From: Andrea Bianco Date: Tue, 11 Jan 2022 12:28:14 +0000 (+0100) Subject: Built motion from commit 0900f080.|2.5.45 X-Git-Tag: 2.5.45 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/%7B%7Bhash%7D%7D/%22?a=commitdiff_plain;h=cc5ed542bde40ef5cb950540b6a10b4f2d3f9dc8;p=motion2.git Built motion from commit 0900f080.|2.5.45 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 5c66864..fb1ed6d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.5.44", + "version": "2.5.45", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-10T19:32:14.880Z", + "time": "2022-01-11T12:20:58.044Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 11497d3..55c2a21 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.5.44", + "version": "2.5.45", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-10T19:32:14.880Z", + "time": "2022-01-11T12:20:58.044Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index 4785d85..98d9d39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.5.44", + "version": "2.5.45", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index a92b59e..e5afcd2 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 _0x8bf3=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x356f2a,_0x44420d){var _0x570af9=function(_0x41511c){while(--_0x41511c){_0x356f2a['push'](_0x356f2a['shift']());}};_0x570af9(++_0x44420d);}(_0x8bf3,0x130));var _0x38bf=function(_0x31956d,_0x2c291f){_0x31956d=_0x31956d-0x0;var _0x15bd5e=_0x8bf3[_0x31956d];return _0x15bd5e;};'use strict';var Sequelize=require(_0x38bf('0x0'));module[_0x38bf('0x1')]={'name':{'type':Sequelize[_0x38bf('0x2')],'get':function(_0x2aa2b3){return this[_0x38bf('0x3')](_0x38bf('0x4'));}},'action':{'type':Sequelize[_0x38bf('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x38bf('0x6'),_0x38bf('0x7'),'motionbar',_0x38bf('0x8'),_0x38bf('0x9'),_0x38bf('0xa'),'bot',_0x38bf('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x38bf('0xc')},'data1':{'type':Sequelize[_0x38bf('0x5')](0x1000),'comment':_0x38bf('0xd')},'data2':{'type':Sequelize[_0x38bf('0x5')](0x1000),'comment':_0x38bf('0xe')},'data3':{'type':Sequelize[_0x38bf('0x5')](0x1000),'comment':_0x38bf('0xf')},'data4':{'type':Sequelize[_0x38bf('0x5')](0x1000),'comments':_0x38bf('0x10')},'data5':{'type':Sequelize[_0x38bf('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x38bf('0x11')},'data7':{'type':Sequelize[_0x38bf('0x12')],'comments':_0x38bf('0x13')}}; \ No newline at end of file +var _0x9d61=['urlForward','browser','bot','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x9d61,0xbe));var _0x19d6=function(_0x4bd59c,_0x5a72a5){_0x4bd59c=_0x4bd59c-0x0;var _0x5d0ae4=_0x9d61[_0x4bd59c];return _0x5d0ae4;};'use strict';var Sequelize=require(_0x19d6('0x0'));module[_0x19d6('0x1')]={'name':{'type':Sequelize[_0x19d6('0x2')],'get':function(_0x484314){return this[_0x19d6('0x3')](_0x19d6('0x4'));}},'action':{'type':Sequelize[_0x19d6('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x19d6('0x6'),_0x19d6('0x7'),_0x19d6('0x8'),_0x19d6('0x9'),_0x19d6('0xa'),_0x19d6('0xb'),_0x19d6('0xc'),_0x19d6('0xd')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x19d6('0xe')},'data2':{'type':Sequelize[_0x19d6('0x5')](0x1000),'comment':_0x19d6('0xf')},'data3':{'type':Sequelize[_0x19d6('0x5')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x19d6('0x5')](0x1000),'comments':_0x19d6('0x10')},'data5':{'type':Sequelize[_0x19d6('0x5')](0x1000),'comments':_0x19d6('0x11')},'data6':{'type':Sequelize[_0x19d6('0x5')],'comments':_0x19d6('0x12')},'data7':{'type':Sequelize[_0x19d6('0x13')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index cf574bf..0022507 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 _0x3eec=['body','find','params','catch','destroy','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','end','sendStatus','error','stack','name'];(function(_0x85e154,_0x37d630){var _0x407ad8=function(_0x484cb2){while(--_0x484cb2){_0x85e154['push'](_0x85e154['shift']());}};_0x407ad8(++_0x37d630);}(_0x3eec,0x19b));var _0xc3ee=function(_0x202b74,_0x31a505){_0x202b74=_0x202b74-0x0;var _0x114116=_0x3eec[_0x202b74];return _0x114116;};'use strict';var emlformat=require(_0xc3ee('0x0'));var rimraf=require(_0xc3ee('0x1'));var zipdir=require(_0xc3ee('0x2'));var jsonpatch=require(_0xc3ee('0x3'));var rp=require(_0xc3ee('0x4'));var moment=require(_0xc3ee('0x5'));var BPromise=require(_0xc3ee('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc3ee('0x7'));var sox=require(_0xc3ee('0x8'));var csv=require(_0xc3ee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3ee('0xa'));var squel=require(_0xc3ee('0xb'));var crypto=require('crypto');var jsforce=require(_0xc3ee('0xc'));var deskjs=require(_0xc3ee('0xd'));var toCsv=require(_0xc3ee('0x9'));var querystring=require('querystring');var Papa=require(_0xc3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xc3ee('0xf'));var qs=require(_0xc3ee('0x10'));var as=require(_0xc3ee('0x11'));var hardwareService=require(_0xc3ee('0x12'));var logger=require('../../config/logger')(_0xc3ee('0x13'));var utils=require(_0xc3ee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc3ee('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283a22,_0x42abb6){_0x42abb6=_0x42abb6||0xcc;return function(_0x3250a4){if(_0x3250a4){return _0x283a22['sendStatus'](_0x42abb6);}return _0x283a22[_0xc3ee('0x16')](_0x42abb6)['end']();};}function respondWithResult(_0x5a885d,_0x219dbf){_0x219dbf=_0x219dbf||0xc8;return function(_0x20e5db){if(_0x20e5db){return _0x5a885d['status'](_0x219dbf)['json'](_0x20e5db);}};}function respondWithFilteredResult(_0x794ddd,_0x4d9e97){return function(_0x168ab6){if(_0x168ab6){var _0x187af4=typeof _0x4d9e97[_0xc3ee('0x17')]==='undefined'&&typeof _0x4d9e97[_0xc3ee('0x18')]===_0xc3ee('0x19');var _0x272285=_0x168ab6[_0xc3ee('0x1a')];var _0x4071fe=_0x187af4?0x0:_0x4d9e97[_0xc3ee('0x17')];var _0x58ca7b=_0x187af4?_0x168ab6[_0xc3ee('0x1a')]:_0x4d9e97['offset']+_0x4d9e97[_0xc3ee('0x18')];var _0x2861ce;if(_0x58ca7b>=_0x272285){_0x58ca7b=_0x272285;_0x2861ce=0xc8;}else{_0x2861ce=0xce;}_0x794ddd[_0xc3ee('0x16')](_0x2861ce);return _0x794ddd[_0xc3ee('0x1b')](_0xc3ee('0x1c'),_0x4071fe+'-'+_0x58ca7b+'/'+_0x272285)[_0xc3ee('0x1d')](_0x168ab6);}return null;};}function patchUpdates(_0x1c4d52){return function(_0x409e70){try{jsonpatch['apply'](_0x409e70,_0x1c4d52,!![]);}catch(_0x4b4673){return BPromise[_0xc3ee('0x1e')](_0x4b4673);}return _0x409e70[_0xc3ee('0x1f')]();};}function saveUpdates(_0x9750b5,_0x418bb0){return function(_0x5b147b){if(_0x5b147b){return _0x5b147b[_0xc3ee('0x20')](_0x9750b5)['then'](function(_0x36f00f){return _0x36f00f;});}return null;};}function removeEntity(_0x2420dc,_0xe777c9){return function(_0x4438ea){if(_0x4438ea){return _0x4438ea['destroy']()[_0xc3ee('0x21')](function(){_0x2420dc[_0xc3ee('0x16')](0xcc)[_0xc3ee('0x22')]();});}};}function handleEntityNotFound(_0x4d1a92,_0x2ae7ee){return function(_0x499e75){if(!_0x499e75){_0x4d1a92[_0xc3ee('0x23')](0x194);}return _0x499e75;};}function handleError(_0xfd7669,_0x465a5f){_0x465a5f=_0x465a5f||0x1f4;return function(_0x43c6a3){logger[_0xc3ee('0x24')](_0x43c6a3[_0xc3ee('0x25')]);if(_0x43c6a3[_0xc3ee('0x26')]){delete _0x43c6a3[_0xc3ee('0x26')];}_0xfd7669['status'](_0x465a5f)['send'](_0x43c6a3);};}exports[_0xc3ee('0x20')]=function(_0x21e808,_0x31ffbd){if(_0x21e808[_0xc3ee('0x27')]['id']){delete _0x21e808['body']['id'];}return db['Action'][_0xc3ee('0x28')]({'where':{'id':_0x21e808[_0xc3ee('0x29')]['id']}})[_0xc3ee('0x21')](handleEntityNotFound(_0x31ffbd,null))['then'](saveUpdates(_0x21e808[_0xc3ee('0x27')],null))[_0xc3ee('0x21')](respondWithResult(_0x31ffbd,null))[_0xc3ee('0x2a')](handleError(_0x31ffbd,null));};exports[_0xc3ee('0x2b')]=function(_0x256623,_0x2707d3){return db[_0xc3ee('0x2c')]['find']({'where':{'id':_0x256623[_0xc3ee('0x29')]['id']}})[_0xc3ee('0x21')](handleEntityNotFound(_0x2707d3,null))['then'](removeEntity(_0x2707d3,null))[_0xc3ee('0x2a')](handleError(_0x2707d3,null));}; \ No newline at end of file +var _0x09a4=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x50a330,_0x2e003c){var _0x475636=function(_0x1ce9ab){while(--_0x1ce9ab){_0x50a330['push'](_0x50a330['shift']());}};_0x475636(++_0x2e003c);}(_0x09a4,0x101));var _0x409a=function(_0x7555db,_0x28062d){_0x7555db=_0x7555db-0x0;var _0x2a2f0b=_0x09a4[_0x7555db];return _0x2a2f0b;};'use strict';var emlformat=require(_0x409a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x409a('0x1'));var jsonpatch=require(_0x409a('0x2'));var rp=require(_0x409a('0x3'));var moment=require(_0x409a('0x4'));var BPromise=require(_0x409a('0x5'));var Mustache=require(_0x409a('0x6'));var util=require(_0x409a('0x7'));var path=require(_0x409a('0x8'));var sox=require(_0x409a('0x9'));var csv=require(_0x409a('0xa'));var ejs=require(_0x409a('0xb'));var fs=require('fs');var fs_extra=require(_0x409a('0xc'));var _=require(_0x409a('0xd'));var squel=require(_0x409a('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x409a('0xa'));var querystring=require(_0x409a('0xf'));var Papa=require(_0x409a('0x10'));var Redis=require('ioredis');var authService=require(_0x409a('0x11'));var qs=require(_0x409a('0x12'));var as=require(_0x409a('0x13'));var hardwareService=require(_0x409a('0x14'));var logger=require(_0x409a('0x15'))('api');var utils=require(_0x409a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x409a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a776b,_0xe5bdc6){_0xe5bdc6=_0xe5bdc6||0xcc;return function(_0xdbc164){if(_0xdbc164){return _0x5a776b[_0x409a('0x18')](_0xe5bdc6);}return _0x5a776b[_0x409a('0x19')](_0xe5bdc6)[_0x409a('0x1a')]();};}function respondWithResult(_0x106ee2,_0x56ee6b){_0x56ee6b=_0x56ee6b||0xc8;return function(_0x2c23b8){if(_0x2c23b8){return _0x106ee2[_0x409a('0x19')](_0x56ee6b)['json'](_0x2c23b8);}};}function respondWithFilteredResult(_0x13c49d,_0x1f3d8d){return function(_0x8bc622){if(_0x8bc622){var _0x40cd47=typeof _0x1f3d8d['offset']===_0x409a('0x1b')&&typeof _0x1f3d8d[_0x409a('0x1c')]===_0x409a('0x1b');var _0x2f259e=_0x8bc622[_0x409a('0x1d')];var _0x197512=_0x40cd47?0x0:_0x1f3d8d[_0x409a('0x1e')];var _0x493cac=_0x40cd47?_0x8bc622['count']:_0x1f3d8d[_0x409a('0x1e')]+_0x1f3d8d['limit'];var _0x508ab4;if(_0x493cac>=_0x2f259e){_0x493cac=_0x2f259e;_0x508ab4=0xc8;}else{_0x508ab4=0xce;}_0x13c49d[_0x409a('0x19')](_0x508ab4);return _0x13c49d[_0x409a('0x1f')](_0x409a('0x20'),_0x197512+'-'+_0x493cac+'/'+_0x2f259e)[_0x409a('0x21')](_0x8bc622);}return null;};}function patchUpdates(_0x91a761){return function(_0x13b45e){try{jsonpatch[_0x409a('0x22')](_0x13b45e,_0x91a761,!![]);}catch(_0x563471){return BPromise[_0x409a('0x23')](_0x563471);}return _0x13b45e[_0x409a('0x24')]();};}function saveUpdates(_0x2a8595,_0x1a0c97){return function(_0x3fe16b){if(_0x3fe16b){return _0x3fe16b[_0x409a('0x25')](_0x2a8595)[_0x409a('0x26')](function(_0x5dd2f4){return _0x5dd2f4;});}return null;};}function removeEntity(_0x39f0ec,_0x41c25e){return function(_0x180c36){if(_0x180c36){return _0x180c36[_0x409a('0x27')]()['then'](function(){_0x39f0ec['status'](0xcc)[_0x409a('0x1a')]();});}};}function handleEntityNotFound(_0x3203e1,_0x3d9ca1){return function(_0x4df9f0){if(!_0x4df9f0){_0x3203e1['sendStatus'](0x194);}return _0x4df9f0;};}function handleError(_0x27a0fd,_0x366dc8){_0x366dc8=_0x366dc8||0x1f4;return function(_0x56ce68){logger[_0x409a('0x28')](_0x56ce68[_0x409a('0x29')]);if(_0x56ce68[_0x409a('0x2a')]){delete _0x56ce68['name'];}_0x27a0fd[_0x409a('0x19')](_0x366dc8)['send'](_0x56ce68);};}exports[_0x409a('0x25')]=function(_0x1b10d7,_0x5a4298){if(_0x1b10d7[_0x409a('0x2b')]['id']){delete _0x1b10d7[_0x409a('0x2b')]['id'];}return db[_0x409a('0x2c')]['find']({'where':{'id':_0x1b10d7[_0x409a('0x2d')]['id']}})[_0x409a('0x26')](handleEntityNotFound(_0x5a4298,null))['then'](saveUpdates(_0x1b10d7['body'],null))[_0x409a('0x26')](respondWithResult(_0x5a4298,null))[_0x409a('0x2e')](handleError(_0x5a4298,null));};exports['destroy']=function(_0x5b6ed9,_0x25e7d7){return db[_0x409a('0x2c')][_0x409a('0x2f')]({'where':{'id':_0x5b6ed9[_0x409a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x25e7d7,null))[_0x409a('0x26')](removeEntity(_0x25e7d7,null))['catch'](handleError(_0x25e7d7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 68be4a1..707df75 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 _0x32c4=['bluebird','exports','define','Action','tools_actions','lodash','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x32c4,0x1a9));var _0x432c=function(_0xdc0641,_0x1dc55c){_0xdc0641=_0xdc0641-0x0;var _0x3eb12a=_0x32c4[_0xdc0641];return _0x3eb12a;};'use strict';var _=require(_0x432c('0x0'));var util=require('util');var logger=require(_0x432c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x432c('0x2'));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('./action.attributes');module[_0x432c('0x3')]=function(_0x5d9ee7,_0x4ce3c1){return _0x5d9ee7[_0x432c('0x4')](_0x432c('0x5'),attributes,{'tableName':_0x432c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ee=['./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c1e10,_0x43facd){var _0x5abcb9=function(_0x5be39b){while(--_0x5be39b){_0x2c1e10['push'](_0x2c1e10['shift']());}};_0x5abcb9(++_0x43facd);}(_0xc4ee,0x147));var _0xec4e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4ee[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec4e('0x0'));var util=require(_0xec4e('0x1'));var logger=require(_0xec4e('0x2'))(_0xec4e('0x3'));var moment=require('moment');var BPromise=require(_0xec4e('0x4'));var rp=require(_0xec4e('0x5'));var fs=require('fs');var path=require(_0xec4e('0x6'));var rimraf=require(_0xec4e('0x7'));var config=require(_0xec4e('0x8'));var attributes=require(_0xec4e('0x9'));module[_0xec4e('0xa')]=function(_0x4cd36c,_0xf8ec68){return _0x4cd36c[_0xec4e('0xb')](_0xec4e('0xc'),attributes,{'tableName':_0xec4e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 441bb9e..d3e78dd 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3cb37b,_0x2a19b6){var _0x25dd6f=function(_0x3a9e66){while(--_0x3a9e66){_0x3cb37b['push'](_0x3cb37b['shift']());}};_0x25dd6f(++_0x2a19b6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x23cb6e,_0x1e024d){_0x23cb6e=_0x23cb6e-0x0;var _0x148e51=_0x8ef6[_0x23cb6e];return _0x148e51;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0xf494,0x1c6));var _0x4f49=function(_0x5e5341,_0x5acb9e){_0x5e5341=_0x5e5341-0x0;var _0x589414=_0xf494[_0x5e5341];return _0x589414;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 285fe5c..513bc75 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 _0x9ce3=['../../components/interaction/service','../../config/environment','./action.controller','/:id','update','isAuthenticated','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x5d5ff1,_0x3394d0){var _0x4840e0=function(_0xfdba9c){while(--_0xfdba9c){_0x5d5ff1['push'](_0x5d5ff1['shift']());}};_0x4840e0(++_0x3394d0);}(_0x9ce3,0x11b));var _0x39ce=function(_0x481604,_0x276ff8){_0x481604=_0x481604-0x0;var _0x1ca4ed=_0x9ce3[_0x481604];return _0x1ca4ed;};'use strict';var multer=require(_0x39ce('0x0'));var util=require(_0x39ce('0x1'));var path=require('path');var timeout=require(_0x39ce('0x2'));var express=require(_0x39ce('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x39ce('0x4'));var interaction=require(_0x39ce('0x5'));var config=require(_0x39ce('0x6'));var controller=require(_0x39ce('0x7'));router['put'](_0x39ce('0x8'),auth['isAuthenticated'](),controller[_0x39ce('0x9')]);router['delete'](_0x39ce('0x8'),auth[_0x39ce('0xa')](),controller['destroy']);module[_0x39ce('0xb')]=router; \ No newline at end of file +var _0x2c31=['../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c31,0x12a));var _0x12c3=function(_0x164a85,_0x89fc3f){_0x164a85=_0x164a85-0x0;var _0x288b6e=_0x2c31[_0x164a85];return _0x288b6e;};'use strict';var multer=require(_0x12c3('0x0'));var util=require(_0x12c3('0x1'));var path=require(_0x12c3('0x2'));var timeout=require(_0x12c3('0x3'));var express=require(_0x12c3('0x4'));var router=express[_0x12c3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x12c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x12c3('0x7'));var controller=require(_0x12c3('0x8'));router[_0x12c3('0x9')]('/:id',auth[_0x12c3('0xa')](),controller[_0x12c3('0xb')]);router[_0x12c3('0xc')](_0x12c3('0xd'),auth['isAuthenticated'](),controller[_0x12c3('0xe')]);module[_0x12c3('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 db263be..09aaf21 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 _0xbd51=['sequelize','STRING'];(function(_0x1c66f1,_0x53c85c){var _0x682d89=function(_0x2e0036){while(--_0x2e0036){_0x1c66f1['push'](_0x1c66f1['shift']());}};_0x682d89(++_0x53c85c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3e3e6b,_0x906f3c){_0x3e3e6b=_0x3e3e6b-0x0;var _0x51e019=_0xbd51[_0x3e3e6b];return _0x51e019;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x24d0e5,_0x202a86){var _0x429111=function(_0x29cde9){while(--_0x29cde9){_0x24d0e5['push'](_0x24d0e5['shift']());}};_0x429111(++_0x202a86);}(_0xeda8,0x104));var _0x8eda=function(_0x33932f,_0x47282e){_0x33932f=_0x33932f-0x0;var _0x5b679a=_0xeda8[_0x33932f];return _0x5b679a;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index fb77a03..dcd928d 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 _0xd4dc=['userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','length','rules','group','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','function','format','groupBy','orderBy','field','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','cross_join','SUM(%s)','DATE(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','value','ValidationErrorItem','keyBy','MetricId','metric','replace','DESC','alias','clone','web','fullPath','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','fork','output','../../files/reports','savename','from','countTable','COUNT(*)','QueryTypes','runReport','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','destroy','sendStatus','error','stack','name','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4dc,0xff));var _0xcd4d=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xd4dc[_0x3e44fa];return _0x2a0aba;};'use strict';var emlformat=require(_0xcd4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd4d('0x1'));var jsonpatch=require(_0xcd4d('0x2'));var rp=require(_0xcd4d('0x3'));var moment=require(_0xcd4d('0x4'));var BPromise=require(_0xcd4d('0x5'));var Mustache=require(_0xcd4d('0x6'));var util=require(_0xcd4d('0x7'));var path=require('path');var sox=require(_0xcd4d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd4d('0x9'));var _=require('lodash');var squel=require(_0xcd4d('0xa'));var crypto=require(_0xcd4d('0xb'));var jsforce=require(_0xcd4d('0xc'));var deskjs=require(_0xcd4d('0xd'));var toCsv=require(_0xcd4d('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd4d('0xf'));var authService=require(_0xcd4d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcd4d('0x11'));var hardwareService=require(_0xcd4d('0x12'));var logger=require(_0xcd4d('0x13'))('api');var utils=require(_0xcd4d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd4d('0x15'));var db=require(_0xcd4d('0x16'))['db'];var dbH=require(_0xcd4d('0x16'))[_0xcd4d('0x17')];function respondWithStatusCode(_0x10fb9e,_0x5c3c00){_0x5c3c00=_0x5c3c00||0xcc;return function(_0x47db1a){if(_0x47db1a){return _0x10fb9e['sendStatus'](_0x5c3c00);}return _0x10fb9e[_0xcd4d('0x18')](_0x5c3c00)[_0xcd4d('0x19')]();};}function respondWithResult(_0x36afd0,_0x3f9724){_0x3f9724=_0x3f9724||0xc8;return function(_0x1fc419){if(_0x1fc419){return _0x36afd0[_0xcd4d('0x18')](_0x3f9724)[_0xcd4d('0x1a')](_0x1fc419);}};}function respondWithFilteredResult(_0x3cf713,_0x27bf0c){return function(_0xbddbe){if(_0xbddbe){var _0x5e7ae1=typeof _0x27bf0c[_0xcd4d('0x1b')]===_0xcd4d('0x1c')&&typeof _0x27bf0c[_0xcd4d('0x1d')]===_0xcd4d('0x1c');var _0x470e42=_0xbddbe[_0xcd4d('0x1e')];var _0x32ac99=_0x5e7ae1?0x0:_0x27bf0c[_0xcd4d('0x1b')];var _0x138d00=_0x5e7ae1?_0xbddbe[_0xcd4d('0x1e')]:_0x27bf0c[_0xcd4d('0x1b')]+_0x27bf0c[_0xcd4d('0x1d')];var _0x346bd3;if(_0x138d00>=_0x470e42){_0x138d00=_0x470e42;_0x346bd3=0xc8;}else{_0x346bd3=0xce;}_0x3cf713['status'](_0x346bd3);return _0x3cf713[_0xcd4d('0x1f')](_0xcd4d('0x20'),_0x32ac99+'-'+_0x138d00+'/'+_0x470e42)[_0xcd4d('0x1a')](_0xbddbe);}return null;};}function patchUpdates(_0x1b149e){return function(_0x2a4ee3){try{jsonpatch[_0xcd4d('0x21')](_0x2a4ee3,_0x1b149e,!![]);}catch(_0x2a143e){return BPromise[_0xcd4d('0x22')](_0x2a143e);}return _0x2a4ee3[_0xcd4d('0x23')]();};}function saveUpdates(_0x1f3e88,_0x6998){return function(_0x502fd5){if(_0x502fd5){return _0x502fd5[_0xcd4d('0x24')](_0x1f3e88)['then'](function(_0x1f7026){return _0x1f7026;});}return null;};}function removeEntity(_0x770ec6,_0x58cade){return function(_0x367aa1){if(_0x367aa1){return _0x367aa1['destroy']()[_0xcd4d('0x25')](function(){var _0xdc7660=_0x367aa1[_0xcd4d('0x26')]({'plain':!![]});var _0x512774='CustomReports';return db['UserProfileResource'][_0xcd4d('0x27')]({'where':{'type':_0x512774,'resourceId':_0xdc7660['id']}})[_0xcd4d('0x25')](function(){return _0x367aa1;});})[_0xcd4d('0x25')](function(){_0x770ec6[_0xcd4d('0x18')](0xcc)[_0xcd4d('0x19')]();});}};}function handleEntityNotFound(_0x4d5c84,_0x50f031){return function(_0x28da5c){if(!_0x28da5c){_0x4d5c84[_0xcd4d('0x28')](0x194);}return _0x28da5c;};}function handleError(_0x4adcb5,_0x1ab2ed){_0x1ab2ed=_0x1ab2ed||0x1f4;return function(_0x893333){logger[_0xcd4d('0x29')](_0x893333[_0xcd4d('0x2a')]);if(_0x893333[_0xcd4d('0x2b')]){delete _0x893333[_0xcd4d('0x2b')];}_0x4adcb5[_0xcd4d('0x18')](_0x1ab2ed)['send'](_0x893333);};}exports[_0xcd4d('0x2c')]=function(_0x10bdfa,_0x4a2cf4){var _0xe150ec={},_0x490012={},_0x4e45b7={'count':0x0,'rows':[]};var _0x449e3a=_['map'](db[_0xcd4d('0x2d')][_0xcd4d('0x2e')],function(_0x9eae4b){return{'name':_0x9eae4b[_0xcd4d('0x2f')],'type':_0x9eae4b[_0xcd4d('0x30')][_0xcd4d('0x31')]};});_0x490012[_0xcd4d('0x32')]=_[_0xcd4d('0x33')](_0x449e3a,_0xcd4d('0x2b'));_0x490012[_0xcd4d('0x34')]=_[_0xcd4d('0x35')](_0x10bdfa[_0xcd4d('0x34')]);_0x490012[_0xcd4d('0x36')]=_[_0xcd4d('0x37')](_0x490012[_0xcd4d('0x32')],_0x490012[_0xcd4d('0x34')]);_0xe150ec[_0xcd4d('0x38')]=_[_0xcd4d('0x37')](_0x490012['model'],qs[_0xcd4d('0x39')](_0x10bdfa['query'][_0xcd4d('0x39')]));_0xe150ec[_0xcd4d('0x38')]=_0xe150ec[_0xcd4d('0x38')]['length']?_0xe150ec['attributes']:_0x490012[_0xcd4d('0x32')];if(!_0x10bdfa['query'][_0xcd4d('0x3a')](_0xcd4d('0x3b'))){_0xe150ec[_0xcd4d('0x1d')]=qs[_0xcd4d('0x1d')](_0x10bdfa[_0xcd4d('0x34')][_0xcd4d('0x1d')]);_0xe150ec['offset']=qs[_0xcd4d('0x1b')](_0x10bdfa[_0xcd4d('0x34')][_0xcd4d('0x1b')]);}_0xe150ec['order']=qs[_0xcd4d('0x3c')](_0x10bdfa[_0xcd4d('0x34')][_0xcd4d('0x3c')]);_0xe150ec[_0xcd4d('0x3d')]=qs['filters'](_[_0xcd4d('0x3e')](_0x10bdfa[_0xcd4d('0x34')],_0x490012['filters']),_0x449e3a);if(_0x10bdfa[_0xcd4d('0x34')][_0xcd4d('0x3f')]){_0xe150ec['where']=_['merge'](_0xe150ec[_0xcd4d('0x3d')],{'$or':_[_0xcd4d('0x33')](_0x449e3a,function(_0x2928fb){if(_0x2928fb[_0xcd4d('0x30')]!==_0xcd4d('0x40')){var _0x123413={};_0x123413[_0x2928fb[_0xcd4d('0x2b')]]={'$like':'%'+_0x10bdfa[_0xcd4d('0x34')]['filter']+'%'};return _0x123413;}})});}_0xe150ec=_['merge']({},_0xe150ec,_0x10bdfa[_0xcd4d('0x41')]);var _0x5587c7={'where':_0xe150ec[_0xcd4d('0x3d')]};return db[_0xcd4d('0x2d')][_0xcd4d('0x1e')](_0x5587c7)[_0xcd4d('0x25')](function(_0x2d4075){_0x4e45b7[_0xcd4d('0x1e')]=_0x2d4075;if(_0x10bdfa['query'][_0xcd4d('0x42')]){_0xe150ec[_0xcd4d('0x43')]=[{'all':!![]}];}return db[_0xcd4d('0x2d')][_0xcd4d('0x44')](_0xe150ec);})[_0xcd4d('0x25')](function(_0x36c18a){_0x4e45b7[_0xcd4d('0x45')]=_0x36c18a;return _0x4e45b7;})[_0xcd4d('0x25')](respondWithFilteredResult(_0x4a2cf4,_0xe150ec))['catch'](handleError(_0x4a2cf4,null));};exports[_0xcd4d('0x46')]=function(_0x2e1f9a,_0x25ee24){var _0x587ba1={'raw':![],'where':{'id':_0x2e1f9a[_0xcd4d('0x47')]['id']}},_0x2946ad={};_0x2946ad[_0xcd4d('0x32')]=_[_0xcd4d('0x35')](db['AnalyticCustomReport'][_0xcd4d('0x2e')]);_0x2946ad[_0xcd4d('0x34')]=_[_0xcd4d('0x35')](_0x2e1f9a['query']);_0x2946ad[_0xcd4d('0x36')]=_['intersection'](_0x2946ad['model'],_0x2946ad[_0xcd4d('0x34')]);_0x587ba1[_0xcd4d('0x38')]=_[_0xcd4d('0x37')](_0x2946ad[_0xcd4d('0x32')],qs[_0xcd4d('0x39')](_0x2e1f9a['query'][_0xcd4d('0x39')]));_0x587ba1[_0xcd4d('0x38')]=_0x587ba1[_0xcd4d('0x38')]['length']?_0x587ba1['attributes']:_0x2946ad['model'];if(_0x2e1f9a['query'][_0xcd4d('0x42')]){_0x587ba1[_0xcd4d('0x43')]=[{'all':!![]}];}_0x587ba1=_[_0xcd4d('0x48')]({},_0x587ba1,_0x2e1f9a[_0xcd4d('0x41')]);return db[_0xcd4d('0x2d')][_0xcd4d('0x49')](_0x587ba1)[_0xcd4d('0x25')](handleEntityNotFound(_0x25ee24,null))[_0xcd4d('0x25')](respondWithResult(_0x25ee24,null))['catch'](handleError(_0x25ee24,null));};exports['create']=function(_0x1cdf8d,_0x275b3e){return db[_0xcd4d('0x2d')][_0xcd4d('0x4a')](_0x1cdf8d[_0xcd4d('0x4b')],{})['then'](function(_0x140aee){var _0x357d3f=_0x1cdf8d[_0xcd4d('0x4c')]['get']({'plain':!![]});if(!_0x357d3f)throw new Error(_0xcd4d('0x4d'));if(_0x357d3f[_0xcd4d('0x4e')]===_0xcd4d('0x4c')){var _0x10c9a4=_0x140aee[_0xcd4d('0x26')]({'plain':!![]});var _0x32c3a8=_0xcd4d('0x4f');return db[_0xcd4d('0x50')][_0xcd4d('0x49')]({'where':{'name':_0x32c3a8,'userProfileId':_0x357d3f[_0xcd4d('0x51')]},'raw':!![]})[_0xcd4d('0x25')](function(_0x6f1297){if(_0x6f1297&&_0x6f1297[_0xcd4d('0x52')]===0x0){return db['UserProfileResource'][_0xcd4d('0x4a')]({'name':_0x10c9a4['name'],'resourceId':_0x10c9a4['id'],'type':'CustomReports','sectionId':_0x6f1297['id']},{})[_0xcd4d('0x25')](function(){return _0x140aee;});}else{return _0x140aee;}})[_0xcd4d('0x53')](function(_0x2e284b){logger[_0xcd4d('0x29')](_0xcd4d('0x54'),_0x2e284b);throw _0x2e284b;});}return _0x140aee;})[_0xcd4d('0x25')](respondWithResult(_0x275b3e,0xc9))['catch'](handleError(_0x275b3e,null));};exports[_0xcd4d('0x24')]=function(_0x48a17a,_0x1546e0){if(_0x48a17a[_0xcd4d('0x4b')]['id']){delete _0x48a17a[_0xcd4d('0x4b')]['id'];}return db['AnalyticCustomReport'][_0xcd4d('0x49')]({'where':{'id':_0x48a17a[_0xcd4d('0x47')]['id']}})[_0xcd4d('0x25')](handleEntityNotFound(_0x1546e0,null))['then'](saveUpdates(_0x48a17a['body'],null))[_0xcd4d('0x25')](respondWithResult(_0x1546e0,null))[_0xcd4d('0x53')](handleError(_0x1546e0,null));};exports['destroy']=function(_0x260ae8,_0x209d84){return db[_0xcd4d('0x2d')][_0xcd4d('0x49')]({'where':{'id':_0x260ae8[_0xcd4d('0x47')]['id']}})[_0xcd4d('0x25')](handleEntityNotFound(_0x209d84,null))[_0xcd4d('0x25')](removeEntity(_0x209d84,null))[_0xcd4d('0x53')](handleError(_0x209d84,null));};exports[_0xcd4d('0x55')]=function(_0x533312,_0x161170){var _0x1a3b44=0xa;var _0x3e7ab0=[_0xcd4d('0x56'),_0xcd4d('0x57'),_0xcd4d('0x58'),'cross_join'];var _0x5264d2={'SUM':'SUM(%s)','COUNT':_0xcd4d('0x59'),'COUNT DISTINCT':_0xcd4d('0x5a'),'MAX':_0xcd4d('0x5b'),'MIN':_0xcd4d('0x5c'),'AVG':_0xcd4d('0x5d'),'GROUP_CONCAT':_0xcd4d('0x5e'),'GROUP_CONCAT ASC':_0xcd4d('0x5f'),'GROUP_CONCAT DESC':_0xcd4d('0x60')};var _0x25907b={'SEC_TO_TIME':_0xcd4d('0x61'),'DATE':'DATE(%s)','HOUR':_0xcd4d('0x62'),'ROUND':_0xcd4d('0x63'),'UNIX_TIMESTAMP':_0xcd4d('0x64')};var _0x8b8ab8=function(_0x4a6e06){return!_['includes']([_0xcd4d('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xcd4d('0x66')],_0x4a6e06);};var _0x2c1254=function(_0x3074d7){if(!_0x3074d7||!_0x3074d7['rules'][_0xcd4d('0x67')]){return'';}for(var _0x4ac793='(',_0x13e223=0x0;_0x13e223<_0x3074d7[_0xcd4d('0x68')][_0xcd4d('0x67')];_0x13e223+=0x1){_0x13e223>0x0&&(_0x4ac793+='\x20'+_0x3074d7['operator']+'\x20');_0x4ac793+=_0x3074d7['rules'][_0x13e223][_0xcd4d('0x69')]?_0x2c1254(_0x3074d7[_0xcd4d('0x68')][_0x13e223]['group']):_0x3074d7[_0xcd4d('0x68')][_0x13e223]['field']+'\x20'+_0x3074d7[_0xcd4d('0x68')][_0x13e223]['condition']+(_0x8b8ab8(_0x3074d7[_0xcd4d('0x68')][_0x13e223][_0xcd4d('0x6a')])?'\x20'+_0x3074d7[_0xcd4d('0x68')][_0x13e223]['value']:'');}return _0x4ac793+')';};var _0xfff2fb={'where':{'id':_0x533312['params']['id']}},_0x2adf9c,_0x52989f,_0x345484,_0x11fa3c,_0x180399;_0xfff2fb=_[_0xcd4d('0x48')]({},_0xfff2fb,_0x533312[_0xcd4d('0x41')]);return db[_0xcd4d('0x2d')][_0xcd4d('0x49')](_0xfff2fb)['then'](function(_0x575e2a){if(_0x575e2a){_0x2adf9c=_0x575e2a;return _0x575e2a[_0xcd4d('0x6b')]();}return null;})[_0xcd4d('0x25')](function(_0x4fda50){if(_0x4fda50){if(!_0x4fda50['length']){throw new db[(_0xcd4d('0x6c'))]['ValidationErrorItem'](_0xcd4d('0x6d'),0x193);}_0x52989f=_0x4fda50;return db[_0xcd4d('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xcd4d('0x25')](function(_0x1cb0a9){if(_0x1cb0a9){_0x345484=_['keyBy'](_0x1cb0a9,'id');var _0x25cd0c;var _0x1a2169=squel[_0xcd4d('0x6f')]();_0x1a2169['from'](_0x2adf9c[_0xcd4d('0x70')]);for(var _0x3ec9e1=0x0;_0x3ec9e1<_0x52989f['length'];_0x3ec9e1+=0x1){_0x25cd0c=_0x52989f[_0x3ec9e1]['MetricId']?_0x345484[_0x52989f[_0x3ec9e1]['MetricId']]['metric']:_0x52989f[_0x3ec9e1]['field'];_0x25cd0c=_0x52989f[_0x3ec9e1]['function']?_['replace'](_0x5264d2[_0x52989f[_0x3ec9e1][_0xcd4d('0x71')]],'%s',_0x25cd0c):_0x25cd0c;_0x25cd0c=_0x52989f[_0x3ec9e1][_0xcd4d('0x72')]?_['replace'](_0x25907b[_0x52989f[_0x3ec9e1]['format']],'%s',_0x25cd0c):_0x25cd0c;if(_0x52989f[_0x3ec9e1][_0xcd4d('0x73')]){_0x1a2169[_0xcd4d('0x69')](_0x25cd0c);}_0x52989f[_0x3ec9e1][_0xcd4d('0x74')]&&_0x1a2169['order'](_0x25cd0c,_0x52989f[_0x3ec9e1][_0xcd4d('0x74')]==='DESC'?![]:!![]);_0x1a2169[_0xcd4d('0x75')](_0x25cd0c,_0x52989f[_0x3ec9e1]['alias']||_0x25cd0c);}if(_0x2adf9c[_0xcd4d('0x76')]){_0x2adf9c[_0xcd4d('0x76')]=JSON[_0xcd4d('0x77')](_0x2adf9c[_0xcd4d('0x76')]);for(var _0x32b4a9=0x0;_0x32b4a9<_0x2adf9c[_0xcd4d('0x76')][_0xcd4d('0x67')];_0x32b4a9+=0x1){if(_0x2adf9c['joins'][_0x32b4a9][_0xcd4d('0x30')]&&_[_0xcd4d('0x78')](_0x3e7ab0,_0x2adf9c[_0xcd4d('0x76')][_0x32b4a9]['type'])&&_0x2adf9c[_0xcd4d('0x76')][_0x32b4a9][_0xcd4d('0x79')]&&_0x2adf9c[_0xcd4d('0x76')][_0x32b4a9][_0xcd4d('0x7a')]&&_0x2adf9c['joins'][_0x32b4a9][_0xcd4d('0x7b')]){_0x1a2169[_0x2adf9c[_0xcd4d('0x76')][_0x32b4a9][_0xcd4d('0x30')]](_0x2adf9c['joins'][_0x32b4a9][_0xcd4d('0x7a')],null,util[_0xcd4d('0x72')](_0xcd4d('0x7c'),_0x2adf9c['table'],_0x2adf9c[_0xcd4d('0x76')][_0x32b4a9]['parentKey'],_0x2adf9c[_0xcd4d('0x76')][_0x32b4a9][_0xcd4d('0x7a')],_0x2adf9c['joins'][_0x32b4a9][_0xcd4d('0x7b')]));}}}if(_0x2adf9c['conditions']){_0x2adf9c[_0xcd4d('0x7d')]=JSON['parse'](_0x2adf9c[_0xcd4d('0x7d')]);_0x1a2169[_0xcd4d('0x3d')](_0x2c1254(_0x2adf9c[_0xcd4d('0x7d')][_0xcd4d('0x69')]));}_0x180399=_0x1a2169['clone']();_0x1a2169[_0xcd4d('0x1d')](_0x1a3b44);_0x1a2169[_0xcd4d('0x1b')](0x0);logger[_0xcd4d('0x7e')](_0xcd4d('0x7f'),_0x1a2169[_0xcd4d('0x80')]());return dbH[_0xcd4d('0x81')][_0xcd4d('0x34')](_0x1a2169[_0xcd4d('0x80')](),{'type':dbH[_0xcd4d('0x81')]['QueryTypes'][_0xcd4d('0x82')]});}})[_0xcd4d('0x25')](respondWithResult(_0x161170,null))[_0xcd4d('0x53')](handleError(_0x161170,null));};function runReport(_0xd894d3,_0x1d9e82,_0x251fbf){var _0x4fc71d=_0x1d9e82[_0xcd4d('0x2b')];var _0x1a84bd=0xa;var _0x4574b5=['join',_0xcd4d('0x57'),'right_join',_0xcd4d('0x83')];var _0x4df240={'SUM':_0xcd4d('0x84'),'COUNT':_0xcd4d('0x59'),'COUNT DISTINCT':_0xcd4d('0x5a'),'MAX':_0xcd4d('0x5b'),'MIN':_0xcd4d('0x5c'),'AVG':_0xcd4d('0x5d'),'GROUP_CONCAT':_0xcd4d('0x5e'),'GROUP_CONCAT ASC':_0xcd4d('0x5f'),'GROUP_CONCAT DESC':_0xcd4d('0x60')};var _0x982a4e={'SEC_TO_TIME':_0xcd4d('0x61'),'DATE':_0xcd4d('0x85'),'HOUR':_0xcd4d('0x62'),'ROUND':_0xcd4d('0x63'),'UNIX_TIMESTAMP':_0xcd4d('0x64')};var _0x151fa6=function(_0x2daaee){return!_[_0xcd4d('0x78')](['IS\x20NULL',_0xcd4d('0x86'),_0xcd4d('0x87'),_0xcd4d('0x66')],_0x2daaee);};var _0x1d3c94=function(_0x2868be){if(!_0x2868be||!_0x2868be[_0xcd4d('0x68')]['length']){return'';}for(var _0x413735='(',_0x37f5ad=0x0;_0x37f5ad<_0x2868be[_0xcd4d('0x68')]['length'];_0x37f5ad+=0x1){_0x37f5ad>0x0&&(_0x413735+='\x20'+_0x2868be[_0xcd4d('0x88')]+'\x20');_0x413735+=_0x2868be[_0xcd4d('0x68')][_0x37f5ad][_0xcd4d('0x69')]?_0x1d3c94(_0x2868be['rules'][_0x37f5ad][_0xcd4d('0x69')]):_0x2868be[_0xcd4d('0x68')][_0x37f5ad][_0xcd4d('0x75')]+'\x20'+_0x2868be[_0xcd4d('0x68')][_0x37f5ad][_0xcd4d('0x6a')]+(_0x151fa6(_0x2868be[_0xcd4d('0x68')][_0x37f5ad][_0xcd4d('0x6a')])?'\x20'+_0x2868be[_0xcd4d('0x68')][_0x37f5ad][_0xcd4d('0x89')]:'');}return _0x413735+')';};var _0x23d707={'where':{'id':_0xd894d3['id']}},_0x5e90bb,_0x359dd7,_0x845661,_0x5f20a4,_0x2ec203;_0x23d707=_[_0xcd4d('0x48')]({},_0x23d707,_0x251fbf);return db['AnalyticCustomReport'][_0xcd4d('0x49')](_0x23d707)['then'](function(_0x4c7a79){if(_0x4c7a79){_0x5e90bb=_0x4c7a79;return _0x4c7a79['getFields']();}return null;})['then'](function(_0x2d5fe1){if(_0x2d5fe1){if(!_0x2d5fe1[_0xcd4d('0x67')]){throw new db[(_0xcd4d('0x6c'))][(_0xcd4d('0x8a'))](_0xcd4d('0x6d'),0x193);}_0x359dd7=_0x2d5fe1;return db['AnalyticMetric'][_0xcd4d('0x44')]({'raw':!![]});}return null;})['then'](function(_0xdcaa6){if(_0xdcaa6){_0x845661=_[_0xcd4d('0x8b')](_0xdcaa6,'id');var _0x4e88a2;var _0x2bc608=squel[_0xcd4d('0x6f')]();_0x2bc608['from'](_0x5e90bb['table']);for(var _0x525302=0x0;_0x525302<_0x359dd7[_0xcd4d('0x67')];_0x525302+=0x1){_0x4e88a2=_0x359dd7[_0x525302][_0xcd4d('0x8c')]?_0x845661[_0x359dd7[_0x525302]['MetricId']][_0xcd4d('0x8d')]:_0x359dd7[_0x525302][_0xcd4d('0x75')];_0x4e88a2=_0x359dd7[_0x525302][_0xcd4d('0x71')]?_[_0xcd4d('0x8e')](_0x4df240[_0x359dd7[_0x525302]['function']],'%s',_0x4e88a2):_0x4e88a2;_0x4e88a2=_0x359dd7[_0x525302][_0xcd4d('0x72')]?_[_0xcd4d('0x8e')](_0x982a4e[_0x359dd7[_0x525302][_0xcd4d('0x72')]],'%s',_0x4e88a2):_0x4e88a2;if(_0x359dd7[_0x525302][_0xcd4d('0x73')]){_0x2bc608[_0xcd4d('0x69')](_0x4e88a2);}_0x359dd7[_0x525302][_0xcd4d('0x74')]&&_0x2bc608['order'](_0x4e88a2,_0x359dd7[_0x525302][_0xcd4d('0x74')]===_0xcd4d('0x8f')?![]:!![]);_0x2bc608['field'](_0x4e88a2,_0x359dd7[_0x525302][_0xcd4d('0x90')]||_0x4e88a2);}if(_0x5e90bb[_0xcd4d('0x76')]){_0x5e90bb[_0xcd4d('0x76')]=JSON['parse'](_0x5e90bb[_0xcd4d('0x76')]);for(var _0x575384=0x0;_0x575384<_0x5e90bb[_0xcd4d('0x76')][_0xcd4d('0x67')];_0x575384+=0x1){if(_0x5e90bb[_0xcd4d('0x76')][_0x575384][_0xcd4d('0x30')]&&_['includes'](_0x4574b5,_0x5e90bb[_0xcd4d('0x76')][_0x575384][_0xcd4d('0x30')])&&_0x5e90bb[_0xcd4d('0x76')][_0x575384]['parentKey']&&_0x5e90bb[_0xcd4d('0x76')][_0x575384][_0xcd4d('0x7a')]&&_0x5e90bb[_0xcd4d('0x76')][_0x575384][_0xcd4d('0x7b')]){_0x2bc608[_0x5e90bb[_0xcd4d('0x76')][_0x575384][_0xcd4d('0x30')]](_0x5e90bb[_0xcd4d('0x76')][_0x575384]['foreignTable'],null,util[_0xcd4d('0x72')](_0xcd4d('0x7c'),_0x5e90bb['table'],_0x5e90bb[_0xcd4d('0x76')][_0x575384][_0xcd4d('0x79')],_0x5e90bb['joins'][_0x575384][_0xcd4d('0x7a')],_0x5e90bb[_0xcd4d('0x76')][_0x575384]['foreignKey']));}}}if(_0x5e90bb[_0xcd4d('0x7d')]){_0x5e90bb[_0xcd4d('0x7d')]=JSON[_0xcd4d('0x77')](_0x5e90bb['conditions']);_0x2bc608[_0xcd4d('0x3d')](_0x1d3c94(_0x5e90bb[_0xcd4d('0x7d')][_0xcd4d('0x69')]));}_0x2ec203=_0x2bc608[_0xcd4d('0x91')]();_0x2bc608[_0xcd4d('0x1d')](_0x1a84bd);_0x2bc608['offset'](0x0);return;}})[_0xcd4d('0x25')](function(){if(_0x1d9e82['output']===_0xcd4d('0x92')){return null;}var _0x30aa7d=_[_0xcd4d('0x48')](_0x1d9e82,{'name':_0x1d9e82[_0xcd4d('0x93')]||_0x1d9e82[_0xcd4d('0x2b')]||_0x5e90bb['name'],'basename':_0x4fc71d,'savename':util['format']('%s-%s.%s',_0x1d9e82[_0xcd4d('0x2b')]||_0x5e90bb['name'],require('randomstring')[_0xcd4d('0x94')](0x4),_0x1d9e82['output']||_0xcd4d('0x95')),'reportId':_0x5e90bb['id'],'reportType':_0xcd4d('0x96')});return db[_0xcd4d('0x97')][_0xcd4d('0x4a')](_0x30aa7d,{'raw':!![]});})[_0xcd4d('0x25')](function(_0x409393){if(_0x5e90bb[_0xcd4d('0x70')]===_0xcd4d('0x98')){_0x2ec203[_0xcd4d('0x3d')](_0x5e90bb[_0xcd4d('0x70')]+_0xcd4d('0x99'),_0x1d9e82['startDate'],_0x1d9e82[_0xcd4d('0x9a')]);}else{_0x2ec203['where'](_0x5e90bb[_0xcd4d('0x70')]+_0xcd4d('0x9b'),_0x1d9e82[_0xcd4d('0x9c')],_0x1d9e82[_0xcd4d('0x9a')]);}if(_0x409393){logger[_0xcd4d('0x9d')]('Run\x20Query:',_0x2ec203[_0xcd4d('0x80')]());require('child_process')[_0xcd4d('0x9e')](path[_0xcd4d('0x56')](__dirname,'../../components/export/',_0x409393[_0xcd4d('0x9f')]),[_0x409393['id'],_0x2ec203[_0xcd4d('0x80')](),path[_0xcd4d('0x56')](__dirname,_0xcd4d('0xa0'),_0x409393[_0xcd4d('0xa1')]),_0x4fc71d]);return _0x409393;}else{var _0x11591b=squel[_0xcd4d('0x6f')]();_0x11591b[_0xcd4d('0xa2')]('('+_0x2ec203[_0xcd4d('0x80')]()+')',_0xcd4d('0xa3'));_0x11591b[_0xcd4d('0x75')](_0xcd4d('0xa4'),_0xcd4d('0x1e'));_0x2ec203['limit'](_0x1d9e82[_0xcd4d('0x1d')]||_0x1a84bd);_0x2ec203[_0xcd4d('0x1b')](_0x1d9e82[_0xcd4d('0x1b')]||0x0);return dbH['sequelize'][_0xcd4d('0x34')](_0x11591b[_0xcd4d('0x80')](),{'type':dbH['sequelize'][_0xcd4d('0xa5')][_0xcd4d('0x82')]})[_0xcd4d('0x25')](function(_0x35bb7e){if(!_0x35bb7e['length']){_0x5f20a4=0x0;}else{_0x5f20a4=_0x35bb7e[0x0][_0xcd4d('0x1e')]||0x0;}return dbH[_0xcd4d('0x81')]['query'](_0x2ec203[_0xcd4d('0x80')](),{'type':dbH[_0xcd4d('0x81')][_0xcd4d('0xa5')][_0xcd4d('0x82')]});})[_0xcd4d('0x25')](function(_0x199493){return{'rows':_0x199493||[],'count':_0x5f20a4};});}});}exports['run']=function(_0x3bae29,_0x13bcf9){return runReport(_0x3bae29[_0xcd4d('0x47')],_0x3bae29[_0xcd4d('0x34')],_0x3bae29['options'])[_0xcd4d('0x25')](respondWithResult(_0x13bcf9,null))[_0xcd4d('0x53')](handleError(_0x13bcf9,null));};exports[_0xcd4d('0xa6')]=runReport;exports[_0xcd4d('0x34')]=function(_0x1d272a,_0xfbb448){var _0x214a48=0xa;var _0x5ef37f=[_0xcd4d('0x56'),_0xcd4d('0x57'),_0xcd4d('0x58'),_0xcd4d('0x83')];var _0x2c96cd={'SUM':_0xcd4d('0x84'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcd4d('0x5a'),'MAX':'MAX(%s)','MIN':_0xcd4d('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcd4d('0x5f'),'GROUP_CONCAT DESC':_0xcd4d('0x60')};var _0x97e00e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcd4d('0x85'),'HOUR':_0xcd4d('0x62'),'ROUND':_0xcd4d('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x560379=function(_0x48ce97){return!_['includes']([_0xcd4d('0x65'),_0xcd4d('0x86'),_0xcd4d('0x87'),_0xcd4d('0x66')],_0x48ce97);};var _0x291c92=function(_0x256bed){if(!_0x256bed||!_0x256bed[_0xcd4d('0x68')][_0xcd4d('0x67')]){return'';}for(var _0x5144c3='(',_0x40ea5b=0x0;_0x40ea5b<_0x256bed[_0xcd4d('0x68')][_0xcd4d('0x67')];_0x40ea5b+=0x1){_0x40ea5b>0x0&&(_0x5144c3+='\x20'+_0x256bed[_0xcd4d('0x88')]+'\x20');_0x5144c3+=_0x256bed[_0xcd4d('0x68')][_0x40ea5b]['group']?_0x291c92(_0x256bed[_0xcd4d('0x68')][_0x40ea5b][_0xcd4d('0x69')]):_0x256bed[_0xcd4d('0x68')][_0x40ea5b]['field']+'\x20'+_0x256bed['rules'][_0x40ea5b][_0xcd4d('0x6a')]+(_0x560379(_0x256bed[_0xcd4d('0x68')][_0x40ea5b][_0xcd4d('0x6a')])?'\x20'+_0x256bed['rules'][_0x40ea5b][_0xcd4d('0x89')]:'');}return _0x5144c3+')';};var _0x74e453={'where':{'id':_0x1d272a['params']['id']}},_0x37e13b,_0x191a56,_0x5436e2,_0x3d8d15,_0x535996;_0x74e453=_[_0xcd4d('0x48')]({},_0x74e453,_0x1d272a[_0xcd4d('0x41')]);return db[_0xcd4d('0x2d')][_0xcd4d('0x49')](_0x74e453)[_0xcd4d('0x25')](function(_0x359f09){if(_0x359f09){_0x37e13b=_0x359f09;return _0x359f09[_0xcd4d('0x6b')]();}return null;})['then'](function(_0x362c18){if(_0x362c18){if(!_0x362c18[_0xcd4d('0x67')]){throw new db['Sequelize'][(_0xcd4d('0x8a'))](_0xcd4d('0x6d'),0x193);}_0x191a56=_0x362c18;return db[_0xcd4d('0x6e')][_0xcd4d('0x44')]({'raw':!![]});}return null;})[_0xcd4d('0x25')](function(_0x450db5){if(_0x450db5){_0x5436e2=_[_0xcd4d('0x8b')](_0x450db5,'id');var _0xfbcf0b;var _0x161b92=squel[_0xcd4d('0x6f')]();_0x161b92['from'](_0x37e13b[_0xcd4d('0x70')]);for(var _0x44e0f3=0x0;_0x44e0f3<_0x191a56[_0xcd4d('0x67')];_0x44e0f3+=0x1){_0xfbcf0b=_0x191a56[_0x44e0f3][_0xcd4d('0x8c')]?_0x5436e2[_0x191a56[_0x44e0f3]['MetricId']][_0xcd4d('0x8d')]:_0x191a56[_0x44e0f3][_0xcd4d('0x75')];_0xfbcf0b=_0x191a56[_0x44e0f3]['function']?_[_0xcd4d('0x8e')](_0x2c96cd[_0x191a56[_0x44e0f3][_0xcd4d('0x71')]],'%s',_0xfbcf0b):_0xfbcf0b;_0xfbcf0b=_0x191a56[_0x44e0f3][_0xcd4d('0x72')]?_[_0xcd4d('0x8e')](_0x97e00e[_0x191a56[_0x44e0f3][_0xcd4d('0x72')]],'%s',_0xfbcf0b):_0xfbcf0b;if(_0x191a56[_0x44e0f3][_0xcd4d('0x73')]){_0x161b92[_0xcd4d('0x69')](_0xfbcf0b);}_0x191a56[_0x44e0f3][_0xcd4d('0x74')]&&_0x161b92[_0xcd4d('0xa7')](_0xfbcf0b,_0x191a56[_0x44e0f3][_0xcd4d('0x74')]===_0xcd4d('0x8f')?![]:!![]);_0x161b92[_0xcd4d('0x75')](_0xfbcf0b,_0x191a56[_0x44e0f3][_0xcd4d('0x90')]||_0xfbcf0b);}if(_0x37e13b[_0xcd4d('0x76')]){_0x37e13b['joins']=JSON[_0xcd4d('0x77')](_0x37e13b[_0xcd4d('0x76')]);for(var _0x2a2089=0x0;_0x2a2089<_0x37e13b['joins'][_0xcd4d('0x67')];_0x2a2089+=0x1){if(_0x37e13b[_0xcd4d('0x76')][_0x2a2089]['type']&&_[_0xcd4d('0x78')](_0x5ef37f,_0x37e13b[_0xcd4d('0x76')][_0x2a2089][_0xcd4d('0x30')])&&_0x37e13b['joins'][_0x2a2089][_0xcd4d('0x79')]&&_0x37e13b[_0xcd4d('0x76')][_0x2a2089]['foreignTable']&&_0x37e13b['joins'][_0x2a2089][_0xcd4d('0x7b')]){_0x161b92[_0x37e13b[_0xcd4d('0x76')][_0x2a2089]['type']](_0x37e13b[_0xcd4d('0x76')][_0x2a2089][_0xcd4d('0x7a')],null,util[_0xcd4d('0x72')](_0xcd4d('0x7c'),_0x37e13b[_0xcd4d('0x70')],_0x37e13b[_0xcd4d('0x76')][_0x2a2089][_0xcd4d('0x79')],_0x37e13b[_0xcd4d('0x76')][_0x2a2089][_0xcd4d('0x7a')],_0x37e13b['joins'][_0x2a2089][_0xcd4d('0x7b')]));}}}if(_0x37e13b['conditions']){_0x37e13b[_0xcd4d('0x7d')]=JSON[_0xcd4d('0x77')](_0x37e13b[_0xcd4d('0x7d')]);_0x161b92[_0xcd4d('0x3d')](_0x291c92(_0x37e13b['conditions'][_0xcd4d('0x69')]));}_0x535996=_0x161b92[_0xcd4d('0x91')]();_0x161b92[_0xcd4d('0x1d')](_0x214a48);_0x161b92['offset'](0x0);logger[_0xcd4d('0x7e')](_0xcd4d('0x7f'),_0x161b92[_0xcd4d('0x80')]());return dbH['sequelize'][_0xcd4d('0x34')](_0x161b92['toString'](),{'type':dbH['sequelize'][_0xcd4d('0xa5')][_0xcd4d('0x82')]});}})['then'](function(){return{'sql':_0x535996[_0xcd4d('0x80')]()};})[_0xcd4d('0x25')](respondWithResult(_0xfbb448,null))[_0xcd4d('0x53')](handleError(_0xfbb448,null));}; \ No newline at end of file +var _0x5522=['type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','keys','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','value','alias','includes','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','child_process','fork','countTable','COUNT(*)','run','runReport','left_join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','limit','offset','count','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','fieldName'];(function(_0x5326ba,_0x156aca){var _0x6afc=function(_0x42c82d){while(--_0x42c82d){_0x5326ba['push'](_0x5326ba['shift']());}};_0x6afc(++_0x156aca);}(_0x5522,0x1bd));var _0x2552=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5522[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x2552('0x0'));var rimraf=require(_0x2552('0x1'));var zipdir=require(_0x2552('0x2'));var jsonpatch=require(_0x2552('0x3'));var rp=require(_0x2552('0x4'));var moment=require('moment');var BPromise=require(_0x2552('0x5'));var Mustache=require(_0x2552('0x6'));var util=require(_0x2552('0x7'));var path=require('path');var sox=require(_0x2552('0x8'));var csv=require(_0x2552('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2552('0xa'));var _=require(_0x2552('0xb'));var squel=require(_0x2552('0xc'));var crypto=require(_0x2552('0xd'));var jsforce=require(_0x2552('0xe'));var deskjs=require(_0x2552('0xf'));var toCsv=require(_0x2552('0x9'));var querystring=require(_0x2552('0x10'));var Papa=require(_0x2552('0x11'));var Redis=require(_0x2552('0x12'));var authService=require(_0x2552('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2552('0x14'));var hardwareService=require(_0x2552('0x15'));var logger=require(_0x2552('0x16'))(_0x2552('0x17'));var utils=require(_0x2552('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2552('0x19'));var db=require(_0x2552('0x1a'))['db'];var dbH=require(_0x2552('0x1a'))[_0x2552('0x1b')];function respondWithStatusCode(_0x5fb831,_0x220fdb){_0x220fdb=_0x220fdb||0xcc;return function(_0x3ed7ed){if(_0x3ed7ed){return _0x5fb831[_0x2552('0x1c')](_0x220fdb);}return _0x5fb831['status'](_0x220fdb)[_0x2552('0x1d')]();};}function respondWithResult(_0x260d4a,_0x28db8b){_0x28db8b=_0x28db8b||0xc8;return function(_0x1cbbe7){if(_0x1cbbe7){return _0x260d4a[_0x2552('0x1e')](_0x28db8b)[_0x2552('0x1f')](_0x1cbbe7);}};}function respondWithFilteredResult(_0x2672cc,_0x27fff0){return function(_0x381b91){if(_0x381b91){var _0x217569=typeof _0x27fff0['offset']==='undefined'&&typeof _0x27fff0[_0x2552('0x20')]==='undefined';var _0x45de77=_0x381b91['count'];var _0x5beec8=_0x217569?0x0:_0x27fff0[_0x2552('0x21')];var _0x405986=_0x217569?_0x381b91[_0x2552('0x22')]:_0x27fff0[_0x2552('0x21')]+_0x27fff0[_0x2552('0x20')];var _0x1c1af4;if(_0x405986>=_0x45de77){_0x405986=_0x45de77;_0x1c1af4=0xc8;}else{_0x1c1af4=0xce;}_0x2672cc[_0x2552('0x1e')](_0x1c1af4);return _0x2672cc['set'](_0x2552('0x23'),_0x5beec8+'-'+_0x405986+'/'+_0x45de77)['json'](_0x381b91);}return null;};}function patchUpdates(_0x3489b1){return function(_0x38576d){try{jsonpatch['apply'](_0x38576d,_0x3489b1,!![]);}catch(_0x992b1d){return BPromise[_0x2552('0x24')](_0x992b1d);}return _0x38576d[_0x2552('0x25')]();};}function saveUpdates(_0x4e8a8b,_0x421280){return function(_0x11bd17){if(_0x11bd17){return _0x11bd17['update'](_0x4e8a8b)[_0x2552('0x26')](function(_0x3ea83d){return _0x3ea83d;});}return null;};}function removeEntity(_0x361c0e,_0x5bd7d8){return function(_0x408874){if(_0x408874){return _0x408874[_0x2552('0x27')]()[_0x2552('0x26')](function(){var _0x147c62=_0x408874[_0x2552('0x28')]({'plain':!![]});var _0x4ea485='CustomReports';return db[_0x2552('0x29')][_0x2552('0x27')]({'where':{'type':_0x4ea485,'resourceId':_0x147c62['id']}})[_0x2552('0x26')](function(){return _0x408874;});})[_0x2552('0x26')](function(){_0x361c0e[_0x2552('0x1e')](0xcc)[_0x2552('0x1d')]();});}};}function handleEntityNotFound(_0x27ba54,_0x51a228){return function(_0xd92ab4){if(!_0xd92ab4){_0x27ba54[_0x2552('0x1c')](0x194);}return _0xd92ab4;};}function handleError(_0x5597c2,_0x24a7f3){_0x24a7f3=_0x24a7f3||0x1f4;return function(_0x261b6c){logger[_0x2552('0x2a')](_0x261b6c[_0x2552('0x2b')]);if(_0x261b6c[_0x2552('0x2c')]){delete _0x261b6c[_0x2552('0x2c')];}_0x5597c2[_0x2552('0x1e')](_0x24a7f3)[_0x2552('0x2d')](_0x261b6c);};}exports[_0x2552('0x2e')]=function(_0x1dae94,_0x19772c){var _0xb640f5={},_0x2f7d2c={},_0x4ee39d={'count':0x0,'rows':[]};var _0x575dcd=_[_0x2552('0x2f')](db[_0x2552('0x30')]['rawAttributes'],function(_0x3e5829){return{'name':_0x3e5829[_0x2552('0x31')],'type':_0x3e5829[_0x2552('0x32')][_0x2552('0x33')]};});_0x2f7d2c[_0x2552('0x34')]=_[_0x2552('0x2f')](_0x575dcd,_0x2552('0x2c'));_0x2f7d2c[_0x2552('0x35')]=_['keys'](_0x1dae94['query']);_0x2f7d2c['filters']=_['intersection'](_0x2f7d2c[_0x2552('0x34')],_0x2f7d2c['query']);_0xb640f5[_0x2552('0x36')]=_[_0x2552('0x37')](_0x2f7d2c['model'],qs[_0x2552('0x38')](_0x1dae94[_0x2552('0x35')][_0x2552('0x38')]));_0xb640f5['attributes']=_0xb640f5[_0x2552('0x36')][_0x2552('0x39')]?_0xb640f5[_0x2552('0x36')]:_0x2f7d2c['model'];if(!_0x1dae94[_0x2552('0x35')][_0x2552('0x3a')](_0x2552('0x3b'))){_0xb640f5[_0x2552('0x20')]=qs[_0x2552('0x20')](_0x1dae94[_0x2552('0x35')]['limit']);_0xb640f5['offset']=qs[_0x2552('0x21')](_0x1dae94['query'][_0x2552('0x21')]);}_0xb640f5[_0x2552('0x3c')]=qs[_0x2552('0x3d')](_0x1dae94['query'][_0x2552('0x3d')]);_0xb640f5[_0x2552('0x3e')]=qs[_0x2552('0x3f')](_[_0x2552('0x40')](_0x1dae94[_0x2552('0x35')],_0x2f7d2c[_0x2552('0x3f')]),_0x575dcd);if(_0x1dae94[_0x2552('0x35')][_0x2552('0x41')]){_0xb640f5['where']=_[_0x2552('0x42')](_0xb640f5[_0x2552('0x3e')],{'$or':_[_0x2552('0x2f')](_0x575dcd,function(_0x4fb187){if(_0x4fb187[_0x2552('0x32')]!==_0x2552('0x43')){var _0x2dfd3e={};_0x2dfd3e[_0x4fb187[_0x2552('0x2c')]]={'$like':'%'+_0x1dae94[_0x2552('0x35')][_0x2552('0x41')]+'%'};return _0x2dfd3e;}})});}_0xb640f5=_['merge']({},_0xb640f5,_0x1dae94[_0x2552('0x44')]);var _0x348b8b={'where':_0xb640f5['where']};return db[_0x2552('0x30')]['count'](_0x348b8b)['then'](function(_0x15adac){_0x4ee39d[_0x2552('0x22')]=_0x15adac;if(_0x1dae94[_0x2552('0x35')]['includeAll']){_0xb640f5[_0x2552('0x45')]=[{'all':!![]}];}return db[_0x2552('0x30')][_0x2552('0x46')](_0xb640f5);})[_0x2552('0x26')](function(_0x576124){_0x4ee39d['rows']=_0x576124;return _0x4ee39d;})[_0x2552('0x26')](respondWithFilteredResult(_0x19772c,_0xb640f5))['catch'](handleError(_0x19772c,null));};exports[_0x2552('0x47')]=function(_0x4744e9,_0x43dd04){var _0x46ab1a={'raw':![],'where':{'id':_0x4744e9[_0x2552('0x48')]['id']}},_0xb89c6={};_0xb89c6[_0x2552('0x34')]=_[_0x2552('0x49')](db['AnalyticCustomReport'][_0x2552('0x4a')]);_0xb89c6[_0x2552('0x35')]=_['keys'](_0x4744e9['query']);_0xb89c6[_0x2552('0x3f')]=_[_0x2552('0x37')](_0xb89c6[_0x2552('0x34')],_0xb89c6[_0x2552('0x35')]);_0x46ab1a[_0x2552('0x36')]=_[_0x2552('0x37')](_0xb89c6['model'],qs['fields'](_0x4744e9['query'][_0x2552('0x38')]));_0x46ab1a[_0x2552('0x36')]=_0x46ab1a[_0x2552('0x36')]['length']?_0x46ab1a[_0x2552('0x36')]:_0xb89c6[_0x2552('0x34')];if(_0x4744e9[_0x2552('0x35')]['includeAll']){_0x46ab1a[_0x2552('0x45')]=[{'all':!![]}];}_0x46ab1a=_['merge']({},_0x46ab1a,_0x4744e9[_0x2552('0x44')]);return db['AnalyticCustomReport']['find'](_0x46ab1a)[_0x2552('0x26')](handleEntityNotFound(_0x43dd04,null))['then'](respondWithResult(_0x43dd04,null))[_0x2552('0x4b')](handleError(_0x43dd04,null));};exports[_0x2552('0x4c')]=function(_0x4379df,_0x92e16d){return db['AnalyticCustomReport'][_0x2552('0x4c')](_0x4379df[_0x2552('0x4d')],{})[_0x2552('0x26')](function(_0x5f33f3){var _0x14c63d=_0x4379df[_0x2552('0x4e')][_0x2552('0x28')]({'plain':!![]});if(!_0x14c63d)throw new Error(_0x2552('0x4f'));if(_0x14c63d['role']===_0x2552('0x4e')){var _0x313ea5=_0x5f33f3[_0x2552('0x28')]({'plain':!![]});var _0x137bf1=_0x2552('0x50');return db[_0x2552('0x51')][_0x2552('0x52')]({'where':{'name':_0x137bf1,'userProfileId':_0x14c63d[_0x2552('0x53')]},'raw':!![]})[_0x2552('0x26')](function(_0x49a446){if(_0x49a446&&_0x49a446[_0x2552('0x54')]===0x0){return db[_0x2552('0x29')][_0x2552('0x4c')]({'name':_0x313ea5[_0x2552('0x2c')],'resourceId':_0x313ea5['id'],'type':_0x2552('0x55'),'sectionId':_0x49a446['id']},{})[_0x2552('0x26')](function(){return _0x5f33f3;});}else{return _0x5f33f3;}})[_0x2552('0x4b')](function(_0x4fe312){logger['error'](_0x2552('0x56'),_0x4fe312);throw _0x4fe312;});}return _0x5f33f3;})[_0x2552('0x26')](respondWithResult(_0x92e16d,0xc9))['catch'](handleError(_0x92e16d,null));};exports['update']=function(_0xa06e88,_0x4fc7a0){if(_0xa06e88[_0x2552('0x4d')]['id']){delete _0xa06e88['body']['id'];}return db['AnalyticCustomReport'][_0x2552('0x52')]({'where':{'id':_0xa06e88[_0x2552('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fc7a0,null))[_0x2552('0x26')](saveUpdates(_0xa06e88[_0x2552('0x4d')],null))[_0x2552('0x26')](respondWithResult(_0x4fc7a0,null))['catch'](handleError(_0x4fc7a0,null));};exports[_0x2552('0x27')]=function(_0x5f41a1,_0x503914){return db[_0x2552('0x30')][_0x2552('0x52')]({'where':{'id':_0x5f41a1[_0x2552('0x48')]['id']}})[_0x2552('0x26')](handleEntityNotFound(_0x503914,null))[_0x2552('0x26')](removeEntity(_0x503914,null))['catch'](handleError(_0x503914,null));};exports[_0x2552('0x57')]=function(_0x570faf,_0x4dff3e){var _0x3e9750=0xa;var _0x478b24=[_0x2552('0x58'),'left_join',_0x2552('0x59'),_0x2552('0x5a')];var _0x51be9f={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2552('0x5b'),'MAX':_0x2552('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2552('0x5d'),'GROUP_CONCAT DESC':_0x2552('0x5e')};var _0x41b55c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2552('0x5f'),'HOUR':_0x2552('0x60'),'ROUND':_0x2552('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1cf315=function(_0x53024){return!_['includes']([_0x2552('0x62'),_0x2552('0x63'),_0x2552('0x64'),'IS\x20NOT\x20EMPTY'],_0x53024);};var _0x5bb69e=function(_0x3b55b2){if(!_0x3b55b2||!_0x3b55b2[_0x2552('0x65')]['length']){return'';}for(var _0x5753f2='(',_0x28171a=0x0;_0x28171a<_0x3b55b2[_0x2552('0x65')][_0x2552('0x39')];_0x28171a+=0x1){_0x28171a>0x0&&(_0x5753f2+='\x20'+_0x3b55b2['operator']+'\x20');_0x5753f2+=_0x3b55b2['rules'][_0x28171a][_0x2552('0x66')]?_0x5bb69e(_0x3b55b2['rules'][_0x28171a][_0x2552('0x66')]):_0x3b55b2['rules'][_0x28171a]['field']+'\x20'+_0x3b55b2[_0x2552('0x65')][_0x28171a][_0x2552('0x67')]+(_0x1cf315(_0x3b55b2[_0x2552('0x65')][_0x28171a][_0x2552('0x67')])?'\x20'+_0x3b55b2[_0x2552('0x65')][_0x28171a]['value']:'');}return _0x5753f2+')';};var _0x9ba1a0={'where':{'id':_0x570faf[_0x2552('0x48')]['id']}},_0x3b4beb,_0x21faa3,_0x96069e,_0x5afd04,_0x343518;_0x9ba1a0=_['merge']({},_0x9ba1a0,_0x570faf[_0x2552('0x44')]);return db[_0x2552('0x30')]['find'](_0x9ba1a0)[_0x2552('0x26')](function(_0x8b4865){if(_0x8b4865){_0x3b4beb=_0x8b4865;return _0x8b4865[_0x2552('0x68')]();}return null;})[_0x2552('0x26')](function(_0x1c689b){if(_0x1c689b){if(!_0x1c689b[_0x2552('0x39')]){throw new db[(_0x2552('0x69'))][(_0x2552('0x6a'))](_0x2552('0x6b'),0x193);}_0x21faa3=_0x1c689b;return db[_0x2552('0x6c')][_0x2552('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7d6){if(_0x3aa7d6){_0x96069e=_[_0x2552('0x6d')](_0x3aa7d6,'id');var _0x5f2227;var _0x48e2d8=squel[_0x2552('0x6e')]();_0x48e2d8[_0x2552('0x6f')](_0x3b4beb[_0x2552('0x70')]);for(var _0x25e99f=0x0;_0x25e99f<_0x21faa3[_0x2552('0x39')];_0x25e99f+=0x1){_0x5f2227=_0x21faa3[_0x25e99f][_0x2552('0x71')]?_0x96069e[_0x21faa3[_0x25e99f]['MetricId']][_0x2552('0x72')]:_0x21faa3[_0x25e99f][_0x2552('0x73')];_0x5f2227=_0x21faa3[_0x25e99f][_0x2552('0x74')]?_[_0x2552('0x75')](_0x51be9f[_0x21faa3[_0x25e99f][_0x2552('0x74')]],'%s',_0x5f2227):_0x5f2227;_0x5f2227=_0x21faa3[_0x25e99f][_0x2552('0x76')]?_[_0x2552('0x75')](_0x41b55c[_0x21faa3[_0x25e99f][_0x2552('0x76')]],'%s',_0x5f2227):_0x5f2227;if(_0x21faa3[_0x25e99f][_0x2552('0x77')]){_0x48e2d8['group'](_0x5f2227);}_0x21faa3[_0x25e99f][_0x2552('0x78')]&&_0x48e2d8['order'](_0x5f2227,_0x21faa3[_0x25e99f][_0x2552('0x78')]===_0x2552('0x79')?![]:!![]);_0x48e2d8['field'](_0x5f2227,_0x21faa3[_0x25e99f]['alias']||_0x5f2227);}if(_0x3b4beb[_0x2552('0x7a')]){_0x3b4beb['joins']=JSON[_0x2552('0x7b')](_0x3b4beb[_0x2552('0x7a')]);for(var _0x1c9685=0x0;_0x1c9685<_0x3b4beb[_0x2552('0x7a')][_0x2552('0x39')];_0x1c9685+=0x1){if(_0x3b4beb[_0x2552('0x7a')][_0x1c9685][_0x2552('0x32')]&&_['includes'](_0x478b24,_0x3b4beb['joins'][_0x1c9685][_0x2552('0x32')])&&_0x3b4beb[_0x2552('0x7a')][_0x1c9685][_0x2552('0x7c')]&&_0x3b4beb[_0x2552('0x7a')][_0x1c9685][_0x2552('0x7d')]&&_0x3b4beb[_0x2552('0x7a')][_0x1c9685][_0x2552('0x7e')]){_0x48e2d8[_0x3b4beb[_0x2552('0x7a')][_0x1c9685]['type']](_0x3b4beb['joins'][_0x1c9685][_0x2552('0x7d')],null,util[_0x2552('0x76')](_0x2552('0x7f'),_0x3b4beb[_0x2552('0x70')],_0x3b4beb[_0x2552('0x7a')][_0x1c9685]['parentKey'],_0x3b4beb['joins'][_0x1c9685][_0x2552('0x7d')],_0x3b4beb[_0x2552('0x7a')][_0x1c9685][_0x2552('0x7e')]));}}}if(_0x3b4beb[_0x2552('0x80')]){_0x3b4beb[_0x2552('0x80')]=JSON[_0x2552('0x7b')](_0x3b4beb[_0x2552('0x80')]);_0x48e2d8['where'](_0x5bb69e(_0x3b4beb[_0x2552('0x80')][_0x2552('0x66')]));}_0x343518=_0x48e2d8['clone']();_0x48e2d8['limit'](_0x3e9750);_0x48e2d8['offset'](0x0);logger['debug'](_0x2552('0x81'),_0x48e2d8['toString']());return dbH[_0x2552('0x82')]['query'](_0x48e2d8[_0x2552('0x83')](),{'type':dbH['sequelize'][_0x2552('0x84')][_0x2552('0x85')]});}})[_0x2552('0x26')](respondWithResult(_0x4dff3e,null))[_0x2552('0x4b')](handleError(_0x4dff3e,null));};function runReport(_0x2ddb58,_0x3a427d,_0x2c7945){var _0x2f0157=_0x3a427d[_0x2552('0x2c')];var _0x11dcb9=0xa;var _0x4a173c=[_0x2552('0x58'),'left_join',_0x2552('0x59'),'cross_join'];var _0x3dfa44={'SUM':_0x2552('0x86'),'COUNT':_0x2552('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2552('0x5c'),'MIN':_0x2552('0x88'),'AVG':_0x2552('0x89'),'GROUP_CONCAT':_0x2552('0x8a'),'GROUP_CONCAT ASC':_0x2552('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x21224e={'SEC_TO_TIME':_0x2552('0x8b'),'DATE':_0x2552('0x5f'),'HOUR':_0x2552('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2552('0x8c')};var _0x5a9882=function(_0x447b40){return!_['includes']([_0x2552('0x62'),_0x2552('0x63'),_0x2552('0x64'),_0x2552('0x8d')],_0x447b40);};var _0x21a12f=function(_0x22b455){if(!_0x22b455||!_0x22b455[_0x2552('0x65')]['length']){return'';}for(var _0x54b8b9='(',_0x26b594=0x0;_0x26b594<_0x22b455[_0x2552('0x65')][_0x2552('0x39')];_0x26b594+=0x1){_0x26b594>0x0&&(_0x54b8b9+='\x20'+_0x22b455[_0x2552('0x8e')]+'\x20');_0x54b8b9+=_0x22b455[_0x2552('0x65')][_0x26b594]['group']?_0x21a12f(_0x22b455[_0x2552('0x65')][_0x26b594][_0x2552('0x66')]):_0x22b455[_0x2552('0x65')][_0x26b594][_0x2552('0x73')]+'\x20'+_0x22b455['rules'][_0x26b594][_0x2552('0x67')]+(_0x5a9882(_0x22b455['rules'][_0x26b594][_0x2552('0x67')])?'\x20'+_0x22b455[_0x2552('0x65')][_0x26b594][_0x2552('0x8f')]:'');}return _0x54b8b9+')';};var _0x4a9c6f={'where':{'id':_0x2ddb58['id']}},_0xf0ed9c,_0x4b7764,_0x3725a0,_0x1deec9,_0x5d6521;_0x4a9c6f=_[_0x2552('0x42')]({},_0x4a9c6f,_0x2c7945);return db[_0x2552('0x30')]['find'](_0x4a9c6f)['then'](function(_0x5304aa){if(_0x5304aa){_0xf0ed9c=_0x5304aa;return _0x5304aa[_0x2552('0x68')]();}return null;})[_0x2552('0x26')](function(_0x406795){if(_0x406795){if(!_0x406795['length']){throw new db[(_0x2552('0x69'))][(_0x2552('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4b7764=_0x406795;return db[_0x2552('0x6c')][_0x2552('0x46')]({'raw':!![]});}return null;})[_0x2552('0x26')](function(_0x302e95){if(_0x302e95){_0x3725a0=_[_0x2552('0x6d')](_0x302e95,'id');var _0x2b211c;var _0x296784=squel['select']();_0x296784[_0x2552('0x6f')](_0xf0ed9c[_0x2552('0x70')]);for(var _0x2ff89c=0x0;_0x2ff89c<_0x4b7764[_0x2552('0x39')];_0x2ff89c+=0x1){_0x2b211c=_0x4b7764[_0x2ff89c][_0x2552('0x71')]?_0x3725a0[_0x4b7764[_0x2ff89c][_0x2552('0x71')]][_0x2552('0x72')]:_0x4b7764[_0x2ff89c][_0x2552('0x73')];_0x2b211c=_0x4b7764[_0x2ff89c]['function']?_[_0x2552('0x75')](_0x3dfa44[_0x4b7764[_0x2ff89c][_0x2552('0x74')]],'%s',_0x2b211c):_0x2b211c;_0x2b211c=_0x4b7764[_0x2ff89c][_0x2552('0x76')]?_[_0x2552('0x75')](_0x21224e[_0x4b7764[_0x2ff89c][_0x2552('0x76')]],'%s',_0x2b211c):_0x2b211c;if(_0x4b7764[_0x2ff89c][_0x2552('0x77')]){_0x296784[_0x2552('0x66')](_0x2b211c);}_0x4b7764[_0x2ff89c][_0x2552('0x78')]&&_0x296784[_0x2552('0x3c')](_0x2b211c,_0x4b7764[_0x2ff89c][_0x2552('0x78')]==='DESC'?![]:!![]);_0x296784[_0x2552('0x73')](_0x2b211c,_0x4b7764[_0x2ff89c][_0x2552('0x90')]||_0x2b211c);}if(_0xf0ed9c['joins']){_0xf0ed9c[_0x2552('0x7a')]=JSON[_0x2552('0x7b')](_0xf0ed9c[_0x2552('0x7a')]);for(var _0x11ff79=0x0;_0x11ff79<_0xf0ed9c['joins'][_0x2552('0x39')];_0x11ff79+=0x1){if(_0xf0ed9c[_0x2552('0x7a')][_0x11ff79][_0x2552('0x32')]&&_[_0x2552('0x91')](_0x4a173c,_0xf0ed9c['joins'][_0x11ff79]['type'])&&_0xf0ed9c['joins'][_0x11ff79][_0x2552('0x7c')]&&_0xf0ed9c[_0x2552('0x7a')][_0x11ff79][_0x2552('0x7d')]&&_0xf0ed9c[_0x2552('0x7a')][_0x11ff79][_0x2552('0x7e')]){_0x296784[_0xf0ed9c['joins'][_0x11ff79][_0x2552('0x32')]](_0xf0ed9c[_0x2552('0x7a')][_0x11ff79][_0x2552('0x7d')],null,util[_0x2552('0x76')]('%s.%s\x20=\x20%s.%s',_0xf0ed9c[_0x2552('0x70')],_0xf0ed9c['joins'][_0x11ff79][_0x2552('0x7c')],_0xf0ed9c['joins'][_0x11ff79][_0x2552('0x7d')],_0xf0ed9c[_0x2552('0x7a')][_0x11ff79][_0x2552('0x7e')]));}}}if(_0xf0ed9c[_0x2552('0x80')]){_0xf0ed9c['conditions']=JSON[_0x2552('0x7b')](_0xf0ed9c[_0x2552('0x80')]);_0x296784[_0x2552('0x3e')](_0x21a12f(_0xf0ed9c[_0x2552('0x80')]['group']));}_0x5d6521=_0x296784[_0x2552('0x92')]();_0x296784['limit'](_0x11dcb9);_0x296784[_0x2552('0x21')](0x0);return;}})[_0x2552('0x26')](function(){if(_0x3a427d[_0x2552('0x93')]===_0x2552('0x94')){return null;}var _0x9b441c=_[_0x2552('0x42')](_0x3a427d,{'name':_0x3a427d[_0x2552('0x95')]||_0x3a427d[_0x2552('0x2c')]||_0xf0ed9c['name'],'basename':_0x2f0157,'savename':util[_0x2552('0x76')](_0x2552('0x96'),_0x3a427d[_0x2552('0x2c')]||_0xf0ed9c['name'],require(_0x2552('0x97'))[_0x2552('0x98')](0x4),_0x3a427d[_0x2552('0x93')]||_0x2552('0x99')),'reportId':_0xf0ed9c['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x2552('0x4c')](_0x9b441c,{'raw':!![]});})[_0x2552('0x26')](function(_0x91782c){if(_0xf0ed9c[_0x2552('0x70')]===_0x2552('0x9a')){_0x5d6521[_0x2552('0x3e')](_0xf0ed9c[_0x2552('0x70')]+_0x2552('0x9b'),_0x3a427d['startDate'],_0x3a427d[_0x2552('0x9c')]);}else{_0x5d6521['where'](_0xf0ed9c[_0x2552('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a427d[_0x2552('0x9d')],_0x3a427d['endDate']);}if(_0x91782c){logger['info']('Run\x20Query:',_0x5d6521['toString']());require(_0x2552('0x9e'))[_0x2552('0x9f')](path[_0x2552('0x58')](__dirname,'../../components/export/',_0x91782c[_0x2552('0x93')]),[_0x91782c['id'],_0x5d6521['toString'](),path[_0x2552('0x58')](__dirname,'../../files/reports',_0x91782c['savename']),_0x2f0157]);return _0x91782c;}else{var _0x1fdf6a=squel[_0x2552('0x6e')]();_0x1fdf6a['from']('('+_0x5d6521[_0x2552('0x83')]()+')',_0x2552('0xa0'));_0x1fdf6a[_0x2552('0x73')](_0x2552('0xa1'),'count');_0x5d6521[_0x2552('0x20')](_0x3a427d[_0x2552('0x20')]||_0x11dcb9);_0x5d6521[_0x2552('0x21')](_0x3a427d[_0x2552('0x21')]||0x0);return dbH[_0x2552('0x82')][_0x2552('0x35')](_0x1fdf6a[_0x2552('0x83')](),{'type':dbH['sequelize'][_0x2552('0x84')][_0x2552('0x85')]})[_0x2552('0x26')](function(_0x469385){if(!_0x469385['length']){_0x1deec9=0x0;}else{_0x1deec9=_0x469385[0x0][_0x2552('0x22')]||0x0;}return dbH[_0x2552('0x82')][_0x2552('0x35')](_0x5d6521[_0x2552('0x83')](),{'type':dbH[_0x2552('0x82')][_0x2552('0x84')][_0x2552('0x85')]});})[_0x2552('0x26')](function(_0x2e6953){return{'rows':_0x2e6953||[],'count':_0x1deec9};});}});}exports[_0x2552('0xa2')]=function(_0x4cbfbb,_0x4eed14){return runReport(_0x4cbfbb[_0x2552('0x48')],_0x4cbfbb[_0x2552('0x35')],_0x4cbfbb[_0x2552('0x44')])[_0x2552('0x26')](respondWithResult(_0x4eed14,null))[_0x2552('0x4b')](handleError(_0x4eed14,null));};exports[_0x2552('0xa3')]=runReport;exports[_0x2552('0x35')]=function(_0x228083,_0x5dddb4){var _0x31514a=0xa;var _0x1c4fba=['join',_0x2552('0xa4'),_0x2552('0x59'),_0x2552('0x5a')];var _0x23a5b={'SUM':_0x2552('0x86'),'COUNT':_0x2552('0x87'),'COUNT DISTINCT':_0x2552('0x5b'),'MAX':_0x2552('0x5c'),'MIN':_0x2552('0x88'),'AVG':_0x2552('0x89'),'GROUP_CONCAT':_0x2552('0x8a'),'GROUP_CONCAT ASC':_0x2552('0x5d'),'GROUP_CONCAT DESC':_0x2552('0x5e')};var _0x2dfe5f={'SEC_TO_TIME':_0x2552('0x8b'),'DATE':'DATE(%s)','HOUR':_0x2552('0x60'),'ROUND':_0x2552('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42e615=function(_0x251c37){return!_[_0x2552('0x91')]([_0x2552('0x62'),_0x2552('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x251c37);};var _0x249a48=function(_0x3d9c22){if(!_0x3d9c22||!_0x3d9c22[_0x2552('0x65')][_0x2552('0x39')]){return'';}for(var _0x4ba2e1='(',_0x31b798=0x0;_0x31b798<_0x3d9c22[_0x2552('0x65')][_0x2552('0x39')];_0x31b798+=0x1){_0x31b798>0x0&&(_0x4ba2e1+='\x20'+_0x3d9c22[_0x2552('0x8e')]+'\x20');_0x4ba2e1+=_0x3d9c22[_0x2552('0x65')][_0x31b798]['group']?_0x249a48(_0x3d9c22[_0x2552('0x65')][_0x31b798][_0x2552('0x66')]):_0x3d9c22[_0x2552('0x65')][_0x31b798][_0x2552('0x73')]+'\x20'+_0x3d9c22[_0x2552('0x65')][_0x31b798]['condition']+(_0x42e615(_0x3d9c22[_0x2552('0x65')][_0x31b798][_0x2552('0x67')])?'\x20'+_0x3d9c22[_0x2552('0x65')][_0x31b798][_0x2552('0x8f')]:'');}return _0x4ba2e1+')';};var _0x1b6e0c={'where':{'id':_0x228083['params']['id']}},_0x5bb3e8,_0x45c9ac,_0x143416,_0x45b36a,_0x4ab55;_0x1b6e0c=_[_0x2552('0x42')]({},_0x1b6e0c,_0x228083[_0x2552('0x44')]);return db[_0x2552('0x30')][_0x2552('0x52')](_0x1b6e0c)[_0x2552('0x26')](function(_0x3cc40a){if(_0x3cc40a){_0x5bb3e8=_0x3cc40a;return _0x3cc40a['getFields']();}return null;})[_0x2552('0x26')](function(_0x173f2a){if(_0x173f2a){if(!_0x173f2a['length']){throw new db[(_0x2552('0x69'))][(_0x2552('0x6a'))](_0x2552('0x6b'),0x193);}_0x45c9ac=_0x173f2a;return db[_0x2552('0x6c')][_0x2552('0x46')]({'raw':!![]});}return null;})['then'](function(_0x365a4a){if(_0x365a4a){_0x143416=_[_0x2552('0x6d')](_0x365a4a,'id');var _0x135108;var _0x3622ba=squel[_0x2552('0x6e')]();_0x3622ba[_0x2552('0x6f')](_0x5bb3e8[_0x2552('0x70')]);for(var _0x96105d=0x0;_0x96105d<_0x45c9ac[_0x2552('0x39')];_0x96105d+=0x1){_0x135108=_0x45c9ac[_0x96105d][_0x2552('0x71')]?_0x143416[_0x45c9ac[_0x96105d][_0x2552('0x71')]]['metric']:_0x45c9ac[_0x96105d]['field'];_0x135108=_0x45c9ac[_0x96105d][_0x2552('0x74')]?_['replace'](_0x23a5b[_0x45c9ac[_0x96105d][_0x2552('0x74')]],'%s',_0x135108):_0x135108;_0x135108=_0x45c9ac[_0x96105d][_0x2552('0x76')]?_['replace'](_0x2dfe5f[_0x45c9ac[_0x96105d][_0x2552('0x76')]],'%s',_0x135108):_0x135108;if(_0x45c9ac[_0x96105d][_0x2552('0x77')]){_0x3622ba[_0x2552('0x66')](_0x135108);}_0x45c9ac[_0x96105d]['orderBy']&&_0x3622ba[_0x2552('0x3c')](_0x135108,_0x45c9ac[_0x96105d][_0x2552('0x78')]===_0x2552('0x79')?![]:!![]);_0x3622ba['field'](_0x135108,_0x45c9ac[_0x96105d][_0x2552('0x90')]||_0x135108);}if(_0x5bb3e8['joins']){_0x5bb3e8[_0x2552('0x7a')]=JSON[_0x2552('0x7b')](_0x5bb3e8[_0x2552('0x7a')]);for(var _0x5aafed=0x0;_0x5aafed<_0x5bb3e8[_0x2552('0x7a')][_0x2552('0x39')];_0x5aafed+=0x1){if(_0x5bb3e8['joins'][_0x5aafed][_0x2552('0x32')]&&_[_0x2552('0x91')](_0x1c4fba,_0x5bb3e8[_0x2552('0x7a')][_0x5aafed][_0x2552('0x32')])&&_0x5bb3e8[_0x2552('0x7a')][_0x5aafed]['parentKey']&&_0x5bb3e8['joins'][_0x5aafed][_0x2552('0x7d')]&&_0x5bb3e8[_0x2552('0x7a')][_0x5aafed]['foreignKey']){_0x3622ba[_0x5bb3e8[_0x2552('0x7a')][_0x5aafed]['type']](_0x5bb3e8[_0x2552('0x7a')][_0x5aafed]['foreignTable'],null,util[_0x2552('0x76')](_0x2552('0x7f'),_0x5bb3e8['table'],_0x5bb3e8[_0x2552('0x7a')][_0x5aafed][_0x2552('0x7c')],_0x5bb3e8[_0x2552('0x7a')][_0x5aafed][_0x2552('0x7d')],_0x5bb3e8[_0x2552('0x7a')][_0x5aafed][_0x2552('0x7e')]));}}}if(_0x5bb3e8[_0x2552('0x80')]){_0x5bb3e8[_0x2552('0x80')]=JSON['parse'](_0x5bb3e8['conditions']);_0x3622ba[_0x2552('0x3e')](_0x249a48(_0x5bb3e8['conditions'][_0x2552('0x66')]));}_0x4ab55=_0x3622ba[_0x2552('0x92')]();_0x3622ba[_0x2552('0x20')](_0x31514a);_0x3622ba[_0x2552('0x21')](0x0);logger['debug'](_0x2552('0x81'),_0x3622ba['toString']());return dbH['sequelize'][_0x2552('0x35')](_0x3622ba[_0x2552('0x83')](),{'type':dbH[_0x2552('0x82')]['QueryTypes'][_0x2552('0x85')]});}})[_0x2552('0x26')](function(){return{'sql':_0x4ab55['toString']()};})[_0x2552('0x26')](respondWithResult(_0x5dddb4,null))[_0x2552('0x4b')](handleError(_0x5dddb4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bc8c9eb..4f9cb12 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 _0x7ddf=['AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x39ad4c,_0x2fa27e){var _0xf3314d=function(_0x4de109){while(--_0x4de109){_0x39ad4c['push'](_0x39ad4c['shift']());}};_0xf3314d(++_0x2fa27e);}(_0x7ddf,0x1a6));var _0xf7dd=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7ddf[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xf7dd('0x0'));var util=require(_0xf7dd('0x1'));var logger=require('../../config/logger')(_0xf7dd('0x2'));var moment=require(_0xf7dd('0x3'));var BPromise=require(_0xf7dd('0x4'));var rp=require(_0xf7dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf7dd('0x6'));var attributes=require(_0xf7dd('0x7'));module[_0xf7dd('0x8')]=function(_0x1402ca,_0xff28e6){return _0x1402ca[_0xf7dd('0x9')](_0xf7dd('0xa'),attributes,{'tableName':_0xf7dd('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x726a=['AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3a88d9,_0x51f50a){var _0x1433aa=function(_0xb2d0a1){while(--_0xb2d0a1){_0x3a88d9['push'](_0x3a88d9['shift']());}};_0x1433aa(++_0x51f50a);}(_0x726a,0x1af));var _0xa726=function(_0x48c17c,_0x4458d0){_0x48c17c=_0x48c17c-0x0;var _0x222069=_0x726a[_0x48c17c];return _0x222069;};'use strict';var _=require('lodash');var util=require(_0xa726('0x0'));var logger=require('../../config/logger')(_0xa726('0x1'));var moment=require(_0xa726('0x2'));var BPromise=require(_0xa726('0x3'));var rp=require(_0xa726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa726('0x5'));var config=require(_0xa726('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xa726('0x7')]=function(_0x3cc092,_0x9c4def){return _0x3cc092[_0xa726('0x8')](_0xa726('0x9'),attributes,{'tableName':_0xa726('0xa'),'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 6cacd79..9cb2791 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 _0xe710=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b1321,_0x52f747){var _0x4e0e4f=function(_0x4ad6af){while(--_0x4ad6af){_0x5b1321['push'](_0x5b1321['shift']());}};_0x4e0e4f(++_0x52f747);}(_0xe710,0x1f1));var _0x0e71=function(_0x232710,_0x561335){_0x232710=_0x232710-0x0;var _0x4b9eba=_0xe710[_0x232710];return _0x4b9eba;};'use strict';var _=require(_0x0e71('0x0'));var util=require(_0x0e71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0e71('0x2'));var fs=require('fs');var Redis=require(_0x0e71('0x3'));var db=require(_0x0e71('0x4'))['db'];var utils=require(_0x0e71('0x5'));var logger=require(_0x0e71('0x6'))(_0x0e71('0x7'));var config=require(_0x0e71('0x8'));var jayson=require(_0x0e71('0x9'));var client=jayson[_0x0e71('0xa')][_0x0e71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11c952,_0x36c7a4,_0x40db85){return new BPromise(function(_0x2f32a2,_0x123a3d){return client[_0x0e71('0xc')](_0x11c952,_0x40db85)[_0x0e71('0xd')](function(_0x333e0b){logger[_0x0e71('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x36c7a4,'request\x20sent');logger[_0x0e71('0xf')](_0x0e71('0x10'),_0x36c7a4,_0x0e71('0x11'),JSON['stringify'](_0x333e0b));if(_0x333e0b[_0x0e71('0x12')]){if(_0x333e0b[_0x0e71('0x12')][_0x0e71('0x13')]===0x1f4){logger[_0x0e71('0x12')](_0x0e71('0x14'),_0x36c7a4,_0x333e0b['error'][_0x0e71('0x15')]);return _0x123a3d(_0x333e0b[_0x0e71('0x12')][_0x0e71('0x15')]);}logger['error'](_0x0e71('0x14'),_0x36c7a4,_0x333e0b[_0x0e71('0x12')]['message']);return _0x2f32a2(_0x333e0b[_0x0e71('0x12')]['message']);}else{logger['info'](_0x0e71('0x14'),_0x36c7a4,_0x0e71('0x11'));_0x2f32a2(_0x333e0b[_0x0e71('0x16')][_0x0e71('0x15')]);}})[_0x0e71('0x17')](function(_0x50999d){logger[_0x0e71('0x12')](_0x0e71('0x14'),_0x36c7a4,_0x50999d);_0x123a3d(_0x50999d);});});} \ No newline at end of file +var _0x56f0=['../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4cbde1,_0x4feef5){var _0x49683c=function(_0x28c392){while(--_0x28c392){_0x4cbde1['push'](_0x4cbde1['shift']());}};_0x49683c(++_0x4feef5);}(_0x56f0,0xed));var _0x056f=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x56f0[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0x056f('0x0'));var util=require(_0x056f('0x1'));var moment=require(_0x056f('0x2'));var BPromise=require(_0x056f('0x3'));var rs=require(_0x056f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x056f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x056f('0x6'));var config=require(_0x056f('0x7'));var jayson=require(_0x056f('0x8'));var client=jayson['client'][_0x056f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24734b,_0x36ff79,_0x47bb4e){return new BPromise(function(_0x466a86,_0x3ad6dd){return client[_0x056f('0xa')](_0x24734b,_0x47bb4e)[_0x056f('0xb')](function(_0x380838){logger[_0x056f('0xc')](_0x056f('0xd'),_0x36ff79,_0x056f('0xe'));logger[_0x056f('0xf')](_0x056f('0x10'),_0x36ff79,_0x056f('0xe'),JSON[_0x056f('0x11')](_0x380838));if(_0x380838[_0x056f('0x12')]){if(_0x380838[_0x056f('0x12')][_0x056f('0x13')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x36ff79,_0x380838[_0x056f('0x12')][_0x056f('0x14')]);return _0x3ad6dd(_0x380838['error'][_0x056f('0x14')]);}logger[_0x056f('0x12')](_0x056f('0xd'),_0x36ff79,_0x380838[_0x056f('0x12')][_0x056f('0x14')]);return _0x466a86(_0x380838[_0x056f('0x12')][_0x056f('0x14')]);}else{logger[_0x056f('0xc')](_0x056f('0xd'),_0x36ff79,_0x056f('0xe'));_0x466a86(_0x380838['result'][_0x056f('0x14')]);}})[_0x056f('0x15')](function(_0x45927a){logger[_0x056f('0x12')](_0x056f('0xd'),_0x36ff79,_0x45927a);_0x3ad6dd(_0x45927a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index fec8ce3..c2a5877 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 _0xb4a1=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','preview','/:id/run','/:id/query','query','post','create','update','delete','destroy','exports'];(function(_0x2bf059,_0x29f7de){var _0x327dcc=function(_0x190efb){while(--_0x190efb){_0x2bf059['push'](_0x2bf059['shift']());}};_0x327dcc(++_0x29f7de);}(_0xb4a1,0xc6));var _0x1b4a=function(_0x20e6c4,_0x573880){_0x20e6c4=_0x20e6c4-0x0;var _0x61fc99=_0xb4a1[_0x20e6c4];return _0x61fc99;};'use strict';var multer=require('multer');var util=require(_0x1b4a('0x0'));var path=require(_0x1b4a('0x1'));var timeout=require(_0x1b4a('0x2'));var express=require(_0x1b4a('0x3'));var router=express[_0x1b4a('0x4')]();var fs_extra=require(_0x1b4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1b4a('0x6'));var config=require('../../config/environment');var controller=require(_0x1b4a('0x7'));router[_0x1b4a('0x8')]('/',auth['isAuthenticated'](),controller[_0x1b4a('0x9')]);router[_0x1b4a('0x8')](_0x1b4a('0xa'),auth[_0x1b4a('0xb')](),controller['show']);router[_0x1b4a('0x8')]('/:id/preview',auth[_0x1b4a('0xb')](),controller[_0x1b4a('0xc')]);router['get'](_0x1b4a('0xd'),auth['isAuthenticated'](),controller['run']);router['get'](_0x1b4a('0xe'),auth[_0x1b4a('0xb')](),controller[_0x1b4a('0xf')]);router[_0x1b4a('0x10')]('/',auth[_0x1b4a('0xb')](),controller[_0x1b4a('0x11')]);router['put']('/:id',auth[_0x1b4a('0xb')](),controller[_0x1b4a('0x12')]);router[_0x1b4a('0x13')](_0x1b4a('0xa'),auth[_0x1b4a('0xb')](),controller[_0x1b4a('0x14')]);module[_0x1b4a('0x15')]=router; \ No newline at end of file +var _0xbf00=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','query','create','/:id','update','destroy','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf00,0xaf));var _0x0bf0=function(_0x44d385,_0x1a313a){_0x44d385=_0x44d385-0x0;var _0x5c2cc5=_0xbf00[_0x44d385];return _0x5c2cc5;};'use strict';var multer=require('multer');var util=require(_0x0bf0('0x0'));var path=require('path');var timeout=require(_0x0bf0('0x1'));var express=require(_0x0bf0('0x2'));var router=express[_0x0bf0('0x3')]();var fs_extra=require(_0x0bf0('0x4'));var auth=require(_0x0bf0('0x5'));var interaction=require(_0x0bf0('0x6'));var config=require('../../config/environment');var controller=require(_0x0bf0('0x7'));router[_0x0bf0('0x8')]('/',auth[_0x0bf0('0x9')](),controller[_0x0bf0('0xa')]);router[_0x0bf0('0x8')]('/:id',auth[_0x0bf0('0x9')](),controller['show']);router[_0x0bf0('0x8')](_0x0bf0('0xb'),auth[_0x0bf0('0x9')](),controller[_0x0bf0('0xc')]);router[_0x0bf0('0x8')](_0x0bf0('0xd'),auth[_0x0bf0('0x9')](),controller[_0x0bf0('0xe')]);router[_0x0bf0('0x8')](_0x0bf0('0xf'),auth['isAuthenticated'](),controller[_0x0bf0('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0bf0('0x11')]);router['put'](_0x0bf0('0x12'),auth['isAuthenticated'](),controller[_0x0bf0('0x13')]);router['delete'](_0x0bf0('0x12'),auth[_0x0bf0('0x9')](),controller[_0x0bf0('0x14')]);module[_0x0bf0('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 8a7233b..a18536a 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 _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x145044,_0x4dedef){var _0xb114d2=function(_0x113550){while(--_0x113550){_0x145044['push'](_0x145044['shift']());}};_0xb114d2(++_0x4dedef);}(_0xeec6,0x1c2));var _0x6eec=function(_0x44a9c8,_0x19facb){_0x44a9c8=_0x44a9c8-0x0;var _0x3a3d70=_0xeec6[_0x44a9c8];return _0x3a3d70;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2f8449,_0x91cdce){_0x2f8449=_0x2f8449-0x0;var _0x1c3453=_0xb4c7[_0x2f8449];return _0x1c3453;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 612dd9d..07f7a47 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 _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x2ab233,_0x10a101){var _0x2779a7=function(_0x82885d){while(--_0x82885d){_0x2ab233['push'](_0x2ab233['shift']());}};_0x2779a7(++_0x10a101);}(_0xda19,0xd5));var _0x9da1=function(_0x53b1d9,_0x4aff36){_0x53b1d9=_0x53b1d9-0x0;var _0x49baa3=_0xda19[_0x53b1d9];return _0x49baa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +var _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x0295,0x1f0));var _0x5029=function(_0x348860,_0x4531f6){_0x348860=_0x348860-0x0;var _0x2fc2ad=_0x0295[_0x348860];return _0x2fc2ad;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5bf3b88..55d54ca 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 _0x6c94=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api'];(function(_0xed2842,_0x9e07b1){var _0x5aace7=function(_0x2144c7){while(--_0x2144c7){_0xed2842['push'](_0xed2842['shift']());}};_0x5aace7(++_0x9e07b1);}(_0x6c94,0x1d1));var _0x46c9=function(_0xfd6a1,_0x2a5228){_0xfd6a1=_0xfd6a1-0x0;var _0x2e87a6=_0x6c94[_0xfd6a1];return _0x2e87a6;};'use strict';var _=require('lodash');var util=require(_0x46c9('0x0'));var logger=require(_0x46c9('0x1'))(_0x46c9('0x2'));var moment=require('moment');var BPromise=require(_0x46c9('0x3'));var rp=require(_0x46c9('0x4'));var fs=require('fs');var path=require(_0x46c9('0x5'));var rimraf=require(_0x46c9('0x6'));var config=require(_0x46c9('0x7'));var attributes=require(_0x46c9('0x8'));module[_0x46c9('0x9')]=function(_0x3d4fd6,_0x14993e){return _0x3d4fd6['define'](_0x46c9('0xa'),attributes,{'tableName':_0x46c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe79f=['rimraf','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','api','bluebird','request-promise','path'];(function(_0x63e72,_0x223b4a){var _0x563dd4=function(_0x5b0a0a){while(--_0x5b0a0a){_0x63e72['push'](_0x63e72['shift']());}};_0x563dd4(++_0x223b4a);}(_0xe79f,0x1b2));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfe79('0x0'));var util=require(_0xfe79('0x1'));var logger=require('../../config/logger')(_0xfe79('0x2'));var moment=require('moment');var BPromise=require(_0xfe79('0x3'));var rp=require(_0xfe79('0x4'));var fs=require('fs');var path=require(_0xfe79('0x5'));var rimraf=require(_0xfe79('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe79('0x7'));module[_0xfe79('0x8')]=function(_0x59c092,_0x22a949){return _0x59c092[_0xfe79('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0xfe79('0xa'),'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 5767290..b70553d 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 _0x12ef=['code','message','error','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12d7ef,_0x4263bd){var _0x21adf9=function(_0x47dddc){while(--_0x47dddc){_0x12d7ef['push'](_0x12d7ef['shift']());}};_0x21adf9(++_0x4263bd);}(_0x12ef,0x71));var _0xf12e=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x12ef[_0x5b34c0];return _0x242bd3;};'use strict';var _=require('lodash');var util=require(_0xf12e('0x0'));var moment=require(_0xf12e('0x1'));var BPromise=require(_0xf12e('0x2'));var rs=require(_0xf12e('0x3'));var fs=require('fs');var Redis=require(_0xf12e('0x4'));var db=require(_0xf12e('0x5'))['db'];var utils=require(_0xf12e('0x6'));var logger=require(_0xf12e('0x7'))(_0xf12e('0x8'));var config=require(_0xf12e('0x9'));var jayson=require(_0xf12e('0xa'));var client=jayson['client'][_0xf12e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2973b7,_0x301cbe,_0x4cbde2){return new BPromise(function(_0x365ad,_0xc67e14){return client[_0xf12e('0xc')](_0x2973b7,_0x4cbde2)['then'](function(_0x349a7d){logger[_0xf12e('0xd')](_0xf12e('0xe'),_0x301cbe,_0xf12e('0xf'));logger[_0xf12e('0x10')](_0xf12e('0x11'),_0x301cbe,_0xf12e('0xf'),JSON[_0xf12e('0x12')](_0x349a7d));if(_0x349a7d['error']){if(_0x349a7d['error'][_0xf12e('0x13')]===0x1f4){logger['error'](_0xf12e('0xe'),_0x301cbe,_0x349a7d['error'][_0xf12e('0x14')]);return _0xc67e14(_0x349a7d['error']['message']);}logger[_0xf12e('0x15')](_0xf12e('0xe'),_0x301cbe,_0x349a7d['error'][_0xf12e('0x14')]);return _0x365ad(_0x349a7d[_0xf12e('0x15')]['message']);}else{logger['info'](_0xf12e('0xe'),_0x301cbe,_0xf12e('0xf'));_0x365ad(_0x349a7d['result'][_0xf12e('0x14')]);}})['catch'](function(_0x3f4e9b){logger[_0xf12e('0x15')](_0xf12e('0xe'),_0x301cbe,_0x3f4e9b);_0xc67e14(_0x3f4e9b);});});} \ No newline at end of file +var _0x9411=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x1c6250,_0x4ba01d){var _0x5e2f3a=function(_0x84f05f){while(--_0x84f05f){_0x1c6250['push'](_0x1c6250['shift']());}};_0x5e2f3a(++_0x4ba01d);}(_0x9411,0x1a1));var _0x1941=function(_0x3d1651,_0x3d9693){_0x3d1651=_0x3d1651-0x0;var _0x163dad=_0x9411[_0x3d1651];return _0x163dad;};'use strict';var _=require(_0x1941('0x0'));var util=require(_0x1941('0x1'));var moment=require(_0x1941('0x2'));var BPromise=require('bluebird');var rs=require(_0x1941('0x3'));var fs=require('fs');var Redis=require(_0x1941('0x4'));var db=require(_0x1941('0x5'))['db'];var utils=require(_0x1941('0x6'));var logger=require(_0x1941('0x7'))(_0x1941('0x8'));var config=require('../../config/environment');var jayson=require(_0x1941('0x9'));var client=jayson[_0x1941('0xa')][_0x1941('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15846e,_0x2b400b,_0x1514a6){return new BPromise(function(_0xda8392,_0x49ddbc){return client['request'](_0x15846e,_0x1514a6)[_0x1941('0xc')](function(_0x47d528){logger['info'](_0x1941('0xd'),_0x2b400b,_0x1941('0xe'));logger[_0x1941('0xf')](_0x1941('0x10'),_0x2b400b,_0x1941('0xe'),JSON[_0x1941('0x11')](_0x47d528));if(_0x47d528[_0x1941('0x12')]){if(_0x47d528[_0x1941('0x12')][_0x1941('0x13')]===0x1f4){logger[_0x1941('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2b400b,_0x47d528['error'][_0x1941('0x14')]);return _0x49ddbc(_0x47d528[_0x1941('0x12')][_0x1941('0x14')]);}logger[_0x1941('0x12')](_0x1941('0xd'),_0x2b400b,_0x47d528[_0x1941('0x12')][_0x1941('0x14')]);return _0xda8392(_0x47d528[_0x1941('0x12')]['message']);}else{logger[_0x1941('0x15')](_0x1941('0xd'),_0x2b400b,_0x1941('0xe'));_0xda8392(_0x47d528['result'][_0x1941('0x14')]);}})['catch'](function(_0x4924f8){logger[_0x1941('0x12')](_0x1941('0xd'),_0x2b400b,_0x4924f8);_0x49ddbc(_0x4924f8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 09d380d..4bb878a 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 _0x03e9=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','post','put','update','delete','multer'];(function(_0x33bbaa,_0x1f5395){var _0x579de3=function(_0x113047){while(--_0x113047){_0x33bbaa['push'](_0x33bbaa['shift']());}};_0x579de3(++_0x1f5395);}(_0x03e9,0x13f));var _0x903e=function(_0x4e01f3,_0x5a1422){_0x4e01f3=_0x4e01f3-0x0;var _0x1a1662=_0x03e9[_0x4e01f3];return _0x1a1662;};'use strict';var multer=require(_0x903e('0x0'));var util=require(_0x903e('0x1'));var path=require('path');var timeout=require(_0x903e('0x2'));var express=require(_0x903e('0x3'));var router=express[_0x903e('0x4')]();var fs_extra=require(_0x903e('0x5'));var auth=require(_0x903e('0x6'));var interaction=require(_0x903e('0x7'));var config=require('../../config/environment');var controller=require(_0x903e('0x8'));router[_0x903e('0x9')]('/',auth[_0x903e('0xa')](),controller[_0x903e('0xb')]);router[_0x903e('0x9')](_0x903e('0xc'),auth[_0x903e('0xa')](),controller[_0x903e('0xd')]);router['get'](_0x903e('0xe'),auth[_0x903e('0xa')](),controller[_0x903e('0xf')]);router[_0x903e('0x9')]('/:id/run',auth[_0x903e('0xa')](),controller['run']);router[_0x903e('0x9')]('/:id/query',auth[_0x903e('0xa')](),controller['query']);router[_0x903e('0x10')]('/',auth[_0x903e('0xa')](),controller['create']);router[_0x903e('0x11')](_0x903e('0xc'),auth[_0x903e('0xa')](),controller[_0x903e('0x12')]);router[_0x903e('0x13')](_0x903e('0xc'),auth[_0x903e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf36e=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','run','query','/:id'];(function(_0xfd1945,_0x29827d){var _0x53d788=function(_0x34cbb6){while(--_0x34cbb6){_0xfd1945['push'](_0xfd1945['shift']());}};_0x53d788(++_0x29827d);}(_0xf36e,0x1a6));var _0xef36=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf36e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xef36('0x0'));var path=require(_0xef36('0x1'));var timeout=require(_0xef36('0x2'));var express=require(_0xef36('0x3'));var router=express[_0xef36('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef36('0x6'));var controller=require(_0xef36('0x7'));router['get']('/',auth[_0xef36('0x8')](),controller[_0xef36('0x9')]);router[_0xef36('0xa')]('/:id',auth[_0xef36('0x8')](),controller[_0xef36('0xb')]);router[_0xef36('0xa')](_0xef36('0xc'),auth[_0xef36('0x8')](),controller[_0xef36('0xd')]);router[_0xef36('0xa')](_0xef36('0xe'),auth[_0xef36('0x8')](),controller[_0xef36('0xf')]);router[_0xef36('0xa')]('/:id/query',auth[_0xef36('0x8')](),controller[_0xef36('0x10')]);router['post']('/',auth[_0xef36('0x8')](),controller['create']);router['put'](_0xef36('0x11'),auth['isAuthenticated'](),controller[_0xef36('0x12')]);router[_0xef36('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xef36('0x14')]);module[_0xef36('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 8c33d9a..05527df 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 _0x0e67=['INTEGER','UNSIGNED','STRING','moment','exports','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled'];(function(_0x22e410,_0x28bfc2){var _0x3fe685=function(_0x45aa27){while(--_0x45aa27){_0x22e410['push'](_0x22e410['shift']());}};_0x3fe685(++_0x28bfc2);}(_0x0e67,0x1f1));var _0x70e6=function(_0x3337b0,_0x58c198){_0x3337b0=_0x3337b0-0x0;var _0x52c2a7=_0x0e67[_0x3337b0];return _0x52c2a7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x70e6('0x0'));module[_0x70e6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x70e6('0x2')](_0x70e6('0x3'),_0x70e6('0x4'),_0x70e6('0x5')),'allowNull':![],'defaultValue':_0x70e6('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x70e6('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x70e6('0x7')},'type':{'type':Sequelize['ENUM'](_0x70e6('0x8'),_0x70e6('0x9')),'allowNull':![],'defaultValue':_0x70e6('0x8')},'reportId':{'type':Sequelize[_0x70e6('0xa')](0xb)[_0x70e6('0xb')]},'reportType':{'type':Sequelize[_0x70e6('0xc')]}}; \ No newline at end of file +var _0x2733=['pdf','xlsx','DATE','Loading','manual','scheduled','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x3dd112,_0x5b87e9){var _0x281bd9=function(_0x8214f7){while(--_0x8214f7){_0x3dd112['push'](_0x3dd112['shift']());}};_0x281bd9(++_0x5b87e9);}(_0x2733,0x7e));var _0x3273=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x2733[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x3273('0x0'));var moment=require(_0x3273('0x1'));module[_0x3273('0x2')]={'name':{'type':Sequelize[_0x3273('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3273('0x4')](_0x3273('0x5'),_0x3273('0x6'),_0x3273('0x7')),'allowNull':![],'defaultValue':_0x3273('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x3273('0x8')]},'endDate':{'type':Sequelize[_0x3273('0x8')]},'status':{'type':Sequelize[_0x3273('0x3')],'defaultValue':_0x3273('0x9')},'type':{'type':Sequelize[_0x3273('0x4')](_0x3273('0xa'),_0x3273('0xb')),'allowNull':![],'defaultValue':_0x3273('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'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 800bc5c..65f95ab 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 _0x2f11=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','savename','output','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','role'];(function(_0x19a7ba,_0x517aef){var _0x230c13=function(_0x33e4aa){while(--_0x33e4aa){_0x19a7ba['push'](_0x19a7ba['shift']());}};_0x230c13(++_0x517aef);}(_0x2f11,0xcc));var _0x12f1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2f11[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x12f1('0x0'));var rimraf=require(_0x12f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12f1('0x2'));var rp=require(_0x12f1('0x3'));var moment=require('moment');var BPromise=require(_0x12f1('0x4'));var Mustache=require(_0x12f1('0x5'));var util=require(_0x12f1('0x6'));var path=require(_0x12f1('0x7'));var sox=require(_0x12f1('0x8'));var csv=require(_0x12f1('0x9'));var ejs=require(_0x12f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12f1('0xb'));var squel=require(_0x12f1('0xc'));var crypto=require(_0x12f1('0xd'));var jsforce=require(_0x12f1('0xe'));var deskjs=require(_0x12f1('0xf'));var toCsv=require(_0x12f1('0x9'));var querystring=require(_0x12f1('0x10'));var Papa=require(_0x12f1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x12f1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12f1('0x13'));var logger=require(_0x12f1('0x14'))(_0x12f1('0x15'));var utils=require(_0x12f1('0x16'));var config=require(_0x12f1('0x17'));var licenseUtil=require(_0x12f1('0x18'));var db=require(_0x12f1('0x19'))['db'];function respondWithStatusCode(_0x51897a,_0x283105){_0x283105=_0x283105||0xcc;return function(_0x398261){if(_0x398261){return _0x51897a[_0x12f1('0x1a')](_0x283105);}return _0x51897a['status'](_0x283105)[_0x12f1('0x1b')]();};}function respondWithResult(_0x3f3405,_0x49bf6e){_0x49bf6e=_0x49bf6e||0xc8;return function(_0x4793d0){if(_0x4793d0){return _0x3f3405[_0x12f1('0x1c')](_0x49bf6e)[_0x12f1('0x1d')](_0x4793d0);}};}function respondWithFilteredResult(_0x5ad5a2,_0x2e167a){return function(_0x553a6c){if(_0x553a6c){var _0x2ef174=typeof _0x2e167a[_0x12f1('0x1e')]==='undefined'&&typeof _0x2e167a[_0x12f1('0x1f')]===_0x12f1('0x20');var _0xea2598=_0x553a6c[_0x12f1('0x21')];var _0x3b80c2=_0x2ef174?0x0:_0x2e167a[_0x12f1('0x1e')];var _0x2e9f1d=_0x2ef174?_0x553a6c[_0x12f1('0x21')]:_0x2e167a['offset']+_0x2e167a['limit'];var _0x164c55;if(_0x2e9f1d>=_0xea2598){_0x2e9f1d=_0xea2598;_0x164c55=0xc8;}else{_0x164c55=0xce;}_0x5ad5a2[_0x12f1('0x1c')](_0x164c55);return _0x5ad5a2[_0x12f1('0x22')](_0x12f1('0x23'),_0x3b80c2+'-'+_0x2e9f1d+'/'+_0xea2598)[_0x12f1('0x1d')](_0x553a6c);}return null;};}function patchUpdates(_0x5e807d){return function(_0x5ad5c7){try{jsonpatch[_0x12f1('0x24')](_0x5ad5c7,_0x5e807d,!![]);}catch(_0x3672b7){return BPromise[_0x12f1('0x25')](_0x3672b7);}return _0x5ad5c7['save']();};}function saveUpdates(_0x1226b8,_0xde26f4){return function(_0x4d0856){if(_0x4d0856){return _0x4d0856[_0x12f1('0x26')](_0x1226b8)[_0x12f1('0x27')](function(_0x38f759){return _0x38f759;});}return null;};}function removeEntity(_0x3cc332,_0x4c39d9){return function(_0x344c7f){if(_0x344c7f){return _0x344c7f[_0x12f1('0x28')]()[_0x12f1('0x27')](function(){var _0x4ff7c3=_0x344c7f[_0x12f1('0x29')]({'plain':!![]});var _0x534217='ExtractedReports';return db[_0x12f1('0x2a')][_0x12f1('0x28')]({'where':{'type':_0x534217,'resourceId':_0x4ff7c3['id']}})[_0x12f1('0x27')](function(){return _0x344c7f;});})['then'](function(){_0x3cc332[_0x12f1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5856c0,_0x1f9702){return function(_0xbbb8d){if(!_0xbbb8d){_0x5856c0[_0x12f1('0x1a')](0x194);}return _0xbbb8d;};}function handleError(_0x3e7cbd,_0x5449f0){_0x5449f0=_0x5449f0||0x1f4;return function(_0x387a43){logger[_0x12f1('0x2b')](_0x387a43[_0x12f1('0x2c')]);if(_0x387a43[_0x12f1('0x2d')]){delete _0x387a43[_0x12f1('0x2d')];}_0x3e7cbd[_0x12f1('0x1c')](_0x5449f0)[_0x12f1('0x2e')](_0x387a43);};}exports[_0x12f1('0x2f')]=function(_0x459624,_0x533934){var _0x4711f4={},_0x1943ef={},_0x22d249={'count':0x0,'rows':[]};var _0x377e20=_[_0x12f1('0x30')](db[_0x12f1('0x31')][_0x12f1('0x32')],function(_0x1e372f){return{'name':_0x1e372f[_0x12f1('0x33')],'type':_0x1e372f[_0x12f1('0x34')][_0x12f1('0x35')]};});_0x1943ef[_0x12f1('0x36')]=_[_0x12f1('0x30')](_0x377e20,_0x12f1('0x2d'));_0x1943ef[_0x12f1('0x37')]=_[_0x12f1('0x38')](_0x459624[_0x12f1('0x37')]);_0x1943ef['filters']=_['intersection'](_0x1943ef[_0x12f1('0x36')],_0x1943ef[_0x12f1('0x37')]);_0x4711f4[_0x12f1('0x39')]=_[_0x12f1('0x3a')](_0x1943ef[_0x12f1('0x36')],qs[_0x12f1('0x3b')](_0x459624['query'][_0x12f1('0x3b')]));_0x4711f4[_0x12f1('0x39')]=_0x4711f4[_0x12f1('0x39')][_0x12f1('0x3c')]?_0x4711f4[_0x12f1('0x39')]:_0x1943ef['model'];if(!_0x459624['query']['hasOwnProperty']('nolimit')){_0x4711f4[_0x12f1('0x1f')]=qs['limit'](_0x459624[_0x12f1('0x37')][_0x12f1('0x1f')]);_0x4711f4[_0x12f1('0x1e')]=qs[_0x12f1('0x1e')](_0x459624[_0x12f1('0x37')][_0x12f1('0x1e')]);}_0x4711f4[_0x12f1('0x3d')]=qs[_0x12f1('0x3e')](_0x459624[_0x12f1('0x37')][_0x12f1('0x3e')]);_0x4711f4['where']=qs[_0x12f1('0x3f')](_[_0x12f1('0x40')](_0x459624[_0x12f1('0x37')],_0x1943ef[_0x12f1('0x3f')]),_0x377e20);if(_0x459624[_0x12f1('0x37')][_0x12f1('0x41')]){_0x4711f4[_0x12f1('0x42')]=_[_0x12f1('0x43')](_0x4711f4[_0x12f1('0x42')],{'$or':_[_0x12f1('0x30')](_0x377e20,function(_0x14bd5c){if(_0x14bd5c['type']!==_0x12f1('0x44')){var _0x36de04={};_0x36de04[_0x14bd5c[_0x12f1('0x2d')]]={'$like':'%'+_0x459624['query'][_0x12f1('0x41')]+'%'};return _0x36de04;}})});}_0x4711f4=_[_0x12f1('0x43')]({},_0x4711f4,_0x459624['options']);var _0x2fc405={'where':_0x4711f4[_0x12f1('0x42')]};return db[_0x12f1('0x31')][_0x12f1('0x21')](_0x2fc405)[_0x12f1('0x27')](function(_0x4642ac){_0x22d249[_0x12f1('0x21')]=_0x4642ac;if(_0x459624[_0x12f1('0x37')][_0x12f1('0x45')]){_0x4711f4['include']=[{'all':!![]}];}return db[_0x12f1('0x31')][_0x12f1('0x46')](_0x4711f4);})[_0x12f1('0x27')](function(_0x178a6c){_0x22d249['rows']=_0x178a6c;return _0x22d249;})[_0x12f1('0x27')](respondWithFilteredResult(_0x533934,_0x4711f4))[_0x12f1('0x47')](handleError(_0x533934,null));};exports[_0x12f1('0x48')]=function(_0x3d3ddb,_0x44cb7b){var _0x565663={'raw':!![],'where':{'id':_0x3d3ddb[_0x12f1('0x49')]['id']}},_0x9a81ea={};_0x9a81ea[_0x12f1('0x36')]=_['keys'](db['AnalyticExtractedReport'][_0x12f1('0x32')]);_0x9a81ea[_0x12f1('0x37')]=_[_0x12f1('0x38')](_0x3d3ddb['query']);_0x9a81ea[_0x12f1('0x3f')]=_['intersection'](_0x9a81ea[_0x12f1('0x36')],_0x9a81ea[_0x12f1('0x37')]);_0x565663[_0x12f1('0x39')]=_[_0x12f1('0x3a')](_0x9a81ea[_0x12f1('0x36')],qs[_0x12f1('0x3b')](_0x3d3ddb[_0x12f1('0x37')]['fields']));_0x565663['attributes']=_0x565663[_0x12f1('0x39')][_0x12f1('0x3c')]?_0x565663['attributes']:_0x9a81ea[_0x12f1('0x36')];if(_0x3d3ddb['query']['includeAll']){_0x565663[_0x12f1('0x4a')]=[{'all':!![]}];}_0x565663=_[_0x12f1('0x43')]({},_0x565663,_0x3d3ddb['options']);return db['AnalyticExtractedReport'][_0x12f1('0x4b')](_0x565663)[_0x12f1('0x27')](handleEntityNotFound(_0x44cb7b,null))[_0x12f1('0x27')](respondWithResult(_0x44cb7b,null))[_0x12f1('0x47')](handleError(_0x44cb7b,null));};exports[_0x12f1('0x4c')]=function(_0x2cbe99,_0x561ff1){return db[_0x12f1('0x31')]['create'](_0x2cbe99['body'],{})[_0x12f1('0x27')](function(_0x4a6f10){var _0x302825=_0x2cbe99['user']['get']({'plain':!![]});if(!_0x302825)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x302825[_0x12f1('0x4d')]===_0x12f1('0x4e')){var _0x5ed6ae=_0x4a6f10['get']({'plain':!![]});var _0x2aec0b='ExtractedReports';return db[_0x12f1('0x4f')][_0x12f1('0x4b')]({'where':{'name':_0x2aec0b,'userProfileId':_0x302825[_0x12f1('0x50')]},'raw':!![]})[_0x12f1('0x27')](function(_0xf20dda){if(_0xf20dda&&_0xf20dda[_0x12f1('0x51')]===0x0){return db[_0x12f1('0x2a')][_0x12f1('0x4c')]({'name':_0x5ed6ae[_0x12f1('0x2d')],'resourceId':_0x5ed6ae['id'],'type':_0xf20dda[_0x12f1('0x2d')],'sectionId':_0xf20dda['id']},{})['then'](function(){return _0x4a6f10;});}else{return _0x4a6f10;}})[_0x12f1('0x47')](function(_0x2f8e93){logger['error'](_0x12f1('0x52'),_0x2f8e93);throw _0x2f8e93;});}return _0x4a6f10;})[_0x12f1('0x27')](respondWithResult(_0x561ff1,0xc9))[_0x12f1('0x47')](handleError(_0x561ff1,null));};exports[_0x12f1('0x26')]=function(_0x442f2f,_0x40196f){if(_0x442f2f[_0x12f1('0x53')]['id']){delete _0x442f2f[_0x12f1('0x53')]['id'];}return db[_0x12f1('0x31')][_0x12f1('0x4b')]({'where':{'id':_0x442f2f[_0x12f1('0x49')]['id']}})[_0x12f1('0x27')](handleEntityNotFound(_0x40196f,null))[_0x12f1('0x27')](saveUpdates(_0x442f2f[_0x12f1('0x53')],null))[_0x12f1('0x27')](respondWithResult(_0x40196f,null))[_0x12f1('0x47')](handleError(_0x40196f,null));};exports['destroy']=function(_0x1d2aba,_0x42fb33){return db[_0x12f1('0x31')]['find']({'where':{'id':_0x1d2aba['params']['id']}})[_0x12f1('0x27')](handleEntityNotFound(_0x42fb33,null))[_0x12f1('0x27')](removeEntity(_0x42fb33,null))[_0x12f1('0x47')](handleError(_0x42fb33,null));};exports['download']=function(_0x320415,_0x94a647,_0x2eed8c){return db['AnalyticExtractedReport'][_0x12f1('0x4b')]({'where':{'id':_0x320415[_0x12f1('0x49')]['id']},'attributes':[_0x12f1('0x2d'),'basename',_0x12f1('0x54'),_0x12f1('0x55')],'raw':!![]})[_0x12f1('0x27')](handleEntityNotFound(_0x94a647,null))['then'](function(_0x48dda0){if(_0x48dda0){if(!fs['existsSync'](path[_0x12f1('0x56')](config[_0x12f1('0x57')],'server/files/reports',_0x48dda0[_0x12f1('0x54')]))){throw new db[(_0x12f1('0x58'))][(_0x12f1('0x59'))](_0x12f1('0x5a'));}if(_0x320415['query'][_0x12f1('0x5b')]){return _0x94a647['sendStatus'](0xc8);}return _0x94a647['download'](path[_0x12f1('0x56')](config['root'],'server/files/reports',_0x48dda0['savename']),util['format'](_0x12f1('0x5c'),_0x48dda0['basename']||_0x48dda0[_0x12f1('0x2d')],_0x48dda0[_0x12f1('0x55')][_0x12f1('0x5d')]()));}})['catch'](handleError(_0x94a647,null));}; \ No newline at end of file +var _0x40b3=['fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','show','params','model','merge','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','body','basename','savename','output','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','index','map','AnalyticExtractedReport','rawAttributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x40b3,0x1d7));var _0x340b=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x40b3[_0x5c4e16];return _0x36044a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x340b('0x0'));var jsonpatch=require(_0x340b('0x1'));var rp=require('request-promise');var moment=require(_0x340b('0x2'));var BPromise=require(_0x340b('0x3'));var Mustache=require(_0x340b('0x4'));var util=require(_0x340b('0x5'));var path=require('path');var sox=require(_0x340b('0x6'));var csv=require(_0x340b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x340b('0x8'));var _=require(_0x340b('0x9'));var squel=require(_0x340b('0xa'));var crypto=require(_0x340b('0xb'));var jsforce=require(_0x340b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x340b('0x7'));var querystring=require('querystring');var Papa=require(_0x340b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x340b('0xe'));var utils=require(_0x340b('0xf'));var config=require(_0x340b('0x10'));var licenseUtil=require(_0x340b('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3234ec,_0x21030b){_0x21030b=_0x21030b||0xcc;return function(_0x3eac70){if(_0x3eac70){return _0x3234ec[_0x340b('0x12')](_0x21030b);}return _0x3234ec[_0x340b('0x13')](_0x21030b)['end']();};}function respondWithResult(_0x4f7bdc,_0x12096c){_0x12096c=_0x12096c||0xc8;return function(_0x5b6da2){if(_0x5b6da2){return _0x4f7bdc[_0x340b('0x13')](_0x12096c)[_0x340b('0x14')](_0x5b6da2);}};}function respondWithFilteredResult(_0x1788e9,_0x2f199a){return function(_0x1baaf0){if(_0x1baaf0){var _0x4b5646=typeof _0x2f199a[_0x340b('0x15')]==='undefined'&&typeof _0x2f199a['limit']===_0x340b('0x16');var _0x1670b8=_0x1baaf0[_0x340b('0x17')];var _0xc2884c=_0x4b5646?0x0:_0x2f199a[_0x340b('0x15')];var _0xdfcbc2=_0x4b5646?_0x1baaf0[_0x340b('0x17')]:_0x2f199a[_0x340b('0x15')]+_0x2f199a['limit'];var _0x4d7731;if(_0xdfcbc2>=_0x1670b8){_0xdfcbc2=_0x1670b8;_0x4d7731=0xc8;}else{_0x4d7731=0xce;}_0x1788e9[_0x340b('0x13')](_0x4d7731);return _0x1788e9[_0x340b('0x18')]('Content-Range',_0xc2884c+'-'+_0xdfcbc2+'/'+_0x1670b8)['json'](_0x1baaf0);}return null;};}function patchUpdates(_0x219f5b){return function(_0x56fb7e){try{jsonpatch['apply'](_0x56fb7e,_0x219f5b,!![]);}catch(_0x3e64d7){return BPromise[_0x340b('0x19')](_0x3e64d7);}return _0x56fb7e[_0x340b('0x1a')]();};}function saveUpdates(_0x36e58d,_0x54d3a2){return function(_0x4813c9){if(_0x4813c9){return _0x4813c9[_0x340b('0x1b')](_0x36e58d)[_0x340b('0x1c')](function(_0x29aca4){return _0x29aca4;});}return null;};}function removeEntity(_0x2d363e,_0x5cecb4){return function(_0x4763e4){if(_0x4763e4){return _0x4763e4[_0x340b('0x1d')]()[_0x340b('0x1c')](function(){var _0x293173=_0x4763e4[_0x340b('0x1e')]({'plain':!![]});var _0xcf8dd=_0x340b('0x1f');return db[_0x340b('0x20')]['destroy']({'where':{'type':_0xcf8dd,'resourceId':_0x293173['id']}})['then'](function(){return _0x4763e4;});})['then'](function(){_0x2d363e[_0x340b('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cfa6e,_0x1394c7){return function(_0x1cf1f9){if(!_0x1cf1f9){_0x4cfa6e['sendStatus'](0x194);}return _0x1cf1f9;};}function handleError(_0x4968c6,_0x183ae2){_0x183ae2=_0x183ae2||0x1f4;return function(_0x3ccc7c){logger['error'](_0x3ccc7c[_0x340b('0x21')]);if(_0x3ccc7c[_0x340b('0x22')]){delete _0x3ccc7c[_0x340b('0x22')];}_0x4968c6[_0x340b('0x13')](_0x183ae2)['send'](_0x3ccc7c);};}exports[_0x340b('0x23')]=function(_0x219bab,_0x485f80){var _0x392265={},_0x22404e={},_0x1fbccd={'count':0x0,'rows':[]};var _0x5b7618=_[_0x340b('0x24')](db[_0x340b('0x25')][_0x340b('0x26')],function(_0x33758f){return{'name':_0x33758f[_0x340b('0x27')],'type':_0x33758f[_0x340b('0x28')][_0x340b('0x29')]};});_0x22404e['model']=_[_0x340b('0x24')](_0x5b7618,_0x340b('0x22'));_0x22404e[_0x340b('0x2a')]=_['keys'](_0x219bab['query']);_0x22404e[_0x340b('0x2b')]=_[_0x340b('0x2c')](_0x22404e['model'],_0x22404e[_0x340b('0x2a')]);_0x392265[_0x340b('0x2d')]=_['intersection'](_0x22404e['model'],qs[_0x340b('0x2e')](_0x219bab[_0x340b('0x2a')][_0x340b('0x2e')]));_0x392265['attributes']=_0x392265[_0x340b('0x2d')][_0x340b('0x2f')]?_0x392265[_0x340b('0x2d')]:_0x22404e['model'];if(!_0x219bab[_0x340b('0x2a')][_0x340b('0x30')](_0x340b('0x31'))){_0x392265['limit']=qs[_0x340b('0x32')](_0x219bab[_0x340b('0x2a')][_0x340b('0x32')]);_0x392265[_0x340b('0x15')]=qs[_0x340b('0x15')](_0x219bab[_0x340b('0x2a')][_0x340b('0x15')]);}_0x392265[_0x340b('0x33')]=qs[_0x340b('0x34')](_0x219bab[_0x340b('0x2a')][_0x340b('0x34')]);_0x392265['where']=qs['filters'](_[_0x340b('0x35')](_0x219bab[_0x340b('0x2a')],_0x22404e['filters']),_0x5b7618);if(_0x219bab[_0x340b('0x2a')][_0x340b('0x36')]){_0x392265[_0x340b('0x37')]=_['merge'](_0x392265['where'],{'$or':_[_0x340b('0x24')](_0x5b7618,function(_0x891898){if(_0x891898[_0x340b('0x28')]!==_0x340b('0x38')){var _0x4c56fe={};_0x4c56fe[_0x891898[_0x340b('0x22')]]={'$like':'%'+_0x219bab['query'][_0x340b('0x36')]+'%'};return _0x4c56fe;}})});}_0x392265=_['merge']({},_0x392265,_0x219bab['options']);var _0x1dddb7={'where':_0x392265[_0x340b('0x37')]};return db[_0x340b('0x25')]['count'](_0x1dddb7)['then'](function(_0x525e7b){_0x1fbccd[_0x340b('0x17')]=_0x525e7b;if(_0x219bab[_0x340b('0x2a')][_0x340b('0x39')]){_0x392265[_0x340b('0x3a')]=[{'all':!![]}];}return db[_0x340b('0x25')][_0x340b('0x3b')](_0x392265);})[_0x340b('0x1c')](function(_0x51aa76){_0x1fbccd[_0x340b('0x3c')]=_0x51aa76;return _0x1fbccd;})['then'](respondWithFilteredResult(_0x485f80,_0x392265))['catch'](handleError(_0x485f80,null));};exports[_0x340b('0x3d')]=function(_0x1bbc24,_0x2fadd4){var _0x8d1672={'raw':!![],'where':{'id':_0x1bbc24[_0x340b('0x3e')]['id']}},_0x19c698={};_0x19c698[_0x340b('0x3f')]=_['keys'](db[_0x340b('0x25')][_0x340b('0x26')]);_0x19c698[_0x340b('0x2a')]=_['keys'](_0x1bbc24[_0x340b('0x2a')]);_0x19c698[_0x340b('0x2b')]=_[_0x340b('0x2c')](_0x19c698[_0x340b('0x3f')],_0x19c698[_0x340b('0x2a')]);_0x8d1672[_0x340b('0x2d')]=_[_0x340b('0x2c')](_0x19c698[_0x340b('0x3f')],qs[_0x340b('0x2e')](_0x1bbc24[_0x340b('0x2a')][_0x340b('0x2e')]));_0x8d1672[_0x340b('0x2d')]=_0x8d1672['attributes'][_0x340b('0x2f')]?_0x8d1672[_0x340b('0x2d')]:_0x19c698[_0x340b('0x3f')];if(_0x1bbc24[_0x340b('0x2a')][_0x340b('0x39')]){_0x8d1672['include']=[{'all':!![]}];}_0x8d1672=_[_0x340b('0x40')]({},_0x8d1672,_0x1bbc24[_0x340b('0x41')]);return db[_0x340b('0x25')][_0x340b('0x42')](_0x8d1672)['then'](handleEntityNotFound(_0x2fadd4,null))[_0x340b('0x1c')](respondWithResult(_0x2fadd4,null))[_0x340b('0x43')](handleError(_0x2fadd4,null));};exports[_0x340b('0x44')]=function(_0x292abd,_0x474c2b){return db[_0x340b('0x25')][_0x340b('0x44')](_0x292abd['body'],{})['then'](function(_0x2dc21c){var _0x5353fd=_0x292abd['user'][_0x340b('0x1e')]({'plain':!![]});if(!_0x5353fd)throw new Error(_0x340b('0x45'));if(_0x5353fd[_0x340b('0x46')]==='user'){var _0x10b4ca=_0x2dc21c['get']({'plain':!![]});var _0x34bbca=_0x340b('0x1f');return db['UserProfileSection'][_0x340b('0x42')]({'where':{'name':_0x34bbca,'userProfileId':_0x5353fd[_0x340b('0x47')]},'raw':!![]})[_0x340b('0x1c')](function(_0x4fac91){if(_0x4fac91&&_0x4fac91[_0x340b('0x48')]===0x0){return db['UserProfileResource'][_0x340b('0x44')]({'name':_0x10b4ca[_0x340b('0x22')],'resourceId':_0x10b4ca['id'],'type':_0x4fac91[_0x340b('0x22')],'sectionId':_0x4fac91['id']},{})['then'](function(){return _0x2dc21c;});}else{return _0x2dc21c;}})[_0x340b('0x43')](function(_0x325de4){logger[_0x340b('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x325de4);throw _0x325de4;});}return _0x2dc21c;})[_0x340b('0x1c')](respondWithResult(_0x474c2b,0xc9))[_0x340b('0x43')](handleError(_0x474c2b,null));};exports[_0x340b('0x1b')]=function(_0x36544a,_0x50fccf){if(_0x36544a[_0x340b('0x4a')]['id']){delete _0x36544a[_0x340b('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0x340b('0x42')]({'where':{'id':_0x36544a[_0x340b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x50fccf,null))[_0x340b('0x1c')](saveUpdates(_0x36544a[_0x340b('0x4a')],null))[_0x340b('0x1c')](respondWithResult(_0x50fccf,null))[_0x340b('0x43')](handleError(_0x50fccf,null));};exports[_0x340b('0x1d')]=function(_0x572939,_0x2fb393){return db[_0x340b('0x25')]['find']({'where':{'id':_0x572939[_0x340b('0x3e')]['id']}})[_0x340b('0x1c')](handleEntityNotFound(_0x2fb393,null))[_0x340b('0x1c')](removeEntity(_0x2fb393,null))[_0x340b('0x43')](handleError(_0x2fb393,null));};exports['download']=function(_0xc936a0,_0x1c98e9,_0x2c56ea){return db[_0x340b('0x25')][_0x340b('0x42')]({'where':{'id':_0xc936a0[_0x340b('0x3e')]['id']},'attributes':[_0x340b('0x22'),_0x340b('0x4b'),_0x340b('0x4c'),_0x340b('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1c98e9,null))[_0x340b('0x1c')](function(_0x591ba6){if(_0x591ba6){if(!fs['existsSync'](path[_0x340b('0x4e')](config['root'],_0x340b('0x4f'),_0x591ba6[_0x340b('0x4c')]))){throw new db[(_0x340b('0x50'))][(_0x340b('0x51'))](_0x340b('0x52'));}if(_0xc936a0[_0x340b('0x2a')]['exists']){return _0x1c98e9['sendStatus'](0xc8);}return _0x1c98e9['download'](path[_0x340b('0x4e')](config[_0x340b('0x53')],_0x340b('0x4f'),_0x591ba6['savename']),util[_0x340b('0x54')]('%s.%s',_0x591ba6['basename']||_0x591ba6[_0x340b('0x22')],_0x591ba6[_0x340b('0x4d')]['toLowerCase']()));}})[_0x340b('0x43')](handleError(_0x1c98e9,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f72e578..a988460 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 _0x777b=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x777b,0xb9));var _0xb777=function(_0x3bf12c,_0x2cce3d){_0x3bf12c=_0x3bf12c-0x0;var _0xabef12=_0x777b[_0x3bf12c];return _0xabef12;};'use strict';var _=require(_0xb777('0x0'));var util=require(_0xb777('0x1'));var logger=require(_0xb777('0x2'))(_0xb777('0x3'));var moment=require(_0xb777('0x4'));var BPromise=require(_0xb777('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb777('0x6'));var rimraf=require(_0xb777('0x7'));var config=require(_0xb777('0x8'));var attributes=require(_0xb777('0x9'));module['exports']=function(_0x227604,_0x329861){return _0x227604[_0xb777('0xa')](_0xb777('0xb'),attributes,{'tableName':_0xb777('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x051e=['util','../../config/logger','api','moment','rimraf','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x051e,0x1a3));var _0xe051=function(_0x292447,_0x3de2f9){_0x292447=_0x292447-0x0;var _0x141608=_0x051e[_0x292447];return _0x141608;};'use strict';var _=require(_0xe051('0x0'));var util=require(_0xe051('0x1'));var logger=require(_0xe051('0x2'))(_0xe051('0x3'));var moment=require(_0xe051('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe051('0x5'));var config=require('../../config/environment');var attributes=require(_0xe051('0x6'));module[_0xe051('0x7')]=function(_0x52c27c,_0x1bdac5){return _0x52c27c['define'](_0xe051('0x8'),attributes,{'tableName':_0xe051('0x9'),'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 c5ae159..984d5ed 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 _0xcd74=['message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xcd74,0x16b));var _0x4cd7=function(_0x2480f6,_0x1a1247){_0x2480f6=_0x2480f6-0x0;var _0xc2c3f1=_0xcd74[_0x2480f6];return _0xc2c3f1;};'use strict';var _=require(_0x4cd7('0x0'));var util=require(_0x4cd7('0x1'));var moment=require('moment');var BPromise=require(_0x4cd7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cd7('0x3'));var db=require(_0x4cd7('0x4'))['db'];var utils=require(_0x4cd7('0x5'));var logger=require(_0x4cd7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4cd7('0x7'));var client=jayson['client'][_0x4cd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x176145,_0x181a81,_0x22f900){return new BPromise(function(_0x4af6c8,_0x195783){return client['request'](_0x176145,_0x22f900)[_0x4cd7('0x9')](function(_0x7f60cd){logger[_0x4cd7('0xa')](_0x4cd7('0xb'),_0x181a81,_0x4cd7('0xc'));logger[_0x4cd7('0xd')](_0x4cd7('0xe'),_0x181a81,_0x4cd7('0xc'),JSON[_0x4cd7('0xf')](_0x7f60cd));if(_0x7f60cd[_0x4cd7('0x10')]){if(_0x7f60cd[_0x4cd7('0x10')]['code']===0x1f4){logger[_0x4cd7('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x181a81,_0x7f60cd[_0x4cd7('0x10')][_0x4cd7('0x11')]);return _0x195783(_0x7f60cd[_0x4cd7('0x10')][_0x4cd7('0x11')]);}logger[_0x4cd7('0x10')](_0x4cd7('0xb'),_0x181a81,_0x7f60cd[_0x4cd7('0x10')][_0x4cd7('0x11')]);return _0x4af6c8(_0x7f60cd[_0x4cd7('0x10')][_0x4cd7('0x11')]);}else{logger[_0x4cd7('0xa')](_0x4cd7('0xb'),_0x181a81,_0x4cd7('0xc'));_0x4af6c8(_0x7f60cd['result'][_0x4cd7('0x11')]);}})[_0x4cd7('0x12')](function(_0x5cc352){logger[_0x4cd7('0x10')](_0x4cd7('0xb'),_0x181a81,_0x5cc352);_0x195783(_0x5cc352);});});} \ No newline at end of file +var _0x1c83=['error','message','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x371338,_0x12c8bb){var _0x51d384=function(_0x105f5c){while(--_0x105f5c){_0x371338['push'](_0x371338['shift']());}};_0x51d384(++_0x12c8bb);}(_0x1c83,0x16c));var _0x31c8=function(_0x54a9e0,_0x3a4dd2){_0x54a9e0=_0x54a9e0-0x0;var _0x28bd21=_0x1c83[_0x54a9e0];return _0x28bd21;};'use strict';var _=require('lodash');var util=require(_0x31c8('0x0'));var moment=require(_0x31c8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31c8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x31c8('0x3'));var logger=require(_0x31c8('0x4'))(_0x31c8('0x5'));var config=require(_0x31c8('0x6'));var jayson=require(_0x31c8('0x7'));var client=jayson[_0x31c8('0x8')][_0x31c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1adf53,_0x17e8eb,_0x160029){return new BPromise(function(_0x115b57,_0x331082){return client[_0x31c8('0xa')](_0x1adf53,_0x160029)[_0x31c8('0xb')](function(_0x47655b){logger[_0x31c8('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17e8eb,_0x31c8('0xd'));logger['debug'](_0x31c8('0xe'),_0x17e8eb,'request\x20sent',JSON['stringify'](_0x47655b));if(_0x47655b['error']){if(_0x47655b['error']['code']===0x1f4){logger['error'](_0x31c8('0xf'),_0x17e8eb,_0x47655b[_0x31c8('0x10')][_0x31c8('0x11')]);return _0x331082(_0x47655b[_0x31c8('0x10')][_0x31c8('0x11')]);}logger[_0x31c8('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17e8eb,_0x47655b[_0x31c8('0x10')][_0x31c8('0x11')]);return _0x115b57(_0x47655b[_0x31c8('0x10')][_0x31c8('0x11')]);}else{logger[_0x31c8('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17e8eb,_0x31c8('0xd'));_0x115b57(_0x47655b['result'][_0x31c8('0x11')]);}})[_0x31c8('0x12')](function(_0x5c2ec0){logger[_0x31c8('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x17e8eb,_0x5c2ec0);_0x331082(_0x5c2ec0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index eaf7b43..bfa3ac8 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 _0x6b34=['post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id','isAuthenticated','download'];(function(_0x33b3ab,_0x2530de){var _0x4ec1ec=function(_0x51dea9){while(--_0x51dea9){_0x33b3ab['push'](_0x33b3ab['shift']());}};_0x4ec1ec(++_0x2530de);}(_0x6b34,0x1ce));var _0x46b3=function(_0x1438a6,_0x27e9b7){_0x1438a6=_0x1438a6-0x0;var _0xba2e51=_0x6b34[_0x1438a6];return _0xba2e51;};'use strict';var multer=require(_0x46b3('0x0'));var util=require(_0x46b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46b3('0x2'));var router=express[_0x46b3('0x3')]();var fs_extra=require(_0x46b3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x46b3('0x5'));var config=require(_0x46b3('0x6'));var controller=require(_0x46b3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x46b3('0x8')]);router[_0x46b3('0x9')](_0x46b3('0xa'),auth[_0x46b3('0xb')](),controller['show']);router[_0x46b3('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x46b3('0xc')]);router[_0x46b3('0xd')]('/',auth['isAuthenticated'](),controller[_0x46b3('0xe')]);router[_0x46b3('0xf')](_0x46b3('0xa'),auth[_0x46b3('0xb')](),controller[_0x46b3('0x10')]);router['delete']('/:id',auth[_0x46b3('0xb')](),controller[_0x46b3('0x11')]);module[_0x46b3('0x12')]=router; \ No newline at end of file +var _0x7178=['download','create','put','/:id','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','/:id/download'];(function(_0x1d568c,_0x4f3351){var _0x10f9fb=function(_0x4c85d4){while(--_0x4c85d4){_0x1d568c['push'](_0x1d568c['shift']());}};_0x10f9fb(++_0x4f3351);}(_0x7178,0x116));var _0x8717=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7178[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8717('0x0'));var express=require(_0x8717('0x1'));var router=express[_0x8717('0x2')]();var fs_extra=require(_0x8717('0x3'));var auth=require(_0x8717('0x4'));var interaction=require(_0x8717('0x5'));var config=require(_0x8717('0x6'));var controller=require(_0x8717('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x8717('0x8')](),controller['show']);router['get'](_0x8717('0x9'),auth[_0x8717('0x8')](),controller[_0x8717('0xa')]);router['post']('/',auth[_0x8717('0x8')](),controller[_0x8717('0xb')]);router[_0x8717('0xc')](_0x8717('0xd'),auth[_0x8717('0x8')](),controller['update']);router[_0x8717('0xe')](_0x8717('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8717('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 784f753..cd301c6 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 _0xcbff=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xcbff,0x6e));var _0xfcbf=function(_0x42a8fc,_0x455dab){_0x42a8fc=_0x42a8fc-0x0;var _0x5aad21=_0xcbff[_0x42a8fc];return _0x5aad21;};'use strict';var Sequelize=require(_0xfcbf('0x0'));module[_0xfcbf('0x1')]={'field':{'type':Sequelize[_0xfcbf('0x2')]},'alias':{'type':Sequelize[_0xfcbf('0x3')]},'function':{'type':Sequelize[_0xfcbf('0x3')]},'format':{'type':Sequelize[_0xfcbf('0x3')]},'groupBy':{'type':Sequelize[_0xfcbf('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfcbf('0x3')]},'custom':{'type':Sequelize[_0xfcbf('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6557=['exports','TEXT','STRING','sequelize'];(function(_0x2fb28c,_0x458fc5){var _0x22ee82=function(_0x47aa1c){while(--_0x47aa1c){_0x2fb28c['push'](_0x2fb28c['shift']());}};_0x22ee82(++_0x458fc5);}(_0x6557,0x187));var _0x7655=function(_0x387e2f,_0x5e2cf0){_0x387e2f=_0x387e2f-0x0;var _0x26ab6d=_0x6557[_0x387e2f];return _0x26ab6d;};'use strict';var Sequelize=require(_0x7655('0x0'));module[_0x7655('0x1')]={'field':{'type':Sequelize[_0x7655('0x2')]},'alias':{'type':Sequelize[_0x7655('0x3')]},'function':{'type':Sequelize[_0x7655('0x3')]},'format':{'type':Sequelize[_0x7655('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index cb42917..af93152 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 _0x510c=['mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','end','error','name','send','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','params','includeAll','find','catch','create','body','bulkCreate','addFields','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x728a0d,_0x44ca89){var _0xc575ed=function(_0x418c03){while(--_0x418c03){_0x728a0d['push'](_0x728a0d['shift']());}};_0xc575ed(++_0x44ca89);}(_0x510c,0xdb));var _0xc510=function(_0x19c650,_0x5e6279){_0x19c650=_0x19c650-0x0;var _0x29cc76=_0x510c[_0x19c650];return _0x29cc76;};'use strict';var emlformat=require(_0xc510('0x0'));var rimraf=require(_0xc510('0x1'));var zipdir=require(_0xc510('0x2'));var jsonpatch=require(_0xc510('0x3'));var rp=require(_0xc510('0x4'));var moment=require('moment');var BPromise=require(_0xc510('0x5'));var Mustache=require(_0xc510('0x6'));var util=require(_0xc510('0x7'));var path=require(_0xc510('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc510('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc510('0xa'));var squel=require('squel');var crypto=require(_0xc510('0xb'));var jsforce=require(_0xc510('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc510('0xd'));var querystring=require(_0xc510('0xe'));var Papa=require(_0xc510('0xf'));var Redis=require(_0xc510('0x10'));var authService=require(_0xc510('0x11'));var qs=require(_0xc510('0x12'));var as=require(_0xc510('0x13'));var hardwareService=require(_0xc510('0x14'));var logger=require(_0xc510('0x15'))(_0xc510('0x16'));var utils=require('../../config/utils');var config=require(_0xc510('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53711b,_0x175c6f){_0x175c6f=_0x175c6f||0xcc;return function(_0x806f53){if(_0x806f53){return _0x53711b[_0xc510('0x18')](_0x175c6f);}return _0x53711b['status'](_0x175c6f)['end']();};}function respondWithResult(_0x133863,_0x75b083){_0x75b083=_0x75b083||0xc8;return function(_0x4fd6b9){if(_0x4fd6b9){return _0x133863[_0xc510('0x19')](_0x75b083)[_0xc510('0x1a')](_0x4fd6b9);}};}function respondWithFilteredResult(_0x2c17ac,_0x2666c9){return function(_0xdfaeb7){if(_0xdfaeb7){var _0x2004c7=typeof _0x2666c9[_0xc510('0x1b')]===_0xc510('0x1c')&&typeof _0x2666c9[_0xc510('0x1d')]===_0xc510('0x1c');var _0x44c0e0=_0xdfaeb7[_0xc510('0x1e')];var _0x995bef=_0x2004c7?0x0:_0x2666c9[_0xc510('0x1b')];var _0x2da9e7=_0x2004c7?_0xdfaeb7[_0xc510('0x1e')]:_0x2666c9[_0xc510('0x1b')]+_0x2666c9['limit'];var _0x128160;if(_0x2da9e7>=_0x44c0e0){_0x2da9e7=_0x44c0e0;_0x128160=0xc8;}else{_0x128160=0xce;}_0x2c17ac[_0xc510('0x19')](_0x128160);return _0x2c17ac[_0xc510('0x1f')](_0xc510('0x20'),_0x995bef+'-'+_0x2da9e7+'/'+_0x44c0e0)['json'](_0xdfaeb7);}return null;};}function patchUpdates(_0x15ec7f){return function(_0x2bfa22){try{jsonpatch['apply'](_0x2bfa22,_0x15ec7f,!![]);}catch(_0x1e600c){return BPromise[_0xc510('0x21')](_0x1e600c);}return _0x2bfa22['save']();};}function saveUpdates(_0x301aaf,_0x1a1729){return function(_0x436898){if(_0x436898){return _0x436898[_0xc510('0x22')](_0x301aaf)['then'](function(_0x3e7cea){return _0x3e7cea;});}return null;};}function removeEntity(_0xeaafa1,_0x13e8fc){return function(_0x63c2a2){if(_0x63c2a2){return _0x63c2a2[_0xc510('0x23')]()[_0xc510('0x24')](function(){_0xeaafa1['status'](0xcc)[_0xc510('0x25')]();});}};}function handleEntityNotFound(_0x46365a,_0x898be0){return function(_0x13e67d){if(!_0x13e67d){_0x46365a[_0xc510('0x18')](0x194);}return _0x13e67d;};}function handleError(_0x5989fc,_0x113e9f){_0x113e9f=_0x113e9f||0x1f4;return function(_0xb66a1e){logger[_0xc510('0x26')](_0xb66a1e['stack']);if(_0xb66a1e[_0xc510('0x27')]){delete _0xb66a1e['name'];}_0x5989fc[_0xc510('0x19')](_0x113e9f)[_0xc510('0x28')](_0xb66a1e);};}exports['index']=function(_0x500fb8,_0x157fa8){var _0x372d8e={},_0x3cbb1b={},_0x377a8c={'count':0x0,'rows':[]};var _0x334a1f=_[_0xc510('0x29')](db[_0xc510('0x2a')][_0xc510('0x2b')],function(_0x25e768){return{'name':_0x25e768['fieldName'],'type':_0x25e768[_0xc510('0x2c')][_0xc510('0x2d')]};});_0x3cbb1b[_0xc510('0x2e')]=_[_0xc510('0x29')](_0x334a1f,_0xc510('0x27'));_0x3cbb1b[_0xc510('0x2f')]=_[_0xc510('0x30')](_0x500fb8[_0xc510('0x2f')]);_0x3cbb1b[_0xc510('0x31')]=_[_0xc510('0x32')](_0x3cbb1b[_0xc510('0x2e')],_0x3cbb1b[_0xc510('0x2f')]);_0x372d8e['attributes']=_[_0xc510('0x32')](_0x3cbb1b[_0xc510('0x2e')],qs[_0xc510('0x33')](_0x500fb8[_0xc510('0x2f')][_0xc510('0x33')]));_0x372d8e[_0xc510('0x34')]=_0x372d8e[_0xc510('0x34')][_0xc510('0x35')]?_0x372d8e[_0xc510('0x34')]:_0x3cbb1b[_0xc510('0x2e')];if(!_0x500fb8[_0xc510('0x2f')][_0xc510('0x36')](_0xc510('0x37'))){_0x372d8e[_0xc510('0x1d')]=qs[_0xc510('0x1d')](_0x500fb8[_0xc510('0x2f')]['limit']);_0x372d8e[_0xc510('0x1b')]=qs[_0xc510('0x1b')](_0x500fb8['query'][_0xc510('0x1b')]);}_0x372d8e[_0xc510('0x38')]=qs[_0xc510('0x39')](_0x500fb8[_0xc510('0x2f')][_0xc510('0x39')]);_0x372d8e[_0xc510('0x3a')]=qs[_0xc510('0x31')](_['pick'](_0x500fb8[_0xc510('0x2f')],_0x3cbb1b[_0xc510('0x31')]),_0x334a1f);if(_0x500fb8[_0xc510('0x2f')][_0xc510('0x3b')]){_0x372d8e['where']=_['merge'](_0x372d8e['where'],{'$or':_[_0xc510('0x29')](_0x334a1f,function(_0x4afd64){if(_0x4afd64[_0xc510('0x2c')]!=='VIRTUAL'){var _0x46ffc0={};_0x46ffc0[_0x4afd64[_0xc510('0x27')]]={'$like':'%'+_0x500fb8[_0xc510('0x2f')][_0xc510('0x3b')]+'%'};return _0x46ffc0;}})});}_0x372d8e=_[_0xc510('0x3c')]({},_0x372d8e,_0x500fb8[_0xc510('0x3d')]);var _0x4ecd9b={'where':_0x372d8e[_0xc510('0x3a')]};return db[_0xc510('0x2a')][_0xc510('0x1e')](_0x4ecd9b)[_0xc510('0x24')](function(_0x36e252){_0x377a8c[_0xc510('0x1e')]=_0x36e252;if(_0x500fb8[_0xc510('0x2f')]['includeAll']){_0x372d8e[_0xc510('0x3e')]=[{'all':!![]}];}return db[_0xc510('0x2a')][_0xc510('0x3f')](_0x372d8e);})[_0xc510('0x24')](function(_0x1db811){_0x377a8c['rows']=_0x1db811;return _0x377a8c;})['then'](respondWithFilteredResult(_0x157fa8,_0x372d8e))['catch'](handleError(_0x157fa8,null));};exports['show']=function(_0x3f4c13,_0x4cb3f4){var _0xb3866c={'raw':![],'where':{'id':_0x3f4c13[_0xc510('0x40')]['id']}},_0x55b72e={};_0x55b72e[_0xc510('0x2e')]=_[_0xc510('0x30')](db[_0xc510('0x2a')][_0xc510('0x2b')]);_0x55b72e['query']=_[_0xc510('0x30')](_0x3f4c13[_0xc510('0x2f')]);_0x55b72e[_0xc510('0x31')]=_[_0xc510('0x32')](_0x55b72e[_0xc510('0x2e')],_0x55b72e[_0xc510('0x2f')]);_0xb3866c[_0xc510('0x34')]=_[_0xc510('0x32')](_0x55b72e[_0xc510('0x2e')],qs[_0xc510('0x33')](_0x3f4c13[_0xc510('0x2f')][_0xc510('0x33')]));_0xb3866c[_0xc510('0x34')]=_0xb3866c[_0xc510('0x34')][_0xc510('0x35')]?_0xb3866c['attributes']:_0x55b72e['model'];if(_0x3f4c13['query'][_0xc510('0x41')]){_0xb3866c['include']=[{'all':!![]}];}_0xb3866c=_[_0xc510('0x3c')]({},_0xb3866c,_0x3f4c13[_0xc510('0x3d')]);return db[_0xc510('0x2a')][_0xc510('0x42')](_0xb3866c)[_0xc510('0x24')](handleEntityNotFound(_0x4cb3f4,null))[_0xc510('0x24')](respondWithResult(_0x4cb3f4,null))[_0xc510('0x43')](handleError(_0x4cb3f4,null));};exports['create']=function(_0x41fff1,_0x32d7a4){return db[_0xc510('0x2a')][_0xc510('0x44')](_0x41fff1[_0xc510('0x45')],{})[_0xc510('0x24')](respondWithResult(_0x32d7a4,0xc9))['catch'](handleError(_0x32d7a4,null));};exports[_0xc510('0x46')]=function(_0x113ff2,_0xe88138){return db[_0xc510('0x2a')][_0xc510('0x46')](_0x113ff2[_0xc510('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xe88138,0xc9))[_0xc510('0x43')](handleError(_0xe88138,null));};exports['update']=function(_0xbdcc3,_0x463c7e){if(_0xbdcc3['body']['id']){delete _0xbdcc3[_0xc510('0x45')]['id'];}return db[_0xc510('0x2a')][_0xc510('0x42')]({'where':{'id':_0xbdcc3[_0xc510('0x40')]['id']}})[_0xc510('0x24')](handleEntityNotFound(_0x463c7e,null))['then'](saveUpdates(_0xbdcc3[_0xc510('0x45')],null))[_0xc510('0x24')](respondWithResult(_0x463c7e,null))[_0xc510('0x43')](handleError(_0x463c7e,null));};exports['destroy']=function(_0x5d2689,_0x5c8024){return db[_0xc510('0x2a')][_0xc510('0x42')]({'where':{'id':_0x5d2689[_0xc510('0x40')]['id']}})[_0xc510('0x24')](handleEntityNotFound(_0x5c8024,null))[_0xc510('0x24')](removeEntity(_0x5c8024,null))[_0xc510('0x43')](handleError(_0x5c8024,null));};exports['bulkDestroy']=function(_0x4f8a6a,_0x295cf8){return db['AnalyticFieldReport'][_0xc510('0x23')]({'where':{'id':_0x4f8a6a[_0xc510('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x295cf8,0xcc))['catch'](handleError(_0x295cf8,null));};exports[_0xc510('0x47')]=function(_0x489eaf,_0x141fba,_0x5e4597){return db['AnalyticCustomReport'][_0xc510('0x48')]({'where':{'id':_0x489eaf[_0xc510('0x40')]['id']}})[_0xc510('0x24')](handleEntityNotFound(_0x141fba,null))[_0xc510('0x24')](function(_0x54115e){if(_0x54115e){return db[_0xc510('0x49')]['transaction'](function(_0x50d24f){return db[_0xc510('0x2a')][_0xc510('0x23')]({'where':{'CustomReportId':_0x489eaf[_0xc510('0x40')]['id']},'transaction':_0x50d24f})[_0xc510('0x24')](function(_0x18aca0){var _0x144032=_[_0xc510('0x29')](_0x489eaf['body'],function(_0x5ea098){delete _0x5ea098['id'];_0x5ea098[_0xc510('0x4a')]=_0x489eaf[_0xc510('0x40')]['id'];return _0x5ea098;});return db['AnalyticFieldReport']['bulkCreate'](_0x144032,{'transaction':_0x50d24f});});})[_0xc510('0x24')](function(){return db[_0xc510('0x2a')][_0xc510('0x3f')]({'where':{'CustomReportId':_0x489eaf[_0xc510('0x40')]['id']}});});}})[_0xc510('0x24')](respondWithResult(_0x141fba,null))[_0xc510('0x43')](handleError(_0x141fba,null));}; \ No newline at end of file +var _0x5924=['options','findAll','rows','rawAttributes','include','find','catch','create','body','bulkCreate','update','params','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge'];(function(_0x107ec0,_0x2e7d49){var _0x35c83b=function(_0x37401e){while(--_0x37401e){_0x107ec0['push'](_0x107ec0['shift']());}};_0x35c83b(++_0x2e7d49);}(_0x5924,0xb6));var _0x4592=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x5924[_0x5cbf0e];return _0x1c76f8;};'use strict';var emlformat=require(_0x4592('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4592('0x1'));var jsonpatch=require(_0x4592('0x2'));var rp=require(_0x4592('0x3'));var moment=require(_0x4592('0x4'));var BPromise=require(_0x4592('0x5'));var Mustache=require(_0x4592('0x6'));var util=require(_0x4592('0x7'));var path=require(_0x4592('0x8'));var sox=require(_0x4592('0x9'));var csv=require(_0x4592('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4592('0xb'));var jsforce=require(_0x4592('0xc'));var deskjs=require(_0x4592('0xd'));var toCsv=require(_0x4592('0xa'));var querystring=require(_0x4592('0xe'));var Papa=require(_0x4592('0xf'));var Redis=require(_0x4592('0x10'));var authService=require(_0x4592('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4592('0x12'));var hardwareService=require(_0x4592('0x13'));var logger=require(_0x4592('0x14'))(_0x4592('0x15'));var utils=require(_0x4592('0x16'));var config=require(_0x4592('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4592('0x18'))['db'];function respondWithStatusCode(_0x56165a,_0x39796b){_0x39796b=_0x39796b||0xcc;return function(_0x2f46db){if(_0x2f46db){return _0x56165a[_0x4592('0x19')](_0x39796b);}return _0x56165a[_0x4592('0x1a')](_0x39796b)['end']();};}function respondWithResult(_0x584dbb,_0x38cdc2){_0x38cdc2=_0x38cdc2||0xc8;return function(_0x109a2f){if(_0x109a2f){return _0x584dbb[_0x4592('0x1a')](_0x38cdc2)[_0x4592('0x1b')](_0x109a2f);}};}function respondWithFilteredResult(_0x247bf7,_0x41db9e){return function(_0x516a73){if(_0x516a73){var _0x4375ec=typeof _0x41db9e[_0x4592('0x1c')]===_0x4592('0x1d')&&typeof _0x41db9e[_0x4592('0x1e')]===_0x4592('0x1d');var _0x8f67c9=_0x516a73[_0x4592('0x1f')];var _0x480c0f=_0x4375ec?0x0:_0x41db9e['offset'];var _0x1bb4b8=_0x4375ec?_0x516a73[_0x4592('0x1f')]:_0x41db9e[_0x4592('0x1c')]+_0x41db9e['limit'];var _0x51e461;if(_0x1bb4b8>=_0x8f67c9){_0x1bb4b8=_0x8f67c9;_0x51e461=0xc8;}else{_0x51e461=0xce;}_0x247bf7[_0x4592('0x1a')](_0x51e461);return _0x247bf7['set'](_0x4592('0x20'),_0x480c0f+'-'+_0x1bb4b8+'/'+_0x8f67c9)[_0x4592('0x1b')](_0x516a73);}return null;};}function patchUpdates(_0x458621){return function(_0x3e3840){try{jsonpatch[_0x4592('0x21')](_0x3e3840,_0x458621,!![]);}catch(_0x3de0f7){return BPromise[_0x4592('0x22')](_0x3de0f7);}return _0x3e3840[_0x4592('0x23')]();};}function saveUpdates(_0x2e212f,_0xad9087){return function(_0xf3afbc){if(_0xf3afbc){return _0xf3afbc['update'](_0x2e212f)['then'](function(_0x3eca50){return _0x3eca50;});}return null;};}function removeEntity(_0x32f8b7,_0x1d3b46){return function(_0x19573f){if(_0x19573f){return _0x19573f[_0x4592('0x24')]()[_0x4592('0x25')](function(){_0x32f8b7[_0x4592('0x1a')](0xcc)[_0x4592('0x26')]();});}};}function handleEntityNotFound(_0x5b4934,_0x35a40f){return function(_0x1aa222){if(!_0x1aa222){_0x5b4934[_0x4592('0x19')](0x194);}return _0x1aa222;};}function handleError(_0x1f3de1,_0x1d19f7){_0x1d19f7=_0x1d19f7||0x1f4;return function(_0x41b5f3){logger[_0x4592('0x27')](_0x41b5f3[_0x4592('0x28')]);if(_0x41b5f3[_0x4592('0x29')]){delete _0x41b5f3[_0x4592('0x29')];}_0x1f3de1[_0x4592('0x1a')](_0x1d19f7)[_0x4592('0x2a')](_0x41b5f3);};}exports[_0x4592('0x2b')]=function(_0x1c6c03,_0x28abd7){var _0x19a6d4={},_0x32a659={},_0x3a0bd0={'count':0x0,'rows':[]};var _0x489af9=_[_0x4592('0x2c')](db[_0x4592('0x2d')]['rawAttributes'],function(_0x1b81e3){return{'name':_0x1b81e3[_0x4592('0x2e')],'type':_0x1b81e3['type'][_0x4592('0x2f')]};});_0x32a659[_0x4592('0x30')]=_['map'](_0x489af9,'name');_0x32a659[_0x4592('0x31')]=_[_0x4592('0x32')](_0x1c6c03[_0x4592('0x31')]);_0x32a659[_0x4592('0x33')]=_[_0x4592('0x34')](_0x32a659[_0x4592('0x30')],_0x32a659['query']);_0x19a6d4[_0x4592('0x35')]=_[_0x4592('0x34')](_0x32a659[_0x4592('0x30')],qs[_0x4592('0x36')](_0x1c6c03[_0x4592('0x31')][_0x4592('0x36')]));_0x19a6d4[_0x4592('0x35')]=_0x19a6d4[_0x4592('0x35')][_0x4592('0x37')]?_0x19a6d4['attributes']:_0x32a659[_0x4592('0x30')];if(!_0x1c6c03[_0x4592('0x31')][_0x4592('0x38')]('nolimit')){_0x19a6d4[_0x4592('0x1e')]=qs['limit'](_0x1c6c03['query'][_0x4592('0x1e')]);_0x19a6d4[_0x4592('0x1c')]=qs['offset'](_0x1c6c03[_0x4592('0x31')][_0x4592('0x1c')]);}_0x19a6d4['order']=qs[_0x4592('0x39')](_0x1c6c03[_0x4592('0x31')][_0x4592('0x39')]);_0x19a6d4['where']=qs['filters'](_[_0x4592('0x3a')](_0x1c6c03[_0x4592('0x31')],_0x32a659[_0x4592('0x33')]),_0x489af9);if(_0x1c6c03['query'][_0x4592('0x3b')]){_0x19a6d4[_0x4592('0x3c')]=_['merge'](_0x19a6d4[_0x4592('0x3c')],{'$or':_['map'](_0x489af9,function(_0x224017){if(_0x224017[_0x4592('0x3d')]!==_0x4592('0x3e')){var _0x43293e={};_0x43293e[_0x224017['name']]={'$like':'%'+_0x1c6c03['query'][_0x4592('0x3b')]+'%'};return _0x43293e;}})});}_0x19a6d4=_[_0x4592('0x3f')]({},_0x19a6d4,_0x1c6c03[_0x4592('0x40')]);var _0x22aebf={'where':_0x19a6d4[_0x4592('0x3c')]};return db['AnalyticFieldReport'][_0x4592('0x1f')](_0x22aebf)[_0x4592('0x25')](function(_0x182bdd){_0x3a0bd0[_0x4592('0x1f')]=_0x182bdd;if(_0x1c6c03[_0x4592('0x31')]['includeAll']){_0x19a6d4['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4592('0x41')](_0x19a6d4);})[_0x4592('0x25')](function(_0x20d9c0){_0x3a0bd0[_0x4592('0x42')]=_0x20d9c0;return _0x3a0bd0;})[_0x4592('0x25')](respondWithFilteredResult(_0x28abd7,_0x19a6d4))['catch'](handleError(_0x28abd7,null));};exports['show']=function(_0x363676,_0x45225d){var _0x45efd2={'raw':![],'where':{'id':_0x363676['params']['id']}},_0x11f4b0={};_0x11f4b0[_0x4592('0x30')]=_[_0x4592('0x32')](db['AnalyticFieldReport'][_0x4592('0x43')]);_0x11f4b0[_0x4592('0x31')]=_['keys'](_0x363676[_0x4592('0x31')]);_0x11f4b0[_0x4592('0x33')]=_['intersection'](_0x11f4b0[_0x4592('0x30')],_0x11f4b0['query']);_0x45efd2[_0x4592('0x35')]=_[_0x4592('0x34')](_0x11f4b0[_0x4592('0x30')],qs[_0x4592('0x36')](_0x363676['query'][_0x4592('0x36')]));_0x45efd2[_0x4592('0x35')]=_0x45efd2['attributes'][_0x4592('0x37')]?_0x45efd2[_0x4592('0x35')]:_0x11f4b0['model'];if(_0x363676[_0x4592('0x31')]['includeAll']){_0x45efd2[_0x4592('0x44')]=[{'all':!![]}];}_0x45efd2=_[_0x4592('0x3f')]({},_0x45efd2,_0x363676['options']);return db['AnalyticFieldReport'][_0x4592('0x45')](_0x45efd2)['then'](handleEntityNotFound(_0x45225d,null))[_0x4592('0x25')](respondWithResult(_0x45225d,null))[_0x4592('0x46')](handleError(_0x45225d,null));};exports[_0x4592('0x47')]=function(_0x1ea226,_0x144e9e){return db[_0x4592('0x2d')][_0x4592('0x47')](_0x1ea226[_0x4592('0x48')],{})[_0x4592('0x25')](respondWithResult(_0x144e9e,0xc9))[_0x4592('0x46')](handleError(_0x144e9e,null));};exports[_0x4592('0x49')]=function(_0x34eb60,_0x58db04){return db[_0x4592('0x2d')]['bulkCreate'](_0x34eb60['body'],{'raw':![],'individualHooks':!![]})[_0x4592('0x25')](respondWithResult(_0x58db04,0xc9))['catch'](handleError(_0x58db04,null));};exports[_0x4592('0x4a')]=function(_0x3f421a,_0x56d142){if(_0x3f421a[_0x4592('0x48')]['id']){delete _0x3f421a[_0x4592('0x48')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x3f421a[_0x4592('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56d142,null))[_0x4592('0x25')](saveUpdates(_0x3f421a[_0x4592('0x48')],null))['then'](respondWithResult(_0x56d142,null))['catch'](handleError(_0x56d142,null));};exports[_0x4592('0x24')]=function(_0xb720e0,_0x359507){return db[_0x4592('0x2d')]['find']({'where':{'id':_0xb720e0['params']['id']}})[_0x4592('0x25')](handleEntityNotFound(_0x359507,null))[_0x4592('0x25')](removeEntity(_0x359507,null))[_0x4592('0x46')](handleError(_0x359507,null));};exports[_0x4592('0x4c')]=function(_0x41b425,_0x141f3c){return db[_0x4592('0x2d')]['destroy']({'where':{'id':_0x41b425[_0x4592('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x4592('0x25')](respondWithResult(_0x141f3c,0xcc))[_0x4592('0x46')](handleError(_0x141f3c,null));};exports['addFields']=function(_0x578144,_0x2a26f0,_0xab42b4){return db[_0x4592('0x4d')][_0x4592('0x4e')]({'where':{'id':_0x578144['params']['id']}})[_0x4592('0x25')](handleEntityNotFound(_0x2a26f0,null))[_0x4592('0x25')](function(_0x418b74){if(_0x418b74){return db[_0x4592('0x4f')][_0x4592('0x50')](function(_0x38646b){return db[_0x4592('0x2d')]['destroy']({'where':{'CustomReportId':_0x578144[_0x4592('0x4b')]['id']},'transaction':_0x38646b})['then'](function(_0x580aea){var _0x3f7e5d=_[_0x4592('0x2c')](_0x578144[_0x4592('0x48')],function(_0x3596c0){delete _0x3596c0['id'];_0x3596c0[_0x4592('0x51')]=_0x578144[_0x4592('0x4b')]['id'];return _0x3596c0;});return db[_0x4592('0x2d')][_0x4592('0x49')](_0x3f7e5d,{'transaction':_0x38646b});});})[_0x4592('0x25')](function(){return db['AnalyticFieldReport'][_0x4592('0x41')]({'where':{'CustomReportId':_0x578144[_0x4592('0x4b')]['id']}});});}})[_0x4592('0x25')](respondWithResult(_0x2a26f0,null))['catch'](handleError(_0x2a26f0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9e18895..bd6ae69 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 _0xff7d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xff7d,0xe4));var _0xdff7=function(_0x11c34e,_0x3eb734){_0x11c34e=_0x11c34e-0x0;var _0x350f74=_0xff7d[_0x11c34e];return _0x350f74;};'use strict';var _=require(_0xdff7('0x0'));var util=require('util');var logger=require(_0xdff7('0x1'))(_0xdff7('0x2'));var moment=require(_0xdff7('0x3'));var BPromise=require(_0xdff7('0x4'));var rp=require(_0xdff7('0x5'));var fs=require('fs');var path=require(_0xdff7('0x6'));var rimraf=require(_0xdff7('0x7'));var config=require('../../config/environment');var attributes=require(_0xdff7('0x8'));module[_0xdff7('0x9')]=function(_0x589dd6,_0x33e1af){return _0x589dd6['define'](_0xdff7('0xa'),attributes,{'tableName':_0xdff7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb067=['AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x449c45,_0x5e37d7){var _0x2921a3=function(_0x3abbed){while(--_0x3abbed){_0x449c45['push'](_0x449c45['shift']());}};_0x2921a3(++_0x5e37d7);}(_0xb067,0x1c2));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7b06('0x0'));var logger=require(_0x7b06('0x1'))(_0x7b06('0x2'));var moment=require(_0x7b06('0x3'));var BPromise=require(_0x7b06('0x4'));var rp=require(_0x7b06('0x5'));var fs=require('fs');var path=require(_0x7b06('0x6'));var rimraf=require(_0x7b06('0x7'));var config=require(_0x7b06('0x8'));var attributes=require(_0x7b06('0x9'));module[_0x7b06('0xa')]=function(_0x3e23de,_0x5d8e97){return _0x3e23de[_0x7b06('0xb')](_0x7b06('0xc'),attributes,{'tableName':_0x7b06('0xd'),'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 9006922..f5075cd 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 _0x780b=['http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0xb7d7a,_0x2b9ff4){var _0x4b1d75=function(_0x25edcd){while(--_0x25edcd){_0xb7d7a['push'](_0xb7d7a['shift']());}};_0x4b1d75(++_0x2b9ff4);}(_0x780b,0xd3));var _0xb780=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x780b[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xb780('0x0'));var util=require('util');var moment=require(_0xb780('0x1'));var BPromise=require('bluebird');var rs=require(_0xb780('0x2'));var fs=require('fs');var Redis=require(_0xb780('0x3'));var db=require(_0xb780('0x4'))['db'];var utils=require(_0xb780('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb780('0x6'));var jayson=require(_0xb780('0x7'));var client=jayson[_0xb780('0x8')][_0xb780('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x282488,_0x4adf10,_0x526536){return new BPromise(function(_0x339889,_0x32713e){return client[_0xb780('0xa')](_0x282488,_0x526536)[_0xb780('0xb')](function(_0x132c7a){logger['info'](_0xb780('0xc'),_0x4adf10,_0xb780('0xd'));logger[_0xb780('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4adf10,_0xb780('0xd'),JSON[_0xb780('0xf')](_0x132c7a));if(_0x132c7a[_0xb780('0x10')]){if(_0x132c7a[_0xb780('0x10')][_0xb780('0x11')]===0x1f4){logger['error'](_0xb780('0xc'),_0x4adf10,_0x132c7a[_0xb780('0x10')]['message']);return _0x32713e(_0x132c7a[_0xb780('0x10')][_0xb780('0x12')]);}logger[_0xb780('0x10')](_0xb780('0xc'),_0x4adf10,_0x132c7a[_0xb780('0x10')][_0xb780('0x12')]);return _0x339889(_0x132c7a['error'][_0xb780('0x12')]);}else{logger[_0xb780('0x13')](_0xb780('0xc'),_0x4adf10,_0xb780('0xd'));_0x339889(_0x132c7a[_0xb780('0x14')][_0xb780('0x12')]);}})[_0xb780('0x15')](function(_0x313f9a){logger[_0xb780('0x10')](_0xb780('0xc'),_0x4adf10,_0x313f9a);_0x32713e(_0x313f9a);});});} \ No newline at end of file +var _0x9453=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x8c7462,_0x347f1f){var _0x202790=function(_0x4b8038){while(--_0x4b8038){_0x8c7462['push'](_0x8c7462['shift']());}};_0x202790(++_0x347f1f);}(_0x9453,0xef));var _0x3945=function(_0x2d7954,_0x20c34e){_0x2d7954=_0x2d7954-0x0;var _0x5a4ee1=_0x9453[_0x2d7954];return _0x5a4ee1;};'use strict';var _=require(_0x3945('0x0'));var util=require(_0x3945('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3945('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3945('0x3'))['db'];var utils=require(_0x3945('0x4'));var logger=require(_0x3945('0x5'))(_0x3945('0x6'));var config=require(_0x3945('0x7'));var jayson=require(_0x3945('0x8'));var client=jayson['client'][_0x3945('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0f2ca,_0x32148c,_0x363124){return new BPromise(function(_0x2fdb11,_0x4d1831){return client[_0x3945('0xa')](_0xd0f2ca,_0x363124)[_0x3945('0xb')](function(_0x168a72){logger[_0x3945('0xc')](_0x3945('0xd'),_0x32148c,_0x3945('0xe'));logger[_0x3945('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x32148c,_0x3945('0xe'),JSON[_0x3945('0x10')](_0x168a72));if(_0x168a72[_0x3945('0x11')]){if(_0x168a72[_0x3945('0x11')][_0x3945('0x12')]===0x1f4){logger[_0x3945('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32148c,_0x168a72['error'][_0x3945('0x13')]);return _0x4d1831(_0x168a72[_0x3945('0x11')][_0x3945('0x13')]);}logger['error'](_0x3945('0xd'),_0x32148c,_0x168a72[_0x3945('0x11')][_0x3945('0x13')]);return _0x2fdb11(_0x168a72[_0x3945('0x11')][_0x3945('0x13')]);}else{logger[_0x3945('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32148c,_0x3945('0xe'));_0x2fdb11(_0x168a72[_0x3945('0x14')][_0x3945('0x13')]);}})[_0x3945('0x15')](function(_0x43b241){logger[_0x3945('0x11')](_0x3945('0xd'),_0x32148c,_0x43b241);_0x4d1831(_0x43b241);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 94d2068..e443167 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(_0x4121b7,_0xbd8d75){var _0x5bcc3a=function(_0x3c9573){while(--_0x3c9573){_0x4121b7['push'](_0x4121b7['shift']());}};_0x5bcc3a(++_0xbd8d75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +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(_0x47c8d5,_0x1e2e75){var _0x476808=function(_0x795d7a){while(--_0x795d7a){_0x47c8d5['push'](_0x47c8d5['shift']());}};_0x476808(++_0x1e2e75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 1f49417..36ce868 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 _0x1789=['STRING','TEXT','sequelize','exports'];(function(_0x2e186a,_0x3721bc){var _0xfbe4da=function(_0x109492){while(--_0x109492){_0x2e186a['push'](_0x2e186a['shift']());}};_0xfbe4da(++_0x3721bc);}(_0x1789,0x92));var _0x9178=function(_0x20db3c,_0x2fda98){_0x20db3c=_0x20db3c-0x0;var _0x10daa=_0x1789[_0x20db3c];return _0x10daa;};'use strict';var Sequelize=require(_0x9178('0x0'));module[_0x9178('0x1')]={'name':{'type':Sequelize[_0x9178('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x9178('0x2')]},'metric':{'type':Sequelize[_0x9178('0x3')]},'description':{'type':Sequelize[_0x9178('0x2')]}}; \ No newline at end of file +var _0xb09d=['name','TEXT','sequelize','exports','STRING'];(function(_0x420926,_0x2472d4){var _0x207bf6=function(_0x3cf906){while(--_0x3cf906){_0x420926['push'](_0x420926['shift']());}};_0x207bf6(++_0x2472d4);}(_0xb09d,0xed));var _0xdb09=function(_0x1037ae,_0x818dd7){_0x1037ae=_0x1037ae-0x0;var _0x5234c3=_0xb09d[_0x1037ae];return _0x5234c3;};'use strict';var Sequelize=require(_0xdb09('0x0'));module[_0xdb09('0x1')]={'name':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'unique':_0xdb09('0x3')},'table':{'type':Sequelize[_0xdb09('0x2')]},'metric':{'type':Sequelize[_0xdb09('0x4')]},'description':{'type':Sequelize[_0xdb09('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 81e8559..216917e 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x39bd3f,_0x45b058){var _0x5ce625=function(_0x127975){while(--_0x127975){_0x39bd3f['push'](_0x39bd3f['shift']());}};_0x5ce625(++_0x45b058);}(_0x008c,0x188));var _0xc008=function(_0x3eb926,_0x27e966){_0x3eb926=_0x3eb926-0x0;var _0x29460d=_0x008c[_0x3eb926];return _0x29460d;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x26b664,_0x7ff6c6){var _0x250a79=function(_0x6d16d4){while(--_0x6d16d4){_0x26b664['push'](_0x26b664['shift']());}};_0x250a79(++_0x7ff6c6);}(_0xdc97,0x13b));var _0x7dc9=function(_0x47a114,_0x27e524){_0x47a114=_0x47a114-0x0;var _0x489871=_0xdc97[_0x47a114];return _0x489871;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6eed451..1df3f9c 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 _0x8daf=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','moment','bluebird','path'];(function(_0x2d91f2,_0x4b56ae){var _0x1ba446=function(_0x1668e0){while(--_0x1668e0){_0x2d91f2['push'](_0x2d91f2['shift']());}};_0x1ba446(++_0x4b56ae);}(_0x8daf,0x15c));var _0xf8da=function(_0x3c6a3b,_0x362ae6){_0x3c6a3b=_0x3c6a3b-0x0;var _0x1c474e=_0x8daf[_0x3c6a3b];return _0x1c474e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf8da('0x0'));var BPromise=require(_0xf8da('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8da('0x2'));var rimraf=require(_0xf8da('0x3'));var config=require(_0xf8da('0x4'));var attributes=require(_0xf8da('0x5'));module[_0xf8da('0x6')]=function(_0x1f6571,_0x10c454){return _0x1f6571[_0xf8da('0x7')](_0xf8da('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2af8=['request-promise','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','../../config/logger','api','bluebird'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x2af8,0xf6));var _0x82af=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x2af8[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x82af('0x0'));var util=require('util');var logger=require(_0x82af('0x1'))(_0x82af('0x2'));var moment=require('moment');var BPromise=require(_0x82af('0x3'));var rp=require(_0x82af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82af('0x5'));var config=require('../../config/environment');var attributes=require(_0x82af('0x6'));module[_0x82af('0x7')]=function(_0x4dd422,_0x3d29ef){return _0x4dd422[_0x82af('0x8')]('AnalyticMetric',attributes,{'tableName':_0x82af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 7965195..8aea12b 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 _0x58e2=['client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0x58e2,0x1d5));var _0x258e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x58e2[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x258e('0x0'));var util=require(_0x258e('0x1'));var moment=require('moment');var BPromise=require(_0x258e('0x2'));var rs=require(_0x258e('0x3'));var fs=require('fs');var Redis=require(_0x258e('0x4'));var db=require(_0x258e('0x5'))['db'];var utils=require(_0x258e('0x6'));var logger=require(_0x258e('0x7'))(_0x258e('0x8'));var config=require(_0x258e('0x9'));var jayson=require(_0x258e('0xa'));var client=jayson[_0x258e('0xb')][_0x258e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14134a,_0xa8bbb1,_0x3522bb){return new BPromise(function(_0x40004f,_0x1170af){return client[_0x258e('0xd')](_0x14134a,_0x3522bb)[_0x258e('0xe')](function(_0x1c8e9a){logger[_0x258e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0xa8bbb1,_0x258e('0x10'));logger[_0x258e('0x11')](_0x258e('0x12'),_0xa8bbb1,'request\x20sent',JSON['stringify'](_0x1c8e9a));if(_0x1c8e9a[_0x258e('0x13')]){if(_0x1c8e9a[_0x258e('0x13')][_0x258e('0x14')]===0x1f4){logger[_0x258e('0x13')](_0x258e('0x15'),_0xa8bbb1,_0x1c8e9a[_0x258e('0x13')][_0x258e('0x16')]);return _0x1170af(_0x1c8e9a[_0x258e('0x13')]['message']);}logger[_0x258e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0xa8bbb1,_0x1c8e9a[_0x258e('0x13')]['message']);return _0x40004f(_0x1c8e9a['error']['message']);}else{logger[_0x258e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0xa8bbb1,_0x258e('0x10'));_0x40004f(_0x1c8e9a['result'][_0x258e('0x16')]);}})[_0x258e('0x17')](function(_0x4e93a1){logger[_0x258e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0xa8bbb1,_0x4e93a1);_0x1170af(_0x4e93a1);});});} \ No newline at end of file +var _0x9674=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','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','catch','lodash'];(function(_0x3f48d,_0x639d42){var _0x3cc2cf=function(_0x336afd){while(--_0x336afd){_0x3f48d['push'](_0x3f48d['shift']());}};_0x3cc2cf(++_0x639d42);}(_0x9674,0xbf));var _0x4967=function(_0x2ea087,_0x17f324){_0x2ea087=_0x2ea087-0x0;var _0x23ebac=_0x9674[_0x2ea087];return _0x23ebac;};'use strict';var _=require(_0x4967('0x0'));var util=require(_0x4967('0x1'));var moment=require('moment');var BPromise=require(_0x4967('0x2'));var rs=require(_0x4967('0x3'));var fs=require('fs');var Redis=require(_0x4967('0x4'));var db=require(_0x4967('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4967('0x6'))('rpc');var config=require(_0x4967('0x7'));var jayson=require(_0x4967('0x8'));var client=jayson[_0x4967('0x9')][_0x4967('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8fe375,_0x41dba7,_0x252439){return new BPromise(function(_0x520bc4,_0x1f5433){return client[_0x4967('0xb')](_0x8fe375,_0x252439)[_0x4967('0xc')](function(_0x36e600){logger[_0x4967('0xd')](_0x4967('0xe'),_0x41dba7,_0x4967('0xf'));logger[_0x4967('0x10')](_0x4967('0x11'),_0x41dba7,'request\x20sent',JSON[_0x4967('0x12')](_0x36e600));if(_0x36e600[_0x4967('0x13')]){if(_0x36e600[_0x4967('0x13')][_0x4967('0x14')]===0x1f4){logger[_0x4967('0x13')](_0x4967('0xe'),_0x41dba7,_0x36e600[_0x4967('0x13')][_0x4967('0x15')]);return _0x1f5433(_0x36e600[_0x4967('0x13')][_0x4967('0x15')]);}logger[_0x4967('0x13')](_0x4967('0xe'),_0x41dba7,_0x36e600['error']['message']);return _0x520bc4(_0x36e600[_0x4967('0x13')][_0x4967('0x15')]);}else{logger[_0x4967('0xd')](_0x4967('0xe'),_0x41dba7,_0x4967('0xf'));_0x520bc4(_0x36e600[_0x4967('0x16')][_0x4967('0x15')]);}})[_0x4967('0x17')](function(_0x209ddd){logger[_0x4967('0x13')](_0x4967('0xe'),_0x41dba7,_0x209ddd);_0x1f5433(_0x209ddd);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 64499dd..66ab51b 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 _0x4813=['fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3ca77a,_0x473312){var _0x212470=function(_0x4abfc8){while(--_0x4abfc8){_0x3ca77a['push'](_0x3ca77a['shift']());}};_0x212470(++_0x473312);}(_0x4813,0x14e));var _0x3481=function(_0x45c1e5,_0x59c663){_0x45c1e5=_0x45c1e5-0x0;var _0x62e57b=_0x4813[_0x45c1e5];return _0x62e57b;};'use strict';var multer=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var path=require(_0x3481('0x2'));var timeout=require(_0x3481('0x3'));var express=require(_0x3481('0x4'));var router=express[_0x3481('0x5')]();var fs_extra=require(_0x3481('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3481('0x7'));var config=require(_0x3481('0x8'));var controller=require(_0x3481('0x9'));router[_0x3481('0xa')]('/',auth[_0x3481('0xb')](),controller['index']);router['get'](_0x3481('0xc'),auth['isAuthenticated'](),controller[_0x3481('0xd')]);router[_0x3481('0xe')]('/',auth[_0x3481('0xb')](),controller['create']);router['put']('/:id',auth[_0x3481('0xb')](),controller['update']);router['delete'](_0x3481('0xc'),auth[_0x3481('0xb')](),controller[_0x3481('0xf')]);module[_0x3481('0x10')]=router; \ No newline at end of file +var _0x379e=['../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x379e,0x104));var _0xe379=function(_0xd8b4dd,_0x3c8cbc){_0xd8b4dd=_0xd8b4dd-0x0;var _0x53113d=_0x379e[_0xd8b4dd];return _0x53113d;};'use strict';var multer=require(_0xe379('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe379('0x1'));var router=express[_0xe379('0x2')]();var fs_extra=require(_0xe379('0x3'));var auth=require(_0xe379('0x4'));var interaction=require(_0xe379('0x5'));var config=require(_0xe379('0x6'));var controller=require(_0xe379('0x7'));router['get']('/',auth[_0xe379('0x8')](),controller[_0xe379('0x9')]);router[_0xe379('0xa')](_0xe379('0xb'),auth[_0xe379('0x8')](),controller['show']);router[_0xe379('0xc')]('/',auth[_0xe379('0x8')](),controller[_0xe379('0xd')]);router[_0xe379('0xe')](_0xe379('0xb'),auth[_0xe379('0x8')](),controller[_0xe379('0xf')]);router[_0xe379('0x10')](_0xe379('0xb'),auth['isAuthenticated'](),controller[_0xe379('0x11')]);module[_0xe379('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index eb8df6e..e1f3959 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 _0xfb54=['sequelize'];(function(_0xc43fb7,_0x3f867e){var _0x91899c=function(_0x55d1e8){while(--_0x55d1e8){_0xc43fb7['push'](_0xc43fb7['shift']());}};_0x91899c(++_0x3f867e);}(_0xfb54,0x153));var _0x4fb5=function(_0x4cb14f,_0x59d64b){_0x4cb14f=_0x4cb14f-0x0;var _0x1fdc6c=_0xfb54[_0x4cb14f];return _0x1fdc6c;};'use strict';var Sequelize=require(_0x4fb5('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xd827=['TEXT','sequelize','exports'];(function(_0x5edb55,_0x21a3d0){var _0x4aae5b=function(_0x3ad22b){while(--_0x3ad22b){_0x5edb55['push'](_0x5edb55['shift']());}};_0x4aae5b(++_0x21a3d0);}(_0xd827,0x115));var _0x7d82=function(_0x774b6f,_0x1717fe){_0x774b6f=_0x774b6f-0x0;var _0x38cf6b=_0xd827[_0x774b6f];return _0x38cf6b;};'use strict';var Sequelize=require(_0x7d82('0x0'));module[_0x7d82('0x1')]={'tree':{'type':Sequelize[_0x7d82('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 ae9a2be..a213f85 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 _0xe38d=['filter','merge','options','then','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','apply','reject','save','update','destroy','error','name','map','AnalyticTreeReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x20eb4e,_0x2a60f8){var _0x59ee78=function(_0x54e64b){while(--_0x54e64b){_0x20eb4e['push'](_0x20eb4e['shift']());}};_0x59ee78(++_0x2a60f8);}(_0xe38d,0x166));var _0xde38=function(_0x5205d9,_0x17450c){_0x5205d9=_0x5205d9-0x0;var _0x35c77f=_0xe38d[_0x5205d9];return _0x35c77f;};'use strict';var emlformat=require(_0xde38('0x0'));var rimraf=require(_0xde38('0x1'));var zipdir=require(_0xde38('0x2'));var jsonpatch=require(_0xde38('0x3'));var rp=require(_0xde38('0x4'));var moment=require('moment');var BPromise=require(_0xde38('0x5'));var Mustache=require('mustache');var util=require(_0xde38('0x6'));var path=require(_0xde38('0x7'));var sox=require(_0xde38('0x8'));var csv=require(_0xde38('0x9'));var ejs=require(_0xde38('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde38('0xb'));var squel=require(_0xde38('0xc'));var crypto=require(_0xde38('0xd'));var jsforce=require(_0xde38('0xe'));var deskjs=require(_0xde38('0xf'));var toCsv=require('to-csv');var querystring=require(_0xde38('0x10'));var Papa=require(_0xde38('0x11'));var Redis=require(_0xde38('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xde38('0x13'));var as=require(_0xde38('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde38('0x15'))(_0xde38('0x16'));var utils=require(_0xde38('0x17'));var config=require(_0xde38('0x18'));var licenseUtil=require(_0xde38('0x19'));var db=require(_0xde38('0x1a'))['db'];function respondWithStatusCode(_0x1dd3ad,_0x577c08){_0x577c08=_0x577c08||0xcc;return function(_0x231320){if(_0x231320){return _0x1dd3ad[_0xde38('0x1b')](_0x577c08);}return _0x1dd3ad['status'](_0x577c08)[_0xde38('0x1c')]();};}function respondWithResult(_0x466b2b,_0x51f7fd){_0x51f7fd=_0x51f7fd||0xc8;return function(_0x5b62cf){if(_0x5b62cf){return _0x466b2b['status'](_0x51f7fd)['json'](_0x5b62cf);}};}function respondWithFilteredResult(_0x42f982,_0x11f60d){return function(_0x349788){if(_0x349788){var _0x1cf7dc=typeof _0x11f60d[_0xde38('0x1d')]===_0xde38('0x1e')&&typeof _0x11f60d[_0xde38('0x1f')]==='undefined';var _0x1c8c60=_0x349788[_0xde38('0x20')];var _0x2aeea4=_0x1cf7dc?0x0:_0x11f60d[_0xde38('0x1d')];var _0x4944e5=_0x1cf7dc?_0x349788[_0xde38('0x20')]:_0x11f60d[_0xde38('0x1d')]+_0x11f60d[_0xde38('0x1f')];var _0x13e8bf;if(_0x4944e5>=_0x1c8c60){_0x4944e5=_0x1c8c60;_0x13e8bf=0xc8;}else{_0x13e8bf=0xce;}_0x42f982[_0xde38('0x21')](_0x13e8bf);return _0x42f982['set']('Content-Range',_0x2aeea4+'-'+_0x4944e5+'/'+_0x1c8c60)['json'](_0x349788);}return null;};}function patchUpdates(_0x426f59){return function(_0x388b12){try{jsonpatch[_0xde38('0x22')](_0x388b12,_0x426f59,!![]);}catch(_0x48efd6){return BPromise[_0xde38('0x23')](_0x48efd6);}return _0x388b12[_0xde38('0x24')]();};}function saveUpdates(_0x25da83,_0x2e8a73){return function(_0x15e2e3){if(_0x15e2e3){return _0x15e2e3[_0xde38('0x25')](_0x25da83)['then'](function(_0x44741a){return _0x44741a;});}return null;};}function removeEntity(_0x3c9c46,_0x5b1433){return function(_0x309028){if(_0x309028){return _0x309028[_0xde38('0x26')]()['then'](function(){_0x3c9c46['status'](0xcc)[_0xde38('0x1c')]();});}};}function handleEntityNotFound(_0x5b895b,_0xf67358){return function(_0x3e7b8c){if(!_0x3e7b8c){_0x5b895b[_0xde38('0x1b')](0x194);}return _0x3e7b8c;};}function handleError(_0x39e487,_0x1a5858){_0x1a5858=_0x1a5858||0x1f4;return function(_0x180550){logger[_0xde38('0x27')](_0x180550['stack']);if(_0x180550[_0xde38('0x28')]){delete _0x180550[_0xde38('0x28')];}_0x39e487[_0xde38('0x21')](_0x1a5858)['send'](_0x180550);};}exports['index']=function(_0x255bc6,_0x243bb9){var _0x2e9038={},_0x291712={},_0x4ec636={'count':0x0,'rows':[]};var _0x4681ca=_[_0xde38('0x29')](db[_0xde38('0x2a')][_0xde38('0x2b')],function(_0xcf6f1f){return{'name':_0xcf6f1f[_0xde38('0x2c')],'type':_0xcf6f1f['type']['key']};});_0x291712[_0xde38('0x2d')]=_[_0xde38('0x29')](_0x4681ca,_0xde38('0x28'));_0x291712[_0xde38('0x2e')]=_[_0xde38('0x2f')](_0x255bc6[_0xde38('0x2e')]);_0x291712[_0xde38('0x30')]=_[_0xde38('0x31')](_0x291712['model'],_0x291712[_0xde38('0x2e')]);_0x2e9038[_0xde38('0x32')]=_[_0xde38('0x31')](_0x291712[_0xde38('0x2d')],qs[_0xde38('0x33')](_0x255bc6[_0xde38('0x2e')][_0xde38('0x33')]));_0x2e9038[_0xde38('0x32')]=_0x2e9038['attributes']['length']?_0x2e9038[_0xde38('0x32')]:_0x291712['model'];if(!_0x255bc6[_0xde38('0x2e')][_0xde38('0x34')](_0xde38('0x35'))){_0x2e9038['limit']=qs[_0xde38('0x1f')](_0x255bc6[_0xde38('0x2e')][_0xde38('0x1f')]);_0x2e9038[_0xde38('0x1d')]=qs[_0xde38('0x1d')](_0x255bc6['query'][_0xde38('0x1d')]);}_0x2e9038['order']=qs['sort'](_0x255bc6[_0xde38('0x2e')][_0xde38('0x36')]);_0x2e9038[_0xde38('0x37')]=qs['filters'](_['pick'](_0x255bc6['query'],_0x291712[_0xde38('0x30')]),_0x4681ca);if(_0x255bc6[_0xde38('0x2e')][_0xde38('0x38')]){_0x2e9038['where']=_[_0xde38('0x39')](_0x2e9038['where'],{'$or':_[_0xde38('0x29')](_0x4681ca,function(_0x1e7491){if(_0x1e7491['type']!=='VIRTUAL'){var _0x206ce5={};_0x206ce5[_0x1e7491[_0xde38('0x28')]]={'$like':'%'+_0x255bc6[_0xde38('0x2e')][_0xde38('0x38')]+'%'};return _0x206ce5;}})});}_0x2e9038=_[_0xde38('0x39')]({},_0x2e9038,_0x255bc6[_0xde38('0x3a')]);var _0x3e8612={'where':_0x2e9038['where']};return db['AnalyticTreeReport']['count'](_0x3e8612)[_0xde38('0x3b')](function(_0x58e82d){_0x4ec636[_0xde38('0x20')]=_0x58e82d;if(_0x255bc6[_0xde38('0x2e')][_0xde38('0x3c')]){_0x2e9038[_0xde38('0x3d')]=[{'all':!![]}];}return db[_0xde38('0x2a')][_0xde38('0x3e')](_0x2e9038);})[_0xde38('0x3b')](function(_0x4f6e75){_0x4ec636['rows']=_0x4f6e75;return _0x4ec636;})[_0xde38('0x3b')](respondWithFilteredResult(_0x243bb9,_0x2e9038))[_0xde38('0x3f')](handleError(_0x243bb9,null));};exports[_0xde38('0x40')]=function(_0xf848f0,_0x41588a){var _0xea9e46={'raw':!![],'where':{'id':_0xf848f0[_0xde38('0x41')]['id']}},_0x97a2d7={};_0x97a2d7[_0xde38('0x2d')]=_[_0xde38('0x2f')](db['AnalyticTreeReport'][_0xde38('0x2b')]);_0x97a2d7[_0xde38('0x2e')]=_[_0xde38('0x2f')](_0xf848f0[_0xde38('0x2e')]);_0x97a2d7['filters']=_[_0xde38('0x31')](_0x97a2d7[_0xde38('0x2d')],_0x97a2d7[_0xde38('0x2e')]);_0xea9e46['attributes']=_['intersection'](_0x97a2d7['model'],qs['fields'](_0xf848f0[_0xde38('0x2e')][_0xde38('0x33')]));_0xea9e46[_0xde38('0x32')]=_0xea9e46[_0xde38('0x32')]['length']?_0xea9e46[_0xde38('0x32')]:_0x97a2d7['model'];if(_0xf848f0[_0xde38('0x2e')][_0xde38('0x3c')]){_0xea9e46[_0xde38('0x3d')]=[{'all':!![]}];}_0xea9e46=_[_0xde38('0x39')]({},_0xea9e46,_0xf848f0[_0xde38('0x3a')]);return db[_0xde38('0x2a')]['find'](_0xea9e46)['then'](handleEntityNotFound(_0x41588a,null))['then'](respondWithResult(_0x41588a,null))[_0xde38('0x3f')](handleError(_0x41588a,null));};exports['create']=function(_0x16f959,_0x914397){return db[_0xde38('0x2a')][_0xde38('0x42')](_0x16f959[_0xde38('0x43')],{})[_0xde38('0x3b')](respondWithResult(_0x914397,0xc9))['catch'](handleError(_0x914397,null));};exports[_0xde38('0x25')]=function(_0x4792cc,_0x20ce3d){if(_0x4792cc[_0xde38('0x43')]['id']){delete _0x4792cc['body']['id'];}return db[_0xde38('0x2a')][_0xde38('0x44')]({'where':{'id':_0x4792cc[_0xde38('0x41')]['id']}})[_0xde38('0x3b')](handleEntityNotFound(_0x20ce3d,null))[_0xde38('0x3b')](saveUpdates(_0x4792cc['body'],null))[_0xde38('0x3b')](respondWithResult(_0x20ce3d,null))[_0xde38('0x3f')](handleError(_0x20ce3d,null));};exports['destroy']=function(_0xee744,_0x103866){return db[_0xde38('0x2a')][_0xde38('0x44')]({'where':{'id':_0xee744[_0xde38('0x41')]['id']}})['then'](handleEntityNotFound(_0x103866,null))[_0xde38('0x3b')](removeEntity(_0x103866,null))[_0xde38('0x3f')](handleError(_0x103866,null));}; \ No newline at end of file +var _0xe706=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x5a2c71,_0x3a2c36){var _0x640a45=function(_0x3b40a8){while(--_0x3b40a8){_0x5a2c71['push'](_0x5a2c71['shift']());}};_0x640a45(++_0x3a2c36);}(_0xe706,0xd6));var _0x6e70=function(_0x5038e3,_0x29855b){_0x5038e3=_0x5038e3-0x0;var _0x593c8d=_0xe706[_0x5038e3];return _0x593c8d;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require(_0x6e70('0x3'));var rp=require('request-promise');var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require('mustache');var util=require(_0x6e70('0x6'));var path=require(_0x6e70('0x7'));var sox=require(_0x6e70('0x8'));var csv=require(_0x6e70('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e70('0xa'));var _=require(_0x6e70('0xb'));var squel=require('squel');var crypto=require(_0x6e70('0xc'));var jsforce=require(_0x6e70('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e70('0x9'));var querystring=require(_0x6e70('0xe'));var Papa=require(_0x6e70('0xf'));var Redis=require(_0x6e70('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6e70('0x11'));var as=require(_0x6e70('0x12'));var hardwareService=require(_0x6e70('0x13'));var logger=require(_0x6e70('0x14'))(_0x6e70('0x15'));var utils=require('../../config/utils');var config=require(_0x6e70('0x16'));var licenseUtil=require(_0x6e70('0x17'));var db=require(_0x6e70('0x18'))['db'];function respondWithStatusCode(_0x3b0746,_0x274117){_0x274117=_0x274117||0xcc;return function(_0x24f886){if(_0x24f886){return _0x3b0746[_0x6e70('0x19')](_0x274117);}return _0x3b0746['status'](_0x274117)[_0x6e70('0x1a')]();};}function respondWithResult(_0x397171,_0x4c6368){_0x4c6368=_0x4c6368||0xc8;return function(_0x41a580){if(_0x41a580){return _0x397171['status'](_0x4c6368)[_0x6e70('0x1b')](_0x41a580);}};}function respondWithFilteredResult(_0x36e588,_0x24b756){return function(_0x112fc0){if(_0x112fc0){var _0x37e067=typeof _0x24b756['offset']===_0x6e70('0x1c')&&typeof _0x24b756[_0x6e70('0x1d')]===_0x6e70('0x1c');var _0x2f2375=_0x112fc0[_0x6e70('0x1e')];var _0x2e6fd5=_0x37e067?0x0:_0x24b756[_0x6e70('0x1f')];var _0x40d252=_0x37e067?_0x112fc0['count']:_0x24b756[_0x6e70('0x1f')]+_0x24b756[_0x6e70('0x1d')];var _0x37857a;if(_0x40d252>=_0x2f2375){_0x40d252=_0x2f2375;_0x37857a=0xc8;}else{_0x37857a=0xce;}_0x36e588[_0x6e70('0x20')](_0x37857a);return _0x36e588[_0x6e70('0x21')](_0x6e70('0x22'),_0x2e6fd5+'-'+_0x40d252+'/'+_0x2f2375)[_0x6e70('0x1b')](_0x112fc0);}return null;};}function patchUpdates(_0x16da56){return function(_0x478dc5){try{jsonpatch[_0x6e70('0x23')](_0x478dc5,_0x16da56,!![]);}catch(_0x2822e3){return BPromise[_0x6e70('0x24')](_0x2822e3);}return _0x478dc5[_0x6e70('0x25')]();};}function saveUpdates(_0x30ecee,_0x1b22d2){return function(_0x59a785){if(_0x59a785){return _0x59a785[_0x6e70('0x26')](_0x30ecee)[_0x6e70('0x27')](function(_0x4dafd0){return _0x4dafd0;});}return null;};}function removeEntity(_0x370321,_0x329043){return function(_0x1c1df7){if(_0x1c1df7){return _0x1c1df7[_0x6e70('0x28')]()[_0x6e70('0x27')](function(){_0x370321[_0x6e70('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f2941,_0xf2bcb7){return function(_0x213d49){if(!_0x213d49){_0x2f2941[_0x6e70('0x19')](0x194);}return _0x213d49;};}function handleError(_0x9ebd7,_0x420c41){_0x420c41=_0x420c41||0x1f4;return function(_0x11d13a){logger['error'](_0x11d13a[_0x6e70('0x29')]);if(_0x11d13a[_0x6e70('0x2a')]){delete _0x11d13a[_0x6e70('0x2a')];}_0x9ebd7[_0x6e70('0x20')](_0x420c41)[_0x6e70('0x2b')](_0x11d13a);};}exports[_0x6e70('0x2c')]=function(_0x21f018,_0x5f560b){var _0x5e5c0a={},_0x3ec9db={},_0x5ae654={'count':0x0,'rows':[]};var _0x24b989=_[_0x6e70('0x2d')](db[_0x6e70('0x2e')]['rawAttributes'],function(_0x6575ce){return{'name':_0x6575ce['fieldName'],'type':_0x6575ce[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3ec9db['model']=_['map'](_0x24b989,'name');_0x3ec9db[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x21f018[_0x6e70('0x31')]);_0x3ec9db[_0x6e70('0x33')]=_['intersection'](_0x3ec9db[_0x6e70('0x34')],_0x3ec9db[_0x6e70('0x31')]);_0x5e5c0a[_0x6e70('0x35')]=_['intersection'](_0x3ec9db[_0x6e70('0x34')],qs[_0x6e70('0x36')](_0x21f018[_0x6e70('0x31')][_0x6e70('0x36')]));_0x5e5c0a[_0x6e70('0x35')]=_0x5e5c0a[_0x6e70('0x35')][_0x6e70('0x37')]?_0x5e5c0a[_0x6e70('0x35')]:_0x3ec9db[_0x6e70('0x34')];if(!_0x21f018['query'][_0x6e70('0x38')](_0x6e70('0x39'))){_0x5e5c0a[_0x6e70('0x1d')]=qs[_0x6e70('0x1d')](_0x21f018['query'][_0x6e70('0x1d')]);_0x5e5c0a[_0x6e70('0x1f')]=qs[_0x6e70('0x1f')](_0x21f018[_0x6e70('0x31')][_0x6e70('0x1f')]);}_0x5e5c0a[_0x6e70('0x3a')]=qs[_0x6e70('0x3b')](_0x21f018[_0x6e70('0x31')][_0x6e70('0x3b')]);_0x5e5c0a['where']=qs[_0x6e70('0x33')](_[_0x6e70('0x3c')](_0x21f018[_0x6e70('0x31')],_0x3ec9db[_0x6e70('0x33')]),_0x24b989);if(_0x21f018[_0x6e70('0x31')]['filter']){_0x5e5c0a['where']=_[_0x6e70('0x3d')](_0x5e5c0a['where'],{'$or':_[_0x6e70('0x2d')](_0x24b989,function(_0x558482){if(_0x558482['type']!==_0x6e70('0x3e')){var _0x5f1df6={};_0x5f1df6[_0x558482[_0x6e70('0x2a')]]={'$like':'%'+_0x21f018[_0x6e70('0x31')][_0x6e70('0x3f')]+'%'};return _0x5f1df6;}})});}_0x5e5c0a=_[_0x6e70('0x3d')]({},_0x5e5c0a,_0x21f018[_0x6e70('0x40')]);var _0x4b0f24={'where':_0x5e5c0a[_0x6e70('0x41')]};return db[_0x6e70('0x2e')][_0x6e70('0x1e')](_0x4b0f24)['then'](function(_0x2022b2){_0x5ae654[_0x6e70('0x1e')]=_0x2022b2;if(_0x21f018[_0x6e70('0x31')][_0x6e70('0x42')]){_0x5e5c0a['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x5e5c0a);})[_0x6e70('0x27')](function(_0x234e23){_0x5ae654[_0x6e70('0x43')]=_0x234e23;return _0x5ae654;})[_0x6e70('0x27')](respondWithFilteredResult(_0x5f560b,_0x5e5c0a))[_0x6e70('0x44')](handleError(_0x5f560b,null));};exports[_0x6e70('0x45')]=function(_0x3f1567,_0x3293a2){var _0x526e63={'raw':!![],'where':{'id':_0x3f1567[_0x6e70('0x46')]['id']}},_0x159c3c={};_0x159c3c[_0x6e70('0x34')]=_[_0x6e70('0x32')](db[_0x6e70('0x2e')][_0x6e70('0x47')]);_0x159c3c[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x3f1567['query']);_0x159c3c[_0x6e70('0x33')]=_[_0x6e70('0x48')](_0x159c3c['model'],_0x159c3c[_0x6e70('0x31')]);_0x526e63[_0x6e70('0x35')]=_[_0x6e70('0x48')](_0x159c3c[_0x6e70('0x34')],qs[_0x6e70('0x36')](_0x3f1567[_0x6e70('0x31')][_0x6e70('0x36')]));_0x526e63['attributes']=_0x526e63[_0x6e70('0x35')]['length']?_0x526e63['attributes']:_0x159c3c[_0x6e70('0x34')];if(_0x3f1567[_0x6e70('0x31')][_0x6e70('0x42')]){_0x526e63[_0x6e70('0x49')]=[{'all':!![]}];}_0x526e63=_['merge']({},_0x526e63,_0x3f1567[_0x6e70('0x40')]);return db[_0x6e70('0x2e')][_0x6e70('0x4a')](_0x526e63)[_0x6e70('0x27')](handleEntityNotFound(_0x3293a2,null))[_0x6e70('0x27')](respondWithResult(_0x3293a2,null))[_0x6e70('0x44')](handleError(_0x3293a2,null));};exports[_0x6e70('0x4b')]=function(_0x2f3111,_0x1e1125){return db[_0x6e70('0x2e')][_0x6e70('0x4b')](_0x2f3111[_0x6e70('0x4c')],{})[_0x6e70('0x27')](respondWithResult(_0x1e1125,0xc9))['catch'](handleError(_0x1e1125,null));};exports[_0x6e70('0x26')]=function(_0x3dd7,_0x20bb9e){if(_0x3dd7[_0x6e70('0x4c')]['id']){delete _0x3dd7['body']['id'];}return db['AnalyticTreeReport'][_0x6e70('0x4a')]({'where':{'id':_0x3dd7[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x20bb9e,null))[_0x6e70('0x27')](saveUpdates(_0x3dd7[_0x6e70('0x4c')],null))['then'](respondWithResult(_0x20bb9e,null))[_0x6e70('0x44')](handleError(_0x20bb9e,null));};exports['destroy']=function(_0x22408a,_0x35cea7){return db[_0x6e70('0x2e')][_0x6e70('0x4a')]({'where':{'id':_0x22408a[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x35cea7,null))[_0x6e70('0x27')](removeEntity(_0x35cea7,null))[_0x6e70('0x44')](handleError(_0x35cea7,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8172186..e216f37 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 _0xa6be=['AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','bluebird','request-promise','path','exports','define'];(function(_0x39f794,_0x212dc5){var _0x180134=function(_0x1b6401){while(--_0x1b6401){_0x39f794['push'](_0x39f794['shift']());}};_0x180134(++_0x212dc5);}(_0xa6be,0x7a));var _0xea6b=function(_0x1cccd9,_0xeabc88){_0x1cccd9=_0x1cccd9-0x0;var _0x1ae588=_0xa6be[_0x1cccd9];return _0x1ae588;};'use strict';var _=require('lodash');var util=require(_0xea6b('0x0'));var logger=require(_0xea6b('0x1'))('api');var moment=require(_0xea6b('0x2'));var BPromise=require(_0xea6b('0x3'));var rp=require(_0xea6b('0x4'));var fs=require('fs');var path=require(_0xea6b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0xea6b('0x6')]=function(_0x3dde2c,_0xf3b6c2){return _0x3dde2c[_0xea6b('0x7')](_0xea6b('0x8'),attributes,{'tableName':_0xea6b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aa1=['define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5effe3,_0x15cf55){var _0x2ae1f8=function(_0x313a5b){while(--_0x313a5b){_0x5effe3['push'](_0x5effe3['shift']());}};_0x2ae1f8(++_0x15cf55);}(_0x1aa1,0x162));var _0x11aa=function(_0x43f69e,_0x3115a4){_0x43f69e=_0x43f69e-0x0;var _0x5d733e=_0x1aa1[_0x43f69e];return _0x5d733e;};'use strict';var _=require(_0x11aa('0x0'));var util=require(_0x11aa('0x1'));var logger=require(_0x11aa('0x2'))(_0x11aa('0x3'));var moment=require(_0x11aa('0x4'));var BPromise=require(_0x11aa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11aa('0x6'));var rimraf=require(_0x11aa('0x7'));var config=require(_0x11aa('0x8'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1e727d,_0x29eae3){return _0x1e727d[_0x11aa('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x11aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index afd3d19..eb6a4c5 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x47e279,_0x346c67){var _0x59de91=function(_0x8573b){while(--_0x8573b){_0x47e279['push'](_0x47e279['shift']());}};_0x59de91(++_0x346c67);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x77936c,_0x4464a5){var _0xbed3a5=function(_0x2f85f8){while(--_0x2f85f8){_0x77936c['push'](_0x77936c['shift']());}};_0xbed3a5(++_0x4464a5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4652a9,_0x2078f5){_0x4652a9=_0x4652a9-0x0;var _0x1497fe=_0x5f2f[_0x4652a9];return _0x1497fe;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 95cc89c..e96fae3 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 _0xbe3d=['../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b8f33,_0x59227c){var _0x5919c5=function(_0x132d35){while(--_0x132d35){_0x1b8f33['push'](_0x1b8f33['shift']());}};_0x5919c5(++_0x59227c);}(_0xbe3d,0x89));var _0xdbe3=function(_0x11446a,_0x1e8460){_0x11446a=_0x11446a-0x0;var _0x3d1f82=_0xbe3d[_0x11446a];return _0x3d1f82;};'use strict';var multer=require('multer');var util=require(_0xdbe3('0x0'));var path=require(_0xdbe3('0x1'));var timeout=require(_0xdbe3('0x2'));var express=require(_0xdbe3('0x3'));var router=express[_0xdbe3('0x4')]();var fs_extra=require(_0xdbe3('0x5'));var auth=require(_0xdbe3('0x6'));var interaction=require(_0xdbe3('0x7'));var config=require('../../config/environment');var controller=require(_0xdbe3('0x8'));router[_0xdbe3('0x9')]('/',auth[_0xdbe3('0xa')](),controller[_0xdbe3('0xb')]);router[_0xdbe3('0x9')](_0xdbe3('0xc'),auth['isAuthenticated'](),controller[_0xdbe3('0xd')]);router['post']('/',auth[_0xdbe3('0xa')](),controller['create']);router[_0xdbe3('0xe')](_0xdbe3('0xc'),auth[_0xdbe3('0xa')](),controller[_0xdbe3('0xf')]);router['delete'](_0xdbe3('0xc'),auth[_0xdbe3('0xa')](),controller[_0xdbe3('0x10')]);module[_0xdbe3('0x11')]=router; \ No newline at end of file +var _0x66bc=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2b2b21,_0x19b7ef){var _0x2ef804=function(_0x5694ce){while(--_0x5694ce){_0x2b2b21['push'](_0x2b2b21['shift']());}};_0x2ef804(++_0x19b7ef);}(_0x66bc,0x162));var _0xc66b=function(_0x100a35,_0x54aaf1){_0x100a35=_0x100a35-0x0;var _0x3ced33=_0x66bc[_0x100a35];return _0x3ced33;};'use strict';var multer=require(_0xc66b('0x0'));var util=require(_0xc66b('0x1'));var path=require(_0xc66b('0x2'));var timeout=require(_0xc66b('0x3'));var express=require(_0xc66b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc66b('0x5'));var interaction=require(_0xc66b('0x6'));var config=require(_0xc66b('0x7'));var controller=require(_0xc66b('0x8'));router[_0xc66b('0x9')]('/',auth[_0xc66b('0xa')](),controller['index']);router['get']('/:id',auth[_0xc66b('0xa')](),controller[_0xc66b('0xb')]);router[_0xc66b('0xc')]('/',auth[_0xc66b('0xa')](),controller[_0xc66b('0xd')]);router[_0xc66b('0xe')](_0xc66b('0xf'),auth[_0xc66b('0xa')](),controller['update']);router[_0xc66b('0x10')](_0xc66b('0xf'),auth[_0xc66b('0xa')](),controller[_0xc66b('0x11')]);module[_0xc66b('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 816484e..0ee2f6c 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 _0x60c2=['STRING','exports'];(function(_0x3f72d3,_0x2180f5){var _0x19c015=function(_0x15ad8a){while(--_0x15ad8a){_0x3f72d3['push'](_0x3f72d3['shift']());}};_0x19c015(++_0x2180f5);}(_0x60c2,0x8f));var _0x260c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60c2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x260c('0x0')]={'name':{'type':Sequelize[_0x260c('0x1')]},'basename':{'type':Sequelize[_0x260c('0x1')]},'type':{'type':Sequelize[_0x260c('0x1')]}}; \ No newline at end of file +var _0xab29=['STRING','sequelize','exports'];(function(_0x35f59d,_0x38d56c){var _0xc90018=function(_0x4c52ee){while(--_0x4c52ee){_0x35f59d['push'](_0x35f59d['shift']());}};_0xc90018(++_0x38d56c);}(_0xab29,0x145));var _0x9ab2=function(_0x44be5c,_0x3fc6fd){_0x44be5c=_0x44be5c-0x0;var _0x2ee726=_0xab29[_0x44be5c];return _0x2ee726;};'use strict';var Sequelize=require(_0x9ab2('0x0'));module[_0x9ab2('0x1')]={'name':{'type':Sequelize[_0x9ab2('0x2')]},'basename':{'type':Sequelize[_0x9ab2('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 38b4ff4..41d7ea8 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 _0x66e3=['save','update','then','destroy','end','error','stack','name','send','map','Attachment','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','clone','get','omit','createdAt','updatedAt','body','create','find','file','originalname','basename','filename','type','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x66e3,0xe0));var _0x366e=function(_0xc10d06,_0x591702){_0xc10d06=_0xc10d06-0x0;var _0x1eaa75=_0x66e3[_0xc10d06];return _0x1eaa75;};'use strict';var emlformat=require(_0x366e('0x0'));var rimraf=require(_0x366e('0x1'));var zipdir=require(_0x366e('0x2'));var jsonpatch=require(_0x366e('0x3'));var rp=require(_0x366e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x366e('0x5'));var util=require('util');var path=require(_0x366e('0x6'));var sox=require('sox');var csv=require(_0x366e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x366e('0x8'));var squel=require(_0x366e('0x9'));var crypto=require('crypto');var jsforce=require(_0x366e('0xa'));var deskjs=require(_0x366e('0xb'));var toCsv=require(_0x366e('0x7'));var querystring=require(_0x366e('0xc'));var Papa=require('papaparse');var Redis=require(_0x366e('0xd'));var authService=require(_0x366e('0xe'));var qs=require(_0x366e('0xf'));var as=require(_0x366e('0x10'));var hardwareService=require(_0x366e('0x11'));var logger=require('../../config/logger')(_0x366e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x366e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4c58,_0x205887){_0x205887=_0x205887||0xcc;return function(_0x592f3e){if(_0x592f3e){return _0x4a4c58[_0x366e('0x14')](_0x205887);}return _0x4a4c58['status'](_0x205887)['end']();};}function respondWithResult(_0x32a465,_0x2f4254){_0x2f4254=_0x2f4254||0xc8;return function(_0x5c64e7){if(_0x5c64e7){return _0x32a465['status'](_0x2f4254)[_0x366e('0x15')](_0x5c64e7);}};}function respondWithFilteredResult(_0x4ca37f,_0x1637ca){return function(_0x4683f4){if(_0x4683f4){var _0x207d02=typeof _0x1637ca[_0x366e('0x16')]===_0x366e('0x17')&&typeof _0x1637ca[_0x366e('0x18')]===_0x366e('0x17');var _0x3f476f=_0x4683f4[_0x366e('0x19')];var _0x4e1fd7=_0x207d02?0x0:_0x1637ca['offset'];var _0x318ca7=_0x207d02?_0x4683f4[_0x366e('0x19')]:_0x1637ca['offset']+_0x1637ca[_0x366e('0x18')];var _0x4ebb23;if(_0x318ca7>=_0x3f476f){_0x318ca7=_0x3f476f;_0x4ebb23=0xc8;}else{_0x4ebb23=0xce;}_0x4ca37f[_0x366e('0x1a')](_0x4ebb23);return _0x4ca37f[_0x366e('0x1b')](_0x366e('0x1c'),_0x4e1fd7+'-'+_0x318ca7+'/'+_0x3f476f)[_0x366e('0x15')](_0x4683f4);}return null;};}function patchUpdates(_0x27ab0f){return function(_0x80c0ff){try{jsonpatch[_0x366e('0x1d')](_0x80c0ff,_0x27ab0f,!![]);}catch(_0x520ed0){return BPromise[_0x366e('0x1e')](_0x520ed0);}return _0x80c0ff[_0x366e('0x1f')]();};}function saveUpdates(_0x3207b1,_0xe1d1c0){return function(_0xc0a7bf){if(_0xc0a7bf){return _0xc0a7bf[_0x366e('0x20')](_0x3207b1)[_0x366e('0x21')](function(_0x1db028){return _0x1db028;});}return null;};}function removeEntity(_0x2219ee,_0x3a037b){return function(_0x41f7f1){if(_0x41f7f1){return _0x41f7f1[_0x366e('0x22')]()['then'](function(){_0x2219ee['status'](0xcc)[_0x366e('0x23')]();});}};}function handleEntityNotFound(_0x5f043c,_0x49eae1){return function(_0x29f1f9){if(!_0x29f1f9){_0x5f043c[_0x366e('0x14')](0x194);}return _0x29f1f9;};}function handleError(_0x4e88a8,_0x205250){_0x205250=_0x205250||0x1f4;return function(_0x43bed1){logger[_0x366e('0x24')](_0x43bed1[_0x366e('0x25')]);if(_0x43bed1[_0x366e('0x26')]){delete _0x43bed1[_0x366e('0x26')];}_0x4e88a8[_0x366e('0x1a')](_0x205250)[_0x366e('0x27')](_0x43bed1);};}exports['index']=function(_0x2584e6,_0x319063){var _0x1da35a={},_0x70d65d={},_0x5236da={'count':0x0,'rows':[]};var _0x13002b=_[_0x366e('0x28')](db[_0x366e('0x29')][_0x366e('0x2a')],function(_0x4fe6bf){return{'name':_0x4fe6bf[_0x366e('0x2b')],'type':_0x4fe6bf['type'][_0x366e('0x2c')]};});_0x70d65d[_0x366e('0x2d')]=_[_0x366e('0x28')](_0x13002b,_0x366e('0x26'));_0x70d65d['query']=_[_0x366e('0x2e')](_0x2584e6[_0x366e('0x2f')]);_0x70d65d[_0x366e('0x30')]=_[_0x366e('0x31')](_0x70d65d[_0x366e('0x2d')],_0x70d65d['query']);_0x1da35a[_0x366e('0x32')]=_[_0x366e('0x31')](_0x70d65d[_0x366e('0x2d')],qs['fields'](_0x2584e6['query'][_0x366e('0x33')]));_0x1da35a[_0x366e('0x32')]=_0x1da35a[_0x366e('0x32')][_0x366e('0x34')]?_0x1da35a['attributes']:_0x70d65d['model'];if(!_0x2584e6[_0x366e('0x2f')][_0x366e('0x35')](_0x366e('0x36'))){_0x1da35a['limit']=qs[_0x366e('0x18')](_0x2584e6[_0x366e('0x2f')][_0x366e('0x18')]);_0x1da35a[_0x366e('0x16')]=qs[_0x366e('0x16')](_0x2584e6['query'][_0x366e('0x16')]);}_0x1da35a['order']=qs[_0x366e('0x37')](_0x2584e6['query'][_0x366e('0x37')]);_0x1da35a[_0x366e('0x38')]=qs[_0x366e('0x30')](_['pick'](_0x2584e6[_0x366e('0x2f')],_0x70d65d['filters']),_0x13002b);if(_0x2584e6['query'][_0x366e('0x39')]){_0x1da35a['where']=_[_0x366e('0x3a')](_0x1da35a[_0x366e('0x38')],{'$or':_[_0x366e('0x28')](_0x13002b,function(_0x9da0d2){if(_0x9da0d2['type']!==_0x366e('0x3b')){var _0x5db490={};_0x5db490[_0x9da0d2[_0x366e('0x26')]]={'$like':'%'+_0x2584e6['query']['filter']+'%'};return _0x5db490;}})});}_0x1da35a=_[_0x366e('0x3a')]({},_0x1da35a,_0x2584e6[_0x366e('0x3c')]);var _0x2d5884={'where':_0x1da35a[_0x366e('0x38')]};return db['Attachment']['count'](_0x2d5884)[_0x366e('0x21')](function(_0x466327){_0x5236da['count']=_0x466327;if(_0x2584e6[_0x366e('0x2f')][_0x366e('0x3d')]){_0x1da35a[_0x366e('0x3e')]=[{'all':!![]}];}return db[_0x366e('0x29')]['findAll'](_0x1da35a);})[_0x366e('0x21')](function(_0xc14a07){_0x5236da[_0x366e('0x3f')]=_0xc14a07;return _0x5236da;})[_0x366e('0x21')](respondWithFilteredResult(_0x319063,_0x1da35a))[_0x366e('0x40')](handleError(_0x319063,null));};exports['show']=function(_0x529db8,_0x4cbc12){var _0x4b84c0={'raw':!![],'where':{'id':_0x529db8[_0x366e('0x41')]['id']}},_0x8ca88={};_0x8ca88[_0x366e('0x2d')]=_[_0x366e('0x2e')](db[_0x366e('0x29')]['rawAttributes']);_0x8ca88[_0x366e('0x2f')]=_[_0x366e('0x2e')](_0x529db8[_0x366e('0x2f')]);_0x8ca88['filters']=_[_0x366e('0x31')](_0x8ca88['model'],_0x8ca88[_0x366e('0x2f')]);_0x4b84c0[_0x366e('0x32')]=_[_0x366e('0x31')](_0x8ca88[_0x366e('0x2d')],qs[_0x366e('0x33')](_0x529db8[_0x366e('0x2f')]['fields']));_0x4b84c0[_0x366e('0x32')]=_0x4b84c0[_0x366e('0x32')][_0x366e('0x34')]?_0x4b84c0['attributes']:_0x8ca88[_0x366e('0x2d')];if(_0x529db8[_0x366e('0x2f')][_0x366e('0x3d')]){_0x4b84c0[_0x366e('0x3e')]=[{'all':!![]}];}_0x4b84c0=_[_0x366e('0x3a')]({},_0x4b84c0,_0x529db8[_0x366e('0x3c')]);return db[_0x366e('0x29')]['find'](_0x4b84c0)[_0x366e('0x21')](handleEntityNotFound(_0x4cbc12,null))[_0x366e('0x21')](respondWithResult(_0x4cbc12,null))['catch'](handleError(_0x4cbc12,null));};exports[_0x366e('0x42')]=function(_0x4d687b,_0xb05b5c){var _0x3b73e4={'where':{'id':_0x4d687b[_0x366e('0x41')]['id']}},_0x29eb97={};_0x29eb97[_0x366e('0x2d')]=_[_0x366e('0x2e')](db[_0x366e('0x29')][_0x366e('0x2a')]);_0x3b73e4['attributes']=_[_0x366e('0x31')](_0x29eb97[_0x366e('0x2d')],qs['fields'](_0x4d687b[_0x366e('0x2f')]['fields']));_0x3b73e4[_0x366e('0x32')]=_0x3b73e4[_0x366e('0x32')][_0x366e('0x34')]?_0x3b73e4[_0x366e('0x32')]:_0x29eb97[_0x366e('0x2d')];if(_0x4d687b[_0x366e('0x2f')]['includeAll']){_0x3b73e4[_0x366e('0x3e')]=[{'all':!![]}];}_0x3b73e4=_[_0x366e('0x3a')]({},_0x3b73e4,_0x4d687b[_0x366e('0x3c')]);return db[_0x366e('0x29')]['find'](_0x3b73e4)[_0x366e('0x21')](handleEntityNotFound(_0xb05b5c,null))['then'](function(_0x9bb79e){if(_0x9bb79e){var _0x1d4a2b=_0x9bb79e[_0x366e('0x43')]({'plain':!![]});_0x1d4a2b=qs[_0x366e('0x44')](_0x1d4a2b,['id',_0x366e('0x45'),_0x366e('0x46')]);_0x4d687b[_0x366e('0x47')]=_[_0x366e('0x44')](_0x4d687b['body'],['id',_0x366e('0x45'),_0x366e('0x46')]);return db['Attachment'][_0x366e('0x48')](_[_0x366e('0x3a')](_0x1d4a2b,_0x4d687b[_0x366e('0x47')]),{'include':_0x4d687b[_0x366e('0x2f')][_0x366e('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xb05b5c,0xc9))[_0x366e('0x40')](handleError(_0xb05b5c,null));};exports[_0x366e('0x20')]=function(_0xb4e60c,_0x2cf1f7){if(_0xb4e60c['body']['id']){delete _0xb4e60c[_0x366e('0x47')]['id'];}return db[_0x366e('0x29')][_0x366e('0x49')]({'where':{'id':_0xb4e60c[_0x366e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cf1f7,null))[_0x366e('0x21')](saveUpdates(_0xb4e60c[_0x366e('0x47')],null))[_0x366e('0x21')](respondWithResult(_0x2cf1f7,null))[_0x366e('0x40')](handleError(_0x2cf1f7,null));};exports[_0x366e('0x22')]=function(_0x5ec971,_0x52e6ad){return db['Attachment'][_0x366e('0x49')]({'where':{'id':_0x5ec971['params']['id']}})[_0x366e('0x21')](handleEntityNotFound(_0x52e6ad,null))[_0x366e('0x21')](removeEntity(_0x52e6ad,null))[_0x366e('0x40')](handleError(_0x52e6ad,null));};exports[_0x366e('0x48')]=function(_0x9ae871,_0x458914,_0x159e29){_0x9ae871[_0x366e('0x47')]['name']=_0x9ae871[_0x366e('0x4a')][_0x366e('0x4b')];_0x9ae871['body'][_0x366e('0x4c')]=_0x9ae871[_0x366e('0x4a')][_0x366e('0x4d')];_0x9ae871['body'][_0x366e('0x4e')]=_0x9ae871['file']['mimetype'];return db[_0x366e('0x29')]['create'](_0x9ae871[_0x366e('0x47')])[_0x366e('0x21')](respondWithResult(_0x458914,0xc9))[_0x366e('0x40')](handleError(_0x458914,null));};exports['download']=function(_0x561a55,_0x58449f,_0x368ae5){return db[_0x366e('0x29')][_0x366e('0x4f')]({'where':{'id':_0x561a55[_0x366e('0x41')]['id']},'raw':!![]})[_0x366e('0x21')](handleEntityNotFound(_0x58449f,null))[_0x366e('0x21')](function(_0x1aec2c){if(_0x1aec2c){var _0x5ced4f=_0x1aec2c[_0x366e('0x50')]!==null;var _0x5ecfe5=path[_0x366e('0x51')](config[_0x366e('0x52')],_0x366e('0x53'));if(_0x5ced4f){_0x5ecfe5=path[_0x366e('0x51')](_0x5ecfe5,'offline-chat/');}var _0xa96812=path[_0x366e('0x51')](_0x5ecfe5,_0x1aec2c[_0x366e('0x4c')]);return _0x58449f[_0x366e('0x54')](_0xa96812);}})[_0x366e('0x40')](handleError(_0x58449f,null));}; \ No newline at end of file +var _0x4e95=['where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','createdAt','updatedAt','body','omit','update','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','stack','name','send','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x499f42,_0x47a05c){var _0x285e92=function(_0x360d15){while(--_0x360d15){_0x499f42['push'](_0x499f42['shift']());}};_0x285e92(++_0x47a05c);}(_0x4e95,0x1c8));var _0x54e9=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x4e95[_0x40dd56];return _0x4f850f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54e9('0x1'));var rp=require(_0x54e9('0x2'));var moment=require(_0x54e9('0x3'));var BPromise=require(_0x54e9('0x4'));var Mustache=require('mustache');var util=require(_0x54e9('0x5'));var path=require(_0x54e9('0x6'));var sox=require('sox');var csv=require(_0x54e9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54e9('0x8'));var _=require(_0x54e9('0x9'));var squel=require('squel');var crypto=require(_0x54e9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x54e9('0xb'));var toCsv=require(_0x54e9('0x7'));var querystring=require('querystring');var Papa=require(_0x54e9('0xc'));var Redis=require(_0x54e9('0xd'));var authService=require(_0x54e9('0xe'));var qs=require(_0x54e9('0xf'));var as=require(_0x54e9('0x10'));var hardwareService=require(_0x54e9('0x11'));var logger=require(_0x54e9('0x12'))(_0x54e9('0x13'));var utils=require(_0x54e9('0x14'));var config=require(_0x54e9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x54e9('0x16'))['db'];function respondWithStatusCode(_0x362d18,_0x51812a){_0x51812a=_0x51812a||0xcc;return function(_0x583c65){if(_0x583c65){return _0x362d18[_0x54e9('0x17')](_0x51812a);}return _0x362d18[_0x54e9('0x18')](_0x51812a)[_0x54e9('0x19')]();};}function respondWithResult(_0x5111fb,_0x32d7b4){_0x32d7b4=_0x32d7b4||0xc8;return function(_0x3e1ba3){if(_0x3e1ba3){return _0x5111fb[_0x54e9('0x18')](_0x32d7b4)['json'](_0x3e1ba3);}};}function respondWithFilteredResult(_0x2f5efa,_0x1d1bbd){return function(_0x8ea202){if(_0x8ea202){var _0x475e8e=typeof _0x1d1bbd[_0x54e9('0x1a')]===_0x54e9('0x1b')&&typeof _0x1d1bbd[_0x54e9('0x1c')]===_0x54e9('0x1b');var _0x5b4c34=_0x8ea202[_0x54e9('0x1d')];var _0x459255=_0x475e8e?0x0:_0x1d1bbd['offset'];var _0x33be0e=_0x475e8e?_0x8ea202['count']:_0x1d1bbd[_0x54e9('0x1a')]+_0x1d1bbd[_0x54e9('0x1c')];var _0x15acc3;if(_0x33be0e>=_0x5b4c34){_0x33be0e=_0x5b4c34;_0x15acc3=0xc8;}else{_0x15acc3=0xce;}_0x2f5efa[_0x54e9('0x18')](_0x15acc3);return _0x2f5efa['set'](_0x54e9('0x1e'),_0x459255+'-'+_0x33be0e+'/'+_0x5b4c34)['json'](_0x8ea202);}return null;};}function patchUpdates(_0x15e9cb){return function(_0x5c014b){try{jsonpatch[_0x54e9('0x1f')](_0x5c014b,_0x15e9cb,!![]);}catch(_0x3fb6d4){return BPromise[_0x54e9('0x20')](_0x3fb6d4);}return _0x5c014b[_0x54e9('0x21')]();};}function saveUpdates(_0x51674a,_0x46baa8){return function(_0x2d286c){if(_0x2d286c){return _0x2d286c['update'](_0x51674a)['then'](function(_0x47f8cb){return _0x47f8cb;});}return null;};}function removeEntity(_0x19627b,_0x22948a){return function(_0x25b481){if(_0x25b481){return _0x25b481[_0x54e9('0x22')]()[_0x54e9('0x23')](function(){_0x19627b[_0x54e9('0x18')](0xcc)[_0x54e9('0x19')]();});}};}function handleEntityNotFound(_0x29b4e4,_0xd02297){return function(_0x32bd9f){if(!_0x32bd9f){_0x29b4e4[_0x54e9('0x17')](0x194);}return _0x32bd9f;};}function handleError(_0x5b05f7,_0x14d88e){_0x14d88e=_0x14d88e||0x1f4;return function(_0x39eb36){logger['error'](_0x39eb36[_0x54e9('0x24')]);if(_0x39eb36[_0x54e9('0x25')]){delete _0x39eb36['name'];}_0x5b05f7['status'](_0x14d88e)[_0x54e9('0x26')](_0x39eb36);};}exports['index']=function(_0x3fc5f0,_0x1938de){var _0x35f6d9={},_0x2376c7={},_0x3a1f69={'count':0x0,'rows':[]};var _0x7fe56e=_['map'](db[_0x54e9('0x27')][_0x54e9('0x28')],function(_0x57e932){return{'name':_0x57e932[_0x54e9('0x29')],'type':_0x57e932[_0x54e9('0x2a')][_0x54e9('0x2b')]};});_0x2376c7[_0x54e9('0x2c')]=_['map'](_0x7fe56e,'name');_0x2376c7[_0x54e9('0x2d')]=_[_0x54e9('0x2e')](_0x3fc5f0['query']);_0x2376c7[_0x54e9('0x2f')]=_[_0x54e9('0x30')](_0x2376c7[_0x54e9('0x2c')],_0x2376c7[_0x54e9('0x2d')]);_0x35f6d9[_0x54e9('0x31')]=_[_0x54e9('0x30')](_0x2376c7[_0x54e9('0x2c')],qs['fields'](_0x3fc5f0[_0x54e9('0x2d')][_0x54e9('0x32')]));_0x35f6d9['attributes']=_0x35f6d9['attributes']['length']?_0x35f6d9[_0x54e9('0x31')]:_0x2376c7[_0x54e9('0x2c')];if(!_0x3fc5f0['query']['hasOwnProperty'](_0x54e9('0x33'))){_0x35f6d9[_0x54e9('0x1c')]=qs[_0x54e9('0x1c')](_0x3fc5f0['query'][_0x54e9('0x1c')]);_0x35f6d9[_0x54e9('0x1a')]=qs[_0x54e9('0x1a')](_0x3fc5f0[_0x54e9('0x2d')][_0x54e9('0x1a')]);}_0x35f6d9[_0x54e9('0x34')]=qs[_0x54e9('0x35')](_0x3fc5f0[_0x54e9('0x2d')][_0x54e9('0x35')]);_0x35f6d9[_0x54e9('0x36')]=qs['filters'](_['pick'](_0x3fc5f0[_0x54e9('0x2d')],_0x2376c7[_0x54e9('0x2f')]),_0x7fe56e);if(_0x3fc5f0[_0x54e9('0x2d')][_0x54e9('0x37')]){_0x35f6d9['where']=_[_0x54e9('0x38')](_0x35f6d9['where'],{'$or':_[_0x54e9('0x39')](_0x7fe56e,function(_0x55c748){if(_0x55c748[_0x54e9('0x2a')]!==_0x54e9('0x3a')){var _0x1ca97d={};_0x1ca97d[_0x55c748['name']]={'$like':'%'+_0x3fc5f0[_0x54e9('0x2d')][_0x54e9('0x37')]+'%'};return _0x1ca97d;}})});}_0x35f6d9=_['merge']({},_0x35f6d9,_0x3fc5f0[_0x54e9('0x3b')]);var _0xfa43f={'where':_0x35f6d9[_0x54e9('0x36')]};return db['Attachment'][_0x54e9('0x1d')](_0xfa43f)[_0x54e9('0x23')](function(_0x37bbd7){_0x3a1f69['count']=_0x37bbd7;if(_0x3fc5f0[_0x54e9('0x2d')][_0x54e9('0x3c')]){_0x35f6d9[_0x54e9('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0x54e9('0x3e')](_0x35f6d9);})[_0x54e9('0x23')](function(_0x195656){_0x3a1f69[_0x54e9('0x3f')]=_0x195656;return _0x3a1f69;})[_0x54e9('0x23')](respondWithFilteredResult(_0x1938de,_0x35f6d9))[_0x54e9('0x40')](handleError(_0x1938de,null));};exports['show']=function(_0xd7ec7e,_0x5bfe54){var _0x48b734={'raw':!![],'where':{'id':_0xd7ec7e[_0x54e9('0x41')]['id']}},_0x50fe8a={};_0x50fe8a[_0x54e9('0x2c')]=_[_0x54e9('0x2e')](db[_0x54e9('0x27')]['rawAttributes']);_0x50fe8a['query']=_[_0x54e9('0x2e')](_0xd7ec7e[_0x54e9('0x2d')]);_0x50fe8a['filters']=_[_0x54e9('0x30')](_0x50fe8a['model'],_0x50fe8a['query']);_0x48b734['attributes']=_[_0x54e9('0x30')](_0x50fe8a['model'],qs['fields'](_0xd7ec7e[_0x54e9('0x2d')][_0x54e9('0x32')]));_0x48b734[_0x54e9('0x31')]=_0x48b734['attributes'][_0x54e9('0x42')]?_0x48b734['attributes']:_0x50fe8a['model'];if(_0xd7ec7e[_0x54e9('0x2d')][_0x54e9('0x3c')]){_0x48b734['include']=[{'all':!![]}];}_0x48b734=_[_0x54e9('0x38')]({},_0x48b734,_0xd7ec7e[_0x54e9('0x3b')]);return db['Attachment'][_0x54e9('0x43')](_0x48b734)[_0x54e9('0x23')](handleEntityNotFound(_0x5bfe54,null))[_0x54e9('0x23')](respondWithResult(_0x5bfe54,null))[_0x54e9('0x40')](handleError(_0x5bfe54,null));};exports['clone']=function(_0x392ec3,_0x43a1c4){var _0x42d4a7={'where':{'id':_0x392ec3[_0x54e9('0x41')]['id']}},_0x1816ce={};_0x1816ce['model']=_[_0x54e9('0x2e')](db[_0x54e9('0x27')][_0x54e9('0x28')]);_0x42d4a7[_0x54e9('0x31')]=_[_0x54e9('0x30')](_0x1816ce[_0x54e9('0x2c')],qs[_0x54e9('0x32')](_0x392ec3[_0x54e9('0x2d')][_0x54e9('0x32')]));_0x42d4a7[_0x54e9('0x31')]=_0x42d4a7[_0x54e9('0x31')][_0x54e9('0x42')]?_0x42d4a7[_0x54e9('0x31')]:_0x1816ce[_0x54e9('0x2c')];if(_0x392ec3[_0x54e9('0x2d')]['includeAll']){_0x42d4a7[_0x54e9('0x3d')]=[{'all':!![]}];}_0x42d4a7=_[_0x54e9('0x38')]({},_0x42d4a7,_0x392ec3[_0x54e9('0x3b')]);return db[_0x54e9('0x27')]['find'](_0x42d4a7)[_0x54e9('0x23')](handleEntityNotFound(_0x43a1c4,null))[_0x54e9('0x23')](function(_0xdb4846){if(_0xdb4846){var _0x917f46=_0xdb4846['get']({'plain':!![]});_0x917f46=qs['omit'](_0x917f46,['id',_0x54e9('0x44'),_0x54e9('0x45')]);_0x392ec3[_0x54e9('0x46')]=_[_0x54e9('0x47')](_0x392ec3[_0x54e9('0x46')],['id','createdAt','updatedAt']);return db[_0x54e9('0x27')]['create'](_[_0x54e9('0x38')](_0x917f46,_0x392ec3[_0x54e9('0x46')]),{'include':_0x392ec3['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x54e9('0x23')](respondWithResult(_0x43a1c4,0xc9))[_0x54e9('0x40')](handleError(_0x43a1c4,null));};exports[_0x54e9('0x48')]=function(_0x31ed6f,_0x41c252){if(_0x31ed6f[_0x54e9('0x46')]['id']){delete _0x31ed6f[_0x54e9('0x46')]['id'];}return db[_0x54e9('0x27')]['find']({'where':{'id':_0x31ed6f['params']['id']}})['then'](handleEntityNotFound(_0x41c252,null))[_0x54e9('0x23')](saveUpdates(_0x31ed6f[_0x54e9('0x46')],null))[_0x54e9('0x23')](respondWithResult(_0x41c252,null))[_0x54e9('0x40')](handleError(_0x41c252,null));};exports[_0x54e9('0x22')]=function(_0x13e806,_0x43edf5){return db[_0x54e9('0x27')][_0x54e9('0x43')]({'where':{'id':_0x13e806['params']['id']}})[_0x54e9('0x23')](handleEntityNotFound(_0x43edf5,null))[_0x54e9('0x23')](removeEntity(_0x43edf5,null))['catch'](handleError(_0x43edf5,null));};exports[_0x54e9('0x49')]=function(_0x4699af,_0x5794af,_0x43296c){_0x4699af['body'][_0x54e9('0x25')]=_0x4699af[_0x54e9('0x4a')][_0x54e9('0x4b')];_0x4699af['body'][_0x54e9('0x4c')]=_0x4699af[_0x54e9('0x4a')][_0x54e9('0x4d')];_0x4699af[_0x54e9('0x46')][_0x54e9('0x2a')]=_0x4699af[_0x54e9('0x4a')][_0x54e9('0x4e')];return db['Attachment']['create'](_0x4699af[_0x54e9('0x46')])[_0x54e9('0x23')](respondWithResult(_0x5794af,0xc9))['catch'](handleError(_0x5794af,null));};exports[_0x54e9('0x4f')]=function(_0x3671bf,_0x420b19,_0x24ef96){return db[_0x54e9('0x27')][_0x54e9('0x50')]({'where':{'id':_0x3671bf[_0x54e9('0x41')]['id']},'raw':!![]})[_0x54e9('0x23')](handleEntityNotFound(_0x420b19,null))[_0x54e9('0x23')](function(_0x536a25){if(_0x536a25){var _0x1fee7d=_0x536a25[_0x54e9('0x51')]!==null;var _0x188628=path['join'](config['root'],_0x54e9('0x52'));if(_0x1fee7d){_0x188628=path[_0x54e9('0x53')](_0x188628,_0x54e9('0x54'));}var _0x23336d=path['join'](_0x188628,_0x536a25['basename']);return _0x420b19[_0x54e9('0x4f')](_0x23336d);}})[_0x54e9('0x40')](handleError(_0x420b19,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 627efc1..841bb41 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 _0x204c=['api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','util','../../config/logger'];(function(_0x37c062,_0x3d3c72){var _0x573375=function(_0x5c7a1a){while(--_0x5c7a1a){_0x37c062['push'](_0x37c062['shift']());}};_0x573375(++_0x3d3c72);}(_0x204c,0xb4));var _0xc204=function(_0x3fe2be,_0x24cfba){_0x3fe2be=_0x3fe2be-0x0;var _0x16b3ca=_0x204c[_0x3fe2be];return _0x16b3ca;};'use strict';var _=require('lodash');var util=require(_0xc204('0x0'));var logger=require(_0xc204('0x1'))(_0xc204('0x2'));var moment=require(_0xc204('0x3'));var BPromise=require(_0xc204('0x4'));var rp=require(_0xc204('0x5'));var fs=require('fs');var path=require(_0xc204('0x6'));var rimraf=require(_0xc204('0x7'));var config=require('../../config/environment');var attributes=require(_0xc204('0x8'));module[_0xc204('0x9')]=function(_0x5d2920,_0x12b9fc){return _0x5d2920[_0xc204('0xa')](_0xc204('0xb'),attributes,{'tableName':_0xc204('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdd=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','util'];(function(_0x12b6f8,_0x1ad164){var _0x28d210=function(_0x1d73dd){while(--_0x1d73dd){_0x12b6f8['push'](_0x12b6f8['shift']());}};_0x28d210(++_0x1ad164);}(_0x5fdd,0x15f));var _0xd5fd=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x5fdd[_0x195577];return _0x13c367;};'use strict';var _=require('lodash');var util=require(_0xd5fd('0x0'));var logger=require(_0xd5fd('0x1'))('api');var moment=require(_0xd5fd('0x2'));var BPromise=require('bluebird');var rp=require(_0xd5fd('0x3'));var fs=require('fs');var path=require(_0xd5fd('0x4'));var rimraf=require(_0xd5fd('0x5'));var config=require(_0xd5fd('0x6'));var attributes=require(_0xd5fd('0x7'));module[_0xd5fd('0x8')]=function(_0x3d4f4b,_0x1a3fe8){return _0x3d4f4b[_0xd5fd('0x9')]('Attachment',attributes,{'tableName':_0xd5fd('0xa'),'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 fe853bc..3233946 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 _0x4c4e=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','create','body','options','then','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Attachment,\x20%s,\x20%s'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4c4e,0x152));var _0xe4c4=function(_0x107553,_0x14782a){_0x107553=_0x107553-0x0;var _0x489134=_0x4c4e[_0x107553];return _0x489134;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('Attachment,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('Attachment,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});}exports[_0xe4c4('0x15')]=function(_0x42242c){var _0x3820c7=this;return new Promise(function(_0x43a9ce,_0x376585){return db['Attachment'][_0xe4c4('0x16')](_0x42242c[_0xe4c4('0x17')],{'raw':_0x42242c[_0xe4c4('0x18')]?_0x42242c[_0xe4c4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe4c4('0x19')](function(_0x1cad5d){logger[_0xe4c4('0xb')](_0xe4c4('0x15'),_0x42242c);logger[_0xe4c4('0xe')](_0xe4c4('0x15'),_0x42242c,JSON[_0xe4c4('0x1a')](_0x1cad5d));_0x43a9ce(_0x1cad5d);})[_0xe4c4('0x14')](function(_0x21bbb1){logger[_0xe4c4('0x10')](_0xe4c4('0x15'),_0x21bbb1[_0xe4c4('0x12')],_0x42242c);_0x376585(_0x3820c7[_0xe4c4('0x10')](0x1f4,_0x21bbb1[_0xe4c4('0x12')]));});});}; \ No newline at end of file +var _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','bluebird','randomstring'];(function(_0x497642,_0x55c481){var _0x351a14=function(_0xcc4e3b){while(--_0xcc4e3b){_0x497642['push'](_0x497642['shift']());}};_0x351a14(++_0x55c481);}(_0xf874,0xed));var _0x4f87=function(_0x2237f3,_0x54c221){_0x2237f3=_0x2237f3-0x0;var _0x23b1c6=_0xf874[_0x2237f3];return _0x23b1c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Attachment,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateAttachment']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateAttachment',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateAttachment',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 86f5ee8..9f59bd9 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x4f2f40,_0x45ad43){var _0x1161aa=function(_0x4e2d8a){while(--_0x4e2d8a){_0x4f2f40['push'](_0x4f2f40['shift']());}};_0x1161aa(++_0x45ad43);}(_0x757a,0xde));var _0xa757=function(_0x13f840,_0x128bbe){_0x13f840=_0x13f840-0x0;var _0x5252a6=_0x757a[_0x13f840];return _0x5252a6;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x3506ac,_0x5cd818){var _0x1dc3f4=function(_0x5cd214){while(--_0x5cd214){_0x3506ac['push'](_0x3506ac['shift']());}};_0x1dc3f4(++_0x5cd818);}(_0xadb5,0xad));var _0x5adb=function(_0x2a5cfc,_0x1f8c69){_0x2a5cfc=_0x2a5cfc-0x0;var _0x26060e=_0xadb5[_0x2a5cfc];return _0x26060e;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 2167b88..3f38146 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 _0xc73b=['json','use','ad-login','User','passport','passport-local','Strategy','activedirectory2','util','../../config/environment','../../config/logger','undefined','baseDN','activedirectory','url','domain','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','online','agent','then','blockDuration','blockedAt','add','getLicense','login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x339d4c,_0x55d105){var _0x17ab6a=function(_0x4163eb){while(--_0x4163eb){_0x339d4c['push'](_0x339d4c['shift']());}};_0x17ab6a(++_0x55d105);}(_0xc73b,0x134));var _0xbc73=function(_0x514b87,_0x289744){_0x514b87=_0x514b87-0x0;var _0x28bf7b=_0xc73b[_0x514b87];return _0x28bf7b;};'use strict';var passport=require(_0xbc73('0x0'));var LocalStrategy=require(_0xbc73('0x1'))[_0xbc73('0x2')];var moment=require('moment');var ActiveDirectory=require(_0xbc73('0x3'));var BPromise=require('bluebird');var util=require(_0xbc73('0x4'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xbc73('0x5'));var logger=require(_0xbc73('0x6'))('api');function isActiveDirectoryConfigured(_0x19bbcf){var _0x2c6d46=![];if(typeof _0x19bbcf['activedirectory']!==_0xbc73('0x7')){_0x2c6d46=_0x19bbcf['activedirectory'][_0xbc73('0x8')]&&_0x19bbcf[_0xbc73('0x9')][_0xbc73('0xa')]&&_0x19bbcf[_0xbc73('0x9')][_0xbc73('0xb')];}return _0x2c6d46;}function adAuthenticate(_0x2fbf15,_0x3d7e22,_0x5b4b34){return new BPromise(function(_0xc8dbb0,_0xd7bf47){try{var _0x4a79e0=new ActiveDirectory(_0x2fbf15);_0x4a79e0['authenticate'](_0x3d7e22,_0x5b4b34,function(_0x4d6211,_0x1d89a2){if(_0x4d6211){logger[_0xbc73('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x3d7e22,util[_0xbc73('0xd')](_0x4d6211,{'showHidden':![],'depth':null}));_0xd7bf47(_0xbc73('0xe'));}else if(!_0x1d89a2){logger[_0xbc73('0xc')](_0xbc73('0xf'),_0x3d7e22);_0xd7bf47('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xc8dbb0(_0x1d89a2);}});}catch(_0x228090){_0xd7bf47(_0x228090);}});}function ActiveDirectoryAuthenticate(_0x44cc33,_0x43c536,_0xea7ae,_0x11014c){var _0x327306,_0x61bda2;if(!isActiveDirectoryConfigured(config)){logger[_0xbc73('0xc')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x43c536);return _0x11014c(null,![],{'message':_0xbc73('0xe')});}return db['Setting'][_0xbc73('0x10')]({'where':{'id':0x1},'attributes':[_0xbc73('0x11'),'blockDuration'],'raw':!![]})['then'](function(_0x465ad8){_0x327306=_0x465ad8;if(!_0x327306[_0xbc73('0x11')]){logger[_0xbc73('0xc')](_0xbc73('0x12'),_0x43c536);throw new Error(_0xbc73('0xe'));}return _0x44cc33[_0xbc73('0x10')]({'logging':!![],'attributes':['id',_0xbc73('0x13'),_0xbc73('0x14'),_0xbc73('0x15'),_0xbc73('0x16'),_0xbc73('0x17'),_0xbc73('0x18'),'blockedAt',_0xbc73('0x19')],'where':{'name':_0x43c536,'role':{'$or':['admin','user',_0xbc73('0x1a')]},'adSsoEnabled':!![]}});})[_0xbc73('0x1b')](function(_0x4d1660){if(!_0x4d1660||_0x4d1660&&_0x4d1660['name']!==_0x43c536){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x61bda2=_0x4d1660;var _0x256af5=_0x61bda2[_0xbc73('0x13')]+'@'+config[_0xbc73('0x9')][_0xbc73('0xb')];return adAuthenticate(config[_0xbc73('0x9')],_0x256af5,_0xea7ae);})[_0xbc73('0x1b')](function(_0x13e237){if(_0x61bda2['disabled']){throw new Error(_0xbc73('0xe'));}if(_0x327306[_0xbc73('0x1c')]>0x0){if(_0x61bda2[_0xbc73('0x18')]){if(moment(_0x61bda2[_0xbc73('0x1d')])[_0xbc73('0x1e')](_0x327306[_0xbc73('0x1c')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x61bda2,0x0,![],null)[_0xbc73('0x1b')](function(){return utils['getLicense'](_0x61bda2);})[_0xbc73('0x1b')](function(){return _0x11014c(null,_0x61bda2);});}else{return utils[_0xbc73('0x1f')](_0x61bda2)[_0xbc73('0x1b')](function(){return _0x11014c(null,_0x61bda2);});}}else{return utils[_0xbc73('0x1f')](_0x61bda2)[_0xbc73('0x1b')](function(){return _0x11014c(null,_0x61bda2);});}})['catch'](function(_0x4ba22c){return _0x11014c(null,![],_0x4ba22c);});}function handleError(_0x51499f,_0x46fcb1,_0x5ad000){return _0x51499f['status'](_0x46fcb1||0x1f4)['send']({'message':_0x5ad000?_0x5ad000['message']||_0x5ad000:''});}exports[_0xbc73('0x20')]=function(_0x4bf46a,_0x5e6ea0,_0x42b0ea){passport['authenticate']('ad-login',function(_0x46495d,_0x52877f,_0x41395d){var _0x3eaf3c=_0x46495d||_0x41395d;if(_0x3eaf3c){return handleError(_0x5e6ea0,0x191,_0x3eaf3c);}if(!_0x52877f){return handleError(_0x5e6ea0,0x194,{'message':_0xbc73('0x21')});}else{var _0x4419e2={'payload':{'id':_0x52877f['id'],'role':_0x52877f[_0xbc73('0x16')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4419e2)[_0xbc73('0x1b')](function(_0x55ca35){_0x5e6ea0[_0xbc73('0x22')]({'id':_0x52877f['id'],'token':_0x55ca35,'statusCall':'','isAlreadyLogged':_0x52877f[_0xbc73('0x19')]});});}})(_0x4bf46a,_0x5e6ea0,_0x42b0ea);};passport[_0xbc73('0x23')](_0xbc73('0x24'),new LocalStrategy({'usernameField':'name','passwordField':_0xbc73('0x14')},function(_0x3ac7b9,_0x3da822,_0x5dded3){return ActiveDirectoryAuthenticate(db[_0xbc73('0x25')],_0x3ac7b9,_0x3da822,_0x5dded3);})); \ No newline at end of file +var _0x413b=['error','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','blocked','blockedAt','admin','user','agent','name','disabled','blockDuration','add','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport','passport-local','moment','activedirectory2','util','../../components/auth/service','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials'];(function(_0x517dca,_0x2227b1){var _0x13bc6c=function(_0x5a5714){while(--_0x5a5714){_0x517dca['push'](_0x517dca['shift']());}};_0x13bc6c(++_0x2227b1);}(_0x413b,0x19f));var _0xb413=function(_0x3896ea,_0x489972){_0x3896ea=_0x3896ea-0x0;var _0x3527bf=_0x413b[_0x3896ea];return _0x3527bf;};'use strict';var passport=require(_0xb413('0x0'));var LocalStrategy=require(_0xb413('0x1'))['Strategy'];var moment=require(_0xb413('0x2'));var ActiveDirectory=require(_0xb413('0x3'));var BPromise=require('bluebird');var util=require(_0xb413('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xb413('0x5'));var utils=require('../../config/utils');var config=require(_0xb413('0x6'));var logger=require('../../config/logger')(_0xb413('0x7'));function isActiveDirectoryConfigured(_0x1538b9){var _0x23df68=![];if(typeof _0x1538b9[_0xb413('0x8')]!==_0xb413('0x9')){_0x23df68=_0x1538b9['activedirectory'][_0xb413('0xa')]&&_0x1538b9[_0xb413('0x8')][_0xb413('0xb')]&&_0x1538b9['activedirectory']['domain'];}return _0x23df68;}function adAuthenticate(_0x2a9d3f,_0x3bd17a,_0x1c32d9){return new BPromise(function(_0x4fbae8,_0x332a87){try{var _0x5daa46=new ActiveDirectory(_0x2a9d3f);_0x5daa46[_0xb413('0xc')](_0x3bd17a,_0x1c32d9,function(_0x4d5439,_0x251f1f){if(_0x4d5439){logger['error'](_0xb413('0xd'),_0x3bd17a,util[_0xb413('0xe')](_0x4d5439,{'showHidden':![],'depth':null}));_0x332a87(_0xb413('0xf'));}else if(!_0x251f1f){logger['error'](_0xb413('0x10'),_0x3bd17a);_0x332a87(_0xb413('0xf'));}else{_0x4fbae8(_0x251f1f);}});}catch(_0xf8fbaf){_0x332a87(_0xf8fbaf);}});}function ActiveDirectoryAuthenticate(_0x58ddbd,_0x40e793,_0x44a8d0,_0x369c17){var _0x2f354f,_0xdc6d40;if(!isActiveDirectoryConfigured(config)){logger[_0xb413('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x40e793);return _0x369c17(null,![],{'message':_0xb413('0xf')});}return db[_0xb413('0x12')][_0xb413('0x13')]({'where':{'id':0x1},'attributes':[_0xb413('0x14'),'blockDuration'],'raw':!![]})[_0xb413('0x15')](function(_0x16f11d){_0x2f354f=_0x16f11d;if(!_0x2f354f[_0xb413('0x14')]){logger['error'](_0xb413('0x16'),_0x40e793);throw new Error(_0xb413('0xf'));}return _0x58ddbd[_0xb413('0x13')]({'logging':!![],'attributes':['id','name',_0xb413('0x17'),_0xb413('0x18'),'role','disabled',_0xb413('0x19'),_0xb413('0x1a'),'online'],'where':{'name':_0x40e793,'role':{'$or':[_0xb413('0x1b'),_0xb413('0x1c'),_0xb413('0x1d')]},'adSsoEnabled':!![]}});})[_0xb413('0x15')](function(_0x40da65){if(!_0x40da65||_0x40da65&&_0x40da65[_0xb413('0x1e')]!==_0x40e793){throw new Error(_0xb413('0xf'));}_0xdc6d40=_0x40da65;var _0x5f1cfd=_0xdc6d40[_0xb413('0x1e')]+'@'+config[_0xb413('0x8')]['domain'];return adAuthenticate(config['activedirectory'],_0x5f1cfd,_0x44a8d0);})[_0xb413('0x15')](function(_0x3275fc){if(_0xdc6d40[_0xb413('0x1f')]){throw new Error(_0xb413('0xf'));}if(_0x2f354f[_0xb413('0x20')]>0x0){if(_0xdc6d40['blocked']){if(moment(_0xdc6d40[_0xb413('0x1a')])[_0xb413('0x21')](_0x2f354f[_0xb413('0x20')],'minutes')>moment()){throw new Error(_0xb413('0xf'));}return utils[_0xb413('0x22')](_0xdc6d40,0x0,![],null)['then'](function(){return utils[_0xb413('0x23')](_0xdc6d40);})[_0xb413('0x15')](function(){return _0x369c17(null,_0xdc6d40);});}else{return utils['getLicense'](_0xdc6d40)[_0xb413('0x15')](function(){return _0x369c17(null,_0xdc6d40);});}}else{return utils['getLicense'](_0xdc6d40)[_0xb413('0x15')](function(){return _0x369c17(null,_0xdc6d40);});}})[_0xb413('0x24')](function(_0x10bda5){return _0x369c17(null,![],_0x10bda5);});}function handleError(_0xc679b0,_0x5c4c75,_0x5602b3){return _0xc679b0[_0xb413('0x25')](_0x5c4c75||0x1f4)[_0xb413('0x26')]({'message':_0x5602b3?_0x5602b3[_0xb413('0x27')]||_0x5602b3:''});}exports[_0xb413('0x28')]=function(_0x3d70cf,_0x4d0195,_0x1dbb67){passport[_0xb413('0xc')](_0xb413('0x29'),function(_0x4b361c,_0xdd0e70,_0x3ec8bc){var _0xf6efcd=_0x4b361c||_0x3ec8bc;if(_0xf6efcd){return handleError(_0x4d0195,0x191,_0xf6efcd);}if(!_0xdd0e70){return handleError(_0x4d0195,0x194,{'message':_0xb413('0x2a')});}else{var _0x28d1fa={'payload':{'id':_0xdd0e70['id'],'role':_0xdd0e70[_0xb413('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0xb413('0x2c')](_0x28d1fa)[_0xb413('0x15')](function(_0x3aaf10){_0x4d0195[_0xb413('0x2d')]({'id':_0xdd0e70['id'],'token':_0x3aaf10,'statusCall':'','isAlreadyLogged':_0xdd0e70['online']});});}})(_0x3d70cf,_0x4d0195,_0x1dbb67);};passport[_0xb413('0x2e')](_0xb413('0x29'),new LocalStrategy({'usernameField':'name','passwordField':_0xb413('0x17')},function(_0x20e9aa,_0xe740a9,_0x283da1){return ActiveDirectoryAuthenticate(db[_0xb413('0x2f')],_0x20e9aa,_0xe740a9,_0x283da1);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3e6c801..075ac52 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 _0xfbf3=['exports','Router','./authActiveDirectory.controller','post'];(function(_0xb9cbcd,_0x8df75d){var _0x1a7102=function(_0x566c28){while(--_0x566c28){_0xb9cbcd['push'](_0xb9cbcd['shift']());}};_0x1a7102(++_0x8df75d);}(_0xfbf3,0xd5));var _0x3fbf=function(_0xaaf409,_0x28d8cd){_0xaaf409=_0xaaf409-0x0;var _0x40fb5d=_0xfbf3[_0xaaf409];return _0x40fb5d;};'use strict';var express=require('express');var router=express[_0x3fbf('0x0')]();var controller=require(_0x3fbf('0x1'));router[_0x3fbf('0x2')]('/',controller['login']);module[_0x3fbf('0x3')]=router; \ No newline at end of file +var _0x4ddd=['post','exports','express','Router','./authActiveDirectory.controller'];(function(_0x6fcbfe,_0x12426b){var _0x4a91c0=function(_0x5ad12f){while(--_0x5ad12f){_0x6fcbfe['push'](_0x6fcbfe['shift']());}};_0x4a91c0(++_0x12426b);}(_0x4ddd,0x192));var _0xd4dd=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x4ddd[_0x3fb9dd];return _0x20136a;};'use strict';var express=require(_0xd4dd('0x0'));var router=express[_0xd4dd('0x1')]();var controller=require(_0xd4dd('0x2'));router[_0xd4dd('0x3')]('/',controller['login']);module[_0xd4dd('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a415c33..c72f4f5 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(_0x18789c,_0x41c3b6){_0x18789c=_0x18789c-0x0;var _0x29c5de=_0x7a54[_0x18789c];return _0x29c5de;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x47251e,_0x1dc416){_0x47251e=_0x47251e-0x0;var _0x3fc8f4=_0x7a54[_0x47251e];return _0x3fc8f4;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f338965..8c20d56 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 _0x5ef9=['Router','get','/callback','callback','isMiddleware','login','setTokenCookie','express','passport'];(function(_0xed280f,_0x4ca4e7){var _0x353aec=function(_0x439c5d){while(--_0x439c5d){_0xed280f['push'](_0xed280f['shift']());}};_0x353aec(++_0x4ca4e7);}(_0x5ef9,0x142));var _0x95ef=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5ef9[_0x2e4e19];return _0x9ba20b;};'use strict';var express=require(_0x95ef('0x0'));var passport=require(_0x95ef('0x1'));var router=express[_0x95ef('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x95ef('0x3')]('/',controller['login']);router[_0x95ef('0x3')](_0x95ef('0x4'),controller[_0x95ef('0x5')],authService[_0x95ef('0x6')],userController[_0x95ef('0x7')],authService[_0x95ef('0x8')]);module['exports']=router; \ No newline at end of file +var _0x92c4=['/callback','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get'];(function(_0x58d3c0,_0x65e7de){var _0x4f0d70=function(_0x5e6fc9){while(--_0x5e6fc9){_0x58d3c0['push'](_0x58d3c0['shift']());}};_0x4f0d70(++_0x65e7de);}(_0x92c4,0x1a8));var _0x492c=function(_0x23e878,_0x2691dd){_0x23e878=_0x23e878-0x0;var _0xc95b81=_0x92c4[_0x23e878];return _0xc95b81;};'use strict';var express=require(_0x492c('0x0'));var passport=require(_0x492c('0x1'));var router=express[_0x492c('0x2')]();var controller=require(_0x492c('0x3'));var userController=require(_0x492c('0x4'));var authService=require(_0x492c('0x5'));router['get']('/',controller[_0x492c('0x6')]);router[_0x492c('0x7')](_0x492c('0x8'),controller[_0x492c('0x9')],authService[_0x492c('0xa')],userController[_0x492c('0x6')],authService['setTokenCookie']);module[_0x492c('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d6b64da..9f41ccf 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 _0x1b26=['email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','user','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','params','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','password','use','util','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','salt','disabled','blocked','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x1b26,0x1cd));var _0x61b2=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x1b26[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require(_0x61b2('0x0'));var passport=require('passport');var LocalStrategy=require(_0x61b2('0x1'))[_0x61b2('0x2')];var jayson=require(_0x61b2('0x3'));var _=require('lodash');var rs=require(_0x61b2('0x4'));var moment=require(_0x61b2('0x5'));var db=require(_0x61b2('0x6'))['db'];var authService=require(_0x61b2('0x7'));var utils=require(_0x61b2('0x8'));var client=jayson[_0x61b2('0x9')][_0x61b2('0xa')]({'port':0x232b});function localAuthenticate(_0x5deccf,_0x13199d,_0x4884ed,_0x52e27e){var _0x1df2bc,_0x1b40dc;return db[_0x61b2('0xb')][_0x61b2('0xc')]({'where':{'id':0x1},'attributes':[_0x61b2('0xd'),'blockDuration'],'raw':!![]})[_0x61b2('0xe')](function(_0x1a9fb0){_0x1df2bc=_0x1a9fb0;return _0x5deccf[_0x61b2('0xc')]({'attributes':['id',_0x61b2('0xf'),'password',_0x61b2('0x10'),'role',_0x61b2('0x11'),_0x61b2('0x12'),_0x61b2('0x13'),_0x61b2('0x14')],'where':{'name':_0x13199d,'role':{'$or':[_0x61b2('0x15'),'user','agent']}}});})[_0x61b2('0xe')](function(_0x4419da){if(!_0x4419da||_0x4419da&&_0x4419da['name']!==_0x13199d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1b40dc=_0x4419da;return _0x1b40dc;}})[_0x61b2('0xe')](function(){_0x1b40dc['authenticate'](_0x4884ed,function(_0x73147a,_0x2df33c){var _0x3c1073=_0x1b40dc[_0x61b2('0x14')]+0x1;if(_0x73147a){return _0x52e27e(_0x73147a);}else if(!_0x2df33c){if(_0x1b40dc[_0x61b2('0x11')]){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}else if(_0x1df2bc[_0x61b2('0xd')]>0x0){if(_0x1b40dc[_0x61b2('0x12')]){if(_0x1df2bc[_0x61b2('0x17')]>0x0){if(moment(_0x1b40dc['blockedAt'])[_0x61b2('0x18')](_0x1df2bc[_0x61b2('0x17')],_0x61b2('0x19'))>moment()){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}else{return utils['clearBlockUser'](_0x1b40dc,_0x3c1073,![],null)[_0x61b2('0xe')](function(){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});});}}else{return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}}else{if(_0x3c1073>=_0x1df2bc[_0x61b2('0xd')]){return utils[_0x61b2('0x1a')](_0x1b40dc,0x0,!![],moment())[_0x61b2('0xe')](function(){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});});}else{return utils[_0x61b2('0x1a')](_0x1b40dc,_0x3c1073,![],null)[_0x61b2('0xe')](function(){return _0x52e27e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}}else{if(_0x1b40dc[_0x61b2('0x11')]){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}else if(_0x1df2bc[_0x61b2('0xd')]>0x0){if(_0x1b40dc['blocked']){if(_0x1df2bc['blockDuration']>0x0){if(moment(_0x1b40dc[_0x61b2('0x13')])[_0x61b2('0x18')](_0x1df2bc[_0x61b2('0x17')],_0x61b2('0x19'))>moment()){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}else{return utils['clearBlockUser'](_0x1b40dc,0x0,![],null)[_0x61b2('0xe')](function(){return utils['getLicense'](_0x1b40dc);})[_0x61b2('0xe')](function(){return _0x52e27e(null,_0x1b40dc);});}}else{return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}}else{return utils[_0x61b2('0x1a')](_0x1b40dc,0x0,![],null)[_0x61b2('0xe')](function(){return utils[_0x61b2('0x1b')](_0x1b40dc);})[_0x61b2('0xe')](function(){return _0x52e27e(null,_0x1b40dc);})[_0x61b2('0x1c')](function(_0x3cc957){return _0x52e27e(null,![],_0x3cc957);});}}else{if(_0x1b40dc[_0x61b2('0x12')]){return _0x52e27e(null,![],{'message':_0x61b2('0x16')});}else{return utils[_0x61b2('0x1b')](_0x1b40dc)[_0x61b2('0xe')](function(){return _0x52e27e(null,_0x1b40dc);});}}}});})['catch'](function(_0x39a287){return _0x52e27e(null,![],_0x39a287);});}function sendServiceMail(_0xee3bac){return db[_0x61b2('0x1d')][_0x61b2('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x61b2('0xf'),_0x61b2('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x61b2('0x20')}]})[_0x61b2('0xe')](function(_0x3dc7b8){if(!_0x3dc7b8){throw new Error(_0x61b2('0x21'));}var _0x3aa9aa={'tls':{'rejectUnauthorized':![]}};if(_0x3dc7b8[_0x61b2('0x20')][_0x61b2('0x22')]){_0x3aa9aa[_0x61b2('0x22')]=_0x3dc7b8['Smtp'][_0x61b2('0x22')];}else{_0x3aa9aa[_0x61b2('0x23')]=_0x3dc7b8[_0x61b2('0x20')][_0x61b2('0x23')];_0x3aa9aa['port']=_0x3dc7b8[_0x61b2('0x20')][_0x61b2('0x24')];_0x3aa9aa[_0x61b2('0x25')]=_0x3dc7b8[_0x61b2('0x20')]['secure'];}if(_0x3dc7b8[_0x61b2('0x20')]['authentication']){_0x3aa9aa[_0x61b2('0x26')]={'user':_0x3dc7b8[_0x61b2('0x20')]['user'],'pass':_0x3dc7b8[_0x61b2('0x20')][_0x61b2('0x27')]};}var _0x5ded77={'account':_0x3aa9aa,'message':_[_0x61b2('0x28')]({'from':util[_0x61b2('0x29')]('\x22%s\x22\x20<%s>',_0x3dc7b8[_0x61b2('0xf')],_0x3dc7b8[_0x61b2('0x1f')]||_0x3dc7b8[_0x61b2('0x20')][_0x61b2('0x2a')])},_0xee3bac)};return client['request'](_0x61b2('0x2b'),_0x5ded77);})[_0x61b2('0xe')](function(_0x342094){if(_0x342094['error']){throw new Error(util['format'](_0x61b2('0x2c'),_0x342094['error'][_0x61b2('0x2d')]||JSON[_0x61b2('0x2e')](_0x342094['error'])));}return!![];});}function handleError(_0x2f4fbc,_0x2c4d1d,_0x1d220d){return _0x2f4fbc[_0x61b2('0x2f')](_0x2c4d1d||0x1f4)['send']({'message':_0x1d220d?_0x1d220d[_0x61b2('0x2d')]||_0x1d220d:''});}exports[_0x61b2('0x30')]=function(_0x5bbcb0,_0x31daef,_0x418eac){passport[_0x61b2('0x31')](_0x61b2('0x32'),function(_0x671308,_0x4d89d9,_0x12a8ca){var _0x10325a=_0x671308||_0x12a8ca;if(_0x10325a){return handleError(_0x31daef,0x191,_0x10325a);}if(!_0x4d89d9){return handleError(_0x31daef,0x194,{'message':_0x61b2('0x33')});}else{var _0x29642b={'payload':{'id':_0x4d89d9['id'],'role':_0x4d89d9['role']},'options':{'expiresIn':0x15180}};return authService[_0x61b2('0x34')](_0x29642b)[_0x61b2('0xe')](function(_0x68e8da){_0x31daef[_0x61b2('0x35')]({'id':_0x4d89d9['id'],'token':_0x68e8da,'statusCall':'','isAlreadyLogged':_0x4d89d9[_0x61b2('0x36')]});});}})(_0x5bbcb0,_0x31daef,_0x418eac);};exports[_0x61b2('0x37')]=function(_0x10a0a7,_0x4c0eb1,_0x2a91b6){if(!_0x10a0a7[_0x61b2('0x38')][_0x61b2('0x1f')]){return handleError(_0x4c0eb1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x471292=rs[_0x61b2('0x39')]();_0x10a0a7[_0x61b2('0x38')][_0x61b2('0x1f')]=_0x10a0a7[_0x61b2('0x38')]['email'][_0x61b2('0x3a')]()['toLowerCase']();var _0x4d6dc0;return db[_0x61b2('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x61b2('0xd'),_0x61b2('0x17')],'raw':!![]})[_0x61b2('0xe')](function(_0x185b98){_0x4d6dc0=_0x185b98;return db[_0x61b2('0x3b')]['find']({'where':{'email':_0x10a0a7[_0x61b2('0x38')][_0x61b2('0x1f')]}});})[_0x61b2('0xe')](function(_0x2b0d62){if(!_0x2b0d62){throw new Error(_0x61b2('0x3c'));}if(_0x2b0d62[_0x61b2('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2b0d62[_0x61b2('0x12')]){if(moment(_0x2b0d62[_0x61b2('0x13')])[_0x61b2('0x18')](_0x4d6dc0[_0x61b2('0x17')],_0x61b2('0x19'))>moment()){throw new Error(_0x61b2('0x3d'));}else{_0x2b0d62['blocked']=![];_0x2b0d62[_0x61b2('0x13')]=null;}}_0x2b0d62[_0x61b2('0x3e')]=_0x471292;_0x2b0d62[_0x61b2('0x3f')]=Date[_0x61b2('0x40')]()+0x36ee80;return _0x2b0d62[_0x61b2('0x41')]();})[_0x61b2('0xe')](function(){return sendServiceMail({'to':_0x10a0a7[_0x61b2('0x38')][_0x61b2('0x1f')],'subject':_0x61b2('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x61b2('0x43')+_0x61b2('0x44')+_0x10a0a7[_0x61b2('0x45')][_0x61b2('0x23')]+_0x61b2('0x46')+_0x471292+'\x0a\x0a'+_0x61b2('0x47')});})[_0x61b2('0xe')](function(){_0x4c0eb1[_0x61b2('0x2f')](0xc8)[_0x61b2('0x48')]({'message':_0x61b2('0x49')});})[_0x61b2('0x1c')](function(_0x3fe14c){return handleError(_0x4c0eb1,0x1f4,_0x3fe14c);});};exports['reset']=function(_0x54d704,_0x2b222c,_0x1ea16d){return db[_0x61b2('0x3b')][_0x61b2('0x1e')]({'where':{'resetPasswordToken':_0x54d704[_0x61b2('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3f9372){if(!_0x3f9372){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x61b2('0xb')]['findOne']({'attributes':['id','securePassword',_0x61b2('0x4b'),_0x61b2('0x4c')]})[_0x61b2('0xe')](function(_0x4b02e9){if(_0x4b02e9[_0x61b2('0x4d')])authService[_0x61b2('0x4e')](_0x54d704['body']['password']);if(!_0x4b02e9[_0x61b2('0x4b')]||!_0x3f9372['previousPasswords'])return _0x3f9372;authService[_0x61b2('0x4f')](_0x54d704['body'][_0x61b2('0x50')],_0x3f9372['previousPasswords'],_0x4b02e9['passwordHistoryLimit']);return _0x3f9372;})[_0x61b2('0xe')](function(){_0x3f9372[_0x61b2('0x50')]=_0x54d704[_0x61b2('0x38')][_0x61b2('0x50')];_0x3f9372['resetPasswordToken']=null;_0x3f9372[_0x61b2('0x3f')]=null;return _0x3f9372[_0x61b2('0x41')]();});})[_0x61b2('0xe')](function(){_0x2b222c[_0x61b2('0x2f')](0xc8)[_0x61b2('0x48')]({'message':'Password\x20reset!'});})[_0x61b2('0x1c')](function(_0x2480e7){return handleError(_0x2b222c,0x1f4,_0x2480e7);});};passport[_0x61b2('0x51')](_0x61b2('0x32'),new LocalStrategy({'usernameField':_0x61b2('0xf'),'passwordField':_0x61b2('0x50')},function(_0x5dac98,_0x3269c9,_0x4dfee7){return localAuthenticate(db[_0x61b2('0x3b')],_0x5dac98,_0x3269c9,_0x4dfee7);})); \ No newline at end of file +var _0xde35=['email','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','resetPasswordExpires','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','findOne','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','then','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','minutes','clearBlockUser','add','getLicense','catch','find','service','Smtp','host','port','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','message','stringify','status','send','login','json','online','forgot','body'];(function(_0x550151,_0x49d953){var _0x1ba3cb=function(_0x530de2){while(--_0x530de2){_0x550151['push'](_0x550151['shift']());}};_0x1ba3cb(++_0x49d953);}(_0xde35,0x1b7));var _0x5de3=function(_0x5e56fa,_0x38bcbe){_0x5e56fa=_0x5e56fa-0x0;var _0x4dffc0=_0xde35[_0x5e56fa];return _0x4dffc0;};'use strict';var util=require(_0x5de3('0x0'));var passport=require('passport');var LocalStrategy=require(_0x5de3('0x1'))[_0x5de3('0x2')];var jayson=require(_0x5de3('0x3'));var _=require(_0x5de3('0x4'));var rs=require(_0x5de3('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x5de3('0x6'));var utils=require(_0x5de3('0x7'));var client=jayson[_0x5de3('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x5a0efb,_0x34dbeb,_0x540edf,_0x4136a0){var _0x5a1a1d,_0x436698;return db[_0x5de3('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x5de3('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x54d4a8){_0x5a1a1d=_0x54d4a8;return _0x5a0efb[_0x5de3('0xb')]({'attributes':['id','name','password',_0x5de3('0xc'),_0x5de3('0xd'),_0x5de3('0xe'),'blocked',_0x5de3('0xf'),_0x5de3('0x10')],'where':{'name':_0x34dbeb,'role':{'$or':[_0x5de3('0x11'),_0x5de3('0x12'),_0x5de3('0x13')]}}});})[_0x5de3('0x14')](function(_0x11cf85){if(!_0x11cf85||_0x11cf85&&_0x11cf85[_0x5de3('0x15')]!==_0x34dbeb){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x436698=_0x11cf85;return _0x436698;}})[_0x5de3('0x14')](function(){_0x436698[_0x5de3('0x16')](_0x540edf,function(_0x25b4d3,_0x1083cc){var _0x15af8f=_0x436698[_0x5de3('0x10')]+0x1;if(_0x25b4d3){return _0x4136a0(_0x25b4d3);}else if(!_0x1083cc){if(_0x436698['disabled']){return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}else if(_0x5a1a1d[_0x5de3('0xa')]>0x0){if(_0x436698[_0x5de3('0x18')]){if(_0x5a1a1d[_0x5de3('0x19')]>0x0){if(moment(_0x436698[_0x5de3('0xf')])['add'](_0x5a1a1d[_0x5de3('0x19')],_0x5de3('0x1a'))>moment()){return _0x4136a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5de3('0x1b')](_0x436698,_0x15af8f,![],null)[_0x5de3('0x14')](function(){return _0x4136a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}}else{if(_0x15af8f>=_0x5a1a1d[_0x5de3('0xa')]){return utils['clearBlockUser'](_0x436698,0x0,!![],moment())[_0x5de3('0x14')](function(){return _0x4136a0(null,![],{'message':_0x5de3('0x17')});});}else{return utils['clearBlockUser'](_0x436698,_0x15af8f,![],null)['then'](function(){return _0x4136a0(null,![],{'message':_0x5de3('0x17')});});}}}else{return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}}else{if(_0x436698[_0x5de3('0xe')]){return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}else if(_0x5a1a1d['allowedLoginAttempts']>0x0){if(_0x436698['blocked']){if(_0x5a1a1d[_0x5de3('0x19')]>0x0){if(moment(_0x436698[_0x5de3('0xf')])[_0x5de3('0x1c')](_0x5a1a1d[_0x5de3('0x19')],_0x5de3('0x1a'))>moment()){return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}else{return utils[_0x5de3('0x1b')](_0x436698,0x0,![],null)[_0x5de3('0x14')](function(){return utils[_0x5de3('0x1d')](_0x436698);})[_0x5de3('0x14')](function(){return _0x4136a0(null,_0x436698);});}}else{return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}}else{return utils[_0x5de3('0x1b')](_0x436698,0x0,![],null)[_0x5de3('0x14')](function(){return utils['getLicense'](_0x436698);})[_0x5de3('0x14')](function(){return _0x4136a0(null,_0x436698);})[_0x5de3('0x1e')](function(_0x3edf70){return _0x4136a0(null,![],_0x3edf70);});}}else{if(_0x436698[_0x5de3('0x18')]){return _0x4136a0(null,![],{'message':_0x5de3('0x17')});}else{return utils[_0x5de3('0x1d')](_0x436698)['then'](function(){return _0x4136a0(null,_0x436698);});}}}});})[_0x5de3('0x1e')](function(_0x8b1c38){return _0x4136a0(null,![],_0x8b1c38);});}function sendServiceMail(_0x219d18){return db['MailAccount'][_0x5de3('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x5de3('0x15'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](function(_0x4be403){if(!_0x4be403){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1f9aeb={'tls':{'rejectUnauthorized':![]}};if(_0x4be403['Smtp'][_0x5de3('0x20')]){_0x1f9aeb[_0x5de3('0x20')]=_0x4be403[_0x5de3('0x21')][_0x5de3('0x20')];}else{_0x1f9aeb[_0x5de3('0x22')]=_0x4be403[_0x5de3('0x21')]['host'];_0x1f9aeb[_0x5de3('0x23')]=_0x4be403['Smtp'][_0x5de3('0x23')];_0x1f9aeb['secure']=_0x4be403[_0x5de3('0x21')]['secure'];}if(_0x4be403[_0x5de3('0x21')][_0x5de3('0x24')]){_0x1f9aeb[_0x5de3('0x25')]={'user':_0x4be403[_0x5de3('0x21')][_0x5de3('0x12')],'pass':_0x4be403[_0x5de3('0x21')][_0x5de3('0x26')]};}var _0x2af46f={'account':_0x1f9aeb,'message':_[_0x5de3('0x27')]({'from':util[_0x5de3('0x28')](_0x5de3('0x29'),_0x4be403['name'],_0x4be403['email']||_0x4be403['Smtp'][_0x5de3('0x12')])},_0x219d18)};return client[_0x5de3('0x2a')](_0x5de3('0x2b'),_0x2af46f);})[_0x5de3('0x14')](function(_0x507cf6){if(_0x507cf6['error']){throw new Error(util[_0x5de3('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x507cf6['error'][_0x5de3('0x2c')]||JSON[_0x5de3('0x2d')](_0x507cf6['error'])));}return!![];});}function handleError(_0x17cffe,_0xb5fdb5,_0x298d9d){return _0x17cffe[_0x5de3('0x2e')](_0xb5fdb5||0x1f4)[_0x5de3('0x2f')]({'message':_0x298d9d?_0x298d9d['message']||_0x298d9d:''});}exports[_0x5de3('0x30')]=function(_0x2116d6,_0x4b27f3,_0xcffd86){passport['authenticate']('local-login',function(_0x12b4a8,_0xa351a6,_0x22181d){var _0x36b3ab=_0x12b4a8||_0x22181d;if(_0x36b3ab){return handleError(_0x4b27f3,0x191,_0x36b3ab);}if(!_0xa351a6){return handleError(_0x4b27f3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x8efa44={'payload':{'id':_0xa351a6['id'],'role':_0xa351a6[_0x5de3('0xd')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x8efa44)[_0x5de3('0x14')](function(_0x5bf27f){_0x4b27f3[_0x5de3('0x31')]({'id':_0xa351a6['id'],'token':_0x5bf27f,'statusCall':'','isAlreadyLogged':_0xa351a6[_0x5de3('0x32')]});});}})(_0x2116d6,_0x4b27f3,_0xcffd86);};exports[_0x5de3('0x33')]=function(_0x303184,_0x336fd9,_0x4c65d7){if(!_0x303184[_0x5de3('0x34')][_0x5de3('0x35')]){return handleError(_0x336fd9,0x1f4,{'message':_0x5de3('0x36')});}var _0x272d7d=rs[_0x5de3('0x37')]();_0x303184[_0x5de3('0x34')][_0x5de3('0x35')]=_0x303184[_0x5de3('0x34')][_0x5de3('0x35')][_0x5de3('0x38')]()[_0x5de3('0x39')]();var _0x31011f;return db[_0x5de3('0x9')][_0x5de3('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x5de3('0x14')](function(_0x15efa2){_0x31011f=_0x15efa2;return db[_0x5de3('0x3a')]['find']({'where':{'email':_0x303184['body']['email']}});})[_0x5de3('0x14')](function(_0x1e4706){if(!_0x1e4706){throw new Error(_0x5de3('0x3b'));}if(_0x1e4706[_0x5de3('0xe')]){throw new Error(_0x5de3('0x3c'));}if(_0x1e4706[_0x5de3('0x18')]){if(moment(_0x1e4706[_0x5de3('0xf')])[_0x5de3('0x1c')](_0x31011f[_0x5de3('0x19')],_0x5de3('0x1a'))>moment()){throw new Error(_0x5de3('0x3d'));}else{_0x1e4706['blocked']=![];_0x1e4706['blockedAt']=null;}}_0x1e4706[_0x5de3('0x3e')]=_0x272d7d;_0x1e4706['resetPasswordExpires']=Date[_0x5de3('0x3f')]()+0x36ee80;return _0x1e4706[_0x5de3('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x303184[_0x5de3('0x34')][_0x5de3('0x35')],'subject':_0x5de3('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x5de3('0x42')+_0x5de3('0x43')+_0x303184[_0x5de3('0x44')][_0x5de3('0x22')]+_0x5de3('0x45')+_0x272d7d+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x5de3('0x14')](function(){_0x336fd9['status'](0xc8)[_0x5de3('0x2f')]({'message':_0x5de3('0x46')});})[_0x5de3('0x1e')](function(_0x116013){return handleError(_0x336fd9,0x1f4,_0x116013);});};exports[_0x5de3('0x47')]=function(_0x1c4799,_0x256cea,_0x277454){return db['User']['find']({'where':{'resetPasswordToken':_0x1c4799[_0x5de3('0x48')][_0x5de3('0x49')],'resetPasswordExpires':{'$gt':Date[_0x5de3('0x3f')]()}}})[_0x5de3('0x14')](function(_0x57c1fd){if(!_0x57c1fd){throw new Error(_0x5de3('0x4a'));}return db[_0x5de3('0x9')][_0x5de3('0xb')]({'attributes':['id',_0x5de3('0x4b'),'enforcePasswordHistory',_0x5de3('0x4c')]})[_0x5de3('0x14')](function(_0x19db20){if(_0x19db20[_0x5de3('0x4b')])authService[_0x5de3('0x4d')](_0x1c4799[_0x5de3('0x34')][_0x5de3('0x4e')]);if(!_0x19db20[_0x5de3('0x4f')]||!_0x57c1fd['previousPasswords'])return _0x57c1fd;authService['validatePasswordHistory'](_0x1c4799[_0x5de3('0x34')][_0x5de3('0x4e')],_0x57c1fd[_0x5de3('0x50')],_0x19db20['passwordHistoryLimit']);return _0x57c1fd;})[_0x5de3('0x14')](function(){_0x57c1fd[_0x5de3('0x4e')]=_0x1c4799['body'][_0x5de3('0x4e')];_0x57c1fd['resetPasswordToken']=null;_0x57c1fd[_0x5de3('0x51')]=null;return _0x57c1fd[_0x5de3('0x40')]();});})[_0x5de3('0x14')](function(){_0x256cea[_0x5de3('0x2e')](0xc8)[_0x5de3('0x2f')]({'message':'Password\x20reset!'});})[_0x5de3('0x1e')](function(_0x485902){return handleError(_0x256cea,0x1f4,_0x485902);});};passport['use']('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x5de3('0x4e')},function(_0x409c79,_0x2748b1,_0xfb253){return localAuthenticate(db[_0x5de3('0x3a')],_0x409c79,_0x2748b1,_0xfb253);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c424743..710fe15 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 _0xe072=['Router','./authLocal.controller','login','post','/forgot','forgot','/reset/:token','exports'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0xe072,0xc0));var _0x2e07=function(_0x18db4d,_0x488874){_0x18db4d=_0x18db4d-0x0;var _0x3d9218=_0xe072[_0x18db4d];return _0x3d9218;};'use strict';var express=require('express');var router=express[_0x2e07('0x0')]();var controller=require(_0x2e07('0x1'));router['post']('/',controller[_0x2e07('0x2')]);router[_0x2e07('0x3')](_0x2e07('0x4'),controller[_0x2e07('0x5')]);router['post'](_0x2e07('0x6'),controller['reset']);module[_0x2e07('0x7')]=router; \ No newline at end of file +var _0xec97=['./authLocal.controller','login','/forgot','forgot','post'];(function(_0x1f77be,_0x1ea03c){var _0x349b38=function(_0x4dc45f){while(--_0x4dc45f){_0x1f77be['push'](_0x1f77be['shift']());}};_0x349b38(++_0x1ea03c);}(_0xec97,0x91));var _0x7ec9=function(_0x235ced,_0x4a5767){_0x235ced=_0x235ced-0x0;var _0x1da17f=_0xec97[_0x235ced];return _0x1da17f;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x7ec9('0x0'));router['post']('/',controller[_0x7ec9('0x1')]);router['post'](_0x7ec9('0x2'),controller[_0x7ec9('0x3')]);router[_0x7ec9('0x4')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 00c1969..ebdb0d8 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 _0x1f32=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x1d37c6,_0x5ec404){var _0xd95b3a=function(_0x3cfaff){while(--_0x3cfaff){_0x1d37c6['push'](_0x1d37c6['shift']());}};_0xd95b3a(++_0x5ec404);}(_0x1f32,0xd1));var _0x21f3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1f32[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x21f3('0x0'));module[_0x21f3('0x1')]={'name':{'type':Sequelize[_0x21f3('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x21f3('0x2')]},'description':{'type':Sequelize[_0x21f3('0x2')]},'status':{'type':Sequelize[_0x21f3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x21f3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe48a=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xe48a,0x106));var _0xae48=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0xe48a[_0xcfcbaa];return _0x157ed0;};'use strict';var Sequelize=require('sequelize');module[_0xae48('0x0')]={'name':{'type':Sequelize[_0xae48('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xae48('0x1')]},'description':{'type':Sequelize[_0xae48('0x1')]},'status':{'type':Sequelize[_0xae48('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xae48('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index e1c2816..f328595 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 _0xd77b=['addConditions','Condition','omit','ids','getConditions','findOne','Action','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','apply','save','update','destroy','then','error','stack','name','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','Automation','count','includeAll','include','findAll','catch','show','find','create','body','params'];(function(_0x354332,_0x1867a6){var _0x44c806=function(_0x395828){while(--_0x395828){_0x354332['push'](_0x354332['shift']());}};_0x44c806(++_0x1867a6);}(_0xd77b,0xa8));var _0xbd77=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xd77b[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0xbd77('0x0'));var rimraf=require(_0xbd77('0x1'));var zipdir=require(_0xbd77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd77('0x3'));var moment=require('moment');var BPromise=require(_0xbd77('0x4'));var Mustache=require(_0xbd77('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbd77('0x6'));var ejs=require(_0xbd77('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd77('0x8'));var squel=require(_0xbd77('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbd77('0xa'));var toCsv=require(_0xbd77('0x6'));var querystring=require(_0xbd77('0xb'));var Papa=require(_0xbd77('0xc'));var Redis=require('ioredis');var authService=require(_0xbd77('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbd77('0xe'));var hardwareService=require(_0xbd77('0xf'));var logger=require(_0xbd77('0x10'))(_0xbd77('0x11'));var utils=require(_0xbd77('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbd77('0x13'));var db=require(_0xbd77('0x14'))['db'];function respondWithStatusCode(_0xf66343,_0x1b0d6f){_0x1b0d6f=_0x1b0d6f||0xcc;return function(_0x5b21af){if(_0x5b21af){return _0xf66343[_0xbd77('0x15')](_0x1b0d6f);}return _0xf66343[_0xbd77('0x16')](_0x1b0d6f)[_0xbd77('0x17')]();};}function respondWithResult(_0x5e11b1,_0x117500){_0x117500=_0x117500||0xc8;return function(_0x11ab90){if(_0x11ab90){return _0x5e11b1['status'](_0x117500)[_0xbd77('0x18')](_0x11ab90);}};}function respondWithFilteredResult(_0x533e89,_0x51d786){return function(_0x49617d){if(_0x49617d){var _0x5cb4c0=typeof _0x51d786['offset']===_0xbd77('0x19')&&typeof _0x51d786[_0xbd77('0x1a')]===_0xbd77('0x19');var _0x10334f=_0x49617d['count'];var _0x2f6047=_0x5cb4c0?0x0:_0x51d786[_0xbd77('0x1b')];var _0x520022=_0x5cb4c0?_0x49617d['count']:_0x51d786[_0xbd77('0x1b')]+_0x51d786['limit'];var _0x1f828a;if(_0x520022>=_0x10334f){_0x520022=_0x10334f;_0x1f828a=0xc8;}else{_0x1f828a=0xce;}_0x533e89[_0xbd77('0x16')](_0x1f828a);return _0x533e89[_0xbd77('0x1c')]('Content-Range',_0x2f6047+'-'+_0x520022+'/'+_0x10334f)[_0xbd77('0x18')](_0x49617d);}return null;};}function patchUpdates(_0x4b8cac){return function(_0x335436){try{jsonpatch[_0xbd77('0x1d')](_0x335436,_0x4b8cac,!![]);}catch(_0x5b2729){return BPromise['reject'](_0x5b2729);}return _0x335436[_0xbd77('0x1e')]();};}function saveUpdates(_0x552edc,_0x24b88e){return function(_0x19d3a8){if(_0x19d3a8){return _0x19d3a8[_0xbd77('0x1f')](_0x552edc)['then'](function(_0xefc29f){return _0xefc29f;});}return null;};}function removeEntity(_0x57f564,_0x5812c9){return function(_0x64b797){if(_0x64b797){return _0x64b797[_0xbd77('0x20')]()[_0xbd77('0x21')](function(){_0x57f564[_0xbd77('0x16')](0xcc)[_0xbd77('0x17')]();});}};}function handleEntityNotFound(_0x295839,_0x3ab330){return function(_0x4203ec){if(!_0x4203ec){_0x295839['sendStatus'](0x194);}return _0x4203ec;};}function handleError(_0x245236,_0x627731){_0x627731=_0x627731||0x1f4;return function(_0x45c8e5){logger[_0xbd77('0x22')](_0x45c8e5[_0xbd77('0x23')]);if(_0x45c8e5[_0xbd77('0x24')]){delete _0x45c8e5['name'];}_0x245236[_0xbd77('0x16')](_0x627731)['send'](_0x45c8e5);};}exports[_0xbd77('0x25')]=function(_0x41ac4a,_0x3e1e7e){var _0x2c0dc0={},_0x198e67={},_0x4b22ee={'count':0x0,'rows':[]};var _0x5d4883=_['map'](db['Automation'][_0xbd77('0x26')],function(_0x4bd0d1){return{'name':_0x4bd0d1[_0xbd77('0x27')],'type':_0x4bd0d1['type'][_0xbd77('0x28')]};});_0x198e67['model']=_[_0xbd77('0x29')](_0x5d4883,'name');_0x198e67[_0xbd77('0x2a')]=_[_0xbd77('0x2b')](_0x41ac4a['query']);_0x198e67[_0xbd77('0x2c')]=_[_0xbd77('0x2d')](_0x198e67['model'],_0x198e67['query']);_0x2c0dc0[_0xbd77('0x2e')]=_[_0xbd77('0x2d')](_0x198e67[_0xbd77('0x2f')],qs[_0xbd77('0x30')](_0x41ac4a[_0xbd77('0x2a')][_0xbd77('0x30')]));_0x2c0dc0[_0xbd77('0x2e')]=_0x2c0dc0['attributes'][_0xbd77('0x31')]?_0x2c0dc0[_0xbd77('0x2e')]:_0x198e67[_0xbd77('0x2f')];if(!_0x41ac4a[_0xbd77('0x2a')][_0xbd77('0x32')](_0xbd77('0x33'))){_0x2c0dc0[_0xbd77('0x1a')]=qs[_0xbd77('0x1a')](_0x41ac4a[_0xbd77('0x2a')]['limit']);_0x2c0dc0[_0xbd77('0x1b')]=qs[_0xbd77('0x1b')](_0x41ac4a[_0xbd77('0x2a')][_0xbd77('0x1b')]);}_0x2c0dc0[_0xbd77('0x34')]=qs[_0xbd77('0x35')](_0x41ac4a['query'][_0xbd77('0x35')]);_0x2c0dc0['where']=qs[_0xbd77('0x2c')](_[_0xbd77('0x36')](_0x41ac4a['query'],_0x198e67[_0xbd77('0x2c')]),_0x5d4883);if(_0x41ac4a['query']['filter']){_0x2c0dc0['where']=_['merge'](_0x2c0dc0[_0xbd77('0x37')],{'$or':_[_0xbd77('0x29')](_0x5d4883,function(_0x3ad751){if(_0x3ad751[_0xbd77('0x38')]!==_0xbd77('0x39')){var _0x43844e={};_0x43844e[_0x3ad751['name']]={'$like':'%'+_0x41ac4a[_0xbd77('0x2a')][_0xbd77('0x3a')]+'%'};return _0x43844e;}})});}_0x2c0dc0=_[_0xbd77('0x3b')]({},_0x2c0dc0,_0x41ac4a[_0xbd77('0x3c')]);var _0xc203f={'where':_0x2c0dc0[_0xbd77('0x37')]};return db[_0xbd77('0x3d')][_0xbd77('0x3e')](_0xc203f)['then'](function(_0x2f9ef4){_0x4b22ee[_0xbd77('0x3e')]=_0x2f9ef4;if(_0x41ac4a['query'][_0xbd77('0x3f')]){_0x2c0dc0[_0xbd77('0x40')]=[{'all':!![]}];}return db[_0xbd77('0x3d')][_0xbd77('0x41')](_0x2c0dc0);})[_0xbd77('0x21')](function(_0x4f2e39){_0x4b22ee['rows']=_0x4f2e39;return _0x4b22ee;})[_0xbd77('0x21')](respondWithFilteredResult(_0x3e1e7e,_0x2c0dc0))[_0xbd77('0x42')](handleError(_0x3e1e7e,null));};exports[_0xbd77('0x43')]=function(_0x1a5ae0,_0xb24fa4){var _0x2f4ece={'raw':![],'where':{'id':_0x1a5ae0['params']['id']}},_0x135c49={};_0x135c49[_0xbd77('0x2f')]=_[_0xbd77('0x2b')](db[_0xbd77('0x3d')][_0xbd77('0x26')]);_0x135c49[_0xbd77('0x2a')]=_['keys'](_0x1a5ae0['query']);_0x135c49[_0xbd77('0x2c')]=_[_0xbd77('0x2d')](_0x135c49[_0xbd77('0x2f')],_0x135c49[_0xbd77('0x2a')]);_0x2f4ece[_0xbd77('0x2e')]=_[_0xbd77('0x2d')](_0x135c49[_0xbd77('0x2f')],qs[_0xbd77('0x30')](_0x1a5ae0[_0xbd77('0x2a')][_0xbd77('0x30')]));_0x2f4ece[_0xbd77('0x2e')]=_0x2f4ece[_0xbd77('0x2e')][_0xbd77('0x31')]?_0x2f4ece[_0xbd77('0x2e')]:_0x135c49[_0xbd77('0x2f')];if(_0x1a5ae0['query']['includeAll']){_0x2f4ece[_0xbd77('0x40')]=[{'all':!![]}];}_0x2f4ece=_['merge']({},_0x2f4ece,_0x1a5ae0['options']);return db[_0xbd77('0x3d')][_0xbd77('0x44')](_0x2f4ece)[_0xbd77('0x21')](handleEntityNotFound(_0xb24fa4,null))[_0xbd77('0x21')](respondWithResult(_0xb24fa4,null))['catch'](handleError(_0xb24fa4,null));};exports[_0xbd77('0x45')]=function(_0x577822,_0x55dd68){return db[_0xbd77('0x3d')]['create'](_0x577822[_0xbd77('0x46')],{})[_0xbd77('0x21')](respondWithResult(_0x55dd68,0xc9))[_0xbd77('0x42')](handleError(_0x55dd68,null));};exports[_0xbd77('0x1f')]=function(_0x27f4ba,_0x5f1465){if(_0x27f4ba[_0xbd77('0x46')]['id']){delete _0x27f4ba['body']['id'];}return db['Automation']['find']({'where':{'id':_0x27f4ba[_0xbd77('0x47')]['id']}})[_0xbd77('0x21')](handleEntityNotFound(_0x5f1465,null))['then'](saveUpdates(_0x27f4ba['body'],null))[_0xbd77('0x21')](respondWithResult(_0x5f1465,null))[_0xbd77('0x42')](handleError(_0x5f1465,null));};exports['destroy']=function(_0x1d5d58,_0x3afd4d){return db[_0xbd77('0x3d')][_0xbd77('0x44')]({'where':{'id':_0x1d5d58[_0xbd77('0x47')]['id']}})['then'](handleEntityNotFound(_0x3afd4d,null))['then'](removeEntity(_0x3afd4d,null))[_0xbd77('0x42')](handleError(_0x3afd4d,null));};exports[_0xbd77('0x48')]=function(_0x1db1d2,_0x49ceef,_0x4338c1){return db[_0xbd77('0x49')][_0xbd77('0x44')]({'where':{'id':_0x1db1d2[_0xbd77('0x47')]['id']}})[_0xbd77('0x21')](handleEntityNotFound(_0x49ceef,null))['then'](function(_0x18d710){if(_0x18d710){return _0x18d710[_0xbd77('0x48')](_0x1db1d2[_0xbd77('0x46')]['ids'],_[_0xbd77('0x4a')](_0x1db1d2[_0xbd77('0x46')],[_0xbd77('0x4b'),'id'])||{});}})[_0xbd77('0x21')](respondWithResult(_0x49ceef,null))[_0xbd77('0x42')](handleError(_0x49ceef,null));};exports[_0xbd77('0x4c')]=function(_0x37c9b3,_0x3ff872,_0x4f40a1){var _0x4a8d37={};var _0xf11337={};var _0x57c50a;var _0x41cdc8;return db[_0xbd77('0x3d')][_0xbd77('0x4d')]({'where':{'id':_0x37c9b3[_0xbd77('0x47')]['id']}})[_0xbd77('0x21')](handleEntityNotFound(_0x3ff872,null))[_0xbd77('0x21')](function(_0x148014){if(_0x148014){_0x57c50a=_0x148014;_0xf11337['model']=_[_0xbd77('0x2b')](db[_0xbd77('0x49')][_0xbd77('0x26')]);_0xf11337[_0xbd77('0x2a')]=_[_0xbd77('0x2b')](_0x37c9b3[_0xbd77('0x2a')]);_0xf11337[_0xbd77('0x2c')]=_[_0xbd77('0x2d')](_0xf11337['model'],_0xf11337['query']);_0x4a8d37[_0xbd77('0x2e')]=_['intersection'](_0xf11337[_0xbd77('0x2f')],qs[_0xbd77('0x30')](_0x37c9b3[_0xbd77('0x2a')][_0xbd77('0x30')]));_0x4a8d37['attributes']=_0x4a8d37[_0xbd77('0x2e')][_0xbd77('0x31')]?_0x4a8d37[_0xbd77('0x2e')]:_0xf11337[_0xbd77('0x2f')];_0x4a8d37['order']=qs[_0xbd77('0x35')](_0x37c9b3[_0xbd77('0x2a')][_0xbd77('0x35')]);_0x4a8d37[_0xbd77('0x37')]=qs[_0xbd77('0x2c')](_[_0xbd77('0x36')](_0x37c9b3['query'],_0xf11337[_0xbd77('0x2c')]));if(_0x37c9b3['query']['filter']){_0x4a8d37[_0xbd77('0x37')]=_[_0xbd77('0x3b')](_0x4a8d37[_0xbd77('0x37')],{'$or':_[_0xbd77('0x29')](_0x4a8d37['attributes'],function(_0x1e2dd4){var _0x20c07c={};_0x20c07c[_0x1e2dd4]={'$like':'%'+_0x37c9b3[_0xbd77('0x2a')][_0xbd77('0x3a')]+'%'};return _0x20c07c;})});}_0x4a8d37=_['merge']({},_0x4a8d37,_0x37c9b3[_0xbd77('0x3c')]);return _0x57c50a['getConditions'](_0x4a8d37);}})[_0xbd77('0x21')](function(_0x5d3aa6){if(_0x5d3aa6){_0x41cdc8=_0x5d3aa6[_0xbd77('0x31')];if(!_0x37c9b3[_0xbd77('0x2a')][_0xbd77('0x32')](_0xbd77('0x33'))){_0x4a8d37[_0xbd77('0x1a')]=qs[_0xbd77('0x1a')](_0x37c9b3[_0xbd77('0x2a')][_0xbd77('0x1a')]);_0x4a8d37[_0xbd77('0x1b')]=qs['offset'](_0x37c9b3[_0xbd77('0x2a')]['offset']);}return _0x57c50a[_0xbd77('0x4c')](_0x4a8d37);}})[_0xbd77('0x21')](function(_0x426cff){if(_0x426cff){return _0x426cff?{'count':_0x41cdc8,'rows':_0x426cff}:null;}})[_0xbd77('0x21')](respondWithResult(_0x3ff872,null))[_0xbd77('0x42')](handleError(_0x3ff872,null));};exports['addActions']=function(_0x1a7e01,_0x7215b0,_0x2e1ba7){return db[_0xbd77('0x4e')]['find']({'where':{'id':_0x1a7e01[_0xbd77('0x47')]['id']}})[_0xbd77('0x21')](handleEntityNotFound(_0x7215b0,null))[_0xbd77('0x21')](function(_0x5acaac){if(_0x5acaac){return _0x5acaac['addActions'](_0x1a7e01['body'][_0xbd77('0x4b')],_[_0xbd77('0x4a')](_0x1a7e01[_0xbd77('0x46')],[_0xbd77('0x4b'),'id'])||{});}})[_0xbd77('0x21')](respondWithResult(_0x7215b0,null))['catch'](handleError(_0x7215b0,null));};exports[_0xbd77('0x4f')]=function(_0x269423,_0x43139d,_0x28f57a){var _0x476847={};var _0x546278={};var _0x3a2727;var _0x4896b3;return db[_0xbd77('0x3d')][_0xbd77('0x4d')]({'where':{'id':_0x269423[_0xbd77('0x47')]['id']}})['then'](handleEntityNotFound(_0x43139d,null))['then'](function(_0xa6fc8e){if(_0xa6fc8e){_0x3a2727=_0xa6fc8e;_0x546278[_0xbd77('0x2f')]=_[_0xbd77('0x2b')](db[_0xbd77('0x4e')]['rawAttributes']);_0x546278[_0xbd77('0x2a')]=_[_0xbd77('0x2b')](_0x269423[_0xbd77('0x2a')]);_0x546278[_0xbd77('0x2c')]=_[_0xbd77('0x2d')](_0x546278[_0xbd77('0x2f')],_0x546278['query']);_0x476847['attributes']=_[_0xbd77('0x2d')](_0x546278['model'],qs[_0xbd77('0x30')](_0x269423['query'][_0xbd77('0x30')]));_0x476847[_0xbd77('0x2e')]=_0x476847[_0xbd77('0x2e')]['length']?_0x476847[_0xbd77('0x2e')]:_0x546278['model'];_0x476847[_0xbd77('0x34')]=qs[_0xbd77('0x35')](_0x269423[_0xbd77('0x2a')][_0xbd77('0x35')]);_0x476847['where']=qs[_0xbd77('0x2c')](_[_0xbd77('0x36')](_0x269423['query'],_0x546278[_0xbd77('0x2c')]));if(_0x269423[_0xbd77('0x2a')][_0xbd77('0x3a')]){_0x476847[_0xbd77('0x37')]=_[_0xbd77('0x3b')](_0x476847[_0xbd77('0x37')],{'$or':_[_0xbd77('0x29')](_0x476847[_0xbd77('0x2e')],function(_0x2f0813){var _0x52a5dc={};_0x52a5dc[_0x2f0813]={'$like':'%'+_0x269423[_0xbd77('0x2a')]['filter']+'%'};return _0x52a5dc;})});}_0x476847=_[_0xbd77('0x3b')]({},_0x476847,_0x269423[_0xbd77('0x3c')]);return _0x3a2727[_0xbd77('0x4f')](_0x476847);}})[_0xbd77('0x21')](function(_0x2962e7){if(_0x2962e7){_0x4896b3=_0x2962e7['length'];if(!_0x269423[_0xbd77('0x2a')]['hasOwnProperty'](_0xbd77('0x33'))){_0x476847[_0xbd77('0x1a')]=qs[_0xbd77('0x1a')](_0x269423[_0xbd77('0x2a')]['limit']);_0x476847['offset']=qs[_0xbd77('0x1b')](_0x269423[_0xbd77('0x2a')][_0xbd77('0x1b')]);}return _0x3a2727[_0xbd77('0x4f')](_0x476847);}})[_0xbd77('0x21')](function(_0x4cd5c4){if(_0x4cd5c4){return _0x4cd5c4?{'count':_0x4896b3,'rows':_0x4cd5c4}:null;}})[_0xbd77('0x21')](respondWithResult(_0x43139d,null))['catch'](handleError(_0x43139d,null));}; \ No newline at end of file +var _0x9acc=['length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','addConditions','ids','getConditions','findOne','addActions','Action','getActions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields'];(function(_0x125633,_0x2514fe){var _0x55b6e8=function(_0x38ed3b){while(--_0x38ed3b){_0x125633['push'](_0x125633['shift']());}};_0x55b6e8(++_0x2514fe);}(_0x9acc,0x6e));var _0xc9ac=function(_0x351fbe,_0xe352a2){_0x351fbe=_0x351fbe-0x0;var _0x56d088=_0x9acc[_0x351fbe];return _0x56d088;};'use strict';var emlformat=require(_0xc9ac('0x0'));var rimraf=require(_0xc9ac('0x1'));var zipdir=require(_0xc9ac('0x2'));var jsonpatch=require(_0xc9ac('0x3'));var rp=require(_0xc9ac('0x4'));var moment=require(_0xc9ac('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc9ac('0x6'));var util=require(_0xc9ac('0x7'));var path=require(_0xc9ac('0x8'));var sox=require('sox');var csv=require(_0xc9ac('0x9'));var ejs=require(_0xc9ac('0xa'));var fs=require('fs');var fs_extra=require(_0xc9ac('0xb'));var _=require(_0xc9ac('0xc'));var squel=require(_0xc9ac('0xd'));var crypto=require(_0xc9ac('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc9ac('0xf'));var toCsv=require(_0xc9ac('0x9'));var querystring=require(_0xc9ac('0x10'));var Papa=require(_0xc9ac('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9ac('0x12'));var hardwareService=require(_0xc9ac('0x13'));var logger=require('../../config/logger')(_0xc9ac('0x14'));var utils=require(_0xc9ac('0x15'));var config=require(_0xc9ac('0x16'));var licenseUtil=require(_0xc9ac('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec416f,_0x244098){_0x244098=_0x244098||0xcc;return function(_0x56a78c){if(_0x56a78c){return _0xec416f[_0xc9ac('0x18')](_0x244098);}return _0xec416f[_0xc9ac('0x19')](_0x244098)[_0xc9ac('0x1a')]();};}function respondWithResult(_0x1046f1,_0x482585){_0x482585=_0x482585||0xc8;return function(_0x3f31e9){if(_0x3f31e9){return _0x1046f1[_0xc9ac('0x19')](_0x482585)['json'](_0x3f31e9);}};}function respondWithFilteredResult(_0x418f86,_0x24cf70){return function(_0x30f718){if(_0x30f718){var _0x1c1232=typeof _0x24cf70[_0xc9ac('0x1b')]==='undefined'&&typeof _0x24cf70[_0xc9ac('0x1c')]===_0xc9ac('0x1d');var _0x1ec39d=_0x30f718['count'];var _0x487457=_0x1c1232?0x0:_0x24cf70[_0xc9ac('0x1b')];var _0x331197=_0x1c1232?_0x30f718[_0xc9ac('0x1e')]:_0x24cf70[_0xc9ac('0x1b')]+_0x24cf70[_0xc9ac('0x1c')];var _0x5f458c;if(_0x331197>=_0x1ec39d){_0x331197=_0x1ec39d;_0x5f458c=0xc8;}else{_0x5f458c=0xce;}_0x418f86[_0xc9ac('0x19')](_0x5f458c);return _0x418f86['set'](_0xc9ac('0x1f'),_0x487457+'-'+_0x331197+'/'+_0x1ec39d)[_0xc9ac('0x20')](_0x30f718);}return null;};}function patchUpdates(_0x470363){return function(_0x2a9679){try{jsonpatch['apply'](_0x2a9679,_0x470363,!![]);}catch(_0x1173f8){return BPromise[_0xc9ac('0x21')](_0x1173f8);}return _0x2a9679['save']();};}function saveUpdates(_0x249e57,_0x12823d){return function(_0x3afcc7){if(_0x3afcc7){return _0x3afcc7[_0xc9ac('0x22')](_0x249e57)[_0xc9ac('0x23')](function(_0x1c076b){return _0x1c076b;});}return null;};}function removeEntity(_0x226d2,_0x315d94){return function(_0x451c11){if(_0x451c11){return _0x451c11[_0xc9ac('0x24')]()[_0xc9ac('0x23')](function(){_0x226d2[_0xc9ac('0x19')](0xcc)[_0xc9ac('0x1a')]();});}};}function handleEntityNotFound(_0x2f75a8,_0x5e4b7e){return function(_0x599f5a){if(!_0x599f5a){_0x2f75a8[_0xc9ac('0x18')](0x194);}return _0x599f5a;};}function handleError(_0x1b7199,_0x3dd414){_0x3dd414=_0x3dd414||0x1f4;return function(_0x31bc75){logger[_0xc9ac('0x25')](_0x31bc75[_0xc9ac('0x26')]);if(_0x31bc75[_0xc9ac('0x27')]){delete _0x31bc75['name'];}_0x1b7199[_0xc9ac('0x19')](_0x3dd414)[_0xc9ac('0x28')](_0x31bc75);};}exports[_0xc9ac('0x29')]=function(_0x496398,_0x25be6f){var _0x4ab168={},_0x1d19ce={},_0x2a3df1={'count':0x0,'rows':[]};var _0x1b42f8=_['map'](db[_0xc9ac('0x2a')][_0xc9ac('0x2b')],function(_0xa7a38c){return{'name':_0xa7a38c['fieldName'],'type':_0xa7a38c[_0xc9ac('0x2c')][_0xc9ac('0x2d')]};});_0x1d19ce['model']=_[_0xc9ac('0x2e')](_0x1b42f8,'name');_0x1d19ce['query']=_[_0xc9ac('0x2f')](_0x496398[_0xc9ac('0x30')]);_0x1d19ce[_0xc9ac('0x31')]=_[_0xc9ac('0x32')](_0x1d19ce[_0xc9ac('0x33')],_0x1d19ce[_0xc9ac('0x30')]);_0x4ab168[_0xc9ac('0x34')]=_[_0xc9ac('0x32')](_0x1d19ce[_0xc9ac('0x33')],qs[_0xc9ac('0x35')](_0x496398['query'][_0xc9ac('0x35')]));_0x4ab168['attributes']=_0x4ab168[_0xc9ac('0x34')][_0xc9ac('0x36')]?_0x4ab168[_0xc9ac('0x34')]:_0x1d19ce['model'];if(!_0x496398[_0xc9ac('0x30')][_0xc9ac('0x37')](_0xc9ac('0x38'))){_0x4ab168[_0xc9ac('0x1c')]=qs[_0xc9ac('0x1c')](_0x496398['query'][_0xc9ac('0x1c')]);_0x4ab168[_0xc9ac('0x1b')]=qs[_0xc9ac('0x1b')](_0x496398[_0xc9ac('0x30')]['offset']);}_0x4ab168['order']=qs[_0xc9ac('0x39')](_0x496398[_0xc9ac('0x30')]['sort']);_0x4ab168['where']=qs[_0xc9ac('0x31')](_[_0xc9ac('0x3a')](_0x496398[_0xc9ac('0x30')],_0x1d19ce[_0xc9ac('0x31')]),_0x1b42f8);if(_0x496398[_0xc9ac('0x30')][_0xc9ac('0x3b')]){_0x4ab168[_0xc9ac('0x3c')]=_['merge'](_0x4ab168['where'],{'$or':_[_0xc9ac('0x2e')](_0x1b42f8,function(_0x4cf48f){if(_0x4cf48f['type']!==_0xc9ac('0x3d')){var _0x3aad37={};_0x3aad37[_0x4cf48f[_0xc9ac('0x27')]]={'$like':'%'+_0x496398[_0xc9ac('0x30')][_0xc9ac('0x3b')]+'%'};return _0x3aad37;}})});}_0x4ab168=_['merge']({},_0x4ab168,_0x496398[_0xc9ac('0x3e')]);var _0x5f1312={'where':_0x4ab168[_0xc9ac('0x3c')]};return db[_0xc9ac('0x2a')]['count'](_0x5f1312)[_0xc9ac('0x23')](function(_0x4b126c){_0x2a3df1['count']=_0x4b126c;if(_0x496398[_0xc9ac('0x30')][_0xc9ac('0x3f')]){_0x4ab168[_0xc9ac('0x40')]=[{'all':!![]}];}return db[_0xc9ac('0x2a')][_0xc9ac('0x41')](_0x4ab168);})[_0xc9ac('0x23')](function(_0x36db68){_0x2a3df1[_0xc9ac('0x42')]=_0x36db68;return _0x2a3df1;})[_0xc9ac('0x23')](respondWithFilteredResult(_0x25be6f,_0x4ab168))[_0xc9ac('0x43')](handleError(_0x25be6f,null));};exports[_0xc9ac('0x44')]=function(_0x19ae3c,_0x4ed64e){var _0x1392a4={'raw':![],'where':{'id':_0x19ae3c[_0xc9ac('0x45')]['id']}},_0x1ec79f={};_0x1ec79f[_0xc9ac('0x33')]=_[_0xc9ac('0x2f')](db[_0xc9ac('0x2a')][_0xc9ac('0x2b')]);_0x1ec79f['query']=_[_0xc9ac('0x2f')](_0x19ae3c[_0xc9ac('0x30')]);_0x1ec79f['filters']=_[_0xc9ac('0x32')](_0x1ec79f[_0xc9ac('0x33')],_0x1ec79f[_0xc9ac('0x30')]);_0x1392a4[_0xc9ac('0x34')]=_[_0xc9ac('0x32')](_0x1ec79f['model'],qs['fields'](_0x19ae3c[_0xc9ac('0x30')]['fields']));_0x1392a4[_0xc9ac('0x34')]=_0x1392a4[_0xc9ac('0x34')][_0xc9ac('0x36')]?_0x1392a4['attributes']:_0x1ec79f['model'];if(_0x19ae3c['query'][_0xc9ac('0x3f')]){_0x1392a4[_0xc9ac('0x40')]=[{'all':!![]}];}_0x1392a4=_[_0xc9ac('0x46')]({},_0x1392a4,_0x19ae3c[_0xc9ac('0x3e')]);return db[_0xc9ac('0x2a')][_0xc9ac('0x47')](_0x1392a4)[_0xc9ac('0x23')](handleEntityNotFound(_0x4ed64e,null))['then'](respondWithResult(_0x4ed64e,null))[_0xc9ac('0x43')](handleError(_0x4ed64e,null));};exports[_0xc9ac('0x48')]=function(_0x58c5de,_0x749307){return db[_0xc9ac('0x2a')][_0xc9ac('0x48')](_0x58c5de[_0xc9ac('0x49')],{})['then'](respondWithResult(_0x749307,0xc9))[_0xc9ac('0x43')](handleError(_0x749307,null));};exports[_0xc9ac('0x22')]=function(_0x28283b,_0x5d85a7){if(_0x28283b['body']['id']){delete _0x28283b[_0xc9ac('0x49')]['id'];}return db[_0xc9ac('0x2a')][_0xc9ac('0x47')]({'where':{'id':_0x28283b[_0xc9ac('0x45')]['id']}})[_0xc9ac('0x23')](handleEntityNotFound(_0x5d85a7,null))[_0xc9ac('0x23')](saveUpdates(_0x28283b['body'],null))['then'](respondWithResult(_0x5d85a7,null))['catch'](handleError(_0x5d85a7,null));};exports[_0xc9ac('0x24')]=function(_0x4ae1bf,_0x375573){return db[_0xc9ac('0x2a')]['find']({'where':{'id':_0x4ae1bf['params']['id']}})[_0xc9ac('0x23')](handleEntityNotFound(_0x375573,null))['then'](removeEntity(_0x375573,null))['catch'](handleError(_0x375573,null));};exports[_0xc9ac('0x4a')]=function(_0x5e02b1,_0x398d5b,_0x5e5804){return db['Condition'][_0xc9ac('0x47')]({'where':{'id':_0x5e02b1[_0xc9ac('0x45')]['id']}})[_0xc9ac('0x23')](handleEntityNotFound(_0x398d5b,null))['then'](function(_0x5e55c2){if(_0x5e55c2){return _0x5e55c2['addConditions'](_0x5e02b1['body'][_0xc9ac('0x4b')],_['omit'](_0x5e02b1['body'],[_0xc9ac('0x4b'),'id'])||{});}})[_0xc9ac('0x23')](respondWithResult(_0x398d5b,null))['catch'](handleError(_0x398d5b,null));};exports[_0xc9ac('0x4c')]=function(_0x5f30e4,_0xe5857,_0x5be314){var _0x5c3910={};var _0x5d6d93={};var _0xf3fecd;var _0x19b83b;return db[_0xc9ac('0x2a')][_0xc9ac('0x4d')]({'where':{'id':_0x5f30e4[_0xc9ac('0x45')]['id']}})[_0xc9ac('0x23')](handleEntityNotFound(_0xe5857,null))['then'](function(_0x500548){if(_0x500548){_0xf3fecd=_0x500548;_0x5d6d93[_0xc9ac('0x33')]=_['keys'](db['Condition'][_0xc9ac('0x2b')]);_0x5d6d93[_0xc9ac('0x30')]=_[_0xc9ac('0x2f')](_0x5f30e4[_0xc9ac('0x30')]);_0x5d6d93['filters']=_[_0xc9ac('0x32')](_0x5d6d93[_0xc9ac('0x33')],_0x5d6d93[_0xc9ac('0x30')]);_0x5c3910[_0xc9ac('0x34')]=_[_0xc9ac('0x32')](_0x5d6d93[_0xc9ac('0x33')],qs['fields'](_0x5f30e4[_0xc9ac('0x30')][_0xc9ac('0x35')]));_0x5c3910[_0xc9ac('0x34')]=_0x5c3910[_0xc9ac('0x34')]['length']?_0x5c3910[_0xc9ac('0x34')]:_0x5d6d93[_0xc9ac('0x33')];_0x5c3910['order']=qs[_0xc9ac('0x39')](_0x5f30e4[_0xc9ac('0x30')][_0xc9ac('0x39')]);_0x5c3910[_0xc9ac('0x3c')]=qs[_0xc9ac('0x31')](_[_0xc9ac('0x3a')](_0x5f30e4[_0xc9ac('0x30')],_0x5d6d93[_0xc9ac('0x31')]));if(_0x5f30e4[_0xc9ac('0x30')][_0xc9ac('0x3b')]){_0x5c3910[_0xc9ac('0x3c')]=_[_0xc9ac('0x46')](_0x5c3910[_0xc9ac('0x3c')],{'$or':_[_0xc9ac('0x2e')](_0x5c3910[_0xc9ac('0x34')],function(_0x3167ff){var _0xe2fb88={};_0xe2fb88[_0x3167ff]={'$like':'%'+_0x5f30e4[_0xc9ac('0x30')][_0xc9ac('0x3b')]+'%'};return _0xe2fb88;})});}_0x5c3910=_[_0xc9ac('0x46')]({},_0x5c3910,_0x5f30e4[_0xc9ac('0x3e')]);return _0xf3fecd[_0xc9ac('0x4c')](_0x5c3910);}})['then'](function(_0x56c01a){if(_0x56c01a){_0x19b83b=_0x56c01a[_0xc9ac('0x36')];if(!_0x5f30e4[_0xc9ac('0x30')][_0xc9ac('0x37')](_0xc9ac('0x38'))){_0x5c3910[_0xc9ac('0x1c')]=qs['limit'](_0x5f30e4['query']['limit']);_0x5c3910['offset']=qs['offset'](_0x5f30e4[_0xc9ac('0x30')][_0xc9ac('0x1b')]);}return _0xf3fecd[_0xc9ac('0x4c')](_0x5c3910);}})[_0xc9ac('0x23')](function(_0x1f334c){if(_0x1f334c){return _0x1f334c?{'count':_0x19b83b,'rows':_0x1f334c}:null;}})[_0xc9ac('0x23')](respondWithResult(_0xe5857,null))[_0xc9ac('0x43')](handleError(_0xe5857,null));};exports[_0xc9ac('0x4e')]=function(_0x1f005a,_0xd1cc47,_0x3236d1){return db[_0xc9ac('0x4f')][_0xc9ac('0x47')]({'where':{'id':_0x1f005a[_0xc9ac('0x45')]['id']}})[_0xc9ac('0x23')](handleEntityNotFound(_0xd1cc47,null))[_0xc9ac('0x23')](function(_0x4f6df1){if(_0x4f6df1){return _0x4f6df1[_0xc9ac('0x4e')](_0x1f005a[_0xc9ac('0x49')][_0xc9ac('0x4b')],_['omit'](_0x1f005a[_0xc9ac('0x49')],[_0xc9ac('0x4b'),'id'])||{});}})['then'](respondWithResult(_0xd1cc47,null))[_0xc9ac('0x43')](handleError(_0xd1cc47,null));};exports[_0xc9ac('0x50')]=function(_0x3c4d0a,_0xb8da9b,_0x264cf7){var _0x4d18e5={};var _0x121bcf={};var _0x51fb6d;var _0x5ec044;return db[_0xc9ac('0x2a')][_0xc9ac('0x4d')]({'where':{'id':_0x3c4d0a[_0xc9ac('0x45')]['id']}})[_0xc9ac('0x23')](handleEntityNotFound(_0xb8da9b,null))[_0xc9ac('0x23')](function(_0x568003){if(_0x568003){_0x51fb6d=_0x568003;_0x121bcf[_0xc9ac('0x33')]=_[_0xc9ac('0x2f')](db[_0xc9ac('0x4f')][_0xc9ac('0x2b')]);_0x121bcf[_0xc9ac('0x30')]=_['keys'](_0x3c4d0a['query']);_0x121bcf[_0xc9ac('0x31')]=_[_0xc9ac('0x32')](_0x121bcf[_0xc9ac('0x33')],_0x121bcf[_0xc9ac('0x30')]);_0x4d18e5[_0xc9ac('0x34')]=_[_0xc9ac('0x32')](_0x121bcf[_0xc9ac('0x33')],qs[_0xc9ac('0x35')](_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x35')]));_0x4d18e5[_0xc9ac('0x34')]=_0x4d18e5[_0xc9ac('0x34')][_0xc9ac('0x36')]?_0x4d18e5[_0xc9ac('0x34')]:_0x121bcf['model'];_0x4d18e5[_0xc9ac('0x51')]=qs[_0xc9ac('0x39')](_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x39')]);_0x4d18e5['where']=qs[_0xc9ac('0x31')](_[_0xc9ac('0x3a')](_0x3c4d0a[_0xc9ac('0x30')],_0x121bcf['filters']));if(_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x3b')]){_0x4d18e5[_0xc9ac('0x3c')]=_[_0xc9ac('0x46')](_0x4d18e5[_0xc9ac('0x3c')],{'$or':_[_0xc9ac('0x2e')](_0x4d18e5['attributes'],function(_0x43014a){var _0x441be7={};_0x441be7[_0x43014a]={'$like':'%'+_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x3b')]+'%'};return _0x441be7;})});}_0x4d18e5=_[_0xc9ac('0x46')]({},_0x4d18e5,_0x3c4d0a['options']);return _0x51fb6d[_0xc9ac('0x50')](_0x4d18e5);}})[_0xc9ac('0x23')](function(_0x7b2e4a){if(_0x7b2e4a){_0x5ec044=_0x7b2e4a[_0xc9ac('0x36')];if(!_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x37')](_0xc9ac('0x38'))){_0x4d18e5[_0xc9ac('0x1c')]=qs[_0xc9ac('0x1c')](_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x1c')]);_0x4d18e5[_0xc9ac('0x1b')]=qs[_0xc9ac('0x1b')](_0x3c4d0a[_0xc9ac('0x30')][_0xc9ac('0x1b')]);}return _0x51fb6d[_0xc9ac('0x50')](_0x4d18e5);}})[_0xc9ac('0x23')](function(_0x473c50){if(_0x473c50){return _0x473c50?{'count':_0x5ec044,'rows':_0x473c50}:null;}})[_0xc9ac('0x23')](respondWithResult(_0xb8da9b,null))[_0xc9ac('0x43')](handleError(_0xb8da9b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a483762..0d7d42a 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 _0x84c4=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','util'];(function(_0x35825e,_0x657421){var _0x4f4d90=function(_0x160265){while(--_0x160265){_0x35825e['push'](_0x35825e['shift']());}};_0x4f4d90(++_0x657421);}(_0x84c4,0x15a));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484c('0x0'));var util=require(_0x484c('0x1'));var logger=require('../../config/logger')(_0x484c('0x2'));var moment=require(_0x484c('0x3'));var BPromise=require(_0x484c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x484c('0x5'));var rimraf=require(_0x484c('0x6'));var config=require(_0x484c('0x7'));var attributes=require('./automation.attributes');module[_0x484c('0x8')]=function(_0x524d99,_0x428a75){return _0x524d99[_0x484c('0x9')](_0x484c('0xa'),attributes,{'tableName':_0x484c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda42=['util','api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash'];(function(_0x2bd440,_0xfb5a9d){var _0x58f325=function(_0x19847f){while(--_0x19847f){_0x2bd440['push'](_0x2bd440['shift']());}};_0x58f325(++_0xfb5a9d);}(_0xda42,0x1ed));var _0x2da4=function(_0x3233de,_0x5e7ec4){_0x3233de=_0x3233de-0x0;var _0x34427c=_0xda42[_0x3233de];return _0x34427c;};'use strict';var _=require(_0x2da4('0x0'));var util=require(_0x2da4('0x1'));var logger=require('../../config/logger')(_0x2da4('0x2'));var moment=require(_0x2da4('0x3'));var BPromise=require(_0x2da4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2da4('0x5'));var rimraf=require(_0x2da4('0x6'));var config=require(_0x2da4('0x7'));var attributes=require(_0x2da4('0x8'));module[_0x2da4('0x9')]=function(_0x338eec,_0xd9bb90){return _0x338eec[_0x2da4('0xa')](_0x2da4('0xb'),attributes,{'tableName':_0x2da4('0xc'),'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 5cb138c..9007b0e 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 _0x20df=['debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Automation,\x20%s,\x20%s'];(function(_0x3b3047,_0x1800ab){var _0x123ae8=function(_0x30e52d){while(--_0x30e52d){_0x3b3047['push'](_0x3b3047['shift']());}};_0x123ae8(++_0x1800ab);}(_0x20df,0x7c));var _0xf20d=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0x20df[_0x5d61b4];return _0x183fc5;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var moment=require(_0xf20d('0x2'));var BPromise=require(_0xf20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20d('0x4'));var db=require(_0xf20d('0x5'))['db'];var utils=require(_0xf20d('0x6'));var logger=require(_0xf20d('0x7'))(_0xf20d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf20d('0x9'));var client=jayson['client'][_0xf20d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d0da,_0x53a7b5,_0x184c8d){return new BPromise(function(_0x5f0353,_0x4f36d1){return client['request'](_0x41d0da,_0x184c8d)[_0xf20d('0xb')](function(_0x22b427){logger[_0xf20d('0xc')](_0xf20d('0xd'),_0x53a7b5,'request\x20sent');logger[_0xf20d('0xe')](_0xf20d('0xf'),_0x53a7b5,_0xf20d('0x10'),JSON[_0xf20d('0x11')](_0x22b427));if(_0x22b427[_0xf20d('0x12')]){if(_0x22b427[_0xf20d('0x12')][_0xf20d('0x13')]===0x1f4){logger[_0xf20d('0x12')]('Automation,\x20%s,\x20%s',_0x53a7b5,_0x22b427[_0xf20d('0x12')]['message']);return _0x4f36d1(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}logger['error'](_0xf20d('0xd'),_0x53a7b5,_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);return _0x5f0353(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x53a7b5,_0xf20d('0x10'));_0x5f0353(_0x22b427[_0xf20d('0x15')][_0xf20d('0x14')]);}})[_0xf20d('0x16')](function(_0x53c164){logger[_0xf20d('0x12')]('Automation,\x20%s,\x20%s',_0x53a7b5,_0x53c164);_0x4f36d1(_0x53c164);});});} \ No newline at end of file +var _0xd9eb=['then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x55118b,_0x15da70){var _0x107e47=function(_0x3ed7e5){while(--_0x3ed7e5){_0x55118b['push'](_0x55118b['shift']());}};_0x107e47(++_0x15da70);}(_0xd9eb,0xca));var _0xbd9e=function(_0x53d2d4,_0x1f63eb){_0x53d2d4=_0x53d2d4-0x0;var _0x2128d2=_0xd9eb[_0x53d2d4];return _0x2128d2;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var moment=require(_0xbd9e('0x2'));var BPromise=require(_0xbd9e('0x3'));var rs=require(_0xbd9e('0x4'));var fs=require('fs');var Redis=require(_0xbd9e('0x5'));var db=require(_0xbd9e('0x6'))['db'];var utils=require(_0xbd9e('0x7'));var logger=require(_0xbd9e('0x8'))(_0xbd9e('0x9'));var config=require(_0xbd9e('0xa'));var jayson=require(_0xbd9e('0xb'));var client=jayson[_0xbd9e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26408d,_0x37d9a1,_0x293a79){return new BPromise(function(_0x2dbf84,_0x20cddf){return client[_0xbd9e('0xd')](_0x26408d,_0x293a79)[_0xbd9e('0xe')](function(_0x82e476){logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));logger[_0xbd9e('0x12')]('Automation,\x20%s,\x20%s,\x20%s',_0x37d9a1,_0xbd9e('0x11'),JSON[_0xbd9e('0x13')](_0x82e476));if(_0x82e476['error']){if(_0x82e476[_0xbd9e('0x14')]['code']===0x1f4){logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);return _0x20cddf(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}logger[_0xbd9e('0x14')](_0xbd9e('0x10'),_0x37d9a1,_0x82e476['error'][_0xbd9e('0x15')]);return _0x2dbf84(_0x82e476[_0xbd9e('0x14')][_0xbd9e('0x15')]);}else{logger[_0xbd9e('0xf')](_0xbd9e('0x10'),_0x37d9a1,_0xbd9e('0x11'));_0x2dbf84(_0x82e476[_0xbd9e('0x16')][_0xbd9e('0x15')]);}})[_0xbd9e('0x17')](function(_0x42e634){logger[_0xbd9e('0x14')]('Automation,\x20%s,\x20%s',_0x37d9a1,_0x42e634);_0x20cddf(_0x42e634);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d9c0286..acd4e79 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 _0xad86=['/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','addConditions','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x279216,_0x19e24b){var _0x4f16de=function(_0x3b7991){while(--_0x3b7991){_0x279216['push'](_0x279216['shift']());}};_0x4f16de(++_0x19e24b);}(_0xad86,0x194));var _0x6ad8=function(_0x5b709a,_0x599b4b){_0x5b709a=_0x5b709a-0x0;var _0x34cf52=_0xad86[_0x5b709a];return _0x34cf52;};'use strict';var multer=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var path=require(_0x6ad8('0x2'));var timeout=require(_0x6ad8('0x3'));var express=require(_0x6ad8('0x4'));var router=express[_0x6ad8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6ad8('0x6'));var config=require(_0x6ad8('0x7'));var controller=require(_0x6ad8('0x8'));router[_0x6ad8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ad8('0x9')](_0x6ad8('0xa'),auth[_0x6ad8('0xb')](),controller[_0x6ad8('0xc')]);router['get']('/:id/conditions',auth[_0x6ad8('0xb')](),controller[_0x6ad8('0xd')]);router[_0x6ad8('0x9')](_0x6ad8('0xe'),auth[_0x6ad8('0xb')](),controller[_0x6ad8('0xf')]);router[_0x6ad8('0x10')]('/',auth[_0x6ad8('0xb')](),controller[_0x6ad8('0x11')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0x6ad8('0x12')]);router[_0x6ad8('0x10')]('/:id/actions',auth[_0x6ad8('0xb')](),controller['addActions']);router[_0x6ad8('0x13')](_0x6ad8('0xa'),auth['isAuthenticated'](),controller[_0x6ad8('0x14')]);router['delete'](_0x6ad8('0xa'),auth[_0x6ad8('0xb')](),controller[_0x6ad8('0x15')]);module[_0x6ad8('0x16')]=router; \ No newline at end of file +var _0xdd1b=['show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id'];(function(_0x326987,_0x65a19a){var _0x4f805e=function(_0x3baba2){while(--_0x3baba2){_0x326987['push'](_0x326987['shift']());}};_0x4f805e(++_0x65a19a);}(_0xdd1b,0x11f));var _0xbdd1=function(_0x293130,_0x5da862){_0x293130=_0x293130-0x0;var _0x30de42=_0xdd1b[_0x293130];return _0x30de42;};'use strict';var multer=require(_0xbdd1('0x0'));var util=require(_0xbdd1('0x1'));var path=require(_0xbdd1('0x2'));var timeout=require(_0xbdd1('0x3'));var express=require(_0xbdd1('0x4'));var router=express[_0xbdd1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbdd1('0x6'));var config=require('../../config/environment');var controller=require(_0xbdd1('0x7'));router[_0xbdd1('0x8')]('/',auth[_0xbdd1('0x9')](),controller[_0xbdd1('0xa')]);router[_0xbdd1('0x8')](_0xbdd1('0xb'),auth[_0xbdd1('0x9')](),controller[_0xbdd1('0xc')]);router[_0xbdd1('0x8')](_0xbdd1('0xd'),auth[_0xbdd1('0x9')](),controller[_0xbdd1('0xe')]);router[_0xbdd1('0x8')](_0xbdd1('0xf'),auth[_0xbdd1('0x9')](),controller[_0xbdd1('0x10')]);router[_0xbdd1('0x11')]('/',auth[_0xbdd1('0x9')](),controller[_0xbdd1('0x12')]);router['post'](_0xbdd1('0xd'),auth[_0xbdd1('0x9')](),controller['addConditions']);router[_0xbdd1('0x11')](_0xbdd1('0xf'),auth['isAuthenticated'](),controller[_0xbdd1('0x13')]);router[_0xbdd1('0x14')]('/:id',auth[_0xbdd1('0x9')](),controller['update']);router[_0xbdd1('0x15')](_0xbdd1('0xb'),auth[_0xbdd1('0x9')](),controller[_0xbdd1('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7d80d6a..8146ccc 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 _0xc9b8=['#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x45bd84,_0x4f5c50){var _0x48b5d8=function(_0x3d962){while(--_0x3d962){_0x45bd84['push'](_0x45bd84['shift']());}};_0x48b5d8(++_0x4f5c50);}(_0xc9b8,0x1e3));var _0x8c9b=function(_0x48ced3,_0x28d7d7){_0x48ced3=_0x48ced3-0x0;var _0x17d50a=_0xc9b8[_0x48ced3];return _0x17d50a;};'use strict';var Sequelize=require('sequelize');module[_0x8c9b('0x0')]={'name':{'type':Sequelize[_0x8c9b('0x1')],'unique':_0x8c9b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x8c9b('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x8c9b('0x1')]},'active':{'type':Sequelize[_0x8c9b('0x4')],'defaultValue':0x0,'comment':_0x8c9b('0x5')},'limitCalls':{'type':Sequelize[_0x8c9b('0x6')](0x4)[_0x8c9b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8c9b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8c9b('0x6')](0x3)[_0x8c9b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8c9b('0x6')](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c9b('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8c9b('0x6')](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c9b('0x9')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8c9b('0x6')](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[_0x8c9b('0x1')],'defaultValue':_0x8c9b('0xa')},'dialCheckDuplicateType':{'type':Sequelize[_0x8c9b('0xb')]('always',_0x8c9b('0xc'),_0x8c9b('0xd')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8c9b('0x4')],'defaultValue':0x0,'comment':_0x8c9b('0xe')},'dialAMDInitialSilence':{'type':Sequelize[_0x8c9b('0x6')](0x9)[_0x8c9b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8c9b('0xf')},'dialAMDGreeting':{'type':Sequelize[_0x8c9b('0x6')](0x9)[_0x8c9b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8c9b('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8c9b('0x6')](0x9)[_0x8c9b('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8c9b('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8c9b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8c9b('0x12')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8c9b('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8c9b('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8c9b('0x6')](0x9)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8c9b('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8c9b('0x6')](0x9)[_0x8c9b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8c9b('0x15')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8c9b('0xb')](_0x8c9b('0x16'),_0x8c9b('0x17')),'defaultValue':_0x8c9b('0x16')},'dialPrefix':{'type':Sequelize[_0x8c9b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8c9b('0x18')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8c9b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8c9b('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c9b('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c9b('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x8c9b('0x6')](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c9b('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c9b('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8c9b('0x6')](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c9b('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c9b('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x8c9b('0x6')](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c9b('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c9b('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8c9b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c9b('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8c9b('0x6')](0x5)[_0x8c9b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c9b('0x23')}}; \ No newline at end of file +var _0xf8da=['Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING'];(function(_0x21b14b,_0x4f9516){var _0x132411=function(_0x4b9797){while(--_0x4b9797){_0x21b14b['push'](_0x21b14b['shift']());}};_0x132411(++_0x4f9516);}(_0xf8da,0xf7));var _0xaf8d=function(_0x54f4a2,_0x3b0158){_0x54f4a2=_0x54f4a2-0x0;var _0x326631=_0xf8da[_0x54f4a2];return _0x326631;};'use strict';var Sequelize=require('sequelize');module[_0xaf8d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xaf8d('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xaf8d('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xaf8d('0x3')},'description':{'type':Sequelize[_0xaf8d('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xaf8d('0x5')},'limitCalls':{'type':Sequelize[_0xaf8d('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaf8d('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xaf8d('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaf8d('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xaf8d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaf8d('0x6')](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaf8d('0x6')](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf8d('0x6')](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xaf8d('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf8d('0x4')],'defaultValue':_0xaf8d('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xaf8d('0x2')](_0xaf8d('0xf'),_0xaf8d('0x10'),_0xaf8d('0x11')),'defaultValue':_0xaf8d('0xf')},'dialAMDActive':{'type':Sequelize[_0xaf8d('0x12')],'defaultValue':0x0,'comment':_0xaf8d('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xaf8d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf8d('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xaf8d('0x6')](0x9)[_0xaf8d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaf8d('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaf8d('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaf8d('0x6')](0x9)[_0xaf8d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf8d('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf8d('0x6')](0x9)[_0xaf8d('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaf8d('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf8d('0x6')](0x9)[_0xaf8d('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaf8d('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaf8d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf8d('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaf8d('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf8d('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaf8d('0x6')](0x9)[_0xaf8d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf8d('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xaf8d('0x1c')),'defaultValue':_0xaf8d('0x1d')},'dialPrefix':{'type':Sequelize[_0xaf8d('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xaf8d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf8d('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xaf8d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf8d('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xaf8d('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xaf8d('0x6')](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaf8d('0x6')](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaf8d('0x6')](0x3)[_0xaf8d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf8d('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf8d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf8d('0x29')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3f608ae..f4ab665 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 _0x391b=['CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','createdAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','push','removeLists','getBlackLists','addBlackLists','sequelize','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','params','Campaign','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','IvrCampaigns','error','getHoppers','findOne','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getLists'];(function(_0xa5c57b,_0x923064){var _0x47a747=function(_0x3b38c5){while(--_0x3b38c5){_0xa5c57b['push'](_0xa5c57b['shift']());}};_0x47a747(++_0x923064);}(_0x391b,0x141));var _0xb391=function(_0x3ebbd2,_0x18293c){_0x3ebbd2=_0x3ebbd2-0x0;var _0x5cc1ba=_0x391b[_0x3ebbd2];return _0x5cc1ba;};'use strict';var emlformat=require(_0xb391('0x0'));var rimraf=require(_0xb391('0x1'));var zipdir=require(_0xb391('0x2'));var jsonpatch=require(_0xb391('0x3'));var rp=require(_0xb391('0x4'));var moment=require(_0xb391('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb391('0x6'));var path=require(_0xb391('0x7'));var sox=require(_0xb391('0x8'));var csv=require(_0xb391('0x9'));var ejs=require(_0xb391('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb391('0xb'));var squel=require(_0xb391('0xc'));var crypto=require(_0xb391('0xd'));var jsforce=require(_0xb391('0xe'));var deskjs=require(_0xb391('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb391('0x10'));var Papa=require('papaparse');var Redis=require(_0xb391('0x11'));var authService=require(_0xb391('0x12'));var qs=require(_0xb391('0x13'));var as=require(_0xb391('0x14'));var hardwareService=require(_0xb391('0x15'));var logger=require(_0xb391('0x16'))(_0xb391('0x17'));var utils=require(_0xb391('0x18'));var config=require(_0xb391('0x19'));var licenseUtil=require(_0xb391('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e272d,_0x27442a){_0x27442a=_0x27442a||0xcc;return function(_0x265632){if(_0x265632){return _0x1e272d['sendStatus'](_0x27442a);}return _0x1e272d['status'](_0x27442a)[_0xb391('0x1b')]();};}function respondWithResult(_0x2c0be8,_0x2741b3){_0x2741b3=_0x2741b3||0xc8;return function(_0x262032){if(_0x262032){return _0x2c0be8[_0xb391('0x1c')](_0x2741b3)[_0xb391('0x1d')](_0x262032);}};}function respondWithFilteredResult(_0x3a1270,_0x159d1a){return function(_0x287d05){if(_0x287d05){var _0x4b39e8=typeof _0x159d1a['offset']===_0xb391('0x1e')&&typeof _0x159d1a[_0xb391('0x1f')]==='undefined';var _0x3f383b=_0x287d05[_0xb391('0x20')];var _0x4fb349=_0x4b39e8?0x0:_0x159d1a[_0xb391('0x21')];var _0x342bc3=_0x4b39e8?_0x287d05[_0xb391('0x20')]:_0x159d1a['offset']+_0x159d1a[_0xb391('0x1f')];var _0x4a0b7e;if(_0x342bc3>=_0x3f383b){_0x342bc3=_0x3f383b;_0x4a0b7e=0xc8;}else{_0x4a0b7e=0xce;}_0x3a1270['status'](_0x4a0b7e);return _0x3a1270[_0xb391('0x22')](_0xb391('0x23'),_0x4fb349+'-'+_0x342bc3+'/'+_0x3f383b)[_0xb391('0x1d')](_0x287d05);}return null;};}function patchUpdates(_0x917d36){return function(_0x511411){try{jsonpatch[_0xb391('0x24')](_0x511411,_0x917d36,!![]);}catch(_0x45a3f0){return BPromise[_0xb391('0x25')](_0x45a3f0);}return _0x511411[_0xb391('0x26')]();};}function saveUpdates(_0x1eff27,_0x2da8a6){return function(_0x2b9afa){if(_0x2b9afa){return _0x2b9afa[_0xb391('0x27')](_0x1eff27)[_0xb391('0x28')](function(_0x51a250){return _0x51a250;});}return null;};}function removeEntity(_0x2da40f,_0x521a98){return function(_0x5d0b6b){if(_0x5d0b6b){return _0x5d0b6b[_0xb391('0x29')]()[_0xb391('0x28')](function(){var _0x31b9f3=_0x5d0b6b[_0xb391('0x2a')]({'plain':!![]});var _0x33af39='IvrCampaigns';return db['UserProfileResource'][_0xb391('0x29')]({'where':{'type':_0x33af39,'resourceId':_0x31b9f3['id']}})[_0xb391('0x28')](function(){return _0x5d0b6b;});})['then'](function(){_0x2da40f[_0xb391('0x1c')](0xcc)[_0xb391('0x1b')]();});}};}function handleEntityNotFound(_0x493188,_0x5d131d){return function(_0x490c6a){if(!_0x490c6a){_0x493188[_0xb391('0x2b')](0x194);}return _0x490c6a;};}function handleError(_0x4067ed,_0x501652){_0x501652=_0x501652||0x1f4;return function(_0x1f42db){logger['error'](_0x1f42db[_0xb391('0x2c')]);if(_0x1f42db[_0xb391('0x2d')]){delete _0x1f42db[_0xb391('0x2d')];}_0x4067ed[_0xb391('0x1c')](_0x501652)[_0xb391('0x2e')](_0x1f42db);};}exports[_0xb391('0x2f')]=function(_0x1184c2,_0x497a9d){var _0x2ec122={},_0x5cd52e={},_0x4fb319={'count':0x0,'rows':[]};var _0x3e982f=_[_0xb391('0x30')](db['Campaign'][_0xb391('0x31')],function(_0x4e260c){return{'name':_0x4e260c[_0xb391('0x32')],'type':_0x4e260c[_0xb391('0x33')][_0xb391('0x34')]};});_0x5cd52e[_0xb391('0x35')]=_[_0xb391('0x30')](_0x3e982f,_0xb391('0x2d'));_0x5cd52e[_0xb391('0x36')]=_[_0xb391('0x37')](_0x1184c2[_0xb391('0x36')]);_0x5cd52e[_0xb391('0x38')]=_[_0xb391('0x39')](_0x5cd52e['model'],_0x5cd52e['query']);_0x2ec122[_0xb391('0x3a')]=_['intersection'](_0x5cd52e['model'],qs[_0xb391('0x3b')](_0x1184c2[_0xb391('0x36')][_0xb391('0x3b')]));_0x2ec122['attributes']=_0x2ec122[_0xb391('0x3a')]['length']?_0x2ec122[_0xb391('0x3a')]:_0x5cd52e[_0xb391('0x35')];if(!_0x1184c2['query'][_0xb391('0x3c')]('nolimit')){_0x2ec122['limit']=qs[_0xb391('0x1f')](_0x1184c2[_0xb391('0x36')][_0xb391('0x1f')]);_0x2ec122[_0xb391('0x21')]=qs[_0xb391('0x21')](_0x1184c2[_0xb391('0x36')][_0xb391('0x21')]);}_0x2ec122[_0xb391('0x3d')]=qs[_0xb391('0x3e')](_0x1184c2['query'][_0xb391('0x3e')]);_0x2ec122['where']=qs[_0xb391('0x38')](_[_0xb391('0x3f')](_0x1184c2[_0xb391('0x36')],_0x5cd52e[_0xb391('0x38')]),_0x3e982f);if(_0x1184c2[_0xb391('0x36')][_0xb391('0x40')]){_0x2ec122[_0xb391('0x41')]=_[_0xb391('0x42')](_0x2ec122['where'],{'$or':_[_0xb391('0x30')](_0x3e982f,function(_0xa94983){if(_0xa94983[_0xb391('0x33')]!==_0xb391('0x43')){var _0xbbd948={};_0xbbd948[_0xa94983[_0xb391('0x2d')]]={'$like':'%'+_0x1184c2[_0xb391('0x36')][_0xb391('0x40')]+'%'};return _0xbbd948;}})});}_0x2ec122=_[_0xb391('0x42')]({},_0x2ec122,_0x1184c2[_0xb391('0x44')]);var _0x38b0f3={'where':_0x2ec122[_0xb391('0x41')]};return db['Campaign'][_0xb391('0x20')](_0x38b0f3)[_0xb391('0x28')](function(_0x4b8948){_0x4fb319['count']=_0x4b8948;if(_0x1184c2[_0xb391('0x36')]['includeAll']){_0x2ec122[_0xb391('0x45')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x2ec122);})[_0xb391('0x28')](function(_0x16ce67){_0x4fb319[_0xb391('0x46')]=_0x16ce67;return _0x4fb319;})['then'](respondWithFilteredResult(_0x497a9d,_0x2ec122))[_0xb391('0x47')](handleError(_0x497a9d,null));};exports['show']=function(_0x107754,_0x4958cb){var _0x508ccb={'raw':![],'where':{'id':_0x107754[_0xb391('0x48')]['id']}},_0x81d881={};_0x81d881[_0xb391('0x35')]=_['keys'](db[_0xb391('0x49')]['rawAttributes']);_0x81d881[_0xb391('0x36')]=_[_0xb391('0x37')](_0x107754[_0xb391('0x36')]);_0x81d881[_0xb391('0x38')]=_[_0xb391('0x39')](_0x81d881['model'],_0x81d881[_0xb391('0x36')]);_0x508ccb['attributes']=_['intersection'](_0x81d881[_0xb391('0x35')],qs[_0xb391('0x3b')](_0x107754['query'][_0xb391('0x3b')]));_0x508ccb[_0xb391('0x3a')]=_0x508ccb[_0xb391('0x3a')][_0xb391('0x4a')]?_0x508ccb['attributes']:_0x81d881[_0xb391('0x35')];if(_0x107754[_0xb391('0x36')][_0xb391('0x4b')]){_0x508ccb['include']=[{'all':!![]}];}_0x508ccb=_[_0xb391('0x42')]({},_0x508ccb,_0x107754['options']);return db['Campaign'][_0xb391('0x4c')](_0x508ccb)[_0xb391('0x28')](handleEntityNotFound(_0x4958cb,null))[_0xb391('0x28')](respondWithResult(_0x4958cb,null))[_0xb391('0x47')](handleError(_0x4958cb,null));};exports[_0xb391('0x4d')]=function(_0x10b293,_0x1b3e96){return db[_0xb391('0x49')]['create'](_0x10b293[_0xb391('0x4e')],{})['then'](function(_0x377161){var _0x288bf7=_0x10b293[_0xb391('0x4f')][_0xb391('0x2a')]({'plain':!![]});if(!_0x288bf7)throw new Error(_0xb391('0x50'));if(_0x288bf7[_0xb391('0x51')]==='user'){var _0x4622e3=_0x377161[_0xb391('0x2a')]({'plain':!![]});var _0x43f2a1='IvrCampaigns';return db[_0xb391('0x52')][_0xb391('0x4c')]({'where':{'name':_0x43f2a1,'userProfileId':_0x288bf7[_0xb391('0x53')]},'raw':!![]})[_0xb391('0x28')](function(_0x5e0b18){if(_0x5e0b18&&_0x5e0b18[_0xb391('0x54')]===0x0){return db[_0xb391('0x55')]['create']({'name':_0x4622e3[_0xb391('0x2d')],'resourceId':_0x4622e3['id'],'type':_0x5e0b18[_0xb391('0x2d')],'sectionId':_0x5e0b18['id']},{})['then'](function(){return _0x377161;});}else{return _0x377161;}})[_0xb391('0x47')](function(_0x763657){logger['error'](_0xb391('0x56'),_0x763657);throw _0x763657;});}return _0x377161;})[_0xb391('0x28')](respondWithResult(_0x1b3e96,0xc9))['catch'](handleError(_0x1b3e96,null));};exports[_0xb391('0x57')]=function(_0x2a967a,_0x2349d5){var _0x432d3d={'where':{'id':_0x2a967a['params']['id']}},_0x280c9f={};_0x280c9f[_0xb391('0x35')]=_[_0xb391('0x37')](db[_0xb391('0x49')][_0xb391('0x31')]);_0x432d3d[_0xb391('0x3a')]=_[_0xb391('0x39')](_0x280c9f[_0xb391('0x35')],qs[_0xb391('0x3b')](_0x2a967a[_0xb391('0x36')]['fields']));_0x432d3d['attributes']=_0x432d3d[_0xb391('0x3a')][_0xb391('0x4a')]?_0x432d3d[_0xb391('0x3a')]:_0x280c9f['model'];if(_0x2a967a[_0xb391('0x36')][_0xb391('0x4b')]){_0x432d3d[_0xb391('0x45')]=[{'all':!![]}];}_0x432d3d=_['merge']({},_0x432d3d,_0x2a967a[_0xb391('0x44')]);return db[_0xb391('0x49')]['find'](_0x432d3d)[_0xb391('0x28')](handleEntityNotFound(_0x2349d5,null))[_0xb391('0x28')](function(_0x2a1f15){if(_0x2a1f15){var _0x5266e3=_0x2a1f15['get']({'plain':!![]});_0x5266e3=qs[_0xb391('0x58')](_0x5266e3,['id','createdAt',_0xb391('0x59')]);_0x2a967a[_0xb391('0x4e')]=_['omit'](_0x2a967a[_0xb391('0x4e')],['id','createdAt',_0xb391('0x59')]);return db['Campaign'][_0xb391('0x4d')](_['merge'](_0x5266e3,_0x2a967a['body']),{'include':_0x2a967a[_0xb391('0x36')][_0xb391('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x377732){var _0x443ec6=_0x2a967a[_0xb391('0x4f')]['get']({'plain':!![]});if(!_0x443ec6)throw new Error(_0xb391('0x50'));if(_0x443ec6[_0xb391('0x51')]===_0xb391('0x4f')){var _0x2379f7=_0x377732[_0xb391('0x2a')]({'plain':!![]});var _0x395adc=_0xb391('0x5a');return db['UserProfileSection']['find']({'where':{'name':_0x395adc,'userProfileId':_0x443ec6['userProfileId']},'raw':!![]})[_0xb391('0x28')](function(_0x4e3854){if(_0x4e3854&&_0x4e3854[_0xb391('0x54')]===0x0){return db[_0xb391('0x55')][_0xb391('0x4d')]({'name':_0x2379f7[_0xb391('0x2d')],'resourceId':_0x2379f7['id'],'type':_0x4e3854[_0xb391('0x2d')],'sectionId':_0x4e3854['id']},{})['then'](function(){return _0x377732;});}else{return _0x377732;}})['catch'](function(_0x30c53a){logger[_0xb391('0x5b')](_0xb391('0x56'),_0x30c53a);throw _0x30c53a;});}return _0x377732;});}})[_0xb391('0x28')](respondWithResult(_0x2349d5,0xc9))[_0xb391('0x47')](handleError(_0x2349d5,null));};exports[_0xb391('0x27')]=function(_0x397d76,_0x574e73){if(_0x397d76[_0xb391('0x4e')]['id']){delete _0x397d76[_0xb391('0x4e')]['id'];}return db['Campaign']['find']({'where':{'id':_0x397d76[_0xb391('0x48')]['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x574e73,null))['then'](saveUpdates(_0x397d76[_0xb391('0x4e')],null))['then'](respondWithResult(_0x574e73,null))[_0xb391('0x47')](handleError(_0x574e73,null));};exports[_0xb391('0x29')]=function(_0x41f397,_0x45608f){return db[_0xb391('0x49')][_0xb391('0x4c')]({'where':{'id':_0x41f397['params']['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x45608f,null))[_0xb391('0x28')](removeEntity(_0x45608f,null))[_0xb391('0x47')](handleError(_0x45608f,null));};exports[_0xb391('0x5c')]=function(_0x4c0643,_0x162e63,_0x931076){var _0x32ea4f={'raw':!![],'where':{}};var _0x57c59a={};var _0x489f41={'count':0x0,'rows':[]};return db['Campaign'][_0xb391('0x5d')]({'where':{'id':_0x4c0643['params']['id']}})['then'](handleEntityNotFound(_0x162e63,null))[_0xb391('0x28')](function(_0x30bc7f){if(_0x30bc7f){_0x57c59a['model']=_['keys'](db['CmHopper'][_0xb391('0x31')]);_0x57c59a[_0xb391('0x36')]=_[_0xb391('0x37')](_0x4c0643['query']);_0x57c59a[_0xb391('0x38')]=_[_0xb391('0x39')](_0x57c59a[_0xb391('0x35')],_0x57c59a[_0xb391('0x36')]);_0x32ea4f[_0xb391('0x3a')]=_[_0xb391('0x39')](_0x57c59a[_0xb391('0x35')],qs[_0xb391('0x3b')](_0x4c0643['query'][_0xb391('0x3b')]));_0x32ea4f['attributes']=_0x32ea4f[_0xb391('0x3a')][_0xb391('0x4a')]?_0x32ea4f[_0xb391('0x3a')]:_0x57c59a[_0xb391('0x35')];if(!_0x4c0643[_0xb391('0x36')][_0xb391('0x3c')]('nolimit')){_0x32ea4f['limit']=qs['limit'](_0x4c0643[_0xb391('0x36')][_0xb391('0x1f')]);_0x32ea4f[_0xb391('0x21')]=qs[_0xb391('0x21')](_0x4c0643[_0xb391('0x36')]['offset']);}_0x32ea4f[_0xb391('0x3d')]=qs[_0xb391('0x3e')](_0x4c0643[_0xb391('0x36')][_0xb391('0x3e')]);_0x32ea4f[_0xb391('0x41')]=qs[_0xb391('0x38')](_[_0xb391('0x3f')](_0x4c0643['query'],_0x57c59a[_0xb391('0x38')]));_0x32ea4f['where'][_0xb391('0x5e')]=_0x30bc7f['id'];if(_0x4c0643['query'][_0xb391('0x40')]){_0x32ea4f[_0xb391('0x41')]=_[_0xb391('0x42')](_0x32ea4f[_0xb391('0x41')],{'$or':_[_0xb391('0x30')](_0x32ea4f['attributes'],function(_0x11a78b){var _0x7994bb={};_0x7994bb[_0x11a78b]={'$like':'%'+_0x4c0643[_0xb391('0x36')][_0xb391('0x40')]+'%'};return _0x7994bb;})});}_0x32ea4f=_['merge']({},_0x32ea4f,_0x4c0643[_0xb391('0x44')]);return db[_0xb391('0x5f')][_0xb391('0x20')]({'where':_0x32ea4f['where']})[_0xb391('0x28')](function(_0x5a531e){_0x489f41[_0xb391('0x20')]=_0x5a531e;if(_0x4c0643[_0xb391('0x36')][_0xb391('0x4b')]){_0x32ea4f['include']=[{'all':!![]}];}return db[_0xb391('0x5f')][_0xb391('0x60')](_0x32ea4f);})[_0xb391('0x28')](function(_0x25795e){_0x489f41[_0xb391('0x46')]=_0x25795e;return _0x489f41;});}})[_0xb391('0x28')](respondWithFilteredResult(_0x162e63,_0x32ea4f))[_0xb391('0x47')](handleError(_0x162e63,null));};exports[_0xb391('0x61')]=function(_0x5ef90a,_0x50f133,_0xa88168){var _0x35a92b={'raw':!![],'where':{}};var _0x133a56={};var _0x2de2e2={'count':0x0,'rows':[]};return db[_0xb391('0x49')][_0xb391('0x5d')]({'where':{'id':_0x5ef90a[_0xb391('0x48')]['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x50f133,null))[_0xb391('0x28')](function(_0x223568){if(_0x223568){_0x133a56[_0xb391('0x35')]=_[_0xb391('0x37')](db[_0xb391('0x62')][_0xb391('0x31')]);_0x133a56['query']=_[_0xb391('0x37')](_0x5ef90a[_0xb391('0x36')]);_0x133a56[_0xb391('0x38')]=_[_0xb391('0x39')](_0x133a56[_0xb391('0x35')],_0x133a56[_0xb391('0x36')]);_0x35a92b['attributes']=_[_0xb391('0x39')](_0x133a56['model'],qs[_0xb391('0x3b')](_0x5ef90a[_0xb391('0x36')][_0xb391('0x3b')]));_0x35a92b[_0xb391('0x3a')]=_0x35a92b[_0xb391('0x3a')][_0xb391('0x4a')]?_0x35a92b['attributes']:_0x133a56[_0xb391('0x35')];if(!_0x5ef90a['query'][_0xb391('0x3c')]('nolimit')){_0x35a92b['limit']=qs[_0xb391('0x1f')](_0x5ef90a['query'][_0xb391('0x1f')]);_0x35a92b[_0xb391('0x21')]=qs[_0xb391('0x21')](_0x5ef90a[_0xb391('0x36')][_0xb391('0x21')]);}_0x35a92b['order']=qs[_0xb391('0x3e')](_0x5ef90a[_0xb391('0x36')][_0xb391('0x3e')]);_0x35a92b[_0xb391('0x41')]=qs['filters'](_[_0xb391('0x3f')](_0x5ef90a['query'],_0x133a56[_0xb391('0x38')]));_0x35a92b['where'][_0xb391('0x5e')]=_0x223568['id'];if(_0x5ef90a[_0xb391('0x36')]['filter']){_0x35a92b['where']=_['merge'](_0x35a92b['where'],{'$or':_[_0xb391('0x30')](_0x35a92b[_0xb391('0x3a')],function(_0x42d9ae){var _0x37448e={};_0x37448e[_0x42d9ae]={'$like':'%'+_0x5ef90a[_0xb391('0x36')][_0xb391('0x40')]+'%'};return _0x37448e;})});}_0x35a92b=_[_0xb391('0x42')]({},_0x35a92b,_0x5ef90a['options']);return db[_0xb391('0x62')][_0xb391('0x20')]({'where':_0x35a92b[_0xb391('0x41')]})[_0xb391('0x28')](function(_0x5d78e3){_0x2de2e2[_0xb391('0x20')]=_0x5d78e3;if(_0x5ef90a[_0xb391('0x36')]['includeAll']){_0x35a92b[_0xb391('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb391('0x60')](_0x35a92b);})['then'](function(_0x354d5a){_0x2de2e2[_0xb391('0x46')]=_0x354d5a;return _0x2de2e2;});}})[_0xb391('0x28')](respondWithFilteredResult(_0x50f133,_0x35a92b))[_0xb391('0x47')](handleError(_0x50f133,null));};exports[_0xb391('0x63')]=function(_0x548810,_0x6f967a,_0x35ae5a){var _0x358863={'raw':!![],'where':{}};var _0x558b7d={};var _0x2c8796={'count':0x0,'rows':[]};return db[_0xb391('0x49')][_0xb391('0x5d')]({'where':{'id':_0x548810[_0xb391('0x48')]['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x6f967a,null))[_0xb391('0x28')](function(_0x1c71a1){if(_0x1c71a1){_0x558b7d['model']=_[_0xb391('0x37')](db[_0xb391('0x64')][_0xb391('0x31')]);_0x558b7d[_0xb391('0x36')]=_['keys'](_0x548810[_0xb391('0x36')]);_0x558b7d[_0xb391('0x38')]=_['intersection'](_0x558b7d[_0xb391('0x35')],_0x558b7d[_0xb391('0x36')]);_0x358863[_0xb391('0x3a')]=_['intersection'](_0x558b7d[_0xb391('0x35')],qs[_0xb391('0x3b')](_0x548810['query'][_0xb391('0x3b')]));_0x358863[_0xb391('0x3a')]=_0x358863['attributes'][_0xb391('0x4a')]?_0x358863['attributes']:_0x558b7d['model'];if(!_0x548810[_0xb391('0x36')][_0xb391('0x3c')](_0xb391('0x65'))){_0x358863[_0xb391('0x1f')]=qs['limit'](_0x548810[_0xb391('0x36')][_0xb391('0x1f')]);_0x358863[_0xb391('0x21')]=qs['offset'](_0x548810[_0xb391('0x36')][_0xb391('0x21')]);}_0x358863[_0xb391('0x3d')]=qs['sort'](_0x548810[_0xb391('0x36')][_0xb391('0x3e')]);_0x358863[_0xb391('0x41')]=qs[_0xb391('0x38')](_[_0xb391('0x3f')](_0x548810[_0xb391('0x36')],_0x558b7d['filters']));_0x358863[_0xb391('0x41')]['CampaignId']=_0x1c71a1['id'];if(_0x548810[_0xb391('0x36')][_0xb391('0x40')]){_0x358863[_0xb391('0x41')]=_[_0xb391('0x42')](_0x358863[_0xb391('0x41')],{'$or':_[_0xb391('0x30')](_0x358863[_0xb391('0x3a')],function(_0x187126){var _0x5ba0ba={};_0x5ba0ba[_0x187126]={'$like':'%'+_0x548810['query'][_0xb391('0x40')]+'%'};return _0x5ba0ba;})});}_0x358863=_[_0xb391('0x42')]({},_0x358863,_0x548810['options']);return db[_0xb391('0x64')][_0xb391('0x20')]({'where':_0x358863[_0xb391('0x41')]})[_0xb391('0x28')](function(_0x581ecf){_0x2c8796['count']=_0x581ecf;if(_0x548810[_0xb391('0x36')]['includeAll']){_0x358863[_0xb391('0x45')]=[{'all':!![]}];}return db[_0xb391('0x64')][_0xb391('0x60')](_0x358863);})[_0xb391('0x28')](function(_0x34de20){_0x2c8796[_0xb391('0x46')]=_0x34de20;return _0x2c8796;});}})[_0xb391('0x28')](respondWithFilteredResult(_0x6f967a,_0x358863))['catch'](handleError(_0x6f967a,null));};exports[_0xb391('0x66')]=function(_0x41105e,_0x1085ee,_0x29e2f9){var _0x1557d6={'raw':!![],'where':{}};var _0x3cb41f={};var _0x54632f={'count':0x0,'rows':[]};return db[_0xb391('0x49')][_0xb391('0x5d')]({'where':{'id':_0x41105e['params']['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x1085ee,null))[_0xb391('0x28')](function(_0x42eda1){if(_0x42eda1){_0x3cb41f[_0xb391('0x35')]=_[_0xb391('0x37')](db[_0xb391('0x67')][_0xb391('0x31')]);_0x3cb41f[_0xb391('0x36')]=_[_0xb391('0x37')](_0x41105e[_0xb391('0x36')]);_0x3cb41f[_0xb391('0x38')]=_['intersection'](_0x3cb41f[_0xb391('0x35')],_0x3cb41f[_0xb391('0x36')]);_0x1557d6[_0xb391('0x3a')]=_[_0xb391('0x39')](_0x3cb41f[_0xb391('0x35')],qs[_0xb391('0x3b')](_0x41105e[_0xb391('0x36')]['fields']));_0x1557d6['attributes']=_0x1557d6['attributes']['length']?_0x1557d6[_0xb391('0x3a')]:_0x3cb41f['model'];if(!_0x41105e[_0xb391('0x36')]['hasOwnProperty']('nolimit')){_0x1557d6[_0xb391('0x1f')]=qs[_0xb391('0x1f')](_0x41105e[_0xb391('0x36')]['limit']);_0x1557d6[_0xb391('0x21')]=qs[_0xb391('0x21')](_0x41105e[_0xb391('0x36')][_0xb391('0x21')]);}_0x1557d6[_0xb391('0x3d')]=qs[_0xb391('0x3e')](_0x41105e['query'][_0xb391('0x3e')]);_0x1557d6[_0xb391('0x41')]=qs['filters'](_[_0xb391('0x3f')](_0x41105e[_0xb391('0x36')],_0x3cb41f[_0xb391('0x38')]));_0x1557d6[_0xb391('0x41')][_0xb391('0x5e')]=_0x42eda1['id'];if(_0x41105e['query'][_0xb391('0x40')]){_0x1557d6[_0xb391('0x41')]=_[_0xb391('0x42')](_0x1557d6['where'],{'$or':_[_0xb391('0x30')](_0x1557d6['attributes'],function(_0x1313fa){var _0x1f5312={};_0x1f5312[_0x1313fa]={'$like':'%'+_0x41105e[_0xb391('0x36')][_0xb391('0x40')]+'%'};return _0x1f5312;})});}_0x1557d6=_['merge']({},_0x1557d6,_0x41105e[_0xb391('0x44')]);return db[_0xb391('0x67')][_0xb391('0x20')]({'where':_0x1557d6[_0xb391('0x41')]})['then'](function(_0x4a8dc3){_0x54632f[_0xb391('0x20')]=_0x4a8dc3;if(_0x41105e[_0xb391('0x36')][_0xb391('0x4b')]){_0x1557d6['include']=[{'all':!![]}];}return db[_0xb391('0x67')][_0xb391('0x60')](_0x1557d6);})[_0xb391('0x28')](function(_0x10b118){_0x54632f[_0xb391('0x46')]=_0x10b118;return _0x54632f;});}})['then'](respondWithFilteredResult(_0x1085ee,_0x1557d6))[_0xb391('0x47')](handleError(_0x1085ee,null));};exports[_0xb391('0x68')]=function(_0x456791,_0x57fb68,_0x53abcf){var _0x597de6={};var _0x3b1251={};var _0x2cc4c8;var _0x2e3671;return db[_0xb391('0x49')][_0xb391('0x5d')]({'where':{'id':_0x456791[_0xb391('0x48')]['id']}})['then'](handleEntityNotFound(_0x57fb68,null))[_0xb391('0x28')](function(_0x21988e){if(_0x21988e){_0x2cc4c8=_0x21988e;_0x3b1251[_0xb391('0x35')]=_[_0xb391('0x37')](db[_0xb391('0x69')][_0xb391('0x31')]);_0x3b1251['query']=_['keys'](_0x456791[_0xb391('0x36')]);_0x3b1251['filters']=_[_0xb391('0x39')](_0x3b1251[_0xb391('0x35')],_0x3b1251['query']);_0x597de6[_0xb391('0x3a')]=_[_0xb391('0x39')](_0x3b1251[_0xb391('0x35')],qs[_0xb391('0x3b')](_0x456791['query']['fields']));_0x597de6[_0xb391('0x3a')]=_0x597de6[_0xb391('0x3a')][_0xb391('0x4a')]?_0x597de6['attributes']:_0x3b1251[_0xb391('0x35')];_0x597de6[_0xb391('0x3d')]=qs[_0xb391('0x3e')](_0x456791[_0xb391('0x36')][_0xb391('0x3e')]);_0x597de6[_0xb391('0x41')]=qs['filters'](_['pick'](_0x456791[_0xb391('0x36')],_0x3b1251[_0xb391('0x38')]));if(_0x456791[_0xb391('0x36')]['filter']){_0x597de6['where']=_['merge'](_0x597de6[_0xb391('0x41')],{'$or':_[_0xb391('0x30')](_0x597de6['attributes'],function(_0xf7402d){var _0x260c8e={};_0x260c8e[_0xf7402d]={'$like':'%'+_0x456791[_0xb391('0x36')]['filter']+'%'};return _0x260c8e;})});}_0x597de6=_[_0xb391('0x42')]({},_0x597de6,_0x456791[_0xb391('0x44')]);return _0x2cc4c8[_0xb391('0x68')](_0x597de6);}})['then'](function(_0x1e3182){if(_0x1e3182){_0x2e3671=_0x1e3182[_0xb391('0x4a')];if(!_0x456791[_0xb391('0x36')]['hasOwnProperty'](_0xb391('0x65'))){_0x597de6[_0xb391('0x1f')]=qs[_0xb391('0x1f')](_0x456791['query'][_0xb391('0x1f')]);_0x597de6[_0xb391('0x21')]=qs[_0xb391('0x21')](_0x456791[_0xb391('0x36')][_0xb391('0x21')]);}return _0x2cc4c8[_0xb391('0x68')](_0x597de6);}})[_0xb391('0x28')](function(_0x42a5df){if(_0x42a5df){return _0x42a5df?{'count':_0x2e3671,'rows':_0x42a5df}:null;}})[_0xb391('0x28')](respondWithResult(_0x57fb68,null))[_0xb391('0x47')](handleError(_0x57fb68,null));};exports['addLists']=function(_0x4da6f1,_0x484659,_0x43f5a0){var _0x1bdbd4,_0x18d9d7;return db[_0xb391('0x49')][_0xb391('0x4c')]({'where':{'id':_0x4da6f1[_0xb391('0x48')]['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x484659,null))[_0xb391('0x28')](function(_0x346758){if(_0x346758){_0x18d9d7=_0x346758;return _0x346758[_0xb391('0x6a')](_0x4da6f1[_0xb391('0x4e')]['ids'],_['omit'](_0x4da6f1['body'],[_0xb391('0x6b'),'id'])||{});}return null;})[_0xb391('0x6c')](function(_0x401422){var _0x4490b5;_0x1bdbd4=_0x401422||[];var _0x45db48=[];if(_0x401422){for(var _0x1579d3=0x0;_0x1579d3<_0x401422[_0xb391('0x4a')];_0x1579d3+=0x1){var _0x4d3f8d=_0x401422[_0x1579d3][_0xb391('0x2a')]({'plain':!![]});_0x18d9d7[_0xb391('0x6d')]=_0x4da6f1[_0xb391('0x4e')][_0xb391('0x6d')]?_0x4da6f1[_0xb391('0x4e')]['dialCheckDuplicateType']:_0x18d9d7[_0xb391('0x6d')];switch(_0x18d9d7[_0xb391('0x6d')]){case _0xb391('0x6e'):_0x4490b5=squel[_0xb391('0x6f')]()[_0xb391('0x70')](_0xb391('0x71'))[_0xb391('0x72')]([_0xb391('0x73'),_0xb391('0x74'),_0xb391('0x75'),_0xb391('0x76'),_0xb391('0x5e'),'createdAt',_0xb391('0x59')],squel[_0xb391('0x77')]()[_0xb391('0x78')](_0xb391('0x73'),'phone')[_0xb391('0x78')](_0xb391('0x79'),_0xb391('0x74'))[_0xb391('0x78')]('id','ContactId')[_0xb391('0x78')](_0x4d3f8d[_0xb391('0x7a')][_0xb391('0x7b')](),_0xb391('0x76'))['field'](_0x4da6f1['params']['id']['toString'](),'CampaignId')[_0xb391('0x78')](_0xb391('0x79'),_0xb391('0x7c'))[_0xb391('0x78')](_0xb391('0x79'),_0xb391('0x59'))[_0xb391('0x7d')](_0xb391('0x7e'))[_0xb391('0x41')](_0xb391('0x7f'))[_0xb391('0x41')](_0xb391('0x80'),_0x4d3f8d[_0xb391('0x7a')]['toString']())[_0xb391('0x41')](_0xb391('0x81'))[_0xb391('0x41')](_0xb391('0x82'),squel[_0xb391('0x77')]()[_0xb391('0x78')](_0xb391('0x83'))['from']('cm_hopper_final')[_0xb391('0x41')]('CampaignId\x20=\x20?',_0x4da6f1[_0xb391('0x48')]['id'][_0xb391('0x7b')]()))[_0xb391('0x41')](_0xb391('0x82'),squel[_0xb391('0x77')]()[_0xb391('0x78')](_0xb391('0x84'))[_0xb391('0x7d')](_0xb391('0x71'))[_0xb391('0x41')](_0xb391('0x85'),_0x4da6f1[_0xb391('0x48')]['id']['toString']())))['toString']();break;case _0xb391('0x86'):_0x4490b5=squel['insert']()['into'](_0xb391('0x71'))[_0xb391('0x72')]([_0xb391('0x73'),_0xb391('0x74'),'ContactId',_0xb391('0x76'),_0xb391('0x5e'),_0xb391('0x7c'),_0xb391('0x59')],squel[_0xb391('0x77')]()['field'](_0xb391('0x73'),_0xb391('0x73'))[_0xb391('0x78')](_0xb391('0x79'),'scheduledAt')[_0xb391('0x78')]('id',_0xb391('0x75'))['field'](_0x4d3f8d[_0xb391('0x7a')][_0xb391('0x7b')](),_0xb391('0x76'))[_0xb391('0x78')](_0x4da6f1['params']['id'][_0xb391('0x7b')](),'CampaignId')['field'](_0xb391('0x79'),_0xb391('0x7c'))['field']('NOW()',_0xb391('0x59'))[_0xb391('0x7d')](_0xb391('0x7e'))[_0xb391('0x41')](_0xb391('0x7f'))[_0xb391('0x41')](_0xb391('0x80'),_0x4d3f8d['CmListId'][_0xb391('0x7b')]())[_0xb391('0x41')](_0xb391('0x81'))[_0xb391('0x41')](_0xb391('0x82'),squel[_0xb391('0x77')]()[_0xb391('0x78')](_0xb391('0x84'))[_0xb391('0x7d')](_0xb391('0x71'))[_0xb391('0x41')](_0xb391('0x85'),_0x4da6f1['params']['id']['toString']())))[_0xb391('0x7b')]();break;default:_0x4490b5=squel[_0xb391('0x6f')]()[_0xb391('0x70')](_0xb391('0x71'))[_0xb391('0x72')]([_0xb391('0x73'),_0xb391('0x74'),_0xb391('0x75'),_0xb391('0x76'),_0xb391('0x5e'),_0xb391('0x7c'),_0xb391('0x59')],squel[_0xb391('0x77')]()['field'](_0xb391('0x73'),_0xb391('0x73'))['field']('NOW()',_0xb391('0x74'))[_0xb391('0x78')]('id',_0xb391('0x75'))[_0xb391('0x78')](_0x4d3f8d[_0xb391('0x7a')][_0xb391('0x7b')](),_0xb391('0x76'))['field'](_0x4da6f1[_0xb391('0x48')]['id'][_0xb391('0x7b')](),_0xb391('0x5e'))['field'](_0xb391('0x79'),_0xb391('0x7c'))['field']('NOW()',_0xb391('0x59'))['from'](_0xb391('0x7e'))['where']('deletedAt\x20IS\x20NULL')[_0xb391('0x41')]('ListId\x20=\x20?',_0x4d3f8d[_0xb391('0x7a')][_0xb391('0x7b')]())[_0xb391('0x41')](_0xb391('0x81')))['toString']();}_0x45db48[_0xb391('0x87')](db['sequelize']['query'](_0x4490b5));}return BPromise['all'](_0x45db48);}})[_0xb391('0x28')](function(){return _0x1bdbd4;})['then'](respondWithResult(_0x484659,null))[_0xb391('0x47')](handleError(_0x484659,null));};exports[_0xb391('0x88')]=function(_0x2bd43f,_0x1b19cf,_0x5640f9){return db['Campaign']['find']({'where':{'id':_0x2bd43f[_0xb391('0x48')]['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x1b19cf,null))[_0xb391('0x28')](function(_0x3b3ee8){if(_0x3b3ee8){return _0x3b3ee8[_0xb391('0x88')](_0x2bd43f[_0xb391('0x36')]['ids']);}})[_0xb391('0x28')](function(_0x48fae2){if(_0x48fae2){return db[_0xb391('0x5f')][_0xb391('0x29')]({'where':{'ListId':_0x2bd43f['query'][_0xb391('0x6b')],'CampaignId':_0x2bd43f[_0xb391('0x48')]['id']}})[_0xb391('0x28')](function(){return _0x48fae2;});}})[_0xb391('0x28')](respondWithStatusCode(_0x1b19cf,null))['catch'](handleError(_0x1b19cf,null));};exports['getBlackLists']=function(_0x4c27e5,_0x2364c3,_0x1ae725){var _0x1120d9={};var _0x472387={};var _0x19e634;var _0x27532c;return db[_0xb391('0x49')][_0xb391('0x5d')]({'where':{'id':_0x4c27e5[_0xb391('0x48')]['id']}})['then'](handleEntityNotFound(_0x2364c3,null))[_0xb391('0x28')](function(_0x22b5b7){if(_0x22b5b7){_0x19e634=_0x22b5b7;_0x472387[_0xb391('0x35')]=_[_0xb391('0x37')](db[_0xb391('0x69')][_0xb391('0x31')]);_0x472387['query']=_[_0xb391('0x37')](_0x4c27e5[_0xb391('0x36')]);_0x472387['filters']=_[_0xb391('0x39')](_0x472387[_0xb391('0x35')],_0x472387['query']);_0x1120d9[_0xb391('0x3a')]=_['intersection'](_0x472387[_0xb391('0x35')],qs['fields'](_0x4c27e5[_0xb391('0x36')][_0xb391('0x3b')]));_0x1120d9['attributes']=_0x1120d9[_0xb391('0x3a')]['length']?_0x1120d9[_0xb391('0x3a')]:_0x472387[_0xb391('0x35')];_0x1120d9[_0xb391('0x3d')]=qs[_0xb391('0x3e')](_0x4c27e5['query'][_0xb391('0x3e')]);_0x1120d9[_0xb391('0x41')]=qs[_0xb391('0x38')](_[_0xb391('0x3f')](_0x4c27e5[_0xb391('0x36')],_0x472387['filters']));if(_0x4c27e5['query'][_0xb391('0x40')]){_0x1120d9[_0xb391('0x41')]=_[_0xb391('0x42')](_0x1120d9[_0xb391('0x41')],{'$or':_[_0xb391('0x30')](_0x1120d9[_0xb391('0x3a')],function(_0x6c2b4f){var _0x1997c9={};_0x1997c9[_0x6c2b4f]={'$like':'%'+_0x4c27e5[_0xb391('0x36')]['filter']+'%'};return _0x1997c9;})});}_0x1120d9=_['merge']({},_0x1120d9,_0x4c27e5[_0xb391('0x44')]);return _0x19e634[_0xb391('0x89')](_0x1120d9);}})['then'](function(_0x18fdda){if(_0x18fdda){_0x27532c=_0x18fdda['length'];if(!_0x4c27e5[_0xb391('0x36')]['hasOwnProperty']('nolimit')){_0x1120d9[_0xb391('0x1f')]=qs[_0xb391('0x1f')](_0x4c27e5['query'][_0xb391('0x1f')]);_0x1120d9['offset']=qs[_0xb391('0x21')](_0x4c27e5[_0xb391('0x36')][_0xb391('0x21')]);}return _0x19e634[_0xb391('0x89')](_0x1120d9);}})[_0xb391('0x28')](function(_0x354fe2){if(_0x354fe2){return _0x354fe2?{'count':_0x27532c,'rows':_0x354fe2}:null;}})[_0xb391('0x28')](respondWithResult(_0x2364c3,null))[_0xb391('0x47')](handleError(_0x2364c3,null));};exports[_0xb391('0x8a')]=function(_0x1922c5,_0x2e2b8,_0x1f18f1){var _0x563096,_0x9cb50d;return db[_0xb391('0x49')][_0xb391('0x4c')]({'where':{'id':_0x1922c5[_0xb391('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e2b8,null))[_0xb391('0x28')](function(_0x4bffde){if(_0x4bffde){_0x9cb50d=_0x4bffde;return _0x4bffde['addBlackLists'](_0x1922c5[_0xb391('0x4e')][_0xb391('0x6b')],_[_0xb391('0x58')](_0x1922c5[_0xb391('0x4e')],[_0xb391('0x6b'),'id'])||{});}return null;})[_0xb391('0x6c')](function(_0x20c8b1){var _0x446fe2;_0x563096=_0x20c8b1||[];var _0x2daa99=[];if(_0x20c8b1){for(var _0xc94910=0x0;_0xc94910<_0x20c8b1[_0xb391('0x4a')];_0xc94910+=0x1){var _0x3d5979=_0x20c8b1[_0xc94910]['get']({'plain':!![]});_0x446fe2=squel['insert']()[_0xb391('0x70')]('cm_hopper_black')['fromQuery']([_0xb391('0x73'),'ContactId','ListId',_0xb391('0x5e'),_0xb391('0x7c'),'updatedAt'],squel['select']()[_0xb391('0x78')]('phone',_0xb391('0x73'))[_0xb391('0x78')]('id','ContactId')[_0xb391('0x78')](_0x3d5979[_0xb391('0x7a')][_0xb391('0x7b')](),'ListId')[_0xb391('0x78')](_0x1922c5[_0xb391('0x48')]['id'][_0xb391('0x7b')](),_0xb391('0x5e'))[_0xb391('0x78')]('NOW()','createdAt')[_0xb391('0x78')]('NOW()',_0xb391('0x59'))['from'](_0xb391('0x7e'))[_0xb391('0x41')](_0xb391('0x7f'))[_0xb391('0x41')]('ListId\x20=\x20?',_0x3d5979[_0xb391('0x7a')]['toString']())[_0xb391('0x41')](_0xb391('0x81')))[_0xb391('0x7b')]();_0x2daa99[_0xb391('0x87')](db[_0xb391('0x8b')][_0xb391('0x36')](_0x446fe2));}return BPromise[_0xb391('0x8c')](_0x2daa99);}})[_0xb391('0x28')](function(){return _0x563096;})[_0xb391('0x28')](respondWithResult(_0x2e2b8,null))[_0xb391('0x47')](handleError(_0x2e2b8,null));};exports[_0xb391('0x8d')]=function(_0x317bad,_0x46eddc,_0x512105){return db[_0xb391('0x49')]['find']({'where':{'id':_0x317bad[_0xb391('0x48')]['id']}})[_0xb391('0x28')](handleEntityNotFound(_0x46eddc,null))[_0xb391('0x28')](function(_0x175106){if(_0x175106){return _0x175106['removeBlackLists'](_0x317bad[_0xb391('0x36')][_0xb391('0x6b')]);}})[_0xb391('0x28')](function(_0x555fef){if(_0x555fef){return db['CmHopperBlack'][_0xb391('0x29')]({'where':{'ListId':_0x317bad[_0xb391('0x36')]['ids'],'CampaignId':_0x317bad['params']['id']}})[_0xb391('0x28')](function(){return _0x555fef;});}})['then'](respondWithStatusCode(_0x46eddc,null))[_0xb391('0x47')](handleError(_0x46eddc,null));}; \ No newline at end of file +var _0xc792=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','insert','all','removeLists','ids','getBlackLists','addBlackLists','spread','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../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','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','send','index','map','Campaign','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','UserProfileResource','getHoppers','CmHopper','getHopperHistories','findOne','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc792,0x123));var _0x2c79=function(_0x25d312,_0xcf3ea1){_0x25d312=_0x25d312-0x0;var _0x5a2879=_0xc792[_0x25d312];return _0x5a2879;};'use strict';var emlformat=require(_0x2c79('0x0'));var rimraf=require(_0x2c79('0x1'));var zipdir=require(_0x2c79('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c79('0x3'));var moment=require(_0x2c79('0x4'));var BPromise=require(_0x2c79('0x5'));var Mustache=require('mustache');var util=require(_0x2c79('0x6'));var path=require(_0x2c79('0x7'));var sox=require('sox');var csv=require(_0x2c79('0x8'));var ejs=require(_0x2c79('0x9'));var fs=require('fs');var fs_extra=require(_0x2c79('0xa'));var _=require(_0x2c79('0xb'));var squel=require(_0x2c79('0xc'));var crypto=require('crypto');var jsforce=require(_0x2c79('0xd'));var deskjs=require(_0x2c79('0xe'));var toCsv=require(_0x2c79('0x8'));var querystring=require('querystring');var Papa=require(_0x2c79('0xf'));var Redis=require(_0x2c79('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2c79('0x11'));var as=require(_0x2c79('0x12'));var hardwareService=require(_0x2c79('0x13'));var logger=require(_0x2c79('0x14'))(_0x2c79('0x15'));var utils=require(_0x2c79('0x16'));var config=require(_0x2c79('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c79('0x18'))['db'];function respondWithStatusCode(_0x28a261,_0x4e5aea){_0x4e5aea=_0x4e5aea||0xcc;return function(_0x33346c){if(_0x33346c){return _0x28a261[_0x2c79('0x19')](_0x4e5aea);}return _0x28a261[_0x2c79('0x1a')](_0x4e5aea)[_0x2c79('0x1b')]();};}function respondWithResult(_0x43795d,_0x4b9c6f){_0x4b9c6f=_0x4b9c6f||0xc8;return function(_0x393ed9){if(_0x393ed9){return _0x43795d[_0x2c79('0x1a')](_0x4b9c6f)[_0x2c79('0x1c')](_0x393ed9);}};}function respondWithFilteredResult(_0x734994,_0x289010){return function(_0x5e8512){if(_0x5e8512){var _0x150060=typeof _0x289010[_0x2c79('0x1d')]===_0x2c79('0x1e')&&typeof _0x289010[_0x2c79('0x1f')]===_0x2c79('0x1e');var _0x3e1a2b=_0x5e8512[_0x2c79('0x20')];var _0x406c2a=_0x150060?0x0:_0x289010[_0x2c79('0x1d')];var _0x1cdddd=_0x150060?_0x5e8512[_0x2c79('0x20')]:_0x289010[_0x2c79('0x1d')]+_0x289010[_0x2c79('0x1f')];var _0x110fd2;if(_0x1cdddd>=_0x3e1a2b){_0x1cdddd=_0x3e1a2b;_0x110fd2=0xc8;}else{_0x110fd2=0xce;}_0x734994['status'](_0x110fd2);return _0x734994[_0x2c79('0x21')](_0x2c79('0x22'),_0x406c2a+'-'+_0x1cdddd+'/'+_0x3e1a2b)[_0x2c79('0x1c')](_0x5e8512);}return null;};}function patchUpdates(_0x58b2cf){return function(_0x1eb830){try{jsonpatch['apply'](_0x1eb830,_0x58b2cf,!![]);}catch(_0x595fa2){return BPromise[_0x2c79('0x23')](_0x595fa2);}return _0x1eb830[_0x2c79('0x24')]();};}function saveUpdates(_0x9768ed,_0x50ed5b){return function(_0x15e83e){if(_0x15e83e){return _0x15e83e[_0x2c79('0x25')](_0x9768ed)[_0x2c79('0x26')](function(_0x48eb70){return _0x48eb70;});}return null;};}function removeEntity(_0x4190ee,_0x1c9ea4){return function(_0x54f004){if(_0x54f004){return _0x54f004[_0x2c79('0x27')]()[_0x2c79('0x26')](function(){var _0x32b602=_0x54f004[_0x2c79('0x28')]({'plain':!![]});var _0x9b2229=_0x2c79('0x29');return db['UserProfileResource'][_0x2c79('0x27')]({'where':{'type':_0x9b2229,'resourceId':_0x32b602['id']}})[_0x2c79('0x26')](function(){return _0x54f004;});})[_0x2c79('0x26')](function(){_0x4190ee[_0x2c79('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38db9b,_0x5a7bb6){return function(_0x4a7dcb){if(!_0x4a7dcb){_0x38db9b['sendStatus'](0x194);}return _0x4a7dcb;};}function handleError(_0x5f18d4,_0x5ed121){_0x5ed121=_0x5ed121||0x1f4;return function(_0xdc830e){logger[_0x2c79('0x2a')](_0xdc830e[_0x2c79('0x2b')]);if(_0xdc830e['name']){delete _0xdc830e['name'];}_0x5f18d4[_0x2c79('0x1a')](_0x5ed121)[_0x2c79('0x2c')](_0xdc830e);};}exports[_0x2c79('0x2d')]=function(_0x55a6c1,_0x43743a){var _0x2336d9={},_0x348a3e={},_0x514337={'count':0x0,'rows':[]};var _0x4e5c08=_[_0x2c79('0x2e')](db[_0x2c79('0x2f')]['rawAttributes'],function(_0x3e3496){return{'name':_0x3e3496[_0x2c79('0x30')],'type':_0x3e3496[_0x2c79('0x31')][_0x2c79('0x32')]};});_0x348a3e[_0x2c79('0x33')]=_[_0x2c79('0x2e')](_0x4e5c08,_0x2c79('0x34'));_0x348a3e[_0x2c79('0x35')]=_['keys'](_0x55a6c1[_0x2c79('0x35')]);_0x348a3e[_0x2c79('0x36')]=_[_0x2c79('0x37')](_0x348a3e[_0x2c79('0x33')],_0x348a3e['query']);_0x2336d9[_0x2c79('0x38')]=_[_0x2c79('0x37')](_0x348a3e['model'],qs[_0x2c79('0x39')](_0x55a6c1[_0x2c79('0x35')]['fields']));_0x2336d9['attributes']=_0x2336d9[_0x2c79('0x38')][_0x2c79('0x3a')]?_0x2336d9[_0x2c79('0x38')]:_0x348a3e[_0x2c79('0x33')];if(!_0x55a6c1['query'][_0x2c79('0x3b')](_0x2c79('0x3c'))){_0x2336d9['limit']=qs['limit'](_0x55a6c1[_0x2c79('0x35')]['limit']);_0x2336d9[_0x2c79('0x1d')]=qs[_0x2c79('0x1d')](_0x55a6c1['query'][_0x2c79('0x1d')]);}_0x2336d9[_0x2c79('0x3d')]=qs[_0x2c79('0x3e')](_0x55a6c1['query'][_0x2c79('0x3e')]);_0x2336d9[_0x2c79('0x3f')]=qs[_0x2c79('0x36')](_[_0x2c79('0x40')](_0x55a6c1[_0x2c79('0x35')],_0x348a3e[_0x2c79('0x36')]),_0x4e5c08);if(_0x55a6c1[_0x2c79('0x35')][_0x2c79('0x41')]){_0x2336d9[_0x2c79('0x3f')]=_['merge'](_0x2336d9[_0x2c79('0x3f')],{'$or':_['map'](_0x4e5c08,function(_0x36fc4d){if(_0x36fc4d[_0x2c79('0x31')]!==_0x2c79('0x42')){var _0x100c09={};_0x100c09[_0x36fc4d[_0x2c79('0x34')]]={'$like':'%'+_0x55a6c1['query'][_0x2c79('0x41')]+'%'};return _0x100c09;}})});}_0x2336d9=_[_0x2c79('0x43')]({},_0x2336d9,_0x55a6c1['options']);var _0x4fe7d1={'where':_0x2336d9['where']};return db['Campaign'][_0x2c79('0x20')](_0x4fe7d1)[_0x2c79('0x26')](function(_0x2d22f7){_0x514337[_0x2c79('0x20')]=_0x2d22f7;if(_0x55a6c1[_0x2c79('0x35')]['includeAll']){_0x2336d9[_0x2c79('0x44')]=[{'all':!![]}];}return db[_0x2c79('0x2f')][_0x2c79('0x45')](_0x2336d9);})['then'](function(_0xb446e8){_0x514337[_0x2c79('0x46')]=_0xb446e8;return _0x514337;})[_0x2c79('0x26')](respondWithFilteredResult(_0x43743a,_0x2336d9))[_0x2c79('0x47')](handleError(_0x43743a,null));};exports[_0x2c79('0x48')]=function(_0x323cdd,_0x5a3389){var _0xf7f290={'raw':![],'where':{'id':_0x323cdd['params']['id']}},_0x3e8dfa={};_0x3e8dfa[_0x2c79('0x33')]=_[_0x2c79('0x49')](db[_0x2c79('0x2f')][_0x2c79('0x4a')]);_0x3e8dfa[_0x2c79('0x35')]=_[_0x2c79('0x49')](_0x323cdd[_0x2c79('0x35')]);_0x3e8dfa[_0x2c79('0x36')]=_[_0x2c79('0x37')](_0x3e8dfa['model'],_0x3e8dfa[_0x2c79('0x35')]);_0xf7f290['attributes']=_[_0x2c79('0x37')](_0x3e8dfa[_0x2c79('0x33')],qs[_0x2c79('0x39')](_0x323cdd[_0x2c79('0x35')]['fields']));_0xf7f290['attributes']=_0xf7f290['attributes'][_0x2c79('0x3a')]?_0xf7f290['attributes']:_0x3e8dfa[_0x2c79('0x33')];if(_0x323cdd[_0x2c79('0x35')][_0x2c79('0x4b')]){_0xf7f290[_0x2c79('0x44')]=[{'all':!![]}];}_0xf7f290=_[_0x2c79('0x43')]({},_0xf7f290,_0x323cdd[_0x2c79('0x4c')]);return db['Campaign']['find'](_0xf7f290)[_0x2c79('0x26')](handleEntityNotFound(_0x5a3389,null))['then'](respondWithResult(_0x5a3389,null))[_0x2c79('0x47')](handleError(_0x5a3389,null));};exports[_0x2c79('0x4d')]=function(_0x42caa7,_0x5e347c){return db[_0x2c79('0x2f')]['create'](_0x42caa7[_0x2c79('0x4e')],{})[_0x2c79('0x26')](function(_0x1a4123){var _0x1411ad=_0x42caa7[_0x2c79('0x4f')][_0x2c79('0x28')]({'plain':!![]});if(!_0x1411ad)throw new Error(_0x2c79('0x50'));if(_0x1411ad[_0x2c79('0x51')]==='user'){var _0x57844b=_0x1a4123[_0x2c79('0x28')]({'plain':!![]});var _0x2819be=_0x2c79('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x2819be,'userProfileId':_0x1411ad[_0x2c79('0x52')]},'raw':!![]})[_0x2c79('0x26')](function(_0x59250d){if(_0x59250d&&_0x59250d['autoAssociation']===0x0){return db['UserProfileResource'][_0x2c79('0x4d')]({'name':_0x57844b[_0x2c79('0x34')],'resourceId':_0x57844b['id'],'type':_0x59250d[_0x2c79('0x34')],'sectionId':_0x59250d['id']},{})[_0x2c79('0x26')](function(){return _0x1a4123;});}else{return _0x1a4123;}})[_0x2c79('0x47')](function(_0x11f29e){logger[_0x2c79('0x2a')](_0x2c79('0x53'),_0x11f29e);throw _0x11f29e;});}return _0x1a4123;})[_0x2c79('0x26')](respondWithResult(_0x5e347c,0xc9))[_0x2c79('0x47')](handleError(_0x5e347c,null));};exports['clone']=function(_0x314d09,_0x282a55){var _0x110901={'where':{'id':_0x314d09[_0x2c79('0x54')]['id']}},_0x8547b0={};_0x8547b0[_0x2c79('0x33')]=_['keys'](db['Campaign']['rawAttributes']);_0x110901[_0x2c79('0x38')]=_[_0x2c79('0x37')](_0x8547b0[_0x2c79('0x33')],qs[_0x2c79('0x39')](_0x314d09['query']['fields']));_0x110901[_0x2c79('0x38')]=_0x110901[_0x2c79('0x38')]['length']?_0x110901[_0x2c79('0x38')]:_0x8547b0[_0x2c79('0x33')];if(_0x314d09[_0x2c79('0x35')]['includeAll']){_0x110901[_0x2c79('0x44')]=[{'all':!![]}];}_0x110901=_[_0x2c79('0x43')]({},_0x110901,_0x314d09[_0x2c79('0x4c')]);return db[_0x2c79('0x2f')][_0x2c79('0x55')](_0x110901)['then'](handleEntityNotFound(_0x282a55,null))[_0x2c79('0x26')](function(_0x42737d){if(_0x42737d){var _0x4143e2=_0x42737d[_0x2c79('0x28')]({'plain':!![]});_0x4143e2=qs[_0x2c79('0x56')](_0x4143e2,['id',_0x2c79('0x57'),_0x2c79('0x58')]);_0x314d09['body']=_[_0x2c79('0x56')](_0x314d09[_0x2c79('0x4e')],['id',_0x2c79('0x57'),_0x2c79('0x58')]);return db['Campaign'][_0x2c79('0x4d')](_['merge'](_0x4143e2,_0x314d09[_0x2c79('0x4e')]),{'include':_0x314d09[_0x2c79('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x2c79('0x26')](function(_0x44ad57){var _0x500ab4=_0x314d09[_0x2c79('0x4f')][_0x2c79('0x28')]({'plain':!![]});if(!_0x500ab4)throw new Error(_0x2c79('0x50'));if(_0x500ab4[_0x2c79('0x51')]==='user'){var _0x487cef=_0x44ad57[_0x2c79('0x28')]({'plain':!![]});var _0x317fd3='IvrCampaigns';return db[_0x2c79('0x59')]['find']({'where':{'name':_0x317fd3,'userProfileId':_0x500ab4[_0x2c79('0x52')]},'raw':!![]})['then'](function(_0x6e316){if(_0x6e316&&_0x6e316[_0x2c79('0x5a')]===0x0){return db[_0x2c79('0x5b')][_0x2c79('0x4d')]({'name':_0x487cef[_0x2c79('0x34')],'resourceId':_0x487cef['id'],'type':_0x6e316[_0x2c79('0x34')],'sectionId':_0x6e316['id']},{})[_0x2c79('0x26')](function(){return _0x44ad57;});}else{return _0x44ad57;}})[_0x2c79('0x47')](function(_0x5abba0){logger[_0x2c79('0x2a')](_0x2c79('0x53'),_0x5abba0);throw _0x5abba0;});}return _0x44ad57;});}})['then'](respondWithResult(_0x282a55,0xc9))['catch'](handleError(_0x282a55,null));};exports[_0x2c79('0x25')]=function(_0x229e40,_0x1bbfcf){if(_0x229e40[_0x2c79('0x4e')]['id']){delete _0x229e40[_0x2c79('0x4e')]['id'];}return db['Campaign']['find']({'where':{'id':_0x229e40['params']['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x1bbfcf,null))[_0x2c79('0x26')](saveUpdates(_0x229e40[_0x2c79('0x4e')],null))[_0x2c79('0x26')](respondWithResult(_0x1bbfcf,null))['catch'](handleError(_0x1bbfcf,null));};exports[_0x2c79('0x27')]=function(_0x3426d2,_0x2da896){return db[_0x2c79('0x2f')][_0x2c79('0x55')]({'where':{'id':_0x3426d2[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x2da896,null))[_0x2c79('0x26')](removeEntity(_0x2da896,null))[_0x2c79('0x47')](handleError(_0x2da896,null));};exports[_0x2c79('0x5c')]=function(_0x4c586a,_0x3a7040,_0x1c2c0f){var _0xbd6eff={'raw':!![],'where':{}};var _0x258e9e={};var _0x1d7ddd={'count':0x0,'rows':[]};return db[_0x2c79('0x2f')]['findOne']({'where':{'id':_0x4c586a[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x3a7040,null))[_0x2c79('0x26')](function(_0xa161f7){if(_0xa161f7){_0x258e9e[_0x2c79('0x33')]=_[_0x2c79('0x49')](db[_0x2c79('0x5d')]['rawAttributes']);_0x258e9e[_0x2c79('0x35')]=_[_0x2c79('0x49')](_0x4c586a[_0x2c79('0x35')]);_0x258e9e[_0x2c79('0x36')]=_[_0x2c79('0x37')](_0x258e9e['model'],_0x258e9e[_0x2c79('0x35')]);_0xbd6eff['attributes']=_[_0x2c79('0x37')](_0x258e9e[_0x2c79('0x33')],qs['fields'](_0x4c586a['query'][_0x2c79('0x39')]));_0xbd6eff['attributes']=_0xbd6eff[_0x2c79('0x38')][_0x2c79('0x3a')]?_0xbd6eff[_0x2c79('0x38')]:_0x258e9e['model'];if(!_0x4c586a['query'][_0x2c79('0x3b')](_0x2c79('0x3c'))){_0xbd6eff['limit']=qs[_0x2c79('0x1f')](_0x4c586a['query'][_0x2c79('0x1f')]);_0xbd6eff[_0x2c79('0x1d')]=qs[_0x2c79('0x1d')](_0x4c586a['query'][_0x2c79('0x1d')]);}_0xbd6eff[_0x2c79('0x3d')]=qs[_0x2c79('0x3e')](_0x4c586a[_0x2c79('0x35')][_0x2c79('0x3e')]);_0xbd6eff[_0x2c79('0x3f')]=qs['filters'](_[_0x2c79('0x40')](_0x4c586a[_0x2c79('0x35')],_0x258e9e[_0x2c79('0x36')]));_0xbd6eff[_0x2c79('0x3f')]['CampaignId']=_0xa161f7['id'];if(_0x4c586a[_0x2c79('0x35')][_0x2c79('0x41')]){_0xbd6eff[_0x2c79('0x3f')]=_[_0x2c79('0x43')](_0xbd6eff[_0x2c79('0x3f')],{'$or':_[_0x2c79('0x2e')](_0xbd6eff[_0x2c79('0x38')],function(_0x5bb45a){var _0x4ae97b={};_0x4ae97b[_0x5bb45a]={'$like':'%'+_0x4c586a[_0x2c79('0x35')]['filter']+'%'};return _0x4ae97b;})});}_0xbd6eff=_[_0x2c79('0x43')]({},_0xbd6eff,_0x4c586a[_0x2c79('0x4c')]);return db[_0x2c79('0x5d')]['count']({'where':_0xbd6eff[_0x2c79('0x3f')]})[_0x2c79('0x26')](function(_0x371908){_0x1d7ddd[_0x2c79('0x20')]=_0x371908;if(_0x4c586a['query'][_0x2c79('0x4b')]){_0xbd6eff[_0x2c79('0x44')]=[{'all':!![]}];}return db[_0x2c79('0x5d')]['findAll'](_0xbd6eff);})[_0x2c79('0x26')](function(_0x24feeb){_0x1d7ddd[_0x2c79('0x46')]=_0x24feeb;return _0x1d7ddd;});}})[_0x2c79('0x26')](respondWithFilteredResult(_0x3a7040,_0xbd6eff))[_0x2c79('0x47')](handleError(_0x3a7040,null));};exports[_0x2c79('0x5e')]=function(_0x2d75c7,_0x22db40,_0x28e948){var _0xd2d44f={'raw':!![],'where':{}};var _0x2dca3e={};var _0x4837a2={'count':0x0,'rows':[]};return db[_0x2c79('0x2f')][_0x2c79('0x5f')]({'where':{'id':_0x2d75c7[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x22db40,null))[_0x2c79('0x26')](function(_0x1b2ca3){if(_0x1b2ca3){_0x2dca3e[_0x2c79('0x33')]=_['keys'](db[_0x2c79('0x60')][_0x2c79('0x4a')]);_0x2dca3e[_0x2c79('0x35')]=_['keys'](_0x2d75c7[_0x2c79('0x35')]);_0x2dca3e[_0x2c79('0x36')]=_[_0x2c79('0x37')](_0x2dca3e[_0x2c79('0x33')],_0x2dca3e[_0x2c79('0x35')]);_0xd2d44f[_0x2c79('0x38')]=_[_0x2c79('0x37')](_0x2dca3e['model'],qs[_0x2c79('0x39')](_0x2d75c7[_0x2c79('0x35')][_0x2c79('0x39')]));_0xd2d44f[_0x2c79('0x38')]=_0xd2d44f['attributes'][_0x2c79('0x3a')]?_0xd2d44f['attributes']:_0x2dca3e['model'];if(!_0x2d75c7[_0x2c79('0x35')][_0x2c79('0x3b')]('nolimit')){_0xd2d44f[_0x2c79('0x1f')]=qs[_0x2c79('0x1f')](_0x2d75c7[_0x2c79('0x35')][_0x2c79('0x1f')]);_0xd2d44f[_0x2c79('0x1d')]=qs[_0x2c79('0x1d')](_0x2d75c7[_0x2c79('0x35')][_0x2c79('0x1d')]);}_0xd2d44f[_0x2c79('0x3d')]=qs[_0x2c79('0x3e')](_0x2d75c7['query']['sort']);_0xd2d44f[_0x2c79('0x3f')]=qs[_0x2c79('0x36')](_['pick'](_0x2d75c7['query'],_0x2dca3e['filters']));_0xd2d44f[_0x2c79('0x3f')][_0x2c79('0x61')]=_0x1b2ca3['id'];if(_0x2d75c7[_0x2c79('0x35')][_0x2c79('0x41')]){_0xd2d44f[_0x2c79('0x3f')]=_[_0x2c79('0x43')](_0xd2d44f[_0x2c79('0x3f')],{'$or':_['map'](_0xd2d44f[_0x2c79('0x38')],function(_0x227718){var _0x3c20f4={};_0x3c20f4[_0x227718]={'$like':'%'+_0x2d75c7[_0x2c79('0x35')]['filter']+'%'};return _0x3c20f4;})});}_0xd2d44f=_['merge']({},_0xd2d44f,_0x2d75c7[_0x2c79('0x4c')]);return db[_0x2c79('0x60')]['count']({'where':_0xd2d44f[_0x2c79('0x3f')]})[_0x2c79('0x26')](function(_0x1f9c42){_0x4837a2[_0x2c79('0x20')]=_0x1f9c42;if(_0x2d75c7['query'][_0x2c79('0x4b')]){_0xd2d44f[_0x2c79('0x44')]=[{'all':!![]}];}return db[_0x2c79('0x60')]['findAll'](_0xd2d44f);})['then'](function(_0x3b47c9){_0x4837a2[_0x2c79('0x46')]=_0x3b47c9;return _0x4837a2;});}})[_0x2c79('0x26')](respondWithFilteredResult(_0x22db40,_0xd2d44f))[_0x2c79('0x47')](handleError(_0x22db40,null));};exports[_0x2c79('0x62')]=function(_0x4cc535,_0x4c07ad,_0x20c8f5){var _0x40e3af={'raw':!![],'where':{}};var _0x484015={};var _0x46b314={'count':0x0,'rows':[]};return db[_0x2c79('0x2f')][_0x2c79('0x5f')]({'where':{'id':_0x4cc535[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x4c07ad,null))[_0x2c79('0x26')](function(_0xe18a01){if(_0xe18a01){_0x484015[_0x2c79('0x33')]=_[_0x2c79('0x49')](db['CmHopperFinal'][_0x2c79('0x4a')]);_0x484015['query']=_[_0x2c79('0x49')](_0x4cc535[_0x2c79('0x35')]);_0x484015['filters']=_[_0x2c79('0x37')](_0x484015[_0x2c79('0x33')],_0x484015[_0x2c79('0x35')]);_0x40e3af[_0x2c79('0x38')]=_[_0x2c79('0x37')](_0x484015['model'],qs[_0x2c79('0x39')](_0x4cc535['query'][_0x2c79('0x39')]));_0x40e3af['attributes']=_0x40e3af[_0x2c79('0x38')][_0x2c79('0x3a')]?_0x40e3af[_0x2c79('0x38')]:_0x484015[_0x2c79('0x33')];if(!_0x4cc535['query'][_0x2c79('0x3b')]('nolimit')){_0x40e3af[_0x2c79('0x1f')]=qs[_0x2c79('0x1f')](_0x4cc535[_0x2c79('0x35')]['limit']);_0x40e3af[_0x2c79('0x1d')]=qs[_0x2c79('0x1d')](_0x4cc535[_0x2c79('0x35')][_0x2c79('0x1d')]);}_0x40e3af[_0x2c79('0x3d')]=qs[_0x2c79('0x3e')](_0x4cc535[_0x2c79('0x35')]['sort']);_0x40e3af[_0x2c79('0x3f')]=qs['filters'](_['pick'](_0x4cc535[_0x2c79('0x35')],_0x484015[_0x2c79('0x36')]));_0x40e3af['where']['CampaignId']=_0xe18a01['id'];if(_0x4cc535['query']['filter']){_0x40e3af[_0x2c79('0x3f')]=_[_0x2c79('0x43')](_0x40e3af[_0x2c79('0x3f')],{'$or':_[_0x2c79('0x2e')](_0x40e3af['attributes'],function(_0x2b970f){var _0x58d576={};_0x58d576[_0x2b970f]={'$like':'%'+_0x4cc535[_0x2c79('0x35')][_0x2c79('0x41')]+'%'};return _0x58d576;})});}_0x40e3af=_[_0x2c79('0x43')]({},_0x40e3af,_0x4cc535[_0x2c79('0x4c')]);return db[_0x2c79('0x63')][_0x2c79('0x20')]({'where':_0x40e3af[_0x2c79('0x3f')]})[_0x2c79('0x26')](function(_0x443775){_0x46b314['count']=_0x443775;if(_0x4cc535[_0x2c79('0x35')][_0x2c79('0x4b')]){_0x40e3af[_0x2c79('0x44')]=[{'all':!![]}];}return db[_0x2c79('0x63')][_0x2c79('0x45')](_0x40e3af);})[_0x2c79('0x26')](function(_0x2f9da0){_0x46b314['rows']=_0x2f9da0;return _0x46b314;});}})[_0x2c79('0x26')](respondWithFilteredResult(_0x4c07ad,_0x40e3af))['catch'](handleError(_0x4c07ad,null));};exports[_0x2c79('0x64')]=function(_0x2c07a8,_0x2c78f7,_0x1d48af){var _0x5d2978={'raw':!![],'where':{}};var _0x2f651e={};var _0x17d77c={'count':0x0,'rows':[]};return db['Campaign'][_0x2c79('0x5f')]({'where':{'id':_0x2c07a8[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x2c78f7,null))[_0x2c79('0x26')](function(_0x418c73){if(_0x418c73){_0x2f651e['model']=_[_0x2c79('0x49')](db[_0x2c79('0x65')]['rawAttributes']);_0x2f651e[_0x2c79('0x35')]=_[_0x2c79('0x49')](_0x2c07a8[_0x2c79('0x35')]);_0x2f651e[_0x2c79('0x36')]=_[_0x2c79('0x37')](_0x2f651e[_0x2c79('0x33')],_0x2f651e[_0x2c79('0x35')]);_0x5d2978[_0x2c79('0x38')]=_[_0x2c79('0x37')](_0x2f651e[_0x2c79('0x33')],qs[_0x2c79('0x39')](_0x2c07a8['query']['fields']));_0x5d2978[_0x2c79('0x38')]=_0x5d2978[_0x2c79('0x38')][_0x2c79('0x3a')]?_0x5d2978['attributes']:_0x2f651e['model'];if(!_0x2c07a8[_0x2c79('0x35')][_0x2c79('0x3b')](_0x2c79('0x3c'))){_0x5d2978[_0x2c79('0x1f')]=qs[_0x2c79('0x1f')](_0x2c07a8['query'][_0x2c79('0x1f')]);_0x5d2978['offset']=qs[_0x2c79('0x1d')](_0x2c07a8[_0x2c79('0x35')][_0x2c79('0x1d')]);}_0x5d2978['order']=qs[_0x2c79('0x3e')](_0x2c07a8[_0x2c79('0x35')][_0x2c79('0x3e')]);_0x5d2978[_0x2c79('0x3f')]=qs[_0x2c79('0x36')](_[_0x2c79('0x40')](_0x2c07a8[_0x2c79('0x35')],_0x2f651e[_0x2c79('0x36')]));_0x5d2978[_0x2c79('0x3f')]['CampaignId']=_0x418c73['id'];if(_0x2c07a8[_0x2c79('0x35')][_0x2c79('0x41')]){_0x5d2978[_0x2c79('0x3f')]=_[_0x2c79('0x43')](_0x5d2978[_0x2c79('0x3f')],{'$or':_[_0x2c79('0x2e')](_0x5d2978[_0x2c79('0x38')],function(_0x3b8325){var _0x1efdc9={};_0x1efdc9[_0x3b8325]={'$like':'%'+_0x2c07a8['query'][_0x2c79('0x41')]+'%'};return _0x1efdc9;})});}_0x5d2978=_[_0x2c79('0x43')]({},_0x5d2978,_0x2c07a8[_0x2c79('0x4c')]);return db[_0x2c79('0x65')][_0x2c79('0x20')]({'where':_0x5d2978[_0x2c79('0x3f')]})['then'](function(_0x56366f){_0x17d77c[_0x2c79('0x20')]=_0x56366f;if(_0x2c07a8[_0x2c79('0x35')]['includeAll']){_0x5d2978[_0x2c79('0x44')]=[{'all':!![]}];}return db[_0x2c79('0x65')][_0x2c79('0x45')](_0x5d2978);})['then'](function(_0xdbfece){_0x17d77c[_0x2c79('0x46')]=_0xdbfece;return _0x17d77c;});}})['then'](respondWithFilteredResult(_0x2c78f7,_0x5d2978))[_0x2c79('0x47')](handleError(_0x2c78f7,null));};exports[_0x2c79('0x66')]=function(_0xe99577,_0x59101e,_0xa15f1a){var _0x13df96={};var _0x743fd0={};var _0x2afd85;var _0x41b17b;return db[_0x2c79('0x2f')][_0x2c79('0x5f')]({'where':{'id':_0xe99577[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x59101e,null))[_0x2c79('0x26')](function(_0xb75eaa){if(_0xb75eaa){_0x2afd85=_0xb75eaa;_0x743fd0[_0x2c79('0x33')]=_[_0x2c79('0x49')](db[_0x2c79('0x67')][_0x2c79('0x4a')]);_0x743fd0[_0x2c79('0x35')]=_[_0x2c79('0x49')](_0xe99577['query']);_0x743fd0[_0x2c79('0x36')]=_['intersection'](_0x743fd0[_0x2c79('0x33')],_0x743fd0['query']);_0x13df96[_0x2c79('0x38')]=_[_0x2c79('0x37')](_0x743fd0[_0x2c79('0x33')],qs[_0x2c79('0x39')](_0xe99577['query']['fields']));_0x13df96[_0x2c79('0x38')]=_0x13df96['attributes'][_0x2c79('0x3a')]?_0x13df96[_0x2c79('0x38')]:_0x743fd0[_0x2c79('0x33')];_0x13df96[_0x2c79('0x3d')]=qs[_0x2c79('0x3e')](_0xe99577[_0x2c79('0x35')]['sort']);_0x13df96[_0x2c79('0x3f')]=qs['filters'](_['pick'](_0xe99577[_0x2c79('0x35')],_0x743fd0[_0x2c79('0x36')]));if(_0xe99577[_0x2c79('0x35')]['filter']){_0x13df96[_0x2c79('0x3f')]=_['merge'](_0x13df96['where'],{'$or':_[_0x2c79('0x2e')](_0x13df96[_0x2c79('0x38')],function(_0x199330){var _0x8b14a6={};_0x8b14a6[_0x199330]={'$like':'%'+_0xe99577[_0x2c79('0x35')][_0x2c79('0x41')]+'%'};return _0x8b14a6;})});}_0x13df96=_[_0x2c79('0x43')]({},_0x13df96,_0xe99577[_0x2c79('0x4c')]);return _0x2afd85[_0x2c79('0x66')](_0x13df96);}})[_0x2c79('0x26')](function(_0x4f114e){if(_0x4f114e){_0x41b17b=_0x4f114e['length'];if(!_0xe99577[_0x2c79('0x35')][_0x2c79('0x3b')](_0x2c79('0x3c'))){_0x13df96[_0x2c79('0x1f')]=qs['limit'](_0xe99577[_0x2c79('0x35')][_0x2c79('0x1f')]);_0x13df96[_0x2c79('0x1d')]=qs['offset'](_0xe99577[_0x2c79('0x35')][_0x2c79('0x1d')]);}return _0x2afd85['getLists'](_0x13df96);}})['then'](function(_0x223ac5){if(_0x223ac5){return _0x223ac5?{'count':_0x41b17b,'rows':_0x223ac5}:null;}})[_0x2c79('0x26')](respondWithResult(_0x59101e,null))[_0x2c79('0x47')](handleError(_0x59101e,null));};exports[_0x2c79('0x68')]=function(_0x515e97,_0x570f15,_0x3a6ec9){var _0x56f3e8,_0x469907;return db[_0x2c79('0x2f')][_0x2c79('0x55')]({'where':{'id':_0x515e97['params']['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x570f15,null))[_0x2c79('0x26')](function(_0x41c30d){if(_0x41c30d){_0x469907=_0x41c30d;return _0x41c30d[_0x2c79('0x68')](_0x515e97['body']['ids'],_[_0x2c79('0x56')](_0x515e97[_0x2c79('0x4e')],['ids','id'])||{});}return null;})['spread'](function(_0x47953e){var _0x37dd7c;_0x56f3e8=_0x47953e||[];var _0x1f13d6=[];if(_0x47953e){for(var _0x9bbb0d=0x0;_0x9bbb0d<_0x47953e[_0x2c79('0x3a')];_0x9bbb0d+=0x1){var _0x1f5693=_0x47953e[_0x9bbb0d][_0x2c79('0x28')]({'plain':!![]});_0x469907[_0x2c79('0x69')]=_0x515e97[_0x2c79('0x4e')][_0x2c79('0x69')]?_0x515e97[_0x2c79('0x4e')][_0x2c79('0x69')]:_0x469907['dialCheckDuplicateType'];switch(_0x469907[_0x2c79('0x69')]){case'always':_0x37dd7c=squel['insert']()[_0x2c79('0x6a')](_0x2c79('0x6b'))[_0x2c79('0x6c')]([_0x2c79('0x6d'),_0x2c79('0x6e'),'ContactId',_0x2c79('0x6f'),_0x2c79('0x61'),_0x2c79('0x57'),_0x2c79('0x58')],squel['select']()[_0x2c79('0x70')](_0x2c79('0x6d'),_0x2c79('0x6d'))['field'](_0x2c79('0x71'),_0x2c79('0x6e'))[_0x2c79('0x70')]('id',_0x2c79('0x72'))[_0x2c79('0x70')](_0x1f5693[_0x2c79('0x73')][_0x2c79('0x74')](),_0x2c79('0x6f'))[_0x2c79('0x70')](_0x515e97[_0x2c79('0x54')]['id'][_0x2c79('0x74')](),'CampaignId')[_0x2c79('0x70')]('NOW()','createdAt')[_0x2c79('0x70')](_0x2c79('0x71'),_0x2c79('0x58'))[_0x2c79('0x75')](_0x2c79('0x76'))['where'](_0x2c79('0x77'))[_0x2c79('0x3f')](_0x2c79('0x78'),_0x1f5693[_0x2c79('0x73')][_0x2c79('0x74')]())['where'](_0x2c79('0x79'))[_0x2c79('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2c79('0x7a')]()[_0x2c79('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x2c79('0x75')](_0x2c79('0x7b'))[_0x2c79('0x3f')](_0x2c79('0x7c'),_0x515e97[_0x2c79('0x54')]['id']['toString']()))[_0x2c79('0x3f')](_0x2c79('0x7d'),squel[_0x2c79('0x7a')]()[_0x2c79('0x70')](_0x2c79('0x7e'))['from'](_0x2c79('0x6b'))[_0x2c79('0x3f')](_0x2c79('0x7c'),_0x515e97[_0x2c79('0x54')]['id'][_0x2c79('0x74')]())))[_0x2c79('0x74')]();break;case'onlyIfOpen':_0x37dd7c=squel[_0x2c79('0x7f')]()[_0x2c79('0x6a')]('cm_hopper')[_0x2c79('0x6c')](['phone',_0x2c79('0x6e'),_0x2c79('0x72'),_0x2c79('0x6f'),'CampaignId',_0x2c79('0x57'),_0x2c79('0x58')],squel[_0x2c79('0x7a')]()[_0x2c79('0x70')](_0x2c79('0x6d'),_0x2c79('0x6d'))[_0x2c79('0x70')](_0x2c79('0x71'),_0x2c79('0x6e'))['field']('id',_0x2c79('0x72'))[_0x2c79('0x70')](_0x1f5693[_0x2c79('0x73')][_0x2c79('0x74')](),_0x2c79('0x6f'))[_0x2c79('0x70')](_0x515e97[_0x2c79('0x54')]['id'][_0x2c79('0x74')](),_0x2c79('0x61'))[_0x2c79('0x70')]('NOW()','createdAt')['field']('NOW()',_0x2c79('0x58'))[_0x2c79('0x75')](_0x2c79('0x76'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1f5693['CmListId'][_0x2c79('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x2c79('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2c79('0x70')](_0x2c79('0x7e'))[_0x2c79('0x75')]('cm_hopper')['where'](_0x2c79('0x7c'),_0x515e97[_0x2c79('0x54')]['id'][_0x2c79('0x74')]())))['toString']();break;default:_0x37dd7c=squel[_0x2c79('0x7f')]()[_0x2c79('0x6a')]('cm_hopper')['fromQuery'](['phone',_0x2c79('0x6e'),_0x2c79('0x72'),'ListId','CampaignId',_0x2c79('0x57'),'updatedAt'],squel[_0x2c79('0x7a')]()[_0x2c79('0x70')](_0x2c79('0x6d'),_0x2c79('0x6d'))['field']('NOW()',_0x2c79('0x6e'))[_0x2c79('0x70')]('id','ContactId')[_0x2c79('0x70')](_0x1f5693['CmListId']['toString'](),'ListId')['field'](_0x515e97[_0x2c79('0x54')]['id'][_0x2c79('0x74')](),_0x2c79('0x61'))[_0x2c79('0x70')](_0x2c79('0x71'),'createdAt')['field'](_0x2c79('0x71'),_0x2c79('0x58'))[_0x2c79('0x75')]('cm_contacts')[_0x2c79('0x3f')](_0x2c79('0x77'))['where'](_0x2c79('0x78'),_0x1f5693[_0x2c79('0x73')][_0x2c79('0x74')]())[_0x2c79('0x3f')](_0x2c79('0x79')))[_0x2c79('0x74')]();}_0x1f13d6['push'](db['sequelize'][_0x2c79('0x35')](_0x37dd7c));}return BPromise[_0x2c79('0x80')](_0x1f13d6);}})['then'](function(){return _0x56f3e8;})[_0x2c79('0x26')](respondWithResult(_0x570f15,null))['catch'](handleError(_0x570f15,null));};exports[_0x2c79('0x81')]=function(_0x3f7a50,_0x340049,_0x3980ed){return db['Campaign']['find']({'where':{'id':_0x3f7a50[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x340049,null))[_0x2c79('0x26')](function(_0x5757dd){if(_0x5757dd){return _0x5757dd[_0x2c79('0x81')](_0x3f7a50[_0x2c79('0x35')][_0x2c79('0x82')]);}})[_0x2c79('0x26')](function(_0x2c4f8d){if(_0x2c4f8d){return db['CmHopper'][_0x2c79('0x27')]({'where':{'ListId':_0x3f7a50[_0x2c79('0x35')][_0x2c79('0x82')],'CampaignId':_0x3f7a50[_0x2c79('0x54')]['id']}})['then'](function(){return _0x2c4f8d;});}})['then'](respondWithStatusCode(_0x340049,null))[_0x2c79('0x47')](handleError(_0x340049,null));};exports[_0x2c79('0x83')]=function(_0x361716,_0x38ad40,_0x5c6a03){var _0x57039a={};var _0x37412b={};var _0x3fbb2b;var _0x452b76;return db[_0x2c79('0x2f')]['findOne']({'where':{'id':_0x361716['params']['id']}})['then'](handleEntityNotFound(_0x38ad40,null))[_0x2c79('0x26')](function(_0x202242){if(_0x202242){_0x3fbb2b=_0x202242;_0x37412b['model']=_[_0x2c79('0x49')](db['CmList'][_0x2c79('0x4a')]);_0x37412b['query']=_[_0x2c79('0x49')](_0x361716[_0x2c79('0x35')]);_0x37412b['filters']=_[_0x2c79('0x37')](_0x37412b[_0x2c79('0x33')],_0x37412b['query']);_0x57039a['attributes']=_[_0x2c79('0x37')](_0x37412b[_0x2c79('0x33')],qs[_0x2c79('0x39')](_0x361716[_0x2c79('0x35')]['fields']));_0x57039a[_0x2c79('0x38')]=_0x57039a[_0x2c79('0x38')]['length']?_0x57039a[_0x2c79('0x38')]:_0x37412b[_0x2c79('0x33')];_0x57039a[_0x2c79('0x3d')]=qs[_0x2c79('0x3e')](_0x361716['query'][_0x2c79('0x3e')]);_0x57039a['where']=qs[_0x2c79('0x36')](_['pick'](_0x361716[_0x2c79('0x35')],_0x37412b[_0x2c79('0x36')]));if(_0x361716[_0x2c79('0x35')][_0x2c79('0x41')]){_0x57039a[_0x2c79('0x3f')]=_['merge'](_0x57039a['where'],{'$or':_['map'](_0x57039a[_0x2c79('0x38')],function(_0x3a175b){var _0x4f3f7f={};_0x4f3f7f[_0x3a175b]={'$like':'%'+_0x361716[_0x2c79('0x35')][_0x2c79('0x41')]+'%'};return _0x4f3f7f;})});}_0x57039a=_['merge']({},_0x57039a,_0x361716[_0x2c79('0x4c')]);return _0x3fbb2b[_0x2c79('0x83')](_0x57039a);}})[_0x2c79('0x26')](function(_0x3d9a83){if(_0x3d9a83){_0x452b76=_0x3d9a83[_0x2c79('0x3a')];if(!_0x361716[_0x2c79('0x35')]['hasOwnProperty']('nolimit')){_0x57039a[_0x2c79('0x1f')]=qs[_0x2c79('0x1f')](_0x361716[_0x2c79('0x35')][_0x2c79('0x1f')]);_0x57039a['offset']=qs[_0x2c79('0x1d')](_0x361716[_0x2c79('0x35')][_0x2c79('0x1d')]);}return _0x3fbb2b['getBlackLists'](_0x57039a);}})[_0x2c79('0x26')](function(_0x1aa216){if(_0x1aa216){return _0x1aa216?{'count':_0x452b76,'rows':_0x1aa216}:null;}})[_0x2c79('0x26')](respondWithResult(_0x38ad40,null))[_0x2c79('0x47')](handleError(_0x38ad40,null));};exports[_0x2c79('0x84')]=function(_0x648de,_0x16313c,_0x31f4d8){var _0x5cd72c,_0x26e3c6;return db[_0x2c79('0x2f')][_0x2c79('0x55')]({'where':{'id':_0x648de['params']['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x16313c,null))[_0x2c79('0x26')](function(_0x5ee756){if(_0x5ee756){_0x26e3c6=_0x5ee756;return _0x5ee756['addBlackLists'](_0x648de[_0x2c79('0x4e')][_0x2c79('0x82')],_[_0x2c79('0x56')](_0x648de[_0x2c79('0x4e')],[_0x2c79('0x82'),'id'])||{});}return null;})[_0x2c79('0x85')](function(_0x780bbc){var _0x4c33bb;_0x5cd72c=_0x780bbc||[];var _0x651dc=[];if(_0x780bbc){for(var _0x5eb121=0x0;_0x5eb121<_0x780bbc[_0x2c79('0x3a')];_0x5eb121+=0x1){var _0x586b23=_0x780bbc[_0x5eb121]['get']({'plain':!![]});_0x4c33bb=squel['insert']()[_0x2c79('0x6a')](_0x2c79('0x86'))[_0x2c79('0x6c')]([_0x2c79('0x6d'),_0x2c79('0x72'),'ListId',_0x2c79('0x61'),'createdAt',_0x2c79('0x58')],squel[_0x2c79('0x7a')]()['field'](_0x2c79('0x6d'),'phone')[_0x2c79('0x70')]('id',_0x2c79('0x72'))['field'](_0x586b23[_0x2c79('0x73')][_0x2c79('0x74')](),_0x2c79('0x6f'))[_0x2c79('0x70')](_0x648de[_0x2c79('0x54')]['id'][_0x2c79('0x74')](),_0x2c79('0x61'))[_0x2c79('0x70')](_0x2c79('0x71'),_0x2c79('0x57'))[_0x2c79('0x70')]('NOW()',_0x2c79('0x58'))['from']('cm_contacts')[_0x2c79('0x3f')](_0x2c79('0x77'))['where'](_0x2c79('0x78'),_0x586b23['CmListId'][_0x2c79('0x74')]())['where'](_0x2c79('0x79')))[_0x2c79('0x74')]();_0x651dc['push'](db[_0x2c79('0x87')][_0x2c79('0x35')](_0x4c33bb));}return BPromise['all'](_0x651dc);}})[_0x2c79('0x26')](function(){return _0x5cd72c;})[_0x2c79('0x26')](respondWithResult(_0x16313c,null))['catch'](handleError(_0x16313c,null));};exports[_0x2c79('0x88')]=function(_0x527991,_0x18cbe6,_0x51b133){return db[_0x2c79('0x2f')][_0x2c79('0x55')]({'where':{'id':_0x527991['params']['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x18cbe6,null))[_0x2c79('0x26')](function(_0x500408){if(_0x500408){return _0x500408[_0x2c79('0x88')](_0x527991[_0x2c79('0x35')]['ids']);}})[_0x2c79('0x26')](function(_0xa6b1bc){if(_0xa6b1bc){return db[_0x2c79('0x65')]['destroy']({'where':{'ListId':_0x527991[_0x2c79('0x35')]['ids'],'CampaignId':_0x527991[_0x2c79('0x54')]['id']}})[_0x2c79('0x26')](function(){return _0xa6b1bc;});}})[_0x2c79('0x26')](respondWithStatusCode(_0x18cbe6,null))['catch'](handleError(_0x18cbe6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3fa3de8..9d67929 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5f3175,_0x389e09){var _0x12fbe9=function(_0x162654){while(--_0x162654){_0x5f3175['push'](_0x5f3175['shift']());}};_0x12fbe9(++_0x389e09);}(_0x7a54,0x106));var _0x47a5=function(_0x3e8c68,_0x44079c){_0x3e8c68=_0x3e8c68-0x0;var _0x4ba040=_0x7a54[_0x3e8c68];return _0x4ba040;};'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 +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index b48741f..7d179e8 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 _0x89e8=['GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x106a7f,_0x5cc4fa){var _0x26858a=function(_0x552753){while(--_0x552753){_0x106a7f['push'](_0x106a7f['shift']());}};_0x26858a(++_0x5cc4fa);}(_0x89e8,0x74));var _0x889e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x89e8[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var moment=require(_0x889e('0x2'));var BPromise=require(_0x889e('0x3'));var rs=require(_0x889e('0x4'));var fs=require('fs');var Redis=require(_0x889e('0x5'));var db=require(_0x889e('0x6'))['db'];var utils=require(_0x889e('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x889e('0x8'));var client=jayson[_0x889e('0x9')][_0x889e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed85f,_0x38eeae,_0x54f734){return new BPromise(function(_0x2bfae4,_0x42be62){return client[_0x889e('0xb')](_0x5ed85f,_0x54f734)['then'](function(_0x21c1d9){logger[_0x889e('0xc')](_0x889e('0xd'),_0x38eeae,_0x889e('0xe'));logger['debug'](_0x889e('0xf'),_0x38eeae,_0x889e('0xe'),JSON['stringify'](_0x21c1d9));if(_0x21c1d9[_0x889e('0x10')]){if(_0x21c1d9[_0x889e('0x10')][_0x889e('0x11')]===0x1f4){logger[_0x889e('0x10')]('Campaign,\x20%s,\x20%s',_0x38eeae,_0x21c1d9[_0x889e('0x10')][_0x889e('0x12')]);return _0x42be62(_0x21c1d9[_0x889e('0x10')]['message']);}logger[_0x889e('0x10')](_0x889e('0xd'),_0x38eeae,_0x21c1d9[_0x889e('0x10')][_0x889e('0x12')]);return _0x2bfae4(_0x21c1d9[_0x889e('0x10')]['message']);}else{logger['info'](_0x889e('0xd'),_0x38eeae,_0x889e('0xe'));_0x2bfae4(_0x21c1d9[_0x889e('0x13')][_0x889e('0x12')]);}})['catch'](function(_0x22fbf6){logger[_0x889e('0x10')]('Campaign,\x20%s,\x20%s',_0x38eeae,_0x22fbf6);_0x42be62(_0x22fbf6);});});}exports[_0x889e('0x14')]=function(_0x4f9b2c){var _0x75e219=this;return new Promise(function(_0x168fed,_0x232452){return db[_0x889e('0x15')][_0x889e('0x16')]({'raw':_0x4f9b2c['options']?_0x4f9b2c[_0x889e('0x17')][_0x889e('0x18')]===undefined?!![]:![]:!![],'where':_0x4f9b2c['options']?_0x4f9b2c[_0x889e('0x17')][_0x889e('0x19')]||null:null,'attributes':_0x4f9b2c[_0x889e('0x17')]?_0x4f9b2c['options'][_0x889e('0x1a')]||null:null,'limit':_0x4f9b2c[_0x889e('0x17')]?_0x4f9b2c[_0x889e('0x17')][_0x889e('0x1b')]||null:null,'include':_0x4f9b2c['options']?_0x4f9b2c['options'][_0x889e('0x1c')]?_[_0x889e('0x1d')](_0x4f9b2c[_0x889e('0x17')]['include'],function(_0x956dae){return{'model':db[_0x956dae[_0x889e('0x1e')]],'as':_0x956dae['as'],'attributes':_0x956dae[_0x889e('0x1a')],'include':_0x956dae['include']?_[_0x889e('0x1d')](_0x956dae['include'],function(_0x37fb09){return{'model':db[_0x37fb09[_0x889e('0x1e')]],'as':_0x37fb09['as'],'attributes':_0x37fb09[_0x889e('0x1a')],'include':_0x37fb09['include']?_[_0x889e('0x1d')](_0x37fb09['include'],function(_0x34db77){return{'model':db[_0x34db77[_0x889e('0x1e')]],'as':_0x34db77['as'],'attributes':_0x34db77[_0x889e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x889e('0x1f')](function(_0x5e0267){logger['info'](_0x889e('0x14'),_0x4f9b2c);logger['debug'](_0x889e('0x14'),_0x4f9b2c,JSON[_0x889e('0x20')](_0x5e0267));_0x168fed(_0x5e0267);})[_0x889e('0x21')](function(_0x9e8192){logger[_0x889e('0x10')]('GetCampaign',_0x9e8192['message'],_0x4f9b2c);_0x232452(_0x75e219['error'](0x1f4,_0x9e8192['message']));});});}; \ No newline at end of file +var _0x1978=['findAll','options','raw','where','attributes','include','map','model','GetCampaign','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1978,0x174));var _0x8197=function(_0x12e91e,_0x39c16b){_0x12e91e=_0x12e91e-0x0;var _0x5bcb9=_0x1978[_0x12e91e];return _0x5bcb9;};'use strict';var _=require('lodash');var util=require(_0x8197('0x0'));var moment=require(_0x8197('0x1'));var BPromise=require(_0x8197('0x2'));var rs=require(_0x8197('0x3'));var fs=require('fs');var Redis=require(_0x8197('0x4'));var db=require(_0x8197('0x5'))['db'];var utils=require(_0x8197('0x6'));var logger=require(_0x8197('0x7'))(_0x8197('0x8'));var config=require(_0x8197('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8197('0xa')][_0x8197('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x117bf1,_0x374969,_0x3e8799){return new BPromise(function(_0x1bc265,_0x108379){return client[_0x8197('0xc')](_0x117bf1,_0x3e8799)[_0x8197('0xd')](function(_0x3fd8ee){logger[_0x8197('0xe')](_0x8197('0xf'),_0x374969,_0x8197('0x10'));logger[_0x8197('0x11')](_0x8197('0x12'),_0x374969,'request\x20sent',JSON[_0x8197('0x13')](_0x3fd8ee));if(_0x3fd8ee[_0x8197('0x14')]){if(_0x3fd8ee[_0x8197('0x14')][_0x8197('0x15')]===0x1f4){logger[_0x8197('0x14')](_0x8197('0xf'),_0x374969,_0x3fd8ee['error']['message']);return _0x108379(_0x3fd8ee[_0x8197('0x14')][_0x8197('0x16')]);}logger[_0x8197('0x14')](_0x8197('0xf'),_0x374969,_0x3fd8ee[_0x8197('0x14')]['message']);return _0x1bc265(_0x3fd8ee[_0x8197('0x14')]['message']);}else{logger[_0x8197('0xe')]('Campaign,\x20%s,\x20%s',_0x374969,_0x8197('0x10'));_0x1bc265(_0x3fd8ee['result'][_0x8197('0x16')]);}})[_0x8197('0x17')](function(_0x56fd37){logger[_0x8197('0x14')]('Campaign,\x20%s,\x20%s',_0x374969,_0x56fd37);_0x108379(_0x56fd37);});});}exports['GetCampaign']=function(_0x4695a5){var _0x48bce1=this;return new Promise(function(_0x170d65,_0x34292d){return db['Campaign'][_0x8197('0x18')]({'raw':_0x4695a5['options']?_0x4695a5[_0x8197('0x19')][_0x8197('0x1a')]===undefined?!![]:![]:!![],'where':_0x4695a5[_0x8197('0x19')]?_0x4695a5[_0x8197('0x19')][_0x8197('0x1b')]||null:null,'attributes':_0x4695a5[_0x8197('0x19')]?_0x4695a5['options'][_0x8197('0x1c')]||null:null,'limit':_0x4695a5[_0x8197('0x19')]?_0x4695a5[_0x8197('0x19')]['limit']||null:null,'include':_0x4695a5['options']?_0x4695a5[_0x8197('0x19')][_0x8197('0x1d')]?_[_0x8197('0x1e')](_0x4695a5[_0x8197('0x19')][_0x8197('0x1d')],function(_0x11abb4){return{'model':db[_0x11abb4['model']],'as':_0x11abb4['as'],'attributes':_0x11abb4[_0x8197('0x1c')],'include':_0x11abb4[_0x8197('0x1d')]?_[_0x8197('0x1e')](_0x11abb4['include'],function(_0x342f59){return{'model':db[_0x342f59[_0x8197('0x1f')]],'as':_0x342f59['as'],'attributes':_0x342f59[_0x8197('0x1c')],'include':_0x342f59[_0x8197('0x1d')]?_[_0x8197('0x1e')](_0x342f59[_0x8197('0x1d')],function(_0x461d89){return{'model':db[_0x461d89['model']],'as':_0x461d89['as'],'attributes':_0x461d89[_0x8197('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8197('0xd')](function(_0x1344bf){logger[_0x8197('0xe')](_0x8197('0x20'),_0x4695a5);logger[_0x8197('0x11')]('GetCampaign',_0x4695a5,JSON[_0x8197('0x13')](_0x1344bf));_0x170d65(_0x1344bf);})[_0x8197('0x17')](function(_0x485692){logger[_0x8197('0x14')](_0x8197('0x20'),_0x485692['message'],_0x4695a5);_0x34292d(_0x48bce1[_0x8197('0x14')](0x1f4,_0x485692[_0x8197('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index d24bb1f..1222929 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 _0x422f=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeLists'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x422f,0xd9));var _0xf422=function(_0x469c7c,_0x4a54c6){_0x469c7c=_0x469c7c-0x0;var _0x4b8ffa=_0x422f[_0x469c7c];return _0x4b8ffa;};'use strict';var multer=require(_0xf422('0x0'));var util=require('util');var path=require(_0xf422('0x1'));var timeout=require(_0xf422('0x2'));var express=require(_0xf422('0x3'));var router=express[_0xf422('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf422('0x5'));var interaction=require(_0xf422('0x6'));var config=require(_0xf422('0x7'));var controller=require(_0xf422('0x8'));router['get']('/',auth[_0xf422('0x9')](),controller[_0xf422('0xa')]);router[_0xf422('0xb')](_0xf422('0xc'),auth[_0xf422('0x9')](),controller[_0xf422('0xd')]);router['get'](_0xf422('0xe'),auth[_0xf422('0x9')](),controller[_0xf422('0xf')]);router[_0xf422('0xb')]('/:id/hopper_histories',auth[_0xf422('0x9')](),controller[_0xf422('0x10')]);router[_0xf422('0xb')](_0xf422('0x11'),auth[_0xf422('0x9')](),controller[_0xf422('0x12')]);router[_0xf422('0xb')](_0xf422('0x13'),auth[_0xf422('0x9')](),controller[_0xf422('0x14')]);router[_0xf422('0xb')]('/:id/lists',auth[_0xf422('0x9')](),controller[_0xf422('0x15')]);router[_0xf422('0xb')](_0xf422('0x16'),auth[_0xf422('0x9')](),controller[_0xf422('0x17')]);router[_0xf422('0x18')]('/',auth[_0xf422('0x9')](),controller['create']);router[_0xf422('0x18')](_0xf422('0x19'),auth[_0xf422('0x9')](),controller[_0xf422('0x1a')]);router[_0xf422('0x18')](_0xf422('0x1b'),auth[_0xf422('0x9')](),controller[_0xf422('0x1c')]);router[_0xf422('0x18')]('/:id/blacklists',auth[_0xf422('0x9')](),controller[_0xf422('0x1d')]);router[_0xf422('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xf422('0x1f')]);router[_0xf422('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xf422('0x21')]);router[_0xf422('0x20')](_0xf422('0x1b'),auth['isAuthenticated'](),controller[_0xf422('0x22')]);router[_0xf422('0x20')](_0xf422('0x16'),auth[_0xf422('0x9')](),controller['removeBlackLists']);module[_0xf422('0x23')]=router; \ No newline at end of file +var _0x9831=['/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','update','destroy','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x21bee1,_0x1bc743){var _0x40df80=function(_0x160abc){while(--_0x160abc){_0x21bee1['push'](_0x21bee1['shift']());}};_0x40df80(++_0x1bc743);}(_0x9831,0xfc));var _0x1983=function(_0x161fbf,_0x1d640a){_0x161fbf=_0x161fbf-0x0;var _0x55928b=_0x9831[_0x161fbf];return _0x55928b;};'use strict';var multer=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var path=require(_0x1983('0x2'));var timeout=require(_0x1983('0x3'));var express=require(_0x1983('0x4'));var router=express['Router']();var fs_extra=require(_0x1983('0x5'));var auth=require(_0x1983('0x6'));var interaction=require(_0x1983('0x7'));var config=require(_0x1983('0x8'));var controller=require('./campaign.controller');router[_0x1983('0x9')]('/',auth[_0x1983('0xa')](),controller[_0x1983('0xb')]);router[_0x1983('0x9')](_0x1983('0xc'),auth[_0x1983('0xa')](),controller[_0x1983('0xd')]);router[_0x1983('0x9')]('/:id/hoppers',auth[_0x1983('0xa')](),controller[_0x1983('0xe')]);router[_0x1983('0x9')](_0x1983('0xf'),auth[_0x1983('0xa')](),controller[_0x1983('0x10')]);router[_0x1983('0x9')](_0x1983('0x11'),auth[_0x1983('0xa')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x1983('0xa')](),controller['getHopperBlacks']);router[_0x1983('0x9')](_0x1983('0x12'),auth['isAuthenticated'](),controller['getLists']);router[_0x1983('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x1983('0x13')]);router[_0x1983('0x14')]('/',auth[_0x1983('0xa')](),controller[_0x1983('0x15')]);router[_0x1983('0x14')](_0x1983('0x16'),auth[_0x1983('0xa')](),controller[_0x1983('0x17')]);router[_0x1983('0x14')]('/:id/lists',auth['isAuthenticated'](),controller[_0x1983('0x18')]);router[_0x1983('0x14')](_0x1983('0x19'),auth[_0x1983('0xa')](),controller['addBlackLists']);router['put']('/:id',auth[_0x1983('0xa')](),controller[_0x1983('0x1a')]);router['delete'](_0x1983('0xc'),auth[_0x1983('0xa')](),controller[_0x1983('0x1b')]);router[_0x1983('0x1c')](_0x1983('0x12'),auth['isAuthenticated'](),controller['removeLists']);router[_0x1983('0x1c')](_0x1983('0x19'),auth[_0x1983('0xa')](),controller['removeBlackLists']);module[_0x1983('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index fc3de00..0f77fc3 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 _0x9127=['STRING','TEXT','VIRTUAL','key','sequelize','exports'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x9127,0xbe));var _0x7912=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x9127[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x7912('0x0'));module[_0x7912('0x1')]={'key':{'type':Sequelize[_0x7912('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x7912('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x7912('0x2')]},'name':{'type':Sequelize[_0x7912('0x4')],'get':function(){return this['getDataValue'](_0x7912('0x5'));}}}; \ No newline at end of file +var _0xcfd7=['sequelize','exports','STRING','key'];(function(_0x231de6,_0x516cfb){var _0x5c2924=function(_0x279539){while(--_0x279539){_0x231de6['push'](_0x231de6['shift']());}};_0x5c2924(++_0x516cfb);}(_0xcfd7,0x13c));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7cfd('0x0'));module[_0x7cfd('0x1')]={'key':{'type':Sequelize[_0x7cfd('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x7cfd('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x7cfd('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 38c7510..a4c6faa 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 _0xc26d=['request-promise','bluebird','util','path','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','save','then','destroy','get','CannedAnswers','error','stack','name','index','CannedAnswer','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','pick','filters','filter','where','merge','options','findAll','catch','show','params','includeAll','include','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xc239fc,_0x24f786){var _0x21dc25=function(_0x3d6f15){while(--_0x3d6f15){_0xc239fc['push'](_0xc239fc['shift']());}};_0x21dc25(++_0x24f786);}(_0xc26d,0x148));var _0xdc26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdc26('0x0'));var rimraf=require(_0xdc26('0x1'));var zipdir=require(_0xdc26('0x2'));var jsonpatch=require(_0xdc26('0x3'));var rp=require(_0xdc26('0x4'));var moment=require('moment');var BPromise=require(_0xdc26('0x5'));var Mustache=require('mustache');var util=require(_0xdc26('0x6'));var path=require(_0xdc26('0x7'));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(_0xdc26('0x8'));var squel=require(_0xdc26('0x9'));var crypto=require('crypto');var jsforce=require(_0xdc26('0xa'));var deskjs=require(_0xdc26('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdc26('0xc'));var Papa=require(_0xdc26('0xd'));var Redis=require(_0xdc26('0xe'));var authService=require(_0xdc26('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdc26('0x10'));var hardwareService=require(_0xdc26('0x11'));var logger=require(_0xdc26('0x12'))(_0xdc26('0x13'));var utils=require(_0xdc26('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc26('0x15'))['db'];function respondWithStatusCode(_0x186e59,_0x504baa){_0x504baa=_0x504baa||0xcc;return function(_0xb7f6cd){if(_0xb7f6cd){return _0x186e59[_0xdc26('0x16')](_0x504baa);}return _0x186e59[_0xdc26('0x17')](_0x504baa)[_0xdc26('0x18')]();};}function respondWithResult(_0x3ba678,_0x54dbc4){_0x54dbc4=_0x54dbc4||0xc8;return function(_0x1b261e){if(_0x1b261e){return _0x3ba678['status'](_0x54dbc4)[_0xdc26('0x19')](_0x1b261e);}};}function respondWithFilteredResult(_0x155b7c,_0x314bb0){return function(_0x314132){if(_0x314132){var _0xe435b=typeof _0x314bb0['offset']===_0xdc26('0x1a')&&typeof _0x314bb0[_0xdc26('0x1b')]===_0xdc26('0x1a');var _0x15dacf=_0x314132[_0xdc26('0x1c')];var _0x1608c2=_0xe435b?0x0:_0x314bb0['offset'];var _0x55380a=_0xe435b?_0x314132[_0xdc26('0x1c')]:_0x314bb0['offset']+_0x314bb0[_0xdc26('0x1b')];var _0x412e0e;if(_0x55380a>=_0x15dacf){_0x55380a=_0x15dacf;_0x412e0e=0xc8;}else{_0x412e0e=0xce;}_0x155b7c[_0xdc26('0x17')](_0x412e0e);return _0x155b7c['set']('Content-Range',_0x1608c2+'-'+_0x55380a+'/'+_0x15dacf)['json'](_0x314132);}return null;};}function patchUpdates(_0x5d7b88){return function(_0x593ac7){try{jsonpatch[_0xdc26('0x1d')](_0x593ac7,_0x5d7b88,!![]);}catch(_0x57970b){return BPromise['reject'](_0x57970b);}return _0x593ac7[_0xdc26('0x1e')]();};}function saveUpdates(_0x15c6dc,_0x1f1eea){return function(_0x48a7a7){if(_0x48a7a7){return _0x48a7a7['update'](_0x15c6dc)[_0xdc26('0x1f')](function(_0xc6ec37){return _0xc6ec37;});}return null;};}function removeEntity(_0x228c33,_0x57a249){return function(_0x2aa29a){if(_0x2aa29a){return _0x2aa29a[_0xdc26('0x20')]()[_0xdc26('0x1f')](function(){var _0x533266=_0x2aa29a[_0xdc26('0x21')]({'plain':!![]});var _0x4cf8ee=_0xdc26('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x4cf8ee,'resourceId':_0x533266['id']}})[_0xdc26('0x1f')](function(){return _0x2aa29a;});})['then'](function(){_0x228c33['status'](0xcc)[_0xdc26('0x18')]();});}};}function handleEntityNotFound(_0x28c104,_0x398fd2){return function(_0x1748d5){if(!_0x1748d5){_0x28c104[_0xdc26('0x16')](0x194);}return _0x1748d5;};}function handleError(_0x2e2b5f,_0x1423f0){_0x1423f0=_0x1423f0||0x1f4;return function(_0x298403){logger[_0xdc26('0x23')](_0x298403[_0xdc26('0x24')]);if(_0x298403['name']){delete _0x298403[_0xdc26('0x25')];}_0x2e2b5f[_0xdc26('0x17')](_0x1423f0)['send'](_0x298403);};}exports[_0xdc26('0x26')]=function(_0x2265d3,_0x82d21e){var _0x5d272d={},_0x5ab6e6={},_0x5d1cf6={'count':0x0,'rows':[]};var _0x516927=_['map'](db[_0xdc26('0x27')][_0xdc26('0x28')],function(_0x536717){return{'name':_0x536717['fieldName'],'type':_0x536717[_0xdc26('0x29')][_0xdc26('0x2a')]};});_0x5ab6e6[_0xdc26('0x2b')]=_[_0xdc26('0x2c')](_0x516927,_0xdc26('0x25'));_0x5ab6e6[_0xdc26('0x2d')]=_[_0xdc26('0x2e')](_0x2265d3[_0xdc26('0x2d')]);_0x5ab6e6['filters']=_[_0xdc26('0x2f')](_0x5ab6e6[_0xdc26('0x2b')],_0x5ab6e6[_0xdc26('0x2d')]);_0x5d272d['attributes']=_['intersection'](_0x5ab6e6['model'],qs[_0xdc26('0x30')](_0x2265d3[_0xdc26('0x2d')][_0xdc26('0x30')]));_0x5d272d[_0xdc26('0x31')]=_0x5d272d[_0xdc26('0x31')][_0xdc26('0x32')]?_0x5d272d[_0xdc26('0x31')]:_0x5ab6e6[_0xdc26('0x2b')];if(!_0x2265d3[_0xdc26('0x2d')][_0xdc26('0x33')](_0xdc26('0x34'))){_0x5d272d['limit']=qs[_0xdc26('0x1b')](_0x2265d3['query'][_0xdc26('0x1b')]);_0x5d272d[_0xdc26('0x35')]=qs[_0xdc26('0x35')](_0x2265d3['query']['offset']);}_0x5d272d['order']=qs[_0xdc26('0x36')](_0x2265d3['query'][_0xdc26('0x36')]);_0x5d272d['where']=qs['filters'](_[_0xdc26('0x37')](_0x2265d3[_0xdc26('0x2d')],_0x5ab6e6[_0xdc26('0x38')]),_0x516927);if(_0x2265d3[_0xdc26('0x2d')][_0xdc26('0x39')]){_0x5d272d[_0xdc26('0x3a')]=_[_0xdc26('0x3b')](_0x5d272d['where'],{'$or':[{'key':{'$like':'%'+_0x2265d3[_0xdc26('0x2d')][_0xdc26('0x39')]+'%'}},{'value':{'$like':'%'+_0x2265d3[_0xdc26('0x2d')][_0xdc26('0x39')]+'%'}}]});}_0x5d272d=_[_0xdc26('0x3b')]({},_0x5d272d,_0x2265d3[_0xdc26('0x3c')]);var _0x262a3f={'where':_0x5d272d[_0xdc26('0x3a')]};return db[_0xdc26('0x27')][_0xdc26('0x1c')](_0x262a3f)['then'](function(_0x249438){_0x5d1cf6[_0xdc26('0x1c')]=_0x249438;if(_0x2265d3[_0xdc26('0x2d')]['includeAll']){_0x5d272d['include']=[{'all':!![]}];}return db[_0xdc26('0x27')][_0xdc26('0x3d')](_0x5d272d);})[_0xdc26('0x1f')](function(_0x265432){_0x5d1cf6['rows']=_0x265432;return _0x5d1cf6;})[_0xdc26('0x1f')](respondWithFilteredResult(_0x82d21e,_0x5d272d))[_0xdc26('0x3e')](handleError(_0x82d21e,null));};exports[_0xdc26('0x3f')]=function(_0x507ec4,_0x4bfffe){var _0x55fdcb={'raw':!![],'where':{'id':_0x507ec4[_0xdc26('0x40')]['id']}},_0x5af5ee={};_0x5af5ee[_0xdc26('0x2b')]=_[_0xdc26('0x2e')](db['CannedAnswer'][_0xdc26('0x28')]);_0x5af5ee[_0xdc26('0x2d')]=_[_0xdc26('0x2e')](_0x507ec4[_0xdc26('0x2d')]);_0x5af5ee[_0xdc26('0x38')]=_[_0xdc26('0x2f')](_0x5af5ee['model'],_0x5af5ee[_0xdc26('0x2d')]);_0x55fdcb[_0xdc26('0x31')]=_['intersection'](_0x5af5ee[_0xdc26('0x2b')],qs['fields'](_0x507ec4[_0xdc26('0x2d')]['fields']));_0x55fdcb[_0xdc26('0x31')]=_0x55fdcb['attributes'][_0xdc26('0x32')]?_0x55fdcb[_0xdc26('0x31')]:_0x5af5ee[_0xdc26('0x2b')];if(_0x507ec4['query'][_0xdc26('0x41')]){_0x55fdcb[_0xdc26('0x42')]=[{'all':!![]}];}_0x55fdcb=_[_0xdc26('0x3b')]({},_0x55fdcb,_0x507ec4[_0xdc26('0x3c')]);return db['CannedAnswer'][_0xdc26('0x43')](_0x55fdcb)[_0xdc26('0x1f')](handleEntityNotFound(_0x4bfffe,null))['then'](respondWithResult(_0x4bfffe,null))[_0xdc26('0x3e')](handleError(_0x4bfffe,null));};exports[_0xdc26('0x44')]=function(_0x1b5bd9,_0xe79bc2){if(_0x1b5bd9[_0xdc26('0x45')]['id']){delete _0x1b5bd9[_0xdc26('0x45')]['id'];}return db['CannedAnswer'][_0xdc26('0x43')]({'where':{'id':_0x1b5bd9[_0xdc26('0x40')]['id']}})[_0xdc26('0x1f')](handleEntityNotFound(_0xe79bc2,null))[_0xdc26('0x1f')](saveUpdates(_0x1b5bd9[_0xdc26('0x45')],null))[_0xdc26('0x1f')](respondWithResult(_0xe79bc2,null))[_0xdc26('0x3e')](handleError(_0xe79bc2,null));};exports[_0xdc26('0x20')]=function(_0x3fd31b,_0x226a54){return db[_0xdc26('0x27')][_0xdc26('0x43')]({'where':{'id':_0x3fd31b[_0xdc26('0x40')]['id']}})[_0xdc26('0x1f')](handleEntityNotFound(_0x226a54,null))[_0xdc26('0x1f')](removeEntity(_0x226a54,null))[_0xdc26('0x3e')](handleError(_0x226a54,null));};exports['create']=function(_0xc26fc6,_0x2db7d3){var _0x3e5f33={'key':_0xc26fc6['body'][_0xdc26('0x2a')]};if(_0xc26fc6[_0xdc26('0x45')]['MailAccountId']){_0x3e5f33[_0xdc26('0x46')]=_0xc26fc6[_0xdc26('0x45')][_0xdc26('0x46')];}else if(_0xc26fc6[_0xdc26('0x45')]['SmsAccountId']){_0x3e5f33[_0xdc26('0x47')]=_0xc26fc6[_0xdc26('0x45')][_0xdc26('0x47')];}else if(_0xc26fc6[_0xdc26('0x45')][_0xdc26('0x48')]){_0x3e5f33[_0xdc26('0x48')]=_0xc26fc6[_0xdc26('0x45')]['OpenchannelAccountId'];}else if(_0xc26fc6[_0xdc26('0x45')][_0xdc26('0x49')]){_0x3e5f33[_0xdc26('0x49')]=_0xc26fc6[_0xdc26('0x45')][_0xdc26('0x49')];}return db[_0xdc26('0x27')][_0xdc26('0x43')]({'where':_0x3e5f33})[_0xdc26('0x1f')](function(_0xec2dff){if(_0xec2dff){throw new db['Sequelize'][(_0xdc26('0x4a'))](_0xdc26('0x4b'));}return db['CannedAnswer']['create'](_0xc26fc6[_0xdc26('0x45')]);})[_0xdc26('0x1f')](function(_0x4bd290){var _0xb6bc99=_0xc26fc6['user'][_0xdc26('0x21')]({'plain':!![]});if(!_0xb6bc99)throw new Error(_0xdc26('0x4c'));if(_0xb6bc99[_0xdc26('0x4d')]==='user'){var _0x1ef0cb=_0x4bd290[_0xdc26('0x21')]({'plain':!![]});return db[_0xdc26('0x4e')][_0xdc26('0x43')]({'where':{'name':_0xdc26('0x22'),'userProfileId':_0xb6bc99['userProfileId']},'raw':!![]})[_0xdc26('0x1f')](function(_0x353e0a){if(_0x353e0a&&_0x353e0a[_0xdc26('0x4f')]===0x0){return db[_0xdc26('0x50')][_0xdc26('0x51')]({'name':_0x1ef0cb[_0xdc26('0x25')],'resourceId':_0x1ef0cb['id'],'type':_0x353e0a['name'],'sectionId':_0x353e0a['id']},{})[_0xdc26('0x1f')](function(){return _0x4bd290;});}else{return _0x4bd290;}})[_0xdc26('0x3e')](function(_0x4a2ab5){logger[_0xdc26('0x23')](_0xdc26('0x52'),_0x4a2ab5);throw _0x4a2ab5;});}return _0x4bd290;})['then'](respondWithResult(_0x2db7d3,0xc9))[_0xdc26('0x3e')](handleError(_0x2db7d3,null));}; \ No newline at end of file +var _0x77f8=['fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','get','destroy','then','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','CannedAnswers','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x1ef8f6,_0x18a001){var _0x49bd57=function(_0x5b60c8){while(--_0x5b60c8){_0x1ef8f6['push'](_0x1ef8f6['shift']());}};_0x49bd57(++_0x18a001);}(_0x77f8,0x15a));var _0x877f=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x77f8[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0x877f('0x0'));var rimraf=require(_0x877f('0x1'));var zipdir=require(_0x877f('0x2'));var jsonpatch=require(_0x877f('0x3'));var rp=require(_0x877f('0x4'));var moment=require('moment');var BPromise=require(_0x877f('0x5'));var Mustache=require(_0x877f('0x6'));var util=require('util');var path=require(_0x877f('0x7'));var sox=require(_0x877f('0x8'));var csv=require(_0x877f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x877f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x877f('0xb'));var jsforce=require(_0x877f('0xc'));var deskjs=require(_0x877f('0xd'));var toCsv=require(_0x877f('0x9'));var querystring=require('querystring');var Papa=require(_0x877f('0xe'));var Redis=require('ioredis');var authService=require(_0x877f('0xf'));var qs=require(_0x877f('0x10'));var as=require(_0x877f('0x11'));var hardwareService=require(_0x877f('0x12'));var logger=require(_0x877f('0x13'))('api');var utils=require(_0x877f('0x14'));var config=require(_0x877f('0x15'));var licenseUtil=require(_0x877f('0x16'));var db=require(_0x877f('0x17'))['db'];function respondWithStatusCode(_0x2999e6,_0x2f2259){_0x2f2259=_0x2f2259||0xcc;return function(_0x584534){if(_0x584534){return _0x2999e6['sendStatus'](_0x2f2259);}return _0x2999e6[_0x877f('0x18')](_0x2f2259)[_0x877f('0x19')]();};}function respondWithResult(_0xb4758,_0x2b0a06){_0x2b0a06=_0x2b0a06||0xc8;return function(_0x23fdd5){if(_0x23fdd5){return _0xb4758['status'](_0x2b0a06)[_0x877f('0x1a')](_0x23fdd5);}};}function respondWithFilteredResult(_0x13c42b,_0xd72997){return function(_0x5ec749){if(_0x5ec749){var _0x5660a8=typeof _0xd72997[_0x877f('0x1b')]===_0x877f('0x1c')&&typeof _0xd72997['limit']===_0x877f('0x1c');var _0x365b44=_0x5ec749[_0x877f('0x1d')];var _0xe17b6c=_0x5660a8?0x0:_0xd72997[_0x877f('0x1b')];var _0x3529ee=_0x5660a8?_0x5ec749[_0x877f('0x1d')]:_0xd72997['offset']+_0xd72997[_0x877f('0x1e')];var _0x49fce5;if(_0x3529ee>=_0x365b44){_0x3529ee=_0x365b44;_0x49fce5=0xc8;}else{_0x49fce5=0xce;}_0x13c42b[_0x877f('0x18')](_0x49fce5);return _0x13c42b[_0x877f('0x1f')](_0x877f('0x20'),_0xe17b6c+'-'+_0x3529ee+'/'+_0x365b44)['json'](_0x5ec749);}return null;};}function patchUpdates(_0x188576){return function(_0x2409d6){try{jsonpatch[_0x877f('0x21')](_0x2409d6,_0x188576,!![]);}catch(_0x508c9d){return BPromise['reject'](_0x508c9d);}return _0x2409d6[_0x877f('0x22')]();};}function saveUpdates(_0x3d78ef,_0x3ae7be){return function(_0xeb87fd){if(_0xeb87fd){return _0xeb87fd[_0x877f('0x23')](_0x3d78ef)['then'](function(_0x3c5a3a){return _0x3c5a3a;});}return null;};}function removeEntity(_0x2de1bc,_0x2a9f34){return function(_0x176aae){if(_0x176aae){return _0x176aae['destroy']()['then'](function(){var _0x42fa31=_0x176aae[_0x877f('0x24')]({'plain':!![]});var _0x1732da='CannedAnswers';return db['UserProfileResource'][_0x877f('0x25')]({'where':{'type':_0x1732da,'resourceId':_0x42fa31['id']}})[_0x877f('0x26')](function(){return _0x176aae;});})[_0x877f('0x26')](function(){_0x2de1bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a309,_0x465bb9){return function(_0x3de8de){if(!_0x3de8de){_0x54a309[_0x877f('0x27')](0x194);}return _0x3de8de;};}function handleError(_0x36a6ad,_0x1f0acc){_0x1f0acc=_0x1f0acc||0x1f4;return function(_0x267f81){logger[_0x877f('0x28')](_0x267f81[_0x877f('0x29')]);if(_0x267f81[_0x877f('0x2a')]){delete _0x267f81[_0x877f('0x2a')];}_0x36a6ad['status'](_0x1f0acc)[_0x877f('0x2b')](_0x267f81);};}exports[_0x877f('0x2c')]=function(_0x44c439,_0x38ee14){var _0x39390c={},_0x556df0={},_0x2a4bc7={'count':0x0,'rows':[]};var _0x349670=_[_0x877f('0x2d')](db[_0x877f('0x2e')][_0x877f('0x2f')],function(_0x180a3a){return{'name':_0x180a3a[_0x877f('0x30')],'type':_0x180a3a[_0x877f('0x31')][_0x877f('0x32')]};});_0x556df0[_0x877f('0x33')]=_['map'](_0x349670,_0x877f('0x2a'));_0x556df0[_0x877f('0x34')]=_[_0x877f('0x35')](_0x44c439[_0x877f('0x34')]);_0x556df0[_0x877f('0x36')]=_[_0x877f('0x37')](_0x556df0[_0x877f('0x33')],_0x556df0[_0x877f('0x34')]);_0x39390c[_0x877f('0x38')]=_[_0x877f('0x37')](_0x556df0[_0x877f('0x33')],qs[_0x877f('0x39')](_0x44c439[_0x877f('0x34')]['fields']));_0x39390c[_0x877f('0x38')]=_0x39390c[_0x877f('0x38')][_0x877f('0x3a')]?_0x39390c[_0x877f('0x38')]:_0x556df0[_0x877f('0x33')];if(!_0x44c439[_0x877f('0x34')][_0x877f('0x3b')]('nolimit')){_0x39390c['limit']=qs[_0x877f('0x1e')](_0x44c439[_0x877f('0x34')][_0x877f('0x1e')]);_0x39390c[_0x877f('0x1b')]=qs[_0x877f('0x1b')](_0x44c439[_0x877f('0x34')][_0x877f('0x1b')]);}_0x39390c[_0x877f('0x3c')]=qs['sort'](_0x44c439['query'][_0x877f('0x3d')]);_0x39390c[_0x877f('0x3e')]=qs[_0x877f('0x36')](_[_0x877f('0x3f')](_0x44c439[_0x877f('0x34')],_0x556df0['filters']),_0x349670);if(_0x44c439['query'][_0x877f('0x40')]){_0x39390c['where']=_[_0x877f('0x41')](_0x39390c[_0x877f('0x3e')],{'$or':[{'key':{'$like':'%'+_0x44c439[_0x877f('0x34')][_0x877f('0x40')]+'%'}},{'value':{'$like':'%'+_0x44c439['query']['filter']+'%'}}]});}_0x39390c=_['merge']({},_0x39390c,_0x44c439['options']);var _0x16fc1c={'where':_0x39390c[_0x877f('0x3e')]};return db[_0x877f('0x2e')][_0x877f('0x1d')](_0x16fc1c)[_0x877f('0x26')](function(_0x10384c){_0x2a4bc7[_0x877f('0x1d')]=_0x10384c;if(_0x44c439[_0x877f('0x34')][_0x877f('0x42')]){_0x39390c['include']=[{'all':!![]}];}return db[_0x877f('0x2e')][_0x877f('0x43')](_0x39390c);})[_0x877f('0x26')](function(_0x1f7779){_0x2a4bc7[_0x877f('0x44')]=_0x1f7779;return _0x2a4bc7;})[_0x877f('0x26')](respondWithFilteredResult(_0x38ee14,_0x39390c))[_0x877f('0x45')](handleError(_0x38ee14,null));};exports[_0x877f('0x46')]=function(_0x56dfd9,_0xf5cef5){var _0x4eb87e={'raw':!![],'where':{'id':_0x56dfd9[_0x877f('0x47')]['id']}},_0x5025fd={};_0x5025fd[_0x877f('0x33')]=_[_0x877f('0x35')](db[_0x877f('0x2e')][_0x877f('0x2f')]);_0x5025fd[_0x877f('0x34')]=_[_0x877f('0x35')](_0x56dfd9['query']);_0x5025fd[_0x877f('0x36')]=_[_0x877f('0x37')](_0x5025fd[_0x877f('0x33')],_0x5025fd['query']);_0x4eb87e[_0x877f('0x38')]=_[_0x877f('0x37')](_0x5025fd[_0x877f('0x33')],qs['fields'](_0x56dfd9['query'][_0x877f('0x39')]));_0x4eb87e[_0x877f('0x38')]=_0x4eb87e[_0x877f('0x38')]['length']?_0x4eb87e['attributes']:_0x5025fd[_0x877f('0x33')];if(_0x56dfd9[_0x877f('0x34')][_0x877f('0x42')]){_0x4eb87e[_0x877f('0x48')]=[{'all':!![]}];}_0x4eb87e=_['merge']({},_0x4eb87e,_0x56dfd9[_0x877f('0x49')]);return db[_0x877f('0x2e')][_0x877f('0x4a')](_0x4eb87e)[_0x877f('0x26')](handleEntityNotFound(_0xf5cef5,null))[_0x877f('0x26')](respondWithResult(_0xf5cef5,null))[_0x877f('0x45')](handleError(_0xf5cef5,null));};exports[_0x877f('0x23')]=function(_0x8fd1fe,_0xd435bd){if(_0x8fd1fe[_0x877f('0x4b')]['id']){delete _0x8fd1fe[_0x877f('0x4b')]['id'];}return db['CannedAnswer'][_0x877f('0x4a')]({'where':{'id':_0x8fd1fe[_0x877f('0x47')]['id']}})[_0x877f('0x26')](handleEntityNotFound(_0xd435bd,null))[_0x877f('0x26')](saveUpdates(_0x8fd1fe[_0x877f('0x4b')],null))[_0x877f('0x26')](respondWithResult(_0xd435bd,null))[_0x877f('0x45')](handleError(_0xd435bd,null));};exports[_0x877f('0x25')]=function(_0x17d489,_0x5aca61){return db[_0x877f('0x2e')]['find']({'where':{'id':_0x17d489[_0x877f('0x47')]['id']}})['then'](handleEntityNotFound(_0x5aca61,null))[_0x877f('0x26')](removeEntity(_0x5aca61,null))[_0x877f('0x45')](handleError(_0x5aca61,null));};exports['create']=function(_0x22ed17,_0x3ff2e6){var _0xe00906={'key':_0x22ed17[_0x877f('0x4b')][_0x877f('0x32')]};if(_0x22ed17[_0x877f('0x4b')][_0x877f('0x4c')]){_0xe00906['MailAccountId']=_0x22ed17['body'][_0x877f('0x4c')];}else if(_0x22ed17[_0x877f('0x4b')]['SmsAccountId']){_0xe00906['SmsAccountId']=_0x22ed17[_0x877f('0x4b')][_0x877f('0x4d')];}else if(_0x22ed17[_0x877f('0x4b')][_0x877f('0x4e')]){_0xe00906[_0x877f('0x4e')]=_0x22ed17[_0x877f('0x4b')][_0x877f('0x4e')];}else if(_0x22ed17['body'][_0x877f('0x4f')]){_0xe00906[_0x877f('0x4f')]=_0x22ed17[_0x877f('0x4b')]['ChatWebsiteId'];}return db[_0x877f('0x2e')]['find']({'where':_0xe00906})[_0x877f('0x26')](function(_0x3bcc2f){if(_0x3bcc2f){throw new db[(_0x877f('0x50'))][(_0x877f('0x51'))](_0x877f('0x52'));}return db[_0x877f('0x2e')][_0x877f('0x53')](_0x22ed17[_0x877f('0x4b')]);})[_0x877f('0x26')](function(_0x18ab2e){var _0x20a1ef=_0x22ed17[_0x877f('0x54')][_0x877f('0x24')]({'plain':!![]});if(!_0x20a1ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20a1ef['role']===_0x877f('0x54')){var _0x44cee8=_0x18ab2e['get']({'plain':!![]});return db['UserProfileSection'][_0x877f('0x4a')]({'where':{'name':_0x877f('0x55'),'userProfileId':_0x20a1ef['userProfileId']},'raw':!![]})[_0x877f('0x26')](function(_0x2e2432){if(_0x2e2432&&_0x2e2432[_0x877f('0x56')]===0x0){return db[_0x877f('0x57')][_0x877f('0x53')]({'name':_0x44cee8[_0x877f('0x2a')],'resourceId':_0x44cee8['id'],'type':_0x2e2432[_0x877f('0x2a')],'sectionId':_0x2e2432['id']},{})[_0x877f('0x26')](function(){return _0x18ab2e;});}else{return _0x18ab2e;}})['catch'](function(_0x4d35ed){logger['error'](_0x877f('0x58'),_0x4d35ed);throw _0x4d35ed;});}return _0x18ab2e;})[_0x877f('0x26')](respondWithResult(_0x3ff2e6,0xc9))[_0x877f('0x45')](handleError(_0x3ff2e6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 90f07ba..41df93a 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 _0x3da0=['path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x392842,_0x365019){var _0x157c7d=function(_0x406d05){while(--_0x406d05){_0x392842['push'](_0x392842['shift']());}};_0x157c7d(++_0x365019);}(_0x3da0,0x1e9));var _0x03da=function(_0xc3aae7,_0x3bfa91){_0xc3aae7=_0xc3aae7-0x0;var _0x1f365a=_0x3da0[_0xc3aae7];return _0x1f365a;};'use strict';var _=require(_0x03da('0x0'));var util=require(_0x03da('0x1'));var logger=require(_0x03da('0x2'))('api');var moment=require(_0x03da('0x3'));var BPromise=require(_0x03da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03da('0x5'));var rimraf=require(_0x03da('0x6'));var config=require(_0x03da('0x7'));var attributes=require(_0x03da('0x8'));module[_0x03da('0x9')]=function(_0x36c6e0,_0x13dd8d){return _0x36c6e0['define'](_0x03da('0xa'),attributes,{'tableName':_0x03da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x03da('0xc')});}; \ No newline at end of file +var _0x476e=['moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x21af3a,_0x27ad01){var _0x471c30=function(_0x453780){while(--_0x453780){_0x21af3a['push'](_0x21af3a['shift']());}};_0x471c30(++_0x27ad01);}(_0x476e,0x1a1));var _0xe476=function(_0x469790,_0x1e45d6){_0x469790=_0x469790-0x0;var _0x3807cd=_0x476e[_0x469790];return _0x3807cd;};'use strict';var _=require(_0xe476('0x0'));var util=require('util');var logger=require(_0xe476('0x1'))(_0xe476('0x2'));var moment=require(_0xe476('0x3'));var BPromise=require(_0xe476('0x4'));var rp=require(_0xe476('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe476('0x6'));var config=require(_0xe476('0x7'));var attributes=require(_0xe476('0x8'));module['exports']=function(_0x594c98,_0xb36c87){return _0x594c98['define']('CannedAnswer',attributes,{'tableName':_0xe476('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe476('0xa'),'collate':_0xe476('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 773ea8c..52f2cb7 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(_0x31bfe0,_0x1bc14a){var _0x2f90ec=function(_0x168911){while(--_0x168911){_0x31bfe0['push'](_0x31bfe0['shift']());}};_0x2f90ec(++_0x1bc14a);}(_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 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(_0x1a863e,_0x3e7a3c){var _0x240955=function(_0x353d62){while(--_0x353d62){_0x1a863e['push'](_0x1a863e['shift']());}};_0x240955(++_0x3e7a3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 ab0aa8a..c38271e 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 _0x151b=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x151b,0x19c));var _0xb151=function(_0x1620e1,_0x27b16b){_0x1620e1=_0x1620e1-0x0;var _0x24c546=_0x151b[_0x1620e1];return _0x24c546;};'use strict';var multer=require(_0xb151('0x0'));var util=require(_0xb151('0x1'));var path=require(_0xb151('0x2'));var timeout=require('connect-timeout');var express=require(_0xb151('0x3'));var router=express[_0xb151('0x4')]();var fs_extra=require(_0xb151('0x5'));var auth=require(_0xb151('0x6'));var interaction=require(_0xb151('0x7'));var config=require(_0xb151('0x8'));var controller=require(_0xb151('0x9'));router[_0xb151('0xa')]('/',auth[_0xb151('0xb')](),controller[_0xb151('0xc')]);router['get'](_0xb151('0xd'),auth['isAuthenticated'](),controller[_0xb151('0xe')]);router[_0xb151('0xf')]('/',auth[_0xb151('0xb')](),controller[_0xb151('0x10')]);router['put']('/:id',auth[_0xb151('0xb')](),controller[_0xb151('0x11')]);router[_0xb151('0x12')](_0xb151('0xd'),auth['isAuthenticated'](),controller[_0xb151('0x13')]);module[_0xb151('0x14')]=router; \ No newline at end of file +var _0xd7f7=['post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','index','get','/:id','isAuthenticated','show'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xd7f7,0xef));var _0x7d7f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd7f7[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0x7d7f('0x0'));var path=require('path');var timeout=require(_0x7d7f('0x1'));var express=require(_0x7d7f('0x2'));var router=express[_0x7d7f('0x3')]();var fs_extra=require(_0x7d7f('0x4'));var auth=require(_0x7d7f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d7f('0x6'));var controller=require(_0x7d7f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d7f('0x8')]);router[_0x7d7f('0x9')](_0x7d7f('0xa'),auth[_0x7d7f('0xb')](),controller[_0x7d7f('0xc')]);router[_0x7d7f('0xd')]('/',auth['isAuthenticated'](),controller[_0x7d7f('0xe')]);router[_0x7d7f('0xf')](_0x7d7f('0xa'),auth[_0x7d7f('0xb')](),controller['update']);router[_0x7d7f('0x10')](_0x7d7f('0xa'),auth[_0x7d7f('0xb')](),controller['destroy']);module[_0x7d7f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4ffab53..1d59e15 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 _0xafa8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x15d2be,_0x241878){var _0x5fdbe1=function(_0x37e7de){while(--_0x37e7de){_0x15d2be['push'](_0x15d2be['shift']());}};_0x5fdbe1(++_0x241878);}(_0xafa8,0x135));var _0x8afa=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xafa8[_0xadde88];return _0x3b8eb6;};'use strict';var Sequelize=require('sequelize');module[_0x8afa('0x0')]={'calldate':{'type':Sequelize[_0x8afa('0x1')],'allowNull':![],'defaultValue':_0x8afa('0x2')},'clid':{'type':Sequelize[_0x8afa('0x3')]},'src':{'type':Sequelize[_0x8afa('0x3')]},'dst':{'type':Sequelize[_0x8afa('0x3')]},'dcontext':{'type':Sequelize[_0x8afa('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x8afa('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x8afa('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8afa('0x3')]},'amaflags':{'type':Sequelize[_0x8afa('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8afa('0x3')]},'userfield':{'type':Sequelize[_0x8afa('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x8afa('0x3')]},'sequence':{'type':Sequelize[_0x8afa('0x3')]},'peeraccount':{'type':Sequelize[_0x8afa('0x3')]},'type':{'type':Sequelize[_0x8afa('0x3')]},'tag':{'type':Sequelize[_0x8afa('0x3')]}}; \ No newline at end of file +var _0xd1d4=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x4f5856,_0x33aa05){var _0x1b437c=function(_0x642be2){while(--_0x642be2){_0x4f5856['push'](_0x4f5856['shift']());}};_0x1b437c(++_0x33aa05);}(_0xd1d4,0xfb));var _0x4d1d=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xd1d4[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x4d1d('0x0'));module[_0x4d1d('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4d1d('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x4d1d('0x3')]},'dcontext':{'type':Sequelize[_0x4d1d('0x3')]},'channel':{'type':Sequelize[_0x4d1d('0x3')]},'dstchannel':{'type':Sequelize[_0x4d1d('0x3')]},'lastapp':{'type':Sequelize[_0x4d1d('0x3')]},'lastdata':{'type':Sequelize[_0x4d1d('0x3')]},'duration':{'type':Sequelize[_0x4d1d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4d1d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4d1d('0x3')]},'amaflags':{'type':Sequelize[_0x4d1d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4d1d('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x4d1d('0x3')]},'sequence':{'type':Sequelize[_0x4d1d('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d1d('0x3')]},'tag':{'type':Sequelize[_0x4d1d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8b4bbb6..e12d5aa 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 _0x7a59=['describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','Cdr','findAll','show','params','keys','include','find','create','body','catch','update'];(function(_0x26bfb0,_0x5b0ffc){var _0x4454b3=function(_0x2e7c5f){while(--_0x2e7c5f){_0x26bfb0['push'](_0x26bfb0['shift']());}};_0x4454b3(++_0x5b0ffc);}(_0x7a59,0x16e));var _0x97a5=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x7a59[_0xcd0918];return _0x250704;};'use strict';var emlformat=require(_0x97a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a5('0x1'));var rp=require(_0x97a5('0x2'));var moment=require(_0x97a5('0x3'));var BPromise=require(_0x97a5('0x4'));var Mustache=require(_0x97a5('0x5'));var util=require('util');var path=require(_0x97a5('0x6'));var sox=require(_0x97a5('0x7'));var csv=require(_0x97a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a5('0x9'));var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0x8'));var querystring=require('querystring');var Papa=require(_0x97a5('0xf'));var Redis=require(_0x97a5('0x10'));var authService=require(_0x97a5('0x11'));var qs=require(_0x97a5('0x12'));var as=require(_0x97a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x14'));var utils=require(_0x97a5('0x15'));var config=require(_0x97a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x17'))['db'];function respondWithStatusCode(_0x350720,_0x55305a){_0x55305a=_0x55305a||0xcc;return function(_0x4f85a0){if(_0x4f85a0){return _0x350720[_0x97a5('0x18')](_0x55305a);}return _0x350720[_0x97a5('0x19')](_0x55305a)['end']();};}function respondWithResult(_0x595437,_0x51d5e2){_0x51d5e2=_0x51d5e2||0xc8;return function(_0x5a4471){if(_0x5a4471){return _0x595437[_0x97a5('0x19')](_0x51d5e2)[_0x97a5('0x1a')](_0x5a4471);}};}function respondWithFilteredResult(_0x3603e4,_0x4d8ba7){return function(_0x1a7a62){if(_0x1a7a62){var _0x3fa986=typeof _0x4d8ba7['offset']===_0x97a5('0x1b')&&typeof _0x4d8ba7['limit']===_0x97a5('0x1b');var _0x55071b=_0x1a7a62['count'];var _0x52ce92=_0x3fa986?0x0:_0x4d8ba7[_0x97a5('0x1c')];var _0x5c5740=_0x3fa986?_0x1a7a62[_0x97a5('0x1d')]:_0x4d8ba7[_0x97a5('0x1c')]+_0x4d8ba7[_0x97a5('0x1e')];var _0x1efe8c;if(_0x5c5740>=_0x55071b){_0x5c5740=_0x55071b;_0x1efe8c=0xc8;}else{_0x1efe8c=0xce;}_0x3603e4['status'](_0x1efe8c);return _0x3603e4['set'](_0x97a5('0x1f'),_0x52ce92+'-'+_0x5c5740+'/'+_0x55071b)[_0x97a5('0x1a')](_0x1a7a62);}return null;};}function patchUpdates(_0x4e3386){return function(_0x51858b){try{jsonpatch[_0x97a5('0x20')](_0x51858b,_0x4e3386,!![]);}catch(_0x3d7dba){return BPromise[_0x97a5('0x21')](_0x3d7dba);}return _0x51858b['save']();};}function saveUpdates(_0x34fb55,_0x3a5849){return function(_0x23f4f8){if(_0x23f4f8){return _0x23f4f8['update'](_0x34fb55)[_0x97a5('0x22')](function(_0x33d6da){return _0x33d6da;});}return null;};}function removeEntity(_0x4e2074,_0x5e731e){return function(_0x469592){if(_0x469592){return _0x469592[_0x97a5('0x23')]()[_0x97a5('0x22')](function(){_0x4e2074[_0x97a5('0x19')](0xcc)[_0x97a5('0x24')]();});}};}function handleEntityNotFound(_0x302d78,_0xf7ad1e){return function(_0x4743e0){if(!_0x4743e0){_0x302d78['sendStatus'](0x194);}return _0x4743e0;};}function handleError(_0x2038dd,_0x46ee45){_0x46ee45=_0x46ee45||0x1f4;return function(_0x2ca97c){logger[_0x97a5('0x25')](_0x2ca97c[_0x97a5('0x26')]);if(_0x2ca97c[_0x97a5('0x27')]){delete _0x2ca97c['name'];}_0x2038dd[_0x97a5('0x19')](_0x46ee45)[_0x97a5('0x28')](_0x2ca97c);};}exports['index']=function(_0x274ccb,_0x52248f){var _0x48f1c1={},_0x1bdb74={},_0x2eaae4={'count':0x0,'rows':[]};var _0x5c1c67=_[_0x97a5('0x29')](db['Cdr'][_0x97a5('0x2a')],function(_0x3c5d02){return{'name':_0x3c5d02[_0x97a5('0x2b')],'type':_0x3c5d02[_0x97a5('0x2c')]['key']};});_0x1bdb74['model']=_[_0x97a5('0x29')](_0x5c1c67,_0x97a5('0x27'));_0x1bdb74[_0x97a5('0x2d')]=_['keys'](_0x274ccb[_0x97a5('0x2d')]);_0x1bdb74[_0x97a5('0x2e')]=_['intersection'](_0x1bdb74[_0x97a5('0x2f')],_0x1bdb74[_0x97a5('0x2d')]);_0x48f1c1['attributes']=_[_0x97a5('0x30')](_0x1bdb74[_0x97a5('0x2f')],qs[_0x97a5('0x31')](_0x274ccb['query'][_0x97a5('0x31')]));_0x48f1c1[_0x97a5('0x32')]=_0x48f1c1[_0x97a5('0x32')][_0x97a5('0x33')]?_0x48f1c1[_0x97a5('0x32')]:_0x1bdb74[_0x97a5('0x2f')];if(!_0x274ccb[_0x97a5('0x2d')]['hasOwnProperty'](_0x97a5('0x34'))){_0x48f1c1[_0x97a5('0x1e')]=qs[_0x97a5('0x1e')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x1e')]);_0x48f1c1[_0x97a5('0x1c')]=qs[_0x97a5('0x1c')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x1c')]);}_0x48f1c1[_0x97a5('0x35')]=qs[_0x97a5('0x36')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x36')]);_0x48f1c1['where']=qs[_0x97a5('0x2e')](_[_0x97a5('0x37')](_0x274ccb[_0x97a5('0x2d')],_0x1bdb74[_0x97a5('0x2e')]),_0x5c1c67);if(_0x274ccb[_0x97a5('0x2d')]['filter']){_0x48f1c1['where']=_[_0x97a5('0x38')](_0x48f1c1[_0x97a5('0x39')],{'$or':_[_0x97a5('0x29')](_0x5c1c67,function(_0x45a548){if(_0x45a548[_0x97a5('0x2c')]!==_0x97a5('0x3a')){var _0x57333b={};_0x57333b[_0x45a548[_0x97a5('0x27')]]={'$like':'%'+_0x274ccb['query'][_0x97a5('0x3b')]+'%'};return _0x57333b;}})});}_0x48f1c1=_[_0x97a5('0x38')]({},_0x48f1c1,_0x274ccb[_0x97a5('0x3c')]);var _0x798318={'where':_0x48f1c1[_0x97a5('0x39')]};return db['Cdr'][_0x97a5('0x1d')](_0x798318)[_0x97a5('0x22')](function(_0x64505){_0x2eaae4[_0x97a5('0x1d')]=_0x64505;if(_0x274ccb[_0x97a5('0x2d')]['includeAll']){_0x48f1c1['include']=[{'all':!![]}];}return db[_0x97a5('0x3d')][_0x97a5('0x3e')](_0x48f1c1);})[_0x97a5('0x22')](function(_0x20dbc6){_0x2eaae4['rows']=_0x20dbc6;return _0x2eaae4;})[_0x97a5('0x22')](respondWithFilteredResult(_0x52248f,_0x48f1c1))['catch'](handleError(_0x52248f,null));};exports[_0x97a5('0x3f')]=function(_0x331108,_0x111e72){var _0x5baf77={'raw':!![],'where':{'id':_0x331108[_0x97a5('0x40')]['id']}},_0xefb019={};_0xefb019['model']=_[_0x97a5('0x41')](db[_0x97a5('0x3d')][_0x97a5('0x2a')]);_0xefb019[_0x97a5('0x2d')]=_[_0x97a5('0x41')](_0x331108[_0x97a5('0x2d')]);_0xefb019[_0x97a5('0x2e')]=_[_0x97a5('0x30')](_0xefb019[_0x97a5('0x2f')],_0xefb019[_0x97a5('0x2d')]);_0x5baf77[_0x97a5('0x32')]=_[_0x97a5('0x30')](_0xefb019['model'],qs[_0x97a5('0x31')](_0x331108[_0x97a5('0x2d')][_0x97a5('0x31')]));_0x5baf77['attributes']=_0x5baf77[_0x97a5('0x32')][_0x97a5('0x33')]?_0x5baf77[_0x97a5('0x32')]:_0xefb019[_0x97a5('0x2f')];if(_0x331108[_0x97a5('0x2d')]['includeAll']){_0x5baf77[_0x97a5('0x42')]=[{'all':!![]}];}_0x5baf77=_[_0x97a5('0x38')]({},_0x5baf77,_0x331108[_0x97a5('0x3c')]);return db[_0x97a5('0x3d')][_0x97a5('0x43')](_0x5baf77)['then'](handleEntityNotFound(_0x111e72,null))[_0x97a5('0x22')](respondWithResult(_0x111e72,null))['catch'](handleError(_0x111e72,null));};exports[_0x97a5('0x44')]=function(_0x235f9d,_0x330f6a){return db['Cdr'][_0x97a5('0x44')](_0x235f9d[_0x97a5('0x45')],{})[_0x97a5('0x22')](respondWithResult(_0x330f6a,0xc9))[_0x97a5('0x46')](handleError(_0x330f6a,null));};exports[_0x97a5('0x47')]=function(_0x42ced6,_0x49b215){if(_0x42ced6[_0x97a5('0x45')]['id']){delete _0x42ced6[_0x97a5('0x45')]['id'];}return db[_0x97a5('0x3d')][_0x97a5('0x43')]({'where':{'id':_0x42ced6['params']['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x49b215,null))[_0x97a5('0x22')](saveUpdates(_0x42ced6['body'],null))[_0x97a5('0x22')](respondWithResult(_0x49b215,null))[_0x97a5('0x46')](handleError(_0x49b215,null));};exports[_0x97a5('0x23')]=function(_0x56890f,_0x2a6fa0){return db[_0x97a5('0x3d')]['find']({'where':{'id':_0x56890f[_0x97a5('0x40')]['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x2a6fa0,null))[_0x97a5('0x22')](removeEntity(_0x2a6fa0,null))['catch'](handleError(_0x2a6fa0,null));};exports[_0x97a5('0x48')]=function(_0xc3c9e5,_0x7adad){return db['Cdr']['describe']()[_0x97a5('0x22')](respondWithResult(_0x7adad,null))[_0x97a5('0x46')](handleError(_0x7adad,null));}; \ No newline at end of file +var _0x1dcc=['then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update'];(function(_0x2f6c7a,_0x275aa0){var _0x24ca62=function(_0xb8d471){while(--_0xb8d471){_0x2f6c7a['push'](_0x2f6c7a['shift']());}};_0x24ca62(++_0x275aa0);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x42a2cb,_0xe60f2d){_0x42a2cb=_0x42a2cb-0x0;var _0x534074=_0x1dcc[_0x42a2cb];return _0x534074;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var jsonpatch=require(_0xc1dc('0x3'));var rp=require('request-promise');var moment=require(_0xc1dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x5'));var util=require(_0xc1dc('0x6'));var path=require(_0xc1dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0xd'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xe'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xf'));var qs=require(_0xc1dc('0x10'));var as=require(_0xc1dc('0x11'));var hardwareService=require(_0xc1dc('0x12'));var logger=require(_0xc1dc('0x13'))(_0xc1dc('0x14'));var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require(_0xc1dc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226ba3,_0x2c5f41){_0x2c5f41=_0x2c5f41||0xcc;return function(_0xb7e667){if(_0xb7e667){return _0x226ba3['sendStatus'](_0x2c5f41);}return _0x226ba3[_0xc1dc('0x18')](_0x2c5f41)[_0xc1dc('0x19')]();};}function respondWithResult(_0x299520,_0xd51b1e){_0xd51b1e=_0xd51b1e||0xc8;return function(_0x145708){if(_0x145708){return _0x299520[_0xc1dc('0x18')](_0xd51b1e)[_0xc1dc('0x1a')](_0x145708);}};}function respondWithFilteredResult(_0x21aed1,_0x265929){return function(_0x37b23a){if(_0x37b23a){var _0x1cbbfe=typeof _0x265929['offset']===_0xc1dc('0x1b')&&typeof _0x265929[_0xc1dc('0x1c')]===_0xc1dc('0x1b');var _0x3d3315=_0x37b23a['count'];var _0x332400=_0x1cbbfe?0x0:_0x265929[_0xc1dc('0x1d')];var _0x499a42=_0x1cbbfe?_0x37b23a['count']:_0x265929[_0xc1dc('0x1d')]+_0x265929[_0xc1dc('0x1c')];var _0x197941;if(_0x499a42>=_0x3d3315){_0x499a42=_0x3d3315;_0x197941=0xc8;}else{_0x197941=0xce;}_0x21aed1[_0xc1dc('0x18')](_0x197941);return _0x21aed1[_0xc1dc('0x1e')](_0xc1dc('0x1f'),_0x332400+'-'+_0x499a42+'/'+_0x3d3315)[_0xc1dc('0x1a')](_0x37b23a);}return null;};}function patchUpdates(_0xd5a2e){return function(_0x5762e5){try{jsonpatch['apply'](_0x5762e5,_0xd5a2e,!![]);}catch(_0x4efe0d){return BPromise[_0xc1dc('0x20')](_0x4efe0d);}return _0x5762e5[_0xc1dc('0x21')]();};}function saveUpdates(_0x47af1e,_0x367965){return function(_0x19325f){if(_0x19325f){return _0x19325f[_0xc1dc('0x22')](_0x47af1e)[_0xc1dc('0x23')](function(_0x22b80d){return _0x22b80d;});}return null;};}function removeEntity(_0x2944a2,_0x353bf3){return function(_0x18ba56){if(_0x18ba56){return _0x18ba56[_0xc1dc('0x24')]()[_0xc1dc('0x23')](function(){_0x2944a2['status'](0xcc)[_0xc1dc('0x19')]();});}};}function handleEntityNotFound(_0xfeb0b1,_0x17ce2b){return function(_0x52b0b9){if(!_0x52b0b9){_0xfeb0b1['sendStatus'](0x194);}return _0x52b0b9;};}function handleError(_0x296523,_0x109e88){_0x109e88=_0x109e88||0x1f4;return function(_0xfd3f88){logger[_0xc1dc('0x25')](_0xfd3f88[_0xc1dc('0x26')]);if(_0xfd3f88[_0xc1dc('0x27')]){delete _0xfd3f88[_0xc1dc('0x27')];}_0x296523[_0xc1dc('0x18')](_0x109e88)[_0xc1dc('0x28')](_0xfd3f88);};}exports['index']=function(_0x2d5a57,_0x25b7bf){var _0xd77537={},_0x27e54d={},_0x52b0ff={'count':0x0,'rows':[]};var _0x4750a9=_[_0xc1dc('0x29')](db[_0xc1dc('0x2a')][_0xc1dc('0x2b')],function(_0x1182a4){return{'name':_0x1182a4[_0xc1dc('0x2c')],'type':_0x1182a4['type'][_0xc1dc('0x2d')]};});_0x27e54d[_0xc1dc('0x2e')]=_[_0xc1dc('0x29')](_0x4750a9,_0xc1dc('0x27'));_0x27e54d[_0xc1dc('0x2f')]=_[_0xc1dc('0x30')](_0x2d5a57[_0xc1dc('0x2f')]);_0x27e54d[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x27e54d['model'],_0x27e54d['query']);_0xd77537[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x27e54d[_0xc1dc('0x2e')],qs[_0xc1dc('0x34')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x34')]));_0xd77537['attributes']=_0xd77537[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0xd77537['attributes']:_0x27e54d[_0xc1dc('0x2e')];if(!_0x2d5a57[_0xc1dc('0x2f')]['hasOwnProperty'](_0xc1dc('0x36'))){_0xd77537[_0xc1dc('0x1c')]=qs[_0xc1dc('0x1c')](_0x2d5a57['query'][_0xc1dc('0x1c')]);_0xd77537[_0xc1dc('0x1d')]=qs[_0xc1dc('0x1d')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0xd77537[_0xc1dc('0x37')]=qs[_0xc1dc('0x38')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x38')]);_0xd77537['where']=qs[_0xc1dc('0x31')](_[_0xc1dc('0x39')](_0x2d5a57[_0xc1dc('0x2f')],_0x27e54d['filters']),_0x4750a9);if(_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]){_0xd77537[_0xc1dc('0x3b')]=_[_0xc1dc('0x3c')](_0xd77537[_0xc1dc('0x3b')],{'$or':_[_0xc1dc('0x29')](_0x4750a9,function(_0x2e8d34){if(_0x2e8d34[_0xc1dc('0x3d')]!=='VIRTUAL'){var _0x16356d={};_0x16356d[_0x2e8d34[_0xc1dc('0x27')]]={'$like':'%'+_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]+'%'};return _0x16356d;}})});}_0xd77537=_[_0xc1dc('0x3c')]({},_0xd77537,_0x2d5a57[_0xc1dc('0x3e')]);var _0x503ec8={'where':_0xd77537[_0xc1dc('0x3b')]};return db[_0xc1dc('0x2a')][_0xc1dc('0x3f')](_0x503ec8)[_0xc1dc('0x23')](function(_0x1bcf3d){_0x52b0ff['count']=_0x1bcf3d;if(_0x2d5a57['query'][_0xc1dc('0x40')]){_0xd77537[_0xc1dc('0x41')]=[{'all':!![]}];}return db[_0xc1dc('0x2a')][_0xc1dc('0x42')](_0xd77537);})[_0xc1dc('0x23')](function(_0x2b4190){_0x52b0ff[_0xc1dc('0x43')]=_0x2b4190;return _0x52b0ff;})['then'](respondWithFilteredResult(_0x25b7bf,_0xd77537))[_0xc1dc('0x44')](handleError(_0x25b7bf,null));};exports[_0xc1dc('0x45')]=function(_0xe5c170,_0x4f99ea){var _0x402d3a={'raw':!![],'where':{'id':_0xe5c170[_0xc1dc('0x46')]['id']}},_0x2f52f7={};_0x2f52f7[_0xc1dc('0x2e')]=_['keys'](db['Cdr'][_0xc1dc('0x2b')]);_0x2f52f7[_0xc1dc('0x2f')]=_['keys'](_0xe5c170[_0xc1dc('0x2f')]);_0x2f52f7[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x2f52f7[_0xc1dc('0x2e')],_0x2f52f7[_0xc1dc('0x2f')]);_0x402d3a[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x2f52f7['model'],qs['fields'](_0xe5c170[_0xc1dc('0x2f')]['fields']));_0x402d3a[_0xc1dc('0x33')]=_0x402d3a[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0x402d3a[_0xc1dc('0x33')]:_0x2f52f7[_0xc1dc('0x2e')];if(_0xe5c170[_0xc1dc('0x2f')][_0xc1dc('0x40')]){_0x402d3a[_0xc1dc('0x41')]=[{'all':!![]}];}_0x402d3a=_['merge']({},_0x402d3a,_0xe5c170[_0xc1dc('0x3e')]);return db[_0xc1dc('0x2a')][_0xc1dc('0x47')](_0x402d3a)[_0xc1dc('0x23')](handleEntityNotFound(_0x4f99ea,null))[_0xc1dc('0x23')](respondWithResult(_0x4f99ea,null))[_0xc1dc('0x44')](handleError(_0x4f99ea,null));};exports[_0xc1dc('0x48')]=function(_0x9a48b7,_0x2ca7f1){return db[_0xc1dc('0x2a')]['create'](_0x9a48b7['body'],{})['then'](respondWithResult(_0x2ca7f1,0xc9))[_0xc1dc('0x44')](handleError(_0x2ca7f1,null));};exports[_0xc1dc('0x22')]=function(_0x57b792,_0x129e23){if(_0x57b792[_0xc1dc('0x49')]['id']){delete _0x57b792['body']['id'];}return db[_0xc1dc('0x2a')]['find']({'where':{'id':_0x57b792[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0x23')](saveUpdates(_0x57b792[_0xc1dc('0x49')],null))[_0xc1dc('0x23')](respondWithResult(_0x129e23,null))[_0xc1dc('0x44')](handleError(_0x129e23,null));};exports[_0xc1dc('0x24')]=function(_0x34667b,_0x4d4240){return db[_0xc1dc('0x2a')][_0xc1dc('0x47')]({'where':{'id':_0x34667b[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x4d4240,null))['then'](removeEntity(_0x4d4240,null))[_0xc1dc('0x44')](handleError(_0x4d4240,null));};exports[_0xc1dc('0x4a')]=function(_0x3e3e6c,_0x1755cb){return db[_0xc1dc('0x2a')][_0xc1dc('0x4a')]()[_0xc1dc('0x23')](respondWithResult(_0x1755cb,null))[_0xc1dc('0x44')](handleError(_0x1755cb,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 27badeb..f7f1220 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x46957b,_0x1dc98c){var _0x554ab9=function(_0x5283f2){while(--_0x5283f2){_0x46957b['push'](_0x46957b['shift']());}};_0x554ab9(++_0x1dc98c);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3b1e17,_0x2fe839){var _0x4e3468=function(_0x9d6678){while(--_0x9d6678){_0x3b1e17['push'](_0x3b1e17['shift']());}};_0x4e3468(++_0x2fe839);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 7b10aae..ea07c90 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 _0xe06a=['message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c2289,_0x1ddd5e){var _0xc2d91d=function(_0x36221f){while(--_0x36221f){_0x2c2289['push'](_0x2c2289['shift']());}};_0xc2d91d(++_0x1ddd5e);}(_0xe06a,0xfe));var _0xae06=function(_0x334ff4,_0x29c919){_0x334ff4=_0x334ff4-0x0;var _0x564843=_0xe06a[_0x334ff4];return _0x564843;};'use strict';var _=require('lodash');var util=require(_0xae06('0x0'));var moment=require('moment');var BPromise=require(_0xae06('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae06('0x2'));var db=require(_0xae06('0x3'))['db'];var utils=require(_0xae06('0x4'));var logger=require(_0xae06('0x5'))(_0xae06('0x6'));var config=require('../../config/environment');var jayson=require(_0xae06('0x7'));var client=jayson[_0xae06('0x8')][_0xae06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28ecab,_0x42c989,_0x850dad){return new BPromise(function(_0x6cb376,_0xbb21d8){return client[_0xae06('0xa')](_0x28ecab,_0x850dad)[_0xae06('0xb')](function(_0x28e609){logger[_0xae06('0xc')](_0xae06('0xd'),_0x42c989,_0xae06('0xe'));logger[_0xae06('0xf')](_0xae06('0x10'),_0x42c989,_0xae06('0xe'),JSON[_0xae06('0x11')](_0x28e609));if(_0x28e609[_0xae06('0x12')]){if(_0x28e609['error']['code']===0x1f4){logger[_0xae06('0x12')](_0xae06('0xd'),_0x42c989,_0x28e609[_0xae06('0x12')][_0xae06('0x13')]);return _0xbb21d8(_0x28e609['error']['message']);}logger[_0xae06('0x12')](_0xae06('0xd'),_0x42c989,_0x28e609[_0xae06('0x12')][_0xae06('0x13')]);return _0x6cb376(_0x28e609['error'][_0xae06('0x13')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x42c989,'request\x20sent');_0x6cb376(_0x28e609['result'][_0xae06('0x13')]);}})[_0xae06('0x14')](function(_0x4e50df){logger[_0xae06('0x12')](_0xae06('0xd'),_0x42c989,_0x4e50df);_0xbb21d8(_0x4e50df);});});} \ No newline at end of file +var _0xe9af=['then','info','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xe9af,0xc7));var _0xfe9a=function(_0x35735d,_0x2d32de){_0x35735d=_0x35735d-0x0;var _0x5b75de=_0xe9af[_0x35735d];return _0x5b75de;};'use strict';var _=require(_0xfe9a('0x0'));var util=require(_0xfe9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe9a('0x2'));var db=require(_0xfe9a('0x3'))['db'];var utils=require(_0xfe9a('0x4'));var logger=require('../../config/logger')(_0xfe9a('0x5'));var config=require(_0xfe9a('0x6'));var jayson=require(_0xfe9a('0x7'));var client=jayson['client'][_0xfe9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x130f2a,_0x39a5a6,_0x3299c4){return new BPromise(function(_0x2a9550,_0x5661f0){return client[_0xfe9a('0x9')](_0x130f2a,_0x3299c4)[_0xfe9a('0xa')](function(_0x46b0c7){logger[_0xfe9a('0xb')]('Cdr,\x20%s,\x20%s',_0x39a5a6,'request\x20sent');logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x39a5a6,'request\x20sent',JSON[_0xfe9a('0xc')](_0x46b0c7));if(_0x46b0c7['error']){if(_0x46b0c7[_0xfe9a('0xd')][_0xfe9a('0xe')]===0x1f4){logger[_0xfe9a('0xd')](_0xfe9a('0xf'),_0x39a5a6,_0x46b0c7['error']['message']);return _0x5661f0(_0x46b0c7['error'][_0xfe9a('0x10')]);}logger['error'](_0xfe9a('0xf'),_0x39a5a6,_0x46b0c7[_0xfe9a('0xd')]['message']);return _0x2a9550(_0x46b0c7[_0xfe9a('0xd')]['message']);}else{logger['info'](_0xfe9a('0xf'),_0x39a5a6,'request\x20sent');_0x2a9550(_0x46b0c7[_0xfe9a('0x11')][_0xfe9a('0x10')]);}})[_0xfe9a('0x12')](function(_0x40e3d8){logger[_0xfe9a('0xd')]('Cdr,\x20%s,\x20%s',_0x39a5a6,_0x40e3d8);_0x5661f0(_0x40e3d8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0bbf5e2..64c16ba 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(_0x6be9d9,_0x153d7e){var _0x43858f=function(_0x10bc51){while(--_0x10bc51){_0x6be9d9['push'](_0x6be9d9['shift']());}};_0x43858f(++_0x153d7e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x3efcbd,_0x5ecdfa){var _0x1ccb1e=function(_0x58f752){while(--_0x58f752){_0x3efcbd['push'](_0x3efcbd['shift']());}};_0x1ccb1e(++_0x5ecdfa);}(_0xb10b,0x12a));var _0xbb10=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xb10b[_0x13137e];return _0x346261;};'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 d028252..6bafb42 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 _0x87c9=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x15c9d8,_0x57b9f5){var _0x59879f=function(_0xdfa8b3){while(--_0xdfa8b3){_0x15c9d8['push'](_0x15c9d8['shift']());}};_0x59879f(++_0x57b9f5);}(_0x87c9,0x1d7));var _0x987c=function(_0x3a1aaf,_0x15658d){_0x3a1aaf=_0x3a1aaf-0x0;var _0x1e5119=_0x87c9[_0x3a1aaf];return _0x1e5119;};'use strict';var Sequelize=require(_0x987c('0x0'));module[_0x987c('0x1')]={'priority':{'type':Sequelize[_0x987c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x987c('0x3')],'allowNull':![],'defaultValue':_0x987c('0x4')},'appdata':{'type':Sequelize[_0x987c('0x5')]()},'description':{'type':Sequelize[_0x987c('0x3')]},'interval':{'type':Sequelize[_0x987c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6426=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x6426,0xd6));var _0x6642=function(_0x42b71c,_0x1204d9){_0x42b71c=_0x42b71c-0x0;var _0x52d9e1=_0x6426[_0x42b71c];return _0x52d9e1;};'use strict';var Sequelize=require(_0x6642('0x0'));module[_0x6642('0x1')]={'priority':{'type':Sequelize[_0x6642('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6642('0x3')],'allowNull':![],'defaultValue':_0x6642('0x4')},'appdata':{'type':Sequelize[_0x6642('0x5')]()},'description':{'type':Sequelize[_0x6642('0x3')]},'interval':{'type':Sequelize[_0x6642('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c9db9ed..a19fc3f 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 _0xa25c=['end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','includeAll','merge','options','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3ada37,_0x3376a2){var _0x5185e5=function(_0x2b7342){while(--_0x2b7342){_0x3ada37['push'](_0x3ada37['shift']());}};_0x5185e5(++_0x3376a2);}(_0xa25c,0x13f));var _0xca25=function(_0x81e5d9,_0x4493fc){_0x81e5d9=_0x81e5d9-0x0;var _0x1d00f6=_0xa25c[_0x81e5d9];return _0x1d00f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)[_0xca25('0x17')]();});}};}function handleEntityNotFound(_0x20dc6d,_0x4dffad){return function(_0x1aa848){if(!_0x1aa848){_0x20dc6d[_0xca25('0x24')](0x194);}return _0x1aa848;};}function handleError(_0x7ceacb,_0x374cde){_0x374cde=_0x374cde||0x1f4;return function(_0x220546){logger['error'](_0x220546[_0xca25('0x25')]);if(_0x220546[_0xca25('0x26')]){delete _0x220546[_0xca25('0x26')];}_0x7ceacb[_0xca25('0x16')](_0x374cde)[_0xca25('0x27')](_0x220546);};}exports[_0xca25('0x28')]=function(_0xfd888c,_0x1660a5){var _0x3e72cb={'raw':!![],'where':{'id':_0xfd888c[_0xca25('0x29')]['id']}},_0x7b67f4={};_0x7b67f4[_0xca25('0x2a')]=_[_0xca25('0x2b')](db[_0xca25('0x2c')][_0xca25('0x2d')]);_0x7b67f4[_0xca25('0x2e')]=_[_0xca25('0x2b')](_0xfd888c[_0xca25('0x2e')]);_0x7b67f4['filters']=_[_0xca25('0x2f')](_0x7b67f4[_0xca25('0x2a')],_0x7b67f4[_0xca25('0x2e')]);_0x3e72cb['attributes']=_[_0xca25('0x2f')](_0x7b67f4[_0xca25('0x2a')],qs[_0xca25('0x30')](_0xfd888c[_0xca25('0x2e')][_0xca25('0x30')]));_0x3e72cb[_0xca25('0x31')]=_0x3e72cb['attributes'][_0xca25('0x32')]?_0x3e72cb['attributes']:_0x7b67f4[_0xca25('0x2a')];if(_0xfd888c[_0xca25('0x2e')][_0xca25('0x33')]){_0x3e72cb['include']=[{'all':!![]}];}_0x3e72cb=_[_0xca25('0x34')]({},_0x3e72cb,_0xfd888c[_0xca25('0x35')]);return db[_0xca25('0x2c')][_0xca25('0x36')](_0x3e72cb)[_0xca25('0x22')](handleEntityNotFound(_0x1660a5,null))['then'](respondWithResult(_0x1660a5,null))[_0xca25('0x37')](handleError(_0x1660a5,null));};exports[_0xca25('0x21')]=function(_0x13649a,_0x1d118a){if(_0x13649a[_0xca25('0x38')]['id']){delete _0x13649a[_0xca25('0x38')]['id'];}return db[_0xca25('0x2c')]['find']({'where':{'id':_0x13649a['params']['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x1d118a,null))[_0xca25('0x22')](saveUpdates(_0x13649a['body'],null))['then'](respondWithResult(_0x1d118a,null))[_0xca25('0x37')](handleError(_0x1d118a,null));};exports[_0xca25('0x23')]=function(_0x321272,_0x5f44cb){return db[_0xca25('0x2c')][_0xca25('0x36')]({'where':{'id':_0x321272[_0xca25('0x29')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x5f44cb,null))[_0xca25('0x22')](removeEntity(_0x5f44cb,null))[_0xca25('0x37')](handleError(_0x5f44cb,null));}; \ No newline at end of file +var _0x21a3=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','find','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs'];(function(_0x532903,_0x2f1742){var _0xa75503=function(_0x21777b){while(--_0x21777b){_0x532903['push'](_0x532903['shift']());}};_0xa75503(++_0x2f1742);}(_0x21a3,0x66));var _0x321a=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0x21a3[_0xb4788];return _0xd49d21;};'use strict';var emlformat=require(_0x321a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x321a('0x1'));var jsonpatch=require(_0x321a('0x2'));var rp=require(_0x321a('0x3'));var moment=require(_0x321a('0x4'));var BPromise=require(_0x321a('0x5'));var Mustache=require(_0x321a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x321a('0x7'));var csv=require(_0x321a('0x8'));var ejs=require(_0x321a('0x9'));var fs=require('fs');var fs_extra=require(_0x321a('0xa'));var _=require('lodash');var squel=require(_0x321a('0xb'));var crypto=require(_0x321a('0xc'));var jsforce=require(_0x321a('0xd'));var deskjs=require(_0x321a('0xe'));var toCsv=require(_0x321a('0x8'));var querystring=require(_0x321a('0xf'));var Papa=require(_0x321a('0x10'));var Redis=require(_0x321a('0x11'));var authService=require(_0x321a('0x12'));var qs=require(_0x321a('0x13'));var as=require(_0x321a('0x14'));var hardwareService=require(_0x321a('0x15'));var logger=require('../../config/logger')(_0x321a('0x16'));var utils=require(_0x321a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x321a('0x18'))['db'];function respondWithStatusCode(_0x4f6fcc,_0x26cc62){_0x26cc62=_0x26cc62||0xcc;return function(_0x1390bb){if(_0x1390bb){return _0x4f6fcc['sendStatus'](_0x26cc62);}return _0x4f6fcc['status'](_0x26cc62)[_0x321a('0x19')]();};}function respondWithResult(_0x123b53,_0x13a73b){_0x13a73b=_0x13a73b||0xc8;return function(_0x3677f9){if(_0x3677f9){return _0x123b53[_0x321a('0x1a')](_0x13a73b)[_0x321a('0x1b')](_0x3677f9);}};}function respondWithFilteredResult(_0x14044b,_0xfe6906){return function(_0x5e0895){if(_0x5e0895){var _0x11d623=typeof _0xfe6906[_0x321a('0x1c')]==='undefined'&&typeof _0xfe6906[_0x321a('0x1d')]===_0x321a('0x1e');var _0x460de1=_0x5e0895['count'];var _0x5b1810=_0x11d623?0x0:_0xfe6906[_0x321a('0x1c')];var _0x35fd6f=_0x11d623?_0x5e0895['count']:_0xfe6906[_0x321a('0x1c')]+_0xfe6906[_0x321a('0x1d')];var _0x15eff4;if(_0x35fd6f>=_0x460de1){_0x35fd6f=_0x460de1;_0x15eff4=0xc8;}else{_0x15eff4=0xce;}_0x14044b['status'](_0x15eff4);return _0x14044b[_0x321a('0x1f')](_0x321a('0x20'),_0x5b1810+'-'+_0x35fd6f+'/'+_0x460de1)[_0x321a('0x1b')](_0x5e0895);}return null;};}function patchUpdates(_0x423cb8){return function(_0x2c3a70){try{jsonpatch[_0x321a('0x21')](_0x2c3a70,_0x423cb8,!![]);}catch(_0x16ad4b){return BPromise[_0x321a('0x22')](_0x16ad4b);}return _0x2c3a70[_0x321a('0x23')]();};}function saveUpdates(_0x2765e5,_0x1b94a1){return function(_0x225efb){if(_0x225efb){return _0x225efb['update'](_0x2765e5)[_0x321a('0x24')](function(_0x8a9206){return _0x8a9206;});}return null;};}function removeEntity(_0x1ad8b8,_0x5ae154){return function(_0x26da8e){if(_0x26da8e){return _0x26da8e[_0x321a('0x25')]()['then'](function(){_0x1ad8b8['status'](0xcc)[_0x321a('0x19')]();});}};}function handleEntityNotFound(_0x5a66c2,_0x9c11b6){return function(_0x348ea9){if(!_0x348ea9){_0x5a66c2[_0x321a('0x26')](0x194);}return _0x348ea9;};}function handleError(_0x24b3dd,_0x37ad07){_0x37ad07=_0x37ad07||0x1f4;return function(_0xdce138){logger['error'](_0xdce138['stack']);if(_0xdce138[_0x321a('0x27')]){delete _0xdce138[_0x321a('0x27')];}_0x24b3dd[_0x321a('0x1a')](_0x37ad07)['send'](_0xdce138);};}exports[_0x321a('0x28')]=function(_0x46eec2,_0x190d81){var _0x56210a={'raw':!![],'where':{'id':_0x46eec2[_0x321a('0x29')]['id']}},_0x8a09bb={};_0x8a09bb[_0x321a('0x2a')]=_[_0x321a('0x2b')](db[_0x321a('0x2c')][_0x321a('0x2d')]);_0x8a09bb[_0x321a('0x2e')]=_[_0x321a('0x2b')](_0x46eec2[_0x321a('0x2e')]);_0x8a09bb['filters']=_[_0x321a('0x2f')](_0x8a09bb[_0x321a('0x2a')],_0x8a09bb[_0x321a('0x2e')]);_0x56210a[_0x321a('0x30')]=_[_0x321a('0x2f')](_0x8a09bb[_0x321a('0x2a')],qs['fields'](_0x46eec2['query'][_0x321a('0x31')]));_0x56210a['attributes']=_0x56210a[_0x321a('0x30')][_0x321a('0x32')]?_0x56210a[_0x321a('0x30')]:_0x8a09bb['model'];if(_0x46eec2['query'][_0x321a('0x33')]){_0x56210a['include']=[{'all':!![]}];}_0x56210a=_[_0x321a('0x34')]({},_0x56210a,_0x46eec2['options']);return db['ChatApplication'][_0x321a('0x35')](_0x56210a)[_0x321a('0x24')](handleEntityNotFound(_0x190d81,null))[_0x321a('0x24')](respondWithResult(_0x190d81,null))['catch'](handleError(_0x190d81,null));};exports['update']=function(_0x51ed06,_0x1bc8dc){if(_0x51ed06[_0x321a('0x36')]['id']){delete _0x51ed06['body']['id'];}return db['ChatApplication'][_0x321a('0x35')]({'where':{'id':_0x51ed06[_0x321a('0x29')]['id']}})[_0x321a('0x24')](handleEntityNotFound(_0x1bc8dc,null))[_0x321a('0x24')](saveUpdates(_0x51ed06[_0x321a('0x36')],null))[_0x321a('0x24')](respondWithResult(_0x1bc8dc,null))['catch'](handleError(_0x1bc8dc,null));};exports[_0x321a('0x25')]=function(_0x2a9a33,_0x31a2fd){return db[_0x321a('0x2c')]['find']({'where':{'id':_0x2a9a33[_0x321a('0x29')]['id']}})['then'](handleEntityNotFound(_0x31a2fd,null))['then'](removeEntity(_0x31a2fd,null))[_0x321a('0x37')](handleError(_0x31a2fd,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ea887c1..24f0320 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 _0x0cc3=['chat_applications','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x58fb25,_0x1b350b){var _0x458b26=function(_0x5a1cec){while(--_0x5a1cec){_0x58fb25['push'](_0x58fb25['shift']());}};_0x458b26(++_0x1b350b);}(_0x0cc3,0x195));var _0x30cc=function(_0x1daa0b,_0x3025b4){_0x1daa0b=_0x1daa0b-0x0;var _0x9a997b=_0x0cc3[_0x1daa0b];return _0x9a997b;};'use strict';var _=require(_0x30cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30cc('0x1'));var moment=require('moment');var BPromise=require(_0x30cc('0x2'));var rp=require(_0x30cc('0x3'));var fs=require('fs');var path=require(_0x30cc('0x4'));var rimraf=require(_0x30cc('0x5'));var config=require(_0x30cc('0x6'));var attributes=require(_0x30cc('0x7'));module[_0x30cc('0x8')]=function(_0x56b7b6,_0x255ccf){return _0x56b7b6[_0x30cc('0x9')](_0x30cc('0xa'),attributes,{'tableName':_0x30cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x30cc('0xc')});}; \ No newline at end of file +var _0xe27c=['bluebird','request-promise','rimraf','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5b4f98,_0x4e2213){var _0x1f5022=function(_0x32b3f5){while(--_0x32b3f5){_0x5b4f98['push'](_0x5b4f98['shift']());}};_0x1f5022(++_0x4e2213);}(_0xe27c,0xec));var _0xce27=function(_0x22f8d8,_0x537e53){_0x22f8d8=_0x22f8d8-0x0;var _0x4cf09c=_0xe27c[_0x22f8d8];return _0x4cf09c;};'use strict';var _=require(_0xce27('0x0'));var util=require(_0xce27('0x1'));var logger=require(_0xce27('0x2'))(_0xce27('0x3'));var moment=require('moment');var BPromise=require(_0xce27('0x4'));var rp=require(_0xce27('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce27('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module['exports']=function(_0x42c128,_0x586471){return _0x42c128['define'](_0xce27('0x7'),attributes,{'tableName':_0xce27('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce27('0x9')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5baa2c2..0511896 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 _0x9d62=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','catch','lodash','util'];(function(_0x3328ff,_0x2f9e64){var _0x5df2da=function(_0xd6de5f){while(--_0xd6de5f){_0x3328ff['push'](_0x3328ff['shift']());}};_0x5df2da(++_0x2f9e64);}(_0x9d62,0xb2));var _0x29d6=function(_0x153068,_0x4bbaf8){_0x153068=_0x153068-0x0;var _0x4f23d6=_0x9d62[_0x153068];return _0x4f23d6;};'use strict';var _=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var moment=require('moment');var BPromise=require(_0x29d6('0x2'));var rs=require(_0x29d6('0x3'));var fs=require('fs');var Redis=require(_0x29d6('0x4'));var db=require(_0x29d6('0x5'))['db'];var utils=require(_0x29d6('0x6'));var logger=require('../../config/logger')(_0x29d6('0x7'));var config=require(_0x29d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x29d6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d997f,_0x4334af,_0xa75415){return new BPromise(function(_0xc15b48,_0x543e2a){return client['request'](_0x2d997f,_0xa75415)['then'](function(_0x8e94c6){logger[_0x29d6('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4334af,'request\x20sent');logger[_0x29d6('0xb')](_0x29d6('0xc'),_0x4334af,_0x29d6('0xd'),JSON[_0x29d6('0xe')](_0x8e94c6));if(_0x8e94c6['error']){if(_0x8e94c6[_0x29d6('0xf')][_0x29d6('0x10')]===0x1f4){logger[_0x29d6('0xf')]('ChatApplication,\x20%s,\x20%s',_0x4334af,_0x8e94c6[_0x29d6('0xf')][_0x29d6('0x11')]);return _0x543e2a(_0x8e94c6[_0x29d6('0xf')][_0x29d6('0x11')]);}logger[_0x29d6('0xf')]('ChatApplication,\x20%s,\x20%s',_0x4334af,_0x8e94c6['error'][_0x29d6('0x11')]);return _0xc15b48(_0x8e94c6['error'][_0x29d6('0x11')]);}else{logger[_0x29d6('0xa')](_0x29d6('0x12'),_0x4334af,_0x29d6('0xd'));_0xc15b48(_0x8e94c6['result'][_0x29d6('0x11')]);}})[_0x29d6('0x13')](function(_0x34c613){logger['error'](_0x29d6('0x12'),_0x4334af,_0x34c613);_0x543e2a(_0x34c613);});});} \ No newline at end of file +var _0x05b3=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x05b3,0xbe));var _0x305b=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x05b3[_0x406696];return _0x10e35c;};'use strict';var _=require(_0x305b('0x0'));var util=require(_0x305b('0x1'));var moment=require(_0x305b('0x2'));var BPromise=require(_0x305b('0x3'));var rs=require(_0x305b('0x4'));var fs=require('fs');var Redis=require(_0x305b('0x5'));var db=require(_0x305b('0x6'))['db'];var utils=require(_0x305b('0x7'));var logger=require(_0x305b('0x8'))('rpc');var config=require(_0x305b('0x9'));var jayson=require(_0x305b('0xa'));var client=jayson[_0x305b('0xb')][_0x305b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5148ef,_0x4383b5,_0x532b0a){return new BPromise(function(_0x567b20,_0x5928ce){return client['request'](_0x5148ef,_0x532b0a)['then'](function(_0x1e45c9){logger[_0x305b('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4383b5,_0x305b('0xe'));logger[_0x305b('0xf')](_0x305b('0x10'),_0x4383b5,_0x305b('0xe'),JSON[_0x305b('0x11')](_0x1e45c9));if(_0x1e45c9[_0x305b('0x12')]){if(_0x1e45c9[_0x305b('0x12')][_0x305b('0x13')]===0x1f4){logger[_0x305b('0x12')](_0x305b('0x14'),_0x4383b5,_0x1e45c9[_0x305b('0x12')]['message']);return _0x5928ce(_0x1e45c9['error'][_0x305b('0x15')]);}logger['error'](_0x305b('0x14'),_0x4383b5,_0x1e45c9['error']['message']);return _0x567b20(_0x1e45c9[_0x305b('0x12')][_0x305b('0x15')]);}else{logger[_0x305b('0xd')](_0x305b('0x14'),_0x4383b5,'request\x20sent');_0x567b20(_0x1e45c9[_0x305b('0x16')][_0x305b('0x15')]);}})['catch'](function(_0x2f14c6){logger[_0x305b('0x12')](_0x305b('0x14'),_0x4383b5,_0x2f14c6);_0x5928ce(_0x2f14c6);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6571043..f6fae45 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 _0xea83=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x374fc3,_0x1c8a85){var _0x3d9744=function(_0x1b66a8){while(--_0x1b66a8){_0x374fc3['push'](_0x374fc3['shift']());}};_0x3d9744(++_0x1c8a85);}(_0xea83,0x8d));var _0x3ea8=function(_0x4474c2,_0x59cf02){_0x4474c2=_0x4474c2-0x0;var _0x435fbb=_0xea83[_0x4474c2];return _0x435fbb;};'use strict';var multer=require(_0x3ea8('0x0'));var util=require(_0x3ea8('0x1'));var path=require(_0x3ea8('0x2'));var timeout=require(_0x3ea8('0x3'));var express=require(_0x3ea8('0x4'));var router=express[_0x3ea8('0x5')]();var fs_extra=require(_0x3ea8('0x6'));var auth=require(_0x3ea8('0x7'));var interaction=require(_0x3ea8('0x8'));var config=require('../../config/environment');var controller=require(_0x3ea8('0x9'));router[_0x3ea8('0xa')](_0x3ea8('0xb'),auth[_0x3ea8('0xc')](),controller[_0x3ea8('0xd')]);router[_0x3ea8('0xe')]('/:id',auth[_0x3ea8('0xc')](),controller[_0x3ea8('0xf')]);router[_0x3ea8('0x10')](_0x3ea8('0xb'),auth['isAuthenticated'](),controller[_0x3ea8('0x11')]);module[_0x3ea8('0x12')]=router; \ No newline at end of file +var _0x3d4b=['util','connect-timeout','express','Router','../../components/auth/service','get','/:id','show','put','update','destroy','exports','multer'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3d4b,0x1ac));var _0xb3d4=function(_0x57dc5f,_0x1baa29){_0x57dc5f=_0x57dc5f-0x0;var _0x23a288=_0x3d4b[_0x57dc5f];return _0x23a288;};'use strict';var multer=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var path=require('path');var timeout=require(_0xb3d4('0x2'));var express=require(_0xb3d4('0x3'));var router=express[_0xb3d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3d4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xb3d4('0x6')](_0xb3d4('0x7'),auth['isAuthenticated'](),controller[_0xb3d4('0x8')]);router[_0xb3d4('0x9')](_0xb3d4('0x7'),auth['isAuthenticated'](),controller[_0xb3d4('0xa')]);router['delete'](_0xb3d4('0x7'),auth['isAuthenticated'](),controller[_0xb3d4('0xb')]);module[_0xb3d4('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6cf66e0..4559b6a 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 _0xabac=['sequelize','exports','STRING'];(function(_0x17b4c1,_0x2377a5){var _0xf38f21=function(_0x4b1f4d){while(--_0x4b1f4d){_0x17b4c1['push'](_0x17b4c1['shift']());}};_0xf38f21(++_0x2377a5);}(_0xabac,0x1dd));var _0xcaba=function(_0x2ad792,_0x481da1){_0x2ad792=_0x2ad792-0x0;var _0xd8386e=_0xabac[_0x2ad792];return _0xd8386e;};'use strict';var Sequelize=require(_0xcaba('0x0'));module[_0xcaba('0x1')]={'name':{'type':Sequelize[_0xcaba('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x63ea=['BOOLEAN','sequelize','exports'];(function(_0x5d4752,_0x19fbf9){var _0x12f5ee=function(_0x4146bb){while(--_0x4146bb){_0x5d4752['push'](_0x5d4752['shift']());}};_0x12f5ee(++_0x19fbf9);}(_0x63ea,0xb5));var _0xa63e=function(_0x360a82,_0x4f2348){_0x360a82=_0x360a82-0x0;var _0x45f1ac=_0x63ea[_0x360a82];return _0x45f1ac;};'use strict';var Sequelize=require(_0xa63e('0x0'));module[_0xa63e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa63e('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3b5df79..57b33ce 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 _0x39b7=['sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','stack','name','index','rawAttributes','fieldName','type','map','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','ChatGroup','keys','catch','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','nolimit','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./chatGroup.socket','register'];(function(_0x154e01,_0x2dfeb0){var _0x45d297=function(_0x318f8f){while(--_0x318f8f){_0x154e01['push'](_0x154e01['shift']());}};_0x45d297(++_0x2dfeb0);}(_0x39b7,0xf9));var _0x739b=function(_0x4b2ef6,_0x2aa7d0){_0x4b2ef6=_0x4b2ef6-0x0;var _0x5f355f=_0x39b7[_0x4b2ef6];return _0x5f355f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x739b('0x0'));var jsonpatch=require(_0x739b('0x1'));var rp=require('request-promise');var moment=require(_0x739b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x739b('0x3'));var util=require('util');var path=require(_0x739b('0x4'));var sox=require(_0x739b('0x5'));var csv=require('to-csv');var ejs=require(_0x739b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x739b('0x7'));var squel=require(_0x739b('0x8'));var crypto=require('crypto');var jsforce=require(_0x739b('0x9'));var deskjs=require(_0x739b('0xa'));var toCsv=require(_0x739b('0xb'));var querystring=require(_0x739b('0xc'));var Papa=require(_0x739b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x739b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x739b('0xf'));var logger=require(_0x739b('0x10'))(_0x739b('0x11'));var utils=require(_0x739b('0x12'));var config=require(_0x739b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x739b('0x14'))['db'];config[_0x739b('0x15')]=_['defaults'](config[_0x739b('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x739b('0x15')]));require(_0x739b('0x16'))[_0x739b('0x17')](socket);function respondWithStatusCode(_0x2ddd2c,_0x3ab15d){_0x3ab15d=_0x3ab15d||0xcc;return function(_0x5c53ae){if(_0x5c53ae){return _0x2ddd2c[_0x739b('0x18')](_0x3ab15d);}return _0x2ddd2c[_0x739b('0x19')](_0x3ab15d)[_0x739b('0x1a')]();};}function respondWithResult(_0x56cbea,_0x1852e1){_0x1852e1=_0x1852e1||0xc8;return function(_0x434e46){if(_0x434e46){return _0x56cbea[_0x739b('0x19')](_0x1852e1)[_0x739b('0x1b')](_0x434e46);}};}function respondWithFilteredResult(_0x1bf56a,_0x1b1a82){return function(_0x2879f8){if(_0x2879f8){var _0x471a5b=typeof _0x1b1a82[_0x739b('0x1c')]===_0x739b('0x1d')&&typeof _0x1b1a82['limit']===_0x739b('0x1d');var _0x36bdf4=_0x2879f8[_0x739b('0x1e')];var _0x29add4=_0x471a5b?0x0:_0x1b1a82['offset'];var _0x5656d2=_0x471a5b?_0x2879f8[_0x739b('0x1e')]:_0x1b1a82[_0x739b('0x1c')]+_0x1b1a82[_0x739b('0x1f')];var _0x1fb5ef;if(_0x5656d2>=_0x36bdf4){_0x5656d2=_0x36bdf4;_0x1fb5ef=0xc8;}else{_0x1fb5ef=0xce;}_0x1bf56a[_0x739b('0x19')](_0x1fb5ef);return _0x1bf56a[_0x739b('0x20')]('Content-Range',_0x29add4+'-'+_0x5656d2+'/'+_0x36bdf4)[_0x739b('0x1b')](_0x2879f8);}return null;};}function patchUpdates(_0x1ecd2e){return function(_0x432b6b){try{jsonpatch[_0x739b('0x21')](_0x432b6b,_0x1ecd2e,!![]);}catch(_0x23acfb){return BPromise[_0x739b('0x22')](_0x23acfb);}return _0x432b6b['save']();};}function saveUpdates(_0x4af669,_0x28168d){return function(_0x413940){if(_0x413940){return _0x413940[_0x739b('0x23')](_0x4af669)['then'](function(_0x5e2781){return _0x5e2781;});}return null;};}function removeEntity(_0x17c430,_0x47ea9a){return function(_0xdd8efa){if(_0xdd8efa){return _0xdd8efa[_0x739b('0x24')]()['then'](function(){_0x17c430[_0x739b('0x19')](0xcc)[_0x739b('0x1a')]();});}};}function handleEntityNotFound(_0x606ba2,_0x4f1d9a){return function(_0x7b5228){if(!_0x7b5228){_0x606ba2[_0x739b('0x18')](0x194);}return _0x7b5228;};}function handleError(_0x1bf436,_0x2519b1){_0x2519b1=_0x2519b1||0x1f4;return function(_0x2ec563){logger['error'](_0x2ec563[_0x739b('0x25')]);if(_0x2ec563[_0x739b('0x26')]){delete _0x2ec563[_0x739b('0x26')];}_0x1bf436[_0x739b('0x19')](_0x2519b1)['send'](_0x2ec563);};}exports[_0x739b('0x27')]=function(_0x5b9852,_0x183c13){var _0xe26f2f={},_0x905778={},_0x431486={'count':0x0,'rows':[]};var _0x889763=_['map'](db['ChatGroup'][_0x739b('0x28')],function(_0x127f22){return{'name':_0x127f22[_0x739b('0x29')],'type':_0x127f22[_0x739b('0x2a')]['key']};});_0x905778['model']=_[_0x739b('0x2b')](_0x889763,_0x739b('0x26'));_0x905778[_0x739b('0x2c')]=_['keys'](_0x5b9852[_0x739b('0x2c')]);_0x905778[_0x739b('0x2d')]=_[_0x739b('0x2e')](_0x905778['model'],_0x905778[_0x739b('0x2c')]);_0xe26f2f['attributes']=_['intersection'](_0x905778['model'],qs[_0x739b('0x2f')](_0x5b9852[_0x739b('0x2c')][_0x739b('0x2f')]));_0xe26f2f['attributes']=_0xe26f2f[_0x739b('0x30')][_0x739b('0x31')]?_0xe26f2f[_0x739b('0x30')]:_0x905778[_0x739b('0x32')];if(!_0x5b9852[_0x739b('0x2c')][_0x739b('0x33')]('nolimit')){_0xe26f2f[_0x739b('0x1f')]=qs['limit'](_0x5b9852[_0x739b('0x2c')][_0x739b('0x1f')]);_0xe26f2f[_0x739b('0x1c')]=qs[_0x739b('0x1c')](_0x5b9852[_0x739b('0x2c')][_0x739b('0x1c')]);}_0xe26f2f[_0x739b('0x34')]=qs[_0x739b('0x35')](_0x5b9852[_0x739b('0x2c')][_0x739b('0x35')]);_0xe26f2f[_0x739b('0x36')]=qs[_0x739b('0x2d')](_[_0x739b('0x37')](_0x5b9852[_0x739b('0x2c')],_0x905778[_0x739b('0x2d')]),_0x889763);if(_0x5b9852['query'][_0x739b('0x38')]){_0xe26f2f[_0x739b('0x36')]=_[_0x739b('0x39')](_0xe26f2f['where'],{'$or':_['map'](_0x889763,function(_0x410e29){if(_0x410e29[_0x739b('0x2a')]!==_0x739b('0x3a')){var _0x482a4e={};_0x482a4e[_0x410e29[_0x739b('0x26')]]={'$like':'%'+_0x5b9852['query'][_0x739b('0x38')]+'%'};return _0x482a4e;}})});}_0xe26f2f=_[_0x739b('0x39')]({},_0xe26f2f,_0x5b9852[_0x739b('0x3b')]);var _0x168ab5={'where':_0xe26f2f[_0x739b('0x36')]};return db['ChatGroup'][_0x739b('0x1e')](_0x168ab5)[_0x739b('0x3c')](function(_0xb28d12){_0x431486['count']=_0xb28d12;if(_0x5b9852[_0x739b('0x2c')][_0x739b('0x3d')]){_0xe26f2f[_0x739b('0x3e')]=[{'all':!![]}];}return db['ChatGroup'][_0x739b('0x3f')](_0xe26f2f);})[_0x739b('0x3c')](function(_0x481aca){_0x431486[_0x739b('0x40')]=_0x481aca;return _0x431486;})[_0x739b('0x3c')](respondWithFilteredResult(_0x183c13,_0xe26f2f))['catch'](handleError(_0x183c13,null));};exports['show']=function(_0x29a7f3,_0x305137){var _0x454899={'raw':!![],'where':{'id':_0x29a7f3[_0x739b('0x41')]['id']}},_0x14bde2={};_0x14bde2['model']=_['keys'](db[_0x739b('0x42')][_0x739b('0x28')]);_0x14bde2[_0x739b('0x2c')]=_[_0x739b('0x43')](_0x29a7f3[_0x739b('0x2c')]);_0x14bde2[_0x739b('0x2d')]=_[_0x739b('0x2e')](_0x14bde2[_0x739b('0x32')],_0x14bde2[_0x739b('0x2c')]);_0x454899['attributes']=_[_0x739b('0x2e')](_0x14bde2['model'],qs[_0x739b('0x2f')](_0x29a7f3[_0x739b('0x2c')][_0x739b('0x2f')]));_0x454899[_0x739b('0x30')]=_0x454899['attributes'][_0x739b('0x31')]?_0x454899['attributes']:_0x14bde2[_0x739b('0x32')];if(_0x29a7f3[_0x739b('0x2c')][_0x739b('0x3d')]){_0x454899[_0x739b('0x3e')]=[{'all':!![]}];}_0x454899=_[_0x739b('0x39')]({},_0x454899,_0x29a7f3['options']);return db[_0x739b('0x42')]['find'](_0x454899)[_0x739b('0x3c')](handleEntityNotFound(_0x305137,null))[_0x739b('0x3c')](respondWithResult(_0x305137,null))[_0x739b('0x44')](handleError(_0x305137,null));};exports[_0x739b('0x45')]=function(_0x6790cc,_0x441e4d){return db[_0x739b('0x42')]['create'](_0x6790cc[_0x739b('0x46')],{})[_0x739b('0x3c')](respondWithResult(_0x441e4d,0xc9))[_0x739b('0x44')](handleError(_0x441e4d,null));};exports['update']=function(_0x255471,_0x3c9ffd){if(_0x255471[_0x739b('0x46')]['id']){delete _0x255471[_0x739b('0x46')]['id'];}return db[_0x739b('0x42')][_0x739b('0x47')]({'where':{'id':_0x255471[_0x739b('0x41')]['id']}})[_0x739b('0x3c')](handleEntityNotFound(_0x3c9ffd,null))[_0x739b('0x3c')](saveUpdates(_0x255471['body'],null))[_0x739b('0x3c')](respondWithResult(_0x3c9ffd,null))['catch'](handleError(_0x3c9ffd,null));};exports['destroy']=function(_0x1266ea,_0x40ce58){return db[_0x739b('0x42')][_0x739b('0x47')]({'where':{'id':_0x1266ea[_0x739b('0x41')]['id']}})[_0x739b('0x3c')](handleEntityNotFound(_0x40ce58,null))[_0x739b('0x3c')](removeEntity(_0x40ce58,null))[_0x739b('0x44')](handleError(_0x40ce58,null));};exports['describe']=function(_0x2280c4,_0x14a0be){return db['ChatGroup'][_0x739b('0x48')]()[_0x739b('0x3c')](respondWithResult(_0x14a0be,null))[_0x739b('0x44')](handleError(_0x14a0be,null));};exports[_0x739b('0x49')]=function(_0x47afb1,_0x2a24f9,_0x741bd4){return db[_0x739b('0x4a')][_0x739b('0x1e')]({'where':{'ChatGroupId':_0x47afb1['params']['id'],'ToId':_0x47afb1[_0x739b('0x4b')]['id'],'read':![]}})[_0x739b('0x3c')](function(_0x243935){return{'id':_[_0x739b('0x4c')](_0x47afb1['params']['id']),'count':_0x243935};})[_0x739b('0x3c')](respondWithResult(_0x2a24f9,null))[_0x739b('0x44')](handleError(_0x2a24f9,null));};exports['addMembers']=function(_0xfbe2b,_0x1038b5,_0x26394f){return db[_0x739b('0x42')]['find']({'where':{'id':_0xfbe2b['params']['id']}})[_0x739b('0x3c')](handleEntityNotFound(_0x1038b5,null))[_0x739b('0x3c')](function(_0x432c02){if(_0x432c02){return _0x432c02[_0x739b('0x4d')](_0xfbe2b['body'][_0x739b('0x4e')],_[_0x739b('0x4f')](_0xfbe2b[_0x739b('0x46')],[_0x739b('0x4e'),'id'])||{});}})[_0x739b('0x3c')](respondWithResult(_0x1038b5,null))[_0x739b('0x44')](handleError(_0x1038b5,null));};exports[_0x739b('0x50')]=function(_0x563e91,_0x2eae29,_0x475ede){var _0x39ec30={};var _0x7ec880={};var _0x496522;var _0x63b906;return db[_0x739b('0x42')][_0x739b('0x51')]({'where':{'id':_0x563e91[_0x739b('0x41')]['id']}})['then'](handleEntityNotFound(_0x2eae29,null))[_0x739b('0x3c')](function(_0x37e641){if(_0x37e641){_0x496522=_0x37e641;_0x7ec880[_0x739b('0x32')]=_[_0x739b('0x43')](db[_0x739b('0x52')][_0x739b('0x28')]);_0x7ec880[_0x739b('0x2c')]=_[_0x739b('0x43')](_0x563e91['query']);_0x7ec880[_0x739b('0x2d')]=_[_0x739b('0x2e')](_0x7ec880[_0x739b('0x32')],_0x7ec880[_0x739b('0x2c')]);_0x39ec30['attributes']=_['intersection'](_0x7ec880[_0x739b('0x32')],qs[_0x739b('0x2f')](_0x563e91[_0x739b('0x2c')][_0x739b('0x2f')]));_0x39ec30[_0x739b('0x30')]=_0x39ec30['attributes'][_0x739b('0x31')]?_0x39ec30[_0x739b('0x30')]:_0x7ec880['model'];_0x39ec30['order']=qs['sort'](_0x563e91[_0x739b('0x2c')][_0x739b('0x35')]);_0x39ec30[_0x739b('0x36')]=qs['filters'](_[_0x739b('0x37')](_0x563e91[_0x739b('0x2c')],_0x7ec880[_0x739b('0x2d')]));if(_0x563e91['query']['filter']){_0x39ec30[_0x739b('0x36')]=_[_0x739b('0x39')](_0x39ec30[_0x739b('0x36')],{'$or':_[_0x739b('0x2b')](_0x39ec30[_0x739b('0x30')],function(_0x2a1e8e){var _0x5b8dcf={};_0x5b8dcf[_0x2a1e8e]={'$like':'%'+_0x563e91[_0x739b('0x2c')][_0x739b('0x38')]+'%'};return _0x5b8dcf;})});}_0x39ec30=_[_0x739b('0x39')]({},_0x39ec30,_0x563e91['options']);return _0x496522[_0x739b('0x50')](_0x39ec30);}})['then'](function(_0x37ac5f){if(_0x37ac5f){_0x63b906=_0x37ac5f[_0x739b('0x31')];if(!_0x563e91[_0x739b('0x2c')][_0x739b('0x33')]('nolimit')){_0x39ec30[_0x739b('0x1f')]=qs[_0x739b('0x1f')](_0x563e91[_0x739b('0x2c')][_0x739b('0x1f')]);_0x39ec30[_0x739b('0x1c')]=qs[_0x739b('0x1c')](_0x563e91[_0x739b('0x2c')]['offset']);}return _0x496522['getMembers'](_0x39ec30);}})['then'](function(_0x4920c2){if(_0x4920c2){return _0x4920c2?{'count':_0x63b906,'rows':_0x4920c2}:null;}})['then'](respondWithResult(_0x2eae29,null))[_0x739b('0x44')](handleError(_0x2eae29,null));};exports[_0x739b('0x53')]=function(_0x3ea6c1,_0x15fe93,_0x175d8e){return db[_0x739b('0x42')][_0x739b('0x47')]({'where':{'id':_0x3ea6c1['params']['id']}})['then'](handleEntityNotFound(_0x15fe93,null))[_0x739b('0x3c')](function(_0x3355cf){if(_0x3355cf){return _0x3355cf['removeMembers'](_0x3ea6c1['query'][_0x739b('0x4e')]);}})['then'](respondWithStatusCode(_0x15fe93,null))['catch'](handleError(_0x15fe93,null));};exports[_0x739b('0x54')]=function(_0x5df9b5,_0xbfe0cc,_0x461308){if(_0x5df9b5['body']['id']){delete _0x5df9b5['body']['id'];}return db[_0x739b('0x42')]['find']({'where':{'id':_0x5df9b5[_0x739b('0x41')]['id']}})['then'](handleEntityNotFound(_0xbfe0cc,null))[_0x739b('0x3c')](function(_0x5c831a){if(_0x5c831a){_0x5df9b5[_0x739b('0x46')][_0x739b('0x55')]=_0x5c831a['id'];return db[_0x739b('0x4a')]['create'](_0x5df9b5[_0x739b('0x46')]);}})['then'](respondWithResult(_0xbfe0cc,null))[_0x739b('0x44')](handleError(_0xbfe0cc,null));};exports[_0x739b('0x56')]=function(_0x41a250,_0x52bac9,_0x49f6e8){var _0x3bf06e={};var _0x28a00f={};var _0x1cd48c;var _0x3667bc;return db[_0x739b('0x42')][_0x739b('0x51')]({'where':{'id':_0x41a250['params']['id']}})[_0x739b('0x3c')](handleEntityNotFound(_0x52bac9,null))[_0x739b('0x3c')](function(_0x3ff673){if(_0x3ff673){_0x1cd48c=_0x3ff673;_0x28a00f['model']=_[_0x739b('0x43')](db[_0x739b('0x4a')][_0x739b('0x28')]);_0x28a00f['query']=_[_0x739b('0x43')](_0x41a250[_0x739b('0x2c')]);_0x28a00f[_0x739b('0x2d')]=_['intersection'](_0x28a00f[_0x739b('0x32')],_0x28a00f[_0x739b('0x2c')]);_0x3bf06e[_0x739b('0x30')]=_[_0x739b('0x2e')](_0x28a00f[_0x739b('0x32')],qs[_0x739b('0x2f')](_0x41a250[_0x739b('0x2c')][_0x739b('0x2f')]));_0x3bf06e[_0x739b('0x30')]=_0x3bf06e['attributes'][_0x739b('0x31')]?_0x3bf06e[_0x739b('0x30')]:_0x28a00f[_0x739b('0x32')];_0x3bf06e[_0x739b('0x34')]=qs[_0x739b('0x35')](_0x41a250['query'][_0x739b('0x35')]);_0x3bf06e['where']=qs['filters'](_['pick'](_0x41a250[_0x739b('0x2c')],_0x28a00f[_0x739b('0x2d')]));if(_0x41a250[_0x739b('0x2c')][_0x739b('0x38')]){_0x3bf06e[_0x739b('0x36')]=_[_0x739b('0x39')](_0x3bf06e['where'],{'$or':_['map'](_0x3bf06e['attributes'],function(_0x662477){var _0x525442={};_0x525442[_0x662477]={'$like':'%'+_0x41a250[_0x739b('0x2c')]['filter']+'%'};return _0x525442;})});}if(_0x41a250['query']['$gte']){var _0x1d8c61=_0x41a250[_0x739b('0x2c')][_0x739b('0x57')][_0x739b('0x58')](',');var _0x5f1f0a={};_0x5f1f0a[_0x1d8c61[0x0]]={'$gte':moment(_0x1d8c61[0x1])['format'](_0x739b('0x59'))};_0x3bf06e['where']=_[_0x739b('0x39')](_0x3bf06e[_0x739b('0x36')],_0x5f1f0a);}_0x3bf06e=_['merge']({},_0x3bf06e,_0x41a250['options']);return _0x1cd48c['getMessages'](_0x3bf06e);}})[_0x739b('0x3c')](function(_0x3bd105){if(_0x3bd105){_0x3667bc=_0x3bd105[_0x739b('0x31')];if(!_0x41a250[_0x739b('0x2c')][_0x739b('0x33')](_0x739b('0x5a'))){_0x3bf06e[_0x739b('0x1f')]=qs['limit'](_0x41a250[_0x739b('0x2c')][_0x739b('0x1f')]);_0x3bf06e[_0x739b('0x1c')]=qs[_0x739b('0x1c')](_0x41a250['query']['offset']);}return _0x1cd48c[_0x739b('0x56')](_0x3bf06e);}})[_0x739b('0x3c')](function(_0x152b63){if(_0x152b63){return _0x152b63?{'count':_0x3667bc,'rows':_0x152b63}:null;}})[_0x739b('0x3c')](respondWithResult(_0x52bac9,null))[_0x739b('0x44')](handleError(_0x52bac9,null));}; \ No newline at end of file +var _0xb919=['localhost','socket.io-emitter','./chatGroup.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','sendStatus','error','name','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ChatGroup','includeAll','findAll','show','params','include','find','catch','create','body','update','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','length','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x58df23,_0x3e9eb9){var _0x2fcd18=function(_0x5f4e06){while(--_0x5f4e06){_0x58df23['push'](_0x58df23['shift']());}};_0x2fcd18(++_0x3e9eb9);}(_0xb919,0x10e));var _0x9b91=function(_0x2afbbc,_0x55324e){_0x2afbbc=_0x2afbbc-0x0;var _0x290ebd=_0xb919[_0x2afbbc];return _0x290ebd;};'use strict';var emlformat=require(_0x9b91('0x0'));var rimraf=require(_0x9b91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b91('0x2'));var moment=require(_0x9b91('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9b91('0x4'));var util=require(_0x9b91('0x5'));var path=require(_0x9b91('0x6'));var sox=require(_0x9b91('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b91('0x8'));var _=require(_0x9b91('0x9'));var squel=require(_0x9b91('0xa'));var crypto=require(_0x9b91('0xb'));var jsforce=require(_0x9b91('0xc'));var deskjs=require(_0x9b91('0xd'));var toCsv=require(_0x9b91('0xe'));var querystring=require(_0x9b91('0xf'));var Papa=require(_0x9b91('0x10'));var Redis=require(_0x9b91('0x11'));var authService=require(_0x9b91('0x12'));var qs=require(_0x9b91('0x13'));var as=require(_0x9b91('0x14'));var hardwareService=require(_0x9b91('0x15'));var logger=require(_0x9b91('0x16'))(_0x9b91('0x17'));var utils=require(_0x9b91('0x18'));var config=require(_0x9b91('0x19'));var licenseUtil=require(_0x9b91('0x1a'));var db=require(_0x9b91('0x1b'))['db'];config[_0x9b91('0x1c')]=_[_0x9b91('0x1d')](config['redis'],{'host':_0x9b91('0x1e'),'port':0x18eb});var socket=require(_0x9b91('0x1f'))(new Redis(config['redis']));require(_0x9b91('0x20'))[_0x9b91('0x21')](socket);function respondWithStatusCode(_0x2fc165,_0x539bfc){_0x539bfc=_0x539bfc||0xcc;return function(_0x34fdc3){if(_0x34fdc3){return _0x2fc165['sendStatus'](_0x539bfc);}return _0x2fc165[_0x9b91('0x22')](_0x539bfc)['end']();};}function respondWithResult(_0x5b1f5f,_0x548985){_0x548985=_0x548985||0xc8;return function(_0x156414){if(_0x156414){return _0x5b1f5f[_0x9b91('0x22')](_0x548985)[_0x9b91('0x23')](_0x156414);}};}function respondWithFilteredResult(_0x56cb16,_0x1d089a){return function(_0x223aea){if(_0x223aea){var _0x5d80c4=typeof _0x1d089a[_0x9b91('0x24')]===_0x9b91('0x25')&&typeof _0x1d089a[_0x9b91('0x26')]===_0x9b91('0x25');var _0x55a30e=_0x223aea[_0x9b91('0x27')];var _0x2b324f=_0x5d80c4?0x0:_0x1d089a['offset'];var _0x54cecb=_0x5d80c4?_0x223aea[_0x9b91('0x27')]:_0x1d089a[_0x9b91('0x24')]+_0x1d089a[_0x9b91('0x26')];var _0x261c29;if(_0x54cecb>=_0x55a30e){_0x54cecb=_0x55a30e;_0x261c29=0xc8;}else{_0x261c29=0xce;}_0x56cb16['status'](_0x261c29);return _0x56cb16[_0x9b91('0x28')]('Content-Range',_0x2b324f+'-'+_0x54cecb+'/'+_0x55a30e)[_0x9b91('0x23')](_0x223aea);}return null;};}function patchUpdates(_0x34b99e){return function(_0x3709d4){try{jsonpatch[_0x9b91('0x29')](_0x3709d4,_0x34b99e,!![]);}catch(_0xe4c919){return BPromise[_0x9b91('0x2a')](_0xe4c919);}return _0x3709d4[_0x9b91('0x2b')]();};}function saveUpdates(_0x1f0b27,_0x460b47){return function(_0x3fb459){if(_0x3fb459){return _0x3fb459['update'](_0x1f0b27)['then'](function(_0x5e0b23){return _0x5e0b23;});}return null;};}function removeEntity(_0x259696,_0x133683){return function(_0x59459c){if(_0x59459c){return _0x59459c[_0x9b91('0x2c')]()[_0x9b91('0x2d')](function(){_0x259696[_0x9b91('0x22')](0xcc)[_0x9b91('0x2e')]();});}};}function handleEntityNotFound(_0x5ca84b,_0x597408){return function(_0xdabbe5){if(!_0xdabbe5){_0x5ca84b[_0x9b91('0x2f')](0x194);}return _0xdabbe5;};}function handleError(_0xf6d4fa,_0x672e82){_0x672e82=_0x672e82||0x1f4;return function(_0x19dbfb){logger[_0x9b91('0x30')](_0x19dbfb['stack']);if(_0x19dbfb['name']){delete _0x19dbfb[_0x9b91('0x31')];}_0xf6d4fa[_0x9b91('0x22')](_0x672e82)['send'](_0x19dbfb);};}exports[_0x9b91('0x32')]=function(_0x2b9d6b,_0x3c5c18){var _0x5b7086={},_0x2850d5={},_0x1e8b06={'count':0x0,'rows':[]};var _0x503bf9=_['map'](db['ChatGroup'][_0x9b91('0x33')],function(_0x4f4049){return{'name':_0x4f4049[_0x9b91('0x34')],'type':_0x4f4049['type']['key']};});_0x2850d5[_0x9b91('0x35')]=_[_0x9b91('0x36')](_0x503bf9,_0x9b91('0x31'));_0x2850d5[_0x9b91('0x37')]=_[_0x9b91('0x38')](_0x2b9d6b[_0x9b91('0x37')]);_0x2850d5[_0x9b91('0x39')]=_[_0x9b91('0x3a')](_0x2850d5['model'],_0x2850d5[_0x9b91('0x37')]);_0x5b7086[_0x9b91('0x3b')]=_['intersection'](_0x2850d5[_0x9b91('0x35')],qs[_0x9b91('0x3c')](_0x2b9d6b[_0x9b91('0x37')][_0x9b91('0x3c')]));_0x5b7086[_0x9b91('0x3b')]=_0x5b7086['attributes']['length']?_0x5b7086[_0x9b91('0x3b')]:_0x2850d5[_0x9b91('0x35')];if(!_0x2b9d6b[_0x9b91('0x37')][_0x9b91('0x3d')](_0x9b91('0x3e'))){_0x5b7086['limit']=qs[_0x9b91('0x26')](_0x2b9d6b[_0x9b91('0x37')][_0x9b91('0x26')]);_0x5b7086[_0x9b91('0x24')]=qs[_0x9b91('0x24')](_0x2b9d6b[_0x9b91('0x37')]['offset']);}_0x5b7086[_0x9b91('0x3f')]=qs[_0x9b91('0x40')](_0x2b9d6b['query'][_0x9b91('0x40')]);_0x5b7086[_0x9b91('0x41')]=qs['filters'](_[_0x9b91('0x42')](_0x2b9d6b[_0x9b91('0x37')],_0x2850d5[_0x9b91('0x39')]),_0x503bf9);if(_0x2b9d6b[_0x9b91('0x37')]['filter']){_0x5b7086[_0x9b91('0x41')]=_[_0x9b91('0x43')](_0x5b7086[_0x9b91('0x41')],{'$or':_[_0x9b91('0x36')](_0x503bf9,function(_0x37b908){if(_0x37b908[_0x9b91('0x44')]!==_0x9b91('0x45')){var _0xcfe278={};_0xcfe278[_0x37b908['name']]={'$like':'%'+_0x2b9d6b[_0x9b91('0x37')][_0x9b91('0x46')]+'%'};return _0xcfe278;}})});}_0x5b7086=_[_0x9b91('0x43')]({},_0x5b7086,_0x2b9d6b[_0x9b91('0x47')]);var _0x21e184={'where':_0x5b7086[_0x9b91('0x41')]};return db[_0x9b91('0x48')][_0x9b91('0x27')](_0x21e184)[_0x9b91('0x2d')](function(_0x24dfa7){_0x1e8b06[_0x9b91('0x27')]=_0x24dfa7;if(_0x2b9d6b[_0x9b91('0x37')][_0x9b91('0x49')]){_0x5b7086['include']=[{'all':!![]}];}return db['ChatGroup'][_0x9b91('0x4a')](_0x5b7086);})['then'](function(_0x4330b9){_0x1e8b06['rows']=_0x4330b9;return _0x1e8b06;})[_0x9b91('0x2d')](respondWithFilteredResult(_0x3c5c18,_0x5b7086))['catch'](handleError(_0x3c5c18,null));};exports[_0x9b91('0x4b')]=function(_0x3c7859,_0x51c259){var _0x24d521={'raw':!![],'where':{'id':_0x3c7859[_0x9b91('0x4c')]['id']}},_0x27ae92={};_0x27ae92[_0x9b91('0x35')]=_['keys'](db[_0x9b91('0x48')][_0x9b91('0x33')]);_0x27ae92[_0x9b91('0x37')]=_[_0x9b91('0x38')](_0x3c7859[_0x9b91('0x37')]);_0x27ae92[_0x9b91('0x39')]=_[_0x9b91('0x3a')](_0x27ae92[_0x9b91('0x35')],_0x27ae92[_0x9b91('0x37')]);_0x24d521[_0x9b91('0x3b')]=_[_0x9b91('0x3a')](_0x27ae92[_0x9b91('0x35')],qs['fields'](_0x3c7859[_0x9b91('0x37')][_0x9b91('0x3c')]));_0x24d521['attributes']=_0x24d521[_0x9b91('0x3b')]['length']?_0x24d521[_0x9b91('0x3b')]:_0x27ae92[_0x9b91('0x35')];if(_0x3c7859['query'][_0x9b91('0x49')]){_0x24d521[_0x9b91('0x4d')]=[{'all':!![]}];}_0x24d521=_[_0x9b91('0x43')]({},_0x24d521,_0x3c7859[_0x9b91('0x47')]);return db['ChatGroup'][_0x9b91('0x4e')](_0x24d521)['then'](handleEntityNotFound(_0x51c259,null))[_0x9b91('0x2d')](respondWithResult(_0x51c259,null))[_0x9b91('0x4f')](handleError(_0x51c259,null));};exports[_0x9b91('0x50')]=function(_0x312f04,_0x5edad1){return db[_0x9b91('0x48')][_0x9b91('0x50')](_0x312f04[_0x9b91('0x51')],{})[_0x9b91('0x2d')](respondWithResult(_0x5edad1,0xc9))['catch'](handleError(_0x5edad1,null));};exports[_0x9b91('0x52')]=function(_0x1251a5,_0x5684a0){if(_0x1251a5[_0x9b91('0x51')]['id']){delete _0x1251a5[_0x9b91('0x51')]['id'];}return db[_0x9b91('0x48')][_0x9b91('0x4e')]({'where':{'id':_0x1251a5['params']['id']}})[_0x9b91('0x2d')](handleEntityNotFound(_0x5684a0,null))[_0x9b91('0x2d')](saveUpdates(_0x1251a5['body'],null))[_0x9b91('0x2d')](respondWithResult(_0x5684a0,null))[_0x9b91('0x4f')](handleError(_0x5684a0,null));};exports['destroy']=function(_0x3e8bf1,_0x27a40b){return db[_0x9b91('0x48')]['find']({'where':{'id':_0x3e8bf1['params']['id']}})['then'](handleEntityNotFound(_0x27a40b,null))[_0x9b91('0x2d')](removeEntity(_0x27a40b,null))[_0x9b91('0x4f')](handleError(_0x27a40b,null));};exports[_0x9b91('0x53')]=function(_0x5581f4,_0x3d6024){return db[_0x9b91('0x48')][_0x9b91('0x53')]()[_0x9b91('0x2d')](respondWithResult(_0x3d6024,null))[_0x9b91('0x4f')](handleError(_0x3d6024,null));};exports[_0x9b91('0x54')]=function(_0x17487a,_0x47196d,_0x5e365b){return db['ChatInternalMessage'][_0x9b91('0x27')]({'where':{'ChatGroupId':_0x17487a[_0x9b91('0x4c')]['id'],'ToId':_0x17487a[_0x9b91('0x55')]['id'],'read':![]}})[_0x9b91('0x2d')](function(_0x206a86){return{'id':_[_0x9b91('0x56')](_0x17487a['params']['id']),'count':_0x206a86};})['then'](respondWithResult(_0x47196d,null))['catch'](handleError(_0x47196d,null));};exports[_0x9b91('0x57')]=function(_0x21c2b5,_0xc75009,_0x82f4d1){return db['ChatGroup'][_0x9b91('0x4e')]({'where':{'id':_0x21c2b5['params']['id']}})[_0x9b91('0x2d')](handleEntityNotFound(_0xc75009,null))['then'](function(_0x39a8b7){if(_0x39a8b7){return _0x39a8b7[_0x9b91('0x57')](_0x21c2b5[_0x9b91('0x51')]['ids'],_['omit'](_0x21c2b5[_0x9b91('0x51')],[_0x9b91('0x58'),'id'])||{});}})[_0x9b91('0x2d')](respondWithResult(_0xc75009,null))[_0x9b91('0x4f')](handleError(_0xc75009,null));};exports[_0x9b91('0x59')]=function(_0x1b7dc2,_0x2085c6,_0x165509){var _0x569a73={};var _0x1630a2={};var _0x238203;var _0x32881c;return db[_0x9b91('0x48')][_0x9b91('0x5a')]({'where':{'id':_0x1b7dc2[_0x9b91('0x4c')]['id']}})[_0x9b91('0x2d')](handleEntityNotFound(_0x2085c6,null))[_0x9b91('0x2d')](function(_0x3a2076){if(_0x3a2076){_0x238203=_0x3a2076;_0x1630a2[_0x9b91('0x35')]=_[_0x9b91('0x38')](db['User'][_0x9b91('0x33')]);_0x1630a2[_0x9b91('0x37')]=_[_0x9b91('0x38')](_0x1b7dc2[_0x9b91('0x37')]);_0x1630a2[_0x9b91('0x39')]=_[_0x9b91('0x3a')](_0x1630a2[_0x9b91('0x35')],_0x1630a2[_0x9b91('0x37')]);_0x569a73[_0x9b91('0x3b')]=_[_0x9b91('0x3a')](_0x1630a2[_0x9b91('0x35')],qs[_0x9b91('0x3c')](_0x1b7dc2[_0x9b91('0x37')][_0x9b91('0x3c')]));_0x569a73['attributes']=_0x569a73[_0x9b91('0x3b')][_0x9b91('0x5b')]?_0x569a73[_0x9b91('0x3b')]:_0x1630a2[_0x9b91('0x35')];_0x569a73['order']=qs[_0x9b91('0x40')](_0x1b7dc2['query'][_0x9b91('0x40')]);_0x569a73[_0x9b91('0x41')]=qs[_0x9b91('0x39')](_[_0x9b91('0x42')](_0x1b7dc2[_0x9b91('0x37')],_0x1630a2['filters']));if(_0x1b7dc2[_0x9b91('0x37')][_0x9b91('0x46')]){_0x569a73[_0x9b91('0x41')]=_[_0x9b91('0x43')](_0x569a73[_0x9b91('0x41')],{'$or':_[_0x9b91('0x36')](_0x569a73[_0x9b91('0x3b')],function(_0x4da358){var _0x2c1601={};_0x2c1601[_0x4da358]={'$like':'%'+_0x1b7dc2['query'][_0x9b91('0x46')]+'%'};return _0x2c1601;})});}_0x569a73=_[_0x9b91('0x43')]({},_0x569a73,_0x1b7dc2[_0x9b91('0x47')]);return _0x238203[_0x9b91('0x59')](_0x569a73);}})['then'](function(_0x49e5fd){if(_0x49e5fd){_0x32881c=_0x49e5fd[_0x9b91('0x5b')];if(!_0x1b7dc2[_0x9b91('0x37')]['hasOwnProperty']('nolimit')){_0x569a73[_0x9b91('0x26')]=qs[_0x9b91('0x26')](_0x1b7dc2[_0x9b91('0x37')]['limit']);_0x569a73['offset']=qs[_0x9b91('0x24')](_0x1b7dc2['query']['offset']);}return _0x238203[_0x9b91('0x59')](_0x569a73);}})[_0x9b91('0x2d')](function(_0x2be4ba){if(_0x2be4ba){return _0x2be4ba?{'count':_0x32881c,'rows':_0x2be4ba}:null;}})[_0x9b91('0x2d')](respondWithResult(_0x2085c6,null))[_0x9b91('0x4f')](handleError(_0x2085c6,null));};exports['removeMembers']=function(_0x62071e,_0x375f84,_0x3ebf44){return db[_0x9b91('0x48')][_0x9b91('0x4e')]({'where':{'id':_0x62071e[_0x9b91('0x4c')]['id']}})[_0x9b91('0x2d')](handleEntityNotFound(_0x375f84,null))[_0x9b91('0x2d')](function(_0x20f169){if(_0x20f169){return _0x20f169[_0x9b91('0x5c')](_0x62071e[_0x9b91('0x37')]['ids']);}})[_0x9b91('0x2d')](respondWithStatusCode(_0x375f84,null))[_0x9b91('0x4f')](handleError(_0x375f84,null));};exports[_0x9b91('0x5d')]=function(_0x52fee2,_0x4e885b,_0x15b192){if(_0x52fee2[_0x9b91('0x51')]['id']){delete _0x52fee2[_0x9b91('0x51')]['id'];}return db[_0x9b91('0x48')][_0x9b91('0x4e')]({'where':{'id':_0x52fee2[_0x9b91('0x4c')]['id']}})[_0x9b91('0x2d')](handleEntityNotFound(_0x4e885b,null))[_0x9b91('0x2d')](function(_0x335ed6){if(_0x335ed6){_0x52fee2[_0x9b91('0x51')][_0x9b91('0x5e')]=_0x335ed6['id'];return db[_0x9b91('0x5f')][_0x9b91('0x50')](_0x52fee2[_0x9b91('0x51')]);}})[_0x9b91('0x2d')](respondWithResult(_0x4e885b,null))['catch'](handleError(_0x4e885b,null));};exports[_0x9b91('0x60')]=function(_0xc7820b,_0x26d98e,_0x5d8bcc){var _0x2be5e7={};var _0x16280f={};var _0xaf7070;var _0x499131;return db[_0x9b91('0x48')][_0x9b91('0x5a')]({'where':{'id':_0xc7820b[_0x9b91('0x4c')]['id']}})[_0x9b91('0x2d')](handleEntityNotFound(_0x26d98e,null))['then'](function(_0x41f37c){if(_0x41f37c){_0xaf7070=_0x41f37c;_0x16280f['model']=_['keys'](db[_0x9b91('0x5f')][_0x9b91('0x33')]);_0x16280f[_0x9b91('0x37')]=_[_0x9b91('0x38')](_0xc7820b[_0x9b91('0x37')]);_0x16280f[_0x9b91('0x39')]=_[_0x9b91('0x3a')](_0x16280f[_0x9b91('0x35')],_0x16280f['query']);_0x2be5e7[_0x9b91('0x3b')]=_[_0x9b91('0x3a')](_0x16280f[_0x9b91('0x35')],qs[_0x9b91('0x3c')](_0xc7820b['query'][_0x9b91('0x3c')]));_0x2be5e7[_0x9b91('0x3b')]=_0x2be5e7[_0x9b91('0x3b')]['length']?_0x2be5e7[_0x9b91('0x3b')]:_0x16280f[_0x9b91('0x35')];_0x2be5e7[_0x9b91('0x3f')]=qs['sort'](_0xc7820b[_0x9b91('0x37')]['sort']);_0x2be5e7[_0x9b91('0x41')]=qs[_0x9b91('0x39')](_[_0x9b91('0x42')](_0xc7820b['query'],_0x16280f['filters']));if(_0xc7820b[_0x9b91('0x37')][_0x9b91('0x46')]){_0x2be5e7[_0x9b91('0x41')]=_['merge'](_0x2be5e7['where'],{'$or':_[_0x9b91('0x36')](_0x2be5e7['attributes'],function(_0x25ec16){var _0x2b1ca6={};_0x2b1ca6[_0x25ec16]={'$like':'%'+_0xc7820b['query'][_0x9b91('0x46')]+'%'};return _0x2b1ca6;})});}if(_0xc7820b[_0x9b91('0x37')][_0x9b91('0x61')]){var _0xe03d6=_0xc7820b['query']['$gte']['split'](',');var _0x2236a2={};_0x2236a2[_0xe03d6[0x0]]={'$gte':moment(_0xe03d6[0x1])[_0x9b91('0x62')](_0x9b91('0x63'))};_0x2be5e7[_0x9b91('0x41')]=_[_0x9b91('0x43')](_0x2be5e7[_0x9b91('0x41')],_0x2236a2);}_0x2be5e7=_[_0x9b91('0x43')]({},_0x2be5e7,_0xc7820b[_0x9b91('0x47')]);return _0xaf7070[_0x9b91('0x60')](_0x2be5e7);}})['then'](function(_0x37140c){if(_0x37140c){_0x499131=_0x37140c[_0x9b91('0x5b')];if(!_0xc7820b['query']['hasOwnProperty'](_0x9b91('0x3e'))){_0x2be5e7[_0x9b91('0x26')]=qs[_0x9b91('0x26')](_0xc7820b[_0x9b91('0x37')][_0x9b91('0x26')]);_0x2be5e7[_0x9b91('0x24')]=qs[_0x9b91('0x24')](_0xc7820b[_0x9b91('0x37')]['offset']);}return _0xaf7070[_0x9b91('0x60')](_0x2be5e7);}})[_0x9b91('0x2d')](function(_0x2cad7f){if(_0x2cad7f){return _0x2cad7f?{'count':_0x499131,'rows':_0x2cad7f}:null;}})['then'](respondWithResult(_0x26d98e,null))[_0x9b91('0x4f')](handleError(_0x26d98e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 454ccf9..e3a0f1b 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 _0x9bb3=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','emit','hasOwnProperty'];(function(_0xae67cd,_0x3eaaa4){var _0x4da710=function(_0x4dae88){while(--_0x4dae88){_0xae67cd['push'](_0xae67cd['shift']());}};_0x4da710(++_0x3eaaa4);}(_0x9bb3,0x134));var _0x39bb=function(_0x3e2606,_0x17438b){_0x3e2606=_0x3e2606-0x0;var _0x185a42=_0x9bb3[_0x3e2606];return _0x185a42;};'use strict';var EventEmitter=require(_0x39bb('0x0'));var ChatGroup=require(_0x39bb('0x1'))['db'][_0x39bb('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x39bb('0x3')](0x0);var events={'afterCreate':_0x39bb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x40566c){return function(_0xc3b9fd,_0x3cd3b9,_0x2e238f){ChatGroupEvents[_0x39bb('0x5')](_0x40566c+':'+_0xc3b9fd['id'],_0xc3b9fd);ChatGroupEvents[_0x39bb('0x5')](_0x40566c,_0xc3b9fd);_0x2e238f(null);};}for(var e in events){if(events[_0x39bb('0x6')](e)){var event=events[e];ChatGroup[_0x39bb('0x7')](e,emitEvent(event));}}module[_0x39bb('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x6e4d=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x6e4d,0x1cb));var _0xd6e4=function(_0x22f6f1,_0x1690df){_0x22f6f1=_0x22f6f1-0x0;var _0x3ec7f4=_0x6e4d[_0x22f6f1];return _0x3ec7f4;};'use strict';var EventEmitter=require(_0xd6e4('0x0'));var ChatGroup=require(_0xd6e4('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd6e4('0x2')](0x0);var events={'afterCreate':_0xd6e4('0x3'),'afterUpdate':'update','afterDestroy':_0xd6e4('0x4')};function emitEvent(_0x2c0410){return function(_0x252011,_0x52f622,_0x5bde1a){ChatGroupEvents[_0xd6e4('0x5')](_0x2c0410+':'+_0x252011['id'],_0x252011);ChatGroupEvents['emit'](_0x2c0410,_0x252011);_0x5bde1a(null);};}for(var e in events){if(events[_0xd6e4('0x6')](e)){var event=events[e];ChatGroup[_0xd6e4('0x7')](e,emitEvent(event));}}module[_0xd6e4('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index dec29a8..777d80d 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 _0x2027=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x18fdc6,_0x2b92ed){var _0x1da50c=function(_0x3d2dce){while(--_0x3d2dce){_0x18fdc6['push'](_0x18fdc6['shift']());}};_0x1da50c(++_0x2b92ed);}(_0x2027,0xcf));var _0x7202=function(_0x21c662,_0x4cc5d0){_0x21c662=_0x21c662-0x0;var _0x3aaade=_0x2027[_0x21c662];return _0x3aaade;};'use strict';var _=require(_0x7202('0x0'));var util=require(_0x7202('0x1'));var logger=require(_0x7202('0x2'))(_0x7202('0x3'));var moment=require(_0x7202('0x4'));var BPromise=require(_0x7202('0x5'));var rp=require(_0x7202('0x6'));var fs=require('fs');var path=require(_0x7202('0x7'));var rimraf=require(_0x7202('0x8'));var config=require(_0x7202('0x9'));var attributes=require(_0x7202('0xa'));module[_0x7202('0xb')]=function(_0x593a2a,_0x5de675){return _0x593a2a[_0x7202('0xc')](_0x7202('0xd'),attributes,{'tableName':_0x7202('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cc8=['rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','lodash','moment','bluebird'];(function(_0x5c29d7,_0xb16bd4){var _0xcb40af=function(_0x88206f){while(--_0x88206f){_0x5c29d7['push'](_0x5c29d7['shift']());}};_0xcb40af(++_0xb16bd4);}(_0x0cc8,0x14d));var _0x80cc=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x0cc8[_0x172747];return _0x509692;};'use strict';var _=require(_0x80cc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x80cc('0x1'));var BPromise=require(_0x80cc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80cc('0x3'));var config=require(_0x80cc('0x4'));var attributes=require(_0x80cc('0x5'));module[_0x80cc('0x6')]=function(_0x105557,_0x44b913){return _0x105557['define'](_0x80cc('0x7'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 72e0518..c0ed48c 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 _0x13e3=['register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./chatGroup.socket'];(function(_0x3e625c,_0x372847){var _0x3cc347=function(_0x1cfba4){while(--_0x1cfba4){_0x3e625c['push'](_0x3e625c['shift']());}};_0x3cc347(++_0x372847);}(_0x13e3,0x137));var _0x313e=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0x13e3[_0x561771];return _0x54d16e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x313e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x313e('0x1'));var db=require(_0x313e('0x2'))['db'];var utils=require(_0x313e('0x3'));var logger=require(_0x313e('0x4'))('rpc');var config=require(_0x313e('0x5'));var jayson=require(_0x313e('0x6'));var client=jayson[_0x313e('0x7')]['http']({'port':0x232a});config[_0x313e('0x8')]=_[_0x313e('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x313e('0x8')]));require(_0x313e('0xa'))[_0x313e('0xb')](socket);function respondWithRpcPromise(_0x3c39cc,_0x474546,_0x3bc88e){return new BPromise(function(_0x5b7550,_0x16d722){return client[_0x313e('0xc')](_0x3c39cc,_0x3bc88e)['then'](function(_0x359e03){logger[_0x313e('0xd')]('ChatGroup,\x20%s,\x20%s',_0x474546,_0x313e('0xe'));logger[_0x313e('0xf')](_0x313e('0x10'),_0x474546,_0x313e('0xe'),JSON[_0x313e('0x11')](_0x359e03));if(_0x359e03['error']){if(_0x359e03[_0x313e('0x12')][_0x313e('0x13')]===0x1f4){logger[_0x313e('0x12')](_0x313e('0x14'),_0x474546,_0x359e03[_0x313e('0x12')][_0x313e('0x15')]);return _0x16d722(_0x359e03[_0x313e('0x12')][_0x313e('0x15')]);}logger[_0x313e('0x12')](_0x313e('0x14'),_0x474546,_0x359e03['error'][_0x313e('0x15')]);return _0x5b7550(_0x359e03[_0x313e('0x12')][_0x313e('0x15')]);}else{logger[_0x313e('0xd')](_0x313e('0x14'),_0x474546,'request\x20sent');_0x5b7550(_0x359e03[_0x313e('0x16')][_0x313e('0x15')]);}})['catch'](function(_0x3fbce6){logger['error'](_0x313e('0x14'),_0x474546,_0x3fbce6);_0x16d722(_0x3fbce6);});});} \ No newline at end of file +var _0xfcda=['message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1faf67,_0x41fa5f){var _0x17045d=function(_0x14a470){while(--_0x14a470){_0x1faf67['push'](_0x1faf67['shift']());}};_0x17045d(++_0x41fa5f);}(_0xfcda,0x198));var _0xafcd=function(_0x4e24e2,_0x4bf3cc){_0x4e24e2=_0x4e24e2-0x0;var _0x17975b=_0xfcda[_0x4e24e2];return _0x17975b;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var moment=require('moment');var BPromise=require(_0xafcd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafcd('0x3'));var logger=require(_0xafcd('0x4'))(_0xafcd('0x5'));var config=require(_0xafcd('0x6'));var jayson=require(_0xafcd('0x7'));var client=jayson[_0xafcd('0x8')][_0xafcd('0x9')]({'port':0x232a});config['redis']=_[_0xafcd('0xa')](config['redis'],{'host':_0xafcd('0xb'),'port':0x18eb});var socket=require(_0xafcd('0xc'))(new Redis(config[_0xafcd('0xd')]));require(_0xafcd('0xe'))[_0xafcd('0xf')](socket);function respondWithRpcPromise(_0x33b666,_0x4911d6,_0x8fe535){return new BPromise(function(_0x358964,_0x3a0d5e){return client[_0xafcd('0x10')](_0x33b666,_0x8fe535)[_0xafcd('0x11')](function(_0x212159){logger[_0xafcd('0x12')](_0xafcd('0x13'),_0x4911d6,_0xafcd('0x14'));logger['debug'](_0xafcd('0x15'),_0x4911d6,_0xafcd('0x14'),JSON['stringify'](_0x212159));if(_0x212159[_0xafcd('0x16')]){if(_0x212159[_0xafcd('0x16')][_0xafcd('0x17')]===0x1f4){logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x212159['error']['message']);return _0x3a0d5e(_0x212159['error'][_0xafcd('0x18')]);}logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x212159['error'][_0xafcd('0x18')]);return _0x358964(_0x212159[_0xafcd('0x16')][_0xafcd('0x18')]);}else{logger[_0xafcd('0x12')](_0xafcd('0x13'),_0x4911d6,'request\x20sent');_0x358964(_0x212159[_0xafcd('0x19')]['message']);}})[_0xafcd('0x1a')](function(_0x3e6449){logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x3e6449);_0x3a0d5e(_0x3e6449);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0639f94..b660660 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 _0x463a=['register','length','chatGroup:','save','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x463a,0x1b3));var _0xa463=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x463a[_0x18a79d];return _0x4f8848;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xa463('0x0'),_0xa463('0x1'),_0xa463('0x2')];function createListener(_0x71c507,_0xa02da){return function(_0x35ddcd){_0xa02da['emit'](_0x71c507,_0x35ddcd);};}function removeListener(_0xd587e2,_0x532562){return function(){ChatGroupEvents['removeListener'](_0xd587e2,_0x532562);};}exports[_0xa463('0x3')]=function(_0x1fd56b){for(var _0x419efc=0x0,_0x35b634=events[_0xa463('0x4')];_0x419efc<_0x35b634;_0x419efc++){var _0x48b203=events[_0x419efc];var _0x1931c7=createListener(_0xa463('0x5')+_0x48b203,_0x1fd56b);ChatGroupEvents['on'](_0x48b203,_0x1931c7);}}; \ No newline at end of file +var _0x7956=['remove','update','length','chatGroup:','./chatGroup.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7956,0x196));var _0x6795=function(_0x175bc3,_0x4c3916){_0x175bc3=_0x175bc3-0x0;var _0x2d13fc=_0x7956[_0x175bc3];return _0x2d13fc;};'use strict';var ChatGroupEvents=require(_0x6795('0x0'));var events=[_0x6795('0x1'),_0x6795('0x2'),_0x6795('0x3')];function createListener(_0xbde95f,_0x1b75be){return function(_0x2d51e4){_0x1b75be['emit'](_0xbde95f,_0x2d51e4);};}function removeListener(_0x3e92ab,_0x1be53b){return function(){ChatGroupEvents['removeListener'](_0x3e92ab,_0x1be53b);};}exports['register']=function(_0x16ca95){for(var _0x58e014=0x0,_0x887cab=events[_0x6795('0x4')];_0x58e014<_0x887cab;_0x58e014++){var _0x1ea08e=events[_0x58e014];var _0x4bd9c2=createListener(_0x6795('0x5')+_0x1ea08e,_0x16ca95);ChatGroupEvents['on'](_0x1ea08e,_0x4bd9c2);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4a8158b..5ee978a 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 _0xc793=['delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update'];(function(_0x5c230a,_0xf87ca1){var _0xb74e8e=function(_0x257083){while(--_0x257083){_0x5c230a['push'](_0x5c230a['shift']());}};_0xb74e8e(++_0xf87ca1);}(_0xc793,0x1a4));var _0x3c79=function(_0x92365c,_0x3bf098){_0x92365c=_0x92365c-0x0;var _0x55d973=_0xc793[_0x92365c];return _0x55d973;};'use strict';var multer=require(_0x3c79('0x0'));var util=require(_0x3c79('0x1'));var path=require(_0x3c79('0x2'));var timeout=require(_0x3c79('0x3'));var express=require(_0x3c79('0x4'));var router=express[_0x3c79('0x5')]();var fs_extra=require(_0x3c79('0x6'));var auth=require(_0x3c79('0x7'));var interaction=require(_0x3c79('0x8'));var config=require(_0x3c79('0x9'));var controller=require(_0x3c79('0xa'));router[_0x3c79('0xb')]('/',auth[_0x3c79('0xc')](),controller[_0x3c79('0xd')]);router['get'](_0x3c79('0xe'),auth['isAuthenticated'](),controller[_0x3c79('0xf')]);router[_0x3c79('0xb')](_0x3c79('0x10'),auth[_0x3c79('0xc')](),controller[_0x3c79('0x11')]);router[_0x3c79('0xb')]('/:id/unread',auth[_0x3c79('0xc')](),controller[_0x3c79('0x12')]);router[_0x3c79('0xb')](_0x3c79('0x13'),auth['isAuthenticated'](),controller[_0x3c79('0x14')]);router['get'](_0x3c79('0x15'),auth[_0x3c79('0xc')](),controller[_0x3c79('0x16')]);router[_0x3c79('0x17')]('/',auth[_0x3c79('0xc')](),controller[_0x3c79('0x18')]);router[_0x3c79('0x17')]('/:id/members',auth[_0x3c79('0xc')](),controller[_0x3c79('0x19')]);router['post'](_0x3c79('0x15'),auth['isAuthenticated'](),controller[_0x3c79('0x1a')]);router['put'](_0x3c79('0x10'),auth[_0x3c79('0xc')](),controller[_0x3c79('0x1b')]);router[_0x3c79('0x1c')](_0x3c79('0x10'),auth['isAuthenticated'](),controller[_0x3c79('0x1d')]);router[_0x3c79('0x1c')]('/:id/members',auth[_0x3c79('0xc')](),controller[_0x3c79('0x1e')]);module[_0x3c79('0x1f')]=router; \ No newline at end of file +var _0x6e91=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','get','/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','addMembers','/:id/messages','addMessage','/:id','delete','destroy','removeMembers','exports'];(function(_0xd559f7,_0x5c7fd9){var _0x4455e9=function(_0x40e13a){while(--_0x40e13a){_0xd559f7['push'](_0xd559f7['shift']());}};_0x4455e9(++_0x5c7fd9);}(_0x6e91,0x1f4));var _0x16e9=function(_0x17c624,_0x2c6f74){_0x17c624=_0x17c624-0x0;var _0x24c927=_0x6e91[_0x17c624];return _0x24c927;};'use strict';var multer=require(_0x16e9('0x0'));var util=require(_0x16e9('0x1'));var path=require('path');var timeout=require(_0x16e9('0x2'));var express=require(_0x16e9('0x3'));var router=express[_0x16e9('0x4')]();var fs_extra=require(_0x16e9('0x5'));var auth=require(_0x16e9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x16e9('0x7')](),controller['index']);router[_0x16e9('0x8')](_0x16e9('0x9'),auth[_0x16e9('0x7')](),controller[_0x16e9('0xa')]);router[_0x16e9('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x16e9('0xb'),auth[_0x16e9('0x7')](),controller[_0x16e9('0xc')]);router['get'](_0x16e9('0xd'),auth[_0x16e9('0x7')](),controller[_0x16e9('0xe')]);router[_0x16e9('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x16e9('0xf')]);router[_0x16e9('0x10')]('/',auth[_0x16e9('0x7')](),controller['create']);router['post'](_0x16e9('0xd'),auth['isAuthenticated'](),controller[_0x16e9('0x11')]);router['post'](_0x16e9('0x12'),auth['isAuthenticated'](),controller[_0x16e9('0x13')]);router['put'](_0x16e9('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x16e9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x16e9('0x16')]);router[_0x16e9('0x15')](_0x16e9('0xd'),auth[_0x16e9('0x7')](),controller[_0x16e9('0x17')]);module[_0x16e9('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 05babdd..c3d5741 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 _0xae87=['ENUM','star','STRING','DATE','TEXT','BOOLEAN'];(function(_0x5bfe25,_0x56a866){var _0xef7504=function(_0x1d11ac){while(--_0x1d11ac){_0x5bfe25['push'](_0x5bfe25['shift']());}};_0xef7504(++_0x56a866);}(_0xae87,0x1ce));var _0x7ae8=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0xae87[_0x2ac5f8];return _0x3b8229;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x7ae8('0x0')](_0x7ae8('0x1'),'thumb'),'defaultValue':_0x7ae8('0x1')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x7ae8('0x2')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7ae8('0x3')]},'disposition':{'type':Sequelize[_0x7ae8('0x2')]},'secondDisposition':{'type':Sequelize[_0x7ae8('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7ae8('0x2')]},'browserName':{'type':Sequelize[_0x7ae8('0x2')]},'browserVersion':{'type':Sequelize[_0x7ae8('0x2')]},'osName':{'type':Sequelize[_0x7ae8('0x2')]},'osVersion':{'type':Sequelize[_0x7ae8('0x2')]},'deviceModel':{'type':Sequelize[_0x7ae8('0x2')]},'deviceVendor':{'type':Sequelize[_0x7ae8('0x2')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x7ae8('0x2')]},'formData':{'type':Sequelize[_0x7ae8('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x7ae8('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7ae8('0x0')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7ae8('0x2')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7ae8('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7ae8('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xfd7b=['STRING','DATE','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0xfd7b,0xd1));var _0xbfd7=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xfd7b[_0xf51c06];return _0x1d5420;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'closed':{'type':Sequelize[_0xbfd7('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xbfd7('0x3')](_0xbfd7('0x4'),_0xbfd7('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xbfd7('0x6')]},'pathTranscript':{'type':Sequelize[_0xbfd7('0x6')]},'mailTranscript':{'type':Sequelize[_0xbfd7('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbfd7('0x7')]},'secondDisposition':{'type':Sequelize[_0xbfd7('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbfd7('0x7')]},'browserName':{'type':Sequelize[_0xbfd7('0x7')]},'browserVersion':{'type':Sequelize[_0xbfd7('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xbfd7('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xbfd7('0x7')]},'referer':{'type':Sequelize[_0xbfd7('0x6')]},'customerIp':{'type':Sequelize[_0xbfd7('0x7')]},'formData':{'type':Sequelize[_0xbfd7('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xbfd7('0x8')]},'lastMsgAt':{'type':Sequelize[_0xbfd7('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xbfd7('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbfd7('0x7')]},'customerPort':{'type':Sequelize[_0xbfd7('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xbfd7('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 264f21d..044a23b 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 _0x02e4=['sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','intersection','includeAll','include','create','params','describe','findOne','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','ChatWebsite','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','User','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','options','findAll','getMyMessages','includeAgent','setTags','spread','Tag','chatInteractionTags:save','removeTags','root','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','direction','Account','Owner','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','server','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','save','update','destroy','stack','name','send','render','merge','body','contact','agent','account','Users','map','fullname','TagIds','Tags','split','push','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','total','index','ChatInteraction','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','ChatWebsiteId','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x02e4,0x90));var _0x402e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x02e4[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x402e('0x0'));var zipdir=require(_0x402e('0x1'));var jsonpatch=require(_0x402e('0x2'));var rp=require(_0x402e('0x3'));var moment=require(_0x402e('0x4'));var BPromise=require(_0x402e('0x5'));var Mustache=require(_0x402e('0x6'));var util=require(_0x402e('0x7'));var path=require('path');var sox=require(_0x402e('0x8'));var csv=require(_0x402e('0x9'));var ejs=require(_0x402e('0xa'));var fs=require('fs');var fs_extra=require(_0x402e('0xb'));var _=require(_0x402e('0xc'));var squel=require(_0x402e('0xd'));var crypto=require(_0x402e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x402e('0xf'));var toCsv=require(_0x402e('0x9'));var querystring=require('querystring');var Papa=require(_0x402e('0x10'));var Redis=require('ioredis');var authService=require(_0x402e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x402e('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x402e('0x13'));var logger=require(_0x402e('0x14'))(_0x402e('0x15'));var utils=require(_0x402e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x402e('0x17'));var db=require(_0x402e('0x18'))['db'];config[_0x402e('0x19')]=_[_0x402e('0x1a')](config['redis'],{'host':_0x402e('0x1b'),'port':0x18eb});var socket=require(_0x402e('0x1c'))(new Redis(config[_0x402e('0x19')]));require(_0x402e('0x1d'))[_0x402e('0x1e')](socket);var jayson=require(_0x402e('0x1f'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x402e('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4583b1,_0x3aa2a1,_0x40e8b9,_0x5dcf8f){return new BPromise(function(_0x28ee0f,_0x2f05d0){var _0x907c69=_0x5dcf8f||client;return _0x907c69[_0x402e('0x21')](_0x4583b1,_0x40e8b9)[_0x402e('0x22')](function(_0x2b47fb){logger['info'](_0x402e('0x23'),_0x3aa2a1,_0x402e('0x24'));logger[_0x402e('0x25')](_0x402e('0x26'),_0x3aa2a1,_0x402e('0x24'),JSON[_0x402e('0x27')](_0x2b47fb));if(_0x2b47fb[_0x402e('0x28')]){if(_0x2b47fb[_0x402e('0x28')]['code']===0x1f4){logger[_0x402e('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3aa2a1,_0x2b47fb[_0x402e('0x28')]['message']);return _0x2f05d0(_0x2b47fb['error'][_0x402e('0x29')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3aa2a1,_0x2b47fb['error'][_0x402e('0x29')]);return _0x28ee0f(_0x2b47fb[_0x402e('0x28')][_0x402e('0x29')]);}else{logger[_0x402e('0x2a')](_0x402e('0x23'),_0x3aa2a1,'request\x20sent');_0x28ee0f(_0x2b47fb[_0x402e('0x2b')][_0x402e('0x29')]);}})[_0x402e('0x2c')](function(_0x7c80a5){logger[_0x402e('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3aa2a1,_0x7c80a5);_0x2f05d0(_0x7c80a5);});});}function respondWithStatusCode(_0x2ed9fa,_0x21a968){_0x21a968=_0x21a968||0xcc;return function(_0x48b773){if(_0x48b773){return _0x2ed9fa[_0x402e('0x2d')](_0x21a968);}return _0x2ed9fa[_0x402e('0x2e')](_0x21a968)[_0x402e('0x2f')]();};}function respondWithResult(_0x19a102,_0x204575){_0x204575=_0x204575||0xc8;return function(_0x51d147){if(_0x51d147){return _0x19a102[_0x402e('0x2e')](_0x204575)['json'](_0x51d147);}};}function respondWithFilteredResult(_0x46223b,_0x5d8e92){return function(_0x3cda0d){if(_0x3cda0d){var _0x4f3e8e=typeof _0x5d8e92['offset']===_0x402e('0x30')&&typeof _0x5d8e92[_0x402e('0x31')]===_0x402e('0x30');var _0x2fafac=_0x3cda0d['count'];var _0x2d6fe3=_0x4f3e8e?0x0:_0x5d8e92[_0x402e('0x32')];var _0xedbf39=_0x4f3e8e?_0x3cda0d[_0x402e('0x33')]:_0x5d8e92[_0x402e('0x32')]+_0x5d8e92[_0x402e('0x31')];var _0x29a760;if(_0xedbf39>=_0x2fafac){_0xedbf39=_0x2fafac;_0x29a760=0xc8;}else{_0x29a760=0xce;}_0x46223b['status'](_0x29a760);return _0x46223b['set'](_0x402e('0x34'),_0x2d6fe3+'-'+_0xedbf39+'/'+_0x2fafac)[_0x402e('0x35')](_0x3cda0d);}return null;};}function patchUpdates(_0x24c711){return function(_0x175d47){try{jsonpatch[_0x402e('0x36')](_0x175d47,_0x24c711,!![]);}catch(_0x4fc3c6){return BPromise['reject'](_0x4fc3c6);}return _0x175d47[_0x402e('0x37')]();};}function saveUpdates(_0xb83736,_0x2a368f){return function(_0x37614b){if(_0x37614b){return _0x37614b[_0x402e('0x38')](_0xb83736)[_0x402e('0x22')](function(_0x1e8b2d){return _0x1e8b2d;});}return null;};}function removeEntity(_0x192b13,_0x1982b2){return function(_0x1fa271){if(_0x1fa271){return _0x1fa271[_0x402e('0x39')]()[_0x402e('0x22')](function(){_0x192b13[_0x402e('0x2e')](0xcc)[_0x402e('0x2f')]();});}};}function handleEntityNotFound(_0x399d9f,_0x28e84a){return function(_0x11c111){if(!_0x11c111){_0x399d9f['sendStatus'](0x194);}return _0x11c111;};}function handleError(_0x371c9a,_0x9caa2a){_0x9caa2a=_0x9caa2a||0x1f4;return function(_0x3728fb){logger[_0x402e('0x28')](_0x3728fb[_0x402e('0x3a')]);if(_0x3728fb['name']){delete _0x3728fb[_0x402e('0x3b')];}_0x371c9a[_0x402e('0x2e')](_0x9caa2a)[_0x402e('0x3c')](_0x3728fb);};}function getMustacheRender(_0x153717,_0x19e4dc){return Mustache[_0x402e('0x3d')](_0x153717,_[_0x402e('0x3e')](_0x19e4dc[_0x402e('0x3f')],{'contact':_0x19e4dc[_0x402e('0x40')],'message':_0x19e4dc[_0x402e('0x29')],'agent':_0x19e4dc[_0x402e('0x41')],'interaction':_0x19e4dc['interaction'],'account':_0x19e4dc[_0x402e('0x42')]}))||'';}function getInteractionUsers(_0x237ffd,_0x2e9071){return new BPromise(function(_0x482b95,_0x4b7c57){try{if(_0x2e9071[_0x237ffd['id']]){_0x237ffd[_0x402e('0x43')]=_[_0x402e('0x44')](_0x2e9071[_0x237ffd['id']],function(_0x4dc3fc){return{'id':_0x4dc3fc['id'],'fullname':_0x4dc3fc[_0x402e('0x45')]};});}}catch(_0x400d30){_0x4b7c57(_0x400d30);}_0x482b95(_0x237ffd);});}function getInteractionTags(_0x4d7212,_0x366c38){return new BPromise(function(_0x290306,_0x21f171){try{if(_0x4d7212[_0x402e('0x46')]){_0x4d7212[_0x402e('0x47')]=[];_0x4d7212[_0x402e('0x46')][_0x402e('0x48')](',')['forEach'](function(_0x46b4ec){_0x4d7212['Tags'][_0x402e('0x49')](_0x366c38[_0x46b4ec]);});}delete _0x4d7212[_0x402e('0x46')];}catch(_0x7e12d4){_0x21f171(_0x7e12d4);}_0x290306(_0x4d7212);});}function updateChatInteraction(_0x92d8f9,_0x4308aa,_0x573120){return new BPromise(function(_0x33a20c,_0x226ec4){return getInteractionUsers(_0x92d8f9,_0x573120)[_0x402e('0x22')](function(_0x92acb9){return getInteractionTags(_0x92acb9,_0x4308aa);})[_0x402e('0x22')](function(_0x2a3de1){return getStateInteraction(_0x2a3de1);})[_0x402e('0x22')](function(_0x47170b){_0x33a20c(_0x47170b);})['catch'](function(_0x25a13d){_0x226ec4(_0x25a13d);});});}function getStateInteraction(_0x528362){return new BPromise(function(_0xd03db6){_0x528362[_0x402e('0x4a')]=0x0;_0x528362[_0x402e('0x4b')]=0x0;_0x528362[_0x402e('0x4c')]=0x0;_0x528362[_0x402e('0x4d')]=0x0;_0x528362[_0x402e('0x4e')]=0x0;_0x528362['total']=0x0;if(!_0x528362[_0x402e('0x4f')]&&!_0x528362[_0x402e('0x50')]){_0x528362[_0x402e('0x4a')]+=0x1;}if(!_0x528362[_0x402e('0x4f')]&&_0x528362[_0x402e('0x50')]){_0x528362[_0x402e('0x4b')]+=0x1;if(_0x528362[_0x402e('0x4a')]){_0x528362['waiting']-=0x1;}}if(_0x528362['closed']&&_0x528362[_0x402e('0x51')]===_0x402e('0x4e')){_0x528362[_0x402e('0x4e')]+=0x1;if(_0x528362['waiting']){_0x528362[_0x402e('0x4a')]-=0x1;}}else if(_0x528362[_0x402e('0x4f')]&&!_0x528362[_0x402e('0x50')]&&_0x528362[_0x402e('0x51')]){_0x528362[_0x402e('0x4d')]+=0x1;if(_0x528362[_0x402e('0x4a')]){_0x528362[_0x402e('0x4a')]-=0x1;}}else if(_0x528362['closed']&&_0x528362[_0x402e('0x50')]){_0x528362[_0x402e('0x4c')]+=0x1;if(_0x528362[_0x402e('0x4b')]){_0x528362[_0x402e('0x4b')]-=0x1;}}_0x528362[_0x402e('0x52')]+=0x1;_0xd03db6(_0x528362);});}exports[_0x402e('0x53')]=function(_0x48c7f6,_0xac27e0){var _0x1ffff9={},_0x561746={},_0xd85de2={'count':0x0,'rows':[]};var _0x36f460=_[_0x402e('0x44')](db[_0x402e('0x54')][_0x402e('0x55')],function(_0x4bcf5c){return{'name':_0x4bcf5c['fieldName'],'type':_0x4bcf5c[_0x402e('0x56')][_0x402e('0x57')]};});_0x561746[_0x402e('0x58')]=_[_0x402e('0x44')](_0x36f460,_0x402e('0x3b'));_0x561746['query']=_[_0x402e('0x59')](_0x48c7f6[_0x402e('0x5a')]);_0x561746[_0x402e('0x5b')]=_['intersection'](_0x561746[_0x402e('0x58')],_0x561746[_0x402e('0x5a')]);_0x1ffff9[_0x402e('0x5c')]=_['intersection'](_0x561746[_0x402e('0x58')],qs[_0x402e('0x5d')](_0x48c7f6[_0x402e('0x5a')][_0x402e('0x5d')]));_0x1ffff9[_0x402e('0x5c')]=_0x1ffff9[_0x402e('0x5c')][_0x402e('0x5e')]?_0x1ffff9[_0x402e('0x5c')]:_0x561746[_0x402e('0x58')];if(!_0x48c7f6[_0x402e('0x5a')][_0x402e('0x5f')](_0x402e('0x60'))){_0x1ffff9['limit']=qs['limit'](_0x48c7f6[_0x402e('0x5a')][_0x402e('0x31')]);_0x1ffff9['offset']=qs['offset'](_0x48c7f6[_0x402e('0x5a')][_0x402e('0x32')]);}_0x1ffff9[_0x402e('0x61')]=qs[_0x402e('0x62')](_0x48c7f6[_0x402e('0x5a')][_0x402e('0x62')]);_0x1ffff9[_0x402e('0x63')]=qs[_0x402e('0x5b')](_[_0x402e('0x64')](_0x48c7f6[_0x402e('0x5a')],_0x561746[_0x402e('0x5b')]),_0x36f460);var _0x3c4388=[];var _0x42bd57=squel['select']()[_0x402e('0x65')]('id')['field'](_0x402e('0x3b'))['field'](_0x402e('0x66'))[_0x402e('0x67')](_0x402e('0x68'));var _0x2837dd=squel[_0x402e('0x69')]()[_0x402e('0x65')](_0x402e('0x6a'))[_0x402e('0x65')](_0x402e('0x6b'))[_0x402e('0x65')](_0x402e('0x6c'))[_0x402e('0x67')](_0x402e('0x6d'),'ui')[_0x402e('0x6e')](_0x402e('0x6f'),'u','u.id\x20=\x20ui.UserId');var _0x431e=squel['select']()[_0x402e('0x67')]('chat_interactions','i')['left_join']('cm_contacts','c',_0x402e('0x70'))[_0x402e('0x6e')](_0x402e('0x6f'),'o','o.id\x20=\x20i.UserId')[_0x402e('0x6e')]('chat_websites','a',_0x402e('0x71'))['left_join'](_0x402e('0x72'),'me',_0x402e('0x73'))[_0x402e('0x6e')]('chat_interaction_has_tags','it',_0x402e('0x74'))['left_join'](_0x402e('0x68'),'t',_0x402e('0x75'));var _0x457e2e=squel[_0x402e('0x76')]();var _0x2d3f3f=[];var _0x44fc27=squel[_0x402e('0x76')]();var _0x3f02d3;if(_0x48c7f6[_0x402e('0x5a')][_0x402e('0x77')]){_0x3f02d3=as[_0x402e('0x78')](_0x48c7f6[_0x402e('0x5a')][_0x402e('0x77')]);var _0x221ba3=_0x3f02d3[_0x402e('0x79')];for(var _0x660b75=0x0;_0x660b75<_0x3f02d3[_0x402e('0x7a')][_0x402e('0x5e')];_0x660b75++){var _0x481e0b=_0x3f02d3[_0x402e('0x7a')][_0x660b75];var _0x4a5162='i';var _0x4c2e22=_[_0x402e('0x7b')](_0x36f460,[_0x402e('0x3b'),_0x481e0b[_0x402e('0x65')]]);if(!_0x4c2e22){switch(_0x481e0b[_0x402e('0x65')]){case _0x402e('0x7c'):if(_0x481e0b[_0x402e('0x7d')]==0x1){_0x431e['having']('`'+_0x481e0b[_0x402e('0x65')]+_0x402e('0x7e'));}else{_0x431e['having']('`'+_0x481e0b['field']+'`\x20>\x200');}break;case _0x402e('0x7f'):if(_0x481e0b['operator']==='$substring'){if(_0x481e0b[_0x402e('0x7d')][_0x402e('0x48')]('\x20')[_0x402e('0x5e')]>0x1){_0x457e2e[_0x221ba3](_0x402e('0x80'),qs['getFullTextValue'](_0x481e0b[_0x402e('0x7d')]),null);}else{var _0x3bcc59='%'+_0x481e0b[_0x402e('0x7d')]+'%';_0x457e2e[_0x221ba3](_0x402e('0x81'),_0x3bcc59,_0x3bcc59,_0x3bcc59);}}else{_0x4c2e22=_[_0x402e('0x7b')](_0x36f460,[_0x402e('0x3b'),_0x402e('0x82')]);_0x481e0b[_0x402e('0x65')]=_0x402e('0x82');_0x2c59f3=as[_0x402e('0x83')](_0x4a5162,_0x4c2e22['type'],_0x481e0b);_0x457e2e[_0x221ba3](_0x2c59f3[_0x402e('0x84')],_0x2c59f3['value']['start'],_0x2c59f3[_0x402e('0x7d')][_0x402e('0x2f')]);}break;case'Tag':var _0x34d25d=_0x481e0b[_0x402e('0x7d')][_0x402e('0x48')](',')[_0x402e('0x44')](function(_0x5830c2){return Number(_0x5830c2);});_0x34d25d[_0x402e('0x85')](function(_0x1b20f1){_0x44fc27['or'](_0x402e('0x86'),'%,'+_0x1b20f1+',%');});_0x2d3f3f=_['union'](_0x2d3f3f,_0x34d25d);break;case'User':if(_0x481e0b[_0x402e('0x87')]===_0x402e('0x88')){_0x457e2e[_0x221ba3](_0x402e('0x89'),'%'+_0x481e0b[_0x402e('0x7d')]+'%',null);}else{_0x4c2e22=_[_0x402e('0x7b')](_0x36f460,[_0x402e('0x3b'),_0x402e('0x50')]);_0x481e0b['field']=_0x402e('0x50');_0x2c59f3=as['buildExpression'](_0x4a5162,_0x4c2e22['type'],_0x481e0b);_0x457e2e[_0x221ba3](_0x2c59f3[_0x402e('0x84')],_0x2c59f3[_0x402e('0x7d')][_0x402e('0x8a')],_0x2c59f3[_0x402e('0x7d')]['end']);}break;case _0x402e('0x3f'):_0x2c59f3=as[_0x402e('0x83')]('me',null,_0x481e0b);_0x457e2e[_0x221ba3](_0x2c59f3[_0x402e('0x84')],_0x2c59f3['value'][_0x402e('0x8a')],_0x2c59f3['value']['end']);break;}}else{var _0x2c59f3=as[_0x402e('0x83')](_0x4a5162,_0x4c2e22['type'],_0x481e0b);_0x457e2e[_0x221ba3](_0x2c59f3[_0x402e('0x84')],_0x2c59f3[_0x402e('0x7d')][_0x402e('0x8a')],_0x2c59f3[_0x402e('0x7d')][_0x402e('0x2f')]);}}}else{var _0x336608=_(_0x48c7f6['query'])[_0x402e('0x59')]()[_0x402e('0x44')](function(_0x28a1d3){return _[_0x402e('0x8b')](_0x36f460,[_0x402e('0x3b'),_0x28a1d3])?_0x28a1d3:undefined;})[_0x402e('0x8c')]()[_0x402e('0x7d')]();if(!_[_0x402e('0x8d')](_0x336608)){_0x336608['forEach'](function(_0x161853){if(_0x161853==='ChatWebsiteId'){_0x431e[_0x402e('0x63')]('i.ChatWebsiteId\x20IN\x20?',[][_0x402e('0x8e')](_0x48c7f6['query'][_0x161853]));}else if(_0x161853===_0x402e('0x8f')){var _0x3c7d3d=JSON[_0x402e('0x90')](_0x48c7f6[_0x402e('0x5a')][_0x161853])[_0x402e('0x91')];var _0x171389=JSON[_0x402e('0x90')](_0x48c7f6[_0x402e('0x5a')][_0x161853])[_0x402e('0x92')];_0x431e['where'](_0x402e('0x93'),_0x3c7d3d,_0x171389);}else{if(_0x48c7f6[_0x402e('0x5a')][_0x161853]===_0x402e('0x94')){_0x431e[_0x402e('0x63')]('i.'+_0x161853+_0x402e('0x95'));}else{_0x431e[_0x402e('0x63')]('i.'+_0x161853+_0x402e('0x96'),_0x48c7f6[_0x402e('0x5a')][_0x161853]);}}});}if(_0x48c7f6[_0x402e('0x5a')][_0x402e('0x97')]){if(_0x48c7f6[_0x402e('0x5a')][_0x402e('0x97')]==0x1){_0x431e['having'](_0x402e('0x98'));}else{_0x431e[_0x402e('0x99')](_0x402e('0x9a'));}}if(_0x48c7f6['query'][_0x402e('0x9b')]){_0x2d3f3f=_[_0x402e('0x9c')](_0x48c7f6[_0x402e('0x5a')]['tag'])?_0x48c7f6[_0x402e('0x5a')][_0x402e('0x9b')]:new Array(_0x48c7f6[_0x402e('0x5a')][_0x402e('0x9b')]);_0x2d3f3f['forEach'](function(_0x59ecde){_0x44fc27['or'](_0x402e('0x86'),'%,'+_0x59ecde+',%');});}if(_0x48c7f6[_0x402e('0x5a')]['filter']){var _0x1b8bb8=_0x48c7f6[_0x402e('0x5a')][_0x402e('0x9d')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1b8bb8)){_0x457e2e['or'](_0x402e('0x9e'),_0x1b8bb8+'%');}else{_0x457e2e['or'](_0x402e('0x9f'),qs[_0x402e('0xa0')](_0x1b8bb8))['or'](_0x402e('0xa1'),_0x1b8bb8+'%');}}}_0x431e[_0x402e('0x63')](_0x457e2e);_0x431e[_0x402e('0xa2')](_0x402e('0xa3'));var _0x25e21b={'type':db['Sequelize'][_0x402e('0xa4')][_0x402e('0xa5')],'raw':!![]};var _0x52096d=_0x431e[_0x402e('0xa6')]();_0x52096d[_0x402e('0x65')](_0x402e('0xa3'));_0x52096d[_0x402e('0x65')](_0x402e('0xa7'),_0x402e('0x7c'));if(_0x1ffff9[_0x402e('0x61')]){_0x1ffff9[_0x402e('0x61')]['forEach'](function(_0x568e16){var _0x311d23=_0x568e16[0x0]===_0x402e('0xa8')?_0x568e16[0x0]:'i.'+_0x568e16[0x0];_0x431e[_0x402e('0x61')](_0x311d23,_0x568e16[0x1]==='DESC'?![]:!![]);});}if(!_[_0x402e('0x8d')](_0x2d3f3f)){_0x431e['having'](_0x44fc27);_0x52096d[_0x402e('0x63')]('t.id\x20IN\x20?',_0x2d3f3f);}BPromise[_0x402e('0xa9')]()['then'](function(){if(!_0x3f02d3){if(_0x48c7f6[_0x402e('0x5a')][_0x402e('0xaa')])return;_0x52096d['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x431e['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x48c7f6[_0x402e('0xab')]['role']!==_0x402e('0x41'))return;return _0x48c7f6['user'][_0x402e('0xac')]({'attributes':['id'],'raw':!![]})[_0x402e('0x22')](function(_0x4f2174){if(_[_0x402e('0x8d')](_0x4f2174)){_0x52096d[_0x402e('0x63')](_0x402e('0xad'));_0x431e[_0x402e('0x63')](_0x402e('0xad'));}else{_0x52096d['where'](_0x402e('0xae'),_[_0x402e('0x44')](_0x4f2174,'id'));_0x431e[_0x402e('0x63')](_0x402e('0xae'),_[_0x402e('0x44')](_0x4f2174,'id'));}});})['then'](function(){if(_0x48c7f6[_0x402e('0xab')][_0x402e('0xaf')]==='agent'&&!_0x3f02d3&&!_0x48c7f6[_0x402e('0x5a')][_0x402e('0xaa')])return[];return db[_0x402e('0xb0')][_0x402e('0x5a')](_0x52096d[_0x402e('0xb1')](),_0x25e21b);})['then'](function(_0x37e8a3){_0xd85de2[_0x402e('0x33')]=_0x37e8a3['length'];if(_0xd85de2['count']===0x0)return[];return db[_0x402e('0xb0')][_0x402e('0x5a')](_0x42bd57[_0x402e('0xb1')](),_0x25e21b)['then'](function(_0x17496a){_0x3c4388=_[_0x402e('0xb2')](_0x17496a,'id');_0x25e21b=_[_0x402e('0x3e')](_0x25e21b,{'model':db[_0x402e('0x54')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48c7f6[_0x402e('0x5a')][_0x402e('0x5d')]){_0x1ffff9[_0x402e('0x5c')][_0x402e('0x85')](function(_0x2b3828){_0x431e[_0x402e('0x65')]('i.'+_0x2b3828);});}else{_0x431e[_0x402e('0x65')](_0x402e('0xa7'),'unreadMessages');_0x431e[_0x402e('0x65')](_0x402e('0xb3'),_0x402e('0xb4'));_0x431e[_0x402e('0x65')](_0x402e('0xb5'),'Account.mandatoryDisposition');_0x431e[_0x402e('0x65')](_0x402e('0xb6'),_0x402e('0xa8'));_0x431e[_0x402e('0x65')](_0x402e('0xb7'));_0x431e[_0x402e('0x65')]('c.firstName',_0x402e('0xb8'));_0x431e[_0x402e('0x65')](_0x402e('0xb9'),_0x402e('0xba'));_0x431e[_0x402e('0x65')]('c.email',_0x402e('0xbb'));_0x431e[_0x402e('0x65')]('c.phone','Contact.phone');_0x431e[_0x402e('0x65')]('c.mobile',_0x402e('0xbc'));_0x431e[_0x402e('0x65')](_0x402e('0xbd'),_0x402e('0xbe'));_0x431e['field'](_0x402e('0xbf'),_0x402e('0xc0'));_0x431e['field']('o.internal',_0x402e('0xc1'));_0x431e[_0x402e('0x65')](_0x402e('0xc2'),_0x402e('0x46'));}if(_0x1ffff9[_0x402e('0x31')])_0x431e[_0x402e('0x31')](_0x1ffff9['limit']);if(_0x1ffff9[_0x402e('0x32')])_0x431e[_0x402e('0x32')](_0x1ffff9[_0x402e('0x32')]);return db['sequelize'][_0x402e('0x5a')](_0x431e['toString'](),_0x25e21b);})[_0x402e('0x22')](function(_0x54dd00){if(_0x54dd00[_0x402e('0x5e')]>0x0)_0x2837dd['where'](_0x402e('0xc3'),_[_0x402e('0x44')](_0x54dd00,'id'));return db[_0x402e('0xb0')][_0x402e('0x5a')](_0x2837dd[_0x402e('0xb1')](),_0x25e21b)[_0x402e('0x22')](function(_0x1aea5e){var _0x4c025a=_[_0x402e('0xc4')](_0x1aea5e,_0x402e('0xc5'));var _0xf4f5ff=[];_0x54dd00[_0x402e('0x85')](function(_0x16febb){_0xf4f5ff[_0x402e('0x49')](updateChatInteraction(_0x16febb,_0x3c4388,_0x4c025a));});return BPromise[_0x402e('0xc6')](_0xf4f5ff);});});})[_0x402e('0x22')](function(_0xb999cc){_0xd85de2[_0x402e('0xc7')]=_0xb999cc;return _0xd85de2;})[_0x402e('0x22')](respondWithFilteredResult(_0xac27e0,_0x1ffff9))[_0x402e('0x2c')](handleError(_0xac27e0,null));};exports['show']=function(_0x4550ee,_0x421de0){var _0x131dc4={'raw':![],'where':{'id':_0x4550ee['params']['id']}},_0x3e4f1e={};_0x3e4f1e[_0x402e('0x58')]=_[_0x402e('0x59')](db['ChatInteraction'][_0x402e('0x55')]);_0x3e4f1e[_0x402e('0x5a')]=_[_0x402e('0x59')](_0x4550ee[_0x402e('0x5a')]);_0x3e4f1e[_0x402e('0x5b')]=_[_0x402e('0xc8')](_0x3e4f1e[_0x402e('0x58')],_0x3e4f1e['query']);_0x131dc4[_0x402e('0x5c')]=_[_0x402e('0xc8')](_0x3e4f1e[_0x402e('0x58')],qs[_0x402e('0x5d')](_0x4550ee['query'][_0x402e('0x5d')]));_0x131dc4[_0x402e('0x5c')]=_0x131dc4['attributes']['length']?_0x131dc4[_0x402e('0x5c')]:_0x3e4f1e[_0x402e('0x58')];if(_0x4550ee[_0x402e('0x5a')][_0x402e('0xc9')]){_0x131dc4[_0x402e('0xca')]=[{'all':!![]}];}_0x131dc4=_[_0x402e('0x3e')]({},_0x131dc4,_0x4550ee['options']);return db['ChatInteraction'][_0x402e('0x7b')](_0x131dc4)['then'](handleEntityNotFound(_0x421de0,null))['then'](respondWithResult(_0x421de0,null))[_0x402e('0x2c')](handleError(_0x421de0,null));};exports[_0x402e('0xcb')]=function(_0x25b8da,_0x5814bc){return db[_0x402e('0x54')]['create'](_0x25b8da[_0x402e('0x3f')],{})[_0x402e('0x22')](respondWithResult(_0x5814bc,0xc9))['catch'](handleError(_0x5814bc,null));};exports['update']=function(_0x3ffa1c,_0x200af4){if(_0x3ffa1c['body']['id']){delete _0x3ffa1c[_0x402e('0x3f')]['id'];}return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0x3ffa1c[_0x402e('0xcc')]['id']}})[_0x402e('0x22')](handleEntityNotFound(_0x200af4,null))[_0x402e('0x22')](saveUpdates(_0x3ffa1c[_0x402e('0x3f')],null))[_0x402e('0x22')](respondWithResult(_0x200af4,null))[_0x402e('0x2c')](handleError(_0x200af4,null));};exports[_0x402e('0x39')]=function(_0x4b8179,_0x42d4c5){return db['ChatInteraction'][_0x402e('0x7b')]({'where':{'id':_0x4b8179[_0x402e('0xcc')]['id']}})[_0x402e('0x22')](handleEntityNotFound(_0x42d4c5,null))[_0x402e('0x22')](removeEntity(_0x42d4c5,null))[_0x402e('0x2c')](handleError(_0x42d4c5,null));};exports[_0x402e('0xcd')]=function(_0x2d334,_0x1805b0){return db[_0x402e('0x54')][_0x402e('0xcd')]()[_0x402e('0x22')](respondWithResult(_0x1805b0,null))[_0x402e('0x2c')](handleError(_0x1805b0,null));};exports['createVidaooSession']=function(_0x2aa12f,_0x483c47){var _0x51d7df=_0x2aa12f['params']['id'];var _0x11de00;var _0x2d2bb1;var _0x7d248e;return db['ChatInteraction'][_0x402e('0xce')]({'where':{'id':_0x51d7df}})[_0x402e('0x22')](function(_0x4afe9b){_0x11de00=_0x4afe9b;return db['ChatWebsite']['findOne']({'where':{'id':_0x4afe9b[_0x402e('0xaa')]},'attributes':['id',_0x402e('0xcf'),_0x402e('0xd0'),'vidaooTopic','vidaooNote',_0x402e('0xd1')],'raw':!![]});})['then'](function(_0x45a1b6){if(_0x45a1b6&&_0x45a1b6['vidaooApiKey']&&_0x45a1b6[_0x402e('0xd0')]){_0x2d2bb1=_0x45a1b6;var _0x2ab1a4={'interaction':{'id':_0x51d7df},'agent':{'id':_0x2aa12f['user']['id'],'name':_0x2aa12f[_0x402e('0xab')][_0x402e('0x3b')],'fullname':_0x2aa12f['user'][_0x402e('0x45')],'email':_0x2aa12f[_0x402e('0xab')][_0x402e('0xd2')]},'contact':_0x2aa12f[_0x402e('0x3f')][_0x402e('0x40')],'account':_0x2aa12f[_0x402e('0x3f')]['account']};var _0x4bea8e={'rejectUnauthorized':![],'method':_0x402e('0xd3'),'url':_0x402e('0xd4'),'headers':{'X-APIKEY':_0x45a1b6[_0x402e('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2aa12f[_0x402e('0xab')][_0x402e('0xd2')]],'buttons':null,'topic':_0x2d2bb1[_0x402e('0xd5')],'note':_[_0x402e('0xd6')](_0x2d2bb1[_0x402e('0xd7')])?null:getMustacheRender(_0x2d2bb1[_0x402e('0xd7')],_0x2ab1a4),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x402e('0xd6')](_0x2d2bb1[_0x402e('0xd1')])){var _0x376907=getMustacheRender(_0x2d2bb1['vidaooMetadata'],_0x2ab1a4);var _0x58b1cc=JSON['parse'](_0x376907);_0x4bea8e['body'][_0x402e('0xd8')]=_0x58b1cc;}}catch(_0x2955ee){throw new db[(_0x402e('0xd9'))][(_0x402e('0xda'))](_0x402e('0xdb'));}return rp(_0x4bea8e);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x402e('0x22')](function(_0x1a9b6c){_0x7d248e=_0x1a9b6c;if(_0x7d248e['id']){var _0x51f471={'body':_0x7d248e[_0x402e('0xdc')],'ChatWebsiteId':_0x2d2bb1['id'],'ChatInteractionId':_0x11de00['id'],'direction':_0x402e('0xdd'),'UserId':_0x2aa12f[_0x402e('0xab')]['id']};return db[_0x402e('0xde')][_0x402e('0xcb')](_0x51f471,{});}else{throw new db[(_0x402e('0xd9'))][(_0x402e('0xda'))](_0x402e('0xdf'));}})[_0x402e('0x22')](function(){return _0x11de00['updateAttributes']({'vidaooSessionId':_0x7d248e['id']});})['then'](respondWithResult(_0x483c47,null))['catch'](handleError(_0x483c47,null));};exports[_0x402e('0xe0')]=function(_0x2d541,_0x3cc97b){if(_0x2d541['body']['id']){delete _0x2d541[_0x402e('0x3f')]['id'];}return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0x2d541[_0x402e('0xcc')]['id']},'include':[{'model':db[_0x402e('0xe1')],'as':'Contact'}]})[_0x402e('0x22')](handleEntityNotFound(_0x3cc97b,null))['then'](saveUpdates(_0x2d541[_0x402e('0x3f')],null))[_0x402e('0x22')](respondWithResult(_0x3cc97b,null))['catch'](handleError(_0x3cc97b,null));};exports[_0x402e('0xe2')]=function(_0x15ad6f,_0x33fd3b,_0x5d4278){if(_0x15ad6f[_0x402e('0x3f')]['id']){delete _0x15ad6f[_0x402e('0x3f')]['id'];}return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0x15ad6f[_0x402e('0xcc')]['id']}})[_0x402e('0x22')](function(_0x548785){if(!_0x548785){logger['error'](_0x402e('0xe3'),_0x402e('0xe2'),0x194,'entity\x20not\x20found');_0x33fd3b[_0x402e('0x2d')](0x194);}else{if(_0x548785[_0x402e('0x50')]){throw new db[(_0x402e('0xd9'))]['ValidationError'](_0x402e('0xe4'));}}return _0x548785;})[_0x402e('0x22')](function(_0x3e3738){if(_0x3e3738){return _0x3e3738[_0x402e('0x38')]({'closed':_0x15ad6f['body'][_0x402e('0x4f')],'disposition':_0x15ad6f[_0x402e('0x3f')][_0x402e('0x51')]})['then'](function(_0x5e44aa){return _0x5e44aa;});}})[_0x402e('0x22')](function(_0x485811){return respondWithRpcPromise(_0x402e('0xe5'),_0x402e('0xe2'),_0x15ad6f[_0x402e('0x3f')],client9004);})['then'](respondWithResult(_0x33fd3b,null))[_0x402e('0x2c')](handleError(_0x33fd3b,null));};exports[_0x402e('0xe6')]=function(_0x3050b6,_0x101c71,_0x14780b){_0x3050b6[_0x402e('0x3f')][_0x402e('0x3b')]=_0x3050b6[_0x402e('0xe7')][_0x402e('0xe8')];_0x3050b6[_0x402e('0x3f')][_0x402e('0xe9')]=_0x3050b6[_0x402e('0xe7')]['filename'];_0x3050b6[_0x402e('0x3f')][_0x402e('0x56')]=_0x3050b6[_0x402e('0xe7')][_0x402e('0xea')];return db[_0x402e('0xeb')][_0x402e('0xcb')](_0x3050b6[_0x402e('0x3f')])[_0x402e('0x22')](respondWithResult(_0x101c71,0xc9))['catch'](handleError(_0x101c71,null));};exports[_0x402e('0xec')]=function(_0x203678,_0x286954,_0x34dbee){return db[_0x402e('0x54')][_0x402e('0xce')]({'where':{'id':_0x203678[_0x402e('0xcc')]['id']},'raw':!![]})[_0x402e('0x22')](handleEntityNotFound(_0x286954,null))[_0x402e('0x22')](function(_0x31f8c7){if(_0x31f8c7){if(_0x31f8c7[_0x402e('0x4f')]){return _0x286954[_0x402e('0x2e')](0x193)['json']({'status':0x193,'message':_0x402e('0xed')});}return db[_0x402e('0xeb')][_0x402e('0xce')]({'where':{'id':_0x203678[_0x402e('0x5a')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x286954,null));}})[_0x402e('0x22')](function(_0x5de73a){if(_0x5de73a){var _0x437018=_0x5de73a[_0x402e('0xee')]!==null;var _0x5a03a0=path[_0x402e('0xef')](config['root'],_0x402e('0xf0'));if(_0x437018){_0x5a03a0=path[_0x402e('0xef')](_0x5a03a0,_0x402e('0xf1'));}var _0x1fac7a=path[_0x402e('0xef')](_0x5a03a0,_0x5de73a['basename']);return _0x286954[_0x402e('0xf2')](_0x1fac7a);}})[_0x402e('0x2c')](handleError(_0x286954,null));};exports[_0x402e('0xf3')]=function(_0x3983bd,_0x2ebe66){var _0x3c5d52=null;var _0x505768=null;var _0x23fad0=null;var _0x5b9733=null;if(_0x3983bd[_0x402e('0x3f')]['id']){delete _0x3983bd[_0x402e('0x3f')]['id'];}if(_0x3983bd[_0x402e('0x3f')][_0x402e('0xf4')]){_0x5b9733=path[_0x402e('0xef')](config['root'],_0x402e('0xf5'),util[_0x402e('0xf6')](_0x402e('0xf7'),Date[_0x402e('0xf8')]()));_0x3983bd[_0x402e('0x3f')]['pathTranscript']=_0x5b9733;}return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0x3983bd[_0x402e('0xcc')]['id']},'include':[{'model':db[_0x402e('0xde')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0x402e('0x22')](handleEntityNotFound(_0x2ebe66,null))[_0x402e('0x22')](saveUpdates(_0x3983bd[_0x402e('0x3f')],null))[_0x402e('0x22')](function(_0x90a0b6){if(_0x90a0b6){_0x3c5d52=_0x90a0b6;return db[_0x402e('0xf9')][_0x402e('0x7b')]({'where':{'id':_0x3c5d52['ChatWebsiteId']}});}})['then'](function(_0x5765f2){if(_0x5765f2){_0x23fad0=_0x5765f2;return db['CmContact'][_0x402e('0x7b')]({'where':{'id':_0x3c5d52['ContactId']}});}})[_0x402e('0x22')](function(_0x3c25c1){if(_0x3c25c1){_0x505768=_0x3c25c1;if(_0x5b9733){var _0x2a2940=null;for(var _0x57f543=0x1;_0x57f543<_0x3c5d52[_0x402e('0xfa')]['length'];++_0x57f543){_0x2a2940=_0x3c5d52[_0x402e('0xfa')][_0x57f543];var _0x104c72=_0x2a2940[_0x402e('0x50')]?util[_0x402e('0xf6')](_0x402e('0xfb'),_0x23fad0[_0x402e('0xfc')],_0x2a2940[_0x402e('0x50')]):_0x402e('0xfd');var _0x310186=_0x3983bd[_0x402e('0x3f')][_0x402e('0xfe')]||util[_0x402e('0xf6')](_0x402e('0xfb'),_0x402e('0xff'),_0x2a2940[_0x402e('0x82')]);switch(_0x23fad0['agentIdentifier']){case _0x402e('0x100'):_0x104c72=_0x2a2940['UserId']?util[_0x402e('0xf6')]('%s%d',_0x23fad0[_0x402e('0xfc')],_0x2a2940[_0x402e('0x50')]):_0x402e('0xfd');break;case _0x402e('0x101'):_0x104c72=_0x2a2940[_0x402e('0x50')]?_0x2a2940[_0x402e('0x102')][_0x402e('0x103')]||_0x2a2940[_0x402e('0x102')][_0x402e('0x45')]:'System';break;case'agent_fullname':_0x104c72=_0x2a2940[_0x402e('0x50')]?_0x2a2940['User']['fullname']:'System';break;default:_0x104c72=_0x2a2940[_0x402e('0x50')]?util[_0x402e('0xf6')](_0x402e('0xfb'),_0x23fad0[_0x402e('0xfc')],_0x2a2940[_0x402e('0x50')]):'System';}var _0x5bbf19=util[_0x402e('0xf6')](_0x402e('0x104'),moment(_0x2a2940['createdAt'])[_0x402e('0xf6')](_0x402e('0x105')),_0x2a2940['direction']==='in'?_0x310186:_0x104c72,_0x2a2940['body']);if(!_0x2a2940[_0x402e('0x106')]){fs[_0x402e('0x107')](_0x5b9733,_0x5bbf19);}}return db[_0x402e('0x108')][_0x402e('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x402e('0x109')],'as':_0x402e('0x10a'),'raw':!![]}]});}}})[_0x402e('0x22')](function(_0x3c08fc){if(_0x3c08fc&&_0x3c08fc[_0x402e('0x10a')]&&_0x3983bd[_0x402e('0x3f')]){var _0x24ca91={'tls':{'rejectUnauthorized':![]}};if(_0x3c08fc['Smtp']['service']){_0x24ca91[_0x402e('0x10b')]=_0x3c08fc[_0x402e('0x10a')][_0x402e('0x10b')];}else{_0x24ca91[_0x402e('0x10c')]=_0x3c08fc['Smtp'][_0x402e('0x10c')];_0x24ca91[_0x402e('0x10d')]=_0x3c08fc[_0x402e('0x10a')]['port'];_0x24ca91[_0x402e('0x10e')]=_0x3c08fc[_0x402e('0x10a')]['secure'];}if(_0x3c08fc[_0x402e('0x10a')][_0x402e('0x10f')]){_0x24ca91[_0x402e('0x110')]={'user':_0x3c08fc[_0x402e('0x10a')][_0x402e('0xab')],'pass':_0x3c08fc[_0x402e('0x10a')][_0x402e('0x111')]};}return respondWithRpcPromise(_0x402e('0x112'),_0x402e('0x113'),{'account':_0x24ca91,'message':{'from':util[_0x402e('0xf6')](_0x402e('0x114'),_0x3c08fc[_0x402e('0x3b')],_0x3c08fc[_0x402e('0xd2')]||_0x3c08fc['Smtp']['user']),'to':_0x3983bd[_0x402e('0x3f')][_0x402e('0xf4')],'subject':_0x402e('0x115'),'text':util[_0x402e('0xf6')](_0x402e('0x116'),_0x3983bd[_0x402e('0x3f')][_0x402e('0xf4')]),'attachments':[{'path':_0x5b9733}]}})[_0x402e('0x22')](function(){return _0x3c5d52;})[_0x402e('0x2c')](function(_0x38144c){console[_0x402e('0x28')](_0x38144c);});}else{return _0x3c5d52;}})[_0x402e('0x22')](respondWithStatusCode(_0x2ebe66,0xc8))[_0x402e('0x2c')](handleError(_0x2ebe66,null));};exports['addMessage']=function(_0x4e8cb8,_0x401946,_0x4167e1){return db[_0x402e('0xde')][_0x402e('0x7b')]({'where':{'id':_0x4e8cb8[_0x402e('0xcc')]['id']}})[_0x402e('0x22')](handleEntityNotFound(_0x401946,null))['then'](function(_0x5f5722){if(_0x5f5722){return _0x5f5722[_0x402e('0x117')](_0x4e8cb8[_0x402e('0x3f')][_0x402e('0x118')],_[_0x402e('0x119')](_0x4e8cb8[_0x402e('0x3f')],[_0x402e('0x118'),'id'])||{});}})['then'](respondWithResult(_0x401946,null))[_0x402e('0x2c')](handleError(_0x401946,null));};exports[_0x402e('0x11a')]=function(_0x545ee0,_0x8ccdb6,_0x4988a1){var _0x336a62={'raw':![],'where':{}};var _0x91a135={};var _0x117c08={'count':0x0,'rows':[]};return db[_0x402e('0x54')][_0x402e('0xce')]({'where':{'id':_0x545ee0['params']['id']}})[_0x402e('0x22')](handleEntityNotFound(_0x8ccdb6,null))['then'](function(_0x56daf7){if(_0x56daf7){_0x91a135[_0x402e('0x58')]=_[_0x402e('0x59')](db[_0x402e('0xde')][_0x402e('0x55')]);_0x91a135[_0x402e('0x5a')]=_[_0x402e('0x59')](_0x545ee0['query']);_0x91a135[_0x402e('0x5b')]=_['intersection'](_0x91a135['model'],_0x91a135[_0x402e('0x5a')]);_0x336a62[_0x402e('0x5c')]=_['intersection'](_0x91a135[_0x402e('0x58')],qs[_0x402e('0x5d')](_0x545ee0[_0x402e('0x5a')][_0x402e('0x5d')]));_0x336a62[_0x402e('0x5c')]=_0x336a62[_0x402e('0x5c')][_0x402e('0x5e')]?_0x336a62[_0x402e('0x5c')]:_0x91a135['model'];if(!_0x545ee0['query'][_0x402e('0x5f')]('nolimit')){_0x336a62[_0x402e('0x31')]=qs[_0x402e('0x31')](_0x545ee0[_0x402e('0x5a')][_0x402e('0x31')]);_0x336a62['offset']=qs[_0x402e('0x32')](_0x545ee0['query'][_0x402e('0x32')]);}_0x336a62[_0x402e('0x61')]=qs[_0x402e('0x62')](_0x545ee0[_0x402e('0x5a')][_0x402e('0x62')]);_0x336a62[_0x402e('0x63')]=qs[_0x402e('0x5b')](_[_0x402e('0x64')](_0x545ee0[_0x402e('0x5a')],_0x91a135[_0x402e('0x5b')]));_0x336a62['where'][_0x402e('0xc5')]=_0x56daf7['id'];if(_0x545ee0['query'][_0x402e('0x9d')]){_0x336a62[_0x402e('0x63')]=_['merge'](_0x336a62[_0x402e('0x63')],{'$or':_[_0x402e('0x44')](_0x336a62[_0x402e('0x5c')],function(_0x28025f){var _0x18f20a={};_0x18f20a[_0x28025f]={'$like':'%'+_0x545ee0['query'][_0x402e('0x9d')]+'%'};return _0x18f20a;})});}if(_0x545ee0[_0x402e('0x5a')][_0x402e('0x91')]){var _0x28a35d=_0x545ee0[_0x402e('0x5a')][_0x402e('0x91')][_0x402e('0x48')](',');var _0x25728e={};_0x25728e[_0x28a35d[0x0]]={'$gte':moment(_0x28a35d[0x1])[_0x402e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x336a62[_0x402e('0x63')]=_[_0x402e('0x3e')](_0x336a62[_0x402e('0x63')],_0x25728e);}_0x336a62=_[_0x402e('0x3e')]({},_0x336a62,_0x545ee0[_0x402e('0x11b')]);return db[_0x402e('0xde')][_0x402e('0x33')]({'where':_0x336a62[_0x402e('0x63')]})[_0x402e('0x22')](function(_0x1cd072){_0x117c08[_0x402e('0x33')]=_0x1cd072;if(_0x545ee0[_0x402e('0x5a')][_0x402e('0xc9')]){_0x336a62[_0x402e('0xca')]=[{'all':!![]}];}return db[_0x402e('0xde')][_0x402e('0x11c')](_0x336a62);})[_0x402e('0x22')](function(_0x543464){_0x117c08[_0x402e('0xc7')]=_0x543464;return _0x117c08;});}})[_0x402e('0x22')](respondWithFilteredResult(_0x8ccdb6,_0x336a62))[_0x402e('0x2c')](handleError(_0x8ccdb6,null));};exports[_0x402e('0x11d')]=function(_0x5a3e45,_0x7804a3,_0xf924d9){var _0xcea034={'where':{}},_0x3c81d1={},_0x1bd289={'count':0x0,'rows':[]};return db[_0x402e('0x54')][_0x402e('0xce')]({'where':{'id':_0x5a3e45[_0x402e('0xcc')]['id']}})[_0x402e('0x22')](handleEntityNotFound(_0x7804a3,null))[_0x402e('0x22')](function(_0x20783f){if(_0x20783f){_0x3c81d1[_0x402e('0x58')]=_[_0x402e('0x59')](db[_0x402e('0xde')][_0x402e('0x55')]);_0x3c81d1[_0x402e('0x5a')]=_['keys'](_0x5a3e45[_0x402e('0x5a')]);_0x3c81d1['filters']=_[_0x402e('0xc8')](_0x3c81d1[_0x402e('0x58')],_0x3c81d1[_0x402e('0x5a')]);_0xcea034[_0x402e('0x5c')]=_[_0x402e('0xc8')](_0x3c81d1[_0x402e('0x58')],qs[_0x402e('0x5d')](_0x5a3e45[_0x402e('0x5a')][_0x402e('0x5d')]));_0xcea034[_0x402e('0x5c')]=_0xcea034[_0x402e('0x5c')][_0x402e('0x5e')]?_0xcea034['attributes']:_0x3c81d1[_0x402e('0x58')];if(!_0x5a3e45['query']['hasOwnProperty'](_0x402e('0x60'))){_0xcea034[_0x402e('0x31')]=qs[_0x402e('0x31')](_0x5a3e45[_0x402e('0x5a')]['limit']);_0xcea034[_0x402e('0x32')]=qs[_0x402e('0x32')](_0x5a3e45[_0x402e('0x5a')][_0x402e('0x32')]);}_0xcea034[_0x402e('0x61')]=qs[_0x402e('0x62')](_0x5a3e45[_0x402e('0x5a')][_0x402e('0x62')]);_0xcea034[_0x402e('0x63')]=qs[_0x402e('0x5b')](_[_0x402e('0x64')](_0x5a3e45[_0x402e('0x5a')],_0x3c81d1[_0x402e('0x5b')]));_0xcea034[_0x402e('0x63')][_0x402e('0xc5')]=_0x20783f['id'];if(_0x5a3e45[_0x402e('0x5a')][_0x402e('0x9d')]){_0xcea034[_0x402e('0x63')]=_[_0x402e('0x3e')](_0xcea034[_0x402e('0x63')],{'$or':_[_0x402e('0x44')](_0xcea034['attributes'],function(_0x20eb9b){var _0x1faded={};_0x1faded[_0x20eb9b]={'$like':'%'+_0x5a3e45[_0x402e('0x5a')][_0x402e('0x9d')]+'%'};return _0x1faded;})});}_0xcea034[_0x402e('0x63')][_0x402e('0x106')]=![];if(_0x5a3e45[_0x402e('0x5a')]['id']){_0xcea034[_0x402e('0x63')]['id']={'$gt':_0x5a3e45[_0x402e('0x5a')]['id']};}_0xcea034=_['merge']({},_0xcea034,_0x5a3e45[_0x402e('0x11b')]);return db[_0x402e('0xde')][_0x402e('0x33')]({'where':_0xcea034[_0x402e('0x63')]})[_0x402e('0x22')](function(_0x3772d9){_0x1bd289['count']=_0x3772d9;_0xcea034[_0x402e('0xca')]=[];if(_0x5a3e45[_0x402e('0x5a')][_0x402e('0x11e')]){_0xcea034[_0x402e('0xca')][_0x402e('0x49')]({'model':db[_0x402e('0x102')],'as':_0x402e('0x102'),'attributes':['id',_0x402e('0x45'),_0x402e('0x103')]});}if(_0x5a3e45[_0x402e('0x5a')][_0x402e('0xc9')]){_0xcea034[_0x402e('0xca')]=[{'all':!![]}];}return db[_0x402e('0xde')][_0x402e('0x11c')](_0xcea034);})['then'](function(_0x336aa9){_0x1bd289[_0x402e('0xc7')]=_0x336aa9;return _0x1bd289;});}})[_0x402e('0x22')](respondWithFilteredResult(_0x7804a3,_0xcea034))[_0x402e('0x2c')](handleError(_0x7804a3,null));};exports['addTags']=function(_0x451eb3,_0x4bcf97,_0x49b178){return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0x451eb3['params']['id']}})[_0x402e('0x22')](handleEntityNotFound(_0x4bcf97,null))['then'](function(_0x24dc76){if(_0x24dc76){return _0x24dc76[_0x402e('0x11f')](_0x451eb3[_0x402e('0x3f')]['ids'],_['omit'](_0x451eb3['body'],[_0x402e('0x118'),'id'])||{})[_0x402e('0x120')](function(){return db[_0x402e('0x121')][_0x402e('0x11c')]({'attributes':['id','name',_0x402e('0x66')],'where':{'id':_0x451eb3['body']['ids']}});})[_0x402e('0x22')](function(_0x12071e){socket['emit'](_0x402e('0x122'),{'id':Number(_0x451eb3[_0x402e('0xcc')]['id']),'tags':_0x12071e||[]});return{'id':Number(_0x451eb3[_0x402e('0xcc')]['id']),'tags':_0x12071e||[]};});}})[_0x402e('0x22')](respondWithResult(_0x4bcf97,null))[_0x402e('0x2c')](handleError(_0x4bcf97,null));};exports['removeTags']=function(_0x107c25,_0xc29e05,_0x3a2afe){return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0x107c25[_0x402e('0xcc')]['id']}})['then'](handleEntityNotFound(_0xc29e05,null))['then'](function(_0x42c744){if(_0x42c744){return _0x42c744[_0x402e('0x123')](_0x107c25[_0x402e('0x5a')][_0x402e('0x118')]);}})[_0x402e('0x22')](respondWithStatusCode(_0xc29e05,null))[_0x402e('0x2c')](handleError(_0xc29e05,null));};exports['download']=function(_0xce561a,_0x2a4ea9){var _0x5358a4=moment()['unix']()['toString']();var _0xf3f67=path[_0x402e('0xef')](config[_0x402e('0x124')],'server',_0x402e('0x125'),_0x402e('0x126'));var _0x2a1e95=path[_0x402e('0xef')](config[_0x402e('0x124')],'server',_0x402e('0x125'),'attachments');var _0x4c1e65=path[_0x402e('0xef')](_0xf3f67,_0x5358a4);var _0x32045c=util[_0x402e('0xf6')](_0x402e('0x127'),_0xce561a[_0x402e('0xcc')]['id'],_0x5358a4);var _0x1b4aa3=path[_0x402e('0xef')](_0xf3f67,_0x32045c);var _0x2f0801=[];_0x2f0801[_0x402e('0x49')]({'model':db[_0x402e('0x102')],'as':_0x402e('0x102'),'attributes':['id','fullname'],'raw':!![]});_0x2f0801['push']({'model':db[_0x402e('0xe1')],'as':_0x402e('0x7f'),'attributes':['id',_0x402e('0x128'),_0x402e('0x129')],'raw':!![]});if(_0xce561a[_0x402e('0x5a')][_0x402e('0x12a')]){_0x2f0801[_0x402e('0x49')]({'model':db['Attachment'],'as':_0x402e('0xeb'),'raw':!![]});}var _0xe8dc86=[{'model':db[_0x402e('0xde')],'as':_0x402e('0xfa'),'attributes':['id',_0x402e('0x3f'),_0x402e('0x8f'),_0x402e('0x12b'),_0x402e('0x106'),_0x402e('0x97')],'include':_0x2f0801}];_0xe8dc86['push']({'model':db[_0x402e('0xf9')],'as':_0x402e('0x12c'),'attributes':['id',_0x402e('0x3b')]});_0xe8dc86[_0x402e('0x49')]({'model':db[_0x402e('0x102')],'as':_0x402e('0x12d'),'attributes':['id',_0x402e('0x45')]});return db[_0x402e('0x54')][_0x402e('0x7b')]({'where':{'id':_0xce561a[_0x402e('0xcc')]['id']},'include':_0xe8dc86})[_0x402e('0x22')](handleEntityNotFound(_0x2a4ea9,null))[_0x402e('0x22')](function(_0x218d88){if(_0x218d88){var _0x35e630=_0x218d88['get']({'plain':!![]});fs['mkdirSync'](_0x4c1e65);var _0x44c0ed={'channel':_0x402e('0x12e'),'account':_0x35e630['Account'][_0x402e('0x3b')],'agent':_0x35e630['Owner']?_0x35e630[_0x402e('0x12d')][_0x402e('0x45')]:'N.A.','createdAt':moment(_0x35e630[_0x402e('0x8f')])['format'](_0x402e('0x12f'))['toString'](),'closedAt':_0x35e630[_0x402e('0x4f')]?moment(_0x35e630[_0x402e('0x130')])['format'](_0x402e('0x12f'))[_0x402e('0xb1')]():'','disposition':_0x35e630[_0x402e('0x51')],'chatInfo':{'browser':_0x35e630['browserName'],'os':_0x35e630['osName'],'referer':_0x35e630['referer'],'customerIp':_0x35e630[_0x402e('0x131')],'customerPort':_0x35e630[_0x402e('0x132')]?_0x35e630[_0x402e('0x132')]:_0x402e('0x133')},'messages':_(_0x35e630[_0x402e('0xfa')])['tail']()['filter']({'secret':![]})[_0x402e('0x44')](function(_0x3a7859){if(_0x3a7859[_0x402e('0xeb')]){var _0x2c06a8=path['join'](_0x2a1e95,_0x3a7859[_0x402e('0xeb')][_0x402e('0xe9')]);if(fs[_0x402e('0x134')](_0x2c06a8)){fs[_0x402e('0x135')](_0x2c06a8)[_0x402e('0x136')](fs[_0x402e('0x137')](path[_0x402e('0xef')](_0x4c1e65,_0x3a7859[_0x402e('0xeb')]['basename'])));}}return{'date':moment(_0x3a7859[_0x402e('0x8f')])[_0x402e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x402e('0xb1')](),'sender':_0x3a7859[_0x402e('0x12b')]===_0x402e('0xdd')?_0x3a7859[_0x402e('0x102')]?_0x3a7859[_0x402e('0x102')][_0x402e('0x45')]:_0x402e('0xfd'):_0x3a7859[_0x402e('0x7f')][_0x402e('0x128')]+(_0x3a7859[_0x402e('0x7f')][_0x402e('0x129')]?'\x20'+_0x3a7859[_0x402e('0x7f')][_0x402e('0x129')]:''),'body':_0x3a7859[_0x402e('0xeb')]?_0x3a7859[_0x402e('0xeb')]['basename']:_0x3a7859[_0x402e('0x3f')],'direction':_0x3a7859[_0x402e('0x12b')]==='out'?'A':'C','secret':_0x3a7859[_0x402e('0x106')],'read':_0x3a7859['read'],'attachment':_0x3a7859[_0x402e('0xeb')]};})[_0x402e('0x7d')]()};return ejs['renderFile'](path[_0x402e('0xef')](config[_0x402e('0x124')],_0x402e('0x138'),_0x402e('0x139'),_0x402e('0x13a')),{'interaction':_0x44c0ed})[_0x402e('0x22')](function(_0x350800){var _0x367673=path[_0x402e('0xef')](_0x4c1e65,_0x402e('0x13b')+_0x35e630['id']+'-'+_0x5358a4+'.pdf');var _0x12e800={'path':_0x367673,'channel':_0x402e('0x12e'),'interactionId':_0x35e630['id']};return pdf[_0x402e('0x13c')](_0x350800,_0x12e800);})[_0x402e('0x22')](function(){return new BPromise(function(_0xc64cdd,_0x58495c){zipdir(_0x4c1e65,{'saveTo':_0x1b4aa3},function(_0x4e06aa,_0x2a2759){if(_0x4e06aa)return _0x58495c(_0x4e06aa);return _0xc64cdd(_0x2a2759);});})[_0x402e('0x22')](function(){return new BPromise(function(_0x5e42b2,_0x38e4e1){rimraf(_0x4c1e65,function(_0x8082bc){if(_0x8082bc)_0x38e4e1(_0x8082bc);return _0x5e42b2();});});})['then'](function(){return _0x2a4ea9[_0x402e('0xf2')](_0x1b4aa3,_0x32045c,function(_0x2f1acc){if(_0x2f1acc){console[_0x402e('0x13d')](_0x402e('0x13e'),_0x2f1acc);}else{fs[_0x402e('0x13f')](_0x1b4aa3);}});});});}else{return _0x2a4ea9[_0x402e('0x2d')](0xc8);}})[_0x402e('0x2c')](handleError(_0x2a4ea9,null));}; \ No newline at end of file +var _0xced1=['name','render','merge','body','contact','agent','interaction','Users','map','fullname','split','forEach','push','TagIds','catch','talking','answered','unmanaged','abandoned','total','closed','UserId','waiting','disposition','index','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','field','tools_tags','u.id','u.fullname','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','isEmpty','ChatWebsiteId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','keyBy','ChatInteraction','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','rawAttributes','include','options','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooNote','vidaooMetadata','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','includeAll','findAll','rows','hasOwnProperty','secret','includeAgent','alias','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','Chat','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','osName','referer','customerIp','customerPort','tail','pipe','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy'];(function(_0x75f17b,_0x5068a2){var _0x31113d=function(_0x6a0195){while(--_0x6a0195){_0x75f17b['push'](_0x75f17b['shift']());}};_0x31113d(++_0x5068a2);}(_0xced1,0x107));var _0x1ced=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xced1[_0x5ac84c];return _0x3c53d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ced('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1ced('0x1'));var moment=require(_0x1ced('0x2'));var BPromise=require(_0x1ced('0x3'));var Mustache=require(_0x1ced('0x4'));var util=require(_0x1ced('0x5'));var path=require(_0x1ced('0x6'));var sox=require(_0x1ced('0x7'));var csv=require(_0x1ced('0x8'));var ejs=require(_0x1ced('0x9'));var fs=require('fs');var fs_extra=require(_0x1ced('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ced('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1ced('0xc'));var toCsv=require(_0x1ced('0x8'));var querystring=require('querystring');var Papa=require(_0x1ced('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ced('0xe'));var pdf=require(_0x1ced('0xf'));var hardwareService=require(_0x1ced('0x10'));var logger=require(_0x1ced('0x11'))(_0x1ced('0x12'));var utils=require(_0x1ced('0x13'));var config=require(_0x1ced('0x14'));var licenseUtil=require(_0x1ced('0x15'));var db=require('../../mysqldb')['db'];config[_0x1ced('0x16')]=_[_0x1ced('0x17')](config[_0x1ced('0x16')],{'host':_0x1ced('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ced('0x16')]));require(_0x1ced('0x19'))[_0x1ced('0x1a')](socket);var jayson=require(_0x1ced('0x1b'));var client=jayson[_0x1ced('0x1c')][_0x1ced('0x1d')]({'port':0x232b});var client9004=jayson[_0x1ced('0x1c')][_0x1ced('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3f9588,_0x183ff8,_0x4e5b27,_0x14ef4b){return new BPromise(function(_0x4efc64,_0x302451){var _0x1a981d=_0x14ef4b||client;return _0x1a981d[_0x1ced('0x1e')](_0x3f9588,_0x4e5b27)[_0x1ced('0x1f')](function(_0x4f5c6c){logger[_0x1ced('0x20')](_0x1ced('0x21'),_0x183ff8,_0x1ced('0x22'));logger['debug'](_0x1ced('0x23'),_0x183ff8,_0x1ced('0x22'),JSON[_0x1ced('0x24')](_0x4f5c6c));if(_0x4f5c6c[_0x1ced('0x25')]){if(_0x4f5c6c['error']['code']===0x1f4){logger[_0x1ced('0x25')](_0x1ced('0x21'),_0x183ff8,_0x4f5c6c['error']['message']);return _0x302451(_0x4f5c6c[_0x1ced('0x25')][_0x1ced('0x26')]);}logger[_0x1ced('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x183ff8,_0x4f5c6c[_0x1ced('0x25')][_0x1ced('0x26')]);return _0x4efc64(_0x4f5c6c[_0x1ced('0x25')][_0x1ced('0x26')]);}else{logger[_0x1ced('0x20')](_0x1ced('0x21'),_0x183ff8,_0x1ced('0x22'));_0x4efc64(_0x4f5c6c[_0x1ced('0x27')][_0x1ced('0x26')]);}})['catch'](function(_0x805580){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x183ff8,_0x805580);_0x302451(_0x805580);});});}function respondWithStatusCode(_0x5817e4,_0x145f43){_0x145f43=_0x145f43||0xcc;return function(_0x29dc99){if(_0x29dc99){return _0x5817e4['sendStatus'](_0x145f43);}return _0x5817e4[_0x1ced('0x28')](_0x145f43)[_0x1ced('0x29')]();};}function respondWithResult(_0x4ef91f,_0x22d38e){_0x22d38e=_0x22d38e||0xc8;return function(_0x17dd6b){if(_0x17dd6b){return _0x4ef91f[_0x1ced('0x28')](_0x22d38e)[_0x1ced('0x2a')](_0x17dd6b);}};}function respondWithFilteredResult(_0x32f2ca,_0x160842){return function(_0x55133a){if(_0x55133a){var _0x160ed6=typeof _0x160842['offset']===_0x1ced('0x2b')&&typeof _0x160842['limit']===_0x1ced('0x2b');var _0x1bf69c=_0x55133a['count'];var _0x406a99=_0x160ed6?0x0:_0x160842['offset'];var _0x270344=_0x160ed6?_0x55133a[_0x1ced('0x2c')]:_0x160842[_0x1ced('0x2d')]+_0x160842[_0x1ced('0x2e')];var _0x7ca3ea;if(_0x270344>=_0x1bf69c){_0x270344=_0x1bf69c;_0x7ca3ea=0xc8;}else{_0x7ca3ea=0xce;}_0x32f2ca[_0x1ced('0x28')](_0x7ca3ea);return _0x32f2ca[_0x1ced('0x2f')](_0x1ced('0x30'),_0x406a99+'-'+_0x270344+'/'+_0x1bf69c)[_0x1ced('0x2a')](_0x55133a);}return null;};}function patchUpdates(_0x2c62be){return function(_0x3659ab){try{jsonpatch[_0x1ced('0x31')](_0x3659ab,_0x2c62be,!![]);}catch(_0x3d8d87){return BPromise[_0x1ced('0x32')](_0x3d8d87);}return _0x3659ab[_0x1ced('0x33')]();};}function saveUpdates(_0x532271,_0x555ff6){return function(_0x5610cb){if(_0x5610cb){return _0x5610cb['update'](_0x532271)[_0x1ced('0x1f')](function(_0xebd9df){return _0xebd9df;});}return null;};}function removeEntity(_0x3b8243,_0x3b2904){return function(_0x1db99b){if(_0x1db99b){return _0x1db99b[_0x1ced('0x34')]()['then'](function(){_0x3b8243[_0x1ced('0x28')](0xcc)[_0x1ced('0x29')]();});}};}function handleEntityNotFound(_0x11ba96,_0x682dc4){return function(_0x284a45){if(!_0x284a45){_0x11ba96['sendStatus'](0x194);}return _0x284a45;};}function handleError(_0x37606a,_0x184107){_0x184107=_0x184107||0x1f4;return function(_0x7875ae){logger[_0x1ced('0x25')](_0x7875ae['stack']);if(_0x7875ae[_0x1ced('0x35')]){delete _0x7875ae['name'];}_0x37606a[_0x1ced('0x28')](_0x184107)['send'](_0x7875ae);};}function getMustacheRender(_0x1abef8,_0x18717f){return Mustache[_0x1ced('0x36')](_0x1abef8,_[_0x1ced('0x37')](_0x18717f[_0x1ced('0x38')],{'contact':_0x18717f[_0x1ced('0x39')],'message':_0x18717f[_0x1ced('0x26')],'agent':_0x18717f[_0x1ced('0x3a')],'interaction':_0x18717f[_0x1ced('0x3b')],'account':_0x18717f['account']}))||'';}function getInteractionUsers(_0x7522fe,_0x27ebb6){return new BPromise(function(_0x431f7f,_0x2ee8c0){try{if(_0x27ebb6[_0x7522fe['id']]){_0x7522fe[_0x1ced('0x3c')]=_[_0x1ced('0x3d')](_0x27ebb6[_0x7522fe['id']],function(_0x42a20b){return{'id':_0x42a20b['id'],'fullname':_0x42a20b[_0x1ced('0x3e')]};});}}catch(_0x37b172){_0x2ee8c0(_0x37b172);}_0x431f7f(_0x7522fe);});}function getInteractionTags(_0x3e23a9,_0x1df5b9){return new BPromise(function(_0xa24e41,_0x57c9d8){try{if(_0x3e23a9['TagIds']){_0x3e23a9['Tags']=[];_0x3e23a9['TagIds'][_0x1ced('0x3f')](',')[_0x1ced('0x40')](function(_0x570aaa){_0x3e23a9['Tags'][_0x1ced('0x41')](_0x1df5b9[_0x570aaa]);});}delete _0x3e23a9[_0x1ced('0x42')];}catch(_0x45078d){_0x57c9d8(_0x45078d);}_0xa24e41(_0x3e23a9);});}function updateChatInteraction(_0x240314,_0x9c2345,_0x27c2c8){return new BPromise(function(_0x47f0e5,_0x3f7484){return getInteractionUsers(_0x240314,_0x27c2c8)['then'](function(_0x4e70a7){return getInteractionTags(_0x4e70a7,_0x9c2345);})[_0x1ced('0x1f')](function(_0x144079){return getStateInteraction(_0x144079);})[_0x1ced('0x1f')](function(_0x156cea){_0x47f0e5(_0x156cea);})[_0x1ced('0x43')](function(_0x3ce2e9){_0x3f7484(_0x3ce2e9);});});}function getStateInteraction(_0x2d9d1c){return new BPromise(function(_0x31b0b4){_0x2d9d1c['waiting']=0x0;_0x2d9d1c[_0x1ced('0x44')]=0x0;_0x2d9d1c[_0x1ced('0x45')]=0x0;_0x2d9d1c[_0x1ced('0x46')]=0x0;_0x2d9d1c[_0x1ced('0x47')]=0x0;_0x2d9d1c[_0x1ced('0x48')]=0x0;if(!_0x2d9d1c[_0x1ced('0x49')]&&!_0x2d9d1c['UserId']){_0x2d9d1c['waiting']+=0x1;}if(!_0x2d9d1c[_0x1ced('0x49')]&&_0x2d9d1c[_0x1ced('0x4a')]){_0x2d9d1c[_0x1ced('0x44')]+=0x1;if(_0x2d9d1c[_0x1ced('0x4b')]){_0x2d9d1c[_0x1ced('0x4b')]-=0x1;}}if(_0x2d9d1c['closed']&&_0x2d9d1c[_0x1ced('0x4c')]==='abandoned'){_0x2d9d1c[_0x1ced('0x47')]+=0x1;if(_0x2d9d1c[_0x1ced('0x4b')]){_0x2d9d1c[_0x1ced('0x4b')]-=0x1;}}else if(_0x2d9d1c['closed']&&!_0x2d9d1c['UserId']&&_0x2d9d1c[_0x1ced('0x4c')]){_0x2d9d1c['unmanaged']+=0x1;if(_0x2d9d1c[_0x1ced('0x4b')]){_0x2d9d1c[_0x1ced('0x4b')]-=0x1;}}else if(_0x2d9d1c[_0x1ced('0x49')]&&_0x2d9d1c['UserId']){_0x2d9d1c[_0x1ced('0x45')]+=0x1;if(_0x2d9d1c[_0x1ced('0x44')]){_0x2d9d1c[_0x1ced('0x44')]-=0x1;}}_0x2d9d1c[_0x1ced('0x48')]+=0x1;_0x31b0b4(_0x2d9d1c);});}exports[_0x1ced('0x4d')]=function(_0x385e5d,_0x166725){var _0xf13557={},_0x2ac72e={},_0x356c48={'count':0x0,'rows':[]};var _0x369def=_[_0x1ced('0x3d')](db['ChatInteraction']['rawAttributes'],function(_0xc82e09){return{'name':_0xc82e09[_0x1ced('0x4e')],'type':_0xc82e09[_0x1ced('0x4f')][_0x1ced('0x50')]};});_0x2ac72e[_0x1ced('0x51')]=_[_0x1ced('0x3d')](_0x369def,_0x1ced('0x35'));_0x2ac72e[_0x1ced('0x52')]=_[_0x1ced('0x53')](_0x385e5d['query']);_0x2ac72e['filters']=_['intersection'](_0x2ac72e['model'],_0x2ac72e[_0x1ced('0x52')]);_0xf13557[_0x1ced('0x54')]=_[_0x1ced('0x55')](_0x2ac72e[_0x1ced('0x51')],qs[_0x1ced('0x56')](_0x385e5d[_0x1ced('0x52')][_0x1ced('0x56')]));_0xf13557[_0x1ced('0x54')]=_0xf13557[_0x1ced('0x54')][_0x1ced('0x57')]?_0xf13557[_0x1ced('0x54')]:_0x2ac72e['model'];if(!_0x385e5d[_0x1ced('0x52')]['hasOwnProperty'](_0x1ced('0x58'))){_0xf13557[_0x1ced('0x2e')]=qs['limit'](_0x385e5d['query'][_0x1ced('0x2e')]);_0xf13557[_0x1ced('0x2d')]=qs[_0x1ced('0x2d')](_0x385e5d['query'][_0x1ced('0x2d')]);}_0xf13557[_0x1ced('0x59')]=qs[_0x1ced('0x5a')](_0x385e5d[_0x1ced('0x52')][_0x1ced('0x5a')]);_0xf13557[_0x1ced('0x5b')]=qs[_0x1ced('0x5c')](_[_0x1ced('0x5d')](_0x385e5d[_0x1ced('0x52')],_0x2ac72e[_0x1ced('0x5c')]),_0x369def);var _0x5b8ee7=[];var _0x2134e1=squel['select']()[_0x1ced('0x5e')]('id')[_0x1ced('0x5e')](_0x1ced('0x35'))['field']('color')['from'](_0x1ced('0x5f'));var _0x3c48f3=squel['select']()[_0x1ced('0x5e')](_0x1ced('0x60'))[_0x1ced('0x5e')](_0x1ced('0x61'))[_0x1ced('0x5e')]('ui.ChatInteractionId')[_0x1ced('0x62')](_0x1ced('0x63'),'ui')[_0x1ced('0x64')]('users','u',_0x1ced('0x65'));var _0x54a386=squel[_0x1ced('0x66')]()[_0x1ced('0x62')]('chat_interactions','i')[_0x1ced('0x64')]('cm_contacts','c',_0x1ced('0x67'))[_0x1ced('0x64')](_0x1ced('0x68'),'o',_0x1ced('0x69'))[_0x1ced('0x64')]('chat_websites','a',_0x1ced('0x6a'))[_0x1ced('0x64')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x1ced('0x64')](_0x1ced('0x6b'),'it',_0x1ced('0x6c'))['left_join'](_0x1ced('0x5f'),'t',_0x1ced('0x6d'));var _0x9c60e0=squel[_0x1ced('0x6e')]();var _0x7fbeb7=[];var _0x42df29=squel['expr']();var _0x1b015b;if(_0x385e5d[_0x1ced('0x52')][_0x1ced('0x6f')]){_0x1b015b=as['parseSearch'](_0x385e5d[_0x1ced('0x52')][_0x1ced('0x6f')]);var _0x9cc305=_0x1b015b[_0x1ced('0x70')];for(var _0xe649a3=0x0;_0xe649a3<_0x1b015b['conditions'][_0x1ced('0x57')];_0xe649a3++){var _0x438180=_0x1b015b[_0x1ced('0x71')][_0xe649a3];var _0x3a042e='i';var _0x33a040=_[_0x1ced('0x72')](_0x369def,[_0x1ced('0x35'),_0x438180['field']]);if(!_0x33a040){switch(_0x438180[_0x1ced('0x5e')]){case _0x1ced('0x73'):if(_0x438180[_0x1ced('0x74')]==0x1){_0x54a386[_0x1ced('0x75')]('`'+_0x438180['field']+'`\x20=\x200');}else{_0x54a386[_0x1ced('0x75')]('`'+_0x438180['field']+_0x1ced('0x76'));}break;case _0x1ced('0x77'):if(_0x438180[_0x1ced('0x78')]===_0x1ced('0x79')){if(_0x438180[_0x1ced('0x74')][_0x1ced('0x3f')]('\x20')[_0x1ced('0x57')]>0x1){_0x9c60e0[_0x9cc305](_0x1ced('0x7a'),qs[_0x1ced('0x7b')](_0x438180['value']),null);}else{var _0x4b10b6='%'+_0x438180[_0x1ced('0x74')]+'%';_0x9c60e0[_0x9cc305](_0x1ced('0x7c'),_0x4b10b6,_0x4b10b6,_0x4b10b6);}}else{_0x33a040=_['find'](_0x369def,['name',_0x1ced('0x7d')]);_0x438180['field']=_0x1ced('0x7d');_0x14b4e6=as[_0x1ced('0x7e')](_0x3a042e,_0x33a040[_0x1ced('0x4f')],_0x438180);_0x9c60e0[_0x9cc305](_0x14b4e6[_0x1ced('0x7f')],_0x14b4e6[_0x1ced('0x74')][_0x1ced('0x80')],_0x14b4e6[_0x1ced('0x74')]['end']);}break;case'Tag':var _0x3d818f=_0x438180['value'][_0x1ced('0x3f')](',')['map'](function(_0x5a644d){return Number(_0x5a644d);});_0x3d818f[_0x1ced('0x40')](function(_0x50b4aa){_0x42df29['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50b4aa+',%');});_0x7fbeb7=_['union'](_0x7fbeb7,_0x3d818f);break;case _0x1ced('0x81'):if(_0x438180[_0x1ced('0x78')]===_0x1ced('0x79')){_0x9c60e0[_0x9cc305](_0x1ced('0x82'),'%'+_0x438180[_0x1ced('0x74')]+'%',null);}else{_0x33a040=_[_0x1ced('0x72')](_0x369def,[_0x1ced('0x35'),_0x1ced('0x4a')]);_0x438180[_0x1ced('0x5e')]=_0x1ced('0x4a');_0x14b4e6=as['buildExpression'](_0x3a042e,_0x33a040['type'],_0x438180);_0x9c60e0[_0x9cc305](_0x14b4e6[_0x1ced('0x7f')],_0x14b4e6[_0x1ced('0x74')]['start'],_0x14b4e6['value'][_0x1ced('0x29')]);}break;case _0x1ced('0x38'):_0x14b4e6=as[_0x1ced('0x7e')]('me',null,_0x438180);_0x9c60e0[_0x9cc305](_0x14b4e6[_0x1ced('0x7f')],_0x14b4e6[_0x1ced('0x74')][_0x1ced('0x80')],_0x14b4e6[_0x1ced('0x74')][_0x1ced('0x29')]);break;}}else{var _0x14b4e6=as['buildExpression'](_0x3a042e,_0x33a040['type'],_0x438180);_0x9c60e0[_0x9cc305](_0x14b4e6[_0x1ced('0x7f')],_0x14b4e6['value'][_0x1ced('0x80')],_0x14b4e6[_0x1ced('0x74')][_0x1ced('0x29')]);}}}else{var _0x38541f=_(_0x385e5d['query'])[_0x1ced('0x53')]()[_0x1ced('0x3d')](function(_0x1c3311){return _['some'](_0x369def,['name',_0x1c3311])?_0x1c3311:undefined;})['compact']()['value']();if(!_[_0x1ced('0x83')](_0x38541f)){_0x38541f[_0x1ced('0x40')](function(_0x42ca62){if(_0x42ca62===_0x1ced('0x84')){_0x54a386['where']('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x385e5d['query'][_0x42ca62]));}else if(_0x42ca62==='createdAt'){var _0x39be42=JSON[_0x1ced('0x85')](_0x385e5d[_0x1ced('0x52')][_0x42ca62])[_0x1ced('0x86')];var _0xf5be6=JSON[_0x1ced('0x85')](_0x385e5d[_0x1ced('0x52')][_0x42ca62])[_0x1ced('0x87')];_0x54a386['where'](_0x1ced('0x88'),_0x39be42,_0xf5be6);}else{if(_0x385e5d['query'][_0x42ca62]===_0x1ced('0x89')){_0x54a386[_0x1ced('0x5b')]('i.'+_0x42ca62+_0x1ced('0x8a'));}else{_0x54a386[_0x1ced('0x5b')]('i.'+_0x42ca62+_0x1ced('0x8b'),_0x385e5d['query'][_0x42ca62]);}}});}if(_0x385e5d['query'][_0x1ced('0x8c')]){if(_0x385e5d[_0x1ced('0x52')][_0x1ced('0x8c')]==0x1){_0x54a386[_0x1ced('0x75')](_0x1ced('0x8d'));}else{_0x54a386[_0x1ced('0x75')](_0x1ced('0x8e'));}}if(_0x385e5d[_0x1ced('0x52')][_0x1ced('0x8f')]){_0x7fbeb7=_[_0x1ced('0x90')](_0x385e5d[_0x1ced('0x52')][_0x1ced('0x8f')])?_0x385e5d[_0x1ced('0x52')][_0x1ced('0x8f')]:new Array(_0x385e5d['query'][_0x1ced('0x8f')]);_0x7fbeb7['forEach'](function(_0x4ee7e3){_0x42df29['or'](_0x1ced('0x91'),'%,'+_0x4ee7e3+',%');});}if(_0x385e5d[_0x1ced('0x52')][_0x1ced('0x92')]){var _0x3a3456=_0x385e5d[_0x1ced('0x52')]['filter']['replace']('\x5c','\x5c\x5c')[_0x1ced('0x93')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3a3456)){_0x9c60e0['or'](_0x1ced('0x94'),_0x3a3456+'%');}else{_0x9c60e0['or'](_0x1ced('0x95'),qs[_0x1ced('0x7b')](_0x3a3456))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a3456+'%');}}}_0x54a386[_0x1ced('0x5b')](_0x9c60e0);_0x54a386[_0x1ced('0x96')](_0x1ced('0x97'));var _0x52288e={'type':db[_0x1ced('0x98')][_0x1ced('0x99')][_0x1ced('0x9a')],'raw':!![]};var _0x3c4c13=_0x54a386[_0x1ced('0x9b')]();_0x3c4c13['field'](_0x1ced('0x97'));_0x3c4c13[_0x1ced('0x5e')](_0x1ced('0x9c'),_0x1ced('0x73'));if(_0xf13557['order']){_0xf13557['order'][_0x1ced('0x40')](function(_0x10386b){var _0x42f66c=_0x10386b[0x0]===_0x1ced('0x9d')?_0x10386b[0x0]:'i.'+_0x10386b[0x0];_0x54a386[_0x1ced('0x59')](_0x42f66c,_0x10386b[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1ced('0x83')](_0x7fbeb7)){_0x54a386[_0x1ced('0x75')](_0x42df29);_0x3c4c13['where'](_0x1ced('0x9e'),_0x7fbeb7);}BPromise['resolve']()[_0x1ced('0x1f')](function(){if(!_0x1b015b){if(_0x385e5d['query'][_0x1ced('0x84')])return;_0x3c4c13['where'](_0x1ced('0x9f'));_0x54a386['where'](_0x1ced('0x9f'));return;}if(_0x385e5d[_0x1ced('0xa0')][_0x1ced('0xa1')]!==_0x1ced('0x3a'))return;return _0x385e5d['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x25cc4d){if(_[_0x1ced('0x83')](_0x25cc4d)){_0x3c4c13[_0x1ced('0x5b')](_0x1ced('0xa2'));_0x54a386['where'](_0x1ced('0xa2'));}else{_0x3c4c13[_0x1ced('0x5b')](_0x1ced('0xa3'),_[_0x1ced('0x3d')](_0x25cc4d,'id'));_0x54a386[_0x1ced('0x5b')](_0x1ced('0xa3'),_['map'](_0x25cc4d,'id'));}});})[_0x1ced('0x1f')](function(){if(_0x385e5d[_0x1ced('0xa0')][_0x1ced('0xa1')]===_0x1ced('0x3a')&&!_0x1b015b&&!_0x385e5d[_0x1ced('0x52')][_0x1ced('0x84')])return[];return db[_0x1ced('0xa4')][_0x1ced('0x52')](_0x3c4c13['toString'](),_0x52288e);})[_0x1ced('0x1f')](function(_0x5bc033){_0x356c48[_0x1ced('0x2c')]=_0x5bc033[_0x1ced('0x57')];if(_0x356c48[_0x1ced('0x2c')]===0x0)return[];return db['sequelize'][_0x1ced('0x52')](_0x2134e1['toString'](),_0x52288e)['then'](function(_0x5e5c15){_0x5b8ee7=_[_0x1ced('0xa5')](_0x5e5c15,'id');_0x52288e=_[_0x1ced('0x37')](_0x52288e,{'model':db[_0x1ced('0xa6')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x385e5d[_0x1ced('0x52')]['fields']){_0xf13557[_0x1ced('0x54')][_0x1ced('0x40')](function(_0x3ae956){_0x54a386[_0x1ced('0x5e')]('i.'+_0x3ae956);});}else{_0x54a386['field'](_0x1ced('0x9c'),'unreadMessages');_0x54a386[_0x1ced('0x5e')]('a.key',_0x1ced('0xa7'));_0x54a386['field'](_0x1ced('0xa8'),'Account.mandatoryDisposition');_0x54a386[_0x1ced('0x5e')](_0x1ced('0xa9'),_0x1ced('0x9d'));_0x54a386[_0x1ced('0x5e')](_0x1ced('0xaa'));_0x54a386[_0x1ced('0x5e')](_0x1ced('0xab'),_0x1ced('0xac'));_0x54a386[_0x1ced('0x5e')](_0x1ced('0xad'),'Contact.lastName');_0x54a386['field'](_0x1ced('0xae'),_0x1ced('0xaf'));_0x54a386[_0x1ced('0x5e')](_0x1ced('0xb0'),'Contact.phone');_0x54a386['field'](_0x1ced('0xb1'),'Contact.mobile');_0x54a386[_0x1ced('0x5e')](_0x1ced('0xb2'),'Contact.fax');_0x54a386[_0x1ced('0x5e')](_0x1ced('0xb3'),_0x1ced('0xb4'));_0x54a386[_0x1ced('0x5e')](_0x1ced('0xb5'),_0x1ced('0xb6'));_0x54a386[_0x1ced('0x5e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1ced('0x42'));}if(_0xf13557[_0x1ced('0x2e')])_0x54a386[_0x1ced('0x2e')](_0xf13557[_0x1ced('0x2e')]);if(_0xf13557[_0x1ced('0x2d')])_0x54a386['offset'](_0xf13557[_0x1ced('0x2d')]);return db['sequelize'][_0x1ced('0x52')](_0x54a386[_0x1ced('0xb7')](),_0x52288e);})[_0x1ced('0x1f')](function(_0x565b7d){if(_0x565b7d[_0x1ced('0x57')]>0x0)_0x3c48f3[_0x1ced('0x5b')](_0x1ced('0xb8'),_[_0x1ced('0x3d')](_0x565b7d,'id'));return db[_0x1ced('0xa4')]['query'](_0x3c48f3[_0x1ced('0xb7')](),_0x52288e)['then'](function(_0x31e8e9){var _0x1f157d=_[_0x1ced('0xb9')](_0x31e8e9,_0x1ced('0xba'));var _0xb5339=[];_0x565b7d[_0x1ced('0x40')](function(_0x2b5baa){_0xb5339[_0x1ced('0x41')](updateChatInteraction(_0x2b5baa,_0x5b8ee7,_0x1f157d));});return BPromise[_0x1ced('0xbb')](_0xb5339);});});})[_0x1ced('0x1f')](function(_0x54f2c6){_0x356c48['rows']=_0x54f2c6;return _0x356c48;})['then'](respondWithFilteredResult(_0x166725,_0xf13557))[_0x1ced('0x43')](handleError(_0x166725,null));};exports[_0x1ced('0xbc')]=function(_0x48feb7,_0x2d0c96){var _0x5dec79={'raw':![],'where':{'id':_0x48feb7['params']['id']}},_0x4c2cf9={};_0x4c2cf9['model']=_[_0x1ced('0x53')](db[_0x1ced('0xa6')][_0x1ced('0xbd')]);_0x4c2cf9[_0x1ced('0x52')]=_['keys'](_0x48feb7['query']);_0x4c2cf9[_0x1ced('0x5c')]=_[_0x1ced('0x55')](_0x4c2cf9[_0x1ced('0x51')],_0x4c2cf9[_0x1ced('0x52')]);_0x5dec79[_0x1ced('0x54')]=_[_0x1ced('0x55')](_0x4c2cf9['model'],qs['fields'](_0x48feb7[_0x1ced('0x52')][_0x1ced('0x56')]));_0x5dec79['attributes']=_0x5dec79['attributes'][_0x1ced('0x57')]?_0x5dec79['attributes']:_0x4c2cf9['model'];if(_0x48feb7[_0x1ced('0x52')]['includeAll']){_0x5dec79[_0x1ced('0xbe')]=[{'all':!![]}];}_0x5dec79=_[_0x1ced('0x37')]({},_0x5dec79,_0x48feb7[_0x1ced('0xbf')]);return db[_0x1ced('0xa6')][_0x1ced('0x72')](_0x5dec79)['then'](handleEntityNotFound(_0x2d0c96,null))[_0x1ced('0x1f')](respondWithResult(_0x2d0c96,null))[_0x1ced('0x43')](handleError(_0x2d0c96,null));};exports[_0x1ced('0xc0')]=function(_0x2b3837,_0x525d9b){return db[_0x1ced('0xa6')][_0x1ced('0xc0')](_0x2b3837['body'],{})[_0x1ced('0x1f')](respondWithResult(_0x525d9b,0xc9))[_0x1ced('0x43')](handleError(_0x525d9b,null));};exports[_0x1ced('0xc1')]=function(_0x25d90c,_0x498ae1){if(_0x25d90c[_0x1ced('0x38')]['id']){delete _0x25d90c['body']['id'];}return db['ChatInteraction'][_0x1ced('0x72')]({'where':{'id':_0x25d90c[_0x1ced('0xc2')]['id']}})[_0x1ced('0x1f')](handleEntityNotFound(_0x498ae1,null))[_0x1ced('0x1f')](saveUpdates(_0x25d90c[_0x1ced('0x38')],null))['then'](respondWithResult(_0x498ae1,null))['catch'](handleError(_0x498ae1,null));};exports[_0x1ced('0x34')]=function(_0x99982f,_0x153965){return db[_0x1ced('0xa6')][_0x1ced('0x72')]({'where':{'id':_0x99982f[_0x1ced('0xc2')]['id']}})[_0x1ced('0x1f')](handleEntityNotFound(_0x153965,null))['then'](removeEntity(_0x153965,null))[_0x1ced('0x43')](handleError(_0x153965,null));};exports[_0x1ced('0xc3')]=function(_0x139006,_0x32467a){return db[_0x1ced('0xa6')]['describe']()[_0x1ced('0x1f')](respondWithResult(_0x32467a,null))[_0x1ced('0x43')](handleError(_0x32467a,null));};exports[_0x1ced('0xc4')]=function(_0x5cda7a,_0x52fffe){var _0xc0176a=_0x5cda7a[_0x1ced('0xc2')]['id'];var _0x5d4432;var _0x241924;var _0x55571a;return db[_0x1ced('0xa6')][_0x1ced('0xc5')]({'where':{'id':_0xc0176a}})['then'](function(_0x13b65e){_0x5d4432=_0x13b65e;return db[_0x1ced('0xc6')]['findOne']({'where':{'id':_0x13b65e[_0x1ced('0x84')]},'attributes':['id',_0x1ced('0xc7'),'vidaooEscalation','vidaooTopic',_0x1ced('0xc8'),_0x1ced('0xc9')],'raw':!![]});})[_0x1ced('0x1f')](function(_0x38d6dc){if(_0x38d6dc&&_0x38d6dc[_0x1ced('0xc7')]&&_0x38d6dc['vidaooEscalation']){_0x241924=_0x38d6dc;var _0x44e7ae={'interaction':{'id':_0xc0176a},'agent':{'id':_0x5cda7a[_0x1ced('0xa0')]['id'],'name':_0x5cda7a[_0x1ced('0xa0')][_0x1ced('0x35')],'fullname':_0x5cda7a[_0x1ced('0xa0')][_0x1ced('0x3e')],'email':_0x5cda7a[_0x1ced('0xa0')]['email']},'contact':_0x5cda7a[_0x1ced('0x38')][_0x1ced('0x39')],'account':_0x5cda7a[_0x1ced('0x38')][_0x1ced('0xca')]};var _0x1ca5c9={'rejectUnauthorized':![],'method':_0x1ced('0xcb'),'url':_0x1ced('0xcc'),'headers':{'X-APIKEY':_0x38d6dc[_0x1ced('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5cda7a[_0x1ced('0xa0')][_0x1ced('0xcd')]],'buttons':null,'topic':_0x241924['vidaooTopic'],'note':_[_0x1ced('0xce')](_0x241924[_0x1ced('0xc8')])?null:getMustacheRender(_0x241924['vidaooNote'],_0x44e7ae),'metadata':null},'redirect':_0x1ced('0xcf'),'json':!![]};try{if(!_[_0x1ced('0xce')](_0x241924[_0x1ced('0xc9')])){var _0x10c194=getMustacheRender(_0x241924[_0x1ced('0xc9')],_0x44e7ae);var _0x1fea23=JSON['parse'](_0x10c194);_0x1ca5c9[_0x1ced('0x38')][_0x1ced('0xd0')]=_0x1fea23;}}catch(_0x4a7d21){throw new db['Sequelize'][(_0x1ced('0xd1'))](_0x1ced('0xd2'));}return rp(_0x1ca5c9);}else{throw new db[(_0x1ced('0x98'))][(_0x1ced('0xd1'))](_0x1ced('0xd3'));}})[_0x1ced('0x1f')](function(_0xa1a6dd){_0x55571a=_0xa1a6dd;if(_0x55571a['id']){var _0x45b804={'body':_0x55571a[_0x1ced('0xd4')],'ChatWebsiteId':_0x241924['id'],'ChatInteractionId':_0x5d4432['id'],'direction':_0x1ced('0xd5'),'UserId':_0x5cda7a[_0x1ced('0xa0')]['id']};return db[_0x1ced('0xd6')][_0x1ced('0xc0')](_0x45b804,{});}else{throw new db[(_0x1ced('0x98'))][(_0x1ced('0xd1'))](_0x1ced('0xd7'));}})['then'](function(){return _0x5d4432[_0x1ced('0xd8')]({'vidaooSessionId':_0x55571a['id']});})[_0x1ced('0x1f')](respondWithResult(_0x52fffe,null))[_0x1ced('0x43')](handleError(_0x52fffe,null));};exports['customUpdate']=function(_0x32add2,_0x121b8d){if(_0x32add2[_0x1ced('0x38')]['id']){delete _0x32add2[_0x1ced('0x38')]['id'];}return db[_0x1ced('0xa6')]['find']({'where':{'id':_0x32add2[_0x1ced('0xc2')]['id']},'include':[{'model':db[_0x1ced('0xd9')],'as':_0x1ced('0x77')}]})[_0x1ced('0x1f')](handleEntityNotFound(_0x121b8d,null))[_0x1ced('0x1f')](saveUpdates(_0x32add2[_0x1ced('0x38')],null))['then'](respondWithResult(_0x121b8d,null))['catch'](handleError(_0x121b8d,null));};exports['abandon']=function(_0x317e05,_0x48c65f,_0xd75c21){if(_0x317e05[_0x1ced('0x38')]['id']){delete _0x317e05[_0x1ced('0x38')]['id'];}return db['ChatInteraction'][_0x1ced('0x72')]({'where':{'id':_0x317e05[_0x1ced('0xc2')]['id']}})[_0x1ced('0x1f')](function(_0x51a3ec){if(!_0x51a3ec){logger['error'](_0x1ced('0xda'),_0x1ced('0xdb'),0x194,'entity\x20not\x20found');_0x48c65f['sendStatus'](0x194);}else{if(_0x51a3ec[_0x1ced('0x4a')]){throw new db[(_0x1ced('0x98'))][(_0x1ced('0xd1'))]('Interaction\x20already\x20assigned');}}return _0x51a3ec;})['then'](function(_0x2dd4d1){if(_0x2dd4d1){return _0x2dd4d1['update']({'closed':_0x317e05[_0x1ced('0x38')][_0x1ced('0x49')],'disposition':_0x317e05['body'][_0x1ced('0x4c')]})[_0x1ced('0x1f')](function(_0x440bc6){return _0x440bc6;});}})['then'](function(_0x177f35){return respondWithRpcPromise(_0x1ced('0xdc'),'abandon',_0x317e05[_0x1ced('0x38')],client9004);})['then'](respondWithResult(_0x48c65f,null))['catch'](handleError(_0x48c65f,null));};exports[_0x1ced('0xdd')]=function(_0x1ff290,_0x18f0f7,_0x46c7d5){_0x1ff290['body'][_0x1ced('0x35')]=_0x1ff290[_0x1ced('0xde')]['originalname'];_0x1ff290[_0x1ced('0x38')]['basename']=_0x1ff290[_0x1ced('0xde')][_0x1ced('0xdf')];_0x1ff290[_0x1ced('0x38')][_0x1ced('0x4f')]=_0x1ff290[_0x1ced('0xde')][_0x1ced('0xe0')];return db[_0x1ced('0xe1')]['create'](_0x1ff290[_0x1ced('0x38')])[_0x1ced('0x1f')](respondWithResult(_0x18f0f7,0xc9))['catch'](handleError(_0x18f0f7,null));};exports[_0x1ced('0xe2')]=function(_0x416566,_0x129923,_0x2ba5ab){return db[_0x1ced('0xa6')][_0x1ced('0xc5')]({'where':{'id':_0x416566[_0x1ced('0xc2')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x129923,null))[_0x1ced('0x1f')](function(_0x4c8a66){if(_0x4c8a66){if(_0x4c8a66[_0x1ced('0x49')]){return _0x129923[_0x1ced('0x28')](0x193)['json']({'status':0x193,'message':_0x1ced('0xe3')});}return db['Attachment']['findOne']({'where':{'id':_0x416566['query'][_0x1ced('0xe4')]},'raw':!![]})[_0x1ced('0x1f')](handleEntityNotFound(_0x129923,null));}})[_0x1ced('0x1f')](function(_0x56b8e9){if(_0x56b8e9){var _0x17c9bf=_0x56b8e9[_0x1ced('0xe5')]!==null;var _0x105228=path[_0x1ced('0xe6')](config[_0x1ced('0xe7')],'server/files/attachments/');if(_0x17c9bf){_0x105228=path[_0x1ced('0xe6')](_0x105228,_0x1ced('0xe8'));}var _0x44c626=path['join'](_0x105228,_0x56b8e9[_0x1ced('0xe9')]);return _0x129923[_0x1ced('0xea')](_0x44c626);}})[_0x1ced('0x43')](handleError(_0x129923,null));};exports[_0x1ced('0xeb')]=function(_0x7fee2a,_0x5c4e90){var _0x5bea2a=null;var _0x458abe=null;var _0x408da5=null;var _0x223b46=null;if(_0x7fee2a[_0x1ced('0x38')]['id']){delete _0x7fee2a[_0x1ced('0x38')]['id'];}if(_0x7fee2a[_0x1ced('0x38')][_0x1ced('0xec')]){_0x223b46=path[_0x1ced('0xe6')](config['root'],_0x1ced('0xed'),util[_0x1ced('0xee')](_0x1ced('0xef'),Date['now']()));_0x7fee2a[_0x1ced('0x38')][_0x1ced('0xf0')]=_0x223b46;}return db[_0x1ced('0xa6')][_0x1ced('0x72')]({'where':{'id':_0x7fee2a[_0x1ced('0xc2')]['id']},'include':[{'model':db[_0x1ced('0xd6')],'as':_0x1ced('0xf1'),'include':[{'model':db[_0x1ced('0x81')],'as':_0x1ced('0x81')}]}]})[_0x1ced('0x1f')](handleEntityNotFound(_0x5c4e90,null))[_0x1ced('0x1f')](saveUpdates(_0x7fee2a[_0x1ced('0x38')],null))['then'](function(_0x27918e){if(_0x27918e){_0x5bea2a=_0x27918e;return db[_0x1ced('0xc6')]['find']({'where':{'id':_0x5bea2a[_0x1ced('0x84')]}});}})[_0x1ced('0x1f')](function(_0xdad299){if(_0xdad299){_0x408da5=_0xdad299;return db[_0x1ced('0xd9')][_0x1ced('0x72')]({'where':{'id':_0x5bea2a['ContactId']}});}})[_0x1ced('0x1f')](function(_0x3f0884){if(_0x3f0884){_0x458abe=_0x3f0884;if(_0x223b46){var _0xd85895=null;for(var _0x58954f=0x1;_0x58954f<_0x5bea2a[_0x1ced('0xf1')][_0x1ced('0x57')];++_0x58954f){_0xd85895=_0x5bea2a['Messages'][_0x58954f];var _0xb05aaf=_0xd85895[_0x1ced('0x4a')]?util[_0x1ced('0xee')](_0x1ced('0xf2'),_0x408da5[_0x1ced('0xf3')],_0xd85895['UserId']):_0x1ced('0xf4');var _0x33554d=_0x7fee2a[_0x1ced('0x38')][_0x1ced('0xf5')]||util[_0x1ced('0xee')](_0x1ced('0xf2'),_0x1ced('0xf6'),_0xd85895[_0x1ced('0x7d')]);switch(_0x408da5[_0x1ced('0xf7')]){case _0x1ced('0xf8'):_0xb05aaf=_0xd85895[_0x1ced('0x4a')]?util[_0x1ced('0xee')](_0x1ced('0xf2'),_0x408da5[_0x1ced('0xf3')],_0xd85895[_0x1ced('0x4a')]):_0x1ced('0xf4');break;case _0x1ced('0xf9'):_0xb05aaf=_0xd85895[_0x1ced('0x4a')]?_0xd85895[_0x1ced('0x81')]['alias']||_0xd85895[_0x1ced('0x81')][_0x1ced('0x3e')]:_0x1ced('0xf4');break;case _0x1ced('0xfa'):_0xb05aaf=_0xd85895[_0x1ced('0x4a')]?_0xd85895[_0x1ced('0x81')][_0x1ced('0x3e')]:_0x1ced('0xf4');break;default:_0xb05aaf=_0xd85895[_0x1ced('0x4a')]?util[_0x1ced('0xee')](_0x1ced('0xf2'),_0x408da5[_0x1ced('0xf3')],_0xd85895['UserId']):_0x1ced('0xf4');}var _0x5b58ef=util['format'](_0x1ced('0xfb'),moment(_0xd85895[_0x1ced('0xfc')])[_0x1ced('0xee')](_0x1ced('0xfd')),_0xd85895[_0x1ced('0xfe')]==='in'?_0x33554d:_0xb05aaf,_0xd85895[_0x1ced('0x38')]);if(!_0xd85895['secret']){fs[_0x1ced('0xff')](_0x223b46,_0x5b58ef);}}return db[_0x1ced('0x100')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1ced('0x101')],'as':_0x1ced('0x102'),'raw':!![]}]});}}})[_0x1ced('0x1f')](function(_0x45fe37){if(_0x45fe37&&_0x45fe37[_0x1ced('0x102')]&&_0x7fee2a[_0x1ced('0x38')]){var _0x8976f0={'tls':{'rejectUnauthorized':![]}};if(_0x45fe37[_0x1ced('0x102')]['service']){_0x8976f0[_0x1ced('0x103')]=_0x45fe37[_0x1ced('0x102')][_0x1ced('0x103')];}else{_0x8976f0[_0x1ced('0x104')]=_0x45fe37[_0x1ced('0x102')][_0x1ced('0x104')];_0x8976f0[_0x1ced('0x105')]=_0x45fe37[_0x1ced('0x102')][_0x1ced('0x105')];_0x8976f0[_0x1ced('0x106')]=_0x45fe37[_0x1ced('0x102')]['secure'];}if(_0x45fe37['Smtp'][_0x1ced('0x107')]){_0x8976f0[_0x1ced('0x108')]={'user':_0x45fe37[_0x1ced('0x102')][_0x1ced('0xa0')],'pass':_0x45fe37[_0x1ced('0x102')][_0x1ced('0x109')]};}return respondWithRpcPromise(_0x1ced('0x10a'),_0x1ced('0x10b'),{'account':_0x8976f0,'message':{'from':util[_0x1ced('0xee')]('\x22%s\x22\x20<%s>',_0x45fe37[_0x1ced('0x35')],_0x45fe37['email']||_0x45fe37[_0x1ced('0x102')][_0x1ced('0xa0')]),'to':_0x7fee2a[_0x1ced('0x38')][_0x1ced('0xec')],'subject':_0x1ced('0x10c'),'text':util[_0x1ced('0xee')](_0x1ced('0x10d'),_0x7fee2a[_0x1ced('0x38')][_0x1ced('0xec')]),'attachments':[{'path':_0x223b46}]}})[_0x1ced('0x1f')](function(){return _0x5bea2a;})['catch'](function(_0x145cb5){console[_0x1ced('0x25')](_0x145cb5);});}else{return _0x5bea2a;}})['then'](respondWithStatusCode(_0x5c4e90,0xc8))['catch'](handleError(_0x5c4e90,null));};exports[_0x1ced('0x10e')]=function(_0x40f443,_0x3984e9,_0x49907f){return db[_0x1ced('0xd6')][_0x1ced('0x72')]({'where':{'id':_0x40f443[_0x1ced('0xc2')]['id']}})[_0x1ced('0x1f')](handleEntityNotFound(_0x3984e9,null))[_0x1ced('0x1f')](function(_0x417432){if(_0x417432){return _0x417432[_0x1ced('0x10e')](_0x40f443[_0x1ced('0x38')][_0x1ced('0x10f')],_[_0x1ced('0x110')](_0x40f443['body'],[_0x1ced('0x10f'),'id'])||{});}})[_0x1ced('0x1f')](respondWithResult(_0x3984e9,null))[_0x1ced('0x43')](handleError(_0x3984e9,null));};exports[_0x1ced('0x111')]=function(_0x2eb576,_0x45ece7,_0x584012){var _0x202a11={'raw':![],'where':{}};var _0x59a265={};var _0x4369d4={'count':0x0,'rows':[]};return db[_0x1ced('0xa6')][_0x1ced('0xc5')]({'where':{'id':_0x2eb576['params']['id']}})['then'](handleEntityNotFound(_0x45ece7,null))[_0x1ced('0x1f')](function(_0x3a7685){if(_0x3a7685){_0x59a265['model']=_[_0x1ced('0x53')](db[_0x1ced('0xd6')][_0x1ced('0xbd')]);_0x59a265[_0x1ced('0x52')]=_[_0x1ced('0x53')](_0x2eb576['query']);_0x59a265[_0x1ced('0x5c')]=_['intersection'](_0x59a265[_0x1ced('0x51')],_0x59a265['query']);_0x202a11[_0x1ced('0x54')]=_[_0x1ced('0x55')](_0x59a265['model'],qs[_0x1ced('0x56')](_0x2eb576[_0x1ced('0x52')][_0x1ced('0x56')]));_0x202a11[_0x1ced('0x54')]=_0x202a11[_0x1ced('0x54')][_0x1ced('0x57')]?_0x202a11[_0x1ced('0x54')]:_0x59a265[_0x1ced('0x51')];if(!_0x2eb576[_0x1ced('0x52')]['hasOwnProperty']('nolimit')){_0x202a11[_0x1ced('0x2e')]=qs[_0x1ced('0x2e')](_0x2eb576[_0x1ced('0x52')][_0x1ced('0x2e')]);_0x202a11['offset']=qs['offset'](_0x2eb576[_0x1ced('0x52')][_0x1ced('0x2d')]);}_0x202a11[_0x1ced('0x59')]=qs[_0x1ced('0x5a')](_0x2eb576['query'][_0x1ced('0x5a')]);_0x202a11[_0x1ced('0x5b')]=qs[_0x1ced('0x5c')](_[_0x1ced('0x5d')](_0x2eb576[_0x1ced('0x52')],_0x59a265[_0x1ced('0x5c')]));_0x202a11['where']['ChatInteractionId']=_0x3a7685['id'];if(_0x2eb576[_0x1ced('0x52')]['filter']){_0x202a11['where']=_[_0x1ced('0x37')](_0x202a11['where'],{'$or':_[_0x1ced('0x3d')](_0x202a11['attributes'],function(_0x49323){var _0x562b8c={};_0x562b8c[_0x49323]={'$like':'%'+_0x2eb576[_0x1ced('0x52')][_0x1ced('0x92')]+'%'};return _0x562b8c;})});}if(_0x2eb576[_0x1ced('0x52')][_0x1ced('0x86')]){var _0x5c727a=_0x2eb576[_0x1ced('0x52')]['$gte'][_0x1ced('0x3f')](',');var _0x2e560c={};_0x2e560c[_0x5c727a[0x0]]={'$gte':moment(_0x5c727a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x202a11['where']=_[_0x1ced('0x37')](_0x202a11[_0x1ced('0x5b')],_0x2e560c);}_0x202a11=_['merge']({},_0x202a11,_0x2eb576[_0x1ced('0xbf')]);return db[_0x1ced('0xd6')][_0x1ced('0x2c')]({'where':_0x202a11[_0x1ced('0x5b')]})[_0x1ced('0x1f')](function(_0xc631f4){_0x4369d4[_0x1ced('0x2c')]=_0xc631f4;if(_0x2eb576[_0x1ced('0x52')][_0x1ced('0x112')]){_0x202a11[_0x1ced('0xbe')]=[{'all':!![]}];}return db[_0x1ced('0xd6')][_0x1ced('0x113')](_0x202a11);})['then'](function(_0x585328){_0x4369d4[_0x1ced('0x114')]=_0x585328;return _0x4369d4;});}})['then'](respondWithFilteredResult(_0x45ece7,_0x202a11))[_0x1ced('0x43')](handleError(_0x45ece7,null));};exports['getMyMessages']=function(_0xd6493b,_0x4f3b44,_0x25276a){var _0x566bb5={'where':{}},_0x510271={},_0x3d8893={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0xd6493b['params']['id']}})[_0x1ced('0x1f')](handleEntityNotFound(_0x4f3b44,null))[_0x1ced('0x1f')](function(_0x25d95a){if(_0x25d95a){_0x510271[_0x1ced('0x51')]=_[_0x1ced('0x53')](db['ChatMessage'][_0x1ced('0xbd')]);_0x510271[_0x1ced('0x52')]=_[_0x1ced('0x53')](_0xd6493b[_0x1ced('0x52')]);_0x510271[_0x1ced('0x5c')]=_[_0x1ced('0x55')](_0x510271['model'],_0x510271['query']);_0x566bb5[_0x1ced('0x54')]=_['intersection'](_0x510271[_0x1ced('0x51')],qs['fields'](_0xd6493b[_0x1ced('0x52')][_0x1ced('0x56')]));_0x566bb5[_0x1ced('0x54')]=_0x566bb5[_0x1ced('0x54')][_0x1ced('0x57')]?_0x566bb5['attributes']:_0x510271[_0x1ced('0x51')];if(!_0xd6493b[_0x1ced('0x52')][_0x1ced('0x115')](_0x1ced('0x58'))){_0x566bb5['limit']=qs[_0x1ced('0x2e')](_0xd6493b[_0x1ced('0x52')][_0x1ced('0x2e')]);_0x566bb5[_0x1ced('0x2d')]=qs[_0x1ced('0x2d')](_0xd6493b[_0x1ced('0x52')]['offset']);}_0x566bb5['order']=qs[_0x1ced('0x5a')](_0xd6493b[_0x1ced('0x52')][_0x1ced('0x5a')]);_0x566bb5['where']=qs['filters'](_[_0x1ced('0x5d')](_0xd6493b['query'],_0x510271[_0x1ced('0x5c')]));_0x566bb5[_0x1ced('0x5b')][_0x1ced('0xba')]=_0x25d95a['id'];if(_0xd6493b[_0x1ced('0x52')][_0x1ced('0x92')]){_0x566bb5[_0x1ced('0x5b')]=_['merge'](_0x566bb5[_0x1ced('0x5b')],{'$or':_[_0x1ced('0x3d')](_0x566bb5[_0x1ced('0x54')],function(_0x115671){var _0x46f4e5={};_0x46f4e5[_0x115671]={'$like':'%'+_0xd6493b['query'][_0x1ced('0x92')]+'%'};return _0x46f4e5;})});}_0x566bb5['where'][_0x1ced('0x116')]=![];if(_0xd6493b[_0x1ced('0x52')]['id']){_0x566bb5[_0x1ced('0x5b')]['id']={'$gt':_0xd6493b[_0x1ced('0x52')]['id']};}_0x566bb5=_['merge']({},_0x566bb5,_0xd6493b[_0x1ced('0xbf')]);return db[_0x1ced('0xd6')]['count']({'where':_0x566bb5[_0x1ced('0x5b')]})['then'](function(_0x521a56){_0x3d8893[_0x1ced('0x2c')]=_0x521a56;_0x566bb5['include']=[];if(_0xd6493b['query'][_0x1ced('0x117')]){_0x566bb5[_0x1ced('0xbe')]['push']({'model':db[_0x1ced('0x81')],'as':_0x1ced('0x81'),'attributes':['id',_0x1ced('0x3e'),_0x1ced('0x118')]});}if(_0xd6493b[_0x1ced('0x52')][_0x1ced('0x112')]){_0x566bb5[_0x1ced('0xbe')]=[{'all':!![]}];}return db[_0x1ced('0xd6')]['findAll'](_0x566bb5);})['then'](function(_0x33121c){_0x3d8893[_0x1ced('0x114')]=_0x33121c;return _0x3d8893;});}})[_0x1ced('0x1f')](respondWithFilteredResult(_0x4f3b44,_0x566bb5))[_0x1ced('0x43')](handleError(_0x4f3b44,null));};exports['addTags']=function(_0xaaf551,_0x1e4110,_0x158897){return db[_0x1ced('0xa6')][_0x1ced('0x72')]({'where':{'id':_0xaaf551['params']['id']}})[_0x1ced('0x1f')](handleEntityNotFound(_0x1e4110,null))[_0x1ced('0x1f')](function(_0x5bb5a8){if(_0x5bb5a8){return _0x5bb5a8[_0x1ced('0x119')](_0xaaf551['body']['ids'],_[_0x1ced('0x110')](_0xaaf551[_0x1ced('0x38')],[_0x1ced('0x10f'),'id'])||{})[_0x1ced('0x11a')](function(){return db[_0x1ced('0x11b')]['findAll']({'attributes':['id','name',_0x1ced('0x11c')],'where':{'id':_0xaaf551[_0x1ced('0x38')]['ids']}});})['then'](function(_0x5e4fce){socket[_0x1ced('0x11d')](_0x1ced('0x11e'),{'id':Number(_0xaaf551[_0x1ced('0xc2')]['id']),'tags':_0x5e4fce||[]});return{'id':Number(_0xaaf551['params']['id']),'tags':_0x5e4fce||[]};});}})[_0x1ced('0x1f')](respondWithResult(_0x1e4110,null))[_0x1ced('0x43')](handleError(_0x1e4110,null));};exports[_0x1ced('0x11f')]=function(_0x465f92,_0x4647d7,_0x360f78){return db[_0x1ced('0xa6')][_0x1ced('0x72')]({'where':{'id':_0x465f92[_0x1ced('0xc2')]['id']}})['then'](handleEntityNotFound(_0x4647d7,null))['then'](function(_0x391d3f){if(_0x391d3f){return _0x391d3f[_0x1ced('0x11f')](_0x465f92[_0x1ced('0x52')][_0x1ced('0x10f')]);}})[_0x1ced('0x1f')](respondWithStatusCode(_0x4647d7,null))['catch'](handleError(_0x4647d7,null));};exports[_0x1ced('0xea')]=function(_0x1ee435,_0x58b045){var _0x4bd6b6=moment()['unix']()[_0x1ced('0xb7')]();var _0x55dfc2=path[_0x1ced('0xe6')](config['root'],_0x1ced('0x120'),_0x1ced('0x121'),_0x1ced('0x122'));var _0x3b0c6f=path[_0x1ced('0xe6')](config['root'],_0x1ced('0x120'),'files',_0x1ced('0x123'));var _0x245734=path[_0x1ced('0xe6')](_0x55dfc2,_0x4bd6b6);var _0x2ef2ed=util[_0x1ced('0xee')](_0x1ced('0x124'),_0x1ee435[_0x1ced('0xc2')]['id'],_0x4bd6b6);var _0x5eed5e=path[_0x1ced('0xe6')](_0x55dfc2,_0x2ef2ed);var _0x48fd06=[];_0x48fd06[_0x1ced('0x41')]({'model':db[_0x1ced('0x81')],'as':'User','attributes':['id',_0x1ced('0x3e')],'raw':!![]});_0x48fd06[_0x1ced('0x41')]({'model':db[_0x1ced('0xd9')],'as':_0x1ced('0x77'),'attributes':['id',_0x1ced('0x125'),_0x1ced('0x126')],'raw':!![]});if(_0x1ee435['query'][_0x1ced('0x123')]){_0x48fd06[_0x1ced('0x41')]({'model':db[_0x1ced('0xe1')],'as':_0x1ced('0xe1'),'raw':!![]});}var _0x2b3cc8=[{'model':db[_0x1ced('0xd6')],'as':_0x1ced('0xf1'),'attributes':['id',_0x1ced('0x38'),_0x1ced('0xfc'),_0x1ced('0xfe'),_0x1ced('0x116'),_0x1ced('0x8c')],'include':_0x48fd06}];_0x2b3cc8[_0x1ced('0x41')]({'model':db[_0x1ced('0xc6')],'as':_0x1ced('0x127'),'attributes':['id','name']});_0x2b3cc8[_0x1ced('0x41')]({'model':db[_0x1ced('0x81')],'as':_0x1ced('0x128'),'attributes':['id',_0x1ced('0x3e')]});return db[_0x1ced('0xa6')][_0x1ced('0x72')]({'where':{'id':_0x1ee435[_0x1ced('0xc2')]['id']},'include':_0x2b3cc8})[_0x1ced('0x1f')](handleEntityNotFound(_0x58b045,null))[_0x1ced('0x1f')](function(_0x47fd40){if(_0x47fd40){var _0x3890ae=_0x47fd40['get']({'plain':!![]});fs['mkdirSync'](_0x245734);var _0x52d4a7={'channel':_0x1ced('0x129'),'account':_0x3890ae[_0x1ced('0x127')][_0x1ced('0x35')],'agent':_0x3890ae['Owner']?_0x3890ae[_0x1ced('0x128')][_0x1ced('0x3e')]:_0x1ced('0x12a'),'createdAt':moment(_0x3890ae['createdAt'])[_0x1ced('0xee')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1ced('0xb7')](),'closedAt':_0x3890ae[_0x1ced('0x49')]?moment(_0x3890ae[_0x1ced('0x12b')])['format'](_0x1ced('0x12c'))[_0x1ced('0xb7')]():'','disposition':_0x3890ae['disposition'],'chatInfo':{'browser':_0x3890ae['browserName'],'os':_0x3890ae[_0x1ced('0x12d')],'referer':_0x3890ae[_0x1ced('0x12e')],'customerIp':_0x3890ae[_0x1ced('0x12f')],'customerPort':_0x3890ae[_0x1ced('0x130')]?_0x3890ae['customerPort']:_0x1ced('0x12a')},'messages':_(_0x3890ae['Messages'])[_0x1ced('0x131')]()['filter']({'secret':![]})[_0x1ced('0x3d')](function(_0x4181d9){if(_0x4181d9[_0x1ced('0xe1')]){var _0x2f054d=path[_0x1ced('0xe6')](_0x3b0c6f,_0x4181d9[_0x1ced('0xe1')]['basename']);if(fs['existsSync'](_0x2f054d)){fs['createReadStream'](_0x2f054d)[_0x1ced('0x132')](fs['createWriteStream'](path[_0x1ced('0xe6')](_0x245734,_0x4181d9[_0x1ced('0xe1')]['basename'])));}}return{'date':moment(_0x4181d9['createdAt'])[_0x1ced('0xee')](_0x1ced('0x12c'))[_0x1ced('0xb7')](),'sender':_0x4181d9['direction']===_0x1ced('0xd5')?_0x4181d9[_0x1ced('0x81')]?_0x4181d9[_0x1ced('0x81')][_0x1ced('0x3e')]:_0x1ced('0xf4'):_0x4181d9['Contact']['firstName']+(_0x4181d9[_0x1ced('0x77')]['lastName']?'\x20'+_0x4181d9[_0x1ced('0x77')][_0x1ced('0x126')]:''),'body':_0x4181d9[_0x1ced('0xe1')]?_0x4181d9[_0x1ced('0xe1')]['basename']:_0x4181d9[_0x1ced('0x38')],'direction':_0x4181d9[_0x1ced('0xfe')]===_0x1ced('0xd5')?'A':'C','secret':_0x4181d9[_0x1ced('0x116')],'read':_0x4181d9['read'],'attachment':_0x4181d9['Attachment']};})['value']()};return ejs[_0x1ced('0x133')](path[_0x1ced('0xe6')](config[_0x1ced('0xe7')],_0x1ced('0x120'),_0x1ced('0x134'),_0x1ced('0x135')),{'interaction':_0x52d4a7})[_0x1ced('0x1f')](function(_0x122751){var _0x23e17d=path[_0x1ced('0xe6')](_0x245734,_0x1ced('0x136')+_0x3890ae['id']+'-'+_0x4bd6b6+_0x1ced('0x137'));var _0x11e44f={'path':_0x23e17d,'channel':_0x1ced('0x129'),'interactionId':_0x3890ae['id']};return pdf[_0x1ced('0x138')](_0x122751,_0x11e44f);})[_0x1ced('0x1f')](function(){return new BPromise(function(_0x42a0fe,_0x3c497f){zipdir(_0x245734,{'saveTo':_0x5eed5e},function(_0x52d60a,_0x4356aa){if(_0x52d60a)return _0x3c497f(_0x52d60a);return _0x42a0fe(_0x4356aa);});})[_0x1ced('0x1f')](function(){return new BPromise(function(_0x50d21d,_0xd21705){rimraf(_0x245734,function(_0xd0ea36){if(_0xd0ea36)_0xd21705(_0xd0ea36);return _0x50d21d();});});})['then'](function(){return _0x58b045[_0x1ced('0xea')](_0x5eed5e,_0x2ef2ed,function(_0x5846aa){if(_0x5846aa){console[_0x1ced('0x139')](_0x1ced('0x13a'),_0x5846aa);}else{fs[_0x1ced('0x13b')](_0x5eed5e);}});});});}else{return _0x58b045['sendStatus'](0xc8);}})[_0x1ced('0x43')](handleError(_0x58b045,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 2fe5f6e..1c5f94b 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 _0x1cc5=['setMaxListeners','save','update','getUsers','then','map','findAll','setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x5e0914,_0x481afe){var _0x5eebff=function(_0x34c6f3){while(--_0x34c6f3){_0x5e0914['push'](_0x5e0914['shift']());}};_0x5eebff(++_0x481afe);}(_0x1cc5,0x19a));var _0x51cc=function(_0x56e1f1,_0x433412){_0x56e1f1=_0x56e1f1-0x0;var _0x5a7b9d=_0x1cc5[_0x56e1f1];return _0x5a7b9d;};'use strict';var EventEmitter=require(_0x51cc('0x0'));var ChatInteraction=require(_0x51cc('0x1'))['db'][_0x51cc('0x2')];var ChatMessage=require(_0x51cc('0x1'))['db'][_0x51cc('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x51cc('0x4')](0x0);var events={'afterCreate':_0x51cc('0x5'),'afterUpdate':_0x51cc('0x6'),'afterDestroy':'remove'};function emitEvent(_0xe6db63){return function(_0x52b27d,_0x1ede4f,_0x80da74){_0x52b27d[_0x51cc('0x7')]({'attributes':['id'],'raw':!![]})[_0x51cc('0x8')](function(_0x5b8739){_0x52b27d['setDataValue']('Users',_0x5b8739[_0x51cc('0x9')](function(_0x4142d6){return{'id':_0x4142d6['id']};}));return ChatMessage[_0x51cc('0xa')]({'where':{'ChatInteractionId':_0x52b27d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x51cc('0x8')](function(_0xbd5faa){_0x52b27d[_0x51cc('0xb')](_0x51cc('0xc'),_0xbd5faa[_0x51cc('0xd')]);ChatInteractionEvents['emit'](_0xe6db63+':'+_0x52b27d['id'],_0x52b27d);ChatInteractionEvents['emit'](_0xe6db63,_0x52b27d);_0x80da74(null);})[_0x51cc('0xe')](_0x80da74(null));};}for(var e in events){if(events[_0x51cc('0xf')](e)){var event=events[e];ChatInteraction[_0x51cc('0x10')](e,emitEvent(event));}}module[_0x51cc('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xe1e4=['remove','getUsers','setDataValue','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','save','update'];(function(_0x4dbab6,_0x22b3fa){var _0x18db47=function(_0x490d01){while(--_0x490d01){_0x4dbab6['push'](_0x4dbab6['shift']());}};_0x18db47(++_0x22b3fa);}(_0xe1e4,0xeb));var _0x4e1e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe1e4[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0x4e1e('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x4e1e('0x1'))['db'][_0x4e1e('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e1e('0x3'),'afterUpdate':_0x4e1e('0x4'),'afterDestroy':_0x4e1e('0x5')};function emitEvent(_0x58bd5e){return function(_0x189ff6,_0x38162a,_0x31e1f3){_0x189ff6[_0x4e1e('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xae5100){_0x189ff6[_0x4e1e('0x7')]('Users',_0xae5100[_0x4e1e('0x8')](function(_0x317d98){return{'id':_0x317d98['id']};}));return ChatMessage[_0x4e1e('0x9')]({'where':{'ChatInteractionId':_0x189ff6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e1e('0xa')](function(_0x39ab20){_0x189ff6['setDataValue'](_0x4e1e('0xb'),_0x39ab20['length']);ChatInteractionEvents[_0x4e1e('0xc')](_0x58bd5e+':'+_0x189ff6['id'],_0x189ff6);ChatInteractionEvents[_0x4e1e('0xc')](_0x58bd5e,_0x189ff6);_0x31e1f3(null);})[_0x4e1e('0xd')](_0x31e1f3(null));};}for(var e in events){if(events[_0x4e1e('0xe')](e)){var event=events[e];ChatInteraction[_0x4e1e('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index fc2f7b3..72f3f2a 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 _0x0680=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','define'];(function(_0x512bd2,_0xedef2c){var _0x1a1341=function(_0x1cc2b5){while(--_0x1cc2b5){_0x512bd2['push'](_0x512bd2['shift']());}};_0x1a1341(++_0xedef2c);}(_0x0680,0x1aa));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0068('0x0'));var util=require(_0x0068('0x1'));var logger=require(_0x0068('0x2'))(_0x0068('0x3'));var moment=require(_0x0068('0x4'));var BPromise=require(_0x0068('0x5'));var rp=require(_0x0068('0x6'));var fs=require('fs');var path=require(_0x0068('0x7'));var rimraf=require(_0x0068('0x8'));var config=require('../../config/environment');var attributes=require(_0x0068('0x9'));module['exports']=function(_0x3f7508,_0x289f47){return _0x3f7508[_0x0068('0xa')](_0x0068('0xb'),attributes,{'tableName':_0x0068('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cc3ba,_0x1c015f,_0x48fbf4){if(_0x2cc3ba[_0x0068('0xd')](_0x0068('0xe'))){_0x2cc3ba[_0x0068('0xf')]=moment()[_0x0068('0x10')](_0x0068('0x11'));}_0x48fbf4(null,_0x2cc3ba);}},'charset':'utf8mb4','collate':_0x0068('0x12')});}; \ No newline at end of file +var _0x09e0=['chat_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x550de5,_0x27837d){var _0x236281=function(_0x4759b8){while(--_0x4759b8){_0x550de5['push'](_0x550de5['shift']());}};_0x236281(++_0x27837d);}(_0x09e0,0x6a));var _0x009e=function(_0x366013,_0x595e06){_0x366013=_0x366013-0x0;var _0x4e3613=_0x09e0[_0x366013];return _0x4e3613;};'use strict';var _=require(_0x009e('0x0'));var util=require(_0x009e('0x1'));var logger=require(_0x009e('0x2'))(_0x009e('0x3'));var moment=require(_0x009e('0x4'));var BPromise=require('bluebird');var rp=require(_0x009e('0x5'));var fs=require('fs');var path=require(_0x009e('0x6'));var rimraf=require(_0x009e('0x7'));var config=require(_0x009e('0x8'));var attributes=require(_0x009e('0x9'));module[_0x009e('0xa')]=function(_0x12f3b1,_0x4100ae){return _0x12f3b1[_0x009e('0xb')](_0x009e('0xc'),attributes,{'tableName':_0x009e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20fe54,_0x262af0,_0x5bab99){if(_0x20fe54['changed']('closed')){_0x20fe54[_0x009e('0xe')]=moment()['format'](_0x009e('0xf'));}_0x5bab99(null,_0x20fe54);}},'charset':_0x009e('0x10'),'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 70eee7b..747a6d9 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 _0x4d1f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','stringify','catch','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment'];(function(_0x5bba4b,_0x443c3c){var _0x3489e7=function(_0x21b581){while(--_0x21b581){_0x5bba4b['push'](_0x5bba4b['shift']());}};_0x3489e7(++_0x443c3c);}(_0x4d1f,0x1c0));var _0xf4d1=function(_0x5014d8,_0x176247){_0x5014d8=_0x5014d8-0x0;var _0x5ddb02=_0x4d1f[_0x5014d8];return _0x5ddb02;};'use strict';var _=require(_0xf4d1('0x0'));var util=require(_0xf4d1('0x1'));var moment=require(_0xf4d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4d1('0x5'))(_0xf4d1('0x6'));var config=require(_0xf4d1('0x7'));var jayson=require(_0xf4d1('0x8'));var client=jayson[_0xf4d1('0x9')][_0xf4d1('0xa')]({'port':0x232a});config[_0xf4d1('0xb')]=_[_0xf4d1('0xc')](config[_0xf4d1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4d1('0xd'))(new Redis(config['redis']));require(_0xf4d1('0xe'))[_0xf4d1('0xf')](socket);function respondWithRpcPromise(_0x497a3b,_0x17d290,_0x110d8f){return new BPromise(function(_0x30636c,_0x5e4b13){return client[_0xf4d1('0x10')](_0x497a3b,_0x110d8f)[_0xf4d1('0x11')](function(_0x26eccd){logger[_0xf4d1('0x12')](_0xf4d1('0x13'),_0x17d290,_0xf4d1('0x14'));logger[_0xf4d1('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x17d290,'request\x20sent',JSON['stringify'](_0x26eccd));if(_0x26eccd['error']){if(_0x26eccd['error']['code']===0x1f4){logger[_0xf4d1('0x16')](_0xf4d1('0x13'),_0x17d290,_0x26eccd[_0xf4d1('0x16')][_0xf4d1('0x17')]);return _0x5e4b13(_0x26eccd['error']['message']);}logger[_0xf4d1('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x17d290,_0x26eccd[_0xf4d1('0x16')][_0xf4d1('0x17')]);return _0x30636c(_0x26eccd['error']['message']);}else{logger[_0xf4d1('0x12')](_0xf4d1('0x13'),_0x17d290,'request\x20sent');_0x30636c(_0x26eccd[_0xf4d1('0x18')]['message']);}})['catch'](function(_0x1d22b3){logger[_0xf4d1('0x16')](_0xf4d1('0x13'),_0x17d290,_0x1d22b3);_0x5e4b13(_0x1d22b3);});});}exports[_0xf4d1('0x19')]=function(_0x9e6c9c){var _0x4d7193=this;return new Promise(function(_0x2fd8f7,_0x5f159b){return db[_0xf4d1('0x1a')]['update'](_0x9e6c9c[_0xf4d1('0x1b')],{'raw':_0x9e6c9c[_0xf4d1('0x1c')]?_0x9e6c9c[_0xf4d1('0x1c')][_0xf4d1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9e6c9c['options']?_0x9e6c9c[_0xf4d1('0x1c')][_0xf4d1('0x1e')]||null:null,'attributes':_0x9e6c9c[_0xf4d1('0x1c')]?_0x9e6c9c['options'][_0xf4d1('0x1f')]||null:null,'limit':_0x9e6c9c['options']?_0x9e6c9c[_0xf4d1('0x1c')][_0xf4d1('0x20')]||null:null})['then'](function(_0x192325){logger[_0xf4d1('0x12')](_0xf4d1('0x19'),_0x9e6c9c);logger['debug'](_0xf4d1('0x19'),_0x9e6c9c,JSON[_0xf4d1('0x21')](_0x192325));_0x2fd8f7(_0x192325);})[_0xf4d1('0x22')](function(_0x381a49){logger['error'](_0xf4d1('0x19'),_0x381a49[_0xf4d1('0x17')],_0x9e6c9c);_0x5f159b(_0x4d7193[_0xf4d1('0x16')](0x1f4,_0x381a49[_0xf4d1('0x17')]));});});};exports[_0xf4d1('0x23')]=function(_0x261835){return new Promise(function(_0x10ca5f,_0x2d5b40){return db[_0xf4d1('0x1a')][_0xf4d1('0x24')]({'where':_0x261835[_0xf4d1('0x1c')]?_0x261835[_0xf4d1('0x1c')][_0xf4d1('0x1e')]||null:null})[_0xf4d1('0x11')](function(_0x4b563f){if(_0x4b563f){return _0x4b563f[_0xf4d1('0x25')](_0x261835[_0xf4d1('0x1b')][_0xf4d1('0x26')],_['omit'](_0x261835[_0xf4d1('0x1b')],['ids','id'])||{});}})[_0xf4d1('0x27')](function(_0x293fa7){logger['info'](_0xf4d1('0x28'),_0x261835);logger[_0xf4d1('0x15')](_0xf4d1('0x28'),_0x261835,JSON[_0xf4d1('0x21')](_0x293fa7));_0x10ca5f(_0x293fa7);})[_0xf4d1('0x22')](function(_0x2a1be){logger[_0xf4d1('0x16')]('AddTags',_0x2a1be[_0xf4d1('0x17')],_0x261835);_0x2d5b40(_this[_0xf4d1('0x16')](0x1f4,_0x2a1be[_0xf4d1('0x17')]));});});}; \ No newline at end of file +var _0x7a64=['catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','find','then','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x3ea625,_0x33990b){var _0x48fc1c=function(_0x3ca06d){while(--_0x3ca06d){_0x3ea625['push'](_0x3ea625['shift']());}};_0x48fc1c(++_0x33990b);}(_0x7a64,0xec));var _0x47a6=function(_0x4c71a6,_0x5bab4d){_0x4c71a6=_0x4c71a6-0x0;var _0x53d900=_0x7a64[_0x4c71a6];return _0x53d900;};'use strict';var _=require(_0x47a6('0x0'));var util=require('util');var moment=require(_0x47a6('0x1'));var BPromise=require(_0x47a6('0x2'));var rs=require(_0x47a6('0x3'));var fs=require('fs');var Redis=require(_0x47a6('0x4'));var db=require(_0x47a6('0x5'))['db'];var utils=require(_0x47a6('0x6'));var logger=require(_0x47a6('0x7'))(_0x47a6('0x8'));var config=require(_0x47a6('0x9'));var jayson=require(_0x47a6('0xa'));var client=jayson[_0x47a6('0xb')][_0x47a6('0xc')]({'port':0x232a});config[_0x47a6('0xd')]=_[_0x47a6('0xe')](config[_0x47a6('0xd')],{'host':_0x47a6('0xf'),'port':0x18eb});var socket=require(_0x47a6('0x10'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x47a6('0x11')](socket);function respondWithRpcPromise(_0x211b9c,_0x5ace47,_0x3e1dbc){return new BPromise(function(_0x1b2fec,_0x51f38f){return client[_0x47a6('0x12')](_0x211b9c,_0x3e1dbc)['then'](function(_0x4e3a66){logger[_0x47a6('0x13')](_0x47a6('0x14'),_0x5ace47,'request\x20sent');logger[_0x47a6('0x15')](_0x47a6('0x16'),_0x5ace47,'request\x20sent',JSON[_0x47a6('0x17')](_0x4e3a66));if(_0x4e3a66['error']){if(_0x4e3a66[_0x47a6('0x18')]['code']===0x1f4){logger[_0x47a6('0x18')](_0x47a6('0x14'),_0x5ace47,_0x4e3a66[_0x47a6('0x18')]['message']);return _0x51f38f(_0x4e3a66[_0x47a6('0x18')][_0x47a6('0x19')]);}logger[_0x47a6('0x18')](_0x47a6('0x14'),_0x5ace47,_0x4e3a66[_0x47a6('0x18')][_0x47a6('0x19')]);return _0x1b2fec(_0x4e3a66['error'][_0x47a6('0x19')]);}else{logger[_0x47a6('0x13')](_0x47a6('0x14'),_0x5ace47,_0x47a6('0x1a'));_0x1b2fec(_0x4e3a66[_0x47a6('0x1b')][_0x47a6('0x19')]);}})[_0x47a6('0x1c')](function(_0x5a20da){logger[_0x47a6('0x18')](_0x47a6('0x14'),_0x5ace47,_0x5a20da);_0x51f38f(_0x5a20da);});});}exports[_0x47a6('0x1d')]=function(_0x351ee1){var _0x3175dc=this;return new Promise(function(_0x3edf14,_0x50d190){return db[_0x47a6('0x1e')]['update'](_0x351ee1[_0x47a6('0x1f')],{'raw':_0x351ee1[_0x47a6('0x20')]?_0x351ee1['options'][_0x47a6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x351ee1[_0x47a6('0x20')]?_0x351ee1[_0x47a6('0x20')][_0x47a6('0x22')]||null:null,'attributes':_0x351ee1['options']?_0x351ee1[_0x47a6('0x20')][_0x47a6('0x23')]||null:null,'limit':_0x351ee1[_0x47a6('0x20')]?_0x351ee1[_0x47a6('0x20')][_0x47a6('0x24')]||null:null})['then'](function(_0x2bfec3){logger[_0x47a6('0x13')](_0x47a6('0x1d'),_0x351ee1);logger[_0x47a6('0x15')](_0x47a6('0x1d'),_0x351ee1,JSON['stringify'](_0x2bfec3));_0x3edf14(_0x2bfec3);})[_0x47a6('0x1c')](function(_0x27c6c8){logger[_0x47a6('0x18')](_0x47a6('0x1d'),_0x27c6c8[_0x47a6('0x19')],_0x351ee1);_0x50d190(_0x3175dc['error'](0x1f4,_0x27c6c8[_0x47a6('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x5ab0d6){return new Promise(function(_0x1a06b5,_0x507316){return db[_0x47a6('0x1e')][_0x47a6('0x25')]({'where':_0x5ab0d6[_0x47a6('0x20')]?_0x5ab0d6[_0x47a6('0x20')][_0x47a6('0x22')]||null:null})[_0x47a6('0x26')](function(_0x413be9){if(_0x413be9){return _0x413be9[_0x47a6('0x27')](_0x5ab0d6[_0x47a6('0x1f')][_0x47a6('0x28')],_[_0x47a6('0x29')](_0x5ab0d6[_0x47a6('0x1f')],['ids','id'])||{});}})[_0x47a6('0x2a')](function(_0xd74cea){logger['info'](_0x47a6('0x2b'),_0x5ab0d6);logger[_0x47a6('0x15')](_0x47a6('0x2b'),_0x5ab0d6,JSON['stringify'](_0xd74cea));_0x1a06b5(_0xd74cea);})['catch'](function(_0x275ddc){logger[_0x47a6('0x18')]('AddTags',_0x275ddc['message'],_0x5ab0d6);_0x507316(_this['error'](0x1f4,_0x275ddc[_0x47a6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b6c8c71..789b558 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 _0x4d46=['removeListener','register','length','chatInteraction:','save','update'];(function(_0xb40a8f,_0x2a907e){var _0x5e1908=function(_0xa91458){while(--_0xa91458){_0xb40a8f['push'](_0xb40a8f['shift']());}};_0x5e1908(++_0x2a907e);}(_0x4d46,0x6a));var _0x64d4=function(_0x3fce4e,_0x18e429){_0x3fce4e=_0x3fce4e-0x0;var _0x393360=_0x4d46[_0x3fce4e];return _0x393360;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x64d4('0x0'),'remove',_0x64d4('0x1')];function createListener(_0x286a85,_0x2299f6){return function(_0xee53bc){_0x2299f6['emit'](_0x286a85,_0xee53bc);};}function removeListener(_0x3f6019,_0x5411a9){return function(){ChatInteractionEvents[_0x64d4('0x2')](_0x3f6019,_0x5411a9);};}exports[_0x64d4('0x3')]=function(_0x4aad2f){for(var _0x23abb3=0x0,_0x16ff28=events[_0x64d4('0x4')];_0x23abb3<_0x16ff28;_0x23abb3++){var _0x2d9dad=events[_0x23abb3];var _0x23d1f5=createListener(_0x64d4('0x5')+_0x2d9dad,_0x4aad2f);ChatInteractionEvents['on'](_0x2d9dad,_0x23d1f5);}}; \ No newline at end of file +var _0x85e9=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x2a60d5,_0x482adf){var _0x1aa7ec=function(_0x3d3e4f){while(--_0x3d3e4f){_0x2a60d5['push'](_0x2a60d5['shift']());}};_0x1aa7ec(++_0x482adf);}(_0x85e9,0x185));var _0x985e=function(_0x29239b,_0x114fdf){_0x29239b=_0x29239b-0x0;var _0x4f1c69=_0x85e9[_0x29239b];return _0x4f1c69;};'use strict';var ChatInteractionEvents=require(_0x985e('0x0'));var events=[_0x985e('0x1'),_0x985e('0x2'),_0x985e('0x3')];function createListener(_0x41b499,_0x41726a){return function(_0x3b00a9){_0x41726a[_0x985e('0x4')](_0x41b499,_0x3b00a9);};}function removeListener(_0x152b54,_0x44e85c){return function(){ChatInteractionEvents['removeListener'](_0x152b54,_0x44e85c);};}exports[_0x985e('0x5')]=function(_0x43dc5e){for(var _0x3f8533=0x0,_0x59f43c=events[_0x985e('0x6')];_0x3f8533<_0x59f43c;_0x3f8533++){var _0x404ab4=events[_0x3f8533];var _0x1848c7=createListener(_0x985e('0x7')+_0x404ab4,_0x43dc5e);ChatInteractionEvents['on'](_0x404ab4,_0x1848c7);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index de34c11..c2f064d 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 _0xe459=['attachmentUpload','addMessage','tracked','chat','/:id','customUpdate','put','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','format','now','originalname','replace','single','file'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe459,0x1c9));var _0x9e45=function(_0x45a9b6,_0x34879c){_0x45a9b6=_0x45a9b6-0x0;var _0x18bdaf=_0xe459[_0x45a9b6];return _0x18bdaf;};'use strict';var multer=require(_0x9e45('0x0'));var util=require('util');var path=require(_0x9e45('0x1'));var timeout=require(_0x9e45('0x2'));var express=require(_0x9e45('0x3'));var router=express[_0x9e45('0x4')]();var fs_extra=require(_0x9e45('0x5'));var auth=require(_0x9e45('0x6'));var interaction=require(_0x9e45('0x7'));var config=require('../../config/environment');var controller=require(_0x9e45('0x8'));router[_0x9e45('0x9')]('/',auth[_0x9e45('0xa')](),controller['index']);router[_0x9e45('0x9')]('/describe',auth[_0x9e45('0xa')](),controller[_0x9e45('0xb')]);router[_0x9e45('0x9')]('/:id',auth[_0x9e45('0xc')](),controller[_0x9e45('0xd')]);router[_0x9e45('0x9')](_0x9e45('0xe'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x9e45('0x9')](_0x9e45('0xf'),auth['isAuthenticated'](),controller[_0x9e45('0x10')]);router['get'](_0x9e45('0x11'),auth[_0x9e45('0xc')](),controller[_0x9e45('0x12')]);router['get'](_0x9e45('0x13'),auth[_0x9e45('0xa')](),controller[_0x9e45('0x14')]);router[_0x9e45('0x15')]('/',auth[_0x9e45('0xa')](),controller[_0x9e45('0x16')]);router[_0x9e45('0x15')](_0x9e45('0x17'),auth[_0x9e45('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9e45('0x18')]({'destination':function(_0x1b4224,_0x4037f4,_0x59627f){_0x59627f(null,path[_0x9e45('0x19')](config[_0x9e45('0x1a')],'server/files/attachments/'));},'filename':function(_0x100efb,_0x599fbc,_0x4836e4){_0x4836e4(null,util[_0x9e45('0x1b')]('%s-%s',Date[_0x9e45('0x1c')](),_0x599fbc[_0x9e45('0x1d')][_0x9e45('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9e45('0x15')]('/:id/attachment_upload',upload[_0x9e45('0x1f')](_0x9e45('0x20')),controller[_0x9e45('0x21')]);router[_0x9e45('0x15')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x9e45('0x22')]);router[_0x9e45('0x15')]('/:id/tags',auth[_0x9e45('0xa')](),interaction[_0x9e45('0x23')](_0x9e45('0x24'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x9e45('0x25'),auth['isAuthenticated'](),interaction[_0x9e45('0x23')](_0x9e45('0x24'),'chatinteraction:update'),controller['update']);router['put']('/:id/custom_update',controller[_0x9e45('0x26')]);router[_0x9e45('0x27')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x9e45('0x28')]);router[_0x9e45('0x27')](_0x9e45('0x29'),controller[_0x9e45('0x2a')]);router['delete']('/:id',auth[_0x9e45('0xa')](),interaction['tracked']('chat',_0x9e45('0x2b')),controller[_0x9e45('0x2c')]);router[_0x9e45('0x2d')](_0x9e45('0x2e'),auth[_0x9e45('0xa')](),controller[_0x9e45('0x2f')]);module[_0x9e45('0x30')]=router; \ No newline at end of file +var _0xee72=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','delete','/:id','chatinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id/attachment_download','isChatInteractionAuthorized'];(function(_0x161504,_0x5b6ac0){var _0x2e140a=function(_0x56cae1){while(--_0x56cae1){_0x161504['push'](_0x161504['shift']());}};_0x2e140a(++_0x5b6ac0);}(_0xee72,0x1f0));var _0x2ee7=function(_0x21cded,_0x3111be){_0x21cded=_0x21cded-0x0;var _0x555e50=_0xee72[_0x21cded];return _0x555e50;};'use strict';var multer=require('multer');var util=require(_0x2ee7('0x0'));var path=require(_0x2ee7('0x1'));var timeout=require(_0x2ee7('0x2'));var express=require(_0x2ee7('0x3'));var router=express[_0x2ee7('0x4')]();var fs_extra=require(_0x2ee7('0x5'));var auth=require(_0x2ee7('0x6'));var interaction=require(_0x2ee7('0x7'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x2ee7('0x8')]('/',auth[_0x2ee7('0x9')](),controller['index']);router[_0x2ee7('0x8')](_0x2ee7('0xa'),auth[_0x2ee7('0x9')](),controller[_0x2ee7('0xb')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router[_0x2ee7('0x8')](_0x2ee7('0xc'),auth[_0x2ee7('0xd')](),controller[_0x2ee7('0xe')]);router[_0x2ee7('0x8')](_0x2ee7('0xf'),auth[_0x2ee7('0x9')](),controller[_0x2ee7('0x10')]);router[_0x2ee7('0x8')](_0x2ee7('0x11'),auth[_0x2ee7('0xd')](),controller['getMyMessages']);router['get'](_0x2ee7('0x12'),auth[_0x2ee7('0x9')](),controller[_0x2ee7('0x13')]);router[_0x2ee7('0x14')]('/',auth[_0x2ee7('0x9')](),controller[_0x2ee7('0x15')]);router['post'](_0x2ee7('0x16'),auth['isAuthenticated'](),controller[_0x2ee7('0x17')]);var upload=multer({'storage':multer[_0x2ee7('0x18')]({'destination':function(_0x6fa7b5,_0x52c531,_0x42d75c){_0x42d75c(null,path[_0x2ee7('0x19')](config[_0x2ee7('0x1a')],_0x2ee7('0x1b')));},'filename':function(_0x25d47b,_0x4ad7c9,_0x5e639d){_0x5e639d(null,util[_0x2ee7('0x1c')]('%s-%s',Date['now'](),_0x4ad7c9['originalname'][_0x2ee7('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2ee7('0x14')](_0x2ee7('0x1e'),upload['single'](_0x2ee7('0x1f')),controller[_0x2ee7('0x20')]);router[_0x2ee7('0x14')](_0x2ee7('0xf'),auth[_0x2ee7('0xd')](),controller[_0x2ee7('0x21')]);router['post'](_0x2ee7('0x22'),auth[_0x2ee7('0x9')](),interaction[_0x2ee7('0x23')](_0x2ee7('0x24'),_0x2ee7('0x25')),controller[_0x2ee7('0x26')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2ee7('0x24'),_0x2ee7('0x27')),controller[_0x2ee7('0x28')]);router[_0x2ee7('0x29')]('/:id/custom_update',controller[_0x2ee7('0x2a')]);router[_0x2ee7('0x29')](_0x2ee7('0x2b'),auth[_0x2ee7('0xd')](),controller[_0x2ee7('0x2c')]);router[_0x2ee7('0x29')](_0x2ee7('0x2d'),controller['close']);router[_0x2ee7('0x2e')](_0x2ee7('0x2f'),auth[_0x2ee7('0x9')](),interaction[_0x2ee7('0x23')]('chat',_0x2ee7('0x30')),controller[_0x2ee7('0x31')]);router[_0x2ee7('0x2e')](_0x2ee7('0x22'),auth[_0x2ee7('0x9')](),controller['removeTags']);module[_0x2ee7('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index bc6ffd4..ec74fc9 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 _0xde44=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x48779a,_0x2afba6){var _0x4af39b=function(_0x3b5d26){while(--_0x3b5d26){_0x48779a['push'](_0x48779a['shift']());}};_0x4af39b(++_0x2afba6);}(_0xde44,0x145));var _0x4de4=function(_0x7dde8d,_0x12f5f3){_0x7dde8d=_0x7dde8d-0x0;var _0x4dc038=_0xde44[_0x7dde8d];return _0x4dc038;};'use strict';var Sequelize=require(_0x4de4('0x0'));module[_0x4de4('0x1')]={'body':{'type':Sequelize[_0x4de4('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4de4('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x74d1=['BOOLEAN','INTEGER','sequelize','TEXT','medium'];(function(_0x419214,_0xee9d6d){var _0x424338=function(_0x2060e9){while(--_0x2060e9){_0x419214['push'](_0x419214['shift']());}};_0x424338(++_0xee9d6d);}(_0x74d1,0x1c9));var _0x174d=function(_0x5e8f01,_0x2edb92){_0x5e8f01=_0x5e8f01-0x0;var _0x555653=_0x74d1[_0x5e8f01];return _0x555653;};'use strict';var Sequelize=require(_0x174d('0x0'));module['exports']={'body':{'type':Sequelize[_0x174d('0x1')](_0x174d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x174d('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x174d('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index acd94f7..5af0787 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 _0x7802=['name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','findAll','catch','show','params','includeAll','find','create','body','update','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','getUsers','User','agent','admin','role','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','push','FromId','read','all','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7802,0x1e7));var _0x2780=function(_0x2a05b0,_0x45eed9){_0x2a05b0=_0x2a05b0-0x0;var _0x36eb0a=_0x7802[_0x2a05b0];return _0x36eb0a;};'use strict';var emlformat=require(_0x2780('0x0'));var rimraf=require(_0x2780('0x1'));var zipdir=require(_0x2780('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2780('0x3'));var moment=require('moment');var BPromise=require(_0x2780('0x4'));var Mustache=require(_0x2780('0x5'));var util=require(_0x2780('0x6'));var path=require(_0x2780('0x7'));var sox=require(_0x2780('0x8'));var csv=require(_0x2780('0x9'));var ejs=require(_0x2780('0xa'));var fs=require('fs');var fs_extra=require(_0x2780('0xb'));var _=require('lodash');var squel=require(_0x2780('0xc'));var crypto=require(_0x2780('0xd'));var jsforce=require(_0x2780('0xe'));var deskjs=require(_0x2780('0xf'));var toCsv=require(_0x2780('0x9'));var querystring=require(_0x2780('0x10'));var Papa=require(_0x2780('0x11'));var Redis=require(_0x2780('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2780('0x13'));var as=require(_0x2780('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2780('0x15'))(_0x2780('0x16'));var utils=require(_0x2780('0x17'));var config=require(_0x2780('0x18'));var licenseUtil=require(_0x2780('0x19'));var db=require(_0x2780('0x1a'))['db'];config[_0x2780('0x1b')]=_['defaults'](config['redis'],{'host':_0x2780('0x1c'),'port':0x18eb});var socket=require(_0x2780('0x1d'))(new Redis(config[_0x2780('0x1b')]));require(_0x2780('0x1e'))['register'](socket);function respondWithStatusCode(_0x541141,_0x486425){_0x486425=_0x486425||0xcc;return function(_0x43b107){if(_0x43b107){return _0x541141[_0x2780('0x1f')](_0x486425);}return _0x541141[_0x2780('0x20')](_0x486425)[_0x2780('0x21')]();};}function respondWithResult(_0x1f6ab3,_0x20a610){_0x20a610=_0x20a610||0xc8;return function(_0x50a2b7){if(_0x50a2b7){return _0x1f6ab3[_0x2780('0x20')](_0x20a610)['json'](_0x50a2b7);}};}function respondWithFilteredResult(_0x15d839,_0x19b6f4){return function(_0x387450){if(_0x387450){var _0x2fade5=typeof _0x19b6f4[_0x2780('0x22')]===_0x2780('0x23')&&typeof _0x19b6f4[_0x2780('0x24')]===_0x2780('0x23');var _0x2ac4e7=_0x387450[_0x2780('0x25')];var _0x1ab595=_0x2fade5?0x0:_0x19b6f4[_0x2780('0x22')];var _0x372903=_0x2fade5?_0x387450[_0x2780('0x25')]:_0x19b6f4[_0x2780('0x22')]+_0x19b6f4[_0x2780('0x24')];var _0x13c26d;if(_0x372903>=_0x2ac4e7){_0x372903=_0x2ac4e7;_0x13c26d=0xc8;}else{_0x13c26d=0xce;}_0x15d839['status'](_0x13c26d);return _0x15d839[_0x2780('0x26')](_0x2780('0x27'),_0x1ab595+'-'+_0x372903+'/'+_0x2ac4e7)[_0x2780('0x28')](_0x387450);}return null;};}function patchUpdates(_0x43f84d){return function(_0x5c1afd){try{jsonpatch[_0x2780('0x29')](_0x5c1afd,_0x43f84d,!![]);}catch(_0x311615){return BPromise[_0x2780('0x2a')](_0x311615);}return _0x5c1afd[_0x2780('0x2b')]();};}function saveUpdates(_0x36a9c9,_0xcee1dd){return function(_0x2768d7){if(_0x2768d7){return _0x2768d7['update'](_0x36a9c9)[_0x2780('0x2c')](function(_0x20b94a){return _0x20b94a;});}return null;};}function removeEntity(_0x29b312,_0x4e2b6c){return function(_0x1d9bef){if(_0x1d9bef){return _0x1d9bef[_0x2780('0x2d')]()[_0x2780('0x2c')](function(){_0x29b312[_0x2780('0x20')](0xcc)[_0x2780('0x21')]();});}};}function handleEntityNotFound(_0x427f4b,_0x8cdb79){return function(_0x2e9975){if(!_0x2e9975){_0x427f4b[_0x2780('0x1f')](0x194);}return _0x2e9975;};}function handleError(_0x4a64c0,_0x1cb9d1){_0x1cb9d1=_0x1cb9d1||0x1f4;return function(_0x5b8c45){logger[_0x2780('0x2e')](_0x5b8c45[_0x2780('0x2f')]);if(_0x5b8c45[_0x2780('0x30')]){delete _0x5b8c45[_0x2780('0x30')];}_0x4a64c0[_0x2780('0x20')](_0x1cb9d1)[_0x2780('0x31')](_0x5b8c45);};}exports[_0x2780('0x32')]=function(_0x2e99dc,_0x4528ba){var _0x5e2555={},_0x6bbc6={},_0x171945={'count':0x0,'rows':[]};var _0x5e45a8=_[_0x2780('0x33')](db[_0x2780('0x34')][_0x2780('0x35')],function(_0x1de6d1){return{'name':_0x1de6d1[_0x2780('0x36')],'type':_0x1de6d1[_0x2780('0x37')]['key']};});_0x6bbc6[_0x2780('0x38')]=_[_0x2780('0x33')](_0x5e45a8,_0x2780('0x30'));_0x6bbc6[_0x2780('0x39')]=_[_0x2780('0x3a')](_0x2e99dc[_0x2780('0x39')]);_0x6bbc6[_0x2780('0x3b')]=_[_0x2780('0x3c')](_0x6bbc6[_0x2780('0x38')],_0x6bbc6['query']);_0x5e2555[_0x2780('0x3d')]=_[_0x2780('0x3c')](_0x6bbc6['model'],qs[_0x2780('0x3e')](_0x2e99dc[_0x2780('0x39')][_0x2780('0x3e')]));_0x5e2555[_0x2780('0x3d')]=_0x5e2555['attributes'][_0x2780('0x3f')]?_0x5e2555[_0x2780('0x3d')]:_0x6bbc6['model'];if(!_0x2e99dc[_0x2780('0x39')]['hasOwnProperty'](_0x2780('0x40'))){_0x5e2555[_0x2780('0x24')]=qs[_0x2780('0x24')](_0x2e99dc[_0x2780('0x39')][_0x2780('0x24')]);_0x5e2555['offset']=qs['offset'](_0x2e99dc[_0x2780('0x39')][_0x2780('0x22')]);}_0x5e2555[_0x2780('0x41')]=qs['sort'](_0x2e99dc[_0x2780('0x39')]['sort']);_0x5e2555[_0x2780('0x42')]=qs[_0x2780('0x3b')](_[_0x2780('0x43')](_0x2e99dc['query'],_0x6bbc6[_0x2780('0x3b')]),_0x5e45a8);if(_0x2e99dc[_0x2780('0x39')][_0x2780('0x44')]){_0x5e2555[_0x2780('0x42')]=_['merge'](_0x5e2555[_0x2780('0x42')],{'$or':_[_0x2780('0x33')](_0x5e45a8,function(_0x3b972a){if(_0x3b972a[_0x2780('0x37')]!=='VIRTUAL'){var _0x42b873={};_0x42b873[_0x3b972a[_0x2780('0x30')]]={'$like':'%'+_0x2e99dc[_0x2780('0x39')][_0x2780('0x44')]+'%'};return _0x42b873;}})});}_0x5e2555=_[_0x2780('0x45')]({},_0x5e2555,_0x2e99dc[_0x2780('0x46')]);var _0x52d166={'where':_0x5e2555[_0x2780('0x42')]};return db[_0x2780('0x34')][_0x2780('0x25')](_0x52d166)['then'](function(_0x44bbdb){_0x171945[_0x2780('0x25')]=_0x44bbdb;if(_0x2e99dc[_0x2780('0x39')]['includeAll']){_0x5e2555['include']=[{'all':!![]}];}return db[_0x2780('0x34')][_0x2780('0x47')](_0x5e2555);})[_0x2780('0x2c')](function(_0x2e8fbb){_0x171945['rows']=_0x2e8fbb;return _0x171945;})['then'](respondWithFilteredResult(_0x4528ba,_0x5e2555))[_0x2780('0x48')](handleError(_0x4528ba,null));};exports[_0x2780('0x49')]=function(_0x2338ce,_0x582732){var _0x58ae82={'raw':!![],'where':{'id':_0x2338ce[_0x2780('0x4a')]['id']}},_0x3c484e={};_0x3c484e[_0x2780('0x38')]=_[_0x2780('0x3a')](db['ChatInternalMessage'][_0x2780('0x35')]);_0x3c484e[_0x2780('0x39')]=_['keys'](_0x2338ce[_0x2780('0x39')]);_0x3c484e[_0x2780('0x3b')]=_[_0x2780('0x3c')](_0x3c484e[_0x2780('0x38')],_0x3c484e[_0x2780('0x39')]);_0x58ae82[_0x2780('0x3d')]=_[_0x2780('0x3c')](_0x3c484e[_0x2780('0x38')],qs[_0x2780('0x3e')](_0x2338ce[_0x2780('0x39')][_0x2780('0x3e')]));_0x58ae82[_0x2780('0x3d')]=_0x58ae82[_0x2780('0x3d')][_0x2780('0x3f')]?_0x58ae82[_0x2780('0x3d')]:_0x3c484e['model'];if(_0x2338ce[_0x2780('0x39')][_0x2780('0x4b')]){_0x58ae82['include']=[{'all':!![]}];}_0x58ae82=_[_0x2780('0x45')]({},_0x58ae82,_0x2338ce['options']);return db[_0x2780('0x34')][_0x2780('0x4c')](_0x58ae82)[_0x2780('0x2c')](handleEntityNotFound(_0x582732,null))[_0x2780('0x2c')](respondWithResult(_0x582732,null))[_0x2780('0x48')](handleError(_0x582732,null));};exports['create']=function(_0x4b5ed4,_0x1aae34){return db[_0x2780('0x34')][_0x2780('0x4d')](_0x4b5ed4[_0x2780('0x4e')],{})[_0x2780('0x2c')](respondWithResult(_0x1aae34,0xc9))[_0x2780('0x48')](handleError(_0x1aae34,null));};exports[_0x2780('0x4f')]=function(_0x52fb68,_0x5addaa){if(_0x52fb68['body']['id']){delete _0x52fb68[_0x2780('0x4e')]['id'];}return db[_0x2780('0x34')][_0x2780('0x4c')]({'where':{'id':_0x52fb68[_0x2780('0x4a')]['id']}})[_0x2780('0x2c')](handleEntityNotFound(_0x5addaa,null))[_0x2780('0x2c')](saveUpdates(_0x52fb68[_0x2780('0x4e')],null))[_0x2780('0x2c')](respondWithResult(_0x5addaa,null))[_0x2780('0x48')](handleError(_0x5addaa,null));};exports[_0x2780('0x2d')]=function(_0x4b19a6,_0x484a21){return db[_0x2780('0x34')][_0x2780('0x4c')]({'where':{'id':_0x4b19a6[_0x2780('0x4a')]['id']}})[_0x2780('0x2c')](handleEntityNotFound(_0x484a21,null))['then'](removeEntity(_0x484a21,null))[_0x2780('0x48')](handleError(_0x484a21,null));};exports[_0x2780('0x50')]=function(_0x4e1806,_0x3a7b30){return db['ChatInternalMessage'][_0x2780('0x50')]()[_0x2780('0x2c')](respondWithResult(_0x3a7b30,null))[_0x2780('0x48')](handleError(_0x3a7b30,null));};function wrapUser(_0x446482){return function(_0x1f92dc){var _0x54b3ce=_0x446482[_0x2780('0x51')]({'plain':!![]});_0x54b3ce[_0x2780('0x52')]=[];if(_0x1f92dc){_0x54b3ce['lastMessageAt']=_0x1f92dc[_0x2780('0x53')];_0x54b3ce[_0x2780('0x54')]=_0x1f92dc;}else{_0x54b3ce[_0x2780('0x55')]=moment(0x0)[_0x2780('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x54b3ce[_0x2780('0x54')]={};}return _0x54b3ce;};}exports[_0x2780('0x57')]=function(_0x3bfbf7,_0x43ab78,_0xbaceb7){var _0x5e532c=[];return db[_0x2780('0x58')][_0x2780('0x47')]({'where':{'role':[_0x2780('0x59'),_0x2780('0x5a'),'user']},'attributes':['id','fullname','name',_0x2780('0x5b'),'userpic',_0x2780('0x5c'),_0x2780('0x5d'),_0x2780('0x5e'),_0x2780('0x5f'),_0x2780('0x60')],'order':qs['sort']('-online'),'include':[{'model':db[_0x2780('0x61')],'as':'VoiceQueues','attributes':['id',_0x2780('0x30'),_0x2780('0x37')],'through':{'attributes':[]}}]})[_0x2780('0x2c')](function(_0x3c3332){if(_0x3c3332){var _0x55152d=_0x3bfbf7[_0x2780('0x62')][_0x2780('0x51')]({'plain':!![]});if(!_0x55152d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55152d[_0x2780('0x5b')]==='user'){return db[_0x2780('0x63')][_0x2780('0x4c')]({'where':{'name':'Agents','userProfileId':_0x55152d[_0x2780('0x64')]},'raw':!![]})[_0x2780('0x2c')](function(_0xd1625d){if(_0xd1625d){if(_0xd1625d[_0x2780('0x65')]===0x0){return db[_0x2780('0x66')]['findAll']({'where':{'sectionId':_0xd1625d['id']},'raw':!![]})[_0x2780('0x2c')](function(_0x29389f){var _0x5d67d2=[];if(_['isEmpty'](_0x29389f)){_0x5d67d2=_[_0x2780('0x44')](_0x3c3332,function(_0x2fde95){if(_0x2fde95[_0x2780('0x5b')]!==_0x2780('0x59')){return _0x2fde95;}});return _0x5d67d2;}else{for(var _0x111aae=0x0;_0x111aae<_0x3c3332[_0x2780('0x3f')];_0x111aae++){var _0x2ef6d3=_0x3c3332[_0x111aae];if(_0x2ef6d3[_0x2780('0x5b')]===_0x2780('0x59')){var _0x33c4f5=_[_0x2780('0x4c')](_0x29389f,function(_0x135dbe){return _0x135dbe['resourceId']===_0x2ef6d3['id'];});if(_0x33c4f5)_0x5d67d2['push'](_0x2ef6d3);}else{_0x5d67d2[_0x2780('0x67')](_0x2ef6d3);}}return _0x5d67d2;}});}else{return _0x3c3332;}}else{var _0x3f5590=_['filter'](_0x3c3332,function(_0x35afa7){if(_0x35afa7[_0x2780('0x5b')]!==_0x2780('0x59')){return _0x35afa7;}});return _0x3f5590;}});}else{return _0x3c3332;}}})[_0x2780('0x2c')](function(_0x51b1a8){var _0x11a447=[];if(_0x51b1a8){_0x5e532c=_0x51b1a8;for(var _0x3a1fe1=0x0;_0x3a1fe1<_0x51b1a8[_0x2780('0x3f')];_0x3a1fe1+=0x1){_0x5e532c[_0x3a1fe1][_0x2780('0x52')]=[];_0x11a447[_0x2780('0x67')](db[_0x2780('0x34')][_0x2780('0x4c')]({'where':{'FromId':[_0x3bfbf7[_0x2780('0x62')]['id'],_0x51b1a8[_0x3a1fe1]['id']],'ToId':[_0x3bfbf7[_0x2780('0x62')]['id'],_0x51b1a8[_0x3a1fe1]['id']],'ChatGroupId':null},'attributes':['id',_0x2780('0x53'),_0x2780('0x68'),'ToId',_0x2780('0x69'),_0x2780('0x4e')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2780('0x2c')](wrapUser(_0x51b1a8[_0x3a1fe1])));}return BPromise[_0x2780('0x6a')](_0x11a447);}return[];})[_0x2780('0x2c')](function(_0xfe2457){return{'rows':_0xfe2457,'count':_0xfe2457[_0x2780('0x3f')]};})['then'](respondWithResult(_0x43ab78,null))[_0x2780('0x48')](handleError(_0x43ab78,null));}; \ No newline at end of file +var _0xc2be=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','includeAll','options','create','body','find','describe','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','role','userpic','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','createdAt','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x250362,_0x7d462f){var _0x48d6ec=function(_0x398ec1){while(--_0x398ec1){_0x250362['push'](_0x250362['shift']());}};_0x48d6ec(++_0x7d462f);}(_0xc2be,0xb6));var _0xec2b=function(_0x9add99,_0x3eda3b){_0x9add99=_0x9add99-0x0;var _0x482653=_0xc2be[_0x9add99];return _0x482653;};'use strict';var emlformat=require(_0xec2b('0x0'));var rimraf=require(_0xec2b('0x1'));var zipdir=require(_0xec2b('0x2'));var jsonpatch=require(_0xec2b('0x3'));var rp=require(_0xec2b('0x4'));var moment=require(_0xec2b('0x5'));var BPromise=require(_0xec2b('0x6'));var Mustache=require(_0xec2b('0x7'));var util=require(_0xec2b('0x8'));var path=require(_0xec2b('0x9'));var sox=require(_0xec2b('0xa'));var csv=require(_0xec2b('0xb'));var ejs=require(_0xec2b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec2b('0xd'));var squel=require('squel');var crypto=require(_0xec2b('0xe'));var jsforce=require(_0xec2b('0xf'));var deskjs=require(_0xec2b('0x10'));var toCsv=require(_0xec2b('0xb'));var querystring=require(_0xec2b('0x11'));var Papa=require(_0xec2b('0x12'));var Redis=require(_0xec2b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xec2b('0x14'));var as=require(_0xec2b('0x15'));var hardwareService=require(_0xec2b('0x16'));var logger=require(_0xec2b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xec2b('0x18'));var licenseUtil=require(_0xec2b('0x19'));var db=require('../../mysqldb')['db'];config[_0xec2b('0x1a')]=_[_0xec2b('0x1b')](config[_0xec2b('0x1a')],{'host':_0xec2b('0x1c'),'port':0x18eb});var socket=require(_0xec2b('0x1d'))(new Redis(config[_0xec2b('0x1a')]));require(_0xec2b('0x1e'))[_0xec2b('0x1f')](socket);function respondWithStatusCode(_0x156f35,_0x366fab){_0x366fab=_0x366fab||0xcc;return function(_0x350d10){if(_0x350d10){return _0x156f35[_0xec2b('0x20')](_0x366fab);}return _0x156f35[_0xec2b('0x21')](_0x366fab)[_0xec2b('0x22')]();};}function respondWithResult(_0x504468,_0x3eea8e){_0x3eea8e=_0x3eea8e||0xc8;return function(_0x5a0e2d){if(_0x5a0e2d){return _0x504468[_0xec2b('0x21')](_0x3eea8e)[_0xec2b('0x23')](_0x5a0e2d);}};}function respondWithFilteredResult(_0x2183f,_0x29fefc){return function(_0x343bf0){if(_0x343bf0){var _0x362ee6=typeof _0x29fefc['offset']===_0xec2b('0x24')&&typeof _0x29fefc[_0xec2b('0x25')]===_0xec2b('0x24');var _0x1befc3=_0x343bf0[_0xec2b('0x26')];var _0x8c93fa=_0x362ee6?0x0:_0x29fefc[_0xec2b('0x27')];var _0x1f7bd8=_0x362ee6?_0x343bf0[_0xec2b('0x26')]:_0x29fefc[_0xec2b('0x27')]+_0x29fefc['limit'];var _0x3cdafb;if(_0x1f7bd8>=_0x1befc3){_0x1f7bd8=_0x1befc3;_0x3cdafb=0xc8;}else{_0x3cdafb=0xce;}_0x2183f[_0xec2b('0x21')](_0x3cdafb);return _0x2183f['set'](_0xec2b('0x28'),_0x8c93fa+'-'+_0x1f7bd8+'/'+_0x1befc3)[_0xec2b('0x23')](_0x343bf0);}return null;};}function patchUpdates(_0x5519f9){return function(_0x40b9ff){try{jsonpatch[_0xec2b('0x29')](_0x40b9ff,_0x5519f9,!![]);}catch(_0x2620df){return BPromise[_0xec2b('0x2a')](_0x2620df);}return _0x40b9ff[_0xec2b('0x2b')]();};}function saveUpdates(_0xb823a3,_0x410b22){return function(_0x32b570){if(_0x32b570){return _0x32b570[_0xec2b('0x2c')](_0xb823a3)[_0xec2b('0x2d')](function(_0x3f5b80){return _0x3f5b80;});}return null;};}function removeEntity(_0x3ae6d4,_0x32fc82){return function(_0x5c060e){if(_0x5c060e){return _0x5c060e[_0xec2b('0x2e')]()[_0xec2b('0x2d')](function(){_0x3ae6d4[_0xec2b('0x21')](0xcc)[_0xec2b('0x22')]();});}};}function handleEntityNotFound(_0x5063f0,_0x51ab98){return function(_0x49d6ab){if(!_0x49d6ab){_0x5063f0[_0xec2b('0x20')](0x194);}return _0x49d6ab;};}function handleError(_0x8e04df,_0x5c603c){_0x5c603c=_0x5c603c||0x1f4;return function(_0x56da05){logger[_0xec2b('0x2f')](_0x56da05[_0xec2b('0x30')]);if(_0x56da05[_0xec2b('0x31')]){delete _0x56da05[_0xec2b('0x31')];}_0x8e04df[_0xec2b('0x21')](_0x5c603c)[_0xec2b('0x32')](_0x56da05);};}exports[_0xec2b('0x33')]=function(_0x4eb15d,_0x2595a8){var _0x355b18={},_0x5091bf={},_0x1e5e38={'count':0x0,'rows':[]};var _0x137e4a=_[_0xec2b('0x34')](db[_0xec2b('0x35')][_0xec2b('0x36')],function(_0x5919b0){return{'name':_0x5919b0['fieldName'],'type':_0x5919b0[_0xec2b('0x37')]['key']};});_0x5091bf[_0xec2b('0x38')]=_['map'](_0x137e4a,'name');_0x5091bf[_0xec2b('0x39')]=_[_0xec2b('0x3a')](_0x4eb15d[_0xec2b('0x39')]);_0x5091bf[_0xec2b('0x3b')]=_[_0xec2b('0x3c')](_0x5091bf[_0xec2b('0x38')],_0x5091bf[_0xec2b('0x39')]);_0x355b18[_0xec2b('0x3d')]=_['intersection'](_0x5091bf[_0xec2b('0x38')],qs[_0xec2b('0x3e')](_0x4eb15d[_0xec2b('0x39')][_0xec2b('0x3e')]));_0x355b18[_0xec2b('0x3d')]=_0x355b18[_0xec2b('0x3d')][_0xec2b('0x3f')]?_0x355b18['attributes']:_0x5091bf[_0xec2b('0x38')];if(!_0x4eb15d[_0xec2b('0x39')][_0xec2b('0x40')](_0xec2b('0x41'))){_0x355b18[_0xec2b('0x25')]=qs[_0xec2b('0x25')](_0x4eb15d[_0xec2b('0x39')][_0xec2b('0x25')]);_0x355b18['offset']=qs[_0xec2b('0x27')](_0x4eb15d[_0xec2b('0x39')]['offset']);}_0x355b18[_0xec2b('0x42')]=qs[_0xec2b('0x43')](_0x4eb15d[_0xec2b('0x39')]['sort']);_0x355b18[_0xec2b('0x44')]=qs['filters'](_[_0xec2b('0x45')](_0x4eb15d[_0xec2b('0x39')],_0x5091bf['filters']),_0x137e4a);if(_0x4eb15d['query']['filter']){_0x355b18['where']=_[_0xec2b('0x46')](_0x355b18['where'],{'$or':_['map'](_0x137e4a,function(_0x563d90){if(_0x563d90[_0xec2b('0x37')]!==_0xec2b('0x47')){var _0x3ef764={};_0x3ef764[_0x563d90[_0xec2b('0x31')]]={'$like':'%'+_0x4eb15d[_0xec2b('0x39')][_0xec2b('0x48')]+'%'};return _0x3ef764;}})});}_0x355b18=_[_0xec2b('0x46')]({},_0x355b18,_0x4eb15d['options']);var _0x4e65b4={'where':_0x355b18[_0xec2b('0x44')]};return db[_0xec2b('0x35')]['count'](_0x4e65b4)[_0xec2b('0x2d')](function(_0x5ef9c2){_0x1e5e38[_0xec2b('0x26')]=_0x5ef9c2;if(_0x4eb15d['query']['includeAll']){_0x355b18[_0xec2b('0x49')]=[{'all':!![]}];}return db[_0xec2b('0x35')][_0xec2b('0x4a')](_0x355b18);})[_0xec2b('0x2d')](function(_0x2fe3d9){_0x1e5e38[_0xec2b('0x4b')]=_0x2fe3d9;return _0x1e5e38;})[_0xec2b('0x2d')](respondWithFilteredResult(_0x2595a8,_0x355b18))[_0xec2b('0x4c')](handleError(_0x2595a8,null));};exports['show']=function(_0xa34953,_0x3679ff){var _0x195e3d={'raw':!![],'where':{'id':_0xa34953[_0xec2b('0x4d')]['id']}},_0x1b58a7={};_0x1b58a7['model']=_['keys'](db[_0xec2b('0x35')]['rawAttributes']);_0x1b58a7['query']=_[_0xec2b('0x3a')](_0xa34953[_0xec2b('0x39')]);_0x1b58a7[_0xec2b('0x3b')]=_[_0xec2b('0x3c')](_0x1b58a7[_0xec2b('0x38')],_0x1b58a7['query']);_0x195e3d[_0xec2b('0x3d')]=_[_0xec2b('0x3c')](_0x1b58a7[_0xec2b('0x38')],qs[_0xec2b('0x3e')](_0xa34953[_0xec2b('0x39')][_0xec2b('0x3e')]));_0x195e3d['attributes']=_0x195e3d[_0xec2b('0x3d')]['length']?_0x195e3d[_0xec2b('0x3d')]:_0x1b58a7[_0xec2b('0x38')];if(_0xa34953['query'][_0xec2b('0x4e')]){_0x195e3d[_0xec2b('0x49')]=[{'all':!![]}];}_0x195e3d=_[_0xec2b('0x46')]({},_0x195e3d,_0xa34953[_0xec2b('0x4f')]);return db[_0xec2b('0x35')]['find'](_0x195e3d)[_0xec2b('0x2d')](handleEntityNotFound(_0x3679ff,null))['then'](respondWithResult(_0x3679ff,null))[_0xec2b('0x4c')](handleError(_0x3679ff,null));};exports[_0xec2b('0x50')]=function(_0x5851e2,_0x18e109){return db[_0xec2b('0x35')][_0xec2b('0x50')](_0x5851e2[_0xec2b('0x51')],{})[_0xec2b('0x2d')](respondWithResult(_0x18e109,0xc9))[_0xec2b('0x4c')](handleError(_0x18e109,null));};exports['update']=function(_0x5ea7ed,_0x2804f){if(_0x5ea7ed[_0xec2b('0x51')]['id']){delete _0x5ea7ed[_0xec2b('0x51')]['id'];}return db[_0xec2b('0x35')]['find']({'where':{'id':_0x5ea7ed[_0xec2b('0x4d')]['id']}})[_0xec2b('0x2d')](handleEntityNotFound(_0x2804f,null))[_0xec2b('0x2d')](saveUpdates(_0x5ea7ed[_0xec2b('0x51')],null))[_0xec2b('0x2d')](respondWithResult(_0x2804f,null))[_0xec2b('0x4c')](handleError(_0x2804f,null));};exports[_0xec2b('0x2e')]=function(_0x3c6c52,_0x274ec8){return db['ChatInternalMessage'][_0xec2b('0x52')]({'where':{'id':_0x3c6c52['params']['id']}})[_0xec2b('0x2d')](handleEntityNotFound(_0x274ec8,null))[_0xec2b('0x2d')](removeEntity(_0x274ec8,null))['catch'](handleError(_0x274ec8,null));};exports[_0xec2b('0x53')]=function(_0x12f6be,_0x29d62c){return db[_0xec2b('0x35')][_0xec2b('0x53')]()[_0xec2b('0x2d')](respondWithResult(_0x29d62c,null))[_0xec2b('0x4c')](handleError(_0x29d62c,null));};function wrapUser(_0xd014ea){return function(_0x6c8ad0){var _0x167a3b=_0xd014ea['get']({'plain':!![]});_0x167a3b['messages']=[];if(_0x6c8ad0){_0x167a3b[_0xec2b('0x54')]=_0x6c8ad0['createdAt'];_0x167a3b[_0xec2b('0x55')]=_0x6c8ad0;}else{_0x167a3b[_0xec2b('0x54')]=moment(0x0)['format'](_0xec2b('0x56'));_0x167a3b[_0xec2b('0x55')]={};}return _0x167a3b;};}exports[_0xec2b('0x57')]=function(_0x3945bc,_0x5e4725,_0x7e8b73){var _0x33f99f=[];return db['User'][_0xec2b('0x4a')]({'where':{'role':[_0xec2b('0x58'),'admin',_0xec2b('0x59')]},'attributes':['id','fullname',_0xec2b('0x31'),_0xec2b('0x5a'),_0xec2b('0x5b'),'internal','online',_0xec2b('0x5c'),'allowmessenger',_0xec2b('0x5d')],'order':qs['sort'](_0xec2b('0x5e')),'include':[{'model':db[_0xec2b('0x5f')],'as':_0xec2b('0x60'),'attributes':['id',_0xec2b('0x31'),_0xec2b('0x37')],'through':{'attributes':[]}}]})[_0xec2b('0x2d')](function(_0x39799c){if(_0x39799c){var _0x39eccf=_0x3945bc[_0xec2b('0x59')]['get']({'plain':!![]});if(!_0x39eccf)throw new Error(_0xec2b('0x61'));if(_0x39eccf[_0xec2b('0x5a')]===_0xec2b('0x59')){return db[_0xec2b('0x62')]['find']({'where':{'name':'Agents','userProfileId':_0x39eccf[_0xec2b('0x63')]},'raw':!![]})[_0xec2b('0x2d')](function(_0x180cf6){if(_0x180cf6){if(_0x180cf6[_0xec2b('0x64')]===0x0){return db[_0xec2b('0x65')][_0xec2b('0x4a')]({'where':{'sectionId':_0x180cf6['id']},'raw':!![]})['then'](function(_0x5d65b8){var _0x38047c=[];if(_[_0xec2b('0x66')](_0x5d65b8)){_0x38047c=_[_0xec2b('0x48')](_0x39799c,function(_0x323677){if(_0x323677[_0xec2b('0x5a')]!==_0xec2b('0x58')){return _0x323677;}});return _0x38047c;}else{for(var _0x210417=0x0;_0x210417<_0x39799c[_0xec2b('0x3f')];_0x210417++){var _0x902919=_0x39799c[_0x210417];if(_0x902919['role']===_0xec2b('0x58')){var _0x87c7a2=_[_0xec2b('0x52')](_0x5d65b8,function(_0x322188){return _0x322188[_0xec2b('0x67')]===_0x902919['id'];});if(_0x87c7a2)_0x38047c['push'](_0x902919);}else{_0x38047c[_0xec2b('0x68')](_0x902919);}}return _0x38047c;}});}else{return _0x39799c;}}else{var _0x13c33e=_[_0xec2b('0x48')](_0x39799c,function(_0x22f544){if(_0x22f544['role']!==_0xec2b('0x58')){return _0x22f544;}});return _0x13c33e;}});}else{return _0x39799c;}}})[_0xec2b('0x2d')](function(_0x3233fc){var _0x1792d2=[];if(_0x3233fc){_0x33f99f=_0x3233fc;for(var _0x37f332=0x0;_0x37f332<_0x3233fc[_0xec2b('0x3f')];_0x37f332+=0x1){_0x33f99f[_0x37f332][_0xec2b('0x69')]=[];_0x1792d2['push'](db['ChatInternalMessage'][_0xec2b('0x52')]({'where':{'FromId':[_0x3945bc['user']['id'],_0x3233fc[_0x37f332]['id']],'ToId':[_0x3945bc[_0xec2b('0x59')]['id'],_0x3233fc[_0x37f332]['id']],'ChatGroupId':null},'attributes':['id',_0xec2b('0x6a'),_0xec2b('0x6b'),_0xec2b('0x6c'),'read',_0xec2b('0x51')],'order':qs[_0xec2b('0x43')](_0xec2b('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xec2b('0x2d')](wrapUser(_0x3233fc[_0x37f332])));}return BPromise[_0xec2b('0x6e')](_0x1792d2);}return[];})[_0xec2b('0x2d')](function(_0x52f1b4){return{'rows':_0x52f1b4,'count':_0x52f1b4[_0xec2b('0x3f')]};})['then'](respondWithResult(_0x5e4725,null))[_0xec2b('0x4c')](handleError(_0x5e4725,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0cd41cb..9114446 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 _0xf29c=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x4b0df5,_0x5cfeb5){var _0x144800=function(_0x3ece1e){while(--_0x3ece1e){_0x4b0df5['push'](_0x4b0df5['shift']());}};_0x144800(++_0x5cfeb5);}(_0xf29c,0xf1));var _0xcf29=function(_0x4b610d,_0x2475c0){_0x4b610d=_0x4b610d-0x0;var _0x6a1af9=_0xf29c[_0x4b610d];return _0x6a1af9;};'use strict';var EventEmitter=require(_0xcf29('0x0'));var ChatInternalMessage=require(_0xcf29('0x1'))['db'][_0xcf29('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcf29('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9c1f0e){return function(_0x502c15,_0x429d32,_0x2d7eea){ChatInternalMessageEvents['emit'](_0x9c1f0e+':'+_0x502c15['id'],_0x502c15);ChatInternalMessageEvents[_0xcf29('0x4')](_0x9c1f0e,_0x502c15);_0x2d7eea(null);};}for(var e in events){if(events[_0xcf29('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcf29('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xefe8=['ChatInternalMessage','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x1f470a,_0x36c10e){var _0x39c13d=function(_0x27592c){while(--_0x27592c){_0x1f470a['push'](_0x1f470a['shift']());}};_0x39c13d(++_0x36c10e);}(_0xefe8,0xc3));var _0x8efe=function(_0x1519ec,_0x26ab64){_0x1519ec=_0x1519ec-0x0;var _0x4ebabc=_0xefe8[_0x1519ec];return _0x4ebabc;};'use strict';var EventEmitter=require(_0x8efe('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x8efe('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8efe('0x2'),'afterDestroy':_0x8efe('0x3')};function emitEvent(_0xa8175e){return function(_0xc4b454,_0x3de15f,_0x3c1c5f){ChatInternalMessageEvents['emit'](_0xa8175e+':'+_0xc4b454['id'],_0xc4b454);ChatInternalMessageEvents['emit'](_0xa8175e,_0xc4b454);_0x3c1c5f(null);};}for(var e in events){if(events[_0x8efe('0x4')](e)){var event=events[e];ChatInternalMessage[_0x8efe('0x5')](e,emitEvent(event));}}module[_0x8efe('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3617fa0..f4629c3 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 _0xbca2=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xbca2,0x1d1));var _0x2bca=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbca2[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x2bca('0x0'));var util=require(_0x2bca('0x1'));var logger=require(_0x2bca('0x2'))(_0x2bca('0x3'));var moment=require(_0x2bca('0x4'));var BPromise=require(_0x2bca('0x5'));var rp=require(_0x2bca('0x6'));var fs=require('fs');var path=require(_0x2bca('0x7'));var rimraf=require('rimraf');var config=require(_0x2bca('0x8'));var attributes=require(_0x2bca('0x9'));module[_0x2bca('0xa')]=function(_0x5075aa,_0x43221a){return _0x5075aa['define'](_0x2bca('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2bca('0xc'),'collate':_0x2bca('0xd')});}; \ No newline at end of file +var _0x4220=['bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x4220,0x1f3));var _0x0422=function(_0x2bfd0f,_0x1f57a0){_0x2bfd0f=_0x2bfd0f-0x0;var _0x335be7=_0x4220[_0x2bfd0f];return _0x335be7;};'use strict';var _=require(_0x0422('0x0'));var util=require(_0x0422('0x1'));var logger=require(_0x0422('0x2'))(_0x0422('0x3'));var moment=require(_0x0422('0x4'));var BPromise=require(_0x0422('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0422('0x6'));var rimraf=require(_0x0422('0x7'));var config=require(_0x0422('0x8'));var attributes=require(_0x0422('0x9'));module[_0x0422('0xa')]=function(_0x2db4c5,_0x1494eb){return _0x2db4c5[_0x0422('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x0422('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0422('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4e15aff..6537a7d 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 _0xe3c5=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0xe3c5[_0x3b81eb];return _0x149491;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var moment=require(_0x5e3c('0x2'));var BPromise=require(_0x5e3c('0x3'));var rs=require(_0x5e3c('0x4'));var fs=require('fs');var Redis=require(_0x5e3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e3c('0x6'));var logger=require(_0x5e3c('0x7'))(_0x5e3c('0x8'));var config=require(_0x5e3c('0x9'));var jayson=require(_0x5e3c('0xa'));var client=jayson[_0x5e3c('0xb')][_0x5e3c('0xc')]({'port':0x232a});config[_0x5e3c('0xd')]=_[_0x5e3c('0xe')](config[_0x5e3c('0xd')],{'host':_0x5e3c('0xf'),'port':0x18eb});var socket=require(_0x5e3c('0x10'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5e3c('0x11')](socket);function respondWithRpcPromise(_0x125a7c,_0x1835d9,_0x167eee){return new BPromise(function(_0x3ffc9,_0x54ce39){return client[_0x5e3c('0x12')](_0x125a7c,_0x167eee)[_0x5e3c('0x13')](function(_0x5e110b){logger[_0x5e3c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,'request\x20sent');logger[_0x5e3c('0x15')](_0x5e3c('0x16'),_0x1835d9,_0x5e3c('0x17'),JSON[_0x5e3c('0x18')](_0x5e110b));if(_0x5e110b[_0x5e3c('0x19')]){if(_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1a')]===0x1f4){logger[_0x5e3c('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x5e110b['error'][_0x5e3c('0x1b')]);return _0x54ce39(_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1b')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1b')]);return _0x3ffc9(_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1b')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x5e3c('0x17'));_0x3ffc9(_0x5e110b['result']['message']);}})[_0x5e3c('0x1c')](function(_0x551ccb){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x551ccb);_0x54ce39(_0x551ccb);});});} \ No newline at end of file +var _0x4983=['socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x2867a6,_0x10d905){var _0x4afc2b=function(_0x457840){while(--_0x457840){_0x2867a6['push'](_0x2867a6['shift']());}};_0x4afc2b(++_0x10d905);}(_0x4983,0x1a4));var _0x3498=function(_0x33a866,_0x44787f){_0x33a866=_0x33a866-0x0;var _0x1a6039=_0x4983[_0x33a866];return _0x1a6039;};'use strict';var _=require(_0x3498('0x0'));var util=require('util');var moment=require(_0x3498('0x1'));var BPromise=require(_0x3498('0x2'));var rs=require(_0x3498('0x3'));var fs=require('fs');var Redis=require(_0x3498('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3498('0x5'));var config=require(_0x3498('0x6'));var jayson=require(_0x3498('0x7'));var client=jayson[_0x3498('0x8')]['http']({'port':0x232a});config[_0x3498('0x9')]=_[_0x3498('0xa')](config[_0x3498('0x9')],{'host':_0x3498('0xb'),'port':0x18eb});var socket=require(_0x3498('0xc'))(new Redis(config[_0x3498('0x9')]));require(_0x3498('0xd'))[_0x3498('0xe')](socket);function respondWithRpcPromise(_0x5037a1,_0x427e0f,_0xc2aede){return new BPromise(function(_0x59c879,_0x56f966){return client[_0x3498('0xf')](_0x5037a1,_0xc2aede)[_0x3498('0x10')](function(_0x3e561f){logger[_0x3498('0x11')](_0x3498('0x12'),_0x427e0f,_0x3498('0x13'));logger[_0x3498('0x14')](_0x3498('0x15'),_0x427e0f,'request\x20sent',JSON['stringify'](_0x3e561f));if(_0x3e561f['error']){if(_0x3e561f[_0x3498('0x16')][_0x3498('0x17')]===0x1f4){logger[_0x3498('0x16')](_0x3498('0x12'),_0x427e0f,_0x3e561f['error'][_0x3498('0x18')]);return _0x56f966(_0x3e561f[_0x3498('0x16')][_0x3498('0x18')]);}logger[_0x3498('0x16')](_0x3498('0x12'),_0x427e0f,_0x3e561f[_0x3498('0x16')][_0x3498('0x18')]);return _0x59c879(_0x3e561f[_0x3498('0x16')][_0x3498('0x18')]);}else{logger[_0x3498('0x11')](_0x3498('0x12'),_0x427e0f,_0x3498('0x13'));_0x59c879(_0x3e561f[_0x3498('0x19')][_0x3498('0x18')]);}})[_0x3498('0x1a')](function(_0x43d403){logger[_0x3498('0x16')](_0x3498('0x12'),_0x427e0f,_0x43d403);_0x56f966(_0x43d403);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b621ad3..ac7d882 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 _0x8a16=['emit','removeListener','register','length','chatInternalMessage:','save','remove','update'];(function(_0x25d3a0,_0x43b3a0){var _0x1ead08=function(_0xa825fb){while(--_0xa825fb){_0x25d3a0['push'](_0x25d3a0['shift']());}};_0x1ead08(++_0x43b3a0);}(_0x8a16,0xcd));var _0x68a1=function(_0x24d622,_0x35a1e4){_0x24d622=_0x24d622-0x0;var _0xa6d6dc=_0x8a16[_0x24d622];return _0xa6d6dc;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x68a1('0x0'),_0x68a1('0x1'),_0x68a1('0x2')];function createListener(_0x257503,_0x38a562){return function(_0x3a3642){_0x38a562[_0x68a1('0x3')](_0x257503,_0x3a3642);};}function removeListener(_0x13f2f0,_0x5a9c27){return function(){ChatInternalMessageEvents[_0x68a1('0x4')](_0x13f2f0,_0x5a9c27);};}exports[_0x68a1('0x5')]=function(_0x36ecfa){for(var _0x15b001=0x0,_0x4ef4b7=events[_0x68a1('0x6')];_0x15b001<_0x4ef4b7;_0x15b001++){var _0x1ee037=events[_0x15b001];var _0x5251f4=createListener(_0x68a1('0x7')+_0x1ee037,_0x36ecfa);ChatInternalMessageEvents['on'](_0x1ee037,_0x5251f4);}}; \ No newline at end of file +var _0x9bed=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x9bed,0x95));var _0xd9be=function(_0x395d2d,_0x5a73bd){_0x395d2d=_0x395d2d-0x0;var _0x47a846=_0x9bed[_0x395d2d];return _0x47a846;};'use strict';var ChatInternalMessageEvents=require(_0xd9be('0x0'));var events=[_0xd9be('0x1'),_0xd9be('0x2'),'update'];function createListener(_0x53defc,_0x474f6b){return function(_0x1b42fa){_0x474f6b[_0xd9be('0x3')](_0x53defc,_0x1b42fa);};}function removeListener(_0x3f6e87,_0x2ddf80){return function(){ChatInternalMessageEvents[_0xd9be('0x4')](_0x3f6e87,_0x2ddf80);};}exports[_0xd9be('0x5')]=function(_0x3bf47d){for(var _0x52fd79=0x0,_0x1bc773=events[_0xd9be('0x6')];_0x52fd79<_0x1bc773;_0x52fd79++){var _0x4f6b03=events[_0x52fd79];var _0x2fe782=createListener(_0xd9be('0x7')+_0x4f6b03,_0x3bf47d);ChatInternalMessageEvents['on'](_0x4f6b03,_0x2fe782);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 38aa915..021caf5 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 _0x05a1=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','describe','getUsers','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x05a1,0x72));var _0x105a=function(_0x190a12,_0x28e9e8){_0x190a12=_0x190a12-0x0;var _0x371e5f=_0x05a1[_0x190a12];return _0x371e5f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x105a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x105a('0x1')]();var fs_extra=require(_0x105a('0x2'));var auth=require(_0x105a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x105a('0x4'));var controller=require(_0x105a('0x5'));router['get']('/',auth[_0x105a('0x6')](),controller[_0x105a('0x7')]);router[_0x105a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x105a('0x9')]);router[_0x105a('0x8')]('/users',auth[_0x105a('0x6')](),controller[_0x105a('0xa')]);router[_0x105a('0x8')](_0x105a('0xb'),auth[_0x105a('0x6')](),controller[_0x105a('0xc')]);router[_0x105a('0xd')]('/',auth[_0x105a('0x6')](),controller[_0x105a('0xe')]);router[_0x105a('0xf')](_0x105a('0xb'),controller['update']);router[_0x105a('0x10')]('/:id',auth[_0x105a('0x6')](),controller[_0x105a('0x11')]);module[_0x105a('0x12')]=router; \ No newline at end of file +var _0x31c3=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','getUsers','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31c3,0x79));var _0x331c=function(_0x131c3e,_0x131a66){_0x131c3e=_0x131c3e-0x0;var _0x1cf7a6=_0x31c3[_0x131c3e];return _0x1cf7a6;};'use strict';var multer=require(_0x331c('0x0'));var util=require(_0x331c('0x1'));var path=require(_0x331c('0x2'));var timeout=require(_0x331c('0x3'));var express=require(_0x331c('0x4'));var router=express[_0x331c('0x5')]();var fs_extra=require(_0x331c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x331c('0x7'));var config=require(_0x331c('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x331c('0x9')]('/',auth[_0x331c('0xa')](),controller[_0x331c('0xb')]);router[_0x331c('0x9')]('/describe',auth[_0x331c('0xa')](),controller[_0x331c('0xc')]);router[_0x331c('0x9')](_0x331c('0xd'),auth[_0x331c('0xa')](),controller[_0x331c('0xe')]);router[_0x331c('0x9')](_0x331c('0xf'),auth[_0x331c('0xa')](),controller[_0x331c('0x10')]);router[_0x331c('0x11')]('/',auth[_0x331c('0xa')](),controller[_0x331c('0x12')]);router[_0x331c('0x13')](_0x331c('0xf'),controller[_0x331c('0x14')]);router[_0x331c('0x15')](_0x331c('0xf'),auth['isAuthenticated'](),controller[_0x331c('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2a62a71..9807cb0 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 _0x1b0e=['TEXT','medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x1b0e,0x132));var _0xe1b0=function(_0x33d20a,_0x10edaf){_0x33d20a=_0x33d20a-0x0;var _0x30a111=_0x1b0e[_0x33d20a];return _0x30a111;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'body':{'type':Sequelize[_0xe1b0('0x2')](_0xe1b0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe1b0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe1b0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe1b0('0x2')]}}; \ No newline at end of file +var _0x7d13=['out','DATE','TEXT','exports','medium','BOOLEAN','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d13,0x6c));var _0x37d1=function(_0x4ff2a7,_0x46fbd1){_0x4ff2a7=_0x4ff2a7-0x0;var _0x562f6e=_0x7d13[_0x4ff2a7];return _0x562f6e;};'use strict';var Sequelize=require('sequelize');module[_0x37d1('0x0')]={'body':{'type':Sequelize['TEXT'](_0x37d1('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x37d1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x37d1('0x3')]('in',_0x37d1('0x4')),'defaultValue':_0x37d1('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x37d1('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x37d1('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a4f26a8..6a1c368 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 _0xa1d2=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','SIP/%s','motionChannel','channel','EventManager','acceptmessage','parse','formData','ChatInteraction','ChatInteractionId','interaction','null','RejectMessage','rejectMessage','contact','fullname','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','end','stack','send','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','nolimit','sort','filters','filter','where','name','options','includeAll','include','findAll','rows','show','length','merge','find','create','body','update','params','describe','../../config/logger','chat-interactions','accept','chat','format','UserId','user','agent','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role'];(function(_0x3b1a5f,_0x33bea2){var _0x1c0b45=function(_0x318ed6){while(--_0x318ed6){_0x3b1a5f['push'](_0x3b1a5f['shift']());}};_0x1c0b45(++_0x33bea2);}(_0xa1d2,0x1a5));var _0x2a1d=function(_0x217c62,_0x515d22){_0x217c62=_0x217c62-0x0;var _0x2809c0=_0xa1d2[_0x217c62];return _0x2809c0;};'use strict';var emlformat=require(_0x2a1d('0x0'));var rimraf=require(_0x2a1d('0x1'));var zipdir=require(_0x2a1d('0x2'));var jsonpatch=require(_0x2a1d('0x3'));var rp=require('request-promise');var moment=require(_0x2a1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2a1d('0x5'));var util=require(_0x2a1d('0x6'));var path=require(_0x2a1d('0x7'));var sox=require(_0x2a1d('0x8'));var csv=require(_0x2a1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a1d('0xa'));var _=require(_0x2a1d('0xb'));var squel=require(_0x2a1d('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a1d('0xd'));var deskjs=require(_0x2a1d('0xe'));var toCsv=require(_0x2a1d('0x9'));var querystring=require(_0x2a1d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2a1d('0x10'));var qs=require(_0x2a1d('0x11'));var as=require(_0x2a1d('0x12'));var hardwareService=require(_0x2a1d('0x13'));var logger=require('../../config/logger')(_0x2a1d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2a1d('0x15'));var db=require(_0x2a1d('0x16'))['db'];config[_0x2a1d('0x17')]=_[_0x2a1d('0x18')](config[_0x2a1d('0x17')],{'host':_0x2a1d('0x19'),'port':0x18eb});var socket=require(_0x2a1d('0x1a'))(new Redis(config[_0x2a1d('0x17')]));require(_0x2a1d('0x1b'))[_0x2a1d('0x1c')](socket);var jayson=require(_0x2a1d('0x1d'));var client=jayson[_0x2a1d('0x1e')][_0x2a1d('0x1f')]({'port':0x232c});var client9002=jayson[_0x2a1d('0x1e')][_0x2a1d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x49df67,_0x318289,_0x32fa6e,_0x42814b){return new BPromise(function(_0x1d27ff,_0x6b56e4){var _0x329508=_0x42814b||client;return _0x329508['request'](_0x49df67,_0x32fa6e)[_0x2a1d('0x20')](function(_0x2faf57){logger[_0x2a1d('0x21')](_0x2a1d('0x22'),_0x318289,_0x2a1d('0x23'));logger[_0x2a1d('0x24')](_0x2a1d('0x25'),_0x318289,_0x2a1d('0x23'),JSON[_0x2a1d('0x26')](_0x2faf57));if(_0x2faf57[_0x2a1d('0x27')]){if(_0x2faf57[_0x2a1d('0x27')][_0x2a1d('0x28')]===0x1f4){logger[_0x2a1d('0x27')](_0x2a1d('0x22'),_0x318289,_0x2faf57[_0x2a1d('0x27')][_0x2a1d('0x29')]);return _0x6b56e4(_0x2faf57[_0x2a1d('0x27')]['message']);}logger[_0x2a1d('0x27')](_0x2a1d('0x22'),_0x318289,_0x2faf57['error'][_0x2a1d('0x29')]);return _0x1d27ff(_0x2faf57[_0x2a1d('0x27')][_0x2a1d('0x29')]);}else{logger[_0x2a1d('0x21')](_0x2a1d('0x22'),_0x318289,'request\x20sent');_0x1d27ff(_0x2faf57[_0x2a1d('0x2a')][_0x2a1d('0x29')]);}})[_0x2a1d('0x2b')](function(_0x160662){logger['error']('ChatMessage,\x20%s,\x20%s',_0x318289,_0x160662);_0x6b56e4(_0x160662);});});}function respondWithStatusCode(_0x547892,_0x5d7c91){_0x5d7c91=_0x5d7c91||0xcc;return function(_0x1bf435){if(_0x1bf435){return _0x547892[_0x2a1d('0x2c')](_0x5d7c91);}return _0x547892[_0x2a1d('0x2d')](_0x5d7c91)['end']();};}function respondWithResult(_0xb60508,_0x580495){_0x580495=_0x580495||0xc8;return function(_0x4b9673){if(_0x4b9673){return _0xb60508[_0x2a1d('0x2d')](_0x580495)['json'](_0x4b9673);}};}function respondWithFilteredResult(_0x3897ec,_0x1de8c1){return function(_0x47ee15){if(_0x47ee15){var _0x1f8836=typeof _0x1de8c1[_0x2a1d('0x2e')]===_0x2a1d('0x2f')&&typeof _0x1de8c1[_0x2a1d('0x30')]===_0x2a1d('0x2f');var _0xd92d51=_0x47ee15[_0x2a1d('0x31')];var _0x2b4c3a=_0x1f8836?0x0:_0x1de8c1[_0x2a1d('0x2e')];var _0x3c72ea=_0x1f8836?_0x47ee15[_0x2a1d('0x31')]:_0x1de8c1[_0x2a1d('0x2e')]+_0x1de8c1[_0x2a1d('0x30')];var _0x538688;if(_0x3c72ea>=_0xd92d51){_0x3c72ea=_0xd92d51;_0x538688=0xc8;}else{_0x538688=0xce;}_0x3897ec[_0x2a1d('0x2d')](_0x538688);return _0x3897ec['set'](_0x2a1d('0x32'),_0x2b4c3a+'-'+_0x3c72ea+'/'+_0xd92d51)['json'](_0x47ee15);}return null;};}function patchUpdates(_0x2b9fe2){return function(_0x510e8a){try{jsonpatch[_0x2a1d('0x33')](_0x510e8a,_0x2b9fe2,!![]);}catch(_0x48d985){return BPromise[_0x2a1d('0x34')](_0x48d985);}return _0x510e8a[_0x2a1d('0x35')]();};}function saveUpdates(_0x4ce8d6,_0x2b2a67){return function(_0x38659e){if(_0x38659e){return _0x38659e['update'](_0x4ce8d6)['then'](function(_0x11995c){return _0x11995c;});}return null;};}function removeEntity(_0x152294,_0x4c5690){return function(_0x2413c1){if(_0x2413c1){return _0x2413c1[_0x2a1d('0x36')]()[_0x2a1d('0x20')](function(){_0x152294[_0x2a1d('0x2d')](0xcc)[_0x2a1d('0x37')]();});}};}function handleEntityNotFound(_0x12f6bf,_0x45c586){return function(_0x4adb1a){if(!_0x4adb1a){_0x12f6bf[_0x2a1d('0x2c')](0x194);}return _0x4adb1a;};}function handleError(_0xd5d96c,_0x836dfd){_0x836dfd=_0x836dfd||0x1f4;return function(_0x26c309){logger[_0x2a1d('0x27')](_0x26c309[_0x2a1d('0x38')]);if(_0x26c309['name']){delete _0x26c309['name'];}_0xd5d96c['status'](_0x836dfd)[_0x2a1d('0x39')](_0x26c309);};}exports[_0x2a1d('0x3a')]=function(_0x2587bd,_0xfc28c8){var _0x2879e7={},_0xd35855={},_0x417c61={'count':0x0,'rows':[]};var _0x5d6d5d=_['map'](db[_0x2a1d('0x3b')][_0x2a1d('0x3c')],function(_0x36fb69){return{'name':_0x36fb69[_0x2a1d('0x3d')],'type':_0x36fb69[_0x2a1d('0x3e')][_0x2a1d('0x3f')]};});_0xd35855[_0x2a1d('0x40')]=_[_0x2a1d('0x41')](_0x5d6d5d,'name');_0xd35855[_0x2a1d('0x42')]=_[_0x2a1d('0x43')](_0x2587bd[_0x2a1d('0x42')]);_0xd35855['filters']=_['intersection'](_0xd35855[_0x2a1d('0x40')],_0xd35855[_0x2a1d('0x42')]);_0x2879e7[_0x2a1d('0x44')]=_[_0x2a1d('0x45')](_0xd35855[_0x2a1d('0x40')],qs['fields'](_0x2587bd['query'][_0x2a1d('0x46')]));_0x2879e7['attributes']=_0x2879e7[_0x2a1d('0x44')]['length']?_0x2879e7[_0x2a1d('0x44')]:_0xd35855[_0x2a1d('0x40')];if(!_0x2587bd['query']['hasOwnProperty'](_0x2a1d('0x47'))){_0x2879e7[_0x2a1d('0x30')]=qs[_0x2a1d('0x30')](_0x2587bd[_0x2a1d('0x42')][_0x2a1d('0x30')]);_0x2879e7[_0x2a1d('0x2e')]=qs[_0x2a1d('0x2e')](_0x2587bd[_0x2a1d('0x42')][_0x2a1d('0x2e')]);}_0x2879e7['order']=qs[_0x2a1d('0x48')](_0x2587bd['query']['sort']);_0x2879e7['where']=qs[_0x2a1d('0x49')](_['pick'](_0x2587bd['query'],_0xd35855[_0x2a1d('0x49')]),_0x5d6d5d);if(_0x2587bd['query'][_0x2a1d('0x4a')]){_0x2879e7[_0x2a1d('0x4b')]=_['merge'](_0x2879e7[_0x2a1d('0x4b')],{'$or':_['map'](_0x5d6d5d,function(_0x3fb860){if(_0x3fb860[_0x2a1d('0x3e')]!=='VIRTUAL'){var _0xb35d7d={};_0xb35d7d[_0x3fb860[_0x2a1d('0x4c')]]={'$like':'%'+_0x2587bd[_0x2a1d('0x42')][_0x2a1d('0x4a')]+'%'};return _0xb35d7d;}})});}_0x2879e7=_['merge']({},_0x2879e7,_0x2587bd[_0x2a1d('0x4d')]);var _0x1c4f58={'where':_0x2879e7[_0x2a1d('0x4b')]};return db[_0x2a1d('0x3b')][_0x2a1d('0x31')](_0x1c4f58)['then'](function(_0x595306){_0x417c61[_0x2a1d('0x31')]=_0x595306;if(_0x2587bd[_0x2a1d('0x42')][_0x2a1d('0x4e')]){_0x2879e7[_0x2a1d('0x4f')]=[{'all':!![]}];}return db[_0x2a1d('0x3b')][_0x2a1d('0x50')](_0x2879e7);})['then'](function(_0x440b2a){_0x417c61[_0x2a1d('0x51')]=_0x440b2a;return _0x417c61;})[_0x2a1d('0x20')](respondWithFilteredResult(_0xfc28c8,_0x2879e7))[_0x2a1d('0x2b')](handleError(_0xfc28c8,null));};exports[_0x2a1d('0x52')]=function(_0x31e2c4,_0x238b5a){var _0x1b08f0={'raw':!![],'where':{'id':_0x31e2c4['params']['id']}},_0xa653bc={};_0xa653bc['model']=_['keys'](db[_0x2a1d('0x3b')][_0x2a1d('0x3c')]);_0xa653bc[_0x2a1d('0x42')]=_[_0x2a1d('0x43')](_0x31e2c4[_0x2a1d('0x42')]);_0xa653bc[_0x2a1d('0x49')]=_[_0x2a1d('0x45')](_0xa653bc[_0x2a1d('0x40')],_0xa653bc['query']);_0x1b08f0['attributes']=_[_0x2a1d('0x45')](_0xa653bc[_0x2a1d('0x40')],qs['fields'](_0x31e2c4[_0x2a1d('0x42')][_0x2a1d('0x46')]));_0x1b08f0[_0x2a1d('0x44')]=_0x1b08f0[_0x2a1d('0x44')][_0x2a1d('0x53')]?_0x1b08f0[_0x2a1d('0x44')]:_0xa653bc[_0x2a1d('0x40')];if(_0x31e2c4[_0x2a1d('0x42')][_0x2a1d('0x4e')]){_0x1b08f0[_0x2a1d('0x4f')]=[{'all':!![]}];}_0x1b08f0=_[_0x2a1d('0x54')]({},_0x1b08f0,_0x31e2c4[_0x2a1d('0x4d')]);return db[_0x2a1d('0x3b')][_0x2a1d('0x55')](_0x1b08f0)[_0x2a1d('0x20')](handleEntityNotFound(_0x238b5a,null))[_0x2a1d('0x20')](respondWithResult(_0x238b5a,null))[_0x2a1d('0x2b')](handleError(_0x238b5a,null));};exports[_0x2a1d('0x56')]=function(_0x29da5d,_0x3b93c5){return db[_0x2a1d('0x3b')][_0x2a1d('0x56')](_0x29da5d[_0x2a1d('0x57')],{})[_0x2a1d('0x20')](respondWithResult(_0x3b93c5,0xc9))[_0x2a1d('0x2b')](handleError(_0x3b93c5,null));};exports[_0x2a1d('0x58')]=function(_0x4eba7d,_0x501557){if(_0x4eba7d[_0x2a1d('0x57')]['id']){delete _0x4eba7d['body']['id'];}return db['ChatMessage'][_0x2a1d('0x55')]({'where':{'id':_0x4eba7d[_0x2a1d('0x59')]['id']}})['then'](handleEntityNotFound(_0x501557,null))[_0x2a1d('0x20')](saveUpdates(_0x4eba7d[_0x2a1d('0x57')],null))[_0x2a1d('0x20')](respondWithResult(_0x501557,null))['catch'](handleError(_0x501557,null));};exports[_0x2a1d('0x36')]=function(_0x5f423b,_0x3c4322){return db[_0x2a1d('0x3b')]['find']({'where':{'id':_0x5f423b['params']['id']}})[_0x2a1d('0x20')](handleEntityNotFound(_0x3c4322,null))[_0x2a1d('0x20')](removeEntity(_0x3c4322,null))[_0x2a1d('0x2b')](handleError(_0x3c4322,null));};exports['describe']=function(_0xbf305a,_0x5d339d){return db[_0x2a1d('0x3b')][_0x2a1d('0x5a')]()[_0x2a1d('0x20')](respondWithResult(_0x5d339d,null))[_0x2a1d('0x2b')](handleError(_0x5d339d,null));};var interaction_log=require(_0x2a1d('0x5b'))(_0x2a1d('0x5c'));exports[_0x2a1d('0x5d')]=function(_0x2a731a,_0x5e86b1,_0x2da8c5){var _0x204d10={'agent':{},'channel':_0x2a1d('0x5e')};if(_0x2a731a[_0x2a1d('0x57')]['id']){delete _0x2a731a[_0x2a1d('0x57')]['id'];}_0x2a731a[_0x2a1d('0x57')]['read']=!![];_0x2a731a['body']['readAt']=moment()[_0x2a1d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a731a[_0x2a1d('0x57')][_0x2a1d('0x60')]=_0x2a731a[_0x2a1d('0x57')][_0x2a1d('0x60')]||_0x2a731a[_0x2a1d('0x61')]['id'];_0x204d10[_0x2a1d('0x62')]['id']=_0x2a731a[_0x2a1d('0x57')]['UserId'];return db[_0x2a1d('0x3b')][_0x2a1d('0x55')]({'where':{'id':_0x2a731a[_0x2a1d('0x59')]['id'],'UserId':null}})[_0x2a1d('0x20')](handleEntityNotFound(_0x5e86b1,null))[_0x2a1d('0x20')](saveUpdates(_0x2a731a[_0x2a1d('0x57')],null))['then'](function(_0x55e727){if(_0x55e727){_0x204d10[_0x2a1d('0x29')]=_0x55e727[_0x2a1d('0x63')]({'plain':!![]});return db['ChatInteraction'][_0x2a1d('0x55')]({'where':{'id':_0x55e727['ChatInteractionId']}});}return null;})[_0x2a1d('0x20')](handleEntityNotFound(_0x5e86b1,null))['then'](function(_0x435511){if(_0x435511){return _0x435511['update']({'UserId':_0x2a731a[_0x2a1d('0x57')]['UserId'],'read1stAt':_['isNil'](_0x435511[_0x2a1d('0x64')])?moment()['format'](_0x2a1d('0x65')):undefined});}return null;})[_0x2a1d('0x20')](function(_0xb91ff3){if(_0xb91ff3){_0x204d10['interaction']=_0xb91ff3['get']({'plain':!![]});interaction_log[_0x2a1d('0x21')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a731a[_0x2a1d('0x61')]['id'],_0x2a731a[_0x2a1d('0x61')]['name'],_0x2a731a[_0x2a1d('0x61')][_0x2a1d('0x66')],_0x204d10['interaction']['id'],_0x2a731a[_0x2a1d('0x57')]?JSON[_0x2a1d('0x26')](_0x2a731a['body']):'null');return respondWithRpcPromise(_0x2a1d('0x67'),'acceptMessage',_0x204d10);}return null;})[_0x2a1d('0x20')](function(_0x208568){var _0x176c99=_0x2a1d('0x68')+_0x208568[_0x2a1d('0x29')][_0x2a1d('0x69')];return db[_0x2a1d('0x6a')][_0x2a1d('0x42')](_0x176c99,{'type':db[_0x2a1d('0x6b')][_0x2a1d('0x6c')][_0x2a1d('0x6d')],'raw':!![]})['then'](function(_0x1ffe0a){return _0x1ffe0a;});})['then'](function(_0x14758e){if(_0x14758e){_0x204d10[_0x2a1d('0x29')]['contact']=_0x14758e[0x0];if(!_0x2a731a[_0x2a1d('0x57')]['UserId'])return;return db[_0x2a1d('0x6e')][_0x2a1d('0x55')]({'where':{'id':_0x2a731a[_0x2a1d('0x57')][_0x2a1d('0x60')],'role':_0x2a1d('0x62')},'attributes':['id',_0x2a1d('0x4c'),'fullname',_0x2a1d('0x6f'),_0x2a1d('0x70')],'raw':!![]});}return null;})[_0x2a1d('0x20')](function(_0x59652c){if(!_0x59652c)return null;_0x204d10[_0x2a1d('0x29')][_0x2a1d('0x62')]=_0x59652c;return _0x204d10;})['then'](function(_0x3e10ec){if(_0x3e10ec){if(_0x2a731a[_0x2a1d('0x57')][_0x2a1d('0x71')]){_0x204d10[_0x2a1d('0x29')]['interface']=util[_0x2a1d('0x5f')](_0x2a1d('0x72'),_0x2a731a[_0x2a1d('0x61')][_0x2a1d('0x4c')]);_0x204d10[_0x2a1d('0x29')]['channel']=_0x204d10['channel'];_0x204d10[_0x2a1d('0x29')][_0x2a1d('0x73')]=_0x204d10[_0x2a1d('0x74')];_0x204d10[_0x2a1d('0x29')]['event']='accept';return respondWithRpcPromise('EventManager',_0x2a1d('0x75'),{'event':_0x2a1d('0x76'),'message':_[_0x2a1d('0x54')](_0x204d10[_0x2a1d('0x29')],JSON[_0x2a1d('0x77')](_0x204d10['interaction'][_0x2a1d('0x78')]))},client9002)[_0x2a1d('0x20')](function(){return _0x204d10;});}return _0x204d10;}return null;})[_0x2a1d('0x20')](respondWithResult(_0x5e86b1,null))[_0x2a1d('0x2b')](handleError(_0x5e86b1,null));};var interaction_log=require(_0x2a1d('0x5b'))('chat-interactions');exports[_0x2a1d('0x34')]=function(_0x2417d4,_0x83a466,_0x376b92){var _0x434ab7={'agent':{},'channel':_0x2a1d('0x5e')};if(_0x2417d4[_0x2a1d('0x57')]['id']){delete _0x2417d4[_0x2a1d('0x57')]['id'];}_0x2417d4[_0x2a1d('0x57')][_0x2a1d('0x60')]=_0x2417d4[_0x2a1d('0x57')][_0x2a1d('0x60')]||_0x2417d4[_0x2a1d('0x61')]['id'];_0x434ab7[_0x2a1d('0x62')]['id']=_0x2417d4['body'][_0x2a1d('0x60')];return db[_0x2a1d('0x3b')][_0x2a1d('0x55')]({'where':{'id':_0x2417d4[_0x2a1d('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x83a466,null))[_0x2a1d('0x20')](function(_0x544d92){if(_0x544d92){_0x434ab7[_0x2a1d('0x29')]=_0x544d92[_0x2a1d('0x63')]({'plain':!![]});return db[_0x2a1d('0x79')][_0x2a1d('0x55')]({'where':{'id':_0x544d92[_0x2a1d('0x7a')]}});}return null;})[_0x2a1d('0x20')](handleEntityNotFound(_0x83a466,null))[_0x2a1d('0x20')](function(_0x5152f0){if(_0x5152f0){_0x434ab7[_0x2a1d('0x7b')]=_0x5152f0['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2417d4['user']['id'],_0x2417d4[_0x2a1d('0x61')][_0x2a1d('0x4c')],_0x2417d4[_0x2a1d('0x61')][_0x2a1d('0x66')],_0x434ab7['interaction']['id'],_0x2417d4[_0x2a1d('0x57')]?JSON[_0x2a1d('0x26')](_0x2417d4[_0x2a1d('0x57')]):_0x2a1d('0x7c'));return respondWithRpcPromise(_0x2a1d('0x7d'),_0x2a1d('0x7e'),_0x434ab7);}return null;})[_0x2a1d('0x20')](function(_0x44d358){var _0x228117=_0x2a1d('0x68')+_0x44d358['message']['ContactId'];return db[_0x2a1d('0x6a')]['query'](_0x228117,{'type':db[_0x2a1d('0x6b')]['QueryTypes'][_0x2a1d('0x6d')],'raw':!![]})['then'](function(_0x5cf09f){return _0x5cf09f;});})['then'](function(_0x36568c){if(_0x36568c){_0x434ab7['message'][_0x2a1d('0x7f')]=_0x36568c[0x0];if(!_0x2417d4['body']['UserId'])return;return db['User'][_0x2a1d('0x55')]({'where':{'id':_0x2417d4['body'][_0x2a1d('0x60')],'role':_0x2a1d('0x62')},'attributes':['id',_0x2a1d('0x4c'),_0x2a1d('0x80'),_0x2a1d('0x6f'),_0x2a1d('0x70')],'raw':!![]});}return null;})['then'](function(_0x3eaa0){if(!_0x3eaa0)return null;_0x434ab7[_0x2a1d('0x29')]['agent']=_0x3eaa0;return _0x434ab7;})[_0x2a1d('0x20')](function(_0x2394c1){if(_0x2394c1){_0x2394c1[_0x2a1d('0x29')][_0x2a1d('0x81')]=util['format']('SIP/%s',_0x2417d4[_0x2a1d('0x61')][_0x2a1d('0x4c')]);_0x2394c1['message']['channel']=_0x434ab7[_0x2a1d('0x74')];_0x2394c1[_0x2a1d('0x29')][_0x2a1d('0x73')]=_0x434ab7[_0x2a1d('0x74')];_0x2394c1[_0x2a1d('0x29')]['event']='reject';respondWithRpcPromise('EventManager',_0x2a1d('0x75'),{'event':_0x2a1d('0x82'),'message':_['merge'](_0x434ab7[_0x2a1d('0x29')],JSON[_0x2a1d('0x77')](_0x434ab7[_0x2a1d('0x7b')]['formData']))},client9002);return _0x434ab7;}return null;})[_0x2a1d('0x20')](respondWithResult(_0x83a466,null))[_0x2a1d('0x2b')](handleError(_0x83a466,null));}; \ No newline at end of file +var _0xdbcd=['client','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','ChatMessage','findAll','rows','params','keys','length','find','create','body','describe','../../config/logger','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','User','agent','fullname','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','reject','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','sequelize','contact','email','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http'];(function(_0x2419f5,_0x5babca){var _0x2d9bd3=function(_0x3f94ec){while(--_0x3f94ec){_0x2419f5['push'](_0x2419f5['shift']());}};_0x2d9bd3(++_0x5babca);}(_0xdbcd,0x67));var _0xddbc=function(_0x187aad,_0xfadd51){_0x187aad=_0x187aad-0x0;var _0x16e487=_0xdbcd[_0x187aad];return _0x16e487;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddbc('0x0'));var zipdir=require(_0xddbc('0x1'));var jsonpatch=require(_0xddbc('0x2'));var rp=require('request-promise');var moment=require(_0xddbc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xddbc('0x4'));var util=require(_0xddbc('0x5'));var path=require(_0xddbc('0x6'));var sox=require(_0xddbc('0x7'));var csv=require(_0xddbc('0x8'));var ejs=require(_0xddbc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xddbc('0xa'));var squel=require(_0xddbc('0xb'));var crypto=require('crypto');var jsforce=require(_0xddbc('0xc'));var deskjs=require(_0xddbc('0xd'));var toCsv=require(_0xddbc('0x8'));var querystring=require(_0xddbc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddbc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xddbc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddbc('0x11'));var utils=require(_0xddbc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xddbc('0x13'));var db=require(_0xddbc('0x14'))['db'];config[_0xddbc('0x15')]=_['defaults'](config[_0xddbc('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xddbc('0x16'))(new Redis(config[_0xddbc('0x15')]));require(_0xddbc('0x17'))[_0xddbc('0x18')](socket);var jayson=require(_0xddbc('0x19'));var client=jayson['client'][_0xddbc('0x1a')]({'port':0x232c});var client9002=jayson[_0xddbc('0x1b')][_0xddbc('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5dc036,_0x424a23,_0x128698,_0x18cc83){return new BPromise(function(_0x44e0be,_0xa9addf){var _0x3af297=_0x18cc83||client;return _0x3af297['request'](_0x5dc036,_0x128698)[_0xddbc('0x1c')](function(_0x32e2ff){logger[_0xddbc('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x424a23,'request\x20sent');logger[_0xddbc('0x1e')](_0xddbc('0x1f'),_0x424a23,_0xddbc('0x20'),JSON['stringify'](_0x32e2ff));if(_0x32e2ff[_0xddbc('0x21')]){if(_0x32e2ff[_0xddbc('0x21')]['code']===0x1f4){logger['error'](_0xddbc('0x22'),_0x424a23,_0x32e2ff[_0xddbc('0x21')][_0xddbc('0x23')]);return _0xa9addf(_0x32e2ff[_0xddbc('0x21')]['message']);}logger[_0xddbc('0x21')](_0xddbc('0x22'),_0x424a23,_0x32e2ff['error']['message']);return _0x44e0be(_0x32e2ff[_0xddbc('0x21')]['message']);}else{logger[_0xddbc('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x424a23,_0xddbc('0x20'));_0x44e0be(_0x32e2ff[_0xddbc('0x24')][_0xddbc('0x23')]);}})[_0xddbc('0x25')](function(_0x404270){logger['error'](_0xddbc('0x22'),_0x424a23,_0x404270);_0xa9addf(_0x404270);});});}function respondWithStatusCode(_0x1696f4,_0x9b2e33){_0x9b2e33=_0x9b2e33||0xcc;return function(_0xedda1){if(_0xedda1){return _0x1696f4['sendStatus'](_0x9b2e33);}return _0x1696f4[_0xddbc('0x26')](_0x9b2e33)[_0xddbc('0x27')]();};}function respondWithResult(_0x22b2af,_0x20a536){_0x20a536=_0x20a536||0xc8;return function(_0xe6b98d){if(_0xe6b98d){return _0x22b2af['status'](_0x20a536)[_0xddbc('0x28')](_0xe6b98d);}};}function respondWithFilteredResult(_0x3d5235,_0x49fa43){return function(_0x5b5fd1){if(_0x5b5fd1){var _0x2e1217=typeof _0x49fa43[_0xddbc('0x29')]==='undefined'&&typeof _0x49fa43[_0xddbc('0x2a')]===_0xddbc('0x2b');var _0x4b3819=_0x5b5fd1[_0xddbc('0x2c')];var _0x20178e=_0x2e1217?0x0:_0x49fa43[_0xddbc('0x29')];var _0x1bcd71=_0x2e1217?_0x5b5fd1['count']:_0x49fa43[_0xddbc('0x29')]+_0x49fa43[_0xddbc('0x2a')];var _0xcd4b80;if(_0x1bcd71>=_0x4b3819){_0x1bcd71=_0x4b3819;_0xcd4b80=0xc8;}else{_0xcd4b80=0xce;}_0x3d5235[_0xddbc('0x26')](_0xcd4b80);return _0x3d5235[_0xddbc('0x2d')](_0xddbc('0x2e'),_0x20178e+'-'+_0x1bcd71+'/'+_0x4b3819)[_0xddbc('0x28')](_0x5b5fd1);}return null;};}function patchUpdates(_0x3419fc){return function(_0x92da56){try{jsonpatch[_0xddbc('0x2f')](_0x92da56,_0x3419fc,!![]);}catch(_0x175146){return BPromise['reject'](_0x175146);}return _0x92da56[_0xddbc('0x30')]();};}function saveUpdates(_0x22e3de,_0x1fae8b){return function(_0x557135){if(_0x557135){return _0x557135[_0xddbc('0x31')](_0x22e3de)[_0xddbc('0x1c')](function(_0x5f03d3){return _0x5f03d3;});}return null;};}function removeEntity(_0xa6fcba,_0x76b27c){return function(_0x494d3e){if(_0x494d3e){return _0x494d3e[_0xddbc('0x32')]()[_0xddbc('0x1c')](function(){_0xa6fcba['status'](0xcc)[_0xddbc('0x27')]();});}};}function handleEntityNotFound(_0x546679,_0x5d2477){return function(_0x4ed5e7){if(!_0x4ed5e7){_0x546679[_0xddbc('0x33')](0x194);}return _0x4ed5e7;};}function handleError(_0x2f8182,_0x47cb22){_0x47cb22=_0x47cb22||0x1f4;return function(_0x40a85e){logger[_0xddbc('0x21')](_0x40a85e['stack']);if(_0x40a85e[_0xddbc('0x34')]){delete _0x40a85e['name'];}_0x2f8182[_0xddbc('0x26')](_0x47cb22)[_0xddbc('0x35')](_0x40a85e);};}exports[_0xddbc('0x36')]=function(_0x1cdd7c,_0x583a0b){var _0x55c2b5={},_0x2ec4cd={},_0x456839={'count':0x0,'rows':[]};var _0x50d9de=_[_0xddbc('0x37')](db['ChatMessage'][_0xddbc('0x38')],function(_0x17c828){return{'name':_0x17c828[_0xddbc('0x39')],'type':_0x17c828['type'][_0xddbc('0x3a')]};});_0x2ec4cd['model']=_[_0xddbc('0x37')](_0x50d9de,'name');_0x2ec4cd[_0xddbc('0x3b')]=_['keys'](_0x1cdd7c['query']);_0x2ec4cd[_0xddbc('0x3c')]=_[_0xddbc('0x3d')](_0x2ec4cd[_0xddbc('0x3e')],_0x2ec4cd[_0xddbc('0x3b')]);_0x55c2b5[_0xddbc('0x3f')]=_[_0xddbc('0x3d')](_0x2ec4cd['model'],qs['fields'](_0x1cdd7c[_0xddbc('0x3b')][_0xddbc('0x40')]));_0x55c2b5[_0xddbc('0x3f')]=_0x55c2b5[_0xddbc('0x3f')]['length']?_0x55c2b5[_0xddbc('0x3f')]:_0x2ec4cd[_0xddbc('0x3e')];if(!_0x1cdd7c[_0xddbc('0x3b')][_0xddbc('0x41')]('nolimit')){_0x55c2b5[_0xddbc('0x2a')]=qs[_0xddbc('0x2a')](_0x1cdd7c[_0xddbc('0x3b')][_0xddbc('0x2a')]);_0x55c2b5[_0xddbc('0x29')]=qs[_0xddbc('0x29')](_0x1cdd7c[_0xddbc('0x3b')][_0xddbc('0x29')]);}_0x55c2b5[_0xddbc('0x42')]=qs[_0xddbc('0x43')](_0x1cdd7c[_0xddbc('0x3b')]['sort']);_0x55c2b5[_0xddbc('0x44')]=qs[_0xddbc('0x3c')](_['pick'](_0x1cdd7c[_0xddbc('0x3b')],_0x2ec4cd['filters']),_0x50d9de);if(_0x1cdd7c['query']['filter']){_0x55c2b5[_0xddbc('0x44')]=_[_0xddbc('0x45')](_0x55c2b5[_0xddbc('0x44')],{'$or':_[_0xddbc('0x37')](_0x50d9de,function(_0x2cd4de){if(_0x2cd4de[_0xddbc('0x46')]!==_0xddbc('0x47')){var _0x4d8aa4={};_0x4d8aa4[_0x2cd4de[_0xddbc('0x34')]]={'$like':'%'+_0x1cdd7c[_0xddbc('0x3b')]['filter']+'%'};return _0x4d8aa4;}})});}_0x55c2b5=_[_0xddbc('0x45')]({},_0x55c2b5,_0x1cdd7c[_0xddbc('0x48')]);var _0x2acc5e={'where':_0x55c2b5[_0xddbc('0x44')]};return db['ChatMessage'][_0xddbc('0x2c')](_0x2acc5e)['then'](function(_0x3ca067){_0x456839[_0xddbc('0x2c')]=_0x3ca067;if(_0x1cdd7c['query'][_0xddbc('0x49')]){_0x55c2b5[_0xddbc('0x4a')]=[{'all':!![]}];}return db[_0xddbc('0x4b')][_0xddbc('0x4c')](_0x55c2b5);})[_0xddbc('0x1c')](function(_0x568da6){_0x456839[_0xddbc('0x4d')]=_0x568da6;return _0x456839;})[_0xddbc('0x1c')](respondWithFilteredResult(_0x583a0b,_0x55c2b5))['catch'](handleError(_0x583a0b,null));};exports['show']=function(_0xa66da4,_0x3a8ac2){var _0x5b90fc={'raw':!![],'where':{'id':_0xa66da4[_0xddbc('0x4e')]['id']}},_0x402f6c={};_0x402f6c[_0xddbc('0x3e')]=_['keys'](db[_0xddbc('0x4b')][_0xddbc('0x38')]);_0x402f6c[_0xddbc('0x3b')]=_[_0xddbc('0x4f')](_0xa66da4[_0xddbc('0x3b')]);_0x402f6c[_0xddbc('0x3c')]=_[_0xddbc('0x3d')](_0x402f6c[_0xddbc('0x3e')],_0x402f6c[_0xddbc('0x3b')]);_0x5b90fc[_0xddbc('0x3f')]=_[_0xddbc('0x3d')](_0x402f6c[_0xddbc('0x3e')],qs[_0xddbc('0x40')](_0xa66da4[_0xddbc('0x3b')][_0xddbc('0x40')]));_0x5b90fc[_0xddbc('0x3f')]=_0x5b90fc[_0xddbc('0x3f')][_0xddbc('0x50')]?_0x5b90fc[_0xddbc('0x3f')]:_0x402f6c[_0xddbc('0x3e')];if(_0xa66da4['query'][_0xddbc('0x49')]){_0x5b90fc[_0xddbc('0x4a')]=[{'all':!![]}];}_0x5b90fc=_['merge']({},_0x5b90fc,_0xa66da4[_0xddbc('0x48')]);return db['ChatMessage'][_0xddbc('0x51')](_0x5b90fc)[_0xddbc('0x1c')](handleEntityNotFound(_0x3a8ac2,null))['then'](respondWithResult(_0x3a8ac2,null))['catch'](handleError(_0x3a8ac2,null));};exports['create']=function(_0x15cedd,_0x376077){return db[_0xddbc('0x4b')][_0xddbc('0x52')](_0x15cedd[_0xddbc('0x53')],{})['then'](respondWithResult(_0x376077,0xc9))[_0xddbc('0x25')](handleError(_0x376077,null));};exports[_0xddbc('0x31')]=function(_0x5c3523,_0x42844c){if(_0x5c3523['body']['id']){delete _0x5c3523[_0xddbc('0x53')]['id'];}return db[_0xddbc('0x4b')][_0xddbc('0x51')]({'where':{'id':_0x5c3523[_0xddbc('0x4e')]['id']}})[_0xddbc('0x1c')](handleEntityNotFound(_0x42844c,null))[_0xddbc('0x1c')](saveUpdates(_0x5c3523[_0xddbc('0x53')],null))[_0xddbc('0x1c')](respondWithResult(_0x42844c,null))[_0xddbc('0x25')](handleError(_0x42844c,null));};exports[_0xddbc('0x32')]=function(_0x20eb74,_0xed477){return db[_0xddbc('0x4b')][_0xddbc('0x51')]({'where':{'id':_0x20eb74['params']['id']}})[_0xddbc('0x1c')](handleEntityNotFound(_0xed477,null))['then'](removeEntity(_0xed477,null))[_0xddbc('0x25')](handleError(_0xed477,null));};exports[_0xddbc('0x54')]=function(_0x1853c5,_0x5aa05a){return db[_0xddbc('0x4b')][_0xddbc('0x54')]()[_0xddbc('0x1c')](respondWithResult(_0x5aa05a,null))[_0xddbc('0x25')](handleError(_0x5aa05a,null));};var interaction_log=require(_0xddbc('0x55'))('chat-interactions');exports[_0xddbc('0x56')]=function(_0x843fbd,_0x36c9ae,_0x4490e6){var _0x5bd960={'agent':{},'channel':_0xddbc('0x57')};if(_0x843fbd[_0xddbc('0x53')]['id']){delete _0x843fbd['body']['id'];}_0x843fbd[_0xddbc('0x53')][_0xddbc('0x58')]=!![];_0x843fbd[_0xddbc('0x53')]['readAt']=moment()[_0xddbc('0x59')](_0xddbc('0x5a'));_0x843fbd[_0xddbc('0x53')]['UserId']=_0x843fbd['body'][_0xddbc('0x5b')]||_0x843fbd[_0xddbc('0x5c')]['id'];_0x5bd960['agent']['id']=_0x843fbd[_0xddbc('0x53')]['UserId'];return db[_0xddbc('0x4b')]['find']({'where':{'id':_0x843fbd[_0xddbc('0x4e')]['id'],'UserId':null}})[_0xddbc('0x1c')](handleEntityNotFound(_0x36c9ae,null))[_0xddbc('0x1c')](saveUpdates(_0x843fbd[_0xddbc('0x53')],null))['then'](function(_0x2ffc85){if(_0x2ffc85){_0x5bd960[_0xddbc('0x23')]=_0x2ffc85['get']({'plain':!![]});return db[_0xddbc('0x5d')][_0xddbc('0x51')]({'where':{'id':_0x2ffc85[_0xddbc('0x5e')]}});}return null;})[_0xddbc('0x1c')](handleEntityNotFound(_0x36c9ae,null))['then'](function(_0x6f2bf9){if(_0x6f2bf9){return _0x6f2bf9['update']({'UserId':_0x843fbd[_0xddbc('0x53')][_0xddbc('0x5b')],'read1stAt':_[_0xddbc('0x5f')](_0x6f2bf9['read1stAt'])?moment()[_0xddbc('0x59')](_0xddbc('0x5a')):undefined});}return null;})[_0xddbc('0x1c')](function(_0x58bf85){if(_0x58bf85){_0x5bd960[_0xddbc('0x60')]=_0x58bf85['get']({'plain':!![]});interaction_log[_0xddbc('0x1d')](_0xddbc('0x61'),_0x843fbd[_0xddbc('0x5c')]['id'],_0x843fbd['user'][_0xddbc('0x34')],_0x843fbd[_0xddbc('0x5c')]['role'],_0x5bd960[_0xddbc('0x60')]['id'],_0x843fbd[_0xddbc('0x53')]?JSON[_0xddbc('0x62')](_0x843fbd[_0xddbc('0x53')]):_0xddbc('0x63'));return respondWithRpcPromise(_0xddbc('0x64'),_0xddbc('0x65'),_0x5bd960);}return null;})[_0xddbc('0x1c')](function(_0x701ae8){var _0x3ce435=_0xddbc('0x66')+_0x701ae8['message']['ContactId'];return db['sequelize'][_0xddbc('0x3b')](_0x3ce435,{'type':db[_0xddbc('0x67')][_0xddbc('0x68')][_0xddbc('0x69')],'raw':!![]})['then'](function(_0x28ca58){return _0x28ca58;});})['then'](function(_0x3b3bc8){if(_0x3b3bc8){_0x5bd960[_0xddbc('0x23')]['contact']=_0x3b3bc8[0x0];if(!_0x843fbd['body'][_0xddbc('0x5b')])return;return db[_0xddbc('0x6a')]['find']({'where':{'id':_0x843fbd[_0xddbc('0x53')][_0xddbc('0x5b')],'role':_0xddbc('0x6b')},'attributes':['id',_0xddbc('0x34'),_0xddbc('0x6c'),'email',_0xddbc('0x6d')],'raw':!![]});}return null;})['then'](function(_0x2cf1f2){if(!_0x2cf1f2)return null;_0x5bd960[_0xddbc('0x23')]['agent']=_0x2cf1f2;return _0x5bd960;})[_0xddbc('0x1c')](function(_0xc1886d){if(_0xc1886d){if(_0x843fbd['body'][_0xddbc('0x6e')]){_0x5bd960[_0xddbc('0x23')][_0xddbc('0x6f')]=util[_0xddbc('0x59')](_0xddbc('0x70'),_0x843fbd[_0xddbc('0x5c')]['name']);_0x5bd960['message']['channel']=_0x5bd960['channel'];_0x5bd960[_0xddbc('0x23')][_0xddbc('0x71')]=_0x5bd960[_0xddbc('0x72')];_0x5bd960[_0xddbc('0x23')][_0xddbc('0x73')]=_0xddbc('0x56');return respondWithRpcPromise(_0xddbc('0x74'),_0xddbc('0x74'),{'event':_0xddbc('0x75'),'message':_[_0xddbc('0x45')](_0x5bd960['message'],JSON[_0xddbc('0x76')](_0x5bd960[_0xddbc('0x60')][_0xddbc('0x77')]))},client9002)[_0xddbc('0x1c')](function(){return _0x5bd960;});}return _0x5bd960;}return null;})[_0xddbc('0x1c')](respondWithResult(_0x36c9ae,null))['catch'](handleError(_0x36c9ae,null));};var interaction_log=require('../../config/logger')(_0xddbc('0x78'));exports[_0xddbc('0x79')]=function(_0x3284db,_0x401fdf,_0x3385c7){var _0x25ab0c={'agent':{},'channel':'chat'};if(_0x3284db[_0xddbc('0x53')]['id']){delete _0x3284db[_0xddbc('0x53')]['id'];}_0x3284db[_0xddbc('0x53')][_0xddbc('0x5b')]=_0x3284db[_0xddbc('0x53')][_0xddbc('0x5b')]||_0x3284db['user']['id'];_0x25ab0c[_0xddbc('0x6b')]['id']=_0x3284db['body'][_0xddbc('0x5b')];return db[_0xddbc('0x4b')]['find']({'where':{'id':_0x3284db[_0xddbc('0x4e')]['id'],'UserId':null}})[_0xddbc('0x1c')](handleEntityNotFound(_0x401fdf,null))[_0xddbc('0x1c')](function(_0x40c563){if(_0x40c563){_0x25ab0c[_0xddbc('0x23')]=_0x40c563[_0xddbc('0x7a')]({'plain':!![]});return db[_0xddbc('0x5d')][_0xddbc('0x51')]({'where':{'id':_0x40c563[_0xddbc('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x401fdf,null))['then'](function(_0x2a7d94){if(_0x2a7d94){_0x25ab0c[_0xddbc('0x60')]=_0x2a7d94[_0xddbc('0x7a')]({'plain':!![]});interaction_log[_0xddbc('0x1d')](_0xddbc('0x7b'),_0x3284db[_0xddbc('0x5c')]['id'],_0x3284db['user']['name'],_0x3284db[_0xddbc('0x5c')][_0xddbc('0x7c')],_0x25ab0c[_0xddbc('0x60')]['id'],_0x3284db[_0xddbc('0x53')]?JSON[_0xddbc('0x62')](_0x3284db[_0xddbc('0x53')]):_0xddbc('0x63'));return respondWithRpcPromise('RejectMessage',_0xddbc('0x7d'),_0x25ab0c);}return null;})[_0xddbc('0x1c')](function(_0x2b6a6e){var _0x3cc190=_0xddbc('0x66')+_0x2b6a6e['message'][_0xddbc('0x7e')];return db[_0xddbc('0x7f')]['query'](_0x3cc190,{'type':db[_0xddbc('0x67')]['QueryTypes'][_0xddbc('0x69')],'raw':!![]})[_0xddbc('0x1c')](function(_0x5f36d0){return _0x5f36d0;});})[_0xddbc('0x1c')](function(_0x169bee){if(_0x169bee){_0x25ab0c[_0xddbc('0x23')][_0xddbc('0x80')]=_0x169bee[0x0];if(!_0x3284db[_0xddbc('0x53')][_0xddbc('0x5b')])return;return db['User'][_0xddbc('0x51')]({'where':{'id':_0x3284db[_0xddbc('0x53')][_0xddbc('0x5b')],'role':'agent'},'attributes':['id',_0xddbc('0x34'),'fullname',_0xddbc('0x81'),'internal'],'raw':!![]});}return null;})['then'](function(_0xb57952){if(!_0xb57952)return null;_0x25ab0c['message'][_0xddbc('0x6b')]=_0xb57952;return _0x25ab0c;})[_0xddbc('0x1c')](function(_0x2c8e76){if(_0x2c8e76){_0x2c8e76[_0xddbc('0x23')][_0xddbc('0x6f')]=util[_0xddbc('0x59')]('SIP/%s',_0x3284db[_0xddbc('0x5c')]['name']);_0x2c8e76['message'][_0xddbc('0x72')]=_0x25ab0c[_0xddbc('0x72')];_0x2c8e76[_0xddbc('0x23')][_0xddbc('0x71')]=_0x25ab0c['channel'];_0x2c8e76['message'][_0xddbc('0x73')]=_0xddbc('0x79');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_['merge'](_0x25ab0c[_0xddbc('0x23')],JSON[_0xddbc('0x76')](_0x25ab0c[_0xddbc('0x60')][_0xddbc('0x77')]))},client9002);return _0x25ab0c;}return null;})[_0xddbc('0x1c')](respondWithResult(_0x401fdf,null))[_0xddbc('0x25')](handleError(_0x401fdf,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1509e4c..a7627a6 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 _0xb834=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb834,0x190));var _0x4b83=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xb834[_0x5ac1e5];return _0x1bccc6;};'use strict';var EventEmitter=require(_0x4b83('0x0'));var ChatMessage=require(_0x4b83('0x1'))['db'][_0x4b83('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4b83('0x3')](0x0);var events={'afterCreate':_0x4b83('0x4'),'afterUpdate':_0x4b83('0x5'),'afterDestroy':_0x4b83('0x6')};function emitEvent(_0x5d327d){return function(_0x2eca26,_0x5aa1cf,_0x7a9ecf){ChatMessageEvents[_0x4b83('0x7')](_0x5d327d+':'+_0x2eca26['id'],_0x2eca26);ChatMessageEvents[_0x4b83('0x7')](_0x5d327d,_0x2eca26);_0x7a9ecf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x4b83('0x8')](e,emitEvent(event));}}module[_0x4b83('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x760a=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hook'];(function(_0xc19b38,_0x535577){var _0x2d3082=function(_0x1f7fb2){while(--_0x1f7fb2){_0xc19b38['push'](_0xc19b38['shift']());}};_0x2d3082(++_0x535577);}(_0x760a,0x19f));var _0xa760=function(_0x417441,_0x97b32){_0x417441=_0x417441-0x0;var _0xc5bc3e=_0x760a[_0x417441];return _0xc5bc3e;};'use strict';var EventEmitter=require(_0xa760('0x0'));var ChatMessage=require(_0xa760('0x1'))['db'][_0xa760('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa760('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa760('0x4'),'afterDestroy':_0xa760('0x5')};function emitEvent(_0x33f2d6){return function(_0x150eb2,_0x10f198,_0x337672){ChatMessageEvents[_0xa760('0x6')](_0x33f2d6+':'+_0x150eb2['id'],_0x150eb2);ChatMessageEvents[_0xa760('0x6')](_0x33f2d6,_0x150eb2);_0x337672(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xa760('0x7')](e,emitEvent(event));}}module[_0xa760('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 79064e1..8a14a6f 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 _0x0a96=['bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x4bd453,_0x41c73b){var _0x192d1d=function(_0x20a423){while(--_0x20a423){_0x4bd453['push'](_0x4bd453['shift']());}};_0x192d1d(++_0x41c73b);}(_0x0a96,0xe4));var _0x60a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a96[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x60a9('0x0'));var util=require(_0x60a9('0x1'));var logger=require(_0x60a9('0x2'))('api');var moment=require(_0x60a9('0x3'));var BPromise=require(_0x60a9('0x4'));var rp=require(_0x60a9('0x5'));var fs=require('fs');var path=require(_0x60a9('0x6'));var rimraf=require(_0x60a9('0x7'));var config=require(_0x60a9('0x8'));var attributes=require(_0x60a9('0x9'));module[_0x60a9('0xa')]=function(_0xe1d2ea,_0x488c93){return _0xe1d2ea['define'](_0x60a9('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x60a9('0xc')],'type':_0x60a9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ee42c,_0x1b4bce,_0x5ea310){var _0x16327b=_0xe1d2ea[_0x60a9('0xe')];var _0x4e9b4b=_0x3ee42c[_0x60a9('0xf')]({'plain':!![]});if(_0x4e9b4b[_0x60a9('0x10')][_0x60a9('0x11')]()==='in'||_0x4e9b4b['direction'][_0x60a9('0x11')]()===_0x60a9('0x12')&&!_0x4e9b4b[_0x60a9('0x13')]&&!_[_0x60a9('0x14')](_0x4e9b4b[_0x60a9('0x15')])){_0x16327b[_0x60a9('0x16')]['findOne']({'where':{'id':_0x4e9b4b[_0x60a9('0x17')]}})['then'](function(_0x3b8be5){if(_0x3b8be5){_0x3b8be5[_0x60a9('0x18')]({'lastMsgAt':_0x4e9b4b[_0x60a9('0x19')],'lastMsgDirection':_0x4e9b4b['direction'][_0x60a9('0x11')]()});}})['catch'](function(_0x5689e9){console[_0x60a9('0x1a')](_0x5689e9);});}_0x5ea310();}},'charset':_0x60a9('0x1b'),'collate':_0x60a9('0x1c')});}; \ No newline at end of file +var _0x77c6=['fti_chat_messages','body','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','ChatInteractionId','update','catch','error','utf8mb4','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages'];(function(_0x24c95f,_0x51b31c){var _0x1da225=function(_0x1a90f9){while(--_0x1a90f9){_0x24c95f['push'](_0x24c95f['shift']());}};_0x1da225(++_0x51b31c);}(_0x77c6,0x1b7));var _0x677c=function(_0x181943,_0x542386){_0x181943=_0x181943-0x0;var _0x343642=_0x77c6[_0x181943];return _0x343642;};'use strict';var _=require(_0x677c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x677c('0x1'));var moment=require('moment');var BPromise=require(_0x677c('0x2'));var rp=require(_0x677c('0x3'));var fs=require('fs');var path=require(_0x677c('0x4'));var rimraf=require(_0x677c('0x5'));var config=require(_0x677c('0x6'));var attributes=require('./chatMessage.attributes');module[_0x677c('0x7')]=function(_0x5447de,_0x3efacc){return _0x5447de[_0x677c('0x8')](_0x677c('0x9'),attributes,{'tableName':_0x677c('0xa'),'paranoid':![],'indexes':[{'name':_0x677c('0xb'),'fields':[_0x677c('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56c5de,_0x48d8dc,_0x13c009){var _0x12e7a9=_0x5447de['models'];var _0x15ab1d=_0x56c5de[_0x677c('0xd')]({'plain':!![]});if(_0x15ab1d[_0x677c('0xe')]['toLowerCase']()==='in'||_0x15ab1d['direction'][_0x677c('0xf')]()==='out'&&!_0x15ab1d[_0x677c('0x10')]&&!_['isNil'](_0x15ab1d[_0x677c('0x11')])){_0x12e7a9[_0x677c('0x12')][_0x677c('0x13')]({'where':{'id':_0x15ab1d[_0x677c('0x14')]}})['then'](function(_0x25def5){if(_0x25def5){_0x25def5[_0x677c('0x15')]({'lastMsgAt':_0x15ab1d['createdAt'],'lastMsgDirection':_0x15ab1d['direction'][_0x677c('0xf')]()});}})[_0x677c('0x16')](function(_0xc7d023){console[_0x677c('0x17')](_0xc7d023);});}_0x13c009();}},'charset':_0x677c('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3160a79..c4cb385 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 _0x22b4=['message','result','CreateChatMessage','ChatMessage','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x17b38a,_0x46b1b4){var _0x20179b=function(_0x36e717){while(--_0x36e717){_0x17b38a['push'](_0x17b38a['shift']());}};_0x20179b(++_0x46b1b4);}(_0x22b4,0x8b));var _0x422b=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x22b4[_0x12fc8d];return _0x3f9d04;};'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')]('ChatMessage,\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')]('ChatMessage,\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);});});}exports[_0x422b('0x1c')]=function(_0x16073e){var _0x46d6bb=this;return new Promise(function(_0x25bd15,_0x51049c){return db[_0x422b('0x1d')]['create'](_0x16073e['body'],{'raw':_0x16073e[_0x422b('0x1e')]?_0x16073e['options'][_0x422b('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3f7619){logger[_0x422b('0x13')](_0x422b('0x1c'),_0x16073e);logger['debug'](_0x422b('0x1c'),_0x16073e,JSON[_0x422b('0x17')](_0x3f7619));_0x25bd15(_0x3f7619);})[_0x422b('0x20')](function(_0x3cc51c){logger[_0x422b('0x18')](_0x422b('0x1c'),_0x3cc51c[_0x422b('0x1a')],_0x16073e);_0x51049c(_0x46d6bb[_0x422b('0x18')](0x1f4,_0x3cc51c[_0x422b('0x1a')]));});});}; \ No newline at end of file +var _0x5336=['message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','stringify','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x424c13,_0xb0441){var _0x3df3ee=function(_0x4796e2){while(--_0x4796e2){_0x424c13['push'](_0x424c13['shift']());}};_0x3df3ee(++_0xb0441);}(_0x5336,0xa9));var _0x6533=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5336[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x6533('0x0'));var moment=require(_0x6533('0x1'));var BPromise=require('bluebird');var rs=require(_0x6533('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6533('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6533('0x4'))(_0x6533('0x5'));var config=require(_0x6533('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6533('0x7')]['http']({'port':0x232a});config[_0x6533('0x8')]=_[_0x6533('0x9')](config[_0x6533('0x8')],{'host':_0x6533('0xa'),'port':0x18eb});var socket=require(_0x6533('0xb'))(new Redis(config[_0x6533('0x8')]));require(_0x6533('0xc'))[_0x6533('0xd')](socket);function respondWithRpcPromise(_0x25acae,_0x25ad2a,_0x361006){return new BPromise(function(_0x33195f,_0x1d6e00){return client[_0x6533('0xe')](_0x25acae,_0x361006)[_0x6533('0xf')](function(_0x382b36){logger[_0x6533('0x10')](_0x6533('0x11'),_0x25ad2a,_0x6533('0x12'));logger[_0x6533('0x13')](_0x6533('0x14'),_0x25ad2a,_0x6533('0x12'),JSON['stringify'](_0x382b36));if(_0x382b36['error']){if(_0x382b36[_0x6533('0x15')][_0x6533('0x16')]===0x1f4){logger[_0x6533('0x15')](_0x6533('0x11'),_0x25ad2a,_0x382b36[_0x6533('0x15')]['message']);return _0x1d6e00(_0x382b36[_0x6533('0x15')][_0x6533('0x17')]);}logger[_0x6533('0x15')]('ChatMessage,\x20%s,\x20%s',_0x25ad2a,_0x382b36[_0x6533('0x15')][_0x6533('0x17')]);return _0x33195f(_0x382b36[_0x6533('0x15')][_0x6533('0x17')]);}else{logger[_0x6533('0x10')]('ChatMessage,\x20%s,\x20%s',_0x25ad2a,_0x6533('0x12'));_0x33195f(_0x382b36[_0x6533('0x18')]['message']);}})[_0x6533('0x19')](function(_0x2683c6){logger['error'](_0x6533('0x11'),_0x25ad2a,_0x2683c6);_0x1d6e00(_0x2683c6);});});}exports[_0x6533('0x1a')]=function(_0x4bf0b0){var _0x126544=this;return new Promise(function(_0x449839,_0x112e13){return db[_0x6533('0x1b')]['create'](_0x4bf0b0[_0x6533('0x1c')],{'raw':_0x4bf0b0[_0x6533('0x1d')]?_0x4bf0b0[_0x6533('0x1d')][_0x6533('0x1e')]===undefined?!![]:![]:!![]})[_0x6533('0xf')](function(_0x5c3634){logger['info'](_0x6533('0x1a'),_0x4bf0b0);logger['debug'](_0x6533('0x1a'),_0x4bf0b0,JSON[_0x6533('0x1f')](_0x5c3634));_0x449839(_0x5c3634);})[_0x6533('0x19')](function(_0xbafb46){logger['error']('CreateChatMessage',_0xbafb46['message'],_0x4bf0b0);_0x112e13(_0x126544['error'](0x1f4,_0xbafb46['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f9e1f83..ea6b792 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 _0x615a=['remove','emit','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x50fb04,_0x2af672){var _0x60d2a8=function(_0x419d6b){while(--_0x419d6b){_0x50fb04['push'](_0x50fb04['shift']());}};_0x60d2a8(++_0x2af672);}(_0x615a,0x119));var _0xa615=function(_0x4d1dcb,_0x49df03){_0x4d1dcb=_0x4d1dcb-0x0;var _0x3088a7=_0x615a[_0x4d1dcb];return _0x3088a7;};'use strict';var ChatMessageEvents=require(_0xa615('0x0'));var events=['save',_0xa615('0x1'),'update'];function createListener(_0x7e1c17,_0x33c100){return function(_0x30bb4f){_0x33c100[_0xa615('0x2')](_0x7e1c17,_0x30bb4f);};}function removeListener(_0x52ae35,_0x1d9a38){return function(){ChatMessageEvents[_0xa615('0x3')](_0x52ae35,_0x1d9a38);};}exports['register']=function(_0x320680){for(var _0x5d04bd=0x0,_0x44afda=events[_0xa615('0x4')];_0x5d04bd<_0x44afda;_0x5d04bd++){var _0x2db48d=events[_0x5d04bd];var _0x1e714d=createListener(_0xa615('0x5')+_0x2db48d,_0x320680);ChatMessageEvents['on'](_0x2db48d,_0x1e714d);}}; \ No newline at end of file +var _0x9f7a=['removeListener','./chatMessage.events','save','remove','update'];(function(_0x176585,_0x18f8c5){var _0x55e185=function(_0x4a1202){while(--_0x4a1202){_0x176585['push'](_0x176585['shift']());}};_0x55e185(++_0x18f8c5);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x9f7a[_0x1c8c28];return _0x1f59b4;};'use strict';var ChatMessageEvents=require(_0xa9f7('0x0'));var events=[_0xa9f7('0x1'),_0xa9f7('0x2'),_0xa9f7('0x3')];function createListener(_0x4af524,_0x302d71){return function(_0x4c0346){_0x302d71['emit'](_0x4af524,_0x4c0346);};}function removeListener(_0x59823f,_0x22dbdd){return function(){ChatMessageEvents[_0xa9f7('0x4')](_0x59823f,_0x22dbdd);};}exports['register']=function(_0x499ff6){for(var _0xc1334d=0x0,_0x5497c8=events['length'];_0xc1334d<_0x5497c8;_0xc1334d++){var _0x5bf7ca=events[_0xc1334d];var _0x21010f=createListener('chatMessage:'+_0x5bf7ca,_0x499ff6);ChatMessageEvents['on'](_0x5bf7ca,_0x21010f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 883a2dd..8823c6d 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 _0xd804=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports'];(function(_0xf6ccf6,_0x500d6a){var _0x432937=function(_0x23c186){while(--_0x23c186){_0xf6ccf6['push'](_0xf6ccf6['shift']());}};_0x432937(++_0x500d6a);}(_0xd804,0x16c));var _0x4d80=function(_0x54b458,_0x4da21b){_0x54b458=_0x54b458-0x0;var _0x18d704=_0xd804[_0x54b458];return _0x18d704;};'use strict';var multer=require(_0x4d80('0x0'));var util=require(_0x4d80('0x1'));var path=require(_0x4d80('0x2'));var timeout=require(_0x4d80('0x3'));var express=require('express');var router=express[_0x4d80('0x4')]();var fs_extra=require(_0x4d80('0x5'));var auth=require(_0x4d80('0x6'));var interaction=require(_0x4d80('0x7'));var config=require(_0x4d80('0x8'));var controller=require(_0x4d80('0x9'));router[_0x4d80('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4d80('0xa')]('/describe',auth[_0x4d80('0xb')](),controller[_0x4d80('0xc')]);router[_0x4d80('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4d80('0xd')]);router[_0x4d80('0xe')]('/',auth['isAuthenticated'](),interaction[_0x4d80('0xf')](_0x4d80('0x10'),_0x4d80('0x11')),controller[_0x4d80('0x12')]);router['put']('/:id',controller['update']);router[_0x4d80('0x13')](_0x4d80('0x14'),auth[_0x4d80('0xb')](),controller[_0x4d80('0x15')]);router[_0x4d80('0x13')](_0x4d80('0x16'),auth[_0x4d80('0xb')](),controller[_0x4d80('0x17')]);router[_0x4d80('0x18')](_0x4d80('0x19'),auth['isAuthenticated'](),controller[_0x4d80('0x1a')]);module[_0x4d80('0x1b')]=router; \ No newline at end of file +var _0xb58f=['/describe','describe','/:id','show','post','chat','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4bb27a,_0x373798){var _0x1ef716=function(_0x5c0403){while(--_0x5c0403){_0x4bb27a['push'](_0x4bb27a['shift']());}};_0x1ef716(++_0x373798);}(_0xb58f,0x12c));var _0xfb58=function(_0x5894eb,_0x45bc1b){_0x5894eb=_0x5894eb-0x0;var _0x3d6fd9=_0xb58f[_0x5894eb];return _0x3d6fd9;};'use strict';var multer=require(_0xfb58('0x0'));var util=require(_0xfb58('0x1'));var path=require(_0xfb58('0x2'));var timeout=require(_0xfb58('0x3'));var express=require(_0xfb58('0x4'));var router=express[_0xfb58('0x5')]();var fs_extra=require(_0xfb58('0x6'));var auth=require(_0xfb58('0x7'));var interaction=require(_0xfb58('0x8'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0xfb58('0x9')]('/',auth[_0xfb58('0xa')](),controller[_0xfb58('0xb')]);router['get'](_0xfb58('0xc'),auth[_0xfb58('0xa')](),controller[_0xfb58('0xd')]);router[_0xfb58('0x9')](_0xfb58('0xe'),auth[_0xfb58('0xa')](),controller[_0xfb58('0xf')]);router[_0xfb58('0x10')]('/',auth[_0xfb58('0xa')](),interaction['tracked'](_0xfb58('0x11'),'chatmessage:create'),controller['create']);router[_0xfb58('0x12')]('/:id',controller['update']);router[_0xfb58('0x12')](_0xfb58('0x13'),auth['isAuthenticated'](),controller[_0xfb58('0x14')]);router[_0xfb58('0x12')](_0xfb58('0x15'),auth[_0xfb58('0xa')](),controller[_0xfb58('0x16')]);router[_0xfb58('0x17')](_0xfb58('0xe'),auth[_0xfb58('0xa')](),controller[_0xfb58('0x18')]);module[_0xfb58('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0385df9..a707423 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 _0x2032=['medium','exports','TEXT'];(function(_0x25e6b9,_0x9d17ea){var _0x4bfb70=function(_0x5aafec){while(--_0x5aafec){_0x25e6b9['push'](_0x25e6b9['shift']());}};_0x4bfb70(++_0x9d17ea);}(_0x2032,0xd9));var _0x2203=function(_0x5b1318,_0x2933cb){_0x5b1318=_0x5b1318-0x0;var _0x27a4f2=_0x2032[_0x5b1318];return _0x27a4f2;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x757a,0xde));var _0xa757=function(_0x3a9198,_0xd6104){_0x3a9198=_0x3a9198-0x0;var _0x10b0f0=_0x757a[_0x3a9198];return _0x10b0f0;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4f63fbc..eb62c2d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1b8765,_0x5f2b89){var _0x17706b=function(_0x567802){while(--_0x567802){_0x1b8765['push'](_0x1b8765['shift']());}};_0x17706b(++_0x5f2b89);}(_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 +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(_0x1394d0,_0x20d15f){var _0x5a0e44=function(_0x24c9ba){while(--_0x24c9ba){_0x1394d0['push'](_0x1394d0['shift']());}};_0x5a0e44(++_0x20d15f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 6bbe664..7b12d49 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 _0x0e8a=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove','emit','hook'];(function(_0x185bba,_0x3103f3){var _0x29cf4d=function(_0x204a5a){while(--_0x204a5a){_0x185bba['push'](_0x185bba['shift']());}};_0x29cf4d(++_0x3103f3);}(_0x0e8a,0x1c3));var _0xa0e8=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x0e8a[_0xbc2974];return _0x3a5b4f;};'use strict';var EventEmitter=require(_0xa0e8('0x0'));var ChatOfflineMessage=require(_0xa0e8('0x1'))['db'][_0xa0e8('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa0e8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0e8('0x4'),'afterDestroy':_0xa0e8('0x5')};function emitEvent(_0x1a7c64){return function(_0x162f30,_0x4375b,_0x41e90c){ChatOfflineMessageEvents['emit'](_0x1a7c64+':'+_0x162f30['id'],_0x162f30);ChatOfflineMessageEvents[_0xa0e8('0x6')](_0x1a7c64,_0x162f30);_0x41e90c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xa0e8('0x7')](e,emitEvent(event));}}module[_0xa0e8('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3a67=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x125703,_0x46989c){var _0x1a954b=function(_0x1fdbb1){while(--_0x1fdbb1){_0x125703['push'](_0x125703['shift']());}};_0x1a954b(++_0x46989c);}(_0x3a67,0x11c));var _0x73a6=function(_0xeca823,_0x276d38){_0xeca823=_0xeca823-0x0;var _0x35f4ab=_0x3a67[_0xeca823];return _0x35f4ab;};'use strict';var EventEmitter=require(_0x73a6('0x0'));var ChatOfflineMessage=require(_0x73a6('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x73a6('0x2'),'afterUpdate':'update','afterDestroy':_0x73a6('0x3')};function emitEvent(_0x484fd5){return function(_0x365e25,_0x558f15,_0x7e5b87){ChatOfflineMessageEvents[_0x73a6('0x4')](_0x484fd5+':'+_0x365e25['id'],_0x365e25);ChatOfflineMessageEvents[_0x73a6('0x4')](_0x484fd5,_0x365e25);_0x7e5b87(null);};}for(var e in events){if(events[_0x73a6('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x73a6('0x6')](e,emitEvent(event));}}module[_0x73a6('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 f685196..ea91f07 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 _0xf992=['utf8mb4_unicode_ci','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x528d4f,_0x19b4f9){var _0x3df605=function(_0x18ed9d){while(--_0x18ed9d){_0x528d4f['push'](_0x528d4f['shift']());}};_0x3df605(++_0x19b4f9);}(_0xf992,0xdf));var _0x2f99=function(_0xae0839,_0x3318eb){_0xae0839=_0xae0839-0x0;var _0x266b15=_0xf992[_0xae0839];return _0x266b15;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x2f99('0x0')]=function(_0x366435){return _0x366435[_0x2f99('0x1')](_0x2f99('0x2'),attributes,{'tableName':_0x2f99('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f99('0x4'),'collate':_0x2f99('0x5')});}; \ No newline at end of file +var _0x4b58=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4'];(function(_0x4fc8dd,_0x44239a){var _0xfa6052=function(_0x199dff){while(--_0x199dff){_0x4fc8dd['push'](_0x4fc8dd['shift']());}};_0xfa6052(++_0x44239a);}(_0x4b58,0x182));var _0x84b5=function(_0x209bb2,_0x3950e6){_0x209bb2=_0x209bb2-0x0;var _0xdbedfe=_0x4b58[_0x209bb2];return _0xdbedfe;};'use strict';var attributes=require(_0x84b5('0x0'));module['exports']=function(_0x28d146){return _0x28d146[_0x84b5('0x1')](_0x84b5('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x84b5('0x3'),'collate':_0x84b5('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 598f586..46f55f9 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 _0x90c2=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x5c3ea5,_0xa9ed0c){var _0x102b61=function(_0xafb4a3){while(--_0xafb4a3){_0x5c3ea5['push'](_0x5c3ea5['shift']());}};_0x102b61(++_0xa9ed0c);}(_0x90c2,0x12e));var _0x290c=function(_0x1ac870,_0x33afd4){_0x1ac870=_0x1ac870-0x0;var _0x34e7d0=_0x90c2[_0x1ac870];return _0x34e7d0;};'use strict';var _=require(_0x290c('0x0'));var util=require(_0x290c('0x1'));var moment=require(_0x290c('0x2'));var BPromise=require(_0x290c('0x3'));var rs=require(_0x290c('0x4'));var fs=require('fs');var Redis=require(_0x290c('0x5'));var db=require(_0x290c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x290c('0x7'))(_0x290c('0x8'));var config=require(_0x290c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x290c('0xa')][_0x290c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50b136,_0x318079,_0x2b750c){return new BPromise(function(_0x30a4dc,_0x1978b4){return client[_0x290c('0xc')](_0x50b136,_0x2b750c)[_0x290c('0xd')](function(_0x3c3ae9){logger[_0x290c('0xe')](_0x290c('0xf'),_0x318079,_0x290c('0x10'));logger[_0x290c('0x11')](_0x290c('0x12'),_0x318079,_0x290c('0x10'),JSON['stringify'](_0x3c3ae9));if(_0x3c3ae9[_0x290c('0x13')]){if(_0x3c3ae9[_0x290c('0x13')]['code']===0x1f4){logger[_0x290c('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x318079,_0x3c3ae9[_0x290c('0x13')][_0x290c('0x14')]);return _0x1978b4(_0x3c3ae9[_0x290c('0x13')][_0x290c('0x14')]);}logger[_0x290c('0x13')](_0x290c('0xf'),_0x318079,_0x3c3ae9['error'][_0x290c('0x14')]);return _0x30a4dc(_0x3c3ae9[_0x290c('0x13')][_0x290c('0x14')]);}else{logger[_0x290c('0xe')](_0x290c('0xf'),_0x318079,_0x290c('0x10'));_0x30a4dc(_0x3c3ae9[_0x290c('0x15')][_0x290c('0x14')]);}})[_0x290c('0x16')](function(_0x523f05){logger[_0x290c('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x318079,_0x523f05);_0x1978b4(_0x523f05);});});} \ No newline at end of file +var _0x408f=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x26a709,_0x47c89f){var _0x5358d6=function(_0x53dfba){while(--_0x53dfba){_0x26a709['push'](_0x26a709['shift']());}};_0x5358d6(++_0x47c89f);}(_0x408f,0x1c1));var _0xf408=function(_0x284b35,_0x26cbfa){_0x284b35=_0x284b35-0x0;var _0x4fb5ab=_0x408f[_0x284b35];return _0x4fb5ab;};'use strict';var _=require(_0xf408('0x0'));var util=require(_0xf408('0x1'));var moment=require('moment');var BPromise=require(_0xf408('0x2'));var rs=require(_0xf408('0x3'));var fs=require('fs');var Redis=require(_0xf408('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf408('0x5'));var logger=require(_0xf408('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf408('0x7'));var client=jayson[_0xf408('0x8')][_0xf408('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe678ff,_0x2f1c04,_0x31d015){return new BPromise(function(_0x315c6e,_0x8baadd){return client[_0xf408('0xa')](_0xe678ff,_0x31d015)[_0xf408('0xb')](function(_0x2204c2){logger[_0xf408('0xc')](_0xf408('0xd'),_0x2f1c04,_0xf408('0xe'));logger[_0xf408('0xf')](_0xf408('0x10'),_0x2f1c04,_0xf408('0xe'),JSON[_0xf408('0x11')](_0x2204c2));if(_0x2204c2[_0xf408('0x12')]){if(_0x2204c2[_0xf408('0x12')][_0xf408('0x13')]===0x1f4){logger[_0xf408('0x12')](_0xf408('0xd'),_0x2f1c04,_0x2204c2[_0xf408('0x12')][_0xf408('0x14')]);return _0x8baadd(_0x2204c2['error'][_0xf408('0x14')]);}logger[_0xf408('0x12')](_0xf408('0xd'),_0x2f1c04,_0x2204c2[_0xf408('0x12')]['message']);return _0x315c6e(_0x2204c2[_0xf408('0x12')][_0xf408('0x14')]);}else{logger['info'](_0xf408('0xd'),_0x2f1c04,'request\x20sent');_0x315c6e(_0x2204c2[_0xf408('0x15')]['message']);}})[_0xf408('0x16')](function(_0xe499e0){logger['error'](_0xf408('0xd'),_0x2f1c04,_0xe499e0);_0x8baadd(_0xe499e0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5002596..a9366c0 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 _0x72da=['./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x387517,_0x302240){var _0x5aaacc=function(_0x3e0b7a){while(--_0x3e0b7a){_0x387517['push'](_0x387517['shift']());}};_0x5aaacc(++_0x302240);}(_0x72da,0x117));var _0xa72d=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0x72da[_0x119d13];return _0x333c35;};'use strict';var multer=require(_0xa72d('0x0'));var util=require(_0xa72d('0x1'));var path=require('path');var timeout=require(_0xa72d('0x2'));var express=require('express');var router=express[_0xa72d('0x3')]();var fs_extra=require(_0xa72d('0x4'));var auth=require(_0xa72d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa72d('0x6'));var controller=require(_0xa72d('0x7'));router[_0xa72d('0x8')]('/',auth[_0xa72d('0x9')](),controller[_0xa72d('0xa')]);router['get'](_0xa72d('0xb'),auth[_0xa72d('0x9')](),controller[_0xa72d('0xc')]);router['get'](_0xa72d('0xd'),auth[_0xa72d('0x9')](),controller[_0xa72d('0xe')]);router[_0xa72d('0xf')]('/',auth['isAuthenticated'](),controller[_0xa72d('0x10')]);router[_0xa72d('0x11')](_0xa72d('0xd'),auth[_0xa72d('0x9')](),controller[_0xa72d('0x12')]);router[_0xa72d('0x13')](_0xa72d('0xd'),auth[_0xa72d('0x9')](),controller[_0xa72d('0x14')]);module[_0xa72d('0x15')]=router; \ No newline at end of file +var _0xe66c=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x8bdea4,_0x2b175d){var _0x3f619f=function(_0x5782e9){while(--_0x5782e9){_0x8bdea4['push'](_0x8bdea4['shift']());}};_0x3f619f(++_0x2b175d);}(_0xe66c,0x133));var _0xce66=function(_0x3c8ea6,_0x54723e){_0x3c8ea6=_0x3c8ea6-0x0;var _0x217dc0=_0xe66c[_0x3c8ea6];return _0x217dc0;};'use strict';var multer=require(_0xce66('0x0'));var util=require(_0xce66('0x1'));var path=require(_0xce66('0x2'));var timeout=require(_0xce66('0x3'));var express=require(_0xce66('0x4'));var router=express[_0xce66('0x5')]();var fs_extra=require(_0xce66('0x6'));var auth=require(_0xce66('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xce66('0x8'));var controller=require(_0xce66('0x9'));router[_0xce66('0xa')]('/',auth[_0xce66('0xb')](),controller[_0xce66('0xc')]);router[_0xce66('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xce66('0xd'),auth[_0xce66('0xb')](),controller['show']);router[_0xce66('0xe')]('/',auth[_0xce66('0xb')](),controller[_0xce66('0xf')]);router['put'](_0xce66('0xd'),auth[_0xce66('0xb')](),controller[_0xce66('0x10')]);router[_0xce66('0x11')](_0xce66('0xd'),auth[_0xce66('0xb')](),controller[_0xce66('0x12')]);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 31b4767..50bd3b7 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 _0x6186=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6186,0x94));var _0x6618=function(_0x482393,_0x355061){_0x482393=_0x482393-0x0;var _0x4c07ae=_0x6186[_0x482393];return _0x4c07ae;};'use strict';var Sequelize=require(_0x6618('0x0'));module[_0x6618('0x1')]={'name':{'type':Sequelize[_0x6618('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6618('0x3'),_0x6618('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x6618('0x2')]},'timeout':{'type':Sequelize[_0x6618('0x5')]}}; \ No newline at end of file +var _0x2896=['STRING','INTEGER','sequelize','exports','mouseOver','timeout'];(function(_0x454643,_0x1c8611){var _0x4fa630=function(_0x338e04){while(--_0x338e04){_0x454643['push'](_0x454643['shift']());}};_0x4fa630(++_0x1c8611);}(_0x2896,0x140));var _0x6289=function(_0x188b0b,_0x15ec7b){_0x188b0b=_0x188b0b-0x0;var _0x33b734=_0x2896[_0x188b0b];return _0x33b734;};'use strict';var Sequelize=require(_0x6289('0x0'));module[_0x6289('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6289('0x2'),_0x6289('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x6289('0x4')]},'timeout':{'type':Sequelize[_0x6289('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9676003..de822b8 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 _0xb13b=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','then','end','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','create','ChatProactiveAction','catch','body','find','destroy','eml-format','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb13b,0x1de));var _0xbb13=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb13b[_0x2aec52];return _0x3b8835;};'use strict';var emlformat=require(_0xbb13('0x0'));var rimraf=require(_0xbb13('0x1'));var zipdir=require(_0xbb13('0x2'));var jsonpatch=require(_0xbb13('0x3'));var rp=require(_0xbb13('0x4'));var moment=require('moment');var BPromise=require(_0xbb13('0x5'));var Mustache=require(_0xbb13('0x6'));var util=require('util');var path=require(_0xbb13('0x7'));var sox=require(_0xbb13('0x8'));var csv=require(_0xbb13('0x9'));var ejs=require(_0xbb13('0xa'));var fs=require('fs');var fs_extra=require(_0xbb13('0xb'));var _=require(_0xbb13('0xc'));var squel=require(_0xbb13('0xd'));var crypto=require(_0xbb13('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbb13('0x9'));var querystring=require(_0xbb13('0xf'));var Papa=require(_0xbb13('0x10'));var Redis=require(_0xbb13('0x11'));var authService=require(_0xbb13('0x12'));var qs=require(_0xbb13('0x13'));var as=require(_0xbb13('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb13('0x15'))(_0xbb13('0x16'));var utils=require(_0xbb13('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb13('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56ee42,_0x3c033f){_0x3c033f=_0x3c033f||0xcc;return function(_0x3613c8){if(_0x3613c8){return _0x56ee42[_0xbb13('0x19')](_0x3c033f);}return _0x56ee42[_0xbb13('0x1a')](_0x3c033f)['end']();};}function respondWithResult(_0x11e664,_0x58f59d){_0x58f59d=_0x58f59d||0xc8;return function(_0x3eda54){if(_0x3eda54){return _0x11e664['status'](_0x58f59d)[_0xbb13('0x1b')](_0x3eda54);}};}function respondWithFilteredResult(_0x5f3ab1,_0x1ee7a6){return function(_0x4a35c4){if(_0x4a35c4){var _0xea5007=typeof _0x1ee7a6[_0xbb13('0x1c')]===_0xbb13('0x1d')&&typeof _0x1ee7a6['limit']==='undefined';var _0x54cc3d=_0x4a35c4[_0xbb13('0x1e')];var _0x4eef59=_0xea5007?0x0:_0x1ee7a6['offset'];var _0x4f7dd1=_0xea5007?_0x4a35c4[_0xbb13('0x1e')]:_0x1ee7a6[_0xbb13('0x1c')]+_0x1ee7a6[_0xbb13('0x1f')];var _0x432b9a;if(_0x4f7dd1>=_0x54cc3d){_0x4f7dd1=_0x54cc3d;_0x432b9a=0xc8;}else{_0x432b9a=0xce;}_0x5f3ab1[_0xbb13('0x1a')](_0x432b9a);return _0x5f3ab1[_0xbb13('0x20')]('Content-Range',_0x4eef59+'-'+_0x4f7dd1+'/'+_0x54cc3d)[_0xbb13('0x1b')](_0x4a35c4);}return null;};}function patchUpdates(_0x40b7df){return function(_0x3b5a4d){try{jsonpatch[_0xbb13('0x21')](_0x3b5a4d,_0x40b7df,!![]);}catch(_0x553d12){return BPromise['reject'](_0x553d12);}return _0x3b5a4d[_0xbb13('0x22')]();};}function saveUpdates(_0x18de23,_0xf14f4a){return function(_0x29ef25){if(_0x29ef25){return _0x29ef25['update'](_0x18de23)[_0xbb13('0x23')](function(_0x178c22){return _0x178c22;});}return null;};}function removeEntity(_0xc119cc,_0x4d64b7){return function(_0x4319c3){if(_0x4319c3){return _0x4319c3['destroy']()['then'](function(){_0xc119cc[_0xbb13('0x1a')](0xcc)[_0xbb13('0x24')]();});}};}function handleEntityNotFound(_0x2ba6b6,_0x259e48){return function(_0x3187e9){if(!_0x3187e9){_0x2ba6b6[_0xbb13('0x19')](0x194);}return _0x3187e9;};}function handleError(_0xb1063d,_0x3872f3){_0x3872f3=_0x3872f3||0x1f4;return function(_0x16e451){logger[_0xbb13('0x25')](_0x16e451[_0xbb13('0x26')]);if(_0x16e451['name']){delete _0x16e451['name'];}_0xb1063d['status'](_0x3872f3)[_0xbb13('0x27')](_0x16e451);};}exports[_0xbb13('0x28')]=function(_0x1531cf,_0x24e43e){var _0x21b19d={'raw':!![],'where':{'id':_0x1531cf[_0xbb13('0x29')]['id']}},_0x5c83bc={};_0x5c83bc[_0xbb13('0x2a')]=_[_0xbb13('0x2b')](db['ChatProactiveAction'][_0xbb13('0x2c')]);_0x5c83bc[_0xbb13('0x2d')]=_[_0xbb13('0x2b')](_0x1531cf[_0xbb13('0x2d')]);_0x5c83bc['filters']=_[_0xbb13('0x2e')](_0x5c83bc['model'],_0x5c83bc[_0xbb13('0x2d')]);_0x21b19d[_0xbb13('0x2f')]=_['intersection'](_0x5c83bc[_0xbb13('0x2a')],qs['fields'](_0x1531cf[_0xbb13('0x2d')][_0xbb13('0x30')]));_0x21b19d[_0xbb13('0x2f')]=_0x21b19d[_0xbb13('0x2f')][_0xbb13('0x31')]?_0x21b19d[_0xbb13('0x2f')]:_0x5c83bc['model'];if(_0x1531cf['query'][_0xbb13('0x32')]){_0x21b19d[_0xbb13('0x33')]=[{'all':!![]}];}_0x21b19d=_[_0xbb13('0x34')]({},_0x21b19d,_0x1531cf[_0xbb13('0x35')]);return db['ChatProactiveAction']['find'](_0x21b19d)[_0xbb13('0x23')](handleEntityNotFound(_0x24e43e,null))[_0xbb13('0x23')](respondWithResult(_0x24e43e,null))['catch'](handleError(_0x24e43e,null));};exports[_0xbb13('0x36')]=function(_0x592dd9,_0x299466){return db[_0xbb13('0x37')]['create'](_0x592dd9['body'],{})[_0xbb13('0x23')](respondWithResult(_0x299466,0xc9))[_0xbb13('0x38')](handleError(_0x299466,null));};exports['update']=function(_0x29e86d,_0x33dd55){if(_0x29e86d[_0xbb13('0x39')]['id']){delete _0x29e86d[_0xbb13('0x39')]['id'];}return db[_0xbb13('0x37')][_0xbb13('0x3a')]({'where':{'id':_0x29e86d[_0xbb13('0x29')]['id']}})[_0xbb13('0x23')](handleEntityNotFound(_0x33dd55,null))[_0xbb13('0x23')](saveUpdates(_0x29e86d[_0xbb13('0x39')],null))[_0xbb13('0x23')](respondWithResult(_0x33dd55,null))[_0xbb13('0x38')](handleError(_0x33dd55,null));};exports[_0xbb13('0x3b')]=function(_0x5d922d,_0x90e2db){return db['ChatProactiveAction']['find']({'where':{'id':_0x5d922d[_0xbb13('0x29')]['id']}})[_0xbb13('0x23')](handleEntityNotFound(_0x90e2db,null))[_0xbb13('0x23')](removeEntity(_0x90e2db,null))[_0xbb13('0x38')](handleError(_0x90e2db,null));}; \ No newline at end of file +var _0x8375=['params','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','length','include','merge','options','catch','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','show'];(function(_0x2acb82,_0xb4f8ab){var _0x41d0b2=function(_0x4f553a){while(--_0x4f553a){_0x2acb82['push'](_0x2acb82['shift']());}};_0x41d0b2(++_0xb4f8ab);}(_0x8375,0x132));var _0x5837=function(_0x2b87ab,_0x2d538a){_0x2b87ab=_0x2b87ab-0x0;var _0x3e524d=_0x8375[_0x2b87ab];return _0x3e524d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5837('0x0'));var zipdir=require(_0x5837('0x1'));var jsonpatch=require(_0x5837('0x2'));var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require('mustache');var util=require(_0x5837('0x6'));var path=require(_0x5837('0x7'));var sox=require('sox');var csv=require(_0x5837('0x8'));var ejs=require(_0x5837('0x9'));var fs=require('fs');var fs_extra=require(_0x5837('0xa'));var _=require(_0x5837('0xb'));var squel=require('squel');var crypto=require(_0x5837('0xc'));var jsforce=require(_0x5837('0xd'));var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x8'));var querystring=require(_0x5837('0xf'));var Papa=require(_0x5837('0x10'));var Redis=require(_0x5837('0x11'));var authService=require(_0x5837('0x12'));var qs=require(_0x5837('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5837('0x14'));var logger=require(_0x5837('0x15'))('api');var utils=require(_0x5837('0x16'));var config=require(_0x5837('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x5abd5e,_0x2b0b43){_0x2b0b43=_0x2b0b43||0xcc;return function(_0x3ad5b3){if(_0x3ad5b3){return _0x5abd5e[_0x5837('0x19')](_0x2b0b43);}return _0x5abd5e[_0x5837('0x1a')](_0x2b0b43)['end']();};}function respondWithResult(_0x2b82a9,_0x103b9c){_0x103b9c=_0x103b9c||0xc8;return function(_0x2bc6f6){if(_0x2bc6f6){return _0x2b82a9['status'](_0x103b9c)[_0x5837('0x1b')](_0x2bc6f6);}};}function respondWithFilteredResult(_0x11f16c,_0x2f8af0){return function(_0x23c3af){if(_0x23c3af){var _0x304fe7=typeof _0x2f8af0[_0x5837('0x1c')]==='undefined'&&typeof _0x2f8af0['limit']==='undefined';var _0x37824b=_0x23c3af[_0x5837('0x1d')];var _0x1a5725=_0x304fe7?0x0:_0x2f8af0[_0x5837('0x1c')];var _0x128b4a=_0x304fe7?_0x23c3af[_0x5837('0x1d')]:_0x2f8af0[_0x5837('0x1c')]+_0x2f8af0['limit'];var _0x3c5ec9;if(_0x128b4a>=_0x37824b){_0x128b4a=_0x37824b;_0x3c5ec9=0xc8;}else{_0x3c5ec9=0xce;}_0x11f16c[_0x5837('0x1a')](_0x3c5ec9);return _0x11f16c[_0x5837('0x1e')](_0x5837('0x1f'),_0x1a5725+'-'+_0x128b4a+'/'+_0x37824b)[_0x5837('0x1b')](_0x23c3af);}return null;};}function patchUpdates(_0x50c42c){return function(_0x4bd76c){try{jsonpatch[_0x5837('0x20')](_0x4bd76c,_0x50c42c,!![]);}catch(_0x21c0bf){return BPromise[_0x5837('0x21')](_0x21c0bf);}return _0x4bd76c['save']();};}function saveUpdates(_0x31010b,_0x46786c){return function(_0x4b59b1){if(_0x4b59b1){return _0x4b59b1[_0x5837('0x22')](_0x31010b)[_0x5837('0x23')](function(_0x5e9c2e){return _0x5e9c2e;});}return null;};}function removeEntity(_0x332a90,_0x2709cf){return function(_0x1366c1){if(_0x1366c1){return _0x1366c1['destroy']()[_0x5837('0x23')](function(){_0x332a90['status'](0xcc)[_0x5837('0x24')]();});}};}function handleEntityNotFound(_0x8e5a48,_0x31d25b){return function(_0x3f96b1){if(!_0x3f96b1){_0x8e5a48[_0x5837('0x19')](0x194);}return _0x3f96b1;};}function handleError(_0x1f7f97,_0x22564a){_0x22564a=_0x22564a||0x1f4;return function(_0x1d7285){logger[_0x5837('0x25')](_0x1d7285[_0x5837('0x26')]);if(_0x1d7285[_0x5837('0x27')]){delete _0x1d7285[_0x5837('0x27')];}_0x1f7f97[_0x5837('0x1a')](_0x22564a)[_0x5837('0x28')](_0x1d7285);};}exports[_0x5837('0x29')]=function(_0x5c17dd,_0x321c49){var _0x2818c0={'raw':!![],'where':{'id':_0x5c17dd[_0x5837('0x2a')]['id']}},_0x170cb2={};_0x170cb2[_0x5837('0x2b')]=_[_0x5837('0x2c')](db[_0x5837('0x2d')]['rawAttributes']);_0x170cb2[_0x5837('0x2e')]=_[_0x5837('0x2c')](_0x5c17dd[_0x5837('0x2e')]);_0x170cb2[_0x5837('0x2f')]=_['intersection'](_0x170cb2['model'],_0x170cb2[_0x5837('0x2e')]);_0x2818c0[_0x5837('0x30')]=_[_0x5837('0x31')](_0x170cb2['model'],qs[_0x5837('0x32')](_0x5c17dd[_0x5837('0x2e')][_0x5837('0x32')]));_0x2818c0[_0x5837('0x30')]=_0x2818c0[_0x5837('0x30')][_0x5837('0x33')]?_0x2818c0['attributes']:_0x170cb2[_0x5837('0x2b')];if(_0x5c17dd[_0x5837('0x2e')]['includeAll']){_0x2818c0[_0x5837('0x34')]=[{'all':!![]}];}_0x2818c0=_[_0x5837('0x35')]({},_0x2818c0,_0x5c17dd[_0x5837('0x36')]);return db['ChatProactiveAction']['find'](_0x2818c0)['then'](handleEntityNotFound(_0x321c49,null))['then'](respondWithResult(_0x321c49,null))[_0x5837('0x37')](handleError(_0x321c49,null));};exports['create']=function(_0x4bc062,_0x2a5cf9){return db[_0x5837('0x2d')]['create'](_0x4bc062[_0x5837('0x38')],{})['then'](respondWithResult(_0x2a5cf9,0xc9))[_0x5837('0x37')](handleError(_0x2a5cf9,null));};exports[_0x5837('0x22')]=function(_0x4c0c4a,_0x4109fa){if(_0x4c0c4a[_0x5837('0x38')]['id']){delete _0x4c0c4a['body']['id'];}return db[_0x5837('0x2d')]['find']({'where':{'id':_0x4c0c4a[_0x5837('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4109fa,null))['then'](saveUpdates(_0x4c0c4a[_0x5837('0x38')],null))[_0x5837('0x23')](respondWithResult(_0x4109fa,null))[_0x5837('0x37')](handleError(_0x4109fa,null));};exports[_0x5837('0x39')]=function(_0x1a3639,_0x5ca1ea){return db[_0x5837('0x2d')]['find']({'where':{'id':_0x1a3639['params']['id']}})[_0x5837('0x23')](handleEntityNotFound(_0x5ca1ea,null))[_0x5837('0x23')](removeEntity(_0x5ca1ea,null))['catch'](handleError(_0x5ca1ea,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 721c541..71f091d 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 _0x7a69=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x3b99f4,_0x33bdd7){var _0x556c49=function(_0x5f57a4){while(--_0x5f57a4){_0x3b99f4['push'](_0x3b99f4['shift']());}};_0x556c49(++_0x33bdd7);}(_0x7a69,0x1cb));var _0x97a6=function(_0x242e07,_0x333620){_0x242e07=_0x242e07-0x0;var _0x26c8ac=_0x7a69[_0x242e07];return _0x26c8ac;};'use strict';var _=require(_0x97a6('0x0'));var util=require(_0x97a6('0x1'));var logger=require(_0x97a6('0x2'))('api');var moment=require(_0x97a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x97a6('0x4'));var fs=require('fs');var path=require(_0x97a6('0x5'));var rimraf=require(_0x97a6('0x6'));var config=require(_0x97a6('0x7'));var attributes=require(_0x97a6('0x8'));module[_0x97a6('0x9')]=function(_0x10dbee,_0x378d32){return _0x10dbee[_0x97a6('0xa')](_0x97a6('0xb'),attributes,{'tableName':_0x97a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x220d=['path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise'];(function(_0x161f7b,_0x364838){var _0x20700f=function(_0x563557){while(--_0x563557){_0x161f7b['push'](_0x161f7b['shift']());}};_0x20700f(++_0x364838);}(_0x220d,0x19a));var _0xd220=function(_0xa29722,_0x24199a){_0xa29722=_0xa29722-0x0;var _0x58c891=_0x220d[_0xa29722];return _0x58c891;};'use strict';var _=require(_0xd220('0x0'));var util=require(_0xd220('0x1'));var logger=require('../../config/logger')(_0xd220('0x2'));var moment=require(_0xd220('0x3'));var BPromise=require(_0xd220('0x4'));var rp=require(_0xd220('0x5'));var fs=require('fs');var path=require(_0xd220('0x6'));var rimraf=require('rimraf');var config=require(_0xd220('0x7'));var attributes=require(_0xd220('0x8'));module[_0xd220('0x9')]=function(_0x4e5494,_0x221dde){return _0x4e5494[_0xd220('0xa')](_0xd220('0xb'),attributes,{'tableName':_0xd220('0xc'),'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 c6f6c51..368f19f 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 _0x22dc=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22dc,0xd8));var _0xc22d=function(_0x1cb42c,_0x422597){_0x1cb42c=_0x1cb42c-0x0;var _0x5148f7=_0x22dc[_0x1cb42c];return _0x5148f7;};'use strict';var _=require(_0xc22d('0x0'));var util=require('util');var moment=require(_0xc22d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc22d('0x2'));var fs=require('fs');var Redis=require(_0xc22d('0x3'));var db=require(_0xc22d('0x4'))['db'];var utils=require(_0xc22d('0x5'));var logger=require(_0xc22d('0x6'))(_0xc22d('0x7'));var config=require(_0xc22d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc22d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40c51e,_0x1622bc,_0x5a2b9e){return new BPromise(function(_0x5f2304,_0x409b66){return client[_0xc22d('0xa')](_0x40c51e,_0x5a2b9e)[_0xc22d('0xb')](function(_0x197597){logger[_0xc22d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x1622bc,_0xc22d('0xd'));logger[_0xc22d('0xe')](_0xc22d('0xf'),_0x1622bc,_0xc22d('0xd'),JSON['stringify'](_0x197597));if(_0x197597[_0xc22d('0x10')]){if(_0x197597[_0xc22d('0x10')][_0xc22d('0x11')]===0x1f4){logger[_0xc22d('0x10')](_0xc22d('0x12'),_0x1622bc,_0x197597[_0xc22d('0x10')]['message']);return _0x409b66(_0x197597[_0xc22d('0x10')][_0xc22d('0x13')]);}logger[_0xc22d('0x10')](_0xc22d('0x12'),_0x1622bc,_0x197597[_0xc22d('0x10')][_0xc22d('0x13')]);return _0x5f2304(_0x197597[_0xc22d('0x10')][_0xc22d('0x13')]);}else{logger[_0xc22d('0xc')](_0xc22d('0x12'),_0x1622bc,_0xc22d('0xd'));_0x5f2304(_0x197597[_0xc22d('0x14')][_0xc22d('0x13')]);}})['catch'](function(_0x1a351b){logger['error'](_0xc22d('0x12'),_0x1622bc,_0x1a351b);_0x409b66(_0x1a351b);});});} \ No newline at end of file +var _0xb997=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x2d9710,_0x12f2fd){var _0x3d5887=function(_0x527eb3){while(--_0x527eb3){_0x2d9710['push'](_0x2d9710['shift']());}};_0x3d5887(++_0x12f2fd);}(_0xb997,0x1be));var _0x7b99=function(_0xbefd3c,_0xbc56f0){_0xbefd3c=_0xbefd3c-0x0;var _0x253ad5=_0xb997[_0xbefd3c];return _0x253ad5;};'use strict';var _=require(_0x7b99('0x0'));var util=require(_0x7b99('0x1'));var moment=require(_0x7b99('0x2'));var BPromise=require(_0x7b99('0x3'));var rs=require(_0x7b99('0x4'));var fs=require('fs');var Redis=require(_0x7b99('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b99('0x6'));var config=require(_0x7b99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7b99('0x8')][_0x7b99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a20c4,_0x528cd8,_0x127277){return new BPromise(function(_0x48144c,_0x120921){return client['request'](_0x4a20c4,_0x127277)[_0x7b99('0xa')](function(_0xf5808a){logger[_0x7b99('0xb')](_0x7b99('0xc'),_0x528cd8,_0x7b99('0xd'));logger[_0x7b99('0xe')](_0x7b99('0xf'),_0x528cd8,'request\x20sent',JSON['stringify'](_0xf5808a));if(_0xf5808a['error']){if(_0xf5808a[_0x7b99('0x10')][_0x7b99('0x11')]===0x1f4){logger[_0x7b99('0x10')](_0x7b99('0xc'),_0x528cd8,_0xf5808a[_0x7b99('0x10')][_0x7b99('0x12')]);return _0x120921(_0xf5808a['error']['message']);}logger[_0x7b99('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x528cd8,_0xf5808a['error'][_0x7b99('0x12')]);return _0x48144c(_0xf5808a[_0x7b99('0x10')][_0x7b99('0x12')]);}else{logger[_0x7b99('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x528cd8,_0x7b99('0xd'));_0x48144c(_0xf5808a[_0x7b99('0x13')][_0x7b99('0x12')]);}})[_0x7b99('0x14')](function(_0x40abd0){logger['error'](_0x7b99('0xc'),_0x528cd8,_0x40abd0);_0x120921(_0x40abd0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8290745..f0693e9 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 _0x9c5a=['/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x237c6d,_0x57e94d){_0x237c6d=_0x237c6d-0x0;var _0xe976d=_0x9c5a[_0x237c6d];return _0xe976d;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./chatProactiveAction.controller');router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa9c5('0xb')]);router[_0xa9c5('0xc')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xd')]);router['delete'](_0xa9c5('0xe'),auth[_0xa9c5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x98a8,0x12c));var _0x898a=function(_0x557b4e,_0x1d624e){_0x557b4e=_0x557b4e-0x0;var _0x2602f4=_0x98a8[_0x557b4e];return _0x2602f4;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')](_0x898a('0xb'),auth['isAuthenticated'](),controller[_0x898a('0xc')]);router['post']('/',auth[_0x898a('0xd')](),controller['create']);router[_0x898a('0xe')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0x11')]);module[_0x898a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 07d4e82..bd0dd0b 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 _0xbb95=['name','ENUM','beepall','roundrobin','sequelize','STRING'];(function(_0x4525b5,_0x49471f){var _0x537a7a=function(_0x582687){while(--_0x582687){_0x4525b5['push'](_0x4525b5['shift']());}};_0x537a7a(++_0x49471f);}(_0xbb95,0x1e4));var _0x5bb9=function(_0x5a4d7a,_0x3a566e){_0x5a4d7a=_0x5a4d7a-0x0;var _0x490e8d=_0xbb95[_0x5a4d7a];return _0x490e8d;};'use strict';var Sequelize=require(_0x5bb9('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bb9('0x1')],'unique':_0x5bb9('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bb9('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5bb9('0x3')]('rrmemory',_0x5bb9('0x4'),_0x5bb9('0x5'))}}; \ No newline at end of file +var _0x3931=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x38d499,_0x1cbb6b){var _0x274b18=function(_0x488d64){while(--_0x488d64){_0x38d499['push'](_0x38d499['shift']());}};_0x274b18(++_0x1cbb6b);}(_0x3931,0x188));var _0x1393=function(_0x4b5a02,_0x98ff53){_0x4b5a02=_0x4b5a02-0x0;var _0x1d4810=_0x3931[_0x4b5a02];return _0x1d4810;};'use strict';var Sequelize=require(_0x1393('0x0'));module[_0x1393('0x1')]={'name':{'type':Sequelize[_0x1393('0x2')],'unique':_0x1393('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1393('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1393('0x4')](_0x1393('0x5'),_0x1393('0x6'),_0x1393('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3b25673..edce8d9 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 _0x0023=['ChatQueues','UserProfileResource','name','index','map','ChatQueue','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','params','keys','rawAttributes','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','destroy','then'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x0023,0x102));var _0x3002=function(_0x5dbaa7,_0x1f6d4a){_0x5dbaa7=_0x5dbaa7-0x0;var _0x481319=_0x0023[_0x5dbaa7];return _0x481319;};'use strict';var emlformat=require(_0x3002('0x0'));var rimraf=require(_0x3002('0x1'));var zipdir=require(_0x3002('0x2'));var jsonpatch=require(_0x3002('0x3'));var rp=require(_0x3002('0x4'));var moment=require(_0x3002('0x5'));var BPromise=require(_0x3002('0x6'));var Mustache=require(_0x3002('0x7'));var util=require(_0x3002('0x8'));var path=require(_0x3002('0x9'));var sox=require(_0x3002('0xa'));var csv=require(_0x3002('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3002('0xc'));var _=require('lodash');var squel=require(_0x3002('0xd'));var crypto=require(_0x3002('0xe'));var jsforce=require(_0x3002('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3002('0xb'));var querystring=require(_0x3002('0x10'));var Papa=require(_0x3002('0x11'));var Redis=require(_0x3002('0x12'));var authService=require(_0x3002('0x13'));var qs=require(_0x3002('0x14'));var as=require(_0x3002('0x15'));var hardwareService=require(_0x3002('0x16'));var logger=require(_0x3002('0x17'))(_0x3002('0x18'));var utils=require(_0x3002('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3002('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3002('0x1b')](config[_0x3002('0x1c')],{'host':_0x3002('0x1d'),'port':0x18eb});var socket=require(_0x3002('0x1e'))(new Redis(config[_0x3002('0x1c')]));require(_0x3002('0x1f'))[_0x3002('0x20')](socket);var jayson=require(_0x3002('0x21'));var client=jayson[_0x3002('0x22')][_0x3002('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x51ebc7,_0x152ea3,_0x4062c5,_0x3de980){return new BPromise(function(_0x2e8013,_0x1e8def){var _0x142774=_0x3de980||client;return _0x142774[_0x3002('0x24')](_0x51ebc7,_0x4062c5)['then'](function(_0x45e840){logger[_0x3002('0x25')](_0x3002('0x26'),_0x152ea3,'request\x20sent');logger[_0x3002('0x27')](_0x3002('0x28'),_0x152ea3,_0x3002('0x29'),JSON[_0x3002('0x2a')](_0x45e840));if(_0x45e840[_0x3002('0x2b')]){if(_0x45e840[_0x3002('0x2b')][_0x3002('0x2c')]===0x1f4){logger[_0x3002('0x2b')](_0x3002('0x26'),_0x152ea3,_0x45e840[_0x3002('0x2b')]['message']);return _0x1e8def(_0x45e840['error']['message']);}logger[_0x3002('0x2b')](_0x3002('0x26'),_0x152ea3,_0x45e840[_0x3002('0x2b')][_0x3002('0x2d')]);return _0x2e8013(_0x45e840[_0x3002('0x2b')]['message']);}else{logger[_0x3002('0x25')](_0x3002('0x26'),_0x152ea3,_0x3002('0x29'));_0x2e8013(_0x45e840['result']['message']);}})[_0x3002('0x2e')](function(_0x1e359c){logger[_0x3002('0x2b')](_0x3002('0x26'),_0x152ea3,_0x1e359c);_0x1e8def(_0x1e359c);});});}function respondWithStatusCode(_0x273768,_0x288753){_0x288753=_0x288753||0xcc;return function(_0xc40527){if(_0xc40527){return _0x273768[_0x3002('0x2f')](_0x288753);}return _0x273768[_0x3002('0x30')](_0x288753)[_0x3002('0x31')]();};}function respondWithResult(_0x4d78e8,_0x3ca080){_0x3ca080=_0x3ca080||0xc8;return function(_0x1f6075){if(_0x1f6075){return _0x4d78e8[_0x3002('0x30')](_0x3ca080)['json'](_0x1f6075);}};}function respondWithFilteredResult(_0x2cf14d,_0x4c656c){return function(_0x3d18f1){if(_0x3d18f1){var _0x98f40b=typeof _0x4c656c[_0x3002('0x32')]===_0x3002('0x33')&&typeof _0x4c656c[_0x3002('0x34')]===_0x3002('0x33');var _0x372625=_0x3d18f1['count'];var _0x3e48c3=_0x98f40b?0x0:_0x4c656c[_0x3002('0x32')];var _0x2efe25=_0x98f40b?_0x3d18f1[_0x3002('0x35')]:_0x4c656c[_0x3002('0x32')]+_0x4c656c['limit'];var _0x157279;if(_0x2efe25>=_0x372625){_0x2efe25=_0x372625;_0x157279=0xc8;}else{_0x157279=0xce;}_0x2cf14d[_0x3002('0x30')](_0x157279);return _0x2cf14d['set']('Content-Range',_0x3e48c3+'-'+_0x2efe25+'/'+_0x372625)[_0x3002('0x36')](_0x3d18f1);}return null;};}function patchUpdates(_0x3a28a7){return function(_0x11281e){try{jsonpatch[_0x3002('0x37')](_0x11281e,_0x3a28a7,!![]);}catch(_0x4e4257){return BPromise['reject'](_0x4e4257);}return _0x11281e[_0x3002('0x38')]();};}function saveUpdates(_0x390bf4,_0x4ece5d){return function(_0x5c325f){if(_0x5c325f){return _0x5c325f[_0x3002('0x39')](_0x390bf4)['then'](function(_0x2a1260){return _0x2a1260;});}return null;};}function removeEntity(_0x15c68a,_0x57cfed){return function(_0x454737){if(_0x454737){return _0x454737[_0x3002('0x3a')]()[_0x3002('0x3b')](function(){var _0x4e8bd0=_0x454737['get']({'plain':!![]});var _0x3a140f=_0x3002('0x3c');return db[_0x3002('0x3d')][_0x3002('0x3a')]({'where':{'type':_0x3a140f,'resourceId':_0x4e8bd0['id']}})[_0x3002('0x3b')](function(){return _0x454737;});})['then'](function(){_0x15c68a[_0x3002('0x30')](0xcc)[_0x3002('0x31')]();});}};}function handleEntityNotFound(_0x7a5694,_0x4de614){return function(_0x51decd){if(!_0x51decd){_0x7a5694[_0x3002('0x2f')](0x194);}return _0x51decd;};}function handleError(_0x3e1df8,_0x142cb2){_0x142cb2=_0x142cb2||0x1f4;return function(_0x500590){logger[_0x3002('0x2b')](_0x500590['stack']);if(_0x500590[_0x3002('0x3e')]){delete _0x500590[_0x3002('0x3e')];}_0x3e1df8['status'](_0x142cb2)['send'](_0x500590);};}exports[_0x3002('0x3f')]=function(_0x2015c6,_0x8f1ce1){var _0x57fc3d={},_0x948e47={},_0x1aaba0={'count':0x0,'rows':[]};var _0x3299a1=_[_0x3002('0x40')](db[_0x3002('0x41')]['rawAttributes'],function(_0x455b1e){return{'name':_0x455b1e[_0x3002('0x42')],'type':_0x455b1e[_0x3002('0x43')][_0x3002('0x44')]};});_0x948e47[_0x3002('0x45')]=_[_0x3002('0x40')](_0x3299a1,_0x3002('0x3e'));_0x948e47['query']=_['keys'](_0x2015c6[_0x3002('0x46')]);_0x948e47[_0x3002('0x47')]=_[_0x3002('0x48')](_0x948e47[_0x3002('0x45')],_0x948e47[_0x3002('0x46')]);_0x57fc3d['attributes']=_[_0x3002('0x48')](_0x948e47['model'],qs['fields'](_0x2015c6[_0x3002('0x46')][_0x3002('0x49')]));_0x57fc3d['attributes']=_0x57fc3d[_0x3002('0x4a')][_0x3002('0x4b')]?_0x57fc3d[_0x3002('0x4a')]:_0x948e47[_0x3002('0x45')];if(!_0x2015c6['query']['hasOwnProperty'](_0x3002('0x4c'))){_0x57fc3d['limit']=qs[_0x3002('0x34')](_0x2015c6['query'][_0x3002('0x34')]);_0x57fc3d[_0x3002('0x32')]=qs[_0x3002('0x32')](_0x2015c6[_0x3002('0x46')][_0x3002('0x32')]);}_0x57fc3d['order']=qs[_0x3002('0x4d')](_0x2015c6[_0x3002('0x46')][_0x3002('0x4d')]);_0x57fc3d['where']=qs[_0x3002('0x47')](_[_0x3002('0x4e')](_0x2015c6[_0x3002('0x46')],_0x948e47['filters']),_0x3299a1);if(_0x2015c6[_0x3002('0x46')][_0x3002('0x4f')]){_0x57fc3d[_0x3002('0x50')]=_[_0x3002('0x51')](_0x57fc3d[_0x3002('0x50')],{'$or':_[_0x3002('0x40')](_0x3299a1,function(_0x2677f9){if(_0x2677f9[_0x3002('0x43')]!==_0x3002('0x52')){var _0x4b3307={};_0x4b3307[_0x2677f9[_0x3002('0x3e')]]={'$like':'%'+_0x2015c6[_0x3002('0x46')][_0x3002('0x4f')]+'%'};return _0x4b3307;}})});}_0x57fc3d=_[_0x3002('0x51')]({},_0x57fc3d,_0x2015c6['options']);var _0x4add60={'where':_0x57fc3d[_0x3002('0x50')]};return db[_0x3002('0x41')][_0x3002('0x35')](_0x4add60)[_0x3002('0x3b')](function(_0x257899){_0x1aaba0[_0x3002('0x35')]=_0x257899;if(_0x2015c6[_0x3002('0x46')]['includeAll']){_0x57fc3d['include']=[{'all':!![]}];}return db[_0x3002('0x41')][_0x3002('0x53')](_0x57fc3d);})[_0x3002('0x3b')](function(_0x1edc43){_0x1aaba0[_0x3002('0x54')]=_0x1edc43;return _0x1aaba0;})[_0x3002('0x3b')](respondWithFilteredResult(_0x8f1ce1,_0x57fc3d))[_0x3002('0x2e')](handleError(_0x8f1ce1,null));};exports['show']=function(_0x324c47,_0xe58be0){var _0x2911a3={'raw':!![],'where':{'id':_0x324c47[_0x3002('0x55')]['id']}},_0x5d5106={};_0x5d5106['model']=_[_0x3002('0x56')](db[_0x3002('0x41')][_0x3002('0x57')]);_0x5d5106[_0x3002('0x46')]=_[_0x3002('0x56')](_0x324c47['query']);_0x5d5106['filters']=_[_0x3002('0x48')](_0x5d5106['model'],_0x5d5106[_0x3002('0x46')]);_0x2911a3[_0x3002('0x4a')]=_[_0x3002('0x48')](_0x5d5106[_0x3002('0x45')],qs[_0x3002('0x49')](_0x324c47[_0x3002('0x46')]['fields']));_0x2911a3['attributes']=_0x2911a3['attributes'][_0x3002('0x4b')]?_0x2911a3['attributes']:_0x5d5106[_0x3002('0x45')];if(_0x324c47[_0x3002('0x46')][_0x3002('0x58')]){_0x2911a3[_0x3002('0x59')]=[{'all':!![]}];}_0x2911a3=_[_0x3002('0x51')]({},_0x2911a3,_0x324c47[_0x3002('0x5a')]);return db['ChatQueue'][_0x3002('0x5b')](_0x2911a3)[_0x3002('0x3b')](handleEntityNotFound(_0xe58be0,null))[_0x3002('0x3b')](respondWithResult(_0xe58be0,null))[_0x3002('0x2e')](handleError(_0xe58be0,null));};exports[_0x3002('0x5c')]=function(_0xf9e909,_0x5260da){return db['ChatQueue']['create'](_0xf9e909[_0x3002('0x5d')],{})[_0x3002('0x3b')](function(_0x154e1f){var _0x2391e2=_0xf9e909[_0x3002('0x5e')][_0x3002('0x5f')]({'plain':!![]});if(!_0x2391e2)throw new Error(_0x3002('0x60'));if(_0x2391e2[_0x3002('0x61')]===_0x3002('0x5e')){var _0x24b23b=_0x154e1f[_0x3002('0x5f')]({'plain':!![]});var _0x4b9916=_0x3002('0x3c');return db[_0x3002('0x62')][_0x3002('0x5b')]({'where':{'name':_0x4b9916,'userProfileId':_0x2391e2[_0x3002('0x63')]},'raw':!![]})['then'](function(_0xedb879){if(_0xedb879&&_0xedb879['autoAssociation']===0x0){return db[_0x3002('0x3d')][_0x3002('0x5c')]({'name':_0x24b23b['name'],'resourceId':_0x24b23b['id'],'type':_0xedb879[_0x3002('0x3e')],'sectionId':_0xedb879['id']},{})[_0x3002('0x3b')](function(){return _0x154e1f;});}else{return _0x154e1f;}})[_0x3002('0x2e')](function(_0x5d27a8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d27a8);throw _0x5d27a8;});}return _0x154e1f;})[_0x3002('0x3b')](respondWithResult(_0x5260da,0xc9))['catch'](handleError(_0x5260da,null));};exports['update']=function(_0x557e38,_0x147801){if(_0x557e38['body']['id']){delete _0x557e38[_0x3002('0x5d')]['id'];}return db[_0x3002('0x41')][_0x3002('0x5b')]({'where':{'id':_0x557e38[_0x3002('0x55')]['id']}})[_0x3002('0x3b')](handleEntityNotFound(_0x147801,null))['then'](saveUpdates(_0x557e38[_0x3002('0x5d')],null))[_0x3002('0x3b')](respondWithResult(_0x147801,null))[_0x3002('0x2e')](handleError(_0x147801,null));};exports[_0x3002('0x3a')]=function(_0x37ff46,_0xffdcd4){return db[_0x3002('0x41')][_0x3002('0x5b')]({'where':{'id':_0x37ff46[_0x3002('0x55')]['id']}})[_0x3002('0x3b')](handleEntityNotFound(_0xffdcd4,null))[_0x3002('0x3b')](removeEntity(_0xffdcd4,null))[_0x3002('0x2e')](handleError(_0xffdcd4,null));};exports[_0x3002('0x64')]=function(_0x2c5f73,_0x52847c){return db[_0x3002('0x41')][_0x3002('0x64')]()[_0x3002('0x3b')](respondWithResult(_0x52847c,null))[_0x3002('0x2e')](handleError(_0x52847c,null));};exports[_0x3002('0x65')]=function(_0x432de9,_0x3c6364,_0x3d8365){var _0x21e240={'raw':!![],'where':{}},_0x36796e={},_0x1f09d8;return db[_0x3002('0x41')][_0x3002('0x66')]({'where':{'id':_0x432de9['params']['id']}})['then'](handleEntityNotFound(_0x3c6364,null))['then'](function(_0x130726){if(_0x130726){_0x1f09d8=_0x130726[_0x3002('0x5f')]({'plain':!![]});_0x36796e[_0x3002('0x45')]=_[_0x3002('0x56')](db[_0x3002('0x67')][_0x3002('0x57')]);_0x36796e[_0x3002('0x46')]=_[_0x3002('0x56')](_0x432de9[_0x3002('0x46')]);_0x36796e[_0x3002('0x47')]=_[_0x3002('0x48')](_0x36796e['model'],_0x36796e[_0x3002('0x46')]);_0x21e240[_0x3002('0x4a')]=_[_0x3002('0x48')](_0x36796e[_0x3002('0x45')],qs['fields'](_0x432de9[_0x3002('0x46')]['fields']));_0x21e240[_0x3002('0x4a')]=_0x21e240[_0x3002('0x4a')]['length']?_0x21e240[_0x3002('0x4a')]:_0x36796e['model'];if(!_0x432de9['query'][_0x3002('0x68')](_0x3002('0x4c'))){_0x21e240[_0x3002('0x34')]=qs[_0x3002('0x34')](_0x432de9[_0x3002('0x46')][_0x3002('0x34')]);_0x21e240['offset']=qs['offset'](_0x432de9['query']['offset']);}_0x21e240[_0x3002('0x69')]=qs[_0x3002('0x4d')](_0x432de9[_0x3002('0x46')][_0x3002('0x4d')]);_0x21e240[_0x3002('0x50')]=qs[_0x3002('0x47')](_[_0x3002('0x4e')](_0x432de9['query'],_0x36796e[_0x3002('0x47')]));_0x21e240[_0x3002('0x50')][_0x3002('0x6a')]=_0x130726['id'];if(_0x432de9[_0x3002('0x46')][_0x3002('0x4f')]){_0x21e240[_0x3002('0x50')]=_[_0x3002('0x51')](_0x21e240[_0x3002('0x50')],{'$or':_[_0x3002('0x40')](_0x21e240[_0x3002('0x4a')],function(_0x346cb4){var _0x14c501={};_0x14c501[_0x346cb4]={'$like':'%'+_0x432de9[_0x3002('0x46')][_0x3002('0x4f')]+'%'};return _0x14c501;})});}_0x21e240=_[_0x3002('0x51')]({},_0x21e240,_0x432de9[_0x3002('0x5a')]);return db['UserChatQueue'][_0x3002('0x53')](_0x21e240);}})['then'](function(_0x12bf31){if(_0x12bf31){return db[_0x3002('0x6b')][_0x3002('0x6c')]({'where':{'id':_[_0x3002('0x40')](_0x12bf31,_0x3002('0x6d')),'role':_0x3002('0x6e')},'attributes':['id',_0x3002('0x3e'),_0x3002('0x6f'),_0x3002('0x70'),_0x3002('0x71')]});}})[_0x3002('0x3b')](function(_0xf38b69){if(_0xf38b69){return{'count':_0xf38b69[_0x3002('0x35')],'rows':_[_0x3002('0x40')](_0xf38b69[_0x3002('0x54')],function(_0x4fafd7){return{'membername':_0x4fafd7['name'],'UserId':_0x4fafd7['id'],'queue_name':_0x1f09d8['name'],'ChatQueueId':_0x1f09d8['id'],'interface':util['format'](_0x3002('0x72'),_0x3002('0x73'),_0x4fafd7[_0x3002('0x3e')]),'penalty':0x0,'paused':_0x4fafd7[_0x3002('0x6f')],'createdAt':_0x4fafd7[_0x3002('0x71')],'updatedAt':_0x4fafd7[_0x3002('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3002('0x3b')](respondWithFilteredResult(_0x3c6364,_0x21e240))[_0x3002('0x2e')](handleError(_0x3c6364,null));};exports[_0x3002('0x74')]=function(_0x6ca777,_0x3244fa,_0x2988ad){var _0x2d7d2={};var _0x320b8d={};var _0x300cbf;var _0x3588c9;return db[_0x3002('0x41')][_0x3002('0x66')]({'where':{'id':_0x6ca777[_0x3002('0x55')]['id']}})['then'](handleEntityNotFound(_0x3244fa,null))[_0x3002('0x3b')](function(_0x304015){if(_0x304015){_0x300cbf=_0x304015;_0x320b8d[_0x3002('0x45')]=_['keys'](db['Team'][_0x3002('0x57')]);_0x320b8d['query']=_['keys'](_0x6ca777[_0x3002('0x46')]);_0x320b8d[_0x3002('0x47')]=_['intersection'](_0x320b8d[_0x3002('0x45')],_0x320b8d['query']);_0x2d7d2['attributes']=_[_0x3002('0x48')](_0x320b8d[_0x3002('0x45')],qs[_0x3002('0x49')](_0x6ca777[_0x3002('0x46')][_0x3002('0x49')]));_0x2d7d2[_0x3002('0x4a')]=_0x2d7d2['attributes'][_0x3002('0x4b')]?_0x2d7d2[_0x3002('0x4a')]:_0x320b8d['model'];_0x2d7d2[_0x3002('0x69')]=qs[_0x3002('0x4d')](_0x6ca777[_0x3002('0x46')][_0x3002('0x4d')]);_0x2d7d2['where']=qs[_0x3002('0x47')](_[_0x3002('0x4e')](_0x6ca777[_0x3002('0x46')],_0x320b8d[_0x3002('0x47')]));if(_0x6ca777[_0x3002('0x46')][_0x3002('0x4f')]){_0x2d7d2[_0x3002('0x50')]=_['merge'](_0x2d7d2[_0x3002('0x50')],{'$or':_[_0x3002('0x40')](_0x2d7d2[_0x3002('0x4a')],function(_0x1ddd56){var _0x19d21d={};_0x19d21d[_0x1ddd56]={'$like':'%'+_0x6ca777['query'][_0x3002('0x4f')]+'%'};return _0x19d21d;})});}_0x2d7d2=_['merge']({},_0x2d7d2,_0x6ca777[_0x3002('0x5a')]);return _0x300cbf[_0x3002('0x74')](_0x2d7d2);}})[_0x3002('0x3b')](function(_0x455f61){if(_0x455f61){_0x3588c9=_0x455f61[_0x3002('0x4b')];if(!_0x6ca777['query'][_0x3002('0x68')]('nolimit')){_0x2d7d2[_0x3002('0x34')]=qs[_0x3002('0x34')](_0x6ca777['query'][_0x3002('0x34')]);_0x2d7d2['offset']=qs[_0x3002('0x32')](_0x6ca777[_0x3002('0x46')][_0x3002('0x32')]);}return _0x300cbf[_0x3002('0x74')](_0x2d7d2);}})['then'](function(_0xb34c22){if(_0xb34c22){return _0xb34c22?{'count':_0x3588c9,'rows':_0xb34c22}:null;}})[_0x3002('0x3b')](respondWithResult(_0x3244fa,null))[_0x3002('0x2e')](handleError(_0x3244fa,null));};exports[_0x3002('0x75')]=function(_0x6eba4d,_0x2aa036,_0x55d64e){var _0x163910=_0x6eba4d[_0x3002('0x5d')][_0x3002('0x76')];return db[_0x3002('0x77')][_0x3002('0x53')]({'where':{'id':_0x163910},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3002('0x78'),'attributes':['id',_0x3002('0x3e'),'online',_0x3002('0x79'),_0x3002('0x7a')],'raw':!![]}]})[_0x3002('0x3b')](function(_0xc32dd8){if(_0xc32dd8){var _0x589ba1=_[_0x3002('0x7b')](_0xc32dd8,function(_0x417256){var _0x285afe=_0x417256[_0x3002('0x5f')]({'plain':!![]});return _0x285afe[_0x3002('0x78')];});return db[_0x3002('0x41')][_0x3002('0x5b')]({'where':{'id':_0x6eba4d[_0x3002('0x55')]['id']}})[_0x3002('0x3b')](function(_0x354539){return db[_0x3002('0x7c')][_0x3002('0x7d')](function(_0x414b0d){return _0x354539['addTeams'](_0x163910,{'transaction':_0x414b0d})[_0x3002('0x3b')](function(){return BPromise[_0x3002('0x7e')](_0x589ba1,function(_0x8d73cd){return db[_0x3002('0x67')][_0x3002('0x7f')]({'where':{'UserId':_0x8d73cd['id'],'ChatQueueId':_0x6eba4d[_0x3002('0x55')]['id']},'transaction':_0x414b0d});});})[_0x3002('0x3b')](function(){_0x589ba1[_0x3002('0x80')](function(_0x491b24){socket[_0x3002('0x81')](_0x3002('0x82'),{'UserId':_0x491b24['id'],'ChatQueueId':_0x354539['id']});});});});});}})[_0x3002('0x3b')](respondWithStatusCode(_0x2aa036,null))[_0x3002('0x2e')](handleError(_0x2aa036,null));};exports[_0x3002('0x83')]=function(_0x3681f3,_0x2816ef,_0x4b3385){return db['Team'][_0x3002('0x53')]({'where':{'id':_0x3681f3[_0x3002('0x46')][_0x3002('0x76')]},'attributes':['id'],'include':[{'model':db[_0x3002('0x6b')],'as':_0x3002('0x78'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2816ef,null))[_0x3002('0x3b')](function(_0x9884e9){var _0x592115=_[_0x3002('0x40')](_0x9884e9,'id');var _0x17cdbf=[];var _0x227f1a=[];var _0x3d3586=squel[_0x3002('0x84')]();_0x3d3586[_0x3002('0x85')](_0x3002('0x86'))[_0x3002('0x87')](_0x3002('0x88'),'tq')[_0x3002('0x89')](_0x3002('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3002('0x50')](_0x3002('0x8b'),_0x3681f3[_0x3002('0x55')]['id']);for(var _0x1a241b=0x0;_0x1a241b<_0x9884e9['length'];_0x1a241b+=0x1){let _0x6af048=_0x9884e9[_0x1a241b];for(var _0x1ca400=0x0;_0x1ca400<_0x6af048['Agents'][_0x3002('0x4b')];_0x1ca400+=0x1){let _0x3cbac9=_0x6af048[_0x3002('0x78')][_0x1ca400];var _0x332be2=_0x3d3586[_0x3002('0x8c')]();_0x332be2[_0x3002('0x50')](_0x3002('0x8d'),_0x3cbac9['id']);_0x227f1a[_0x3002('0x8e')](db[_0x3002('0x7c')][_0x3002('0x46')](_0x332be2[_0x3002('0x8f')](),{'type':db[_0x3002('0x7c')]['QueryTypes'][_0x3002('0x90')]})[_0x3002('0x3b')](function(_0xa3abb6){if(_0xa3abb6['length']===0x1){return _0x3cbac9['id'];}else{var _0x46083e=_[_0x3002('0x91')](_[_0x3002('0x40')](_0xa3abb6,_0x3002('0x92')),function(_0x43dada){return _[_0x3002('0x93')](_0x592115,_0x43dada);});if(_0x46083e){return _0x3cbac9['id'];}}}));}}return BPromise[_0x3002('0x94')](_0x227f1a)['then'](function(_0x3d1bbb){_0x17cdbf=_(_0x17cdbf)[_0x3002('0x95')](_0x3d1bbb)['compact']()[_0x3002('0x96')]();return db['ChatQueue'][_0x3002('0x5b')]({'where':{'id':_0x3681f3[_0x3002('0x55')]['id']}})['then'](function(_0x2ff040){return db[_0x3002('0x7c')]['transaction'](function(_0x2795dd){return _0x2ff040['removeTeams'](_0x3681f3[_0x3002('0x46')]['ids'],{'transaction':_0x2795dd})[_0x3002('0x3b')](function(){if(!_[_0x3002('0x97')](_0x17cdbf)){return _0x2ff040[_0x3002('0x98')](_0x17cdbf,{'transaction':_0x2795dd});}})[_0x3002('0x3b')](function(){_0x17cdbf[_0x3002('0x80')](function(_0x15d92b){socket[_0x3002('0x81')](_0x3002('0x99'),{'UserId':_0x15d92b,'ChatQueueId':_0x2ff040['id']});});});});});});})['then'](respondWithStatusCode(_0x2816ef,null))['catch'](handleError(_0x2816ef,null));};exports[_0x3002('0x9a')]=function(_0x1db98d,_0x5f2985,_0x186914){return db[_0x3002('0x41')][_0x3002('0x5b')]({'where':{'id':_0x1db98d[_0x3002('0x55')]['id']}})[_0x3002('0x3b')](handleEntityNotFound(_0x5f2985,null))['then'](function(_0x275230){if(_0x275230){return _0x275230[_0x3002('0x9a')](_0x1db98d[_0x3002('0x5d')][_0x3002('0x76')],_[_0x3002('0x9b')](_0x1db98d[_0x3002('0x5d')],[_0x3002('0x76'),'id'])||{})[_0x3002('0x9c')](function(_0x3f87e3){for(var _0x298e7b=0x0;_0x298e7b<_0x1db98d[_0x3002('0x5d')]['ids'][_0x3002('0x4b')];_0x298e7b+=0x1){socket[_0x3002('0x81')]('userChatQueue:save',{'UserId':Number(_0x1db98d[_0x3002('0x5d')][_0x3002('0x76')][_0x298e7b]),'ChatQueueId':Number(_0x1db98d[_0x3002('0x55')]['id'])});}return _0x3f87e3;});}})[_0x3002('0x3b')](respondWithResult(_0x5f2985,null))[_0x3002('0x2e')](handleError(_0x5f2985,null));};exports[_0x3002('0x98')]=function(_0x29f3f1,_0x1beece,_0x5c53b6){return db[_0x3002('0x41')][_0x3002('0x5b')]({'where':{'id':_0x29f3f1['params']['id']}})['then'](handleEntityNotFound(_0x1beece,null))[_0x3002('0x3b')](function(_0x4ab011){if(_0x4ab011){return _0x4ab011['removeAgents'](_0x29f3f1[_0x3002('0x46')][_0x3002('0x76')])['then'](function(){if(_[_0x3002('0x9d')](_0x29f3f1[_0x3002('0x46')][_0x3002('0x76')])){for(var _0x6a4620=0x0;_0x6a4620<_0x29f3f1[_0x3002('0x46')][_0x3002('0x76')]['length'];_0x6a4620+=0x1){socket[_0x3002('0x81')]('userChatQueue:remove',{'UserId':Number(_0x29f3f1[_0x3002('0x46')][_0x3002('0x76')][_0x6a4620]),'ChatQueueId':Number(_0x29f3f1['params']['id'])});}}else{socket[_0x3002('0x81')](_0x3002('0x99'),{'UserId':Number(_0x29f3f1[_0x3002('0x46')][_0x3002('0x76')]),'ChatQueueId':Number(_0x29f3f1[_0x3002('0x55')]['id'])});}});}})[_0x3002('0x3b')](respondWithStatusCode(_0x1beece,null))['catch'](handleError(_0x1beece,null));};exports[_0x3002('0x9e')]=function(_0x232226,_0x1ff277,_0x1c67ff){var _0x58405d={};var _0x14f452={};var _0x5742c9;var _0x4cf669;return db[_0x3002('0x41')][_0x3002('0x66')]({'where':{'id':_0x232226[_0x3002('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ff277,null))[_0x3002('0x3b')](function(_0x539dfe){if(_0x539dfe){_0x5742c9=_0x539dfe;_0x14f452[_0x3002('0x45')]=_[_0x3002('0x56')](db[_0x3002('0x6b')][_0x3002('0x57')]);_0x14f452[_0x3002('0x46')]=_[_0x3002('0x56')](_0x232226['query']);_0x14f452['filters']=_['intersection'](_0x14f452[_0x3002('0x45')],_0x14f452[_0x3002('0x46')]);_0x58405d[_0x3002('0x4a')]=_[_0x3002('0x48')](_0x14f452[_0x3002('0x45')],qs[_0x3002('0x49')](_0x232226['query'][_0x3002('0x49')]));_0x58405d[_0x3002('0x4a')]=_0x58405d[_0x3002('0x4a')][_0x3002('0x4b')]?_0x58405d[_0x3002('0x4a')]:_0x14f452['model'];_0x58405d[_0x3002('0x69')]=qs[_0x3002('0x4d')](_0x232226['query'][_0x3002('0x4d')]);_0x58405d['where']=qs[_0x3002('0x47')](_[_0x3002('0x4e')](_0x232226[_0x3002('0x46')],_0x14f452[_0x3002('0x47')]));if(_0x232226[_0x3002('0x46')][_0x3002('0x4f')]){_0x58405d['where']=_[_0x3002('0x51')](_0x58405d[_0x3002('0x50')],{'$or':_['map'](_0x58405d[_0x3002('0x4a')],function(_0x4629b7){var _0x16791a={};_0x16791a[_0x4629b7]={'$like':'%'+_0x232226[_0x3002('0x46')][_0x3002('0x4f')]+'%'};return _0x16791a;})});}_0x58405d=_[_0x3002('0x51')]({},_0x58405d,_0x232226[_0x3002('0x5a')]);return _0x5742c9['getAgents'](_0x58405d);}})[_0x3002('0x3b')](function(_0xfe3d6a){if(_0xfe3d6a){_0x4cf669=_0xfe3d6a[_0x3002('0x4b')];if(!_0x232226[_0x3002('0x46')][_0x3002('0x68')](_0x3002('0x4c'))){_0x58405d[_0x3002('0x34')]=qs[_0x3002('0x34')](_0x232226[_0x3002('0x46')][_0x3002('0x34')]);_0x58405d[_0x3002('0x32')]=qs[_0x3002('0x32')](_0x232226[_0x3002('0x46')][_0x3002('0x32')]);}return _0x5742c9[_0x3002('0x9e')](_0x58405d);}})[_0x3002('0x3b')](function(_0x1f8fa4){if(_0x1f8fa4){return _0x1f8fa4?{'count':_0x4cf669,'rows':_0x1f8fa4}:null;}})[_0x3002('0x3b')](respondWithResult(_0x1ff277,null))[_0x3002('0x2e')](handleError(_0x1ff277,null));}; \ No newline at end of file +var _0x4627=['key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','ChatQueue','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','pick','ChatQueueId','UserChatQueue','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x4bacdc,_0x5d6cf0){var _0x5dd5cb=function(_0x7ecdbb){while(--_0x7ecdbb){_0x4bacdc['push'](_0x4bacdc['shift']());}};_0x5dd5cb(++_0x5d6cf0);}(_0x4627,0x188));var _0x7462=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4627[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7462('0x3'));var moment=require(_0x7462('0x4'));var BPromise=require(_0x7462('0x5'));var Mustache=require(_0x7462('0x6'));var util=require(_0x7462('0x7'));var path=require(_0x7462('0x8'));var sox=require(_0x7462('0x9'));var csv=require('to-csv');var ejs=require(_0x7462('0xa'));var fs=require('fs');var fs_extra=require(_0x7462('0xb'));var _=require(_0x7462('0xc'));var squel=require(_0x7462('0xd'));var crypto=require(_0x7462('0xe'));var jsforce=require(_0x7462('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7462('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7462('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7462('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7462('0x13'));var config=require(_0x7462('0x14'));var licenseUtil=require(_0x7462('0x15'));var db=require(_0x7462('0x16'))['db'];config[_0x7462('0x17')]=_[_0x7462('0x18')](config[_0x7462('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7462('0x19'))(new Redis(config[_0x7462('0x17')]));require(_0x7462('0x1a'))[_0x7462('0x1b')](socket);var jayson=require(_0x7462('0x1c'));var client=jayson[_0x7462('0x1d')][_0x7462('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5a283d,_0x4eab87,_0x4bdeea,_0x30e3ce){return new BPromise(function(_0x3a7a32,_0x2c85c3){var _0x1c3e7c=_0x30e3ce||client;return _0x1c3e7c[_0x7462('0x1f')](_0x5a283d,_0x4bdeea)[_0x7462('0x20')](function(_0x5473d5){logger[_0x7462('0x21')](_0x7462('0x22'),_0x4eab87,'request\x20sent');logger[_0x7462('0x23')](_0x7462('0x24'),_0x4eab87,'request\x20sent',JSON[_0x7462('0x25')](_0x5473d5));if(_0x5473d5[_0x7462('0x26')]){if(_0x5473d5[_0x7462('0x26')][_0x7462('0x27')]===0x1f4){logger[_0x7462('0x26')](_0x7462('0x22'),_0x4eab87,_0x5473d5[_0x7462('0x26')][_0x7462('0x28')]);return _0x2c85c3(_0x5473d5[_0x7462('0x26')]['message']);}logger[_0x7462('0x26')](_0x7462('0x22'),_0x4eab87,_0x5473d5['error'][_0x7462('0x28')]);return _0x3a7a32(_0x5473d5['error'][_0x7462('0x28')]);}else{logger[_0x7462('0x21')](_0x7462('0x22'),_0x4eab87,_0x7462('0x29'));_0x3a7a32(_0x5473d5[_0x7462('0x2a')][_0x7462('0x28')]);}})[_0x7462('0x2b')](function(_0x117536){logger[_0x7462('0x26')](_0x7462('0x22'),_0x4eab87,_0x117536);_0x2c85c3(_0x117536);});});}function respondWithStatusCode(_0x38d843,_0xbefb35){_0xbefb35=_0xbefb35||0xcc;return function(_0x967d1){if(_0x967d1){return _0x38d843[_0x7462('0x2c')](_0xbefb35);}return _0x38d843[_0x7462('0x2d')](_0xbefb35)['end']();};}function respondWithResult(_0x184e18,_0x346346){_0x346346=_0x346346||0xc8;return function(_0x55382f){if(_0x55382f){return _0x184e18['status'](_0x346346)[_0x7462('0x2e')](_0x55382f);}};}function respondWithFilteredResult(_0x17c671,_0x37e5a5){return function(_0x4d064f){if(_0x4d064f){var _0x4ff0bb=typeof _0x37e5a5[_0x7462('0x2f')]===_0x7462('0x30')&&typeof _0x37e5a5[_0x7462('0x31')]===_0x7462('0x30');var _0x1aea99=_0x4d064f[_0x7462('0x32')];var _0x557b71=_0x4ff0bb?0x0:_0x37e5a5[_0x7462('0x2f')];var _0x59d968=_0x4ff0bb?_0x4d064f['count']:_0x37e5a5[_0x7462('0x2f')]+_0x37e5a5[_0x7462('0x31')];var _0x1b228f;if(_0x59d968>=_0x1aea99){_0x59d968=_0x1aea99;_0x1b228f=0xc8;}else{_0x1b228f=0xce;}_0x17c671['status'](_0x1b228f);return _0x17c671[_0x7462('0x33')](_0x7462('0x34'),_0x557b71+'-'+_0x59d968+'/'+_0x1aea99)[_0x7462('0x2e')](_0x4d064f);}return null;};}function patchUpdates(_0x18c907){return function(_0x560db8){try{jsonpatch['apply'](_0x560db8,_0x18c907,!![]);}catch(_0x2f47e1){return BPromise[_0x7462('0x35')](_0x2f47e1);}return _0x560db8[_0x7462('0x36')]();};}function saveUpdates(_0x3e622f,_0x48835c){return function(_0x23fb6c){if(_0x23fb6c){return _0x23fb6c[_0x7462('0x37')](_0x3e622f)[_0x7462('0x20')](function(_0x4558fe){return _0x4558fe;});}return null;};}function removeEntity(_0x18fcee,_0x3d48ea){return function(_0x35ccee){if(_0x35ccee){return _0x35ccee[_0x7462('0x38')]()[_0x7462('0x20')](function(){var _0x2d5471=_0x35ccee[_0x7462('0x39')]({'plain':!![]});var _0xe29c8f='ChatQueues';return db[_0x7462('0x3a')][_0x7462('0x38')]({'where':{'type':_0xe29c8f,'resourceId':_0x2d5471['id']}})['then'](function(){return _0x35ccee;});})['then'](function(){_0x18fcee[_0x7462('0x2d')](0xcc)[_0x7462('0x3b')]();});}};}function handleEntityNotFound(_0x8a8a2d,_0x3350a6){return function(_0x3f48a8){if(!_0x3f48a8){_0x8a8a2d[_0x7462('0x2c')](0x194);}return _0x3f48a8;};}function handleError(_0x2f50ee,_0x36e9f7){_0x36e9f7=_0x36e9f7||0x1f4;return function(_0x1c3ede){logger[_0x7462('0x26')](_0x1c3ede[_0x7462('0x3c')]);if(_0x1c3ede[_0x7462('0x3d')]){delete _0x1c3ede[_0x7462('0x3d')];}_0x2f50ee[_0x7462('0x2d')](_0x36e9f7)[_0x7462('0x3e')](_0x1c3ede);};}exports[_0x7462('0x3f')]=function(_0x5b8ced,_0x5af497){var _0x574f50={},_0x446ac3={},_0x52c6be={'count':0x0,'rows':[]};var _0x229077=_[_0x7462('0x40')](db['ChatQueue'][_0x7462('0x41')],function(_0x4abb2c){return{'name':_0x4abb2c[_0x7462('0x42')],'type':_0x4abb2c['type'][_0x7462('0x43')]};});_0x446ac3[_0x7462('0x44')]=_['map'](_0x229077,_0x7462('0x3d'));_0x446ac3[_0x7462('0x45')]=_[_0x7462('0x46')](_0x5b8ced[_0x7462('0x45')]);_0x446ac3['filters']=_[_0x7462('0x47')](_0x446ac3['model'],_0x446ac3['query']);_0x574f50[_0x7462('0x48')]=_['intersection'](_0x446ac3[_0x7462('0x44')],qs[_0x7462('0x49')](_0x5b8ced['query'][_0x7462('0x49')]));_0x574f50[_0x7462('0x48')]=_0x574f50['attributes'][_0x7462('0x4a')]?_0x574f50[_0x7462('0x48')]:_0x446ac3[_0x7462('0x44')];if(!_0x5b8ced[_0x7462('0x45')]['hasOwnProperty'](_0x7462('0x4b'))){_0x574f50[_0x7462('0x31')]=qs[_0x7462('0x31')](_0x5b8ced[_0x7462('0x45')][_0x7462('0x31')]);_0x574f50[_0x7462('0x2f')]=qs[_0x7462('0x2f')](_0x5b8ced['query'][_0x7462('0x2f')]);}_0x574f50['order']=qs[_0x7462('0x4c')](_0x5b8ced[_0x7462('0x45')][_0x7462('0x4c')]);_0x574f50[_0x7462('0x4d')]=qs['filters'](_['pick'](_0x5b8ced[_0x7462('0x45')],_0x446ac3['filters']),_0x229077);if(_0x5b8ced[_0x7462('0x45')][_0x7462('0x4e')]){_0x574f50[_0x7462('0x4d')]=_[_0x7462('0x4f')](_0x574f50[_0x7462('0x4d')],{'$or':_[_0x7462('0x40')](_0x229077,function(_0x32ffe9){if(_0x32ffe9[_0x7462('0x50')]!==_0x7462('0x51')){var _0x2e51c9={};_0x2e51c9[_0x32ffe9[_0x7462('0x3d')]]={'$like':'%'+_0x5b8ced[_0x7462('0x45')][_0x7462('0x4e')]+'%'};return _0x2e51c9;}})});}_0x574f50=_[_0x7462('0x4f')]({},_0x574f50,_0x5b8ced[_0x7462('0x52')]);var _0xac7139={'where':_0x574f50[_0x7462('0x4d')]};return db[_0x7462('0x53')][_0x7462('0x32')](_0xac7139)['then'](function(_0x46d192){_0x52c6be['count']=_0x46d192;if(_0x5b8ced[_0x7462('0x45')]['includeAll']){_0x574f50[_0x7462('0x54')]=[{'all':!![]}];}return db[_0x7462('0x53')][_0x7462('0x55')](_0x574f50);})[_0x7462('0x20')](function(_0x595492){_0x52c6be[_0x7462('0x56')]=_0x595492;return _0x52c6be;})[_0x7462('0x20')](respondWithFilteredResult(_0x5af497,_0x574f50))[_0x7462('0x2b')](handleError(_0x5af497,null));};exports[_0x7462('0x57')]=function(_0x5cd4b7,_0x34f92e){var _0x522e57={'raw':!![],'where':{'id':_0x5cd4b7[_0x7462('0x58')]['id']}},_0x3ce5ac={};_0x3ce5ac[_0x7462('0x44')]=_[_0x7462('0x46')](db[_0x7462('0x53')][_0x7462('0x41')]);_0x3ce5ac[_0x7462('0x45')]=_[_0x7462('0x46')](_0x5cd4b7[_0x7462('0x45')]);_0x3ce5ac['filters']=_['intersection'](_0x3ce5ac[_0x7462('0x44')],_0x3ce5ac['query']);_0x522e57['attributes']=_[_0x7462('0x47')](_0x3ce5ac[_0x7462('0x44')],qs[_0x7462('0x49')](_0x5cd4b7[_0x7462('0x45')][_0x7462('0x49')]));_0x522e57[_0x7462('0x48')]=_0x522e57[_0x7462('0x48')][_0x7462('0x4a')]?_0x522e57[_0x7462('0x48')]:_0x3ce5ac['model'];if(_0x5cd4b7['query']['includeAll']){_0x522e57[_0x7462('0x54')]=[{'all':!![]}];}_0x522e57=_[_0x7462('0x4f')]({},_0x522e57,_0x5cd4b7[_0x7462('0x52')]);return db[_0x7462('0x53')][_0x7462('0x59')](_0x522e57)['then'](handleEntityNotFound(_0x34f92e,null))['then'](respondWithResult(_0x34f92e,null))['catch'](handleError(_0x34f92e,null));};exports[_0x7462('0x5a')]=function(_0x30ab77,_0x2d6662){return db[_0x7462('0x53')][_0x7462('0x5a')](_0x30ab77[_0x7462('0x5b')],{})['then'](function(_0x14371a){var _0x5ccd2c=_0x30ab77[_0x7462('0x5c')][_0x7462('0x39')]({'plain':!![]});if(!_0x5ccd2c)throw new Error(_0x7462('0x5d'));if(_0x5ccd2c[_0x7462('0x5e')]===_0x7462('0x5c')){var _0x4b41b3=_0x14371a[_0x7462('0x39')]({'plain':!![]});var _0x5e29d4='ChatQueues';return db[_0x7462('0x5f')][_0x7462('0x59')]({'where':{'name':_0x5e29d4,'userProfileId':_0x5ccd2c[_0x7462('0x60')]},'raw':!![]})[_0x7462('0x20')](function(_0x253870){if(_0x253870&&_0x253870[_0x7462('0x61')]===0x0){return db[_0x7462('0x3a')][_0x7462('0x5a')]({'name':_0x4b41b3[_0x7462('0x3d')],'resourceId':_0x4b41b3['id'],'type':_0x253870[_0x7462('0x3d')],'sectionId':_0x253870['id']},{})['then'](function(){return _0x14371a;});}else{return _0x14371a;}})[_0x7462('0x2b')](function(_0x2629ea){logger[_0x7462('0x26')](_0x7462('0x62'),_0x2629ea);throw _0x2629ea;});}return _0x14371a;})['then'](respondWithResult(_0x2d6662,0xc9))[_0x7462('0x2b')](handleError(_0x2d6662,null));};exports[_0x7462('0x37')]=function(_0x158d05,_0x1dcd83){if(_0x158d05[_0x7462('0x5b')]['id']){delete _0x158d05['body']['id'];}return db[_0x7462('0x53')]['find']({'where':{'id':_0x158d05[_0x7462('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dcd83,null))['then'](saveUpdates(_0x158d05[_0x7462('0x5b')],null))[_0x7462('0x20')](respondWithResult(_0x1dcd83,null))[_0x7462('0x2b')](handleError(_0x1dcd83,null));};exports['destroy']=function(_0x1468f4,_0x2c8e3d){return db[_0x7462('0x53')][_0x7462('0x59')]({'where':{'id':_0x1468f4['params']['id']}})[_0x7462('0x20')](handleEntityNotFound(_0x2c8e3d,null))[_0x7462('0x20')](removeEntity(_0x2c8e3d,null))[_0x7462('0x2b')](handleError(_0x2c8e3d,null));};exports[_0x7462('0x63')]=function(_0x3f558a,_0x4ddf84){return db[_0x7462('0x53')]['describe']()[_0x7462('0x20')](respondWithResult(_0x4ddf84,null))[_0x7462('0x2b')](handleError(_0x4ddf84,null));};exports[_0x7462('0x64')]=function(_0x4c572e,_0x11ed27,_0x5c7756){var _0x293728={'raw':!![],'where':{}},_0x219b17={},_0xc825bb;return db[_0x7462('0x53')][_0x7462('0x65')]({'where':{'id':_0x4c572e[_0x7462('0x58')]['id']}})[_0x7462('0x20')](handleEntityNotFound(_0x11ed27,null))[_0x7462('0x20')](function(_0x1f1fe6){if(_0x1f1fe6){_0xc825bb=_0x1f1fe6[_0x7462('0x39')]({'plain':!![]});_0x219b17[_0x7462('0x44')]=_[_0x7462('0x46')](db['UserChatQueue'][_0x7462('0x41')]);_0x219b17['query']=_[_0x7462('0x46')](_0x4c572e[_0x7462('0x45')]);_0x219b17[_0x7462('0x66')]=_[_0x7462('0x47')](_0x219b17[_0x7462('0x44')],_0x219b17[_0x7462('0x45')]);_0x293728[_0x7462('0x48')]=_[_0x7462('0x47')](_0x219b17[_0x7462('0x44')],qs[_0x7462('0x49')](_0x4c572e['query'][_0x7462('0x49')]));_0x293728['attributes']=_0x293728[_0x7462('0x48')][_0x7462('0x4a')]?_0x293728[_0x7462('0x48')]:_0x219b17[_0x7462('0x44')];if(!_0x4c572e['query']['hasOwnProperty']('nolimit')){_0x293728['limit']=qs[_0x7462('0x31')](_0x4c572e[_0x7462('0x45')][_0x7462('0x31')]);_0x293728[_0x7462('0x2f')]=qs[_0x7462('0x2f')](_0x4c572e[_0x7462('0x45')][_0x7462('0x2f')]);}_0x293728['order']=qs[_0x7462('0x4c')](_0x4c572e[_0x7462('0x45')][_0x7462('0x4c')]);_0x293728[_0x7462('0x4d')]=qs[_0x7462('0x66')](_[_0x7462('0x67')](_0x4c572e[_0x7462('0x45')],_0x219b17[_0x7462('0x66')]));_0x293728['where'][_0x7462('0x68')]=_0x1f1fe6['id'];if(_0x4c572e[_0x7462('0x45')][_0x7462('0x4e')]){_0x293728[_0x7462('0x4d')]=_['merge'](_0x293728['where'],{'$or':_[_0x7462('0x40')](_0x293728[_0x7462('0x48')],function(_0x173c4e){var _0x3bea61={};_0x3bea61[_0x173c4e]={'$like':'%'+_0x4c572e['query']['filter']+'%'};return _0x3bea61;})});}_0x293728=_[_0x7462('0x4f')]({},_0x293728,_0x4c572e[_0x7462('0x52')]);return db[_0x7462('0x69')][_0x7462('0x55')](_0x293728);}})[_0x7462('0x20')](function(_0x2326f9){if(_0x2326f9){return db[_0x7462('0x6a')][_0x7462('0x6b')]({'where':{'id':_['map'](_0x2326f9,'UserId'),'role':_0x7462('0x6c')},'attributes':['id',_0x7462('0x3d'),_0x7462('0x6d'),_0x7462('0x6e'),_0x7462('0x6f')]});}})['then'](function(_0x1faf99){if(_0x1faf99){return{'count':_0x1faf99['count'],'rows':_['map'](_0x1faf99[_0x7462('0x56')],function(_0x208241){return{'membername':_0x208241[_0x7462('0x3d')],'UserId':_0x208241['id'],'queue_name':_0xc825bb['name'],'ChatQueueId':_0xc825bb['id'],'interface':util[_0x7462('0x70')](_0x7462('0x71'),_0x7462('0x72'),_0x208241[_0x7462('0x3d')]),'penalty':0x0,'paused':_0x208241['chatPause'],'createdAt':_0x208241['createdAt'],'updatedAt':_0x208241[_0x7462('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7462('0x20')](respondWithFilteredResult(_0x11ed27,_0x293728))[_0x7462('0x2b')](handleError(_0x11ed27,null));};exports[_0x7462('0x73')]=function(_0x5e07b6,_0x5a0ec4,_0x3797f2){var _0x4118f3={};var _0x52e3aa={};var _0x4e5446;var _0x4eb6ba;return db[_0x7462('0x53')][_0x7462('0x65')]({'where':{'id':_0x5e07b6[_0x7462('0x58')]['id']}})[_0x7462('0x20')](handleEntityNotFound(_0x5a0ec4,null))[_0x7462('0x20')](function(_0x160b14){if(_0x160b14){_0x4e5446=_0x160b14;_0x52e3aa[_0x7462('0x44')]=_[_0x7462('0x46')](db[_0x7462('0x74')]['rawAttributes']);_0x52e3aa[_0x7462('0x45')]=_['keys'](_0x5e07b6['query']);_0x52e3aa['filters']=_['intersection'](_0x52e3aa[_0x7462('0x44')],_0x52e3aa[_0x7462('0x45')]);_0x4118f3[_0x7462('0x48')]=_[_0x7462('0x47')](_0x52e3aa[_0x7462('0x44')],qs[_0x7462('0x49')](_0x5e07b6['query'][_0x7462('0x49')]));_0x4118f3[_0x7462('0x48')]=_0x4118f3['attributes'][_0x7462('0x4a')]?_0x4118f3[_0x7462('0x48')]:_0x52e3aa['model'];_0x4118f3[_0x7462('0x75')]=qs['sort'](_0x5e07b6[_0x7462('0x45')]['sort']);_0x4118f3['where']=qs[_0x7462('0x66')](_[_0x7462('0x67')](_0x5e07b6[_0x7462('0x45')],_0x52e3aa[_0x7462('0x66')]));if(_0x5e07b6[_0x7462('0x45')][_0x7462('0x4e')]){_0x4118f3['where']=_['merge'](_0x4118f3[_0x7462('0x4d')],{'$or':_['map'](_0x4118f3[_0x7462('0x48')],function(_0x19ff56){var _0x3d4ecc={};_0x3d4ecc[_0x19ff56]={'$like':'%'+_0x5e07b6[_0x7462('0x45')][_0x7462('0x4e')]+'%'};return _0x3d4ecc;})});}_0x4118f3=_[_0x7462('0x4f')]({},_0x4118f3,_0x5e07b6[_0x7462('0x52')]);return _0x4e5446[_0x7462('0x73')](_0x4118f3);}})[_0x7462('0x20')](function(_0x3d8265){if(_0x3d8265){_0x4eb6ba=_0x3d8265[_0x7462('0x4a')];if(!_0x5e07b6[_0x7462('0x45')][_0x7462('0x76')](_0x7462('0x4b'))){_0x4118f3[_0x7462('0x31')]=qs[_0x7462('0x31')](_0x5e07b6[_0x7462('0x45')]['limit']);_0x4118f3[_0x7462('0x2f')]=qs[_0x7462('0x2f')](_0x5e07b6['query']['offset']);}return _0x4e5446[_0x7462('0x73')](_0x4118f3);}})[_0x7462('0x20')](function(_0x47acd5){if(_0x47acd5){return _0x47acd5?{'count':_0x4eb6ba,'rows':_0x47acd5}:null;}})['then'](respondWithResult(_0x5a0ec4,null))[_0x7462('0x2b')](handleError(_0x5a0ec4,null));};exports['addTeams']=function(_0x52a7e1,_0x24ef29,_0x2661e0){var _0x4a9ccd=_0x52a7e1[_0x7462('0x5b')][_0x7462('0x77')];return db['Team'][_0x7462('0x55')]({'where':{'id':_0x4a9ccd},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7462('0x78'),'attributes':['id',_0x7462('0x3d'),_0x7462('0x79'),_0x7462('0x7a'),_0x7462('0x7b')],'raw':!![]}]})[_0x7462('0x20')](function(_0x50f150){if(_0x50f150){var _0x2abd0a=_[_0x7462('0x7c')](_0x50f150,function(_0x25e9ac){var _0x518925=_0x25e9ac[_0x7462('0x39')]({'plain':!![]});return _0x518925[_0x7462('0x78')];});return db[_0x7462('0x53')][_0x7462('0x59')]({'where':{'id':_0x52a7e1[_0x7462('0x58')]['id']}})['then'](function(_0x12249f){return db[_0x7462('0x7d')]['transaction'](function(_0x50bb37){return _0x12249f['addTeams'](_0x4a9ccd,{'transaction':_0x50bb37})[_0x7462('0x20')](function(){return BPromise[_0x7462('0x7e')](_0x2abd0a,function(_0x5f144a){return db[_0x7462('0x69')][_0x7462('0x7f')]({'where':{'UserId':_0x5f144a['id'],'ChatQueueId':_0x52a7e1[_0x7462('0x58')]['id']},'transaction':_0x50bb37});});})[_0x7462('0x20')](function(){_0x2abd0a[_0x7462('0x80')](function(_0x1fffa3){socket[_0x7462('0x81')]('userChatQueue:save',{'UserId':_0x1fffa3['id'],'ChatQueueId':_0x12249f['id']});});});});});}})[_0x7462('0x20')](respondWithStatusCode(_0x24ef29,null))[_0x7462('0x2b')](handleError(_0x24ef29,null));};exports[_0x7462('0x82')]=function(_0x40a284,_0x22c16b,_0x277286){return db[_0x7462('0x74')][_0x7462('0x55')]({'where':{'id':_0x40a284['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7462('0x20')](handleEntityNotFound(_0x22c16b,null))[_0x7462('0x20')](function(_0x29b2eb){var _0x591ab3=_[_0x7462('0x40')](_0x29b2eb,'id');var _0x36334f=[];var _0x54cba9=[];var _0x5ce85f=squel['select']();_0x5ce85f['field'](_0x7462('0x83'))['from'](_0x7462('0x84'),'tq')['join'](_0x7462('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7462('0x86'),_0x40a284['params']['id']);for(var _0x56ee0b=0x0;_0x56ee0b<_0x29b2eb[_0x7462('0x4a')];_0x56ee0b+=0x1){let _0x527c8c=_0x29b2eb[_0x56ee0b];for(var _0x443021=0x0;_0x443021<_0x527c8c['Agents']['length'];_0x443021+=0x1){let _0x25c36c=_0x527c8c[_0x7462('0x78')][_0x443021];var _0x51c097=_0x5ce85f[_0x7462('0x87')]();_0x51c097[_0x7462('0x4d')]('ut.UserId\x20=\x20?',_0x25c36c['id']);_0x54cba9['push'](db[_0x7462('0x7d')][_0x7462('0x45')](_0x51c097[_0x7462('0x88')](),{'type':db[_0x7462('0x7d')][_0x7462('0x89')][_0x7462('0x8a')]})['then'](function(_0x1d1dac){if(_0x1d1dac['length']===0x1){return _0x25c36c['id'];}else{var _0xeabf6=_[_0x7462('0x8b')](_['map'](_0x1d1dac,_0x7462('0x8c')),function(_0x1cc476){return _['includes'](_0x591ab3,_0x1cc476);});if(_0xeabf6){return _0x25c36c['id'];}}}));}}return BPromise['all'](_0x54cba9)[_0x7462('0x20')](function(_0x4d7e92){_0x36334f=_(_0x36334f)[_0x7462('0x8d')](_0x4d7e92)[_0x7462('0x8e')]()[_0x7462('0x8f')]();return db['ChatQueue'][_0x7462('0x59')]({'where':{'id':_0x40a284[_0x7462('0x58')]['id']}})[_0x7462('0x20')](function(_0x4cc675){return db[_0x7462('0x7d')]['transaction'](function(_0x3cca61){return _0x4cc675['removeTeams'](_0x40a284[_0x7462('0x45')][_0x7462('0x77')],{'transaction':_0x3cca61})[_0x7462('0x20')](function(){if(!_[_0x7462('0x90')](_0x36334f)){return _0x4cc675[_0x7462('0x91')](_0x36334f,{'transaction':_0x3cca61});}})[_0x7462('0x20')](function(){_0x36334f[_0x7462('0x80')](function(_0x2095dd){socket[_0x7462('0x81')](_0x7462('0x92'),{'UserId':_0x2095dd,'ChatQueueId':_0x4cc675['id']});});});});});});})[_0x7462('0x20')](respondWithStatusCode(_0x22c16b,null))[_0x7462('0x2b')](handleError(_0x22c16b,null));};exports[_0x7462('0x93')]=function(_0x472213,_0x38cab6,_0x392501){return db[_0x7462('0x53')][_0x7462('0x59')]({'where':{'id':_0x472213['params']['id']}})[_0x7462('0x20')](handleEntityNotFound(_0x38cab6,null))['then'](function(_0x3603a9){if(_0x3603a9){return _0x3603a9[_0x7462('0x93')](_0x472213[_0x7462('0x5b')][_0x7462('0x77')],_[_0x7462('0x94')](_0x472213[_0x7462('0x5b')],[_0x7462('0x77'),'id'])||{})[_0x7462('0x95')](function(_0x5335da){for(var _0xa33f9f=0x0;_0xa33f9f<_0x472213[_0x7462('0x5b')]['ids'][_0x7462('0x4a')];_0xa33f9f+=0x1){socket['emit'](_0x7462('0x96'),{'UserId':Number(_0x472213[_0x7462('0x5b')][_0x7462('0x77')][_0xa33f9f]),'ChatQueueId':Number(_0x472213[_0x7462('0x58')]['id'])});}return _0x5335da;});}})[_0x7462('0x20')](respondWithResult(_0x38cab6,null))[_0x7462('0x2b')](handleError(_0x38cab6,null));};exports[_0x7462('0x91')]=function(_0x376826,_0x5e498e,_0x372e1a){return db[_0x7462('0x53')]['find']({'where':{'id':_0x376826[_0x7462('0x58')]['id']}})[_0x7462('0x20')](handleEntityNotFound(_0x5e498e,null))[_0x7462('0x20')](function(_0x43de00){if(_0x43de00){return _0x43de00[_0x7462('0x91')](_0x376826['query'][_0x7462('0x77')])[_0x7462('0x20')](function(){if(_[_0x7462('0x97')](_0x376826[_0x7462('0x45')][_0x7462('0x77')])){for(var _0x1063ca=0x0;_0x1063ca<_0x376826['query'][_0x7462('0x77')][_0x7462('0x4a')];_0x1063ca+=0x1){socket[_0x7462('0x81')](_0x7462('0x92'),{'UserId':Number(_0x376826[_0x7462('0x45')][_0x7462('0x77')][_0x1063ca]),'ChatQueueId':Number(_0x376826['params']['id'])});}}else{socket['emit'](_0x7462('0x92'),{'UserId':Number(_0x376826[_0x7462('0x45')][_0x7462('0x77')]),'ChatQueueId':Number(_0x376826['params']['id'])});}});}})[_0x7462('0x20')](respondWithStatusCode(_0x5e498e,null))[_0x7462('0x2b')](handleError(_0x5e498e,null));};exports[_0x7462('0x98')]=function(_0x5d0b0f,_0x548a95,_0x35bc6b){var _0x57146c={};var _0x26084b={};var _0x3fb3dc;var _0x223855;return db[_0x7462('0x53')]['findOne']({'where':{'id':_0x5d0b0f[_0x7462('0x58')]['id']}})[_0x7462('0x20')](handleEntityNotFound(_0x548a95,null))['then'](function(_0x2ae572){if(_0x2ae572){_0x3fb3dc=_0x2ae572;_0x26084b[_0x7462('0x44')]=_[_0x7462('0x46')](db[_0x7462('0x6a')][_0x7462('0x41')]);_0x26084b['query']=_[_0x7462('0x46')](_0x5d0b0f[_0x7462('0x45')]);_0x26084b[_0x7462('0x66')]=_[_0x7462('0x47')](_0x26084b[_0x7462('0x44')],_0x26084b['query']);_0x57146c[_0x7462('0x48')]=_[_0x7462('0x47')](_0x26084b['model'],qs[_0x7462('0x49')](_0x5d0b0f[_0x7462('0x45')][_0x7462('0x49')]));_0x57146c[_0x7462('0x48')]=_0x57146c[_0x7462('0x48')][_0x7462('0x4a')]?_0x57146c[_0x7462('0x48')]:_0x26084b['model'];_0x57146c[_0x7462('0x75')]=qs[_0x7462('0x4c')](_0x5d0b0f['query'][_0x7462('0x4c')]);_0x57146c['where']=qs[_0x7462('0x66')](_[_0x7462('0x67')](_0x5d0b0f[_0x7462('0x45')],_0x26084b[_0x7462('0x66')]));if(_0x5d0b0f[_0x7462('0x45')][_0x7462('0x4e')]){_0x57146c['where']=_[_0x7462('0x4f')](_0x57146c[_0x7462('0x4d')],{'$or':_[_0x7462('0x40')](_0x57146c[_0x7462('0x48')],function(_0x43056f){var _0x6a3afc={};_0x6a3afc[_0x43056f]={'$like':'%'+_0x5d0b0f['query'][_0x7462('0x4e')]+'%'};return _0x6a3afc;})});}_0x57146c=_['merge']({},_0x57146c,_0x5d0b0f['options']);return _0x3fb3dc[_0x7462('0x98')](_0x57146c);}})[_0x7462('0x20')](function(_0x22d570){if(_0x22d570){_0x223855=_0x22d570[_0x7462('0x4a')];if(!_0x5d0b0f[_0x7462('0x45')]['hasOwnProperty']('nolimit')){_0x57146c['limit']=qs[_0x7462('0x31')](_0x5d0b0f[_0x7462('0x45')][_0x7462('0x31')]);_0x57146c[_0x7462('0x2f')]=qs[_0x7462('0x2f')](_0x5d0b0f[_0x7462('0x45')][_0x7462('0x2f')]);}return _0x3fb3dc[_0x7462('0x98')](_0x57146c);}})[_0x7462('0x20')](function(_0x25af10){if(_0x25af10){return _0x25af10?{'count':_0x223855,'rows':_0x25af10}:null;}})[_0x7462('0x20')](respondWithResult(_0x548a95,null))[_0x7462('0x2b')](handleError(_0x548a95,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b9e9640..85de715 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 _0xa554=['events','ChatQueue','setMaxListeners','update','remove','hasOwnProperty','hook'];(function(_0x57ce09,_0x56ec9f){var _0x411aed=function(_0x30df82){while(--_0x30df82){_0x57ce09['push'](_0x57ce09['shift']());}};_0x411aed(++_0x56ec9f);}(_0xa554,0x12d));var _0x4a55=function(_0xdd5ce0,_0x28993d){_0xdd5ce0=_0xdd5ce0-0x0;var _0x367d9b=_0xa554[_0xdd5ce0];return _0x367d9b;};'use strict';var EventEmitter=require(_0x4a55('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4a55('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4a55('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4a55('0x3'),'afterDestroy':_0x4a55('0x4')};function emitEvent(_0x47d29b){return function(_0x2b1999,_0x5a5c57,_0x25ce69){ChatQueueEvents['emit'](_0x47d29b+':'+_0x2b1999['id'],_0x2b1999);ChatQueueEvents['emit'](_0x47d29b,_0x2b1999);_0x25ce69(null);};}for(var e in events){if(events[_0x4a55('0x5')](e)){var event=events[e];ChatQueue[_0x4a55('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x439f=['save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x14bdd1,_0x4e9148){var _0x4123b7=function(_0x3d0eaa){while(--_0x3d0eaa){_0x14bdd1['push'](_0x14bdd1['shift']());}};_0x4123b7(++_0x4e9148);}(_0x439f,0x196));var _0xf439=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x439f[_0x22e47a];return _0x15a12a;};'use strict';var EventEmitter=require(_0xf439('0x0'));var ChatQueue=require(_0xf439('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf439('0x2'),'afterUpdate':_0xf439('0x3'),'afterDestroy':_0xf439('0x4')};function emitEvent(_0x229b16){return function(_0x6d160c,_0x1eda5a,_0x4c775b){ChatQueueEvents['emit'](_0x229b16+':'+_0x6d160c['id'],_0x6d160c);ChatQueueEvents[_0xf439('0x5')](_0x229b16,_0x6d160c);_0x4c775b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xf439('0x6')](e,emitEvent(event));}}module[_0xf439('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 01980d0..63b63fa 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 _0x1d62=['api','request-promise','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x3f2bfc,_0x38c575){var _0x498995=function(_0xfe05d1){while(--_0xfe05d1){_0x3f2bfc['push'](_0x3f2bfc['shift']());}};_0x498995(++_0x38c575);}(_0x1d62,0x126));var _0x21d6=function(_0x22ec63,_0x8f8973){_0x22ec63=_0x22ec63-0x0;var _0x24935b=_0x1d62[_0x22ec63];return _0x24935b;};'use strict';var _=require(_0x21d6('0x0'));var util=require(_0x21d6('0x1'));var logger=require(_0x21d6('0x2'))(_0x21d6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21d6('0x5'));var config=require(_0x21d6('0x6'));var attributes=require('./chatQueue.attributes');module[_0x21d6('0x7')]=function(_0x1d1169,_0x342b5d){return _0x1d1169[_0x21d6('0x8')](_0x21d6('0x9'),attributes,{'tableName':_0x21d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17b7=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x435cb8,_0x3e41ab){var _0x5142b3=function(_0x2c1605){while(--_0x2c1605){_0x435cb8['push'](_0x435cb8['shift']());}};_0x5142b3(++_0x3e41ab);}(_0x17b7,0x1b3));var _0x717b=function(_0x55b885,_0x25cbf9){_0x55b885=_0x55b885-0x0;var _0x533c6d=_0x17b7[_0x55b885];return _0x533c6d;};'use strict';var _=require('lodash');var util=require(_0x717b('0x0'));var logger=require(_0x717b('0x1'))(_0x717b('0x2'));var moment=require('moment');var BPromise=require(_0x717b('0x3'));var rp=require(_0x717b('0x4'));var fs=require('fs');var path=require(_0x717b('0x5'));var rimraf=require(_0x717b('0x6'));var config=require(_0x717b('0x7'));var attributes=require(_0x717b('0x8'));module[_0x717b('0x9')]=function(_0x3fbd59,_0x5073dd){return _0x3fbd59[_0x717b('0xa')](_0x717b('0xb'),attributes,{'tableName':_0x717b('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 de554e9..9b9bcc7 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 _0xf7b4=['raw','attributes','limit','map','include','model','GetChatQueue','ShowChatQueue','find','where','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','options'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0xf7b4,0x152));var _0x4f7b=function(_0x37e018,_0xe2ac25){_0x37e018=_0x37e018-0x0;var _0x152d64=_0xf7b4[_0x37e018];return _0x152d64;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});config[_0x4f7b('0xa')]=_[_0x4f7b('0xb')](config[_0x4f7b('0xa')],{'host':_0x4f7b('0xc'),'port':0x18eb});var socket=require(_0x4f7b('0xd'))(new Redis(config[_0x4f7b('0xa')]));require('./chatQueue.socket')[_0x4f7b('0xe')](socket);function respondWithRpcPromise(_0x1016e0,_0x479208,_0xdd1aab){return new BPromise(function(_0x3a3d6c,_0x408e01){return client[_0x4f7b('0xf')](_0x1016e0,_0xdd1aab)[_0x4f7b('0x10')](function(_0x55d69f){logger[_0x4f7b('0x11')]('ChatQueue,\x20%s,\x20%s',_0x479208,'request\x20sent');logger[_0x4f7b('0x12')](_0x4f7b('0x13'),_0x479208,_0x4f7b('0x14'),JSON[_0x4f7b('0x15')](_0x55d69f));if(_0x55d69f['error']){if(_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x17')]===0x1f4){logger[_0x4f7b('0x16')](_0x4f7b('0x18'),_0x479208,_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x19')]);return _0x408e01(_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x19')]);}logger[_0x4f7b('0x16')](_0x4f7b('0x18'),_0x479208,_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x19')]);return _0x3a3d6c(_0x55d69f['error'][_0x4f7b('0x19')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x479208,_0x4f7b('0x14'));_0x3a3d6c(_0x55d69f[_0x4f7b('0x1a')]['message']);}})[_0x4f7b('0x1b')](function(_0x24c460){logger[_0x4f7b('0x16')](_0x4f7b('0x18'),_0x479208,_0x24c460);_0x408e01(_0x24c460);});});}exports['GetChatQueue']=function(_0x1daa79){var _0x5adacb=this;return new Promise(function(_0x41cf36,_0x12374b){return db[_0x4f7b('0x1c')][_0x4f7b('0x1d')]({'raw':_0x1daa79[_0x4f7b('0x1e')]?_0x1daa79[_0x4f7b('0x1e')][_0x4f7b('0x1f')]===undefined?!![]:![]:!![],'where':_0x1daa79[_0x4f7b('0x1e')]?_0x1daa79[_0x4f7b('0x1e')]['where']||null:null,'attributes':_0x1daa79[_0x4f7b('0x1e')]?_0x1daa79[_0x4f7b('0x1e')][_0x4f7b('0x20')]||null:null,'limit':_0x1daa79['options']?_0x1daa79[_0x4f7b('0x1e')][_0x4f7b('0x21')]||null:null,'include':_0x1daa79['options']?_0x1daa79[_0x4f7b('0x1e')]['include']?_[_0x4f7b('0x22')](_0x1daa79[_0x4f7b('0x1e')][_0x4f7b('0x23')],function(_0x278c41){return{'model':db[_0x278c41[_0x4f7b('0x24')]],'as':_0x278c41['as'],'attributes':_0x278c41[_0x4f7b('0x20')],'include':_0x278c41[_0x4f7b('0x23')]?_[_0x4f7b('0x22')](_0x278c41['include'],function(_0x6c9626){return{'model':db[_0x6c9626[_0x4f7b('0x24')]],'as':_0x6c9626['as'],'attributes':_0x6c9626[_0x4f7b('0x20')],'include':_0x6c9626['include']?_[_0x4f7b('0x22')](_0x6c9626[_0x4f7b('0x23')],function(_0x1db684){return{'model':db[_0x1db684[_0x4f7b('0x24')]],'as':_0x1db684['as'],'attributes':_0x1db684[_0x4f7b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xac1f93){logger[_0x4f7b('0x11')](_0x4f7b('0x25'),_0x1daa79);logger['debug'](_0x4f7b('0x25'),_0x1daa79,JSON['stringify'](_0xac1f93));_0x41cf36(_0xac1f93);})['catch'](function(_0x1a2346){logger['error'](_0x4f7b('0x25'),_0x1a2346[_0x4f7b('0x19')],_0x1daa79);_0x12374b(_0x5adacb[_0x4f7b('0x16')](0x1f4,_0x1a2346[_0x4f7b('0x19')]));});});};exports[_0x4f7b('0x26')]=function(_0x4e5862){var _0x13a113=this;return new Promise(function(_0x179372,_0xba46b8){return db[_0x4f7b('0x1c')][_0x4f7b('0x27')]({'raw':_0x4e5862[_0x4f7b('0x1e')]?_0x4e5862[_0x4f7b('0x1e')][_0x4f7b('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e5862[_0x4f7b('0x1e')]?_0x4e5862[_0x4f7b('0x1e')][_0x4f7b('0x28')]||null:null,'attributes':_0x4e5862[_0x4f7b('0x1e')]?_0x4e5862[_0x4f7b('0x1e')][_0x4f7b('0x20')]||null:null,'include':_0x4e5862[_0x4f7b('0x1e')]?_0x4e5862[_0x4f7b('0x1e')]['include']?_[_0x4f7b('0x22')](_0x4e5862['options'][_0x4f7b('0x23')],function(_0x4005ad){return{'model':db[_0x4005ad['model']],'as':_0x4005ad['as'],'attributes':_0x4005ad[_0x4f7b('0x20')],'include':_0x4005ad[_0x4f7b('0x23')]?_[_0x4f7b('0x22')](_0x4005ad['include'],function(_0x38b463){return{'model':db[_0x38b463[_0x4f7b('0x24')]],'as':_0x38b463['as'],'attributes':_0x38b463[_0x4f7b('0x20')],'include':_0x38b463[_0x4f7b('0x23')]?_[_0x4f7b('0x22')](_0x38b463[_0x4f7b('0x23')],function(_0xd42b30){return{'model':db[_0xd42b30['model']],'as':_0xd42b30['as'],'attributes':_0xd42b30[_0x4f7b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26fe5b){logger[_0x4f7b('0x11')](_0x4f7b('0x26'),_0x4e5862);logger['debug'](_0x4f7b('0x26'),_0x4e5862,JSON['stringify'](_0x26fe5b));_0x179372(_0x26fe5b);})[_0x4f7b('0x1b')](function(_0x16d554){logger['error']('ShowChatQueue',_0x16d554[_0x4f7b('0x19')],_0x4e5862);_0xba46b8(_0x13a113['error'](0x1f4,_0x16d554[_0x4f7b('0x19')]));});});}; \ No newline at end of file +var _0xc4e1=['defaults','localhost','./chatQueue.socket','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','ChatQueue','find','ShowChatQueue','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x47c09e,_0x6d0b2d){var _0x2940c2=function(_0x2afaa0){while(--_0x2afaa0){_0x47c09e['push'](_0x47c09e['shift']());}};_0x2940c2(++_0x6d0b2d);}(_0xc4e1,0x172));var _0x1c4e=function(_0x4e1850,_0x579f64){_0x4e1850=_0x4e1850-0x0;var _0x5562b3=_0xc4e1[_0x4e1850];return _0x5562b3;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var moment=require(_0x1c4e('0x2'));var BPromise=require(_0x1c4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c4e('0x5'));var logger=require('../../config/logger')(_0x1c4e('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c4e('0x7'));var client=jayson[_0x1c4e('0x8')]['http']({'port':0x232a});config[_0x1c4e('0x9')]=_[_0x1c4e('0xa')](config['redis'],{'host':_0x1c4e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1c4e('0xc'))['register'](socket);function respondWithRpcPromise(_0x474947,_0x524692,_0x1aa3d7){return new BPromise(function(_0x4b61e5,_0x39b296){return client['request'](_0x474947,_0x1aa3d7)['then'](function(_0x5b75a3){logger[_0x1c4e('0xd')](_0x1c4e('0xe'),_0x524692,_0x1c4e('0xf'));logger['debug'](_0x1c4e('0x10'),_0x524692,_0x1c4e('0xf'),JSON['stringify'](_0x5b75a3));if(_0x5b75a3['error']){if(_0x5b75a3['error'][_0x1c4e('0x11')]===0x1f4){logger[_0x1c4e('0x12')]('ChatQueue,\x20%s,\x20%s',_0x524692,_0x5b75a3[_0x1c4e('0x12')][_0x1c4e('0x13')]);return _0x39b296(_0x5b75a3[_0x1c4e('0x12')][_0x1c4e('0x13')]);}logger[_0x1c4e('0x12')]('ChatQueue,\x20%s,\x20%s',_0x524692,_0x5b75a3[_0x1c4e('0x12')][_0x1c4e('0x13')]);return _0x4b61e5(_0x5b75a3['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x524692,_0x1c4e('0xf'));_0x4b61e5(_0x5b75a3[_0x1c4e('0x14')]['message']);}})[_0x1c4e('0x15')](function(_0x366529){logger[_0x1c4e('0x12')](_0x1c4e('0xe'),_0x524692,_0x366529);_0x39b296(_0x366529);});});}exports[_0x1c4e('0x16')]=function(_0x152ddf){var _0x5c6305=this;return new Promise(function(_0x1e9b11,_0x24a1c7){return db['ChatQueue'][_0x1c4e('0x17')]({'raw':_0x152ddf['options']?_0x152ddf[_0x1c4e('0x18')][_0x1c4e('0x19')]===undefined?!![]:![]:!![],'where':_0x152ddf[_0x1c4e('0x18')]?_0x152ddf[_0x1c4e('0x18')][_0x1c4e('0x1a')]||null:null,'attributes':_0x152ddf['options']?_0x152ddf[_0x1c4e('0x18')][_0x1c4e('0x1b')]||null:null,'limit':_0x152ddf[_0x1c4e('0x18')]?_0x152ddf[_0x1c4e('0x18')][_0x1c4e('0x1c')]||null:null,'include':_0x152ddf[_0x1c4e('0x18')]?_0x152ddf['options'][_0x1c4e('0x1d')]?_[_0x1c4e('0x1e')](_0x152ddf[_0x1c4e('0x18')][_0x1c4e('0x1d')],function(_0x2bf026){return{'model':db[_0x2bf026[_0x1c4e('0x1f')]],'as':_0x2bf026['as'],'attributes':_0x2bf026['attributes'],'include':_0x2bf026[_0x1c4e('0x1d')]?_[_0x1c4e('0x1e')](_0x2bf026['include'],function(_0x256e72){return{'model':db[_0x256e72[_0x1c4e('0x1f')]],'as':_0x256e72['as'],'attributes':_0x256e72[_0x1c4e('0x1b')],'include':_0x256e72[_0x1c4e('0x1d')]?_['map'](_0x256e72[_0x1c4e('0x1d')],function(_0xd843da){return{'model':db[_0xd843da[_0x1c4e('0x1f')]],'as':_0xd843da['as'],'attributes':_0xd843da['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c4e('0x20')](function(_0x2c48c2){logger[_0x1c4e('0xd')](_0x1c4e('0x16'),_0x152ddf);logger['debug'](_0x1c4e('0x16'),_0x152ddf,JSON[_0x1c4e('0x21')](_0x2c48c2));_0x1e9b11(_0x2c48c2);})[_0x1c4e('0x15')](function(_0x1166c9){logger['error']('GetChatQueue',_0x1166c9[_0x1c4e('0x13')],_0x152ddf);_0x24a1c7(_0x5c6305[_0x1c4e('0x12')](0x1f4,_0x1166c9[_0x1c4e('0x13')]));});});};exports['ShowChatQueue']=function(_0x340268){var _0x296f6b=this;return new Promise(function(_0x5e1fb9,_0x3d3351){return db[_0x1c4e('0x22')][_0x1c4e('0x23')]({'raw':_0x340268[_0x1c4e('0x18')]?_0x340268[_0x1c4e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x340268[_0x1c4e('0x18')]?_0x340268[_0x1c4e('0x18')][_0x1c4e('0x1a')]||null:null,'attributes':_0x340268[_0x1c4e('0x18')]?_0x340268[_0x1c4e('0x18')]['attributes']||null:null,'include':_0x340268[_0x1c4e('0x18')]?_0x340268['options'][_0x1c4e('0x1d')]?_[_0x1c4e('0x1e')](_0x340268[_0x1c4e('0x18')][_0x1c4e('0x1d')],function(_0x2b386a){return{'model':db[_0x2b386a['model']],'as':_0x2b386a['as'],'attributes':_0x2b386a[_0x1c4e('0x1b')],'include':_0x2b386a[_0x1c4e('0x1d')]?_[_0x1c4e('0x1e')](_0x2b386a[_0x1c4e('0x1d')],function(_0x3f08af){return{'model':db[_0x3f08af[_0x1c4e('0x1f')]],'as':_0x3f08af['as'],'attributes':_0x3f08af[_0x1c4e('0x1b')],'include':_0x3f08af[_0x1c4e('0x1d')]?_[_0x1c4e('0x1e')](_0x3f08af[_0x1c4e('0x1d')],function(_0xa8b923){return{'model':db[_0xa8b923[_0x1c4e('0x1f')]],'as':_0xa8b923['as'],'attributes':_0xa8b923[_0x1c4e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f017){logger[_0x1c4e('0xd')](_0x1c4e('0x24'),_0x340268);logger[_0x1c4e('0x25')](_0x1c4e('0x24'),_0x340268,JSON['stringify'](_0x21f017));_0x5e1fb9(_0x21f017);})[_0x1c4e('0x15')](function(_0x4e4e55){logger['error'](_0x1c4e('0x24'),_0x4e4e55['message'],_0x340268);_0x3d3351(_0x296f6b[_0x1c4e('0x12')](0x1f4,_0x4e4e55[_0x1c4e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b13d888..f1f2fbd 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 _0x7bae=['remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x1d66d5,_0xf9d343){var _0x55d82f=function(_0x55665c){while(--_0x55665c){_0x1d66d5['push'](_0x1d66d5['shift']());}};_0x55d82f(++_0xf9d343);}(_0x7bae,0x13b));var _0xe7ba=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7bae[_0x56482c];return _0x5aae7a;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){ChatQueueEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);ChatQueueEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file +var _0x84ab=['update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x47e9b6,_0x3e3d56){var _0x596fe6=function(_0x5ca075){while(--_0x5ca075){_0x47e9b6['push'](_0x47e9b6['shift']());}};_0x596fe6(++_0x3e3d56);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x84ab[_0x2a55f8];return _0x245efd;};'use strict';var ChatQueueEvents=require(_0xb84a('0x0'));var events=[_0xb84a('0x1'),_0xb84a('0x2'),_0xb84a('0x3')];function createListener(_0x473c3,_0x512f13){return function(_0xc83587){_0x512f13[_0xb84a('0x4')](_0x473c3,_0xc83587);};}function removeListener(_0x47b8e3,_0x9d3a00){return function(){ChatQueueEvents[_0xb84a('0x5')](_0x47b8e3,_0x9d3a00);};}exports[_0xb84a('0x6')]=function(_0x5b9def){for(var _0x521a64=0x0,_0x4dc496=events[_0xb84a('0x7')];_0x521a64<_0x4dc496;_0x521a64++){var _0x4fac4d=events[_0x521a64];var _0x3e9086=createListener(_0xb84a('0x8')+_0x4fac4d,_0x5b9def);ChatQueueEvents['on'](_0x4fac4d,_0x3e9086);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 5e759e0..177d56c 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x1b2699,_0x42032c){var _0x2ee98b=function(_0x314dcc){while(--_0x314dcc){_0x1b2699['push'](_0x1b2699['shift']());}};_0x2ee98b(++_0x42032c);}(_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/teams',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/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5385c7,_0x73e1b6){var _0x26d432=function(_0x5f157e){while(--_0x5f157e){_0x5385c7['push'](_0x5385c7['shift']());}};_0x26d432(++_0x73e1b6);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 491e498..dcacc05 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 _0xcfad=['STRING','DATE','moment','exports'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xcfad,0x1d6));var _0xdcfa=function(_0x49d16c,_0x500403){_0x49d16c=_0x49d16c-0x0;var _0xfe7f68=_0xcfad[_0x49d16c];return _0xfe7f68;};'use strict';var moment=require(_0xdcfa('0x0'));var Sequelize=require('sequelize');module[_0xdcfa('0x1')]={'uniqueid':{'type':Sequelize[_0xdcfa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdcfa('0x2')]},'joinAt':{'type':Sequelize[_0xdcfa('0x3')]},'leaveAt':{'type':Sequelize[_0xdcfa('0x3')]},'acceptAt':{'type':Sequelize[_0xdcfa('0x3')]},'exitAt':{'type':Sequelize[_0xdcfa('0x3')]},'reason':{'type':Sequelize[_0xdcfa('0x2')]}}; \ No newline at end of file +var _0x2ce0=['STRING','DATE','moment','sequelize'];(function(_0x380197,_0x465700){var _0x2e8af0=function(_0x3d061c){while(--_0x3d061c){_0x380197['push'](_0x380197['shift']());}};_0x2e8af0(++_0x465700);}(_0x2ce0,0x82));var _0x02ce=function(_0x18a4cd,_0x377f5e){_0x18a4cd=_0x18a4cd-0x0;var _0x3500cb=_0x2ce0[_0x18a4cd];return _0x3500cb;};'use strict';var moment=require(_0x02ce('0x0'));var Sequelize=require(_0x02ce('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x02ce('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x02ce('0x2')]},'joinAt':{'type':Sequelize[_0x02ce('0x3')]},'leaveAt':{'type':Sequelize[_0x02ce('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x02ce('0x3')]},'reason':{'type':Sequelize[_0x02ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0c8e0d7..7b28657 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 _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','ChatQueueReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4ea4dc,_0x88c0f8){var _0x9240ac=function(_0x5b0b21){while(--_0x5b0b21){_0x4ea4dc['push'](_0x4ea4dc['shift']());}};_0x9240ac(++_0x88c0f8);}(_0x4975,0x86));var _0x5497=function(_0x10f748,_0x430616){_0x10f748=_0x10f748-0x0;var _0x311d0b=_0x4975[_0x10f748];return _0x311d0b;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['ChatQueueReport'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['ChatQueueReport'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0xfe91=['fast-json-patch','moment','bluebird','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/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','find','destroy','describe','eml-format'];(function(_0x31f647,_0x4dd253){var _0x127e94=function(_0x5b2f53){while(--_0x5b2f53){_0x31f647['push'](_0x31f647['shift']());}};_0x127e94(++_0x4dd253);}(_0xfe91,0xd4));var _0x1fe9=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xfe91[_0x3899d1];return _0xeb4a7d;};'use strict';var emlformat=require(_0x1fe9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1fe9('0x1'));var rp=require('request-promise');var moment=require(_0x1fe9('0x2'));var BPromise=require(_0x1fe9('0x3'));var Mustache=require(_0x1fe9('0x4'));var util=require(_0x1fe9('0x5'));var path=require(_0x1fe9('0x6'));var sox=require(_0x1fe9('0x7'));var csv=require(_0x1fe9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fe9('0x9'));var _=require(_0x1fe9('0xa'));var squel=require(_0x1fe9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1fe9('0xc'));var toCsv=require(_0x1fe9('0x8'));var querystring=require('querystring');var Papa=require(_0x1fe9('0xd'));var Redis=require(_0x1fe9('0xe'));var authService=require(_0x1fe9('0xf'));var qs=require(_0x1fe9('0x10'));var as=require(_0x1fe9('0x11'));var hardwareService=require(_0x1fe9('0x12'));var logger=require(_0x1fe9('0x13'))(_0x1fe9('0x14'));var utils=require('../../config/utils');var config=require(_0x1fe9('0x15'));var licenseUtil=require(_0x1fe9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d747e,_0x2deeaf){_0x2deeaf=_0x2deeaf||0xcc;return function(_0x4299dd){if(_0x4299dd){return _0x1d747e[_0x1fe9('0x17')](_0x2deeaf);}return _0x1d747e[_0x1fe9('0x18')](_0x2deeaf)['end']();};}function respondWithResult(_0x1c10ef,_0x1f6026){_0x1f6026=_0x1f6026||0xc8;return function(_0x4c5e41){if(_0x4c5e41){return _0x1c10ef[_0x1fe9('0x18')](_0x1f6026)['json'](_0x4c5e41);}};}function respondWithFilteredResult(_0x30d5c8,_0x3b6988){return function(_0x2f62a8){if(_0x2f62a8){var _0x5da3c1=typeof _0x3b6988[_0x1fe9('0x19')]===_0x1fe9('0x1a')&&typeof _0x3b6988[_0x1fe9('0x1b')]==='undefined';var _0x440e0a=_0x2f62a8[_0x1fe9('0x1c')];var _0x2085ac=_0x5da3c1?0x0:_0x3b6988['offset'];var _0x2070a3=_0x5da3c1?_0x2f62a8['count']:_0x3b6988[_0x1fe9('0x19')]+_0x3b6988[_0x1fe9('0x1b')];var _0x491bcb;if(_0x2070a3>=_0x440e0a){_0x2070a3=_0x440e0a;_0x491bcb=0xc8;}else{_0x491bcb=0xce;}_0x30d5c8[_0x1fe9('0x18')](_0x491bcb);return _0x30d5c8[_0x1fe9('0x1d')](_0x1fe9('0x1e'),_0x2085ac+'-'+_0x2070a3+'/'+_0x440e0a)[_0x1fe9('0x1f')](_0x2f62a8);}return null;};}function patchUpdates(_0x442ae7){return function(_0x125775){try{jsonpatch['apply'](_0x125775,_0x442ae7,!![]);}catch(_0x38ec4e){return BPromise['reject'](_0x38ec4e);}return _0x125775['save']();};}function saveUpdates(_0x15b582,_0xe32090){return function(_0x1859ee){if(_0x1859ee){return _0x1859ee[_0x1fe9('0x20')](_0x15b582)[_0x1fe9('0x21')](function(_0xa79582){return _0xa79582;});}return null;};}function removeEntity(_0x56d3bf,_0x18afe2){return function(_0xa92d55){if(_0xa92d55){return _0xa92d55['destroy']()[_0x1fe9('0x21')](function(){_0x56d3bf[_0x1fe9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e492f,_0x462537){return function(_0x5f135d){if(!_0x5f135d){_0x2e492f[_0x1fe9('0x17')](0x194);}return _0x5f135d;};}function handleError(_0x44ae36,_0x5206a0){_0x5206a0=_0x5206a0||0x1f4;return function(_0x297c4b){logger[_0x1fe9('0x22')](_0x297c4b[_0x1fe9('0x23')]);if(_0x297c4b[_0x1fe9('0x24')]){delete _0x297c4b[_0x1fe9('0x24')];}_0x44ae36[_0x1fe9('0x18')](_0x5206a0)[_0x1fe9('0x25')](_0x297c4b);};}exports[_0x1fe9('0x26')]=function(_0xed426c,_0x1828ca){var _0x2aea20={},_0x11f374={},_0x3551e4={'count':0x0,'rows':[]};var _0x538d33=_[_0x1fe9('0x27')](db[_0x1fe9('0x28')][_0x1fe9('0x29')],function(_0x5319d2){return{'name':_0x5319d2[_0x1fe9('0x2a')],'type':_0x5319d2[_0x1fe9('0x2b')]['key']};});_0x11f374[_0x1fe9('0x2c')]=_['map'](_0x538d33,_0x1fe9('0x24'));_0x11f374[_0x1fe9('0x2d')]=_[_0x1fe9('0x2e')](_0xed426c[_0x1fe9('0x2d')]);_0x11f374[_0x1fe9('0x2f')]=_[_0x1fe9('0x30')](_0x11f374[_0x1fe9('0x2c')],_0x11f374[_0x1fe9('0x2d')]);_0x2aea20[_0x1fe9('0x31')]=_['intersection'](_0x11f374[_0x1fe9('0x2c')],qs[_0x1fe9('0x32')](_0xed426c['query'][_0x1fe9('0x32')]));_0x2aea20[_0x1fe9('0x31')]=_0x2aea20[_0x1fe9('0x31')][_0x1fe9('0x33')]?_0x2aea20[_0x1fe9('0x31')]:_0x11f374[_0x1fe9('0x2c')];if(!_0xed426c['query']['hasOwnProperty'](_0x1fe9('0x34'))){_0x2aea20['limit']=qs['limit'](_0xed426c[_0x1fe9('0x2d')][_0x1fe9('0x1b')]);_0x2aea20[_0x1fe9('0x19')]=qs[_0x1fe9('0x19')](_0xed426c['query'][_0x1fe9('0x19')]);}_0x2aea20['order']=qs[_0x1fe9('0x35')](_0xed426c[_0x1fe9('0x2d')]['sort']);_0x2aea20[_0x1fe9('0x36')]=qs['filters'](_[_0x1fe9('0x37')](_0xed426c[_0x1fe9('0x2d')],_0x11f374[_0x1fe9('0x2f')]),_0x538d33);if(_0xed426c['query'][_0x1fe9('0x38')]){_0x2aea20[_0x1fe9('0x36')]=_[_0x1fe9('0x39')](_0x2aea20['where'],{'$or':_[_0x1fe9('0x27')](_0x538d33,function(_0x1bf2df){if(_0x1bf2df['type']!==_0x1fe9('0x3a')){var _0x36ef35={};_0x36ef35[_0x1bf2df[_0x1fe9('0x24')]]={'$like':'%'+_0xed426c[_0x1fe9('0x2d')][_0x1fe9('0x38')]+'%'};return _0x36ef35;}})});}_0x2aea20=_['merge']({},_0x2aea20,_0xed426c[_0x1fe9('0x3b')]);var _0xcb61ae={'where':_0x2aea20[_0x1fe9('0x36')]};return db[_0x1fe9('0x28')][_0x1fe9('0x1c')](_0xcb61ae)[_0x1fe9('0x21')](function(_0x110530){_0x3551e4['count']=_0x110530;if(_0xed426c['query']['includeAll']){_0x2aea20[_0x1fe9('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x2aea20);})[_0x1fe9('0x21')](function(_0x427db5){_0x3551e4[_0x1fe9('0x3d')]=_0x427db5;return _0x3551e4;})[_0x1fe9('0x21')](respondWithFilteredResult(_0x1828ca,_0x2aea20))[_0x1fe9('0x3e')](handleError(_0x1828ca,null));};exports[_0x1fe9('0x3f')]=function(_0x38f045,_0x2a9bf7){var _0x2b3f92={'raw':!![],'where':{'id':_0x38f045[_0x1fe9('0x40')]['id']}},_0xd4d387={};_0xd4d387[_0x1fe9('0x2c')]=_['keys'](db[_0x1fe9('0x28')]['rawAttributes']);_0xd4d387['query']=_[_0x1fe9('0x2e')](_0x38f045[_0x1fe9('0x2d')]);_0xd4d387[_0x1fe9('0x2f')]=_['intersection'](_0xd4d387['model'],_0xd4d387[_0x1fe9('0x2d')]);_0x2b3f92[_0x1fe9('0x31')]=_[_0x1fe9('0x30')](_0xd4d387['model'],qs[_0x1fe9('0x32')](_0x38f045[_0x1fe9('0x2d')][_0x1fe9('0x32')]));_0x2b3f92[_0x1fe9('0x31')]=_0x2b3f92[_0x1fe9('0x31')][_0x1fe9('0x33')]?_0x2b3f92[_0x1fe9('0x31')]:_0xd4d387[_0x1fe9('0x2c')];if(_0x38f045[_0x1fe9('0x2d')][_0x1fe9('0x41')]){_0x2b3f92[_0x1fe9('0x3c')]=[{'all':!![]}];}_0x2b3f92=_[_0x1fe9('0x39')]({},_0x2b3f92,_0x38f045[_0x1fe9('0x3b')]);return db[_0x1fe9('0x28')]['find'](_0x2b3f92)['then'](handleEntityNotFound(_0x2a9bf7,null))['then'](respondWithResult(_0x2a9bf7,null))[_0x1fe9('0x3e')](handleError(_0x2a9bf7,null));};exports[_0x1fe9('0x42')]=function(_0x2d490f,_0x3c9a4e){return db[_0x1fe9('0x28')][_0x1fe9('0x42')](_0x2d490f[_0x1fe9('0x43')],{})[_0x1fe9('0x21')](respondWithResult(_0x3c9a4e,0xc9))[_0x1fe9('0x3e')](handleError(_0x3c9a4e,null));};exports[_0x1fe9('0x20')]=function(_0x3f9a18,_0x2ccf57){if(_0x3f9a18[_0x1fe9('0x43')]['id']){delete _0x3f9a18[_0x1fe9('0x43')]['id'];}return db[_0x1fe9('0x28')][_0x1fe9('0x44')]({'where':{'id':_0x3f9a18['params']['id']}})[_0x1fe9('0x21')](handleEntityNotFound(_0x2ccf57,null))[_0x1fe9('0x21')](saveUpdates(_0x3f9a18['body'],null))[_0x1fe9('0x21')](respondWithResult(_0x2ccf57,null))[_0x1fe9('0x3e')](handleError(_0x2ccf57,null));};exports[_0x1fe9('0x45')]=function(_0x85d38e,_0x4eea2d){return db[_0x1fe9('0x28')][_0x1fe9('0x44')]({'where':{'id':_0x85d38e[_0x1fe9('0x40')]['id']}})[_0x1fe9('0x21')](handleEntityNotFound(_0x4eea2d,null))[_0x1fe9('0x21')](removeEntity(_0x4eea2d,null))[_0x1fe9('0x3e')](handleError(_0x4eea2d,null));};exports[_0x1fe9('0x46')]=function(_0x5c4123,_0x3081f8){return db[_0x1fe9('0x28')]['describe']()[_0x1fe9('0x21')](respondWithResult(_0x3081f8,null))[_0x1fe9('0x3e')](handleError(_0x3081f8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f896419..9aa679d 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3a942e,_0x4cf399){var _0x65b0ac=function(_0x2d9e47){while(--_0x2d9e47){_0x3a942e['push'](_0x3a942e['shift']());}};_0x65b0ac(++_0x4cf399);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x38080e,_0x95512d){var _0x4e4c87=function(_0x2be6b3){while(--_0x2be6b3){_0x38080e['push'](_0x38080e['shift']());}};_0x4e4c87(++_0x95512d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3da241,_0xeba26a){_0x3da241=_0x3da241-0x0;var _0x43e156=_0xb10b[_0x3da241];return _0x43e156;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 64ca22a..20a6a6a 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 _0x57b2=['options','raw','UpdateChatQueueReport','update','body','where','attributes','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x57b2,0xda));var _0x257b=function(_0x422a3b,_0x2a6f6f){_0x422a3b=_0x422a3b-0x0;var _0x1a8e79=_0x57b2[_0x422a3b];return _0x1a8e79;};'use strict';var _=require(_0x257b('0x0'));var util=require(_0x257b('0x1'));var moment=require(_0x257b('0x2'));var BPromise=require(_0x257b('0x3'));var rs=require(_0x257b('0x4'));var fs=require('fs');var Redis=require(_0x257b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x257b('0x6'));var logger=require(_0x257b('0x7'))(_0x257b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1adf73,_0x4a5c36,_0x873b77){return new BPromise(function(_0xa58e13,_0x19f8dc){return client['request'](_0x1adf73,_0x873b77)[_0x257b('0x9')](function(_0x45eca9){logger['info'](_0x257b('0xa'),_0x4a5c36,_0x257b('0xb'));logger[_0x257b('0xc')](_0x257b('0xd'),_0x4a5c36,_0x257b('0xb'),JSON[_0x257b('0xe')](_0x45eca9));if(_0x45eca9[_0x257b('0xf')]){if(_0x45eca9[_0x257b('0xf')][_0x257b('0x10')]===0x1f4){logger[_0x257b('0xf')](_0x257b('0xa'),_0x4a5c36,_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);return _0x19f8dc(_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);}logger['error'](_0x257b('0xa'),_0x4a5c36,_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);return _0xa58e13(_0x45eca9[_0x257b('0xf')][_0x257b('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4a5c36,_0x257b('0xb'));_0xa58e13(_0x45eca9['result'][_0x257b('0x11')]);}})[_0x257b('0x12')](function(_0x317e86){logger[_0x257b('0xf')](_0x257b('0xa'),_0x4a5c36,_0x317e86);_0x19f8dc(_0x317e86);});});}exports[_0x257b('0x13')]=function(_0xd0ab4e){var _0x37eb35=this;return new Promise(function(_0x50122b,_0x2dece2){return db[_0x257b('0x14')][_0x257b('0x15')](_0xd0ab4e['body'],{'raw':_0xd0ab4e[_0x257b('0x16')]?_0xd0ab4e['options'][_0x257b('0x17')]===undefined?!![]:![]:!![]})[_0x257b('0x9')](function(_0x147868){logger['info'](_0x257b('0x13'),_0xd0ab4e);logger[_0x257b('0xc')]('CreateChatQueueReport',_0xd0ab4e,JSON[_0x257b('0xe')](_0x147868));_0x50122b(_0x147868);})[_0x257b('0x12')](function(_0x24e74a){logger[_0x257b('0xf')](_0x257b('0x13'),_0x24e74a[_0x257b('0x11')],_0xd0ab4e);_0x2dece2(_0x37eb35['error'](0x1f4,_0x24e74a[_0x257b('0x11')]));});});};exports[_0x257b('0x18')]=function(_0x22a722){var _0x3f2148=this;return new Promise(function(_0x3e2f34,_0x9023cc){return db['ChatQueueReport'][_0x257b('0x19')](_0x22a722[_0x257b('0x1a')],{'raw':_0x22a722['options']?_0x22a722[_0x257b('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a722[_0x257b('0x16')]?_0x22a722[_0x257b('0x16')][_0x257b('0x1b')]||null:null,'attributes':_0x22a722[_0x257b('0x16')]?_0x22a722[_0x257b('0x16')][_0x257b('0x1c')]||null:null,'limit':_0x22a722[_0x257b('0x16')]?_0x22a722[_0x257b('0x16')]['limit']||null:null})[_0x257b('0x9')](function(_0x5988e0){logger[_0x257b('0x1d')](_0x257b('0x18'),_0x22a722);logger[_0x257b('0xc')](_0x257b('0x18'),_0x22a722,JSON[_0x257b('0xe')](_0x5988e0));_0x3e2f34(_0x5988e0);})[_0x257b('0x12')](function(_0x572361){logger['error'](_0x257b('0x18'),_0x572361['message'],_0x22a722);_0x9023cc(_0x3f2148['error'](0x1f4,_0x572361[_0x257b('0x11')]));});});}; \ No newline at end of file +var _0x1776=['CreateChatQueueReport','ChatQueueReport','options','UpdateChatQueueReport','body','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x28f866,_0x478f52){var _0x36b21f=function(_0x5727e6){while(--_0x5727e6){_0x28f866['push'](_0x28f866['shift']());}};_0x36b21f(++_0x478f52);}(_0x1776,0xff));var _0x6177=function(_0x37e91f,_0x3e025c){_0x37e91f=_0x37e91f-0x0;var _0x1babb9=_0x1776[_0x37e91f];return _0x1babb9;};'use strict';var _=require(_0x6177('0x0'));var util=require(_0x6177('0x1'));var moment=require(_0x6177('0x2'));var BPromise=require(_0x6177('0x3'));var rs=require(_0x6177('0x4'));var fs=require('fs');var Redis=require(_0x6177('0x5'));var db=require(_0x6177('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6177('0x7'))(_0x6177('0x8'));var config=require('../../config/environment');var jayson=require(_0x6177('0x9'));var client=jayson[_0x6177('0xa')][_0x6177('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24be45,_0xc1e3db,_0x365ee9){return new BPromise(function(_0x249081,_0x48a810){return client[_0x6177('0xc')](_0x24be45,_0x365ee9)[_0x6177('0xd')](function(_0x2cf916){logger[_0x6177('0xe')](_0x6177('0xf'),_0xc1e3db,_0x6177('0x10'));logger[_0x6177('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xc1e3db,_0x6177('0x10'),JSON[_0x6177('0x12')](_0x2cf916));if(_0x2cf916[_0x6177('0x13')]){if(_0x2cf916['error'][_0x6177('0x14')]===0x1f4){logger[_0x6177('0x13')](_0x6177('0xf'),_0xc1e3db,_0x2cf916[_0x6177('0x13')][_0x6177('0x15')]);return _0x48a810(_0x2cf916[_0x6177('0x13')]['message']);}logger['error'](_0x6177('0xf'),_0xc1e3db,_0x2cf916['error'][_0x6177('0x15')]);return _0x249081(_0x2cf916[_0x6177('0x13')][_0x6177('0x15')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xc1e3db,'request\x20sent');_0x249081(_0x2cf916[_0x6177('0x16')][_0x6177('0x15')]);}})[_0x6177('0x17')](function(_0x41e978){logger['error'](_0x6177('0xf'),_0xc1e3db,_0x41e978);_0x48a810(_0x41e978);});});}exports[_0x6177('0x18')]=function(_0x45d799){var _0x5a976f=this;return new Promise(function(_0x3f415c,_0x41f86d){return db[_0x6177('0x19')]['create'](_0x45d799['body'],{'raw':_0x45d799[_0x6177('0x1a')]?_0x45d799[_0x6177('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6177('0xd')](function(_0x38f5f2){logger[_0x6177('0xe')](_0x6177('0x18'),_0x45d799);logger['debug']('CreateChatQueueReport',_0x45d799,JSON['stringify'](_0x38f5f2));_0x3f415c(_0x38f5f2);})[_0x6177('0x17')](function(_0x53e12a){logger[_0x6177('0x13')](_0x6177('0x18'),_0x53e12a['message'],_0x45d799);_0x41f86d(_0x5a976f[_0x6177('0x13')](0x1f4,_0x53e12a[_0x6177('0x15')]));});});};exports[_0x6177('0x1b')]=function(_0x12fb09){var _0x29b327=this;return new Promise(function(_0x7c1d30,_0x3867e7){return db[_0x6177('0x19')]['update'](_0x12fb09[_0x6177('0x1c')],{'raw':_0x12fb09[_0x6177('0x1a')]?_0x12fb09[_0x6177('0x1a')][_0x6177('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12fb09[_0x6177('0x1a')]?_0x12fb09[_0x6177('0x1a')][_0x6177('0x1e')]||null:null,'attributes':_0x12fb09[_0x6177('0x1a')]?_0x12fb09[_0x6177('0x1a')]['attributes']||null:null,'limit':_0x12fb09[_0x6177('0x1a')]?_0x12fb09['options']['limit']||null:null})['then'](function(_0x2291a4){logger[_0x6177('0xe')](_0x6177('0x1b'),_0x12fb09);logger[_0x6177('0x11')](_0x6177('0x1b'),_0x12fb09,JSON[_0x6177('0x12')](_0x2291a4));_0x7c1d30(_0x2291a4);})[_0x6177('0x17')](function(_0xce6ae8){logger['error']('UpdateChatQueueReport',_0xce6ae8[_0x6177('0x15')],_0x12fb09);_0x3867e7(_0x29b327[_0x6177('0x13')](0x1f4,_0xce6ae8[_0x6177('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 859d175..e08fe3b 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 _0xe4c5=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','destroy','exports'];(function(_0x1f5417,_0x266f18){var _0x4801c5=function(_0x5a44e9){while(--_0x5a44e9){_0x1f5417['push'](_0x1f5417['shift']());}};_0x4801c5(++_0x266f18);}(_0xe4c5,0xbe));var _0x5e4c=function(_0x1aadcb,_0x443135){_0x1aadcb=_0x1aadcb-0x0;var _0x44ad34=_0xe4c5[_0x1aadcb];return _0x44ad34;};'use strict';var multer=require(_0x5e4c('0x0'));var util=require('util');var path=require(_0x5e4c('0x1'));var timeout=require(_0x5e4c('0x2'));var express=require(_0x5e4c('0x3'));var router=express[_0x5e4c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e4c('0x5'));var config=require(_0x5e4c('0x6'));var controller=require('./chatQueueReport.controller');router[_0x5e4c('0x7')]('/',auth[_0x5e4c('0x8')](),controller[_0x5e4c('0x9')]);router[_0x5e4c('0x7')](_0x5e4c('0xa'),auth[_0x5e4c('0x8')](),controller[_0x5e4c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5e4c('0xc')]('/',auth[_0x5e4c('0x8')](),controller[_0x5e4c('0xd')]);router[_0x5e4c('0xe')](_0x5e4c('0xf'),auth[_0x5e4c('0x8')](),controller[_0x5e4c('0x10')]);router['delete'](_0x5e4c('0xf'),auth[_0x5e4c('0x8')](),controller[_0x5e4c('0x11')]);module[_0x5e4c('0x12')]=router; \ No newline at end of file +var _0x7666=['index','/describe','/:id','create','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x7666,0x1f0));var _0x6766=function(_0x1a07c9,_0x4d2830){_0x1a07c9=_0x1a07c9-0x0;var _0x39f978=_0x7666[_0x1a07c9];return _0x39f978;};'use strict';var multer=require('multer');var util=require(_0x6766('0x0'));var path=require(_0x6766('0x1'));var timeout=require(_0x6766('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6766('0x3'));var auth=require(_0x6766('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6766('0x5'));router[_0x6766('0x6')]('/',auth[_0x6766('0x7')](),controller[_0x6766('0x8')]);router[_0x6766('0x6')](_0x6766('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6766('0x6')](_0x6766('0xa'),auth[_0x6766('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6766('0xb')]);router['put'](_0x6766('0xa'),auth['isAuthenticated'](),controller[_0x6766('0xc')]);router['delete'](_0x6766('0xa'),auth[_0x6766('0x7')](),controller['destroy']);module[_0x6766('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ee53155..be7ef5e 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2e5d6c,_0xd9f7c8){var _0x379b59=function(_0x309eb9){while(--_0x309eb9){_0x2e5d6c['push'](_0x2e5d6c['shift']());}};_0x379b59(++_0xd9f7c8);}(_0xedd9,0xfc));var _0x9edd=function(_0x88c7d4,_0x5cb179){_0x88c7d4=_0x88c7d4-0x0;var _0x308122=_0xedd9[_0x88c7d4];return _0x308122;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x282b98,_0xd255ed){var _0x440e19=function(_0x2c07b1){while(--_0x2c07b1){_0x282b98['push'](_0x282b98['shift']());}};_0x440e19(++_0xd255ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7170753..56feeef 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 _0xfe29=['where','pick','filter','merge','map','VIRTUAL','includeAll','rows','catch','show','params','length','include','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x2387c4,_0x35b5d8){var _0x51ac8c=function(_0x2e0c88){while(--_0x2e0c88){_0x2387c4['push'](_0x2387c4['shift']());}};_0x51ac8c(++_0x35b5d8);}(_0xfe29,0x1ed));var _0x9fe2=function(_0x3f160a,_0x3c1284){_0x3f160a=_0x3f160a-0x0;var _0x81a0b=_0xfe29[_0x3f160a];return _0x81a0b;};'use strict';var emlformat=require(_0x9fe2('0x0'));var rimraf=require(_0x9fe2('0x1'));var zipdir=require(_0x9fe2('0x2'));var jsonpatch=require(_0x9fe2('0x3'));var rp=require(_0x9fe2('0x4'));var moment=require(_0x9fe2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9fe2('0x6'));var util=require(_0x9fe2('0x7'));var path=require(_0x9fe2('0x8'));var sox=require(_0x9fe2('0x9'));var csv=require(_0x9fe2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fe2('0xb'));var _=require(_0x9fe2('0xc'));var squel=require(_0x9fe2('0xd'));var crypto=require(_0x9fe2('0xe'));var jsforce=require(_0x9fe2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9fe2('0x10'));var Papa=require('papaparse');var Redis=require(_0x9fe2('0x11'));var authService=require(_0x9fe2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9fe2('0x13'));var hardwareService=require(_0x9fe2('0x14'));var logger=require('../../config/logger')(_0x9fe2('0x15'));var utils=require(_0x9fe2('0x16'));var config=require(_0x9fe2('0x17'));var licenseUtil=require(_0x9fe2('0x18'));var db=require(_0x9fe2('0x19'))['db'];function respondWithStatusCode(_0x50040c,_0x98c9db){_0x98c9db=_0x98c9db||0xcc;return function(_0x54db5d){if(_0x54db5d){return _0x50040c[_0x9fe2('0x1a')](_0x98c9db);}return _0x50040c[_0x9fe2('0x1b')](_0x98c9db)[_0x9fe2('0x1c')]();};}function respondWithResult(_0x3cd04b,_0x5101a7){_0x5101a7=_0x5101a7||0xc8;return function(_0x196871){if(_0x196871){return _0x3cd04b[_0x9fe2('0x1b')](_0x5101a7)[_0x9fe2('0x1d')](_0x196871);}};}function respondWithFilteredResult(_0x591c5b,_0x210f7a){return function(_0x2a1e6c){if(_0x2a1e6c){var _0x117e96=typeof _0x210f7a[_0x9fe2('0x1e')]===_0x9fe2('0x1f')&&typeof _0x210f7a[_0x9fe2('0x20')]===_0x9fe2('0x1f');var _0x5e8089=_0x2a1e6c[_0x9fe2('0x21')];var _0x30e119=_0x117e96?0x0:_0x210f7a[_0x9fe2('0x1e')];var _0x1e5d5f=_0x117e96?_0x2a1e6c[_0x9fe2('0x21')]:_0x210f7a[_0x9fe2('0x1e')]+_0x210f7a[_0x9fe2('0x20')];var _0x4db1b3;if(_0x1e5d5f>=_0x5e8089){_0x1e5d5f=_0x5e8089;_0x4db1b3=0xc8;}else{_0x4db1b3=0xce;}_0x591c5b['status'](_0x4db1b3);return _0x591c5b[_0x9fe2('0x22')]('Content-Range',_0x30e119+'-'+_0x1e5d5f+'/'+_0x5e8089)[_0x9fe2('0x1d')](_0x2a1e6c);}return null;};}function patchUpdates(_0x4dff90){return function(_0x52851d){try{jsonpatch[_0x9fe2('0x23')](_0x52851d,_0x4dff90,!![]);}catch(_0xc3a166){return BPromise[_0x9fe2('0x24')](_0xc3a166);}return _0x52851d[_0x9fe2('0x25')]();};}function saveUpdates(_0x489d71,_0x3bd529){return function(_0x28e424){if(_0x28e424){return _0x28e424['update'](_0x489d71)['then'](function(_0x53b9c4){return _0x53b9c4;});}return null;};}function removeEntity(_0x44612f,_0x145e6a){return function(_0x23dbc1){if(_0x23dbc1){return _0x23dbc1[_0x9fe2('0x26')]()[_0x9fe2('0x27')](function(){_0x44612f[_0x9fe2('0x1b')](0xcc)[_0x9fe2('0x1c')]();});}};}function handleEntityNotFound(_0x3847ce,_0x19484b){return function(_0x5e3338){if(!_0x5e3338){_0x3847ce[_0x9fe2('0x1a')](0x194);}return _0x5e3338;};}function handleError(_0x113469,_0x4a06f1){_0x4a06f1=_0x4a06f1||0x1f4;return function(_0x3adbf6){logger[_0x9fe2('0x28')](_0x3adbf6['stack']);if(_0x3adbf6[_0x9fe2('0x29')]){delete _0x3adbf6[_0x9fe2('0x29')];}_0x113469[_0x9fe2('0x1b')](_0x4a06f1)[_0x9fe2('0x2a')](_0x3adbf6);};}exports[_0x9fe2('0x2b')]=function(_0x576dd1,_0x38ea4a){var _0x2b700e={},_0x8048bb={},_0x2fdfec={'count':0x0,'rows':[]};var _0x2d02ce=_['map'](db[_0x9fe2('0x2c')][_0x9fe2('0x2d')],function(_0x3206dd){return{'name':_0x3206dd[_0x9fe2('0x2e')],'type':_0x3206dd[_0x9fe2('0x2f')][_0x9fe2('0x30')]};});_0x8048bb[_0x9fe2('0x31')]=_['map'](_0x2d02ce,_0x9fe2('0x29'));_0x8048bb[_0x9fe2('0x32')]=_[_0x9fe2('0x33')](_0x576dd1[_0x9fe2('0x32')]);_0x8048bb[_0x9fe2('0x34')]=_[_0x9fe2('0x35')](_0x8048bb[_0x9fe2('0x31')],_0x8048bb[_0x9fe2('0x32')]);_0x2b700e[_0x9fe2('0x36')]=_['intersection'](_0x8048bb[_0x9fe2('0x31')],qs[_0x9fe2('0x37')](_0x576dd1['query'][_0x9fe2('0x37')]));_0x2b700e[_0x9fe2('0x36')]=_0x2b700e[_0x9fe2('0x36')]['length']?_0x2b700e[_0x9fe2('0x36')]:_0x8048bb[_0x9fe2('0x31')];if(!_0x576dd1[_0x9fe2('0x32')][_0x9fe2('0x38')](_0x9fe2('0x39'))){_0x2b700e[_0x9fe2('0x20')]=qs['limit'](_0x576dd1[_0x9fe2('0x32')][_0x9fe2('0x20')]);_0x2b700e[_0x9fe2('0x1e')]=qs[_0x9fe2('0x1e')](_0x576dd1['query'][_0x9fe2('0x1e')]);}_0x2b700e[_0x9fe2('0x3a')]=qs[_0x9fe2('0x3b')](_0x576dd1[_0x9fe2('0x32')][_0x9fe2('0x3b')]);_0x2b700e[_0x9fe2('0x3c')]=qs[_0x9fe2('0x34')](_[_0x9fe2('0x3d')](_0x576dd1[_0x9fe2('0x32')],_0x8048bb['filters']),_0x2d02ce);if(_0x576dd1[_0x9fe2('0x32')][_0x9fe2('0x3e')]){_0x2b700e[_0x9fe2('0x3c')]=_[_0x9fe2('0x3f')](_0x2b700e['where'],{'$or':_[_0x9fe2('0x40')](_0x2d02ce,function(_0x542776){if(_0x542776[_0x9fe2('0x2f')]!==_0x9fe2('0x41')){var _0x57b09d={};_0x57b09d[_0x542776[_0x9fe2('0x29')]]={'$like':'%'+_0x576dd1['query'][_0x9fe2('0x3e')]+'%'};return _0x57b09d;}})});}_0x2b700e=_['merge']({},_0x2b700e,_0x576dd1['options']);var _0x48b826={'where':_0x2b700e[_0x9fe2('0x3c')]};return db[_0x9fe2('0x2c')]['count'](_0x48b826)[_0x9fe2('0x27')](function(_0x260dc5){_0x2fdfec[_0x9fe2('0x21')]=_0x260dc5;if(_0x576dd1[_0x9fe2('0x32')][_0x9fe2('0x42')]){_0x2b700e['include']=[{'all':!![]}];}return db[_0x9fe2('0x2c')]['findAll'](_0x2b700e);})[_0x9fe2('0x27')](function(_0x510a5e){_0x2fdfec[_0x9fe2('0x43')]=_0x510a5e;return _0x2fdfec;})[_0x9fe2('0x27')](respondWithFilteredResult(_0x38ea4a,_0x2b700e))[_0x9fe2('0x44')](handleError(_0x38ea4a,null));};exports[_0x9fe2('0x45')]=function(_0x43b3e6,_0x28ca4b){var _0x6134ba={'raw':!![],'where':{'id':_0x43b3e6[_0x9fe2('0x46')]['id']}},_0x5eb8ca={};_0x5eb8ca[_0x9fe2('0x31')]=_[_0x9fe2('0x33')](db[_0x9fe2('0x2c')][_0x9fe2('0x2d')]);_0x5eb8ca[_0x9fe2('0x32')]=_[_0x9fe2('0x33')](_0x43b3e6[_0x9fe2('0x32')]);_0x5eb8ca['filters']=_[_0x9fe2('0x35')](_0x5eb8ca[_0x9fe2('0x31')],_0x5eb8ca[_0x9fe2('0x32')]);_0x6134ba['attributes']=_['intersection'](_0x5eb8ca[_0x9fe2('0x31')],qs['fields'](_0x43b3e6[_0x9fe2('0x32')]['fields']));_0x6134ba[_0x9fe2('0x36')]=_0x6134ba['attributes'][_0x9fe2('0x47')]?_0x6134ba[_0x9fe2('0x36')]:_0x5eb8ca['model'];if(_0x43b3e6[_0x9fe2('0x32')][_0x9fe2('0x42')]){_0x6134ba[_0x9fe2('0x48')]=[{'all':!![]}];}_0x6134ba=_[_0x9fe2('0x3f')]({},_0x6134ba,_0x43b3e6[_0x9fe2('0x49')]);return db[_0x9fe2('0x2c')][_0x9fe2('0x4a')](_0x6134ba)[_0x9fe2('0x27')](handleEntityNotFound(_0x28ca4b,null))[_0x9fe2('0x27')](respondWithResult(_0x28ca4b,null))[_0x9fe2('0x44')](handleError(_0x28ca4b,null));};exports['create']=function(_0x364242,_0x3e874b){return db[_0x9fe2('0x2c')][_0x9fe2('0x4b')](_0x364242[_0x9fe2('0x4c')],{})[_0x9fe2('0x27')](respondWithResult(_0x3e874b,0xc9))[_0x9fe2('0x44')](handleError(_0x3e874b,null));};exports[_0x9fe2('0x4d')]=function(_0x4d52b9,_0x1b93ba){if(_0x4d52b9['body']['id']){delete _0x4d52b9['body']['id'];}return db['ChatTransferReport'][_0x9fe2('0x4a')]({'where':{'id':_0x4d52b9[_0x9fe2('0x46')]['id']}})[_0x9fe2('0x27')](handleEntityNotFound(_0x1b93ba,null))[_0x9fe2('0x27')](saveUpdates(_0x4d52b9[_0x9fe2('0x4c')],null))[_0x9fe2('0x27')](respondWithResult(_0x1b93ba,null))['catch'](handleError(_0x1b93ba,null));};exports[_0x9fe2('0x26')]=function(_0x4b9699,_0x41e0fe){return db[_0x9fe2('0x2c')][_0x9fe2('0x4a')]({'where':{'id':_0x4b9699['params']['id']}})[_0x9fe2('0x27')](handleEntityNotFound(_0x41e0fe,null))['then'](removeEntity(_0x41e0fe,null))[_0x9fe2('0x44')](handleError(_0x41e0fe,null));};exports[_0x9fe2('0x4e')]=function(_0x370a13,_0x53a393){return db[_0x9fe2('0x2c')]['describe']()['then'](respondWithResult(_0x53a393,null))[_0x9fe2('0x44')](handleError(_0x53a393,null));}; \ No newline at end of file +var _0x6507=['update','then','destroy','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','rows','catch','params','include','merge','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6507,0x1d0));var _0x7650=function(_0x5d37a1,_0x311473){_0x5d37a1=_0x5d37a1-0x0;var _0x5c7ca0=_0x6507[_0x5d37a1];return _0x5c7ca0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7650('0x0'));var rp=require(_0x7650('0x1'));var moment=require(_0x7650('0x2'));var BPromise=require(_0x7650('0x3'));var Mustache=require(_0x7650('0x4'));var util=require(_0x7650('0x5'));var path=require('path');var sox=require(_0x7650('0x6'));var csv=require(_0x7650('0x7'));var ejs=require(_0x7650('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7650('0x9'));var crypto=require(_0x7650('0xa'));var jsforce=require(_0x7650('0xb'));var deskjs=require(_0x7650('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7650('0xd'));var authService=require(_0x7650('0xe'));var qs=require(_0x7650('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7650('0x10'));var logger=require('../../config/logger')(_0x7650('0x11'));var utils=require('../../config/utils');var config=require(_0x7650('0x12'));var licenseUtil=require(_0x7650('0x13'));var db=require(_0x7650('0x14'))['db'];function respondWithStatusCode(_0x280399,_0x346bd7){_0x346bd7=_0x346bd7||0xcc;return function(_0x3fd863){if(_0x3fd863){return _0x280399['sendStatus'](_0x346bd7);}return _0x280399[_0x7650('0x15')](_0x346bd7)[_0x7650('0x16')]();};}function respondWithResult(_0x511ae0,_0x481247){_0x481247=_0x481247||0xc8;return function(_0x44a100){if(_0x44a100){return _0x511ae0['status'](_0x481247)[_0x7650('0x17')](_0x44a100);}};}function respondWithFilteredResult(_0x179755,_0x41e673){return function(_0x1911d7){if(_0x1911d7){var _0x13aee0=typeof _0x41e673[_0x7650('0x18')]===_0x7650('0x19')&&typeof _0x41e673[_0x7650('0x1a')]===_0x7650('0x19');var _0x235f6b=_0x1911d7[_0x7650('0x1b')];var _0x595712=_0x13aee0?0x0:_0x41e673[_0x7650('0x18')];var _0x5e67ec=_0x13aee0?_0x1911d7['count']:_0x41e673[_0x7650('0x18')]+_0x41e673[_0x7650('0x1a')];var _0x1db662;if(_0x5e67ec>=_0x235f6b){_0x5e67ec=_0x235f6b;_0x1db662=0xc8;}else{_0x1db662=0xce;}_0x179755[_0x7650('0x15')](_0x1db662);return _0x179755[_0x7650('0x1c')](_0x7650('0x1d'),_0x595712+'-'+_0x5e67ec+'/'+_0x235f6b)['json'](_0x1911d7);}return null;};}function patchUpdates(_0x26823a){return function(_0x45db2c){try{jsonpatch[_0x7650('0x1e')](_0x45db2c,_0x26823a,!![]);}catch(_0x225432){return BPromise[_0x7650('0x1f')](_0x225432);}return _0x45db2c[_0x7650('0x20')]();};}function saveUpdates(_0x516ec8,_0x34f5ff){return function(_0x2a405e){if(_0x2a405e){return _0x2a405e[_0x7650('0x21')](_0x516ec8)[_0x7650('0x22')](function(_0x2d0008){return _0x2d0008;});}return null;};}function removeEntity(_0x1ead58,_0x664ae7){return function(_0x43dc41){if(_0x43dc41){return _0x43dc41[_0x7650('0x23')]()[_0x7650('0x22')](function(){_0x1ead58[_0x7650('0x15')](0xcc)[_0x7650('0x16')]();});}};}function handleEntityNotFound(_0x44b7bc,_0x1c63e4){return function(_0x2be74c){if(!_0x2be74c){_0x44b7bc[_0x7650('0x24')](0x194);}return _0x2be74c;};}function handleError(_0x35849f,_0x38a6ea){_0x38a6ea=_0x38a6ea||0x1f4;return function(_0x5737e4){logger[_0x7650('0x25')](_0x5737e4[_0x7650('0x26')]);if(_0x5737e4[_0x7650('0x27')]){delete _0x5737e4[_0x7650('0x27')];}_0x35849f[_0x7650('0x15')](_0x38a6ea)['send'](_0x5737e4);};}exports[_0x7650('0x28')]=function(_0x573098,_0x4db2c7){var _0x5f1521={},_0x502436={},_0x1b1ecd={'count':0x0,'rows':[]};var _0x98077b=_[_0x7650('0x29')](db[_0x7650('0x2a')][_0x7650('0x2b')],function(_0x354ffe){return{'name':_0x354ffe['fieldName'],'type':_0x354ffe['type'][_0x7650('0x2c')]};});_0x502436[_0x7650('0x2d')]=_['map'](_0x98077b,_0x7650('0x27'));_0x502436[_0x7650('0x2e')]=_[_0x7650('0x2f')](_0x573098[_0x7650('0x2e')]);_0x502436['filters']=_[_0x7650('0x30')](_0x502436[_0x7650('0x2d')],_0x502436['query']);_0x5f1521[_0x7650('0x31')]=_[_0x7650('0x30')](_0x502436[_0x7650('0x2d')],qs[_0x7650('0x32')](_0x573098[_0x7650('0x2e')][_0x7650('0x32')]));_0x5f1521[_0x7650('0x31')]=_0x5f1521[_0x7650('0x31')][_0x7650('0x33')]?_0x5f1521[_0x7650('0x31')]:_0x502436[_0x7650('0x2d')];if(!_0x573098[_0x7650('0x2e')][_0x7650('0x34')]('nolimit')){_0x5f1521[_0x7650('0x1a')]=qs[_0x7650('0x1a')](_0x573098[_0x7650('0x2e')][_0x7650('0x1a')]);_0x5f1521['offset']=qs[_0x7650('0x18')](_0x573098[_0x7650('0x2e')][_0x7650('0x18')]);}_0x5f1521[_0x7650('0x35')]=qs['sort'](_0x573098['query'][_0x7650('0x36')]);_0x5f1521[_0x7650('0x37')]=qs[_0x7650('0x38')](_['pick'](_0x573098['query'],_0x502436[_0x7650('0x38')]),_0x98077b);if(_0x573098['query'][_0x7650('0x39')]){_0x5f1521[_0x7650('0x37')]=_['merge'](_0x5f1521[_0x7650('0x37')],{'$or':_[_0x7650('0x29')](_0x98077b,function(_0x4b4b98){if(_0x4b4b98[_0x7650('0x3a')]!==_0x7650('0x3b')){var _0x13541f={};_0x13541f[_0x4b4b98[_0x7650('0x27')]]={'$like':'%'+_0x573098[_0x7650('0x2e')][_0x7650('0x39')]+'%'};return _0x13541f;}})});}_0x5f1521=_['merge']({},_0x5f1521,_0x573098[_0x7650('0x3c')]);var _0x52fd05={'where':_0x5f1521[_0x7650('0x37')]};return db[_0x7650('0x2a')][_0x7650('0x1b')](_0x52fd05)['then'](function(_0x31dad0){_0x1b1ecd[_0x7650('0x1b')]=_0x31dad0;if(_0x573098[_0x7650('0x2e')][_0x7650('0x3d')]){_0x5f1521['include']=[{'all':!![]}];}return db[_0x7650('0x2a')]['findAll'](_0x5f1521);})[_0x7650('0x22')](function(_0x4aea65){_0x1b1ecd[_0x7650('0x3e')]=_0x4aea65;return _0x1b1ecd;})['then'](respondWithFilteredResult(_0x4db2c7,_0x5f1521))[_0x7650('0x3f')](handleError(_0x4db2c7,null));};exports['show']=function(_0x3be5a8,_0x3e23d5){var _0x432c72={'raw':!![],'where':{'id':_0x3be5a8[_0x7650('0x40')]['id']}},_0x20d10e={};_0x20d10e['model']=_[_0x7650('0x2f')](db['ChatTransferReport'][_0x7650('0x2b')]);_0x20d10e['query']=_[_0x7650('0x2f')](_0x3be5a8['query']);_0x20d10e[_0x7650('0x38')]=_[_0x7650('0x30')](_0x20d10e[_0x7650('0x2d')],_0x20d10e['query']);_0x432c72[_0x7650('0x31')]=_[_0x7650('0x30')](_0x20d10e[_0x7650('0x2d')],qs[_0x7650('0x32')](_0x3be5a8[_0x7650('0x2e')][_0x7650('0x32')]));_0x432c72[_0x7650('0x31')]=_0x432c72[_0x7650('0x31')][_0x7650('0x33')]?_0x432c72['attributes']:_0x20d10e['model'];if(_0x3be5a8[_0x7650('0x2e')]['includeAll']){_0x432c72[_0x7650('0x41')]=[{'all':!![]}];}_0x432c72=_[_0x7650('0x42')]({},_0x432c72,_0x3be5a8[_0x7650('0x3c')]);return db[_0x7650('0x2a')][_0x7650('0x43')](_0x432c72)['then'](handleEntityNotFound(_0x3e23d5,null))[_0x7650('0x22')](respondWithResult(_0x3e23d5,null))['catch'](handleError(_0x3e23d5,null));};exports[_0x7650('0x44')]=function(_0x1876f7,_0x38ba36){return db[_0x7650('0x2a')]['create'](_0x1876f7[_0x7650('0x45')],{})[_0x7650('0x22')](respondWithResult(_0x38ba36,0xc9))[_0x7650('0x3f')](handleError(_0x38ba36,null));};exports[_0x7650('0x21')]=function(_0xe3ccd,_0x454931){if(_0xe3ccd[_0x7650('0x45')]['id']){delete _0xe3ccd['body']['id'];}return db[_0x7650('0x2a')][_0x7650('0x43')]({'where':{'id':_0xe3ccd['params']['id']}})[_0x7650('0x22')](handleEntityNotFound(_0x454931,null))[_0x7650('0x22')](saveUpdates(_0xe3ccd[_0x7650('0x45')],null))['then'](respondWithResult(_0x454931,null))[_0x7650('0x3f')](handleError(_0x454931,null));};exports[_0x7650('0x23')]=function(_0x2907d6,_0x38d213){return db[_0x7650('0x2a')]['find']({'where':{'id':_0x2907d6[_0x7650('0x40')]['id']}})[_0x7650('0x22')](handleEntityNotFound(_0x38d213,null))[_0x7650('0x22')](removeEntity(_0x38d213,null))[_0x7650('0x3f')](handleError(_0x38d213,null));};exports[_0x7650('0x46')]=function(_0xd20f66,_0x5ec9d2){return db[_0x7650('0x2a')][_0x7650('0x46')]()['then'](respondWithResult(_0x5ec9d2,null))['catch'](handleError(_0x5ec9d2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5343412..2c99691 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 _0xa550=['bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xe13e3c,_0x3d3bff){var _0x4024a4=function(_0x163a24){while(--_0x163a24){_0xe13e3c['push'](_0xe13e3c['shift']());}};_0x4024a4(++_0x3d3bff);}(_0xa550,0x127));var _0x0a55=function(_0x4fc212,_0x1087aa){_0x4fc212=_0x4fc212-0x0;var _0x252317=_0xa550[_0x4fc212];return _0x252317;};'use strict';var _=require(_0x0a55('0x0'));var util=require(_0x0a55('0x1'));var logger=require(_0x0a55('0x2'))(_0x0a55('0x3'));var moment=require(_0x0a55('0x4'));var BPromise=require(_0x0a55('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a55('0x6'));var rimraf=require(_0x0a55('0x7'));var config=require(_0x0a55('0x8'));var attributes=require(_0x0a55('0x9'));module[_0x0a55('0xa')]=function(_0x2cfaef,_0x1334c3){return _0x2cfaef[_0x0a55('0xb')](_0x0a55('0xc'),attributes,{'tableName':_0x0a55('0xd'),'paranoid':![],'indexes':[{'name':_0x0a55('0xe'),'fields':[_0x0a55('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd16c=['path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','api','moment','request-promise'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xd16c,0x1dc));var _0xcd16=function(_0x1c7f76,_0x2fec34){_0x1c7f76=_0x1c7f76-0x0;var _0x2388d5=_0xd16c[_0x1c7f76];return _0x2388d5;};'use strict';var _=require(_0xcd16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcd16('0x1'));var moment=require(_0xcd16('0x2'));var BPromise=require('bluebird');var rp=require(_0xcd16('0x3'));var fs=require('fs');var path=require(_0xcd16('0x4'));var rimraf=require(_0xcd16('0x5'));var config=require(_0xcd16('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0xcd16('0x7')]=function(_0x35a73e,_0x110f17){return _0x35a73e[_0xcd16('0x8')](_0xcd16('0x9'),attributes,{'tableName':_0xcd16('0xa'),'paranoid':![],'indexes':[{'name':_0xcd16('0xb'),'fields':[_0xcd16('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e9548e2..6a3c949 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 _0xdd8b=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x4855a8,_0x1757ca){var _0x2849b4=function(_0x36c890){while(--_0x36c890){_0x4855a8['push'](_0x4855a8['shift']());}};_0x2849b4(++_0x1757ca);}(_0xdd8b,0x1b1));var _0xbdd8=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xdd8b[_0x879e31];return _0x3467e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdd8('0x0'));var BPromise=require('bluebird');var rs=require(_0xbdd8('0x1'));var fs=require('fs');var Redis=require(_0xbdd8('0x2'));var db=require(_0xbdd8('0x3'))['db'];var utils=require(_0xbdd8('0x4'));var logger=require('../../config/logger')(_0xbdd8('0x5'));var config=require(_0xbdd8('0x6'));var jayson=require(_0xbdd8('0x7'));var client=jayson[_0xbdd8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f955b,_0x5458cb,_0x6ec023){return new BPromise(function(_0xe86234,_0x417899){return client['request'](_0x8f955b,_0x6ec023)['then'](function(_0x487381){logger[_0xbdd8('0x9')](_0xbdd8('0xa'),_0x5458cb,_0xbdd8('0xb'));logger[_0xbdd8('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5458cb,_0xbdd8('0xb'),JSON[_0xbdd8('0xd')](_0x487381));if(_0x487381[_0xbdd8('0xe')]){if(_0x487381[_0xbdd8('0xe')]['code']===0x1f4){logger[_0xbdd8('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x5458cb,_0x487381['error'][_0xbdd8('0xf')]);return _0x417899(_0x487381[_0xbdd8('0xe')]['message']);}logger[_0xbdd8('0xe')](_0xbdd8('0xa'),_0x5458cb,_0x487381[_0xbdd8('0xe')]['message']);return _0xe86234(_0x487381[_0xbdd8('0xe')]['message']);}else{logger[_0xbdd8('0x9')](_0xbdd8('0xa'),_0x5458cb,_0xbdd8('0xb'));_0xe86234(_0x487381[_0xbdd8('0x10')]['message']);}})[_0xbdd8('0x11')](function(_0x5b011d){logger[_0xbdd8('0xe')](_0xbdd8('0xa'),_0x5458cb,_0x5b011d);_0x417899(_0x5b011d);});});} \ No newline at end of file +var _0x3b2c=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x2deb01,_0x4e741c){var _0x3920b3=function(_0x391a64){while(--_0x391a64){_0x2deb01['push'](_0x2deb01['shift']());}};_0x3920b3(++_0x4e741c);}(_0x3b2c,0x10c));var _0xc3b2=function(_0x14910c,_0x2f2a10){_0x14910c=_0x14910c-0x0;var _0x5012ec=_0x3b2c[_0x14910c];return _0x5012ec;};'use strict';var _=require('lodash');var util=require(_0xc3b2('0x0'));var moment=require(_0xc3b2('0x1'));var BPromise=require(_0xc3b2('0x2'));var rs=require(_0xc3b2('0x3'));var fs=require('fs');var Redis=require(_0xc3b2('0x4'));var db=require(_0xc3b2('0x5'))['db'];var utils=require(_0xc3b2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc3b2('0x7'));var jayson=require(_0xc3b2('0x8'));var client=jayson[_0xc3b2('0x9')][_0xc3b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31390e,_0x5285b8,_0x711e8b){return new BPromise(function(_0x4f2c51,_0x52852e){return client[_0xc3b2('0xb')](_0x31390e,_0x711e8b)[_0xc3b2('0xc')](function(_0x33cd8a){logger['info'](_0xc3b2('0xd'),_0x5285b8,_0xc3b2('0xe'));logger['debug'](_0xc3b2('0xf'),_0x5285b8,_0xc3b2('0xe'),JSON[_0xc3b2('0x10')](_0x33cd8a));if(_0x33cd8a['error']){if(_0x33cd8a['error'][_0xc3b2('0x11')]===0x1f4){logger['error'](_0xc3b2('0xd'),_0x5285b8,_0x33cd8a['error'][_0xc3b2('0x12')]);return _0x52852e(_0x33cd8a[_0xc3b2('0x13')][_0xc3b2('0x12')]);}logger['error'](_0xc3b2('0xd'),_0x5285b8,_0x33cd8a['error'][_0xc3b2('0x12')]);return _0x4f2c51(_0x33cd8a[_0xc3b2('0x13')][_0xc3b2('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x5285b8,'request\x20sent');_0x4f2c51(_0x33cd8a[_0xc3b2('0x14')][_0xc3b2('0x12')]);}})['catch'](function(_0x231a1e){logger[_0xc3b2('0x13')](_0xc3b2('0xd'),_0x5285b8,_0x231a1e);_0x52852e(_0x231a1e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 76ecb29..c913e77 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 _0x4c09=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x154e6e,_0x4a83fe){var _0x55f56e=function(_0x3e6c13){while(--_0x3e6c13){_0x154e6e['push'](_0x154e6e['shift']());}};_0x55f56e(++_0x4a83fe);}(_0x4c09,0xf9));var _0x94c0=function(_0x3879f5,_0x5b4fe8){_0x3879f5=_0x3879f5-0x0;var _0x27ee90=_0x4c09[_0x3879f5];return _0x27ee90;};'use strict';var multer=require(_0x94c0('0x0'));var util=require('util');var path=require(_0x94c0('0x1'));var timeout=require(_0x94c0('0x2'));var express=require('express');var router=express[_0x94c0('0x3')]();var fs_extra=require(_0x94c0('0x4'));var auth=require(_0x94c0('0x5'));var interaction=require(_0x94c0('0x6'));var config=require(_0x94c0('0x7'));var controller=require('./chatTransferReport.controller');router[_0x94c0('0x8')]('/',auth[_0x94c0('0x9')](),controller[_0x94c0('0xa')]);router[_0x94c0('0x8')](_0x94c0('0xb'),auth['isAuthenticated'](),controller[_0x94c0('0xc')]);router[_0x94c0('0x8')](_0x94c0('0xd'),auth['isAuthenticated'](),controller[_0x94c0('0xe')]);router[_0x94c0('0xf')]('/',auth[_0x94c0('0x9')](),controller[_0x94c0('0x10')]);router[_0x94c0('0x11')](_0x94c0('0xd'),auth[_0x94c0('0x9')](),controller['update']);router[_0x94c0('0x12')](_0x94c0('0xd'),auth[_0x94c0('0x9')](),controller[_0x94c0('0x13')]);module[_0x94c0('0x14')]=router; \ No newline at end of file +var _0xdda3=['/describe','show','post','create','put','/:id','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdda3,0xcf));var _0x3dda=function(_0x372c96,_0x59799b){_0x372c96=_0x372c96-0x0;var _0x4ad389=_0xdda3[_0x372c96];return _0x4ad389;};'use strict';var multer=require('multer');var util=require(_0x3dda('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3dda('0x1')]();var fs_extra=require(_0x3dda('0x2'));var auth=require(_0x3dda('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3dda('0x4'));var controller=require(_0x3dda('0x5'));router[_0x3dda('0x6')]('/',auth[_0x3dda('0x7')](),controller[_0x3dda('0x8')]);router['get'](_0x3dda('0x9'),auth[_0x3dda('0x7')](),controller['describe']);router[_0x3dda('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x3dda('0xa')]);router[_0x3dda('0xb')]('/',auth[_0x3dda('0x7')](),controller[_0x3dda('0xc')]);router[_0x3dda('0xd')](_0x3dda('0xe'),auth[_0x3dda('0x7')](),controller['update']);router[_0x3dda('0xf')](_0x3dda('0xe'),auth[_0x3dda('0x7')](),controller[_0x3dda('0x10')]);module[_0x3dda('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6d5ff14..c2d6243 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 _0x3142=['Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','input','name','text','email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','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','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message'];(function(_0x5d5773,_0x43303c){var _0x3c1acd=function(_0x4f69ea){while(--_0x4f69ea){_0x5d5773['push'](_0x5d5773['shift']());}};_0x3c1acd(++_0x43303c);}(_0x3142,0xb9));var _0x2314=function(_0x5a6acc,_0x1d4209){_0x5a6acc=_0x5a6acc-0x0;var _0x456651=_0x3142[_0x5a6acc];return _0x456651;};'use strict';var Sequelize=require(_0x2314('0x0'));var rs=require(_0x2314('0x1'));module[_0x2314('0x2')]={'name':{'type':Sequelize[_0x2314('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x2314('0x3')],'allowNull':![],'unique':_0x2314('0x4')},'description':{'type':Sequelize[_0x2314('0x3')]},'mapKey':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x2314('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2314('0x3')],'allowNull':![],'defaultValue':_0x2314('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2314('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2314('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2314('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2314('0x3')]},'animation':{'type':Sequelize[_0x2314('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2314('0x9')](_0x2314('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0xb')},'start_chat_button':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0xc')},'offline_chat_button':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0xd')},'download_transcript':{'type':Sequelize[_0x2314('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2314('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2314('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2314('0xe')]},'closingQuestion':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x11')},'noteTitle':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x12')},'closingMessage':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x2314('0x14')},'skipMessageButton':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x15')},'conditionAgreement':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x16')},'ratingType':{'type':Sequelize[_0x2314('0x9')](_0x2314('0x17'),'thumb'),'defaultValue':_0x2314('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x2314('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2314('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2314('0x18'),'variable':null,'config':{'placeholder':_0x2314('0x19'),'type':_0x2314('0x1a'),'required':!![]},'props':{'title':_0x2314('0x19'),'helpText':''}},{'type':_0x2314('0x18'),'props':{'title':_0x2314('0x1b'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2314('0x1b')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2314('0x1c')](_0x2314('0x1d'))?JSON[_0x2314('0x1e')](this[_0x2314('0x1c')](_0x2314('0x1d'))):{};},'set':function(_0x42e346){return this[_0x2314('0x1f')](_0x2314('0x1d'),JSON['stringify'](_0x42e346));}},'offlineForm':{'type':Sequelize[_0x2314('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2314('0x18'),'props':{'title':_0x2314('0x1b'),'helpText':''},'config':{'required':!![],'placeholder':_0x2314('0x1b'),'type':_0x2314('0x1b')},'variable':null},{'type':_0x2314('0x20'),'config':{'placeholder':_0x2314('0x21')},'props':{'title':_0x2314('0x21'),'helpText':_0x2314('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x2314('0x1e')](this['getDataValue'](_0x2314('0x23'))):{};},'set':function(_0x4a1df0){return this['setDataValue']('offlineForm',JSON['stringify'](_0x4a1df0));}},'token':{'type':Sequelize[_0x2314('0x3')],'defaultValue':function(){return rs[_0x2314('0x24')]();}},'autoclose':{'type':Sequelize[_0x2314('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x25')},'offlineMessageBody':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2314('0x27')},'skipUnmanaged':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x14')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2314('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2314('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2314('0x28');}},'notificationSound':{'type':Sequelize[_0x2314('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x2314('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x2314('0x29')},'verticalAlignment':{'type':Sequelize[_0x2314('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x2a')},'messagesAlignment':{'type':Sequelize[_0x2314('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x2314('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2314('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2314('0x3')],'allowNull':![],'defaultValue':_0x2314('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2314('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2314('0x3')],'defaultValue':_0x2314('0x2c')},'systemAvatar':{'type':Sequelize[_0x2314('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2314('0x7')],'comment':_0x2314('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![],'comment':_0x2314('0x2e'),'set':function(_0x4b8dfd){if(!_0x4b8dfd)this[_0x2314('0x1f')](_0x2314('0x2f'),null);this[_0x2314('0x1f')](_0x2314('0x30'),_0x4b8dfd);}},'vidaooEscalation':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x2314('0x3')],'allowNull':![],'defaultValue':_0x2314('0x31')},'vidaooNote':{'type':Sequelize[_0x2314('0x3')],'defaultValue':function(){return _0x2314('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x2314('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2314('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2314('0xe')]}}; \ No newline at end of file +var _0xf5e9=['Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','onlineForm','getDataValue','setDataValue','TEXT','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','INTEGER','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','BOOLEAN','rounded','squared','We\x20are\x20here!'];(function(_0x401d96,_0x31d181){var _0xd6ec1f=function(_0x55a045){while(--_0x55a045){_0x401d96['push'](_0x401d96['shift']());}};_0xd6ec1f(++_0x31d181);}(_0xf5e9,0x185));var _0x9f5e=function(_0x164e76,_0x4446cc){_0x164e76=_0x164e76-0x0;var _0x44e4b4=_0xf5e9[_0x164e76];return _0x44e4b4;};'use strict';var Sequelize=require(_0x9f5e('0x0'));var rs=require(_0x9f5e('0x1'));module['exports']={'name':{'type':Sequelize[_0x9f5e('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x9f5e('0x2')],'allowNull':![],'unique':_0x9f5e('0x3')},'description':{'type':Sequelize[_0x9f5e('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x9f5e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x4')},'key':{'type':Sequelize[_0x9f5e('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x5')},'customerAlias':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9f5e('0x2')],'allowNull':![],'defaultValue':_0x9f5e('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9f5e('0x2')],'allowNull':![],'defaultValue':_0x9f5e('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9f5e('0x2')]},'animation':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x9f5e('0x8'),_0x9f5e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0xa')},'start_chat_button':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9f5e('0xc')},'header_offline':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x9f5e('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x9f5e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x11')},'noteTitle':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x13')},'closingMessageButton':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x14')},'conditionAgreement':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x9f5e('0x16'),_0x9f5e('0x17')),'defaultValue':_0x9f5e('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9f5e('0x18')]({'items':[{'type':_0x9f5e('0x19'),'variable':null,'config':{'placeholder':_0x9f5e('0x1a'),'type':'text','required':!![]},'props':{'title':_0x9f5e('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x9f5e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9f5e('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x9f5e('0x1b'))?JSON['parse'](this[_0x9f5e('0x1c')]('onlineForm')):{};},'set':function(_0xbcb8f6){return this[_0x9f5e('0x1d')]('onlineForm',JSON[_0x9f5e('0x18')](_0xbcb8f6));}},'offlineForm':{'type':Sequelize[_0x9f5e('0x1e')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9f5e('0x19'),'props':{'title':_0x9f5e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9f5e('0x4'),'type':_0x9f5e('0x4')},'variable':null},{'type':_0x9f5e('0x1f'),'config':{'placeholder':_0x9f5e('0x20')},'props':{'title':_0x9f5e('0x20'),'helpText':_0x9f5e('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x9f5e('0x1c')](_0x9f5e('0x22'))?JSON[_0x9f5e('0x23')](this['getDataValue'](_0x9f5e('0x22'))):{};},'set':function(_0x125fc2){return this[_0x9f5e('0x1d')](_0x9f5e('0x22'),JSON['stringify'](_0x125fc2));}},'token':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9f5e('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x24')},'waitingMessage':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x25')},'skipUnmanaged':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x14')},'sendUnmanaged':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9f5e('0x1e')]},'showAgentAvatar':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9f5e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9f5e('0x1e')],'defaultValue':function(){return _0x9f5e('0x26');}},'notificationSound':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f5e('0x28')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':_0x9f5e('0x29')},'verticalAlignment':{'type':Sequelize[_0x9f5e('0x28')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x9f5e('0x2a')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9f5e('0x2b')},'defaultTitle':{'type':Sequelize[_0x9f5e('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9f5e('0x28')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9f5e('0x2')],'allowNull':![],'defaultValue':_0x9f5e('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f5e('0x28')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f5e('0x28')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9f5e('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x9f5e('0x1e')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f5e('0x28')],'comment':_0x9f5e('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![],'comment':_0x9f5e('0x2e'),'set':function(_0x52ab72){if(!_0x52ab72)this['setDataValue'](_0x9f5e('0x2f'),null);this[_0x9f5e('0x1d')]('mandatoryDisposition',_0x52ab72);}},'vidaooEscalation':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9f5e('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f5e('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x9f5e('0x31');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9f5e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9f5e('0x1e')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3e3f7d6..ead08ec 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 _0x34e7=['tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','custom','all','some','utf8','remote','x-real-ip','remoteAddress','replace','alignment','textColor','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','info','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','map','ChatWebsite','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','Pause','mandatoryDispositionPause','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','existsSync','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','DESC','ChatApplication','Applications','account','applications','list','Contacts','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','no\x20available\x20attributes','ListId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','Tags','color'];(function(_0x5914c2,_0x4fd1bb){var _0x381436=function(_0x83072a){while(--_0x83072a){_0x5914c2['push'](_0x5914c2['shift']());}};_0x381436(++_0x4fd1bb);}(_0x34e7,0x164));var _0x734e=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x34e7[_0x4ec520];return _0xed49d7;};'use strict';var BPromise=require(_0x734e('0x0'));var Mustache=require(_0x734e('0x1'));var util=require(_0x734e('0x2'));var path=require(_0x734e('0x3'));var ejs=require(_0x734e('0x4'));var fs=require('fs');var fs_extra=require(_0x734e('0x5'));var _=require(_0x734e('0x6'));var querystring=require(_0x734e('0x7'));var Redis=require(_0x734e('0x8'));var qs=require(_0x734e('0x9'));var logger=require(_0x734e('0xa'))(_0x734e('0xb'));var config=require(_0x734e('0xc'));var db=require(_0x734e('0xd'))['db'];config['redis']=_[_0x734e('0xe')](config[_0x734e('0xf')],{'host':_0x734e('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x734e('0xf')]));require('./chatWebsite.socket')[_0x734e('0x11')](socket);var htmlToText=require(_0x734e('0x12'));var jayson=require(_0x734e('0x13'));var client=jayson[_0x734e('0x14')][_0x734e('0x15')]({'port':0x232c});var client9002=jayson[_0x734e('0x14')]['http']({'port':0x232a});var client9003=jayson['client'][_0x734e('0x15')]({'port':0x232b});var client9001=jayson[_0x734e('0x14')][_0x734e('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x33013a,_0x4bf3e0,_0x1cca88,_0x2cfb3a){return new BPromise(function(_0x507bca,_0x17f200){var _0x58df71=_0x2cfb3a||client;return _0x58df71[_0x734e('0x16')](_0x33013a,_0x1cca88)[_0x734e('0x17')](function(_0x4f16d8){logger['info'](_0x734e('0x18'),_0x4bf3e0,_0x734e('0x19'));logger[_0x734e('0x1a')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4bf3e0,_0x734e('0x19'),JSON['stringify'](_0x4f16d8));if(_0x4f16d8[_0x734e('0x1b')]){if(_0x4f16d8[_0x734e('0x1b')]['code']===0x1f4){logger[_0x734e('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x4bf3e0,_0x4f16d8[_0x734e('0x1b')]['message']);return _0x17f200(_0x4f16d8[_0x734e('0x1b')][_0x734e('0x1c')]);}logger[_0x734e('0x1b')](_0x734e('0x18'),_0x4bf3e0,_0x4f16d8[_0x734e('0x1b')][_0x734e('0x1c')]);return _0x507bca(_0x4f16d8[_0x734e('0x1b')][_0x734e('0x1c')]);}else{logger[_0x734e('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x4bf3e0,_0x734e('0x19'));_0x507bca(_0x4f16d8['result'][_0x734e('0x1c')]);}})['catch'](function(_0x491759){logger[_0x734e('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x4bf3e0,_0x491759);_0x17f200(_0x491759);});});}function respondWithStatusCode(_0x21b1a0,_0x5914e9){_0x5914e9=_0x5914e9||0xcc;return function(_0x6c9792){if(_0x6c9792){return _0x21b1a0[_0x734e('0x1e')](_0x5914e9);}return _0x21b1a0[_0x734e('0x1f')](_0x5914e9)[_0x734e('0x20')]();};}function respondWithResult(_0x23af96,_0xf26b80){_0xf26b80=_0xf26b80||0xc8;return function(_0xf72cd7){if(_0xf72cd7){return _0x23af96[_0x734e('0x1f')](_0xf26b80)[_0x734e('0x21')](_0xf72cd7);}};}function respondWithFilteredResult(_0x482e66,_0x5b5778){return function(_0x1276ba){if(_0x1276ba){var _0x417961=typeof _0x5b5778[_0x734e('0x22')]===_0x734e('0x23')&&typeof _0x5b5778[_0x734e('0x24')]===_0x734e('0x23');var _0xe7de3=_0x1276ba[_0x734e('0x25')];var _0x4c74af=_0x417961?0x0:_0x5b5778[_0x734e('0x22')];var _0x53b422=_0x417961?_0x1276ba[_0x734e('0x25')]:_0x5b5778[_0x734e('0x22')]+_0x5b5778[_0x734e('0x24')];var _0x44c379;if(_0x53b422>=_0xe7de3){_0x53b422=_0xe7de3;_0x44c379=0xc8;}else{_0x44c379=0xce;}_0x482e66['status'](_0x44c379);return _0x482e66[_0x734e('0x26')](_0x734e('0x27'),_0x4c74af+'-'+_0x53b422+'/'+_0xe7de3)[_0x734e('0x21')](_0x1276ba);}return null;};}function saveUpdates(_0xa9aaba){return function(_0x2bdfe6){if(_0x2bdfe6){return _0x2bdfe6['update'](_0xa9aaba)[_0x734e('0x17')](function(_0x24558b){return _0x24558b;});}return null;};}function removeEntity(_0x33652f){return function(_0xf9deb1){if(_0xf9deb1){return _0xf9deb1['destroy']()['then'](function(){var _0x496aa3=_0xf9deb1[_0x734e('0x28')]({'plain':!![]});var _0xbf389e=_0x734e('0x29');return db[_0x734e('0x2a')][_0x734e('0x2b')]({'where':{'type':_0xbf389e,'resourceId':_0x496aa3['id']}})[_0x734e('0x17')](function(){return _0xf9deb1;});})[_0x734e('0x17')](function(){_0x33652f[_0x734e('0x1f')](0xcc)[_0x734e('0x20')]();});}};}function handleEntityNotFound(_0x5f4135){return function(_0x4d9687){if(!_0x4d9687){_0x5f4135[_0x734e('0x1e')](0x194);}return _0x4d9687;};}function handleError(_0x3c308f,_0x15c68d){_0x15c68d=_0x15c68d||0x1f4;return function(_0x4d38aa){logger[_0x734e('0x1b')](_0x4d38aa[_0x734e('0x2c')]);if(_0x4d38aa['name']){delete _0x4d38aa[_0x734e('0x2d')];}_0x3c308f[_0x734e('0x1f')](_0x15c68d)[_0x734e('0x2e')](_0x4d38aa);};}exports[_0x734e('0x2f')]=function(_0x5a55c5,_0x29e410){var _0x2267ec={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2c99a1={},_0x5e29e0={'count':0x0,'rows':[]};var _0x1af307=_[_0x734e('0x30')](db[_0x734e('0x31')][_0x734e('0x32')],function(_0x4b6e1a){return{'name':_0x4b6e1a['fieldName'],'type':_0x4b6e1a[_0x734e('0x33')][_0x734e('0x34')]};});_0x2c99a1[_0x734e('0x35')]=_[_0x734e('0x30')](_0x1af307,_0x734e('0x2d'));_0x2c99a1[_0x734e('0x36')]=_['keys'](_0x5a55c5[_0x734e('0x36')]);_0x2c99a1[_0x734e('0x37')]=_['intersection'](_0x2c99a1[_0x734e('0x35')],_0x2c99a1[_0x734e('0x36')]);_0x2267ec[_0x734e('0x38')]=_[_0x734e('0x39')](_0x2c99a1[_0x734e('0x35')],qs[_0x734e('0x3a')](_0x5a55c5[_0x734e('0x36')]['fields']));_0x2267ec['attributes']=_0x2267ec[_0x734e('0x38')][_0x734e('0x3b')]?_0x2267ec[_0x734e('0x38')]:_0x2c99a1['model'];if(!_0x5a55c5[_0x734e('0x36')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x2267ec[_0x734e('0x24')]=qs[_0x734e('0x24')](_0x5a55c5[_0x734e('0x36')][_0x734e('0x24')]);_0x2267ec[_0x734e('0x22')]=qs['offset'](_0x5a55c5[_0x734e('0x36')]['offset']);}_0x2267ec[_0x734e('0x3e')]=qs['sort'](_0x5a55c5[_0x734e('0x36')][_0x734e('0x3f')]);_0x2267ec['where']=qs[_0x734e('0x37')](_[_0x734e('0x40')](_0x5a55c5['query'],_0x2c99a1[_0x734e('0x37')]),_0x1af307);if(_0x5a55c5[_0x734e('0x36')]['filter']){_0x2267ec[_0x734e('0x41')]=_['merge'](_0x2267ec[_0x734e('0x41')],{'$or':_[_0x734e('0x30')](_0x1af307,function(_0x4650bb){if(_0x4650bb[_0x734e('0x33')]!==_0x734e('0x42')){var _0x5da304={};_0x5da304[_0x4650bb[_0x734e('0x2d')]]={'$like':'%'+_0x5a55c5[_0x734e('0x36')][_0x734e('0x43')]+'%'};return _0x5da304;}})});}_0x2267ec=_['merge']({},_0x2267ec,_0x5a55c5[_0x734e('0x44')]);var _0x53f223={'where':_0x2267ec[_0x734e('0x41')]};return db['ChatWebsite'][_0x734e('0x25')](_0x53f223)[_0x734e('0x17')](function(_0x20f6df){_0x5e29e0[_0x734e('0x25')]=_0x20f6df;if(_0x5a55c5[_0x734e('0x36')]['includeAll']){_0x2267ec[_0x734e('0x45')]=[{'all':!![]}];}return db['ChatWebsite'][_0x734e('0x46')](_0x2267ec);})['then'](function(_0x5ac67c){_0x5e29e0[_0x734e('0x47')]=_0x5ac67c;return _0x5e29e0;})['then'](respondWithFilteredResult(_0x29e410,_0x2267ec))[_0x734e('0x48')](handleError(_0x29e410,null));};exports[_0x734e('0x49')]=function(_0x33a877,_0x620ffc){var _0x4cd4c3={'raw':![],'where':{'id':_0x33a877['params']['id']},'include':[{'model':db[_0x734e('0x4a')],'as':_0x734e('0x4b')}]},_0x333124={};_0x333124[_0x734e('0x35')]=_[_0x734e('0x4c')](db[_0x734e('0x31')][_0x734e('0x32')]);_0x333124[_0x734e('0x36')]=_[_0x734e('0x4c')](_0x33a877['query']);_0x333124[_0x734e('0x37')]=_[_0x734e('0x39')](_0x333124[_0x734e('0x35')],_0x333124[_0x734e('0x36')]);_0x4cd4c3[_0x734e('0x38')]=_['intersection'](_0x333124[_0x734e('0x35')],qs['fields'](_0x33a877[_0x734e('0x36')][_0x734e('0x3a')]));_0x4cd4c3[_0x734e('0x38')]=_0x4cd4c3[_0x734e('0x38')]['length']?_0x4cd4c3[_0x734e('0x38')]:_0x333124[_0x734e('0x35')];if(_0x33a877[_0x734e('0x36')]['includeAll']){_0x4cd4c3[_0x734e('0x45')]=[{'all':!![]}];}_0x4cd4c3=_[_0x734e('0x4d')]({},_0x4cd4c3,_0x33a877[_0x734e('0x44')]);return db[_0x734e('0x31')][_0x734e('0x4e')](_0x4cd4c3)['then'](handleEntityNotFound(_0x620ffc,null))[_0x734e('0x17')](respondWithResult(_0x620ffc,null))['catch'](handleError(_0x620ffc,null));};exports[_0x734e('0x4f')]=function(_0x169ae5,_0x45194f){return db[_0x734e('0x31')][_0x734e('0x4f')](_0x169ae5[_0x734e('0x50')],{})[_0x734e('0x17')](function(_0x77e650){var _0x18c0fe=_0x169ae5['user'][_0x734e('0x28')]({'plain':!![]});if(!_0x18c0fe)throw new Error(_0x734e('0x51'));if(_0x18c0fe[_0x734e('0x52')]===_0x734e('0x53')){var _0xc857ce=_0x77e650['get']({'plain':!![]});var _0x2a9f4f=_0x734e('0x29');return db['UserProfileSection'][_0x734e('0x4e')]({'where':{'name':_0x2a9f4f,'userProfileId':_0x18c0fe[_0x734e('0x54')]},'raw':!![]})['then'](function(_0x48897e){if(_0x48897e&&_0x48897e['autoAssociation']===0x0){return db['UserProfileResource'][_0x734e('0x4f')]({'name':_0xc857ce[_0x734e('0x2d')],'resourceId':_0xc857ce['id'],'type':_0x48897e[_0x734e('0x2d')],'sectionId':_0x48897e['id']},{})[_0x734e('0x17')](function(){return _0x77e650;});}else{return _0x77e650;}})['catch'](function(_0x6fc19a){logger[_0x734e('0x1b')](_0x734e('0x55'),_0x6fc19a);throw _0x6fc19a;});}return _0x77e650;})['then'](respondWithResult(_0x45194f,0xc9))[_0x734e('0x48')](handleError(_0x45194f,null));};exports[_0x734e('0x56')]=function(_0x5f3044,_0x3c3278){if(_0x5f3044[_0x734e('0x50')]['id']){delete _0x5f3044[_0x734e('0x50')]['id'];}return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x5f3044[_0x734e('0x57')]['id']},'include':[{'model':db[_0x734e('0x4a')],'as':_0x734e('0x4b')}]})['then'](handleEntityNotFound(_0x3c3278,null))['then'](saveUpdates(_0x5f3044[_0x734e('0x50')],null))[_0x734e('0x17')](respondWithResult(_0x3c3278,null))[_0x734e('0x48')](handleError(_0x3c3278,null));};exports['destroy']=function(_0x37f9a9,_0x29fba6){return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x37f9a9[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x29fba6,null))[_0x734e('0x17')](removeEntity(_0x29fba6,null))[_0x734e('0x48')](handleError(_0x29fba6,null));};exports[_0x734e('0x58')]=function(_0x5102c3,_0x17c6e1){return db[_0x734e('0x31')][_0x734e('0x58')]()[_0x734e('0x17')](respondWithResult(_0x17c6e1,null))['catch'](handleError(_0x17c6e1,null));};exports[_0x734e('0x59')]=function(_0x26e381,_0x3f85fc){if(_0x26e381['body']['id']){delete _0x26e381[_0x734e('0x50')]['id'];}return db[_0x734e('0x31')]['find']({'where':{'id':_0x26e381[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x3f85fc,null))[_0x734e('0x17')](function(_0x38de2b){if(_0x38de2b){_0x26e381[_0x734e('0x50')][_0x734e('0x5a')]=_0x38de2b['id'];return db[_0x734e('0x5b')]['create'](_0x26e381[_0x734e('0x50')]);}})['then'](respondWithResult(_0x3f85fc,null))[_0x734e('0x48')](handleError(_0x3f85fc,null));};exports[_0x734e('0x5c')]=function(_0x4d549b,_0x4760c5){var _0x1fb63d={'raw':![],'where':{}};var _0x59b0bd={};var _0x203d12={'count':0x0,'rows':[]};return db[_0x734e('0x31')]['findOne']({'where':{'id':_0x4d549b[_0x734e('0x57')]['id']}})['then'](handleEntityNotFound(_0x4760c5,null))['then'](function(_0x3bfe60){if(_0x3bfe60){_0x59b0bd[_0x734e('0x35')]=_[_0x734e('0x4c')](db[_0x734e('0x5b')]['rawAttributes']);_0x59b0bd[_0x734e('0x36')]=_['keys'](_0x4d549b['query']);_0x59b0bd[_0x734e('0x37')]=_[_0x734e('0x39')](_0x59b0bd[_0x734e('0x35')],_0x59b0bd['query']);_0x1fb63d[_0x734e('0x38')]=_[_0x734e('0x39')](_0x59b0bd['model'],qs['fields'](_0x4d549b['query']['fields']));_0x1fb63d[_0x734e('0x38')]=_0x1fb63d['attributes'][_0x734e('0x3b')]?_0x1fb63d[_0x734e('0x38')]:_0x59b0bd[_0x734e('0x35')];if(!_0x4d549b[_0x734e('0x36')][_0x734e('0x3c')]('nolimit')){_0x1fb63d[_0x734e('0x24')]=qs[_0x734e('0x24')](_0x4d549b[_0x734e('0x36')][_0x734e('0x24')]);_0x1fb63d[_0x734e('0x22')]=qs['offset'](_0x4d549b[_0x734e('0x36')][_0x734e('0x22')]);}_0x1fb63d[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x4d549b[_0x734e('0x36')][_0x734e('0x3f')]);_0x1fb63d[_0x734e('0x41')]=qs[_0x734e('0x37')](_['pick'](_0x4d549b[_0x734e('0x36')],_0x59b0bd[_0x734e('0x37')]));_0x1fb63d[_0x734e('0x41')]['ChatWebsiteId']=_0x3bfe60['id'];if(_0x4d549b[_0x734e('0x36')][_0x734e('0x43')]){_0x1fb63d[_0x734e('0x41')]=_[_0x734e('0x4d')](_0x1fb63d['where'],{'$or':_[_0x734e('0x30')](_0x1fb63d[_0x734e('0x38')],function(_0x3656db){var _0x46057d={};_0x46057d[_0x3656db]={'$like':'%'+_0x4d549b[_0x734e('0x36')][_0x734e('0x43')]+'%'};return _0x46057d;})});}_0x1fb63d=_[_0x734e('0x4d')]({},_0x1fb63d,_0x4d549b[_0x734e('0x44')]);return db[_0x734e('0x5b')][_0x734e('0x25')]({'where':_0x1fb63d[_0x734e('0x41')]})['then'](function(_0x365392){_0x203d12[_0x734e('0x25')]=_0x365392;if(_0x4d549b[_0x734e('0x36')][_0x734e('0x5d')]){_0x1fb63d[_0x734e('0x45')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1fb63d);})[_0x734e('0x17')](function(_0x2cb91a){_0x203d12[_0x734e('0x47')]=_0x2cb91a;return _0x203d12;});}})['then'](respondWithFilteredResult(_0x4760c5,_0x1fb63d))[_0x734e('0x48')](handleError(_0x4760c5,null));};exports[_0x734e('0x5e')]=function(_0x415682,_0x5f5423){return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x415682['params']['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x5f5423,null))['then'](function(_0x1a27ec){if(_0x1a27ec){return _0x1a27ec['removeDispositions'](_0x415682[_0x734e('0x36')][_0x734e('0x5f')]);}})[_0x734e('0x17')](respondWithStatusCode(_0x5f5423,null))[_0x734e('0x48')](handleError(_0x5f5423,null));};exports['addAnswer']=function(_0x5a111f,_0x3fc3ab){if(_0x5a111f['body']['id']){delete _0x5a111f[_0x734e('0x50')]['id'];}return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x5a111f[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x3fc3ab,null))[_0x734e('0x17')](function(_0x50907b){if(_0x50907b){_0x5a111f['body'][_0x734e('0x5a')]=_0x50907b['id'];return db[_0x734e('0x60')]['create'](_0x5a111f[_0x734e('0x50')]);}})['then'](respondWithResult(_0x3fc3ab,null))[_0x734e('0x48')](handleError(_0x3fc3ab,null));};exports[_0x734e('0x61')]=function(_0xba242c,_0x1b3da4){var _0x426c48={'raw':![],'where':{}};var _0x3648bd={};var _0x7ddbef={'count':0x0,'rows':[]};return db[_0x734e('0x31')][_0x734e('0x62')]({'where':{'id':_0xba242c[_0x734e('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b3da4,null))[_0x734e('0x17')](function(_0x578fe7){if(_0x578fe7){_0x3648bd[_0x734e('0x35')]=_['keys'](db[_0x734e('0x60')][_0x734e('0x32')]);_0x3648bd[_0x734e('0x36')]=_[_0x734e('0x4c')](_0xba242c['query']);_0x3648bd[_0x734e('0x37')]=_['intersection'](_0x3648bd[_0x734e('0x35')],_0x3648bd[_0x734e('0x36')]);_0x426c48[_0x734e('0x38')]=_[_0x734e('0x39')](_0x3648bd[_0x734e('0x35')],qs[_0x734e('0x3a')](_0xba242c['query']['fields']));_0x426c48[_0x734e('0x38')]=_0x426c48['attributes'][_0x734e('0x3b')]?_0x426c48['attributes']:_0x3648bd[_0x734e('0x35')];if(!_0xba242c[_0x734e('0x36')]['hasOwnProperty']('nolimit')){_0x426c48[_0x734e('0x24')]=qs['limit'](_0xba242c[_0x734e('0x36')]['limit']);_0x426c48[_0x734e('0x22')]=qs[_0x734e('0x22')](_0xba242c[_0x734e('0x36')][_0x734e('0x22')]);}_0x426c48['order']=qs[_0x734e('0x3f')](_0xba242c[_0x734e('0x36')][_0x734e('0x3f')]);_0x426c48[_0x734e('0x41')]=qs[_0x734e('0x37')](_[_0x734e('0x40')](_0xba242c['query'],_0x3648bd[_0x734e('0x37')]));_0x426c48[_0x734e('0x41')][_0x734e('0x5a')]=_0x578fe7['id'];if(_0xba242c['query'][_0x734e('0x43')]){_0x426c48[_0x734e('0x41')]=_[_0x734e('0x4d')](_0x426c48[_0x734e('0x41')],{'$or':_[_0x734e('0x30')](_0x426c48[_0x734e('0x38')],function(_0x5d67ee){var _0x31ae1d={};_0x31ae1d[_0x5d67ee]={'$like':'%'+_0xba242c[_0x734e('0x36')][_0x734e('0x43')]+'%'};return _0x31ae1d;})});}_0x426c48=_[_0x734e('0x4d')]({},_0x426c48,_0xba242c[_0x734e('0x44')]);return db['CannedAnswer'][_0x734e('0x25')]({'where':_0x426c48['where']})[_0x734e('0x17')](function(_0x1b57b6){_0x7ddbef[_0x734e('0x25')]=_0x1b57b6;if(_0xba242c[_0x734e('0x36')][_0x734e('0x5d')]){_0x426c48[_0x734e('0x45')]=[{'all':!![]}];}return db[_0x734e('0x60')][_0x734e('0x46')](_0x426c48);})[_0x734e('0x17')](function(_0x281158){_0x7ddbef[_0x734e('0x47')]=_0x281158;return _0x7ddbef;});}})[_0x734e('0x17')](respondWithFilteredResult(_0x1b3da4,_0x426c48))[_0x734e('0x48')](handleError(_0x1b3da4,null));};exports[_0x734e('0x63')]=function(_0x255795,_0x193a57){return db[_0x734e('0x31')]['find']({'where':{'id':_0x255795[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x193a57,null))[_0x734e('0x17')](function(_0x39dee4){if(_0x39dee4){return _0x39dee4['removeAnswers'](_0x255795[_0x734e('0x36')][_0x734e('0x5f')]);}})[_0x734e('0x17')](respondWithStatusCode(_0x193a57,null))['catch'](handleError(_0x193a57,null));};exports[_0x734e('0x64')]=function(_0x2ed9a5,_0x2b195d){_0x2ed9a5[_0x734e('0x50')]['sitepic']=_0x2ed9a5[_0x734e('0x65')][_0x734e('0x66')];return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x2ed9a5[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x2b195d,null))[_0x734e('0x17')](saveUpdates(_0x2ed9a5[_0x734e('0x50')],null))['then'](respondWithResult(_0x2b195d,null))['catch'](handleError(_0x2b195d,null));};exports['addAvatar']=function(_0x2bcfe5,_0x315eb4){_0x2bcfe5['body'][_0x734e('0x67')]=_0x2bcfe5[_0x734e('0x65')][_0x734e('0x66')];return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x2bcfe5[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x315eb4,null))[_0x734e('0x17')](saveUpdates(_0x2bcfe5[_0x734e('0x50')],null))[_0x734e('0x17')](respondWithResult(_0x315eb4,null))[_0x734e('0x48')](handleError(_0x315eb4,null));};exports[_0x734e('0x68')]=function(_0x47480a,_0x288d8b){_0x47480a[_0x734e('0x50')][_0x734e('0x69')]=_0x47480a['file'][_0x734e('0x66')];return db[_0x734e('0x31')]['find']({'where':{'id':_0x47480a['params']['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x288d8b,null))[_0x734e('0x17')](saveUpdates(_0x47480a[_0x734e('0x50')],null))[_0x734e('0x17')](respondWithResult(_0x288d8b,null))['catch'](handleError(_0x288d8b,null));};exports[_0x734e('0x6a')]=function(_0x52c95f,_0x3d30a0){_0x52c95f['body'][_0x734e('0x6b')]=_0x52c95f[_0x734e('0x65')][_0x734e('0x66')];return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x52c95f[_0x734e('0x57')]['id']}})['then'](handleEntityNotFound(_0x3d30a0,null))[_0x734e('0x17')](saveUpdates(_0x52c95f['body'],null))[_0x734e('0x17')](respondWithResult(_0x3d30a0,null))[_0x734e('0x48')](handleError(_0x3d30a0,null));};exports[_0x734e('0x6c')]=function(_0x511aeb,_0x9ac8b){var _0x29c7b3=path['join'](config[_0x734e('0x6d')],_0x734e('0x6e'));var _0x3b0218={'where':{'id':_0x511aeb['params']['id']},'attributes':['id',_0x734e('0x6f')],'raw':!![]};var _0xab1068=![];return require(_0x734e('0x70'))[_0x734e('0x71')]()[_0x734e('0x17')](function(_0x4f3b81){if(_0x4f3b81){_0xab1068=_0x4f3b81['custom'];}})[_0x734e('0x17')](function(){return db[_0x734e('0x31')][_0x734e('0x4e')](_0x3b0218);})[_0x734e('0x17')](handleEntityNotFound(_0x9ac8b,null))['then'](function(_0x39700f){if(_0x39700f){if(!_[_0x734e('0x72')](_0x39700f['sitepic'])){if(fs['existsSync'](path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0x74'),_0x39700f['sitepic']))&&_0xab1068){_0x29c7b3=path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0x74'),_0x39700f[_0x734e('0x6f')]);}}return _0x9ac8b[_0x734e('0x75')](_0x29c7b3);}})[_0x734e('0x48')](handleError(_0x9ac8b,null));};exports[_0x734e('0x76')]=function(_0x450e6c,_0x280730){var _0x467886=path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0x77'));var _0x46cdf8={'where':{'id':_0x450e6c['params']['id']},'attributes':['id',_0x734e('0x67')],'raw':!![]};return db[_0x734e('0x31')][_0x734e('0x4e')](_0x46cdf8)[_0x734e('0x17')](handleEntityNotFound(_0x280730,null))[_0x734e('0x17')](function(_0x4abe67){if(_0x4abe67){if(!_['isNil'](_0x4abe67['agentAvatar'])){if(fs['existsSync'](path[_0x734e('0x73')](config['root'],'server/files/images/avatars/',_0x4abe67[_0x734e('0x67')]))){_0x467886=path[_0x734e('0x73')](config[_0x734e('0x6d')],'server/files/images/avatars/',_0x4abe67['agentAvatar']);}}return _0x280730[_0x734e('0x75')](_0x467886);}})[_0x734e('0x48')](handleError(_0x280730,null));};exports[_0x734e('0x78')]=function(_0xe4a703,_0x4e1b35){var _0x4803d4=path[_0x734e('0x73')](config['root'],_0x734e('0x79'));var _0x4b8f88={'where':{'id':_0xe4a703['params']['id']},'attributes':['id',_0x734e('0x69'),_0x734e('0x7a')],'raw':!![]};return db[_0x734e('0x31')][_0x734e('0x4e')](_0x4b8f88)['then'](handleEntityNotFound(_0x4e1b35,null))[_0x734e('0x17')](function(_0x53a097){if(_0x53a097){if(!_[_0x734e('0x72')](_0x53a097[_0x734e('0x69')])){if(fs['existsSync'](path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0x7b'),_0x53a097[_0x734e('0x69')]))&&_0x53a097['showCustomerAvatar']){_0x4803d4=path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0x7b'),_0x53a097['customerAvatar']);}}return _0x4e1b35[_0x734e('0x75')](_0x4803d4);}})[_0x734e('0x48')](handleError(_0x4e1b35,null));};exports[_0x734e('0x7c')]=function(_0x583ab9,_0x1736f0){var _0xab2291=path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0x7d'));var _0x4c48e3={'where':{'id':_0x583ab9[_0x734e('0x57')]['id']},'attributes':['id',_0x734e('0x6b')],'raw':!![]};return db[_0x734e('0x31')]['find'](_0x4c48e3)[_0x734e('0x17')](handleEntityNotFound(_0x1736f0,null))[_0x734e('0x17')](function(_0x250452){if(_0x250452){if(!_[_0x734e('0x72')](_0x250452[_0x734e('0x6b')])){if(fs[_0x734e('0x7e')](path['join'](config[_0x734e('0x6d')],'server/files/images/avatars/',_0x250452[_0x734e('0x6b')]))){_0xab2291=path[_0x734e('0x73')](config['root'],_0x734e('0x7b'),_0x250452[_0x734e('0x6b')]);}}return _0x1736f0[_0x734e('0x75')](_0xab2291);}})[_0x734e('0x48')](handleError(_0x1736f0,null));};exports['notify']=function(_0x581fbe,_0x2d8b04){var _0x278697=require(_0x734e('0x7f'));var _0x3e4e1f=new _0x278697();var _0x101369=_0x3e4e1f[_0x734e('0x80')](_0x581fbe[_0x734e('0x81')][_0x734e('0x82')])[_0x734e('0x83')]();var _0x20e3b1={'body':_0x581fbe[_0x734e('0x50')],'channel':_0x734e('0x84')};var _0x5fc8e1=[];var _0x50df9e=[];var _0x443261={};var _0x4a520e=![];return db[_0x734e('0x85')][_0x734e('0x58')]()['then'](function(_0x3e0085){if(!_0x3e0085){throw new db['Sequelize'][(_0x734e('0x86'))]('no\x20available\x20attributes');}_0x5fc8e1=_[_0x734e('0x87')](_[_0x734e('0x4c')](_0x3e0085),[_0x734e('0x88'),_0x734e('0x89')]);_0x50df9e=_[_0x734e('0x87')](_[_0x734e('0x4c')](_0x3e0085),['createdAt',_0x734e('0x89'),_0x734e('0x8a'),'ListId']);if(_0x581fbe[_0x734e('0x50')]['id']){delete _0x581fbe['body']['id'];}if(_['isNil'](_0x581fbe['body']['from'])){throw new db['Sequelize']['ValidationError'](_0x734e('0x8b'));}if(_['isNil'](_0x581fbe[_0x734e('0x50')]['body'])||_0x581fbe[_0x734e('0x50')][_0x734e('0x50')]===''){throw new db[(_0x734e('0x8c'))][(_0x734e('0x86'))](_0x734e('0x8d'));}if(_[_0x734e('0x72')](_0x581fbe[_0x734e('0x50')][_0x734e('0x8e')])){throw new db['Sequelize'][(_0x734e('0x86'))](_0x734e('0x8f')+_0x50df9e);}if(!_[_0x734e('0x90')](_0x50df9e,_0x581fbe[_0x734e('0x50')][_0x734e('0x8e')])){throw new db['Sequelize'][(_0x734e('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x50df9e);}_0x443261[_0x581fbe[_0x734e('0x50')]['mapKey']]=_0x581fbe[_0x734e('0x50')][_0x734e('0x91')];})[_0x734e('0x17')](function(){return db[_0x734e('0x31')]['find']({'where':{'id':_0x581fbe[_0x734e('0x57')]['id']},'include':[{'model':db[_0x734e('0x92')],'as':_0x734e('0x93'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x443261,'limit':0x1,'order':[[_0x734e('0x89'),_0x734e('0x94')]]}]},{'model':db[_0x734e('0x95')],'as':_0x734e('0x96')}]});})['then'](handleEntityNotFound(_0x2d8b04,null))[_0x734e('0x17')](function(_0x59a3d1){if(_0x59a3d1&&_0x59a3d1[_0x734e('0x93')]){_0x20e3b1[_0x734e('0x97')]=_0x59a3d1;_0x20e3b1[_0x734e('0x98')]=_0x59a3d1['Applications'];_0x20e3b1[_0x734e('0x99')]=_0x59a3d1['List'];_0x20e3b1[_0x734e('0x98')]=_['orderBy'](_0x20e3b1[_0x734e('0x98')],['priority'],['asc']);if(_0x20e3b1[_0x734e('0x97')][_0x734e('0x96')]){delete _0x20e3b1[_0x734e('0x97')]['Applications'];}if(_0x20e3b1[_0x734e('0x97')][_0x734e('0x93')]&&_0x20e3b1['account'][_0x734e('0x93')][_0x734e('0x9a')][_0x734e('0x3b')]){return _0x20e3b1[_0x734e('0x97')][_0x734e('0x93')][_0x734e('0x9a')][0x0];}var _0x3f00ed=_[_0x734e('0xe')](_0x581fbe[_0x734e('0x50')],{'firstName':_0x581fbe[_0x734e('0x50')][_0x734e('0x91')],'ListId':_0x59a3d1['ListId']});_0x3f00ed[_0x581fbe[_0x734e('0x50')][_0x734e('0x8e')]]=_0x581fbe['body'][_0x734e('0x91')];return db[_0x734e('0x85')][_0x734e('0x4f')](_0x3f00ed,{'fields':_0x5fc8e1,'raw':!![]});}})[_0x734e('0x17')](handleEntityNotFound(_0x2d8b04,null))[_0x734e('0x17')](function(_0x594f92){_0x20e3b1[_0x734e('0x9b')]=_0x594f92;var _0x44a7d7=_0x581fbe[_0x734e('0x50')][_0x734e('0x9c')];if(_0x581fbe['headers'][_0x734e('0x9d')]){_0x44a7d7=_0x581fbe['headers'][_0x734e('0x9d')];}else if(_0x581fbe['headers']['x-forwarded-for']){_0x44a7d7=_[_0x734e('0x9e')](_0x581fbe[_0x734e('0x81')][_0x734e('0x9f')][_0x734e('0xa0')](','));}if(_0x594f92){var _0x1a0131={'ContactId':_0x594f92['id'],'ChatWebsiteId':_0x581fbe['params']['id'],'from':(_0x594f92['firstName']||'')+'\x20'+(_0x594f92['lastName']||''),'customerIp':_0x44a7d7,'customerPort':_0x581fbe[_0x734e('0x81')][_0x734e('0xa1')]?_0x581fbe[_0x734e('0x81')][_0x734e('0xa1')]:null,'referer':_0x581fbe['body'][_0x734e('0xa2')],'browserName':_0x101369['browser'][_0x734e('0x2d')]&&_0x101369[_0x734e('0xa3')]['version']?util[_0x734e('0xa4')](_0x734e('0xa5'),_0x101369[_0x734e('0xa3')][_0x734e('0x2d')],_0x101369[_0x734e('0xa3')][_0x734e('0xa6')]):'unknown','browserVersion':_0x101369[_0x734e('0xa3')][_0x734e('0xa6')]||_0x734e('0xa7'),'osName':util['format'](_0x734e('0xa5'),_0x101369['os'][_0x734e('0x2d')],_0x101369['os'][_0x734e('0xa6')]),'osVersion':_0x101369['os'][_0x734e('0xa6')],'deviceModel':_0x101369[_0x734e('0xa8')][_0x734e('0x35')]&&_0x101369[_0x734e('0xa8')]['vendor']?util[_0x734e('0xa4')](_0x734e('0xa9'),_0x101369['device'][_0x734e('0x35')],_0x101369[_0x734e('0xa8')]['vendor'],_0x101369[_0x734e('0xa8')][_0x734e('0x33')]):null,'deviceVendor':_0x101369[_0x734e('0xa8')][_0x734e('0xaa')],'deviceType':_0x101369[_0x734e('0xa8')][_0x734e('0x33')],'formData':JSON[_0x734e('0xab')](_0x581fbe[_0x734e('0x50')])};var _0x3a40c6={'ChatWebsiteId':_0x581fbe[_0x734e('0x57')]['id'],'closed':![]};if(_0x581fbe['body'][_0x734e('0xac')]){_0x3a40c6[_0x734e('0xac')]=_0x581fbe[_0x734e('0x50')][_0x734e('0xac')];return db[_0x734e('0xad')]['find']({'where':_0x3a40c6})[_0x734e('0x17')](function(_0x21926a){if(_0x21926a){return[_0x21926a,![]];}_0x1a0131['threadId']=_0x581fbe['body'][_0x734e('0xac')];_0x1a0131[_0x734e('0xae')]=_0x581fbe[_0x734e('0x50')]['externalUrl'];return db[_0x734e('0xad')][_0x734e('0x4f')](_0x1a0131)[_0x734e('0x17')](function(_0x4db769){return[_0x4db769,!![]];});});}_0x3a40c6[_0x734e('0xaf')]=_0x594f92['id'];if(_0x581fbe[_0x734e('0x50')]['interaction']&&_0x581fbe[_0x734e('0x50')][_0x734e('0xb0')]['id']){_0x3a40c6['id']=_0x581fbe['body']['interaction']['id'];return db['ChatInteraction'][_0x734e('0x4e')]({'where':_0x3a40c6})[_0x734e('0x17')](function(_0x528fe9){if(_0x528fe9){return[_0x528fe9,![]];}return db['ChatInteraction'][_0x734e('0x4f')](_0x1a0131)[_0x734e('0x17')](function(_0x23b418){return[_0x23b418,!![]];});});}return db[_0x734e('0xad')][_0x734e('0x4f')](_0x1a0131)['then'](function(_0x280c59){return[_0x280c59,!![]];});}})[_0x734e('0xb1')](function(_0x589353,_0x4540c1){if(_0x589353){_0x4a520e=_0x4540c1;if(!_0x4540c1){var _0x8d5976={'from':(_0x20e3b1[_0x734e('0x9b')][_0x734e('0xb2')]||'')+'\x20'+(_0x20e3b1[_0x734e('0x9b')][_0x734e('0xb3')]||'')};if(_0x581fbe['body']['threadId']&&_0x581fbe[_0x734e('0x50')]['messageId']&&_0x581fbe[_0x734e('0x50')][_0x734e('0xac')]!=_0x581fbe[_0x734e('0x50')][_0x734e('0xb4')]){_0x8d5976[_0x734e('0xac')]=_0x581fbe['body'][_0x734e('0xb4')];}return _0x589353['update'](_0x8d5976);}else{return _0x589353;}}})[_0x734e('0x17')](function(_0x1c4e05){_0x20e3b1['interaction']=_0x1c4e05[_0x734e('0x28')]({'plain':!![]});_0x20e3b1[_0x734e('0xb0')][_0x734e('0xb5')]=_0x4a520e;if(_0x20e3b1['interaction'][_0x734e('0xb5')]){if(_0x20e3b1[_0x734e('0x97')][_0x734e('0xb6')]){_0x20e3b1[_0x734e('0x98')][_0x734e('0xb7')]({'id':0x0,'priority':_0x20e3b1['applications']['length']+0x1,'app':_0x734e('0xb8'),'appdata':_0x734e('0xb9'),'interval':'*,*,*,*'});}}return db[_0x734e('0xba')]['create']({'body':_0x581fbe[_0x734e('0x50')][_0x734e('0x50')],'ChatWebsiteId':_0x581fbe[_0x734e('0x57')]['id'],'ChatInteractionId':_0x1c4e05['id'],'direction':'in','ContactId':_0x20e3b1[_0x734e('0x9b')]['id'],'AttachmentId':_0x581fbe['body'][_0x734e('0xbb')]});})[_0x734e('0x17')](function(_0x221c02){_0x20e3b1['message']=_0x221c02;if(_0x20e3b1[_0x734e('0xb0')][_0x734e('0xbc')]){return db[_0x734e('0xbd')]['find']({'attributes':['id','name'],'where':{'id':_0x20e3b1[_0x734e('0xb0')]['UserId']}})[_0x734e('0x17')](function(_0x582ffc){if(_0x582ffc){_0x20e3b1[_0x734e('0x98')]['unshift']({'id':0x0,'priority':0x0,'app':_0x734e('0xbe'),'appdata':_0x582ffc[_0x734e('0x2d')]+','+(_0x20e3b1['account'][_0x734e('0xbf')]||0xa),'interval':_0x734e('0xc0')});_0x20e3b1[_0x734e('0xc1')]=!![];}return respondWithRpcPromise(_0x734e('0xc2'),_0x734e('0xc3'),_0x20e3b1);});}return respondWithRpcPromise('Start',_0x734e('0xc3'),_0x20e3b1);})['then'](function(_0x56572e){respondWithRpcPromise(_0x734e('0xc4'),_0x734e('0xc4'),{'event':_0x734e('0xc5'),'message':_0x56572e},client9002);return _0x56572e;})[_0x734e('0x17')](respondWithResult(_0x2d8b04,null))[_0x734e('0x48')](handleError(_0x2d8b04,null));};exports[_0x734e('0xc6')]=function(_0x24d6c5,_0x566cbf){var _0x56e3fd,_0x425391,_0x4b1fcd;var _0x566b24=[];var _0x9c50f1={};var _0x36035c=_0x24d6c5['files']||[];var _0x144ec0=[];var _0x45b1ed;return db[_0x734e('0x85')]['describe']()[_0x734e('0x17')](function(_0x478487){if(!_0x478487){throw new db['Sequelize'][(_0x734e('0x86'))](_0x734e('0xc7'));}_0x566b24=_['difference'](_[_0x734e('0x4c')](_0x478487),[_0x734e('0x88'),_0x734e('0x89'),_0x734e('0x8a'),_0x734e('0xc8')]);if(_0x24d6c5[_0x734e('0x50')]['id']){delete _0x24d6c5['body']['id'];}if(_[_0x734e('0x72')](_0x24d6c5[_0x734e('0x50')][_0x734e('0x91')])){throw _0x566cbf[_0x734e('0x1f')](0x1f4)[_0x734e('0x2e')](new db['Sequelize'][(_0x734e('0x86'))](_0x734e('0x8b')));}if(_['isNil'](_0x24d6c5[_0x734e('0x50')][_0x734e('0x50')])||_0x24d6c5[_0x734e('0x50')][_0x734e('0x50')]===''){throw _0x566cbf['status'](0x1f4)[_0x734e('0x2e')](new db[(_0x734e('0x8c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x734e('0x72')](_0x24d6c5['body'][_0x734e('0xc9')])){throw _0x566cbf['status'](0x1f4)[_0x734e('0x2e')](new db[(_0x734e('0x8c'))]['ValidationError'](_0x734e('0xca')+_0x566b24));}if(!_[_0x734e('0x90')](_0x566b24,_0x24d6c5[_0x734e('0x50')][_0x734e('0xc9')])){throw _0x566cbf[_0x734e('0x1f')](0x1f4)[_0x734e('0x2e')](new db[(_0x734e('0x8c'))][(_0x734e('0x86'))](_0x734e('0xcb')+_0x566b24));}_0x9c50f1[_0x24d6c5[_0x734e('0x50')]['mapKeyOffline']]=_0x24d6c5['body'][_0x734e('0x91')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x24d6c5[_0x734e('0x57')]['id']},'include':[{'model':db[_0x734e('0x92')],'as':'List'},{'model':db['MailAccount'],'as':_0x734e('0xcc')}]});})[_0x734e('0x17')](handleEntityNotFound(_0x566cbf,null))['then'](function(_0x2cf771){if(_0x2cf771&&_0x2cf771[_0x734e('0x93')]){_0x425391=_0x2cf771;var _0x3a236d=_[_0x734e('0xe')](_0x24d6c5[_0x734e('0x50')],{'firstName':_0x24d6c5['body'][_0x734e('0x91')],'phone':_0x24d6c5[_0x734e('0x50')]['from'],'ListId':_0x2cf771[_0x734e('0xc8')]});_0x3a236d[_0x24d6c5[_0x734e('0x50')][_0x734e('0xc9')]]=_0x24d6c5['body']['from'];return db[_0x734e('0x85')]['findOrCreate']({'where':_0x9c50f1,'defaults':_0x3a236d});}})[_0x734e('0xb1')](function(_0x16b488){if(_0x16b488){_0x4b1fcd=_0x16b488;var _0x4475a0=fs[_0x734e('0xcd')](path['join'](config[_0x734e('0x6d')],_0x734e('0xce')),'utf8');var _0x1271e3=ejs[_0x734e('0xcf')](_0x4475a0,{'body':_[_0x734e('0xd0')](_0x24d6c5[_0x734e('0x50')]['body']),'bodyTitle':_0x425391[_0x734e('0xd1')]});return db[_0x734e('0xd2')][_0x734e('0x4f')]({'body':_0x1271e3,'plainBody':htmlToText[_0x734e('0xd3')](_0x1271e3),'ContactId':_0x16b488['id'],'ChatWebsiteId':_0x425391['id']});}})[_0x734e('0x17')](function(_0x183639){_0x45b1ed=_0x183639;if(_0x36035c['length']){var _0x541fc6=_0x36035c[_0x734e('0x30')](function(_0x1bf1a2){return{'name':_0x1bf1a2[_0x734e('0xd4')],'basename':_0x1bf1a2[_0x734e('0x66')],'type':_0x1bf1a2[_0x734e('0xd5')],'ChatOfflineMessageId':_0x183639['id']};});_0x144ec0=_0x541fc6[_0x734e('0x30')](_0xdf5ef9=>{var _0x189327={'filename':_0xdf5ef9[_0x734e('0x2d')],'path':path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0xd6'),_0x734e('0xd7'),_0x734e('0xd8'),_0x734e('0xd9'),_0xdf5ef9[_0x734e('0xda')])};return _0x189327;});if(!_0x425391['openNewInteraction']){return db['sequelize']['transaction'](function(_0x16a06a){return db[_0x734e('0xdb')][_0x734e('0xdc')](_0x541fc6,{'transaction':_0x16a06a});});}}})['then'](function(){if(_0x45b1ed){_0x56e3fd=_0x45b1ed;return db[_0x734e('0xcc')][_0x734e('0x62')]({'where':{'active':!![]},'include':[{'model':db[_0x734e('0xdd')],'as':_0x734e('0xde'),'raw':!![]}]});}})[_0x734e('0x17')](function(_0x595d68){if(_0x595d68&&_0x595d68['Smtp']&&_0x425391['forwardOffline']&&_0x425391[_0x734e('0xdf')]){var _0x22ef85={'tls':{'rejectUnauthorized':![]}};if(_0x595d68['Smtp'][_0x734e('0xe0')]){_0x22ef85['service']=_0x595d68[_0x734e('0xde')][_0x734e('0xe0')];}else{_0x22ef85[_0x734e('0xe1')]=_0x595d68['Smtp'][_0x734e('0xe1')];_0x22ef85[_0x734e('0xe2')]=_0x595d68[_0x734e('0xde')]['port'];_0x22ef85['secure']=_0x595d68[_0x734e('0xde')][_0x734e('0xe3')];}if(_0x595d68[_0x734e('0xde')]['authentication']){_0x22ef85[_0x734e('0xe4')]={'user':_0x595d68[_0x734e('0xde')][_0x734e('0x53')],'pass':_0x595d68[_0x734e('0xde')][_0x734e('0xe5')]};}return respondWithRpcPromise(_0x734e('0xe6'),'sendMail',{'account':_0x22ef85,'message':{'from':util[_0x734e('0xa4')](_0x734e('0xe7'),_0x595d68['name'],_0x595d68[_0x734e('0xe8')]||_0x595d68['Smtp'][_0x734e('0x53')]),'to':_0x425391[_0x734e('0xdf')],'subject':_0x425391[_0x734e('0xe9')],'html':_0x56e3fd['body'],'attachments':_0x144ec0}},client9003)[_0x734e('0x17')](function(){return _0x56e3fd;})[_0x734e('0x48')](function(_0xc66229){console[_0x734e('0x1b')](_0xc66229);});}})[_0x734e('0x17')](function(){if(_0x425391&&_0x425391[_0x734e('0xea')]&&_0x425391[_0x734e('0xeb')]){var _0x4b6e14=[];if(_0x36035c[_0x734e('0x3b')]){_0x4b6e14=_0x36035c[_0x734e('0x30')](function(_0x2163e1){return{'name':_0x2163e1[_0x734e('0xd4')],'basename':_0x2163e1[_0x734e('0x66')],'type':_0x2163e1[_0x734e('0xd5')],'ChatOfflineMessageId':_0x45b1ed['id']};});}var _0x472cbe;if(!_['isNil'](_0x425391[_0x734e('0xec')])){var _0x5108f0=_['map'](_0x24d6c5[_0x734e('0x50')],function(_0x34c9c1){return _0x34c9c1;});var _0x4e388e=_[_0x734e('0xed')](_0x5108f0)[0x0];var _0x55edda=_[_0x734e('0xee')](_0x4e388e,function(_0x49f8dd){return _0x49f8dd;});_0x472cbe=_0x55edda[0x1][_0x425391[_0x734e('0xec')]];}var _0x144fd9={'from':_0x4b1fcd[_0x734e('0xe8')],'firstName':_0x4b1fcd[_0x734e('0xb2')],'lastName':_0x4b1fcd[_0x734e('0xb3')],'mapKey':_0x734e('0xe8'),'message':{'from':_0x4b1fcd[_0x734e('0xe8')],'to':_0x425391['MailAccount'][_0x734e('0xe8')],'cc':'','subject':_[_0x734e('0x72')](_0x472cbe)?_0x425391['offlineMessageSubject']:_0x472cbe,'messageId':'','sentAt':new Date(),'attach':_0x4b6e14['length'],'attachments':_0x4b6e14,'originChannel':'Chat','ChatWebsiteId':_0x425391['id'],'ChatOfflineMessageId':_0x56e3fd['id'],'originTo':_0x425391[_0x734e('0xcc')][_0x734e('0xe8')]},'body':_0x56e3fd['body']};var _0x5c5cf9={'account':{'id':_0x425391[_0x734e('0xeb')]},'body':_0x144fd9,'log':_0x734e('0xef')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x5c5cf9,client9001)[_0x734e('0x17')](function(){return _0x56e3fd;})[_0x734e('0x48')](function(_0x58fe13){console[_0x734e('0x1b')](_0x58fe13);});}return;})[_0x734e('0x17')](function(){if(_0x56e3fd){return _0x56e3fd;}})[_0x734e('0x17')](respondWithResult(_0x566cbf,null))[_0x734e('0x48')](function(_0x1a0717){console['error'](_0x734e('0x48'),_0x1a0717);for(var _0x3db15f of _0x36035c){var _0x133312=path[_0x734e('0x73')](config[_0x734e('0x6d')],_0x734e('0xd6'),'files',_0x734e('0xd8'),_0x734e('0xd9'),_0x3db15f[_0x734e('0x66')]);fs_extra[_0x734e('0xf0')](_0x133312)[_0x734e('0x48')](function(_0x46b609){console['error'](_0x734e('0xf1'),_0x133312,_0x46b609);});}});};exports[_0x734e('0xf2')]=function(_0x2350c2,_0x36cfa8){return db['ChatInteraction']['find']({'where':{'id':_0x2350c2[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x36cfa8,null))[_0x734e('0x17')](function(_0x10e1a3){if(_0x10e1a3){return _0x10e1a3[_0x734e('0xf2')](_0x2350c2[_0x734e('0x50')][_0x734e('0x5f')],_[_0x734e('0xf3')](_0x2350c2[_0x734e('0x50')],['ids','id'])||{});}})[_0x734e('0x17')](respondWithResult(_0x36cfa8,null))[_0x734e('0x48')](handleError(_0x36cfa8,null));};exports['getInteractions']=function(_0x175a40,_0x1e3b15){var _0x1548e4={'raw':![],'where':{}};var _0x52859a={};var _0x4fa1b7={'count':0x0,'rows':[]};return db[_0x734e('0x31')][_0x734e('0x62')]({'where':{'id':_0x175a40[_0x734e('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e3b15,null))['then'](function(_0x108323){if(_0x108323){_0x52859a[_0x734e('0x35')]=_[_0x734e('0x4c')](db['ChatInteraction'][_0x734e('0x32')]);_0x52859a[_0x734e('0x36')]=_['keys'](_0x175a40[_0x734e('0x36')]);_0x52859a[_0x734e('0x37')]=_[_0x734e('0x39')](_0x52859a['model'],_0x52859a[_0x734e('0x36')]);_0x1548e4[_0x734e('0x38')]=_[_0x734e('0x39')](_0x52859a[_0x734e('0x35')],qs[_0x734e('0x3a')](_0x175a40[_0x734e('0x36')][_0x734e('0x3a')]));_0x1548e4[_0x734e('0x38')]=_0x1548e4[_0x734e('0x38')][_0x734e('0x3b')]?_0x1548e4[_0x734e('0x38')]:_0x52859a[_0x734e('0x35')];if(!_0x175a40[_0x734e('0x36')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x1548e4[_0x734e('0x24')]=qs['limit'](_0x175a40[_0x734e('0x36')]['limit']);_0x1548e4[_0x734e('0x22')]=qs[_0x734e('0x22')](_0x175a40[_0x734e('0x36')][_0x734e('0x22')]);}_0x1548e4[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x175a40[_0x734e('0x36')]['sort']);_0x1548e4[_0x734e('0x41')]=qs[_0x734e('0x37')](_[_0x734e('0x40')](_0x175a40[_0x734e('0x36')],_0x52859a[_0x734e('0x37')]));_0x1548e4['where'][_0x734e('0x5a')]=_0x108323['id'];if(_0x175a40[_0x734e('0x36')]['filter']){_0x1548e4[_0x734e('0x41')]=_[_0x734e('0x4d')](_0x1548e4[_0x734e('0x41')],{'$or':_[_0x734e('0x30')](_0x1548e4['attributes'],function(_0x5b96cb){var _0x13c772={};_0x13c772[_0x5b96cb]={'$like':'%'+_0x175a40[_0x734e('0x36')]['filter']+'%'};return _0x13c772;})});}_0x1548e4=_['merge']({},_0x1548e4,_0x175a40[_0x734e('0x44')]);return db[_0x734e('0xad')][_0x734e('0x25')]({'where':_0x1548e4['where']})[_0x734e('0x17')](function(_0x4413d1){_0x4fa1b7[_0x734e('0x25')]=_0x4413d1;if(_0x175a40[_0x734e('0x36')]['includeAll']){_0x1548e4[_0x734e('0x45')]=[{'model':db['CmContact'],'as':_0x734e('0xf4'),'required':![]},{'model':db[_0x734e('0xbd')],'as':'Owner','attributes':[_0x734e('0x2d'),_0x734e('0xf5'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x734e('0xf6'),'attributes':['id',_0x734e('0x2d'),_0x734e('0xf7')],'where':_0x175a40[_0x734e('0x36')][_0x734e('0xf8')]?{'id':_0x175a40[_0x734e('0x36')][_0x734e('0xf8')]}:undefined,'required':_0x175a40[_0x734e('0x36')]['tag']?!![]:![]}];}return db[_0x734e('0xad')][_0x734e('0x46')](_0x1548e4);})[_0x734e('0x17')](function(_0x7c30e9){_0x4fa1b7['rows']=_0x7c30e9;return _0x4fa1b7;});}})['then'](respondWithFilteredResult(_0x1e3b15,_0x1548e4))[_0x734e('0x48')](handleError(_0x1e3b15,null));};function iftimePromise(_0x245f34,_0x398f49){return respondWithRpcPromise(_0x734e('0xf9'),_0x734e('0xfa'),{'command':_0x398f49['timezone']?util[_0x734e('0xa4')](_0x734e('0xfb'),_0x245f34[_0x734e('0xfc')],_0x398f49[_0x734e('0xfd')]):util[_0x734e('0xa4')](_0x734e('0xfe'),_0x245f34[_0x734e('0xfc')])},client9002)[_0x734e('0x17')](function(_0x553571){var _0x590c01=_0x553571&&_0x553571[_0x734e('0xff')](_0x734e('0x100'))>=0x0?!![]:![];logger[_0x734e('0x1d')](_0x734e('0x101'),_0x398f49['id'],_0x245f34['id'],_0x245f34[_0x734e('0xfc')],_0x590c01?_0x734e('0x102'):_0x734e('0x103'),_0x398f49[_0x734e('0xfd')]?_0x398f49[_0x734e('0xfd')]:_0x734e('0x104'));return _0x590c01;})['catch'](function(_0x2f742d){logger[_0x734e('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x398f49['id'],_0x245f34['id'],_0x245f34[_0x734e('0xfc')],util[_0x734e('0x105')](_0x2f742d,{'showHidden':![],'depth':null}),_0x398f49[_0x734e('0xfd')]?_0x398f49[_0x734e('0xfd')]:_0x734e('0x104'));return![];});}exports[_0x734e('0xfa')]=function(_0x321ad8,_0x4d66e3){var _0x2ec8da=0x0;var _0x45a432=0x0;var _0x5bf711=![];var _0x3b5f71;var _0x2b8a46;return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x321ad8[_0x734e('0x57')]['id']},'include':[{'model':db[_0x734e('0x106')],'as':_0x734e('0x106'),'include':[{'model':db[_0x734e('0x106')],'as':_0x734e('0x107'),'attributes':['id',_0x734e('0xfc')],'raw':!![]}]}]})[_0x734e('0x17')](handleEntityNotFound(_0x4d66e3,null))[_0x734e('0x17')](function(_0x243e80){if(_0x243e80){_0x3b5f71=_0x243e80;return _0x243e80['getProactiveActions']({'raw':!![]});}})[_0x734e('0x17')](function(_0x19019f){if(_0x3b5f71){if(_0x19019f){_0x2b8a46=_0x19019f;}}return require(_0x734e('0x70'))[_0x734e('0x71')]();})[_0x734e('0x17')](function(_0x41a586){if(_0x41a586){_0x45a432=_0x41a586[_0x734e('0x108')];_0x5bf711=_0x41a586[_0x734e('0x109')];}})['then'](function(){return db[_0x734e('0xad')][_0x734e('0x25')]({'where':{'closed':![]}});})[_0x734e('0x17')](function(_0x1dec75){_0x2ec8da=_0x1dec75;if(_0x45a432&&_0x1dec75>_0x45a432){return db['License'][_0x734e('0x62')]({'where':{'id':0x1}})[_0x734e('0x17')](function(_0x248098){if(_0x248098){_0x248098['increment']('chatLicenseExceeded');}});}})[_0x734e('0x17')](function(){if(_0x3b5f71[_0x734e('0x106')]&&_0x3b5f71[_0x734e('0x106')][_0x734e('0x107')]){var _0x24d2d4=[];for(var _0x47363b=0x0;_0x47363b<_0x3b5f71[_0x734e('0x106')]['Intervals'][_0x734e('0x3b')];_0x47363b++){var _0xc08e38=_0x3b5f71[_0x734e('0x106')][_0x734e('0x107')][_0x47363b][_0x734e('0x28')]({'plain':!![]});_0x24d2d4[_0x734e('0xb7')](iftimePromise(_0xc08e38,_0x3b5f71));}return BPromise[_0x734e('0x10a')](_0x24d2d4)['then'](function(_0x5b78c7){return _[_0x734e('0x10b')](_0x5b78c7);});}else{return!![];}})[_0x734e('0x17')](function(_0x36029d){var _0x1a103a=fs[_0x734e('0xcd')](path['join'](config[_0x734e('0x6d')],'server/files/chat/iframe.ejs'),_0x734e('0x10c'));var _0x410466={'remote':_0x3b5f71[_0x734e('0x10d')],'query':querystring[_0x734e('0xab')](_[_0x734e('0x4d')](_0x3b5f71[_0x734e('0x28')]({'plain':!![]}),{'customerIp':_0x321ad8['headers'][_0x734e('0x9f')]||_0x321ad8[_0x734e('0x81')][_0x734e('0x10e')]||_0x321ad8['connection'][_0x734e('0x10f')]||_0x321ad8['ip'],'referer':_0x321ad8['headers'][_0x734e('0xa2')],'openedInteractions':_0x2ec8da,'maxInteractions':_0x45a432,'virtual':_0x5bf711[_0x734e('0x108')],'online':_0x36029d,'custom':_0x5bf711}))[_0x734e('0x110')](/'/g,'\x5c\x27')};_0x4d66e3[_0x734e('0x2e')](ejs[_0x734e('0xcf')](Mustache[_0x734e('0xcf')](_0x1a103a,_0x410466),{'proactiveActions':_0x2b8a46,'alignment':_0x3b5f71[_0x734e('0x111')],'verticalAlignment':_0x3b5f71['verticalAlignment'],'div_color':_0x3b5f71[_0x734e('0xf7')],'labelText':_0x3b5f71['labelText'],'text_color':_0x3b5f71[_0x734e('0x112')],'button_color':_0x3b5f71[_0x734e('0x113')],'background_color':_0x3b5f71['backgroundColor'],'hideWhenOffline':_0x3b5f71[_0x734e('0x114')],'interval':_0x3b5f71[_0x734e('0x115')]}));})[_0x734e('0x48')](handleError(_0x4d66e3,null));};exports[_0x734e('0x116')]=function(_0x110506,_0x4552a1){var _0x37d427=_0x110506['params']['id'];var _0x1146f6=_0x110506[_0x734e('0x50')];var _0x52cfb9=0xc8;var _0x3b22ec=null;return db[_0x734e('0x117')][_0x734e('0x118')]({'isolationLevel':db['sequelize'][_0x734e('0x119')][_0x734e('0x11a')][_0x734e('0x11b')]},function(_0x8df212){return db['ChatWebsite'][_0x734e('0x62')]({'where':{'id':_0x37d427},'transaction':_0x8df212})['then'](function(_0x21c0f0){if(_0x21c0f0){return db[_0x734e('0x95')][_0x734e('0x2b')]({'where':{'ChatWebsiteId':_0x37d427},'transaction':_0x8df212})[_0x734e('0x17')](function(){var _0x58052d=_['map'](_0x1146f6,function(_0x6d2ec0){_0x6d2ec0[_0x734e('0x5a')]=_0x37d427;return _0x6d2ec0;});return db['ChatApplication']['bulkCreate'](_0x58052d,{'transaction':_0x8df212});});}else{_0x52cfb9=0x194;_0x3b22ec=[];}});})['then'](function(){if(_0x52cfb9!==0x194){return db[_0x734e('0x95')][_0x734e('0x11c')]({'where':{'ChatWebsiteId':_0x37d427},'order':'priority'})[_0x734e('0x17')](function(_0x326fd1){_0x3b22ec=_0x326fd1;});}})[_0x734e('0x48')](function(_0x34a9fb){_0x52cfb9=0x1f4;logger['error'](_0x34a9fb[_0x734e('0x2c')]);if(_0x34a9fb[_0x734e('0x2d')]){delete _0x34a9fb[_0x734e('0x2d')];}_0x3b22ec=_0x34a9fb;})[_0x734e('0x11d')](function(){if(_0x3b22ec===null){_0x4552a1[_0x734e('0x1e')](_0x52cfb9);}else{if(_0x52cfb9===0x1f4){_0x4552a1[_0x734e('0x1f')](_0x52cfb9)[_0x734e('0x2e')](_0x3b22ec);}else{_0x4552a1['status'](_0x52cfb9)[_0x734e('0x21')](_0x3b22ec);}}});};exports['getApplications']=function(_0x3b9e1e,_0x211223){var _0x4130e8={};var _0xcf85ab={};var _0x4dbca0;var _0x532fa9;return db[_0x734e('0x31')][_0x734e('0x62')]({'where':{'id':_0x3b9e1e[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x211223,null))['then'](function(_0x94d4c7){if(_0x94d4c7){_0x4dbca0=_0x94d4c7;_0xcf85ab[_0x734e('0x35')]=_[_0x734e('0x4c')](db[_0x734e('0x95')][_0x734e('0x32')]);_0xcf85ab[_0x734e('0x36')]=_[_0x734e('0x4c')](_0x3b9e1e[_0x734e('0x36')]);_0xcf85ab[_0x734e('0x37')]=_['intersection'](_0xcf85ab[_0x734e('0x35')],_0xcf85ab[_0x734e('0x36')]);_0x4130e8['attributes']=_['intersection'](_0xcf85ab['model'],qs[_0x734e('0x3a')](_0x3b9e1e[_0x734e('0x36')][_0x734e('0x3a')]));_0x4130e8[_0x734e('0x38')]=_0x4130e8['attributes'][_0x734e('0x3b')]?_0x4130e8['attributes']:_0xcf85ab['model'];_0x4130e8[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x3b9e1e['query'][_0x734e('0x3f')]);_0x4130e8['where']=qs[_0x734e('0x37')](_[_0x734e('0x40')](_0x3b9e1e['query'],_0xcf85ab[_0x734e('0x37')]));if(_0x3b9e1e[_0x734e('0x36')]['filter']){_0x4130e8[_0x734e('0x41')]=_[_0x734e('0x4d')](_0x4130e8[_0x734e('0x41')],{'$or':_[_0x734e('0x30')](_0x4130e8[_0x734e('0x38')],function(_0x1b13a4){var _0x587c59={};_0x587c59[_0x1b13a4]={'$like':'%'+_0x3b9e1e[_0x734e('0x36')]['filter']+'%'};return _0x587c59;})});}_0x4130e8=_[_0x734e('0x4d')]({},_0x4130e8,_0x3b9e1e['options']);return _0x4dbca0[_0x734e('0x11e')](_0x4130e8);}})[_0x734e('0x17')](function(_0x4e2abf){if(_0x4e2abf){_0x532fa9=_0x4e2abf[_0x734e('0x3b')];if(!_0x3b9e1e[_0x734e('0x36')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x4130e8['limit']=qs[_0x734e('0x24')](_0x3b9e1e['query']['limit']);_0x4130e8['offset']=qs[_0x734e('0x22')](_0x3b9e1e[_0x734e('0x36')][_0x734e('0x22')]);}return _0x4dbca0[_0x734e('0x11e')](_0x4130e8);}})['then'](function(_0x58aafb){if(_0x58aafb){return _0x58aafb?{'count':_0x532fa9,'rows':_0x58aafb}:null;}})['then'](respondWithResult(_0x211223,null))[_0x734e('0x48')](handleError(_0x211223,null));};exports['addProactiveActions']=function(_0x38add6,_0x4417a9){return db['chatProactiveAction'][_0x734e('0x4e')]({'where':{'id':_0x38add6[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x4417a9,null))[_0x734e('0x17')](function(_0x1da94a){if(_0x1da94a){return _0x1da94a[_0x734e('0x11f')](_0x38add6[_0x734e('0x50')][_0x734e('0x5f')],_[_0x734e('0xf3')](_0x38add6[_0x734e('0x50')],[_0x734e('0x5f'),'id'])||{});}})[_0x734e('0x17')](respondWithResult(_0x4417a9,null))[_0x734e('0x48')](handleError(_0x4417a9,null));};exports[_0x734e('0x120')]=function(_0x506dda,_0x343de3){var _0x314345={};var _0x3d3797={};var _0x39d83b;var _0xa6b5d6;return db[_0x734e('0x31')][_0x734e('0x62')]({'where':{'id':_0x506dda[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x343de3,null))[_0x734e('0x17')](function(_0x501c03){if(_0x501c03){_0x39d83b=_0x501c03;_0x3d3797[_0x734e('0x35')]=_[_0x734e('0x4c')](db[_0x734e('0x121')]['rawAttributes']);_0x3d3797['query']=_[_0x734e('0x4c')](_0x506dda[_0x734e('0x36')]);_0x3d3797[_0x734e('0x37')]=_['intersection'](_0x3d3797[_0x734e('0x35')],_0x3d3797[_0x734e('0x36')]);_0x314345['attributes']=_['intersection'](_0x3d3797['model'],qs[_0x734e('0x3a')](_0x506dda[_0x734e('0x36')][_0x734e('0x3a')]));_0x314345['attributes']=_0x314345[_0x734e('0x38')][_0x734e('0x3b')]?_0x314345[_0x734e('0x38')]:_0x3d3797[_0x734e('0x35')];_0x314345[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x506dda[_0x734e('0x36')][_0x734e('0x3f')]);_0x314345[_0x734e('0x41')]=qs[_0x734e('0x37')](_[_0x734e('0x40')](_0x506dda['query'],_0x3d3797['filters']));if(_0x506dda[_0x734e('0x36')][_0x734e('0x43')]){_0x314345['where']=_[_0x734e('0x4d')](_0x314345[_0x734e('0x41')],{'$or':_[_0x734e('0x30')](_0x314345[_0x734e('0x38')],function(_0x4479a1){var _0x4ba549={};_0x4ba549[_0x4479a1]={'$like':'%'+_0x506dda[_0x734e('0x36')][_0x734e('0x43')]+'%'};return _0x4ba549;})});}_0x314345=_[_0x734e('0x4d')]({},_0x314345,_0x506dda['options']);return _0x39d83b[_0x734e('0x120')](_0x314345);}})[_0x734e('0x17')](function(_0x3bc2cc){if(_0x3bc2cc){_0xa6b5d6=_0x3bc2cc[_0x734e('0x3b')];if(!_0x506dda[_0x734e('0x36')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x314345['limit']=qs[_0x734e('0x24')](_0x506dda[_0x734e('0x36')]['limit']);_0x314345[_0x734e('0x22')]=qs[_0x734e('0x22')](_0x506dda[_0x734e('0x36')][_0x734e('0x22')]);}return _0x39d83b[_0x734e('0x120')](_0x314345);}})[_0x734e('0x17')](function(_0x4c5c3a){if(_0x4c5c3a){return _0x4c5c3a?{'count':_0xa6b5d6,'rows':_0x4c5c3a}:null;}})['then'](respondWithResult(_0x343de3,null))[_0x734e('0x48')](handleError(_0x343de3,null));};exports['getFields']=function(_0x455f6c,_0x291d10){var _0x218f82=_0x455f6c[_0x734e('0x36')][_0x734e('0x122')]===_0x734e('0x123')?'offlineForm':_0x734e('0x124');return db[_0x734e('0x31')][_0x734e('0x4e')]({'attributes':['id',_0x218f82],'where':{'id':_0x455f6c['params']['id']}})['then'](handleEntityNotFound(_0x291d10,null))[_0x734e('0x17')](function(_0x286898){if(_0x286898){var _0x24af77=_0x286898[_0x218f82];var _0xfe75=_0x24af77&&_0x24af77['items']?_0x24af77[_0x734e('0x125')]:[];_0x291d10[_0x734e('0x2e')]({'fromKey':_[_0x734e('0x72')](_0x24af77[_0x734e('0x126')])?undefined:_0x24af77[_0x734e('0x126')],'count':_0xfe75['length'],'rows':_0xfe75});}})[_0x734e('0x48')](handleError(_0x291d10,null));};exports[_0x734e('0x127')]=function(_0x490f00,_0x13206a){var _0x410f29={'raw':![],'where':{}};var _0x7d1e7d={};var _0x3cb19d={'count':0x0,'rows':[]};return db[_0x734e('0x31')]['findOne']({'where':{'id':_0x490f00[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x13206a,null))[_0x734e('0x17')](function(_0x2c72cc){if(_0x2c72cc){_0x7d1e7d['model']=_[_0x734e('0x4c')](db['ChatOfflineMessage'][_0x734e('0x32')]);_0x7d1e7d[_0x734e('0x36')]=_['keys'](_0x490f00[_0x734e('0x36')]);_0x7d1e7d[_0x734e('0x37')]=_[_0x734e('0x39')](_0x7d1e7d[_0x734e('0x35')],_0x7d1e7d['query']);_0x410f29[_0x734e('0x38')]=_[_0x734e('0x39')](_0x7d1e7d[_0x734e('0x35')],qs[_0x734e('0x3a')](_0x490f00[_0x734e('0x36')][_0x734e('0x3a')]));_0x410f29['attributes']=_0x410f29[_0x734e('0x38')][_0x734e('0x3b')]?_0x410f29[_0x734e('0x38')]:_0x7d1e7d[_0x734e('0x35')];if(!_0x490f00['query'][_0x734e('0x3c')](_0x734e('0x3d'))){_0x410f29[_0x734e('0x24')]=qs['limit'](_0x490f00[_0x734e('0x36')][_0x734e('0x24')]);_0x410f29[_0x734e('0x22')]=qs['offset'](_0x490f00['query'][_0x734e('0x22')]);}_0x410f29[_0x734e('0x3e')]=qs[_0x734e('0x3f')](_0x490f00[_0x734e('0x36')][_0x734e('0x3f')]);_0x410f29['where']=qs['filters'](_[_0x734e('0x40')](_0x490f00[_0x734e('0x36')],_0x7d1e7d['filters']));_0x410f29[_0x734e('0x41')][_0x734e('0x5a')]=_0x2c72cc['id'];if(_0x490f00['query'][_0x734e('0x43')]){_0x410f29[_0x734e('0x41')]=_[_0x734e('0x4d')](_0x410f29[_0x734e('0x41')],{'$or':_[_0x734e('0x30')](_0x410f29[_0x734e('0x38')],function(_0x110182){var _0x5f3964={};_0x5f3964[_0x110182]={'$like':'%'+_0x490f00[_0x734e('0x36')][_0x734e('0x43')]+'%'};return _0x5f3964;})});}_0x410f29=_[_0x734e('0x4d')]({},_0x410f29,_0x490f00[_0x734e('0x44')]);return db[_0x734e('0xd2')]['count']({'where':_0x410f29[_0x734e('0x41')]})[_0x734e('0x17')](function(_0x2e67b7){_0x3cb19d[_0x734e('0x25')]=_0x2e67b7;if(_0x490f00[_0x734e('0x36')][_0x734e('0x5d')]){_0x410f29[_0x734e('0x45')]=[{'all':!![]}];}else{_0x410f29[_0x734e('0x45')]=[{'model':db[_0x734e('0x85')],'as':_0x734e('0xf4'),'required':![]},{'model':db[_0x734e('0xdb')],'as':'Attachments','required':![]}];}return db[_0x734e('0xd2')][_0x734e('0x46')](_0x410f29);})[_0x734e('0x17')](function(_0x5c50fa){_0x3cb19d[_0x734e('0x47')]=_0x5c50fa;return _0x3cb19d;});}})[_0x734e('0x17')](respondWithFilteredResult(_0x13206a,_0x410f29))[_0x734e('0x48')](handleError(_0x13206a,null));};exports['addAgents']=function(_0x324b11,_0x3d0a91){return db[_0x734e('0x31')][_0x734e('0x4e')]({'where':{'id':_0x324b11['params']['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x3d0a91,null))[_0x734e('0x17')](function(_0x1f6974){if(_0x1f6974){return _0x1f6974[_0x734e('0x128')](_0x324b11[_0x734e('0x50')][_0x734e('0x5f')],_[_0x734e('0xf3')](_0x324b11[_0x734e('0x50')],['ids','id'])||{})[_0x734e('0xb1')](function(_0x51e25f){for(var _0x31238b=0x0;_0x31238b<_0x324b11[_0x734e('0x50')][_0x734e('0x5f')][_0x734e('0x3b')];_0x31238b+=0x1){socket[_0x734e('0x129')](_0x734e('0x12a'),{'UserId':Number(_0x324b11['body'][_0x734e('0x5f')][_0x31238b]),'ChatWebsiteId':Number(_0x324b11[_0x734e('0x57')]['id'])});}return _0x51e25f;});}})[_0x734e('0x17')](respondWithResult(_0x3d0a91,null))['catch'](handleError(_0x3d0a91,null));};exports[_0x734e('0x12b')]=function(_0x422ca8,_0x1c61f3){return db[_0x734e('0x31')]['find']({'where':{'id':_0x422ca8['params']['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x1c61f3,null))[_0x734e('0x17')](function(_0x842b6d){if(_0x842b6d){return _0x842b6d[_0x734e('0x12b')](_0x422ca8[_0x734e('0x36')][_0x734e('0x5f')])[_0x734e('0x17')](function(){if(_[_0x734e('0x12c')](_0x422ca8[_0x734e('0x36')]['ids'])){for(var _0x2afaa3=0x0;_0x2afaa3<_0x422ca8['query'][_0x734e('0x5f')][_0x734e('0x3b')];_0x2afaa3+=0x1){socket[_0x734e('0x129')](_0x734e('0x12d'),{'UserId':Number(_0x422ca8['query'][_0x734e('0x5f')][_0x2afaa3]),'ChatWebsiteId':Number(_0x422ca8[_0x734e('0x57')]['id'])});}}else{socket[_0x734e('0x129')](_0x734e('0x12d'),{'UserId':Number(_0x422ca8[_0x734e('0x36')][_0x734e('0x5f')]),'ChatWebsiteId':Number(_0x422ca8[_0x734e('0x57')]['id'])});}});}})[_0x734e('0x17')](respondWithStatusCode(_0x1c61f3,null))['catch'](handleError(_0x1c61f3,null));};exports['getAgents']=function(_0x17c958,_0x283669){var _0x15771c={};var _0xb4619f={};var _0x20a4ff;var _0x2cc10a;return db[_0x734e('0x31')][_0x734e('0x62')]({'where':{'id':_0x17c958[_0x734e('0x57')]['id']}})[_0x734e('0x17')](handleEntityNotFound(_0x283669,null))[_0x734e('0x17')](function(_0x1bba02){if(_0x1bba02){_0x20a4ff=_0x1bba02;_0xb4619f[_0x734e('0x35')]=_[_0x734e('0x4c')](db[_0x734e('0xbd')][_0x734e('0x32')]);_0xb4619f[_0x734e('0x36')]=_[_0x734e('0x4c')](_0x17c958[_0x734e('0x36')]);_0xb4619f[_0x734e('0x37')]=_[_0x734e('0x39')](_0xb4619f['model'],_0xb4619f['query']);_0x15771c[_0x734e('0x38')]=_[_0x734e('0x39')](_0xb4619f[_0x734e('0x35')],qs['fields'](_0x17c958[_0x734e('0x36')][_0x734e('0x3a')]));_0x15771c[_0x734e('0x38')]=_0x15771c[_0x734e('0x38')][_0x734e('0x3b')]?_0x15771c[_0x734e('0x38')]:_0xb4619f[_0x734e('0x35')];_0x15771c[_0x734e('0x3e')]=qs['sort'](_0x17c958[_0x734e('0x36')][_0x734e('0x3f')]);_0x15771c[_0x734e('0x41')]=qs[_0x734e('0x37')](_[_0x734e('0x40')](_0x17c958[_0x734e('0x36')],_0xb4619f[_0x734e('0x37')]));if(_0x17c958[_0x734e('0x36')]['filter']){_0x15771c[_0x734e('0x41')]=_[_0x734e('0x4d')](_0x15771c['where'],{'$or':_['map'](_0x15771c[_0x734e('0x38')],function(_0xc05f33){var _0x34601a={};_0x34601a[_0xc05f33]={'$like':'%'+_0x17c958[_0x734e('0x36')][_0x734e('0x43')]+'%'};return _0x34601a;})});}_0x15771c=_[_0x734e('0x4d')]({},_0x15771c,_0x17c958['options']);return _0x20a4ff['getAgents'](_0x15771c);}})['then'](function(_0x17611e){if(_0x17611e){_0x2cc10a=_0x17611e[_0x734e('0x3b')];if(!_0x17c958[_0x734e('0x36')][_0x734e('0x3c')](_0x734e('0x3d'))){_0x15771c['limit']=qs[_0x734e('0x24')](_0x17c958['query'][_0x734e('0x24')]);_0x15771c[_0x734e('0x22')]=qs['offset'](_0x17c958[_0x734e('0x36')][_0x734e('0x22')]);}return _0x20a4ff['getAgents'](_0x15771c);}})[_0x734e('0x17')](function(_0x586d6c){if(_0x586d6c){return _0x586d6c?{'count':_0x2cc10a,'rows':_0x586d6c}:null;}})['then'](respondWithResult(_0x283669,null))[_0x734e('0x48')](handleError(_0x283669,null));}; \ No newline at end of file +var _0x4aa3=['forwardOffline','forwardOfflineAddress','service','host','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','fullname','Tag','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','custom','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','replace','verticalAlignment','textColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','html-to-text','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','ChatWebsite','count','includeAll','include','findAll','rows','show','params','Pause','keys','rawAttributes','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','describe','ChatWebsiteId','Disposition','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','isNil','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','customerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','list','applications','orderBy','priority','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','interaction','contact','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','defaults','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','sequelize','transaction','bulkCreate','MailServerOut','Smtp'];(function(_0xf2c955,_0x214d9e){var _0x233831=function(_0x4a7d77){while(--_0x4a7d77){_0xf2c955['push'](_0xf2c955['shift']());}};_0x233831(++_0x214d9e);}(_0x4aa3,0x174));var _0x34aa=function(_0x370f0b,_0x4d7eb3){_0x370f0b=_0x370f0b-0x0;var _0x4735ee=_0x4aa3[_0x370f0b];return _0x4735ee;};'use strict';var BPromise=require(_0x34aa('0x0'));var Mustache=require(_0x34aa('0x1'));var util=require('util');var path=require(_0x34aa('0x2'));var ejs=require(_0x34aa('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34aa('0x4'));var querystring=require(_0x34aa('0x5'));var Redis=require('ioredis');var qs=require(_0x34aa('0x6'));var logger=require(_0x34aa('0x7'))(_0x34aa('0x8'));var config=require('../../config/environment');var db=require(_0x34aa('0x9'))['db'];config[_0x34aa('0xa')]=_['defaults'](config[_0x34aa('0xa')],{'host':_0x34aa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34aa('0xa')]));require('./chatWebsite.socket')['register'](socket);var htmlToText=require(_0x34aa('0xc'));var jayson=require(_0x34aa('0xd'));var client=jayson[_0x34aa('0xe')][_0x34aa('0xf')]({'port':0x232c});var client9002=jayson[_0x34aa('0xe')][_0x34aa('0xf')]({'port':0x232a});var client9003=jayson['client'][_0x34aa('0xf')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x2f3b54,_0x1803a6,_0x35b673,_0x4818bd){return new BPromise(function(_0x452208,_0x5a5a5b){var _0x424c4d=_0x4818bd||client;return _0x424c4d[_0x34aa('0x10')](_0x2f3b54,_0x35b673)[_0x34aa('0x11')](function(_0x3a6819){logger[_0x34aa('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1803a6,_0x34aa('0x13'));logger[_0x34aa('0x14')](_0x34aa('0x15'),_0x1803a6,_0x34aa('0x13'),JSON[_0x34aa('0x16')](_0x3a6819));if(_0x3a6819[_0x34aa('0x17')]){if(_0x3a6819[_0x34aa('0x17')][_0x34aa('0x18')]===0x1f4){logger[_0x34aa('0x17')](_0x34aa('0x19'),_0x1803a6,_0x3a6819[_0x34aa('0x17')][_0x34aa('0x1a')]);return _0x5a5a5b(_0x3a6819[_0x34aa('0x17')][_0x34aa('0x1a')]);}logger[_0x34aa('0x17')](_0x34aa('0x19'),_0x1803a6,_0x3a6819[_0x34aa('0x17')][_0x34aa('0x1a')]);return _0x452208(_0x3a6819[_0x34aa('0x17')][_0x34aa('0x1a')]);}else{logger[_0x34aa('0x12')](_0x34aa('0x19'),_0x1803a6,_0x34aa('0x13'));_0x452208(_0x3a6819[_0x34aa('0x1b')][_0x34aa('0x1a')]);}})[_0x34aa('0x1c')](function(_0xd9874e){logger['error'](_0x34aa('0x19'),_0x1803a6,_0xd9874e);_0x5a5a5b(_0xd9874e);});});}function respondWithStatusCode(_0x3e78b9,_0x577f0b){_0x577f0b=_0x577f0b||0xcc;return function(_0x2db2ec){if(_0x2db2ec){return _0x3e78b9[_0x34aa('0x1d')](_0x577f0b);}return _0x3e78b9[_0x34aa('0x1e')](_0x577f0b)[_0x34aa('0x1f')]();};}function respondWithResult(_0x1ff3c3,_0x333d8d){_0x333d8d=_0x333d8d||0xc8;return function(_0x492598){if(_0x492598){return _0x1ff3c3[_0x34aa('0x1e')](_0x333d8d)[_0x34aa('0x20')](_0x492598);}};}function respondWithFilteredResult(_0x48bb85,_0x1aadee){return function(_0x413540){if(_0x413540){var _0xade9de=typeof _0x1aadee[_0x34aa('0x21')]===_0x34aa('0x22')&&typeof _0x1aadee[_0x34aa('0x23')]===_0x34aa('0x22');var _0x15e1f8=_0x413540['count'];var _0x3e8f8e=_0xade9de?0x0:_0x1aadee[_0x34aa('0x21')];var _0xc920c7=_0xade9de?_0x413540['count']:_0x1aadee[_0x34aa('0x21')]+_0x1aadee[_0x34aa('0x23')];var _0x1de0a4;if(_0xc920c7>=_0x15e1f8){_0xc920c7=_0x15e1f8;_0x1de0a4=0xc8;}else{_0x1de0a4=0xce;}_0x48bb85[_0x34aa('0x1e')](_0x1de0a4);return _0x48bb85[_0x34aa('0x24')](_0x34aa('0x25'),_0x3e8f8e+'-'+_0xc920c7+'/'+_0x15e1f8)[_0x34aa('0x20')](_0x413540);}return null;};}function saveUpdates(_0x43faaa){return function(_0x2fdd7e){if(_0x2fdd7e){return _0x2fdd7e[_0x34aa('0x26')](_0x43faaa)[_0x34aa('0x11')](function(_0x253088){return _0x253088;});}return null;};}function removeEntity(_0xffcbf2){return function(_0x3f91b1){if(_0x3f91b1){return _0x3f91b1[_0x34aa('0x27')]()['then'](function(){var _0x33fb7b=_0x3f91b1[_0x34aa('0x28')]({'plain':!![]});var _0x3ce8ae=_0x34aa('0x29');return db[_0x34aa('0x2a')][_0x34aa('0x27')]({'where':{'type':_0x3ce8ae,'resourceId':_0x33fb7b['id']}})[_0x34aa('0x11')](function(){return _0x3f91b1;});})['then'](function(){_0xffcbf2['status'](0xcc)[_0x34aa('0x1f')]();});}};}function handleEntityNotFound(_0x3e1749){return function(_0x3cb4cd){if(!_0x3cb4cd){_0x3e1749[_0x34aa('0x1d')](0x194);}return _0x3cb4cd;};}function handleError(_0x48d4bf,_0x218a31){_0x218a31=_0x218a31||0x1f4;return function(_0x42a871){logger[_0x34aa('0x17')](_0x42a871[_0x34aa('0x2b')]);if(_0x42a871[_0x34aa('0x2c')]){delete _0x42a871['name'];}_0x48d4bf[_0x34aa('0x1e')](_0x218a31)[_0x34aa('0x2d')](_0x42a871);};}exports[_0x34aa('0x2e')]=function(_0xf409a,_0x373711){var _0x39dc26={'include':[{'model':db['Pause'],'as':_0x34aa('0x2f')}]},_0x4474d8={},_0x16512b={'count':0x0,'rows':[]};var _0x35a5a7=_[_0x34aa('0x30')](db['ChatWebsite']['rawAttributes'],function(_0x4955c5){return{'name':_0x4955c5[_0x34aa('0x31')],'type':_0x4955c5[_0x34aa('0x32')]['key']};});_0x4474d8[_0x34aa('0x33')]=_[_0x34aa('0x30')](_0x35a5a7,'name');_0x4474d8[_0x34aa('0x34')]=_['keys'](_0xf409a[_0x34aa('0x34')]);_0x4474d8[_0x34aa('0x35')]=_[_0x34aa('0x36')](_0x4474d8[_0x34aa('0x33')],_0x4474d8[_0x34aa('0x34')]);_0x39dc26[_0x34aa('0x37')]=_[_0x34aa('0x36')](_0x4474d8[_0x34aa('0x33')],qs[_0x34aa('0x38')](_0xf409a[_0x34aa('0x34')]['fields']));_0x39dc26[_0x34aa('0x37')]=_0x39dc26[_0x34aa('0x37')]['length']?_0x39dc26[_0x34aa('0x37')]:_0x4474d8['model'];if(!_0xf409a[_0x34aa('0x34')]['hasOwnProperty'](_0x34aa('0x39'))){_0x39dc26[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0xf409a[_0x34aa('0x34')][_0x34aa('0x23')]);_0x39dc26[_0x34aa('0x21')]=qs[_0x34aa('0x21')](_0xf409a[_0x34aa('0x34')][_0x34aa('0x21')]);}_0x39dc26[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0xf409a['query'][_0x34aa('0x3b')]);_0x39dc26[_0x34aa('0x3c')]=qs['filters'](_[_0x34aa('0x3d')](_0xf409a[_0x34aa('0x34')],_0x4474d8[_0x34aa('0x35')]),_0x35a5a7);if(_0xf409a[_0x34aa('0x34')][_0x34aa('0x3e')]){_0x39dc26[_0x34aa('0x3c')]=_['merge'](_0x39dc26[_0x34aa('0x3c')],{'$or':_[_0x34aa('0x30')](_0x35a5a7,function(_0x5420ed){if(_0x5420ed['type']!=='VIRTUAL'){var _0x3aa65a={};_0x3aa65a[_0x5420ed[_0x34aa('0x2c')]]={'$like':'%'+_0xf409a[_0x34aa('0x34')][_0x34aa('0x3e')]+'%'};return _0x3aa65a;}})});}_0x39dc26=_[_0x34aa('0x3f')]({},_0x39dc26,_0xf409a[_0x34aa('0x40')]);var _0x5ef573={'where':_0x39dc26[_0x34aa('0x3c')]};return db[_0x34aa('0x41')][_0x34aa('0x42')](_0x5ef573)['then'](function(_0x34aa52){_0x16512b['count']=_0x34aa52;if(_0xf409a['query'][_0x34aa('0x43')]){_0x39dc26[_0x34aa('0x44')]=[{'all':!![]}];}return db[_0x34aa('0x41')][_0x34aa('0x45')](_0x39dc26);})[_0x34aa('0x11')](function(_0x17ba78){_0x16512b[_0x34aa('0x46')]=_0x17ba78;return _0x16512b;})['then'](respondWithFilteredResult(_0x373711,_0x39dc26))[_0x34aa('0x1c')](handleError(_0x373711,null));};exports[_0x34aa('0x47')]=function(_0x2805c6,_0x42b52f){var _0x3f4f9b={'raw':![],'where':{'id':_0x2805c6[_0x34aa('0x48')]['id']},'include':[{'model':db[_0x34aa('0x49')],'as':_0x34aa('0x2f')}]},_0x1ae882={};_0x1ae882[_0x34aa('0x33')]=_[_0x34aa('0x4a')](db['ChatWebsite'][_0x34aa('0x4b')]);_0x1ae882['query']=_['keys'](_0x2805c6[_0x34aa('0x34')]);_0x1ae882['filters']=_[_0x34aa('0x36')](_0x1ae882[_0x34aa('0x33')],_0x1ae882[_0x34aa('0x34')]);_0x3f4f9b[_0x34aa('0x37')]=_['intersection'](_0x1ae882['model'],qs[_0x34aa('0x38')](_0x2805c6[_0x34aa('0x34')][_0x34aa('0x38')]));_0x3f4f9b[_0x34aa('0x37')]=_0x3f4f9b['attributes'][_0x34aa('0x4c')]?_0x3f4f9b[_0x34aa('0x37')]:_0x1ae882['model'];if(_0x2805c6[_0x34aa('0x34')]['includeAll']){_0x3f4f9b[_0x34aa('0x44')]=[{'all':!![]}];}_0x3f4f9b=_[_0x34aa('0x3f')]({},_0x3f4f9b,_0x2805c6[_0x34aa('0x40')]);return db[_0x34aa('0x41')]['find'](_0x3f4f9b)[_0x34aa('0x11')](handleEntityNotFound(_0x42b52f,null))['then'](respondWithResult(_0x42b52f,null))[_0x34aa('0x1c')](handleError(_0x42b52f,null));};exports[_0x34aa('0x4d')]=function(_0x43ea33,_0x47a003){return db[_0x34aa('0x41')]['create'](_0x43ea33['body'],{})[_0x34aa('0x11')](function(_0x5eff3b){var _0x348f95=_0x43ea33[_0x34aa('0x4e')][_0x34aa('0x28')]({'plain':!![]});if(!_0x348f95)throw new Error(_0x34aa('0x4f'));if(_0x348f95[_0x34aa('0x50')]===_0x34aa('0x4e')){var _0x579799=_0x5eff3b[_0x34aa('0x28')]({'plain':!![]});var _0x28c821='ChatWebsites';return db[_0x34aa('0x51')][_0x34aa('0x52')]({'where':{'name':_0x28c821,'userProfileId':_0x348f95[_0x34aa('0x53')]},'raw':!![]})[_0x34aa('0x11')](function(_0x2a0023){if(_0x2a0023&&_0x2a0023[_0x34aa('0x54')]===0x0){return db['UserProfileResource'][_0x34aa('0x4d')]({'name':_0x579799[_0x34aa('0x2c')],'resourceId':_0x579799['id'],'type':_0x2a0023[_0x34aa('0x2c')],'sectionId':_0x2a0023['id']},{})[_0x34aa('0x11')](function(){return _0x5eff3b;});}else{return _0x5eff3b;}})['catch'](function(_0x1f31b4){logger[_0x34aa('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f31b4);throw _0x1f31b4;});}return _0x5eff3b;})[_0x34aa('0x11')](respondWithResult(_0x47a003,0xc9))[_0x34aa('0x1c')](handleError(_0x47a003,null));};exports[_0x34aa('0x26')]=function(_0x134bef,_0x3fe964){if(_0x134bef[_0x34aa('0x55')]['id']){delete _0x134bef[_0x34aa('0x55')]['id'];}return db['ChatWebsite'][_0x34aa('0x52')]({'where':{'id':_0x134bef[_0x34aa('0x48')]['id']},'include':[{'model':db[_0x34aa('0x49')],'as':_0x34aa('0x2f')}]})['then'](handleEntityNotFound(_0x3fe964,null))[_0x34aa('0x11')](saveUpdates(_0x134bef[_0x34aa('0x55')],null))[_0x34aa('0x11')](respondWithResult(_0x3fe964,null))['catch'](handleError(_0x3fe964,null));};exports[_0x34aa('0x27')]=function(_0x1b7d1e,_0x54b383){return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x1b7d1e[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x54b383,null))['then'](removeEntity(_0x54b383,null))[_0x34aa('0x1c')](handleError(_0x54b383,null));};exports[_0x34aa('0x56')]=function(_0x26ba1e,_0x429192){return db[_0x34aa('0x41')]['describe']()[_0x34aa('0x11')](respondWithResult(_0x429192,null))['catch'](handleError(_0x429192,null));};exports['addDisposition']=function(_0x4e8569,_0x257992){if(_0x4e8569[_0x34aa('0x55')]['id']){delete _0x4e8569[_0x34aa('0x55')]['id'];}return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x4e8569[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x257992,null))[_0x34aa('0x11')](function(_0x589988){if(_0x589988){_0x4e8569[_0x34aa('0x55')][_0x34aa('0x57')]=_0x589988['id'];return db[_0x34aa('0x58')][_0x34aa('0x4d')](_0x4e8569[_0x34aa('0x55')]);}})['then'](respondWithResult(_0x257992,null))[_0x34aa('0x1c')](handleError(_0x257992,null));};exports['getDispositions']=function(_0x4a7d1b,_0x290891){var _0x9262e2={'raw':![],'where':{}};var _0x3b2886={};var _0xdfeb26={'count':0x0,'rows':[]};return db[_0x34aa('0x41')]['findOne']({'where':{'id':_0x4a7d1b['params']['id']}})['then'](handleEntityNotFound(_0x290891,null))[_0x34aa('0x11')](function(_0x3b85cb){if(_0x3b85cb){_0x3b2886[_0x34aa('0x33')]=_['keys'](db[_0x34aa('0x58')][_0x34aa('0x4b')]);_0x3b2886[_0x34aa('0x34')]=_[_0x34aa('0x4a')](_0x4a7d1b[_0x34aa('0x34')]);_0x3b2886['filters']=_['intersection'](_0x3b2886['model'],_0x3b2886[_0x34aa('0x34')]);_0x9262e2[_0x34aa('0x37')]=_['intersection'](_0x3b2886[_0x34aa('0x33')],qs['fields'](_0x4a7d1b[_0x34aa('0x34')][_0x34aa('0x38')]));_0x9262e2[_0x34aa('0x37')]=_0x9262e2[_0x34aa('0x37')][_0x34aa('0x4c')]?_0x9262e2['attributes']:_0x3b2886[_0x34aa('0x33')];if(!_0x4a7d1b[_0x34aa('0x34')][_0x34aa('0x59')](_0x34aa('0x39'))){_0x9262e2[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x4a7d1b[_0x34aa('0x34')][_0x34aa('0x23')]);_0x9262e2[_0x34aa('0x21')]=qs[_0x34aa('0x21')](_0x4a7d1b[_0x34aa('0x34')][_0x34aa('0x21')]);}_0x9262e2[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0x4a7d1b[_0x34aa('0x34')]['sort']);_0x9262e2[_0x34aa('0x3c')]=qs[_0x34aa('0x35')](_[_0x34aa('0x3d')](_0x4a7d1b[_0x34aa('0x34')],_0x3b2886[_0x34aa('0x35')]));_0x9262e2[_0x34aa('0x3c')][_0x34aa('0x57')]=_0x3b85cb['id'];if(_0x4a7d1b[_0x34aa('0x34')]['filter']){_0x9262e2[_0x34aa('0x3c')]=_[_0x34aa('0x3f')](_0x9262e2[_0x34aa('0x3c')],{'$or':_[_0x34aa('0x30')](_0x9262e2[_0x34aa('0x37')],function(_0x1cd8b7){var _0xa86493={};_0xa86493[_0x1cd8b7]={'$like':'%'+_0x4a7d1b[_0x34aa('0x34')][_0x34aa('0x3e')]+'%'};return _0xa86493;})});}_0x9262e2=_['merge']({},_0x9262e2,_0x4a7d1b[_0x34aa('0x40')]);return db[_0x34aa('0x58')][_0x34aa('0x42')]({'where':_0x9262e2[_0x34aa('0x3c')]})[_0x34aa('0x11')](function(_0x2ce1be){_0xdfeb26[_0x34aa('0x42')]=_0x2ce1be;if(_0x4a7d1b[_0x34aa('0x34')][_0x34aa('0x43')]){_0x9262e2[_0x34aa('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x34aa('0x45')](_0x9262e2);})[_0x34aa('0x11')](function(_0x35c580){_0xdfeb26[_0x34aa('0x46')]=_0x35c580;return _0xdfeb26;});}})['then'](respondWithFilteredResult(_0x290891,_0x9262e2))['catch'](handleError(_0x290891,null));};exports['removeDispositions']=function(_0x419c51,_0x408f5e){return db['ChatWebsite'][_0x34aa('0x52')]({'where':{'id':_0x419c51[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x408f5e,null))['then'](function(_0x2a3a26){if(_0x2a3a26){return _0x2a3a26[_0x34aa('0x5a')](_0x419c51[_0x34aa('0x34')][_0x34aa('0x5b')]);}})[_0x34aa('0x11')](respondWithStatusCode(_0x408f5e,null))[_0x34aa('0x1c')](handleError(_0x408f5e,null));};exports['addAnswer']=function(_0x29073b,_0x2cd161){if(_0x29073b['body']['id']){delete _0x29073b['body']['id'];}return db['ChatWebsite'][_0x34aa('0x52')]({'where':{'id':_0x29073b['params']['id']}})['then'](handleEntityNotFound(_0x2cd161,null))[_0x34aa('0x11')](function(_0x58e530){if(_0x58e530){_0x29073b[_0x34aa('0x55')]['ChatWebsiteId']=_0x58e530['id'];return db[_0x34aa('0x5c')][_0x34aa('0x4d')](_0x29073b[_0x34aa('0x55')]);}})[_0x34aa('0x11')](respondWithResult(_0x2cd161,null))[_0x34aa('0x1c')](handleError(_0x2cd161,null));};exports[_0x34aa('0x5d')]=function(_0x3e34b9,_0x13045f){var _0x42f250={'raw':![],'where':{}};var _0x41a794={};var _0x39fbf6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x34aa('0x5e')]({'where':{'id':_0x3e34b9[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x13045f,null))['then'](function(_0x1678a2){if(_0x1678a2){_0x41a794[_0x34aa('0x33')]=_[_0x34aa('0x4a')](db[_0x34aa('0x5c')][_0x34aa('0x4b')]);_0x41a794['query']=_[_0x34aa('0x4a')](_0x3e34b9['query']);_0x41a794['filters']=_[_0x34aa('0x36')](_0x41a794[_0x34aa('0x33')],_0x41a794['query']);_0x42f250[_0x34aa('0x37')]=_[_0x34aa('0x36')](_0x41a794[_0x34aa('0x33')],qs[_0x34aa('0x38')](_0x3e34b9[_0x34aa('0x34')][_0x34aa('0x38')]));_0x42f250[_0x34aa('0x37')]=_0x42f250[_0x34aa('0x37')][_0x34aa('0x4c')]?_0x42f250[_0x34aa('0x37')]:_0x41a794['model'];if(!_0x3e34b9[_0x34aa('0x34')][_0x34aa('0x59')](_0x34aa('0x39'))){_0x42f250[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x3e34b9[_0x34aa('0x34')]['limit']);_0x42f250[_0x34aa('0x21')]=qs['offset'](_0x3e34b9[_0x34aa('0x34')][_0x34aa('0x21')]);}_0x42f250[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0x3e34b9['query'][_0x34aa('0x3b')]);_0x42f250[_0x34aa('0x3c')]=qs[_0x34aa('0x35')](_[_0x34aa('0x3d')](_0x3e34b9[_0x34aa('0x34')],_0x41a794[_0x34aa('0x35')]));_0x42f250[_0x34aa('0x3c')]['ChatWebsiteId']=_0x1678a2['id'];if(_0x3e34b9['query'][_0x34aa('0x3e')]){_0x42f250[_0x34aa('0x3c')]=_[_0x34aa('0x3f')](_0x42f250[_0x34aa('0x3c')],{'$or':_[_0x34aa('0x30')](_0x42f250['attributes'],function(_0x5e6406){var _0x56e71f={};_0x56e71f[_0x5e6406]={'$like':'%'+_0x3e34b9[_0x34aa('0x34')]['filter']+'%'};return _0x56e71f;})});}_0x42f250=_[_0x34aa('0x3f')]({},_0x42f250,_0x3e34b9[_0x34aa('0x40')]);return db[_0x34aa('0x5c')][_0x34aa('0x42')]({'where':_0x42f250[_0x34aa('0x3c')]})[_0x34aa('0x11')](function(_0x54ae8d){_0x39fbf6[_0x34aa('0x42')]=_0x54ae8d;if(_0x3e34b9[_0x34aa('0x34')][_0x34aa('0x43')]){_0x42f250[_0x34aa('0x44')]=[{'all':!![]}];}return db[_0x34aa('0x5c')][_0x34aa('0x45')](_0x42f250);})[_0x34aa('0x11')](function(_0x4162be){_0x39fbf6[_0x34aa('0x46')]=_0x4162be;return _0x39fbf6;});}})['then'](respondWithFilteredResult(_0x13045f,_0x42f250))[_0x34aa('0x1c')](handleError(_0x13045f,null));};exports[_0x34aa('0x5f')]=function(_0xff033b,_0x56a931){return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0xff033b['params']['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x56a931,null))['then'](function(_0x2c3bbb){if(_0x2c3bbb){return _0x2c3bbb[_0x34aa('0x5f')](_0xff033b[_0x34aa('0x34')]['ids']);}})[_0x34aa('0x11')](respondWithStatusCode(_0x56a931,null))[_0x34aa('0x1c')](handleError(_0x56a931,null));};exports[_0x34aa('0x60')]=function(_0x5465e1,_0x525eae){_0x5465e1[_0x34aa('0x55')][_0x34aa('0x61')]=_0x5465e1['file'][_0x34aa('0x62')];return db['ChatWebsite'][_0x34aa('0x52')]({'where':{'id':_0x5465e1[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x525eae,null))['then'](saveUpdates(_0x5465e1[_0x34aa('0x55')],null))['then'](respondWithResult(_0x525eae,null))[_0x34aa('0x1c')](handleError(_0x525eae,null));};exports[_0x34aa('0x63')]=function(_0x2189c1,_0x18399f){_0x2189c1[_0x34aa('0x55')][_0x34aa('0x64')]=_0x2189c1[_0x34aa('0x65')][_0x34aa('0x62')];return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x2189c1[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x18399f,null))[_0x34aa('0x11')](saveUpdates(_0x2189c1['body'],null))[_0x34aa('0x11')](respondWithResult(_0x18399f,null))[_0x34aa('0x1c')](handleError(_0x18399f,null));};exports[_0x34aa('0x66')]=function(_0x210e28,_0x3fe8c0){_0x210e28[_0x34aa('0x55')]['customerAvatar']=_0x210e28[_0x34aa('0x65')][_0x34aa('0x62')];return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x210e28[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x3fe8c0,null))[_0x34aa('0x11')](saveUpdates(_0x210e28[_0x34aa('0x55')],null))[_0x34aa('0x11')](respondWithResult(_0x3fe8c0,null))[_0x34aa('0x1c')](handleError(_0x3fe8c0,null));};exports[_0x34aa('0x67')]=function(_0x435b67,_0x3f2908){_0x435b67['body'][_0x34aa('0x68')]=_0x435b67[_0x34aa('0x65')][_0x34aa('0x62')];return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x435b67['params']['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x3f2908,null))[_0x34aa('0x11')](saveUpdates(_0x435b67['body'],null))['then'](respondWithResult(_0x3f2908,null))[_0x34aa('0x1c')](handleError(_0x3f2908,null));};exports[_0x34aa('0x69')]=function(_0x3b4b49,_0x125bac){var _0x5061bc=path['join'](config[_0x34aa('0x6a')],_0x34aa('0x6b'));var _0x2e0afb={'where':{'id':_0x3b4b49[_0x34aa('0x48')]['id']},'attributes':['id',_0x34aa('0x61')],'raw':!![]};var _0x214189=![];return require('../../config/license/util')[_0x34aa('0x6c')]()[_0x34aa('0x11')](function(_0x137ed0){if(_0x137ed0){_0x214189=_0x137ed0['custom'];}})[_0x34aa('0x11')](function(){return db['ChatWebsite'][_0x34aa('0x52')](_0x2e0afb);})['then'](handleEntityNotFound(_0x125bac,null))[_0x34aa('0x11')](function(_0x285c40){if(_0x285c40){if(!_[_0x34aa('0x6d')](_0x285c40['sitepic'])){if(fs['existsSync'](path['join'](config['root'],_0x34aa('0x6e'),_0x285c40[_0x34aa('0x61')]))&&_0x214189){_0x5061bc=path[_0x34aa('0x6f')](config[_0x34aa('0x6a')],_0x34aa('0x6e'),_0x285c40[_0x34aa('0x61')]);}}return _0x125bac[_0x34aa('0x70')](_0x5061bc);}})[_0x34aa('0x1c')](handleError(_0x125bac,null));};exports[_0x34aa('0x71')]=function(_0x14aaa0,_0x506a10){var _0x11f66b=path['join'](config[_0x34aa('0x6a')],_0x34aa('0x72'));var _0x310082={'where':{'id':_0x14aaa0['params']['id']},'attributes':['id',_0x34aa('0x64')],'raw':!![]};return db[_0x34aa('0x41')][_0x34aa('0x52')](_0x310082)[_0x34aa('0x11')](handleEntityNotFound(_0x506a10,null))['then'](function(_0xee0963){if(_0xee0963){if(!_[_0x34aa('0x6d')](_0xee0963[_0x34aa('0x64')])){if(fs['existsSync'](path[_0x34aa('0x6f')](config[_0x34aa('0x6a')],_0x34aa('0x73'),_0xee0963[_0x34aa('0x64')]))){_0x11f66b=path['join'](config[_0x34aa('0x6a')],_0x34aa('0x73'),_0xee0963['agentAvatar']);}}return _0x506a10[_0x34aa('0x70')](_0x11f66b);}})['catch'](handleError(_0x506a10,null));};exports['getCustomerAvatar']=function(_0x290f34,_0x10e9d2){var _0x3522be=path['join'](config[_0x34aa('0x6a')],_0x34aa('0x74'));var _0x250802={'where':{'id':_0x290f34['params']['id']},'attributes':['id','customerAvatar',_0x34aa('0x75')],'raw':!![]};return db['ChatWebsite'][_0x34aa('0x52')](_0x250802)[_0x34aa('0x11')](handleEntityNotFound(_0x10e9d2,null))[_0x34aa('0x11')](function(_0x19d7b1){if(_0x19d7b1){if(!_[_0x34aa('0x6d')](_0x19d7b1['customerAvatar'])){if(fs[_0x34aa('0x76')](path['join'](config['root'],_0x34aa('0x73'),_0x19d7b1[_0x34aa('0x77')]))&&_0x19d7b1[_0x34aa('0x75')]){_0x3522be=path['join'](config[_0x34aa('0x6a')],_0x34aa('0x73'),_0x19d7b1['customerAvatar']);}}return _0x10e9d2['download'](_0x3522be);}})[_0x34aa('0x1c')](handleError(_0x10e9d2,null));};exports['getSystemAvatar']=function(_0x4a190b,_0x841120){var _0x3006f4=path[_0x34aa('0x6f')](config[_0x34aa('0x6a')],_0x34aa('0x78'));var _0xfad51d={'where':{'id':_0x4a190b[_0x34aa('0x48')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x34aa('0x41')][_0x34aa('0x52')](_0xfad51d)['then'](handleEntityNotFound(_0x841120,null))[_0x34aa('0x11')](function(_0x208f2f){if(_0x208f2f){if(!_['isNil'](_0x208f2f[_0x34aa('0x68')])){if(fs['existsSync'](path[_0x34aa('0x6f')](config[_0x34aa('0x6a')],_0x34aa('0x73'),_0x208f2f[_0x34aa('0x68')]))){_0x3006f4=path[_0x34aa('0x6f')](config[_0x34aa('0x6a')],'server/files/images/avatars/',_0x208f2f[_0x34aa('0x68')]);}}return _0x841120[_0x34aa('0x70')](_0x3006f4);}})[_0x34aa('0x1c')](handleError(_0x841120,null));};exports[_0x34aa('0x79')]=function(_0x368a74,_0x314372){var _0x2556c0=require(_0x34aa('0x7a'));var _0x26f58a=new _0x2556c0();var _0x2b087a=_0x26f58a[_0x34aa('0x7b')](_0x368a74[_0x34aa('0x7c')]['user-agent'])[_0x34aa('0x7d')]();var _0x1559c5={'body':_0x368a74[_0x34aa('0x55')],'channel':_0x34aa('0x7e')};var _0x29a468=[];var _0x1e395f=[];var _0x3aa90a={};var _0x121aa6=![];return db[_0x34aa('0x7f')][_0x34aa('0x56')]()['then'](function(_0x3f3b58){if(!_0x3f3b58){throw new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))]('no\x20available\x20attributes');}_0x29a468=_['difference'](_[_0x34aa('0x4a')](_0x3f3b58),[_0x34aa('0x82'),'updatedAt']);_0x1e395f=_[_0x34aa('0x83')](_['keys'](_0x3f3b58),['createdAt',_0x34aa('0x84'),_0x34aa('0x85'),_0x34aa('0x86')]);if(_0x368a74[_0x34aa('0x55')]['id']){delete _0x368a74[_0x34aa('0x55')]['id'];}if(_[_0x34aa('0x6d')](_0x368a74[_0x34aa('0x55')][_0x34aa('0x87')])){throw new db[(_0x34aa('0x80'))]['ValidationError'](_0x34aa('0x88'));}if(_['isNil'](_0x368a74['body'][_0x34aa('0x55')])||_0x368a74['body'][_0x34aa('0x55')]===''){throw new db[(_0x34aa('0x80'))]['ValidationError'](_0x34aa('0x89'));}if(_[_0x34aa('0x6d')](_0x368a74['body'][_0x34aa('0x8a')])){throw new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))](_0x34aa('0x8b')+_0x1e395f);}if(!_['includes'](_0x1e395f,_0x368a74['body'][_0x34aa('0x8a')])){throw new db['Sequelize'][(_0x34aa('0x81'))](_0x34aa('0x8c')+_0x1e395f);}_0x3aa90a[_0x368a74[_0x34aa('0x55')][_0x34aa('0x8a')]]=_0x368a74[_0x34aa('0x55')][_0x34aa('0x87')];})['then'](function(){return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x368a74[_0x34aa('0x48')]['id']},'include':[{'model':db[_0x34aa('0x8d')],'as':_0x34aa('0x8e'),'include':[{'model':db[_0x34aa('0x7f')],'as':_0x34aa('0x8f'),'where':_0x3aa90a,'limit':0x1,'order':[[_0x34aa('0x84'),_0x34aa('0x90')]]}]},{'model':db['ChatApplication'],'as':_0x34aa('0x91')}]});})[_0x34aa('0x11')](handleEntityNotFound(_0x314372,null))[_0x34aa('0x11')](function(_0x5415ae){if(_0x5415ae&&_0x5415ae[_0x34aa('0x8e')]){_0x1559c5[_0x34aa('0x92')]=_0x5415ae;_0x1559c5['applications']=_0x5415ae['Applications'];_0x1559c5[_0x34aa('0x93')]=_0x5415ae[_0x34aa('0x8e')];_0x1559c5[_0x34aa('0x94')]=_[_0x34aa('0x95')](_0x1559c5['applications'],[_0x34aa('0x96')],['asc']);if(_0x1559c5[_0x34aa('0x92')][_0x34aa('0x91')]){delete _0x1559c5[_0x34aa('0x92')]['Applications'];}if(_0x1559c5[_0x34aa('0x92')][_0x34aa('0x8e')]&&_0x1559c5[_0x34aa('0x92')][_0x34aa('0x8e')]['Contacts'][_0x34aa('0x4c')]){return _0x1559c5[_0x34aa('0x92')]['List']['Contacts'][0x0];}var _0x334bc2=_['defaults'](_0x368a74[_0x34aa('0x55')],{'firstName':_0x368a74[_0x34aa('0x55')][_0x34aa('0x87')],'ListId':_0x5415ae['ListId']});_0x334bc2[_0x368a74[_0x34aa('0x55')][_0x34aa('0x8a')]]=_0x368a74[_0x34aa('0x55')][_0x34aa('0x87')];return db[_0x34aa('0x7f')][_0x34aa('0x4d')](_0x334bc2,{'fields':_0x29a468,'raw':!![]});}})[_0x34aa('0x11')](handleEntityNotFound(_0x314372,null))[_0x34aa('0x11')](function(_0x28eadd){_0x1559c5['contact']=_0x28eadd;var _0x28ec10=_0x368a74[_0x34aa('0x55')][_0x34aa('0x97')];if(_0x368a74[_0x34aa('0x7c')][_0x34aa('0x98')]){_0x28ec10=_0x368a74[_0x34aa('0x7c')][_0x34aa('0x98')];}else if(_0x368a74[_0x34aa('0x7c')][_0x34aa('0x99')]){_0x28ec10=_['first'](_0x368a74[_0x34aa('0x7c')][_0x34aa('0x99')]['split'](','));}if(_0x28eadd){var _0x24a3d1={'ContactId':_0x28eadd['id'],'ChatWebsiteId':_0x368a74['params']['id'],'from':(_0x28eadd[_0x34aa('0x9a')]||'')+'\x20'+(_0x28eadd[_0x34aa('0x9b')]||''),'customerIp':_0x28ec10,'customerPort':_0x368a74[_0x34aa('0x7c')]['x-real-port']?_0x368a74[_0x34aa('0x7c')]['x-real-port']:null,'referer':_0x368a74[_0x34aa('0x55')][_0x34aa('0x9c')],'browserName':_0x2b087a[_0x34aa('0x9d')]['name']&&_0x2b087a[_0x34aa('0x9d')][_0x34aa('0x9e')]?util[_0x34aa('0x9f')](_0x34aa('0xa0'),_0x2b087a['browser'][_0x34aa('0x2c')],_0x2b087a[_0x34aa('0x9d')][_0x34aa('0x9e')]):'unknown','browserVersion':_0x2b087a['browser']['version']||_0x34aa('0xa1'),'osName':util['format'](_0x34aa('0xa0'),_0x2b087a['os'][_0x34aa('0x2c')],_0x2b087a['os'][_0x34aa('0x9e')]),'osVersion':_0x2b087a['os'][_0x34aa('0x9e')],'deviceModel':_0x2b087a[_0x34aa('0xa2')][_0x34aa('0x33')]&&_0x2b087a[_0x34aa('0xa2')][_0x34aa('0xa3')]?util[_0x34aa('0x9f')](_0x34aa('0xa4'),_0x2b087a[_0x34aa('0xa2')][_0x34aa('0x33')],_0x2b087a[_0x34aa('0xa2')][_0x34aa('0xa3')],_0x2b087a[_0x34aa('0xa2')][_0x34aa('0x32')]):null,'deviceVendor':_0x2b087a[_0x34aa('0xa2')][_0x34aa('0xa3')],'deviceType':_0x2b087a['device'][_0x34aa('0x32')],'formData':JSON[_0x34aa('0x16')](_0x368a74[_0x34aa('0x55')])};var _0x257a9a={'ChatWebsiteId':_0x368a74[_0x34aa('0x48')]['id'],'closed':![]};if(_0x368a74['body']['threadId']){_0x257a9a['threadId']=_0x368a74['body'][_0x34aa('0xa5')];return db['ChatInteraction'][_0x34aa('0x52')]({'where':_0x257a9a})[_0x34aa('0x11')](function(_0x181cbf){if(_0x181cbf){return[_0x181cbf,![]];}_0x24a3d1[_0x34aa('0xa5')]=_0x368a74[_0x34aa('0x55')]['threadId'];_0x24a3d1[_0x34aa('0xa6')]=_0x368a74[_0x34aa('0x55')][_0x34aa('0xa6')];return db[_0x34aa('0xa7')][_0x34aa('0x4d')](_0x24a3d1)[_0x34aa('0x11')](function(_0x26c31c){return[_0x26c31c,!![]];});});}_0x257a9a['ContactId']=_0x28eadd['id'];if(_0x368a74[_0x34aa('0x55')][_0x34aa('0xa8')]&&_0x368a74[_0x34aa('0x55')][_0x34aa('0xa8')]['id']){_0x257a9a['id']=_0x368a74[_0x34aa('0x55')][_0x34aa('0xa8')]['id'];return db['ChatInteraction'][_0x34aa('0x52')]({'where':_0x257a9a})[_0x34aa('0x11')](function(_0x22d2a1){if(_0x22d2a1){return[_0x22d2a1,![]];}return db[_0x34aa('0xa7')][_0x34aa('0x4d')](_0x24a3d1)['then'](function(_0x5342b1){return[_0x5342b1,!![]];});});}return db[_0x34aa('0xa7')][_0x34aa('0x4d')](_0x24a3d1)[_0x34aa('0x11')](function(_0x23f211){return[_0x23f211,!![]];});}})['spread'](function(_0x59f098,_0x1c325e){if(_0x59f098){_0x121aa6=_0x1c325e;if(!_0x1c325e){var _0x1744fc={'from':(_0x1559c5[_0x34aa('0xa9')][_0x34aa('0x9a')]||'')+'\x20'+(_0x1559c5['contact'][_0x34aa('0x9b')]||'')};if(_0x368a74[_0x34aa('0x55')]['threadId']&&_0x368a74[_0x34aa('0x55')][_0x34aa('0xaa')]&&_0x368a74['body'][_0x34aa('0xa5')]!=_0x368a74[_0x34aa('0x55')][_0x34aa('0xaa')]){_0x1744fc[_0x34aa('0xa5')]=_0x368a74[_0x34aa('0x55')][_0x34aa('0xaa')];}return _0x59f098[_0x34aa('0x26')](_0x1744fc);}else{return _0x59f098;}}})['then'](function(_0x40f5f8){_0x1559c5[_0x34aa('0xa8')]=_0x40f5f8[_0x34aa('0x28')]({'plain':!![]});_0x1559c5[_0x34aa('0xa8')][_0x34aa('0xab')]=_0x121aa6;if(_0x1559c5[_0x34aa('0xa8')][_0x34aa('0xab')]){if(_0x1559c5[_0x34aa('0x92')]['autoclose']){_0x1559c5[_0x34aa('0x94')][_0x34aa('0xac')]({'id':0x0,'priority':_0x1559c5[_0x34aa('0x94')]['length']+0x1,'app':'close','appdata':_0x34aa('0xad'),'interval':_0x34aa('0xae')});}}return db[_0x34aa('0xaf')]['create']({'body':_0x368a74['body']['body'],'ChatWebsiteId':_0x368a74[_0x34aa('0x48')]['id'],'ChatInteractionId':_0x40f5f8['id'],'direction':'in','ContactId':_0x1559c5[_0x34aa('0xa9')]['id'],'AttachmentId':_0x368a74[_0x34aa('0x55')][_0x34aa('0xb0')]});})[_0x34aa('0x11')](function(_0x58f5a2){_0x1559c5[_0x34aa('0x1a')]=_0x58f5a2;if(_0x1559c5[_0x34aa('0xa8')]['UserId']){return db[_0x34aa('0xb1')][_0x34aa('0x52')]({'attributes':['id',_0x34aa('0x2c')],'where':{'id':_0x1559c5['interaction'][_0x34aa('0xb2')]}})[_0x34aa('0x11')](function(_0x47eb19){if(_0x47eb19){_0x1559c5[_0x34aa('0x94')][_0x34aa('0xb3')]({'id':0x0,'priority':0x0,'app':_0x34aa('0xb4'),'appdata':_0x47eb19[_0x34aa('0x2c')]+','+(_0x1559c5['account'][_0x34aa('0xb5')]||0xa),'interval':_0x34aa('0xae')});_0x1559c5[_0x34aa('0xb6')]=!![];}return respondWithRpcPromise(_0x34aa('0xb7'),_0x34aa('0xb8'),_0x1559c5);});}return respondWithRpcPromise('Start',_0x34aa('0xb8'),_0x1559c5);})['then'](function(_0x483fe1){respondWithRpcPromise(_0x34aa('0xb9'),_0x34aa('0xb9'),{'event':_0x34aa('0x79'),'message':_0x483fe1},client9002);return _0x483fe1;})[_0x34aa('0x11')](respondWithResult(_0x314372,null))[_0x34aa('0x1c')](handleError(_0x314372,null));};exports[_0x34aa('0xba')]=function(_0x3f0f6f,_0x467026){var _0x1ac951,_0x38435c,_0xa93072;var _0x39d523=[];var _0x85dd0c={};var _0x477b4b=_0x3f0f6f[_0x34aa('0xbb')]||[];var _0x1bbe74=[];var _0x500000;return db['CmContact'][_0x34aa('0x56')]()[_0x34aa('0x11')](function(_0x1bb17c){if(!_0x1bb17c){throw new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))]('no\x20available\x20attributes');}_0x39d523=_[_0x34aa('0x83')](_[_0x34aa('0x4a')](_0x1bb17c),[_0x34aa('0x82'),_0x34aa('0x84'),_0x34aa('0x85'),'ListId']);if(_0x3f0f6f[_0x34aa('0x55')]['id']){delete _0x3f0f6f[_0x34aa('0x55')]['id'];}if(_[_0x34aa('0x6d')](_0x3f0f6f[_0x34aa('0x55')][_0x34aa('0x87')])){throw _0x467026[_0x34aa('0x1e')](0x1f4)[_0x34aa('0x2d')](new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x3f0f6f[_0x34aa('0x55')][_0x34aa('0x55')])||_0x3f0f6f[_0x34aa('0x55')][_0x34aa('0x55')]===''){throw _0x467026[_0x34aa('0x1e')](0x1f4)[_0x34aa('0x2d')](new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))](_0x34aa('0x89')));}if(_['isNil'](_0x3f0f6f[_0x34aa('0x55')]['mapKeyOffline'])){throw _0x467026['status'](0x1f4)[_0x34aa('0x2d')](new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))](_0x34aa('0xbc')+_0x39d523));}if(!_['includes'](_0x39d523,_0x3f0f6f[_0x34aa('0x55')][_0x34aa('0xbd')])){throw _0x467026['status'](0x1f4)[_0x34aa('0x2d')](new db[(_0x34aa('0x80'))][(_0x34aa('0x81'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x39d523));}_0x85dd0c[_0x3f0f6f['body'][_0x34aa('0xbd')]]=_0x3f0f6f[_0x34aa('0x55')]['from'];})[_0x34aa('0x11')](function(){return db['ChatWebsite'][_0x34aa('0x52')]({'where':{'id':_0x3f0f6f[_0x34aa('0x48')]['id']},'include':[{'model':db['CmList'],'as':_0x34aa('0x8e')},{'model':db[_0x34aa('0xbe')],'as':'MailAccount'}]});})[_0x34aa('0x11')](handleEntityNotFound(_0x467026,null))['then'](function(_0x51214e){if(_0x51214e&&_0x51214e[_0x34aa('0x8e')]){_0x38435c=_0x51214e;var _0x1244ce=_[_0x34aa('0xbf')](_0x3f0f6f[_0x34aa('0x55')],{'firstName':_0x3f0f6f['body'][_0x34aa('0x87')],'phone':_0x3f0f6f[_0x34aa('0x55')]['from'],'ListId':_0x51214e[_0x34aa('0x86')]});_0x1244ce[_0x3f0f6f[_0x34aa('0x55')][_0x34aa('0xbd')]]=_0x3f0f6f['body'][_0x34aa('0x87')];return db[_0x34aa('0x7f')][_0x34aa('0xc0')]({'where':_0x85dd0c,'defaults':_0x1244ce});}})[_0x34aa('0xc1')](function(_0x3b911c){if(_0x3b911c){_0xa93072=_0x3b911c;var _0x3db2fa=fs[_0x34aa('0xc2')](path[_0x34aa('0x6f')](config['root'],_0x34aa('0xc3')),_0x34aa('0xc4'));var _0x3ced03=ejs[_0x34aa('0xc5')](_0x3db2fa,{'body':_[_0x34aa('0xc6')](_0x3f0f6f[_0x34aa('0x55')][_0x34aa('0x55')]),'bodyTitle':_0x38435c['offlineMessageBody']});return db[_0x34aa('0xc7')][_0x34aa('0x4d')]({'body':_0x3ced03,'plainBody':htmlToText['fromString'](_0x3ced03),'ContactId':_0x3b911c['id'],'ChatWebsiteId':_0x38435c['id']});}})[_0x34aa('0x11')](function(_0x2880df){_0x500000=_0x2880df;if(_0x477b4b[_0x34aa('0x4c')]){var _0xa817d6=_0x477b4b[_0x34aa('0x30')](function(_0x4c7913){return{'name':_0x4c7913[_0x34aa('0xc8')],'basename':_0x4c7913[_0x34aa('0x62')],'type':_0x4c7913['mimetype'],'ChatOfflineMessageId':_0x2880df['id']};});_0x1bbe74=_0xa817d6[_0x34aa('0x30')](_0x3a3a5e=>{var _0x292041={'filename':_0x3a3a5e[_0x34aa('0x2c')],'path':path['join'](config['root'],_0x34aa('0xc9'),'files',_0x34aa('0xca'),_0x34aa('0xcb'),_0x3a3a5e[_0x34aa('0xcc')])};return _0x292041;});if(!_0x38435c['openNewInteraction']){return db[_0x34aa('0xcd')][_0x34aa('0xce')](function(_0x1378a0){return db['Attachment'][_0x34aa('0xcf')](_0xa817d6,{'transaction':_0x1378a0});});}}})[_0x34aa('0x11')](function(){if(_0x500000){_0x1ac951=_0x500000;return db[_0x34aa('0xbe')][_0x34aa('0x5e')]({'where':{'active':!![]},'include':[{'model':db[_0x34aa('0xd0')],'as':_0x34aa('0xd1'),'raw':!![]}]});}})[_0x34aa('0x11')](function(_0xeabc88){if(_0xeabc88&&_0xeabc88[_0x34aa('0xd1')]&&_0x38435c[_0x34aa('0xd2')]&&_0x38435c[_0x34aa('0xd3')]){var _0x2c4f0c={'tls':{'rejectUnauthorized':![]}};if(_0xeabc88['Smtp'][_0x34aa('0xd4')]){_0x2c4f0c[_0x34aa('0xd4')]=_0xeabc88[_0x34aa('0xd1')][_0x34aa('0xd4')];}else{_0x2c4f0c[_0x34aa('0xd5')]=_0xeabc88[_0x34aa('0xd1')][_0x34aa('0xd5')];_0x2c4f0c['port']=_0xeabc88[_0x34aa('0xd1')]['port'];_0x2c4f0c[_0x34aa('0xd6')]=_0xeabc88[_0x34aa('0xd1')][_0x34aa('0xd6')];}if(_0xeabc88['Smtp'][_0x34aa('0xd7')]){_0x2c4f0c[_0x34aa('0xd8')]={'user':_0xeabc88[_0x34aa('0xd1')][_0x34aa('0x4e')],'pass':_0xeabc88[_0x34aa('0xd1')][_0x34aa('0xd9')]};}return respondWithRpcPromise(_0x34aa('0xda'),_0x34aa('0xdb'),{'account':_0x2c4f0c,'message':{'from':util[_0x34aa('0x9f')](_0x34aa('0xdc'),_0xeabc88[_0x34aa('0x2c')],_0xeabc88[_0x34aa('0xdd')]||_0xeabc88[_0x34aa('0xd1')]['user']),'to':_0x38435c[_0x34aa('0xd3')],'subject':_0x38435c[_0x34aa('0xde')],'html':_0x1ac951[_0x34aa('0x55')],'attachments':_0x1bbe74}},client9003)[_0x34aa('0x11')](function(){return _0x1ac951;})[_0x34aa('0x1c')](function(_0x4005e5){console[_0x34aa('0x17')](_0x4005e5);});}})[_0x34aa('0x11')](function(){if(_0x38435c&&_0x38435c['openNewInteraction']&&_0x38435c[_0x34aa('0xdf')]){var _0x45f98d=[];if(_0x477b4b[_0x34aa('0x4c')]){_0x45f98d=_0x477b4b[_0x34aa('0x30')](function(_0x87bbbd){return{'name':_0x87bbbd[_0x34aa('0xc8')],'basename':_0x87bbbd[_0x34aa('0x62')],'type':_0x87bbbd[_0x34aa('0xe0')],'ChatOfflineMessageId':_0x500000['id']};});}var _0x595728;if(!_['isNil'](_0x38435c['subjectOffline'])){var _0x58a664=_[_0x34aa('0x30')](_0x3f0f6f[_0x34aa('0x55')],function(_0xd6ebfe){return _0xd6ebfe;});var _0x202647=_['toPairsIn'](_0x58a664)[0x0];var _0x313356=_[_0x34aa('0xe1')](_0x202647,function(_0x5619b3){return _0x5619b3;});_0x595728=_0x313356[0x1][_0x38435c['subjectOffline']];}var _0x1b250f={'from':_0xa93072[_0x34aa('0xdd')],'firstName':_0xa93072[_0x34aa('0x9a')],'lastName':_0xa93072[_0x34aa('0x9b')],'mapKey':_0x34aa('0xdd'),'message':{'from':_0xa93072[_0x34aa('0xdd')],'to':_0x38435c[_0x34aa('0xbe')]['email'],'cc':'','subject':_['isNil'](_0x595728)?_0x38435c[_0x34aa('0xde')]:_0x595728,'messageId':'','sentAt':new Date(),'attach':_0x45f98d[_0x34aa('0x4c')],'attachments':_0x45f98d,'originChannel':_0x34aa('0xe2'),'ChatWebsiteId':_0x38435c['id'],'ChatOfflineMessageId':_0x1ac951['id'],'originTo':_0x38435c['MailAccount'][_0x34aa('0xdd')]},'body':_0x1ac951[_0x34aa('0x55')]};var _0x3f6b3f={'account':{'id':_0x38435c[_0x34aa('0xdf')]},'body':_0x1b250f,'log':_0x34aa('0xe3')};return respondWithRpcPromise(_0x34aa('0xe3'),_0x34aa('0xe4'),_0x3f6b3f,client9001)[_0x34aa('0x11')](function(){return _0x1ac951;})[_0x34aa('0x1c')](function(_0x207ab2){console['error'](_0x207ab2);});}return;})[_0x34aa('0x11')](function(){if(_0x1ac951){return _0x1ac951;}})[_0x34aa('0x11')](respondWithResult(_0x467026,null))['catch'](function(_0x1da5d4){console[_0x34aa('0x17')](_0x34aa('0x1c'),_0x1da5d4);for(var _0x4f99ff of _0x477b4b){var _0x1fca9d=path['join'](config[_0x34aa('0x6a')],_0x34aa('0xc9'),_0x34aa('0xbb'),_0x34aa('0xca'),_0x34aa('0xcb'),_0x4f99ff[_0x34aa('0x62')]);fs_extra[_0x34aa('0xe5')](_0x1fca9d)[_0x34aa('0x1c')](function(_0x2378a4){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x1fca9d,_0x2378a4);});}});};exports[_0x34aa('0xe6')]=function(_0x4bfb9a,_0x338ecc){return db['ChatInteraction'][_0x34aa('0x52')]({'where':{'id':_0x4bfb9a[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x338ecc,null))[_0x34aa('0x11')](function(_0x3c9163){if(_0x3c9163){return _0x3c9163[_0x34aa('0xe6')](_0x4bfb9a[_0x34aa('0x55')][_0x34aa('0x5b')],_[_0x34aa('0xe7')](_0x4bfb9a['body'],[_0x34aa('0x5b'),'id'])||{});}})[_0x34aa('0x11')](respondWithResult(_0x338ecc,null))['catch'](handleError(_0x338ecc,null));};exports[_0x34aa('0xe8')]=function(_0x4132e8,_0x335017){var _0x22793c={'raw':![],'where':{}};var _0x46295b={};var _0x3df1f7={'count':0x0,'rows':[]};return db[_0x34aa('0x41')][_0x34aa('0x5e')]({'where':{'id':_0x4132e8[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x335017,null))[_0x34aa('0x11')](function(_0x312a1a){if(_0x312a1a){_0x46295b['model']=_[_0x34aa('0x4a')](db[_0x34aa('0xa7')]['rawAttributes']);_0x46295b[_0x34aa('0x34')]=_[_0x34aa('0x4a')](_0x4132e8['query']);_0x46295b['filters']=_['intersection'](_0x46295b[_0x34aa('0x33')],_0x46295b['query']);_0x22793c[_0x34aa('0x37')]=_[_0x34aa('0x36')](_0x46295b[_0x34aa('0x33')],qs[_0x34aa('0x38')](_0x4132e8[_0x34aa('0x34')][_0x34aa('0x38')]));_0x22793c[_0x34aa('0x37')]=_0x22793c[_0x34aa('0x37')][_0x34aa('0x4c')]?_0x22793c[_0x34aa('0x37')]:_0x46295b['model'];if(!_0x4132e8['query'][_0x34aa('0x59')](_0x34aa('0x39'))){_0x22793c[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x4132e8[_0x34aa('0x34')][_0x34aa('0x23')]);_0x22793c['offset']=qs[_0x34aa('0x21')](_0x4132e8[_0x34aa('0x34')][_0x34aa('0x21')]);}_0x22793c[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0x4132e8['query'][_0x34aa('0x3b')]);_0x22793c[_0x34aa('0x3c')]=qs[_0x34aa('0x35')](_['pick'](_0x4132e8['query'],_0x46295b['filters']));_0x22793c['where'][_0x34aa('0x57')]=_0x312a1a['id'];if(_0x4132e8['query'][_0x34aa('0x3e')]){_0x22793c['where']=_['merge'](_0x22793c[_0x34aa('0x3c')],{'$or':_[_0x34aa('0x30')](_0x22793c['attributes'],function(_0x597b31){var _0x373099={};_0x373099[_0x597b31]={'$like':'%'+_0x4132e8[_0x34aa('0x34')][_0x34aa('0x3e')]+'%'};return _0x373099;})});}_0x22793c=_[_0x34aa('0x3f')]({},_0x22793c,_0x4132e8[_0x34aa('0x40')]);return db[_0x34aa('0xa7')][_0x34aa('0x42')]({'where':_0x22793c[_0x34aa('0x3c')]})[_0x34aa('0x11')](function(_0x262af3){_0x3df1f7[_0x34aa('0x42')]=_0x262af3;if(_0x4132e8['query'][_0x34aa('0x43')]){_0x22793c[_0x34aa('0x44')]=[{'model':db[_0x34aa('0x7f')],'as':_0x34aa('0xe9'),'required':![]},{'model':db[_0x34aa('0xb1')],'as':'Owner','attributes':[_0x34aa('0x2c'),_0x34aa('0xea'),'internal'],'required':![]},{'model':db[_0x34aa('0xeb')],'as':'Tags','attributes':['id','name','color'],'where':_0x4132e8[_0x34aa('0x34')][_0x34aa('0xec')]?{'id':_0x4132e8[_0x34aa('0x34')][_0x34aa('0xec')]}:undefined,'required':_0x4132e8[_0x34aa('0x34')][_0x34aa('0xec')]?!![]:![]}];}return db[_0x34aa('0xa7')]['findAll'](_0x22793c);})[_0x34aa('0x11')](function(_0x3fb7d8){_0x3df1f7[_0x34aa('0x46')]=_0x3fb7d8;return _0x3df1f7;});}})[_0x34aa('0x11')](respondWithFilteredResult(_0x335017,_0x22793c))[_0x34aa('0x1c')](handleError(_0x335017,null));};function iftimePromise(_0x125a13,_0x1b7be0){return respondWithRpcPromise(_0x34aa('0xed'),_0x34aa('0xee'),{'command':_0x1b7be0[_0x34aa('0xef')]?util[_0x34aa('0x9f')](_0x34aa('0xf0'),_0x125a13[_0x34aa('0xf1')],_0x1b7be0['timezone']):util[_0x34aa('0x9f')](_0x34aa('0xf2'),_0x125a13['interval'])},client9002)[_0x34aa('0x11')](function(_0x15fc2c){var _0x1704f4=_0x15fc2c&&_0x15fc2c[_0x34aa('0xf3')](_0x34aa('0xf4'))>=0x0?!![]:![];logger[_0x34aa('0x12')](_0x34aa('0xf5'),_0x1b7be0['id'],_0x125a13['id'],_0x125a13[_0x34aa('0xf1')],_0x1704f4?_0x34aa('0xf6'):_0x34aa('0xf7'),_0x1b7be0[_0x34aa('0xef')]?_0x1b7be0['timezone']:'No\x20timezone');return _0x1704f4;})[_0x34aa('0x1c')](function(_0x5c371a){logger['error'](_0x34aa('0xf5'),_0x1b7be0['id'],_0x125a13['id'],_0x125a13[_0x34aa('0xf1')],util[_0x34aa('0xf8')](_0x5c371a,{'showHidden':![],'depth':null}),_0x1b7be0[_0x34aa('0xef')]?_0x1b7be0['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x279232,_0x557bfb){var _0xb54bbf=0x0;var _0x3c79c0=0x0;var _0x34620d=![];var _0x56f2d1;var _0x497567;return db[_0x34aa('0x41')]['find']({'where':{'id':_0x279232[_0x34aa('0x48')]['id']},'include':[{'model':db[_0x34aa('0xf9')],'as':_0x34aa('0xf9'),'include':[{'model':db[_0x34aa('0xf9')],'as':_0x34aa('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x557bfb,null))[_0x34aa('0x11')](function(_0x1d462c){if(_0x1d462c){_0x56f2d1=_0x1d462c;return _0x1d462c[_0x34aa('0xfb')]({'raw':!![]});}})[_0x34aa('0x11')](function(_0x45b96e){if(_0x56f2d1){if(_0x45b96e){_0x497567=_0x45b96e;}}return require(_0x34aa('0xfc'))[_0x34aa('0x6c')]();})[_0x34aa('0x11')](function(_0xf508c6){if(_0xf508c6){_0x3c79c0=_0xf508c6[_0x34aa('0xfd')];_0x34620d=_0xf508c6[_0x34aa('0xfe')];}})[_0x34aa('0x11')](function(){return db['ChatInteraction'][_0x34aa('0x42')]({'where':{'closed':![]}});})['then'](function(_0x236382){_0xb54bbf=_0x236382;if(_0x3c79c0&&_0x236382>_0x3c79c0){return db['License'][_0x34aa('0x5e')]({'where':{'id':0x1}})[_0x34aa('0x11')](function(_0x161366){if(_0x161366){_0x161366['increment'](_0x34aa('0xff'));}});}})[_0x34aa('0x11')](function(){if(_0x56f2d1[_0x34aa('0xf9')]&&_0x56f2d1[_0x34aa('0xf9')][_0x34aa('0xfa')]){var _0x33e31a=[];for(var _0x5aa90d=0x0;_0x5aa90d<_0x56f2d1[_0x34aa('0xf9')]['Intervals'][_0x34aa('0x4c')];_0x5aa90d++){var _0x273f41=_0x56f2d1[_0x34aa('0xf9')][_0x34aa('0xfa')][_0x5aa90d][_0x34aa('0x28')]({'plain':!![]});_0x33e31a[_0x34aa('0xac')](iftimePromise(_0x273f41,_0x56f2d1));}return BPromise['all'](_0x33e31a)[_0x34aa('0x11')](function(_0x28614f){return _[_0x34aa('0x100')](_0x28614f);});}else{return!![];}})['then'](function(_0x369e06){var _0x561652=fs['readFileSync'](path[_0x34aa('0x6f')](config[_0x34aa('0x6a')],_0x34aa('0x101')),'utf8');var _0x21b8a0={'remote':_0x56f2d1[_0x34aa('0x102')],'query':querystring[_0x34aa('0x16')](_[_0x34aa('0x3f')](_0x56f2d1[_0x34aa('0x28')]({'plain':!![]}),{'customerIp':_0x279232[_0x34aa('0x7c')][_0x34aa('0x99')]||_0x279232['headers']['x-real-ip']||_0x279232[_0x34aa('0x103')][_0x34aa('0x104')]||_0x279232['ip'],'referer':_0x279232['headers']['referer'],'openedInteractions':_0xb54bbf,'maxInteractions':_0x3c79c0,'virtual':_0x34620d[_0x34aa('0xfd')],'online':_0x369e06,'custom':_0x34620d}))[_0x34aa('0x105')](/'/g,'\x5c\x27')};_0x557bfb[_0x34aa('0x2d')](ejs['render'](Mustache[_0x34aa('0xc5')](_0x561652,_0x21b8a0),{'proactiveActions':_0x497567,'alignment':_0x56f2d1['alignment'],'verticalAlignment':_0x56f2d1[_0x34aa('0x106')],'div_color':_0x56f2d1['color'],'labelText':_0x56f2d1['labelText'],'text_color':_0x56f2d1[_0x34aa('0x107')],'button_color':_0x56f2d1[_0x34aa('0x108')],'background_color':_0x56f2d1['backgroundColor'],'hideWhenOffline':_0x56f2d1[_0x34aa('0x109')],'interval':_0x56f2d1[_0x34aa('0x10a')]}));})[_0x34aa('0x1c')](handleError(_0x557bfb,null));};exports[_0x34aa('0x10b')]=function(_0x2b8a7b,_0x3b14e7){var _0x54e976=_0x2b8a7b[_0x34aa('0x48')]['id'];var _0x1d8f53=_0x2b8a7b[_0x34aa('0x55')];var _0x15a7b9=0xc8;var _0x350dea=null;return db[_0x34aa('0xcd')]['transaction']({'isolationLevel':db[_0x34aa('0xcd')][_0x34aa('0x10c')][_0x34aa('0x10d')][_0x34aa('0x10e')]},function(_0x5e7208){return db['ChatWebsite'][_0x34aa('0x5e')]({'where':{'id':_0x54e976},'transaction':_0x5e7208})[_0x34aa('0x11')](function(_0x52bdbb){if(_0x52bdbb){return db[_0x34aa('0x10f')][_0x34aa('0x27')]({'where':{'ChatWebsiteId':_0x54e976},'transaction':_0x5e7208})['then'](function(){var _0x44a96e=_[_0x34aa('0x30')](_0x1d8f53,function(_0x260f08){_0x260f08[_0x34aa('0x57')]=_0x54e976;return _0x260f08;});return db[_0x34aa('0x10f')]['bulkCreate'](_0x44a96e,{'transaction':_0x5e7208});});}else{_0x15a7b9=0x194;_0x350dea=[];}});})[_0x34aa('0x11')](function(){if(_0x15a7b9!==0x194){return db[_0x34aa('0x10f')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x54e976},'order':'priority'})[_0x34aa('0x11')](function(_0x3b3161){_0x350dea=_0x3b3161;});}})[_0x34aa('0x1c')](function(_0x25f3b6){_0x15a7b9=0x1f4;logger[_0x34aa('0x17')](_0x25f3b6[_0x34aa('0x2b')]);if(_0x25f3b6[_0x34aa('0x2c')]){delete _0x25f3b6[_0x34aa('0x2c')];}_0x350dea=_0x25f3b6;})[_0x34aa('0x110')](function(){if(_0x350dea===null){_0x3b14e7[_0x34aa('0x1d')](_0x15a7b9);}else{if(_0x15a7b9===0x1f4){_0x3b14e7['status'](_0x15a7b9)[_0x34aa('0x2d')](_0x350dea);}else{_0x3b14e7[_0x34aa('0x1e')](_0x15a7b9)['json'](_0x350dea);}}});};exports[_0x34aa('0x111')]=function(_0x4146ef,_0x5aaaf1){var _0xef088d={};var _0x192f0f={};var _0x1db1e5;var _0x2fd7dc;return db[_0x34aa('0x41')]['findOne']({'where':{'id':_0x4146ef['params']['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x5aaaf1,null))[_0x34aa('0x11')](function(_0x21dfb5){if(_0x21dfb5){_0x1db1e5=_0x21dfb5;_0x192f0f[_0x34aa('0x33')]=_[_0x34aa('0x4a')](db[_0x34aa('0x10f')]['rawAttributes']);_0x192f0f[_0x34aa('0x34')]=_[_0x34aa('0x4a')](_0x4146ef[_0x34aa('0x34')]);_0x192f0f[_0x34aa('0x35')]=_[_0x34aa('0x36')](_0x192f0f['model'],_0x192f0f[_0x34aa('0x34')]);_0xef088d[_0x34aa('0x37')]=_[_0x34aa('0x36')](_0x192f0f[_0x34aa('0x33')],qs[_0x34aa('0x38')](_0x4146ef[_0x34aa('0x34')][_0x34aa('0x38')]));_0xef088d[_0x34aa('0x37')]=_0xef088d[_0x34aa('0x37')]['length']?_0xef088d['attributes']:_0x192f0f[_0x34aa('0x33')];_0xef088d[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0x4146ef[_0x34aa('0x34')][_0x34aa('0x3b')]);_0xef088d[_0x34aa('0x3c')]=qs[_0x34aa('0x35')](_[_0x34aa('0x3d')](_0x4146ef[_0x34aa('0x34')],_0x192f0f[_0x34aa('0x35')]));if(_0x4146ef['query'][_0x34aa('0x3e')]){_0xef088d[_0x34aa('0x3c')]=_[_0x34aa('0x3f')](_0xef088d[_0x34aa('0x3c')],{'$or':_['map'](_0xef088d[_0x34aa('0x37')],function(_0x336739){var _0x19b0c4={};_0x19b0c4[_0x336739]={'$like':'%'+_0x4146ef['query'][_0x34aa('0x3e')]+'%'};return _0x19b0c4;})});}_0xef088d=_[_0x34aa('0x3f')]({},_0xef088d,_0x4146ef[_0x34aa('0x40')]);return _0x1db1e5['getApplications'](_0xef088d);}})[_0x34aa('0x11')](function(_0x46ab46){if(_0x46ab46){_0x2fd7dc=_0x46ab46[_0x34aa('0x4c')];if(!_0x4146ef[_0x34aa('0x34')]['hasOwnProperty']('nolimit')){_0xef088d[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x4146ef[_0x34aa('0x34')][_0x34aa('0x23')]);_0xef088d[_0x34aa('0x21')]=qs[_0x34aa('0x21')](_0x4146ef[_0x34aa('0x34')][_0x34aa('0x21')]);}return _0x1db1e5['getApplications'](_0xef088d);}})[_0x34aa('0x11')](function(_0x4af919){if(_0x4af919){return _0x4af919?{'count':_0x2fd7dc,'rows':_0x4af919}:null;}})[_0x34aa('0x11')](respondWithResult(_0x5aaaf1,null))[_0x34aa('0x1c')](handleError(_0x5aaaf1,null));};exports['addProactiveActions']=function(_0x294a67,_0x51f796){return db[_0x34aa('0x112')]['find']({'where':{'id':_0x294a67[_0x34aa('0x48')]['id']}})['then'](handleEntityNotFound(_0x51f796,null))[_0x34aa('0x11')](function(_0xf72321){if(_0xf72321){return _0xf72321[_0x34aa('0x113')](_0x294a67[_0x34aa('0x55')][_0x34aa('0x5b')],_[_0x34aa('0xe7')](_0x294a67['body'],['ids','id'])||{});}})[_0x34aa('0x11')](respondWithResult(_0x51f796,null))[_0x34aa('0x1c')](handleError(_0x51f796,null));};exports[_0x34aa('0xfb')]=function(_0x44468c,_0x4e55dc){var _0x22e828={};var _0xdca8ec={};var _0x1a7ab3;var _0x156785;return db['ChatWebsite'][_0x34aa('0x5e')]({'where':{'id':_0x44468c[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x4e55dc,null))['then'](function(_0xd116b7){if(_0xd116b7){_0x1a7ab3=_0xd116b7;_0xdca8ec[_0x34aa('0x33')]=_[_0x34aa('0x4a')](db[_0x34aa('0x114')]['rawAttributes']);_0xdca8ec[_0x34aa('0x34')]=_[_0x34aa('0x4a')](_0x44468c['query']);_0xdca8ec['filters']=_[_0x34aa('0x36')](_0xdca8ec[_0x34aa('0x33')],_0xdca8ec[_0x34aa('0x34')]);_0x22e828[_0x34aa('0x37')]=_[_0x34aa('0x36')](_0xdca8ec[_0x34aa('0x33')],qs[_0x34aa('0x38')](_0x44468c['query'][_0x34aa('0x38')]));_0x22e828['attributes']=_0x22e828[_0x34aa('0x37')][_0x34aa('0x4c')]?_0x22e828[_0x34aa('0x37')]:_0xdca8ec[_0x34aa('0x33')];_0x22e828[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0x44468c[_0x34aa('0x34')][_0x34aa('0x3b')]);_0x22e828[_0x34aa('0x3c')]=qs['filters'](_[_0x34aa('0x3d')](_0x44468c['query'],_0xdca8ec[_0x34aa('0x35')]));if(_0x44468c['query'][_0x34aa('0x3e')]){_0x22e828[_0x34aa('0x3c')]=_[_0x34aa('0x3f')](_0x22e828['where'],{'$or':_[_0x34aa('0x30')](_0x22e828[_0x34aa('0x37')],function(_0x4cf68f){var _0x21efd0={};_0x21efd0[_0x4cf68f]={'$like':'%'+_0x44468c[_0x34aa('0x34')][_0x34aa('0x3e')]+'%'};return _0x21efd0;})});}_0x22e828=_[_0x34aa('0x3f')]({},_0x22e828,_0x44468c[_0x34aa('0x40')]);return _0x1a7ab3[_0x34aa('0xfb')](_0x22e828);}})['then'](function(_0x14ae50){if(_0x14ae50){_0x156785=_0x14ae50[_0x34aa('0x4c')];if(!_0x44468c[_0x34aa('0x34')]['hasOwnProperty'](_0x34aa('0x39'))){_0x22e828[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x44468c[_0x34aa('0x34')][_0x34aa('0x23')]);_0x22e828[_0x34aa('0x21')]=qs[_0x34aa('0x21')](_0x44468c[_0x34aa('0x34')][_0x34aa('0x21')]);}return _0x1a7ab3[_0x34aa('0xfb')](_0x22e828);}})['then'](function(_0x26d833){if(_0x26d833){return _0x26d833?{'count':_0x156785,'rows':_0x26d833}:null;}})['then'](respondWithResult(_0x4e55dc,null))[_0x34aa('0x1c')](handleError(_0x4e55dc,null));};exports['getFields']=function(_0x421c8e,_0x1d7ffc){var _0x5c0da2=_0x421c8e[_0x34aa('0x34')]['online']===_0x34aa('0x115')?_0x34aa('0x116'):_0x34aa('0x117');return db[_0x34aa('0x41')]['find']({'attributes':['id',_0x5c0da2],'where':{'id':_0x421c8e[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x1d7ffc,null))[_0x34aa('0x11')](function(_0x393b06){if(_0x393b06){var _0x4614b8=_0x393b06[_0x5c0da2];var _0x4ff994=_0x4614b8&&_0x4614b8[_0x34aa('0x118')]?_0x4614b8[_0x34aa('0x118')]:[];_0x1d7ffc['send']({'fromKey':_[_0x34aa('0x6d')](_0x4614b8[_0x34aa('0x119')])?undefined:_0x4614b8[_0x34aa('0x119')],'count':_0x4ff994[_0x34aa('0x4c')],'rows':_0x4ff994});}})[_0x34aa('0x1c')](handleError(_0x1d7ffc,null));};exports[_0x34aa('0x11a')]=function(_0x48062a,_0x2917d2){var _0x43bebe={'raw':![],'where':{}};var _0x4cf187={};var _0x23b8a3={'count':0x0,'rows':[]};return db[_0x34aa('0x41')][_0x34aa('0x5e')]({'where':{'id':_0x48062a[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x2917d2,null))[_0x34aa('0x11')](function(_0x3532ef){if(_0x3532ef){_0x4cf187['model']=_[_0x34aa('0x4a')](db['ChatOfflineMessage'][_0x34aa('0x4b')]);_0x4cf187[_0x34aa('0x34')]=_[_0x34aa('0x4a')](_0x48062a[_0x34aa('0x34')]);_0x4cf187[_0x34aa('0x35')]=_[_0x34aa('0x36')](_0x4cf187[_0x34aa('0x33')],_0x4cf187[_0x34aa('0x34')]);_0x43bebe[_0x34aa('0x37')]=_['intersection'](_0x4cf187[_0x34aa('0x33')],qs[_0x34aa('0x38')](_0x48062a['query'][_0x34aa('0x38')]));_0x43bebe['attributes']=_0x43bebe[_0x34aa('0x37')]['length']?_0x43bebe[_0x34aa('0x37')]:_0x4cf187[_0x34aa('0x33')];if(!_0x48062a[_0x34aa('0x34')][_0x34aa('0x59')]('nolimit')){_0x43bebe[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x48062a[_0x34aa('0x34')][_0x34aa('0x23')]);_0x43bebe[_0x34aa('0x21')]=qs['offset'](_0x48062a[_0x34aa('0x34')]['offset']);}_0x43bebe['order']=qs['sort'](_0x48062a[_0x34aa('0x34')][_0x34aa('0x3b')]);_0x43bebe[_0x34aa('0x3c')]=qs[_0x34aa('0x35')](_[_0x34aa('0x3d')](_0x48062a[_0x34aa('0x34')],_0x4cf187['filters']));_0x43bebe['where'][_0x34aa('0x57')]=_0x3532ef['id'];if(_0x48062a['query'][_0x34aa('0x3e')]){_0x43bebe[_0x34aa('0x3c')]=_[_0x34aa('0x3f')](_0x43bebe[_0x34aa('0x3c')],{'$or':_[_0x34aa('0x30')](_0x43bebe['attributes'],function(_0x236d65){var _0x543386={};_0x543386[_0x236d65]={'$like':'%'+_0x48062a[_0x34aa('0x34')][_0x34aa('0x3e')]+'%'};return _0x543386;})});}_0x43bebe=_[_0x34aa('0x3f')]({},_0x43bebe,_0x48062a[_0x34aa('0x40')]);return db[_0x34aa('0xc7')][_0x34aa('0x42')]({'where':_0x43bebe['where']})[_0x34aa('0x11')](function(_0x329ebe){_0x23b8a3[_0x34aa('0x42')]=_0x329ebe;if(_0x48062a[_0x34aa('0x34')][_0x34aa('0x43')]){_0x43bebe[_0x34aa('0x44')]=[{'all':!![]}];}else{_0x43bebe[_0x34aa('0x44')]=[{'model':db[_0x34aa('0x7f')],'as':_0x34aa('0xe9'),'required':![]},{'model':db[_0x34aa('0x11b')],'as':'Attachments','required':![]}];}return db[_0x34aa('0xc7')][_0x34aa('0x45')](_0x43bebe);})[_0x34aa('0x11')](function(_0x15f78e){_0x23b8a3[_0x34aa('0x46')]=_0x15f78e;return _0x23b8a3;});}})[_0x34aa('0x11')](respondWithFilteredResult(_0x2917d2,_0x43bebe))[_0x34aa('0x1c')](handleError(_0x2917d2,null));};exports['addAgents']=function(_0x136d5d,_0x152528){return db[_0x34aa('0x41')][_0x34aa('0x52')]({'where':{'id':_0x136d5d['params']['id']}})['then'](handleEntityNotFound(_0x152528,null))[_0x34aa('0x11')](function(_0x165ddf){if(_0x165ddf){return _0x165ddf[_0x34aa('0x11c')](_0x136d5d[_0x34aa('0x55')][_0x34aa('0x5b')],_[_0x34aa('0xe7')](_0x136d5d[_0x34aa('0x55')],['ids','id'])||{})['spread'](function(_0x243df8){for(var _0x27f76f=0x0;_0x27f76f<_0x136d5d[_0x34aa('0x55')][_0x34aa('0x5b')][_0x34aa('0x4c')];_0x27f76f+=0x1){socket[_0x34aa('0x11d')](_0x34aa('0x11e'),{'UserId':Number(_0x136d5d[_0x34aa('0x55')]['ids'][_0x27f76f]),'ChatWebsiteId':Number(_0x136d5d['params']['id'])});}return _0x243df8;});}})[_0x34aa('0x11')](respondWithResult(_0x152528,null))[_0x34aa('0x1c')](handleError(_0x152528,null));};exports[_0x34aa('0x11f')]=function(_0x2f766b,_0x22611d){return db['ChatWebsite'][_0x34aa('0x52')]({'where':{'id':_0x2f766b[_0x34aa('0x48')]['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x22611d,null))['then'](function(_0x1b39ee){if(_0x1b39ee){return _0x1b39ee['removeAgents'](_0x2f766b[_0x34aa('0x34')][_0x34aa('0x5b')])['then'](function(){if(_[_0x34aa('0x120')](_0x2f766b['query']['ids'])){for(var _0x2ec732=0x0;_0x2ec732<_0x2f766b[_0x34aa('0x34')][_0x34aa('0x5b')][_0x34aa('0x4c')];_0x2ec732+=0x1){socket['emit'](_0x34aa('0x121'),{'UserId':Number(_0x2f766b['query'][_0x34aa('0x5b')][_0x2ec732]),'ChatWebsiteId':Number(_0x2f766b[_0x34aa('0x48')]['id'])});}}else{socket[_0x34aa('0x11d')](_0x34aa('0x121'),{'UserId':Number(_0x2f766b[_0x34aa('0x34')]['ids']),'ChatWebsiteId':Number(_0x2f766b[_0x34aa('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x22611d,null))['catch'](handleError(_0x22611d,null));};exports[_0x34aa('0x122')]=function(_0x589177,_0x4a2510){var _0x632761={};var _0x236888={};var _0x5e71ff;var _0x397dcd;return db[_0x34aa('0x41')]['findOne']({'where':{'id':_0x589177['params']['id']}})[_0x34aa('0x11')](handleEntityNotFound(_0x4a2510,null))['then'](function(_0x400a20){if(_0x400a20){_0x5e71ff=_0x400a20;_0x236888['model']=_[_0x34aa('0x4a')](db[_0x34aa('0xb1')]['rawAttributes']);_0x236888[_0x34aa('0x34')]=_[_0x34aa('0x4a')](_0x589177[_0x34aa('0x34')]);_0x236888[_0x34aa('0x35')]=_[_0x34aa('0x36')](_0x236888[_0x34aa('0x33')],_0x236888[_0x34aa('0x34')]);_0x632761[_0x34aa('0x37')]=_['intersection'](_0x236888[_0x34aa('0x33')],qs['fields'](_0x589177[_0x34aa('0x34')][_0x34aa('0x38')]));_0x632761['attributes']=_0x632761[_0x34aa('0x37')][_0x34aa('0x4c')]?_0x632761[_0x34aa('0x37')]:_0x236888['model'];_0x632761[_0x34aa('0x3a')]=qs[_0x34aa('0x3b')](_0x589177[_0x34aa('0x34')][_0x34aa('0x3b')]);_0x632761[_0x34aa('0x3c')]=qs['filters'](_[_0x34aa('0x3d')](_0x589177[_0x34aa('0x34')],_0x236888['filters']));if(_0x589177[_0x34aa('0x34')]['filter']){_0x632761[_0x34aa('0x3c')]=_[_0x34aa('0x3f')](_0x632761[_0x34aa('0x3c')],{'$or':_[_0x34aa('0x30')](_0x632761[_0x34aa('0x37')],function(_0x482b81){var _0x1b3ad5={};_0x1b3ad5[_0x482b81]={'$like':'%'+_0x589177[_0x34aa('0x34')][_0x34aa('0x3e')]+'%'};return _0x1b3ad5;})});}_0x632761=_[_0x34aa('0x3f')]({},_0x632761,_0x589177[_0x34aa('0x40')]);return _0x5e71ff[_0x34aa('0x122')](_0x632761);}})[_0x34aa('0x11')](function(_0x2635ff){if(_0x2635ff){_0x397dcd=_0x2635ff[_0x34aa('0x4c')];if(!_0x589177[_0x34aa('0x34')]['hasOwnProperty'](_0x34aa('0x39'))){_0x632761[_0x34aa('0x23')]=qs[_0x34aa('0x23')](_0x589177['query']['limit']);_0x632761['offset']=qs['offset'](_0x589177['query'][_0x34aa('0x21')]);}return _0x5e71ff['getAgents'](_0x632761);}})[_0x34aa('0x11')](function(_0x21fbfa){if(_0x21fbfa){return _0x21fbfa?{'count':_0x397dcd,'rows':_0x21fbfa}:null;}})[_0x34aa('0x11')](respondWithResult(_0x4a2510,null))[_0x34aa('0x1c')](handleError(_0x4a2510,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 38b5eb6..69aa617 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 _0xa22a=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xa22a,0x153));var _0xaa22=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa22a[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xaa22('0x0'));var ChatWebsite=require(_0xaa22('0x1'))['db'][_0xaa22('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xaa22('0x3')](0x0);var events={'afterCreate':_0xaa22('0x4'),'afterUpdate':'update','afterDestroy':_0xaa22('0x5')};function emitEvent(_0x280c73){return function(_0x1912a3,_0x454829,_0xc8f622){ChatWebsiteEvents[_0xaa22('0x6')](_0x280c73+':'+_0x1912a3['id'],_0x1912a3);ChatWebsiteEvents['emit'](_0x280c73,_0x1912a3);_0xc8f622(null);};}for(var e in events){if(events[_0xaa22('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xaa22('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x142c=['setMaxListeners','save','remove','emit','hook','exports','events','ChatWebsite'];(function(_0x24f69b,_0x432b8f){var _0x272ad6=function(_0x1b529a){while(--_0x1b529a){_0x24f69b['push'](_0x24f69b['shift']());}};_0x272ad6(++_0x432b8f);}(_0x142c,0x86));var _0xc142=function(_0x4825bf,_0x2e42fa){_0x4825bf=_0x4825bf-0x0;var _0x6de463=_0x142c[_0x4825bf];return _0x6de463;};'use strict';var EventEmitter=require(_0xc142('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xc142('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc142('0x2')](0x0);var events={'afterCreate':_0xc142('0x3'),'afterUpdate':'update','afterDestroy':_0xc142('0x4')};function emitEvent(_0x3d66ef){return function(_0x4fa56e,_0x47e43a,_0x110b14){ChatWebsiteEvents['emit'](_0x3d66ef+':'+_0x4fa56e['id'],_0x4fa56e);ChatWebsiteEvents[_0xc142('0x5')](_0x3d66ef,_0x4fa56e);_0x110b14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc142('0x6')](e,emitEvent(event));}}module[_0xc142('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 49fb475..5668d6f 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 _0xb71e=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x2dd299,_0x30537b){var _0x554490=function(_0x3c5118){while(--_0x3c5118){_0x2dd299['push'](_0x2dd299['shift']());}};_0x554490(++_0x30537b);}(_0xb71e,0x1ac));var _0xeb71=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xb71e[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0xeb71('0x0'));var util=require(_0xeb71('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb71('0x2'));var BPromise=require(_0xeb71('0x3'));var rp=require(_0xeb71('0x4'));var fs=require('fs');var path=require(_0xeb71('0x5'));var rimraf=require(_0xeb71('0x6'));var config=require(_0xeb71('0x7'));var attributes=require(_0xeb71('0x8'));module[_0xeb71('0x9')]=function(_0x51a35b,_0x1aad97){return _0x51a35b[_0xeb71('0xa')](_0xeb71('0xb'),attributes,{'tableName':_0xeb71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3e0=['chat_websites','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x3b22ee,_0x53cb84){var _0x5e712e=function(_0x3294bd){while(--_0x3294bd){_0x3b22ee['push'](_0x3b22ee['shift']());}};_0x5e712e(++_0x53cb84);}(_0xa3e0,0xeb));var _0x0a3e=function(_0x184a31,_0x6b315c){_0x184a31=_0x184a31-0x0;var _0x36db99=_0xa3e0[_0x184a31];return _0x36db99;};'use strict';var _=require(_0x0a3e('0x0'));var util=require(_0x0a3e('0x1'));var logger=require(_0x0a3e('0x2'))(_0x0a3e('0x3'));var moment=require('moment');var BPromise=require(_0x0a3e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a3e('0x5'));var rimraf=require(_0x0a3e('0x6'));var config=require(_0x0a3e('0x7'));var attributes=require(_0x0a3e('0x8'));module[_0x0a3e('0x9')]=function(_0x21f41d,_0x40f2d7){return _0x21f41d[_0x0a3e('0xa')](_0x0a3e('0xb'),attributes,{'tableName':_0x0a3e('0xc'),'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 65a98e5..6c98a86 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 _0xe1dd=['message','result','catch','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x43e692,_0x40d756){var _0x2674e2=function(_0x406a94){while(--_0x406a94){_0x43e692['push'](_0x43e692['shift']());}};_0x2674e2(++_0x40d756);}(_0xe1dd,0xfd));var _0xde1d=function(_0x18b033,_0x5ef12a){_0x18b033=_0x18b033-0x0;var _0x2d38b8=_0xe1dd[_0x18b033];return _0x2d38b8;};'use strict';var _=require(_0xde1d('0x0'));var util=require('util');var moment=require(_0xde1d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde1d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xde1d('0x3'));var logger=require('../../config/logger')(_0xde1d('0x4'));var config=require(_0xde1d('0x5'));var jayson=require(_0xde1d('0x6'));var client=jayson[_0xde1d('0x7')][_0xde1d('0x8')]({'port':0x232a});config[_0xde1d('0x9')]=_['defaults'](config[_0xde1d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xde1d('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xde1d('0xb')](socket);function respondWithRpcPromise(_0x7922b5,_0x62cd49,_0xcceda5){return new BPromise(function(_0x20de16,_0x41f853){return client[_0xde1d('0xc')](_0x7922b5,_0xcceda5)[_0xde1d('0xd')](function(_0xd86290){logger[_0xde1d('0xe')](_0xde1d('0xf'),_0x62cd49,_0xde1d('0x10'));logger[_0xde1d('0x11')](_0xde1d('0x12'),_0x62cd49,'request\x20sent',JSON[_0xde1d('0x13')](_0xd86290));if(_0xd86290[_0xde1d('0x14')]){if(_0xd86290[_0xde1d('0x14')][_0xde1d('0x15')]===0x1f4){logger['error'](_0xde1d('0xf'),_0x62cd49,_0xd86290['error'][_0xde1d('0x16')]);return _0x41f853(_0xd86290[_0xde1d('0x14')]['message']);}logger['error'](_0xde1d('0xf'),_0x62cd49,_0xd86290['error'][_0xde1d('0x16')]);return _0x20de16(_0xd86290[_0xde1d('0x14')][_0xde1d('0x16')]);}else{logger[_0xde1d('0xe')]('ChatWebsite,\x20%s,\x20%s',_0x62cd49,'request\x20sent');_0x20de16(_0xd86290[_0xde1d('0x17')][_0xde1d('0x16')]);}})[_0xde1d('0x18')](function(_0x501e45){logger['error'](_0xde1d('0xf'),_0x62cd49,_0x501e45);_0x41f853(_0x501e45);});});} \ No newline at end of file +var _0x9df3=['register','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x22bff1,_0x1d964a){var _0x279396=function(_0x2573c7){while(--_0x2573c7){_0x22bff1['push'](_0x22bff1['shift']());}};_0x279396(++_0x1d964a);}(_0x9df3,0x11a));var _0x39df=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x9df3[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x39df('0x0'));var util=require(_0x39df('0x1'));var moment=require(_0x39df('0x2'));var BPromise=require('bluebird');var rs=require(_0x39df('0x3'));var fs=require('fs');var Redis=require(_0x39df('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x39df('0x5'))(_0x39df('0x6'));var config=require(_0x39df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x39df('0x8')][_0x39df('0x9')]({'port':0x232a});config['redis']=_[_0x39df('0xa')](config[_0x39df('0xb')],{'host':_0x39df('0xc'),'port':0x18eb});var socket=require(_0x39df('0xd'))(new Redis(config[_0x39df('0xb')]));require(_0x39df('0xe'))[_0x39df('0xf')](socket);function respondWithRpcPromise(_0x1e2337,_0xe01181,_0xc2cd1){return new BPromise(function(_0x3d4e50,_0x28ac2f){return client[_0x39df('0x10')](_0x1e2337,_0xc2cd1)[_0x39df('0x11')](function(_0x5dc0d7){logger['info'](_0x39df('0x12'),_0xe01181,'request\x20sent');logger['debug'](_0x39df('0x13'),_0xe01181,_0x39df('0x14'),JSON[_0x39df('0x15')](_0x5dc0d7));if(_0x5dc0d7[_0x39df('0x16')]){if(_0x5dc0d7[_0x39df('0x16')][_0x39df('0x17')]===0x1f4){logger[_0x39df('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xe01181,_0x5dc0d7['error'][_0x39df('0x18')]);return _0x28ac2f(_0x5dc0d7[_0x39df('0x16')][_0x39df('0x18')]);}logger[_0x39df('0x16')](_0x39df('0x12'),_0xe01181,_0x5dc0d7[_0x39df('0x16')][_0x39df('0x18')]);return _0x3d4e50(_0x5dc0d7[_0x39df('0x16')][_0x39df('0x18')]);}else{logger['info'](_0x39df('0x12'),_0xe01181,_0x39df('0x14'));_0x3d4e50(_0x5dc0d7[_0x39df('0x19')][_0x39df('0x18')]);}})[_0x39df('0x1a')](function(_0x61cc4b){logger[_0x39df('0x16')](_0x39df('0x12'),_0xe01181,_0x61cc4b);_0x28ac2f(_0x61cc4b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 44fab6f..72ac968 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 _0x97a8=['length','chatWebsite:','remove','update','emit','removeListener','register'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x97a8,0x80));var _0x897a=function(_0x50c463,_0x493daf){_0x50c463=_0x50c463-0x0;var _0x26df7b=_0x97a8[_0x50c463];return _0x26df7b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x897a('0x0'),_0x897a('0x1')];function createListener(_0x16e8ef,_0x2d3a96){return function(_0x5be9b3){_0x2d3a96[_0x897a('0x2')](_0x16e8ef,_0x5be9b3);};}function removeListener(_0x51fb23,_0x2a140d){return function(){ChatWebsiteEvents[_0x897a('0x3')](_0x51fb23,_0x2a140d);};}exports[_0x897a('0x4')]=function(_0x206d08){for(var _0x5969c2=0x0,_0x395e32=events[_0x897a('0x5')];_0x5969c2<_0x395e32;_0x5969c2++){var _0x299260=events[_0x5969c2];var _0x2543f0=createListener(_0x897a('0x6')+_0x299260,_0x206d08);ChatWebsiteEvents['on'](_0x299260,_0x2543f0);}}; \ No newline at end of file +var _0x3e3e=['length','./chatWebsite.events','update','emit','register'];(function(_0x51f7e9,_0x3521ec){var _0x2ef4c8=function(_0x3d0567){while(--_0x3d0567){_0x51f7e9['push'](_0x51f7e9['shift']());}};_0x2ef4c8(++_0x3521ec);}(_0x3e3e,0x1f0));var _0xe3e3=function(_0x46d458,_0x120f47){_0x46d458=_0x46d458-0x0;var _0x7118c3=_0x3e3e[_0x46d458];return _0x7118c3;};'use strict';var ChatWebsiteEvents=require(_0xe3e3('0x0'));var events=['save','remove',_0xe3e3('0x1')];function createListener(_0x3f013d,_0x591fac){return function(_0x371de3){_0x591fac[_0xe3e3('0x2')](_0x3f013d,_0x371de3);};}function removeListener(_0x2ec4bc,_0x5dc2db){return function(){ChatWebsiteEvents['removeListener'](_0x2ec4bc,_0x5dc2db);};}exports[_0xe3e3('0x3')]=function(_0x284aa3){for(var _0x4354bc=0x0,_0x4da7fb=events[_0xe3e3('0x4')];_0x4354bc<_0x4da7fb;_0x4354bc++){var _0x41ea24=events[_0x4354bc];var _0x7829b8=createListener('chatWebsite:'+_0x41ea24,_0x284aa3);ChatWebsiteEvents['on'](_0x41ea24,_0x7829b8);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7f53c99..38a9acb 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 _0x7df4=['addLogo','root','server/files/images/avatars/','file','addAvatar','/:id/customer_avatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','replace','/:id/offline','any','offline','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','/:id/users','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','format','%s-%s','now','originalname'];(function(_0x48c790,_0x2dc331){var _0x3fb1b9=function(_0x271ed1){while(--_0x271ed1){_0x48c790['push'](_0x48c790['shift']());}};_0x3fb1b9(++_0x2dc331);}(_0x7df4,0x182));var _0x47df=function(_0x474241,_0xaa4c69){_0x474241=_0x474241-0x0;var _0x510a20=_0x7df4[_0x474241];return _0x510a20;};'use strict';var multer=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var path=require('path');var timeout=require(_0x47df('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x47df('0x3'));var auth=require(_0x47df('0x4'));var interaction=require(_0x47df('0x5'));var config=require('../../config/environment');var controller=require(_0x47df('0x6'));router[_0x47df('0x7')]('/',auth[_0x47df('0x8')](),controller[_0x47df('0x9')]);router['get'](_0x47df('0xa'),auth[_0x47df('0x8')](),controller[_0x47df('0xb')]);router['get'](_0x47df('0xc'),auth[_0x47df('0x8')](),controller[_0x47df('0xd')]);router[_0x47df('0x7')]('/:id/dispositions',auth[_0x47df('0x8')](),controller[_0x47df('0xe')]);router[_0x47df('0x7')](_0x47df('0xf'),auth[_0x47df('0x8')](),controller['getAnswers']);router['get'](_0x47df('0x10'),controller[_0x47df('0x11')]);router[_0x47df('0x7')](_0x47df('0x12'),controller[_0x47df('0x13')]);router['get']('/:id/customer_avatar',controller[_0x47df('0x14')]);router[_0x47df('0x7')](_0x47df('0x15'),controller[_0x47df('0x16')]);router[_0x47df('0x7')](_0x47df('0x17'),auth['isAuthenticated'](),controller[_0x47df('0x18')]);router[_0x47df('0x7')](_0x47df('0x19'),controller[_0x47df('0x1a')]);router[_0x47df('0x7')](_0x47df('0x1b'),auth[_0x47df('0x8')](),controller[_0x47df('0x1c')]);router[_0x47df('0x7')](_0x47df('0x1d'),auth[_0x47df('0x8')](),controller[_0x47df('0x1e')]);router[_0x47df('0x7')](_0x47df('0x1f'),controller[_0x47df('0x20')]);router[_0x47df('0x7')](_0x47df('0x21'),auth[_0x47df('0x8')](),controller[_0x47df('0x22')]);router['get']('/:id/users',auth[_0x47df('0x8')](),controller[_0x47df('0x23')]);router[_0x47df('0x24')]('/',auth[_0x47df('0x8')](),controller[_0x47df('0x25')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x47df('0x26')]);router[_0x47df('0x24')](_0x47df('0xf'),auth[_0x47df('0x8')](),controller[_0x47df('0x27')]);var upload=multer({'storage':multer[_0x47df('0x28')]({'destination':function(_0x13db9e,_0x2af8af,_0x1888c6){_0x1888c6(null,path[_0x47df('0x29')](config['root'],'server/files/images/logos/'));},'filename':function(_0x26de3e,_0x319b23,_0x276ae9){_0x276ae9(null,util[_0x47df('0x2a')](_0x47df('0x2b'),Date[_0x47df('0x2c')](),_0x319b23[_0x47df('0x2d')]));}})});router[_0x47df('0x24')](_0x47df('0x10'),upload['single']('file'),controller[_0x47df('0x2e')]);var upload=multer({'storage':multer[_0x47df('0x28')]({'destination':function(_0x35d61b,_0xa4c7f,_0x46f262){_0x46f262(null,path[_0x47df('0x29')](config[_0x47df('0x2f')],_0x47df('0x30')));},'filename':function(_0x1ef1f1,_0x37f00d,_0x256bea){_0x256bea(null,util['format'](_0x47df('0x2b'),Date[_0x47df('0x2c')](),_0x37f00d[_0x47df('0x2d')]));}})});router[_0x47df('0x24')](_0x47df('0x12'),upload['single'](_0x47df('0x31')),controller[_0x47df('0x32')]);var upload=multer({'storage':multer[_0x47df('0x28')]({'destination':function(_0x4526a7,_0x4f2620,_0x298685){_0x298685(null,path[_0x47df('0x29')](config[_0x47df('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x2c498d,_0x9113c,_0x63d332){_0x63d332(null,util[_0x47df('0x2a')]('%s-%s',Date['now'](),_0x9113c[_0x47df('0x2d')]));}})});router[_0x47df('0x24')](_0x47df('0x33'),upload[_0x47df('0x34')]('file'),controller[_0x47df('0x35')]);var upload=multer({'storage':multer[_0x47df('0x28')]({'destination':function(_0x1f74d2,_0x5775d6,_0x18254a){_0x18254a(null,path['join'](config[_0x47df('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x4481df,_0x2d4010,_0x5ec4a4){_0x5ec4a4(null,util[_0x47df('0x2a')](_0x47df('0x2b'),Date[_0x47df('0x2c')](),_0x2d4010[_0x47df('0x2d')]));}})});router[_0x47df('0x24')](_0x47df('0x15'),upload['single'](_0x47df('0x31')),controller[_0x47df('0x36')]);router[_0x47df('0x24')](_0x47df('0x37'),controller[_0x47df('0x38')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x89f3fa,_0x480655,_0x3dee6b){const _0x46c98f=path[_0x47df('0x29')](config[_0x47df('0x2f')],_0x47df('0x39'),_0x47df('0x3a'),'offline-chat');fs_extra['ensureDir'](_0x46c98f,function(){_0x3dee6b(null,_0x46c98f);});},'filename':function(_0x4c8c9e,_0x4e12bc,_0x22f7a0){const _0x39c34f=_0x4e12bc[_0x47df('0x2d')][_0x47df('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2ad9b6=path['extname'](_0x39c34f);const _0x1d72f2=Date[_0x47df('0x2c')]()+'-'+_0x39c34f[_0x47df('0x3b')](_0x2ad9b6,'')+_0x2ad9b6;_0x22f7a0(null,_0x1d72f2);}})});router['post'](_0x47df('0x3c'),offlineUploadMulter[_0x47df('0x3d')](),controller[_0x47df('0x3e')]);router[_0x47df('0x24')](_0x47df('0x17'),auth[_0x47df('0x8')](),controller['addInteraction']);router[_0x47df('0x24')](_0x47df('0x1b'),auth[_0x47df('0x8')](),controller['addApplications']);router['post'](_0x47df('0x1d'),auth[_0x47df('0x8')](),controller['addProactiveActions']);router[_0x47df('0x24')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x47df('0x3f')](_0x47df('0xc'),auth['isAuthenticated'](),controller[_0x47df('0x40')]);router[_0x47df('0x41')](_0x47df('0xc'),auth[_0x47df('0x8')](),controller[_0x47df('0x42')]);router['delete'](_0x47df('0x43'),auth[_0x47df('0x8')](),controller[_0x47df('0x44')]);router[_0x47df('0x41')](_0x47df('0xf'),auth['isAuthenticated'](),controller[_0x47df('0x45')]);router[_0x47df('0x41')](_0x47df('0x46'),auth[_0x47df('0x8')](),controller['removeAgents']);module[_0x47df('0x47')]=router; \ No newline at end of file +var _0x1486=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','join','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','format','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','replace','extname','/:id/offline','any','addApplications','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path'];(function(_0x45fe84,_0x35f6cf){var _0x333f98=function(_0x26f660){while(--_0x26f660){_0x45fe84['push'](_0x45fe84['shift']());}};_0x333f98(++_0x35f6cf);}(_0x1486,0x1ee));var _0x6148=function(_0x420fc2,_0x46f0a8){_0x420fc2=_0x420fc2-0x0;var _0x515d52=_0x1486[_0x420fc2];return _0x515d52;};'use strict';var multer=require(_0x6148('0x0'));var util=require(_0x6148('0x1'));var path=require(_0x6148('0x2'));var timeout=require(_0x6148('0x3'));var express=require(_0x6148('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6148('0x5'));var interaction=require(_0x6148('0x6'));var config=require(_0x6148('0x7'));var controller=require(_0x6148('0x8'));router[_0x6148('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6148('0x9')](_0x6148('0xa'),auth[_0x6148('0xb')](),controller[_0x6148('0xc')]);router['get'](_0x6148('0xd'),auth[_0x6148('0xb')](),controller[_0x6148('0xe')]);router[_0x6148('0x9')](_0x6148('0xf'),auth[_0x6148('0xb')](),controller['getDispositions']);router[_0x6148('0x9')](_0x6148('0x10'),auth[_0x6148('0xb')](),controller[_0x6148('0x11')]);router[_0x6148('0x9')](_0x6148('0x12'),controller[_0x6148('0x13')]);router[_0x6148('0x9')](_0x6148('0x14'),controller[_0x6148('0x15')]);router[_0x6148('0x9')](_0x6148('0x16'),controller[_0x6148('0x17')]);router[_0x6148('0x9')](_0x6148('0x18'),controller[_0x6148('0x19')]);router[_0x6148('0x9')](_0x6148('0x1a'),auth[_0x6148('0xb')](),controller[_0x6148('0x1b')]);router[_0x6148('0x9')](_0x6148('0x1c'),controller[_0x6148('0x1d')]);router[_0x6148('0x9')](_0x6148('0x1e'),auth[_0x6148('0xb')](),controller[_0x6148('0x1f')]);router['get'](_0x6148('0x20'),auth[_0x6148('0xb')](),controller[_0x6148('0x21')]);router[_0x6148('0x9')](_0x6148('0x22'),controller[_0x6148('0x23')]);router['get'](_0x6148('0x24'),auth[_0x6148('0xb')](),controller[_0x6148('0x25')]);router['get'](_0x6148('0x26'),auth[_0x6148('0xb')](),controller[_0x6148('0x27')]);router['post']('/',auth[_0x6148('0xb')](),controller[_0x6148('0x28')]);router[_0x6148('0x29')](_0x6148('0xf'),auth[_0x6148('0xb')](),controller['addDisposition']);router[_0x6148('0x29')](_0x6148('0x10'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4348ad,_0x241564,_0x1bc6af){_0x1bc6af(null,path[_0x6148('0x2a')](config[_0x6148('0x2b')],_0x6148('0x2c')));},'filename':function(_0x31cca4,_0x269f50,_0x1c7ee3){_0x1c7ee3(null,util['format'](_0x6148('0x2d'),Date[_0x6148('0x2e')](),_0x269f50[_0x6148('0x2f')]));}})});router[_0x6148('0x29')](_0x6148('0x12'),upload[_0x6148('0x30')](_0x6148('0x31')),controller[_0x6148('0x32')]);var upload=multer({'storage':multer[_0x6148('0x33')]({'destination':function(_0x19e6a0,_0x3fcd75,_0x693bbc){_0x693bbc(null,path[_0x6148('0x2a')](config['root'],_0x6148('0x34')));},'filename':function(_0x18fba3,_0x5519a7,_0x45d16f){_0x45d16f(null,util[_0x6148('0x35')](_0x6148('0x2d'),Date[_0x6148('0x2e')](),_0x5519a7[_0x6148('0x2f')]));}})});router[_0x6148('0x29')]('/:id/avatar',upload['single'](_0x6148('0x31')),controller[_0x6148('0x36')]);var upload=multer({'storage':multer[_0x6148('0x33')]({'destination':function(_0x3ef8f4,_0x3595d4,_0x5c5051){_0x5c5051(null,path[_0x6148('0x2a')](config[_0x6148('0x2b')],_0x6148('0x34')));},'filename':function(_0x11980d,_0x20b228,_0x30db2d){_0x30db2d(null,util[_0x6148('0x35')]('%s-%s',Date[_0x6148('0x2e')](),_0x20b228[_0x6148('0x2f')]));}})});router[_0x6148('0x29')](_0x6148('0x16'),upload[_0x6148('0x30')](_0x6148('0x31')),controller[_0x6148('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32cf26,_0x1eb25d,_0x486e96){_0x486e96(null,path['join'](config[_0x6148('0x2b')],_0x6148('0x34')));},'filename':function(_0x4fe489,_0x27298b,_0xd6c1a7){_0xd6c1a7(null,util[_0x6148('0x35')](_0x6148('0x2d'),Date[_0x6148('0x2e')](),_0x27298b['originalname']));}})});router[_0x6148('0x29')](_0x6148('0x18'),upload['single'](_0x6148('0x31')),controller[_0x6148('0x38')]);router[_0x6148('0x29')](_0x6148('0x39'),controller[_0x6148('0x3a')]);const offlineUploadMulter=multer({'storage':multer[_0x6148('0x33')]({'destination':function(_0x43c41b,_0x10bdff,_0x3e672c){const _0x5419d4=path['join'](config[_0x6148('0x2b')],'server/files','attachments','offline-chat');fs_extra['ensureDir'](_0x5419d4,function(){_0x3e672c(null,_0x5419d4);});},'filename':function(_0x5086a,_0x1e9e83,_0x3fa5ed){const _0x5989df=_0x1e9e83[_0x6148('0x2f')][_0x6148('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x139d8f=path[_0x6148('0x3c')](_0x5989df);const _0x5bb791=Date[_0x6148('0x2e')]()+'-'+_0x5989df[_0x6148('0x3b')](_0x139d8f,'')+_0x139d8f;_0x3fa5ed(null,_0x5bb791);}})});router[_0x6148('0x29')](_0x6148('0x3d'),offlineUploadMulter[_0x6148('0x3e')](),controller['offline']);router[_0x6148('0x29')]('/:id/interactions',auth[_0x6148('0xb')](),controller['addInteraction']);router[_0x6148('0x29')](_0x6148('0x1e'),auth[_0x6148('0xb')](),controller[_0x6148('0x3f')]);router['post'](_0x6148('0x20'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x6148('0x29')](_0x6148('0x26'),auth[_0x6148('0xb')](),controller['addAgents']);router[_0x6148('0x40')](_0x6148('0xd'),auth[_0x6148('0xb')](),controller[_0x6148('0x41')]);router[_0x6148('0x42')](_0x6148('0xd'),auth[_0x6148('0xb')](),controller[_0x6148('0x43')]);router[_0x6148('0x42')](_0x6148('0xf'),auth[_0x6148('0xb')](),controller[_0x6148('0x44')]);router[_0x6148('0x42')](_0x6148('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x6148('0x42')]('/:id/users',auth[_0x6148('0xb')](),controller[_0x6148('0x45')]);module[_0x6148('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 5ffc354..0a5f615 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 _0x4774=['isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','production','app','client-side-logger','expressEndpoint','/client-logs','use'];(function(_0x2faa79,_0x4d1863){var _0x1f2c09=function(_0x363857){while(--_0x363857){_0x2faa79['push'](_0x2faa79['shift']());}};_0x1f2c09(++_0x4d1863);}(_0x4774,0xb8));var _0x4477=function(_0x496bef,_0x351c30){_0x496bef=_0x496bef-0x0;var _0x51cd9f=_0x4774[_0x496bef];return _0x51cd9f;};var beaverLogger=require(_0x4477('0x0'));var express=require(_0x4477('0x1'));var auth=require(_0x4477('0x2'));var config=require(_0x4477('0x3'));var router=express[_0x4477('0x4')]();var isProduction=config['env']===_0x4477('0x5')||![];function clientSideLogs(_0x522607,_0x471154,_0x96de80){var _0x109bbb=_0x522607[_0x4477('0x6')]['get'](_0x4477('0x7'));if(!_0x109bbb){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x4477('0x8')]({'uri':_0x4477('0x9'),'logger':_0x109bbb,'enableCors':!isProduction})(_0x522607,_0x471154,_0x96de80);}router[_0x4477('0xa')](auth[_0x4477('0xb')](),clientSideLogs);module[_0x4477('0xc')]=router; \ No newline at end of file +var _0x4f50=['isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x4f50,0x12c));var _0x04f5=function(_0x102b50,_0x536173){_0x102b50=_0x102b50-0x0;var _0x4a6749=_0x4f50[_0x102b50];return _0x4a6749;};var beaverLogger=require(_0x04f5('0x0'));var express=require(_0x04f5('0x1'));var auth=require(_0x04f5('0x2'));var config=require(_0x04f5('0x3'));var router=express[_0x04f5('0x4')]();var isProduction=config[_0x04f5('0x5')]===_0x04f5('0x6')||![];function clientSideLogs(_0x14e617,_0x1835aa,_0x5b0307){var _0x336708=_0x14e617['app'][_0x04f5('0x7')](_0x04f5('0x8'));if(!_0x336708){throw new Error(_0x04f5('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x04f5('0xa'),'logger':_0x336708,'enableCors':!isProduction})(_0x14e617,_0x1835aa,_0x5b0307);}router[_0x04f5('0xb')](auth[_0x04f5('0xc')](),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 8237827..206f1a1 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 _0xca7c=['Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20tenant','STRING','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS'];(function(_0x171142,_0x3948cc){var _0xfc3773=function(_0x444a0b){while(--_0x444a0b){_0x171142['push'](_0x171142['shift']());}};_0xfc3773(++_0x3948cc);}(_0xca7c,0x1ae));var _0xcca7=function(_0x1fc985,_0x846abf){_0x1fc985=_0x1fc985-0x0;var _0x5c3209=_0xca7c[_0x1fc985];return _0x5c3209;};'use strict';var Sequelize=require(_0xcca7('0x0'));module[_0xcca7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xcca7('0x2')](_0xcca7('0x3'),_0xcca7('0x4'),_0xcca7('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xcca7('0x2')](_0xcca7('0x6'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0xcca7('0x7')},'data3':{'type':Sequelize[_0xcca7('0x8')],'comment':_0xcca7('0x9')},'data4':{'type':Sequelize[_0xcca7('0x8')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xcca7('0xa')],'comment':_0xcca7('0xb')},'data6':{'type':Sequelize[_0xcca7('0xa')],'comment':_0xcca7('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':_0xcca7('0xd')}}; \ No newline at end of file +var _0x4b46=['sequelize','STRING','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4b46,0x150));var _0x64b4=function(_0x3c1b4b,_0x5cec39){_0x3c1b4b=_0x3c1b4b-0x0;var _0x548e89=_0x4b46[_0x3c1b4b];return _0x548e89;};'use strict';var Sequelize=require(_0x64b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x64b4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x64b4('0x2'),_0x64b4('0x3'),_0x64b4('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x64b4('0x5'),_0x64b4('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0x64b4('0x7')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x64b4('0x1')],'comment':_0x64b4('0x8')},'data5':{'type':Sequelize[_0x64b4('0x9')],'comment':_0x64b4('0xa')},'data6':{'type':Sequelize[_0x64b4('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x64b4('0x9')],'comment':_0x64b4('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 16fea19..cc103a8 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 _0x8166=['limit','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','catch','show','params','find','data3','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','toString','isValidIdToken','id_token','del','code','access_token','data6','refresh_token','data5','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8166,0x1d6));var _0x6816=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x8166[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x6816('0x0'));var encryptor=require(_0x6816('0x1'));var config=require('../../config/environment');var logger=require(_0x6816('0x2'))(_0x6816('0x3'));var db=require(_0x6816('0x4'))['db'];var oauth=require(_0x6816('0x5'));config[_0x6816('0x6')]=_[_0x6816('0x7')](config['redis'],{'host':_0x6816('0x8'),'port':0x18eb});var socket=require(_0x6816('0x9'))(new Redis(config[_0x6816('0x6')]));var redis=new Redis(config[_0x6816('0x6')]);function respondWithStatusCode(_0x40a95e,_0x4c4125){_0x4c4125=_0x4c4125||0xcc;return function(_0x108157){if(_0x108157){return _0x40a95e[_0x6816('0xa')](_0x4c4125);}return _0x40a95e['status'](_0x4c4125)['end']();};}function respondWithResult(_0x36902e,_0x585fff){_0x585fff=_0x585fff||0xc8;return function(_0x1e552c){if(_0x1e552c){return _0x36902e[_0x6816('0xb')](_0x585fff)[_0x6816('0xc')](_0x1e552c);}};}function respondWithFilteredResult(_0x405aab,_0x13107d){return function(_0x12e47f){if(_0x12e47f){var _0x3675fa=typeof _0x13107d[_0x6816('0xd')]===_0x6816('0xe')&&typeof _0x13107d['limit']===_0x6816('0xe');var _0x39cf0c=_0x12e47f['count'];var _0x40aece=_0x3675fa?0x0:_0x13107d[_0x6816('0xd')];var _0x399fbe=_0x3675fa?_0x12e47f['count']:_0x13107d[_0x6816('0xd')]+_0x13107d[_0x6816('0xf')];var _0x310ba8;if(_0x399fbe>=_0x39cf0c){_0x399fbe=_0x39cf0c;_0x310ba8=0xc8;}else{_0x310ba8=0xce;}_0x405aab[_0x6816('0xb')](_0x310ba8);return _0x405aab[_0x6816('0x10')](_0x6816('0x11'),_0x40aece+'-'+_0x399fbe+'/'+_0x39cf0c)[_0x6816('0xc')](_0x12e47f);}return null;};}function saveUpdates(_0x2cfa10){return function(_0x107e58){if(_0x107e58){return _0x107e58[_0x6816('0x12')](_0x2cfa10)[_0x6816('0x13')](function(_0x2d7a74){return _0x2d7a74;});}return null;};}function removeEntity(_0x6f2910){return function(_0x1ca9b9){if(_0x1ca9b9){return _0x1ca9b9[_0x6816('0x14')]()['then'](function(){_0x6f2910[_0x6816('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c36a5){return function(_0x4a724c){if(!_0x4a724c){_0x1c36a5['sendStatus'](0x194);}return _0x4a724c;};}function handleError(_0x45a9d7,_0x48ac4c){_0x48ac4c=_0x48ac4c||0x1f4;return function(_0xb0dc96){logger[_0x6816('0x15')](_0xb0dc96[_0x6816('0x16')]);if(_0xb0dc96[_0x6816('0x17')]){delete _0xb0dc96['name'];}_0x45a9d7[_0x6816('0xb')](_0x48ac4c)[_0x6816('0x18')](_0xb0dc96);};}function maskClientSecret(_0x2742af){return _[_0x6816('0x19')](_0x2742af[_0x6816('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6816('0x1b')]=function(_0x50fc2b,_0x108448){var _0xb8d33b={},_0x4049cc={},_0x366262={'count':0x0,'rows':[]};var _0x13640f=_[_0x6816('0x1c')](db[_0x6816('0x1d')][_0x6816('0x1e')],function(_0x5e8346){return{'name':_0x5e8346[_0x6816('0x1f')],'type':_0x5e8346[_0x6816('0x20')][_0x6816('0x21')]};});_0x4049cc['model']=_['map'](_0x13640f,_0x6816('0x17'));_0x4049cc['query']=_[_0x6816('0x22')](_0x50fc2b[_0x6816('0x23')]);_0x4049cc['filters']=_[_0x6816('0x24')](_0x4049cc[_0x6816('0x25')],_0x4049cc[_0x6816('0x23')]);_0xb8d33b['attributes']=_['intersection'](_0x4049cc[_0x6816('0x25')],qs[_0x6816('0x26')](_0x50fc2b[_0x6816('0x23')]['fields']));_0xb8d33b[_0x6816('0x27')]=_0xb8d33b[_0x6816('0x27')][_0x6816('0x28')]?_0xb8d33b[_0x6816('0x27')]:_0x4049cc[_0x6816('0x25')];if(!_0x50fc2b[_0x6816('0x23')][_0x6816('0x29')](_0x6816('0x2a'))){_0xb8d33b[_0x6816('0xf')]=qs[_0x6816('0xf')](_0x50fc2b[_0x6816('0x23')][_0x6816('0xf')]);_0xb8d33b[_0x6816('0xd')]=qs[_0x6816('0xd')](_0x50fc2b[_0x6816('0x23')][_0x6816('0xd')]);}_0xb8d33b[_0x6816('0x2b')]=qs[_0x6816('0x2c')](_0x50fc2b[_0x6816('0x23')][_0x6816('0x2c')]);_0xb8d33b['where']=qs[_0x6816('0x2d')](_['pick'](_0x50fc2b[_0x6816('0x23')],_0x4049cc[_0x6816('0x2d')]),_0x13640f);if(_0x50fc2b[_0x6816('0x23')]['filter']){_0xb8d33b[_0x6816('0x2e')]=_[_0x6816('0x2f')](_0xb8d33b['where'],{'$or':_[_0x6816('0x1c')](_0x13640f,function(_0x1cc29c){if(_0x1cc29c[_0x6816('0x20')]!==_0x6816('0x30')){var _0xed3a23={};_0xed3a23[_0x1cc29c[_0x6816('0x17')]]={'$like':'%'+_0x50fc2b[_0x6816('0x23')][_0x6816('0x31')]+'%'};return _0xed3a23;}})});}_0xb8d33b=_[_0x6816('0x2f')]({},_0xb8d33b,_0x50fc2b[_0x6816('0x32')]);var _0x318d62={'where':_0xb8d33b[_0x6816('0x2e')]};return db[_0x6816('0x1d')]['count'](_0x318d62)[_0x6816('0x13')](function(_0x583b3b){_0x366262['count']=_0x583b3b;if(_0x50fc2b[_0x6816('0x23')][_0x6816('0x33')]){_0xb8d33b[_0x6816('0x34')]=[{'all':!![]}];}return db[_0x6816('0x1d')][_0x6816('0x35')](_0xb8d33b);})[_0x6816('0x13')](function(_0x52dfbc){_0x366262[_0x6816('0x36')]=_['map'](_0x52dfbc,function(_0x30e8c8){if(_0x30e8c8[_0x6816('0x37')]===_0x6816('0x38')){var _0x4e78c8=encryptor[_0x6816('0x39')](_0x30e8c8['data3']);_0x30e8c8['data3']=maskClientSecret(_0x4e78c8);}return _0x30e8c8;});return _0x366262;})[_0x6816('0x13')](respondWithFilteredResult(_0x108448,_0xb8d33b))[_0x6816('0x3a')](handleError(_0x108448,null));};exports[_0x6816('0x3b')]=function(_0x392a3d,_0x11a204){var _0x26aada={'raw':!![],'where':{'id':_0x392a3d[_0x6816('0x3c')]['id']}},_0x542d64={};_0x542d64['model']=_[_0x6816('0x22')](db['CloudProvider'][_0x6816('0x1e')]);_0x542d64['query']=_['keys'](_0x392a3d[_0x6816('0x23')]);_0x542d64[_0x6816('0x2d')]=_[_0x6816('0x24')](_0x542d64['model'],_0x542d64['query']);_0x26aada['attributes']=_[_0x6816('0x24')](_0x542d64['model'],qs[_0x6816('0x26')](_0x392a3d[_0x6816('0x23')][_0x6816('0x26')]));_0x26aada[_0x6816('0x27')]=_0x26aada['attributes'][_0x6816('0x28')]?_0x26aada['attributes']:_0x542d64[_0x6816('0x25')];if(_0x392a3d[_0x6816('0x23')][_0x6816('0x33')]){_0x26aada['include']=[{'all':!![]}];}_0x26aada=_[_0x6816('0x2f')]({},_0x26aada,_0x392a3d[_0x6816('0x32')]);return db[_0x6816('0x1d')][_0x6816('0x3d')](_0x26aada)[_0x6816('0x13')](handleEntityNotFound(_0x11a204,null))['then'](function(_0x47ec47){if(_0x47ec47['service']==='MicrosoftAzure'){var _0x3e0d95=encryptor[_0x6816('0x39')](_0x47ec47[_0x6816('0x3e')]);_0x47ec47[_0x6816('0x3e')]=maskClientSecret(_0x3e0d95);}return _0x47ec47;})[_0x6816('0x13')](respondWithResult(_0x11a204,null))[_0x6816('0x3a')](handleError(_0x11a204,null));};exports['create']=function(_0x55cf88,_0x202748){if(!_0x55cf88[_0x6816('0x3f')][_0x6816('0x17')])throw new Error(_0x6816('0x40'));if(!_0x55cf88[_0x6816('0x3f')][_0x6816('0x37')])throw new Error(_0x6816('0x41'));var _0x52b9fa=db[_0x6816('0x1d')]['rawAttributes'][_0x6816('0x37')]['values'];if(!_0x52b9fa[_0x6816('0x42')](_0x55cf88['body'][_0x6816('0x37')]))throw new Error(_0x6816('0x43')+_0x52b9fa['join'](',\x20'));if(_0x55cf88[_0x6816('0x3f')][_0x6816('0x37')]==='MicrosoftAzure'&&_0x55cf88[_0x6816('0x3f')][_0x6816('0x3e')]){_0x55cf88[_0x6816('0x3f')][_0x6816('0x3e')]=encryptor[_0x6816('0x44')](_0x55cf88[_0x6816('0x3f')][_0x6816('0x3e')]);}return db[_0x6816('0x1d')][_0x6816('0x45')](_0x55cf88['body'],{})[_0x6816('0x13')](respondWithResult(_0x202748,0xc9))[_0x6816('0x3a')](handleError(_0x202748,null));};exports['update']=function(_0x35793b,_0x2daaa6){if(_0x35793b[_0x6816('0x3f')]['id']){delete _0x35793b[_0x6816('0x3f')]['id'];}return db['CloudProvider'][_0x6816('0x3d')]({'where':{'id':_0x35793b[_0x6816('0x3c')]['id']}})[_0x6816('0x13')](handleEntityNotFound(_0x2daaa6,null))[_0x6816('0x13')](function(_0x457258){if(_0x457258['service']===_0x6816('0x38')&&_0x35793b[_0x6816('0x3f')]['data3']){_0x35793b['body'][_0x6816('0x3e')]=encryptor[_0x6816('0x44')](_0x35793b[_0x6816('0x3f')]['data3']);}return _0x457258;})['then'](saveUpdates(_0x35793b['body'],null))['then'](respondWithResult(_0x2daaa6,null))[_0x6816('0x3a')](handleError(_0x2daaa6,null));};exports['destroy']=function(_0x4606a0,_0xb86324){return db[_0x6816('0x1d')][_0x6816('0x3d')]({'where':{'id':_0x4606a0[_0x6816('0x3c')]['id']}})[_0x6816('0x13')](handleEntityNotFound(_0xb86324,null))['then'](removeEntity(_0xb86324,null))[_0x6816('0x3a')](handleError(_0xb86324,null));};exports[_0x6816('0x46')]=function(_0x288b3b,_0x2bdda3){return db['CloudProvider'][_0x6816('0x47')]({'where':{'id':_0x288b3b[_0x6816('0x3c')]['id']},'raw':!![]})[_0x6816('0x13')](function(_0x173fe4){if(!_0x173fe4)return _0x2bdda3[_0x6816('0xa')](0x194);return{'url':oauth[_0x6816('0x48')](_0x173fe4,_0x288b3b[_0x6816('0x49')]['id'])};})[_0x6816('0x13')](respondWithResult(_0x2bdda3,null))[_0x6816('0x3a')](handleError(_0x2bdda3,null));};exports[_0x6816('0x4a')]=function(_0x7785a1,_0x2bc561){var _0x91c60f=_0x7785a1[_0x6816('0x3f')];var _0x30186c;var _0x16ddb8;if(_0x91c60f[_0x6816('0x15')])throw _0x91c60f;redis[_0x6816('0x4b')](_0x91c60f[_0x6816('0x4c')])['then'](function(_0x259a24){if(!_0x259a24)throw new Error(_0x6816('0x4d'));_0x30186c=JSON[_0x6816('0x4e')](_0x259a24);var _0x56e69e=Buffer['from'](_0x91c60f['state'],_0x6816('0x4f'))[_0x6816('0x50')]('ascii');_0x16ddb8=JSON[_0x6816('0x4e')](_0x56e69e);if(!oauth[_0x6816('0x51')](_0x91c60f[_0x6816('0x52')],_0x30186c['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x6816('0x53')](_0x91c60f[_0x6816('0x4c')]);return oauth['getOauth2MicrosoftAccessToken'](_0x91c60f[_0x6816('0x54')],_0x30186c);})[_0x6816('0x13')](function(_0x3a70c8){_0x30186c['data5']=_0x3a70c8[_0x6816('0x55')];_0x30186c[_0x6816('0x56')]=_0x3a70c8[_0x6816('0x57')];return db[_0x6816('0x1d')][_0x6816('0x12')]({'data5':_0x30186c[_0x6816('0x58')],'data6':_0x30186c[_0x6816('0x56')]},{'where':{'id':_0x30186c['id']}});})[_0x6816('0x13')](function(){oauth[_0x6816('0x59')](_0x30186c);socket['emit'](_0x6816('0x5a'),{'id':_0x16ddb8['id']});return;})[_0x6816('0x13')](respondWithStatusCode(_0x2bc561,null))[_0x6816('0x3a')](function(_0x40a819){if(_0x16ddb8){socket[_0x6816('0x5b')](_0x6816('0x5c'),{'id':_0x16ddb8['id']});}if(!_0x30186c){logger[_0x6816('0x15')](_0x6816('0x5d'),_0x40a819);return _0x2bc561[_0x6816('0xb')](0x1f4)[_0x6816('0x18')](_0x40a819[_0x6816('0x5e')]);}logger[_0x6816('0x15')](_0x6816('0x5f'),_0x30186c['id'],JSON[_0x6816('0x60')](_0x40a819));});}; \ No newline at end of file +var _0xb493=['Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','toString','isValidIdToken','id_token','oauth2Claims','del','state','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','emit','microsoftAuthorization:error'];(function(_0x475eac,_0x2fa495){var _0x4ad158=function(_0x2d7c4c){while(--_0x2d7c4c){_0x475eac['push'](_0x475eac['shift']());}};_0x4ad158(++_0x2fa495);}(_0xb493,0x126));var _0x3b49=function(_0x39db9e,_0x4569ae){_0x39db9e=_0x39db9e-0x0;var _0x5a7a01=_0xb493[_0x39db9e];return _0x5a7a01;};'use strict';var _=require(_0x3b49('0x0'));var Redis=require(_0x3b49('0x1'));var qs=require(_0x3b49('0x2'));var encryptor=require(_0x3b49('0x3'));var config=require(_0x3b49('0x4'));var logger=require(_0x3b49('0x5'))(_0x3b49('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0x3b49('0x7'));config[_0x3b49('0x8')]=_['defaults'](config['redis'],{'host':_0x3b49('0x9'),'port':0x18eb});var socket=require(_0x3b49('0xa'))(new Redis(config[_0x3b49('0x8')]));var redis=new Redis(config[_0x3b49('0x8')]);function respondWithStatusCode(_0x429dd1,_0x8f4e4b){_0x8f4e4b=_0x8f4e4b||0xcc;return function(_0x2767a7){if(_0x2767a7){return _0x429dd1[_0x3b49('0xb')](_0x8f4e4b);}return _0x429dd1[_0x3b49('0xc')](_0x8f4e4b)['end']();};}function respondWithResult(_0x34f3ee,_0x4ff51a){_0x4ff51a=_0x4ff51a||0xc8;return function(_0x1d76a9){if(_0x1d76a9){return _0x34f3ee[_0x3b49('0xc')](_0x4ff51a)[_0x3b49('0xd')](_0x1d76a9);}};}function respondWithFilteredResult(_0x2dc168,_0x3382f1){return function(_0x22b408){if(_0x22b408){var _0x5488dd=typeof _0x3382f1[_0x3b49('0xe')]==='undefined'&&typeof _0x3382f1['limit']==='undefined';var _0x2ffcd6=_0x22b408[_0x3b49('0xf')];var _0x2de575=_0x5488dd?0x0:_0x3382f1[_0x3b49('0xe')];var _0x4e960f=_0x5488dd?_0x22b408[_0x3b49('0xf')]:_0x3382f1['offset']+_0x3382f1[_0x3b49('0x10')];var _0x58cf1d;if(_0x4e960f>=_0x2ffcd6){_0x4e960f=_0x2ffcd6;_0x58cf1d=0xc8;}else{_0x58cf1d=0xce;}_0x2dc168[_0x3b49('0xc')](_0x58cf1d);return _0x2dc168[_0x3b49('0x11')](_0x3b49('0x12'),_0x2de575+'-'+_0x4e960f+'/'+_0x2ffcd6)[_0x3b49('0xd')](_0x22b408);}return null;};}function saveUpdates(_0x3808e5){return function(_0x29979e){if(_0x29979e){return _0x29979e[_0x3b49('0x13')](_0x3808e5)[_0x3b49('0x14')](function(_0x236c28){return _0x236c28;});}return null;};}function removeEntity(_0x48a983){return function(_0x205896){if(_0x205896){return _0x205896[_0x3b49('0x15')]()[_0x3b49('0x14')](function(){_0x48a983['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x124292){return function(_0x5e4474){if(!_0x5e4474){_0x124292[_0x3b49('0xb')](0x194);}return _0x5e4474;};}function handleError(_0x4756e1,_0x4be1f3){_0x4be1f3=_0x4be1f3||0x1f4;return function(_0xfc76f8){logger[_0x3b49('0x16')](_0xfc76f8[_0x3b49('0x17')]);if(_0xfc76f8[_0x3b49('0x18')]){delete _0xfc76f8[_0x3b49('0x18')];}_0x4756e1[_0x3b49('0xc')](_0x4be1f3)[_0x3b49('0x19')](_0xfc76f8);};}function maskClientSecret(_0xc129ef){return _[_0x3b49('0x1a')](_0xc129ef[_0x3b49('0x1b')](0x0,0x3),0x14,'*');}exports[_0x3b49('0x1c')]=function(_0x259091,_0xe6d40a){var _0x3fdd0a={},_0x466d6b={},_0x3eb6af={'count':0x0,'rows':[]};var _0x9b5204=_[_0x3b49('0x1d')](db[_0x3b49('0x1e')]['rawAttributes'],function(_0x4c2d26){return{'name':_0x4c2d26[_0x3b49('0x1f')],'type':_0x4c2d26['type'][_0x3b49('0x20')]};});_0x466d6b['model']=_[_0x3b49('0x1d')](_0x9b5204,'name');_0x466d6b[_0x3b49('0x21')]=_[_0x3b49('0x22')](_0x259091[_0x3b49('0x21')]);_0x466d6b[_0x3b49('0x23')]=_[_0x3b49('0x24')](_0x466d6b[_0x3b49('0x25')],_0x466d6b[_0x3b49('0x21')]);_0x3fdd0a[_0x3b49('0x26')]=_['intersection'](_0x466d6b[_0x3b49('0x25')],qs['fields'](_0x259091[_0x3b49('0x21')][_0x3b49('0x27')]));_0x3fdd0a[_0x3b49('0x26')]=_0x3fdd0a[_0x3b49('0x26')][_0x3b49('0x28')]?_0x3fdd0a[_0x3b49('0x26')]:_0x466d6b[_0x3b49('0x25')];if(!_0x259091[_0x3b49('0x21')]['hasOwnProperty']('nolimit')){_0x3fdd0a['limit']=qs[_0x3b49('0x10')](_0x259091[_0x3b49('0x21')]['limit']);_0x3fdd0a[_0x3b49('0xe')]=qs['offset'](_0x259091['query']['offset']);}_0x3fdd0a[_0x3b49('0x29')]=qs['sort'](_0x259091[_0x3b49('0x21')][_0x3b49('0x2a')]);_0x3fdd0a[_0x3b49('0x2b')]=qs['filters'](_[_0x3b49('0x2c')](_0x259091[_0x3b49('0x21')],_0x466d6b[_0x3b49('0x23')]),_0x9b5204);if(_0x259091['query'][_0x3b49('0x2d')]){_0x3fdd0a['where']=_[_0x3b49('0x2e')](_0x3fdd0a[_0x3b49('0x2b')],{'$or':_[_0x3b49('0x1d')](_0x9b5204,function(_0x1daddc){if(_0x1daddc[_0x3b49('0x2f')]!==_0x3b49('0x30')){var _0x1edd0e={};_0x1edd0e[_0x1daddc[_0x3b49('0x18')]]={'$like':'%'+_0x259091[_0x3b49('0x21')][_0x3b49('0x2d')]+'%'};return _0x1edd0e;}})});}_0x3fdd0a=_[_0x3b49('0x2e')]({},_0x3fdd0a,_0x259091[_0x3b49('0x31')]);var _0x5afc73={'where':_0x3fdd0a[_0x3b49('0x2b')]};return db[_0x3b49('0x1e')][_0x3b49('0xf')](_0x5afc73)['then'](function(_0x547172){_0x3eb6af[_0x3b49('0xf')]=_0x547172;if(_0x259091[_0x3b49('0x21')][_0x3b49('0x32')]){_0x3fdd0a[_0x3b49('0x33')]=[{'all':!![]}];}return db[_0x3b49('0x1e')][_0x3b49('0x34')](_0x3fdd0a);})['then'](function(_0xcbdba9){_0x3eb6af['rows']=_[_0x3b49('0x1d')](_0xcbdba9,function(_0x261868){if(_0x261868['service']===_0x3b49('0x35')){var _0x4b1a22=encryptor[_0x3b49('0x36')](_0x261868[_0x3b49('0x37')]);_0x261868[_0x3b49('0x37')]=maskClientSecret(_0x4b1a22);}return _0x261868;});return _0x3eb6af;})[_0x3b49('0x14')](respondWithFilteredResult(_0xe6d40a,_0x3fdd0a))[_0x3b49('0x38')](handleError(_0xe6d40a,null));};exports[_0x3b49('0x39')]=function(_0xe5fc48,_0xaee5da){var _0x3c93c4={'raw':!![],'where':{'id':_0xe5fc48[_0x3b49('0x3a')]['id']}},_0x22698d={};_0x22698d[_0x3b49('0x25')]=_['keys'](db[_0x3b49('0x1e')][_0x3b49('0x3b')]);_0x22698d['query']=_[_0x3b49('0x22')](_0xe5fc48['query']);_0x22698d[_0x3b49('0x23')]=_[_0x3b49('0x24')](_0x22698d[_0x3b49('0x25')],_0x22698d['query']);_0x3c93c4['attributes']=_[_0x3b49('0x24')](_0x22698d[_0x3b49('0x25')],qs[_0x3b49('0x27')](_0xe5fc48[_0x3b49('0x21')][_0x3b49('0x27')]));_0x3c93c4[_0x3b49('0x26')]=_0x3c93c4[_0x3b49('0x26')]['length']?_0x3c93c4[_0x3b49('0x26')]:_0x22698d[_0x3b49('0x25')];if(_0xe5fc48['query'][_0x3b49('0x32')]){_0x3c93c4[_0x3b49('0x33')]=[{'all':!![]}];}_0x3c93c4=_['merge']({},_0x3c93c4,_0xe5fc48[_0x3b49('0x31')]);return db[_0x3b49('0x1e')][_0x3b49('0x3c')](_0x3c93c4)[_0x3b49('0x14')](handleEntityNotFound(_0xaee5da,null))['then'](function(_0x576b17){if(_0x576b17[_0x3b49('0x3d')]===_0x3b49('0x35')){var _0x8dcee1=encryptor['decryptString'](_0x576b17[_0x3b49('0x37')]);_0x576b17[_0x3b49('0x37')]=maskClientSecret(_0x8dcee1);}return _0x576b17;})[_0x3b49('0x14')](respondWithResult(_0xaee5da,null))[_0x3b49('0x38')](handleError(_0xaee5da,null));};exports[_0x3b49('0x3e')]=function(_0x47bada,_0x136383){if(!_0x47bada[_0x3b49('0x3f')]['name'])throw new Error(_0x3b49('0x40'));if(!_0x47bada['body'][_0x3b49('0x3d')])throw new Error(_0x3b49('0x41'));var _0x3c6c92=db['CloudProvider'][_0x3b49('0x3b')][_0x3b49('0x3d')][_0x3b49('0x42')];if(!_0x3c6c92[_0x3b49('0x43')](_0x47bada['body'][_0x3b49('0x3d')]))throw new Error(_0x3b49('0x44')+_0x3c6c92['join'](',\x20'));if(_0x47bada[_0x3b49('0x3f')][_0x3b49('0x3d')]===_0x3b49('0x35')&&_0x47bada[_0x3b49('0x3f')][_0x3b49('0x37')]){_0x47bada[_0x3b49('0x3f')][_0x3b49('0x37')]=encryptor['encryptString'](_0x47bada[_0x3b49('0x3f')][_0x3b49('0x37')]);}return db[_0x3b49('0x1e')][_0x3b49('0x3e')](_0x47bada['body'],{})[_0x3b49('0x14')](respondWithResult(_0x136383,0xc9))[_0x3b49('0x38')](handleError(_0x136383,null));};exports['update']=function(_0x358e90,_0x4ea5a8){if(_0x358e90[_0x3b49('0x3f')]['id']){delete _0x358e90[_0x3b49('0x3f')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x358e90[_0x3b49('0x3a')]['id']}})[_0x3b49('0x14')](handleEntityNotFound(_0x4ea5a8,null))[_0x3b49('0x14')](function(_0x3b2c96){if(_0x3b2c96[_0x3b49('0x3d')]===_0x3b49('0x35')&&_0x358e90[_0x3b49('0x3f')][_0x3b49('0x37')]){_0x358e90['body']['data3']=encryptor[_0x3b49('0x45')](_0x358e90['body'][_0x3b49('0x37')]);}return _0x3b2c96;})[_0x3b49('0x14')](saveUpdates(_0x358e90[_0x3b49('0x3f')],null))[_0x3b49('0x14')](respondWithResult(_0x4ea5a8,null))[_0x3b49('0x38')](handleError(_0x4ea5a8,null));};exports['destroy']=function(_0x195119,_0x90272e){return db['CloudProvider'][_0x3b49('0x3c')]({'where':{'id':_0x195119[_0x3b49('0x3a')]['id']}})['then'](handleEntityNotFound(_0x90272e,null))[_0x3b49('0x14')](removeEntity(_0x90272e,null))['catch'](handleError(_0x90272e,null));};exports[_0x3b49('0x46')]=function(_0x23e782,_0x5a6912){return db[_0x3b49('0x1e')][_0x3b49('0x47')]({'where':{'id':_0x23e782[_0x3b49('0x3a')]['id']},'raw':!![]})[_0x3b49('0x14')](function(_0x57042f){if(!_0x57042f)return _0x5a6912[_0x3b49('0xb')](0x194);return{'url':oauth[_0x3b49('0x48')](_0x57042f,_0x23e782[_0x3b49('0x49')]['id'])};})[_0x3b49('0x14')](respondWithResult(_0x5a6912,null))[_0x3b49('0x38')](handleError(_0x5a6912,null));};exports[_0x3b49('0x4a')]=function(_0x3ad606,_0x2b8a63){var _0x558c72=_0x3ad606[_0x3b49('0x3f')];var _0x522e84;var _0x16930f;if(_0x558c72[_0x3b49('0x16')])throw _0x558c72;redis[_0x3b49('0x4b')](_0x558c72['state'])[_0x3b49('0x14')](function(_0xd0f7d1){if(!_0xd0f7d1)throw new Error(_0x3b49('0x4c'));_0x522e84=JSON[_0x3b49('0x4d')](_0xd0f7d1);var _0x31cf45=Buffer[_0x3b49('0x4e')](_0x558c72['state'],'base64')[_0x3b49('0x4f')]('ascii');_0x16930f=JSON[_0x3b49('0x4d')](_0x31cf45);if(!oauth[_0x3b49('0x50')](_0x558c72[_0x3b49('0x51')],_0x522e84[_0x3b49('0x52')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x3b49('0x53')](_0x558c72[_0x3b49('0x54')]);return oauth[_0x3b49('0x55')](_0x558c72[_0x3b49('0x56')],_0x522e84);})[_0x3b49('0x14')](function(_0x51669a){_0x522e84[_0x3b49('0x57')]=_0x51669a[_0x3b49('0x58')];_0x522e84[_0x3b49('0x59')]=_0x51669a[_0x3b49('0x5a')];return db[_0x3b49('0x1e')][_0x3b49('0x13')]({'data5':_0x522e84[_0x3b49('0x57')],'data6':_0x522e84[_0x3b49('0x59')]},{'where':{'id':_0x522e84['id']}});})[_0x3b49('0x14')](function(){oauth['startRefreshInterval'](_0x522e84);socket['emit'](_0x3b49('0x5b'),{'id':_0x16930f['id']});return;})[_0x3b49('0x14')](respondWithStatusCode(_0x2b8a63,null))['catch'](function(_0x26e373){if(_0x16930f){socket[_0x3b49('0x5c')](_0x3b49('0x5d'),{'id':_0x16930f['id']});}if(!_0x522e84){logger[_0x3b49('0x16')](_0x3b49('0x5e'),_0x26e373);return _0x2b8a63[_0x3b49('0xc')](0x1f4)[_0x3b49('0x19')](_0x26e373[_0x3b49('0x5f')]);}logger[_0x3b49('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x522e84['id'],JSON[_0x3b49('0x60')](_0x26e373));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fd29b8e..24918c6 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 _0x4195=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x4195,0xbd));var _0x5419=function(_0x217523,_0x5d793a){_0x217523=_0x217523-0x0;var _0x43e3e1=_0x4195[_0x217523];return _0x43e3e1;};'use strict';var _=require(_0x5419('0x0'));var util=require(_0x5419('0x1'));var logger=require(_0x5419('0x2'))(_0x5419('0x3'));var moment=require(_0x5419('0x4'));var BPromise=require(_0x5419('0x5'));var rp=require(_0x5419('0x6'));var fs=require('fs');var path=require(_0x5419('0x7'));var rimraf=require(_0x5419('0x8'));var config=require(_0x5419('0x9'));var attributes=require(_0x5419('0xa'));module['exports']=function(_0xfff89b,_0x42d12a){return _0xfff89b[_0x5419('0xb')](_0x5419('0xc'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75cf=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api'];(function(_0x2c4b06,_0x5e8a08){var _0x3669d5=function(_0x1700a4){while(--_0x1700a4){_0x2c4b06['push'](_0x2c4b06['shift']());}};_0x3669d5(++_0x5e8a08);}(_0x75cf,0x1f4));var _0xf75c=function(_0x405d0f,_0x15924b){_0x405d0f=_0x405d0f-0x0;var _0x366e83=_0x75cf[_0x405d0f];return _0x366e83;};'use strict';var _=require(_0xf75c('0x0'));var util=require(_0xf75c('0x1'));var logger=require(_0xf75c('0x2'))(_0xf75c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf75c('0x4'));var fs=require('fs');var path=require(_0xf75c('0x5'));var rimraf=require(_0xf75c('0x6'));var config=require(_0xf75c('0x7'));var attributes=require(_0xf75c('0x8'));module[_0xf75c('0x9')]=function(_0x4d635e,_0x629473){return _0x4d635e[_0xf75c('0xa')](_0xf75c('0xb'),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 8621a1d..5727292 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 _0x8cd1=['crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','{TENANT_ID}','data2','code','id_token','from','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','state','nonce','prompt','login','key','oauth2Claims','oauth2/','set','stringify','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','data6','data4','data3','POST','replace','refresh_token','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','exports','lodash'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8cd1,0xa7));var _0x18cd=function(_0x5e37ca,_0x416e0f){_0x5e37ca=_0x5e37ca-0x0;var _0x458568=_0x8cd1[_0x5e37ca];return _0x458568;};'use strict';var _=require(_0x18cd('0x0'));var crypto=require(_0x18cd('0x1'));var jwt=require(_0x18cd('0x2'));var moment=require('moment');var Redis=require(_0x18cd('0x3'));var rp=require(_0x18cd('0x4'));var util=require(_0x18cd('0x5'));var encryptor=require(_0x18cd('0x6'));var config=require(_0x18cd('0x7'));var logger=require(_0x18cd('0x8'))(_0x18cd('0x9'));var schedule=require(_0x18cd('0xa'));var db=require(_0x18cd('0xb'))['db'];config['redis']=_[_0x18cd('0xc')](config[_0x18cd('0xd')],{'host':_0x18cd('0xe'),'port':0x18eb});var redis=new Redis(config[_0x18cd('0xd')]);var MICROSOFT_AUTH_URL=_0x18cd('0xf');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x18cd('0x10'),_0x18cd('0x11'),_0x18cd('0x12'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x18cd('0x13'),_0x18cd('0x14')],'Dynamics365':[_0x18cd('0x15'),_0x18cd('0x12')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x18cd('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x112939){var _0x23bf59=_[_0x18cd('0x17')](AZURE_AUTH_SCOPES[_0x112939[_0x18cd('0x18')]]);if(_0x112939['type']===_0x18cd('0x19'))_0x23bf59[_0x18cd('0x1a')](_0x112939[_0x18cd('0x1b')]+_0x18cd('0x1c'));return _0x23bf59[_0x18cd('0x1d')]('\x20');}function getAccessTokenScope(_0x78be23){if(_0x78be23['type']===_0x18cd('0x1e'))return _0x18cd('0x1f');if(_0x78be23[_0x18cd('0x18')]===_0x18cd('0x19'))return _0x78be23[_0x18cd('0x1b')]+_0x18cd('0x1c');}function generateMicrosoftAuthorizationUrl(_0x2b30df,_0x10492a){var _0x348008=MICROSOFT_AUTH_URL['replace'](_0x18cd('0x20'),_0x2b30df[_0x18cd('0x21')]);var _0x17f89d=[_0x18cd('0x22'),_0x18cd('0x23')];var _0x1ee1c8=Buffer[_0x18cd('0x24')](JSON['stringify']({'id':_0x10492a}))['toString']('base64');var _0x21a327=crypto[_0x18cd('0x25')](0x10)[_0x18cd('0x26')](_0x18cd('0x27'));var _0x4d0a08=getAuthorizationScopes(_0x2b30df);var _0x2386d9=[{'key':_0x18cd('0x28'),'value':_0x2b30df[_0x18cd('0x29')]},{'key':_0x18cd('0x2a'),'value':encodeURIComponent(_0x17f89d[_0x18cd('0x1d')]('\x20'))},{'key':_0x18cd('0x2b'),'value':_0x2b30df['data4']},{'key':_0x18cd('0x2c'),'value':_0x18cd('0x2d')},{'key':'scope','value':encodeURIComponent(_0x4d0a08)},{'key':_0x18cd('0x2e'),'value':_0x1ee1c8},{'key':_0x18cd('0x2f'),'value':_0x21a327},{'key':_0x18cd('0x30'),'value':_0x18cd('0x31')}];var _0x361c35=_0x348008+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x18cd('0x17')](_0x2386d9,function(_0x524a8a){return _0x524a8a[_0x18cd('0x32')]+'='+_0x524a8a['value'];})['join']('&');_0x2b30df[_0x18cd('0x33')]={'issuer':_0x348008['replace'](_0x18cd('0x34'),''),'audience':_0x2b30df[_0x18cd('0x29')],'state':_0x1ee1c8,'nonce':_0x21a327};redis[_0x18cd('0x35')](_0x1ee1c8,JSON[_0x18cd('0x36')](_0x2b30df));return _0x361c35;}function isValidIdToken(_0x168887,_0x477605){try{var _0x5cd4a4=jwt[_0x18cd('0x37')](_0x168887,{'complete':!![]});var _0x1d69a4=_0x5cd4a4[_0x18cd('0x38')];if(_0x1d69a4[_0x18cd('0x39')]!==_0x477605[_0x18cd('0x3a')])return![];if(_0x1d69a4[_0x18cd('0x3b')]!==_0x477605[_0x18cd('0x3c')])return![];if(_0x1d69a4['nonce']!==_0x477605[_0x18cd('0x2f')])return![];if(moment()[_0x18cd('0x3d')](moment[_0x18cd('0x3e')](_0x1d69a4[_0x18cd('0x3f')])))return![];return!![];}catch(_0x2252cb){throw _0x2252cb;}}function refreshOauth2MicrosoftAccessToken(_0x56a804){return Promise[_0x18cd('0x40')]()[_0x18cd('0x41')](function(){if(_0x56a804['data3'])return _0x56a804;return db[_0x18cd('0x42')]['findOne']({'where':{'id':_0x56a804['id']},'raw':!![]});})[_0x18cd('0x41')](function(_0x1e4f8b){var _0x33ee32={'grant_type':'refresh_token','refresh_token':_0x1e4f8b[_0x18cd('0x43')],'scope':getAccessTokenScope(_0x1e4f8b),'redirect_uri':_0x1e4f8b[_0x18cd('0x44')],'client_id':_0x1e4f8b[_0x18cd('0x29')],'client_secret':encryptor['decryptString'](_0x1e4f8b[_0x18cd('0x45')])};var _0xdf49ae={'method':_0x18cd('0x46'),'uri':MICROSOFT_AUTH_URL[_0x18cd('0x47')](_0x18cd('0x20'),_0x1e4f8b[_0x18cd('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x33ee32,'json':!![]};return rp(_0xdf49ae);})[_0x18cd('0x41')](function(_0x51a78d){_0x56a804['data5']=_0x51a78d['access_token'];_0x56a804['data6']=_0x51a78d[_0x18cd('0x48')];return db[_0x18cd('0x42')]['update']({'data5':_0x56a804[_0x18cd('0x49')],'data6':_0x56a804[_0x18cd('0x43')]},{'where':{'id':_0x56a804['id']}});})['then'](function(){return _0x56a804;})[_0x18cd('0x4a')](function(_0x3138a6){logger[_0x18cd('0x4b')](_0x18cd('0x4c'),_0x56a804['id'],_0x3138a6);});}function getOauth2MicrosoftAccessToken(_0x2b6984,_0x1cee30){var _0x4fa4cf={'grant_type':_0x18cd('0x4d'),'code':_0x2b6984,'scope':getAccessTokenScope(_0x1cee30),'redirect_uri':_0x1cee30['data4'],'client_id':_0x1cee30[_0x18cd('0x29')],'client_secret':encryptor['decryptString'](_0x1cee30[_0x18cd('0x45')])};var _0x274ace={'method':_0x18cd('0x46'),'uri':MICROSOFT_AUTH_URL[_0x18cd('0x47')]('{TENANT_ID}',_0x1cee30[_0x18cd('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4fa4cf,'json':!![]};return rp(_0x274ace);}function startRefreshInterval(_0x21b622){var _0x3a94d3=schedule[_0x18cd('0x4e')];if(_0x3a94d3[_0x21b622['id']])clearInterval(_0x3a94d3[_0x21b622['id']]);_0x3a94d3[_0x21b622['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x18cd('0x4f')](this,{'id':_0x21b622['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x18cd('0x4e')]=_0x3a94d3;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x18cd('0x50')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x5b87c9){var _0x42350a=_0x5b87c9['map'](function(_0x5224c8){return refreshOauth2MicrosoftAccessToken(_0x5224c8)[_0x18cd('0x41')](function(_0x41f098){startRefreshInterval(_0x41f098);});});return Promise[_0x18cd('0x51')](_0x42350a);})[_0x18cd('0x4a')](function(_0x5eff70){var _0x5e9e04=_0x5eff70?util[_0x18cd('0x52')](_0x5eff70,{'showHidden':![],'depth':null}):'';logger[_0x18cd('0x4b')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x5e9e04);});}module[_0x18cd('0x53')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xf282=['push','data7','/.default','https://outlook.office365.com/IMAP.AccessAsUser.All','Dynamics365','replace','{TENANT_ID}','data2','id_token','from','toString','randomBytes','hex','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','set','decode','payload','iss','audience','unix','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','map','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf282,0x1cf));var _0x2f28=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf282[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x2f28('0x0'));var crypto=require(_0x2f28('0x1'));var jwt=require(_0x2f28('0x2'));var moment=require('moment');var Redis=require(_0x2f28('0x3'));var rp=require(_0x2f28('0x4'));var util=require(_0x2f28('0x5'));var encryptor=require(_0x2f28('0x6'));var config=require(_0x2f28('0x7'));var logger=require(_0x2f28('0x8'))('api');var schedule=require(_0x2f28('0x9'));var db=require(_0x2f28('0xa'))['db'];config[_0x2f28('0xb')]=_[_0x2f28('0xc')](config[_0x2f28('0xb')],{'host':_0x2f28('0xd'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x2f28('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x2f28('0xf'),'email',_0x2f28('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x2f28('0x11'),_0x2f28('0x12')],'Dynamics365':[_0x2f28('0x13'),_0x2f28('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x2f28('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x2f28('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x27274c){var _0x528428=_['map'](AZURE_AUTH_SCOPES[_0x27274c['type']]);if(_0x27274c[_0x2f28('0x16')]==='Dynamics365')_0x528428[_0x2f28('0x17')](_0x27274c[_0x2f28('0x18')]+_0x2f28('0x19'));return _0x528428['join']('\x20');}function getAccessTokenScope(_0x491c){if(_0x491c['type']==='Outlook365')return _0x2f28('0x1a');if(_0x491c['type']===_0x2f28('0x1b'))return _0x491c[_0x2f28('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x524f57,_0x48585a){var _0x35c4a3=MICROSOFT_AUTH_URL[_0x2f28('0x1c')](_0x2f28('0x1d'),_0x524f57[_0x2f28('0x1e')]);var _0x146d15=['code',_0x2f28('0x1f')];var _0x376d73=Buffer[_0x2f28('0x20')](JSON['stringify']({'id':_0x48585a}))[_0x2f28('0x21')]('base64');var _0x384896=crypto[_0x2f28('0x22')](0x10)[_0x2f28('0x21')](_0x2f28('0x23'));var _0x5a2aa=getAuthorizationScopes(_0x524f57);var _0x147083=[{'key':_0x2f28('0x24'),'value':_0x524f57[_0x2f28('0x25')]},{'key':_0x2f28('0x26'),'value':encodeURIComponent(_0x146d15[_0x2f28('0x27')]('\x20'))},{'key':_0x2f28('0x28'),'value':_0x524f57[_0x2f28('0x29')]},{'key':_0x2f28('0x2a'),'value':_0x2f28('0x2b')},{'key':_0x2f28('0x2c'),'value':encodeURIComponent(_0x5a2aa)},{'key':_0x2f28('0x2d'),'value':_0x376d73},{'key':_0x2f28('0x2e'),'value':_0x384896},{'key':_0x2f28('0x2f'),'value':_0x2f28('0x30')}];var _0xe1f21a=_0x35c4a3+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x147083,function(_0x5c4469){return _0x5c4469[_0x2f28('0x31')]+'='+_0x5c4469['value'];})[_0x2f28('0x27')]('&');_0x524f57[_0x2f28('0x32')]={'issuer':_0x35c4a3[_0x2f28('0x1c')](_0x2f28('0x33'),''),'audience':_0x524f57[_0x2f28('0x25')],'state':_0x376d73,'nonce':_0x384896};redis[_0x2f28('0x34')](_0x376d73,JSON['stringify'](_0x524f57));return _0xe1f21a;}function isValidIdToken(_0x175222,_0xa9cff6){try{var _0x2fe561=jwt[_0x2f28('0x35')](_0x175222,{'complete':!![]});var _0x2f6dc1=_0x2fe561[_0x2f28('0x36')];if(_0x2f6dc1[_0x2f28('0x37')]!==_0xa9cff6['issuer'])return![];if(_0x2f6dc1['aud']!==_0xa9cff6[_0x2f28('0x38')])return![];if(_0x2f6dc1[_0x2f28('0x2e')]!==_0xa9cff6[_0x2f28('0x2e')])return![];if(moment()['isAfter'](moment[_0x2f28('0x39')](_0x2f6dc1['exp'])))return![];return!![];}catch(_0x1b7057){throw _0x1b7057;}}function refreshOauth2MicrosoftAccessToken(_0x2a0e87){return Promise['resolve']()[_0x2f28('0x3a')](function(){if(_0x2a0e87[_0x2f28('0x3b')])return _0x2a0e87;return db[_0x2f28('0x3c')][_0x2f28('0x3d')]({'where':{'id':_0x2a0e87['id']},'raw':!![]});})[_0x2f28('0x3a')](function(_0xa07dbf){var _0x4228e5={'grant_type':_0x2f28('0x3e'),'refresh_token':_0xa07dbf[_0x2f28('0x3f')],'scope':getAccessTokenScope(_0xa07dbf),'redirect_uri':_0xa07dbf[_0x2f28('0x29')],'client_id':_0xa07dbf[_0x2f28('0x25')],'client_secret':encryptor[_0x2f28('0x40')](_0xa07dbf[_0x2f28('0x3b')])};var _0x2f9f82={'method':_0x2f28('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0x2f28('0x1d'),_0xa07dbf[_0x2f28('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4228e5,'json':!![]};return rp(_0x2f9f82);})[_0x2f28('0x3a')](function(_0x44779b){_0x2a0e87[_0x2f28('0x42')]=_0x44779b[_0x2f28('0x43')];_0x2a0e87[_0x2f28('0x3f')]=_0x44779b['refresh_token'];return db['CloudProvider'][_0x2f28('0x44')]({'data5':_0x2a0e87[_0x2f28('0x42')],'data6':_0x2a0e87['data6']},{'where':{'id':_0x2a0e87['id']}});})[_0x2f28('0x3a')](function(){return _0x2a0e87;})[_0x2f28('0x45')](function(_0x3d0a01){logger[_0x2f28('0x46')](_0x2f28('0x47'),_0x2a0e87['id'],_0x3d0a01);});}function getOauth2MicrosoftAccessToken(_0x3c328a,_0x4795f9){var _0x381e12={'grant_type':_0x2f28('0x48'),'code':_0x3c328a,'scope':getAccessTokenScope(_0x4795f9),'redirect_uri':_0x4795f9[_0x2f28('0x29')],'client_id':_0x4795f9[_0x2f28('0x25')],'client_secret':encryptor['decryptString'](_0x4795f9[_0x2f28('0x3b')])};var _0x4abd90={'method':_0x2f28('0x41'),'uri':MICROSOFT_AUTH_URL[_0x2f28('0x1c')](_0x2f28('0x1d'),_0x4795f9[_0x2f28('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x381e12,'json':!![]};return rp(_0x4abd90);}function startRefreshInterval(_0x2b1893){var _0x37687c=schedule[_0x2f28('0x49')];if(_0x37687c[_0x2b1893['id']])clearInterval(_0x37687c[_0x2b1893['id']]);_0x37687c[_0x2b1893['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x2f28('0x4a')](this,{'id':_0x2b1893['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x2f28('0x49')]=_0x37687c;}function startAllRefreshIntervals(){return db[_0x2f28('0x3c')][_0x2f28('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x2f28('0x3a')](function(_0x3a901d){var _0x36321f=_0x3a901d[_0x2f28('0x4c')](function(_0x530fef){return refreshOauth2MicrosoftAccessToken(_0x530fef)['then'](function(_0x4d3a59){startRefreshInterval(_0x4d3a59);});});return Promise[_0x2f28('0x4d')](_0x36321f);})[_0x2f28('0x45')](function(_0x44eca7){var _0x543a56=_0x44eca7?util[_0x2f28('0x4e')](_0x44eca7,{'showHidden':![],'depth':null}):'';logger['error'](_0x2f28('0x4f'),_0x543a56);});}module[_0x2f28('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 323fa49..e03cccd 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 _0xedf1=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x4f268a,_0x553d89){var _0x4eb3dc=function(_0x216cb2){while(--_0x216cb2){_0x4f268a['push'](_0x4f268a['shift']());}};_0x4eb3dc(++_0x553d89);}(_0xedf1,0xb2));var _0x1edf=function(_0x81d5d9,_0x1edd71){_0x81d5d9=_0x81d5d9-0x0;var _0x1805cb=_0xedf1[_0x81d5d9];return _0x1805cb;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1edf('0x2'));var fs=require('fs');var Redis=require(_0x1edf('0x3'));var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615b2,_0x1029fe,_0x20b629){return new BPromise(function(_0x12293b,_0x206f63){return client[_0x1edf('0x9')](_0x1615b2,_0x20b629)[_0x1edf('0xa')](function(_0x30a13f){logger['info'](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));logger[_0x1edf('0xd')](_0x1edf('0xe'),_0x1029fe,'request\x20sent',JSON[_0x1edf('0xf')](_0x30a13f));if(_0x30a13f['error']){if(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x11')]===0x1f4){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x206f63(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);}logger[_0x1edf('0x10')]('CloudProvider,\x20%s,\x20%s',_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x12293b(_0x30a13f['error'][_0x1edf('0x12')]);}else{logger[_0x1edf('0x13')](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));_0x12293b(_0x30a13f[_0x1edf('0x14')][_0x1edf('0x12')]);}})['catch'](function(_0x4f2584){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x4f2584);_0x206f63(_0x4f2584);});});} \ No newline at end of file +var _0xab54=['error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x5ee5af,_0x52369f){var _0x1fdd47=function(_0x906004){while(--_0x906004){_0x5ee5af['push'](_0x5ee5af['shift']());}};_0x1fdd47(++_0x52369f);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4ab5('0x0'));var moment=require(_0x4ab5('0x1'));var BPromise=require(_0x4ab5('0x2'));var rs=require(_0x4ab5('0x3'));var fs=require('fs');var Redis=require(_0x4ab5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ab5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4ab5('0x6'));var client=jayson[_0x4ab5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c39fe,_0x5c8c61,_0x467942){return new BPromise(function(_0x600112,_0xd57886){return client[_0x4ab5('0x8')](_0x2c39fe,_0x467942)['then'](function(_0x58e6a7){logger['info'](_0x4ab5('0x9'),_0x5c8c61,_0x4ab5('0xa'));logger['debug'](_0x4ab5('0xb'),_0x5c8c61,_0x4ab5('0xa'),JSON['stringify'](_0x58e6a7));if(_0x58e6a7[_0x4ab5('0xc')]){if(_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xd')]===0x1f4){logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);return _0xd57886(_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);}logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);return _0x600112(_0x58e6a7[_0x4ab5('0xc')]['message']);}else{logger[_0x4ab5('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5c8c61,_0x4ab5('0xa'));_0x600112(_0x58e6a7['result']['message']);}})[_0x4ab5('0x10')](function(_0x1b1ca5){logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x1b1ca5);_0xd57886(_0x1b1ca5);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c3cc363..5b7a3db 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x4199c3,_0x3d2223){var _0x3ccdab=function(_0x496206){while(--_0x496206){_0x4199c3['push'](_0x4199c3['shift']());}};_0x3ccdab(++_0x3d2223);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=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(_0xfebdd7,_0x1bdd61){var _0x180cf8=function(_0x78a1b7){while(--_0x78a1b7){_0xfebdd7['push'](_0xfebdd7['shift']());}};_0x180cf8(++_0x1bdd61);}(_0xdb28,0x106));var _0x8db2=function(_0x5378be,_0x960d3d){_0x5378be=_0x5378be-0x0;var _0x5777a5=_0xdb28[_0x5378be];return _0x5777a5;};'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 7a89087..e0561b7 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 _0x9bad=['sequelize','STRING','name'];(function(_0x5c2454,_0x4b1584){var _0xc8a390=function(_0x53220b){while(--_0x53220b){_0x5c2454['push'](_0x5c2454['shift']());}};_0xc8a390(++_0x4b1584);}(_0x9bad,0xa2));var _0xd9ba=function(_0x50c5a9,_0x432235){_0x50c5a9=_0x50c5a9-0x0;var _0x5f4a09=_0x9bad[_0x50c5a9];return _0x5f4a09;};'use strict';var Sequelize=require(_0xd9ba('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9ba('0x1')],'unique':_0xd9ba('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xd9ba('0x1')]},'website':{'type':Sequelize[_0xd9ba('0x1')]},'phone':{'type':Sequelize[_0xd9ba('0x1')]},'fax':{'type':Sequelize[_0xd9ba('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd9ba('0x1')]},'postalCode':{'type':Sequelize[_0xd9ba('0x1')]},'city':{'type':Sequelize[_0xd9ba('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd9ba('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd9ba('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xd9ba('0x1')]},'sCountry':{'type':Sequelize[_0xd9ba('0x1')]},'description':{'type':Sequelize[_0xd9ba('0x1')]}}; \ No newline at end of file +var _0x351b=['exports','STRING','name','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x351b,0xf7));var _0xb351=function(_0x3de9c7,_0x4da6b8){_0x3de9c7=_0x3de9c7-0x0;var _0x1c5538=_0x351b[_0x3de9c7];return _0x1c5538;};'use strict';var Sequelize=require(_0xb351('0x0'));module[_0xb351('0x1')]={'name':{'type':Sequelize[_0xb351('0x2')],'unique':_0xb351('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb351('0x2')]},'companyId':{'type':Sequelize[_0xb351('0x2')]},'website':{'type':Sequelize[_0xb351('0x2')]},'phone':{'type':Sequelize[_0xb351('0x2')]},'fax':{'type':Sequelize[_0xb351('0x2')]},'type':{'type':Sequelize[_0xb351('0x2')]},'street':{'type':Sequelize[_0xb351('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb351('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb351('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xb351('0x2')]},'sPostalCode':{'type':Sequelize[_0xb351('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xb351('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f20f296..516ebb6 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 _0x7dda=['findAll','rows','catch','show','rawAttributes','intersection','find','create','CmCompany','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','params','CmContact','ids','getContacts','findOne','sort','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','apply','save','update','then','get','Companies','UserProfileResource','destroy','stack','name','send','index','describe','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','merge','where','map','options','count','includeAll','include'];(function(_0x42235f,_0x5dabfd){var _0x3f5fab=function(_0x358fd7){while(--_0x358fd7){_0x42235f['push'](_0x42235f['shift']());}};_0x3f5fab(++_0x5dabfd);}(_0x7dda,0x6c));var _0xa7dd=function(_0x547030,_0x3aff53){_0x547030=_0x547030-0x0;var _0x10140b=_0x7dda[_0x547030];return _0x10140b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7dd('0x0'));var zipdir=require(_0xa7dd('0x1'));var jsonpatch=require(_0xa7dd('0x2'));var rp=require(_0xa7dd('0x3'));var moment=require(_0xa7dd('0x4'));var BPromise=require(_0xa7dd('0x5'));var Mustache=require(_0xa7dd('0x6'));var util=require(_0xa7dd('0x7'));var path=require(_0xa7dd('0x8'));var sox=require(_0xa7dd('0x9'));var csv=require(_0xa7dd('0xa'));var ejs=require(_0xa7dd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7dd('0xc'));var squel=require(_0xa7dd('0xd'));var crypto=require(_0xa7dd('0xe'));var jsforce=require(_0xa7dd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa7dd('0xa'));var querystring=require(_0xa7dd('0x10'));var Papa=require(_0xa7dd('0x11'));var Redis=require('ioredis');var authService=require(_0xa7dd('0x12'));var qs=require(_0xa7dd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7dd('0x14'));var logger=require('../../config/logger')(_0xa7dd('0x15'));var utils=require(_0xa7dd('0x16'));var config=require(_0xa7dd('0x17'));var licenseUtil=require(_0xa7dd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23d1f7,_0x376843){_0x376843=_0x376843||0xcc;return function(_0x4a27f8){if(_0x4a27f8){return _0x23d1f7[_0xa7dd('0x19')](_0x376843);}return _0x23d1f7[_0xa7dd('0x1a')](_0x376843)['end']();};}function respondWithResult(_0x357f9a,_0xc786a7){_0xc786a7=_0xc786a7||0xc8;return function(_0x5b2a10){if(_0x5b2a10){return _0x357f9a[_0xa7dd('0x1a')](_0xc786a7)[_0xa7dd('0x1b')](_0x5b2a10);}};}function respondWithFilteredResult(_0x14755d,_0x52ef4c){return function(_0x3e2713){if(_0x3e2713){var _0x5973c0=typeof _0x52ef4c[_0xa7dd('0x1c')]==='undefined'&&typeof _0x52ef4c[_0xa7dd('0x1d')]==='undefined';var _0x5f517b=_0x3e2713['count'];var _0x3d54f9=_0x5973c0?0x0:_0x52ef4c[_0xa7dd('0x1c')];var _0x4e8fbd=_0x5973c0?_0x3e2713['count']:_0x52ef4c[_0xa7dd('0x1c')]+_0x52ef4c['limit'];var _0x17305e;if(_0x4e8fbd>=_0x5f517b){_0x4e8fbd=_0x5f517b;_0x17305e=0xc8;}else{_0x17305e=0xce;}_0x14755d[_0xa7dd('0x1a')](_0x17305e);return _0x14755d[_0xa7dd('0x1e')]('Content-Range',_0x3d54f9+'-'+_0x4e8fbd+'/'+_0x5f517b)[_0xa7dd('0x1b')](_0x3e2713);}return null;};}function patchUpdates(_0x1448b3){return function(_0x11af94){try{jsonpatch[_0xa7dd('0x1f')](_0x11af94,_0x1448b3,!![]);}catch(_0x11c603){return BPromise['reject'](_0x11c603);}return _0x11af94[_0xa7dd('0x20')]();};}function saveUpdates(_0x519376,_0x42274a){return function(_0x3ff21f){if(_0x3ff21f){return _0x3ff21f[_0xa7dd('0x21')](_0x519376)[_0xa7dd('0x22')](function(_0x3d0143){return _0x3d0143;});}return null;};}function removeEntity(_0x3771f0,_0x4e5542){return function(_0x79c7f9){if(_0x79c7f9){return _0x79c7f9['destroy']()[_0xa7dd('0x22')](function(){var _0x6fbfe0=_0x79c7f9[_0xa7dd('0x23')]({'plain':!![]});var _0xfeced0=_0xa7dd('0x24');return db[_0xa7dd('0x25')][_0xa7dd('0x26')]({'where':{'type':_0xfeced0,'resourceId':_0x6fbfe0['id']}})[_0xa7dd('0x22')](function(){return _0x79c7f9;});})['then'](function(){_0x3771f0[_0xa7dd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32cfe8,_0x30cb75){return function(_0xa2d781){if(!_0xa2d781){_0x32cfe8[_0xa7dd('0x19')](0x194);}return _0xa2d781;};}function handleError(_0x337808,_0x475bb5){_0x475bb5=_0x475bb5||0x1f4;return function(_0x23723f){logger['error'](_0x23723f[_0xa7dd('0x27')]);if(_0x23723f[_0xa7dd('0x28')]){delete _0x23723f['name'];}_0x337808[_0xa7dd('0x1a')](_0x475bb5)[_0xa7dd('0x29')](_0x23723f);};}exports[_0xa7dd('0x2a')]=function(_0xa5481,_0xd6a17c){var _0xeb0745={},_0x2095a6={},_0x110cfb={'count':0x0,'rows':[]};return db['CmCompany'][_0xa7dd('0x2b')]()['then'](function(_0x2f8256){_0x2095a6[_0xa7dd('0x2c')]=_[_0xa7dd('0x2d')](_0x2f8256);_0x2095a6[_0xa7dd('0x2e')]=_['keys'](_0xa5481['query']);_0x2095a6['filters']=_['intersection'](_0x2095a6[_0xa7dd('0x2c')],_0x2095a6['query']);_0xeb0745[_0xa7dd('0x2f')]=_['intersection'](_0x2095a6['model'],qs[_0xa7dd('0x30')](_0xa5481[_0xa7dd('0x2e')][_0xa7dd('0x30')]));_0xeb0745['attributes']=_0xeb0745['attributes'][_0xa7dd('0x31')]?_0xeb0745[_0xa7dd('0x2f')]:_0x2095a6['model'];if(!_0xa5481[_0xa7dd('0x2e')][_0xa7dd('0x32')](_0xa7dd('0x33'))){_0xeb0745['limit']=qs[_0xa7dd('0x1d')](_0xa5481[_0xa7dd('0x2e')][_0xa7dd('0x1d')]);_0xeb0745['offset']=qs['offset'](_0xa5481['query'][_0xa7dd('0x1c')]);}_0xeb0745[_0xa7dd('0x34')]=qs['sort'](_0xa5481[_0xa7dd('0x2e')]['sort']);_0xeb0745['where']=qs[_0xa7dd('0x35')](_[_0xa7dd('0x36')](_0xa5481[_0xa7dd('0x2e')],_0x2095a6[_0xa7dd('0x35')]),_0x2f8256);if(_0xa5481[_0xa7dd('0x2e')]['filter']){_0xeb0745['where']=_[_0xa7dd('0x37')](_0xeb0745[_0xa7dd('0x38')],{'$or':_[_0xa7dd('0x39')](_0xeb0745['attributes'],function(_0x3cdbe3){var _0x20fa63={};_0x20fa63[_0x3cdbe3]={'$like':'%'+_0xa5481[_0xa7dd('0x2e')]['filter']+'%'};return _0x20fa63;})});}_0xeb0745=_[_0xa7dd('0x37')]({},_0xeb0745,_0xa5481[_0xa7dd('0x3a')]);var _0xd59b77={'where':_0xeb0745[_0xa7dd('0x38')]};return db['CmCompany']['count'](_0xd59b77)['then'](function(_0xbce821){_0x110cfb[_0xa7dd('0x3b')]=_0xbce821;if(_0xa5481['query'][_0xa7dd('0x3c')]){_0xeb0745[_0xa7dd('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xa7dd('0x3e')](_0xeb0745);})[_0xa7dd('0x22')](function(_0x2238ca){_0x110cfb[_0xa7dd('0x3f')]=_0x2238ca;return _0x110cfb;})['then'](respondWithFilteredResult(_0xd6a17c,_0xeb0745))[_0xa7dd('0x40')](handleError(_0xd6a17c,null));})['catch'](handleError(_0xd6a17c,null));};exports[_0xa7dd('0x41')]=function(_0x56fe4e,_0xea03ec){var _0x4de598={'raw':![],'where':{'id':_0x56fe4e['params']['id']}},_0x34d844={};_0x34d844[_0xa7dd('0x2c')]=_[_0xa7dd('0x2d')](db['CmCompany'][_0xa7dd('0x42')]);_0x34d844[_0xa7dd('0x2e')]=_[_0xa7dd('0x2d')](_0x56fe4e['query']);_0x34d844[_0xa7dd('0x35')]=_[_0xa7dd('0x43')](_0x34d844[_0xa7dd('0x2c')],_0x34d844[_0xa7dd('0x2e')]);_0x4de598[_0xa7dd('0x2f')]=_['intersection'](_0x34d844[_0xa7dd('0x2c')],qs['fields'](_0x56fe4e[_0xa7dd('0x2e')][_0xa7dd('0x30')]));_0x4de598[_0xa7dd('0x2f')]=_0x4de598['attributes']['length']?_0x4de598['attributes']:_0x34d844['model'];if(_0x56fe4e[_0xa7dd('0x2e')][_0xa7dd('0x3c')]){_0x4de598[_0xa7dd('0x3d')]=[{'all':!![]}];}_0x4de598=_[_0xa7dd('0x37')]({},_0x4de598,_0x56fe4e[_0xa7dd('0x3a')]);return db['CmCompany'][_0xa7dd('0x44')](_0x4de598)[_0xa7dd('0x22')](handleEntityNotFound(_0xea03ec,null))[_0xa7dd('0x22')](respondWithResult(_0xea03ec,null))[_0xa7dd('0x40')](handleError(_0xea03ec,null));};exports[_0xa7dd('0x45')]=function(_0xf69ff8,_0x56b528){return db[_0xa7dd('0x46')][_0xa7dd('0x45')](_0xf69ff8[_0xa7dd('0x47')],{})[_0xa7dd('0x22')](function(_0x5dc0ac){var _0x3252a6=_0xf69ff8['user']['get']({'plain':!![]});if(!_0x3252a6)throw new Error(_0xa7dd('0x48'));if(_0x3252a6['role']===_0xa7dd('0x49')){var _0x1c2c23=_0x5dc0ac[_0xa7dd('0x23')]({'plain':!![]});var _0x22051f=_0xa7dd('0x24');return db[_0xa7dd('0x4a')]['find']({'where':{'name':_0x22051f,'userProfileId':_0x3252a6[_0xa7dd('0x4b')]},'raw':!![]})[_0xa7dd('0x22')](function(_0x46d871){if(_0x46d871&&_0x46d871[_0xa7dd('0x4c')]===0x0){return db[_0xa7dd('0x25')][_0xa7dd('0x45')]({'name':_0x1c2c23['name'],'resourceId':_0x1c2c23['id'],'type':_0x46d871['name'],'sectionId':_0x46d871['id']},{})[_0xa7dd('0x22')](function(){return _0x5dc0ac;});}else{return _0x5dc0ac;}})[_0xa7dd('0x40')](function(_0x11f095){logger[_0xa7dd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11f095);throw _0x11f095;});}return _0x5dc0ac;})['then'](respondWithResult(_0x56b528,0xc9))['catch'](handleError(_0x56b528,null));};exports['update']=function(_0x4be83d,_0x3becdc){if(_0x4be83d[_0xa7dd('0x47')]['id']){delete _0x4be83d[_0xa7dd('0x47')]['id'];}return db[_0xa7dd('0x46')][_0xa7dd('0x44')]({'where':{'id':_0x4be83d[_0xa7dd('0x4e')]['id']}})[_0xa7dd('0x22')](handleEntityNotFound(_0x3becdc,null))[_0xa7dd('0x22')](saveUpdates(_0x4be83d[_0xa7dd('0x47')],null))[_0xa7dd('0x22')](respondWithResult(_0x3becdc,null))[_0xa7dd('0x40')](handleError(_0x3becdc,null));};exports[_0xa7dd('0x26')]=function(_0x15bac7,_0x2648ae){return db[_0xa7dd('0x46')]['find']({'where':{'id':_0x15bac7[_0xa7dd('0x4e')]['id']}})[_0xa7dd('0x22')](handleEntityNotFound(_0x2648ae,null))[_0xa7dd('0x22')](removeEntity(_0x2648ae,null))[_0xa7dd('0x40')](handleError(_0x2648ae,null));};exports[_0xa7dd('0x2b')]=function(_0xdaa9f,_0x1a8cbc){return db[_0xa7dd('0x46')][_0xa7dd('0x2b')]()[_0xa7dd('0x22')](respondWithResult(_0x1a8cbc,null))[_0xa7dd('0x40')](handleError(_0x1a8cbc,null));};exports['addContacts']=function(_0x2b339a,_0x2890d1,_0x3cd297){return db[_0xa7dd('0x4f')][_0xa7dd('0x44')]({'where':{'id':_0x2b339a['params']['id']}})[_0xa7dd('0x22')](handleEntityNotFound(_0x2890d1,null))['then'](function(_0x353062){if(_0x353062){return _0x353062['addContacts'](_0x2b339a[_0xa7dd('0x47')][_0xa7dd('0x50')],_['omit'](_0x2b339a[_0xa7dd('0x47')],[_0xa7dd('0x50'),'id'])||{});}})[_0xa7dd('0x22')](respondWithResult(_0x2890d1,null))[_0xa7dd('0x40')](handleError(_0x2890d1,null));};exports[_0xa7dd('0x51')]=function(_0x270851,_0x51ea61,_0x3eb33b){var _0x4fb5c2={};var _0x263142={};var _0x525b78;var _0x2b3ea2;return db[_0xa7dd('0x46')][_0xa7dd('0x52')]({'where':{'id':_0x270851['params']['id']}})[_0xa7dd('0x22')](handleEntityNotFound(_0x51ea61,null))[_0xa7dd('0x22')](function(_0x1f4e0d){if(_0x1f4e0d){_0x525b78=_0x1f4e0d;_0x263142[_0xa7dd('0x2c')]=_[_0xa7dd('0x2d')](db[_0xa7dd('0x4f')]['rawAttributes']);_0x263142[_0xa7dd('0x2e')]=_[_0xa7dd('0x2d')](_0x270851[_0xa7dd('0x2e')]);_0x263142[_0xa7dd('0x35')]=_['intersection'](_0x263142[_0xa7dd('0x2c')],_0x263142[_0xa7dd('0x2e')]);_0x4fb5c2[_0xa7dd('0x2f')]=_[_0xa7dd('0x43')](_0x263142[_0xa7dd('0x2c')],qs['fields'](_0x270851['query']['fields']));_0x4fb5c2[_0xa7dd('0x2f')]=_0x4fb5c2['attributes'][_0xa7dd('0x31')]?_0x4fb5c2[_0xa7dd('0x2f')]:_0x263142[_0xa7dd('0x2c')];_0x4fb5c2[_0xa7dd('0x34')]=qs['sort'](_0x270851[_0xa7dd('0x2e')][_0xa7dd('0x53')]);_0x4fb5c2[_0xa7dd('0x38')]=qs[_0xa7dd('0x35')](_[_0xa7dd('0x36')](_0x270851['query'],_0x263142[_0xa7dd('0x35')]));if(_0x270851[_0xa7dd('0x2e')][_0xa7dd('0x54')]){_0x4fb5c2[_0xa7dd('0x38')]=_['merge'](_0x4fb5c2[_0xa7dd('0x38')],{'$or':_[_0xa7dd('0x39')](_0x4fb5c2['attributes'],function(_0x2f6cb4){var _0x4be600={};_0x4be600[_0x2f6cb4]={'$like':'%'+_0x270851[_0xa7dd('0x2e')][_0xa7dd('0x54')]+'%'};return _0x4be600;})});}_0x4fb5c2=_['merge']({},_0x4fb5c2,_0x270851[_0xa7dd('0x3a')]);return _0x525b78[_0xa7dd('0x51')](_0x4fb5c2);}})[_0xa7dd('0x22')](function(_0x1c7a2b){if(_0x1c7a2b){_0x2b3ea2=_0x1c7a2b[_0xa7dd('0x31')];if(!_0x270851[_0xa7dd('0x2e')][_0xa7dd('0x32')]('nolimit')){_0x4fb5c2['limit']=qs['limit'](_0x270851[_0xa7dd('0x2e')][_0xa7dd('0x1d')]);_0x4fb5c2[_0xa7dd('0x1c')]=qs[_0xa7dd('0x1c')](_0x270851['query']['offset']);}return _0x525b78[_0xa7dd('0x51')](_0x4fb5c2);}})[_0xa7dd('0x22')](function(_0x3db592){if(_0x3db592){return _0x3db592?{'count':_0x2b3ea2,'rows':_0x3db592}:null;}})[_0xa7dd('0x22')](respondWithResult(_0x51ea61,null))[_0xa7dd('0x40')](handleError(_0x51ea61,null));}; \ No newline at end of file +var _0xe8dd=['bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','destroy','then','Companies','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','filters','where','filter','options','findAll','rows','catch','rawAttributes','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','params','addContacts','CmContact','ids','getContacts','findOne','merge','nolimit','eml-format','rimraf','zip-dir','moment'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xe8dd,0x1a0));var _0xde8d=function(_0x56a757,_0x255ce4){_0x56a757=_0x56a757-0x0;var _0x4beae0=_0xe8dd[_0x56a757];return _0x4beae0;};'use strict';var emlformat=require(_0xde8d('0x0'));var rimraf=require(_0xde8d('0x1'));var zipdir=require(_0xde8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde8d('0x3'));var BPromise=require(_0xde8d('0x4'));var Mustache=require(_0xde8d('0x5'));var util=require(_0xde8d('0x6'));var path=require(_0xde8d('0x7'));var sox=require(_0xde8d('0x8'));var csv=require(_0xde8d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde8d('0xa'));var _=require('lodash');var squel=require(_0xde8d('0xb'));var crypto=require(_0xde8d('0xc'));var jsforce=require(_0xde8d('0xd'));var deskjs=require(_0xde8d('0xe'));var toCsv=require(_0xde8d('0x9'));var querystring=require(_0xde8d('0xf'));var Papa=require(_0xde8d('0x10'));var Redis=require(_0xde8d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xde8d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde8d('0x13'));var logger=require(_0xde8d('0x14'))(_0xde8d('0x15'));var utils=require(_0xde8d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde8d('0x17'));var db=require(_0xde8d('0x18'))['db'];function respondWithStatusCode(_0x23de7d,_0x44fb68){_0x44fb68=_0x44fb68||0xcc;return function(_0x53840e){if(_0x53840e){return _0x23de7d[_0xde8d('0x19')](_0x44fb68);}return _0x23de7d['status'](_0x44fb68)['end']();};}function respondWithResult(_0xe7a681,_0x13bdc2){_0x13bdc2=_0x13bdc2||0xc8;return function(_0x40e071){if(_0x40e071){return _0xe7a681['status'](_0x13bdc2)[_0xde8d('0x1a')](_0x40e071);}};}function respondWithFilteredResult(_0x3bdc71,_0x1eeb3c){return function(_0x502d81){if(_0x502d81){var _0x1ec523=typeof _0x1eeb3c[_0xde8d('0x1b')]===_0xde8d('0x1c')&&typeof _0x1eeb3c[_0xde8d('0x1d')]===_0xde8d('0x1c');var _0x14d95e=_0x502d81[_0xde8d('0x1e')];var _0x59bd45=_0x1ec523?0x0:_0x1eeb3c[_0xde8d('0x1b')];var _0x348306=_0x1ec523?_0x502d81[_0xde8d('0x1e')]:_0x1eeb3c[_0xde8d('0x1b')]+_0x1eeb3c['limit'];var _0x5c661d;if(_0x348306>=_0x14d95e){_0x348306=_0x14d95e;_0x5c661d=0xc8;}else{_0x5c661d=0xce;}_0x3bdc71[_0xde8d('0x1f')](_0x5c661d);return _0x3bdc71[_0xde8d('0x20')](_0xde8d('0x21'),_0x59bd45+'-'+_0x348306+'/'+_0x14d95e)[_0xde8d('0x1a')](_0x502d81);}return null;};}function patchUpdates(_0x39725f){return function(_0xff2485){try{jsonpatch[_0xde8d('0x22')](_0xff2485,_0x39725f,!![]);}catch(_0x3ead49){return BPromise['reject'](_0x3ead49);}return _0xff2485[_0xde8d('0x23')]();};}function saveUpdates(_0x4fa9fc,_0x5b7783){return function(_0x3b0e6f){if(_0x3b0e6f){return _0x3b0e6f[_0xde8d('0x24')](_0x4fa9fc)['then'](function(_0x4c1656){return _0x4c1656;});}return null;};}function removeEntity(_0x56037c,_0x446f7c){return function(_0x3dfa62){if(_0x3dfa62){return _0x3dfa62[_0xde8d('0x25')]()[_0xde8d('0x26')](function(){var _0xf4671f=_0x3dfa62['get']({'plain':!![]});var _0x962404=_0xde8d('0x27');return db[_0xde8d('0x28')][_0xde8d('0x25')]({'where':{'type':_0x962404,'resourceId':_0xf4671f['id']}})['then'](function(){return _0x3dfa62;});})['then'](function(){_0x56037c[_0xde8d('0x1f')](0xcc)[_0xde8d('0x29')]();});}};}function handleEntityNotFound(_0x40b135,_0x3c5736){return function(_0x11206c){if(!_0x11206c){_0x40b135[_0xde8d('0x19')](0x194);}return _0x11206c;};}function handleError(_0x6d1bf1,_0x1b9419){_0x1b9419=_0x1b9419||0x1f4;return function(_0x38e3f7){logger[_0xde8d('0x2a')](_0x38e3f7[_0xde8d('0x2b')]);if(_0x38e3f7[_0xde8d('0x2c')]){delete _0x38e3f7[_0xde8d('0x2c')];}_0x6d1bf1[_0xde8d('0x1f')](_0x1b9419)[_0xde8d('0x2d')](_0x38e3f7);};}exports[_0xde8d('0x2e')]=function(_0x53809b,_0x1dcc61){var _0x1b3754={},_0x578061={},_0x122229={'count':0x0,'rows':[]};return db[_0xde8d('0x2f')][_0xde8d('0x30')]()[_0xde8d('0x26')](function(_0x5dfb51){_0x578061['model']=_['keys'](_0x5dfb51);_0x578061[_0xde8d('0x31')]=_[_0xde8d('0x32')](_0x53809b[_0xde8d('0x31')]);_0x578061['filters']=_[_0xde8d('0x33')](_0x578061[_0xde8d('0x34')],_0x578061[_0xde8d('0x31')]);_0x1b3754['attributes']=_[_0xde8d('0x33')](_0x578061[_0xde8d('0x34')],qs['fields'](_0x53809b['query'][_0xde8d('0x35')]));_0x1b3754[_0xde8d('0x36')]=_0x1b3754[_0xde8d('0x36')]['length']?_0x1b3754[_0xde8d('0x36')]:_0x578061['model'];if(!_0x53809b[_0xde8d('0x31')][_0xde8d('0x37')]('nolimit')){_0x1b3754[_0xde8d('0x1d')]=qs['limit'](_0x53809b[_0xde8d('0x31')][_0xde8d('0x1d')]);_0x1b3754[_0xde8d('0x1b')]=qs['offset'](_0x53809b['query'][_0xde8d('0x1b')]);}_0x1b3754[_0xde8d('0x38')]=qs[_0xde8d('0x39')](_0x53809b[_0xde8d('0x31')][_0xde8d('0x39')]);_0x1b3754['where']=qs[_0xde8d('0x3a')](_['pick'](_0x53809b[_0xde8d('0x31')],_0x578061[_0xde8d('0x3a')]),_0x5dfb51);if(_0x53809b[_0xde8d('0x31')]['filter']){_0x1b3754[_0xde8d('0x3b')]=_['merge'](_0x1b3754[_0xde8d('0x3b')],{'$or':_['map'](_0x1b3754['attributes'],function(_0xf1284){var _0x3eb1e4={};_0x3eb1e4[_0xf1284]={'$like':'%'+_0x53809b[_0xde8d('0x31')][_0xde8d('0x3c')]+'%'};return _0x3eb1e4;})});}_0x1b3754=_['merge']({},_0x1b3754,_0x53809b[_0xde8d('0x3d')]);var _0x1283d7={'where':_0x1b3754[_0xde8d('0x3b')]};return db[_0xde8d('0x2f')]['count'](_0x1283d7)[_0xde8d('0x26')](function(_0x487a5b){_0x122229[_0xde8d('0x1e')]=_0x487a5b;if(_0x53809b['query']['includeAll']){_0x1b3754['include']=[{'all':!![]}];}return db[_0xde8d('0x2f')][_0xde8d('0x3e')](_0x1b3754);})[_0xde8d('0x26')](function(_0x5b3eca){_0x122229[_0xde8d('0x3f')]=_0x5b3eca;return _0x122229;})[_0xde8d('0x26')](respondWithFilteredResult(_0x1dcc61,_0x1b3754))[_0xde8d('0x40')](handleError(_0x1dcc61,null));})[_0xde8d('0x40')](handleError(_0x1dcc61,null));};exports['show']=function(_0x2bc28b,_0x6ecc47){var _0x1a1ec8={'raw':![],'where':{'id':_0x2bc28b['params']['id']}},_0x301e65={};_0x301e65[_0xde8d('0x34')]=_[_0xde8d('0x32')](db['CmCompany'][_0xde8d('0x41')]);_0x301e65['query']=_['keys'](_0x2bc28b['query']);_0x301e65[_0xde8d('0x3a')]=_[_0xde8d('0x33')](_0x301e65['model'],_0x301e65[_0xde8d('0x31')]);_0x1a1ec8[_0xde8d('0x36')]=_[_0xde8d('0x33')](_0x301e65[_0xde8d('0x34')],qs['fields'](_0x2bc28b['query'][_0xde8d('0x35')]));_0x1a1ec8['attributes']=_0x1a1ec8[_0xde8d('0x36')][_0xde8d('0x42')]?_0x1a1ec8['attributes']:_0x301e65[_0xde8d('0x34')];if(_0x2bc28b[_0xde8d('0x31')][_0xde8d('0x43')]){_0x1a1ec8['include']=[{'all':!![]}];}_0x1a1ec8=_['merge']({},_0x1a1ec8,_0x2bc28b['options']);return db['CmCompany'][_0xde8d('0x44')](_0x1a1ec8)[_0xde8d('0x26')](handleEntityNotFound(_0x6ecc47,null))['then'](respondWithResult(_0x6ecc47,null))[_0xde8d('0x40')](handleError(_0x6ecc47,null));};exports[_0xde8d('0x45')]=function(_0x469a30,_0x3a59c1){return db[_0xde8d('0x2f')][_0xde8d('0x45')](_0x469a30[_0xde8d('0x46')],{})['then'](function(_0x27b3e4){var _0x5f4237=_0x469a30[_0xde8d('0x47')][_0xde8d('0x48')]({'plain':!![]});if(!_0x5f4237)throw new Error(_0xde8d('0x49'));if(_0x5f4237['role']===_0xde8d('0x47')){var _0x12c0db=_0x27b3e4[_0xde8d('0x48')]({'plain':!![]});var _0x2a4d4c=_0xde8d('0x27');return db['UserProfileSection'][_0xde8d('0x44')]({'where':{'name':_0x2a4d4c,'userProfileId':_0x5f4237[_0xde8d('0x4a')]},'raw':!![]})[_0xde8d('0x26')](function(_0x3cd45d){if(_0x3cd45d&&_0x3cd45d[_0xde8d('0x4b')]===0x0){return db[_0xde8d('0x28')][_0xde8d('0x45')]({'name':_0x12c0db[_0xde8d('0x2c')],'resourceId':_0x12c0db['id'],'type':_0x3cd45d[_0xde8d('0x2c')],'sectionId':_0x3cd45d['id']},{})[_0xde8d('0x26')](function(){return _0x27b3e4;});}else{return _0x27b3e4;}})[_0xde8d('0x40')](function(_0x42b9c1){logger[_0xde8d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42b9c1);throw _0x42b9c1;});}return _0x27b3e4;})[_0xde8d('0x26')](respondWithResult(_0x3a59c1,0xc9))[_0xde8d('0x40')](handleError(_0x3a59c1,null));};exports[_0xde8d('0x24')]=function(_0x1919ba,_0x6f2090){if(_0x1919ba[_0xde8d('0x46')]['id']){delete _0x1919ba[_0xde8d('0x46')]['id'];}return db['CmCompany'][_0xde8d('0x44')]({'where':{'id':_0x1919ba[_0xde8d('0x4c')]['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x6f2090,null))[_0xde8d('0x26')](saveUpdates(_0x1919ba[_0xde8d('0x46')],null))[_0xde8d('0x26')](respondWithResult(_0x6f2090,null))['catch'](handleError(_0x6f2090,null));};exports[_0xde8d('0x25')]=function(_0x53a472,_0x560247){return db[_0xde8d('0x2f')][_0xde8d('0x44')]({'where':{'id':_0x53a472['params']['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x560247,null))[_0xde8d('0x26')](removeEntity(_0x560247,null))[_0xde8d('0x40')](handleError(_0x560247,null));};exports[_0xde8d('0x30')]=function(_0x11bfc8,_0x48a41d){return db[_0xde8d('0x2f')]['describe']()[_0xde8d('0x26')](respondWithResult(_0x48a41d,null))[_0xde8d('0x40')](handleError(_0x48a41d,null));};exports[_0xde8d('0x4d')]=function(_0x2bb466,_0x5c0f6a,_0x1a2269){return db[_0xde8d('0x4e')]['find']({'where':{'id':_0x2bb466[_0xde8d('0x4c')]['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x5c0f6a,null))[_0xde8d('0x26')](function(_0x2c750d){if(_0x2c750d){return _0x2c750d[_0xde8d('0x4d')](_0x2bb466[_0xde8d('0x46')][_0xde8d('0x4f')],_['omit'](_0x2bb466[_0xde8d('0x46')],[_0xde8d('0x4f'),'id'])||{});}})[_0xde8d('0x26')](respondWithResult(_0x5c0f6a,null))[_0xde8d('0x40')](handleError(_0x5c0f6a,null));};exports[_0xde8d('0x50')]=function(_0xc5af6f,_0x4e2d6b,_0x65f0ff){var _0x1312ff={};var _0x100e3e={};var _0x58be5f;var _0x7a9ea8;return db[_0xde8d('0x2f')][_0xde8d('0x51')]({'where':{'id':_0xc5af6f['params']['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x4e2d6b,null))['then'](function(_0x24e377){if(_0x24e377){_0x58be5f=_0x24e377;_0x100e3e[_0xde8d('0x34')]=_['keys'](db['CmContact']['rawAttributes']);_0x100e3e[_0xde8d('0x31')]=_[_0xde8d('0x32')](_0xc5af6f['query']);_0x100e3e[_0xde8d('0x3a')]=_[_0xde8d('0x33')](_0x100e3e[_0xde8d('0x34')],_0x100e3e[_0xde8d('0x31')]);_0x1312ff[_0xde8d('0x36')]=_[_0xde8d('0x33')](_0x100e3e[_0xde8d('0x34')],qs[_0xde8d('0x35')](_0xc5af6f['query'][_0xde8d('0x35')]));_0x1312ff[_0xde8d('0x36')]=_0x1312ff['attributes'][_0xde8d('0x42')]?_0x1312ff[_0xde8d('0x36')]:_0x100e3e[_0xde8d('0x34')];_0x1312ff['order']=qs[_0xde8d('0x39')](_0xc5af6f[_0xde8d('0x31')][_0xde8d('0x39')]);_0x1312ff[_0xde8d('0x3b')]=qs[_0xde8d('0x3a')](_['pick'](_0xc5af6f[_0xde8d('0x31')],_0x100e3e[_0xde8d('0x3a')]));if(_0xc5af6f[_0xde8d('0x31')][_0xde8d('0x3c')]){_0x1312ff[_0xde8d('0x3b')]=_['merge'](_0x1312ff[_0xde8d('0x3b')],{'$or':_['map'](_0x1312ff[_0xde8d('0x36')],function(_0x2651d2){var _0x325664={};_0x325664[_0x2651d2]={'$like':'%'+_0xc5af6f['query'][_0xde8d('0x3c')]+'%'};return _0x325664;})});}_0x1312ff=_[_0xde8d('0x52')]({},_0x1312ff,_0xc5af6f[_0xde8d('0x3d')]);return _0x58be5f[_0xde8d('0x50')](_0x1312ff);}})['then'](function(_0x2bb8e1){if(_0x2bb8e1){_0x7a9ea8=_0x2bb8e1[_0xde8d('0x42')];if(!_0xc5af6f[_0xde8d('0x31')][_0xde8d('0x37')](_0xde8d('0x53'))){_0x1312ff['limit']=qs['limit'](_0xc5af6f[_0xde8d('0x31')]['limit']);_0x1312ff[_0xde8d('0x1b')]=qs[_0xde8d('0x1b')](_0xc5af6f[_0xde8d('0x31')][_0xde8d('0x1b')]);}return _0x58be5f[_0xde8d('0x50')](_0x1312ff);}})[_0xde8d('0x26')](function(_0x3d844f){if(_0x3d844f){return _0x3d844f?{'count':_0x7a9ea8,'rows':_0x3d844f}:null;}})[_0xde8d('0x26')](respondWithResult(_0x4e2d6b,null))[_0xde8d('0x40')](handleError(_0x4e2d6b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 00bf541..6fa769b 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 _0xb964=['path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b37d0,_0x5e3d41){var _0x4987b6=function(_0xd63e1c){while(--_0xd63e1c){_0x3b37d0['push'](_0x3b37d0['shift']());}};_0x4987b6(++_0x5e3d41);}(_0xb964,0x181));var _0x4b96=function(_0x2846de,_0x44bd95){_0x2846de=_0x2846de-0x0;var _0x2f736e=_0xb964[_0x2846de];return _0x2f736e;};'use strict';var _=require(_0x4b96('0x0'));var util=require(_0x4b96('0x1'));var logger=require(_0x4b96('0x2'))(_0x4b96('0x3'));var moment=require(_0x4b96('0x4'));var BPromise=require(_0x4b96('0x5'));var rp=require(_0x4b96('0x6'));var fs=require('fs');var path=require(_0x4b96('0x7'));var rimraf=require(_0x4b96('0x8'));var config=require(_0x4b96('0x9'));var attributes=require(_0x4b96('0xa'));module['exports']=function(_0x3a7bca,_0x500892){return _0x3a7bca[_0x4b96('0xb')](_0x4b96('0xc'),attributes,{'tableName':_0x4b96('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x82c4,0xde));var _0x482c=function(_0x593576,_0x8629f2){_0x593576=_0x593576-0x0;var _0x2bcd63=_0x82c4[_0x593576];return _0x2bcd63;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x6'));var config=require(_0x482c('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x832fba,_0xa1c9a7){return _0x832fba[_0x482c('0x8')](_0x482c('0x9'),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 c3bf58d..b77a987 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 _0x3464=['message','CmCompany,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4658f0,_0x5b3e48){var _0x157dc9=function(_0xb7b3a6){while(--_0xb7b3a6){_0x4658f0['push'](_0x4658f0['shift']());}};_0x157dc9(++_0x5b3e48);}(_0x3464,0xeb));var _0x4346=function(_0x135f85,_0x2949af){_0x135f85=_0x135f85-0x0;var _0x2bd8a3=_0x3464[_0x135f85];return _0x2bd8a3;};'use strict';var _=require(_0x4346('0x0'));var util=require(_0x4346('0x1'));var moment=require(_0x4346('0x2'));var BPromise=require(_0x4346('0x3'));var rs=require(_0x4346('0x4'));var fs=require('fs');var Redis=require(_0x4346('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4346('0x6'))(_0x4346('0x7'));var config=require(_0x4346('0x8'));var jayson=require(_0x4346('0x9'));var client=jayson[_0x4346('0xa')][_0x4346('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48eeb6,_0x108d82,_0x9067a3){return new BPromise(function(_0x20c0c0,_0x23254b){return client[_0x4346('0xc')](_0x48eeb6,_0x9067a3)['then'](function(_0x43a895){logger['info']('CmCompany,\x20%s,\x20%s',_0x108d82,_0x4346('0xd'));logger['debug'](_0x4346('0xe'),_0x108d82,_0x4346('0xd'),JSON[_0x4346('0xf')](_0x43a895));if(_0x43a895[_0x4346('0x10')]){if(_0x43a895[_0x4346('0x10')]['code']===0x1f4){logger[_0x4346('0x10')]('CmCompany,\x20%s,\x20%s',_0x108d82,_0x43a895[_0x4346('0x10')][_0x4346('0x11')]);return _0x23254b(_0x43a895[_0x4346('0x10')][_0x4346('0x11')]);}logger[_0x4346('0x10')](_0x4346('0x12'),_0x108d82,_0x43a895[_0x4346('0x10')][_0x4346('0x11')]);return _0x20c0c0(_0x43a895[_0x4346('0x10')][_0x4346('0x11')]);}else{logger[_0x4346('0x13')](_0x4346('0x12'),_0x108d82,_0x4346('0xd'));_0x20c0c0(_0x43a895[_0x4346('0x14')][_0x4346('0x11')]);}})['catch'](function(_0x224e71){logger[_0x4346('0x10')](_0x4346('0x12'),_0x108d82,_0x224e71);_0x23254b(_0x224e71);});});} \ No newline at end of file +var _0x8ca4=['error','code','CmCompany,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8ca4,0x8a));var _0x48ca=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x8ca4[_0x267d8d];return _0x11a98f;};'use strict';var _=require('lodash');var util=require(_0x48ca('0x0'));var moment=require('moment');var BPromise=require(_0x48ca('0x1'));var rs=require(_0x48ca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48ca('0x3'))['db'];var utils=require(_0x48ca('0x4'));var logger=require(_0x48ca('0x5'))(_0x48ca('0x6'));var config=require(_0x48ca('0x7'));var jayson=require(_0x48ca('0x8'));var client=jayson['client'][_0x48ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x390df9,_0x1a07c0,_0x47fcda){return new BPromise(function(_0x4ab2a8,_0x36d0f7){return client[_0x48ca('0xa')](_0x390df9,_0x47fcda)[_0x48ca('0xb')](function(_0x4be8b9){logger[_0x48ca('0xc')]('CmCompany,\x20%s,\x20%s',_0x1a07c0,_0x48ca('0xd'));logger['debug'](_0x48ca('0xe'),_0x1a07c0,'request\x20sent',JSON[_0x48ca('0xf')](_0x4be8b9));if(_0x4be8b9[_0x48ca('0x10')]){if(_0x4be8b9['error'][_0x48ca('0x11')]===0x1f4){logger[_0x48ca('0x10')](_0x48ca('0x12'),_0x1a07c0,_0x4be8b9[_0x48ca('0x10')][_0x48ca('0x13')]);return _0x36d0f7(_0x4be8b9[_0x48ca('0x10')][_0x48ca('0x13')]);}logger[_0x48ca('0x10')](_0x48ca('0x12'),_0x1a07c0,_0x4be8b9[_0x48ca('0x10')][_0x48ca('0x13')]);return _0x4ab2a8(_0x4be8b9[_0x48ca('0x10')][_0x48ca('0x13')]);}else{logger['info'](_0x48ca('0x12'),_0x1a07c0,_0x48ca('0xd'));_0x4ab2a8(_0x4be8b9[_0x48ca('0x14')][_0x48ca('0x13')]);}})[_0x48ca('0x15')](function(_0x1848f6){logger[_0x48ca('0x10')]('CmCompany,\x20%s,\x20%s',_0x1a07c0,_0x1848f6);_0x36d0f7(_0x1848f6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index db7f5f7..31ed5d8 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 _0x66d0=['./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e10ed,_0x49fca8){var _0x560116=function(_0x434646){while(--_0x434646){_0x4e10ed['push'](_0x4e10ed['shift']());}};_0x560116(++_0x49fca8);}(_0x66d0,0xb1));var _0x066d=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0x66d0[_0x555069];return _0x100af7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x066d('0x0'));var timeout=require(_0x066d('0x1'));var express=require(_0x066d('0x2'));var router=express['Router']();var fs_extra=require(_0x066d('0x3'));var auth=require(_0x066d('0x4'));var interaction=require(_0x066d('0x5'));var config=require(_0x066d('0x6'));var controller=require(_0x066d('0x7'));router[_0x066d('0x8')]('/',auth[_0x066d('0x9')](),controller[_0x066d('0xa')]);router[_0x066d('0x8')]('/describe',auth[_0x066d('0x9')](),controller[_0x066d('0xb')]);router[_0x066d('0x8')](_0x066d('0xc'),auth[_0x066d('0x9')](),controller[_0x066d('0xd')]);router[_0x066d('0x8')](_0x066d('0xe'),auth[_0x066d('0x9')](),controller[_0x066d('0xf')]);router['post']('/',auth[_0x066d('0x9')](),controller[_0x066d('0x10')]);router[_0x066d('0x11')](_0x066d('0xe'),auth[_0x066d('0x9')](),controller[_0x066d('0x12')]);router[_0x066d('0x13')](_0x066d('0xc'),auth[_0x066d('0x9')](),controller[_0x066d('0x14')]);router[_0x066d('0x15')](_0x066d('0xc'),auth[_0x066d('0x9')](),controller[_0x066d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xaeb6=['/:id/contacts','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getContacts','create','post'];(function(_0x10c198,_0x1527c0){var _0x246e3b=function(_0x14785a){while(--_0x14785a){_0x10c198['push'](_0x10c198['shift']());}};_0x246e3b(++_0x1527c0);}(_0xaeb6,0x1e8));var _0x6aeb=function(_0x3ea495,_0x2cd347){_0x3ea495=_0x3ea495-0x0;var _0x108ee0=_0xaeb6[_0x3ea495];return _0x108ee0;};'use strict';var multer=require(_0x6aeb('0x0'));var util=require(_0x6aeb('0x1'));var path=require('path');var timeout=require(_0x6aeb('0x2'));var express=require('express');var router=express[_0x6aeb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6aeb('0x4'));var interaction=require(_0x6aeb('0x5'));var config=require(_0x6aeb('0x6'));var controller=require('./cmCompany.controller');router[_0x6aeb('0x7')]('/',auth[_0x6aeb('0x8')](),controller['index']);router[_0x6aeb('0x7')](_0x6aeb('0x9'),auth['isAuthenticated'](),controller[_0x6aeb('0xa')]);router[_0x6aeb('0x7')](_0x6aeb('0xb'),auth[_0x6aeb('0x8')](),controller[_0x6aeb('0xc')]);router[_0x6aeb('0x7')]('/:id/contacts',auth[_0x6aeb('0x8')](),controller[_0x6aeb('0xd')]);router['post']('/',auth[_0x6aeb('0x8')](),controller[_0x6aeb('0xe')]);router[_0x6aeb('0xf')](_0x6aeb('0x10'),auth[_0x6aeb('0x8')](),controller['addContacts']);router[_0x6aeb('0x11')](_0x6aeb('0xb'),auth[_0x6aeb('0x8')](),controller[_0x6aeb('0x12')]);router['delete'](_0x6aeb('0xb'),auth[_0x6aeb('0x8')](),controller[_0x6aeb('0x13')]);module[_0x6aeb('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 65f5acf..62167e9 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 _0xbaf0=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2ea8d2,_0x125b66){var _0x35a2ad=function(_0x5c6c40){while(--_0x5c6c40){_0x2ea8d2['push'](_0x2ea8d2['shift']());}};_0x35a2ad(++_0x125b66);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'firstName':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0baf('0x2')]},'street':{'type':Sequelize[_0x0baf('0x2')]},'postalCode':{'type':Sequelize[_0x0baf('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0baf('0x2')]},'dateOfBirth':{'type':Sequelize[_0x0baf('0x2')]},'description':{'type':Sequelize[_0x0baf('0x3')]},'phone':{'type':Sequelize[_0x0baf('0x2')]},'mobile':{'type':Sequelize[_0x0baf('0x2')]},'fax':{'type':Sequelize[_0x0baf('0x2')]},'email':{'type':Sequelize[_0x0baf('0x2')]},'url':{'type':Sequelize[_0x0baf('0x2')]},'facebook':{'type':Sequelize[_0x0baf('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0baf('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x0baf('0x2')]},'viber':{'type':Sequelize[_0x0baf('0x2')]},'line':{'type':Sequelize[_0x0baf('0x2')]},'wechat':{'type':Sequelize[_0x0baf('0x2')]},'telegram':{'type':Sequelize[_0x0baf('0x2')]},'UserId':{'type':Sequelize[_0x0baf('0x4')]},'priority':{'type':Sequelize[_0x0baf('0x4')](0x2)[_0x0baf('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':Sequelize[_0x0baf('0x7')]},'dialTimezone':{'type':Sequelize[_0x0baf('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5f66=['sequelize','STRING','INTEGER','DATE'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var Sequelize=require(_0x65f6('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x65f6('0x1')]},'street':{'type':Sequelize[_0x65f6('0x1')]},'postalCode':{'type':Sequelize[_0x65f6('0x1')]},'city':{'type':Sequelize[_0x65f6('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x65f6('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x65f6('0x1')]},'mobile':{'type':Sequelize[_0x65f6('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x65f6('0x1')]},'facebook':{'type':Sequelize[_0x65f6('0x1')]},'fb_data':{'type':Sequelize[_0x65f6('0x1')]},'twitter':{'type':Sequelize[_0x65f6('0x1')]},'skype':{'type':Sequelize[_0x65f6('0x1')]},'teams':{'type':Sequelize[_0x65f6('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x65f6('0x1')]},'telegram':{'type':Sequelize[_0x65f6('0x1')]},'UserId':{'type':Sequelize[_0x65f6('0x2')]},'priority':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x65f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 02dd808..4116d23 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 _0x7d13=['spread','show','color','$and','omit','format','cf_%d','table','setFields','toParam','phone','getTags','findOne','options','setTags','ids','getHoppers','rawAttributes','ContactId','includeAll','getHopperHistories','include','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','root','server/files/tmp','chmodSync','0777','child_process','fork','../../components/import/cm/csv','pid','send','upload','createReadStream','file','parse','meta','import','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','stringify','exit','error\x20child\x20process','getJourney','mail','sms','fax','whatsapp','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','slice','bluebird','path','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','CmContact','describe','length','keys','startsWith','cf_','CmCustomField','trimStart','all','fieldType','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','from','tools_tags','cm_contacts','cm_user_has_contacts','left_join','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','dateOfBirth','datetime','castTo','DATE','buildExpression','text','value','start','filter','isNil','Contact','push','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','order','DESC','t.id\x20IN\x20?','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.mobile','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','tags','columnName','analytics','findAll','displayName','alias','custom','values','body','get','isArray','join','info','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','dialTimezone','timezones','utcOffset','each','duplicates','findOrCreate'];(function(_0x439576,_0x45649f){var _0xdeb760=function(_0x1c5e11){while(--_0x1c5e11){_0x439576['push'](_0x439576['shift']());}};_0xdeb760(++_0x45649f);}(_0x7d13,0x6c));var _0x37d1=function(_0x565404,_0x846949){_0x565404=_0x565404-0x0;var _0x2b0bb3=_0x7d13[_0x565404];return _0x2b0bb3;};'use strict';var moment=require('moment');var BPromise=require(_0x37d1('0x0'));var util=require('util');var path=require(_0x37d1('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37d1('0x2'));var Papa=require(_0x37d1('0x3'));var Redis=require(_0x37d1('0x4'));var qs=require(_0x37d1('0x5'));var as=require(_0x37d1('0x6'));var logger=require('../../config/logger')(_0x37d1('0x7'));var config=require(_0x37d1('0x8'));var shared=require(_0x37d1('0x9'));var db=require(_0x37d1('0xa'))['db'];config['redis']=_[_0x37d1('0xb')](config[_0x37d1('0xc')],{'host':_0x37d1('0xd'),'port':0x18eb});var socket=require(_0x37d1('0xe'))(new Redis(config[_0x37d1('0xc')]));require(_0x37d1('0xf'))[_0x37d1('0x10')](socket);function respondWithResult(_0x543479,_0x5887a5){_0x5887a5=_0x5887a5||0xc8;return function(_0x408a5b){if(_0x408a5b){return _0x543479[_0x37d1('0x11')](_0x5887a5)['json'](_0x408a5b);}};}function respondWithFilteredResult(_0x5c091,_0x29f4d3){return function(_0x251057){if(_0x251057){var _0x1cfab7=typeof _0x29f4d3[_0x37d1('0x12')]===_0x37d1('0x13')&&typeof _0x29f4d3[_0x37d1('0x14')]===_0x37d1('0x13');var _0x544915=_0x251057[_0x37d1('0x15')];var _0x279505=_0x1cfab7?0x0:_0x29f4d3['offset'];var _0x7987b3=_0x1cfab7?_0x251057[_0x37d1('0x15')]:_0x29f4d3['offset']+_0x29f4d3[_0x37d1('0x14')];var _0x43e615;if(_0x7987b3>=_0x544915){_0x7987b3=_0x544915;_0x43e615=0xc8;}else{_0x43e615=0xce;}_0x5c091['status'](_0x43e615);return _0x5c091['set'](_0x37d1('0x16'),_0x279505+'-'+_0x7987b3+'/'+_0x544915)[_0x37d1('0x17')](_0x251057);}return null;};}function saveUpdates(_0x23bb13){return function(_0x5ded71){if(_0x5ded71){return _0x5ded71[_0x37d1('0x18')](_0x23bb13)[_0x37d1('0x19')](function(_0x1c100a){return _0x1c100a;});}return null;};}function removeEntity(_0x597418){return function(_0x477ac8){if(_0x477ac8){return _0x477ac8[_0x37d1('0x1a')]()['then'](function(){_0x597418[_0x37d1('0x11')](0xcc)[_0x37d1('0x1b')]();});}};}function handleEntityNotFound(_0x2e1094){return function(_0x27bcd1){if(!_0x27bcd1){_0x2e1094[_0x37d1('0x1c')](0x194);}return _0x27bcd1;};}function handleError(_0x1d522e,_0x1c0845){_0x1c0845=_0x1c0845||0x1f4;return function(_0x546826){logger['error'](_0x546826[_0x37d1('0x1d')]);if(_0x546826[_0x37d1('0x1e')]){delete _0x546826[_0x37d1('0x1e')];}_0x1d522e[_0x37d1('0x11')](_0x1c0845)['send'](_0x546826);};}exports['index']=function(_0x381345,_0x19c4a9){var _0x16efdd={},_0x18c36b={},_0x461b36={'count':0x0,'rows':[]};return db[_0x37d1('0x1f')][_0x37d1('0x20')]()[_0x37d1('0x19')](function(_0x3caa78){var _0x6a709d=[];for(var _0xc88fb4=0x0;_0xc88fb40x1){_0x2d8610['or'](_0x37d1('0x5b'),qs[_0x37d1('0x5c')](_0x553dd0),null);}else{if(qs[_0x37d1('0x5d')](_0x553dd0)){_0x2d8610['or'](_0x37d1('0x5e'),_0x553dd0+'%');_0x2d8610['or'](_0x37d1('0x5f'),_0x553dd0+'%');_0x2d8610['or'](_0x37d1('0x60'),_0x553dd0+'%');_0x2d8610['or'](_0x37d1('0x61'),_0x553dd0+'%');}else if(qs[_0x37d1('0x62')](_0x553dd0)){_0x2d8610['or'](_0x37d1('0x63'),_0x553dd0+'%');}else{_0x2d8610['or']('c.firstName\x20LIKE\x20?','%'+_0x553dd0+'%');_0x2d8610['or'](_0x37d1('0x64'),'%'+_0x553dd0+'%');_0x2d8610['or']('c.email\x20LIKE\x20?','%'+_0x553dd0+'%');}}}}_0xd8f52e['where'](_0x2d8610);_0xd8f52e[_0x37d1('0x65')](_0x37d1('0x66'));var _0x2121fb={'type':db[_0x37d1('0x67')]['QueryTypes'][_0x37d1('0x68')],'raw':!![]};var _0x58d872=_0xd8f52e[_0x37d1('0x69')]()[_0x37d1('0x36')](_0x37d1('0x66'));if(_0x16efdd[_0x37d1('0x6a')]){_0x16efdd[_0x37d1('0x6a')][_0x37d1('0x45')](function(_0x218e80){_0xd8f52e['order']('c.'+_0x218e80[0x0],_0x218e80[0x1]===_0x37d1('0x6b')?![]:!![]);});}if(!_[_0x37d1('0x55')](_0x5d8a17)){_0xd8f52e['having'](_0x2a9b29);_0x58d872[_0x37d1('0x33')](_0x37d1('0x6c'),_0x5d8a17);}BPromise['resolve']()['then'](function(){if(!_0x3b1012)return;if(_0x381345[_0x37d1('0x6d')][_0x37d1('0x6e')]!==_0x37d1('0x6f'))return;if(!_[_0x37d1('0x70')](_0x3b1012['conditions'],['field',_0x37d1('0x47')])){return _0x381345[_0x37d1('0x6d')][_0x37d1('0x71')]({'attributes':['id'],'raw':!![]})[_0x37d1('0x19')](function(_0x23431b){if(_[_0x37d1('0x55')](_0x23431b)){_0x58d872['where']('c.ListId\x20IS\x20NULL');_0xd8f52e[_0x37d1('0x33')](_0x37d1('0x72'));}else{_0x58d872[_0x37d1('0x33')]('c.ListId\x20IN\x20?',_[_0x37d1('0x44')](_0x23431b,'id'));_0xd8f52e[_0x37d1('0x33')](_0x37d1('0x73'),_[_0x37d1('0x44')](_0x23431b,'id'));}});}})[_0x37d1('0x19')](function(){if(_0x381345[_0x37d1('0x6d')][_0x37d1('0x6e')]==='agent'&&!_0x3b1012&&!_0x381345[_0x37d1('0x2b')]['ListId'])return[];return db[_0x37d1('0x74')][_0x37d1('0x2b')](_0x58d872[_0x37d1('0x75')](),_0x2121fb);})[_0x37d1('0x19')](function(_0x392570){_0x461b36[_0x37d1('0x15')]=_0x392570['length'];if(_0x461b36[_0x37d1('0x15')]===0x0)return[];return db[_0x37d1('0x74')][_0x37d1('0x2b')](_0x149642[_0x37d1('0x75')](),_0x2121fb)[_0x37d1('0x19')](function(_0x479416){_0x4e0821=_[_0x37d1('0x76')](_0x479416,'id');_0x2121fb=_[_0x37d1('0x77')](_0x2121fb,{'model':db[_0x37d1('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x381345[_0x37d1('0x2b')][_0x37d1('0x2e')]){_0x16efdd[_0x37d1('0x2f')][_0x37d1('0x45')](function(_0x5e32dd){_0xd8f52e[_0x37d1('0x36')]('c.'+_0x5e32dd);});}else{_0xd8f52e[_0x37d1('0x36')](_0x37d1('0x66'));_0xd8f52e['field'](_0x37d1('0x78'));_0xd8f52e[_0x37d1('0x36')](_0x37d1('0x79'));_0xd8f52e[_0x37d1('0x36')]('c.phone');_0xd8f52e[_0x37d1('0x36')](_0x37d1('0x7a'));_0xd8f52e['field']('c.fax');_0xd8f52e[_0x37d1('0x36')]('c.email');_0xd8f52e['field'](_0x37d1('0x7b'));_0xd8f52e['field']('c.createdAt');_0xd8f52e[_0x37d1('0x36')](_0x37d1('0x7c'));_0xd8f52e[_0x37d1('0x36')]('c.CompanyId');_0xd8f52e[_0x37d1('0x36')](_0x37d1('0x7d'),_0x37d1('0x7e'));}if(_0x16efdd[_0x37d1('0x14')])_0xd8f52e[_0x37d1('0x14')](_0x16efdd['limit']);if(_0x16efdd[_0x37d1('0x12')])_0xd8f52e[_0x37d1('0x12')](_0x16efdd[_0x37d1('0x12')]);return db['sequelize'][_0x37d1('0x2b')](_0xd8f52e['toString'](),_0x2121fb);});})[_0x37d1('0x19')](function(_0xd49755){_0xd49755['forEach'](function(_0x4c99ab){if(_0x4c99ab[_0x37d1('0x7e')]){_0x4c99ab[_0x37d1('0x7f')]=[];_0x4c99ab[_0x37d1('0x7e')][_0x37d1('0x43')](',')[_0x37d1('0x45')](function(_0x1944db){_0x4c99ab['Tags'][_0x37d1('0x54')](_0x4e0821[_0x1944db]);});}delete _0x4c99ab[_0x37d1('0x7e')];});_0x461b36[_0x37d1('0x80')]=_0xd49755;return _0x461b36;})['then'](respondWithFilteredResult(_0x19c4a9,_0x16efdd));})['catch'](handleError(_0x19c4a9,null));};exports['destroy']=function(_0x2e1aca,_0x2f3f94){return db['CmContact'][_0x37d1('0x41')]({'where':{'id':_0x2e1aca[_0x37d1('0x81')]['id']}})[_0x37d1('0x19')](handleEntityNotFound(_0x2f3f94,null))[_0x37d1('0x19')](removeEntity(_0x2f3f94,null))[_0x37d1('0x82')](handleError(_0x2f3f94,null));};exports[_0x37d1('0x20')]=function(_0x3c8788,_0x1fc9db){return db[_0x37d1('0x1f')]['describe']()[_0x37d1('0x19')](function(_0x85c95b){delete _0x85c95b[_0x37d1('0x83')];for(var _0x4489d4=0x0;_0x4489d4=_0x324788){_0x271337=_0x324788;_0x129f4f=0xc8;}else{_0x129f4f=0xce;}_0x18c4f6[_0xc4ca('0xa')](_0x129f4f);return _0x18c4f6[_0xc4ca('0xf')](_0xc4ca('0x10'),_0x20c901+'-'+_0x271337+'/'+_0x324788)['json'](_0x2b0bfb);}return null;};}function saveUpdates(_0x47ecd6){return function(_0x2836c8){if(_0x2836c8){return _0x2836c8[_0xc4ca('0x11')](_0x47ecd6)[_0xc4ca('0x12')](function(_0x15cb09){return _0x15cb09;});}return null;};}function removeEntity(_0x56a862){return function(_0x3a6c86){if(_0x3a6c86){return _0x3a6c86[_0xc4ca('0x13')]()[_0xc4ca('0x12')](function(){_0x56a862[_0xc4ca('0xa')](0xcc)[_0xc4ca('0x14')]();});}};}function handleEntityNotFound(_0x2f1b21){return function(_0x25ee14){if(!_0x25ee14){_0x2f1b21[_0xc4ca('0x15')](0x194);}return _0x25ee14;};}function handleError(_0x306ae1,_0x15776e){_0x15776e=_0x15776e||0x1f4;return function(_0x4eac44){logger['error'](_0x4eac44['stack']);if(_0x4eac44[_0xc4ca('0x16')]){delete _0x4eac44['name'];}_0x306ae1[_0xc4ca('0xa')](_0x15776e)[_0xc4ca('0x17')](_0x4eac44);};}exports[_0xc4ca('0x18')]=function(_0x3cd94a,_0x48ae0c){var _0x4b83c4={},_0x1f0cfb={},_0x58d775={'count':0x0,'rows':[]};return db[_0xc4ca('0x19')][_0xc4ca('0x1a')]()['then'](function(_0x11b7db){var _0x21771a=[];for(var _0x55f25c=0x0;_0x55f25c0x1){_0x209fa2['or'](_0xc4ca('0x53'),qs[_0xc4ca('0x54')](_0x438a0e),null);}else{if(qs[_0xc4ca('0x55')](_0x438a0e)){_0x209fa2['or'](_0xc4ca('0x56'),_0x438a0e+'%');_0x209fa2['or']('c.phone\x20LIKE\x20?',_0x438a0e+'%');_0x209fa2['or'](_0xc4ca('0x57'),_0x438a0e+'%');_0x209fa2['or']('c.fax\x20LIKE\x20?',_0x438a0e+'%');}else if(qs[_0xc4ca('0x58')](_0x438a0e)){_0x209fa2['or'](_0xc4ca('0x59'),_0x438a0e+'%');}else{_0x209fa2['or']('c.firstName\x20LIKE\x20?','%'+_0x438a0e+'%');_0x209fa2['or'](_0xc4ca('0x5a'),'%'+_0x438a0e+'%');_0x209fa2['or'](_0xc4ca('0x59'),'%'+_0x438a0e+'%');}}}}_0xe0d709[_0xc4ca('0x28')](_0x209fa2);_0xe0d709[_0xc4ca('0x5b')]('c.id');var _0x34a0e3={'type':db['Sequelize'][_0xc4ca('0x5c')]['SELECT'],'raw':!![]};var _0x19e189=_0xe0d709[_0xc4ca('0x5d')]()[_0xc4ca('0x2b')](_0xc4ca('0x5e'));if(_0x4b83c4['order']){_0x4b83c4['order']['forEach'](function(_0x4e5f01){_0xe0d709[_0xc4ca('0x5f')]('c.'+_0x4e5f01[0x0],_0x4e5f01[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc4ca('0x60')](_0x4ee0b8)){_0xe0d709['having'](_0x24cd97);_0x19e189[_0xc4ca('0x28')](_0xc4ca('0x61'),_0x4ee0b8);}BPromise[_0xc4ca('0x62')]()[_0xc4ca('0x12')](function(){if(!_0x883316)return;if(_0x3cd94a[_0xc4ca('0x63')][_0xc4ca('0x64')]!==_0xc4ca('0x65'))return;if(!_[_0xc4ca('0x66')](_0x883316[_0xc4ca('0x39')],[_0xc4ca('0x2b'),'User'])){return _0x3cd94a[_0xc4ca('0x63')]['getLists']({'attributes':['id'],'raw':!![]})[_0xc4ca('0x12')](function(_0x34a812){if(_[_0xc4ca('0x60')](_0x34a812)){_0x19e189[_0xc4ca('0x28')](_0xc4ca('0x67'));_0xe0d709[_0xc4ca('0x28')]('c.ListId\x20IS\x20NULL');}else{_0x19e189[_0xc4ca('0x28')](_0xc4ca('0x4f'),_[_0xc4ca('0x68')](_0x34a812,'id'));_0xe0d709[_0xc4ca('0x28')]('c.ListId\x20IN\x20?',_[_0xc4ca('0x68')](_0x34a812,'id'));}});}})[_0xc4ca('0x12')](function(){if(_0x3cd94a[_0xc4ca('0x63')][_0xc4ca('0x64')]===_0xc4ca('0x65')&&!_0x883316&&!_0x3cd94a['query'][_0xc4ca('0x69')])return[];return db['sequelize']['query'](_0x19e189[_0xc4ca('0x6a')](),_0x34a0e3);})[_0xc4ca('0x12')](function(_0x2d84eb){_0x58d775['count']=_0x2d84eb['length'];if(_0x58d775['count']===0x0)return[];return db[_0xc4ca('0x6b')]['query'](_0xff9b05['toString'](),_0x34a0e3)[_0xc4ca('0x12')](function(_0x482af7){_0x3d2fc7=_['keyBy'](_0x482af7,'id');_0x34a0e3=_[_0xc4ca('0x6c')](_0x34a0e3,{'model':db[_0xc4ca('0x19')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3cd94a[_0xc4ca('0x22')][_0xc4ca('0x24')]){_0x4b83c4[_0xc4ca('0x25')]['forEach'](function(_0x17c619){_0xe0d709[_0xc4ca('0x2b')]('c.'+_0x17c619);});}else{_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x5e'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x6d'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x6e'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x6f'));_0xe0d709['field'](_0xc4ca('0x70'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x71'));_0xe0d709[_0xc4ca('0x2b')]('c.email');_0xe0d709[_0xc4ca('0x2b')]('c.ListId');_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x72'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x73'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x74'));_0xe0d709[_0xc4ca('0x2b')](_0xc4ca('0x75'),_0xc4ca('0x76'));}if(_0x4b83c4[_0xc4ca('0xd')])_0xe0d709[_0xc4ca('0xd')](_0x4b83c4[_0xc4ca('0xd')]);if(_0x4b83c4[_0xc4ca('0xe')])_0xe0d709['offset'](_0x4b83c4[_0xc4ca('0xe')]);return db[_0xc4ca('0x6b')]['query'](_0xe0d709[_0xc4ca('0x6a')](),_0x34a0e3);});})[_0xc4ca('0x12')](function(_0x460ac8){_0x460ac8[_0xc4ca('0x3d')](function(_0x4fae55){if(_0x4fae55[_0xc4ca('0x76')]){_0x4fae55[_0xc4ca('0x77')]=[];_0x4fae55[_0xc4ca('0x76')][_0xc4ca('0x3c')](',')['forEach'](function(_0x26b10a){_0x4fae55['Tags'][_0xc4ca('0x1d')](_0x3d2fc7[_0x26b10a]);});}delete _0x4fae55[_0xc4ca('0x76')];});_0x58d775[_0xc4ca('0x78')]=_0x460ac8;return _0x58d775;})['then'](respondWithFilteredResult(_0x48ae0c,_0x4b83c4));})[_0xc4ca('0x79')](handleError(_0x48ae0c,null));};exports[_0xc4ca('0x13')]=function(_0xdac06e,_0x333696){return db[_0xc4ca('0x19')][_0xc4ca('0x3a')]({'where':{'id':_0xdac06e[_0xc4ca('0x7a')]['id']}})[_0xc4ca('0x12')](handleEntityNotFound(_0x333696,null))[_0xc4ca('0x12')](removeEntity(_0x333696,null))[_0xc4ca('0x79')](handleError(_0x333696,null));};exports['describe']=function(_0x3541c3,_0x219fbc){return db['CmContact'][_0xc4ca('0x1a')]()[_0xc4ca('0x12')](function(_0x2de811){delete _0x2de811[_0xc4ca('0x7b')];for(var _0x25f0dc=0x0;_0x25f0dc{}\s\\|]/g,'-');_0x50c6e2(null,util[_0xc6ae('0x21')](_0xc6ae('0x22'),path['basename'](_0x195468[_0xc6ae('0x1f')],path[_0xc6ae('0x23')](_0x195468[_0xc6ae('0x1f')])),Date[_0xc6ae('0x24')](),path[_0xc6ae('0x23')](_0x195468['originalname'])));}})});router['post']('/csv',upload[_0xc6ae('0x25')](_0xc6ae('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xc6ae('0x1c')]({'destination':function(_0x11fe38,_0x2e79ff,_0x3b3193){_0x3b3193(null,path[_0xc6ae('0x1d')](config['root'],_0xc6ae('0x27')));},'filename':function(_0x219986,_0x1ed440,_0x9ab522){_0x1ed440[_0xc6ae('0x1f')]=_0x1ed440[_0xc6ae('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9ab522(null,util[_0xc6ae('0x21')](_0xc6ae('0x22'),path[_0xc6ae('0x28')](_0x1ed440[_0xc6ae('0x1f')],path['extname'](_0x1ed440[_0xc6ae('0x1f')])),Date[_0xc6ae('0x24')](),path[_0xc6ae('0x23')](_0x1ed440[_0xc6ae('0x1f')])));}})});router[_0xc6ae('0x16')]('/upload',upload[_0xc6ae('0x25')](_0xc6ae('0x26')),controller[_0xc6ae('0x29')]);router['post'](_0xc6ae('0x2a'),auth[_0xc6ae('0x7')](),controller[_0xc6ae('0x2b')]);router[_0xc6ae('0x2c')](_0xc6ae('0x2d'),auth['isAuthenticated'](),controller[_0xc6ae('0x2e')]);router[_0xc6ae('0x2f')](_0xc6ae('0x2d'),auth[_0xc6ae('0x7')](),controller[_0xc6ae('0x30')]);module['exports']=router; \ No newline at end of file +var _0x457d=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','post','merge','create','/create_many','bulkCreate','setTags','join','server/files/tmp','originalname','replace','format','basename','extname','/csv','single','file','diskStorage','now','/upload','upload','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id','show','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories'];(function(_0x137a65,_0x3844eb){var _0x485f8a=function(_0x3a2739){while(--_0x3a2739){_0x137a65['push'](_0x137a65['shift']());}};_0x485f8a(++_0x3844eb);}(_0x457d,0x18d));var _0xd457=function(_0x333160,_0x4c1df7){_0x333160=_0x333160-0x0;var _0x256d5a=_0x457d[_0x333160];return _0x256d5a;};'use strict';var multer=require(_0xd457('0x0'));var util=require(_0xd457('0x1'));var path=require(_0xd457('0x2'));var timeout=require(_0xd457('0x3'));var express=require(_0xd457('0x4'));var router=express[_0xd457('0x5')]();var fs_extra=require(_0xd457('0x6'));var auth=require(_0xd457('0x7'));var interaction=require(_0xd457('0x8'));var config=require(_0xd457('0x9'));var controller=require('./cmContact.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd457('0xa')]);router[_0xd457('0xb')]('/describe',auth[_0xd457('0xc')](),controller['describe']);router[_0xd457('0xb')](_0xd457('0xd'),auth[_0xd457('0xc')](),controller[_0xd457('0xe')]);router[_0xd457('0xb')](_0xd457('0xf'),auth[_0xd457('0xc')](),controller[_0xd457('0x10')]);router[_0xd457('0xb')](_0xd457('0x11'),auth[_0xd457('0xc')](),controller['getHoppers']);router['get'](_0xd457('0x12'),auth['isAuthenticated'](),controller[_0xd457('0x13')]);router['get'](_0xd457('0x14'),auth[_0xd457('0xc')](),controller[_0xd457('0x15')]);router[_0xd457('0xb')](_0xd457('0x16'),auth[_0xd457('0xc')](),controller['getJscriptySessions']);router[_0xd457('0xb')](_0xd457('0x17'),auth['isAuthenticated'](),controller[_0xd457('0x18')]);router[_0xd457('0x19')]('/merge',auth['isAuthenticated'](),controller[_0xd457('0x1a')]);router[_0xd457('0x19')]('/',auth['isAuthenticated'](),controller[_0xd457('0x1b')]);router[_0xd457('0x19')](_0xd457('0x1c'),auth[_0xd457('0xc')](),controller[_0xd457('0x1d')]);router[_0xd457('0x19')]('/:id/tags',auth[_0xd457('0xc')](),controller[_0xd457('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x145c89,_0x3c3dd0,_0x52671a){_0x52671a(null,path[_0xd457('0x1f')](config['root'],_0xd457('0x20')));},'filename':function(_0x5129ca,_0xbf5471,_0x2bff4a){_0xbf5471[_0xd457('0x21')]=_0xbf5471[_0xd457('0x21')][_0xd457('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2bff4a(null,util[_0xd457('0x23')]('%s-%s%s',path[_0xd457('0x24')](_0xbf5471[_0xd457('0x21')],path['extname'](_0xbf5471[_0xd457('0x21')])),Date['now'](),path[_0xd457('0x25')](_0xbf5471[_0xd457('0x21')])));}})});router[_0xd457('0x19')](_0xd457('0x26'),upload[_0xd457('0x27')](_0xd457('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xd457('0x29')]({'destination':function(_0x3273dc,_0x11b684,_0x29d408){_0x29d408(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x57323b,_0x16fe1b,_0x13c894){_0x16fe1b[_0xd457('0x21')]=_0x16fe1b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13c894(null,util['format']('%s-%s%s',path[_0xd457('0x24')](_0x16fe1b[_0xd457('0x21')],path[_0xd457('0x25')](_0x16fe1b[_0xd457('0x21')])),Date[_0xd457('0x2a')](),path['extname'](_0x16fe1b['originalname'])));}})});router['post'](_0xd457('0x2b'),upload[_0xd457('0x27')](_0xd457('0x28')),controller[_0xd457('0x2c')]);router[_0xd457('0x19')](_0xd457('0x2d'),auth['isAuthenticated'](),controller[_0xd457('0x2e')]);router[_0xd457('0x2f')](_0xd457('0xd'),auth[_0xd457('0xc')](),controller[_0xd457('0x30')]);router[_0xd457('0x31')](_0xd457('0xd'),auth['isAuthenticated'](),controller[_0xd457('0x32')]);module[_0xd457('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 88b20fa..df22099 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 _0xa313=['isArray','stringify','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','getDataValue','name','TEXT','long','select','parse','values'];(function(_0x4fd119,_0x480251){var _0x160ff3=function(_0x330068){while(--_0x330068){_0x4fd119['push'](_0x4fd119['shift']());}};_0x160ff3(++_0x480251);}(_0xa313,0x125));var _0x3a31=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0xa313[_0x3c2666];return _0x10c814;};'use strict';var Sequelize=require(_0x3a31('0x0'));var _=require(_0x3a31('0x1'));module[_0x3a31('0x2')]={'name':{'type':Sequelize[_0x3a31('0x3')],'get':function(_0x446a40){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x3a31('0x4')],'allowNull':![],'set':function(_0x1f3e6d){this[_0x3a31('0x5')]('alias',_0x1f3e6d?_0x1f3e6d:this[_0x3a31('0x6')](_0x3a31('0x7')));}},'type':{'type':Sequelize[_0x3a31('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x3a31('0x8')](_0x3a31('0x9')),'get':function(){if(this[_0x3a31('0x6')]('type')===_0x3a31('0xa')){return JSON[_0x3a31('0xb')](this[_0x3a31('0x6')](_0x3a31('0xc')));}else{return this[_0x3a31('0x6')](_0x3a31('0xc'));}},'set':function(_0x5f11d9){if(Array[_0x3a31('0xd')](_0x5f11d9)){this[_0x3a31('0x5')]('values',JSON[_0x3a31('0xe')](_0x5f11d9));}else{this['setDataValue'](_0x3a31('0xc'),_0x5f11d9);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3a31('0xf')](_0x3a31('0x10'))}}; \ No newline at end of file +var _0xf0ef=['isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','parse','values'];(function(_0x3264c1,_0x1c893e){var _0x307813=function(_0x408529){while(--_0x408529){_0x3264c1['push'](_0x3264c1['shift']());}};_0x307813(++_0x1c893e);}(_0xf0ef,0x126));var _0xff0e=function(_0x456fc1,_0x5e289d){_0x456fc1=_0x456fc1-0x0;var _0x35587a=_0xf0ef[_0x456fc1];return _0x35587a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xff0e('0x0'));module[_0xff0e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x386913){return this[_0xff0e('0x2')](_0xff0e('0x3'));}},'alias':{'type':Sequelize[_0xff0e('0x4')],'allowNull':![],'set':function(_0x1f2fb8){this[_0xff0e('0x5')](_0xff0e('0x3'),_0x1f2fb8?_0x1f2fb8:this[_0xff0e('0x2')](_0xff0e('0x6')));}},'type':{'type':Sequelize[_0xff0e('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xff0e('0x7')]('long'),'get':function(){if(this['getDataValue'](_0xff0e('0x8'))===_0xff0e('0x9')){return JSON[_0xff0e('0xa')](this[_0xff0e('0x2')](_0xff0e('0xb')));}else{return this['getDataValue'](_0xff0e('0xb'));}},'set':function(_0x42c259){if(Array[_0xff0e('0xc')](_0x42c259)){this['setDataValue'](_0xff0e('0xb'),JSON[_0xff0e('0xd')](_0x42c259));}else{this[_0xff0e('0x5')](_0xff0e('0xb'),_0x42c259);}}},'required':{'type':Sequelize[_0xff0e('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xff0e('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xff0e('0xf')](_0xff0e('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 996a1e1..3533ca8 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 _0x16b1=['attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','body','find','create','transaction','text','Sequelize','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','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','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','CmCustomField','fieldName','type','model','differenceBy','keys','query','filters','intersection','fields'];(function(_0xa80908,_0x1fbb08){var _0x1e8bed=function(_0x4e45b7){while(--_0x4e45b7){_0xa80908['push'](_0xa80908['shift']());}};_0x1e8bed(++_0x1fbb08);}(_0x16b1,0x1ce));var _0x116b=function(_0x33edda,_0x34b182){_0x33edda=_0x33edda-0x0;var _0x2d5b2e=_0x16b1[_0x33edda];return _0x2d5b2e;};'use strict';var emlformat=require(_0x116b('0x0'));var rimraf=require(_0x116b('0x1'));var zipdir=require(_0x116b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x116b('0x3'));var moment=require('moment');var BPromise=require(_0x116b('0x4'));var Mustache=require('mustache');var util=require(_0x116b('0x5'));var path=require(_0x116b('0x6'));var sox=require(_0x116b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x116b('0x8'));var squel=require(_0x116b('0x9'));var crypto=require(_0x116b('0xa'));var jsforce=require(_0x116b('0xb'));var deskjs=require(_0x116b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x116b('0xd'));var Papa=require(_0x116b('0xe'));var Redis=require(_0x116b('0xf'));var authService=require(_0x116b('0x10'));var qs=require(_0x116b('0x11'));var as=require(_0x116b('0x12'));var hardwareService=require(_0x116b('0x13'));var logger=require(_0x116b('0x14'))(_0x116b('0x15'));var utils=require(_0x116b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x116b('0x17'));var db=require(_0x116b('0x18'))['db'];function respondWithStatusCode(_0x1a7781,_0x503bc6){_0x503bc6=_0x503bc6||0xcc;return function(_0x2cf047){if(_0x2cf047){return _0x1a7781[_0x116b('0x19')](_0x503bc6);}return _0x1a7781[_0x116b('0x1a')](_0x503bc6)[_0x116b('0x1b')]();};}function respondWithResult(_0x4e6a71,_0x417b5b){_0x417b5b=_0x417b5b||0xc8;return function(_0x3379ba){if(_0x3379ba){return _0x4e6a71[_0x116b('0x1a')](_0x417b5b)['json'](_0x3379ba);}};}function respondWithFilteredResult(_0x5addcc,_0x16236f){return function(_0x533799){if(_0x533799){var _0x39a546=typeof _0x16236f[_0x116b('0x1c')]==='undefined'&&typeof _0x16236f[_0x116b('0x1d')]===_0x116b('0x1e');var _0x2bbc78=_0x533799['count'];var _0x550c99=_0x39a546?0x0:_0x16236f[_0x116b('0x1c')];var _0x313e06=_0x39a546?_0x533799['count']:_0x16236f['offset']+_0x16236f[_0x116b('0x1d')];var _0x4ec80c;if(_0x313e06>=_0x2bbc78){_0x313e06=_0x2bbc78;_0x4ec80c=0xc8;}else{_0x4ec80c=0xce;}_0x5addcc['status'](_0x4ec80c);return _0x5addcc[_0x116b('0x1f')](_0x116b('0x20'),_0x550c99+'-'+_0x313e06+'/'+_0x2bbc78)['json'](_0x533799);}return null;};}function patchUpdates(_0x5e43ce){return function(_0x7312e){try{jsonpatch[_0x116b('0x21')](_0x7312e,_0x5e43ce,!![]);}catch(_0x239991){return BPromise[_0x116b('0x22')](_0x239991);}return _0x7312e[_0x116b('0x23')]();};}function saveUpdates(_0x4e44df,_0x554fcd){return function(_0x2a8f7d){if(_0x2a8f7d){return _0x2a8f7d[_0x116b('0x24')](_0x4e44df)[_0x116b('0x25')](function(_0x24c04b){return _0x24c04b;});}return null;};}function removeEntity(_0x4211d6,_0x40f982){return function(_0x43bdd0){if(_0x43bdd0){return _0x43bdd0[_0x116b('0x26')]()[_0x116b('0x25')](function(){_0x4211d6[_0x116b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d833f,_0x1c278a){return function(_0x453e55){if(!_0x453e55){_0x3d833f['sendStatus'](0x194);}return _0x453e55;};}function handleError(_0x1c7d53,_0x9affe8){_0x9affe8=_0x9affe8||0x1f4;return function(_0x5082e6){logger[_0x116b('0x27')](_0x5082e6['stack']);if(_0x5082e6[_0x116b('0x28')]){delete _0x5082e6[_0x116b('0x28')];}_0x1c7d53[_0x116b('0x1a')](_0x9affe8)[_0x116b('0x29')](_0x5082e6);};}exports[_0x116b('0x2a')]=function(_0x171873,_0x390947){var _0x16ba83={},_0x30c2a1={},_0x50c3f7={'count':0x0,'rows':[]};var _0xc56e9b=_[_0x116b('0x2b')](db[_0x116b('0x2c')]['rawAttributes'],function(_0x29d843){return{'name':_0x29d843[_0x116b('0x2d')],'type':_0x29d843[_0x116b('0x2e')]['key']};});_0x30c2a1[_0x116b('0x2f')]=_[_0x116b('0x30')](_[_0x116b('0x2b')](_0xc56e9b,'name'),[_0x116b('0x28')]);_0x30c2a1['query']=_[_0x116b('0x31')](_0x171873[_0x116b('0x32')]);_0x30c2a1[_0x116b('0x33')]=_[_0x116b('0x34')](_0x30c2a1[_0x116b('0x2f')],_0x30c2a1[_0x116b('0x32')]);_0x16ba83['attributes']=_[_0x116b('0x34')](_0x30c2a1[_0x116b('0x2f')],qs['fields'](_0x171873[_0x116b('0x32')][_0x116b('0x35')]));_0x16ba83[_0x116b('0x36')]=_0x16ba83[_0x116b('0x36')][_0x116b('0x37')]?_0x16ba83[_0x116b('0x36')]:_0x30c2a1[_0x116b('0x2f')];if(!_0x171873[_0x116b('0x32')]['hasOwnProperty'](_0x116b('0x38'))){_0x16ba83['limit']=qs[_0x116b('0x1d')](_0x171873[_0x116b('0x32')][_0x116b('0x1d')]);_0x16ba83[_0x116b('0x1c')]=qs[_0x116b('0x1c')](_0x171873[_0x116b('0x32')][_0x116b('0x1c')]);}_0x16ba83[_0x116b('0x39')]=qs[_0x116b('0x3a')](_0x171873[_0x116b('0x32')][_0x116b('0x3a')]);_0x16ba83['where']=qs['filters'](_[_0x116b('0x3b')](_0x171873[_0x116b('0x32')],_0x30c2a1['filters']),_0xc56e9b);if(_0x171873[_0x116b('0x32')]['filter']){_0x16ba83[_0x116b('0x3c')]=_[_0x116b('0x3d')](_0x16ba83[_0x116b('0x3c')],{'$or':_[_0x116b('0x2b')](_0xc56e9b,function(_0x200581){if(_0x200581[_0x116b('0x2e')]!==_0x116b('0x3e')){var _0x4b4a34={};_0x4b4a34[_0x200581[_0x116b('0x28')]]={'$like':'%'+_0x171873[_0x116b('0x32')][_0x116b('0x3f')]+'%'};return _0x4b4a34;}})});}_0x16ba83=_[_0x116b('0x3d')]({},_0x16ba83,_0x171873['options']);var _0x4fb745={'where':_0x16ba83[_0x116b('0x3c')]};return db[_0x116b('0x2c')]['count'](_0x4fb745)[_0x116b('0x25')](function(_0x19079d){_0x50c3f7[_0x116b('0x40')]=_0x19079d;if(_0x171873[_0x116b('0x32')][_0x116b('0x41')]){_0x16ba83[_0x116b('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0x116b('0x43')](_0x16ba83);})[_0x116b('0x25')](function(_0x21c63d){_0x50c3f7[_0x116b('0x44')]=_0x21c63d;return _0x50c3f7;})['then'](respondWithFilteredResult(_0x390947,_0x16ba83))[_0x116b('0x45')](handleError(_0x390947,null));};exports[_0x116b('0x46')]=function(_0x89eb62,_0x3a024a){var _0x1b322e={'raw':!![],'where':{'id':_0x89eb62[_0x116b('0x47')]['id']}},_0x370cf7={};_0x370cf7[_0x116b('0x2f')]=_[_0x116b('0x31')](db[_0x116b('0x2c')][_0x116b('0x48')]);_0x370cf7[_0x116b('0x32')]=_[_0x116b('0x31')](_0x89eb62[_0x116b('0x32')]);_0x370cf7[_0x116b('0x33')]=_[_0x116b('0x34')](_0x370cf7[_0x116b('0x2f')],_0x370cf7[_0x116b('0x32')]);_0x1b322e[_0x116b('0x36')]=_['intersection'](_0x370cf7['model'],qs[_0x116b('0x35')](_0x89eb62[_0x116b('0x32')][_0x116b('0x35')]));_0x1b322e[_0x116b('0x36')]=_0x1b322e[_0x116b('0x36')][_0x116b('0x37')]?_0x1b322e['attributes']:_0x370cf7[_0x116b('0x2f')];if(_0x89eb62['query']['includeAll']){_0x1b322e[_0x116b('0x42')]=[{'all':!![]}];}_0x1b322e=_['merge']({},_0x1b322e,_0x89eb62[_0x116b('0x49')]);return db[_0x116b('0x2c')]['find'](_0x1b322e)[_0x116b('0x25')](handleEntityNotFound(_0x3a024a,null))[_0x116b('0x25')](respondWithResult(_0x3a024a,null))[_0x116b('0x45')](handleError(_0x3a024a,null));};exports[_0x116b('0x24')]=function(_0x24c623,_0x5dc7e7){if(_0x24c623[_0x116b('0x4a')]['id']){delete _0x24c623[_0x116b('0x4a')]['id'];}return db[_0x116b('0x2c')][_0x116b('0x4b')]({'where':{'id':_0x24c623[_0x116b('0x47')]['id']}})[_0x116b('0x25')](handleEntityNotFound(_0x5dc7e7,null))[_0x116b('0x25')](saveUpdates(_0x24c623[_0x116b('0x4a')],null))[_0x116b('0x25')](respondWithResult(_0x5dc7e7,null))[_0x116b('0x45')](handleError(_0x5dc7e7,null));};exports[_0x116b('0x26')]=function(_0x55c702,_0x1dd808){return db[_0x116b('0x2c')][_0x116b('0x4b')]({'where':{'id':_0x55c702[_0x116b('0x47')]['id']}})[_0x116b('0x25')](handleEntityNotFound(_0x1dd808,null))[_0x116b('0x25')](removeEntity(_0x1dd808,null))[_0x116b('0x45')](handleError(_0x1dd808,null));};exports[_0x116b('0x4c')]=function(_0x5e06b5,_0x354151){var _0x5e8394;return db['sequelize'][_0x116b('0x4d')](function(_0x3eb17a){return db[_0x116b('0x2c')][_0x116b('0x4c')](_0x5e06b5['body'],{'transaction':_0x3eb17a})[_0x116b('0x25')](function(_0x56e51c){_0x5e8394=_0x56e51c;var _0x48bed5={'type':db['Sequelize']['TEXT'],'transaction':_0x3eb17a};switch(_0x5e06b5[_0x116b('0x4a')][_0x116b('0x2e')]){case _0x116b('0x4e'):_0x48bed5[_0x116b('0x2e')]=db[_0x116b('0x4f')]['TEXT'];break;case'number':_0x48bed5[_0x116b('0x2e')]=db['Sequelize']['INTEGER'];break;case _0x116b('0x50'):_0x48bed5[_0x116b('0x2e')]=db[_0x116b('0x4f')][_0x116b('0x51')];_0x48bed5[_0x116b('0x52')]=![];break;default:}return db[_0x116b('0x53')][_0x116b('0x54')][_0x116b('0x55')]('cm_contacts',util['format']('cf_%d',_0x5e8394['id']),_0x48bed5);})['then'](function(){return _0x5e8394;});})['then'](respondWithResult(_0x354151,0xc9))[_0x116b('0x45')](handleError(_0x354151,null));}; \ No newline at end of file +var _0x5d8e=['text','number','INTEGER','switch','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../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','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','attributes','intersection','fields','length','order','sort','filters','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','show','keys','find','update','body','params','create','sequelize','transaction','Sequelize','TEXT'];(function(_0x5e7565,_0x12f1e4){var _0x176aae=function(_0x5b7b51){while(--_0x5b7b51){_0x5e7565['push'](_0x5e7565['shift']());}};_0x176aae(++_0x12f1e4);}(_0x5d8e,0xb2));var _0xe5d8=function(_0x27b6c9,_0x40f508){_0x27b6c9=_0x27b6c9-0x0;var _0x367a08=_0x5d8e[_0x27b6c9];return _0x367a08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe5d8('0x0'));var jsonpatch=require(_0xe5d8('0x1'));var rp=require(_0xe5d8('0x2'));var moment=require(_0xe5d8('0x3'));var BPromise=require(_0xe5d8('0x4'));var Mustache=require(_0xe5d8('0x5'));var util=require('util');var path=require(_0xe5d8('0x6'));var sox=require(_0xe5d8('0x7'));var csv=require(_0xe5d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5d8('0x9'));var squel=require('squel');var crypto=require(_0xe5d8('0xa'));var jsforce=require(_0xe5d8('0xb'));var deskjs=require(_0xe5d8('0xc'));var toCsv=require(_0xe5d8('0x8'));var querystring=require(_0xe5d8('0xd'));var Papa=require(_0xe5d8('0xe'));var Redis=require('ioredis');var authService=require(_0xe5d8('0xf'));var qs=require(_0xe5d8('0x10'));var as=require(_0xe5d8('0x11'));var hardwareService=require(_0xe5d8('0x12'));var logger=require(_0xe5d8('0x13'))(_0xe5d8('0x14'));var utils=require('../../config/utils');var config=require(_0xe5d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5d8('0x16'))['db'];function respondWithStatusCode(_0x4db3dd,_0x585a17){_0x585a17=_0x585a17||0xcc;return function(_0x4432a6){if(_0x4432a6){return _0x4db3dd[_0xe5d8('0x17')](_0x585a17);}return _0x4db3dd[_0xe5d8('0x18')](_0x585a17)[_0xe5d8('0x19')]();};}function respondWithResult(_0x510c49,_0x38dde6){_0x38dde6=_0x38dde6||0xc8;return function(_0x110f9b){if(_0x110f9b){return _0x510c49[_0xe5d8('0x18')](_0x38dde6)['json'](_0x110f9b);}};}function respondWithFilteredResult(_0x3f2c4d,_0xbd9c89){return function(_0x2a270e){if(_0x2a270e){var _0x1f69c2=typeof _0xbd9c89['offset']===_0xe5d8('0x1a')&&typeof _0xbd9c89[_0xe5d8('0x1b')]==='undefined';var _0x1f6a48=_0x2a270e[_0xe5d8('0x1c')];var _0x33a8be=_0x1f69c2?0x0:_0xbd9c89['offset'];var _0x5d099a=_0x1f69c2?_0x2a270e[_0xe5d8('0x1c')]:_0xbd9c89[_0xe5d8('0x1d')]+_0xbd9c89[_0xe5d8('0x1b')];var _0x8cddb3;if(_0x5d099a>=_0x1f6a48){_0x5d099a=_0x1f6a48;_0x8cddb3=0xc8;}else{_0x8cddb3=0xce;}_0x3f2c4d[_0xe5d8('0x18')](_0x8cddb3);return _0x3f2c4d[_0xe5d8('0x1e')](_0xe5d8('0x1f'),_0x33a8be+'-'+_0x5d099a+'/'+_0x1f6a48)[_0xe5d8('0x20')](_0x2a270e);}return null;};}function patchUpdates(_0x1c099d){return function(_0x10b250){try{jsonpatch[_0xe5d8('0x21')](_0x10b250,_0x1c099d,!![]);}catch(_0x36e0f7){return BPromise[_0xe5d8('0x22')](_0x36e0f7);}return _0x10b250[_0xe5d8('0x23')]();};}function saveUpdates(_0x5ce414,_0x5f1f4a){return function(_0x41009c){if(_0x41009c){return _0x41009c['update'](_0x5ce414)[_0xe5d8('0x24')](function(_0x76dd5){return _0x76dd5;});}return null;};}function removeEntity(_0x2f1399,_0x42b815){return function(_0x1fc498){if(_0x1fc498){return _0x1fc498[_0xe5d8('0x25')]()[_0xe5d8('0x24')](function(){_0x2f1399[_0xe5d8('0x18')](0xcc)[_0xe5d8('0x19')]();});}};}function handleEntityNotFound(_0x472d68,_0x5edfe9){return function(_0x3e24dd){if(!_0x3e24dd){_0x472d68[_0xe5d8('0x17')](0x194);}return _0x3e24dd;};}function handleError(_0x2a4d6e,_0x2c5689){_0x2c5689=_0x2c5689||0x1f4;return function(_0x121150){logger[_0xe5d8('0x26')](_0x121150[_0xe5d8('0x27')]);if(_0x121150[_0xe5d8('0x28')]){delete _0x121150['name'];}_0x2a4d6e['status'](_0x2c5689)['send'](_0x121150);};}exports['index']=function(_0x3fd85b,_0x2d13c3){var _0x4f7a02={},_0xe7dde0={},_0x23a286={'count':0x0,'rows':[]};var _0x172a5b=_[_0xe5d8('0x29')](db[_0xe5d8('0x2a')][_0xe5d8('0x2b')],function(_0x2cf752){return{'name':_0x2cf752['fieldName'],'type':_0x2cf752[_0xe5d8('0x2c')][_0xe5d8('0x2d')]};});_0xe7dde0[_0xe5d8('0x2e')]=_[_0xe5d8('0x2f')](_[_0xe5d8('0x29')](_0x172a5b,_0xe5d8('0x28')),[_0xe5d8('0x28')]);_0xe7dde0[_0xe5d8('0x30')]=_['keys'](_0x3fd85b['query']);_0xe7dde0['filters']=_['intersection'](_0xe7dde0[_0xe5d8('0x2e')],_0xe7dde0[_0xe5d8('0x30')]);_0x4f7a02[_0xe5d8('0x31')]=_[_0xe5d8('0x32')](_0xe7dde0['model'],qs[_0xe5d8('0x33')](_0x3fd85b[_0xe5d8('0x30')][_0xe5d8('0x33')]));_0x4f7a02[_0xe5d8('0x31')]=_0x4f7a02[_0xe5d8('0x31')][_0xe5d8('0x34')]?_0x4f7a02[_0xe5d8('0x31')]:_0xe7dde0[_0xe5d8('0x2e')];if(!_0x3fd85b[_0xe5d8('0x30')]['hasOwnProperty']('nolimit')){_0x4f7a02[_0xe5d8('0x1b')]=qs['limit'](_0x3fd85b[_0xe5d8('0x30')][_0xe5d8('0x1b')]);_0x4f7a02[_0xe5d8('0x1d')]=qs['offset'](_0x3fd85b[_0xe5d8('0x30')][_0xe5d8('0x1d')]);}_0x4f7a02[_0xe5d8('0x35')]=qs[_0xe5d8('0x36')](_0x3fd85b[_0xe5d8('0x30')][_0xe5d8('0x36')]);_0x4f7a02['where']=qs[_0xe5d8('0x37')](_['pick'](_0x3fd85b['query'],_0xe7dde0[_0xe5d8('0x37')]),_0x172a5b);if(_0x3fd85b[_0xe5d8('0x30')]['filter']){_0x4f7a02['where']=_[_0xe5d8('0x38')](_0x4f7a02['where'],{'$or':_[_0xe5d8('0x29')](_0x172a5b,function(_0x1f5c83){if(_0x1f5c83[_0xe5d8('0x2c')]!==_0xe5d8('0x39')){var _0xc6d347={};_0xc6d347[_0x1f5c83['name']]={'$like':'%'+_0x3fd85b[_0xe5d8('0x30')][_0xe5d8('0x3a')]+'%'};return _0xc6d347;}})});}_0x4f7a02=_[_0xe5d8('0x38')]({},_0x4f7a02,_0x3fd85b[_0xe5d8('0x3b')]);var _0x517a76={'where':_0x4f7a02[_0xe5d8('0x3c')]};return db['CmCustomField'][_0xe5d8('0x1c')](_0x517a76)['then'](function(_0x699577){_0x23a286[_0xe5d8('0x1c')]=_0x699577;if(_0x3fd85b[_0xe5d8('0x30')][_0xe5d8('0x3d')]){_0x4f7a02[_0xe5d8('0x3e')]=[{'all':!![]}];}return db['CmCustomField'][_0xe5d8('0x3f')](_0x4f7a02);})['then'](function(_0x3ec8f2){_0x23a286[_0xe5d8('0x40')]=_0x3ec8f2;return _0x23a286;})[_0xe5d8('0x24')](respondWithFilteredResult(_0x2d13c3,_0x4f7a02))[_0xe5d8('0x41')](handleError(_0x2d13c3,null));};exports[_0xe5d8('0x42')]=function(_0x50527d,_0x33397f){var _0x3cd5e5={'raw':!![],'where':{'id':_0x50527d['params']['id']}},_0x1b5523={};_0x1b5523[_0xe5d8('0x2e')]=_[_0xe5d8('0x43')](db['CmCustomField'][_0xe5d8('0x2b')]);_0x1b5523[_0xe5d8('0x30')]=_[_0xe5d8('0x43')](_0x50527d[_0xe5d8('0x30')]);_0x1b5523[_0xe5d8('0x37')]=_[_0xe5d8('0x32')](_0x1b5523[_0xe5d8('0x2e')],_0x1b5523[_0xe5d8('0x30')]);_0x3cd5e5[_0xe5d8('0x31')]=_[_0xe5d8('0x32')](_0x1b5523[_0xe5d8('0x2e')],qs[_0xe5d8('0x33')](_0x50527d['query'][_0xe5d8('0x33')]));_0x3cd5e5['attributes']=_0x3cd5e5[_0xe5d8('0x31')][_0xe5d8('0x34')]?_0x3cd5e5[_0xe5d8('0x31')]:_0x1b5523[_0xe5d8('0x2e')];if(_0x50527d[_0xe5d8('0x30')][_0xe5d8('0x3d')]){_0x3cd5e5[_0xe5d8('0x3e')]=[{'all':!![]}];}_0x3cd5e5=_['merge']({},_0x3cd5e5,_0x50527d[_0xe5d8('0x3b')]);return db[_0xe5d8('0x2a')][_0xe5d8('0x44')](_0x3cd5e5)[_0xe5d8('0x24')](handleEntityNotFound(_0x33397f,null))[_0xe5d8('0x24')](respondWithResult(_0x33397f,null))['catch'](handleError(_0x33397f,null));};exports[_0xe5d8('0x45')]=function(_0x5a5b85,_0x10ef83){if(_0x5a5b85['body']['id']){delete _0x5a5b85[_0xe5d8('0x46')]['id'];}return db[_0xe5d8('0x2a')]['find']({'where':{'id':_0x5a5b85['params']['id']}})['then'](handleEntityNotFound(_0x10ef83,null))['then'](saveUpdates(_0x5a5b85['body'],null))['then'](respondWithResult(_0x10ef83,null))[_0xe5d8('0x41')](handleError(_0x10ef83,null));};exports['destroy']=function(_0x5b1116,_0x58230f){return db[_0xe5d8('0x2a')][_0xe5d8('0x44')]({'where':{'id':_0x5b1116[_0xe5d8('0x47')]['id']}})[_0xe5d8('0x24')](handleEntityNotFound(_0x58230f,null))[_0xe5d8('0x24')](removeEntity(_0x58230f,null))['catch'](handleError(_0x58230f,null));};exports[_0xe5d8('0x48')]=function(_0x358216,_0x2e8866){var _0x43e29a;return db[_0xe5d8('0x49')][_0xe5d8('0x4a')](function(_0x2553ad){return db[_0xe5d8('0x2a')][_0xe5d8('0x48')](_0x358216['body'],{'transaction':_0x2553ad})['then'](function(_0x882bf9){_0x43e29a=_0x882bf9;var _0x23a84e={'type':db[_0xe5d8('0x4b')][_0xe5d8('0x4c')],'transaction':_0x2553ad};switch(_0x358216[_0xe5d8('0x46')]['type']){case _0xe5d8('0x4d'):_0x23a84e[_0xe5d8('0x2c')]=db[_0xe5d8('0x4b')]['TEXT'];break;case _0xe5d8('0x4e'):_0x23a84e[_0xe5d8('0x2c')]=db['Sequelize'][_0xe5d8('0x4f')];break;case _0xe5d8('0x50'):_0x23a84e[_0xe5d8('0x2c')]=db[_0xe5d8('0x4b')]['BOOLEAN'];_0x23a84e['defaultValue']=![];break;default:}return db[_0xe5d8('0x49')]['queryInterface'][_0xe5d8('0x51')](_0xe5d8('0x52'),util[_0xe5d8('0x53')](_0xe5d8('0x54'),_0x43e29a['id']),_0x23a84e);})['then'](function(){return _0x43e29a;});})['then'](respondWithResult(_0x2e8866,0xc9))['catch'](handleError(_0x2e8866,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c160351..7a64b35 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 _0xb133=['lodash','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields'];(function(_0x2d900d,_0x2a51aa){var _0x3619e9=function(_0x2088e5){while(--_0x2088e5){_0x2d900d['push'](_0x2d900d['shift']());}};_0x3619e9(++_0x2a51aa);}(_0xb133,0xb4));var _0x3b13=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb133[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3b13('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3b13('0x1'));var BPromise=require(_0x3b13('0x2'));var rp=require(_0x3b13('0x3'));var fs=require('fs');var path=require(_0x3b13('0x4'));var rimraf=require(_0x3b13('0x5'));var config=require('../../config/environment');var attributes=require(_0x3b13('0x6'));module['exports']=function(_0x3806cd,_0x5476ad){return _0x3806cd[_0x3b13('0x7')](_0x3b13('0x8'),attributes,{'tableName':_0x3b13('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4704=['exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x4704,0xdf));var _0x4470=function(_0x3d3590,_0x23bd12){_0x3d3590=_0x3d3590-0x0;var _0x1348ff=_0x4704[_0x3d3590];return _0x1348ff;};'use strict';var _=require(_0x4470('0x0'));var util=require(_0x4470('0x1'));var logger=require(_0x4470('0x2'))('api');var moment=require(_0x4470('0x3'));var BPromise=require(_0x4470('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4470('0x5'));var config=require(_0x4470('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x4470('0x7')]=function(_0x2c1629,_0x380bce){return _0x2c1629['define'](_0x4470('0x8'),attributes,{'tableName':_0x4470('0x9'),'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 dc50826..86b4057 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 _0x3f20=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x3f20,0x1d0));var _0x03f2=function(_0x133eb2,_0x56f0b7){_0x133eb2=_0x133eb2-0x0;var _0x5e2761=_0x3f20[_0x133eb2];return _0x5e2761;};'use strict';var _=require(_0x03f2('0x0'));var util=require(_0x03f2('0x1'));var moment=require(_0x03f2('0x2'));var BPromise=require(_0x03f2('0x3'));var rs=require(_0x03f2('0x4'));var fs=require('fs');var Redis=require(_0x03f2('0x5'));var db=require(_0x03f2('0x6'))['db'];var utils=require(_0x03f2('0x7'));var logger=require(_0x03f2('0x8'))('rpc');var config=require(_0x03f2('0x9'));var jayson=require(_0x03f2('0xa'));var client=jayson[_0x03f2('0xb')][_0x03f2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c8add,_0x283013,_0x27199e){return new BPromise(function(_0x152c37,_0x3a900d){return client['request'](_0x5c8add,_0x27199e)[_0x03f2('0xd')](function(_0x43c901){logger[_0x03f2('0xe')](_0x03f2('0xf'),_0x283013,_0x03f2('0x10'));logger['debug'](_0x03f2('0x11'),_0x283013,'request\x20sent',JSON[_0x03f2('0x12')](_0x43c901));if(_0x43c901['error']){if(_0x43c901[_0x03f2('0x13')][_0x03f2('0x14')]===0x1f4){logger[_0x03f2('0x13')](_0x03f2('0xf'),_0x283013,_0x43c901[_0x03f2('0x13')][_0x03f2('0x15')]);return _0x3a900d(_0x43c901[_0x03f2('0x13')][_0x03f2('0x15')]);}logger['error'](_0x03f2('0xf'),_0x283013,_0x43c901[_0x03f2('0x13')][_0x03f2('0x15')]);return _0x152c37(_0x43c901['error'][_0x03f2('0x15')]);}else{logger[_0x03f2('0xe')](_0x03f2('0xf'),_0x283013,'request\x20sent');_0x152c37(_0x43c901[_0x03f2('0x16')]['message']);}})['catch'](function(_0x18e7c7){logger[_0x03f2('0x13')](_0x03f2('0xf'),_0x283013,_0x18e7c7);_0x3a900d(_0x18e7c7);});});} \ No newline at end of file +var _0x553a=['message','result','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','then','info','debug','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x553a,0x192));var _0xa553=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0x553a[_0x11fbaa];return _0x1831fd;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var moment=require('moment');var BPromise=require(_0xa553('0x1'));var rs=require(_0xa553('0x2'));var fs=require('fs');var Redis=require(_0xa553('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa553('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa553('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18da5d,_0x3da5c7,_0xaae97){return new BPromise(function(_0x48f7d2,_0x25bbb7){return client['request'](_0x18da5d,_0xaae97)[_0xa553('0x6')](function(_0xf6e0db){logger[_0xa553('0x7')]('CmCustomField,\x20%s,\x20%s',_0x3da5c7,'request\x20sent');logger[_0xa553('0x8')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3da5c7,_0xa553('0x9'),JSON[_0xa553('0xa')](_0xf6e0db));if(_0xf6e0db[_0xa553('0xb')]){if(_0xf6e0db['error'][_0xa553('0xc')]===0x1f4){logger[_0xa553('0xb')](_0xa553('0xd'),_0x3da5c7,_0xf6e0db['error'][_0xa553('0xe')]);return _0x25bbb7(_0xf6e0db[_0xa553('0xb')][_0xa553('0xe')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x3da5c7,_0xf6e0db[_0xa553('0xb')][_0xa553('0xe')]);return _0x48f7d2(_0xf6e0db[_0xa553('0xb')][_0xa553('0xe')]);}else{logger['info'](_0xa553('0xd'),_0x3da5c7,'request\x20sent');_0x48f7d2(_0xf6e0db[_0xa553('0xf')]['message']);}})['catch'](function(_0x1d0f4e){logger['error'](_0xa553('0xd'),_0x3da5c7,_0x1d0f4e);_0x25bbb7(_0x1d0f4e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5d53bca..0c39c31 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 _0xd4c5=['post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4f32ff,_0x4f8a98){var _0x1640e=function(_0x4adee4){while(--_0x4adee4){_0x4f32ff['push'](_0x4f32ff['shift']());}};_0x1640e(++_0x4f8a98);}(_0xd4c5,0x1d2));var _0x5d4c=function(_0x3a84a1,_0x4c89e0){_0x3a84a1=_0x3a84a1-0x0;var _0x251767=_0xd4c5[_0x3a84a1];return _0x251767;};'use strict';var multer=require(_0x5d4c('0x0'));var util=require(_0x5d4c('0x1'));var path=require(_0x5d4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d4c('0x3'));var router=express[_0x5d4c('0x4')]();var fs_extra=require(_0x5d4c('0x5'));var auth=require(_0x5d4c('0x6'));var interaction=require(_0x5d4c('0x7'));var config=require(_0x5d4c('0x8'));var controller=require('./cmCustomField.controller');router[_0x5d4c('0x9')]('/',auth[_0x5d4c('0xa')](),controller[_0x5d4c('0xb')]);router[_0x5d4c('0x9')](_0x5d4c('0xc'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0xd')]);router[_0x5d4c('0xe')]('/',auth[_0x5d4c('0xa')](),controller[_0x5d4c('0xf')]);router[_0x5d4c('0x10')](_0x5d4c('0xc'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x11')]);router['delete'](_0x5d4c('0xc'),auth['isAuthenticated'](),controller[_0x5d4c('0x12')]);module[_0x5d4c('0x13')]=router; \ No newline at end of file +var _0x59cf=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59cf,0x158));var _0xf59c=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x59cf[_0x48c4ef];return _0x435715;};'use strict';var multer=require(_0xf59c('0x0'));var util=require(_0xf59c('0x1'));var path=require(_0xf59c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf59c('0x3'));var interaction=require(_0xf59c('0x4'));var config=require(_0xf59c('0x5'));var controller=require('./cmCustomField.controller');router[_0xf59c('0x6')]('/',auth['isAuthenticated'](),controller[_0xf59c('0x7')]);router[_0xf59c('0x6')]('/:id',auth[_0xf59c('0x8')](),controller[_0xf59c('0x9')]);router['post']('/',auth[_0xf59c('0x8')](),controller[_0xf59c('0xa')]);router[_0xf59c('0xb')](_0xf59c('0xc'),auth[_0xf59c('0x8')](),controller['update']);router[_0xf59c('0xd')](_0xf59c('0xc'),auth[_0xf59c('0x8')](),controller[_0xf59c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index fbfd5a2..7936490 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 _0xda2d=['UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER'];(function(_0x25ada8,_0x140ac9){var _0x51e173=function(_0x49824d){while(--_0x49824d){_0x25ada8['push'](_0x25ada8['shift']());}};_0x51e173(++_0x140ac9);}(_0xda2d,0x102));var _0xdda2=function(_0x4eb648,_0x5da52b){_0x4eb648=_0x4eb648-0x0;var _0x351fa2=_0xda2d[_0x4eb648];return _0x351fa2;};'use strict';var moment=require('moment');var Sequelize=require(_0xdda2('0x0'));module[_0xdda2('0x1')]={'phone':{'type':Sequelize[_0xdda2('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdda2('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdda2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdda2('0x4')]},'priority':{'type':Sequelize[_0xdda2('0x5')](0x2)[_0xdda2('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdda2('0x5')],'unique':_0xdda2('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xdda2('0x7')},'UserId':{'type':Sequelize[_0xdda2('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xdda2('0x7')},'CampaignId':{'type':Sequelize[_0xdda2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdda2('0x5')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdda2('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xf61e=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x216ce3,_0x446a98){var _0x16278d=function(_0x38860e){while(--_0x38860e){_0x216ce3['push'](_0x216ce3['shift']());}};_0x16278d(++_0x446a98);}(_0xf61e,0x191));var _0xef61=function(_0x418167,_0x22ef10){_0x418167=_0x418167-0x0;var _0x4b350e=_0xf61e[_0x418167];return _0x4b350e;};'use strict';var moment=require(_0xef61('0x0'));var Sequelize=require(_0xef61('0x1'));module[_0xef61('0x2')]={'phone':{'type':Sequelize[_0xef61('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xef61('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xef61('0x5')],'defaultValue':moment()[_0xef61('0x6')](_0xef61('0x7'))},'countbusyretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xef61('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xef61('0x5')]},'priority':{'type':Sequelize[_0xef61('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xef61('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xef61('0x8')],'unique':_0xef61('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xef61('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xef61('0x8')],'unique':_0xef61('0x9')},'CampaignId':{'type':Sequelize[_0xef61('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xef61('0x8')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xef61('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xef61('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 7991c7b..0338860 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 _0xbdeb=['key','model','query','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$between','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','body','describe','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','CmContact','ContactId','firstName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','hopperId','UPDATE','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','rimraf','fast-json-patch','moment','bluebird','mustache','util','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/license/util','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','CmHopper','fieldName','type'];(function(_0x4a6b08,_0x21acfb){var _0x37b941=function(_0x1afee1){while(--_0x1afee1){_0x4a6b08['push'](_0x4a6b08['shift']());}};_0x37b941(++_0x21acfb);}(_0xbdeb,0x6f));var _0xbbde=function(_0x1faa6e,_0x423197){_0x1faa6e=_0x1faa6e-0x0;var _0x15fc1d=_0xbdeb[_0x1faa6e];return _0x15fc1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbde('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbde('0x1'));var rp=require('request-promise');var moment=require(_0xbbde('0x2'));var BPromise=require(_0xbbde('0x3'));var Mustache=require(_0xbbde('0x4'));var util=require(_0xbbde('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbbde('0x6'));var ejs=require(_0xbbde('0x7'));var fs=require('fs');var fs_extra=require(_0xbbde('0x8'));var _=require(_0xbbde('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbbde('0xa'));var deskjs=require(_0xbbde('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbbde('0xc'));var Papa=require(_0xbbde('0xd'));var Redis=require(_0xbbde('0xe'));var authService=require(_0xbbde('0xf'));var qs=require(_0xbbde('0x10'));var as=require(_0xbbde('0x11'));var hardwareService=require(_0xbbde('0x12'));var logger=require(_0xbbde('0x13'))(_0xbbde('0x14'));var utils=require(_0xbbde('0x15'));var config=require('../../config/environment');var shared=require('../../config/environment');var licenseUtil=require(_0xbbde('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d09fa,_0x55e439){_0x55e439=_0x55e439||0xcc;return function(_0x38fba2){if(_0x38fba2){return _0x3d09fa[_0xbbde('0x17')](_0x55e439);}return _0x3d09fa[_0xbbde('0x18')](_0x55e439)[_0xbbde('0x19')]();};}function respondWithResult(_0x4afa45,_0x374e93){_0x374e93=_0x374e93||0xc8;return function(_0x1b6a23){if(_0x1b6a23){return _0x4afa45['status'](_0x374e93)[_0xbbde('0x1a')](_0x1b6a23);}};}function respondWithFilteredResult(_0x13db58,_0x4b3c6f){return function(_0x5ce713){if(_0x5ce713){var _0x4f23d7=typeof _0x4b3c6f['offset']===_0xbbde('0x1b')&&typeof _0x4b3c6f['limit']===_0xbbde('0x1b');var _0x939bc2=_0x5ce713['count'];var _0x2073d1=_0x4f23d7?0x0:_0x4b3c6f[_0xbbde('0x1c')];var _0xeb6b63=_0x4f23d7?_0x5ce713[_0xbbde('0x1d')]:_0x4b3c6f[_0xbbde('0x1c')]+_0x4b3c6f[_0xbbde('0x1e')];var _0x49e8e5;if(_0xeb6b63>=_0x939bc2){_0xeb6b63=_0x939bc2;_0x49e8e5=0xc8;}else{_0x49e8e5=0xce;}_0x13db58[_0xbbde('0x18')](_0x49e8e5);return _0x13db58[_0xbbde('0x1f')](_0xbbde('0x20'),_0x2073d1+'-'+_0xeb6b63+'/'+_0x939bc2)[_0xbbde('0x1a')](_0x5ce713);}return null;};}function patchUpdates(_0x1a5c58){return function(_0x51d22c){try{jsonpatch[_0xbbde('0x21')](_0x51d22c,_0x1a5c58,!![]);}catch(_0x3355e6){return BPromise[_0xbbde('0x22')](_0x3355e6);}return _0x51d22c[_0xbbde('0x23')]();};}function saveUpdates(_0x2c2c14,_0x31b97d){return function(_0x329d54){if(_0x329d54){return _0x329d54[_0xbbde('0x24')](_0x2c2c14)[_0xbbde('0x25')](function(_0x1b6f82){return _0x1b6f82;});}return null;};}function removeEntity(_0x4ac50b,_0x45db0e){return function(_0x460194){if(_0x460194){return _0x460194[_0xbbde('0x26')]()['then'](function(){_0x4ac50b[_0xbbde('0x18')](0xcc)[_0xbbde('0x19')]();});}};}function handleEntityNotFound(_0xad2657,_0x61d0a8){return function(_0x20a180){if(!_0x20a180){_0xad2657['sendStatus'](0x194);}return _0x20a180;};}function handleError(_0xbcf40e,_0x14243a){_0x14243a=_0x14243a||0x1f4;return function(_0x4ec095){logger[_0xbbde('0x27')](_0x4ec095[_0xbbde('0x28')]);if(_0x4ec095[_0xbbde('0x29')]){delete _0x4ec095[_0xbbde('0x29')];}_0xbcf40e[_0xbbde('0x18')](_0x14243a)['send'](_0x4ec095);};}exports['index']=function(_0x18bc12,_0x36a98a){var _0x5ac8a2={},_0x1ee462={},_0x22413b={'count':0x0,'rows':[]};var _0x2762ed=_[_0xbbde('0x2a')](db[_0xbbde('0x2b')]['rawAttributes'],function(_0x387eb3){return{'name':_0x387eb3[_0xbbde('0x2c')],'type':_0x387eb3[_0xbbde('0x2d')][_0xbbde('0x2e')]};});_0x1ee462[_0xbbde('0x2f')]=_['map'](_0x2762ed,_0xbbde('0x29'));_0x1ee462[_0xbbde('0x30')]=_['keys'](_0x18bc12['query']);_0x1ee462[_0xbbde('0x31')]=_[_0xbbde('0x32')](_0x1ee462[_0xbbde('0x2f')],_0x1ee462[_0xbbde('0x30')]);_0x1ee462[_0xbbde('0x31')]=_[_0xbbde('0x33')](_0x1ee462[_0xbbde('0x31')],[_0xbbde('0x34'),_0xbbde('0x35'),'$gt',_0xbbde('0x36'),_0xbbde('0x37'),_0xbbde('0x38'),_0xbbde('0x39'),'$eq','$not',_0xbbde('0x3a'),_0xbbde('0x3b'),_0xbbde('0x3c'),_0xbbde('0x3d'),'$like',_0xbbde('0x3e'),'$iLike',_0xbbde('0x3f'),_0xbbde('0x40'),_0xbbde('0x41'),_0xbbde('0x42'),_0xbbde('0x43'),'$any']);_0x5ac8a2[_0xbbde('0x44')]=_[_0xbbde('0x32')](_0x1ee462['model'],qs[_0xbbde('0x45')](_0x18bc12[_0xbbde('0x30')]['fields']));_0x5ac8a2[_0xbbde('0x44')]=_0x5ac8a2['attributes'][_0xbbde('0x46')]?_0x5ac8a2[_0xbbde('0x44')]:_0x1ee462[_0xbbde('0x2f')];if(!_0x18bc12['query'][_0xbbde('0x47')](_0xbbde('0x48'))){_0x5ac8a2['limit']=qs[_0xbbde('0x1e')](_0x18bc12['query'][_0xbbde('0x1e')]);_0x5ac8a2[_0xbbde('0x1c')]=qs['offset'](_0x18bc12[_0xbbde('0x30')][_0xbbde('0x1c')]);}_0x5ac8a2[_0xbbde('0x49')]=qs[_0xbbde('0x4a')](_0x18bc12['query'][_0xbbde('0x4a')]);_0x5ac8a2[_0xbbde('0x4b')]=qs['filters'](_[_0xbbde('0x4c')](_0x18bc12[_0xbbde('0x30')],_0x1ee462[_0xbbde('0x31')]),_0x2762ed);if(_0x18bc12[_0xbbde('0x30')]['filter']){_0x5ac8a2[_0xbbde('0x4b')]=_[_0xbbde('0x4d')](_0x5ac8a2['where'],{'$or':_[_0xbbde('0x2a')](_0x2762ed,function(_0x4d2f8c){if(_0x4d2f8c['type']!==_0xbbde('0x4e')){var _0x6a5b40={};_0x6a5b40[_0x4d2f8c[_0xbbde('0x29')]]={'$like':'%'+_0x18bc12[_0xbbde('0x30')][_0xbbde('0x4f')]+'%'};return _0x6a5b40;}})});}_0x5ac8a2=_[_0xbbde('0x4d')]({},_0x5ac8a2,_0x18bc12['options']);var _0x1e4fc1={'where':_0x5ac8a2[_0xbbde('0x4b')]};return db[_0xbbde('0x2b')][_0xbbde('0x1d')](_0x1e4fc1)[_0xbbde('0x25')](function(_0x5eaad9){_0x22413b[_0xbbde('0x1d')]=_0x5eaad9;if(_0x18bc12[_0xbbde('0x30')][_0xbbde('0x50')]){_0x5ac8a2['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5ac8a2);})[_0xbbde('0x25')](function(_0x5cb21d){_0x22413b[_0xbbde('0x51')]=_0x5cb21d;return _0x22413b;})[_0xbbde('0x25')](respondWithFilteredResult(_0x36a98a,_0x5ac8a2))[_0xbbde('0x52')](handleError(_0x36a98a,null));};exports[_0xbbde('0x53')]=function(_0x5431c9,_0x11048e){var _0x135345={'raw':!![],'where':{'id':_0x5431c9[_0xbbde('0x54')]['id']}},_0x49b9cd={};_0x49b9cd[_0xbbde('0x2f')]=_['keys'](db['CmHopper']['rawAttributes']);_0x49b9cd[_0xbbde('0x30')]=_[_0xbbde('0x55')](_0x5431c9[_0xbbde('0x30')]);_0x49b9cd['filters']=_['intersection'](_0x49b9cd[_0xbbde('0x2f')],_0x49b9cd['query']);_0x135345[_0xbbde('0x44')]=_['intersection'](_0x49b9cd[_0xbbde('0x2f')],qs['fields'](_0x5431c9['query'][_0xbbde('0x45')]));_0x135345[_0xbbde('0x44')]=_0x135345[_0xbbde('0x44')]['length']?_0x135345['attributes']:_0x49b9cd[_0xbbde('0x2f')];if(_0x5431c9[_0xbbde('0x30')]['includeAll']){_0x135345[_0xbbde('0x56')]=[{'all':!![]}];}_0x135345=_[_0xbbde('0x4d')]({},_0x135345,_0x5431c9[_0xbbde('0x57')]);return db['CmHopper'][_0xbbde('0x58')](_0x135345)[_0xbbde('0x25')](handleEntityNotFound(_0x11048e,null))[_0xbbde('0x25')](respondWithResult(_0x11048e,null))['catch'](handleError(_0x11048e,null));};exports[_0xbbde('0x59')]=function(_0x493b18,_0x36781d){return db[_0xbbde('0x2b')][_0xbbde('0x59')](_0x493b18['body'],{})[_0xbbde('0x25')](respondWithResult(_0x36781d,0xc9))['catch'](handleError(_0x36781d,null));};exports[_0xbbde('0x24')]=function(_0x37c2ea,_0x2b4810){if(_0x37c2ea[_0xbbde('0x5a')]['id']){delete _0x37c2ea[_0xbbde('0x5a')]['id'];}return db['CmHopper'][_0xbbde('0x58')]({'where':{'id':_0x37c2ea['params']['id']}})[_0xbbde('0x25')](handleEntityNotFound(_0x2b4810,null))[_0xbbde('0x25')](saveUpdates(_0x37c2ea[_0xbbde('0x5a')],null))[_0xbbde('0x25')](respondWithResult(_0x2b4810,null))['catch'](handleError(_0x2b4810,null));};exports['describe']=function(_0x106edd,_0x13714a){return db['CmHopper'][_0xbbde('0x5b')]()[_0xbbde('0x25')](respondWithResult(_0x13714a,null))['catch'](handleError(_0x13714a,null));};exports[_0xbbde('0x26')]=function(_0x56c10d,_0x1f55ae){var _0x514980;return db[_0xbbde('0x2b')][_0xbbde('0x58')]({'where':{'id':_0x56c10d[_0xbbde('0x54')]['id']}})[_0xbbde('0x25')](handleEntityNotFound(_0x1f55ae,null))[_0xbbde('0x25')](function(_0x25e4dd){if(_0x25e4dd){return _0x25e4dd[_0xbbde('0x26')]()[_0xbbde('0x25')](function(_0x4d1f3d){return _0x4d1f3d;});}})[_0xbbde('0x25')](function(_0x42db9f){_0x514980=_0x42db9f;if(_0x42db9f){if(_0x42db9f['VoiceQueueId']||_0x42db9f[_0xbbde('0x5c')]){return db[_0x42db9f['VoiceQueueId']?_0xbbde('0x5d'):_0xbbde('0x5e')][_0xbbde('0x58')]({'where':{'id':_0x42db9f[_0xbbde('0x5f')]?_0x42db9f['VoiceQueueId']:_0x42db9f[_0xbbde('0x5c')]},'attributes':['id','name'],'raw':!![]});}}})[_0xbbde('0x25')](function(_0x22456e){var _0x331025={};if(_0x22456e){_[_0xbbde('0x4d')](_0x331025,_[_0xbbde('0x60')](_0x514980['dataValues'],['createdAt',_0xbbde('0x61'),'id']));_0x331025[_0xbbde('0x62')]=0x15;_0x331025[_0xbbde('0x63')]=_0xbbde('0x64');_0x331025[_0xbbde('0x65')]=_0x22456e[_0xbbde('0x29')];_0x331025[_0xbbde('0x66')]=_0x56c10d[_0xbbde('0x67')][_0xbbde('0x29')];_0x331025[_0xbbde('0x68')]=_0x56c10d[_0xbbde('0x67')]['id'];_0x331025[_0xbbde('0x64')]=!![];_0x331025[_0xbbde('0x69')]=moment()['format'](_0xbbde('0x6a'));_0x331025[_0xbbde('0x6b')]=_0x514980[_0xbbde('0x6c')];_0x331025['campaigntype']=_0x514980[_0xbbde('0x5f')]?'queue':'ivr';return db[_0xbbde('0x6d')]['find']({'where':{'id':_0x331025[_0xbbde('0x6e')]},'attributes':[_0xbbde('0x6f'),'lastName']})[_0xbbde('0x25')](function(_0x2d2e9f){if(!_[_0xbbde('0x70')](_0x1f55ae)&&!_[_0xbbde('0x70')](_0x2d2e9f['firstName'])){_0x331025[_0xbbde('0x71')]=_0x2d2e9f['firstName'];if(!_[_0xbbde('0x70')](_0x2d2e9f['lastName'])){_0x331025[_0xbbde('0x71')]+='\x20'+_0x2d2e9f['lastName'];}}})['finally'](function(){return db[_0xbbde('0x72')]['create'](_0x331025);});}})['then'](function(){return _0x1f55ae[_0xbbde('0x18')](0xcc)[_0xbbde('0x19')]();})[_0xbbde('0x52')](handleError(_0x1f55ae,null));};exports[_0xbbde('0x73')]=function(_0xb9ac23,_0x33f4dc,_0x58a26c){var _0x44ce5d=[];return db[_0xbbde('0x6d')][_0xbbde('0x5b')]()['then'](function(_0x278a44){_0x44ce5d=_[_0xbbde('0x55')](_0x278a44);return _0xb9ac23[_0xbbde('0x67')][_0xbbde('0x74')]({'where':{'type':_0xbbde('0x75'),'dialActive':!![],'dialMethod':_0xbbde('0x76')},'attributes':['id','dialOrderByScheduledAt',_0xbbde('0x77')],'raw':!![]});})[_0xbbde('0x25')](function(_0x2db950){if(_0x2db950&&_0x2db950['length']){return db[_0xbbde('0x78')][_0xbbde('0x79')](function(_0x3f208d){var _0x1f9654={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbbde('0x7a')](_0xbbde('0x6a'))},'VoiceQueueId':{'$in':_[_0xbbde('0x2a')](_0x2db950,'id')},'$or':[{'UserId':null},{'UserId':_0xb9ac23[_0xbbde('0x67')]['id']}]};var _0x1e12c6={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2db950)[_0xbbde('0x4f')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0xbbde('0x7b')]()},'$or':[{'UserId':null},{'UserId':_0xb9ac23[_0xbbde('0x67')]['id']}]};var _0x27dea7={'$or':[_0x1f9654,_0x1e12c6]};var _0x29aa8b=[];if(_0xb9ac23['body'][_0xbbde('0x7c')]&&_0xb9ac23[_0xbbde('0x5a')]['direction']===_0xbbde('0x7d')){if(!_[_0xbbde('0x7e')](_0xb9ac23[_0xbbde('0x5a')][_0xbbde('0x7f')])){_0x27dea7['id']={'$in':_0xb9ac23['body'][_0xbbde('0x7f')]};}_0x29aa8b=[['priority',_0xbbde('0x80')],['scheduledAt',_0x2db950[0x0][_0xbbde('0x81')]===_0xbbde('0x80')?_0xbbde('0x82'):_0xbbde('0x80')],db[_0xbbde('0x78')][_0xbbde('0x83')](_0xbbde('0x84')),['id',_0xbbde('0x82')]];}else{if(!_['isEmpty'](_0xb9ac23['body'][_0xbbde('0x7f')])){_0x27dea7['id']={'$notIn':_0xb9ac23[_0xbbde('0x5a')][_0xbbde('0x7f')]};}_0x29aa8b=[[_0xbbde('0x85'),'DESC'],[_0xbbde('0x86'),_0x2db950[0x0][_0xbbde('0x81')]],db[_0xbbde('0x78')][_0xbbde('0x83')](_0xbbde('0x87')),['id','ASC']];}return db[_0xbbde('0x2b')][_0xbbde('0x88')]({'attributes':['id',_0xbbde('0x89'),_0xbbde('0x8a')],'where':_0x27dea7,'order':_0x29aa8b,'transaction':_0x3f208d,'lock':_0x3f208d[_0xbbde('0x8b')]['UPDATE'],'include':[{'model':db[_0xbbde('0x6d')],'as':_0xbbde('0x8c'),'attributes':_0x44ce5d,'include':[{'model':db[_0xbbde('0x8d')],'as':_0xbbde('0x8e'),'attributes':['id',_0xbbde('0x29')]}]},{'model':db[_0xbbde('0x8f')],'as':_0xbbde('0x90'),'attributes':['id','name']},{'model':db[_0xbbde('0x5d')],'as':_0xbbde('0x91'),'attributes':['id','name',_0xbbde('0x92')]}]})['then'](function(_0x463842){if(_0x463842){return _0x463842[_0xbbde('0x24')]({'UserId':_0xb9ac23['user']['id']},{'transaction':_0x3f208d});}});});}})[_0xbbde('0x25')](handleEntityNotFound(_0x33f4dc,null))[_0xbbde('0x25')](respondWithResult(_0x33f4dc,null))[_0xbbde('0x52')](handleError(_0x33f4dc,null));};exports[_0xbbde('0x93')]=function(_0x493cd5,_0xae5b07,_0x81d0b6){var _0x34c806=[];return db[_0xbbde('0x6d')][_0xbbde('0x5b')]()['then'](function(_0x1f8e69){_0x34c806=_[_0xbbde('0x55')](_0x1f8e69);return _0x493cd5[_0xbbde('0x67')][_0xbbde('0x74')]({'where':{'type':_0xbbde('0x75'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xbbde('0x81'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x5d2981){if(_0x5d2981&&_0x5d2981['length']){return db[_0xbbde('0x78')]['transaction'](function(_0x48b4f4){var _0x9f1642={'active':![],'recallme':!![],'id':_0x493cd5[_0xbbde('0x5a')][_0xbbde('0x94')]};return db[_0xbbde('0x2b')][_0xbbde('0x88')]({'attributes':['id',_0xbbde('0x89'),'recallme'],'where':_0x9f1642,'transaction':_0x48b4f4,'lock':_0x48b4f4[_0xbbde('0x8b')][_0xbbde('0x95')],'include':[{'model':db[_0xbbde('0x6d')],'as':_0xbbde('0x8c'),'attributes':_0x34c806,'include':[{'model':db[_0xbbde('0x8d')],'as':_0xbbde('0x8e'),'attributes':['id',_0xbbde('0x29')]}]},{'model':db[_0xbbde('0x8f')],'as':_0xbbde('0x90'),'attributes':['id',_0xbbde('0x29')]},{'model':db['VoiceQueue'],'as':_0xbbde('0x91'),'attributes':['id',_0xbbde('0x29'),_0xbbde('0x92')]}]})['then'](function(_0x1190fc){if(_0x1190fc){return _0x1190fc['update']({'UserId':_0x493cd5['user']['id']},{'transaction':_0x48b4f4});}});});}})['then'](handleEntityNotFound(_0xae5b07,null))[_0xbbde('0x25')](respondWithResult(_0xae5b07,null))[_0xbbde('0x52')](handleError(_0xae5b07,null));};exports[_0xbbde('0x96')]=function(_0x4e778c,_0x3f9977,_0x2192fd){return _0x4e778c[_0xbbde('0x67')][_0xbbde('0x74')]({'where':{'type':_0xbbde('0x75'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x3a019e){if(_0x3a019e&&_0x3a019e['length']){return db['CmHopper'][_0xbbde('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbbde('0x6a'))},'VoiceQueueId':{'$in':_[_0xbbde('0x2a')](_0x3a019e,'id')},'$or':[{'UserId':null},{'UserId':_0x4e778c[_0xbbde('0x67')]['id']}]}});}return 0x0;})[_0xbbde('0x25')](function(_0x4d37af){if(!_[_0xbbde('0x70')](_0x4d37af)&&_['isNumber'](_0x4d37af)){return _0x3f9977['status'](0xc8)[_0xbbde('0x1a')]({'contacts':_0x4d37af});}else{logger[_0xbbde('0x27')](_0xbbde('0x97'),_0xbbde('0x96'),0x194,_0xbbde('0x98'));_0x3f9977[_0xbbde('0x17')](0x194);}})[_0xbbde('0x52')](handleError(_0x3f9977,null));};exports[_0xbbde('0x99')]=function(_0x3db9d4,_0x2721e4,_0x26963b){var _0x58cbd8=shared['timezones'];var _0x1f6361=[];_['map'](_0x58cbd8,function(_0x125585){_0x1f6361[_0xbbde('0x9a')]({'id':_0x125585['name'],'name':_0x125585[_0xbbde('0x29')],'utcOffset':_0x125585[_0xbbde('0x9b')]});});return _0x2721e4[_0xbbde('0x18')](0xc8)[_0xbbde('0x1a')]({'tz':_0x1f6361});};exports['getTimezone']=function(_0x564f05,_0x2739d1,_0x4c19e4){var _0x79cd4a=shared[_0xbbde('0x9c')];var _0x48f5b2={};if(!_['isNil'](_0x79cd4a[_0x564f05[_0xbbde('0x5a')]['id']]))_0x48f5b2=_0x79cd4a[_0x564f05[_0xbbde('0x5a')]['id']];return _0x2739d1[_0xbbde('0x18')](0xc8)[_0xbbde('0x1a')](_0x48f5b2);}; \ No newline at end of file +var _0xddbb=['CmHopperFinal','getPreview','getVoiceQueues','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','CmCompany','Company','CmList','VoiceQueue','Queue','dialActive','getPreviewRecall','outbound','preview','hopperId','findOne','scheduledat','Contact','List','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','getTimezone','timezones','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$or','$gt','$lte','$eq','$not','$between','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','Campaign','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally'];(function(_0x50576c,_0x502d9c){var _0x22c1ef=function(_0x4067e7){while(--_0x4067e7){_0x50576c['push'](_0x50576c['shift']());}};_0x22c1ef(++_0x502d9c);}(_0xddbb,0xbf));var _0xbddb=function(_0x19ef73,_0x35d3a2){_0x19ef73=_0x19ef73-0x0;var _0x33f75f=_0xddbb[_0x19ef73];return _0x33f75f;};'use strict';var emlformat=require(_0xbddb('0x0'));var rimraf=require(_0xbddb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbddb('0x2'));var rp=require(_0xbddb('0x3'));var moment=require(_0xbddb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbddb('0x5'));var sox=require(_0xbddb('0x6'));var csv=require('to-csv');var ejs=require(_0xbddb('0x7'));var fs=require('fs');var fs_extra=require(_0xbddb('0x8'));var _=require('lodash');var squel=require(_0xbddb('0x9'));var crypto=require(_0xbddb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbddb('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbddb('0xc'));var Papa=require(_0xbddb('0xd'));var Redis=require(_0xbddb('0xe'));var authService=require(_0xbddb('0xf'));var qs=require(_0xbddb('0x10'));var as=require(_0xbddb('0x11'));var hardwareService=require(_0xbddb('0x12'));var logger=require(_0xbddb('0x13'))(_0xbddb('0x14'));var utils=require(_0xbddb('0x15'));var config=require(_0xbddb('0x16'));var shared=require(_0xbddb('0x16'));var licenseUtil=require(_0xbddb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a196c,_0x15a181){_0x15a181=_0x15a181||0xcc;return function(_0x2addaa){if(_0x2addaa){return _0x3a196c[_0xbddb('0x18')](_0x15a181);}return _0x3a196c[_0xbddb('0x19')](_0x15a181)[_0xbddb('0x1a')]();};}function respondWithResult(_0x46f5f9,_0x5e4d78){_0x5e4d78=_0x5e4d78||0xc8;return function(_0x38b3ca){if(_0x38b3ca){return _0x46f5f9[_0xbddb('0x19')](_0x5e4d78)[_0xbddb('0x1b')](_0x38b3ca);}};}function respondWithFilteredResult(_0x4282da,_0x4b5fc3){return function(_0x5e2dd4){if(_0x5e2dd4){var _0x5bc6b3=typeof _0x4b5fc3[_0xbddb('0x1c')]===_0xbddb('0x1d')&&typeof _0x4b5fc3[_0xbddb('0x1e')]===_0xbddb('0x1d');var _0x5adb42=_0x5e2dd4['count'];var _0xe23dd8=_0x5bc6b3?0x0:_0x4b5fc3[_0xbddb('0x1c')];var _0x7894b3=_0x5bc6b3?_0x5e2dd4[_0xbddb('0x1f')]:_0x4b5fc3[_0xbddb('0x1c')]+_0x4b5fc3['limit'];var _0x9b7981;if(_0x7894b3>=_0x5adb42){_0x7894b3=_0x5adb42;_0x9b7981=0xc8;}else{_0x9b7981=0xce;}_0x4282da[_0xbddb('0x19')](_0x9b7981);return _0x4282da[_0xbddb('0x20')](_0xbddb('0x21'),_0xe23dd8+'-'+_0x7894b3+'/'+_0x5adb42)[_0xbddb('0x1b')](_0x5e2dd4);}return null;};}function patchUpdates(_0x3973e6){return function(_0x5418d1){try{jsonpatch['apply'](_0x5418d1,_0x3973e6,!![]);}catch(_0x6291e0){return BPromise['reject'](_0x6291e0);}return _0x5418d1['save']();};}function saveUpdates(_0x3d0507,_0x2fe6bd){return function(_0x5b6265){if(_0x5b6265){return _0x5b6265[_0xbddb('0x22')](_0x3d0507)[_0xbddb('0x23')](function(_0x507392){return _0x507392;});}return null;};}function removeEntity(_0x57a5e2,_0x5727ac){return function(_0x21de20){if(_0x21de20){return _0x21de20['destroy']()['then'](function(){_0x57a5e2[_0xbddb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41bc76,_0x6eafa2){return function(_0x124c73){if(!_0x124c73){_0x41bc76[_0xbddb('0x18')](0x194);}return _0x124c73;};}function handleError(_0x2f27d8,_0x29d9cf){_0x29d9cf=_0x29d9cf||0x1f4;return function(_0x190172){logger[_0xbddb('0x24')](_0x190172['stack']);if(_0x190172['name']){delete _0x190172[_0xbddb('0x25')];}_0x2f27d8[_0xbddb('0x19')](_0x29d9cf)[_0xbddb('0x26')](_0x190172);};}exports['index']=function(_0x227eaa,_0x12f0ce){var _0x91f38a={},_0x2f4ed8={},_0x3e3dbf={'count':0x0,'rows':[]};var _0x11a540=_[_0xbddb('0x27')](db[_0xbddb('0x28')][_0xbddb('0x29')],function(_0x4ea4bb){return{'name':_0x4ea4bb['fieldName'],'type':_0x4ea4bb[_0xbddb('0x2a')][_0xbddb('0x2b')]};});_0x2f4ed8[_0xbddb('0x2c')]=_[_0xbddb('0x27')](_0x11a540,_0xbddb('0x25'));_0x2f4ed8[_0xbddb('0x2d')]=_[_0xbddb('0x2e')](_0x227eaa[_0xbddb('0x2d')]);_0x2f4ed8[_0xbddb('0x2f')]=_[_0xbddb('0x30')](_0x2f4ed8['model'],_0x2f4ed8[_0xbddb('0x2d')]);_0x2f4ed8[_0xbddb('0x2f')]=_[_0xbddb('0x31')](_0x2f4ed8[_0xbddb('0x2f')],['$and',_0xbddb('0x32'),_0xbddb('0x33'),'$gte','$lt',_0xbddb('0x34'),'$ne',_0xbddb('0x35'),_0xbddb('0x36'),_0xbddb('0x37'),'$notBetween',_0xbddb('0x38'),_0xbddb('0x39'),_0xbddb('0x3a'),'$notLike',_0xbddb('0x3b'),_0xbddb('0x3c'),'$like',_0xbddb('0x3d'),_0xbddb('0x3e'),_0xbddb('0x3f'),'$any']);_0x91f38a[_0xbddb('0x40')]=_[_0xbddb('0x30')](_0x2f4ed8[_0xbddb('0x2c')],qs[_0xbddb('0x41')](_0x227eaa[_0xbddb('0x2d')][_0xbddb('0x41')]));_0x91f38a['attributes']=_0x91f38a[_0xbddb('0x40')][_0xbddb('0x42')]?_0x91f38a[_0xbddb('0x40')]:_0x2f4ed8[_0xbddb('0x2c')];if(!_0x227eaa[_0xbddb('0x2d')]['hasOwnProperty']('nolimit')){_0x91f38a[_0xbddb('0x1e')]=qs['limit'](_0x227eaa[_0xbddb('0x2d')]['limit']);_0x91f38a[_0xbddb('0x1c')]=qs['offset'](_0x227eaa[_0xbddb('0x2d')]['offset']);}_0x91f38a[_0xbddb('0x43')]=qs[_0xbddb('0x44')](_0x227eaa[_0xbddb('0x2d')][_0xbddb('0x44')]);_0x91f38a['where']=qs[_0xbddb('0x2f')](_[_0xbddb('0x45')](_0x227eaa[_0xbddb('0x2d')],_0x2f4ed8[_0xbddb('0x2f')]),_0x11a540);if(_0x227eaa[_0xbddb('0x2d')][_0xbddb('0x46')]){_0x91f38a[_0xbddb('0x47')]=_[_0xbddb('0x48')](_0x91f38a[_0xbddb('0x47')],{'$or':_[_0xbddb('0x27')](_0x11a540,function(_0x58b2a7){if(_0x58b2a7[_0xbddb('0x2a')]!==_0xbddb('0x49')){var _0x4f2efe={};_0x4f2efe[_0x58b2a7[_0xbddb('0x25')]]={'$like':'%'+_0x227eaa['query'][_0xbddb('0x46')]+'%'};return _0x4f2efe;}})});}_0x91f38a=_[_0xbddb('0x48')]({},_0x91f38a,_0x227eaa[_0xbddb('0x4a')]);var _0x20ed2f={'where':_0x91f38a['where']};return db['CmHopper'][_0xbddb('0x1f')](_0x20ed2f)[_0xbddb('0x23')](function(_0x2810ad){_0x3e3dbf[_0xbddb('0x1f')]=_0x2810ad;if(_0x227eaa[_0xbddb('0x2d')]['includeAll']){_0x91f38a[_0xbddb('0x4b')]=[{'all':!![]}];}return db[_0xbddb('0x28')]['findAll'](_0x91f38a);})['then'](function(_0x5d9d07){_0x3e3dbf[_0xbddb('0x4c')]=_0x5d9d07;return _0x3e3dbf;})[_0xbddb('0x23')](respondWithFilteredResult(_0x12f0ce,_0x91f38a))[_0xbddb('0x4d')](handleError(_0x12f0ce,null));};exports['show']=function(_0xf67c8b,_0x42bf80){var _0x51a9b6={'raw':!![],'where':{'id':_0xf67c8b[_0xbddb('0x4e')]['id']}},_0x13a386={};_0x13a386[_0xbddb('0x2c')]=_[_0xbddb('0x2e')](db[_0xbddb('0x28')][_0xbddb('0x29')]);_0x13a386[_0xbddb('0x2d')]=_[_0xbddb('0x2e')](_0xf67c8b[_0xbddb('0x2d')]);_0x13a386['filters']=_['intersection'](_0x13a386[_0xbddb('0x2c')],_0x13a386['query']);_0x51a9b6[_0xbddb('0x40')]=_[_0xbddb('0x30')](_0x13a386[_0xbddb('0x2c')],qs[_0xbddb('0x41')](_0xf67c8b[_0xbddb('0x2d')][_0xbddb('0x41')]));_0x51a9b6['attributes']=_0x51a9b6[_0xbddb('0x40')][_0xbddb('0x42')]?_0x51a9b6[_0xbddb('0x40')]:_0x13a386[_0xbddb('0x2c')];if(_0xf67c8b[_0xbddb('0x2d')]['includeAll']){_0x51a9b6[_0xbddb('0x4b')]=[{'all':!![]}];}_0x51a9b6=_['merge']({},_0x51a9b6,_0xf67c8b['options']);return db['CmHopper'][_0xbddb('0x4f')](_0x51a9b6)[_0xbddb('0x23')](handleEntityNotFound(_0x42bf80,null))['then'](respondWithResult(_0x42bf80,null))[_0xbddb('0x4d')](handleError(_0x42bf80,null));};exports[_0xbddb('0x50')]=function(_0x1e2720,_0x3fda0e){return db[_0xbddb('0x28')][_0xbddb('0x50')](_0x1e2720[_0xbddb('0x51')],{})[_0xbddb('0x23')](respondWithResult(_0x3fda0e,0xc9))[_0xbddb('0x4d')](handleError(_0x3fda0e,null));};exports['update']=function(_0x15924f,_0x6860ef){if(_0x15924f[_0xbddb('0x51')]['id']){delete _0x15924f[_0xbddb('0x51')]['id'];}return db[_0xbddb('0x28')]['find']({'where':{'id':_0x15924f[_0xbddb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x6860ef,null))[_0xbddb('0x23')](saveUpdates(_0x15924f[_0xbddb('0x51')],null))['then'](respondWithResult(_0x6860ef,null))['catch'](handleError(_0x6860ef,null));};exports[_0xbddb('0x52')]=function(_0xc2adbe,_0xdf5c29){return db['CmHopper']['describe']()[_0xbddb('0x23')](respondWithResult(_0xdf5c29,null))[_0xbddb('0x4d')](handleError(_0xdf5c29,null));};exports[_0xbddb('0x53')]=function(_0x3b1625,_0x4c6d98){var _0x2b344d;return db[_0xbddb('0x28')][_0xbddb('0x4f')]({'where':{'id':_0x3b1625[_0xbddb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c6d98,null))[_0xbddb('0x23')](function(_0x5bda8e){if(_0x5bda8e){return _0x5bda8e[_0xbddb('0x53')]()[_0xbddb('0x23')](function(_0x382d4b){return _0x382d4b;});}})[_0xbddb('0x23')](function(_0x331630){_0x2b344d=_0x331630;if(_0x331630){if(_0x331630['VoiceQueueId']||_0x331630[_0xbddb('0x54')]){return db[_0x331630[_0xbddb('0x55')]?'VoiceQueue':_0xbddb('0x56')]['find']({'where':{'id':_0x331630[_0xbddb('0x55')]?_0x331630[_0xbddb('0x55')]:_0x331630[_0xbddb('0x54')]},'attributes':['id','name'],'raw':!![]});}}})[_0xbddb('0x23')](function(_0x4143bb){var _0x258b15={};if(_0x4143bb){_[_0xbddb('0x48')](_0x258b15,_[_0xbddb('0x57')](_0x2b344d[_0xbddb('0x58')],[_0xbddb('0x59'),_0xbddb('0x5a'),'id']));_0x258b15[_0xbddb('0x5b')]=0x15;_0x258b15['statedesc']=_0xbddb('0x5c');_0x258b15[_0xbddb('0x5d')]=_0x4143bb[_0xbddb('0x25')];_0x258b15[_0xbddb('0x5e')]=_0x3b1625['user']['name'];_0x258b15[_0xbddb('0x5f')]=_0x3b1625[_0xbddb('0x60')]['id'];_0x258b15[_0xbddb('0x5c')]=!![];_0x258b15['deletedat']=moment()[_0xbddb('0x61')](_0xbddb('0x62'));_0x258b15['calleridnum']=_0x2b344d[_0xbddb('0x63')];_0x258b15[_0xbddb('0x64')]=_0x2b344d[_0xbddb('0x55')]?'queue':_0xbddb('0x65');return db[_0xbddb('0x66')]['find']({'where':{'id':_0x258b15[_0xbddb('0x67')]},'attributes':[_0xbddb('0x68'),_0xbddb('0x69')]})['then'](function(_0xe1d3c5){if(!_[_0xbddb('0x6a')](_0x4c6d98)&&!_[_0xbddb('0x6a')](_0xe1d3c5[_0xbddb('0x68')])){_0x258b15[_0xbddb('0x6b')]=_0xe1d3c5[_0xbddb('0x68')];if(!_['isNil'](_0xe1d3c5[_0xbddb('0x69')])){_0x258b15[_0xbddb('0x6b')]+='\x20'+_0xe1d3c5[_0xbddb('0x69')];}}})[_0xbddb('0x6c')](function(){return db[_0xbddb('0x6d')]['create'](_0x258b15);});}})[_0xbddb('0x23')](function(){return _0x4c6d98['status'](0xcc)[_0xbddb('0x1a')]();})['catch'](handleError(_0x4c6d98,null));};exports[_0xbddb('0x6e')]=function(_0xfa0929,_0x2c01dc,_0x5eef1c){var _0x1d247b=[];return db[_0xbddb('0x66')][_0xbddb('0x52')]()[_0xbddb('0x23')](function(_0x1eb33f){_0x1d247b=_['keys'](_0x1eb33f);return _0xfa0929[_0xbddb('0x60')][_0xbddb('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xbddb('0x70'),_0xbddb('0x71')],'raw':!![]});})[_0xbddb('0x23')](function(_0x17eb10){if(_0x17eb10&&_0x17eb10[_0xbddb('0x42')]){return db['sequelize'][_0xbddb('0x72')](function(_0x1c0531){var _0x3d6a88={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbddb('0x61')](_0xbddb('0x62'))},'VoiceQueueId':{'$in':_[_0xbddb('0x27')](_0x17eb10,'id')},'$or':[{'UserId':null},{'UserId':_0xfa0929['user']['id']}]};var _0x4171f2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x17eb10)[_0xbddb('0x46')]([_0xbddb('0x71'),0x0])[_0xbddb('0x27')]('id')[_0xbddb('0x73')]()},'$or':[{'UserId':null},{'UserId':_0xfa0929[_0xbddb('0x60')]['id']}]};var _0x2a7f2a={'$or':[_0x3d6a88,_0x4171f2]};var _0x33e8ab=[];if(_0xfa0929['body']['direction']&&_0xfa0929[_0xbddb('0x51')][_0xbddb('0x74')]===_0xbddb('0x75')){if(!_[_0xbddb('0x76')](_0xfa0929[_0xbddb('0x51')][_0xbddb('0x77')])){_0x2a7f2a['id']={'$in':_0xfa0929[_0xbddb('0x51')]['hopperIds']};}_0x33e8ab=[[_0xbddb('0x78'),_0xbddb('0x79')],['scheduledAt',_0x17eb10[0x0][_0xbddb('0x70')]==='ASC'?'DESC':_0xbddb('0x79')],db['sequelize'][_0xbddb('0x7a')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xbddb('0x76')](_0xfa0929[_0xbddb('0x51')]['hopperIds'])){_0x2a7f2a['id']={'$notIn':_0xfa0929[_0xbddb('0x51')][_0xbddb('0x77')]};}_0x33e8ab=[[_0xbddb('0x78'),'DESC'],[_0xbddb('0x7b'),_0x17eb10[0x0][_0xbddb('0x70')]],db['sequelize']['literal'](_0xbddb('0x7c')),['id',_0xbddb('0x79')]];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0xbddb('0x7d')],'where':_0x2a7f2a,'order':_0x33e8ab,'transaction':_0x1c0531,'lock':_0x1c0531[_0xbddb('0x7e')][_0xbddb('0x7f')],'include':[{'model':db[_0xbddb('0x66')],'as':'Contact','attributes':_0x1d247b,'include':[{'model':db[_0xbddb('0x80')],'as':_0xbddb('0x81'),'attributes':['id','name']}]},{'model':db[_0xbddb('0x82')],'as':'List','attributes':['id',_0xbddb('0x25')]},{'model':db[_0xbddb('0x83')],'as':_0xbddb('0x84'),'attributes':['id','name',_0xbddb('0x85')]}]})['then'](function(_0x5ee938){if(_0x5ee938){return _0x5ee938[_0xbddb('0x22')]({'UserId':_0xfa0929[_0xbddb('0x60')]['id']},{'transaction':_0x1c0531});}});});}})[_0xbddb('0x23')](handleEntityNotFound(_0x2c01dc,null))[_0xbddb('0x23')](respondWithResult(_0x2c01dc,null))['catch'](handleError(_0x2c01dc,null));};exports[_0xbddb('0x86')]=function(_0x349ba5,_0x3463d8,_0x21dddd){var _0x8e721b=[];return db[_0xbddb('0x66')][_0xbddb('0x52')]()[_0xbddb('0x23')](function(_0x39abaf){_0x8e721b=_[_0xbddb('0x2e')](_0x39abaf);return _0x349ba5['user'][_0xbddb('0x6f')]({'where':{'type':_0xbddb('0x87'),'dialActive':!![],'dialMethod':_0xbddb('0x88')},'attributes':['id',_0xbddb('0x70'),_0xbddb('0x71')],'raw':!![]});})[_0xbddb('0x23')](function(_0x5c8568){if(_0x5c8568&&_0x5c8568[_0xbddb('0x42')]){return db['sequelize']['transaction'](function(_0x5c3922){var _0x386cf5={'active':![],'recallme':!![],'id':_0x349ba5['body'][_0xbddb('0x89')]};return db['CmHopper'][_0xbddb('0x8a')]({'attributes':['id',_0xbddb('0x8b'),_0xbddb('0x7d')],'where':_0x386cf5,'transaction':_0x5c3922,'lock':_0x5c3922[_0xbddb('0x7e')][_0xbddb('0x7f')],'include':[{'model':db[_0xbddb('0x66')],'as':_0xbddb('0x8c'),'attributes':_0x8e721b,'include':[{'model':db[_0xbddb('0x80')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0xbddb('0x8d'),'attributes':['id','name']},{'model':db[_0xbddb('0x83')],'as':_0xbddb('0x84'),'attributes':['id',_0xbddb('0x25'),'dialActive']}]})[_0xbddb('0x23')](function(_0x1e53dd){if(_0x1e53dd){return _0x1e53dd[_0xbddb('0x22')]({'UserId':_0x349ba5[_0xbddb('0x60')]['id']},{'transaction':_0x5c3922});}});});}})[_0xbddb('0x23')](handleEntityNotFound(_0x3463d8,null))[_0xbddb('0x23')](respondWithResult(_0x3463d8,null))[_0xbddb('0x4d')](handleError(_0x3463d8,null));};exports[_0xbddb('0x8e')]=function(_0x31ee71,_0x23a759,_0x2597e3){return _0x31ee71['user'][_0xbddb('0x6f')]({'where':{'type':_0xbddb('0x87'),'dialActive':!![],'dialMethod':_0xbddb('0x88')},'attributes':['id'],'raw':!![]})[_0xbddb('0x23')](function(_0x1c04e4){if(_0x1c04e4&&_0x1c04e4[_0xbddb('0x42')]){return db[_0xbddb('0x28')][_0xbddb('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbddb('0x61')](_0xbddb('0x62'))},'VoiceQueueId':{'$in':_[_0xbddb('0x27')](_0x1c04e4,'id')},'$or':[{'UserId':null},{'UserId':_0x31ee71[_0xbddb('0x60')]['id']}]}});}return 0x0;})['then'](function(_0x35a8c5){if(!_[_0xbddb('0x6a')](_0x35a8c5)&&_[_0xbddb('0x8f')](_0x35a8c5)){return _0x23a759[_0xbddb('0x19')](0xc8)[_0xbddb('0x1b')]({'contacts':_0x35a8c5});}else{logger[_0xbddb('0x24')](_0xbddb('0x90'),_0xbddb('0x8e'),0x194,_0xbddb('0x91'));_0x23a759['sendStatus'](0x194);}})[_0xbddb('0x4d')](handleError(_0x23a759,null));};exports['getTimezones']=function(_0x14ebc2,_0x35a0d1,_0x409543){var _0x21595d=shared['timezones'];var _0x514458=[];_[_0xbddb('0x27')](_0x21595d,function(_0x2abdd0){_0x514458[_0xbddb('0x92')]({'id':_0x2abdd0[_0xbddb('0x25')],'name':_0x2abdd0[_0xbddb('0x25')],'utcOffset':_0x2abdd0[_0xbddb('0x93')]});});return _0x35a0d1[_0xbddb('0x19')](0xc8)[_0xbddb('0x1b')]({'tz':_0x514458});};exports[_0xbddb('0x94')]=function(_0x1deb13,_0xe66d3f,_0x3faf0c){var _0x150137=shared[_0xbddb('0x95')];var _0x453214={};if(!_[_0xbddb('0x6a')](_0x150137[_0x1deb13['body']['id']]))_0x453214=_0x150137[_0x1deb13['body']['id']];return _0xe66d3f[_0xbddb('0x19')](0xc8)[_0xbddb('0x1b')](_0x453214);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d28e192..ca0107c 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 _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x113bf5,_0x5e585a){_0x113bf5=_0x113bf5-0x0;var _0x28e260=_0xc6ac[_0x113bf5];return _0x28e260;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x90b1,0x1bb));var _0x190b=function(_0x3eff40,_0x1cdf9e){_0x3eff40=_0x3eff40-0x0;var _0x4ee4fb=_0x90b1[_0x3eff40];return _0x4ee4fb;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 08c99fc..805972a 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 _0xf376=['push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','order','UserId','LOCK','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','twilio/lib/webhooks/webhooks','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCmHopper','options','raw','where','attributes','include','map','model','ShowCmHopper','CreateCmHopper','CmHopper','create','body','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','User','Agent','name','voicePause','length'];(function(_0x3b6805,_0x4d352f){var _0x311566=function(_0x2f22e6){while(--_0x2f22e6){_0x3b6805['push'](_0x3b6805['shift']());}};_0x311566(++_0x4d352f);}(_0xf376,0xd9));var _0x6f37=function(_0x2c28fb,_0x4bded7){_0x2c28fb=_0x2c28fb-0x0;var _0x2f9ab3=_0xf376[_0x2c28fb];return _0x2f9ab3;};'use strict';var _=require(_0x6f37('0x0'));var util=require(_0x6f37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f37('0x2'));var fs=require('fs');var Redis=require(_0x6f37('0x3'));var db=require(_0x6f37('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6f37('0x5'));var config=require(_0x6f37('0x6'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x6f37('0x7'));var client=jayson[_0x6f37('0x8')][_0x6f37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb0eb,_0x47bfd3,_0x51f5ab){return new BPromise(function(_0x40eac0,_0x5091fc){return client[_0x6f37('0xa')](_0x2cb0eb,_0x51f5ab)[_0x6f37('0xb')](function(_0x13b015){logger[_0x6f37('0xc')](_0x6f37('0xd'),_0x47bfd3,_0x6f37('0xe'));logger[_0x6f37('0xf')](_0x6f37('0x10'),_0x47bfd3,_0x6f37('0xe'),JSON[_0x6f37('0x11')](_0x13b015));if(_0x13b015['error']){if(_0x13b015['error'][_0x6f37('0x12')]===0x1f4){logger[_0x6f37('0x13')](_0x6f37('0xd'),_0x47bfd3,_0x13b015[_0x6f37('0x13')][_0x6f37('0x14')]);return _0x5091fc(_0x13b015[_0x6f37('0x13')][_0x6f37('0x14')]);}logger[_0x6f37('0x13')](_0x6f37('0xd'),_0x47bfd3,_0x13b015[_0x6f37('0x13')][_0x6f37('0x14')]);return _0x40eac0(_0x13b015['error']['message']);}else{logger[_0x6f37('0xc')](_0x6f37('0xd'),_0x47bfd3,_0x6f37('0xe'));_0x40eac0(_0x13b015[_0x6f37('0x15')][_0x6f37('0x14')]);}})[_0x6f37('0x16')](function(_0xf68a5a){logger[_0x6f37('0x13')]('CmHopper,\x20%s,\x20%s',_0x47bfd3,_0xf68a5a);_0x5091fc(_0xf68a5a);});});}exports[_0x6f37('0x17')]=function(_0x4357d7){var _0x61c57a=this;return new Promise(function(_0x48f264,_0x539b97){return db['CmHopper']['findAll']({'raw':_0x4357d7['options']?_0x4357d7[_0x6f37('0x18')][_0x6f37('0x19')]===undefined?!![]:![]:!![],'where':_0x4357d7[_0x6f37('0x18')]?_0x4357d7[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':_0x4357d7[_0x6f37('0x18')]?_0x4357d7['options'][_0x6f37('0x1b')]||null:null,'limit':_0x4357d7[_0x6f37('0x18')]?_0x4357d7[_0x6f37('0x18')]['limit']||null:null,'include':_0x4357d7['options']?_0x4357d7[_0x6f37('0x18')][_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x4357d7[_0x6f37('0x18')]['include'],function(_0x14cfc3){return{'model':db[_0x14cfc3[_0x6f37('0x1e')]],'as':_0x14cfc3['as'],'attributes':_0x14cfc3[_0x6f37('0x1b')],'include':_0x14cfc3[_0x6f37('0x1c')]?_['map'](_0x14cfc3[_0x6f37('0x1c')],function(_0x2ca3a3){return{'model':db[_0x2ca3a3['model']],'as':_0x2ca3a3['as'],'attributes':_0x2ca3a3[_0x6f37('0x1b')],'include':_0x2ca3a3[_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x2ca3a3['include'],function(_0x5de396){return{'model':db[_0x5de396[_0x6f37('0x1e')]],'as':_0x5de396['as'],'attributes':_0x5de396[_0x6f37('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6f37('0xb')](function(_0x165b31){logger[_0x6f37('0xc')](_0x6f37('0x17'),_0x4357d7);logger[_0x6f37('0xf')](_0x6f37('0x17'),_0x4357d7,JSON[_0x6f37('0x11')](_0x165b31));_0x48f264(_0x165b31);})[_0x6f37('0x16')](function(_0x391ce3){logger[_0x6f37('0x13')](_0x6f37('0x17'),_0x391ce3['message'],_0x4357d7);_0x539b97(_0x61c57a[_0x6f37('0x13')](0x1f4,_0x391ce3['message']));});});};exports['ShowCmHopper']=function(_0x324a90){var _0x2f1c05=this;return new Promise(function(_0xc1e2a,_0x47eb19){return db['CmHopper']['find']({'raw':_0x324a90[_0x6f37('0x18')]?_0x324a90[_0x6f37('0x18')][_0x6f37('0x19')]===undefined?!![]:![]:!![],'where':_0x324a90['options']?_0x324a90[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':_0x324a90['options']?_0x324a90[_0x6f37('0x18')][_0x6f37('0x1b')]||null:null,'include':_0x324a90[_0x6f37('0x18')]?_0x324a90[_0x6f37('0x18')][_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x324a90['options'][_0x6f37('0x1c')],function(_0x518022){return{'model':db[_0x518022[_0x6f37('0x1e')]],'as':_0x518022['as'],'attributes':_0x518022['attributes'],'include':_0x518022[_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x518022[_0x6f37('0x1c')],function(_0x3d0cce){return{'model':db[_0x3d0cce[_0x6f37('0x1e')]],'as':_0x3d0cce['as'],'attributes':_0x3d0cce['attributes'],'include':_0x3d0cce[_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x3d0cce[_0x6f37('0x1c')],function(_0x1f8d13){return{'model':db[_0x1f8d13[_0x6f37('0x1e')]],'as':_0x1f8d13['as'],'attributes':_0x1f8d13[_0x6f37('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6f37('0xb')](function(_0x41d62d){logger[_0x6f37('0xc')](_0x6f37('0x1f'),_0x324a90);logger[_0x6f37('0xf')](_0x6f37('0x1f'),_0x324a90,JSON[_0x6f37('0x11')](_0x41d62d));_0xc1e2a(_0x41d62d);})[_0x6f37('0x16')](function(_0x2de2b0){logger['error'](_0x6f37('0x1f'),_0x2de2b0['message'],_0x324a90);_0x47eb19(_0x2f1c05['error'](0x1f4,_0x2de2b0[_0x6f37('0x14')]));});});};exports[_0x6f37('0x20')]=function(_0xd5442c){var _0x5a6910=this;return new Promise(function(_0x4fb2ae,_0x40efaf){return db[_0x6f37('0x21')][_0x6f37('0x22')](_0xd5442c[_0x6f37('0x23')],{'raw':_0xd5442c[_0x6f37('0x18')]?_0xd5442c[_0x6f37('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6f37('0xb')](function(_0x3a6829){logger[_0x6f37('0xc')](_0x6f37('0x20'),_0xd5442c);logger[_0x6f37('0xf')](_0x6f37('0x20'),_0xd5442c,JSON[_0x6f37('0x11')](_0x3a6829));_0x4fb2ae(_0x3a6829);})[_0x6f37('0x16')](function(_0x17786c){logger['error'](_0x6f37('0x20'),_0x17786c['message'],_0xd5442c);_0x40efaf(_0x5a6910['error'](0x1f4,_0x17786c[_0x6f37('0x14')]));});});};exports['UpdateCmHopper']=function(_0x37c26f){var _0x42da48=this;return new Promise(function(_0x7f8ff1,_0x13be9e){return db[_0x6f37('0x21')]['update'](_0x37c26f[_0x6f37('0x23')],{'raw':_0x37c26f['options']?_0x37c26f[_0x6f37('0x18')][_0x6f37('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c26f[_0x6f37('0x18')]?_0x37c26f[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':_0x37c26f[_0x6f37('0x18')]?_0x37c26f['options'][_0x6f37('0x1b')]||null:null,'limit':_0x37c26f[_0x6f37('0x18')]?_0x37c26f[_0x6f37('0x18')][_0x6f37('0x24')]||null:null})[_0x6f37('0xb')](function(_0x299e59){logger['info'](_0x6f37('0x25'),_0x37c26f);logger['info'](_0x6f37('0x26'),JSON[_0x6f37('0x11')](_0x37c26f[_0x6f37('0x18')]['where']),_0x37c26f[_0x6f37('0x23')]['active']);logger[_0x6f37('0xf')](_0x6f37('0x25'),_0x37c26f,JSON[_0x6f37('0x11')](_0x299e59));_0x7f8ff1(_0x299e59);})[_0x6f37('0x16')](function(_0x26caa5){logger[_0x6f37('0x13')](_0x6f37('0x25'),_0x26caa5[_0x6f37('0x14')],_0x37c26f);_0x13be9e(_0x42da48['error'](0x1f4,_0x26caa5[_0x6f37('0x14')]));});});};exports[_0x6f37('0x27')]=function(_0x245f8b){var _0x47c33a=this;return new Promise(function(_0x20eb66,_0x591479){return db[_0x6f37('0x21')]['destroy']({'where':_0x245f8b[_0x6f37('0x18')]?_0x245f8b[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null})['then'](function(_0x232364){logger[_0x6f37('0xc')](_0x6f37('0x27'),_0x245f8b);logger[_0x6f37('0xf')](_0x6f37('0x27'),_0x245f8b,JSON[_0x6f37('0x11')](_0x232364));_0x20eb66(_0x232364);})[_0x6f37('0x16')](function(_0x2d1117){logger['error']('DestroyCmHopper',_0x2d1117[_0x6f37('0x14')],_0x245f8b);_0x591479(_0x47c33a[_0x6f37('0x13')](0x1f4,_0x2d1117['message']));});});};exports[_0x6f37('0x28')]=function(_0x21e27a){var _0x355245=this;return new Promise(function(_0x6818fd,_0x5807e3){return db[_0x6f37('0x29')][_0x6f37('0x2a')]()[_0x6f37('0xb')](function(_0x574e0b){return db[_0x6f37('0x2b')][_0x6f37('0x2c')](function(_0x2f8e35){return db['CmHopper']['findAll']({'where':_0x21e27a['options']?_0x21e27a[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':_0x21e27a[_0x6f37('0x18')]?_0x21e27a[_0x6f37('0x18')][_0x6f37('0x1b')]||null:null,'limit':_0x21e27a[_0x6f37('0x18')]?_0x21e27a[_0x6f37('0x18')][_0x6f37('0x24')]||null:null,'order':_0x21e27a[_0x6f37('0x18')]?_0x21e27a[_0x6f37('0x18')]['order']||null:null,'transaction':_0x2f8e35,'lock':_0x2f8e35['LOCK'][_0x6f37('0x2d')],'include':[{'model':db['CmContact'],'as':_0x6f37('0x2e'),'attributes':_[_0x6f37('0x2f')](_0x574e0b)},{'model':db[_0x6f37('0x30')],'as':_0x6f37('0x31'),'attributes':['id',_0x6f37('0x32'),_0x6f37('0x33')]}]})[_0x6f37('0xb')](function(_0x45a82c){var _0x1521e5=[];var _0x3baf96=[];for(var _0x12e8b8=0x0;_0x12e8b8<_0x45a82c[_0x6f37('0x34')];_0x12e8b8+=0x1){var _0x26c537=_0x45a82c[_0x12e8b8]['UserId'];if(_0x26c537===null){_0x1521e5[_0x6f37('0x35')](_0x45a82c[_0x12e8b8][_0x6f37('0x36')](_0x21e27a['body'],{'transaction':_0x2f8e35}));}else if(!_0x3baf96[_0x6f37('0x37')](_0x26c537)){_0x3baf96[_0x6f37('0x35')](_0x26c537);_0x1521e5['push'](_0x45a82c[_0x12e8b8][_0x6f37('0x36')](_0x21e27a[_0x6f37('0x23')],{'transaction':_0x2f8e35}));}}return BPromise[_0x6f37('0x38')](_0x1521e5);});})[_0x6f37('0xb')](function(_0x5e6b61){logger['info'](_0x6f37('0x28'),_0x21e27a);if(_0x5e6b61[_0x6f37('0x34')]>0x0){logger[_0x6f37('0xc')](_0x6f37('0x39'),_0x5e6b61[0x0][_0x6f37('0x3a')]['id'],_0x5e6b61[0x0][_0x6f37('0x3a')][_0x6f37('0x3b')],_0x5e6b61[0x0]['dataValues']['active']);}logger[_0x6f37('0xf')](_0x6f37('0x28'),_0x21e27a,JSON['stringify'](_0x5e6b61));_0x6818fd(_0x5e6b61);})[_0x6f37('0x16')](function(_0x42f5c8){logger[_0x6f37('0x13')](_0x6f37('0x28'),_0x42f5c8[_0x6f37('0x14')],_0x21e27a);_0x5807e3(_0x355245[_0x6f37('0x13')](0x1f4,_0x42f5c8[_0x6f37('0x14')]));});});});};exports[_0x6f37('0x3c')]=function(_0x23f91f){var _0x22870b=this;return new Promise(function(_0x4fcf6d,_0x25c1dd){return db['sequelize'][_0x6f37('0x2c')](function(_0x232d69){return db[_0x6f37('0x3d')][_0x6f37('0x22')](_0x23f91f[_0x6f37('0x23')],{'raw':_0x23f91f[_0x6f37('0x18')]?_0x23f91f['options'][_0x6f37('0x19')]===undefined?!![]:![]:!![],'transaction':_0x232d69})[_0x6f37('0xb')](function(){logger['info'](_0x6f37('0x3e'),JSON['stringify'](_0x23f91f[_0x6f37('0x18')][_0x6f37('0x1a')]),_0x23f91f[_0x6f37('0x18')]['where'][_0x6f37('0x3f')]);return db[_0x6f37('0x21')][_0x6f37('0x40')]({'where':_0x23f91f[_0x6f37('0x18')]?_0x23f91f[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'transaction':_0x232d69});});})[_0x6f37('0xb')](function(_0x5ad418){logger['info']('MoveContactManagedDialer',_0x23f91f);logger['debug']('MoveContactManagedDialer',_0x23f91f,JSON[_0x6f37('0x11')](_0x5ad418));_0x4fcf6d(_0x5ad418);})[_0x6f37('0x16')](function(_0x1207e6){logger[_0x6f37('0x13')](_0x6f37('0x3c'),_0x1207e6[_0x6f37('0x14')],_0x23f91f);_0x25c1dd(_0x22870b['error'](0x1f4,_0x1207e6[_0x6f37('0x14')]));});});};exports[_0x6f37('0x41')]=function(_0x4d40ce){var _0x9ce5b1=this;return new Promise(function(_0x55b787,_0x4d23ca){return db['CmHopper'][_0x6f37('0x42')]({'raw':_0x4d40ce['options']?_0x4d40ce['options'][_0x6f37('0x19')]===undefined?!![]:![]:!![],'where':_0x4d40ce[_0x6f37('0x18')]?_0x4d40ce[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':[[db[_0x6f37('0x2b')]['fn'](_0x6f37('0x43'),db[_0x6f37('0x2b')]['fn']('IF',db['sequelize'][_0x6f37('0x44')](_0x6f37('0x45')+util['format'](_0x6f37('0x46'),moment()[_0x6f37('0x47')](_0x6f37('0x48')))+_0x6f37('0x49')))),'contactsRescheduled']]})[_0x6f37('0xb')](function(_0x1c0270){logger[_0x6f37('0xc')](_0x6f37('0x41'),_0x4d40ce);logger[_0x6f37('0xf')]('CountReScheduled',_0x4d40ce,JSON[_0x6f37('0x11')](_0x1c0270));_0x55b787(_0x1c0270);})[_0x6f37('0x16')](function(_0xa799dd){logger['error'](_0x6f37('0x41'),_0xa799dd[_0x6f37('0x14')],_0x4d40ce);_0x4d23ca(_0x9ce5b1[_0x6f37('0x13')](0x1f4,_0xa799dd[_0x6f37('0x14')]));});});};exports['GetContactRecallMe']=function(_0x4e496e){var _0x36c4d8=this;return new Promise(function(_0x10af86,_0x11e8d3){return db[_0x6f37('0x29')][_0x6f37('0x2a')]()[_0x6f37('0xb')](function(_0xa7bd4d){return db['sequelize']['transaction'](function(_0x127e5f){return db[_0x6f37('0x21')][_0x6f37('0x42')]({'where':_0x4e496e[_0x6f37('0x18')]?_0x4e496e[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':_0x4e496e[_0x6f37('0x18')]?_0x4e496e[_0x6f37('0x18')][_0x6f37('0x1b')]||null:null,'limit':0x1,'order':_0x4e496e[_0x6f37('0x18')]?_0x4e496e[_0x6f37('0x18')][_0x6f37('0x4a')]||null:null,'group':db[_0x6f37('0x21')][_0x6f37('0x4b')],'transaction':_0x127e5f,'lock':_0x127e5f[_0x6f37('0x4c')][_0x6f37('0x2d')],'include':_0x4e496e['options']?_0x4e496e[_0x6f37('0x18')]['include']?_[_0x6f37('0x1d')](_0x4e496e['options'][_0x6f37('0x1c')],function(_0x2e17fb){return{'model':db[_0x2e17fb[_0x6f37('0x1e')]],'as':_0x2e17fb['as'],'attributes':_0x2e17fb['attributes'],'include':_0x2e17fb[_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x2e17fb[_0x6f37('0x1c')],function(_0x412a10){return{'model':db[_0x412a10[_0x6f37('0x1e')]],'as':_0x412a10['as'],'attributes':_0x412a10['attributes'],'include':_0x412a10[_0x6f37('0x1c')]?_['map'](_0x412a10['include'],function(_0x2b1502){return{'model':db[_0x2b1502[_0x6f37('0x1e')]],'as':_0x2b1502['as'],'attributes':_0x2b1502[_0x6f37('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e2a60){var _0x17cc5f=[];for(var _0x2bbb90=0x0;_0x2bbb90<_0x2e2a60['length'];_0x2bbb90+=0x1){_0x17cc5f[_0x6f37('0x35')](_0x2e2a60[_0x2bbb90]['update'](_0x4e496e['body'],{'transaction':_0x127e5f}));}return BPromise[_0x6f37('0x38')](_0x17cc5f);});})[_0x6f37('0xb')](function(_0x230b7c){logger[_0x6f37('0xc')](_0x6f37('0x4d'),_0x4e496e);logger[_0x6f37('0xf')](_0x6f37('0x4d'),_0x4e496e,JSON['stringify'](_0x230b7c));_0x10af86(_0x230b7c);})[_0x6f37('0x16')](function(_0x3ad02e){logger['error'](_0x6f37('0x4d'),_0x3ad02e[_0x6f37('0x14')],_0x4e496e);_0x11e8d3(_0x36c4d8[_0x6f37('0x13')](0x1f4,_0x3ad02e['message']));});});});};exports[_0x6f37('0x4e')]=function(_0x481b5a){var _0x5681f0=this;return new Promise(function(_0x5bd443,_0x1db791){db[_0x6f37('0x29')][_0x6f37('0x2a')]()[_0x6f37('0xb')](function(_0x1fde38){return db[_0x6f37('0x21')][_0x6f37('0x42')]({'raw':_0x481b5a['options']?_0x481b5a[_0x6f37('0x18')][_0x6f37('0x19')]===undefined?!![]:![]:!![],'where':_0x481b5a['options']?_0x481b5a[_0x6f37('0x18')][_0x6f37('0x1a')]||null:null,'attributes':_0x481b5a[_0x6f37('0x18')]?_0x481b5a[_0x6f37('0x18')][_0x6f37('0x1b')]||null:null,'limit':_0x481b5a['options']?_0x481b5a[_0x6f37('0x18')][_0x6f37('0x24')]||null:null,'include':_0x481b5a[_0x6f37('0x18')]?_0x481b5a[_0x6f37('0x18')]['include']?_[_0x6f37('0x1d')](_0x481b5a['options'][_0x6f37('0x1c')],function(_0x301583){return{'model':db[_0x301583['model']],'as':_0x301583['as'],'attributes':_0x301583['as']===_0x6f37('0x2e')?_[_0x6f37('0x2f')](_0x1fde38):_0x301583['attributes'],'include':_0x301583[_0x6f37('0x1c')]?_[_0x6f37('0x1d')](_0x301583[_0x6f37('0x1c')],function(_0x425f7d){return{'model':db[_0x425f7d[_0x6f37('0x1e')]],'as':_0x425f7d['as'],'attributes':_0x425f7d[_0x6f37('0x1b')],'include':_0x425f7d[_0x6f37('0x1c')]?_['map'](_0x425f7d[_0x6f37('0x1c')],function(_0x120216){return{'model':db[_0x120216['model']],'as':_0x120216['as'],'attributes':_0x120216['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f37('0xb')](function(_0x16ba49){logger[_0x6f37('0xc')](_0x6f37('0x17'),_0x481b5a);logger['debug'](_0x6f37('0x17'),_0x481b5a,JSON[_0x6f37('0x11')](_0x16ba49));_0x5bd443(_0x16ba49);})[_0x6f37('0x16')](function(_0x2cfc71){logger[_0x6f37('0x13')](_0x6f37('0x17'),_0x2cfc71[_0x6f37('0x14')],_0x481b5a);_0x1db791(_0x5681f0[_0x6f37('0x13')](0x1f4,_0x2cfc71[_0x6f37('0x14')]));});});});};exports[_0x6f37('0x4f')]=function(_0x3993dc){var _0x273729=this;return new Promise(function(_0xe08171,_0x21f398){return db[_0x6f37('0x29')][_0x6f37('0x50')]({'raw':!![],'where':{'phone':_0x3993dc[_0x6f37('0x18')][_0x6f37('0x1a')]['phone']},'attributes':['id',_0x6f37('0x51')],'order':[['id',_0x6f37('0x52')]]})['then'](function(_0x3fbd47){logger[_0x6f37('0xc')](_0x6f37('0x53'),_0x3993dc);logger['debug'](_0x6f37('0x53'),_0x3993dc,JSON[_0x6f37('0x11')](_0x3fbd47));_0xe08171(_0x3fbd47);})['catch'](function(_0x5b8870){logger['error']('getContactByPhone',_0x5b8870[_0x6f37('0x14')],_0x3993dc);_0x21f398(_0x273729[_0x6f37('0x13')](0x1f4,_0x5b8870[_0x6f37('0x14')]));});});};exports[_0x6f37('0x54')]=function(_0x57df0a){var _0x4d0a4e=this;return new Promise(function(_0x2fda21,_0x4bf996){return db[_0x6f37('0x2b')][_0x6f37('0x2c')](function(_0x499659){return db[_0x6f37('0x21')][_0x6f37('0x36')]({'active':![]},{'where':{},'transaction':_0x499659})[_0x6f37('0xb')](function(_0x2efb69){logger[_0x6f37('0xc')]('ResetActiveCalls',_0x57df0a);logger['debug'](_0x6f37('0x54'),_0x57df0a,JSON[_0x6f37('0x11')](_0x2efb69));_0x2fda21(_0x2efb69);})['catch'](function(_0x1c57a1){logger[_0x6f37('0x13')](_0x6f37('0x54'),_0x1c57a1[_0x6f37('0x14')],_0x57df0a);_0x4bf996(_0x4d0a4e[_0x6f37('0x13')](0x1f4,_0x1c57a1[_0x6f37('0x14')]));});});});};exports[_0x6f37('0x55')]=function(_0x4b8fa9){var _0x1746af=this;var _0x4974f1=_0x4b8fa9['body'][_0x6f37('0x1a')]['voiceQueueId'];var _0x528203=_0x4b8fa9[_0x6f37('0x23')][_0x6f37('0x1a')][_0x6f37('0x56')];return new Promise(function(_0x26e2e6,_0x57220f){return db[_0x6f37('0x21')][_0x6f37('0x42')]({'where':{'voiceQueueId':_0x4974f1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x6f37('0x2b')][_0x6f37('0x44')](_0x6f37('0x57')+_0x528203+_0x6f37('0x58'))}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x6f37('0x30')],'as':'Agent','attributes':['id',_0x6f37('0x32'),'voicePause']},{'model':db['CmList'],'as':_0x6f37('0x59')}]})['then'](function(_0x263347){return db[_0x6f37('0x2b')][_0x6f37('0x2c')](function(_0x36975f){return db['CmHopper']['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x4974f1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x6f37('0x44')](_0x6f37('0x57')+_0x528203+_0x6f37('0x58'))}},'transaction':_0x36975f})[_0x6f37('0xb')](function(_0x11f6ee){_0x26e2e6(_0x263347);})[_0x6f37('0x16')](function(_0x50de7f){logger[_0x6f37('0x13')](_0x6f37('0x55'),_0x50de7f['message'],_0x4b8fa9);_0x57220f(validateExpressRequest);});});})[_0x6f37('0x16')](function(_0x41d101){logger[_0x6f37('0x13')](_0x6f37('0x55'),_0x41d101[_0x6f37('0x14')],_0x4b8fa9);_0x57220f(_0x1746af['error'](0x1f4,_0x41d101[_0x6f37('0x14')]));});});}; \ No newline at end of file +var _0x402d=['contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','voicePause','List','\x20MINUTE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CmHopper','options','raw','where','attributes','map','model','include','GetCmHopper','find','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','describe','sequelize','transaction','findAll','limit','order','UPDATE','CmContact','Contact','keys','User','Agent','name','length','UserId','push','includes','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null'];(function(_0x821ec,_0x34306b){var _0x5f1e43=function(_0x5d43a5){while(--_0x5d43a5){_0x821ec['push'](_0x821ec['shift']());}};_0x5f1e43(++_0x34306b);}(_0x402d,0x186));var _0xd402=function(_0x4e2eab,_0x28d3ed){_0x4e2eab=_0x4e2eab-0x0;var _0xf924c1=_0x402d[_0x4e2eab];return _0xf924c1;};'use strict';var _=require(_0xd402('0x0'));var util=require(_0xd402('0x1'));var moment=require(_0xd402('0x2'));var BPromise=require(_0xd402('0x3'));var rs=require(_0xd402('0x4'));var fs=require('fs');var Redis=require(_0xd402('0x5'));var db=require(_0xd402('0x6'))['db'];var utils=require(_0xd402('0x7'));var logger=require(_0xd402('0x8'))(_0xd402('0x9'));var config=require(_0xd402('0xa'));var jayson=require(_0xd402('0xb'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0xd402('0xc')][_0xd402('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a0106,_0x16cb22,_0x578872){return new BPromise(function(_0x3e9242,_0x3afe52){return client[_0xd402('0xe')](_0x5a0106,_0x578872)[_0xd402('0xf')](function(_0x565a0e){logger[_0xd402('0x10')](_0xd402('0x11'),_0x16cb22,'request\x20sent');logger[_0xd402('0x12')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x16cb22,_0xd402('0x13'),JSON[_0xd402('0x14')](_0x565a0e));if(_0x565a0e[_0xd402('0x15')]){if(_0x565a0e['error']['code']===0x1f4){logger[_0xd402('0x15')](_0xd402('0x11'),_0x16cb22,_0x565a0e['error'][_0xd402('0x16')]);return _0x3afe52(_0x565a0e['error']['message']);}logger['error'](_0xd402('0x11'),_0x16cb22,_0x565a0e['error']['message']);return _0x3e9242(_0x565a0e[_0xd402('0x15')][_0xd402('0x16')]);}else{logger[_0xd402('0x10')](_0xd402('0x11'),_0x16cb22,_0xd402('0x13'));_0x3e9242(_0x565a0e[_0xd402('0x17')][_0xd402('0x16')]);}})[_0xd402('0x18')](function(_0x3b6ddb){logger[_0xd402('0x15')](_0xd402('0x11'),_0x16cb22,_0x3b6ddb);_0x3afe52(_0x3b6ddb);});});}exports['GetCmHopper']=function(_0x116c11){var _0x409bc5=this;return new Promise(function(_0x1dfdc6,_0x107870){return db[_0xd402('0x19')]['findAll']({'raw':_0x116c11[_0xd402('0x1a')]?_0x116c11[_0xd402('0x1a')][_0xd402('0x1b')]===undefined?!![]:![]:!![],'where':_0x116c11[_0xd402('0x1a')]?_0x116c11['options'][_0xd402('0x1c')]||null:null,'attributes':_0x116c11['options']?_0x116c11[_0xd402('0x1a')][_0xd402('0x1d')]||null:null,'limit':_0x116c11[_0xd402('0x1a')]?_0x116c11[_0xd402('0x1a')]['limit']||null:null,'include':_0x116c11['options']?_0x116c11[_0xd402('0x1a')]['include']?_[_0xd402('0x1e')](_0x116c11[_0xd402('0x1a')]['include'],function(_0x1018aa){return{'model':db[_0x1018aa[_0xd402('0x1f')]],'as':_0x1018aa['as'],'attributes':_0x1018aa['attributes'],'include':_0x1018aa[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x1018aa[_0xd402('0x20')],function(_0x15bf54){return{'model':db[_0x15bf54[_0xd402('0x1f')]],'as':_0x15bf54['as'],'attributes':_0x15bf54['attributes'],'include':_0x15bf54[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x15bf54['include'],function(_0xfe116c){return{'model':db[_0xfe116c[_0xd402('0x1f')]],'as':_0xfe116c['as'],'attributes':_0xfe116c[_0xd402('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd402('0xf')](function(_0x1d4003){logger[_0xd402('0x10')]('GetCmHopper',_0x116c11);logger[_0xd402('0x12')](_0xd402('0x21'),_0x116c11,JSON[_0xd402('0x14')](_0x1d4003));_0x1dfdc6(_0x1d4003);})[_0xd402('0x18')](function(_0x403965){logger[_0xd402('0x15')](_0xd402('0x21'),_0x403965[_0xd402('0x16')],_0x116c11);_0x107870(_0x409bc5['error'](0x1f4,_0x403965[_0xd402('0x16')]));});});};exports['ShowCmHopper']=function(_0x4ae368){var _0x19f985=this;return new Promise(function(_0x776c0a,_0x24f1b2){return db[_0xd402('0x19')][_0xd402('0x22')]({'raw':_0x4ae368[_0xd402('0x1a')]?_0x4ae368[_0xd402('0x1a')][_0xd402('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ae368[_0xd402('0x1a')]?_0x4ae368[_0xd402('0x1a')][_0xd402('0x1c')]||null:null,'attributes':_0x4ae368['options']?_0x4ae368[_0xd402('0x1a')][_0xd402('0x1d')]||null:null,'include':_0x4ae368[_0xd402('0x1a')]?_0x4ae368[_0xd402('0x1a')]['include']?_['map'](_0x4ae368[_0xd402('0x1a')]['include'],function(_0x7c40d2){return{'model':db[_0x7c40d2[_0xd402('0x1f')]],'as':_0x7c40d2['as'],'attributes':_0x7c40d2[_0xd402('0x1d')],'include':_0x7c40d2[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x7c40d2['include'],function(_0x34a5dc){return{'model':db[_0x34a5dc[_0xd402('0x1f')]],'as':_0x34a5dc['as'],'attributes':_0x34a5dc[_0xd402('0x1d')],'include':_0x34a5dc[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x34a5dc['include'],function(_0x5d6865){return{'model':db[_0x5d6865[_0xd402('0x1f')]],'as':_0x5d6865['as'],'attributes':_0x5d6865[_0xd402('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425a75){logger[_0xd402('0x10')](_0xd402('0x23'),_0x4ae368);logger[_0xd402('0x12')](_0xd402('0x23'),_0x4ae368,JSON[_0xd402('0x14')](_0x425a75));_0x776c0a(_0x425a75);})['catch'](function(_0x4de3a9){logger['error'](_0xd402('0x23'),_0x4de3a9[_0xd402('0x16')],_0x4ae368);_0x24f1b2(_0x19f985[_0xd402('0x15')](0x1f4,_0x4de3a9['message']));});});};exports[_0xd402('0x24')]=function(_0x3c6e34){var _0x158683=this;return new Promise(function(_0x5a00ce,_0x2caeea){return db[_0xd402('0x19')]['create'](_0x3c6e34[_0xd402('0x25')],{'raw':_0x3c6e34[_0xd402('0x1a')]?_0x3c6e34['options']['raw']===undefined?!![]:![]:!![]})[_0xd402('0xf')](function(_0x1e5992){logger[_0xd402('0x10')]('CreateCmHopper',_0x3c6e34);logger['debug']('CreateCmHopper',_0x3c6e34,JSON[_0xd402('0x14')](_0x1e5992));_0x5a00ce(_0x1e5992);})[_0xd402('0x18')](function(_0x1a1832){logger[_0xd402('0x15')](_0xd402('0x24'),_0x1a1832[_0xd402('0x16')],_0x3c6e34);_0x2caeea(_0x158683['error'](0x1f4,_0x1a1832['message']));});});};exports[_0xd402('0x26')]=function(_0x15166c){var _0x16e3ce=this;return new Promise(function(_0x14f0c7,_0x4a3f21){return db[_0xd402('0x19')]['update'](_0x15166c[_0xd402('0x25')],{'raw':_0x15166c[_0xd402('0x1a')]?_0x15166c[_0xd402('0x1a')][_0xd402('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15166c['options']?_0x15166c[_0xd402('0x1a')][_0xd402('0x1c')]||null:null,'attributes':_0x15166c['options']?_0x15166c[_0xd402('0x1a')][_0xd402('0x1d')]||null:null,'limit':_0x15166c[_0xd402('0x1a')]?_0x15166c['options']['limit']||null:null})[_0xd402('0xf')](function(_0x51e45f){logger['info'](_0xd402('0x26'),_0x15166c);logger[_0xd402('0x10')](_0xd402('0x27'),JSON['stringify'](_0x15166c['options']['where']),_0x15166c[_0xd402('0x25')]['active']);logger['debug'](_0xd402('0x26'),_0x15166c,JSON[_0xd402('0x14')](_0x51e45f));_0x14f0c7(_0x51e45f);})[_0xd402('0x18')](function(_0x5f2f4e){logger[_0xd402('0x15')](_0xd402('0x26'),_0x5f2f4e[_0xd402('0x16')],_0x15166c);_0x4a3f21(_0x16e3ce[_0xd402('0x15')](0x1f4,_0x5f2f4e[_0xd402('0x16')]));});});};exports['DestroyCmHopper']=function(_0x12f969){var _0x303c24=this;return new Promise(function(_0x12d9d6,_0x57e456){return db[_0xd402('0x19')][_0xd402('0x28')]({'where':_0x12f969[_0xd402('0x1a')]?_0x12f969[_0xd402('0x1a')][_0xd402('0x1c')]||null:null})['then'](function(_0x28a0a3){logger[_0xd402('0x10')](_0xd402('0x29'),_0x12f969);logger[_0xd402('0x12')](_0xd402('0x29'),_0x12f969,JSON[_0xd402('0x14')](_0x28a0a3));_0x12d9d6(_0x28a0a3);})['catch'](function(_0x13f577){logger['error'](_0xd402('0x29'),_0x13f577[_0xd402('0x16')],_0x12f969);_0x57e456(_0x303c24['error'](0x1f4,_0x13f577[_0xd402('0x16')]));});});};exports['GetContactDialer']=function(_0x4e2287){var _0x555dbd=this;return new Promise(function(_0x4b491b,_0x3bbe4b){return db['CmContact'][_0xd402('0x2a')]()[_0xd402('0xf')](function(_0x3ddb34){return db[_0xd402('0x2b')][_0xd402('0x2c')](function(_0x49a4f7){return db[_0xd402('0x19')][_0xd402('0x2d')]({'where':_0x4e2287[_0xd402('0x1a')]?_0x4e2287['options']['where']||null:null,'attributes':_0x4e2287[_0xd402('0x1a')]?_0x4e2287[_0xd402('0x1a')][_0xd402('0x1d')]||null:null,'limit':_0x4e2287[_0xd402('0x1a')]?_0x4e2287[_0xd402('0x1a')][_0xd402('0x2e')]||null:null,'order':_0x4e2287['options']?_0x4e2287[_0xd402('0x1a')][_0xd402('0x2f')]||null:null,'transaction':_0x49a4f7,'lock':_0x49a4f7['LOCK'][_0xd402('0x30')],'include':[{'model':db[_0xd402('0x31')],'as':_0xd402('0x32'),'attributes':_[_0xd402('0x33')](_0x3ddb34)},{'model':db[_0xd402('0x34')],'as':_0xd402('0x35'),'attributes':['id',_0xd402('0x36'),'voicePause']}]})[_0xd402('0xf')](function(_0xc3336d){var _0x424f95=[];var _0x1aedc1=[];for(var _0x55c56c=0x0;_0x55c56c<_0xc3336d[_0xd402('0x37')];_0x55c56c+=0x1){var _0x6c5bd6=_0xc3336d[_0x55c56c][_0xd402('0x38')];if(_0x6c5bd6===null){_0x424f95[_0xd402('0x39')](_0xc3336d[_0x55c56c]['update'](_0x4e2287[_0xd402('0x25')],{'transaction':_0x49a4f7}));}else if(!_0x1aedc1[_0xd402('0x3a')](_0x6c5bd6)){_0x1aedc1[_0xd402('0x39')](_0x6c5bd6);_0x424f95[_0xd402('0x39')](_0xc3336d[_0x55c56c][_0xd402('0x3b')](_0x4e2287['body'],{'transaction':_0x49a4f7}));}}return BPromise[_0xd402('0x3c')](_0x424f95);});})[_0xd402('0xf')](function(_0x1cf33d){logger[_0xd402('0x10')]('GetContactDialer',_0x4e2287);if(_0x1cf33d[_0xd402('0x37')]>0x0){logger['info'](_0xd402('0x3d'),_0x1cf33d[0x0]['dataValues']['id'],_0x1cf33d[0x0][_0xd402('0x3e')]['ContactId'],_0x1cf33d[0x0][_0xd402('0x3e')][_0xd402('0x3f')]);}logger['debug']('GetContactDialer',_0x4e2287,JSON['stringify'](_0x1cf33d));_0x4b491b(_0x1cf33d);})[_0xd402('0x18')](function(_0x18b5df){logger[_0xd402('0x15')](_0xd402('0x40'),_0x18b5df[_0xd402('0x16')],_0x4e2287);_0x3bbe4b(_0x555dbd[_0xd402('0x15')](0x1f4,_0x18b5df[_0xd402('0x16')]));});});});};exports[_0xd402('0x41')]=function(_0x19a156){var _0x24038e=this;return new Promise(function(_0x4b98fb,_0x365fb7){return db['sequelize'][_0xd402('0x2c')](function(_0x48634b){return db[_0xd402('0x42')][_0xd402('0x43')](_0x19a156[_0xd402('0x25')],{'raw':_0x19a156['options']?_0x19a156[_0xd402('0x1a')][_0xd402('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x48634b})[_0xd402('0xf')](function(){logger[_0xd402('0x10')](_0xd402('0x44'),JSON[_0xd402('0x14')](_0x19a156[_0xd402('0x1a')][_0xd402('0x1c')]),_0x19a156[_0xd402('0x1a')][_0xd402('0x1c')][_0xd402('0x3f')]);return db[_0xd402('0x19')]['destroy']({'where':_0x19a156[_0xd402('0x1a')]?_0x19a156['options'][_0xd402('0x1c')]||null:null,'transaction':_0x48634b});});})[_0xd402('0xf')](function(_0xb437bb){logger[_0xd402('0x10')](_0xd402('0x41'),_0x19a156);logger[_0xd402('0x12')](_0xd402('0x41'),_0x19a156,JSON['stringify'](_0xb437bb));_0x4b98fb(_0xb437bb);})[_0xd402('0x18')](function(_0x28b159){logger['error']('MoveContactManagedDialer',_0x28b159[_0xd402('0x16')],_0x19a156);_0x365fb7(_0x24038e['error'](0x1f4,_0x28b159[_0xd402('0x16')]));});});};exports['CountReScheduled']=function(_0x15d282){var _0x355e17=this;return new Promise(function(_0x2b6146,_0x39a61f){return db[_0xd402('0x19')][_0xd402('0x2d')]({'raw':_0x15d282['options']?_0x15d282[_0xd402('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x15d282[_0xd402('0x1a')]?_0x15d282[_0xd402('0x1a')][_0xd402('0x1c')]||null:null,'attributes':[[db[_0xd402('0x2b')]['fn']('COUNT',db[_0xd402('0x2b')]['fn']('IF',db[_0xd402('0x2b')][_0xd402('0x45')](_0xd402('0x46')+util[_0xd402('0x47')](_0xd402('0x48'),moment()[_0xd402('0x47')](_0xd402('0x49')))+_0xd402('0x4a')))),_0xd402('0x4b')]]})[_0xd402('0xf')](function(_0x4caf00){logger['info'](_0xd402('0x4c'),_0x15d282);logger['debug'](_0xd402('0x4c'),_0x15d282,JSON[_0xd402('0x14')](_0x4caf00));_0x2b6146(_0x4caf00);})[_0xd402('0x18')](function(_0x8e795f){logger[_0xd402('0x15')]('CountReScheduled',_0x8e795f[_0xd402('0x16')],_0x15d282);_0x39a61f(_0x355e17[_0xd402('0x15')](0x1f4,_0x8e795f[_0xd402('0x16')]));});});};exports[_0xd402('0x4d')]=function(_0xba293e){var _0x5e14a5=this;return new Promise(function(_0x50c6c7,_0x3ef849){return db['CmContact']['describe']()['then'](function(_0x2e973d){return db[_0xd402('0x2b')][_0xd402('0x2c')](function(_0x445918){return db['CmHopper'][_0xd402('0x2d')]({'where':_0xba293e[_0xd402('0x1a')]?_0xba293e[_0xd402('0x1a')][_0xd402('0x1c')]||null:null,'attributes':_0xba293e['options']?_0xba293e[_0xd402('0x1a')][_0xd402('0x1d')]||null:null,'limit':0x1,'order':_0xba293e['options']?_0xba293e[_0xd402('0x1a')]['order']||null:null,'group':db[_0xd402('0x19')][_0xd402('0x38')],'transaction':_0x445918,'lock':_0x445918[_0xd402('0x4e')][_0xd402('0x30')],'include':_0xba293e[_0xd402('0x1a')]?_0xba293e[_0xd402('0x1a')]['include']?_[_0xd402('0x1e')](_0xba293e[_0xd402('0x1a')]['include'],function(_0x417018){return{'model':db[_0x417018['model']],'as':_0x417018['as'],'attributes':_0x417018[_0xd402('0x1d')],'include':_0x417018[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x417018[_0xd402('0x20')],function(_0x4b0db9){return{'model':db[_0x4b0db9[_0xd402('0x1f')]],'as':_0x4b0db9['as'],'attributes':_0x4b0db9[_0xd402('0x1d')],'include':_0x4b0db9[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x4b0db9[_0xd402('0x20')],function(_0x73c5c){return{'model':db[_0x73c5c['model']],'as':_0x73c5c['as'],'attributes':_0x73c5c[_0xd402('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1071f0){var _0x149aa4=[];for(var _0x33f147=0x0;_0x33f147<_0x1071f0[_0xd402('0x37')];_0x33f147+=0x1){_0x149aa4['push'](_0x1071f0[_0x33f147][_0xd402('0x3b')](_0xba293e[_0xd402('0x25')],{'transaction':_0x445918}));}return BPromise[_0xd402('0x3c')](_0x149aa4);});})[_0xd402('0xf')](function(_0x1e1f11){logger['info']('GetContactRecallMe',_0xba293e);logger[_0xd402('0x12')](_0xd402('0x4d'),_0xba293e,JSON[_0xd402('0x14')](_0x1e1f11));_0x50c6c7(_0x1e1f11);})[_0xd402('0x18')](function(_0x4e59e9){logger['error'](_0xd402('0x4d'),_0x4e59e9[_0xd402('0x16')],_0xba293e);_0x3ef849(_0x5e14a5[_0xd402('0x15')](0x1f4,_0x4e59e9[_0xd402('0x16')]));});});});};exports[_0xd402('0x4f')]=function(_0x79af9d){var _0x35eb23=this;return new Promise(function(_0x3ce876,_0x5c5719){db[_0xd402('0x31')][_0xd402('0x2a')]()[_0xd402('0xf')](function(_0x391047){return db[_0xd402('0x19')][_0xd402('0x2d')]({'raw':_0x79af9d[_0xd402('0x1a')]?_0x79af9d[_0xd402('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x79af9d[_0xd402('0x1a')]?_0x79af9d['options'][_0xd402('0x1c')]||null:null,'attributes':_0x79af9d[_0xd402('0x1a')]?_0x79af9d[_0xd402('0x1a')][_0xd402('0x1d')]||null:null,'limit':_0x79af9d[_0xd402('0x1a')]?_0x79af9d[_0xd402('0x1a')][_0xd402('0x2e')]||null:null,'include':_0x79af9d[_0xd402('0x1a')]?_0x79af9d[_0xd402('0x1a')]['include']?_[_0xd402('0x1e')](_0x79af9d[_0xd402('0x1a')][_0xd402('0x20')],function(_0x4667c4){return{'model':db[_0x4667c4['model']],'as':_0x4667c4['as'],'attributes':_0x4667c4['as']===_0xd402('0x32')?_[_0xd402('0x33')](_0x391047):_0x4667c4[_0xd402('0x1d')],'include':_0x4667c4[_0xd402('0x20')]?_[_0xd402('0x1e')](_0x4667c4['include'],function(_0x363aa3){return{'model':db[_0x363aa3[_0xd402('0x1f')]],'as':_0x363aa3['as'],'attributes':_0x363aa3[_0xd402('0x1d')],'include':_0x363aa3[_0xd402('0x20')]?_['map'](_0x363aa3[_0xd402('0x20')],function(_0x1069b7){return{'model':db[_0x1069b7['model']],'as':_0x1069b7['as'],'attributes':_0x1069b7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x288e74){logger['info'](_0xd402('0x21'),_0x79af9d);logger[_0xd402('0x12')](_0xd402('0x21'),_0x79af9d,JSON[_0xd402('0x14')](_0x288e74));_0x3ce876(_0x288e74);})[_0xd402('0x18')](function(_0x35c620){logger[_0xd402('0x15')](_0xd402('0x21'),_0x35c620[_0xd402('0x16')],_0x79af9d);_0x5c5719(_0x35eb23[_0xd402('0x15')](0x1f4,_0x35c620[_0xd402('0x16')]));});});});};exports[_0xd402('0x50')]=function(_0x23bf14){var _0x1c248e=this;return new Promise(function(_0x207850,_0x49fa6a){return db[_0xd402('0x31')]['findOne']({'raw':!![],'where':{'phone':_0x23bf14['options'][_0xd402('0x1c')][_0xd402('0x51')]},'attributes':['id',_0xd402('0x52')],'order':[['id',_0xd402('0x53')]]})[_0xd402('0xf')](function(_0x58cb46){logger['info'](_0xd402('0x54'),_0x23bf14);logger['debug'](_0xd402('0x54'),_0x23bf14,JSON[_0xd402('0x14')](_0x58cb46));_0x207850(_0x58cb46);})[_0xd402('0x18')](function(_0x4f41ef){logger['error'](_0xd402('0x54'),_0x4f41ef[_0xd402('0x16')],_0x23bf14);_0x49fa6a(_0x1c248e[_0xd402('0x15')](0x1f4,_0x4f41ef[_0xd402('0x16')]));});});};exports[_0xd402('0x55')]=function(_0x5d6d46){var _0x43caf0=this;return new Promise(function(_0x39958d,_0x36f2d5){return db[_0xd402('0x2b')][_0xd402('0x2c')](function(_0x25f039){return db['CmHopper'][_0xd402('0x3b')]({'active':![]},{'where':{},'transaction':_0x25f039})['then'](function(_0x261ec3){logger[_0xd402('0x10')](_0xd402('0x55'),_0x5d6d46);logger[_0xd402('0x12')](_0xd402('0x55'),_0x5d6d46,JSON[_0xd402('0x14')](_0x261ec3));_0x39958d(_0x261ec3);})[_0xd402('0x18')](function(_0x231889){logger[_0xd402('0x15')](_0xd402('0x55'),_0x231889[_0xd402('0x16')],_0x5d6d46);_0x36f2d5(_0x43caf0['error'](0x1f4,_0x231889['message']));});});});};exports[_0xd402('0x56')]=function(_0x1a5e22){var _0xbd0aa5=this;var _0xc3107d=_0x1a5e22['body'][_0xd402('0x1c')][_0xd402('0x57')];var _0xd72bb3=_0x1a5e22['body']['where'][_0xd402('0x58')];return new Promise(function(_0x35336f,_0x2aeba4){return db['CmHopper'][_0xd402('0x2d')]({'where':{'voiceQueueId':_0xc3107d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xd402('0x2b')][_0xd402('0x45')](_0xd402('0x59')+_0xd72bb3+'\x20MINUTE')}},'include':[{'model':db['CmContact'],'as':_0xd402('0x32')},{'model':db[_0xd402('0x34')],'as':'Agent','attributes':['id',_0xd402('0x36'),_0xd402('0x5a')]},{'model':db['CmList'],'as':_0xd402('0x5b')}]})[_0xd402('0xf')](function(_0xf0971e){return db[_0xd402('0x2b')]['transaction'](function(_0x2ae930){return db[_0xd402('0x19')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0xc3107d,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xd402('0x2b')][_0xd402('0x45')](_0xd402('0x59')+_0xd72bb3+_0xd402('0x5c'))}},'transaction':_0x2ae930})['then'](function(_0x92b95b){_0x35336f(_0xf0971e);})[_0xd402('0x18')](function(_0x11401e){logger[_0xd402('0x15')](_0xd402('0x56'),_0x11401e[_0xd402('0x16')],_0x1a5e22);_0x2aeba4(validateExpressRequest);});});})[_0xd402('0x18')](function(_0x1dd518){logger[_0xd402('0x15')]('CmHopperHandlePreviewRecallNotifications',_0x1dd518[_0xd402('0x16')],_0x1a5e22);_0x2aeba4(_0xbd0aa5[_0xd402('0x15')](0x1f4,_0x1dd518[_0xd402('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 311e219..15b8178 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 _0x794a=['show','post','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','update','delete','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x458c48,_0x17fdb1){var _0x31f9ac=function(_0x2a6b5){while(--_0x2a6b5){_0x458c48['push'](_0x458c48['shift']());}};_0x31f9ac(++_0x17fdb1);}(_0x794a,0x8b));var _0xa794=function(_0x55d605,_0x31cdd2){_0x55d605=_0x55d605-0x0;var _0x168ab7=_0x794a[_0x55d605];return _0x168ab7;};'use strict';var multer=require('multer');var util=require(_0xa794('0x0'));var path=require(_0xa794('0x1'));var timeout=require(_0xa794('0x2'));var express=require(_0xa794('0x3'));var router=express['Router']();var fs_extra=require(_0xa794('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa794('0x5'));var config=require(_0xa794('0x6'));var controller=require(_0xa794('0x7'));router[_0xa794('0x8')]('/',auth[_0xa794('0x9')](),controller['index']);router[_0xa794('0x8')](_0xa794('0xa'),auth['isAuthenticated'](),controller[_0xa794('0xb')]);router[_0xa794('0x8')](_0xa794('0xc'),auth[_0xa794('0x9')](),controller[_0xa794('0xd')]);router[_0xa794('0x8')](_0xa794('0xe'),auth[_0xa794('0x9')](),controller[_0xa794('0xf')]);router['get'](_0xa794('0x10'),auth[_0xa794('0x9')](),controller[_0xa794('0x11')]);router[_0xa794('0x12')]('/',auth[_0xa794('0x9')](),controller['create']);router[_0xa794('0x12')]('/preview',auth[_0xa794('0x9')](),controller[_0xa794('0x13')]);router['post'](_0xa794('0x14'),auth[_0xa794('0x9')](),controller[_0xa794('0x15')]);router['post'](_0xa794('0x16'),auth[_0xa794('0x9')](),controller[_0xa794('0x17')]);router['put'](_0xa794('0x10'),auth[_0xa794('0x9')](),controller[_0xa794('0x18')]);router[_0xa794('0x19')](_0xa794('0x10'),auth[_0xa794('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x905c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','/:id','show','post','create','/preview','getPreviewRecall','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x59eb82,_0x47102a){var _0x1362e2=function(_0xf74418){while(--_0xf74418){_0x59eb82['push'](_0x59eb82['shift']());}};_0x1362e2(++_0x47102a);}(_0x905c,0x14e));var _0xc905=function(_0x190735,_0x57a739){_0x190735=_0x190735-0x0;var _0x4c1b93=_0x905c[_0x190735];return _0x4c1b93;};'use strict';var multer=require(_0xc905('0x0'));var util=require(_0xc905('0x1'));var path=require(_0xc905('0x2'));var timeout=require(_0xc905('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc905('0x4'));var auth=require(_0xc905('0x5'));var interaction=require(_0xc905('0x6'));var config=require(_0xc905('0x7'));var controller=require('./cmHopper.controller');router[_0xc905('0x8')]('/',auth[_0xc905('0x9')](),controller[_0xc905('0xa')]);router[_0xc905('0x8')](_0xc905('0xb'),auth[_0xc905('0x9')](),controller['describe']);router[_0xc905('0x8')](_0xc905('0xc'),auth[_0xc905('0x9')](),controller[_0xc905('0xd')]);router[_0xc905('0x8')](_0xc905('0xe'),auth[_0xc905('0x9')](),controller['getTimezones']);router[_0xc905('0x8')](_0xc905('0xf'),auth[_0xc905('0x9')](),controller[_0xc905('0x10')]);router[_0xc905('0x11')]('/',auth[_0xc905('0x9')](),controller[_0xc905('0x12')]);router['post'](_0xc905('0x13'),auth[_0xc905('0x9')](),controller['getPreview']);router[_0xc905('0x11')]('/timezone',auth[_0xc905('0x9')](),controller['getTimezone']);router[_0xc905('0x11')]('/previewrecall',auth[_0xc905('0x9')](),controller[_0xc905('0x14')]);router[_0xc905('0x15')](_0xc905('0xf'),auth[_0xc905('0x9')](),controller[_0xc905('0x16')]);router[_0xc905('0x17')](_0xc905('0xf'),auth[_0xc905('0x9')](),controller[_0xc905('0x18')]);module[_0xc905('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a360855..889a3be 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 _0x5b5a=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x1fc272,_0x15f49e){var _0x186554=function(_0x18a51f){while(--_0x18a51f){_0x1fc272['push'](_0x1fc272['shift']());}};_0x186554(++_0x15f49e);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0x5b5a[_0x49258d];return _0x2a9044;};'use strict';var moment=require('moment');var Sequelize=require(_0xa5b5('0x0'));module[_0xa5b5('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa5b5('0x2')],'unique':_0xa5b5('0x3')},'ListId':{'type':Sequelize[_0xa5b5('0x2')],'unique':_0xa5b5('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa5b5('0x2')],'unique':_0xa5b5('0x3')}}; \ No newline at end of file +var _0xf78f=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x13a8b9,_0x5597b1){var _0x5d0175=function(_0x65343){while(--_0x65343){_0x13a8b9['push'](_0x13a8b9['shift']());}};_0x5d0175(++_0x5597b1);}(_0xf78f,0x72));var _0xff78=function(_0x5158ce,_0x212be4){_0x5158ce=_0x5158ce-0x0;var _0x390850=_0xf78f[_0x5158ce];return _0x390850;};'use strict';var moment=require('moment');var Sequelize=require(_0xff78('0x0'));module[_0xff78('0x1')]={'phone':{'type':Sequelize[_0xff78('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xff78('0x3')],'unique':_0xff78('0x4')},'ListId':{'type':Sequelize[_0xff78('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fe010f4..e9cfdc4 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 _0xb568=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','save','update','then','destroy','stack','name','CmHopperBlack','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','body','find','params','catch','describe','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb568,0x1ec));var _0x8b56=function(_0x3f9015,_0xf85b98){_0x3f9015=_0x3f9015-0x0;var _0x1d18a8=_0xb568[_0x3f9015];return _0x1d18a8;};'use strict';var emlformat=require(_0x8b56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b56('0x2'));var moment=require(_0x8b56('0x3'));var BPromise=require(_0x8b56('0x4'));var Mustache=require(_0x8b56('0x5'));var util=require(_0x8b56('0x6'));var path=require(_0x8b56('0x7'));var sox=require(_0x8b56('0x8'));var csv=require(_0x8b56('0x9'));var ejs=require(_0x8b56('0xa'));var fs=require('fs');var fs_extra=require(_0x8b56('0xb'));var _=require('lodash');var squel=require(_0x8b56('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b56('0xd'));var deskjs=require(_0x8b56('0xe'));var toCsv=require(_0x8b56('0x9'));var querystring=require(_0x8b56('0xf'));var Papa=require('papaparse');var Redis=require(_0x8b56('0x10'));var authService=require(_0x8b56('0x11'));var qs=require(_0x8b56('0x12'));var as=require(_0x8b56('0x13'));var hardwareService=require(_0x8b56('0x14'));var logger=require(_0x8b56('0x15'))(_0x8b56('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b56('0x17'));var db=require(_0x8b56('0x18'))['db'];function respondWithStatusCode(_0x5a9fe8,_0x2fe664){_0x2fe664=_0x2fe664||0xcc;return function(_0x3f79b6){if(_0x3f79b6){return _0x5a9fe8[_0x8b56('0x19')](_0x2fe664);}return _0x5a9fe8[_0x8b56('0x1a')](_0x2fe664)[_0x8b56('0x1b')]();};}function respondWithResult(_0x328728,_0x56da78){_0x56da78=_0x56da78||0xc8;return function(_0x2b410d){if(_0x2b410d){return _0x328728[_0x8b56('0x1a')](_0x56da78)['json'](_0x2b410d);}};}function respondWithFilteredResult(_0x25124a,_0x50efee){return function(_0x4888d8){if(_0x4888d8){var _0x215359=typeof _0x50efee[_0x8b56('0x1c')]==='undefined'&&typeof _0x50efee[_0x8b56('0x1d')]===_0x8b56('0x1e');var _0x1094ae=_0x4888d8['count'];var _0x2cb5dd=_0x215359?0x0:_0x50efee[_0x8b56('0x1c')];var _0x42fd3d=_0x215359?_0x4888d8[_0x8b56('0x1f')]:_0x50efee[_0x8b56('0x1c')]+_0x50efee['limit'];var _0x15a55b;if(_0x42fd3d>=_0x1094ae){_0x42fd3d=_0x1094ae;_0x15a55b=0xc8;}else{_0x15a55b=0xce;}_0x25124a[_0x8b56('0x1a')](_0x15a55b);return _0x25124a['set'](_0x8b56('0x20'),_0x2cb5dd+'-'+_0x42fd3d+'/'+_0x1094ae)[_0x8b56('0x21')](_0x4888d8);}return null;};}function patchUpdates(_0x75223a){return function(_0x5df252){try{jsonpatch['apply'](_0x5df252,_0x75223a,!![]);}catch(_0xd907f7){return BPromise['reject'](_0xd907f7);}return _0x5df252[_0x8b56('0x22')]();};}function saveUpdates(_0x3cc046,_0x2fae31){return function(_0x1eb494){if(_0x1eb494){return _0x1eb494[_0x8b56('0x23')](_0x3cc046)[_0x8b56('0x24')](function(_0x26818e){return _0x26818e;});}return null;};}function removeEntity(_0x46b096,_0x1426b1){return function(_0x37ee2d){if(_0x37ee2d){return _0x37ee2d[_0x8b56('0x25')]()[_0x8b56('0x24')](function(){_0x46b096[_0x8b56('0x1a')](0xcc)[_0x8b56('0x1b')]();});}};}function handleEntityNotFound(_0x5c977b,_0x1af192){return function(_0x18c663){if(!_0x18c663){_0x5c977b['sendStatus'](0x194);}return _0x18c663;};}function handleError(_0x25f995,_0xe474ba){_0xe474ba=_0xe474ba||0x1f4;return function(_0x3d2bc1){logger['error'](_0x3d2bc1[_0x8b56('0x26')]);if(_0x3d2bc1[_0x8b56('0x27')]){delete _0x3d2bc1['name'];}_0x25f995[_0x8b56('0x1a')](_0xe474ba)['send'](_0x3d2bc1);};}exports['index']=function(_0x3dc6b2,_0x3ad6bd){var _0x5abee5={},_0x5075d3={},_0x3f6079={'count':0x0,'rows':[]};var _0x359629=_['map'](db[_0x8b56('0x28')]['rawAttributes'],function(_0x458cd4){return{'name':_0x458cd4[_0x8b56('0x29')],'type':_0x458cd4[_0x8b56('0x2a')]['key']};});_0x5075d3[_0x8b56('0x2b')]=_[_0x8b56('0x2c')](_0x359629,_0x8b56('0x27'));_0x5075d3[_0x8b56('0x2d')]=_['keys'](_0x3dc6b2['query']);_0x5075d3[_0x8b56('0x2e')]=_['intersection'](_0x5075d3[_0x8b56('0x2b')],_0x5075d3['query']);_0x5abee5[_0x8b56('0x2f')]=_[_0x8b56('0x30')](_0x5075d3[_0x8b56('0x2b')],qs[_0x8b56('0x31')](_0x3dc6b2[_0x8b56('0x2d')]['fields']));_0x5abee5[_0x8b56('0x2f')]=_0x5abee5[_0x8b56('0x2f')][_0x8b56('0x32')]?_0x5abee5[_0x8b56('0x2f')]:_0x5075d3['model'];if(!_0x3dc6b2[_0x8b56('0x2d')]['hasOwnProperty'](_0x8b56('0x33'))){_0x5abee5['limit']=qs[_0x8b56('0x1d')](_0x3dc6b2[_0x8b56('0x2d')][_0x8b56('0x1d')]);_0x5abee5[_0x8b56('0x1c')]=qs[_0x8b56('0x1c')](_0x3dc6b2[_0x8b56('0x2d')]['offset']);}_0x5abee5[_0x8b56('0x34')]=qs[_0x8b56('0x35')](_0x3dc6b2[_0x8b56('0x2d')][_0x8b56('0x35')]);_0x5abee5['where']=qs['filters'](_[_0x8b56('0x36')](_0x3dc6b2[_0x8b56('0x2d')],_0x5075d3[_0x8b56('0x2e')]),_0x359629);if(_0x3dc6b2['query'][_0x8b56('0x37')]){_0x5abee5[_0x8b56('0x38')]=_[_0x8b56('0x39')](_0x5abee5['where'],{'$or':_[_0x8b56('0x2c')](_0x359629,function(_0x2f653c){if(_0x2f653c[_0x8b56('0x2a')]!==_0x8b56('0x3a')){var _0x45ffcc={};_0x45ffcc[_0x2f653c[_0x8b56('0x27')]]={'$like':'%'+_0x3dc6b2[_0x8b56('0x2d')][_0x8b56('0x37')]+'%'};return _0x45ffcc;}})});}_0x5abee5=_[_0x8b56('0x39')]({},_0x5abee5,_0x3dc6b2[_0x8b56('0x3b')]);var _0x4af32d={'where':_0x5abee5[_0x8b56('0x38')]};return db['CmHopperBlack'][_0x8b56('0x1f')](_0x4af32d)[_0x8b56('0x24')](function(_0x954b2c){_0x3f6079['count']=_0x954b2c;if(_0x3dc6b2['query'][_0x8b56('0x3c')]){_0x5abee5[_0x8b56('0x3d')]=[{'all':!![]}];}return db[_0x8b56('0x28')][_0x8b56('0x3e')](_0x5abee5);})[_0x8b56('0x24')](function(_0x21ca04){_0x3f6079[_0x8b56('0x3f')]=_0x21ca04;return _0x3f6079;})[_0x8b56('0x24')](respondWithFilteredResult(_0x3ad6bd,_0x5abee5))['catch'](handleError(_0x3ad6bd,null));};exports[_0x8b56('0x40')]=function(_0x426725,_0x125794){var _0x4b53fe={'raw':!![],'where':{'id':_0x426725['params']['id']}},_0x3a8461={};_0x3a8461[_0x8b56('0x2b')]=_[_0x8b56('0x41')](db[_0x8b56('0x28')]['rawAttributes']);_0x3a8461['query']=_['keys'](_0x426725[_0x8b56('0x2d')]);_0x3a8461[_0x8b56('0x2e')]=_[_0x8b56('0x30')](_0x3a8461['model'],_0x3a8461[_0x8b56('0x2d')]);_0x4b53fe[_0x8b56('0x2f')]=_[_0x8b56('0x30')](_0x3a8461[_0x8b56('0x2b')],qs['fields'](_0x426725[_0x8b56('0x2d')][_0x8b56('0x31')]));_0x4b53fe[_0x8b56('0x2f')]=_0x4b53fe[_0x8b56('0x2f')][_0x8b56('0x32')]?_0x4b53fe[_0x8b56('0x2f')]:_0x3a8461['model'];if(_0x426725[_0x8b56('0x2d')]['includeAll']){_0x4b53fe[_0x8b56('0x3d')]=[{'all':!![]}];}_0x4b53fe=_['merge']({},_0x4b53fe,_0x426725['options']);return db['CmHopperBlack']['find'](_0x4b53fe)[_0x8b56('0x24')](handleEntityNotFound(_0x125794,null))[_0x8b56('0x24')](respondWithResult(_0x125794,null))['catch'](handleError(_0x125794,null));};exports['update']=function(_0xbf2d36,_0x1bf8f1){if(_0xbf2d36[_0x8b56('0x42')]['id']){delete _0xbf2d36[_0x8b56('0x42')]['id'];}return db[_0x8b56('0x28')][_0x8b56('0x43')]({'where':{'id':_0xbf2d36[_0x8b56('0x44')]['id']}})[_0x8b56('0x24')](handleEntityNotFound(_0x1bf8f1,null))[_0x8b56('0x24')](saveUpdates(_0xbf2d36[_0x8b56('0x42')],null))['then'](respondWithResult(_0x1bf8f1,null))[_0x8b56('0x45')](handleError(_0x1bf8f1,null));};exports[_0x8b56('0x25')]=function(_0x2f7dba,_0x1b51d6){return db[_0x8b56('0x28')][_0x8b56('0x43')]({'where':{'id':_0x2f7dba[_0x8b56('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b51d6,null))[_0x8b56('0x24')](removeEntity(_0x1b51d6,null))[_0x8b56('0x45')](handleError(_0x1b51d6,null));};exports[_0x8b56('0x46')]=function(_0x2d35af,_0x446339){return db[_0x8b56('0x28')][_0x8b56('0x46')]()[_0x8b56('0x24')](respondWithResult(_0x446339,null))['catch'](handleError(_0x446339,null));}; \ No newline at end of file +var _0xc71e=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model'];(function(_0x5a8ef7,_0x1362a5){var _0x32735a=function(_0x2686d9){while(--_0x2686d9){_0x5a8ef7['push'](_0x5a8ef7['shift']());}};_0x32735a(++_0x1362a5);}(_0xc71e,0xfe));var _0xec71=function(_0x3589b8,_0x410f77){_0x3589b8=_0x3589b8-0x0;var _0x53d911=_0xc71e[_0x3589b8];return _0x53d911;};'use strict';var emlformat=require(_0xec71('0x0'));var rimraf=require(_0xec71('0x1'));var zipdir=require(_0xec71('0x2'));var jsonpatch=require(_0xec71('0x3'));var rp=require(_0xec71('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec71('0x5'));var util=require(_0xec71('0x6'));var path=require(_0xec71('0x7'));var sox=require(_0xec71('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec71('0x9'));var _=require(_0xec71('0xa'));var squel=require(_0xec71('0xb'));var crypto=require('crypto');var jsforce=require(_0xec71('0xc'));var deskjs=require(_0xec71('0xd'));var toCsv=require(_0xec71('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xec71('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xec71('0x10'));var as=require(_0xec71('0x11'));var hardwareService=require(_0xec71('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xec71('0x13'));var config=require(_0xec71('0x14'));var licenseUtil=require(_0xec71('0x15'));var db=require(_0xec71('0x16'))['db'];function respondWithStatusCode(_0x380480,_0x442573){_0x442573=_0x442573||0xcc;return function(_0x287dd5){if(_0x287dd5){return _0x380480[_0xec71('0x17')](_0x442573);}return _0x380480[_0xec71('0x18')](_0x442573)[_0xec71('0x19')]();};}function respondWithResult(_0x33046b,_0x6527c5){_0x6527c5=_0x6527c5||0xc8;return function(_0x20f901){if(_0x20f901){return _0x33046b[_0xec71('0x18')](_0x6527c5)[_0xec71('0x1a')](_0x20f901);}};}function respondWithFilteredResult(_0x5de50d,_0x24bb5){return function(_0x388ce9){if(_0x388ce9){var _0x17f863=typeof _0x24bb5[_0xec71('0x1b')]==='undefined'&&typeof _0x24bb5[_0xec71('0x1c')]===_0xec71('0x1d');var _0x41c5e0=_0x388ce9[_0xec71('0x1e')];var _0x2c594c=_0x17f863?0x0:_0x24bb5[_0xec71('0x1b')];var _0x462aa1=_0x17f863?_0x388ce9[_0xec71('0x1e')]:_0x24bb5['offset']+_0x24bb5['limit'];var _0xb500e7;if(_0x462aa1>=_0x41c5e0){_0x462aa1=_0x41c5e0;_0xb500e7=0xc8;}else{_0xb500e7=0xce;}_0x5de50d['status'](_0xb500e7);return _0x5de50d[_0xec71('0x1f')](_0xec71('0x20'),_0x2c594c+'-'+_0x462aa1+'/'+_0x41c5e0)[_0xec71('0x1a')](_0x388ce9);}return null;};}function patchUpdates(_0x295511){return function(_0x15c78c){try{jsonpatch[_0xec71('0x21')](_0x15c78c,_0x295511,!![]);}catch(_0x25f38e){return BPromise['reject'](_0x25f38e);}return _0x15c78c[_0xec71('0x22')]();};}function saveUpdates(_0x32d268,_0x1e524d){return function(_0x397819){if(_0x397819){return _0x397819[_0xec71('0x23')](_0x32d268)[_0xec71('0x24')](function(_0x4ccb1d){return _0x4ccb1d;});}return null;};}function removeEntity(_0x2d0af8,_0x474b6c){return function(_0x1b034b){if(_0x1b034b){return _0x1b034b[_0xec71('0x25')]()[_0xec71('0x24')](function(){_0x2d0af8[_0xec71('0x18')](0xcc)[_0xec71('0x19')]();});}};}function handleEntityNotFound(_0x26a973,_0xe5188a){return function(_0x5edc10){if(!_0x5edc10){_0x26a973['sendStatus'](0x194);}return _0x5edc10;};}function handleError(_0x2943b8,_0x300d42){_0x300d42=_0x300d42||0x1f4;return function(_0x469537){logger[_0xec71('0x26')](_0x469537[_0xec71('0x27')]);if(_0x469537['name']){delete _0x469537[_0xec71('0x28')];}_0x2943b8[_0xec71('0x18')](_0x300d42)[_0xec71('0x29')](_0x469537);};}exports[_0xec71('0x2a')]=function(_0x277b89,_0x3360eb){var _0x28036b={},_0x1f9b4c={},_0x55154d={'count':0x0,'rows':[]};var _0x572c30=_[_0xec71('0x2b')](db[_0xec71('0x2c')][_0xec71('0x2d')],function(_0x281d61){return{'name':_0x281d61[_0xec71('0x2e')],'type':_0x281d61[_0xec71('0x2f')][_0xec71('0x30')]};});_0x1f9b4c[_0xec71('0x31')]=_['map'](_0x572c30,_0xec71('0x28'));_0x1f9b4c[_0xec71('0x32')]=_[_0xec71('0x33')](_0x277b89[_0xec71('0x32')]);_0x1f9b4c['filters']=_[_0xec71('0x34')](_0x1f9b4c[_0xec71('0x31')],_0x1f9b4c['query']);_0x28036b[_0xec71('0x35')]=_[_0xec71('0x34')](_0x1f9b4c['model'],qs[_0xec71('0x36')](_0x277b89[_0xec71('0x32')][_0xec71('0x36')]));_0x28036b[_0xec71('0x35')]=_0x28036b[_0xec71('0x35')][_0xec71('0x37')]?_0x28036b['attributes']:_0x1f9b4c[_0xec71('0x31')];if(!_0x277b89['query'][_0xec71('0x38')](_0xec71('0x39'))){_0x28036b['limit']=qs[_0xec71('0x1c')](_0x277b89['query'][_0xec71('0x1c')]);_0x28036b[_0xec71('0x1b')]=qs[_0xec71('0x1b')](_0x277b89[_0xec71('0x32')]['offset']);}_0x28036b['order']=qs[_0xec71('0x3a')](_0x277b89['query'][_0xec71('0x3a')]);_0x28036b[_0xec71('0x3b')]=qs[_0xec71('0x3c')](_[_0xec71('0x3d')](_0x277b89[_0xec71('0x32')],_0x1f9b4c[_0xec71('0x3c')]),_0x572c30);if(_0x277b89[_0xec71('0x32')][_0xec71('0x3e')]){_0x28036b['where']=_['merge'](_0x28036b[_0xec71('0x3b')],{'$or':_[_0xec71('0x2b')](_0x572c30,function(_0x1264b7){if(_0x1264b7[_0xec71('0x2f')]!==_0xec71('0x3f')){var _0x1827ad={};_0x1827ad[_0x1264b7[_0xec71('0x28')]]={'$like':'%'+_0x277b89[_0xec71('0x32')]['filter']+'%'};return _0x1827ad;}})});}_0x28036b=_['merge']({},_0x28036b,_0x277b89[_0xec71('0x40')]);var _0x2c02b4={'where':_0x28036b['where']};return db['CmHopperBlack'][_0xec71('0x1e')](_0x2c02b4)[_0xec71('0x24')](function(_0x5e98ac){_0x55154d[_0xec71('0x1e')]=_0x5e98ac;if(_0x277b89[_0xec71('0x32')][_0xec71('0x41')]){_0x28036b[_0xec71('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xec71('0x43')](_0x28036b);})[_0xec71('0x24')](function(_0x4fbe00){_0x55154d[_0xec71('0x44')]=_0x4fbe00;return _0x55154d;})[_0xec71('0x24')](respondWithFilteredResult(_0x3360eb,_0x28036b))[_0xec71('0x45')](handleError(_0x3360eb,null));};exports[_0xec71('0x46')]=function(_0x149581,_0x462055){var _0x4f3149={'raw':!![],'where':{'id':_0x149581[_0xec71('0x47')]['id']}},_0x1741f1={};_0x1741f1[_0xec71('0x31')]=_['keys'](db['CmHopperBlack'][_0xec71('0x2d')]);_0x1741f1[_0xec71('0x32')]=_['keys'](_0x149581[_0xec71('0x32')]);_0x1741f1['filters']=_['intersection'](_0x1741f1[_0xec71('0x31')],_0x1741f1[_0xec71('0x32')]);_0x4f3149[_0xec71('0x35')]=_[_0xec71('0x34')](_0x1741f1[_0xec71('0x31')],qs['fields'](_0x149581[_0xec71('0x32')][_0xec71('0x36')]));_0x4f3149[_0xec71('0x35')]=_0x4f3149['attributes']['length']?_0x4f3149[_0xec71('0x35')]:_0x1741f1[_0xec71('0x31')];if(_0x149581['query'][_0xec71('0x41')]){_0x4f3149['include']=[{'all':!![]}];}_0x4f3149=_[_0xec71('0x48')]({},_0x4f3149,_0x149581['options']);return db[_0xec71('0x2c')][_0xec71('0x49')](_0x4f3149)[_0xec71('0x24')](handleEntityNotFound(_0x462055,null))[_0xec71('0x24')](respondWithResult(_0x462055,null))[_0xec71('0x45')](handleError(_0x462055,null));};exports[_0xec71('0x23')]=function(_0x16054e,_0x3e93b9){if(_0x16054e[_0xec71('0x4a')]['id']){delete _0x16054e[_0xec71('0x4a')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x16054e[_0xec71('0x47')]['id']}})[_0xec71('0x24')](handleEntityNotFound(_0x3e93b9,null))[_0xec71('0x24')](saveUpdates(_0x16054e[_0xec71('0x4a')],null))['then'](respondWithResult(_0x3e93b9,null))[_0xec71('0x45')](handleError(_0x3e93b9,null));};exports['destroy']=function(_0x5c9762,_0x494f34){return db['CmHopperBlack'][_0xec71('0x49')]({'where':{'id':_0x5c9762[_0xec71('0x47')]['id']}})[_0xec71('0x24')](handleEntityNotFound(_0x494f34,null))['then'](removeEntity(_0x494f34,null))[_0xec71('0x45')](handleError(_0x494f34,null));};exports[_0xec71('0x4b')]=function(_0x5bde54,_0x3b6ab6){return db[_0xec71('0x2c')][_0xec71('0x4b')]()['then'](respondWithResult(_0x3b6ab6,null))['catch'](handleError(_0x3b6ab6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bd512d6..8867b1f 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 _0x09e3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x33cfca,_0x3058d1){var _0x68d722=function(_0xa70d6a){while(--_0xa70d6a){_0x33cfca['push'](_0x33cfca['shift']());}};_0x68d722(++_0x3058d1);}(_0x09e3,0x90));var _0x309e=function(_0xf4f489,_0x5328bb){_0xf4f489=_0xf4f489-0x0;var _0x5a5bc6=_0x09e3[_0xf4f489];return _0x5a5bc6;};'use strict';var _=require(_0x309e('0x0'));var util=require(_0x309e('0x1'));var logger=require('../../config/logger')(_0x309e('0x2'));var moment=require(_0x309e('0x3'));var BPromise=require(_0x309e('0x4'));var rp=require(_0x309e('0x5'));var fs=require('fs');var path=require(_0x309e('0x6'));var rimraf=require('rimraf');var config=require(_0x309e('0x7'));var attributes=require(_0x309e('0x8'));module[_0x309e('0x9')]=function(_0x535c08,_0x2a5613){return _0x535c08[_0x309e('0xa')](_0x309e('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dce=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0xbcc7a8,_0x523908){var _0x5275f6=function(_0x448913){while(--_0x448913){_0xbcc7a8['push'](_0xbcc7a8['shift']());}};_0x5275f6(++_0x523908);}(_0x1dce,0x13c));var _0xe1dc=function(_0x2f0249,_0x43513f){_0x2f0249=_0x2f0249-0x0;var _0x1e984f=_0x1dce[_0x2f0249];return _0x1e984f;};'use strict';var _=require(_0xe1dc('0x0'));var util=require(_0xe1dc('0x1'));var logger=require(_0xe1dc('0x2'))(_0xe1dc('0x3'));var moment=require(_0xe1dc('0x4'));var BPromise=require('bluebird');var rp=require(_0xe1dc('0x5'));var fs=require('fs');var path=require(_0xe1dc('0x6'));var rimraf=require(_0xe1dc('0x7'));var config=require('../../config/environment');var attributes=require(_0xe1dc('0x8'));module[_0xe1dc('0x9')]=function(_0x4588af,_0x5156e1){return _0x4588af[_0xe1dc('0xa')](_0xe1dc('0xb'),attributes,{'tableName':_0xe1dc('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 5f37032..978674a 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 _0xe669=['request\x20sent','stringify','error','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','model','info','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xe669,0xee));var _0x9e66=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xe669[_0x2a1b33];return _0x4c50e7;};'use strict';var _=require(_0x9e66('0x0'));var util=require(_0x9e66('0x1'));var moment=require(_0x9e66('0x2'));var BPromise=require(_0x9e66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e66('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e66('0x5'));var config=require(_0x9e66('0x6'));var jayson=require(_0x9e66('0x7'));var client=jayson[_0x9e66('0x8')][_0x9e66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3af359,_0x4d8301,_0x26aca3){return new BPromise(function(_0x400b58,_0x2f3be5){return client[_0x9e66('0xa')](_0x3af359,_0x26aca3)[_0x9e66('0xb')](function(_0x57969b){logger['info'](_0x9e66('0xc'),_0x4d8301,'request\x20sent');logger[_0x9e66('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4d8301,_0x9e66('0xe'),JSON[_0x9e66('0xf')](_0x57969b));if(_0x57969b['error']){if(_0x57969b[_0x9e66('0x10')]['code']===0x1f4){logger['error'](_0x9e66('0xc'),_0x4d8301,_0x57969b[_0x9e66('0x10')]['message']);return _0x2f3be5(_0x57969b[_0x9e66('0x10')][_0x9e66('0x11')]);}logger[_0x9e66('0x10')](_0x9e66('0xc'),_0x4d8301,_0x57969b[_0x9e66('0x10')][_0x9e66('0x11')]);return _0x400b58(_0x57969b['error'][_0x9e66('0x11')]);}else{logger['info'](_0x9e66('0xc'),_0x4d8301,_0x9e66('0xe'));_0x400b58(_0x57969b['result']['message']);}})[_0x9e66('0x12')](function(_0x7076e6){logger['error'](_0x9e66('0xc'),_0x4d8301,_0x7076e6);_0x2f3be5(_0x7076e6);});});}exports[_0x9e66('0x13')]=function(_0x1e2cba){var _0x594f97=this;return new Promise(function(_0x109c30,_0x393ae6){return db[_0x9e66('0x14')][_0x9e66('0x15')]({'raw':_0x1e2cba[_0x9e66('0x16')]?_0x1e2cba['options'][_0x9e66('0x17')]===undefined?!![]:![]:!![],'where':_0x1e2cba[_0x9e66('0x16')]?_0x1e2cba[_0x9e66('0x16')][_0x9e66('0x18')]||null:null,'attributes':_0x1e2cba[_0x9e66('0x16')]?_0x1e2cba['options']['attributes']||null:null,'limit':_0x1e2cba[_0x9e66('0x16')]?_0x1e2cba[_0x9e66('0x16')][_0x9e66('0x19')]||null:null,'include':_0x1e2cba[_0x9e66('0x16')]?_0x1e2cba[_0x9e66('0x16')][_0x9e66('0x1a')]?_[_0x9e66('0x1b')](_0x1e2cba[_0x9e66('0x16')]['include'],function(_0x20a30c){return{'model':db[_0x20a30c['model']],'as':_0x20a30c['as'],'attributes':_0x20a30c[_0x9e66('0x1c')],'include':_0x20a30c['include']?_[_0x9e66('0x1b')](_0x20a30c[_0x9e66('0x1a')],function(_0x4fbd8a){return{'model':db[_0x4fbd8a[_0x9e66('0x1d')]],'as':_0x4fbd8a['as'],'attributes':_0x4fbd8a['attributes'],'include':_0x4fbd8a[_0x9e66('0x1a')]?_[_0x9e66('0x1b')](_0x4fbd8a[_0x9e66('0x1a')],function(_0x93ffab){return{'model':db[_0x93ffab[_0x9e66('0x1d')]],'as':_0x93ffab['as'],'attributes':_0x93ffab[_0x9e66('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e66('0xb')](function(_0x40d9b4){logger[_0x9e66('0x1e')]('GetCmHopperBlack',_0x1e2cba);logger[_0x9e66('0xd')](_0x9e66('0x13'),_0x1e2cba,JSON[_0x9e66('0xf')](_0x40d9b4));_0x109c30(_0x40d9b4);})['catch'](function(_0x5db83c){logger[_0x9e66('0x10')](_0x9e66('0x13'),_0x5db83c['message'],_0x1e2cba);_0x393ae6(_0x594f97['error'](0x1f4,_0x5db83c[_0x9e66('0x11')]));});});};exports[_0x9e66('0x1f')]=function(_0x91fb19){var _0x3d9105=this;return new Promise(function(_0x2596e8,_0x8aff60){return db[_0x9e66('0x14')][_0x9e66('0x20')](_0x91fb19[_0x9e66('0x21')],{'raw':_0x91fb19[_0x9e66('0x16')]?_0x91fb19['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x91fb19['options']?_0x91fb19[_0x9e66('0x16')][_0x9e66('0x18')]||null:null,'attributes':_0x91fb19[_0x9e66('0x16')]?_0x91fb19[_0x9e66('0x16')][_0x9e66('0x1c')]||null:null,'limit':_0x91fb19[_0x9e66('0x16')]?_0x91fb19[_0x9e66('0x16')][_0x9e66('0x19')]||null:null})['then'](function(_0x1b3332){logger['info'](_0x9e66('0x1f'),_0x91fb19);logger[_0x9e66('0xd')](_0x9e66('0x1f'),_0x91fb19,JSON['stringify'](_0x1b3332));_0x2596e8(_0x1b3332);})[_0x9e66('0x12')](function(_0x56a2b7){logger[_0x9e66('0x10')](_0x9e66('0x1f'),_0x56a2b7[_0x9e66('0x11')],_0x91fb19);_0x8aff60(_0x3d9105[_0x9e66('0x10')](0x1f4,_0x56a2b7[_0x9e66('0x11')]));});});};exports[_0x9e66('0x22')]=function(_0x121e96){var _0x5d4302=this;return new Promise(function(_0x33848b,_0x3129a5){return db[_0x9e66('0x14')][_0x9e66('0x23')]({'where':_0x121e96[_0x9e66('0x16')]?_0x121e96[_0x9e66('0x16')][_0x9e66('0x18')]||null:null})[_0x9e66('0xb')](function(_0x289fd5){logger['info']('DestroyCmHopperBlack',_0x121e96);logger['debug'](_0x9e66('0x22'),_0x121e96,JSON[_0x9e66('0xf')](_0x289fd5));_0x33848b(_0x289fd5);})[_0x9e66('0x12')](function(_0xdeb079){logger[_0x9e66('0x10')](_0x9e66('0x22'),_0xdeb079[_0x9e66('0x11')],_0x121e96);_0x3129a5(_0x5d4302[_0x9e66('0x10')](0x1f4,_0xdeb079[_0x9e66('0x11')]));});});}; \ No newline at end of file +var _0x9374=['error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x5e5e02,_0x2f9104){var _0x1f62f4=function(_0x5742d5){while(--_0x5742d5){_0x5e5e02['push'](_0x5e5e02['shift']());}};_0x1f62f4(++_0x2f9104);}(_0x9374,0xc3));var _0x4937=function(_0x304655,_0x15b109){_0x304655=_0x304655-0x0;var _0x2fa58a=_0x9374[_0x304655];return _0x2fa58a;};'use strict';var _=require(_0x4937('0x0'));var util=require(_0x4937('0x1'));var moment=require(_0x4937('0x2'));var BPromise=require(_0x4937('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4937('0x4'))['db'];var utils=require(_0x4937('0x5'));var logger=require('../../config/logger')(_0x4937('0x6'));var config=require(_0x4937('0x7'));var jayson=require(_0x4937('0x8'));var client=jayson[_0x4937('0x9')][_0x4937('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7634,_0x5b3b8e,_0xaf9dcb){return new BPromise(function(_0x689aff,_0x1c61ed){return client['request'](_0x2f7634,_0xaf9dcb)[_0x4937('0xb')](function(_0x11842b){logger[_0x4937('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x5b3b8e,_0x4937('0xd'));logger[_0x4937('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5b3b8e,_0x4937('0xd'),JSON['stringify'](_0x11842b));if(_0x11842b['error']){if(_0x11842b[_0x4937('0xf')][_0x4937('0x10')]===0x1f4){logger[_0x4937('0xf')](_0x4937('0x11'),_0x5b3b8e,_0x11842b[_0x4937('0xf')]['message']);return _0x1c61ed(_0x11842b[_0x4937('0xf')][_0x4937('0x12')]);}logger[_0x4937('0xf')](_0x4937('0x11'),_0x5b3b8e,_0x11842b[_0x4937('0xf')][_0x4937('0x12')]);return _0x689aff(_0x11842b['error'][_0x4937('0x12')]);}else{logger[_0x4937('0xc')](_0x4937('0x11'),_0x5b3b8e,_0x4937('0xd'));_0x689aff(_0x11842b['result'][_0x4937('0x12')]);}})[_0x4937('0x13')](function(_0x1c15d3){logger[_0x4937('0xf')](_0x4937('0x11'),_0x5b3b8e,_0x1c15d3);_0x1c61ed(_0x1c15d3);});});}exports[_0x4937('0x14')]=function(_0x1ebb5c){var _0x4c622b=this;return new Promise(function(_0x3202a7,_0x4d0c90){return db[_0x4937('0x15')][_0x4937('0x16')]({'raw':_0x1ebb5c[_0x4937('0x17')]?_0x1ebb5c['options'][_0x4937('0x18')]===undefined?!![]:![]:!![],'where':_0x1ebb5c[_0x4937('0x17')]?_0x1ebb5c[_0x4937('0x17')][_0x4937('0x19')]||null:null,'attributes':_0x1ebb5c[_0x4937('0x17')]?_0x1ebb5c['options'][_0x4937('0x1a')]||null:null,'limit':_0x1ebb5c[_0x4937('0x17')]?_0x1ebb5c[_0x4937('0x17')][_0x4937('0x1b')]||null:null,'include':_0x1ebb5c[_0x4937('0x17')]?_0x1ebb5c[_0x4937('0x17')][_0x4937('0x1c')]?_[_0x4937('0x1d')](_0x1ebb5c['options'][_0x4937('0x1c')],function(_0x300d22){return{'model':db[_0x300d22['model']],'as':_0x300d22['as'],'attributes':_0x300d22[_0x4937('0x1a')],'include':_0x300d22[_0x4937('0x1c')]?_['map'](_0x300d22[_0x4937('0x1c')],function(_0x53d857){return{'model':db[_0x53d857['model']],'as':_0x53d857['as'],'attributes':_0x53d857['attributes'],'include':_0x53d857[_0x4937('0x1c')]?_[_0x4937('0x1d')](_0x53d857['include'],function(_0x53a5c6){return{'model':db[_0x53a5c6[_0x4937('0x1e')]],'as':_0x53a5c6['as'],'attributes':_0x53a5c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x4937('0xb')](function(_0x5dfbd0){logger['info']('GetCmHopperBlack',_0x1ebb5c);logger[_0x4937('0xe')](_0x4937('0x14'),_0x1ebb5c,JSON[_0x4937('0x1f')](_0x5dfbd0));_0x3202a7(_0x5dfbd0);})['catch'](function(_0x2a614e){logger['error']('GetCmHopperBlack',_0x2a614e[_0x4937('0x12')],_0x1ebb5c);_0x4d0c90(_0x4c622b[_0x4937('0xf')](0x1f4,_0x2a614e[_0x4937('0x12')]));});});};exports[_0x4937('0x20')]=function(_0x335afb){var _0x369d6e=this;return new Promise(function(_0x1b971e,_0x2f04d8){return db['CmHopperBlack'][_0x4937('0x21')](_0x335afb['body'],{'raw':_0x335afb[_0x4937('0x17')]?_0x335afb[_0x4937('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x335afb['options']?_0x335afb[_0x4937('0x17')][_0x4937('0x19')]||null:null,'attributes':_0x335afb['options']?_0x335afb[_0x4937('0x17')][_0x4937('0x1a')]||null:null,'limit':_0x335afb[_0x4937('0x17')]?_0x335afb[_0x4937('0x17')][_0x4937('0x1b')]||null:null})['then'](function(_0x5ca2c0){logger[_0x4937('0xc')]('UpdateCmHopperBlack',_0x335afb);logger[_0x4937('0xe')]('UpdateCmHopperBlack',_0x335afb,JSON[_0x4937('0x1f')](_0x5ca2c0));_0x1b971e(_0x5ca2c0);})[_0x4937('0x13')](function(_0x4b460e){logger[_0x4937('0xf')]('UpdateCmHopperBlack',_0x4b460e[_0x4937('0x12')],_0x335afb);_0x2f04d8(_0x369d6e[_0x4937('0xf')](0x1f4,_0x4b460e[_0x4937('0x12')]));});});};exports[_0x4937('0x22')]=function(_0xc86ba){var _0x154b4a=this;return new Promise(function(_0x37488f,_0x319caa){return db['CmHopperBlack']['destroy']({'where':_0xc86ba[_0x4937('0x17')]?_0xc86ba['options'][_0x4937('0x19')]||null:null})[_0x4937('0xb')](function(_0x56c43a){logger['info'](_0x4937('0x22'),_0xc86ba);logger[_0x4937('0xe')](_0x4937('0x22'),_0xc86ba,JSON[_0x4937('0x1f')](_0x56c43a));_0x37488f(_0x56c43a);})[_0x4937('0x13')](function(_0x254ea3){logger[_0x4937('0xf')](_0x4937('0x22'),_0x254ea3[_0x4937('0x12')],_0xc86ba);_0x319caa(_0x154b4a['error'](0x1f4,_0x254ea3['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a6742da..cd1d3ae 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 _0xacf4=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','put','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x208961,_0x5e6cf6){var _0x4236f5=function(_0x28856f){while(--_0x28856f){_0x208961['push'](_0x208961['shift']());}};_0x4236f5(++_0x5e6cf6);}(_0xacf4,0xe7));var _0x4acf=function(_0x5c8e8b,_0x56f91a){_0x5c8e8b=_0x5c8e8b-0x0;var _0x195e96=_0xacf4[_0x5c8e8b];return _0x195e96;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0xd')](_0x4acf('0xe'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0xf')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0x10')]=router; \ No newline at end of file +var _0x187d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x1fea1c,_0x308bec){var _0x2dba62=function(_0x22061d){while(--_0x22061d){_0x1fea1c['push'](_0x1fea1c['shift']());}};_0x2dba62(++_0x308bec);}(_0x187d,0x93));var _0xd187=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x187d[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0x13')]);module[_0xd187('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 0910636..c6b7afd 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 _0xae95=['DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING'];(function(_0x5e616b,_0x456df6){var _0x3a4976=function(_0x4a06bb){while(--_0x4a06bb){_0x5e616b['push'](_0x5e616b['shift']());}};_0x3a4976(++_0x456df6);}(_0xae95,0xcc));var _0x5ae9=function(_0x43983a,_0x1f0d8){_0x43983a=_0x43983a-0x0;var _0x527d0b=_0xae95[_0x43983a];return _0x527d0b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5ae9('0x0'));module[_0x5ae9('0x1')]={'state':{'type':Sequelize[_0x5ae9('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5ae9('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5ae9('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5ae9('0x3')]},'calleridnum':{'type':Sequelize[_0x5ae9('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5ae9('0x4')]},'responsetime':{'type':Sequelize[_0x5ae9('0x4')]},'answertime':{'type':Sequelize[_0x5ae9('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5ae9('0x4')]},'ringtime':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5ae9('0x3')]},'campaign':{'type':Sequelize[_0x5ae9('0x3')]},'campaigntype':{'type':Sequelize[_0x5ae9('0x3')]},'membername':{'type':Sequelize[_0x5ae9('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5ae9('0x3')]},'dispositionat':{'type':Sequelize[_0x5ae9('0x4')],'set':function(_0x42a12a){var _0x521276=this[_0x5ae9('0x5')](_0x5ae9('0x6'));if(_0x521276&&_0x42a12a){this[_0x5ae9('0x7')](_0x5ae9('0x8'),moment(_0x42a12a)[_0x5ae9('0x9')](moment(_0x521276),_0x5ae9('0xa')));}return this['setDataValue'](_0x5ae9('0xb'),_0x42a12a);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5ae9('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5ae9('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x5ae9('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5ae9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x5ae9('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5ae9('0x4')]},'recallme':{'type':Sequelize[_0x5ae9('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5ae9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a80=['diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING','DATE','setDataValue','followuptime'];(function(_0x60b0f4,_0x5c9c28){var _0x2b6cb4=function(_0x2fb943){while(--_0x2fb943){_0x60b0f4['push'](_0x60b0f4['shift']());}};_0x2b6cb4(++_0x5c9c28);}(_0x8a80,0x7d));var _0x08a8=function(_0x5d7a03,_0x4964ce){_0x5d7a03=_0x5d7a03-0x0;var _0x54014a=_0x8a80[_0x5d7a03];return _0x54014a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x08a8('0x0'));module[_0x08a8('0x1')]={'state':{'type':Sequelize[_0x08a8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x08a8('0x3')]},'scheduledat':{'type':Sequelize[_0x08a8('0x4')]},'countbusyretry':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x08a8('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x08a8('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x08a8('0x3')]},'starttime':{'type':Sequelize[_0x08a8('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x08a8('0x4')]},'endtime':{'type':Sequelize[_0x08a8('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x08a8('0x3')]},'membername':{'type':Sequelize[_0x08a8('0x3')]},'reason':{'type':Sequelize[_0x08a8('0x3')]},'disposition':{'type':Sequelize[_0x08a8('0x3')]},'secondDisposition':{'type':Sequelize[_0x08a8('0x3')]},'thirdDisposition':{'type':Sequelize[_0x08a8('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5572f6){var _0x4be8fd=this['getDataValue']('endtime');if(_0x4be8fd&&_0x5572f6){this[_0x08a8('0x5')](_0x08a8('0x6'),moment(_0x5572f6)[_0x08a8('0x7')](moment(_0x4be8fd),_0x08a8('0x8')));}return this[_0x08a8('0x5')](_0x08a8('0x9'),_0x5572f6);}},'amd':{'type':Sequelize[_0x08a8('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x08a8('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x08a8('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x08a8('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x08a8('0x4')]},'callback':{'type':Sequelize[_0x08a8('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x08a8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x08a8('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x08a8('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x08a8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x08a8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 ac6267d..82a1aef 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 _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x317b2e,_0x165181){var _0x1a30d6=function(_0x498315){while(--_0x498315){_0x317b2e['push'](_0x317b2e['shift']());}};_0x1a30d6(++_0x165181);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file +var _0x4975=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','CmHopperFinal','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','noAnswerContacts','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','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','select'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4975,0x86));var _0x5497=function(_0x10c8cf,_0x3cc8f9){_0x10c8cf=_0x10c8cf-0x0;var _0x5d300c=_0x4975[_0x10c8cf];return _0x5d300c;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['CmHopperFinal'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['describe']()[_0x5497('0x24')](respondWithResult(_0x466287,null))[_0x5497('0x40')](handleError(_0x466287,null));};exports[_0x5497('0x23')]=function(_0x52a189,_0x3e4da2){if(_0x52a189['body'][_0x5497('0x46')]){delete _0x52a189[_0x5497('0x47')][_0x5497('0x46')];}return db['CmHopperFinal'][_0x5497('0x44')]({'where':{'uniqueid':_0x52a189[_0x5497('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e4da2,null))[_0x5497('0x24')](saveUpdates(_0x52a189['body'],null))[_0x5497('0x24')](respondWithResult(_0x3e4da2,null))['catch'](handleError(_0x3e4da2,null));};exports[_0x5497('0x48')]=function(_0x400860,_0x26fd9f,_0xf07541){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x400860[_0x5497('0x42')]['id']},'attributes':[[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize'][_0x5497('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x50')))),_0x5497('0x51')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x52')))),_0x5497('0x53')],[db['sequelize']['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x56')))),_0x5497('0x57')]]})[_0x5497('0x24')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x24')](respondWithResult(_0x26fd9f,null))[_0x5497('0x40')](handleError(_0x26fd9f,null));};exports[_0x5497('0x58')]=function(_0x573f93,_0x18b30c,_0x3b0350){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'CampaignId':_0x573f93['params']['id']},'attributes':[[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x5b')))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x51')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x53')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x56')))),_0x5497('0x57')]]})['then'](handleEntityNotFound(_0x18b30c,null))[_0x5497('0x24')](respondWithResult(_0x18b30c,null))[_0x5497('0x40')](handleError(_0x18b30c,null));};exports[_0x5497('0x5c')]=function(_0x4ef195,_0x5794ff,_0x589008){return db[_0x5497('0x5d')][_0x5497('0x44')]({'where':{'id':_0x4ef195['params']['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x5794ff,null))[_0x5497('0x24')](function(_0x21c715){var _0x286af8;if(_0x21c715){_0x286af8=squel['insert']()[_0x5497('0x5e')](_0x5497('0x5f'))[_0x5497('0x60')](['phone',_0x5497('0x61'),_0x5497('0x62'),'ListId',_0x5497('0x63'),_0x5497('0x64'),_0x5497('0x65')],squel['select']()['field'](_0x5497('0x66'),_0x5497('0x67'))[_0x5497('0x68')](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x6d'),_0x5497('0x63'))[_0x5497('0x68')]('NOW()',_0x5497('0x64'))[_0x5497('0x68')]('NOW()',_0x5497('0x65'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4ef195[_0x5497('0x47')][_0x5497('0x73')]['toString']())[_0x5497('0x37')](_0x5497('0x74'))[_0x5497('0x37')](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x67'))['from'](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195[_0x5497('0x42')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5497('0x76'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id']['toString']())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x286af8);}return[];})[_0x5497('0x24')](respondWithResult(_0x5794ff,null))[_0x5497('0x40')](handleError(_0x5794ff,null));};exports[_0x5497('0x79')]=function(_0x4c41c4,_0x1515f1,_0x4118ec){return db[_0x5497('0x7a')][_0x5497('0x44')]({'where':{'id':_0x4c41c4[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x1515f1,null))['then'](function(_0x1ef7fc){var _0x5903b7;if(_0x1ef7fc){_0x5903b7=squel[_0x5497('0x7b')]()[_0x5497('0x5e')](_0x5497('0x5f'))['fromQuery'](['phone',_0x5497('0x61'),_0x5497('0x62'),_0x5497('0x6c'),_0x5497('0x7c'),_0x5497('0x64'),_0x5497('0x65')],squel[_0x5497('0x7d')]()[_0x5497('0x68')]('ANY_VALUE(calleridnum)','phone')['field'](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x7e'),_0x5497('0x7c'))[_0x5497('0x68')](_0x5497('0x69'),'createdAt')['field']('NOW()','updatedAt')['from'](_0x5497('0x6f'))['where'](_0x5497('0x7f'),_0x4c41c4['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4c41c4[_0x5497('0x47')][_0x5497('0x73')][_0x5497('0x71')]())['where'](_0x5497('0x74'))['where'](_0x5497('0x75'),squel[_0x5497('0x7d')]()[_0x5497('0x68')](_0x5497('0x67'))[_0x5497('0x6e')](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]()))['where'](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x76'))['from'](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x5903b7);}return[];})[_0x5497('0x24')](respondWithResult(_0x1515f1,null))[_0x5497('0x40')](handleError(_0x1515f1,null));};exports['checkContactHopper']=function(_0x37c17e,_0x163b5b,_0x3a31be){return db[_0x5497('0x80')][_0x5497('0x81')]({'where':{'VoiceQueueId':_0x37c17e['body'][_0x5497('0x63')],'CampaignId':_0x37c17e[_0x5497('0x47')]['CampaignId'],'ContactId':_0x37c17e['body'][_0x5497('0x62')]}})[_0x5497('0x24')](handleEntityNotFound(_0x163b5b,null))[_0x5497('0x24')](function(_0x14f693){if(_0x14f693){return _0x14f693;}return null;})[_0x5497('0x24')](respondWithResult(_0x163b5b,null))['catch'](handleError(_0x163b5b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 92a5d95..e280f48 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 _0xbb2d=['../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x225f7a,_0x2a0447){var _0x418621=function(_0x490958){while(--_0x490958){_0x225f7a['push'](_0x225f7a['shift']());}};_0x418621(++_0x2a0447);}(_0xbb2d,0x1aa));var _0xdbb2=function(_0x57dc85,_0x3a6d51){_0x57dc85=_0x57dc85-0x0;var _0x563a2e=_0xbb2d[_0x57dc85];return _0x563a2e;};'use strict';var _=require(_0xdbb2('0x0'));var util=require(_0xdbb2('0x1'));var logger=require(_0xdbb2('0x2'))(_0xdbb2('0x3'));var moment=require(_0xdbb2('0x4'));var BPromise=require(_0xdbb2('0x5'));var rp=require(_0xdbb2('0x6'));var fs=require('fs');var path=require(_0xdbb2('0x7'));var rimraf=require(_0xdbb2('0x8'));var config=require(_0xdbb2('0x9'));var attributes=require(_0xdbb2('0xa'));module[_0xdbb2('0xb')]=function(_0xdcc4de,_0x148850){return _0xdcc4de['define']('CmHopperFinal',attributes,{'tableName':_0xdbb2('0xc'),'paranoid':![],'indexes':[{'name':_0xdbb2('0xd'),'fields':[_0xdbb2('0xd')]},{'name':_0xdbb2('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc827=['moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','util','api'];(function(_0x460a75,_0x35f984){var _0xdddb7c=function(_0x1ea8bf){while(--_0x1ea8bf){_0x460a75['push'](_0x460a75['shift']());}};_0xdddb7c(++_0x35f984);}(_0xc827,0x112));var _0x7c82=function(_0x15ede4,_0x3edc11){_0x15ede4=_0x15ede4-0x0;var _0x26acf2=_0xc827[_0x15ede4];return _0x26acf2;};'use strict';var _=require('lodash');var util=require(_0x7c82('0x0'));var logger=require('../../config/logger')(_0x7c82('0x1'));var moment=require(_0x7c82('0x2'));var BPromise=require(_0x7c82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c82('0x4'));var rimraf=require('rimraf');var config=require(_0x7c82('0x5'));var attributes=require(_0x7c82('0x6'));module[_0x7c82('0x7')]=function(_0x373fff,_0xcfdc95){return _0x373fff[_0x7c82('0x8')](_0x7c82('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7c82('0xa'),'fields':[_0x7c82('0xa')]},{'name':'uniqueid','fields':[_0x7c82('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 82033ce..f2ccea9 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x40f811,_0x16724d){var _0x2a3044=function(_0x24cc5f){while(--_0x24cc5f){_0x40f811['push'](_0x40f811['shift']());}};_0x2a3044(++_0x16724d);}(_0x7a54,0x106));var _0x47a5=function(_0x23fd5c,_0xd466d4){_0x23fd5c=_0x23fd5c-0x0;var _0x400c65=_0x7a54[_0x23fd5c];return _0x400c65;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x12f2a9,_0x450b5){var _0x5bc030=function(_0xcbaa56){while(--_0xcbaa56){_0x12f2a9['push'](_0x12f2a9['shift']());}};_0x5bc030(++_0x450b5);}(_0x7a54,0x106));var _0x47a5=function(_0xc7753e,_0x52aa0a){_0xc7753e=_0xc7753e-0x0;var _0x46168c=_0x7a54[_0xc7753e];return _0x46168c;};'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 b1921d2..e123306 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 _0xd798=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd798,0x97));var _0x8d79=function(_0x51f2bb,_0x1e31ee){_0x51f2bb=_0x51f2bb-0x0;var _0x457ce9=_0xd798[_0x51f2bb];return _0x457ce9;};'use strict';var multer=require(_0x8d79('0x0'));var util=require(_0x8d79('0x1'));var path=require(_0x8d79('0x2'));var timeout=require(_0x8d79('0x3'));var express=require(_0x8d79('0x4'));var router=express[_0x8d79('0x5')]();var fs_extra=require(_0x8d79('0x6'));var auth=require(_0x8d79('0x7'));var interaction=require(_0x8d79('0x8'));var config=require(_0x8d79('0x9'));var controller=require(_0x8d79('0xa'));router[_0x8d79('0xb')]('/',auth[_0x8d79('0xc')](),controller[_0x8d79('0xd')]);router['get'](_0x8d79('0xe'),auth['isAuthenticated'](),controller[_0x8d79('0xf')]);router[_0x8d79('0xb')](_0x8d79('0x10'),auth[_0x8d79('0xc')](),controller[_0x8d79('0x11')]);router[_0x8d79('0xb')](_0x8d79('0x12'),auth[_0x8d79('0xc')](),controller[_0x8d79('0x13')]);router[_0x8d79('0xb')](_0x8d79('0x14'),auth[_0x8d79('0xc')](),controller[_0x8d79('0x15')]);router[_0x8d79('0x16')](_0x8d79('0x17'),auth['isAuthenticated'](),controller[_0x8d79('0x18')]);router[_0x8d79('0x16')](_0x8d79('0x19'),auth['isAuthenticated'](),controller[_0x8d79('0x1a')]);router['post'](_0x8d79('0x1b'),auth[_0x8d79('0xc')](),controller[_0x8d79('0x1c')]);router[_0x8d79('0x1d')](_0x8d79('0x10'),auth[_0x8d79('0xc')](),controller[_0x8d79('0x1e')]);module[_0x8d79('0x1f')]=router; \ No newline at end of file +var _0x323a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports'];(function(_0x1a2b19,_0x421ca0){var _0x59dac6=function(_0x1cf242){while(--_0x1cf242){_0x1a2b19['push'](_0x1a2b19['shift']());}};_0x59dac6(++_0x421ca0);}(_0x323a,0x1b0));var _0xa323=function(_0x4bbb2f,_0x1d2540){_0x4bbb2f=_0x4bbb2f-0x0;var _0xd473a4=_0x323a[_0x4bbb2f];return _0xd473a4;};'use strict';var multer=require('multer');var util=require(_0xa323('0x0'));var path=require(_0xa323('0x1'));var timeout=require(_0xa323('0x2'));var express=require(_0xa323('0x3'));var router=express[_0xa323('0x4')]();var fs_extra=require(_0xa323('0x5'));var auth=require(_0xa323('0x6'));var interaction=require(_0xa323('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xa323('0x8')]('/',auth[_0xa323('0x9')](),controller[_0xa323('0xa')]);router[_0xa323('0x8')]('/describe',auth[_0xa323('0x9')](),controller['describe']);router[_0xa323('0x8')](_0xa323('0xb'),auth['isAuthenticated'](),controller[_0xa323('0xc')]);router[_0xa323('0x8')]('/voice/queue/countAttributes/:id',auth[_0xa323('0x9')](),controller[_0xa323('0xd')]);router[_0xa323('0x8')](_0xa323('0xe'),auth[_0xa323('0x9')](),controller[_0xa323('0xf')]);router[_0xa323('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xa323('0x11')]);router['post'](_0xa323('0x12'),auth[_0xa323('0x9')](),controller[_0xa323('0x13')]);router[_0xa323('0x10')](_0xa323('0x14'),auth[_0xa323('0x9')](),controller[_0xa323('0x15')]);router['put']('/:id',auth[_0xa323('0x9')](),controller[_0xa323('0x16')]);module[_0xa323('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0f89db3..c634239 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 _0x0f16=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x42f981,_0x4ced0a){var _0xcbcc36=function(_0x33de70){while(--_0x33de70){_0x42f981['push'](_0x42f981['shift']());}};_0xcbcc36(++_0x4ced0a);}(_0x0f16,0x151));var _0x60f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f16[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x60f1('0x0'));module['exports']={'state':{'type':Sequelize[_0x60f1('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x60f1('0x2')]},'countbusyretry':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x60f1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x60f1('0x3')]},'calleridnum':{'type':Sequelize[_0x60f1('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x60f1('0x2')]},'responsetime':{'type':Sequelize[_0x60f1('0x2')]},'answertime':{'type':Sequelize[_0x60f1('0x2')]},'droptime':{'type':Sequelize[_0x60f1('0x2')]},'endtime':{'type':Sequelize[_0x60f1('0x2')]},'ringtime':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x60f1('0x3')]},'amd':{'type':Sequelize[_0x60f1('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x60f1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x60f1('0x2')]},'recallme':{'type':Sequelize[_0x60f1('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x60f1('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x60f1('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x60f1('0x3')]}}; \ No newline at end of file +var _0x5f0e=['sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3fd985,_0x265717){var _0x2beb95=function(_0x4c1a82){while(--_0x4c1a82){_0x3fd985['push'](_0x3fd985['shift']());}};_0x2beb95(++_0x265717);}(_0x5f0e,0x19a));var _0xe5f0=function(_0xb2e5d6,_0x439507){_0xb2e5d6=_0xb2e5d6-0x0;var _0x386876=_0x5f0e[_0xb2e5d6];return _0x386876;};'use strict';var Sequelize=require(_0xe5f0('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe5f0('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe5f0('0x1')]},'calleridname':{'type':Sequelize[_0xe5f0('0x1')]},'starttime':{'type':Sequelize[_0xe5f0('0x3')]},'responsetime':{'type':Sequelize[_0xe5f0('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe5f0('0x3')]},'endtime':{'type':Sequelize[_0xe5f0('0x3')]},'ringtime':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe5f0('0x1')]},'campaign':{'type':Sequelize[_0xe5f0('0x1')]},'campaigntype':{'type':Sequelize[_0xe5f0('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xe5f0('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe5f0('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe5f0('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe5f0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe5f0('0x3')]},'edited':{'type':Sequelize[_0xe5f0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe5f0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe5f0('0x2')],'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 c78c35a..aabe61f 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 _0x2e52=['filters','find','catch','create','body','describe','uniqueid','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x3cda26,_0x31a42a){var _0x45469f=function(_0x27a69d){while(--_0x27a69d){_0x3cda26['push'](_0x3cda26['shift']());}};_0x45469f(++_0x31a42a);}(_0x2e52,0x140));var _0x22e5=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2e52[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22e5('0x0'));var zipdir=require(_0x22e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22e5('0x2'));var moment=require(_0x22e5('0x3'));var BPromise=require(_0x22e5('0x4'));var Mustache=require(_0x22e5('0x5'));var util=require(_0x22e5('0x6'));var path=require(_0x22e5('0x7'));var sox=require(_0x22e5('0x8'));var csv=require(_0x22e5('0x9'));var ejs=require(_0x22e5('0xa'));var fs=require('fs');var fs_extra=require(_0x22e5('0xb'));var _=require(_0x22e5('0xc'));var squel=require('squel');var crypto=require(_0x22e5('0xd'));var jsforce=require(_0x22e5('0xe'));var deskjs=require(_0x22e5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x22e5('0x10'));var Papa=require(_0x22e5('0x11'));var Redis=require(_0x22e5('0x12'));var authService=require(_0x22e5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x22e5('0x14'));var hardwareService=require(_0x22e5('0x15'));var logger=require(_0x22e5('0x16'))('api');var utils=require(_0x22e5('0x17'));var config=require(_0x22e5('0x18'));var licenseUtil=require(_0x22e5('0x19'));var db=require(_0x22e5('0x1a'))['db'];function respondWithStatusCode(_0x41dca9,_0x281465){_0x281465=_0x281465||0xcc;return function(_0x4369a3){if(_0x4369a3){return _0x41dca9[_0x22e5('0x1b')](_0x281465);}return _0x41dca9[_0x22e5('0x1c')](_0x281465)[_0x22e5('0x1d')]();};}function respondWithResult(_0x251282,_0xf0def4){_0xf0def4=_0xf0def4||0xc8;return function(_0x21e5a3){if(_0x21e5a3){return _0x251282[_0x22e5('0x1c')](_0xf0def4)[_0x22e5('0x1e')](_0x21e5a3);}};}function respondWithFilteredResult(_0x47024b,_0x11c7c3){return function(_0x3bd4a6){if(_0x3bd4a6){var _0x3b6844=typeof _0x11c7c3[_0x22e5('0x1f')]===_0x22e5('0x20')&&typeof _0x11c7c3[_0x22e5('0x21')]==='undefined';var _0x2ac2e4=_0x3bd4a6[_0x22e5('0x22')];var _0x162a7b=_0x3b6844?0x0:_0x11c7c3[_0x22e5('0x1f')];var _0x48bd3e=_0x3b6844?_0x3bd4a6[_0x22e5('0x22')]:_0x11c7c3['offset']+_0x11c7c3['limit'];var _0x7e3fb8;if(_0x48bd3e>=_0x2ac2e4){_0x48bd3e=_0x2ac2e4;_0x7e3fb8=0xc8;}else{_0x7e3fb8=0xce;}_0x47024b[_0x22e5('0x1c')](_0x7e3fb8);return _0x47024b[_0x22e5('0x23')]('Content-Range',_0x162a7b+'-'+_0x48bd3e+'/'+_0x2ac2e4)['json'](_0x3bd4a6);}return null;};}function patchUpdates(_0x32bfd8){return function(_0x1e3d97){try{jsonpatch[_0x22e5('0x24')](_0x1e3d97,_0x32bfd8,!![]);}catch(_0x395f73){return BPromise[_0x22e5('0x25')](_0x395f73);}return _0x1e3d97[_0x22e5('0x26')]();};}function saveUpdates(_0x57be93,_0x2db11d){return function(_0x2b4c6c){if(_0x2b4c6c){return _0x2b4c6c[_0x22e5('0x27')](_0x57be93)[_0x22e5('0x28')](function(_0x1836db){return _0x1836db;});}return null;};}function removeEntity(_0x53f4a7,_0x407f20){return function(_0x473af3){if(_0x473af3){return _0x473af3['destroy']()[_0x22e5('0x28')](function(){_0x53f4a7['status'](0xcc)[_0x22e5('0x1d')]();});}};}function handleEntityNotFound(_0x583be8,_0x929a85){return function(_0xb266df){if(!_0xb266df){_0x583be8[_0x22e5('0x1b')](0x194);}return _0xb266df;};}function handleError(_0x3ab237,_0xe53b0c){_0xe53b0c=_0xe53b0c||0x1f4;return function(_0x4e240c){logger['error'](_0x4e240c[_0x22e5('0x29')]);if(_0x4e240c[_0x22e5('0x2a')]){delete _0x4e240c[_0x22e5('0x2a')];}_0x3ab237[_0x22e5('0x1c')](_0xe53b0c)[_0x22e5('0x2b')](_0x4e240c);};}exports['index']=function(_0x19cc25,_0x59f159){var _0x3e37f4={},_0x48741f={},_0x3a0fc8={'count':0x0,'rows':[]};var _0xa337ca=_[_0x22e5('0x2c')](db[_0x22e5('0x2d')][_0x22e5('0x2e')],function(_0x29a1ab){return{'name':_0x29a1ab[_0x22e5('0x2f')],'type':_0x29a1ab[_0x22e5('0x30')]['key']};});_0x48741f[_0x22e5('0x31')]=_[_0x22e5('0x2c')](_0xa337ca,_0x22e5('0x2a'));_0x48741f['query']=_[_0x22e5('0x32')](_0x19cc25[_0x22e5('0x33')]);_0x48741f['filters']=_[_0x22e5('0x34')](_0x48741f[_0x22e5('0x31')],_0x48741f['query']);_0x3e37f4['attributes']=_[_0x22e5('0x34')](_0x48741f[_0x22e5('0x31')],qs[_0x22e5('0x35')](_0x19cc25[_0x22e5('0x33')][_0x22e5('0x35')]));_0x3e37f4[_0x22e5('0x36')]=_0x3e37f4['attributes'][_0x22e5('0x37')]?_0x3e37f4['attributes']:_0x48741f[_0x22e5('0x31')];if(!_0x19cc25[_0x22e5('0x33')][_0x22e5('0x38')]('nolimit')){_0x3e37f4['limit']=qs[_0x22e5('0x21')](_0x19cc25['query'][_0x22e5('0x21')]);_0x3e37f4[_0x22e5('0x1f')]=qs[_0x22e5('0x1f')](_0x19cc25['query'][_0x22e5('0x1f')]);}_0x3e37f4[_0x22e5('0x39')]=qs[_0x22e5('0x3a')](_0x19cc25[_0x22e5('0x33')][_0x22e5('0x3a')]);_0x3e37f4[_0x22e5('0x3b')]=qs['filters'](_[_0x22e5('0x3c')](_0x19cc25[_0x22e5('0x33')],_0x48741f['filters']),_0xa337ca);if(_0x19cc25[_0x22e5('0x33')][_0x22e5('0x3d')]){_0x3e37f4[_0x22e5('0x3b')]=_[_0x22e5('0x3e')](_0x3e37f4['where'],{'$or':_[_0x22e5('0x2c')](_0xa337ca,function(_0x312efd){if(_0x312efd[_0x22e5('0x30')]!==_0x22e5('0x3f')){var _0x4e46b3={};_0x4e46b3[_0x312efd[_0x22e5('0x2a')]]={'$like':'%'+_0x19cc25[_0x22e5('0x33')]['filter']+'%'};return _0x4e46b3;}})});}_0x3e37f4=_['merge']({},_0x3e37f4,_0x19cc25[_0x22e5('0x40')]);var _0x469bab={'where':_0x3e37f4[_0x22e5('0x3b')]};return db['CmHopperHistory']['count'](_0x469bab)[_0x22e5('0x28')](function(_0x46b00b){_0x3a0fc8[_0x22e5('0x22')]=_0x46b00b;if(_0x19cc25['query'][_0x22e5('0x41')]){_0x3e37f4[_0x22e5('0x42')]=[{'all':!![]}];}return db[_0x22e5('0x2d')][_0x22e5('0x43')](_0x3e37f4);})['then'](function(_0x113f7d){_0x3a0fc8[_0x22e5('0x44')]=_0x113f7d;return _0x3a0fc8;})[_0x22e5('0x28')](respondWithFilteredResult(_0x59f159,_0x3e37f4))['catch'](handleError(_0x59f159,null));};exports[_0x22e5('0x45')]=function(_0xee987b,_0xb9411c){var _0x44f84e={'raw':!![],'where':{'id':_0xee987b['params']['id']}},_0x293254={};_0x293254[_0x22e5('0x31')]=_[_0x22e5('0x32')](db[_0x22e5('0x2d')][_0x22e5('0x2e')]);_0x293254[_0x22e5('0x33')]=_[_0x22e5('0x32')](_0xee987b[_0x22e5('0x33')]);_0x293254[_0x22e5('0x46')]=_[_0x22e5('0x34')](_0x293254[_0x22e5('0x31')],_0x293254[_0x22e5('0x33')]);_0x44f84e[_0x22e5('0x36')]=_[_0x22e5('0x34')](_0x293254[_0x22e5('0x31')],qs[_0x22e5('0x35')](_0xee987b[_0x22e5('0x33')][_0x22e5('0x35')]));_0x44f84e[_0x22e5('0x36')]=_0x44f84e['attributes'][_0x22e5('0x37')]?_0x44f84e[_0x22e5('0x36')]:_0x293254[_0x22e5('0x31')];if(_0xee987b[_0x22e5('0x33')][_0x22e5('0x41')]){_0x44f84e[_0x22e5('0x42')]=[{'all':!![]}];}_0x44f84e=_['merge']({},_0x44f84e,_0xee987b[_0x22e5('0x40')]);return db[_0x22e5('0x2d')][_0x22e5('0x47')](_0x44f84e)['then'](handleEntityNotFound(_0xb9411c,null))[_0x22e5('0x28')](respondWithResult(_0xb9411c,null))[_0x22e5('0x48')](handleError(_0xb9411c,null));};exports[_0x22e5('0x49')]=function(_0xdb40d,_0x18f61d){return db[_0x22e5('0x2d')][_0x22e5('0x49')](_0xdb40d[_0x22e5('0x4a')],{})[_0x22e5('0x28')](respondWithResult(_0x18f61d,0xc9))[_0x22e5('0x48')](handleError(_0x18f61d,null));};exports['describe']=function(_0xfbba23,_0x553ac2){return db[_0x22e5('0x2d')][_0x22e5('0x4b')]()[_0x22e5('0x28')](respondWithResult(_0x553ac2,null))['catch'](handleError(_0x553ac2,null));};exports[_0x22e5('0x27')]=function(_0x2cdcbf,_0x1adc5e){if(_0x2cdcbf['body'][_0x22e5('0x4c')]){delete _0x2cdcbf[_0x22e5('0x4a')][_0x22e5('0x4c')];}return db[_0x22e5('0x2d')][_0x22e5('0x47')]({'where':{'uniqueid':_0x2cdcbf[_0x22e5('0x4d')]['id']}})[_0x22e5('0x28')](handleEntityNotFound(_0x1adc5e,null))[_0x22e5('0x28')](saveUpdates(_0x2cdcbf[_0x22e5('0x4a')],null))[_0x22e5('0x28')](respondWithResult(_0x1adc5e,null))['catch'](handleError(_0x1adc5e,null));}; \ No newline at end of file +var _0xd9ca=['sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperHistory','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','update','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x59250d,_0x3faa07){var _0x7635eb=function(_0x27ad6b){while(--_0x27ad6b){_0x59250d['push'](_0x59250d['shift']());}};_0x7635eb(++_0x3faa07);}(_0xd9ca,0x1bc));var _0xad9c=function(_0x2fc304,_0x33b0e9){_0x2fc304=_0x2fc304-0x0;var _0x5cb8f3=_0xd9ca[_0x2fc304];return _0x5cb8f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad9c('0x0'));var zipdir=require(_0xad9c('0x1'));var jsonpatch=require(_0xad9c('0x2'));var rp=require(_0xad9c('0x3'));var moment=require(_0xad9c('0x4'));var BPromise=require(_0xad9c('0x5'));var Mustache=require('mustache');var util=require(_0xad9c('0x6'));var path=require(_0xad9c('0x7'));var sox=require('sox');var csv=require(_0xad9c('0x8'));var ejs=require(_0xad9c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad9c('0xa'));var squel=require(_0xad9c('0xb'));var crypto=require(_0xad9c('0xc'));var jsforce=require(_0xad9c('0xd'));var deskjs=require(_0xad9c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xad9c('0xf'));var Papa=require(_0xad9c('0x10'));var Redis=require(_0xad9c('0x11'));var authService=require(_0xad9c('0x12'));var qs=require(_0xad9c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad9c('0x14'));var logger=require(_0xad9c('0x15'))(_0xad9c('0x16'));var utils=require(_0xad9c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14ffa6,_0x3c3fe2){_0x3c3fe2=_0x3c3fe2||0xcc;return function(_0x193e0a){if(_0x193e0a){return _0x14ffa6[_0xad9c('0x18')](_0x3c3fe2);}return _0x14ffa6[_0xad9c('0x19')](_0x3c3fe2)[_0xad9c('0x1a')]();};}function respondWithResult(_0x105d0a,_0x4a8904){_0x4a8904=_0x4a8904||0xc8;return function(_0x117b67){if(_0x117b67){return _0x105d0a[_0xad9c('0x19')](_0x4a8904)[_0xad9c('0x1b')](_0x117b67);}};}function respondWithFilteredResult(_0x285c3c,_0x27b430){return function(_0xfdc0c9){if(_0xfdc0c9){var _0x3a53be=typeof _0x27b430[_0xad9c('0x1c')]===_0xad9c('0x1d')&&typeof _0x27b430['limit']==='undefined';var _0x463fa1=_0xfdc0c9[_0xad9c('0x1e')];var _0xad47e3=_0x3a53be?0x0:_0x27b430[_0xad9c('0x1c')];var _0x18793f=_0x3a53be?_0xfdc0c9['count']:_0x27b430[_0xad9c('0x1c')]+_0x27b430['limit'];var _0x3f282e;if(_0x18793f>=_0x463fa1){_0x18793f=_0x463fa1;_0x3f282e=0xc8;}else{_0x3f282e=0xce;}_0x285c3c['status'](_0x3f282e);return _0x285c3c[_0xad9c('0x1f')](_0xad9c('0x20'),_0xad47e3+'-'+_0x18793f+'/'+_0x463fa1)[_0xad9c('0x1b')](_0xfdc0c9);}return null;};}function patchUpdates(_0x384091){return function(_0x295adc){try{jsonpatch[_0xad9c('0x21')](_0x295adc,_0x384091,!![]);}catch(_0x484717){return BPromise[_0xad9c('0x22')](_0x484717);}return _0x295adc[_0xad9c('0x23')]();};}function saveUpdates(_0x128a58,_0x5ee829){return function(_0x54c8dc){if(_0x54c8dc){return _0x54c8dc['update'](_0x128a58)[_0xad9c('0x24')](function(_0x3e40f7){return _0x3e40f7;});}return null;};}function removeEntity(_0x389f6c,_0x409bda){return function(_0x5780ff){if(_0x5780ff){return _0x5780ff[_0xad9c('0x25')]()['then'](function(){_0x389f6c[_0xad9c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d7aa,_0x263084){return function(_0x115dc2){if(!_0x115dc2){_0x50d7aa[_0xad9c('0x18')](0x194);}return _0x115dc2;};}function handleError(_0x2e1169,_0x2bd5cf){_0x2bd5cf=_0x2bd5cf||0x1f4;return function(_0x2ff965){logger['error'](_0x2ff965[_0xad9c('0x26')]);if(_0x2ff965[_0xad9c('0x27')]){delete _0x2ff965[_0xad9c('0x27')];}_0x2e1169[_0xad9c('0x19')](_0x2bd5cf)[_0xad9c('0x28')](_0x2ff965);};}exports[_0xad9c('0x29')]=function(_0x3c70dc,_0x3160f4){var _0x4b80d8={},_0x3bfe70={},_0x2cfee8={'count':0x0,'rows':[]};var _0x17f426=_['map'](db['CmHopperHistory'][_0xad9c('0x2a')],function(_0x5a604a){return{'name':_0x5a604a['fieldName'],'type':_0x5a604a['type'][_0xad9c('0x2b')]};});_0x3bfe70[_0xad9c('0x2c')]=_[_0xad9c('0x2d')](_0x17f426,_0xad9c('0x27'));_0x3bfe70[_0xad9c('0x2e')]=_['keys'](_0x3c70dc['query']);_0x3bfe70[_0xad9c('0x2f')]=_[_0xad9c('0x30')](_0x3bfe70[_0xad9c('0x2c')],_0x3bfe70[_0xad9c('0x2e')]);_0x4b80d8[_0xad9c('0x31')]=_[_0xad9c('0x30')](_0x3bfe70['model'],qs[_0xad9c('0x32')](_0x3c70dc[_0xad9c('0x2e')][_0xad9c('0x32')]));_0x4b80d8['attributes']=_0x4b80d8['attributes'][_0xad9c('0x33')]?_0x4b80d8['attributes']:_0x3bfe70[_0xad9c('0x2c')];if(!_0x3c70dc[_0xad9c('0x2e')][_0xad9c('0x34')](_0xad9c('0x35'))){_0x4b80d8[_0xad9c('0x36')]=qs[_0xad9c('0x36')](_0x3c70dc[_0xad9c('0x2e')]['limit']);_0x4b80d8[_0xad9c('0x1c')]=qs['offset'](_0x3c70dc[_0xad9c('0x2e')]['offset']);}_0x4b80d8[_0xad9c('0x37')]=qs['sort'](_0x3c70dc['query'][_0xad9c('0x38')]);_0x4b80d8[_0xad9c('0x39')]=qs['filters'](_[_0xad9c('0x3a')](_0x3c70dc[_0xad9c('0x2e')],_0x3bfe70[_0xad9c('0x2f')]),_0x17f426);if(_0x3c70dc['query'][_0xad9c('0x3b')]){_0x4b80d8['where']=_[_0xad9c('0x3c')](_0x4b80d8['where'],{'$or':_[_0xad9c('0x2d')](_0x17f426,function(_0xe936f0){if(_0xe936f0[_0xad9c('0x3d')]!==_0xad9c('0x3e')){var _0x4779ab={};_0x4779ab[_0xe936f0['name']]={'$like':'%'+_0x3c70dc[_0xad9c('0x2e')][_0xad9c('0x3b')]+'%'};return _0x4779ab;}})});}_0x4b80d8=_[_0xad9c('0x3c')]({},_0x4b80d8,_0x3c70dc[_0xad9c('0x3f')]);var _0x528735={'where':_0x4b80d8['where']};return db[_0xad9c('0x40')][_0xad9c('0x1e')](_0x528735)[_0xad9c('0x24')](function(_0x2b7598){_0x2cfee8[_0xad9c('0x1e')]=_0x2b7598;if(_0x3c70dc['query'][_0xad9c('0x41')]){_0x4b80d8[_0xad9c('0x42')]=[{'all':!![]}];}return db[_0xad9c('0x40')]['findAll'](_0x4b80d8);})[_0xad9c('0x24')](function(_0xec085a){_0x2cfee8[_0xad9c('0x43')]=_0xec085a;return _0x2cfee8;})[_0xad9c('0x24')](respondWithFilteredResult(_0x3160f4,_0x4b80d8))[_0xad9c('0x44')](handleError(_0x3160f4,null));};exports[_0xad9c('0x45')]=function(_0x2af510,_0x3ca810){var _0x5e7210={'raw':!![],'where':{'id':_0x2af510[_0xad9c('0x46')]['id']}},_0x59d034={};_0x59d034['model']=_[_0xad9c('0x47')](db[_0xad9c('0x40')][_0xad9c('0x2a')]);_0x59d034[_0xad9c('0x2e')]=_[_0xad9c('0x47')](_0x2af510[_0xad9c('0x2e')]);_0x59d034['filters']=_[_0xad9c('0x30')](_0x59d034[_0xad9c('0x2c')],_0x59d034[_0xad9c('0x2e')]);_0x5e7210[_0xad9c('0x31')]=_['intersection'](_0x59d034[_0xad9c('0x2c')],qs['fields'](_0x2af510['query'][_0xad9c('0x32')]));_0x5e7210[_0xad9c('0x31')]=_0x5e7210[_0xad9c('0x31')][_0xad9c('0x33')]?_0x5e7210['attributes']:_0x59d034[_0xad9c('0x2c')];if(_0x2af510[_0xad9c('0x2e')]['includeAll']){_0x5e7210[_0xad9c('0x42')]=[{'all':!![]}];}_0x5e7210=_['merge']({},_0x5e7210,_0x2af510[_0xad9c('0x3f')]);return db[_0xad9c('0x40')][_0xad9c('0x48')](_0x5e7210)[_0xad9c('0x24')](handleEntityNotFound(_0x3ca810,null))[_0xad9c('0x24')](respondWithResult(_0x3ca810,null))[_0xad9c('0x44')](handleError(_0x3ca810,null));};exports[_0xad9c('0x49')]=function(_0x1b095c,_0x2beae1){return db[_0xad9c('0x40')][_0xad9c('0x49')](_0x1b095c[_0xad9c('0x4a')],{})['then'](respondWithResult(_0x2beae1,0xc9))[_0xad9c('0x44')](handleError(_0x2beae1,null));};exports[_0xad9c('0x4b')]=function(_0xd5aeef,_0x17fcde){return db[_0xad9c('0x40')]['describe']()[_0xad9c('0x24')](respondWithResult(_0x17fcde,null))['catch'](handleError(_0x17fcde,null));};exports[_0xad9c('0x4c')]=function(_0x2655a2,_0x95026b){if(_0x2655a2[_0xad9c('0x4a')][_0xad9c('0x4d')]){delete _0x2655a2[_0xad9c('0x4a')]['uniqueid'];}return db[_0xad9c('0x40')][_0xad9c('0x48')]({'where':{'uniqueid':_0x2655a2[_0xad9c('0x46')]['id']}})[_0xad9c('0x24')](handleEntityNotFound(_0x95026b,null))[_0xad9c('0x24')](saveUpdates(_0x2655a2[_0xad9c('0x4a')],null))[_0xad9c('0x24')](respondWithResult(_0x95026b,null))[_0xad9c('0x44')](handleError(_0x95026b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 06b09db..6902ad6 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 _0x042a=['moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x042a,0x1d9));var _0xa042=function(_0x14fc5b,_0x637807){_0x14fc5b=_0x14fc5b-0x0;var _0x10e56e=_0x042a[_0x14fc5b];return _0x10e56e;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var logger=require(_0xa042('0x1'))(_0xa042('0x2'));var moment=require(_0xa042('0x3'));var BPromise=require('bluebird');var rp=require(_0xa042('0x4'));var fs=require('fs');var path=require(_0xa042('0x5'));var rimraf=require(_0xa042('0x6'));var config=require(_0xa042('0x7'));var attributes=require(_0xa042('0x8'));module[_0xa042('0x9')]=function(_0x622ece,_0xc35608){return _0x622ece['define'](_0xa042('0xa'),attributes,{'tableName':_0xa042('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xa042('0xc')]},{'name':'uniqueid','fields':[_0xa042('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2faf=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3655e5,_0x469eae){var _0x37dfac=function(_0x4378d2){while(--_0x4378d2){_0x3655e5['push'](_0x3655e5['shift']());}};_0x37dfac(++_0x469eae);}(_0x2faf,0xb0));var _0xf2fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var logger=require(_0xf2fa('0x2'))('api');var moment=require(_0xf2fa('0x3'));var BPromise=require(_0xf2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2fa('0x5'));var rimraf=require(_0xf2fa('0x6'));var config=require(_0xf2fa('0x7'));var attributes=require(_0xf2fa('0x8'));module[_0xf2fa('0x9')]=function(_0x33c832,_0x44d406){return _0x33c832['define'](_0xf2fa('0xa'),attributes,{'tableName':_0xf2fa('0xb'),'paranoid':![],'indexes':[{'name':_0xf2fa('0xc'),'fields':[_0xf2fa('0xc')]},{'name':'uniqueid','fields':[_0xf2fa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7701f4c..7d13274 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 _0xc302=['request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x3dafbc,_0x29359b){var _0x13d1e1=function(_0x25f8c4){while(--_0x25f8c4){_0x3dafbc['push'](_0x3dafbc['shift']());}};_0x13d1e1(++_0x29359b);}(_0xc302,0x17e));var _0x2c30=function(_0x2f8e57,_0x54f91a){_0x2f8e57=_0x2f8e57-0x0;var _0x5153ea=_0xc302[_0x2f8e57];return _0x5153ea;};'use strict';var _=require(_0x2c30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c30('0x2'));var db=require(_0x2c30('0x3'))['db'];var utils=require(_0x2c30('0x4'));var logger=require(_0x2c30('0x5'))('rpc');var config=require(_0x2c30('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2c30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc9dd1e,_0xb41008,_0x387f98){return new BPromise(function(_0x4c48cd,_0x3fcac2){return client[_0x2c30('0x8')](_0xc9dd1e,_0x387f98)[_0x2c30('0x9')](function(_0xf52da4){logger[_0x2c30('0xa')](_0x2c30('0xb'),_0xb41008,_0x2c30('0xc'));logger[_0x2c30('0xd')](_0x2c30('0xe'),_0xb41008,_0x2c30('0xc'),JSON[_0x2c30('0xf')](_0xf52da4));if(_0xf52da4[_0x2c30('0x10')]){if(_0xf52da4[_0x2c30('0x10')][_0x2c30('0x11')]===0x1f4){logger[_0x2c30('0x10')](_0x2c30('0xb'),_0xb41008,_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);return _0x3fcac2(_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);}logger[_0x2c30('0x10')](_0x2c30('0xb'),_0xb41008,_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);return _0x4c48cd(_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);}else{logger[_0x2c30('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0xb41008,_0x2c30('0xc'));_0x4c48cd(_0xf52da4[_0x2c30('0x13')][_0x2c30('0x12')]);}})[_0x2c30('0x14')](function(_0x24a1f2){logger[_0x2c30('0x10')](_0x2c30('0xb'),_0xb41008,_0x24a1f2);_0x3fcac2(_0x24a1f2);});});}exports[_0x2c30('0x15')]=function(_0x369dab){var _0x3b1914=this;return new Promise(function(_0x4e73d3,_0x164a24){return db[_0x2c30('0x16')][_0x2c30('0x17')](_0x369dab[_0x2c30('0x18')],{'raw':_0x369dab[_0x2c30('0x19')]?_0x369dab[_0x2c30('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2c30('0x9')](function(_0x2ed7d8){logger[_0x2c30('0xa')]('CreateCmHopperHistory',_0x369dab);logger[_0x2c30('0xd')](_0x2c30('0x15'),_0x369dab,JSON[_0x2c30('0xf')](_0x2ed7d8));_0x4e73d3(_0x2ed7d8);})['catch'](function(_0x85e21){logger[_0x2c30('0x10')](_0x2c30('0x15'),_0x85e21[_0x2c30('0x12')],_0x369dab);_0x164a24(_0x3b1914[_0x2c30('0x10')](0x1f4,_0x85e21['message']));});});};exports[_0x2c30('0x1a')]=function(_0x2cae4f){var _0x1aaddf=this;return new Promise(function(_0x15cd29,_0x15dca1){return db[_0x2c30('0x16')][_0x2c30('0x1b')]({'raw':_0x2cae4f[_0x2c30('0x19')]?_0x2cae4f[_0x2c30('0x19')][_0x2c30('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cae4f[_0x2c30('0x19')]?_0x2cae4f[_0x2c30('0x19')][_0x2c30('0x1d')]||null:null,'attributes':[[db[_0x2c30('0x1e')]['fn']('COUNT',db[_0x2c30('0x1e')][_0x2c30('0x1f')]('id')),_0x2c30('0x20')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x23')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x24')))),_0x2c30('0x25')],[db['sequelize']['fn'](_0x2c30('0x26'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')]['literal'](_0x2c30('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x2c30('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x2c30('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x2c30('0x9')](function(_0x20d889){logger['info'](_0x2c30('0x1a'),_0x2cae4f);logger[_0x2c30('0xd')](_0x2c30('0x1a'),_0x2cae4f,JSON['stringify'](_0x20d889));_0x15cd29(_0x20d889);})[_0x2c30('0x14')](function(_0x2c0cd6){logger[_0x2c30('0x10')](_0x2c30('0x1a'),_0x2c0cd6['message'],_0x2cae4f);_0x15dca1(_0x1aaddf[_0x2c30('0x10')](0x1f4,_0x2c0cd6[_0x2c30('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x11f1db){var _0x4cf056=this;return new Promise(function(_0x17d6fd,_0x238f29){return db[_0x2c30('0x16')][_0x2c30('0x1b')]({'raw':_0x11f1db[_0x2c30('0x19')]?_0x11f1db['options'][_0x2c30('0x1c')]===undefined?!![]:![]:!![],'where':_0x11f1db[_0x2c30('0x19')]?_0x11f1db['options'][_0x2c30('0x1d')]||null:null,'attributes':[[_0x2c30('0x28'),_0x2c30('0x29')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x2a')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db[_0x2c30('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x2c30('0x1e')]['fn']('COUNT',db[_0x2c30('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x2c30('0x2b')],[db[_0x2c30('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x2c')))),_0x2c30('0x2d')],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x2e')))),_0x2c30('0x2f')],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x30')))),'outboundDropCallsDayTimeout'],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2c30('0x31')))),_0x2c30('0x32')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x33')))),_0x2c30('0x34')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x35')))),_0x2c30('0x36')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x2c30('0x37')))),_0x2c30('0x38')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2c30('0x39')))),_0x2c30('0x3a')],[db[_0x2c30('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x2c30('0x3b')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')]['literal'](_0x2c30('0x3c')))),_0x2c30('0x3a')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x2c30('0x22')](_0x2c30('0x3d')))),_0x2c30('0x3e')]],'group':['campaign']})[_0x2c30('0x9')](function(_0xdde5dc){logger[_0x2c30('0xa')]('GetVoiceQueueHopperHistory',_0x11f1db);logger[_0x2c30('0xd')](_0x2c30('0x3f'),_0x11f1db,JSON[_0x2c30('0xf')](_0xdde5dc));_0x17d6fd(_0xdde5dc);})['catch'](function(_0x36a0c2){logger[_0x2c30('0x10')](_0x2c30('0x3f'),_0x36a0c2[_0x2c30('0x12')],_0x11f1db);_0x238f29(_0x4cf056[_0x2c30('0x10')](0x1f4,_0x36a0c2['message']));});});};exports[_0x2c30('0x40')]=function(_0xe4141a){var _0x3d50aa=this;return new Promise(function(_0x3d8960,_0x395af8){return db[_0x2c30('0x16')]['findAll']({'raw':_0xe4141a[_0x2c30('0x19')]?_0xe4141a[_0x2c30('0x19')][_0x2c30('0x1c')]===undefined?!![]:![]:!![],'where':_0xe4141a[_0x2c30('0x19')]?_0xe4141a[_0x2c30('0x19')][_0x2c30('0x1d')]||null:null,'attributes':[[_0x2c30('0x28'),_0x2c30('0x29')],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')][_0x2c30('0x1f')]('id')),'ivrTotalCallsDays'],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x2c30('0x28')]})[_0x2c30('0x9')](function(_0x3e9299){logger[_0x2c30('0xa')]('GetCampaignHopperHistory',_0xe4141a);logger[_0x2c30('0xd')]('GetCampaignHopperHistory',_0xe4141a,JSON['stringify'](_0x3e9299));_0x3d8960(_0x3e9299);})[_0x2c30('0x14')](function(_0x15d163){logger['error']('GetCampaignHopperHistory',_0x15d163['message'],_0xe4141a);_0x395af8(_0x3d50aa[_0x2c30('0x10')](0x1f4,_0x15d163[_0x2c30('0x12')]));});});}; \ No newline at end of file +var _0xf6a9=['raw','then','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options'];(function(_0x1540cb,_0x23bb60){var _0x34ddbf=function(_0x3d0cd9){while(--_0x3d0cd9){_0x1540cb['push'](_0x1540cb['shift']());}};_0x34ddbf(++_0x23bb60);}(_0xf6a9,0x176));var _0x9f6a=function(_0x1c119c,_0x426b2e){_0x1c119c=_0x1c119c-0x0;var _0xb472b4=_0xf6a9[_0x1c119c];return _0xb472b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f6a('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f6a('0x1'));var fs=require('fs');var Redis=require(_0x9f6a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f6a('0x3'));var logger=require(_0x9f6a('0x4'))(_0x9f6a('0x5'));var config=require(_0x9f6a('0x6'));var jayson=require(_0x9f6a('0x7'));var client=jayson[_0x9f6a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272496,_0x3c0549,_0x529af0){return new BPromise(function(_0x12b9a0,_0x39a057){return client['request'](_0x272496,_0x529af0)['then'](function(_0x3c9a34){logger[_0x9f6a('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x3c0549,_0x9f6a('0xa'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c0549,_0x9f6a('0xa'),JSON[_0x9f6a('0xb')](_0x3c9a34));if(_0x3c9a34['error']){if(_0x3c9a34[_0x9f6a('0xc')]['code']===0x1f4){logger[_0x9f6a('0xc')](_0x9f6a('0xd'),_0x3c0549,_0x3c9a34[_0x9f6a('0xc')][_0x9f6a('0xe')]);return _0x39a057(_0x3c9a34[_0x9f6a('0xc')][_0x9f6a('0xe')]);}logger['error'](_0x9f6a('0xd'),_0x3c0549,_0x3c9a34[_0x9f6a('0xc')][_0x9f6a('0xe')]);return _0x12b9a0(_0x3c9a34['error']['message']);}else{logger[_0x9f6a('0x9')](_0x9f6a('0xd'),_0x3c0549,'request\x20sent');_0x12b9a0(_0x3c9a34[_0x9f6a('0xf')][_0x9f6a('0xe')]);}})[_0x9f6a('0x10')](function(_0xc4406d){logger[_0x9f6a('0xc')](_0x9f6a('0xd'),_0x3c0549,_0xc4406d);_0x39a057(_0xc4406d);});});}exports[_0x9f6a('0x11')]=function(_0x474e16){var _0xf93c37=this;return new Promise(function(_0x168df3,_0x34c84e){return db[_0x9f6a('0x12')][_0x9f6a('0x13')](_0x474e16[_0x9f6a('0x14')],{'raw':_0x474e16[_0x9f6a('0x15')]?_0x474e16[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![]})[_0x9f6a('0x17')](function(_0x7336c7){logger[_0x9f6a('0x9')]('CreateCmHopperHistory',_0x474e16);logger[_0x9f6a('0x18')](_0x9f6a('0x11'),_0x474e16,JSON[_0x9f6a('0xb')](_0x7336c7));_0x168df3(_0x7336c7);})[_0x9f6a('0x10')](function(_0x5c245a){logger[_0x9f6a('0xc')](_0x9f6a('0x11'),_0x5c245a[_0x9f6a('0xe')],_0x474e16);_0x34c84e(_0xf93c37[_0x9f6a('0xc')](0x1f4,_0x5c245a['message']));});});};exports[_0x9f6a('0x19')]=function(_0x3d4fb3){var _0x160fa5=this;return new Promise(function(_0x4292b3,_0x4a65f5){return db['CmHopperHistory'][_0x9f6a('0x1a')]({'raw':_0x3d4fb3[_0x9f6a('0x15')]?_0x3d4fb3[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![],'where':_0x3d4fb3[_0x9f6a('0x15')]?_0x3d4fb3[_0x9f6a('0x15')][_0x9f6a('0x1b')]||null:null,'attributes':[[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')][_0x9f6a('0x1e')]('id')),_0x9f6a('0x1f')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal'](_0x9f6a('0x20')))),_0x9f6a('0x21')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x23')))),_0x9f6a('0x24')],[db[_0x9f6a('0x1c')]['fn']('COUNT',db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x25')))),_0x9f6a('0x26')],[db[_0x9f6a('0x1c')]['fn']('AVG',db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x27')))),_0x9f6a('0x28')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x29'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x2a')))),_0x9f6a('0x2b')]]})['then'](function(_0x376913){logger[_0x9f6a('0x9')](_0x9f6a('0x19'),_0x3d4fb3);logger[_0x9f6a('0x18')](_0x9f6a('0x19'),_0x3d4fb3,JSON['stringify'](_0x376913));_0x4292b3(_0x376913);})['catch'](function(_0x54328d){logger[_0x9f6a('0xc')](_0x9f6a('0x19'),_0x54328d[_0x9f6a('0xe')],_0x3d4fb3);_0x4a65f5(_0x160fa5[_0x9f6a('0xc')](0x1f4,_0x54328d[_0x9f6a('0xe')]));});});};exports[_0x9f6a('0x2c')]=function(_0x2da67c){var _0x4e0ecb=this;return new Promise(function(_0x163979,_0xc63b2){return db[_0x9f6a('0x12')][_0x9f6a('0x1a')]({'raw':_0x2da67c['options']?_0x2da67c[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![],'where':_0x2da67c['options']?_0x2da67c[_0x9f6a('0x15')][_0x9f6a('0x1b')]||null:null,'attributes':[['campaign',_0x9f6a('0x2d')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x9f6a('0x2e')],[db['sequelize']['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal'](_0x9f6a('0x2f')))),_0x9f6a('0x30')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9f6a('0x20')))),_0x9f6a('0x31')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db['sequelize']['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9f6a('0x32')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db['sequelize'][_0x9f6a('0x22')](_0x9f6a('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x9f6a('0x34')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x35')))),_0x9f6a('0x36')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db['sequelize'][_0x9f6a('0x22')](_0x9f6a('0x37')))),_0x9f6a('0x38')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal'](_0x9f6a('0x39')))),_0x9f6a('0x3a')],[db[_0x9f6a('0x1c')]['fn']('COUNT',db[_0x9f6a('0x1c')]['fn']('IF',db['sequelize'][_0x9f6a('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x9f6a('0x3b')],[db['sequelize']['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x3c')))),_0x9f6a('0x3a')],[db[_0x9f6a('0x1c')]['fn']('COUNT',db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x3d')))),_0x9f6a('0x3e')]],'group':[_0x9f6a('0x3f')]})[_0x9f6a('0x17')](function(_0x318b0c){logger[_0x9f6a('0x9')](_0x9f6a('0x2c'),_0x2da67c);logger[_0x9f6a('0x18')]('GetVoiceQueueHopperHistory',_0x2da67c,JSON[_0x9f6a('0xb')](_0x318b0c));_0x163979(_0x318b0c);})[_0x9f6a('0x10')](function(_0x2e2e6a){logger['error'](_0x9f6a('0x2c'),_0x2e2e6a[_0x9f6a('0xe')],_0x2da67c);_0xc63b2(_0x4e0ecb[_0x9f6a('0xc')](0x1f4,_0x2e2e6a[_0x9f6a('0xe')]));});});};exports[_0x9f6a('0x40')]=function(_0x5b12e6){var _0x1bbeab=this;return new Promise(function(_0x550623,_0x5070db){return db[_0x9f6a('0x12')][_0x9f6a('0x1a')]({'raw':_0x5b12e6[_0x9f6a('0x15')]?_0x5b12e6[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![],'where':_0x5b12e6[_0x9f6a('0x15')]?_0x5b12e6[_0x9f6a('0x15')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')][_0x9f6a('0x1e')]('id')),_0x9f6a('0x41')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db['sequelize']['fn']('IF',db[_0x9f6a('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x9f6a('0x17')](function(_0x27daf3){logger[_0x9f6a('0x9')]('GetCampaignHopperHistory',_0x5b12e6);logger[_0x9f6a('0x18')](_0x9f6a('0x40'),_0x5b12e6,JSON[_0x9f6a('0xb')](_0x27daf3));_0x550623(_0x27daf3);})[_0x9f6a('0x10')](function(_0x39a922){logger[_0x9f6a('0xc')](_0x9f6a('0x40'),_0x39a922[_0x9f6a('0xe')],_0x5b12e6);_0x5070db(_0x1bbeab['error'](0x1f4,_0x39a922[_0x9f6a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9ad5dd0..3a100d6 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 _0xcdf8=['show','post','create','put','/:id','update','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x2a54a9,_0x1220f0){var _0xbdea1e=function(_0xa38280){while(--_0xa38280){_0x2a54a9['push'](_0x2a54a9['shift']());}};_0xbdea1e(++_0x1220f0);}(_0xcdf8,0x84));var _0x8cdf=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xcdf8[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x8cdf('0x0'));var util=require(_0x8cdf('0x1'));var path=require('path');var timeout=require(_0x8cdf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8cdf('0x3'));var auth=require(_0x8cdf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8cdf('0x5'));var controller=require(_0x8cdf('0x6'));router['get']('/',auth[_0x8cdf('0x7')](),controller[_0x8cdf('0x8')]);router[_0x8cdf('0x9')](_0x8cdf('0xa'),auth[_0x8cdf('0x7')](),controller[_0x8cdf('0xb')]);router['get']('/:id',auth[_0x8cdf('0x7')](),controller[_0x8cdf('0xc')]);router[_0x8cdf('0xd')]('/',auth['isAuthenticated'](),controller[_0x8cdf('0xe')]);router[_0x8cdf('0xf')](_0x8cdf('0x10'),auth[_0x8cdf('0x7')](),controller[_0x8cdf('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe391=['get','/describe','isAuthenticated','describe','show','create','put','/:id','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xe391,0x1a8));var _0x1e39=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xe391[_0x2d982d];return _0x4f36b0;};'use strict';var multer=require(_0x1e39('0x0'));var util=require('util');var path=require(_0x1e39('0x1'));var timeout=require('connect-timeout');var express=require(_0x1e39('0x2'));var router=express[_0x1e39('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1e39('0x4'));var interaction=require(_0x1e39('0x5'));var config=require(_0x1e39('0x6'));var controller=require(_0x1e39('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1e39('0x8')](_0x1e39('0x9'),auth[_0x1e39('0xa')](),controller[_0x1e39('0xb')]);router[_0x1e39('0x8')]('/:id',auth[_0x1e39('0xa')](),controller[_0x1e39('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e39('0xd')]);router[_0x1e39('0xe')](_0x1e39('0xf'),auth[_0x1e39('0xa')](),controller[_0x1e39('0x10')]);module[_0x1e39('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 70612a7..3960c48 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 _0x2fda=['sequelize','name','STRING'];(function(_0x76c4f2,_0x7bcba){var _0x18547=function(_0x56dfbb){while(--_0x56dfbb){_0x76c4f2['push'](_0x76c4f2['shift']());}};_0x18547(++_0x7bcba);}(_0x2fda,0x186));var _0xa2fd=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x2fda[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0xa2fd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa2fd('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2fd('0x2')]},'dialPrefix':{'type':Sequelize[_0xa2fd('0x2')]}}; \ No newline at end of file +var _0xc999=['STRING','name','exports'];(function(_0xeccbfe,_0x46c617){var _0x5835e8=function(_0x12a329){while(--_0x12a329){_0xeccbfe['push'](_0xeccbfe['shift']());}};_0x5835e8(++_0x46c617);}(_0xc999,0x176));var _0x9c99=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0xc999[_0xcda377];return _0x1c024f;};'use strict';var Sequelize=require('sequelize');module[_0x9c99('0x0')]={'name':{'type':Sequelize[_0x9c99('0x1')],'unique':_0x9c99('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9f8a1d2..0da6b9c 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 _0x074b=['localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','reject','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','name','send','index','CmList','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','ListId','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','addColumn','cf_%s','addAgents','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x19e2a4,_0x3fc6cb){var _0x4d15a8=function(_0x319490){while(--_0x319490){_0x19e2a4['push'](_0x19e2a4['shift']());}};_0x4d15a8(++_0x3fc6cb);}(_0x074b,0x195));var _0xb074=function(_0x5da25d,_0xcad1d1){_0x5da25d=_0x5da25d-0x0;var _0x4e64ef=_0x074b[_0x5da25d];return _0x4e64ef;};'use strict';var emlformat=require(_0xb074('0x0'));var rimraf=require(_0xb074('0x1'));var zipdir=require(_0xb074('0x2'));var jsonpatch=require(_0xb074('0x3'));var rp=require(_0xb074('0x4'));var moment=require(_0xb074('0x5'));var BPromise=require(_0xb074('0x6'));var Mustache=require(_0xb074('0x7'));var util=require(_0xb074('0x8'));var path=require(_0xb074('0x9'));var sox=require('sox');var csv=require(_0xb074('0xa'));var ejs=require(_0xb074('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb074('0xc'));var squel=require(_0xb074('0xd'));var crypto=require(_0xb074('0xe'));var jsforce=require(_0xb074('0xf'));var deskjs=require(_0xb074('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb074('0x11'));var Papa=require(_0xb074('0x12'));var Redis=require(_0xb074('0x13'));var authService=require(_0xb074('0x14'));var qs=require(_0xb074('0x15'));var as=require(_0xb074('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb074('0x17'))('api');var utils=require(_0xb074('0x18'));var config=require(_0xb074('0x19'));var licenseUtil=require(_0xb074('0x1a'));var db=require(_0xb074('0x1b'))['db'];config[_0xb074('0x1c')]=_[_0xb074('0x1d')](config[_0xb074('0x1c')],{'host':_0xb074('0x1e'),'port':0x18eb});var socket=require(_0xb074('0x1f'))(new Redis(config[_0xb074('0x1c')]));require('./cmList.socket')[_0xb074('0x20')](socket);function respondWithStatusCode(_0xaaa8b9,_0x53dc73){_0x53dc73=_0x53dc73||0xcc;return function(_0x79cc9f){if(_0x79cc9f){return _0xaaa8b9['sendStatus'](_0x53dc73);}return _0xaaa8b9['status'](_0x53dc73)[_0xb074('0x21')]();};}function respondWithResult(_0x5c55ce,_0xf847f0){_0xf847f0=_0xf847f0||0xc8;return function(_0x274db5){if(_0x274db5){return _0x5c55ce[_0xb074('0x22')](_0xf847f0)[_0xb074('0x23')](_0x274db5);}};}function respondWithFilteredResult(_0x25058a,_0x53b0aa){return function(_0x3222ce){if(_0x3222ce){var _0x259843=typeof _0x53b0aa[_0xb074('0x24')]==='undefined'&&typeof _0x53b0aa[_0xb074('0x25')]===_0xb074('0x26');var _0x433a47=_0x3222ce['count'];var _0x197744=_0x259843?0x0:_0x53b0aa[_0xb074('0x24')];var _0x33d13f=_0x259843?_0x3222ce[_0xb074('0x27')]:_0x53b0aa[_0xb074('0x24')]+_0x53b0aa['limit'];var _0x4eacd1;if(_0x33d13f>=_0x433a47){_0x33d13f=_0x433a47;_0x4eacd1=0xc8;}else{_0x4eacd1=0xce;}_0x25058a['status'](_0x4eacd1);return _0x25058a['set']('Content-Range',_0x197744+'-'+_0x33d13f+'/'+_0x433a47)[_0xb074('0x23')](_0x3222ce);}return null;};}function patchUpdates(_0x540a1e){return function(_0x370e6b){try{jsonpatch['apply'](_0x370e6b,_0x540a1e,!![]);}catch(_0x50840d){return BPromise[_0xb074('0x28')](_0x50840d);}return _0x370e6b['save']();};}function saveUpdates(_0x55bd2d,_0x8f88ac){return function(_0x2d7944){if(_0x2d7944){return _0x2d7944[_0xb074('0x29')](_0x55bd2d)[_0xb074('0x2a')](function(_0x17cd29){return _0x17cd29;});}return null;};}function removeEntity(_0x81a34c,_0x5d8338){return function(_0x16fd10){if(_0x16fd10){return _0x16fd10[_0xb074('0x2b')]()[_0xb074('0x2a')](function(){var _0x3ba3b9=_0x16fd10[_0xb074('0x2c')]({'plain':!![]});var _0x5319f1=_0xb074('0x2d');return db[_0xb074('0x2e')][_0xb074('0x2b')]({'where':{'type':_0x5319f1,'resourceId':_0x3ba3b9['id']}})['then'](function(){return _0x16fd10;});})['then'](function(){_0x81a34c[_0xb074('0x22')](0xcc)[_0xb074('0x21')]();});}};}function handleEntityNotFound(_0x9d97ba,_0x3d5b64){return function(_0x51697c){if(!_0x51697c){_0x9d97ba[_0xb074('0x2f')](0x194);}return _0x51697c;};}function handleError(_0x2296c6,_0x11d0e1){_0x11d0e1=_0x11d0e1||0x1f4;return function(_0x5e94f7){logger[_0xb074('0x30')](_0x5e94f7['stack']);if(_0x5e94f7['name']){delete _0x5e94f7[_0xb074('0x31')];}_0x2296c6[_0xb074('0x22')](_0x11d0e1)[_0xb074('0x32')](_0x5e94f7);};}exports[_0xb074('0x33')]=function(_0x142164,_0x44a964){var _0x1c62c3={},_0x437d42={},_0x27bb3b={'count':0x0,'rows':[]};var _0x2ffc74=_['map'](db[_0xb074('0x34')][_0xb074('0x35')],function(_0x31ac54){return{'name':_0x31ac54['fieldName'],'type':_0x31ac54['type'][_0xb074('0x36')]};});_0x437d42[_0xb074('0x37')]=_[_0xb074('0x38')](_0x2ffc74,_0xb074('0x31'));_0x437d42[_0xb074('0x39')]=_[_0xb074('0x3a')](_0x142164[_0xb074('0x39')]);_0x437d42[_0xb074('0x3b')]=_['intersection'](_0x437d42[_0xb074('0x37')],_0x437d42[_0xb074('0x39')]);_0x1c62c3[_0xb074('0x3c')]=_[_0xb074('0x3d')](_0x437d42[_0xb074('0x37')],qs[_0xb074('0x3e')](_0x142164['query'][_0xb074('0x3e')]));_0x1c62c3['attributes']=_0x1c62c3['attributes'][_0xb074('0x3f')]?_0x1c62c3['attributes']:_0x437d42[_0xb074('0x37')];if(!_0x142164[_0xb074('0x39')][_0xb074('0x40')](_0xb074('0x41'))){_0x1c62c3[_0xb074('0x25')]=qs[_0xb074('0x25')](_0x142164[_0xb074('0x39')][_0xb074('0x25')]);_0x1c62c3[_0xb074('0x24')]=qs[_0xb074('0x24')](_0x142164[_0xb074('0x39')][_0xb074('0x24')]);}_0x1c62c3[_0xb074('0x42')]=qs['sort'](_0x142164['query']['sort']);_0x1c62c3[_0xb074('0x43')]=qs['filters'](_[_0xb074('0x44')](_0x142164[_0xb074('0x39')],_0x437d42['filters']),_0x2ffc74);if(_0x142164['query'][_0xb074('0x45')]){_0x1c62c3[_0xb074('0x43')]=_['merge'](_0x1c62c3[_0xb074('0x43')],{'$or':_[_0xb074('0x38')](_0x2ffc74,function(_0x26e7ab){if(_0x26e7ab[_0xb074('0x46')]!==_0xb074('0x47')){var _0x57fb43={};_0x57fb43[_0x26e7ab[_0xb074('0x31')]]={'$like':'%'+_0x142164['query'][_0xb074('0x45')]+'%'};return _0x57fb43;}})});}_0x1c62c3=_['merge']({},_0x1c62c3,_0x142164[_0xb074('0x48')]);var _0x1f615b={'where':_0x1c62c3[_0xb074('0x43')]};return db[_0xb074('0x34')][_0xb074('0x27')](_0x1f615b)['then'](function(_0x34e24c){_0x27bb3b[_0xb074('0x27')]=_0x34e24c;if(_0x142164['query'][_0xb074('0x49')]){_0x1c62c3[_0xb074('0x4a')]=[{'all':!![]}];}return db['CmList'][_0xb074('0x4b')](_0x1c62c3);})[_0xb074('0x2a')](function(_0x46c3f0){_0x27bb3b[_0xb074('0x4c')]=_0x46c3f0;return _0x27bb3b;})[_0xb074('0x2a')](respondWithFilteredResult(_0x44a964,_0x1c62c3))[_0xb074('0x4d')](handleError(_0x44a964,null));};exports[_0xb074('0x4e')]=function(_0x2d82ba,_0x17bb2a){var _0x59eca0={'raw':![],'where':{'id':_0x2d82ba['params']['id']}},_0xee7713={};_0xee7713[_0xb074('0x37')]=_[_0xb074('0x3a')](db[_0xb074('0x34')][_0xb074('0x35')]);_0xee7713[_0xb074('0x39')]=_[_0xb074('0x3a')](_0x2d82ba[_0xb074('0x39')]);_0xee7713[_0xb074('0x3b')]=_[_0xb074('0x3d')](_0xee7713[_0xb074('0x37')],_0xee7713['query']);_0x59eca0['attributes']=_[_0xb074('0x3d')](_0xee7713[_0xb074('0x37')],qs[_0xb074('0x3e')](_0x2d82ba[_0xb074('0x39')][_0xb074('0x3e')]));_0x59eca0['attributes']=_0x59eca0[_0xb074('0x3c')][_0xb074('0x3f')]?_0x59eca0['attributes']:_0xee7713['model'];if(_0x2d82ba[_0xb074('0x39')][_0xb074('0x49')]){_0x59eca0['include']=[{'all':!![]}];}_0x59eca0=_[_0xb074('0x4f')]({},_0x59eca0,_0x2d82ba[_0xb074('0x48')]);return db['CmList'][_0xb074('0x50')](_0x59eca0)[_0xb074('0x2a')](handleEntityNotFound(_0x17bb2a,null))[_0xb074('0x2a')](respondWithResult(_0x17bb2a,null))['catch'](handleError(_0x17bb2a,null));};exports[_0xb074('0x51')]=function(_0x178bca,_0x157d93){return db[_0xb074('0x34')][_0xb074('0x51')](_0x178bca[_0xb074('0x52')],{})[_0xb074('0x2a')](function(_0x5537ee){var _0x4607ed=_0x178bca[_0xb074('0x53')][_0xb074('0x2c')]({'plain':!![]});if(!_0x4607ed)throw new Error(_0xb074('0x54'));if(_0x4607ed['role']===_0xb074('0x53')){var _0x113086=_0x5537ee[_0xb074('0x2c')]({'plain':!![]});var _0x14b599='Lists';return db[_0xb074('0x55')][_0xb074('0x50')]({'where':{'name':_0x14b599,'userProfileId':_0x4607ed[_0xb074('0x56')]},'raw':!![]})[_0xb074('0x2a')](function(_0x338f3c){if(_0x338f3c&&_0x338f3c[_0xb074('0x57')]===0x0){return db[_0xb074('0x2e')][_0xb074('0x51')]({'name':_0x113086[_0xb074('0x31')],'resourceId':_0x113086['id'],'type':_0x338f3c['name'],'sectionId':_0x338f3c['id']},{})[_0xb074('0x2a')](function(){return _0x5537ee;});}else{return _0x5537ee;}})[_0xb074('0x4d')](function(_0x143e3e){logger[_0xb074('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x143e3e);throw _0x143e3e;});}return _0x5537ee;})['then'](respondWithResult(_0x157d93,0xc9))['catch'](handleError(_0x157d93,null));};exports[_0xb074('0x29')]=function(_0xb9ce2f,_0x3ced61){if(_0xb9ce2f[_0xb074('0x52')]['id']){delete _0xb9ce2f[_0xb074('0x52')]['id'];}return db[_0xb074('0x34')][_0xb074('0x50')]({'where':{'id':_0xb9ce2f[_0xb074('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ced61,null))[_0xb074('0x2a')](saveUpdates(_0xb9ce2f[_0xb074('0x52')],null))[_0xb074('0x2a')](respondWithResult(_0x3ced61,null))[_0xb074('0x4d')](handleError(_0x3ced61,null));};exports[_0xb074('0x2b')]=function(_0x12e420,_0x3beca9){return db[_0xb074('0x34')][_0xb074('0x50')]({'where':{'id':_0x12e420[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x3beca9,null))[_0xb074('0x2a')](removeEntity(_0x3beca9,null))[_0xb074('0x4d')](handleError(_0x3beca9,null));};exports['describe']=function(_0x45e64f,_0x2a134a){return db['CmList'][_0xb074('0x59')]()[_0xb074('0x2a')](respondWithResult(_0x2a134a,null))[_0xb074('0x4d')](handleError(_0x2a134a,null));};exports[_0xb074('0x5a')]=function(_0x27e95b,_0x3b24c3,_0x5395d2){if(_0x27e95b[_0xb074('0x52')]['id']){delete _0x27e95b[_0xb074('0x52')]['id'];}return db[_0xb074('0x34')]['find']({'where':{'id':_0x27e95b[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x3b24c3,null))[_0xb074('0x2a')](function(_0x422b1b){if(_0x422b1b){_0x27e95b[_0xb074('0x52')]['ListId']=_0x422b1b['id'];return db[_0xb074('0x5b')][_0xb074('0x51')](_0x27e95b['body']);}})[_0xb074('0x2a')](respondWithResult(_0x3b24c3,null))['catch'](handleError(_0x3b24c3,null));};exports[_0xb074('0x5c')]=function(_0x2183cd,_0x4e01d0,_0x3ebe4a){var _0x631678={'raw':![],'where':{}};var _0x28c724={};var _0x5d9e0a={'count':0x0,'rows':[]};return db['CmList'][_0xb074('0x5d')]({'where':{'id':_0x2183cd[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x4e01d0,null))[_0xb074('0x2a')](function(_0x1b0cca){if(_0x1b0cca){_0x28c724[_0xb074('0x37')]=_['keys'](db[_0xb074('0x5b')][_0xb074('0x35')]);_0x28c724[_0xb074('0x39')]=_[_0xb074('0x3a')](_0x2183cd[_0xb074('0x39')]);_0x28c724[_0xb074('0x3b')]=_[_0xb074('0x3d')](_0x28c724[_0xb074('0x37')],_0x28c724[_0xb074('0x39')]);_0x631678['attributes']=_[_0xb074('0x3d')](_0x28c724[_0xb074('0x37')],qs['fields'](_0x2183cd['query'][_0xb074('0x3e')]));_0x631678[_0xb074('0x3c')]=_0x631678[_0xb074('0x3c')][_0xb074('0x3f')]?_0x631678[_0xb074('0x3c')]:_0x28c724[_0xb074('0x37')];if(!_0x2183cd[_0xb074('0x39')][_0xb074('0x40')]('nolimit')){_0x631678[_0xb074('0x25')]=qs['limit'](_0x2183cd[_0xb074('0x39')][_0xb074('0x25')]);_0x631678[_0xb074('0x24')]=qs[_0xb074('0x24')](_0x2183cd[_0xb074('0x39')][_0xb074('0x24')]);}_0x631678['order']=qs[_0xb074('0x5e')](_0x2183cd[_0xb074('0x39')]['sort']);_0x631678[_0xb074('0x43')]=qs[_0xb074('0x3b')](_[_0xb074('0x44')](_0x2183cd[_0xb074('0x39')],_0x28c724[_0xb074('0x3b')]));_0x631678[_0xb074('0x43')]['ListId']=_0x1b0cca['id'];if(_0x2183cd[_0xb074('0x39')][_0xb074('0x45')]){_0x631678[_0xb074('0x43')]=_[_0xb074('0x4f')](_0x631678[_0xb074('0x43')],{'$or':_[_0xb074('0x38')](_0x631678['attributes'],function(_0x4df17c){var _0x4dcc45={};_0x4dcc45[_0x4df17c]={'$like':'%'+_0x2183cd['query'][_0xb074('0x45')]+'%'};return _0x4dcc45;})});}_0x631678=_[_0xb074('0x4f')]({},_0x631678,_0x2183cd[_0xb074('0x48')]);return db[_0xb074('0x5b')][_0xb074('0x27')]({'where':_0x631678['where']})[_0xb074('0x2a')](function(_0x374504){_0x5d9e0a[_0xb074('0x27')]=_0x374504;if(_0x2183cd['query'][_0xb074('0x49')]){_0x631678[_0xb074('0x4a')]=[{'all':!![]}];}return db[_0xb074('0x5b')][_0xb074('0x4b')](_0x631678);})[_0xb074('0x2a')](function(_0x339a7c){_0x5d9e0a[_0xb074('0x4c')]=_0x339a7c;return _0x5d9e0a;});}})[_0xb074('0x2a')](respondWithFilteredResult(_0x4e01d0,_0x631678))[_0xb074('0x4d')](handleError(_0x4e01d0,null));};exports['removeDispositions']=function(_0x2c76a9,_0x2b94ef,_0x1980dc){return db[_0xb074('0x34')][_0xb074('0x50')]({'where':{'id':_0x2c76a9[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x2b94ef,null))['then'](function(_0x287f60){if(_0x287f60){return _0x287f60[_0xb074('0x5f')](_0x2c76a9['query'][_0xb074('0x60')]);}})[_0xb074('0x2a')](respondWithStatusCode(_0x2b94ef,null))[_0xb074('0x4d')](handleError(_0x2b94ef,null));};exports[_0xb074('0x61')]=function(_0x18171c,_0x15764b,_0x47b70c){return db['CmList'][_0xb074('0x50')]({'where':{'id':_0x18171c['params']['id']}})['then'](handleEntityNotFound(_0x15764b,null))['then'](function(_0x538d0b){if(_0x538d0b){var _0x498e34=[];var _0x294a03={'success':[],'errors':[]};return db[_0xb074('0x62')]['describe']()[_0xb074('0x2a')](function(_0x1c58d8){if(_0x18171c['body'][_0xb074('0x63')]&&_[_0xb074('0x64')](_0x18171c[_0xb074('0x52')]['tags'])){if(_0x18171c[_0xb074('0x52')][_0xb074('0x63')]['length']){_0x18171c['body'][_0xb074('0x63')]=_0x18171c[_0xb074('0x52')][_0xb074('0x63')][_0xb074('0x65')](';')+';';}else{_0x18171c[_0xb074('0x52')][_0xb074('0x63')]=null;}}else{_0x18171c[_0xb074('0x52')]['tags']=null;}if(_0x18171c[_0xb074('0x52')]&&_['isArray'](_0x18171c[_0xb074('0x52')])){for(var _0x52c9b3=0x0;_0x52c9b3<_0x18171c[_0xb074('0x52')][_0xb074('0x3f')];_0x52c9b3+=0x1){_0x18171c[_0xb074('0x52')][_0x52c9b3][_0xb074('0x66')]=_0x18171c[_0xb074('0x58')]['id'];_0x498e34[_0xb074('0x67')](_0x18171c['body'][_0x52c9b3]);}return BPromise[_0xb074('0x68')](_0x498e34,function(_0x23758a){return db['CmContact']['create'](_[_0xb074('0x69')](_0x23758a,[_0xb074('0x60'),'id'])||{},{'fields':_[_0xb074('0x3a')](_0x1c58d8),'raw':!![]})[_0xb074('0x2a')](function(_0x3b8a7b){_0x294a03['success'][_0xb074('0x67')](_0x3b8a7b[_0xb074('0x6a')]);})['catch'](function(_0x48579c){_0x294a03[_0xb074('0x6b')][_0xb074('0x67')]({'data':_0x23758a,'error':_0x48579c[_0xb074('0x6c')]});});})[_0xb074('0x2a')](function(_0xbdd685){return _0x294a03;})[_0xb074('0x4d')](function(_0x48cc2c){return _0x48cc2c;});}else{_0x15764b['status'](0x190)[_0xb074('0x23')]({'message':_0xb074('0x6d')});}});}})[_0xb074('0x2a')](respondWithResult(_0x15764b,null))[_0xb074('0x4d')](handleError(_0x15764b,null));};exports['getContacts']=function(_0x3c55ee,_0x2e2995,_0x2aca43){var _0x59139f;return db[_0xb074('0x34')][_0xb074('0x50')]({'where':{'id':_0x3c55ee[_0xb074('0x58')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb074('0x6e')}]})['then'](handleEntityNotFound(_0x2e2995,null))['then'](function(_0x52bcfb){if(_0x52bcfb){_0x59139f=_0x52bcfb;return db[_0xb074('0x62')][_0xb074('0x35')];}})['then'](function(_0x4f2e3a){if(_0x4f2e3a){var _0x5333ee={};var _0x301fc2={};_0x301fc2[_0xb074('0x37')]=_[_0xb074('0x6f')](_[_0xb074('0x3a')](_0x4f2e3a),_[_0xb074('0x38')](_0x59139f['CustomFields'],function(_0x2d2b52){return util[_0xb074('0x70')](_0xb074('0x71'),_0x2d2b52['id']);}));_0x301fc2[_0xb074('0x39')]=_[_0xb074('0x3a')](_0x3c55ee[_0xb074('0x39')]);_0x301fc2[_0xb074('0x3b')]=_['intersection'](_0x301fc2[_0xb074('0x37')],_0x301fc2[_0xb074('0x39')]);_0x5333ee[_0xb074('0x3c')]=_[_0xb074('0x3d')](_0x301fc2[_0xb074('0x37')],qs[_0xb074('0x3e')](_0x3c55ee['query'][_0xb074('0x3e')]));_0x5333ee[_0xb074('0x3c')]=_0x5333ee[_0xb074('0x3c')][_0xb074('0x3f')]?_0x5333ee[_0xb074('0x3c')]:_0x301fc2[_0xb074('0x37')];if(!_0x3c55ee[_0xb074('0x39')][_0xb074('0x40')](_0xb074('0x41'))){_0x5333ee['limit']=qs['limit'](_0x3c55ee[_0xb074('0x39')][_0xb074('0x25')]);_0x5333ee['offset']=qs['offset'](_0x3c55ee['query'][_0xb074('0x24')]);}_0x5333ee[_0xb074('0x42')]=qs[_0xb074('0x5e')](_0x3c55ee[_0xb074('0x39')][_0xb074('0x5e')]);_0x5333ee[_0xb074('0x43')]=qs[_0xb074('0x3b')](_[_0xb074('0x44')](_0x3c55ee[_0xb074('0x39')],_0x301fc2[_0xb074('0x3b')]));_0x5333ee[_0xb074('0x72')]=!![];if(_0x3c55ee[_0xb074('0x39')][_0xb074('0x45')]){_0x5333ee['where']=_[_0xb074('0x4f')](_0x5333ee[_0xb074('0x43')],{'$or':_['map'](_0x5333ee['attributes'],function(_0x33c0e9){var _0x5a8007={};_0x5a8007[_0x33c0e9]={'$like':'%'+_0x3c55ee[_0xb074('0x39')][_0xb074('0x45')]+'%'};return _0x5a8007;})});}_0x5333ee=_[_0xb074('0x4f')]({},_0x5333ee,_0x3c55ee['options']);return _0x59139f[_0xb074('0x73')](_0x5333ee);}})[_0xb074('0x2a')](respondWithResult(_0x2e2995,null))[_0xb074('0x4d')](handleError(_0x2e2995,null));};exports[_0xb074('0x74')]=function(_0x2600b7,_0x552b4b,_0x371d70){var _0x4b79b1;return db['CmList'][_0xb074('0x50')]({'where':{'id':_0x2600b7[_0xb074('0x58')]['id']},'include':[{'model':db[_0xb074('0x75')],'as':_0xb074('0x6e')}]})['then'](handleEntityNotFound(_0x552b4b,null))[_0xb074('0x2a')](function(_0x20e67a){if(_0x20e67a){_0x4b79b1=_0x20e67a;return db['CmContact'][_0xb074('0x35')];}})[_0xb074('0x2a')](function(_0x2c3f03){if(_0x2c3f03){var _0x3cf71e={};var _0x4dd0f3={};_0x4dd0f3['model']=_[_0xb074('0x6f')](_['keys'](_0x2c3f03),_[_0xb074('0x38')](_0x4b79b1['CustomFields'],function(_0x56b48a){return util[_0xb074('0x70')](_0xb074('0x71'),_0x56b48a['id']);}));_0x4dd0f3[_0xb074('0x39')]=_[_0xb074('0x3a')](_0x2600b7[_0xb074('0x39')]);_0x4dd0f3[_0xb074('0x3b')]=_[_0xb074('0x3d')](_0x4dd0f3['model'],_0x4dd0f3[_0xb074('0x39')]);_0x3cf71e['attributes']=_[_0xb074('0x3d')](_0x4dd0f3['model'],qs[_0xb074('0x3e')](_0x2600b7[_0xb074('0x39')][_0xb074('0x3e')]));_0x3cf71e[_0xb074('0x3c')]=_0x3cf71e[_0xb074('0x3c')][_0xb074('0x3f')]?_0x3cf71e[_0xb074('0x3c')]:_0x4dd0f3[_0xb074('0x37')];if(!_0x2600b7['query'][_0xb074('0x40')]('nolimit')){_0x3cf71e[_0xb074('0x25')]=qs[_0xb074('0x25')](_0x2600b7[_0xb074('0x39')][_0xb074('0x25')]);_0x3cf71e['offset']=qs['offset'](_0x2600b7[_0xb074('0x39')]['offset']);}_0x3cf71e[_0xb074('0x42')]=qs[_0xb074('0x5e')](_0x2600b7[_0xb074('0x39')][_0xb074('0x5e')]);_0x3cf71e['where']=qs[_0xb074('0x3b')](_[_0xb074('0x44')](_0x2600b7[_0xb074('0x39')],_0x4dd0f3[_0xb074('0x3b')]));_0x3cf71e[_0xb074('0x72')]=!![];if(_0x2600b7['query'][_0xb074('0x45')]){_0x3cf71e[_0xb074('0x43')]=_[_0xb074('0x4f')](_0x3cf71e[_0xb074('0x43')],{'$or':_['map'](_0x3cf71e[_0xb074('0x3c')],function(_0x7bb5b8){var _0x3a8426={};_0x3a8426[_0x7bb5b8]={'$like':'%'+_0x2600b7[_0xb074('0x39')]['filter']+'%'};return _0x3a8426;})});}_0x3cf71e=_[_0xb074('0x4f')]({},_0x3cf71e,_0x2600b7['options']);return _0x4b79b1[_0xb074('0x73')](_0x3cf71e);}})[_0xb074('0x2a')](function(_0xfca5c3){if(!_[_0xb074('0x76')](_0xfca5c3)){var _0x3b4fc9=toCsv(_0xfca5c3);var _0x33aab3=Date[_0xb074('0x77')]();fs[_0xb074('0x78')](util[_0xb074('0x70')](_0xb074('0x79'),_0x4b79b1['id'],_0x33aab3),_0x3b4fc9);_0x552b4b[_0xb074('0x7a')]('Content-disposition',_0xb074('0x7b')+util[_0xb074('0x70')](_0xb074('0x7c'),_0x4b79b1['id'],_0x33aab3));_0x552b4b[_0xb074('0x7a')](_0xb074('0x7d'),'text/csv');return _0x552b4b[_0xb074('0x7e')](util[_0xb074('0x70')](_0xb074('0x79'),_0x4b79b1['id'],_0x33aab3));}else{return _0x552b4b[_0xb074('0x2f')](0xcc);}})[_0xb074('0x4d')](handleError(_0x552b4b,null));};exports[_0xb074('0x7f')]=function(_0x3defb0,_0x45f6d8,_0x40ff35){var _0x3e252e;delete _0x3defb0[_0xb074('0x52')]['id'];return db[_0xb074('0x34')][_0xb074('0x5d')]({'where':{'id':_0x3defb0[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x45f6d8,null))[_0xb074('0x2a')](function(_0x5f53b4){if(_0x5f53b4){return db[_0xb074('0x80')][_0xb074('0x81')](function(_0x5bc8c2){return db[_0xb074('0x75')][_0xb074('0x51')](_0x3defb0[_0xb074('0x52')],{'transaction':_0x5bc8c2})['then'](function(_0x7163d9){_0x3e252e=_0x7163d9;return _0x5f53b4[_0xb074('0x82')](_0x7163d9,{'transaction':_0x5bc8c2});})[_0xb074('0x2a')](function(){var _0x56f702={'type':db[_0xb074('0x83')][_0xb074('0x84')],'transaction':_0x5bc8c2};switch(_0x3defb0['body']['type']){case'text':_0x56f702[_0xb074('0x46')]=db[_0xb074('0x83')][_0xb074('0x84')];break;case _0xb074('0x85'):_0x56f702[_0xb074('0x46')]=db['Sequelize'][_0xb074('0x86')];break;case _0xb074('0x87'):_0x56f702['type']=db[_0xb074('0x83')][_0xb074('0x88')];_0x56f702['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0xb074('0x89')]('cm_contacts',util['format'](_0xb074('0x8a'),_0x3e252e['id']),_0x56f702);})[_0xb074('0x2a')](function(){return _0x3e252e;});});}})['then'](respondWithResult(_0x45f6d8,null))[_0xb074('0x4d')](handleError(_0x45f6d8,null));};exports['getCustomFields']=function(_0x45ce00,_0x2d5e30,_0x423c37){var _0x4688c0={};var _0x392941={};var _0x5896ab;var _0x1a236b;return db[_0xb074('0x34')]['findOne']({'where':{'id':_0x45ce00[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x2d5e30,null))[_0xb074('0x2a')](function(_0x54d4df){if(_0x54d4df){_0x5896ab=_0x54d4df;_0x392941[_0xb074('0x37')]=_['keys'](db[_0xb074('0x75')]['rawAttributes']);_0x392941['query']=_[_0xb074('0x3a')](_0x45ce00[_0xb074('0x39')]);_0x392941['filters']=_[_0xb074('0x3d')](_0x392941['model'],_0x392941[_0xb074('0x39')]);_0x4688c0[_0xb074('0x3c')]=_['intersection'](_0x392941['model'],qs[_0xb074('0x3e')](_0x45ce00[_0xb074('0x39')][_0xb074('0x3e')]));_0x4688c0[_0xb074('0x3c')]=_0x4688c0[_0xb074('0x3c')][_0xb074('0x3f')]?_0x4688c0[_0xb074('0x3c')]:_0x392941[_0xb074('0x37')];_0x4688c0['order']=qs[_0xb074('0x5e')](_0x45ce00[_0xb074('0x39')]['sort']);_0x4688c0[_0xb074('0x43')]=qs[_0xb074('0x3b')](_['pick'](_0x45ce00[_0xb074('0x39')],_0x392941[_0xb074('0x3b')]));_0x4688c0[_0xb074('0x43')]=_[_0xb074('0x4f')](_0x4688c0[_0xb074('0x43')],{'$or':[{'ListId':_0x54d4df['id']},{'ListId':null}]});if(_0x45ce00[_0xb074('0x39')]['filter']){_0x4688c0[_0xb074('0x43')]=_[_0xb074('0x4f')](_0x4688c0['where'],{'$or':_[_0xb074('0x38')](_0x4688c0[_0xb074('0x3c')],function(_0x107cdd){var _0x3e9949={};_0x3e9949[_0x107cdd]={'$like':'%'+_0x45ce00[_0xb074('0x39')]['filter']+'%'};return _0x3e9949;})});}_0x4688c0=_[_0xb074('0x4f')]({},_0x4688c0,_0x45ce00[_0xb074('0x48')]);return db[_0xb074('0x75')]['findAndCountAll'](_0x4688c0);}})[_0xb074('0x2a')](respondWithResult(_0x2d5e30,null))[_0xb074('0x4d')](handleError(_0x2d5e30,null));};exports[_0xb074('0x8b')]=function(_0x2cc29b,_0x564f30,_0x1f80eb){return db['CmList'][_0xb074('0x50')]({'where':{'id':_0x2cc29b[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x564f30,null))['then'](function(_0x12baed){if(_0x12baed){return _0x12baed['addAgents'](_0x2cc29b[_0xb074('0x52')][_0xb074('0x60')],_['omit'](_0x2cc29b[_0xb074('0x52')],[_0xb074('0x60'),'id'])||{})['spread'](function(_0x30ab59){for(var _0x2afe50=0x0;_0x2afe50<_0x2cc29b[_0xb074('0x52')]['ids'][_0xb074('0x3f')];_0x2afe50+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x2cc29b['body'][_0xb074('0x60')][_0x2afe50]),'CmListId':Number(_0x2cc29b[_0xb074('0x58')]['id'])});}return _0x30ab59;});}})[_0xb074('0x2a')](respondWithResult(_0x564f30,null))[_0xb074('0x4d')](handleError(_0x564f30,null));};exports['removeAgents']=function(_0xe34ed7,_0x4efe1b,_0x2a73b8){return db[_0xb074('0x34')][_0xb074('0x50')]({'where':{'id':_0xe34ed7[_0xb074('0x58')]['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x4efe1b,null))[_0xb074('0x2a')](function(_0xcc2f7b){if(_0xcc2f7b){return _0xcc2f7b[_0xb074('0x8c')](_0xe34ed7[_0xb074('0x39')]['ids'])[_0xb074('0x2a')](function(){if(_[_0xb074('0x64')](_0xe34ed7[_0xb074('0x39')]['ids'])){for(var _0x53cb49=0x0;_0x53cb49<_0xe34ed7['query']['ids'][_0xb074('0x3f')];_0x53cb49+=0x1){socket[_0xb074('0x8d')](_0xb074('0x8e'),{'UserId':Number(_0xe34ed7[_0xb074('0x39')][_0xb074('0x60')][_0x53cb49]),'CmListId':Number(_0xe34ed7[_0xb074('0x58')]['id'])});}}else{socket[_0xb074('0x8d')]('userCmList:remove',{'UserId':Number(_0xe34ed7[_0xb074('0x39')][_0xb074('0x60')]),'CmListId':Number(_0xe34ed7['params']['id'])});}});}})[_0xb074('0x2a')](respondWithStatusCode(_0x4efe1b,null))['catch'](handleError(_0x4efe1b,null));};exports[_0xb074('0x8f')]=function(_0x141aed,_0x3f7af5,_0xf4f13e){var _0x2195a5={};var _0x55f3d7={};var _0x4172b9;var _0x407aba;return db[_0xb074('0x34')][_0xb074('0x5d')]({'where':{'id':_0x141aed['params']['id']}})[_0xb074('0x2a')](handleEntityNotFound(_0x3f7af5,null))['then'](function(_0x25727e){if(_0x25727e){_0x4172b9=_0x25727e;_0x55f3d7[_0xb074('0x37')]=_[_0xb074('0x3a')](db[_0xb074('0x90')][_0xb074('0x35')]);_0x55f3d7['query']=_[_0xb074('0x3a')](_0x141aed['query']);_0x55f3d7[_0xb074('0x3b')]=_['intersection'](_0x55f3d7[_0xb074('0x37')],_0x55f3d7[_0xb074('0x39')]);_0x2195a5[_0xb074('0x3c')]=_['intersection'](_0x55f3d7[_0xb074('0x37')],qs['fields'](_0x141aed[_0xb074('0x39')][_0xb074('0x3e')]));_0x2195a5[_0xb074('0x3c')]=_0x2195a5['attributes']['length']?_0x2195a5[_0xb074('0x3c')]:_0x55f3d7[_0xb074('0x37')];_0x2195a5[_0xb074('0x42')]=qs[_0xb074('0x5e')](_0x141aed['query'][_0xb074('0x5e')]);_0x2195a5[_0xb074('0x43')]=qs[_0xb074('0x3b')](_[_0xb074('0x44')](_0x141aed[_0xb074('0x39')],_0x55f3d7[_0xb074('0x3b')]));if(_0x141aed[_0xb074('0x39')]['filter']){_0x2195a5[_0xb074('0x43')]=_[_0xb074('0x4f')](_0x2195a5[_0xb074('0x43')],{'$or':_[_0xb074('0x38')](_0x2195a5[_0xb074('0x3c')],function(_0x17155e){var _0x4fe122={};_0x4fe122[_0x17155e]={'$like':'%'+_0x141aed[_0xb074('0x39')][_0xb074('0x45')]+'%'};return _0x4fe122;})});}_0x2195a5=_[_0xb074('0x4f')]({},_0x2195a5,_0x141aed['options']);return _0x4172b9[_0xb074('0x8f')](_0x2195a5);}})[_0xb074('0x2a')](function(_0x5797a9){if(_0x5797a9){_0x407aba=_0x5797a9[_0xb074('0x3f')];if(!_0x141aed['query'][_0xb074('0x40')](_0xb074('0x41'))){_0x2195a5[_0xb074('0x25')]=qs[_0xb074('0x25')](_0x141aed[_0xb074('0x39')][_0xb074('0x25')]);_0x2195a5[_0xb074('0x24')]=qs[_0xb074('0x24')](_0x141aed['query'][_0xb074('0x24')]);}return _0x4172b9[_0xb074('0x8f')](_0x2195a5);}})[_0xb074('0x2a')](function(_0xdf4aa5){if(_0xdf4aa5){return _0xdf4aa5?{'count':_0x407aba,'rows':_0xdf4aa5}:null;}})['then'](respondWithResult(_0x3f7af5,null))[_0xb074('0x4d')](handleError(_0x3f7af5,null));}; \ No newline at end of file +var _0x3fec=['request-promise','bluebird','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmList','includeAll','rows','catch','show','params','length','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','order','findAll','removeDispositions','ids','addContacts','tags','isArray','join','each','CmContact','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','fast-json-patch'];(function(_0x1982cc,_0x1fc213){var _0x974ce6=function(_0x41314b){while(--_0x41314b){_0x1982cc['push'](_0x1982cc['shift']());}};_0x974ce6(++_0x1fc213);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc3fe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3fe('0x1'));var rp=require(_0xc3fe('0x2'));var moment=require('moment');var BPromise=require(_0xc3fe('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc3fe('0x4'));var sox=require('sox');var csv=require(_0xc3fe('0x5'));var ejs=require(_0xc3fe('0x6'));var fs=require('fs');var fs_extra=require(_0xc3fe('0x7'));var _=require(_0xc3fe('0x8'));var squel=require(_0xc3fe('0x9'));var crypto=require(_0xc3fe('0xa'));var jsforce=require(_0xc3fe('0xb'));var deskjs=require(_0xc3fe('0xc'));var toCsv=require(_0xc3fe('0x5'));var querystring=require(_0xc3fe('0xd'));var Papa=require(_0xc3fe('0xe'));var Redis=require(_0xc3fe('0xf'));var authService=require(_0xc3fe('0x10'));var qs=require(_0xc3fe('0x11'));var as=require(_0xc3fe('0x12'));var hardwareService=require(_0xc3fe('0x13'));var logger=require('../../config/logger')(_0xc3fe('0x14'));var utils=require(_0xc3fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc3fe('0x16'));var db=require(_0xc3fe('0x17'))['db'];config[_0xc3fe('0x18')]=_[_0xc3fe('0x19')](config[_0xc3fe('0x18')],{'host':_0xc3fe('0x1a'),'port':0x18eb});var socket=require(_0xc3fe('0x1b'))(new Redis(config[_0xc3fe('0x18')]));require(_0xc3fe('0x1c'))[_0xc3fe('0x1d')](socket);function respondWithStatusCode(_0x4b8088,_0x400476){_0x400476=_0x400476||0xcc;return function(_0x531fa5){if(_0x531fa5){return _0x4b8088[_0xc3fe('0x1e')](_0x400476);}return _0x4b8088[_0xc3fe('0x1f')](_0x400476)[_0xc3fe('0x20')]();};}function respondWithResult(_0x25ce78,_0x17edb6){_0x17edb6=_0x17edb6||0xc8;return function(_0x39705c){if(_0x39705c){return _0x25ce78[_0xc3fe('0x1f')](_0x17edb6)[_0xc3fe('0x21')](_0x39705c);}};}function respondWithFilteredResult(_0x3405dc,_0x8d0835){return function(_0x376fff){if(_0x376fff){var _0x442fbd=typeof _0x8d0835[_0xc3fe('0x22')]===_0xc3fe('0x23')&&typeof _0x8d0835[_0xc3fe('0x24')]==='undefined';var _0x2ce44e=_0x376fff[_0xc3fe('0x25')];var _0x3b895e=_0x442fbd?0x0:_0x8d0835['offset'];var _0x1e3242=_0x442fbd?_0x376fff[_0xc3fe('0x25')]:_0x8d0835['offset']+_0x8d0835['limit'];var _0x3333ad;if(_0x1e3242>=_0x2ce44e){_0x1e3242=_0x2ce44e;_0x3333ad=0xc8;}else{_0x3333ad=0xce;}_0x3405dc[_0xc3fe('0x1f')](_0x3333ad);return _0x3405dc[_0xc3fe('0x26')]('Content-Range',_0x3b895e+'-'+_0x1e3242+'/'+_0x2ce44e)[_0xc3fe('0x21')](_0x376fff);}return null;};}function patchUpdates(_0x15706a){return function(_0x3f9418){try{jsonpatch[_0xc3fe('0x27')](_0x3f9418,_0x15706a,!![]);}catch(_0x2a6635){return BPromise[_0xc3fe('0x28')](_0x2a6635);}return _0x3f9418[_0xc3fe('0x29')]();};}function saveUpdates(_0x6b57a6,_0x2c4727){return function(_0x30657f){if(_0x30657f){return _0x30657f[_0xc3fe('0x2a')](_0x6b57a6)[_0xc3fe('0x2b')](function(_0x4da635){return _0x4da635;});}return null;};}function removeEntity(_0x3220e7,_0x1caee8){return function(_0x1d3c16){if(_0x1d3c16){return _0x1d3c16[_0xc3fe('0x2c')]()[_0xc3fe('0x2b')](function(){var _0x5672b9=_0x1d3c16[_0xc3fe('0x2d')]({'plain':!![]});var _0x431594=_0xc3fe('0x2e');return db[_0xc3fe('0x2f')][_0xc3fe('0x2c')]({'where':{'type':_0x431594,'resourceId':_0x5672b9['id']}})[_0xc3fe('0x2b')](function(){return _0x1d3c16;});})[_0xc3fe('0x2b')](function(){_0x3220e7[_0xc3fe('0x1f')](0xcc)[_0xc3fe('0x20')]();});}};}function handleEntityNotFound(_0xd2b14d,_0x391167){return function(_0x17fe31){if(!_0x17fe31){_0xd2b14d[_0xc3fe('0x1e')](0x194);}return _0x17fe31;};}function handleError(_0x499b99,_0x165734){_0x165734=_0x165734||0x1f4;return function(_0x1339e7){logger[_0xc3fe('0x30')](_0x1339e7[_0xc3fe('0x31')]);if(_0x1339e7['name']){delete _0x1339e7[_0xc3fe('0x32')];}_0x499b99[_0xc3fe('0x1f')](_0x165734)[_0xc3fe('0x33')](_0x1339e7);};}exports[_0xc3fe('0x34')]=function(_0x11a44e,_0x293999){var _0x3f4573={},_0x28fc3b={},_0x6fe063={'count':0x0,'rows':[]};var _0x357db9=_[_0xc3fe('0x35')](db['CmList']['rawAttributes'],function(_0x4aadda){return{'name':_0x4aadda[_0xc3fe('0x36')],'type':_0x4aadda[_0xc3fe('0x37')]['key']};});_0x28fc3b[_0xc3fe('0x38')]=_[_0xc3fe('0x35')](_0x357db9,'name');_0x28fc3b['query']=_[_0xc3fe('0x39')](_0x11a44e[_0xc3fe('0x3a')]);_0x28fc3b[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x28fc3b['model'],_0x28fc3b['query']);_0x3f4573[_0xc3fe('0x3d')]=_[_0xc3fe('0x3c')](_0x28fc3b[_0xc3fe('0x38')],qs[_0xc3fe('0x3e')](_0x11a44e['query'][_0xc3fe('0x3e')]));_0x3f4573['attributes']=_0x3f4573[_0xc3fe('0x3d')]['length']?_0x3f4573[_0xc3fe('0x3d')]:_0x28fc3b[_0xc3fe('0x38')];if(!_0x11a44e['query'][_0xc3fe('0x3f')](_0xc3fe('0x40'))){_0x3f4573['limit']=qs[_0xc3fe('0x24')](_0x11a44e['query'][_0xc3fe('0x24')]);_0x3f4573[_0xc3fe('0x22')]=qs[_0xc3fe('0x22')](_0x11a44e[_0xc3fe('0x3a')][_0xc3fe('0x22')]);}_0x3f4573['order']=qs[_0xc3fe('0x41')](_0x11a44e[_0xc3fe('0x3a')][_0xc3fe('0x41')]);_0x3f4573[_0xc3fe('0x42')]=qs[_0xc3fe('0x3b')](_[_0xc3fe('0x43')](_0x11a44e[_0xc3fe('0x3a')],_0x28fc3b['filters']),_0x357db9);if(_0x11a44e[_0xc3fe('0x3a')][_0xc3fe('0x44')]){_0x3f4573[_0xc3fe('0x42')]=_[_0xc3fe('0x45')](_0x3f4573[_0xc3fe('0x42')],{'$or':_[_0xc3fe('0x35')](_0x357db9,function(_0x1031f6){if(_0x1031f6['type']!=='VIRTUAL'){var _0xe01dbb={};_0xe01dbb[_0x1031f6['name']]={'$like':'%'+_0x11a44e['query'][_0xc3fe('0x44')]+'%'};return _0xe01dbb;}})});}_0x3f4573=_[_0xc3fe('0x45')]({},_0x3f4573,_0x11a44e[_0xc3fe('0x46')]);var _0x16f11b={'where':_0x3f4573['where']};return db[_0xc3fe('0x47')][_0xc3fe('0x25')](_0x16f11b)[_0xc3fe('0x2b')](function(_0x55edc1){_0x6fe063[_0xc3fe('0x25')]=_0x55edc1;if(_0x11a44e[_0xc3fe('0x3a')][_0xc3fe('0x48')]){_0x3f4573['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x3f4573);})[_0xc3fe('0x2b')](function(_0x1530ff){_0x6fe063[_0xc3fe('0x49')]=_0x1530ff;return _0x6fe063;})[_0xc3fe('0x2b')](respondWithFilteredResult(_0x293999,_0x3f4573))[_0xc3fe('0x4a')](handleError(_0x293999,null));};exports[_0xc3fe('0x4b')]=function(_0x46fd56,_0x525278){var _0x10de1b={'raw':![],'where':{'id':_0x46fd56[_0xc3fe('0x4c')]['id']}},_0x3b9569={};_0x3b9569[_0xc3fe('0x38')]=_[_0xc3fe('0x39')](db[_0xc3fe('0x47')]['rawAttributes']);_0x3b9569[_0xc3fe('0x3a')]=_[_0xc3fe('0x39')](_0x46fd56[_0xc3fe('0x3a')]);_0x3b9569[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x3b9569[_0xc3fe('0x38')],_0x3b9569[_0xc3fe('0x3a')]);_0x10de1b[_0xc3fe('0x3d')]=_[_0xc3fe('0x3c')](_0x3b9569[_0xc3fe('0x38')],qs['fields'](_0x46fd56[_0xc3fe('0x3a')][_0xc3fe('0x3e')]));_0x10de1b[_0xc3fe('0x3d')]=_0x10de1b[_0xc3fe('0x3d')][_0xc3fe('0x4d')]?_0x10de1b[_0xc3fe('0x3d')]:_0x3b9569[_0xc3fe('0x38')];if(_0x46fd56[_0xc3fe('0x3a')][_0xc3fe('0x48')]){_0x10de1b[_0xc3fe('0x4e')]=[{'all':!![]}];}_0x10de1b=_[_0xc3fe('0x45')]({},_0x10de1b,_0x46fd56[_0xc3fe('0x46')]);return db[_0xc3fe('0x47')][_0xc3fe('0x4f')](_0x10de1b)['then'](handleEntityNotFound(_0x525278,null))[_0xc3fe('0x2b')](respondWithResult(_0x525278,null))[_0xc3fe('0x4a')](handleError(_0x525278,null));};exports[_0xc3fe('0x50')]=function(_0x5a5ad9,_0x1700e9){return db[_0xc3fe('0x47')][_0xc3fe('0x50')](_0x5a5ad9[_0xc3fe('0x51')],{})[_0xc3fe('0x2b')](function(_0x5a3c2c){var _0x514fca=_0x5a5ad9[_0xc3fe('0x52')][_0xc3fe('0x2d')]({'plain':!![]});if(!_0x514fca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x514fca[_0xc3fe('0x53')]===_0xc3fe('0x52')){var _0x53da54=_0x5a3c2c[_0xc3fe('0x2d')]({'plain':!![]});var _0xf9a20a=_0xc3fe('0x2e');return db[_0xc3fe('0x54')]['find']({'where':{'name':_0xf9a20a,'userProfileId':_0x514fca['userProfileId']},'raw':!![]})[_0xc3fe('0x2b')](function(_0x3f8eb3){if(_0x3f8eb3&&_0x3f8eb3[_0xc3fe('0x55')]===0x0){return db['UserProfileResource'][_0xc3fe('0x50')]({'name':_0x53da54[_0xc3fe('0x32')],'resourceId':_0x53da54['id'],'type':_0x3f8eb3[_0xc3fe('0x32')],'sectionId':_0x3f8eb3['id']},{})['then'](function(){return _0x5a3c2c;});}else{return _0x5a3c2c;}})[_0xc3fe('0x4a')](function(_0x426d51){logger['error'](_0xc3fe('0x56'),_0x426d51);throw _0x426d51;});}return _0x5a3c2c;})[_0xc3fe('0x2b')](respondWithResult(_0x1700e9,0xc9))[_0xc3fe('0x4a')](handleError(_0x1700e9,null));};exports[_0xc3fe('0x2a')]=function(_0x80c71,_0xe17a49){if(_0x80c71[_0xc3fe('0x51')]['id']){delete _0x80c71[_0xc3fe('0x51')]['id'];}return db[_0xc3fe('0x47')]['find']({'where':{'id':_0x80c71[_0xc3fe('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe17a49,null))[_0xc3fe('0x2b')](saveUpdates(_0x80c71[_0xc3fe('0x51')],null))['then'](respondWithResult(_0xe17a49,null))[_0xc3fe('0x4a')](handleError(_0xe17a49,null));};exports[_0xc3fe('0x2c')]=function(_0x3118c4,_0x527027){return db[_0xc3fe('0x47')][_0xc3fe('0x4f')]({'where':{'id':_0x3118c4[_0xc3fe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x527027,null))[_0xc3fe('0x2b')](removeEntity(_0x527027,null))[_0xc3fe('0x4a')](handleError(_0x527027,null));};exports[_0xc3fe('0x57')]=function(_0x35c581,_0x17fc18){return db[_0xc3fe('0x47')][_0xc3fe('0x57')]()['then'](respondWithResult(_0x17fc18,null))[_0xc3fe('0x4a')](handleError(_0x17fc18,null));};exports[_0xc3fe('0x58')]=function(_0x1ab9c8,_0x1ead09,_0x3f5bd4){if(_0x1ab9c8[_0xc3fe('0x51')]['id']){delete _0x1ab9c8[_0xc3fe('0x51')]['id'];}return db[_0xc3fe('0x47')][_0xc3fe('0x4f')]({'where':{'id':_0x1ab9c8[_0xc3fe('0x4c')]['id']}})[_0xc3fe('0x2b')](handleEntityNotFound(_0x1ead09,null))['then'](function(_0x1084c3){if(_0x1084c3){_0x1ab9c8[_0xc3fe('0x51')]['ListId']=_0x1084c3['id'];return db[_0xc3fe('0x59')]['create'](_0x1ab9c8[_0xc3fe('0x51')]);}})[_0xc3fe('0x2b')](respondWithResult(_0x1ead09,null))[_0xc3fe('0x4a')](handleError(_0x1ead09,null));};exports[_0xc3fe('0x5a')]=function(_0x3c4514,_0x547310,_0x304dcc){var _0x519596={'raw':![],'where':{}};var _0x12a9ce={};var _0x5e6d75={'count':0x0,'rows':[]};return db[_0xc3fe('0x47')][_0xc3fe('0x5b')]({'where':{'id':_0x3c4514['params']['id']}})[_0xc3fe('0x2b')](handleEntityNotFound(_0x547310,null))[_0xc3fe('0x2b')](function(_0x336d20){if(_0x336d20){_0x12a9ce[_0xc3fe('0x38')]=_[_0xc3fe('0x39')](db[_0xc3fe('0x59')][_0xc3fe('0x5c')]);_0x12a9ce[_0xc3fe('0x3a')]=_['keys'](_0x3c4514[_0xc3fe('0x3a')]);_0x12a9ce[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x12a9ce[_0xc3fe('0x38')],_0x12a9ce['query']);_0x519596['attributes']=_[_0xc3fe('0x3c')](_0x12a9ce[_0xc3fe('0x38')],qs[_0xc3fe('0x3e')](_0x3c4514[_0xc3fe('0x3a')][_0xc3fe('0x3e')]));_0x519596[_0xc3fe('0x3d')]=_0x519596[_0xc3fe('0x3d')][_0xc3fe('0x4d')]?_0x519596[_0xc3fe('0x3d')]:_0x12a9ce['model'];if(!_0x3c4514[_0xc3fe('0x3a')][_0xc3fe('0x3f')](_0xc3fe('0x40'))){_0x519596['limit']=qs[_0xc3fe('0x24')](_0x3c4514[_0xc3fe('0x3a')][_0xc3fe('0x24')]);_0x519596[_0xc3fe('0x22')]=qs[_0xc3fe('0x22')](_0x3c4514[_0xc3fe('0x3a')][_0xc3fe('0x22')]);}_0x519596[_0xc3fe('0x5d')]=qs[_0xc3fe('0x41')](_0x3c4514[_0xc3fe('0x3a')][_0xc3fe('0x41')]);_0x519596[_0xc3fe('0x42')]=qs[_0xc3fe('0x3b')](_[_0xc3fe('0x43')](_0x3c4514['query'],_0x12a9ce['filters']));_0x519596[_0xc3fe('0x42')]['ListId']=_0x336d20['id'];if(_0x3c4514[_0xc3fe('0x3a')][_0xc3fe('0x44')]){_0x519596['where']=_[_0xc3fe('0x45')](_0x519596['where'],{'$or':_[_0xc3fe('0x35')](_0x519596['attributes'],function(_0x6697ee){var _0x13f3c4={};_0x13f3c4[_0x6697ee]={'$like':'%'+_0x3c4514['query'][_0xc3fe('0x44')]+'%'};return _0x13f3c4;})});}_0x519596=_[_0xc3fe('0x45')]({},_0x519596,_0x3c4514[_0xc3fe('0x46')]);return db[_0xc3fe('0x59')]['count']({'where':_0x519596[_0xc3fe('0x42')]})['then'](function(_0x12cdb1){_0x5e6d75[_0xc3fe('0x25')]=_0x12cdb1;if(_0x3c4514['query'][_0xc3fe('0x48')]){_0x519596[_0xc3fe('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0xc3fe('0x5e')](_0x519596);})[_0xc3fe('0x2b')](function(_0x37c877){_0x5e6d75[_0xc3fe('0x49')]=_0x37c877;return _0x5e6d75;});}})[_0xc3fe('0x2b')](respondWithFilteredResult(_0x547310,_0x519596))['catch'](handleError(_0x547310,null));};exports[_0xc3fe('0x5f')]=function(_0x2c2a8a,_0xa15ef2,_0x59e62e){return db[_0xc3fe('0x47')]['find']({'where':{'id':_0x2c2a8a[_0xc3fe('0x4c')]['id']}})['then'](handleEntityNotFound(_0xa15ef2,null))['then'](function(_0x593864){if(_0x593864){return _0x593864['removeDispositions'](_0x2c2a8a['query'][_0xc3fe('0x60')]);}})[_0xc3fe('0x2b')](respondWithStatusCode(_0xa15ef2,null))[_0xc3fe('0x4a')](handleError(_0xa15ef2,null));};exports[_0xc3fe('0x61')]=function(_0x5253a0,_0x505455,_0x1f8d3c){return db[_0xc3fe('0x47')][_0xc3fe('0x4f')]({'where':{'id':_0x5253a0[_0xc3fe('0x4c')]['id']}})[_0xc3fe('0x2b')](handleEntityNotFound(_0x505455,null))[_0xc3fe('0x2b')](function(_0x1f6a39){if(_0x1f6a39){var _0x31f07f=[];var _0x26141c={'success':[],'errors':[]};return db['CmContact'][_0xc3fe('0x57')]()[_0xc3fe('0x2b')](function(_0x1ab03f){if(_0x5253a0['body'][_0xc3fe('0x62')]&&_[_0xc3fe('0x63')](_0x5253a0[_0xc3fe('0x51')][_0xc3fe('0x62')])){if(_0x5253a0['body'][_0xc3fe('0x62')][_0xc3fe('0x4d')]){_0x5253a0['body']['tags']=_0x5253a0[_0xc3fe('0x51')]['tags'][_0xc3fe('0x64')](';')+';';}else{_0x5253a0['body'][_0xc3fe('0x62')]=null;}}else{_0x5253a0['body'][_0xc3fe('0x62')]=null;}if(_0x5253a0[_0xc3fe('0x51')]&&_[_0xc3fe('0x63')](_0x5253a0[_0xc3fe('0x51')])){for(var _0x65d2c=0x0;_0x65d2c<_0x5253a0['body'][_0xc3fe('0x4d')];_0x65d2c+=0x1){_0x5253a0['body'][_0x65d2c]['ListId']=_0x5253a0['params']['id'];_0x31f07f['push'](_0x5253a0['body'][_0x65d2c]);}return BPromise[_0xc3fe('0x65')](_0x31f07f,function(_0xad894d){return db[_0xc3fe('0x66')][_0xc3fe('0x50')](_[_0xc3fe('0x67')](_0xad894d,[_0xc3fe('0x60'),'id'])||{},{'fields':_[_0xc3fe('0x39')](_0x1ab03f),'raw':!![]})[_0xc3fe('0x2b')](function(_0x4d1c8e){_0x26141c[_0xc3fe('0x68')][_0xc3fe('0x69')](_0x4d1c8e[_0xc3fe('0x6a')]);})['catch'](function(_0x76befc){_0x26141c[_0xc3fe('0x6b')][_0xc3fe('0x69')]({'data':_0xad894d,'error':_0x76befc[_0xc3fe('0x6c')]});});})[_0xc3fe('0x2b')](function(_0x53c2e3){return _0x26141c;})[_0xc3fe('0x4a')](function(_0x1b30a0){return _0x1b30a0;});}else{_0x505455[_0xc3fe('0x1f')](0x190)[_0xc3fe('0x21')]({'message':_0xc3fe('0x6d')});}});}})[_0xc3fe('0x2b')](respondWithResult(_0x505455,null))['catch'](handleError(_0x505455,null));};exports[_0xc3fe('0x6e')]=function(_0x5c33de,_0x5982e0,_0x12a482){var _0x1bba5f;return db[_0xc3fe('0x47')]['find']({'where':{'id':_0x5c33de[_0xc3fe('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xc3fe('0x6f')}]})[_0xc3fe('0x2b')](handleEntityNotFound(_0x5982e0,null))[_0xc3fe('0x2b')](function(_0x5da448){if(_0x5da448){_0x1bba5f=_0x5da448;return db[_0xc3fe('0x66')][_0xc3fe('0x5c')];}})[_0xc3fe('0x2b')](function(_0x47f1fe){if(_0x47f1fe){var _0x2eea93={};var _0x381edb={};_0x381edb['model']=_[_0xc3fe('0x70')](_[_0xc3fe('0x39')](_0x47f1fe),_['map'](_0x1bba5f[_0xc3fe('0x6f')],function(_0xf65acb){return util[_0xc3fe('0x71')](_0xc3fe('0x72'),_0xf65acb['id']);}));_0x381edb[_0xc3fe('0x3a')]=_[_0xc3fe('0x39')](_0x5c33de['query']);_0x381edb[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x381edb[_0xc3fe('0x38')],_0x381edb[_0xc3fe('0x3a')]);_0x2eea93[_0xc3fe('0x3d')]=_[_0xc3fe('0x3c')](_0x381edb[_0xc3fe('0x38')],qs[_0xc3fe('0x3e')](_0x5c33de['query'][_0xc3fe('0x3e')]));_0x2eea93[_0xc3fe('0x3d')]=_0x2eea93['attributes'][_0xc3fe('0x4d')]?_0x2eea93[_0xc3fe('0x3d')]:_0x381edb['model'];if(!_0x5c33de[_0xc3fe('0x3a')][_0xc3fe('0x3f')](_0xc3fe('0x40'))){_0x2eea93[_0xc3fe('0x24')]=qs[_0xc3fe('0x24')](_0x5c33de['query'][_0xc3fe('0x24')]);_0x2eea93[_0xc3fe('0x22')]=qs[_0xc3fe('0x22')](_0x5c33de[_0xc3fe('0x3a')][_0xc3fe('0x22')]);}_0x2eea93[_0xc3fe('0x5d')]=qs['sort'](_0x5c33de[_0xc3fe('0x3a')]['sort']);_0x2eea93['where']=qs['filters'](_[_0xc3fe('0x43')](_0x5c33de[_0xc3fe('0x3a')],_0x381edb['filters']));_0x2eea93[_0xc3fe('0x73')]=!![];if(_0x5c33de[_0xc3fe('0x3a')]['filter']){_0x2eea93[_0xc3fe('0x42')]=_[_0xc3fe('0x45')](_0x2eea93[_0xc3fe('0x42')],{'$or':_[_0xc3fe('0x35')](_0x2eea93[_0xc3fe('0x3d')],function(_0x49346d){var _0x2c6dbb={};_0x2c6dbb[_0x49346d]={'$like':'%'+_0x5c33de['query']['filter']+'%'};return _0x2c6dbb;})});}_0x2eea93=_[_0xc3fe('0x45')]({},_0x2eea93,_0x5c33de['options']);return _0x1bba5f[_0xc3fe('0x6e')](_0x2eea93);}})[_0xc3fe('0x2b')](respondWithResult(_0x5982e0,null))[_0xc3fe('0x4a')](handleError(_0x5982e0,null));};exports[_0xc3fe('0x74')]=function(_0x2d46fb,_0x5d1c47,_0x2a383c){var _0x37298d;return db[_0xc3fe('0x47')][_0xc3fe('0x4f')]({'where':{'id':_0x2d46fb[_0xc3fe('0x4c')]['id']},'include':[{'model':db[_0xc3fe('0x75')],'as':'CustomFields'}]})[_0xc3fe('0x2b')](handleEntityNotFound(_0x5d1c47,null))[_0xc3fe('0x2b')](function(_0x7157e0){if(_0x7157e0){_0x37298d=_0x7157e0;return db[_0xc3fe('0x66')][_0xc3fe('0x5c')];}})[_0xc3fe('0x2b')](function(_0x38e442){if(_0x38e442){var _0x1d1a6c={};var _0x41eee2={};_0x41eee2[_0xc3fe('0x38')]=_['concat'](_['keys'](_0x38e442),_[_0xc3fe('0x35')](_0x37298d[_0xc3fe('0x6f')],function(_0x26c323){return util[_0xc3fe('0x71')](_0xc3fe('0x72'),_0x26c323['id']);}));_0x41eee2['query']=_[_0xc3fe('0x39')](_0x2d46fb[_0xc3fe('0x3a')]);_0x41eee2[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x41eee2[_0xc3fe('0x38')],_0x41eee2['query']);_0x1d1a6c[_0xc3fe('0x3d')]=_[_0xc3fe('0x3c')](_0x41eee2['model'],qs['fields'](_0x2d46fb[_0xc3fe('0x3a')][_0xc3fe('0x3e')]));_0x1d1a6c['attributes']=_0x1d1a6c[_0xc3fe('0x3d')][_0xc3fe('0x4d')]?_0x1d1a6c[_0xc3fe('0x3d')]:_0x41eee2[_0xc3fe('0x38')];if(!_0x2d46fb[_0xc3fe('0x3a')][_0xc3fe('0x3f')](_0xc3fe('0x40'))){_0x1d1a6c[_0xc3fe('0x24')]=qs[_0xc3fe('0x24')](_0x2d46fb[_0xc3fe('0x3a')]['limit']);_0x1d1a6c['offset']=qs['offset'](_0x2d46fb['query'][_0xc3fe('0x22')]);}_0x1d1a6c[_0xc3fe('0x5d')]=qs[_0xc3fe('0x41')](_0x2d46fb[_0xc3fe('0x3a')][_0xc3fe('0x41')]);_0x1d1a6c['where']=qs[_0xc3fe('0x3b')](_[_0xc3fe('0x43')](_0x2d46fb['query'],_0x41eee2[_0xc3fe('0x3b')]));_0x1d1a6c[_0xc3fe('0x73')]=!![];if(_0x2d46fb[_0xc3fe('0x3a')][_0xc3fe('0x44')]){_0x1d1a6c[_0xc3fe('0x42')]=_[_0xc3fe('0x45')](_0x1d1a6c[_0xc3fe('0x42')],{'$or':_['map'](_0x1d1a6c[_0xc3fe('0x3d')],function(_0x579a18){var _0x10060c={};_0x10060c[_0x579a18]={'$like':'%'+_0x2d46fb['query'][_0xc3fe('0x44')]+'%'};return _0x10060c;})});}_0x1d1a6c=_['merge']({},_0x1d1a6c,_0x2d46fb[_0xc3fe('0x46')]);return _0x37298d[_0xc3fe('0x6e')](_0x1d1a6c);}})[_0xc3fe('0x2b')](function(_0x419ce4){if(!_[_0xc3fe('0x76')](_0x419ce4)){var _0x174553=toCsv(_0x419ce4);var _0x598f4a=Date['now']();fs[_0xc3fe('0x77')](util[_0xc3fe('0x71')](_0xc3fe('0x78'),_0x37298d['id'],_0x598f4a),_0x174553);_0x5d1c47[_0xc3fe('0x79')](_0xc3fe('0x7a'),_0xc3fe('0x7b')+util[_0xc3fe('0x71')]('list_%d_%s.csv',_0x37298d['id'],_0x598f4a));_0x5d1c47[_0xc3fe('0x79')](_0xc3fe('0x7c'),_0xc3fe('0x7d'));return _0x5d1c47['download'](util['format'](_0xc3fe('0x78'),_0x37298d['id'],_0x598f4a));}else{return _0x5d1c47['sendStatus'](0xcc);}})[_0xc3fe('0x4a')](handleError(_0x5d1c47,null));};exports[_0xc3fe('0x7e')]=function(_0x12bf96,_0x2bc7e8,_0x4763c8){var _0x465f49;delete _0x12bf96['body']['id'];return db[_0xc3fe('0x47')][_0xc3fe('0x5b')]({'where':{'id':_0x12bf96[_0xc3fe('0x4c')]['id']}})[_0xc3fe('0x2b')](handleEntityNotFound(_0x2bc7e8,null))['then'](function(_0x508914){if(_0x508914){return db[_0xc3fe('0x7f')][_0xc3fe('0x80')](function(_0x22230a){return db[_0xc3fe('0x75')][_0xc3fe('0x50')](_0x12bf96[_0xc3fe('0x51')],{'transaction':_0x22230a})['then'](function(_0x53ce1b){_0x465f49=_0x53ce1b;return _0x508914[_0xc3fe('0x81')](_0x53ce1b,{'transaction':_0x22230a});})['then'](function(){var _0x2e1970={'type':db[_0xc3fe('0x82')][_0xc3fe('0x83')],'transaction':_0x22230a};switch(_0x12bf96[_0xc3fe('0x51')][_0xc3fe('0x37')]){case'text':_0x2e1970[_0xc3fe('0x37')]=db[_0xc3fe('0x82')][_0xc3fe('0x83')];break;case _0xc3fe('0x84'):_0x2e1970[_0xc3fe('0x37')]=db[_0xc3fe('0x82')]['INTEGER'];break;case _0xc3fe('0x85'):_0x2e1970[_0xc3fe('0x37')]=db[_0xc3fe('0x82')][_0xc3fe('0x86')];_0x2e1970[_0xc3fe('0x87')]=![];break;default:}return db[_0xc3fe('0x7f')][_0xc3fe('0x88')]['addColumn'](_0xc3fe('0x89'),util[_0xc3fe('0x71')]('cf_%s',_0x465f49['id']),_0x2e1970);})['then'](function(){return _0x465f49;});});}})['then'](respondWithResult(_0x2bc7e8,null))['catch'](handleError(_0x2bc7e8,null));};exports[_0xc3fe('0x8a')]=function(_0x230ce1,_0x361e01,_0xe46762){var _0x431f31={};var _0x12e475={};var _0x5f2820;var _0x23b141;return db[_0xc3fe('0x47')][_0xc3fe('0x5b')]({'where':{'id':_0x230ce1[_0xc3fe('0x4c')]['id']}})[_0xc3fe('0x2b')](handleEntityNotFound(_0x361e01,null))['then'](function(_0x2c858c){if(_0x2c858c){_0x5f2820=_0x2c858c;_0x12e475['model']=_['keys'](db[_0xc3fe('0x75')]['rawAttributes']);_0x12e475['query']=_['keys'](_0x230ce1['query']);_0x12e475[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x12e475[_0xc3fe('0x38')],_0x12e475[_0xc3fe('0x3a')]);_0x431f31['attributes']=_[_0xc3fe('0x3c')](_0x12e475[_0xc3fe('0x38')],qs['fields'](_0x230ce1[_0xc3fe('0x3a')][_0xc3fe('0x3e')]));_0x431f31[_0xc3fe('0x3d')]=_0x431f31[_0xc3fe('0x3d')][_0xc3fe('0x4d')]?_0x431f31[_0xc3fe('0x3d')]:_0x12e475[_0xc3fe('0x38')];_0x431f31[_0xc3fe('0x5d')]=qs[_0xc3fe('0x41')](_0x230ce1[_0xc3fe('0x3a')]['sort']);_0x431f31[_0xc3fe('0x42')]=qs['filters'](_['pick'](_0x230ce1[_0xc3fe('0x3a')],_0x12e475['filters']));_0x431f31[_0xc3fe('0x42')]=_[_0xc3fe('0x45')](_0x431f31[_0xc3fe('0x42')],{'$or':[{'ListId':_0x2c858c['id']},{'ListId':null}]});if(_0x230ce1[_0xc3fe('0x3a')]['filter']){_0x431f31['where']=_[_0xc3fe('0x45')](_0x431f31[_0xc3fe('0x42')],{'$or':_[_0xc3fe('0x35')](_0x431f31[_0xc3fe('0x3d')],function(_0x426014){var _0x51ccfa={};_0x51ccfa[_0x426014]={'$like':'%'+_0x230ce1[_0xc3fe('0x3a')][_0xc3fe('0x44')]+'%'};return _0x51ccfa;})});}_0x431f31=_[_0xc3fe('0x45')]({},_0x431f31,_0x230ce1[_0xc3fe('0x46')]);return db[_0xc3fe('0x75')][_0xc3fe('0x8b')](_0x431f31);}})[_0xc3fe('0x2b')](respondWithResult(_0x361e01,null))[_0xc3fe('0x4a')](handleError(_0x361e01,null));};exports[_0xc3fe('0x8c')]=function(_0x22a19c,_0x33e867,_0x5f4582){return db[_0xc3fe('0x47')][_0xc3fe('0x4f')]({'where':{'id':_0x22a19c[_0xc3fe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33e867,null))[_0xc3fe('0x2b')](function(_0x1a937a){if(_0x1a937a){return _0x1a937a['addAgents'](_0x22a19c['body']['ids'],_['omit'](_0x22a19c[_0xc3fe('0x51')],['ids','id'])||{})[_0xc3fe('0x8d')](function(_0x5c5ad3){for(var _0x5b05=0x0;_0x5b05<_0x22a19c['body']['ids'][_0xc3fe('0x4d')];_0x5b05+=0x1){socket[_0xc3fe('0x8e')](_0xc3fe('0x8f'),{'UserId':Number(_0x22a19c[_0xc3fe('0x51')][_0xc3fe('0x60')][_0x5b05]),'CmListId':Number(_0x22a19c['params']['id'])});}return _0x5c5ad3;});}})[_0xc3fe('0x2b')](respondWithResult(_0x33e867,null))[_0xc3fe('0x4a')](handleError(_0x33e867,null));};exports[_0xc3fe('0x90')]=function(_0x1724bf,_0x34ab0e,_0x4fc2d2){return db[_0xc3fe('0x47')]['find']({'where':{'id':_0x1724bf[_0xc3fe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34ab0e,null))[_0xc3fe('0x2b')](function(_0x118b76){if(_0x118b76){return _0x118b76[_0xc3fe('0x90')](_0x1724bf['query'][_0xc3fe('0x60')])[_0xc3fe('0x2b')](function(){if(_[_0xc3fe('0x63')](_0x1724bf[_0xc3fe('0x3a')][_0xc3fe('0x60')])){for(var _0x46403f=0x0;_0x46403f<_0x1724bf[_0xc3fe('0x3a')][_0xc3fe('0x60')][_0xc3fe('0x4d')];_0x46403f+=0x1){socket[_0xc3fe('0x8e')](_0xc3fe('0x91'),{'UserId':Number(_0x1724bf[_0xc3fe('0x3a')][_0xc3fe('0x60')][_0x46403f]),'CmListId':Number(_0x1724bf[_0xc3fe('0x4c')]['id'])});}}else{socket[_0xc3fe('0x8e')](_0xc3fe('0x91'),{'UserId':Number(_0x1724bf[_0xc3fe('0x3a')]['ids']),'CmListId':Number(_0x1724bf['params']['id'])});}});}})[_0xc3fe('0x2b')](respondWithStatusCode(_0x34ab0e,null))[_0xc3fe('0x4a')](handleError(_0x34ab0e,null));};exports[_0xc3fe('0x92')]=function(_0x31cfc1,_0x447ee8,_0x9eabae){var _0x5277cf={};var _0x444f79={};var _0x131dcd;var _0x4ee511;return db[_0xc3fe('0x47')][_0xc3fe('0x5b')]({'where':{'id':_0x31cfc1[_0xc3fe('0x4c')]['id']}})[_0xc3fe('0x2b')](handleEntityNotFound(_0x447ee8,null))[_0xc3fe('0x2b')](function(_0x1ee7f6){if(_0x1ee7f6){_0x131dcd=_0x1ee7f6;_0x444f79['model']=_['keys'](db[_0xc3fe('0x93')][_0xc3fe('0x5c')]);_0x444f79[_0xc3fe('0x3a')]=_[_0xc3fe('0x39')](_0x31cfc1['query']);_0x444f79[_0xc3fe('0x3b')]=_[_0xc3fe('0x3c')](_0x444f79[_0xc3fe('0x38')],_0x444f79[_0xc3fe('0x3a')]);_0x5277cf[_0xc3fe('0x3d')]=_[_0xc3fe('0x3c')](_0x444f79[_0xc3fe('0x38')],qs[_0xc3fe('0x3e')](_0x31cfc1[_0xc3fe('0x3a')][_0xc3fe('0x3e')]));_0x5277cf[_0xc3fe('0x3d')]=_0x5277cf[_0xc3fe('0x3d')][_0xc3fe('0x4d')]?_0x5277cf[_0xc3fe('0x3d')]:_0x444f79['model'];_0x5277cf[_0xc3fe('0x5d')]=qs[_0xc3fe('0x41')](_0x31cfc1[_0xc3fe('0x3a')][_0xc3fe('0x41')]);_0x5277cf['where']=qs['filters'](_[_0xc3fe('0x43')](_0x31cfc1[_0xc3fe('0x3a')],_0x444f79[_0xc3fe('0x3b')]));if(_0x31cfc1[_0xc3fe('0x3a')][_0xc3fe('0x44')]){_0x5277cf[_0xc3fe('0x42')]=_[_0xc3fe('0x45')](_0x5277cf[_0xc3fe('0x42')],{'$or':_['map'](_0x5277cf[_0xc3fe('0x3d')],function(_0x3d0929){var _0x30d054={};_0x30d054[_0x3d0929]={'$like':'%'+_0x31cfc1[_0xc3fe('0x3a')][_0xc3fe('0x44')]+'%'};return _0x30d054;})});}_0x5277cf=_[_0xc3fe('0x45')]({},_0x5277cf,_0x31cfc1[_0xc3fe('0x46')]);return _0x131dcd['getAgents'](_0x5277cf);}})[_0xc3fe('0x2b')](function(_0x124c08){if(_0x124c08){_0x4ee511=_0x124c08[_0xc3fe('0x4d')];if(!_0x31cfc1[_0xc3fe('0x3a')][_0xc3fe('0x3f')](_0xc3fe('0x40'))){_0x5277cf[_0xc3fe('0x24')]=qs[_0xc3fe('0x24')](_0x31cfc1[_0xc3fe('0x3a')][_0xc3fe('0x24')]);_0x5277cf['offset']=qs['offset'](_0x31cfc1[_0xc3fe('0x3a')]['offset']);}return _0x131dcd[_0xc3fe('0x92')](_0x5277cf);}})[_0xc3fe('0x2b')](function(_0x28327a){if(_0x28327a){return _0x28327a?{'count':_0x4ee511,'rows':_0x28327a}:null;}})['then'](respondWithResult(_0x447ee8,null))[_0xc3fe('0x4a')](handleError(_0x447ee8,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 27fecb4..95a83a0 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x413351,_0x1836f0){_0x413351=_0x413351-0x0;var _0x3f04fd=_0x326f[_0x413351];return _0x3f04fd;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x50e944,_0x13a411){var _0x9eb69=function(_0x5aa90f){while(--_0x5aa90f){_0x50e944['push'](_0x50e944['shift']());}};_0x9eb69(++_0x13a411);}(_0x814b,0x1a2));var _0xb814=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x814b[_0x34c027];return _0x47bff0;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 91ef4c6..abbf8cd 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb947c5,_0x3791ce){var _0x2c5132=function(_0x224ca6){while(--_0x224ca6){_0xb947c5['push'](_0xb947c5['shift']());}};_0x2c5132(++_0x3791ce);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x35ba71,_0xa2fbbd){_0x35ba71=_0x35ba71-0x0;var _0x5f04f4=_0xf3cd[_0x35ba71];return _0x5f04f4;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./cmList.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x297317,_0x7dcc2c){var _0x3e4b41=function(_0x1c1673){while(--_0x1c1673){_0x297317['push'](_0x297317['shift']());}};_0x3e4b41(++_0x7dcc2c);}(_0xbec5,0xe5));var _0x5bec=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0xbec5[_0x534c8f];return _0x5a57f5;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'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 2996587..85e4e68 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 _0x54db=['then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./cmList.socket','request'];(function(_0x127bb2,_0x849c5f){var _0x596034=function(_0x307a4c){while(--_0x307a4c){_0x127bb2['push'](_0x127bb2['shift']());}};_0x596034(++_0x849c5f);}(_0x54db,0x1f1));var _0xb54d=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x54db[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xb54d('0x0'));var util=require('util');var moment=require(_0xb54d('0x1'));var BPromise=require(_0xb54d('0x2'));var rs=require(_0xb54d('0x3'));var fs=require('fs');var Redis=require(_0xb54d('0x4'));var db=require(_0xb54d('0x5'))['db'];var utils=require(_0xb54d('0x6'));var logger=require(_0xb54d('0x7'))(_0xb54d('0x8'));var config=require('../../config/environment');var jayson=require(_0xb54d('0x9'));var client=jayson[_0xb54d('0xa')][_0xb54d('0xb')]({'port':0x232a});config[_0xb54d('0xc')]=_[_0xb54d('0xd')](config[_0xb54d('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb54d('0xc')]));require(_0xb54d('0xe'))['register'](socket);function respondWithRpcPromise(_0x5ff6d9,_0x4840ba,_0x5d3dfa){return new BPromise(function(_0x2d907b,_0x549ec7){return client[_0xb54d('0xf')](_0x5ff6d9,_0x5d3dfa)[_0xb54d('0x10')](function(_0x3dbb3d){logger[_0xb54d('0x11')](_0xb54d('0x12'),_0x4840ba,_0xb54d('0x13'));logger['debug'](_0xb54d('0x14'),_0x4840ba,_0xb54d('0x13'),JSON[_0xb54d('0x15')](_0x3dbb3d));if(_0x3dbb3d[_0xb54d('0x16')]){if(_0x3dbb3d[_0xb54d('0x16')][_0xb54d('0x17')]===0x1f4){logger[_0xb54d('0x16')](_0xb54d('0x12'),_0x4840ba,_0x3dbb3d[_0xb54d('0x16')][_0xb54d('0x18')]);return _0x549ec7(_0x3dbb3d[_0xb54d('0x16')][_0xb54d('0x18')]);}logger[_0xb54d('0x16')](_0xb54d('0x12'),_0x4840ba,_0x3dbb3d['error'][_0xb54d('0x18')]);return _0x2d907b(_0x3dbb3d[_0xb54d('0x16')]['message']);}else{logger[_0xb54d('0x11')](_0xb54d('0x12'),_0x4840ba,'request\x20sent');_0x2d907b(_0x3dbb3d[_0xb54d('0x19')][_0xb54d('0x18')]);}})[_0xb54d('0x1a')](function(_0x538895){logger[_0xb54d('0x16')](_0xb54d('0x12'),_0x4840ba,_0x538895);_0x549ec7(_0x538895);});});} \ No newline at end of file +var _0x1dfe=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x4a26bd,_0x21f904){var _0x7b875a=function(_0x3b9110){while(--_0x3b9110){_0x4a26bd['push'](_0x4a26bd['shift']());}};_0x7b875a(++_0x21f904);}(_0x1dfe,0xb5));var _0xe1df=function(_0x569335,_0x3174d5){_0x569335=_0x569335-0x0;var _0x458741=_0x1dfe[_0x569335];return _0x458741;};'use strict';var _=require(_0xe1df('0x0'));var util=require(_0xe1df('0x1'));var moment=require(_0xe1df('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1df('0x3'));var fs=require('fs');var Redis=require(_0xe1df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1df('0x5'));var logger=require(_0xe1df('0x6'))('rpc');var config=require(_0xe1df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1df('0x8')][_0xe1df('0x9')]({'port':0x232a});config[_0xe1df('0xa')]=_['defaults'](config[_0xe1df('0xa')],{'host':_0xe1df('0xb'),'port':0x18eb});var socket=require(_0xe1df('0xc'))(new Redis(config['redis']));require(_0xe1df('0xd'))[_0xe1df('0xe')](socket);function respondWithRpcPromise(_0x126dff,_0x1d126f,_0x2c6626){return new BPromise(function(_0x3d77bc,_0x377c5d){return client[_0xe1df('0xf')](_0x126dff,_0x2c6626)[_0xe1df('0x10')](function(_0x43d8b4){logger[_0xe1df('0x11')](_0xe1df('0x12'),_0x1d126f,_0xe1df('0x13'));logger[_0xe1df('0x14')](_0xe1df('0x15'),_0x1d126f,_0xe1df('0x13'),JSON[_0xe1df('0x16')](_0x43d8b4));if(_0x43d8b4['error']){if(_0x43d8b4[_0xe1df('0x17')][_0xe1df('0x18')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x1d126f,_0x43d8b4[_0xe1df('0x17')][_0xe1df('0x19')]);return _0x377c5d(_0x43d8b4[_0xe1df('0x17')][_0xe1df('0x19')]);}logger[_0xe1df('0x17')]('CmList,\x20%s,\x20%s',_0x1d126f,_0x43d8b4[_0xe1df('0x17')][_0xe1df('0x19')]);return _0x3d77bc(_0x43d8b4[_0xe1df('0x17')]['message']);}else{logger[_0xe1df('0x11')](_0xe1df('0x12'),_0x1d126f,_0xe1df('0x13'));_0x3d77bc(_0x43d8b4[_0xe1df('0x1a')][_0xe1df('0x19')]);}})[_0xe1df('0x1b')](function(_0x3e4e78){logger[_0xe1df('0x17')]('CmList,\x20%s,\x20%s',_0x1d126f,_0x3e4e78);_0x377c5d(_0x3e4e78);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 16fa42f..5c56e66 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 _0xa948=['removeListener','register','length','./cmList.events','save','remove','update','emit'];(function(_0x257b82,_0x239cb1){var _0x47d763=function(_0x5b766f){while(--_0x5b766f){_0x257b82['push'](_0x257b82['shift']());}};_0x47d763(++_0x239cb1);}(_0xa948,0x1cb));var _0x8a94=function(_0x3cdcfc,_0x5c259b){_0x3cdcfc=_0x3cdcfc-0x0;var _0x4b7c43=_0xa948[_0x3cdcfc];return _0x4b7c43;};'use strict';var CmListEvents=require(_0x8a94('0x0'));var events=[_0x8a94('0x1'),_0x8a94('0x2'),_0x8a94('0x3')];function createListener(_0x39e042,_0x574e11){return function(_0x3e8e4f){_0x574e11[_0x8a94('0x4')](_0x39e042,_0x3e8e4f);};}function removeListener(_0x5882b0,_0x2c96dd){return function(){CmListEvents[_0x8a94('0x5')](_0x5882b0,_0x2c96dd);};}exports[_0x8a94('0x6')]=function(_0x434d7b){for(var _0x5b89d6=0x0,_0x2d24ae=events[_0x8a94('0x7')];_0x5b89d6<_0x2d24ae;_0x5b89d6++){var _0x56646d=events[_0x5b89d6];var _0x4334a6=createListener('cmList:'+_0x56646d,_0x434d7b);CmListEvents['on'](_0x56646d,_0x4334a6);}}; \ No newline at end of file +var _0x7b4e=['save','remove','update','emit','removeListener','cmList:','./cmList.events'];(function(_0x3e4e8c,_0x1210be){var _0xda93f5=function(_0x1984f6){while(--_0x1984f6){_0x3e4e8c['push'](_0x3e4e8c['shift']());}};_0xda93f5(++_0x1210be);}(_0x7b4e,0x16b));var _0xe7b4=function(_0x31ea83,_0x41c5f7){_0x31ea83=_0x31ea83-0x0;var _0x2acd8a=_0x7b4e[_0x31ea83];return _0x2acd8a;};'use strict';var CmListEvents=require(_0xe7b4('0x0'));var events=[_0xe7b4('0x1'),_0xe7b4('0x2'),_0xe7b4('0x3')];function createListener(_0x43dfb0,_0x453c2d){return function(_0x3c319b){_0x453c2d[_0xe7b4('0x4')](_0x43dfb0,_0x3c319b);};}function removeListener(_0x269d27,_0x29b832){return function(){CmListEvents[_0xe7b4('0x5')](_0x269d27,_0x29b832);};}exports['register']=function(_0x758611){for(var _0x467892=0x0,_0x4e7024=events['length'];_0x467892<_0x4e7024;_0x467892++){var _0x2fb356=events[_0x467892];var _0x4ad987=createListener(_0xe7b4('0x6')+_0x2fb356,_0x758611);CmListEvents['on'](_0x2fb356,_0x4ad987);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0728d95..748e902 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 _0x9848=['../../components/interaction/service','../../config/environment','./cmList.controller','index','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addContacts','addCustomField','addAgents','put','destroy','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1afedc,_0x17ee2f){var _0x3520db=function(_0x46b771){while(--_0x46b771){_0x1afedc['push'](_0x1afedc['shift']());}};_0x3520db(++_0x17ee2f);}(_0x9848,0x14d));var _0x8984=function(_0x4a8605,_0x1879d1){_0x4a8605=_0x4a8605-0x0;var _0x215efa=_0x9848[_0x4a8605];return _0x215efa;};'use strict';var multer=require('multer');var util=require(_0x8984('0x0'));var path=require(_0x8984('0x1'));var timeout=require(_0x8984('0x2'));var express=require(_0x8984('0x3'));var router=express[_0x8984('0x4')]();var fs_extra=require(_0x8984('0x5'));var auth=require(_0x8984('0x6'));var interaction=require(_0x8984('0x7'));var config=require(_0x8984('0x8'));var controller=require(_0x8984('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8984('0xa')]);router[_0x8984('0xb')]('/describe',auth[_0x8984('0xc')](),controller[_0x8984('0xd')]);router[_0x8984('0xb')](_0x8984('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x8984('0xb')](_0x8984('0xf'),auth['isAuthenticated'](),controller[_0x8984('0x10')]);router['get'](_0x8984('0x11'),auth[_0x8984('0xc')](),controller[_0x8984('0x12')]);router['get'](_0x8984('0x13'),auth[_0x8984('0xc')](),controller[_0x8984('0x14')]);router[_0x8984('0xb')](_0x8984('0x15'),auth[_0x8984('0xc')](),controller[_0x8984('0x16')]);router[_0x8984('0xb')](_0x8984('0x17'),auth[_0x8984('0xc')](),controller[_0x8984('0x18')]);router[_0x8984('0x19')]('/',auth[_0x8984('0xc')](),controller['create']);router[_0x8984('0x19')](_0x8984('0xf'),auth[_0x8984('0xc')](),controller['addDisposition']);router[_0x8984('0x19')](_0x8984('0x11'),auth[_0x8984('0xc')](),controller[_0x8984('0x1a')]);router[_0x8984('0x19')](_0x8984('0x15'),auth['isAuthenticated'](),controller[_0x8984('0x1b')]);router[_0x8984('0x19')](_0x8984('0x17'),auth[_0x8984('0xc')](),controller[_0x8984('0x1c')]);router[_0x8984('0x1d')](_0x8984('0xe'),auth[_0x8984('0xc')](),controller['update']);router['delete'](_0x8984('0xe'),auth['isAuthenticated'](),controller[_0x8984('0x1e')]);router[_0x8984('0x1f')](_0x8984('0xf'),auth[_0x8984('0xc')](),controller['removeDispositions']);router[_0x8984('0x1f')]('/:id/users',auth[_0x8984('0xc')](),controller[_0x8984('0x20')]);module[_0x8984('0x21')]=router; \ No newline at end of file +var _0x59cb=['delete','removeDispositions','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create','post','addDisposition','addContacts','addCustomField','put','update','destroy'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x59cb,0xb2));var _0xb59c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x59cb[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xb59c('0x0'));var util=require(_0xb59c('0x1'));var path=require('path');var timeout=require(_0xb59c('0x2'));var express=require(_0xb59c('0x3'));var router=express[_0xb59c('0x4')]();var fs_extra=require(_0xb59c('0x5'));var auth=require(_0xb59c('0x6'));var interaction=require(_0xb59c('0x7'));var config=require(_0xb59c('0x8'));var controller=require(_0xb59c('0x9'));router[_0xb59c('0xa')]('/',auth[_0xb59c('0xb')](),controller[_0xb59c('0xc')]);router['get']('/describe',auth[_0xb59c('0xb')](),controller[_0xb59c('0xd')]);router[_0xb59c('0xa')](_0xb59c('0xe'),auth[_0xb59c('0xb')](),controller[_0xb59c('0xf')]);router['get'](_0xb59c('0x10'),auth[_0xb59c('0xb')](),controller['getDispositions']);router[_0xb59c('0xa')](_0xb59c('0x11'),auth[_0xb59c('0xb')](),controller[_0xb59c('0x12')]);router[_0xb59c('0xa')](_0xb59c('0x13'),auth['isAuthenticated'](),controller[_0xb59c('0x14')]);router[_0xb59c('0xa')](_0xb59c('0x15'),auth[_0xb59c('0xb')](),controller[_0xb59c('0x16')]);router[_0xb59c('0xa')](_0xb59c('0x17'),auth[_0xb59c('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb59c('0xb')](),controller[_0xb59c('0x18')]);router[_0xb59c('0x19')](_0xb59c('0x10'),auth[_0xb59c('0xb')](),controller[_0xb59c('0x1a')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0xb59c('0x1b')]);router['post'](_0xb59c('0x15'),auth[_0xb59c('0xb')](),controller[_0xb59c('0x1c')]);router[_0xb59c('0x19')](_0xb59c('0x17'),auth[_0xb59c('0xb')](),controller['addAgents']);router[_0xb59c('0x1d')]('/:id',auth[_0xb59c('0xb')](),controller[_0xb59c('0x1e')]);router['delete'](_0xb59c('0xe'),auth[_0xb59c('0xb')](),controller[_0xb59c('0x1f')]);router[_0xb59c('0x20')](_0xb59c('0x10'),auth[_0xb59c('0xb')](),controller[_0xb59c('0x21')]);router[_0xb59c('0x20')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb59c('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3bdc10f..86af931 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 _0xca1d=['sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x323cd6,_0x56dc3a){var _0x5b2f7b=function(_0x5ab616){while(--_0x5ab616){_0x323cd6['push'](_0x323cd6['shift']());}};_0x5b2f7b(++_0x56dc3a);}(_0xca1d,0x87));var _0xdca1=function(_0x4326ea,_0x72328a){_0x4326ea=_0x4326ea-0x0;var _0x54c5fb=_0xca1d[_0x4326ea];return _0x54c5fb;};'use strict';var Sequelize=require(_0xdca1('0x0'));module[_0xdca1('0x1')]={'name':{'type':Sequelize[_0xdca1('0x2')],'get':function(_0x31d08f){return this[_0xdca1('0x3')]('field');}},'field':{'type':Sequelize[_0xdca1('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x702e=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x702e,0x1b5));var _0xe702=function(_0x4ac64c,_0x331480){_0x4ac64c=_0x4ac64c-0x0;var _0x3d3371=_0x702e[_0x4ac64c];return _0x3d3371;};'use strict';var Sequelize=require(_0xe702('0x0'));module[_0xe702('0x1')]={'name':{'type':Sequelize[_0xe702('0x2')],'get':function(_0xc83218){return this[_0xe702('0x3')](_0xe702('0x4'));}},'field':{'type':Sequelize[_0xe702('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xe702('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xe702('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7279afd..f138e7e 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(_0x56c7a3,_0x454e98){var _0x411871=function(_0x3464fe){while(--_0x3464fe){_0x56c7a3['push'](_0x56c7a3['shift']());}};_0x411871(++_0x454e98);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x2e469c,_0x16e64b){var _0x196cb1=function(_0x3f589a){while(--_0x3f589a){_0x2e469c['push'](_0x2e469c['shift']());}};_0x196cb1(++_0x16e64b);}(_0x7a54,0x106));var _0x47a5=function(_0x3271d2,_0x3059e3){_0x3271d2=_0x3271d2-0x0;var _0x4369f6=_0x7a54[_0x3271d2];return _0x4369f6;};'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 e7d3df1..e9c1cef 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 _0xa495=['rimraf','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0xa495,0x170));var _0x5a49=function(_0x54deb9,_0x53e74b){_0x54deb9=_0x54deb9-0x0;var _0x5da9aa=_0xa495[_0x54deb9];return _0x5da9aa;};'use strict';var _=require(_0x5a49('0x0'));var util=require(_0x5a49('0x1'));var logger=require(_0x5a49('0x2'))(_0x5a49('0x3'));var moment=require('moment');var BPromise=require(_0x5a49('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a49('0x5'));var rimraf=require(_0x5a49('0x6'));var config=require('../../config/environment');var attributes=require(_0x5a49('0x7'));module[_0x5a49('0x8')]=function(_0x5e26e2,_0x58f0bd){return _0x5e26e2[_0x5a49('0x9')]('Condition',attributes,{'tableName':_0x5a49('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9bd=['exports','Condition','lodash','util','../../config/logger','bluebird','../../config/environment','./condition.attributes'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xf9bd,0x92));var _0xdf9b=function(_0xc30ebc,_0x435123){_0xc30ebc=_0xc30ebc-0x0;var _0xe757e5=_0xf9bd[_0xc30ebc];return _0xe757e5;};'use strict';var _=require(_0xdf9b('0x0'));var util=require(_0xdf9b('0x1'));var logger=require(_0xdf9b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdf9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf9b('0x4'));var attributes=require(_0xdf9b('0x5'));module[_0xdf9b('0x6')]=function(_0x1ca527,_0x5f55b1){return _0x1ca527['define'](_0xdf9b('0x7'),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 ba599e7..7520d54 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 _0xa186=['then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xa186,0x185));var _0x6a18=function(_0x31f5c2,_0x2a47d3){_0x31f5c2=_0x31f5c2-0x0;var _0xcb7d73=_0xa186[_0x31f5c2];return _0xcb7d73;};'use strict';var _=require('lodash');var util=require(_0x6a18('0x0'));var moment=require(_0x6a18('0x1'));var BPromise=require(_0x6a18('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a18('0x3'));var logger=require(_0x6a18('0x4'))(_0x6a18('0x5'));var config=require(_0x6a18('0x6'));var jayson=require(_0x6a18('0x7'));var client=jayson[_0x6a18('0x8')][_0x6a18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ccc9f,_0x1f7673,_0x20f745){return new BPromise(function(_0x1842c7,_0x41f242){return client[_0x6a18('0xa')](_0x4ccc9f,_0x20f745)[_0x6a18('0xb')](function(_0x3e0a80){logger[_0x6a18('0xc')](_0x6a18('0xd'),_0x1f7673,_0x6a18('0xe'));logger['debug'](_0x6a18('0xf'),_0x1f7673,_0x6a18('0xe'),JSON[_0x6a18('0x10')](_0x3e0a80));if(_0x3e0a80[_0x6a18('0x11')]){if(_0x3e0a80[_0x6a18('0x11')][_0x6a18('0x12')]===0x1f4){logger[_0x6a18('0x11')](_0x6a18('0xd'),_0x1f7673,_0x3e0a80['error']['message']);return _0x41f242(_0x3e0a80[_0x6a18('0x11')][_0x6a18('0x13')]);}logger[_0x6a18('0x11')](_0x6a18('0xd'),_0x1f7673,_0x3e0a80[_0x6a18('0x11')]['message']);return _0x1842c7(_0x3e0a80[_0x6a18('0x11')][_0x6a18('0x13')]);}else{logger[_0x6a18('0xc')](_0x6a18('0xd'),_0x1f7673,'request\x20sent');_0x1842c7(_0x3e0a80['result'][_0x6a18('0x13')]);}})['catch'](function(_0x3ffbd4){logger['error'](_0x6a18('0xd'),_0x1f7673,_0x3ffbd4);_0x41f242(_0x3ffbd4);});});} \ No newline at end of file +var _0xe410=['../../config/environment','jayson/promise','client','request','then','request\x20sent','error','code','Condition,\x20%s,\x20%s','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xe410,0x188));var _0x0e41=function(_0x234577,_0x3b9004){_0x234577=_0x234577-0x0;var _0x28fea6=_0xe410[_0x234577];return _0x28fea6;};'use strict';var _=require(_0x0e41('0x0'));var util=require('util');var moment=require(_0x0e41('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e41('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e41('0x3'))['db'];var utils=require(_0x0e41('0x4'));var logger=require(_0x0e41('0x5'))(_0x0e41('0x6'));var config=require(_0x0e41('0x7'));var jayson=require(_0x0e41('0x8'));var client=jayson[_0x0e41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cbdbb,_0x495d24,_0x54c2ef){return new BPromise(function(_0x5e4af3,_0x31e3d8){return client[_0x0e41('0xa')](_0x3cbdbb,_0x54c2ef)[_0x0e41('0xb')](function(_0x3e7b3d){logger['info']('Condition,\x20%s,\x20%s',_0x495d24,_0x0e41('0xc'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x495d24,_0x0e41('0xc'),JSON['stringify'](_0x3e7b3d));if(_0x3e7b3d[_0x0e41('0xd')]){if(_0x3e7b3d[_0x0e41('0xd')][_0x0e41('0xe')]===0x1f4){logger['error'](_0x0e41('0xf'),_0x495d24,_0x3e7b3d[_0x0e41('0xd')][_0x0e41('0x10')]);return _0x31e3d8(_0x3e7b3d['error'][_0x0e41('0x10')]);}logger['error'](_0x0e41('0xf'),_0x495d24,_0x3e7b3d['error'][_0x0e41('0x10')]);return _0x5e4af3(_0x3e7b3d[_0x0e41('0xd')]['message']);}else{logger[_0x0e41('0x11')](_0x0e41('0xf'),_0x495d24,_0x0e41('0xc'));_0x5e4af3(_0x3e7b3d[_0x0e41('0x12')][_0x0e41('0x10')]);}})['catch'](function(_0x376cec){logger[_0x0e41('0xd')]('Condition,\x20%s,\x20%s',_0x495d24,_0x376cec);_0x31e3d8(_0x376cec);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0010b6f..4d8e08c 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 _0xd634=['update','delete','util','path','Router','fs-extra','../../config/environment','./condition.controller','put','/:id','isAuthenticated'];(function(_0x52a50e,_0x444576){var _0x14a588=function(_0x434a3c){while(--_0x434a3c){_0x52a50e['push'](_0x52a50e['shift']());}};_0x14a588(++_0x444576);}(_0xd634,0xf4));var _0x4d63=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xd634[_0x4849f6];return _0x1a3dcd;};'use strict';var multer=require('multer');var util=require(_0x4d63('0x0'));var path=require(_0x4d63('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d63('0x2')]();var fs_extra=require(_0x4d63('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d63('0x4'));var controller=require(_0x4d63('0x5'));router[_0x4d63('0x6')](_0x4d63('0x7'),auth[_0x4d63('0x8')](),controller[_0x4d63('0x9')]);router[_0x4d63('0xa')](_0x4d63('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8fcc=['../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x8fcc,0x166));var _0xc8fc=function(_0x3ce9fd,_0x5a3723){_0x3ce9fd=_0x3ce9fd-0x0;var _0x4da2eb=_0x8fcc[_0x3ce9fd];return _0x4da2eb;};'use strict';var multer=require('multer');var util=require(_0xc8fc('0x0'));var path=require(_0xc8fc('0x1'));var timeout=require(_0xc8fc('0x2'));var express=require(_0xc8fc('0x3'));var router=express[_0xc8fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc8fc('0x5'));var interaction=require(_0xc8fc('0x6'));var config=require(_0xc8fc('0x7'));var controller=require(_0xc8fc('0x8'));router[_0xc8fc('0x9')]('/:id',auth[_0xc8fc('0xa')](),controller[_0xc8fc('0xb')]);router['delete']('/:id',auth[_0xc8fc('0xa')](),controller[_0xc8fc('0xc')]);module[_0xc8fc('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 2132fff..ee12b99 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x1364da,_0x5cd71f){var _0x66113b=function(_0x3a77c2){while(--_0x3a77c2){_0x1364da['push'](_0x1364da['shift']());}};_0x66113b(++_0x5cd71f);}(_0x2032,0xd9));var _0x2203=function(_0x3bf18a,_0x318425){_0x3bf18a=_0x3bf18a-0x0;var _0x4e15c2=_0x2032[_0x3bf18a];return _0x4e15c2;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe706,0xa3));var _0x6e70=function(_0x5982a5,_0x3dc07b){_0x5982a5=_0x5982a5-0x0;var _0x159c80=_0xe706[_0x5982a5];return _0x159c80;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b09d253..07aef4d 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 _0x1ff4=['stringify','addItem','DashboardId','getItems','findOne','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','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','stack','name','send','index','map','rawAttributes','fieldName','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','type','filter','merge','options','Dashboard','includeAll','include','findAll','rows','catch','show','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','autoAssociation','error','clone','params','omit','updatedAt','body','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s'];(function(_0x43c0d8,_0x59449e){var _0x255aaf=function(_0x204b32){while(--_0x204b32){_0x43c0d8['push'](_0x43c0d8['shift']());}};_0x255aaf(++_0x59449e);}(_0x1ff4,0x8d));var _0x41ff=function(_0x1bcff0,_0x1a06cc){_0x1bcff0=_0x1bcff0-0x0;var _0x1c949d=_0x1ff4[_0x1bcff0];return _0x1c949d;};'use strict';var emlformat=require(_0x41ff('0x0'));var rimraf=require(_0x41ff('0x1'));var zipdir=require(_0x41ff('0x2'));var jsonpatch=require(_0x41ff('0x3'));var rp=require(_0x41ff('0x4'));var moment=require(_0x41ff('0x5'));var BPromise=require(_0x41ff('0x6'));var Mustache=require(_0x41ff('0x7'));var util=require(_0x41ff('0x8'));var path=require(_0x41ff('0x9'));var sox=require(_0x41ff('0xa'));var csv=require(_0x41ff('0xb'));var ejs=require(_0x41ff('0xc'));var fs=require('fs');var fs_extra=require(_0x41ff('0xd'));var _=require(_0x41ff('0xe'));var squel=require(_0x41ff('0xf'));var crypto=require(_0x41ff('0x10'));var jsforce=require(_0x41ff('0x11'));var deskjs=require(_0x41ff('0x12'));var toCsv=require(_0x41ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41ff('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x41ff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41ff('0x15'));var logger=require('../../config/logger')(_0x41ff('0x16'));var utils=require(_0x41ff('0x17'));var config=require(_0x41ff('0x18'));var licenseUtil=require(_0x41ff('0x19'));var db=require('../../mysqldb')['db'];config[_0x41ff('0x1a')]=_[_0x41ff('0x1b')](config[_0x41ff('0x1a')],{'host':_0x41ff('0x1c'),'port':0x18eb});var socket=require(_0x41ff('0x1d'))(new Redis(config[_0x41ff('0x1a')]));require(_0x41ff('0x1e'))[_0x41ff('0x1f')](socket);function respondWithStatusCode(_0x57e2fc,_0x309f8e){_0x309f8e=_0x309f8e||0xcc;return function(_0x18a025){if(_0x18a025){return _0x57e2fc[_0x41ff('0x20')](_0x309f8e);}return _0x57e2fc[_0x41ff('0x21')](_0x309f8e)[_0x41ff('0x22')]();};}function respondWithResult(_0x3aa551,_0x342c5b){_0x342c5b=_0x342c5b||0xc8;return function(_0x297f98){if(_0x297f98){return _0x3aa551['status'](_0x342c5b)[_0x41ff('0x23')](_0x297f98);}};}function respondWithFilteredResult(_0x29bdbc,_0x2854a3){return function(_0x6cb750){if(_0x6cb750){var _0x1cc17b=typeof _0x2854a3['offset']===_0x41ff('0x24')&&typeof _0x2854a3['limit']===_0x41ff('0x24');var _0x10ccb8=_0x6cb750[_0x41ff('0x25')];var _0x4bc720=_0x1cc17b?0x0:_0x2854a3[_0x41ff('0x26')];var _0x4f329b=_0x1cc17b?_0x6cb750[_0x41ff('0x25')]:_0x2854a3[_0x41ff('0x26')]+_0x2854a3['limit'];var _0x27740a;if(_0x4f329b>=_0x10ccb8){_0x4f329b=_0x10ccb8;_0x27740a=0xc8;}else{_0x27740a=0xce;}_0x29bdbc[_0x41ff('0x21')](_0x27740a);return _0x29bdbc[_0x41ff('0x27')](_0x41ff('0x28'),_0x4bc720+'-'+_0x4f329b+'/'+_0x10ccb8)[_0x41ff('0x23')](_0x6cb750);}return null;};}function patchUpdates(_0x2d1455){return function(_0xa11725){try{jsonpatch[_0x41ff('0x29')](_0xa11725,_0x2d1455,!![]);}catch(_0xf62ed9){return BPromise[_0x41ff('0x2a')](_0xf62ed9);}return _0xa11725[_0x41ff('0x2b')]();};}function saveUpdates(_0x326bd8,_0x4a1f07){return function(_0x40eba9){if(_0x40eba9){return _0x40eba9[_0x41ff('0x2c')](_0x326bd8)['then'](function(_0x48b7b3){return _0x48b7b3;});}return null;};}function removeEntity(_0x40954c,_0x36a5ca){return function(_0x3307d6){if(_0x3307d6){return _0x3307d6[_0x41ff('0x2d')]()['then'](function(){var _0x3ae6e4=_0x3307d6[_0x41ff('0x2e')]({'plain':!![]});var _0x16296c='CustomDashboards';return db[_0x41ff('0x2f')]['destroy']({'where':{'type':_0x16296c,'resourceId':_0x3ae6e4['id']}})[_0x41ff('0x30')](function(){return _0x3307d6;});})[_0x41ff('0x30')](function(){_0x40954c[_0x41ff('0x21')](0xcc)[_0x41ff('0x22')]();});}};}function handleEntityNotFound(_0x1befc3,_0x2c1e70){return function(_0x1f0267){if(!_0x1f0267){_0x1befc3[_0x41ff('0x20')](0x194);}return _0x1f0267;};}function handleError(_0x3a678c,_0xed2492){_0xed2492=_0xed2492||0x1f4;return function(_0xd8e883){logger['error'](_0xd8e883[_0x41ff('0x31')]);if(_0xd8e883[_0x41ff('0x32')]){delete _0xd8e883[_0x41ff('0x32')];}_0x3a678c[_0x41ff('0x21')](_0xed2492)[_0x41ff('0x33')](_0xd8e883);};}exports[_0x41ff('0x34')]=function(_0x2ad63f,_0x1421ba){var _0x3cb51e={},_0x3c6bce={},_0xd47d75={'count':0x0,'rows':[]};var _0x521f0f=_[_0x41ff('0x35')](db['Dashboard'][_0x41ff('0x36')],function(_0x10252b){return{'name':_0x10252b[_0x41ff('0x37')],'type':_0x10252b['type']['key']};});_0x3c6bce['model']=_[_0x41ff('0x35')](_0x521f0f,_0x41ff('0x32'));_0x3c6bce[_0x41ff('0x38')]=_[_0x41ff('0x39')](_0x2ad63f['query']);_0x3c6bce['filters']=_[_0x41ff('0x3a')](_0x3c6bce['model'],_0x3c6bce[_0x41ff('0x38')]);_0x3cb51e[_0x41ff('0x3b')]=_[_0x41ff('0x3a')](_0x3c6bce[_0x41ff('0x3c')],qs[_0x41ff('0x3d')](_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x3cb51e['attributes']=_0x3cb51e[_0x41ff('0x3b')]['length']?_0x3cb51e[_0x41ff('0x3b')]:_0x3c6bce[_0x41ff('0x3c')];if(!_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x3e')](_0x41ff('0x3f'))){_0x3cb51e[_0x41ff('0x40')]=qs['limit'](_0x2ad63f['query'][_0x41ff('0x40')]);_0x3cb51e[_0x41ff('0x26')]=qs['offset'](_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x26')]);}_0x3cb51e[_0x41ff('0x41')]=qs[_0x41ff('0x42')](_0x2ad63f['query'][_0x41ff('0x42')]);_0x3cb51e['where']=qs[_0x41ff('0x43')](_[_0x41ff('0x44')](_0x2ad63f[_0x41ff('0x38')],_0x3c6bce[_0x41ff('0x43')]),_0x521f0f);if(_0x2ad63f[_0x41ff('0x38')]['filter']){_0x3cb51e[_0x41ff('0x45')]=_['merge'](_0x3cb51e[_0x41ff('0x45')],{'$or':_[_0x41ff('0x35')](_0x521f0f,function(_0x4e8335){if(_0x4e8335[_0x41ff('0x46')]!=='VIRTUAL'){var _0x4052b4={};_0x4052b4[_0x4e8335[_0x41ff('0x32')]]={'$like':'%'+_0x2ad63f[_0x41ff('0x38')][_0x41ff('0x47')]+'%'};return _0x4052b4;}})});}_0x3cb51e=_[_0x41ff('0x48')]({},_0x3cb51e,_0x2ad63f[_0x41ff('0x49')]);var _0x18e971={'where':_0x3cb51e[_0x41ff('0x45')]};return db[_0x41ff('0x4a')][_0x41ff('0x25')](_0x18e971)[_0x41ff('0x30')](function(_0x173baf){_0xd47d75[_0x41ff('0x25')]=_0x173baf;if(_0x2ad63f['query'][_0x41ff('0x4b')]){_0x3cb51e[_0x41ff('0x4c')]=[{'all':!![]}];}return db[_0x41ff('0x4a')][_0x41ff('0x4d')](_0x3cb51e);})[_0x41ff('0x30')](function(_0x3ce0b6){_0xd47d75[_0x41ff('0x4e')]=_0x3ce0b6;return _0xd47d75;})[_0x41ff('0x30')](respondWithFilteredResult(_0x1421ba,_0x3cb51e))[_0x41ff('0x4f')](handleError(_0x1421ba,null));};exports[_0x41ff('0x50')]=function(_0x4b1c35,_0x100e66){var _0x493d36={'raw':![],'where':{'id':_0x4b1c35['params']['id']}},_0x5ea425={};_0x5ea425[_0x41ff('0x3c')]=_['keys'](db[_0x41ff('0x4a')]['rawAttributes']);_0x5ea425[_0x41ff('0x38')]=_[_0x41ff('0x39')](_0x4b1c35[_0x41ff('0x38')]);_0x5ea425[_0x41ff('0x43')]=_[_0x41ff('0x3a')](_0x5ea425['model'],_0x5ea425[_0x41ff('0x38')]);_0x493d36[_0x41ff('0x3b')]=_[_0x41ff('0x3a')](_0x5ea425[_0x41ff('0x3c')],qs['fields'](_0x4b1c35[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x493d36[_0x41ff('0x3b')]=_0x493d36[_0x41ff('0x3b')][_0x41ff('0x51')]?_0x493d36['attributes']:_0x5ea425[_0x41ff('0x3c')];if(_0x4b1c35[_0x41ff('0x38')][_0x41ff('0x4b')]){_0x493d36['include']=[{'all':!![]}];}_0x493d36=_[_0x41ff('0x48')]({},_0x493d36,_0x4b1c35[_0x41ff('0x49')]);return db['Dashboard']['find'](_0x493d36)[_0x41ff('0x30')](handleEntityNotFound(_0x100e66,null))[_0x41ff('0x30')](respondWithResult(_0x100e66,null))[_0x41ff('0x4f')](handleError(_0x100e66,null));};exports[_0x41ff('0x52')]=function(_0x44e8e9,_0x7bdb26){return db[_0x41ff('0x4a')][_0x41ff('0x52')](_0x44e8e9['body'],{})[_0x41ff('0x30')](function(_0xd87b75){var _0x2b14ba=_0x44e8e9[_0x41ff('0x53')]['get']({'plain':!![]});if(!_0x2b14ba)throw new Error(_0x41ff('0x54'));if(_0x2b14ba[_0x41ff('0x55')]==='user'){var _0x5209ee=_0xd87b75[_0x41ff('0x2e')]({'plain':!![]});var _0x4394b0=_0x41ff('0x56');return db[_0x41ff('0x57')][_0x41ff('0x58')]({'where':{'name':_0x4394b0,'userProfileId':_0x2b14ba['userProfileId']},'raw':!![]})[_0x41ff('0x30')](function(_0x21d579){if(_0x21d579&&_0x21d579[_0x41ff('0x59')]===0x0){return db[_0x41ff('0x2f')][_0x41ff('0x52')]({'name':_0x5209ee[_0x41ff('0x32')],'resourceId':_0x5209ee['id'],'type':_0x21d579[_0x41ff('0x32')],'sectionId':_0x21d579['id']},{})[_0x41ff('0x30')](function(){return _0xd87b75;});}else{return _0xd87b75;}})[_0x41ff('0x4f')](function(_0x32d007){logger[_0x41ff('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d007);throw _0x32d007;});}return _0xd87b75;})[_0x41ff('0x30')](respondWithResult(_0x7bdb26,0xc9))[_0x41ff('0x4f')](handleError(_0x7bdb26,null));};exports[_0x41ff('0x5b')]=function(_0x486996,_0x309ef9){var _0x165194={'where':{'id':_0x486996[_0x41ff('0x5c')]['id']}},_0x314349={};_0x314349['model']=_['keys'](db[_0x41ff('0x4a')][_0x41ff('0x36')]);_0x165194['attributes']=_[_0x41ff('0x3a')](_0x314349[_0x41ff('0x3c')],qs['fields'](_0x486996[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x165194[_0x41ff('0x3b')]=_0x165194[_0x41ff('0x3b')]['length']?_0x165194[_0x41ff('0x3b')]:_0x314349[_0x41ff('0x3c')];if(_0x486996[_0x41ff('0x38')][_0x41ff('0x4b')]){_0x165194[_0x41ff('0x4c')]=[{'all':!![]}];}_0x165194=_[_0x41ff('0x48')]({},_0x165194,_0x486996[_0x41ff('0x49')]);return db['Dashboard'][_0x41ff('0x58')](_0x165194)[_0x41ff('0x30')](handleEntityNotFound(_0x309ef9,null))[_0x41ff('0x30')](function(_0xcbd45e){if(_0xcbd45e){var _0x641e7f=_0xcbd45e[_0x41ff('0x2e')]({'plain':!![]});_0x641e7f=qs[_0x41ff('0x5d')](_0x641e7f,['id','createdAt',_0x41ff('0x5e')]);_0x486996[_0x41ff('0x5f')]=_[_0x41ff('0x5d')](_0x486996[_0x41ff('0x5f')],['id',_0x41ff('0x60'),_0x41ff('0x5e')]);return db[_0x41ff('0x4a')][_0x41ff('0x52')](_['merge'](_0x641e7f,_0x486996[_0x41ff('0x5f')]),{'include':_0x486996[_0x41ff('0x38')][_0x41ff('0x4b')]?[{'all':!![]}]:undefined})[_0x41ff('0x30')](function(_0x88ae1f){var _0x47e09f=_0x486996[_0x41ff('0x53')][_0x41ff('0x2e')]({'plain':!![]});if(!_0x47e09f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47e09f[_0x41ff('0x55')]===_0x41ff('0x53')){var _0x58bd91=_0x88ae1f[_0x41ff('0x2e')]({'plain':!![]});var _0x433658=_0x41ff('0x56');return db[_0x41ff('0x57')][_0x41ff('0x58')]({'where':{'name':_0x433658,'userProfileId':_0x47e09f[_0x41ff('0x61')]},'raw':!![]})['then'](function(_0x23a626){if(_0x23a626&&_0x23a626[_0x41ff('0x59')]===0x0){return db[_0x41ff('0x2f')]['create']({'name':_0x58bd91[_0x41ff('0x32')],'resourceId':_0x58bd91['id'],'type':_0x23a626[_0x41ff('0x32')],'sectionId':_0x23a626['id']},{})['then'](function(){return _0x88ae1f;});}else{return _0x88ae1f;}})[_0x41ff('0x4f')](function(_0x52634a){logger['error'](_0x41ff('0x62'),_0x52634a);throw _0x52634a;});}return _0x88ae1f;});}})[_0x41ff('0x30')](respondWithResult(_0x309ef9,0xc9))[_0x41ff('0x4f')](handleError(_0x309ef9,null));};exports[_0x41ff('0x2c')]=function(_0x3a544a,_0x4a29cb){if(_0x3a544a[_0x41ff('0x5f')]['id']){delete _0x3a544a[_0x41ff('0x5f')]['id'];}return db[_0x41ff('0x4a')]['find']({'where':{'id':_0x3a544a[_0x41ff('0x5c')]['id']}})[_0x41ff('0x30')](handleEntityNotFound(_0x4a29cb,null))[_0x41ff('0x30')](saveUpdates(_0x3a544a[_0x41ff('0x5f')],null))[_0x41ff('0x30')](respondWithResult(_0x4a29cb,null))[_0x41ff('0x4f')](handleError(_0x4a29cb,null));};exports[_0x41ff('0x2d')]=function(_0x3076a7,_0xeb998d){return db['Dashboard']['find']({'where':{'id':_0x3076a7[_0x41ff('0x5c')]['id']}})[_0x41ff('0x30')](handleEntityNotFound(_0xeb998d,null))[_0x41ff('0x30')](removeEntity(_0xeb998d,null))['catch'](handleError(_0xeb998d,null));};function widgetAttributes(_0x865f51){try{switch(_0x865f51[_0x41ff('0x46')]){case _0x41ff('0x63'):return[{'name':_0x41ff('0x64'),'value':_0x865f51['attrUrl']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||_0x41ff('0x67')}];case _0x41ff('0x68'):return[{'name':_0x41ff('0x69'),'value':_0x865f51[_0x41ff('0x69')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x865f51[_0x41ff('0x6a')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||'HH:mm:ss'},{'name':_0x41ff('0x6b'),'value':_0x865f51[_0x41ff('0x6b')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51[_0x41ff('0x65')][0x1]['value']:undefined)||_0x41ff('0x6c')},{'name':'attrFontSize','value':_0x865f51[_0x41ff('0x6d')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x2]?_0x865f51['attrs'][0x2][_0x41ff('0x66')]:undefined)||0xc}];case _0x41ff('0x6e'):return[{'name':_0x41ff('0x6f'),'value':_0x865f51[_0x41ff('0x6f')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||_0x41ff('0x70')},{'name':'attrVoiceQueues','value':_0x865f51[_0x41ff('0x71')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51[_0x41ff('0x65')][0x1][_0x41ff('0x66')]:undefined)||[]},{'name':_0x41ff('0x6d'),'value':_0x865f51[_0x41ff('0x6d')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x2]?_0x865f51[_0x41ff('0x65')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x865f51[_0x41ff('0x72')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x3]?_0x865f51[_0x41ff('0x65')][0x3][_0x41ff('0x66')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x865f51[_0x41ff('0x73')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x4]?_0x865f51[_0x41ff('0x65')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x865f51[_0x41ff('0x74')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x5]?_0x865f51[_0x41ff('0x65')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x865f51[_0x41ff('0x75')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x6]?_0x865f51[_0x41ff('0x65')][0x6][_0x41ff('0x66')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x865f51['attrOpenchannelAccounts']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x7]?_0x865f51[_0x41ff('0x65')][0x7][_0x41ff('0x66')]:undefined)||''},{'name':_0x41ff('0x76'),'value':_0x865f51['attrWhatsappAccounts']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x8]?_0x865f51[_0x41ff('0x65')][0x8][_0x41ff('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x865f51[_0x41ff('0x77')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x9]?_0x865f51[_0x41ff('0x65')][0x9][_0x41ff('0x66')]:undefined)||''}];case _0x41ff('0x78'):case _0x41ff('0x79'):return[{'name':_0x41ff('0x7a'),'value':_0x865f51['attrSerie1']||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51[_0x41ff('0x65')][0x0][_0x41ff('0x66')]:undefined)||'total'},{'name':_0x41ff('0x7b'),'value':_0x865f51[_0x41ff('0x7b')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51['attrs'][0x1][_0x41ff('0x66')]:undefined)||null},{'name':_0x41ff('0x7c'),'value':_0x865f51['attrSerie3']||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x2]?_0x865f51['attrs'][0x2][_0x41ff('0x66')]:undefined)||null},{'name':_0x41ff('0x71'),'value':_0x865f51['attrVoiceQueues']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x3]?_0x865f51['attrs'][0x3][_0x41ff('0x66')]:undefined)||[]},{'name':_0x41ff('0x72'),'value':_0x865f51[_0x41ff('0x72')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x4]?_0x865f51[_0x41ff('0x65')][0x4][_0x41ff('0x66')]:undefined)||_0x41ff('0x7d')},{'name':_0x41ff('0x73'),'value':_0x865f51[_0x41ff('0x73')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x5]?_0x865f51[_0x41ff('0x65')][0x5][_0x41ff('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x865f51['attrFaxAccounts']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x6]?_0x865f51[_0x41ff('0x65')][0x6][_0x41ff('0x66')]:undefined)||''},{'name':_0x41ff('0x75'),'value':_0x865f51[_0x41ff('0x75')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x7]?_0x865f51[_0x41ff('0x65')][0x7]['value']:undefined)||''},{'name':_0x41ff('0x7e'),'value':_0x865f51[_0x41ff('0x7e')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x8]?_0x865f51['attrs'][0x8][_0x41ff('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x865f51[_0x41ff('0x76')]||(_0x865f51['attrs']&&_0x865f51[_0x41ff('0x65')][0x9]?_0x865f51[_0x41ff('0x65')][0x9][_0x41ff('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x865f51[_0x41ff('0x77')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0xa]?_0x865f51[_0x41ff('0x65')][0xa][_0x41ff('0x66')]:undefined)||''}];case _0x41ff('0x7f'):return[{'name':_0x41ff('0x80'),'type':_0x865f51['reportType']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x0]?_0x865f51['attrs'][0x0]['type']:undefined)||null,'value':_0x865f51['attrReport']||(_0x865f51[_0x41ff('0x65')]&&_0x865f51['attrs'][0x0]?_0x865f51[_0x41ff('0x65')][0x0]['value']:undefined)||null},{'name':_0x41ff('0x81'),'value':_0x865f51[_0x41ff('0x81')]||(_0x865f51[_0x41ff('0x65')]&&_0x865f51[_0x41ff('0x65')][0x1]?_0x865f51[_0x41ff('0x65')][0x1][_0x41ff('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x504106){logger[_0x41ff('0x5a')](_0x41ff('0x82'),JSON[_0x41ff('0x83')](_0x504106));return[];}}exports[_0x41ff('0x84')]=function(_0xd226e9,_0x1e2090,_0x25d5a6){if(_0xd226e9[_0x41ff('0x5f')]['id']){delete _0xd226e9[_0x41ff('0x5f')]['id'];}return db['Dashboard'][_0x41ff('0x58')]({'where':{'id':_0xd226e9['params']['id']}})[_0x41ff('0x30')](handleEntityNotFound(_0x1e2090,null))[_0x41ff('0x30')](function(_0x22fa61){if(_0x22fa61){_0xd226e9[_0x41ff('0x5f')][_0x41ff('0x85')]=_0x22fa61['id'];_0xd226e9[_0x41ff('0x5f')][_0x41ff('0x65')]=widgetAttributes(_0xd226e9[_0x41ff('0x5f')]);return db['DashboardItem'][_0x41ff('0x52')](_0xd226e9[_0x41ff('0x5f')]);}})[_0x41ff('0x30')](respondWithResult(_0x1e2090,null))[_0x41ff('0x4f')](handleError(_0x1e2090,null));};exports[_0x41ff('0x86')]=function(_0x379c97,_0xc2e4a8,_0x2fba78){var _0x1a09df={};var _0x16275b={};var _0x16e4e0;var _0x2a9f83;return db[_0x41ff('0x4a')][_0x41ff('0x87')]({'where':{'id':_0x379c97[_0x41ff('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc2e4a8,null))['then'](function(_0x9d657d){if(_0x9d657d){_0x16e4e0=_0x9d657d;_0x16275b[_0x41ff('0x3c')]=_[_0x41ff('0x39')](db['DashboardItem']['rawAttributes']);_0x16275b[_0x41ff('0x38')]=_['keys'](_0x379c97['query']);_0x16275b[_0x41ff('0x43')]=_[_0x41ff('0x3a')](_0x16275b[_0x41ff('0x3c')],_0x16275b[_0x41ff('0x38')]);_0x1a09df[_0x41ff('0x3b')]=_[_0x41ff('0x3a')](_0x16275b['model'],qs[_0x41ff('0x3d')](_0x379c97[_0x41ff('0x38')][_0x41ff('0x3d')]));_0x1a09df[_0x41ff('0x3b')]=_0x1a09df[_0x41ff('0x3b')][_0x41ff('0x51')]?_0x1a09df['attributes']:_0x16275b[_0x41ff('0x3c')];_0x1a09df['order']=qs[_0x41ff('0x42')](_0x379c97[_0x41ff('0x38')]['sort']);_0x1a09df[_0x41ff('0x45')]=qs[_0x41ff('0x43')](_[_0x41ff('0x44')](_0x379c97[_0x41ff('0x38')],_0x16275b['filters']));if(_0x379c97['query'][_0x41ff('0x47')]){_0x1a09df[_0x41ff('0x45')]=_[_0x41ff('0x48')](_0x1a09df[_0x41ff('0x45')],{'$or':_[_0x41ff('0x35')](_0x1a09df['attributes'],function(_0x5576d9){var _0x89966f={};_0x89966f[_0x5576d9]={'$like':'%'+_0x379c97[_0x41ff('0x38')]['filter']+'%'};return _0x89966f;})});}_0x1a09df=_['merge']({},_0x1a09df,_0x379c97[_0x41ff('0x49')]);return _0x16e4e0[_0x41ff('0x86')](_0x1a09df);}})[_0x41ff('0x30')](function(_0x4e62c2){if(_0x4e62c2){_0x2a9f83=_0x4e62c2[_0x41ff('0x51')];if(!_0x379c97[_0x41ff('0x38')][_0x41ff('0x3e')]('nolimit')){_0x1a09df[_0x41ff('0x40')]=qs[_0x41ff('0x40')](_0x379c97[_0x41ff('0x38')][_0x41ff('0x40')]);_0x1a09df[_0x41ff('0x26')]=qs[_0x41ff('0x26')](_0x379c97[_0x41ff('0x38')][_0x41ff('0x26')]);}return _0x16e4e0[_0x41ff('0x86')](_0x1a09df);}})['then'](function(_0x3fcf78){if(_0x3fcf78){return _0x3fcf78?{'count':_0x2a9f83,'rows':_0x3fcf78}:null;}})['then'](respondWithResult(_0xc2e4a8,null))[_0x41ff('0x4f')](handleError(_0xc2e4a8,null));}; \ No newline at end of file +var _0x49eb=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','user','destroy','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','redis','defaults','localhost','./dashboard.socket','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','error','stack','name','Dashboard','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x49eb,0x136));var _0xb49e=function(_0x317db3,_0xef2070){_0x317db3=_0x317db3-0x0;var _0x593f60=_0x49eb[_0x317db3];return _0x593f60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb49e('0x0'));var zipdir=require(_0xb49e('0x1'));var jsonpatch=require(_0xb49e('0x2'));var rp=require(_0xb49e('0x3'));var moment=require('moment');var BPromise=require(_0xb49e('0x4'));var Mustache=require(_0xb49e('0x5'));var util=require(_0xb49e('0x6'));var path=require(_0xb49e('0x7'));var sox=require(_0xb49e('0x8'));var csv=require(_0xb49e('0x9'));var ejs=require(_0xb49e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb49e('0xb'));var jsforce=require(_0xb49e('0xc'));var deskjs=require(_0xb49e('0xd'));var toCsv=require(_0xb49e('0x9'));var querystring=require(_0xb49e('0xe'));var Papa=require(_0xb49e('0xf'));var Redis=require(_0xb49e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb49e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb49e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb49e('0x13'));var db=require('../../mysqldb')['db'];config[_0xb49e('0x14')]=_[_0xb49e('0x15')](config['redis'],{'host':_0xb49e('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb49e('0x14')]));require(_0xb49e('0x17'))['register'](socket);function respondWithStatusCode(_0x44b0f7,_0x2f236b){_0x2f236b=_0x2f236b||0xcc;return function(_0x408276){if(_0x408276){return _0x44b0f7[_0xb49e('0x18')](_0x2f236b);}return _0x44b0f7['status'](_0x2f236b)[_0xb49e('0x19')]();};}function respondWithResult(_0x2ce41b,_0x52b337){_0x52b337=_0x52b337||0xc8;return function(_0x2fe530){if(_0x2fe530){return _0x2ce41b[_0xb49e('0x1a')](_0x52b337)['json'](_0x2fe530);}};}function respondWithFilteredResult(_0x10ca89,_0x27e40b){return function(_0x10b860){if(_0x10b860){var _0x3224e5=typeof _0x27e40b[_0xb49e('0x1b')]==='undefined'&&typeof _0x27e40b['limit']==='undefined';var _0x5cb83c=_0x10b860['count'];var _0x363671=_0x3224e5?0x0:_0x27e40b[_0xb49e('0x1b')];var _0x51051f=_0x3224e5?_0x10b860[_0xb49e('0x1c')]:_0x27e40b[_0xb49e('0x1b')]+_0x27e40b[_0xb49e('0x1d')];var _0x3bc626;if(_0x51051f>=_0x5cb83c){_0x51051f=_0x5cb83c;_0x3bc626=0xc8;}else{_0x3bc626=0xce;}_0x10ca89[_0xb49e('0x1a')](_0x3bc626);return _0x10ca89[_0xb49e('0x1e')](_0xb49e('0x1f'),_0x363671+'-'+_0x51051f+'/'+_0x5cb83c)[_0xb49e('0x20')](_0x10b860);}return null;};}function patchUpdates(_0x31e059){return function(_0x2eb8fa){try{jsonpatch[_0xb49e('0x21')](_0x2eb8fa,_0x31e059,!![]);}catch(_0x3ed729){return BPromise[_0xb49e('0x22')](_0x3ed729);}return _0x2eb8fa[_0xb49e('0x23')]();};}function saveUpdates(_0x122347,_0x180ba6){return function(_0x3cf825){if(_0x3cf825){return _0x3cf825[_0xb49e('0x24')](_0x122347)['then'](function(_0x517da7){return _0x517da7;});}return null;};}function removeEntity(_0x50306e,_0x50c5dc){return function(_0x2ff0ac){if(_0x2ff0ac){return _0x2ff0ac['destroy']()[_0xb49e('0x25')](function(){var _0x27f8e0=_0x2ff0ac[_0xb49e('0x26')]({'plain':!![]});var _0x15027f=_0xb49e('0x27');return db[_0xb49e('0x28')]['destroy']({'where':{'type':_0x15027f,'resourceId':_0x27f8e0['id']}})[_0xb49e('0x25')](function(){return _0x2ff0ac;});})[_0xb49e('0x25')](function(){_0x50306e[_0xb49e('0x1a')](0xcc)[_0xb49e('0x19')]();});}};}function handleEntityNotFound(_0x5c2228,_0x310f9d){return function(_0x45a9f3){if(!_0x45a9f3){_0x5c2228[_0xb49e('0x18')](0x194);}return _0x45a9f3;};}function handleError(_0x13ac58,_0x582c29){_0x582c29=_0x582c29||0x1f4;return function(_0x54ef88){logger[_0xb49e('0x29')](_0x54ef88[_0xb49e('0x2a')]);if(_0x54ef88[_0xb49e('0x2b')]){delete _0x54ef88[_0xb49e('0x2b')];}_0x13ac58['status'](_0x582c29)['send'](_0x54ef88);};}exports['index']=function(_0x1d86c9,_0x22a0e1){var _0x58c71e={},_0x2591ad={},_0x7c760b={'count':0x0,'rows':[]};var _0x4202dd=_['map'](db[_0xb49e('0x2c')][_0xb49e('0x2d')],function(_0x4fd55a){return{'name':_0x4fd55a[_0xb49e('0x2e')],'type':_0x4fd55a[_0xb49e('0x2f')][_0xb49e('0x30')]};});_0x2591ad[_0xb49e('0x31')]=_[_0xb49e('0x32')](_0x4202dd,'name');_0x2591ad['query']=_[_0xb49e('0x33')](_0x1d86c9[_0xb49e('0x34')]);_0x2591ad[_0xb49e('0x35')]=_[_0xb49e('0x36')](_0x2591ad[_0xb49e('0x31')],_0x2591ad['query']);_0x58c71e['attributes']=_['intersection'](_0x2591ad[_0xb49e('0x31')],qs[_0xb49e('0x37')](_0x1d86c9[_0xb49e('0x34')][_0xb49e('0x37')]));_0x58c71e[_0xb49e('0x38')]=_0x58c71e['attributes'][_0xb49e('0x39')]?_0x58c71e[_0xb49e('0x38')]:_0x2591ad[_0xb49e('0x31')];if(!_0x1d86c9[_0xb49e('0x34')][_0xb49e('0x3a')](_0xb49e('0x3b'))){_0x58c71e[_0xb49e('0x1d')]=qs[_0xb49e('0x1d')](_0x1d86c9[_0xb49e('0x34')]['limit']);_0x58c71e[_0xb49e('0x1b')]=qs[_0xb49e('0x1b')](_0x1d86c9['query']['offset']);}_0x58c71e[_0xb49e('0x3c')]=qs[_0xb49e('0x3d')](_0x1d86c9['query'][_0xb49e('0x3d')]);_0x58c71e[_0xb49e('0x3e')]=qs['filters'](_[_0xb49e('0x3f')](_0x1d86c9[_0xb49e('0x34')],_0x2591ad[_0xb49e('0x35')]),_0x4202dd);if(_0x1d86c9['query'][_0xb49e('0x40')]){_0x58c71e[_0xb49e('0x3e')]=_[_0xb49e('0x41')](_0x58c71e[_0xb49e('0x3e')],{'$or':_['map'](_0x4202dd,function(_0x5bbc4c){if(_0x5bbc4c['type']!=='VIRTUAL'){var _0x372dc7={};_0x372dc7[_0x5bbc4c[_0xb49e('0x2b')]]={'$like':'%'+_0x1d86c9['query']['filter']+'%'};return _0x372dc7;}})});}_0x58c71e=_[_0xb49e('0x41')]({},_0x58c71e,_0x1d86c9[_0xb49e('0x42')]);var _0x58cb18={'where':_0x58c71e['where']};return db[_0xb49e('0x2c')][_0xb49e('0x1c')](_0x58cb18)[_0xb49e('0x25')](function(_0x8c9177){_0x7c760b['count']=_0x8c9177;if(_0x1d86c9['query'][_0xb49e('0x43')]){_0x58c71e[_0xb49e('0x44')]=[{'all':!![]}];}return db[_0xb49e('0x2c')]['findAll'](_0x58c71e);})[_0xb49e('0x25')](function(_0x1166e0){_0x7c760b[_0xb49e('0x45')]=_0x1166e0;return _0x7c760b;})[_0xb49e('0x25')](respondWithFilteredResult(_0x22a0e1,_0x58c71e))[_0xb49e('0x46')](handleError(_0x22a0e1,null));};exports[_0xb49e('0x47')]=function(_0x3dcf1d,_0x242529){var _0x5b5ded={'raw':![],'where':{'id':_0x3dcf1d[_0xb49e('0x48')]['id']}},_0x463a0a={};_0x463a0a[_0xb49e('0x31')]=_['keys'](db[_0xb49e('0x2c')][_0xb49e('0x2d')]);_0x463a0a[_0xb49e('0x34')]=_['keys'](_0x3dcf1d[_0xb49e('0x34')]);_0x463a0a[_0xb49e('0x35')]=_[_0xb49e('0x36')](_0x463a0a[_0xb49e('0x31')],_0x463a0a[_0xb49e('0x34')]);_0x5b5ded[_0xb49e('0x38')]=_[_0xb49e('0x36')](_0x463a0a[_0xb49e('0x31')],qs[_0xb49e('0x37')](_0x3dcf1d[_0xb49e('0x34')][_0xb49e('0x37')]));_0x5b5ded['attributes']=_0x5b5ded[_0xb49e('0x38')][_0xb49e('0x39')]?_0x5b5ded['attributes']:_0x463a0a[_0xb49e('0x31')];if(_0x3dcf1d[_0xb49e('0x34')][_0xb49e('0x43')]){_0x5b5ded[_0xb49e('0x44')]=[{'all':!![]}];}_0x5b5ded=_[_0xb49e('0x41')]({},_0x5b5ded,_0x3dcf1d[_0xb49e('0x42')]);return db[_0xb49e('0x2c')][_0xb49e('0x49')](_0x5b5ded)[_0xb49e('0x25')](handleEntityNotFound(_0x242529,null))['then'](respondWithResult(_0x242529,null))['catch'](handleError(_0x242529,null));};exports[_0xb49e('0x4a')]=function(_0x2803ad,_0x1172e2){return db[_0xb49e('0x2c')][_0xb49e('0x4a')](_0x2803ad[_0xb49e('0x4b')],{})['then'](function(_0x449f90){var _0x2f9e02=_0x2803ad['user'][_0xb49e('0x26')]({'plain':!![]});if(!_0x2f9e02)throw new Error(_0xb49e('0x4c'));if(_0x2f9e02['role']==='user'){var _0x3ee14d=_0x449f90[_0xb49e('0x26')]({'plain':!![]});var _0xf50d3d=_0xb49e('0x27');return db[_0xb49e('0x4d')][_0xb49e('0x49')]({'where':{'name':_0xf50d3d,'userProfileId':_0x2f9e02[_0xb49e('0x4e')]},'raw':!![]})[_0xb49e('0x25')](function(_0x2e4c10){if(_0x2e4c10&&_0x2e4c10[_0xb49e('0x4f')]===0x0){return db[_0xb49e('0x28')]['create']({'name':_0x3ee14d[_0xb49e('0x2b')],'resourceId':_0x3ee14d['id'],'type':_0x2e4c10[_0xb49e('0x2b')],'sectionId':_0x2e4c10['id']},{})[_0xb49e('0x25')](function(){return _0x449f90;});}else{return _0x449f90;}})['catch'](function(_0x51b1a6){logger['error'](_0xb49e('0x50'),_0x51b1a6);throw _0x51b1a6;});}return _0x449f90;})[_0xb49e('0x25')](respondWithResult(_0x1172e2,0xc9))[_0xb49e('0x46')](handleError(_0x1172e2,null));};exports[_0xb49e('0x51')]=function(_0xa4f852,_0x41f907){var _0x42d7b3={'where':{'id':_0xa4f852[_0xb49e('0x48')]['id']}},_0x5219dd={};_0x5219dd['model']=_[_0xb49e('0x33')](db[_0xb49e('0x2c')][_0xb49e('0x2d')]);_0x42d7b3[_0xb49e('0x38')]=_[_0xb49e('0x36')](_0x5219dd[_0xb49e('0x31')],qs[_0xb49e('0x37')](_0xa4f852[_0xb49e('0x34')]['fields']));_0x42d7b3[_0xb49e('0x38')]=_0x42d7b3[_0xb49e('0x38')][_0xb49e('0x39')]?_0x42d7b3['attributes']:_0x5219dd[_0xb49e('0x31')];if(_0xa4f852[_0xb49e('0x34')][_0xb49e('0x43')]){_0x42d7b3[_0xb49e('0x44')]=[{'all':!![]}];}_0x42d7b3=_[_0xb49e('0x41')]({},_0x42d7b3,_0xa4f852[_0xb49e('0x42')]);return db[_0xb49e('0x2c')][_0xb49e('0x49')](_0x42d7b3)[_0xb49e('0x25')](handleEntityNotFound(_0x41f907,null))[_0xb49e('0x25')](function(_0x514795){if(_0x514795){var _0x5d7fc1=_0x514795[_0xb49e('0x26')]({'plain':!![]});_0x5d7fc1=qs[_0xb49e('0x52')](_0x5d7fc1,['id',_0xb49e('0x53'),'updatedAt']);_0xa4f852[_0xb49e('0x4b')]=_[_0xb49e('0x52')](_0xa4f852[_0xb49e('0x4b')],['id',_0xb49e('0x53'),'updatedAt']);return db[_0xb49e('0x2c')][_0xb49e('0x4a')](_[_0xb49e('0x41')](_0x5d7fc1,_0xa4f852[_0xb49e('0x4b')]),{'include':_0xa4f852[_0xb49e('0x34')][_0xb49e('0x43')]?[{'all':!![]}]:undefined})[_0xb49e('0x25')](function(_0x3e8b1e){var _0x4ea033=_0xa4f852[_0xb49e('0x54')][_0xb49e('0x26')]({'plain':!![]});if(!_0x4ea033)throw new Error(_0xb49e('0x4c'));if(_0x4ea033['role']===_0xb49e('0x54')){var _0x47ff5c=_0x3e8b1e[_0xb49e('0x26')]({'plain':!![]});var _0x1f7363='CustomDashboards';return db['UserProfileSection'][_0xb49e('0x49')]({'where':{'name':_0x1f7363,'userProfileId':_0x4ea033[_0xb49e('0x4e')]},'raw':!![]})[_0xb49e('0x25')](function(_0x29e74a){if(_0x29e74a&&_0x29e74a[_0xb49e('0x4f')]===0x0){return db[_0xb49e('0x28')][_0xb49e('0x4a')]({'name':_0x47ff5c['name'],'resourceId':_0x47ff5c['id'],'type':_0x29e74a[_0xb49e('0x2b')],'sectionId':_0x29e74a['id']},{})[_0xb49e('0x25')](function(){return _0x3e8b1e;});}else{return _0x3e8b1e;}})['catch'](function(_0x1afecd){logger[_0xb49e('0x29')](_0xb49e('0x50'),_0x1afecd);throw _0x1afecd;});}return _0x3e8b1e;});}})['then'](respondWithResult(_0x41f907,0xc9))[_0xb49e('0x46')](handleError(_0x41f907,null));};exports[_0xb49e('0x24')]=function(_0x3b40e9,_0xf96efe){if(_0x3b40e9[_0xb49e('0x4b')]['id']){delete _0x3b40e9[_0xb49e('0x4b')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x3b40e9[_0xb49e('0x48')]['id']}})[_0xb49e('0x25')](handleEntityNotFound(_0xf96efe,null))[_0xb49e('0x25')](saveUpdates(_0x3b40e9[_0xb49e('0x4b')],null))['then'](respondWithResult(_0xf96efe,null))['catch'](handleError(_0xf96efe,null));};exports[_0xb49e('0x55')]=function(_0x4fb79b,_0x178c92){return db[_0xb49e('0x2c')]['find']({'where':{'id':_0x4fb79b['params']['id']}})['then'](handleEntityNotFound(_0x178c92,null))[_0xb49e('0x25')](removeEntity(_0x178c92,null))[_0xb49e('0x46')](handleError(_0x178c92,null));};function widgetAttributes(_0x1e4774){try{switch(_0x1e4774[_0xb49e('0x2f')]){case _0xb49e('0x56'):return[{'name':_0xb49e('0x57'),'value':_0x1e4774[_0xb49e('0x57')]||(_0x1e4774['attrs']&&_0x1e4774[_0xb49e('0x58')][0x0]?_0x1e4774['attrs'][0x0][_0xb49e('0x59')]:undefined)||_0xb49e('0x5a')}];case _0xb49e('0x5b'):return[{'name':_0xb49e('0x5c'),'value':_0x1e4774[_0xb49e('0x5c')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x0]?_0x1e4774['attrs'][0x0][_0xb49e('0x59')]:undefined)||''}];case _0xb49e('0x5d'):return[{'name':_0xb49e('0x5e'),'value':_0x1e4774[_0xb49e('0x5e')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x0]?_0x1e4774[_0xb49e('0x58')][0x0][_0xb49e('0x59')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1e4774['attrTimezone']||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x1]?_0x1e4774['attrs'][0x1]['value']:undefined)||_0xb49e('0x5f')},{'name':_0xb49e('0x60'),'value':_0x1e4774[_0xb49e('0x60')]||(_0x1e4774['attrs']&&_0x1e4774[_0xb49e('0x58')][0x2]?_0x1e4774['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xb49e('0x61'),'value':_0x1e4774[_0xb49e('0x61')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x0]?_0x1e4774[_0xb49e('0x58')][0x0][_0xb49e('0x59')]:undefined)||_0xb49e('0x62')},{'name':_0xb49e('0x63'),'value':_0x1e4774[_0xb49e('0x63')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x1]?_0x1e4774['attrs'][0x1]['value']:undefined)||[]},{'name':_0xb49e('0x60'),'value':_0x1e4774[_0xb49e('0x60')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x2]?_0x1e4774[_0xb49e('0x58')][0x2][_0xb49e('0x59')]:undefined)||0x14},{'name':'attrChannel','value':_0x1e4774[_0xb49e('0x64')]||(_0x1e4774['attrs']&&_0x1e4774[_0xb49e('0x58')][0x3]?_0x1e4774[_0xb49e('0x58')][0x3]['value']:undefined)||_0xb49e('0x65')},{'name':_0xb49e('0x66'),'value':_0x1e4774[_0xb49e('0x66')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x4]?_0x1e4774['attrs'][0x4][_0xb49e('0x59')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1e4774['attrFaxAccounts']||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x5]?_0x1e4774[_0xb49e('0x58')][0x5][_0xb49e('0x59')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1e4774[_0xb49e('0x67')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774['attrs'][0x6]?_0x1e4774[_0xb49e('0x58')][0x6][_0xb49e('0x59')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1e4774[_0xb49e('0x68')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x7]?_0x1e4774['attrs'][0x7][_0xb49e('0x59')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1e4774[_0xb49e('0x69')]||(_0x1e4774['attrs']&&_0x1e4774['attrs'][0x8]?_0x1e4774[_0xb49e('0x58')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x1e4774[_0xb49e('0x6a')]||(_0x1e4774['attrs']&&_0x1e4774[_0xb49e('0x58')][0x9]?_0x1e4774['attrs'][0x9][_0xb49e('0x59')]:undefined)||''}];case _0xb49e('0x6b'):case'pie-chart':return[{'name':_0xb49e('0x6c'),'value':_0x1e4774[_0xb49e('0x6c')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x0]?_0x1e4774[_0xb49e('0x58')][0x0][_0xb49e('0x59')]:undefined)||_0xb49e('0x62')},{'name':_0xb49e('0x6d'),'value':_0x1e4774[_0xb49e('0x6d')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774['attrs'][0x1]?_0x1e4774[_0xb49e('0x58')][0x1][_0xb49e('0x59')]:undefined)||null},{'name':_0xb49e('0x6e'),'value':_0x1e4774[_0xb49e('0x6e')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x2]?_0x1e4774[_0xb49e('0x58')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x1e4774['attrVoiceQueues']||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x3]?_0x1e4774[_0xb49e('0x58')][0x3][_0xb49e('0x59')]:undefined)||[]},{'name':_0xb49e('0x64'),'value':_0x1e4774[_0xb49e('0x64')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x4]?_0x1e4774['attrs'][0x4][_0xb49e('0x59')]:undefined)||_0xb49e('0x65')},{'name':_0xb49e('0x66'),'value':_0x1e4774['attrEmailAccounts']||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x5]?_0x1e4774[_0xb49e('0x58')][0x5][_0xb49e('0x59')]:undefined)||''},{'name':_0xb49e('0x6f'),'value':_0x1e4774[_0xb49e('0x6f')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x6]?_0x1e4774[_0xb49e('0x58')][0x6][_0xb49e('0x59')]:undefined)||''},{'name':_0xb49e('0x67'),'value':_0x1e4774['attrSmsAccounts']||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774['attrs'][0x7]?_0x1e4774[_0xb49e('0x58')][0x7][_0xb49e('0x59')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1e4774[_0xb49e('0x68')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x8]?_0x1e4774[_0xb49e('0x58')][0x8][_0xb49e('0x59')]:undefined)||''},{'name':_0xb49e('0x69'),'value':_0x1e4774[_0xb49e('0x69')]||(_0x1e4774['attrs']&&_0x1e4774[_0xb49e('0x58')][0x9]?_0x1e4774[_0xb49e('0x58')][0x9]['value']:undefined)||''},{'name':_0xb49e('0x6a'),'value':_0x1e4774[_0xb49e('0x6a')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0xa]?_0x1e4774[_0xb49e('0x58')][0xa][_0xb49e('0x59')]:undefined)||''}];case _0xb49e('0x70'):return[{'name':_0xb49e('0x71'),'type':_0x1e4774[_0xb49e('0x72')]||(_0x1e4774['attrs']&&_0x1e4774['attrs'][0x0]?_0x1e4774[_0xb49e('0x58')][0x0][_0xb49e('0x2f')]:undefined)||null,'value':_0x1e4774['attrReport']||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x0]?_0x1e4774[_0xb49e('0x58')][0x0][_0xb49e('0x59')]:undefined)||null},{'name':_0xb49e('0x73'),'value':_0x1e4774[_0xb49e('0x73')]||(_0x1e4774[_0xb49e('0x58')]&&_0x1e4774[_0xb49e('0x58')][0x1]?_0x1e4774['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2752d8){logger[_0xb49e('0x29')](_0xb49e('0x74'),JSON[_0xb49e('0x75')](_0x2752d8));return[];}}exports[_0xb49e('0x76')]=function(_0x3fe439,_0x24c43e,_0x55e019){if(_0x3fe439[_0xb49e('0x4b')]['id']){delete _0x3fe439[_0xb49e('0x4b')]['id'];}return db['Dashboard'][_0xb49e('0x49')]({'where':{'id':_0x3fe439['params']['id']}})[_0xb49e('0x25')](handleEntityNotFound(_0x24c43e,null))[_0xb49e('0x25')](function(_0x5dffcc){if(_0x5dffcc){_0x3fe439[_0xb49e('0x4b')]['DashboardId']=_0x5dffcc['id'];_0x3fe439[_0xb49e('0x4b')][_0xb49e('0x58')]=widgetAttributes(_0x3fe439[_0xb49e('0x4b')]);return db[_0xb49e('0x77')][_0xb49e('0x4a')](_0x3fe439[_0xb49e('0x4b')]);}})['then'](respondWithResult(_0x24c43e,null))[_0xb49e('0x46')](handleError(_0x24c43e,null));};exports['getItems']=function(_0x312f8f,_0x506eb6,_0x50a924){var _0x1f972d={};var _0x5192df={};var _0x3bd253;var _0x5df366;return db[_0xb49e('0x2c')][_0xb49e('0x78')]({'where':{'id':_0x312f8f[_0xb49e('0x48')]['id']}})[_0xb49e('0x25')](handleEntityNotFound(_0x506eb6,null))[_0xb49e('0x25')](function(_0x9c8d52){if(_0x9c8d52){_0x3bd253=_0x9c8d52;_0x5192df[_0xb49e('0x31')]=_[_0xb49e('0x33')](db[_0xb49e('0x77')]['rawAttributes']);_0x5192df['query']=_[_0xb49e('0x33')](_0x312f8f['query']);_0x5192df[_0xb49e('0x35')]=_[_0xb49e('0x36')](_0x5192df[_0xb49e('0x31')],_0x5192df[_0xb49e('0x34')]);_0x1f972d[_0xb49e('0x38')]=_[_0xb49e('0x36')](_0x5192df[_0xb49e('0x31')],qs['fields'](_0x312f8f['query'][_0xb49e('0x37')]));_0x1f972d[_0xb49e('0x38')]=_0x1f972d['attributes']['length']?_0x1f972d[_0xb49e('0x38')]:_0x5192df[_0xb49e('0x31')];_0x1f972d['order']=qs['sort'](_0x312f8f['query'][_0xb49e('0x3d')]);_0x1f972d[_0xb49e('0x3e')]=qs['filters'](_[_0xb49e('0x3f')](_0x312f8f[_0xb49e('0x34')],_0x5192df['filters']));if(_0x312f8f['query'][_0xb49e('0x40')]){_0x1f972d[_0xb49e('0x3e')]=_[_0xb49e('0x41')](_0x1f972d['where'],{'$or':_[_0xb49e('0x32')](_0x1f972d[_0xb49e('0x38')],function(_0x5ce732){var _0xffe7ba={};_0xffe7ba[_0x5ce732]={'$like':'%'+_0x312f8f[_0xb49e('0x34')][_0xb49e('0x40')]+'%'};return _0xffe7ba;})});}_0x1f972d=_[_0xb49e('0x41')]({},_0x1f972d,_0x312f8f[_0xb49e('0x42')]);return _0x3bd253[_0xb49e('0x79')](_0x1f972d);}})['then'](function(_0x3d21fd){if(_0x3d21fd){_0x5df366=_0x3d21fd[_0xb49e('0x39')];if(!_0x312f8f[_0xb49e('0x34')][_0xb49e('0x3a')](_0xb49e('0x3b'))){_0x1f972d[_0xb49e('0x1d')]=qs[_0xb49e('0x1d')](_0x312f8f['query'][_0xb49e('0x1d')]);_0x1f972d['offset']=qs[_0xb49e('0x1b')](_0x312f8f[_0xb49e('0x34')][_0xb49e('0x1b')]);}return _0x3bd253[_0xb49e('0x79')](_0x1f972d);}})['then'](function(_0x335a2a){if(_0x335a2a){return _0x335a2a?{'count':_0x5df366,'rows':_0x335a2a}:null;}})['then'](respondWithResult(_0x506eb6,null))[_0xb49e('0x46')](handleError(_0x506eb6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 0f7af11..003046c 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 _0x7bb9=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x20b0f6,_0x5094bf){var _0x515207=function(_0x4a42c8){while(--_0x4a42c8){_0x20b0f6['push'](_0x20b0f6['shift']());}};_0x515207(++_0x5094bf);}(_0x7bb9,0x89));var _0x97bb=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x7bb9[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0x97bb('0x0'));var Dashboard=require(_0x97bb('0x1'))['db'][_0x97bb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x97bb('0x3')](0x0);var events={'afterCreate':_0x97bb('0x4'),'afterUpdate':'update','afterDestroy':_0x97bb('0x5')};function emitEvent(_0x20b061){return function(_0x3c0cd6,_0x1c3f67,_0x2ae3af){DashboardEvents[_0x97bb('0x6')](_0x20b061+':'+_0x3c0cd6['id'],_0x3c0cd6);DashboardEvents[_0x97bb('0x6')](_0x20b061,_0x3c0cd6);_0x2ae3af(null);};}for(var e in events){if(events[_0x97bb('0x7')](e)){var event=events[e];Dashboard[_0x97bb('0x8')](e,emitEvent(event));}}module[_0x97bb('0x9')]=DashboardEvents; \ No newline at end of file +var _0x2e41=['../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e41,0x15e));var _0x12e4=function(_0x2f31d0,_0x4fce9a){_0x2f31d0=_0x2f31d0-0x0;var _0x1d0256=_0x2e41[_0x2f31d0];return _0x1d0256;};'use strict';var EventEmitter=require(_0x12e4('0x0'));var Dashboard=require(_0x12e4('0x1'))['db'][_0x12e4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x12e4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x12e4('0x4'),'afterDestroy':_0x12e4('0x5')};function emitEvent(_0x24f685){return function(_0x1e70b1,_0x40230e,_0x4245d8){DashboardEvents[_0x12e4('0x6')](_0x24f685+':'+_0x1e70b1['id'],_0x1e70b1);DashboardEvents[_0x12e4('0x6')](_0x24f685,_0x1e70b1);_0x4245d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x12e4('0x7')](e,emitEvent(event));}}module[_0x12e4('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 586fdd5..42f8cae 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 _0xd6a8=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd6a8,0xf7));var _0x8d6a=function(_0x52864f,_0x5b4cdd){_0x52864f=_0x52864f-0x0;var _0x36fa26=_0xd6a8[_0x52864f];return _0x36fa26;};'use strict';var _=require(_0x8d6a('0x0'));var util=require(_0x8d6a('0x1'));var logger=require(_0x8d6a('0x2'))(_0x8d6a('0x3'));var moment=require(_0x8d6a('0x4'));var BPromise=require(_0x8d6a('0x5'));var rp=require(_0x8d6a('0x6'));var fs=require('fs');var path=require(_0x8d6a('0x7'));var rimraf=require(_0x8d6a('0x8'));var config=require(_0x8d6a('0x9'));var attributes=require(_0x8d6a('0xa'));module[_0x8d6a('0xb')]=function(_0x54177b,_0x117eb6){return _0x54177b[_0x8d6a('0xc')]('Dashboard',attributes,{'tableName':_0x8d6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d2=['dashboards','lodash','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dashboard'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0xa5d2,0xe7));var _0x2a5d=function(_0x4a81ad,_0x426f56){_0x4a81ad=_0x4a81ad-0x0;var _0x577cdb=_0xa5d2[_0x4a81ad];return _0x577cdb;};'use strict';var _=require(_0x2a5d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a5d('0x1'));var rp=require(_0x2a5d('0x2'));var fs=require('fs');var path=require(_0x2a5d('0x3'));var rimraf=require(_0x2a5d('0x4'));var config=require(_0x2a5d('0x5'));var attributes=require('./dashboard.attributes');module[_0x2a5d('0x6')]=function(_0x23cda1,_0x37ad86){return _0x23cda1[_0x2a5d('0x7')](_0x2a5d('0x8'),attributes,{'tableName':_0x2a5d('0x9'),'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 80d428c..283800a 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 _0x1d01=['request','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','./dashboard.socket','register'];(function(_0x4710ed,_0x211c8c){var _0x3c1e56=function(_0x3ec711){while(--_0x3ec711){_0x4710ed['push'](_0x4710ed['shift']());}};_0x3c1e56(++_0x211c8c);}(_0x1d01,0xb7));var _0x11d0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d01[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x11d0('0x0'));var util=require(_0x11d0('0x1'));var moment=require(_0x11d0('0x2'));var BPromise=require(_0x11d0('0x3'));var rs=require(_0x11d0('0x4'));var fs=require('fs');var Redis=require(_0x11d0('0x5'));var db=require(_0x11d0('0x6'))['db'];var utils=require(_0x11d0('0x7'));var logger=require(_0x11d0('0x8'))(_0x11d0('0x9'));var config=require(_0x11d0('0xa'));var jayson=require(_0x11d0('0xb'));var client=jayson[_0x11d0('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x11d0('0xd'))[_0x11d0('0xe')](socket);function respondWithRpcPromise(_0x31d546,_0x5f3ae2,_0x3f9def){return new BPromise(function(_0x146dff,_0x4a741f){return client[_0x11d0('0xf')](_0x31d546,_0x3f9def)['then'](function(_0x20e5e3){logger[_0x11d0('0x10')](_0x11d0('0x11'),_0x5f3ae2,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x5f3ae2,_0x11d0('0x12'),JSON[_0x11d0('0x13')](_0x20e5e3));if(_0x20e5e3[_0x11d0('0x14')]){if(_0x20e5e3[_0x11d0('0x14')]['code']===0x1f4){logger[_0x11d0('0x14')]('Dashboard,\x20%s,\x20%s',_0x5f3ae2,_0x20e5e3[_0x11d0('0x14')][_0x11d0('0x15')]);return _0x4a741f(_0x20e5e3[_0x11d0('0x14')][_0x11d0('0x15')]);}logger[_0x11d0('0x14')](_0x11d0('0x11'),_0x5f3ae2,_0x20e5e3[_0x11d0('0x14')][_0x11d0('0x15')]);return _0x146dff(_0x20e5e3[_0x11d0('0x14')]['message']);}else{logger[_0x11d0('0x10')](_0x11d0('0x11'),_0x5f3ae2,_0x11d0('0x12'));_0x146dff(_0x20e5e3['result'][_0x11d0('0x15')]);}})['catch'](function(_0x5d01c0){logger[_0x11d0('0x14')]('Dashboard,\x20%s,\x20%s',_0x5f3ae2,_0x5d01c0);_0x4a741f(_0x5d01c0);});});} \ No newline at end of file +var _0xa2c0=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','util','moment','bluebird'];(function(_0x51bf0f,_0x3b3cfb){var _0x5c8633=function(_0x13ae1a){while(--_0x13ae1a){_0x51bf0f['push'](_0x51bf0f['shift']());}};_0x5c8633(++_0x3b3cfb);}(_0xa2c0,0x1ea));var _0x0a2c=function(_0x28168c,_0x54ef13){_0x28168c=_0x28168c-0x0;var _0x5a2062=_0xa2c0[_0x28168c];return _0x5a2062;};'use strict';var _=require('lodash');var util=require(_0x0a2c('0x0'));var moment=require(_0x0a2c('0x1'));var BPromise=require(_0x0a2c('0x2'));var rs=require(_0x0a2c('0x3'));var fs=require('fs');var Redis=require(_0x0a2c('0x4'));var db=require(_0x0a2c('0x5'))['db'];var utils=require(_0x0a2c('0x6'));var logger=require('../../config/logger')(_0x0a2c('0x7'));var config=require(_0x0a2c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a2c('0x9')][_0x0a2c('0xa')]({'port':0x232a});config[_0x0a2c('0xb')]=_[_0x0a2c('0xc')](config['redis'],{'host':_0x0a2c('0xd'),'port':0x18eb});var socket=require(_0x0a2c('0xe'))(new Redis(config[_0x0a2c('0xb')]));require(_0x0a2c('0xf'))[_0x0a2c('0x10')](socket);function respondWithRpcPromise(_0x5d3de4,_0x174752,_0x3ec160){return new BPromise(function(_0x2f79ad,_0x25620f){return client[_0x0a2c('0x11')](_0x5d3de4,_0x3ec160)['then'](function(_0x453594){logger[_0x0a2c('0x12')]('Dashboard,\x20%s,\x20%s',_0x174752,_0x0a2c('0x13'));logger[_0x0a2c('0x14')](_0x0a2c('0x15'),_0x174752,'request\x20sent',JSON[_0x0a2c('0x16')](_0x453594));if(_0x453594[_0x0a2c('0x17')]){if(_0x453594[_0x0a2c('0x17')][_0x0a2c('0x18')]===0x1f4){logger[_0x0a2c('0x17')]('Dashboard,\x20%s,\x20%s',_0x174752,_0x453594['error'][_0x0a2c('0x19')]);return _0x25620f(_0x453594['error'][_0x0a2c('0x19')]);}logger[_0x0a2c('0x17')](_0x0a2c('0x1a'),_0x174752,_0x453594[_0x0a2c('0x17')][_0x0a2c('0x19')]);return _0x2f79ad(_0x453594['error'][_0x0a2c('0x19')]);}else{logger[_0x0a2c('0x12')]('Dashboard,\x20%s,\x20%s',_0x174752,_0x0a2c('0x13'));_0x2f79ad(_0x453594[_0x0a2c('0x1b')][_0x0a2c('0x19')]);}})[_0x0a2c('0x1c')](function(_0x2d8910){logger['error']('Dashboard,\x20%s,\x20%s',_0x174752,_0x2d8910);_0x25620f(_0x2d8910);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 427c90e..c4e47ac 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 _0x0b44=['length','dashboard:','./dashboard.events','save','remove','emit'];(function(_0x3ac8f5,_0x4853c3){var _0x55b14c=function(_0x1da7a0){while(--_0x1da7a0){_0x3ac8f5['push'](_0x3ac8f5['shift']());}};_0x55b14c(++_0x4853c3);}(_0x0b44,0x104));var _0x40b4=function(_0x137301,_0x10fdfd){_0x137301=_0x137301-0x0;var _0x404768=_0x0b44[_0x137301];return _0x404768;};'use strict';var DashboardEvents=require(_0x40b4('0x0'));var events=[_0x40b4('0x1'),_0x40b4('0x2'),'update'];function createListener(_0x21c66e,_0x5f3527){return function(_0x510074){_0x5f3527[_0x40b4('0x3')](_0x21c66e,_0x510074);};}function removeListener(_0xe026b0,_0x621cc2){return function(){DashboardEvents['removeListener'](_0xe026b0,_0x621cc2);};}exports['register']=function(_0x384aae){for(var _0x1aadc2=0x0,_0x48dd1c=events[_0x40b4('0x4')];_0x1aadc2<_0x48dd1c;_0x1aadc2++){var _0x355c0d=events[_0x1aadc2];var _0x5082b8=createListener(_0x40b4('0x5')+_0x355c0d,_0x384aae);DashboardEvents['on'](_0x355c0d,_0x5082b8);}}; \ No newline at end of file +var _0x8789=['register','length','./dashboard.events','remove','update','emit','removeListener'];(function(_0x4edc38,_0x26867e){var _0x182c61=function(_0x39c3ed){while(--_0x39c3ed){_0x4edc38['push'](_0x4edc38['shift']());}};_0x182c61(++_0x26867e);}(_0x8789,0xbf));var _0x9878=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8789[_0x1d1779];return _0x2377e9;};'use strict';var DashboardEvents=require(_0x9878('0x0'));var events=['save',_0x9878('0x1'),_0x9878('0x2')];function createListener(_0x500f5a,_0x18fde0){return function(_0x5c13ff){_0x18fde0[_0x9878('0x3')](_0x500f5a,_0x5c13ff);};}function removeListener(_0xdb152,_0x8243fc){return function(){DashboardEvents[_0x9878('0x4')](_0xdb152,_0x8243fc);};}exports[_0x9878('0x5')]=function(_0x4496a5){for(var _0x1d13cb=0x0,_0x471d16=events[_0x9878('0x6')];_0x1d13cb<_0x471d16;_0x1d13cb++){var _0x7063bc=events[_0x1d13cb];var _0x4a5f4a=createListener('dashboard:'+_0x7063bc,_0x4496a5);DashboardEvents['on'](_0x7063bc,_0x4a5f4a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 393c902..e093028 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 _0x5a71=['../../config/environment','get','index','/:id','isAuthenticated','getItems','create','/:id/clone','post','addItem','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x356b35,_0x12c0f8){var _0x12fb6f=function(_0x4fba0d){while(--_0x4fba0d){_0x356b35['push'](_0x356b35['shift']());}};_0x12fb6f(++_0x12c0f8);}(_0x5a71,0x16f));var _0x15a7=function(_0x357b27,_0x1f1145){_0x357b27=_0x357b27-0x0;var _0x54a1a5=_0x5a71[_0x357b27];return _0x54a1a5;};'use strict';var multer=require(_0x15a7('0x0'));var util=require('util');var path=require(_0x15a7('0x1'));var timeout=require(_0x15a7('0x2'));var express=require(_0x15a7('0x3'));var router=express[_0x15a7('0x4')]();var fs_extra=require(_0x15a7('0x5'));var auth=require(_0x15a7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x15a7('0x7'));var controller=require('./dashboard.controller');router[_0x15a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x15a7('0x9')]);router[_0x15a7('0x8')](_0x15a7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x15a7('0x8')]('/:id/items',auth[_0x15a7('0xb')](),controller[_0x15a7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x15a7('0xd')]);router['post'](_0x15a7('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0x15a7('0xf')]('/:id/items',auth['isAuthenticated'](),controller[_0x15a7('0x10')]);router[_0x15a7('0x11')](_0x15a7('0xa'),auth[_0x15a7('0xb')](),controller[_0x15a7('0x12')]);router[_0x15a7('0x13')]('/:id',auth[_0x15a7('0xb')](),controller[_0x15a7('0x14')]);module[_0x15a7('0x15')]=router; \ No newline at end of file +var _0x4390=['/:id','show','/:id/items','getItems','create','/:id/clone','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index'];(function(_0x46d68b,_0x154971){var _0x3a7893=function(_0x17e56a){while(--_0x17e56a){_0x46d68b['push'](_0x46d68b['shift']());}};_0x3a7893(++_0x154971);}(_0x4390,0x1ee));var _0x0439=function(_0x51076f,_0x485004){_0x51076f=_0x51076f-0x0;var _0x598b52=_0x4390[_0x51076f];return _0x598b52;};'use strict';var multer=require(_0x0439('0x0'));var util=require(_0x0439('0x1'));var path=require(_0x0439('0x2'));var timeout=require(_0x0439('0x3'));var express=require(_0x0439('0x4'));var router=express['Router']();var fs_extra=require(_0x0439('0x5'));var auth=require(_0x0439('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0439('0x7'));var controller=require(_0x0439('0x8'));router[_0x0439('0x9')]('/',auth[_0x0439('0xa')](),controller[_0x0439('0xb')]);router[_0x0439('0x9')](_0x0439('0xc'),auth[_0x0439('0xa')](),controller[_0x0439('0xd')]);router[_0x0439('0x9')](_0x0439('0xe'),auth[_0x0439('0xa')](),controller[_0x0439('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0439('0x10')]);router['post'](_0x0439('0x11'),auth[_0x0439('0xa')](),controller['clone']);router[_0x0439('0x12')](_0x0439('0xe'),auth['isAuthenticated'](),controller['addItem']);router[_0x0439('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0439('0x14')]);router['delete'](_0x0439('0xc'),auth[_0x0439('0xa')](),controller[_0x0439('0x15')]);module[_0x0439('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 011226a..d16814f 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 _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0xcde75b,_0x1dfbbd){var _0x2dd868=function(_0xdab5a1){while(--_0xdab5a1){_0xcde75b['push'](_0xcde75b['shift']());}};_0x2dd868(++_0x1dfbbd);}(_0x6d38,0x1ef));var _0x86d3=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6d38[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x5d17,0x114));var _0x75d1=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x5d17[_0x2ce6d5];return _0x32d272;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'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 d637230..16d800a 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 _0x2a07=['attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x3eadcd,_0xda37b4){var _0x1bc036=function(_0x2d7346){while(--_0x2d7346){_0x3eadcd['push'](_0x3eadcd['shift']());}};_0x1bc036(++_0xda37b4);}(_0x2a07,0x74));var _0x72a0=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0x2a07[_0x58b6c7];return _0x5f50d0;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];config[_0x72a0('0x1c')]=_[_0x72a0('0x1d')](config[_0x72a0('0x1c')],{'host':_0x72a0('0x1e'),'port':0x18eb});var socket=require(_0x72a0('0x1f'))(new Redis(config[_0x72a0('0x1c')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0xe103dc,_0x3cd89f){_0x3cd89f=_0x3cd89f||0xcc;return function(_0x19eaf9){if(_0x19eaf9){return _0xe103dc[_0x72a0('0x20')](_0x3cd89f);}return _0xe103dc[_0x72a0('0x21')](_0x3cd89f)[_0x72a0('0x22')]();};}function respondWithResult(_0x4ab55e,_0x30248e){_0x30248e=_0x30248e||0xc8;return function(_0x2e7552){if(_0x2e7552){return _0x4ab55e[_0x72a0('0x21')](_0x30248e)[_0x72a0('0x23')](_0x2e7552);}};}function respondWithFilteredResult(_0x2d1e95,_0x54495e){return function(_0x100d8f){if(_0x100d8f){var _0x42e9ec=typeof _0x54495e[_0x72a0('0x24')]==='undefined'&&typeof _0x54495e[_0x72a0('0x25')]===_0x72a0('0x26');var _0x30899b=_0x100d8f[_0x72a0('0x27')];var _0x5437df=_0x42e9ec?0x0:_0x54495e[_0x72a0('0x24')];var _0x5b8f2c=_0x42e9ec?_0x100d8f[_0x72a0('0x27')]:_0x54495e[_0x72a0('0x24')]+_0x54495e[_0x72a0('0x25')];var _0x5c7479;if(_0x5b8f2c>=_0x30899b){_0x5b8f2c=_0x30899b;_0x5c7479=0xc8;}else{_0x5c7479=0xce;}_0x2d1e95[_0x72a0('0x21')](_0x5c7479);return _0x2d1e95[_0x72a0('0x28')](_0x72a0('0x29'),_0x5437df+'-'+_0x5b8f2c+'/'+_0x30899b)[_0x72a0('0x23')](_0x100d8f);}return null;};}function patchUpdates(_0x5d6145){return function(_0x38a7ba){try{jsonpatch[_0x72a0('0x2a')](_0x38a7ba,_0x5d6145,!![]);}catch(_0x1ddd54){return BPromise[_0x72a0('0x2b')](_0x1ddd54);}return _0x38a7ba[_0x72a0('0x2c')]();};}function saveUpdates(_0x174b1b,_0x5c4daf){return function(_0x4dd1a6){if(_0x4dd1a6){return _0x4dd1a6[_0x72a0('0x2d')](_0x174b1b)[_0x72a0('0x2e')](function(_0x123df4){return _0x123df4;});}return null;};}function removeEntity(_0x1504ed,_0xf5cb49){return function(_0x27ca5a){if(_0x27ca5a){return _0x27ca5a[_0x72a0('0x2f')]()[_0x72a0('0x2e')](function(){_0x1504ed[_0x72a0('0x21')](0xcc)[_0x72a0('0x22')]();});}};}function handleEntityNotFound(_0x4f9718,_0x304b92){return function(_0x553641){if(!_0x553641){_0x4f9718[_0x72a0('0x20')](0x194);}return _0x553641;};}function handleError(_0x2928f6,_0x1773ea){_0x1773ea=_0x1773ea||0x1f4;return function(_0x177a3a){logger[_0x72a0('0x30')](_0x177a3a[_0x72a0('0x31')]);if(_0x177a3a[_0x72a0('0x32')]){delete _0x177a3a[_0x72a0('0x32')];}_0x2928f6['status'](_0x1773ea)[_0x72a0('0x33')](_0x177a3a);};}exports[_0x72a0('0x34')]=function(_0x39136d,_0xfbe9b3){var _0x13c04={'raw':![],'where':{'id':_0x39136d[_0x72a0('0x35')]['id']}},_0x19e783={};_0x19e783['model']=_[_0x72a0('0x36')](db[_0x72a0('0x37')][_0x72a0('0x38')]);_0x19e783[_0x72a0('0x39')]=_[_0x72a0('0x36')](_0x39136d[_0x72a0('0x39')]);_0x19e783[_0x72a0('0x3a')]=_[_0x72a0('0x3b')](_0x19e783['model'],_0x19e783[_0x72a0('0x39')]);_0x13c04[_0x72a0('0x3c')]=_[_0x72a0('0x3b')](_0x19e783['model'],qs[_0x72a0('0x3d')](_0x39136d['query'][_0x72a0('0x3d')]));_0x13c04[_0x72a0('0x3c')]=_0x13c04[_0x72a0('0x3c')][_0x72a0('0x3e')]?_0x13c04[_0x72a0('0x3c')]:_0x19e783[_0x72a0('0x3f')];if(_0x39136d[_0x72a0('0x39')][_0x72a0('0x40')]){_0x13c04[_0x72a0('0x41')]=[{'all':!![]}];}_0x13c04=_[_0x72a0('0x42')]({},_0x13c04,_0x39136d[_0x72a0('0x43')]);return db[_0x72a0('0x37')]['find'](_0x13c04)[_0x72a0('0x2e')](handleEntityNotFound(_0xfbe9b3,null))['then'](respondWithResult(_0xfbe9b3,null))[_0x72a0('0x44')](handleError(_0xfbe9b3,null));};exports[_0x72a0('0x2f')]=function(_0x446222,_0x1a9597){return db[_0x72a0('0x37')][_0x72a0('0x45')]({'where':{'id':_0x446222[_0x72a0('0x35')]['id']}})[_0x72a0('0x2e')](handleEntityNotFound(_0x1a9597,null))[_0x72a0('0x2e')](removeEntity(_0x1a9597,null))['catch'](handleError(_0x1a9597,null));};function widgetAttributes(_0x4a973a){try{switch(_0x4a973a[_0x72a0('0x46')]){case _0x72a0('0x47'):return[{'name':_0x72a0('0x48'),'value':_0x4a973a[_0x72a0('0x48')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x0]?_0x4a973a[_0x72a0('0x49')][0x0][_0x72a0('0x4a')]:undefined)||'https://'}];case _0x72a0('0x4b'):return[{'name':'attrPath','value':_0x4a973a['attrPath']||(_0x4a973a['attrs']&&_0x4a973a[_0x72a0('0x49')][0x0]?_0x4a973a['attrs'][0x0][_0x72a0('0x4a')]:undefined)||''}];case _0x72a0('0x4c'):return[{'name':_0x72a0('0x4d'),'value':_0x4a973a[_0x72a0('0x4d')]||(_0x4a973a['attrs']&&_0x4a973a['attrs'][0x0]?_0x4a973a['attrs'][0x0]['value']:undefined)||_0x72a0('0x4e')},{'name':_0x72a0('0x4f'),'value':_0x4a973a['attrTimezone']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x1]?_0x4a973a['attrs'][0x1][_0x72a0('0x4a')]:undefined)||_0x72a0('0x50')},{'name':_0x72a0('0x51'),'value':_0x4a973a[_0x72a0('0x51')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x2]?_0x4a973a['attrs'][0x2][_0x72a0('0x4a')]:undefined)||0xc}];case'counter':return[{'name':_0x72a0('0x52'),'value':_0x4a973a['attrMetric']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x0]?_0x4a973a['attrs'][0x0][_0x72a0('0x4a')]:undefined)||'total'},{'name':_0x72a0('0x53'),'value':_0x4a973a[_0x72a0('0x53')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x1]?_0x4a973a[_0x72a0('0x49')][0x1][_0x72a0('0x4a')]:undefined)||[]},{'name':_0x72a0('0x51'),'value':_0x4a973a['attrFontSize']||(_0x4a973a['attrs']&&_0x4a973a[_0x72a0('0x49')][0x2]?_0x4a973a['attrs'][0x2][_0x72a0('0x4a')]:undefined)||0x14},{'name':_0x72a0('0x54'),'value':_0x4a973a[_0x72a0('0x54')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x3]?_0x4a973a[_0x72a0('0x49')][0x3][_0x72a0('0x4a')]:undefined)||_0x72a0('0x55')},{'name':_0x72a0('0x56'),'value':_0x4a973a['attrEmailAccounts']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x4]?_0x4a973a[_0x72a0('0x49')][0x4][_0x72a0('0x4a')]:undefined)||''},{'name':_0x72a0('0x57'),'value':_0x4a973a[_0x72a0('0x57')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x5]?_0x4a973a['attrs'][0x5][_0x72a0('0x4a')]:undefined)||''},{'name':_0x72a0('0x58'),'value':_0x4a973a[_0x72a0('0x58')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x6]?_0x4a973a[_0x72a0('0x49')][0x6][_0x72a0('0x4a')]:undefined)||''},{'name':_0x72a0('0x59'),'value':_0x4a973a[_0x72a0('0x59')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x7]?_0x4a973a[_0x72a0('0x49')][0x7][_0x72a0('0x4a')]:undefined)||''},{'name':_0x72a0('0x5a'),'value':_0x4a973a[_0x72a0('0x5a')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x8]?_0x4a973a[_0x72a0('0x49')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x4a973a[_0x72a0('0x5b')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x9]?_0x4a973a[_0x72a0('0x49')][0x9][_0x72a0('0x4a')]:undefined)||''}];case'multibar-chart':case _0x72a0('0x5c'):return[{'name':_0x72a0('0x5d'),'value':_0x4a973a['attrSerie1']||(_0x4a973a['attrs']&&_0x4a973a[_0x72a0('0x49')][0x0]?_0x4a973a[_0x72a0('0x49')][0x0][_0x72a0('0x4a')]:undefined)||_0x72a0('0x5e')},{'name':_0x72a0('0x5f'),'value':_0x4a973a[_0x72a0('0x5f')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x1]?_0x4a973a['attrs'][0x1][_0x72a0('0x4a')]:undefined)||null},{'name':'attrSerie3','value':_0x4a973a['attrSerie3']||(_0x4a973a['attrs']&&_0x4a973a[_0x72a0('0x49')][0x2]?_0x4a973a[_0x72a0('0x49')][0x2]['value']:undefined)||null},{'name':_0x72a0('0x53'),'value':_0x4a973a['attrVoiceQueues']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x3]?_0x4a973a['attrs'][0x3][_0x72a0('0x4a')]:undefined)||[]},{'name':_0x72a0('0x54'),'value':_0x4a973a['attrChannel']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x4]?_0x4a973a[_0x72a0('0x49')][0x4]['value']:undefined)||'voice'},{'name':_0x72a0('0x56'),'value':_0x4a973a[_0x72a0('0x56')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x5]?_0x4a973a['attrs'][0x5][_0x72a0('0x4a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4a973a[_0x72a0('0x57')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x6]?_0x4a973a[_0x72a0('0x49')][0x6][_0x72a0('0x4a')]:undefined)||''},{'name':_0x72a0('0x58'),'value':_0x4a973a[_0x72a0('0x58')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x7]?_0x4a973a[_0x72a0('0x49')][0x7][_0x72a0('0x4a')]:undefined)||''},{'name':_0x72a0('0x59'),'value':_0x4a973a['attrOpenchannelAccounts']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x8]?_0x4a973a['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4a973a[_0x72a0('0x5a')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a[_0x72a0('0x49')][0x9]?_0x4a973a['attrs'][0x9][_0x72a0('0x4a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4a973a[_0x72a0('0x5b')]||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0xa]?_0x4a973a[_0x72a0('0x49')][0xa][_0x72a0('0x4a')]:undefined)||''}];case _0x72a0('0x60'):return[{'name':_0x72a0('0x61'),'type':_0x4a973a['reportType']||(_0x4a973a[_0x72a0('0x49')]&&_0x4a973a['attrs'][0x0]?_0x4a973a[_0x72a0('0x49')][0x0][_0x72a0('0x46')]:undefined)||null,'value':_0x4a973a[_0x72a0('0x61')]||(_0x4a973a['attrs']&&_0x4a973a[_0x72a0('0x49')][0x0]?_0x4a973a[_0x72a0('0x49')][0x0][_0x72a0('0x4a')]:undefined)||null},{'name':_0x72a0('0x62'),'value':_0x4a973a[_0x72a0('0x62')]||(_0x4a973a['attrs']&&_0x4a973a['attrs'][0x1]?_0x4a973a[_0x72a0('0x49')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x421c35){logger['error'](_0x72a0('0x63'),JSON[_0x72a0('0x64')](_0x421c35));return[];}}exports['create']=function(_0x1cfd1d,_0x1b960e){if(_0x1cfd1d[_0x72a0('0x65')]){_0x1cfd1d['body'][_0x72a0('0x49')]=widgetAttributes(_0x1cfd1d['body']);}return db[_0x72a0('0x37')][_0x72a0('0x66')](_0x1cfd1d['body'],{})[_0x72a0('0x2e')](respondWithResult(_0x1b960e,0xc9))['catch'](handleError(_0x1b960e,null));};exports['update']=function(_0x5142de,_0x28969a){if(_0x5142de['body']['id']){delete _0x5142de[_0x72a0('0x65')]['id'];}_0x5142de['body'][_0x72a0('0x49')]=widgetAttributes(_0x5142de[_0x72a0('0x65')]);return db[_0x72a0('0x37')]['find']({'where':{'id':_0x5142de[_0x72a0('0x35')]['id']}})[_0x72a0('0x2e')](handleEntityNotFound(_0x28969a,null))[_0x72a0('0x2e')](saveUpdates(_0x5142de[_0x72a0('0x65')],null))[_0x72a0('0x2e')](respondWithResult(_0x28969a,null))['catch'](handleError(_0x28969a,null));}; \ No newline at end of file +var _0xcb04=['then','destroy','sendStatus','stack','name','send','model','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','DashboardItem','find','params','catch','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','set','apply','reject','save','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4cb0('0x0'));var rimraf=require(_0x4cb0('0x1'));var zipdir=require(_0x4cb0('0x2'));var jsonpatch=require(_0x4cb0('0x3'));var rp=require(_0x4cb0('0x4'));var moment=require(_0x4cb0('0x5'));var BPromise=require(_0x4cb0('0x6'));var Mustache=require(_0x4cb0('0x7'));var util=require(_0x4cb0('0x8'));var path=require(_0x4cb0('0x9'));var sox=require('sox');var csv=require(_0x4cb0('0xa'));var ejs=require(_0x4cb0('0xb'));var fs=require('fs');var fs_extra=require(_0x4cb0('0xc'));var _=require(_0x4cb0('0xd'));var squel=require(_0x4cb0('0xe'));var crypto=require(_0x4cb0('0xf'));var jsforce=require(_0x4cb0('0x10'));var deskjs=require(_0x4cb0('0x11'));var toCsv=require(_0x4cb0('0xa'));var querystring=require(_0x4cb0('0x12'));var Papa=require(_0x4cb0('0x13'));var Redis=require(_0x4cb0('0x14'));var authService=require(_0x4cb0('0x15'));var qs=require(_0x4cb0('0x16'));var as=require(_0x4cb0('0x17'));var hardwareService=require(_0x4cb0('0x18'));var logger=require(_0x4cb0('0x19'))(_0x4cb0('0x1a'));var utils=require('../../config/utils');var config=require(_0x4cb0('0x1b'));var licenseUtil=require(_0x4cb0('0x1c'));var db=require(_0x4cb0('0x1d'))['db'];config[_0x4cb0('0x1e')]=_['defaults'](config[_0x4cb0('0x1e')],{'host':_0x4cb0('0x1f'),'port':0x18eb});var socket=require(_0x4cb0('0x20'))(new Redis(config[_0x4cb0('0x1e')]));require(_0x4cb0('0x21'))[_0x4cb0('0x22')](socket);function respondWithStatusCode(_0x2738aa,_0x3014ae){_0x3014ae=_0x3014ae||0xcc;return function(_0x246605){if(_0x246605){return _0x2738aa['sendStatus'](_0x3014ae);}return _0x2738aa[_0x4cb0('0x23')](_0x3014ae)[_0x4cb0('0x24')]();};}function respondWithResult(_0x1317e9,_0x3bbe1a){_0x3bbe1a=_0x3bbe1a||0xc8;return function(_0x53838b){if(_0x53838b){return _0x1317e9['status'](_0x3bbe1a)[_0x4cb0('0x25')](_0x53838b);}};}function respondWithFilteredResult(_0x33f7ef,_0x1e4659){return function(_0x91d3b){if(_0x91d3b){var _0x248e22=typeof _0x1e4659[_0x4cb0('0x26')]===_0x4cb0('0x27')&&typeof _0x1e4659['limit']==='undefined';var _0x30ba5a=_0x91d3b['count'];var _0x4ca756=_0x248e22?0x0:_0x1e4659[_0x4cb0('0x26')];var _0x3b2f0c=_0x248e22?_0x91d3b['count']:_0x1e4659[_0x4cb0('0x26')]+_0x1e4659[_0x4cb0('0x28')];var _0x2def01;if(_0x3b2f0c>=_0x30ba5a){_0x3b2f0c=_0x30ba5a;_0x2def01=0xc8;}else{_0x2def01=0xce;}_0x33f7ef['status'](_0x2def01);return _0x33f7ef[_0x4cb0('0x29')]('Content-Range',_0x4ca756+'-'+_0x3b2f0c+'/'+_0x30ba5a)[_0x4cb0('0x25')](_0x91d3b);}return null;};}function patchUpdates(_0x3196e0){return function(_0x267c74){try{jsonpatch[_0x4cb0('0x2a')](_0x267c74,_0x3196e0,!![]);}catch(_0x4f12e6){return BPromise[_0x4cb0('0x2b')](_0x4f12e6);}return _0x267c74[_0x4cb0('0x2c')]();};}function saveUpdates(_0x53fdd3,_0x485c9f){return function(_0x3456ef){if(_0x3456ef){return _0x3456ef[_0x4cb0('0x2d')](_0x53fdd3)[_0x4cb0('0x2e')](function(_0x188623){return _0x188623;});}return null;};}function removeEntity(_0x325745,_0x3710eb){return function(_0x1688c5){if(_0x1688c5){return _0x1688c5[_0x4cb0('0x2f')]()[_0x4cb0('0x2e')](function(){_0x325745[_0x4cb0('0x23')](0xcc)[_0x4cb0('0x24')]();});}};}function handleEntityNotFound(_0xde2bd9,_0x50f9eb){return function(_0x2f3b9f){if(!_0x2f3b9f){_0xde2bd9[_0x4cb0('0x30')](0x194);}return _0x2f3b9f;};}function handleError(_0x4417df,_0x347dfd){_0x347dfd=_0x347dfd||0x1f4;return function(_0x25a25d){logger['error'](_0x25a25d[_0x4cb0('0x31')]);if(_0x25a25d['name']){delete _0x25a25d[_0x4cb0('0x32')];}_0x4417df[_0x4cb0('0x23')](_0x347dfd)[_0x4cb0('0x33')](_0x25a25d);};}exports['show']=function(_0x2182bc,_0xf1bdc1){var _0x1abab2={'raw':![],'where':{'id':_0x2182bc['params']['id']}},_0xe3ae3a={};_0xe3ae3a[_0x4cb0('0x34')]=_['keys'](db['DashboardItem'][_0x4cb0('0x35')]);_0xe3ae3a[_0x4cb0('0x36')]=_['keys'](_0x2182bc[_0x4cb0('0x36')]);_0xe3ae3a['filters']=_[_0x4cb0('0x37')](_0xe3ae3a[_0x4cb0('0x34')],_0xe3ae3a[_0x4cb0('0x36')]);_0x1abab2[_0x4cb0('0x38')]=_['intersection'](_0xe3ae3a[_0x4cb0('0x34')],qs[_0x4cb0('0x39')](_0x2182bc[_0x4cb0('0x36')][_0x4cb0('0x39')]));_0x1abab2[_0x4cb0('0x38')]=_0x1abab2[_0x4cb0('0x38')][_0x4cb0('0x3a')]?_0x1abab2['attributes']:_0xe3ae3a[_0x4cb0('0x34')];if(_0x2182bc[_0x4cb0('0x36')][_0x4cb0('0x3b')]){_0x1abab2[_0x4cb0('0x3c')]=[{'all':!![]}];}_0x1abab2=_['merge']({},_0x1abab2,_0x2182bc['options']);return db[_0x4cb0('0x3d')]['find'](_0x1abab2)[_0x4cb0('0x2e')](handleEntityNotFound(_0xf1bdc1,null))[_0x4cb0('0x2e')](respondWithResult(_0xf1bdc1,null))['catch'](handleError(_0xf1bdc1,null));};exports[_0x4cb0('0x2f')]=function(_0x58bd51,_0x444d7e){return db[_0x4cb0('0x3d')][_0x4cb0('0x3e')]({'where':{'id':_0x58bd51[_0x4cb0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x444d7e,null))[_0x4cb0('0x2e')](removeEntity(_0x444d7e,null))[_0x4cb0('0x40')](handleError(_0x444d7e,null));};function widgetAttributes(_0x139efc){try{switch(_0x139efc[_0x4cb0('0x41')]){case _0x4cb0('0x42'):return[{'name':_0x4cb0('0x43'),'value':_0x139efc[_0x4cb0('0x43')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc[_0x4cb0('0x44')][0x0]['value']:undefined)||'https://'}];case _0x4cb0('0x45'):return[{'name':'attrPath','value':_0x139efc[_0x4cb0('0x46')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc['attrs'][0x0][_0x4cb0('0x47')]:undefined)||''}];case _0x4cb0('0x48'):return[{'name':_0x4cb0('0x49'),'value':_0x139efc['attrHourFormat']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc[_0x4cb0('0x44')][0x0][_0x4cb0('0x47')]:undefined)||'HH:mm:ss'},{'name':_0x4cb0('0x4a'),'value':_0x139efc[_0x4cb0('0x4a')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x1]?_0x139efc[_0x4cb0('0x44')][0x1]['value']:undefined)||'0.00'},{'name':_0x4cb0('0x4b'),'value':_0x139efc[_0x4cb0('0x4b')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x2]?_0x139efc['attrs'][0x2][_0x4cb0('0x47')]:undefined)||0xc}];case _0x4cb0('0x4c'):return[{'name':_0x4cb0('0x4d'),'value':_0x139efc[_0x4cb0('0x4d')]||(_0x139efc['attrs']&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc[_0x4cb0('0x44')][0x0][_0x4cb0('0x47')]:undefined)||_0x4cb0('0x4e')},{'name':_0x4cb0('0x4f'),'value':_0x139efc[_0x4cb0('0x4f')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x1]?_0x139efc['attrs'][0x1][_0x4cb0('0x47')]:undefined)||[]},{'name':_0x4cb0('0x4b'),'value':_0x139efc[_0x4cb0('0x4b')]||(_0x139efc['attrs']&&_0x139efc[_0x4cb0('0x44')][0x2]?_0x139efc['attrs'][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x139efc[_0x4cb0('0x50')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x3]?_0x139efc[_0x4cb0('0x44')][0x3][_0x4cb0('0x47')]:undefined)||_0x4cb0('0x51')},{'name':'attrEmailAccounts','value':_0x139efc[_0x4cb0('0x52')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x4]?_0x139efc['attrs'][0x4][_0x4cb0('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x139efc[_0x4cb0('0x53')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x5]?_0x139efc[_0x4cb0('0x44')][0x5][_0x4cb0('0x47')]:undefined)||''},{'name':_0x4cb0('0x54'),'value':_0x139efc[_0x4cb0('0x54')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x6]?_0x139efc['attrs'][0x6][_0x4cb0('0x47')]:undefined)||''},{'name':_0x4cb0('0x55'),'value':_0x139efc['attrOpenchannelAccounts']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x7]?_0x139efc[_0x4cb0('0x44')][0x7][_0x4cb0('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x139efc['attrWhatsappAccounts']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x8]?_0x139efc[_0x4cb0('0x44')][0x8][_0x4cb0('0x47')]:undefined)||''},{'name':_0x4cb0('0x56'),'value':_0x139efc['attrChatWebsites']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x9]?_0x139efc[_0x4cb0('0x44')][0x9][_0x4cb0('0x47')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x4cb0('0x57'),'value':_0x139efc[_0x4cb0('0x57')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc[_0x4cb0('0x44')][0x0][_0x4cb0('0x47')]:undefined)||_0x4cb0('0x4e')},{'name':_0x4cb0('0x58'),'value':_0x139efc[_0x4cb0('0x58')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x1]?_0x139efc[_0x4cb0('0x44')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x139efc[_0x4cb0('0x59')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x2]?_0x139efc[_0x4cb0('0x44')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x139efc[_0x4cb0('0x4f')]||(_0x139efc['attrs']&&_0x139efc['attrs'][0x3]?_0x139efc[_0x4cb0('0x44')][0x3][_0x4cb0('0x47')]:undefined)||[]},{'name':_0x4cb0('0x50'),'value':_0x139efc[_0x4cb0('0x50')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x4]?_0x139efc[_0x4cb0('0x44')][0x4]['value']:undefined)||_0x4cb0('0x51')},{'name':_0x4cb0('0x52'),'value':_0x139efc[_0x4cb0('0x52')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x5]?_0x139efc[_0x4cb0('0x44')][0x5][_0x4cb0('0x47')]:undefined)||''},{'name':_0x4cb0('0x53'),'value':_0x139efc['attrFaxAccounts']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x6]?_0x139efc[_0x4cb0('0x44')][0x6][_0x4cb0('0x47')]:undefined)||''},{'name':_0x4cb0('0x54'),'value':_0x139efc['attrSmsAccounts']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x7]?_0x139efc[_0x4cb0('0x44')][0x7][_0x4cb0('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x139efc[_0x4cb0('0x55')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x8]?_0x139efc[_0x4cb0('0x44')][0x8][_0x4cb0('0x47')]:undefined)||''},{'name':_0x4cb0('0x5a'),'value':_0x139efc[_0x4cb0('0x5a')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x9]?_0x139efc[_0x4cb0('0x44')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x139efc[_0x4cb0('0x56')]||(_0x139efc['attrs']&&_0x139efc[_0x4cb0('0x44')][0xa]?_0x139efc[_0x4cb0('0x44')][0xa]['value']:undefined)||''}];case _0x4cb0('0x5b'):return[{'name':_0x4cb0('0x5c'),'type':_0x139efc[_0x4cb0('0x5d')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc[_0x4cb0('0x44')][0x0][_0x4cb0('0x41')]:undefined)||null,'value':_0x139efc[_0x4cb0('0x5c')]||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc[_0x4cb0('0x44')][0x0]?_0x139efc[_0x4cb0('0x44')][0x0][_0x4cb0('0x47')]:undefined)||null},{'name':_0x4cb0('0x5e'),'value':_0x139efc['attrRefresh']||(_0x139efc[_0x4cb0('0x44')]&&_0x139efc['attrs'][0x1]?_0x139efc['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x597abc){logger[_0x4cb0('0x5f')](_0x4cb0('0x60'),JSON[_0x4cb0('0x61')](_0x597abc));return[];}}exports[_0x4cb0('0x62')]=function(_0x490b6f,_0xda9228){if(_0x490b6f[_0x4cb0('0x63')]){_0x490b6f['body'][_0x4cb0('0x44')]=widgetAttributes(_0x490b6f[_0x4cb0('0x63')]);}return db['DashboardItem'][_0x4cb0('0x62')](_0x490b6f[_0x4cb0('0x63')],{})[_0x4cb0('0x2e')](respondWithResult(_0xda9228,0xc9))['catch'](handleError(_0xda9228,null));};exports[_0x4cb0('0x2d')]=function(_0x46178c,_0x53f01c){if(_0x46178c[_0x4cb0('0x63')]['id']){delete _0x46178c[_0x4cb0('0x63')]['id'];}_0x46178c[_0x4cb0('0x63')][_0x4cb0('0x44')]=widgetAttributes(_0x46178c[_0x4cb0('0x63')]);return db[_0x4cb0('0x3d')][_0x4cb0('0x3e')]({'where':{'id':_0x46178c[_0x4cb0('0x3f')]['id']}})[_0x4cb0('0x2e')](handleEntityNotFound(_0x53f01c,null))['then'](saveUpdates(_0x46178c['body'],null))[_0x4cb0('0x2e')](respondWithResult(_0x53f01c,null))[_0x4cb0('0x40')](handleError(_0x53f01c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 46c19b1..4f5ac01 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 _0xaa2c=['exports','events','../../mysqldb','DashboardItem','update','remove','emit','hook'];(function(_0x300370,_0x236c84){var _0x272b25=function(_0x2b9a87){while(--_0x2b9a87){_0x300370['push'](_0x300370['shift']());}};_0x272b25(++_0x236c84);}(_0xaa2c,0x1d1));var _0xcaa2=function(_0x1191d0,_0x3c8e6e){_0x1191d0=_0x1191d0-0x0;var _0x592084=_0xaa2c[_0x1191d0];return _0x592084;};'use strict';var EventEmitter=require(_0xcaa2('0x0'));var DashboardItem=require(_0xcaa2('0x1'))['db'][_0xcaa2('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcaa2('0x3'),'afterDestroy':_0xcaa2('0x4')};function emitEvent(_0x4c2111){return function(_0x26f1ce,_0x4b0566,_0xa95aee){DashboardItemEvents[_0xcaa2('0x5')](_0x4c2111+':'+_0x26f1ce['id'],_0x26f1ce);DashboardItemEvents[_0xcaa2('0x5')](_0x4c2111,_0x26f1ce);_0xa95aee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xcaa2('0x6')](e,emitEvent(event));}}module[_0xcaa2('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xa2c5=['update','remove','emit','hasOwnProperty','events','../../mysqldb','DashboardItem','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2c5,0x10c));var _0x5a2c=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xa2c5[_0x9dfc10];return _0x4f938a;};'use strict';var EventEmitter=require(_0x5a2c('0x0'));var DashboardItem=require(_0x5a2c('0x1'))['db'][_0x5a2c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5a2c('0x3'),'afterUpdate':_0x5a2c('0x4'),'afterDestroy':_0x5a2c('0x5')};function emitEvent(_0x25a74e){return function(_0x323167,_0x31b164,_0xfc2a4f){DashboardItemEvents[_0x5a2c('0x6')](_0x25a74e+':'+_0x323167['id'],_0x323167);DashboardItemEvents[_0x5a2c('0x6')](_0x25a74e,_0x323167);_0xfc2a4f(null);};}for(var e in events){if(events[_0x5a2c('0x7')](e)){var event=events[e];DashboardItem['hook'](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 e2c127a..4e8603c 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 _0x0b80=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0x0b80,0xa7));var _0x00b8=function(_0x520786,_0x135075){_0x520786=_0x520786-0x0;var _0x51422a=_0x0b80[_0x520786];return _0x51422a;};'use strict';var _=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var logger=require(_0x00b8('0x2'))(_0x00b8('0x3'));var moment=require(_0x00b8('0x4'));var BPromise=require(_0x00b8('0x5'));var rp=require(_0x00b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00b8('0x7'));var config=require(_0x00b8('0x8'));var attributes=require(_0x00b8('0x9'));module[_0x00b8('0xa')]=function(_0x12c902,_0x4211eb){return _0x12c902[_0x00b8('0xb')]('DashboardItem',attributes,{'tableName':_0x00b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe79c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','util'];(function(_0xce6473,_0x1d7bcf){var _0x527614=function(_0x486897){while(--_0x486897){_0xce6473['push'](_0xce6473['shift']());}};_0x527614(++_0x1d7bcf);}(_0xe79c,0x106));var _0xce79=function(_0x13bea8,_0x5dc617){_0x13bea8=_0x13bea8-0x0;var _0x12c6d5=_0xe79c[_0x13bea8];return _0x12c6d5;};'use strict';var _=require(_0xce79('0x0'));var util=require(_0xce79('0x1'));var logger=require(_0xce79('0x2'))(_0xce79('0x3'));var moment=require(_0xce79('0x4'));var BPromise=require(_0xce79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce79('0x6'));var rimraf=require(_0xce79('0x7'));var config=require(_0xce79('0x8'));var attributes=require(_0xce79('0x9'));module['exports']=function(_0x1f9d9b,_0x3ce3af){return _0x1f9d9b[_0xce79('0xa')](_0xce79('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 62d6d13..fde4fd8 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 _0xc9e8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x214497,_0x3230ec){var _0x33ac04=function(_0x9fb854){while(--_0x9fb854){_0x214497['push'](_0x214497['shift']());}};_0x33ac04(++_0x3230ec);}(_0xc9e8,0x143));var _0x8c9e=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xc9e8[_0x1f3aec];return _0x409f0d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c9e('0x0'));var BPromise=require(_0x8c9e('0x1'));var rs=require(_0x8c9e('0x2'));var fs=require('fs');var Redis=require(_0x8c9e('0x3'));var db=require(_0x8c9e('0x4'))['db'];var utils=require(_0x8c9e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c9e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8c9e('0x7')][_0x8c9e('0x8')]({'port':0x232a});config[_0x8c9e('0x9')]=_[_0x8c9e('0xa')](config['redis'],{'host':_0x8c9e('0xb'),'port':0x18eb});var socket=require(_0x8c9e('0xc'))(new Redis(config[_0x8c9e('0x9')]));require('./dashboardItem.socket')[_0x8c9e('0xd')](socket);function respondWithRpcPromise(_0x2c1305,_0x50eefa,_0x203a2f){return new BPromise(function(_0xbbabf9,_0x557f9c){return client[_0x8c9e('0xe')](_0x2c1305,_0x203a2f)['then'](function(_0xd49f54){logger[_0x8c9e('0xf')]('DashboardItem,\x20%s,\x20%s',_0x50eefa,_0x8c9e('0x10'));logger[_0x8c9e('0x11')](_0x8c9e('0x12'),_0x50eefa,_0x8c9e('0x10'),JSON['stringify'](_0xd49f54));if(_0xd49f54[_0x8c9e('0x13')]){if(_0xd49f54[_0x8c9e('0x13')][_0x8c9e('0x14')]===0x1f4){logger['error'](_0x8c9e('0x15'),_0x50eefa,_0xd49f54['error']['message']);return _0x557f9c(_0xd49f54['error'][_0x8c9e('0x16')]);}logger[_0x8c9e('0x13')](_0x8c9e('0x15'),_0x50eefa,_0xd49f54['error'][_0x8c9e('0x16')]);return _0xbbabf9(_0xd49f54[_0x8c9e('0x13')]['message']);}else{logger[_0x8c9e('0xf')](_0x8c9e('0x15'),_0x50eefa,_0x8c9e('0x10'));_0xbbabf9(_0xd49f54[_0x8c9e('0x17')][_0x8c9e('0x16')]);}})[_0x8c9e('0x18')](function(_0x3c49ca){logger[_0x8c9e('0x13')](_0x8c9e('0x15'),_0x50eefa,_0x3c49ca);_0x557f9c(_0x3c49ca);});});} \ No newline at end of file +var _0x46c2=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21d401,_0x392214){var _0xcac6e9=function(_0x582a0c){while(--_0x582a0c){_0x21d401['push'](_0x21d401['shift']());}};_0xcac6e9(++_0x392214);}(_0x46c2,0xff));var _0x246c=function(_0x516a6e,_0x3abade){_0x516a6e=_0x516a6e-0x0;var _0x353d41=_0x46c2[_0x516a6e];return _0x353d41;};'use strict';var _=require(_0x246c('0x0'));var util=require(_0x246c('0x1'));var moment=require(_0x246c('0x2'));var BPromise=require('bluebird');var rs=require(_0x246c('0x3'));var fs=require('fs');var Redis=require(_0x246c('0x4'));var db=require(_0x246c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x246c('0x6'))('rpc');var config=require(_0x246c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x246c('0x8')][_0x246c('0x9')]({'port':0x232a});config[_0x246c('0xa')]=_['defaults'](config[_0x246c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x246c('0xb'))['register'](socket);function respondWithRpcPromise(_0x160306,_0x39e1a7,_0x1dce28){return new BPromise(function(_0x48c06c,_0x3659e0){return client[_0x246c('0xc')](_0x160306,_0x1dce28)[_0x246c('0xd')](function(_0x381a5e){logger[_0x246c('0xe')](_0x246c('0xf'),_0x39e1a7,_0x246c('0x10'));logger[_0x246c('0x11')](_0x246c('0x12'),_0x39e1a7,_0x246c('0x10'),JSON[_0x246c('0x13')](_0x381a5e));if(_0x381a5e[_0x246c('0x14')]){if(_0x381a5e[_0x246c('0x14')]['code']===0x1f4){logger['error'](_0x246c('0xf'),_0x39e1a7,_0x381a5e[_0x246c('0x14')][_0x246c('0x15')]);return _0x3659e0(_0x381a5e[_0x246c('0x14')][_0x246c('0x15')]);}logger[_0x246c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x39e1a7,_0x381a5e['error'][_0x246c('0x15')]);return _0x48c06c(_0x381a5e[_0x246c('0x14')][_0x246c('0x15')]);}else{logger['info'](_0x246c('0xf'),_0x39e1a7,_0x246c('0x10'));_0x48c06c(_0x381a5e['result']['message']);}})[_0x246c('0x16')](function(_0x2451c7){logger[_0x246c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x39e1a7,_0x2451c7);_0x3659e0(_0x2451c7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b149da7..08663ac 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 _0xa1da=['update','emit','register','dashboardItem:','save'];(function(_0xf8ea5,_0x2d8ec6){var _0x45df45=function(_0x486323){while(--_0x486323){_0xf8ea5['push'](_0xf8ea5['shift']());}};_0x45df45(++_0x2d8ec6);}(_0xa1da,0x1c1));var _0xaa1d=function(_0x577fe9,_0x2a3fac){_0x577fe9=_0x577fe9-0x0;var _0x12524b=_0xa1da[_0x577fe9];return _0x12524b;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xaa1d('0x0'),'remove',_0xaa1d('0x1')];function createListener(_0x149b88,_0x51e824){return function(_0x23eed9){_0x51e824[_0xaa1d('0x2')](_0x149b88,_0x23eed9);};}function removeListener(_0x3a4a69,_0x49d840){return function(){DashboardItemEvents['removeListener'](_0x3a4a69,_0x49d840);};}exports[_0xaa1d('0x3')]=function(_0x31297d){for(var _0x2925ab=0x0,_0x404bcf=events['length'];_0x2925ab<_0x404bcf;_0x2925ab++){var _0x40727c=events[_0x2925ab];var _0x3b41c5=createListener(_0xaa1d('0x4')+_0x40727c,_0x31297d);DashboardItemEvents['on'](_0x40727c,_0x3b41c5);}}; \ No newline at end of file +var _0xfd67=['update','emit','removeListener','length','dashboardItem:'];(function(_0x215767,_0xfdbe24){var _0x5eecb8=function(_0x4c137e){while(--_0x4c137e){_0x215767['push'](_0x215767['shift']());}};_0x5eecb8(++_0xfdbe24);}(_0xfd67,0x104));var _0x7fd6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfd67[_0xfae23b];return _0x200640;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0x7fd6('0x0')];function createListener(_0x3558d1,_0x32e3be){return function(_0x44343c){_0x32e3be[_0x7fd6('0x1')](_0x3558d1,_0x44343c);};}function removeListener(_0x181e2a,_0x1f483f){return function(){DashboardItemEvents[_0x7fd6('0x2')](_0x181e2a,_0x1f483f);};}exports['register']=function(_0x4c1116){for(var _0x2ba68b=0x0,_0x86b035=events[_0x7fd6('0x3')];_0x2ba68b<_0x86b035;_0x2ba68b++){var _0x1f1090=events[_0x2ba68b];var _0x1ac2b9=createListener(_0x7fd6('0x4')+_0x1f1090,_0x4c1116);DashboardItemEvents['on'](_0x1f1090,_0x1ac2b9);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c9cfd03..fa5641c 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 _0x1898=['delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put'];(function(_0x43bd69,_0x379bb0){var _0x234e77=function(_0x4b1cf8){while(--_0x4b1cf8){_0x43bd69['push'](_0x43bd69['shift']());}};_0x234e77(++_0x379bb0);}(_0x1898,0x1b2));var _0x8189=function(_0x3d348c,_0x5076b5){_0x3d348c=_0x3d348c-0x0;var _0xcd8d92=_0x1898[_0x3d348c];return _0xcd8d92;};'use strict';var multer=require('multer');var util=require(_0x8189('0x0'));var path=require(_0x8189('0x1'));var timeout=require('connect-timeout');var express=require(_0x8189('0x2'));var router=express[_0x8189('0x3')]();var fs_extra=require(_0x8189('0x4'));var auth=require(_0x8189('0x5'));var interaction=require(_0x8189('0x6'));var config=require('../../config/environment');var controller=require(_0x8189('0x7'));router[_0x8189('0x8')](_0x8189('0x9'),auth[_0x8189('0xa')](),controller[_0x8189('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8189('0xc')]);router[_0x8189('0xd')](_0x8189('0x9'),auth[_0x8189('0xa')](),controller['update']);router[_0x8189('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8189('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb31d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xb31d,0xf6));var _0xdb31=function(_0x37a007,_0x98a0fb){_0x37a007=_0x37a007-0x0;var _0x55706c=_0xb31d[_0x37a007];return _0x55706c;};'use strict';var multer=require(_0xdb31('0x0'));var util=require(_0xdb31('0x1'));var path=require(_0xdb31('0x2'));var timeout=require(_0xdb31('0x3'));var express=require(_0xdb31('0x4'));var router=express[_0xdb31('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb31('0x6'));var interaction=require(_0xdb31('0x7'));var config=require(_0xdb31('0x8'));var controller=require(_0xdb31('0x9'));router[_0xdb31('0xa')]('/:id',auth[_0xdb31('0xb')](),controller[_0xdb31('0xc')]);router['post']('/',auth[_0xdb31('0xb')](),controller[_0xdb31('0xd')]);router['put']('/:id',auth[_0xdb31('0xb')](),controller[_0xdb31('0xe')]);router[_0xdb31('0xf')](_0xdb31('0x10'),auth[_0xdb31('0xb')](),controller[_0xdb31('0x11')]);module[_0xdb31('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 61c4098..86e8e32 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 _0x6cea=['exports','STRING','ENUM','first','second'];(function(_0x4dbe6e,_0x573f1c){var _0x216563=function(_0x21f8dd){while(--_0x21f8dd){_0x4dbe6e['push'](_0x4dbe6e['shift']());}};_0x216563(++_0x573f1c);}(_0x6cea,0x181));var _0xa6ce=function(_0xcfe394,_0x4ed7d7){_0xcfe394=_0xcfe394-0x0;var _0xac6749=_0x6cea[_0xcfe394];return _0xac6749;};'use strict';var Sequelize=require('sequelize');module[_0xa6ce('0x0')]={'name':{'type':Sequelize[_0xa6ce('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xa6ce('0x2')](_0xa6ce('0x3'),_0xa6ce('0x4'),'third'),'allowNull':![],'defaultValue':_0xa6ce('0x3')},'description':{'type':Sequelize[_0xa6ce('0x1')]}}; \ No newline at end of file +var _0x295c=['second','sequelize','exports','STRING','ENUM','first'];(function(_0x4a76bb,_0x1567ef){var _0x4f17ef=function(_0x3c5e83){while(--_0x3c5e83){_0x4a76bb['push'](_0x4a76bb['shift']());}};_0x4f17ef(++_0x1567ef);}(_0x295c,0x181));var _0xc295=function(_0x21fa49,_0x5f2aae){_0x21fa49=_0x21fa49-0x0;var _0x502b3c=_0x295c[_0x21fa49];return _0x502b3c;};'use strict';var Sequelize=require(_0xc295('0x0'));module[_0xc295('0x1')]={'name':{'type':Sequelize[_0xc295('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc295('0x3')](_0xc295('0x4'),_0xc295('0x5'),'third'),'allowNull':![],'defaultValue':_0xc295('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 c61eebc..8db937b 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 _0x69f8=['ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','index','Disposition','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','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','mustache','util','path','sox','to-csv'];(function(_0x2c8caa,_0x74fa11){var _0xddbe98=function(_0x267774){while(--_0x267774){_0x2c8caa['push'](_0x2c8caa['shift']());}};_0xddbe98(++_0x74fa11);}(_0x69f8,0x14c));var _0x869f=function(_0x88dc75,_0x526f60){_0x88dc75=_0x88dc75-0x0;var _0x5b8282=_0x69f8[_0x88dc75];return _0x5b8282;};'use strict';var emlformat=require(_0x869f('0x0'));var rimraf=require(_0x869f('0x1'));var zipdir=require(_0x869f('0x2'));var jsonpatch=require(_0x869f('0x3'));var rp=require(_0x869f('0x4'));var moment=require(_0x869f('0x5'));var BPromise=require(_0x869f('0x6'));var Mustache=require(_0x869f('0x7'));var util=require(_0x869f('0x8'));var path=require(_0x869f('0x9'));var sox=require(_0x869f('0xa'));var csv=require(_0x869f('0xb'));var ejs=require(_0x869f('0xc'));var fs=require('fs');var fs_extra=require(_0x869f('0xd'));var _=require('lodash');var squel=require(_0x869f('0xe'));var crypto=require(_0x869f('0xf'));var jsforce=require(_0x869f('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x869f('0x11'));var Papa=require('papaparse');var Redis=require(_0x869f('0x12'));var authService=require(_0x869f('0x13'));var qs=require(_0x869f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x869f('0x15'));var logger=require('../../config/logger')(_0x869f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x869f('0x17'));var db=require(_0x869f('0x18'))['db'];function respondWithStatusCode(_0x1afee7,_0x1d511b){_0x1d511b=_0x1d511b||0xcc;return function(_0x3bdca3){if(_0x3bdca3){return _0x1afee7[_0x869f('0x19')](_0x1d511b);}return _0x1afee7[_0x869f('0x1a')](_0x1d511b)[_0x869f('0x1b')]();};}function respondWithResult(_0x523855,_0x181817){_0x181817=_0x181817||0xc8;return function(_0x23a62b){if(_0x23a62b){return _0x523855[_0x869f('0x1a')](_0x181817)[_0x869f('0x1c')](_0x23a62b);}};}function respondWithFilteredResult(_0x213dca,_0x10ad23){return function(_0x7acd9e){if(_0x7acd9e){var _0x38290e=typeof _0x10ad23[_0x869f('0x1d')]===_0x869f('0x1e')&&typeof _0x10ad23[_0x869f('0x1f')]===_0x869f('0x1e');var _0x21b043=_0x7acd9e[_0x869f('0x20')];var _0x28c0a8=_0x38290e?0x0:_0x10ad23[_0x869f('0x1d')];var _0x1e0d75=_0x38290e?_0x7acd9e[_0x869f('0x20')]:_0x10ad23[_0x869f('0x1d')]+_0x10ad23[_0x869f('0x1f')];var _0x1078d6;if(_0x1e0d75>=_0x21b043){_0x1e0d75=_0x21b043;_0x1078d6=0xc8;}else{_0x1078d6=0xce;}_0x213dca[_0x869f('0x1a')](_0x1078d6);return _0x213dca[_0x869f('0x21')](_0x869f('0x22'),_0x28c0a8+'-'+_0x1e0d75+'/'+_0x21b043)[_0x869f('0x1c')](_0x7acd9e);}return null;};}function patchUpdates(_0x34cff7){return function(_0x5d1e4f){try{jsonpatch['apply'](_0x5d1e4f,_0x34cff7,!![]);}catch(_0x2689ca){return BPromise[_0x869f('0x23')](_0x2689ca);}return _0x5d1e4f[_0x869f('0x24')]();};}function saveUpdates(_0x41e75d,_0x58c941){return function(_0x256e3e){if(_0x256e3e){return _0x256e3e[_0x869f('0x25')](_0x41e75d)[_0x869f('0x26')](function(_0x25e8c4){return _0x25e8c4;});}return null;};}function removeEntity(_0x3a9ea7,_0x3dbdf5){return function(_0x3bf910){if(_0x3bf910){return _0x3bf910[_0x869f('0x27')]()[_0x869f('0x26')](function(){var _0x2ccf57=_0x3bf910[_0x869f('0x28')]({'plain':!![]});var _0x52f06d=_0x869f('0x29');return db['UserProfileResource'][_0x869f('0x27')]({'where':{'type':_0x52f06d,'resourceId':_0x2ccf57['id']}})[_0x869f('0x26')](function(){return _0x3bf910;});})['then'](function(){_0x3a9ea7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3380d2,_0x2361ec){return function(_0x121709){if(!_0x121709){_0x3380d2[_0x869f('0x19')](0x194);}return _0x121709;};}function handleError(_0x44810c,_0x25a039){_0x25a039=_0x25a039||0x1f4;return function(_0x6b475){logger[_0x869f('0x2a')](_0x6b475[_0x869f('0x2b')]);if(_0x6b475[_0x869f('0x2c')]){delete _0x6b475[_0x869f('0x2c')];}_0x44810c['status'](_0x25a039)[_0x869f('0x2d')](_0x6b475);};}exports[_0x869f('0x2e')]=function(_0x2993a4,_0x417720){var _0x61f09b={},_0x4628c0={},_0x2bf8bb={'count':0x0,'rows':[]};var _0x1f9792=_['map'](db[_0x869f('0x2f')]['rawAttributes'],function(_0x41de15){return{'name':_0x41de15[_0x869f('0x30')],'type':_0x41de15[_0x869f('0x31')][_0x869f('0x32')]};});_0x4628c0[_0x869f('0x33')]=_['map'](_0x1f9792,_0x869f('0x2c'));_0x4628c0[_0x869f('0x34')]=_[_0x869f('0x35')](_0x2993a4[_0x869f('0x34')]);_0x4628c0[_0x869f('0x36')]=_[_0x869f('0x37')](_0x4628c0[_0x869f('0x33')],_0x4628c0[_0x869f('0x34')]);_0x61f09b[_0x869f('0x38')]=_[_0x869f('0x37')](_0x4628c0[_0x869f('0x33')],qs[_0x869f('0x39')](_0x2993a4[_0x869f('0x34')]['fields']));_0x61f09b[_0x869f('0x38')]=_0x61f09b[_0x869f('0x38')][_0x869f('0x3a')]?_0x61f09b[_0x869f('0x38')]:_0x4628c0[_0x869f('0x33')];if(!_0x2993a4['query'][_0x869f('0x3b')]('nolimit')){_0x61f09b[_0x869f('0x1f')]=qs[_0x869f('0x1f')](_0x2993a4[_0x869f('0x34')][_0x869f('0x1f')]);_0x61f09b[_0x869f('0x1d')]=qs[_0x869f('0x1d')](_0x2993a4[_0x869f('0x34')][_0x869f('0x1d')]);}_0x61f09b[_0x869f('0x3c')]=qs[_0x869f('0x3d')](_0x2993a4[_0x869f('0x34')][_0x869f('0x3d')]);_0x61f09b[_0x869f('0x3e')]=qs[_0x869f('0x36')](_[_0x869f('0x3f')](_0x2993a4['query'],_0x4628c0[_0x869f('0x36')]),_0x1f9792);if(_0x2993a4['query']['filter']){_0x61f09b[_0x869f('0x3e')]=_[_0x869f('0x40')](_0x61f09b[_0x869f('0x3e')],{'$or':_[_0x869f('0x41')](_0x1f9792,function(_0x577c7a){if(_0x577c7a[_0x869f('0x31')]!==_0x869f('0x42')){var _0x299964={};_0x299964[_0x577c7a[_0x869f('0x2c')]]={'$like':'%'+_0x2993a4[_0x869f('0x34')]['filter']+'%'};return _0x299964;}})});}_0x61f09b=_[_0x869f('0x40')]({},_0x61f09b,_0x2993a4[_0x869f('0x43')]);var _0x4fd91c={'where':_0x61f09b[_0x869f('0x3e')]};return db[_0x869f('0x2f')][_0x869f('0x20')](_0x4fd91c)[_0x869f('0x26')](function(_0x460785){_0x2bf8bb['count']=_0x460785;if(_0x2993a4['query']['includeAll']){_0x61f09b[_0x869f('0x44')]=[{'all':!![]}];}return db[_0x869f('0x2f')][_0x869f('0x45')](_0x61f09b);})[_0x869f('0x26')](function(_0x1245dd){_0x2bf8bb[_0x869f('0x46')]=_0x1245dd;return _0x2bf8bb;})['then'](respondWithFilteredResult(_0x417720,_0x61f09b))['catch'](handleError(_0x417720,null));};exports[_0x869f('0x47')]=function(_0xf6ba4,_0x1b03f9){var _0x2ca1dc={'raw':!![],'where':{'id':_0xf6ba4[_0x869f('0x48')]['id']}},_0x14077c={};_0x14077c[_0x869f('0x33')]=_[_0x869f('0x35')](db['Disposition'][_0x869f('0x49')]);_0x14077c[_0x869f('0x34')]=_['keys'](_0xf6ba4['query']);_0x14077c['filters']=_['intersection'](_0x14077c['model'],_0x14077c[_0x869f('0x34')]);_0x2ca1dc[_0x869f('0x38')]=_[_0x869f('0x37')](_0x14077c[_0x869f('0x33')],qs[_0x869f('0x39')](_0xf6ba4['query'][_0x869f('0x39')]));_0x2ca1dc[_0x869f('0x38')]=_0x2ca1dc[_0x869f('0x38')][_0x869f('0x3a')]?_0x2ca1dc['attributes']:_0x14077c['model'];if(_0xf6ba4[_0x869f('0x34')][_0x869f('0x4a')]){_0x2ca1dc[_0x869f('0x44')]=[{'all':!![]}];}_0x2ca1dc=_['merge']({},_0x2ca1dc,_0xf6ba4[_0x869f('0x43')]);return db['Disposition'][_0x869f('0x4b')](_0x2ca1dc)[_0x869f('0x26')](handleEntityNotFound(_0x1b03f9,null))[_0x869f('0x26')](respondWithResult(_0x1b03f9,null))[_0x869f('0x4c')](handleError(_0x1b03f9,null));};exports[_0x869f('0x4d')]=function(_0x5228c7,_0x19c1d8){return db['Disposition'][_0x869f('0x4d')](_0x5228c7[_0x869f('0x4e')],{})[_0x869f('0x26')](function(_0x3b38b0){var _0x5e5c59=_0x5228c7[_0x869f('0x4f')][_0x869f('0x28')]({'plain':!![]});if(!_0x5e5c59)throw new Error(_0x869f('0x50'));if(_0x5e5c59['role']===_0x869f('0x4f')){var _0x555d9a=_0x3b38b0[_0x869f('0x28')]({'plain':!![]});var _0x3712c4=_0x869f('0x29');return db[_0x869f('0x51')][_0x869f('0x4b')]({'where':{'name':_0x3712c4,'userProfileId':_0x5e5c59[_0x869f('0x52')]},'raw':!![]})[_0x869f('0x26')](function(_0x45bb7e){if(_0x45bb7e&&_0x45bb7e[_0x869f('0x53')]===0x0){return db[_0x869f('0x54')]['create']({'name':_0x555d9a[_0x869f('0x2c')],'resourceId':_0x555d9a['id'],'type':_0x45bb7e[_0x869f('0x2c')],'sectionId':_0x45bb7e['id']},{})['then'](function(){return _0x3b38b0;});}else{return _0x3b38b0;}})[_0x869f('0x4c')](function(_0x59ba43){logger[_0x869f('0x2a')](_0x869f('0x55'),_0x59ba43);throw _0x59ba43;});}return _0x3b38b0;})[_0x869f('0x26')](respondWithResult(_0x19c1d8,0xc9))[_0x869f('0x4c')](handleError(_0x19c1d8,null));};exports[_0x869f('0x25')]=function(_0x2dc888,_0x3c5d03){if(_0x2dc888[_0x869f('0x4e')]['id']){delete _0x2dc888[_0x869f('0x4e')]['id'];}return db[_0x869f('0x2f')][_0x869f('0x4b')]({'where':{'id':_0x2dc888['params']['id']}})[_0x869f('0x26')](handleEntityNotFound(_0x3c5d03,null))[_0x869f('0x26')](saveUpdates(_0x2dc888[_0x869f('0x4e')],null))['then'](respondWithResult(_0x3c5d03,null))['catch'](handleError(_0x3c5d03,null));};exports[_0x869f('0x27')]=function(_0x540825,_0x477773){return db[_0x869f('0x2f')]['find']({'where':{'id':_0x540825['params']['id']}})[_0x869f('0x26')](handleEntityNotFound(_0x477773,null))['then'](removeEntity(_0x477773,null))[_0x869f('0x4c')](handleError(_0x477773,null));}; \ No newline at end of file +var _0xc2d6=['get','UserProfileResource','status','error','name','send','index','Disposition','rawAttributes','model','keys','filters','query','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Dispositions','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xc2d6,0x171));var _0x6c2d=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xc2d6[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c2d('0x0'));var zipdir=require(_0x6c2d('0x1'));var jsonpatch=require(_0x6c2d('0x2'));var rp=require(_0x6c2d('0x3'));var moment=require(_0x6c2d('0x4'));var BPromise=require(_0x6c2d('0x5'));var Mustache=require(_0x6c2d('0x6'));var util=require(_0x6c2d('0x7'));var path=require(_0x6c2d('0x8'));var sox=require(_0x6c2d('0x9'));var csv=require('to-csv');var ejs=require(_0x6c2d('0xa'));var fs=require('fs');var fs_extra=require(_0x6c2d('0xb'));var _=require(_0x6c2d('0xc'));var squel=require('squel');var crypto=require(_0x6c2d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c2d('0xe'));var toCsv=require(_0x6c2d('0xf'));var querystring=require(_0x6c2d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c2d('0x11'));var qs=require(_0x6c2d('0x12'));var as=require(_0x6c2d('0x13'));var hardwareService=require(_0x6c2d('0x14'));var logger=require('../../config/logger')(_0x6c2d('0x15'));var utils=require(_0x6c2d('0x16'));var config=require(_0x6c2d('0x17'));var licenseUtil=require(_0x6c2d('0x18'));var db=require(_0x6c2d('0x19'))['db'];function respondWithStatusCode(_0x177240,_0x5ccd68){_0x5ccd68=_0x5ccd68||0xcc;return function(_0x5be11c){if(_0x5be11c){return _0x177240[_0x6c2d('0x1a')](_0x5ccd68);}return _0x177240['status'](_0x5ccd68)[_0x6c2d('0x1b')]();};}function respondWithResult(_0x4632b3,_0x2b6dbf){_0x2b6dbf=_0x2b6dbf||0xc8;return function(_0x5ca11d){if(_0x5ca11d){return _0x4632b3['status'](_0x2b6dbf)[_0x6c2d('0x1c')](_0x5ca11d);}};}function respondWithFilteredResult(_0x500f62,_0x2e9475){return function(_0x109eef){if(_0x109eef){var _0x28ff75=typeof _0x2e9475[_0x6c2d('0x1d')]===_0x6c2d('0x1e')&&typeof _0x2e9475[_0x6c2d('0x1f')]==='undefined';var _0x1f75b5=_0x109eef[_0x6c2d('0x20')];var _0xc70f8e=_0x28ff75?0x0:_0x2e9475[_0x6c2d('0x1d')];var _0x37ecbe=_0x28ff75?_0x109eef[_0x6c2d('0x20')]:_0x2e9475[_0x6c2d('0x1d')]+_0x2e9475[_0x6c2d('0x1f')];var _0x4785c9;if(_0x37ecbe>=_0x1f75b5){_0x37ecbe=_0x1f75b5;_0x4785c9=0xc8;}else{_0x4785c9=0xce;}_0x500f62['status'](_0x4785c9);return _0x500f62[_0x6c2d('0x21')](_0x6c2d('0x22'),_0xc70f8e+'-'+_0x37ecbe+'/'+_0x1f75b5)['json'](_0x109eef);}return null;};}function patchUpdates(_0xe941d9){return function(_0x1f3941){try{jsonpatch[_0x6c2d('0x23')](_0x1f3941,_0xe941d9,!![]);}catch(_0x580395){return BPromise[_0x6c2d('0x24')](_0x580395);}return _0x1f3941[_0x6c2d('0x25')]();};}function saveUpdates(_0x494053,_0x3354c2){return function(_0x236656){if(_0x236656){return _0x236656[_0x6c2d('0x26')](_0x494053)['then'](function(_0x17b078){return _0x17b078;});}return null;};}function removeEntity(_0x440b48,_0x595a42){return function(_0x5ea17f){if(_0x5ea17f){return _0x5ea17f[_0x6c2d('0x27')]()[_0x6c2d('0x28')](function(){var _0x52da05=_0x5ea17f[_0x6c2d('0x29')]({'plain':!![]});var _0x70fec3='Dispositions';return db[_0x6c2d('0x2a')]['destroy']({'where':{'type':_0x70fec3,'resourceId':_0x52da05['id']}})[_0x6c2d('0x28')](function(){return _0x5ea17f;});})[_0x6c2d('0x28')](function(){_0x440b48[_0x6c2d('0x2b')](0xcc)[_0x6c2d('0x1b')]();});}};}function handleEntityNotFound(_0x2a639b,_0x15920f){return function(_0x450f43){if(!_0x450f43){_0x2a639b[_0x6c2d('0x1a')](0x194);}return _0x450f43;};}function handleError(_0x2eae75,_0x2358b4){_0x2358b4=_0x2358b4||0x1f4;return function(_0x3c8d61){logger[_0x6c2d('0x2c')](_0x3c8d61['stack']);if(_0x3c8d61[_0x6c2d('0x2d')]){delete _0x3c8d61[_0x6c2d('0x2d')];}_0x2eae75['status'](_0x2358b4)[_0x6c2d('0x2e')](_0x3c8d61);};}exports[_0x6c2d('0x2f')]=function(_0x3df0dd,_0x269846){var _0x3f340c={},_0x3aa4e6={},_0x5a78e9={'count':0x0,'rows':[]};var _0x5a6a2e=_['map'](db[_0x6c2d('0x30')][_0x6c2d('0x31')],function(_0x18fc52){return{'name':_0x18fc52['fieldName'],'type':_0x18fc52['type']['key']};});_0x3aa4e6[_0x6c2d('0x32')]=_['map'](_0x5a6a2e,'name');_0x3aa4e6['query']=_[_0x6c2d('0x33')](_0x3df0dd['query']);_0x3aa4e6[_0x6c2d('0x34')]=_['intersection'](_0x3aa4e6[_0x6c2d('0x32')],_0x3aa4e6[_0x6c2d('0x35')]);_0x3f340c[_0x6c2d('0x36')]=_[_0x6c2d('0x37')](_0x3aa4e6[_0x6c2d('0x32')],qs[_0x6c2d('0x38')](_0x3df0dd[_0x6c2d('0x35')]['fields']));_0x3f340c[_0x6c2d('0x36')]=_0x3f340c[_0x6c2d('0x36')]['length']?_0x3f340c['attributes']:_0x3aa4e6[_0x6c2d('0x32')];if(!_0x3df0dd[_0x6c2d('0x35')]['hasOwnProperty'](_0x6c2d('0x39'))){_0x3f340c[_0x6c2d('0x1f')]=qs[_0x6c2d('0x1f')](_0x3df0dd[_0x6c2d('0x35')][_0x6c2d('0x1f')]);_0x3f340c[_0x6c2d('0x1d')]=qs[_0x6c2d('0x1d')](_0x3df0dd[_0x6c2d('0x35')][_0x6c2d('0x1d')]);}_0x3f340c[_0x6c2d('0x3a')]=qs[_0x6c2d('0x3b')](_0x3df0dd['query']['sort']);_0x3f340c['where']=qs[_0x6c2d('0x34')](_[_0x6c2d('0x3c')](_0x3df0dd[_0x6c2d('0x35')],_0x3aa4e6['filters']),_0x5a6a2e);if(_0x3df0dd[_0x6c2d('0x35')][_0x6c2d('0x3d')]){_0x3f340c[_0x6c2d('0x3e')]=_[_0x6c2d('0x3f')](_0x3f340c['where'],{'$or':_[_0x6c2d('0x40')](_0x5a6a2e,function(_0xa0417c){if(_0xa0417c['type']!==_0x6c2d('0x41')){var _0x322adc={};_0x322adc[_0xa0417c['name']]={'$like':'%'+_0x3df0dd['query']['filter']+'%'};return _0x322adc;}})});}_0x3f340c=_[_0x6c2d('0x3f')]({},_0x3f340c,_0x3df0dd['options']);var _0x47e891={'where':_0x3f340c[_0x6c2d('0x3e')]};return db[_0x6c2d('0x30')][_0x6c2d('0x20')](_0x47e891)[_0x6c2d('0x28')](function(_0x451d33){_0x5a78e9[_0x6c2d('0x20')]=_0x451d33;if(_0x3df0dd['query'][_0x6c2d('0x42')]){_0x3f340c[_0x6c2d('0x43')]=[{'all':!![]}];}return db[_0x6c2d('0x30')][_0x6c2d('0x44')](_0x3f340c);})[_0x6c2d('0x28')](function(_0x43fb66){_0x5a78e9['rows']=_0x43fb66;return _0x5a78e9;})[_0x6c2d('0x28')](respondWithFilteredResult(_0x269846,_0x3f340c))[_0x6c2d('0x45')](handleError(_0x269846,null));};exports[_0x6c2d('0x46')]=function(_0x385315,_0x5978f3){var _0x3eadf2={'raw':!![],'where':{'id':_0x385315[_0x6c2d('0x47')]['id']}},_0x35fb5d={};_0x35fb5d[_0x6c2d('0x32')]=_[_0x6c2d('0x33')](db[_0x6c2d('0x30')][_0x6c2d('0x31')]);_0x35fb5d[_0x6c2d('0x35')]=_[_0x6c2d('0x33')](_0x385315['query']);_0x35fb5d[_0x6c2d('0x34')]=_[_0x6c2d('0x37')](_0x35fb5d[_0x6c2d('0x32')],_0x35fb5d[_0x6c2d('0x35')]);_0x3eadf2['attributes']=_[_0x6c2d('0x37')](_0x35fb5d[_0x6c2d('0x32')],qs[_0x6c2d('0x38')](_0x385315['query'][_0x6c2d('0x38')]));_0x3eadf2['attributes']=_0x3eadf2[_0x6c2d('0x36')]['length']?_0x3eadf2['attributes']:_0x35fb5d[_0x6c2d('0x32')];if(_0x385315[_0x6c2d('0x35')][_0x6c2d('0x42')]){_0x3eadf2[_0x6c2d('0x43')]=[{'all':!![]}];}_0x3eadf2=_[_0x6c2d('0x3f')]({},_0x3eadf2,_0x385315[_0x6c2d('0x48')]);return db[_0x6c2d('0x30')][_0x6c2d('0x49')](_0x3eadf2)[_0x6c2d('0x28')](handleEntityNotFound(_0x5978f3,null))['then'](respondWithResult(_0x5978f3,null))[_0x6c2d('0x45')](handleError(_0x5978f3,null));};exports[_0x6c2d('0x4a')]=function(_0x4d98ce,_0x40ae43){return db[_0x6c2d('0x30')]['create'](_0x4d98ce[_0x6c2d('0x4b')],{})[_0x6c2d('0x28')](function(_0x560c35){var _0xad3ded=_0x4d98ce['user'][_0x6c2d('0x29')]({'plain':!![]});if(!_0xad3ded)throw new Error(_0x6c2d('0x4c'));if(_0xad3ded[_0x6c2d('0x4d')]===_0x6c2d('0x4e')){var _0x4f14ef=_0x560c35['get']({'plain':!![]});var _0x4743a4=_0x6c2d('0x4f');return db['UserProfileSection'][_0x6c2d('0x49')]({'where':{'name':_0x4743a4,'userProfileId':_0xad3ded[_0x6c2d('0x50')]},'raw':!![]})['then'](function(_0x538e6d){if(_0x538e6d&&_0x538e6d['autoAssociation']===0x0){return db[_0x6c2d('0x2a')][_0x6c2d('0x4a')]({'name':_0x4f14ef[_0x6c2d('0x2d')],'resourceId':_0x4f14ef['id'],'type':_0x538e6d['name'],'sectionId':_0x538e6d['id']},{})['then'](function(){return _0x560c35;});}else{return _0x560c35;}})[_0x6c2d('0x45')](function(_0x7001bb){logger[_0x6c2d('0x2c')](_0x6c2d('0x51'),_0x7001bb);throw _0x7001bb;});}return _0x560c35;})['then'](respondWithResult(_0x40ae43,0xc9))[_0x6c2d('0x45')](handleError(_0x40ae43,null));};exports[_0x6c2d('0x26')]=function(_0x4843d0,_0x21a45f){if(_0x4843d0[_0x6c2d('0x4b')]['id']){delete _0x4843d0['body']['id'];}return db[_0x6c2d('0x30')]['find']({'where':{'id':_0x4843d0[_0x6c2d('0x47')]['id']}})[_0x6c2d('0x28')](handleEntityNotFound(_0x21a45f,null))[_0x6c2d('0x28')](saveUpdates(_0x4843d0[_0x6c2d('0x4b')],null))[_0x6c2d('0x28')](respondWithResult(_0x21a45f,null))['catch'](handleError(_0x21a45f,null));};exports[_0x6c2d('0x27')]=function(_0x3d762d,_0x48a578){return db['Disposition'][_0x6c2d('0x49')]({'where':{'id':_0x3d762d[_0x6c2d('0x47')]['id']}})['then'](handleEntityNotFound(_0x48a578,null))['then'](removeEntity(_0x48a578,null))['catch'](handleError(_0x48a578,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3d7dc71..7f876dc 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 _0xa973=['../../config/environment','./disposition.attributes','exports','define','name_voice','ListId','name_chat','name','ChatWebsiteId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','path'];(function(_0xedd2d7,_0x2f6ec7){var _0x5d1692=function(_0x4aa736){while(--_0x4aa736){_0xedd2d7['push'](_0xedd2d7['shift']());}};_0x5d1692(++_0x2f6ec7);}(_0xa973,0x73));var _0x3a97=function(_0x3182f2,_0x242888){_0x3182f2=_0x3182f2-0x0;var _0x5ed78d=_0xa973[_0x3182f2];return _0x5ed78d;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var logger=require(_0x3a97('0x2'))(_0x3a97('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a97('0x4'));var rimraf=require('rimraf');var config=require(_0x3a97('0x5'));var attributes=require(_0x3a97('0x6'));module[_0x3a97('0x7')]=function(_0x4a1f55,_0x508cc6){return _0x4a1f55[_0x3a97('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x3a97('0x9'),'fields':['name',_0x3a97('0xa')]},{'unique':!![],'name':_0x3a97('0xb'),'fields':[_0x3a97('0xc'),_0x3a97('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x3a97('0xc'),'MailAccountId']},{'unique':!![],'name':_0x3a97('0xe'),'fields':[_0x3a97('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x3a97('0xf'),'fields':[_0x3a97('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x3a97('0x10'),'fields':[_0x3a97('0xc'),_0x3a97('0x11')]},{'unique':!![],'name':_0x3a97('0x12'),'fields':['name',_0x3a97('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c03=['exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c03,0x88));var _0x39c0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9c03[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x39c0('0x0'));var util=require('util');var logger=require(_0x39c0('0x1'))(_0x39c0('0x2'));var moment=require('moment');var BPromise=require(_0x39c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39c0('0x4'));var rimraf=require(_0x39c0('0x5'));var config=require(_0x39c0('0x6'));var attributes=require(_0x39c0('0x7'));module[_0x39c0('0x8')]=function(_0x34aad2,_0x29bc18){return _0x34aad2[_0x39c0('0x9')](_0x39c0('0xa'),attributes,{'tableName':_0x39c0('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x39c0('0xc'),'fields':[_0x39c0('0xd'),_0x39c0('0xe')]},{'unique':!![],'name':_0x39c0('0xf'),'fields':[_0x39c0('0xd'),_0x39c0('0x10')]},{'unique':!![],'name':_0x39c0('0x11'),'fields':[_0x39c0('0xd'),'MailAccountId']},{'unique':!![],'name':_0x39c0('0x12'),'fields':[_0x39c0('0xd'),_0x39c0('0x13')]},{'unique':!![],'name':_0x39c0('0x14'),'fields':[_0x39c0('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x39c0('0xd'),_0x39c0('0x15')]},{'unique':!![],'name':_0x39c0('0x16'),'fields':[_0x39c0('0xd'),_0x39c0('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1390b3a..a6dbd21 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(_0xc56f23,_0x5941ff){var _0x24191c=function(_0x291da0){while(--_0x291da0){_0xc56f23['push'](_0xc56f23['shift']());}};_0x24191c(++_0x5941ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x19681e,_0x35f032){var _0x438514=function(_0x5d8aa6){while(--_0x5d8aa6){_0x19681e['push'](_0x19681e['shift']());}};_0x438514(++_0x35f032);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 2e812b8..dd4a331 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 _0xd9b9=['../../components/interaction/service','isAuthenticated','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9b9,0xea));var _0x9d9b=function(_0x57eed4,_0x3537a4){_0x57eed4=_0x57eed4-0x0;var _0xd1337c=_0xd9b9[_0x57eed4];return _0xd1337c;};'use strict';var multer=require('multer');var util=require(_0x9d9b('0x0'));var path=require(_0x9d9b('0x1'));var timeout=require(_0x9d9b('0x2'));var express=require(_0x9d9b('0x3'));var router=express[_0x9d9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d9b('0x5'));var interaction=require(_0x9d9b('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth[_0x9d9b('0x7')](),controller['index']);router['get'](_0x9d9b('0x8'),auth[_0x9d9b('0x7')](),controller['show']);router['post']('/',auth[_0x9d9b('0x7')](),controller[_0x9d9b('0x9')]);router[_0x9d9b('0xa')](_0x9d9b('0x8'),auth[_0x9d9b('0x7')](),controller[_0x9d9b('0xb')]);router[_0x9d9b('0xc')](_0x9d9b('0x8'),auth['isAuthenticated'](),controller[_0x9d9b('0xd')]);module[_0x9d9b('0xe')]=router; \ No newline at end of file +var _0x1399=['index','get','/:id','show','post','create','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x1399,0x1d7));var _0x9139=function(_0x48d007,_0x446953){_0x48d007=_0x48d007-0x0;var _0x412d80=_0x1399[_0x48d007];return _0x412d80;};'use strict';var multer=require(_0x9139('0x0'));var util=require('util');var path=require(_0x9139('0x1'));var timeout=require(_0x9139('0x2'));var express=require(_0x9139('0x3'));var router=express['Router']();var fs_extra=require(_0x9139('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9139('0x5'));var config=require(_0x9139('0x6'));var controller=require(_0x9139('0x7'));router['get']('/',auth[_0x9139('0x8')](),controller[_0x9139('0x9')]);router[_0x9139('0xa')](_0x9139('0xb'),auth[_0x9139('0x8')](),controller[_0x9139('0xc')]);router[_0x9139('0xd')]('/',auth['isAuthenticated'](),controller[_0x9139('0xe')]);router['put']('/:id',auth[_0x9139('0x8')](),controller['update']);router['delete'](_0x9139('0xb'),auth['isAuthenticated'](),controller[_0x9139('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 47eec1f..49a6fc6 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 _0x05b9=['DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','12000','4800','INTEGER','SIP'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x05b9,0x7f));var _0x905b=function(_0x22ad3d,_0x2abad6){_0x22ad3d=_0x22ad3d-0x0;var _0x35700e=_0x05b9[_0x22ad3d];return _0x35700e;};'use strict';var Sequelize=require(_0x905b('0x0'));module[_0x905b('0x1')]={'name':{'type':Sequelize[_0x905b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x905b('0x2')]},'ecm':{'type':Sequelize[_0x905b('0x3')]('yes','no'),'defaultValue':_0x905b('0x4')},'headerinfo':{'type':Sequelize[_0x905b('0x2')],'defaultValue':_0x905b('0x5')},'localstationid':{'type':Sequelize[_0x905b('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x905b('0x6'),'4800',_0x905b('0x7'),_0x905b('0x8'),_0x905b('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x905b('0x3')](_0x905b('0x6'),_0x905b('0xa'),_0x905b('0x7'),_0x905b('0x8'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x905b('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x905b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x905b('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x905b('0x3')](_0x905b('0xc'),'IAX',_0x905b('0xd'),_0x905b('0xe')),'defaultValue':_0x905b('0xc')},'key':{'type':Sequelize[_0x905b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x905b('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x905b('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x905b('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x905b('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x905b('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x905b('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x905b('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x905b('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x905b('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x434403){if(!_0x434403)this[_0x905b('0x12')](_0x905b('0x13'),null);this['setDataValue']('mandatoryDisposition',_0x434403);}}}; \ No newline at end of file +var _0x0a91=['xCALLY\x20Motion\x20Fax','localstationid','7200','9600','14400','4800','2400','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x5ff2b2,_0x494e8c){var _0x4c7817=function(_0x185f84){while(--_0x185f84){_0x5ff2b2['push'](_0x5ff2b2['shift']());}};_0x4c7817(++_0x494e8c);}(_0x0a91,0x140));var _0x10a9=function(_0x43794c,_0x4b4158){_0x43794c=_0x43794c-0x0;var _0xa31045=_0x0a91[_0x43794c];return _0xa31045;};'use strict';var Sequelize=require(_0x10a9('0x0'));module[_0x10a9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x10a9('0x2')]},'ecm':{'type':Sequelize[_0x10a9('0x3')]('yes','no'),'defaultValue':_0x10a9('0x4')},'headerinfo':{'type':Sequelize[_0x10a9('0x2')],'defaultValue':_0x10a9('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x10a9('0x6')},'minrate':{'type':Sequelize[_0x10a9('0x3')]('2400','4800',_0x10a9('0x7'),_0x10a9('0x8'),'12000',_0x10a9('0x9')),'defaultValue':_0x10a9('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x10a9('0xb'),_0x10a9('0xa'),_0x10a9('0x7'),_0x10a9('0x8'),'12000',_0x10a9('0x9')),'defaultValue':_0x10a9('0x9')},'modem':{'type':Sequelize[_0x10a9('0x2')],'defaultValue':_0x10a9('0xc')},'gateway':{'type':Sequelize[_0x10a9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x10a9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x10a9('0x3')](_0x10a9('0xd'),_0x10a9('0xe'),'DADHI',_0x10a9('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x10a9('0x10')],'defaultValue':function(){return _0x10a9('0x11');}},'notificationSound':{'type':Sequelize[_0x10a9('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x10a9('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x10a9('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x10a9('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x10a9('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x10a9('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x10a9('0x12')],'defaultValue':![],'comment':_0x10a9('0x15'),'set':function(_0x33a92d){if(!_0x33a92d)this[_0x10a9('0x16')](_0x10a9('0x17'),null);this[_0x10a9('0x16')](_0x10a9('0x18'),_0x33a92d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4157701..cad474b 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 _0x8c3e=['removeAgents','userFaxAccount:remove','getAgents','User','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./faxAccount.socket','register','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','index','Pause','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','FaxAccount','includeAll','findAll','rows','show','params','mandatoryDispositionPause','fields','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','removeDispositions','addAnswer','getAnswers','order','CannedAnswer','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','finally','sendStatus','send','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','localstationid','gateway','faxdetect','maxrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x8c3e,0x180));var _0xe8c3=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0x8c3e[_0x4a1353];return _0x3805cc;};'use strict';var emlformat=require(_0xe8c3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe8c3('0x1'));var rp=require(_0xe8c3('0x2'));var moment=require(_0xe8c3('0x3'));var BPromise=require(_0xe8c3('0x4'));var Mustache=require(_0xe8c3('0x5'));var util=require(_0xe8c3('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe8c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8c3('0x8'));var _=require(_0xe8c3('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8c3('0x7'));var querystring=require(_0xe8c3('0xa'));var Papa=require('papaparse');var Redis=require(_0xe8c3('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe8c3('0xc'));var hardwareService=require(_0xe8c3('0xd'));var logger=require(_0xe8c3('0xe'))(_0xe8c3('0xf'));var utils=require('../../config/utils');var config=require(_0xe8c3('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8c3('0x11'))['db'];config['redis']=_[_0xe8c3('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8c3('0x13'))(new Redis(config['redis']));require(_0xe8c3('0x14'))[_0xe8c3('0x15')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xe8c3('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x15e807,_0x2609bc,_0x509870,_0x35a74b){return new BPromise(function(_0x49c806,_0x4b6a63){var _0x27a9a0=_0x35a74b||client;return _0x27a9a0[_0xe8c3('0x17')](_0x15e807,_0x509870)[_0xe8c3('0x18')](function(_0x5dd92c){logger[_0xe8c3('0x19')](_0xe8c3('0x1a'),_0x2609bc,'request\x20sent');logger[_0xe8c3('0x1b')](_0xe8c3('0x1c'),_0x2609bc,'request\x20sent',JSON[_0xe8c3('0x1d')](_0x5dd92c));if(_0x5dd92c['error']){if(_0x5dd92c[_0xe8c3('0x1e')][_0xe8c3('0x1f')]===0x1f4){logger[_0xe8c3('0x1e')](_0xe8c3('0x1a'),_0x2609bc,_0x5dd92c['error'][_0xe8c3('0x20')]);return _0x4b6a63(_0x5dd92c[_0xe8c3('0x1e')]['message']);}logger[_0xe8c3('0x1e')](_0xe8c3('0x1a'),_0x2609bc,_0x5dd92c[_0xe8c3('0x1e')][_0xe8c3('0x20')]);return _0x49c806(_0x5dd92c[_0xe8c3('0x1e')]['message']);}else{logger[_0xe8c3('0x19')](_0xe8c3('0x1a'),_0x2609bc,_0xe8c3('0x21'));_0x49c806(_0x5dd92c[_0xe8c3('0x22')][_0xe8c3('0x20')]);}})[_0xe8c3('0x23')](function(_0x447561){logger['error'](_0xe8c3('0x1a'),_0x2609bc,_0x447561);_0x4b6a63(_0x447561);});});}function respondWithStatusCode(_0x30d185,_0x156d48){_0x156d48=_0x156d48||0xcc;return function(_0x1d9f81){if(_0x1d9f81){return _0x30d185['sendStatus'](_0x156d48);}return _0x30d185[_0xe8c3('0x24')](_0x156d48)['end']();};}function respondWithResult(_0xb2b0dd,_0x5afdfb){_0x5afdfb=_0x5afdfb||0xc8;return function(_0x420dc6){if(_0x420dc6){return _0xb2b0dd[_0xe8c3('0x24')](_0x5afdfb)[_0xe8c3('0x25')](_0x420dc6);}};}function respondWithFilteredResult(_0x862800,_0x2af293){return function(_0x4e0983){if(_0x4e0983){var _0x4ba239=typeof _0x2af293[_0xe8c3('0x26')]==='undefined'&&typeof _0x2af293['limit']===_0xe8c3('0x27');var _0x2f3a3e=_0x4e0983[_0xe8c3('0x28')];var _0x306456=_0x4ba239?0x0:_0x2af293[_0xe8c3('0x26')];var _0x334306=_0x4ba239?_0x4e0983[_0xe8c3('0x28')]:_0x2af293[_0xe8c3('0x26')]+_0x2af293[_0xe8c3('0x29')];var _0x43f277;if(_0x334306>=_0x2f3a3e){_0x334306=_0x2f3a3e;_0x43f277=0xc8;}else{_0x43f277=0xce;}_0x862800['status'](_0x43f277);return _0x862800[_0xe8c3('0x2a')]('Content-Range',_0x306456+'-'+_0x334306+'/'+_0x2f3a3e)[_0xe8c3('0x25')](_0x4e0983);}return null;};}function patchUpdates(_0xb892b8){return function(_0x512863){try{jsonpatch['apply'](_0x512863,_0xb892b8,!![]);}catch(_0x4d8541){return BPromise[_0xe8c3('0x2b')](_0x4d8541);}return _0x512863[_0xe8c3('0x2c')]();};}function saveUpdates(_0x560555,_0x569146){return function(_0x2b0b43){if(_0x2b0b43){return _0x2b0b43[_0xe8c3('0x2d')](_0x560555)[_0xe8c3('0x18')](function(_0xf4c1dc){return _0xf4c1dc;});}return null;};}function removeEntity(_0x3e3066,_0x145b8a){return function(_0x3a817a){if(_0x3a817a){return _0x3a817a[_0xe8c3('0x2e')]()[_0xe8c3('0x18')](function(){var _0x5e7878=_0x3a817a['get']({'plain':!![]});var _0x293e5c=_0xe8c3('0x2f');return db[_0xe8c3('0x30')][_0xe8c3('0x2e')]({'where':{'type':_0x293e5c,'resourceId':_0x5e7878['id']}})[_0xe8c3('0x18')](function(){return _0x3a817a;});})[_0xe8c3('0x18')](function(){_0x3e3066[_0xe8c3('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13481d,_0x1797c0){return function(_0x54807d){if(!_0x54807d){_0x13481d['sendStatus'](0x194);}return _0x54807d;};}function handleError(_0x21b377,_0x228694){_0x228694=_0x228694||0x1f4;return function(_0x4e465e){logger[_0xe8c3('0x1e')](_0x4e465e[_0xe8c3('0x31')]);if(_0x4e465e[_0xe8c3('0x32')]){delete _0x4e465e[_0xe8c3('0x32')];}_0x21b377[_0xe8c3('0x24')](_0x228694)['send'](_0x4e465e);};}exports[_0xe8c3('0x33')]=function(_0x21d820,_0x52cd9b){var _0x260800={'include':[{'model':db[_0xe8c3('0x34')],'as':'mandatoryDispositionPause'}]},_0x456cac={},_0x45b9a6={'count':0x0,'rows':[]};var _0x3eaf42=_[_0xe8c3('0x35')](db['FaxAccount'][_0xe8c3('0x36')],function(_0x5b264d){return{'name':_0x5b264d['fieldName'],'type':_0x5b264d[_0xe8c3('0x37')]['key']};});_0x456cac[_0xe8c3('0x38')]=_[_0xe8c3('0x35')](_0x3eaf42,_0xe8c3('0x32'));_0x456cac[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x21d820[_0xe8c3('0x39')]);_0x456cac[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x456cac[_0xe8c3('0x38')],_0x456cac[_0xe8c3('0x39')]);_0x260800['attributes']=_[_0xe8c3('0x3c')](_0x456cac[_0xe8c3('0x38')],qs['fields'](_0x21d820[_0xe8c3('0x39')]['fields']));_0x260800[_0xe8c3('0x3d')]=_0x260800[_0xe8c3('0x3d')]['length']?_0x260800['attributes']:_0x456cac['model'];if(!_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x260800[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x260800[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x21d820['query'][_0xe8c3('0x26')]);}_0x260800['order']=qs[_0xe8c3('0x40')](_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x260800[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x21d820[_0xe8c3('0x39')],_0x456cac[_0xe8c3('0x3b')]),_0x3eaf42);if(_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x260800[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x260800[_0xe8c3('0x41')],{'$or':_['map'](_0x3eaf42,function(_0x35f876){if(_0x35f876[_0xe8c3('0x37')]!=='VIRTUAL'){var _0x336cbd={};_0x336cbd[_0x35f876[_0xe8c3('0x32')]]={'$like':'%'+_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x336cbd;}})});}_0x260800=_[_0xe8c3('0x44')]({},_0x260800,_0x21d820[_0xe8c3('0x45')]);var _0x50b3fd={'where':_0x260800[_0xe8c3('0x41')]};return db[_0xe8c3('0x46')]['count'](_0x50b3fd)[_0xe8c3('0x18')](function(_0x9c791d){_0x45b9a6[_0xe8c3('0x28')]=_0x9c791d;if(_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x47')]){_0x260800['include']=[{'all':!![]}];}return db[_0xe8c3('0x46')][_0xe8c3('0x48')](_0x260800);})[_0xe8c3('0x18')](function(_0x506e89){_0x45b9a6[_0xe8c3('0x49')]=_0x506e89;return _0x45b9a6;})[_0xe8c3('0x18')](respondWithFilteredResult(_0x52cd9b,_0x260800))[_0xe8c3('0x23')](handleError(_0x52cd9b,null));};exports[_0xe8c3('0x4a')]=function(_0x42f3d8,_0x5a0822){var _0x5ee33d={'raw':![],'where':{'id':_0x42f3d8[_0xe8c3('0x4b')]['id']},'include':[{'model':db['Pause'],'as':_0xe8c3('0x4c')}]},_0x1c1e0a={};_0x1c1e0a[_0xe8c3('0x38')]=_['keys'](db[_0xe8c3('0x46')][_0xe8c3('0x36')]);_0x1c1e0a['query']=_['keys'](_0x42f3d8[_0xe8c3('0x39')]);_0x1c1e0a['filters']=_[_0xe8c3('0x3c')](_0x1c1e0a[_0xe8c3('0x38')],_0x1c1e0a[_0xe8c3('0x39')]);_0x5ee33d[_0xe8c3('0x3d')]=_['intersection'](_0x1c1e0a['model'],qs[_0xe8c3('0x4d')](_0x42f3d8['query']['fields']));_0x5ee33d[_0xe8c3('0x3d')]=_0x5ee33d[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x5ee33d[_0xe8c3('0x3d')]:_0x1c1e0a[_0xe8c3('0x38')];if(_0x42f3d8[_0xe8c3('0x39')][_0xe8c3('0x47')]){_0x5ee33d[_0xe8c3('0x4f')]=[{'all':!![]}];}_0x5ee33d=_[_0xe8c3('0x44')]({},_0x5ee33d,_0x42f3d8[_0xe8c3('0x45')]);return db[_0xe8c3('0x46')][_0xe8c3('0x50')](_0x5ee33d)[_0xe8c3('0x18')](handleEntityNotFound(_0x5a0822,null))['then'](respondWithResult(_0x5a0822,null))[_0xe8c3('0x23')](handleError(_0x5a0822,null));};exports[_0xe8c3('0x51')]=function(_0x46e119,_0x83e652){return db[_0xe8c3('0x46')][_0xe8c3('0x51')](_0x46e119[_0xe8c3('0x52')],{})[_0xe8c3('0x18')](function(_0x41491a){var _0x2636a1=_0x46e119[_0xe8c3('0x53')][_0xe8c3('0x54')]({'plain':!![]});if(!_0x2636a1)throw new Error(_0xe8c3('0x55'));if(_0x2636a1[_0xe8c3('0x56')]===_0xe8c3('0x53')){var _0x567083=_0x41491a['get']({'plain':!![]});var _0x17fcae=_0xe8c3('0x2f');return db[_0xe8c3('0x57')][_0xe8c3('0x50')]({'where':{'name':_0x17fcae,'userProfileId':_0x2636a1['userProfileId']},'raw':!![]})[_0xe8c3('0x18')](function(_0x465486){if(_0x465486&&_0x465486[_0xe8c3('0x58')]===0x0){return db[_0xe8c3('0x30')]['create']({'name':_0x567083['name'],'resourceId':_0x567083['id'],'type':_0x465486[_0xe8c3('0x32')],'sectionId':_0x465486['id']},{})['then'](function(){return _0x41491a;});}else{return _0x41491a;}})[_0xe8c3('0x23')](function(_0xf0b596){logger[_0xe8c3('0x1e')](_0xe8c3('0x59'),_0xf0b596);throw _0xf0b596;});}return _0x41491a;})[_0xe8c3('0x18')](respondWithResult(_0x83e652,0xc9))[_0xe8c3('0x23')](handleError(_0x83e652,null));};exports[_0xe8c3('0x2d')]=function(_0x218fba,_0x3efad2){if(_0x218fba[_0xe8c3('0x52')]['id']){delete _0x218fba[_0xe8c3('0x52')]['id'];}return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x218fba['params']['id']},'include':[{'model':db[_0xe8c3('0x34')],'as':'mandatoryDispositionPause'}]})[_0xe8c3('0x18')](handleEntityNotFound(_0x3efad2,null))[_0xe8c3('0x18')](saveUpdates(_0x218fba[_0xe8c3('0x52')],null))[_0xe8c3('0x18')](respondWithResult(_0x3efad2,null))[_0xe8c3('0x23')](handleError(_0x3efad2,null));};exports[_0xe8c3('0x2e')]=function(_0x245613,_0xbd0a98){return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x245613['params']['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0xbd0a98,null))[_0xe8c3('0x18')](removeEntity(_0xbd0a98,null))['catch'](handleError(_0xbd0a98,null));};exports[_0xe8c3('0x5a')]=function(_0x5f49ea,_0x585441){return db[_0xe8c3('0x46')][_0xe8c3('0x5a')]()['then'](respondWithResult(_0x585441,null))[_0xe8c3('0x23')](handleError(_0x585441,null));};exports[_0xe8c3('0x5b')]=function(_0x47912a,_0x1b411f,_0x665300){if(_0x47912a[_0xe8c3('0x52')]['id']){delete _0x47912a[_0xe8c3('0x52')]['id'];}return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0x47912a[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x1b411f,null))[_0xe8c3('0x18')](function(_0x54ff61){if(_0x54ff61){_0x47912a['body'][_0xe8c3('0x5c')]=_0x54ff61['id'];return db[_0xe8c3('0x5d')][_0xe8c3('0x51')](_0x47912a[_0xe8c3('0x52')]);}})['then'](respondWithResult(_0x1b411f,null))[_0xe8c3('0x23')](handleError(_0x1b411f,null));};exports['getDispositions']=function(_0x5dd9ce,_0x39288d,_0x2ac4b9){var _0x34e6ce={'raw':![],'where':{}};var _0x3856dc={};var _0x3f55a5={'count':0x0,'rows':[]};return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x5dd9ce[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x39288d,null))[_0xe8c3('0x18')](function(_0xd5b45e){if(_0xd5b45e){_0x3856dc[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db['Disposition'][_0xe8c3('0x36')]);_0x3856dc[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x5dd9ce[_0xe8c3('0x39')]);_0x3856dc[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x3856dc[_0xe8c3('0x38')],_0x3856dc[_0xe8c3('0x39')]);_0x34e6ce[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0x3856dc[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x34e6ce[_0xe8c3('0x3d')]=_0x34e6ce['attributes'][_0xe8c3('0x4e')]?_0x34e6ce[_0xe8c3('0x3d')]:_0x3856dc[_0xe8c3('0x38')];if(!_0x5dd9ce['query'][_0xe8c3('0x3e')]('nolimit')){_0x34e6ce['limit']=qs[_0xe8c3('0x29')](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x34e6ce[_0xe8c3('0x26')]=qs['offset'](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x26')]);}_0x34e6ce['order']=qs[_0xe8c3('0x40')](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x34e6ce['where']=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x5dd9ce[_0xe8c3('0x39')],_0x3856dc[_0xe8c3('0x3b')]));_0x34e6ce['where'][_0xe8c3('0x5c')]=_0xd5b45e['id'];if(_0x5dd9ce['query'][_0xe8c3('0x43')]){_0x34e6ce[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x34e6ce['where'],{'$or':_[_0xe8c3('0x35')](_0x34e6ce[_0xe8c3('0x3d')],function(_0x5b4307){var _0x35d94d={};_0x35d94d[_0x5b4307]={'$like':'%'+_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x35d94d;})});}_0x34e6ce=_[_0xe8c3('0x44')]({},_0x34e6ce,_0x5dd9ce[_0xe8c3('0x45')]);return db[_0xe8c3('0x5d')][_0xe8c3('0x28')]({'where':_0x34e6ce['where']})[_0xe8c3('0x18')](function(_0x30f61d){_0x3f55a5[_0xe8c3('0x28')]=_0x30f61d;if(_0x5dd9ce['query'][_0xe8c3('0x47')]){_0x34e6ce[_0xe8c3('0x4f')]=[{'all':!![]}];}return db[_0xe8c3('0x5d')][_0xe8c3('0x48')](_0x34e6ce);})['then'](function(_0x4ac737){_0x3f55a5['rows']=_0x4ac737;return _0x3f55a5;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0x39288d,_0x34e6ce))[_0xe8c3('0x23')](handleError(_0x39288d,null));};exports[_0xe8c3('0x5f')]=function(_0xc254cb,_0x5e916d,_0x1873c3){return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0xc254cb['params']['id']}})['then'](handleEntityNotFound(_0x5e916d,null))[_0xe8c3('0x18')](function(_0x43522a){if(_0x43522a){return _0x43522a[_0xe8c3('0x5f')](_0xc254cb[_0xe8c3('0x39')]['ids']);}})[_0xe8c3('0x18')](respondWithStatusCode(_0x5e916d,null))[_0xe8c3('0x23')](handleError(_0x5e916d,null));};exports[_0xe8c3('0x60')]=function(_0x363efc,_0x3228f1,_0xf4c085){if(_0x363efc[_0xe8c3('0x52')]['id']){delete _0x363efc['body']['id'];}return db[_0xe8c3('0x46')]['find']({'where':{'id':_0x363efc[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x3228f1,null))[_0xe8c3('0x18')](function(_0x290e78){if(_0x290e78){_0x363efc[_0xe8c3('0x52')][_0xe8c3('0x5c')]=_0x290e78['id'];return db['CannedAnswer'][_0xe8c3('0x51')](_0x363efc[_0xe8c3('0x52')]);}})['then'](respondWithResult(_0x3228f1,null))['catch'](handleError(_0x3228f1,null));};exports[_0xe8c3('0x61')]=function(_0x78c734,_0xa9c44c,_0x7a81a0){var _0x54456e={'raw':![],'where':{}};var _0x239917={};var _0x152853={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe8c3('0x5e')]({'where':{'id':_0x78c734['params']['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0xa9c44c,null))[_0xe8c3('0x18')](function(_0x234166){if(_0x234166){_0x239917[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db['CannedAnswer'][_0xe8c3('0x36')]);_0x239917[_0xe8c3('0x39')]=_['keys'](_0x78c734[_0xe8c3('0x39')]);_0x239917[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x239917['model'],_0x239917[_0xe8c3('0x39')]);_0x54456e[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0x239917['model'],qs[_0xe8c3('0x4d')](_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x54456e[_0xe8c3('0x3d')]=_0x54456e[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x54456e[_0xe8c3('0x3d')]:_0x239917[_0xe8c3('0x38')];if(!_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x54456e[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x78c734[_0xe8c3('0x39')]['limit']);_0x54456e[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x26')]);}_0x54456e[_0xe8c3('0x62')]=qs['sort'](_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x54456e[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x78c734['query'],_0x239917[_0xe8c3('0x3b')]));_0x54456e[_0xe8c3('0x41')][_0xe8c3('0x5c')]=_0x234166['id'];if(_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x54456e[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x54456e[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x54456e['attributes'],function(_0x783e30){var _0x1239ef={};_0x1239ef[_0x783e30]={'$like':'%'+_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x1239ef;})});}_0x54456e=_[_0xe8c3('0x44')]({},_0x54456e,_0x78c734[_0xe8c3('0x45')]);return db[_0xe8c3('0x63')][_0xe8c3('0x28')]({'where':_0x54456e[_0xe8c3('0x41')]})[_0xe8c3('0x18')](function(_0x194b8e){_0x152853[_0xe8c3('0x28')]=_0x194b8e;if(_0x78c734['query'][_0xe8c3('0x47')]){_0x54456e[_0xe8c3('0x4f')]=[{'all':!![]}];}return db[_0xe8c3('0x63')]['findAll'](_0x54456e);})[_0xe8c3('0x18')](function(_0x5d69d9){_0x152853[_0xe8c3('0x49')]=_0x5d69d9;return _0x152853;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0xa9c44c,_0x54456e))[_0xe8c3('0x23')](handleError(_0xa9c44c,null));};exports[_0xe8c3('0x64')]=function(_0x59e858,_0x44fb92,_0x12df65){return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x59e858[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x44fb92,null))[_0xe8c3('0x18')](function(_0xdaa842){if(_0xdaa842){return _0xdaa842['removeAnswers'](_0x59e858[_0xe8c3('0x39')][_0xe8c3('0x65')]);}})[_0xe8c3('0x18')](respondWithStatusCode(_0x44fb92,null))['catch'](handleError(_0x44fb92,null));};exports[_0xe8c3('0x66')]=function(_0x22574e,_0x352c79,_0x3606e8){return db['FaxInteraction']['find']({'where':{'id':_0x22574e[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x352c79,null))['then'](function(_0x7f20fe){if(_0x7f20fe){return _0x7f20fe[_0xe8c3('0x66')](_0x22574e[_0xe8c3('0x52')][_0xe8c3('0x65')],_[_0xe8c3('0x67')](_0x22574e[_0xe8c3('0x52')],['ids','id'])||{});}})['then'](respondWithResult(_0x352c79,null))[_0xe8c3('0x23')](handleError(_0x352c79,null));};exports[_0xe8c3('0x68')]=function(_0x2d778f,_0x3f2d7a,_0x344611){var _0x3bf6e5={'raw':![],'where':{}};var _0x1d13b5={};var _0x265b61={'count':0x0,'rows':[]};return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x2d778f[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x3f2d7a,null))['then'](function(_0x145a1d){if(_0x145a1d){_0x1d13b5[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db['FaxInteraction'][_0xe8c3('0x36')]);_0x1d13b5[_0xe8c3('0x39')]=_['keys'](_0x2d778f[_0xe8c3('0x39')]);_0x1d13b5[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x1d13b5['model'],_0x1d13b5[_0xe8c3('0x39')]);_0x3bf6e5[_0xe8c3('0x3d')]=_['intersection'](_0x1d13b5[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x2d778f[_0xe8c3('0x39')]['fields']));_0x3bf6e5[_0xe8c3('0x3d')]=_0x3bf6e5['attributes']['length']?_0x3bf6e5[_0xe8c3('0x3d')]:_0x1d13b5[_0xe8c3('0x38')];if(!_0x2d778f[_0xe8c3('0x39')]['hasOwnProperty'](_0xe8c3('0x3f'))){_0x3bf6e5[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x3bf6e5[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x26')]);}_0x3bf6e5[_0xe8c3('0x62')]=qs['sort'](_0x2d778f[_0xe8c3('0x39')]['sort']);_0x3bf6e5[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x2d778f[_0xe8c3('0x39')],_0x1d13b5['filters']));_0x3bf6e5[_0xe8c3('0x41')]['FaxAccountId']=_0x145a1d['id'];if(_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x3bf6e5[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x3bf6e5[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x3bf6e5[_0xe8c3('0x3d')],function(_0x95a5e0){var _0x539d65={};_0x539d65[_0x95a5e0]={'$like':'%'+_0x2d778f['query'][_0xe8c3('0x43')]+'%'};return _0x539d65;})});}_0x3bf6e5=_[_0xe8c3('0x44')]({},_0x3bf6e5,_0x2d778f[_0xe8c3('0x45')]);return db[_0xe8c3('0x69')]['count']({'where':_0x3bf6e5[_0xe8c3('0x41')]})['then'](function(_0x210b12){_0x265b61[_0xe8c3('0x28')]=_0x210b12;if(_0x2d778f['query'][_0xe8c3('0x47')]){_0x3bf6e5[_0xe8c3('0x4f')]=[{'model':db[_0xe8c3('0x6a')],'as':_0xe8c3('0x6b'),'required':![]},{'model':db['User'],'as':_0xe8c3('0x6c'),'attributes':['name',_0xe8c3('0x6d'),_0xe8c3('0x6e')],'required':![]},{'model':db[_0xe8c3('0x6f')],'as':_0xe8c3('0x70'),'attributes':['id',_0xe8c3('0x32'),_0xe8c3('0x71')],'where':_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x72')]?{'id':_0x2d778f['query'][_0xe8c3('0x72')]}:undefined,'required':_0x2d778f[_0xe8c3('0x39')]['tag']?!![]:![]}];}return db[_0xe8c3('0x69')][_0xe8c3('0x48')](_0x3bf6e5);})[_0xe8c3('0x18')](function(_0x25031e){_0x265b61['rows']=_0x25031e;return _0x265b61;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0x3f2d7a,_0x3bf6e5))[_0xe8c3('0x23')](handleError(_0x3f2d7a,null));};exports[_0xe8c3('0x73')]=function(_0x58fe39,_0x228312){var _0x1024ec=_0x58fe39[_0xe8c3('0x4b')]['id'];var _0x1faeac=_0x58fe39[_0xe8c3('0x52')];var _0x3af574=0xc8;var _0x5b9589=null;return db[_0xe8c3('0x74')][_0xe8c3('0x75')]({'isolationLevel':db[_0xe8c3('0x74')][_0xe8c3('0x76')][_0xe8c3('0x77')][_0xe8c3('0x78')]},function(_0x2a381a){return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x1024ec},'transaction':_0x2a381a})['then'](function(_0x53e0cc){if(_0x53e0cc){return db['FaxApplication'][_0xe8c3('0x2e')]({'where':{'FaxAccountId':_0x1024ec},'transaction':_0x2a381a})[_0xe8c3('0x18')](function(){var _0x588f2f=_[_0xe8c3('0x35')](_0x1faeac,function(_0x10af0f){_0x10af0f[_0xe8c3('0x5c')]=_0x1024ec;return _0x10af0f;});return db[_0xe8c3('0x79')]['bulkCreate'](_0x588f2f,{'transaction':_0x2a381a});});}else{_0x3af574=0x194;_0x5b9589=[];}});})[_0xe8c3('0x18')](function(){if(_0x3af574!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x1024ec},'order':_0xe8c3('0x7a')})[_0xe8c3('0x18')](function(_0xa605ac){_0x5b9589=_0xa605ac;});}})[_0xe8c3('0x23')](function(_0x370112){_0x3af574=0x1f4;logger[_0xe8c3('0x1e')](_0x370112[_0xe8c3('0x31')]);if(_0x370112['name']){delete _0x370112[_0xe8c3('0x32')];}_0x5b9589=_0x370112;})[_0xe8c3('0x7b')](function(){if(_0x5b9589===null){_0x228312[_0xe8c3('0x7c')](_0x3af574);}else{if(_0x3af574===0x1f4){_0x228312[_0xe8c3('0x24')](_0x3af574)[_0xe8c3('0x7d')](_0x5b9589);}else{_0x228312['status'](_0x3af574)[_0xe8c3('0x25')](_0x5b9589);}}});};exports['getApplications']=function(_0x35a4f1,_0x7a0006,_0x47704f){var _0x177461={};var _0x36b3cc={};var _0x35bcb8;var _0x85fb69;return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x35a4f1['params']['id']}})['then'](handleEntityNotFound(_0x7a0006,null))[_0xe8c3('0x18')](function(_0x4ccaab){if(_0x4ccaab){_0x35bcb8=_0x4ccaab;_0x36b3cc['model']=_[_0xe8c3('0x3a')](db[_0xe8c3('0x79')][_0xe8c3('0x36')]);_0x36b3cc['query']=_['keys'](_0x35a4f1[_0xe8c3('0x39')]);_0x36b3cc[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x36b3cc[_0xe8c3('0x38')],_0x36b3cc[_0xe8c3('0x39')]);_0x177461[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0x36b3cc[_0xe8c3('0x38')],qs['fields'](_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x177461['attributes']=_0x177461[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x177461['attributes']:_0x36b3cc[_0xe8c3('0x38')];_0x177461[_0xe8c3('0x62')]=qs[_0xe8c3('0x40')](_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x177461[_0xe8c3('0x41')]=qs['filters'](_[_0xe8c3('0x42')](_0x35a4f1[_0xe8c3('0x39')],_0x36b3cc[_0xe8c3('0x3b')]));if(_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x177461[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x177461[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x177461[_0xe8c3('0x3d')],function(_0x183444){var _0x4a20c5={};_0x4a20c5[_0x183444]={'$like':'%'+_0x35a4f1['query'][_0xe8c3('0x43')]+'%'};return _0x4a20c5;})});}_0x177461=_['merge']({},_0x177461,_0x35a4f1[_0xe8c3('0x45')]);return _0x35bcb8[_0xe8c3('0x7e')](_0x177461);}})['then'](function(_0x29305d){if(_0x29305d){_0x85fb69=_0x29305d[_0xe8c3('0x4e')];if(!_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x177461[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x177461[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x35a4f1['query']['offset']);}return _0x35bcb8[_0xe8c3('0x7e')](_0x177461);}})[_0xe8c3('0x18')](function(_0x268efb){if(_0x268efb){return _0x268efb?{'count':_0x85fb69,'rows':_0x268efb}:null;}})[_0xe8c3('0x18')](respondWithResult(_0x7a0006,null))[_0xe8c3('0x23')](handleError(_0x7a0006,null));};function Extension(_0x539ee4,_0x545c14,_0x7cbd03,_0x2cde7a){this['context']=_0xe8c3('0x7f');this[_0xe8c3('0x80')]=_0x539ee4['localstationid'];this[_0xe8c3('0x81')]=_0x2cde7a;this[_0xe8c3('0x37')]=_0xe8c3('0x82');this[_0xe8c3('0x83')]=_0xe8c3('0x84');this[_0xe8c3('0x5c')]=_0x539ee4['id'];this['priority']=_0x545c14;this[_0xe8c3('0x85')]=_0x7cbd03;}function createExtensionsReciveFax(_0x3cf521){var _0x5e3ecf=0x1;var _0x570e57=[];_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,'',_0xe8c3('0x87')));_0x5e3ecf+=0x1;_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,'CDR(type)=inbound-fax',_0xe8c3('0x88')));_0x5e3ecf+=0x1;for(var _0x5f556a in _0x3cf521){if(_0x3cf521[_0xe8c3('0x3e')](_0x5f556a)&&(_0x5f556a===_0xe8c3('0x89')||_0x5f556a===_0xe8c3('0x8a')||_0x5f556a===_0xe8c3('0x8b')||_0x5f556a===_0xe8c3('0x8c')||_0x5f556a==='headerinfo'||_0x5f556a===_0xe8c3('0x8d')||_0x5f556a==='minrate'||_0x5f556a===_0xe8c3('0x8e')||_0x5f556a===_0xe8c3('0x8f'))){_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,_0xe8c3('0x90')+_0x5f556a+')='+_0x3cf521[_0x5f556a],_0xe8c3('0x88')));_0x5e3ecf+=0x1;}}_0x570e57['push'](new Extension(_0x3cf521,_0x5e3ecf,'6','Wait'));_0x5e3ecf+=0x1;_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,'/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',_0xe8c3('0x91')));_0x5e3ecf=0x0;return _0x570e57;}exports[_0xe8c3('0x92')]=function(_0x3d3d03,_0x1eb316,_0x1ff440){var _0x12fd6f;return db[_0xe8c3('0x74')][_0xe8c3('0x75')](function(_0x3ac958){return db[_0xe8c3('0x46')][_0xe8c3('0x51')](_0x3d3d03[_0xe8c3('0x52')],{'transaction':_0x3ac958})[_0xe8c3('0x18')](function(_0x2a85fa){_0x12fd6f=_0x2a85fa[_0xe8c3('0x54')]({'plain':!![]});return db[_0xe8c3('0x93')][_0xe8c3('0x94')](createExtensionsReciveFax(_0x12fd6f),{'transaction':_0x3ac958});});})['then'](function(){return _0x12fd6f;})[_0xe8c3('0x18')](respondWithResult(_0x1eb316,null))[_0xe8c3('0x23')](handleError(_0x1eb316,null));};exports['updateAccountApplications']=function(_0x50fe9d,_0x3059c6,_0x16e908){var _0x2b389c;return db['sequelize']['transaction'](function(_0x2f0f96){return db[_0xe8c3('0x46')][_0xe8c3('0x2d')](_0x50fe9d['body'],{'where':{'id':_0x50fe9d[_0xe8c3('0x52')]['id']},'transaction':_0x2f0f96})[_0xe8c3('0x18')](function(_0x15608b){return db[_0xe8c3('0x93')][_0xe8c3('0x2e')]({'where':{'FaxAccountId':_0x50fe9d[_0xe8c3('0x52')]['id']},'transaction':_0x2f0f96})[_0xe8c3('0x18')](function(_0x3e7d60){return db[_0xe8c3('0x93')]['bulkCreate'](createExtensionsReciveFax(_[_0xe8c3('0x67')](_0x50fe9d[_0xe8c3('0x52')],[_0xe8c3('0x95'),'key',_0xe8c3('0x96'),_0xe8c3('0x97'),'TrunkId',_0xe8c3('0x98')])),{'transaction':_0x2f0f96});});});})[_0xe8c3('0x18')](function(){return db[_0xe8c3('0x46')][_0xe8c3('0x99')](_0x50fe9d[_0xe8c3('0x52')]['id']);})[_0xe8c3('0x18')](respondWithResult(_0x3059c6,null))[_0xe8c3('0x23')](handleError(_0x3059c6,null));};exports[_0xe8c3('0x9a')]=function(_0x3d3c29,_0x4aab68,_0x380b9f){var _0x3ac0ef={'raw':!![],'where':{}};var _0xd02be9={};var _0x3c6e09={'count':0x0,'rows':[]};return db[_0xe8c3('0x46')]['findOne']({'where':{'id':_0x3d3c29[_0xe8c3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4aab68,null))[_0xe8c3('0x18')](function(_0x25c862){if(_0x25c862){_0xd02be9[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db[_0xe8c3('0x9b')][_0xe8c3('0x36')]);_0xd02be9[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x3d3c29[_0xe8c3('0x39')]);_0xd02be9[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0xd02be9[_0xe8c3('0x38')],_0xd02be9[_0xe8c3('0x39')]);_0x3ac0ef[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0xd02be9[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x3ac0ef['attributes']=_0x3ac0ef[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x3ac0ef['attributes']:_0xd02be9['model'];if(!_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x3ac0ef[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x3d3c29['query']['limit']);_0x3ac0ef['offset']=qs[_0xe8c3('0x26')](_0x3d3c29[_0xe8c3('0x39')]['offset']);}_0x3ac0ef[_0xe8c3('0x62')]=qs[_0xe8c3('0x40')](_0x3d3c29[_0xe8c3('0x39')]['sort']);_0x3ac0ef['where']=qs['filters'](_[_0xe8c3('0x42')](_0x3d3c29[_0xe8c3('0x39')],_0xd02be9[_0xe8c3('0x3b')]));_0x3ac0ef[_0xe8c3('0x41')]['FaxAccountId']=_0x25c862['id'];if(_0x3d3c29['query'][_0xe8c3('0x43')]){_0x3ac0ef[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x3ac0ef['where'],{'$or':_['map'](_0x3ac0ef[_0xe8c3('0x3d')],function(_0x22782f){var _0x3b666e={};_0x3b666e[_0x22782f]={'$like':'%'+_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x3b666e;})});}if(_0x3d3c29[_0xe8c3('0x39')]['$gte']){var _0x5094ba=_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x9c')]['split'](',');var _0x43d2d5={};_0x43d2d5[_0x5094ba[0x0]]={'$gte':moment(_0x5094ba[0x1])[_0xe8c3('0x9d')](_0xe8c3('0x9e'))};_0x3ac0ef[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x3ac0ef['where'],_0x43d2d5);}_0x3ac0ef=_[_0xe8c3('0x44')]({},_0x3ac0ef,_0x3d3c29[_0xe8c3('0x45')]);return db['FaxMessage'][_0xe8c3('0x28')]({'where':_0x3ac0ef[_0xe8c3('0x41')]})[_0xe8c3('0x18')](function(_0x521b5a){_0x3c6e09[_0xe8c3('0x28')]=_0x521b5a;if(_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x47')]){_0x3ac0ef[_0xe8c3('0x4f')]=[{'all':!![]}];}return db[_0xe8c3('0x9b')]['findAll'](_0x3ac0ef);})['then'](function(_0xe3e3da){_0x3c6e09[_0xe8c3('0x49')]=_0xe3e3da;return _0x3c6e09;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0x4aab68,_0x3ac0ef))[_0xe8c3('0x23')](handleError(_0x4aab68,null));};exports[_0xe8c3('0x7d')]=function(_0x4923d2,_0x4588e7,_0x39f688){var _0x151b1e,_0x392be0={},_0xf957c3;if(_0x4923d2[_0xe8c3('0x52')]['to']){_0xf957c3=_0x4923d2[_0xe8c3('0x52')]['to'][0x0];}return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0x4923d2[_0xe8c3('0x4b')]['id']},'include':[{'model':db[_0xe8c3('0x9f')],'as':'List','include':[{'model':db[_0xe8c3('0x6a')],'as':_0xe8c3('0xa0'),'where':{'fax':_0xf957c3},'limit':0x1,'order':[['updatedAt',_0xe8c3('0xa1')]]}]}]})[_0xe8c3('0x18')](handleEntityNotFound(_0x4588e7,null))[_0xe8c3('0x18')](function(_0x4c5b59){_0x151b1e=_0x4c5b59;if(_0x4923d2['body']['attachments']&&_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][_0xe8c3('0x4e')]){for(var _0xf8cb4f=0x0;_0xf8cb4f<_0x4923d2['body']['attachments'][_0xe8c3('0x4e')];_0xf8cb4f+=0x1){_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][_0xf8cb4f]={'filename':_0x4923d2['body']['attachments'][_0xf8cb4f][_0xe8c3('0x32')],'id':_0x4923d2['body'][_0xe8c3('0xa2')][_0xf8cb4f]['id'],'path':path[_0xe8c3('0xa3')](config[_0xe8c3('0xa4')],_0xe8c3('0xa5'),_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][_0xf8cb4f][_0xe8c3('0xa6')])};}}return respondWithRpcPromise(_0xe8c3('0xa7'),_0xe8c3('0xa7'),{'FaxAccountId':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x4b')]['id'])?undefined:_0x4923d2[_0xe8c3('0x4b')]['id'],'path':_[_0xe8c3('0xa8')](_0x4923d2['body']['attachments'][0x0][_0xe8c3('0xa9')])?undefined:_0x4923d2['body'][_0xe8c3('0xa2')][0x0][_0xe8c3('0xa9')],'fax':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')]['to'][0x0])?undefined:_0x4923d2[_0xe8c3('0x52')]['to'][0x0]},client9002);})[_0xe8c3('0x18')](function(){if(_0x151b1e){if(_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xaa')])){_0x4923d2['body'][_0xe8c3('0xaa')]=util[_0xe8c3('0x9d')](_0xe8c3('0xab'),_0x151b1e[_0xe8c3('0x32')],_0x151b1e[_0xe8c3('0xac')]);}if(_0x151b1e['List']){if(_0x151b1e[_0xe8c3('0xad')][_0xe8c3('0xa0')][_0xe8c3('0x4e')]){return _0x151b1e[_0xe8c3('0xad')]['Contacts'][0x0];}else{return db[_0xe8c3('0x6a')][_0xe8c3('0x51')](_[_0xe8c3('0x12')](_0x4923d2[_0xe8c3('0x52')],{'firstName':_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'phone':_0x4923d2['body']['to'][0x0],'fax':_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'ListId':_0x151b1e['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x521d6c){if(_0x521d6c){return db[_0xe8c3('0x69')][_0xe8c3('0x50')]({'where':{'ContactId':_0x521d6c['id'],'closed':![],'FaxAccountId':_0x151b1e['id']}})['then'](function(_0x74c48d){if(_0x74c48d){return[_0x74c48d,![]];}return db[_0xe8c3('0x69')]['create']({'UserId':_0x4923d2[_0xe8c3('0x53')]['id'],'ContactId':_0x521d6c['id'],'FaxAccountId':_0x151b1e['id'],'fax':_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'firstMsgDirection':_0xe8c3('0xae'),'Messages':[_['merge'](_0x4923d2[_0xe8c3('0x52')],{'read':![],'body':_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][0x0][_0xe8c3('0xaf')],'FaxAccountId':_0x151b1e['id'],'UserId':_0x4923d2[_0xe8c3('0x53')]['id'],'ContactId':_0x521d6c['id'],'AttachmentId':_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0xe8c3('0x9b')],'as':_0xe8c3('0xb0')}]})['then'](function(_0x3c884c){return[_0x3c884c,!![]];});});}else{throw new Error(_0xe8c3('0xb1'));}})[_0xe8c3('0xb2')](function(_0x1c0afe,_0x1dbfd6){if(_0x1dbfd6){return _0x1c0afe;}return db[_0xe8c3('0x9b')][_0xe8c3('0x51')]({'direction':_0xe8c3('0xae'),'read':![],'body':_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][0x0][_0xe8c3('0xaf')],'FaxAccountId':_0x151b1e['id'],'FaxInteractionId':_0x1c0afe['id'],'UserId':_0x4923d2[_0xe8c3('0x53')]['id'],'ContactId':_0x1c0afe[_0xe8c3('0xb3')],'AttachmentId':_0x4923d2['body'][_0xe8c3('0xa2')][0x0]['id']})[_0xe8c3('0x18')](function(_0x8f1fd1){_0x1c0afe[_0xe8c3('0xb4')][_0xe8c3('0xb0')]=[];_0x1c0afe[_0xe8c3('0xb4')][_0xe8c3('0xb0')][_0xe8c3('0x86')](_0x8f1fd1[_0xe8c3('0xb4')]);return _0x1c0afe;});})['then'](function(_0x3ed270){respondWithRpcPromise(_0xe8c3('0xb5'),_0xe8c3('0xb5'),{'FaxAccountId':_[_0xe8c3('0xa8')](_0x4923d2['params']['id'])?undefined:_0x4923d2['params']['id'],'path':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')]['attachments'][0x0][_0xe8c3('0xa9')])?undefined:_0x4923d2[_0xe8c3('0x52')]['attachments'][0x0][_0xe8c3('0xa9')],'fax':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')]['to'][0x0])?undefined:_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'AttachmentId':_0x4923d2['body'][_0xe8c3('0xa2')][0x0]['id']},client9002)['then'](function(_0x26735a){logger[_0xe8c3('0x19')](_0xe8c3('0xb6'),_0x26735a);})['catch'](function(_0x3d5c93){logger[_0xe8c3('0x19')](_0xe8c3('0xb6'),_0x3d5c93);});return _0x3ed270;})['then'](respondWithResult(_0x4588e7,null))[_0xe8c3('0x23')](handleError(_0x4588e7,null));};exports['addAgents']=function(_0x1cb157,_0x3ff8d2,_0x251a17){return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x1cb157['params']['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x3ff8d2,null))[_0xe8c3('0x18')](function(_0x58a4d0){if(_0x58a4d0){return _0x58a4d0[_0xe8c3('0xb7')](_0x1cb157[_0xe8c3('0x52')][_0xe8c3('0x65')],_[_0xe8c3('0x67')](_0x1cb157[_0xe8c3('0x52')],[_0xe8c3('0x65'),'id'])||{})[_0xe8c3('0xb2')](function(_0x2ac668){for(var _0x7d4d5a=0x0;_0x7d4d5a<_0x1cb157[_0xe8c3('0x52')][_0xe8c3('0x65')][_0xe8c3('0x4e')];_0x7d4d5a+=0x1){socket[_0xe8c3('0xb8')](_0xe8c3('0xb9'),{'UserId':Number(_0x1cb157[_0xe8c3('0x52')][_0xe8c3('0x65')][_0x7d4d5a]),'FaxAccountId':Number(_0x1cb157[_0xe8c3('0x4b')]['id'])});}return _0x2ac668;});}})[_0xe8c3('0x18')](respondWithResult(_0x3ff8d2,null))[_0xe8c3('0x23')](handleError(_0x3ff8d2,null));};exports[_0xe8c3('0xba')]=function(_0x4b36bc,_0x31b5d8,_0x508d5){return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0x4b36bc['params']['id']}})['then'](handleEntityNotFound(_0x31b5d8,null))['then'](function(_0x35f613){if(_0x35f613){return _0x35f613[_0xe8c3('0xba')](_0x4b36bc[_0xe8c3('0x39')][_0xe8c3('0x65')])[_0xe8c3('0x18')](function(){if(_['isArray'](_0x4b36bc['query']['ids'])){for(var _0x66e399=0x0;_0x66e399<_0x4b36bc[_0xe8c3('0x39')][_0xe8c3('0x65')][_0xe8c3('0x4e')];_0x66e399+=0x1){socket[_0xe8c3('0xb8')](_0xe8c3('0xbb'),{'UserId':Number(_0x4b36bc[_0xe8c3('0x39')]['ids'][_0x66e399]),'FaxAccountId':Number(_0x4b36bc['params']['id'])});}}else{socket[_0xe8c3('0xb8')](_0xe8c3('0xbb'),{'UserId':Number(_0x4b36bc['query']['ids']),'FaxAccountId':Number(_0x4b36bc['params']['id'])});}});}})[_0xe8c3('0x18')](respondWithStatusCode(_0x31b5d8,null))[_0xe8c3('0x23')](handleError(_0x31b5d8,null));};exports[_0xe8c3('0xbc')]=function(_0x24e229,_0x34eb68,_0x151006){var _0x46eb1f={};var _0x161eb2={};var _0x35fedb;var _0x916de2;return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x24e229[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x34eb68,null))['then'](function(_0xcbcdf8){if(_0xcbcdf8){_0x35fedb=_0xcbcdf8;_0x161eb2[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db[_0xe8c3('0xbd')]['rawAttributes']);_0x161eb2[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x24e229[_0xe8c3('0x39')]);_0x161eb2[_0xe8c3('0x3b')]=_['intersection'](_0x161eb2['model'],_0x161eb2[_0xe8c3('0x39')]);_0x46eb1f['attributes']=_[_0xe8c3('0x3c')](_0x161eb2[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x46eb1f[_0xe8c3('0x3d')]=_0x46eb1f[_0xe8c3('0x3d')]['length']?_0x46eb1f[_0xe8c3('0x3d')]:_0x161eb2[_0xe8c3('0x38')];_0x46eb1f['order']=qs[_0xe8c3('0x40')](_0x24e229[_0xe8c3('0x39')]['sort']);_0x46eb1f[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x24e229[_0xe8c3('0x39')],_0x161eb2[_0xe8c3('0x3b')]));if(_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x46eb1f['where']=_[_0xe8c3('0x44')](_0x46eb1f[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x46eb1f[_0xe8c3('0x3d')],function(_0x1dc5d3){var _0x5778ca={};_0x5778ca[_0x1dc5d3]={'$like':'%'+_0x24e229[_0xe8c3('0x39')]['filter']+'%'};return _0x5778ca;})});}_0x46eb1f=_[_0xe8c3('0x44')]({},_0x46eb1f,_0x24e229[_0xe8c3('0x45')]);return _0x35fedb[_0xe8c3('0xbc')](_0x46eb1f);}})[_0xe8c3('0x18')](function(_0x19b71e){if(_0x19b71e){_0x916de2=_0x19b71e[_0xe8c3('0x4e')];if(!_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x3e')]('nolimit')){_0x46eb1f['limit']=qs[_0xe8c3('0x29')](_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x46eb1f[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x24e229['query']['offset']);}return _0x35fedb['getAgents'](_0x46eb1f);}})[_0xe8c3('0x18')](function(_0x308490){if(_0x308490){return _0x308490?{'count':_0x916de2,'rows':_0x308490}:null;}})[_0xe8c3('0x18')](respondWithResult(_0x34eb68,null))[_0xe8c3('0x23')](handleError(_0x34eb68,null));}; \ No newline at end of file +var _0x8964=['find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','ecm','gateway','headerinfo','FAXOPT(','Set','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','spread','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','count','limit','Content-Range','apply','reject','save','update','get','FaxAccounts','destroy','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','rawAttributes','include','create','body','user','role','UserProfileSection'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x8964,0x66));var _0x4896=function(_0x5a18fc,_0xb1a4aa){_0x5a18fc=_0x5a18fc-0x0;var _0x57b441=_0x8964[_0x5a18fc];return _0x57b441;};'use strict';var emlformat=require(_0x4896('0x0'));var rimraf=require(_0x4896('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4896('0x2'));var rp=require(_0x4896('0x3'));var moment=require(_0x4896('0x4'));var BPromise=require(_0x4896('0x5'));var Mustache=require('mustache');var util=require(_0x4896('0x6'));var path=require(_0x4896('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4896('0x8'));var fs=require('fs');var fs_extra=require(_0x4896('0x9'));var _=require('lodash');var squel=require(_0x4896('0xa'));var crypto=require('crypto');var jsforce=require(_0x4896('0xb'));var deskjs=require(_0x4896('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4896('0xd'));var Papa=require(_0x4896('0xe'));var Redis=require('ioredis');var authService=require(_0x4896('0xf'));var qs=require(_0x4896('0x10'));var as=require(_0x4896('0x11'));var hardwareService=require(_0x4896('0x12'));var logger=require(_0x4896('0x13'))('api');var utils=require(_0x4896('0x14'));var config=require(_0x4896('0x15'));var licenseUtil=require(_0x4896('0x16'));var db=require(_0x4896('0x17'))['db'];config[_0x4896('0x18')]=_[_0x4896('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4896('0x1a'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x4896('0x1b')](socket);var jayson=require(_0x4896('0x1c'));var client=jayson[_0x4896('0x1d')][_0x4896('0x1e')]({'port':0x232c});var client9002=jayson[_0x4896('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5538cc,_0x35324a,_0x15bb59,_0x5c10a4){return new BPromise(function(_0xc70784,_0x3105d6){var _0x208e65=_0x5c10a4||client;return _0x208e65[_0x4896('0x1f')](_0x5538cc,_0x15bb59)[_0x4896('0x20')](function(_0x17504c){logger[_0x4896('0x21')]('FaxAccount,\x20%s,\x20%s',_0x35324a,_0x4896('0x22'));logger['debug'](_0x4896('0x23'),_0x35324a,'request\x20sent',JSON['stringify'](_0x17504c));if(_0x17504c[_0x4896('0x24')]){if(_0x17504c['error'][_0x4896('0x25')]===0x1f4){logger[_0x4896('0x24')](_0x4896('0x26'),_0x35324a,_0x17504c['error'][_0x4896('0x27')]);return _0x3105d6(_0x17504c[_0x4896('0x24')][_0x4896('0x27')]);}logger[_0x4896('0x24')](_0x4896('0x26'),_0x35324a,_0x17504c[_0x4896('0x24')][_0x4896('0x27')]);return _0xc70784(_0x17504c[_0x4896('0x24')][_0x4896('0x27')]);}else{logger['info'](_0x4896('0x26'),_0x35324a,_0x4896('0x22'));_0xc70784(_0x17504c[_0x4896('0x28')]['message']);}})[_0x4896('0x29')](function(_0x645abd){logger[_0x4896('0x24')](_0x4896('0x26'),_0x35324a,_0x645abd);_0x3105d6(_0x645abd);});});}function respondWithStatusCode(_0x31be24,_0x5c041c){_0x5c041c=_0x5c041c||0xcc;return function(_0x4bb0ca){if(_0x4bb0ca){return _0x31be24[_0x4896('0x2a')](_0x5c041c);}return _0x31be24[_0x4896('0x2b')](_0x5c041c)[_0x4896('0x2c')]();};}function respondWithResult(_0x12c31a,_0x4f9256){_0x4f9256=_0x4f9256||0xc8;return function(_0x4d81ea){if(_0x4d81ea){return _0x12c31a['status'](_0x4f9256)['json'](_0x4d81ea);}};}function respondWithFilteredResult(_0x362b79,_0x461aed){return function(_0x13d1dd){if(_0x13d1dd){var _0x331cca=typeof _0x461aed[_0x4896('0x2d')]==='undefined'&&typeof _0x461aed['limit']==='undefined';var _0x171a4b=_0x13d1dd[_0x4896('0x2e')];var _0x3bbf51=_0x331cca?0x0:_0x461aed[_0x4896('0x2d')];var _0x19755b=_0x331cca?_0x13d1dd[_0x4896('0x2e')]:_0x461aed[_0x4896('0x2d')]+_0x461aed[_0x4896('0x2f')];var _0x395be9;if(_0x19755b>=_0x171a4b){_0x19755b=_0x171a4b;_0x395be9=0xc8;}else{_0x395be9=0xce;}_0x362b79[_0x4896('0x2b')](_0x395be9);return _0x362b79['set'](_0x4896('0x30'),_0x3bbf51+'-'+_0x19755b+'/'+_0x171a4b)['json'](_0x13d1dd);}return null;};}function patchUpdates(_0x55af61){return function(_0x360cd4){try{jsonpatch[_0x4896('0x31')](_0x360cd4,_0x55af61,!![]);}catch(_0x29d2ca){return BPromise[_0x4896('0x32')](_0x29d2ca);}return _0x360cd4[_0x4896('0x33')]();};}function saveUpdates(_0x2cc8aa,_0x49cd4c){return function(_0x164957){if(_0x164957){return _0x164957[_0x4896('0x34')](_0x2cc8aa)[_0x4896('0x20')](function(_0x567294){return _0x567294;});}return null;};}function removeEntity(_0x124f98,_0x5b338d){return function(_0x1ad451){if(_0x1ad451){return _0x1ad451['destroy']()[_0x4896('0x20')](function(){var _0x56ad7d=_0x1ad451[_0x4896('0x35')]({'plain':!![]});var _0x47ab76=_0x4896('0x36');return db['UserProfileResource'][_0x4896('0x37')]({'where':{'type':_0x47ab76,'resourceId':_0x56ad7d['id']}})[_0x4896('0x20')](function(){return _0x1ad451;});})[_0x4896('0x20')](function(){_0x124f98[_0x4896('0x2b')](0xcc)[_0x4896('0x2c')]();});}};}function handleEntityNotFound(_0x2091ca,_0x126020){return function(_0x5ce543){if(!_0x5ce543){_0x2091ca[_0x4896('0x2a')](0x194);}return _0x5ce543;};}function handleError(_0x541496,_0x416fe9){_0x416fe9=_0x416fe9||0x1f4;return function(_0x98cb01){logger[_0x4896('0x24')](_0x98cb01[_0x4896('0x38')]);if(_0x98cb01['name']){delete _0x98cb01[_0x4896('0x39')];}_0x541496[_0x4896('0x2b')](_0x416fe9)[_0x4896('0x3a')](_0x98cb01);};}exports['index']=function(_0x5f377a,_0x28d41c){var _0x80e9fc={'include':[{'model':db[_0x4896('0x3b')],'as':_0x4896('0x3c')}]},_0x504a2c={},_0x1ece08={'count':0x0,'rows':[]};var _0x5f3f24=_['map'](db[_0x4896('0x3d')]['rawAttributes'],function(_0x4167bb){return{'name':_0x4167bb[_0x4896('0x3e')],'type':_0x4167bb[_0x4896('0x3f')][_0x4896('0x40')]};});_0x504a2c[_0x4896('0x41')]=_[_0x4896('0x42')](_0x5f3f24,_0x4896('0x39'));_0x504a2c['query']=_[_0x4896('0x43')](_0x5f377a['query']);_0x504a2c[_0x4896('0x44')]=_[_0x4896('0x45')](_0x504a2c[_0x4896('0x41')],_0x504a2c[_0x4896('0x46')]);_0x80e9fc[_0x4896('0x47')]=_[_0x4896('0x45')](_0x504a2c['model'],qs[_0x4896('0x48')](_0x5f377a['query'][_0x4896('0x48')]));_0x80e9fc[_0x4896('0x47')]=_0x80e9fc[_0x4896('0x47')][_0x4896('0x49')]?_0x80e9fc['attributes']:_0x504a2c[_0x4896('0x41')];if(!_0x5f377a[_0x4896('0x46')][_0x4896('0x4a')](_0x4896('0x4b'))){_0x80e9fc[_0x4896('0x2f')]=qs[_0x4896('0x2f')](_0x5f377a[_0x4896('0x46')]['limit']);_0x80e9fc[_0x4896('0x2d')]=qs[_0x4896('0x2d')](_0x5f377a[_0x4896('0x46')]['offset']);}_0x80e9fc[_0x4896('0x4c')]=qs[_0x4896('0x4d')](_0x5f377a['query'][_0x4896('0x4d')]);_0x80e9fc[_0x4896('0x4e')]=qs[_0x4896('0x44')](_[_0x4896('0x4f')](_0x5f377a[_0x4896('0x46')],_0x504a2c[_0x4896('0x44')]),_0x5f3f24);if(_0x5f377a[_0x4896('0x46')][_0x4896('0x50')]){_0x80e9fc[_0x4896('0x4e')]=_[_0x4896('0x51')](_0x80e9fc[_0x4896('0x4e')],{'$or':_[_0x4896('0x42')](_0x5f3f24,function(_0x3e52b9){if(_0x3e52b9[_0x4896('0x3f')]!==_0x4896('0x52')){var _0x30230d={};_0x30230d[_0x3e52b9['name']]={'$like':'%'+_0x5f377a['query'][_0x4896('0x50')]+'%'};return _0x30230d;}})});}_0x80e9fc=_[_0x4896('0x51')]({},_0x80e9fc,_0x5f377a[_0x4896('0x53')]);var _0x1246cb={'where':_0x80e9fc[_0x4896('0x4e')]};return db['FaxAccount'][_0x4896('0x2e')](_0x1246cb)[_0x4896('0x20')](function(_0x47b99d){_0x1ece08[_0x4896('0x2e')]=_0x47b99d;if(_0x5f377a[_0x4896('0x46')][_0x4896('0x54')]){_0x80e9fc['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x80e9fc);})[_0x4896('0x20')](function(_0x1ce5c4){_0x1ece08[_0x4896('0x55')]=_0x1ce5c4;return _0x1ece08;})['then'](respondWithFilteredResult(_0x28d41c,_0x80e9fc))[_0x4896('0x29')](handleError(_0x28d41c,null));};exports[_0x4896('0x56')]=function(_0x1a259d,_0x5ba55e){var _0x50117c={'raw':![],'where':{'id':_0x1a259d['params']['id']},'include':[{'model':db[_0x4896('0x3b')],'as':_0x4896('0x3c')}]},_0x5e0fc5={};_0x5e0fc5[_0x4896('0x41')]=_[_0x4896('0x43')](db['FaxAccount'][_0x4896('0x57')]);_0x5e0fc5[_0x4896('0x46')]=_[_0x4896('0x43')](_0x1a259d[_0x4896('0x46')]);_0x5e0fc5[_0x4896('0x44')]=_['intersection'](_0x5e0fc5['model'],_0x5e0fc5[_0x4896('0x46')]);_0x50117c['attributes']=_[_0x4896('0x45')](_0x5e0fc5[_0x4896('0x41')],qs[_0x4896('0x48')](_0x1a259d['query'][_0x4896('0x48')]));_0x50117c[_0x4896('0x47')]=_0x50117c['attributes'][_0x4896('0x49')]?_0x50117c[_0x4896('0x47')]:_0x5e0fc5[_0x4896('0x41')];if(_0x1a259d[_0x4896('0x46')][_0x4896('0x54')]){_0x50117c[_0x4896('0x58')]=[{'all':!![]}];}_0x50117c=_[_0x4896('0x51')]({},_0x50117c,_0x1a259d[_0x4896('0x53')]);return db[_0x4896('0x3d')]['find'](_0x50117c)['then'](handleEntityNotFound(_0x5ba55e,null))[_0x4896('0x20')](respondWithResult(_0x5ba55e,null))[_0x4896('0x29')](handleError(_0x5ba55e,null));};exports[_0x4896('0x59')]=function(_0x2136b1,_0x5a55c2){return db[_0x4896('0x3d')][_0x4896('0x59')](_0x2136b1[_0x4896('0x5a')],{})[_0x4896('0x20')](function(_0x151467){var _0x215e7f=_0x2136b1[_0x4896('0x5b')]['get']({'plain':!![]});if(!_0x215e7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x215e7f[_0x4896('0x5c')]==='user'){var _0x217ecb=_0x151467[_0x4896('0x35')]({'plain':!![]});var _0x262ac6=_0x4896('0x36');return db[_0x4896('0x5d')][_0x4896('0x5e')]({'where':{'name':_0x262ac6,'userProfileId':_0x215e7f[_0x4896('0x5f')]},'raw':!![]})[_0x4896('0x20')](function(_0x51eda7){if(_0x51eda7&&_0x51eda7['autoAssociation']===0x0){return db[_0x4896('0x60')]['create']({'name':_0x217ecb['name'],'resourceId':_0x217ecb['id'],'type':_0x51eda7[_0x4896('0x39')],'sectionId':_0x51eda7['id']},{})[_0x4896('0x20')](function(){return _0x151467;});}else{return _0x151467;}})['catch'](function(_0x47f19c){logger['error'](_0x4896('0x61'),_0x47f19c);throw _0x47f19c;});}return _0x151467;})[_0x4896('0x20')](respondWithResult(_0x5a55c2,0xc9))[_0x4896('0x29')](handleError(_0x5a55c2,null));};exports[_0x4896('0x34')]=function(_0x523c01,_0x2cc35c){if(_0x523c01[_0x4896('0x5a')]['id']){delete _0x523c01[_0x4896('0x5a')]['id'];}return db['FaxAccount'][_0x4896('0x5e')]({'where':{'id':_0x523c01[_0x4896('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x4896('0x3c')}]})[_0x4896('0x20')](handleEntityNotFound(_0x2cc35c,null))[_0x4896('0x20')](saveUpdates(_0x523c01[_0x4896('0x5a')],null))[_0x4896('0x20')](respondWithResult(_0x2cc35c,null))[_0x4896('0x29')](handleError(_0x2cc35c,null));};exports['destroy']=function(_0x6e6ab3,_0x4141ac){return db['FaxAccount'][_0x4896('0x5e')]({'where':{'id':_0x6e6ab3['params']['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x4141ac,null))['then'](removeEntity(_0x4141ac,null))['catch'](handleError(_0x4141ac,null));};exports[_0x4896('0x63')]=function(_0x430b75,_0x3529d7){return db[_0x4896('0x3d')][_0x4896('0x63')]()['then'](respondWithResult(_0x3529d7,null))[_0x4896('0x29')](handleError(_0x3529d7,null));};exports[_0x4896('0x64')]=function(_0x2fd364,_0x5966f4,_0x2dff17){if(_0x2fd364['body']['id']){delete _0x2fd364[_0x4896('0x5a')]['id'];}return db[_0x4896('0x3d')][_0x4896('0x5e')]({'where':{'id':_0x2fd364[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x5966f4,null))['then'](function(_0x6213eb){if(_0x6213eb){_0x2fd364[_0x4896('0x5a')]['FaxAccountId']=_0x6213eb['id'];return db[_0x4896('0x65')]['create'](_0x2fd364[_0x4896('0x5a')]);}})[_0x4896('0x20')](respondWithResult(_0x5966f4,null))[_0x4896('0x29')](handleError(_0x5966f4,null));};exports[_0x4896('0x66')]=function(_0x393b30,_0x532efc,_0x4e92f5){var _0x205ec0={'raw':![],'where':{}};var _0x373cb6={};var _0xfce83b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4896('0x67')]({'where':{'id':_0x393b30[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x532efc,null))[_0x4896('0x20')](function(_0x1d9859){if(_0x1d9859){_0x373cb6['model']=_[_0x4896('0x43')](db[_0x4896('0x65')][_0x4896('0x57')]);_0x373cb6[_0x4896('0x46')]=_[_0x4896('0x43')](_0x393b30[_0x4896('0x46')]);_0x373cb6[_0x4896('0x44')]=_[_0x4896('0x45')](_0x373cb6[_0x4896('0x41')],_0x373cb6[_0x4896('0x46')]);_0x205ec0[_0x4896('0x47')]=_[_0x4896('0x45')](_0x373cb6[_0x4896('0x41')],qs['fields'](_0x393b30['query'][_0x4896('0x48')]));_0x205ec0[_0x4896('0x47')]=_0x205ec0['attributes'][_0x4896('0x49')]?_0x205ec0['attributes']:_0x373cb6[_0x4896('0x41')];if(!_0x393b30['query'][_0x4896('0x4a')]('nolimit')){_0x205ec0[_0x4896('0x2f')]=qs['limit'](_0x393b30[_0x4896('0x46')][_0x4896('0x2f')]);_0x205ec0['offset']=qs['offset'](_0x393b30[_0x4896('0x46')][_0x4896('0x2d')]);}_0x205ec0[_0x4896('0x4c')]=qs[_0x4896('0x4d')](_0x393b30[_0x4896('0x46')][_0x4896('0x4d')]);_0x205ec0[_0x4896('0x4e')]=qs[_0x4896('0x44')](_['pick'](_0x393b30['query'],_0x373cb6[_0x4896('0x44')]));_0x205ec0[_0x4896('0x4e')][_0x4896('0x68')]=_0x1d9859['id'];if(_0x393b30[_0x4896('0x46')]['filter']){_0x205ec0[_0x4896('0x4e')]=_['merge'](_0x205ec0[_0x4896('0x4e')],{'$or':_[_0x4896('0x42')](_0x205ec0[_0x4896('0x47')],function(_0x5a6150){var _0x58b672={};_0x58b672[_0x5a6150]={'$like':'%'+_0x393b30['query']['filter']+'%'};return _0x58b672;})});}_0x205ec0=_[_0x4896('0x51')]({},_0x205ec0,_0x393b30[_0x4896('0x53')]);return db[_0x4896('0x65')][_0x4896('0x2e')]({'where':_0x205ec0[_0x4896('0x4e')]})[_0x4896('0x20')](function(_0x22db53){_0xfce83b[_0x4896('0x2e')]=_0x22db53;if(_0x393b30['query'][_0x4896('0x54')]){_0x205ec0[_0x4896('0x58')]=[{'all':!![]}];}return db[_0x4896('0x65')][_0x4896('0x69')](_0x205ec0);})[_0x4896('0x20')](function(_0x120733){_0xfce83b[_0x4896('0x55')]=_0x120733;return _0xfce83b;});}})[_0x4896('0x20')](respondWithFilteredResult(_0x532efc,_0x205ec0))[_0x4896('0x29')](handleError(_0x532efc,null));};exports['removeDispositions']=function(_0x3a40dd,_0x22d1f2,_0x2f6f69){return db[_0x4896('0x3d')][_0x4896('0x5e')]({'where':{'id':_0x3a40dd['params']['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x22d1f2,null))[_0x4896('0x20')](function(_0x3085e3){if(_0x3085e3){return _0x3085e3[_0x4896('0x6a')](_0x3a40dd[_0x4896('0x46')]['ids']);}})[_0x4896('0x20')](respondWithStatusCode(_0x22d1f2,null))[_0x4896('0x29')](handleError(_0x22d1f2,null));};exports[_0x4896('0x6b')]=function(_0x680c8f,_0x741a7,_0x4d20d4){if(_0x680c8f['body']['id']){delete _0x680c8f['body']['id'];}return db[_0x4896('0x3d')][_0x4896('0x5e')]({'where':{'id':_0x680c8f[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x741a7,null))['then'](function(_0xe5a643){if(_0xe5a643){_0x680c8f[_0x4896('0x5a')]['FaxAccountId']=_0xe5a643['id'];return db[_0x4896('0x6c')][_0x4896('0x59')](_0x680c8f['body']);}})['then'](respondWithResult(_0x741a7,null))['catch'](handleError(_0x741a7,null));};exports[_0x4896('0x6d')]=function(_0x5cc341,_0x64f7d1,_0x283d62){var _0x133744={'raw':![],'where':{}};var _0x28ac77={};var _0x1525c1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4896('0x67')]({'where':{'id':_0x5cc341[_0x4896('0x62')]['id']}})['then'](handleEntityNotFound(_0x64f7d1,null))[_0x4896('0x20')](function(_0x574bd9){if(_0x574bd9){_0x28ac77[_0x4896('0x41')]=_[_0x4896('0x43')](db['CannedAnswer'][_0x4896('0x57')]);_0x28ac77[_0x4896('0x46')]=_[_0x4896('0x43')](_0x5cc341[_0x4896('0x46')]);_0x28ac77['filters']=_['intersection'](_0x28ac77[_0x4896('0x41')],_0x28ac77[_0x4896('0x46')]);_0x133744[_0x4896('0x47')]=_['intersection'](_0x28ac77[_0x4896('0x41')],qs[_0x4896('0x48')](_0x5cc341['query'][_0x4896('0x48')]));_0x133744[_0x4896('0x47')]=_0x133744[_0x4896('0x47')][_0x4896('0x49')]?_0x133744['attributes']:_0x28ac77[_0x4896('0x41')];if(!_0x5cc341['query'][_0x4896('0x4a')](_0x4896('0x4b'))){_0x133744[_0x4896('0x2f')]=qs['limit'](_0x5cc341[_0x4896('0x46')][_0x4896('0x2f')]);_0x133744[_0x4896('0x2d')]=qs[_0x4896('0x2d')](_0x5cc341[_0x4896('0x46')]['offset']);}_0x133744['order']=qs[_0x4896('0x4d')](_0x5cc341[_0x4896('0x46')][_0x4896('0x4d')]);_0x133744['where']=qs[_0x4896('0x44')](_['pick'](_0x5cc341['query'],_0x28ac77[_0x4896('0x44')]));_0x133744['where'][_0x4896('0x68')]=_0x574bd9['id'];if(_0x5cc341[_0x4896('0x46')][_0x4896('0x50')]){_0x133744['where']=_['merge'](_0x133744[_0x4896('0x4e')],{'$or':_[_0x4896('0x42')](_0x133744[_0x4896('0x47')],function(_0x198f33){var _0x237b41={};_0x237b41[_0x198f33]={'$like':'%'+_0x5cc341['query'][_0x4896('0x50')]+'%'};return _0x237b41;})});}_0x133744=_[_0x4896('0x51')]({},_0x133744,_0x5cc341[_0x4896('0x53')]);return db[_0x4896('0x6c')]['count']({'where':_0x133744[_0x4896('0x4e')]})[_0x4896('0x20')](function(_0x272e52){_0x1525c1['count']=_0x272e52;if(_0x5cc341[_0x4896('0x46')][_0x4896('0x54')]){_0x133744['include']=[{'all':!![]}];}return db[_0x4896('0x6c')][_0x4896('0x69')](_0x133744);})[_0x4896('0x20')](function(_0x50fb4b){_0x1525c1[_0x4896('0x55')]=_0x50fb4b;return _0x1525c1;});}})[_0x4896('0x20')](respondWithFilteredResult(_0x64f7d1,_0x133744))[_0x4896('0x29')](handleError(_0x64f7d1,null));};exports[_0x4896('0x6e')]=function(_0x26f0bd,_0x42dfae,_0x486d38){return db[_0x4896('0x3d')][_0x4896('0x5e')]({'where':{'id':_0x26f0bd['params']['id']}})['then'](handleEntityNotFound(_0x42dfae,null))[_0x4896('0x20')](function(_0x4f34e7){if(_0x4f34e7){return _0x4f34e7[_0x4896('0x6e')](_0x26f0bd['query'][_0x4896('0x6f')]);}})['then'](respondWithStatusCode(_0x42dfae,null))['catch'](handleError(_0x42dfae,null));};exports[_0x4896('0x70')]=function(_0x56e882,_0x20186c,_0x4cc1cf){return db[_0x4896('0x71')][_0x4896('0x5e')]({'where':{'id':_0x56e882[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x20186c,null))[_0x4896('0x20')](function(_0x4a7049){if(_0x4a7049){return _0x4a7049[_0x4896('0x70')](_0x56e882['body'][_0x4896('0x6f')],_[_0x4896('0x72')](_0x56e882[_0x4896('0x5a')],[_0x4896('0x6f'),'id'])||{});}})[_0x4896('0x20')](respondWithResult(_0x20186c,null))['catch'](handleError(_0x20186c,null));};exports[_0x4896('0x73')]=function(_0x3dac7e,_0x532950,_0xb9f3fb){var _0x251159={'raw':![],'where':{}};var _0x42eceb={};var _0x27bc80={'count':0x0,'rows':[]};return db[_0x4896('0x3d')][_0x4896('0x67')]({'where':{'id':_0x3dac7e['params']['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x532950,null))[_0x4896('0x20')](function(_0x215826){if(_0x215826){_0x42eceb[_0x4896('0x41')]=_[_0x4896('0x43')](db[_0x4896('0x71')][_0x4896('0x57')]);_0x42eceb[_0x4896('0x46')]=_['keys'](_0x3dac7e['query']);_0x42eceb['filters']=_['intersection'](_0x42eceb['model'],_0x42eceb[_0x4896('0x46')]);_0x251159[_0x4896('0x47')]=_[_0x4896('0x45')](_0x42eceb[_0x4896('0x41')],qs['fields'](_0x3dac7e[_0x4896('0x46')][_0x4896('0x48')]));_0x251159[_0x4896('0x47')]=_0x251159[_0x4896('0x47')][_0x4896('0x49')]?_0x251159[_0x4896('0x47')]:_0x42eceb[_0x4896('0x41')];if(!_0x3dac7e['query'][_0x4896('0x4a')](_0x4896('0x4b'))){_0x251159['limit']=qs[_0x4896('0x2f')](_0x3dac7e['query']['limit']);_0x251159[_0x4896('0x2d')]=qs[_0x4896('0x2d')](_0x3dac7e[_0x4896('0x46')][_0x4896('0x2d')]);}_0x251159[_0x4896('0x4c')]=qs[_0x4896('0x4d')](_0x3dac7e['query']['sort']);_0x251159['where']=qs[_0x4896('0x44')](_[_0x4896('0x4f')](_0x3dac7e[_0x4896('0x46')],_0x42eceb[_0x4896('0x44')]));_0x251159[_0x4896('0x4e')][_0x4896('0x68')]=_0x215826['id'];if(_0x3dac7e[_0x4896('0x46')][_0x4896('0x50')]){_0x251159['where']=_['merge'](_0x251159[_0x4896('0x4e')],{'$or':_[_0x4896('0x42')](_0x251159[_0x4896('0x47')],function(_0x40f39c){var _0x57915d={};_0x57915d[_0x40f39c]={'$like':'%'+_0x3dac7e['query'][_0x4896('0x50')]+'%'};return _0x57915d;})});}_0x251159=_['merge']({},_0x251159,_0x3dac7e[_0x4896('0x53')]);return db[_0x4896('0x71')][_0x4896('0x2e')]({'where':_0x251159[_0x4896('0x4e')]})[_0x4896('0x20')](function(_0x561457){_0x27bc80['count']=_0x561457;if(_0x3dac7e['query'][_0x4896('0x54')]){_0x251159[_0x4896('0x58')]=[{'model':db['CmContact'],'as':_0x4896('0x74'),'required':![]},{'model':db[_0x4896('0x75')],'as':_0x4896('0x76'),'attributes':[_0x4896('0x39'),_0x4896('0x77'),_0x4896('0x78')],'required':![]},{'model':db['Tag'],'as':_0x4896('0x79'),'attributes':['id',_0x4896('0x39'),_0x4896('0x7a')],'where':_0x3dac7e[_0x4896('0x46')][_0x4896('0x7b')]?{'id':_0x3dac7e['query'][_0x4896('0x7b')]}:undefined,'required':_0x3dac7e[_0x4896('0x46')][_0x4896('0x7b')]?!![]:![]}];}return db[_0x4896('0x71')]['findAll'](_0x251159);})[_0x4896('0x20')](function(_0x63a06c){_0x27bc80[_0x4896('0x55')]=_0x63a06c;return _0x27bc80;});}})[_0x4896('0x20')](respondWithFilteredResult(_0x532950,_0x251159))[_0x4896('0x29')](handleError(_0x532950,null));};exports[_0x4896('0x7c')]=function(_0x172c0d,_0x5253b2){var _0x1f0235=_0x172c0d[_0x4896('0x62')]['id'];var _0xbede91=_0x172c0d[_0x4896('0x5a')];var _0x147a1e=0xc8;var _0x28ea8c=null;return db[_0x4896('0x7d')][_0x4896('0x7e')]({'isolationLevel':db[_0x4896('0x7d')][_0x4896('0x7f')][_0x4896('0x80')]['READ_COMMITTED']},function(_0x4360bd){return db[_0x4896('0x3d')][_0x4896('0x67')]({'where':{'id':_0x1f0235},'transaction':_0x4360bd})[_0x4896('0x20')](function(_0x1df3cb){if(_0x1df3cb){return db[_0x4896('0x81')][_0x4896('0x37')]({'where':{'FaxAccountId':_0x1f0235},'transaction':_0x4360bd})['then'](function(){var _0xce85f7=_[_0x4896('0x42')](_0xbede91,function(_0x5775a2){_0x5775a2['FaxAccountId']=_0x1f0235;return _0x5775a2;});return db['FaxApplication'][_0x4896('0x82')](_0xce85f7,{'transaction':_0x4360bd});});}else{_0x147a1e=0x194;_0x28ea8c=[];}});})[_0x4896('0x20')](function(){if(_0x147a1e!==0x194){return db[_0x4896('0x81')][_0x4896('0x83')]({'where':{'FaxAccountId':_0x1f0235},'order':_0x4896('0x84')})[_0x4896('0x20')](function(_0xe7ee82){_0x28ea8c=_0xe7ee82;});}})[_0x4896('0x29')](function(_0x3a1804){_0x147a1e=0x1f4;logger[_0x4896('0x24')](_0x3a1804[_0x4896('0x38')]);if(_0x3a1804['name']){delete _0x3a1804[_0x4896('0x39')];}_0x28ea8c=_0x3a1804;})[_0x4896('0x85')](function(){if(_0x28ea8c===null){_0x5253b2['sendStatus'](_0x147a1e);}else{if(_0x147a1e===0x1f4){_0x5253b2[_0x4896('0x2b')](_0x147a1e)['send'](_0x28ea8c);}else{_0x5253b2[_0x4896('0x2b')](_0x147a1e)[_0x4896('0x86')](_0x28ea8c);}}});};exports[_0x4896('0x87')]=function(_0x51693b,_0x339cf8,_0x50f66a){var _0x32a767={};var _0x546621={};var _0x488618;var _0x3ab63f;return db[_0x4896('0x3d')][_0x4896('0x67')]({'where':{'id':_0x51693b[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x339cf8,null))[_0x4896('0x20')](function(_0x1d31f4){if(_0x1d31f4){_0x488618=_0x1d31f4;_0x546621['model']=_[_0x4896('0x43')](db['FaxApplication']['rawAttributes']);_0x546621[_0x4896('0x46')]=_['keys'](_0x51693b['query']);_0x546621[_0x4896('0x44')]=_[_0x4896('0x45')](_0x546621[_0x4896('0x41')],_0x546621[_0x4896('0x46')]);_0x32a767[_0x4896('0x47')]=_[_0x4896('0x45')](_0x546621[_0x4896('0x41')],qs['fields'](_0x51693b[_0x4896('0x46')]['fields']));_0x32a767[_0x4896('0x47')]=_0x32a767[_0x4896('0x47')][_0x4896('0x49')]?_0x32a767[_0x4896('0x47')]:_0x546621['model'];_0x32a767[_0x4896('0x4c')]=qs['sort'](_0x51693b[_0x4896('0x46')][_0x4896('0x4d')]);_0x32a767[_0x4896('0x4e')]=qs[_0x4896('0x44')](_['pick'](_0x51693b['query'],_0x546621['filters']));if(_0x51693b[_0x4896('0x46')][_0x4896('0x50')]){_0x32a767[_0x4896('0x4e')]=_[_0x4896('0x51')](_0x32a767[_0x4896('0x4e')],{'$or':_[_0x4896('0x42')](_0x32a767[_0x4896('0x47')],function(_0x40ac91){var _0x3ab60d={};_0x3ab60d[_0x40ac91]={'$like':'%'+_0x51693b[_0x4896('0x46')][_0x4896('0x50')]+'%'};return _0x3ab60d;})});}_0x32a767=_[_0x4896('0x51')]({},_0x32a767,_0x51693b[_0x4896('0x53')]);return _0x488618[_0x4896('0x87')](_0x32a767);}})[_0x4896('0x20')](function(_0x4feabd){if(_0x4feabd){_0x3ab63f=_0x4feabd['length'];if(!_0x51693b['query']['hasOwnProperty']('nolimit')){_0x32a767[_0x4896('0x2f')]=qs[_0x4896('0x2f')](_0x51693b[_0x4896('0x46')][_0x4896('0x2f')]);_0x32a767['offset']=qs[_0x4896('0x2d')](_0x51693b['query']['offset']);}return _0x488618[_0x4896('0x87')](_0x32a767);}})[_0x4896('0x20')](function(_0x1bdec0){if(_0x1bdec0){return _0x1bdec0?{'count':_0x3ab63f,'rows':_0x1bdec0}:null;}})[_0x4896('0x20')](respondWithResult(_0x339cf8,null))[_0x4896('0x29')](handleError(_0x339cf8,null));};function Extension(_0x409b8a,_0x1e9f15,_0x25ad92,_0x201bdf){this[_0x4896('0x88')]='from-voip-provider';this[_0x4896('0x89')]=_0x409b8a[_0x4896('0x8a')];this[_0x4896('0x8b')]=_0x201bdf;this[_0x4896('0x3f')]=_0x4896('0x8c');this[_0x4896('0x8d')]=_0x4896('0x8e');this['FaxAccountId']=_0x409b8a['id'];this[_0x4896('0x84')]=_0x1e9f15;this['appdata']=_0x25ad92;}function createExtensionsReciveFax(_0x313b21){var _0x57e139=0x1;var _0x3a211a=[];_0x3a211a[_0x4896('0x8f')](new Extension(_0x313b21,_0x57e139,'','Answer'));_0x57e139+=0x1;_0x3a211a[_0x4896('0x8f')](new Extension(_0x313b21,_0x57e139,_0x4896('0x90'),'Set'));_0x57e139+=0x1;for(var _0x171004 in _0x313b21){if(_0x313b21[_0x4896('0x4a')](_0x171004)&&(_0x171004===_0x4896('0x91')||_0x171004===_0x4896('0x8a')||_0x171004===_0x4896('0x92')||_0x171004==='faxdetect'||_0x171004===_0x4896('0x93')||_0x171004==='maxrate'||_0x171004==='minrate'||_0x171004==='modem'||_0x171004==='t38timeout')){_0x3a211a['push'](new Extension(_0x313b21,_0x57e139,_0x4896('0x94')+_0x171004+')='+_0x313b21[_0x171004],_0x4896('0x95')));_0x57e139+=0x1;}}_0x3a211a[_0x4896('0x8f')](new Extension(_0x313b21,_0x57e139,'6','Wait'));_0x57e139+=0x1;_0x3a211a[_0x4896('0x8f')](new Extension(_0x313b21,_0x57e139,'/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',_0x4896('0x96')));_0x57e139=0x0;return _0x3a211a;}exports[_0x4896('0x97')]=function(_0x3a7068,_0x442912,_0x5b3b02){var _0x3d5753;return db[_0x4896('0x7d')][_0x4896('0x7e')](function(_0xcd3313){return db[_0x4896('0x3d')][_0x4896('0x59')](_0x3a7068[_0x4896('0x5a')],{'transaction':_0xcd3313})[_0x4896('0x20')](function(_0x492663){_0x3d5753=_0x492663[_0x4896('0x35')]({'plain':!![]});return db[_0x4896('0x98')][_0x4896('0x82')](createExtensionsReciveFax(_0x3d5753),{'transaction':_0xcd3313});});})[_0x4896('0x20')](function(){return _0x3d5753;})[_0x4896('0x20')](respondWithResult(_0x442912,null))[_0x4896('0x29')](handleError(_0x442912,null));};exports[_0x4896('0x99')]=function(_0x529a85,_0x5305b6,_0x1ce93a){var _0x309ae5;return db[_0x4896('0x7d')][_0x4896('0x7e')](function(_0x331c47){return db[_0x4896('0x3d')]['update'](_0x529a85['body'],{'where':{'id':_0x529a85[_0x4896('0x5a')]['id']},'transaction':_0x331c47})['then'](function(_0x24e21c){return db[_0x4896('0x98')][_0x4896('0x37')]({'where':{'FaxAccountId':_0x529a85[_0x4896('0x5a')]['id']},'transaction':_0x331c47})['then'](function(_0x2e253d){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x4896('0x72')](_0x529a85[_0x4896('0x5a')],[_0x4896('0x9a'),_0x4896('0x40'),_0x4896('0x9b'),_0x4896('0x9c'),_0x4896('0x9d'),_0x4896('0x9e')])),{'transaction':_0x331c47});});});})['then'](function(){return db[_0x4896('0x3d')][_0x4896('0x9f')](_0x529a85[_0x4896('0x5a')]['id']);})[_0x4896('0x20')](respondWithResult(_0x5305b6,null))['catch'](handleError(_0x5305b6,null));};exports[_0x4896('0xa0')]=function(_0x15ebec,_0xf96a4e,_0x5800cb){var _0x492b4c={'raw':!![],'where':{}};var _0x264032={};var _0x1b4b0a={'count':0x0,'rows':[]};return db[_0x4896('0x3d')]['findOne']({'where':{'id':_0x15ebec[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0xf96a4e,null))[_0x4896('0x20')](function(_0x184a76){if(_0x184a76){_0x264032[_0x4896('0x41')]=_['keys'](db[_0x4896('0xa1')][_0x4896('0x57')]);_0x264032[_0x4896('0x46')]=_[_0x4896('0x43')](_0x15ebec[_0x4896('0x46')]);_0x264032[_0x4896('0x44')]=_[_0x4896('0x45')](_0x264032[_0x4896('0x41')],_0x264032[_0x4896('0x46')]);_0x492b4c['attributes']=_[_0x4896('0x45')](_0x264032[_0x4896('0x41')],qs[_0x4896('0x48')](_0x15ebec[_0x4896('0x46')][_0x4896('0x48')]));_0x492b4c[_0x4896('0x47')]=_0x492b4c['attributes'][_0x4896('0x49')]?_0x492b4c[_0x4896('0x47')]:_0x264032[_0x4896('0x41')];if(!_0x15ebec[_0x4896('0x46')][_0x4896('0x4a')](_0x4896('0x4b'))){_0x492b4c['limit']=qs[_0x4896('0x2f')](_0x15ebec[_0x4896('0x46')][_0x4896('0x2f')]);_0x492b4c['offset']=qs[_0x4896('0x2d')](_0x15ebec[_0x4896('0x46')][_0x4896('0x2d')]);}_0x492b4c[_0x4896('0x4c')]=qs[_0x4896('0x4d')](_0x15ebec[_0x4896('0x46')]['sort']);_0x492b4c[_0x4896('0x4e')]=qs[_0x4896('0x44')](_[_0x4896('0x4f')](_0x15ebec[_0x4896('0x46')],_0x264032[_0x4896('0x44')]));_0x492b4c['where']['FaxAccountId']=_0x184a76['id'];if(_0x15ebec[_0x4896('0x46')][_0x4896('0x50')]){_0x492b4c[_0x4896('0x4e')]=_[_0x4896('0x51')](_0x492b4c[_0x4896('0x4e')],{'$or':_[_0x4896('0x42')](_0x492b4c[_0x4896('0x47')],function(_0x383d27){var _0x1dba86={};_0x1dba86[_0x383d27]={'$like':'%'+_0x15ebec['query'][_0x4896('0x50')]+'%'};return _0x1dba86;})});}if(_0x15ebec['query'][_0x4896('0xa2')]){var _0x1b2d02=_0x15ebec[_0x4896('0x46')]['$gte'][_0x4896('0xa3')](',');var _0x5602c2={};_0x5602c2[_0x1b2d02[0x0]]={'$gte':moment(_0x1b2d02[0x1])[_0x4896('0xa4')](_0x4896('0xa5'))};_0x492b4c[_0x4896('0x4e')]=_[_0x4896('0x51')](_0x492b4c['where'],_0x5602c2);}_0x492b4c=_[_0x4896('0x51')]({},_0x492b4c,_0x15ebec[_0x4896('0x53')]);return db[_0x4896('0xa1')]['count']({'where':_0x492b4c[_0x4896('0x4e')]})[_0x4896('0x20')](function(_0x4a72a5){_0x1b4b0a[_0x4896('0x2e')]=_0x4a72a5;if(_0x15ebec['query'][_0x4896('0x54')]){_0x492b4c[_0x4896('0x58')]=[{'all':!![]}];}return db[_0x4896('0xa1')][_0x4896('0x69')](_0x492b4c);})[_0x4896('0x20')](function(_0x5087bf){_0x1b4b0a[_0x4896('0x55')]=_0x5087bf;return _0x1b4b0a;});}})[_0x4896('0x20')](respondWithFilteredResult(_0xf96a4e,_0x492b4c))[_0x4896('0x29')](handleError(_0xf96a4e,null));};exports[_0x4896('0x3a')]=function(_0xe91e15,_0x69ab65,_0x413272){var _0x21ad91,_0x4e714e={},_0x28a996;if(_0xe91e15[_0x4896('0x5a')]['to']){_0x28a996=_0xe91e15[_0x4896('0x5a')]['to'][0x0];}return db['FaxAccount'][_0x4896('0x5e')]({'where':{'id':_0xe91e15[_0x4896('0x62')]['id']},'include':[{'model':db[_0x4896('0xa6')],'as':_0x4896('0xa7'),'include':[{'model':db[_0x4896('0xa8')],'as':'Contacts','where':{'fax':_0x28a996},'limit':0x1,'order':[[_0x4896('0x9c'),_0x4896('0xa9')]]}]}]})[_0x4896('0x20')](handleEntityNotFound(_0x69ab65,null))[_0x4896('0x20')](function(_0x34d102){_0x21ad91=_0x34d102;if(_0xe91e15['body'][_0x4896('0xaa')]&&_0xe91e15[_0x4896('0x5a')]['attachments'][_0x4896('0x49')]){for(var _0x192b8c=0x0;_0x192b8c<_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][_0x4896('0x49')];_0x192b8c+=0x1){_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][_0x192b8c]={'filename':_0xe91e15['body'][_0x4896('0xaa')][_0x192b8c][_0x4896('0x39')],'id':_0xe91e15['body'][_0x4896('0xaa')][_0x192b8c]['id'],'path':path[_0x4896('0xab')](config[_0x4896('0xac')],_0x4896('0xad'),_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][_0x192b8c][_0x4896('0xae')])};}}return respondWithRpcPromise(_0x4896('0xaf'),_0x4896('0xaf'),{'FaxAccountId':_[_0x4896('0xb0')](_0xe91e15[_0x4896('0x62')]['id'])?undefined:_0xe91e15[_0x4896('0x62')]['id'],'path':_[_0x4896('0xb0')](_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0][_0x4896('0x7')])?undefined:_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0][_0x4896('0x7')],'fax':_[_0x4896('0xb0')](_0xe91e15[_0x4896('0x5a')]['to'][0x0])?undefined:_0xe91e15[_0x4896('0x5a')]['to'][0x0]},client9002);})[_0x4896('0x20')](function(){if(_0x21ad91){if(_[_0x4896('0xb0')](_0xe91e15[_0x4896('0x5a')][_0x4896('0xb1')])){_0xe91e15[_0x4896('0x5a')][_0x4896('0xb1')]=util[_0x4896('0xa4')](_0x4896('0xb2'),_0x21ad91[_0x4896('0x39')],_0x21ad91[_0x4896('0xb3')]);}if(_0x21ad91[_0x4896('0xa7')]){if(_0x21ad91[_0x4896('0xa7')][_0x4896('0xb4')][_0x4896('0x49')]){return _0x21ad91[_0x4896('0xa7')][_0x4896('0xb4')][0x0];}else{return db[_0x4896('0xa8')][_0x4896('0x59')](_[_0x4896('0x19')](_0xe91e15[_0x4896('0x5a')],{'firstName':_0xe91e15[_0x4896('0x5a')]['to'][0x0],'phone':_0xe91e15['body']['to'][0x0],'fax':_0xe91e15['body']['to'][0x0],'ListId':_0x21ad91['ListId']}));}}else{throw new Error(_0x4896('0xb5'));}}else{throw new Error(_0x4896('0xb6'));}})[_0x4896('0x20')](function(_0x40ab4d){if(_0x40ab4d){return db[_0x4896('0x71')][_0x4896('0x5e')]({'where':{'ContactId':_0x40ab4d['id'],'closed':![],'FaxAccountId':_0x21ad91['id']}})[_0x4896('0x20')](function(_0x214dd0){if(_0x214dd0){return[_0x214dd0,![]];}return db[_0x4896('0x71')][_0x4896('0x59')]({'UserId':_0xe91e15[_0x4896('0x5b')]['id'],'ContactId':_0x40ab4d['id'],'FaxAccountId':_0x21ad91['id'],'fax':_0xe91e15[_0x4896('0x5a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x4896('0x51')](_0xe91e15[_0x4896('0x5a')],{'read':![],'body':_0xe91e15[_0x4896('0x5a')]['attachments'][0x0]['filename'],'FaxAccountId':_0x21ad91['id'],'UserId':_0xe91e15[_0x4896('0x5b')]['id'],'ContactId':_0x40ab4d['id'],'AttachmentId':_0xe91e15[_0x4896('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x4896('0xa1')],'as':'Messages'}]})['then'](function(_0x560b86){return[_0x560b86,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4896('0xb7')](function(_0x3a9db7,_0x1ac98e){if(_0x1ac98e){return _0x3a9db7;}return db['FaxMessage'][_0x4896('0x59')]({'direction':'out','read':![],'body':_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0][_0x4896('0xb8')],'FaxAccountId':_0x21ad91['id'],'FaxInteractionId':_0x3a9db7['id'],'UserId':_0xe91e15[_0x4896('0x5b')]['id'],'ContactId':_0x3a9db7['ContactId'],'AttachmentId':_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0]['id']})['then'](function(_0x1e16d1){_0x3a9db7[_0x4896('0xb9')][_0x4896('0xba')]=[];_0x3a9db7[_0x4896('0xb9')][_0x4896('0xba')][_0x4896('0x8f')](_0x1e16d1['dataValues']);return _0x3a9db7;});})[_0x4896('0x20')](function(_0x5d5cfe){respondWithRpcPromise(_0x4896('0xbb'),_0x4896('0xbb'),{'FaxAccountId':_['isNil'](_0xe91e15['params']['id'])?undefined:_0xe91e15['params']['id'],'path':_[_0x4896('0xb0')](_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0][_0x4896('0x7')])?undefined:_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0][_0x4896('0x7')],'fax':_[_0x4896('0xb0')](_0xe91e15['body']['to'][0x0])?undefined:_0xe91e15[_0x4896('0x5a')]['to'][0x0],'AttachmentId':_0xe91e15[_0x4896('0x5a')][_0x4896('0xaa')][0x0]['id']},client9002)['then'](function(_0x292f62){logger[_0x4896('0x21')](_0x4896('0xbc'),_0x292f62);})[_0x4896('0x29')](function(_0x3ed96c){logger[_0x4896('0x21')](_0x4896('0xbc'),_0x3ed96c);});return _0x5d5cfe;})['then'](respondWithResult(_0x69ab65,null))['catch'](handleError(_0x69ab65,null));};exports[_0x4896('0xbd')]=function(_0x158899,_0x4ce6ea,_0x3bdb16){return db[_0x4896('0x3d')][_0x4896('0x5e')]({'where':{'id':_0x158899['params']['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x4ce6ea,null))['then'](function(_0x17d3a5){if(_0x17d3a5){return _0x17d3a5['addAgents'](_0x158899['body'][_0x4896('0x6f')],_[_0x4896('0x72')](_0x158899[_0x4896('0x5a')],[_0x4896('0x6f'),'id'])||{})[_0x4896('0xb7')](function(_0x2d3cb2){for(var _0x571783=0x0;_0x571783<_0x158899['body'][_0x4896('0x6f')]['length'];_0x571783+=0x1){socket['emit'](_0x4896('0xbe'),{'UserId':Number(_0x158899[_0x4896('0x5a')]['ids'][_0x571783]),'FaxAccountId':Number(_0x158899[_0x4896('0x62')]['id'])});}return _0x2d3cb2;});}})[_0x4896('0x20')](respondWithResult(_0x4ce6ea,null))['catch'](handleError(_0x4ce6ea,null));};exports[_0x4896('0xbf')]=function(_0x4edf55,_0x424147,_0x33ab62){return db['FaxAccount']['find']({'where':{'id':_0x4edf55[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x424147,null))[_0x4896('0x20')](function(_0x50eb9f){if(_0x50eb9f){return _0x50eb9f['removeAgents'](_0x4edf55[_0x4896('0x46')][_0x4896('0x6f')])['then'](function(){if(_[_0x4896('0xc0')](_0x4edf55['query']['ids'])){for(var _0x398a5f=0x0;_0x398a5f<_0x4edf55[_0x4896('0x46')][_0x4896('0x6f')][_0x4896('0x49')];_0x398a5f+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x4edf55[_0x4896('0x46')][_0x4896('0x6f')][_0x398a5f]),'FaxAccountId':Number(_0x4edf55[_0x4896('0x62')]['id'])});}}else{socket[_0x4896('0xc1')](_0x4896('0xc2'),{'UserId':Number(_0x4edf55['query'][_0x4896('0x6f')]),'FaxAccountId':Number(_0x4edf55['params']['id'])});}});}})[_0x4896('0x20')](respondWithStatusCode(_0x424147,null))[_0x4896('0x29')](handleError(_0x424147,null));};exports[_0x4896('0xc3')]=function(_0x2f7bd5,_0x8c17ae,_0x51711a){var _0x16a8e6={};var _0x39d871={};var _0x58f4b6;var _0xc94da2;return db[_0x4896('0x3d')][_0x4896('0x67')]({'where':{'id':_0x2f7bd5[_0x4896('0x62')]['id']}})[_0x4896('0x20')](handleEntityNotFound(_0x8c17ae,null))[_0x4896('0x20')](function(_0x5a63be){if(_0x5a63be){_0x58f4b6=_0x5a63be;_0x39d871[_0x4896('0x41')]=_[_0x4896('0x43')](db[_0x4896('0x75')][_0x4896('0x57')]);_0x39d871[_0x4896('0x46')]=_['keys'](_0x2f7bd5[_0x4896('0x46')]);_0x39d871[_0x4896('0x44')]=_[_0x4896('0x45')](_0x39d871['model'],_0x39d871[_0x4896('0x46')]);_0x16a8e6[_0x4896('0x47')]=_[_0x4896('0x45')](_0x39d871[_0x4896('0x41')],qs[_0x4896('0x48')](_0x2f7bd5['query'][_0x4896('0x48')]));_0x16a8e6[_0x4896('0x47')]=_0x16a8e6['attributes'][_0x4896('0x49')]?_0x16a8e6[_0x4896('0x47')]:_0x39d871[_0x4896('0x41')];_0x16a8e6[_0x4896('0x4c')]=qs[_0x4896('0x4d')](_0x2f7bd5[_0x4896('0x46')]['sort']);_0x16a8e6['where']=qs[_0x4896('0x44')](_['pick'](_0x2f7bd5[_0x4896('0x46')],_0x39d871[_0x4896('0x44')]));if(_0x2f7bd5[_0x4896('0x46')][_0x4896('0x50')]){_0x16a8e6['where']=_[_0x4896('0x51')](_0x16a8e6['where'],{'$or':_[_0x4896('0x42')](_0x16a8e6[_0x4896('0x47')],function(_0x10b9c0){var _0x524a24={};_0x524a24[_0x10b9c0]={'$like':'%'+_0x2f7bd5[_0x4896('0x46')][_0x4896('0x50')]+'%'};return _0x524a24;})});}_0x16a8e6=_[_0x4896('0x51')]({},_0x16a8e6,_0x2f7bd5['options']);return _0x58f4b6[_0x4896('0xc3')](_0x16a8e6);}})[_0x4896('0x20')](function(_0x155676){if(_0x155676){_0xc94da2=_0x155676[_0x4896('0x49')];if(!_0x2f7bd5[_0x4896('0x46')]['hasOwnProperty'](_0x4896('0x4b'))){_0x16a8e6[_0x4896('0x2f')]=qs[_0x4896('0x2f')](_0x2f7bd5[_0x4896('0x46')][_0x4896('0x2f')]);_0x16a8e6[_0x4896('0x2d')]=qs[_0x4896('0x2d')](_0x2f7bd5[_0x4896('0x46')][_0x4896('0x2d')]);}return _0x58f4b6[_0x4896('0xc3')](_0x16a8e6);}})[_0x4896('0x20')](function(_0x223830){if(_0x223830){return _0x223830?{'count':_0xc94da2,'rows':_0x223830}:null;}})[_0x4896('0x20')](respondWithResult(_0x8c17ae,null))['catch'](handleError(_0x8c17ae,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6913104..e353cad 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 _0x6629=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x2dee04,_0x468895){var _0x4b81a7=function(_0xc5e766){while(--_0xc5e766){_0x2dee04['push'](_0x2dee04['shift']());}};_0x4b81a7(++_0x468895);}(_0x6629,0x1c2));var _0x9662=function(_0x55109d,_0x219519){_0x55109d=_0x55109d-0x0;var _0x3b188b=_0x6629[_0x55109d];return _0x3b188b;};'use strict';var EventEmitter=require(_0x9662('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9662('0x1')](0x0);var events={'afterCreate':_0x9662('0x2'),'afterUpdate':_0x9662('0x3'),'afterDestroy':_0x9662('0x4')};function emitEvent(_0x54979b){return function(_0x43f66a,_0x41ad57,_0x285f7e){FaxAccountEvents['emit'](_0x54979b+':'+_0x43f66a['id'],_0x43f66a);FaxAccountEvents[_0x9662('0x5')](_0x54979b,_0x43f66a);_0x285f7e(null);};}for(var e in events){if(events[_0x9662('0x6')](e)){var event=events[e];FaxAccount[_0x9662('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x70de=['save','update','remove','hasOwnProperty','hook','FaxAccount'];(function(_0x37e331,_0x5c5bb7){var _0x3b0b3d=function(_0x99a51f){while(--_0x99a51f){_0x37e331['push'](_0x37e331['shift']());}};_0x3b0b3d(++_0x5c5bb7);}(_0x70de,0xb3));var _0xe70d=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0x70de[_0x58ac34];return _0x3921ab;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xe70d('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe70d('0x1'),'afterUpdate':_0xe70d('0x2'),'afterDestroy':_0xe70d('0x3')};function emitEvent(_0x1c88d1){return function(_0x52a812,_0x312ab4,_0x1b6346){FaxAccountEvents['emit'](_0x1c88d1+':'+_0x52a812['id'],_0x52a812);FaxAccountEvents['emit'](_0x1c88d1,_0x52a812);_0x1b6346(null);};}for(var e in events){if(events[_0xe70d('0x4')](e)){var event=events[e];FaxAccount[_0xe70d('0x5')](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 9f682ce..8a333c3 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 _0xac61=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','api','bluebird'];(function(_0x1a2a88,_0x2c3cc7){var _0x577d74=function(_0x467bc6){while(--_0x467bc6){_0x1a2a88['push'](_0x1a2a88['shift']());}};_0x577d74(++_0x2c3cc7);}(_0xac61,0x105));var _0x1ac6=function(_0x284ae7,_0x432446){_0x284ae7=_0x284ae7-0x0;var _0x30967b=_0xac61[_0x284ae7];return _0x30967b;};'use strict';var _=require(_0x1ac6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ac6('0x1'));var moment=require('moment');var BPromise=require(_0x1ac6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ac6('0x3'));var rimraf=require(_0x1ac6('0x4'));var config=require(_0x1ac6('0x5'));var attributes=require(_0x1ac6('0x6'));module[_0x1ac6('0x7')]=function(_0x51bd11,_0x20df65){return _0x51bd11[_0x1ac6('0x8')](_0x1ac6('0x9'),attributes,{'tableName':_0x1ac6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa53=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','fax_accounts'];(function(_0x37ef09,_0x5edd6e){var _0xa254fc=function(_0x3289d7){while(--_0x3289d7){_0x37ef09['push'](_0x37ef09['shift']());}};_0xa254fc(++_0x5edd6e);}(_0xaa53,0x171));var _0x3aa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa53[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3aa5('0x0'));var util=require(_0x3aa5('0x1'));var logger=require(_0x3aa5('0x2'))(_0x3aa5('0x3'));var moment=require('moment');var BPromise=require(_0x3aa5('0x4'));var rp=require(_0x3aa5('0x5'));var fs=require('fs');var path=require(_0x3aa5('0x6'));var rimraf=require('rimraf');var config=require(_0x3aa5('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x35a05e,_0x567dbd){return _0x35a05e['define']('FaxAccount',attributes,{'tableName':_0x3aa5('0x8'),'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 65e1aec..2f06e56 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 _0x1848=['rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','model','map','include','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','length','contact','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','interaction','ContactId','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1848,0xa7));var _0x8184=function(_0x3905e4,_0x2ca34f){_0x3905e4=_0x3905e4-0x0;var _0x4383b5=_0x1848[_0x3905e4];return _0x4383b5;};'use strict';var _=require(_0x8184('0x0'));var util=require(_0x8184('0x1'));var moment=require(_0x8184('0x2'));var BPromise=require(_0x8184('0x3'));var rs=require(_0x8184('0x4'));var fs=require('fs');var Redis=require(_0x8184('0x5'));var db=require(_0x8184('0x6'))['db'];var utils=require(_0x8184('0x7'));var logger=require(_0x8184('0x8'))(_0x8184('0x9'));var config=require(_0x8184('0xa'));var jayson=require(_0x8184('0xb'));var client=jayson['client'][_0x8184('0xc')]({'port':0x232c});config[_0x8184('0xd')]=_[_0x8184('0xe')](config[_0x8184('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8184('0xf'))(new Redis(config['redis']));require(_0x8184('0x10'))[_0x8184('0x11')](socket);function respondWithRpcPromise(_0x23cd94,_0x30b5cc,_0x3da16b){return new BPromise(function(_0x1b914a,_0x5850a4){return client[_0x8184('0x12')](_0x23cd94,_0x3da16b)[_0x8184('0x13')](function(_0x243be5){logger[_0x8184('0x14')](_0x8184('0x15'),_0x30b5cc,_0x8184('0x16'));logger[_0x8184('0x17')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x30b5cc,_0x8184('0x16'),JSON[_0x8184('0x18')](_0x243be5));if(_0x243be5[_0x8184('0x19')]){if(_0x243be5[_0x8184('0x19')][_0x8184('0x1a')]===0x1f4){logger[_0x8184('0x19')]('FaxAccount,\x20%s,\x20%s',_0x30b5cc,_0x243be5['error'][_0x8184('0x1b')]);return _0x5850a4(_0x243be5['error'][_0x8184('0x1b')]);}logger[_0x8184('0x19')]('FaxAccount,\x20%s,\x20%s',_0x30b5cc,_0x243be5[_0x8184('0x19')]['message']);return _0x1b914a(_0x243be5['error'][_0x8184('0x1b')]);}else{logger[_0x8184('0x14')]('FaxAccount,\x20%s,\x20%s',_0x30b5cc,_0x8184('0x16'));_0x1b914a(_0x243be5[_0x8184('0x1c')]['message']);}})['catch'](function(_0x26c4ad){logger[_0x8184('0x19')](_0x8184('0x15'),_0x30b5cc,_0x26c4ad);_0x5850a4(_0x26c4ad);});});}exports[_0x8184('0x1d')]=function(_0x20e609){var _0x5f28cc=this;return new Promise(function(_0x13bf1c,_0x3ff36b){return db[_0x8184('0x1e')][_0x8184('0x1f')]({'raw':_0x20e609[_0x8184('0x20')]?_0x20e609[_0x8184('0x20')][_0x8184('0x21')]===undefined?!![]:![]:!![],'where':_0x20e609['options']?_0x20e609['options']['where']||null:null,'attributes':_0x20e609[_0x8184('0x20')]?_0x20e609['options'][_0x8184('0x22')]||null:null,'limit':_0x20e609[_0x8184('0x20')]?_0x20e609[_0x8184('0x20')]['limit']||null:null,'include':_0x20e609[_0x8184('0x20')]?_0x20e609[_0x8184('0x20')]['include']?_['map'](_0x20e609[_0x8184('0x20')]['include'],function(_0x11c177){return{'model':db[_0x11c177[_0x8184('0x23')]],'as':_0x11c177['as'],'attributes':_0x11c177[_0x8184('0x22')],'include':_0x11c177['include']?_[_0x8184('0x24')](_0x11c177[_0x8184('0x25')],function(_0x1a0c59){return{'model':db[_0x1a0c59[_0x8184('0x23')]],'as':_0x1a0c59['as'],'attributes':_0x1a0c59['attributes'],'include':_0x1a0c59[_0x8184('0x25')]?_[_0x8184('0x24')](_0x1a0c59[_0x8184('0x25')],function(_0x46d449){return{'model':db[_0x46d449[_0x8184('0x23')]],'as':_0x46d449['as'],'attributes':_0x46d449[_0x8184('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9865ad){logger[_0x8184('0x14')](_0x8184('0x1d'),_0x20e609);logger['debug'](_0x8184('0x1d'),_0x20e609,JSON[_0x8184('0x18')](_0x9865ad));_0x13bf1c(_0x9865ad);})[_0x8184('0x26')](function(_0x5b7415){logger[_0x8184('0x19')]('GetFaxAccount',_0x5b7415['message'],_0x20e609);_0x3ff36b(_0x5f28cc[_0x8184('0x19')](0x1f4,_0x5b7415[_0x8184('0x1b')]));});});};exports[_0x8184('0x27')]=function(_0x2774f3,_0x469811,_0x54bb0d){var _0x30547a=this;return new Promise(function(_0x2c2a78,_0x565f34){var _0x57ca59={'body':_0x2774f3[_0x8184('0x28')],'channel':_0x8184('0x29')};var _0x1d9930=[];var _0x152656=[];var _0x54ae84={};return db[_0x8184('0x2a')][_0x8184('0x2b')]()[_0x8184('0x13')](function(_0x35407c){if(!_0x35407c){throw new db[(_0x8184('0x2c'))]['ValidationError']('no\x20available\x20attributes');}_0x1d9930=_[_0x8184('0x2d')](_[_0x8184('0x2e')](_0x35407c),[_0x8184('0x2f'),_0x8184('0x30')]);_0x152656=_[_0x8184('0x2d')](_[_0x8184('0x2e')](_0x35407c),[_0x8184('0x2f'),_0x8184('0x30'),_0x8184('0x31'),_0x8184('0x32')]);if(_0x2774f3[_0x8184('0x28')]['id']){delete _0x2774f3['body']['id'];}if(_[_0x8184('0x33')](_0x2774f3[_0x8184('0x28')][_0x8184('0x34')])){throw new db['Sequelize'][(_0x8184('0x35'))]('from\x20is\x20mandatory');}if(_[_0x8184('0x33')](_0x2774f3[_0x8184('0x28')]['body'])||_0x2774f3[_0x8184('0x28')]['body']===''){throw new db['Sequelize'][(_0x8184('0x35'))](_0x8184('0x36'));}if(_[_0x8184('0x33')](_0x2774f3[_0x8184('0x28')][_0x8184('0x37')])){throw new db[(_0x8184('0x2c'))][(_0x8184('0x35'))](_0x8184('0x38')+_0x152656);}if(!_['includes'](_0x152656,_0x2774f3['body']['mapKey'])){throw new db[(_0x8184('0x2c'))][(_0x8184('0x35'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x152656);}_0x54ae84[_0x2774f3[_0x8184('0x28')][_0x8184('0x37')]]=_0x2774f3['body'][_0x8184('0x34')];})[_0x8184('0x13')](function(){return db[_0x8184('0x1e')][_0x8184('0x39')]({'where':{'id':_0x2774f3[_0x8184('0x3a')]['id']},'include':[{'model':db[_0x8184('0x3b')],'as':'List','include':[{'model':db[_0x8184('0x2a')],'as':_0x8184('0x3c'),'where':_0x54ae84,'limit':0x1,'order':[[_0x8184('0x30'),_0x8184('0x3d')]]}]},{'model':db[_0x8184('0x3e')],'as':_0x8184('0x3f')}]});})[_0x8184('0x13')](function(_0x215bfe){if(_0x215bfe&&_0x215bfe[_0x8184('0x40')]){var _0x21f703=_0x215bfe[_0x8184('0x41')]({'plain':!![]});_0x57ca59['account']=_0x21f703;_0x57ca59[_0x8184('0x42')]=_0x21f703[_0x8184('0x3f')];_0x57ca59[_0x8184('0x43')]=_0x21f703[_0x8184('0x40')];_0x57ca59[_0x8184('0x42')]=_[_0x8184('0x44')](_0x57ca59['applications'],[_0x8184('0x45')],['asc']);if(_0x57ca59[_0x8184('0x3a')][_0x8184('0x3f')]){delete _0x57ca59['account'][_0x8184('0x3f')];}if(_0x57ca59[_0x8184('0x3a')][_0x8184('0x40')]&&_0x57ca59['account'][_0x8184('0x40')][_0x8184('0x3c')][_0x8184('0x46')]){return _0x57ca59['account'][_0x8184('0x40')]['Contacts'][0x0];}var _0x30ef9c=_[_0x8184('0xe')](_0x2774f3[_0x8184('0x28')],{'firstName':_0x2774f3[_0x8184('0x28')][_0x8184('0x34')],'ListId':_0x21f703['ListId']});_0x30ef9c[_0x2774f3[_0x8184('0x28')][_0x8184('0x37')]]=_0x2774f3[_0x8184('0x28')][_0x8184('0x34')];return db[_0x8184('0x2a')]['create'](_0x30ef9c,{'fields':_0x1d9930,'raw':!![]});}})['then'](function(_0x1aca0f){_0x57ca59[_0x8184('0x47')]=_0x1aca0f;if(_0x1aca0f){var _0x2c4706={'ContactId':_0x1aca0f['id'],'FaxAccountId':_0x2774f3['account']['id'],'fax':_0x1aca0f['fax']};return db[_0x8184('0x48')][_0x8184('0x39')]({'where':{'ContactId':_0x1aca0f['id'],'closed':![],'FaxAccountId':_0x2774f3[_0x8184('0x3a')]['id']}})[_0x8184('0x13')](function(_0x5aae4f){if(_0x5aae4f){return[_0x5aae4f,![]];}return db[_0x8184('0x48')][_0x8184('0x49')](_0x2c4706)[_0x8184('0x13')](function(_0x3f29eb){return[_0x3f29eb,!![]];});});}else{throw new Error(_0x8184('0x4a'));}})['spread'](function(_0xbc698d,_0x510cf5){var _0xe2ef2f=_0xbc698d[_0x8184('0x41')]({'plain':!![]});if(_0x510cf5){if(_0x57ca59[_0x8184('0x3a')][_0x8184('0x4b')]){_0x57ca59['applications'][_0x8184('0x4c')]({'id':0x0,'priority':_0x57ca59['applications'][_0x8184('0x46')]+0x1,'app':'close','appdata':_0x8184('0x4d'),'interval':_0x8184('0x4e')});}_0xe2ef2f['created']=!![];}else{_0xe2ef2f['created']=![];}_0x57ca59[_0x8184('0x4f')]=_0xe2ef2f;return db['FaxMessage'][_0x8184('0x49')]({'body':_0x2774f3['body'][_0x8184('0x28')],'FaxAccountId':_0x2774f3[_0x8184('0x3a')]['id'],'FaxInteractionId':_0xbc698d['id'],'direction':'in','ContactId':_0xbc698d[_0x8184('0x50')],'AttachmentId':_0x2774f3[_0x8184('0x28')]['AttachmentId']});})[_0x8184('0x13')](function(_0x2f54d9){_0x57ca59['message']=_0x2f54d9;if(_0x57ca59['interaction'][_0x8184('0x51')]){return db[_0x8184('0x52')]['find']({'attributes':['id',_0x8184('0x53')],'where':{'id':_0x57ca59[_0x8184('0x4f')][_0x8184('0x51')]}})[_0x8184('0x13')](function(_0x33e8ca){if(_0x33e8ca){_0x57ca59[_0x8184('0x42')][_0x8184('0x54')]({'id':0x0,'priority':0x0,'app':_0x8184('0x55'),'appdata':_0x33e8ca[_0x8184('0x53')]+','+(_0x57ca59['account']['waitForTheAssignedAgent']||0xa),'interval':_0x8184('0x4e')});}return respondWithRpcPromise(_0x8184('0x56'),_0x8184('0x57'),_0x57ca59);});}return respondWithRpcPromise(_0x8184('0x56'),_0x8184('0x57'),_0x57ca59);})[_0x8184('0x13')](function(_0x366281){_0x2c2a78(_0x366281);})[_0x8184('0x26')](function(_0x550545){_0x565f34(_0x30547a[_0x8184('0x19')](0x1f4,_0x550545[_0x8184('0x1b')]));});});}; \ No newline at end of file +var _0xb29f=['register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','include','map','model','attributes','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Contacts','DESC','Applications','applications','list','orderBy','priority','asc','create','contact','FaxInteraction','find','Contact\x20not\x20found','get','autoclose','push','length','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x1c7710,_0x27abe0){var _0x22479b=function(_0x1ae016){while(--_0x1ae016){_0x1c7710['push'](_0x1c7710['shift']());}};_0x22479b(++_0x27abe0);}(_0xb29f,0xfe));var _0xfb29=function(_0x4898eb,_0x23c70d){_0x4898eb=_0x4898eb-0x0;var _0x30536a=_0xb29f[_0x4898eb];return _0x30536a;};'use strict';var _=require(_0xfb29('0x0'));var util=require('util');var moment=require(_0xfb29('0x1'));var BPromise=require(_0xfb29('0x2'));var rs=require(_0xfb29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb29('0x4'))['db'];var utils=require(_0xfb29('0x5'));var logger=require('../../config/logger')(_0xfb29('0x6'));var config=require(_0xfb29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb29('0x8')][_0xfb29('0x9')]({'port':0x232c});config[_0xfb29('0xa')]=_[_0xfb29('0xb')](config['redis'],{'host':_0xfb29('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb29('0xa')]));require('./faxAccount.socket')[_0xfb29('0xd')](socket);function respondWithRpcPromise(_0x5d8de0,_0x5508ec,_0x100e1a){return new BPromise(function(_0x2016ab,_0xd839ff){return client['request'](_0x5d8de0,_0x100e1a)[_0xfb29('0xe')](function(_0x5a023f){logger[_0xfb29('0xf')](_0xfb29('0x10'),_0x5508ec,_0xfb29('0x11'));logger[_0xfb29('0x12')](_0xfb29('0x13'),_0x5508ec,_0xfb29('0x11'),JSON[_0xfb29('0x14')](_0x5a023f));if(_0x5a023f[_0xfb29('0x15')]){if(_0x5a023f[_0xfb29('0x15')][_0xfb29('0x16')]===0x1f4){logger['error'](_0xfb29('0x10'),_0x5508ec,_0x5a023f['error'][_0xfb29('0x17')]);return _0xd839ff(_0x5a023f['error'][_0xfb29('0x17')]);}logger['error'](_0xfb29('0x10'),_0x5508ec,_0x5a023f[_0xfb29('0x15')]['message']);return _0x2016ab(_0x5a023f['error'][_0xfb29('0x17')]);}else{logger[_0xfb29('0xf')](_0xfb29('0x10'),_0x5508ec,_0xfb29('0x11'));_0x2016ab(_0x5a023f[_0xfb29('0x18')]['message']);}})[_0xfb29('0x19')](function(_0x154540){logger[_0xfb29('0x15')](_0xfb29('0x10'),_0x5508ec,_0x154540);_0xd839ff(_0x154540);});});}exports[_0xfb29('0x1a')]=function(_0x542fe7){var _0x1e4425=this;return new Promise(function(_0x4db797,_0x16c65c){return db[_0xfb29('0x1b')][_0xfb29('0x1c')]({'raw':_0x542fe7[_0xfb29('0x1d')]?_0x542fe7[_0xfb29('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x542fe7['options']?_0x542fe7[_0xfb29('0x1d')][_0xfb29('0x1e')]||null:null,'attributes':_0x542fe7['options']?_0x542fe7[_0xfb29('0x1d')]['attributes']||null:null,'limit':_0x542fe7[_0xfb29('0x1d')]?_0x542fe7[_0xfb29('0x1d')]['limit']||null:null,'include':_0x542fe7[_0xfb29('0x1d')]?_0x542fe7[_0xfb29('0x1d')][_0xfb29('0x1f')]?_[_0xfb29('0x20')](_0x542fe7[_0xfb29('0x1d')][_0xfb29('0x1f')],function(_0x271e9d){return{'model':db[_0x271e9d[_0xfb29('0x21')]],'as':_0x271e9d['as'],'attributes':_0x271e9d[_0xfb29('0x22')],'include':_0x271e9d[_0xfb29('0x1f')]?_[_0xfb29('0x20')](_0x271e9d[_0xfb29('0x1f')],function(_0x499b10){return{'model':db[_0x499b10[_0xfb29('0x21')]],'as':_0x499b10['as'],'attributes':_0x499b10[_0xfb29('0x22')],'include':_0x499b10[_0xfb29('0x1f')]?_[_0xfb29('0x20')](_0x499b10['include'],function(_0x58ffbe){return{'model':db[_0x58ffbe[_0xfb29('0x21')]],'as':_0x58ffbe['as'],'attributes':_0x58ffbe['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb29('0xe')](function(_0x1634bc){logger[_0xfb29('0xf')]('GetFaxAccount',_0x542fe7);logger[_0xfb29('0x12')](_0xfb29('0x1a'),_0x542fe7,JSON[_0xfb29('0x14')](_0x1634bc));_0x4db797(_0x1634bc);})[_0xfb29('0x19')](function(_0x30a19f){logger[_0xfb29('0x15')]('GetFaxAccount',_0x30a19f[_0xfb29('0x17')],_0x542fe7);_0x16c65c(_0x1e4425[_0xfb29('0x15')](0x1f4,_0x30a19f[_0xfb29('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x5679d2,_0x3b0826,_0x1d20e1){var _0x5fc11f=this;return new Promise(function(_0x1e88ba,_0x84809c){var _0x3efaf3={'body':_0x5679d2[_0xfb29('0x23')],'channel':_0xfb29('0x24')};var _0x4e1249=[];var _0x1c4d37=[];var _0x1ed352={};return db['CmContact']['describe']()[_0xfb29('0xe')](function(_0x588e5d){if(!_0x588e5d){throw new db[(_0xfb29('0x25'))][(_0xfb29('0x26'))](_0xfb29('0x27'));}_0x4e1249=_[_0xfb29('0x28')](_['keys'](_0x588e5d),[_0xfb29('0x29'),_0xfb29('0x2a')]);_0x1c4d37=_['difference'](_[_0xfb29('0x2b')](_0x588e5d),[_0xfb29('0x29'),_0xfb29('0x2a'),_0xfb29('0x2c'),_0xfb29('0x2d')]);if(_0x5679d2['body']['id']){delete _0x5679d2[_0xfb29('0x23')]['id'];}if(_[_0xfb29('0x2e')](_0x5679d2[_0xfb29('0x23')][_0xfb29('0x2f')])){throw new db[(_0xfb29('0x25'))][(_0xfb29('0x26'))](_0xfb29('0x30'));}if(_[_0xfb29('0x2e')](_0x5679d2[_0xfb29('0x23')]['body'])||_0x5679d2['body']['body']===''){throw new db[(_0xfb29('0x25'))][(_0xfb29('0x26'))](_0xfb29('0x31'));}if(_[_0xfb29('0x2e')](_0x5679d2[_0xfb29('0x23')]['mapKey'])){throw new db[(_0xfb29('0x25'))][(_0xfb29('0x26'))](_0xfb29('0x32')+_0x1c4d37);}if(!_[_0xfb29('0x33')](_0x1c4d37,_0x5679d2['body'][_0xfb29('0x34')])){throw new db['Sequelize'][(_0xfb29('0x26'))](_0xfb29('0x35')+_0x1c4d37);}_0x1ed352[_0x5679d2['body'][_0xfb29('0x34')]]=_0x5679d2[_0xfb29('0x23')]['from'];})[_0xfb29('0xe')](function(){return db['FaxAccount']['find']({'where':{'id':_0x5679d2[_0xfb29('0x36')]['id']},'include':[{'model':db[_0xfb29('0x37')],'as':_0xfb29('0x38'),'include':[{'model':db[_0xfb29('0x39')],'as':_0xfb29('0x3a'),'where':_0x1ed352,'limit':0x1,'order':[[_0xfb29('0x2a'),_0xfb29('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0xfb29('0x3c')}]});})[_0xfb29('0xe')](function(_0x5804ae){if(_0x5804ae&&_0x5804ae[_0xfb29('0x38')]){var _0x5a5307=_0x5804ae['get']({'plain':!![]});_0x3efaf3[_0xfb29('0x36')]=_0x5a5307;_0x3efaf3[_0xfb29('0x3d')]=_0x5a5307[_0xfb29('0x3c')];_0x3efaf3[_0xfb29('0x3e')]=_0x5a5307[_0xfb29('0x38')];_0x3efaf3['applications']=_[_0xfb29('0x3f')](_0x3efaf3[_0xfb29('0x3d')],[_0xfb29('0x40')],[_0xfb29('0x41')]);if(_0x3efaf3[_0xfb29('0x36')][_0xfb29('0x3c')]){delete _0x3efaf3['account']['Applications'];}if(_0x3efaf3[_0xfb29('0x36')]['List']&&_0x3efaf3['account'][_0xfb29('0x38')][_0xfb29('0x3a')]['length']){return _0x3efaf3[_0xfb29('0x36')][_0xfb29('0x38')][_0xfb29('0x3a')][0x0];}var _0x22f395=_[_0xfb29('0xb')](_0x5679d2[_0xfb29('0x23')],{'firstName':_0x5679d2[_0xfb29('0x23')][_0xfb29('0x2f')],'ListId':_0x5a5307[_0xfb29('0x2d')]});_0x22f395[_0x5679d2[_0xfb29('0x23')][_0xfb29('0x34')]]=_0x5679d2[_0xfb29('0x23')][_0xfb29('0x2f')];return db['CmContact'][_0xfb29('0x42')](_0x22f395,{'fields':_0x4e1249,'raw':!![]});}})['then'](function(_0x281d46){_0x3efaf3[_0xfb29('0x43')]=_0x281d46;if(_0x281d46){var _0x2a0221={'ContactId':_0x281d46['id'],'FaxAccountId':_0x5679d2[_0xfb29('0x36')]['id'],'fax':_0x281d46[_0xfb29('0x24')]};return db[_0xfb29('0x44')][_0xfb29('0x45')]({'where':{'ContactId':_0x281d46['id'],'closed':![],'FaxAccountId':_0x5679d2[_0xfb29('0x36')]['id']}})[_0xfb29('0xe')](function(_0x479b5e){if(_0x479b5e){return[_0x479b5e,![]];}return db[_0xfb29('0x44')][_0xfb29('0x42')](_0x2a0221)['then'](function(_0x415cd0){return[_0x415cd0,!![]];});});}else{throw new Error(_0xfb29('0x46'));}})['spread'](function(_0x2b4fad,_0x47966f){var _0x3c601c=_0x2b4fad[_0xfb29('0x47')]({'plain':!![]});if(_0x47966f){if(_0x3efaf3[_0xfb29('0x36')][_0xfb29('0x48')]){_0x3efaf3[_0xfb29('0x3d')][_0xfb29('0x49')]({'id':0x0,'priority':_0x3efaf3['applications'][_0xfb29('0x4a')]+0x1,'app':_0xfb29('0x4b'),'appdata':_0xfb29('0x4c'),'interval':_0xfb29('0x4d')});}_0x3c601c[_0xfb29('0x4e')]=!![];}else{_0x3c601c[_0xfb29('0x4e')]=![];}_0x3efaf3['interaction']=_0x3c601c;return db['FaxMessage'][_0xfb29('0x42')]({'body':_0x5679d2['body'][_0xfb29('0x23')],'FaxAccountId':_0x5679d2[_0xfb29('0x36')]['id'],'FaxInteractionId':_0x2b4fad['id'],'direction':'in','ContactId':_0x2b4fad[_0xfb29('0x4f')],'AttachmentId':_0x5679d2['body'][_0xfb29('0x50')]});})[_0xfb29('0xe')](function(_0x2990ee){_0x3efaf3[_0xfb29('0x17')]=_0x2990ee;if(_0x3efaf3['interaction'][_0xfb29('0x51')]){return db[_0xfb29('0x52')][_0xfb29('0x45')]({'attributes':['id',_0xfb29('0x53')],'where':{'id':_0x3efaf3['interaction'][_0xfb29('0x51')]}})[_0xfb29('0xe')](function(_0x293e0c){if(_0x293e0c){_0x3efaf3[_0xfb29('0x3d')][_0xfb29('0x54')]({'id':0x0,'priority':0x0,'app':_0xfb29('0x55'),'appdata':_0x293e0c[_0xfb29('0x53')]+','+(_0x3efaf3['account'][_0xfb29('0x56')]||0xa),'interval':_0xfb29('0x4d')});}return respondWithRpcPromise(_0xfb29('0x57'),_0xfb29('0x58'),_0x3efaf3);});}return respondWithRpcPromise(_0xfb29('0x57'),_0xfb29('0x58'),_0x3efaf3);})['then'](function(_0x5a4cf4){_0x1e88ba(_0x5a4cf4);})[_0xfb29('0x19')](function(_0x412d9c){_0x84809c(_0x5fc11f['error'](0x1f4,_0x412d9c[_0xfb29('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3b33008..8b054d4 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 _0x4233=['./faxAccount.events','save','remove','update','removeListener','faxAccount:'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x4233,0x162));var _0x3423=function(_0x4441be,_0x2aa433){_0x4441be=_0x4441be-0x0;var _0x5dfe7d=_0x4233[_0x4441be];return _0x5dfe7d;};'use strict';var FaxAccountEvents=require(_0x3423('0x0'));var events=[_0x3423('0x1'),_0x3423('0x2'),_0x3423('0x3')];function createListener(_0x21ccb3,_0x319d90){return function(_0x380e5a){_0x319d90['emit'](_0x21ccb3,_0x380e5a);};}function removeListener(_0x8a9b3a,_0x338f58){return function(){FaxAccountEvents[_0x3423('0x4')](_0x8a9b3a,_0x338f58);};}exports['register']=function(_0x3282c5){for(var _0x5813b4=0x0,_0x5e2690=events['length'];_0x5813b4<_0x5e2690;_0x5813b4++){var _0x156628=events[_0x5813b4];var _0x2c9985=createListener(_0x3423('0x5')+_0x156628,_0x3282c5);FaxAccountEvents['on'](_0x156628,_0x2c9985);}}; \ No newline at end of file +var _0x017e=['removeListener','register','length','faxAccount:','./faxAccount.events','remove','update'];(function(_0x204424,_0x263415){var _0x2ded71=function(_0x1bbc1e){while(--_0x1bbc1e){_0x204424['push'](_0x204424['shift']());}};_0x2ded71(++_0x263415);}(_0x017e,0x162));var _0xe017=function(_0x6465b0,_0x45653a){_0x6465b0=_0x6465b0-0x0;var _0x4884fe=_0x017e[_0x6465b0];return _0x4884fe;};'use strict';var FaxAccountEvents=require(_0xe017('0x0'));var events=['save',_0xe017('0x1'),_0xe017('0x2')];function createListener(_0x2c4870,_0x32f30b){return function(_0x209103){_0x32f30b['emit'](_0x2c4870,_0x209103);};}function removeListener(_0x27bfd9,_0x55e6d2){return function(){FaxAccountEvents[_0xe017('0x3')](_0x27bfd9,_0x55e6d2);};}exports[_0xe017('0x4')]=function(_0x5d29d7){for(var _0xe71f83=0x0,_0x1f8a1b=events[_0xe017('0x5')];_0xe71f83<_0x1f8a1b;_0xe71f83++){var _0x9a74b7=events[_0xe71f83];var _0x37cc67=createListener(_0xe017('0x6')+_0x9a74b7,_0x5d29d7);FaxAccountEvents['on'](_0x9a74b7,_0x37cc67);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7e2cce8..804064e 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2c0edf,_0x13e8d2){var _0x20bb56=function(_0x3530ca){while(--_0x3530ca){_0x2c0edf['push'](_0x2c0edf['shift']());}};_0x20bb56(++_0x13e8d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x24f4e9,_0x630d52){var _0xe613a9=function(_0x4004a0){while(--_0x4004a0){_0x24f4e9['push'](_0x24f4e9['shift']());}};_0xe613a9(++_0x630d52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 51799a9..190e0f9 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 _0xec9e=['noop','exports','STRING'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0xec9e,0x109));var _0xeec9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec9e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xeec9('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeec9('0x1')],'allowNull':![],'defaultValue':_0xeec9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xeec9('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x53de=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x53de,0x13e));var _0xe53d=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x53de[_0xa4f636];return _0x37e02a;};'use strict';var Sequelize=require(_0xe53d('0x0'));module[_0xe53d('0x1')]={'priority':{'type':Sequelize[_0xe53d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe53d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe53d('0x4')]()},'description':{'type':Sequelize[_0xe53d('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe53d('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 799da16..77d55f4 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 _0xabf9=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','pick','where','merge','map','VIRTUAL','options','includeAll','include','findAll','show','length','find','catch','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xabf9,0x11a));var _0x9abf=function(_0x489dd1,_0x3d4564){_0x489dd1=_0x489dd1-0x0;var _0x292b0f=_0xabf9[_0x489dd1];return _0x292b0f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9abf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9abf('0x1'));var moment=require(_0x9abf('0x2'));var BPromise=require(_0x9abf('0x3'));var Mustache=require(_0x9abf('0x4'));var util=require('util');var path=require(_0x9abf('0x5'));var sox=require('sox');var csv=require(_0x9abf('0x6'));var ejs=require(_0x9abf('0x7'));var fs=require('fs');var fs_extra=require(_0x9abf('0x8'));var _=require(_0x9abf('0x9'));var squel=require('squel');var crypto=require(_0x9abf('0xa'));var jsforce=require(_0x9abf('0xb'));var deskjs=require(_0x9abf('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9abf('0xd'));var Redis=require(_0x9abf('0xe'));var authService=require(_0x9abf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9abf('0x10'));var logger=require(_0x9abf('0x11'))(_0x9abf('0x12'));var utils=require(_0x9abf('0x13'));var config=require(_0x9abf('0x14'));var licenseUtil=require(_0x9abf('0x15'));var db=require(_0x9abf('0x16'))['db'];function respondWithStatusCode(_0x3d159b,_0xba7c6d){_0xba7c6d=_0xba7c6d||0xcc;return function(_0x4048d9){if(_0x4048d9){return _0x3d159b[_0x9abf('0x17')](_0xba7c6d);}return _0x3d159b[_0x9abf('0x18')](_0xba7c6d)[_0x9abf('0x19')]();};}function respondWithResult(_0xc470ae,_0x53c016){_0x53c016=_0x53c016||0xc8;return function(_0x1eeed4){if(_0x1eeed4){return _0xc470ae[_0x9abf('0x18')](_0x53c016)['json'](_0x1eeed4);}};}function respondWithFilteredResult(_0x217eaa,_0x24c502){return function(_0x5e2d7c){if(_0x5e2d7c){var _0x28833b=typeof _0x24c502['offset']==='undefined'&&typeof _0x24c502['limit']==='undefined';var _0x359211=_0x5e2d7c[_0x9abf('0x1a')];var _0x15c331=_0x28833b?0x0:_0x24c502[_0x9abf('0x1b')];var _0xddf0d9=_0x28833b?_0x5e2d7c[_0x9abf('0x1a')]:_0x24c502[_0x9abf('0x1b')]+_0x24c502[_0x9abf('0x1c')];var _0x1cbcd7;if(_0xddf0d9>=_0x359211){_0xddf0d9=_0x359211;_0x1cbcd7=0xc8;}else{_0x1cbcd7=0xce;}_0x217eaa['status'](_0x1cbcd7);return _0x217eaa[_0x9abf('0x1d')](_0x9abf('0x1e'),_0x15c331+'-'+_0xddf0d9+'/'+_0x359211)[_0x9abf('0x1f')](_0x5e2d7c);}return null;};}function patchUpdates(_0x1c342e){return function(_0x15ab72){try{jsonpatch['apply'](_0x15ab72,_0x1c342e,!![]);}catch(_0x4b71af){return BPromise[_0x9abf('0x20')](_0x4b71af);}return _0x15ab72[_0x9abf('0x21')]();};}function saveUpdates(_0x2b0a7a,_0x35f751){return function(_0x13eb57){if(_0x13eb57){return _0x13eb57[_0x9abf('0x22')](_0x2b0a7a)[_0x9abf('0x23')](function(_0x16774d){return _0x16774d;});}return null;};}function removeEntity(_0x2890d6,_0x50a3eb){return function(_0x4f92e5){if(_0x4f92e5){return _0x4f92e5[_0x9abf('0x24')]()[_0x9abf('0x23')](function(){_0x2890d6[_0x9abf('0x18')](0xcc)[_0x9abf('0x19')]();});}};}function handleEntityNotFound(_0x57a5be,_0x18c52a){return function(_0x5666aa){if(!_0x5666aa){_0x57a5be[_0x9abf('0x17')](0x194);}return _0x5666aa;};}function handleError(_0xf72b48,_0x32f1fb){_0x32f1fb=_0x32f1fb||0x1f4;return function(_0x25f942){logger[_0x9abf('0x25')](_0x25f942[_0x9abf('0x26')]);if(_0x25f942[_0x9abf('0x27')]){delete _0x25f942[_0x9abf('0x27')];}_0xf72b48[_0x9abf('0x18')](_0x32f1fb)[_0x9abf('0x28')](_0x25f942);};}exports[_0x9abf('0x29')]=function(_0x5e67da,_0xafbb63){var _0x2a5213={},_0x2b855c={},_0xd6b5e6={'count':0x0,'rows':[]};var _0x25aaea=_['map'](db[_0x9abf('0x2a')][_0x9abf('0x2b')],function(_0x3e94e3){return{'name':_0x3e94e3[_0x9abf('0x2c')],'type':_0x3e94e3[_0x9abf('0x2d')][_0x9abf('0x2e')]};});_0x2b855c['model']=_['map'](_0x25aaea,_0x9abf('0x27'));_0x2b855c['query']=_[_0x9abf('0x2f')](_0x5e67da['query']);_0x2b855c[_0x9abf('0x30')]=_[_0x9abf('0x31')](_0x2b855c[_0x9abf('0x32')],_0x2b855c[_0x9abf('0x33')]);_0x2a5213[_0x9abf('0x34')]=_[_0x9abf('0x31')](_0x2b855c['model'],qs[_0x9abf('0x35')](_0x5e67da[_0x9abf('0x33')][_0x9abf('0x35')]));_0x2a5213[_0x9abf('0x34')]=_0x2a5213[_0x9abf('0x34')]['length']?_0x2a5213[_0x9abf('0x34')]:_0x2b855c[_0x9abf('0x32')];if(!_0x5e67da[_0x9abf('0x33')][_0x9abf('0x36')](_0x9abf('0x37'))){_0x2a5213[_0x9abf('0x1c')]=qs[_0x9abf('0x1c')](_0x5e67da[_0x9abf('0x33')][_0x9abf('0x1c')]);_0x2a5213[_0x9abf('0x1b')]=qs['offset'](_0x5e67da[_0x9abf('0x33')]['offset']);}_0x2a5213[_0x9abf('0x38')]=qs['sort'](_0x5e67da[_0x9abf('0x33')]['sort']);_0x2a5213['where']=qs[_0x9abf('0x30')](_[_0x9abf('0x39')](_0x5e67da[_0x9abf('0x33')],_0x2b855c[_0x9abf('0x30')]),_0x25aaea);if(_0x5e67da[_0x9abf('0x33')]['filter']){_0x2a5213[_0x9abf('0x3a')]=_[_0x9abf('0x3b')](_0x2a5213[_0x9abf('0x3a')],{'$or':_[_0x9abf('0x3c')](_0x25aaea,function(_0x4f2e62){if(_0x4f2e62[_0x9abf('0x2d')]!==_0x9abf('0x3d')){var _0x1dd786={};_0x1dd786[_0x4f2e62['name']]={'$like':'%'+_0x5e67da[_0x9abf('0x33')]['filter']+'%'};return _0x1dd786;}})});}_0x2a5213=_[_0x9abf('0x3b')]({},_0x2a5213,_0x5e67da[_0x9abf('0x3e')]);var _0x169b0a={'where':_0x2a5213[_0x9abf('0x3a')]};return db['FaxApplication'][_0x9abf('0x1a')](_0x169b0a)[_0x9abf('0x23')](function(_0x321347){_0xd6b5e6[_0x9abf('0x1a')]=_0x321347;if(_0x5e67da[_0x9abf('0x33')][_0x9abf('0x3f')]){_0x2a5213[_0x9abf('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x9abf('0x41')](_0x2a5213);})[_0x9abf('0x23')](function(_0x243937){_0xd6b5e6['rows']=_0x243937;return _0xd6b5e6;})[_0x9abf('0x23')](respondWithFilteredResult(_0xafbb63,_0x2a5213))['catch'](handleError(_0xafbb63,null));};exports[_0x9abf('0x42')]=function(_0x54e5e6,_0x388350){var _0x477d88={'raw':!![],'where':{'id':_0x54e5e6['params']['id']}},_0x246f9d={};_0x246f9d[_0x9abf('0x32')]=_[_0x9abf('0x2f')](db[_0x9abf('0x2a')][_0x9abf('0x2b')]);_0x246f9d[_0x9abf('0x33')]=_[_0x9abf('0x2f')](_0x54e5e6[_0x9abf('0x33')]);_0x246f9d[_0x9abf('0x30')]=_[_0x9abf('0x31')](_0x246f9d['model'],_0x246f9d['query']);_0x477d88[_0x9abf('0x34')]=_['intersection'](_0x246f9d[_0x9abf('0x32')],qs[_0x9abf('0x35')](_0x54e5e6['query']['fields']));_0x477d88[_0x9abf('0x34')]=_0x477d88[_0x9abf('0x34')][_0x9abf('0x43')]?_0x477d88[_0x9abf('0x34')]:_0x246f9d[_0x9abf('0x32')];if(_0x54e5e6[_0x9abf('0x33')][_0x9abf('0x3f')]){_0x477d88[_0x9abf('0x40')]=[{'all':!![]}];}_0x477d88=_[_0x9abf('0x3b')]({},_0x477d88,_0x54e5e6[_0x9abf('0x3e')]);return db[_0x9abf('0x2a')][_0x9abf('0x44')](_0x477d88)[_0x9abf('0x23')](handleEntityNotFound(_0x388350,null))[_0x9abf('0x23')](respondWithResult(_0x388350,null))[_0x9abf('0x45')](handleError(_0x388350,null));};exports[_0x9abf('0x46')]=function(_0x57c57d,_0x3ff4cb){return db[_0x9abf('0x2a')][_0x9abf('0x46')](_0x57c57d['body'],{})['then'](respondWithResult(_0x3ff4cb,0xc9))[_0x9abf('0x45')](handleError(_0x3ff4cb,null));};exports[_0x9abf('0x22')]=function(_0x3696ae,_0x75f7b4){if(_0x3696ae[_0x9abf('0x47')]['id']){delete _0x3696ae['body']['id'];}return db[_0x9abf('0x2a')][_0x9abf('0x44')]({'where':{'id':_0x3696ae['params']['id']}})[_0x9abf('0x23')](handleEntityNotFound(_0x75f7b4,null))[_0x9abf('0x23')](saveUpdates(_0x3696ae[_0x9abf('0x47')],null))['then'](respondWithResult(_0x75f7b4,null))[_0x9abf('0x45')](handleError(_0x75f7b4,null));};exports['destroy']=function(_0x1c0f2c,_0x46d393){return db['FaxApplication'][_0x9abf('0x44')]({'where':{'id':_0x1c0f2c[_0x9abf('0x48')]['id']}})[_0x9abf('0x23')](handleEntityNotFound(_0x46d393,null))[_0x9abf('0x23')](removeEntity(_0x46d393,null))['catch'](handleError(_0x46d393,null));}; \ No newline at end of file +var _0xf7f3=['../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','index','map','FaxApplication','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x26bba7,_0x5a59d9){var _0x4a50d9=function(_0x3c3a08){while(--_0x3c3a08){_0x26bba7['push'](_0x26bba7['shift']());}};_0x4a50d9(++_0x5a59d9);}(_0xf7f3,0x19e));var _0x3f7f=function(_0x30a722,_0x19e000){_0x30a722=_0x30a722-0x0;var _0x109700=_0xf7f3[_0x30a722];return _0x109700;};'use strict';var emlformat=require(_0x3f7f('0x0'));var rimraf=require(_0x3f7f('0x1'));var zipdir=require(_0x3f7f('0x2'));var jsonpatch=require(_0x3f7f('0x3'));var rp=require('request-promise');var moment=require(_0x3f7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f7f('0x5'));var util=require(_0x3f7f('0x6'));var path=require('path');var sox=require(_0x3f7f('0x7'));var csv=require(_0x3f7f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f7f('0x9'));var _=require(_0x3f7f('0xa'));var squel=require(_0x3f7f('0xb'));var crypto=require(_0x3f7f('0xc'));var jsforce=require(_0x3f7f('0xd'));var deskjs=require(_0x3f7f('0xe'));var toCsv=require(_0x3f7f('0x8'));var querystring=require(_0x3f7f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3f7f('0x10'));var qs=require(_0x3f7f('0x11'));var as=require(_0x3f7f('0x12'));var hardwareService=require(_0x3f7f('0x13'));var logger=require(_0x3f7f('0x14'))('api');var utils=require(_0x3f7f('0x15'));var config=require(_0x3f7f('0x16'));var licenseUtil=require(_0x3f7f('0x17'));var db=require(_0x3f7f('0x18'))['db'];function respondWithStatusCode(_0x306483,_0x552271){_0x552271=_0x552271||0xcc;return function(_0x41251a){if(_0x41251a){return _0x306483['sendStatus'](_0x552271);}return _0x306483[_0x3f7f('0x19')](_0x552271)[_0x3f7f('0x1a')]();};}function respondWithResult(_0x5ccf6a,_0x4d9796){_0x4d9796=_0x4d9796||0xc8;return function(_0x515893){if(_0x515893){return _0x5ccf6a[_0x3f7f('0x19')](_0x4d9796)[_0x3f7f('0x1b')](_0x515893);}};}function respondWithFilteredResult(_0x291746,_0x58f3b2){return function(_0x2e3a5a){if(_0x2e3a5a){var _0x508de7=typeof _0x58f3b2[_0x3f7f('0x1c')]===_0x3f7f('0x1d')&&typeof _0x58f3b2[_0x3f7f('0x1e')]===_0x3f7f('0x1d');var _0x57b7e3=_0x2e3a5a[_0x3f7f('0x1f')];var _0x1163b5=_0x508de7?0x0:_0x58f3b2[_0x3f7f('0x1c')];var _0xd9fd4a=_0x508de7?_0x2e3a5a[_0x3f7f('0x1f')]:_0x58f3b2[_0x3f7f('0x1c')]+_0x58f3b2[_0x3f7f('0x1e')];var _0x4bb124;if(_0xd9fd4a>=_0x57b7e3){_0xd9fd4a=_0x57b7e3;_0x4bb124=0xc8;}else{_0x4bb124=0xce;}_0x291746[_0x3f7f('0x19')](_0x4bb124);return _0x291746[_0x3f7f('0x20')](_0x3f7f('0x21'),_0x1163b5+'-'+_0xd9fd4a+'/'+_0x57b7e3)[_0x3f7f('0x1b')](_0x2e3a5a);}return null;};}function patchUpdates(_0x53fa85){return function(_0x3ccf61){try{jsonpatch[_0x3f7f('0x22')](_0x3ccf61,_0x53fa85,!![]);}catch(_0x23b610){return BPromise['reject'](_0x23b610);}return _0x3ccf61['save']();};}function saveUpdates(_0x55a18c,_0x3a58b2){return function(_0x2ebc38){if(_0x2ebc38){return _0x2ebc38[_0x3f7f('0x23')](_0x55a18c)[_0x3f7f('0x24')](function(_0xa66f39){return _0xa66f39;});}return null;};}function removeEntity(_0x5b2f0d,_0x8da2d){return function(_0x302636){if(_0x302636){return _0x302636['destroy']()[_0x3f7f('0x24')](function(){_0x5b2f0d[_0x3f7f('0x19')](0xcc)[_0x3f7f('0x1a')]();});}};}function handleEntityNotFound(_0x12ad27,_0x3cf7f2){return function(_0x1b1697){if(!_0x1b1697){_0x12ad27['sendStatus'](0x194);}return _0x1b1697;};}function handleError(_0x413c5b,_0x4ed5ab){_0x4ed5ab=_0x4ed5ab||0x1f4;return function(_0x182f71){logger[_0x3f7f('0x25')](_0x182f71[_0x3f7f('0x26')]);if(_0x182f71[_0x3f7f('0x27')]){delete _0x182f71[_0x3f7f('0x27')];}_0x413c5b['status'](_0x4ed5ab)['send'](_0x182f71);};}exports[_0x3f7f('0x28')]=function(_0x43b786,_0x18ab07){var _0xefecb7={},_0x3ad8f2={},_0x10acb7={'count':0x0,'rows':[]};var _0xb23c9b=_[_0x3f7f('0x29')](db[_0x3f7f('0x2a')]['rawAttributes'],function(_0x406ad3){return{'name':_0x406ad3[_0x3f7f('0x2b')],'type':_0x406ad3[_0x3f7f('0x2c')]['key']};});_0x3ad8f2[_0x3f7f('0x2d')]=_['map'](_0xb23c9b,_0x3f7f('0x27'));_0x3ad8f2['query']=_[_0x3f7f('0x2e')](_0x43b786[_0x3f7f('0x2f')]);_0x3ad8f2['filters']=_['intersection'](_0x3ad8f2[_0x3f7f('0x2d')],_0x3ad8f2[_0x3f7f('0x2f')]);_0xefecb7[_0x3f7f('0x30')]=_[_0x3f7f('0x31')](_0x3ad8f2[_0x3f7f('0x2d')],qs[_0x3f7f('0x32')](_0x43b786[_0x3f7f('0x2f')][_0x3f7f('0x32')]));_0xefecb7[_0x3f7f('0x30')]=_0xefecb7[_0x3f7f('0x30')][_0x3f7f('0x33')]?_0xefecb7[_0x3f7f('0x30')]:_0x3ad8f2[_0x3f7f('0x2d')];if(!_0x43b786[_0x3f7f('0x2f')][_0x3f7f('0x34')](_0x3f7f('0x35'))){_0xefecb7[_0x3f7f('0x1e')]=qs[_0x3f7f('0x1e')](_0x43b786[_0x3f7f('0x2f')]['limit']);_0xefecb7[_0x3f7f('0x1c')]=qs[_0x3f7f('0x1c')](_0x43b786[_0x3f7f('0x2f')][_0x3f7f('0x1c')]);}_0xefecb7[_0x3f7f('0x36')]=qs[_0x3f7f('0x37')](_0x43b786['query'][_0x3f7f('0x37')]);_0xefecb7[_0x3f7f('0x38')]=qs[_0x3f7f('0x39')](_[_0x3f7f('0x3a')](_0x43b786[_0x3f7f('0x2f')],_0x3ad8f2['filters']),_0xb23c9b);if(_0x43b786[_0x3f7f('0x2f')][_0x3f7f('0x3b')]){_0xefecb7[_0x3f7f('0x38')]=_[_0x3f7f('0x3c')](_0xefecb7['where'],{'$or':_[_0x3f7f('0x29')](_0xb23c9b,function(_0x41bb07){if(_0x41bb07[_0x3f7f('0x2c')]!==_0x3f7f('0x3d')){var _0x45fa7a={};_0x45fa7a[_0x41bb07[_0x3f7f('0x27')]]={'$like':'%'+_0x43b786[_0x3f7f('0x2f')][_0x3f7f('0x3b')]+'%'};return _0x45fa7a;}})});}_0xefecb7=_[_0x3f7f('0x3c')]({},_0xefecb7,_0x43b786[_0x3f7f('0x3e')]);var _0x3b53e6={'where':_0xefecb7[_0x3f7f('0x38')]};return db[_0x3f7f('0x2a')][_0x3f7f('0x1f')](_0x3b53e6)[_0x3f7f('0x24')](function(_0x3973c2){_0x10acb7['count']=_0x3973c2;if(_0x43b786[_0x3f7f('0x2f')][_0x3f7f('0x3f')]){_0xefecb7[_0x3f7f('0x40')]=[{'all':!![]}];}return db[_0x3f7f('0x2a')][_0x3f7f('0x41')](_0xefecb7);})['then'](function(_0x57b8ee){_0x10acb7[_0x3f7f('0x42')]=_0x57b8ee;return _0x10acb7;})[_0x3f7f('0x24')](respondWithFilteredResult(_0x18ab07,_0xefecb7))[_0x3f7f('0x43')](handleError(_0x18ab07,null));};exports[_0x3f7f('0x44')]=function(_0x5e1ad5,_0x1fc377){var _0x304804={'raw':!![],'where':{'id':_0x5e1ad5['params']['id']}},_0xcffa5a={};_0xcffa5a['model']=_[_0x3f7f('0x2e')](db[_0x3f7f('0x2a')][_0x3f7f('0x45')]);_0xcffa5a[_0x3f7f('0x2f')]=_[_0x3f7f('0x2e')](_0x5e1ad5[_0x3f7f('0x2f')]);_0xcffa5a[_0x3f7f('0x39')]=_[_0x3f7f('0x31')](_0xcffa5a[_0x3f7f('0x2d')],_0xcffa5a[_0x3f7f('0x2f')]);_0x304804[_0x3f7f('0x30')]=_['intersection'](_0xcffa5a[_0x3f7f('0x2d')],qs[_0x3f7f('0x32')](_0x5e1ad5['query'][_0x3f7f('0x32')]));_0x304804[_0x3f7f('0x30')]=_0x304804[_0x3f7f('0x30')][_0x3f7f('0x33')]?_0x304804[_0x3f7f('0x30')]:_0xcffa5a['model'];if(_0x5e1ad5[_0x3f7f('0x2f')]['includeAll']){_0x304804[_0x3f7f('0x40')]=[{'all':!![]}];}_0x304804=_[_0x3f7f('0x3c')]({},_0x304804,_0x5e1ad5[_0x3f7f('0x3e')]);return db['FaxApplication'][_0x3f7f('0x46')](_0x304804)[_0x3f7f('0x24')](handleEntityNotFound(_0x1fc377,null))['then'](respondWithResult(_0x1fc377,null))[_0x3f7f('0x43')](handleError(_0x1fc377,null));};exports['create']=function(_0x369aa7,_0x4f9df9){return db[_0x3f7f('0x2a')][_0x3f7f('0x47')](_0x369aa7[_0x3f7f('0x48')],{})[_0x3f7f('0x24')](respondWithResult(_0x4f9df9,0xc9))[_0x3f7f('0x43')](handleError(_0x4f9df9,null));};exports[_0x3f7f('0x23')]=function(_0x574956,_0x580356){if(_0x574956[_0x3f7f('0x48')]['id']){delete _0x574956[_0x3f7f('0x48')]['id'];}return db[_0x3f7f('0x2a')][_0x3f7f('0x46')]({'where':{'id':_0x574956['params']['id']}})[_0x3f7f('0x24')](handleEntityNotFound(_0x580356,null))[_0x3f7f('0x24')](saveUpdates(_0x574956[_0x3f7f('0x48')],null))[_0x3f7f('0x24')](respondWithResult(_0x580356,null))[_0x3f7f('0x43')](handleError(_0x580356,null));};exports['destroy']=function(_0x14fadd,_0x1e7378){return db[_0x3f7f('0x2a')][_0x3f7f('0x46')]({'where':{'id':_0x14fadd['params']['id']}})[_0x3f7f('0x24')](handleEntityNotFound(_0x1e7378,null))['then'](removeEntity(_0x1e7378,null))[_0x3f7f('0x43')](handleError(_0x1e7378,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b559849..afc7ff7 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 _0x5281=['rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5281,0x125));var _0x1528=function(_0x2cd485,_0x5d348c){_0x2cd485=_0x2cd485-0x0;var _0xe9612c=_0x5281[_0x2cd485];return _0xe9612c;};'use strict';var _=require(_0x1528('0x0'));var util=require('util');var logger=require(_0x1528('0x1'))(_0x1528('0x2'));var moment=require(_0x1528('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1528('0x4'));var config=require(_0x1528('0x5'));var attributes=require(_0x1528('0x6'));module['exports']=function(_0x3807bb,_0x26d83c){return _0x3807bb[_0x1528('0x7')](_0x1528('0x8'),attributes,{'tableName':_0x1528('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1528('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9798=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9798,0x177));var _0x8979=function(_0x34c3f4,_0x559761){_0x34c3f4=_0x34c3f4-0x0;var _0x137938=_0x9798[_0x34c3f4];return _0x137938;};'use strict';var _=require(_0x8979('0x0'));var util=require(_0x8979('0x1'));var logger=require(_0x8979('0x2'))(_0x8979('0x3'));var moment=require('moment');var BPromise=require(_0x8979('0x4'));var rp=require(_0x8979('0x5'));var fs=require('fs');var path=require(_0x8979('0x6'));var rimraf=require(_0x8979('0x7'));var config=require(_0x8979('0x8'));var attributes=require('./faxApplication.attributes');module[_0x8979('0x9')]=function(_0x1ef17c,_0x4aed46){return _0x1ef17c[_0x8979('0xa')](_0x8979('0xb'),attributes,{'tableName':_0x8979('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8979('0xd'),'collate':_0x8979('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ac766a3..2e13686 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 _0x4873=['error','code','message','FaxApplication,\x20%s,\x20%s','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x2cbfe5,_0x1fb99b){var _0x3f69ad=function(_0x10b7c6){while(--_0x10b7c6){_0x2cbfe5['push'](_0x2cbfe5['shift']());}};_0x3f69ad(++_0x1fb99b);}(_0x4873,0x1df));var _0x3487=function(_0x55407c,_0x27ed95){_0x55407c=_0x55407c-0x0;var _0xacfd16=_0x4873[_0x55407c];return _0xacfd16;};'use strict';var _=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var moment=require(_0x3487('0x2'));var BPromise=require('bluebird');var rs=require(_0x3487('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3487('0x4'));var logger=require(_0x3487('0x5'))(_0x3487('0x6'));var config=require(_0x3487('0x7'));var jayson=require(_0x3487('0x8'));var client=jayson[_0x3487('0x9')][_0x3487('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193589,_0x4a2407,_0x1d4cae){return new BPromise(function(_0x3df081,_0x1d0487){return client[_0x3487('0xb')](_0x193589,_0x1d4cae)[_0x3487('0xc')](function(_0x5a50e8){logger[_0x3487('0xd')]('FaxApplication,\x20%s,\x20%s',_0x4a2407,_0x3487('0xe'));logger[_0x3487('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4a2407,'request\x20sent',JSON[_0x3487('0x10')](_0x5a50e8));if(_0x5a50e8[_0x3487('0x11')]){if(_0x5a50e8['error'][_0x3487('0x12')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4a2407,_0x5a50e8[_0x3487('0x11')][_0x3487('0x13')]);return _0x1d0487(_0x5a50e8[_0x3487('0x11')][_0x3487('0x13')]);}logger[_0x3487('0x11')](_0x3487('0x14'),_0x4a2407,_0x5a50e8['error'][_0x3487('0x13')]);return _0x3df081(_0x5a50e8[_0x3487('0x11')][_0x3487('0x13')]);}else{logger['info'](_0x3487('0x14'),_0x4a2407,_0x3487('0xe'));_0x3df081(_0x5a50e8[_0x3487('0x15')][_0x3487('0x13')]);}})[_0x3487('0x16')](function(_0x21809c){logger[_0x3487('0x11')](_0x3487('0x14'),_0x4a2407,_0x21809c);_0x1d0487(_0x21809c);});});}exports[_0x3487('0x17')]=function(_0x2fa630){var _0x3576ca=this;return new Promise(function(_0x41795b,_0xd56d94){return db[_0x3487('0x18')]['update'](_0x2fa630[_0x3487('0x19')],{'raw':_0x2fa630['options']?_0x2fa630[_0x3487('0x1a')][_0x3487('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fa630[_0x3487('0x1a')]?_0x2fa630[_0x3487('0x1a')][_0x3487('0x1c')]||null:null,'attributes':_0x2fa630[_0x3487('0x1a')]?_0x2fa630['options'][_0x3487('0x1d')]||null:null,'limit':_0x2fa630[_0x3487('0x1a')]?_0x2fa630[_0x3487('0x1a')][_0x3487('0x1e')]||null:null})[_0x3487('0xc')](function(_0x409dcf){logger['info'](_0x3487('0x17'),_0x2fa630);logger[_0x3487('0xf')](_0x3487('0x17'),_0x2fa630,JSON['stringify'](_0x409dcf));_0x41795b(_0x409dcf);})['catch'](function(_0x38d35c){logger[_0x3487('0x11')](_0x3487('0x17'),_0x38d35c[_0x3487('0x13')],_0x2fa630);_0xd56d94(_0x3576ca['error'](0x1f4,_0x38d35c[_0x3487('0x13')]));});});}; \ No newline at end of file +var _0x08fc=['FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x24e603,_0x12d5e8){var _0x462f4b=function(_0x406191){while(--_0x406191){_0x24e603['push'](_0x24e603['shift']());}};_0x462f4b(++_0x12d5e8);}(_0x08fc,0x11a));var _0xc08f=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x08fc[_0x5f3de3];return _0x287e0d;};'use strict';var _=require(_0xc08f('0x0'));var util=require(_0xc08f('0x1'));var moment=require(_0xc08f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc08f('0x3'));var fs=require('fs');var Redis=require(_0xc08f('0x4'));var db=require(_0xc08f('0x5'))['db'];var utils=require(_0xc08f('0x6'));var logger=require('../../config/logger')(_0xc08f('0x7'));var config=require(_0xc08f('0x8'));var jayson=require(_0xc08f('0x9'));var client=jayson[_0xc08f('0xa')][_0xc08f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5473af,_0x51f964,_0x595ab5){return new BPromise(function(_0x335492,_0x27f9c7){return client[_0xc08f('0xc')](_0x5473af,_0x595ab5)[_0xc08f('0xd')](function(_0x5b37ea){logger[_0xc08f('0xe')](_0xc08f('0xf'),_0x51f964,_0xc08f('0x10'));logger['debug'](_0xc08f('0x11'),_0x51f964,_0xc08f('0x10'),JSON[_0xc08f('0x12')](_0x5b37ea));if(_0x5b37ea[_0xc08f('0x13')]){if(_0x5b37ea[_0xc08f('0x13')]['code']===0x1f4){logger['error'](_0xc08f('0xf'),_0x51f964,_0x5b37ea[_0xc08f('0x13')][_0xc08f('0x14')]);return _0x27f9c7(_0x5b37ea[_0xc08f('0x13')][_0xc08f('0x14')]);}logger[_0xc08f('0x13')](_0xc08f('0xf'),_0x51f964,_0x5b37ea[_0xc08f('0x13')][_0xc08f('0x14')]);return _0x335492(_0x5b37ea[_0xc08f('0x13')]['message']);}else{logger[_0xc08f('0xe')](_0xc08f('0xf'),_0x51f964,_0xc08f('0x10'));_0x335492(_0x5b37ea[_0xc08f('0x15')]['message']);}})[_0xc08f('0x16')](function(_0x2b17ca){logger[_0xc08f('0x13')](_0xc08f('0xf'),_0x51f964,_0x2b17ca);_0x27f9c7(_0x2b17ca);});});}exports[_0xc08f('0x17')]=function(_0x54f685){var _0x581705=this;return new Promise(function(_0x49ab0d,_0x5a706e){return db[_0xc08f('0x18')][_0xc08f('0x19')](_0x54f685[_0xc08f('0x1a')],{'raw':_0x54f685[_0xc08f('0x1b')]?_0x54f685['options'][_0xc08f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54f685[_0xc08f('0x1b')]?_0x54f685[_0xc08f('0x1b')][_0xc08f('0x1d')]||null:null,'attributes':_0x54f685[_0xc08f('0x1b')]?_0x54f685[_0xc08f('0x1b')][_0xc08f('0x1e')]||null:null,'limit':_0x54f685[_0xc08f('0x1b')]?_0x54f685[_0xc08f('0x1b')][_0xc08f('0x1f')]||null:null})['then'](function(_0x32ab0b){logger[_0xc08f('0xe')](_0xc08f('0x17'),_0x54f685);logger[_0xc08f('0x20')]('UpdateFaxApplication',_0x54f685,JSON[_0xc08f('0x12')](_0x32ab0b));_0x49ab0d(_0x32ab0b);})['catch'](function(_0x46f9c4){logger[_0xc08f('0x13')](_0xc08f('0x17'),_0x46f9c4[_0xc08f('0x14')],_0x54f685);_0x5a706e(_0x581705[_0xc08f('0x13')](0x1f4,_0x46f9c4[_0xc08f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3017992..9b42570 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 _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e1b79,_0x9ecb29){var _0x1e3dd9=function(_0x36c19b){while(--_0x36c19b){_0x4e1b79['push'](_0x4e1b79['shift']());}};_0x1e3dd9(++_0x9ecb29);}(_0x9c00,0x1a0));var _0x09c0=function(_0x475aa9,_0x439aab){_0x475aa9=_0x475aa9-0x0;var _0x360bbc=_0x9c00[_0x475aa9];return _0x360bbc;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','/:id'];(function(_0x4a9a17,_0x273a09){var _0x30e831=function(_0xabbcbd){while(--_0xabbcbd){_0x4a9a17['push'](_0x4a9a17['shift']());}};_0x30e831(++_0x273a09);}(_0x4fc2,0x111));var _0x24fc=function(_0x581481,_0x190792){_0x581481=_0x581481-0x0;var _0x4dfd79=_0x4fc2[_0x581481];return _0x4dfd79;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('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 694ec0b..8334567 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 _0xa54e=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x52364b,_0x43fd12){var _0x2dfad7=function(_0x8cff20){while(--_0x8cff20){_0x52364b['push'](_0x52364b['shift']());}};_0x2dfad7(++_0x43fd12);}(_0xa54e,0x7d));var _0xea54=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xa54e[_0x5e6cb8];return _0x3faeb3;};'use strict';var Sequelize=require(_0xea54('0x0'));module[_0xea54('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea54('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xea54('0x3')]},'thirdDisposition':{'type':Sequelize[_0xea54('0x3')]},'note':{'type':Sequelize[_0xea54('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xea54('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xea54('0x4')]('in',_0xea54('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xea54('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xea54('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2eff=['DATE','sequelize','exports','BOOLEAN','STRING','ENUM','out'];(function(_0x1c3dbb,_0x3d9591){var _0x22cbf7=function(_0x459faa){while(--_0x459faa){_0x1c3dbb['push'](_0x1c3dbb['shift']());}};_0x22cbf7(++_0x3d9591);}(_0x2eff,0x1cf));var _0xf2ef=function(_0x21bb01,_0x4988f2){_0x21bb01=_0x21bb01-0x0;var _0x4a8035=_0x2eff[_0x21bb01];return _0x4a8035;};'use strict';var Sequelize=require(_0xf2ef('0x0'));module[_0xf2ef('0x1')]={'closed':{'type':Sequelize[_0xf2ef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf2ef('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf2ef('0x3')]},'note':{'type':Sequelize[_0xf2ef('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xf2ef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf2ef('0x4')]('in',_0xf2ef('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf2ef('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf2ef('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f9991d0..b130a2f 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 _0x2384=['intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','select','field','from','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','cm_contacts','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','end','body','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','unreadMessages','contactName','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','includeAll','include','options','create','update','params','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','nolimit','merge','format','YYYY-MM-DD\x20HH:mm:ss','setTags','Tag','findAll','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','catch','waiting','answered','total','UserId','closed','talking','unmanaged','FaxInteraction','fieldName','key','query','keys'];(function(_0x1ce355,_0x500411){var _0xff0402=function(_0xd6eb79){while(--_0xd6eb79){_0x1ce355['push'](_0x1ce355['shift']());}};_0xff0402(++_0x500411);}(_0x2384,0x179));var _0x4238=function(_0x3111a9,_0x3051da){_0x3111a9=_0x3111a9-0x0;var _0x267973=_0x2384[_0x3111a9];return _0x267973;};'use strict';var emlformat=require(_0x4238('0x0'));var rimraf=require(_0x4238('0x1'));var zipdir=require(_0x4238('0x2'));var jsonpatch=require(_0x4238('0x3'));var rp=require(_0x4238('0x4'));var moment=require(_0x4238('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4238('0x6'));var util=require('util');var path=require(_0x4238('0x7'));var sox=require(_0x4238('0x8'));var csv=require('to-csv');var ejs=require(_0x4238('0x9'));var fs=require('fs');var fs_extra=require(_0x4238('0xa'));var _=require(_0x4238('0xb'));var squel=require(_0x4238('0xc'));var crypto=require(_0x4238('0xd'));var jsforce=require(_0x4238('0xe'));var deskjs=require(_0x4238('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4238('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4238('0x11'));var as=require(_0x4238('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4238('0x13'))(_0x4238('0x14'));var utils=require('../../config/utils');var config=require(_0x4238('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4238('0x16'))['db'];config[_0x4238('0x17')]=_[_0x4238('0x18')](config[_0x4238('0x17')],{'host':_0x4238('0x19'),'port':0x18eb});var socket=require(_0x4238('0x1a'))(new Redis(config[_0x4238('0x17')]));require(_0x4238('0x1b'))[_0x4238('0x1c')](socket);function respondWithStatusCode(_0x3d52c6,_0x525b10){_0x525b10=_0x525b10||0xcc;return function(_0x3bae0d){if(_0x3bae0d){return _0x3d52c6[_0x4238('0x1d')](_0x525b10);}return _0x3d52c6[_0x4238('0x1e')](_0x525b10)['end']();};}function respondWithResult(_0x4e5e36,_0x4a9ce5){_0x4a9ce5=_0x4a9ce5||0xc8;return function(_0x83dcba){if(_0x83dcba){return _0x4e5e36[_0x4238('0x1e')](_0x4a9ce5)[_0x4238('0x1f')](_0x83dcba);}};}function respondWithFilteredResult(_0x3d12e8,_0x138fa8){return function(_0x5f5a29){if(_0x5f5a29){var _0x14ad73=typeof _0x138fa8[_0x4238('0x20')]===_0x4238('0x21')&&typeof _0x138fa8['limit']==='undefined';var _0x5926cd=_0x5f5a29[_0x4238('0x22')];var _0x46582e=_0x14ad73?0x0:_0x138fa8['offset'];var _0x14035d=_0x14ad73?_0x5f5a29['count']:_0x138fa8[_0x4238('0x20')]+_0x138fa8[_0x4238('0x23')];var _0x3d8684;if(_0x14035d>=_0x5926cd){_0x14035d=_0x5926cd;_0x3d8684=0xc8;}else{_0x3d8684=0xce;}_0x3d12e8[_0x4238('0x1e')](_0x3d8684);return _0x3d12e8[_0x4238('0x24')](_0x4238('0x25'),_0x46582e+'-'+_0x14035d+'/'+_0x5926cd)['json'](_0x5f5a29);}return null;};}function patchUpdates(_0x28b93e){return function(_0x588cef){try{jsonpatch[_0x4238('0x26')](_0x588cef,_0x28b93e,!![]);}catch(_0x5aca95){return BPromise[_0x4238('0x27')](_0x5aca95);}return _0x588cef[_0x4238('0x28')]();};}function saveUpdates(_0x12bd42,_0x2947f5){return function(_0x1be6f3){if(_0x1be6f3){return _0x1be6f3['update'](_0x12bd42)[_0x4238('0x29')](function(_0x3a8957){return _0x3a8957;});}return null;};}function removeEntity(_0xe0e2c6,_0xe94b6c){return function(_0x849e8){if(_0x849e8){return _0x849e8['destroy']()[_0x4238('0x29')](function(){_0xe0e2c6[_0x4238('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x105a78,_0x1f3800){return function(_0xbfe2c7){if(!_0xbfe2c7){_0x105a78[_0x4238('0x1d')](0x194);}return _0xbfe2c7;};}function handleError(_0x7d3f34,_0xea4e96){_0xea4e96=_0xea4e96||0x1f4;return function(_0x582a30){logger['error'](_0x582a30[_0x4238('0x2a')]);if(_0x582a30[_0x4238('0x2b')]){delete _0x582a30[_0x4238('0x2b')];}_0x7d3f34[_0x4238('0x1e')](_0xea4e96)[_0x4238('0x2c')](_0x582a30);};}function getInteractionUsers(_0x572332,_0x5042da){return new BPromise(function(_0x15c3e7,_0x3f8e22){try{if(_0x5042da[_0x572332['id']]){_0x572332[_0x4238('0x2d')]=_[_0x4238('0x2e')](_0x5042da[_0x572332['id']],function(_0x4a561b){return{'id':_0x4a561b['id'],'fullname':_0x4a561b['fullname']};});}}catch(_0x1fd9cf){_0x3f8e22(_0x1fd9cf);}_0x15c3e7(_0x572332);});}function getInteractionTags(_0x4f91dd,_0x12addf){return new BPromise(function(_0x1bc029,_0x3376b5){try{if(_0x4f91dd['TagIds']){_0x4f91dd['Tags']=[];_0x4f91dd[_0x4238('0x2f')][_0x4238('0x30')](',')[_0x4238('0x31')](function(_0x129b31){_0x4f91dd[_0x4238('0x32')][_0x4238('0x33')](_0x12addf[_0x129b31]);});}delete _0x4f91dd[_0x4238('0x2f')];}catch(_0x4d7706){_0x3376b5(_0x4d7706);}_0x1bc029(_0x4f91dd);});}function updateFaxInteraction(_0x3ca568,_0xbd681a,_0x328be9){return new BPromise(function(_0x5113a6,_0x55626c){return getInteractionUsers(_0x3ca568,_0x328be9)[_0x4238('0x29')](function(_0x98b58b){return getInteractionTags(_0x98b58b,_0xbd681a);})['then'](function(_0x5976e8){return getStateInteraction(_0x5976e8);})[_0x4238('0x29')](function(_0x7a08e9){_0x5113a6(_0x7a08e9);})[_0x4238('0x34')](function(_0x33fb08){_0x55626c(_0x33fb08);});});}function getStateInteraction(_0x23bef4){return new BPromise(function(_0x354d93){_0x23bef4[_0x4238('0x35')]=0x0;_0x23bef4['talking']=0x0;_0x23bef4[_0x4238('0x36')]=0x0;_0x23bef4['unmanaged']=0x0;_0x23bef4[_0x4238('0x37')]=0x0;if(!_0x23bef4['closed']&&!_0x23bef4[_0x4238('0x38')]){_0x23bef4[_0x4238('0x35')]+=0x1;}if(!_0x23bef4[_0x4238('0x39')]&&_0x23bef4[_0x4238('0x38')]){_0x23bef4['talking']+=0x1;if(_0x23bef4[_0x4238('0x35')]){_0x23bef4[_0x4238('0x35')]-=0x1;}}if(_0x23bef4['closed']&&_0x23bef4[_0x4238('0x38')]){_0x23bef4[_0x4238('0x36')]+=0x1;if(_0x23bef4[_0x4238('0x3a')]){_0x23bef4[_0x4238('0x3a')]-=0x1;}}if(_0x23bef4[_0x4238('0x39')]&&!_0x23bef4[_0x4238('0x38')]){_0x23bef4[_0x4238('0x3b')]+=0x1;if(_0x23bef4[_0x4238('0x35')]){_0x23bef4[_0x4238('0x35')]-=0x1;}}_0x23bef4[_0x4238('0x37')]+=0x1;_0x354d93(_0x23bef4);});}exports['index']=function(_0x15d4dd,_0x56426a){var _0x3f4129={},_0x8fe6d4={},_0x52a6ba={'count':0x0,'rows':[]};var _0x35d290=_[_0x4238('0x2e')](db[_0x4238('0x3c')]['rawAttributes'],function(_0x3ca383){return{'name':_0x3ca383[_0x4238('0x3d')],'type':_0x3ca383['type'][_0x4238('0x3e')]};});_0x8fe6d4['model']=_[_0x4238('0x2e')](_0x35d290,_0x4238('0x2b'));_0x8fe6d4[_0x4238('0x3f')]=_[_0x4238('0x40')](_0x15d4dd[_0x4238('0x3f')]);_0x8fe6d4['filters']=_[_0x4238('0x41')](_0x8fe6d4[_0x4238('0x42')],_0x8fe6d4[_0x4238('0x3f')]);_0x3f4129[_0x4238('0x43')]=_['intersection'](_0x8fe6d4[_0x4238('0x42')],qs[_0x4238('0x44')](_0x15d4dd[_0x4238('0x3f')][_0x4238('0x44')]));_0x3f4129[_0x4238('0x43')]=_0x3f4129[_0x4238('0x43')]['length']?_0x3f4129[_0x4238('0x43')]:_0x8fe6d4[_0x4238('0x42')];if(!_0x15d4dd[_0x4238('0x3f')][_0x4238('0x45')]('nolimit')){_0x3f4129[_0x4238('0x23')]=qs[_0x4238('0x23')](_0x15d4dd[_0x4238('0x3f')][_0x4238('0x23')]);_0x3f4129[_0x4238('0x20')]=qs[_0x4238('0x20')](_0x15d4dd[_0x4238('0x3f')][_0x4238('0x20')]);}_0x3f4129[_0x4238('0x46')]=qs[_0x4238('0x47')](_0x15d4dd[_0x4238('0x3f')][_0x4238('0x47')]);_0x3f4129[_0x4238('0x48')]=qs[_0x4238('0x49')](_[_0x4238('0x4a')](_0x15d4dd[_0x4238('0x3f')],_0x8fe6d4[_0x4238('0x49')]),_0x35d290);var _0x5ef362=[];var _0x21e10e=squel[_0x4238('0x4b')]()[_0x4238('0x4c')]('id')[_0x4238('0x4c')](_0x4238('0x2b'))[_0x4238('0x4c')]('color')[_0x4238('0x4d')]('tools_tags');var _0x58b337=squel[_0x4238('0x4b')]()[_0x4238('0x4c')](_0x4238('0x4e'))[_0x4238('0x4c')]('u.fullname')[_0x4238('0x4c')](_0x4238('0x4f'))[_0x4238('0x4d')](_0x4238('0x50'),'ui')[_0x4238('0x51')]('users','u','u.id\x20=\x20ui.UserId');var _0x4246bd=squel[_0x4238('0x4b')]()[_0x4238('0x4d')]('fax_interactions','i')[_0x4238('0x51')](_0x4238('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x4238('0x53'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x4238('0x54'),'a',_0x4238('0x55'))[_0x4238('0x51')](_0x4238('0x56'),'me',_0x4238('0x57'))[_0x4238('0x51')](_0x4238('0x58'),'it',_0x4238('0x59'))['left_join']('tools_tags','t',_0x4238('0x5a'));var _0x5f0312=squel[_0x4238('0x5b')]();var _0x24b001=[];var _0x2d30b5=squel[_0x4238('0x5b')]();var _0x51abfa;if(_0x15d4dd[_0x4238('0x3f')][_0x4238('0x5c')]){_0x51abfa=as[_0x4238('0x5d')](_0x15d4dd['query']['search']);var _0x57b37d=_0x51abfa[_0x4238('0x5e')];for(var _0x5e40c9=0x0;_0x5e40c9<_0x51abfa['conditions'][_0x4238('0x5f')];_0x5e40c9++){var _0x1d4723=_0x51abfa['conditions'][_0x5e40c9];var _0x531e79='i';var _0x1cc9e9=_[_0x4238('0x60')](_0x35d290,[_0x4238('0x2b'),_0x1d4723[_0x4238('0x4c')]]);if(!_0x1cc9e9){switch(_0x1d4723[_0x4238('0x4c')]){case'unreadMessages':if(_0x1d4723['value']==0x1){_0x4246bd[_0x4238('0x61')]('`'+_0x1d4723[_0x4238('0x4c')]+_0x4238('0x62'));}else{_0x4246bd['having']('`'+_0x1d4723[_0x4238('0x4c')]+_0x4238('0x63'));}break;case _0x4238('0x64'):if(_0x1d4723[_0x4238('0x65')]===_0x4238('0x66')){if(_0x1d4723[_0x4238('0x67')][_0x4238('0x30')]('\x20')[_0x4238('0x5f')]>0x1){_0x5f0312[_0x57b37d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4238('0x68')](_0x1d4723[_0x4238('0x67')]),null);}else{var _0x1b2b55='%'+_0x1d4723[_0x4238('0x67')]+'%';_0x5f0312[_0x57b37d](_0x4238('0x69'),_0x1b2b55,_0x1b2b55,_0x1b2b55);}}else{_0x1cc9e9=_[_0x4238('0x60')](_0x35d290,[_0x4238('0x2b'),_0x4238('0x6a')]);_0x1d4723[_0x4238('0x4c')]='ContactId';_0x307faf=as[_0x4238('0x6b')](_0x531e79,_0x1cc9e9[_0x4238('0x6c')],_0x1d4723);_0x5f0312[_0x57b37d](_0x307faf[_0x4238('0x6d')],_0x307faf[_0x4238('0x67')][_0x4238('0x6e')],_0x307faf[_0x4238('0x67')]['end']);}break;case'Tag':var _0x2d9fb4=_0x1d4723[_0x4238('0x67')][_0x4238('0x30')](',')['map'](function(_0x49115d){return Number(_0x49115d);});_0x2d9fb4['forEach'](function(_0x25cd76){_0x2d30b5['or'](_0x4238('0x6f'),'%,'+_0x25cd76+',%');});_0x24b001=_[_0x4238('0x70')](_0x24b001,_0x2d9fb4);break;case _0x4238('0x71'):if(_0x1d4723[_0x4238('0x65')]===_0x4238('0x66')){_0x5f0312[_0x57b37d](_0x4238('0x72'),'%'+_0x1d4723[_0x4238('0x67')]+'%',null);}else{_0x1cc9e9=_[_0x4238('0x60')](_0x35d290,['name',_0x4238('0x38')]);_0x1d4723[_0x4238('0x4c')]=_0x4238('0x38');_0x307faf=as[_0x4238('0x6b')](_0x531e79,_0x1cc9e9['type'],_0x1d4723);_0x5f0312[_0x57b37d](_0x307faf['text'],_0x307faf[_0x4238('0x67')][_0x4238('0x6e')],_0x307faf[_0x4238('0x67')][_0x4238('0x73')]);}break;case _0x4238('0x74'):_0x307faf=as[_0x4238('0x6b')]('me',null,_0x1d4723);_0x5f0312[_0x57b37d](_0x307faf[_0x4238('0x6d')],_0x307faf[_0x4238('0x67')]['start'],_0x307faf[_0x4238('0x67')][_0x4238('0x73')]);break;}}else{var _0x307faf=as[_0x4238('0x6b')](_0x531e79,_0x1cc9e9[_0x4238('0x6c')],_0x1d4723);_0x5f0312[_0x57b37d](_0x307faf['text'],_0x307faf[_0x4238('0x67')][_0x4238('0x6e')],_0x307faf[_0x4238('0x67')]['end']);}}}else{var _0x4a673a=_(_0x15d4dd['query'])['keys']()[_0x4238('0x2e')](function(_0x3033a9){return _['some'](_0x35d290,[_0x4238('0x2b'),_0x3033a9])?_0x3033a9:undefined;})[_0x4238('0x75')]()['value']();if(!_['isEmpty'](_0x4a673a)){_0x4a673a[_0x4238('0x31')](function(_0x4d780e){if(_0x4d780e==='FaxAccountId'){_0x4246bd[_0x4238('0x48')]('i.FaxAccountId\x20IN\x20?',[][_0x4238('0x76')](_0x15d4dd[_0x4238('0x3f')][_0x4d780e]));}else if(_0x4d780e===_0x4238('0x77')){var _0x3e5b51=JSON[_0x4238('0x78')](_0x15d4dd[_0x4238('0x3f')][_0x4d780e])[_0x4238('0x79')];var _0x1a21a4=JSON['parse'](_0x15d4dd[_0x4238('0x3f')][_0x4d780e])[_0x4238('0x7a')];_0x4246bd[_0x4238('0x48')](_0x4238('0x7b'),_0x3e5b51,_0x1a21a4);}else{if(_0x15d4dd[_0x4238('0x3f')][_0x4d780e]==='null'){_0x4246bd[_0x4238('0x48')]('i.'+_0x4d780e+'\x20IS\x20NULL');}else{_0x4246bd[_0x4238('0x48')]('i.'+_0x4d780e+_0x4238('0x7c'),_0x15d4dd[_0x4238('0x3f')][_0x4d780e]);}}});}if(_0x15d4dd[_0x4238('0x3f')][_0x4238('0x7d')]){if(_0x15d4dd[_0x4238('0x3f')]['read']==0x1){_0x4246bd[_0x4238('0x61')](_0x4238('0x7e'));}else{_0x4246bd[_0x4238('0x61')](_0x4238('0x7f'));}}if(_0x15d4dd[_0x4238('0x3f')][_0x4238('0x80')]){_0x24b001=_[_0x4238('0x81')](_0x15d4dd[_0x4238('0x3f')][_0x4238('0x80')])?_0x15d4dd['query'][_0x4238('0x80')]:new Array(_0x15d4dd[_0x4238('0x3f')]['tag']);_0x24b001['forEach'](function(_0x30aedf){_0x2d30b5['or'](_0x4238('0x6f'),'%,'+_0x30aedf+',%');});}if(_0x15d4dd[_0x4238('0x3f')][_0x4238('0x82')]){var _0x42cd9b=_0x15d4dd['query'][_0x4238('0x82')][_0x4238('0x83')]('\x5c','\x5c\x5c')[_0x4238('0x83')](/'/g,'\x27\x27');if(qs[_0x4238('0x84')](_0x42cd9b)){_0x5f0312['or']('i.id\x20LIKE\x20?',_0x42cd9b+'%')['or'](_0x4238('0x85'),_0x42cd9b+'%');}_0x5f0312['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42cd9b+'%');}}_0x4246bd['where'](_0x5f0312);_0x4246bd[_0x4238('0x86')](_0x4238('0x87'));var _0x4cde03={'type':db[_0x4238('0x88')][_0x4238('0x89')]['SELECT'],'raw':!![]};var _0x306ae7=_0x4246bd[_0x4238('0x8a')]();_0x306ae7['field'](_0x4238('0x87'));_0x306ae7[_0x4238('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4238('0x8b'));if(_0x3f4129[_0x4238('0x46')]){_0x3f4129[_0x4238('0x46')][_0x4238('0x31')](function(_0x3834d8){var _0x56f98f=_0x3834d8[0x0]===_0x4238('0x8c')?_0x3834d8[0x0]:'i.'+_0x3834d8[0x0];_0x4246bd['order'](_0x56f98f,_0x3834d8[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x24b001)){_0x4246bd['having'](_0x2d30b5);_0x306ae7[_0x4238('0x48')](_0x4238('0x8d'),_0x24b001);}BPromise[_0x4238('0x8e')]()[_0x4238('0x29')](function(){if(!_0x51abfa){if(_0x15d4dd[_0x4238('0x3f')][_0x4238('0x8f')])return;_0x306ae7['where'](_0x4238('0x90'));_0x4246bd[_0x4238('0x48')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x15d4dd[_0x4238('0x91')][_0x4238('0x92')]!==_0x4238('0x93'))return;return _0x15d4dd[_0x4238('0x91')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x4238('0x29')](function(_0x1495a9){if(_[_0x4238('0x94')](_0x1495a9)){_0x306ae7[_0x4238('0x48')](_0x4238('0x95'));_0x4246bd[_0x4238('0x48')](_0x4238('0x95'));}else{_0x306ae7['where']('i.FaxAccountId\x20IN\x20?',_[_0x4238('0x2e')](_0x1495a9,'id'));_0x4246bd[_0x4238('0x48')](_0x4238('0x96'),_[_0x4238('0x2e')](_0x1495a9,'id'));}});})[_0x4238('0x29')](function(){if(_0x15d4dd['user'][_0x4238('0x92')]===_0x4238('0x93')&&!_0x51abfa&&!_0x15d4dd['query'][_0x4238('0x8f')])return[];return db[_0x4238('0x97')][_0x4238('0x3f')](_0x306ae7[_0x4238('0x98')](),_0x4cde03);})[_0x4238('0x29')](function(_0x1ec889){_0x52a6ba[_0x4238('0x22')]=_0x1ec889[_0x4238('0x5f')];if(_0x52a6ba[_0x4238('0x22')]===0x0)return[];return db[_0x4238('0x97')]['query'](_0x21e10e[_0x4238('0x98')](),_0x4cde03)[_0x4238('0x29')](function(_0x218b19){_0x5ef362=_['keyBy'](_0x218b19,'id');_0x4cde03=_['merge'](_0x4cde03,{'model':db[_0x4238('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15d4dd[_0x4238('0x3f')][_0x4238('0x44')]){_0x3f4129[_0x4238('0x43')][_0x4238('0x31')](function(_0x33ff22){_0x4246bd[_0x4238('0x4c')]('i.'+_0x33ff22);});}else{_0x4246bd[_0x4238('0x4c')](_0x4238('0x99'),_0x4238('0x8b'));_0x4246bd[_0x4238('0x4c')](_0x4238('0x9a'),_0x4238('0x9b'));_0x4246bd[_0x4238('0x4c')](_0x4238('0x9c'),_0x4238('0x9d'));_0x4246bd[_0x4238('0x4c')](_0x4238('0x9e'),'contactName');_0x4246bd['field']('i.*');_0x4246bd['field']('c.firstName',_0x4238('0x9f'));_0x4246bd[_0x4238('0x4c')](_0x4238('0xa0'),_0x4238('0xa1'));_0x4246bd[_0x4238('0x4c')](_0x4238('0xa2'),_0x4238('0xa3'));_0x4246bd[_0x4238('0x4c')](_0x4238('0xa4'),_0x4238('0xa5'));_0x4246bd[_0x4238('0x4c')]('c.mobile',_0x4238('0xa6'));_0x4246bd[_0x4238('0x4c')](_0x4238('0xa7'),_0x4238('0xa8'));_0x4246bd[_0x4238('0x4c')](_0x4238('0xa9'),'Owner.fullname');_0x4246bd[_0x4238('0x4c')](_0x4238('0xaa'),_0x4238('0xab'));_0x4246bd[_0x4238('0x4c')](_0x4238('0xac'),'TagIds');}if(_0x3f4129['limit'])_0x4246bd[_0x4238('0x23')](_0x3f4129[_0x4238('0x23')]);if(_0x3f4129[_0x4238('0x20')])_0x4246bd['offset'](_0x3f4129[_0x4238('0x20')]);return db[_0x4238('0x97')][_0x4238('0x3f')](_0x4246bd[_0x4238('0x98')](),_0x4cde03);})[_0x4238('0x29')](function(_0x560274){if(_0x560274['length']>0x0)_0x58b337[_0x4238('0x48')](_0x4238('0xad'),_[_0x4238('0x2e')](_0x560274,'id'));return db[_0x4238('0x97')][_0x4238('0x3f')](_0x58b337[_0x4238('0x98')](),_0x4cde03)[_0x4238('0x29')](function(_0x383df3){var _0x27c90c=_[_0x4238('0xae')](_0x383df3,_0x4238('0xaf'));var _0x48a48e=[];_0x560274[_0x4238('0x31')](function(_0x280c5a){_0x48a48e[_0x4238('0x33')](updateFaxInteraction(_0x280c5a,_0x5ef362,_0x27c90c));});return BPromise[_0x4238('0xb0')](_0x48a48e);});});})[_0x4238('0x29')](function(_0x2cb012){_0x52a6ba[_0x4238('0xb1')]=_0x2cb012;return _0x52a6ba;})[_0x4238('0x29')](respondWithFilteredResult(_0x56426a,_0x3f4129))[_0x4238('0x34')](handleError(_0x56426a,null));};exports['show']=function(_0x4ef706,_0xa71f26){var _0x325dc1={'raw':![],'where':{'id':_0x4ef706['params']['id']}},_0x1a3601={};_0x1a3601[_0x4238('0x42')]=_[_0x4238('0x40')](db[_0x4238('0x3c')]['rawAttributes']);_0x1a3601[_0x4238('0x3f')]=_[_0x4238('0x40')](_0x4ef706[_0x4238('0x3f')]);_0x1a3601[_0x4238('0x49')]=_[_0x4238('0x41')](_0x1a3601[_0x4238('0x42')],_0x1a3601[_0x4238('0x3f')]);_0x325dc1[_0x4238('0x43')]=_[_0x4238('0x41')](_0x1a3601['model'],qs[_0x4238('0x44')](_0x4ef706['query'][_0x4238('0x44')]));_0x325dc1[_0x4238('0x43')]=_0x325dc1[_0x4238('0x43')][_0x4238('0x5f')]?_0x325dc1[_0x4238('0x43')]:_0x1a3601['model'];if(_0x4ef706[_0x4238('0x3f')][_0x4238('0xb2')]){_0x325dc1[_0x4238('0xb3')]=[{'all':!![]}];}_0x325dc1=_['merge']({},_0x325dc1,_0x4ef706[_0x4238('0xb4')]);return db[_0x4238('0x3c')][_0x4238('0x60')](_0x325dc1)['then'](handleEntityNotFound(_0xa71f26,null))[_0x4238('0x29')](respondWithResult(_0xa71f26,null))['catch'](handleError(_0xa71f26,null));};exports[_0x4238('0xb5')]=function(_0x4f1b1c,_0x235c28){return db[_0x4238('0x3c')][_0x4238('0xb5')](_0x4f1b1c[_0x4238('0x74')],{})[_0x4238('0x29')](respondWithResult(_0x235c28,0xc9))[_0x4238('0x34')](handleError(_0x235c28,null));};exports[_0x4238('0xb6')]=function(_0x20ee2c,_0x2b9807){if(_0x20ee2c[_0x4238('0x74')]['id']){delete _0x20ee2c[_0x4238('0x74')]['id'];}return db[_0x4238('0x3c')][_0x4238('0x60')]({'where':{'id':_0x20ee2c[_0x4238('0xb7')]['id']}})[_0x4238('0x29')](handleEntityNotFound(_0x2b9807,null))[_0x4238('0x29')](saveUpdates(_0x20ee2c[_0x4238('0x74')],null))['then'](respondWithResult(_0x2b9807,null))[_0x4238('0x34')](handleError(_0x2b9807,null));};exports['destroy']=function(_0x52a245,_0x532307){return db[_0x4238('0x3c')]['find']({'where':{'id':_0x52a245['params']['id']}})[_0x4238('0x29')](handleEntityNotFound(_0x532307,null))['then'](removeEntity(_0x532307,null))[_0x4238('0x34')](handleError(_0x532307,null));};exports[_0x4238('0xb8')]=function(_0x531e10,_0xf95a65){return db[_0x4238('0x3c')][_0x4238('0xb8')]()[_0x4238('0x29')](respondWithResult(_0xf95a65,null))[_0x4238('0x34')](handleError(_0xf95a65,null));};exports[_0x4238('0xb9')]=function(_0x36e693,_0x204c13,_0x3cd90a){return db[_0x4238('0xba')][_0x4238('0x60')]({'where':{'id':_0x36e693[_0x4238('0xb7')]['id']}})[_0x4238('0x29')](handleEntityNotFound(_0x204c13,null))[_0x4238('0x29')](function(_0x557a53){if(_0x557a53){return _0x557a53['addMessage'](_0x36e693[_0x4238('0x74')]['ids'],_[_0x4238('0xbb')](_0x36e693['body'],[_0x4238('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x204c13,null))[_0x4238('0x34')](handleError(_0x204c13,null));};exports[_0x4238('0xbd')]=function(_0x1e3c6e,_0x365049,_0x4ea48a){var _0x5e1b56={'raw':![],'where':{}};var _0x4705ed={};var _0x39a579={'count':0x0,'rows':[]};return db[_0x4238('0x3c')][_0x4238('0xbe')]({'where':{'id':_0x1e3c6e[_0x4238('0xb7')]['id']}})['then'](handleEntityNotFound(_0x365049,null))[_0x4238('0x29')](function(_0x2ee00d){if(_0x2ee00d){_0x4705ed[_0x4238('0x42')]=_[_0x4238('0x40')](db[_0x4238('0xba')]['rawAttributes']);_0x4705ed['query']=_[_0x4238('0x40')](_0x1e3c6e['query']);_0x4705ed[_0x4238('0x49')]=_[_0x4238('0x41')](_0x4705ed['model'],_0x4705ed['query']);_0x5e1b56[_0x4238('0x43')]=_[_0x4238('0x41')](_0x4705ed[_0x4238('0x42')],qs[_0x4238('0x44')](_0x1e3c6e[_0x4238('0x3f')][_0x4238('0x44')]));_0x5e1b56[_0x4238('0x43')]=_0x5e1b56[_0x4238('0x43')][_0x4238('0x5f')]?_0x5e1b56[_0x4238('0x43')]:_0x4705ed[_0x4238('0x42')];if(!_0x1e3c6e[_0x4238('0x3f')][_0x4238('0x45')](_0x4238('0xbf'))){_0x5e1b56['limit']=qs['limit'](_0x1e3c6e[_0x4238('0x3f')]['limit']);_0x5e1b56[_0x4238('0x20')]=qs[_0x4238('0x20')](_0x1e3c6e[_0x4238('0x3f')][_0x4238('0x20')]);}_0x5e1b56[_0x4238('0x46')]=qs[_0x4238('0x47')](_0x1e3c6e['query'][_0x4238('0x47')]);_0x5e1b56['where']=qs[_0x4238('0x49')](_[_0x4238('0x4a')](_0x1e3c6e[_0x4238('0x3f')],_0x4705ed[_0x4238('0x49')]));_0x5e1b56[_0x4238('0x48')][_0x4238('0xaf')]=_0x2ee00d['id'];if(_0x1e3c6e[_0x4238('0x3f')][_0x4238('0x82')]){_0x5e1b56[_0x4238('0x48')]=_[_0x4238('0xc0')](_0x5e1b56['where'],{'$or':_[_0x4238('0x2e')](_0x5e1b56[_0x4238('0x43')],function(_0x2f6dc9){var _0x1b978d={};_0x1b978d[_0x2f6dc9]={'$like':'%'+_0x1e3c6e[_0x4238('0x3f')][_0x4238('0x82')]+'%'};return _0x1b978d;})});}if(_0x1e3c6e[_0x4238('0x3f')]['$gte']){var _0x47b641=_0x1e3c6e[_0x4238('0x3f')][_0x4238('0x79')][_0x4238('0x30')](',');var _0x1a9d45={};_0x1a9d45[_0x47b641[0x0]]={'$gte':moment(_0x47b641[0x1])[_0x4238('0xc1')](_0x4238('0xc2'))};_0x5e1b56[_0x4238('0x48')]=_[_0x4238('0xc0')](_0x5e1b56[_0x4238('0x48')],_0x1a9d45);}_0x5e1b56=_[_0x4238('0xc0')]({},_0x5e1b56,_0x1e3c6e[_0x4238('0xb4')]);return db['FaxMessage'][_0x4238('0x22')]({'where':_0x5e1b56[_0x4238('0x48')]})[_0x4238('0x29')](function(_0x2a4ff0){_0x39a579[_0x4238('0x22')]=_0x2a4ff0;if(_0x1e3c6e['query']['includeAll']){_0x5e1b56[_0x4238('0xb3')]=[{'all':!![]}];}return db[_0x4238('0xba')]['findAll'](_0x5e1b56);})[_0x4238('0x29')](function(_0xa2fb3){_0x39a579['rows']=_0xa2fb3;return _0x39a579;});}})[_0x4238('0x29')](respondWithFilteredResult(_0x365049,_0x5e1b56))[_0x4238('0x34')](handleError(_0x365049,null));};exports['addTags']=function(_0x26fc15,_0xd00390,_0x45ec6d){return db[_0x4238('0x3c')]['find']({'where':{'id':_0x26fc15['params']['id']}})[_0x4238('0x29')](handleEntityNotFound(_0xd00390,null))[_0x4238('0x29')](function(_0x45c71f){if(_0x45c71f){return _0x45c71f[_0x4238('0xc3')](_0x26fc15[_0x4238('0x74')][_0x4238('0xbc')],_['omit'](_0x26fc15[_0x4238('0x74')],['ids','id'])||{})['spread'](function(){return db[_0x4238('0xc4')][_0x4238('0xc5')]({'attributes':['id','name',_0x4238('0xc6')],'where':{'id':_0x26fc15[_0x4238('0x74')][_0x4238('0xbc')]}});})[_0x4238('0x29')](function(_0x1eaae8){socket[_0x4238('0xc7')](_0x4238('0xc8'),{'id':Number(_0x26fc15[_0x4238('0xb7')]['id']),'tags':_0x1eaae8||[]});return{'id':Number(_0x26fc15[_0x4238('0xb7')]['id']),'tags':_0x1eaae8||[]};});}})[_0x4238('0x29')](respondWithResult(_0xd00390,null))[_0x4238('0x34')](handleError(_0xd00390,null));};exports[_0x4238('0xc9')]=function(_0x1e6c59,_0x223f5a,_0x26bd66){return db[_0x4238('0x3c')]['find']({'where':{'id':_0x1e6c59[_0x4238('0xb7')]['id']}})['then'](handleEntityNotFound(_0x223f5a,null))['then'](function(_0x35dce3){if(_0x35dce3){return _0x35dce3[_0x4238('0xc9')](_0x1e6c59[_0x4238('0x3f')][_0x4238('0xbc')]);}})['then'](respondWithStatusCode(_0x223f5a,null))[_0x4238('0x34')](handleError(_0x223f5a,null));};exports[_0x4238('0xca')]=function(_0x3faae7,_0x116224){var _0x4170a2=moment()[_0x4238('0xcb')]()['toString']();var _0x38a2e9=path[_0x4238('0xcc')](config[_0x4238('0xcd')],_0x4238('0xce'),_0x4238('0xcf'),_0x4238('0xd0'));var _0x2fc646=path[_0x4238('0xcc')](config[_0x4238('0xcd')],_0x4238('0xce'),'files',_0x4238('0xd1'));var _0x50bb20=path[_0x4238('0xcc')](_0x38a2e9,_0x4170a2);var _0x196dd9=util['format'](_0x4238('0xd2'),_0x3faae7[_0x4238('0xb7')]['id'],_0x4170a2);var _0x19d648=path[_0x4238('0xcc')](_0x38a2e9,_0x196dd9);var _0x793d10=[];_0x793d10[_0x4238('0x33')]({'model':db[_0x4238('0xd3')],'as':_0x4238('0xd3'),'raw':!![]});var _0xf81c1f=[{'model':db[_0x4238('0xba')],'as':_0x4238('0xd4'),'attributes':['id',_0x4238('0x74'),_0x4238('0x77')],'include':_0x793d10}];return db[_0x4238('0x3c')][_0x4238('0x60')]({'where':{'id':_0x3faae7[_0x4238('0xb7')]['id']},'include':_0xf81c1f})[_0x4238('0x29')](handleEntityNotFound(_0x116224,null))[_0x4238('0x29')](function(_0x143493){if(_0x143493&&_0x143493[_0x4238('0xd4')]){var _0x326209=_0x143493[_0x4238('0xd5')]({'plain':!![]});fs[_0x4238('0xd6')](_0x50bb20);for(var _0x36fa37=0x0;_0x36fa37<_0x326209[_0x4238('0xd4')]['length'];_0x36fa37++){var _0x1ecaf2=_0x326209['Messages'][_0x36fa37][_0x4238('0xd3')];if(_0x1ecaf2){var _0x32037f=path[_0x4238('0xcc')](_0x2fc646,_0x1ecaf2['basename']);if(fs[_0x4238('0xd7')](_0x32037f)){fs[_0x4238('0xd8')](_0x32037f)[_0x4238('0xd9')](fs['createWriteStream'](path[_0x4238('0xcc')](_0x50bb20,_0x1ecaf2['basename'])));}}}return BPromise[_0x4238('0x8e')]()['then'](function(){return new BPromise(function(_0x4ea8b4,_0x40eefb){zipdir(_0x50bb20,{'saveTo':_0x19d648},function(_0x3775ac,_0x26be7d){if(_0x3775ac)return _0x40eefb(_0x3775ac);return _0x4ea8b4(_0x26be7d);});})['then'](function(){return new BPromise(function(_0x22a49c,_0x1ae2f7){rimraf(_0x50bb20,function(_0x1bebe1){if(_0x1bebe1)_0x1ae2f7(_0x1bebe1);return _0x22a49c();});});})['then'](function(){return _0x116224['download'](_0x19d648,_0x196dd9,function(_0x4b1a14){if(_0x4b1a14){console[_0x4238('0xda')](_0x4238('0xdb'),_0x4b1a14);}else{fs[_0x4238('0xdc')](_0x19d648);}});});});}else{return _0x116224[_0x4238('0x1d')](0xc8);}})['catch'](handleError(_0x116224,null));}; \ No newline at end of file +var _0xc87a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','from','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','keys','includeAll','options','create','update','body','addMessage','ids','omit','getMessages','findOne','pick','$gte','format','FaxMessage','include','findAll','rows','addTags','setTags','spread','color','emit','removeTags','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','papaparse','ioredis','../../components/auth/service'];(function(_0x4b0488,_0x1582df){var _0x1ee4be=function(_0xba269a){while(--_0xba269a){_0x4b0488['push'](_0x4b0488['shift']());}};_0x1ee4be(++_0x1582df);}(_0xc87a,0xcd));var _0xac87=function(_0x4eeaaf,_0x3ccbf3){_0x4eeaaf=_0x4eeaaf-0x0;var _0x5ca746=_0xc87a[_0x4eeaaf];return _0x5ca746;};'use strict';var emlformat=require(_0xac87('0x0'));var rimraf=require(_0xac87('0x1'));var zipdir=require(_0xac87('0x2'));var jsonpatch=require(_0xac87('0x3'));var rp=require(_0xac87('0x4'));var moment=require(_0xac87('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac87('0x6'));var path=require(_0xac87('0x7'));var sox=require(_0xac87('0x8'));var csv=require(_0xac87('0x9'));var ejs=require(_0xac87('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xac87('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac87('0x9'));var querystring=require('querystring');var Papa=require(_0xac87('0xc'));var Redis=require(_0xac87('0xd'));var authService=require(_0xac87('0xe'));var qs=require(_0xac87('0xf'));var as=require(_0xac87('0x10'));var hardwareService=require(_0xac87('0x11'));var logger=require(_0xac87('0x12'))(_0xac87('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac87('0x14'));var db=require(_0xac87('0x15'))['db'];config[_0xac87('0x16')]=_[_0xac87('0x17')](config[_0xac87('0x16')],{'host':_0xac87('0x18'),'port':0x18eb});var socket=require(_0xac87('0x19'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0xf76aff,_0x153499){_0x153499=_0x153499||0xcc;return function(_0x4711ae){if(_0x4711ae){return _0xf76aff[_0xac87('0x1a')](_0x153499);}return _0xf76aff[_0xac87('0x1b')](_0x153499)[_0xac87('0x1c')]();};}function respondWithResult(_0x3d0bc8,_0x262f6c){_0x262f6c=_0x262f6c||0xc8;return function(_0x397f0d){if(_0x397f0d){return _0x3d0bc8['status'](_0x262f6c)['json'](_0x397f0d);}};}function respondWithFilteredResult(_0xee20d1,_0x2bf2b1){return function(_0x3eb45d){if(_0x3eb45d){var _0x2b3557=typeof _0x2bf2b1['offset']===_0xac87('0x1d')&&typeof _0x2bf2b1[_0xac87('0x1e')]==='undefined';var _0x2ccef1=_0x3eb45d[_0xac87('0x1f')];var _0x501462=_0x2b3557?0x0:_0x2bf2b1[_0xac87('0x20')];var _0x33998d=_0x2b3557?_0x3eb45d[_0xac87('0x1f')]:_0x2bf2b1[_0xac87('0x20')]+_0x2bf2b1['limit'];var _0xd8b817;if(_0x33998d>=_0x2ccef1){_0x33998d=_0x2ccef1;_0xd8b817=0xc8;}else{_0xd8b817=0xce;}_0xee20d1[_0xac87('0x1b')](_0xd8b817);return _0xee20d1[_0xac87('0x21')](_0xac87('0x22'),_0x501462+'-'+_0x33998d+'/'+_0x2ccef1)['json'](_0x3eb45d);}return null;};}function patchUpdates(_0x2659d2){return function(_0xd8a310){try{jsonpatch[_0xac87('0x23')](_0xd8a310,_0x2659d2,!![]);}catch(_0x5d0001){return BPromise['reject'](_0x5d0001);}return _0xd8a310['save']();};}function saveUpdates(_0x4c7075,_0x4a3d21){return function(_0x581bd9){if(_0x581bd9){return _0x581bd9['update'](_0x4c7075)[_0xac87('0x24')](function(_0x2e3f27){return _0x2e3f27;});}return null;};}function removeEntity(_0x1cd98a,_0x2aae9e){return function(_0x5d32ea){if(_0x5d32ea){return _0x5d32ea[_0xac87('0x25')]()[_0xac87('0x24')](function(){_0x1cd98a[_0xac87('0x1b')](0xcc)[_0xac87('0x1c')]();});}};}function handleEntityNotFound(_0x115122,_0x56d163){return function(_0xcd6fed){if(!_0xcd6fed){_0x115122[_0xac87('0x1a')](0x194);}return _0xcd6fed;};}function handleError(_0x5f5d44,_0x33f7f3){_0x33f7f3=_0x33f7f3||0x1f4;return function(_0x412ddc){logger[_0xac87('0x26')](_0x412ddc[_0xac87('0x27')]);if(_0x412ddc[_0xac87('0x28')]){delete _0x412ddc[_0xac87('0x28')];}_0x5f5d44[_0xac87('0x1b')](_0x33f7f3)['send'](_0x412ddc);};}function getInteractionUsers(_0x505149,_0x229eac){return new BPromise(function(_0x71d09,_0x4048ab){try{if(_0x229eac[_0x505149['id']]){_0x505149[_0xac87('0x29')]=_[_0xac87('0x2a')](_0x229eac[_0x505149['id']],function(_0x3ba645){return{'id':_0x3ba645['id'],'fullname':_0x3ba645['fullname']};});}}catch(_0x1650de){_0x4048ab(_0x1650de);}_0x71d09(_0x505149);});}function getInteractionTags(_0x34a297,_0x5413ba){return new BPromise(function(_0xc17def,_0x1cb56e){try{if(_0x34a297[_0xac87('0x2b')]){_0x34a297[_0xac87('0x2c')]=[];_0x34a297['TagIds'][_0xac87('0x2d')](',')[_0xac87('0x2e')](function(_0x47e648){_0x34a297[_0xac87('0x2c')][_0xac87('0x2f')](_0x5413ba[_0x47e648]);});}delete _0x34a297[_0xac87('0x2b')];}catch(_0x105381){_0x1cb56e(_0x105381);}_0xc17def(_0x34a297);});}function updateFaxInteraction(_0x3cb4d2,_0x193384,_0x27ce26){return new BPromise(function(_0x1dd106,_0x203e25){return getInteractionUsers(_0x3cb4d2,_0x27ce26)[_0xac87('0x24')](function(_0x5ee417){return getInteractionTags(_0x5ee417,_0x193384);})[_0xac87('0x24')](function(_0x2cd7eb){return getStateInteraction(_0x2cd7eb);})[_0xac87('0x24')](function(_0x177e44){_0x1dd106(_0x177e44);})[_0xac87('0x30')](function(_0x5e34b8){_0x203e25(_0x5e34b8);});});}function getStateInteraction(_0x4cb62b){return new BPromise(function(_0x2faca9){_0x4cb62b[_0xac87('0x31')]=0x0;_0x4cb62b[_0xac87('0x32')]=0x0;_0x4cb62b[_0xac87('0x33')]=0x0;_0x4cb62b[_0xac87('0x34')]=0x0;_0x4cb62b['total']=0x0;if(!_0x4cb62b[_0xac87('0x35')]&&!_0x4cb62b[_0xac87('0x36')]){_0x4cb62b[_0xac87('0x31')]+=0x1;}if(!_0x4cb62b[_0xac87('0x35')]&&_0x4cb62b[_0xac87('0x36')]){_0x4cb62b['talking']+=0x1;if(_0x4cb62b[_0xac87('0x31')]){_0x4cb62b['waiting']-=0x1;}}if(_0x4cb62b['closed']&&_0x4cb62b['UserId']){_0x4cb62b[_0xac87('0x33')]+=0x1;if(_0x4cb62b[_0xac87('0x32')]){_0x4cb62b[_0xac87('0x32')]-=0x1;}}if(_0x4cb62b[_0xac87('0x35')]&&!_0x4cb62b[_0xac87('0x36')]){_0x4cb62b[_0xac87('0x34')]+=0x1;if(_0x4cb62b[_0xac87('0x31')]){_0x4cb62b[_0xac87('0x31')]-=0x1;}}_0x4cb62b[_0xac87('0x37')]+=0x1;_0x2faca9(_0x4cb62b);});}exports[_0xac87('0x38')]=function(_0x1eaaae,_0x2ded8e){var _0x5e745a={},_0x4a71ef={},_0x2108d7={'count':0x0,'rows':[]};var _0x62e587=_[_0xac87('0x2a')](db[_0xac87('0x39')][_0xac87('0x3a')],function(_0x355cf7){return{'name':_0x355cf7[_0xac87('0x3b')],'type':_0x355cf7[_0xac87('0x3c')][_0xac87('0x3d')]};});_0x4a71ef[_0xac87('0x3e')]=_[_0xac87('0x2a')](_0x62e587,_0xac87('0x28'));_0x4a71ef[_0xac87('0x3f')]=_['keys'](_0x1eaaae[_0xac87('0x3f')]);_0x4a71ef[_0xac87('0x40')]=_[_0xac87('0x41')](_0x4a71ef[_0xac87('0x3e')],_0x4a71ef['query']);_0x5e745a['attributes']=_[_0xac87('0x41')](_0x4a71ef[_0xac87('0x3e')],qs[_0xac87('0x42')](_0x1eaaae['query']['fields']));_0x5e745a[_0xac87('0x43')]=_0x5e745a[_0xac87('0x43')][_0xac87('0x44')]?_0x5e745a[_0xac87('0x43')]:_0x4a71ef[_0xac87('0x3e')];if(!_0x1eaaae[_0xac87('0x3f')][_0xac87('0x45')](_0xac87('0x46'))){_0x5e745a['limit']=qs['limit'](_0x1eaaae[_0xac87('0x3f')][_0xac87('0x1e')]);_0x5e745a[_0xac87('0x20')]=qs['offset'](_0x1eaaae[_0xac87('0x3f')][_0xac87('0x20')]);}_0x5e745a[_0xac87('0x47')]=qs[_0xac87('0x48')](_0x1eaaae[_0xac87('0x3f')]['sort']);_0x5e745a[_0xac87('0x49')]=qs[_0xac87('0x40')](_['pick'](_0x1eaaae['query'],_0x4a71ef[_0xac87('0x40')]),_0x62e587);var _0xb8a65=[];var _0x166292=squel[_0xac87('0x4a')]()[_0xac87('0x4b')]('id')[_0xac87('0x4b')](_0xac87('0x28'))[_0xac87('0x4b')]('color')['from'](_0xac87('0x4c'));var _0x21fa09=squel[_0xac87('0x4a')]()[_0xac87('0x4b')](_0xac87('0x4d'))[_0xac87('0x4b')](_0xac87('0x4e'))[_0xac87('0x4b')](_0xac87('0x4f'))['from'](_0xac87('0x50'),'ui')['left_join'](_0xac87('0x51'),'u',_0xac87('0x52'));var _0x464db0=squel['select']()[_0xac87('0x53')]('fax_interactions','i')[_0xac87('0x54')]('cm_contacts','c',_0xac87('0x55'))[_0xac87('0x54')](_0xac87('0x51'),'o',_0xac87('0x56'))[_0xac87('0x54')](_0xac87('0x57'),'a','a.id\x20=\x20i.FaxAccountId')[_0xac87('0x54')](_0xac87('0x58'),'me',_0xac87('0x59'))[_0xac87('0x54')](_0xac87('0x5a'),'it',_0xac87('0x5b'))[_0xac87('0x54')]('tools_tags','t',_0xac87('0x5c'));var _0x124057=squel[_0xac87('0x5d')]();var _0x1c9ba0=[];var _0x425612=squel[_0xac87('0x5d')]();var _0x12524c;if(_0x1eaaae[_0xac87('0x3f')][_0xac87('0x5e')]){_0x12524c=as[_0xac87('0x5f')](_0x1eaaae[_0xac87('0x3f')]['search']);var _0x129cef=_0x12524c[_0xac87('0x60')];for(var _0x59cfb0=0x0;_0x59cfb0<_0x12524c['conditions'][_0xac87('0x44')];_0x59cfb0++){var _0x2bfa06=_0x12524c[_0xac87('0x61')][_0x59cfb0];var _0x282f25='i';var _0x299797=_['find'](_0x62e587,[_0xac87('0x28'),_0x2bfa06[_0xac87('0x4b')]]);if(!_0x299797){switch(_0x2bfa06[_0xac87('0x4b')]){case _0xac87('0x62'):if(_0x2bfa06[_0xac87('0x63')]==0x1){_0x464db0[_0xac87('0x64')]('`'+_0x2bfa06[_0xac87('0x4b')]+_0xac87('0x65'));}else{_0x464db0[_0xac87('0x64')]('`'+_0x2bfa06[_0xac87('0x4b')]+_0xac87('0x66'));}break;case'Contact':if(_0x2bfa06[_0xac87('0x67')]===_0xac87('0x68')){if(_0x2bfa06[_0xac87('0x63')]['split']('\x20')[_0xac87('0x44')]>0x1){_0x124057[_0x129cef](_0xac87('0x69'),qs[_0xac87('0x6a')](_0x2bfa06[_0xac87('0x63')]),null);}else{var _0xc4f561='%'+_0x2bfa06[_0xac87('0x63')]+'%';_0x124057[_0x129cef](_0xac87('0x6b'),_0xc4f561,_0xc4f561,_0xc4f561);}}else{_0x299797=_[_0xac87('0x6c')](_0x62e587,[_0xac87('0x28'),_0xac87('0x6d')]);_0x2bfa06[_0xac87('0x4b')]='ContactId';_0x5adfa7=as[_0xac87('0x6e')](_0x282f25,_0x299797[_0xac87('0x3c')],_0x2bfa06);_0x124057[_0x129cef](_0x5adfa7[_0xac87('0x6f')],_0x5adfa7[_0xac87('0x63')]['start'],_0x5adfa7[_0xac87('0x63')][_0xac87('0x1c')]);}break;case _0xac87('0x70'):var _0x1ca524=_0x2bfa06[_0xac87('0x63')]['split'](',')['map'](function(_0x464b84){return Number(_0x464b84);});_0x1ca524[_0xac87('0x2e')](function(_0x36d12f){_0x425612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36d12f+',%');});_0x1c9ba0=_['union'](_0x1c9ba0,_0x1ca524);break;case'User':if(_0x2bfa06[_0xac87('0x67')]===_0xac87('0x68')){_0x124057[_0x129cef](_0xac87('0x71'),'%'+_0x2bfa06[_0xac87('0x63')]+'%',null);}else{_0x299797=_[_0xac87('0x6c')](_0x62e587,['name',_0xac87('0x36')]);_0x2bfa06[_0xac87('0x4b')]=_0xac87('0x36');_0x5adfa7=as[_0xac87('0x6e')](_0x282f25,_0x299797[_0xac87('0x3c')],_0x2bfa06);_0x124057[_0x129cef](_0x5adfa7[_0xac87('0x6f')],_0x5adfa7[_0xac87('0x63')][_0xac87('0x72')],_0x5adfa7[_0xac87('0x63')][_0xac87('0x1c')]);}break;case'body':_0x5adfa7=as['buildExpression']('me',null,_0x2bfa06);_0x124057[_0x129cef](_0x5adfa7[_0xac87('0x6f')],_0x5adfa7[_0xac87('0x63')]['start'],_0x5adfa7[_0xac87('0x63')][_0xac87('0x1c')]);break;}}else{var _0x5adfa7=as[_0xac87('0x6e')](_0x282f25,_0x299797[_0xac87('0x3c')],_0x2bfa06);_0x124057[_0x129cef](_0x5adfa7[_0xac87('0x6f')],_0x5adfa7[_0xac87('0x63')][_0xac87('0x72')],_0x5adfa7[_0xac87('0x63')][_0xac87('0x1c')]);}}}else{var _0x448d69=_(_0x1eaaae[_0xac87('0x3f')])['keys']()['map'](function(_0xbc3c44){return _[_0xac87('0x73')](_0x62e587,[_0xac87('0x28'),_0xbc3c44])?_0xbc3c44:undefined;})[_0xac87('0x74')]()[_0xac87('0x63')]();if(!_['isEmpty'](_0x448d69)){_0x448d69[_0xac87('0x2e')](function(_0x22f6fb){if(_0x22f6fb==='FaxAccountId'){_0x464db0[_0xac87('0x49')](_0xac87('0x75'),[][_0xac87('0x76')](_0x1eaaae[_0xac87('0x3f')][_0x22f6fb]));}else if(_0x22f6fb===_0xac87('0x77')){var _0x44c7f4=JSON[_0xac87('0x78')](_0x1eaaae[_0xac87('0x3f')][_0x22f6fb])['$gte'];var _0x15b99a=JSON['parse'](_0x1eaaae[_0xac87('0x3f')][_0x22f6fb])[_0xac87('0x79')];_0x464db0[_0xac87('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x44c7f4,_0x15b99a);}else{if(_0x1eaaae[_0xac87('0x3f')][_0x22f6fb]===_0xac87('0x7a')){_0x464db0['where']('i.'+_0x22f6fb+_0xac87('0x7b'));}else{_0x464db0[_0xac87('0x49')]('i.'+_0x22f6fb+_0xac87('0x7c'),_0x1eaaae['query'][_0x22f6fb]);}}});}if(_0x1eaaae[_0xac87('0x3f')]['read']){if(_0x1eaaae['query']['read']==0x1){_0x464db0[_0xac87('0x64')]('`unreadMessages`\x20=\x200');}else{_0x464db0[_0xac87('0x64')](_0xac87('0x7d'));}}if(_0x1eaaae['query'][_0xac87('0x7e')]){_0x1c9ba0=_[_0xac87('0x7f')](_0x1eaaae[_0xac87('0x3f')][_0xac87('0x7e')])?_0x1eaaae['query'][_0xac87('0x7e')]:new Array(_0x1eaaae[_0xac87('0x3f')][_0xac87('0x7e')]);_0x1c9ba0[_0xac87('0x2e')](function(_0x556727){_0x425612['or'](_0xac87('0x80'),'%,'+_0x556727+',%');});}if(_0x1eaaae['query']['filter']){var _0xafe232=_0x1eaaae[_0xac87('0x3f')][_0xac87('0x81')][_0xac87('0x82')]('\x5c','\x5c\x5c')[_0xac87('0x82')](/'/g,'\x27\x27');if(qs[_0xac87('0x83')](_0xafe232)){_0x124057['or'](_0xac87('0x84'),_0xafe232+'%')['or'](_0xac87('0x85'),_0xafe232+'%');}_0x124057['or'](_0xac87('0x86'),_0xafe232+'%');}}_0x464db0[_0xac87('0x49')](_0x124057);_0x464db0[_0xac87('0x87')](_0xac87('0x88'));var _0x4d59ed={'type':db[_0xac87('0x89')]['QueryTypes'][_0xac87('0x8a')],'raw':!![]};var _0x4f2dcd=_0x464db0[_0xac87('0x8b')]();_0x4f2dcd[_0xac87('0x4b')](_0xac87('0x88'));_0x4f2dcd['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5e745a[_0xac87('0x47')]){_0x5e745a[_0xac87('0x47')]['forEach'](function(_0x14ff5){var _0x2ed33b=_0x14ff5[0x0]===_0xac87('0x8c')?_0x14ff5[0x0]:'i.'+_0x14ff5[0x0];_0x464db0['order'](_0x2ed33b,_0x14ff5[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1c9ba0)){_0x464db0[_0xac87('0x64')](_0x425612);_0x4f2dcd[_0xac87('0x49')](_0xac87('0x8d'),_0x1c9ba0);}BPromise[_0xac87('0x8e')]()[_0xac87('0x24')](function(){if(!_0x12524c){if(_0x1eaaae['query'][_0xac87('0x8f')])return;_0x4f2dcd['where'](_0xac87('0x90'));_0x464db0[_0xac87('0x49')](_0xac87('0x90'));return;}if(_0x1eaaae['user'][_0xac87('0x91')]!==_0xac87('0x92'))return;return _0x1eaaae['user'][_0xac87('0x93')]({'attributes':['id'],'raw':!![]})[_0xac87('0x24')](function(_0x190b1c){if(_['isEmpty'](_0x190b1c)){_0x4f2dcd[_0xac87('0x49')](_0xac87('0x94'));_0x464db0[_0xac87('0x49')](_0xac87('0x94'));}else{_0x4f2dcd[_0xac87('0x49')](_0xac87('0x75'),_[_0xac87('0x2a')](_0x190b1c,'id'));_0x464db0[_0xac87('0x49')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x190b1c,'id'));}});})[_0xac87('0x24')](function(){if(_0x1eaaae['user'][_0xac87('0x91')]===_0xac87('0x92')&&!_0x12524c&&!_0x1eaaae[_0xac87('0x3f')]['FaxAccountId'])return[];return db[_0xac87('0x95')][_0xac87('0x3f')](_0x4f2dcd[_0xac87('0x96')](),_0x4d59ed);})[_0xac87('0x24')](function(_0x159ec2){_0x2108d7[_0xac87('0x1f')]=_0x159ec2['length'];if(_0x2108d7[_0xac87('0x1f')]===0x0)return[];return db['sequelize'][_0xac87('0x3f')](_0x166292[_0xac87('0x96')](),_0x4d59ed)[_0xac87('0x24')](function(_0x2ccf23){_0xb8a65=_[_0xac87('0x97')](_0x2ccf23,'id');_0x4d59ed=_[_0xac87('0x98')](_0x4d59ed,{'model':db[_0xac87('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1eaaae[_0xac87('0x3f')]['fields']){_0x5e745a[_0xac87('0x43')][_0xac87('0x2e')](function(_0x42c32f){_0x464db0['field']('i.'+_0x42c32f);});}else{_0x464db0[_0xac87('0x4b')](_0xac87('0x99'),_0xac87('0x62'));_0x464db0[_0xac87('0x4b')](_0xac87('0x9a'),_0xac87('0x9b'));_0x464db0['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x464db0[_0xac87('0x4b')]('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',_0xac87('0x8c'));_0x464db0[_0xac87('0x4b')](_0xac87('0x9c'));_0x464db0[_0xac87('0x4b')](_0xac87('0x9d'),_0xac87('0x9e'));_0x464db0[_0xac87('0x4b')](_0xac87('0x9f'),_0xac87('0xa0'));_0x464db0[_0xac87('0x4b')](_0xac87('0xa1'),_0xac87('0xa2'));_0x464db0[_0xac87('0x4b')](_0xac87('0xa3'),_0xac87('0xa4'));_0x464db0[_0xac87('0x4b')](_0xac87('0xa5'),_0xac87('0xa6'));_0x464db0['field'](_0xac87('0xa7'),_0xac87('0xa8'));_0x464db0['field'](_0xac87('0xa9'),'Owner.fullname');_0x464db0[_0xac87('0x4b')](_0xac87('0xaa'),_0xac87('0xab'));_0x464db0['field'](_0xac87('0xac'),_0xac87('0x2b'));}if(_0x5e745a[_0xac87('0x1e')])_0x464db0[_0xac87('0x1e')](_0x5e745a[_0xac87('0x1e')]);if(_0x5e745a['offset'])_0x464db0[_0xac87('0x20')](_0x5e745a[_0xac87('0x20')]);return db[_0xac87('0x95')][_0xac87('0x3f')](_0x464db0[_0xac87('0x96')](),_0x4d59ed);})['then'](function(_0x203d84){if(_0x203d84['length']>0x0)_0x21fa09['where'](_0xac87('0xad'),_[_0xac87('0x2a')](_0x203d84,'id'));return db[_0xac87('0x95')][_0xac87('0x3f')](_0x21fa09[_0xac87('0x96')](),_0x4d59ed)[_0xac87('0x24')](function(_0x36070b){var _0x52665c=_[_0xac87('0xae')](_0x36070b,_0xac87('0xaf'));var _0x44617f=[];_0x203d84[_0xac87('0x2e')](function(_0x264052){_0x44617f[_0xac87('0x2f')](updateFaxInteraction(_0x264052,_0xb8a65,_0x52665c));});return BPromise[_0xac87('0xb0')](_0x44617f);});});})[_0xac87('0x24')](function(_0x198d22){_0x2108d7['rows']=_0x198d22;return _0x2108d7;})[_0xac87('0x24')](respondWithFilteredResult(_0x2ded8e,_0x5e745a))[_0xac87('0x30')](handleError(_0x2ded8e,null));};exports['show']=function(_0x229ed4,_0xc30e00){var _0x1cacb1={'raw':![],'where':{'id':_0x229ed4[_0xac87('0xb1')]['id']}},_0x4503c3={};_0x4503c3[_0xac87('0x3e')]=_[_0xac87('0xb2')](db[_0xac87('0x39')][_0xac87('0x3a')]);_0x4503c3['query']=_[_0xac87('0xb2')](_0x229ed4['query']);_0x4503c3['filters']=_['intersection'](_0x4503c3[_0xac87('0x3e')],_0x4503c3[_0xac87('0x3f')]);_0x1cacb1['attributes']=_[_0xac87('0x41')](_0x4503c3[_0xac87('0x3e')],qs[_0xac87('0x42')](_0x229ed4[_0xac87('0x3f')][_0xac87('0x42')]));_0x1cacb1[_0xac87('0x43')]=_0x1cacb1['attributes'][_0xac87('0x44')]?_0x1cacb1[_0xac87('0x43')]:_0x4503c3['model'];if(_0x229ed4['query'][_0xac87('0xb3')]){_0x1cacb1['include']=[{'all':!![]}];}_0x1cacb1=_['merge']({},_0x1cacb1,_0x229ed4[_0xac87('0xb4')]);return db['FaxInteraction'][_0xac87('0x6c')](_0x1cacb1)[_0xac87('0x24')](handleEntityNotFound(_0xc30e00,null))[_0xac87('0x24')](respondWithResult(_0xc30e00,null))['catch'](handleError(_0xc30e00,null));};exports[_0xac87('0xb5')]=function(_0x434f22,_0x5aa8f7){return db[_0xac87('0x39')][_0xac87('0xb5')](_0x434f22['body'],{})[_0xac87('0x24')](respondWithResult(_0x5aa8f7,0xc9))[_0xac87('0x30')](handleError(_0x5aa8f7,null));};exports[_0xac87('0xb6')]=function(_0x3bd477,_0x539743){if(_0x3bd477[_0xac87('0xb7')]['id']){delete _0x3bd477['body']['id'];}return db['FaxInteraction'][_0xac87('0x6c')]({'where':{'id':_0x3bd477['params']['id']}})[_0xac87('0x24')](handleEntityNotFound(_0x539743,null))['then'](saveUpdates(_0x3bd477[_0xac87('0xb7')],null))[_0xac87('0x24')](respondWithResult(_0x539743,null))[_0xac87('0x30')](handleError(_0x539743,null));};exports[_0xac87('0x25')]=function(_0x3ad092,_0x3c6265){return db[_0xac87('0x39')]['find']({'where':{'id':_0x3ad092[_0xac87('0xb1')]['id']}})[_0xac87('0x24')](handleEntityNotFound(_0x3c6265,null))['then'](removeEntity(_0x3c6265,null))['catch'](handleError(_0x3c6265,null));};exports['describe']=function(_0x1fe188,_0x59d7be){return db[_0xac87('0x39')]['describe']()[_0xac87('0x24')](respondWithResult(_0x59d7be,null))[_0xac87('0x30')](handleError(_0x59d7be,null));};exports[_0xac87('0xb8')]=function(_0x43dc99,_0x270898,_0x58cef8){return db['FaxMessage'][_0xac87('0x6c')]({'where':{'id':_0x43dc99['params']['id']}})[_0xac87('0x24')](handleEntityNotFound(_0x270898,null))[_0xac87('0x24')](function(_0x33ff2d){if(_0x33ff2d){return _0x33ff2d[_0xac87('0xb8')](_0x43dc99['body'][_0xac87('0xb9')],_[_0xac87('0xba')](_0x43dc99[_0xac87('0xb7')],['ids','id'])||{});}})['then'](respondWithResult(_0x270898,null))[_0xac87('0x30')](handleError(_0x270898,null));};exports[_0xac87('0xbb')]=function(_0x1b091a,_0x118f66,_0x22cf12){var _0x5a7aea={'raw':![],'where':{}};var _0x3454b6={};var _0x138c65={'count':0x0,'rows':[]};return db[_0xac87('0x39')][_0xac87('0xbc')]({'where':{'id':_0x1b091a[_0xac87('0xb1')]['id']}})[_0xac87('0x24')](handleEntityNotFound(_0x118f66,null))[_0xac87('0x24')](function(_0x23463c){if(_0x23463c){_0x3454b6[_0xac87('0x3e')]=_[_0xac87('0xb2')](db['FaxMessage']['rawAttributes']);_0x3454b6[_0xac87('0x3f')]=_[_0xac87('0xb2')](_0x1b091a['query']);_0x3454b6[_0xac87('0x40')]=_[_0xac87('0x41')](_0x3454b6['model'],_0x3454b6[_0xac87('0x3f')]);_0x5a7aea[_0xac87('0x43')]=_[_0xac87('0x41')](_0x3454b6[_0xac87('0x3e')],qs[_0xac87('0x42')](_0x1b091a[_0xac87('0x3f')][_0xac87('0x42')]));_0x5a7aea[_0xac87('0x43')]=_0x5a7aea[_0xac87('0x43')][_0xac87('0x44')]?_0x5a7aea[_0xac87('0x43')]:_0x3454b6[_0xac87('0x3e')];if(!_0x1b091a[_0xac87('0x3f')]['hasOwnProperty']('nolimit')){_0x5a7aea[_0xac87('0x1e')]=qs['limit'](_0x1b091a[_0xac87('0x3f')][_0xac87('0x1e')]);_0x5a7aea[_0xac87('0x20')]=qs[_0xac87('0x20')](_0x1b091a[_0xac87('0x3f')]['offset']);}_0x5a7aea[_0xac87('0x47')]=qs['sort'](_0x1b091a[_0xac87('0x3f')][_0xac87('0x48')]);_0x5a7aea[_0xac87('0x49')]=qs[_0xac87('0x40')](_[_0xac87('0xbd')](_0x1b091a['query'],_0x3454b6[_0xac87('0x40')]));_0x5a7aea['where'][_0xac87('0xaf')]=_0x23463c['id'];if(_0x1b091a['query'][_0xac87('0x81')]){_0x5a7aea[_0xac87('0x49')]=_[_0xac87('0x98')](_0x5a7aea[_0xac87('0x49')],{'$or':_['map'](_0x5a7aea['attributes'],function(_0x329397){var _0x286a87={};_0x286a87[_0x329397]={'$like':'%'+_0x1b091a['query'][_0xac87('0x81')]+'%'};return _0x286a87;})});}if(_0x1b091a[_0xac87('0x3f')][_0xac87('0xbe')]){var _0x5cb9a6=_0x1b091a[_0xac87('0x3f')][_0xac87('0xbe')]['split'](',');var _0x685bce={};_0x685bce[_0x5cb9a6[0x0]]={'$gte':moment(_0x5cb9a6[0x1])[_0xac87('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a7aea[_0xac87('0x49')]=_[_0xac87('0x98')](_0x5a7aea['where'],_0x685bce);}_0x5a7aea=_[_0xac87('0x98')]({},_0x5a7aea,_0x1b091a[_0xac87('0xb4')]);return db[_0xac87('0xc0')][_0xac87('0x1f')]({'where':_0x5a7aea[_0xac87('0x49')]})[_0xac87('0x24')](function(_0x4e791b){_0x138c65[_0xac87('0x1f')]=_0x4e791b;if(_0x1b091a[_0xac87('0x3f')][_0xac87('0xb3')]){_0x5a7aea[_0xac87('0xc1')]=[{'all':!![]}];}return db['FaxMessage'][_0xac87('0xc2')](_0x5a7aea);})[_0xac87('0x24')](function(_0x26719d){_0x138c65[_0xac87('0xc3')]=_0x26719d;return _0x138c65;});}})[_0xac87('0x24')](respondWithFilteredResult(_0x118f66,_0x5a7aea))[_0xac87('0x30')](handleError(_0x118f66,null));};exports[_0xac87('0xc4')]=function(_0x7b0147,_0x5aa06f,_0x2bb44e){return db['FaxInteraction']['find']({'where':{'id':_0x7b0147[_0xac87('0xb1')]['id']}})[_0xac87('0x24')](handleEntityNotFound(_0x5aa06f,null))[_0xac87('0x24')](function(_0x48e36e){if(_0x48e36e){return _0x48e36e[_0xac87('0xc5')](_0x7b0147['body'][_0xac87('0xb9')],_['omit'](_0x7b0147[_0xac87('0xb7')],[_0xac87('0xb9'),'id'])||{})[_0xac87('0xc6')](function(){return db[_0xac87('0x70')][_0xac87('0xc2')]({'attributes':['id','name',_0xac87('0xc7')],'where':{'id':_0x7b0147[_0xac87('0xb7')]['ids']}});})[_0xac87('0x24')](function(_0x180cde){socket[_0xac87('0xc8')]('faxInteractionTags:save',{'id':Number(_0x7b0147['params']['id']),'tags':_0x180cde||[]});return{'id':Number(_0x7b0147[_0xac87('0xb1')]['id']),'tags':_0x180cde||[]};});}})[_0xac87('0x24')](respondWithResult(_0x5aa06f,null))[_0xac87('0x30')](handleError(_0x5aa06f,null));};exports[_0xac87('0xc9')]=function(_0x1f90db,_0x3e4372,_0x56ed3c){return db[_0xac87('0x39')][_0xac87('0x6c')]({'where':{'id':_0x1f90db[_0xac87('0xb1')]['id']}})[_0xac87('0x24')](handleEntityNotFound(_0x3e4372,null))[_0xac87('0x24')](function(_0x304041){if(_0x304041){return _0x304041['removeTags'](_0x1f90db[_0xac87('0x3f')][_0xac87('0xb9')]);}})[_0xac87('0x24')](respondWithStatusCode(_0x3e4372,null))[_0xac87('0x30')](handleError(_0x3e4372,null));};exports['download']=function(_0x25f909,_0x29f0c1){var _0x342f65=moment()[_0xac87('0xca')]()[_0xac87('0x96')]();var _0xa7f73=path[_0xac87('0xcb')](config[_0xac87('0xcc')],'server',_0xac87('0xcd'),_0xac87('0xce'));var _0x547d5b=path['join'](config[_0xac87('0xcc')],'server',_0xac87('0xcd'),_0xac87('0xcf'));var _0x336af4=path[_0xac87('0xcb')](_0xa7f73,_0x342f65);var _0x45b6f1=util[_0xac87('0xbf')](_0xac87('0xd0'),_0x25f909[_0xac87('0xb1')]['id'],_0x342f65);var _0x5b1d91=path[_0xac87('0xcb')](_0xa7f73,_0x45b6f1);var _0x4dacb2=[];_0x4dacb2[_0xac87('0x2f')]({'model':db[_0xac87('0xd1')],'as':'Attachment','raw':!![]});var _0x797ca7=[{'model':db[_0xac87('0xc0')],'as':_0xac87('0xd2'),'attributes':['id',_0xac87('0xb7'),_0xac87('0x77')],'include':_0x4dacb2}];return db['FaxInteraction'][_0xac87('0x6c')]({'where':{'id':_0x25f909[_0xac87('0xb1')]['id']},'include':_0x797ca7})['then'](handleEntityNotFound(_0x29f0c1,null))['then'](function(_0x3cdc09){if(_0x3cdc09&&_0x3cdc09[_0xac87('0xd2')]){var _0x3e284d=_0x3cdc09[_0xac87('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x336af4);for(var _0x26f741=0x0;_0x26f741<_0x3e284d['Messages']['length'];_0x26f741++){var _0x8bc296=_0x3e284d[_0xac87('0xd2')][_0x26f741][_0xac87('0xd1')];if(_0x8bc296){var _0x396864=path[_0xac87('0xcb')](_0x547d5b,_0x8bc296[_0xac87('0xd4')]);if(fs[_0xac87('0xd5')](_0x396864)){fs[_0xac87('0xd6')](_0x396864)[_0xac87('0xd7')](fs[_0xac87('0xd8')](path['join'](_0x336af4,_0x8bc296[_0xac87('0xd4')])));}}}return BPromise['resolve']()[_0xac87('0x24')](function(){return new BPromise(function(_0x45aeb3,_0x363b19){zipdir(_0x336af4,{'saveTo':_0x5b1d91},function(_0x55511b,_0x46ea45){if(_0x55511b)return _0x363b19(_0x55511b);return _0x45aeb3(_0x46ea45);});})[_0xac87('0x24')](function(){return new BPromise(function(_0xa2c867,_0x20380f){rimraf(_0x336af4,function(_0x4fa3ab){if(_0x4fa3ab)_0x20380f(_0x4fa3ab);return _0xa2c867();});});})['then'](function(){return _0x29f0c1[_0xac87('0xd9')](_0x5b1d91,_0x45b6f1,function(_0x35da15){if(_0x35da15){console['log'](_0xac87('0xda'),_0x35da15);}else{fs[_0xac87('0xdb')](_0x5b1d91);}});});});}else{return _0x29f0c1[_0xac87('0x1a')](0xc8);}})[_0xac87('0x30')](handleError(_0x29f0c1,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f73b829..e4ba32a 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 _0xdfaf=['then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers'];(function(_0x14af1b,_0x25cff8){var _0x4acefb=function(_0x327bcf){while(--_0x327bcf){_0x14af1b['push'](_0x14af1b['shift']());}};_0x4acefb(++_0x25cff8);}(_0xdfaf,0x13d));var _0xfdfa=function(_0xbef9cf,_0x554612){_0xbef9cf=_0xbef9cf-0x0;var _0x44c9d3=_0xdfaf[_0xbef9cf];return _0x44c9d3;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xfdfa('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xfdfa('0x0'))['db'][_0xfdfa('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xfdfa('0x2')](0x0);var events={'afterCreate':_0xfdfa('0x3'),'afterUpdate':_0xfdfa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1cf142){return function(_0x5092b4,_0x393ef7,_0x57785a){_0x5092b4[_0xfdfa('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdfa('0x6')](function(_0x464aa0){_0x5092b4['setDataValue'](_0xfdfa('0x7'),_0x464aa0[_0xfdfa('0x8')](function(_0x1a8740){return{'id':_0x1a8740['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5092b4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdfa('0x6')](function(_0xeb13fb){_0x5092b4[_0xfdfa('0x9')](_0xfdfa('0xa'),_0xeb13fb[_0xfdfa('0xb')]);FaxInteractionEvents[_0xfdfa('0xc')](_0x1cf142+':'+_0x5092b4['id'],_0x5092b4);FaxInteractionEvents[_0xfdfa('0xc')](_0x1cf142,_0x5092b4);_0x57785a(null);})[_0xfdfa('0xd')](_0x57785a(null));};}for(var e in events){if(events[_0xfdfa('0xe')](e)){var event=events[e];FaxInteraction[_0xfdfa('0xf')](e,emitEvent(event));}}module[_0xfdfa('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ccf=['map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','remove','getUsers','then','Users'];(function(_0x1d5fb9,_0x43aa73){var _0xd72009=function(_0x44052e){while(--_0x44052e){_0x1d5fb9['push'](_0x1d5fb9['shift']());}};_0xd72009(++_0x43aa73);}(_0x2ccf,0x1e5));var _0xf2cc=function(_0x5c50f0,_0x2c9b49){_0x5c50f0=_0x5c50f0-0x0;var _0x25d2b4=_0x2ccf[_0x5c50f0];return _0x25d2b4;};'use strict';var EventEmitter=require(_0xf2cc('0x0'));var FaxInteraction=require(_0xf2cc('0x1'))['db'][_0xf2cc('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf2cc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf2cc('0x4')};function emitEvent(_0x5922fd){return function(_0x4a8465,_0x3fe59c,_0x583cb9){_0x4a8465[_0xf2cc('0x5')]({'attributes':['id'],'raw':!![]})[_0xf2cc('0x6')](function(_0x488a5f){_0x4a8465['setDataValue'](_0xf2cc('0x7'),_0x488a5f[_0xf2cc('0x8')](function(_0x563218){return{'id':_0x563218['id']};}));return FaxMessage[_0xf2cc('0x9')]({'where':{'FaxInteractionId':_0x4a8465['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf2cc('0x6')](function(_0x1927dc){_0x4a8465[_0xf2cc('0xa')]('unreadMessages',_0x1927dc[_0xf2cc('0xb')]);FaxInteractionEvents[_0xf2cc('0xc')](_0x5922fd+':'+_0x4a8465['id'],_0x4a8465);FaxInteractionEvents[_0xf2cc('0xc')](_0x5922fd,_0x4a8465);_0x583cb9(null);})[_0xf2cc('0xd')](_0x583cb9(null));};}for(var e in events){if(events[_0xf2cc('0xe')](e)){var event=events[e];FaxInteraction[_0xf2cc('0xf')](e,emitEvent(event));}}module[_0xf2cc('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b6f9904..1f9b700 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 _0xf27d=['lodash','../../config/logger','moment','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3f7dee,_0x23bea2){var _0x2bae94=function(_0x2105d6){while(--_0x2105d6){_0x3f7dee['push'](_0x3f7dee['shift']());}};_0x2bae94(++_0x23bea2);}(_0xf27d,0xc3));var _0xdf27=function(_0x14a611,_0x544d30){_0x14a611=_0x14a611-0x0;var _0x594f23=_0xf27d[_0x14a611];return _0x594f23;};'use strict';var _=require(_0xdf27('0x0'));var util=require('util');var logger=require(_0xdf27('0x1'))('api');var moment=require(_0xdf27('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf27('0x3'));var rimraf=require(_0xdf27('0x4'));var config=require(_0xdf27('0x5'));var attributes=require(_0xdf27('0x6'));module[_0xdf27('0x7')]=function(_0xea5213,_0x550b91){return _0xea5213[_0xdf27('0x8')](_0xdf27('0x9'),attributes,{'tableName':_0xdf27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x158754,_0x5e5530,_0x4b0041){if(_0x158754[_0xdf27('0xb')](_0xdf27('0xc'))){_0x158754['closedAt']=moment()[_0xdf27('0xd')](_0xdf27('0xe'));}_0x4b0041(null,_0x158754);}}});}; \ No newline at end of file +var _0x1740=['exports','define','FaxInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xa2a3a0,_0x1f5cf9){var _0x3648cc=function(_0x5d68ba){while(--_0x5d68ba){_0xa2a3a0['push'](_0xa2a3a0['shift']());}};_0x3648cc(++_0x1f5cf9);}(_0x1740,0x1c6));var _0x0174=function(_0x205d12,_0x4e3ccb){_0x205d12=_0x205d12-0x0;var _0x1e958d=_0x1740[_0x205d12];return _0x1e958d;};'use strict';var _=require(_0x0174('0x0'));var util=require(_0x0174('0x1'));var logger=require(_0x0174('0x2'))(_0x0174('0x3'));var moment=require(_0x0174('0x4'));var BPromise=require(_0x0174('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0174('0x6'));var rimraf=require(_0x0174('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x0174('0x8')]=function(_0x12536e,_0x4ad777){return _0x12536e[_0x0174('0x9')](_0x0174('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x148600,_0x28ca8e,_0x406f1a){if(_0x148600[_0x0174('0xb')]('closed')){_0x148600[_0x0174('0xc')]=moment()['format'](_0x0174('0xd'));}_0x406f1a(null,_0x148600);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e477ebb..870c569 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 _0x7823=['ids','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','find','where','addTags'];(function(_0x454fe7,_0x492eba){var _0x30f729=function(_0x54f9c1){while(--_0x54f9c1){_0x454fe7['push'](_0x454fe7['shift']());}};_0x30f729(++_0x492eba);}(_0x7823,0xac));var _0x3782=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7823[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x3782('0x0'));var moment=require(_0x3782('0x1'));var BPromise=require('bluebird');var rs=require(_0x3782('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3782('0x3'))['db'];var utils=require(_0x3782('0x4'));var logger=require('../../config/logger')(_0x3782('0x5'));var config=require(_0x3782('0x6'));var jayson=require(_0x3782('0x7'));var client=jayson[_0x3782('0x8')][_0x3782('0x9')]({'port':0x232a});config['redis']=_[_0x3782('0xa')](config[_0x3782('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3782('0xc'))(new Redis(config[_0x3782('0xb')]));require(_0x3782('0xd'))[_0x3782('0xe')](socket);function respondWithRpcPromise(_0x728539,_0x500f3c,_0x546341){return new BPromise(function(_0x39d518,_0x47e94d){return client[_0x3782('0xf')](_0x728539,_0x546341)[_0x3782('0x10')](function(_0x3f639d){logger[_0x3782('0x11')](_0x3782('0x12'),_0x500f3c,_0x3782('0x13'));logger[_0x3782('0x14')](_0x3782('0x15'),_0x500f3c,'request\x20sent',JSON[_0x3782('0x16')](_0x3f639d));if(_0x3f639d[_0x3782('0x17')]){if(_0x3f639d['error'][_0x3782('0x18')]===0x1f4){logger['error'](_0x3782('0x12'),_0x500f3c,_0x3f639d[_0x3782('0x17')][_0x3782('0x19')]);return _0x47e94d(_0x3f639d[_0x3782('0x17')][_0x3782('0x19')]);}logger['error'](_0x3782('0x12'),_0x500f3c,_0x3f639d[_0x3782('0x17')][_0x3782('0x19')]);return _0x39d518(_0x3f639d['error']['message']);}else{logger[_0x3782('0x11')](_0x3782('0x12'),_0x500f3c,_0x3782('0x13'));_0x39d518(_0x3f639d[_0x3782('0x1a')][_0x3782('0x19')]);}})[_0x3782('0x1b')](function(_0x460d38){logger['error'](_0x3782('0x12'),_0x500f3c,_0x460d38);_0x47e94d(_0x460d38);});});}exports[_0x3782('0x1c')]=function(_0x492f54){var _0x810c79=this;return new Promise(function(_0x2e395f,_0x585d0a){return db[_0x3782('0x1d')][_0x3782('0x1e')](_0x492f54[_0x3782('0x1f')],{'raw':_0x492f54[_0x3782('0x20')]?_0x492f54[_0x3782('0x20')][_0x3782('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x492f54['options']?_0x492f54[_0x3782('0x20')]['where']||null:null,'attributes':_0x492f54[_0x3782('0x20')]?_0x492f54[_0x3782('0x20')][_0x3782('0x22')]||null:null,'limit':_0x492f54[_0x3782('0x20')]?_0x492f54[_0x3782('0x20')]['limit']||null:null})[_0x3782('0x10')](function(_0x5587db){logger['info'](_0x3782('0x1c'),_0x492f54);logger[_0x3782('0x14')](_0x3782('0x1c'),_0x492f54,JSON[_0x3782('0x16')](_0x5587db));_0x2e395f(_0x5587db);})['catch'](function(_0xe9078e){logger[_0x3782('0x17')](_0x3782('0x1c'),_0xe9078e[_0x3782('0x19')],_0x492f54);_0x585d0a(_0x810c79[_0x3782('0x17')](0x1f4,_0xe9078e[_0x3782('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2f5264){return new Promise(function(_0x41c533,_0x1b1c49){return db['FaxInteraction'][_0x3782('0x23')]({'where':_0x2f5264[_0x3782('0x20')]?_0x2f5264['options'][_0x3782('0x24')]||null:null})[_0x3782('0x10')](function(_0x1c63b1){if(_0x1c63b1){return _0x1c63b1[_0x3782('0x25')](_0x2f5264['body'][_0x3782('0x26')],_[_0x3782('0x27')](_0x2f5264['body'],[_0x3782('0x26'),'id'])||{});}})[_0x3782('0x28')](function(_0x3a24a2){logger['info']('AddTags',_0x2f5264);logger[_0x3782('0x14')](_0x3782('0x29'),_0x2f5264,JSON[_0x3782('0x16')](_0x3a24a2));_0x41c533(_0x3a24a2);})[_0x3782('0x1b')](function(_0x1398f8){logger[_0x3782('0x17')](_0x3782('0x29'),_0x1398f8['message'],_0x2f5264);_0x1b1c49(_this[_0x3782('0x17')](0x1f4,_0x1398f8[_0x3782('0x19')]));});});}; \ No newline at end of file +var _0x201e=['AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','stringify','AddTagsToFaxInteraction','ids','omit','body'];(function(_0x5e1762,_0x1d111d){var _0x1c8327=function(_0x2ea153){while(--_0x2ea153){_0x5e1762['push'](_0x5e1762['shift']());}};_0x1c8327(++_0x1d111d);}(_0x201e,0xe5));var _0xe201=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x201e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xe201('0x0'));var util=require(_0xe201('0x1'));var moment=require(_0xe201('0x2'));var BPromise=require('bluebird');var rs=require(_0xe201('0x3'));var fs=require('fs');var Redis=require(_0xe201('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe201('0x5'));var logger=require(_0xe201('0x6'))(_0xe201('0x7'));var config=require(_0xe201('0x8'));var jayson=require(_0xe201('0x9'));var client=jayson['client'][_0xe201('0xa')]({'port':0x232a});config[_0xe201('0xb')]=_['defaults'](config['redis'],{'host':_0xe201('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe201('0xb')]));require('./faxInteraction.socket')[_0xe201('0xd')](socket);function respondWithRpcPromise(_0x4a6aad,_0xa37d26,_0x3d3db3){return new BPromise(function(_0x4d8a25,_0x48d659){return client[_0xe201('0xe')](_0x4a6aad,_0x3d3db3)[_0xe201('0xf')](function(_0x58605f){logger[_0xe201('0x10')](_0xe201('0x11'),_0xa37d26,_0xe201('0x12'));logger[_0xe201('0x13')](_0xe201('0x14'),_0xa37d26,_0xe201('0x12'),JSON['stringify'](_0x58605f));if(_0x58605f['error']){if(_0x58605f['error'][_0xe201('0x15')]===0x1f4){logger['error'](_0xe201('0x11'),_0xa37d26,_0x58605f['error'][_0xe201('0x16')]);return _0x48d659(_0x58605f['error'][_0xe201('0x16')]);}logger[_0xe201('0x17')](_0xe201('0x11'),_0xa37d26,_0x58605f[_0xe201('0x17')][_0xe201('0x16')]);return _0x4d8a25(_0x58605f[_0xe201('0x17')]['message']);}else{logger[_0xe201('0x10')](_0xe201('0x11'),_0xa37d26,_0xe201('0x12'));_0x4d8a25(_0x58605f[_0xe201('0x18')][_0xe201('0x16')]);}})[_0xe201('0x19')](function(_0x3826b1){logger[_0xe201('0x17')](_0xe201('0x11'),_0xa37d26,_0x3826b1);_0x48d659(_0x3826b1);});});}exports[_0xe201('0x1a')]=function(_0x399672){var _0x5d831c=this;return new Promise(function(_0x5adbec,_0x31c602){return db[_0xe201('0x1b')][_0xe201('0x1c')](_0x399672['body'],{'raw':_0x399672[_0xe201('0x1d')]?_0x399672[_0xe201('0x1d')][_0xe201('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399672[_0xe201('0x1d')]?_0x399672['options']['where']||null:null,'attributes':_0x399672[_0xe201('0x1d')]?_0x399672[_0xe201('0x1d')][_0xe201('0x1f')]||null:null,'limit':_0x399672[_0xe201('0x1d')]?_0x399672[_0xe201('0x1d')]['limit']||null:null})[_0xe201('0xf')](function(_0x52b9b4){logger['info'](_0xe201('0x1a'),_0x399672);logger[_0xe201('0x13')](_0xe201('0x1a'),_0x399672,JSON[_0xe201('0x20')](_0x52b9b4));_0x5adbec(_0x52b9b4);})[_0xe201('0x19')](function(_0x5a0a85){logger[_0xe201('0x17')](_0xe201('0x1a'),_0x5a0a85[_0xe201('0x16')],_0x399672);_0x31c602(_0x5d831c[_0xe201('0x17')](0x1f4,_0x5a0a85[_0xe201('0x16')]));});});};exports[_0xe201('0x21')]=function(_0x193915){return new Promise(function(_0x1a489f,_0x4c773a){return db['FaxInteraction']['find']({'where':_0x193915[_0xe201('0x1d')]?_0x193915[_0xe201('0x1d')]['where']||null:null})[_0xe201('0xf')](function(_0x1bca63){if(_0x1bca63){return _0x1bca63['addTags'](_0x193915['body'][_0xe201('0x22')],_[_0xe201('0x23')](_0x193915[_0xe201('0x24')],[_0xe201('0x22'),'id'])||{});}})['spread'](function(_0x516264){logger[_0xe201('0x10')]('AddTags',_0x193915);logger[_0xe201('0x13')]('AddTags',_0x193915,JSON[_0xe201('0x20')](_0x516264));_0x1a489f(_0x516264);})[_0xe201('0x19')](function(_0x102946){logger[_0xe201('0x17')](_0xe201('0x25'),_0x102946['message'],_0x193915);_0x4c773a(_this[_0xe201('0x17')](0x1f4,_0x102946[_0xe201('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 89fdbff..8342320 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 _0x366d=['./faxInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x29631a,_0x417c1a){var _0x33e15a=function(_0x3adf84){while(--_0x3adf84){_0x29631a['push'](_0x29631a['shift']());}};_0x33e15a(++_0x417c1a);}(_0x366d,0x126));var _0xd366=function(_0x59fd84,_0x3df774){_0x59fd84=_0x59fd84-0x0;var _0x3bbb6f=_0x366d[_0x59fd84];return _0x3bbb6f;};'use strict';var FaxInteractionEvents=require(_0xd366('0x0'));var events=['save',_0xd366('0x1'),_0xd366('0x2')];function createListener(_0x318686,_0x2d4364){return function(_0x27c9ab){_0x2d4364[_0xd366('0x3')](_0x318686,_0x27c9ab);};}function removeListener(_0x5185eb,_0x1b6175){return function(){FaxInteractionEvents[_0xd366('0x4')](_0x5185eb,_0x1b6175);};}exports[_0xd366('0x5')]=function(_0x1e5078){for(var _0x5e98a6=0x0,_0x5119a1=events[_0xd366('0x6')];_0x5e98a6<_0x5119a1;_0x5e98a6++){var _0x322c66=events[_0x5e98a6];var _0x4651bd=createListener('faxInteraction:'+_0x322c66,_0x1e5078);FaxInteractionEvents['on'](_0x322c66,_0x4651bd);}}; \ No newline at end of file +var _0x2b61=['./faxInteraction.events','save','remove','emit','register','length'];(function(_0x168c21,_0x204248){var _0x52b8a8=function(_0x459d87){while(--_0x459d87){_0x168c21['push'](_0x168c21['shift']());}};_0x52b8a8(++_0x204248);}(_0x2b61,0xba));var _0x12b6=function(_0x30ba85,_0x503490){_0x30ba85=_0x30ba85-0x0;var _0x58b533=_0x2b61[_0x30ba85];return _0x58b533;};'use strict';var FaxInteractionEvents=require(_0x12b6('0x0'));var events=[_0x12b6('0x1'),_0x12b6('0x2'),'update'];function createListener(_0x2efa3a,_0x5c09ae){return function(_0x12d57c){_0x5c09ae[_0x12b6('0x3')](_0x2efa3a,_0x12d57c);};}function removeListener(_0x5bbecc,_0x4a8e73){return function(){FaxInteractionEvents['removeListener'](_0x5bbecc,_0x4a8e73);};}exports[_0x12b6('0x4')]=function(_0xc512f2){for(var _0x3f3930=0x0,_0x187883=events[_0x12b6('0x5')];_0x3f3930<_0x187883;_0x3f3930++){var _0x334f97=events[_0x3f3930];var _0xea5d59=createListener('faxInteraction:'+_0x334f97,_0xc512f2);FaxInteractionEvents['on'](_0x334f97,_0xea5d59);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ad00aa5..d971e98 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 _0x84b5=['../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','addTags','put','fax','faxinteraction:update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x84b5,0xa9));var _0x584b=function(_0x3dd2a8,_0x1c9e86){_0x3dd2a8=_0x3dd2a8-0x0;var _0x261f37=_0x84b5[_0x3dd2a8];return _0x261f37;};'use strict';var multer=require('multer');var util=require(_0x584b('0x0'));var path=require('path');var timeout=require(_0x584b('0x1'));var express=require(_0x584b('0x2'));var router=express['Router']();var fs_extra=require(_0x584b('0x3'));var auth=require(_0x584b('0x4'));var interaction=require(_0x584b('0x5'));var config=require(_0x584b('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x584b('0x7')](),controller['index']);router['get'](_0x584b('0x8'),auth[_0x584b('0x7')](),controller[_0x584b('0x9')]);router[_0x584b('0xa')](_0x584b('0xb'),auth[_0x584b('0x7')](),controller[_0x584b('0xc')]);router[_0x584b('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x584b('0xd')]);router[_0x584b('0xa')](_0x584b('0xe'),auth['isAuthenticated'](),controller[_0x584b('0xf')]);router[_0x584b('0x10')]('/',auth[_0x584b('0x7')](),controller[_0x584b('0x11')]);router[_0x584b('0x10')](_0x584b('0x12'),auth[_0x584b('0x7')](),controller[_0x584b('0x13')]);router[_0x584b('0x10')](_0x584b('0x14'),auth[_0x584b('0x7')](),interaction[_0x584b('0x15')]('fax','faxinteraction:addtags'),controller[_0x584b('0x16')]);router[_0x584b('0x17')](_0x584b('0xb'),auth[_0x584b('0x7')](),interaction['tracked'](_0x584b('0x18'),_0x584b('0x19')),controller['update']);router[_0x584b('0x1a')](_0x584b('0xb'),auth['isAuthenticated'](),interaction[_0x584b('0x15')]('fax','faxinteraction:destroy'),controller[_0x584b('0x1b')]);router[_0x584b('0x1a')](_0x584b('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0x584b('0x1c')]=router; \ No newline at end of file +var _0x0adb=['/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','addTags','put','fax','faxinteraction:update','update','delete','destroy'];(function(_0x4a90e0,_0x47c7cd){var _0x4cb6d1=function(_0x2cf359){while(--_0x2cf359){_0x4a90e0['push'](_0x4a90e0['shift']());}};_0x4cb6d1(++_0x47c7cd);}(_0x0adb,0x1c4));var _0xb0ad=function(_0x28dab9,_0x2829df){_0x28dab9=_0x28dab9-0x0;var _0x11deae=_0x0adb[_0x28dab9];return _0x11deae;};'use strict';var multer=require('multer');var util=require(_0xb0ad('0x0'));var path=require(_0xb0ad('0x1'));var timeout=require(_0xb0ad('0x2'));var express=require(_0xb0ad('0x3'));var router=express[_0xb0ad('0x4')]();var fs_extra=require(_0xb0ad('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb0ad('0x6'));var controller=require(_0xb0ad('0x7'));router[_0xb0ad('0x8')]('/',auth[_0xb0ad('0x9')](),controller[_0xb0ad('0xa')]);router[_0xb0ad('0x8')](_0xb0ad('0xb'),auth[_0xb0ad('0x9')](),controller['describe']);router[_0xb0ad('0x8')](_0xb0ad('0xc'),auth[_0xb0ad('0x9')](),controller[_0xb0ad('0xd')]);router[_0xb0ad('0x8')](_0xb0ad('0xe'),auth['isAuthenticated'](),controller[_0xb0ad('0xf')]);router['get'](_0xb0ad('0x10'),auth[_0xb0ad('0x9')](),controller['download']);router[_0xb0ad('0x11')]('/',auth[_0xb0ad('0x9')](),controller[_0xb0ad('0x12')]);router[_0xb0ad('0x11')](_0xb0ad('0xe'),auth['isAuthenticated'](),controller[_0xb0ad('0x13')]);router[_0xb0ad('0x11')]('/:id/tags',auth[_0xb0ad('0x9')](),interaction[_0xb0ad('0x14')]('fax','faxinteraction:addtags'),controller[_0xb0ad('0x15')]);router[_0xb0ad('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xb0ad('0x14')](_0xb0ad('0x17'),_0xb0ad('0x18')),controller[_0xb0ad('0x19')]);router[_0xb0ad('0x1a')](_0xb0ad('0xc'),auth[_0xb0ad('0x9')](),interaction[_0xb0ad('0x14')](_0xb0ad('0x17'),'faxinteraction:destroy'),controller[_0xb0ad('0x1b')]);router[_0xb0ad('0x1a')](_0xb0ad('0x1c'),auth[_0xb0ad('0x9')](),controller[_0xb0ad('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0a6ada0..5bbea9f 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 _0x0e85=['exports','medium','BOOLEAN','TEXT','sequelize'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x0e85,0x7c));var _0x50e8=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0e85[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x50e8('0x0'));module[_0x50e8('0x1')]={'body':{'type':Sequelize['TEXT'](_0x50e8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x50e8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x50e8('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xda65=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x246694,_0x555b7c){var _0x264b96=function(_0x338f29){while(--_0x338f29){_0x246694['push'](_0x246694['shift']());}};_0x264b96(++_0x555b7c);}(_0xda65,0x1d0));var _0x5da6=function(_0x1c366e,_0x418363){_0x1c366e=_0x1c366e-0x0;var _0x12fdee=_0xda65[_0x1c366e];return _0x12fdee;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'body':{'type':Sequelize[_0x5da6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5da6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5da6('0x4')]('in',_0x5da6('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5da6('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index dac0176..3577b0d 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 _0xc151=['attachments','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','findAll','rows','show','params','includeAll','include','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','user','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','email','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xc151,0x90));var _0x1c15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc151[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1c15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c15('0x1'));var jsonpatch=require(_0x1c15('0x2'));var rp=require('request-promise');var moment=require(_0x1c15('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1c15('0x4'));var util=require(_0x1c15('0x5'));var path=require(_0x1c15('0x6'));var sox=require(_0x1c15('0x7'));var csv=require(_0x1c15('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c15('0x9'));var squel=require(_0x1c15('0xa'));var crypto=require(_0x1c15('0xb'));var jsforce=require(_0x1c15('0xc'));var deskjs=require(_0x1c15('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1c15('0xe'));var authService=require(_0x1c15('0xf'));var qs=require(_0x1c15('0x10'));var as=require(_0x1c15('0x11'));var hardwareService=require(_0x1c15('0x12'));var logger=require(_0x1c15('0x13'))(_0x1c15('0x14'));var utils=require(_0x1c15('0x15'));var config=require(_0x1c15('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c15('0x17'))['db'];config[_0x1c15('0x18')]=_[_0x1c15('0x19')](config[_0x1c15('0x18')],{'host':_0x1c15('0x1a'),'port':0x18eb});var socket=require(_0x1c15('0x1b'))(new Redis(config[_0x1c15('0x18')]));require(_0x1c15('0x1c'))[_0x1c15('0x1d')](socket);var jayson=require(_0x1c15('0x1e'));var client=jayson[_0x1c15('0x1f')][_0x1c15('0x20')]({'port':0x232c});var client9002=jayson[_0x1c15('0x1f')][_0x1c15('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4afcab,_0x38aad2,_0x443f54,_0x82c4db){return new BPromise(function(_0x16450c,_0x5ec3b3){var _0xe16df8=_0x82c4db||client;return _0xe16df8[_0x1c15('0x21')](_0x4afcab,_0x443f54)[_0x1c15('0x22')](function(_0xe31976){logger[_0x1c15('0x23')](_0x1c15('0x24'),_0x38aad2,_0x1c15('0x25'));logger[_0x1c15('0x26')](_0x1c15('0x27'),_0x38aad2,_0x1c15('0x25'),JSON[_0x1c15('0x28')](_0xe31976));if(_0xe31976[_0x1c15('0x29')]){if(_0xe31976[_0x1c15('0x29')]['code']===0x1f4){logger[_0x1c15('0x29')](_0x1c15('0x24'),_0x38aad2,_0xe31976['error'][_0x1c15('0x2a')]);return _0x5ec3b3(_0xe31976['error'][_0x1c15('0x2a')]);}logger[_0x1c15('0x29')]('FaxMessage,\x20%s,\x20%s',_0x38aad2,_0xe31976[_0x1c15('0x29')][_0x1c15('0x2a')]);return _0x16450c(_0xe31976[_0x1c15('0x29')][_0x1c15('0x2a')]);}else{logger[_0x1c15('0x23')](_0x1c15('0x24'),_0x38aad2,_0x1c15('0x25'));_0x16450c(_0xe31976['result'][_0x1c15('0x2a')]);}})[_0x1c15('0x2b')](function(_0x1ce701){logger[_0x1c15('0x29')](_0x1c15('0x24'),_0x38aad2,_0x1ce701);_0x5ec3b3(_0x1ce701);});});}function respondWithStatusCode(_0x25a61a,_0x123952){_0x123952=_0x123952||0xcc;return function(_0xd05661){if(_0xd05661){return _0x25a61a[_0x1c15('0x2c')](_0x123952);}return _0x25a61a[_0x1c15('0x2d')](_0x123952)[_0x1c15('0x2e')]();};}function respondWithResult(_0x1465e7,_0x478e91){_0x478e91=_0x478e91||0xc8;return function(_0xafdc86){if(_0xafdc86){return _0x1465e7[_0x1c15('0x2d')](_0x478e91)[_0x1c15('0x2f')](_0xafdc86);}};}function respondWithFilteredResult(_0x5e9712,_0x41c8a3){return function(_0x416ea4){if(_0x416ea4){var _0xc7f3c5=typeof _0x41c8a3[_0x1c15('0x30')]===_0x1c15('0x31')&&typeof _0x41c8a3[_0x1c15('0x32')]===_0x1c15('0x31');var _0x59d16f=_0x416ea4[_0x1c15('0x33')];var _0x26ace8=_0xc7f3c5?0x0:_0x41c8a3[_0x1c15('0x30')];var _0x1c7445=_0xc7f3c5?_0x416ea4[_0x1c15('0x33')]:_0x41c8a3[_0x1c15('0x30')]+_0x41c8a3[_0x1c15('0x32')];var _0x3749e6;if(_0x1c7445>=_0x59d16f){_0x1c7445=_0x59d16f;_0x3749e6=0xc8;}else{_0x3749e6=0xce;}_0x5e9712[_0x1c15('0x2d')](_0x3749e6);return _0x5e9712['set'](_0x1c15('0x34'),_0x26ace8+'-'+_0x1c7445+'/'+_0x59d16f)[_0x1c15('0x2f')](_0x416ea4);}return null;};}function patchUpdates(_0x2f2ea2){return function(_0x28ff84){try{jsonpatch['apply'](_0x28ff84,_0x2f2ea2,!![]);}catch(_0x5c76f8){return BPromise[_0x1c15('0x35')](_0x5c76f8);}return _0x28ff84['save']();};}function saveUpdates(_0x1050f1,_0x44ee47){return function(_0x3f8e8a){if(_0x3f8e8a){return _0x3f8e8a[_0x1c15('0x36')](_0x1050f1)[_0x1c15('0x22')](function(_0x4155d6){return _0x4155d6;});}return null;};}function removeEntity(_0x44415c,_0x2e9781){return function(_0x3aece3){if(_0x3aece3){return _0x3aece3['destroy']()[_0x1c15('0x22')](function(){_0x44415c[_0x1c15('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dbcb5,_0x32307){return function(_0xbd5a2b){if(!_0xbd5a2b){_0x4dbcb5[_0x1c15('0x2c')](0x194);}return _0xbd5a2b;};}function handleError(_0x23f0c6,_0x4c9457){_0x4c9457=_0x4c9457||0x1f4;return function(_0x543357){logger['error'](_0x543357[_0x1c15('0x37')]);if(_0x543357[_0x1c15('0x38')]){delete _0x543357[_0x1c15('0x38')];}_0x23f0c6['status'](_0x4c9457)[_0x1c15('0x39')](_0x543357);};}exports[_0x1c15('0x3a')]=function(_0x49f39b,_0x36febd){var _0x47cabe={},_0x57626d={},_0x3c46f0={'count':0x0,'rows':[]};var _0x29433b=_['map'](db[_0x1c15('0x3b')][_0x1c15('0x3c')],function(_0xae20e4){return{'name':_0xae20e4[_0x1c15('0x3d')],'type':_0xae20e4[_0x1c15('0x3e')][_0x1c15('0x3f')]};});_0x57626d[_0x1c15('0x40')]=_[_0x1c15('0x41')](_0x29433b,'name');_0x57626d['query']=_[_0x1c15('0x42')](_0x49f39b['query']);_0x57626d['filters']=_[_0x1c15('0x43')](_0x57626d[_0x1c15('0x40')],_0x57626d[_0x1c15('0x44')]);_0x47cabe['attributes']=_['intersection'](_0x57626d[_0x1c15('0x40')],qs[_0x1c15('0x45')](_0x49f39b[_0x1c15('0x44')][_0x1c15('0x45')]));_0x47cabe[_0x1c15('0x46')]=_0x47cabe[_0x1c15('0x46')][_0x1c15('0x47')]?_0x47cabe['attributes']:_0x57626d[_0x1c15('0x40')];if(!_0x49f39b['query'][_0x1c15('0x48')](_0x1c15('0x49'))){_0x47cabe[_0x1c15('0x32')]=qs[_0x1c15('0x32')](_0x49f39b[_0x1c15('0x44')]['limit']);_0x47cabe[_0x1c15('0x30')]=qs[_0x1c15('0x30')](_0x49f39b['query'][_0x1c15('0x30')]);}_0x47cabe[_0x1c15('0x4a')]=qs[_0x1c15('0x4b')](_0x49f39b[_0x1c15('0x44')][_0x1c15('0x4b')]);_0x47cabe['where']=qs[_0x1c15('0x4c')](_[_0x1c15('0x4d')](_0x49f39b[_0x1c15('0x44')],_0x57626d['filters']),_0x29433b);if(_0x49f39b[_0x1c15('0x44')][_0x1c15('0x4e')]){_0x47cabe[_0x1c15('0x4f')]=_[_0x1c15('0x50')](_0x47cabe[_0x1c15('0x4f')],{'$or':_[_0x1c15('0x41')](_0x29433b,function(_0xa0a1eb){if(_0xa0a1eb['type']!=='VIRTUAL'){var _0xcad966={};_0xcad966[_0xa0a1eb['name']]={'$like':'%'+_0x49f39b[_0x1c15('0x44')]['filter']+'%'};return _0xcad966;}})});}_0x47cabe=_[_0x1c15('0x50')]({},_0x47cabe,_0x49f39b[_0x1c15('0x51')]);var _0x595dc1={'where':_0x47cabe[_0x1c15('0x4f')]};return db['FaxMessage']['count'](_0x595dc1)[_0x1c15('0x22')](function(_0x2d3b14){_0x3c46f0[_0x1c15('0x33')]=_0x2d3b14;if(_0x49f39b['query']['includeAll']){_0x47cabe['include']=[{'all':!![]}];}return db['FaxMessage'][_0x1c15('0x52')](_0x47cabe);})['then'](function(_0xe9a8c7){_0x3c46f0[_0x1c15('0x53')]=_0xe9a8c7;return _0x3c46f0;})[_0x1c15('0x22')](respondWithFilteredResult(_0x36febd,_0x47cabe))[_0x1c15('0x2b')](handleError(_0x36febd,null));};exports[_0x1c15('0x54')]=function(_0x26295a,_0x3d7a4){var _0x11a52c={'raw':!![],'where':{'id':_0x26295a[_0x1c15('0x55')]['id']}},_0x28844a={};_0x28844a['model']=_[_0x1c15('0x42')](db[_0x1c15('0x3b')]['rawAttributes']);_0x28844a[_0x1c15('0x44')]=_[_0x1c15('0x42')](_0x26295a[_0x1c15('0x44')]);_0x28844a[_0x1c15('0x4c')]=_[_0x1c15('0x43')](_0x28844a[_0x1c15('0x40')],_0x28844a[_0x1c15('0x44')]);_0x11a52c[_0x1c15('0x46')]=_[_0x1c15('0x43')](_0x28844a[_0x1c15('0x40')],qs[_0x1c15('0x45')](_0x26295a[_0x1c15('0x44')][_0x1c15('0x45')]));_0x11a52c['attributes']=_0x11a52c['attributes']['length']?_0x11a52c[_0x1c15('0x46')]:_0x28844a[_0x1c15('0x40')];if(_0x26295a['query'][_0x1c15('0x56')]){_0x11a52c[_0x1c15('0x57')]=[{'all':!![]}];}_0x11a52c=_[_0x1c15('0x50')]({},_0x11a52c,_0x26295a[_0x1c15('0x51')]);return db[_0x1c15('0x3b')][_0x1c15('0x58')](_0x11a52c)['then'](handleEntityNotFound(_0x3d7a4,null))['then'](respondWithResult(_0x3d7a4,null))['catch'](handleError(_0x3d7a4,null));};exports['update']=function(_0x1ee136,_0x2a3e11){if(_0x1ee136[_0x1c15('0x59')]['id']){delete _0x1ee136['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x1ee136[_0x1c15('0x55')]['id']}})[_0x1c15('0x22')](handleEntityNotFound(_0x2a3e11,null))[_0x1c15('0x22')](saveUpdates(_0x1ee136[_0x1c15('0x59')],null))[_0x1c15('0x22')](respondWithResult(_0x2a3e11,null))[_0x1c15('0x2b')](handleError(_0x2a3e11,null));};exports['destroy']=function(_0x842acb,_0x16fbe7){return db[_0x1c15('0x3b')]['find']({'where':{'id':_0x842acb['params']['id']}})[_0x1c15('0x22')](handleEntityNotFound(_0x16fbe7,null))['then'](removeEntity(_0x16fbe7,null))[_0x1c15('0x2b')](handleError(_0x16fbe7,null));};exports[_0x1c15('0x5a')]=function(_0x27e469,_0x30afb0){return db[_0x1c15('0x3b')][_0x1c15('0x5a')]()[_0x1c15('0x22')](respondWithResult(_0x30afb0,null))[_0x1c15('0x2b')](handleError(_0x30afb0,null));};var interaction_log=require(_0x1c15('0x13'))(_0x1c15('0x5b'));exports[_0x1c15('0x5c')]=function(_0x4f3a49,_0xde3552,_0x53f695){var _0xbb423={'agent':{},'channel':_0x1c15('0x5d')};if(_0x4f3a49[_0x1c15('0x59')]['id']){delete _0x4f3a49['body']['id'];}_0x4f3a49['body'][_0x1c15('0x5e')]=!![];_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x5f')]=moment()[_0x1c15('0x60')](_0x1c15('0x61'));_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x62')]=_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x62')]||_0x4f3a49['user']['id'];_0xbb423[_0x1c15('0x63')]['id']=_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x62')];return db['FaxMessage'][_0x1c15('0x58')]({'where':{'id':_0x4f3a49[_0x1c15('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xde3552,null))[_0x1c15('0x22')](saveUpdates(_0x4f3a49['body'],null))[_0x1c15('0x22')](function(_0x17eb0e){if(_0x17eb0e){_0xbb423[_0x1c15('0x2a')]=_0x17eb0e[_0x1c15('0x64')]({'plain':!![]});return db[_0x1c15('0x65')]['find']({'where':{'id':_0x17eb0e[_0x1c15('0x66')]}});}return null;})[_0x1c15('0x22')](handleEntityNotFound(_0xde3552,null))['then'](function(_0x3b4ee7){if(_0x3b4ee7){return _0x3b4ee7[_0x1c15('0x36')]({'UserId':_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x62')],'read1stAt':_[_0x1c15('0x67')](_0x3b4ee7['read1stAt'])?moment()[_0x1c15('0x60')](_0x1c15('0x61')):undefined});}return null;})[_0x1c15('0x22')](function(_0x34d928){if(_0x34d928){_0xbb423[_0x1c15('0x68')]=_0x34d928[_0x1c15('0x64')]({'plain':!![]});interaction_log[_0x1c15('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4f3a49[_0x1c15('0x69')]['id'],_0x4f3a49['user'][_0x1c15('0x38')],_0x4f3a49[_0x1c15('0x69')]['role'],_0xbb423[_0x1c15('0x68')]['id'],_0x4f3a49[_0x1c15('0x59')]?JSON['stringify'](_0x4f3a49[_0x1c15('0x59')]):'null');return respondWithRpcPromise(_0x1c15('0x6a'),_0x1c15('0x6b'),_0xbb423);}return null;})[_0x1c15('0x22')](function(_0x357f34){var _0x274fa9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x357f34[_0x1c15('0x2a')][_0x1c15('0x6c')];return db['sequelize'][_0x1c15('0x44')](_0x274fa9,{'type':db[_0x1c15('0x6d')][_0x1c15('0x6e')][_0x1c15('0x6f')],'raw':!![]})[_0x1c15('0x22')](function(_0xaac8e2){return _0xaac8e2;});})['then'](function(_0x519683){if(_0x519683){_0xbb423[_0x1c15('0x2a')][_0x1c15('0x70')]=_0x519683[0x0];if(!_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x62')])return;return db['User'][_0x1c15('0x58')]({'where':{'id':_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x62')],'role':'agent'},'attributes':['id',_0x1c15('0x38'),_0x1c15('0x71'),'email',_0x1c15('0x72')],'raw':!![]});}return null;})[_0x1c15('0x22')](function(_0x2384b2){if(!_0x2384b2)return null;_0xbb423[_0x1c15('0x2a')]['agent']=_0x2384b2;return _0xbb423;})[_0x1c15('0x22')](function(_0x484856){if(_0x484856){if(_0x4f3a49[_0x1c15('0x59')][_0x1c15('0x73')]){_0xbb423[_0x1c15('0x2a')]['interface']=util['format'](_0x1c15('0x74'),_0x4f3a49[_0x1c15('0x69')]['name']);_0xbb423[_0x1c15('0x2a')]['channel']=_0xbb423[_0x1c15('0x75')];_0xbb423[_0x1c15('0x2a')][_0x1c15('0x76')]=_0xbb423[_0x1c15('0x75')];_0xbb423['message']['event']=_0x1c15('0x5c');return respondWithRpcPromise(_0x1c15('0x77'),_0x1c15('0x77'),{'event':_0x1c15('0x78'),'message':_0xbb423[_0x1c15('0x2a')]},client9002)[_0x1c15('0x22')](function(){return _0xbb423;});}return _0xbb423;}return null;})['then'](respondWithResult(_0xde3552,null))[_0x1c15('0x2b')](handleError(_0xde3552,null));};var interaction_log=require('../../config/logger')(_0x1c15('0x5b'));exports[_0x1c15('0x35')]=function(_0x46efc7,_0x38108c,_0x80fecf){var _0x562580={'agent':{},'channel':'fax'};if(_0x46efc7[_0x1c15('0x59')]['id']){delete _0x46efc7[_0x1c15('0x59')]['id'];}_0x46efc7[_0x1c15('0x59')][_0x1c15('0x62')]=_0x46efc7[_0x1c15('0x59')][_0x1c15('0x62')]||_0x46efc7[_0x1c15('0x69')]['id'];_0x562580[_0x1c15('0x63')]['id']=_0x46efc7[_0x1c15('0x59')][_0x1c15('0x62')];return db['FaxMessage'][_0x1c15('0x58')]({'where':{'id':_0x46efc7['params']['id'],'UserId':null}})[_0x1c15('0x22')](handleEntityNotFound(_0x38108c,null))[_0x1c15('0x22')](function(_0x342847){if(_0x342847){_0x562580[_0x1c15('0x2a')]=_0x342847[_0x1c15('0x64')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x342847[_0x1c15('0x66')]}});}return null;})[_0x1c15('0x22')](handleEntityNotFound(_0x38108c,null))[_0x1c15('0x22')](function(_0x353866){if(_0x353866){_0x562580['interaction']=_0x353866[_0x1c15('0x64')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46efc7[_0x1c15('0x69')]['id'],_0x46efc7['user'][_0x1c15('0x38')],_0x46efc7[_0x1c15('0x69')][_0x1c15('0x79')],_0x562580[_0x1c15('0x68')]['id'],_0x46efc7[_0x1c15('0x59')]?JSON[_0x1c15('0x28')](_0x46efc7[_0x1c15('0x59')]):_0x1c15('0x7a'));return respondWithRpcPromise('RejectMessage',_0x1c15('0x7b'),_0x562580);}return null;})[_0x1c15('0x22')](function(_0xb7959d){var _0x1ed764=_0x1c15('0x7c')+_0xb7959d['message'][_0x1c15('0x6c')];return db[_0x1c15('0x7d')][_0x1c15('0x44')](_0x1ed764,{'type':db[_0x1c15('0x6d')][_0x1c15('0x6e')][_0x1c15('0x6f')],'raw':!![]})['then'](function(_0x3cfcd2){return _0x3cfcd2;});})[_0x1c15('0x22')](function(_0x2d6694){if(_0x2d6694){_0x562580[_0x1c15('0x2a')][_0x1c15('0x70')]=_0x2d6694[0x0];if(!_0x46efc7[_0x1c15('0x59')][_0x1c15('0x62')])return;return db[_0x1c15('0x7e')]['find']({'where':{'id':_0x46efc7['body'][_0x1c15('0x62')],'role':'agent'},'attributes':['id','name',_0x1c15('0x71'),_0x1c15('0x7f'),'internal'],'raw':!![]});}return null;})[_0x1c15('0x22')](function(_0x30bfd6){if(!_0x30bfd6)return null;_0x562580['message'][_0x1c15('0x63')]=_0x30bfd6;return _0x562580;})[_0x1c15('0x22')](function(_0xf4596f){if(_0xf4596f){_0xf4596f[_0x1c15('0x2a')]['interface']=util[_0x1c15('0x60')](_0x1c15('0x74'),_0x46efc7[_0x1c15('0x69')]['name']);_0xf4596f[_0x1c15('0x2a')][_0x1c15('0x75')]=_0x562580[_0x1c15('0x75')];_0xf4596f['message'][_0x1c15('0x76')]=_0x562580[_0x1c15('0x75')];_0xf4596f[_0x1c15('0x2a')][_0x1c15('0x80')]='reject';respondWithRpcPromise(_0x1c15('0x77'),'EventManager',{'event':_0x1c15('0x81'),'message':_0xf4596f[_0x1c15('0x2a')]},client9002);return _0x562580;}return null;})[_0x1c15('0x22')](respondWithResult(_0x38108c,null))[_0x1c15('0x2b')](handleError(_0x38108c,null));};exports[_0x1c15('0x82')]=function(_0x348141,_0x291eed){var _0x25d1a3;return db[_0x1c15('0x3b')][_0x1c15('0x82')](_0x348141[_0x1c15('0x59')],{})[_0x1c15('0x22')](function(_0x45db1b){_0x25d1a3=_0x45db1b;return db[_0x1c15('0x83')][_0x1c15('0x84')]({'where':{'id':_0x25d1a3[_0x1c15('0x6c')]}});})[_0x1c15('0x22')](function(_0x205521){if(_['isNil'](_0x205521)){return;}else{_0x25d1a3[_0x1c15('0x5d')]=_0x205521['fax'];return db[_0x1c15('0x85')]['findOne']({'where':{'id':_0x25d1a3[_0x1c15('0x86')]}});}})[_0x1c15('0x22')](function(_0x443d99){return respondWithRpcPromise(_0x1c15('0x87'),_0x1c15('0x87'),{'FaxAccountId':_[_0x1c15('0x67')](_0x348141[_0x1c15('0x59')])?undefined:_0x348141['body'][_0x1c15('0x88')],'path':_[_0x1c15('0x67')](_0x443d99)?undefined:util[_0x1c15('0x60')](_0x1c15('0x89'),_0x443d99[_0x1c15('0x8a')]),'fax':_[_0x1c15('0x67')](_0x25d1a3[_0x1c15('0x5d')])?undefined:_0x25d1a3[_0x1c15('0x5d')],'AttachmentId':_0x25d1a3[_0x1c15('0x86')]},client9002);})['then'](respondWithResult(_0x291eed,0xc9))[_0x1c15('0x2b')](handleError(_0x291eed,null));};exports[_0x1c15('0x8b')]=function(_0x40ecb8,_0x10565b){var _0x192d58=path[_0x1c15('0x8c')](config[_0x1c15('0x8d')],'server','files',_0x1c15('0x8e'));return db[_0x1c15('0x3b')][_0x1c15('0x58')]({'where':{'id':_0x40ecb8[_0x1c15('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0x1c15('0x85')}]})[_0x1c15('0x22')](handleEntityNotFound(_0x10565b,null))[_0x1c15('0x22')](function(_0x3f8306){if(_0x3f8306){return _0x10565b[_0x1c15('0x8b')](path[_0x1c15('0x8c')](_0x192d58,_0x3f8306[_0x1c15('0x85')][_0x1c15('0x8a')]));}})['catch'](handleError(_0x10565b,null));}; \ No newline at end of file +var _0x96c3=['localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','code','error','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','index','FaxMessage','rawAttributes','fieldName','key','model','map','name','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','catch','show','params','includeAll','body','find','describe','fax-interactions','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','format','interaction','user','role','acceptMessage','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','motionChannel','rejectmessage','create','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x96c3,0xff));var _0x396c=function(_0x50c88d,_0x30cbd1){_0x50c88d=_0x50c88d-0x0;var _0x4bba24=_0x96c3[_0x50c88d];return _0x4bba24;};'use strict';var emlformat=require(_0x396c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x396c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x396c('0x2'));var moment=require(_0x396c('0x3'));var BPromise=require(_0x396c('0x4'));var Mustache=require('mustache');var util=require(_0x396c('0x5'));var path=require(_0x396c('0x6'));var sox=require('sox');var csv=require(_0x396c('0x7'));var ejs=require(_0x396c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x396c('0x9'));var crypto=require('crypto');var jsforce=require(_0x396c('0xa'));var deskjs=require(_0x396c('0xb'));var toCsv=require(_0x396c('0x7'));var querystring=require(_0x396c('0xc'));var Papa=require('papaparse');var Redis=require(_0x396c('0xd'));var authService=require(_0x396c('0xe'));var qs=require(_0x396c('0xf'));var as=require(_0x396c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x396c('0x11'))('api');var utils=require(_0x396c('0x12'));var config=require(_0x396c('0x13'));var licenseUtil=require(_0x396c('0x14'));var db=require('../../mysqldb')['db'];config[_0x396c('0x15')]=_[_0x396c('0x16')](config['redis'],{'host':_0x396c('0x17'),'port':0x18eb});var socket=require(_0x396c('0x18'))(new Redis(config[_0x396c('0x15')]));require(_0x396c('0x19'))[_0x396c('0x1a')](socket);var jayson=require(_0x396c('0x1b'));var client=jayson[_0x396c('0x1c')][_0x396c('0x1d')]({'port':0x232c});var client9002=jayson[_0x396c('0x1c')][_0x396c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1f9bf4,_0x56cb68,_0xbc2733,_0xd8a6e5){return new BPromise(function(_0x3f6731,_0x4967fb){var _0x2e6f75=_0xd8a6e5||client;return _0x2e6f75[_0x396c('0x1e')](_0x1f9bf4,_0xbc2733)[_0x396c('0x1f')](function(_0x4f7f89){logger[_0x396c('0x20')]('FaxMessage,\x20%s,\x20%s',_0x56cb68,'request\x20sent');logger[_0x396c('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x56cb68,_0x396c('0x22'),JSON[_0x396c('0x23')](_0x4f7f89));if(_0x4f7f89['error']){if(_0x4f7f89['error'][_0x396c('0x24')]===0x1f4){logger[_0x396c('0x25')]('FaxMessage,\x20%s,\x20%s',_0x56cb68,_0x4f7f89[_0x396c('0x25')][_0x396c('0x26')]);return _0x4967fb(_0x4f7f89[_0x396c('0x25')]['message']);}logger[_0x396c('0x25')]('FaxMessage,\x20%s,\x20%s',_0x56cb68,_0x4f7f89[_0x396c('0x25')][_0x396c('0x26')]);return _0x3f6731(_0x4f7f89['error'][_0x396c('0x26')]);}else{logger['info'](_0x396c('0x27'),_0x56cb68,_0x396c('0x22'));_0x3f6731(_0x4f7f89[_0x396c('0x28')][_0x396c('0x26')]);}})['catch'](function(_0x571d57){logger[_0x396c('0x25')](_0x396c('0x27'),_0x56cb68,_0x571d57);_0x4967fb(_0x571d57);});});}function respondWithStatusCode(_0x2b82bd,_0x37b8b8){_0x37b8b8=_0x37b8b8||0xcc;return function(_0x1e2e77){if(_0x1e2e77){return _0x2b82bd[_0x396c('0x29')](_0x37b8b8);}return _0x2b82bd[_0x396c('0x2a')](_0x37b8b8)[_0x396c('0x2b')]();};}function respondWithResult(_0x392d5d,_0x2ab7f4){_0x2ab7f4=_0x2ab7f4||0xc8;return function(_0x206665){if(_0x206665){return _0x392d5d[_0x396c('0x2a')](_0x2ab7f4)[_0x396c('0x2c')](_0x206665);}};}function respondWithFilteredResult(_0x348db2,_0x579d55){return function(_0x20bc0d){if(_0x20bc0d){var _0x5d1134=typeof _0x579d55[_0x396c('0x2d')]==='undefined'&&typeof _0x579d55[_0x396c('0x2e')]===_0x396c('0x2f');var _0x35368a=_0x20bc0d[_0x396c('0x30')];var _0x8938e0=_0x5d1134?0x0:_0x579d55[_0x396c('0x2d')];var _0x1524ed=_0x5d1134?_0x20bc0d[_0x396c('0x30')]:_0x579d55[_0x396c('0x2d')]+_0x579d55[_0x396c('0x2e')];var _0x1417cc;if(_0x1524ed>=_0x35368a){_0x1524ed=_0x35368a;_0x1417cc=0xc8;}else{_0x1417cc=0xce;}_0x348db2[_0x396c('0x2a')](_0x1417cc);return _0x348db2[_0x396c('0x31')](_0x396c('0x32'),_0x8938e0+'-'+_0x1524ed+'/'+_0x35368a)[_0x396c('0x2c')](_0x20bc0d);}return null;};}function patchUpdates(_0x2a33f3){return function(_0x2d48f4){try{jsonpatch[_0x396c('0x33')](_0x2d48f4,_0x2a33f3,!![]);}catch(_0x34f88d){return BPromise[_0x396c('0x34')](_0x34f88d);}return _0x2d48f4[_0x396c('0x35')]();};}function saveUpdates(_0xd949c7,_0x3ed447){return function(_0x46bce7){if(_0x46bce7){return _0x46bce7[_0x396c('0x36')](_0xd949c7)[_0x396c('0x1f')](function(_0x1c083a){return _0x1c083a;});}return null;};}function removeEntity(_0x1d33eb,_0x1cbfc2){return function(_0x8330f5){if(_0x8330f5){return _0x8330f5[_0x396c('0x37')]()[_0x396c('0x1f')](function(){_0x1d33eb[_0x396c('0x2a')](0xcc)[_0x396c('0x2b')]();});}};}function handleEntityNotFound(_0x1c65bd,_0x3daae0){return function(_0x1f8e80){if(!_0x1f8e80){_0x1c65bd[_0x396c('0x29')](0x194);}return _0x1f8e80;};}function handleError(_0x44a9cd,_0x17e6b6){_0x17e6b6=_0x17e6b6||0x1f4;return function(_0x4b84e5){logger[_0x396c('0x25')](_0x4b84e5[_0x396c('0x38')]);if(_0x4b84e5['name']){delete _0x4b84e5['name'];}_0x44a9cd[_0x396c('0x2a')](_0x17e6b6)['send'](_0x4b84e5);};}exports[_0x396c('0x39')]=function(_0x50a0e6,_0x149add){var _0x281eeb={},_0x5c66f5={},_0x5bf70b={'count':0x0,'rows':[]};var _0x11d842=_['map'](db[_0x396c('0x3a')][_0x396c('0x3b')],function(_0xae168b){return{'name':_0xae168b[_0x396c('0x3c')],'type':_0xae168b['type'][_0x396c('0x3d')]};});_0x5c66f5[_0x396c('0x3e')]=_[_0x396c('0x3f')](_0x11d842,_0x396c('0x40'));_0x5c66f5['query']=_[_0x396c('0x41')](_0x50a0e6['query']);_0x5c66f5[_0x396c('0x42')]=_[_0x396c('0x43')](_0x5c66f5[_0x396c('0x3e')],_0x5c66f5['query']);_0x281eeb[_0x396c('0x44')]=_['intersection'](_0x5c66f5[_0x396c('0x3e')],qs[_0x396c('0x45')](_0x50a0e6[_0x396c('0x46')][_0x396c('0x45')]));_0x281eeb[_0x396c('0x44')]=_0x281eeb['attributes'][_0x396c('0x47')]?_0x281eeb[_0x396c('0x44')]:_0x5c66f5[_0x396c('0x3e')];if(!_0x50a0e6[_0x396c('0x46')][_0x396c('0x48')](_0x396c('0x49'))){_0x281eeb['limit']=qs['limit'](_0x50a0e6['query'][_0x396c('0x2e')]);_0x281eeb[_0x396c('0x2d')]=qs[_0x396c('0x2d')](_0x50a0e6[_0x396c('0x46')][_0x396c('0x2d')]);}_0x281eeb[_0x396c('0x4a')]=qs[_0x396c('0x4b')](_0x50a0e6[_0x396c('0x46')][_0x396c('0x4b')]);_0x281eeb['where']=qs[_0x396c('0x42')](_[_0x396c('0x4c')](_0x50a0e6[_0x396c('0x46')],_0x5c66f5[_0x396c('0x42')]),_0x11d842);if(_0x50a0e6['query'][_0x396c('0x4d')]){_0x281eeb[_0x396c('0x4e')]=_[_0x396c('0x4f')](_0x281eeb[_0x396c('0x4e')],{'$or':_[_0x396c('0x3f')](_0x11d842,function(_0x4a9098){if(_0x4a9098[_0x396c('0x50')]!==_0x396c('0x51')){var _0x2102db={};_0x2102db[_0x4a9098[_0x396c('0x40')]]={'$like':'%'+_0x50a0e6[_0x396c('0x46')]['filter']+'%'};return _0x2102db;}})});}_0x281eeb=_[_0x396c('0x4f')]({},_0x281eeb,_0x50a0e6[_0x396c('0x52')]);var _0x34a250={'where':_0x281eeb[_0x396c('0x4e')]};return db[_0x396c('0x3a')][_0x396c('0x30')](_0x34a250)[_0x396c('0x1f')](function(_0x2f2d45){_0x5bf70b[_0x396c('0x30')]=_0x2f2d45;if(_0x50a0e6[_0x396c('0x46')]['includeAll']){_0x281eeb['include']=[{'all':!![]}];}return db[_0x396c('0x3a')][_0x396c('0x53')](_0x281eeb);})[_0x396c('0x1f')](function(_0x2f6746){_0x5bf70b['rows']=_0x2f6746;return _0x5bf70b;})[_0x396c('0x1f')](respondWithFilteredResult(_0x149add,_0x281eeb))[_0x396c('0x54')](handleError(_0x149add,null));};exports[_0x396c('0x55')]=function(_0x5992c4,_0x2e6bc0){var _0x2dadae={'raw':!![],'where':{'id':_0x5992c4[_0x396c('0x56')]['id']}},_0x331723={};_0x331723[_0x396c('0x3e')]=_['keys'](db[_0x396c('0x3a')][_0x396c('0x3b')]);_0x331723[_0x396c('0x46')]=_[_0x396c('0x41')](_0x5992c4[_0x396c('0x46')]);_0x331723[_0x396c('0x42')]=_[_0x396c('0x43')](_0x331723[_0x396c('0x3e')],_0x331723[_0x396c('0x46')]);_0x2dadae[_0x396c('0x44')]=_[_0x396c('0x43')](_0x331723['model'],qs[_0x396c('0x45')](_0x5992c4[_0x396c('0x46')][_0x396c('0x45')]));_0x2dadae[_0x396c('0x44')]=_0x2dadae[_0x396c('0x44')][_0x396c('0x47')]?_0x2dadae[_0x396c('0x44')]:_0x331723[_0x396c('0x3e')];if(_0x5992c4[_0x396c('0x46')][_0x396c('0x57')]){_0x2dadae['include']=[{'all':!![]}];}_0x2dadae=_['merge']({},_0x2dadae,_0x5992c4[_0x396c('0x52')]);return db[_0x396c('0x3a')]['find'](_0x2dadae)[_0x396c('0x1f')](handleEntityNotFound(_0x2e6bc0,null))[_0x396c('0x1f')](respondWithResult(_0x2e6bc0,null))['catch'](handleError(_0x2e6bc0,null));};exports['update']=function(_0x992b18,_0x3ed71e){if(_0x992b18[_0x396c('0x58')]['id']){delete _0x992b18['body']['id'];}return db[_0x396c('0x3a')][_0x396c('0x59')]({'where':{'id':_0x992b18[_0x396c('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ed71e,null))[_0x396c('0x1f')](saveUpdates(_0x992b18[_0x396c('0x58')],null))[_0x396c('0x1f')](respondWithResult(_0x3ed71e,null))['catch'](handleError(_0x3ed71e,null));};exports[_0x396c('0x37')]=function(_0x1ae572,_0x578c43){return db['FaxMessage'][_0x396c('0x59')]({'where':{'id':_0x1ae572[_0x396c('0x56')]['id']}})[_0x396c('0x1f')](handleEntityNotFound(_0x578c43,null))[_0x396c('0x1f')](removeEntity(_0x578c43,null))[_0x396c('0x54')](handleError(_0x578c43,null));};exports['describe']=function(_0x9654ec,_0x23da8e){return db[_0x396c('0x3a')][_0x396c('0x5a')]()[_0x396c('0x1f')](respondWithResult(_0x23da8e,null))[_0x396c('0x54')](handleError(_0x23da8e,null));};var interaction_log=require(_0x396c('0x11'))(_0x396c('0x5b'));exports[_0x396c('0x5c')]=function(_0xa1a074,_0x2596ee,_0x5497ce){var _0x21fa54={'agent':{},'channel':'fax'};if(_0xa1a074[_0x396c('0x58')]['id']){delete _0xa1a074[_0x396c('0x58')]['id'];}_0xa1a074['body']['read']=!![];_0xa1a074[_0x396c('0x58')]['readAt']=moment()['format'](_0x396c('0x5d'));_0xa1a074[_0x396c('0x58')]['UserId']=_0xa1a074['body'][_0x396c('0x5e')]||_0xa1a074['user']['id'];_0x21fa54['agent']['id']=_0xa1a074[_0x396c('0x58')][_0x396c('0x5e')];return db[_0x396c('0x3a')]['find']({'where':{'id':_0xa1a074[_0x396c('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2596ee,null))['then'](saveUpdates(_0xa1a074[_0x396c('0x58')],null))['then'](function(_0xe97673){if(_0xe97673){_0x21fa54[_0x396c('0x26')]=_0xe97673[_0x396c('0x5f')]({'plain':!![]});return db[_0x396c('0x60')][_0x396c('0x59')]({'where':{'id':_0xe97673[_0x396c('0x61')]}});}return null;})[_0x396c('0x1f')](handleEntityNotFound(_0x2596ee,null))[_0x396c('0x1f')](function(_0x42a9dc){if(_0x42a9dc){return _0x42a9dc['update']({'UserId':_0xa1a074['body']['UserId'],'read1stAt':_['isNil'](_0x42a9dc['read1stAt'])?moment()[_0x396c('0x62')](_0x396c('0x5d')):undefined});}return null;})[_0x396c('0x1f')](function(_0x1259be){if(_0x1259be){_0x21fa54[_0x396c('0x63')]=_0x1259be[_0x396c('0x5f')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa1a074[_0x396c('0x64')]['id'],_0xa1a074[_0x396c('0x64')]['name'],_0xa1a074[_0x396c('0x64')][_0x396c('0x65')],_0x21fa54[_0x396c('0x63')]['id'],_0xa1a074[_0x396c('0x58')]?JSON['stringify'](_0xa1a074[_0x396c('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x396c('0x66'),_0x21fa54);}return null;})[_0x396c('0x1f')](function(_0xc384){var _0x427807='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xc384['message']['ContactId'];return db['sequelize'][_0x396c('0x46')](_0x427807,{'type':db[_0x396c('0x67')][_0x396c('0x68')]['SELECT'],'raw':!![]})[_0x396c('0x1f')](function(_0x266f6c){return _0x266f6c;});})['then'](function(_0x4d5c45){if(_0x4d5c45){_0x21fa54[_0x396c('0x26')][_0x396c('0x69')]=_0x4d5c45[0x0];if(!_0xa1a074[_0x396c('0x58')][_0x396c('0x5e')])return;return db[_0x396c('0x6a')][_0x396c('0x59')]({'where':{'id':_0xa1a074[_0x396c('0x58')][_0x396c('0x5e')],'role':_0x396c('0x6b')},'attributes':['id',_0x396c('0x40'),_0x396c('0x6c'),_0x396c('0x6d'),_0x396c('0x6e')],'raw':!![]});}return null;})[_0x396c('0x1f')](function(_0x43e7f9){if(!_0x43e7f9)return null;_0x21fa54[_0x396c('0x26')][_0x396c('0x6b')]=_0x43e7f9;return _0x21fa54;})[_0x396c('0x1f')](function(_0x251569){if(_0x251569){if(_0xa1a074[_0x396c('0x58')][_0x396c('0x6f')]){_0x21fa54[_0x396c('0x26')]['interface']=util[_0x396c('0x62')](_0x396c('0x70'),_0xa1a074['user'][_0x396c('0x40')]);_0x21fa54['message']['channel']=_0x21fa54[_0x396c('0x71')];_0x21fa54['message']['motionChannel']=_0x21fa54[_0x396c('0x71')];_0x21fa54['message'][_0x396c('0x72')]=_0x396c('0x5c');return respondWithRpcPromise('EventManager',_0x396c('0x73'),{'event':'acceptmessage','message':_0x21fa54[_0x396c('0x26')]},client9002)['then'](function(){return _0x21fa54;});}return _0x21fa54;}return null;})['then'](respondWithResult(_0x2596ee,null))[_0x396c('0x54')](handleError(_0x2596ee,null));};var interaction_log=require(_0x396c('0x11'))(_0x396c('0x5b'));exports[_0x396c('0x34')]=function(_0x357265,_0x1eab4b,_0x4e40e4){var _0x38ff54={'agent':{},'channel':_0x396c('0x74')};if(_0x357265[_0x396c('0x58')]['id']){delete _0x357265[_0x396c('0x58')]['id'];}_0x357265['body'][_0x396c('0x5e')]=_0x357265[_0x396c('0x58')][_0x396c('0x5e')]||_0x357265[_0x396c('0x64')]['id'];_0x38ff54[_0x396c('0x6b')]['id']=_0x357265[_0x396c('0x58')]['UserId'];return db[_0x396c('0x3a')][_0x396c('0x59')]({'where':{'id':_0x357265[_0x396c('0x56')]['id'],'UserId':null}})[_0x396c('0x1f')](handleEntityNotFound(_0x1eab4b,null))[_0x396c('0x1f')](function(_0x2eb072){if(_0x2eb072){_0x38ff54['message']=_0x2eb072['get']({'plain':!![]});return db[_0x396c('0x60')][_0x396c('0x59')]({'where':{'id':_0x2eb072[_0x396c('0x61')]}});}return null;})[_0x396c('0x1f')](handleEntityNotFound(_0x1eab4b,null))['then'](function(_0x2d17ee){if(_0x2d17ee){_0x38ff54[_0x396c('0x63')]=_0x2d17ee[_0x396c('0x5f')]({'plain':!![]});interaction_log[_0x396c('0x20')](_0x396c('0x75'),_0x357265[_0x396c('0x64')]['id'],_0x357265[_0x396c('0x64')][_0x396c('0x40')],_0x357265[_0x396c('0x64')]['role'],_0x38ff54[_0x396c('0x63')]['id'],_0x357265[_0x396c('0x58')]?JSON[_0x396c('0x23')](_0x357265['body']):_0x396c('0x76'));return respondWithRpcPromise(_0x396c('0x77'),_0x396c('0x78'),_0x38ff54);}return null;})['then'](function(_0x6277cc){var _0x331ca5=_0x396c('0x79')+_0x6277cc[_0x396c('0x26')][_0x396c('0x7a')];return db[_0x396c('0x7b')][_0x396c('0x46')](_0x331ca5,{'type':db[_0x396c('0x67')]['QueryTypes']['SELECT'],'raw':!![]})[_0x396c('0x1f')](function(_0xb4e231){return _0xb4e231;});})['then'](function(_0x42edeb){if(_0x42edeb){_0x38ff54[_0x396c('0x26')]['contact']=_0x42edeb[0x0];if(!_0x357265[_0x396c('0x58')]['UserId'])return;return db['User'][_0x396c('0x59')]({'where':{'id':_0x357265[_0x396c('0x58')][_0x396c('0x5e')],'role':'agent'},'attributes':['id','name',_0x396c('0x6c'),'email','internal'],'raw':!![]});}return null;})[_0x396c('0x1f')](function(_0x5debcd){if(!_0x5debcd)return null;_0x38ff54[_0x396c('0x26')]['agent']=_0x5debcd;return _0x38ff54;})[_0x396c('0x1f')](function(_0x5b7d37){if(_0x5b7d37){_0x5b7d37[_0x396c('0x26')]['interface']=util['format'](_0x396c('0x70'),_0x357265[_0x396c('0x64')][_0x396c('0x40')]);_0x5b7d37[_0x396c('0x26')][_0x396c('0x71')]=_0x38ff54['channel'];_0x5b7d37['message'][_0x396c('0x7c')]=_0x38ff54[_0x396c('0x71')];_0x5b7d37[_0x396c('0x26')][_0x396c('0x72')]=_0x396c('0x34');respondWithRpcPromise(_0x396c('0x73'),_0x396c('0x73'),{'event':_0x396c('0x7d'),'message':_0x5b7d37[_0x396c('0x26')]},client9002);return _0x38ff54;}return null;})[_0x396c('0x1f')](respondWithResult(_0x1eab4b,null))[_0x396c('0x54')](handleError(_0x1eab4b,null));};exports[_0x396c('0x7e')]=function(_0x1396b8,_0x5aae9b){var _0x20c7b7;return db[_0x396c('0x3a')][_0x396c('0x7e')](_0x1396b8['body'],{})['then'](function(_0x12d971){_0x20c7b7=_0x12d971;return db['CmContact'][_0x396c('0x7f')]({'where':{'id':_0x20c7b7[_0x396c('0x7a')]}});})[_0x396c('0x1f')](function(_0x421cba){if(_[_0x396c('0x80')](_0x421cba)){return;}else{_0x20c7b7[_0x396c('0x74')]=_0x421cba[_0x396c('0x74')];return db[_0x396c('0x81')][_0x396c('0x7f')]({'where':{'id':_0x20c7b7['AttachmentId']}});}})[_0x396c('0x1f')](function(_0xa1f9cd){return respondWithRpcPromise('SendFax',_0x396c('0x82'),{'FaxAccountId':_[_0x396c('0x80')](_0x1396b8[_0x396c('0x58')])?undefined:_0x1396b8['body'][_0x396c('0x83')],'path':_[_0x396c('0x80')](_0xa1f9cd)?undefined:util['format'](_0x396c('0x84'),_0xa1f9cd[_0x396c('0x85')]),'fax':_[_0x396c('0x80')](_0x20c7b7[_0x396c('0x74')])?undefined:_0x20c7b7[_0x396c('0x74')],'AttachmentId':_0x20c7b7['AttachmentId']},client9002);})[_0x396c('0x1f')](respondWithResult(_0x5aae9b,0xc9))['catch'](handleError(_0x5aae9b,null));};exports['download']=function(_0x10c1a3,_0x300add){var _0x172d48=path[_0x396c('0x86')](config[_0x396c('0x87')],_0x396c('0x88'),_0x396c('0x89'),_0x396c('0x8a'));return db[_0x396c('0x3a')][_0x396c('0x59')]({'where':{'id':_0x10c1a3[_0x396c('0x56')]['id']},'include':[{'model':db[_0x396c('0x81')],'as':_0x396c('0x81')}]})['then'](handleEntityNotFound(_0x300add,null))[_0x396c('0x1f')](function(_0x6e8cb2){if(_0x6e8cb2){return _0x300add['download'](path[_0x396c('0x86')](_0x172d48,_0x6e8cb2[_0x396c('0x81')][_0x396c('0x85')]));}})[_0x396c('0x54')](handleError(_0x300add,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b0a439f..ec92801 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 _0x49fe=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x49fe,0x75));var _0xe49f=function(_0x7f6457,_0x27aff0){_0x7f6457=_0x7f6457-0x0;var _0x4aed3b=_0x49fe[_0x7f6457];return _0x4aed3b;};'use strict';var EventEmitter=require(_0xe49f('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe49f('0x1'),'afterUpdate':_0xe49f('0x2'),'afterDestroy':_0xe49f('0x3')};function emitEvent(_0xb99c7){return function(_0x1cac40,_0x2db0ec,_0x1235f4){FaxMessageEvents[_0xe49f('0x4')](_0xb99c7+':'+_0x1cac40['id'],_0x1cac40);FaxMessageEvents[_0xe49f('0x4')](_0xb99c7,_0x1cac40);_0x1235f4(null);};}for(var e in events){if(events[_0xe49f('0x5')](e)){var event=events[e];FaxMessage[_0xe49f('0x6')](e,emitEvent(event));}}module[_0xe49f('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x1241=['events','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5ec365,_0x49930c){var _0xab187d=function(_0x4d4bbd){while(--_0x4d4bbd){_0x5ec365['push'](_0x5ec365['shift']());}};_0xab187d(++_0x49930c);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1124('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x1124('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1124('0x2')](0x0);var events={'afterCreate':_0x1124('0x3'),'afterUpdate':_0x1124('0x4'),'afterDestroy':_0x1124('0x5')};function emitEvent(_0x57830b){return function(_0x34e834,_0x355ccc,_0x3843ff){FaxMessageEvents['emit'](_0x57830b+':'+_0x34e834['id'],_0x34e834);FaxMessageEvents[_0x1124('0x6')](_0x57830b,_0x34e834);_0x3843ff(null);};}for(var e in events){if(events[_0x1124('0x7')](e)){var event=events[e];FaxMessage[_0x1124('0x8')](e,emitEvent(event));}}module[_0x1124('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a925562..84b40fb 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 _0x97b9=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId'];(function(_0x31b6b0,_0x309f69){var _0x35a044=function(_0x5dda51){while(--_0x5dda51){_0x31b6b0['push'](_0x31b6b0['shift']());}};_0x35a044(++_0x309f69);}(_0x97b9,0xe8));var _0x997b=function(_0x2c7aae,_0x1f423d){_0x2c7aae=_0x2c7aae-0x0;var _0x38f821=_0x97b9[_0x2c7aae];return _0x38f821;};'use strict';var _=require(_0x997b('0x0'));var util=require(_0x997b('0x1'));var logger=require(_0x997b('0x2'))('api');var moment=require(_0x997b('0x3'));var BPromise=require(_0x997b('0x4'));var rp=require(_0x997b('0x5'));var fs=require('fs');var path=require(_0x997b('0x6'));var rimraf=require(_0x997b('0x7'));var config=require('../../config/environment');var attributes=require(_0x997b('0x8'));module['exports']=function(_0x1f3fe6,_0x3d8d7c){return _0x1f3fe6[_0x997b('0x9')](_0x997b('0xa'),attributes,{'tableName':_0x997b('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x997b('0xc')],'type':_0x997b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdbad32,_0x569380,_0x398437){var _0x31aa8e=_0x1f3fe6['models'];var _0x3bc7f8=_0xdbad32[_0x997b('0xe')]({'plain':!![]});if(_0x3bc7f8[_0x997b('0xf')]['toLowerCase']()==='in'||_0x3bc7f8[_0x997b('0xf')][_0x997b('0x10')]()===_0x997b('0x11')&&!_0x3bc7f8[_0x997b('0x12')]&&!_['isNil'](_0x3bc7f8[_0x997b('0x13')])){_0x31aa8e[_0x997b('0x14')][_0x997b('0x15')]({'where':{'id':_0x3bc7f8[_0x997b('0x16')]}})[_0x997b('0x17')](function(_0x107b41){if(_0x107b41){_0x107b41[_0x997b('0x18')]({'lastMsgAt':_0x3bc7f8[_0x997b('0x19')],'lastMsgDirection':_0x3bc7f8[_0x997b('0xf')][_0x997b('0x10')]()});}})['catch'](function(_0x32db7d){console[_0x997b('0x1a')](_0x32db7d);});}_0x398437();}},'charset':_0x997b('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4619=['get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT'];(function(_0x255c58,_0x27700d){var _0x56cb9e=function(_0x4cad2e){while(--_0x4cad2e){_0x255c58['push'](_0x255c58['shift']());}};_0x56cb9e(++_0x27700d);}(_0x4619,0xcc));var _0x9461=function(_0x546e84,_0x31100d){_0x546e84=_0x546e84-0x0;var _0x254a14=_0x4619[_0x546e84];return _0x254a14;};'use strict';var _=require(_0x9461('0x0'));var util=require(_0x9461('0x1'));var logger=require('../../config/logger')(_0x9461('0x2'));var moment=require('moment');var BPromise=require(_0x9461('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9461('0x4'));var config=require('../../config/environment');var attributes=require(_0x9461('0x5'));module[_0x9461('0x6')]=function(_0x40fd56,_0x2a8885){return _0x40fd56[_0x9461('0x7')](_0x9461('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x9461('0x9'),'fields':[_0x9461('0xa')],'type':_0x9461('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x108baf,_0x5580b9,_0x498d74){var _0x4158ad=_0x40fd56['models'];var _0x597369=_0x108baf[_0x9461('0xc')]({'plain':!![]});if(_0x597369[_0x9461('0xd')]['toLowerCase']()==='in'||_0x597369[_0x9461('0xd')][_0x9461('0xe')]()===_0x9461('0xf')&&!_0x597369[_0x9461('0x10')]&&!_[_0x9461('0x11')](_0x597369[_0x9461('0x12')])){_0x4158ad[_0x9461('0x13')][_0x9461('0x14')]({'where':{'id':_0x597369[_0x9461('0x15')]}})['then'](function(_0x476b19){if(_0x476b19){_0x476b19[_0x9461('0x16')]({'lastMsgAt':_0x597369[_0x9461('0x17')],'lastMsgDirection':_0x597369['direction']['toLowerCase']()});}})[_0x9461('0x18')](function(_0x1c9e8f){console['error'](_0x1c9e8f);});}_0x498d74();}},'charset':_0x9461('0x19'),'collate':_0x9461('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 55ed05b..f1a72c4 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 _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x1467c4,_0xbc1d88){var _0x366f12=function(_0x48d316){while(--_0x48d316){_0x1467c4['push'](_0x1467c4['shift']());}};_0x366f12(++_0xbc1d88);}(_0x4b84,0x1cc));var _0x44b8=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x4b84[_0x229128];return _0x1875b9;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x25367f,_0x39dd29){var _0x1e3d32=function(_0x31f447){while(--_0x31f447){_0x25367f['push'](_0x25367f['shift']());}};_0x1e3d32(++_0x39dd29);}(_0x54ef,0x112));var _0xf54e=function(_0x31ec1d,_0x390c3f){_0x31ec1d=_0x31ec1d-0x0;var _0x224a1a=_0x54ef[_0x31ec1d];return _0x224a1a;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5581237..fc37c15 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 _0xd578=['update','emit','register','length','./faxMessage.events','save'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd578,0x19c));var _0x8d57=function(_0x34711b,_0x5d29fd){_0x34711b=_0x34711b-0x0;var _0x2bca38=_0xd578[_0x34711b];return _0x2bca38;};'use strict';var FaxMessageEvents=require(_0x8d57('0x0'));var events=[_0x8d57('0x1'),'remove',_0x8d57('0x2')];function createListener(_0x4414f0,_0x3aa908){return function(_0x1d3c45){_0x3aa908[_0x8d57('0x3')](_0x4414f0,_0x1d3c45);};}function removeListener(_0x2a5ece,_0x441c67){return function(){FaxMessageEvents['removeListener'](_0x2a5ece,_0x441c67);};}exports[_0x8d57('0x4')]=function(_0x1c1ce5){for(var _0x3fa97d=0x0,_0x59e2bc=events[_0x8d57('0x5')];_0x3fa97d<_0x59e2bc;_0x3fa97d++){var _0x29214f=events[_0x3fa97d];var _0x2c6566=createListener('faxMessage:'+_0x29214f,_0x1c1ce5);FaxMessageEvents['on'](_0x29214f,_0x2c6566);}}; \ No newline at end of file +var _0xe4b9=['faxMessage:','./faxMessage.events','save','remove','update','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe4b9,0x91));var _0x9e4b=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0xe4b9[_0xfcdda0];return _0x17ebe3;};'use strict';var FaxMessageEvents=require(_0x9e4b('0x0'));var events=[_0x9e4b('0x1'),_0x9e4b('0x2'),_0x9e4b('0x3')];function createListener(_0x48871d,_0x5d1738){return function(_0x25d828){_0x5d1738['emit'](_0x48871d,_0x25d828);};}function removeListener(_0x530e64,_0x256d3d){return function(){FaxMessageEvents[_0x9e4b('0x4')](_0x530e64,_0x256d3d);};}exports[_0x9e4b('0x5')]=function(_0x400134){for(var _0x21d0f9=0x0,_0xa1501f=events[_0x9e4b('0x6')];_0x21d0f9<_0xa1501f;_0x21d0f9++){var _0x1f350c=events[_0x21d0f9];var _0x67ddda=createListener(_0x9e4b('0x7')+_0x1f350c,_0x400134);FaxMessageEvents['on'](_0x1f350c,_0x67ddda);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 139cd97..9bf3758 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 _0xe13a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','util','path'];(function(_0x4f6e0b,_0x424264){var _0x304438=function(_0x4328eb){while(--_0x4328eb){_0x4f6e0b['push'](_0x4f6e0b['shift']());}};_0x304438(++_0x424264);}(_0xe13a,0x178));var _0xae13=function(_0x21eb83,_0x415ce1){_0x21eb83=_0x21eb83-0x0;var _0x3383bc=_0xe13a[_0x21eb83];return _0x3383bc;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/describe',auth[_0xae13('0xa')](),controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller['download']);router[_0xae13('0x10')]('/',auth[_0xae13('0xa')](),interaction[_0xae13('0x11')](_0xae13('0x12'),_0xae13('0x13')),controller[_0xae13('0x14')]);router[_0xae13('0x15')]('/:id',auth[_0xae13('0xa')](),controller[_0xae13('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0xae13('0x17'),auth[_0xae13('0xa')](),controller[_0xae13('0x18')]);router[_0xae13('0x19')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller['destroy']);module[_0xae13('0x1a')]=router; \ No newline at end of file +var _0x2547=['/:id/download','download','post','tracked','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x2547,0x1cd));var _0x7254=function(_0x10e867,_0x1d26a9){_0x10e867=_0x10e867-0x0;var _0x12a679=_0x2547[_0x10e867];return _0x12a679;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/',auth[_0x7254('0xa')](),interaction[_0x7254('0x12')]('fax',_0x7254('0x13')),controller['create']);router[_0x7254('0x14')]('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0x15')]);router[_0x7254('0x14')](_0x7254('0x16'),auth[_0x7254('0xa')](),controller[_0x7254('0x17')]);router[_0x7254('0x14')](_0x7254('0x18'),auth[_0x7254('0xa')](),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),controller['destroy']);module[_0x7254('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2273b73..b95a9ad 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 _0x3599=['exports','STRING','name','beepall','sequelize'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x3599,0x185));var _0x9359=function(_0x5b6be9,_0x5b142c){_0x5b6be9=_0x5b6be9-0x0;var _0x252048=_0x3599[_0x5b6be9];return _0x252048;};'use strict';var Sequelize=require(_0x9359('0x0'));module[_0x9359('0x1')]={'name':{'type':Sequelize[_0x9359('0x2')],'unique':_0x9359('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9359('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x9359('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc5e4=['rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x19e192,_0x3defa2){var _0x40f875=function(_0x335b3c){while(--_0x335b3c){_0x19e192['push'](_0x19e192['shift']());}};_0x40f875(++_0x3defa2);}(_0xc5e4,0x117));var _0x4c5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc5e4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x4c5e('0x0')]={'name':{'type':Sequelize[_0x4c5e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4c5e('0x1')]},'timeout':{'type':Sequelize[_0x4c5e('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4c5e('0x3'),_0x4c5e('0x4'),_0x4c5e('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4c5e('0x2')],'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 284b26c..0daad70 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 _0x1b05=['localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','key','model','map','keys','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','sequelize','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis'];(function(_0x12db71,_0x4ac41b){var _0x2dacbd=function(_0x5b94c1){while(--_0x5b94c1){_0x12db71['push'](_0x12db71['shift']());}};_0x2dacbd(++_0x4ac41b);}(_0x1b05,0x79));var _0x51b0=function(_0x1852c4,_0x458b55){_0x1852c4=_0x1852c4-0x0;var _0x5d68e5=_0x1b05[_0x1852c4];return _0x5d68e5;};'use strict';var emlformat=require(_0x51b0('0x0'));var rimraf=require(_0x51b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51b0('0x2'));var rp=require(_0x51b0('0x3'));var moment=require(_0x51b0('0x4'));var BPromise=require(_0x51b0('0x5'));var Mustache=require(_0x51b0('0x6'));var util=require(_0x51b0('0x7'));var path=require(_0x51b0('0x8'));var sox=require(_0x51b0('0x9'));var csv=require(_0x51b0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x51b0('0xb'));var crypto=require(_0x51b0('0xc'));var jsforce=require(_0x51b0('0xd'));var deskjs=require(_0x51b0('0xe'));var toCsv=require(_0x51b0('0xa'));var querystring=require(_0x51b0('0xf'));var Papa=require(_0x51b0('0x10'));var Redis=require(_0x51b0('0x11'));var authService=require(_0x51b0('0x12'));var qs=require(_0x51b0('0x13'));var as=require(_0x51b0('0x14'));var hardwareService=require(_0x51b0('0x15'));var logger=require(_0x51b0('0x16'))(_0x51b0('0x17'));var utils=require(_0x51b0('0x18'));var config=require(_0x51b0('0x19'));var licenseUtil=require(_0x51b0('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x51b0('0x1b')](config[_0x51b0('0x1c')],{'host':_0x51b0('0x1d'),'port':0x18eb});var socket=require(_0x51b0('0x1e'))(new Redis(config[_0x51b0('0x1c')]));require(_0x51b0('0x1f'))[_0x51b0('0x20')](socket);function respondWithStatusCode(_0x1aa3c2,_0x54aef9){_0x54aef9=_0x54aef9||0xcc;return function(_0x9ff02c){if(_0x9ff02c){return _0x1aa3c2[_0x51b0('0x21')](_0x54aef9);}return _0x1aa3c2[_0x51b0('0x22')](_0x54aef9)[_0x51b0('0x23')]();};}function respondWithResult(_0x441b7d,_0x20d7dd){_0x20d7dd=_0x20d7dd||0xc8;return function(_0x8154e0){if(_0x8154e0){return _0x441b7d[_0x51b0('0x22')](_0x20d7dd)[_0x51b0('0x24')](_0x8154e0);}};}function respondWithFilteredResult(_0x12d719,_0x29dd2f){return function(_0x594e4e){if(_0x594e4e){var _0x59e7c0=typeof _0x29dd2f['offset']===_0x51b0('0x25')&&typeof _0x29dd2f[_0x51b0('0x26')]===_0x51b0('0x25');var _0x78d3ab=_0x594e4e['count'];var _0xbd9302=_0x59e7c0?0x0:_0x29dd2f[_0x51b0('0x27')];var _0x1c3c7f=_0x59e7c0?_0x594e4e[_0x51b0('0x28')]:_0x29dd2f['offset']+_0x29dd2f[_0x51b0('0x26')];var _0x4d52ef;if(_0x1c3c7f>=_0x78d3ab){_0x1c3c7f=_0x78d3ab;_0x4d52ef=0xc8;}else{_0x4d52ef=0xce;}_0x12d719['status'](_0x4d52ef);return _0x12d719[_0x51b0('0x29')](_0x51b0('0x2a'),_0xbd9302+'-'+_0x1c3c7f+'/'+_0x78d3ab)[_0x51b0('0x24')](_0x594e4e);}return null;};}function patchUpdates(_0x113c40){return function(_0x512ca1){try{jsonpatch['apply'](_0x512ca1,_0x113c40,!![]);}catch(_0x331549){return BPromise[_0x51b0('0x2b')](_0x331549);}return _0x512ca1[_0x51b0('0x2c')]();};}function saveUpdates(_0x13ce17,_0x1492fd){return function(_0x1a380f){if(_0x1a380f){return _0x1a380f['update'](_0x13ce17)[_0x51b0('0x2d')](function(_0x2b008c){return _0x2b008c;});}return null;};}function removeEntity(_0x41b02b,_0x38dfec){return function(_0x4d2b73){if(_0x4d2b73){return _0x4d2b73[_0x51b0('0x2e')]()[_0x51b0('0x2d')](function(){var _0x161c6d=_0x4d2b73['get']({'plain':!![]});var _0x221ac4=_0x51b0('0x2f');return db[_0x51b0('0x30')][_0x51b0('0x2e')]({'where':{'type':_0x221ac4,'resourceId':_0x161c6d['id']}})[_0x51b0('0x2d')](function(){return _0x4d2b73;});})['then'](function(){_0x41b02b['status'](0xcc)[_0x51b0('0x23')]();});}};}function handleEntityNotFound(_0x263853,_0x5d76ba){return function(_0x24cbcf){if(!_0x24cbcf){_0x263853['sendStatus'](0x194);}return _0x24cbcf;};}function handleError(_0x5b8e2f,_0x2ab9ca){_0x2ab9ca=_0x2ab9ca||0x1f4;return function(_0xdb07a8){logger[_0x51b0('0x31')](_0xdb07a8[_0x51b0('0x32')]);if(_0xdb07a8['name']){delete _0xdb07a8[_0x51b0('0x33')];}_0x5b8e2f['status'](_0x2ab9ca)[_0x51b0('0x34')](_0xdb07a8);};}exports[_0x51b0('0x35')]=function(_0x3ab87d,_0x1b299d){var _0x221e56={},_0x308c9e={},_0x59d030={'count':0x0,'rows':[]};var _0x1596b0=_['map'](db[_0x51b0('0x36')]['rawAttributes'],function(_0x543746){return{'name':_0x543746['fieldName'],'type':_0x543746['type'][_0x51b0('0x37')]};});_0x308c9e[_0x51b0('0x38')]=_[_0x51b0('0x39')](_0x1596b0,_0x51b0('0x33'));_0x308c9e['query']=_[_0x51b0('0x3a')](_0x3ab87d[_0x51b0('0x3b')]);_0x308c9e['filters']=_[_0x51b0('0x3c')](_0x308c9e[_0x51b0('0x38')],_0x308c9e['query']);_0x221e56[_0x51b0('0x3d')]=_[_0x51b0('0x3c')](_0x308c9e[_0x51b0('0x38')],qs[_0x51b0('0x3e')](_0x3ab87d[_0x51b0('0x3b')]['fields']));_0x221e56[_0x51b0('0x3d')]=_0x221e56['attributes']['length']?_0x221e56[_0x51b0('0x3d')]:_0x308c9e[_0x51b0('0x38')];if(!_0x3ab87d[_0x51b0('0x3b')]['hasOwnProperty'](_0x51b0('0x3f'))){_0x221e56['limit']=qs[_0x51b0('0x26')](_0x3ab87d[_0x51b0('0x3b')][_0x51b0('0x26')]);_0x221e56[_0x51b0('0x27')]=qs['offset'](_0x3ab87d[_0x51b0('0x3b')]['offset']);}_0x221e56[_0x51b0('0x40')]=qs[_0x51b0('0x41')](_0x3ab87d[_0x51b0('0x3b')][_0x51b0('0x41')]);_0x221e56[_0x51b0('0x42')]=qs['filters'](_[_0x51b0('0x43')](_0x3ab87d[_0x51b0('0x3b')],_0x308c9e[_0x51b0('0x44')]),_0x1596b0);if(_0x3ab87d[_0x51b0('0x3b')][_0x51b0('0x45')]){_0x221e56[_0x51b0('0x42')]=_[_0x51b0('0x46')](_0x221e56['where'],{'$or':_[_0x51b0('0x39')](_0x1596b0,function(_0x4c475e){if(_0x4c475e['type']!==_0x51b0('0x47')){var _0x5c62f0={};_0x5c62f0[_0x4c475e[_0x51b0('0x33')]]={'$like':'%'+_0x3ab87d['query'][_0x51b0('0x45')]+'%'};return _0x5c62f0;}})});}_0x221e56=_[_0x51b0('0x46')]({},_0x221e56,_0x3ab87d[_0x51b0('0x48')]);var _0x420b40={'where':_0x221e56[_0x51b0('0x42')]};return db[_0x51b0('0x36')]['count'](_0x420b40)['then'](function(_0x1703cc){_0x59d030[_0x51b0('0x28')]=_0x1703cc;if(_0x3ab87d[_0x51b0('0x3b')][_0x51b0('0x49')]){_0x221e56[_0x51b0('0x4a')]=[{'all':!![]}];}return db[_0x51b0('0x36')][_0x51b0('0x4b')](_0x221e56);})['then'](function(_0x322e4c){_0x59d030[_0x51b0('0x4c')]=_0x322e4c;return _0x59d030;})[_0x51b0('0x2d')](respondWithFilteredResult(_0x1b299d,_0x221e56))[_0x51b0('0x4d')](handleError(_0x1b299d,null));};exports['show']=function(_0x361c53,_0x1f1677){var _0x4c145c={'raw':!![],'where':{'id':_0x361c53[_0x51b0('0x4e')]['id']}},_0x19ed27={};_0x19ed27[_0x51b0('0x38')]=_[_0x51b0('0x3a')](db['FaxQueue'][_0x51b0('0x4f')]);_0x19ed27[_0x51b0('0x3b')]=_[_0x51b0('0x3a')](_0x361c53[_0x51b0('0x3b')]);_0x19ed27[_0x51b0('0x44')]=_[_0x51b0('0x3c')](_0x19ed27['model'],_0x19ed27[_0x51b0('0x3b')]);_0x4c145c[_0x51b0('0x3d')]=_[_0x51b0('0x3c')](_0x19ed27['model'],qs['fields'](_0x361c53['query']['fields']));_0x4c145c[_0x51b0('0x3d')]=_0x4c145c[_0x51b0('0x3d')][_0x51b0('0x50')]?_0x4c145c[_0x51b0('0x3d')]:_0x19ed27[_0x51b0('0x38')];if(_0x361c53[_0x51b0('0x3b')][_0x51b0('0x49')]){_0x4c145c[_0x51b0('0x4a')]=[{'all':!![]}];}_0x4c145c=_['merge']({},_0x4c145c,_0x361c53[_0x51b0('0x48')]);return db[_0x51b0('0x36')][_0x51b0('0x51')](_0x4c145c)['then'](handleEntityNotFound(_0x1f1677,null))[_0x51b0('0x2d')](respondWithResult(_0x1f1677,null))[_0x51b0('0x4d')](handleError(_0x1f1677,null));};exports[_0x51b0('0x52')]=function(_0x54b5ad,_0x114aa4){return db['FaxQueue'][_0x51b0('0x52')](_0x54b5ad['body'],{})[_0x51b0('0x2d')](function(_0x3610b9){var _0x414c9c=_0x54b5ad['user'][_0x51b0('0x53')]({'plain':!![]});if(!_0x414c9c)throw new Error(_0x51b0('0x54'));if(_0x414c9c[_0x51b0('0x55')]===_0x51b0('0x56')){var _0x918cae=_0x3610b9[_0x51b0('0x53')]({'plain':!![]});var _0x233605='FaxQueues';return db[_0x51b0('0x57')][_0x51b0('0x51')]({'where':{'name':_0x233605,'userProfileId':_0x414c9c[_0x51b0('0x58')]},'raw':!![]})[_0x51b0('0x2d')](function(_0x16a621){if(_0x16a621&&_0x16a621[_0x51b0('0x59')]===0x0){return db[_0x51b0('0x30')][_0x51b0('0x52')]({'name':_0x918cae[_0x51b0('0x33')],'resourceId':_0x918cae['id'],'type':_0x16a621['name'],'sectionId':_0x16a621['id']},{})[_0x51b0('0x2d')](function(){return _0x3610b9;});}else{return _0x3610b9;}})[_0x51b0('0x4d')](function(_0x262ccf){logger[_0x51b0('0x31')](_0x51b0('0x5a'),_0x262ccf);throw _0x262ccf;});}return _0x3610b9;})['then'](respondWithResult(_0x114aa4,0xc9))['catch'](handleError(_0x114aa4,null));};exports[_0x51b0('0x5b')]=function(_0x3def02,_0x2ee030){if(_0x3def02[_0x51b0('0x5c')]['id']){delete _0x3def02[_0x51b0('0x5c')]['id'];}return db[_0x51b0('0x36')][_0x51b0('0x51')]({'where':{'id':_0x3def02['params']['id']}})[_0x51b0('0x2d')](handleEntityNotFound(_0x2ee030,null))['then'](saveUpdates(_0x3def02[_0x51b0('0x5c')],null))[_0x51b0('0x2d')](respondWithResult(_0x2ee030,null))[_0x51b0('0x4d')](handleError(_0x2ee030,null));};exports['destroy']=function(_0x459b31,_0x3061c7){return db[_0x51b0('0x36')][_0x51b0('0x51')]({'where':{'id':_0x459b31[_0x51b0('0x4e')]['id']}})[_0x51b0('0x2d')](handleEntityNotFound(_0x3061c7,null))[_0x51b0('0x2d')](removeEntity(_0x3061c7,null))[_0x51b0('0x4d')](handleError(_0x3061c7,null));};exports[_0x51b0('0x5d')]=function(_0x165e53,_0x17b2e0){return db[_0x51b0('0x36')][_0x51b0('0x5d')]()[_0x51b0('0x2d')](respondWithResult(_0x17b2e0,null))[_0x51b0('0x4d')](handleError(_0x17b2e0,null));};exports[_0x51b0('0x5e')]=function(_0x47076a,_0x1b9a47,_0x3ce3d5){var _0x222cf3={'raw':!![],'where':{}},_0x1a0db5={},_0x2e8249;return db[_0x51b0('0x36')][_0x51b0('0x5f')]({'where':{'id':_0x47076a[_0x51b0('0x4e')]['id']}})[_0x51b0('0x2d')](handleEntityNotFound(_0x1b9a47,null))[_0x51b0('0x2d')](function(_0x4fe94d){if(_0x4fe94d){_0x2e8249=_0x4fe94d[_0x51b0('0x53')]({'plain':!![]});_0x1a0db5[_0x51b0('0x38')]=_['keys'](db[_0x51b0('0x60')][_0x51b0('0x4f')]);_0x1a0db5[_0x51b0('0x3b')]=_[_0x51b0('0x3a')](_0x47076a[_0x51b0('0x3b')]);_0x1a0db5[_0x51b0('0x44')]=_['intersection'](_0x1a0db5[_0x51b0('0x38')],_0x1a0db5[_0x51b0('0x3b')]);_0x222cf3[_0x51b0('0x3d')]=_[_0x51b0('0x3c')](_0x1a0db5[_0x51b0('0x38')],qs[_0x51b0('0x3e')](_0x47076a['query'][_0x51b0('0x3e')]));_0x222cf3[_0x51b0('0x3d')]=_0x222cf3[_0x51b0('0x3d')]['length']?_0x222cf3[_0x51b0('0x3d')]:_0x1a0db5[_0x51b0('0x38')];if(!_0x47076a[_0x51b0('0x3b')][_0x51b0('0x61')]('nolimit')){_0x222cf3['limit']=qs[_0x51b0('0x26')](_0x47076a['query'][_0x51b0('0x26')]);_0x222cf3[_0x51b0('0x27')]=qs[_0x51b0('0x27')](_0x47076a[_0x51b0('0x3b')][_0x51b0('0x27')]);}_0x222cf3[_0x51b0('0x40')]=qs[_0x51b0('0x41')](_0x47076a[_0x51b0('0x3b')]['sort']);_0x222cf3[_0x51b0('0x42')]=qs['filters'](_[_0x51b0('0x43')](_0x47076a[_0x51b0('0x3b')],_0x1a0db5[_0x51b0('0x44')]));_0x222cf3[_0x51b0('0x42')][_0x51b0('0x62')]=_0x4fe94d['id'];if(_0x47076a[_0x51b0('0x3b')][_0x51b0('0x45')]){_0x222cf3[_0x51b0('0x42')]=_[_0x51b0('0x46')](_0x222cf3[_0x51b0('0x42')],{'$or':_[_0x51b0('0x39')](_0x222cf3['attributes'],function(_0x1a7b59){var _0x53c492={};_0x53c492[_0x1a7b59]={'$like':'%'+_0x47076a['query'][_0x51b0('0x45')]+'%'};return _0x53c492;})});}_0x222cf3=_[_0x51b0('0x46')]({},_0x222cf3,_0x47076a[_0x51b0('0x48')]);return db[_0x51b0('0x60')][_0x51b0('0x4b')](_0x222cf3);}})[_0x51b0('0x2d')](function(_0xece44b){if(_0xece44b){return db['User'][_0x51b0('0x63')]({'where':{'id':_['map'](_0xece44b,_0x51b0('0x64')),'role':'agent'},'attributes':['id','name',_0x51b0('0x65'),_0x51b0('0x66'),_0x51b0('0x67')]});}})[_0x51b0('0x2d')](function(_0x394d27){if(_0x394d27){return{'count':_0x394d27[_0x51b0('0x28')],'rows':_['map'](_0x394d27['rows'],function(_0x37ac1b){return{'membername':_0x37ac1b['name'],'UserId':_0x37ac1b['id'],'queue_name':_0x2e8249['name'],'FaxQueueId':_0x2e8249['id'],'interface':util[_0x51b0('0x68')](_0x51b0('0x69'),_0x51b0('0x6a'),_0x37ac1b[_0x51b0('0x33')]),'penalty':0x0,'paused':_0x37ac1b[_0x51b0('0x65')],'createdAt':_0x37ac1b[_0x51b0('0x67')],'updatedAt':_0x37ac1b[_0x51b0('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x51b0('0x2d')](respondWithFilteredResult(_0x1b9a47,_0x222cf3))[_0x51b0('0x4d')](handleError(_0x1b9a47,null));};exports[_0x51b0('0x6b')]=function(_0x117ce8,_0x456a92,_0x8876f2){var _0x381e03={};var _0x106dce={};var _0x35dca5;var _0x217daf;return db['FaxQueue'][_0x51b0('0x5f')]({'where':{'id':_0x117ce8[_0x51b0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x456a92,null))['then'](function(_0x2bf52f){if(_0x2bf52f){_0x35dca5=_0x2bf52f;_0x106dce['model']=_[_0x51b0('0x3a')](db[_0x51b0('0x6c')]['rawAttributes']);_0x106dce[_0x51b0('0x3b')]=_[_0x51b0('0x3a')](_0x117ce8[_0x51b0('0x3b')]);_0x106dce[_0x51b0('0x44')]=_[_0x51b0('0x3c')](_0x106dce[_0x51b0('0x38')],_0x106dce[_0x51b0('0x3b')]);_0x381e03[_0x51b0('0x3d')]=_[_0x51b0('0x3c')](_0x106dce[_0x51b0('0x38')],qs['fields'](_0x117ce8[_0x51b0('0x3b')][_0x51b0('0x3e')]));_0x381e03['attributes']=_0x381e03[_0x51b0('0x3d')][_0x51b0('0x50')]?_0x381e03['attributes']:_0x106dce[_0x51b0('0x38')];_0x381e03['order']=qs['sort'](_0x117ce8['query']['sort']);_0x381e03[_0x51b0('0x42')]=qs[_0x51b0('0x44')](_[_0x51b0('0x43')](_0x117ce8[_0x51b0('0x3b')],_0x106dce['filters']));if(_0x117ce8[_0x51b0('0x3b')]['filter']){_0x381e03[_0x51b0('0x42')]=_['merge'](_0x381e03[_0x51b0('0x42')],{'$or':_['map'](_0x381e03[_0x51b0('0x3d')],function(_0x2935df){var _0x361ac9={};_0x361ac9[_0x2935df]={'$like':'%'+_0x117ce8[_0x51b0('0x3b')]['filter']+'%'};return _0x361ac9;})});}_0x381e03=_[_0x51b0('0x46')]({},_0x381e03,_0x117ce8[_0x51b0('0x48')]);return _0x35dca5['getTeams'](_0x381e03);}})['then'](function(_0x116efc){if(_0x116efc){_0x217daf=_0x116efc[_0x51b0('0x50')];if(!_0x117ce8[_0x51b0('0x3b')]['hasOwnProperty'](_0x51b0('0x3f'))){_0x381e03['limit']=qs['limit'](_0x117ce8[_0x51b0('0x3b')][_0x51b0('0x26')]);_0x381e03[_0x51b0('0x27')]=qs[_0x51b0('0x27')](_0x117ce8[_0x51b0('0x3b')][_0x51b0('0x27')]);}return _0x35dca5[_0x51b0('0x6b')](_0x381e03);}})[_0x51b0('0x2d')](function(_0x103b43){if(_0x103b43){return _0x103b43?{'count':_0x217daf,'rows':_0x103b43}:null;}})[_0x51b0('0x2d')](respondWithResult(_0x456a92,null))[_0x51b0('0x4d')](handleError(_0x456a92,null));};exports[_0x51b0('0x6d')]=function(_0x3c5278,_0x20958a,_0x44096e){var _0x8fb488=_0x3c5278[_0x51b0('0x5c')][_0x51b0('0x6e')];return db[_0x51b0('0x6c')][_0x51b0('0x4b')]({'where':{'id':_0x8fb488},'attributes':['id'],'include':[{'model':db[_0x51b0('0x6f')],'as':_0x51b0('0x70'),'attributes':['id',_0x51b0('0x33'),_0x51b0('0x71'),'voicePause',_0x51b0('0x72')],'raw':!![]}]})[_0x51b0('0x2d')](function(_0x41bf0f){if(_0x41bf0f){var _0x318d5f=_[_0x51b0('0x73')](_0x41bf0f,function(_0x349e85){var _0x5871eb=_0x349e85[_0x51b0('0x53')]({'plain':!![]});return _0x5871eb[_0x51b0('0x70')];});return db[_0x51b0('0x36')]['find']({'where':{'id':_0x3c5278[_0x51b0('0x4e')]['id']}})['then'](function(_0x2e2153){return db['sequelize'][_0x51b0('0x74')](function(_0x12d461){return _0x2e2153[_0x51b0('0x6d')](_0x8fb488,{'transaction':_0x12d461})[_0x51b0('0x2d')](function(){return BPromise[_0x51b0('0x75')](_0x318d5f,function(_0x264977){return db[_0x51b0('0x60')][_0x51b0('0x76')]({'where':{'UserId':_0x264977['id'],'FaxQueueId':_0x3c5278['params']['id']},'transaction':_0x12d461});});})[_0x51b0('0x2d')](function(){_0x318d5f[_0x51b0('0x77')](function(_0x1a6827){socket[_0x51b0('0x78')](_0x51b0('0x79'),{'UserId':_0x1a6827['id'],'FaxQueueId':_0x2e2153['id']});});});});});}})[_0x51b0('0x2d')](respondWithStatusCode(_0x20958a,null))[_0x51b0('0x4d')](handleError(_0x20958a,null));};exports['removeTeams']=function(_0x6dfbc1,_0x37567c,_0x5dc604){return db[_0x51b0('0x6c')]['findAll']({'where':{'id':_0x6dfbc1[_0x51b0('0x3b')][_0x51b0('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x51b0('0x6f')],'as':_0x51b0('0x70'),'attributes':['id'],'raw':!![]}]})[_0x51b0('0x2d')](handleEntityNotFound(_0x37567c,null))['then'](function(_0x4c4305){var _0x4a603d=_[_0x51b0('0x39')](_0x4c4305,'id');var _0xbac7d5=[];var _0x5756cd=[];var _0x45b4ef=squel[_0x51b0('0x7a')]();_0x45b4ef[_0x51b0('0x7b')](_0x51b0('0x7c'))[_0x51b0('0x7d')](_0x51b0('0x7e'),'tq')[_0x51b0('0x7f')](_0x51b0('0x80'),'ut',_0x51b0('0x81'))[_0x51b0('0x42')](_0x51b0('0x82'),_0x6dfbc1[_0x51b0('0x4e')]['id']);for(var _0x5187fc=0x0;_0x5187fc<_0x4c4305[_0x51b0('0x50')];_0x5187fc+=0x1){let _0x43960b=_0x4c4305[_0x5187fc];for(var _0x58b4e5=0x0;_0x58b4e5<_0x43960b[_0x51b0('0x70')][_0x51b0('0x50')];_0x58b4e5+=0x1){let _0x17400d=_0x43960b[_0x51b0('0x70')][_0x58b4e5];var _0x3e323f=_0x45b4ef[_0x51b0('0x83')]();_0x3e323f[_0x51b0('0x42')]('ut.UserId\x20=\x20?',_0x17400d['id']);_0x5756cd[_0x51b0('0x84')](db['sequelize'][_0x51b0('0x3b')](_0x3e323f[_0x51b0('0x85')](),{'type':db['sequelize'][_0x51b0('0x86')]['SELECT']})['then'](function(_0x5734bc){if(_0x5734bc[_0x51b0('0x50')]===0x1){return _0x17400d['id'];}else{var _0x210315=_[_0x51b0('0x87')](_[_0x51b0('0x39')](_0x5734bc,_0x51b0('0x88')),function(_0xb655e2){return _[_0x51b0('0x89')](_0x4a603d,_0xb655e2);});if(_0x210315){return _0x17400d['id'];}}}));}}return BPromise[_0x51b0('0x8a')](_0x5756cd)[_0x51b0('0x2d')](function(_0x2cad9e){_0xbac7d5=_(_0xbac7d5)[_0x51b0('0x8b')](_0x2cad9e)[_0x51b0('0x8c')]()[_0x51b0('0x8d')]();return db[_0x51b0('0x36')][_0x51b0('0x51')]({'where':{'id':_0x6dfbc1[_0x51b0('0x4e')]['id']}})[_0x51b0('0x2d')](function(_0x46e8f3){return db[_0x51b0('0x8e')][_0x51b0('0x74')](function(_0x39d03e){return _0x46e8f3['removeTeams'](_0x6dfbc1[_0x51b0('0x3b')][_0x51b0('0x6e')],{'transaction':_0x39d03e})[_0x51b0('0x2d')](function(){if(!_[_0x51b0('0x8f')](_0xbac7d5)){return _0x46e8f3['removeAgents'](_0xbac7d5,{'transaction':_0x39d03e});}})[_0x51b0('0x2d')](function(){_0xbac7d5['forEach'](function(_0x380b5f){socket[_0x51b0('0x78')](_0x51b0('0x90'),{'UserId':_0x380b5f,'FaxQueueId':_0x46e8f3['id']});});});});});});})[_0x51b0('0x2d')](respondWithStatusCode(_0x37567c,null))[_0x51b0('0x4d')](handleError(_0x37567c,null));};exports[_0x51b0('0x91')]=function(_0x408d0b,_0x285820,_0x4fee78){return db['FaxQueue']['find']({'where':{'id':_0x408d0b[_0x51b0('0x4e')]['id']}})[_0x51b0('0x2d')](handleEntityNotFound(_0x285820,null))[_0x51b0('0x2d')](function(_0x5dde08){if(_0x5dde08){return _0x5dde08[_0x51b0('0x91')](_0x408d0b[_0x51b0('0x5c')][_0x51b0('0x6e')],_[_0x51b0('0x92')](_0x408d0b[_0x51b0('0x5c')],['ids','id'])||{})[_0x51b0('0x93')](function(_0x4a832c){for(var _0x2f1aba=0x0;_0x2f1aba<_0x408d0b[_0x51b0('0x5c')][_0x51b0('0x6e')][_0x51b0('0x50')];_0x2f1aba+=0x1){socket[_0x51b0('0x78')](_0x51b0('0x79'),{'UserId':Number(_0x408d0b['body'][_0x51b0('0x6e')][_0x2f1aba]),'FaxQueueId':Number(_0x408d0b[_0x51b0('0x4e')]['id'])});}return _0x4a832c;});}})['then'](respondWithResult(_0x285820,null))[_0x51b0('0x4d')](handleError(_0x285820,null));};exports['removeAgents']=function(_0x2115e1,_0x519cdf,_0x3f6cfc){return db[_0x51b0('0x36')][_0x51b0('0x51')]({'where':{'id':_0x2115e1[_0x51b0('0x4e')]['id']}})[_0x51b0('0x2d')](handleEntityNotFound(_0x519cdf,null))[_0x51b0('0x2d')](function(_0x37bdc4){if(_0x37bdc4){return _0x37bdc4[_0x51b0('0x94')](_0x2115e1[_0x51b0('0x3b')][_0x51b0('0x6e')])[_0x51b0('0x2d')](function(){if(_['isArray'](_0x2115e1['query'][_0x51b0('0x6e')])){for(var _0x32f6e5=0x0;_0x32f6e5<_0x2115e1[_0x51b0('0x3b')][_0x51b0('0x6e')][_0x51b0('0x50')];_0x32f6e5+=0x1){socket['emit'](_0x51b0('0x90'),{'UserId':Number(_0x2115e1[_0x51b0('0x3b')]['ids'][_0x32f6e5]),'FaxQueueId':Number(_0x2115e1['params']['id'])});}}else{socket['emit'](_0x51b0('0x90'),{'UserId':Number(_0x2115e1['query']['ids']),'FaxQueueId':Number(_0x2115e1[_0x51b0('0x4e')]['id'])});}});}})[_0x51b0('0x2d')](respondWithStatusCode(_0x519cdf,null))[_0x51b0('0x4d')](handleError(_0x519cdf,null));};exports['getAgents']=function(_0x5dd09d,_0x5d8aa9,_0x449a91){var _0x4130c4={};var _0x4615b2={};var _0x47154f;var _0x49114d;return db[_0x51b0('0x36')][_0x51b0('0x5f')]({'where':{'id':_0x5dd09d['params']['id']}})[_0x51b0('0x2d')](handleEntityNotFound(_0x5d8aa9,null))[_0x51b0('0x2d')](function(_0x5c1dea){if(_0x5c1dea){_0x47154f=_0x5c1dea;_0x4615b2[_0x51b0('0x38')]=_[_0x51b0('0x3a')](db[_0x51b0('0x6f')][_0x51b0('0x4f')]);_0x4615b2[_0x51b0('0x3b')]=_['keys'](_0x5dd09d[_0x51b0('0x3b')]);_0x4615b2[_0x51b0('0x44')]=_[_0x51b0('0x3c')](_0x4615b2[_0x51b0('0x38')],_0x4615b2['query']);_0x4130c4[_0x51b0('0x3d')]=_[_0x51b0('0x3c')](_0x4615b2[_0x51b0('0x38')],qs[_0x51b0('0x3e')](_0x5dd09d[_0x51b0('0x3b')][_0x51b0('0x3e')]));_0x4130c4[_0x51b0('0x3d')]=_0x4130c4['attributes']['length']?_0x4130c4[_0x51b0('0x3d')]:_0x4615b2['model'];_0x4130c4['order']=qs[_0x51b0('0x41')](_0x5dd09d['query'][_0x51b0('0x41')]);_0x4130c4[_0x51b0('0x42')]=qs[_0x51b0('0x44')](_['pick'](_0x5dd09d[_0x51b0('0x3b')],_0x4615b2[_0x51b0('0x44')]));if(_0x5dd09d[_0x51b0('0x3b')][_0x51b0('0x45')]){_0x4130c4[_0x51b0('0x42')]=_[_0x51b0('0x46')](_0x4130c4['where'],{'$or':_[_0x51b0('0x39')](_0x4130c4[_0x51b0('0x3d')],function(_0x1473db){var _0x3550d5={};_0x3550d5[_0x1473db]={'$like':'%'+_0x5dd09d[_0x51b0('0x3b')][_0x51b0('0x45')]+'%'};return _0x3550d5;})});}_0x4130c4=_[_0x51b0('0x46')]({},_0x4130c4,_0x5dd09d['options']);return _0x47154f[_0x51b0('0x95')](_0x4130c4);}})[_0x51b0('0x2d')](function(_0x23625d){if(_0x23625d){_0x49114d=_0x23625d['length'];if(!_0x5dd09d[_0x51b0('0x3b')][_0x51b0('0x61')](_0x51b0('0x3f'))){_0x4130c4[_0x51b0('0x26')]=qs['limit'](_0x5dd09d[_0x51b0('0x3b')][_0x51b0('0x26')]);_0x4130c4['offset']=qs[_0x51b0('0x27')](_0x5dd09d[_0x51b0('0x3b')][_0x51b0('0x27')]);}return _0x47154f[_0x51b0('0x95')](_0x4130c4);}})[_0x51b0('0x2d')](function(_0x2358ba){if(_0x2358ba){return _0x2358ba?{'count':_0x49114d,'rows':_0x2358ba}:null;}})[_0x51b0('0x2d')](respondWithResult(_0x5d8aa9,null))[_0x51b0('0x4d')](handleError(_0x5d8aa9,null));}; \ No newline at end of file +var _0x96b4=['TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','index','map','FaxQueue','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne','UserFaxQueue','hasOwnProperty','filter','User','findAndCountAll','agent','faxPause','updatedAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','ids','select','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT'];(function(_0x25886f,_0x492785){var _0x12e414=function(_0x18d124){while(--_0x18d124){_0x25886f['push'](_0x25886f['shift']());}};_0x12e414(++_0x492785);}(_0x96b4,0x110));var _0x496b=function(_0x454f0a,_0xff10e0){_0x454f0a=_0x454f0a-0x0;var _0x368215=_0x96b4[_0x454f0a];return _0x368215;};'use strict';var emlformat=require(_0x496b('0x0'));var rimraf=require(_0x496b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x496b('0x2'));var rp=require(_0x496b('0x3'));var moment=require(_0x496b('0x4'));var BPromise=require(_0x496b('0x5'));var Mustache=require('mustache');var util=require(_0x496b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x496b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x496b('0x8'));var squel=require(_0x496b('0x9'));var crypto=require(_0x496b('0xa'));var jsforce=require(_0x496b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x496b('0xc'));var Papa=require(_0x496b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x496b('0xe'));var hardwareService=require(_0x496b('0xf'));var logger=require('../../config/logger')(_0x496b('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x496b('0x11'));var db=require(_0x496b('0x12'))['db'];config['redis']=_['defaults'](config[_0x496b('0x13')],{'host':_0x496b('0x14'),'port':0x18eb});var socket=require(_0x496b('0x15'))(new Redis(config['redis']));require(_0x496b('0x16'))[_0x496b('0x17')](socket);function respondWithStatusCode(_0x39939b,_0x250a4a){_0x250a4a=_0x250a4a||0xcc;return function(_0x5a9148){if(_0x5a9148){return _0x39939b['sendStatus'](_0x250a4a);}return _0x39939b[_0x496b('0x18')](_0x250a4a)[_0x496b('0x19')]();};}function respondWithResult(_0x12f59c,_0x377988){_0x377988=_0x377988||0xc8;return function(_0x3dd9fc){if(_0x3dd9fc){return _0x12f59c['status'](_0x377988)[_0x496b('0x1a')](_0x3dd9fc);}};}function respondWithFilteredResult(_0x9899ab,_0x2517d1){return function(_0x456625){if(_0x456625){var _0x56d97d=typeof _0x2517d1[_0x496b('0x1b')]===_0x496b('0x1c')&&typeof _0x2517d1['limit']===_0x496b('0x1c');var _0x4bb066=_0x456625['count'];var _0x565774=_0x56d97d?0x0:_0x2517d1[_0x496b('0x1b')];var _0x459695=_0x56d97d?_0x456625[_0x496b('0x1d')]:_0x2517d1[_0x496b('0x1b')]+_0x2517d1[_0x496b('0x1e')];var _0x35147b;if(_0x459695>=_0x4bb066){_0x459695=_0x4bb066;_0x35147b=0xc8;}else{_0x35147b=0xce;}_0x9899ab[_0x496b('0x18')](_0x35147b);return _0x9899ab['set'](_0x496b('0x1f'),_0x565774+'-'+_0x459695+'/'+_0x4bb066)['json'](_0x456625);}return null;};}function patchUpdates(_0x1442d0){return function(_0x2b3ff2){try{jsonpatch['apply'](_0x2b3ff2,_0x1442d0,!![]);}catch(_0x4f63c3){return BPromise[_0x496b('0x20')](_0x4f63c3);}return _0x2b3ff2[_0x496b('0x21')]();};}function saveUpdates(_0x49a73c,_0x520225){return function(_0x596665){if(_0x596665){return _0x596665[_0x496b('0x22')](_0x49a73c)['then'](function(_0x5b9dfe){return _0x5b9dfe;});}return null;};}function removeEntity(_0x2ca43d,_0x504fb5){return function(_0x21d930){if(_0x21d930){return _0x21d930[_0x496b('0x23')]()[_0x496b('0x24')](function(){var _0x273ed9=_0x21d930[_0x496b('0x25')]({'plain':!![]});var _0x4d8f86=_0x496b('0x26');return db[_0x496b('0x27')][_0x496b('0x23')]({'where':{'type':_0x4d8f86,'resourceId':_0x273ed9['id']}})[_0x496b('0x24')](function(){return _0x21d930;});})[_0x496b('0x24')](function(){_0x2ca43d['status'](0xcc)[_0x496b('0x19')]();});}};}function handleEntityNotFound(_0x1832b1,_0x561939){return function(_0x2e809b){if(!_0x2e809b){_0x1832b1[_0x496b('0x28')](0x194);}return _0x2e809b;};}function handleError(_0x48c48d,_0x592d57){_0x592d57=_0x592d57||0x1f4;return function(_0x17981b){logger[_0x496b('0x29')](_0x17981b[_0x496b('0x2a')]);if(_0x17981b['name']){delete _0x17981b['name'];}_0x48c48d['status'](_0x592d57)['send'](_0x17981b);};}exports[_0x496b('0x2b')]=function(_0x4a3434,_0x427f73){var _0x2a6ae8={},_0x40a338={},_0x101232={'count':0x0,'rows':[]};var _0x30565a=_[_0x496b('0x2c')](db[_0x496b('0x2d')][_0x496b('0x2e')],function(_0xb31c5a){return{'name':_0xb31c5a[_0x496b('0x2f')],'type':_0xb31c5a[_0x496b('0x30')]['key']};});_0x40a338[_0x496b('0x31')]=_[_0x496b('0x2c')](_0x30565a,_0x496b('0x32'));_0x40a338[_0x496b('0x33')]=_[_0x496b('0x34')](_0x4a3434[_0x496b('0x33')]);_0x40a338[_0x496b('0x35')]=_['intersection'](_0x40a338[_0x496b('0x31')],_0x40a338[_0x496b('0x33')]);_0x2a6ae8['attributes']=_[_0x496b('0x36')](_0x40a338[_0x496b('0x31')],qs[_0x496b('0x37')](_0x4a3434[_0x496b('0x33')]['fields']));_0x2a6ae8[_0x496b('0x38')]=_0x2a6ae8[_0x496b('0x38')][_0x496b('0x39')]?_0x2a6ae8['attributes']:_0x40a338[_0x496b('0x31')];if(!_0x4a3434[_0x496b('0x33')]['hasOwnProperty'](_0x496b('0x3a'))){_0x2a6ae8['limit']=qs[_0x496b('0x1e')](_0x4a3434[_0x496b('0x33')]['limit']);_0x2a6ae8[_0x496b('0x1b')]=qs[_0x496b('0x1b')](_0x4a3434[_0x496b('0x33')][_0x496b('0x1b')]);}_0x2a6ae8[_0x496b('0x3b')]=qs[_0x496b('0x3c')](_0x4a3434[_0x496b('0x33')][_0x496b('0x3c')]);_0x2a6ae8[_0x496b('0x3d')]=qs[_0x496b('0x35')](_[_0x496b('0x3e')](_0x4a3434[_0x496b('0x33')],_0x40a338[_0x496b('0x35')]),_0x30565a);if(_0x4a3434[_0x496b('0x33')]['filter']){_0x2a6ae8[_0x496b('0x3d')]=_['merge'](_0x2a6ae8[_0x496b('0x3d')],{'$or':_['map'](_0x30565a,function(_0x2207b9){if(_0x2207b9[_0x496b('0x30')]!==_0x496b('0x3f')){var _0x238aa8={};_0x238aa8[_0x2207b9['name']]={'$like':'%'+_0x4a3434[_0x496b('0x33')]['filter']+'%'};return _0x238aa8;}})});}_0x2a6ae8=_[_0x496b('0x40')]({},_0x2a6ae8,_0x4a3434['options']);var _0x4b7ae3={'where':_0x2a6ae8['where']};return db[_0x496b('0x2d')]['count'](_0x4b7ae3)[_0x496b('0x24')](function(_0x561a59){_0x101232['count']=_0x561a59;if(_0x4a3434[_0x496b('0x33')][_0x496b('0x41')]){_0x2a6ae8['include']=[{'all':!![]}];}return db['FaxQueue'][_0x496b('0x42')](_0x2a6ae8);})['then'](function(_0x4f3f37){_0x101232[_0x496b('0x43')]=_0x4f3f37;return _0x101232;})[_0x496b('0x24')](respondWithFilteredResult(_0x427f73,_0x2a6ae8))[_0x496b('0x44')](handleError(_0x427f73,null));};exports[_0x496b('0x45')]=function(_0x57f01c,_0x2aea62){var _0x171c6d={'raw':!![],'where':{'id':_0x57f01c[_0x496b('0x46')]['id']}},_0x2ff45d={};_0x2ff45d['model']=_['keys'](db[_0x496b('0x2d')][_0x496b('0x2e')]);_0x2ff45d[_0x496b('0x33')]=_[_0x496b('0x34')](_0x57f01c[_0x496b('0x33')]);_0x2ff45d[_0x496b('0x35')]=_[_0x496b('0x36')](_0x2ff45d[_0x496b('0x31')],_0x2ff45d[_0x496b('0x33')]);_0x171c6d[_0x496b('0x38')]=_['intersection'](_0x2ff45d['model'],qs['fields'](_0x57f01c[_0x496b('0x33')][_0x496b('0x37')]));_0x171c6d['attributes']=_0x171c6d['attributes'][_0x496b('0x39')]?_0x171c6d[_0x496b('0x38')]:_0x2ff45d['model'];if(_0x57f01c[_0x496b('0x33')][_0x496b('0x41')]){_0x171c6d['include']=[{'all':!![]}];}_0x171c6d=_['merge']({},_0x171c6d,_0x57f01c[_0x496b('0x47')]);return db[_0x496b('0x2d')][_0x496b('0x48')](_0x171c6d)[_0x496b('0x24')](handleEntityNotFound(_0x2aea62,null))['then'](respondWithResult(_0x2aea62,null))[_0x496b('0x44')](handleError(_0x2aea62,null));};exports[_0x496b('0x49')]=function(_0x72c4f7,_0x41bf7a){return db[_0x496b('0x2d')][_0x496b('0x49')](_0x72c4f7[_0x496b('0x4a')],{})[_0x496b('0x24')](function(_0x19bce6){var _0xb19305=_0x72c4f7[_0x496b('0x4b')][_0x496b('0x25')]({'plain':!![]});if(!_0xb19305)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb19305[_0x496b('0x4c')]===_0x496b('0x4b')){var _0xff9cad=_0x19bce6['get']({'plain':!![]});var _0x15752a='FaxQueues';return db[_0x496b('0x4d')]['find']({'where':{'name':_0x15752a,'userProfileId':_0xb19305[_0x496b('0x4e')]},'raw':!![]})[_0x496b('0x24')](function(_0x58697b){if(_0x58697b&&_0x58697b[_0x496b('0x4f')]===0x0){return db[_0x496b('0x27')]['create']({'name':_0xff9cad[_0x496b('0x32')],'resourceId':_0xff9cad['id'],'type':_0x58697b[_0x496b('0x32')],'sectionId':_0x58697b['id']},{})[_0x496b('0x24')](function(){return _0x19bce6;});}else{return _0x19bce6;}})['catch'](function(_0x39ee08){logger[_0x496b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39ee08);throw _0x39ee08;});}return _0x19bce6;})[_0x496b('0x24')](respondWithResult(_0x41bf7a,0xc9))[_0x496b('0x44')](handleError(_0x41bf7a,null));};exports[_0x496b('0x22')]=function(_0x224512,_0x5ba62d){if(_0x224512[_0x496b('0x4a')]['id']){delete _0x224512[_0x496b('0x4a')]['id'];}return db[_0x496b('0x2d')][_0x496b('0x48')]({'where':{'id':_0x224512[_0x496b('0x46')]['id']}})[_0x496b('0x24')](handleEntityNotFound(_0x5ba62d,null))['then'](saveUpdates(_0x224512[_0x496b('0x4a')],null))['then'](respondWithResult(_0x5ba62d,null))[_0x496b('0x44')](handleError(_0x5ba62d,null));};exports[_0x496b('0x23')]=function(_0x568358,_0x8fb86c){return db[_0x496b('0x2d')][_0x496b('0x48')]({'where':{'id':_0x568358[_0x496b('0x46')]['id']}})[_0x496b('0x24')](handleEntityNotFound(_0x8fb86c,null))[_0x496b('0x24')](removeEntity(_0x8fb86c,null))['catch'](handleError(_0x8fb86c,null));};exports['describe']=function(_0xdcd30c,_0x5ae241){return db[_0x496b('0x2d')]['describe']()[_0x496b('0x24')](respondWithResult(_0x5ae241,null))[_0x496b('0x44')](handleError(_0x5ae241,null));};exports[_0x496b('0x50')]=function(_0x287de3,_0x4cc894,_0xb96448){var _0x7b401b={'raw':!![],'where':{}},_0x57fc24={},_0x26d0d1;return db['FaxQueue'][_0x496b('0x51')]({'where':{'id':_0x287de3['params']['id']}})[_0x496b('0x24')](handleEntityNotFound(_0x4cc894,null))[_0x496b('0x24')](function(_0x5262d0){if(_0x5262d0){_0x26d0d1=_0x5262d0[_0x496b('0x25')]({'plain':!![]});_0x57fc24[_0x496b('0x31')]=_[_0x496b('0x34')](db[_0x496b('0x52')][_0x496b('0x2e')]);_0x57fc24[_0x496b('0x33')]=_[_0x496b('0x34')](_0x287de3[_0x496b('0x33')]);_0x57fc24['filters']=_[_0x496b('0x36')](_0x57fc24[_0x496b('0x31')],_0x57fc24[_0x496b('0x33')]);_0x7b401b['attributes']=_['intersection'](_0x57fc24['model'],qs[_0x496b('0x37')](_0x287de3['query'][_0x496b('0x37')]));_0x7b401b['attributes']=_0x7b401b['attributes'][_0x496b('0x39')]?_0x7b401b[_0x496b('0x38')]:_0x57fc24[_0x496b('0x31')];if(!_0x287de3[_0x496b('0x33')][_0x496b('0x53')]('nolimit')){_0x7b401b['limit']=qs[_0x496b('0x1e')](_0x287de3[_0x496b('0x33')]['limit']);_0x7b401b[_0x496b('0x1b')]=qs[_0x496b('0x1b')](_0x287de3[_0x496b('0x33')][_0x496b('0x1b')]);}_0x7b401b['order']=qs['sort'](_0x287de3[_0x496b('0x33')][_0x496b('0x3c')]);_0x7b401b[_0x496b('0x3d')]=qs[_0x496b('0x35')](_['pick'](_0x287de3[_0x496b('0x33')],_0x57fc24[_0x496b('0x35')]));_0x7b401b[_0x496b('0x3d')]['FaxQueueId']=_0x5262d0['id'];if(_0x287de3['query'][_0x496b('0x54')]){_0x7b401b[_0x496b('0x3d')]=_[_0x496b('0x40')](_0x7b401b[_0x496b('0x3d')],{'$or':_[_0x496b('0x2c')](_0x7b401b['attributes'],function(_0x17d5da){var _0x522b96={};_0x522b96[_0x17d5da]={'$like':'%'+_0x287de3[_0x496b('0x33')][_0x496b('0x54')]+'%'};return _0x522b96;})});}_0x7b401b=_['merge']({},_0x7b401b,_0x287de3[_0x496b('0x47')]);return db[_0x496b('0x52')]['findAll'](_0x7b401b);}})['then'](function(_0x4ee34a){if(_0x4ee34a){return db[_0x496b('0x55')][_0x496b('0x56')]({'where':{'id':_[_0x496b('0x2c')](_0x4ee34a,'UserId'),'role':_0x496b('0x57')},'attributes':['id','name',_0x496b('0x58'),_0x496b('0x59'),'createdAt']});}})[_0x496b('0x24')](function(_0x25a92d){if(_0x25a92d){return{'count':_0x25a92d[_0x496b('0x1d')],'rows':_['map'](_0x25a92d[_0x496b('0x43')],function(_0x4fd432){return{'membername':_0x4fd432['name'],'UserId':_0x4fd432['id'],'queue_name':_0x26d0d1[_0x496b('0x32')],'FaxQueueId':_0x26d0d1['id'],'interface':util['format'](_0x496b('0x5a'),_0x496b('0x5b'),_0x4fd432[_0x496b('0x32')]),'penalty':0x0,'paused':_0x4fd432[_0x496b('0x58')],'createdAt':_0x4fd432['createdAt'],'updatedAt':_0x4fd432[_0x496b('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4cc894,_0x7b401b))[_0x496b('0x44')](handleError(_0x4cc894,null));};exports[_0x496b('0x5c')]=function(_0x2a2b38,_0x4faf03,_0x44bf07){var _0x4f69b1={};var _0x3a0826={};var _0x431161;var _0x1078de;return db[_0x496b('0x2d')][_0x496b('0x51')]({'where':{'id':_0x2a2b38[_0x496b('0x46')]['id']}})[_0x496b('0x24')](handleEntityNotFound(_0x4faf03,null))[_0x496b('0x24')](function(_0x422a7e){if(_0x422a7e){_0x431161=_0x422a7e;_0x3a0826['model']=_[_0x496b('0x34')](db[_0x496b('0x5d')]['rawAttributes']);_0x3a0826['query']=_['keys'](_0x2a2b38[_0x496b('0x33')]);_0x3a0826['filters']=_[_0x496b('0x36')](_0x3a0826[_0x496b('0x31')],_0x3a0826['query']);_0x4f69b1['attributes']=_[_0x496b('0x36')](_0x3a0826[_0x496b('0x31')],qs[_0x496b('0x37')](_0x2a2b38['query']['fields']));_0x4f69b1[_0x496b('0x38')]=_0x4f69b1['attributes'][_0x496b('0x39')]?_0x4f69b1[_0x496b('0x38')]:_0x3a0826['model'];_0x4f69b1[_0x496b('0x3b')]=qs[_0x496b('0x3c')](_0x2a2b38['query'][_0x496b('0x3c')]);_0x4f69b1[_0x496b('0x3d')]=qs[_0x496b('0x35')](_[_0x496b('0x3e')](_0x2a2b38['query'],_0x3a0826['filters']));if(_0x2a2b38[_0x496b('0x33')][_0x496b('0x54')]){_0x4f69b1[_0x496b('0x3d')]=_[_0x496b('0x40')](_0x4f69b1[_0x496b('0x3d')],{'$or':_[_0x496b('0x2c')](_0x4f69b1[_0x496b('0x38')],function(_0x600385){var _0x3950dd={};_0x3950dd[_0x600385]={'$like':'%'+_0x2a2b38[_0x496b('0x33')][_0x496b('0x54')]+'%'};return _0x3950dd;})});}_0x4f69b1=_[_0x496b('0x40')]({},_0x4f69b1,_0x2a2b38[_0x496b('0x47')]);return _0x431161[_0x496b('0x5c')](_0x4f69b1);}})[_0x496b('0x24')](function(_0x34c7e5){if(_0x34c7e5){_0x1078de=_0x34c7e5[_0x496b('0x39')];if(!_0x2a2b38[_0x496b('0x33')][_0x496b('0x53')](_0x496b('0x3a'))){_0x4f69b1[_0x496b('0x1e')]=qs['limit'](_0x2a2b38[_0x496b('0x33')]['limit']);_0x4f69b1['offset']=qs[_0x496b('0x1b')](_0x2a2b38[_0x496b('0x33')][_0x496b('0x1b')]);}return _0x431161[_0x496b('0x5c')](_0x4f69b1);}})[_0x496b('0x24')](function(_0x1eeee3){if(_0x1eeee3){return _0x1eeee3?{'count':_0x1078de,'rows':_0x1eeee3}:null;}})[_0x496b('0x24')](respondWithResult(_0x4faf03,null))['catch'](handleError(_0x4faf03,null));};exports[_0x496b('0x5e')]=function(_0x529e63,_0x14f3bb,_0x1aa5cb){var _0x3f8498=_0x529e63[_0x496b('0x4a')]['ids'];return db[_0x496b('0x5d')][_0x496b('0x42')]({'where':{'id':_0x3f8498},'attributes':['id'],'include':[{'model':db[_0x496b('0x55')],'as':_0x496b('0x5f'),'attributes':['id',_0x496b('0x32'),_0x496b('0x60'),'voicePause',_0x496b('0x61')],'raw':!![]}]})[_0x496b('0x24')](function(_0x117858){if(_0x117858){var _0x1ca157=_['flatMap'](_0x117858,function(_0x4ac585){var _0x1245eb=_0x4ac585[_0x496b('0x25')]({'plain':!![]});return _0x1245eb[_0x496b('0x5f')];});return db[_0x496b('0x2d')][_0x496b('0x48')]({'where':{'id':_0x529e63[_0x496b('0x46')]['id']}})[_0x496b('0x24')](function(_0x16b5f8){return db[_0x496b('0x62')][_0x496b('0x63')](function(_0x2dda34){return _0x16b5f8['addTeams'](_0x3f8498,{'transaction':_0x2dda34})[_0x496b('0x24')](function(){return BPromise[_0x496b('0x64')](_0x1ca157,function(_0x303d9e){return db[_0x496b('0x52')][_0x496b('0x65')]({'where':{'UserId':_0x303d9e['id'],'FaxQueueId':_0x529e63[_0x496b('0x46')]['id']},'transaction':_0x2dda34});});})[_0x496b('0x24')](function(){_0x1ca157['forEach'](function(_0x1c3508){socket[_0x496b('0x66')](_0x496b('0x67'),{'UserId':_0x1c3508['id'],'FaxQueueId':_0x16b5f8['id']});});});});});}})['then'](respondWithStatusCode(_0x14f3bb,null))['catch'](handleError(_0x14f3bb,null));};exports['removeTeams']=function(_0x1bc4c9,_0x450d0b,_0x303389){return db['Team'][_0x496b('0x42')]({'where':{'id':_0x1bc4c9['query'][_0x496b('0x68')]},'attributes':['id'],'include':[{'model':db[_0x496b('0x55')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x496b('0x24')](handleEntityNotFound(_0x450d0b,null))['then'](function(_0x147cea){var _0x3e8c79=_[_0x496b('0x2c')](_0x147cea,'id');var _0xd52d10=[];var _0x463ff6=[];var _0x5eff6e=squel[_0x496b('0x69')]();_0x5eff6e['field'](_0x496b('0x6a'))[_0x496b('0x6b')]('team_has_fax_queues','tq')[_0x496b('0x6c')](_0x496b('0x6d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x496b('0x3d')](_0x496b('0x6e'),_0x1bc4c9[_0x496b('0x46')]['id']);for(var _0x2913e2=0x0;_0x2913e2<_0x147cea['length'];_0x2913e2+=0x1){let _0x5a9fc2=_0x147cea[_0x2913e2];for(var _0x56e8af=0x0;_0x56e8af<_0x5a9fc2[_0x496b('0x5f')][_0x496b('0x39')];_0x56e8af+=0x1){let _0x5c67ec=_0x5a9fc2[_0x496b('0x5f')][_0x56e8af];var _0x338929=_0x5eff6e['clone']();_0x338929['where']('ut.UserId\x20=\x20?',_0x5c67ec['id']);_0x463ff6[_0x496b('0x6f')](db[_0x496b('0x62')][_0x496b('0x33')](_0x338929[_0x496b('0x70')](),{'type':db[_0x496b('0x62')][_0x496b('0x71')][_0x496b('0x72')]})['then'](function(_0xb4d6e7){if(_0xb4d6e7[_0x496b('0x39')]===0x1){return _0x5c67ec['id'];}else{var _0x5f14c1=_['every'](_[_0x496b('0x2c')](_0xb4d6e7,_0x496b('0x73')),function(_0x5a8fb4){return _[_0x496b('0x74')](_0x3e8c79,_0x5a8fb4);});if(_0x5f14c1){return _0x5c67ec['id'];}}}));}}return BPromise[_0x496b('0x75')](_0x463ff6)[_0x496b('0x24')](function(_0x4bbc6f){_0xd52d10=_(_0xd52d10)[_0x496b('0x76')](_0x4bbc6f)[_0x496b('0x77')]()[_0x496b('0x78')]();return db[_0x496b('0x2d')]['find']({'where':{'id':_0x1bc4c9['params']['id']}})[_0x496b('0x24')](function(_0x271f36){return db[_0x496b('0x62')][_0x496b('0x63')](function(_0x1a6c60){return _0x271f36['removeTeams'](_0x1bc4c9[_0x496b('0x33')][_0x496b('0x68')],{'transaction':_0x1a6c60})['then'](function(){if(!_[_0x496b('0x79')](_0xd52d10)){return _0x271f36[_0x496b('0x7a')](_0xd52d10,{'transaction':_0x1a6c60});}})['then'](function(){_0xd52d10['forEach'](function(_0xbbbebc){socket['emit']('userFaxQueue:remove',{'UserId':_0xbbbebc,'FaxQueueId':_0x271f36['id']});});});});});});})[_0x496b('0x24')](respondWithStatusCode(_0x450d0b,null))[_0x496b('0x44')](handleError(_0x450d0b,null));};exports[_0x496b('0x7b')]=function(_0x36a55e,_0x527dfc,_0xa21b60){return db[_0x496b('0x2d')][_0x496b('0x48')]({'where':{'id':_0x36a55e['params']['id']}})['then'](handleEntityNotFound(_0x527dfc,null))[_0x496b('0x24')](function(_0x1480ca){if(_0x1480ca){return _0x1480ca[_0x496b('0x7b')](_0x36a55e[_0x496b('0x4a')][_0x496b('0x68')],_[_0x496b('0x7c')](_0x36a55e[_0x496b('0x4a')],[_0x496b('0x68'),'id'])||{})[_0x496b('0x7d')](function(_0xe40b12){for(var _0x2111dc=0x0;_0x2111dc<_0x36a55e[_0x496b('0x4a')][_0x496b('0x68')][_0x496b('0x39')];_0x2111dc+=0x1){socket['emit'](_0x496b('0x67'),{'UserId':Number(_0x36a55e['body'][_0x496b('0x68')][_0x2111dc]),'FaxQueueId':Number(_0x36a55e[_0x496b('0x46')]['id'])});}return _0xe40b12;});}})[_0x496b('0x24')](respondWithResult(_0x527dfc,null))[_0x496b('0x44')](handleError(_0x527dfc,null));};exports['removeAgents']=function(_0x15f557,_0xdf8186,_0x3862ad){return db[_0x496b('0x2d')][_0x496b('0x48')]({'where':{'id':_0x15f557[_0x496b('0x46')]['id']}})[_0x496b('0x24')](handleEntityNotFound(_0xdf8186,null))[_0x496b('0x24')](function(_0x3ed89b){if(_0x3ed89b){return _0x3ed89b[_0x496b('0x7a')](_0x15f557[_0x496b('0x33')][_0x496b('0x68')])['then'](function(){if(_[_0x496b('0x7e')](_0x15f557[_0x496b('0x33')][_0x496b('0x68')])){for(var _0x49ada8=0x0;_0x49ada8<_0x15f557[_0x496b('0x33')]['ids'][_0x496b('0x39')];_0x49ada8+=0x1){socket[_0x496b('0x66')](_0x496b('0x7f'),{'UserId':Number(_0x15f557[_0x496b('0x33')][_0x496b('0x68')][_0x49ada8]),'FaxQueueId':Number(_0x15f557[_0x496b('0x46')]['id'])});}}else{socket[_0x496b('0x66')](_0x496b('0x7f'),{'UserId':Number(_0x15f557[_0x496b('0x33')]['ids']),'FaxQueueId':Number(_0x15f557[_0x496b('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0xdf8186,null))[_0x496b('0x44')](handleError(_0xdf8186,null));};exports[_0x496b('0x80')]=function(_0x343f73,_0x3e21dd,_0x1bf1f4){var _0x14bc56={};var _0x129048={};var _0x7a5f85;var _0x5d0cb9;return db[_0x496b('0x2d')][_0x496b('0x51')]({'where':{'id':_0x343f73['params']['id']}})['then'](handleEntityNotFound(_0x3e21dd,null))[_0x496b('0x24')](function(_0x27d5b9){if(_0x27d5b9){_0x7a5f85=_0x27d5b9;_0x129048[_0x496b('0x31')]=_[_0x496b('0x34')](db['User'][_0x496b('0x2e')]);_0x129048[_0x496b('0x33')]=_[_0x496b('0x34')](_0x343f73[_0x496b('0x33')]);_0x129048['filters']=_['intersection'](_0x129048['model'],_0x129048[_0x496b('0x33')]);_0x14bc56[_0x496b('0x38')]=_[_0x496b('0x36')](_0x129048[_0x496b('0x31')],qs[_0x496b('0x37')](_0x343f73[_0x496b('0x33')][_0x496b('0x37')]));_0x14bc56['attributes']=_0x14bc56[_0x496b('0x38')][_0x496b('0x39')]?_0x14bc56['attributes']:_0x129048[_0x496b('0x31')];_0x14bc56[_0x496b('0x3b')]=qs[_0x496b('0x3c')](_0x343f73['query'][_0x496b('0x3c')]);_0x14bc56[_0x496b('0x3d')]=qs[_0x496b('0x35')](_['pick'](_0x343f73[_0x496b('0x33')],_0x129048[_0x496b('0x35')]));if(_0x343f73['query'][_0x496b('0x54')]){_0x14bc56[_0x496b('0x3d')]=_['merge'](_0x14bc56[_0x496b('0x3d')],{'$or':_[_0x496b('0x2c')](_0x14bc56[_0x496b('0x38')],function(_0x310e23){var _0x23dd19={};_0x23dd19[_0x310e23]={'$like':'%'+_0x343f73['query'][_0x496b('0x54')]+'%'};return _0x23dd19;})});}_0x14bc56=_[_0x496b('0x40')]({},_0x14bc56,_0x343f73[_0x496b('0x47')]);return _0x7a5f85['getAgents'](_0x14bc56);}})[_0x496b('0x24')](function(_0x478108){if(_0x478108){_0x5d0cb9=_0x478108[_0x496b('0x39')];if(!_0x343f73[_0x496b('0x33')][_0x496b('0x53')](_0x496b('0x3a'))){_0x14bc56['limit']=qs[_0x496b('0x1e')](_0x343f73['query']['limit']);_0x14bc56['offset']=qs['offset'](_0x343f73[_0x496b('0x33')][_0x496b('0x1b')]);}return _0x7a5f85[_0x496b('0x80')](_0x14bc56);}})['then'](function(_0x3d8db4){if(_0x3d8db4){return _0x3d8db4?{'count':_0x5d0cb9,'rows':_0x3d8db4}:null;}})['then'](respondWithResult(_0x3e21dd,null))[_0x496b('0x44')](handleError(_0x3e21dd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 946af07..3555209 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 _0xb8d6=['exports','events','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2bd0be,_0x278c23){var _0x3ae11e=function(_0x511b24){while(--_0x511b24){_0x2bd0be['push'](_0x2bd0be['shift']());}};_0x3ae11e(++_0x278c23);}(_0xb8d6,0xdd));var _0x6b8d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb8d6[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0x6b8d('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x6b8d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6b8d('0x2')](0x0);var events={'afterCreate':_0x6b8d('0x3'),'afterUpdate':_0x6b8d('0x4'),'afterDestroy':_0x6b8d('0x5')};function emitEvent(_0xc111db){return function(_0x4c43e5,_0x5b0223,_0x359dec){FaxQueueEvents[_0x6b8d('0x6')](_0xc111db+':'+_0x4c43e5['id'],_0x4c43e5);FaxQueueEvents[_0x6b8d('0x6')](_0xc111db,_0x4c43e5);_0x359dec(null);};}for(var e in events){if(events[_0x6b8d('0x7')](e)){var event=events[e];FaxQueue[_0x6b8d('0x8')](e,emitEvent(event));}}module[_0x6b8d('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xc1be=['exports','../../mysqldb','FaxQueue','save','update','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc1be,0x1a5));var _0xec1b=function(_0x232725,_0x2f38ad){_0x232725=_0x232725-0x0;var _0x5a8576=_0xc1be[_0x232725];return _0x5a8576;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xec1b('0x0'))['db'][_0xec1b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec1b('0x2'),'afterUpdate':_0xec1b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ecaf0){return function(_0x4326bd,_0x5cbdae,_0x65edec){FaxQueueEvents[_0xec1b('0x4')](_0x1ecaf0+':'+_0x4326bd['id'],_0x4326bd);FaxQueueEvents[_0xec1b('0x4')](_0x1ecaf0,_0x4326bd);_0x65edec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xec1b('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 86be611..7769e3f 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 _0x9256=['lodash','api','bluebird','request-promise','../../config/environment','define','FaxQueue','fax_queues'];(function(_0x1ccb99,_0x1a427a){var _0x5966fc=function(_0x289179){while(--_0x289179){_0x1ccb99['push'](_0x1ccb99['shift']());}};_0x5966fc(++_0x1a427a);}(_0x9256,0xa8));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6925('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6925('0x1'));var moment=require('moment');var BPromise=require(_0x6925('0x2'));var rp=require(_0x6925('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6925('0x4'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x2a4d20,_0x4e8ccd){return _0x2a4d20[_0x6925('0x5')](_0x6925('0x6'),attributes,{'tableName':_0x6925('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54b3=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util'];(function(_0x1fbb77,_0x1363c1){var _0x20ca6e=function(_0xd53ef5){while(--_0xd53ef5){_0x1fbb77['push'](_0x1fbb77['shift']());}};_0x20ca6e(++_0x1363c1);}(_0x54b3,0x8d));var _0x354b=function(_0x18d1b7,_0x475bef){_0x18d1b7=_0x18d1b7-0x0;var _0x15618c=_0x54b3[_0x18d1b7];return _0x15618c;};'use strict';var _=require(_0x354b('0x0'));var util=require(_0x354b('0x1'));var logger=require(_0x354b('0x2'))(_0x354b('0x3'));var moment=require('moment');var BPromise=require(_0x354b('0x4'));var rp=require(_0x354b('0x5'));var fs=require('fs');var path=require(_0x354b('0x6'));var rimraf=require(_0x354b('0x7'));var config=require(_0x354b('0x8'));var attributes=require(_0x354b('0x9'));module[_0x354b('0xa')]=function(_0x3d7f87,_0x5319c5){return _0x3d7f87['define'](_0x354b('0xb'),attributes,{'tableName':_0x354b('0xc'),'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 cb2dc70..6abf47a 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 _0xb9a7=['FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','map','include','model','stringify','ShowFaxQueue','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb9a7,0x122));var _0x7b9a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb9a7[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x7b9a('0x0'));var util=require(_0x7b9a('0x1'));var moment=require(_0x7b9a('0x2'));var BPromise=require(_0x7b9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x4'));var db=require(_0x7b9a('0x5'))['db'];var utils=require(_0x7b9a('0x6'));var logger=require(_0x7b9a('0x7'))('rpc');var config=require(_0x7b9a('0x8'));var jayson=require(_0x7b9a('0x9'));var client=jayson[_0x7b9a('0xa')][_0x7b9a('0xb')]({'port':0x232a});config[_0x7b9a('0xc')]=_[_0x7b9a('0xd')](config['redis'],{'host':_0x7b9a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b9a('0xc')]));require(_0x7b9a('0xf'))['register'](socket);function respondWithRpcPromise(_0x29188c,_0x927de2,_0x21bd64){return new BPromise(function(_0x1f6b21,_0x48519a){return client['request'](_0x29188c,_0x21bd64)['then'](function(_0x288434){logger[_0x7b9a('0x10')]('FaxQueue,\x20%s,\x20%s',_0x927de2,_0x7b9a('0x11'));logger[_0x7b9a('0x12')](_0x7b9a('0x13'),_0x927de2,_0x7b9a('0x11'),JSON['stringify'](_0x288434));if(_0x288434[_0x7b9a('0x14')]){if(_0x288434[_0x7b9a('0x14')][_0x7b9a('0x15')]===0x1f4){logger[_0x7b9a('0x14')](_0x7b9a('0x16'),_0x927de2,_0x288434[_0x7b9a('0x14')][_0x7b9a('0x17')]);return _0x48519a(_0x288434['error'][_0x7b9a('0x17')]);}logger['error'](_0x7b9a('0x16'),_0x927de2,_0x288434['error'][_0x7b9a('0x17')]);return _0x1f6b21(_0x288434[_0x7b9a('0x14')][_0x7b9a('0x17')]);}else{logger[_0x7b9a('0x10')](_0x7b9a('0x16'),_0x927de2,_0x7b9a('0x11'));_0x1f6b21(_0x288434[_0x7b9a('0x18')]['message']);}})[_0x7b9a('0x19')](function(_0x2b5120){logger[_0x7b9a('0x14')](_0x7b9a('0x16'),_0x927de2,_0x2b5120);_0x48519a(_0x2b5120);});});}exports[_0x7b9a('0x1a')]=function(_0x569236){var _0x53906a=this;return new Promise(function(_0x24d003,_0x13ff18){return db[_0x7b9a('0x1b')][_0x7b9a('0x1c')]({'raw':_0x569236['options']?_0x569236[_0x7b9a('0x1d')][_0x7b9a('0x1e')]===undefined?!![]:![]:!![],'where':_0x569236['options']?_0x569236['options']['where']||null:null,'attributes':_0x569236['options']?_0x569236['options'][_0x7b9a('0x1f')]||null:null,'limit':_0x569236[_0x7b9a('0x1d')]?_0x569236[_0x7b9a('0x1d')]['limit']||null:null,'include':_0x569236[_0x7b9a('0x1d')]?_0x569236['options']['include']?_[_0x7b9a('0x20')](_0x569236[_0x7b9a('0x1d')][_0x7b9a('0x21')],function(_0x5657d3){return{'model':db[_0x5657d3[_0x7b9a('0x22')]],'as':_0x5657d3['as'],'attributes':_0x5657d3['attributes'],'include':_0x5657d3[_0x7b9a('0x21')]?_[_0x7b9a('0x20')](_0x5657d3[_0x7b9a('0x21')],function(_0x29ab6e){return{'model':db[_0x29ab6e['model']],'as':_0x29ab6e['as'],'attributes':_0x29ab6e[_0x7b9a('0x1f')],'include':_0x29ab6e['include']?_[_0x7b9a('0x20')](_0x29ab6e[_0x7b9a('0x21')],function(_0x280d07){return{'model':db[_0x280d07[_0x7b9a('0x22')]],'as':_0x280d07['as'],'attributes':_0x280d07[_0x7b9a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f17a5){logger['info']('GetFaxQueue',_0x569236);logger[_0x7b9a('0x12')]('GetFaxQueue',_0x569236,JSON[_0x7b9a('0x23')](_0x2f17a5));_0x24d003(_0x2f17a5);})['catch'](function(_0x19c453){logger[_0x7b9a('0x14')](_0x7b9a('0x1a'),_0x19c453[_0x7b9a('0x17')],_0x569236);_0x13ff18(_0x53906a['error'](0x1f4,_0x19c453[_0x7b9a('0x17')]));});});};exports[_0x7b9a('0x24')]=function(_0x5ed581){var _0x20446a=this;return new Promise(function(_0x214d99,_0x2e8e0f){return db[_0x7b9a('0x1b')][_0x7b9a('0x25')]({'raw':_0x5ed581[_0x7b9a('0x1d')]?_0x5ed581[_0x7b9a('0x1d')][_0x7b9a('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ed581[_0x7b9a('0x1d')]?_0x5ed581[_0x7b9a('0x1d')]['where']||null:null,'attributes':_0x5ed581[_0x7b9a('0x1d')]?_0x5ed581[_0x7b9a('0x1d')][_0x7b9a('0x1f')]||null:null,'include':_0x5ed581[_0x7b9a('0x1d')]?_0x5ed581[_0x7b9a('0x1d')][_0x7b9a('0x21')]?_[_0x7b9a('0x20')](_0x5ed581['options']['include'],function(_0x558db9){return{'model':db[_0x558db9[_0x7b9a('0x22')]],'as':_0x558db9['as'],'attributes':_0x558db9['attributes'],'include':_0x558db9[_0x7b9a('0x21')]?_[_0x7b9a('0x20')](_0x558db9[_0x7b9a('0x21')],function(_0x39f7e2){return{'model':db[_0x39f7e2[_0x7b9a('0x22')]],'as':_0x39f7e2['as'],'attributes':_0x39f7e2[_0x7b9a('0x1f')],'include':_0x39f7e2[_0x7b9a('0x21')]?_['map'](_0x39f7e2[_0x7b9a('0x21')],function(_0x3e0284){return{'model':db[_0x3e0284[_0x7b9a('0x22')]],'as':_0x3e0284['as'],'attributes':_0x3e0284[_0x7b9a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7b9a('0x26')](function(_0x370167){logger[_0x7b9a('0x10')]('ShowFaxQueue',_0x5ed581);logger[_0x7b9a('0x12')](_0x7b9a('0x24'),_0x5ed581,JSON[_0x7b9a('0x23')](_0x370167));_0x214d99(_0x370167);})[_0x7b9a('0x19')](function(_0x24e5bd){logger[_0x7b9a('0x14')](_0x7b9a('0x24'),_0x24e5bd[_0x7b9a('0x17')],_0x5ed581);_0x2e8e0f(_0x20446a['error'](0x1f4,_0x24e5bd[_0x7b9a('0x17')]));});});}; \ No newline at end of file +var _0x17e7=['attributes','limit','map','model','include','stringify','catch','ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x3af65f,_0x5e6544){var _0x137d27=function(_0x1364e0){while(--_0x1364e0){_0x3af65f['push'](_0x3af65f['shift']());}};_0x137d27(++_0x5e6544);}(_0x17e7,0x139));var _0x717e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x17e7[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x717e('0x0'));var moment=require(_0x717e('0x1'));var BPromise=require(_0x717e('0x2'));var rs=require(_0x717e('0x3'));var fs=require('fs');var Redis=require(_0x717e('0x4'));var db=require(_0x717e('0x5'))['db'];var utils=require(_0x717e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x717e('0x7'));var jayson=require(_0x717e('0x8'));var client=jayson[_0x717e('0x9')][_0x717e('0xa')]({'port':0x232a});config[_0x717e('0xb')]=_['defaults'](config[_0x717e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x717e('0xc'))(new Redis(config['redis']));require(_0x717e('0xd'))['register'](socket);function respondWithRpcPromise(_0x2f671e,_0x2c2c36,_0x27997d){return new BPromise(function(_0x459e6c,_0x4b9a0a){return client['request'](_0x2f671e,_0x27997d)[_0x717e('0xe')](function(_0x1cddbd){logger['info'](_0x717e('0xf'),_0x2c2c36,_0x717e('0x10'));logger[_0x717e('0x11')](_0x717e('0x12'),_0x2c2c36,_0x717e('0x10'),JSON['stringify'](_0x1cddbd));if(_0x1cddbd[_0x717e('0x13')]){if(_0x1cddbd[_0x717e('0x13')][_0x717e('0x14')]===0x1f4){logger[_0x717e('0x13')](_0x717e('0xf'),_0x2c2c36,_0x1cddbd[_0x717e('0x13')][_0x717e('0x15')]);return _0x4b9a0a(_0x1cddbd[_0x717e('0x13')][_0x717e('0x15')]);}logger[_0x717e('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2c2c36,_0x1cddbd[_0x717e('0x13')][_0x717e('0x15')]);return _0x459e6c(_0x1cddbd[_0x717e('0x13')][_0x717e('0x15')]);}else{logger[_0x717e('0x16')](_0x717e('0xf'),_0x2c2c36,_0x717e('0x10'));_0x459e6c(_0x1cddbd['result'][_0x717e('0x15')]);}})['catch'](function(_0x4e9ad8){logger[_0x717e('0x13')](_0x717e('0xf'),_0x2c2c36,_0x4e9ad8);_0x4b9a0a(_0x4e9ad8);});});}exports[_0x717e('0x17')]=function(_0x261e5a){var _0x5c8a10=this;return new Promise(function(_0x3fed88,_0x33d210){return db[_0x717e('0x18')][_0x717e('0x19')]({'raw':_0x261e5a[_0x717e('0x1a')]?_0x261e5a[_0x717e('0x1a')][_0x717e('0x1b')]===undefined?!![]:![]:!![],'where':_0x261e5a[_0x717e('0x1a')]?_0x261e5a[_0x717e('0x1a')][_0x717e('0x1c')]||null:null,'attributes':_0x261e5a[_0x717e('0x1a')]?_0x261e5a[_0x717e('0x1a')][_0x717e('0x1d')]||null:null,'limit':_0x261e5a['options']?_0x261e5a[_0x717e('0x1a')][_0x717e('0x1e')]||null:null,'include':_0x261e5a['options']?_0x261e5a[_0x717e('0x1a')]['include']?_[_0x717e('0x1f')](_0x261e5a[_0x717e('0x1a')]['include'],function(_0x5bba08){return{'model':db[_0x5bba08[_0x717e('0x20')]],'as':_0x5bba08['as'],'attributes':_0x5bba08[_0x717e('0x1d')],'include':_0x5bba08[_0x717e('0x21')]?_[_0x717e('0x1f')](_0x5bba08[_0x717e('0x21')],function(_0x31dd86){return{'model':db[_0x31dd86[_0x717e('0x20')]],'as':_0x31dd86['as'],'attributes':_0x31dd86['attributes'],'include':_0x31dd86[_0x717e('0x21')]?_[_0x717e('0x1f')](_0x31dd86['include'],function(_0x9fcbae){return{'model':db[_0x9fcbae[_0x717e('0x20')]],'as':_0x9fcbae['as'],'attributes':_0x9fcbae[_0x717e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x717e('0xe')](function(_0x557282){logger[_0x717e('0x16')](_0x717e('0x17'),_0x261e5a);logger[_0x717e('0x11')]('GetFaxQueue',_0x261e5a,JSON[_0x717e('0x22')](_0x557282));_0x3fed88(_0x557282);})[_0x717e('0x23')](function(_0x138ed7){logger[_0x717e('0x13')]('GetFaxQueue',_0x138ed7['message'],_0x261e5a);_0x33d210(_0x5c8a10['error'](0x1f4,_0x138ed7['message']));});});};exports[_0x717e('0x24')]=function(_0x49787e){var _0x3e7215=this;return new Promise(function(_0x4d3b86,_0x2630c7){return db[_0x717e('0x18')][_0x717e('0x25')]({'raw':_0x49787e[_0x717e('0x1a')]?_0x49787e[_0x717e('0x1a')][_0x717e('0x1b')]===undefined?!![]:![]:!![],'where':_0x49787e[_0x717e('0x1a')]?_0x49787e[_0x717e('0x1a')]['where']||null:null,'attributes':_0x49787e[_0x717e('0x1a')]?_0x49787e['options']['attributes']||null:null,'include':_0x49787e[_0x717e('0x1a')]?_0x49787e[_0x717e('0x1a')][_0x717e('0x21')]?_[_0x717e('0x1f')](_0x49787e[_0x717e('0x1a')][_0x717e('0x21')],function(_0x353cfc){return{'model':db[_0x353cfc[_0x717e('0x20')]],'as':_0x353cfc['as'],'attributes':_0x353cfc[_0x717e('0x1d')],'include':_0x353cfc[_0x717e('0x21')]?_[_0x717e('0x1f')](_0x353cfc['include'],function(_0x5a95bf){return{'model':db[_0x5a95bf['model']],'as':_0x5a95bf['as'],'attributes':_0x5a95bf['attributes'],'include':_0x5a95bf[_0x717e('0x21')]?_[_0x717e('0x1f')](_0x5a95bf[_0x717e('0x21')],function(_0x28ea3e){return{'model':db[_0x28ea3e[_0x717e('0x20')]],'as':_0x28ea3e['as'],'attributes':_0x28ea3e[_0x717e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c6fe5){logger['info'](_0x717e('0x24'),_0x49787e);logger[_0x717e('0x11')](_0x717e('0x24'),_0x49787e,JSON[_0x717e('0x22')](_0x1c6fe5));_0x4d3b86(_0x1c6fe5);})['catch'](function(_0xbb6a6b){logger['error'](_0x717e('0x24'),_0xbb6a6b[_0x717e('0x15')],_0x49787e);_0x2630c7(_0x3e7215[_0x717e('0x13')](0x1f4,_0xbb6a6b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b64c75e..22c5439 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 _0x9b69=['removeListener','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x9b69,0x183));var _0x99b6=function(_0x1813ab,_0x4647d2){_0x1813ab=_0x1813ab-0x0;var _0x9940c0=_0x9b69[_0x1813ab];return _0x9940c0;};'use strict';var FaxQueueEvents=require(_0x99b6('0x0'));var events=[_0x99b6('0x1'),_0x99b6('0x2'),_0x99b6('0x3')];function createListener(_0x99eb50,_0x14fabc){return function(_0x438331){_0x14fabc[_0x99b6('0x4')](_0x99eb50,_0x438331);};}function removeListener(_0x55ee36,_0x3fb51f){return function(){FaxQueueEvents[_0x99b6('0x5')](_0x55ee36,_0x3fb51f);};}exports['register']=function(_0x9705fa){for(var _0x26659f=0x0,_0x286986=events['length'];_0x26659f<_0x286986;_0x26659f++){var _0x460c5f=events[_0x26659f];var _0xfdc87f=createListener(_0x99b6('0x6')+_0x460c5f,_0x9705fa);FaxQueueEvents['on'](_0x460c5f,_0xfdc87f);}}; \ No newline at end of file +var _0x220a=['removeListener','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x2b55fa,_0x4db49a){var _0xd0ceff=function(_0x5c4f14){while(--_0x5c4f14){_0x2b55fa['push'](_0x2b55fa['shift']());}};_0xd0ceff(++_0x4db49a);}(_0x220a,0x13b));var _0xa220=function(_0x518532,_0x58c54e){_0x518532=_0x518532-0x0;var _0x5da599=_0x220a[_0x518532];return _0x5da599;};'use strict';var FaxQueueEvents=require(_0xa220('0x0'));var events=[_0xa220('0x1'),_0xa220('0x2'),_0xa220('0x3')];function createListener(_0x412853,_0x4d2f0c){return function(_0x1a75d3){_0x4d2f0c[_0xa220('0x4')](_0x412853,_0x1a75d3);};}function removeListener(_0x2a14fd,_0x113840){return function(){FaxQueueEvents[_0xa220('0x5')](_0x2a14fd,_0x113840);};}exports['register']=function(_0xda64c2){for(var _0x318442=0x0,_0x367b76=events[_0xa220('0x6')];_0x318442<_0x367b76;_0x318442++){var _0x48bd58=events[_0x318442];var _0x43ab45=createListener(_0xa220('0x7')+_0x48bd58,_0xda64c2);FaxQueueEvents['on'](_0x48bd58,_0x43ab45);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 05e9c81..4e9709c 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 _0x9f0e=['destroy','/:id/teams','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','post','create','/:id/users','put','delete'];(function(_0x59af50,_0x4d777b){var _0x3a5ce7=function(_0x4cca15){while(--_0x4cca15){_0x59af50['push'](_0x59af50['shift']());}};_0x3a5ce7(++_0x4d777b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x431c98,_0x4d8039){_0x431c98=_0x431c98-0x0;var _0x1081a2=_0x9f0e[_0x431c98];return _0x1081a2;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/teams',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x9')]('/:id/users',auth[_0xe9f0('0xb')](),controller['getAgents']);router[_0xe9f0('0x11')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x12')]);router[_0xe9f0('0x11')]('/:id/teams',auth[_0xe9f0('0xb')](),controller['addTeams']);router[_0xe9f0('0x11')](_0xe9f0('0x13'),auth[_0xe9f0('0xb')](),controller['addAgents']);router[_0xe9f0('0x14')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller['update']);router[_0xe9f0('0x15')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x16')]);router[_0xe9f0('0x15')](_0xe9f0('0x17'),auth[_0xe9f0('0xb')](),controller['removeTeams']);router[_0xe9f0('0x15')](_0xe9f0('0x13'),auth[_0xe9f0('0xb')](),controller['removeAgents']);module[_0xe9f0('0x18')]=router; \ No newline at end of file +var _0x7409=['get','index','/describe','describe','/:id','show','/:id/members','isAuthenticated','getTeams','/:id/teams','post','addAgents','put','update','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x10dc20,_0x53b0ca){var _0x45c996=function(_0x5edcac){while(--_0x5edcac){_0x10dc20['push'](_0x10dc20['shift']());}};_0x45c996(++_0x53b0ca);}(_0x7409,0x6e));var _0x9740=function(_0x2c0931,_0x503573){_0x2c0931=_0x2c0931-0x0;var _0x3d781f=_0x7409[_0x2c0931];return _0x3d781f;};'use strict';var multer=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var path=require('path');var timeout=require(_0x9740('0x2'));var express=require(_0x9740('0x3'));var router=express[_0x9740('0x4')]();var fs_extra=require(_0x9740('0x5'));var auth=require(_0x9740('0x6'));var interaction=require(_0x9740('0x7'));var config=require(_0x9740('0x8'));var controller=require(_0x9740('0x9'));router[_0x9740('0xa')]('/',auth['isAuthenticated'](),controller[_0x9740('0xb')]);router[_0x9740('0xa')](_0x9740('0xc'),auth['isAuthenticated'](),controller[_0x9740('0xd')]);router[_0x9740('0xa')](_0x9740('0xe'),auth['isAuthenticated'](),controller[_0x9740('0xf')]);router['get'](_0x9740('0x10'),auth[_0x9740('0x11')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x9740('0x11')](),controller[_0x9740('0x12')]);router[_0x9740('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9740('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9740('0x14')]('/:id/users',auth[_0x9740('0x11')](),controller[_0x9740('0x15')]);router[_0x9740('0x16')](_0x9740('0xe'),auth['isAuthenticated'](),controller[_0x9740('0x17')]);router['delete'](_0x9740('0xe'),auth[_0x9740('0x11')](),controller[_0x9740('0x18')]);router[_0x9740('0x19')](_0x9740('0x13'),auth[_0x9740('0x11')](),controller[_0x9740('0x1a')]);router[_0x9740('0x19')](_0x9740('0x1b'),auth['isAuthenticated'](),controller[_0x9740('0x1c')]);module[_0x9740('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 6a09acb..8b72e04 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 _0x7441=['DATE','moment','sequelize','STRING'];(function(_0x268b02,_0x43efb0){var _0x403154=function(_0x40d310){while(--_0x40d310){_0x268b02['push'](_0x268b02['shift']());}};_0x403154(++_0x43efb0);}(_0x7441,0x191));var _0x1744=function(_0x57aa4c,_0x11656f){_0x57aa4c=_0x57aa4c-0x0;var _0x1f793e=_0x7441[_0x57aa4c];return _0x1f793e;};'use strict';var moment=require(_0x1744('0x0'));var Sequelize=require(_0x1744('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1744('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1744('0x3')]},'exitAt':{'type':Sequelize[_0x1744('0x3')]},'reason':{'type':Sequelize[_0x1744('0x2')]}}; \ No newline at end of file +var _0x5e1d=['DATE','moment','sequelize','STRING'];(function(_0xbab166,_0x5a3803){var _0x3f4226=function(_0x58b7c0){while(--_0x58b7c0){_0xbab166['push'](_0xbab166['shift']());}};_0x3f4226(++_0x5a3803);}(_0x5e1d,0x1e5));var _0xd5e1=function(_0x545312,_0x563053){_0x545312=_0x545312-0x0;var _0x52bc56=_0x5e1d[_0x545312];return _0x52bc56;};'use strict';var moment=require(_0xd5e1('0x0'));var Sequelize=require(_0xd5e1('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd5e1('0x2')]},'joinAt':{'type':Sequelize[_0xd5e1('0x3')]},'leaveAt':{'type':Sequelize[_0xd5e1('0x3')]},'acceptAt':{'type':Sequelize[_0xd5e1('0x3')]},'exitAt':{'type':Sequelize[_0xd5e1('0x3')]},'reason':{'type':Sequelize[_0xd5e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 09da570..5b0d1b3 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 _0x780f=['fieldName','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','FaxQueueReport','rawAttributes'];(function(_0x45dbd6,_0x1ce09a){var _0x512bf7=function(_0x5844ea){while(--_0x5844ea){_0x45dbd6['push'](_0x45dbd6['shift']());}};_0x512bf7(++_0x1ce09a);}(_0x780f,0x6c));var _0xf780=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x780f[_0xc82d1a];return _0x32fad2;};'use strict';var emlformat=require(_0xf780('0x0'));var rimraf=require(_0xf780('0x1'));var zipdir=require(_0xf780('0x2'));var jsonpatch=require(_0xf780('0x3'));var rp=require(_0xf780('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf780('0x5'));var util=require(_0xf780('0x6'));var path=require(_0xf780('0x7'));var sox=require(_0xf780('0x8'));var csv=require('to-csv');var ejs=require(_0xf780('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf780('0xa'));var squel=require(_0xf780('0xb'));var crypto=require(_0xf780('0xc'));var jsforce=require(_0xf780('0xd'));var deskjs=require(_0xf780('0xe'));var toCsv=require(_0xf780('0xf'));var querystring=require('querystring');var Papa=require(_0xf780('0x10'));var Redis=require(_0xf780('0x11'));var authService=require(_0xf780('0x12'));var qs=require(_0xf780('0x13'));var as=require(_0xf780('0x14'));var hardwareService=require(_0xf780('0x15'));var logger=require(_0xf780('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf780('0x17'));var licenseUtil=require(_0xf780('0x18'));var db=require(_0xf780('0x19'))['db'];function respondWithStatusCode(_0x1a8520,_0x5f04e1){_0x5f04e1=_0x5f04e1||0xcc;return function(_0x24aa4f){if(_0x24aa4f){return _0x1a8520[_0xf780('0x1a')](_0x5f04e1);}return _0x1a8520[_0xf780('0x1b')](_0x5f04e1)[_0xf780('0x1c')]();};}function respondWithResult(_0x5c353b,_0x5a64bc){_0x5a64bc=_0x5a64bc||0xc8;return function(_0x4be599){if(_0x4be599){return _0x5c353b[_0xf780('0x1b')](_0x5a64bc)[_0xf780('0x1d')](_0x4be599);}};}function respondWithFilteredResult(_0xc1e872,_0x187b6d){return function(_0x206d34){if(_0x206d34){var _0x335ba6=typeof _0x187b6d[_0xf780('0x1e')]==='undefined'&&typeof _0x187b6d[_0xf780('0x1f')]===_0xf780('0x20');var _0xa78b1b=_0x206d34[_0xf780('0x21')];var _0x5d5a81=_0x335ba6?0x0:_0x187b6d[_0xf780('0x1e')];var _0x53dfee=_0x335ba6?_0x206d34[_0xf780('0x21')]:_0x187b6d[_0xf780('0x1e')]+_0x187b6d['limit'];var _0x29dae1;if(_0x53dfee>=_0xa78b1b){_0x53dfee=_0xa78b1b;_0x29dae1=0xc8;}else{_0x29dae1=0xce;}_0xc1e872[_0xf780('0x1b')](_0x29dae1);return _0xc1e872['set'](_0xf780('0x22'),_0x5d5a81+'-'+_0x53dfee+'/'+_0xa78b1b)[_0xf780('0x1d')](_0x206d34);}return null;};}function patchUpdates(_0x3c7054){return function(_0x4065bb){try{jsonpatch[_0xf780('0x23')](_0x4065bb,_0x3c7054,!![]);}catch(_0x147de9){return BPromise['reject'](_0x147de9);}return _0x4065bb[_0xf780('0x24')]();};}function saveUpdates(_0x4de546,_0x5853ea){return function(_0x45d80e){if(_0x45d80e){return _0x45d80e[_0xf780('0x25')](_0x4de546)[_0xf780('0x26')](function(_0x58bb66){return _0x58bb66;});}return null;};}function removeEntity(_0x2fcb2d,_0x373dce){return function(_0x4f59b1){if(_0x4f59b1){return _0x4f59b1[_0xf780('0x27')]()['then'](function(){_0x2fcb2d[_0xf780('0x1b')](0xcc)[_0xf780('0x1c')]();});}};}function handleEntityNotFound(_0x5d4053,_0x589208){return function(_0x3710bb){if(!_0x3710bb){_0x5d4053[_0xf780('0x1a')](0x194);}return _0x3710bb;};}function handleError(_0x462435,_0x40d9c9){_0x40d9c9=_0x40d9c9||0x1f4;return function(_0x458c76){logger[_0xf780('0x28')](_0x458c76[_0xf780('0x29')]);if(_0x458c76['name']){delete _0x458c76['name'];}_0x462435['status'](_0x40d9c9)[_0xf780('0x2a')](_0x458c76);};}exports[_0xf780('0x2b')]=function(_0x26452f,_0x4ef8c3){var _0x4ed256={},_0x36bc63={},_0x149190={'count':0x0,'rows':[]};var _0x2b832d=_['map'](db[_0xf780('0x2c')][_0xf780('0x2d')],function(_0x2368e3){return{'name':_0x2368e3[_0xf780('0x2e')],'type':_0x2368e3['type'][_0xf780('0x2f')]};});_0x36bc63['model']=_[_0xf780('0x30')](_0x2b832d,_0xf780('0x31'));_0x36bc63[_0xf780('0x32')]=_[_0xf780('0x33')](_0x26452f[_0xf780('0x32')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],_0x36bc63['query']);_0x4ed256[_0xf780('0x37')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],qs[_0xf780('0x38')](_0x26452f[_0xf780('0x32')]['fields']));_0x4ed256[_0xf780('0x37')]=_0x4ed256['attributes'][_0xf780('0x39')]?_0x4ed256[_0xf780('0x37')]:_0x36bc63[_0xf780('0x36')];if(!_0x26452f['query'][_0xf780('0x3a')](_0xf780('0x3b'))){_0x4ed256[_0xf780('0x1f')]=qs[_0xf780('0x1f')](_0x26452f['query'][_0xf780('0x1f')]);_0x4ed256['offset']=qs[_0xf780('0x1e')](_0x26452f['query']['offset']);}_0x4ed256[_0xf780('0x3c')]=qs['sort'](_0x26452f[_0xf780('0x32')][_0xf780('0x3d')]);_0x4ed256[_0xf780('0x3e')]=qs[_0xf780('0x34')](_['pick'](_0x26452f[_0xf780('0x32')],_0x36bc63[_0xf780('0x34')]),_0x2b832d);if(_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]){_0x4ed256['where']=_[_0xf780('0x40')](_0x4ed256[_0xf780('0x3e')],{'$or':_[_0xf780('0x30')](_0x2b832d,function(_0xdac8ab){if(_0xdac8ab[_0xf780('0x41')]!=='VIRTUAL'){var _0x4b8a3c={};_0x4b8a3c[_0xdac8ab[_0xf780('0x31')]]={'$like':'%'+_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]+'%'};return _0x4b8a3c;}})});}_0x4ed256=_[_0xf780('0x40')]({},_0x4ed256,_0x26452f[_0xf780('0x42')]);var _0x4a0efe={'where':_0x4ed256[_0xf780('0x3e')]};return db['FaxQueueReport'][_0xf780('0x21')](_0x4a0efe)[_0xf780('0x26')](function(_0x28783f){_0x149190[_0xf780('0x21')]=_0x28783f;if(_0x26452f['query'][_0xf780('0x43')]){_0x4ed256[_0xf780('0x44')]=[{'all':!![]}];}return db[_0xf780('0x2c')][_0xf780('0x45')](_0x4ed256);})[_0xf780('0x26')](function(_0x12ae9a){_0x149190[_0xf780('0x46')]=_0x12ae9a;return _0x149190;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ef8c3,_0x4ed256))[_0xf780('0x47')](handleError(_0x4ef8c3,null));};exports[_0xf780('0x48')]=function(_0x143118,_0x30a036){var _0x406a9e={'raw':!![],'where':{'id':_0x143118['params']['id']}},_0x42a710={};_0x42a710[_0xf780('0x36')]=_['keys'](db[_0xf780('0x2c')][_0xf780('0x2d')]);_0x42a710['query']=_['keys'](_0x143118['query']);_0x42a710['filters']=_[_0xf780('0x35')](_0x42a710['model'],_0x42a710[_0xf780('0x32')]);_0x406a9e[_0xf780('0x37')]=_[_0xf780('0x35')](_0x42a710[_0xf780('0x36')],qs[_0xf780('0x38')](_0x143118['query']['fields']));_0x406a9e['attributes']=_0x406a9e['attributes'][_0xf780('0x39')]?_0x406a9e[_0xf780('0x37')]:_0x42a710[_0xf780('0x36')];if(_0x143118[_0xf780('0x32')][_0xf780('0x43')]){_0x406a9e[_0xf780('0x44')]=[{'all':!![]}];}_0x406a9e=_['merge']({},_0x406a9e,_0x143118[_0xf780('0x42')]);return db[_0xf780('0x2c')][_0xf780('0x49')](_0x406a9e)[_0xf780('0x26')](handleEntityNotFound(_0x30a036,null))[_0xf780('0x26')](respondWithResult(_0x30a036,null))[_0xf780('0x47')](handleError(_0x30a036,null));};exports['create']=function(_0x26fe74,_0x5c4170){return db[_0xf780('0x2c')]['create'](_0x26fe74[_0xf780('0x4a')],{})['then'](respondWithResult(_0x5c4170,0xc9))['catch'](handleError(_0x5c4170,null));};exports[_0xf780('0x25')]=function(_0x72a225,_0x189717){if(_0x72a225[_0xf780('0x4a')]['id']){delete _0x72a225['body']['id'];}return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x72a225[_0xf780('0x4b')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x189717,null))[_0xf780('0x26')](saveUpdates(_0x72a225['body'],null))[_0xf780('0x26')](respondWithResult(_0x189717,null))['catch'](handleError(_0x189717,null));};exports[_0xf780('0x27')]=function(_0x1b492a,_0x22c52d){return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x1b492a['params']['id']}})['then'](handleEntityNotFound(_0x22c52d,null))[_0xf780('0x26')](removeEntity(_0x22c52d,null))[_0xf780('0x47')](handleError(_0x22c52d,null));};exports[_0xf780('0x4c')]=function(_0x3fead1,_0x4eebe5){return db[_0xf780('0x2c')][_0xf780('0x4c')]()[_0xf780('0x26')](respondWithResult(_0x4eebe5,null))[_0xf780('0x47')](handleError(_0x4eebe5,null));}; \ No newline at end of file +var _0x95c5=['stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','include','create','body','find','params','destroy','describe','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','save','update','then','error'];(function(_0x2e1d3d,_0x719bf0){var _0x3d81df=function(_0x3ddfa3){while(--_0x3ddfa3){_0x2e1d3d['push'](_0x2e1d3d['shift']());}};_0x3d81df(++_0x719bf0);}(_0x95c5,0x153));var _0x595c=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x95c5[_0x5de532];return _0x4e9192;};'use strict';var emlformat=require(_0x595c('0x0'));var rimraf=require(_0x595c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x595c('0x2'));var rp=require(_0x595c('0x3'));var moment=require(_0x595c('0x4'));var BPromise=require(_0x595c('0x5'));var Mustache=require(_0x595c('0x6'));var util=require(_0x595c('0x7'));var path=require(_0x595c('0x8'));var sox=require(_0x595c('0x9'));var csv=require(_0x595c('0xa'));var ejs=require(_0x595c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x595c('0xc'));var crypto=require(_0x595c('0xd'));var jsforce=require(_0x595c('0xe'));var deskjs=require(_0x595c('0xf'));var toCsv=require(_0x595c('0xa'));var querystring=require(_0x595c('0x10'));var Papa=require(_0x595c('0x11'));var Redis=require(_0x595c('0x12'));var authService=require(_0x595c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x595c('0x14'));var hardwareService=require(_0x595c('0x15'));var logger=require(_0x595c('0x16'))('api');var utils=require(_0x595c('0x17'));var config=require(_0x595c('0x18'));var licenseUtil=require(_0x595c('0x19'));var db=require(_0x595c('0x1a'))['db'];function respondWithStatusCode(_0x913a30,_0x1bae2a){_0x1bae2a=_0x1bae2a||0xcc;return function(_0x3c73e8){if(_0x3c73e8){return _0x913a30[_0x595c('0x1b')](_0x1bae2a);}return _0x913a30[_0x595c('0x1c')](_0x1bae2a)[_0x595c('0x1d')]();};}function respondWithResult(_0x31c568,_0x7b2bcd){_0x7b2bcd=_0x7b2bcd||0xc8;return function(_0x35b622){if(_0x35b622){return _0x31c568[_0x595c('0x1c')](_0x7b2bcd)['json'](_0x35b622);}};}function respondWithFilteredResult(_0x17c053,_0x3243f9){return function(_0x3bf9be){if(_0x3bf9be){var _0x28c2ed=typeof _0x3243f9['offset']==='undefined'&&typeof _0x3243f9[_0x595c('0x1e')]==='undefined';var _0x505f0c=_0x3bf9be[_0x595c('0x1f')];var _0xe45721=_0x28c2ed?0x0:_0x3243f9[_0x595c('0x20')];var _0x4f9936=_0x28c2ed?_0x3bf9be[_0x595c('0x1f')]:_0x3243f9[_0x595c('0x20')]+_0x3243f9['limit'];var _0x2bb744;if(_0x4f9936>=_0x505f0c){_0x4f9936=_0x505f0c;_0x2bb744=0xc8;}else{_0x2bb744=0xce;}_0x17c053[_0x595c('0x1c')](_0x2bb744);return _0x17c053[_0x595c('0x21')](_0x595c('0x22'),_0xe45721+'-'+_0x4f9936+'/'+_0x505f0c)[_0x595c('0x23')](_0x3bf9be);}return null;};}function patchUpdates(_0x3195b8){return function(_0x2d59d4){try{jsonpatch[_0x595c('0x24')](_0x2d59d4,_0x3195b8,!![]);}catch(_0x83573f){return BPromise['reject'](_0x83573f);}return _0x2d59d4[_0x595c('0x25')]();};}function saveUpdates(_0x589c35,_0x378eaf){return function(_0x4b0cb1){if(_0x4b0cb1){return _0x4b0cb1[_0x595c('0x26')](_0x589c35)[_0x595c('0x27')](function(_0x3d7668){return _0x3d7668;});}return null;};}function removeEntity(_0x3d64a8,_0x3f58c4){return function(_0x1eb0ff){if(_0x1eb0ff){return _0x1eb0ff['destroy']()[_0x595c('0x27')](function(){_0x3d64a8['status'](0xcc)[_0x595c('0x1d')]();});}};}function handleEntityNotFound(_0x4970a1,_0x3df8ed){return function(_0x1c3d72){if(!_0x1c3d72){_0x4970a1['sendStatus'](0x194);}return _0x1c3d72;};}function handleError(_0x195df7,_0x99622){_0x99622=_0x99622||0x1f4;return function(_0x1998da){logger[_0x595c('0x28')](_0x1998da[_0x595c('0x29')]);if(_0x1998da[_0x595c('0x2a')]){delete _0x1998da[_0x595c('0x2a')];}_0x195df7['status'](_0x99622)[_0x595c('0x2b')](_0x1998da);};}exports['index']=function(_0x306b16,_0x4afafb){var _0x19001a={},_0x4a6278={},_0x5b7d81={'count':0x0,'rows':[]};var _0x1b8414=_[_0x595c('0x2c')](db[_0x595c('0x2d')][_0x595c('0x2e')],function(_0x5e51c1){return{'name':_0x5e51c1[_0x595c('0x2f')],'type':_0x5e51c1[_0x595c('0x30')][_0x595c('0x31')]};});_0x4a6278[_0x595c('0x32')]=_[_0x595c('0x2c')](_0x1b8414,'name');_0x4a6278['query']=_[_0x595c('0x33')](_0x306b16[_0x595c('0x34')]);_0x4a6278[_0x595c('0x35')]=_['intersection'](_0x4a6278[_0x595c('0x32')],_0x4a6278[_0x595c('0x34')]);_0x19001a['attributes']=_[_0x595c('0x36')](_0x4a6278[_0x595c('0x32')],qs[_0x595c('0x37')](_0x306b16[_0x595c('0x34')]['fields']));_0x19001a[_0x595c('0x38')]=_0x19001a['attributes'][_0x595c('0x39')]?_0x19001a['attributes']:_0x4a6278[_0x595c('0x32')];if(!_0x306b16[_0x595c('0x34')]['hasOwnProperty']('nolimit')){_0x19001a[_0x595c('0x1e')]=qs[_0x595c('0x1e')](_0x306b16[_0x595c('0x34')][_0x595c('0x1e')]);_0x19001a[_0x595c('0x20')]=qs[_0x595c('0x20')](_0x306b16['query'][_0x595c('0x20')]);}_0x19001a[_0x595c('0x3a')]=qs['sort'](_0x306b16['query'][_0x595c('0x3b')]);_0x19001a[_0x595c('0x3c')]=qs[_0x595c('0x35')](_[_0x595c('0x3d')](_0x306b16[_0x595c('0x34')],_0x4a6278['filters']),_0x1b8414);if(_0x306b16[_0x595c('0x34')][_0x595c('0x3e')]){_0x19001a['where']=_[_0x595c('0x3f')](_0x19001a['where'],{'$or':_[_0x595c('0x2c')](_0x1b8414,function(_0x2b841b){if(_0x2b841b['type']!==_0x595c('0x40')){var _0x9eb193={};_0x9eb193[_0x2b841b[_0x595c('0x2a')]]={'$like':'%'+_0x306b16['query'][_0x595c('0x3e')]+'%'};return _0x9eb193;}})});}_0x19001a=_['merge']({},_0x19001a,_0x306b16[_0x595c('0x41')]);var _0x23b636={'where':_0x19001a[_0x595c('0x3c')]};return db[_0x595c('0x2d')][_0x595c('0x1f')](_0x23b636)[_0x595c('0x27')](function(_0x46f1e0){_0x5b7d81['count']=_0x46f1e0;if(_0x306b16[_0x595c('0x34')]['includeAll']){_0x19001a['include']=[{'all':!![]}];}return db[_0x595c('0x2d')][_0x595c('0x42')](_0x19001a);})[_0x595c('0x27')](function(_0xcf14e7){_0x5b7d81['rows']=_0xcf14e7;return _0x5b7d81;})[_0x595c('0x27')](respondWithFilteredResult(_0x4afafb,_0x19001a))[_0x595c('0x43')](handleError(_0x4afafb,null));};exports[_0x595c('0x44')]=function(_0x21fbf5,_0x28cd01){var _0x528780={'raw':!![],'where':{'id':_0x21fbf5['params']['id']}},_0x5359e6={};_0x5359e6[_0x595c('0x32')]=_['keys'](db[_0x595c('0x2d')][_0x595c('0x2e')]);_0x5359e6[_0x595c('0x34')]=_[_0x595c('0x33')](_0x21fbf5[_0x595c('0x34')]);_0x5359e6['filters']=_['intersection'](_0x5359e6['model'],_0x5359e6[_0x595c('0x34')]);_0x528780[_0x595c('0x38')]=_[_0x595c('0x36')](_0x5359e6['model'],qs[_0x595c('0x37')](_0x21fbf5['query']['fields']));_0x528780[_0x595c('0x38')]=_0x528780['attributes'][_0x595c('0x39')]?_0x528780[_0x595c('0x38')]:_0x5359e6['model'];if(_0x21fbf5[_0x595c('0x34')]['includeAll']){_0x528780[_0x595c('0x45')]=[{'all':!![]}];}_0x528780=_['merge']({},_0x528780,_0x21fbf5[_0x595c('0x41')]);return db[_0x595c('0x2d')]['find'](_0x528780)[_0x595c('0x27')](handleEntityNotFound(_0x28cd01,null))[_0x595c('0x27')](respondWithResult(_0x28cd01,null))['catch'](handleError(_0x28cd01,null));};exports[_0x595c('0x46')]=function(_0x1aaa69,_0x126b9e){return db[_0x595c('0x2d')]['create'](_0x1aaa69[_0x595c('0x47')],{})[_0x595c('0x27')](respondWithResult(_0x126b9e,0xc9))[_0x595c('0x43')](handleError(_0x126b9e,null));};exports[_0x595c('0x26')]=function(_0x23cdfe,_0x18aa82){if(_0x23cdfe[_0x595c('0x47')]['id']){delete _0x23cdfe[_0x595c('0x47')]['id'];}return db[_0x595c('0x2d')][_0x595c('0x48')]({'where':{'id':_0x23cdfe[_0x595c('0x49')]['id']}})[_0x595c('0x27')](handleEntityNotFound(_0x18aa82,null))[_0x595c('0x27')](saveUpdates(_0x23cdfe[_0x595c('0x47')],null))[_0x595c('0x27')](respondWithResult(_0x18aa82,null))[_0x595c('0x43')](handleError(_0x18aa82,null));};exports[_0x595c('0x4a')]=function(_0x379d16,_0x1e42a4){return db[_0x595c('0x2d')][_0x595c('0x48')]({'where':{'id':_0x379d16['params']['id']}})[_0x595c('0x27')](handleEntityNotFound(_0x1e42a4,null))[_0x595c('0x27')](removeEntity(_0x1e42a4,null))[_0x595c('0x43')](handleError(_0x1e42a4,null));};exports[_0x595c('0x4b')]=function(_0x1796d1,_0x74dea8){return db[_0x595c('0x2d')][_0x595c('0x4b')]()[_0x595c('0x27')](respondWithResult(_0x74dea8,null))[_0x595c('0x43')](handleError(_0x74dea8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index fc5bf37..cce8b30 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x13b037,_0x329a51){var _0x40bb98=function(_0x4dbb70){while(--_0x4dbb70){_0x13b037['push'](_0x13b037['shift']());}};_0x40bb98(++_0x329a51);}(_0x7a54,0x106));var _0x47a5=function(_0x152a61,_0x1e7f9e){_0x152a61=_0x152a61-0x0;var _0x40f365=_0x7a54[_0x152a61];return _0x40f365;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x4caa30,_0x38aa6f){var _0x3d9d11=function(_0x255208){while(--_0x255208){_0x4caa30['push'](_0x4caa30['shift']());}};_0x3d9d11(++_0x38aa6f);}(_0x5fab,0x177));var _0xb5fa=function(_0x4db40c,_0x5aebda){_0x4db40c=_0x4db40c-0x0;var _0x572a4b=_0x5fab[_0x4db40c];return _0x572a4b;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['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 7d7ac6e..5bfb786 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 _0xc8c5=['stringify','error','message','result','catch','create','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','body','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc8c5,0x1eb));var _0x5c8c=function(_0x590455,_0x338a42){_0x590455=_0x590455-0x0;var _0x1b5a98=_0xc8c5[_0x590455];return _0x1b5a98;};'use strict';var _=require(_0x5c8c('0x0'));var util=require(_0x5c8c('0x1'));var moment=require(_0x5c8c('0x2'));var BPromise=require(_0x5c8c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c8c('0x4'));var db=require(_0x5c8c('0x5'))['db'];var utils=require(_0x5c8c('0x6'));var logger=require(_0x5c8c('0x7'))(_0x5c8c('0x8'));var config=require(_0x5c8c('0x9'));var jayson=require(_0x5c8c('0xa'));var client=jayson['client'][_0x5c8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417230,_0x1f5e72,_0x21ffa4){return new BPromise(function(_0x14ab2a,_0xe3e238){return client[_0x5c8c('0xc')](_0x417230,_0x21ffa4)[_0x5c8c('0xd')](function(_0x246413){logger[_0x5c8c('0xe')](_0x5c8c('0xf'),_0x1f5e72,_0x5c8c('0x10'));logger[_0x5c8c('0x11')](_0x5c8c('0x12'),_0x1f5e72,_0x5c8c('0x10'),JSON[_0x5c8c('0x13')](_0x246413));if(_0x246413['error']){if(_0x246413[_0x5c8c('0x14')]['code']===0x1f4){logger[_0x5c8c('0x14')](_0x5c8c('0xf'),_0x1f5e72,_0x246413[_0x5c8c('0x14')][_0x5c8c('0x15')]);return _0xe3e238(_0x246413['error'][_0x5c8c('0x15')]);}logger['error'](_0x5c8c('0xf'),_0x1f5e72,_0x246413[_0x5c8c('0x14')][_0x5c8c('0x15')]);return _0x14ab2a(_0x246413['error']['message']);}else{logger[_0x5c8c('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x1f5e72,_0x5c8c('0x10'));_0x14ab2a(_0x246413[_0x5c8c('0x16')][_0x5c8c('0x15')]);}})[_0x5c8c('0x17')](function(_0x460aed){logger['error'](_0x5c8c('0xf'),_0x1f5e72,_0x460aed);_0xe3e238(_0x460aed);});});}exports['CreateFaxQueueReport']=function(_0xeb9da2){var _0x426e1b=this;return new Promise(function(_0x10627e,_0x66c0a0){return db['FaxQueueReport'][_0x5c8c('0x18')](_0xeb9da2['body'],{'raw':_0xeb9da2[_0x5c8c('0x19')]?_0xeb9da2['options'][_0x5c8c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2093e2){logger[_0x5c8c('0xe')](_0x5c8c('0x1b'),_0xeb9da2);logger[_0x5c8c('0x11')](_0x5c8c('0x1b'),_0xeb9da2,JSON[_0x5c8c('0x13')](_0x2093e2));_0x10627e(_0x2093e2);})[_0x5c8c('0x17')](function(_0x19e5f1){logger[_0x5c8c('0x14')]('CreateFaxQueueReport',_0x19e5f1[_0x5c8c('0x15')],_0xeb9da2);_0x66c0a0(_0x426e1b[_0x5c8c('0x14')](0x1f4,_0x19e5f1[_0x5c8c('0x15')]));});});};exports[_0x5c8c('0x1c')]=function(_0x420a46){var _0xa0f8d5=this;return new Promise(function(_0x369d52,_0x39af51){return db['FaxQueueReport']['update'](_0x420a46[_0x5c8c('0x1d')],{'raw':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')][_0x5c8c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')]['where']||null:null,'attributes':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')]['attributes']||null:null,'limit':_0x420a46[_0x5c8c('0x19')]?_0x420a46[_0x5c8c('0x19')]['limit']||null:null})['then'](function(_0x2b5747){logger[_0x5c8c('0xe')](_0x5c8c('0x1c'),_0x420a46);logger['debug'](_0x5c8c('0x1c'),_0x420a46,JSON[_0x5c8c('0x13')](_0x2b5747));_0x369d52(_0x2b5747);})[_0x5c8c('0x17')](function(_0x368dc6){logger[_0x5c8c('0x14')](_0x5c8c('0x1c'),_0x368dc6[_0x5c8c('0x15')],_0x420a46);_0x39af51(_0xa0f8d5[_0x5c8c('0x14')](0x1f4,_0x368dc6['message']));});});}; \ No newline at end of file +var _0xc432=['body','options','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','raw','stringify','UpdateFaxQueueReport','update'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xc432,0xfc));var _0x2c43=function(_0x5ddd98,_0x5e54f5){_0x5ddd98=_0x5ddd98-0x0;var _0x9288b3=_0xc432[_0x5ddd98];return _0x9288b3;};'use strict';var _=require(_0x2c43('0x0'));var util=require(_0x2c43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c43('0x2'));var fs=require('fs');var Redis=require(_0x2c43('0x3'));var db=require(_0x2c43('0x4'))['db'];var utils=require(_0x2c43('0x5'));var logger=require(_0x2c43('0x6'))('rpc');var config=require(_0x2c43('0x7'));var jayson=require(_0x2c43('0x8'));var client=jayson[_0x2c43('0x9')][_0x2c43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db87e,_0x34c25a,_0x23f6eb){return new BPromise(function(_0x4c4886,_0x5ede78){return client['request'](_0x1db87e,_0x23f6eb)[_0x2c43('0xb')](function(_0xe5d158){logger[_0x2c43('0xc')](_0x2c43('0xd'),_0x34c25a,'request\x20sent');logger[_0x2c43('0xe')](_0x2c43('0xf'),_0x34c25a,_0x2c43('0x10'),JSON['stringify'](_0xe5d158));if(_0xe5d158[_0x2c43('0x11')]){if(_0xe5d158[_0x2c43('0x11')]['code']===0x1f4){logger['error'](_0x2c43('0xd'),_0x34c25a,_0xe5d158[_0x2c43('0x11')]['message']);return _0x5ede78(_0xe5d158['error'][_0x2c43('0x12')]);}logger[_0x2c43('0x11')](_0x2c43('0xd'),_0x34c25a,_0xe5d158[_0x2c43('0x11')][_0x2c43('0x12')]);return _0x4c4886(_0xe5d158[_0x2c43('0x11')][_0x2c43('0x12')]);}else{logger['info'](_0x2c43('0xd'),_0x34c25a,_0x2c43('0x10'));_0x4c4886(_0xe5d158[_0x2c43('0x13')][_0x2c43('0x12')]);}})[_0x2c43('0x14')](function(_0x1950d6){logger[_0x2c43('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x34c25a,_0x1950d6);_0x5ede78(_0x1950d6);});});}exports[_0x2c43('0x15')]=function(_0x53314d){var _0x32d8c5=this;return new Promise(function(_0x590266,_0x5e4138){return db[_0x2c43('0x16')]['create'](_0x53314d['body'],{'raw':_0x53314d['options']?_0x53314d['options'][_0x2c43('0x17')]===undefined?!![]:![]:!![]})[_0x2c43('0xb')](function(_0x523ecc){logger['info']('CreateFaxQueueReport',_0x53314d);logger['debug'](_0x2c43('0x15'),_0x53314d,JSON[_0x2c43('0x18')](_0x523ecc));_0x590266(_0x523ecc);})[_0x2c43('0x14')](function(_0x5b4d6c){logger[_0x2c43('0x11')]('CreateFaxQueueReport',_0x5b4d6c[_0x2c43('0x12')],_0x53314d);_0x5e4138(_0x32d8c5[_0x2c43('0x11')](0x1f4,_0x5b4d6c[_0x2c43('0x12')]));});});};exports[_0x2c43('0x19')]=function(_0xa9310b){var _0x926e0b=this;return new Promise(function(_0x5b9dc3,_0x591696){return db['FaxQueueReport'][_0x2c43('0x1a')](_0xa9310b[_0x2c43('0x1b')],{'raw':_0xa9310b[_0x2c43('0x1c')]?_0xa9310b[_0x2c43('0x1c')][_0x2c43('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9310b[_0x2c43('0x1c')]?_0xa9310b['options'][_0x2c43('0x1d')]||null:null,'attributes':_0xa9310b['options']?_0xa9310b['options']['attributes']||null:null,'limit':_0xa9310b[_0x2c43('0x1c')]?_0xa9310b['options'][_0x2c43('0x1e')]||null:null})['then'](function(_0x5820ca){logger[_0x2c43('0xc')](_0x2c43('0x19'),_0xa9310b);logger[_0x2c43('0xe')](_0x2c43('0x19'),_0xa9310b,JSON[_0x2c43('0x18')](_0x5820ca));_0x5b9dc3(_0x5820ca);})[_0x2c43('0x14')](function(_0x329f82){logger[_0x2c43('0x11')](_0x2c43('0x19'),_0x329f82[_0x2c43('0x12')],_0xa9310b);_0x591696(_0x926e0b[_0x2c43('0x11')](0x1f4,_0x329f82['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index d37f141..5c27bda 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 _0xacfd=['get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2fffff,_0x415518){var _0x4f2a2c=function(_0x32c77b){while(--_0x32c77b){_0x2fffff['push'](_0x2fffff['shift']());}};_0x4f2a2c(++_0x415518);}(_0xacfd,0x12c));var _0xdacf=function(_0x1c9248,_0xe92ed8){_0x1c9248=_0x1c9248-0x0;var _0xf2203d=_0xacfd[_0x1c9248];return _0xf2203d;};'use strict';var multer=require('multer');var util=require(_0xdacf('0x0'));var path=require('path');var timeout=require(_0xdacf('0x1'));var express=require('express');var router=express[_0xdacf('0x2')]();var fs_extra=require(_0xdacf('0x3'));var auth=require(_0xdacf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdacf('0x5'));var controller=require('./faxQueueReport.controller');router[_0xdacf('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdacf('0x6')](_0xdacf('0x7'),auth[_0xdacf('0x8')](),controller[_0xdacf('0x9')]);router[_0xdacf('0x6')](_0xdacf('0xa'),auth[_0xdacf('0x8')](),controller[_0xdacf('0xb')]);router[_0xdacf('0xc')]('/',auth['isAuthenticated'](),controller[_0xdacf('0xd')]);router[_0xdacf('0xe')](_0xdacf('0xa'),auth[_0xdacf('0x8')](),controller[_0xdacf('0xf')]);router[_0xdacf('0x10')](_0xdacf('0xa'),auth[_0xdacf('0x8')](),controller[_0xdacf('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa050=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x18a63a,_0x259cec){var _0x2cca04=function(_0x556e74){while(--_0x556e74){_0x18a63a['push'](_0x18a63a['shift']());}};_0x2cca04(++_0x259cec);}(_0xa050,0x139));var _0x0a05=function(_0x3ebea0,_0x509a0c){_0x3ebea0=_0x3ebea0-0x0;var _0xd8611a=_0xa050[_0x3ebea0];return _0xd8611a;};'use strict';var multer=require(_0x0a05('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a05('0x1'));var express=require(_0x0a05('0x2'));var router=express[_0x0a05('0x3')]();var fs_extra=require(_0x0a05('0x4'));var auth=require(_0x0a05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a05('0x6'));var controller=require(_0x0a05('0x7'));router[_0x0a05('0x8')]('/',auth[_0x0a05('0x9')](),controller[_0x0a05('0xa')]);router[_0x0a05('0x8')](_0x0a05('0xb'),auth['isAuthenticated'](),controller[_0x0a05('0xc')]);router[_0x0a05('0x8')](_0x0a05('0xd'),auth[_0x0a05('0x9')](),controller['show']);router[_0x0a05('0xe')]('/',auth[_0x0a05('0x9')](),controller[_0x0a05('0xf')]);router[_0x0a05('0x10')](_0x0a05('0xd'),auth[_0x0a05('0x9')](),controller[_0x0a05('0x11')]);router[_0x0a05('0x12')](_0x0a05('0xd'),auth[_0x0a05('0x9')](),controller[_0x0a05('0x13')]);module[_0x0a05('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index fd25c21..f57961b 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4b8f72,_0x58a589){var _0x4da88e=function(_0x201354){while(--_0x201354){_0x4b8f72['push'](_0x4b8f72['shift']());}};_0x4da88e(++_0x58a589);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x348e46,_0x5187dc){_0x348e46=_0x348e46-0x0;var _0x58b74f=_0xf3cd[_0x348e46];return _0x58b74f;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xc4ca37,_0x2eff7f){var _0x5db11f=function(_0x377f2a){while(--_0x377f2a){_0xc4ca37['push'](_0xc4ca37['shift']());}};_0x5db11f(++_0x2eff7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c28ed5d..0ca1773 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 _0xbae6=['to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../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','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FaxTransferReport','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','destroy','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x5b38e2,_0x49a820){var _0x2ccda3=function(_0x282531){while(--_0x282531){_0x5b38e2['push'](_0x5b38e2['shift']());}};_0x2ccda3(++_0x49a820);}(_0xbae6,0x125));var _0x6bae=function(_0x3a5595,_0x267381){_0x3a5595=_0x3a5595-0x0;var _0x3cac19=_0xbae6[_0x3a5595];return _0x3cac19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bae('0x0'));var zipdir=require(_0x6bae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bae('0x2'));var BPromise=require(_0x6bae('0x3'));var Mustache=require(_0x6bae('0x4'));var util=require(_0x6bae('0x5'));var path=require(_0x6bae('0x6'));var sox=require('sox');var csv=require(_0x6bae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bae('0x8'));var squel=require('squel');var crypto=require(_0x6bae('0x9'));var jsforce=require(_0x6bae('0xa'));var deskjs=require(_0x6bae('0xb'));var toCsv=require(_0x6bae('0x7'));var querystring=require(_0x6bae('0xc'));var Papa=require(_0x6bae('0xd'));var Redis=require('ioredis');var authService=require(_0x6bae('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6bae('0xf'));var hardwareService=require(_0x6bae('0x10'));var logger=require(_0x6bae('0x11'))(_0x6bae('0x12'));var utils=require(_0x6bae('0x13'));var config=require(_0x6bae('0x14'));var licenseUtil=require(_0x6bae('0x15'));var db=require(_0x6bae('0x16'))['db'];function respondWithStatusCode(_0x372663,_0x4f3241){_0x4f3241=_0x4f3241||0xcc;return function(_0x2c5491){if(_0x2c5491){return _0x372663['sendStatus'](_0x4f3241);}return _0x372663['status'](_0x4f3241)[_0x6bae('0x17')]();};}function respondWithResult(_0x336b21,_0x2ba0ac){_0x2ba0ac=_0x2ba0ac||0xc8;return function(_0x745517){if(_0x745517){return _0x336b21[_0x6bae('0x18')](_0x2ba0ac)[_0x6bae('0x19')](_0x745517);}};}function respondWithFilteredResult(_0x45495c,_0x553189){return function(_0x451303){if(_0x451303){var _0x45a464=typeof _0x553189[_0x6bae('0x1a')]===_0x6bae('0x1b')&&typeof _0x553189['limit']===_0x6bae('0x1b');var _0x276aad=_0x451303[_0x6bae('0x1c')];var _0x3f3dd7=_0x45a464?0x0:_0x553189[_0x6bae('0x1a')];var _0x44b2e2=_0x45a464?_0x451303[_0x6bae('0x1c')]:_0x553189['offset']+_0x553189[_0x6bae('0x1d')];var _0x362ed9;if(_0x44b2e2>=_0x276aad){_0x44b2e2=_0x276aad;_0x362ed9=0xc8;}else{_0x362ed9=0xce;}_0x45495c[_0x6bae('0x18')](_0x362ed9);return _0x45495c[_0x6bae('0x1e')](_0x6bae('0x1f'),_0x3f3dd7+'-'+_0x44b2e2+'/'+_0x276aad)[_0x6bae('0x19')](_0x451303);}return null;};}function patchUpdates(_0x30a9ef){return function(_0x298e5e){try{jsonpatch[_0x6bae('0x20')](_0x298e5e,_0x30a9ef,!![]);}catch(_0x545556){return BPromise['reject'](_0x545556);}return _0x298e5e[_0x6bae('0x21')]();};}function saveUpdates(_0x49aafd,_0x39db36){return function(_0x30186c){if(_0x30186c){return _0x30186c['update'](_0x49aafd)[_0x6bae('0x22')](function(_0x3801c1){return _0x3801c1;});}return null;};}function removeEntity(_0x4f2056,_0x41e856){return function(_0x1e1390){if(_0x1e1390){return _0x1e1390['destroy']()[_0x6bae('0x22')](function(){_0x4f2056[_0x6bae('0x18')](0xcc)[_0x6bae('0x17')]();});}};}function handleEntityNotFound(_0x10c4c2,_0x26a47e){return function(_0x18102b){if(!_0x18102b){_0x10c4c2[_0x6bae('0x23')](0x194);}return _0x18102b;};}function handleError(_0x532588,_0x437cf4){_0x437cf4=_0x437cf4||0x1f4;return function(_0x4f2726){logger['error'](_0x4f2726[_0x6bae('0x24')]);if(_0x4f2726[_0x6bae('0x25')]){delete _0x4f2726[_0x6bae('0x25')];}_0x532588[_0x6bae('0x18')](_0x437cf4)[_0x6bae('0x26')](_0x4f2726);};}exports[_0x6bae('0x27')]=function(_0x1806c5,_0x55c027){var _0x292374={},_0x203d72={},_0x1f9f9b={'count':0x0,'rows':[]};var _0x2a4d0f=_['map'](db['FaxTransferReport'][_0x6bae('0x28')],function(_0x46c424){return{'name':_0x46c424[_0x6bae('0x29')],'type':_0x46c424[_0x6bae('0x2a')][_0x6bae('0x2b')]};});_0x203d72[_0x6bae('0x2c')]=_[_0x6bae('0x2d')](_0x2a4d0f,_0x6bae('0x25'));_0x203d72[_0x6bae('0x2e')]=_[_0x6bae('0x2f')](_0x1806c5['query']);_0x203d72[_0x6bae('0x30')]=_[_0x6bae('0x31')](_0x203d72['model'],_0x203d72[_0x6bae('0x2e')]);_0x292374['attributes']=_[_0x6bae('0x31')](_0x203d72[_0x6bae('0x2c')],qs['fields'](_0x1806c5[_0x6bae('0x2e')][_0x6bae('0x32')]));_0x292374[_0x6bae('0x33')]=_0x292374[_0x6bae('0x33')]['length']?_0x292374[_0x6bae('0x33')]:_0x203d72[_0x6bae('0x2c')];if(!_0x1806c5[_0x6bae('0x2e')][_0x6bae('0x34')](_0x6bae('0x35'))){_0x292374[_0x6bae('0x1d')]=qs[_0x6bae('0x1d')](_0x1806c5['query'][_0x6bae('0x1d')]);_0x292374['offset']=qs[_0x6bae('0x1a')](_0x1806c5['query'][_0x6bae('0x1a')]);}_0x292374[_0x6bae('0x36')]=qs[_0x6bae('0x37')](_0x1806c5[_0x6bae('0x2e')][_0x6bae('0x37')]);_0x292374[_0x6bae('0x38')]=qs[_0x6bae('0x30')](_[_0x6bae('0x39')](_0x1806c5[_0x6bae('0x2e')],_0x203d72[_0x6bae('0x30')]),_0x2a4d0f);if(_0x1806c5[_0x6bae('0x2e')][_0x6bae('0x3a')]){_0x292374[_0x6bae('0x38')]=_[_0x6bae('0x3b')](_0x292374['where'],{'$or':_[_0x6bae('0x2d')](_0x2a4d0f,function(_0x43a6ec){if(_0x43a6ec[_0x6bae('0x2a')]!=='VIRTUAL'){var _0x2e6644={};_0x2e6644[_0x43a6ec[_0x6bae('0x25')]]={'$like':'%'+_0x1806c5[_0x6bae('0x2e')][_0x6bae('0x3a')]+'%'};return _0x2e6644;}})});}_0x292374=_[_0x6bae('0x3b')]({},_0x292374,_0x1806c5[_0x6bae('0x3c')]);var _0x25150d={'where':_0x292374[_0x6bae('0x38')]};return db[_0x6bae('0x3d')][_0x6bae('0x1c')](_0x25150d)[_0x6bae('0x22')](function(_0x5d74f0){_0x1f9f9b['count']=_0x5d74f0;if(_0x1806c5[_0x6bae('0x2e')]['includeAll']){_0x292374[_0x6bae('0x3e')]=[{'all':!![]}];}return db[_0x6bae('0x3d')][_0x6bae('0x3f')](_0x292374);})['then'](function(_0x1501b3){_0x1f9f9b[_0x6bae('0x40')]=_0x1501b3;return _0x1f9f9b;})[_0x6bae('0x22')](respondWithFilteredResult(_0x55c027,_0x292374))[_0x6bae('0x41')](handleError(_0x55c027,null));};exports[_0x6bae('0x42')]=function(_0x24a9db,_0x23b494){var _0x406e97={'raw':!![],'where':{'id':_0x24a9db[_0x6bae('0x43')]['id']}},_0x7053d3={};_0x7053d3[_0x6bae('0x2c')]=_['keys'](db[_0x6bae('0x3d')][_0x6bae('0x28')]);_0x7053d3['query']=_[_0x6bae('0x2f')](_0x24a9db[_0x6bae('0x2e')]);_0x7053d3['filters']=_['intersection'](_0x7053d3[_0x6bae('0x2c')],_0x7053d3['query']);_0x406e97[_0x6bae('0x33')]=_['intersection'](_0x7053d3['model'],qs[_0x6bae('0x32')](_0x24a9db[_0x6bae('0x2e')][_0x6bae('0x32')]));_0x406e97['attributes']=_0x406e97[_0x6bae('0x33')][_0x6bae('0x44')]?_0x406e97['attributes']:_0x7053d3[_0x6bae('0x2c')];if(_0x24a9db[_0x6bae('0x2e')][_0x6bae('0x45')]){_0x406e97[_0x6bae('0x3e')]=[{'all':!![]}];}_0x406e97=_[_0x6bae('0x3b')]({},_0x406e97,_0x24a9db[_0x6bae('0x3c')]);return db[_0x6bae('0x3d')]['find'](_0x406e97)[_0x6bae('0x22')](handleEntityNotFound(_0x23b494,null))['then'](respondWithResult(_0x23b494,null))[_0x6bae('0x41')](handleError(_0x23b494,null));};exports[_0x6bae('0x46')]=function(_0x4c15d3,_0x55c5a1){return db[_0x6bae('0x3d')][_0x6bae('0x46')](_0x4c15d3[_0x6bae('0x47')],{})['then'](respondWithResult(_0x55c5a1,0xc9))['catch'](handleError(_0x55c5a1,null));};exports['update']=function(_0x251512,_0x36e24b){if(_0x251512['body']['id']){delete _0x251512[_0x6bae('0x47')]['id'];}return db['FaxTransferReport'][_0x6bae('0x48')]({'where':{'id':_0x251512[_0x6bae('0x43')]['id']}})[_0x6bae('0x22')](handleEntityNotFound(_0x36e24b,null))[_0x6bae('0x22')](saveUpdates(_0x251512[_0x6bae('0x47')],null))['then'](respondWithResult(_0x36e24b,null))[_0x6bae('0x41')](handleError(_0x36e24b,null));};exports[_0x6bae('0x49')]=function(_0x4b88e5,_0x302474){return db[_0x6bae('0x3d')][_0x6bae('0x48')]({'where':{'id':_0x4b88e5[_0x6bae('0x43')]['id']}})['then'](handleEntityNotFound(_0x302474,null))[_0x6bae('0x22')](removeEntity(_0x302474,null))[_0x6bae('0x41')](handleError(_0x302474,null));};exports[_0x6bae('0x4a')]=function(_0x4bc2bb,_0x4123fe){return db[_0x6bae('0x3d')][_0x6bae('0x4a')]()[_0x6bae('0x22')](respondWithResult(_0x4123fe,null))[_0x6bae('0x41')](handleError(_0x4123fe,null));}; \ No newline at end of file +var _0xb477=['offset','undefined','limit','set','Content-Range','reject','update','then','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json'];(function(_0x2ac5de,_0x557fda){var _0x4a2b5b=function(_0x348175){while(--_0x348175){_0x2ac5de['push'](_0x2ac5de['shift']());}};_0x4a2b5b(++_0x557fda);}(_0xb477,0x1a6));var _0x7b47=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xb477[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x7b47('0x0'));var rimraf=require(_0x7b47('0x1'));var zipdir=require(_0x7b47('0x2'));var jsonpatch=require(_0x7b47('0x3'));var rp=require(_0x7b47('0x4'));var moment=require(_0x7b47('0x5'));var BPromise=require(_0x7b47('0x6'));var Mustache=require(_0x7b47('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7b47('0x8'));var csv=require('to-csv');var ejs=require(_0x7b47('0x9'));var fs=require('fs');var fs_extra=require(_0x7b47('0xa'));var _=require(_0x7b47('0xb'));var squel=require(_0x7b47('0xc'));var crypto=require(_0x7b47('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7b47('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b47('0xf'));var Papa=require(_0x7b47('0x10'));var Redis=require(_0x7b47('0x11'));var authService=require(_0x7b47('0x12'));var qs=require(_0x7b47('0x13'));var as=require(_0x7b47('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b47('0x15'))(_0x7b47('0x16'));var utils=require('../../config/utils');var config=require(_0x7b47('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x199cf6,_0x345a8d){_0x345a8d=_0x345a8d||0xcc;return function(_0x13c95f){if(_0x13c95f){return _0x199cf6[_0x7b47('0x18')](_0x345a8d);}return _0x199cf6[_0x7b47('0x19')](_0x345a8d)[_0x7b47('0x1a')]();};}function respondWithResult(_0x426004,_0x589816){_0x589816=_0x589816||0xc8;return function(_0x34358a){if(_0x34358a){return _0x426004[_0x7b47('0x19')](_0x589816)[_0x7b47('0x1b')](_0x34358a);}};}function respondWithFilteredResult(_0x38cc3f,_0x230097){return function(_0x4ff3c2){if(_0x4ff3c2){var _0x34c747=typeof _0x230097[_0x7b47('0x1c')]===_0x7b47('0x1d')&&typeof _0x230097[_0x7b47('0x1e')]===_0x7b47('0x1d');var _0x5db05e=_0x4ff3c2['count'];var _0x306408=_0x34c747?0x0:_0x230097[_0x7b47('0x1c')];var _0xf6b192=_0x34c747?_0x4ff3c2['count']:_0x230097[_0x7b47('0x1c')]+_0x230097[_0x7b47('0x1e')];var _0x5d7457;if(_0xf6b192>=_0x5db05e){_0xf6b192=_0x5db05e;_0x5d7457=0xc8;}else{_0x5d7457=0xce;}_0x38cc3f[_0x7b47('0x19')](_0x5d7457);return _0x38cc3f[_0x7b47('0x1f')](_0x7b47('0x20'),_0x306408+'-'+_0xf6b192+'/'+_0x5db05e)['json'](_0x4ff3c2);}return null;};}function patchUpdates(_0x32661b){return function(_0x4fca4d){try{jsonpatch['apply'](_0x4fca4d,_0x32661b,!![]);}catch(_0x513586){return BPromise[_0x7b47('0x21')](_0x513586);}return _0x4fca4d['save']();};}function saveUpdates(_0x4c62d8,_0x191dbd){return function(_0x1dc7c0){if(_0x1dc7c0){return _0x1dc7c0[_0x7b47('0x22')](_0x4c62d8)[_0x7b47('0x23')](function(_0x1da938){return _0x1da938;});}return null;};}function removeEntity(_0x6ca2c5,_0x13e554){return function(_0xf5390e){if(_0xf5390e){return _0xf5390e[_0x7b47('0x24')]()[_0x7b47('0x23')](function(){_0x6ca2c5[_0x7b47('0x19')](0xcc)[_0x7b47('0x1a')]();});}};}function handleEntityNotFound(_0x2f745b,_0xcc8eaf){return function(_0x2fe416){if(!_0x2fe416){_0x2f745b[_0x7b47('0x18')](0x194);}return _0x2fe416;};}function handleError(_0x53d97a,_0x59ccf4){_0x59ccf4=_0x59ccf4||0x1f4;return function(_0x357d00){logger[_0x7b47('0x25')](_0x357d00['stack']);if(_0x357d00['name']){delete _0x357d00[_0x7b47('0x26')];}_0x53d97a['status'](_0x59ccf4)[_0x7b47('0x27')](_0x357d00);};}exports[_0x7b47('0x28')]=function(_0x135afb,_0x3adb8a){var _0x2d1b67={},_0x494789={},_0x526746={'count':0x0,'rows':[]};var _0x32d1b7=_[_0x7b47('0x29')](db[_0x7b47('0x2a')][_0x7b47('0x2b')],function(_0x5ed07b){return{'name':_0x5ed07b[_0x7b47('0x2c')],'type':_0x5ed07b[_0x7b47('0x2d')][_0x7b47('0x2e')]};});_0x494789[_0x7b47('0x2f')]=_[_0x7b47('0x29')](_0x32d1b7,'name');_0x494789[_0x7b47('0x30')]=_[_0x7b47('0x31')](_0x135afb[_0x7b47('0x30')]);_0x494789['filters']=_['intersection'](_0x494789['model'],_0x494789[_0x7b47('0x30')]);_0x2d1b67[_0x7b47('0x32')]=_[_0x7b47('0x33')](_0x494789[_0x7b47('0x2f')],qs[_0x7b47('0x34')](_0x135afb[_0x7b47('0x30')][_0x7b47('0x34')]));_0x2d1b67['attributes']=_0x2d1b67[_0x7b47('0x32')]['length']?_0x2d1b67[_0x7b47('0x32')]:_0x494789[_0x7b47('0x2f')];if(!_0x135afb[_0x7b47('0x30')][_0x7b47('0x35')](_0x7b47('0x36'))){_0x2d1b67[_0x7b47('0x1e')]=qs[_0x7b47('0x1e')](_0x135afb[_0x7b47('0x30')][_0x7b47('0x1e')]);_0x2d1b67[_0x7b47('0x1c')]=qs[_0x7b47('0x1c')](_0x135afb[_0x7b47('0x30')][_0x7b47('0x1c')]);}_0x2d1b67[_0x7b47('0x37')]=qs[_0x7b47('0x38')](_0x135afb[_0x7b47('0x30')][_0x7b47('0x38')]);_0x2d1b67[_0x7b47('0x39')]=qs['filters'](_[_0x7b47('0x3a')](_0x135afb[_0x7b47('0x30')],_0x494789[_0x7b47('0x3b')]),_0x32d1b7);if(_0x135afb[_0x7b47('0x30')][_0x7b47('0x3c')]){_0x2d1b67[_0x7b47('0x39')]=_[_0x7b47('0x3d')](_0x2d1b67['where'],{'$or':_[_0x7b47('0x29')](_0x32d1b7,function(_0x11cff5){if(_0x11cff5[_0x7b47('0x2d')]!==_0x7b47('0x3e')){var _0x3a9013={};_0x3a9013[_0x11cff5['name']]={'$like':'%'+_0x135afb[_0x7b47('0x30')][_0x7b47('0x3c')]+'%'};return _0x3a9013;}})});}_0x2d1b67=_[_0x7b47('0x3d')]({},_0x2d1b67,_0x135afb['options']);var _0x3d40b7={'where':_0x2d1b67['where']};return db[_0x7b47('0x2a')][_0x7b47('0x3f')](_0x3d40b7)['then'](function(_0x6f7ede){_0x526746[_0x7b47('0x3f')]=_0x6f7ede;if(_0x135afb[_0x7b47('0x30')][_0x7b47('0x40')]){_0x2d1b67[_0x7b47('0x41')]=[{'all':!![]}];}return db[_0x7b47('0x2a')][_0x7b47('0x42')](_0x2d1b67);})['then'](function(_0x708d12){_0x526746[_0x7b47('0x43')]=_0x708d12;return _0x526746;})[_0x7b47('0x23')](respondWithFilteredResult(_0x3adb8a,_0x2d1b67))[_0x7b47('0x44')](handleError(_0x3adb8a,null));};exports['show']=function(_0x343b43,_0x577f40){var _0x4e375b={'raw':!![],'where':{'id':_0x343b43[_0x7b47('0x45')]['id']}},_0x3f103e={};_0x3f103e[_0x7b47('0x2f')]=_[_0x7b47('0x31')](db['FaxTransferReport'][_0x7b47('0x2b')]);_0x3f103e[_0x7b47('0x30')]=_[_0x7b47('0x31')](_0x343b43[_0x7b47('0x30')]);_0x3f103e[_0x7b47('0x3b')]=_[_0x7b47('0x33')](_0x3f103e[_0x7b47('0x2f')],_0x3f103e[_0x7b47('0x30')]);_0x4e375b[_0x7b47('0x32')]=_['intersection'](_0x3f103e[_0x7b47('0x2f')],qs[_0x7b47('0x34')](_0x343b43[_0x7b47('0x30')][_0x7b47('0x34')]));_0x4e375b[_0x7b47('0x32')]=_0x4e375b[_0x7b47('0x32')]['length']?_0x4e375b[_0x7b47('0x32')]:_0x3f103e['model'];if(_0x343b43[_0x7b47('0x30')][_0x7b47('0x40')]){_0x4e375b['include']=[{'all':!![]}];}_0x4e375b=_[_0x7b47('0x3d')]({},_0x4e375b,_0x343b43[_0x7b47('0x46')]);return db[_0x7b47('0x2a')][_0x7b47('0x47')](_0x4e375b)[_0x7b47('0x23')](handleEntityNotFound(_0x577f40,null))[_0x7b47('0x23')](respondWithResult(_0x577f40,null))[_0x7b47('0x44')](handleError(_0x577f40,null));};exports['create']=function(_0x4e4c7c,_0x48c586){return db['FaxTransferReport'][_0x7b47('0x48')](_0x4e4c7c[_0x7b47('0x49')],{})[_0x7b47('0x23')](respondWithResult(_0x48c586,0xc9))[_0x7b47('0x44')](handleError(_0x48c586,null));};exports[_0x7b47('0x22')]=function(_0x181468,_0x1c2e50){if(_0x181468['body']['id']){delete _0x181468[_0x7b47('0x49')]['id'];}return db[_0x7b47('0x2a')][_0x7b47('0x47')]({'where':{'id':_0x181468[_0x7b47('0x45')]['id']}})[_0x7b47('0x23')](handleEntityNotFound(_0x1c2e50,null))['then'](saveUpdates(_0x181468[_0x7b47('0x49')],null))[_0x7b47('0x23')](respondWithResult(_0x1c2e50,null))[_0x7b47('0x44')](handleError(_0x1c2e50,null));};exports['destroy']=function(_0x3b75c4,_0x41ceac){return db[_0x7b47('0x2a')][_0x7b47('0x47')]({'where':{'id':_0x3b75c4[_0x7b47('0x45')]['id']}})[_0x7b47('0x23')](handleEntityNotFound(_0x41ceac,null))[_0x7b47('0x23')](removeEntity(_0x41ceac,null))[_0x7b47('0x44')](handleError(_0x41ceac,null));};exports[_0x7b47('0x4a')]=function(_0x549fb1,_0x24a1b4){return db['FaxTransferReport'][_0x7b47('0x4a')]()['then'](respondWithResult(_0x24a1b4,null))['catch'](handleError(_0x24a1b4,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9f23cc7..1ea532c 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 _0xd333=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd333,0x1a3));var _0x3d33=function(_0x3962d5,_0x13fb7c){_0x3962d5=_0x3962d5-0x0;var _0x29a51b=_0xd333[_0x3962d5];return _0x29a51b;};'use strict';var _=require(_0x3d33('0x0'));var util=require(_0x3d33('0x1'));var logger=require(_0x3d33('0x2'))('api');var moment=require(_0x3d33('0x3'));var BPromise=require(_0x3d33('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d33('0x5'));var rimraf=require(_0x3d33('0x6'));var config=require(_0x3d33('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0x3d33('0x8')]=function(_0xa29338,_0x5400f0){return _0xa29338[_0x3d33('0x9')](_0x3d33('0xa'),attributes,{'tableName':_0x3d33('0xb'),'paranoid':![],'indexes':[{'name':_0x3d33('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x991f=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x46b01f,_0x43dc27){var _0x5b091a=function(_0x2d9713){while(--_0x2d9713){_0x46b01f['push'](_0x46b01f['shift']());}};_0x5b091a(++_0x43dc27);}(_0x991f,0x10c));var _0xf991=function(_0x2c6b54,_0x1a1991){_0x2c6b54=_0x2c6b54-0x0;var _0x5f4cd7=_0x991f[_0x2c6b54];return _0x5f4cd7;};'use strict';var _=require(_0xf991('0x0'));var util=require(_0xf991('0x1'));var logger=require(_0xf991('0x2'))(_0xf991('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf991('0x4'));var fs=require('fs');var path=require(_0xf991('0x5'));var rimraf=require(_0xf991('0x6'));var config=require(_0xf991('0x7'));var attributes=require(_0xf991('0x8'));module[_0xf991('0x9')]=function(_0x194384,_0x4f6499){return _0x194384[_0xf991('0xa')](_0xf991('0xb'),attributes,{'tableName':_0xf991('0xc'),'paranoid':![],'indexes':[{'name':_0xf991('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3f7ddbb..0955c05 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 _0xe30a=['stringify','error','message','request\x20sent','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe30a,0x1e5));var _0xae30=function(_0x2e9cde,_0x327b54){_0x2e9cde=_0x2e9cde-0x0;var _0x1b1f33=_0xe30a[_0x2e9cde];return _0x1b1f33;};'use strict';var _=require(_0xae30('0x0'));var util=require(_0xae30('0x1'));var moment=require('moment');var BPromise=require(_0xae30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae30('0x3'));var db=require(_0xae30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xae30('0x5'))(_0xae30('0x6'));var config=require('../../config/environment');var jayson=require(_0xae30('0x7'));var client=jayson[_0xae30('0x8')][_0xae30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45d66b,_0xbc54d2,_0x462c1f){return new BPromise(function(_0x7ec22e,_0x34c307){return client[_0xae30('0xa')](_0x45d66b,_0x462c1f)['then'](function(_0x419618){logger[_0xae30('0xb')](_0xae30('0xc'),_0xbc54d2,'request\x20sent');logger[_0xae30('0xd')](_0xae30('0xe'),_0xbc54d2,'request\x20sent',JSON[_0xae30('0xf')](_0x419618));if(_0x419618[_0xae30('0x10')]){if(_0x419618['error']['code']===0x1f4){logger['error'](_0xae30('0xc'),_0xbc54d2,_0x419618[_0xae30('0x10')][_0xae30('0x11')]);return _0x34c307(_0x419618[_0xae30('0x10')][_0xae30('0x11')]);}logger[_0xae30('0x10')](_0xae30('0xc'),_0xbc54d2,_0x419618['error'][_0xae30('0x11')]);return _0x7ec22e(_0x419618[_0xae30('0x10')]['message']);}else{logger['info'](_0xae30('0xc'),_0xbc54d2,_0xae30('0x12'));_0x7ec22e(_0x419618[_0xae30('0x13')][_0xae30('0x11')]);}})['catch'](function(_0x5efdb3){logger['error'](_0xae30('0xc'),_0xbc54d2,_0x5efdb3);_0x34c307(_0x5efdb3);});});} \ No newline at end of file +var _0x9459=['debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x9459,0x117));var _0x9945=function(_0x38d53a,_0x2608df){_0x38d53a=_0x38d53a-0x0;var _0xf7d504=_0x9459[_0x38d53a];return _0xf7d504;};'use strict';var _=require(_0x9945('0x0'));var util=require(_0x9945('0x1'));var moment=require('moment');var BPromise=require(_0x9945('0x2'));var rs=require(_0x9945('0x3'));var fs=require('fs');var Redis=require(_0x9945('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9945('0x5'));var logger=require(_0x9945('0x6'))(_0x9945('0x7'));var config=require(_0x9945('0x8'));var jayson=require(_0x9945('0x9'));var client=jayson['client'][_0x9945('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2363c7,_0x242249,_0x5782a7){return new BPromise(function(_0x5257e8,_0x3f760e){return client['request'](_0x2363c7,_0x5782a7)[_0x9945('0xb')](function(_0xe8cc4c){logger[_0x9945('0xc')](_0x9945('0xd'),_0x242249,_0x9945('0xe'));logger[_0x9945('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x242249,_0x9945('0xe'),JSON['stringify'](_0xe8cc4c));if(_0xe8cc4c[_0x9945('0x10')]){if(_0xe8cc4c[_0x9945('0x10')][_0x9945('0x11')]===0x1f4){logger['error'](_0x9945('0xd'),_0x242249,_0xe8cc4c[_0x9945('0x10')][_0x9945('0x12')]);return _0x3f760e(_0xe8cc4c[_0x9945('0x10')][_0x9945('0x12')]);}logger[_0x9945('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x242249,_0xe8cc4c['error'][_0x9945('0x12')]);return _0x5257e8(_0xe8cc4c[_0x9945('0x10')]['message']);}else{logger[_0x9945('0xc')](_0x9945('0xd'),_0x242249,_0x9945('0xe'));_0x5257e8(_0xe8cc4c[_0x9945('0x13')]['message']);}})[_0x9945('0x14')](function(_0x2e4d59){logger[_0x9945('0x10')](_0x9945('0xd'),_0x242249,_0x2e4d59);_0x3f760e(_0x2e4d59);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1734db9..afcf55b 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 _0x9ac6=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x12d0fa,_0x14702d){var _0x1642d3=function(_0x1fea21){while(--_0x1fea21){_0x12d0fa['push'](_0x12d0fa['shift']());}};_0x1642d3(++_0x14702d);}(_0x9ac6,0x9e));var _0x69ac=function(_0x4cc27b,_0xea7c26){_0x4cc27b=_0x4cc27b-0x0;var _0x4fbaf9=_0x9ac6[_0x4cc27b];return _0x4fbaf9;};'use strict';var multer=require(_0x69ac('0x0'));var util=require(_0x69ac('0x1'));var path=require(_0x69ac('0x2'));var timeout=require(_0x69ac('0x3'));var express=require('express');var router=express[_0x69ac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x69ac('0x5'));var interaction=require(_0x69ac('0x6'));var config=require(_0x69ac('0x7'));var controller=require(_0x69ac('0x8'));router['get']('/',auth[_0x69ac('0x9')](),controller[_0x69ac('0xa')]);router[_0x69ac('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x69ac('0xc')]);router['get'](_0x69ac('0xd'),auth[_0x69ac('0x9')](),controller[_0x69ac('0xe')]);router[_0x69ac('0xf')]('/',auth[_0x69ac('0x9')](),controller[_0x69ac('0x10')]);router['put'](_0x69ac('0xd'),auth[_0x69ac('0x9')](),controller[_0x69ac('0x11')]);router[_0x69ac('0x12')](_0x69ac('0xd'),auth[_0x69ac('0x9')](),controller['destroy']);module[_0x69ac('0x13')]=router; \ No newline at end of file +var _0x2593=['create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','post'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2593,0x6f));var _0x3259=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x2593[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0x3259('0x0'));var util=require(_0x3259('0x1'));var path=require(_0x3259('0x2'));var timeout=require(_0x3259('0x3'));var express=require(_0x3259('0x4'));var router=express[_0x3259('0x5')]();var fs_extra=require(_0x3259('0x6'));var auth=require(_0x3259('0x7'));var interaction=require(_0x3259('0x8'));var config=require(_0x3259('0x9'));var controller=require('./faxTransferReport.controller');router[_0x3259('0xa')]('/',auth['isAuthenticated'](),controller[_0x3259('0xb')]);router[_0x3259('0xa')](_0x3259('0xc'),auth[_0x3259('0xd')](),controller['describe']);router[_0x3259('0xa')]('/:id',auth[_0x3259('0xd')](),controller['show']);router[_0x3259('0xe')]('/',auth['isAuthenticated'](),controller[_0x3259('0xf')]);router[_0x3259('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3259('0x11')]);router['delete'](_0x3259('0x12'),auth[_0x3259('0xd')](),controller[_0x3259('0x13')]);module[_0x3259('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e2e92f2..74c7243 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 _0x7172=['get','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7172,0xd2));var _0x2717=function(_0x165ac1,_0x4b2c41){_0x165ac1=_0x165ac1-0x0;var _0x44c63a=_0x7172[_0x165ac1];return _0x44c63a;};'use strict';var multer=require('multer');var util=require(_0x2717('0x0'));var path=require(_0x2717('0x1'));var timeout=require(_0x2717('0x2'));var express=require(_0x2717('0x3'));var router=express[_0x2717('0x4')]();var fs_extra=require(_0x2717('0x5'));var auth=require(_0x2717('0x6'));var interaction=require(_0x2717('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x2717('0x8')](),controller[_0x2717('0x9')]);router[_0x2717('0xa')](_0x2717('0xb'),auth[_0x2717('0x8')](),controller[_0x2717('0xc')]);router[_0x2717('0xa')]('/:id/configurations',auth[_0x2717('0x8')](),controller[_0x2717('0xd')]);router['get'](_0x2717('0xe'),auth[_0x2717('0x8')](),controller[_0x2717('0xf')]);router[_0x2717('0x10')]('/',auth[_0x2717('0x8')](),controller['create']);router['post'](_0x2717('0x11'),auth[_0x2717('0x8')](),controller[_0x2717('0x12')]);router['put'](_0x2717('0xb'),auth['isAuthenticated'](),controller[_0x2717('0x13')]);router[_0x2717('0x14')]('/:id',auth[_0x2717('0x8')](),controller[_0x2717('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5aea=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5aea,0x105));var _0xa5ae=function(_0x59df69,_0x263432){_0x59df69=_0x59df69-0x0;var _0x50e8b4=_0x5aea[_0x59df69];return _0x50e8b4;};'use strict';var multer=require('multer');var util=require(_0xa5ae('0x0'));var path=require('path');var timeout=require(_0xa5ae('0x1'));var express=require(_0xa5ae('0x2'));var router=express[_0xa5ae('0x3')]();var fs_extra=require(_0xa5ae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa5ae('0x5'));var config=require(_0xa5ae('0x6'));var controller=require(_0xa5ae('0x7'));router[_0xa5ae('0x8')]('/',auth[_0xa5ae('0x9')](),controller[_0xa5ae('0xa')]);router[_0xa5ae('0x8')](_0xa5ae('0xb'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0xc')]);router['get'](_0xa5ae('0xd'),auth['isAuthenticated'](),controller[_0xa5ae('0xe')]);router['get']('/:id/fields',auth[_0xa5ae('0x9')](),controller[_0xa5ae('0xf')]);router[_0xa5ae('0x10')]('/',auth['isAuthenticated'](),controller[_0xa5ae('0x11')]);router[_0xa5ae('0x10')](_0xa5ae('0xd'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0x12')]);router[_0xa5ae('0x13')](_0xa5ae('0xb'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0x14')]);router[_0xa5ae('0x15')](_0xa5ae('0xb'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0x16')]);module[_0xa5ae('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 b8b7235..2e2a29c 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 _0xe9c9=['integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9c9,0x7f));var _0x9e9c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe9c9[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x9e9c('0x0'));module[_0x9e9c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9e9c('0x2')]},'username':{'type':Sequelize[_0x9e9c('0x2')]},'remoteUri':{'type':Sequelize[_0x9e9c('0x2')]},'authType':{'type':Sequelize[_0x9e9c('0x3')]('basic'),'defaultValue':_0x9e9c('0x4')},'password':{'type':Sequelize[_0x9e9c('0x2')]},'consumerKey':{'type':Sequelize[_0x9e9c('0x2')]},'consumerSecret':{'type':Sequelize[_0x9e9c('0x2')]},'token':{'type':Sequelize[_0x9e9c('0x2')]},'tokenSecret':{'type':Sequelize[_0x9e9c('0x2')]},'serverUrl':{'type':Sequelize[_0x9e9c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9e9c('0x3')](_0x9e9c('0x5'),'newTab'),'defaultValue':_0x9e9c('0x5')}}; \ No newline at end of file +var _0xbb28=['ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xbb28,0x9d));var _0x8bb2=function(_0x272af1,_0x45f8f1){_0x272af1=_0x272af1-0x0;var _0x52c6b5=_0xbb28[_0x272af1];return _0x52c6b5;};'use strict';var Sequelize=require(_0x8bb2('0x0'));module[_0x8bb2('0x1')]={'name':{'type':Sequelize[_0x8bb2('0x2')]},'description':{'type':Sequelize[_0x8bb2('0x2')]},'username':{'type':Sequelize[_0x8bb2('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x8bb2('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x8bb2('0x2')]},'consumerKey':{'type':Sequelize[_0x8bb2('0x2')]},'consumerSecret':{'type':Sequelize[_0x8bb2('0x2')]},'token':{'type':Sequelize[_0x8bb2('0x2')]},'tokenSecret':{'type':Sequelize[_0x8bb2('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8bb2('0x3')]('integrationTab','newTab'),'defaultValue':_0x8bb2('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 97158ed..d9dca0f 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 _0x4c2a=['filters','filter','name','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','DeskConfiguration','length','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','Content-Range','apply','save','update','then','destroy','end','stack','send','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x121df1,_0x3a06c0){var _0x59b6f8=function(_0x31aabb){while(--_0x31aabb){_0x121df1['push'](_0x121df1['shift']());}};_0x59b6f8(++_0x3a06c0);}(_0x4c2a,0x11d));var _0xa4c2=function(_0x9e2285,_0x4691cf){_0x9e2285=_0x9e2285-0x0;var _0x496966=_0x4c2a[_0x9e2285];return _0x496966;};'use strict';var emlformat=require(_0xa4c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4c2('0x1'));var jsonpatch=require(_0xa4c2('0x2'));var rp=require(_0xa4c2('0x3'));var moment=require(_0xa4c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4c2('0x5'));var util=require(_0xa4c2('0x6'));var path=require(_0xa4c2('0x7'));var sox=require('sox');var csv=require(_0xa4c2('0x8'));var ejs=require(_0xa4c2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa4c2('0xa'));var crypto=require(_0xa4c2('0xb'));var jsforce=require(_0xa4c2('0xc'));var deskjs=require(_0xa4c2('0xd'));var toCsv=require(_0xa4c2('0x8'));var querystring=require(_0xa4c2('0xe'));var Papa=require(_0xa4c2('0xf'));var Redis=require('ioredis');var authService=require(_0xa4c2('0x10'));var qs=require(_0xa4c2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4c2('0x12'));var logger=require(_0xa4c2('0x13'))(_0xa4c2('0x14'));var utils=require(_0xa4c2('0x15'));var config=require(_0xa4c2('0x16'));var licenseUtil=require(_0xa4c2('0x17'));var db=require(_0xa4c2('0x18'))['db'];var integrations=require(_0xa4c2('0x19'));function respondWithStatusCode(_0x3c947f,_0x14a1b2){_0x14a1b2=_0x14a1b2||0xcc;return function(_0x5dd395){if(_0x5dd395){return _0x3c947f['sendStatus'](_0x14a1b2);}return _0x3c947f['status'](_0x14a1b2)['end']();};}function respondWithResult(_0x38683b,_0x3d9a0e){_0x3d9a0e=_0x3d9a0e||0xc8;return function(_0x2ad824){if(_0x2ad824){return _0x38683b[_0xa4c2('0x1a')](_0x3d9a0e)[_0xa4c2('0x1b')](_0x2ad824);}};}function respondWithFilteredResult(_0x3e08cd,_0x210d65){return function(_0xf959f9){if(_0xf959f9){var _0x4ae908=typeof _0x210d65[_0xa4c2('0x1c')]==='undefined'&&typeof _0x210d65[_0xa4c2('0x1d')]===_0xa4c2('0x1e');var _0x385b5f=_0xf959f9['count'];var _0x437799=_0x4ae908?0x0:_0x210d65[_0xa4c2('0x1c')];var _0x3e31ee=_0x4ae908?_0xf959f9['count']:_0x210d65[_0xa4c2('0x1c')]+_0x210d65['limit'];var _0x228f05;if(_0x3e31ee>=_0x385b5f){_0x3e31ee=_0x385b5f;_0x228f05=0xc8;}else{_0x228f05=0xce;}_0x3e08cd['status'](_0x228f05);return _0x3e08cd['set'](_0xa4c2('0x1f'),_0x437799+'-'+_0x3e31ee+'/'+_0x385b5f)[_0xa4c2('0x1b')](_0xf959f9);}return null;};}function patchUpdates(_0x2b5e70){return function(_0x318921){try{jsonpatch[_0xa4c2('0x20')](_0x318921,_0x2b5e70,!![]);}catch(_0x4ff43c){return BPromise['reject'](_0x4ff43c);}return _0x318921[_0xa4c2('0x21')]();};}function saveUpdates(_0x189f85,_0xb6ed38){return function(_0x17c5fd){if(_0x17c5fd){return _0x17c5fd[_0xa4c2('0x22')](_0x189f85)[_0xa4c2('0x23')](function(_0x10ae15){return _0x10ae15;});}return null;};}function removeEntity(_0x275646,_0x405ce4){return function(_0x15bbc6){if(_0x15bbc6){return _0x15bbc6[_0xa4c2('0x24')]()[_0xa4c2('0x23')](function(){_0x275646[_0xa4c2('0x1a')](0xcc)[_0xa4c2('0x25')]();});}};}function handleEntityNotFound(_0x1f5fff,_0x372ff0){return function(_0x103c7b){if(!_0x103c7b){_0x1f5fff['sendStatus'](0x194);}return _0x103c7b;};}function handleError(_0x2f7409,_0x2ca653){_0x2ca653=_0x2ca653||0x1f4;return function(_0x10957c){logger['error'](_0x10957c[_0xa4c2('0x26')]);if(_0x10957c['name']){delete _0x10957c['name'];}_0x2f7409[_0xa4c2('0x1a')](_0x2ca653)[_0xa4c2('0x27')](_0x10957c);};}exports['index']=function(_0x4b50cd,_0x2f7151){var _0x4c8a63={},_0x2a5e90={},_0x44a965={'count':0x0,'rows':[]};var _0x68df44=_[_0xa4c2('0x28')](db[_0xa4c2('0x29')][_0xa4c2('0x2a')],function(_0x4c2f53){return{'name':_0x4c2f53[_0xa4c2('0x2b')],'type':_0x4c2f53[_0xa4c2('0x2c')]['key']};});_0x2a5e90[_0xa4c2('0x2d')]=_[_0xa4c2('0x28')](_0x68df44,'name');_0x2a5e90[_0xa4c2('0x2e')]=_[_0xa4c2('0x2f')](_0x4b50cd[_0xa4c2('0x2e')]);_0x2a5e90['filters']=_[_0xa4c2('0x30')](_0x2a5e90['model'],_0x2a5e90[_0xa4c2('0x2e')]);_0x4c8a63['attributes']=_[_0xa4c2('0x30')](_0x2a5e90[_0xa4c2('0x2d')],qs[_0xa4c2('0x31')](_0x4b50cd[_0xa4c2('0x2e')][_0xa4c2('0x31')]));_0x4c8a63[_0xa4c2('0x32')]=_0x4c8a63[_0xa4c2('0x32')]['length']?_0x4c8a63[_0xa4c2('0x32')]:_0x2a5e90[_0xa4c2('0x2d')];if(!_0x4b50cd[_0xa4c2('0x2e')][_0xa4c2('0x33')](_0xa4c2('0x34'))){_0x4c8a63[_0xa4c2('0x1d')]=qs[_0xa4c2('0x1d')](_0x4b50cd['query'][_0xa4c2('0x1d')]);_0x4c8a63['offset']=qs[_0xa4c2('0x1c')](_0x4b50cd[_0xa4c2('0x2e')][_0xa4c2('0x1c')]);}_0x4c8a63[_0xa4c2('0x35')]=qs['sort'](_0x4b50cd[_0xa4c2('0x2e')][_0xa4c2('0x36')]);_0x4c8a63[_0xa4c2('0x37')]=qs['filters'](_[_0xa4c2('0x38')](_0x4b50cd[_0xa4c2('0x2e')],_0x2a5e90[_0xa4c2('0x39')]),_0x68df44);if(_0x4b50cd[_0xa4c2('0x2e')][_0xa4c2('0x3a')]){_0x4c8a63[_0xa4c2('0x37')]=_['merge'](_0x4c8a63['where'],{'$or':_[_0xa4c2('0x28')](_0x68df44,function(_0x5cd6a3){if(_0x5cd6a3['type']!=='VIRTUAL'){var _0x6817f6={};_0x6817f6[_0x5cd6a3[_0xa4c2('0x3b')]]={'$like':'%'+_0x4b50cd['query'][_0xa4c2('0x3a')]+'%'};return _0x6817f6;}})});}_0x4c8a63=_[_0xa4c2('0x3c')]({},_0x4c8a63,_0x4b50cd[_0xa4c2('0x3d')]);var _0x295c1a={'where':_0x4c8a63[_0xa4c2('0x37')]};return db[_0xa4c2('0x29')][_0xa4c2('0x3e')](_0x295c1a)['then'](function(_0x300fb6){_0x44a965['count']=_0x300fb6;if(_0x4b50cd[_0xa4c2('0x2e')][_0xa4c2('0x3f')]){_0x4c8a63[_0xa4c2('0x40')]=[{'all':!![]}];}return db[_0xa4c2('0x29')][_0xa4c2('0x41')](_0x4c8a63);})[_0xa4c2('0x23')](function(_0x2c901a){_0x44a965[_0xa4c2('0x42')]=_0x2c901a;return _0x44a965;})['then'](respondWithFilteredResult(_0x2f7151,_0x4c8a63))[_0xa4c2('0x43')](handleError(_0x2f7151,null));};exports['show']=function(_0x13e569,_0x5c373b){var _0x2d2ac7={'raw':![],'where':{'id':_0x13e569[_0xa4c2('0x44')]['id']}},_0x283c05={};_0x283c05[_0xa4c2('0x2d')]=_[_0xa4c2('0x2f')](db[_0xa4c2('0x29')][_0xa4c2('0x2a')]);_0x283c05[_0xa4c2('0x2e')]=_['keys'](_0x13e569['query']);_0x283c05[_0xa4c2('0x39')]=_[_0xa4c2('0x30')](_0x283c05['model'],_0x283c05[_0xa4c2('0x2e')]);_0x2d2ac7[_0xa4c2('0x32')]=_['intersection'](_0x283c05[_0xa4c2('0x2d')],qs[_0xa4c2('0x31')](_0x13e569[_0xa4c2('0x2e')][_0xa4c2('0x31')]));_0x2d2ac7['attributes']=_0x2d2ac7[_0xa4c2('0x32')]['length']?_0x2d2ac7[_0xa4c2('0x32')]:_0x283c05[_0xa4c2('0x2d')];if(_0x13e569[_0xa4c2('0x2e')][_0xa4c2('0x3f')]){_0x2d2ac7[_0xa4c2('0x40')]=[{'all':!![]}];}_0x2d2ac7=_[_0xa4c2('0x3c')]({},_0x2d2ac7,_0x13e569[_0xa4c2('0x3d')]);return db['DeskAccount'][_0xa4c2('0x45')](_0x2d2ac7)[_0xa4c2('0x23')](handleEntityNotFound(_0x5c373b,null))[_0xa4c2('0x23')](respondWithResult(_0x5c373b,null))['catch'](handleError(_0x5c373b,null));};exports['create']=function(_0x44a06d,_0x389053){return db['DeskAccount'][_0xa4c2('0x46')](_0x44a06d[_0xa4c2('0x47')],{})['then'](respondWithResult(_0x389053,0xc9))[_0xa4c2('0x43')](handleError(_0x389053,null));};exports['update']=function(_0x1fedcd,_0x5d876c){if(_0x1fedcd[_0xa4c2('0x47')]['id']){delete _0x1fedcd[_0xa4c2('0x47')]['id'];}return db[_0xa4c2('0x29')][_0xa4c2('0x45')]({'where':{'id':_0x1fedcd[_0xa4c2('0x44')]['id']}})[_0xa4c2('0x23')](handleEntityNotFound(_0x5d876c,null))[_0xa4c2('0x23')](saveUpdates(_0x1fedcd[_0xa4c2('0x47')],null))[_0xa4c2('0x23')](respondWithResult(_0x5d876c,null))[_0xa4c2('0x43')](handleError(_0x5d876c,null));};exports[_0xa4c2('0x24')]=function(_0x67c52f,_0x39870d){return db[_0xa4c2('0x29')][_0xa4c2('0x45')]({'where':{'id':_0x67c52f[_0xa4c2('0x44')]['id']}})[_0xa4c2('0x23')](handleEntityNotFound(_0x39870d,null))[_0xa4c2('0x23')](removeEntity(_0x39870d,null))['catch'](handleError(_0x39870d,null));};exports[_0xa4c2('0x48')]=function(_0xb68716,_0x30873a,_0x3b4da7){var _0x3bacb4={};var _0x541dc3={};var _0x1e11bc;var _0x54687d;return db[_0xa4c2('0x29')][_0xa4c2('0x49')]({'where':{'id':_0xb68716[_0xa4c2('0x44')]['id']}})[_0xa4c2('0x23')](handleEntityNotFound(_0x30873a,null))[_0xa4c2('0x23')](function(_0x5367b5){if(_0x5367b5){_0x1e11bc=_0x5367b5;_0x541dc3['model']=_[_0xa4c2('0x2f')](db[_0xa4c2('0x4a')][_0xa4c2('0x2a')]);_0x541dc3[_0xa4c2('0x2e')]=_[_0xa4c2('0x2f')](_0xb68716[_0xa4c2('0x2e')]);_0x541dc3['filters']=_[_0xa4c2('0x30')](_0x541dc3['model'],_0x541dc3['query']);_0x3bacb4[_0xa4c2('0x32')]=_[_0xa4c2('0x30')](_0x541dc3['model'],qs['fields'](_0xb68716[_0xa4c2('0x2e')][_0xa4c2('0x31')]));_0x3bacb4[_0xa4c2('0x32')]=_0x3bacb4[_0xa4c2('0x32')][_0xa4c2('0x4b')]?_0x3bacb4[_0xa4c2('0x32')]:_0x541dc3[_0xa4c2('0x2d')];_0x3bacb4[_0xa4c2('0x35')]=qs[_0xa4c2('0x36')](_0xb68716[_0xa4c2('0x2e')][_0xa4c2('0x36')]);_0x3bacb4['where']=qs['filters'](_[_0xa4c2('0x38')](_0xb68716[_0xa4c2('0x2e')],_0x541dc3['filters']));if(_0xb68716[_0xa4c2('0x2e')]['filter']){_0x3bacb4[_0xa4c2('0x37')]=_['merge'](_0x3bacb4[_0xa4c2('0x37')],{'$or':_[_0xa4c2('0x28')](_0x3bacb4[_0xa4c2('0x32')],function(_0x260fb7){var _0x142cdf={};_0x142cdf[_0x260fb7]={'$like':'%'+_0xb68716[_0xa4c2('0x2e')][_0xa4c2('0x3a')]+'%'};return _0x142cdf;})});}_0x3bacb4=_[_0xa4c2('0x3c')]({},_0x3bacb4,_0xb68716[_0xa4c2('0x3d')]);return _0x1e11bc[_0xa4c2('0x48')](_0x3bacb4);}})['then'](function(_0xef48b5){if(_0xef48b5){_0x54687d=_0xef48b5[_0xa4c2('0x4b')];if(!_0xb68716[_0xa4c2('0x2e')]['hasOwnProperty'](_0xa4c2('0x34'))){_0x3bacb4[_0xa4c2('0x1d')]=qs[_0xa4c2('0x1d')](_0xb68716[_0xa4c2('0x2e')][_0xa4c2('0x1d')]);_0x3bacb4[_0xa4c2('0x1c')]=qs[_0xa4c2('0x1c')](_0xb68716[_0xa4c2('0x2e')][_0xa4c2('0x1c')]);}return _0x1e11bc[_0xa4c2('0x48')](_0x3bacb4);}})[_0xa4c2('0x23')](function(_0x481c81){if(_0x481c81){return _0x481c81?{'count':_0x54687d,'rows':_0x481c81}:null;}})[_0xa4c2('0x23')](respondWithResult(_0x30873a,null))[_0xa4c2('0x43')](handleError(_0x30873a,null));};exports['addConfiguration']=function(_0x47b650,_0x39ca40,_0x48dff0){if(_0x47b650[_0xa4c2('0x47')]['id']){delete _0x47b650[_0xa4c2('0x47')]['id'];}return db[_0xa4c2('0x29')][_0xa4c2('0x49')]({'where':{'id':_0x47b650[_0xa4c2('0x44')]['id']}})[_0xa4c2('0x23')](handleEntityNotFound(_0x39ca40,null))[_0xa4c2('0x23')](function(_0x31cf28){if(_0x31cf28){_0x47b650[_0xa4c2('0x47')][_0xa4c2('0x4c')]=_0x31cf28['id'];_0x47b650['body'][_0xa4c2('0x4d')]=integrations[_0xa4c2('0x4e')](_0x47b650['body'][_0xa4c2('0x4f')],_0x47b650[_0xa4c2('0x47')][_0xa4c2('0x2c')]);_0x47b650['body'][_0xa4c2('0x50')]=integrations[_0xa4c2('0x51')](_0x47b650[_0xa4c2('0x47')]['channel'],_0x47b650[_0xa4c2('0x47')]['type']);return db[_0xa4c2('0x4a')][_0xa4c2('0x46')](_0x47b650[_0xa4c2('0x47')],{'include':[{'model':db[_0xa4c2('0x52')],'as':_0xa4c2('0x4d')},{'model':db[_0xa4c2('0x52')],'as':_0xa4c2('0x50')}]});}return null;})[_0xa4c2('0x23')](respondWithResult(_0x39ca40,null))[_0xa4c2('0x43')](handleError(_0x39ca40,null));};exports[_0xa4c2('0x53')]=function(_0x387fca,_0x3b19c0,_0x10163d){var _0x5cb37f=[{'name':_0xa4c2('0x54'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x17c47e='';return db['DeskAccount'][_0xa4c2('0x49')]({'where':{'id':_0x387fca[_0xa4c2('0x44')]['id']},'attributes':['id','remoteUri',_0xa4c2('0x55'),_0xa4c2('0x56'),_0xa4c2('0x57'),_0xa4c2('0x58'),_0xa4c2('0x59'),_0xa4c2('0x5a'),_0xa4c2('0x5b')]})[_0xa4c2('0x23')](handleEntityNotFound(_0x3b19c0,null))[_0xa4c2('0x23')](function(_0xc0667c){if(_0xc0667c){_0x17c47e=_0xc0667c[_0xa4c2('0x5c')];var _0x2ebb64=_0x17c47e[_0xa4c2('0x5d')](-0x1);if(_0x2ebb64==='/'){_0x17c47e=_0x17c47e[_0xa4c2('0x5e')](0x0,_0x17c47e['lastIndexOf'](_0x2ebb64));}var _0x4516a6={'method':_0xa4c2('0x5f'),'uri':util[_0xa4c2('0x60')](_0xa4c2('0x61'),_0x17c47e),'headers':{'Content-Type':'application/json','Accept':_0xa4c2('0x62')},'json':!![]};if(_0xc0667c[_0xa4c2('0x55')]==='basic'){_0x4516a6[_0xa4c2('0x63')][_0xa4c2('0x64')]=util[_0xa4c2('0x60')](_0xa4c2('0x65'),new Buffer(util[_0xa4c2('0x60')](_0xa4c2('0x66'),_0xc0667c['username'],_0xc0667c[_0xa4c2('0x57')]))[_0xa4c2('0x67')](_0xa4c2('0x68')));}return rp(_0x4516a6)[_0xa4c2('0x23')](function(_0x22c57c){return _0x5cb37f[_0xa4c2('0x69')](_[_0xa4c2('0x28')](_0x22c57c[_0xa4c2('0x6a')]['entries'],function(_0x44da0d){return{'id':_0x44da0d[_0xa4c2('0x3b')],'name':_0x44da0d[_0xa4c2('0x3b')],'type':_0x44da0d['type'],'active':_0x44da0d[_0xa4c2('0x6b')],'label':_0x44da0d[_0xa4c2('0x6c')],'custom':!![]};}));});}})[_0xa4c2('0x23')](function(_0x432222){return{'count':_0x432222['length'],'rows':_0x432222};})[_0xa4c2('0x23')](respondWithResult(_0x3b19c0,null))['catch'](function(_0xe4ee6d){var _0xf9023d=_0x387fca[_0xa4c2('0x2e')][_0xa4c2('0x6d')]?0x1f4:_0xe4ee6d[_0xa4c2('0x6e')]||0x1f4;logger[_0xa4c2('0x6f')](_0xa4c2('0x70'),'getFields',_0xf9023d,JSON['stringify'](_0xe4ee6d));delete _0xe4ee6d['name'];if(_0xf9023d===0x191){_0xf9023d=0x190;}_0x3b19c0['status'](_0xf9023d)[_0xa4c2('0x27')](_0x387fca[_0xa4c2('0x2e')][_0xa4c2('0x6d')]?{'message':_0xa4c2('0x71'),'statusCode':_0xe4ee6d['statusCode']}:_0xe4ee6d);});}; \ No newline at end of file +var _0x3685=['channel','Descriptions','getDescriptions','DeskConfiguration','create','Subjects','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','slice','substring','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','base64','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','catch','show','params','options','body','find','getConfigurations','findOne','addConfiguration','AccountId'];(function(_0x1834df,_0x27bad3){var _0x5b3b41=function(_0x5830e7){while(--_0x5830e7){_0x1834df['push'](_0x1834df['shift']());}};_0x5b3b41(++_0x27bad3);}(_0x3685,0x1cf));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5368('0x0'));var rimraf=require(_0x5368('0x1'));var zipdir=require(_0x5368('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var BPromise=require(_0x5368('0x5'));var Mustache=require(_0x5368('0x6'));var util=require('util');var path=require(_0x5368('0x7'));var sox=require('sox');var csv=require(_0x5368('0x8'));var ejs=require(_0x5368('0x9'));var fs=require('fs');var fs_extra=require(_0x5368('0xa'));var _=require('lodash');var squel=require(_0x5368('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5368('0xc'));var toCsv=require(_0x5368('0x8'));var querystring=require('querystring');var Papa=require(_0x5368('0xd'));var Redis=require(_0x5368('0xe'));var authService=require(_0x5368('0xf'));var qs=require(_0x5368('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5368('0x11'));var logger=require('../../config/logger')(_0x5368('0x12'));var utils=require(_0x5368('0x13'));var config=require(_0x5368('0x14'));var licenseUtil=require(_0x5368('0x15'));var db=require(_0x5368('0x16'))['db'];var integrations=require(_0x5368('0x17'));function respondWithStatusCode(_0x278b5d,_0x13544c){_0x13544c=_0x13544c||0xcc;return function(_0x243346){if(_0x243346){return _0x278b5d['sendStatus'](_0x13544c);}return _0x278b5d['status'](_0x13544c)[_0x5368('0x18')]();};}function respondWithResult(_0x24c2a2,_0x1fe49a){_0x1fe49a=_0x1fe49a||0xc8;return function(_0x871794){if(_0x871794){return _0x24c2a2[_0x5368('0x19')](_0x1fe49a)[_0x5368('0x1a')](_0x871794);}};}function respondWithFilteredResult(_0x125c46,_0x43bb65){return function(_0x22a6de){if(_0x22a6de){var _0x5070f6=typeof _0x43bb65[_0x5368('0x1b')]===_0x5368('0x1c')&&typeof _0x43bb65['limit']==='undefined';var _0x2d37d3=_0x22a6de[_0x5368('0x1d')];var _0x398153=_0x5070f6?0x0:_0x43bb65[_0x5368('0x1b')];var _0x696ac2=_0x5070f6?_0x22a6de[_0x5368('0x1d')]:_0x43bb65[_0x5368('0x1b')]+_0x43bb65[_0x5368('0x1e')];var _0xb501a4;if(_0x696ac2>=_0x2d37d3){_0x696ac2=_0x2d37d3;_0xb501a4=0xc8;}else{_0xb501a4=0xce;}_0x125c46[_0x5368('0x19')](_0xb501a4);return _0x125c46[_0x5368('0x1f')]('Content-Range',_0x398153+'-'+_0x696ac2+'/'+_0x2d37d3)['json'](_0x22a6de);}return null;};}function patchUpdates(_0x2b77ed){return function(_0x3ed694){try{jsonpatch['apply'](_0x3ed694,_0x2b77ed,!![]);}catch(_0x58d361){return BPromise[_0x5368('0x20')](_0x58d361);}return _0x3ed694[_0x5368('0x21')]();};}function saveUpdates(_0x32629b,_0x1f8191){return function(_0xc46930){if(_0xc46930){return _0xc46930[_0x5368('0x22')](_0x32629b)['then'](function(_0xc1c95e){return _0xc1c95e;});}return null;};}function removeEntity(_0x36c812,_0x272ff1){return function(_0x3524c5){if(_0x3524c5){return _0x3524c5[_0x5368('0x23')]()[_0x5368('0x24')](function(){_0x36c812[_0x5368('0x19')](0xcc)[_0x5368('0x18')]();});}};}function handleEntityNotFound(_0x2a6763,_0x51c9c3){return function(_0x42b9d7){if(!_0x42b9d7){_0x2a6763[_0x5368('0x25')](0x194);}return _0x42b9d7;};}function handleError(_0x4b208d,_0x2f5f5b){_0x2f5f5b=_0x2f5f5b||0x1f4;return function(_0x4825ed){logger['error'](_0x4825ed[_0x5368('0x26')]);if(_0x4825ed['name']){delete _0x4825ed[_0x5368('0x27')];}_0x4b208d[_0x5368('0x19')](_0x2f5f5b)[_0x5368('0x28')](_0x4825ed);};}exports[_0x5368('0x29')]=function(_0x44ac24,_0x5a1f61){var _0x18d954={},_0x5b429c={},_0x33f806={'count':0x0,'rows':[]};var _0xd91acd=_[_0x5368('0x2a')](db[_0x5368('0x2b')][_0x5368('0x2c')],function(_0x499e9d){return{'name':_0x499e9d[_0x5368('0x2d')],'type':_0x499e9d[_0x5368('0x2e')][_0x5368('0x2f')]};});_0x5b429c['model']=_[_0x5368('0x2a')](_0xd91acd,_0x5368('0x27'));_0x5b429c[_0x5368('0x30')]=_[_0x5368('0x31')](_0x44ac24[_0x5368('0x30')]);_0x5b429c[_0x5368('0x32')]=_[_0x5368('0x33')](_0x5b429c[_0x5368('0x34')],_0x5b429c[_0x5368('0x30')]);_0x18d954['attributes']=_[_0x5368('0x33')](_0x5b429c[_0x5368('0x34')],qs[_0x5368('0x35')](_0x44ac24[_0x5368('0x30')][_0x5368('0x35')]));_0x18d954['attributes']=_0x18d954[_0x5368('0x36')][_0x5368('0x37')]?_0x18d954['attributes']:_0x5b429c['model'];if(!_0x44ac24[_0x5368('0x30')][_0x5368('0x38')](_0x5368('0x39'))){_0x18d954[_0x5368('0x1e')]=qs[_0x5368('0x1e')](_0x44ac24[_0x5368('0x30')]['limit']);_0x18d954[_0x5368('0x1b')]=qs['offset'](_0x44ac24[_0x5368('0x30')][_0x5368('0x1b')]);}_0x18d954[_0x5368('0x3a')]=qs[_0x5368('0x3b')](_0x44ac24[_0x5368('0x30')][_0x5368('0x3b')]);_0x18d954['where']=qs['filters'](_[_0x5368('0x3c')](_0x44ac24[_0x5368('0x30')],_0x5b429c[_0x5368('0x32')]),_0xd91acd);if(_0x44ac24[_0x5368('0x30')][_0x5368('0x3d')]){_0x18d954[_0x5368('0x3e')]=_['merge'](_0x18d954[_0x5368('0x3e')],{'$or':_['map'](_0xd91acd,function(_0x4a4628){if(_0x4a4628[_0x5368('0x2e')]!=='VIRTUAL'){var _0x112301={};_0x112301[_0x4a4628[_0x5368('0x27')]]={'$like':'%'+_0x44ac24[_0x5368('0x30')]['filter']+'%'};return _0x112301;}})});}_0x18d954=_[_0x5368('0x3f')]({},_0x18d954,_0x44ac24['options']);var _0x462eb0={'where':_0x18d954['where']};return db[_0x5368('0x2b')][_0x5368('0x1d')](_0x462eb0)['then'](function(_0x55d455){_0x33f806[_0x5368('0x1d')]=_0x55d455;if(_0x44ac24[_0x5368('0x30')][_0x5368('0x40')]){_0x18d954['include']=[{'all':!![]}];}return db['DeskAccount'][_0x5368('0x41')](_0x18d954);})[_0x5368('0x24')](function(_0x3d5c88){_0x33f806[_0x5368('0x42')]=_0x3d5c88;return _0x33f806;})['then'](respondWithFilteredResult(_0x5a1f61,_0x18d954))[_0x5368('0x43')](handleError(_0x5a1f61,null));};exports[_0x5368('0x44')]=function(_0x4b7942,_0x2a5e9e){var _0x8604ee={'raw':![],'where':{'id':_0x4b7942[_0x5368('0x45')]['id']}},_0x5a0cc={};_0x5a0cc[_0x5368('0x34')]=_[_0x5368('0x31')](db[_0x5368('0x2b')][_0x5368('0x2c')]);_0x5a0cc[_0x5368('0x30')]=_[_0x5368('0x31')](_0x4b7942[_0x5368('0x30')]);_0x5a0cc[_0x5368('0x32')]=_[_0x5368('0x33')](_0x5a0cc[_0x5368('0x34')],_0x5a0cc[_0x5368('0x30')]);_0x8604ee[_0x5368('0x36')]=_[_0x5368('0x33')](_0x5a0cc['model'],qs[_0x5368('0x35')](_0x4b7942[_0x5368('0x30')][_0x5368('0x35')]));_0x8604ee[_0x5368('0x36')]=_0x8604ee[_0x5368('0x36')][_0x5368('0x37')]?_0x8604ee[_0x5368('0x36')]:_0x5a0cc[_0x5368('0x34')];if(_0x4b7942[_0x5368('0x30')]['includeAll']){_0x8604ee['include']=[{'all':!![]}];}_0x8604ee=_[_0x5368('0x3f')]({},_0x8604ee,_0x4b7942[_0x5368('0x46')]);return db[_0x5368('0x2b')]['find'](_0x8604ee)[_0x5368('0x24')](handleEntityNotFound(_0x2a5e9e,null))[_0x5368('0x24')](respondWithResult(_0x2a5e9e,null))[_0x5368('0x43')](handleError(_0x2a5e9e,null));};exports['create']=function(_0x3c9806,_0x5bbbd2){return db[_0x5368('0x2b')]['create'](_0x3c9806[_0x5368('0x47')],{})[_0x5368('0x24')](respondWithResult(_0x5bbbd2,0xc9))[_0x5368('0x43')](handleError(_0x5bbbd2,null));};exports[_0x5368('0x22')]=function(_0x3028a9,_0x2a5bd0){if(_0x3028a9[_0x5368('0x47')]['id']){delete _0x3028a9[_0x5368('0x47')]['id'];}return db[_0x5368('0x2b')][_0x5368('0x48')]({'where':{'id':_0x3028a9['params']['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x2a5bd0,null))[_0x5368('0x24')](saveUpdates(_0x3028a9[_0x5368('0x47')],null))[_0x5368('0x24')](respondWithResult(_0x2a5bd0,null))[_0x5368('0x43')](handleError(_0x2a5bd0,null));};exports[_0x5368('0x23')]=function(_0xb92fcb,_0x591326){return db[_0x5368('0x2b')][_0x5368('0x48')]({'where':{'id':_0xb92fcb[_0x5368('0x45')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x591326,null))[_0x5368('0x24')](removeEntity(_0x591326,null))[_0x5368('0x43')](handleError(_0x591326,null));};exports[_0x5368('0x49')]=function(_0x470f04,_0x4a7fbf,_0x1c2a8a){var _0x3d848b={};var _0x370779={};var _0x52a903;var _0x11bca3;return db[_0x5368('0x2b')][_0x5368('0x4a')]({'where':{'id':_0x470f04[_0x5368('0x45')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x4a7fbf,null))['then'](function(_0x227be8){if(_0x227be8){_0x52a903=_0x227be8;_0x370779['model']=_[_0x5368('0x31')](db['DeskConfiguration']['rawAttributes']);_0x370779['query']=_['keys'](_0x470f04[_0x5368('0x30')]);_0x370779['filters']=_[_0x5368('0x33')](_0x370779['model'],_0x370779[_0x5368('0x30')]);_0x3d848b['attributes']=_[_0x5368('0x33')](_0x370779[_0x5368('0x34')],qs['fields'](_0x470f04[_0x5368('0x30')]['fields']));_0x3d848b[_0x5368('0x36')]=_0x3d848b[_0x5368('0x36')]['length']?_0x3d848b[_0x5368('0x36')]:_0x370779[_0x5368('0x34')];_0x3d848b['order']=qs[_0x5368('0x3b')](_0x470f04[_0x5368('0x30')][_0x5368('0x3b')]);_0x3d848b[_0x5368('0x3e')]=qs[_0x5368('0x32')](_['pick'](_0x470f04['query'],_0x370779['filters']));if(_0x470f04['query'][_0x5368('0x3d')]){_0x3d848b['where']=_[_0x5368('0x3f')](_0x3d848b[_0x5368('0x3e')],{'$or':_[_0x5368('0x2a')](_0x3d848b['attributes'],function(_0x198f38){var _0xc639f5={};_0xc639f5[_0x198f38]={'$like':'%'+_0x470f04[_0x5368('0x30')]['filter']+'%'};return _0xc639f5;})});}_0x3d848b=_[_0x5368('0x3f')]({},_0x3d848b,_0x470f04[_0x5368('0x46')]);return _0x52a903[_0x5368('0x49')](_0x3d848b);}})['then'](function(_0x3ae69c){if(_0x3ae69c){_0x11bca3=_0x3ae69c['length'];if(!_0x470f04['query']['hasOwnProperty']('nolimit')){_0x3d848b[_0x5368('0x1e')]=qs[_0x5368('0x1e')](_0x470f04[_0x5368('0x30')]['limit']);_0x3d848b[_0x5368('0x1b')]=qs['offset'](_0x470f04[_0x5368('0x30')][_0x5368('0x1b')]);}return _0x52a903[_0x5368('0x49')](_0x3d848b);}})[_0x5368('0x24')](function(_0x3f0a56){if(_0x3f0a56){return _0x3f0a56?{'count':_0x11bca3,'rows':_0x3f0a56}:null;}})[_0x5368('0x24')](respondWithResult(_0x4a7fbf,null))[_0x5368('0x43')](handleError(_0x4a7fbf,null));};exports[_0x5368('0x4b')]=function(_0x523228,_0x96040d,_0x41492e){if(_0x523228[_0x5368('0x47')]['id']){delete _0x523228[_0x5368('0x47')]['id'];}return db[_0x5368('0x2b')]['findOne']({'where':{'id':_0x523228[_0x5368('0x45')]['id']}})[_0x5368('0x24')](handleEntityNotFound(_0x96040d,null))['then'](function(_0x2302ff){if(_0x2302ff){_0x523228['body'][_0x5368('0x4c')]=_0x2302ff['id'];_0x523228[_0x5368('0x47')]['Subjects']=integrations['getSubjects'](_0x523228[_0x5368('0x47')][_0x5368('0x4d')],_0x523228[_0x5368('0x47')][_0x5368('0x2e')]);_0x523228['body'][_0x5368('0x4e')]=integrations[_0x5368('0x4f')](_0x523228[_0x5368('0x47')][_0x5368('0x4d')],_0x523228[_0x5368('0x47')][_0x5368('0x2e')]);return db[_0x5368('0x50')][_0x5368('0x51')](_0x523228[_0x5368('0x47')],{'include':[{'model':db['DeskField'],'as':_0x5368('0x52')},{'model':db[_0x5368('0x53')],'as':_0x5368('0x4e')}]});}return null;})['then'](respondWithResult(_0x96040d,null))[_0x5368('0x43')](handleError(_0x96040d,null));};exports[_0x5368('0x54')]=function(_0x3d523f,_0x3c7c42,_0x8755b1){var _0x3d172d=[{'name':'priority','label':_0x5368('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x8a6207='';return db[_0x5368('0x2b')]['findOne']({'where':{'id':_0x3d523f[_0x5368('0x45')]['id']},'attributes':['id',_0x5368('0x56'),_0x5368('0x57'),_0x5368('0x58'),_0x5368('0x59'),_0x5368('0x5a'),'consumerSecret','token','tokenSecret']})[_0x5368('0x24')](handleEntityNotFound(_0x3c7c42,null))[_0x5368('0x24')](function(_0x3dc664){if(_0x3dc664){_0x8a6207=_0x3dc664['remoteUri'];var _0x27db54=_0x8a6207[_0x5368('0x5b')](-0x1);if(_0x27db54==='/'){_0x8a6207=_0x8a6207[_0x5368('0x5c')](0x0,_0x8a6207['lastIndexOf'](_0x27db54));}var _0x430f7a={'method':_0x5368('0x5d'),'uri':util[_0x5368('0x5e')](_0x5368('0x5f'),_0x8a6207),'headers':{'Content-Type':_0x5368('0x60'),'Accept':_0x5368('0x60')},'json':!![]};if(_0x3dc664[_0x5368('0x57')]==='basic'){_0x430f7a[_0x5368('0x61')][_0x5368('0x62')]=util[_0x5368('0x5e')](_0x5368('0x63'),new Buffer(util[_0x5368('0x5e')]('%s:%s',_0x3dc664[_0x5368('0x58')],_0x3dc664[_0x5368('0x59')]))['toString'](_0x5368('0x64')));}return rp(_0x430f7a)[_0x5368('0x24')](function(_0x26eae8){return _0x3d172d['concat'](_['map'](_0x26eae8['_embedded'][_0x5368('0x65')],function(_0x529698){return{'id':_0x529698[_0x5368('0x27')],'name':_0x529698['name'],'type':_0x529698['type'],'active':_0x529698[_0x5368('0x66')],'label':_0x529698[_0x5368('0x67')],'custom':!![]};}));});}})[_0x5368('0x24')](function(_0xabc969){return{'count':_0xabc969[_0x5368('0x37')],'rows':_0xabc969};})[_0x5368('0x24')](respondWithResult(_0x3c7c42,null))[_0x5368('0x43')](function(_0x5aafc5){var _0x5e7d8b=_0x3d523f['query'][_0x5368('0x68')]?0x1f4:_0x5aafc5[_0x5368('0x69')]||0x1f4;logger['error'](_0x5368('0x6a'),'getFields',_0x5e7d8b,JSON[_0x5368('0x6b')](_0x5aafc5));delete _0x5aafc5[_0x5368('0x27')];if(_0x5e7d8b===0x191){_0x5e7d8b=0x190;}_0x3c7c42[_0x5368('0x19')](_0x5e7d8b)[_0x5368('0x28')](_0x3d523f[_0x5368('0x30')][_0x5368('0x68')]?{'message':'Wrong\x20credentials','statusCode':_0x5aafc5[_0x5368('0x69')]}:_0x5aafc5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3f3ee15..cd4accf 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 _0x84b2=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','moment','bluebird','path'];(function(_0x46f047,_0x23a936){var _0x352bef=function(_0x99c3cb){while(--_0x99c3cb){_0x46f047['push'](_0x46f047['shift']());}};_0x352bef(++_0x23a936);}(_0x84b2,0x1e9));var _0x284b=function(_0x1188af,_0x5bc9bb){_0x1188af=_0x1188af-0x0;var _0x707c42=_0x84b2[_0x1188af];return _0x707c42;};'use strict';var _=require('lodash');var util=require(_0x284b('0x0'));var logger=require(_0x284b('0x1'))('api');var moment=require(_0x284b('0x2'));var BPromise=require(_0x284b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x284b('0x4'));var rimraf=require(_0x284b('0x5'));var config=require(_0x284b('0x6'));var attributes=require(_0x284b('0x7'));var integrations=require(_0x284b('0x8'));module[_0x284b('0x9')]=function(_0x417c38,_0x4a60f6){return _0x417c38[_0x284b('0xa')](_0x284b('0xb'),attributes,{'tableName':_0x284b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d4=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1594dc,_0x123f4e){var _0x54c60a=function(_0x3a8337){while(--_0x3a8337){_0x1594dc['push'](_0x1594dc['shift']());}};_0x54c60a(++_0x123f4e);}(_0xd6d4,0x13d));var _0x4d6d=function(_0x38489f,_0x5c01cb){_0x38489f=_0x38489f-0x0;var _0x2b6ec9=_0xd6d4[_0x38489f];return _0x2b6ec9;};'use strict';var _=require(_0x4d6d('0x0'));var util=require(_0x4d6d('0x1'));var logger=require(_0x4d6d('0x2'))('api');var moment=require(_0x4d6d('0x3'));var BPromise=require(_0x4d6d('0x4'));var rp=require(_0x4d6d('0x5'));var fs=require('fs');var path=require(_0x4d6d('0x6'));var rimraf=require(_0x4d6d('0x7'));var config=require(_0x4d6d('0x8'));var attributes=require(_0x4d6d('0x9'));var integrations=require(_0x4d6d('0xa'));module['exports']=function(_0x58a683,_0xeec1c4){return _0x58a683[_0x4d6d('0xb')]('DeskAccount',attributes,{'tableName':_0x4d6d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 18f73b2..71662f1 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 _0x05c2=['error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','map','model','ShowDeskAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x19fde7,_0x2def5e){var _0x5a1c36=function(_0x5a5b6c){while(--_0x5a5b6c){_0x19fde7['push'](_0x19fde7['shift']());}};_0x5a1c36(++_0x2def5e);}(_0x05c2,0x165));var _0x205c=function(_0x2e1322,_0x5a1a78){_0x2e1322=_0x2e1322-0x0;var _0x21a2ae=_0x05c2[_0x2e1322];return _0x21a2ae;};'use strict';var _=require(_0x205c('0x0'));var util=require('util');var moment=require(_0x205c('0x1'));var BPromise=require(_0x205c('0x2'));var rs=require(_0x205c('0x3'));var fs=require('fs');var Redis=require(_0x205c('0x4'));var db=require(_0x205c('0x5'))['db'];var utils=require(_0x205c('0x6'));var logger=require('../../config/logger')(_0x205c('0x7'));var config=require('../../config/environment');var jayson=require(_0x205c('0x8'));var client=jayson[_0x205c('0x9')][_0x205c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c7ef6,_0x5a4cdc,_0x30c5b9){return new BPromise(function(_0x148543,_0x5f0114){return client['request'](_0x5c7ef6,_0x30c5b9)[_0x205c('0xb')](function(_0x25103b){logger[_0x205c('0xc')](_0x205c('0xd'),_0x5a4cdc,_0x205c('0xe'));logger[_0x205c('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5a4cdc,_0x205c('0xe'),JSON[_0x205c('0x10')](_0x25103b));if(_0x25103b[_0x205c('0x11')]){if(_0x25103b[_0x205c('0x11')][_0x205c('0x12')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x5a4cdc,_0x25103b[_0x205c('0x11')][_0x205c('0x13')]);return _0x5f0114(_0x25103b[_0x205c('0x11')][_0x205c('0x13')]);}logger[_0x205c('0x11')](_0x205c('0xd'),_0x5a4cdc,_0x25103b[_0x205c('0x11')][_0x205c('0x13')]);return _0x148543(_0x25103b[_0x205c('0x11')][_0x205c('0x13')]);}else{logger['info'](_0x205c('0xd'),_0x5a4cdc,'request\x20sent');_0x148543(_0x25103b[_0x205c('0x14')][_0x205c('0x13')]);}})[_0x205c('0x15')](function(_0x45e6da){logger['error'](_0x205c('0xd'),_0x5a4cdc,_0x45e6da);_0x5f0114(_0x45e6da);});});}exports[_0x205c('0x16')]=function(_0x1f61e3){var _0x46460f=this;return new Promise(function(_0x1af1e2,_0x3e29b7){return db[_0x205c('0x17')][_0x205c('0x18')]({'raw':_0x1f61e3[_0x205c('0x19')]?_0x1f61e3[_0x205c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f61e3[_0x205c('0x19')]?_0x1f61e3[_0x205c('0x19')]['where']||null:null,'attributes':_0x1f61e3['options']?_0x1f61e3['options'][_0x205c('0x1a')]||null:null,'limit':_0x1f61e3['options']?_0x1f61e3[_0x205c('0x19')][_0x205c('0x1b')]||null:null,'include':_0x1f61e3['options']?_0x1f61e3[_0x205c('0x19')][_0x205c('0x1c')]?_[_0x205c('0x1d')](_0x1f61e3[_0x205c('0x19')][_0x205c('0x1c')],function(_0x5a15f7){return{'model':db[_0x5a15f7['model']],'as':_0x5a15f7['as'],'attributes':_0x5a15f7[_0x205c('0x1a')],'include':_0x5a15f7[_0x205c('0x1c')]?_[_0x205c('0x1d')](_0x5a15f7[_0x205c('0x1c')],function(_0x354835){return{'model':db[_0x354835[_0x205c('0x1e')]],'as':_0x354835['as'],'attributes':_0x354835[_0x205c('0x1a')],'include':_0x354835[_0x205c('0x1c')]?_[_0x205c('0x1d')](_0x354835[_0x205c('0x1c')],function(_0x5ac1d6){return{'model':db[_0x5ac1d6[_0x205c('0x1e')]],'as':_0x5ac1d6['as'],'attributes':_0x5ac1d6[_0x205c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x205c('0xb')](function(_0x5b12eb){logger[_0x205c('0xc')](_0x205c('0x16'),_0x1f61e3);logger['debug'](_0x205c('0x16'),_0x1f61e3,JSON[_0x205c('0x10')](_0x5b12eb));_0x1af1e2(_0x5b12eb);})[_0x205c('0x15')](function(_0x3e70db){logger['error'](_0x205c('0x16'),_0x3e70db[_0x205c('0x13')],_0x1f61e3);_0x3e29b7(_0x46460f[_0x205c('0x11')](0x1f4,_0x3e70db[_0x205c('0x13')]));});});};exports[_0x205c('0x1f')]=function(_0x45afdc){var _0x403f7e=this;return new Promise(function(_0x3036a7,_0xe4dbd6){return db[_0x205c('0x17')][_0x205c('0x20')]({'raw':_0x45afdc['options']?_0x45afdc[_0x205c('0x19')][_0x205c('0x21')]===undefined?!![]:![]:!![],'where':_0x45afdc[_0x205c('0x19')]?_0x45afdc[_0x205c('0x19')]['where']||null:null,'attributes':_0x45afdc['options']?_0x45afdc[_0x205c('0x19')][_0x205c('0x1a')]||null:null,'include':_0x45afdc[_0x205c('0x19')]?_0x45afdc[_0x205c('0x19')][_0x205c('0x1c')]?_['map'](_0x45afdc[_0x205c('0x19')]['include'],function(_0x174974){return{'model':db[_0x174974[_0x205c('0x1e')]],'as':_0x174974['as'],'attributes':_0x174974[_0x205c('0x1a')],'include':_0x174974[_0x205c('0x1c')]?_[_0x205c('0x1d')](_0x174974[_0x205c('0x1c')],function(_0x40bdf0){return{'model':db[_0x40bdf0['model']],'as':_0x40bdf0['as'],'attributes':_0x40bdf0[_0x205c('0x1a')],'include':_0x40bdf0[_0x205c('0x1c')]?_[_0x205c('0x1d')](_0x40bdf0[_0x205c('0x1c')],function(_0x218184){return{'model':db[_0x218184[_0x205c('0x1e')]],'as':_0x218184['as'],'attributes':_0x218184[_0x205c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x553b45){logger[_0x205c('0xc')](_0x205c('0x1f'),_0x45afdc);logger[_0x205c('0xf')](_0x205c('0x1f'),_0x45afdc,JSON[_0x205c('0x10')](_0x553b45));_0x3036a7(_0x553b45);})[_0x205c('0x15')](function(_0x5f03f4){logger[_0x205c('0x11')](_0x205c('0x1f'),_0x5f03f4[_0x205c('0x13')],_0x45afdc);_0xe4dbd6(_0x403f7e['error'](0x1f4,_0x5f03f4[_0x205c('0x13')]));});});}; \ No newline at end of file +var _0xa599=['DeskAccount','findAll','options','where','include','map','model','attributes','then','ShowDeskAccount','find','raw','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDeskAccount'];(function(_0x47e89c,_0x12649b){var _0x8793bd=function(_0x5b76d0){while(--_0x5b76d0){_0x47e89c['push'](_0x47e89c['shift']());}};_0x8793bd(++_0x12649b);}(_0xa599,0x1b9));var _0x9a59=function(_0x55b271,_0x5aea31){_0x55b271=_0x55b271-0x0;var _0xaef09=_0xa599[_0x55b271];return _0xaef09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a59('0x0'));var BPromise=require(_0x9a59('0x1'));var rs=require(_0x9a59('0x2'));var fs=require('fs');var Redis=require(_0x9a59('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a59('0x4'));var logger=require(_0x9a59('0x5'))(_0x9a59('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a59('0x7'));var client=jayson[_0x9a59('0x8')][_0x9a59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fe915,_0x4ad283,_0x246321){return new BPromise(function(_0x2de812,_0x355f18){return client[_0x9a59('0xa')](_0x2fe915,_0x246321)['then'](function(_0x165632){logger[_0x9a59('0xb')](_0x9a59('0xc'),_0x4ad283,_0x9a59('0xd'));logger[_0x9a59('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4ad283,_0x9a59('0xd'),JSON[_0x9a59('0xf')](_0x165632));if(_0x165632[_0x9a59('0x10')]){if(_0x165632['error']['code']===0x1f4){logger[_0x9a59('0x10')]('DeskAccount,\x20%s,\x20%s',_0x4ad283,_0x165632[_0x9a59('0x10')][_0x9a59('0x11')]);return _0x355f18(_0x165632[_0x9a59('0x10')][_0x9a59('0x11')]);}logger[_0x9a59('0x10')]('DeskAccount,\x20%s,\x20%s',_0x4ad283,_0x165632[_0x9a59('0x10')][_0x9a59('0x11')]);return _0x2de812(_0x165632[_0x9a59('0x10')][_0x9a59('0x11')]);}else{logger['info'](_0x9a59('0xc'),_0x4ad283,_0x9a59('0xd'));_0x2de812(_0x165632[_0x9a59('0x12')][_0x9a59('0x11')]);}})[_0x9a59('0x13')](function(_0x2051c3){logger[_0x9a59('0x10')](_0x9a59('0xc'),_0x4ad283,_0x2051c3);_0x355f18(_0x2051c3);});});}exports[_0x9a59('0x14')]=function(_0x4356f9){var _0x5ae10b=this;return new Promise(function(_0x2733d4,_0x822dfe){return db[_0x9a59('0x15')][_0x9a59('0x16')]({'raw':_0x4356f9['options']?_0x4356f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4356f9['options']?_0x4356f9[_0x9a59('0x17')][_0x9a59('0x18')]||null:null,'attributes':_0x4356f9['options']?_0x4356f9[_0x9a59('0x17')]['attributes']||null:null,'limit':_0x4356f9['options']?_0x4356f9[_0x9a59('0x17')]['limit']||null:null,'include':_0x4356f9[_0x9a59('0x17')]?_0x4356f9['options'][_0x9a59('0x19')]?_[_0x9a59('0x1a')](_0x4356f9[_0x9a59('0x17')]['include'],function(_0x1bf0d7){return{'model':db[_0x1bf0d7[_0x9a59('0x1b')]],'as':_0x1bf0d7['as'],'attributes':_0x1bf0d7[_0x9a59('0x1c')],'include':_0x1bf0d7['include']?_[_0x9a59('0x1a')](_0x1bf0d7['include'],function(_0x2c8a0e){return{'model':db[_0x2c8a0e['model']],'as':_0x2c8a0e['as'],'attributes':_0x2c8a0e['attributes'],'include':_0x2c8a0e[_0x9a59('0x19')]?_[_0x9a59('0x1a')](_0x2c8a0e[_0x9a59('0x19')],function(_0x12857f){return{'model':db[_0x12857f['model']],'as':_0x12857f['as'],'attributes':_0x12857f[_0x9a59('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9a59('0x1d')](function(_0x2e278d){logger[_0x9a59('0xb')](_0x9a59('0x14'),_0x4356f9);logger['debug'](_0x9a59('0x14'),_0x4356f9,JSON[_0x9a59('0xf')](_0x2e278d));_0x2733d4(_0x2e278d);})[_0x9a59('0x13')](function(_0x585d17){logger[_0x9a59('0x10')](_0x9a59('0x14'),_0x585d17['message'],_0x4356f9);_0x822dfe(_0x5ae10b[_0x9a59('0x10')](0x1f4,_0x585d17[_0x9a59('0x11')]));});});};exports[_0x9a59('0x1e')]=function(_0x30d9ba){var _0x501ef7=this;return new Promise(function(_0x3e6d1a,_0x1278b5){return db[_0x9a59('0x15')][_0x9a59('0x1f')]({'raw':_0x30d9ba['options']?_0x30d9ba[_0x9a59('0x17')][_0x9a59('0x20')]===undefined?!![]:![]:!![],'where':_0x30d9ba[_0x9a59('0x17')]?_0x30d9ba[_0x9a59('0x17')][_0x9a59('0x18')]||null:null,'attributes':_0x30d9ba[_0x9a59('0x17')]?_0x30d9ba[_0x9a59('0x17')][_0x9a59('0x1c')]||null:null,'include':_0x30d9ba[_0x9a59('0x17')]?_0x30d9ba[_0x9a59('0x17')][_0x9a59('0x19')]?_[_0x9a59('0x1a')](_0x30d9ba['options']['include'],function(_0x2b0391){return{'model':db[_0x2b0391[_0x9a59('0x1b')]],'as':_0x2b0391['as'],'attributes':_0x2b0391[_0x9a59('0x1c')],'include':_0x2b0391[_0x9a59('0x19')]?_['map'](_0x2b0391[_0x9a59('0x19')],function(_0x23c8f6){return{'model':db[_0x23c8f6[_0x9a59('0x1b')]],'as':_0x23c8f6['as'],'attributes':_0x23c8f6[_0x9a59('0x1c')],'include':_0x23c8f6[_0x9a59('0x19')]?_[_0x9a59('0x1a')](_0x23c8f6[_0x9a59('0x19')],function(_0x464437){return{'model':db[_0x464437['model']],'as':_0x464437['as'],'attributes':_0x464437['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a59('0x1d')](function(_0x40bbbe){logger[_0x9a59('0xb')](_0x9a59('0x1e'),_0x30d9ba);logger['debug']('ShowDeskAccount',_0x30d9ba,JSON['stringify'](_0x40bbbe));_0x3e6d1a(_0x40bbbe);})[_0x9a59('0x13')](function(_0x31c7f4){logger[_0x9a59('0x10')](_0x9a59('0x1e'),_0x31c7f4[_0x9a59('0x11')],_0x30d9ba);_0x1278b5(_0x501ef7[_0x9a59('0x10')](0x1f4,_0x31c7f4[_0x9a59('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index dc44d2d..9c59cd5 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1999fd,_0x362f26){var _0x27eb08=function(_0xd7d05e){while(--_0xd7d05e){_0x1999fd['push'](_0x1999fd['shift']());}};_0x27eb08(++_0x362f26);}(_0xedd9,0xfc));var _0x9edd=function(_0x50c00a,_0x2afdb8){_0x50c00a=_0x50c00a-0x0;var _0x37e299=_0xedd9[_0x50c00a];return _0x37e299;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5988ac,_0x12e1cf){var _0x5c13e9=function(_0x53dd8a){while(--_0x53dd8a){_0x5988ac['push'](_0x5988ac['shift']());}};_0x5c13e9(++_0x12e1cf);}(_0x34e8,0x12c));var _0x834e=function(_0x96fea,_0x5a9b67){_0x96fea=_0x96fea-0x0;var _0x32d206=_0x34e8[_0x96fea];return _0x32d206;};'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('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 8292e0e..4f046f5 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 _0xf498=['exports','STRING','sequelize'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0xf498,0xec));var _0x8f49=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xf498[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0x8f49('0x0'));module[_0x8f49('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8f49('0x2')]}}; \ No newline at end of file +var _0x84f9=['STRING','sequelize','exports'];(function(_0x4abe1c,_0x601c59){var _0x241a5f=function(_0x558f83){while(--_0x558f83){_0x4abe1c['push'](_0x4abe1c['shift']());}};_0x241a5f(++_0x601c59);}(_0x84f9,0x1de));var _0x984f=function(_0x4a3874,_0x58b7c9){_0x4a3874=_0x4a3874-0x0;var _0x296a51=_0x84f9[_0x4a3874];return _0x296a51;};'use strict';var Sequelize=require(_0x984f('0x0'));module[_0x984f('0x1')]={'name':{'type':Sequelize[_0x984f('0x2')]},'description':{'type':Sequelize[_0x984f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e2b9b36..bdf9f6f 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 _0xa20a=['DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','length','options','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0xa20a,0xd2));var _0xaa20=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa20a[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0xaa20('0x0'));var rimraf=require(_0xaa20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa20('0x2'));var rp=require(_0xaa20('0x3'));var moment=require(_0xaa20('0x4'));var BPromise=require(_0xaa20('0x5'));var Mustache=require(_0xaa20('0x6'));var util=require(_0xaa20('0x7'));var path=require(_0xaa20('0x8'));var sox=require(_0xaa20('0x9'));var csv=require(_0xaa20('0xa'));var ejs=require(_0xaa20('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa20('0xc'));var squel=require(_0xaa20('0xd'));var crypto=require(_0xaa20('0xe'));var jsforce=require(_0xaa20('0xf'));var deskjs=require(_0xaa20('0x10'));var toCsv=require(_0xaa20('0xa'));var querystring=require(_0xaa20('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa20('0x12'));var qs=require(_0xaa20('0x13'));var as=require(_0xaa20('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa20('0x15'))(_0xaa20('0x16'));var utils=require(_0xaa20('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaa20('0x18'));var db=require(_0xaa20('0x19'))['db'];function respondWithStatusCode(_0x3038ed,_0x5c3ecd){_0x5c3ecd=_0x5c3ecd||0xcc;return function(_0x49490a){if(_0x49490a){return _0x3038ed['sendStatus'](_0x5c3ecd);}return _0x3038ed[_0xaa20('0x1a')](_0x5c3ecd)['end']();};}function respondWithResult(_0x5bc3e5,_0x18bae6){_0x18bae6=_0x18bae6||0xc8;return function(_0x869ed6){if(_0x869ed6){return _0x5bc3e5[_0xaa20('0x1a')](_0x18bae6)['json'](_0x869ed6);}};}function respondWithFilteredResult(_0x58a669,_0x4d34e9){return function(_0x45a170){if(_0x45a170){var _0x2e8664=typeof _0x4d34e9[_0xaa20('0x1b')]===_0xaa20('0x1c')&&typeof _0x4d34e9[_0xaa20('0x1d')]==='undefined';var _0x1839f6=_0x45a170[_0xaa20('0x1e')];var _0x44fa89=_0x2e8664?0x0:_0x4d34e9[_0xaa20('0x1b')];var _0xb1d92a=_0x2e8664?_0x45a170['count']:_0x4d34e9[_0xaa20('0x1b')]+_0x4d34e9[_0xaa20('0x1d')];var _0x183627;if(_0xb1d92a>=_0x1839f6){_0xb1d92a=_0x1839f6;_0x183627=0xc8;}else{_0x183627=0xce;}_0x58a669[_0xaa20('0x1a')](_0x183627);return _0x58a669[_0xaa20('0x1f')]('Content-Range',_0x44fa89+'-'+_0xb1d92a+'/'+_0x1839f6)[_0xaa20('0x20')](_0x45a170);}return null;};}function patchUpdates(_0x4b68da){return function(_0x591474){try{jsonpatch[_0xaa20('0x21')](_0x591474,_0x4b68da,!![]);}catch(_0x2f4cb3){return BPromise['reject'](_0x2f4cb3);}return _0x591474[_0xaa20('0x22')]();};}function saveUpdates(_0x3409f4,_0x3ddbeb){return function(_0x284eea){if(_0x284eea){return _0x284eea[_0xaa20('0x23')](_0x3409f4)[_0xaa20('0x24')](function(_0x12d4b4){return _0x12d4b4;});}return null;};}function removeEntity(_0x3fce45,_0x1c5259){return function(_0x39f0d6){if(_0x39f0d6){return _0x39f0d6[_0xaa20('0x25')]()[_0xaa20('0x24')](function(){_0x3fce45[_0xaa20('0x1a')](0xcc)[_0xaa20('0x26')]();});}};}function handleEntityNotFound(_0x256d3d,_0x4a4fc4){return function(_0x4ca92f){if(!_0x4ca92f){_0x256d3d[_0xaa20('0x27')](0x194);}return _0x4ca92f;};}function handleError(_0xad17c1,_0x3b8aa6){_0x3b8aa6=_0x3b8aa6||0x1f4;return function(_0x1dd2d0){logger[_0xaa20('0x28')](_0x1dd2d0[_0xaa20('0x29')]);if(_0x1dd2d0[_0xaa20('0x2a')]){delete _0x1dd2d0['name'];}_0xad17c1[_0xaa20('0x1a')](_0x3b8aa6)[_0xaa20('0x2b')](_0x1dd2d0);};}exports['index']=function(_0x5b2142,_0x1af172){var _0x1e66f8={},_0x20cbaa={},_0x3dee91={'count':0x0,'rows':[]};var _0x4eb5a5=_[_0xaa20('0x2c')](db[_0xaa20('0x2d')][_0xaa20('0x2e')],function(_0x1d5154){return{'name':_0x1d5154[_0xaa20('0x2f')],'type':_0x1d5154[_0xaa20('0x30')]['key']};});_0x20cbaa[_0xaa20('0x31')]=_['map'](_0x4eb5a5,'name');_0x20cbaa[_0xaa20('0x32')]=_[_0xaa20('0x33')](_0x5b2142[_0xaa20('0x32')]);_0x20cbaa[_0xaa20('0x34')]=_[_0xaa20('0x35')](_0x20cbaa[_0xaa20('0x31')],_0x20cbaa[_0xaa20('0x32')]);_0x1e66f8[_0xaa20('0x36')]=_[_0xaa20('0x35')](_0x20cbaa[_0xaa20('0x31')],qs[_0xaa20('0x37')](_0x5b2142[_0xaa20('0x32')][_0xaa20('0x37')]));_0x1e66f8[_0xaa20('0x36')]=_0x1e66f8['attributes']['length']?_0x1e66f8[_0xaa20('0x36')]:_0x20cbaa[_0xaa20('0x31')];if(!_0x5b2142['query'][_0xaa20('0x38')](_0xaa20('0x39'))){_0x1e66f8[_0xaa20('0x1d')]=qs[_0xaa20('0x1d')](_0x5b2142['query'][_0xaa20('0x1d')]);_0x1e66f8[_0xaa20('0x1b')]=qs[_0xaa20('0x1b')](_0x5b2142[_0xaa20('0x32')][_0xaa20('0x1b')]);}_0x1e66f8[_0xaa20('0x3a')]=qs[_0xaa20('0x3b')](_0x5b2142[_0xaa20('0x32')]['sort']);_0x1e66f8[_0xaa20('0x3c')]=qs[_0xaa20('0x34')](_[_0xaa20('0x3d')](_0x5b2142[_0xaa20('0x32')],_0x20cbaa['filters']),_0x4eb5a5);if(_0x5b2142['query'][_0xaa20('0x3e')]){_0x1e66f8[_0xaa20('0x3c')]=_[_0xaa20('0x3f')](_0x1e66f8[_0xaa20('0x3c')],{'$or':_['map'](_0x4eb5a5,function(_0x52f011){if(_0x52f011[_0xaa20('0x30')]!==_0xaa20('0x40')){var _0x21c1bf={};_0x21c1bf[_0x52f011['name']]={'$like':'%'+_0x5b2142[_0xaa20('0x32')][_0xaa20('0x3e')]+'%'};return _0x21c1bf;}})});}_0x1e66f8=_[_0xaa20('0x3f')]({},_0x1e66f8,_0x5b2142['options']);var _0x459f51={'where':_0x1e66f8['where']};return db['DeskConfiguration'][_0xaa20('0x1e')](_0x459f51)[_0xaa20('0x24')](function(_0x157fb){_0x3dee91[_0xaa20('0x1e')]=_0x157fb;if(_0x5b2142[_0xaa20('0x32')][_0xaa20('0x41')]){_0x1e66f8[_0xaa20('0x42')]=[{'all':!![]}];}return db[_0xaa20('0x2d')][_0xaa20('0x43')](_0x1e66f8);})['then'](function(_0x187144){_0x3dee91[_0xaa20('0x44')]=_0x187144;return _0x3dee91;})[_0xaa20('0x24')](respondWithFilteredResult(_0x1af172,_0x1e66f8))[_0xaa20('0x45')](handleError(_0x1af172,null));};exports[_0xaa20('0x46')]=function(_0x17abe3,_0x6a457b){var _0x458b39={'raw':![],'where':{'id':_0x17abe3[_0xaa20('0x47')]['id']}},_0x4dab64={};_0x4dab64[_0xaa20('0x31')]=_[_0xaa20('0x33')](db[_0xaa20('0x2d')][_0xaa20('0x2e')]);_0x4dab64[_0xaa20('0x32')]=_['keys'](_0x17abe3['query']);_0x4dab64[_0xaa20('0x34')]=_['intersection'](_0x4dab64[_0xaa20('0x31')],_0x4dab64[_0xaa20('0x32')]);_0x458b39[_0xaa20('0x36')]=_['intersection'](_0x4dab64[_0xaa20('0x31')],qs[_0xaa20('0x37')](_0x17abe3[_0xaa20('0x32')][_0xaa20('0x37')]));_0x458b39['attributes']=_0x458b39[_0xaa20('0x36')]['length']?_0x458b39[_0xaa20('0x36')]:_0x4dab64['model'];if(_0x17abe3[_0xaa20('0x32')][_0xaa20('0x41')]){_0x458b39[_0xaa20('0x42')]=[{'all':!![]}];}_0x458b39=_[_0xaa20('0x3f')]({},_0x458b39,_0x17abe3['options']);return db[_0xaa20('0x2d')][_0xaa20('0x48')](_0x458b39)[_0xaa20('0x24')](handleEntityNotFound(_0x6a457b,null))[_0xaa20('0x24')](respondWithResult(_0x6a457b,null))[_0xaa20('0x45')](handleError(_0x6a457b,null));};exports['create']=function(_0x4a5318,_0x490682){return db['DeskConfiguration'][_0xaa20('0x49')](_0x4a5318[_0xaa20('0x4a')],{})[_0xaa20('0x24')](respondWithResult(_0x490682,0xc9))[_0xaa20('0x45')](handleError(_0x490682,null));};exports[_0xaa20('0x23')]=function(_0x1907d1,_0x205af2){if(_0x1907d1['body']['id']){delete _0x1907d1[_0xaa20('0x4a')]['id'];}return db[_0xaa20('0x2d')]['find']({'where':{'id':_0x1907d1[_0xaa20('0x47')]['id']}})[_0xaa20('0x24')](handleEntityNotFound(_0x205af2,null))[_0xaa20('0x24')](saveUpdates(_0x1907d1[_0xaa20('0x4a')],null))['then'](respondWithResult(_0x205af2,null))[_0xaa20('0x45')](handleError(_0x205af2,null));};exports[_0xaa20('0x25')]=function(_0x1b7e5d,_0x14e8b0){return db['DeskConfiguration'][_0xaa20('0x48')]({'where':{'id':_0x1b7e5d[_0xaa20('0x47')]['id']}})[_0xaa20('0x24')](handleEntityNotFound(_0x14e8b0,null))['then'](removeEntity(_0x14e8b0,null))['catch'](handleError(_0x14e8b0,null));};exports[_0xaa20('0x4b')]=function(_0x193952,_0x165706,_0x5dc6b2){var _0x2f1fef={};var _0x214574={};var _0x59f316;var _0x471955;return db[_0xaa20('0x2d')][_0xaa20('0x4c')]({'where':{'id':_0x193952[_0xaa20('0x47')]['id']}})[_0xaa20('0x24')](handleEntityNotFound(_0x165706,null))[_0xaa20('0x24')](function(_0xa3ad0){if(_0xa3ad0){_0x59f316=_0xa3ad0;_0x214574[_0xaa20('0x31')]=_['keys'](db['DeskField'][_0xaa20('0x2e')]);_0x214574[_0xaa20('0x32')]=_['keys'](_0x193952[_0xaa20('0x32')]);_0x214574['filters']=_[_0xaa20('0x35')](_0x214574[_0xaa20('0x31')],_0x214574['query']);_0x2f1fef['attributes']=_[_0xaa20('0x35')](_0x214574[_0xaa20('0x31')],qs[_0xaa20('0x37')](_0x193952['query']['fields']));_0x2f1fef[_0xaa20('0x36')]=_0x2f1fef[_0xaa20('0x36')][_0xaa20('0x4d')]?_0x2f1fef['attributes']:_0x214574['model'];_0x2f1fef[_0xaa20('0x3a')]=qs[_0xaa20('0x3b')](_0x193952[_0xaa20('0x32')][_0xaa20('0x3b')]);_0x2f1fef[_0xaa20('0x3c')]=qs[_0xaa20('0x34')](_[_0xaa20('0x3d')](_0x193952[_0xaa20('0x32')],_0x214574[_0xaa20('0x34')]));if(_0x193952[_0xaa20('0x32')][_0xaa20('0x3e')]){_0x2f1fef[_0xaa20('0x3c')]=_[_0xaa20('0x3f')](_0x2f1fef['where'],{'$or':_[_0xaa20('0x2c')](_0x2f1fef['attributes'],function(_0x5ec9ca){var _0x58fdff={};_0x58fdff[_0x5ec9ca]={'$like':'%'+_0x193952[_0xaa20('0x32')][_0xaa20('0x3e')]+'%'};return _0x58fdff;})});}_0x2f1fef=_[_0xaa20('0x3f')]({},_0x2f1fef,_0x193952[_0xaa20('0x4e')]);return _0x59f316[_0xaa20('0x4b')](_0x2f1fef);}})[_0xaa20('0x24')](function(_0x58bd42){if(_0x58bd42){_0x471955=_0x58bd42[_0xaa20('0x4d')];if(!_0x193952[_0xaa20('0x32')][_0xaa20('0x38')](_0xaa20('0x39'))){_0x2f1fef['limit']=qs[_0xaa20('0x1d')](_0x193952[_0xaa20('0x32')][_0xaa20('0x1d')]);_0x2f1fef[_0xaa20('0x1b')]=qs['offset'](_0x193952[_0xaa20('0x32')]['offset']);}return _0x59f316[_0xaa20('0x4b')](_0x2f1fef);}})[_0xaa20('0x24')](function(_0x1f5197){if(_0x1f5197){return _0x1f5197?{'count':_0x471955,'rows':_0x1f5197}:null;}})[_0xaa20('0x24')](respondWithResult(_0x165706,null))[_0xaa20('0x45')](handleError(_0x165706,null));};exports[_0xaa20('0x4f')]=function(_0x5017ba,_0x522042,_0x18a3d8){var _0x59d857={};var _0xdfd74f={};var _0x6d7e8;var _0x147916;return db['DeskConfiguration'][_0xaa20('0x4c')]({'where':{'id':_0x5017ba['params']['id']}})['then'](handleEntityNotFound(_0x522042,null))[_0xaa20('0x24')](function(_0x11fb88){if(_0x11fb88){_0x6d7e8=_0x11fb88;_0xdfd74f[_0xaa20('0x31')]=_[_0xaa20('0x33')](db['DeskField'][_0xaa20('0x2e')]);_0xdfd74f[_0xaa20('0x32')]=_[_0xaa20('0x33')](_0x5017ba['query']);_0xdfd74f[_0xaa20('0x34')]=_[_0xaa20('0x35')](_0xdfd74f[_0xaa20('0x31')],_0xdfd74f[_0xaa20('0x32')]);_0x59d857['attributes']=_[_0xaa20('0x35')](_0xdfd74f[_0xaa20('0x31')],qs[_0xaa20('0x37')](_0x5017ba['query'][_0xaa20('0x37')]));_0x59d857[_0xaa20('0x36')]=_0x59d857[_0xaa20('0x36')][_0xaa20('0x4d')]?_0x59d857[_0xaa20('0x36')]:_0xdfd74f[_0xaa20('0x31')];_0x59d857[_0xaa20('0x3a')]=qs[_0xaa20('0x3b')](_0x5017ba[_0xaa20('0x32')][_0xaa20('0x3b')]);_0x59d857['where']=qs[_0xaa20('0x34')](_[_0xaa20('0x3d')](_0x5017ba[_0xaa20('0x32')],_0xdfd74f[_0xaa20('0x34')]));if(_0x5017ba[_0xaa20('0x32')][_0xaa20('0x3e')]){_0x59d857[_0xaa20('0x3c')]=_[_0xaa20('0x3f')](_0x59d857[_0xaa20('0x3c')],{'$or':_[_0xaa20('0x2c')](_0x59d857[_0xaa20('0x36')],function(_0x33bec1){var _0x16816b={};_0x16816b[_0x33bec1]={'$like':'%'+_0x5017ba[_0xaa20('0x32')][_0xaa20('0x3e')]+'%'};return _0x16816b;})});}_0x59d857=_[_0xaa20('0x3f')]({},_0x59d857,_0x5017ba[_0xaa20('0x4e')]);return _0x6d7e8['getSubjects'](_0x59d857);}})[_0xaa20('0x24')](function(_0x4ef9b6){if(_0x4ef9b6){_0x147916=_0x4ef9b6[_0xaa20('0x4d')];if(!_0x5017ba[_0xaa20('0x32')][_0xaa20('0x38')](_0xaa20('0x39'))){_0x59d857[_0xaa20('0x1d')]=qs[_0xaa20('0x1d')](_0x5017ba[_0xaa20('0x32')]['limit']);_0x59d857[_0xaa20('0x1b')]=qs[_0xaa20('0x1b')](_0x5017ba['query'][_0xaa20('0x1b')]);}return _0x6d7e8['getSubjects'](_0x59d857);}})[_0xaa20('0x24')](function(_0x1ec2e1){if(_0x1ec2e1){return _0x1ec2e1?{'count':_0x147916,'rows':_0x1ec2e1}:null;}})[_0xaa20('0x24')](respondWithResult(_0x522042,null))[_0xaa20('0x45')](handleError(_0x522042,null));};exports['getDescriptions']=function(_0x3ea7c7,_0x49a3f8,_0x1ba520){var _0x9c1620={};var _0x23be3a={};var _0x231643;var _0x5aed99;return db[_0xaa20('0x2d')]['findOne']({'where':{'id':_0x3ea7c7[_0xaa20('0x47')]['id']}})['then'](handleEntityNotFound(_0x49a3f8,null))[_0xaa20('0x24')](function(_0x491cc8){if(_0x491cc8){_0x231643=_0x491cc8;_0x23be3a[_0xaa20('0x31')]=_[_0xaa20('0x33')](db[_0xaa20('0x50')][_0xaa20('0x2e')]);_0x23be3a['query']=_['keys'](_0x3ea7c7[_0xaa20('0x32')]);_0x23be3a[_0xaa20('0x34')]=_[_0xaa20('0x35')](_0x23be3a[_0xaa20('0x31')],_0x23be3a['query']);_0x9c1620[_0xaa20('0x36')]=_[_0xaa20('0x35')](_0x23be3a[_0xaa20('0x31')],qs[_0xaa20('0x37')](_0x3ea7c7[_0xaa20('0x32')]['fields']));_0x9c1620[_0xaa20('0x36')]=_0x9c1620[_0xaa20('0x36')][_0xaa20('0x4d')]?_0x9c1620['attributes']:_0x23be3a['model'];_0x9c1620['order']=qs[_0xaa20('0x3b')](_0x3ea7c7[_0xaa20('0x32')]['sort']);_0x9c1620[_0xaa20('0x3c')]=qs['filters'](_[_0xaa20('0x3d')](_0x3ea7c7[_0xaa20('0x32')],_0x23be3a[_0xaa20('0x34')]));if(_0x3ea7c7[_0xaa20('0x32')][_0xaa20('0x3e')]){_0x9c1620[_0xaa20('0x3c')]=_['merge'](_0x9c1620[_0xaa20('0x3c')],{'$or':_[_0xaa20('0x2c')](_0x9c1620[_0xaa20('0x36')],function(_0x3c542f){var _0x5f28c8={};_0x5f28c8[_0x3c542f]={'$like':'%'+_0x3ea7c7[_0xaa20('0x32')][_0xaa20('0x3e')]+'%'};return _0x5f28c8;})});}_0x9c1620=_[_0xaa20('0x3f')]({},_0x9c1620,_0x3ea7c7[_0xaa20('0x4e')]);return _0x231643[_0xaa20('0x51')](_0x9c1620);}})['then'](function(_0x547acf){if(_0x547acf){_0x5aed99=_0x547acf[_0xaa20('0x4d')];if(!_0x3ea7c7[_0xaa20('0x32')][_0xaa20('0x38')](_0xaa20('0x39'))){_0x9c1620[_0xaa20('0x1d')]=qs['limit'](_0x3ea7c7[_0xaa20('0x32')][_0xaa20('0x1d')]);_0x9c1620[_0xaa20('0x1b')]=qs[_0xaa20('0x1b')](_0x3ea7c7[_0xaa20('0x32')]['offset']);}return _0x231643[_0xaa20('0x51')](_0x9c1620);}})[_0xaa20('0x24')](function(_0x38346a){if(_0x38346a){return _0x38346a?{'count':_0x5aed99,'rows':_0x38346a}:null;}})['then'](respondWithResult(_0x49a3f8,null))[_0xaa20('0x45')](handleError(_0x49a3f8,null));};exports[_0xaa20('0x52')]=function(_0x34d475,_0x5f1b6f,_0x295498){var _0x33a047={};var _0x2b863a={};var _0x13465a;var _0x5dbd60;return db['DeskConfiguration'][_0xaa20('0x4c')]({'where':{'id':_0x34d475['params']['id']}})['then'](handleEntityNotFound(_0x5f1b6f,null))[_0xaa20('0x24')](function(_0x561080){if(_0x561080){_0x13465a=_0x561080;_0x2b863a[_0xaa20('0x31')]=_['keys'](db['Tag'][_0xaa20('0x2e')]);_0x2b863a['query']=_[_0xaa20('0x33')](_0x34d475[_0xaa20('0x32')]);_0x2b863a[_0xaa20('0x34')]=_[_0xaa20('0x35')](_0x2b863a[_0xaa20('0x31')],_0x2b863a[_0xaa20('0x32')]);_0x33a047[_0xaa20('0x36')]=_[_0xaa20('0x35')](_0x2b863a[_0xaa20('0x31')],qs[_0xaa20('0x37')](_0x34d475[_0xaa20('0x32')][_0xaa20('0x37')]));_0x33a047['attributes']=_0x33a047['attributes']['length']?_0x33a047[_0xaa20('0x36')]:_0x2b863a[_0xaa20('0x31')];_0x33a047[_0xaa20('0x3a')]=qs['sort'](_0x34d475['query'][_0xaa20('0x3b')]);_0x33a047[_0xaa20('0x3c')]=qs[_0xaa20('0x34')](_[_0xaa20('0x3d')](_0x34d475['query'],_0x2b863a[_0xaa20('0x34')]));if(_0x34d475[_0xaa20('0x32')][_0xaa20('0x3e')]){_0x33a047[_0xaa20('0x3c')]=_[_0xaa20('0x3f')](_0x33a047[_0xaa20('0x3c')],{'$or':_[_0xaa20('0x2c')](_0x33a047['attributes'],function(_0x101fc6){var _0x1fe9b9={};_0x1fe9b9[_0x101fc6]={'$like':'%'+_0x34d475[_0xaa20('0x32')][_0xaa20('0x3e')]+'%'};return _0x1fe9b9;})});}_0x33a047=_[_0xaa20('0x3f')]({},_0x33a047,_0x34d475[_0xaa20('0x4e')]);return _0x13465a[_0xaa20('0x52')](_0x33a047);}})[_0xaa20('0x24')](function(_0x2faa6a){if(_0x2faa6a){_0x5dbd60=_0x2faa6a[_0xaa20('0x4d')];if(!_0x34d475[_0xaa20('0x32')][_0xaa20('0x38')]('nolimit')){_0x33a047['limit']=qs['limit'](_0x34d475['query'][_0xaa20('0x1d')]);_0x33a047['offset']=qs[_0xaa20('0x1b')](_0x34d475[_0xaa20('0x32')]['offset']);}return _0x13465a['getTags'](_0x33a047);}})[_0xaa20('0x24')](function(_0x1ff737){if(_0x1ff737){return _0x1ff737?{'count':_0x5dbd60,'rows':_0x1ff737}:null;}})[_0xaa20('0x24')](respondWithResult(_0x5f1b6f,null))[_0xaa20('0x45')](handleError(_0x5f1b6f,null));};exports[_0xaa20('0x53')]=function(_0x35293e,_0x3281e5,_0x3a75d9){if(_0x35293e[_0xaa20('0x4a')]['id']){delete _0x35293e[_0xaa20('0x4a')]['id'];}return db[_0xaa20('0x2d')][_0xaa20('0x4c')]({'where':{'id':_0x35293e['params']['id']}})[_0xaa20('0x24')](handleEntityNotFound(_0x3281e5,null))[_0xaa20('0x24')](function(_0x54c5f8){if(_0x54c5f8){return _0x54c5f8[_0xaa20('0x53')](_0x35293e[_0xaa20('0x4a')][_0xaa20('0x54')]||[]);}return null;})[_0xaa20('0x24')](respondWithResult(_0x3281e5,null))['catch'](handleError(_0x3281e5,null));}; \ No newline at end of file +var _0xbfcf=['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','sendStatus','status','end','limit','count','offset','set','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getFields','findOne','keys','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x218796,_0x4b4459){var _0x582796=function(_0x5a62e4){while(--_0x5a62e4){_0x218796['push'](_0x218796['shift']());}};_0x582796(++_0x4b4459);}(_0xbfcf,0x13d));var _0xfbfc=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0xbfcf[_0x1b6311];return _0x25aab6;};'use strict';var emlformat=require(_0xfbfc('0x0'));var rimraf=require(_0xfbfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbfc('0x2'));var rp=require(_0xfbfc('0x3'));var moment=require('moment');var BPromise=require(_0xfbfc('0x4'));var Mustache=require(_0xfbfc('0x5'));var util=require(_0xfbfc('0x6'));var path=require(_0xfbfc('0x7'));var sox=require(_0xfbfc('0x8'));var csv=require(_0xfbfc('0x9'));var ejs=require(_0xfbfc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbfc('0xb'));var squel=require('squel');var crypto=require(_0xfbfc('0xc'));var jsforce=require(_0xfbfc('0xd'));var deskjs=require(_0xfbfc('0xe'));var toCsv=require(_0xfbfc('0x9'));var querystring=require(_0xfbfc('0xf'));var Papa=require(_0xfbfc('0x10'));var Redis=require(_0xfbfc('0x11'));var authService=require(_0xfbfc('0x12'));var qs=require(_0xfbfc('0x13'));var as=require(_0xfbfc('0x14'));var hardwareService=require(_0xfbfc('0x15'));var logger=require(_0xfbfc('0x16'))(_0xfbfc('0x17'));var utils=require(_0xfbfc('0x18'));var config=require(_0xfbfc('0x19'));var licenseUtil=require(_0xfbfc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x225336,_0x389a41){_0x389a41=_0x389a41||0xcc;return function(_0x23efa7){if(_0x23efa7){return _0x225336[_0xfbfc('0x1b')](_0x389a41);}return _0x225336[_0xfbfc('0x1c')](_0x389a41)[_0xfbfc('0x1d')]();};}function respondWithResult(_0x41fae9,_0x2e5852){_0x2e5852=_0x2e5852||0xc8;return function(_0x3f674f){if(_0x3f674f){return _0x41fae9[_0xfbfc('0x1c')](_0x2e5852)['json'](_0x3f674f);}};}function respondWithFilteredResult(_0x27620a,_0x1eda49){return function(_0x5234fc){if(_0x5234fc){var _0xb8318f=typeof _0x1eda49['offset']==='undefined'&&typeof _0x1eda49[_0xfbfc('0x1e')]==='undefined';var _0x39f056=_0x5234fc[_0xfbfc('0x1f')];var _0x401aba=_0xb8318f?0x0:_0x1eda49[_0xfbfc('0x20')];var _0x4964d0=_0xb8318f?_0x5234fc[_0xfbfc('0x1f')]:_0x1eda49['offset']+_0x1eda49[_0xfbfc('0x1e')];var _0x534db4;if(_0x4964d0>=_0x39f056){_0x4964d0=_0x39f056;_0x534db4=0xc8;}else{_0x534db4=0xce;}_0x27620a[_0xfbfc('0x1c')](_0x534db4);return _0x27620a[_0xfbfc('0x21')]('Content-Range',_0x401aba+'-'+_0x4964d0+'/'+_0x39f056)['json'](_0x5234fc);}return null;};}function patchUpdates(_0x2de8a2){return function(_0x125100){try{jsonpatch['apply'](_0x125100,_0x2de8a2,!![]);}catch(_0x515e60){return BPromise[_0xfbfc('0x22')](_0x515e60);}return _0x125100[_0xfbfc('0x23')]();};}function saveUpdates(_0x26df07,_0x5d365b){return function(_0x34fedb){if(_0x34fedb){return _0x34fedb[_0xfbfc('0x24')](_0x26df07)[_0xfbfc('0x25')](function(_0x2d7f61){return _0x2d7f61;});}return null;};}function removeEntity(_0x4321c2,_0x27954a){return function(_0x2af0b2){if(_0x2af0b2){return _0x2af0b2['destroy']()[_0xfbfc('0x25')](function(){_0x4321c2[_0xfbfc('0x1c')](0xcc)[_0xfbfc('0x1d')]();});}};}function handleEntityNotFound(_0x917c90,_0x3d501d){return function(_0xff8891){if(!_0xff8891){_0x917c90[_0xfbfc('0x1b')](0x194);}return _0xff8891;};}function handleError(_0x56a1f4,_0x595483){_0x595483=_0x595483||0x1f4;return function(_0x417822){logger['error'](_0x417822[_0xfbfc('0x26')]);if(_0x417822[_0xfbfc('0x27')]){delete _0x417822['name'];}_0x56a1f4[_0xfbfc('0x1c')](_0x595483)[_0xfbfc('0x28')](_0x417822);};}exports[_0xfbfc('0x29')]=function(_0x1b300f,_0x2a7282){var _0x1a295c={},_0x29e160={},_0x5332d1={'count':0x0,'rows':[]};var _0x5b5c45=_[_0xfbfc('0x2a')](db['DeskConfiguration'][_0xfbfc('0x2b')],function(_0x50cabb){return{'name':_0x50cabb['fieldName'],'type':_0x50cabb[_0xfbfc('0x2c')][_0xfbfc('0x2d')]};});_0x29e160[_0xfbfc('0x2e')]=_['map'](_0x5b5c45,_0xfbfc('0x27'));_0x29e160['query']=_['keys'](_0x1b300f[_0xfbfc('0x2f')]);_0x29e160['filters']=_['intersection'](_0x29e160['model'],_0x29e160[_0xfbfc('0x2f')]);_0x1a295c[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x29e160[_0xfbfc('0x2e')],qs[_0xfbfc('0x32')](_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x1a295c[_0xfbfc('0x30')]=_0x1a295c[_0xfbfc('0x30')][_0xfbfc('0x33')]?_0x1a295c[_0xfbfc('0x30')]:_0x29e160[_0xfbfc('0x2e')];if(!_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x1a295c['limit']=qs[_0xfbfc('0x1e')](_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x1e')]);_0x1a295c[_0xfbfc('0x20')]=qs[_0xfbfc('0x20')](_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x20')]);}_0x1a295c[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x1b300f[_0xfbfc('0x2f')]['sort']);_0x1a295c[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_[_0xfbfc('0x3a')](_0x1b300f[_0xfbfc('0x2f')],_0x29e160['filters']),_0x5b5c45);if(_0x1b300f['query'][_0xfbfc('0x3b')]){_0x1a295c[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x1a295c[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x5b5c45,function(_0x49693e){if(_0x49693e[_0xfbfc('0x2c')]!=='VIRTUAL'){var _0x253825={};_0x253825[_0x49693e['name']]={'$like':'%'+_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x253825;}})});}_0x1a295c=_['merge']({},_0x1a295c,_0x1b300f[_0xfbfc('0x3d')]);var _0x103a5a={'where':_0x1a295c[_0xfbfc('0x38')]};return db[_0xfbfc('0x3e')][_0xfbfc('0x1f')](_0x103a5a)[_0xfbfc('0x25')](function(_0x12549e){_0x5332d1[_0xfbfc('0x1f')]=_0x12549e;if(_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x3f')]){_0x1a295c[_0xfbfc('0x40')]=[{'all':!![]}];}return db[_0xfbfc('0x3e')][_0xfbfc('0x41')](_0x1a295c);})[_0xfbfc('0x25')](function(_0x125aa2){_0x5332d1['rows']=_0x125aa2;return _0x5332d1;})['then'](respondWithFilteredResult(_0x2a7282,_0x1a295c))[_0xfbfc('0x42')](handleError(_0x2a7282,null));};exports[_0xfbfc('0x43')]=function(_0x25f548,_0x3a84e0){var _0x15f493={'raw':![],'where':{'id':_0x25f548[_0xfbfc('0x44')]['id']}},_0x51fd75={};_0x51fd75['model']=_['keys'](db['DeskConfiguration'][_0xfbfc('0x2b')]);_0x51fd75[_0xfbfc('0x2f')]=_['keys'](_0x25f548[_0xfbfc('0x2f')]);_0x51fd75[_0xfbfc('0x39')]=_[_0xfbfc('0x31')](_0x51fd75[_0xfbfc('0x2e')],_0x51fd75[_0xfbfc('0x2f')]);_0x15f493['attributes']=_[_0xfbfc('0x31')](_0x51fd75[_0xfbfc('0x2e')],qs[_0xfbfc('0x32')](_0x25f548[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x15f493[_0xfbfc('0x30')]=_0x15f493[_0xfbfc('0x30')]['length']?_0x15f493[_0xfbfc('0x30')]:_0x51fd75[_0xfbfc('0x2e')];if(_0x25f548['query'][_0xfbfc('0x3f')]){_0x15f493[_0xfbfc('0x40')]=[{'all':!![]}];}_0x15f493=_[_0xfbfc('0x3c')]({},_0x15f493,_0x25f548[_0xfbfc('0x3d')]);return db[_0xfbfc('0x3e')][_0xfbfc('0x45')](_0x15f493)[_0xfbfc('0x25')](handleEntityNotFound(_0x3a84e0,null))[_0xfbfc('0x25')](respondWithResult(_0x3a84e0,null))['catch'](handleError(_0x3a84e0,null));};exports[_0xfbfc('0x46')]=function(_0x50ef8b,_0x1e4216){return db['DeskConfiguration'][_0xfbfc('0x46')](_0x50ef8b['body'],{})[_0xfbfc('0x25')](respondWithResult(_0x1e4216,0xc9))['catch'](handleError(_0x1e4216,null));};exports['update']=function(_0x293265,_0x448e5f){if(_0x293265[_0xfbfc('0x47')]['id']){delete _0x293265['body']['id'];}return db[_0xfbfc('0x3e')][_0xfbfc('0x45')]({'where':{'id':_0x293265[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x448e5f,null))[_0xfbfc('0x25')](saveUpdates(_0x293265[_0xfbfc('0x47')],null))[_0xfbfc('0x25')](respondWithResult(_0x448e5f,null))[_0xfbfc('0x42')](handleError(_0x448e5f,null));};exports[_0xfbfc('0x48')]=function(_0x10124b,_0x1b2281){return db['DeskConfiguration']['find']({'where':{'id':_0x10124b['params']['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x1b2281,null))[_0xfbfc('0x25')](removeEntity(_0x1b2281,null))['catch'](handleError(_0x1b2281,null));};exports[_0xfbfc('0x49')]=function(_0x4e2725,_0x358497,_0xa10a70){var _0x5b66f7={};var _0x1a300b={};var _0x1f9e13;var _0x42f3b6;return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x4e2725[_0xfbfc('0x44')]['id']}})['then'](handleEntityNotFound(_0x358497,null))[_0xfbfc('0x25')](function(_0x1f48fc){if(_0x1f48fc){_0x1f9e13=_0x1f48fc;_0x1a300b['model']=_[_0xfbfc('0x4b')](db[_0xfbfc('0x4c')][_0xfbfc('0x2b')]);_0x1a300b[_0xfbfc('0x2f')]=_['keys'](_0x4e2725['query']);_0x1a300b[_0xfbfc('0x39')]=_[_0xfbfc('0x31')](_0x1a300b[_0xfbfc('0x2e')],_0x1a300b['query']);_0x5b66f7[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x1a300b['model'],qs[_0xfbfc('0x32')](_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x5b66f7[_0xfbfc('0x30')]=_0x5b66f7[_0xfbfc('0x30')][_0xfbfc('0x33')]?_0x5b66f7[_0xfbfc('0x30')]:_0x1a300b[_0xfbfc('0x2e')];_0x5b66f7['order']=qs[_0xfbfc('0x37')](_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x37')]);_0x5b66f7[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_['pick'](_0x4e2725[_0xfbfc('0x2f')],_0x1a300b[_0xfbfc('0x39')]));if(_0x4e2725[_0xfbfc('0x2f')]['filter']){_0x5b66f7[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x5b66f7[_0xfbfc('0x38')],{'$or':_['map'](_0x5b66f7[_0xfbfc('0x30')],function(_0x4dc329){var _0x4d2801={};_0x4d2801[_0x4dc329]={'$like':'%'+_0x4e2725['query']['filter']+'%'};return _0x4d2801;})});}_0x5b66f7=_[_0xfbfc('0x3c')]({},_0x5b66f7,_0x4e2725[_0xfbfc('0x3d')]);return _0x1f9e13[_0xfbfc('0x49')](_0x5b66f7);}})['then'](function(_0x9aacbd){if(_0x9aacbd){_0x42f3b6=_0x9aacbd[_0xfbfc('0x33')];if(!_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x5b66f7['limit']=qs[_0xfbfc('0x1e')](_0x4e2725['query'][_0xfbfc('0x1e')]);_0x5b66f7[_0xfbfc('0x20')]=qs['offset'](_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x20')]);}return _0x1f9e13[_0xfbfc('0x49')](_0x5b66f7);}})['then'](function(_0x2ad019){if(_0x2ad019){return _0x2ad019?{'count':_0x42f3b6,'rows':_0x2ad019}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x358497,null))[_0xfbfc('0x42')](handleError(_0x358497,null));};exports['getSubjects']=function(_0x32958e,_0x1a920a,_0x7f84e4){var _0x128c9d={};var _0xe33fd5={};var _0x145966;var _0x2a9857;return db[_0xfbfc('0x3e')]['findOne']({'where':{'id':_0x32958e['params']['id']}})['then'](handleEntityNotFound(_0x1a920a,null))[_0xfbfc('0x25')](function(_0x1d181f){if(_0x1d181f){_0x145966=_0x1d181f;_0xe33fd5[_0xfbfc('0x2e')]=_[_0xfbfc('0x4b')](db[_0xfbfc('0x4c')]['rawAttributes']);_0xe33fd5[_0xfbfc('0x2f')]=_[_0xfbfc('0x4b')](_0x32958e[_0xfbfc('0x2f')]);_0xe33fd5['filters']=_[_0xfbfc('0x31')](_0xe33fd5['model'],_0xe33fd5[_0xfbfc('0x2f')]);_0x128c9d[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0xe33fd5[_0xfbfc('0x2e')],qs['fields'](_0x32958e[_0xfbfc('0x2f')]['fields']));_0x128c9d[_0xfbfc('0x30')]=_0x128c9d['attributes'][_0xfbfc('0x33')]?_0x128c9d[_0xfbfc('0x30')]:_0xe33fd5['model'];_0x128c9d[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x37')]);_0x128c9d[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_[_0xfbfc('0x3a')](_0x32958e[_0xfbfc('0x2f')],_0xe33fd5['filters']));if(_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x3b')]){_0x128c9d[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x128c9d[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x128c9d[_0xfbfc('0x30')],function(_0x242dae){var _0x1955c1={};_0x1955c1[_0x242dae]={'$like':'%'+_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x1955c1;})});}_0x128c9d=_[_0xfbfc('0x3c')]({},_0x128c9d,_0x32958e[_0xfbfc('0x3d')]);return _0x145966[_0xfbfc('0x4d')](_0x128c9d);}})[_0xfbfc('0x25')](function(_0xf0ec8b){if(_0xf0ec8b){_0x2a9857=_0xf0ec8b[_0xfbfc('0x33')];if(!_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x128c9d['limit']=qs[_0xfbfc('0x1e')](_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x1e')]);_0x128c9d[_0xfbfc('0x20')]=qs['offset'](_0x32958e['query'][_0xfbfc('0x20')]);}return _0x145966[_0xfbfc('0x4d')](_0x128c9d);}})[_0xfbfc('0x25')](function(_0x427caa){if(_0x427caa){return _0x427caa?{'count':_0x2a9857,'rows':_0x427caa}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x1a920a,null))[_0xfbfc('0x42')](handleError(_0x1a920a,null));};exports[_0xfbfc('0x4e')]=function(_0x55bd26,_0x4bb8bb,_0x54342f){var _0x2e9477={};var _0x1759a2={};var _0x577564;var _0x59d18e;return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x55bd26[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x4bb8bb,null))['then'](function(_0x1ca179){if(_0x1ca179){_0x577564=_0x1ca179;_0x1759a2[_0xfbfc('0x2e')]=_[_0xfbfc('0x4b')](db[_0xfbfc('0x4c')]['rawAttributes']);_0x1759a2[_0xfbfc('0x2f')]=_[_0xfbfc('0x4b')](_0x55bd26[_0xfbfc('0x2f')]);_0x1759a2[_0xfbfc('0x39')]=_[_0xfbfc('0x31')](_0x1759a2[_0xfbfc('0x2e')],_0x1759a2['query']);_0x2e9477[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x1759a2[_0xfbfc('0x2e')],qs['fields'](_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x2e9477[_0xfbfc('0x30')]=_0x2e9477[_0xfbfc('0x30')][_0xfbfc('0x33')]?_0x2e9477[_0xfbfc('0x30')]:_0x1759a2[_0xfbfc('0x2e')];_0x2e9477[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x37')]);_0x2e9477['where']=qs[_0xfbfc('0x39')](_[_0xfbfc('0x3a')](_0x55bd26[_0xfbfc('0x2f')],_0x1759a2[_0xfbfc('0x39')]));if(_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x3b')]){_0x2e9477[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x2e9477[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x2e9477[_0xfbfc('0x30')],function(_0x4b1805){var _0x291301={};_0x291301[_0x4b1805]={'$like':'%'+_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x291301;})});}_0x2e9477=_[_0xfbfc('0x3c')]({},_0x2e9477,_0x55bd26['options']);return _0x577564[_0xfbfc('0x4e')](_0x2e9477);}})[_0xfbfc('0x25')](function(_0x5a1fba){if(_0x5a1fba){_0x59d18e=_0x5a1fba[_0xfbfc('0x33')];if(!_0x55bd26[_0xfbfc('0x2f')]['hasOwnProperty'](_0xfbfc('0x35'))){_0x2e9477[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x1e')]);_0x2e9477[_0xfbfc('0x20')]=qs[_0xfbfc('0x20')](_0x55bd26['query']['offset']);}return _0x577564[_0xfbfc('0x4e')](_0x2e9477);}})[_0xfbfc('0x25')](function(_0x4164aa){if(_0x4164aa){return _0x4164aa?{'count':_0x59d18e,'rows':_0x4164aa}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x4bb8bb,null))['catch'](handleError(_0x4bb8bb,null));};exports[_0xfbfc('0x4f')]=function(_0x230019,_0x3c8870,_0x2023b5){var _0x51db4b={};var _0x2404cd={};var _0x3e473c;var _0x2489be;return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x230019[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x3c8870,null))[_0xfbfc('0x25')](function(_0x23249f){if(_0x23249f){_0x3e473c=_0x23249f;_0x2404cd[_0xfbfc('0x2e')]=_['keys'](db['Tag'][_0xfbfc('0x2b')]);_0x2404cd[_0xfbfc('0x2f')]=_['keys'](_0x230019['query']);_0x2404cd['filters']=_['intersection'](_0x2404cd[_0xfbfc('0x2e')],_0x2404cd['query']);_0x51db4b[_0xfbfc('0x30')]=_['intersection'](_0x2404cd[_0xfbfc('0x2e')],qs['fields'](_0x230019[_0xfbfc('0x2f')]['fields']));_0x51db4b['attributes']=_0x51db4b['attributes'][_0xfbfc('0x33')]?_0x51db4b[_0xfbfc('0x30')]:_0x2404cd['model'];_0x51db4b[_0xfbfc('0x36')]=qs['sort'](_0x230019['query']['sort']);_0x51db4b['where']=qs['filters'](_[_0xfbfc('0x3a')](_0x230019[_0xfbfc('0x2f')],_0x2404cd[_0xfbfc('0x39')]));if(_0x230019[_0xfbfc('0x2f')]['filter']){_0x51db4b[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x51db4b[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x51db4b['attributes'],function(_0x1079cf){var _0x5bbf1b={};_0x5bbf1b[_0x1079cf]={'$like':'%'+_0x230019[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x5bbf1b;})});}_0x51db4b=_[_0xfbfc('0x3c')]({},_0x51db4b,_0x230019[_0xfbfc('0x3d')]);return _0x3e473c[_0xfbfc('0x4f')](_0x51db4b);}})[_0xfbfc('0x25')](function(_0xdf5312){if(_0xdf5312){_0x2489be=_0xdf5312[_0xfbfc('0x33')];if(!_0x230019['query'][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x51db4b[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x230019['query'][_0xfbfc('0x1e')]);_0x51db4b['offset']=qs['offset'](_0x230019['query']['offset']);}return _0x3e473c['getTags'](_0x51db4b);}})[_0xfbfc('0x25')](function(_0x416571){if(_0x416571){return _0x416571?{'count':_0x2489be,'rows':_0x416571}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x3c8870,null))[_0xfbfc('0x42')](handleError(_0x3c8870,null));};exports[_0xfbfc('0x50')]=function(_0x41776e,_0xe012b6,_0x406049){if(_0x41776e['body']['id']){delete _0x41776e[_0xfbfc('0x47')]['id'];}return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x41776e[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0xe012b6,null))[_0xfbfc('0x25')](function(_0x27ce00){if(_0x27ce00){return _0x27ce00['setTags'](_0x41776e['body'][_0xfbfc('0x51')]||[]);}return null;})['then'](respondWithResult(_0xe012b6,null))[_0xfbfc('0x42')](handleError(_0xe012b6,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bf71e4e..90f2da6 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 _0x01ab=['exports','define','int_desk_configurations','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x5e280c,_0x1f3614){var _0x335ec2=function(_0x2d15d4){while(--_0x2d15d4){_0x5e280c['push'](_0x5e280c['shift']());}};_0x335ec2(++_0x1f3614);}(_0x01ab,0x71));var _0xb01a=function(_0x3031e5,_0x2a73a9){_0x3031e5=_0x3031e5-0x0;var _0x2e48b4=_0x01ab[_0x3031e5];return _0x2e48b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb01a('0x0'))('api');var moment=require(_0xb01a('0x1'));var BPromise=require(_0xb01a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb01a('0x3'));var rimraf=require(_0xb01a('0x4'));var config=require(_0xb01a('0x5'));var attributes=require(_0xb01a('0x6'));module[_0xb01a('0x7')]=function(_0x2957b6,_0x4fe2a8){return _0x2957b6[_0xb01a('0x8')]('DeskConfiguration',attributes,{'tableName':_0xb01a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7b1=['../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1eb933,_0x23c99d){var _0x4593ed=function(_0x11082){while(--_0x11082){_0x1eb933['push'](_0x1eb933['shift']());}};_0x4593ed(++_0x23c99d);}(_0xc7b1,0x154));var _0x1c7b=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xc7b1[_0x523adf];return _0x283870;};'use strict';var _=require(_0x1c7b('0x0'));var util=require(_0x1c7b('0x1'));var logger=require(_0x1c7b('0x2'))(_0x1c7b('0x3'));var moment=require(_0x1c7b('0x4'));var BPromise=require(_0x1c7b('0x5'));var rp=require(_0x1c7b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c7b('0x7'));var config=require(_0x1c7b('0x8'));var attributes=require(_0x1c7b('0x9'));module[_0x1c7b('0xa')]=function(_0xfe92ff,_0x29a18b){return _0xfe92ff['define'](_0x1c7b('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index af8b28a..380bee9 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 _0xdc15=['../../mysqldb','../../config/environment','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5df787,_0x21d38c){var _0x67d520=function(_0x3f458a){while(--_0x3f458a){_0x5df787['push'](_0x5df787['shift']());}};_0x67d520(++_0x21d38c);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xdc15[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var moment=require(_0x5dc1('0x1'));var BPromise=require(_0x5dc1('0x2'));var rs=require(_0x5dc1('0x3'));var fs=require('fs');var Redis=require(_0x5dc1('0x4'));var db=require(_0x5dc1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ec95f,_0x22d677,_0x12abf9){return new BPromise(function(_0x1c90f6,_0x3e96c1){return client[_0x5dc1('0x8')](_0x2ec95f,_0x12abf9)[_0x5dc1('0x9')](function(_0x1f1293){logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');logger['debug'](_0x5dc1('0xc'),_0x22d677,_0x5dc1('0xd'),JSON['stringify'](_0x1f1293));if(_0x1f1293[_0x5dc1('0xe')]){if(_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0xf')]===0x1f4){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x3e96c1(_0x1f1293['error'][_0x5dc1('0x10')]);}logger[_0x5dc1('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x1c90f6(_0x1f1293['error'][_0x5dc1('0x10')]);}else{logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');_0x1c90f6(_0x1f1293[_0x5dc1('0x11')]['message']);}})['catch'](function(_0x17506b){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x17506b);_0x3e96c1(_0x17506b);});});} \ No newline at end of file +var _0xb90a=['request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','rpc','../../config/environment','http'];(function(_0x4b9485,_0xb3e19d){var _0x235762=function(_0x7067b){while(--_0x7067b){_0x4b9485['push'](_0x4b9485['shift']());}};_0x235762(++_0xb3e19d);}(_0xb90a,0x12a));var _0xab90=function(_0x546896,_0x191d7a){_0x546896=_0x546896-0x0;var _0x2f0fef=_0xb90a[_0x546896];return _0x2f0fef;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var moment=require('moment');var BPromise=require(_0xab90('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('../../config/logger')(_0xab90('0x3'));var config=require(_0xab90('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab90('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x426588,_0x275bf7,_0x4b28a6){return new BPromise(function(_0x2406e1,_0xc5ca04){return client[_0xab90('0x6')](_0x426588,_0x4b28a6)[_0xab90('0x7')](function(_0x93af2f){logger[_0xab90('0x8')](_0xab90('0x9'),_0x275bf7,_0xab90('0xa'));logger['debug'](_0xab90('0xb'),_0x275bf7,_0xab90('0xa'),JSON[_0xab90('0xc')](_0x93af2f));if(_0x93af2f[_0xab90('0xd')]){if(_0x93af2f[_0xab90('0xd')]['code']===0x1f4){logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);return _0xc5ca04(_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);}logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);return _0x2406e1(_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);}else{logger[_0xab90('0x8')]('DeskConfiguration,\x20%s,\x20%s',_0x275bf7,_0xab90('0xa'));_0x2406e1(_0x93af2f['result'][_0xab90('0xe')]);}})[_0xab90('0xf')](function(_0x526bee){logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x526bee);_0xc5ca04(_0x526bee);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e42b12d..d654448 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 _0x84ff=['update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','create','put'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x84ff,0x1ac));var _0xf84f=function(_0x3df3cf,_0x3cf52a){_0x3df3cf=_0x3df3cf-0x0;var _0x4e68c2=_0x84ff[_0x3df3cf];return _0x4e68c2;};'use strict';var multer=require('multer');var util=require(_0xf84f('0x0'));var path=require(_0xf84f('0x1'));var timeout=require(_0xf84f('0x2'));var express=require(_0xf84f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf84f('0x4'));var interaction=require(_0xf84f('0x5'));var config=require(_0xf84f('0x6'));var controller=require(_0xf84f('0x7'));router[_0xf84f('0x8')]('/',auth[_0xf84f('0x9')](),controller['index']);router[_0xf84f('0x8')](_0xf84f('0xa'),auth[_0xf84f('0x9')](),controller[_0xf84f('0xb')]);router['post']('/',auth[_0xf84f('0x9')](),controller[_0xf84f('0xc')]);router[_0xf84f('0xd')]('/:id',auth[_0xf84f('0x9')](),controller[_0xf84f('0xe')]);router[_0xf84f('0xf')]('/:id',auth[_0xf84f('0x9')](),controller[_0xf84f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa0e9=['/:id','show','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index'];(function(_0xf277f0,_0x5857f3){var _0xb0ca14=function(_0x33de9b){while(--_0x33de9b){_0xf277f0['push'](_0xf277f0['shift']());}};_0xb0ca14(++_0x5857f3);}(_0xa0e9,0x147));var _0x9a0e=function(_0x204092,_0x2f11c2){_0x204092=_0x204092-0x0;var _0x36f879=_0xa0e9[_0x204092];return _0x36f879;};'use strict';var multer=require(_0x9a0e('0x0'));var util=require('util');var path=require(_0x9a0e('0x1'));var timeout=require(_0x9a0e('0x2'));var express=require(_0x9a0e('0x3'));var router=express[_0x9a0e('0x4')]();var fs_extra=require(_0x9a0e('0x5'));var auth=require(_0x9a0e('0x6'));var interaction=require(_0x9a0e('0x7'));var config=require(_0x9a0e('0x8'));var controller=require(_0x9a0e('0x9'));router[_0x9a0e('0xa')]('/',auth[_0x9a0e('0xb')](),controller[_0x9a0e('0xc')]);router[_0x9a0e('0xa')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller[_0x9a0e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9a0e('0xf')]);router[_0x9a0e('0x10')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller[_0x9a0e('0x11')]);router[_0x9a0e('0x12')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller['destroy']);module[_0x9a0e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7bae480..a416da8 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 _0xfb22=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x58394b,_0xddda60){var _0x4ee854=function(_0x2bf8af){while(--_0x2bf8af){_0x58394b['push'](_0x58394b['shift']());}};_0x4ee854(++_0xddda60);}(_0xfb22,0x71));var _0x2fb2=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0xfb22[_0x25b4a4];return _0x707267;};'use strict';var Sequelize=require(_0x2fb2('0x0'));module[_0x2fb2('0x1')]={'type':{'type':Sequelize[_0x2fb2('0x2')](_0x2fb2('0x3'),_0x2fb2('0x4'),_0x2fb2('0x5'),'keyValue',_0x2fb2('0x6')),'defaultValue':_0x2fb2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2fb2('0x7')]},'keyType':{'type':Sequelize[_0x2fb2('0x2')]('string',_0x2fb2('0x4'),_0x2fb2('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2fb2('0x7')]},'nameField':{'type':Sequelize[_0x2fb2('0x7')]},'customField':{'type':Sequelize[_0x2fb2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2fb2('0x7')]}}; \ No newline at end of file +var _0x6e66=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x26e5ce,_0x513ef5){var _0x258402=function(_0x1566b3){while(--_0x1566b3){_0x26e5ce['push'](_0x26e5ce['shift']());}};_0x258402(++_0x513ef5);}(_0x6e66,0x1d7));var _0x66e6=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x6e66[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x66e6('0x0'));module['exports']={'type':{'type':Sequelize[_0x66e6('0x1')]('string',_0x66e6('0x2'),_0x66e6('0x3'),_0x66e6('0x4'),_0x66e6('0x5')),'defaultValue':_0x66e6('0x6')},'content':{'type':Sequelize[_0x66e6('0x7')]},'key':{'type':Sequelize[_0x66e6('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x66e6('0x6'),_0x66e6('0x2'),_0x66e6('0x3'))},'keyContent':{'type':Sequelize[_0x66e6('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x66e6('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'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 e593193..44b94ca 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 _0x0b3d=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','update','params','destroy','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x23ed5d,_0x25c460){var _0x12fbdd=function(_0x8dc30){while(--_0x8dc30){_0x23ed5d['push'](_0x23ed5d['shift']());}};_0x12fbdd(++_0x25c460);}(_0x0b3d,0x76));var _0xd0b3=function(_0x3bb954,_0x5173dd){_0x3bb954=_0x3bb954-0x0;var _0x3d96a3=_0x0b3d[_0x3bb954];return _0x3d96a3;};'use strict';var emlformat=require(_0xd0b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0b3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0b3('0x2'));var moment=require('moment');var BPromise=require(_0xd0b3('0x3'));var Mustache=require('mustache');var util=require(_0xd0b3('0x4'));var path=require('path');var sox=require(_0xd0b3('0x5'));var csv=require(_0xd0b3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0b3('0x7'));var _=require('lodash');var squel=require(_0xd0b3('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd0b3('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd0b3('0xa'));var Redis=require('ioredis');var authService=require(_0xd0b3('0xb'));var qs=require(_0xd0b3('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0b3('0xd'))(_0xd0b3('0xe'));var utils=require(_0xd0b3('0xf'));var config=require(_0xd0b3('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x97ca75,_0x2202ec){_0x2202ec=_0x2202ec||0xcc;return function(_0x43af8d){if(_0x43af8d){return _0x97ca75[_0xd0b3('0x11')](_0x2202ec);}return _0x97ca75[_0xd0b3('0x12')](_0x2202ec)[_0xd0b3('0x13')]();};}function respondWithResult(_0x2e4734,_0x5af82f){_0x5af82f=_0x5af82f||0xc8;return function(_0x2d1376){if(_0x2d1376){return _0x2e4734[_0xd0b3('0x12')](_0x5af82f)[_0xd0b3('0x14')](_0x2d1376);}};}function respondWithFilteredResult(_0x28d379,_0x49bfde){return function(_0xd7a36e){if(_0xd7a36e){var _0x1426cc=typeof _0x49bfde[_0xd0b3('0x15')]==='undefined'&&typeof _0x49bfde[_0xd0b3('0x16')]===_0xd0b3('0x17');var _0x50ea99=_0xd7a36e[_0xd0b3('0x18')];var _0x232e6a=_0x1426cc?0x0:_0x49bfde['offset'];var _0x4ed917=_0x1426cc?_0xd7a36e[_0xd0b3('0x18')]:_0x49bfde[_0xd0b3('0x15')]+_0x49bfde['limit'];var _0x8176e2;if(_0x4ed917>=_0x50ea99){_0x4ed917=_0x50ea99;_0x8176e2=0xc8;}else{_0x8176e2=0xce;}_0x28d379[_0xd0b3('0x12')](_0x8176e2);return _0x28d379[_0xd0b3('0x19')]('Content-Range',_0x232e6a+'-'+_0x4ed917+'/'+_0x50ea99)['json'](_0xd7a36e);}return null;};}function patchUpdates(_0xbd82dc){return function(_0x4f755f){try{jsonpatch[_0xd0b3('0x1a')](_0x4f755f,_0xbd82dc,!![]);}catch(_0x1d023d){return BPromise[_0xd0b3('0x1b')](_0x1d023d);}return _0x4f755f[_0xd0b3('0x1c')]();};}function saveUpdates(_0x155add,_0x553c27){return function(_0x55261e){if(_0x55261e){return _0x55261e['update'](_0x155add)[_0xd0b3('0x1d')](function(_0x40a637){return _0x40a637;});}return null;};}function removeEntity(_0x1a84a5,_0x1bfe7b){return function(_0x1ac0cd){if(_0x1ac0cd){return _0x1ac0cd['destroy']()[_0xd0b3('0x1d')](function(){_0x1a84a5[_0xd0b3('0x12')](0xcc)[_0xd0b3('0x13')]();});}};}function handleEntityNotFound(_0x2e0dcc,_0x550d35){return function(_0x259e05){if(!_0x259e05){_0x2e0dcc[_0xd0b3('0x11')](0x194);}return _0x259e05;};}function handleError(_0x1a1d36,_0x52606c){_0x52606c=_0x52606c||0x1f4;return function(_0x48fb43){logger[_0xd0b3('0x1e')](_0x48fb43[_0xd0b3('0x1f')]);if(_0x48fb43[_0xd0b3('0x20')]){delete _0x48fb43['name'];}_0x1a1d36[_0xd0b3('0x12')](_0x52606c)[_0xd0b3('0x21')](_0x48fb43);};}exports['index']=function(_0x1e4c8f,_0x43bfe7){var _0x52f324={},_0x2b2d05={},_0x47cc10={'count':0x0,'rows':[]};var _0x400a9d=_['map'](db[_0xd0b3('0x22')][_0xd0b3('0x23')],function(_0xbb9663){return{'name':_0xbb9663[_0xd0b3('0x24')],'type':_0xbb9663[_0xd0b3('0x25')][_0xd0b3('0x26')]};});_0x2b2d05[_0xd0b3('0x27')]=_['map'](_0x400a9d,_0xd0b3('0x20'));_0x2b2d05[_0xd0b3('0x28')]=_[_0xd0b3('0x29')](_0x1e4c8f[_0xd0b3('0x28')]);_0x2b2d05['filters']=_[_0xd0b3('0x2a')](_0x2b2d05[_0xd0b3('0x27')],_0x2b2d05[_0xd0b3('0x28')]);_0x52f324[_0xd0b3('0x2b')]=_['intersection'](_0x2b2d05[_0xd0b3('0x27')],qs[_0xd0b3('0x2c')](_0x1e4c8f[_0xd0b3('0x28')][_0xd0b3('0x2c')]));_0x52f324[_0xd0b3('0x2b')]=_0x52f324[_0xd0b3('0x2b')][_0xd0b3('0x2d')]?_0x52f324[_0xd0b3('0x2b')]:_0x2b2d05[_0xd0b3('0x27')];if(!_0x1e4c8f[_0xd0b3('0x28')][_0xd0b3('0x2e')](_0xd0b3('0x2f'))){_0x52f324[_0xd0b3('0x16')]=qs[_0xd0b3('0x16')](_0x1e4c8f['query'][_0xd0b3('0x16')]);_0x52f324[_0xd0b3('0x15')]=qs[_0xd0b3('0x15')](_0x1e4c8f[_0xd0b3('0x28')]['offset']);}_0x52f324['order']=qs['sort'](_0x1e4c8f[_0xd0b3('0x28')][_0xd0b3('0x30')]);_0x52f324[_0xd0b3('0x31')]=qs[_0xd0b3('0x32')](_[_0xd0b3('0x33')](_0x1e4c8f[_0xd0b3('0x28')],_0x2b2d05['filters']),_0x400a9d);if(_0x1e4c8f[_0xd0b3('0x28')][_0xd0b3('0x34')]){_0x52f324[_0xd0b3('0x31')]=_[_0xd0b3('0x35')](_0x52f324[_0xd0b3('0x31')],{'$or':_[_0xd0b3('0x36')](_0x400a9d,function(_0x34477e){if(_0x34477e[_0xd0b3('0x25')]!==_0xd0b3('0x37')){var _0x536e23={};_0x536e23[_0x34477e[_0xd0b3('0x20')]]={'$like':'%'+_0x1e4c8f['query']['filter']+'%'};return _0x536e23;}})});}_0x52f324=_[_0xd0b3('0x35')]({},_0x52f324,_0x1e4c8f[_0xd0b3('0x38')]);var _0x2c402c={'where':_0x52f324[_0xd0b3('0x31')]};return db[_0xd0b3('0x22')][_0xd0b3('0x18')](_0x2c402c)['then'](function(_0x463749){_0x47cc10['count']=_0x463749;if(_0x1e4c8f[_0xd0b3('0x28')][_0xd0b3('0x39')]){_0x52f324[_0xd0b3('0x3a')]=[{'all':!![]}];}return db[_0xd0b3('0x22')][_0xd0b3('0x3b')](_0x52f324);})['then'](function(_0x54b345){_0x47cc10[_0xd0b3('0x3c')]=_0x54b345;return _0x47cc10;})[_0xd0b3('0x1d')](respondWithFilteredResult(_0x43bfe7,_0x52f324))['catch'](handleError(_0x43bfe7,null));};exports['show']=function(_0x47b367,_0x3f852f){var _0x175caa={'raw':!![],'where':{'id':_0x47b367['params']['id']}},_0x2fe65={};_0x2fe65['model']=_[_0xd0b3('0x29')](db[_0xd0b3('0x22')][_0xd0b3('0x23')]);_0x2fe65[_0xd0b3('0x28')]=_['keys'](_0x47b367[_0xd0b3('0x28')]);_0x2fe65['filters']=_[_0xd0b3('0x2a')](_0x2fe65['model'],_0x2fe65[_0xd0b3('0x28')]);_0x175caa[_0xd0b3('0x2b')]=_['intersection'](_0x2fe65['model'],qs['fields'](_0x47b367[_0xd0b3('0x28')][_0xd0b3('0x2c')]));_0x175caa[_0xd0b3('0x2b')]=_0x175caa['attributes'][_0xd0b3('0x2d')]?_0x175caa[_0xd0b3('0x2b')]:_0x2fe65[_0xd0b3('0x27')];if(_0x47b367[_0xd0b3('0x28')][_0xd0b3('0x39')]){_0x175caa[_0xd0b3('0x3a')]=[{'all':!![]}];}_0x175caa=_['merge']({},_0x175caa,_0x47b367[_0xd0b3('0x38')]);return db['DeskField'][_0xd0b3('0x3d')](_0x175caa)[_0xd0b3('0x1d')](handleEntityNotFound(_0x3f852f,null))[_0xd0b3('0x1d')](respondWithResult(_0x3f852f,null))[_0xd0b3('0x3e')](handleError(_0x3f852f,null));};exports[_0xd0b3('0x3f')]=function(_0x3e666e,_0x31860b){return db[_0xd0b3('0x22')]['create'](_0x3e666e[_0xd0b3('0x40')],{})[_0xd0b3('0x1d')](respondWithResult(_0x31860b,0xc9))[_0xd0b3('0x3e')](handleError(_0x31860b,null));};exports[_0xd0b3('0x41')]=function(_0x29eaf2,_0x1478cc){if(_0x29eaf2[_0xd0b3('0x40')]['id']){delete _0x29eaf2[_0xd0b3('0x40')]['id'];}return db['DeskField']['find']({'where':{'id':_0x29eaf2[_0xd0b3('0x42')]['id']}})['then'](handleEntityNotFound(_0x1478cc,null))['then'](saveUpdates(_0x29eaf2[_0xd0b3('0x40')],null))[_0xd0b3('0x1d')](respondWithResult(_0x1478cc,null))[_0xd0b3('0x3e')](handleError(_0x1478cc,null));};exports[_0xd0b3('0x43')]=function(_0x474f37,_0x292d2b){return db[_0xd0b3('0x22')][_0xd0b3('0x3d')]({'where':{'id':_0x474f37[_0xd0b3('0x42')]['id']}})['then'](handleEntityNotFound(_0x292d2b,null))['then'](removeEntity(_0x292d2b,null))['catch'](handleError(_0x292d2b,null));}; \ No newline at end of file +var _0xb955=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb955,0x123));var _0x5b95=function(_0x322a97,_0x3f1c4b){_0x322a97=_0x322a97-0x0;var _0x316fff=_0xb955[_0x322a97];return _0x316fff;};'use strict';var emlformat=require(_0x5b95('0x0'));var rimraf=require(_0x5b95('0x1'));var zipdir=require(_0x5b95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b95('0x3'));var BPromise=require(_0x5b95('0x4'));var Mustache=require(_0x5b95('0x5'));var util=require(_0x5b95('0x6'));var path=require(_0x5b95('0x7'));var sox=require(_0x5b95('0x8'));var csv=require(_0x5b95('0x9'));var ejs=require(_0x5b95('0xa'));var fs=require('fs');var fs_extra=require(_0x5b95('0xb'));var _=require(_0x5b95('0xc'));var squel=require('squel');var crypto=require(_0x5b95('0xd'));var jsforce=require(_0x5b95('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b95('0xf'));var Papa=require(_0x5b95('0x10'));var Redis=require(_0x5b95('0x11'));var authService=require(_0x5b95('0x12'));var qs=require(_0x5b95('0x13'));var as=require(_0x5b95('0x14'));var hardwareService=require(_0x5b95('0x15'));var logger=require('../../config/logger')(_0x5b95('0x16'));var utils=require('../../config/utils');var config=require(_0x5b95('0x17'));var licenseUtil=require(_0x5b95('0x18'));var db=require(_0x5b95('0x19'))['db'];function respondWithStatusCode(_0x5d443b,_0x24b9dd){_0x24b9dd=_0x24b9dd||0xcc;return function(_0x3b5dc9){if(_0x3b5dc9){return _0x5d443b[_0x5b95('0x1a')](_0x24b9dd);}return _0x5d443b['status'](_0x24b9dd)[_0x5b95('0x1b')]();};}function respondWithResult(_0xdb23b,_0x28558c){_0x28558c=_0x28558c||0xc8;return function(_0x51b465){if(_0x51b465){return _0xdb23b[_0x5b95('0x1c')](_0x28558c)[_0x5b95('0x1d')](_0x51b465);}};}function respondWithFilteredResult(_0x52cc9d,_0x4b9a0c){return function(_0x2bbc72){if(_0x2bbc72){var _0x4f614b=typeof _0x4b9a0c[_0x5b95('0x1e')]===_0x5b95('0x1f')&&typeof _0x4b9a0c[_0x5b95('0x20')]===_0x5b95('0x1f');var _0x461859=_0x2bbc72['count'];var _0x47e7f8=_0x4f614b?0x0:_0x4b9a0c[_0x5b95('0x1e')];var _0x9a8733=_0x4f614b?_0x2bbc72[_0x5b95('0x21')]:_0x4b9a0c[_0x5b95('0x1e')]+_0x4b9a0c['limit'];var _0x33424b;if(_0x9a8733>=_0x461859){_0x9a8733=_0x461859;_0x33424b=0xc8;}else{_0x33424b=0xce;}_0x52cc9d['status'](_0x33424b);return _0x52cc9d[_0x5b95('0x22')](_0x5b95('0x23'),_0x47e7f8+'-'+_0x9a8733+'/'+_0x461859)['json'](_0x2bbc72);}return null;};}function patchUpdates(_0x636a90){return function(_0x2d24ab){try{jsonpatch[_0x5b95('0x24')](_0x2d24ab,_0x636a90,!![]);}catch(_0x2c5814){return BPromise['reject'](_0x2c5814);}return _0x2d24ab[_0x5b95('0x25')]();};}function saveUpdates(_0x242e66,_0x4acfe4){return function(_0x5d4a8e){if(_0x5d4a8e){return _0x5d4a8e[_0x5b95('0x26')](_0x242e66)[_0x5b95('0x27')](function(_0x11b9d1){return _0x11b9d1;});}return null;};}function removeEntity(_0x1720f9,_0x257e2a){return function(_0x358bcf){if(_0x358bcf){return _0x358bcf[_0x5b95('0x28')]()[_0x5b95('0x27')](function(){_0x1720f9[_0x5b95('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x533aa4,_0x1e083a){return function(_0x2b060){if(!_0x2b060){_0x533aa4[_0x5b95('0x1a')](0x194);}return _0x2b060;};}function handleError(_0x1ee5ed,_0x1ba1eb){_0x1ba1eb=_0x1ba1eb||0x1f4;return function(_0xdc0326){logger[_0x5b95('0x29')](_0xdc0326[_0x5b95('0x2a')]);if(_0xdc0326['name']){delete _0xdc0326[_0x5b95('0x2b')];}_0x1ee5ed['status'](_0x1ba1eb)[_0x5b95('0x2c')](_0xdc0326);};}exports[_0x5b95('0x2d')]=function(_0x533d70,_0x1ec3f6){var _0x1aa6f0={},_0x5329bf={},_0x5149d6={'count':0x0,'rows':[]};var _0x3b9247=_[_0x5b95('0x2e')](db[_0x5b95('0x2f')]['rawAttributes'],function(_0x3c5264){return{'name':_0x3c5264[_0x5b95('0x30')],'type':_0x3c5264[_0x5b95('0x31')][_0x5b95('0x32')]};});_0x5329bf[_0x5b95('0x33')]=_[_0x5b95('0x2e')](_0x3b9247,'name');_0x5329bf[_0x5b95('0x34')]=_[_0x5b95('0x35')](_0x533d70[_0x5b95('0x34')]);_0x5329bf[_0x5b95('0x36')]=_[_0x5b95('0x37')](_0x5329bf[_0x5b95('0x33')],_0x5329bf[_0x5b95('0x34')]);_0x1aa6f0['attributes']=_[_0x5b95('0x37')](_0x5329bf['model'],qs[_0x5b95('0x38')](_0x533d70['query'][_0x5b95('0x38')]));_0x1aa6f0[_0x5b95('0x39')]=_0x1aa6f0[_0x5b95('0x39')][_0x5b95('0x3a')]?_0x1aa6f0[_0x5b95('0x39')]:_0x5329bf[_0x5b95('0x33')];if(!_0x533d70[_0x5b95('0x34')][_0x5b95('0x3b')](_0x5b95('0x3c'))){_0x1aa6f0[_0x5b95('0x20')]=qs[_0x5b95('0x20')](_0x533d70['query'][_0x5b95('0x20')]);_0x1aa6f0[_0x5b95('0x1e')]=qs['offset'](_0x533d70[_0x5b95('0x34')][_0x5b95('0x1e')]);}_0x1aa6f0[_0x5b95('0x3d')]=qs[_0x5b95('0x3e')](_0x533d70['query']['sort']);_0x1aa6f0['where']=qs[_0x5b95('0x36')](_['pick'](_0x533d70[_0x5b95('0x34')],_0x5329bf[_0x5b95('0x36')]),_0x3b9247);if(_0x533d70[_0x5b95('0x34')][_0x5b95('0x3f')]){_0x1aa6f0[_0x5b95('0x40')]=_['merge'](_0x1aa6f0['where'],{'$or':_[_0x5b95('0x2e')](_0x3b9247,function(_0xf3c97b){if(_0xf3c97b[_0x5b95('0x31')]!==_0x5b95('0x41')){var _0x300f89={};_0x300f89[_0xf3c97b[_0x5b95('0x2b')]]={'$like':'%'+_0x533d70[_0x5b95('0x34')][_0x5b95('0x3f')]+'%'};return _0x300f89;}})});}_0x1aa6f0=_[_0x5b95('0x42')]({},_0x1aa6f0,_0x533d70[_0x5b95('0x43')]);var _0x3ad3bf={'where':_0x1aa6f0[_0x5b95('0x40')]};return db['DeskField'][_0x5b95('0x21')](_0x3ad3bf)[_0x5b95('0x27')](function(_0x3f5bee){_0x5149d6[_0x5b95('0x21')]=_0x3f5bee;if(_0x533d70[_0x5b95('0x34')][_0x5b95('0x44')]){_0x1aa6f0[_0x5b95('0x45')]=[{'all':!![]}];}return db['DeskField'][_0x5b95('0x46')](_0x1aa6f0);})['then'](function(_0x44b5ff){_0x5149d6[_0x5b95('0x47')]=_0x44b5ff;return _0x5149d6;})[_0x5b95('0x27')](respondWithFilteredResult(_0x1ec3f6,_0x1aa6f0))[_0x5b95('0x48')](handleError(_0x1ec3f6,null));};exports[_0x5b95('0x49')]=function(_0xc88da1,_0x5debfd){var _0x51edce={'raw':!![],'where':{'id':_0xc88da1[_0x5b95('0x4a')]['id']}},_0x1d4306={};_0x1d4306[_0x5b95('0x33')]=_[_0x5b95('0x35')](db[_0x5b95('0x2f')][_0x5b95('0x4b')]);_0x1d4306['query']=_[_0x5b95('0x35')](_0xc88da1[_0x5b95('0x34')]);_0x1d4306['filters']=_[_0x5b95('0x37')](_0x1d4306[_0x5b95('0x33')],_0x1d4306[_0x5b95('0x34')]);_0x51edce[_0x5b95('0x39')]=_[_0x5b95('0x37')](_0x1d4306[_0x5b95('0x33')],qs['fields'](_0xc88da1[_0x5b95('0x34')][_0x5b95('0x38')]));_0x51edce[_0x5b95('0x39')]=_0x51edce[_0x5b95('0x39')][_0x5b95('0x3a')]?_0x51edce[_0x5b95('0x39')]:_0x1d4306[_0x5b95('0x33')];if(_0xc88da1[_0x5b95('0x34')][_0x5b95('0x44')]){_0x51edce[_0x5b95('0x45')]=[{'all':!![]}];}_0x51edce=_[_0x5b95('0x42')]({},_0x51edce,_0xc88da1[_0x5b95('0x43')]);return db['DeskField']['find'](_0x51edce)[_0x5b95('0x27')](handleEntityNotFound(_0x5debfd,null))[_0x5b95('0x27')](respondWithResult(_0x5debfd,null))[_0x5b95('0x48')](handleError(_0x5debfd,null));};exports[_0x5b95('0x4c')]=function(_0x69468c,_0x434eb4){return db[_0x5b95('0x2f')]['create'](_0x69468c['body'],{})[_0x5b95('0x27')](respondWithResult(_0x434eb4,0xc9))[_0x5b95('0x48')](handleError(_0x434eb4,null));};exports[_0x5b95('0x26')]=function(_0xf30e46,_0x2bf2db){if(_0xf30e46[_0x5b95('0x4d')]['id']){delete _0xf30e46['body']['id'];}return db[_0x5b95('0x2f')][_0x5b95('0x4e')]({'where':{'id':_0xf30e46['params']['id']}})[_0x5b95('0x27')](handleEntityNotFound(_0x2bf2db,null))[_0x5b95('0x27')](saveUpdates(_0xf30e46[_0x5b95('0x4d')],null))[_0x5b95('0x27')](respondWithResult(_0x2bf2db,null))[_0x5b95('0x48')](handleError(_0x2bf2db,null));};exports[_0x5b95('0x28')]=function(_0x258fad,_0x55bdab){return db[_0x5b95('0x2f')][_0x5b95('0x4e')]({'where':{'id':_0x258fad['params']['id']}})[_0x5b95('0x27')](handleEntityNotFound(_0x55bdab,null))[_0x5b95('0x27')](removeEntity(_0x55bdab,null))[_0x5b95('0x48')](handleError(_0x55bdab,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6f74e76..9676b77 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 _0xb205=['bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xb205,0x1eb));var _0x5b20=function(_0x440f7d,_0x4db6d9){_0x440f7d=_0x440f7d-0x0;var _0x1bfd40=_0xb205[_0x440f7d];return _0x1bfd40;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require('moment');var BPromise=require(_0x5b20('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x5'));var rimraf=require(_0x5b20('0x6'));var config=require(_0x5b20('0x7'));var attributes=require(_0x5b20('0x8'));module[_0x5b20('0x9')]=function(_0x2430c2,_0x5509a5){return _0x2430c2['define'](_0x5b20('0xa'),attributes,{'tableName':_0x5b20('0xb'),'paranoid':![],'indexes':[{'name':_0x5b20('0xc'),'fields':[_0x5b20('0xd'),_0x5b20('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cbf=['int_desk_fields','idField','FieldId','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField'];(function(_0x39fb96,_0xfa3a2a){var _0x4c3143=function(_0x1bdd9b){while(--_0x1bdd9b){_0x39fb96['push'](_0x39fb96['shift']());}};_0x4c3143(++_0xfa3a2a);}(_0x5cbf,0x9f));var _0xf5cb=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x5cbf[_0x186376];return _0x2dbdd9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5cb('0x0'))(_0xf5cb('0x1'));var moment=require(_0xf5cb('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5cb('0x3'));var fs=require('fs');var path=require(_0xf5cb('0x4'));var rimraf=require(_0xf5cb('0x5'));var config=require(_0xf5cb('0x6'));var attributes=require(_0xf5cb('0x7'));module[_0xf5cb('0x8')]=function(_0x1ca071,_0x52568f){return _0x1ca071['define'](_0xf5cb('0x9'),attributes,{'tableName':_0xf5cb('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xf5cb('0xb'),_0xf5cb('0xc')],'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 b395e07..354dd96 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 _0x9ec2=['request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x22b2e6,_0x15e9d4){var _0x278077=function(_0x11a7bb){while(--_0x11a7bb){_0x22b2e6['push'](_0x22b2e6['shift']());}};_0x278077(++_0x15e9d4);}(_0x9ec2,0xee));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x29ec('0x0'));var BPromise=require(_0x29ec('0x1'));var rs=require(_0x29ec('0x2'));var fs=require('fs');var Redis=require(_0x29ec('0x3'));var db=require(_0x29ec('0x4'))['db'];var utils=require(_0x29ec('0x5'));var logger=require(_0x29ec('0x6'))('rpc');var config=require(_0x29ec('0x7'));var jayson=require(_0x29ec('0x8'));var client=jayson[_0x29ec('0x9')][_0x29ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x95ee31,_0x126d99,_0x39e30c){return new BPromise(function(_0x121dd3,_0x140c2b){return client[_0x29ec('0xb')](_0x95ee31,_0x39e30c)[_0x29ec('0xc')](function(_0x5ea113){logger[_0x29ec('0xd')]('DeskField,\x20%s,\x20%s',_0x126d99,'request\x20sent');logger[_0x29ec('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x126d99,_0x29ec('0xf'),JSON[_0x29ec('0x10')](_0x5ea113));if(_0x5ea113[_0x29ec('0x11')]){if(_0x5ea113['error'][_0x29ec('0x12')]===0x1f4){logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x126d99,_0x5ea113[_0x29ec('0x11')][_0x29ec('0x14')]);return _0x140c2b(_0x5ea113[_0x29ec('0x11')][_0x29ec('0x14')]);}logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x126d99,_0x5ea113[_0x29ec('0x11')][_0x29ec('0x14')]);return _0x121dd3(_0x5ea113['error'][_0x29ec('0x14')]);}else{logger[_0x29ec('0xd')](_0x29ec('0x13'),_0x126d99,_0x29ec('0xf'));_0x121dd3(_0x5ea113[_0x29ec('0x15')][_0x29ec('0x14')]);}})[_0x29ec('0x16')](function(_0x5e2177){logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x126d99,_0x5e2177);_0x140c2b(_0x5e2177);});});} \ No newline at end of file +var _0x9a32=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x379162,_0x4234c0){var _0x897bd4=function(_0x1e0da1){while(--_0x1e0da1){_0x379162['push'](_0x379162['shift']());}};_0x897bd4(++_0x4234c0);}(_0x9a32,0xd1));var _0x29a3=function(_0x244911,_0x54bed9){_0x244911=_0x244911-0x0;var _0x1218e6=_0x9a32[_0x244911];return _0x1218e6;};'use strict';var _=require(_0x29a3('0x0'));var util=require(_0x29a3('0x1'));var moment=require(_0x29a3('0x2'));var BPromise=require(_0x29a3('0x3'));var rs=require(_0x29a3('0x4'));var fs=require('fs');var Redis=require(_0x29a3('0x5'));var db=require(_0x29a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x29a3('0x7'))(_0x29a3('0x8'));var config=require('../../config/environment');var jayson=require(_0x29a3('0x9'));var client=jayson['client'][_0x29a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29bd63,_0x536ae6,_0x5d87e3){return new BPromise(function(_0xabdaea,_0x495c3f){return client[_0x29a3('0xb')](_0x29bd63,_0x5d87e3)[_0x29a3('0xc')](function(_0x1c05c9){logger[_0x29a3('0xd')](_0x29a3('0xe'),_0x536ae6,_0x29a3('0xf'));logger[_0x29a3('0x10')](_0x29a3('0x11'),_0x536ae6,'request\x20sent',JSON[_0x29a3('0x12')](_0x1c05c9));if(_0x1c05c9['error']){if(_0x1c05c9[_0x29a3('0x13')][_0x29a3('0x14')]===0x1f4){logger['error'](_0x29a3('0xe'),_0x536ae6,_0x1c05c9['error'][_0x29a3('0x15')]);return _0x495c3f(_0x1c05c9[_0x29a3('0x13')][_0x29a3('0x15')]);}logger[_0x29a3('0x13')](_0x29a3('0xe'),_0x536ae6,_0x1c05c9['error'][_0x29a3('0x15')]);return _0xabdaea(_0x1c05c9[_0x29a3('0x13')][_0x29a3('0x15')]);}else{logger['info'](_0x29a3('0xe'),_0x536ae6,_0x29a3('0xf'));_0xabdaea(_0x1c05c9[_0x29a3('0x16')][_0x29a3('0x15')]);}})['catch'](function(_0x4c2937){logger[_0x29a3('0x13')](_0x29a3('0xe'),_0x536ae6,_0x4c2937);_0x495c3f(_0x4c2937);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3cd8410..bd30f7b 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 _0xb6e0=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x8ed2fe,_0x19ca78){var _0x23a751=function(_0x412f75){while(--_0x412f75){_0x8ed2fe['push'](_0x8ed2fe['shift']());}};_0x23a751(++_0x19ca78);}(_0xb6e0,0x10a));var _0x0b6e=function(_0x10abf1,_0x5e3238){_0x10abf1=_0x10abf1-0x0;var _0xab622a=_0xb6e0[_0x10abf1];return _0xab622a;};'use strict';var multer=require(_0x0b6e('0x0'));var util=require(_0x0b6e('0x1'));var path=require('path');var timeout=require(_0x0b6e('0x2'));var express=require(_0x0b6e('0x3'));var router=express[_0x0b6e('0x4')]();var fs_extra=require(_0x0b6e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b6e('0x6'));var config=require('../../config/environment');var controller=require(_0x0b6e('0x7'));router[_0x0b6e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b6e('0x9')]);router[_0x0b6e('0x8')](_0x0b6e('0xa'),auth[_0x0b6e('0xb')](),controller[_0x0b6e('0xc')]);router[_0x0b6e('0x8')](_0x0b6e('0xd'),auth['isAuthenticated'](),controller[_0x0b6e('0xe')]);router[_0x0b6e('0x8')](_0x0b6e('0xf'),auth[_0x0b6e('0xb')](),controller['getFields']);router[_0x0b6e('0x10')]('/',auth[_0x0b6e('0xb')](),controller[_0x0b6e('0x11')]);router['post'](_0x0b6e('0xd'),auth[_0x0b6e('0xb')](),controller[_0x0b6e('0x12')]);router[_0x0b6e('0x13')](_0x0b6e('0xa'),auth['isAuthenticated'](),controller[_0x0b6e('0x14')]);router[_0x0b6e('0x15')](_0x0b6e('0xa'),auth[_0x0b6e('0xb')](),controller[_0x0b6e('0x16')]);module[_0x0b6e('0x17')]=router; \ No newline at end of file +var _0xc1da=['/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','get','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x18a52c,_0x4a0f28){var _0xa2a5fe=function(_0x63b429){while(--_0x63b429){_0x18a52c['push'](_0x18a52c['shift']());}};_0xa2a5fe(++_0x4a0f28);}(_0xc1da,0x13f));var _0xac1d=function(_0x3d6048,_0x2107b7){_0x3d6048=_0x3d6048-0x0;var _0x17fa52=_0xc1da[_0x3d6048];return _0x17fa52;};'use strict';var multer=require(_0xac1d('0x0'));var util=require(_0xac1d('0x1'));var path=require(_0xac1d('0x2'));var timeout=require(_0xac1d('0x3'));var express=require(_0xac1d('0x4'));var router=express['Router']();var fs_extra=require(_0xac1d('0x5'));var auth=require(_0xac1d('0x6'));var interaction=require(_0xac1d('0x7'));var config=require(_0xac1d('0x8'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xac1d('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xac1d('0xa')]);router[_0xac1d('0xb')]('/:id/configurations',auth[_0xac1d('0x9')](),controller[_0xac1d('0xc')]);router['get'](_0xac1d('0xd'),auth[_0xac1d('0x9')](),controller[_0xac1d('0xe')]);router[_0xac1d('0xf')]('/',auth[_0xac1d('0x9')](),controller[_0xac1d('0x10')]);router[_0xac1d('0xf')](_0xac1d('0x11'),auth[_0xac1d('0x9')](),controller[_0xac1d('0x12')]);router[_0xac1d('0x13')](_0xac1d('0x14'),auth[_0xac1d('0x9')](),controller[_0xac1d('0x15')]);router['delete']('/:id',auth[_0xac1d('0x9')](),controller[_0xac1d('0x16')]);module[_0xac1d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1dad70f..b7c5b59 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 _0x9a14=['STRING'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x9a14,0xa8));var _0x49a1=function(_0x4787fe,_0x24f2f1){_0x4787fe=_0x4787fe-0x0;var _0x5073bd=_0x9a14[_0x4787fe];return _0x5073bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49a1('0x0')]},'username':{'type':Sequelize[_0x49a1('0x0')]},'password':{'type':Sequelize[_0x49a1('0x0')]},'remoteUri':{'type':Sequelize[_0x49a1('0x0')]},'tenantId':{'type':Sequelize[_0x49a1('0x0')]},'clientId':{'type':Sequelize[_0x49a1('0x0')]},'clientSecret':{'type':Sequelize[_0x49a1('0x0')]},'serverUrl':{'type':Sequelize[_0x49a1('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xff3c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xff3c,0x179));var _0xcff3=function(_0x79d30f,_0x298c71){_0x79d30f=_0x79d30f-0x0;var _0x53b34c=_0xff3c[_0x79d30f];return _0x53b34c;};'use strict';var Sequelize=require(_0xcff3('0x0'));module[_0xcff3('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcff3('0x2')]},'password':{'type':Sequelize[_0xcff3('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcff3('0x2')]},'clientSecret':{'type':Sequelize[_0xcff3('0x2')]},'serverUrl':{'type':Sequelize[_0xcff3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcff3('0x2')]},'modernAuthentication':{'type':Sequelize[_0xcff3('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 1f7bc3d..65c745c 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 _0x6c29=['escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Label','TrueOption','true','OptionSet','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Dynamics365Account','includeAll','include','catch','show','params','find','body','destroy','getConfigurations','findOne','Dynamics365Configuration','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp'];(function(_0x2edb29,_0x369171){var _0x3fdef3=function(_0x2396f1){while(--_0x2396f1){_0x2edb29['push'](_0x2edb29['shift']());}};_0x3fdef3(++_0x369171);}(_0x6c29,0x1c1));var _0x96c2=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0x6c29[_0x168127];return _0x4c99ad;};'use strict';var rp=require(_0x96c2('0x0'));var util=require(_0x96c2('0x1'));var _=require(_0x96c2('0x2'));var qs=require(_0x96c2('0x3'));var logger=require(_0x96c2('0x4'))(_0x96c2('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x20ac16,_0x1ba8ad){_0x1ba8ad=_0x1ba8ad||0xc8;return function(_0x5c84c4){if(_0x5c84c4){return _0x20ac16[_0x96c2('0x6')](_0x1ba8ad)[_0x96c2('0x7')](_0x5c84c4);}};}function respondWithFilteredResult(_0x2ee7c6,_0x2f9b84){return function(_0x4e15bd){if(_0x4e15bd){var _0x3dbbc2=typeof _0x2f9b84[_0x96c2('0x8')]===_0x96c2('0x9')&&typeof _0x2f9b84[_0x96c2('0xa')]===_0x96c2('0x9');var _0x51ac69=_0x4e15bd[_0x96c2('0xb')];var _0x3438f1=_0x3dbbc2?0x0:_0x2f9b84[_0x96c2('0x8')];var _0x4f2134=_0x3dbbc2?_0x4e15bd['count']:_0x2f9b84[_0x96c2('0x8')]+_0x2f9b84[_0x96c2('0xa')];var _0x3ac4e2;if(_0x4f2134>=_0x51ac69){_0x4f2134=_0x51ac69;_0x3ac4e2=0xc8;}else{_0x3ac4e2=0xce;}_0x2ee7c6['status'](_0x3ac4e2);return _0x2ee7c6[_0x96c2('0xc')](_0x96c2('0xd'),_0x3438f1+'-'+_0x4f2134+'/'+_0x51ac69)[_0x96c2('0x7')](_0x4e15bd);}return null;};}function saveUpdates(_0x605573){return function(_0xa933c3){if(_0xa933c3){return _0xa933c3[_0x96c2('0xe')](_0x605573)[_0x96c2('0xf')](function(_0x294a1f){return _0x294a1f;});}return null;};}function removeEntity(_0x160433){return function(_0x38f87e){if(_0x38f87e){return _0x38f87e['destroy']()[_0x96c2('0xf')](function(){_0x160433['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420400){return function(_0x4bd8f9){if(!_0x4bd8f9){_0x420400[_0x96c2('0x10')](0x194);}return _0x4bd8f9;};}function handleError(_0x382707,_0x5472e5){_0x5472e5=_0x5472e5||0x1f4;return function(_0x3d4300){logger[_0x96c2('0x11')](_0x3d4300[_0x96c2('0x12')]);if(_0x3d4300[_0x96c2('0x13')]){delete _0x3d4300[_0x96c2('0x13')];}_0x382707['status'](_0x5472e5)[_0x96c2('0x14')](_0x3d4300);};}exports[_0x96c2('0x15')]=function(_0x161c32,_0xf4d354){var _0x4e1f88={},_0x32bfaa={},_0x47a875={'count':0x0,'rows':[]};var _0x5a296f=_[_0x96c2('0x16')](db['Dynamics365Account'][_0x96c2('0x17')],function(_0x1964af){return{'name':_0x1964af[_0x96c2('0x18')],'type':_0x1964af[_0x96c2('0x19')]['key']};});_0x32bfaa[_0x96c2('0x1a')]=_['map'](_0x5a296f,_0x96c2('0x13'));_0x32bfaa['query']=_[_0x96c2('0x1b')](_0x161c32[_0x96c2('0x1c')]);_0x32bfaa[_0x96c2('0x1d')]=_[_0x96c2('0x1e')](_0x32bfaa[_0x96c2('0x1a')],_0x32bfaa[_0x96c2('0x1c')]);_0x4e1f88['attributes']=_[_0x96c2('0x1e')](_0x32bfaa[_0x96c2('0x1a')],qs[_0x96c2('0x1f')](_0x161c32[_0x96c2('0x1c')][_0x96c2('0x1f')]));_0x4e1f88[_0x96c2('0x20')]=_0x4e1f88[_0x96c2('0x20')][_0x96c2('0x21')]?_0x4e1f88[_0x96c2('0x20')]:_0x32bfaa['model'];if(!_0x161c32[_0x96c2('0x1c')][_0x96c2('0x22')](_0x96c2('0x23'))){_0x4e1f88['limit']=qs[_0x96c2('0xa')](_0x161c32[_0x96c2('0x1c')][_0x96c2('0xa')]);_0x4e1f88['offset']=qs[_0x96c2('0x8')](_0x161c32[_0x96c2('0x1c')][_0x96c2('0x8')]);}_0x4e1f88[_0x96c2('0x24')]=qs[_0x96c2('0x25')](_0x161c32[_0x96c2('0x1c')]['sort']);_0x4e1f88[_0x96c2('0x26')]=qs['filters'](_[_0x96c2('0x27')](_0x161c32['query'],_0x32bfaa['filters']),_0x5a296f);if(_0x161c32[_0x96c2('0x1c')][_0x96c2('0x28')]){_0x4e1f88[_0x96c2('0x26')]=_['merge'](_0x4e1f88[_0x96c2('0x26')],{'$or':_[_0x96c2('0x16')](_0x5a296f,function(_0x277c09){if(_0x277c09[_0x96c2('0x19')]!==_0x96c2('0x29')){var _0x4eb7e9={};_0x4eb7e9[_0x277c09[_0x96c2('0x13')]]={'$like':'%'+_0x161c32[_0x96c2('0x1c')][_0x96c2('0x28')]+'%'};return _0x4eb7e9;}})});}_0x4e1f88=_[_0x96c2('0x2a')]({},_0x4e1f88,_0x161c32['options']);var _0xf65435={'where':_0x4e1f88[_0x96c2('0x26')]};return db[_0x96c2('0x2b')][_0x96c2('0xb')](_0xf65435)['then'](function(_0x3c6790){_0x47a875['count']=_0x3c6790;if(_0x161c32[_0x96c2('0x1c')][_0x96c2('0x2c')]){_0x4e1f88[_0x96c2('0x2d')]=[{'all':!![]}];}return db[_0x96c2('0x2b')]['findAll'](_0x4e1f88);})[_0x96c2('0xf')](function(_0x18c0bf){_0x47a875['rows']=_0x18c0bf;return _0x47a875;})[_0x96c2('0xf')](respondWithFilteredResult(_0xf4d354,_0x4e1f88))[_0x96c2('0x2e')](handleError(_0xf4d354,null));};exports[_0x96c2('0x2f')]=function(_0x3034fb,_0x81e447){var _0x4b6d6a={'raw':![],'where':{'id':_0x3034fb[_0x96c2('0x30')]['id']}},_0x34e753={};_0x34e753[_0x96c2('0x1a')]=_[_0x96c2('0x1b')](db[_0x96c2('0x2b')]['rawAttributes']);_0x34e753[_0x96c2('0x1c')]=_['keys'](_0x3034fb[_0x96c2('0x1c')]);_0x34e753[_0x96c2('0x1d')]=_[_0x96c2('0x1e')](_0x34e753['model'],_0x34e753['query']);_0x4b6d6a[_0x96c2('0x20')]=_[_0x96c2('0x1e')](_0x34e753['model'],qs[_0x96c2('0x1f')](_0x3034fb['query'][_0x96c2('0x1f')]));_0x4b6d6a[_0x96c2('0x20')]=_0x4b6d6a[_0x96c2('0x20')][_0x96c2('0x21')]?_0x4b6d6a[_0x96c2('0x20')]:_0x34e753['model'];if(_0x3034fb['query'][_0x96c2('0x2c')]){_0x4b6d6a[_0x96c2('0x2d')]=[{'all':!![]}];}_0x4b6d6a=_[_0x96c2('0x2a')]({},_0x4b6d6a,_0x3034fb['options']);return db[_0x96c2('0x2b')][_0x96c2('0x31')](_0x4b6d6a)['then'](handleEntityNotFound(_0x81e447,null))[_0x96c2('0xf')](respondWithResult(_0x81e447,null))[_0x96c2('0x2e')](handleError(_0x81e447,null));};exports['create']=function(_0x3323d4,_0xd1d6df){return db[_0x96c2('0x2b')]['create'](_0x3323d4[_0x96c2('0x32')],{})['then'](respondWithResult(_0xd1d6df,0xc9))[_0x96c2('0x2e')](handleError(_0xd1d6df,null));};exports[_0x96c2('0xe')]=function(_0x212c60,_0x4cce7b){if(_0x212c60[_0x96c2('0x32')]['id']){delete _0x212c60[_0x96c2('0x32')]['id'];}return db['Dynamics365Account'][_0x96c2('0x31')]({'where':{'id':_0x212c60[_0x96c2('0x30')]['id']}})[_0x96c2('0xf')](handleEntityNotFound(_0x4cce7b,null))[_0x96c2('0xf')](saveUpdates(_0x212c60['body'],null))[_0x96c2('0xf')](respondWithResult(_0x4cce7b,null))[_0x96c2('0x2e')](handleError(_0x4cce7b,null));};exports[_0x96c2('0x33')]=function(_0x4d6b02,_0x2ac67e){return db[_0x96c2('0x2b')][_0x96c2('0x31')]({'where':{'id':_0x4d6b02[_0x96c2('0x30')]['id']}})['then'](handleEntityNotFound(_0x2ac67e,null))[_0x96c2('0xf')](removeEntity(_0x2ac67e,null))[_0x96c2('0x2e')](handleError(_0x2ac67e,null));};exports[_0x96c2('0x34')]=function(_0x2aae23,_0x1a5a7a){var _0xa78d42={};var _0x369fd3={};var _0x168ad6;var _0x3b5ab2;return db[_0x96c2('0x2b')][_0x96c2('0x35')]({'where':{'id':_0x2aae23[_0x96c2('0x30')]['id']}})[_0x96c2('0xf')](handleEntityNotFound(_0x1a5a7a,null))[_0x96c2('0xf')](function(_0x1f994e){if(_0x1f994e){_0x168ad6=_0x1f994e;_0x369fd3[_0x96c2('0x1a')]=_[_0x96c2('0x1b')](db[_0x96c2('0x36')][_0x96c2('0x17')]);_0x369fd3[_0x96c2('0x1c')]=_[_0x96c2('0x1b')](_0x2aae23['query']);_0x369fd3[_0x96c2('0x1d')]=_[_0x96c2('0x1e')](_0x369fd3[_0x96c2('0x1a')],_0x369fd3[_0x96c2('0x1c')]);_0xa78d42[_0x96c2('0x20')]=_[_0x96c2('0x1e')](_0x369fd3[_0x96c2('0x1a')],qs[_0x96c2('0x1f')](_0x2aae23[_0x96c2('0x1c')][_0x96c2('0x1f')]));_0xa78d42[_0x96c2('0x20')]=_0xa78d42[_0x96c2('0x20')][_0x96c2('0x21')]?_0xa78d42[_0x96c2('0x20')]:_0x369fd3[_0x96c2('0x1a')];_0xa78d42['order']=qs[_0x96c2('0x25')](_0x2aae23[_0x96c2('0x1c')][_0x96c2('0x25')]);_0xa78d42[_0x96c2('0x26')]=qs[_0x96c2('0x1d')](_[_0x96c2('0x27')](_0x2aae23[_0x96c2('0x1c')],_0x369fd3[_0x96c2('0x1d')]));if(_0x2aae23[_0x96c2('0x1c')][_0x96c2('0x28')]){_0xa78d42['where']=_[_0x96c2('0x2a')](_0xa78d42[_0x96c2('0x26')],{'$or':_['map'](_0xa78d42[_0x96c2('0x20')],function(_0x468ed4){var _0x132ac6={};_0x132ac6[_0x468ed4]={'$like':'%'+_0x2aae23[_0x96c2('0x1c')][_0x96c2('0x28')]+'%'};return _0x132ac6;})});}_0xa78d42=_[_0x96c2('0x2a')]({},_0xa78d42,_0x2aae23[_0x96c2('0x37')]);return _0x168ad6[_0x96c2('0x34')](_0xa78d42);}})[_0x96c2('0xf')](function(_0xf65833){if(_0xf65833){_0x3b5ab2=_0xf65833['length'];if(!_0x2aae23[_0x96c2('0x1c')][_0x96c2('0x22')](_0x96c2('0x23'))){_0xa78d42['limit']=qs[_0x96c2('0xa')](_0x2aae23[_0x96c2('0x1c')][_0x96c2('0xa')]);_0xa78d42['offset']=qs[_0x96c2('0x8')](_0x2aae23['query'][_0x96c2('0x8')]);}return _0x168ad6[_0x96c2('0x34')](_0xa78d42);}})[_0x96c2('0xf')](function(_0x44305b){if(_0x44305b){return _0x44305b?{'count':_0x3b5ab2,'rows':_0x44305b}:null;}})[_0x96c2('0xf')](respondWithResult(_0x1a5a7a,null))[_0x96c2('0x2e')](handleError(_0x1a5a7a,null));};exports[_0x96c2('0x38')]=function(_0x180c8b,_0x9a1340){if(_0x180c8b[_0x96c2('0x32')]['id']){delete _0x180c8b[_0x96c2('0x32')]['id'];}return db[_0x96c2('0x2b')][_0x96c2('0x35')]({'where':{'id':_0x180c8b['params']['id']}})[_0x96c2('0xf')](handleEntityNotFound(_0x9a1340,null))[_0x96c2('0xf')](function(_0x263e07){if(_0x263e07){_0x180c8b[_0x96c2('0x32')][_0x96c2('0x39')]=_0x263e07['id'];_0x180c8b[_0x96c2('0x32')][_0x96c2('0x3a')]=integrations[_0x96c2('0x3b')](_0x180c8b[_0x96c2('0x32')][_0x96c2('0x3c')],_0x180c8b['body'][_0x96c2('0x19')]);_0x180c8b[_0x96c2('0x32')][_0x96c2('0x3d')]=integrations['getDescriptions'](_0x180c8b[_0x96c2('0x32')][_0x96c2('0x3c')],_0x180c8b[_0x96c2('0x32')]['type']);return db[_0x96c2('0x36')][_0x96c2('0x3e')](_0x180c8b[_0x96c2('0x32')],{'include':[{'model':db[_0x96c2('0x3f')],'as':_0x96c2('0x3a')},{'model':db[_0x96c2('0x3f')],'as':_0x96c2('0x3d')}]});}return null;})['then'](respondWithResult(_0x9a1340,null))[_0x96c2('0x2e')](handleError(_0x9a1340,null));};function sanitizeRemoteUri(_0x4db348){var _0x182366=_0x4db348[_0x96c2('0x40')](-0x1);if(_0x182366==='/')return _0x4db348[_0x96c2('0x41')](0x0,_0x4db348[_0x96c2('0x42')](_0x182366));return _0x4db348;}function getWebApiUrl(_0x5f3e61){return util['format'](_0x96c2('0x43'),_0x5f3e61);}exports['getFields']=function(_0x4673fa,_0x436bfb){var _0x161f86=_0x4673fa['query']['ticketType'];var _0x54acfa=_0x161f86===_0x96c2('0x44')?'Incident':_0x96c2('0x45');var _0x156b41='';var _0x10b465='';var _0x549cf1='';var _0x33d9ad='';var _0x37a0cb='';var _0x5f1577='';var _0x4557c4='';var _0x496635='';var _0x386953=['title',_0x96c2('0x46'),_0x96c2('0x47'),_0x96c2('0x48'),_0x96c2('0x49'),_0x96c2('0x4a'),'phonenumber',_0x96c2('0x4b'),_0x96c2('0x4c'),_0x96c2('0x4d')];var _0xb22357=['accountidname',_0x96c2('0x4e'),'actualserviceunits',_0x96c2('0x4f'),_0x96c2('0x50'),_0x96c2('0x51'),'contractdetailidname',_0x96c2('0x52'),'createdbyexternalpartyname',_0x96c2('0x53'),_0x96c2('0x54'),_0x96c2('0x55'),_0x96c2('0x56'),_0x96c2('0x57'),_0x96c2('0x58'),_0x96c2('0x59'),_0x96c2('0x5a'),_0x96c2('0x5b'),'emailaddress',_0x96c2('0x5c'),_0x96c2('0x5d'),'entityimage_url',_0x96c2('0x5e'),_0x96c2('0x5f'),_0x96c2('0x60'),_0x96c2('0x61'),_0x96c2('0x62'),_0x96c2('0x63'),'kbarticleidname','lastonholdtime',_0x96c2('0x64'),_0x96c2('0x65'),'modifiedbyexternalpartyyominame',_0x96c2('0x66'),_0x96c2('0x67'),_0x96c2('0x68'),_0x96c2('0x69'),_0x96c2('0x6a'),_0x96c2('0x6b'),_0x96c2('0x6c'),_0x96c2('0x6d'),'onholdtime',_0x96c2('0x6e'),_0x96c2('0x6f'),_0x96c2('0x70'),'owneridyominame',_0x96c2('0x71'),_0x96c2('0x72'),'primarycontactidyominame',_0x96c2('0x73'),'productidname',_0x96c2('0x74'),_0x96c2('0x75'),_0x96c2('0x76'),_0x96c2('0x77'),'responsiblecontactidname',_0x96c2('0x78'),'sentimentvalue',_0x96c2('0x79'),'slaname',_0x96c2('0x7a'),_0x96c2('0x7b'),_0x96c2('0x7c'),_0x96c2('0x7d'),_0x96c2('0x7e'),_0x96c2('0x7f'),_0x96c2('0x80'),_0x96c2('0x81'),'utcconversiontimezonecode',_0x96c2('0x82')];var _0x154ddf=_0x386953['concat'](_0xb22357);return db[_0x96c2('0x2b')]['findOne']({'where':{'id':_0x4673fa['params']['id']},'attributes':['id',_0x96c2('0x83'),_0x96c2('0x84'),'remoteUri',_0x96c2('0x85'),_0x96c2('0x86'),_0x96c2('0x87'),_0x96c2('0x88')],'include':[{'model':db[_0x96c2('0x89')],'as':_0x96c2('0x89'),'attributes':['id',_0x96c2('0x8a'),_0x96c2('0x8b')]}]})[_0x96c2('0xf')](handleEntityNotFound(_0x436bfb,null))[_0x96c2('0xf')](function(_0x5502bb){if(_0x5502bb){if(_0x5502bb[_0x96c2('0x88')]){_0x5502bb[_0x96c2('0x8c')]=_0x5502bb[_0x96c2('0x89')][_0x96c2('0x8a')];_0x496635=sanitizeRemoteUri(_0x5502bb['CloudProvider'][_0x96c2('0x8b')]);_0x4557c4=getWebApiUrl(_0x496635);return _0x5502bb;}_0x496635=sanitizeRemoteUri(_0x5502bb['remoteUri']);_0x4557c4=getWebApiUrl(_0x496635);var _0x4ec3e1={'method':'POST','uri':_0x96c2('0x8d')+_0x5502bb[_0x96c2('0x85')]+'/oauth2/token','form':{'client_id':_0x5502bb[_0x96c2('0x86')],'resource':_0x496635,'username':_0x5502bb[_0x96c2('0x83')],'password':_0x5502bb[_0x96c2('0x84')],'grant_type':_0x96c2('0x84'),'client_secret':_0x5502bb[_0x96c2('0x87')]},'json':!![]};return rp(_0x4ec3e1);}})[_0x96c2('0xf')](function(_0x1aa246){_0x5f1577=_0x1aa246[_0x96c2('0x8c')];var _0xe563={'method':_0x96c2('0x8e'),'uri':encodeURI(_0x4557c4+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x54acfa+'\x27'),'headers':{'Authorization':_0x96c2('0x8f')+_0x5f1577,'If-None-Match':null,'OData-Version':_0x96c2('0x90')},'json':!![]};return rp(_0xe563);})[_0x96c2('0xf')](function(_0x51510a){var _0x344db4=_0x51510a['value'][0x0];var _0x2414cb=_0x344db4[_0x96c2('0x91')];var _0x461b0d={'method':_0x96c2('0x8e'),'uri':_0x4557c4+_0x96c2('0x92')+_0x2414cb+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x96c2('0x8f')+_0x5f1577,'If-None-Match':null,'OData-Version':_0x96c2('0x90')},'json':!![]};return rp(_0x461b0d);})[_0x96c2('0xf')](function(_0x5013f1){_0x156b41=_0x5013f1;_0x10b465=_0x156b41[_0x96c2('0x93')];_0x10b465=_[_0x96c2('0x94')](_0x10b465,function(_0x525b4b){return!_0x154ddf[_0x96c2('0x95')](_0x525b4b[_0x96c2('0x96')]);});var _0xc3a907=[];var _0x37d80b=[];_0x10b465[_0x96c2('0x97')](function(_0x32b828){if(_0x32b828[_0x96c2('0x98')]){var _0x336c1c=_0x32b828['@odata.type'][_0x96c2('0x41')](_0x32b828['@odata.type'][_0x96c2('0x42')]('.')+0x1);if(_0x336c1c===_0x96c2('0x99')){_0xc3a907[_0x96c2('0x9a')](getSelectList(_0x4557c4,_0x161f86,_0x37d80b,_0x156b41['MetadataId'],_0x32b828[_0x96c2('0x91')],_0x5f1577));}}});return Promise[_0x96c2('0x9b')](_0xc3a907);})['then'](function(_0x116fff){_0x549cf1=_0x116fff[0x0];var _0x564af8=[];var _0xfa6483=[];_0x10b465[_0x96c2('0x97')](function(_0x59d063){if(!_[_0x96c2('0x9c')](_0x59d063[_0x96c2('0x98')])){var _0x49d185=_0x59d063['@odata.type']['substring'](_0x59d063[_0x96c2('0x98')][_0x96c2('0x42')]('.')+0x1);if(_0x49d185==='BooleanAttributeMetadata'){_0x564af8[_0x96c2('0x9a')](getBooleanList(_0x4557c4,_0x161f86,_0xfa6483,_0x156b41[_0x96c2('0x91')],_0x59d063['MetadataId'],_0x5f1577));}}});return Promise[_0x96c2('0x9b')](_0x564af8);})[_0x96c2('0xf')](function(_0x4872e6){_0x33d9ad=_0x4872e6[0x0];var _0x4822ef=[];var _0x4a8ea7=[];_0x10b465[_0x96c2('0x97')](function(_0x339498){if(_0x339498[_0x96c2('0x98')]){var _0x585495=_0x339498[_0x96c2('0x98')][_0x96c2('0x41')](_0x339498[_0x96c2('0x98')][_0x96c2('0x42')]('.')+0x1);if(_0x585495===_0x96c2('0x9d')||_0x585495===_0x96c2('0x9e')||_0x585495==='BigIntAttributeMetadata'||_0x585495===_0x96c2('0x9f')||_0x585495===_0x96c2('0xa0')||_0x585495===_0x96c2('0xa1')||_0x585495==='StatusAttributeMetadata'||_0x585495===_0x96c2('0xa2')||_0x585495===_0x96c2('0xa3')||_0x585495===_0x96c2('0xa4')){_0x4822ef[_0x96c2('0x9a')](getInputList(_0x4557c4,_0x161f86,_0x585495,_0x4a8ea7,_0x156b41[_0x96c2('0x91')],_0x339498['MetadataId'],_0x5f1577));}}});return Promise[_0x96c2('0x9b')](_0x4822ef);})[_0x96c2('0xf')](function(_0x4117fc){_0x37a0cb=_0x4117fc[0x0];var _0x2914ec=_0x549cf1['concat'](_0x33d9ad)[_0x96c2('0xa5')](_0x37a0cb);var _0x4e1250={'count':_0x2914ec[_0x96c2('0x21')],'rows':_0x2914ec};return _0x4e1250;})['then'](respondWithResult(_0x436bfb,null))[_0x96c2('0x2e')](function(_0x22c7d2){var _0xd99e74=_0x4673fa[_0x96c2('0x1c')][_0x96c2('0xa6')]?0x1f4:_0x22c7d2[_0x96c2('0xa7')]||0x1f4;logger[_0x96c2('0x11')](_0x22c7d2[_0x96c2('0x12')]);delete _0x22c7d2[_0x96c2('0x13')];if(_0xd99e74===0x191){_0xd99e74=0x190;}_0x436bfb[_0x96c2('0x6')](_0xd99e74)[_0x96c2('0x14')](_0x4673fa[_0x96c2('0x1c')][_0x96c2('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x22c7d2[_0x96c2('0xa7')]}:_0x22c7d2);});};function getSelectList(_0x71bffa,_0x4b7e7a,_0xe40981,_0x159966,_0x562eda,_0x4b9390){var _0xc2e7f3={'method':_0x96c2('0x8e'),'uri':_0x71bffa+_0x96c2('0x92')+_0x159966+_0x96c2('0xa8')+_0x562eda+_0x96c2('0xa9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x96c2('0x8f')+_0x4b9390,'If-None-Match':null,'OData-Version':_0x96c2('0x90')},'json':!![]};return rp(_0xc2e7f3)['then'](function(_0x1d5dcc){var _0x593351=[];var _0x252237=_0x1d5dcc['OptionSet'][_0x96c2('0xaa')];_0x252237[_0x96c2('0x97')](function(_0x2e3bc0){_0x593351[_0x96c2('0x9a')]({'name':_0x2e3bc0['Label'][_0x96c2('0xab')]['Label'],'value':String(_0x2e3bc0['Value'])});});var _0x2a93b4={'id':_0x4b7e7a+'_'+_0x1d5dcc[_0x96c2('0x96')],'name':_0x1d5dcc['DisplayName']['UserLocalizedLabel'][_0x96c2('0xac')],'custom':![],'options':_0x593351};_0xe40981[_0x96c2('0x9a')](_0x2a93b4);return _0xe40981;});}function getBooleanList(_0x2925e4,_0x54d6b5,_0x461152,_0x76d1c9,_0x12679b,_0x44dcce){var _0x278f44={'method':_0x96c2('0x8e'),'uri':_0x2925e4+'EntityDefinitions('+_0x76d1c9+_0x96c2('0xa8')+_0x12679b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x44dcce,'If-None-Match':null,'OData-Version':_0x96c2('0x90')},'json':!![]};return rp(_0x278f44)[_0x96c2('0xf')](function(_0x413e9f){var _0x620238=[];_0x620238[_0x96c2('0x9a')]({'name':_0x413e9f['OptionSet'][_0x96c2('0xad')][_0x96c2('0xac')][_0x96c2('0xab')][_0x96c2('0xac')],'value':_0x96c2('0xae')},{'name':_0x413e9f[_0x96c2('0xaf')][_0x96c2('0xb0')]['Label'][_0x96c2('0xab')][_0x96c2('0xac')],'value':_0x96c2('0xb1')});var _0x1dc512={'id':_0x54d6b5+'_'+_0x413e9f[_0x96c2('0x96')],'name':_0x413e9f[_0x96c2('0xb2')][_0x96c2('0xab')][_0x96c2('0xac')],'custom':![],'options':_0x620238};_0x461152['push'](_0x1dc512);return _0x461152;});}function getInputList(_0x5aa258,_0x5ad773,_0x18c151,_0x44f8a1,_0x1b5706,_0x2061f4,_0x47e7e6){var _0x1dd153={'method':_0x96c2('0x8e'),'uri':_0x5aa258+_0x96c2('0x92')+_0x1b5706+_0x96c2('0xa8')+_0x2061f4+_0x96c2('0xb3')+_0x18c151+_0x96c2('0xb4'),'headers':{'Authorization':_0x96c2('0x8f')+_0x47e7e6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1dd153)[_0x96c2('0xf')](function(_0x323af6){var _0x57b14a={'id':_0x5ad773+'_'+_0x323af6[_0x96c2('0x96')],'name':_0x323af6['DisplayName'][_0x96c2('0xab')]?_0x323af6[_0x96c2('0xb2')][_0x96c2('0xab')][_0x96c2('0xac')]:_0x323af6['LogicalName'],'custom':![],'options':[]};_0x44f8a1[_0x96c2('0x9a')](_0x57b14a);return _0x44f8a1;});} \ No newline at end of file +var _0xdc22=['CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Dynamics365Account','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','params','include','catch','create','body','find','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientId','clientSecret','modernAuthentication'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0xdc22,0xed));var _0x2dc2=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xdc22[_0x1fd675];return _0x16b554;};'use strict';var rp=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var _=require(_0x2dc2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x2dc2('0x3'))(_0x2dc2('0x4'));var db=require(_0x2dc2('0x5'))['db'];var integrations=require(_0x2dc2('0x6'));function respondWithResult(_0x5d5c34,_0x5c2dbf){_0x5c2dbf=_0x5c2dbf||0xc8;return function(_0x102796){if(_0x102796){return _0x5d5c34[_0x2dc2('0x7')](_0x5c2dbf)[_0x2dc2('0x8')](_0x102796);}};}function respondWithFilteredResult(_0x1286f8,_0x52d71a){return function(_0x23f6d9){if(_0x23f6d9){var _0x4f3fb5=typeof _0x52d71a[_0x2dc2('0x9')]==='undefined'&&typeof _0x52d71a[_0x2dc2('0xa')]==='undefined';var _0x485aaf=_0x23f6d9['count'];var _0x1883bf=_0x4f3fb5?0x0:_0x52d71a[_0x2dc2('0x9')];var _0x2628a2=_0x4f3fb5?_0x23f6d9['count']:_0x52d71a['offset']+_0x52d71a[_0x2dc2('0xa')];var _0x547fad;if(_0x2628a2>=_0x485aaf){_0x2628a2=_0x485aaf;_0x547fad=0xc8;}else{_0x547fad=0xce;}_0x1286f8[_0x2dc2('0x7')](_0x547fad);return _0x1286f8['set'](_0x2dc2('0xb'),_0x1883bf+'-'+_0x2628a2+'/'+_0x485aaf)[_0x2dc2('0x8')](_0x23f6d9);}return null;};}function saveUpdates(_0x7e52a2){return function(_0x6dbf3c){if(_0x6dbf3c){return _0x6dbf3c[_0x2dc2('0xc')](_0x7e52a2)[_0x2dc2('0xd')](function(_0x266eb1){return _0x266eb1;});}return null;};}function removeEntity(_0x5eb371){return function(_0x5455fc){if(_0x5455fc){return _0x5455fc[_0x2dc2('0xe')]()[_0x2dc2('0xd')](function(){_0x5eb371[_0x2dc2('0x7')](0xcc)[_0x2dc2('0xf')]();});}};}function handleEntityNotFound(_0x22f64a){return function(_0x4abac5){if(!_0x4abac5){_0x22f64a[_0x2dc2('0x10')](0x194);}return _0x4abac5;};}function handleError(_0x486db4,_0x5ccc3e){_0x5ccc3e=_0x5ccc3e||0x1f4;return function(_0x38a4a6){logger[_0x2dc2('0x11')](_0x38a4a6[_0x2dc2('0x12')]);if(_0x38a4a6[_0x2dc2('0x13')]){delete _0x38a4a6['name'];}_0x486db4['status'](_0x5ccc3e)[_0x2dc2('0x14')](_0x38a4a6);};}exports['index']=function(_0x13c023,_0x3a72fd){var _0x2d27a4={},_0xc51a47={},_0x114f33={'count':0x0,'rows':[]};var _0x41823c=_['map'](db[_0x2dc2('0x15')]['rawAttributes'],function(_0x5622bd){return{'name':_0x5622bd[_0x2dc2('0x16')],'type':_0x5622bd[_0x2dc2('0x17')][_0x2dc2('0x18')]};});_0xc51a47[_0x2dc2('0x19')]=_[_0x2dc2('0x1a')](_0x41823c,_0x2dc2('0x13'));_0xc51a47[_0x2dc2('0x1b')]=_[_0x2dc2('0x1c')](_0x13c023[_0x2dc2('0x1b')]);_0xc51a47[_0x2dc2('0x1d')]=_['intersection'](_0xc51a47[_0x2dc2('0x19')],_0xc51a47['query']);_0x2d27a4[_0x2dc2('0x1e')]=_[_0x2dc2('0x1f')](_0xc51a47[_0x2dc2('0x19')],qs[_0x2dc2('0x20')](_0x13c023[_0x2dc2('0x1b')]['fields']));_0x2d27a4[_0x2dc2('0x1e')]=_0x2d27a4['attributes'][_0x2dc2('0x21')]?_0x2d27a4[_0x2dc2('0x1e')]:_0xc51a47[_0x2dc2('0x19')];if(!_0x13c023[_0x2dc2('0x1b')][_0x2dc2('0x22')](_0x2dc2('0x23'))){_0x2d27a4[_0x2dc2('0xa')]=qs['limit'](_0x13c023[_0x2dc2('0x1b')][_0x2dc2('0xa')]);_0x2d27a4[_0x2dc2('0x9')]=qs[_0x2dc2('0x9')](_0x13c023[_0x2dc2('0x1b')][_0x2dc2('0x9')]);}_0x2d27a4[_0x2dc2('0x24')]=qs[_0x2dc2('0x25')](_0x13c023[_0x2dc2('0x1b')]['sort']);_0x2d27a4[_0x2dc2('0x26')]=qs['filters'](_[_0x2dc2('0x27')](_0x13c023[_0x2dc2('0x1b')],_0xc51a47['filters']),_0x41823c);if(_0x13c023['query'][_0x2dc2('0x28')]){_0x2d27a4[_0x2dc2('0x26')]=_[_0x2dc2('0x29')](_0x2d27a4[_0x2dc2('0x26')],{'$or':_[_0x2dc2('0x1a')](_0x41823c,function(_0x58ba6d){if(_0x58ba6d[_0x2dc2('0x17')]!==_0x2dc2('0x2a')){var _0x1854de={};_0x1854de[_0x58ba6d[_0x2dc2('0x13')]]={'$like':'%'+_0x13c023['query'][_0x2dc2('0x28')]+'%'};return _0x1854de;}})});}_0x2d27a4=_['merge']({},_0x2d27a4,_0x13c023[_0x2dc2('0x2b')]);var _0x189c51={'where':_0x2d27a4['where']};return db[_0x2dc2('0x15')]['count'](_0x189c51)['then'](function(_0x2db099){_0x114f33[_0x2dc2('0x2c')]=_0x2db099;if(_0x13c023['query'][_0x2dc2('0x2d')]){_0x2d27a4['include']=[{'all':!![]}];}return db[_0x2dc2('0x15')][_0x2dc2('0x2e')](_0x2d27a4);})['then'](function(_0x4adb80){_0x114f33['rows']=_0x4adb80;return _0x114f33;})['then'](respondWithFilteredResult(_0x3a72fd,_0x2d27a4))['catch'](handleError(_0x3a72fd,null));};exports['show']=function(_0x2252f8,_0xd2cb4b){var _0x23ef5d={'raw':![],'where':{'id':_0x2252f8[_0x2dc2('0x2f')]['id']}},_0x201ab1={};_0x201ab1[_0x2dc2('0x19')]=_[_0x2dc2('0x1c')](db[_0x2dc2('0x15')]['rawAttributes']);_0x201ab1['query']=_[_0x2dc2('0x1c')](_0x2252f8[_0x2dc2('0x1b')]);_0x201ab1[_0x2dc2('0x1d')]=_['intersection'](_0x201ab1[_0x2dc2('0x19')],_0x201ab1['query']);_0x23ef5d[_0x2dc2('0x1e')]=_[_0x2dc2('0x1f')](_0x201ab1[_0x2dc2('0x19')],qs[_0x2dc2('0x20')](_0x2252f8[_0x2dc2('0x1b')][_0x2dc2('0x20')]));_0x23ef5d['attributes']=_0x23ef5d[_0x2dc2('0x1e')]['length']?_0x23ef5d[_0x2dc2('0x1e')]:_0x201ab1['model'];if(_0x2252f8[_0x2dc2('0x1b')][_0x2dc2('0x2d')]){_0x23ef5d[_0x2dc2('0x30')]=[{'all':!![]}];}_0x23ef5d=_['merge']({},_0x23ef5d,_0x2252f8['options']);return db[_0x2dc2('0x15')]['find'](_0x23ef5d)[_0x2dc2('0xd')](handleEntityNotFound(_0xd2cb4b,null))[_0x2dc2('0xd')](respondWithResult(_0xd2cb4b,null))[_0x2dc2('0x31')](handleError(_0xd2cb4b,null));};exports[_0x2dc2('0x32')]=function(_0x43cad7,_0x1ddba9){return db['Dynamics365Account'][_0x2dc2('0x32')](_0x43cad7[_0x2dc2('0x33')],{})[_0x2dc2('0xd')](respondWithResult(_0x1ddba9,0xc9))['catch'](handleError(_0x1ddba9,null));};exports['update']=function(_0x3303ef,_0x24b552){if(_0x3303ef['body']['id']){delete _0x3303ef[_0x2dc2('0x33')]['id'];}return db[_0x2dc2('0x15')]['find']({'where':{'id':_0x3303ef[_0x2dc2('0x2f')]['id']}})['then'](handleEntityNotFound(_0x24b552,null))[_0x2dc2('0xd')](saveUpdates(_0x3303ef[_0x2dc2('0x33')],null))['then'](respondWithResult(_0x24b552,null))[_0x2dc2('0x31')](handleError(_0x24b552,null));};exports['destroy']=function(_0x3f14c9,_0x4c1387){return db[_0x2dc2('0x15')][_0x2dc2('0x34')]({'where':{'id':_0x3f14c9[_0x2dc2('0x2f')]['id']}})[_0x2dc2('0xd')](handleEntityNotFound(_0x4c1387,null))[_0x2dc2('0xd')](removeEntity(_0x4c1387,null))[_0x2dc2('0x31')](handleError(_0x4c1387,null));};exports['getConfigurations']=function(_0x5b109f,_0xf26c21){var _0x205a45={};var _0x311607={};var _0x3e1dd9;var _0x408b1b;return db[_0x2dc2('0x15')][_0x2dc2('0x35')]({'where':{'id':_0x5b109f['params']['id']}})['then'](handleEntityNotFound(_0xf26c21,null))[_0x2dc2('0xd')](function(_0xae5adc){if(_0xae5adc){_0x3e1dd9=_0xae5adc;_0x311607[_0x2dc2('0x19')]=_[_0x2dc2('0x1c')](db[_0x2dc2('0x36')][_0x2dc2('0x37')]);_0x311607['query']=_[_0x2dc2('0x1c')](_0x5b109f['query']);_0x311607[_0x2dc2('0x1d')]=_['intersection'](_0x311607[_0x2dc2('0x19')],_0x311607[_0x2dc2('0x1b')]);_0x205a45['attributes']=_[_0x2dc2('0x1f')](_0x311607[_0x2dc2('0x19')],qs[_0x2dc2('0x20')](_0x5b109f[_0x2dc2('0x1b')][_0x2dc2('0x20')]));_0x205a45[_0x2dc2('0x1e')]=_0x205a45['attributes'][_0x2dc2('0x21')]?_0x205a45[_0x2dc2('0x1e')]:_0x311607[_0x2dc2('0x19')];_0x205a45[_0x2dc2('0x24')]=qs[_0x2dc2('0x25')](_0x5b109f[_0x2dc2('0x1b')]['sort']);_0x205a45['where']=qs['filters'](_[_0x2dc2('0x27')](_0x5b109f[_0x2dc2('0x1b')],_0x311607['filters']));if(_0x5b109f[_0x2dc2('0x1b')][_0x2dc2('0x28')]){_0x205a45['where']=_[_0x2dc2('0x29')](_0x205a45['where'],{'$or':_[_0x2dc2('0x1a')](_0x205a45['attributes'],function(_0x519dbe){var _0x51b8f6={};_0x51b8f6[_0x519dbe]={'$like':'%'+_0x5b109f['query']['filter']+'%'};return _0x51b8f6;})});}_0x205a45=_['merge']({},_0x205a45,_0x5b109f[_0x2dc2('0x2b')]);return _0x3e1dd9['getConfigurations'](_0x205a45);}})['then'](function(_0x4821bd){if(_0x4821bd){_0x408b1b=_0x4821bd[_0x2dc2('0x21')];if(!_0x5b109f['query'][_0x2dc2('0x22')]('nolimit')){_0x205a45[_0x2dc2('0xa')]=qs['limit'](_0x5b109f['query'][_0x2dc2('0xa')]);_0x205a45[_0x2dc2('0x9')]=qs[_0x2dc2('0x9')](_0x5b109f['query']['offset']);}return _0x3e1dd9['getConfigurations'](_0x205a45);}})[_0x2dc2('0xd')](function(_0x5b79a4){if(_0x5b79a4){return _0x5b79a4?{'count':_0x408b1b,'rows':_0x5b79a4}:null;}})[_0x2dc2('0xd')](respondWithResult(_0xf26c21,null))['catch'](handleError(_0xf26c21,null));};exports[_0x2dc2('0x38')]=function(_0x1648c8,_0x3cdd8f){if(_0x1648c8['body']['id']){delete _0x1648c8[_0x2dc2('0x33')]['id'];}return db[_0x2dc2('0x15')][_0x2dc2('0x35')]({'where':{'id':_0x1648c8['params']['id']}})[_0x2dc2('0xd')](handleEntityNotFound(_0x3cdd8f,null))[_0x2dc2('0xd')](function(_0x5843fc){if(_0x5843fc){_0x1648c8[_0x2dc2('0x33')][_0x2dc2('0x39')]=_0x5843fc['id'];_0x1648c8[_0x2dc2('0x33')][_0x2dc2('0x3a')]=integrations[_0x2dc2('0x3b')](_0x1648c8[_0x2dc2('0x33')][_0x2dc2('0x3c')],_0x1648c8[_0x2dc2('0x33')][_0x2dc2('0x17')]);_0x1648c8[_0x2dc2('0x33')]['Descriptions']=integrations[_0x2dc2('0x3d')](_0x1648c8[_0x2dc2('0x33')][_0x2dc2('0x3c')],_0x1648c8[_0x2dc2('0x33')][_0x2dc2('0x17')]);return db['Dynamics365Configuration']['create'](_0x1648c8[_0x2dc2('0x33')],{'include':[{'model':db[_0x2dc2('0x3e')],'as':'Subjects'},{'model':db[_0x2dc2('0x3e')],'as':_0x2dc2('0x3f')}]});}return null;})[_0x2dc2('0xd')](respondWithResult(_0x3cdd8f,null))[_0x2dc2('0x31')](handleError(_0x3cdd8f,null));};function sanitizeRemoteUri(_0x1d33f5){var _0x431161=_0x1d33f5[_0x2dc2('0x40')](-0x1);if(_0x431161==='/')return _0x1d33f5[_0x2dc2('0x41')](0x0,_0x1d33f5[_0x2dc2('0x42')](_0x431161));return _0x1d33f5;}function getWebApiUrl(_0x175849){return util[_0x2dc2('0x43')](_0x2dc2('0x44'),_0x175849);}exports[_0x2dc2('0x45')]=function(_0x101a74,_0x430afc){var _0x4afb9e=_0x101a74[_0x2dc2('0x1b')][_0x2dc2('0x46')];var _0xafbb1=_0x4afb9e===_0x2dc2('0x47')?_0x2dc2('0x48'):_0x2dc2('0x49');var _0xbbf1d1='';var _0x259bc5='';var _0x586808='';var _0x149345='';var _0x1dfadb='';var _0x250248='';var _0x408888='';var _0x1c7d43='';var _0x245017=[_0x2dc2('0x4a'),_0x2dc2('0x4b'),_0x2dc2('0x4c'),_0x2dc2('0x4d'),'caseorigincode','subject',_0x2dc2('0x4e'),_0x2dc2('0x4f'),_0x2dc2('0x50'),_0x2dc2('0x51')];var _0xfdf1f7=[_0x2dc2('0x52'),_0x2dc2('0x53'),'actualserviceunits','billedserviceunits',_0x2dc2('0x54'),_0x2dc2('0x55'),_0x2dc2('0x56'),_0x2dc2('0x57'),_0x2dc2('0x58'),_0x2dc2('0x59'),'createdbyname',_0x2dc2('0x5a'),_0x2dc2('0x5b'),_0x2dc2('0x5c'),_0x2dc2('0x5d'),_0x2dc2('0x5e'),_0x2dc2('0x5f'),_0x2dc2('0x60'),_0x2dc2('0x61'),'entitlementidname',_0x2dc2('0x62'),_0x2dc2('0x63'),_0x2dc2('0x64'),_0x2dc2('0x65'),_0x2dc2('0x66'),_0x2dc2('0x67'),_0x2dc2('0x68'),_0x2dc2('0x69'),_0x2dc2('0x6a'),'lastonholdtime',_0x2dc2('0x6b'),_0x2dc2('0x6c'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x2dc2('0x6d'),_0x2dc2('0x6e'),'modifiedonbehalfbyname',_0x2dc2('0x6f'),'msdyn_incidenttypename',_0x2dc2('0x70'),_0x2dc2('0x71'),'onholdtime',_0x2dc2('0x72'),_0x2dc2('0x73'),'owneridtype',_0x2dc2('0x74'),_0x2dc2('0x75'),_0x2dc2('0x76'),'primarycontactidyominame',_0x2dc2('0x77'),_0x2dc2('0x78'),'productserialnumber',_0x2dc2('0x79'),_0x2dc2('0x7a'),'responseby','responsiblecontactidname',_0x2dc2('0x7b'),_0x2dc2('0x7c'),'slainvokedidname',_0x2dc2('0x7d'),_0x2dc2('0x7e'),'statecode',_0x2dc2('0x7f'),_0x2dc2('0x80'),_0x2dc2('0x81'),_0x2dc2('0x82'),'transactioncurrencyidname','traversedpath',_0x2dc2('0x83'),_0x2dc2('0x84')];var _0x47b0e1=_0x245017['concat'](_0xfdf1f7);return db[_0x2dc2('0x15')]['findOne']({'where':{'id':_0x101a74[_0x2dc2('0x2f')]['id']},'attributes':['id',_0x2dc2('0x85'),_0x2dc2('0x86'),_0x2dc2('0x87'),'tenantId',_0x2dc2('0x88'),_0x2dc2('0x89'),_0x2dc2('0x8a')],'include':[{'model':db[_0x2dc2('0x8b')],'as':_0x2dc2('0x8b'),'attributes':['id',_0x2dc2('0x8c'),_0x2dc2('0x8d')]}]})[_0x2dc2('0xd')](handleEntityNotFound(_0x430afc,null))[_0x2dc2('0xd')](function(_0xbfc041){if(_0xbfc041){if(_0xbfc041['modernAuthentication']){_0xbfc041[_0x2dc2('0x8e')]=_0xbfc041[_0x2dc2('0x8b')][_0x2dc2('0x8c')];_0x1c7d43=sanitizeRemoteUri(_0xbfc041[_0x2dc2('0x8b')]['data7']);_0x408888=getWebApiUrl(_0x1c7d43);return _0xbfc041;}_0x1c7d43=sanitizeRemoteUri(_0xbfc041[_0x2dc2('0x87')]);_0x408888=getWebApiUrl(_0x1c7d43);var _0x38d793={'method':_0x2dc2('0x8f'),'uri':_0x2dc2('0x90')+_0xbfc041[_0x2dc2('0x91')]+_0x2dc2('0x92'),'form':{'client_id':_0xbfc041[_0x2dc2('0x88')],'resource':_0x1c7d43,'username':_0xbfc041[_0x2dc2('0x85')],'password':_0xbfc041[_0x2dc2('0x86')],'grant_type':_0x2dc2('0x86'),'client_secret':_0xbfc041[_0x2dc2('0x89')]},'json':!![]};return rp(_0x38d793);}})[_0x2dc2('0xd')](function(_0x1584df){_0x250248=_0x1584df[_0x2dc2('0x8e')];var _0x5e4258={'method':_0x2dc2('0x93'),'uri':encodeURI(_0x408888+_0x2dc2('0x94')+_0xafbb1+'\x27'),'headers':{'Authorization':_0x2dc2('0x95')+_0x250248,'If-None-Match':null,'OData-Version':_0x2dc2('0x96')},'json':!![]};return rp(_0x5e4258);})[_0x2dc2('0xd')](function(_0x47f4dd){var _0x2d6720=_0x47f4dd['value'][0x0];var _0x1a0e22=_0x2d6720[_0x2dc2('0x97')];var _0x429be5={'method':_0x2dc2('0x93'),'uri':_0x408888+'EntityDefinitions('+_0x1a0e22+_0x2dc2('0x98'),'headers':{'Authorization':_0x2dc2('0x95')+_0x250248,'If-None-Match':null,'OData-Version':_0x2dc2('0x96')},'json':!![]};return rp(_0x429be5);})['then'](function(_0x3bfbfc){_0xbbf1d1=_0x3bfbfc;_0x259bc5=_0xbbf1d1[_0x2dc2('0x99')];_0x259bc5=_[_0x2dc2('0x9a')](_0x259bc5,function(_0xe78e1){return!_0x47b0e1[_0x2dc2('0x9b')](_0xe78e1['LogicalName']);});var _0x3f5ff7=[];var _0x2035ab=[];_0x259bc5[_0x2dc2('0x9c')](function(_0x5a0228){if(_0x5a0228[_0x2dc2('0x9d')]){var _0x26f7c6=_0x5a0228[_0x2dc2('0x9d')][_0x2dc2('0x41')](_0x5a0228[_0x2dc2('0x9d')][_0x2dc2('0x42')]('.')+0x1);if(_0x26f7c6==='PicklistAttributeMetadata'){_0x3f5ff7[_0x2dc2('0x9e')](getSelectList(_0x408888,_0x4afb9e,_0x2035ab,_0xbbf1d1[_0x2dc2('0x97')],_0x5a0228['MetadataId'],_0x250248));}}});return Promise['all'](_0x3f5ff7);})['then'](function(_0x57ff52){_0x586808=_0x57ff52[0x0];var _0x5f011b=[];var _0x468cb7=[];_0x259bc5[_0x2dc2('0x9c')](function(_0x435d03){if(!_[_0x2dc2('0x9f')](_0x435d03['@odata.type'])){var _0x2b6a0d=_0x435d03[_0x2dc2('0x9d')]['substring'](_0x435d03['@odata.type'][_0x2dc2('0x42')]('.')+0x1);if(_0x2b6a0d==='BooleanAttributeMetadata'){_0x5f011b[_0x2dc2('0x9e')](getBooleanList(_0x408888,_0x4afb9e,_0x468cb7,_0xbbf1d1[_0x2dc2('0x97')],_0x435d03[_0x2dc2('0x97')],_0x250248));}}});return Promise[_0x2dc2('0xa0')](_0x5f011b);})[_0x2dc2('0xd')](function(_0x4788d7){_0x149345=_0x4788d7[0x0];var _0x11325c=[];var _0x273723=[];_0x259bc5['forEach'](function(_0x3c8f10){if(_0x3c8f10['@odata.type']){var _0x43bbaf=_0x3c8f10[_0x2dc2('0x9d')][_0x2dc2('0x41')](_0x3c8f10['@odata.type'][_0x2dc2('0x42')]('.')+0x1);if(_0x43bbaf===_0x2dc2('0xa1')||_0x43bbaf===_0x2dc2('0xa2')||_0x43bbaf===_0x2dc2('0xa3')||_0x43bbaf==='IntegerAttributeMetadata'||_0x43bbaf===_0x2dc2('0xa4')||_0x43bbaf===_0x2dc2('0xa5')||_0x43bbaf===_0x2dc2('0xa6')||_0x43bbaf===_0x2dc2('0xa7')||_0x43bbaf==='StateAttributeMetadata'||_0x43bbaf===_0x2dc2('0xa8')){_0x11325c[_0x2dc2('0x9e')](getInputList(_0x408888,_0x4afb9e,_0x43bbaf,_0x273723,_0xbbf1d1[_0x2dc2('0x97')],_0x3c8f10[_0x2dc2('0x97')],_0x250248));}}});return Promise[_0x2dc2('0xa0')](_0x11325c);})[_0x2dc2('0xd')](function(_0x3d3106){_0x1dfadb=_0x3d3106[0x0];var _0x34b99b=_0x586808[_0x2dc2('0xa9')](_0x149345)[_0x2dc2('0xa9')](_0x1dfadb);var _0x19982a={'count':_0x34b99b[_0x2dc2('0x21')],'rows':_0x34b99b};return _0x19982a;})['then'](respondWithResult(_0x430afc,null))[_0x2dc2('0x31')](function(_0x5ec852){var _0xdc6d61=_0x101a74[_0x2dc2('0x1b')][_0x2dc2('0xaa')]?0x1f4:_0x5ec852[_0x2dc2('0xab')]||0x1f4;logger['error'](_0x5ec852[_0x2dc2('0x12')]);delete _0x5ec852['name'];if(_0xdc6d61===0x191){_0xdc6d61=0x190;}_0x430afc[_0x2dc2('0x7')](_0xdc6d61)[_0x2dc2('0x14')](_0x101a74[_0x2dc2('0x1b')][_0x2dc2('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x5ec852[_0x2dc2('0xab')]}:_0x5ec852);});};function getSelectList(_0xf3f23b,_0x2a4050,_0x3ec64c,_0xe2ead2,_0x4ca459,_0x3dd3ec){var _0x1f4ef9={'method':'GET','uri':_0xf3f23b+_0x2dc2('0xac')+_0xe2ead2+_0x2dc2('0xad')+_0x4ca459+_0x2dc2('0xae')+_0x2dc2('0xaf'),'headers':{'Authorization':_0x2dc2('0x95')+_0x3dd3ec,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1f4ef9)[_0x2dc2('0xd')](function(_0x2f0da0){var _0x1488fb=[];var _0x1b1dcb=_0x2f0da0[_0x2dc2('0xb0')][_0x2dc2('0xb1')];_0x1b1dcb['forEach'](function(_0x7dca55){_0x1488fb[_0x2dc2('0x9e')]({'name':_0x7dca55[_0x2dc2('0xb2')][_0x2dc2('0xb3')]['Label'],'value':String(_0x7dca55['Value'])});});var _0x11e6d7={'id':_0x2a4050+'_'+_0x2f0da0[_0x2dc2('0xb4')],'name':_0x2f0da0[_0x2dc2('0xb5')][_0x2dc2('0xb3')][_0x2dc2('0xb2')],'custom':![],'options':_0x1488fb};_0x3ec64c['push'](_0x11e6d7);return _0x3ec64c;});}function getBooleanList(_0x277da6,_0xf7dcea,_0x145c7c,_0x279aac,_0x43ac1f,_0x31f694){var _0x2548d2={'method':_0x2dc2('0x93'),'uri':_0x277da6+_0x2dc2('0xac')+_0x279aac+_0x2dc2('0xad')+_0x43ac1f+_0x2dc2('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x31f694,'If-None-Match':null,'OData-Version':_0x2dc2('0x96')},'json':!![]};return rp(_0x2548d2)[_0x2dc2('0xd')](function(_0x435359){var _0xeb8577=[];_0xeb8577[_0x2dc2('0x9e')]({'name':_0x435359[_0x2dc2('0xb0')][_0x2dc2('0xb7')]['Label'][_0x2dc2('0xb3')]['Label'],'value':'true'},{'name':_0x435359[_0x2dc2('0xb0')][_0x2dc2('0xb8')][_0x2dc2('0xb2')][_0x2dc2('0xb3')][_0x2dc2('0xb2')],'value':_0x2dc2('0xb9')});var _0x1c1e4c={'id':_0xf7dcea+'_'+_0x435359['LogicalName'],'name':_0x435359['DisplayName']['UserLocalizedLabel'][_0x2dc2('0xb2')],'custom':![],'options':_0xeb8577};_0x145c7c[_0x2dc2('0x9e')](_0x1c1e4c);return _0x145c7c;});}function getInputList(_0x5a7395,_0xd2389b,_0xf3e63e,_0x51bd82,_0x369a0d,_0x3871ba,_0x8487f1){var _0x49c95f={'method':_0x2dc2('0x93'),'uri':_0x5a7395+_0x2dc2('0xac')+_0x369a0d+_0x2dc2('0xad')+_0x3871ba+_0x2dc2('0xba')+_0xf3e63e+_0x2dc2('0xbb'),'headers':{'Authorization':_0x2dc2('0x95')+_0x8487f1,'If-None-Match':null,'OData-Version':_0x2dc2('0x96')},'json':!![]};return rp(_0x49c95f)[_0x2dc2('0xd')](function(_0x46c16e){var _0x5892c7={'id':_0xd2389b+'_'+_0x46c16e['LogicalName'],'name':_0x46c16e[_0x2dc2('0xb5')][_0x2dc2('0xb3')]?_0x46c16e[_0x2dc2('0xb5')][_0x2dc2('0xb3')]['Label']:_0x46c16e[_0x2dc2('0xb4')],'custom':![],'options':[]};_0x51bd82[_0x2dc2('0x9e')](_0x5892c7);return _0x51bd82;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1a537b8..527fee0 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 _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(_0x45b0d6,_0x5e0d9f){var _0x512004=function(_0x2ece60){while(--_0x2ece60){_0x45b0d6['push'](_0x45b0d6['shift']());}};_0x512004(++_0x5e0d9f);}(_0xe706,0xa3));var _0x6e70=function(_0x48cac8,_0x150d03){_0x48cac8=_0x48cac8-0x0;var _0x539232=_0xe706[_0x48cac8];return _0x539232;};'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 +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x367904,_0xa7f0cf){var _0x216cf7=function(_0x22194b){while(--_0x22194b){_0x367904['push'](_0x367904['shift']());}};_0x216cf7(++_0xa7f0cf);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 256d1e8..8dbf810 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 _0xb5dd=['GetDynamics365Account','Dynamics365Account','options','raw','where','include','map','model','attributes','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch'];(function(_0x3235a8,_0x5b043c){var _0x1887d6=function(_0x3178aa){while(--_0x3178aa){_0x3235a8['push'](_0x3235a8['shift']());}};_0x1887d6(++_0x5b043c);}(_0xb5dd,0xbb));var _0xdb5d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb5dd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var moment=require(_0xdb5d('0x2'));var BPromise=require(_0xdb5d('0x3'));var rs=require(_0xdb5d('0x4'));var fs=require('fs');var Redis=require(_0xdb5d('0x5'));var db=require(_0xdb5d('0x6'))['db'];var utils=require(_0xdb5d('0x7'));var logger=require('../../config/logger')(_0xdb5d('0x8'));var config=require(_0xdb5d('0x9'));var jayson=require(_0xdb5d('0xa'));var client=jayson['client'][_0xdb5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x445120,_0x4de214,_0x3123a7){return new BPromise(function(_0x436fe0,_0x886733){return client[_0xdb5d('0xc')](_0x445120,_0x3123a7)[_0xdb5d('0xd')](function(_0x5df3c6){logger[_0xdb5d('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4de214,_0xdb5d('0xf'));logger[_0xdb5d('0x10')](_0xdb5d('0x11'),_0x4de214,_0xdb5d('0xf'),JSON['stringify'](_0x5df3c6));if(_0x5df3c6[_0xdb5d('0x12')]){if(_0x5df3c6[_0xdb5d('0x12')]['code']===0x1f4){logger[_0xdb5d('0x12')](_0xdb5d('0x13'),_0x4de214,_0x5df3c6[_0xdb5d('0x12')][_0xdb5d('0x14')]);return _0x886733(_0x5df3c6[_0xdb5d('0x12')][_0xdb5d('0x14')]);}logger[_0xdb5d('0x12')](_0xdb5d('0x13'),_0x4de214,_0x5df3c6[_0xdb5d('0x12')][_0xdb5d('0x14')]);return _0x436fe0(_0x5df3c6[_0xdb5d('0x12')][_0xdb5d('0x14')]);}else{logger[_0xdb5d('0xe')](_0xdb5d('0x13'),_0x4de214,_0xdb5d('0xf'));_0x436fe0(_0x5df3c6[_0xdb5d('0x15')][_0xdb5d('0x14')]);}})[_0xdb5d('0x16')](function(_0x4a621e){logger[_0xdb5d('0x12')](_0xdb5d('0x13'),_0x4de214,_0x4a621e);_0x886733(_0x4a621e);});});}exports[_0xdb5d('0x17')]=function(_0x51b021){var _0x224a9b=this;return new Promise(function(_0x2624f7,_0x4b13cd){return db[_0xdb5d('0x18')]['findAll']({'raw':_0x51b021[_0xdb5d('0x19')]?_0x51b021['options'][_0xdb5d('0x1a')]===undefined?!![]:![]:!![],'where':_0x51b021[_0xdb5d('0x19')]?_0x51b021[_0xdb5d('0x19')][_0xdb5d('0x1b')]||null:null,'attributes':_0x51b021[_0xdb5d('0x19')]?_0x51b021['options']['attributes']||null:null,'limit':_0x51b021['options']?_0x51b021['options']['limit']||null:null,'include':_0x51b021[_0xdb5d('0x19')]?_0x51b021[_0xdb5d('0x19')][_0xdb5d('0x1c')]?_[_0xdb5d('0x1d')](_0x51b021['options'][_0xdb5d('0x1c')],function(_0xb2c9b5){return{'model':db[_0xb2c9b5[_0xdb5d('0x1e')]],'as':_0xb2c9b5['as'],'attributes':_0xb2c9b5['attributes'],'include':_0xb2c9b5['include']?_[_0xdb5d('0x1d')](_0xb2c9b5['include'],function(_0x207aa9){return{'model':db[_0x207aa9[_0xdb5d('0x1e')]],'as':_0x207aa9['as'],'attributes':_0x207aa9[_0xdb5d('0x1f')],'include':_0x207aa9['include']?_[_0xdb5d('0x1d')](_0x207aa9[_0xdb5d('0x1c')],function(_0x5e9277){return{'model':db[_0x5e9277[_0xdb5d('0x1e')]],'as':_0x5e9277['as'],'attributes':_0x5e9277['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb5d('0xd')](function(_0xc5372){logger[_0xdb5d('0xe')](_0xdb5d('0x17'),_0x51b021);logger[_0xdb5d('0x10')](_0xdb5d('0x17'),_0x51b021,JSON[_0xdb5d('0x20')](_0xc5372));_0x2624f7(_0xc5372);})['catch'](function(_0x204129){logger[_0xdb5d('0x12')](_0xdb5d('0x17'),_0x204129[_0xdb5d('0x14')],_0x51b021);_0x4b13cd(_0x224a9b[_0xdb5d('0x12')](0x1f4,_0x204129['message']));});});};exports[_0xdb5d('0x21')]=function(_0xedeb9){var _0x3c082a=this;return new Promise(function(_0x187949,_0x48b133){return db[_0xdb5d('0x18')][_0xdb5d('0x22')]({'raw':_0xedeb9[_0xdb5d('0x19')]?_0xedeb9[_0xdb5d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xedeb9['options']?_0xedeb9[_0xdb5d('0x19')]['where']||null:null,'attributes':_0xedeb9['options']?_0xedeb9[_0xdb5d('0x19')][_0xdb5d('0x1f')]||null:null,'include':_0xedeb9[_0xdb5d('0x19')]?_0xedeb9['options'][_0xdb5d('0x1c')]?_[_0xdb5d('0x1d')](_0xedeb9[_0xdb5d('0x19')][_0xdb5d('0x1c')],function(_0x26b941){return{'model':db[_0x26b941[_0xdb5d('0x1e')]],'as':_0x26b941['as'],'attributes':_0x26b941['attributes'],'include':_0x26b941[_0xdb5d('0x1c')]?_[_0xdb5d('0x1d')](_0x26b941['include'],function(_0x2d5c2f){return{'model':db[_0x2d5c2f[_0xdb5d('0x1e')]],'as':_0x2d5c2f['as'],'attributes':_0x2d5c2f['attributes'],'include':_0x2d5c2f[_0xdb5d('0x1c')]?_[_0xdb5d('0x1d')](_0x2d5c2f['include'],function(_0x16aefd){return{'model':db[_0x16aefd[_0xdb5d('0x1e')]],'as':_0x16aefd['as'],'attributes':_0x16aefd[_0xdb5d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b56b7){logger[_0xdb5d('0xe')](_0xdb5d('0x21'),_0xedeb9);logger[_0xdb5d('0x10')]('ShowDynamics365Account',_0xedeb9,JSON[_0xdb5d('0x20')](_0x1b56b7));_0x187949(_0x1b56b7);})[_0xdb5d('0x16')](function(_0x1f6fb6){logger[_0xdb5d('0x12')](_0xdb5d('0x21'),_0x1f6fb6['message'],_0xedeb9);_0x48b133(_0x3c082a[_0xdb5d('0x12')](0x1f4,_0x1f6fb6[_0xdb5d('0x14')]));});});}; \ No newline at end of file +var _0xca35=['randomstring','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','Dynamics365Account','find','raw','lodash','util','bluebird'];(function(_0x2e4426,_0x12c956){var _0x1c1d85=function(_0x506703){while(--_0x506703){_0x2e4426['push'](_0x2e4426['shift']());}};_0x1c1d85(++_0x12c956);}(_0xca35,0xa2));var _0x5ca3=function(_0x3869c8,_0x2ff137){_0x3869c8=_0x3869c8-0x0;var _0x4caf60=_0xca35[_0x3869c8];return _0x4caf60;};'use strict';var _=require(_0x5ca3('0x0'));var util=require(_0x5ca3('0x1'));var moment=require('moment');var BPromise=require(_0x5ca3('0x2'));var rs=require(_0x5ca3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ca3('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5ca3('0x5'));var client=jayson[_0x5ca3('0x6')][_0x5ca3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c7fd2,_0x34c9a7,_0x1284ce){return new BPromise(function(_0x3f85a5,_0x447af1){return client[_0x5ca3('0x8')](_0x3c7fd2,_0x1284ce)[_0x5ca3('0x9')](function(_0x129790){logger[_0x5ca3('0xa')](_0x5ca3('0xb'),_0x34c9a7,_0x5ca3('0xc'));logger[_0x5ca3('0xd')](_0x5ca3('0xe'),_0x34c9a7,_0x5ca3('0xc'),JSON[_0x5ca3('0xf')](_0x129790));if(_0x129790[_0x5ca3('0x10')]){if(_0x129790[_0x5ca3('0x10')]['code']===0x1f4){logger[_0x5ca3('0x10')](_0x5ca3('0xb'),_0x34c9a7,_0x129790[_0x5ca3('0x10')]['message']);return _0x447af1(_0x129790[_0x5ca3('0x10')][_0x5ca3('0x11')]);}logger[_0x5ca3('0x10')](_0x5ca3('0xb'),_0x34c9a7,_0x129790[_0x5ca3('0x10')][_0x5ca3('0x11')]);return _0x3f85a5(_0x129790[_0x5ca3('0x10')][_0x5ca3('0x11')]);}else{logger[_0x5ca3('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x34c9a7,_0x5ca3('0xc'));_0x3f85a5(_0x129790[_0x5ca3('0x12')]['message']);}})[_0x5ca3('0x13')](function(_0x24bb95){logger[_0x5ca3('0x10')](_0x5ca3('0xb'),_0x34c9a7,_0x24bb95);_0x447af1(_0x24bb95);});});}exports['GetDynamics365Account']=function(_0x1d63fc){var _0xa4ff5b=this;return new Promise(function(_0x2dacea,_0x42ab92){return db['Dynamics365Account'][_0x5ca3('0x14')]({'raw':_0x1d63fc[_0x5ca3('0x15')]?_0x1d63fc[_0x5ca3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d63fc[_0x5ca3('0x15')]?_0x1d63fc['options'][_0x5ca3('0x16')]||null:null,'attributes':_0x1d63fc[_0x5ca3('0x15')]?_0x1d63fc[_0x5ca3('0x15')][_0x5ca3('0x17')]||null:null,'limit':_0x1d63fc[_0x5ca3('0x15')]?_0x1d63fc[_0x5ca3('0x15')][_0x5ca3('0x18')]||null:null,'include':_0x1d63fc[_0x5ca3('0x15')]?_0x1d63fc[_0x5ca3('0x15')][_0x5ca3('0x19')]?_[_0x5ca3('0x1a')](_0x1d63fc['options'][_0x5ca3('0x19')],function(_0x53a6c6){return{'model':db[_0x53a6c6[_0x5ca3('0x1b')]],'as':_0x53a6c6['as'],'attributes':_0x53a6c6[_0x5ca3('0x17')],'include':_0x53a6c6['include']?_[_0x5ca3('0x1a')](_0x53a6c6[_0x5ca3('0x19')],function(_0x215f0){return{'model':db[_0x215f0[_0x5ca3('0x1b')]],'as':_0x215f0['as'],'attributes':_0x215f0['attributes'],'include':_0x215f0['include']?_[_0x5ca3('0x1a')](_0x215f0[_0x5ca3('0x19')],function(_0x42bef9){return{'model':db[_0x42bef9['model']],'as':_0x42bef9['as'],'attributes':_0x42bef9[_0x5ca3('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x224faa){logger[_0x5ca3('0xa')](_0x5ca3('0x1c'),_0x1d63fc);logger[_0x5ca3('0xd')](_0x5ca3('0x1c'),_0x1d63fc,JSON[_0x5ca3('0xf')](_0x224faa));_0x2dacea(_0x224faa);})['catch'](function(_0x15bc36){logger[_0x5ca3('0x10')]('GetDynamics365Account',_0x15bc36[_0x5ca3('0x11')],_0x1d63fc);_0x42ab92(_0xa4ff5b['error'](0x1f4,_0x15bc36[_0x5ca3('0x11')]));});});};exports[_0x5ca3('0x1d')]=function(_0x24ccca){var _0x188a2b=this;return new Promise(function(_0x443633,_0xb4d019){return db[_0x5ca3('0x1e')][_0x5ca3('0x1f')]({'raw':_0x24ccca['options']?_0x24ccca[_0x5ca3('0x15')][_0x5ca3('0x20')]===undefined?!![]:![]:!![],'where':_0x24ccca['options']?_0x24ccca[_0x5ca3('0x15')][_0x5ca3('0x16')]||null:null,'attributes':_0x24ccca[_0x5ca3('0x15')]?_0x24ccca['options'][_0x5ca3('0x17')]||null:null,'include':_0x24ccca[_0x5ca3('0x15')]?_0x24ccca[_0x5ca3('0x15')][_0x5ca3('0x19')]?_[_0x5ca3('0x1a')](_0x24ccca[_0x5ca3('0x15')][_0x5ca3('0x19')],function(_0x4a141a){return{'model':db[_0x4a141a[_0x5ca3('0x1b')]],'as':_0x4a141a['as'],'attributes':_0x4a141a['attributes'],'include':_0x4a141a[_0x5ca3('0x19')]?_[_0x5ca3('0x1a')](_0x4a141a[_0x5ca3('0x19')],function(_0x22645b){return{'model':db[_0x22645b['model']],'as':_0x22645b['as'],'attributes':_0x22645b['attributes'],'include':_0x22645b['include']?_[_0x5ca3('0x1a')](_0x22645b['include'],function(_0x1c1fef){return{'model':db[_0x1c1fef[_0x5ca3('0x1b')]],'as':_0x1c1fef['as'],'attributes':_0x1c1fef[_0x5ca3('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4831cd){logger[_0x5ca3('0xa')](_0x5ca3('0x1d'),_0x24ccca);logger[_0x5ca3('0xd')](_0x5ca3('0x1d'),_0x24ccca,JSON[_0x5ca3('0xf')](_0x4831cd));_0x443633(_0x4831cd);})[_0x5ca3('0x13')](function(_0x2044cd){logger[_0x5ca3('0x10')]('ShowDynamics365Account',_0x2044cd[_0x5ca3('0x11')],_0x24ccca);_0xb4d019(_0x188a2b[_0x5ca3('0x10')](0x1f4,_0x2044cd[_0x5ca3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index bbc3107..5351faf 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 _0x0e16=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0e16,0x183));var _0x60e1=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x0e16[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x60e1('0x0'));var util=require(_0x60e1('0x1'));var path=require(_0x60e1('0x2'));var timeout=require(_0x60e1('0x3'));var express=require(_0x60e1('0x4'));var router=express[_0x60e1('0x5')]();var fs_extra=require(_0x60e1('0x6'));var auth=require(_0x60e1('0x7'));var interaction=require(_0x60e1('0x8'));var config=require(_0x60e1('0x9'));var controller=require(_0x60e1('0xa'));router[_0x60e1('0xb')]('/',auth['isAuthenticated'](),controller[_0x60e1('0xc')]);router['get'](_0x60e1('0xd'),auth[_0x60e1('0xe')](),controller[_0x60e1('0xf')]);router[_0x60e1('0xb')](_0x60e1('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x60e1('0xb')](_0x60e1('0x11'),auth[_0x60e1('0xe')](),controller[_0x60e1('0x12')]);router[_0x60e1('0xb')](_0x60e1('0x13'),auth[_0x60e1('0xe')](),controller[_0x60e1('0x14')]);router[_0x60e1('0x15')]('/',auth[_0x60e1('0xe')](),controller[_0x60e1('0x16')]);router[_0x60e1('0x17')]('/:id',auth[_0x60e1('0xe')](),controller[_0x60e1('0x18')]);router[_0x60e1('0x19')](_0x60e1('0xd'),auth[_0x60e1('0xe')](),controller['destroy']);module[_0x60e1('0x1a')]=router; \ No newline at end of file +var _0x1aac=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xdf6802,_0x104255){var _0x4b5aef=function(_0x1e0ceb){while(--_0x1e0ceb){_0xdf6802['push'](_0xdf6802['shift']());}};_0x4b5aef(++_0x104255);}(_0x1aac,0x6b));var _0xc1aa=function(_0xea175a,_0x4ec2f8){_0xea175a=_0xea175a-0x0;var _0x18d7ad=_0x1aac[_0xea175a];return _0x18d7ad;};'use strict';var multer=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var path=require(_0xc1aa('0x2'));var timeout=require(_0xc1aa('0x3'));var express=require(_0xc1aa('0x4'));var router=express[_0xc1aa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc1aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc1aa('0x7'));var controller=require(_0xc1aa('0x8'));router[_0xc1aa('0x9')]('/',auth[_0xc1aa('0xa')](),controller[_0xc1aa('0xb')]);router['get'](_0xc1aa('0xc'),auth[_0xc1aa('0xa')](),controller[_0xc1aa('0xd')]);router[_0xc1aa('0x9')](_0xc1aa('0xe'),auth['isAuthenticated'](),controller[_0xc1aa('0xf')]);router[_0xc1aa('0x9')]('/:id/subjects',auth[_0xc1aa('0xa')](),controller['getSubjects']);router[_0xc1aa('0x9')](_0xc1aa('0x10'),auth['isAuthenticated'](),controller[_0xc1aa('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc1aa('0x12')]);router[_0xc1aa('0x13')](_0xc1aa('0xc'),auth['isAuthenticated'](),controller[_0xc1aa('0x14')]);router['delete'](_0xc1aa('0xc'),auth[_0xc1aa('0xa')](),controller[_0xc1aa('0x15')]);module[_0xc1aa('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 a08b686..7554973 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 _0xdadd=['contact','nothing','sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x45cbf3,_0x55fdc1){var _0x73323b=function(_0x502d20){while(--_0x502d20){_0x45cbf3['push'](_0x45cbf3['shift']());}};_0x73323b(++_0x55fdc1);}(_0xdadd,0x18a));var _0xddad=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xdadd[_0x1f99a0];return _0x1e0849;};'use strict';var Sequelize=require(_0xddad('0x0'));module[_0xddad('0x1')]={'name':{'type':Sequelize[_0xddad('0x2')]},'description':{'type':Sequelize[_0xddad('0x2')]},'ticketType':{'type':Sequelize[_0xddad('0x3')](_0xddad('0x4'),_0xddad('0x5')),'defaultValue':_0xddad('0x4')},'moduleCreate':{'type':Sequelize[_0xddad('0x3')](_0xddad('0x6'),_0xddad('0x7')),'defaultValue':_0xddad('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xea72=['sequelize','exports','STRING','ENUM','incident','contact'];(function(_0x5a9d1e,_0x5c5e5b){var _0x5f0efb=function(_0x38f2b9){while(--_0x38f2b9){_0x5a9d1e['push'](_0x5a9d1e['shift']());}};_0x5f0efb(++_0x5c5e5b);}(_0xea72,0x1c8));var _0x2ea7=function(_0x538168,_0x23ffb0){_0x538168=_0x538168-0x0;var _0x1a5e67=_0xea72[_0x538168];return _0x1a5e67;};'use strict';var Sequelize=require(_0x2ea7('0x0'));module[_0x2ea7('0x1')]={'name':{'type':Sequelize[_0x2ea7('0x2')]},'description':{'type':Sequelize[_0x2ea7('0x2')]},'ticketType':{'type':Sequelize[_0x2ea7('0x3')](_0x2ea7('0x4'),'phonecall'),'defaultValue':_0x2ea7('0x4')},'moduleCreate':{'type':Sequelize[_0x2ea7('0x3')](_0x2ea7('0x5'),'nothing'),'defaultValue':_0x2ea7('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6e534f1..570cdfe 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 _0x52e0=['set','Content-Range','reject','save','update','then','destroy','end','stack','name','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','params','getFields','findOne','Dynamics365Field','sort','getSubjects','order','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count'];(function(_0x2803d3,_0x2efd8e){var _0x6bfcc1=function(_0x414899){while(--_0x414899){_0x2803d3['push'](_0x2803d3['shift']());}};_0x6bfcc1(++_0x2efd8e);}(_0x52e0,0xcc));var _0x052e=function(_0x1a6a05,_0x51866f){_0x1a6a05=_0x1a6a05-0x0;var _0x5db9e0=_0x52e0[_0x1a6a05];return _0x5db9e0;};'use strict';var emlformat=require(_0x052e('0x0'));var rimraf=require(_0x052e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x052e('0x2'));var moment=require(_0x052e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x052e('0x4'));var util=require(_0x052e('0x5'));var path=require('path');var sox=require(_0x052e('0x6'));var csv=require('to-csv');var ejs=require(_0x052e('0x7'));var fs=require('fs');var fs_extra=require(_0x052e('0x8'));var _=require(_0x052e('0x9'));var squel=require(_0x052e('0xa'));var crypto=require(_0x052e('0xb'));var jsforce=require(_0x052e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x052e('0xd'));var querystring=require(_0x052e('0xe'));var Papa=require(_0x052e('0xf'));var Redis=require(_0x052e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x052e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x052e('0x12'))(_0x052e('0x13'));var utils=require(_0x052e('0x14'));var config=require(_0x052e('0x15'));var licenseUtil=require(_0x052e('0x16'));var db=require(_0x052e('0x17'))['db'];function respondWithStatusCode(_0x238584,_0x20d37b){_0x20d37b=_0x20d37b||0xcc;return function(_0x4edf57){if(_0x4edf57){return _0x238584[_0x052e('0x18')](_0x20d37b);}return _0x238584[_0x052e('0x19')](_0x20d37b)['end']();};}function respondWithResult(_0x47d508,_0x216a54){_0x216a54=_0x216a54||0xc8;return function(_0x2e11f2){if(_0x2e11f2){return _0x47d508['status'](_0x216a54)[_0x052e('0x1a')](_0x2e11f2);}};}function respondWithFilteredResult(_0xd1dc91,_0x331372){return function(_0x5ecc4b){if(_0x5ecc4b){var _0x3ef34b=typeof _0x331372[_0x052e('0x1b')]==='undefined'&&typeof _0x331372[_0x052e('0x1c')]==='undefined';var _0x4f6fa1=_0x5ecc4b[_0x052e('0x1d')];var _0x320efe=_0x3ef34b?0x0:_0x331372[_0x052e('0x1b')];var _0x611764=_0x3ef34b?_0x5ecc4b[_0x052e('0x1d')]:_0x331372[_0x052e('0x1b')]+_0x331372[_0x052e('0x1c')];var _0x3d5e6a;if(_0x611764>=_0x4f6fa1){_0x611764=_0x4f6fa1;_0x3d5e6a=0xc8;}else{_0x3d5e6a=0xce;}_0xd1dc91[_0x052e('0x19')](_0x3d5e6a);return _0xd1dc91[_0x052e('0x1e')](_0x052e('0x1f'),_0x320efe+'-'+_0x611764+'/'+_0x4f6fa1)[_0x052e('0x1a')](_0x5ecc4b);}return null;};}function patchUpdates(_0x5c8419){return function(_0x19567c){try{jsonpatch['apply'](_0x19567c,_0x5c8419,!![]);}catch(_0x59c7ca){return BPromise[_0x052e('0x20')](_0x59c7ca);}return _0x19567c[_0x052e('0x21')]();};}function saveUpdates(_0x15ba2b,_0x58afac){return function(_0x16737d){if(_0x16737d){return _0x16737d[_0x052e('0x22')](_0x15ba2b)[_0x052e('0x23')](function(_0x1d00cd){return _0x1d00cd;});}return null;};}function removeEntity(_0x391ba3,_0x1e9f0d){return function(_0x1be4e2){if(_0x1be4e2){return _0x1be4e2[_0x052e('0x24')]()['then'](function(){_0x391ba3[_0x052e('0x19')](0xcc)[_0x052e('0x25')]();});}};}function handleEntityNotFound(_0x5bde60,_0x4b595e){return function(_0x48865f){if(!_0x48865f){_0x5bde60['sendStatus'](0x194);}return _0x48865f;};}function handleError(_0x2b3d6b,_0x2b88eb){_0x2b88eb=_0x2b88eb||0x1f4;return function(_0x54094c){logger['error'](_0x54094c[_0x052e('0x26')]);if(_0x54094c['name']){delete _0x54094c[_0x052e('0x27')];}_0x2b3d6b['status'](_0x2b88eb)['send'](_0x54094c);};}exports['index']=function(_0x23e35f,_0x577718){var _0x57dc3c={},_0x1fae1e={},_0x196d12={'count':0x0,'rows':[]};var _0x3d1d0d=_[_0x052e('0x28')](db[_0x052e('0x29')][_0x052e('0x2a')],function(_0x536876){return{'name':_0x536876[_0x052e('0x2b')],'type':_0x536876[_0x052e('0x2c')][_0x052e('0x2d')]};});_0x1fae1e['model']=_[_0x052e('0x28')](_0x3d1d0d,'name');_0x1fae1e['query']=_[_0x052e('0x2e')](_0x23e35f[_0x052e('0x2f')]);_0x1fae1e['filters']=_[_0x052e('0x30')](_0x1fae1e[_0x052e('0x31')],_0x1fae1e['query']);_0x57dc3c['attributes']=_[_0x052e('0x30')](_0x1fae1e['model'],qs[_0x052e('0x32')](_0x23e35f[_0x052e('0x2f')][_0x052e('0x32')]));_0x57dc3c[_0x052e('0x33')]=_0x57dc3c['attributes'][_0x052e('0x34')]?_0x57dc3c[_0x052e('0x33')]:_0x1fae1e[_0x052e('0x31')];if(!_0x23e35f[_0x052e('0x2f')][_0x052e('0x35')](_0x052e('0x36'))){_0x57dc3c[_0x052e('0x1c')]=qs[_0x052e('0x1c')](_0x23e35f[_0x052e('0x2f')][_0x052e('0x1c')]);_0x57dc3c[_0x052e('0x1b')]=qs[_0x052e('0x1b')](_0x23e35f[_0x052e('0x2f')][_0x052e('0x1b')]);}_0x57dc3c['order']=qs['sort'](_0x23e35f['query']['sort']);_0x57dc3c[_0x052e('0x37')]=qs[_0x052e('0x38')](_[_0x052e('0x39')](_0x23e35f[_0x052e('0x2f')],_0x1fae1e[_0x052e('0x38')]),_0x3d1d0d);if(_0x23e35f['query'][_0x052e('0x3a')]){_0x57dc3c['where']=_[_0x052e('0x3b')](_0x57dc3c[_0x052e('0x37')],{'$or':_[_0x052e('0x28')](_0x3d1d0d,function(_0xc3b4f2){if(_0xc3b4f2[_0x052e('0x2c')]!==_0x052e('0x3c')){var _0x4d2957={};_0x4d2957[_0xc3b4f2[_0x052e('0x27')]]={'$like':'%'+_0x23e35f[_0x052e('0x2f')][_0x052e('0x3a')]+'%'};return _0x4d2957;}})});}_0x57dc3c=_[_0x052e('0x3b')]({},_0x57dc3c,_0x23e35f[_0x052e('0x3d')]);var _0x27df79={'where':_0x57dc3c[_0x052e('0x37')]};return db[_0x052e('0x29')][_0x052e('0x1d')](_0x27df79)[_0x052e('0x23')](function(_0x4d340d){_0x196d12['count']=_0x4d340d;if(_0x23e35f[_0x052e('0x2f')][_0x052e('0x3e')]){_0x57dc3c['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x57dc3c);})['then'](function(_0x49ee0e){_0x196d12[_0x052e('0x3f')]=_0x49ee0e;return _0x196d12;})['then'](respondWithFilteredResult(_0x577718,_0x57dc3c))[_0x052e('0x40')](handleError(_0x577718,null));};exports[_0x052e('0x41')]=function(_0x915a25,_0x5c2c03){var _0x429a5d={'raw':![],'where':{'id':_0x915a25['params']['id']}},_0x4ba6d8={};_0x4ba6d8[_0x052e('0x31')]=_['keys'](db[_0x052e('0x29')][_0x052e('0x2a')]);_0x4ba6d8[_0x052e('0x2f')]=_['keys'](_0x915a25['query']);_0x4ba6d8[_0x052e('0x38')]=_[_0x052e('0x30')](_0x4ba6d8[_0x052e('0x31')],_0x4ba6d8[_0x052e('0x2f')]);_0x429a5d[_0x052e('0x33')]=_[_0x052e('0x30')](_0x4ba6d8[_0x052e('0x31')],qs[_0x052e('0x32')](_0x915a25['query']['fields']));_0x429a5d[_0x052e('0x33')]=_0x429a5d['attributes']['length']?_0x429a5d[_0x052e('0x33')]:_0x4ba6d8[_0x052e('0x31')];if(_0x915a25['query'][_0x052e('0x3e')]){_0x429a5d[_0x052e('0x42')]=[{'all':!![]}];}_0x429a5d=_[_0x052e('0x3b')]({},_0x429a5d,_0x915a25[_0x052e('0x3d')]);return db['Dynamics365Configuration'][_0x052e('0x43')](_0x429a5d)['then'](handleEntityNotFound(_0x5c2c03,null))[_0x052e('0x23')](respondWithResult(_0x5c2c03,null))[_0x052e('0x40')](handleError(_0x5c2c03,null));};exports['create']=function(_0x5f1bcf,_0x114849){return db[_0x052e('0x29')][_0x052e('0x44')](_0x5f1bcf[_0x052e('0x45')],{})[_0x052e('0x23')](respondWithResult(_0x114849,0xc9))[_0x052e('0x40')](handleError(_0x114849,null));};exports[_0x052e('0x22')]=function(_0x5ed0c3,_0x25150e){if(_0x5ed0c3[_0x052e('0x45')]['id']){delete _0x5ed0c3['body']['id'];}return db[_0x052e('0x29')]['find']({'where':{'id':_0x5ed0c3[_0x052e('0x46')]['id']}})[_0x052e('0x23')](handleEntityNotFound(_0x25150e,null))[_0x052e('0x23')](saveUpdates(_0x5ed0c3[_0x052e('0x45')],null))[_0x052e('0x23')](respondWithResult(_0x25150e,null))['catch'](handleError(_0x25150e,null));};exports[_0x052e('0x24')]=function(_0x53a6be,_0x110365){return db[_0x052e('0x29')][_0x052e('0x43')]({'where':{'id':_0x53a6be[_0x052e('0x46')]['id']}})[_0x052e('0x23')](handleEntityNotFound(_0x110365,null))[_0x052e('0x23')](removeEntity(_0x110365,null))['catch'](handleError(_0x110365,null));};exports[_0x052e('0x47')]=function(_0xc156f6,_0x383221,_0x1c47ba){var _0x1ebff4={};var _0x1b7161={};var _0x1f1331;var _0x9541c6;return db[_0x052e('0x29')][_0x052e('0x48')]({'where':{'id':_0xc156f6[_0x052e('0x46')]['id']}})[_0x052e('0x23')](handleEntityNotFound(_0x383221,null))[_0x052e('0x23')](function(_0xf17caa){if(_0xf17caa){_0x1f1331=_0xf17caa;_0x1b7161[_0x052e('0x31')]=_[_0x052e('0x2e')](db[_0x052e('0x49')][_0x052e('0x2a')]);_0x1b7161[_0x052e('0x2f')]=_[_0x052e('0x2e')](_0xc156f6[_0x052e('0x2f')]);_0x1b7161['filters']=_[_0x052e('0x30')](_0x1b7161[_0x052e('0x31')],_0x1b7161[_0x052e('0x2f')]);_0x1ebff4[_0x052e('0x33')]=_[_0x052e('0x30')](_0x1b7161[_0x052e('0x31')],qs[_0x052e('0x32')](_0xc156f6[_0x052e('0x2f')][_0x052e('0x32')]));_0x1ebff4[_0x052e('0x33')]=_0x1ebff4[_0x052e('0x33')]['length']?_0x1ebff4[_0x052e('0x33')]:_0x1b7161['model'];_0x1ebff4['order']=qs[_0x052e('0x4a')](_0xc156f6[_0x052e('0x2f')]['sort']);_0x1ebff4[_0x052e('0x37')]=qs['filters'](_[_0x052e('0x39')](_0xc156f6['query'],_0x1b7161[_0x052e('0x38')]));if(_0xc156f6['query']['filter']){_0x1ebff4[_0x052e('0x37')]=_[_0x052e('0x3b')](_0x1ebff4[_0x052e('0x37')],{'$or':_['map'](_0x1ebff4['attributes'],function(_0x1013e0){var _0x3304a5={};_0x3304a5[_0x1013e0]={'$like':'%'+_0xc156f6[_0x052e('0x2f')][_0x052e('0x3a')]+'%'};return _0x3304a5;})});}_0x1ebff4=_[_0x052e('0x3b')]({},_0x1ebff4,_0xc156f6[_0x052e('0x3d')]);return _0x1f1331[_0x052e('0x47')](_0x1ebff4);}})['then'](function(_0x58c22e){if(_0x58c22e){_0x9541c6=_0x58c22e[_0x052e('0x34')];if(!_0xc156f6[_0x052e('0x2f')][_0x052e('0x35')](_0x052e('0x36'))){_0x1ebff4[_0x052e('0x1c')]=qs[_0x052e('0x1c')](_0xc156f6['query'][_0x052e('0x1c')]);_0x1ebff4[_0x052e('0x1b')]=qs[_0x052e('0x1b')](_0xc156f6[_0x052e('0x2f')][_0x052e('0x1b')]);}return _0x1f1331['getFields'](_0x1ebff4);}})['then'](function(_0x4e9e94){if(_0x4e9e94){return _0x4e9e94?{'count':_0x9541c6,'rows':_0x4e9e94}:null;}})[_0x052e('0x23')](respondWithResult(_0x383221,null))[_0x052e('0x40')](handleError(_0x383221,null));};exports[_0x052e('0x4b')]=function(_0x26d99d,_0x27ac7a,_0x5cf6e2){var _0x1a2043={};var _0x382610={};var _0x59740d;var _0x2891fd;return db['Dynamics365Configuration'][_0x052e('0x48')]({'where':{'id':_0x26d99d['params']['id']}})[_0x052e('0x23')](handleEntityNotFound(_0x27ac7a,null))[_0x052e('0x23')](function(_0x103443){if(_0x103443){_0x59740d=_0x103443;_0x382610['model']=_[_0x052e('0x2e')](db['Dynamics365Field'][_0x052e('0x2a')]);_0x382610[_0x052e('0x2f')]=_['keys'](_0x26d99d['query']);_0x382610[_0x052e('0x38')]=_['intersection'](_0x382610[_0x052e('0x31')],_0x382610[_0x052e('0x2f')]);_0x1a2043[_0x052e('0x33')]=_[_0x052e('0x30')](_0x382610['model'],qs[_0x052e('0x32')](_0x26d99d['query'][_0x052e('0x32')]));_0x1a2043[_0x052e('0x33')]=_0x1a2043[_0x052e('0x33')][_0x052e('0x34')]?_0x1a2043[_0x052e('0x33')]:_0x382610[_0x052e('0x31')];_0x1a2043[_0x052e('0x4c')]=qs['sort'](_0x26d99d[_0x052e('0x2f')][_0x052e('0x4a')]);_0x1a2043[_0x052e('0x37')]=qs[_0x052e('0x38')](_[_0x052e('0x39')](_0x26d99d[_0x052e('0x2f')],_0x382610[_0x052e('0x38')]));if(_0x26d99d['query']['filter']){_0x1a2043[_0x052e('0x37')]=_[_0x052e('0x3b')](_0x1a2043['where'],{'$or':_[_0x052e('0x28')](_0x1a2043[_0x052e('0x33')],function(_0x32bb1a){var _0x3eaf7b={};_0x3eaf7b[_0x32bb1a]={'$like':'%'+_0x26d99d[_0x052e('0x2f')]['filter']+'%'};return _0x3eaf7b;})});}_0x1a2043=_[_0x052e('0x3b')]({},_0x1a2043,_0x26d99d[_0x052e('0x3d')]);return _0x59740d['getSubjects'](_0x1a2043);}})[_0x052e('0x23')](function(_0x1628ae){if(_0x1628ae){_0x2891fd=_0x1628ae[_0x052e('0x34')];if(!_0x26d99d[_0x052e('0x2f')][_0x052e('0x35')](_0x052e('0x36'))){_0x1a2043[_0x052e('0x1c')]=qs[_0x052e('0x1c')](_0x26d99d['query'][_0x052e('0x1c')]);_0x1a2043[_0x052e('0x1b')]=qs[_0x052e('0x1b')](_0x26d99d[_0x052e('0x2f')][_0x052e('0x1b')]);}return _0x59740d[_0x052e('0x4b')](_0x1a2043);}})[_0x052e('0x23')](function(_0x57719e){if(_0x57719e){return _0x57719e?{'count':_0x2891fd,'rows':_0x57719e}:null;}})[_0x052e('0x23')](respondWithResult(_0x27ac7a,null))[_0x052e('0x40')](handleError(_0x27ac7a,null));};exports[_0x052e('0x4d')]=function(_0x241a9c,_0x5b2c3d,_0x47df7c){var _0x469a3e={};var _0x29ed45={};var _0x584eaf;var _0x19a3c9;return db['Dynamics365Configuration'][_0x052e('0x48')]({'where':{'id':_0x241a9c[_0x052e('0x46')]['id']}})[_0x052e('0x23')](handleEntityNotFound(_0x5b2c3d,null))[_0x052e('0x23')](function(_0x204219){if(_0x204219){_0x584eaf=_0x204219;_0x29ed45[_0x052e('0x31')]=_[_0x052e('0x2e')](db[_0x052e('0x49')][_0x052e('0x2a')]);_0x29ed45[_0x052e('0x2f')]=_[_0x052e('0x2e')](_0x241a9c[_0x052e('0x2f')]);_0x29ed45[_0x052e('0x38')]=_['intersection'](_0x29ed45[_0x052e('0x31')],_0x29ed45['query']);_0x469a3e[_0x052e('0x33')]=_[_0x052e('0x30')](_0x29ed45[_0x052e('0x31')],qs[_0x052e('0x32')](_0x241a9c[_0x052e('0x2f')]['fields']));_0x469a3e[_0x052e('0x33')]=_0x469a3e[_0x052e('0x33')][_0x052e('0x34')]?_0x469a3e[_0x052e('0x33')]:_0x29ed45[_0x052e('0x31')];_0x469a3e[_0x052e('0x4c')]=qs[_0x052e('0x4a')](_0x241a9c[_0x052e('0x2f')][_0x052e('0x4a')]);_0x469a3e[_0x052e('0x37')]=qs[_0x052e('0x38')](_['pick'](_0x241a9c[_0x052e('0x2f')],_0x29ed45[_0x052e('0x38')]));if(_0x241a9c[_0x052e('0x2f')][_0x052e('0x3a')]){_0x469a3e[_0x052e('0x37')]=_[_0x052e('0x3b')](_0x469a3e[_0x052e('0x37')],{'$or':_[_0x052e('0x28')](_0x469a3e['attributes'],function(_0x10e3cf){var _0x118af2={};_0x118af2[_0x10e3cf]={'$like':'%'+_0x241a9c[_0x052e('0x2f')][_0x052e('0x3a')]+'%'};return _0x118af2;})});}_0x469a3e=_['merge']({},_0x469a3e,_0x241a9c[_0x052e('0x3d')]);return _0x584eaf[_0x052e('0x4d')](_0x469a3e);}})[_0x052e('0x23')](function(_0x2b1f5d){if(_0x2b1f5d){_0x19a3c9=_0x2b1f5d[_0x052e('0x34')];if(!_0x241a9c[_0x052e('0x2f')][_0x052e('0x35')](_0x052e('0x36'))){_0x469a3e[_0x052e('0x1c')]=qs[_0x052e('0x1c')](_0x241a9c['query']['limit']);_0x469a3e['offset']=qs[_0x052e('0x1b')](_0x241a9c[_0x052e('0x2f')][_0x052e('0x1b')]);}return _0x584eaf[_0x052e('0x4d')](_0x469a3e);}})['then'](function(_0x1c1a2c){if(_0x1c1a2c){return _0x1c1a2c?{'count':_0x19a3c9,'rows':_0x1c1a2c}:null;}})['then'](respondWithResult(_0x5b2c3d,null))[_0x052e('0x40')](handleError(_0x5b2c3d,null));}; \ No newline at end of file +var _0x7722=['VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','body','getFields','Dynamics365Field','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x7722,0x10b));var _0x2772=function(_0x114fd0,_0x36d30f){_0x114fd0=_0x114fd0-0x0;var _0x533de2=_0x7722[_0x114fd0];return _0x533de2;};'use strict';var emlformat=require(_0x2772('0x0'));var rimraf=require(_0x2772('0x1'));var zipdir=require(_0x2772('0x2'));var jsonpatch=require(_0x2772('0x3'));var rp=require(_0x2772('0x4'));var moment=require('moment');var BPromise=require(_0x2772('0x5'));var Mustache=require('mustache');var util=require(_0x2772('0x6'));var path=require(_0x2772('0x7'));var sox=require(_0x2772('0x8'));var csv=require(_0x2772('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2772('0xa'));var _=require(_0x2772('0xb'));var squel=require(_0x2772('0xc'));var crypto=require(_0x2772('0xd'));var jsforce=require(_0x2772('0xe'));var deskjs=require(_0x2772('0xf'));var toCsv=require(_0x2772('0x9'));var querystring=require('querystring');var Papa=require(_0x2772('0x10'));var Redis=require(_0x2772('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2772('0x12'));var as=require(_0x2772('0x13'));var hardwareService=require(_0x2772('0x14'));var logger=require(_0x2772('0x15'))('api');var utils=require(_0x2772('0x16'));var config=require(_0x2772('0x17'));var licenseUtil=require(_0x2772('0x18'));var db=require(_0x2772('0x19'))['db'];function respondWithStatusCode(_0x2590cf,_0x5b50d7){_0x5b50d7=_0x5b50d7||0xcc;return function(_0x4ad8a7){if(_0x4ad8a7){return _0x2590cf[_0x2772('0x1a')](_0x5b50d7);}return _0x2590cf[_0x2772('0x1b')](_0x5b50d7)[_0x2772('0x1c')]();};}function respondWithResult(_0x5e8c03,_0x32d246){_0x32d246=_0x32d246||0xc8;return function(_0x2746d0){if(_0x2746d0){return _0x5e8c03[_0x2772('0x1b')](_0x32d246)['json'](_0x2746d0);}};}function respondWithFilteredResult(_0x50f702,_0x5e012e){return function(_0x185e4a){if(_0x185e4a){var _0x287fa3=typeof _0x5e012e['offset']===_0x2772('0x1d')&&typeof _0x5e012e[_0x2772('0x1e')]===_0x2772('0x1d');var _0x50f07c=_0x185e4a[_0x2772('0x1f')];var _0x54c8fc=_0x287fa3?0x0:_0x5e012e[_0x2772('0x20')];var _0x41fac5=_0x287fa3?_0x185e4a['count']:_0x5e012e[_0x2772('0x20')]+_0x5e012e[_0x2772('0x1e')];var _0x43d166;if(_0x41fac5>=_0x50f07c){_0x41fac5=_0x50f07c;_0x43d166=0xc8;}else{_0x43d166=0xce;}_0x50f702[_0x2772('0x1b')](_0x43d166);return _0x50f702[_0x2772('0x21')](_0x2772('0x22'),_0x54c8fc+'-'+_0x41fac5+'/'+_0x50f07c)[_0x2772('0x23')](_0x185e4a);}return null;};}function patchUpdates(_0x33b5f0){return function(_0x28db54){try{jsonpatch[_0x2772('0x24')](_0x28db54,_0x33b5f0,!![]);}catch(_0x41ed5f){return BPromise[_0x2772('0x25')](_0x41ed5f);}return _0x28db54[_0x2772('0x26')]();};}function saveUpdates(_0x206ac9,_0x1098b4){return function(_0x2c61b2){if(_0x2c61b2){return _0x2c61b2[_0x2772('0x27')](_0x206ac9)[_0x2772('0x28')](function(_0x9c8046){return _0x9c8046;});}return null;};}function removeEntity(_0x1506d9,_0x473660){return function(_0x4f1472){if(_0x4f1472){return _0x4f1472[_0x2772('0x29')]()[_0x2772('0x28')](function(){_0x1506d9[_0x2772('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8011,_0x3017ae){return function(_0x3dd559){if(!_0x3dd559){_0x4f8011['sendStatus'](0x194);}return _0x3dd559;};}function handleError(_0x3037df,_0x221a41){_0x221a41=_0x221a41||0x1f4;return function(_0x4fd23e){logger[_0x2772('0x2a')](_0x4fd23e['stack']);if(_0x4fd23e[_0x2772('0x2b')]){delete _0x4fd23e[_0x2772('0x2b')];}_0x3037df[_0x2772('0x1b')](_0x221a41)[_0x2772('0x2c')](_0x4fd23e);};}exports[_0x2772('0x2d')]=function(_0x348b39,_0x10e1d9){var _0x48e932={},_0x11ca74={},_0xff8309={'count':0x0,'rows':[]};var _0x4f13b7=_[_0x2772('0x2e')](db[_0x2772('0x2f')][_0x2772('0x30')],function(_0x4fa63d){return{'name':_0x4fa63d['fieldName'],'type':_0x4fa63d['type'][_0x2772('0x31')]};});_0x11ca74[_0x2772('0x32')]=_[_0x2772('0x2e')](_0x4f13b7,_0x2772('0x2b'));_0x11ca74[_0x2772('0x33')]=_[_0x2772('0x34')](_0x348b39['query']);_0x11ca74[_0x2772('0x35')]=_[_0x2772('0x36')](_0x11ca74['model'],_0x11ca74[_0x2772('0x33')]);_0x48e932[_0x2772('0x37')]=_['intersection'](_0x11ca74[_0x2772('0x32')],qs[_0x2772('0x38')](_0x348b39[_0x2772('0x33')][_0x2772('0x38')]));_0x48e932[_0x2772('0x37')]=_0x48e932[_0x2772('0x37')]['length']?_0x48e932[_0x2772('0x37')]:_0x11ca74[_0x2772('0x32')];if(!_0x348b39[_0x2772('0x33')][_0x2772('0x39')]('nolimit')){_0x48e932[_0x2772('0x1e')]=qs[_0x2772('0x1e')](_0x348b39[_0x2772('0x33')][_0x2772('0x1e')]);_0x48e932[_0x2772('0x20')]=qs['offset'](_0x348b39[_0x2772('0x33')]['offset']);}_0x48e932[_0x2772('0x3a')]=qs[_0x2772('0x3b')](_0x348b39[_0x2772('0x33')][_0x2772('0x3b')]);_0x48e932[_0x2772('0x3c')]=qs[_0x2772('0x35')](_[_0x2772('0x3d')](_0x348b39['query'],_0x11ca74[_0x2772('0x35')]),_0x4f13b7);if(_0x348b39[_0x2772('0x33')][_0x2772('0x3e')]){_0x48e932['where']=_[_0x2772('0x3f')](_0x48e932[_0x2772('0x3c')],{'$or':_['map'](_0x4f13b7,function(_0x444c04){if(_0x444c04[_0x2772('0x40')]!==_0x2772('0x41')){var _0x4a5ae6={};_0x4a5ae6[_0x444c04['name']]={'$like':'%'+_0x348b39['query'][_0x2772('0x3e')]+'%'};return _0x4a5ae6;}})});}_0x48e932=_[_0x2772('0x3f')]({},_0x48e932,_0x348b39['options']);var _0xb3da7={'where':_0x48e932[_0x2772('0x3c')]};return db[_0x2772('0x2f')]['count'](_0xb3da7)[_0x2772('0x28')](function(_0x3feaf2){_0xff8309[_0x2772('0x1f')]=_0x3feaf2;if(_0x348b39[_0x2772('0x33')][_0x2772('0x42')]){_0x48e932[_0x2772('0x43')]=[{'all':!![]}];}return db[_0x2772('0x2f')][_0x2772('0x44')](_0x48e932);})[_0x2772('0x28')](function(_0x430088){_0xff8309[_0x2772('0x45')]=_0x430088;return _0xff8309;})[_0x2772('0x28')](respondWithFilteredResult(_0x10e1d9,_0x48e932))['catch'](handleError(_0x10e1d9,null));};exports[_0x2772('0x46')]=function(_0x200c41,_0x548ccd){var _0x13da35={'raw':![],'where':{'id':_0x200c41[_0x2772('0x47')]['id']}},_0x274f07={};_0x274f07['model']=_[_0x2772('0x34')](db[_0x2772('0x2f')][_0x2772('0x30')]);_0x274f07[_0x2772('0x33')]=_[_0x2772('0x34')](_0x200c41[_0x2772('0x33')]);_0x274f07[_0x2772('0x35')]=_['intersection'](_0x274f07[_0x2772('0x32')],_0x274f07[_0x2772('0x33')]);_0x13da35[_0x2772('0x37')]=_[_0x2772('0x36')](_0x274f07[_0x2772('0x32')],qs['fields'](_0x200c41['query'][_0x2772('0x38')]));_0x13da35['attributes']=_0x13da35[_0x2772('0x37')][_0x2772('0x48')]?_0x13da35[_0x2772('0x37')]:_0x274f07[_0x2772('0x32')];if(_0x200c41[_0x2772('0x33')][_0x2772('0x42')]){_0x13da35[_0x2772('0x43')]=[{'all':!![]}];}_0x13da35=_[_0x2772('0x3f')]({},_0x13da35,_0x200c41[_0x2772('0x49')]);return db[_0x2772('0x2f')][_0x2772('0x4a')](_0x13da35)[_0x2772('0x28')](handleEntityNotFound(_0x548ccd,null))['then'](respondWithResult(_0x548ccd,null))[_0x2772('0x4b')](handleError(_0x548ccd,null));};exports[_0x2772('0x4c')]=function(_0x477633,_0x18b3df){return db[_0x2772('0x2f')][_0x2772('0x4c')](_0x477633[_0x2772('0x4d')],{})[_0x2772('0x28')](respondWithResult(_0x18b3df,0xc9))[_0x2772('0x4b')](handleError(_0x18b3df,null));};exports[_0x2772('0x27')]=function(_0x4d04f1,_0x54d017){if(_0x4d04f1[_0x2772('0x4d')]['id']){delete _0x4d04f1[_0x2772('0x4d')]['id'];}return db[_0x2772('0x2f')][_0x2772('0x4a')]({'where':{'id':_0x4d04f1[_0x2772('0x47')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x54d017,null))[_0x2772('0x28')](saveUpdates(_0x4d04f1['body'],null))[_0x2772('0x28')](respondWithResult(_0x54d017,null))[_0x2772('0x4b')](handleError(_0x54d017,null));};exports[_0x2772('0x29')]=function(_0x2ac1e4,_0x2f4da1){return db['Dynamics365Configuration']['find']({'where':{'id':_0x2ac1e4[_0x2772('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f4da1,null))[_0x2772('0x28')](removeEntity(_0x2f4da1,null))[_0x2772('0x4b')](handleError(_0x2f4da1,null));};exports[_0x2772('0x4e')]=function(_0x3e9e61,_0x2c938c,_0x4c5485){var _0x44fbe6={};var _0x19e96d={};var _0x205667;var _0xc50032;return db[_0x2772('0x2f')]['findOne']({'where':{'id':_0x3e9e61[_0x2772('0x47')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x2c938c,null))[_0x2772('0x28')](function(_0xba631a){if(_0xba631a){_0x205667=_0xba631a;_0x19e96d['model']=_[_0x2772('0x34')](db[_0x2772('0x4f')][_0x2772('0x30')]);_0x19e96d[_0x2772('0x33')]=_[_0x2772('0x34')](_0x3e9e61[_0x2772('0x33')]);_0x19e96d[_0x2772('0x35')]=_[_0x2772('0x36')](_0x19e96d[_0x2772('0x32')],_0x19e96d['query']);_0x44fbe6[_0x2772('0x37')]=_[_0x2772('0x36')](_0x19e96d[_0x2772('0x32')],qs[_0x2772('0x38')](_0x3e9e61['query'][_0x2772('0x38')]));_0x44fbe6['attributes']=_0x44fbe6[_0x2772('0x37')][_0x2772('0x48')]?_0x44fbe6[_0x2772('0x37')]:_0x19e96d[_0x2772('0x32')];_0x44fbe6[_0x2772('0x3a')]=qs['sort'](_0x3e9e61[_0x2772('0x33')][_0x2772('0x3b')]);_0x44fbe6[_0x2772('0x3c')]=qs[_0x2772('0x35')](_[_0x2772('0x3d')](_0x3e9e61[_0x2772('0x33')],_0x19e96d[_0x2772('0x35')]));if(_0x3e9e61[_0x2772('0x33')][_0x2772('0x3e')]){_0x44fbe6['where']=_[_0x2772('0x3f')](_0x44fbe6[_0x2772('0x3c')],{'$or':_[_0x2772('0x2e')](_0x44fbe6[_0x2772('0x37')],function(_0x5c01cd){var _0x324915={};_0x324915[_0x5c01cd]={'$like':'%'+_0x3e9e61[_0x2772('0x33')][_0x2772('0x3e')]+'%'};return _0x324915;})});}_0x44fbe6=_['merge']({},_0x44fbe6,_0x3e9e61[_0x2772('0x49')]);return _0x205667['getFields'](_0x44fbe6);}})[_0x2772('0x28')](function(_0x5d07ae){if(_0x5d07ae){_0xc50032=_0x5d07ae[_0x2772('0x48')];if(!_0x3e9e61['query'][_0x2772('0x39')](_0x2772('0x50'))){_0x44fbe6[_0x2772('0x1e')]=qs[_0x2772('0x1e')](_0x3e9e61['query'][_0x2772('0x1e')]);_0x44fbe6['offset']=qs[_0x2772('0x20')](_0x3e9e61[_0x2772('0x33')]['offset']);}return _0x205667[_0x2772('0x4e')](_0x44fbe6);}})[_0x2772('0x28')](function(_0x3f0af4){if(_0x3f0af4){return _0x3f0af4?{'count':_0xc50032,'rows':_0x3f0af4}:null;}})[_0x2772('0x28')](respondWithResult(_0x2c938c,null))['catch'](handleError(_0x2c938c,null));};exports['getSubjects']=function(_0x4d434c,_0x439177,_0x2621fb){var _0x5bc570={};var _0x5a41d6={};var _0x2c2eba;var _0x2ca302;return db[_0x2772('0x2f')]['findOne']({'where':{'id':_0x4d434c[_0x2772('0x47')]['id']}})['then'](handleEntityNotFound(_0x439177,null))[_0x2772('0x28')](function(_0xd5ec66){if(_0xd5ec66){_0x2c2eba=_0xd5ec66;_0x5a41d6[_0x2772('0x32')]=_['keys'](db[_0x2772('0x4f')][_0x2772('0x30')]);_0x5a41d6[_0x2772('0x33')]=_[_0x2772('0x34')](_0x4d434c[_0x2772('0x33')]);_0x5a41d6[_0x2772('0x35')]=_[_0x2772('0x36')](_0x5a41d6[_0x2772('0x32')],_0x5a41d6[_0x2772('0x33')]);_0x5bc570[_0x2772('0x37')]=_[_0x2772('0x36')](_0x5a41d6[_0x2772('0x32')],qs[_0x2772('0x38')](_0x4d434c[_0x2772('0x33')]['fields']));_0x5bc570['attributes']=_0x5bc570[_0x2772('0x37')][_0x2772('0x48')]?_0x5bc570[_0x2772('0x37')]:_0x5a41d6[_0x2772('0x32')];_0x5bc570[_0x2772('0x3a')]=qs[_0x2772('0x3b')](_0x4d434c[_0x2772('0x33')][_0x2772('0x3b')]);_0x5bc570[_0x2772('0x3c')]=qs[_0x2772('0x35')](_[_0x2772('0x3d')](_0x4d434c[_0x2772('0x33')],_0x5a41d6[_0x2772('0x35')]));if(_0x4d434c[_0x2772('0x33')][_0x2772('0x3e')]){_0x5bc570[_0x2772('0x3c')]=_[_0x2772('0x3f')](_0x5bc570[_0x2772('0x3c')],{'$or':_['map'](_0x5bc570[_0x2772('0x37')],function(_0x298e26){var _0x18101c={};_0x18101c[_0x298e26]={'$like':'%'+_0x4d434c[_0x2772('0x33')][_0x2772('0x3e')]+'%'};return _0x18101c;})});}_0x5bc570=_[_0x2772('0x3f')]({},_0x5bc570,_0x4d434c['options']);return _0x2c2eba[_0x2772('0x51')](_0x5bc570);}})[_0x2772('0x28')](function(_0x1ff1c4){if(_0x1ff1c4){_0x2ca302=_0x1ff1c4[_0x2772('0x48')];if(!_0x4d434c['query'][_0x2772('0x39')](_0x2772('0x50'))){_0x5bc570[_0x2772('0x1e')]=qs[_0x2772('0x1e')](_0x4d434c['query'][_0x2772('0x1e')]);_0x5bc570['offset']=qs[_0x2772('0x20')](_0x4d434c[_0x2772('0x33')]['offset']);}return _0x2c2eba[_0x2772('0x51')](_0x5bc570);}})[_0x2772('0x28')](function(_0x1638e4){if(_0x1638e4){return _0x1638e4?{'count':_0x2ca302,'rows':_0x1638e4}:null;}})['then'](respondWithResult(_0x439177,null))['catch'](handleError(_0x439177,null));};exports[_0x2772('0x52')]=function(_0x4b9768,_0x337e18,_0x451a07){var _0x59aa0e={};var _0x52f231={};var _0x387b66;var _0x3490a8;return db[_0x2772('0x2f')]['findOne']({'where':{'id':_0x4b9768[_0x2772('0x47')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x337e18,null))[_0x2772('0x28')](function(_0x2a2cac){if(_0x2a2cac){_0x387b66=_0x2a2cac;_0x52f231[_0x2772('0x32')]=_[_0x2772('0x34')](db[_0x2772('0x4f')][_0x2772('0x30')]);_0x52f231[_0x2772('0x33')]=_[_0x2772('0x34')](_0x4b9768[_0x2772('0x33')]);_0x52f231[_0x2772('0x35')]=_[_0x2772('0x36')](_0x52f231['model'],_0x52f231[_0x2772('0x33')]);_0x59aa0e[_0x2772('0x37')]=_[_0x2772('0x36')](_0x52f231[_0x2772('0x32')],qs[_0x2772('0x38')](_0x4b9768[_0x2772('0x33')][_0x2772('0x38')]));_0x59aa0e[_0x2772('0x37')]=_0x59aa0e[_0x2772('0x37')][_0x2772('0x48')]?_0x59aa0e[_0x2772('0x37')]:_0x52f231[_0x2772('0x32')];_0x59aa0e[_0x2772('0x3a')]=qs['sort'](_0x4b9768[_0x2772('0x33')]['sort']);_0x59aa0e[_0x2772('0x3c')]=qs[_0x2772('0x35')](_[_0x2772('0x3d')](_0x4b9768['query'],_0x52f231[_0x2772('0x35')]));if(_0x4b9768[_0x2772('0x33')][_0x2772('0x3e')]){_0x59aa0e[_0x2772('0x3c')]=_['merge'](_0x59aa0e['where'],{'$or':_[_0x2772('0x2e')](_0x59aa0e['attributes'],function(_0x231af4){var _0x316994={};_0x316994[_0x231af4]={'$like':'%'+_0x4b9768['query']['filter']+'%'};return _0x316994;})});}_0x59aa0e=_[_0x2772('0x3f')]({},_0x59aa0e,_0x4b9768['options']);return _0x387b66[_0x2772('0x52')](_0x59aa0e);}})[_0x2772('0x28')](function(_0x5e8662){if(_0x5e8662){_0x3490a8=_0x5e8662[_0x2772('0x48')];if(!_0x4b9768[_0x2772('0x33')][_0x2772('0x39')]('nolimit')){_0x59aa0e[_0x2772('0x1e')]=qs[_0x2772('0x1e')](_0x4b9768['query'][_0x2772('0x1e')]);_0x59aa0e[_0x2772('0x20')]=qs[_0x2772('0x20')](_0x4b9768[_0x2772('0x33')][_0x2772('0x20')]);}return _0x387b66[_0x2772('0x52')](_0x59aa0e);}})[_0x2772('0x28')](function(_0x20b99b){if(_0x20b99b){return _0x20b99b?{'count':_0x3490a8,'rows':_0x20b99b}:null;}})[_0x2772('0x28')](respondWithResult(_0x337e18,null))[_0x2772('0x4b')](handleError(_0x337e18,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ba18069..e9ae6bb 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4de51e,_0x50f4c2){var _0x403e8d=function(_0x3ac0cb){while(--_0x3ac0cb){_0x4de51e['push'](_0x4de51e['shift']());}};_0x403e8d(++_0x50f4c2);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x399338,_0x11496b){_0x399338=_0x399338-0x0;var _0x3c4485=_0xf3cd[_0x399338];return _0x3c4485;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x17aa3d,_0x412de9){var _0x9504dc=function(_0x42a52c){while(--_0x42a52c){_0x17aa3d['push'](_0x17aa3d['shift']());}};_0x9504dc(++_0x412de9);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x429a16,_0xff2398){_0x429a16=_0x429a16-0x0;var _0x2ba31d=_0x8d0e[_0x429a16];return _0x2ba31d;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'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 408b5b0..2d8595e 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 _0x938d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x938d,0x189));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd938('0x0'));var util=require(_0xd938('0x1'));var moment=require('moment');var BPromise=require(_0xd938('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd938('0x3'));var db=require(_0xd938('0x4'))['db'];var utils=require(_0xd938('0x5'));var logger=require(_0xd938('0x6'))(_0xd938('0x7'));var config=require(_0xd938('0x8'));var jayson=require(_0xd938('0x9'));var client=jayson['client'][_0xd938('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x813268,_0x32b48e,_0x11abc8){return new BPromise(function(_0x41e252,_0x388dd3){return client['request'](_0x813268,_0x11abc8)[_0xd938('0xb')](function(_0x1411ce){logger['info'](_0xd938('0xc'),_0x32b48e,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x32b48e,_0xd938('0xd'),JSON[_0xd938('0xe')](_0x1411ce));if(_0x1411ce[_0xd938('0xf')]){if(_0x1411ce['error'][_0xd938('0x10')]===0x1f4){logger[_0xd938('0xf')](_0xd938('0xc'),_0x32b48e,_0x1411ce[_0xd938('0xf')][_0xd938('0x11')]);return _0x388dd3(_0x1411ce[_0xd938('0xf')]['message']);}logger[_0xd938('0xf')](_0xd938('0xc'),_0x32b48e,_0x1411ce[_0xd938('0xf')][_0xd938('0x11')]);return _0x41e252(_0x1411ce[_0xd938('0xf')][_0xd938('0x11')]);}else{logger[_0xd938('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x32b48e,_0xd938('0xd'));_0x41e252(_0x1411ce[_0xd938('0x13')]['message']);}})[_0xd938('0x14')](function(_0x1d4892){logger[_0xd938('0xf')](_0xd938('0xc'),_0x32b48e,_0x1d4892);_0x388dd3(_0x1d4892);});});} \ No newline at end of file +var _0xfa10=['moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util'];(function(_0x44d43d,_0x1e966){var _0x271474=function(_0x31321e){while(--_0x31321e){_0x44d43d['push'](_0x44d43d['shift']());}};_0x271474(++_0x1e966);}(_0xfa10,0x1c7));var _0x0fa1=function(_0x4f24b4,_0xa286a2){_0x4f24b4=_0x4f24b4-0x0;var _0x29c26f=_0xfa10[_0x4f24b4];return _0x29c26f;};'use strict';var _=require('lodash');var util=require(_0x0fa1('0x0'));var moment=require(_0x0fa1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fa1('0x2'));var db=require(_0x0fa1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fa1('0x4'));var config=require(_0x0fa1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0fa1('0x6')][_0x0fa1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x118c6d,_0x226a00,_0x59039a){return new BPromise(function(_0x225f5b,_0x13ab07){return client[_0x0fa1('0x8')](_0x118c6d,_0x59039a)[_0x0fa1('0x9')](function(_0x16825a){logger[_0x0fa1('0xa')](_0x0fa1('0xb'),_0x226a00,_0x0fa1('0xc'));logger[_0x0fa1('0xd')](_0x0fa1('0xe'),_0x226a00,_0x0fa1('0xc'),JSON[_0x0fa1('0xf')](_0x16825a));if(_0x16825a[_0x0fa1('0x10')]){if(_0x16825a['error']['code']===0x1f4){logger['error'](_0x0fa1('0xb'),_0x226a00,_0x16825a['error'][_0x0fa1('0x11')]);return _0x13ab07(_0x16825a['error'][_0x0fa1('0x11')]);}logger[_0x0fa1('0x10')](_0x0fa1('0xb'),_0x226a00,_0x16825a[_0x0fa1('0x10')][_0x0fa1('0x11')]);return _0x225f5b(_0x16825a[_0x0fa1('0x10')]['message']);}else{logger[_0x0fa1('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x226a00,'request\x20sent');_0x225f5b(_0x16825a['result'][_0x0fa1('0x11')]);}})[_0x0fa1('0x12')](function(_0x54790c){logger[_0x0fa1('0x10')](_0x0fa1('0xb'),_0x226a00,_0x54790c);_0x13ab07(_0x54790c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a7eae00..a5f2bc9 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 _0xf5dd=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x290844,_0x366077){var _0x546847=function(_0x4ea65e){while(--_0x4ea65e){_0x290844['push'](_0x290844['shift']());}};_0x546847(++_0x366077);}(_0xf5dd,0x1c9));var _0xdf5d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf5dd[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xdf5d('0x0'));var util=require(_0xdf5d('0x1'));var path=require(_0xdf5d('0x2'));var timeout=require(_0xdf5d('0x3'));var express=require('express');var router=express[_0xdf5d('0x4')]();var fs_extra=require(_0xdf5d('0x5'));var auth=require(_0xdf5d('0x6'));var interaction=require(_0xdf5d('0x7'));var config=require('../../config/environment');var controller=require(_0xdf5d('0x8'));router[_0xdf5d('0x9')]('/',auth[_0xdf5d('0xa')](),controller[_0xdf5d('0xb')]);router[_0xdf5d('0x9')]('/:id',auth[_0xdf5d('0xa')](),controller[_0xdf5d('0xc')]);router[_0xdf5d('0xd')]('/',auth[_0xdf5d('0xa')](),controller[_0xdf5d('0xe')]);router[_0xdf5d('0xf')](_0xdf5d('0x10'),auth['isAuthenticated'](),controller[_0xdf5d('0x11')]);router['delete'](_0xdf5d('0x10'),auth[_0xdf5d('0xa')](),controller[_0xdf5d('0x12')]);module[_0xdf5d('0x13')]=router; \ No newline at end of file +var _0xd51b=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x55112d,_0x136e0b){var _0x3b9d33=function(_0x494573){while(--_0x494573){_0x55112d['push'](_0x55112d['shift']());}};_0x3b9d33(++_0x136e0b);}(_0xd51b,0x72));var _0xbd51=function(_0x4ef6b4,_0x2f503a){_0x4ef6b4=_0x4ef6b4-0x0;var _0xad7c33=_0xd51b[_0x4ef6b4];return _0xad7c33;};'use strict';var multer=require(_0xbd51('0x0'));var util=require(_0xbd51('0x1'));var path=require(_0xbd51('0x2'));var timeout=require(_0xbd51('0x3'));var express=require(_0xbd51('0x4'));var router=express[_0xbd51('0x5')]();var fs_extra=require(_0xbd51('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbd51('0x7'));var config=require(_0xbd51('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xbd51('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd51('0xa')]);router['get'](_0xbd51('0xb'),auth[_0xbd51('0xc')](),controller[_0xbd51('0xd')]);router[_0xbd51('0xe')]('/',auth[_0xbd51('0xc')](),controller['create']);router[_0xbd51('0xf')]('/:id',auth[_0xbd51('0xc')](),controller[_0xbd51('0x10')]);router[_0xbd51('0x11')](_0xbd51('0xb'),auth[_0xbd51('0xc')](),controller[_0xbd51('0x12')]);module[_0xbd51('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7dc302c..395f5ab 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 _0x603c=['string','variable','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x221fdb,_0x25014f){var _0x2c482e=function(_0x5368e3){while(--_0x5368e3){_0x221fdb['push'](_0x221fdb['shift']());}};_0x2c482e(++_0x25014f);}(_0x603c,0xee));var _0xc603=function(_0x532054,_0x32fe3d){_0x532054=_0x532054-0x0;var _0x25446a=_0x603c[_0x532054];return _0x25446a;};'use strict';var Sequelize=require('sequelize');module[_0xc603('0x0')]={'type':{'type':Sequelize[_0xc603('0x1')](_0xc603('0x2'),_0xc603('0x3'),'customVariable',_0xc603('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc603('0x5')]},'key':{'type':Sequelize[_0xc603('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc603('0x3'),_0xc603('0x6'))},'keyContent':{'type':Sequelize[_0xc603('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc603('0x5')]},'customField':{'type':Sequelize[_0xc603('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc603('0x5')]}}; \ No newline at end of file +var _0xfb74=['exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0xfb74,0x17b));var _0x4fb7=function(_0x125a8a,_0x490d31){_0x125a8a=_0x125a8a-0x0;var _0xe767a5=_0xfb74[_0x125a8a];return _0xe767a5;};'use strict';var Sequelize=require(_0x4fb7('0x0'));module[_0x4fb7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4fb7('0x2'),'variable',_0x4fb7('0x3'),_0x4fb7('0x4'),_0x4fb7('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4fb7('0x6')]},'key':{'type':Sequelize[_0x4fb7('0x6')]},'keyType':{'type':Sequelize[_0x4fb7('0x7')](_0x4fb7('0x2'),_0x4fb7('0x8'),_0x4fb7('0x3'))},'keyContent':{'type':Sequelize[_0x4fb7('0x6')]},'idField':{'type':Sequelize[_0x4fb7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4fb7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4fb7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8476878..4cf3f4d 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 _0x987d=['offset','undefined','limit','count','status','set','apply','reject','save','update','then','sendStatus','error','name','index','map','fieldName','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','type','options','Dynamics365Field','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json'];(function(_0x256a77,_0x48b8fa){var _0x26f9db=function(_0x1be41b){while(--_0x1be41b){_0x256a77['push'](_0x256a77['shift']());}};_0x26f9db(++_0x48b8fa);}(_0x987d,0x108));var _0xd987=function(_0x11bfd1,_0x43dba8){_0x11bfd1=_0x11bfd1-0x0;var _0x505c4f=_0x987d[_0x11bfd1];return _0x505c4f;};'use strict';var emlformat=require(_0xd987('0x0'));var rimraf=require(_0xd987('0x1'));var zipdir=require(_0xd987('0x2'));var jsonpatch=require(_0xd987('0x3'));var rp=require(_0xd987('0x4'));var moment=require(_0xd987('0x5'));var BPromise=require(_0xd987('0x6'));var Mustache=require('mustache');var util=require(_0xd987('0x7'));var path=require(_0xd987('0x8'));var sox=require('sox');var csv=require(_0xd987('0x9'));var ejs=require(_0xd987('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd987('0xb'));var squel=require(_0xd987('0xc'));var crypto=require(_0xd987('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd987('0xe'));var toCsv=require(_0xd987('0x9'));var querystring=require(_0xd987('0xf'));var Papa=require(_0xd987('0x10'));var Redis=require(_0xd987('0x11'));var authService=require(_0xd987('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd987('0x13'));var hardwareService=require(_0xd987('0x14'));var logger=require(_0xd987('0x15'))(_0xd987('0x16'));var utils=require(_0xd987('0x17'));var config=require(_0xd987('0x18'));var licenseUtil=require(_0xd987('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2874dd,_0x331e79){_0x331e79=_0x331e79||0xcc;return function(_0x3881a4){if(_0x3881a4){return _0x2874dd['sendStatus'](_0x331e79);}return _0x2874dd['status'](_0x331e79)[_0xd987('0x1a')]();};}function respondWithResult(_0x119dd5,_0x230ee5){_0x230ee5=_0x230ee5||0xc8;return function(_0x29becd){if(_0x29becd){return _0x119dd5['status'](_0x230ee5)[_0xd987('0x1b')](_0x29becd);}};}function respondWithFilteredResult(_0x50a078,_0x2c1656){return function(_0x3e1a77){if(_0x3e1a77){var _0x1223ce=typeof _0x2c1656[_0xd987('0x1c')]===_0xd987('0x1d')&&typeof _0x2c1656[_0xd987('0x1e')]===_0xd987('0x1d');var _0x3e6c7b=_0x3e1a77[_0xd987('0x1f')];var _0x599872=_0x1223ce?0x0:_0x2c1656[_0xd987('0x1c')];var _0x30f8b0=_0x1223ce?_0x3e1a77[_0xd987('0x1f')]:_0x2c1656[_0xd987('0x1c')]+_0x2c1656[_0xd987('0x1e')];var _0x5c89b1;if(_0x30f8b0>=_0x3e6c7b){_0x30f8b0=_0x3e6c7b;_0x5c89b1=0xc8;}else{_0x5c89b1=0xce;}_0x50a078[_0xd987('0x20')](_0x5c89b1);return _0x50a078[_0xd987('0x21')]('Content-Range',_0x599872+'-'+_0x30f8b0+'/'+_0x3e6c7b)[_0xd987('0x1b')](_0x3e1a77);}return null;};}function patchUpdates(_0x446147){return function(_0x1948c5){try{jsonpatch[_0xd987('0x22')](_0x1948c5,_0x446147,!![]);}catch(_0x5f171d){return BPromise[_0xd987('0x23')](_0x5f171d);}return _0x1948c5[_0xd987('0x24')]();};}function saveUpdates(_0x358fec,_0x11b706){return function(_0x2baf9b){if(_0x2baf9b){return _0x2baf9b[_0xd987('0x25')](_0x358fec)['then'](function(_0x3f733b){return _0x3f733b;});}return null;};}function removeEntity(_0x58e62e,_0x4f93a9){return function(_0x3b694d){if(_0x3b694d){return _0x3b694d['destroy']()[_0xd987('0x26')](function(){_0x58e62e[_0xd987('0x20')](0xcc)[_0xd987('0x1a')]();});}};}function handleEntityNotFound(_0x3971a4,_0x447e99){return function(_0x249ebc){if(!_0x249ebc){_0x3971a4[_0xd987('0x27')](0x194);}return _0x249ebc;};}function handleError(_0x447177,_0x481a90){_0x481a90=_0x481a90||0x1f4;return function(_0x4ebf16){logger[_0xd987('0x28')](_0x4ebf16['stack']);if(_0x4ebf16['name']){delete _0x4ebf16[_0xd987('0x29')];}_0x447177['status'](_0x481a90)['send'](_0x4ebf16);};}exports[_0xd987('0x2a')]=function(_0xef6503,_0x10650a){var _0x2bb369={},_0x585195={},_0x1281b4={'count':0x0,'rows':[]};var _0x5bea7e=_[_0xd987('0x2b')](db['Dynamics365Field']['rawAttributes'],function(_0xaf50c6){return{'name':_0xaf50c6[_0xd987('0x2c')],'type':_0xaf50c6['type'][_0xd987('0x2d')]};});_0x585195[_0xd987('0x2e')]=_[_0xd987('0x2b')](_0x5bea7e,'name');_0x585195[_0xd987('0x2f')]=_[_0xd987('0x30')](_0xef6503[_0xd987('0x2f')]);_0x585195['filters']=_['intersection'](_0x585195[_0xd987('0x2e')],_0x585195[_0xd987('0x2f')]);_0x2bb369[_0xd987('0x31')]=_[_0xd987('0x32')](_0x585195['model'],qs['fields'](_0xef6503[_0xd987('0x2f')][_0xd987('0x33')]));_0x2bb369[_0xd987('0x31')]=_0x2bb369[_0xd987('0x31')][_0xd987('0x34')]?_0x2bb369['attributes']:_0x585195[_0xd987('0x2e')];if(!_0xef6503[_0xd987('0x2f')]['hasOwnProperty']('nolimit')){_0x2bb369[_0xd987('0x1e')]=qs[_0xd987('0x1e')](_0xef6503[_0xd987('0x2f')][_0xd987('0x1e')]);_0x2bb369['offset']=qs['offset'](_0xef6503[_0xd987('0x2f')][_0xd987('0x1c')]);}_0x2bb369[_0xd987('0x35')]=qs[_0xd987('0x36')](_0xef6503[_0xd987('0x2f')][_0xd987('0x36')]);_0x2bb369[_0xd987('0x37')]=qs[_0xd987('0x38')](_[_0xd987('0x39')](_0xef6503['query'],_0x585195[_0xd987('0x38')]),_0x5bea7e);if(_0xef6503[_0xd987('0x2f')][_0xd987('0x3a')]){_0x2bb369[_0xd987('0x37')]=_[_0xd987('0x3b')](_0x2bb369[_0xd987('0x37')],{'$or':_[_0xd987('0x2b')](_0x5bea7e,function(_0x23f92f){if(_0x23f92f[_0xd987('0x3c')]!=='VIRTUAL'){var _0x7e3369={};_0x7e3369[_0x23f92f[_0xd987('0x29')]]={'$like':'%'+_0xef6503[_0xd987('0x2f')][_0xd987('0x3a')]+'%'};return _0x7e3369;}})});}_0x2bb369=_[_0xd987('0x3b')]({},_0x2bb369,_0xef6503[_0xd987('0x3d')]);var _0x5edcbc={'where':_0x2bb369[_0xd987('0x37')]};return db[_0xd987('0x3e')][_0xd987('0x1f')](_0x5edcbc)['then'](function(_0x53d592){_0x1281b4['count']=_0x53d592;if(_0xef6503['query'][_0xd987('0x3f')]){_0x2bb369[_0xd987('0x40')]=[{'all':!![]}];}return db[_0xd987('0x3e')][_0xd987('0x41')](_0x2bb369);})[_0xd987('0x26')](function(_0x236e4a){_0x1281b4['rows']=_0x236e4a;return _0x1281b4;})['then'](respondWithFilteredResult(_0x10650a,_0x2bb369))[_0xd987('0x42')](handleError(_0x10650a,null));};exports['show']=function(_0x36847f,_0x1b69dc){var _0x589683={'raw':!![],'where':{'id':_0x36847f['params']['id']}},_0x275ad={};_0x275ad[_0xd987('0x2e')]=_['keys'](db[_0xd987('0x3e')][_0xd987('0x43')]);_0x275ad[_0xd987('0x2f')]=_[_0xd987('0x30')](_0x36847f[_0xd987('0x2f')]);_0x275ad[_0xd987('0x38')]=_[_0xd987('0x32')](_0x275ad[_0xd987('0x2e')],_0x275ad[_0xd987('0x2f')]);_0x589683[_0xd987('0x31')]=_[_0xd987('0x32')](_0x275ad[_0xd987('0x2e')],qs[_0xd987('0x33')](_0x36847f['query'][_0xd987('0x33')]));_0x589683[_0xd987('0x31')]=_0x589683[_0xd987('0x31')][_0xd987('0x34')]?_0x589683[_0xd987('0x31')]:_0x275ad[_0xd987('0x2e')];if(_0x36847f[_0xd987('0x2f')][_0xd987('0x3f')]){_0x589683[_0xd987('0x40')]=[{'all':!![]}];}_0x589683=_[_0xd987('0x3b')]({},_0x589683,_0x36847f[_0xd987('0x3d')]);return db[_0xd987('0x3e')][_0xd987('0x44')](_0x589683)[_0xd987('0x26')](handleEntityNotFound(_0x1b69dc,null))[_0xd987('0x26')](respondWithResult(_0x1b69dc,null))[_0xd987('0x42')](handleError(_0x1b69dc,null));};exports['create']=function(_0x5dcfa4,_0x412e7b){return db[_0xd987('0x3e')][_0xd987('0x45')](_0x5dcfa4['body'],{})[_0xd987('0x26')](respondWithResult(_0x412e7b,0xc9))[_0xd987('0x42')](handleError(_0x412e7b,null));};exports[_0xd987('0x25')]=function(_0xb3c670,_0x50d815){if(_0xb3c670[_0xd987('0x46')]['id']){delete _0xb3c670['body']['id'];}return db[_0xd987('0x3e')][_0xd987('0x44')]({'where':{'id':_0xb3c670[_0xd987('0x47')]['id']}})[_0xd987('0x26')](handleEntityNotFound(_0x50d815,null))[_0xd987('0x26')](saveUpdates(_0xb3c670[_0xd987('0x46')],null))[_0xd987('0x26')](respondWithResult(_0x50d815,null))[_0xd987('0x42')](handleError(_0x50d815,null));};exports[_0xd987('0x48')]=function(_0xda0e43,_0x4a75f1){return db['Dynamics365Field'][_0xd987('0x44')]({'where':{'id':_0xda0e43['params']['id']}})['then'](handleEntityNotFound(_0x4a75f1,null))['then'](removeEntity(_0x4a75f1,null))['catch'](handleError(_0x4a75f1,null));}; \ No newline at end of file +var _0xde34=['where','includeAll','catch','show','create','body','update','params','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','Dynamics365Field','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','VIRTUAL','options'];(function(_0xf4b975,_0x4e1bc3){var _0x47a042=function(_0x429289){while(--_0x429289){_0xf4b975['push'](_0xf4b975['shift']());}};_0x47a042(++_0x4e1bc3);}(_0xde34,0x1bf));var _0x4de3=function(_0x49cfb7,_0x41a35c){_0x49cfb7=_0x49cfb7-0x0;var _0x1d1d68=_0xde34[_0x49cfb7];return _0x1d1d68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4de3('0x0'));var zipdir=require(_0x4de3('0x1'));var jsonpatch=require(_0x4de3('0x2'));var rp=require(_0x4de3('0x3'));var moment=require(_0x4de3('0x4'));var BPromise=require(_0x4de3('0x5'));var Mustache=require(_0x4de3('0x6'));var util=require('util');var path=require(_0x4de3('0x7'));var sox=require('sox');var csv=require(_0x4de3('0x8'));var ejs=require(_0x4de3('0x9'));var fs=require('fs');var fs_extra=require(_0x4de3('0xa'));var _=require(_0x4de3('0xb'));var squel=require(_0x4de3('0xc'));var crypto=require(_0x4de3('0xd'));var jsforce=require(_0x4de3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4de3('0xf'));var Papa=require(_0x4de3('0x10'));var Redis=require(_0x4de3('0x11'));var authService=require(_0x4de3('0x12'));var qs=require(_0x4de3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4de3('0x14'));var logger=require(_0x4de3('0x15'))(_0x4de3('0x16'));var utils=require(_0x4de3('0x17'));var config=require(_0x4de3('0x18'));var licenseUtil=require(_0x4de3('0x19'));var db=require(_0x4de3('0x1a'))['db'];function respondWithStatusCode(_0x493118,_0x793202){_0x793202=_0x793202||0xcc;return function(_0x3ad639){if(_0x3ad639){return _0x493118[_0x4de3('0x1b')](_0x793202);}return _0x493118[_0x4de3('0x1c')](_0x793202)[_0x4de3('0x1d')]();};}function respondWithResult(_0x2f52e5,_0x378700){_0x378700=_0x378700||0xc8;return function(_0x19d413){if(_0x19d413){return _0x2f52e5[_0x4de3('0x1c')](_0x378700)[_0x4de3('0x1e')](_0x19d413);}};}function respondWithFilteredResult(_0x2c655c,_0x376e2f){return function(_0x4d9276){if(_0x4d9276){var _0x3d729c=typeof _0x376e2f['offset']==='undefined'&&typeof _0x376e2f['limit']===_0x4de3('0x1f');var _0x474d81=_0x4d9276[_0x4de3('0x20')];var _0x27a3c5=_0x3d729c?0x0:_0x376e2f['offset'];var _0x290466=_0x3d729c?_0x4d9276[_0x4de3('0x20')]:_0x376e2f[_0x4de3('0x21')]+_0x376e2f[_0x4de3('0x22')];var _0x3a29d3;if(_0x290466>=_0x474d81){_0x290466=_0x474d81;_0x3a29d3=0xc8;}else{_0x3a29d3=0xce;}_0x2c655c[_0x4de3('0x1c')](_0x3a29d3);return _0x2c655c[_0x4de3('0x23')](_0x4de3('0x24'),_0x27a3c5+'-'+_0x290466+'/'+_0x474d81)['json'](_0x4d9276);}return null;};}function patchUpdates(_0x32e70b){return function(_0x58fe89){try{jsonpatch['apply'](_0x58fe89,_0x32e70b,!![]);}catch(_0x27e9c6){return BPromise[_0x4de3('0x25')](_0x27e9c6);}return _0x58fe89[_0x4de3('0x26')]();};}function saveUpdates(_0xf99c9b,_0x5799ae){return function(_0x7d845a){if(_0x7d845a){return _0x7d845a['update'](_0xf99c9b)[_0x4de3('0x27')](function(_0xf4223c){return _0xf4223c;});}return null;};}function removeEntity(_0x43eb66,_0xeab78c){return function(_0x33bfc1){if(_0x33bfc1){return _0x33bfc1[_0x4de3('0x28')]()['then'](function(){_0x43eb66[_0x4de3('0x1c')](0xcc)[_0x4de3('0x1d')]();});}};}function handleEntityNotFound(_0x333917,_0x3d0f03){return function(_0x22493f){if(!_0x22493f){_0x333917[_0x4de3('0x1b')](0x194);}return _0x22493f;};}function handleError(_0x5d562e,_0x20fbde){_0x20fbde=_0x20fbde||0x1f4;return function(_0x419972){logger['error'](_0x419972[_0x4de3('0x29')]);if(_0x419972[_0x4de3('0x2a')]){delete _0x419972['name'];}_0x5d562e[_0x4de3('0x1c')](_0x20fbde)[_0x4de3('0x2b')](_0x419972);};}exports[_0x4de3('0x2c')]=function(_0x74e66c,_0x45f059){var _0x22b39e={},_0x39d827={},_0x3ea2fe={'count':0x0,'rows':[]};var _0x5c12e7=_['map'](db[_0x4de3('0x2d')]['rawAttributes'],function(_0x323b94){return{'name':_0x323b94['fieldName'],'type':_0x323b94[_0x4de3('0x2e')][_0x4de3('0x2f')]};});_0x39d827['model']=_[_0x4de3('0x30')](_0x5c12e7,'name');_0x39d827[_0x4de3('0x31')]=_[_0x4de3('0x32')](_0x74e66c[_0x4de3('0x31')]);_0x39d827[_0x4de3('0x33')]=_[_0x4de3('0x34')](_0x39d827[_0x4de3('0x35')],_0x39d827['query']);_0x22b39e[_0x4de3('0x36')]=_['intersection'](_0x39d827[_0x4de3('0x35')],qs[_0x4de3('0x37')](_0x74e66c[_0x4de3('0x31')][_0x4de3('0x37')]));_0x22b39e['attributes']=_0x22b39e['attributes'][_0x4de3('0x38')]?_0x22b39e['attributes']:_0x39d827[_0x4de3('0x35')];if(!_0x74e66c[_0x4de3('0x31')]['hasOwnProperty'](_0x4de3('0x39'))){_0x22b39e[_0x4de3('0x22')]=qs[_0x4de3('0x22')](_0x74e66c[_0x4de3('0x31')][_0x4de3('0x22')]);_0x22b39e[_0x4de3('0x21')]=qs[_0x4de3('0x21')](_0x74e66c['query'][_0x4de3('0x21')]);}_0x22b39e[_0x4de3('0x3a')]=qs['sort'](_0x74e66c[_0x4de3('0x31')][_0x4de3('0x3b')]);_0x22b39e['where']=qs[_0x4de3('0x33')](_['pick'](_0x74e66c[_0x4de3('0x31')],_0x39d827[_0x4de3('0x33')]),_0x5c12e7);if(_0x74e66c[_0x4de3('0x31')][_0x4de3('0x3c')]){_0x22b39e['where']=_[_0x4de3('0x3d')](_0x22b39e['where'],{'$or':_['map'](_0x5c12e7,function(_0x19c90a){if(_0x19c90a[_0x4de3('0x2e')]!==_0x4de3('0x3e')){var _0x10a6e5={};_0x10a6e5[_0x19c90a[_0x4de3('0x2a')]]={'$like':'%'+_0x74e66c['query'][_0x4de3('0x3c')]+'%'};return _0x10a6e5;}})});}_0x22b39e=_[_0x4de3('0x3d')]({},_0x22b39e,_0x74e66c[_0x4de3('0x3f')]);var _0x441469={'where':_0x22b39e[_0x4de3('0x40')]};return db[_0x4de3('0x2d')][_0x4de3('0x20')](_0x441469)[_0x4de3('0x27')](function(_0x6fce67){_0x3ea2fe[_0x4de3('0x20')]=_0x6fce67;if(_0x74e66c[_0x4de3('0x31')][_0x4de3('0x41')]){_0x22b39e['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x22b39e);})[_0x4de3('0x27')](function(_0x4247ea){_0x3ea2fe['rows']=_0x4247ea;return _0x3ea2fe;})[_0x4de3('0x27')](respondWithFilteredResult(_0x45f059,_0x22b39e))[_0x4de3('0x42')](handleError(_0x45f059,null));};exports[_0x4de3('0x43')]=function(_0x763374,_0x55ff34){var _0x59d275={'raw':!![],'where':{'id':_0x763374['params']['id']}},_0x1e2883={};_0x1e2883[_0x4de3('0x35')]=_[_0x4de3('0x32')](db[_0x4de3('0x2d')]['rawAttributes']);_0x1e2883['query']=_[_0x4de3('0x32')](_0x763374[_0x4de3('0x31')]);_0x1e2883['filters']=_[_0x4de3('0x34')](_0x1e2883[_0x4de3('0x35')],_0x1e2883[_0x4de3('0x31')]);_0x59d275[_0x4de3('0x36')]=_[_0x4de3('0x34')](_0x1e2883['model'],qs[_0x4de3('0x37')](_0x763374[_0x4de3('0x31')][_0x4de3('0x37')]));_0x59d275[_0x4de3('0x36')]=_0x59d275[_0x4de3('0x36')][_0x4de3('0x38')]?_0x59d275[_0x4de3('0x36')]:_0x1e2883['model'];if(_0x763374[_0x4de3('0x31')][_0x4de3('0x41')]){_0x59d275['include']=[{'all':!![]}];}_0x59d275=_[_0x4de3('0x3d')]({},_0x59d275,_0x763374['options']);return db['Dynamics365Field']['find'](_0x59d275)[_0x4de3('0x27')](handleEntityNotFound(_0x55ff34,null))[_0x4de3('0x27')](respondWithResult(_0x55ff34,null))[_0x4de3('0x42')](handleError(_0x55ff34,null));};exports[_0x4de3('0x44')]=function(_0x3f788c,_0x40fdb8){return db['Dynamics365Field'][_0x4de3('0x44')](_0x3f788c[_0x4de3('0x45')],{})[_0x4de3('0x27')](respondWithResult(_0x40fdb8,0xc9))[_0x4de3('0x42')](handleError(_0x40fdb8,null));};exports[_0x4de3('0x46')]=function(_0x48f188,_0x3d73c1){if(_0x48f188[_0x4de3('0x45')]['id']){delete _0x48f188[_0x4de3('0x45')]['id'];}return db[_0x4de3('0x2d')]['find']({'where':{'id':_0x48f188[_0x4de3('0x47')]['id']}})[_0x4de3('0x27')](handleEntityNotFound(_0x3d73c1,null))[_0x4de3('0x27')](saveUpdates(_0x48f188[_0x4de3('0x45')],null))[_0x4de3('0x27')](respondWithResult(_0x3d73c1,null))[_0x4de3('0x42')](handleError(_0x3d73c1,null));};exports['destroy']=function(_0x540b40,_0x1c1e4c){return db['Dynamics365Field'][_0x4de3('0x48')]({'where':{'id':_0x540b40[_0x4de3('0x47')]['id']}})[_0x4de3('0x27')](handleEntityNotFound(_0x1c1e4c,null))['then'](removeEntity(_0x1c1e4c,null))['catch'](handleError(_0x1c1e4c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 835fb35..3090087 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 _0xa41d=['define','Dynamics365Field','lodash','util','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xa41d,0xf2));var _0xda41=function(_0x1b03fe,_0x1cb768){_0x1b03fe=_0x1b03fe-0x0;var _0x1af15a=_0xa41d[_0x1b03fe];return _0x1af15a;};'use strict';var _=require(_0xda41('0x0'));var util=require(_0xda41('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xda41('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda41('0x3'));var rimraf=require(_0xda41('0x4'));var config=require(_0xda41('0x5'));var attributes=require(_0xda41('0x6'));module[_0xda41('0x7')]=function(_0x260f87,_0x540680){return _0x260f87[_0xda41('0x8')](_0xda41('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97ac=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x15c35a,_0x4bb949){var _0x59dfa1=function(_0x58c58e){while(--_0x58c58e){_0x15c35a['push'](_0x15c35a['shift']());}};_0x59dfa1(++_0x4bb949);}(_0x97ac,0x113));var _0xc97a=function(_0x1f9324,_0x492c0d){_0x1f9324=_0x1f9324-0x0;var _0x481436=_0x97ac[_0x1f9324];return _0x481436;};'use strict';var _=require(_0xc97a('0x0'));var util=require('util');var logger=require(_0xc97a('0x1'))(_0xc97a('0x2'));var moment=require('moment');var BPromise=require(_0xc97a('0x3'));var rp=require(_0xc97a('0x4'));var fs=require('fs');var path=require(_0xc97a('0x5'));var rimraf=require(_0xc97a('0x6'));var config=require(_0xc97a('0x7'));var attributes=require(_0xc97a('0x8'));module['exports']=function(_0x4b2779,_0x3562da){return _0x4b2779[_0xc97a('0x9')](_0xc97a('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xc97a('0xb'),'fields':[_0xc97a('0xc'),_0xc97a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 5806513..9403d58 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 _0x348d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x5830eb,_0x5bccc9){var _0x3b7c28=function(_0x5369de){while(--_0x5369de){_0x5830eb['push'](_0x5830eb['shift']());}};_0x3b7c28(++_0x5bccc9);}(_0x348d,0x1b8));var _0xd348=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x348d[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0xd348('0x0'));var util=require(_0xd348('0x1'));var moment=require(_0xd348('0x2'));var BPromise=require(_0xd348('0x3'));var rs=require(_0xd348('0x4'));var fs=require('fs');var Redis=require(_0xd348('0x5'));var db=require(_0xd348('0x6'))['db'];var utils=require(_0xd348('0x7'));var logger=require(_0xd348('0x8'))(_0xd348('0x9'));var config=require(_0xd348('0xa'));var jayson=require(_0xd348('0xb'));var client=jayson[_0xd348('0xc')][_0xd348('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x522182,_0x356199,_0x1a0035){return new BPromise(function(_0x499840,_0x3bd532){return client[_0xd348('0xe')](_0x522182,_0x1a0035)[_0xd348('0xf')](function(_0x46c503){logger[_0xd348('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x356199,_0xd348('0x11'));logger['debug'](_0xd348('0x12'),_0x356199,'request\x20sent',JSON[_0xd348('0x13')](_0x46c503));if(_0x46c503[_0xd348('0x14')]){if(_0x46c503['error'][_0xd348('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x356199,_0x46c503['error'][_0xd348('0x16')]);return _0x3bd532(_0x46c503[_0xd348('0x14')][_0xd348('0x16')]);}logger[_0xd348('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x356199,_0x46c503[_0xd348('0x14')][_0xd348('0x16')]);return _0x499840(_0x46c503['error'][_0xd348('0x16')]);}else{logger[_0xd348('0x10')](_0xd348('0x17'),_0x356199,_0xd348('0x11'));_0x499840(_0x46c503[_0xd348('0x18')]['message']);}})[_0xd348('0x19')](function(_0x24eba4){logger[_0xd348('0x14')](_0xd348('0x17'),_0x356199,_0x24eba4);_0x3bd532(_0x24eba4);});});} \ No newline at end of file +var _0x42ee=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xec031,_0x2daa9b){var _0x3eba31=function(_0x48d4da){while(--_0x48d4da){_0xec031['push'](_0xec031['shift']());}};_0x3eba31(++_0x2daa9b);}(_0x42ee,0xc8));var _0xe42e=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x42ee[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0xe42e('0x0'));var util=require(_0xe42e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe42e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe42e('0x3'))['db'];var utils=require(_0xe42e('0x4'));var logger=require(_0xe42e('0x5'))(_0xe42e('0x6'));var config=require('../../config/environment');var jayson=require(_0xe42e('0x7'));var client=jayson[_0xe42e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56c89b,_0x3d4d4a,_0x48bedf){return new BPromise(function(_0xc98cf4,_0x307186){return client[_0xe42e('0x9')](_0x56c89b,_0x48bedf)['then'](function(_0x18366c){logger[_0xe42e('0xa')](_0xe42e('0xb'),_0x3d4d4a,_0xe42e('0xc'));logger[_0xe42e('0xd')](_0xe42e('0xe'),_0x3d4d4a,_0xe42e('0xc'),JSON['stringify'](_0x18366c));if(_0x18366c[_0xe42e('0xf')]){if(_0x18366c[_0xe42e('0xf')][_0xe42e('0x10')]===0x1f4){logger['error'](_0xe42e('0xb'),_0x3d4d4a,_0x18366c[_0xe42e('0xf')][_0xe42e('0x11')]);return _0x307186(_0x18366c['error'][_0xe42e('0x11')]);}logger[_0xe42e('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3d4d4a,_0x18366c['error'][_0xe42e('0x11')]);return _0xc98cf4(_0x18366c[_0xe42e('0xf')][_0xe42e('0x11')]);}else{logger['info'](_0xe42e('0xb'),_0x3d4d4a,_0xe42e('0xc'));_0xc98cf4(_0x18366c[_0xe42e('0x12')]['message']);}})[_0xe42e('0x13')](function(_0x3e219e){logger[_0xe42e('0xf')](_0xe42e('0xb'),_0x3d4d4a,_0x3e219e);_0x307186(_0x3e219e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3813957..a81a9c9 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 _0x7dee=['../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2697d9,_0x26806a){var _0x25e6ae=function(_0x4ff250){while(--_0x4ff250){_0x2697d9['push'](_0x2697d9['shift']());}};_0x25e6ae(++_0x26806a);}(_0x7dee,0x1f2));var _0xe7de=function(_0x466380,_0x3729bf){_0x466380=_0x466380-0x0;var _0x37120a=_0x7dee[_0x466380];return _0x37120a;};'use strict';var multer=require(_0xe7de('0x0'));var util=require(_0xe7de('0x1'));var path=require(_0xe7de('0x2'));var timeout=require(_0xe7de('0x3'));var express=require(_0xe7de('0x4'));var router=express['Router']();var fs_extra=require(_0xe7de('0x5'));var auth=require(_0xe7de('0x6'));var interaction=require(_0xe7de('0x7'));var config=require('../../config/environment');var controller=require(_0xe7de('0x8'));router[_0xe7de('0x9')]('/',auth[_0xe7de('0xa')](),controller[_0xe7de('0xb')]);router['get'](_0xe7de('0xc'),auth[_0xe7de('0xa')](),controller[_0xe7de('0xd')]);router[_0xe7de('0x9')](_0xe7de('0xe'),auth[_0xe7de('0xa')](),controller[_0xe7de('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xe7de('0x10')]);router[_0xe7de('0x11')]('/',auth[_0xe7de('0xa')](),controller['create']);router[_0xe7de('0x11')](_0xe7de('0xe'),auth[_0xe7de('0xa')](),controller['addConfiguration']);router['put'](_0xe7de('0xc'),auth[_0xe7de('0xa')](),controller[_0xe7de('0x12')]);router['delete']('/:id',auth[_0xe7de('0xa')](),controller[_0xe7de('0x13')]);module[_0xe7de('0x14')]=router; \ No newline at end of file +var _0x896d=['getFields','create','post','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/fields'];(function(_0x1e4519,_0x2b57b7){var _0x11b1d3=function(_0x56e0e2){while(--_0x56e0e2){_0x1e4519['push'](_0x1e4519['shift']());}};_0x11b1d3(++_0x2b57b7);}(_0x896d,0x11e));var _0xd896=function(_0x35aa4f,_0x3bf80b){_0x35aa4f=_0x35aa4f-0x0;var _0x1d2f4d=_0x896d[_0x35aa4f];return _0x1d2f4d;};'use strict';var multer=require(_0xd896('0x0'));var util=require('util');var path=require(_0xd896('0x1'));var timeout=require(_0xd896('0x2'));var express=require(_0xd896('0x3'));var router=express[_0xd896('0x4')]();var fs_extra=require(_0xd896('0x5'));var auth=require(_0xd896('0x6'));var interaction=require(_0xd896('0x7'));var config=require(_0xd896('0x8'));var controller=require(_0xd896('0x9'));router[_0xd896('0xa')]('/',auth[_0xd896('0xb')](),controller[_0xd896('0xc')]);router[_0xd896('0xa')]('/:id',auth[_0xd896('0xb')](),controller['show']);router[_0xd896('0xa')]('/:id/configurations',auth[_0xd896('0xb')](),controller['getConfigurations']);router[_0xd896('0xa')](_0xd896('0xd'),auth['isAuthenticated'](),controller[_0xd896('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd896('0xf')]);router[_0xd896('0x10')]('/:id/configurations',auth[_0xd896('0xb')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd896('0xb')](),controller[_0xd896('0x11')]);router[_0xd896('0x12')]('/:id',auth[_0xd896('0xb')](),controller[_0xd896('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d07599c..26ece8e 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 _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x13ed4c,_0x1ae44b){var _0x5cb412=function(_0x345238){while(--_0x345238){_0x13ed4c['push'](_0x13ed4c['shift']());}};_0x5cb412(++_0x1ae44b);}(_0x236c,0x155));var _0xc236=function(_0x8e719,_0x3b4f3f){_0x8e719=_0x8e719-0x0;var _0x56ee70=_0x236c[_0x8e719];return _0x56ee70;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0x2c60f8,_0x33b526){var _0x2af320=function(_0x26491b){while(--_0x26491b){_0x2c60f8['push'](_0x2c60f8['shift']());}};_0x2af320(++_0x33b526);}(_0x7096,0x10c));var _0x6709=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7096[_0x2bf141];return _0x48277b;};'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/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 5111eb8..baa0976 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 _0xbf1a=['ticket_type','company','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','error','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','apiKey','base64','subject','agent','description','priority','group'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbf1a,0x7c));var _0xabf1=function(_0x177d42,_0x52d476){_0x177d42=_0x177d42-0x0;var _0x15031d=_0xbf1a[_0x177d42];return _0x15031d;};'use strict';var emlformat=require(_0xabf1('0x0'));var rimraf=require(_0xabf1('0x1'));var zipdir=require(_0xabf1('0x2'));var jsonpatch=require(_0xabf1('0x3'));var rp=require(_0xabf1('0x4'));var moment=require('moment');var BPromise=require(_0xabf1('0x5'));var Mustache=require('mustache');var util=require(_0xabf1('0x6'));var path=require(_0xabf1('0x7'));var sox=require(_0xabf1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabf1('0x9'));var _=require('lodash');var squel=require(_0xabf1('0xa'));var crypto=require(_0xabf1('0xb'));var jsforce=require(_0xabf1('0xc'));var deskjs=require(_0xabf1('0xd'));var toCsv=require(_0xabf1('0xe'));var querystring=require(_0xabf1('0xf'));var Papa=require('papaparse');var Redis=require(_0xabf1('0x10'));var authService=require(_0xabf1('0x11'));var qs=require(_0xabf1('0x12'));var as=require(_0xabf1('0x13'));var hardwareService=require(_0xabf1('0x14'));var logger=require(_0xabf1('0x15'))('api');var utils=require(_0xabf1('0x16'));var config=require(_0xabf1('0x17'));var licenseUtil=require(_0xabf1('0x18'));var db=require(_0xabf1('0x19'))['db'];var integrations=require(_0xabf1('0x1a'));function respondWithStatusCode(_0x1186b7,_0x27ade4){_0x27ade4=_0x27ade4||0xcc;return function(_0x4853d5){if(_0x4853d5){return _0x1186b7[_0xabf1('0x1b')](_0x27ade4);}return _0x1186b7[_0xabf1('0x1c')](_0x27ade4)['end']();};}function respondWithResult(_0x783976,_0xcbe7da){_0xcbe7da=_0xcbe7da||0xc8;return function(_0x248705){if(_0x248705){return _0x783976['status'](_0xcbe7da)[_0xabf1('0x1d')](_0x248705);}};}function respondWithFilteredResult(_0x3dd81a,_0x719d3e){return function(_0x3537e4){if(_0x3537e4){var _0x49cfe3=typeof _0x719d3e[_0xabf1('0x1e')]==='undefined'&&typeof _0x719d3e[_0xabf1('0x1f')]===_0xabf1('0x20');var _0x392c5f=_0x3537e4[_0xabf1('0x21')];var _0x26e9f8=_0x49cfe3?0x0:_0x719d3e[_0xabf1('0x1e')];var _0x3cfc35=_0x49cfe3?_0x3537e4[_0xabf1('0x21')]:_0x719d3e[_0xabf1('0x1e')]+_0x719d3e[_0xabf1('0x1f')];var _0x2d34db;if(_0x3cfc35>=_0x392c5f){_0x3cfc35=_0x392c5f;_0x2d34db=0xc8;}else{_0x2d34db=0xce;}_0x3dd81a[_0xabf1('0x1c')](_0x2d34db);return _0x3dd81a[_0xabf1('0x22')](_0xabf1('0x23'),_0x26e9f8+'-'+_0x3cfc35+'/'+_0x392c5f)[_0xabf1('0x1d')](_0x3537e4);}return null;};}function patchUpdates(_0x5a0413){return function(_0x5444b4){try{jsonpatch[_0xabf1('0x24')](_0x5444b4,_0x5a0413,!![]);}catch(_0x167d5d){return BPromise[_0xabf1('0x25')](_0x167d5d);}return _0x5444b4['save']();};}function saveUpdates(_0x216862,_0x3fbce0){return function(_0x3bd4b6){if(_0x3bd4b6){return _0x3bd4b6['update'](_0x216862)[_0xabf1('0x26')](function(_0x57fea6){return _0x57fea6;});}return null;};}function removeEntity(_0x30fac8,_0x551401){return function(_0x5ccb6f){if(_0x5ccb6f){return _0x5ccb6f['destroy']()[_0xabf1('0x26')](function(){_0x30fac8[_0xabf1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c6f0,_0x69ddb8){return function(_0x577b0f){if(!_0x577b0f){_0x14c6f0['sendStatus'](0x194);}return _0x577b0f;};}function handleError(_0x25d432,_0x175678){_0x175678=_0x175678||0x1f4;return function(_0x3e58f6){logger[_0xabf1('0x27')](_0x3e58f6[_0xabf1('0x28')]);if(_0x3e58f6['name']){delete _0x3e58f6[_0xabf1('0x29')];}_0x25d432['status'](_0x175678)[_0xabf1('0x2a')](_0x3e58f6);};}exports['index']=function(_0xb54b63,_0x582fbf){var _0x45e64f={},_0x139540={},_0xe3ecbb={'count':0x0,'rows':[]};var _0x139802=_['map'](db[_0xabf1('0x2b')][_0xabf1('0x2c')],function(_0x4d3dd7){return{'name':_0x4d3dd7[_0xabf1('0x2d')],'type':_0x4d3dd7['type']['key']};});_0x139540['model']=_[_0xabf1('0x2e')](_0x139802,_0xabf1('0x29'));_0x139540[_0xabf1('0x2f')]=_[_0xabf1('0x30')](_0xb54b63['query']);_0x139540[_0xabf1('0x31')]=_[_0xabf1('0x32')](_0x139540[_0xabf1('0x33')],_0x139540[_0xabf1('0x2f')]);_0x45e64f['attributes']=_[_0xabf1('0x32')](_0x139540['model'],qs[_0xabf1('0x34')](_0xb54b63['query']['fields']));_0x45e64f[_0xabf1('0x35')]=_0x45e64f[_0xabf1('0x35')][_0xabf1('0x36')]?_0x45e64f[_0xabf1('0x35')]:_0x139540[_0xabf1('0x33')];if(!_0xb54b63[_0xabf1('0x2f')][_0xabf1('0x37')](_0xabf1('0x38'))){_0x45e64f['limit']=qs[_0xabf1('0x1f')](_0xb54b63[_0xabf1('0x2f')]['limit']);_0x45e64f['offset']=qs['offset'](_0xb54b63[_0xabf1('0x2f')]['offset']);}_0x45e64f[_0xabf1('0x39')]=qs[_0xabf1('0x3a')](_0xb54b63[_0xabf1('0x2f')][_0xabf1('0x3a')]);_0x45e64f['where']=qs[_0xabf1('0x31')](_['pick'](_0xb54b63[_0xabf1('0x2f')],_0x139540[_0xabf1('0x31')]),_0x139802);if(_0xb54b63[_0xabf1('0x2f')][_0xabf1('0x3b')]){_0x45e64f['where']=_[_0xabf1('0x3c')](_0x45e64f[_0xabf1('0x3d')],{'$or':_[_0xabf1('0x2e')](_0x139802,function(_0x284a36){if(_0x284a36[_0xabf1('0x3e')]!==_0xabf1('0x3f')){var _0x378b54={};_0x378b54[_0x284a36[_0xabf1('0x29')]]={'$like':'%'+_0xb54b63[_0xabf1('0x2f')][_0xabf1('0x3b')]+'%'};return _0x378b54;}})});}_0x45e64f=_['merge']({},_0x45e64f,_0xb54b63['options']);var _0x3d52bc={'where':_0x45e64f[_0xabf1('0x3d')]};return db[_0xabf1('0x2b')][_0xabf1('0x21')](_0x3d52bc)[_0xabf1('0x26')](function(_0x588e20){_0xe3ecbb[_0xabf1('0x21')]=_0x588e20;if(_0xb54b63['query'][_0xabf1('0x40')]){_0x45e64f[_0xabf1('0x41')]=[{'all':!![]}];}return db[_0xabf1('0x2b')][_0xabf1('0x42')](_0x45e64f);})[_0xabf1('0x26')](function(_0x6719e0){_0xe3ecbb['rows']=_0x6719e0;return _0xe3ecbb;})['then'](respondWithFilteredResult(_0x582fbf,_0x45e64f))[_0xabf1('0x43')](handleError(_0x582fbf,null));};exports['show']=function(_0x2500d5,_0xdf51f2){var _0x14368a={'raw':![],'where':{'id':_0x2500d5[_0xabf1('0x44')]['id']}},_0x3757fb={};_0x3757fb['model']=_[_0xabf1('0x30')](db[_0xabf1('0x2b')]['rawAttributes']);_0x3757fb[_0xabf1('0x2f')]=_[_0xabf1('0x30')](_0x2500d5[_0xabf1('0x2f')]);_0x3757fb[_0xabf1('0x31')]=_['intersection'](_0x3757fb[_0xabf1('0x33')],_0x3757fb['query']);_0x14368a[_0xabf1('0x35')]=_[_0xabf1('0x32')](_0x3757fb[_0xabf1('0x33')],qs['fields'](_0x2500d5[_0xabf1('0x2f')][_0xabf1('0x34')]));_0x14368a['attributes']=_0x14368a['attributes'][_0xabf1('0x36')]?_0x14368a[_0xabf1('0x35')]:_0x3757fb[_0xabf1('0x33')];if(_0x2500d5['query']['includeAll']){_0x14368a['include']=[{'all':!![]}];}_0x14368a=_[_0xabf1('0x3c')]({},_0x14368a,_0x2500d5[_0xabf1('0x45')]);return db[_0xabf1('0x2b')][_0xabf1('0x46')](_0x14368a)['then'](handleEntityNotFound(_0xdf51f2,null))['then'](respondWithResult(_0xdf51f2,null))[_0xabf1('0x43')](handleError(_0xdf51f2,null));};exports[_0xabf1('0x47')]=function(_0xb1bb2e,_0x47df69){return db[_0xabf1('0x2b')][_0xabf1('0x47')](_0xb1bb2e['body'],{})['then'](respondWithResult(_0x47df69,0xc9))['catch'](handleError(_0x47df69,null));};exports['update']=function(_0x4771b5,_0x307507){if(_0x4771b5[_0xabf1('0x48')]['id']){delete _0x4771b5[_0xabf1('0x48')]['id'];}return db[_0xabf1('0x2b')][_0xabf1('0x46')]({'where':{'id':_0x4771b5[_0xabf1('0x44')]['id']}})[_0xabf1('0x26')](handleEntityNotFound(_0x307507,null))[_0xabf1('0x26')](saveUpdates(_0x4771b5['body'],null))['then'](respondWithResult(_0x307507,null))['catch'](handleError(_0x307507,null));};exports['destroy']=function(_0x2ba3d1,_0x565122){return db[_0xabf1('0x2b')]['find']({'where':{'id':_0x2ba3d1['params']['id']}})['then'](handleEntityNotFound(_0x565122,null))['then'](removeEntity(_0x565122,null))[_0xabf1('0x43')](handleError(_0x565122,null));};exports[_0xabf1('0x49')]=function(_0x2d8259,_0x390f9b,_0x529a08){var _0x2dace7={};var _0x3ee213={};var _0x1cd6d8;var _0x40210b;return db[_0xabf1('0x2b')][_0xabf1('0x4a')]({'where':{'id':_0x2d8259[_0xabf1('0x44')]['id']}})['then'](handleEntityNotFound(_0x390f9b,null))[_0xabf1('0x26')](function(_0x192d92){if(_0x192d92){_0x1cd6d8=_0x192d92;_0x3ee213[_0xabf1('0x33')]=_['keys'](db['FreshdeskConfiguration'][_0xabf1('0x2c')]);_0x3ee213[_0xabf1('0x2f')]=_['keys'](_0x2d8259['query']);_0x3ee213[_0xabf1('0x31')]=_[_0xabf1('0x32')](_0x3ee213[_0xabf1('0x33')],_0x3ee213[_0xabf1('0x2f')]);_0x2dace7[_0xabf1('0x35')]=_[_0xabf1('0x32')](_0x3ee213[_0xabf1('0x33')],qs[_0xabf1('0x34')](_0x2d8259['query']['fields']));_0x2dace7['attributes']=_0x2dace7['attributes'][_0xabf1('0x36')]?_0x2dace7[_0xabf1('0x35')]:_0x3ee213[_0xabf1('0x33')];_0x2dace7['order']=qs[_0xabf1('0x3a')](_0x2d8259['query']['sort']);_0x2dace7[_0xabf1('0x3d')]=qs['filters'](_[_0xabf1('0x4b')](_0x2d8259[_0xabf1('0x2f')],_0x3ee213[_0xabf1('0x31')]));if(_0x2d8259[_0xabf1('0x2f')][_0xabf1('0x3b')]){_0x2dace7[_0xabf1('0x3d')]=_[_0xabf1('0x3c')](_0x2dace7[_0xabf1('0x3d')],{'$or':_['map'](_0x2dace7[_0xabf1('0x35')],function(_0xd7be58){var _0x4a2b0b={};_0x4a2b0b[_0xd7be58]={'$like':'%'+_0x2d8259[_0xabf1('0x2f')]['filter']+'%'};return _0x4a2b0b;})});}_0x2dace7=_['merge']({},_0x2dace7,_0x2d8259[_0xabf1('0x45')]);return _0x1cd6d8['getConfigurations'](_0x2dace7);}})[_0xabf1('0x26')](function(_0x2beb5b){if(_0x2beb5b){_0x40210b=_0x2beb5b[_0xabf1('0x36')];if(!_0x2d8259[_0xabf1('0x2f')][_0xabf1('0x37')](_0xabf1('0x38'))){_0x2dace7['limit']=qs[_0xabf1('0x1f')](_0x2d8259[_0xabf1('0x2f')][_0xabf1('0x1f')]);_0x2dace7['offset']=qs[_0xabf1('0x1e')](_0x2d8259['query']['offset']);}return _0x1cd6d8[_0xabf1('0x49')](_0x2dace7);}})['then'](function(_0x429aa8){if(_0x429aa8){return _0x429aa8?{'count':_0x40210b,'rows':_0x429aa8}:null;}})[_0xabf1('0x26')](respondWithResult(_0x390f9b,null))[_0xabf1('0x43')](handleError(_0x390f9b,null));};exports[_0xabf1('0x4c')]=function(_0x51725e,_0x451489,_0x34bff8){if(_0x51725e['body']['id']){delete _0x51725e[_0xabf1('0x48')]['id'];}return db['FreshdeskAccount'][_0xabf1('0x4a')]({'where':{'id':_0x51725e[_0xabf1('0x44')]['id']}})[_0xabf1('0x26')](handleEntityNotFound(_0x451489,null))[_0xabf1('0x26')](function(_0x204feb){if(_0x204feb){_0x51725e[_0xabf1('0x48')][_0xabf1('0x4d')]=_0x204feb['id'];_0x51725e[_0xabf1('0x48')][_0xabf1('0x4e')]=integrations[_0xabf1('0x4f')](_0x51725e[_0xabf1('0x48')][_0xabf1('0x50')],_0x51725e[_0xabf1('0x48')]['type']);_0x51725e[_0xabf1('0x48')]['Descriptions']=integrations[_0xabf1('0x51')](_0x51725e[_0xabf1('0x48')][_0xabf1('0x50')],_0x51725e[_0xabf1('0x48')]['type']);return db['FreshdeskConfiguration']['create'](_0x51725e[_0xabf1('0x48')],{'include':[{'model':db[_0xabf1('0x52')],'as':'Subjects'},{'model':db[_0xabf1('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x451489,null))[_0xabf1('0x43')](handleError(_0x451489,null));};exports[_0xabf1('0x53')]=function(_0x3e1f8e,_0x41e78f,_0x23d9a4){var _0x54979b='';return db[_0xabf1('0x2b')]['findOne']({'where':{'id':_0x3e1f8e[_0xabf1('0x44')]['id']},'attributes':['id',_0xabf1('0x54'),'apiKey']})[_0xabf1('0x26')](handleEntityNotFound(_0x41e78f,null))[_0xabf1('0x26')](function(_0x86f04e){if(_0x86f04e){_0x54979b=_0x86f04e['remoteUri'];var _0x2e15d2=_0x54979b[_0xabf1('0x55')](-0x1);if(_0x2e15d2==='/'){_0x54979b=_0x54979b[_0xabf1('0x56')](0x0,_0x54979b[_0xabf1('0x57')](_0x2e15d2));}return rp({'method':_0xabf1('0x58'),'uri':util[_0xabf1('0x59')](_0xabf1('0x5a'),_0x54979b,_0xabf1('0x5b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xabf1('0x59')](_0xabf1('0x5c'),_0x86f04e[_0xabf1('0x5d')]))['toString'](_0xabf1('0x5e')))},'json':!![]});}})[_0xabf1('0x26')](function(_0xce15a1){if(_0xce15a1){var _0x4af8c2=['requester',_0xabf1('0x5f'),_0xabf1('0x60'),_0xabf1('0x61'),_0xabf1('0x1c'),_0xabf1('0x62'),_0xabf1('0x63'),'source',_0xabf1('0x64'),_0xabf1('0x63'),_0xabf1('0x65')];_['remove'](_0xce15a1,function(_0x4a0c54){return _0x4af8c2['includes'](_0x4a0c54[_0xabf1('0x29')])||!_0x4a0c54[_0xabf1('0x66')]&&_0x4a0c54[_0xabf1('0x3e')]!==_0xabf1('0x67')&&_0x4a0c54[_0xabf1('0x3e')]!==_0xabf1('0x68');});return{'count':_0xce15a1[_0xabf1('0x36')],'rows':_[_0xabf1('0x2e')](_0xce15a1,function(_0x5c771e){return{'id':_0x5c771e['name'],'name':_0x5c771e[_0xabf1('0x69')],'custom':!_0x5c771e[_0xabf1('0x66')],'options':_0x5c771e[_0xabf1('0x6a')]?_[_0xabf1('0x2e')](_0x5c771e[_0xabf1('0x6a')],function(_0x4f2143){return{'name':_['capitalize'](_0x4f2143),'value':_0x4f2143};}):[]};})};}})['then'](respondWithResult(_0x41e78f,null))[_0xabf1('0x43')](function(_0x4cd09a){var _0xde5c57=_0x3e1f8e[_0xabf1('0x2f')][_0xabf1('0x6b')]?0x1f4:_0x4cd09a[_0xabf1('0x6c')]||0x1f4;logger[_0xabf1('0x27')](_0xabf1('0x6d'),_0xabf1('0x53'),_0xde5c57,JSON[_0xabf1('0x6e')](_0x4cd09a));delete _0x4cd09a[_0xabf1('0x29')];if(_0xde5c57===0x191){_0xde5c57=0x190;}_0x41e78f['status'](_0xde5c57)[_0xabf1('0x2a')](_0x3e1f8e[_0xabf1('0x2f')][_0xabf1('0x6b')]?{'message':_0xabf1('0x6f'),'statusCode':_0x4cd09a[_0xabf1('0x6c')]}:_0x4cd09a);});}; \ No newline at end of file +var _0x8e44=['bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','map','FreshdeskAccount','rawAttributes','type','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','fields','length','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','params','AccountId','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','apiKey','remoteUri','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','ticket_type','company','default','label','choices','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment'];(function(_0x5a9405,_0x52b2aa){var _0x3ae14d=function(_0x3e4f2b){while(--_0x3e4f2b){_0x5a9405['push'](_0x5a9405['shift']());}};_0x3ae14d(++_0x52b2aa);}(_0x8e44,0x1ac));var _0x48e4=function(_0x150625,_0x5713ec){_0x150625=_0x150625-0x0;var _0x3cb4a8=_0x8e44[_0x150625];return _0x3cb4a8;};'use strict';var emlformat=require(_0x48e4('0x0'));var rimraf=require(_0x48e4('0x1'));var zipdir=require(_0x48e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48e4('0x3'));var BPromise=require(_0x48e4('0x4'));var Mustache=require(_0x48e4('0x5'));var util=require(_0x48e4('0x6'));var path=require('path');var sox=require(_0x48e4('0x7'));var csv=require(_0x48e4('0x8'));var ejs=require(_0x48e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x8'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var licenseUtil=require(_0x48e4('0x16'));var db=require(_0x48e4('0x17'))['db'];var integrations=require(_0x48e4('0x18'));function respondWithStatusCode(_0x55a9ab,_0x28c15a){_0x28c15a=_0x28c15a||0xcc;return function(_0x5edebe){if(_0x5edebe){return _0x55a9ab[_0x48e4('0x19')](_0x28c15a);}return _0x55a9ab[_0x48e4('0x1a')](_0x28c15a)[_0x48e4('0x1b')]();};}function respondWithResult(_0xb1f558,_0x12f7af){_0x12f7af=_0x12f7af||0xc8;return function(_0x39bd10){if(_0x39bd10){return _0xb1f558[_0x48e4('0x1a')](_0x12f7af)['json'](_0x39bd10);}};}function respondWithFilteredResult(_0x1c82d2,_0x15519c){return function(_0x5c8fe5){if(_0x5c8fe5){var _0x171f89=typeof _0x15519c[_0x48e4('0x1c')]==='undefined'&&typeof _0x15519c[_0x48e4('0x1d')]===_0x48e4('0x1e');var _0x12fc37=_0x5c8fe5['count'];var _0x231dcd=_0x171f89?0x0:_0x15519c[_0x48e4('0x1c')];var _0x4e3943=_0x171f89?_0x5c8fe5['count']:_0x15519c[_0x48e4('0x1c')]+_0x15519c['limit'];var _0x494927;if(_0x4e3943>=_0x12fc37){_0x4e3943=_0x12fc37;_0x494927=0xc8;}else{_0x494927=0xce;}_0x1c82d2[_0x48e4('0x1a')](_0x494927);return _0x1c82d2[_0x48e4('0x1f')](_0x48e4('0x20'),_0x231dcd+'-'+_0x4e3943+'/'+_0x12fc37)[_0x48e4('0x21')](_0x5c8fe5);}return null;};}function patchUpdates(_0xda50d1){return function(_0x5d86dc){try{jsonpatch['apply'](_0x5d86dc,_0xda50d1,!![]);}catch(_0x431c67){return BPromise[_0x48e4('0x22')](_0x431c67);}return _0x5d86dc[_0x48e4('0x23')]();};}function saveUpdates(_0x131817,_0x846128){return function(_0x377249){if(_0x377249){return _0x377249[_0x48e4('0x24')](_0x131817)[_0x48e4('0x25')](function(_0x73f81c){return _0x73f81c;});}return null;};}function removeEntity(_0x3c0082,_0x1a80ed){return function(_0x5cc3e6){if(_0x5cc3e6){return _0x5cc3e6[_0x48e4('0x26')]()[_0x48e4('0x25')](function(){_0x3c0082['status'](0xcc)[_0x48e4('0x1b')]();});}};}function handleEntityNotFound(_0x23b2ba,_0x4abfbc){return function(_0x9a1c6d){if(!_0x9a1c6d){_0x23b2ba[_0x48e4('0x19')](0x194);}return _0x9a1c6d;};}function handleError(_0x3a446c,_0xc113e3){_0xc113e3=_0xc113e3||0x1f4;return function(_0x1e7d7e){logger[_0x48e4('0x27')](_0x1e7d7e[_0x48e4('0x28')]);if(_0x1e7d7e['name']){delete _0x1e7d7e[_0x48e4('0x29')];}_0x3a446c[_0x48e4('0x1a')](_0xc113e3)['send'](_0x1e7d7e);};}exports['index']=function(_0x318d09,_0x4b8f3c){var _0x346765={},_0x214def={},_0x5a7685={'count':0x0,'rows':[]};var _0x3012b3=_[_0x48e4('0x2a')](db[_0x48e4('0x2b')][_0x48e4('0x2c')],function(_0x15a413){return{'name':_0x15a413['fieldName'],'type':_0x15a413[_0x48e4('0x2d')]['key']};});_0x214def['model']=_['map'](_0x3012b3,_0x48e4('0x29'));_0x214def[_0x48e4('0x2e')]=_[_0x48e4('0x2f')](_0x318d09[_0x48e4('0x2e')]);_0x214def[_0x48e4('0x30')]=_[_0x48e4('0x31')](_0x214def[_0x48e4('0x32')],_0x214def[_0x48e4('0x2e')]);_0x346765[_0x48e4('0x33')]=_[_0x48e4('0x31')](_0x214def[_0x48e4('0x32')],qs['fields'](_0x318d09['query']['fields']));_0x346765[_0x48e4('0x33')]=_0x346765[_0x48e4('0x33')]['length']?_0x346765[_0x48e4('0x33')]:_0x214def[_0x48e4('0x32')];if(!_0x318d09['query'][_0x48e4('0x34')](_0x48e4('0x35'))){_0x346765[_0x48e4('0x1d')]=qs[_0x48e4('0x1d')](_0x318d09['query'][_0x48e4('0x1d')]);_0x346765[_0x48e4('0x1c')]=qs['offset'](_0x318d09['query'][_0x48e4('0x1c')]);}_0x346765[_0x48e4('0x36')]=qs[_0x48e4('0x37')](_0x318d09['query'][_0x48e4('0x37')]);_0x346765[_0x48e4('0x38')]=qs['filters'](_[_0x48e4('0x39')](_0x318d09[_0x48e4('0x2e')],_0x214def[_0x48e4('0x30')]),_0x3012b3);if(_0x318d09[_0x48e4('0x2e')][_0x48e4('0x3a')]){_0x346765['where']=_[_0x48e4('0x3b')](_0x346765[_0x48e4('0x38')],{'$or':_[_0x48e4('0x2a')](_0x3012b3,function(_0x5eb2a6){if(_0x5eb2a6[_0x48e4('0x2d')]!=='VIRTUAL'){var _0x465a2f={};_0x465a2f[_0x5eb2a6[_0x48e4('0x29')]]={'$like':'%'+_0x318d09[_0x48e4('0x2e')][_0x48e4('0x3a')]+'%'};return _0x465a2f;}})});}_0x346765=_[_0x48e4('0x3b')]({},_0x346765,_0x318d09[_0x48e4('0x3c')]);var _0x3046a7={'where':_0x346765[_0x48e4('0x38')]};return db[_0x48e4('0x2b')][_0x48e4('0x3d')](_0x3046a7)[_0x48e4('0x25')](function(_0x526e96){_0x5a7685[_0x48e4('0x3d')]=_0x526e96;if(_0x318d09[_0x48e4('0x2e')][_0x48e4('0x3e')]){_0x346765[_0x48e4('0x3f')]=[{'all':!![]}];}return db[_0x48e4('0x2b')][_0x48e4('0x40')](_0x346765);})[_0x48e4('0x25')](function(_0x5ada7a){_0x5a7685[_0x48e4('0x41')]=_0x5ada7a;return _0x5a7685;})[_0x48e4('0x25')](respondWithFilteredResult(_0x4b8f3c,_0x346765))[_0x48e4('0x42')](handleError(_0x4b8f3c,null));};exports['show']=function(_0x1252b2,_0x331980){var _0x3cc197={'raw':![],'where':{'id':_0x1252b2['params']['id']}},_0x588b5c={};_0x588b5c[_0x48e4('0x32')]=_[_0x48e4('0x2f')](db['FreshdeskAccount'][_0x48e4('0x2c')]);_0x588b5c['query']=_['keys'](_0x1252b2['query']);_0x588b5c['filters']=_[_0x48e4('0x31')](_0x588b5c[_0x48e4('0x32')],_0x588b5c[_0x48e4('0x2e')]);_0x3cc197[_0x48e4('0x33')]=_[_0x48e4('0x31')](_0x588b5c[_0x48e4('0x32')],qs['fields'](_0x1252b2[_0x48e4('0x2e')][_0x48e4('0x43')]));_0x3cc197['attributes']=_0x3cc197['attributes'][_0x48e4('0x44')]?_0x3cc197[_0x48e4('0x33')]:_0x588b5c[_0x48e4('0x32')];if(_0x1252b2[_0x48e4('0x2e')]['includeAll']){_0x3cc197[_0x48e4('0x3f')]=[{'all':!![]}];}_0x3cc197=_[_0x48e4('0x3b')]({},_0x3cc197,_0x1252b2[_0x48e4('0x3c')]);return db[_0x48e4('0x2b')][_0x48e4('0x45')](_0x3cc197)[_0x48e4('0x25')](handleEntityNotFound(_0x331980,null))['then'](respondWithResult(_0x331980,null))[_0x48e4('0x42')](handleError(_0x331980,null));};exports[_0x48e4('0x46')]=function(_0x31ee7b,_0x9de3c4){return db[_0x48e4('0x2b')][_0x48e4('0x46')](_0x31ee7b[_0x48e4('0x47')],{})[_0x48e4('0x25')](respondWithResult(_0x9de3c4,0xc9))[_0x48e4('0x42')](handleError(_0x9de3c4,null));};exports[_0x48e4('0x24')]=function(_0x2436fb,_0x56186a){if(_0x2436fb[_0x48e4('0x47')]['id']){delete _0x2436fb['body']['id'];}return db['FreshdeskAccount'][_0x48e4('0x45')]({'where':{'id':_0x2436fb['params']['id']}})[_0x48e4('0x25')](handleEntityNotFound(_0x56186a,null))[_0x48e4('0x25')](saveUpdates(_0x2436fb[_0x48e4('0x47')],null))[_0x48e4('0x25')](respondWithResult(_0x56186a,null))[_0x48e4('0x42')](handleError(_0x56186a,null));};exports[_0x48e4('0x26')]=function(_0x10eb0c,_0x57c9e5){return db['FreshdeskAccount'][_0x48e4('0x45')]({'where':{'id':_0x10eb0c['params']['id']}})[_0x48e4('0x25')](handleEntityNotFound(_0x57c9e5,null))[_0x48e4('0x25')](removeEntity(_0x57c9e5,null))[_0x48e4('0x42')](handleError(_0x57c9e5,null));};exports['getConfigurations']=function(_0x14ed52,_0x15d1aa,_0x3dbef7){var _0x55d05d={};var _0x3d9db2={};var _0x9ae821;var _0x91b42d;return db[_0x48e4('0x2b')][_0x48e4('0x48')]({'where':{'id':_0x14ed52['params']['id']}})[_0x48e4('0x25')](handleEntityNotFound(_0x15d1aa,null))[_0x48e4('0x25')](function(_0x544137){if(_0x544137){_0x9ae821=_0x544137;_0x3d9db2[_0x48e4('0x32')]=_[_0x48e4('0x2f')](db[_0x48e4('0x49')][_0x48e4('0x2c')]);_0x3d9db2['query']=_['keys'](_0x14ed52['query']);_0x3d9db2['filters']=_[_0x48e4('0x31')](_0x3d9db2[_0x48e4('0x32')],_0x3d9db2[_0x48e4('0x2e')]);_0x55d05d[_0x48e4('0x33')]=_[_0x48e4('0x31')](_0x3d9db2[_0x48e4('0x32')],qs[_0x48e4('0x43')](_0x14ed52[_0x48e4('0x2e')][_0x48e4('0x43')]));_0x55d05d[_0x48e4('0x33')]=_0x55d05d[_0x48e4('0x33')][_0x48e4('0x44')]?_0x55d05d[_0x48e4('0x33')]:_0x3d9db2['model'];_0x55d05d[_0x48e4('0x36')]=qs[_0x48e4('0x37')](_0x14ed52[_0x48e4('0x2e')][_0x48e4('0x37')]);_0x55d05d[_0x48e4('0x38')]=qs[_0x48e4('0x30')](_[_0x48e4('0x39')](_0x14ed52[_0x48e4('0x2e')],_0x3d9db2[_0x48e4('0x30')]));if(_0x14ed52[_0x48e4('0x2e')][_0x48e4('0x3a')]){_0x55d05d[_0x48e4('0x38')]=_['merge'](_0x55d05d['where'],{'$or':_[_0x48e4('0x2a')](_0x55d05d[_0x48e4('0x33')],function(_0x2b0be2){var _0x1a30eb={};_0x1a30eb[_0x2b0be2]={'$like':'%'+_0x14ed52[_0x48e4('0x2e')]['filter']+'%'};return _0x1a30eb;})});}_0x55d05d=_[_0x48e4('0x3b')]({},_0x55d05d,_0x14ed52['options']);return _0x9ae821[_0x48e4('0x4a')](_0x55d05d);}})[_0x48e4('0x25')](function(_0xb6c870){if(_0xb6c870){_0x91b42d=_0xb6c870['length'];if(!_0x14ed52[_0x48e4('0x2e')][_0x48e4('0x34')](_0x48e4('0x35'))){_0x55d05d[_0x48e4('0x1d')]=qs[_0x48e4('0x1d')](_0x14ed52[_0x48e4('0x2e')][_0x48e4('0x1d')]);_0x55d05d['offset']=qs[_0x48e4('0x1c')](_0x14ed52[_0x48e4('0x2e')][_0x48e4('0x1c')]);}return _0x9ae821['getConfigurations'](_0x55d05d);}})[_0x48e4('0x25')](function(_0x1721b5){if(_0x1721b5){return _0x1721b5?{'count':_0x91b42d,'rows':_0x1721b5}:null;}})['then'](respondWithResult(_0x15d1aa,null))['catch'](handleError(_0x15d1aa,null));};exports['addConfiguration']=function(_0x108096,_0x2a895a,_0x571e3b){if(_0x108096[_0x48e4('0x47')]['id']){delete _0x108096[_0x48e4('0x47')]['id'];}return db[_0x48e4('0x2b')][_0x48e4('0x48')]({'where':{'id':_0x108096[_0x48e4('0x4b')]['id']}})[_0x48e4('0x25')](handleEntityNotFound(_0x2a895a,null))[_0x48e4('0x25')](function(_0x273d6a){if(_0x273d6a){_0x108096[_0x48e4('0x47')][_0x48e4('0x4c')]=_0x273d6a['id'];_0x108096['body']['Subjects']=integrations['getSubjects'](_0x108096[_0x48e4('0x47')][_0x48e4('0x4d')],_0x108096['body'][_0x48e4('0x2d')]);_0x108096['body'][_0x48e4('0x4e')]=integrations[_0x48e4('0x4f')](_0x108096[_0x48e4('0x47')][_0x48e4('0x4d')],_0x108096[_0x48e4('0x47')][_0x48e4('0x2d')]);return db[_0x48e4('0x49')][_0x48e4('0x46')](_0x108096[_0x48e4('0x47')],{'include':[{'model':db[_0x48e4('0x50')],'as':_0x48e4('0x51')},{'model':db[_0x48e4('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2a895a,null))[_0x48e4('0x42')](handleError(_0x2a895a,null));};exports['getFields']=function(_0x142a68,_0x1228e8,_0x5be949){var _0x274d07='';return db[_0x48e4('0x2b')][_0x48e4('0x48')]({'where':{'id':_0x142a68[_0x48e4('0x4b')]['id']},'attributes':['id','remoteUri',_0x48e4('0x52')]})['then'](handleEntityNotFound(_0x1228e8,null))[_0x48e4('0x25')](function(_0x3bbb93){if(_0x3bbb93){_0x274d07=_0x3bbb93[_0x48e4('0x53')];var _0x295122=_0x274d07[_0x48e4('0x54')](-0x1);if(_0x295122==='/'){_0x274d07=_0x274d07['substring'](0x0,_0x274d07[_0x48e4('0x55')](_0x295122));}return rp({'method':'GET','uri':util[_0x48e4('0x56')](_0x48e4('0x57'),_0x274d07,_0x48e4('0x58')),'headers':{'Authorization':util[_0x48e4('0x56')](_0x48e4('0x59'),new Buffer(util['format'](_0x48e4('0x5a'),_0x3bbb93[_0x48e4('0x52')]))[_0x48e4('0x5b')](_0x48e4('0x5c')))},'json':!![]});}})[_0x48e4('0x25')](function(_0x25d715){if(_0x25d715){var _0x35f964=[_0x48e4('0x5d'),_0x48e4('0x5e'),_0x48e4('0x5f'),'description','status',_0x48e4('0x60'),'group','source',_0x48e4('0x61'),'group',_0x48e4('0x62')];_['remove'](_0x25d715,function(_0x339f59){return _0x35f964['includes'](_0x339f59[_0x48e4('0x29')])||!_0x339f59[_0x48e4('0x63')]&&_0x339f59[_0x48e4('0x2d')]!=='custom_text'&&_0x339f59['type']!=='custom_dropdown';});return{'count':_0x25d715[_0x48e4('0x44')],'rows':_['map'](_0x25d715,function(_0xc2856){return{'id':_0xc2856[_0x48e4('0x29')],'name':_0xc2856[_0x48e4('0x64')],'custom':!_0xc2856['default'],'options':_0xc2856[_0x48e4('0x65')]?_[_0x48e4('0x2a')](_0xc2856[_0x48e4('0x65')],function(_0x184dd6){return{'name':_['capitalize'](_0x184dd6),'value':_0x184dd6};}):[]};})};}})[_0x48e4('0x25')](respondWithResult(_0x1228e8,null))[_0x48e4('0x42')](function(_0x5974f1){var _0x5cfabf=_0x142a68[_0x48e4('0x2e')]['test']?0x1f4:_0x5974f1['statusCode']||0x1f4;logger[_0x48e4('0x27')](_0x48e4('0x66'),_0x48e4('0x67'),_0x5cfabf,JSON[_0x48e4('0x68')](_0x5974f1));delete _0x5974f1[_0x48e4('0x29')];if(_0x5cfabf===0x191){_0x5cfabf=0x190;}_0x1228e8['status'](_0x5cfabf)['send'](_0x142a68[_0x48e4('0x2e')][_0x48e4('0x69')]?{'message':_0x48e4('0x6a'),'statusCode':_0x5974f1[_0x48e4('0x6b')]}:_0x5974f1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e57777f..601e842 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 _0xdf73=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2c2987,_0xa032ab){var _0x2ad65d=function(_0x2acd84){while(--_0x2acd84){_0x2c2987['push'](_0x2c2987['shift']());}};_0x2ad65d(++_0xa032ab);}(_0xdf73,0x170));var _0x3df7=function(_0x3c927a,_0x356829){_0x3c927a=_0x3c927a-0x0;var _0x248d7e=_0xdf73[_0x3c927a];return _0x248d7e;};'use strict';var _=require(_0x3df7('0x0'));var util=require(_0x3df7('0x1'));var logger=require('../../config/logger')(_0x3df7('0x2'));var moment=require('moment');var BPromise=require(_0x3df7('0x3'));var rp=require(_0x3df7('0x4'));var fs=require('fs');var path=require(_0x3df7('0x5'));var rimraf=require(_0x3df7('0x6'));var config=require(_0x3df7('0x7'));var attributes=require(_0x3df7('0x8'));var integrations=require(_0x3df7('0x9'));module[_0x3df7('0xa')]=function(_0x3eef02,_0x63e89a){return _0x3eef02[_0x3df7('0xb')](_0x3df7('0xc'),attributes,{'tableName':_0x3df7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x198d=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api'];(function(_0x329feb,_0x184c52){var _0x3d67a2=function(_0xd6da34){while(--_0xd6da34){_0x329feb['push'](_0x329feb['shift']());}};_0x3d67a2(++_0x184c52);}(_0x198d,0x1cb));var _0xd198=function(_0x47f1a0,_0x167be1){_0x47f1a0=_0x47f1a0-0x0;var _0x175246=_0x198d[_0x47f1a0];return _0x175246;};'use strict';var _=require('lodash');var util=require(_0xd198('0x0'));var logger=require(_0xd198('0x1'))(_0xd198('0x2'));var moment=require(_0xd198('0x3'));var BPromise=require(_0xd198('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd198('0x5'));var rimraf=require(_0xd198('0x6'));var config=require(_0xd198('0x7'));var attributes=require(_0xd198('0x8'));var integrations=require(_0xd198('0x9'));module[_0xd198('0xa')]=function(_0x3df8c5,_0x3a0394){return _0x3df8c5[_0xd198('0xb')](_0xd198('0xc'),attributes,{'tableName':_0xd198('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 36dd063..5de3474 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 _0x26ed=['rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','model','include','map','catch','ShowFreshdeskAccount','find','where','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x52b935,_0x22700b){var _0xbe543e=function(_0x346093){while(--_0x346093){_0x52b935['push'](_0x52b935['shift']());}};_0xbe543e(++_0x22700b);}(_0x26ed,0x17c));var _0xd26e=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0x26ed[_0x1ad07b];return _0x2c447f;};'use strict';var _=require('lodash');var util=require(_0xd26e('0x0'));var moment=require('moment');var BPromise=require(_0xd26e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd26e('0x2'));var db=require(_0xd26e('0x3'))['db'];var utils=require(_0xd26e('0x4'));var logger=require('../../config/logger')(_0xd26e('0x5'));var config=require(_0xd26e('0x6'));var jayson=require(_0xd26e('0x7'));var client=jayson[_0xd26e('0x8')][_0xd26e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c32df,_0x1f8cff,_0x5b8430){return new BPromise(function(_0x820d88,_0x34a0a7){return client[_0xd26e('0xa')](_0x3c32df,_0x5b8430)[_0xd26e('0xb')](function(_0x57ad26){logger['info'](_0xd26e('0xc'),_0x1f8cff,'request\x20sent');logger[_0xd26e('0xd')](_0xd26e('0xe'),_0x1f8cff,_0xd26e('0xf'),JSON[_0xd26e('0x10')](_0x57ad26));if(_0x57ad26[_0xd26e('0x11')]){if(_0x57ad26[_0xd26e('0x11')][_0xd26e('0x12')]===0x1f4){logger[_0xd26e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f8cff,_0x57ad26['error'][_0xd26e('0x13')]);return _0x34a0a7(_0x57ad26['error'][_0xd26e('0x13')]);}logger[_0xd26e('0x11')](_0xd26e('0xc'),_0x1f8cff,_0x57ad26[_0xd26e('0x11')][_0xd26e('0x13')]);return _0x820d88(_0x57ad26[_0xd26e('0x11')]['message']);}else{logger[_0xd26e('0x14')](_0xd26e('0xc'),_0x1f8cff,_0xd26e('0xf'));_0x820d88(_0x57ad26['result'][_0xd26e('0x13')]);}})['catch'](function(_0x155c7b){logger[_0xd26e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f8cff,_0x155c7b);_0x34a0a7(_0x155c7b);});});}exports[_0xd26e('0x15')]=function(_0x235557){var _0x1d59a4=this;return new Promise(function(_0x9632eb,_0xd64bc2){return db[_0xd26e('0x16')][_0xd26e('0x17')]({'raw':_0x235557['options']?_0x235557[_0xd26e('0x18')][_0xd26e('0x19')]===undefined?!![]:![]:!![],'where':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')]['where']||null:null,'attributes':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')][_0xd26e('0x1a')]||null:null,'limit':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')][_0xd26e('0x1b')]||null:null,'include':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')]['include']?_['map'](_0x235557[_0xd26e('0x18')]['include'],function(_0x3668f2){return{'model':db[_0x3668f2[_0xd26e('0x1c')]],'as':_0x3668f2['as'],'attributes':_0x3668f2['attributes'],'include':_0x3668f2[_0xd26e('0x1d')]?_[_0xd26e('0x1e')](_0x3668f2[_0xd26e('0x1d')],function(_0xe5f8dd){return{'model':db[_0xe5f8dd[_0xd26e('0x1c')]],'as':_0xe5f8dd['as'],'attributes':_0xe5f8dd[_0xd26e('0x1a')],'include':_0xe5f8dd[_0xd26e('0x1d')]?_[_0xd26e('0x1e')](_0xe5f8dd[_0xd26e('0x1d')],function(_0x2968e3){return{'model':db[_0x2968e3[_0xd26e('0x1c')]],'as':_0x2968e3['as'],'attributes':_0x2968e3[_0xd26e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd26e('0xb')](function(_0x42db91){logger['info'](_0xd26e('0x15'),_0x235557);logger[_0xd26e('0xd')](_0xd26e('0x15'),_0x235557,JSON['stringify'](_0x42db91));_0x9632eb(_0x42db91);})[_0xd26e('0x1f')](function(_0x56df11){logger['error'](_0xd26e('0x15'),_0x56df11[_0xd26e('0x13')],_0x235557);_0xd64bc2(_0x1d59a4['error'](0x1f4,_0x56df11['message']));});});};exports[_0xd26e('0x20')]=function(_0x41bc97){var _0x5bc285=this;return new Promise(function(_0x496ac1,_0x528e0f){return db[_0xd26e('0x16')][_0xd26e('0x21')]({'raw':_0x41bc97[_0xd26e('0x18')]?_0x41bc97[_0xd26e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x41bc97[_0xd26e('0x18')]?_0x41bc97[_0xd26e('0x18')][_0xd26e('0x22')]||null:null,'attributes':_0x41bc97[_0xd26e('0x18')]?_0x41bc97[_0xd26e('0x18')][_0xd26e('0x1a')]||null:null,'include':_0x41bc97[_0xd26e('0x18')]?_0x41bc97[_0xd26e('0x18')][_0xd26e('0x1d')]?_[_0xd26e('0x1e')](_0x41bc97[_0xd26e('0x18')]['include'],function(_0x3ea37a){return{'model':db[_0x3ea37a[_0xd26e('0x1c')]],'as':_0x3ea37a['as'],'attributes':_0x3ea37a['attributes'],'include':_0x3ea37a[_0xd26e('0x1d')]?_[_0xd26e('0x1e')](_0x3ea37a[_0xd26e('0x1d')],function(_0x4ba13b){return{'model':db[_0x4ba13b[_0xd26e('0x1c')]],'as':_0x4ba13b['as'],'attributes':_0x4ba13b[_0xd26e('0x1a')],'include':_0x4ba13b['include']?_[_0xd26e('0x1e')](_0x4ba13b[_0xd26e('0x1d')],function(_0x3b0f68){return{'model':db[_0x3b0f68['model']],'as':_0x3b0f68['as'],'attributes':_0x3b0f68[_0xd26e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd26e('0xb')](function(_0xacc3e5){logger[_0xd26e('0x14')]('ShowFreshdeskAccount',_0x41bc97);logger[_0xd26e('0xd')](_0xd26e('0x20'),_0x41bc97,JSON[_0xd26e('0x10')](_0xacc3e5));_0x496ac1(_0xacc3e5);})['catch'](function(_0x56e9ea){logger[_0xd26e('0x11')]('ShowFreshdeskAccount',_0x56e9ea['message'],_0x41bc97);_0x528e0f(_0x5bc285[_0xd26e('0x11')](0x1f4,_0x56e9ea[_0xd26e('0x13')]));});});}; \ No newline at end of file +var _0xdffe=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowFreshdeskAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdffe,0x1d2));var _0xedff=function(_0x4491ef,_0x5153d9){_0x4491ef=_0x4491ef-0x0;var _0x3c72dc=_0xdffe[_0x4491ef];return _0x3c72dc;};'use strict';var _=require('lodash');var util=require(_0xedff('0x0'));var moment=require('moment');var BPromise=require(_0xedff('0x1'));var rs=require(_0xedff('0x2'));var fs=require('fs');var Redis=require(_0xedff('0x3'));var db=require(_0xedff('0x4'))['db'];var utils=require(_0xedff('0x5'));var logger=require(_0xedff('0x6'))('rpc');var config=require(_0xedff('0x7'));var jayson=require(_0xedff('0x8'));var client=jayson[_0xedff('0x9')][_0xedff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49f593,_0x18b784,_0x207b40){return new BPromise(function(_0x2b7152,_0x444b34){return client[_0xedff('0xb')](_0x49f593,_0x207b40)[_0xedff('0xc')](function(_0xf506dd){logger[_0xedff('0xd')](_0xedff('0xe'),_0x18b784,_0xedff('0xf'));logger[_0xedff('0x10')](_0xedff('0x11'),_0x18b784,_0xedff('0xf'),JSON[_0xedff('0x12')](_0xf506dd));if(_0xf506dd[_0xedff('0x13')]){if(_0xf506dd[_0xedff('0x13')][_0xedff('0x14')]===0x1f4){logger[_0xedff('0x13')](_0xedff('0xe'),_0x18b784,_0xf506dd['error'][_0xedff('0x15')]);return _0x444b34(_0xf506dd['error']['message']);}logger[_0xedff('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x18b784,_0xf506dd[_0xedff('0x13')][_0xedff('0x15')]);return _0x2b7152(_0xf506dd['error'][_0xedff('0x15')]);}else{logger[_0xedff('0xd')](_0xedff('0xe'),_0x18b784,_0xedff('0xf'));_0x2b7152(_0xf506dd[_0xedff('0x16')][_0xedff('0x15')]);}})[_0xedff('0x17')](function(_0x5321b1){logger['error'](_0xedff('0xe'),_0x18b784,_0x5321b1);_0x444b34(_0x5321b1);});});}exports[_0xedff('0x18')]=function(_0x4a2493){var _0x65352b=this;return new Promise(function(_0x1a5bc6,_0xb1ab24){return db[_0xedff('0x19')][_0xedff('0x1a')]({'raw':_0x4a2493[_0xedff('0x1b')]?_0x4a2493['options'][_0xedff('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a2493[_0xedff('0x1b')]?_0x4a2493[_0xedff('0x1b')][_0xedff('0x1d')]||null:null,'attributes':_0x4a2493[_0xedff('0x1b')]?_0x4a2493[_0xedff('0x1b')][_0xedff('0x1e')]||null:null,'limit':_0x4a2493[_0xedff('0x1b')]?_0x4a2493['options'][_0xedff('0x1f')]||null:null,'include':_0x4a2493[_0xedff('0x1b')]?_0x4a2493['options'][_0xedff('0x20')]?_['map'](_0x4a2493[_0xedff('0x1b')]['include'],function(_0x4a70cf){return{'model':db[_0x4a70cf[_0xedff('0x21')]],'as':_0x4a70cf['as'],'attributes':_0x4a70cf['attributes'],'include':_0x4a70cf[_0xedff('0x20')]?_['map'](_0x4a70cf[_0xedff('0x20')],function(_0xf8896){return{'model':db[_0xf8896[_0xedff('0x21')]],'as':_0xf8896['as'],'attributes':_0xf8896[_0xedff('0x1e')],'include':_0xf8896['include']?_[_0xedff('0x22')](_0xf8896['include'],function(_0x4505bc){return{'model':db[_0x4505bc[_0xedff('0x21')]],'as':_0x4505bc['as'],'attributes':_0x4505bc[_0xedff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xedff('0xc')](function(_0x4d3275){logger[_0xedff('0xd')](_0xedff('0x18'),_0x4a2493);logger[_0xedff('0x10')](_0xedff('0x18'),_0x4a2493,JSON[_0xedff('0x12')](_0x4d3275));_0x1a5bc6(_0x4d3275);})[_0xedff('0x17')](function(_0x24c986){logger['error']('GetFreshdeskAccount',_0x24c986[_0xedff('0x15')],_0x4a2493);_0xb1ab24(_0x65352b['error'](0x1f4,_0x24c986['message']));});});};exports[_0xedff('0x23')]=function(_0xb070f){var _0x1befd0=this;return new Promise(function(_0x23bb76,_0x21e3fa){return db['FreshdeskAccount'][_0xedff('0x24')]({'raw':_0xb070f[_0xedff('0x1b')]?_0xb070f['options']['raw']===undefined?!![]:![]:!![],'where':_0xb070f[_0xedff('0x1b')]?_0xb070f['options']['where']||null:null,'attributes':_0xb070f[_0xedff('0x1b')]?_0xb070f[_0xedff('0x1b')][_0xedff('0x1e')]||null:null,'include':_0xb070f[_0xedff('0x1b')]?_0xb070f[_0xedff('0x1b')][_0xedff('0x20')]?_[_0xedff('0x22')](_0xb070f[_0xedff('0x1b')][_0xedff('0x20')],function(_0x5ced47){return{'model':db[_0x5ced47[_0xedff('0x21')]],'as':_0x5ced47['as'],'attributes':_0x5ced47[_0xedff('0x1e')],'include':_0x5ced47['include']?_[_0xedff('0x22')](_0x5ced47[_0xedff('0x20')],function(_0x5db980){return{'model':db[_0x5db980[_0xedff('0x21')]],'as':_0x5db980['as'],'attributes':_0x5db980['attributes'],'include':_0x5db980['include']?_['map'](_0x5db980[_0xedff('0x20')],function(_0x811ec){return{'model':db[_0x811ec['model']],'as':_0x811ec['as'],'attributes':_0x811ec[_0xedff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xedff('0xc')](function(_0x2ded75){logger['info'](_0xedff('0x23'),_0xb070f);logger[_0xedff('0x10')](_0xedff('0x23'),_0xb070f,JSON['stringify'](_0x2ded75));_0x23bb76(_0x2ded75);})[_0xedff('0x17')](function(_0x1fd7ff){logger['error'](_0xedff('0x23'),_0x1fd7ff[_0xedff('0x15')],_0xb070f);_0x21e3fa(_0x1befd0['error'](0x1f4,_0x1fd7ff[_0xedff('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 060b5a8..49ce807 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 _0x3190=['/:id/tags','setTags','put','/:id','update','multer','path','connect-timeout','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getTags','post'];(function(_0x292150,_0x23c46f){var _0x2b827e=function(_0x44ffcd){while(--_0x44ffcd){_0x292150['push'](_0x292150['shift']());}};_0x2b827e(++_0x23c46f);}(_0x3190,0xcb));var _0x0319=function(_0x2c2f77,_0x2abde0){_0x2c2f77=_0x2c2f77-0x0;var _0x574204=_0x3190[_0x2c2f77];return _0x574204;};'use strict';var multer=require(_0x0319('0x0'));var util=require('util');var path=require(_0x0319('0x1'));var timeout=require(_0x0319('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0319('0x3'));var auth=require(_0x0319('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0319('0x5'));router[_0x0319('0x6')]('/',auth[_0x0319('0x7')](),controller[_0x0319('0x8')]);router['get']('/:id',auth[_0x0319('0x7')](),controller[_0x0319('0x9')]);router['get'](_0x0319('0xa'),auth[_0x0319('0x7')](),controller['getFields']);router[_0x0319('0x6')]('/:id/subjects',auth[_0x0319('0x7')](),controller['getSubjects']);router[_0x0319('0x6')]('/:id/descriptions',auth[_0x0319('0x7')](),controller['getDescriptions']);router[_0x0319('0x6')]('/:id/tags',auth[_0x0319('0x7')](),controller[_0x0319('0xb')]);router[_0x0319('0xc')]('/',auth[_0x0319('0x7')](),controller['create']);router[_0x0319('0xc')](_0x0319('0xd'),auth['isAuthenticated'](),controller[_0x0319('0xe')]);router[_0x0319('0xf')](_0x0319('0x10'),auth[_0x0319('0x7')](),controller[_0x0319('0x11')]);router['delete']('/:id',auth[_0x0319('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19b0=['setTags','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/tags','getTags','post'];(function(_0x488224,_0x1d8f47){var _0x51ee0a=function(_0xdae9c){while(--_0xdae9c){_0x488224['push'](_0x488224['shift']());}};_0x51ee0a(++_0x1d8f47);}(_0x19b0,0x1bc));var _0x019b=function(_0xd01dde,_0x2d4dc8){_0xd01dde=_0xd01dde-0x0;var _0x45725c=_0x19b0[_0xd01dde];return _0x45725c;};'use strict';var multer=require(_0x019b('0x0'));var util=require(_0x019b('0x1'));var path=require('path');var timeout=require(_0x019b('0x2'));var express=require('express');var router=express[_0x019b('0x3')]();var fs_extra=require(_0x019b('0x4'));var auth=require(_0x019b('0x5'));var interaction=require(_0x019b('0x6'));var config=require(_0x019b('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x019b('0x8')]('/',auth[_0x019b('0x9')](),controller['index']);router['get'](_0x019b('0xa'),auth[_0x019b('0x9')](),controller[_0x019b('0xb')]);router[_0x019b('0x8')](_0x019b('0xc'),auth[_0x019b('0x9')](),controller[_0x019b('0xd')]);router[_0x019b('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x019b('0xe')]);router[_0x019b('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x019b('0x8')](_0x019b('0xf'),auth[_0x019b('0x9')](),controller[_0x019b('0x10')]);router[_0x019b('0x11')]('/',auth[_0x019b('0x9')](),controller['create']);router[_0x019b('0x11')](_0x019b('0xf'),auth[_0x019b('0x9')](),controller[_0x019b('0x12')]);router[_0x019b('0x13')](_0x019b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x019b('0xa'),auth[_0x019b('0x9')](),controller[_0x019b('0x14')]);module[_0x019b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d0a75c7..5228007 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 _0xafe6=['sequelize','STRING'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0xafe6,0xf0));var _0x6afe=function(_0x102cec,_0x25e0f6){_0x102cec=_0x102cec-0x0;var _0x4a4670=_0xafe6[_0x102cec];return _0x4a4670;};'use strict';var Sequelize=require(_0x6afe('0x0'));module['exports']={'name':{'type':Sequelize[_0x6afe('0x1')]},'description':{'type':Sequelize[_0x6afe('0x1')]}}; \ No newline at end of file +var _0x811e=['exports','STRING','sequelize'];(function(_0x5e465a,_0x3e0f32){var _0x52c7db=function(_0x2c9dea){while(--_0x2c9dea){_0x5e465a['push'](_0x5e465a['shift']());}};_0x52c7db(++_0x3e0f32);}(_0x811e,0x1f1));var _0xe811=function(_0x37810f,_0x1e41b4){_0x37810f=_0x37810f-0x0;var _0x2ff1b5=_0x811e[_0x37810f];return _0x2ff1b5;};'use strict';var Sequelize=require(_0xe811('0x0'));module[_0xe811('0x1')]={'name':{'type':Sequelize[_0xe811('0x2')]},'description':{'type':Sequelize[_0xe811('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 9c9f8dc..ee91064 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 _0x57be=['rows','catch','show','params','includeAll','include','create','body','find','destroy','getFields','FreshdeskField','pick','findOne','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count'];(function(_0x25647f,_0xd9af7a){var _0x3ad60e=function(_0x3d5b10){while(--_0x3d5b10){_0x25647f['push'](_0x25647f['shift']());}};_0x3ad60e(++_0xd9af7a);}(_0x57be,0x67));var _0xe57b=function(_0x5d1dda,_0x28f324){_0x5d1dda=_0x5d1dda-0x0;var _0x54b6a5=_0x57be[_0x5d1dda];return _0x54b6a5;};'use strict';var emlformat=require(_0xe57b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe57b('0x1'));var rp=require(_0xe57b('0x2'));var moment=require('moment');var BPromise=require(_0xe57b('0x3'));var Mustache=require('mustache');var util=require(_0xe57b('0x4'));var path=require(_0xe57b('0x5'));var sox=require(_0xe57b('0x6'));var csv=require(_0xe57b('0x7'));var ejs=require(_0xe57b('0x8'));var fs=require('fs');var fs_extra=require(_0xe57b('0x9'));var _=require('lodash');var squel=require(_0xe57b('0xa'));var crypto=require(_0xe57b('0xb'));var jsforce=require(_0xe57b('0xc'));var deskjs=require(_0xe57b('0xd'));var toCsv=require(_0xe57b('0x7'));var querystring=require(_0xe57b('0xe'));var Papa=require(_0xe57b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe57b('0x10'));var logger=require('../../config/logger')(_0xe57b('0x11'));var utils=require('../../config/utils');var config=require(_0xe57b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe57b('0x13'))['db'];function respondWithStatusCode(_0x19e2e8,_0x67a319){_0x67a319=_0x67a319||0xcc;return function(_0x4cdda3){if(_0x4cdda3){return _0x19e2e8[_0xe57b('0x14')](_0x67a319);}return _0x19e2e8[_0xe57b('0x15')](_0x67a319)[_0xe57b('0x16')]();};}function respondWithResult(_0x5b28e4,_0x146512){_0x146512=_0x146512||0xc8;return function(_0x257257){if(_0x257257){return _0x5b28e4[_0xe57b('0x15')](_0x146512)[_0xe57b('0x17')](_0x257257);}};}function respondWithFilteredResult(_0x32a3ec,_0x162ab2){return function(_0x3a4398){if(_0x3a4398){var _0xff668=typeof _0x162ab2[_0xe57b('0x18')]===_0xe57b('0x19')&&typeof _0x162ab2[_0xe57b('0x1a')]==='undefined';var _0x1ae5f1=_0x3a4398['count'];var _0x3f9047=_0xff668?0x0:_0x162ab2['offset'];var _0x328f49=_0xff668?_0x3a4398['count']:_0x162ab2[_0xe57b('0x18')]+_0x162ab2['limit'];var _0x45c043;if(_0x328f49>=_0x1ae5f1){_0x328f49=_0x1ae5f1;_0x45c043=0xc8;}else{_0x45c043=0xce;}_0x32a3ec[_0xe57b('0x15')](_0x45c043);return _0x32a3ec[_0xe57b('0x1b')](_0xe57b('0x1c'),_0x3f9047+'-'+_0x328f49+'/'+_0x1ae5f1)['json'](_0x3a4398);}return null;};}function patchUpdates(_0x52f18e){return function(_0x57943f){try{jsonpatch[_0xe57b('0x1d')](_0x57943f,_0x52f18e,!![]);}catch(_0x20f49e){return BPromise[_0xe57b('0x1e')](_0x20f49e);}return _0x57943f[_0xe57b('0x1f')]();};}function saveUpdates(_0x1c3807,_0x48fe51){return function(_0x149f01){if(_0x149f01){return _0x149f01[_0xe57b('0x20')](_0x1c3807)[_0xe57b('0x21')](function(_0x56c481){return _0x56c481;});}return null;};}function removeEntity(_0x414227,_0x57491f){return function(_0x553dfd){if(_0x553dfd){return _0x553dfd['destroy']()[_0xe57b('0x21')](function(){_0x414227['status'](0xcc)[_0xe57b('0x16')]();});}};}function handleEntityNotFound(_0x5ea879,_0x45af9f){return function(_0x45369c){if(!_0x45369c){_0x5ea879[_0xe57b('0x14')](0x194);}return _0x45369c;};}function handleError(_0x547e4b,_0x2f5d5b){_0x2f5d5b=_0x2f5d5b||0x1f4;return function(_0x20ae93){logger[_0xe57b('0x22')](_0x20ae93[_0xe57b('0x23')]);if(_0x20ae93[_0xe57b('0x24')]){delete _0x20ae93[_0xe57b('0x24')];}_0x547e4b[_0xe57b('0x15')](_0x2f5d5b)[_0xe57b('0x25')](_0x20ae93);};}exports[_0xe57b('0x26')]=function(_0x30aaa3,_0x2f224d){var _0x5e9bd={},_0x5cf03d={},_0x4c1af7={'count':0x0,'rows':[]};var _0x29041b=_[_0xe57b('0x27')](db[_0xe57b('0x28')][_0xe57b('0x29')],function(_0x441b70){return{'name':_0x441b70[_0xe57b('0x2a')],'type':_0x441b70['type'][_0xe57b('0x2b')]};});_0x5cf03d[_0xe57b('0x2c')]=_['map'](_0x29041b,_0xe57b('0x24'));_0x5cf03d[_0xe57b('0x2d')]=_[_0xe57b('0x2e')](_0x30aaa3[_0xe57b('0x2d')]);_0x5cf03d[_0xe57b('0x2f')]=_[_0xe57b('0x30')](_0x5cf03d[_0xe57b('0x2c')],_0x5cf03d[_0xe57b('0x2d')]);_0x5e9bd[_0xe57b('0x31')]=_['intersection'](_0x5cf03d[_0xe57b('0x2c')],qs[_0xe57b('0x32')](_0x30aaa3[_0xe57b('0x2d')][_0xe57b('0x32')]));_0x5e9bd['attributes']=_0x5e9bd[_0xe57b('0x31')][_0xe57b('0x33')]?_0x5e9bd['attributes']:_0x5cf03d['model'];if(!_0x30aaa3[_0xe57b('0x2d')][_0xe57b('0x34')](_0xe57b('0x35'))){_0x5e9bd[_0xe57b('0x1a')]=qs[_0xe57b('0x1a')](_0x30aaa3['query'][_0xe57b('0x1a')]);_0x5e9bd[_0xe57b('0x18')]=qs['offset'](_0x30aaa3[_0xe57b('0x2d')]['offset']);}_0x5e9bd[_0xe57b('0x36')]=qs[_0xe57b('0x37')](_0x30aaa3[_0xe57b('0x2d')][_0xe57b('0x37')]);_0x5e9bd[_0xe57b('0x38')]=qs[_0xe57b('0x2f')](_['pick'](_0x30aaa3['query'],_0x5cf03d['filters']),_0x29041b);if(_0x30aaa3['query']['filter']){_0x5e9bd[_0xe57b('0x38')]=_[_0xe57b('0x39')](_0x5e9bd[_0xe57b('0x38')],{'$or':_['map'](_0x29041b,function(_0x59bc91){if(_0x59bc91[_0xe57b('0x3a')]!==_0xe57b('0x3b')){var _0x1479c6={};_0x1479c6[_0x59bc91[_0xe57b('0x24')]]={'$like':'%'+_0x30aaa3[_0xe57b('0x2d')][_0xe57b('0x3c')]+'%'};return _0x1479c6;}})});}_0x5e9bd=_['merge']({},_0x5e9bd,_0x30aaa3[_0xe57b('0x3d')]);var _0x127003={'where':_0x5e9bd[_0xe57b('0x38')]};return db['FreshdeskConfiguration'][_0xe57b('0x3e')](_0x127003)[_0xe57b('0x21')](function(_0x3aa958){_0x4c1af7[_0xe57b('0x3e')]=_0x3aa958;if(_0x30aaa3[_0xe57b('0x2d')]['includeAll']){_0x5e9bd['include']=[{'all':!![]}];}return db[_0xe57b('0x28')]['findAll'](_0x5e9bd);})[_0xe57b('0x21')](function(_0x107c80){_0x4c1af7[_0xe57b('0x3f')]=_0x107c80;return _0x4c1af7;})[_0xe57b('0x21')](respondWithFilteredResult(_0x2f224d,_0x5e9bd))[_0xe57b('0x40')](handleError(_0x2f224d,null));};exports[_0xe57b('0x41')]=function(_0x196cca,_0x580532){var _0x514da4={'raw':![],'where':{'id':_0x196cca[_0xe57b('0x42')]['id']}},_0x1df730={};_0x1df730[_0xe57b('0x2c')]=_[_0xe57b('0x2e')](db[_0xe57b('0x28')][_0xe57b('0x29')]);_0x1df730[_0xe57b('0x2d')]=_[_0xe57b('0x2e')](_0x196cca['query']);_0x1df730['filters']=_[_0xe57b('0x30')](_0x1df730[_0xe57b('0x2c')],_0x1df730[_0xe57b('0x2d')]);_0x514da4[_0xe57b('0x31')]=_[_0xe57b('0x30')](_0x1df730[_0xe57b('0x2c')],qs[_0xe57b('0x32')](_0x196cca[_0xe57b('0x2d')][_0xe57b('0x32')]));_0x514da4['attributes']=_0x514da4['attributes'][_0xe57b('0x33')]?_0x514da4[_0xe57b('0x31')]:_0x1df730[_0xe57b('0x2c')];if(_0x196cca[_0xe57b('0x2d')][_0xe57b('0x43')]){_0x514da4[_0xe57b('0x44')]=[{'all':!![]}];}_0x514da4=_[_0xe57b('0x39')]({},_0x514da4,_0x196cca['options']);return db[_0xe57b('0x28')]['find'](_0x514da4)['then'](handleEntityNotFound(_0x580532,null))[_0xe57b('0x21')](respondWithResult(_0x580532,null))[_0xe57b('0x40')](handleError(_0x580532,null));};exports[_0xe57b('0x45')]=function(_0x27306a,_0x42b90b){return db['FreshdeskConfiguration'][_0xe57b('0x45')](_0x27306a[_0xe57b('0x46')],{})['then'](respondWithResult(_0x42b90b,0xc9))[_0xe57b('0x40')](handleError(_0x42b90b,null));};exports[_0xe57b('0x20')]=function(_0x4eee09,_0x5a6f1e){if(_0x4eee09[_0xe57b('0x46')]['id']){delete _0x4eee09[_0xe57b('0x46')]['id'];}return db[_0xe57b('0x28')][_0xe57b('0x47')]({'where':{'id':_0x4eee09[_0xe57b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a6f1e,null))['then'](saveUpdates(_0x4eee09[_0xe57b('0x46')],null))[_0xe57b('0x21')](respondWithResult(_0x5a6f1e,null))[_0xe57b('0x40')](handleError(_0x5a6f1e,null));};exports[_0xe57b('0x48')]=function(_0x4182e8,_0x1baf28){return db[_0xe57b('0x28')][_0xe57b('0x47')]({'where':{'id':_0x4182e8['params']['id']}})['then'](handleEntityNotFound(_0x1baf28,null))[_0xe57b('0x21')](removeEntity(_0x1baf28,null))[_0xe57b('0x40')](handleError(_0x1baf28,null));};exports[_0xe57b('0x49')]=function(_0x5c0103,_0x54aad5,_0xa1f91){var _0x2cca7a={};var _0x381723={};var _0x27fbc9;var _0x21d226;return db[_0xe57b('0x28')]['findOne']({'where':{'id':_0x5c0103[_0xe57b('0x42')]['id']}})[_0xe57b('0x21')](handleEntityNotFound(_0x54aad5,null))['then'](function(_0xd1399e){if(_0xd1399e){_0x27fbc9=_0xd1399e;_0x381723['model']=_[_0xe57b('0x2e')](db[_0xe57b('0x4a')]['rawAttributes']);_0x381723[_0xe57b('0x2d')]=_[_0xe57b('0x2e')](_0x5c0103[_0xe57b('0x2d')]);_0x381723['filters']=_[_0xe57b('0x30')](_0x381723[_0xe57b('0x2c')],_0x381723[_0xe57b('0x2d')]);_0x2cca7a[_0xe57b('0x31')]=_[_0xe57b('0x30')](_0x381723[_0xe57b('0x2c')],qs[_0xe57b('0x32')](_0x5c0103[_0xe57b('0x2d')][_0xe57b('0x32')]));_0x2cca7a[_0xe57b('0x31')]=_0x2cca7a['attributes'][_0xe57b('0x33')]?_0x2cca7a[_0xe57b('0x31')]:_0x381723[_0xe57b('0x2c')];_0x2cca7a['order']=qs['sort'](_0x5c0103[_0xe57b('0x2d')][_0xe57b('0x37')]);_0x2cca7a[_0xe57b('0x38')]=qs['filters'](_[_0xe57b('0x4b')](_0x5c0103['query'],_0x381723[_0xe57b('0x2f')]));if(_0x5c0103[_0xe57b('0x2d')][_0xe57b('0x3c')]){_0x2cca7a['where']=_['merge'](_0x2cca7a[_0xe57b('0x38')],{'$or':_[_0xe57b('0x27')](_0x2cca7a[_0xe57b('0x31')],function(_0x154526){var _0x147fe2={};_0x147fe2[_0x154526]={'$like':'%'+_0x5c0103['query']['filter']+'%'};return _0x147fe2;})});}_0x2cca7a=_['merge']({},_0x2cca7a,_0x5c0103[_0xe57b('0x3d')]);return _0x27fbc9[_0xe57b('0x49')](_0x2cca7a);}})[_0xe57b('0x21')](function(_0x217c59){if(_0x217c59){_0x21d226=_0x217c59['length'];if(!_0x5c0103['query'][_0xe57b('0x34')](_0xe57b('0x35'))){_0x2cca7a['limit']=qs[_0xe57b('0x1a')](_0x5c0103[_0xe57b('0x2d')][_0xe57b('0x1a')]);_0x2cca7a[_0xe57b('0x18')]=qs[_0xe57b('0x18')](_0x5c0103[_0xe57b('0x2d')][_0xe57b('0x18')]);}return _0x27fbc9[_0xe57b('0x49')](_0x2cca7a);}})[_0xe57b('0x21')](function(_0x58fc48){if(_0x58fc48){return _0x58fc48?{'count':_0x21d226,'rows':_0x58fc48}:null;}})['then'](respondWithResult(_0x54aad5,null))[_0xe57b('0x40')](handleError(_0x54aad5,null));};exports['getSubjects']=function(_0xf21413,_0xed9f29,_0x3aee00){var _0xfdb881={};var _0x24e592={};var _0x32001f;var _0x301f72;return db[_0xe57b('0x28')][_0xe57b('0x4c')]({'where':{'id':_0xf21413[_0xe57b('0x42')]['id']}})[_0xe57b('0x21')](handleEntityNotFound(_0xed9f29,null))[_0xe57b('0x21')](function(_0x25d0a7){if(_0x25d0a7){_0x32001f=_0x25d0a7;_0x24e592['model']=_['keys'](db[_0xe57b('0x4a')][_0xe57b('0x29')]);_0x24e592['query']=_['keys'](_0xf21413[_0xe57b('0x2d')]);_0x24e592[_0xe57b('0x2f')]=_[_0xe57b('0x30')](_0x24e592[_0xe57b('0x2c')],_0x24e592['query']);_0xfdb881['attributes']=_['intersection'](_0x24e592['model'],qs[_0xe57b('0x32')](_0xf21413[_0xe57b('0x2d')]['fields']));_0xfdb881[_0xe57b('0x31')]=_0xfdb881[_0xe57b('0x31')]['length']?_0xfdb881[_0xe57b('0x31')]:_0x24e592['model'];_0xfdb881[_0xe57b('0x36')]=qs['sort'](_0xf21413[_0xe57b('0x2d')][_0xe57b('0x37')]);_0xfdb881[_0xe57b('0x38')]=qs[_0xe57b('0x2f')](_[_0xe57b('0x4b')](_0xf21413[_0xe57b('0x2d')],_0x24e592[_0xe57b('0x2f')]));if(_0xf21413['query']['filter']){_0xfdb881['where']=_[_0xe57b('0x39')](_0xfdb881[_0xe57b('0x38')],{'$or':_[_0xe57b('0x27')](_0xfdb881[_0xe57b('0x31')],function(_0x4dc4b3){var _0x797632={};_0x797632[_0x4dc4b3]={'$like':'%'+_0xf21413[_0xe57b('0x2d')][_0xe57b('0x3c')]+'%'};return _0x797632;})});}_0xfdb881=_[_0xe57b('0x39')]({},_0xfdb881,_0xf21413[_0xe57b('0x3d')]);return _0x32001f[_0xe57b('0x4d')](_0xfdb881);}})[_0xe57b('0x21')](function(_0x63006c){if(_0x63006c){_0x301f72=_0x63006c[_0xe57b('0x33')];if(!_0xf21413[_0xe57b('0x2d')][_0xe57b('0x34')](_0xe57b('0x35'))){_0xfdb881[_0xe57b('0x1a')]=qs[_0xe57b('0x1a')](_0xf21413[_0xe57b('0x2d')]['limit']);_0xfdb881[_0xe57b('0x18')]=qs[_0xe57b('0x18')](_0xf21413[_0xe57b('0x2d')][_0xe57b('0x18')]);}return _0x32001f[_0xe57b('0x4d')](_0xfdb881);}})[_0xe57b('0x21')](function(_0x195bae){if(_0x195bae){return _0x195bae?{'count':_0x301f72,'rows':_0x195bae}:null;}})[_0xe57b('0x21')](respondWithResult(_0xed9f29,null))[_0xe57b('0x40')](handleError(_0xed9f29,null));};exports['getDescriptions']=function(_0x3110b4,_0x36df79,_0x282ae5){var _0x487b28={};var _0x5623ce={};var _0x1a4d6d;var _0x149255;return db[_0xe57b('0x28')][_0xe57b('0x4c')]({'where':{'id':_0x3110b4['params']['id']}})[_0xe57b('0x21')](handleEntityNotFound(_0x36df79,null))['then'](function(_0x7fe0da){if(_0x7fe0da){_0x1a4d6d=_0x7fe0da;_0x5623ce[_0xe57b('0x2c')]=_[_0xe57b('0x2e')](db[_0xe57b('0x4a')][_0xe57b('0x29')]);_0x5623ce[_0xe57b('0x2d')]=_[_0xe57b('0x2e')](_0x3110b4[_0xe57b('0x2d')]);_0x5623ce[_0xe57b('0x2f')]=_['intersection'](_0x5623ce['model'],_0x5623ce[_0xe57b('0x2d')]);_0x487b28['attributes']=_[_0xe57b('0x30')](_0x5623ce[_0xe57b('0x2c')],qs[_0xe57b('0x32')](_0x3110b4[_0xe57b('0x2d')][_0xe57b('0x32')]));_0x487b28[_0xe57b('0x31')]=_0x487b28[_0xe57b('0x31')][_0xe57b('0x33')]?_0x487b28[_0xe57b('0x31')]:_0x5623ce[_0xe57b('0x2c')];_0x487b28[_0xe57b('0x36')]=qs[_0xe57b('0x37')](_0x3110b4['query'][_0xe57b('0x37')]);_0x487b28['where']=qs[_0xe57b('0x2f')](_[_0xe57b('0x4b')](_0x3110b4[_0xe57b('0x2d')],_0x5623ce[_0xe57b('0x2f')]));if(_0x3110b4[_0xe57b('0x2d')][_0xe57b('0x3c')]){_0x487b28['where']=_[_0xe57b('0x39')](_0x487b28[_0xe57b('0x38')],{'$or':_[_0xe57b('0x27')](_0x487b28['attributes'],function(_0x52283c){var _0x20228d={};_0x20228d[_0x52283c]={'$like':'%'+_0x3110b4['query'][_0xe57b('0x3c')]+'%'};return _0x20228d;})});}_0x487b28=_[_0xe57b('0x39')]({},_0x487b28,_0x3110b4[_0xe57b('0x3d')]);return _0x1a4d6d[_0xe57b('0x4e')](_0x487b28);}})[_0xe57b('0x21')](function(_0x2017ce){if(_0x2017ce){_0x149255=_0x2017ce[_0xe57b('0x33')];if(!_0x3110b4[_0xe57b('0x2d')]['hasOwnProperty'](_0xe57b('0x35'))){_0x487b28[_0xe57b('0x1a')]=qs['limit'](_0x3110b4[_0xe57b('0x2d')][_0xe57b('0x1a')]);_0x487b28[_0xe57b('0x18')]=qs[_0xe57b('0x18')](_0x3110b4[_0xe57b('0x2d')][_0xe57b('0x18')]);}return _0x1a4d6d[_0xe57b('0x4e')](_0x487b28);}})[_0xe57b('0x21')](function(_0x3ab652){if(_0x3ab652){return _0x3ab652?{'count':_0x149255,'rows':_0x3ab652}:null;}})[_0xe57b('0x21')](respondWithResult(_0x36df79,null))['catch'](handleError(_0x36df79,null));};exports['getTags']=function(_0x40a140,_0xa9370c,_0x13a553){var _0x51f5ab={};var _0x372d8e={};var _0x3509ff;var _0x545757;return db[_0xe57b('0x28')][_0xe57b('0x4c')]({'where':{'id':_0x40a140['params']['id']}})[_0xe57b('0x21')](handleEntityNotFound(_0xa9370c,null))[_0xe57b('0x21')](function(_0x4e578f){if(_0x4e578f){_0x3509ff=_0x4e578f;_0x372d8e[_0xe57b('0x2c')]=_['keys'](db[_0xe57b('0x4f')][_0xe57b('0x29')]);_0x372d8e[_0xe57b('0x2d')]=_[_0xe57b('0x2e')](_0x40a140[_0xe57b('0x2d')]);_0x372d8e[_0xe57b('0x2f')]=_['intersection'](_0x372d8e[_0xe57b('0x2c')],_0x372d8e[_0xe57b('0x2d')]);_0x51f5ab[_0xe57b('0x31')]=_[_0xe57b('0x30')](_0x372d8e['model'],qs[_0xe57b('0x32')](_0x40a140[_0xe57b('0x2d')][_0xe57b('0x32')]));_0x51f5ab['attributes']=_0x51f5ab['attributes'][_0xe57b('0x33')]?_0x51f5ab[_0xe57b('0x31')]:_0x372d8e[_0xe57b('0x2c')];_0x51f5ab[_0xe57b('0x36')]=qs[_0xe57b('0x37')](_0x40a140[_0xe57b('0x2d')][_0xe57b('0x37')]);_0x51f5ab['where']=qs[_0xe57b('0x2f')](_[_0xe57b('0x4b')](_0x40a140['query'],_0x372d8e['filters']));if(_0x40a140['query'][_0xe57b('0x3c')]){_0x51f5ab[_0xe57b('0x38')]=_[_0xe57b('0x39')](_0x51f5ab[_0xe57b('0x38')],{'$or':_[_0xe57b('0x27')](_0x51f5ab['attributes'],function(_0x14c249){var _0x50c5f3={};_0x50c5f3[_0x14c249]={'$like':'%'+_0x40a140['query'][_0xe57b('0x3c')]+'%'};return _0x50c5f3;})});}_0x51f5ab=_[_0xe57b('0x39')]({},_0x51f5ab,_0x40a140['options']);return _0x3509ff[_0xe57b('0x50')](_0x51f5ab);}})['then'](function(_0x2bc4d3){if(_0x2bc4d3){_0x545757=_0x2bc4d3[_0xe57b('0x33')];if(!_0x40a140[_0xe57b('0x2d')][_0xe57b('0x34')](_0xe57b('0x35'))){_0x51f5ab['limit']=qs[_0xe57b('0x1a')](_0x40a140[_0xe57b('0x2d')][_0xe57b('0x1a')]);_0x51f5ab[_0xe57b('0x18')]=qs[_0xe57b('0x18')](_0x40a140[_0xe57b('0x2d')][_0xe57b('0x18')]);}return _0x3509ff[_0xe57b('0x50')](_0x51f5ab);}})[_0xe57b('0x21')](function(_0x5d7772){if(_0x5d7772){return _0x5d7772?{'count':_0x545757,'rows':_0x5d7772}:null;}})[_0xe57b('0x21')](respondWithResult(_0xa9370c,null))[_0xe57b('0x40')](handleError(_0xa9370c,null));};exports[_0xe57b('0x51')]=function(_0x13e38e,_0x2a7762,_0x54946e){if(_0x13e38e['body']['id']){delete _0x13e38e['body']['id'];}return db[_0xe57b('0x28')][_0xe57b('0x4c')]({'where':{'id':_0x13e38e[_0xe57b('0x42')]['id']}})[_0xe57b('0x21')](handleEntityNotFound(_0x2a7762,null))[_0xe57b('0x21')](function(_0x29e735){if(_0x29e735){return _0x29e735[_0xe57b('0x51')](_0x13e38e[_0xe57b('0x46')][_0xe57b('0x52')]||[]);}return null;})[_0xe57b('0x21')](respondWithResult(_0x2a7762,null))[_0xe57b('0x40')](handleError(_0x2a7762,null));}; \ No newline at end of file +var _0x23f8=['keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','findAll','rows','show','rawAttributes','length','include','create','catch','body','params','find','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query'];(function(_0x179738,_0x4d7001){var _0x317d99=function(_0x4c0ff4){while(--_0x4c0ff4){_0x179738['push'](_0x179738['shift']());}};_0x317d99(++_0x4d7001);}(_0x23f8,0x7c));var _0x823f=function(_0xfdac8,_0x4d06cf){_0xfdac8=_0xfdac8-0x0;var _0x3337cf=_0x23f8[_0xfdac8];return _0x3337cf;};'use strict';var emlformat=require(_0x823f('0x0'));var rimraf=require(_0x823f('0x1'));var zipdir=require(_0x823f('0x2'));var jsonpatch=require(_0x823f('0x3'));var rp=require(_0x823f('0x4'));var moment=require(_0x823f('0x5'));var BPromise=require(_0x823f('0x6'));var Mustache=require(_0x823f('0x7'));var util=require(_0x823f('0x8'));var path=require(_0x823f('0x9'));var sox=require(_0x823f('0xa'));var csv=require(_0x823f('0xb'));var ejs=require(_0x823f('0xc'));var fs=require('fs');var fs_extra=require(_0x823f('0xd'));var _=require(_0x823f('0xe'));var squel=require(_0x823f('0xf'));var crypto=require(_0x823f('0x10'));var jsforce=require(_0x823f('0x11'));var deskjs=require(_0x823f('0x12'));var toCsv=require(_0x823f('0xb'));var querystring=require(_0x823f('0x13'));var Papa=require(_0x823f('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x823f('0x15'));var as=require(_0x823f('0x16'));var hardwareService=require(_0x823f('0x17'));var logger=require('../../config/logger')(_0x823f('0x18'));var utils=require(_0x823f('0x19'));var config=require(_0x823f('0x1a'));var licenseUtil=require(_0x823f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5682b2,_0x251bcb){_0x251bcb=_0x251bcb||0xcc;return function(_0x1fd75c){if(_0x1fd75c){return _0x5682b2[_0x823f('0x1c')](_0x251bcb);}return _0x5682b2[_0x823f('0x1d')](_0x251bcb)[_0x823f('0x1e')]();};}function respondWithResult(_0x4388de,_0xa9d0a5){_0xa9d0a5=_0xa9d0a5||0xc8;return function(_0x49a39a){if(_0x49a39a){return _0x4388de[_0x823f('0x1d')](_0xa9d0a5)[_0x823f('0x1f')](_0x49a39a);}};}function respondWithFilteredResult(_0x176022,_0xcec49e){return function(_0x2bf6a1){if(_0x2bf6a1){var _0x462c8e=typeof _0xcec49e[_0x823f('0x20')]==='undefined'&&typeof _0xcec49e[_0x823f('0x21')]==='undefined';var _0x3e176d=_0x2bf6a1[_0x823f('0x22')];var _0x20d7bf=_0x462c8e?0x0:_0xcec49e['offset'];var _0x1168e4=_0x462c8e?_0x2bf6a1[_0x823f('0x22')]:_0xcec49e['offset']+_0xcec49e[_0x823f('0x21')];var _0x304fc4;if(_0x1168e4>=_0x3e176d){_0x1168e4=_0x3e176d;_0x304fc4=0xc8;}else{_0x304fc4=0xce;}_0x176022['status'](_0x304fc4);return _0x176022[_0x823f('0x23')](_0x823f('0x24'),_0x20d7bf+'-'+_0x1168e4+'/'+_0x3e176d)['json'](_0x2bf6a1);}return null;};}function patchUpdates(_0x298bc3){return function(_0x13930){try{jsonpatch[_0x823f('0x25')](_0x13930,_0x298bc3,!![]);}catch(_0x1a4056){return BPromise[_0x823f('0x26')](_0x1a4056);}return _0x13930['save']();};}function saveUpdates(_0x196963,_0x39b427){return function(_0x375553){if(_0x375553){return _0x375553[_0x823f('0x27')](_0x196963)['then'](function(_0x336a7a){return _0x336a7a;});}return null;};}function removeEntity(_0x409d97,_0x5ebd20){return function(_0x27a1a6){if(_0x27a1a6){return _0x27a1a6['destroy']()[_0x823f('0x28')](function(){_0x409d97[_0x823f('0x1d')](0xcc)[_0x823f('0x1e')]();});}};}function handleEntityNotFound(_0x158d89,_0x5f0958){return function(_0x3f6683){if(!_0x3f6683){_0x158d89[_0x823f('0x1c')](0x194);}return _0x3f6683;};}function handleError(_0x23b4e0,_0x3976f4){_0x3976f4=_0x3976f4||0x1f4;return function(_0x4c5aab){logger[_0x823f('0x29')](_0x4c5aab[_0x823f('0x2a')]);if(_0x4c5aab[_0x823f('0x2b')]){delete _0x4c5aab[_0x823f('0x2b')];}_0x23b4e0[_0x823f('0x1d')](_0x3976f4)[_0x823f('0x2c')](_0x4c5aab);};}exports[_0x823f('0x2d')]=function(_0x4440cb,_0x3cba87){var _0x42fefb={},_0x4a67fb={},_0x3244be={'count':0x0,'rows':[]};var _0x93e956=_[_0x823f('0x2e')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x26f85e){return{'name':_0x26f85e[_0x823f('0x2f')],'type':_0x26f85e[_0x823f('0x30')][_0x823f('0x31')]};});_0x4a67fb[_0x823f('0x32')]=_[_0x823f('0x2e')](_0x93e956,_0x823f('0x2b'));_0x4a67fb[_0x823f('0x33')]=_[_0x823f('0x34')](_0x4440cb[_0x823f('0x33')]);_0x4a67fb[_0x823f('0x35')]=_['intersection'](_0x4a67fb[_0x823f('0x32')],_0x4a67fb['query']);_0x42fefb['attributes']=_[_0x823f('0x36')](_0x4a67fb['model'],qs[_0x823f('0x37')](_0x4440cb['query'][_0x823f('0x37')]));_0x42fefb[_0x823f('0x38')]=_0x42fefb[_0x823f('0x38')]['length']?_0x42fefb[_0x823f('0x38')]:_0x4a67fb[_0x823f('0x32')];if(!_0x4440cb[_0x823f('0x33')][_0x823f('0x39')]('nolimit')){_0x42fefb['limit']=qs['limit'](_0x4440cb[_0x823f('0x33')][_0x823f('0x21')]);_0x42fefb['offset']=qs[_0x823f('0x20')](_0x4440cb[_0x823f('0x33')][_0x823f('0x20')]);}_0x42fefb[_0x823f('0x3a')]=qs[_0x823f('0x3b')](_0x4440cb['query']['sort']);_0x42fefb[_0x823f('0x3c')]=qs[_0x823f('0x35')](_['pick'](_0x4440cb[_0x823f('0x33')],_0x4a67fb['filters']),_0x93e956);if(_0x4440cb[_0x823f('0x33')][_0x823f('0x3d')]){_0x42fefb[_0x823f('0x3c')]=_[_0x823f('0x3e')](_0x42fefb[_0x823f('0x3c')],{'$or':_['map'](_0x93e956,function(_0x320e0c){if(_0x320e0c[_0x823f('0x30')]!==_0x823f('0x3f')){var _0x309029={};_0x309029[_0x320e0c['name']]={'$like':'%'+_0x4440cb[_0x823f('0x33')][_0x823f('0x3d')]+'%'};return _0x309029;}})});}_0x42fefb=_['merge']({},_0x42fefb,_0x4440cb[_0x823f('0x40')]);var _0x5a2a67={'where':_0x42fefb['where']};return db[_0x823f('0x41')][_0x823f('0x22')](_0x5a2a67)[_0x823f('0x28')](function(_0x1a2613){_0x3244be[_0x823f('0x22')]=_0x1a2613;if(_0x4440cb[_0x823f('0x33')][_0x823f('0x42')]){_0x42fefb['include']=[{'all':!![]}];}return db[_0x823f('0x41')][_0x823f('0x43')](_0x42fefb);})[_0x823f('0x28')](function(_0x17d830){_0x3244be[_0x823f('0x44')]=_0x17d830;return _0x3244be;})['then'](respondWithFilteredResult(_0x3cba87,_0x42fefb))['catch'](handleError(_0x3cba87,null));};exports[_0x823f('0x45')]=function(_0x4eeeb5,_0x10380e){var _0x28b255={'raw':![],'where':{'id':_0x4eeeb5['params']['id']}},_0x41d6f7={};_0x41d6f7['model']=_[_0x823f('0x34')](db[_0x823f('0x41')][_0x823f('0x46')]);_0x41d6f7['query']=_[_0x823f('0x34')](_0x4eeeb5['query']);_0x41d6f7['filters']=_[_0x823f('0x36')](_0x41d6f7['model'],_0x41d6f7[_0x823f('0x33')]);_0x28b255['attributes']=_[_0x823f('0x36')](_0x41d6f7[_0x823f('0x32')],qs[_0x823f('0x37')](_0x4eeeb5[_0x823f('0x33')][_0x823f('0x37')]));_0x28b255[_0x823f('0x38')]=_0x28b255['attributes'][_0x823f('0x47')]?_0x28b255[_0x823f('0x38')]:_0x41d6f7[_0x823f('0x32')];if(_0x4eeeb5[_0x823f('0x33')][_0x823f('0x42')]){_0x28b255[_0x823f('0x48')]=[{'all':!![]}];}_0x28b255=_[_0x823f('0x3e')]({},_0x28b255,_0x4eeeb5[_0x823f('0x40')]);return db[_0x823f('0x41')]['find'](_0x28b255)[_0x823f('0x28')](handleEntityNotFound(_0x10380e,null))['then'](respondWithResult(_0x10380e,null))['catch'](handleError(_0x10380e,null));};exports[_0x823f('0x49')]=function(_0x2d554b,_0x17d7c2){return db[_0x823f('0x41')][_0x823f('0x49')](_0x2d554b['body'],{})[_0x823f('0x28')](respondWithResult(_0x17d7c2,0xc9))[_0x823f('0x4a')](handleError(_0x17d7c2,null));};exports[_0x823f('0x27')]=function(_0x1b6feb,_0xc80333){if(_0x1b6feb[_0x823f('0x4b')]['id']){delete _0x1b6feb[_0x823f('0x4b')]['id'];}return db[_0x823f('0x41')]['find']({'where':{'id':_0x1b6feb[_0x823f('0x4c')]['id']}})[_0x823f('0x28')](handleEntityNotFound(_0xc80333,null))[_0x823f('0x28')](saveUpdates(_0x1b6feb[_0x823f('0x4b')],null))[_0x823f('0x28')](respondWithResult(_0xc80333,null))['catch'](handleError(_0xc80333,null));};exports['destroy']=function(_0xa292ec,_0x969555){return db[_0x823f('0x41')][_0x823f('0x4d')]({'where':{'id':_0xa292ec[_0x823f('0x4c')]['id']}})[_0x823f('0x28')](handleEntityNotFound(_0x969555,null))[_0x823f('0x28')](removeEntity(_0x969555,null))[_0x823f('0x4a')](handleError(_0x969555,null));};exports[_0x823f('0x4e')]=function(_0x280f4d,_0x331aa9,_0x10f73c){var _0xffe36a={};var _0x27c568={};var _0x5e6358;var _0x491c28;return db[_0x823f('0x41')][_0x823f('0x4f')]({'where':{'id':_0x280f4d[_0x823f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x331aa9,null))[_0x823f('0x28')](function(_0x5c56d7){if(_0x5c56d7){_0x5e6358=_0x5c56d7;_0x27c568[_0x823f('0x32')]=_[_0x823f('0x34')](db[_0x823f('0x50')][_0x823f('0x46')]);_0x27c568[_0x823f('0x33')]=_[_0x823f('0x34')](_0x280f4d[_0x823f('0x33')]);_0x27c568[_0x823f('0x35')]=_[_0x823f('0x36')](_0x27c568[_0x823f('0x32')],_0x27c568[_0x823f('0x33')]);_0xffe36a[_0x823f('0x38')]=_[_0x823f('0x36')](_0x27c568[_0x823f('0x32')],qs['fields'](_0x280f4d[_0x823f('0x33')][_0x823f('0x37')]));_0xffe36a[_0x823f('0x38')]=_0xffe36a[_0x823f('0x38')][_0x823f('0x47')]?_0xffe36a['attributes']:_0x27c568[_0x823f('0x32')];_0xffe36a[_0x823f('0x3a')]=qs['sort'](_0x280f4d[_0x823f('0x33')][_0x823f('0x3b')]);_0xffe36a[_0x823f('0x3c')]=qs[_0x823f('0x35')](_[_0x823f('0x51')](_0x280f4d[_0x823f('0x33')],_0x27c568[_0x823f('0x35')]));if(_0x280f4d[_0x823f('0x33')][_0x823f('0x3d')]){_0xffe36a[_0x823f('0x3c')]=_[_0x823f('0x3e')](_0xffe36a['where'],{'$or':_['map'](_0xffe36a['attributes'],function(_0x25d886){var _0xa72633={};_0xa72633[_0x25d886]={'$like':'%'+_0x280f4d['query'][_0x823f('0x3d')]+'%'};return _0xa72633;})});}_0xffe36a=_[_0x823f('0x3e')]({},_0xffe36a,_0x280f4d[_0x823f('0x40')]);return _0x5e6358[_0x823f('0x4e')](_0xffe36a);}})['then'](function(_0x329669){if(_0x329669){_0x491c28=_0x329669['length'];if(!_0x280f4d[_0x823f('0x33')]['hasOwnProperty'](_0x823f('0x52'))){_0xffe36a['limit']=qs[_0x823f('0x21')](_0x280f4d[_0x823f('0x33')][_0x823f('0x21')]);_0xffe36a[_0x823f('0x20')]=qs[_0x823f('0x20')](_0x280f4d[_0x823f('0x33')]['offset']);}return _0x5e6358[_0x823f('0x4e')](_0xffe36a);}})[_0x823f('0x28')](function(_0x33022c){if(_0x33022c){return _0x33022c?{'count':_0x491c28,'rows':_0x33022c}:null;}})[_0x823f('0x28')](respondWithResult(_0x331aa9,null))[_0x823f('0x4a')](handleError(_0x331aa9,null));};exports[_0x823f('0x53')]=function(_0x93514c,_0x4177eb,_0x568696){var _0x4496fd={};var _0x497ec0={};var _0x388a7f;var _0x49c27d;return db['FreshdeskConfiguration'][_0x823f('0x4f')]({'where':{'id':_0x93514c['params']['id']}})[_0x823f('0x28')](handleEntityNotFound(_0x4177eb,null))[_0x823f('0x28')](function(_0x5dec41){if(_0x5dec41){_0x388a7f=_0x5dec41;_0x497ec0[_0x823f('0x32')]=_[_0x823f('0x34')](db[_0x823f('0x50')][_0x823f('0x46')]);_0x497ec0['query']=_['keys'](_0x93514c[_0x823f('0x33')]);_0x497ec0['filters']=_['intersection'](_0x497ec0['model'],_0x497ec0[_0x823f('0x33')]);_0x4496fd['attributes']=_['intersection'](_0x497ec0[_0x823f('0x32')],qs[_0x823f('0x37')](_0x93514c[_0x823f('0x33')][_0x823f('0x37')]));_0x4496fd[_0x823f('0x38')]=_0x4496fd[_0x823f('0x38')]['length']?_0x4496fd[_0x823f('0x38')]:_0x497ec0[_0x823f('0x32')];_0x4496fd[_0x823f('0x3a')]=qs[_0x823f('0x3b')](_0x93514c[_0x823f('0x33')][_0x823f('0x3b')]);_0x4496fd[_0x823f('0x3c')]=qs[_0x823f('0x35')](_[_0x823f('0x51')](_0x93514c[_0x823f('0x33')],_0x497ec0[_0x823f('0x35')]));if(_0x93514c[_0x823f('0x33')]['filter']){_0x4496fd[_0x823f('0x3c')]=_[_0x823f('0x3e')](_0x4496fd['where'],{'$or':_['map'](_0x4496fd['attributes'],function(_0xf945fb){var _0x458817={};_0x458817[_0xf945fb]={'$like':'%'+_0x93514c[_0x823f('0x33')][_0x823f('0x3d')]+'%'};return _0x458817;})});}_0x4496fd=_['merge']({},_0x4496fd,_0x93514c[_0x823f('0x40')]);return _0x388a7f[_0x823f('0x53')](_0x4496fd);}})[_0x823f('0x28')](function(_0x519af6){if(_0x519af6){_0x49c27d=_0x519af6[_0x823f('0x47')];if(!_0x93514c[_0x823f('0x33')][_0x823f('0x39')](_0x823f('0x52'))){_0x4496fd[_0x823f('0x21')]=qs['limit'](_0x93514c['query'][_0x823f('0x21')]);_0x4496fd[_0x823f('0x20')]=qs[_0x823f('0x20')](_0x93514c[_0x823f('0x33')][_0x823f('0x20')]);}return _0x388a7f[_0x823f('0x53')](_0x4496fd);}})['then'](function(_0x25302e){if(_0x25302e){return _0x25302e?{'count':_0x49c27d,'rows':_0x25302e}:null;}})[_0x823f('0x28')](respondWithResult(_0x4177eb,null))[_0x823f('0x4a')](handleError(_0x4177eb,null));};exports['getDescriptions']=function(_0x1ce57e,_0x3e46d9,_0x23bb28){var _0xabf9bc={};var _0x1fa2bb={};var _0x191715;var _0x285684;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1ce57e[_0x823f('0x4c')]['id']}})[_0x823f('0x28')](handleEntityNotFound(_0x3e46d9,null))[_0x823f('0x28')](function(_0x40d4e5){if(_0x40d4e5){_0x191715=_0x40d4e5;_0x1fa2bb['model']=_['keys'](db[_0x823f('0x50')][_0x823f('0x46')]);_0x1fa2bb[_0x823f('0x33')]=_[_0x823f('0x34')](_0x1ce57e[_0x823f('0x33')]);_0x1fa2bb[_0x823f('0x35')]=_['intersection'](_0x1fa2bb[_0x823f('0x32')],_0x1fa2bb['query']);_0xabf9bc[_0x823f('0x38')]=_[_0x823f('0x36')](_0x1fa2bb[_0x823f('0x32')],qs[_0x823f('0x37')](_0x1ce57e['query'][_0x823f('0x37')]));_0xabf9bc[_0x823f('0x38')]=_0xabf9bc['attributes'][_0x823f('0x47')]?_0xabf9bc[_0x823f('0x38')]:_0x1fa2bb['model'];_0xabf9bc['order']=qs[_0x823f('0x3b')](_0x1ce57e['query'][_0x823f('0x3b')]);_0xabf9bc[_0x823f('0x3c')]=qs[_0x823f('0x35')](_[_0x823f('0x51')](_0x1ce57e['query'],_0x1fa2bb['filters']));if(_0x1ce57e[_0x823f('0x33')][_0x823f('0x3d')]){_0xabf9bc['where']=_[_0x823f('0x3e')](_0xabf9bc['where'],{'$or':_[_0x823f('0x2e')](_0xabf9bc['attributes'],function(_0x311942){var _0x61e1a3={};_0x61e1a3[_0x311942]={'$like':'%'+_0x1ce57e[_0x823f('0x33')][_0x823f('0x3d')]+'%'};return _0x61e1a3;})});}_0xabf9bc=_[_0x823f('0x3e')]({},_0xabf9bc,_0x1ce57e['options']);return _0x191715[_0x823f('0x54')](_0xabf9bc);}})[_0x823f('0x28')](function(_0x15922d){if(_0x15922d){_0x285684=_0x15922d['length'];if(!_0x1ce57e[_0x823f('0x33')][_0x823f('0x39')](_0x823f('0x52'))){_0xabf9bc[_0x823f('0x21')]=qs[_0x823f('0x21')](_0x1ce57e['query']['limit']);_0xabf9bc[_0x823f('0x20')]=qs['offset'](_0x1ce57e[_0x823f('0x33')][_0x823f('0x20')]);}return _0x191715[_0x823f('0x54')](_0xabf9bc);}})['then'](function(_0x336610){if(_0x336610){return _0x336610?{'count':_0x285684,'rows':_0x336610}:null;}})['then'](respondWithResult(_0x3e46d9,null))[_0x823f('0x4a')](handleError(_0x3e46d9,null));};exports[_0x823f('0x55')]=function(_0x92666b,_0x3499ea,_0x441310){var _0x2117cd={};var _0x256f9a={};var _0x53535a;var _0x6389a1;return db[_0x823f('0x41')][_0x823f('0x4f')]({'where':{'id':_0x92666b[_0x823f('0x4c')]['id']}})[_0x823f('0x28')](handleEntityNotFound(_0x3499ea,null))['then'](function(_0x51f34a){if(_0x51f34a){_0x53535a=_0x51f34a;_0x256f9a[_0x823f('0x32')]=_[_0x823f('0x34')](db['Tag'][_0x823f('0x46')]);_0x256f9a[_0x823f('0x33')]=_[_0x823f('0x34')](_0x92666b[_0x823f('0x33')]);_0x256f9a[_0x823f('0x35')]=_[_0x823f('0x36')](_0x256f9a[_0x823f('0x32')],_0x256f9a[_0x823f('0x33')]);_0x2117cd[_0x823f('0x38')]=_['intersection'](_0x256f9a['model'],qs[_0x823f('0x37')](_0x92666b[_0x823f('0x33')][_0x823f('0x37')]));_0x2117cd[_0x823f('0x38')]=_0x2117cd[_0x823f('0x38')][_0x823f('0x47')]?_0x2117cd[_0x823f('0x38')]:_0x256f9a[_0x823f('0x32')];_0x2117cd[_0x823f('0x3a')]=qs[_0x823f('0x3b')](_0x92666b[_0x823f('0x33')][_0x823f('0x3b')]);_0x2117cd[_0x823f('0x3c')]=qs[_0x823f('0x35')](_[_0x823f('0x51')](_0x92666b['query'],_0x256f9a[_0x823f('0x35')]));if(_0x92666b['query'][_0x823f('0x3d')]){_0x2117cd[_0x823f('0x3c')]=_[_0x823f('0x3e')](_0x2117cd[_0x823f('0x3c')],{'$or':_[_0x823f('0x2e')](_0x2117cd[_0x823f('0x38')],function(_0x4bb9e4){var _0xa9778a={};_0xa9778a[_0x4bb9e4]={'$like':'%'+_0x92666b[_0x823f('0x33')][_0x823f('0x3d')]+'%'};return _0xa9778a;})});}_0x2117cd=_['merge']({},_0x2117cd,_0x92666b['options']);return _0x53535a[_0x823f('0x55')](_0x2117cd);}})[_0x823f('0x28')](function(_0x1a552a){if(_0x1a552a){_0x6389a1=_0x1a552a['length'];if(!_0x92666b[_0x823f('0x33')][_0x823f('0x39')]('nolimit')){_0x2117cd['limit']=qs[_0x823f('0x21')](_0x92666b[_0x823f('0x33')][_0x823f('0x21')]);_0x2117cd['offset']=qs['offset'](_0x92666b[_0x823f('0x33')]['offset']);}return _0x53535a[_0x823f('0x55')](_0x2117cd);}})[_0x823f('0x28')](function(_0x4bf492){if(_0x4bf492){return _0x4bf492?{'count':_0x6389a1,'rows':_0x4bf492}:null;}})[_0x823f('0x28')](respondWithResult(_0x3499ea,null))[_0x823f('0x4a')](handleError(_0x3499ea,null));};exports['setTags']=function(_0x409298,_0x1afcc0,_0x47562a){if(_0x409298[_0x823f('0x4b')]['id']){delete _0x409298[_0x823f('0x4b')]['id'];}return db[_0x823f('0x41')][_0x823f('0x4f')]({'where':{'id':_0x409298[_0x823f('0x4c')]['id']}})[_0x823f('0x28')](handleEntityNotFound(_0x1afcc0,null))[_0x823f('0x28')](function(_0x3f2399){if(_0x3f2399){return _0x3f2399[_0x823f('0x56')](_0x409298['body'][_0x823f('0x57')]||[]);}return null;})[_0x823f('0x28')](respondWithResult(_0x1afcc0,null))[_0x823f('0x4a')](handleError(_0x1afcc0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index dcc5724..2adfc47 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 _0x6bd4=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x6bd4,0x11d));var _0x46bd=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6bd4[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x46bd('0x0'));var logger=require(_0x46bd('0x1'))(_0x46bd('0x2'));var moment=require(_0x46bd('0x3'));var BPromise=require(_0x46bd('0x4'));var rp=require(_0x46bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46bd('0x6'));var config=require(_0x46bd('0x7'));var attributes=require(_0x46bd('0x8'));module['exports']=function(_0x3964ce,_0x1d8b3c){return _0x3964ce[_0x46bd('0x9')](_0x46bd('0xa'),attributes,{'tableName':_0x46bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b1=['exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x1db72b,_0x40ae19){var _0x480134=function(_0x229109){while(--_0x229109){_0x1db72b['push'](_0x1db72b['shift']());}};_0x480134(++_0x40ae19);}(_0xf5b1,0x12f));var _0x1f5b=function(_0x36c19e,_0x2c4b02){_0x36c19e=_0x36c19e-0x0;var _0x5b9503=_0xf5b1[_0x36c19e];return _0x5b9503;};'use strict';var _=require(_0x1f5b('0x0'));var util=require('util');var logger=require(_0x1f5b('0x1'))(_0x1f5b('0x2'));var moment=require(_0x1f5b('0x3'));var BPromise=require(_0x1f5b('0x4'));var rp=require(_0x1f5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f5b('0x6'));var config=require(_0x1f5b('0x7'));var attributes=require(_0x1f5b('0x8'));module[_0x1f5b('0x9')]=function(_0x37342f,_0x3cf477){return _0x37342f['define'](_0x1f5b('0xa'),attributes,{'tableName':_0x1f5b('0xb'),'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 87d214d..f330e23 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 _0xb309=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x44e4af,_0xc77cfb){var _0x288203=function(_0x51a210){while(--_0x51a210){_0x44e4af['push'](_0x44e4af['shift']());}};_0x288203(++_0xc77cfb);}(_0xb309,0x6e));var _0x9b30=function(_0x30d618,_0x590668){_0x30d618=_0x30d618-0x0;var _0x39731a=_0xb309[_0x30d618];return _0x39731a;};'use strict';var _=require(_0x9b30('0x0'));var util=require(_0x9b30('0x1'));var moment=require(_0x9b30('0x2'));var BPromise=require(_0x9b30('0x3'));var rs=require(_0x9b30('0x4'));var fs=require('fs');var Redis=require(_0x9b30('0x5'));var db=require(_0x9b30('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9b30('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9b30('0x8')][_0x9b30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29603e,_0x49fc4c,_0x5c503a){return new BPromise(function(_0x3aa2ed,_0x3d2484){return client[_0x9b30('0xa')](_0x29603e,_0x5c503a)[_0x9b30('0xb')](function(_0x3f0cdd){logger[_0x9b30('0xc')](_0x9b30('0xd'),_0x49fc4c,_0x9b30('0xe'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x49fc4c,_0x9b30('0xe'),JSON[_0x9b30('0xf')](_0x3f0cdd));if(_0x3f0cdd[_0x9b30('0x10')]){if(_0x3f0cdd[_0x9b30('0x10')][_0x9b30('0x11')]===0x1f4){logger[_0x9b30('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x49fc4c,_0x3f0cdd[_0x9b30('0x10')][_0x9b30('0x12')]);return _0x3d2484(_0x3f0cdd[_0x9b30('0x10')]['message']);}logger[_0x9b30('0x10')](_0x9b30('0xd'),_0x49fc4c,_0x3f0cdd[_0x9b30('0x10')][_0x9b30('0x12')]);return _0x3aa2ed(_0x3f0cdd[_0x9b30('0x10')][_0x9b30('0x12')]);}else{logger['info'](_0x9b30('0xd'),_0x49fc4c,_0x9b30('0xe'));_0x3aa2ed(_0x3f0cdd[_0x9b30('0x13')][_0x9b30('0x12')]);}})[_0x9b30('0x14')](function(_0x18a279){logger[_0x9b30('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x49fc4c,_0x18a279);_0x3d2484(_0x18a279);});});} \ No newline at end of file +var _0x72b9=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x388b2b,_0x4bcdfb){var _0x491672=function(_0x2fcccd){while(--_0x2fcccd){_0x388b2b['push'](_0x388b2b['shift']());}};_0x491672(++_0x4bcdfb);}(_0x72b9,0x183));var _0x972b=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x72b9[_0x217ff6];return _0x417c93;};'use strict';var _=require(_0x972b('0x0'));var util=require(_0x972b('0x1'));var moment=require(_0x972b('0x2'));var BPromise=require(_0x972b('0x3'));var rs=require(_0x972b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x972b('0x5'))['db'];var utils=require(_0x972b('0x6'));var logger=require(_0x972b('0x7'))(_0x972b('0x8'));var config=require(_0x972b('0x9'));var jayson=require(_0x972b('0xa'));var client=jayson['client'][_0x972b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3245c4,_0x532598,_0x186e56){return new BPromise(function(_0x143b53,_0x4497ee){return client[_0x972b('0xc')](_0x3245c4,_0x186e56)[_0x972b('0xd')](function(_0x57eca4){logger['info'](_0x972b('0xe'),_0x532598,_0x972b('0xf'));logger[_0x972b('0x10')](_0x972b('0x11'),_0x532598,'request\x20sent',JSON[_0x972b('0x12')](_0x57eca4));if(_0x57eca4[_0x972b('0x13')]){if(_0x57eca4[_0x972b('0x13')]['code']===0x1f4){logger[_0x972b('0x13')](_0x972b('0xe'),_0x532598,_0x57eca4[_0x972b('0x13')]['message']);return _0x4497ee(_0x57eca4[_0x972b('0x13')]['message']);}logger['error'](_0x972b('0xe'),_0x532598,_0x57eca4[_0x972b('0x13')][_0x972b('0x14')]);return _0x143b53(_0x57eca4['error']['message']);}else{logger[_0x972b('0x15')](_0x972b('0xe'),_0x532598,_0x972b('0xf'));_0x143b53(_0x57eca4[_0x972b('0x16')][_0x972b('0x14')]);}})[_0x972b('0x17')](function(_0x59756d){logger[_0x972b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x532598,_0x59756d);_0x4497ee(_0x59756d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2ce9142..d98968f 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 _0xb9d1=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','exports','multer','path'];(function(_0x5a9f0f,_0x20397d){var _0xe72c06=function(_0x32e85e){while(--_0x32e85e){_0x5a9f0f['push'](_0x5a9f0f['shift']());}};_0xe72c06(++_0x20397d);}(_0xb9d1,0x83));var _0x1b9d=function(_0x180e96,_0x4feb2c){_0x180e96=_0x180e96-0x0;var _0x652c74=_0xb9d1[_0x180e96];return _0x652c74;};'use strict';var multer=require(_0x1b9d('0x0'));var util=require('util');var path=require(_0x1b9d('0x1'));var timeout=require(_0x1b9d('0x2'));var express=require(_0x1b9d('0x3'));var router=express[_0x1b9d('0x4')]();var fs_extra=require(_0x1b9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1b9d('0x6'));var config=require(_0x1b9d('0x7'));var controller=require(_0x1b9d('0x8'));router[_0x1b9d('0x9')]('/',auth[_0x1b9d('0xa')](),controller['index']);router[_0x1b9d('0x9')]('/:id',auth[_0x1b9d('0xa')](),controller[_0x1b9d('0xb')]);router[_0x1b9d('0xc')]('/',auth[_0x1b9d('0xa')](),controller[_0x1b9d('0xd')]);router[_0x1b9d('0xe')]('/:id',auth[_0x1b9d('0xa')](),controller[_0x1b9d('0xf')]);router[_0x1b9d('0x10')](_0x1b9d('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b9d('0x12')]=router; \ No newline at end of file +var _0x1767=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','post','create','put','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x1767,0x82));var _0x7176=function(_0xa10a3f,_0x24ad3c){_0xa10a3f=_0xa10a3f-0x0;var _0x2a5321=_0x1767[_0xa10a3f];return _0x2a5321;};'use strict';var multer=require('multer');var util=require(_0x7176('0x0'));var path=require(_0x7176('0x1'));var timeout=require(_0x7176('0x2'));var express=require(_0x7176('0x3'));var router=express[_0x7176('0x4')]();var fs_extra=require(_0x7176('0x5'));var auth=require(_0x7176('0x6'));var interaction=require(_0x7176('0x7'));var config=require(_0x7176('0x8'));var controller=require(_0x7176('0x9'));router[_0x7176('0xa')]('/',auth[_0x7176('0xb')](),controller['index']);router[_0x7176('0xa')](_0x7176('0xc'),auth[_0x7176('0xb')](),controller['show']);router[_0x7176('0xd')]('/',auth[_0x7176('0xb')](),controller[_0x7176('0xe')]);router[_0x7176('0xf')](_0x7176('0xc'),auth[_0x7176('0xb')](),controller['update']);router['delete'](_0x7176('0xc'),auth[_0x7176('0xb')](),controller[_0x7176('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 57cc738..954750f 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 _0x9cfa=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9cfa,0x8e));var _0xa9cf=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9cfa[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xa9cf('0x0'));module[_0xa9cf('0x1')]={'type':{'type':Sequelize[_0xa9cf('0x2')](_0xa9cf('0x3'),_0xa9cf('0x4'),_0xa9cf('0x5'),_0xa9cf('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa9cf('0x7')]},'key':{'type':Sequelize[_0xa9cf('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xa9cf('0x3'),_0xa9cf('0x4'),_0xa9cf('0x5'))},'keyContent':{'type':Sequelize[_0xa9cf('0x7')]},'idField':{'type':Sequelize[_0xa9cf('0x7')]},'nameField':{'type':Sequelize[_0xa9cf('0x7')]},'customField':{'type':Sequelize[_0xa9cf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9cf('0x7')]}}; \ No newline at end of file +var _0x5415=['customVariable','keyValue','STRING','exports','ENUM','string','variable'];(function(_0x50f0aa,_0x4abefc){var _0x42ca7c=function(_0x3ecd27){while(--_0x3ecd27){_0x50f0aa['push'](_0x50f0aa['shift']());}};_0x42ca7c(++_0x4abefc);}(_0x5415,0xdc));var _0x5541=function(_0x39f6ad,_0x41b7db){_0x39f6ad=_0x39f6ad-0x0;var _0x34fb7b=_0x5415[_0x39f6ad];return _0x34fb7b;};'use strict';var Sequelize=require('sequelize');module[_0x5541('0x0')]={'type':{'type':Sequelize[_0x5541('0x1')](_0x5541('0x2'),_0x5541('0x3'),_0x5541('0x4'),_0x5541('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x5541('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5541('0x1')](_0x5541('0x2'),_0x5541('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5541('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5c83656..8aeb76b 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 _0x2dae=['undefined','limit','offset','count','Content-Range','json','apply','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x410690,_0x5154f4){var _0x2889e4=function(_0x24c5e9){while(--_0x24c5e9){_0x410690['push'](_0x410690['shift']());}};_0x2889e4(++_0x5154f4);}(_0x2dae,0xc3));var _0xe2da=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x2dae[_0x43a1b8];return _0x324ecc;};'use strict';var emlformat=require(_0xe2da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe2da('0x1'));var jsonpatch=require(_0xe2da('0x2'));var rp=require(_0xe2da('0x3'));var moment=require(_0xe2da('0x4'));var BPromise=require(_0xe2da('0x5'));var Mustache=require('mustache');var util=require(_0xe2da('0x6'));var path=require(_0xe2da('0x7'));var sox=require(_0xe2da('0x8'));var csv=require(_0xe2da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2da('0xa'));var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x9'));var querystring=require(_0xe2da('0x10'));var Papa=require(_0xe2da('0x11'));var Redis=require('ioredis');var authService=require(_0xe2da('0x12'));var qs=require(_0xe2da('0x13'));var as=require(_0xe2da('0x14'));var hardwareService=require(_0xe2da('0x15'));var logger=require(_0xe2da('0x16'))(_0xe2da('0x17'));var utils=require(_0xe2da('0x18'));var config=require(_0xe2da('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2da('0x1a'))['db'];function respondWithStatusCode(_0x5200b1,_0x4377c6){_0x4377c6=_0x4377c6||0xcc;return function(_0x245ad7){if(_0x245ad7){return _0x5200b1[_0xe2da('0x1b')](_0x4377c6);}return _0x5200b1[_0xe2da('0x1c')](_0x4377c6)[_0xe2da('0x1d')]();};}function respondWithResult(_0x5660b5,_0x295a86){_0x295a86=_0x295a86||0xc8;return function(_0x48584b){if(_0x48584b){return _0x5660b5[_0xe2da('0x1c')](_0x295a86)['json'](_0x48584b);}};}function respondWithFilteredResult(_0x586b27,_0x403d1c){return function(_0x3dfc52){if(_0x3dfc52){var _0x33f919=typeof _0x403d1c['offset']===_0xe2da('0x1e')&&typeof _0x403d1c[_0xe2da('0x1f')]===_0xe2da('0x1e');var _0x33568f=_0x3dfc52['count'];var _0x45bb92=_0x33f919?0x0:_0x403d1c[_0xe2da('0x20')];var _0x417363=_0x33f919?_0x3dfc52[_0xe2da('0x21')]:_0x403d1c[_0xe2da('0x20')]+_0x403d1c['limit'];var _0x56eeb1;if(_0x417363>=_0x33568f){_0x417363=_0x33568f;_0x56eeb1=0xc8;}else{_0x56eeb1=0xce;}_0x586b27[_0xe2da('0x1c')](_0x56eeb1);return _0x586b27['set'](_0xe2da('0x22'),_0x45bb92+'-'+_0x417363+'/'+_0x33568f)[_0xe2da('0x23')](_0x3dfc52);}return null;};}function patchUpdates(_0x332193){return function(_0x203d36){try{jsonpatch[_0xe2da('0x24')](_0x203d36,_0x332193,!![]);}catch(_0x3e22de){return BPromise['reject'](_0x3e22de);}return _0x203d36[_0xe2da('0x25')]();};}function saveUpdates(_0x53cc4e,_0x30efdc){return function(_0x191d38){if(_0x191d38){return _0x191d38[_0xe2da('0x26')](_0x53cc4e)[_0xe2da('0x27')](function(_0x30dea4){return _0x30dea4;});}return null;};}function removeEntity(_0x1e45e9,_0x38f2c4){return function(_0x221e98){if(_0x221e98){return _0x221e98['destroy']()[_0xe2da('0x27')](function(){_0x1e45e9[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();});}};}function handleEntityNotFound(_0x14704d,_0x3778dc){return function(_0x230fb8){if(!_0x230fb8){_0x14704d[_0xe2da('0x1b')](0x194);}return _0x230fb8;};}function handleError(_0x56c37e,_0x2adc49){_0x2adc49=_0x2adc49||0x1f4;return function(_0x3e23d7){logger[_0xe2da('0x28')](_0x3e23d7[_0xe2da('0x29')]);if(_0x3e23d7[_0xe2da('0x2a')]){delete _0x3e23d7[_0xe2da('0x2a')];}_0x56c37e[_0xe2da('0x1c')](_0x2adc49)[_0xe2da('0x2b')](_0x3e23d7);};}exports['index']=function(_0x487a7c,_0x5e259a){var _0x3c4845={},_0x8c91db={},_0x4146ad={'count':0x0,'rows':[]};var _0x1ab91a=_['map'](db['FreshdeskField'][_0xe2da('0x2c')],function(_0x1ec8ca){return{'name':_0x1ec8ca[_0xe2da('0x2d')],'type':_0x1ec8ca[_0xe2da('0x2e')][_0xe2da('0x2f')]};});_0x8c91db[_0xe2da('0x30')]=_[_0xe2da('0x31')](_0x1ab91a,_0xe2da('0x2a'));_0x8c91db[_0xe2da('0x32')]=_['keys'](_0x487a7c['query']);_0x8c91db[_0xe2da('0x33')]=_[_0xe2da('0x34')](_0x8c91db[_0xe2da('0x30')],_0x8c91db[_0xe2da('0x32')]);_0x3c4845[_0xe2da('0x35')]=_[_0xe2da('0x34')](_0x8c91db[_0xe2da('0x30')],qs[_0xe2da('0x36')](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x36')]));_0x3c4845[_0xe2da('0x35')]=_0x3c4845[_0xe2da('0x35')][_0xe2da('0x37')]?_0x3c4845[_0xe2da('0x35')]:_0x8c91db[_0xe2da('0x30')];if(!_0x487a7c[_0xe2da('0x32')][_0xe2da('0x38')](_0xe2da('0x39'))){_0x3c4845['limit']=qs[_0xe2da('0x1f')](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x1f')]);_0x3c4845['offset']=qs[_0xe2da('0x20')](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x20')]);}_0x3c4845['order']=qs['sort'](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x3a')]);_0x3c4845['where']=qs[_0xe2da('0x33')](_[_0xe2da('0x3b')](_0x487a7c[_0xe2da('0x32')],_0x8c91db[_0xe2da('0x33')]),_0x1ab91a);if(_0x487a7c[_0xe2da('0x32')]['filter']){_0x3c4845[_0xe2da('0x3c')]=_['merge'](_0x3c4845['where'],{'$or':_[_0xe2da('0x31')](_0x1ab91a,function(_0x561afb){if(_0x561afb[_0xe2da('0x2e')]!==_0xe2da('0x3d')){var _0x54d8a3={};_0x54d8a3[_0x561afb[_0xe2da('0x2a')]]={'$like':'%'+_0x487a7c[_0xe2da('0x32')]['filter']+'%'};return _0x54d8a3;}})});}_0x3c4845=_['merge']({},_0x3c4845,_0x487a7c['options']);var _0x2d9c0a={'where':_0x3c4845[_0xe2da('0x3c')]};return db[_0xe2da('0x3e')][_0xe2da('0x21')](_0x2d9c0a)[_0xe2da('0x27')](function(_0xdf6ea6){_0x4146ad[_0xe2da('0x21')]=_0xdf6ea6;if(_0x487a7c['query'][_0xe2da('0x3f')]){_0x3c4845[_0xe2da('0x40')]=[{'all':!![]}];}return db[_0xe2da('0x3e')][_0xe2da('0x41')](_0x3c4845);})[_0xe2da('0x27')](function(_0x5a1550){_0x4146ad[_0xe2da('0x42')]=_0x5a1550;return _0x4146ad;})[_0xe2da('0x27')](respondWithFilteredResult(_0x5e259a,_0x3c4845))[_0xe2da('0x43')](handleError(_0x5e259a,null));};exports['show']=function(_0x24d748,_0x279f67){var _0x1529f4={'raw':!![],'where':{'id':_0x24d748[_0xe2da('0x44')]['id']}},_0x4096c5={};_0x4096c5[_0xe2da('0x30')]=_[_0xe2da('0x45')](db[_0xe2da('0x3e')]['rawAttributes']);_0x4096c5[_0xe2da('0x32')]=_[_0xe2da('0x45')](_0x24d748[_0xe2da('0x32')]);_0x4096c5[_0xe2da('0x33')]=_[_0xe2da('0x34')](_0x4096c5['model'],_0x4096c5[_0xe2da('0x32')]);_0x1529f4[_0xe2da('0x35')]=_[_0xe2da('0x34')](_0x4096c5[_0xe2da('0x30')],qs[_0xe2da('0x36')](_0x24d748[_0xe2da('0x32')][_0xe2da('0x36')]));_0x1529f4['attributes']=_0x1529f4[_0xe2da('0x35')]['length']?_0x1529f4[_0xe2da('0x35')]:_0x4096c5[_0xe2da('0x30')];if(_0x24d748[_0xe2da('0x32')]['includeAll']){_0x1529f4[_0xe2da('0x40')]=[{'all':!![]}];}_0x1529f4=_[_0xe2da('0x46')]({},_0x1529f4,_0x24d748['options']);return db[_0xe2da('0x3e')][_0xe2da('0x47')](_0x1529f4)[_0xe2da('0x27')](handleEntityNotFound(_0x279f67,null))['then'](respondWithResult(_0x279f67,null))[_0xe2da('0x43')](handleError(_0x279f67,null));};exports['create']=function(_0x4e9444,_0x16a393){return db['FreshdeskField'][_0xe2da('0x48')](_0x4e9444[_0xe2da('0x49')],{})['then'](respondWithResult(_0x16a393,0xc9))[_0xe2da('0x43')](handleError(_0x16a393,null));};exports[_0xe2da('0x26')]=function(_0x482547,_0x4a6d80){if(_0x482547[_0xe2da('0x49')]['id']){delete _0x482547['body']['id'];}return db[_0xe2da('0x3e')][_0xe2da('0x47')]({'where':{'id':_0x482547[_0xe2da('0x44')]['id']}})[_0xe2da('0x27')](handleEntityNotFound(_0x4a6d80,null))[_0xe2da('0x27')](saveUpdates(_0x482547[_0xe2da('0x49')],null))[_0xe2da('0x27')](respondWithResult(_0x4a6d80,null))[_0xe2da('0x43')](handleError(_0x4a6d80,null));};exports[_0xe2da('0x4a')]=function(_0x515f9b,_0x3ce9a8){return db[_0xe2da('0x3e')][_0xe2da('0x47')]({'where':{'id':_0x515f9b['params']['id']}})[_0xe2da('0x27')](handleEntityNotFound(_0x3ce9a8,null))[_0xe2da('0x27')](removeEntity(_0x3ce9a8,null))[_0xe2da('0x43')](handleError(_0x3ce9a8,null));}; \ No newline at end of file +var _0x2bc6=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','FreshdeskField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','rawAttributes','fields','find','create','body','eml-format','rimraf','zip-dir','mustache','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x41bab9,_0x39a8e9){var _0x4ae7b9=function(_0x53b3d5){while(--_0x53b3d5){_0x41bab9['push'](_0x41bab9['shift']());}};_0x4ae7b9(++_0x39a8e9);}(_0x2bc6,0x163));var _0x62bc=function(_0x2e026b,_0x20363d){_0x2e026b=_0x2e026b-0x0;var _0x4007bb=_0x2bc6[_0x2e026b];return _0x4007bb;};'use strict';var emlformat=require(_0x62bc('0x0'));var rimraf=require(_0x62bc('0x1'));var zipdir=require(_0x62bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x62bc('0x3'));var util=require('util');var path=require(_0x62bc('0x4'));var sox=require(_0x62bc('0x5'));var csv=require('to-csv');var ejs=require(_0x62bc('0x6'));var fs=require('fs');var fs_extra=require(_0x62bc('0x7'));var _=require(_0x62bc('0x8'));var squel=require(_0x62bc('0x9'));var crypto=require(_0x62bc('0xa'));var jsforce=require(_0x62bc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x62bc('0xc'));var querystring=require(_0x62bc('0xd'));var Papa=require(_0x62bc('0xe'));var Redis=require(_0x62bc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x62bc('0x10'));var as=require(_0x62bc('0x11'));var hardwareService=require(_0x62bc('0x12'));var logger=require('../../config/logger')(_0x62bc('0x13'));var utils=require(_0x62bc('0x14'));var config=require(_0x62bc('0x15'));var licenseUtil=require(_0x62bc('0x16'));var db=require(_0x62bc('0x17'))['db'];function respondWithStatusCode(_0x2a9309,_0x414a08){_0x414a08=_0x414a08||0xcc;return function(_0x4f92f7){if(_0x4f92f7){return _0x2a9309[_0x62bc('0x18')](_0x414a08);}return _0x2a9309[_0x62bc('0x19')](_0x414a08)['end']();};}function respondWithResult(_0x314358,_0x10230f){_0x10230f=_0x10230f||0xc8;return function(_0xc14ac9){if(_0xc14ac9){return _0x314358['status'](_0x10230f)[_0x62bc('0x1a')](_0xc14ac9);}};}function respondWithFilteredResult(_0x94b649,_0x56eade){return function(_0x515c80){if(_0x515c80){var _0x39c5e0=typeof _0x56eade[_0x62bc('0x1b')]==='undefined'&&typeof _0x56eade[_0x62bc('0x1c')]===_0x62bc('0x1d');var _0xc1211c=_0x515c80[_0x62bc('0x1e')];var _0xc95407=_0x39c5e0?0x0:_0x56eade[_0x62bc('0x1b')];var _0x1d3d8f=_0x39c5e0?_0x515c80[_0x62bc('0x1e')]:_0x56eade[_0x62bc('0x1b')]+_0x56eade['limit'];var _0x5dd6f0;if(_0x1d3d8f>=_0xc1211c){_0x1d3d8f=_0xc1211c;_0x5dd6f0=0xc8;}else{_0x5dd6f0=0xce;}_0x94b649[_0x62bc('0x19')](_0x5dd6f0);return _0x94b649[_0x62bc('0x1f')](_0x62bc('0x20'),_0xc95407+'-'+_0x1d3d8f+'/'+_0xc1211c)['json'](_0x515c80);}return null;};}function patchUpdates(_0x380621){return function(_0x495f99){try{jsonpatch[_0x62bc('0x21')](_0x495f99,_0x380621,!![]);}catch(_0x37ab87){return BPromise[_0x62bc('0x22')](_0x37ab87);}return _0x495f99['save']();};}function saveUpdates(_0x3b8644,_0x28757d){return function(_0xae87bf){if(_0xae87bf){return _0xae87bf[_0x62bc('0x23')](_0x3b8644)[_0x62bc('0x24')](function(_0x3b2eb0){return _0x3b2eb0;});}return null;};}function removeEntity(_0x5b2e16,_0x70e428){return function(_0xb0d0fb){if(_0xb0d0fb){return _0xb0d0fb[_0x62bc('0x25')]()[_0x62bc('0x24')](function(){_0x5b2e16[_0x62bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ca86,_0xcd4b0){return function(_0x58e76a){if(!_0x58e76a){_0x52ca86[_0x62bc('0x18')](0x194);}return _0x58e76a;};}function handleError(_0x36af97,_0x1e046d){_0x1e046d=_0x1e046d||0x1f4;return function(_0x4a72d6){logger[_0x62bc('0x26')](_0x4a72d6[_0x62bc('0x27')]);if(_0x4a72d6[_0x62bc('0x28')]){delete _0x4a72d6['name'];}_0x36af97['status'](_0x1e046d)[_0x62bc('0x29')](_0x4a72d6);};}exports[_0x62bc('0x2a')]=function(_0x23817c,_0x4df640){var _0x4313ba={},_0x1f2985={},_0x44600f={'count':0x0,'rows':[]};var _0x444267=_['map'](db[_0x62bc('0x2b')]['rawAttributes'],function(_0x26701b){return{'name':_0x26701b[_0x62bc('0x2c')],'type':_0x26701b[_0x62bc('0x2d')][_0x62bc('0x2e')]};});_0x1f2985[_0x62bc('0x2f')]=_[_0x62bc('0x30')](_0x444267,_0x62bc('0x28'));_0x1f2985[_0x62bc('0x31')]=_[_0x62bc('0x32')](_0x23817c[_0x62bc('0x31')]);_0x1f2985[_0x62bc('0x33')]=_[_0x62bc('0x34')](_0x1f2985[_0x62bc('0x2f')],_0x1f2985[_0x62bc('0x31')]);_0x4313ba[_0x62bc('0x35')]=_[_0x62bc('0x34')](_0x1f2985[_0x62bc('0x2f')],qs['fields'](_0x23817c[_0x62bc('0x31')]['fields']));_0x4313ba['attributes']=_0x4313ba[_0x62bc('0x35')]['length']?_0x4313ba['attributes']:_0x1f2985['model'];if(!_0x23817c[_0x62bc('0x31')][_0x62bc('0x36')](_0x62bc('0x37'))){_0x4313ba['limit']=qs['limit'](_0x23817c['query'][_0x62bc('0x1c')]);_0x4313ba[_0x62bc('0x1b')]=qs['offset'](_0x23817c['query'][_0x62bc('0x1b')]);}_0x4313ba[_0x62bc('0x38')]=qs[_0x62bc('0x39')](_0x23817c['query'][_0x62bc('0x39')]);_0x4313ba[_0x62bc('0x3a')]=qs[_0x62bc('0x33')](_[_0x62bc('0x3b')](_0x23817c['query'],_0x1f2985[_0x62bc('0x33')]),_0x444267);if(_0x23817c[_0x62bc('0x31')]['filter']){_0x4313ba[_0x62bc('0x3a')]=_[_0x62bc('0x3c')](_0x4313ba[_0x62bc('0x3a')],{'$or':_[_0x62bc('0x30')](_0x444267,function(_0x599aed){if(_0x599aed[_0x62bc('0x2d')]!=='VIRTUAL'){var _0x38230a={};_0x38230a[_0x599aed[_0x62bc('0x28')]]={'$like':'%'+_0x23817c[_0x62bc('0x31')][_0x62bc('0x3d')]+'%'};return _0x38230a;}})});}_0x4313ba=_['merge']({},_0x4313ba,_0x23817c[_0x62bc('0x3e')]);var _0x5c806b={'where':_0x4313ba[_0x62bc('0x3a')]};return db[_0x62bc('0x2b')][_0x62bc('0x1e')](_0x5c806b)[_0x62bc('0x24')](function(_0x9011f2){_0x44600f[_0x62bc('0x1e')]=_0x9011f2;if(_0x23817c[_0x62bc('0x31')][_0x62bc('0x3f')]){_0x4313ba[_0x62bc('0x40')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x4313ba);})[_0x62bc('0x24')](function(_0x400779){_0x44600f['rows']=_0x400779;return _0x44600f;})[_0x62bc('0x24')](respondWithFilteredResult(_0x4df640,_0x4313ba))[_0x62bc('0x41')](handleError(_0x4df640,null));};exports[_0x62bc('0x42')]=function(_0xedc9f3,_0xbd8c7e){var _0x5f3752={'raw':!![],'where':{'id':_0xedc9f3[_0x62bc('0x43')]['id']}},_0x3bf043={};_0x3bf043['model']=_['keys'](db[_0x62bc('0x2b')][_0x62bc('0x44')]);_0x3bf043[_0x62bc('0x31')]=_['keys'](_0xedc9f3[_0x62bc('0x31')]);_0x3bf043[_0x62bc('0x33')]=_[_0x62bc('0x34')](_0x3bf043[_0x62bc('0x2f')],_0x3bf043[_0x62bc('0x31')]);_0x5f3752[_0x62bc('0x35')]=_['intersection'](_0x3bf043[_0x62bc('0x2f')],qs['fields'](_0xedc9f3[_0x62bc('0x31')][_0x62bc('0x45')]));_0x5f3752[_0x62bc('0x35')]=_0x5f3752['attributes']['length']?_0x5f3752['attributes']:_0x3bf043[_0x62bc('0x2f')];if(_0xedc9f3['query'][_0x62bc('0x3f')]){_0x5f3752[_0x62bc('0x40')]=[{'all':!![]}];}_0x5f3752=_['merge']({},_0x5f3752,_0xedc9f3['options']);return db['FreshdeskField'][_0x62bc('0x46')](_0x5f3752)[_0x62bc('0x24')](handleEntityNotFound(_0xbd8c7e,null))[_0x62bc('0x24')](respondWithResult(_0xbd8c7e,null))[_0x62bc('0x41')](handleError(_0xbd8c7e,null));};exports[_0x62bc('0x47')]=function(_0x49389f,_0x3834b2){return db[_0x62bc('0x2b')]['create'](_0x49389f[_0x62bc('0x48')],{})['then'](respondWithResult(_0x3834b2,0xc9))[_0x62bc('0x41')](handleError(_0x3834b2,null));};exports[_0x62bc('0x23')]=function(_0x17e0ec,_0xca6190){if(_0x17e0ec[_0x62bc('0x48')]['id']){delete _0x17e0ec[_0x62bc('0x48')]['id'];}return db[_0x62bc('0x2b')]['find']({'where':{'id':_0x17e0ec[_0x62bc('0x43')]['id']}})[_0x62bc('0x24')](handleEntityNotFound(_0xca6190,null))['then'](saveUpdates(_0x17e0ec[_0x62bc('0x48')],null))['then'](respondWithResult(_0xca6190,null))[_0x62bc('0x41')](handleError(_0xca6190,null));};exports[_0x62bc('0x25')]=function(_0x4bec08,_0x6c2969){return db[_0x62bc('0x2b')][_0x62bc('0x46')]({'where':{'id':_0x4bec08['params']['id']}})[_0x62bc('0x24')](handleEntityNotFound(_0x6c2969,null))[_0x62bc('0x24')](removeEntity(_0x6c2969,null))[_0x62bc('0x41')](handleError(_0x6c2969,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index df95d3f..7a86347 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 _0x3c85=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x3c85,0xb8));var _0x53c8=function(_0x426113,_0x29a128){_0x426113=_0x426113-0x0;var _0x467dd9=_0x3c85[_0x426113];return _0x467dd9;};'use strict';var _=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var logger=require(_0x53c8('0x2'))(_0x53c8('0x3'));var moment=require('moment');var BPromise=require(_0x53c8('0x4'));var rp=require(_0x53c8('0x5'));var fs=require('fs');var path=require(_0x53c8('0x6'));var rimraf=require(_0x53c8('0x7'));var config=require(_0x53c8('0x8'));var attributes=require(_0x53c8('0x9'));module[_0x53c8('0xa')]=function(_0x1eea7b,_0x10bf07){return _0x1eea7b['define'](_0x53c8('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x53c8('0xc'),'fields':[_0x53c8('0xd'),_0x53c8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1be2=['FieldId','lodash','util','../../config/logger','api','moment','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','idField'];(function(_0x173102,_0x18f218){var _0x4797f9=function(_0x56ffed){while(--_0x56ffed){_0x173102['push'](_0x173102['shift']());}};_0x4797f9(++_0x18f218);}(_0x1be2,0x181));var _0x21be=function(_0x5b9b7e,_0x51b232){_0x5b9b7e=_0x5b9b7e-0x0;var _0x1a1158=_0x1be2[_0x5b9b7e];return _0x1a1158;};'use strict';var _=require(_0x21be('0x0'));var util=require(_0x21be('0x1'));var logger=require(_0x21be('0x2'))(_0x21be('0x3'));var moment=require(_0x21be('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x21be('0x5'));var config=require('../../config/environment');var attributes=require(_0x21be('0x6'));module[_0x21be('0x7')]=function(_0x2bccf5,_0x376603){return _0x2bccf5['define'](_0x21be('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x21be('0x9'),'fields':[_0x21be('0xa'),_0x21be('0xb')],'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 b1b9889..4c106c0 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 _0xb1b2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','lodash','util','bluebird'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xb1b2,0x1b5));var _0x2b1b=function(_0x5be918,_0x3c4086){_0x5be918=_0x5be918-0x0;var _0x27569e=_0xb1b2[_0x5be918];return _0x27569e;};'use strict';var _=require(_0x2b1b('0x0'));var util=require(_0x2b1b('0x1'));var moment=require('moment');var BPromise=require(_0x2b1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b1b('0x3'));var db=require(_0x2b1b('0x4'))['db'];var utils=require(_0x2b1b('0x5'));var logger=require('../../config/logger')(_0x2b1b('0x6'));var config=require(_0x2b1b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2b1b('0x8')][_0x2b1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x570668,_0x4c1ad2,_0xb65697){return new BPromise(function(_0x1e7f54,_0x3cb38a){return client[_0x2b1b('0xa')](_0x570668,_0xb65697)[_0x2b1b('0xb')](function(_0x459357){logger['info'](_0x2b1b('0xc'),_0x4c1ad2,'request\x20sent');logger[_0x2b1b('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4c1ad2,_0x2b1b('0xe'),JSON['stringify'](_0x459357));if(_0x459357['error']){if(_0x459357[_0x2b1b('0xf')][_0x2b1b('0x10')]===0x1f4){logger[_0x2b1b('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x4c1ad2,_0x459357['error'][_0x2b1b('0x11')]);return _0x3cb38a(_0x459357[_0x2b1b('0xf')][_0x2b1b('0x11')]);}logger['error'](_0x2b1b('0xc'),_0x4c1ad2,_0x459357[_0x2b1b('0xf')][_0x2b1b('0x11')]);return _0x1e7f54(_0x459357['error'][_0x2b1b('0x11')]);}else{logger[_0x2b1b('0x12')](_0x2b1b('0xc'),_0x4c1ad2,_0x2b1b('0xe'));_0x1e7f54(_0x459357[_0x2b1b('0x13')][_0x2b1b('0x11')]);}})['catch'](function(_0x170e7a){logger['error'](_0x2b1b('0xc'),_0x4c1ad2,_0x170e7a);_0x3cb38a(_0x170e7a);});});} \ No newline at end of file +var _0xde62=['request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','FreshdeskField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xde62,0xef));var _0x2de6=function(_0x54432d,_0x49a78e){_0x54432d=_0x54432d-0x0;var _0x565ce6=_0xde62[_0x54432d];return _0x565ce6;};'use strict';var _=require(_0x2de6('0x0'));var util=require('util');var moment=require(_0x2de6('0x1'));var BPromise=require(_0x2de6('0x2'));var rs=require(_0x2de6('0x3'));var fs=require('fs');var Redis=require(_0x2de6('0x4'));var db=require(_0x2de6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2de6('0x6'))('rpc');var config=require(_0x2de6('0x7'));var jayson=require(_0x2de6('0x8'));var client=jayson[_0x2de6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45799f,_0xa5674,_0xc90d0c){return new BPromise(function(_0x250a4f,_0x36ecc1){return client[_0x2de6('0xa')](_0x45799f,_0xc90d0c)[_0x2de6('0xb')](function(_0xedaeef){logger[_0x2de6('0xc')]('FreshdeskField,\x20%s,\x20%s',_0xa5674,_0x2de6('0xd'));logger[_0x2de6('0xe')](_0x2de6('0xf'),_0xa5674,_0x2de6('0xd'),JSON['stringify'](_0xedaeef));if(_0xedaeef['error']){if(_0xedaeef[_0x2de6('0x10')]['code']===0x1f4){logger[_0x2de6('0x10')]('FreshdeskField,\x20%s,\x20%s',_0xa5674,_0xedaeef[_0x2de6('0x10')][_0x2de6('0x11')]);return _0x36ecc1(_0xedaeef['error'][_0x2de6('0x11')]);}logger[_0x2de6('0x10')](_0x2de6('0x12'),_0xa5674,_0xedaeef[_0x2de6('0x10')][_0x2de6('0x11')]);return _0x250a4f(_0xedaeef[_0x2de6('0x10')]['message']);}else{logger[_0x2de6('0xc')](_0x2de6('0x12'),_0xa5674,_0x2de6('0xd'));_0x250a4f(_0xedaeef[_0x2de6('0x13')][_0x2de6('0x11')]);}})[_0x2de6('0x14')](function(_0x15c7d4){logger[_0x2de6('0x10')](_0x2de6('0x12'),_0xa5674,_0x15c7d4);_0x36ecc1(_0x15c7d4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3dd9e4f..52b2eea 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 _0x57f8=['/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x232a22,_0x2bcf3a){var _0x392eaa=function(_0x33d4fa){while(--_0x33d4fa){_0x232a22['push'](_0x232a22['shift']());}};_0x392eaa(++_0x2bcf3a);}(_0x57f8,0x198));var _0x857f=function(_0x124da8,_0x2f4adf){_0x124da8=_0x124da8-0x0;var _0x470b89=_0x57f8[_0x124da8];return _0x470b89;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['getConfigurations']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['getFields']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller[_0x857f('0x11')]);router['put'](_0x857f('0xc'),auth[_0x857f('0xb')](),controller[_0x857f('0x12')]);router[_0x857f('0x13')](_0x857f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x857f('0x14')]=router; \ No newline at end of file +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(_0x8d4fad,_0x4cddfd){var _0x4300d1=function(_0x21491b){while(--_0x21491b){_0x8d4fad['push'](_0x8d4fad['shift']());}};_0x4300d1(++_0x4cddfd);}(_0x087b,0x11a));var _0xb087=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x087b[_0x4e9d3c];return _0x2d0825;};'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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 51574b9..0cbaac5 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 _0x1967=['STRING','username','remoteUri','exports'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1967,0x173));var _0x7196=function(_0x2132a5,_0x390814){_0x2132a5=_0x2132a5-0x0;var _0x4bb33f=_0x1967[_0x2132a5];return _0x4bb33f;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x430fdd,_0x2a9ef8){var _0x15292e=function(_0x384bb5){while(--_0x384bb5){_0x430fdd['push'](_0x430fdd['shift']());}};_0x15292e(++_0x2a9ef8);}(_0x2ef3,0xba));var _0x32ef=function(_0x140cc2,_0x417057){_0x140cc2=_0x140cc2-0x0;var _0x38e88c=_0x2ef3[_0x140cc2];return _0x38e88c;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f63b7a8..9ebf180 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 _0x547c=['%s%s','/api/selector/owners','Token\x20token=','users','email','test','error','stringify','Wrong\x20credentials','rimraf','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','stack','name','send','index','FreshsalesAccount','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','merge','options','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format'];(function(_0x3c265f,_0x5fefd1){var _0x2eadcd=function(_0x417a04){while(--_0x417a04){_0x3c265f['push'](_0x3c265f['shift']());}};_0x2eadcd(++_0x5fefd1);}(_0x547c,0x1e4));var _0xc547=function(_0x40aa4e,_0x5ad1fa){_0x40aa4e=_0x40aa4e-0x0;var _0x9e21ee=_0x547c[_0x40aa4e];return _0x9e21ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc547('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(_0xc547('0x1'));var util=require(_0xc547('0x2'));var path=require(_0xc547('0x3'));var sox=require(_0xc547('0x4'));var csv=require('to-csv');var ejs=require(_0xc547('0x5'));var fs=require('fs');var fs_extra=require(_0xc547('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc547('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc547('0x8'));var Papa=require(_0xc547('0x9'));var Redis=require(_0xc547('0xa'));var authService=require(_0xc547('0xb'));var qs=require(_0xc547('0xc'));var as=require(_0xc547('0xd'));var hardwareService=require(_0xc547('0xe'));var logger=require('../../config/logger')(_0xc547('0xf'));var utils=require(_0xc547('0x10'));var config=require(_0xc547('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc547('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xebb186,_0x182942){_0x182942=_0x182942||0xcc;return function(_0x1e7d75){if(_0x1e7d75){return _0xebb186[_0xc547('0x13')](_0x182942);}return _0xebb186[_0xc547('0x14')](_0x182942)[_0xc547('0x15')]();};}function respondWithResult(_0x1f592a,_0x4319d8){_0x4319d8=_0x4319d8||0xc8;return function(_0x49e55d){if(_0x49e55d){return _0x1f592a[_0xc547('0x14')](_0x4319d8)[_0xc547('0x16')](_0x49e55d);}};}function respondWithFilteredResult(_0x214be1,_0x106bfb){return function(_0x19acb3){if(_0x19acb3){var _0x44bf25=typeof _0x106bfb[_0xc547('0x17')]===_0xc547('0x18')&&typeof _0x106bfb[_0xc547('0x19')]===_0xc547('0x18');var _0x1a203e=_0x19acb3['count'];var _0xb71190=_0x44bf25?0x0:_0x106bfb[_0xc547('0x17')];var _0x130677=_0x44bf25?_0x19acb3[_0xc547('0x1a')]:_0x106bfb['offset']+_0x106bfb[_0xc547('0x19')];var _0x2403df;if(_0x130677>=_0x1a203e){_0x130677=_0x1a203e;_0x2403df=0xc8;}else{_0x2403df=0xce;}_0x214be1[_0xc547('0x14')](_0x2403df);return _0x214be1[_0xc547('0x1b')]('Content-Range',_0xb71190+'-'+_0x130677+'/'+_0x1a203e)[_0xc547('0x16')](_0x19acb3);}return null;};}function patchUpdates(_0x143ef2){return function(_0x32d9fa){try{jsonpatch[_0xc547('0x1c')](_0x32d9fa,_0x143ef2,!![]);}catch(_0x3b4fe4){return BPromise[_0xc547('0x1d')](_0x3b4fe4);}return _0x32d9fa['save']();};}function saveUpdates(_0x5c7999,_0x13f342){return function(_0x59ce15){if(_0x59ce15){return _0x59ce15['update'](_0x5c7999)[_0xc547('0x1e')](function(_0x98f1b7){return _0x98f1b7;});}return null;};}function removeEntity(_0x37f9f0,_0x3f3156){return function(_0x203d5f){if(_0x203d5f){return _0x203d5f[_0xc547('0x1f')]()['then'](function(){_0x37f9f0[_0xc547('0x14')](0xcc)[_0xc547('0x15')]();});}};}function handleEntityNotFound(_0x572457,_0xe173c6){return function(_0x29f156){if(!_0x29f156){_0x572457[_0xc547('0x13')](0x194);}return _0x29f156;};}function handleError(_0x4990de,_0x109916){_0x109916=_0x109916||0x1f4;return function(_0x3a8cd8){logger['error'](_0x3a8cd8[_0xc547('0x20')]);if(_0x3a8cd8[_0xc547('0x21')]){delete _0x3a8cd8[_0xc547('0x21')];}_0x4990de['status'](_0x109916)[_0xc547('0x22')](_0x3a8cd8);};}exports[_0xc547('0x23')]=function(_0xd51088,_0x1f510d){var _0x3b43a8={},_0x60e638={},_0x478a74={'count':0x0,'rows':[]};var _0x2bdd75=_['map'](db[_0xc547('0x24')][_0xc547('0x25')],function(_0x3a4c56){return{'name':_0x3a4c56['fieldName'],'type':_0x3a4c56['type']['key']};});_0x60e638[_0xc547('0x26')]=_[_0xc547('0x27')](_0x2bdd75,'name');_0x60e638[_0xc547('0x28')]=_[_0xc547('0x29')](_0xd51088[_0xc547('0x28')]);_0x60e638[_0xc547('0x2a')]=_[_0xc547('0x2b')](_0x60e638[_0xc547('0x26')],_0x60e638[_0xc547('0x28')]);_0x3b43a8[_0xc547('0x2c')]=_['intersection'](_0x60e638['model'],qs[_0xc547('0x2d')](_0xd51088['query'][_0xc547('0x2d')]));_0x3b43a8[_0xc547('0x2c')]=_0x3b43a8[_0xc547('0x2c')][_0xc547('0x2e')]?_0x3b43a8['attributes']:_0x60e638['model'];if(!_0xd51088[_0xc547('0x28')][_0xc547('0x2f')](_0xc547('0x30'))){_0x3b43a8[_0xc547('0x19')]=qs[_0xc547('0x19')](_0xd51088['query'][_0xc547('0x19')]);_0x3b43a8['offset']=qs['offset'](_0xd51088[_0xc547('0x28')]['offset']);}_0x3b43a8[_0xc547('0x31')]=qs[_0xc547('0x32')](_0xd51088[_0xc547('0x28')][_0xc547('0x32')]);_0x3b43a8['where']=qs['filters'](_[_0xc547('0x33')](_0xd51088[_0xc547('0x28')],_0x60e638[_0xc547('0x2a')]),_0x2bdd75);if(_0xd51088[_0xc547('0x28')]['filter']){_0x3b43a8[_0xc547('0x34')]=_['merge'](_0x3b43a8[_0xc547('0x34')],{'$or':_[_0xc547('0x27')](_0x2bdd75,function(_0x1678fd){if(_0x1678fd[_0xc547('0x35')]!==_0xc547('0x36')){var _0x4fc077={};_0x4fc077[_0x1678fd[_0xc547('0x21')]]={'$like':'%'+_0xd51088[_0xc547('0x28')][_0xc547('0x37')]+'%'};return _0x4fc077;}})});}_0x3b43a8=_['merge']({},_0x3b43a8,_0xd51088['options']);var _0x156a50={'where':_0x3b43a8[_0xc547('0x34')]};return db[_0xc547('0x24')][_0xc547('0x1a')](_0x156a50)[_0xc547('0x1e')](function(_0x5a76ae){_0x478a74[_0xc547('0x1a')]=_0x5a76ae;if(_0xd51088['query'][_0xc547('0x38')]){_0x3b43a8[_0xc547('0x39')]=[{'all':!![]}];}return db[_0xc547('0x24')][_0xc547('0x3a')](_0x3b43a8);})[_0xc547('0x1e')](function(_0x3e8654){_0x478a74[_0xc547('0x3b')]=_0x3e8654;return _0x478a74;})[_0xc547('0x1e')](respondWithFilteredResult(_0x1f510d,_0x3b43a8))['catch'](handleError(_0x1f510d,null));};exports[_0xc547('0x3c')]=function(_0x514532,_0xb76e38){var _0xf519b1={'raw':![],'where':{'id':_0x514532['params']['id']}},_0x4333a5={};_0x4333a5[_0xc547('0x26')]=_['keys'](db['FreshsalesAccount'][_0xc547('0x25')]);_0x4333a5[_0xc547('0x28')]=_[_0xc547('0x29')](_0x514532['query']);_0x4333a5[_0xc547('0x2a')]=_[_0xc547('0x2b')](_0x4333a5[_0xc547('0x26')],_0x4333a5[_0xc547('0x28')]);_0xf519b1['attributes']=_[_0xc547('0x2b')](_0x4333a5[_0xc547('0x26')],qs['fields'](_0x514532[_0xc547('0x28')][_0xc547('0x2d')]));_0xf519b1[_0xc547('0x2c')]=_0xf519b1[_0xc547('0x2c')][_0xc547('0x2e')]?_0xf519b1[_0xc547('0x2c')]:_0x4333a5[_0xc547('0x26')];if(_0x514532[_0xc547('0x28')][_0xc547('0x38')]){_0xf519b1[_0xc547('0x39')]=[{'all':!![]}];}_0xf519b1=_['merge']({},_0xf519b1,_0x514532['options']);return db[_0xc547('0x24')][_0xc547('0x3d')](_0xf519b1)[_0xc547('0x1e')](handleEntityNotFound(_0xb76e38,null))['then'](respondWithResult(_0xb76e38,null))[_0xc547('0x3e')](handleError(_0xb76e38,null));};exports[_0xc547('0x3f')]=function(_0x123574,_0x378dd5){return db[_0xc547('0x24')]['create'](_0x123574[_0xc547('0x40')],{})[_0xc547('0x1e')](respondWithResult(_0x378dd5,0xc9))['catch'](handleError(_0x378dd5,null));};exports[_0xc547('0x41')]=function(_0x41ae08,_0x2d6d7f){if(_0x41ae08[_0xc547('0x40')]['id']){delete _0x41ae08[_0xc547('0x40')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x41ae08['params']['id']}})[_0xc547('0x1e')](handleEntityNotFound(_0x2d6d7f,null))[_0xc547('0x1e')](saveUpdates(_0x41ae08[_0xc547('0x40')],null))[_0xc547('0x1e')](respondWithResult(_0x2d6d7f,null))[_0xc547('0x3e')](handleError(_0x2d6d7f,null));};exports[_0xc547('0x1f')]=function(_0x2d7c88,_0x1e06f1){return db[_0xc547('0x24')][_0xc547('0x3d')]({'where':{'id':_0x2d7c88[_0xc547('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e06f1,null))[_0xc547('0x1e')](removeEntity(_0x1e06f1,null))[_0xc547('0x3e')](handleError(_0x1e06f1,null));};exports[_0xc547('0x43')]=function(_0x388f68,_0x461494,_0x4f8574){var _0x3925d7={};var _0x38dbbf={};var _0xe89ef7;var _0xba937b;return db[_0xc547('0x24')][_0xc547('0x44')]({'where':{'id':_0x388f68[_0xc547('0x42')]['id']}})[_0xc547('0x1e')](handleEntityNotFound(_0x461494,null))['then'](function(_0x5341e3){if(_0x5341e3){_0xe89ef7=_0x5341e3;_0x38dbbf[_0xc547('0x26')]=_[_0xc547('0x29')](db[_0xc547('0x45')][_0xc547('0x25')]);_0x38dbbf[_0xc547('0x28')]=_[_0xc547('0x29')](_0x388f68[_0xc547('0x28')]);_0x38dbbf['filters']=_[_0xc547('0x2b')](_0x38dbbf[_0xc547('0x26')],_0x38dbbf['query']);_0x3925d7[_0xc547('0x2c')]=_[_0xc547('0x2b')](_0x38dbbf['model'],qs[_0xc547('0x2d')](_0x388f68['query'][_0xc547('0x2d')]));_0x3925d7[_0xc547('0x2c')]=_0x3925d7[_0xc547('0x2c')]['length']?_0x3925d7[_0xc547('0x2c')]:_0x38dbbf['model'];_0x3925d7[_0xc547('0x31')]=qs[_0xc547('0x32')](_0x388f68[_0xc547('0x28')]['sort']);_0x3925d7[_0xc547('0x34')]=qs[_0xc547('0x2a')](_[_0xc547('0x33')](_0x388f68['query'],_0x38dbbf['filters']));if(_0x388f68[_0xc547('0x28')][_0xc547('0x37')]){_0x3925d7[_0xc547('0x34')]=_[_0xc547('0x46')](_0x3925d7['where'],{'$or':_[_0xc547('0x27')](_0x3925d7[_0xc547('0x2c')],function(_0x1800d4){var _0x8e14d7={};_0x8e14d7[_0x1800d4]={'$like':'%'+_0x388f68[_0xc547('0x28')][_0xc547('0x37')]+'%'};return _0x8e14d7;})});}_0x3925d7=_[_0xc547('0x46')]({},_0x3925d7,_0x388f68[_0xc547('0x47')]);return _0xe89ef7[_0xc547('0x43')](_0x3925d7);}})[_0xc547('0x1e')](function(_0x21af97){if(_0x21af97){_0xba937b=_0x21af97[_0xc547('0x2e')];if(!_0x388f68['query'][_0xc547('0x2f')](_0xc547('0x30'))){_0x3925d7['limit']=qs['limit'](_0x388f68[_0xc547('0x28')][_0xc547('0x19')]);_0x3925d7[_0xc547('0x17')]=qs[_0xc547('0x17')](_0x388f68[_0xc547('0x28')]['offset']);}return _0xe89ef7[_0xc547('0x43')](_0x3925d7);}})[_0xc547('0x1e')](function(_0x4fca78){if(_0x4fca78){return _0x4fca78?{'count':_0xba937b,'rows':_0x4fca78}:null;}})[_0xc547('0x1e')](respondWithResult(_0x461494,null))[_0xc547('0x3e')](handleError(_0x461494,null));};exports[_0xc547('0x48')]=function(_0x11b261,_0x2ab720,_0x4e716d){if(_0x11b261[_0xc547('0x40')]['id']){delete _0x11b261[_0xc547('0x40')]['id'];}return db[_0xc547('0x24')][_0xc547('0x44')]({'where':{'id':_0x11b261['params']['id']}})[_0xc547('0x1e')](handleEntityNotFound(_0x2ab720,null))[_0xc547('0x1e')](function(_0x530de2){if(_0x530de2){_0x11b261[_0xc547('0x40')][_0xc547('0x49')]=_0x530de2['id'];_0x11b261[_0xc547('0x40')][_0xc547('0x4a')]=integrations['getSubjects'](_0x11b261[_0xc547('0x40')][_0xc547('0x4b')],_0x11b261[_0xc547('0x40')][_0xc547('0x35')]);_0x11b261['body'][_0xc547('0x4c')]=integrations['getDescriptions'](_0x11b261[_0xc547('0x40')][_0xc547('0x4b')],_0x11b261[_0xc547('0x40')][_0xc547('0x35')]);return db[_0xc547('0x45')][_0xc547('0x3f')](_0x11b261['body'],{'include':[{'model':db[_0xc547('0x4d')],'as':_0xc547('0x4a')},{'model':db[_0xc547('0x4d')],'as':_0xc547('0x4c')}]});}return null;})['then'](respondWithResult(_0x2ab720,null))[_0xc547('0x3e')](handleError(_0x2ab720,null));};exports[_0xc547('0x4e')]=function(_0x5c59fe,_0x3d8f4c,_0x256377){var _0x548176='';var _0x17d08d='';return db[_0xc547('0x24')]['findOne']({'where':{'id':_0x5c59fe['params']['id']},'attributes':['id',_0xc547('0x4f'),_0xc547('0x50'),_0xc547('0x51')]})[_0xc547('0x1e')](handleEntityNotFound(_0x3d8f4c,null))['then'](function(_0x3d62d4){if(_0x3d62d4){_0x17d08d=_0x3d62d4[_0xc547('0x4f')];_0x548176=_0x3d62d4[_0xc547('0x50')];var _0x3af035=_0x3d62d4[_0xc547('0x50')][_0xc547('0x52')](-0x1);if(_0x3af035==='/'){_0x548176=_0x548176[_0xc547('0x53')](0x0,_0x548176['lastIndexOf'](_0x3af035));}return rp({'method':_0xc547('0x54'),'uri':util[_0xc547('0x55')](_0xc547('0x56'),_0x548176,_0xc547('0x57')),'headers':{'Authorization':_0xc547('0x58')+_0x3d62d4[_0xc547('0x51')]},'json':!![]});}})[_0xc547('0x1e')](function(_0x3c2000){if(_0x3c2000){var _0x291360=_0x3c2000[_0xc547('0x59')];var _0xba02b1=![];var _0x3d34c7=null;for(_0x3d34c7=0x0;_0x3d34c7<_0x291360[_0xc547('0x2e')];_0x3d34c7++){if(_0x291360[_0x3d34c7][_0xc547('0x5a')]===_0x17d08d){_0xba02b1=!![];}}if(_0xba02b1){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xc547('0x1e')](respondWithResult(_0x3d8f4c,null))['catch'](function(_0x1a6883){var _0x48040c=_0x5c59fe['query'][_0xc547('0x5b')]?0x1f4:_0x1a6883['statusCode']||0x1f4;logger[_0xc547('0x5c')]('getFields,\x20%s,\x20%s,\x20%s',_0xc547('0x4e'),_0x48040c,JSON[_0xc547('0x5d')](_0x1a6883));delete _0x1a6883[_0xc547('0x21')];if(_0x48040c===0x191){_0x48040c=0x190;}_0x3d8f4c['status'](_0x48040c)[_0xc547('0x22')](_0x5c59fe[_0xc547('0x28')][_0xc547('0x5b')]?{'message':_0xc547('0x5e'),'statusCode':_0x1a6883['statusCode']}:_0x1a6883);});}; \ No newline at end of file +var _0x5635=['includeAll','findAll','catch','show','params','keys','include','options','find','create','body','destroy','findOne','FreshsalesConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','FreshsalesAccount'];(function(_0x5a1b31,_0x293ffd){var _0x273ef3=function(_0x12d585){while(--_0x12d585){_0x5a1b31['push'](_0x5a1b31['shift']());}};_0x273ef3(++_0x293ffd);}(_0x5635,0x90));var _0x5563=function(_0x4df53f,_0x161edc){_0x4df53f=_0x4df53f-0x0;var _0x24e733=_0x5635[_0x4df53f];return _0x24e733;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5563('0x0'));var zipdir=require(_0x5563('0x1'));var jsonpatch=require(_0x5563('0x2'));var rp=require(_0x5563('0x3'));var moment=require('moment');var BPromise=require(_0x5563('0x4'));var Mustache=require(_0x5563('0x5'));var util=require(_0x5563('0x6'));var path=require('path');var sox=require(_0x5563('0x7'));var csv=require('to-csv');var ejs=require(_0x5563('0x8'));var fs=require('fs');var fs_extra=require(_0x5563('0x9'));var _=require(_0x5563('0xa'));var squel=require(_0x5563('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5563('0xc'));var querystring=require(_0x5563('0xd'));var Papa=require(_0x5563('0xe'));var Redis=require('ioredis');var authService=require(_0x5563('0xf'));var qs=require(_0x5563('0x10'));var as=require(_0x5563('0x11'));var hardwareService=require(_0x5563('0x12'));var logger=require(_0x5563('0x13'))(_0x5563('0x14'));var utils=require(_0x5563('0x15'));var config=require(_0x5563('0x16'));var licenseUtil=require(_0x5563('0x17'));var db=require(_0x5563('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47ee17,_0x46c53f){_0x46c53f=_0x46c53f||0xcc;return function(_0xb2944a){if(_0xb2944a){return _0x47ee17[_0x5563('0x19')](_0x46c53f);}return _0x47ee17[_0x5563('0x1a')](_0x46c53f)[_0x5563('0x1b')]();};}function respondWithResult(_0x214d9b,_0x1335b8){_0x1335b8=_0x1335b8||0xc8;return function(_0x13f8fd){if(_0x13f8fd){return _0x214d9b['status'](_0x1335b8)[_0x5563('0x1c')](_0x13f8fd);}};}function respondWithFilteredResult(_0x180418,_0x5155eb){return function(_0x512249){if(_0x512249){var _0x4ddf7f=typeof _0x5155eb[_0x5563('0x1d')]===_0x5563('0x1e')&&typeof _0x5155eb[_0x5563('0x1f')]===_0x5563('0x1e');var _0x12d571=_0x512249[_0x5563('0x20')];var _0x3a43c2=_0x4ddf7f?0x0:_0x5155eb['offset'];var _0x37b705=_0x4ddf7f?_0x512249[_0x5563('0x20')]:_0x5155eb['offset']+_0x5155eb[_0x5563('0x1f')];var _0x1bf850;if(_0x37b705>=_0x12d571){_0x37b705=_0x12d571;_0x1bf850=0xc8;}else{_0x1bf850=0xce;}_0x180418['status'](_0x1bf850);return _0x180418[_0x5563('0x21')](_0x5563('0x22'),_0x3a43c2+'-'+_0x37b705+'/'+_0x12d571)[_0x5563('0x1c')](_0x512249);}return null;};}function patchUpdates(_0x24fd0a){return function(_0x3e04ff){try{jsonpatch[_0x5563('0x23')](_0x3e04ff,_0x24fd0a,!![]);}catch(_0xe56e17){return BPromise[_0x5563('0x24')](_0xe56e17);}return _0x3e04ff[_0x5563('0x25')]();};}function saveUpdates(_0x51842e,_0x4693ff){return function(_0x5309e2){if(_0x5309e2){return _0x5309e2[_0x5563('0x26')](_0x51842e)[_0x5563('0x27')](function(_0x5ebe12){return _0x5ebe12;});}return null;};}function removeEntity(_0x218cd9,_0x1745ad){return function(_0x227199){if(_0x227199){return _0x227199['destroy']()['then'](function(){_0x218cd9['status'](0xcc)[_0x5563('0x1b')]();});}};}function handleEntityNotFound(_0x29d444,_0x5273cf){return function(_0x553639){if(!_0x553639){_0x29d444[_0x5563('0x19')](0x194);}return _0x553639;};}function handleError(_0x30014e,_0x4f501c){_0x4f501c=_0x4f501c||0x1f4;return function(_0x3825e8){logger[_0x5563('0x28')](_0x3825e8['stack']);if(_0x3825e8[_0x5563('0x29')]){delete _0x3825e8[_0x5563('0x29')];}_0x30014e['status'](_0x4f501c)['send'](_0x3825e8);};}exports[_0x5563('0x2a')]=function(_0x5e28c8,_0x1ac724){var _0x42ec11={},_0x386ce3={},_0x4f3938={'count':0x0,'rows':[]};var _0x1a56ab=_[_0x5563('0x2b')](db['FreshsalesAccount'][_0x5563('0x2c')],function(_0x4aef01){return{'name':_0x4aef01[_0x5563('0x2d')],'type':_0x4aef01[_0x5563('0x2e')][_0x5563('0x2f')]};});_0x386ce3[_0x5563('0x30')]=_['map'](_0x1a56ab,_0x5563('0x29'));_0x386ce3[_0x5563('0x31')]=_['keys'](_0x5e28c8[_0x5563('0x31')]);_0x386ce3[_0x5563('0x32')]=_[_0x5563('0x33')](_0x386ce3[_0x5563('0x30')],_0x386ce3[_0x5563('0x31')]);_0x42ec11[_0x5563('0x34')]=_[_0x5563('0x33')](_0x386ce3[_0x5563('0x30')],qs[_0x5563('0x35')](_0x5e28c8[_0x5563('0x31')][_0x5563('0x35')]));_0x42ec11[_0x5563('0x34')]=_0x42ec11[_0x5563('0x34')][_0x5563('0x36')]?_0x42ec11[_0x5563('0x34')]:_0x386ce3[_0x5563('0x30')];if(!_0x5e28c8['query'][_0x5563('0x37')](_0x5563('0x38'))){_0x42ec11[_0x5563('0x1f')]=qs[_0x5563('0x1f')](_0x5e28c8['query'][_0x5563('0x1f')]);_0x42ec11['offset']=qs[_0x5563('0x1d')](_0x5e28c8[_0x5563('0x31')][_0x5563('0x1d')]);}_0x42ec11['order']=qs[_0x5563('0x39')](_0x5e28c8['query'][_0x5563('0x39')]);_0x42ec11['where']=qs[_0x5563('0x32')](_[_0x5563('0x3a')](_0x5e28c8[_0x5563('0x31')],_0x386ce3[_0x5563('0x32')]),_0x1a56ab);if(_0x5e28c8[_0x5563('0x31')][_0x5563('0x3b')]){_0x42ec11[_0x5563('0x3c')]=_[_0x5563('0x3d')](_0x42ec11[_0x5563('0x3c')],{'$or':_[_0x5563('0x2b')](_0x1a56ab,function(_0x301837){if(_0x301837['type']!==_0x5563('0x3e')){var _0x351297={};_0x351297[_0x301837[_0x5563('0x29')]]={'$like':'%'+_0x5e28c8[_0x5563('0x31')][_0x5563('0x3b')]+'%'};return _0x351297;}})});}_0x42ec11=_[_0x5563('0x3d')]({},_0x42ec11,_0x5e28c8['options']);var _0x497b67={'where':_0x42ec11[_0x5563('0x3c')]};return db[_0x5563('0x3f')][_0x5563('0x20')](_0x497b67)[_0x5563('0x27')](function(_0x2a1f30){_0x4f3938[_0x5563('0x20')]=_0x2a1f30;if(_0x5e28c8[_0x5563('0x31')][_0x5563('0x40')]){_0x42ec11['include']=[{'all':!![]}];}return db[_0x5563('0x3f')][_0x5563('0x41')](_0x42ec11);})['then'](function(_0xe21d54){_0x4f3938['rows']=_0xe21d54;return _0x4f3938;})['then'](respondWithFilteredResult(_0x1ac724,_0x42ec11))[_0x5563('0x42')](handleError(_0x1ac724,null));};exports[_0x5563('0x43')]=function(_0x886c7,_0x1c7f8f){var _0x35049e={'raw':![],'where':{'id':_0x886c7[_0x5563('0x44')]['id']}},_0x1e902f={};_0x1e902f['model']=_[_0x5563('0x45')](db['FreshsalesAccount'][_0x5563('0x2c')]);_0x1e902f['query']=_[_0x5563('0x45')](_0x886c7['query']);_0x1e902f[_0x5563('0x32')]=_[_0x5563('0x33')](_0x1e902f['model'],_0x1e902f['query']);_0x35049e['attributes']=_[_0x5563('0x33')](_0x1e902f['model'],qs[_0x5563('0x35')](_0x886c7[_0x5563('0x31')]['fields']));_0x35049e[_0x5563('0x34')]=_0x35049e[_0x5563('0x34')][_0x5563('0x36')]?_0x35049e[_0x5563('0x34')]:_0x1e902f['model'];if(_0x886c7[_0x5563('0x31')]['includeAll']){_0x35049e[_0x5563('0x46')]=[{'all':!![]}];}_0x35049e=_[_0x5563('0x3d')]({},_0x35049e,_0x886c7[_0x5563('0x47')]);return db['FreshsalesAccount'][_0x5563('0x48')](_0x35049e)[_0x5563('0x27')](handleEntityNotFound(_0x1c7f8f,null))[_0x5563('0x27')](respondWithResult(_0x1c7f8f,null))['catch'](handleError(_0x1c7f8f,null));};exports[_0x5563('0x49')]=function(_0x3bb0a3,_0x2731e4){return db[_0x5563('0x3f')][_0x5563('0x49')](_0x3bb0a3[_0x5563('0x4a')],{})[_0x5563('0x27')](respondWithResult(_0x2731e4,0xc9))[_0x5563('0x42')](handleError(_0x2731e4,null));};exports[_0x5563('0x26')]=function(_0x4ec6f3,_0x3bcf02){if(_0x4ec6f3[_0x5563('0x4a')]['id']){delete _0x4ec6f3[_0x5563('0x4a')]['id'];}return db[_0x5563('0x3f')][_0x5563('0x48')]({'where':{'id':_0x4ec6f3[_0x5563('0x44')]['id']}})[_0x5563('0x27')](handleEntityNotFound(_0x3bcf02,null))[_0x5563('0x27')](saveUpdates(_0x4ec6f3[_0x5563('0x4a')],null))['then'](respondWithResult(_0x3bcf02,null))['catch'](handleError(_0x3bcf02,null));};exports[_0x5563('0x4b')]=function(_0x354772,_0x3b22de){return db['FreshsalesAccount']['find']({'where':{'id':_0x354772[_0x5563('0x44')]['id']}})[_0x5563('0x27')](handleEntityNotFound(_0x3b22de,null))[_0x5563('0x27')](removeEntity(_0x3b22de,null))[_0x5563('0x42')](handleError(_0x3b22de,null));};exports['getConfigurations']=function(_0x1bd5d7,_0x115664,_0x4c2112){var _0x1bccb5={};var _0x54cd1a={};var _0x17681e;var _0x22036a;return db[_0x5563('0x3f')][_0x5563('0x4c')]({'where':{'id':_0x1bd5d7[_0x5563('0x44')]['id']}})[_0x5563('0x27')](handleEntityNotFound(_0x115664,null))[_0x5563('0x27')](function(_0x5380ee){if(_0x5380ee){_0x17681e=_0x5380ee;_0x54cd1a[_0x5563('0x30')]=_['keys'](db[_0x5563('0x4d')]['rawAttributes']);_0x54cd1a['query']=_[_0x5563('0x45')](_0x1bd5d7[_0x5563('0x31')]);_0x54cd1a['filters']=_[_0x5563('0x33')](_0x54cd1a[_0x5563('0x30')],_0x54cd1a['query']);_0x1bccb5[_0x5563('0x34')]=_[_0x5563('0x33')](_0x54cd1a[_0x5563('0x30')],qs['fields'](_0x1bd5d7[_0x5563('0x31')][_0x5563('0x35')]));_0x1bccb5[_0x5563('0x34')]=_0x1bccb5[_0x5563('0x34')][_0x5563('0x36')]?_0x1bccb5[_0x5563('0x34')]:_0x54cd1a['model'];_0x1bccb5[_0x5563('0x4e')]=qs[_0x5563('0x39')](_0x1bd5d7[_0x5563('0x31')][_0x5563('0x39')]);_0x1bccb5[_0x5563('0x3c')]=qs[_0x5563('0x32')](_['pick'](_0x1bd5d7[_0x5563('0x31')],_0x54cd1a[_0x5563('0x32')]));if(_0x1bd5d7[_0x5563('0x31')]['filter']){_0x1bccb5['where']=_['merge'](_0x1bccb5[_0x5563('0x3c')],{'$or':_[_0x5563('0x2b')](_0x1bccb5[_0x5563('0x34')],function(_0x1377bc){var _0x17c886={};_0x17c886[_0x1377bc]={'$like':'%'+_0x1bd5d7['query'][_0x5563('0x3b')]+'%'};return _0x17c886;})});}_0x1bccb5=_[_0x5563('0x3d')]({},_0x1bccb5,_0x1bd5d7[_0x5563('0x47')]);return _0x17681e[_0x5563('0x4f')](_0x1bccb5);}})[_0x5563('0x27')](function(_0x1aa7c1){if(_0x1aa7c1){_0x22036a=_0x1aa7c1['length'];if(!_0x1bd5d7[_0x5563('0x31')][_0x5563('0x37')](_0x5563('0x38'))){_0x1bccb5[_0x5563('0x1f')]=qs[_0x5563('0x1f')](_0x1bd5d7[_0x5563('0x31')]['limit']);_0x1bccb5[_0x5563('0x1d')]=qs['offset'](_0x1bd5d7[_0x5563('0x31')][_0x5563('0x1d')]);}return _0x17681e[_0x5563('0x4f')](_0x1bccb5);}})[_0x5563('0x27')](function(_0x27ea4e){if(_0x27ea4e){return _0x27ea4e?{'count':_0x22036a,'rows':_0x27ea4e}:null;}})[_0x5563('0x27')](respondWithResult(_0x115664,null))[_0x5563('0x42')](handleError(_0x115664,null));};exports[_0x5563('0x50')]=function(_0x10a89c,_0x3cbc28,_0x4e76ab){if(_0x10a89c['body']['id']){delete _0x10a89c['body']['id'];}return db['FreshsalesAccount'][_0x5563('0x4c')]({'where':{'id':_0x10a89c[_0x5563('0x44')]['id']}})[_0x5563('0x27')](handleEntityNotFound(_0x3cbc28,null))[_0x5563('0x27')](function(_0x3c1410){if(_0x3c1410){_0x10a89c[_0x5563('0x4a')][_0x5563('0x51')]=_0x3c1410['id'];_0x10a89c[_0x5563('0x4a')][_0x5563('0x52')]=integrations['getSubjects'](_0x10a89c[_0x5563('0x4a')][_0x5563('0x53')],_0x10a89c['body']['type']);_0x10a89c[_0x5563('0x4a')][_0x5563('0x54')]=integrations[_0x5563('0x55')](_0x10a89c[_0x5563('0x4a')]['channel'],_0x10a89c[_0x5563('0x4a')]['type']);return db[_0x5563('0x4d')][_0x5563('0x49')](_0x10a89c['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x5563('0x54')}]});}return null;})[_0x5563('0x27')](respondWithResult(_0x3cbc28,null))[_0x5563('0x42')](handleError(_0x3cbc28,null));};exports[_0x5563('0x56')]=function(_0x158f22,_0x241644,_0x5de6c7){var _0xaa8d84='';var _0x2dd175='';return db[_0x5563('0x3f')]['findOne']({'where':{'id':_0x158f22[_0x5563('0x44')]['id']},'attributes':['id','username','remoteUri',_0x5563('0x57')]})[_0x5563('0x27')](handleEntityNotFound(_0x241644,null))[_0x5563('0x27')](function(_0x320fe1){if(_0x320fe1){_0x2dd175=_0x320fe1['username'];_0xaa8d84=_0x320fe1[_0x5563('0x58')];var _0x5c2f30=_0x320fe1[_0x5563('0x58')][_0x5563('0x59')](-0x1);if(_0x5c2f30==='/'){_0xaa8d84=_0xaa8d84[_0x5563('0x5a')](0x0,_0xaa8d84[_0x5563('0x5b')](_0x5c2f30));}return rp({'method':'GET','uri':util[_0x5563('0x5c')]('%s%s',_0xaa8d84,_0x5563('0x5d')),'headers':{'Authorization':_0x5563('0x5e')+_0x320fe1[_0x5563('0x57')]},'json':!![]});}})['then'](function(_0x23c1c1){if(_0x23c1c1){var _0x147a73=_0x23c1c1[_0x5563('0x5f')];var _0xb0cc70=![];var _0xdc919e=null;for(_0xdc919e=0x0;_0xdc919e<_0x147a73[_0x5563('0x36')];_0xdc919e++){if(_0x147a73[_0xdc919e][_0x5563('0x60')]===_0x2dd175){_0xb0cc70=!![];}}if(_0xb0cc70){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5563('0x61')});}}})['then'](respondWithResult(_0x241644,null))[_0x5563('0x42')](function(_0x1b264d){var _0xd0a375=_0x158f22[_0x5563('0x31')]['test']?0x1f4:_0x1b264d[_0x5563('0x62')]||0x1f4;logger[_0x5563('0x28')](_0x5563('0x63'),'getFields',_0xd0a375,JSON[_0x5563('0x64')](_0x1b264d));delete _0x1b264d[_0x5563('0x29')];if(_0xd0a375===0x191){_0xd0a375=0x190;}_0x241644[_0x5563('0x1a')](_0xd0a375)[_0x5563('0x65')](_0x158f22[_0x5563('0x31')][_0x5563('0x66')]?{'message':_0x5563('0x67'),'statusCode':_0x1b264d[_0x5563('0x62')]}:_0x1b264d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2c114e7..c2e69d8 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 _0x5f2f=['../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util'];(function(_0x3804b3,_0x4c4ef7){var _0xeac5e1=function(_0x1b88cc){while(--_0x1b88cc){_0x3804b3['push'](_0x3804b3['shift']());}};_0xeac5e1(++_0x4c4ef7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3081e1,_0x241403){_0x3081e1=_0x3081e1-0x0;var _0x291dc7=_0x5f2f[_0x3081e1];return _0x291dc7;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));var integrations=require(_0xf5f2('0x9'));module[_0xf5f2('0xa')]=function(_0x3eebf6,_0x3133bc){return _0x3eebf6[_0xf5f2('0xb')]('FreshsalesAccount',attributes,{'tableName':_0xf5f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x90b1,0x1bb));var _0x190b=function(_0x184a95,_0x500731){_0x184a95=_0x184a95-0x0;var _0x55eadf=_0x90b1[_0x184a95];return _0x55eadf;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27ff8c,_0x34a689){return _0x27ff8c[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index c25409b..bdbe828 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 _0x0598=['map','model','then','ShowFreshsalesAccount','find','where','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include'];(function(_0x19eed,_0x281332){var _0x5457ff=function(_0x34f7ab){while(--_0x34f7ab){_0x19eed['push'](_0x19eed['shift']());}};_0x5457ff(++_0x281332);}(_0x0598,0x92));var _0x8059=function(_0x2bb9da,_0x13d521){_0x2bb9da=_0x2bb9da-0x0;var _0x32eedf=_0x0598[_0x2bb9da];return _0x32eedf;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['findAll']({'raw':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55['options'][_0x8059('0x12')]===undefined?!![]:![]:!![],'where':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x11')]['where']||null:null,'attributes':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55[_0x8059('0x11')][_0x8059('0x13')]||null:null,'limit':_0x4b6d55['options']?_0x4b6d55['options'][_0x8059('0x14')]||null:null,'include':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55[_0x8059('0x11')][_0x8059('0x15')]?_['map'](_0x4b6d55[_0x8059('0x11')][_0x8059('0x15')],function(_0x3da080){return{'model':db[_0x3da080['model']],'as':_0x3da080['as'],'attributes':_0x3da080[_0x8059('0x13')],'include':_0x3da080[_0x8059('0x15')]?_[_0x8059('0x16')](_0x3da080[_0x8059('0x15')],function(_0x59d3a6){return{'model':db[_0x59d3a6[_0x8059('0x17')]],'as':_0x59d3a6['as'],'attributes':_0x59d3a6[_0x8059('0x13')],'include':_0x59d3a6[_0x8059('0x15')]?_[_0x8059('0x16')](_0x59d3a6[_0x8059('0x15')],function(_0x54b88b){return{'model':db[_0x54b88b[_0x8059('0x17')]],'as':_0x54b88b['as'],'attributes':_0x54b88b[_0x8059('0x13')]};}):[]};}):[]};}):[]:[]})[_0x8059('0x18')](function(_0x4a294f){logger['info']('GetFreshsalesAccount',_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON[_0x8059('0xb')](_0x4a294f));_0x2bb670(_0x4a294f);})[_0x8059('0xe')](function(_0x59abe9){logger[_0x8059('0xc')]('GetFreshsalesAccount',_0x59abe9[_0x8059('0xd')],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x59abe9['message']));});});};exports[_0x8059('0x19')]=function(_0x1aead2){var _0x30aac2=this;return new Promise(function(_0x260ba8,_0x2799b7){return db[_0x8059('0x10')][_0x8059('0x1a')]({'raw':_0x1aead2[_0x8059('0x11')]?_0x1aead2['options'][_0x8059('0x12')]===undefined?!![]:![]:!![],'where':_0x1aead2[_0x8059('0x11')]?_0x1aead2[_0x8059('0x11')][_0x8059('0x1b')]||null:null,'attributes':_0x1aead2[_0x8059('0x11')]?_0x1aead2['options'][_0x8059('0x13')]||null:null,'include':_0x1aead2[_0x8059('0x11')]?_0x1aead2[_0x8059('0x11')][_0x8059('0x15')]?_[_0x8059('0x16')](_0x1aead2[_0x8059('0x11')][_0x8059('0x15')],function(_0x175d57){return{'model':db[_0x175d57[_0x8059('0x17')]],'as':_0x175d57['as'],'attributes':_0x175d57[_0x8059('0x13')],'include':_0x175d57['include']?_[_0x8059('0x16')](_0x175d57['include'],function(_0x24194d){return{'model':db[_0x24194d['model']],'as':_0x24194d['as'],'attributes':_0x24194d['attributes'],'include':_0x24194d[_0x8059('0x15')]?_['map'](_0x24194d[_0x8059('0x15')],function(_0x50c745){return{'model':db[_0x50c745[_0x8059('0x17')]],'as':_0x50c745['as'],'attributes':_0x50c745['attributes']};}):[]};}):[]};}):[]:[]})[_0x8059('0x18')](function(_0x5c4aa0){logger['info'](_0x8059('0x19'),_0x1aead2);logger[_0x8059('0xa')](_0x8059('0x19'),_0x1aead2,JSON['stringify'](_0x5c4aa0));_0x260ba8(_0x5c4aa0);})[_0x8059('0xe')](function(_0x4927c9){logger[_0x8059('0xc')]('ShowFreshsalesAccount',_0x4927c9[_0x8059('0xd')],_0x1aead2);_0x2799b7(_0x30aac2[_0x8059('0xc')](0x1f4,_0x4927c9[_0x8059('0xd')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c212e,_0x3645d9){_0x3c212e=_0x3c212e-0x0;var _0x423877=_0x5f2f[_0x3c212e];return _0x423877;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetFreshsalesAccount',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetFreshsalesAccount',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowFreshsalesAccount',_0x153924);logger[_0xf5f2('0xf')]('ShowFreshsalesAccount',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowFreshsalesAccount',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c3c6e3b..9f3147e 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 _0x9e6e=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0x9e6e,0x1dc));var _0xe9e6=function(_0x23e63d,_0x51def3){_0x23e63d=_0x23e63d-0x0;var _0x1caa61=_0x9e6e[_0x23e63d];return _0x1caa61;};'use strict';var multer=require(_0xe9e6('0x0'));var util=require(_0xe9e6('0x1'));var path=require(_0xe9e6('0x2'));var timeout=require('connect-timeout');var express=require(_0xe9e6('0x3'));var router=express[_0xe9e6('0x4')]();var fs_extra=require(_0xe9e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe9e6('0x6'));var config=require(_0xe9e6('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xe9e6('0x8')]('/',auth[_0xe9e6('0x9')](),controller[_0xe9e6('0xa')]);router['get'](_0xe9e6('0xb'),auth[_0xe9e6('0x9')](),controller[_0xe9e6('0xc')]);router['get']('/:id/subjects',auth[_0xe9e6('0x9')](),controller[_0xe9e6('0xd')]);router['get'](_0xe9e6('0xe'),auth['isAuthenticated'](),controller[_0xe9e6('0xf')]);router[_0xe9e6('0x8')](_0xe9e6('0x10'),auth['isAuthenticated'](),controller[_0xe9e6('0x11')]);router[_0xe9e6('0x12')]('/',auth[_0xe9e6('0x9')](),controller[_0xe9e6('0x13')]);router[_0xe9e6('0x14')](_0xe9e6('0xb'),auth[_0xe9e6('0x9')](),controller[_0xe9e6('0x15')]);router[_0xe9e6('0x16')](_0xe9e6('0xb'),auth[_0xe9e6('0x9')](),controller[_0xe9e6('0x17')]);module[_0xe9e6('0x18')]=router; \ No newline at end of file +var _0x230f=['post','create','put','update','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x12162e,_0x4ce43d){var _0x313314=function(_0x237b8c){while(--_0x237b8c){_0x12162e['push'](_0x12162e['shift']());}};_0x313314(++_0x4ce43d);}(_0x230f,0x1bb));var _0xf230=function(_0x3496d3,_0x4467a2){_0x3496d3=_0x3496d3-0x0;var _0x509096=_0x230f[_0x3496d3];return _0x509096;};'use strict';var multer=require(_0xf230('0x0'));var util=require(_0xf230('0x1'));var path=require(_0xf230('0x2'));var timeout=require(_0xf230('0x3'));var express=require(_0xf230('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf230('0x5'));var interaction=require(_0xf230('0x6'));var config=require(_0xf230('0x7'));var controller=require(_0xf230('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf230('0x9')]);router[_0xf230('0xa')]('/:id',auth[_0xf230('0xb')](),controller[_0xf230('0xc')]);router['get'](_0xf230('0xd'),auth[_0xf230('0xb')](),controller[_0xf230('0xe')]);router['get'](_0xf230('0xf'),auth[_0xf230('0xb')](),controller[_0xf230('0x10')]);router[_0xf230('0xa')]('/:id/fields',auth[_0xf230('0xb')](),controller['getFields']);router[_0xf230('0x11')]('/',auth[_0xf230('0xb')](),controller[_0xf230('0x12')]);router[_0xf230('0x13')]('/:id',auth[_0xf230('0xb')](),controller[_0xf230('0x14')]);router['delete'](_0xf230('0x15'),auth['isAuthenticated'](),controller[_0xf230('0x16')]);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 00ba29d..f2f34be 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 _0x80fe=['exports','STRING','sequelize'];(function(_0x52b174,_0x3e8497){var _0x227f62=function(_0x7c13e4){while(--_0x7c13e4){_0x52b174['push'](_0x52b174['shift']());}};_0x227f62(++_0x3e8497);}(_0x80fe,0x13d));var _0xe80f=function(_0x1abbfd,_0x492c45){_0x1abbfd=_0x1abbfd-0x0;var _0x285585=_0x80fe[_0x1abbfd];return _0x285585;};'use strict';var Sequelize=require(_0xe80f('0x0'));module[_0xe80f('0x1')]={'name':{'type':Sequelize[_0xe80f('0x2')]},'description':{'type':Sequelize[_0xe80f('0x2')]}}; \ No newline at end of file +var _0xb89f=['sequelize','STRING'];(function(_0x48befb,_0x502bb7){var _0x45eb9b=function(_0x5428eb){while(--_0x5428eb){_0x48befb['push'](_0x48befb['shift']());}};_0x45eb9b(++_0x502bb7);}(_0xb89f,0x76));var _0xfb89=function(_0x256450,_0x2b1631){_0x256450=_0x256450-0x0;var _0x4d99af=_0xb89f[_0x256450];return _0x4d99af;};'use strict';var Sequelize=require(_0xfb89('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb89('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9e17d71..d134061 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 _0x123b=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','getSubjects','FreshsalesField','getDescriptions','findOne','getFields'];(function(_0x44b362,_0x1b5fd9){var _0x38b45c=function(_0x163919){while(--_0x163919){_0x44b362['push'](_0x44b362['shift']());}};_0x38b45c(++_0x1b5fd9);}(_0x123b,0x195));var _0xb123=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x123b[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb123('0x0'));var jsonpatch=require(_0xb123('0x1'));var rp=require(_0xb123('0x2'));var moment=require('moment');var BPromise=require(_0xb123('0x3'));var Mustache=require(_0xb123('0x4'));var util=require(_0xb123('0x5'));var path=require(_0xb123('0x6'));var sox=require('sox');var csv=require(_0xb123('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb123('0x8'));var _=require(_0xb123('0x9'));var squel=require(_0xb123('0xa'));var crypto=require(_0xb123('0xb'));var jsforce=require(_0xb123('0xc'));var deskjs=require(_0xb123('0xd'));var toCsv=require(_0xb123('0x7'));var querystring=require(_0xb123('0xe'));var Papa=require('papaparse');var Redis=require(_0xb123('0xf'));var authService=require(_0xb123('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb123('0x11'));var hardwareService=require(_0xb123('0x12'));var logger=require(_0xb123('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb123('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb123('0x15'))['db'];function respondWithStatusCode(_0x5a9d02,_0x96a298){_0x96a298=_0x96a298||0xcc;return function(_0x4c5153){if(_0x4c5153){return _0x5a9d02[_0xb123('0x16')](_0x96a298);}return _0x5a9d02[_0xb123('0x17')](_0x96a298)[_0xb123('0x18')]();};}function respondWithResult(_0x30955d,_0x5b9db3){_0x5b9db3=_0x5b9db3||0xc8;return function(_0x1e5c9b){if(_0x1e5c9b){return _0x30955d[_0xb123('0x17')](_0x5b9db3)[_0xb123('0x19')](_0x1e5c9b);}};}function respondWithFilteredResult(_0x1cfb93,_0x56855a){return function(_0x17155d){if(_0x17155d){var _0xfe3250=typeof _0x56855a['offset']===_0xb123('0x1a')&&typeof _0x56855a['limit']===_0xb123('0x1a');var _0x121e0d=_0x17155d['count'];var _0x45312e=_0xfe3250?0x0:_0x56855a[_0xb123('0x1b')];var _0x1506c1=_0xfe3250?_0x17155d[_0xb123('0x1c')]:_0x56855a[_0xb123('0x1b')]+_0x56855a[_0xb123('0x1d')];var _0x488906;if(_0x1506c1>=_0x121e0d){_0x1506c1=_0x121e0d;_0x488906=0xc8;}else{_0x488906=0xce;}_0x1cfb93[_0xb123('0x17')](_0x488906);return _0x1cfb93[_0xb123('0x1e')](_0xb123('0x1f'),_0x45312e+'-'+_0x1506c1+'/'+_0x121e0d)[_0xb123('0x19')](_0x17155d);}return null;};}function patchUpdates(_0x39f883){return function(_0x2f5ac8){try{jsonpatch[_0xb123('0x20')](_0x2f5ac8,_0x39f883,!![]);}catch(_0x4ef7bc){return BPromise['reject'](_0x4ef7bc);}return _0x2f5ac8[_0xb123('0x21')]();};}function saveUpdates(_0x547830,_0x2e332d){return function(_0x41ffbd){if(_0x41ffbd){return _0x41ffbd[_0xb123('0x22')](_0x547830)['then'](function(_0x37e3f6){return _0x37e3f6;});}return null;};}function removeEntity(_0x3ff831,_0x56c4de){return function(_0x1335ec){if(_0x1335ec){return _0x1335ec[_0xb123('0x23')]()['then'](function(){_0x3ff831[_0xb123('0x17')](0xcc)[_0xb123('0x18')]();});}};}function handleEntityNotFound(_0x545508,_0x4f0c9d){return function(_0x591876){if(!_0x591876){_0x545508[_0xb123('0x16')](0x194);}return _0x591876;};}function handleError(_0x587047,_0x2a41d1){_0x2a41d1=_0x2a41d1||0x1f4;return function(_0x39e603){logger[_0xb123('0x24')](_0x39e603[_0xb123('0x25')]);if(_0x39e603[_0xb123('0x26')]){delete _0x39e603[_0xb123('0x26')];}_0x587047[_0xb123('0x17')](_0x2a41d1)[_0xb123('0x27')](_0x39e603);};}exports[_0xb123('0x28')]=function(_0x168508,_0x1dbaec){var _0x193e6c={},_0x36084e={},_0x10a6fd={'count':0x0,'rows':[]};var _0x11cfd4=_[_0xb123('0x29')](db[_0xb123('0x2a')][_0xb123('0x2b')],function(_0x1f022a){return{'name':_0x1f022a[_0xb123('0x2c')],'type':_0x1f022a[_0xb123('0x2d')][_0xb123('0x2e')]};});_0x36084e[_0xb123('0x2f')]=_[_0xb123('0x29')](_0x11cfd4,_0xb123('0x26'));_0x36084e[_0xb123('0x30')]=_[_0xb123('0x31')](_0x168508[_0xb123('0x30')]);_0x36084e[_0xb123('0x32')]=_['intersection'](_0x36084e[_0xb123('0x2f')],_0x36084e['query']);_0x193e6c[_0xb123('0x33')]=_[_0xb123('0x34')](_0x36084e[_0xb123('0x2f')],qs[_0xb123('0x35')](_0x168508[_0xb123('0x30')][_0xb123('0x35')]));_0x193e6c[_0xb123('0x33')]=_0x193e6c[_0xb123('0x33')][_0xb123('0x36')]?_0x193e6c[_0xb123('0x33')]:_0x36084e[_0xb123('0x2f')];if(!_0x168508[_0xb123('0x30')][_0xb123('0x37')](_0xb123('0x38'))){_0x193e6c[_0xb123('0x1d')]=qs['limit'](_0x168508[_0xb123('0x30')][_0xb123('0x1d')]);_0x193e6c['offset']=qs['offset'](_0x168508[_0xb123('0x30')]['offset']);}_0x193e6c[_0xb123('0x39')]=qs[_0xb123('0x3a')](_0x168508[_0xb123('0x30')][_0xb123('0x3a')]);_0x193e6c[_0xb123('0x3b')]=qs[_0xb123('0x32')](_[_0xb123('0x3c')](_0x168508['query'],_0x36084e[_0xb123('0x32')]),_0x11cfd4);if(_0x168508['query'][_0xb123('0x3d')]){_0x193e6c[_0xb123('0x3b')]=_[_0xb123('0x3e')](_0x193e6c[_0xb123('0x3b')],{'$or':_[_0xb123('0x29')](_0x11cfd4,function(_0xf9654b){if(_0xf9654b['type']!==_0xb123('0x3f')){var _0x425d30={};_0x425d30[_0xf9654b['name']]={'$like':'%'+_0x168508[_0xb123('0x30')][_0xb123('0x3d')]+'%'};return _0x425d30;}})});}_0x193e6c=_[_0xb123('0x3e')]({},_0x193e6c,_0x168508[_0xb123('0x40')]);var _0x3860e9={'where':_0x193e6c[_0xb123('0x3b')]};return db[_0xb123('0x2a')]['count'](_0x3860e9)[_0xb123('0x41')](function(_0x473a26){_0x10a6fd[_0xb123('0x1c')]=_0x473a26;if(_0x168508[_0xb123('0x30')][_0xb123('0x42')]){_0x193e6c[_0xb123('0x43')]=[{'all':!![]}];}return db[_0xb123('0x2a')][_0xb123('0x44')](_0x193e6c);})[_0xb123('0x41')](function(_0x4553c5){_0x10a6fd[_0xb123('0x45')]=_0x4553c5;return _0x10a6fd;})[_0xb123('0x41')](respondWithFilteredResult(_0x1dbaec,_0x193e6c))[_0xb123('0x46')](handleError(_0x1dbaec,null));};exports[_0xb123('0x47')]=function(_0x20b22d,_0x464cb3){var _0x4b853c={'raw':![],'where':{'id':_0x20b22d[_0xb123('0x48')]['id']}},_0x5d3919={};_0x5d3919['model']=_[_0xb123('0x31')](db[_0xb123('0x2a')][_0xb123('0x2b')]);_0x5d3919[_0xb123('0x30')]=_[_0xb123('0x31')](_0x20b22d[_0xb123('0x30')]);_0x5d3919[_0xb123('0x32')]=_[_0xb123('0x34')](_0x5d3919[_0xb123('0x2f')],_0x5d3919[_0xb123('0x30')]);_0x4b853c[_0xb123('0x33')]=_[_0xb123('0x34')](_0x5d3919[_0xb123('0x2f')],qs['fields'](_0x20b22d[_0xb123('0x30')][_0xb123('0x35')]));_0x4b853c[_0xb123('0x33')]=_0x4b853c[_0xb123('0x33')][_0xb123('0x36')]?_0x4b853c[_0xb123('0x33')]:_0x5d3919[_0xb123('0x2f')];if(_0x20b22d[_0xb123('0x30')]['includeAll']){_0x4b853c[_0xb123('0x43')]=[{'all':!![]}];}_0x4b853c=_[_0xb123('0x3e')]({},_0x4b853c,_0x20b22d[_0xb123('0x40')]);return db[_0xb123('0x2a')][_0xb123('0x49')](_0x4b853c)['then'](handleEntityNotFound(_0x464cb3,null))[_0xb123('0x41')](respondWithResult(_0x464cb3,null))[_0xb123('0x46')](handleError(_0x464cb3,null));};exports['create']=function(_0x2a9089,_0x3d9608){return db[_0xb123('0x2a')][_0xb123('0x4a')](_0x2a9089[_0xb123('0x4b')],{})['then'](respondWithResult(_0x3d9608,0xc9))[_0xb123('0x46')](handleError(_0x3d9608,null));};exports['update']=function(_0x178ed1,_0x32c61f){if(_0x178ed1[_0xb123('0x4b')]['id']){delete _0x178ed1[_0xb123('0x4b')]['id'];}return db[_0xb123('0x2a')][_0xb123('0x49')]({'where':{'id':_0x178ed1[_0xb123('0x48')]['id']}})[_0xb123('0x41')](handleEntityNotFound(_0x32c61f,null))[_0xb123('0x41')](saveUpdates(_0x178ed1[_0xb123('0x4b')],null))[_0xb123('0x41')](respondWithResult(_0x32c61f,null))[_0xb123('0x46')](handleError(_0x32c61f,null));};exports[_0xb123('0x23')]=function(_0x479ca1,_0x5c290e){return db[_0xb123('0x2a')]['find']({'where':{'id':_0x479ca1[_0xb123('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c290e,null))[_0xb123('0x41')](removeEntity(_0x5c290e,null))[_0xb123('0x46')](handleError(_0x5c290e,null));};exports[_0xb123('0x4c')]=function(_0x2c966a,_0x56ea7d,_0x1f13d6){var _0x4faf9a={};var _0x5197df={};var _0x5d4566;var _0x1b1266;return db[_0xb123('0x2a')]['findOne']({'where':{'id':_0x2c966a[_0xb123('0x48')]['id']}})[_0xb123('0x41')](handleEntityNotFound(_0x56ea7d,null))[_0xb123('0x41')](function(_0x24f725){if(_0x24f725){_0x5d4566=_0x24f725;_0x5197df[_0xb123('0x2f')]=_['keys'](db[_0xb123('0x4d')][_0xb123('0x2b')]);_0x5197df[_0xb123('0x30')]=_['keys'](_0x2c966a['query']);_0x5197df[_0xb123('0x32')]=_['intersection'](_0x5197df['model'],_0x5197df[_0xb123('0x30')]);_0x4faf9a[_0xb123('0x33')]=_[_0xb123('0x34')](_0x5197df['model'],qs[_0xb123('0x35')](_0x2c966a[_0xb123('0x30')][_0xb123('0x35')]));_0x4faf9a[_0xb123('0x33')]=_0x4faf9a['attributes']['length']?_0x4faf9a[_0xb123('0x33')]:_0x5197df['model'];_0x4faf9a[_0xb123('0x39')]=qs[_0xb123('0x3a')](_0x2c966a[_0xb123('0x30')][_0xb123('0x3a')]);_0x4faf9a[_0xb123('0x3b')]=qs[_0xb123('0x32')](_['pick'](_0x2c966a[_0xb123('0x30')],_0x5197df[_0xb123('0x32')]));if(_0x2c966a['query'][_0xb123('0x3d')]){_0x4faf9a[_0xb123('0x3b')]=_[_0xb123('0x3e')](_0x4faf9a[_0xb123('0x3b')],{'$or':_['map'](_0x4faf9a[_0xb123('0x33')],function(_0x482508){var _0x3e127={};_0x3e127[_0x482508]={'$like':'%'+_0x2c966a[_0xb123('0x30')]['filter']+'%'};return _0x3e127;})});}_0x4faf9a=_['merge']({},_0x4faf9a,_0x2c966a[_0xb123('0x40')]);return _0x5d4566[_0xb123('0x4c')](_0x4faf9a);}})[_0xb123('0x41')](function(_0x2f1ba6){if(_0x2f1ba6){_0x1b1266=_0x2f1ba6[_0xb123('0x36')];if(!_0x2c966a[_0xb123('0x30')]['hasOwnProperty']('nolimit')){_0x4faf9a[_0xb123('0x1d')]=qs[_0xb123('0x1d')](_0x2c966a['query'][_0xb123('0x1d')]);_0x4faf9a[_0xb123('0x1b')]=qs[_0xb123('0x1b')](_0x2c966a[_0xb123('0x30')][_0xb123('0x1b')]);}return _0x5d4566[_0xb123('0x4c')](_0x4faf9a);}})[_0xb123('0x41')](function(_0x45e00c){if(_0x45e00c){return _0x45e00c?{'count':_0x1b1266,'rows':_0x45e00c}:null;}})[_0xb123('0x41')](respondWithResult(_0x56ea7d,null))[_0xb123('0x46')](handleError(_0x56ea7d,null));};exports[_0xb123('0x4e')]=function(_0x197a0d,_0x27c476,_0x5933a6){var _0x1abcba={};var _0x1c4f97={};var _0x53270b;var _0x4af326;return db[_0xb123('0x2a')][_0xb123('0x4f')]({'where':{'id':_0x197a0d['params']['id']}})['then'](handleEntityNotFound(_0x27c476,null))['then'](function(_0x11297b){if(_0x11297b){_0x53270b=_0x11297b;_0x1c4f97[_0xb123('0x2f')]=_[_0xb123('0x31')](db[_0xb123('0x4d')]['rawAttributes']);_0x1c4f97[_0xb123('0x30')]=_['keys'](_0x197a0d[_0xb123('0x30')]);_0x1c4f97[_0xb123('0x32')]=_[_0xb123('0x34')](_0x1c4f97[_0xb123('0x2f')],_0x1c4f97[_0xb123('0x30')]);_0x1abcba[_0xb123('0x33')]=_[_0xb123('0x34')](_0x1c4f97[_0xb123('0x2f')],qs['fields'](_0x197a0d[_0xb123('0x30')]['fields']));_0x1abcba['attributes']=_0x1abcba[_0xb123('0x33')]['length']?_0x1abcba['attributes']:_0x1c4f97[_0xb123('0x2f')];_0x1abcba[_0xb123('0x39')]=qs['sort'](_0x197a0d[_0xb123('0x30')][_0xb123('0x3a')]);_0x1abcba[_0xb123('0x3b')]=qs[_0xb123('0x32')](_[_0xb123('0x3c')](_0x197a0d[_0xb123('0x30')],_0x1c4f97[_0xb123('0x32')]));if(_0x197a0d[_0xb123('0x30')][_0xb123('0x3d')]){_0x1abcba['where']=_[_0xb123('0x3e')](_0x1abcba[_0xb123('0x3b')],{'$or':_[_0xb123('0x29')](_0x1abcba[_0xb123('0x33')],function(_0x2772ec){var _0x3465e1={};_0x3465e1[_0x2772ec]={'$like':'%'+_0x197a0d[_0xb123('0x30')]['filter']+'%'};return _0x3465e1;})});}_0x1abcba=_['merge']({},_0x1abcba,_0x197a0d['options']);return _0x53270b['getDescriptions'](_0x1abcba);}})[_0xb123('0x41')](function(_0x4b6084){if(_0x4b6084){_0x4af326=_0x4b6084[_0xb123('0x36')];if(!_0x197a0d[_0xb123('0x30')][_0xb123('0x37')]('nolimit')){_0x1abcba[_0xb123('0x1d')]=qs[_0xb123('0x1d')](_0x197a0d[_0xb123('0x30')]['limit']);_0x1abcba[_0xb123('0x1b')]=qs['offset'](_0x197a0d[_0xb123('0x30')][_0xb123('0x1b')]);}return _0x53270b[_0xb123('0x4e')](_0x1abcba);}})[_0xb123('0x41')](function(_0xd3b3f){if(_0xd3b3f){return _0xd3b3f?{'count':_0x4af326,'rows':_0xd3b3f}:null;}})[_0xb123('0x41')](respondWithResult(_0x27c476,null))[_0xb123('0x46')](handleError(_0x27c476,null));};exports[_0xb123('0x50')]=function(_0x4892f8,_0xfaf4a9,_0x465475){var _0x949a6c={};var _0x1839ab={};var _0x5eb879;var _0x4daa8c;return db[_0xb123('0x2a')][_0xb123('0x4f')]({'where':{'id':_0x4892f8[_0xb123('0x48')]['id']}})['then'](handleEntityNotFound(_0xfaf4a9,null))[_0xb123('0x41')](function(_0x3fbc9f){if(_0x3fbc9f){_0x5eb879=_0x3fbc9f;_0x1839ab[_0xb123('0x2f')]=_[_0xb123('0x31')](db['FreshsalesField'][_0xb123('0x2b')]);_0x1839ab[_0xb123('0x30')]=_[_0xb123('0x31')](_0x4892f8['query']);_0x1839ab['filters']=_[_0xb123('0x34')](_0x1839ab['model'],_0x1839ab['query']);_0x949a6c[_0xb123('0x33')]=_[_0xb123('0x34')](_0x1839ab['model'],qs[_0xb123('0x35')](_0x4892f8[_0xb123('0x30')]['fields']));_0x949a6c[_0xb123('0x33')]=_0x949a6c[_0xb123('0x33')]['length']?_0x949a6c[_0xb123('0x33')]:_0x1839ab[_0xb123('0x2f')];_0x949a6c[_0xb123('0x39')]=qs[_0xb123('0x3a')](_0x4892f8[_0xb123('0x30')][_0xb123('0x3a')]);_0x949a6c[_0xb123('0x3b')]=qs[_0xb123('0x32')](_[_0xb123('0x3c')](_0x4892f8[_0xb123('0x30')],_0x1839ab[_0xb123('0x32')]));if(_0x4892f8[_0xb123('0x30')]['filter']){_0x949a6c['where']=_[_0xb123('0x3e')](_0x949a6c[_0xb123('0x3b')],{'$or':_[_0xb123('0x29')](_0x949a6c[_0xb123('0x33')],function(_0x19e236){var _0x4eb7ff={};_0x4eb7ff[_0x19e236]={'$like':'%'+_0x4892f8[_0xb123('0x30')][_0xb123('0x3d')]+'%'};return _0x4eb7ff;})});}_0x949a6c=_['merge']({},_0x949a6c,_0x4892f8[_0xb123('0x40')]);return _0x5eb879[_0xb123('0x50')](_0x949a6c);}})[_0xb123('0x41')](function(_0x54406c){if(_0x54406c){_0x4daa8c=_0x54406c[_0xb123('0x36')];if(!_0x4892f8[_0xb123('0x30')][_0xb123('0x37')](_0xb123('0x38'))){_0x949a6c[_0xb123('0x1d')]=qs['limit'](_0x4892f8[_0xb123('0x30')][_0xb123('0x1d')]);_0x949a6c['offset']=qs[_0xb123('0x1b')](_0x4892f8[_0xb123('0x30')][_0xb123('0x1b')]);}return _0x5eb879[_0xb123('0x50')](_0x949a6c);}})[_0xb123('0x41')](function(_0x3957d6){if(_0x3957d6){return _0x3957d6?{'count':_0x4daa8c,'rows':_0x3957d6}:null;}})[_0xb123('0x41')](respondWithResult(_0xfaf4a9,null))[_0xb123('0x46')](handleError(_0xfaf4a9,null));}; \ No newline at end of file +var _0xbf4c=['mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','type','includeAll','FreshsalesConfiguration','findAll','rows','catch','show','params','find','create','body','getSubjects','findOne','FreshsalesField','filter','options','hasOwnProperty','pick','getDescriptions','getFields','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x18fa61,_0x1d2fb3){var _0x45c0e9=function(_0x93678a){while(--_0x93678a){_0x18fa61['push'](_0x18fa61['shift']());}};_0x45c0e9(++_0x1d2fb3);}(_0xbf4c,0x1d5));var _0xcbf4=function(_0x78e2a4,_0x50bf51){_0x78e2a4=_0x78e2a4-0x0;var _0x307426=_0xbf4c[_0x78e2a4];return _0x307426;};'use strict';var emlformat=require(_0xcbf4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbf4('0x1'));var rp=require(_0xcbf4('0x2'));var moment=require(_0xcbf4('0x3'));var BPromise=require(_0xcbf4('0x4'));var Mustache=require(_0xcbf4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcbf4('0x6'));var csv=require(_0xcbf4('0x7'));var ejs=require(_0xcbf4('0x8'));var fs=require('fs');var fs_extra=require(_0xcbf4('0x9'));var _=require(_0xcbf4('0xa'));var squel=require('squel');var crypto=require(_0xcbf4('0xb'));var jsforce=require(_0xcbf4('0xc'));var deskjs=require(_0xcbf4('0xd'));var toCsv=require(_0xcbf4('0x7'));var querystring=require(_0xcbf4('0xe'));var Papa=require(_0xcbf4('0xf'));var Redis=require('ioredis');var authService=require(_0xcbf4('0x10'));var qs=require(_0xcbf4('0x11'));var as=require(_0xcbf4('0x12'));var hardwareService=require(_0xcbf4('0x13'));var logger=require(_0xcbf4('0x14'))('api');var utils=require(_0xcbf4('0x15'));var config=require(_0xcbf4('0x16'));var licenseUtil=require(_0xcbf4('0x17'));var db=require(_0xcbf4('0x18'))['db'];function respondWithStatusCode(_0x29ecb8,_0x419c88){_0x419c88=_0x419c88||0xcc;return function(_0x111ac0){if(_0x111ac0){return _0x29ecb8[_0xcbf4('0x19')](_0x419c88);}return _0x29ecb8['status'](_0x419c88)[_0xcbf4('0x1a')]();};}function respondWithResult(_0x9ba6da,_0x52f5a5){_0x52f5a5=_0x52f5a5||0xc8;return function(_0x97b6bc){if(_0x97b6bc){return _0x9ba6da[_0xcbf4('0x1b')](_0x52f5a5)[_0xcbf4('0x1c')](_0x97b6bc);}};}function respondWithFilteredResult(_0x5cbeac,_0x26021d){return function(_0x53c429){if(_0x53c429){var _0x3a1ad8=typeof _0x26021d['offset']===_0xcbf4('0x1d')&&typeof _0x26021d[_0xcbf4('0x1e')]===_0xcbf4('0x1d');var _0x50c4d4=_0x53c429[_0xcbf4('0x1f')];var _0x21f0b1=_0x3a1ad8?0x0:_0x26021d[_0xcbf4('0x20')];var _0x283338=_0x3a1ad8?_0x53c429[_0xcbf4('0x1f')]:_0x26021d['offset']+_0x26021d[_0xcbf4('0x1e')];var _0x15f4d5;if(_0x283338>=_0x50c4d4){_0x283338=_0x50c4d4;_0x15f4d5=0xc8;}else{_0x15f4d5=0xce;}_0x5cbeac[_0xcbf4('0x1b')](_0x15f4d5);return _0x5cbeac[_0xcbf4('0x21')](_0xcbf4('0x22'),_0x21f0b1+'-'+_0x283338+'/'+_0x50c4d4)[_0xcbf4('0x1c')](_0x53c429);}return null;};}function patchUpdates(_0x251945){return function(_0x2327e5){try{jsonpatch[_0xcbf4('0x23')](_0x2327e5,_0x251945,!![]);}catch(_0x3dc938){return BPromise[_0xcbf4('0x24')](_0x3dc938);}return _0x2327e5['save']();};}function saveUpdates(_0x403eb5,_0x5efc4c){return function(_0x30b3fe){if(_0x30b3fe){return _0x30b3fe['update'](_0x403eb5)[_0xcbf4('0x25')](function(_0x2d75b2){return _0x2d75b2;});}return null;};}function removeEntity(_0xd4ced9,_0x235c08){return function(_0x1611c9){if(_0x1611c9){return _0x1611c9[_0xcbf4('0x26')]()[_0xcbf4('0x25')](function(){_0xd4ced9['status'](0xcc)[_0xcbf4('0x1a')]();});}};}function handleEntityNotFound(_0x5af3a6,_0x81520e){return function(_0x4cda92){if(!_0x4cda92){_0x5af3a6[_0xcbf4('0x19')](0x194);}return _0x4cda92;};}function handleError(_0x4f8542,_0x1e5431){_0x1e5431=_0x1e5431||0x1f4;return function(_0x5d0292){logger['error'](_0x5d0292[_0xcbf4('0x27')]);if(_0x5d0292[_0xcbf4('0x28')]){delete _0x5d0292['name'];}_0x4f8542[_0xcbf4('0x1b')](_0x1e5431)[_0xcbf4('0x29')](_0x5d0292);};}exports[_0xcbf4('0x2a')]=function(_0xaa5414,_0xbca956){var _0x558a75={},_0x2a4f6b={},_0x359ec6={'count':0x0,'rows':[]};var _0x5780b7=_[_0xcbf4('0x2b')](db['FreshsalesConfiguration'][_0xcbf4('0x2c')],function(_0xacb2e5){return{'name':_0xacb2e5[_0xcbf4('0x2d')],'type':_0xacb2e5['type']['key']};});_0x2a4f6b[_0xcbf4('0x2e')]=_[_0xcbf4('0x2b')](_0x5780b7,'name');_0x2a4f6b[_0xcbf4('0x2f')]=_[_0xcbf4('0x30')](_0xaa5414[_0xcbf4('0x2f')]);_0x2a4f6b[_0xcbf4('0x31')]=_['intersection'](_0x2a4f6b[_0xcbf4('0x2e')],_0x2a4f6b[_0xcbf4('0x2f')]);_0x558a75[_0xcbf4('0x32')]=_[_0xcbf4('0x33')](_0x2a4f6b[_0xcbf4('0x2e')],qs['fields'](_0xaa5414[_0xcbf4('0x2f')][_0xcbf4('0x34')]));_0x558a75['attributes']=_0x558a75[_0xcbf4('0x32')][_0xcbf4('0x35')]?_0x558a75['attributes']:_0x2a4f6b[_0xcbf4('0x2e')];if(!_0xaa5414[_0xcbf4('0x2f')]['hasOwnProperty'](_0xcbf4('0x36'))){_0x558a75[_0xcbf4('0x1e')]=qs[_0xcbf4('0x1e')](_0xaa5414[_0xcbf4('0x2f')][_0xcbf4('0x1e')]);_0x558a75['offset']=qs[_0xcbf4('0x20')](_0xaa5414[_0xcbf4('0x2f')][_0xcbf4('0x20')]);}_0x558a75[_0xcbf4('0x37')]=qs[_0xcbf4('0x38')](_0xaa5414[_0xcbf4('0x2f')][_0xcbf4('0x38')]);_0x558a75[_0xcbf4('0x39')]=qs['filters'](_['pick'](_0xaa5414['query'],_0x2a4f6b[_0xcbf4('0x31')]),_0x5780b7);if(_0xaa5414[_0xcbf4('0x2f')]['filter']){_0x558a75[_0xcbf4('0x39')]=_[_0xcbf4('0x3a')](_0x558a75['where'],{'$or':_['map'](_0x5780b7,function(_0x47d5c2){if(_0x47d5c2[_0xcbf4('0x3b')]!=='VIRTUAL'){var _0x171e85={};_0x171e85[_0x47d5c2[_0xcbf4('0x28')]]={'$like':'%'+_0xaa5414[_0xcbf4('0x2f')]['filter']+'%'};return _0x171e85;}})});}_0x558a75=_[_0xcbf4('0x3a')]({},_0x558a75,_0xaa5414['options']);var _0x48e4f3={'where':_0x558a75[_0xcbf4('0x39')]};return db['FreshsalesConfiguration'][_0xcbf4('0x1f')](_0x48e4f3)[_0xcbf4('0x25')](function(_0x57d8b5){_0x359ec6[_0xcbf4('0x1f')]=_0x57d8b5;if(_0xaa5414[_0xcbf4('0x2f')][_0xcbf4('0x3c')]){_0x558a75['include']=[{'all':!![]}];}return db[_0xcbf4('0x3d')][_0xcbf4('0x3e')](_0x558a75);})[_0xcbf4('0x25')](function(_0x3c895e){_0x359ec6[_0xcbf4('0x3f')]=_0x3c895e;return _0x359ec6;})[_0xcbf4('0x25')](respondWithFilteredResult(_0xbca956,_0x558a75))[_0xcbf4('0x40')](handleError(_0xbca956,null));};exports[_0xcbf4('0x41')]=function(_0x4427ca,_0xbc26e1){var _0x4707c0={'raw':![],'where':{'id':_0x4427ca[_0xcbf4('0x42')]['id']}},_0x161c5b={};_0x161c5b[_0xcbf4('0x2e')]=_[_0xcbf4('0x30')](db[_0xcbf4('0x3d')][_0xcbf4('0x2c')]);_0x161c5b[_0xcbf4('0x2f')]=_[_0xcbf4('0x30')](_0x4427ca[_0xcbf4('0x2f')]);_0x161c5b[_0xcbf4('0x31')]=_['intersection'](_0x161c5b['model'],_0x161c5b[_0xcbf4('0x2f')]);_0x4707c0[_0xcbf4('0x32')]=_[_0xcbf4('0x33')](_0x161c5b[_0xcbf4('0x2e')],qs[_0xcbf4('0x34')](_0x4427ca[_0xcbf4('0x2f')][_0xcbf4('0x34')]));_0x4707c0[_0xcbf4('0x32')]=_0x4707c0[_0xcbf4('0x32')]['length']?_0x4707c0[_0xcbf4('0x32')]:_0x161c5b[_0xcbf4('0x2e')];if(_0x4427ca['query'][_0xcbf4('0x3c')]){_0x4707c0['include']=[{'all':!![]}];}_0x4707c0=_[_0xcbf4('0x3a')]({},_0x4707c0,_0x4427ca['options']);return db[_0xcbf4('0x3d')][_0xcbf4('0x43')](_0x4707c0)[_0xcbf4('0x25')](handleEntityNotFound(_0xbc26e1,null))[_0xcbf4('0x25')](respondWithResult(_0xbc26e1,null))[_0xcbf4('0x40')](handleError(_0xbc26e1,null));};exports[_0xcbf4('0x44')]=function(_0x55fe01,_0x4742e9){return db[_0xcbf4('0x3d')][_0xcbf4('0x44')](_0x55fe01[_0xcbf4('0x45')],{})[_0xcbf4('0x25')](respondWithResult(_0x4742e9,0xc9))[_0xcbf4('0x40')](handleError(_0x4742e9,null));};exports['update']=function(_0x31d256,_0x22b689){if(_0x31d256[_0xcbf4('0x45')]['id']){delete _0x31d256[_0xcbf4('0x45')]['id'];}return db[_0xcbf4('0x3d')][_0xcbf4('0x43')]({'where':{'id':_0x31d256[_0xcbf4('0x42')]['id']}})['then'](handleEntityNotFound(_0x22b689,null))[_0xcbf4('0x25')](saveUpdates(_0x31d256[_0xcbf4('0x45')],null))['then'](respondWithResult(_0x22b689,null))[_0xcbf4('0x40')](handleError(_0x22b689,null));};exports[_0xcbf4('0x26')]=function(_0x304701,_0x1d3271){return db[_0xcbf4('0x3d')][_0xcbf4('0x43')]({'where':{'id':_0x304701[_0xcbf4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d3271,null))['then'](removeEntity(_0x1d3271,null))[_0xcbf4('0x40')](handleError(_0x1d3271,null));};exports[_0xcbf4('0x46')]=function(_0xbf64b8,_0x253a87,_0x216d3d){var _0xec9c15={};var _0x4e18f8={};var _0x2de778;var _0x1e5d84;return db[_0xcbf4('0x3d')][_0xcbf4('0x47')]({'where':{'id':_0xbf64b8[_0xcbf4('0x42')]['id']}})[_0xcbf4('0x25')](handleEntityNotFound(_0x253a87,null))['then'](function(_0x449554){if(_0x449554){_0x2de778=_0x449554;_0x4e18f8[_0xcbf4('0x2e')]=_[_0xcbf4('0x30')](db[_0xcbf4('0x48')][_0xcbf4('0x2c')]);_0x4e18f8[_0xcbf4('0x2f')]=_[_0xcbf4('0x30')](_0xbf64b8[_0xcbf4('0x2f')]);_0x4e18f8['filters']=_['intersection'](_0x4e18f8[_0xcbf4('0x2e')],_0x4e18f8[_0xcbf4('0x2f')]);_0xec9c15[_0xcbf4('0x32')]=_[_0xcbf4('0x33')](_0x4e18f8[_0xcbf4('0x2e')],qs['fields'](_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x34')]));_0xec9c15[_0xcbf4('0x32')]=_0xec9c15[_0xcbf4('0x32')][_0xcbf4('0x35')]?_0xec9c15[_0xcbf4('0x32')]:_0x4e18f8[_0xcbf4('0x2e')];_0xec9c15[_0xcbf4('0x37')]=qs[_0xcbf4('0x38')](_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x38')]);_0xec9c15[_0xcbf4('0x39')]=qs['filters'](_['pick'](_0xbf64b8[_0xcbf4('0x2f')],_0x4e18f8[_0xcbf4('0x31')]));if(_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x49')]){_0xec9c15[_0xcbf4('0x39')]=_['merge'](_0xec9c15[_0xcbf4('0x39')],{'$or':_[_0xcbf4('0x2b')](_0xec9c15[_0xcbf4('0x32')],function(_0x36894b){var _0x1e4554={};_0x1e4554[_0x36894b]={'$like':'%'+_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x49')]+'%'};return _0x1e4554;})});}_0xec9c15=_['merge']({},_0xec9c15,_0xbf64b8[_0xcbf4('0x4a')]);return _0x2de778['getSubjects'](_0xec9c15);}})['then'](function(_0x3f0d57){if(_0x3f0d57){_0x1e5d84=_0x3f0d57['length'];if(!_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x4b')](_0xcbf4('0x36'))){_0xec9c15[_0xcbf4('0x1e')]=qs['limit'](_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x1e')]);_0xec9c15[_0xcbf4('0x20')]=qs[_0xcbf4('0x20')](_0xbf64b8[_0xcbf4('0x2f')][_0xcbf4('0x20')]);}return _0x2de778[_0xcbf4('0x46')](_0xec9c15);}})[_0xcbf4('0x25')](function(_0xf8da79){if(_0xf8da79){return _0xf8da79?{'count':_0x1e5d84,'rows':_0xf8da79}:null;}})[_0xcbf4('0x25')](respondWithResult(_0x253a87,null))[_0xcbf4('0x40')](handleError(_0x253a87,null));};exports['getDescriptions']=function(_0x81d527,_0x40bde1,_0x404619){var _0x3d75dd={};var _0x3fc596={};var _0x374dd5;var _0x439385;return db[_0xcbf4('0x3d')][_0xcbf4('0x47')]({'where':{'id':_0x81d527['params']['id']}})[_0xcbf4('0x25')](handleEntityNotFound(_0x40bde1,null))['then'](function(_0x542fbb){if(_0x542fbb){_0x374dd5=_0x542fbb;_0x3fc596[_0xcbf4('0x2e')]=_['keys'](db['FreshsalesField'][_0xcbf4('0x2c')]);_0x3fc596[_0xcbf4('0x2f')]=_[_0xcbf4('0x30')](_0x81d527[_0xcbf4('0x2f')]);_0x3fc596[_0xcbf4('0x31')]=_['intersection'](_0x3fc596[_0xcbf4('0x2e')],_0x3fc596[_0xcbf4('0x2f')]);_0x3d75dd[_0xcbf4('0x32')]=_[_0xcbf4('0x33')](_0x3fc596[_0xcbf4('0x2e')],qs[_0xcbf4('0x34')](_0x81d527['query'][_0xcbf4('0x34')]));_0x3d75dd[_0xcbf4('0x32')]=_0x3d75dd['attributes'][_0xcbf4('0x35')]?_0x3d75dd['attributes']:_0x3fc596[_0xcbf4('0x2e')];_0x3d75dd['order']=qs[_0xcbf4('0x38')](_0x81d527[_0xcbf4('0x2f')]['sort']);_0x3d75dd[_0xcbf4('0x39')]=qs['filters'](_[_0xcbf4('0x4c')](_0x81d527[_0xcbf4('0x2f')],_0x3fc596[_0xcbf4('0x31')]));if(_0x81d527['query']['filter']){_0x3d75dd[_0xcbf4('0x39')]=_[_0xcbf4('0x3a')](_0x3d75dd[_0xcbf4('0x39')],{'$or':_['map'](_0x3d75dd['attributes'],function(_0x3a8bfc){var _0x5d4d30={};_0x5d4d30[_0x3a8bfc]={'$like':'%'+_0x81d527[_0xcbf4('0x2f')][_0xcbf4('0x49')]+'%'};return _0x5d4d30;})});}_0x3d75dd=_[_0xcbf4('0x3a')]({},_0x3d75dd,_0x81d527['options']);return _0x374dd5[_0xcbf4('0x4d')](_0x3d75dd);}})[_0xcbf4('0x25')](function(_0x4a96db){if(_0x4a96db){_0x439385=_0x4a96db['length'];if(!_0x81d527[_0xcbf4('0x2f')][_0xcbf4('0x4b')]('nolimit')){_0x3d75dd[_0xcbf4('0x1e')]=qs[_0xcbf4('0x1e')](_0x81d527['query'][_0xcbf4('0x1e')]);_0x3d75dd[_0xcbf4('0x20')]=qs['offset'](_0x81d527[_0xcbf4('0x2f')][_0xcbf4('0x20')]);}return _0x374dd5[_0xcbf4('0x4d')](_0x3d75dd);}})['then'](function(_0x446b99){if(_0x446b99){return _0x446b99?{'count':_0x439385,'rows':_0x446b99}:null;}})['then'](respondWithResult(_0x40bde1,null))['catch'](handleError(_0x40bde1,null));};exports[_0xcbf4('0x4e')]=function(_0x13dd18,_0x50f4b2,_0x4d119a){var _0xb8c439={};var _0x345f45={};var _0x2101a6;var _0x403978;return db[_0xcbf4('0x3d')][_0xcbf4('0x47')]({'where':{'id':_0x13dd18[_0xcbf4('0x42')]['id']}})[_0xcbf4('0x25')](handleEntityNotFound(_0x50f4b2,null))[_0xcbf4('0x25')](function(_0x5d008e){if(_0x5d008e){_0x2101a6=_0x5d008e;_0x345f45[_0xcbf4('0x2e')]=_[_0xcbf4('0x30')](db['FreshsalesField'][_0xcbf4('0x2c')]);_0x345f45[_0xcbf4('0x2f')]=_['keys'](_0x13dd18[_0xcbf4('0x2f')]);_0x345f45[_0xcbf4('0x31')]=_['intersection'](_0x345f45[_0xcbf4('0x2e')],_0x345f45[_0xcbf4('0x2f')]);_0xb8c439[_0xcbf4('0x32')]=_[_0xcbf4('0x33')](_0x345f45['model'],qs['fields'](_0x13dd18[_0xcbf4('0x2f')][_0xcbf4('0x34')]));_0xb8c439[_0xcbf4('0x32')]=_0xb8c439[_0xcbf4('0x32')][_0xcbf4('0x35')]?_0xb8c439[_0xcbf4('0x32')]:_0x345f45[_0xcbf4('0x2e')];_0xb8c439['order']=qs['sort'](_0x13dd18['query']['sort']);_0xb8c439[_0xcbf4('0x39')]=qs['filters'](_[_0xcbf4('0x4c')](_0x13dd18[_0xcbf4('0x2f')],_0x345f45[_0xcbf4('0x31')]));if(_0x13dd18[_0xcbf4('0x2f')][_0xcbf4('0x49')]){_0xb8c439['where']=_[_0xcbf4('0x3a')](_0xb8c439['where'],{'$or':_['map'](_0xb8c439['attributes'],function(_0x213a82){var _0x3457cc={};_0x3457cc[_0x213a82]={'$like':'%'+_0x13dd18[_0xcbf4('0x2f')][_0xcbf4('0x49')]+'%'};return _0x3457cc;})});}_0xb8c439=_[_0xcbf4('0x3a')]({},_0xb8c439,_0x13dd18[_0xcbf4('0x4a')]);return _0x2101a6[_0xcbf4('0x4e')](_0xb8c439);}})['then'](function(_0x121b43){if(_0x121b43){_0x403978=_0x121b43[_0xcbf4('0x35')];if(!_0x13dd18['query'][_0xcbf4('0x4b')]('nolimit')){_0xb8c439[_0xcbf4('0x1e')]=qs[_0xcbf4('0x1e')](_0x13dd18[_0xcbf4('0x2f')][_0xcbf4('0x1e')]);_0xb8c439[_0xcbf4('0x20')]=qs['offset'](_0x13dd18[_0xcbf4('0x2f')][_0xcbf4('0x20')]);}return _0x2101a6[_0xcbf4('0x4e')](_0xb8c439);}})[_0xcbf4('0x25')](function(_0x586db6){if(_0x586db6){return _0x586db6?{'count':_0x403978,'rows':_0x586db6}:null;}})['then'](respondWithResult(_0x50f4b2,null))[_0xcbf4('0x40')](handleError(_0x50f4b2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 64dcac9..1aa5f5a 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 _0x99ce=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xacd04e,_0x8fd089){var _0x24152b=function(_0x3bef28){while(--_0x3bef28){_0xacd04e['push'](_0xacd04e['shift']());}};_0x24152b(++_0x8fd089);}(_0x99ce,0xac));var _0xe99c=function(_0x128a73,_0x26c676){_0x128a73=_0x128a73-0x0;var _0x210caa=_0x99ce[_0x128a73];return _0x210caa;};'use strict';var _=require(_0xe99c('0x0'));var util=require(_0xe99c('0x1'));var logger=require(_0xe99c('0x2'))(_0xe99c('0x3'));var moment=require(_0xe99c('0x4'));var BPromise=require(_0xe99c('0x5'));var rp=require(_0xe99c('0x6'));var fs=require('fs');var path=require(_0xe99c('0x7'));var rimraf=require(_0xe99c('0x8'));var config=require(_0xe99c('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xe99c('0xa')]=function(_0x3d0905,_0x361e07){return _0x3d0905[_0xe99c('0xb')](_0xe99c('0xc'),attributes,{'tableName':_0xe99c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4246=['request-promise','path','../../config/environment','exports','define','api','moment'];(function(_0x56e607,_0x1a834d){var _0x3a8c12=function(_0x3422a1){while(--_0x3422a1){_0x56e607['push'](_0x56e607['shift']());}};_0x3a8c12(++_0x1a834d);}(_0x4246,0x139));var _0x6424=function(_0xe2e26,_0x47e75d){_0xe2e26=_0xe2e26-0x0;var _0x5e90d0=_0x4246[_0xe2e26];return _0x5e90d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6424('0x0'));var moment=require(_0x6424('0x1'));var BPromise=require('bluebird');var rp=require(_0x6424('0x2'));var fs=require('fs');var path=require(_0x6424('0x3'));var rimraf=require('rimraf');var config=require(_0x6424('0x4'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x6424('0x5')]=function(_0x5666f5,_0x1af31a){return _0x5666f5[_0x6424('0x6')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 72b365d..e6ef8e4 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 _0x06d5=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x06d5,0xae));var _0x506d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x06d5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x506d('0x0'));var util=require(_0x506d('0x1'));var moment=require(_0x506d('0x2'));var BPromise=require(_0x506d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x506d('0x4'));var db=require(_0x506d('0x5'))['db'];var utils=require(_0x506d('0x6'));var logger=require(_0x506d('0x7'))('rpc');var config=require(_0x506d('0x8'));var jayson=require(_0x506d('0x9'));var client=jayson[_0x506d('0xa')][_0x506d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x160fc8,_0x34cc22,_0x3b5fb2){return new BPromise(function(_0x214250,_0x507a75){return client['request'](_0x160fc8,_0x3b5fb2)[_0x506d('0xc')](function(_0x5cddf6){logger[_0x506d('0xd')](_0x506d('0xe'),_0x34cc22,_0x506d('0xf'));logger[_0x506d('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x34cc22,_0x506d('0xf'),JSON[_0x506d('0x11')](_0x5cddf6));if(_0x5cddf6['error']){if(_0x5cddf6[_0x506d('0x12')]['code']===0x1f4){logger[_0x506d('0x12')](_0x506d('0xe'),_0x34cc22,_0x5cddf6[_0x506d('0x12')]['message']);return _0x507a75(_0x5cddf6[_0x506d('0x12')][_0x506d('0x13')]);}logger['error'](_0x506d('0xe'),_0x34cc22,_0x5cddf6[_0x506d('0x12')][_0x506d('0x13')]);return _0x214250(_0x5cddf6[_0x506d('0x12')]['message']);}else{logger[_0x506d('0xd')](_0x506d('0xe'),_0x34cc22,_0x506d('0xf'));_0x214250(_0x5cddf6[_0x506d('0x14')][_0x506d('0x13')]);}})[_0x506d('0x15')](function(_0x197bf9){logger[_0x506d('0x12')](_0x506d('0xe'),_0x34cc22,_0x197bf9);_0x507a75(_0x197bf9);});});} \ No newline at end of file +var _0xc5ec=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xc5ec,0x17e));var _0xcc5e=function(_0x28f493,_0x94fd4b){_0x28f493=_0x28f493-0x0;var _0x4b0409=_0xc5ec[_0x28f493];return _0x4b0409;};'use strict';var _=require(_0xcc5e('0x0'));var util=require(_0xcc5e('0x1'));var moment=require(_0xcc5e('0x2'));var BPromise=require(_0xcc5e('0x3'));var rs=require(_0xcc5e('0x4'));var fs=require('fs');var Redis=require(_0xcc5e('0x5'));var db=require(_0xcc5e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcc5e('0x7'));var client=jayson[_0xcc5e('0x8')][_0xcc5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff4a0,_0x24fdad,_0x23d6b5){return new BPromise(function(_0x5f50aa,_0x1c4c90){return client[_0xcc5e('0xa')](_0x1ff4a0,_0x23d6b5)[_0xcc5e('0xb')](function(_0x1d5f77){logger[_0xcc5e('0xc')](_0xcc5e('0xd'),_0x24fdad,_0xcc5e('0xe'));logger[_0xcc5e('0xf')](_0xcc5e('0x10'),_0x24fdad,_0xcc5e('0xe'),JSON[_0xcc5e('0x11')](_0x1d5f77));if(_0x1d5f77[_0xcc5e('0x12')]){if(_0x1d5f77[_0xcc5e('0x12')]['code']===0x1f4){logger[_0xcc5e('0x12')](_0xcc5e('0xd'),_0x24fdad,_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);return _0x1c4c90(_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);}logger['error'](_0xcc5e('0xd'),_0x24fdad,_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);return _0x5f50aa(_0x1d5f77[_0xcc5e('0x12')][_0xcc5e('0x13')]);}else{logger['info'](_0xcc5e('0xd'),_0x24fdad,'request\x20sent');_0x5f50aa(_0x1d5f77[_0xcc5e('0x14')][_0xcc5e('0x13')]);}})[_0xcc5e('0x15')](function(_0x157c20){logger[_0xcc5e('0x12')](_0xcc5e('0xd'),_0x24fdad,_0x157c20);_0x1c4c90(_0x157c20);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index fea9921..afefa3d 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 _0xe920=['post','create','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x5ad8e6,_0xc6f416){var _0x9a73e=function(_0x8a7aa4){while(--_0x8a7aa4){_0x5ad8e6['push'](_0x5ad8e6['shift']());}};_0x9a73e(++_0xc6f416);}(_0xe920,0xbe));var _0x0e92=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe920[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x0e92('0x0'));var util=require(_0x0e92('0x1'));var path=require(_0x0e92('0x2'));var timeout=require(_0x0e92('0x3'));var express=require(_0x0e92('0x4'));var router=express[_0x0e92('0x5')]();var fs_extra=require(_0x0e92('0x6'));var auth=require(_0x0e92('0x7'));var interaction=require(_0x0e92('0x8'));var config=require(_0x0e92('0x9'));var controller=require('./intFreshsalesField.controller');router[_0x0e92('0xa')]('/',auth['isAuthenticated'](),controller[_0x0e92('0xb')]);router[_0x0e92('0xa')](_0x0e92('0xc'),auth[_0x0e92('0xd')](),controller['show']);router[_0x0e92('0xe')]('/',auth[_0x0e92('0xd')](),controller[_0x0e92('0xf')]);router[_0x0e92('0x10')](_0x0e92('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0e92('0xc'),auth[_0x0e92('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2ceb=['./intFreshsalesField.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x588371,_0x2ea6e6){var _0x233b57=function(_0x241b1a){while(--_0x241b1a){_0x588371['push'](_0x588371['shift']());}};_0x233b57(++_0x2ea6e6);}(_0x2ceb,0x110));var _0xb2ce=function(_0x1b3ade,_0x5768a3){_0x1b3ade=_0x1b3ade-0x0;var _0x1e74ff=_0x2ceb[_0x1b3ade];return _0x1e74ff;};'use strict';var multer=require(_0xb2ce('0x0'));var util=require(_0xb2ce('0x1'));var path=require('path');var timeout=require(_0xb2ce('0x2'));var express=require(_0xb2ce('0x3'));var router=express[_0xb2ce('0x4')]();var fs_extra=require(_0xb2ce('0x5'));var auth=require(_0xb2ce('0x6'));var interaction=require(_0xb2ce('0x7'));var config=require('../../config/environment');var controller=require(_0xb2ce('0x8'));router[_0xb2ce('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2ce('0xa')]);router[_0xb2ce('0x9')]('/:id',auth[_0xb2ce('0xb')](),controller[_0xb2ce('0xc')]);router[_0xb2ce('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb2ce('0xe')](_0xb2ce('0xf'),auth['isAuthenticated'](),controller[_0xb2ce('0x10')]);router[_0xb2ce('0x11')](_0xb2ce('0xf'),auth[_0xb2ce('0xb')](),controller[_0xb2ce('0x12')]);module[_0xb2ce('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4675b03..c187694 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 _0x2f48=['BOOLEAN','exports','ENUM','customVariable','keyValue','picklist','STRING','string','variable'];(function(_0x21da8d,_0x5ccaf1){var _0xe846a4=function(_0x1e86be){while(--_0x1e86be){_0x21da8d['push'](_0x21da8d['shift']());}};_0xe846a4(++_0x5ccaf1);}(_0x2f48,0xbe));var _0x82f4=function(_0x44e316,_0x7d90c8){_0x44e316=_0x44e316-0x0;var _0x27aeb8=_0x2f48[_0x44e316];return _0x27aeb8;};'use strict';var Sequelize=require('sequelize');module[_0x82f4('0x0')]={'type':{'type':Sequelize[_0x82f4('0x1')]('string','variable',_0x82f4('0x2'),_0x82f4('0x3'),_0x82f4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x82f4('0x5')]},'keyType':{'type':Sequelize[_0x82f4('0x1')](_0x82f4('0x6'),_0x82f4('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x82f4('0x5')]},'idField':{'type':Sequelize[_0x82f4('0x5')]},'nameField':{'type':Sequelize[_0x82f4('0x5')]},'customField':{'type':Sequelize[_0x82f4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x82f4('0x5')]}}; \ No newline at end of file +var _0xc89e=['sequelize','exports','variable','customVariable','keyValue','STRING','ENUM','string'];(function(_0x3b813c,_0x196b8a){var _0x22bbe2=function(_0x5f40e8){while(--_0x5f40e8){_0x3b813c['push'](_0x3b813c['shift']());}};_0x22bbe2(++_0x196b8a);}(_0xc89e,0x118));var _0xec89=function(_0xeb4541,_0x584adb){_0xeb4541=_0xeb4541-0x0;var _0x2428c0=_0xc89e[_0xeb4541];return _0x2428c0;};'use strict';var Sequelize=require(_0xec89('0x0'));module[_0xec89('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xec89('0x2'),_0xec89('0x3'),_0xec89('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xec89('0x5')]},'key':{'type':Sequelize[_0xec89('0x5')]},'keyType':{'type':Sequelize[_0xec89('0x6')](_0xec89('0x7'),_0xec89('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xec89('0x5')]},'nameField':{'type':Sequelize[_0xec89('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec89('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 73c0aa7..599e288 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 _0x0c2c=['FreshsalesField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0c2c,0x1ec));var _0xc0c2=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x0c2c[_0x307086];return _0x699043;};'use strict';var emlformat=require(_0xc0c2('0x0'));var rimraf=require(_0xc0c2('0x1'));var zipdir=require(_0xc0c2('0x2'));var jsonpatch=require(_0xc0c2('0x3'));var rp=require(_0xc0c2('0x4'));var moment=require(_0xc0c2('0x5'));var BPromise=require(_0xc0c2('0x6'));var Mustache=require(_0xc0c2('0x7'));var util=require('util');var path=require(_0xc0c2('0x8'));var sox=require(_0xc0c2('0x9'));var csv=require(_0xc0c2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0c2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc0c2('0xc'));var jsforce=require(_0xc0c2('0xd'));var deskjs=require(_0xc0c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc0c2('0xf'));var Papa=require(_0xc0c2('0x10'));var Redis=require(_0xc0c2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0c2('0x12'));var as=require(_0xc0c2('0x13'));var hardwareService=require(_0xc0c2('0x14'));var logger=require(_0xc0c2('0x15'))(_0xc0c2('0x16'));var utils=require(_0xc0c2('0x17'));var config=require(_0xc0c2('0x18'));var licenseUtil=require(_0xc0c2('0x19'));var db=require(_0xc0c2('0x1a'))['db'];function respondWithStatusCode(_0x202c8f,_0x3808e9){_0x3808e9=_0x3808e9||0xcc;return function(_0x302c1a){if(_0x302c1a){return _0x202c8f['sendStatus'](_0x3808e9);}return _0x202c8f['status'](_0x3808e9)['end']();};}function respondWithResult(_0x10a453,_0x29b40a){_0x29b40a=_0x29b40a||0xc8;return function(_0x39f3c0){if(_0x39f3c0){return _0x10a453['status'](_0x29b40a)[_0xc0c2('0x1b')](_0x39f3c0);}};}function respondWithFilteredResult(_0x2a8ded,_0x3a6b26){return function(_0x517a12){if(_0x517a12){var _0xa06763=typeof _0x3a6b26[_0xc0c2('0x1c')]===_0xc0c2('0x1d')&&typeof _0x3a6b26[_0xc0c2('0x1e')]===_0xc0c2('0x1d');var _0x221b8f=_0x517a12[_0xc0c2('0x1f')];var _0x105aa7=_0xa06763?0x0:_0x3a6b26[_0xc0c2('0x1c')];var _0x278eb8=_0xa06763?_0x517a12[_0xc0c2('0x1f')]:_0x3a6b26[_0xc0c2('0x1c')]+_0x3a6b26[_0xc0c2('0x1e')];var _0x563121;if(_0x278eb8>=_0x221b8f){_0x278eb8=_0x221b8f;_0x563121=0xc8;}else{_0x563121=0xce;}_0x2a8ded[_0xc0c2('0x20')](_0x563121);return _0x2a8ded['set'](_0xc0c2('0x21'),_0x105aa7+'-'+_0x278eb8+'/'+_0x221b8f)['json'](_0x517a12);}return null;};}function patchUpdates(_0x2caa30){return function(_0x1f2494){try{jsonpatch[_0xc0c2('0x22')](_0x1f2494,_0x2caa30,!![]);}catch(_0x4d15db){return BPromise[_0xc0c2('0x23')](_0x4d15db);}return _0x1f2494[_0xc0c2('0x24')]();};}function saveUpdates(_0x199e57,_0x363b5e){return function(_0x1cff95){if(_0x1cff95){return _0x1cff95[_0xc0c2('0x25')](_0x199e57)['then'](function(_0x57375d){return _0x57375d;});}return null;};}function removeEntity(_0x11ccd6,_0x1232e0){return function(_0x3e5d3a){if(_0x3e5d3a){return _0x3e5d3a[_0xc0c2('0x26')]()[_0xc0c2('0x27')](function(){_0x11ccd6[_0xc0c2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4673,_0x4e14e3){return function(_0x335b74){if(!_0x335b74){_0x4c4673[_0xc0c2('0x28')](0x194);}return _0x335b74;};}function handleError(_0x4ac1c6,_0x5cd504){_0x5cd504=_0x5cd504||0x1f4;return function(_0x37b673){logger[_0xc0c2('0x29')](_0x37b673[_0xc0c2('0x2a')]);if(_0x37b673[_0xc0c2('0x2b')]){delete _0x37b673['name'];}_0x4ac1c6[_0xc0c2('0x20')](_0x5cd504)[_0xc0c2('0x2c')](_0x37b673);};}exports[_0xc0c2('0x2d')]=function(_0x5f5441,_0x1b36ba){var _0x1f41dc={},_0x51a6df={},_0x4ce71f={'count':0x0,'rows':[]};var _0x481786=_[_0xc0c2('0x2e')](db[_0xc0c2('0x2f')]['rawAttributes'],function(_0x4f685c){return{'name':_0x4f685c[_0xc0c2('0x30')],'type':_0x4f685c['type'][_0xc0c2('0x31')]};});_0x51a6df[_0xc0c2('0x32')]=_[_0xc0c2('0x2e')](_0x481786,_0xc0c2('0x2b'));_0x51a6df[_0xc0c2('0x33')]=_[_0xc0c2('0x34')](_0x5f5441['query']);_0x51a6df[_0xc0c2('0x35')]=_[_0xc0c2('0x36')](_0x51a6df['model'],_0x51a6df['query']);_0x1f41dc[_0xc0c2('0x37')]=_[_0xc0c2('0x36')](_0x51a6df[_0xc0c2('0x32')],qs[_0xc0c2('0x38')](_0x5f5441['query']['fields']));_0x1f41dc[_0xc0c2('0x37')]=_0x1f41dc[_0xc0c2('0x37')][_0xc0c2('0x39')]?_0x1f41dc[_0xc0c2('0x37')]:_0x51a6df[_0xc0c2('0x32')];if(!_0x5f5441[_0xc0c2('0x33')][_0xc0c2('0x3a')]('nolimit')){_0x1f41dc['limit']=qs[_0xc0c2('0x1e')](_0x5f5441[_0xc0c2('0x33')][_0xc0c2('0x1e')]);_0x1f41dc[_0xc0c2('0x1c')]=qs[_0xc0c2('0x1c')](_0x5f5441[_0xc0c2('0x33')][_0xc0c2('0x1c')]);}_0x1f41dc[_0xc0c2('0x3b')]=qs[_0xc0c2('0x3c')](_0x5f5441[_0xc0c2('0x33')]['sort']);_0x1f41dc['where']=qs[_0xc0c2('0x35')](_['pick'](_0x5f5441[_0xc0c2('0x33')],_0x51a6df['filters']),_0x481786);if(_0x5f5441[_0xc0c2('0x33')][_0xc0c2('0x3d')]){_0x1f41dc['where']=_['merge'](_0x1f41dc[_0xc0c2('0x3e')],{'$or':_[_0xc0c2('0x2e')](_0x481786,function(_0x420115){if(_0x420115[_0xc0c2('0x3f')]!==_0xc0c2('0x40')){var _0x386c08={};_0x386c08[_0x420115['name']]={'$like':'%'+_0x5f5441[_0xc0c2('0x33')][_0xc0c2('0x3d')]+'%'};return _0x386c08;}})});}_0x1f41dc=_[_0xc0c2('0x41')]({},_0x1f41dc,_0x5f5441['options']);var _0x5311c4={'where':_0x1f41dc['where']};return db[_0xc0c2('0x2f')][_0xc0c2('0x1f')](_0x5311c4)['then'](function(_0x6d817d){_0x4ce71f[_0xc0c2('0x1f')]=_0x6d817d;if(_0x5f5441[_0xc0c2('0x33')][_0xc0c2('0x42')]){_0x1f41dc['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xc0c2('0x43')](_0x1f41dc);})[_0xc0c2('0x27')](function(_0x4bd4b3){_0x4ce71f[_0xc0c2('0x44')]=_0x4bd4b3;return _0x4ce71f;})[_0xc0c2('0x27')](respondWithFilteredResult(_0x1b36ba,_0x1f41dc))[_0xc0c2('0x45')](handleError(_0x1b36ba,null));};exports[_0xc0c2('0x46')]=function(_0x177cb6,_0x49dca4){var _0x4aca7c={'raw':!![],'where':{'id':_0x177cb6[_0xc0c2('0x47')]['id']}},_0x5d133a={};_0x5d133a['model']=_[_0xc0c2('0x34')](db[_0xc0c2('0x2f')][_0xc0c2('0x48')]);_0x5d133a[_0xc0c2('0x33')]=_[_0xc0c2('0x34')](_0x177cb6[_0xc0c2('0x33')]);_0x5d133a[_0xc0c2('0x35')]=_[_0xc0c2('0x36')](_0x5d133a[_0xc0c2('0x32')],_0x5d133a[_0xc0c2('0x33')]);_0x4aca7c[_0xc0c2('0x37')]=_[_0xc0c2('0x36')](_0x5d133a['model'],qs[_0xc0c2('0x38')](_0x177cb6[_0xc0c2('0x33')][_0xc0c2('0x38')]));_0x4aca7c[_0xc0c2('0x37')]=_0x4aca7c['attributes'][_0xc0c2('0x39')]?_0x4aca7c['attributes']:_0x5d133a['model'];if(_0x177cb6[_0xc0c2('0x33')][_0xc0c2('0x42')]){_0x4aca7c[_0xc0c2('0x49')]=[{'all':!![]}];}_0x4aca7c=_[_0xc0c2('0x41')]({},_0x4aca7c,_0x177cb6['options']);return db['FreshsalesField'][_0xc0c2('0x4a')](_0x4aca7c)[_0xc0c2('0x27')](handleEntityNotFound(_0x49dca4,null))[_0xc0c2('0x27')](respondWithResult(_0x49dca4,null))[_0xc0c2('0x45')](handleError(_0x49dca4,null));};exports[_0xc0c2('0x4b')]=function(_0x4d7bc3,_0x3ac87e){return db[_0xc0c2('0x2f')][_0xc0c2('0x4b')](_0x4d7bc3['body'],{})[_0xc0c2('0x27')](respondWithResult(_0x3ac87e,0xc9))['catch'](handleError(_0x3ac87e,null));};exports[_0xc0c2('0x25')]=function(_0x31344a,_0x3212ff){if(_0x31344a[_0xc0c2('0x4c')]['id']){delete _0x31344a[_0xc0c2('0x4c')]['id'];}return db['FreshsalesField'][_0xc0c2('0x4a')]({'where':{'id':_0x31344a[_0xc0c2('0x47')]['id']}})[_0xc0c2('0x27')](handleEntityNotFound(_0x3212ff,null))[_0xc0c2('0x27')](saveUpdates(_0x31344a[_0xc0c2('0x4c')],null))[_0xc0c2('0x27')](respondWithResult(_0x3212ff,null))['catch'](handleError(_0x3212ff,null));};exports['destroy']=function(_0x31997e,_0x2e93f7){return db[_0xc0c2('0x2f')]['find']({'where':{'id':_0x31997e[_0xc0c2('0x47')]['id']}})[_0xc0c2('0x27')](handleEntityNotFound(_0x2e93f7,null))[_0xc0c2('0x27')](removeEntity(_0x2e93f7,null))[_0xc0c2('0x45')](handleError(_0x2e93f7,null));}; \ No newline at end of file +var _0x3929=['to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','length','find','create','body','catch','eml-format','rimraf','zip-dir','bluebird','util','sox'];(function(_0x367054,_0x3ae59c){var _0x54fbd8=function(_0x1b4ac1){while(--_0x1b4ac1){_0x367054['push'](_0x367054['shift']());}};_0x54fbd8(++_0x3ae59c);}(_0x3929,0x1eb));var _0x9392=function(_0x34c0a8,_0x4fec1a){_0x34c0a8=_0x34c0a8-0x0;var _0x21b7a7=_0x3929[_0x34c0a8];return _0x21b7a7;};'use strict';var emlformat=require(_0x9392('0x0'));var rimraf=require(_0x9392('0x1'));var zipdir=require(_0x9392('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9392('0x3'));var Mustache=require('mustache');var util=require(_0x9392('0x4'));var path=require('path');var sox=require(_0x9392('0x5'));var csv=require(_0x9392('0x6'));var ejs=require(_0x9392('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9392('0x8'));var squel=require('squel');var crypto=require(_0x9392('0x9'));var jsforce=require(_0x9392('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9392('0x6'));var querystring=require(_0x9392('0xb'));var Papa=require('papaparse');var Redis=require(_0x9392('0xc'));var authService=require(_0x9392('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9392('0xe'));var hardwareService=require(_0x9392('0xf'));var logger=require(_0x9392('0x10'))(_0x9392('0x11'));var utils=require(_0x9392('0x12'));var config=require(_0x9392('0x13'));var licenseUtil=require(_0x9392('0x14'));var db=require(_0x9392('0x15'))['db'];function respondWithStatusCode(_0x3402ee,_0x127751){_0x127751=_0x127751||0xcc;return function(_0x331c31){if(_0x331c31){return _0x3402ee[_0x9392('0x16')](_0x127751);}return _0x3402ee[_0x9392('0x17')](_0x127751)[_0x9392('0x18')]();};}function respondWithResult(_0x20e557,_0x56fc93){_0x56fc93=_0x56fc93||0xc8;return function(_0x4103bb){if(_0x4103bb){return _0x20e557[_0x9392('0x17')](_0x56fc93)[_0x9392('0x19')](_0x4103bb);}};}function respondWithFilteredResult(_0x280ff2,_0x258da8){return function(_0x8f14f3){if(_0x8f14f3){var _0x23a870=typeof _0x258da8[_0x9392('0x1a')]===_0x9392('0x1b')&&typeof _0x258da8[_0x9392('0x1c')]===_0x9392('0x1b');var _0x2a53ce=_0x8f14f3[_0x9392('0x1d')];var _0x5da2b4=_0x23a870?0x0:_0x258da8['offset'];var _0x2c1556=_0x23a870?_0x8f14f3[_0x9392('0x1d')]:_0x258da8[_0x9392('0x1a')]+_0x258da8[_0x9392('0x1c')];var _0x301b9b;if(_0x2c1556>=_0x2a53ce){_0x2c1556=_0x2a53ce;_0x301b9b=0xc8;}else{_0x301b9b=0xce;}_0x280ff2[_0x9392('0x17')](_0x301b9b);return _0x280ff2[_0x9392('0x1e')]('Content-Range',_0x5da2b4+'-'+_0x2c1556+'/'+_0x2a53ce)[_0x9392('0x19')](_0x8f14f3);}return null;};}function patchUpdates(_0x34074f){return function(_0x23fef4){try{jsonpatch[_0x9392('0x1f')](_0x23fef4,_0x34074f,!![]);}catch(_0x3048ec){return BPromise[_0x9392('0x20')](_0x3048ec);}return _0x23fef4[_0x9392('0x21')]();};}function saveUpdates(_0x51ddad,_0x3d349e){return function(_0xef8296){if(_0xef8296){return _0xef8296[_0x9392('0x22')](_0x51ddad)[_0x9392('0x23')](function(_0x2a55d5){return _0x2a55d5;});}return null;};}function removeEntity(_0x2f1d78,_0xceab56){return function(_0x5cecfb){if(_0x5cecfb){return _0x5cecfb[_0x9392('0x24')]()['then'](function(){_0x2f1d78[_0x9392('0x17')](0xcc)[_0x9392('0x18')]();});}};}function handleEntityNotFound(_0x2ccfb2,_0x166cc4){return function(_0xed9bee){if(!_0xed9bee){_0x2ccfb2['sendStatus'](0x194);}return _0xed9bee;};}function handleError(_0x49770c,_0x389367){_0x389367=_0x389367||0x1f4;return function(_0x627bc){logger[_0x9392('0x25')](_0x627bc[_0x9392('0x26')]);if(_0x627bc['name']){delete _0x627bc[_0x9392('0x27')];}_0x49770c[_0x9392('0x17')](_0x389367)['send'](_0x627bc);};}exports[_0x9392('0x28')]=function(_0x49ccb0,_0x240bdd){var _0x3e376e={},_0x301499={},_0x12ca0f={'count':0x0,'rows':[]};var _0x561470=_['map'](db[_0x9392('0x29')][_0x9392('0x2a')],function(_0x16e53c){return{'name':_0x16e53c[_0x9392('0x2b')],'type':_0x16e53c['type']['key']};});_0x301499[_0x9392('0x2c')]=_[_0x9392('0x2d')](_0x561470,'name');_0x301499[_0x9392('0x2e')]=_[_0x9392('0x2f')](_0x49ccb0[_0x9392('0x2e')]);_0x301499['filters']=_[_0x9392('0x30')](_0x301499['model'],_0x301499['query']);_0x3e376e[_0x9392('0x31')]=_[_0x9392('0x30')](_0x301499[_0x9392('0x2c')],qs[_0x9392('0x32')](_0x49ccb0[_0x9392('0x2e')]['fields']));_0x3e376e[_0x9392('0x31')]=_0x3e376e[_0x9392('0x31')]['length']?_0x3e376e[_0x9392('0x31')]:_0x301499['model'];if(!_0x49ccb0[_0x9392('0x2e')]['hasOwnProperty'](_0x9392('0x33'))){_0x3e376e[_0x9392('0x1c')]=qs[_0x9392('0x1c')](_0x49ccb0['query'][_0x9392('0x1c')]);_0x3e376e['offset']=qs[_0x9392('0x1a')](_0x49ccb0[_0x9392('0x2e')][_0x9392('0x1a')]);}_0x3e376e[_0x9392('0x34')]=qs[_0x9392('0x35')](_0x49ccb0['query'][_0x9392('0x35')]);_0x3e376e[_0x9392('0x36')]=qs[_0x9392('0x37')](_['pick'](_0x49ccb0[_0x9392('0x2e')],_0x301499[_0x9392('0x37')]),_0x561470);if(_0x49ccb0[_0x9392('0x2e')][_0x9392('0x38')]){_0x3e376e[_0x9392('0x36')]=_[_0x9392('0x39')](_0x3e376e['where'],{'$or':_[_0x9392('0x2d')](_0x561470,function(_0x18a5af){if(_0x18a5af[_0x9392('0x3a')]!==_0x9392('0x3b')){var _0x4ee543={};_0x4ee543[_0x18a5af[_0x9392('0x27')]]={'$like':'%'+_0x49ccb0['query'][_0x9392('0x38')]+'%'};return _0x4ee543;}})});}_0x3e376e=_['merge']({},_0x3e376e,_0x49ccb0[_0x9392('0x3c')]);var _0x5cd365={'where':_0x3e376e[_0x9392('0x36')]};return db[_0x9392('0x29')][_0x9392('0x1d')](_0x5cd365)[_0x9392('0x23')](function(_0x142183){_0x12ca0f['count']=_0x142183;if(_0x49ccb0[_0x9392('0x2e')][_0x9392('0x3d')]){_0x3e376e[_0x9392('0x3e')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x3e376e);})[_0x9392('0x23')](function(_0xa325d6){_0x12ca0f[_0x9392('0x3f')]=_0xa325d6;return _0x12ca0f;})[_0x9392('0x23')](respondWithFilteredResult(_0x240bdd,_0x3e376e))['catch'](handleError(_0x240bdd,null));};exports[_0x9392('0x40')]=function(_0x1729c3,_0x133def){var _0x5e1b95={'raw':!![],'where':{'id':_0x1729c3[_0x9392('0x41')]['id']}},_0x110219={};_0x110219[_0x9392('0x2c')]=_[_0x9392('0x2f')](db[_0x9392('0x29')][_0x9392('0x2a')]);_0x110219[_0x9392('0x2e')]=_['keys'](_0x1729c3['query']);_0x110219['filters']=_[_0x9392('0x30')](_0x110219[_0x9392('0x2c')],_0x110219[_0x9392('0x2e')]);_0x5e1b95['attributes']=_['intersection'](_0x110219[_0x9392('0x2c')],qs[_0x9392('0x32')](_0x1729c3[_0x9392('0x2e')][_0x9392('0x32')]));_0x5e1b95[_0x9392('0x31')]=_0x5e1b95['attributes'][_0x9392('0x42')]?_0x5e1b95[_0x9392('0x31')]:_0x110219[_0x9392('0x2c')];if(_0x1729c3[_0x9392('0x2e')]['includeAll']){_0x5e1b95[_0x9392('0x3e')]=[{'all':!![]}];}_0x5e1b95=_[_0x9392('0x39')]({},_0x5e1b95,_0x1729c3['options']);return db[_0x9392('0x29')][_0x9392('0x43')](_0x5e1b95)['then'](handleEntityNotFound(_0x133def,null))[_0x9392('0x23')](respondWithResult(_0x133def,null))['catch'](handleError(_0x133def,null));};exports[_0x9392('0x44')]=function(_0x3b8149,_0x2f0d73){return db['FreshsalesField'][_0x9392('0x44')](_0x3b8149[_0x9392('0x45')],{})['then'](respondWithResult(_0x2f0d73,0xc9))[_0x9392('0x46')](handleError(_0x2f0d73,null));};exports[_0x9392('0x22')]=function(_0x1fd2d1,_0x511d08){if(_0x1fd2d1['body']['id']){delete _0x1fd2d1[_0x9392('0x45')]['id'];}return db[_0x9392('0x29')][_0x9392('0x43')]({'where':{'id':_0x1fd2d1[_0x9392('0x41')]['id']}})[_0x9392('0x23')](handleEntityNotFound(_0x511d08,null))['then'](saveUpdates(_0x1fd2d1[_0x9392('0x45')],null))[_0x9392('0x23')](respondWithResult(_0x511d08,null))['catch'](handleError(_0x511d08,null));};exports[_0x9392('0x24')]=function(_0x57f652,_0x572ce2){return db[_0x9392('0x29')][_0x9392('0x43')]({'where':{'id':_0x57f652['params']['id']}})[_0x9392('0x23')](handleEntityNotFound(_0x572ce2,null))[_0x9392('0x23')](removeEntity(_0x572ce2,null))['catch'](handleError(_0x572ce2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 3bcee2c..cc4ce61 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 _0x3c1a=['request-promise','rimraf','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x353203,_0x2d39cf){var _0x5ab951=function(_0x3873ed){while(--_0x3873ed){_0x353203['push'](_0x353203['shift']());}};_0x5ab951(++_0x2d39cf);}(_0x3c1a,0xda));var _0xa3c1=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x3c1a[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var logger=require(_0xa3c1('0x2'))(_0xa3c1('0x3'));var moment=require(_0xa3c1('0x4'));var BPromise=require(_0xa3c1('0x5'));var rp=require(_0xa3c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa3c1('0x8'));module[_0xa3c1('0x9')]=function(_0x3f6cab,_0x2da4d2){return _0x3f6cab['define']('FreshsalesField',attributes,{'tableName':_0xa3c1('0xa'),'paranoid':![],'indexes':[{'name':_0xa3c1('0xb'),'fields':[_0xa3c1('0xc'),_0xa3c1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x419f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash'];(function(_0x453bc4,_0x1a31a0){var _0x55476c=function(_0x52e2b3){while(--_0x52e2b3){_0x453bc4['push'](_0x453bc4['shift']());}};_0x55476c(++_0x1a31a0);}(_0x419f,0x176));var _0xf419=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x419f[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var logger=require(_0xf419('0x2'))(_0xf419('0x3'));var moment=require(_0xf419('0x4'));var BPromise=require(_0xf419('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf419('0x6'));var rimraf=require('rimraf');var config=require(_0xf419('0x7'));var attributes=require(_0xf419('0x8'));module[_0xf419('0x9')]=function(_0x38f2fa,_0x2d8430){return _0x38f2fa[_0xf419('0xa')](_0xf419('0xb'),attributes,{'tableName':_0xf419('0xc'),'paranoid':![],'indexes':[{'name':_0xf419('0xd'),'fields':['idField',_0xf419('0xe')],'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 af0f1e7..6e256a8 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 _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(_0xb21be2,_0x5938aa){var _0x160057=function(_0x4abe4f){while(--_0x4abe4f){_0xb21be2['push'](_0xb21be2['shift']());}};_0x160057(++_0x5938aa);}(_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 +var _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x1043cc,_0x4d40da){var _0x56f354=function(_0x1b77f2){while(--_0x1b77f2){_0x1043cc['push'](_0x1043cc['shift']());}};_0x56f354(++_0x4d40da);}(_0x9536,0x179));var _0x6953=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x9536[_0x5ecadc];return _0x565037;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3d56a76..7921931 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(_0x172d33,_0x42ab28){var _0x2b790e=function(_0x5711df){while(--_0x5711df){_0x172d33['push'](_0x172d33['shift']());}};_0x2b790e(++_0x42ab28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x6ec2c7,_0x2dd285){var _0x5555ec=function(_0x1d3797){while(--_0x1d3797){_0x6ec2c7['push'](_0x6ec2c7['shift']());}};_0x5555ec(++_0x2dd285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 7f1ad80..db07efb 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 _0x9a4d=['STRING','integrationTab','newTab','sequelize','exports'];(function(_0x44d797,_0x276017){var _0x4005c2=function(_0x3d3b5b){while(--_0x3d3b5b){_0x44d797['push'](_0x44d797['shift']());}};_0x4005c2(++_0x276017);}(_0x9a4d,0xa8));var _0xd9a4=function(_0x54813d,_0x101c1f){_0x54813d=_0x54813d-0x0;var _0x561eea=_0x9a4d[_0x54813d];return _0x561eea;};'use strict';var Sequelize=require(_0xd9a4('0x0'));module[_0xd9a4('0x1')]={'name':{'type':Sequelize[_0xd9a4('0x2')]},'description':{'type':Sequelize[_0xd9a4('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd9a4('0x2')]},'clientId':{'type':Sequelize[_0xd9a4('0x2')]},'clientSecret':{'type':Sequelize[_0xd9a4('0x2')]},'securityToken':{'type':Sequelize[_0xd9a4('0x2')]},'serverUrl':{'type':Sequelize[_0xd9a4('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd9a4('0x3'),_0xd9a4('0x4')),'defaultValue':_0xd9a4('0x3')}}; \ No newline at end of file +var _0xd781=['exports','STRING','username','integrationTab','newTab','sequelize'];(function(_0x500ef3,_0x579990){var _0x837649=function(_0x42a8e5){while(--_0x42a8e5){_0x500ef3['push'](_0x500ef3['shift']());}};_0x837649(++_0x579990);}(_0xd781,0x1bb));var _0x1d78=function(_0x4a2d80,_0x4d30d1){_0x4a2d80=_0x4a2d80-0x0;var _0x5da7cc=_0xd781[_0x4a2d80];return _0x5da7cc;};'use strict';var Sequelize=require(_0x1d78('0x0'));module[_0x1d78('0x1')]={'name':{'type':Sequelize[_0x1d78('0x2')]},'description':{'type':Sequelize[_0x1d78('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1d78('0x3')},'remoteUri':{'type':Sequelize[_0x1d78('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1d78('0x2')]},'securityToken':{'type':Sequelize[_0x1d78('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1d78('0x4'),_0x1d78('0x5')),'defaultValue':_0x1d78('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8a21927..e0316b9 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 _0xc258=['nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','update','body','getConfigurations','findOne','SalesforceConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','then','destroy','error','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x2fad6f,_0x44b66c){var _0x1f1c03=function(_0x4017f7){while(--_0x4017f7){_0x2fad6f['push'](_0x2fad6f['shift']());}};_0x1f1c03(++_0x44b66c);}(_0xc258,0xc7));var _0x8c25=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc258[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c25('0x0'));var zipdir=require(_0x8c25('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c25('0x2'));var moment=require(_0x8c25('0x3'));var BPromise=require(_0x8c25('0x4'));var Mustache=require(_0x8c25('0x5'));var util=require('util');var path=require(_0x8c25('0x6'));var sox=require(_0x8c25('0x7'));var csv=require(_0x8c25('0x8'));var ejs=require(_0x8c25('0x9'));var fs=require('fs');var fs_extra=require(_0x8c25('0xa'));var _=require(_0x8c25('0xb'));var squel=require(_0x8c25('0xc'));var crypto=require(_0x8c25('0xd'));var jsforce=require(_0x8c25('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8c25('0xf'));var Papa=require(_0x8c25('0x10'));var Redis=require(_0x8c25('0x11'));var authService=require(_0x8c25('0x12'));var qs=require(_0x8c25('0x13'));var as=require(_0x8c25('0x14'));var hardwareService=require(_0x8c25('0x15'));var logger=require(_0x8c25('0x16'))('api');var utils=require(_0x8c25('0x17'));var config=require(_0x8c25('0x18'));var licenseUtil=require(_0x8c25('0x19'));var db=require(_0x8c25('0x1a'))['db'];var integrations=require(_0x8c25('0x1b'));function respondWithStatusCode(_0x108294,_0x3ac1ab){_0x3ac1ab=_0x3ac1ab||0xcc;return function(_0x4919e6){if(_0x4919e6){return _0x108294[_0x8c25('0x1c')](_0x3ac1ab);}return _0x108294[_0x8c25('0x1d')](_0x3ac1ab)[_0x8c25('0x1e')]();};}function respondWithResult(_0x511292,_0x1a0337){_0x1a0337=_0x1a0337||0xc8;return function(_0x210e2d){if(_0x210e2d){return _0x511292['status'](_0x1a0337)[_0x8c25('0x1f')](_0x210e2d);}};}function respondWithFilteredResult(_0x35f805,_0x4d5090){return function(_0x439cbb){if(_0x439cbb){var _0xcf0749=typeof _0x4d5090[_0x8c25('0x20')]===_0x8c25('0x21')&&typeof _0x4d5090[_0x8c25('0x22')]===_0x8c25('0x21');var _0x592617=_0x439cbb['count'];var _0x37d167=_0xcf0749?0x0:_0x4d5090['offset'];var _0x369586=_0xcf0749?_0x439cbb[_0x8c25('0x23')]:_0x4d5090[_0x8c25('0x20')]+_0x4d5090[_0x8c25('0x22')];var _0x199d6a;if(_0x369586>=_0x592617){_0x369586=_0x592617;_0x199d6a=0xc8;}else{_0x199d6a=0xce;}_0x35f805[_0x8c25('0x1d')](_0x199d6a);return _0x35f805['set']('Content-Range',_0x37d167+'-'+_0x369586+'/'+_0x592617)[_0x8c25('0x1f')](_0x439cbb);}return null;};}function patchUpdates(_0x43a0d1){return function(_0x1edb7c){try{jsonpatch[_0x8c25('0x24')](_0x1edb7c,_0x43a0d1,!![]);}catch(_0x26a393){return BPromise[_0x8c25('0x25')](_0x26a393);}return _0x1edb7c['save']();};}function saveUpdates(_0x33141c,_0x2a1e8f){return function(_0xf2e8aa){if(_0xf2e8aa){return _0xf2e8aa['update'](_0x33141c)[_0x8c25('0x26')](function(_0x3228a8){return _0x3228a8;});}return null;};}function removeEntity(_0x159cce,_0xdfac0){return function(_0x39fc82){if(_0x39fc82){return _0x39fc82[_0x8c25('0x27')]()[_0x8c25('0x26')](function(){_0x159cce[_0x8c25('0x1d')](0xcc)[_0x8c25('0x1e')]();});}};}function handleEntityNotFound(_0x33a62e,_0x16c80c){return function(_0x1fa4a2){if(!_0x1fa4a2){_0x33a62e['sendStatus'](0x194);}return _0x1fa4a2;};}function handleError(_0x2bfe2e,_0x552bc9){_0x552bc9=_0x552bc9||0x1f4;return function(_0x518f47){logger[_0x8c25('0x28')](_0x518f47['stack']);if(_0x518f47['name']){delete _0x518f47['name'];}_0x2bfe2e['status'](_0x552bc9)[_0x8c25('0x29')](_0x518f47);};}exports[_0x8c25('0x2a')]=function(_0x4a6138,_0x37d674){var _0x31016b={},_0x2d6115={},_0x2b22c6={'count':0x0,'rows':[]};var _0xe0302b=_[_0x8c25('0x2b')](db[_0x8c25('0x2c')][_0x8c25('0x2d')],function(_0x3c6326){return{'name':_0x3c6326[_0x8c25('0x2e')],'type':_0x3c6326[_0x8c25('0x2f')]['key']};});_0x2d6115['model']=_['map'](_0xe0302b,_0x8c25('0x30'));_0x2d6115['query']=_['keys'](_0x4a6138[_0x8c25('0x31')]);_0x2d6115[_0x8c25('0x32')]=_[_0x8c25('0x33')](_0x2d6115[_0x8c25('0x34')],_0x2d6115[_0x8c25('0x31')]);_0x31016b[_0x8c25('0x35')]=_[_0x8c25('0x33')](_0x2d6115[_0x8c25('0x34')],qs[_0x8c25('0x36')](_0x4a6138[_0x8c25('0x31')][_0x8c25('0x36')]));_0x31016b['attributes']=_0x31016b[_0x8c25('0x35')][_0x8c25('0x37')]?_0x31016b[_0x8c25('0x35')]:_0x2d6115[_0x8c25('0x34')];if(!_0x4a6138[_0x8c25('0x31')][_0x8c25('0x38')](_0x8c25('0x39'))){_0x31016b[_0x8c25('0x22')]=qs['limit'](_0x4a6138['query'][_0x8c25('0x22')]);_0x31016b[_0x8c25('0x20')]=qs['offset'](_0x4a6138[_0x8c25('0x31')]['offset']);}_0x31016b[_0x8c25('0x3a')]=qs['sort'](_0x4a6138['query'][_0x8c25('0x3b')]);_0x31016b['where']=qs['filters'](_[_0x8c25('0x3c')](_0x4a6138[_0x8c25('0x31')],_0x2d6115[_0x8c25('0x32')]),_0xe0302b);if(_0x4a6138[_0x8c25('0x31')][_0x8c25('0x3d')]){_0x31016b['where']=_[_0x8c25('0x3e')](_0x31016b[_0x8c25('0x3f')],{'$or':_[_0x8c25('0x2b')](_0xe0302b,function(_0x379f30){if(_0x379f30[_0x8c25('0x2f')]!==_0x8c25('0x40')){var _0x3348b0={};_0x3348b0[_0x379f30[_0x8c25('0x30')]]={'$like':'%'+_0x4a6138[_0x8c25('0x31')][_0x8c25('0x3d')]+'%'};return _0x3348b0;}})});}_0x31016b=_[_0x8c25('0x3e')]({},_0x31016b,_0x4a6138[_0x8c25('0x41')]);var _0x552011={'where':_0x31016b[_0x8c25('0x3f')]};return db[_0x8c25('0x2c')]['count'](_0x552011)['then'](function(_0x1bb518){_0x2b22c6[_0x8c25('0x23')]=_0x1bb518;if(_0x4a6138[_0x8c25('0x31')][_0x8c25('0x42')]){_0x31016b[_0x8c25('0x43')]=[{'all':!![]}];}return db[_0x8c25('0x2c')]['findAll'](_0x31016b);})[_0x8c25('0x26')](function(_0x7b759f){_0x2b22c6[_0x8c25('0x44')]=_0x7b759f;return _0x2b22c6;})[_0x8c25('0x26')](respondWithFilteredResult(_0x37d674,_0x31016b))[_0x8c25('0x45')](handleError(_0x37d674,null));};exports['show']=function(_0x594d80,_0x56a247){var _0x5acf03={'raw':![],'where':{'id':_0x594d80[_0x8c25('0x46')]['id']}},_0x51a7ea={};_0x51a7ea[_0x8c25('0x34')]=_[_0x8c25('0x47')](db[_0x8c25('0x2c')]['rawAttributes']);_0x51a7ea[_0x8c25('0x31')]=_[_0x8c25('0x47')](_0x594d80['query']);_0x51a7ea['filters']=_[_0x8c25('0x33')](_0x51a7ea[_0x8c25('0x34')],_0x51a7ea[_0x8c25('0x31')]);_0x5acf03[_0x8c25('0x35')]=_['intersection'](_0x51a7ea[_0x8c25('0x34')],qs[_0x8c25('0x36')](_0x594d80[_0x8c25('0x31')]['fields']));_0x5acf03['attributes']=_0x5acf03[_0x8c25('0x35')][_0x8c25('0x37')]?_0x5acf03[_0x8c25('0x35')]:_0x51a7ea[_0x8c25('0x34')];if(_0x594d80['query'][_0x8c25('0x42')]){_0x5acf03[_0x8c25('0x43')]=[{'all':!![]}];}_0x5acf03=_[_0x8c25('0x3e')]({},_0x5acf03,_0x594d80[_0x8c25('0x41')]);return db[_0x8c25('0x2c')][_0x8c25('0x48')](_0x5acf03)[_0x8c25('0x26')](handleEntityNotFound(_0x56a247,null))[_0x8c25('0x26')](respondWithResult(_0x56a247,null))[_0x8c25('0x45')](handleError(_0x56a247,null));};exports['create']=function(_0x14900c,_0x594779){return db[_0x8c25('0x2c')][_0x8c25('0x49')](_0x14900c['body'],{})['then'](respondWithResult(_0x594779,0xc9))[_0x8c25('0x45')](handleError(_0x594779,null));};exports[_0x8c25('0x4a')]=function(_0x4653b8,_0x3e0424){if(_0x4653b8[_0x8c25('0x4b')]['id']){delete _0x4653b8[_0x8c25('0x4b')]['id'];}return db['SalesforceAccount'][_0x8c25('0x48')]({'where':{'id':_0x4653b8[_0x8c25('0x46')]['id']}})[_0x8c25('0x26')](handleEntityNotFound(_0x3e0424,null))['then'](saveUpdates(_0x4653b8[_0x8c25('0x4b')],null))[_0x8c25('0x26')](respondWithResult(_0x3e0424,null))[_0x8c25('0x45')](handleError(_0x3e0424,null));};exports[_0x8c25('0x27')]=function(_0xedfc44,_0x1a81c4){return db[_0x8c25('0x2c')][_0x8c25('0x48')]({'where':{'id':_0xedfc44['params']['id']}})[_0x8c25('0x26')](handleEntityNotFound(_0x1a81c4,null))[_0x8c25('0x26')](removeEntity(_0x1a81c4,null))[_0x8c25('0x45')](handleError(_0x1a81c4,null));};exports[_0x8c25('0x4c')]=function(_0x37f57a,_0x2c8fdf,_0xe7099b){var _0x119330={};var _0x56d02d={};var _0x40cc96;var _0x24fff9;return db[_0x8c25('0x2c')][_0x8c25('0x4d')]({'where':{'id':_0x37f57a[_0x8c25('0x46')]['id']}})[_0x8c25('0x26')](handleEntityNotFound(_0x2c8fdf,null))[_0x8c25('0x26')](function(_0x412774){if(_0x412774){_0x40cc96=_0x412774;_0x56d02d[_0x8c25('0x34')]=_[_0x8c25('0x47')](db[_0x8c25('0x4e')][_0x8c25('0x2d')]);_0x56d02d[_0x8c25('0x31')]=_['keys'](_0x37f57a['query']);_0x56d02d[_0x8c25('0x32')]=_[_0x8c25('0x33')](_0x56d02d[_0x8c25('0x34')],_0x56d02d[_0x8c25('0x31')]);_0x119330['attributes']=_['intersection'](_0x56d02d[_0x8c25('0x34')],qs['fields'](_0x37f57a[_0x8c25('0x31')][_0x8c25('0x36')]));_0x119330['attributes']=_0x119330[_0x8c25('0x35')]['length']?_0x119330['attributes']:_0x56d02d[_0x8c25('0x34')];_0x119330[_0x8c25('0x3a')]=qs[_0x8c25('0x3b')](_0x37f57a[_0x8c25('0x31')][_0x8c25('0x3b')]);_0x119330['where']=qs['filters'](_['pick'](_0x37f57a[_0x8c25('0x31')],_0x56d02d[_0x8c25('0x32')]));if(_0x37f57a[_0x8c25('0x31')][_0x8c25('0x3d')]){_0x119330[_0x8c25('0x3f')]=_[_0x8c25('0x3e')](_0x119330[_0x8c25('0x3f')],{'$or':_['map'](_0x119330['attributes'],function(_0x24d4cd){var _0x5e51ef={};_0x5e51ef[_0x24d4cd]={'$like':'%'+_0x37f57a[_0x8c25('0x31')]['filter']+'%'};return _0x5e51ef;})});}_0x119330=_[_0x8c25('0x3e')]({},_0x119330,_0x37f57a[_0x8c25('0x41')]);return _0x40cc96[_0x8c25('0x4c')](_0x119330);}})[_0x8c25('0x26')](function(_0x4880fc){if(_0x4880fc){_0x24fff9=_0x4880fc[_0x8c25('0x37')];if(!_0x37f57a['query'][_0x8c25('0x38')](_0x8c25('0x39'))){_0x119330['limit']=qs[_0x8c25('0x22')](_0x37f57a['query'][_0x8c25('0x22')]);_0x119330[_0x8c25('0x20')]=qs['offset'](_0x37f57a[_0x8c25('0x31')][_0x8c25('0x20')]);}return _0x40cc96[_0x8c25('0x4c')](_0x119330);}})[_0x8c25('0x26')](function(_0x463bab){if(_0x463bab){return _0x463bab?{'count':_0x24fff9,'rows':_0x463bab}:null;}})[_0x8c25('0x26')](respondWithResult(_0x2c8fdf,null))[_0x8c25('0x45')](handleError(_0x2c8fdf,null));};exports['addConfiguration']=function(_0x3b7e82,_0x1d78ec,_0x539bc0){if(_0x3b7e82[_0x8c25('0x4b')]['id']){delete _0x3b7e82['body']['id'];}return db['SalesforceAccount'][_0x8c25('0x4d')]({'where':{'id':_0x3b7e82[_0x8c25('0x46')]['id']}})[_0x8c25('0x26')](handleEntityNotFound(_0x1d78ec,null))[_0x8c25('0x26')](function(_0x219970){if(_0x219970){_0x3b7e82[_0x8c25('0x4b')]['AccountId']=_0x219970['id'];_0x3b7e82[_0x8c25('0x4b')][_0x8c25('0x4f')]=integrations[_0x8c25('0x50')](_0x3b7e82[_0x8c25('0x4b')][_0x8c25('0x51')],_0x3b7e82['body'][_0x8c25('0x2f')]);_0x3b7e82[_0x8c25('0x4b')][_0x8c25('0x52')]=integrations[_0x8c25('0x53')](_0x3b7e82[_0x8c25('0x4b')]['channel'],_0x3b7e82[_0x8c25('0x4b')][_0x8c25('0x2f')]);return db[_0x8c25('0x4e')][_0x8c25('0x49')](_0x3b7e82['body'],{'include':[{'model':db[_0x8c25('0x54')],'as':_0x8c25('0x4f')},{'model':db[_0x8c25('0x54')],'as':'Descriptions'}]});}return null;})[_0x8c25('0x26')](respondWithResult(_0x1d78ec,null))[_0x8c25('0x45')](handleError(_0x1d78ec,null));};exports['getFields']=function(_0x3889b7,_0x3ac17c,_0x221cee){var _0x4af78b;var _0x17a729='';var _0xbdd3b7=_0x8c25('0x55');return db[_0x8c25('0x2c')]['findOne']({'where':{'id':_0x3889b7['params']['id']},'attributes':['id',_0x8c25('0x56'),_0x8c25('0x57'),'clientSecret',_0x8c25('0x58'),'password',_0x8c25('0x59')]})[_0x8c25('0x26')](handleEntityNotFound(_0x3ac17c,null))['then'](function(_0x54fcfd){if(_0x54fcfd){_0x17a729=_0x54fcfd[_0x8c25('0x56')];var _0x5692cb=_0x17a729[_0x8c25('0x5a')](-0x1);if(_0x5692cb==='/'){_0x17a729=_0x17a729[_0x8c25('0x5b')](0x0,_0x17a729[_0x8c25('0x5c')](_0x5692cb));}_0x4af78b=new jsforce[(_0x8c25('0x5d'))]({'oauth2':{'loginUrl':_0x17a729,'clientId':_0x54fcfd['clientId'],'clientSecret':_0x54fcfd[_0x8c25('0x5e')]}});return _0x4af78b[_0x8c25('0x5f')](_0x54fcfd['username'],_0x54fcfd[_0x8c25('0x60')][_0x8c25('0x61')](_0x54fcfd[_0x8c25('0x59')]));}})['then'](function(_0x103161){if(_0x103161){if(!_[_0x8c25('0x62')](_0x3889b7[_0x8c25('0x31')][_0x8c25('0x63')])){_0xbdd3b7=_0x3889b7[_0x8c25('0x31')][_0x8c25('0x63')];}return _0x4af78b[_0x8c25('0x64')](_0xbdd3b7)[_0x8c25('0x65')]();}})[_0x8c25('0x26')](function(_0x585329){var _0x5e6e15=[_0x8c25('0x66'),_0x8c25('0x67'),_0x8c25('0x68'),_0x8c25('0x69'),_0x8c25('0x6a'),_0x8c25('0x6b')];var _0x3452f4=['string',_0x8c25('0x6c'),_0x8c25('0x6d'),_0x8c25('0x6e'),_0x8c25('0x6f'),'textarea',_0x8c25('0x70')];if(_0x585329){_[_0x8c25('0x71')](_0x585329[_0x8c25('0x36')],function(_0x4afbcf){return _0x5e6e15[_0x8c25('0x72')](_0x4afbcf[_0x8c25('0x30')])||!_0x3452f4['includes'](_0x4afbcf[_0x8c25('0x2f')]);});return{'count':_0x585329[_0x8c25('0x36')][_0x8c25('0x37')],'rows':_['map'](_0x585329[_0x8c25('0x36')],function(_0x1ca3c4){return{'id':_0x1ca3c4[_0x8c25('0x30')],'name':_0x1ca3c4[_0x8c25('0x73')],'custom':_0x1ca3c4[_0x8c25('0x74')],'options':_0x1ca3c4[_0x8c25('0x75')][_0x8c25('0x37')]>0x0?_[_0x8c25('0x2b')](_0x1ca3c4[_0x8c25('0x75')],function(_0x1e5c35){return{'name':_0x1e5c35[_0x8c25('0x73')],'value':_0x1e5c35[_0x8c25('0x76')]};}):_0x1ca3c4['type']==_0x8c25('0x6e')?[{'name':_0x8c25('0x77'),'value':_0x8c25('0x78')},{'name':_0x8c25('0x79'),'value':_0x8c25('0x7a')}]:[]};})};}})[_0x8c25('0x26')](respondWithResult(_0x3ac17c,null))[_0x8c25('0x45')](function(_0x502cbe){var _0x25c9b6=_0x3889b7[_0x8c25('0x31')][_0x8c25('0x7b')]?0x1f4:_0x502cbe[_0x8c25('0x7c')]||0x1f4;logger[_0x8c25('0x28')](_0x8c25('0x7d'),_0x8c25('0x7e'),_0x25c9b6,JSON[_0x8c25('0x7f')](_0x502cbe));delete _0x502cbe[_0x8c25('0x30')];if(_0x25c9b6===0x191){_0x25c9b6=0x190;}_0x3ac17c[_0x8c25('0x1d')](_0x25c9b6)['send'](_0x3889b7['query'][_0x8c25('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x502cbe[_0x8c25('0x7c')]}:_0x502cbe);});}; \ No newline at end of file +var _0xc015=['boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','Task','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','concat','ticketType','sobject','OwnerId','IsRecurrence','Description','picklist'];(function(_0x4a0e61,_0x571bb1){var _0x33a50f=function(_0x4ed905){while(--_0x4ed905){_0x4a0e61['push'](_0x4a0e61['shift']());}};_0x33a50f(++_0x571bb1);}(_0xc015,0x85));var _0x5c01=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0xc015[_0x33bcdb];return _0x18a9bf;};'use strict';var emlformat=require(_0x5c01('0x0'));var rimraf=require(_0x5c01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c01('0x2'));var rp=require(_0x5c01('0x3'));var moment=require(_0x5c01('0x4'));var BPromise=require(_0x5c01('0x5'));var Mustache=require(_0x5c01('0x6'));var util=require(_0x5c01('0x7'));var path=require(_0x5c01('0x8'));var sox=require(_0x5c01('0x9'));var csv=require(_0x5c01('0xa'));var ejs=require(_0x5c01('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(_0x5c01('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c01('0xa'));var querystring=require('querystring');var Papa=require(_0x5c01('0xd'));var Redis=require('ioredis');var authService=require(_0x5c01('0xe'));var qs=require(_0x5c01('0xf'));var as=require(_0x5c01('0x10'));var hardwareService=require(_0x5c01('0x11'));var logger=require(_0x5c01('0x12'))(_0x5c01('0x13'));var utils=require('../../config/utils');var config=require(_0x5c01('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c01('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xd0f224,_0x39707e){_0x39707e=_0x39707e||0xcc;return function(_0x318fd8){if(_0x318fd8){return _0xd0f224[_0x5c01('0x16')](_0x39707e);}return _0xd0f224[_0x5c01('0x17')](_0x39707e)[_0x5c01('0x18')]();};}function respondWithResult(_0x5b6c5f,_0x5339a9){_0x5339a9=_0x5339a9||0xc8;return function(_0x1f242e){if(_0x1f242e){return _0x5b6c5f[_0x5c01('0x17')](_0x5339a9)[_0x5c01('0x19')](_0x1f242e);}};}function respondWithFilteredResult(_0x41c4b9,_0x55a25){return function(_0x3707a0){if(_0x3707a0){var _0x314b4d=typeof _0x55a25[_0x5c01('0x1a')]==='undefined'&&typeof _0x55a25[_0x5c01('0x1b')]===_0x5c01('0x1c');var _0x2743bf=_0x3707a0[_0x5c01('0x1d')];var _0x1ae83b=_0x314b4d?0x0:_0x55a25['offset'];var _0x559733=_0x314b4d?_0x3707a0['count']:_0x55a25[_0x5c01('0x1a')]+_0x55a25[_0x5c01('0x1b')];var _0x35d0c9;if(_0x559733>=_0x2743bf){_0x559733=_0x2743bf;_0x35d0c9=0xc8;}else{_0x35d0c9=0xce;}_0x41c4b9[_0x5c01('0x17')](_0x35d0c9);return _0x41c4b9[_0x5c01('0x1e')](_0x5c01('0x1f'),_0x1ae83b+'-'+_0x559733+'/'+_0x2743bf)[_0x5c01('0x19')](_0x3707a0);}return null;};}function patchUpdates(_0x504c63){return function(_0x649fea){try{jsonpatch[_0x5c01('0x20')](_0x649fea,_0x504c63,!![]);}catch(_0x51f93c){return BPromise[_0x5c01('0x21')](_0x51f93c);}return _0x649fea['save']();};}function saveUpdates(_0x2eba4e,_0x3c8d78){return function(_0x10cfb6){if(_0x10cfb6){return _0x10cfb6[_0x5c01('0x22')](_0x2eba4e)[_0x5c01('0x23')](function(_0x1f55d4){return _0x1f55d4;});}return null;};}function removeEntity(_0x406594,_0x212495){return function(_0x4afc0f){if(_0x4afc0f){return _0x4afc0f[_0x5c01('0x24')]()[_0x5c01('0x23')](function(){_0x406594['status'](0xcc)[_0x5c01('0x18')]();});}};}function handleEntityNotFound(_0x11d0ec,_0x3cdfca){return function(_0x55d6a1){if(!_0x55d6a1){_0x11d0ec[_0x5c01('0x16')](0x194);}return _0x55d6a1;};}function handleError(_0x5a5991,_0x22cc0c){_0x22cc0c=_0x22cc0c||0x1f4;return function(_0x23e1af){logger[_0x5c01('0x25')](_0x23e1af[_0x5c01('0x26')]);if(_0x23e1af['name']){delete _0x23e1af[_0x5c01('0x27')];}_0x5a5991[_0x5c01('0x17')](_0x22cc0c)[_0x5c01('0x28')](_0x23e1af);};}exports[_0x5c01('0x29')]=function(_0x573b16,_0x37c103){var _0x45183d={},_0x478ff8={},_0x51fd3b={'count':0x0,'rows':[]};var _0x56d4ee=_[_0x5c01('0x2a')](db[_0x5c01('0x2b')][_0x5c01('0x2c')],function(_0x420514){return{'name':_0x420514['fieldName'],'type':_0x420514['type'][_0x5c01('0x2d')]};});_0x478ff8['model']=_[_0x5c01('0x2a')](_0x56d4ee,'name');_0x478ff8[_0x5c01('0x2e')]=_[_0x5c01('0x2f')](_0x573b16[_0x5c01('0x2e')]);_0x478ff8[_0x5c01('0x30')]=_[_0x5c01('0x31')](_0x478ff8[_0x5c01('0x32')],_0x478ff8[_0x5c01('0x2e')]);_0x45183d[_0x5c01('0x33')]=_['intersection'](_0x478ff8[_0x5c01('0x32')],qs[_0x5c01('0x34')](_0x573b16['query']['fields']));_0x45183d['attributes']=_0x45183d[_0x5c01('0x33')][_0x5c01('0x35')]?_0x45183d[_0x5c01('0x33')]:_0x478ff8[_0x5c01('0x32')];if(!_0x573b16[_0x5c01('0x2e')][_0x5c01('0x36')](_0x5c01('0x37'))){_0x45183d['limit']=qs[_0x5c01('0x1b')](_0x573b16[_0x5c01('0x2e')][_0x5c01('0x1b')]);_0x45183d[_0x5c01('0x1a')]=qs[_0x5c01('0x1a')](_0x573b16[_0x5c01('0x2e')][_0x5c01('0x1a')]);}_0x45183d[_0x5c01('0x38')]=qs[_0x5c01('0x39')](_0x573b16[_0x5c01('0x2e')]['sort']);_0x45183d[_0x5c01('0x3a')]=qs[_0x5c01('0x30')](_[_0x5c01('0x3b')](_0x573b16[_0x5c01('0x2e')],_0x478ff8[_0x5c01('0x30')]),_0x56d4ee);if(_0x573b16[_0x5c01('0x2e')]['filter']){_0x45183d[_0x5c01('0x3a')]=_[_0x5c01('0x3c')](_0x45183d['where'],{'$or':_['map'](_0x56d4ee,function(_0x3bd64c){if(_0x3bd64c[_0x5c01('0x3d')]!==_0x5c01('0x3e')){var _0x32268e={};_0x32268e[_0x3bd64c[_0x5c01('0x27')]]={'$like':'%'+_0x573b16[_0x5c01('0x2e')][_0x5c01('0x3f')]+'%'};return _0x32268e;}})});}_0x45183d=_[_0x5c01('0x3c')]({},_0x45183d,_0x573b16[_0x5c01('0x40')]);var _0xaf24f7={'where':_0x45183d[_0x5c01('0x3a')]};return db['SalesforceAccount'][_0x5c01('0x1d')](_0xaf24f7)[_0x5c01('0x23')](function(_0x250165){_0x51fd3b['count']=_0x250165;if(_0x573b16[_0x5c01('0x2e')][_0x5c01('0x41')]){_0x45183d[_0x5c01('0x42')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x45183d);})[_0x5c01('0x23')](function(_0x5415f1){_0x51fd3b['rows']=_0x5415f1;return _0x51fd3b;})[_0x5c01('0x23')](respondWithFilteredResult(_0x37c103,_0x45183d))[_0x5c01('0x43')](handleError(_0x37c103,null));};exports[_0x5c01('0x44')]=function(_0x671d45,_0x3b4bce){var _0x143f33={'raw':![],'where':{'id':_0x671d45[_0x5c01('0x45')]['id']}},_0x384dc7={};_0x384dc7['model']=_[_0x5c01('0x2f')](db[_0x5c01('0x2b')][_0x5c01('0x2c')]);_0x384dc7[_0x5c01('0x2e')]=_[_0x5c01('0x2f')](_0x671d45[_0x5c01('0x2e')]);_0x384dc7[_0x5c01('0x30')]=_[_0x5c01('0x31')](_0x384dc7[_0x5c01('0x32')],_0x384dc7[_0x5c01('0x2e')]);_0x143f33['attributes']=_['intersection'](_0x384dc7[_0x5c01('0x32')],qs['fields'](_0x671d45[_0x5c01('0x2e')][_0x5c01('0x34')]));_0x143f33['attributes']=_0x143f33[_0x5c01('0x33')][_0x5c01('0x35')]?_0x143f33['attributes']:_0x384dc7[_0x5c01('0x32')];if(_0x671d45[_0x5c01('0x2e')][_0x5c01('0x41')]){_0x143f33['include']=[{'all':!![]}];}_0x143f33=_[_0x5c01('0x3c')]({},_0x143f33,_0x671d45[_0x5c01('0x40')]);return db[_0x5c01('0x2b')][_0x5c01('0x46')](_0x143f33)[_0x5c01('0x23')](handleEntityNotFound(_0x3b4bce,null))[_0x5c01('0x23')](respondWithResult(_0x3b4bce,null))['catch'](handleError(_0x3b4bce,null));};exports[_0x5c01('0x47')]=function(_0x39022f,_0x3d438c){return db[_0x5c01('0x2b')]['create'](_0x39022f[_0x5c01('0x48')],{})[_0x5c01('0x23')](respondWithResult(_0x3d438c,0xc9))[_0x5c01('0x43')](handleError(_0x3d438c,null));};exports[_0x5c01('0x22')]=function(_0xfadd88,_0x11eb03){if(_0xfadd88[_0x5c01('0x48')]['id']){delete _0xfadd88['body']['id'];}return db[_0x5c01('0x2b')][_0x5c01('0x46')]({'where':{'id':_0xfadd88[_0x5c01('0x45')]['id']}})['then'](handleEntityNotFound(_0x11eb03,null))['then'](saveUpdates(_0xfadd88[_0x5c01('0x48')],null))['then'](respondWithResult(_0x11eb03,null))[_0x5c01('0x43')](handleError(_0x11eb03,null));};exports[_0x5c01('0x24')]=function(_0x290c9f,_0x9d2471){return db['SalesforceAccount'][_0x5c01('0x46')]({'where':{'id':_0x290c9f[_0x5c01('0x45')]['id']}})[_0x5c01('0x23')](handleEntityNotFound(_0x9d2471,null))[_0x5c01('0x23')](removeEntity(_0x9d2471,null))[_0x5c01('0x43')](handleError(_0x9d2471,null));};exports['getConfigurations']=function(_0x8712,_0x3c9fdd,_0x5359dc){var _0x4629bd={};var _0x17c5bd={};var _0x311fc9;var _0x4f9e55;return db[_0x5c01('0x2b')][_0x5c01('0x49')]({'where':{'id':_0x8712[_0x5c01('0x45')]['id']}})[_0x5c01('0x23')](handleEntityNotFound(_0x3c9fdd,null))['then'](function(_0x1b544d){if(_0x1b544d){_0x311fc9=_0x1b544d;_0x17c5bd[_0x5c01('0x32')]=_['keys'](db[_0x5c01('0x4a')][_0x5c01('0x2c')]);_0x17c5bd[_0x5c01('0x2e')]=_['keys'](_0x8712[_0x5c01('0x2e')]);_0x17c5bd['filters']=_[_0x5c01('0x31')](_0x17c5bd['model'],_0x17c5bd[_0x5c01('0x2e')]);_0x4629bd[_0x5c01('0x33')]=_[_0x5c01('0x31')](_0x17c5bd[_0x5c01('0x32')],qs[_0x5c01('0x34')](_0x8712[_0x5c01('0x2e')][_0x5c01('0x34')]));_0x4629bd['attributes']=_0x4629bd[_0x5c01('0x33')][_0x5c01('0x35')]?_0x4629bd[_0x5c01('0x33')]:_0x17c5bd[_0x5c01('0x32')];_0x4629bd[_0x5c01('0x38')]=qs[_0x5c01('0x39')](_0x8712[_0x5c01('0x2e')][_0x5c01('0x39')]);_0x4629bd[_0x5c01('0x3a')]=qs['filters'](_['pick'](_0x8712['query'],_0x17c5bd[_0x5c01('0x30')]));if(_0x8712['query'][_0x5c01('0x3f')]){_0x4629bd[_0x5c01('0x3a')]=_[_0x5c01('0x3c')](_0x4629bd[_0x5c01('0x3a')],{'$or':_[_0x5c01('0x2a')](_0x4629bd[_0x5c01('0x33')],function(_0x10ebe2){var _0x22a0c2={};_0x22a0c2[_0x10ebe2]={'$like':'%'+_0x8712['query']['filter']+'%'};return _0x22a0c2;})});}_0x4629bd=_[_0x5c01('0x3c')]({},_0x4629bd,_0x8712[_0x5c01('0x40')]);return _0x311fc9[_0x5c01('0x4b')](_0x4629bd);}})[_0x5c01('0x23')](function(_0x8df65a){if(_0x8df65a){_0x4f9e55=_0x8df65a[_0x5c01('0x35')];if(!_0x8712['query']['hasOwnProperty'](_0x5c01('0x37'))){_0x4629bd[_0x5c01('0x1b')]=qs[_0x5c01('0x1b')](_0x8712['query'][_0x5c01('0x1b')]);_0x4629bd[_0x5c01('0x1a')]=qs['offset'](_0x8712[_0x5c01('0x2e')]['offset']);}return _0x311fc9['getConfigurations'](_0x4629bd);}})[_0x5c01('0x23')](function(_0x2b9e1c){if(_0x2b9e1c){return _0x2b9e1c?{'count':_0x4f9e55,'rows':_0x2b9e1c}:null;}})['then'](respondWithResult(_0x3c9fdd,null))[_0x5c01('0x43')](handleError(_0x3c9fdd,null));};exports[_0x5c01('0x4c')]=function(_0xc9c0e6,_0x5b22c2,_0x34331f){if(_0xc9c0e6[_0x5c01('0x48')]['id']){delete _0xc9c0e6[_0x5c01('0x48')]['id'];}return db[_0x5c01('0x2b')][_0x5c01('0x49')]({'where':{'id':_0xc9c0e6[_0x5c01('0x45')]['id']}})[_0x5c01('0x23')](handleEntityNotFound(_0x5b22c2,null))[_0x5c01('0x23')](function(_0x1a8ef7){if(_0x1a8ef7){_0xc9c0e6[_0x5c01('0x48')][_0x5c01('0x4d')]=_0x1a8ef7['id'];_0xc9c0e6[_0x5c01('0x48')][_0x5c01('0x4e')]=integrations[_0x5c01('0x4f')](_0xc9c0e6[_0x5c01('0x48')][_0x5c01('0x50')],_0xc9c0e6['body']['type']);_0xc9c0e6[_0x5c01('0x48')][_0x5c01('0x51')]=integrations['getDescriptions'](_0xc9c0e6['body'][_0x5c01('0x50')],_0xc9c0e6[_0x5c01('0x48')]['type']);return db[_0x5c01('0x4a')][_0x5c01('0x47')](_0xc9c0e6[_0x5c01('0x48')],{'include':[{'model':db[_0x5c01('0x52')],'as':'Subjects'},{'model':db[_0x5c01('0x52')],'as':'Descriptions'}]});}return null;})[_0x5c01('0x23')](respondWithResult(_0x5b22c2,null))['catch'](handleError(_0x5b22c2,null));};exports['getFields']=function(_0x1c7217,_0x247087,_0x4168b6){var _0x5c8ee7;var _0x3f6b1e='';var _0x5db34a=_0x5c01('0x53');return db[_0x5c01('0x2b')][_0x5c01('0x49')]({'where':{'id':_0x1c7217[_0x5c01('0x45')]['id']},'attributes':['id','remoteUri',_0x5c01('0x54'),_0x5c01('0x55'),_0x5c01('0x56'),_0x5c01('0x57'),_0x5c01('0x58')]})[_0x5c01('0x23')](handleEntityNotFound(_0x247087,null))[_0x5c01('0x23')](function(_0x519e2c){if(_0x519e2c){_0x3f6b1e=_0x519e2c['remoteUri'];var _0x2290c6=_0x3f6b1e['slice'](-0x1);if(_0x2290c6==='/'){_0x3f6b1e=_0x3f6b1e[_0x5c01('0x59')](0x0,_0x3f6b1e[_0x5c01('0x5a')](_0x2290c6));}_0x5c8ee7=new jsforce[(_0x5c01('0x5b'))]({'oauth2':{'loginUrl':_0x3f6b1e,'clientId':_0x519e2c['clientId'],'clientSecret':_0x519e2c[_0x5c01('0x55')]}});return _0x5c8ee7['login'](_0x519e2c[_0x5c01('0x56')],_0x519e2c[_0x5c01('0x57')][_0x5c01('0x5c')](_0x519e2c['securityToken']));}})[_0x5c01('0x23')](function(_0xc16ae5){if(_0xc16ae5){if(!_['isNil'](_0x1c7217[_0x5c01('0x2e')]['ticketType'])){_0x5db34a=_0x1c7217[_0x5c01('0x2e')][_0x5c01('0x5d')];}return _0x5c8ee7[_0x5c01('0x5e')](_0x5db34a)['describe']();}})['then'](function(_0x4415ed){var _0x54a276=[_0x5c01('0x5f'),'ActivityDate','IsReminderSet',_0x5c01('0x60'),'Subject',_0x5c01('0x61')];var _0x90500d=['string','int',_0x5c01('0x62'),_0x5c01('0x63'),_0x5c01('0x64'),'textarea',_0x5c01('0x65')];if(_0x4415ed){_[_0x5c01('0x66')](_0x4415ed[_0x5c01('0x34')],function(_0x417bfb){return _0x54a276[_0x5c01('0x67')](_0x417bfb[_0x5c01('0x27')])||!_0x90500d['includes'](_0x417bfb[_0x5c01('0x3d')]);});return{'count':_0x4415ed[_0x5c01('0x34')]['length'],'rows':_[_0x5c01('0x2a')](_0x4415ed[_0x5c01('0x34')],function(_0x1c3cb0){return{'id':_0x1c3cb0['name'],'name':_0x1c3cb0[_0x5c01('0x68')],'custom':_0x1c3cb0[_0x5c01('0x69')],'options':_0x1c3cb0[_0x5c01('0x6a')][_0x5c01('0x35')]>0x0?_['map'](_0x1c3cb0['picklistValues'],function(_0x2ec22f){return{'name':_0x2ec22f[_0x5c01('0x68')],'value':_0x2ec22f[_0x5c01('0x6b')]};}):_0x1c3cb0['type']==_0x5c01('0x63')?[{'name':_0x5c01('0x6c'),'value':_0x5c01('0x6d')},{'name':_0x5c01('0x6e'),'value':'false'}]:[]};})};}})[_0x5c01('0x23')](respondWithResult(_0x247087,null))[_0x5c01('0x43')](function(_0x27129b){var _0x25522f=_0x1c7217[_0x5c01('0x2e')][_0x5c01('0x6f')]?0x1f4:_0x27129b[_0x5c01('0x70')]||0x1f4;logger[_0x5c01('0x25')](_0x5c01('0x71'),_0x5c01('0x72'),_0x25522f,JSON[_0x5c01('0x73')](_0x27129b));delete _0x27129b[_0x5c01('0x27')];if(_0x25522f===0x191){_0x25522f=0x190;}_0x247087['status'](_0x25522f)[_0x5c01('0x28')](_0x1c7217['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x27129b['statusCode']}:_0x27129b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 88402e0..c06f6f2 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 _0xca57=['int_salesforce_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount'];(function(_0x161698,_0x6e60e7){var _0x22c3b8=function(_0x1c5e69){while(--_0x1c5e69){_0x161698['push'](_0x161698['shift']());}};_0x22c3b8(++_0x6e60e7);}(_0xca57,0x1d5));var _0x7ca5=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xca57[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x7ca5('0x0'));var util=require(_0x7ca5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7ca5('0x2'));var BPromise=require(_0x7ca5('0x3'));var rp=require(_0x7ca5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca5('0x5'));var config=require(_0x7ca5('0x6'));var attributes=require(_0x7ca5('0x7'));var integrations=require(_0x7ca5('0x8'));module['exports']=function(_0x13a4aa,_0x28a9e7){return _0x13a4aa[_0x7ca5('0x9')](_0x7ca5('0xa'),attributes,{'tableName':_0x7ca5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x795a=['define','int_salesforce_accounts','util','../../config/logger','moment','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1abae0,_0x4d4bab){var _0x338a77=function(_0x1db2cd){while(--_0x1db2cd){_0x1abae0['push'](_0x1abae0['shift']());}};_0x338a77(++_0x4d4bab);}(_0x795a,0xa2));var _0xa795=function(_0x1b585f,_0x16c1fe){_0x1b585f=_0x1b585f-0x0;var _0x219fb2=_0x795a[_0x1b585f];return _0x219fb2;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var logger=require(_0xa795('0x1'))('api');var moment=require(_0xa795('0x2'));var BPromise=require('bluebird');var rp=require(_0xa795('0x3'));var fs=require('fs');var path=require(_0xa795('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa795('0x5'));var integrations=require(_0xa795('0x6'));module[_0xa795('0x7')]=function(_0x2efc9b,_0x553cf3){return _0x2efc9b[_0xa795('0x8')]('SalesforceAccount',attributes,{'tableName':_0xa795('0x9'),'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 94fd920..2f573a4 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 _0x2bce=['find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount'];(function(_0x163ab5,_0x6a7dbe){var _0x17e579=function(_0x10733f){while(--_0x10733f){_0x163ab5['push'](_0x163ab5['shift']());}};_0x17e579(++_0x6a7dbe);}(_0x2bce,0x6d));var _0xe2bc=function(_0x4b53d5,_0x4bd47c){_0x4b53d5=_0x4b53d5-0x0;var _0x10d380=_0x2bce[_0x4b53d5];return _0x10d380;};'use strict';var _=require(_0xe2bc('0x0'));var util=require(_0xe2bc('0x1'));var moment=require(_0xe2bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2bc('0x4'))['db'];var utils=require(_0xe2bc('0x5'));var logger=require(_0xe2bc('0x6'))(_0xe2bc('0x7'));var config=require(_0xe2bc('0x8'));var jayson=require(_0xe2bc('0x9'));var client=jayson['client'][_0xe2bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494308,_0x4f5cf,_0x43e828){return new BPromise(function(_0x13b676,_0x316fc4){return client['request'](_0x494308,_0x43e828)[_0xe2bc('0xb')](function(_0x57d41b){logger[_0xe2bc('0xc')](_0xe2bc('0xd'),_0x4f5cf,'request\x20sent');logger[_0xe2bc('0xe')](_0xe2bc('0xf'),_0x4f5cf,_0xe2bc('0x10'),JSON['stringify'](_0x57d41b));if(_0x57d41b['error']){if(_0x57d41b[_0xe2bc('0x11')][_0xe2bc('0x12')]===0x1f4){logger[_0xe2bc('0x11')](_0xe2bc('0xd'),_0x4f5cf,_0x57d41b[_0xe2bc('0x11')][_0xe2bc('0x13')]);return _0x316fc4(_0x57d41b[_0xe2bc('0x11')][_0xe2bc('0x13')]);}logger[_0xe2bc('0x11')](_0xe2bc('0xd'),_0x4f5cf,_0x57d41b['error'][_0xe2bc('0x13')]);return _0x13b676(_0x57d41b['error'][_0xe2bc('0x13')]);}else{logger[_0xe2bc('0xc')](_0xe2bc('0xd'),_0x4f5cf,_0xe2bc('0x10'));_0x13b676(_0x57d41b[_0xe2bc('0x14')][_0xe2bc('0x13')]);}})[_0xe2bc('0x15')](function(_0x59af2e){logger[_0xe2bc('0x11')](_0xe2bc('0xd'),_0x4f5cf,_0x59af2e);_0x316fc4(_0x59af2e);});});}exports['GetSalesforceAccount']=function(_0x36dbb1){var _0x152ae7=this;return new Promise(function(_0x568cf7,_0x64baa3){return db[_0xe2bc('0x16')][_0xe2bc('0x17')]({'raw':_0x36dbb1['options']?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x19')]===undefined?!![]:![]:!![],'where':_0x36dbb1[_0xe2bc('0x18')]?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1a')]||null:null,'attributes':_0x36dbb1[_0xe2bc('0x18')]?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1b')]||null:null,'limit':_0x36dbb1[_0xe2bc('0x18')]?_0x36dbb1['options'][_0xe2bc('0x1c')]||null:null,'include':_0x36dbb1['options']?_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1d')]?_[_0xe2bc('0x1e')](_0x36dbb1[_0xe2bc('0x18')][_0xe2bc('0x1d')],function(_0x373942){return{'model':db[_0x373942[_0xe2bc('0x1f')]],'as':_0x373942['as'],'attributes':_0x373942['attributes'],'include':_0x373942[_0xe2bc('0x1d')]?_[_0xe2bc('0x1e')](_0x373942['include'],function(_0x2a16f0){return{'model':db[_0x2a16f0[_0xe2bc('0x1f')]],'as':_0x2a16f0['as'],'attributes':_0x2a16f0[_0xe2bc('0x1b')],'include':_0x2a16f0[_0xe2bc('0x1d')]?_[_0xe2bc('0x1e')](_0x2a16f0[_0xe2bc('0x1d')],function(_0x436f20){return{'model':db[_0x436f20[_0xe2bc('0x1f')]],'as':_0x436f20['as'],'attributes':_0x436f20[_0xe2bc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b0e05){logger[_0xe2bc('0xc')](_0xe2bc('0x20'),_0x36dbb1);logger[_0xe2bc('0xe')](_0xe2bc('0x20'),_0x36dbb1,JSON[_0xe2bc('0x21')](_0x1b0e05));_0x568cf7(_0x1b0e05);})[_0xe2bc('0x15')](function(_0x10e98c){logger[_0xe2bc('0x11')](_0xe2bc('0x20'),_0x10e98c[_0xe2bc('0x13')],_0x36dbb1);_0x64baa3(_0x152ae7[_0xe2bc('0x11')](0x1f4,_0x10e98c[_0xe2bc('0x13')]));});});};exports[_0xe2bc('0x22')]=function(_0x35ebbf){var _0x2b140c=this;return new Promise(function(_0x1cb9c4,_0x704e3c){return db[_0xe2bc('0x16')][_0xe2bc('0x23')]({'raw':_0x35ebbf['options']?_0x35ebbf[_0xe2bc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x35ebbf['options']?_0x35ebbf[_0xe2bc('0x18')]['where']||null:null,'attributes':_0x35ebbf[_0xe2bc('0x18')]?_0x35ebbf[_0xe2bc('0x18')][_0xe2bc('0x1b')]||null:null,'include':_0x35ebbf['options']?_0x35ebbf[_0xe2bc('0x18')][_0xe2bc('0x1d')]?_['map'](_0x35ebbf[_0xe2bc('0x18')]['include'],function(_0x437249){return{'model':db[_0x437249[_0xe2bc('0x1f')]],'as':_0x437249['as'],'attributes':_0x437249[_0xe2bc('0x1b')],'include':_0x437249['include']?_[_0xe2bc('0x1e')](_0x437249[_0xe2bc('0x1d')],function(_0x14f151){return{'model':db[_0x14f151[_0xe2bc('0x1f')]],'as':_0x14f151['as'],'attributes':_0x14f151['attributes'],'include':_0x14f151['include']?_[_0xe2bc('0x1e')](_0x14f151[_0xe2bc('0x1d')],function(_0x45ed59){return{'model':db[_0x45ed59[_0xe2bc('0x1f')]],'as':_0x45ed59['as'],'attributes':_0x45ed59[_0xe2bc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe2bc('0xb')](function(_0x14f79a){logger[_0xe2bc('0xc')](_0xe2bc('0x22'),_0x35ebbf);logger['debug']('ShowSalesforceAccount',_0x35ebbf,JSON[_0xe2bc('0x21')](_0x14f79a));_0x1cb9c4(_0x14f79a);})[_0xe2bc('0x15')](function(_0x3ce838){logger['error'](_0xe2bc('0x22'),_0x3ce838[_0xe2bc('0x13')],_0x35ebbf);_0x704e3c(_0x2b140c[_0xe2bc('0x11')](0x1f4,_0x3ce838['message']));});});}; \ No newline at end of file +var _0x6637=['catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','SalesforceAccount','find','ShowSalesforceAccount','stringify','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2b4629,_0x2cfe26){var _0x1d8fa9=function(_0x54de40){while(--_0x54de40){_0x2b4629['push'](_0x2b4629['shift']());}};_0x1d8fa9(++_0x2cfe26);}(_0x6637,0xfe));var _0x7663=function(_0x2465c6,_0x412a0a){_0x2465c6=_0x2465c6-0x0;var _0x28b33c=_0x6637[_0x2465c6];return _0x28b33c;};'use strict';var _=require('lodash');var util=require(_0x7663('0x0'));var moment=require(_0x7663('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7663('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7663('0x3'));var logger=require('../../config/logger')(_0x7663('0x4'));var config=require(_0x7663('0x5'));var jayson=require(_0x7663('0x6'));var client=jayson[_0x7663('0x7')][_0x7663('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bca8c,_0x2bca5b,_0x6499ab){return new BPromise(function(_0x5f1def,_0x50bd49){return client[_0x7663('0x9')](_0x2bca8c,_0x6499ab)['then'](function(_0xfb2b07){logger[_0x7663('0xa')](_0x7663('0xb'),_0x2bca5b,_0x7663('0xc'));logger[_0x7663('0xd')](_0x7663('0xe'),_0x2bca5b,_0x7663('0xc'),JSON['stringify'](_0xfb2b07));if(_0xfb2b07[_0x7663('0xf')]){if(_0xfb2b07['error'][_0x7663('0x10')]===0x1f4){logger['error'](_0x7663('0xb'),_0x2bca5b,_0xfb2b07['error'][_0x7663('0x11')]);return _0x50bd49(_0xfb2b07['error'][_0x7663('0x11')]);}logger['error'](_0x7663('0xb'),_0x2bca5b,_0xfb2b07[_0x7663('0xf')][_0x7663('0x11')]);return _0x5f1def(_0xfb2b07[_0x7663('0xf')][_0x7663('0x11')]);}else{logger[_0x7663('0xa')](_0x7663('0xb'),_0x2bca5b,_0x7663('0xc'));_0x5f1def(_0xfb2b07['result'][_0x7663('0x11')]);}})[_0x7663('0x12')](function(_0x41db8f){logger[_0x7663('0xf')](_0x7663('0xb'),_0x2bca5b,_0x41db8f);_0x50bd49(_0x41db8f);});});}exports[_0x7663('0x13')]=function(_0x1ae687){var _0x344158=this;return new Promise(function(_0x5d755d,_0xb19aea){return db['SalesforceAccount'][_0x7663('0x14')]({'raw':_0x1ae687[_0x7663('0x15')]?_0x1ae687[_0x7663('0x15')][_0x7663('0x16')]===undefined?!![]:![]:!![],'where':_0x1ae687[_0x7663('0x15')]?_0x1ae687[_0x7663('0x15')][_0x7663('0x17')]||null:null,'attributes':_0x1ae687[_0x7663('0x15')]?_0x1ae687[_0x7663('0x15')][_0x7663('0x18')]||null:null,'limit':_0x1ae687[_0x7663('0x15')]?_0x1ae687[_0x7663('0x15')][_0x7663('0x19')]||null:null,'include':_0x1ae687[_0x7663('0x15')]?_0x1ae687['options'][_0x7663('0x1a')]?_[_0x7663('0x1b')](_0x1ae687[_0x7663('0x15')]['include'],function(_0x372197){return{'model':db[_0x372197[_0x7663('0x1c')]],'as':_0x372197['as'],'attributes':_0x372197[_0x7663('0x18')],'include':_0x372197[_0x7663('0x1a')]?_['map'](_0x372197[_0x7663('0x1a')],function(_0x378d1c){return{'model':db[_0x378d1c[_0x7663('0x1c')]],'as':_0x378d1c['as'],'attributes':_0x378d1c[_0x7663('0x18')],'include':_0x378d1c['include']?_[_0x7663('0x1b')](_0x378d1c[_0x7663('0x1a')],function(_0x34b5d4){return{'model':db[_0x34b5d4[_0x7663('0x1c')]],'as':_0x34b5d4['as'],'attributes':_0x34b5d4[_0x7663('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7663('0x1d')](function(_0x2af5c7){logger[_0x7663('0xa')]('GetSalesforceAccount',_0x1ae687);logger['debug']('GetSalesforceAccount',_0x1ae687,JSON['stringify'](_0x2af5c7));_0x5d755d(_0x2af5c7);})[_0x7663('0x12')](function(_0x243ee0){logger[_0x7663('0xf')]('GetSalesforceAccount',_0x243ee0[_0x7663('0x11')],_0x1ae687);_0xb19aea(_0x344158[_0x7663('0xf')](0x1f4,_0x243ee0[_0x7663('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x53786b){var _0x3035f2=this;return new Promise(function(_0x3c2226,_0x469969){return db[_0x7663('0x1e')][_0x7663('0x1f')]({'raw':_0x53786b[_0x7663('0x15')]?_0x53786b['options']['raw']===undefined?!![]:![]:!![],'where':_0x53786b['options']?_0x53786b[_0x7663('0x15')]['where']||null:null,'attributes':_0x53786b[_0x7663('0x15')]?_0x53786b[_0x7663('0x15')][_0x7663('0x18')]||null:null,'include':_0x53786b['options']?_0x53786b['options'][_0x7663('0x1a')]?_[_0x7663('0x1b')](_0x53786b[_0x7663('0x15')][_0x7663('0x1a')],function(_0x8bb4b5){return{'model':db[_0x8bb4b5['model']],'as':_0x8bb4b5['as'],'attributes':_0x8bb4b5[_0x7663('0x18')],'include':_0x8bb4b5['include']?_['map'](_0x8bb4b5[_0x7663('0x1a')],function(_0x1cc70c){return{'model':db[_0x1cc70c[_0x7663('0x1c')]],'as':_0x1cc70c['as'],'attributes':_0x1cc70c[_0x7663('0x18')],'include':_0x1cc70c[_0x7663('0x1a')]?_[_0x7663('0x1b')](_0x1cc70c[_0x7663('0x1a')],function(_0x4f221d){return{'model':db[_0x4f221d[_0x7663('0x1c')]],'as':_0x4f221d['as'],'attributes':_0x4f221d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7663('0x1d')](function(_0x20e2a5){logger[_0x7663('0xa')](_0x7663('0x20'),_0x53786b);logger[_0x7663('0xd')](_0x7663('0x20'),_0x53786b,JSON[_0x7663('0x21')](_0x20e2a5));_0x3c2226(_0x20e2a5);})[_0x7663('0x12')](function(_0x60bec5){logger[_0x7663('0xf')](_0x7663('0x20'),_0x60bec5[_0x7663('0x11')],_0x53786b);_0x469969(_0x3035f2[_0x7663('0xf')](0x1f4,_0x60bec5[_0x7663('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d431c9e..be257a0 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x0b0e[_0x29a29f];return _0x443ea3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xdb28,0x106));var _0x8db2=function(_0x74cce9,_0x230878){_0x74cce9=_0x74cce9-0x0;var _0x50c2a1=_0xdb28[_0x74cce9];return _0x50c2a1;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f0ced11..81e8256 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 _0x4a0e=['lead','account_contact_lead','account','nothing','contact','STRING','sequelize','exports','ENUM','Task','contact_lead'];(function(_0x4db23e,_0x1ca466){var _0x455703=function(_0x353b89){while(--_0x353b89){_0x4db23e['push'](_0x4db23e['shift']());}};_0x455703(++_0x1ca466);}(_0x4a0e,0xab));var _0xe4a0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4a0e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xe4a0('0x0'));module[_0xe4a0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xe4a0('0x2')](_0xe4a0('0x3'),'Case'),'defaultValue':_0xe4a0('0x3')},'moduleSearch':{'type':Sequelize[_0xe4a0('0x2')](_0xe4a0('0x4'),'contact',_0xe4a0('0x5'),_0xe4a0('0x6'),_0xe4a0('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xe4a0('0x2')](_0xe4a0('0x8'),_0xe4a0('0x9'),_0xe4a0('0x5'),_0xe4a0('0x7')),'defaultValue':_0xe4a0('0x5')},'leadId':{'type':Sequelize[_0xe4a0('0xa')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xe4a0('0xa')]},'additionalSearchLead':{'type':Sequelize[_0xe4a0('0xa')]}}; \ No newline at end of file +var _0x8278=['STRING','Case','Task','ENUM','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','exports'];(function(_0x5519df,_0x180fd6){var _0x1759e4=function(_0x482f09){while(--_0x482f09){_0x5519df['push'](_0x5519df['shift']());}};_0x1759e4(++_0x180fd6);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8827('0x0'));module[_0x8827('0x1')]={'name':{'type':Sequelize[_0x8827('0x2')]},'description':{'type':Sequelize[_0x8827('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x8827('0x3')),'defaultValue':_0x8827('0x4')},'moduleSearch':{'type':Sequelize[_0x8827('0x5')](_0x8827('0x6'),'contact',_0x8827('0x7'),_0x8827('0x8'),_0x8827('0x9')),'defaultValue':_0x8827('0x6')},'moduleCreate':{'type':Sequelize[_0x8827('0x5')](_0x8827('0xa'),_0x8827('0xb'),_0x8827('0x7'),_0x8827('0x9')),'defaultValue':_0x8827('0x7')},'leadId':{'type':Sequelize[_0x8827('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x8827('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x8827('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8db237e..b39d55a 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 _0x0748=['reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','model','query','filters','attributes','intersection','fields','length','sort','pick','filter','where','map','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','catch','show','params','keys','find','create','body','SalesforceField','rawAttributes','order','getFields','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x5a5ece,_0x612749){var _0x470616=function(_0xb28c2f){while(--_0xb28c2f){_0x5a5ece['push'](_0x5a5ece['shift']());}};_0x470616(++_0x612749);}(_0x0748,0xce));var _0x8074=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x0748[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require(_0x8074('0x0'));var rimraf=require(_0x8074('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8074('0x2'));var moment=require(_0x8074('0x3'));var BPromise=require(_0x8074('0x4'));var Mustache=require(_0x8074('0x5'));var util=require(_0x8074('0x6'));var path=require('path');var sox=require(_0x8074('0x7'));var csv=require('to-csv');var ejs=require(_0x8074('0x8'));var fs=require('fs');var fs_extra=require(_0x8074('0x9'));var _=require(_0x8074('0xa'));var squel=require(_0x8074('0xb'));var crypto=require('crypto');var jsforce=require(_0x8074('0xc'));var deskjs=require(_0x8074('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8074('0xe'));var Redis=require(_0x8074('0xf'));var authService=require(_0x8074('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8074('0x11'));var hardwareService=require(_0x8074('0x12'));var logger=require(_0x8074('0x13'))(_0x8074('0x14'));var utils=require('../../config/utils');var config=require(_0x8074('0x15'));var licenseUtil=require(_0x8074('0x16'));var db=require(_0x8074('0x17'))['db'];function respondWithStatusCode(_0x49ab3b,_0x5b8f27){_0x5b8f27=_0x5b8f27||0xcc;return function(_0x5f0a44){if(_0x5f0a44){return _0x49ab3b[_0x8074('0x18')](_0x5b8f27);}return _0x49ab3b['status'](_0x5b8f27)[_0x8074('0x19')]();};}function respondWithResult(_0x5258d2,_0x24ec6d){_0x24ec6d=_0x24ec6d||0xc8;return function(_0x3f64cd){if(_0x3f64cd){return _0x5258d2[_0x8074('0x1a')](_0x24ec6d)[_0x8074('0x1b')](_0x3f64cd);}};}function respondWithFilteredResult(_0x46c8be,_0x4f3cc1){return function(_0x2b1e76){if(_0x2b1e76){var _0x457e66=typeof _0x4f3cc1[_0x8074('0x1c')]===_0x8074('0x1d')&&typeof _0x4f3cc1[_0x8074('0x1e')]===_0x8074('0x1d');var _0x26626e=_0x2b1e76[_0x8074('0x1f')];var _0x4bda1a=_0x457e66?0x0:_0x4f3cc1['offset'];var _0x3a5e8b=_0x457e66?_0x2b1e76[_0x8074('0x1f')]:_0x4f3cc1['offset']+_0x4f3cc1[_0x8074('0x1e')];var _0xba499c;if(_0x3a5e8b>=_0x26626e){_0x3a5e8b=_0x26626e;_0xba499c=0xc8;}else{_0xba499c=0xce;}_0x46c8be['status'](_0xba499c);return _0x46c8be['set'](_0x8074('0x20'),_0x4bda1a+'-'+_0x3a5e8b+'/'+_0x26626e)[_0x8074('0x1b')](_0x2b1e76);}return null;};}function patchUpdates(_0x1a8f3b){return function(_0x1ead2a){try{jsonpatch[_0x8074('0x21')](_0x1ead2a,_0x1a8f3b,!![]);}catch(_0x34ea45){return BPromise[_0x8074('0x22')](_0x34ea45);}return _0x1ead2a[_0x8074('0x23')]();};}function saveUpdates(_0x4e713b,_0x41d722){return function(_0x69d35f){if(_0x69d35f){return _0x69d35f[_0x8074('0x24')](_0x4e713b)[_0x8074('0x25')](function(_0x3864e7){return _0x3864e7;});}return null;};}function removeEntity(_0x252fe9,_0xc3a022){return function(_0x321e1a){if(_0x321e1a){return _0x321e1a[_0x8074('0x26')]()['then'](function(){_0x252fe9[_0x8074('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bb290,_0x459c90){return function(_0x80a1f9){if(!_0x80a1f9){_0x5bb290[_0x8074('0x18')](0x194);}return _0x80a1f9;};}function handleError(_0x301b7c,_0x56a395){_0x56a395=_0x56a395||0x1f4;return function(_0x57ac9f){logger[_0x8074('0x27')](_0x57ac9f[_0x8074('0x28')]);if(_0x57ac9f[_0x8074('0x29')]){delete _0x57ac9f[_0x8074('0x29')];}_0x301b7c[_0x8074('0x1a')](_0x56a395)[_0x8074('0x2a')](_0x57ac9f);};}exports[_0x8074('0x2b')]=function(_0x6e555d,_0x5848a3){var _0x3200c6={},_0x4b99be={},_0x2af335={'count':0x0,'rows':[]};var _0x40677e=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x529f47){return{'name':_0x529f47[_0x8074('0x2c')],'type':_0x529f47[_0x8074('0x2d')]['key']};});_0x4b99be[_0x8074('0x2e')]=_['map'](_0x40677e,_0x8074('0x29'));_0x4b99be[_0x8074('0x2f')]=_['keys'](_0x6e555d[_0x8074('0x2f')]);_0x4b99be[_0x8074('0x30')]=_['intersection'](_0x4b99be[_0x8074('0x2e')],_0x4b99be[_0x8074('0x2f')]);_0x3200c6[_0x8074('0x31')]=_[_0x8074('0x32')](_0x4b99be['model'],qs[_0x8074('0x33')](_0x6e555d[_0x8074('0x2f')]['fields']));_0x3200c6[_0x8074('0x31')]=_0x3200c6[_0x8074('0x31')][_0x8074('0x34')]?_0x3200c6['attributes']:_0x4b99be['model'];if(!_0x6e555d['query']['hasOwnProperty']('nolimit')){_0x3200c6['limit']=qs[_0x8074('0x1e')](_0x6e555d[_0x8074('0x2f')][_0x8074('0x1e')]);_0x3200c6[_0x8074('0x1c')]=qs['offset'](_0x6e555d[_0x8074('0x2f')][_0x8074('0x1c')]);}_0x3200c6['order']=qs[_0x8074('0x35')](_0x6e555d[_0x8074('0x2f')][_0x8074('0x35')]);_0x3200c6['where']=qs['filters'](_[_0x8074('0x36')](_0x6e555d[_0x8074('0x2f')],_0x4b99be[_0x8074('0x30')]),_0x40677e);if(_0x6e555d[_0x8074('0x2f')][_0x8074('0x37')]){_0x3200c6[_0x8074('0x38')]=_['merge'](_0x3200c6[_0x8074('0x38')],{'$or':_[_0x8074('0x39')](_0x40677e,function(_0x5d81d5){if(_0x5d81d5[_0x8074('0x2d')]!==_0x8074('0x3a')){var _0x4ebb94={};_0x4ebb94[_0x5d81d5[_0x8074('0x29')]]={'$like':'%'+_0x6e555d[_0x8074('0x2f')][_0x8074('0x37')]+'%'};return _0x4ebb94;}})});}_0x3200c6=_[_0x8074('0x3b')]({},_0x3200c6,_0x6e555d[_0x8074('0x3c')]);var _0x2681ce={'where':_0x3200c6[_0x8074('0x38')]};return db[_0x8074('0x3d')][_0x8074('0x1f')](_0x2681ce)[_0x8074('0x25')](function(_0x1f6797){_0x2af335[_0x8074('0x1f')]=_0x1f6797;if(_0x6e555d[_0x8074('0x2f')][_0x8074('0x3e')]){_0x3200c6[_0x8074('0x3f')]=[{'all':!![]}];}return db[_0x8074('0x3d')][_0x8074('0x40')](_0x3200c6);})[_0x8074('0x25')](function(_0x51d7a7){_0x2af335['rows']=_0x51d7a7;return _0x2af335;})[_0x8074('0x25')](respondWithFilteredResult(_0x5848a3,_0x3200c6))[_0x8074('0x41')](handleError(_0x5848a3,null));};exports[_0x8074('0x42')]=function(_0x1fe1f4,_0x3f9ebb){var _0x1015b3={'raw':![],'where':{'id':_0x1fe1f4[_0x8074('0x43')]['id']}},_0x2f34f3={};_0x2f34f3[_0x8074('0x2e')]=_[_0x8074('0x44')](db[_0x8074('0x3d')]['rawAttributes']);_0x2f34f3[_0x8074('0x2f')]=_[_0x8074('0x44')](_0x1fe1f4[_0x8074('0x2f')]);_0x2f34f3[_0x8074('0x30')]=_[_0x8074('0x32')](_0x2f34f3[_0x8074('0x2e')],_0x2f34f3['query']);_0x1015b3[_0x8074('0x31')]=_['intersection'](_0x2f34f3['model'],qs[_0x8074('0x33')](_0x1fe1f4[_0x8074('0x2f')][_0x8074('0x33')]));_0x1015b3['attributes']=_0x1015b3['attributes'][_0x8074('0x34')]?_0x1015b3['attributes']:_0x2f34f3[_0x8074('0x2e')];if(_0x1fe1f4['query'][_0x8074('0x3e')]){_0x1015b3['include']=[{'all':!![]}];}_0x1015b3=_[_0x8074('0x3b')]({},_0x1015b3,_0x1fe1f4['options']);return db['SalesforceConfiguration'][_0x8074('0x45')](_0x1015b3)['then'](handleEntityNotFound(_0x3f9ebb,null))[_0x8074('0x25')](respondWithResult(_0x3f9ebb,null))['catch'](handleError(_0x3f9ebb,null));};exports[_0x8074('0x46')]=function(_0x4ff015,_0x4c3fe6){return db[_0x8074('0x3d')][_0x8074('0x46')](_0x4ff015[_0x8074('0x47')],{})[_0x8074('0x25')](respondWithResult(_0x4c3fe6,0xc9))[_0x8074('0x41')](handleError(_0x4c3fe6,null));};exports[_0x8074('0x24')]=function(_0x3c2186,_0xc382b5){if(_0x3c2186['body']['id']){delete _0x3c2186['body']['id'];}return db['SalesforceConfiguration'][_0x8074('0x45')]({'where':{'id':_0x3c2186[_0x8074('0x43')]['id']}})[_0x8074('0x25')](handleEntityNotFound(_0xc382b5,null))['then'](saveUpdates(_0x3c2186[_0x8074('0x47')],null))[_0x8074('0x25')](respondWithResult(_0xc382b5,null))[_0x8074('0x41')](handleError(_0xc382b5,null));};exports[_0x8074('0x26')]=function(_0x2e0daf,_0xeb0973){return db[_0x8074('0x3d')]['find']({'where':{'id':_0x2e0daf['params']['id']}})[_0x8074('0x25')](handleEntityNotFound(_0xeb0973,null))[_0x8074('0x25')](removeEntity(_0xeb0973,null))['catch'](handleError(_0xeb0973,null));};exports['getFields']=function(_0xfc8d57,_0x4c3b68,_0x5e7a3b){var _0x5bbaad={};var _0x54c6c1={};var _0x24f3ce;var _0x47c16c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xfc8d57['params']['id']}})[_0x8074('0x25')](handleEntityNotFound(_0x4c3b68,null))[_0x8074('0x25')](function(_0x4685fa){if(_0x4685fa){_0x24f3ce=_0x4685fa;_0x54c6c1[_0x8074('0x2e')]=_[_0x8074('0x44')](db[_0x8074('0x48')][_0x8074('0x49')]);_0x54c6c1[_0x8074('0x2f')]=_[_0x8074('0x44')](_0xfc8d57['query']);_0x54c6c1[_0x8074('0x30')]=_[_0x8074('0x32')](_0x54c6c1[_0x8074('0x2e')],_0x54c6c1[_0x8074('0x2f')]);_0x5bbaad[_0x8074('0x31')]=_['intersection'](_0x54c6c1['model'],qs[_0x8074('0x33')](_0xfc8d57[_0x8074('0x2f')][_0x8074('0x33')]));_0x5bbaad[_0x8074('0x31')]=_0x5bbaad[_0x8074('0x31')][_0x8074('0x34')]?_0x5bbaad[_0x8074('0x31')]:_0x54c6c1['model'];_0x5bbaad[_0x8074('0x4a')]=qs[_0x8074('0x35')](_0xfc8d57['query'][_0x8074('0x35')]);_0x5bbaad[_0x8074('0x38')]=qs[_0x8074('0x30')](_[_0x8074('0x36')](_0xfc8d57[_0x8074('0x2f')],_0x54c6c1[_0x8074('0x30')]));if(_0xfc8d57[_0x8074('0x2f')][_0x8074('0x37')]){_0x5bbaad[_0x8074('0x38')]=_[_0x8074('0x3b')](_0x5bbaad[_0x8074('0x38')],{'$or':_[_0x8074('0x39')](_0x5bbaad[_0x8074('0x31')],function(_0x503b54){var _0x3c7dc9={};_0x3c7dc9[_0x503b54]={'$like':'%'+_0xfc8d57[_0x8074('0x2f')][_0x8074('0x37')]+'%'};return _0x3c7dc9;})});}_0x5bbaad=_[_0x8074('0x3b')]({},_0x5bbaad,_0xfc8d57[_0x8074('0x3c')]);return _0x24f3ce[_0x8074('0x4b')](_0x5bbaad);}})[_0x8074('0x25')](function(_0x4e94c6){if(_0x4e94c6){_0x47c16c=_0x4e94c6[_0x8074('0x34')];if(!_0xfc8d57['query'][_0x8074('0x4c')]('nolimit')){_0x5bbaad[_0x8074('0x1e')]=qs[_0x8074('0x1e')](_0xfc8d57[_0x8074('0x2f')][_0x8074('0x1e')]);_0x5bbaad['offset']=qs[_0x8074('0x1c')](_0xfc8d57[_0x8074('0x2f')][_0x8074('0x1c')]);}return _0x24f3ce[_0x8074('0x4b')](_0x5bbaad);}})[_0x8074('0x25')](function(_0x1f8f1f){if(_0x1f8f1f){return _0x1f8f1f?{'count':_0x47c16c,'rows':_0x1f8f1f}:null;}})[_0x8074('0x25')](respondWithResult(_0x4c3b68,null))[_0x8074('0x41')](handleError(_0x4c3b68,null));};exports['getSubjects']=function(_0x4b93a0,_0xdda1dd,_0x438563){var _0x45b2e2={};var _0x2aee9f={};var _0x36a33c;var _0x1ad598;return db[_0x8074('0x3d')][_0x8074('0x4d')]({'where':{'id':_0x4b93a0[_0x8074('0x43')]['id']}})[_0x8074('0x25')](handleEntityNotFound(_0xdda1dd,null))[_0x8074('0x25')](function(_0x22793d){if(_0x22793d){_0x36a33c=_0x22793d;_0x2aee9f[_0x8074('0x2e')]=_[_0x8074('0x44')](db[_0x8074('0x48')][_0x8074('0x49')]);_0x2aee9f[_0x8074('0x2f')]=_[_0x8074('0x44')](_0x4b93a0[_0x8074('0x2f')]);_0x2aee9f['filters']=_[_0x8074('0x32')](_0x2aee9f[_0x8074('0x2e')],_0x2aee9f[_0x8074('0x2f')]);_0x45b2e2[_0x8074('0x31')]=_[_0x8074('0x32')](_0x2aee9f[_0x8074('0x2e')],qs['fields'](_0x4b93a0[_0x8074('0x2f')]['fields']));_0x45b2e2[_0x8074('0x31')]=_0x45b2e2[_0x8074('0x31')][_0x8074('0x34')]?_0x45b2e2['attributes']:_0x2aee9f[_0x8074('0x2e')];_0x45b2e2[_0x8074('0x4a')]=qs[_0x8074('0x35')](_0x4b93a0['query'][_0x8074('0x35')]);_0x45b2e2[_0x8074('0x38')]=qs['filters'](_[_0x8074('0x36')](_0x4b93a0[_0x8074('0x2f')],_0x2aee9f[_0x8074('0x30')]));if(_0x4b93a0[_0x8074('0x2f')]['filter']){_0x45b2e2[_0x8074('0x38')]=_[_0x8074('0x3b')](_0x45b2e2[_0x8074('0x38')],{'$or':_[_0x8074('0x39')](_0x45b2e2[_0x8074('0x31')],function(_0x47da4f){var _0x24372d={};_0x24372d[_0x47da4f]={'$like':'%'+_0x4b93a0[_0x8074('0x2f')][_0x8074('0x37')]+'%'};return _0x24372d;})});}_0x45b2e2=_[_0x8074('0x3b')]({},_0x45b2e2,_0x4b93a0[_0x8074('0x3c')]);return _0x36a33c[_0x8074('0x4e')](_0x45b2e2);}})[_0x8074('0x25')](function(_0xd0b135){if(_0xd0b135){_0x1ad598=_0xd0b135['length'];if(!_0x4b93a0[_0x8074('0x2f')][_0x8074('0x4c')]('nolimit')){_0x45b2e2['limit']=qs[_0x8074('0x1e')](_0x4b93a0['query'][_0x8074('0x1e')]);_0x45b2e2['offset']=qs[_0x8074('0x1c')](_0x4b93a0[_0x8074('0x2f')][_0x8074('0x1c')]);}return _0x36a33c[_0x8074('0x4e')](_0x45b2e2);}})['then'](function(_0xd028d7){if(_0xd028d7){return _0xd028d7?{'count':_0x1ad598,'rows':_0xd028d7}:null;}})[_0x8074('0x25')](respondWithResult(_0xdda1dd,null))[_0x8074('0x41')](handleError(_0xdda1dd,null));};exports[_0x8074('0x4f')]=function(_0x1ecf9f,_0x1e77c3,_0x157975){var _0xe7b612={};var _0x4409be={};var _0x26cbc4;var _0x49b5d1;return db[_0x8074('0x3d')][_0x8074('0x4d')]({'where':{'id':_0x1ecf9f[_0x8074('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e77c3,null))[_0x8074('0x25')](function(_0x568298){if(_0x568298){_0x26cbc4=_0x568298;_0x4409be[_0x8074('0x2e')]=_['keys'](db[_0x8074('0x48')][_0x8074('0x49')]);_0x4409be['query']=_['keys'](_0x1ecf9f[_0x8074('0x2f')]);_0x4409be['filters']=_[_0x8074('0x32')](_0x4409be[_0x8074('0x2e')],_0x4409be[_0x8074('0x2f')]);_0xe7b612[_0x8074('0x31')]=_[_0x8074('0x32')](_0x4409be[_0x8074('0x2e')],qs['fields'](_0x1ecf9f[_0x8074('0x2f')][_0x8074('0x33')]));_0xe7b612[_0x8074('0x31')]=_0xe7b612[_0x8074('0x31')][_0x8074('0x34')]?_0xe7b612[_0x8074('0x31')]:_0x4409be[_0x8074('0x2e')];_0xe7b612[_0x8074('0x4a')]=qs[_0x8074('0x35')](_0x1ecf9f[_0x8074('0x2f')][_0x8074('0x35')]);_0xe7b612[_0x8074('0x38')]=qs['filters'](_['pick'](_0x1ecf9f[_0x8074('0x2f')],_0x4409be[_0x8074('0x30')]));if(_0x1ecf9f['query'][_0x8074('0x37')]){_0xe7b612[_0x8074('0x38')]=_['merge'](_0xe7b612['where'],{'$or':_[_0x8074('0x39')](_0xe7b612[_0x8074('0x31')],function(_0x6c9f56){var _0x37b5f6={};_0x37b5f6[_0x6c9f56]={'$like':'%'+_0x1ecf9f['query'][_0x8074('0x37')]+'%'};return _0x37b5f6;})});}_0xe7b612=_[_0x8074('0x3b')]({},_0xe7b612,_0x1ecf9f[_0x8074('0x3c')]);return _0x26cbc4[_0x8074('0x4f')](_0xe7b612);}})[_0x8074('0x25')](function(_0x3727d7){if(_0x3727d7){_0x49b5d1=_0x3727d7['length'];if(!_0x1ecf9f['query'][_0x8074('0x4c')]('nolimit')){_0xe7b612[_0x8074('0x1e')]=qs[_0x8074('0x1e')](_0x1ecf9f[_0x8074('0x2f')]['limit']);_0xe7b612[_0x8074('0x1c')]=qs[_0x8074('0x1c')](_0x1ecf9f[_0x8074('0x2f')]['offset']);}return _0x26cbc4[_0x8074('0x4f')](_0xe7b612);}})[_0x8074('0x25')](function(_0x4929eb){if(_0x4929eb){return _0x4929eb?{'count':_0x49b5d1,'rows':_0x4929eb}:null;}})['then'](respondWithResult(_0x1e77c3,null))[_0x8074('0x41')](handleError(_0x1e77c3,null));}; \ No newline at end of file +var _0xa351=['merge','find','catch','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','SalesforceConfiguration','include','rows','show','params','fields'];(function(_0x5bcd23,_0x1242f1){var _0x17ec3c=function(_0x4e117f){while(--_0x4e117f){_0x5bcd23['push'](_0x5bcd23['shift']());}};_0x17ec3c(++_0x1242f1);}(_0xa351,0xac));var _0x1a35=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa351[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a35('0x0'));var jsonpatch=require(_0x1a35('0x1'));var rp=require(_0x1a35('0x2'));var moment=require(_0x1a35('0x3'));var BPromise=require(_0x1a35('0x4'));var Mustache=require(_0x1a35('0x5'));var util=require(_0x1a35('0x6'));var path=require(_0x1a35('0x7'));var sox=require(_0x1a35('0x8'));var csv=require('to-csv');var ejs=require(_0x1a35('0x9'));var fs=require('fs');var fs_extra=require(_0x1a35('0xa'));var _=require(_0x1a35('0xb'));var squel=require('squel');var crypto=require(_0x1a35('0xc'));var jsforce=require(_0x1a35('0xd'));var deskjs=require(_0x1a35('0xe'));var toCsv=require(_0x1a35('0xf'));var querystring=require(_0x1a35('0x10'));var Papa=require(_0x1a35('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1a35('0x12'));var as=require(_0x1a35('0x13'));var hardwareService=require(_0x1a35('0x14'));var logger=require(_0x1a35('0x15'))(_0x1a35('0x16'));var utils=require('../../config/utils');var config=require(_0x1a35('0x17'));var licenseUtil=require(_0x1a35('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e28ce,_0x15529f){_0x15529f=_0x15529f||0xcc;return function(_0x29d19f){if(_0x29d19f){return _0x5e28ce[_0x1a35('0x19')](_0x15529f);}return _0x5e28ce[_0x1a35('0x1a')](_0x15529f)['end']();};}function respondWithResult(_0x3e3174,_0x3998f8){_0x3998f8=_0x3998f8||0xc8;return function(_0x341f61){if(_0x341f61){return _0x3e3174['status'](_0x3998f8)[_0x1a35('0x1b')](_0x341f61);}};}function respondWithFilteredResult(_0x200a40,_0xffe01b){return function(_0x32365d){if(_0x32365d){var _0x18f0ee=typeof _0xffe01b['offset']==='undefined'&&typeof _0xffe01b['limit']===_0x1a35('0x1c');var _0x5b934f=_0x32365d[_0x1a35('0x1d')];var _0x2abc5f=_0x18f0ee?0x0:_0xffe01b[_0x1a35('0x1e')];var _0x7456de=_0x18f0ee?_0x32365d['count']:_0xffe01b[_0x1a35('0x1e')]+_0xffe01b[_0x1a35('0x1f')];var _0x21f72e;if(_0x7456de>=_0x5b934f){_0x7456de=_0x5b934f;_0x21f72e=0xc8;}else{_0x21f72e=0xce;}_0x200a40[_0x1a35('0x1a')](_0x21f72e);return _0x200a40[_0x1a35('0x20')]('Content-Range',_0x2abc5f+'-'+_0x7456de+'/'+_0x5b934f)[_0x1a35('0x1b')](_0x32365d);}return null;};}function patchUpdates(_0x21895a){return function(_0x6e3b46){try{jsonpatch[_0x1a35('0x21')](_0x6e3b46,_0x21895a,!![]);}catch(_0x336662){return BPromise[_0x1a35('0x22')](_0x336662);}return _0x6e3b46[_0x1a35('0x23')]();};}function saveUpdates(_0x2cb6ba,_0x3db8a2){return function(_0x39ad0a){if(_0x39ad0a){return _0x39ad0a['update'](_0x2cb6ba)['then'](function(_0x4258df){return _0x4258df;});}return null;};}function removeEntity(_0xbaca9a,_0x20fb3f){return function(_0x4d7c03){if(_0x4d7c03){return _0x4d7c03[_0x1a35('0x24')]()[_0x1a35('0x25')](function(){_0xbaca9a[_0x1a35('0x1a')](0xcc)[_0x1a35('0x26')]();});}};}function handleEntityNotFound(_0x3751ee,_0x33cbcd){return function(_0x69de37){if(!_0x69de37){_0x3751ee[_0x1a35('0x19')](0x194);}return _0x69de37;};}function handleError(_0x5c2954,_0x541c2e){_0x541c2e=_0x541c2e||0x1f4;return function(_0x2e8225){logger[_0x1a35('0x27')](_0x2e8225[_0x1a35('0x28')]);if(_0x2e8225[_0x1a35('0x29')]){delete _0x2e8225[_0x1a35('0x29')];}_0x5c2954['status'](_0x541c2e)[_0x1a35('0x2a')](_0x2e8225);};}exports[_0x1a35('0x2b')]=function(_0xb0056f,_0x55002b){var _0x3dcaff={},_0x16d07b={},_0x29c699={'count':0x0,'rows':[]};var _0x38d9b1=_[_0x1a35('0x2c')](db['SalesforceConfiguration'][_0x1a35('0x2d')],function(_0x3963ac){return{'name':_0x3963ac[_0x1a35('0x2e')],'type':_0x3963ac[_0x1a35('0x2f')][_0x1a35('0x30')]};});_0x16d07b[_0x1a35('0x31')]=_[_0x1a35('0x2c')](_0x38d9b1,_0x1a35('0x29'));_0x16d07b[_0x1a35('0x32')]=_[_0x1a35('0x33')](_0xb0056f[_0x1a35('0x32')]);_0x16d07b[_0x1a35('0x34')]=_[_0x1a35('0x35')](_0x16d07b[_0x1a35('0x31')],_0x16d07b['query']);_0x3dcaff[_0x1a35('0x36')]=_['intersection'](_0x16d07b[_0x1a35('0x31')],qs['fields'](_0xb0056f[_0x1a35('0x32')]['fields']));_0x3dcaff['attributes']=_0x3dcaff[_0x1a35('0x36')][_0x1a35('0x37')]?_0x3dcaff['attributes']:_0x16d07b['model'];if(!_0xb0056f[_0x1a35('0x32')][_0x1a35('0x38')](_0x1a35('0x39'))){_0x3dcaff['limit']=qs[_0x1a35('0x1f')](_0xb0056f[_0x1a35('0x32')]['limit']);_0x3dcaff[_0x1a35('0x1e')]=qs[_0x1a35('0x1e')](_0xb0056f['query']['offset']);}_0x3dcaff[_0x1a35('0x3a')]=qs[_0x1a35('0x3b')](_0xb0056f[_0x1a35('0x32')][_0x1a35('0x3b')]);_0x3dcaff['where']=qs[_0x1a35('0x34')](_[_0x1a35('0x3c')](_0xb0056f[_0x1a35('0x32')],_0x16d07b['filters']),_0x38d9b1);if(_0xb0056f['query'][_0x1a35('0x3d')]){_0x3dcaff[_0x1a35('0x3e')]=_['merge'](_0x3dcaff['where'],{'$or':_[_0x1a35('0x2c')](_0x38d9b1,function(_0x2afd52){if(_0x2afd52[_0x1a35('0x2f')]!==_0x1a35('0x3f')){var _0x14d0eb={};_0x14d0eb[_0x2afd52['name']]={'$like':'%'+_0xb0056f['query'][_0x1a35('0x3d')]+'%'};return _0x14d0eb;}})});}_0x3dcaff=_['merge']({},_0x3dcaff,_0xb0056f[_0x1a35('0x40')]);var _0x3ac43b={'where':_0x3dcaff['where']};return db[_0x1a35('0x41')][_0x1a35('0x1d')](_0x3ac43b)[_0x1a35('0x25')](function(_0x1bfbbf){_0x29c699[_0x1a35('0x1d')]=_0x1bfbbf;if(_0xb0056f[_0x1a35('0x32')]['includeAll']){_0x3dcaff[_0x1a35('0x42')]=[{'all':!![]}];}return db[_0x1a35('0x41')]['findAll'](_0x3dcaff);})[_0x1a35('0x25')](function(_0x5e0e11){_0x29c699[_0x1a35('0x43')]=_0x5e0e11;return _0x29c699;})[_0x1a35('0x25')](respondWithFilteredResult(_0x55002b,_0x3dcaff))['catch'](handleError(_0x55002b,null));};exports[_0x1a35('0x44')]=function(_0x122488,_0xf6766f){var _0x4bc861={'raw':![],'where':{'id':_0x122488[_0x1a35('0x45')]['id']}},_0x3b5242={};_0x3b5242[_0x1a35('0x31')]=_[_0x1a35('0x33')](db[_0x1a35('0x41')][_0x1a35('0x2d')]);_0x3b5242[_0x1a35('0x32')]=_['keys'](_0x122488['query']);_0x3b5242[_0x1a35('0x34')]=_[_0x1a35('0x35')](_0x3b5242[_0x1a35('0x31')],_0x3b5242['query']);_0x4bc861['attributes']=_[_0x1a35('0x35')](_0x3b5242[_0x1a35('0x31')],qs[_0x1a35('0x46')](_0x122488[_0x1a35('0x32')][_0x1a35('0x46')]));_0x4bc861['attributes']=_0x4bc861['attributes'][_0x1a35('0x37')]?_0x4bc861[_0x1a35('0x36')]:_0x3b5242[_0x1a35('0x31')];if(_0x122488[_0x1a35('0x32')]['includeAll']){_0x4bc861[_0x1a35('0x42')]=[{'all':!![]}];}_0x4bc861=_[_0x1a35('0x47')]({},_0x4bc861,_0x122488[_0x1a35('0x40')]);return db[_0x1a35('0x41')][_0x1a35('0x48')](_0x4bc861)['then'](handleEntityNotFound(_0xf6766f,null))[_0x1a35('0x25')](respondWithResult(_0xf6766f,null))[_0x1a35('0x49')](handleError(_0xf6766f,null));};exports[_0x1a35('0x4a')]=function(_0x192c39,_0x54550b){return db['SalesforceConfiguration']['create'](_0x192c39[_0x1a35('0x4b')],{})[_0x1a35('0x25')](respondWithResult(_0x54550b,0xc9))['catch'](handleError(_0x54550b,null));};exports['update']=function(_0xf9e6b9,_0xe0d663){if(_0xf9e6b9[_0x1a35('0x4b')]['id']){delete _0xf9e6b9[_0x1a35('0x4b')]['id'];}return db['SalesforceConfiguration'][_0x1a35('0x48')]({'where':{'id':_0xf9e6b9['params']['id']}})['then'](handleEntityNotFound(_0xe0d663,null))[_0x1a35('0x25')](saveUpdates(_0xf9e6b9[_0x1a35('0x4b')],null))[_0x1a35('0x25')](respondWithResult(_0xe0d663,null))[_0x1a35('0x49')](handleError(_0xe0d663,null));};exports[_0x1a35('0x24')]=function(_0x4b2c36,_0x2174db){return db[_0x1a35('0x41')][_0x1a35('0x48')]({'where':{'id':_0x4b2c36['params']['id']}})[_0x1a35('0x25')](handleEntityNotFound(_0x2174db,null))['then'](removeEntity(_0x2174db,null))[_0x1a35('0x49')](handleError(_0x2174db,null));};exports[_0x1a35('0x4c')]=function(_0x1e866b,_0xc2aaf2,_0x322178){var _0x131cbf={};var _0x21ae22={};var _0x302ad3;var _0x836a7f;return db[_0x1a35('0x41')][_0x1a35('0x4d')]({'where':{'id':_0x1e866b['params']['id']}})[_0x1a35('0x25')](handleEntityNotFound(_0xc2aaf2,null))['then'](function(_0x3de770){if(_0x3de770){_0x302ad3=_0x3de770;_0x21ae22[_0x1a35('0x31')]=_[_0x1a35('0x33')](db[_0x1a35('0x4e')][_0x1a35('0x2d')]);_0x21ae22['query']=_[_0x1a35('0x33')](_0x1e866b['query']);_0x21ae22[_0x1a35('0x34')]=_['intersection'](_0x21ae22[_0x1a35('0x31')],_0x21ae22['query']);_0x131cbf[_0x1a35('0x36')]=_[_0x1a35('0x35')](_0x21ae22['model'],qs[_0x1a35('0x46')](_0x1e866b[_0x1a35('0x32')][_0x1a35('0x46')]));_0x131cbf[_0x1a35('0x36')]=_0x131cbf[_0x1a35('0x36')][_0x1a35('0x37')]?_0x131cbf[_0x1a35('0x36')]:_0x21ae22['model'];_0x131cbf[_0x1a35('0x3a')]=qs['sort'](_0x1e866b[_0x1a35('0x32')]['sort']);_0x131cbf[_0x1a35('0x3e')]=qs[_0x1a35('0x34')](_[_0x1a35('0x3c')](_0x1e866b['query'],_0x21ae22[_0x1a35('0x34')]));if(_0x1e866b[_0x1a35('0x32')][_0x1a35('0x3d')]){_0x131cbf['where']=_[_0x1a35('0x47')](_0x131cbf['where'],{'$or':_[_0x1a35('0x2c')](_0x131cbf[_0x1a35('0x36')],function(_0xcf860){var _0x55d665={};_0x55d665[_0xcf860]={'$like':'%'+_0x1e866b[_0x1a35('0x32')][_0x1a35('0x3d')]+'%'};return _0x55d665;})});}_0x131cbf=_['merge']({},_0x131cbf,_0x1e866b['options']);return _0x302ad3[_0x1a35('0x4c')](_0x131cbf);}})[_0x1a35('0x25')](function(_0x131093){if(_0x131093){_0x836a7f=_0x131093['length'];if(!_0x1e866b[_0x1a35('0x32')][_0x1a35('0x38')](_0x1a35('0x39'))){_0x131cbf[_0x1a35('0x1f')]=qs[_0x1a35('0x1f')](_0x1e866b[_0x1a35('0x32')][_0x1a35('0x1f')]);_0x131cbf[_0x1a35('0x1e')]=qs['offset'](_0x1e866b[_0x1a35('0x32')][_0x1a35('0x1e')]);}return _0x302ad3[_0x1a35('0x4c')](_0x131cbf);}})[_0x1a35('0x25')](function(_0x5a25bd){if(_0x5a25bd){return _0x5a25bd?{'count':_0x836a7f,'rows':_0x5a25bd}:null;}})[_0x1a35('0x25')](respondWithResult(_0xc2aaf2,null))[_0x1a35('0x49')](handleError(_0xc2aaf2,null));};exports[_0x1a35('0x4f')]=function(_0x1addf1,_0x178da0,_0x43f790){var _0x114738={};var _0x147d93={};var _0x17c022;var _0x1e486e;return db[_0x1a35('0x41')][_0x1a35('0x4d')]({'where':{'id':_0x1addf1['params']['id']}})[_0x1a35('0x25')](handleEntityNotFound(_0x178da0,null))[_0x1a35('0x25')](function(_0x18f1b3){if(_0x18f1b3){_0x17c022=_0x18f1b3;_0x147d93[_0x1a35('0x31')]=_['keys'](db[_0x1a35('0x4e')]['rawAttributes']);_0x147d93['query']=_[_0x1a35('0x33')](_0x1addf1[_0x1a35('0x32')]);_0x147d93[_0x1a35('0x34')]=_['intersection'](_0x147d93[_0x1a35('0x31')],_0x147d93[_0x1a35('0x32')]);_0x114738[_0x1a35('0x36')]=_[_0x1a35('0x35')](_0x147d93[_0x1a35('0x31')],qs[_0x1a35('0x46')](_0x1addf1['query'][_0x1a35('0x46')]));_0x114738['attributes']=_0x114738['attributes'][_0x1a35('0x37')]?_0x114738['attributes']:_0x147d93[_0x1a35('0x31')];_0x114738[_0x1a35('0x3a')]=qs['sort'](_0x1addf1[_0x1a35('0x32')][_0x1a35('0x3b')]);_0x114738['where']=qs[_0x1a35('0x34')](_[_0x1a35('0x3c')](_0x1addf1['query'],_0x147d93[_0x1a35('0x34')]));if(_0x1addf1['query']['filter']){_0x114738[_0x1a35('0x3e')]=_['merge'](_0x114738[_0x1a35('0x3e')],{'$or':_['map'](_0x114738[_0x1a35('0x36')],function(_0x4a1fe3){var _0x46cd28={};_0x46cd28[_0x4a1fe3]={'$like':'%'+_0x1addf1[_0x1a35('0x32')][_0x1a35('0x3d')]+'%'};return _0x46cd28;})});}_0x114738=_[_0x1a35('0x47')]({},_0x114738,_0x1addf1[_0x1a35('0x40')]);return _0x17c022[_0x1a35('0x4f')](_0x114738);}})[_0x1a35('0x25')](function(_0x3bc84d){if(_0x3bc84d){_0x1e486e=_0x3bc84d[_0x1a35('0x37')];if(!_0x1addf1[_0x1a35('0x32')][_0x1a35('0x38')](_0x1a35('0x39'))){_0x114738['limit']=qs[_0x1a35('0x1f')](_0x1addf1[_0x1a35('0x32')]['limit']);_0x114738[_0x1a35('0x1e')]=qs['offset'](_0x1addf1[_0x1a35('0x32')]['offset']);}return _0x17c022[_0x1a35('0x4f')](_0x114738);}})[_0x1a35('0x25')](function(_0x54f52d){if(_0x54f52d){return _0x54f52d?{'count':_0x1e486e,'rows':_0x54f52d}:null;}})[_0x1a35('0x25')](respondWithResult(_0x178da0,null))[_0x1a35('0x49')](handleError(_0x178da0,null));};exports[_0x1a35('0x50')]=function(_0x516b3e,_0x74881e,_0x488f19){var _0xd1a2e7={};var _0x1895cb={};var _0x41ae17;var _0x3492d4;return db[_0x1a35('0x41')]['findOne']({'where':{'id':_0x516b3e[_0x1a35('0x45')]['id']}})[_0x1a35('0x25')](handleEntityNotFound(_0x74881e,null))[_0x1a35('0x25')](function(_0x13a91){if(_0x13a91){_0x41ae17=_0x13a91;_0x1895cb['model']=_[_0x1a35('0x33')](db['SalesforceField'][_0x1a35('0x2d')]);_0x1895cb[_0x1a35('0x32')]=_[_0x1a35('0x33')](_0x516b3e[_0x1a35('0x32')]);_0x1895cb[_0x1a35('0x34')]=_[_0x1a35('0x35')](_0x1895cb[_0x1a35('0x31')],_0x1895cb['query']);_0xd1a2e7[_0x1a35('0x36')]=_[_0x1a35('0x35')](_0x1895cb[_0x1a35('0x31')],qs[_0x1a35('0x46')](_0x516b3e['query'][_0x1a35('0x46')]));_0xd1a2e7['attributes']=_0xd1a2e7[_0x1a35('0x36')][_0x1a35('0x37')]?_0xd1a2e7['attributes']:_0x1895cb[_0x1a35('0x31')];_0xd1a2e7['order']=qs['sort'](_0x516b3e[_0x1a35('0x32')][_0x1a35('0x3b')]);_0xd1a2e7[_0x1a35('0x3e')]=qs['filters'](_['pick'](_0x516b3e[_0x1a35('0x32')],_0x1895cb[_0x1a35('0x34')]));if(_0x516b3e[_0x1a35('0x32')]['filter']){_0xd1a2e7[_0x1a35('0x3e')]=_[_0x1a35('0x47')](_0xd1a2e7[_0x1a35('0x3e')],{'$or':_[_0x1a35('0x2c')](_0xd1a2e7[_0x1a35('0x36')],function(_0x8a63b0){var _0x2ad8f2={};_0x2ad8f2[_0x8a63b0]={'$like':'%'+_0x516b3e[_0x1a35('0x32')][_0x1a35('0x3d')]+'%'};return _0x2ad8f2;})});}_0xd1a2e7=_[_0x1a35('0x47')]({},_0xd1a2e7,_0x516b3e['options']);return _0x41ae17[_0x1a35('0x50')](_0xd1a2e7);}})[_0x1a35('0x25')](function(_0x13f345){if(_0x13f345){_0x3492d4=_0x13f345[_0x1a35('0x37')];if(!_0x516b3e[_0x1a35('0x32')][_0x1a35('0x38')](_0x1a35('0x39'))){_0xd1a2e7[_0x1a35('0x1f')]=qs[_0x1a35('0x1f')](_0x516b3e[_0x1a35('0x32')][_0x1a35('0x1f')]);_0xd1a2e7[_0x1a35('0x1e')]=qs[_0x1a35('0x1e')](_0x516b3e[_0x1a35('0x32')][_0x1a35('0x1e')]);}return _0x41ae17[_0x1a35('0x50')](_0xd1a2e7);}})[_0x1a35('0x25')](function(_0x3a0564){if(_0x3a0564){return _0x3a0564?{'count':_0x3492d4,'rows':_0x3a0564}:null;}})[_0x1a35('0x25')](respondWithResult(_0x74881e,null))['catch'](handleError(_0x74881e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 96f932e..5cf69d1 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 _0x18f2=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x16a764,_0x439f24){var _0xa6b352=function(_0x213820){while(--_0x213820){_0x16a764['push'](_0x16a764['shift']());}};_0xa6b352(++_0x439f24);}(_0x18f2,0x15e));var _0x218f=function(_0x584411,_0x16b0eb){_0x584411=_0x584411-0x0;var _0x22d726=_0x18f2[_0x584411];return _0x22d726;};'use strict';var _=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var logger=require(_0x218f('0x2'))(_0x218f('0x3'));var moment=require('moment');var BPromise=require(_0x218f('0x4'));var rp=require(_0x218f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x218f('0x6'));var config=require('../../config/environment');var attributes=require(_0x218f('0x7'));module[_0x218f('0x8')]=function(_0x40a434,_0x1ddb58){return _0x40a434[_0x218f('0x9')](_0x218f('0xa'),attributes,{'tableName':_0x218f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x400d=['../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','moment','bluebird','rimraf'];(function(_0x5d0818,_0x188411){var _0x37fcdb=function(_0x10c95a){while(--_0x10c95a){_0x5d0818['push'](_0x5d0818['shift']());}};_0x37fcdb(++_0x188411);}(_0x400d,0xeb));var _0xd400=function(_0x501695,_0xda9d02){_0x501695=_0x501695-0x0;var _0xca4b6c=_0x400d[_0x501695];return _0xca4b6c;};'use strict';var _=require(_0xd400('0x0'));var util=require(_0xd400('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd400('0x2'));var BPromise=require(_0xd400('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd400('0x4'));var config=require(_0xd400('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd400('0x6')]=function(_0x27fbd3,_0x1ded7c){return _0x27fbd3[_0xd400('0x7')](_0xd400('0x8'),attributes,{'tableName':_0xd400('0x9'),'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 9099283..52e6a82 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 _0xcc00=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x280587,_0x4e9971){var _0x3b7543=function(_0x1e94de){while(--_0x1e94de){_0x280587['push'](_0x280587['shift']());}};_0x3b7543(++_0x4e9971);}(_0xcc00,0x120));var _0x0cc0=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xcc00[_0x4c4037];return _0x357862;};'use strict';var _=require(_0x0cc0('0x0'));var util=require(_0x0cc0('0x1'));var moment=require(_0x0cc0('0x2'));var BPromise=require(_0x0cc0('0x3'));var rs=require(_0x0cc0('0x4'));var fs=require('fs');var Redis=require(_0x0cc0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0cc0('0x6'));var config=require(_0x0cc0('0x7'));var jayson=require(_0x0cc0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d1032,_0x2f4506,_0x184bcb){return new BPromise(function(_0x45ebf3,_0x4b7ed3){return client['request'](_0x3d1032,_0x184bcb)[_0x0cc0('0x9')](function(_0x598224){logger[_0x0cc0('0xa')](_0x0cc0('0xb'),_0x2f4506,_0x0cc0('0xc'));logger[_0x0cc0('0xd')](_0x0cc0('0xe'),_0x2f4506,_0x0cc0('0xc'),JSON[_0x0cc0('0xf')](_0x598224));if(_0x598224['error']){if(_0x598224[_0x0cc0('0x10')]['code']===0x1f4){logger['error'](_0x0cc0('0xb'),_0x2f4506,_0x598224[_0x0cc0('0x10')][_0x0cc0('0x11')]);return _0x4b7ed3(_0x598224[_0x0cc0('0x10')][_0x0cc0('0x11')]);}logger[_0x0cc0('0x10')](_0x0cc0('0xb'),_0x2f4506,_0x598224[_0x0cc0('0x10')][_0x0cc0('0x11')]);return _0x45ebf3(_0x598224[_0x0cc0('0x10')][_0x0cc0('0x11')]);}else{logger['info'](_0x0cc0('0xb'),_0x2f4506,_0x0cc0('0xc'));_0x45ebf3(_0x598224[_0x0cc0('0x12')][_0x0cc0('0x11')]);}})['catch'](function(_0x34688d){logger[_0x0cc0('0x10')](_0x0cc0('0xb'),_0x2f4506,_0x34688d);_0x4b7ed3(_0x34688d);});});} \ No newline at end of file +var _0x957e=['util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash'];(function(_0x1ca22e,_0x367312){var _0x60b390=function(_0x3a90d3){while(--_0x3a90d3){_0x1ca22e['push'](_0x1ca22e['shift']());}};_0x60b390(++_0x367312);}(_0x957e,0xfb));var _0xe957=function(_0xec9322,_0x2d5b87){_0xec9322=_0xec9322-0x0;var _0x39d576=_0x957e[_0xec9322];return _0x39d576;};'use strict';var _=require(_0xe957('0x0'));var util=require(_0xe957('0x1'));var moment=require(_0xe957('0x2'));var BPromise=require('bluebird');var rs=require(_0xe957('0x3'));var fs=require('fs');var Redis=require(_0xe957('0x4'));var db=require(_0xe957('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe957('0x6'));var config=require('../../config/environment');var jayson=require(_0xe957('0x7'));var client=jayson[_0xe957('0x8')][_0xe957('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23f27f,_0x24ddde,_0x47a37c){return new BPromise(function(_0x5f3825,_0x59cc2a){return client[_0xe957('0xa')](_0x23f27f,_0x47a37c)[_0xe957('0xb')](function(_0x486733){logger[_0xe957('0xc')](_0xe957('0xd'),_0x24ddde,'request\x20sent');logger[_0xe957('0xe')](_0xe957('0xf'),_0x24ddde,_0xe957('0x10'),JSON[_0xe957('0x11')](_0x486733));if(_0x486733[_0xe957('0x12')]){if(_0x486733[_0xe957('0x12')]['code']===0x1f4){logger[_0xe957('0x12')](_0xe957('0xd'),_0x24ddde,_0x486733[_0xe957('0x12')][_0xe957('0x13')]);return _0x59cc2a(_0x486733[_0xe957('0x12')][_0xe957('0x13')]);}logger[_0xe957('0x12')](_0xe957('0xd'),_0x24ddde,_0x486733['error'][_0xe957('0x13')]);return _0x5f3825(_0x486733[_0xe957('0x12')][_0xe957('0x13')]);}else{logger[_0xe957('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x24ddde,_0xe957('0x10'));_0x5f3825(_0x486733['result'][_0xe957('0x13')]);}})[_0xe957('0x14')](function(_0x143088){logger[_0xe957('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x24ddde,_0x143088);_0x59cc2a(_0x143088);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7e90e3c..298fe22 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 _0x58ae=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x33b793,_0x127cfa){var _0x5b01bc=function(_0x560696){while(--_0x560696){_0x33b793['push'](_0x33b793['shift']());}};_0x5b01bc(++_0x127cfa);}(_0x58ae,0xea));var _0xe58a=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0x58ae[_0x47e3f8];return _0x4742d5;};'use strict';var multer=require(_0xe58a('0x0'));var util=require(_0xe58a('0x1'));var path=require('path');var timeout=require(_0xe58a('0x2'));var express=require(_0xe58a('0x3'));var router=express[_0xe58a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe58a('0x5'));var interaction=require(_0xe58a('0x6'));var config=require(_0xe58a('0x7'));var controller=require(_0xe58a('0x8'));router[_0xe58a('0x9')]('/',auth[_0xe58a('0xa')](),controller[_0xe58a('0xb')]);router[_0xe58a('0x9')](_0xe58a('0xc'),auth[_0xe58a('0xa')](),controller[_0xe58a('0xd')]);router[_0xe58a('0xe')]('/',auth[_0xe58a('0xa')](),controller[_0xe58a('0xf')]);router[_0xe58a('0x10')]('/:id',auth[_0xe58a('0xa')](),controller[_0xe58a('0x11')]);router[_0xe58a('0x12')](_0xe58a('0xc'),auth[_0xe58a('0xa')](),controller['destroy']);module[_0xe58a('0x13')]=router; \ No newline at end of file +var _0x0090=['../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3de3d3,_0x2eb3e3){var _0x1c71d9=function(_0x55c57b){while(--_0x55c57b){_0x3de3d3['push'](_0x3de3d3['shift']());}};_0x1c71d9(++_0x2eb3e3);}(_0x0090,0x14a));var _0x0009=function(_0x3d07d9,_0x5ef362){_0x3d07d9=_0x3d07d9-0x0;var _0x48c184=_0x0090[_0x3d07d9];return _0x48c184;};'use strict';var multer=require('multer');var util=require(_0x0009('0x0'));var path=require(_0x0009('0x1'));var timeout=require(_0x0009('0x2'));var express=require(_0x0009('0x3'));var router=express[_0x0009('0x4')]();var fs_extra=require(_0x0009('0x5'));var auth=require(_0x0009('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0009('0x7'));var controller=require(_0x0009('0x8'));router[_0x0009('0x9')]('/',auth['isAuthenticated'](),controller[_0x0009('0xa')]);router[_0x0009('0x9')]('/:id',auth[_0x0009('0xb')](),controller[_0x0009('0xc')]);router[_0x0009('0xd')]('/',auth[_0x0009('0xb')](),controller[_0x0009('0xe')]);router[_0x0009('0xf')](_0x0009('0x10'),auth['isAuthenticated'](),controller[_0x0009('0x11')]);router[_0x0009('0x12')](_0x0009('0x10'),auth['isAuthenticated'](),controller[_0x0009('0x13')]);module[_0x0009('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e94e3a8..8e34411 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 _0x5743=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x5efdac,_0x5dd904){var _0x454f05=function(_0xf934c0){while(--_0xf934c0){_0x5efdac['push'](_0x5efdac['shift']());}};_0x454f05(++_0x5dd904);}(_0x5743,0x6f));var _0x3574=function(_0x134cae,_0x4cd2e0){_0x134cae=_0x134cae-0x0;var _0x5c26de=_0x5743[_0x134cae];return _0x5c26de;};'use strict';var Sequelize=require(_0x3574('0x0'));module['exports']={'type':{'type':Sequelize[_0x3574('0x1')](_0x3574('0x2'),_0x3574('0x3'),_0x3574('0x4'),_0x3574('0x5'),'picklist'),'defaultValue':_0x3574('0x2')},'content':{'type':Sequelize[_0x3574('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3574('0x1')](_0x3574('0x2'),_0x3574('0x3'),_0x3574('0x4'))},'keyContent':{'type':Sequelize[_0x3574('0x6')]},'idField':{'type':Sequelize[_0x3574('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c51=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x58c75c,_0x393003){var _0x1adcb0=function(_0x5baf55){while(--_0x5baf55){_0x58c75c['push'](_0x58c75c['shift']());}};_0x1adcb0(++_0x393003);}(_0x0c51,0x19a));var _0x10c5=function(_0x5e1b52,_0x8ba2a9){_0x5e1b52=_0x5e1b52-0x0;var _0xa2586e=_0x0c51[_0x5e1b52];return _0xa2586e;};'use strict';var Sequelize=require(_0x10c5('0x0'));module[_0x10c5('0x1')]={'type':{'type':Sequelize[_0x10c5('0x2')](_0x10c5('0x3'),_0x10c5('0x4'),_0x10c5('0x5'),_0x10c5('0x6'),_0x10c5('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x10c5('0x8')]},'key':{'type':Sequelize[_0x10c5('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x10c5('0x3'),_0x10c5('0x4'),_0x10c5('0x5'))},'keyContent':{'type':Sequelize[_0x10c5('0x8')]},'idField':{'type':Sequelize[_0x10c5('0x8')]},'variableName':{'type':Sequelize[_0x10c5('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 78cf324..619abf8 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 _0x9361=['eml-format','rimraf','zip-dir','moment','mustache','util','path','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','SalesforceField','includeAll','findAll','rows','catch','include','merge','find','create','body'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x9361,0x8c));var _0x1936=function(_0x2b886e,_0x35885c){_0x2b886e=_0x2b886e-0x0;var _0x1f5e68=_0x9361[_0x2b886e];return _0x1f5e68;};'use strict';var emlformat=require(_0x1936('0x0'));var rimraf=require(_0x1936('0x1'));var zipdir=require(_0x1936('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1936('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1936('0x4'));var util=require(_0x1936('0x5'));var path=require(_0x1936('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1936('0x7'));var _=require('lodash');var squel=require(_0x1936('0x8'));var crypto=require(_0x1936('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1936('0xa'));var Papa=require(_0x1936('0xb'));var Redis=require(_0x1936('0xc'));var authService=require(_0x1936('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1936('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1936('0xf'))(_0x1936('0x10'));var utils=require(_0x1936('0x11'));var config=require(_0x1936('0x12'));var licenseUtil=require(_0x1936('0x13'));var db=require(_0x1936('0x14'))['db'];function respondWithStatusCode(_0x35cb9b,_0x5d2a07){_0x5d2a07=_0x5d2a07||0xcc;return function(_0x13c62e){if(_0x13c62e){return _0x35cb9b[_0x1936('0x15')](_0x5d2a07);}return _0x35cb9b[_0x1936('0x16')](_0x5d2a07)['end']();};}function respondWithResult(_0x450d0b,_0x207082){_0x207082=_0x207082||0xc8;return function(_0x35a4c1){if(_0x35a4c1){return _0x450d0b[_0x1936('0x16')](_0x207082)[_0x1936('0x17')](_0x35a4c1);}};}function respondWithFilteredResult(_0x2d68bb,_0x2c1820){return function(_0x5d27de){if(_0x5d27de){var _0x2e9d31=typeof _0x2c1820[_0x1936('0x18')]==='undefined'&&typeof _0x2c1820[_0x1936('0x19')]===_0x1936('0x1a');var _0x14d5e0=_0x5d27de[_0x1936('0x1b')];var _0x3ce884=_0x2e9d31?0x0:_0x2c1820[_0x1936('0x18')];var _0x163f68=_0x2e9d31?_0x5d27de[_0x1936('0x1b')]:_0x2c1820[_0x1936('0x18')]+_0x2c1820[_0x1936('0x19')];var _0x5110ab;if(_0x163f68>=_0x14d5e0){_0x163f68=_0x14d5e0;_0x5110ab=0xc8;}else{_0x5110ab=0xce;}_0x2d68bb[_0x1936('0x16')](_0x5110ab);return _0x2d68bb[_0x1936('0x1c')](_0x1936('0x1d'),_0x3ce884+'-'+_0x163f68+'/'+_0x14d5e0)[_0x1936('0x17')](_0x5d27de);}return null;};}function patchUpdates(_0x26a536){return function(_0x307984){try{jsonpatch[_0x1936('0x1e')](_0x307984,_0x26a536,!![]);}catch(_0x3bf064){return BPromise[_0x1936('0x1f')](_0x3bf064);}return _0x307984[_0x1936('0x20')]();};}function saveUpdates(_0x115ed0,_0x117a6c){return function(_0x40380b){if(_0x40380b){return _0x40380b[_0x1936('0x21')](_0x115ed0)[_0x1936('0x22')](function(_0x5dfa53){return _0x5dfa53;});}return null;};}function removeEntity(_0x19e074,_0x50c27a){return function(_0xc327d0){if(_0xc327d0){return _0xc327d0[_0x1936('0x23')]()[_0x1936('0x22')](function(){_0x19e074[_0x1936('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fccb,_0x3e820a){return function(_0x2455bd){if(!_0x2455bd){_0x56fccb[_0x1936('0x15')](0x194);}return _0x2455bd;};}function handleError(_0x2f04de,_0x2f6f29){_0x2f6f29=_0x2f6f29||0x1f4;return function(_0xc999ce){logger[_0x1936('0x24')](_0xc999ce[_0x1936('0x25')]);if(_0xc999ce['name']){delete _0xc999ce[_0x1936('0x26')];}_0x2f04de[_0x1936('0x16')](_0x2f6f29)[_0x1936('0x27')](_0xc999ce);};}exports['index']=function(_0xc5987f,_0x1f6ac2){var _0x5d5b26={},_0x1c7264={},_0x5d3b29={'count':0x0,'rows':[]};var _0x197b2d=_[_0x1936('0x28')](db['SalesforceField'][_0x1936('0x29')],function(_0x39a455){return{'name':_0x39a455[_0x1936('0x2a')],'type':_0x39a455[_0x1936('0x2b')][_0x1936('0x2c')]};});_0x1c7264[_0x1936('0x2d')]=_[_0x1936('0x28')](_0x197b2d,_0x1936('0x26'));_0x1c7264[_0x1936('0x2e')]=_[_0x1936('0x2f')](_0xc5987f[_0x1936('0x2e')]);_0x1c7264[_0x1936('0x30')]=_[_0x1936('0x31')](_0x1c7264[_0x1936('0x2d')],_0x1c7264[_0x1936('0x2e')]);_0x5d5b26[_0x1936('0x32')]=_['intersection'](_0x1c7264[_0x1936('0x2d')],qs[_0x1936('0x33')](_0xc5987f[_0x1936('0x2e')][_0x1936('0x33')]));_0x5d5b26[_0x1936('0x32')]=_0x5d5b26[_0x1936('0x32')][_0x1936('0x34')]?_0x5d5b26[_0x1936('0x32')]:_0x1c7264[_0x1936('0x2d')];if(!_0xc5987f[_0x1936('0x2e')]['hasOwnProperty'](_0x1936('0x35'))){_0x5d5b26[_0x1936('0x19')]=qs['limit'](_0xc5987f['query'][_0x1936('0x19')]);_0x5d5b26['offset']=qs[_0x1936('0x18')](_0xc5987f['query'][_0x1936('0x18')]);}_0x5d5b26[_0x1936('0x36')]=qs[_0x1936('0x37')](_0xc5987f['query'][_0x1936('0x37')]);_0x5d5b26[_0x1936('0x38')]=qs[_0x1936('0x30')](_['pick'](_0xc5987f['query'],_0x1c7264[_0x1936('0x30')]),_0x197b2d);if(_0xc5987f['query'][_0x1936('0x39')]){_0x5d5b26[_0x1936('0x38')]=_['merge'](_0x5d5b26['where'],{'$or':_[_0x1936('0x28')](_0x197b2d,function(_0x3f58a7){if(_0x3f58a7[_0x1936('0x2b')]!==_0x1936('0x3a')){var _0x28871b={};_0x28871b[_0x3f58a7[_0x1936('0x26')]]={'$like':'%'+_0xc5987f[_0x1936('0x2e')][_0x1936('0x39')]+'%'};return _0x28871b;}})});}_0x5d5b26=_['merge']({},_0x5d5b26,_0xc5987f[_0x1936('0x3b')]);var _0x84cbc0={'where':_0x5d5b26[_0x1936('0x38')]};return db[_0x1936('0x3c')][_0x1936('0x1b')](_0x84cbc0)['then'](function(_0x1354d6){_0x5d3b29[_0x1936('0x1b')]=_0x1354d6;if(_0xc5987f[_0x1936('0x2e')][_0x1936('0x3d')]){_0x5d5b26['include']=[{'all':!![]}];}return db[_0x1936('0x3c')][_0x1936('0x3e')](_0x5d5b26);})[_0x1936('0x22')](function(_0x292d88){_0x5d3b29[_0x1936('0x3f')]=_0x292d88;return _0x5d3b29;})[_0x1936('0x22')](respondWithFilteredResult(_0x1f6ac2,_0x5d5b26))[_0x1936('0x40')](handleError(_0x1f6ac2,null));};exports['show']=function(_0x559adb,_0x8b94a){var _0x5b3ed2={'raw':!![],'where':{'id':_0x559adb['params']['id']}},_0x545fdd={};_0x545fdd[_0x1936('0x2d')]=_['keys'](db['SalesforceField'][_0x1936('0x29')]);_0x545fdd[_0x1936('0x2e')]=_[_0x1936('0x2f')](_0x559adb[_0x1936('0x2e')]);_0x545fdd[_0x1936('0x30')]=_[_0x1936('0x31')](_0x545fdd[_0x1936('0x2d')],_0x545fdd[_0x1936('0x2e')]);_0x5b3ed2[_0x1936('0x32')]=_['intersection'](_0x545fdd[_0x1936('0x2d')],qs['fields'](_0x559adb[_0x1936('0x2e')][_0x1936('0x33')]));_0x5b3ed2[_0x1936('0x32')]=_0x5b3ed2[_0x1936('0x32')][_0x1936('0x34')]?_0x5b3ed2['attributes']:_0x545fdd[_0x1936('0x2d')];if(_0x559adb[_0x1936('0x2e')][_0x1936('0x3d')]){_0x5b3ed2[_0x1936('0x41')]=[{'all':!![]}];}_0x5b3ed2=_[_0x1936('0x42')]({},_0x5b3ed2,_0x559adb['options']);return db['SalesforceField'][_0x1936('0x43')](_0x5b3ed2)[_0x1936('0x22')](handleEntityNotFound(_0x8b94a,null))[_0x1936('0x22')](respondWithResult(_0x8b94a,null))[_0x1936('0x40')](handleError(_0x8b94a,null));};exports[_0x1936('0x44')]=function(_0x5ce3c,_0x4da0c2){return db[_0x1936('0x3c')][_0x1936('0x44')](_0x5ce3c['body'],{})[_0x1936('0x22')](respondWithResult(_0x4da0c2,0xc9))['catch'](handleError(_0x4da0c2,null));};exports[_0x1936('0x21')]=function(_0x5afed1,_0x1690bd){if(_0x5afed1['body']['id']){delete _0x5afed1[_0x1936('0x45')]['id'];}return db[_0x1936('0x3c')]['find']({'where':{'id':_0x5afed1['params']['id']}})[_0x1936('0x22')](handleEntityNotFound(_0x1690bd,null))[_0x1936('0x22')](saveUpdates(_0x5afed1[_0x1936('0x45')],null))['then'](respondWithResult(_0x1690bd,null))[_0x1936('0x40')](handleError(_0x1690bd,null));};exports[_0x1936('0x23')]=function(_0x38ed78,_0x59b405){return db[_0x1936('0x3c')][_0x1936('0x43')]({'where':{'id':_0x38ed78['params']['id']}})['then'](handleEntityNotFound(_0x59b405,null))['then'](removeEntity(_0x59b405,null))[_0x1936('0x40')](handleError(_0x59b405,null));}; \ No newline at end of file +var _0xb8ae=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','rows','catch','params','find','body','destroy','rimraf','request-promise'];(function(_0x1777d2,_0x384362){var _0x5f0a94=function(_0x202529){while(--_0x202529){_0x1777d2['push'](_0x1777d2['shift']());}};_0x5f0a94(++_0x384362);}(_0xb8ae,0x8a));var _0xeb8a=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xb8ae[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb8a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb8a('0x1'));var moment=require(_0xeb8a('0x2'));var BPromise=require(_0xeb8a('0x3'));var Mustache=require(_0xeb8a('0x4'));var util=require(_0xeb8a('0x5'));var path=require(_0xeb8a('0x6'));var sox=require(_0xeb8a('0x7'));var csv=require(_0xeb8a('0x8'));var ejs=require(_0xeb8a('0x9'));var fs=require('fs');var fs_extra=require(_0xeb8a('0xa'));var _=require(_0xeb8a('0xb'));var squel=require(_0xeb8a('0xc'));var crypto=require(_0xeb8a('0xd'));var jsforce=require(_0xeb8a('0xe'));var deskjs=require(_0xeb8a('0xf'));var toCsv=require(_0xeb8a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeb8a('0x10'));var qs=require(_0xeb8a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb8a('0x12'));var logger=require('../../config/logger')(_0xeb8a('0x13'));var utils=require('../../config/utils');var config=require(_0xeb8a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb8a('0x15'))['db'];function respondWithStatusCode(_0x245824,_0x53d432){_0x53d432=_0x53d432||0xcc;return function(_0x2f3fc9){if(_0x2f3fc9){return _0x245824['sendStatus'](_0x53d432);}return _0x245824['status'](_0x53d432)['end']();};}function respondWithResult(_0xc3c516,_0x1075bf){_0x1075bf=_0x1075bf||0xc8;return function(_0x4ece45){if(_0x4ece45){return _0xc3c516['status'](_0x1075bf)[_0xeb8a('0x16')](_0x4ece45);}};}function respondWithFilteredResult(_0x466b97,_0x57aa41){return function(_0x3d19a0){if(_0x3d19a0){var _0xa7a086=typeof _0x57aa41[_0xeb8a('0x17')]===_0xeb8a('0x18')&&typeof _0x57aa41[_0xeb8a('0x19')]===_0xeb8a('0x18');var _0x25c213=_0x3d19a0[_0xeb8a('0x1a')];var _0x3af4be=_0xa7a086?0x0:_0x57aa41[_0xeb8a('0x17')];var _0x2eb5f0=_0xa7a086?_0x3d19a0['count']:_0x57aa41[_0xeb8a('0x17')]+_0x57aa41['limit'];var _0x33659c;if(_0x2eb5f0>=_0x25c213){_0x2eb5f0=_0x25c213;_0x33659c=0xc8;}else{_0x33659c=0xce;}_0x466b97[_0xeb8a('0x1b')](_0x33659c);return _0x466b97[_0xeb8a('0x1c')](_0xeb8a('0x1d'),_0x3af4be+'-'+_0x2eb5f0+'/'+_0x25c213)[_0xeb8a('0x16')](_0x3d19a0);}return null;};}function patchUpdates(_0x5c8734){return function(_0x9019ea){try{jsonpatch['apply'](_0x9019ea,_0x5c8734,!![]);}catch(_0x4c8a50){return BPromise[_0xeb8a('0x1e')](_0x4c8a50);}return _0x9019ea[_0xeb8a('0x1f')]();};}function saveUpdates(_0x2c3653,_0x406edb){return function(_0x351c1a){if(_0x351c1a){return _0x351c1a[_0xeb8a('0x20')](_0x2c3653)[_0xeb8a('0x21')](function(_0x3fc1fb){return _0x3fc1fb;});}return null;};}function removeEntity(_0xb7ba1f,_0x5ca26a){return function(_0x514897){if(_0x514897){return _0x514897['destroy']()[_0xeb8a('0x21')](function(){_0xb7ba1f[_0xeb8a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8baeb,_0x2410cd){return function(_0x2fc7e4){if(!_0x2fc7e4){_0xa8baeb[_0xeb8a('0x22')](0x194);}return _0x2fc7e4;};}function handleError(_0x4821d1,_0x20ddf7){_0x20ddf7=_0x20ddf7||0x1f4;return function(_0x1dfa3a){logger[_0xeb8a('0x23')](_0x1dfa3a[_0xeb8a('0x24')]);if(_0x1dfa3a[_0xeb8a('0x25')]){delete _0x1dfa3a[_0xeb8a('0x25')];}_0x4821d1['status'](_0x20ddf7)[_0xeb8a('0x26')](_0x1dfa3a);};}exports[_0xeb8a('0x27')]=function(_0x13e10b,_0x288e5b){var _0x4dba7a={},_0x442d62={},_0x558e01={'count':0x0,'rows':[]};var _0x2041d3=_[_0xeb8a('0x28')](db[_0xeb8a('0x29')][_0xeb8a('0x2a')],function(_0x44beb8){return{'name':_0x44beb8[_0xeb8a('0x2b')],'type':_0x44beb8['type']['key']};});_0x442d62['model']=_[_0xeb8a('0x28')](_0x2041d3,_0xeb8a('0x25'));_0x442d62[_0xeb8a('0x2c')]=_[_0xeb8a('0x2d')](_0x13e10b[_0xeb8a('0x2c')]);_0x442d62[_0xeb8a('0x2e')]=_[_0xeb8a('0x2f')](_0x442d62['model'],_0x442d62[_0xeb8a('0x2c')]);_0x4dba7a[_0xeb8a('0x30')]=_[_0xeb8a('0x2f')](_0x442d62['model'],qs[_0xeb8a('0x31')](_0x13e10b[_0xeb8a('0x2c')][_0xeb8a('0x31')]));_0x4dba7a[_0xeb8a('0x30')]=_0x4dba7a[_0xeb8a('0x30')][_0xeb8a('0x32')]?_0x4dba7a['attributes']:_0x442d62[_0xeb8a('0x33')];if(!_0x13e10b['query'][_0xeb8a('0x34')](_0xeb8a('0x35'))){_0x4dba7a['limit']=qs[_0xeb8a('0x19')](_0x13e10b['query'][_0xeb8a('0x19')]);_0x4dba7a['offset']=qs[_0xeb8a('0x17')](_0x13e10b[_0xeb8a('0x2c')]['offset']);}_0x4dba7a[_0xeb8a('0x36')]=qs[_0xeb8a('0x37')](_0x13e10b[_0xeb8a('0x2c')][_0xeb8a('0x37')]);_0x4dba7a['where']=qs[_0xeb8a('0x2e')](_[_0xeb8a('0x38')](_0x13e10b[_0xeb8a('0x2c')],_0x442d62[_0xeb8a('0x2e')]),_0x2041d3);if(_0x13e10b['query'][_0xeb8a('0x39')]){_0x4dba7a[_0xeb8a('0x3a')]=_[_0xeb8a('0x3b')](_0x4dba7a[_0xeb8a('0x3a')],{'$or':_[_0xeb8a('0x28')](_0x2041d3,function(_0x5b76d3){if(_0x5b76d3[_0xeb8a('0x3c')]!==_0xeb8a('0x3d')){var _0xfe0fea={};_0xfe0fea[_0x5b76d3['name']]={'$like':'%'+_0x13e10b[_0xeb8a('0x2c')]['filter']+'%'};return _0xfe0fea;}})});}_0x4dba7a=_[_0xeb8a('0x3b')]({},_0x4dba7a,_0x13e10b[_0xeb8a('0x3e')]);var _0x407c34={'where':_0x4dba7a[_0xeb8a('0x3a')]};return db[_0xeb8a('0x29')][_0xeb8a('0x1a')](_0x407c34)[_0xeb8a('0x21')](function(_0x5b0500){_0x558e01[_0xeb8a('0x1a')]=_0x5b0500;if(_0x13e10b['query'][_0xeb8a('0x3f')]){_0x4dba7a['include']=[{'all':!![]}];}return db[_0xeb8a('0x29')]['findAll'](_0x4dba7a);})['then'](function(_0x434e10){_0x558e01[_0xeb8a('0x40')]=_0x434e10;return _0x558e01;})[_0xeb8a('0x21')](respondWithFilteredResult(_0x288e5b,_0x4dba7a))[_0xeb8a('0x41')](handleError(_0x288e5b,null));};exports['show']=function(_0x52ba23,_0x33e9e5){var _0x1c8d23={'raw':!![],'where':{'id':_0x52ba23[_0xeb8a('0x42')]['id']}},_0x348991={};_0x348991[_0xeb8a('0x33')]=_[_0xeb8a('0x2d')](db[_0xeb8a('0x29')][_0xeb8a('0x2a')]);_0x348991[_0xeb8a('0x2c')]=_[_0xeb8a('0x2d')](_0x52ba23[_0xeb8a('0x2c')]);_0x348991[_0xeb8a('0x2e')]=_[_0xeb8a('0x2f')](_0x348991['model'],_0x348991['query']);_0x1c8d23[_0xeb8a('0x30')]=_[_0xeb8a('0x2f')](_0x348991['model'],qs[_0xeb8a('0x31')](_0x52ba23[_0xeb8a('0x2c')][_0xeb8a('0x31')]));_0x1c8d23['attributes']=_0x1c8d23[_0xeb8a('0x30')][_0xeb8a('0x32')]?_0x1c8d23['attributes']:_0x348991[_0xeb8a('0x33')];if(_0x52ba23[_0xeb8a('0x2c')][_0xeb8a('0x3f')]){_0x1c8d23['include']=[{'all':!![]}];}_0x1c8d23=_[_0xeb8a('0x3b')]({},_0x1c8d23,_0x52ba23[_0xeb8a('0x3e')]);return db['SalesforceField'][_0xeb8a('0x43')](_0x1c8d23)['then'](handleEntityNotFound(_0x33e9e5,null))[_0xeb8a('0x21')](respondWithResult(_0x33e9e5,null))['catch'](handleError(_0x33e9e5,null));};exports['create']=function(_0x49ffef,_0x1056f9){return db[_0xeb8a('0x29')]['create'](_0x49ffef[_0xeb8a('0x44')],{})['then'](respondWithResult(_0x1056f9,0xc9))[_0xeb8a('0x41')](handleError(_0x1056f9,null));};exports['update']=function(_0x5d7a26,_0x3b78b5){if(_0x5d7a26['body']['id']){delete _0x5d7a26[_0xeb8a('0x44')]['id'];}return db[_0xeb8a('0x29')][_0xeb8a('0x43')]({'where':{'id':_0x5d7a26[_0xeb8a('0x42')]['id']}})[_0xeb8a('0x21')](handleEntityNotFound(_0x3b78b5,null))[_0xeb8a('0x21')](saveUpdates(_0x5d7a26['body'],null))[_0xeb8a('0x21')](respondWithResult(_0x3b78b5,null))['catch'](handleError(_0x3b78b5,null));};exports[_0xeb8a('0x45')]=function(_0x6113e4,_0x296abd){return db[_0xeb8a('0x29')]['find']({'where':{'id':_0x6113e4['params']['id']}})[_0xeb8a('0x21')](handleEntityNotFound(_0x296abd,null))[_0xeb8a('0x21')](removeEntity(_0x296abd,null))[_0xeb8a('0x41')](handleError(_0x296abd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 29cd8c6..cb44be4 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 _0x23b1=['../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0xba96f3,_0x79a708){var _0x22cf8b=function(_0x32d936){while(--_0x32d936){_0xba96f3['push'](_0xba96f3['shift']());}};_0x22cf8b(++_0x79a708);}(_0x23b1,0x157));var _0x123b=function(_0x28cb51,_0x9bdb3e){_0x28cb51=_0x28cb51-0x0;var _0x455ca1=_0x23b1[_0x28cb51];return _0x455ca1;};'use strict';var _=require(_0x123b('0x0'));var util=require(_0x123b('0x1'));var logger=require('../../config/logger')(_0x123b('0x2'));var moment=require(_0x123b('0x3'));var BPromise=require('bluebird');var rp=require(_0x123b('0x4'));var fs=require('fs');var path=require(_0x123b('0x5'));var rimraf=require(_0x123b('0x6'));var config=require(_0x123b('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x123b('0x8')]=function(_0x21750e,_0x44b587){return _0x21750e[_0x123b('0x9')](_0x123b('0xa'),attributes,{'tableName':_0x123b('0xb'),'paranoid':![],'indexes':[{'name':_0x123b('0xc'),'fields':['idField',_0x123b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56f6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x56f6,0x80));var _0x656f=function(_0xc0ab08,_0x3923db){_0xc0ab08=_0xc0ab08-0x0;var _0x296505=_0x56f6[_0xc0ab08];return _0x296505;};'use strict';var _=require(_0x656f('0x0'));var util=require(_0x656f('0x1'));var logger=require(_0x656f('0x2'))(_0x656f('0x3'));var moment=require(_0x656f('0x4'));var BPromise=require(_0x656f('0x5'));var rp=require(_0x656f('0x6'));var fs=require('fs');var path=require(_0x656f('0x7'));var rimraf=require(_0x656f('0x8'));var config=require(_0x656f('0x9'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0xd3a66e,_0x45fe37){return _0xd3a66e[_0x656f('0xa')](_0x656f('0xb'),attributes,{'tableName':_0x656f('0xc'),'paranoid':![],'indexes':[{'name':_0x656f('0xd'),'fields':[_0x656f('0xe'),_0x656f('0xf')],'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 ce5b4dc..279b87e 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 _0x28f9=['info','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x5208d2,_0x1b4807){var _0x2a9cb5=function(_0x12fcf6){while(--_0x12fcf6){_0x5208d2['push'](_0x5208d2['shift']());}};_0x2a9cb5(++_0x1b4807);}(_0x28f9,0x180));var _0x928f=function(_0x115926,_0x18c1e2){_0x115926=_0x115926-0x0;var _0x5999ab=_0x28f9[_0x115926];return _0x5999ab;};'use strict';var _=require(_0x928f('0x0'));var util=require(_0x928f('0x1'));var moment=require(_0x928f('0x2'));var BPromise=require('bluebird');var rs=require(_0x928f('0x3'));var fs=require('fs');var Redis=require(_0x928f('0x4'));var db=require(_0x928f('0x5'))['db'];var utils=require(_0x928f('0x6'));var logger=require('../../config/logger')(_0x928f('0x7'));var config=require(_0x928f('0x8'));var jayson=require(_0x928f('0x9'));var client=jayson['client'][_0x928f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16176c,_0x1e5551,_0x2f563e){return new BPromise(function(_0xb7a66a,_0x2c67df){return client['request'](_0x16176c,_0x2f563e)[_0x928f('0xb')](function(_0x5e4c5d){logger[_0x928f('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1e5551,'request\x20sent');logger['debug'](_0x928f('0xd'),_0x1e5551,_0x928f('0xe'),JSON[_0x928f('0xf')](_0x5e4c5d));if(_0x5e4c5d[_0x928f('0x10')]){if(_0x5e4c5d[_0x928f('0x10')][_0x928f('0x11')]===0x1f4){logger[_0x928f('0x10')](_0x928f('0x12'),_0x1e5551,_0x5e4c5d[_0x928f('0x10')][_0x928f('0x13')]);return _0x2c67df(_0x5e4c5d[_0x928f('0x10')][_0x928f('0x13')]);}logger[_0x928f('0x10')](_0x928f('0x12'),_0x1e5551,_0x5e4c5d[_0x928f('0x10')][_0x928f('0x13')]);return _0xb7a66a(_0x5e4c5d['error']['message']);}else{logger[_0x928f('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1e5551,_0x928f('0xe'));_0xb7a66a(_0x5e4c5d[_0x928f('0x14')][_0x928f('0x13')]);}})[_0x928f('0x15')](function(_0x339783){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1e5551,_0x339783);_0x2c67df(_0x339783);});});} \ No newline at end of file +var _0x5643=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x33a822,_0x452a30){var _0x337f34=function(_0x1cd833){while(--_0x1cd833){_0x33a822['push'](_0x33a822['shift']());}};_0x337f34(++_0x452a30);}(_0x5643,0xd5));var _0x3564=function(_0x33d15b,_0x64b39c){_0x33d15b=_0x33d15b-0x0;var _0x4cc3ae=_0x5643[_0x33d15b];return _0x4cc3ae;};'use strict';var _=require(_0x3564('0x0'));var util=require(_0x3564('0x1'));var moment=require('moment');var BPromise=require(_0x3564('0x2'));var rs=require(_0x3564('0x3'));var fs=require('fs');var Redis=require(_0x3564('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3564('0x5'));var logger=require(_0x3564('0x6'))(_0x3564('0x7'));var config=require(_0x3564('0x8'));var jayson=require(_0x3564('0x9'));var client=jayson['client'][_0x3564('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175fca,_0x38ef0a,_0x276e9c){return new BPromise(function(_0x346c49,_0x49d3bb){return client[_0x3564('0xb')](_0x175fca,_0x276e9c)[_0x3564('0xc')](function(_0x5bb9f5){logger['info'](_0x3564('0xd'),_0x38ef0a,_0x3564('0xe'));logger[_0x3564('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x38ef0a,_0x3564('0xe'),JSON[_0x3564('0x10')](_0x5bb9f5));if(_0x5bb9f5['error']){if(_0x5bb9f5[_0x3564('0x11')][_0x3564('0x12')]===0x1f4){logger['error'](_0x3564('0xd'),_0x38ef0a,_0x5bb9f5['error'][_0x3564('0x13')]);return _0x49d3bb(_0x5bb9f5[_0x3564('0x11')][_0x3564('0x13')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x38ef0a,_0x5bb9f5['error']['message']);return _0x346c49(_0x5bb9f5['error'][_0x3564('0x13')]);}else{logger[_0x3564('0x14')](_0x3564('0xd'),_0x38ef0a,_0x3564('0xe'));_0x346c49(_0x5bb9f5[_0x3564('0x15')][_0x3564('0x13')]);}})[_0x3564('0x16')](function(_0x565687){logger['error'](_0x3564('0xd'),_0x38ef0a,_0x565687);_0x49d3bb(_0x565687);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2b375f3..efc2968 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 _0x0b40=['getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x28b07f,_0x48ce50){var _0x3dac90=function(_0x257ac6){while(--_0x257ac6){_0x28b07f['push'](_0x28b07f['shift']());}};_0x3dac90(++_0x48ce50);}(_0x0b40,0xba));var _0x00b4=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x0b40[_0x1992f1];return _0x413dfe;};'use strict';var multer=require('multer');var util=require(_0x00b4('0x0'));var path=require(_0x00b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x00b4('0x2'));var router=express[_0x00b4('0x3')]();var fs_extra=require(_0x00b4('0x4'));var auth=require(_0x00b4('0x5'));var interaction=require(_0x00b4('0x6'));var config=require(_0x00b4('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x00b4('0x8')]('/',auth[_0x00b4('0x9')](),controller[_0x00b4('0xa')]);router[_0x00b4('0x8')]('/:id',auth[_0x00b4('0x9')](),controller[_0x00b4('0xb')]);router[_0x00b4('0x8')]('/:id/configurations',auth[_0x00b4('0x9')](),controller[_0x00b4('0xc')]);router['get']('/:id/fields',auth[_0x00b4('0x9')](),controller[_0x00b4('0xd')]);router[_0x00b4('0xe')]('/',auth[_0x00b4('0x9')](),controller[_0x00b4('0xf')]);router[_0x00b4('0xe')](_0x00b4('0x10'),auth[_0x00b4('0x9')](),controller[_0x00b4('0x11')]);router[_0x00b4('0x12')](_0x00b4('0x13'),auth[_0x00b4('0x9')](),controller['update']);router['delete'](_0x00b4('0x13'),auth[_0x00b4('0x9')](),controller[_0x00b4('0x14')]);module[_0x00b4('0x15')]=router; \ No newline at end of file +var _0x7085=['../../components/interaction/service','../../config/environment','isAuthenticated','index','show','get','/:id/fields','getFields','post','/:id/configurations','put','update','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x14eaa1,_0x2e1c9a){var _0x47fae4=function(_0x3e75f7){while(--_0x3e75f7){_0x14eaa1['push'](_0x14eaa1['shift']());}};_0x47fae4(++_0x2e1c9a);}(_0x7085,0x7e));var _0x5708=function(_0x3c10b7,_0x10fb4a){_0x3c10b7=_0x3c10b7-0x0;var _0xbd891b=_0x7085[_0x3c10b7];return _0xbd891b;};'use strict';var multer=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var path=require(_0x5708('0x2'));var timeout=require(_0x5708('0x3'));var express=require(_0x5708('0x4'));var router=express[_0x5708('0x5')]();var fs_extra=require(_0x5708('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5708('0x7'));var config=require(_0x5708('0x8'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x5708('0x9')](),controller[_0x5708('0xa')]);router['get']('/:id',auth[_0x5708('0x9')](),controller[_0x5708('0xb')]);router[_0x5708('0xc')]('/:id/configurations',auth[_0x5708('0x9')](),controller['getConfigurations']);router[_0x5708('0xc')](_0x5708('0xd'),auth[_0x5708('0x9')](),controller[_0x5708('0xe')]);router[_0x5708('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5708('0x10'),auth[_0x5708('0x9')](),controller['addConfiguration']);router[_0x5708('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5708('0x12')]);router['delete']('/:id',auth[_0x5708('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 9bf6864..3564432 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 _0xc447=['STRING','username','sequelize'];(function(_0x36159d,_0x3d37df){var _0x1c7898=function(_0x27a31b){while(--_0x27a31b){_0x36159d['push'](_0x36159d['shift']());}};_0x1c7898(++_0x3d37df);}(_0xc447,0xef));var _0x7c44=function(_0x3ee02d,_0x5296c0){_0x3ee02d=_0x3ee02d-0x0;var _0xafd402=_0xc447[_0x3ee02d];return _0xafd402;};'use strict';var Sequelize=require(_0x7c44('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c44('0x1')]},'description':{'type':Sequelize[_0x7c44('0x1')]},'username':{'type':Sequelize[_0x7c44('0x1')],'unique':_0x7c44('0x2')},'password':{'type':Sequelize[_0x7c44('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7c44('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x7c44('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x461f=['exports','STRING','remoteUri','sequelize'];(function(_0x6e51f1,_0x11371a){var _0x141b4c=function(_0x2e85e7){while(--_0x2e85e7){_0x6e51f1['push'](_0x6e51f1['shift']());}};_0x141b4c(++_0x11371a);}(_0x461f,0x18b));var _0xf461=function(_0x207d4e,_0x5158dc){_0x207d4e=_0x207d4e-0x0;var _0x24b6f4=_0x461f[_0x207d4e];return _0x24b6f4;};'use strict';var Sequelize=require(_0xf461('0x0'));module[_0xf461('0x1')]={'name':{'type':Sequelize[_0xf461('0x2')]},'description':{'type':Sequelize[_0xf461('0x2')]},'username':{'type':Sequelize[_0xf461('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xf461('0x2')]},'email':{'type':Sequelize[_0xf461('0x2')]},'remoteUri':{'type':Sequelize[_0xf461('0x2')],'unique':_0xf461('0x3')},'serverUrl':{'type':Sequelize[_0xf461('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ef5235b..a608602 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 _0xf04b=['label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','true','False','false','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','catch','create','body','find','findOne','order','sort','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','close_code','incident_state','severity','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','notify','sys_class_name','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','assigned_to','comments','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','password','email','serverUrl','slice','substring','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType'];(function(_0x1ec94e,_0x23f0fb){var _0x5c2b0f=function(_0x5117c7){while(--_0x5117c7){_0x1ec94e['push'](_0x1ec94e['shift']());}};_0x5c2b0f(++_0x23f0fb);}(_0xf04b,0xc5));var _0xbf04=function(_0xeaea99,_0x4b8960){_0xeaea99=_0xeaea99-0x0;var _0x123eb7=_0xf04b[_0xeaea99];return _0x123eb7;};'use strict';var emlformat=require(_0xbf04('0x0'));var rimraf=require(_0xbf04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf04('0x2'));var rp=require(_0xbf04('0x3'));var moment=require(_0xbf04('0x4'));var BPromise=require(_0xbf04('0x5'));var Mustache=require(_0xbf04('0x6'));var util=require(_0xbf04('0x7'));var path=require(_0xbf04('0x8'));var sox=require(_0xbf04('0x9'));var csv=require(_0xbf04('0xa'));var ejs=require(_0xbf04('0xb'));var fs=require('fs');var fs_extra=require(_0xbf04('0xc'));var _=require(_0xbf04('0xd'));var squel=require(_0xbf04('0xe'));var crypto=require(_0xbf04('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf04('0x10'));var Papa=require(_0xbf04('0x11'));var Redis=require(_0xbf04('0x12'));var authService=require(_0xbf04('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbf04('0x14'));var hardwareService=require(_0xbf04('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbf04('0x16'));var config=require(_0xbf04('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3ebf05,_0x3ff30a){_0x3ff30a=_0x3ff30a||0xcc;return function(_0x58fd02){if(_0x58fd02){return _0x3ebf05[_0xbf04('0x18')](_0x3ff30a);}return _0x3ebf05[_0xbf04('0x19')](_0x3ff30a)[_0xbf04('0x1a')]();};}function respondWithResult(_0x28ea0a,_0x2c019f){_0x2c019f=_0x2c019f||0xc8;return function(_0x1c76b8){if(_0x1c76b8){return _0x28ea0a[_0xbf04('0x19')](_0x2c019f)[_0xbf04('0x1b')](_0x1c76b8);}};}function respondWithFilteredResult(_0x1dfd1a,_0x1dbff5){return function(_0x4b679c){if(_0x4b679c){var _0x2498c8=typeof _0x1dbff5[_0xbf04('0x1c')]===_0xbf04('0x1d')&&typeof _0x1dbff5[_0xbf04('0x1e')]===_0xbf04('0x1d');var _0x1fb08a=_0x4b679c[_0xbf04('0x1f')];var _0x240d1c=_0x2498c8?0x0:_0x1dbff5[_0xbf04('0x1c')];var _0x432dd5=_0x2498c8?_0x4b679c[_0xbf04('0x1f')]:_0x1dbff5[_0xbf04('0x1c')]+_0x1dbff5[_0xbf04('0x1e')];var _0x181445;if(_0x432dd5>=_0x1fb08a){_0x432dd5=_0x1fb08a;_0x181445=0xc8;}else{_0x181445=0xce;}_0x1dfd1a[_0xbf04('0x19')](_0x181445);return _0x1dfd1a[_0xbf04('0x20')](_0xbf04('0x21'),_0x240d1c+'-'+_0x432dd5+'/'+_0x1fb08a)[_0xbf04('0x1b')](_0x4b679c);}return null;};}function patchUpdates(_0x14fe81){return function(_0x2f5c1f){try{jsonpatch[_0xbf04('0x22')](_0x2f5c1f,_0x14fe81,!![]);}catch(_0x214f58){return BPromise[_0xbf04('0x23')](_0x214f58);}return _0x2f5c1f[_0xbf04('0x24')]();};}function saveUpdates(_0x5b0af3,_0x40c534){return function(_0x4e3d3b){if(_0x4e3d3b){return _0x4e3d3b[_0xbf04('0x25')](_0x5b0af3)[_0xbf04('0x26')](function(_0x2139e3){return _0x2139e3;});}return null;};}function removeEntity(_0x4566dd,_0x167070){return function(_0x464492){if(_0x464492){return _0x464492[_0xbf04('0x27')]()[_0xbf04('0x26')](function(){_0x4566dd['status'](0xcc)[_0xbf04('0x1a')]();});}};}function handleEntityNotFound(_0x5d6a4a,_0x491c2d){return function(_0x35f1ee){if(!_0x35f1ee){_0x5d6a4a['sendStatus'](0x194);}return _0x35f1ee;};}function handleError(_0x3777da,_0xe5d27d){_0xe5d27d=_0xe5d27d||0x1f4;return function(_0x4f983b){logger[_0xbf04('0x28')](_0x4f983b[_0xbf04('0x29')]);if(_0x4f983b[_0xbf04('0x2a')]){delete _0x4f983b[_0xbf04('0x2a')];}_0x3777da[_0xbf04('0x19')](_0xe5d27d)[_0xbf04('0x2b')](_0x4f983b);};}exports[_0xbf04('0x2c')]=function(_0x1bf1e1,_0x388c60){var _0x5ed8a9={},_0x62bfb8={},_0x28f2ac={'count':0x0,'rows':[]};var _0x30bc8d=_[_0xbf04('0x2d')](db[_0xbf04('0x2e')]['rawAttributes'],function(_0x17bf00){return{'name':_0x17bf00[_0xbf04('0x2f')],'type':_0x17bf00[_0xbf04('0x30')][_0xbf04('0x31')]};});_0x62bfb8[_0xbf04('0x32')]=_[_0xbf04('0x2d')](_0x30bc8d,_0xbf04('0x2a'));_0x62bfb8[_0xbf04('0x33')]=_['keys'](_0x1bf1e1[_0xbf04('0x33')]);_0x62bfb8[_0xbf04('0x34')]=_[_0xbf04('0x35')](_0x62bfb8[_0xbf04('0x32')],_0x62bfb8['query']);_0x5ed8a9[_0xbf04('0x36')]=_[_0xbf04('0x35')](_0x62bfb8['model'],qs[_0xbf04('0x37')](_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x37')]));_0x5ed8a9['attributes']=_0x5ed8a9[_0xbf04('0x36')][_0xbf04('0x38')]?_0x5ed8a9[_0xbf04('0x36')]:_0x62bfb8[_0xbf04('0x32')];if(!_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x39')]('nolimit')){_0x5ed8a9[_0xbf04('0x1e')]=qs[_0xbf04('0x1e')](_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x1e')]);_0x5ed8a9['offset']=qs[_0xbf04('0x1c')](_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x1c')]);}_0x5ed8a9['order']=qs['sort'](_0x1bf1e1['query']['sort']);_0x5ed8a9[_0xbf04('0x3a')]=qs[_0xbf04('0x34')](_[_0xbf04('0x3b')](_0x1bf1e1[_0xbf04('0x33')],_0x62bfb8[_0xbf04('0x34')]),_0x30bc8d);if(_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x3c')]){_0x5ed8a9[_0xbf04('0x3a')]=_[_0xbf04('0x3d')](_0x5ed8a9[_0xbf04('0x3a')],{'$or':_['map'](_0x30bc8d,function(_0x108edc){if(_0x108edc[_0xbf04('0x30')]!=='VIRTUAL'){var _0xe293bf={};_0xe293bf[_0x108edc['name']]={'$like':'%'+_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x3c')]+'%'};return _0xe293bf;}})});}_0x5ed8a9=_[_0xbf04('0x3d')]({},_0x5ed8a9,_0x1bf1e1[_0xbf04('0x3e')]);var _0x2a8938={'where':_0x5ed8a9[_0xbf04('0x3a')]};return db[_0xbf04('0x2e')]['count'](_0x2a8938)[_0xbf04('0x26')](function(_0xbe90ce){_0x28f2ac[_0xbf04('0x1f')]=_0xbe90ce;if(_0x1bf1e1[_0xbf04('0x33')][_0xbf04('0x3f')]){_0x5ed8a9[_0xbf04('0x40')]=[{'all':!![]}];}return db[_0xbf04('0x2e')][_0xbf04('0x41')](_0x5ed8a9);})[_0xbf04('0x26')](function(_0x57f75c){_0x28f2ac[_0xbf04('0x42')]=_0x57f75c;return _0x28f2ac;})[_0xbf04('0x26')](respondWithFilteredResult(_0x388c60,_0x5ed8a9))['catch'](handleError(_0x388c60,null));};exports['show']=function(_0x233783,_0x393249){var _0x4e674e={'raw':![],'where':{'id':_0x233783[_0xbf04('0x43')]['id']}},_0x147ceb={};_0x147ceb[_0xbf04('0x32')]=_[_0xbf04('0x44')](db[_0xbf04('0x2e')][_0xbf04('0x45')]);_0x147ceb[_0xbf04('0x33')]=_[_0xbf04('0x44')](_0x233783['query']);_0x147ceb[_0xbf04('0x34')]=_[_0xbf04('0x35')](_0x147ceb[_0xbf04('0x32')],_0x147ceb[_0xbf04('0x33')]);_0x4e674e[_0xbf04('0x36')]=_['intersection'](_0x147ceb[_0xbf04('0x32')],qs[_0xbf04('0x37')](_0x233783[_0xbf04('0x33')][_0xbf04('0x37')]));_0x4e674e['attributes']=_0x4e674e[_0xbf04('0x36')]['length']?_0x4e674e[_0xbf04('0x36')]:_0x147ceb[_0xbf04('0x32')];if(_0x233783['query'][_0xbf04('0x3f')]){_0x4e674e[_0xbf04('0x40')]=[{'all':!![]}];}_0x4e674e=_[_0xbf04('0x3d')]({},_0x4e674e,_0x233783[_0xbf04('0x3e')]);return db[_0xbf04('0x2e')]['find'](_0x4e674e)['then'](handleEntityNotFound(_0x393249,null))[_0xbf04('0x26')](respondWithResult(_0x393249,null))[_0xbf04('0x46')](handleError(_0x393249,null));};exports[_0xbf04('0x47')]=function(_0x436ccb,_0x4873c3){return db[_0xbf04('0x2e')][_0xbf04('0x47')](_0x436ccb[_0xbf04('0x48')],{})[_0xbf04('0x26')](respondWithResult(_0x4873c3,0xc9))['catch'](handleError(_0x4873c3,null));};exports[_0xbf04('0x25')]=function(_0xfd3244,_0x39aee2){if(_0xfd3244['body']['id']){delete _0xfd3244[_0xbf04('0x48')]['id'];}return db[_0xbf04('0x2e')][_0xbf04('0x49')]({'where':{'id':_0xfd3244[_0xbf04('0x43')]['id']}})[_0xbf04('0x26')](handleEntityNotFound(_0x39aee2,null))[_0xbf04('0x26')](saveUpdates(_0xfd3244[_0xbf04('0x48')],null))[_0xbf04('0x26')](respondWithResult(_0x39aee2,null))['catch'](handleError(_0x39aee2,null));};exports[_0xbf04('0x27')]=function(_0x380deb,_0x228672){return db[_0xbf04('0x2e')][_0xbf04('0x49')]({'where':{'id':_0x380deb[_0xbf04('0x43')]['id']}})[_0xbf04('0x26')](handleEntityNotFound(_0x228672,null))[_0xbf04('0x26')](removeEntity(_0x228672,null))[_0xbf04('0x46')](handleError(_0x228672,null));};exports['getConfigurations']=function(_0x4e4a3a,_0x34fe40,_0x33f6ac){var _0x2fb65c={};var _0x3a21ec={};var _0x4d6659;var _0x5214f9;return db['ServicenowAccount'][_0xbf04('0x4a')]({'where':{'id':_0x4e4a3a[_0xbf04('0x43')]['id']}})[_0xbf04('0x26')](handleEntityNotFound(_0x34fe40,null))[_0xbf04('0x26')](function(_0x226011){if(_0x226011){_0x4d6659=_0x226011;_0x3a21ec[_0xbf04('0x32')]=_[_0xbf04('0x44')](db['ServicenowConfiguration']['rawAttributes']);_0x3a21ec['query']=_[_0xbf04('0x44')](_0x4e4a3a[_0xbf04('0x33')]);_0x3a21ec[_0xbf04('0x34')]=_[_0xbf04('0x35')](_0x3a21ec['model'],_0x3a21ec['query']);_0x2fb65c['attributes']=_['intersection'](_0x3a21ec[_0xbf04('0x32')],qs['fields'](_0x4e4a3a[_0xbf04('0x33')]['fields']));_0x2fb65c[_0xbf04('0x36')]=_0x2fb65c[_0xbf04('0x36')][_0xbf04('0x38')]?_0x2fb65c[_0xbf04('0x36')]:_0x3a21ec['model'];_0x2fb65c[_0xbf04('0x4b')]=qs['sort'](_0x4e4a3a['query'][_0xbf04('0x4c')]);_0x2fb65c[_0xbf04('0x3a')]=qs[_0xbf04('0x34')](_['pick'](_0x4e4a3a[_0xbf04('0x33')],_0x3a21ec[_0xbf04('0x34')]));if(_0x4e4a3a[_0xbf04('0x33')][_0xbf04('0x3c')]){_0x2fb65c[_0xbf04('0x3a')]=_[_0xbf04('0x3d')](_0x2fb65c[_0xbf04('0x3a')],{'$or':_[_0xbf04('0x2d')](_0x2fb65c['attributes'],function(_0x4c572e){var _0x8ded74={};_0x8ded74[_0x4c572e]={'$like':'%'+_0x4e4a3a['query'][_0xbf04('0x3c')]+'%'};return _0x8ded74;})});}_0x2fb65c=_[_0xbf04('0x3d')]({},_0x2fb65c,_0x4e4a3a['options']);return _0x4d6659['getConfigurations'](_0x2fb65c);}})[_0xbf04('0x26')](function(_0x5d6a24){if(_0x5d6a24){_0x5214f9=_0x5d6a24['length'];if(!_0x4e4a3a['query'][_0xbf04('0x39')]('nolimit')){_0x2fb65c[_0xbf04('0x1e')]=qs[_0xbf04('0x1e')](_0x4e4a3a['query']['limit']);_0x2fb65c[_0xbf04('0x1c')]=qs[_0xbf04('0x1c')](_0x4e4a3a[_0xbf04('0x33')]['offset']);}return _0x4d6659[_0xbf04('0x4d')](_0x2fb65c);}})[_0xbf04('0x26')](function(_0x4b43c4){if(_0x4b43c4){return _0x4b43c4?{'count':_0x5214f9,'rows':_0x4b43c4}:null;}})[_0xbf04('0x26')](respondWithResult(_0x34fe40,null))[_0xbf04('0x46')](handleError(_0x34fe40,null));};exports['addConfiguration']=function(_0x483cb8,_0x2ad782,_0x238784){if(_0x483cb8[_0xbf04('0x48')]['id']){delete _0x483cb8[_0xbf04('0x48')]['id'];}return db[_0xbf04('0x2e')]['findOne']({'where':{'id':_0x483cb8[_0xbf04('0x43')]['id']}})[_0xbf04('0x26')](handleEntityNotFound(_0x2ad782,null))[_0xbf04('0x26')](function(_0x1a9352){if(_0x1a9352){_0x483cb8[_0xbf04('0x48')][_0xbf04('0x4e')]=_0x1a9352['id'];_0x483cb8[_0xbf04('0x48')][_0xbf04('0x4f')]=integrations[_0xbf04('0x50')](_0x483cb8['body'][_0xbf04('0x51')],_0x483cb8['body'][_0xbf04('0x30')]);_0x483cb8[_0xbf04('0x48')]['Descriptions']=integrations[_0xbf04('0x52')](_0x483cb8[_0xbf04('0x48')]['channel'],_0x483cb8['body'][_0xbf04('0x30')]);return db['ServicenowConfiguration'][_0xbf04('0x47')](_0x483cb8['body'],{'include':[{'model':db['ServicenowField'],'as':_0xbf04('0x4f')},{'model':db[_0xbf04('0x53')],'as':_0xbf04('0x54')}]});}return null;})[_0xbf04('0x26')](respondWithResult(_0x2ad782,null))[_0xbf04('0x46')](handleError(_0x2ad782,null));};exports['getFields']=function(_0x35e792,_0x1a5831,_0x2b9f14){var _0x2cf1e1=[_0xbf04('0x55'),_0xbf04('0x56'),_0xbf04('0x57'),'subcategory',_0xbf04('0x58'),'notify',_0xbf04('0x59'),_0xbf04('0x5a'),'category'];var _0x271f69=[_0xbf04('0x5b'),_0xbf04('0x55'),'caused_by',_0xbf04('0x5c'),_0xbf04('0x5d'),_0xbf04('0x5e'),_0xbf04('0x5f'),_0xbf04('0x56'),_0xbf04('0x60'),_0xbf04('0x61'),_0xbf04('0x62'),_0xbf04('0x63'),_0xbf04('0x64'),'user_input',_0xbf04('0x65'),_0xbf04('0x66'),_0xbf04('0x67'),_0xbf04('0x68'),_0xbf04('0x57'),_0xbf04('0x4b'),_0xbf04('0x69'),_0xbf04('0x6a'),_0xbf04('0x6b'),_0xbf04('0x6c'),_0xbf04('0x6d'),_0xbf04('0x6e'),_0xbf04('0x6f'),_0xbf04('0x70'),'priority',_0xbf04('0x71'),_0xbf04('0x72'),'time_worked',_0xbf04('0x73'),'opened_at',_0xbf04('0x74'),_0xbf04('0x75'),_0xbf04('0x76'),_0xbf04('0x77'),_0xbf04('0x78'),'caller_id',_0xbf04('0x79'),_0xbf04('0x7a'),_0xbf04('0x7b'),'short_description',_0xbf04('0x58'),_0xbf04('0x7c'),_0xbf04('0x7d'),_0xbf04('0x7e'),_0xbf04('0x7f'),'business_stc',_0xbf04('0x80'),_0xbf04('0x81'),'calendar_duration',_0xbf04('0x82'),_0xbf04('0x83'),'close_notes','closed_by','follow_up','parent_incident',_0xbf04('0x84'),_0xbf04('0x85'),_0xbf04('0x86'),_0xbf04('0x59'),'urgency',_0xbf04('0x87'),_0xbf04('0x88'),_0xbf04('0x89'),'activity_due',_0xbf04('0x8a'),'severity',_0xbf04('0x8b'),'sla_due','approval','comments_and_work_notes',_0xbf04('0x8c'),_0xbf04('0x8d'),_0xbf04('0x8e'),_0xbf04('0x8f'),_0xbf04('0x90'),_0xbf04('0x91'),'correlation_id','location','category'];var _0x5a9f38='';var _0x2413da='';var _0x2781c5=[];var _0x7e3b89='';var _0x166ba5='';var _0x50e39e=[];var _0x4ca526='';var _0x485d28='';var _0x25b48a={};var _0x35c387='';return db[_0xbf04('0x2e')][_0xbf04('0x4a')]({'where':{'id':_0x35e792[_0xbf04('0x43')]['id']},'attributes':['id','username',_0xbf04('0x92'),_0xbf04('0x93'),'remoteUri',_0xbf04('0x94')]})[_0xbf04('0x26')](handleEntityNotFound(_0x1a5831,null))[_0xbf04('0x26')](function(_0x4a45a2){if(_0x4a45a2){_0x35c387=_0x4a45a2['remoteUri'];var _0x52e62c=_0x35c387[_0xbf04('0x95')](-0x1);if(_0x52e62c==='/'){_0x35c387=_0x35c387[_0xbf04('0x96')](0x0,_0x35c387['lastIndexOf'](_0x52e62c));}_0x485d28=util[_0xbf04('0x97')]('%s/api/now/doc/table/schema/',_0x35c387);_0x4ca526=util[_0xbf04('0x97')](_0xbf04('0x98'),_0x35c387);_0x25b48a={'user':_0x4a45a2[_0xbf04('0x99')],'pass':_0x4a45a2[_0xbf04('0x92')]};var _0x484ee0={'method':_0xbf04('0x9a'),'uri':_0x485d28+_0xbf04('0x9b'),'auth':_0x25b48a,'json':!![]};return rp(_0x484ee0);}})[_0xbf04('0x26')](function(_0x54751d){if(_0x54751d[_0xbf04('0x9c')][_0xbf04('0x38')]>0x0){_0x5a9f38=_0x54751d[_0xbf04('0x9c')];}console[_0xbf04('0x9d')]('incident\x20table\x20objects',_0x5a9f38);_0x50e39e=[];_0x2413da=Object[_0xbf04('0x9e')]([],_0x5a9f38);_[_0xbf04('0x9f')](_0x2413da,function(_0x1dddae){return!_0x2cf1e1[_0xbf04('0xa0')](_0x1dddae['name']);});_0x2413da[_0xbf04('0xa1')](function(_0x35ccb6){var _0x51230b=createFieldObject(_0x4ca526,_0x25b48a,_0x35ccb6[_0xbf04('0xa2')],_0x35ccb6[_0xbf04('0x2a')],_0x35ccb6[_0xbf04('0xa3')],![]);_0x50e39e[_0xbf04('0xa4')](_0x51230b);});return Promise[_0xbf04('0xa5')](_0x50e39e);})[_0xbf04('0x26')](function(_0x53b799){_0x2781c5=_0x53b799;_0x7e3b89=Object[_0xbf04('0x9e')]([],_0x5a9f38);console[_0xbf04('0x9d')](_0xbf04('0xa6'),_0x5a9f38);_[_0xbf04('0x9f')](_0x7e3b89,function(_0x4252f1){return _0x271f69[_0xbf04('0xa0')](_0x4252f1[_0xbf04('0x2a')]);});console['log'](_0xbf04('0xa7'),_0x7e3b89);_0x50e39e=[];_0x7e3b89[_0xbf04('0xa1')](function(_0x45a18f){var _0x1f2f8e=createFieldObject(_0x4ca526,_0x25b48a,_0x45a18f[_0xbf04('0xa2')],_0x45a18f[_0xbf04('0x2a')],_0x45a18f[_0xbf04('0xa3')],!![]);_0x50e39e[_0xbf04('0xa4')](_0x1f2f8e);});return Promise[_0xbf04('0xa5')](_0x50e39e);})[_0xbf04('0x26')](function(_0x42ea25){_0x166ba5=_0x42ea25;var _0x33b307=_0x2781c5[_0xbf04('0xa8')](_0x166ba5);return{'count':_0x33b307['length'],'rows':_0x33b307};})[_0xbf04('0x26')](respondWithResult(_0x1a5831,null))[_0xbf04('0x46')](function(_0x174f78){console[_0xbf04('0x9d')](_0xbf04('0xa9')+_0x174f78);var _0x36660c=_0x35e792[_0xbf04('0x33')]['test']?0x1f4:_0x174f78[_0xbf04('0xaa')]||0x1f4;logger[_0xbf04('0x28')](_0x174f78['stack']);delete _0x174f78[_0xbf04('0x2a')];if(_0x36660c===0x191){_0x36660c=0x190;}_0x1a5831['status'](_0x36660c)[_0xbf04('0x2b')](_0x35e792[_0xbf04('0x33')][_0xbf04('0xab')]?{'message':_0xbf04('0xac'),'statusCode':_0x174f78[_0xbf04('0xaa')]}:_0x174f78);});};function createFieldObject(_0x4d8672,_0x3a5078,_0x4abe0e,_0x53811c,_0x45bf77,_0x597b94){return new Promise(function(_0x2efa17,_0x4e231a){var _0x502219={'id':_0x53811c,'name':_0x45bf77,'custom':_0x597b94};if(_0x4abe0e===_0xbf04('0xad')){_0x502219['options']=[{'name':_0xbf04('0xae'),'value':_0xbf04('0xaf')},{'name':_0xbf04('0xb0'),'value':_0xbf04('0xb1')}];_0x2efa17(_0x502219);}else{var _0x162672={'method':'GET','uri':_0x4d8672+'sys_choice?sysparm_query=name=incident^element='+_0x53811c,'auth':_0x3a5078,'json':!![]};return rp(_0x162672)[_0xbf04('0x26')](function(_0x2b561f){var _0x2d7005=[];if(_0x2b561f[_0xbf04('0x9c')][_0xbf04('0x38')]>0x0){_0x2b561f['result']['forEach'](function(_0x5e49b2){if(_0x5e49b2[_0xbf04('0xb2')]==='false'){var _0x4b94cf={'name':_0x5e49b2[_0xbf04('0xa3')],'value':_0x5e49b2[_0xbf04('0xb3')]};_0x2d7005[_0xbf04('0xa4')](_0x4b94cf);}});}_0x502219[_0xbf04('0x3e')]=_0x2d7005;if(_0x502219[_0xbf04('0x3e')][_0xbf04('0x38')]>0x0){_0x2efa17(_0x502219);}else{if(_0x597b94==![]){_0x2efa17();}else{_0x2efa17(_0x502219);}}});}});} \ No newline at end of file +var _0x50eb=['stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','update','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','calendar_stc','closed_at','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','closed_by','follow_up','sys_id','contact_type','reopened_by','incident_state','problem_id','company','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','location','username','password','email','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','includes','forEach','label','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','statusCode','test','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','value','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x2851b2,_0x36d9d1){var _0x41e321=function(_0x1a89d4){while(--_0x1a89d4){_0x2851b2['push'](_0x2851b2['shift']());}};_0x41e321(++_0x36d9d1);}(_0x50eb,0x147));var _0xb50e=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x50eb[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0xb50e('0x0'));var rimraf=require(_0xb50e('0x1'));var zipdir=require(_0xb50e('0x2'));var jsonpatch=require(_0xb50e('0x3'));var rp=require('request-promise');var moment=require(_0xb50e('0x4'));var BPromise=require(_0xb50e('0x5'));var Mustache=require(_0xb50e('0x6'));var util=require(_0xb50e('0x7'));var path=require(_0xb50e('0x8'));var sox=require('sox');var csv=require(_0xb50e('0x9'));var ejs=require(_0xb50e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb50e('0xb'));var crypto=require(_0xb50e('0xc'));var jsforce=require(_0xb50e('0xd'));var deskjs=require(_0xb50e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb50e('0xf'));var Redis=require(_0xb50e('0x10'));var authService=require(_0xb50e('0x11'));var qs=require(_0xb50e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb50e('0x13'));var logger=require(_0xb50e('0x14'))(_0xb50e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb50e('0x16'));var db=require(_0xb50e('0x17'))['db'];var integrations=require(_0xb50e('0x18'));function respondWithStatusCode(_0x3473ee,_0x35f73e){_0x35f73e=_0x35f73e||0xcc;return function(_0x316848){if(_0x316848){return _0x3473ee[_0xb50e('0x19')](_0x35f73e);}return _0x3473ee['status'](_0x35f73e)[_0xb50e('0x1a')]();};}function respondWithResult(_0x254b6f,_0x515d43){_0x515d43=_0x515d43||0xc8;return function(_0x30c69e){if(_0x30c69e){return _0x254b6f[_0xb50e('0x1b')](_0x515d43)['json'](_0x30c69e);}};}function respondWithFilteredResult(_0x520e5f,_0x31ae28){return function(_0x50d068){if(_0x50d068){var _0x26af53=typeof _0x31ae28[_0xb50e('0x1c')]==='undefined'&&typeof _0x31ae28[_0xb50e('0x1d')]==='undefined';var _0x558ad3=_0x50d068['count'];var _0x1e43b1=_0x26af53?0x0:_0x31ae28[_0xb50e('0x1c')];var _0x397052=_0x26af53?_0x50d068[_0xb50e('0x1e')]:_0x31ae28['offset']+_0x31ae28[_0xb50e('0x1d')];var _0x4c6295;if(_0x397052>=_0x558ad3){_0x397052=_0x558ad3;_0x4c6295=0xc8;}else{_0x4c6295=0xce;}_0x520e5f[_0xb50e('0x1b')](_0x4c6295);return _0x520e5f[_0xb50e('0x1f')](_0xb50e('0x20'),_0x1e43b1+'-'+_0x397052+'/'+_0x558ad3)['json'](_0x50d068);}return null;};}function patchUpdates(_0x36a1bb){return function(_0x2c49f0){try{jsonpatch[_0xb50e('0x21')](_0x2c49f0,_0x36a1bb,!![]);}catch(_0x1dae04){return BPromise[_0xb50e('0x22')](_0x1dae04);}return _0x2c49f0[_0xb50e('0x23')]();};}function saveUpdates(_0x17d1c1,_0x7f255b){return function(_0xc850f5){if(_0xc850f5){return _0xc850f5['update'](_0x17d1c1)[_0xb50e('0x24')](function(_0x58f8bd){return _0x58f8bd;});}return null;};}function removeEntity(_0x5ad536,_0x3098dd){return function(_0x5b2136){if(_0x5b2136){return _0x5b2136[_0xb50e('0x25')]()[_0xb50e('0x24')](function(){_0x5ad536[_0xb50e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57f779,_0x564989){return function(_0x497988){if(!_0x497988){_0x57f779[_0xb50e('0x19')](0x194);}return _0x497988;};}function handleError(_0x4a908a,_0x4dae49){_0x4dae49=_0x4dae49||0x1f4;return function(_0x73f46c){logger[_0xb50e('0x26')](_0x73f46c[_0xb50e('0x27')]);if(_0x73f46c[_0xb50e('0x28')]){delete _0x73f46c[_0xb50e('0x28')];}_0x4a908a[_0xb50e('0x1b')](_0x4dae49)[_0xb50e('0x29')](_0x73f46c);};}exports[_0xb50e('0x2a')]=function(_0x3f2db4,_0x5be88b){var _0xef7243={},_0x4edd5d={},_0x13a0c3={'count':0x0,'rows':[]};var _0x12c28f=_[_0xb50e('0x2b')](db[_0xb50e('0x2c')][_0xb50e('0x2d')],function(_0x357d67){return{'name':_0x357d67[_0xb50e('0x2e')],'type':_0x357d67[_0xb50e('0x2f')][_0xb50e('0x30')]};});_0x4edd5d['model']=_[_0xb50e('0x2b')](_0x12c28f,_0xb50e('0x28'));_0x4edd5d[_0xb50e('0x31')]=_[_0xb50e('0x32')](_0x3f2db4['query']);_0x4edd5d[_0xb50e('0x33')]=_[_0xb50e('0x34')](_0x4edd5d[_0xb50e('0x35')],_0x4edd5d['query']);_0xef7243[_0xb50e('0x36')]=_[_0xb50e('0x34')](_0x4edd5d[_0xb50e('0x35')],qs[_0xb50e('0x37')](_0x3f2db4['query'][_0xb50e('0x37')]));_0xef7243[_0xb50e('0x36')]=_0xef7243[_0xb50e('0x36')][_0xb50e('0x38')]?_0xef7243[_0xb50e('0x36')]:_0x4edd5d['model'];if(!_0x3f2db4[_0xb50e('0x31')][_0xb50e('0x39')](_0xb50e('0x3a'))){_0xef7243[_0xb50e('0x1d')]=qs['limit'](_0x3f2db4[_0xb50e('0x31')]['limit']);_0xef7243[_0xb50e('0x1c')]=qs['offset'](_0x3f2db4[_0xb50e('0x31')][_0xb50e('0x1c')]);}_0xef7243[_0xb50e('0x3b')]=qs[_0xb50e('0x3c')](_0x3f2db4[_0xb50e('0x31')][_0xb50e('0x3c')]);_0xef7243[_0xb50e('0x3d')]=qs[_0xb50e('0x33')](_[_0xb50e('0x3e')](_0x3f2db4[_0xb50e('0x31')],_0x4edd5d['filters']),_0x12c28f);if(_0x3f2db4['query'][_0xb50e('0x3f')]){_0xef7243[_0xb50e('0x3d')]=_[_0xb50e('0x40')](_0xef7243[_0xb50e('0x3d')],{'$or':_[_0xb50e('0x2b')](_0x12c28f,function(_0x4ccbbb){if(_0x4ccbbb[_0xb50e('0x2f')]!==_0xb50e('0x41')){var _0x48dac4={};_0x48dac4[_0x4ccbbb[_0xb50e('0x28')]]={'$like':'%'+_0x3f2db4[_0xb50e('0x31')][_0xb50e('0x3f')]+'%'};return _0x48dac4;}})});}_0xef7243=_[_0xb50e('0x40')]({},_0xef7243,_0x3f2db4['options']);var _0x4dc33b={'where':_0xef7243[_0xb50e('0x3d')]};return db[_0xb50e('0x2c')][_0xb50e('0x1e')](_0x4dc33b)[_0xb50e('0x24')](function(_0x32ca05){_0x13a0c3[_0xb50e('0x1e')]=_0x32ca05;if(_0x3f2db4[_0xb50e('0x31')][_0xb50e('0x42')]){_0xef7243[_0xb50e('0x43')]=[{'all':!![]}];}return db[_0xb50e('0x2c')]['findAll'](_0xef7243);})[_0xb50e('0x24')](function(_0x4747bb){_0x13a0c3[_0xb50e('0x44')]=_0x4747bb;return _0x13a0c3;})[_0xb50e('0x24')](respondWithFilteredResult(_0x5be88b,_0xef7243))[_0xb50e('0x45')](handleError(_0x5be88b,null));};exports[_0xb50e('0x46')]=function(_0x19e349,_0x1a9cfc){var _0x1d5d50={'raw':![],'where':{'id':_0x19e349[_0xb50e('0x47')]['id']}},_0x2a6dfa={};_0x2a6dfa['model']=_[_0xb50e('0x32')](db[_0xb50e('0x2c')][_0xb50e('0x2d')]);_0x2a6dfa[_0xb50e('0x31')]=_['keys'](_0x19e349[_0xb50e('0x31')]);_0x2a6dfa[_0xb50e('0x33')]=_[_0xb50e('0x34')](_0x2a6dfa[_0xb50e('0x35')],_0x2a6dfa['query']);_0x1d5d50[_0xb50e('0x36')]=_[_0xb50e('0x34')](_0x2a6dfa[_0xb50e('0x35')],qs['fields'](_0x19e349[_0xb50e('0x31')][_0xb50e('0x37')]));_0x1d5d50[_0xb50e('0x36')]=_0x1d5d50['attributes'][_0xb50e('0x38')]?_0x1d5d50['attributes']:_0x2a6dfa[_0xb50e('0x35')];if(_0x19e349[_0xb50e('0x31')]['includeAll']){_0x1d5d50[_0xb50e('0x43')]=[{'all':!![]}];}_0x1d5d50=_[_0xb50e('0x40')]({},_0x1d5d50,_0x19e349[_0xb50e('0x48')]);return db[_0xb50e('0x2c')][_0xb50e('0x49')](_0x1d5d50)[_0xb50e('0x24')](handleEntityNotFound(_0x1a9cfc,null))['then'](respondWithResult(_0x1a9cfc,null))[_0xb50e('0x45')](handleError(_0x1a9cfc,null));};exports[_0xb50e('0x4a')]=function(_0x52fb16,_0x405f8e){return db[_0xb50e('0x2c')][_0xb50e('0x4a')](_0x52fb16[_0xb50e('0x4b')],{})[_0xb50e('0x24')](respondWithResult(_0x405f8e,0xc9))['catch'](handleError(_0x405f8e,null));};exports[_0xb50e('0x4c')]=function(_0x4d8b33,_0x326a84){if(_0x4d8b33['body']['id']){delete _0x4d8b33[_0xb50e('0x4b')]['id'];}return db[_0xb50e('0x2c')][_0xb50e('0x49')]({'where':{'id':_0x4d8b33['params']['id']}})['then'](handleEntityNotFound(_0x326a84,null))[_0xb50e('0x24')](saveUpdates(_0x4d8b33[_0xb50e('0x4b')],null))['then'](respondWithResult(_0x326a84,null))[_0xb50e('0x45')](handleError(_0x326a84,null));};exports[_0xb50e('0x25')]=function(_0x51056a,_0x488a1a){return db['ServicenowAccount'][_0xb50e('0x49')]({'where':{'id':_0x51056a[_0xb50e('0x47')]['id']}})[_0xb50e('0x24')](handleEntityNotFound(_0x488a1a,null))[_0xb50e('0x24')](removeEntity(_0x488a1a,null))[_0xb50e('0x45')](handleError(_0x488a1a,null));};exports['getConfigurations']=function(_0x396ff2,_0x175b45,_0x41997b){var _0xb1424e={};var _0x225af8={};var _0x14e7d4;var _0x734397;return db[_0xb50e('0x2c')][_0xb50e('0x4d')]({'where':{'id':_0x396ff2[_0xb50e('0x47')]['id']}})[_0xb50e('0x24')](handleEntityNotFound(_0x175b45,null))[_0xb50e('0x24')](function(_0x4e2bb4){if(_0x4e2bb4){_0x14e7d4=_0x4e2bb4;_0x225af8['model']=_[_0xb50e('0x32')](db['ServicenowConfiguration'][_0xb50e('0x2d')]);_0x225af8['query']=_[_0xb50e('0x32')](_0x396ff2['query']);_0x225af8['filters']=_[_0xb50e('0x34')](_0x225af8[_0xb50e('0x35')],_0x225af8[_0xb50e('0x31')]);_0xb1424e[_0xb50e('0x36')]=_[_0xb50e('0x34')](_0x225af8[_0xb50e('0x35')],qs['fields'](_0x396ff2[_0xb50e('0x31')][_0xb50e('0x37')]));_0xb1424e['attributes']=_0xb1424e[_0xb50e('0x36')]['length']?_0xb1424e['attributes']:_0x225af8[_0xb50e('0x35')];_0xb1424e[_0xb50e('0x3b')]=qs['sort'](_0x396ff2[_0xb50e('0x31')][_0xb50e('0x3c')]);_0xb1424e[_0xb50e('0x3d')]=qs[_0xb50e('0x33')](_[_0xb50e('0x3e')](_0x396ff2[_0xb50e('0x31')],_0x225af8[_0xb50e('0x33')]));if(_0x396ff2[_0xb50e('0x31')][_0xb50e('0x3f')]){_0xb1424e[_0xb50e('0x3d')]=_[_0xb50e('0x40')](_0xb1424e['where'],{'$or':_['map'](_0xb1424e[_0xb50e('0x36')],function(_0x31d726){var _0x5011b1={};_0x5011b1[_0x31d726]={'$like':'%'+_0x396ff2[_0xb50e('0x31')][_0xb50e('0x3f')]+'%'};return _0x5011b1;})});}_0xb1424e=_['merge']({},_0xb1424e,_0x396ff2[_0xb50e('0x48')]);return _0x14e7d4[_0xb50e('0x4e')](_0xb1424e);}})[_0xb50e('0x24')](function(_0x2d4819){if(_0x2d4819){_0x734397=_0x2d4819['length'];if(!_0x396ff2[_0xb50e('0x31')][_0xb50e('0x39')](_0xb50e('0x3a'))){_0xb1424e[_0xb50e('0x1d')]=qs['limit'](_0x396ff2[_0xb50e('0x31')][_0xb50e('0x1d')]);_0xb1424e['offset']=qs[_0xb50e('0x1c')](_0x396ff2[_0xb50e('0x31')][_0xb50e('0x1c')]);}return _0x14e7d4[_0xb50e('0x4e')](_0xb1424e);}})[_0xb50e('0x24')](function(_0x2bc5fc){if(_0x2bc5fc){return _0x2bc5fc?{'count':_0x734397,'rows':_0x2bc5fc}:null;}})['then'](respondWithResult(_0x175b45,null))[_0xb50e('0x45')](handleError(_0x175b45,null));};exports[_0xb50e('0x4f')]=function(_0x288e53,_0x27f169,_0x35f1bb){if(_0x288e53[_0xb50e('0x4b')]['id']){delete _0x288e53[_0xb50e('0x4b')]['id'];}return db[_0xb50e('0x2c')]['findOne']({'where':{'id':_0x288e53['params']['id']}})[_0xb50e('0x24')](handleEntityNotFound(_0x27f169,null))[_0xb50e('0x24')](function(_0x2f6612){if(_0x2f6612){_0x288e53[_0xb50e('0x4b')][_0xb50e('0x50')]=_0x2f6612['id'];_0x288e53['body'][_0xb50e('0x51')]=integrations[_0xb50e('0x52')](_0x288e53[_0xb50e('0x4b')][_0xb50e('0x53')],_0x288e53['body'][_0xb50e('0x2f')]);_0x288e53[_0xb50e('0x4b')]['Descriptions']=integrations[_0xb50e('0x54')](_0x288e53['body'][_0xb50e('0x53')],_0x288e53[_0xb50e('0x4b')][_0xb50e('0x2f')]);return db['ServicenowConfiguration'][_0xb50e('0x4a')](_0x288e53['body'],{'include':[{'model':db[_0xb50e('0x55')],'as':'Subjects'},{'model':db[_0xb50e('0x55')],'as':_0xb50e('0x56')}]});}return null;})[_0xb50e('0x24')](respondWithResult(_0x27f169,null))[_0xb50e('0x45')](handleError(_0x27f169,null));};exports[_0xb50e('0x57')]=function(_0x34d653,_0x2b0eee,_0x12aeea){var _0x247f9d=[_0xb50e('0x58'),_0xb50e('0x59'),_0xb50e('0x5a'),_0xb50e('0x5b'),_0xb50e('0x5c'),_0xb50e('0x5d'),'incident_state','severity',_0xb50e('0x5e')];var _0x3b7b5e=['parent','made_sla','caused_by',_0xb50e('0x5f'),_0xb50e('0x60'),_0xb50e('0x61'),_0xb50e('0x62'),_0xb50e('0x59'),_0xb50e('0x63'),_0xb50e('0x64'),_0xb50e('0x65'),_0xb50e('0x66'),_0xb50e('0x67'),_0xb50e('0x68'),'sys_created_on',_0xb50e('0x69'),'state','sys_created_by',_0xb50e('0x5a'),_0xb50e('0x3b'),_0xb50e('0x6a'),_0xb50e('0x6b'),'cmdb_ci',_0xb50e('0x6c'),_0xb50e('0x6d'),'active','work_notes_list',_0xb50e('0x6e'),_0xb50e('0x6f'),_0xb50e('0x70'),_0xb50e('0x71'),_0xb50e('0x72'),'expected_start',_0xb50e('0x73'),_0xb50e('0x74'),_0xb50e('0x75'),_0xb50e('0x76'),_0xb50e('0x77'),_0xb50e('0x78'),_0xb50e('0x79'),_0xb50e('0x7a'),_0xb50e('0x5b'),_0xb50e('0x7b'),_0xb50e('0x7c'),_0xb50e('0x5c'),'correlation_display',_0xb50e('0x7d'),_0xb50e('0x7e'),_0xb50e('0x7f'),_0xb50e('0x80'),'additional_assignee_list',_0xb50e('0x81'),_0xb50e('0x82'),_0xb50e('0x5d'),_0xb50e('0x83'),'close_notes',_0xb50e('0x84'),_0xb50e('0x85'),'parent_incident',_0xb50e('0x86'),_0xb50e('0x87'),_0xb50e('0x88'),_0xb50e('0x89'),'urgency',_0xb50e('0x8a'),_0xb50e('0x8b'),_0xb50e('0x8c'),_0xb50e('0x8d'),_0xb50e('0x8e'),_0xb50e('0x8f'),'comments',_0xb50e('0x90'),_0xb50e('0x91'),_0xb50e('0x92'),_0xb50e('0x93'),_0xb50e('0x94'),'reopen_count',_0xb50e('0x95'),_0xb50e('0x96'),'upon_approval','correlation_id',_0xb50e('0x97'),_0xb50e('0x5e')];var _0x5bf559='';var _0x4ca7d6='';var _0x290ea3=[];var _0x14e971='';var _0x154d86='';var _0x158126=[];var _0x3a6aef='';var _0x384da2='';var _0x3626be={};var _0x52ebeb='';return db[_0xb50e('0x2c')][_0xb50e('0x4d')]({'where':{'id':_0x34d653['params']['id']},'attributes':['id',_0xb50e('0x98'),_0xb50e('0x99'),_0xb50e('0x9a'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x2b0eee,null))[_0xb50e('0x24')](function(_0x19a0a8){if(_0x19a0a8){_0x52ebeb=_0x19a0a8['remoteUri'];var _0x274caa=_0x52ebeb[_0xb50e('0x9b')](-0x1);if(_0x274caa==='/'){_0x52ebeb=_0x52ebeb[_0xb50e('0x9c')](0x0,_0x52ebeb[_0xb50e('0x9d')](_0x274caa));}_0x384da2=util[_0xb50e('0x9e')](_0xb50e('0x9f'),_0x52ebeb);_0x3a6aef=util['format'](_0xb50e('0xa0'),_0x52ebeb);_0x3626be={'user':_0x19a0a8[_0xb50e('0x98')],'pass':_0x19a0a8['password']};var _0x5ac45c={'method':'GET','uri':_0x384da2+_0xb50e('0xa1'),'auth':_0x3626be,'json':!![]};return rp(_0x5ac45c);}})[_0xb50e('0x24')](function(_0x4c8556){if(_0x4c8556[_0xb50e('0xa2')]['length']>0x0){_0x5bf559=_0x4c8556[_0xb50e('0xa2')];}console[_0xb50e('0xa3')](_0xb50e('0xa4'),_0x5bf559);_0x158126=[];_0x4ca7d6=Object['assign']([],_0x5bf559);_[_0xb50e('0xa5')](_0x4ca7d6,function(_0x10c549){return!_0x247f9d[_0xb50e('0xa6')](_0x10c549[_0xb50e('0x28')]);});_0x4ca7d6[_0xb50e('0xa7')](function(_0x271f65){var _0x42071c=createFieldObject(_0x3a6aef,_0x3626be,_0x271f65['internalType'],_0x271f65[_0xb50e('0x28')],_0x271f65[_0xb50e('0xa8')],![]);_0x158126['push'](_0x42071c);});return Promise[_0xb50e('0xa9')](_0x158126);})[_0xb50e('0x24')](function(_0x3ab485){_0x290ea3=_0x3ab485;_0x14e971=Object[_0xb50e('0xaa')]([],_0x5bf559);console[_0xb50e('0xa3')]('TCL:\x20_object',_0x5bf559);_[_0xb50e('0xa5')](_0x14e971,function(_0x3db6c1){return _0x3b7b5e[_0xb50e('0xa6')](_0x3db6c1[_0xb50e('0x28')]);});console[_0xb50e('0xa3')](_0xb50e('0xab'),_0x14e971);_0x158126=[];_0x14e971[_0xb50e('0xa7')](function(_0x5c167e){var _0x200b1b=createFieldObject(_0x3a6aef,_0x3626be,_0x5c167e[_0xb50e('0xac')],_0x5c167e[_0xb50e('0x28')],_0x5c167e[_0xb50e('0xa8')],!![]);_0x158126['push'](_0x200b1b);});return Promise['all'](_0x158126);})[_0xb50e('0x24')](function(_0x4f90c9){_0x154d86=_0x4f90c9;var _0x14e923=_0x290ea3['concat'](_0x154d86);return{'count':_0x14e923[_0xb50e('0x38')],'rows':_0x14e923};})['then'](respondWithResult(_0x2b0eee,null))[_0xb50e('0x45')](function(_0x47ef1f){console[_0xb50e('0xa3')](_0xb50e('0xad')+_0x47ef1f);var _0x19ca79=_0x34d653['query']['test']?0x1f4:_0x47ef1f[_0xb50e('0xae')]||0x1f4;logger['error'](_0x47ef1f['stack']);delete _0x47ef1f[_0xb50e('0x28')];if(_0x19ca79===0x191){_0x19ca79=0x190;}_0x2b0eee[_0xb50e('0x1b')](_0x19ca79)[_0xb50e('0x29')](_0x34d653[_0xb50e('0x31')][_0xb50e('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x47ef1f['statusCode']}:_0x47ef1f);});};function createFieldObject(_0x4b829b,_0x385303,_0x154493,_0x4604a8,_0x163de8,_0x40374c){return new Promise(function(_0x113a16,_0x2c23ee){var _0x164028={'id':_0x4604a8,'name':_0x163de8,'custom':_0x40374c};if(_0x154493==='boolean'){_0x164028['options']=[{'name':_0xb50e('0xb0'),'value':_0xb50e('0xb1')},{'name':'False','value':_0xb50e('0xb2')}];_0x113a16(_0x164028);}else{var _0x299f78={'method':_0xb50e('0xb3'),'uri':_0x4b829b+_0xb50e('0xb4')+_0x4604a8,'auth':_0x385303,'json':!![]};return rp(_0x299f78)[_0xb50e('0x24')](function(_0x5a42b9){var _0x643d12=[];if(_0x5a42b9[_0xb50e('0xa2')][_0xb50e('0x38')]>0x0){_0x5a42b9[_0xb50e('0xa2')]['forEach'](function(_0x1605fa){if(_0x1605fa['inactive']===_0xb50e('0xb2')){var _0x3fc629={'name':_0x1605fa[_0xb50e('0xa8')],'value':_0x1605fa[_0xb50e('0xb5')]};_0x643d12[_0xb50e('0xb6')](_0x3fc629);}});}_0x164028['options']=_0x643d12;if(_0x164028[_0xb50e('0x48')]['length']>0x0){_0x113a16(_0x164028);}else{if(_0x40374c==![]){_0x113a16();}else{_0x113a16(_0x164028);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f987cb2..59f0015 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x27aa6e,_0x321e92){var _0x5d8621=function(_0x342f1a){while(--_0x342f1a){_0x27aa6e['push'](_0x27aa6e['shift']());}};_0x5d8621(++_0x321e92);}(_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 logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x42b184,_0x2b2910){var _0x5b7f10=function(_0x56121e){while(--_0x56121e){_0x42b184['push'](_0x42b184['shift']());}};_0x5b7f10(++_0x2b2910);}(_0xdc97,0x13b));var _0x7dc9=function(_0x14a41b,_0x55efb5){_0x14a41b=_0x14a41b-0x0;var _0x14db66=_0xdc97[_0x14a41b];return _0x14db66;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 6c4bad9..28498d1 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 _0x2982=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','map','model','attributes','ShowServicenowAccount','find','raw','stringify','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2982,0x102));var _0x2298=function(_0x5cbf66,_0x37c600){_0x5cbf66=_0x5cbf66-0x0;var _0x3c6861=_0x2982[_0x5cbf66];return _0x3c6861;};'use strict';var _=require('lodash');var util=require(_0x2298('0x0'));var moment=require(_0x2298('0x1'));var BPromise=require(_0x2298('0x2'));var rs=require(_0x2298('0x3'));var fs=require('fs');var Redis=require(_0x2298('0x4'));var db=require(_0x2298('0x5'))['db'];var utils=require(_0x2298('0x6'));var logger=require(_0x2298('0x7'))(_0x2298('0x8'));var config=require(_0x2298('0x9'));var jayson=require(_0x2298('0xa'));var client=jayson[_0x2298('0xb')][_0x2298('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe6b4,_0x410896,_0x43df79){return new BPromise(function(_0xf356,_0x5e2f4c){return client['request'](_0x4fe6b4,_0x43df79)[_0x2298('0xd')](function(_0xf87191){logger[_0x2298('0xe')](_0x2298('0xf'),_0x410896,_0x2298('0x10'));logger[_0x2298('0x11')](_0x2298('0x12'),_0x410896,_0x2298('0x10'),JSON['stringify'](_0xf87191));if(_0xf87191[_0x2298('0x13')]){if(_0xf87191['error'][_0x2298('0x14')]===0x1f4){logger[_0x2298('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x410896,_0xf87191[_0x2298('0x13')][_0x2298('0x15')]);return _0x5e2f4c(_0xf87191[_0x2298('0x13')][_0x2298('0x15')]);}logger['error'](_0x2298('0xf'),_0x410896,_0xf87191[_0x2298('0x13')][_0x2298('0x15')]);return _0xf356(_0xf87191['error'][_0x2298('0x15')]);}else{logger['info'](_0x2298('0xf'),_0x410896,_0x2298('0x10'));_0xf356(_0xf87191['result'][_0x2298('0x15')]);}})[_0x2298('0x16')](function(_0x62c94b){logger['error'](_0x2298('0xf'),_0x410896,_0x62c94b);_0x5e2f4c(_0x62c94b);});});}exports[_0x2298('0x17')]=function(_0x195127){var _0x9680dd=this;return new Promise(function(_0x3c2417,_0x2e7d52){return db[_0x2298('0x18')][_0x2298('0x19')]({'raw':_0x195127[_0x2298('0x1a')]?_0x195127['options']['raw']===undefined?!![]:![]:!![],'where':_0x195127[_0x2298('0x1a')]?_0x195127[_0x2298('0x1a')][_0x2298('0x1b')]||null:null,'attributes':_0x195127[_0x2298('0x1a')]?_0x195127[_0x2298('0x1a')]['attributes']||null:null,'limit':_0x195127['options']?_0x195127[_0x2298('0x1a')][_0x2298('0x1c')]||null:null,'include':_0x195127[_0x2298('0x1a')]?_0x195127[_0x2298('0x1a')][_0x2298('0x1d')]?_[_0x2298('0x1e')](_0x195127[_0x2298('0x1a')]['include'],function(_0x1b3ae2){return{'model':db[_0x1b3ae2['model']],'as':_0x1b3ae2['as'],'attributes':_0x1b3ae2['attributes'],'include':_0x1b3ae2[_0x2298('0x1d')]?_[_0x2298('0x1e')](_0x1b3ae2[_0x2298('0x1d')],function(_0x5b0310){return{'model':db[_0x5b0310[_0x2298('0x1f')]],'as':_0x5b0310['as'],'attributes':_0x5b0310['attributes'],'include':_0x5b0310[_0x2298('0x1d')]?_[_0x2298('0x1e')](_0x5b0310[_0x2298('0x1d')],function(_0x279014){return{'model':db[_0x279014[_0x2298('0x1f')]],'as':_0x279014['as'],'attributes':_0x279014[_0x2298('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2298('0xd')](function(_0xc15ecd){logger[_0x2298('0xe')](_0x2298('0x17'),_0x195127);logger[_0x2298('0x11')](_0x2298('0x17'),_0x195127,JSON['stringify'](_0xc15ecd));_0x3c2417(_0xc15ecd);})[_0x2298('0x16')](function(_0x1dde3c){logger[_0x2298('0x13')]('GetServicenowAccount',_0x1dde3c['message'],_0x195127);_0x2e7d52(_0x9680dd[_0x2298('0x13')](0x1f4,_0x1dde3c[_0x2298('0x15')]));});});};exports[_0x2298('0x21')]=function(_0x507971){var _0x260f6b=this;return new Promise(function(_0x396d1f,_0x1b109e){return db['ServicenowAccount'][_0x2298('0x22')]({'raw':_0x507971[_0x2298('0x1a')]?_0x507971[_0x2298('0x1a')][_0x2298('0x23')]===undefined?!![]:![]:!![],'where':_0x507971[_0x2298('0x1a')]?_0x507971[_0x2298('0x1a')][_0x2298('0x1b')]||null:null,'attributes':_0x507971[_0x2298('0x1a')]?_0x507971['options'][_0x2298('0x20')]||null:null,'include':_0x507971['options']?_0x507971[_0x2298('0x1a')][_0x2298('0x1d')]?_[_0x2298('0x1e')](_0x507971[_0x2298('0x1a')]['include'],function(_0x4971f6){return{'model':db[_0x4971f6[_0x2298('0x1f')]],'as':_0x4971f6['as'],'attributes':_0x4971f6[_0x2298('0x20')],'include':_0x4971f6[_0x2298('0x1d')]?_['map'](_0x4971f6[_0x2298('0x1d')],function(_0x50babc){return{'model':db[_0x50babc[_0x2298('0x1f')]],'as':_0x50babc['as'],'attributes':_0x50babc[_0x2298('0x20')],'include':_0x50babc[_0x2298('0x1d')]?_[_0x2298('0x1e')](_0x50babc[_0x2298('0x1d')],function(_0x12dad0){return{'model':db[_0x12dad0['model']],'as':_0x12dad0['as'],'attributes':_0x12dad0['attributes']};}):[]};}):[]};}):[]:[]})[_0x2298('0xd')](function(_0x5f585d){logger['info'](_0x2298('0x21'),_0x507971);logger[_0x2298('0x11')](_0x2298('0x21'),_0x507971,JSON[_0x2298('0x24')](_0x5f585d));_0x396d1f(_0x5f585d);})[_0x2298('0x16')](function(_0x557370){logger['error'](_0x2298('0x21'),_0x557370['message'],_0x507971);_0x1b109e(_0x260f6b[_0x2298('0x13')](0x1f4,_0x557370['message']));});});}; \ No newline at end of file +var _0x179d=['raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','then','GetServicenowAccount','debug','find'];(function(_0x7748be,_0x336c5c){var _0x15b684=function(_0x2f674f){while(--_0x2f674f){_0x7748be['push'](_0x7748be['shift']());}};_0x15b684(++_0x336c5c);}(_0x179d,0xe0));var _0xd179=function(_0x57d16f,_0x1a2754){_0x57d16f=_0x57d16f-0x0;var _0x32552b=_0x179d[_0x57d16f];return _0x32552b;};'use strict';var _=require(_0xd179('0x0'));var util=require(_0xd179('0x1'));var moment=require(_0xd179('0x2'));var BPromise=require(_0xd179('0x3'));var rs=require(_0xd179('0x4'));var fs=require('fs');var Redis=require(_0xd179('0x5'));var db=require(_0xd179('0x6'))['db'];var utils=require(_0xd179('0x7'));var logger=require('../../config/logger')(_0xd179('0x8'));var config=require(_0xd179('0x9'));var jayson=require(_0xd179('0xa'));var client=jayson[_0xd179('0xb')][_0xd179('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e38d6,_0x1ba307,_0x1a4540){return new BPromise(function(_0x27b400,_0x2ae5e7){return client[_0xd179('0xd')](_0x3e38d6,_0x1a4540)['then'](function(_0x384874){logger['info'](_0xd179('0xe'),_0x1ba307,_0xd179('0xf'));logger['debug'](_0xd179('0x10'),_0x1ba307,_0xd179('0xf'),JSON[_0xd179('0x11')](_0x384874));if(_0x384874['error']){if(_0x384874[_0xd179('0x12')][_0xd179('0x13')]===0x1f4){logger[_0xd179('0x12')](_0xd179('0xe'),_0x1ba307,_0x384874[_0xd179('0x12')]['message']);return _0x2ae5e7(_0x384874[_0xd179('0x12')][_0xd179('0x14')]);}logger[_0xd179('0x12')](_0xd179('0xe'),_0x1ba307,_0x384874[_0xd179('0x12')][_0xd179('0x14')]);return _0x27b400(_0x384874['error'][_0xd179('0x14')]);}else{logger['info'](_0xd179('0xe'),_0x1ba307,'request\x20sent');_0x27b400(_0x384874['result'][_0xd179('0x14')]);}})[_0xd179('0x15')](function(_0x4ad561){logger[_0xd179('0x12')](_0xd179('0xe'),_0x1ba307,_0x4ad561);_0x2ae5e7(_0x4ad561);});});}exports['GetServicenowAccount']=function(_0x44a78b){var _0x130882=this;return new Promise(function(_0x3d17e1,_0x4c9d99){return db[_0xd179('0x16')][_0xd179('0x17')]({'raw':_0x44a78b[_0xd179('0x18')]?_0x44a78b['options']['raw']===undefined?!![]:![]:!![],'where':_0x44a78b[_0xd179('0x18')]?_0x44a78b[_0xd179('0x18')][_0xd179('0x19')]||null:null,'attributes':_0x44a78b['options']?_0x44a78b[_0xd179('0x18')][_0xd179('0x1a')]||null:null,'limit':_0x44a78b[_0xd179('0x18')]?_0x44a78b[_0xd179('0x18')][_0xd179('0x1b')]||null:null,'include':_0x44a78b[_0xd179('0x18')]?_0x44a78b[_0xd179('0x18')][_0xd179('0x1c')]?_[_0xd179('0x1d')](_0x44a78b['options'][_0xd179('0x1c')],function(_0x502a99){return{'model':db[_0x502a99[_0xd179('0x1e')]],'as':_0x502a99['as'],'attributes':_0x502a99[_0xd179('0x1a')],'include':_0x502a99[_0xd179('0x1c')]?_[_0xd179('0x1d')](_0x502a99[_0xd179('0x1c')],function(_0x515a6e){return{'model':db[_0x515a6e[_0xd179('0x1e')]],'as':_0x515a6e['as'],'attributes':_0x515a6e[_0xd179('0x1a')],'include':_0x515a6e[_0xd179('0x1c')]?_['map'](_0x515a6e[_0xd179('0x1c')],function(_0x98d598){return{'model':db[_0x98d598[_0xd179('0x1e')]],'as':_0x98d598['as'],'attributes':_0x98d598[_0xd179('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd179('0x1f')](function(_0x280192){logger['info'](_0xd179('0x20'),_0x44a78b);logger[_0xd179('0x21')](_0xd179('0x20'),_0x44a78b,JSON['stringify'](_0x280192));_0x3d17e1(_0x280192);})[_0xd179('0x15')](function(_0x5af4d1){logger[_0xd179('0x12')](_0xd179('0x20'),_0x5af4d1[_0xd179('0x14')],_0x44a78b);_0x4c9d99(_0x130882[_0xd179('0x12')](0x1f4,_0x5af4d1[_0xd179('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x3f96c9){var _0x4ff56c=this;return new Promise(function(_0x352776,_0x27db9c){return db[_0xd179('0x16')][_0xd179('0x22')]({'raw':_0x3f96c9[_0xd179('0x18')]?_0x3f96c9[_0xd179('0x18')][_0xd179('0x23')]===undefined?!![]:![]:!![],'where':_0x3f96c9['options']?_0x3f96c9[_0xd179('0x18')]['where']||null:null,'attributes':_0x3f96c9['options']?_0x3f96c9[_0xd179('0x18')][_0xd179('0x1a')]||null:null,'include':_0x3f96c9[_0xd179('0x18')]?_0x3f96c9[_0xd179('0x18')]['include']?_['map'](_0x3f96c9['options']['include'],function(_0x1f2f40){return{'model':db[_0x1f2f40[_0xd179('0x1e')]],'as':_0x1f2f40['as'],'attributes':_0x1f2f40[_0xd179('0x1a')],'include':_0x1f2f40[_0xd179('0x1c')]?_['map'](_0x1f2f40['include'],function(_0x1b8d24){return{'model':db[_0x1b8d24[_0xd179('0x1e')]],'as':_0x1b8d24['as'],'attributes':_0x1b8d24[_0xd179('0x1a')],'include':_0x1b8d24['include']?_[_0xd179('0x1d')](_0x1b8d24['include'],function(_0x3d2e1c){return{'model':db[_0x3d2e1c['model']],'as':_0x3d2e1c['as'],'attributes':_0x3d2e1c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x186df0){logger['info']('ShowServicenowAccount',_0x3f96c9);logger['debug'](_0xd179('0x24'),_0x3f96c9,JSON[_0xd179('0x11')](_0x186df0));_0x352776(_0x186df0);})[_0xd179('0x15')](function(_0x294cce){logger['error'](_0xd179('0x24'),_0x294cce[_0xd179('0x14')],_0x3f96c9);_0x27db9c(_0x4ff56c[_0xd179('0x12')](0x1f4,_0x294cce[_0xd179('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e92be1b..22561c9 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 _0xaa35=['create','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0xbcb6b4,_0x58980d){var _0x16a505=function(_0x4e1c88){while(--_0x4e1c88){_0xbcb6b4['push'](_0xbcb6b4['shift']());}};_0x16a505(++_0x58980d);}(_0xaa35,0x13f));var _0x5aa3=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0xaa35[_0xa4c85];return _0x172c1f;};'use strict';var multer=require('multer');var util=require(_0x5aa3('0x0'));var path=require(_0x5aa3('0x1'));var timeout=require(_0x5aa3('0x2'));var express=require('express');var router=express[_0x5aa3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5aa3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5aa3('0x5'));var controller=require(_0x5aa3('0x6'));router[_0x5aa3('0x7')]('/',auth[_0x5aa3('0x8')](),controller['index']);router['get'](_0x5aa3('0x9'),auth[_0x5aa3('0x8')](),controller[_0x5aa3('0xa')]);router['get'](_0x5aa3('0xb'),auth[_0x5aa3('0x8')](),controller['getFields']);router['get'](_0x5aa3('0xc'),auth['isAuthenticated'](),controller[_0x5aa3('0xd')]);router[_0x5aa3('0x7')](_0x5aa3('0xe'),auth[_0x5aa3('0x8')](),controller[_0x5aa3('0xf')]);router[_0x5aa3('0x10')]('/',auth[_0x5aa3('0x8')](),controller[_0x5aa3('0x11')]);router['put'](_0x5aa3('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5aa3('0x12')]('/:id',auth[_0x5aa3('0x8')](),controller[_0x5aa3('0x13')]);module[_0x5aa3('0x14')]=router; \ No newline at end of file +var _0xb73f=['../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','multer','path','express','Router','fs-extra'];(function(_0x38dcad,_0x16a9af){var _0x140e55=function(_0xe580a7){while(--_0xe580a7){_0x38dcad['push'](_0x38dcad['shift']());}};_0x140e55(++_0x16a9af);}(_0xb73f,0x1c9));var _0xfb73=function(_0x1f2c15,_0x202189){_0x1f2c15=_0x1f2c15-0x0;var _0x16a8bf=_0xb73f[_0x1f2c15];return _0x16a8bf;};'use strict';var multer=require(_0xfb73('0x0'));var util=require('util');var path=require(_0xfb73('0x1'));var timeout=require('connect-timeout');var express=require(_0xfb73('0x2'));var router=express[_0xfb73('0x3')]();var fs_extra=require(_0xfb73('0x4'));var auth=require(_0xfb73('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfb73('0x6'));var controller=require(_0xfb73('0x7'));router[_0xfb73('0x8')]('/',auth[_0xfb73('0x9')](),controller[_0xfb73('0xa')]);router[_0xfb73('0x8')](_0xfb73('0xb'),auth[_0xfb73('0x9')](),controller[_0xfb73('0xc')]);router['get'](_0xfb73('0xd'),auth['isAuthenticated'](),controller[_0xfb73('0xe')]);router[_0xfb73('0x8')](_0xfb73('0xf'),auth[_0xfb73('0x9')](),controller[_0xfb73('0x10')]);router[_0xfb73('0x8')]('/:id/descriptions',auth[_0xfb73('0x9')](),controller[_0xfb73('0x11')]);router['post']('/',auth[_0xfb73('0x9')](),controller[_0xfb73('0x12')]);router[_0xfb73('0x13')](_0xfb73('0xb'),auth[_0xfb73('0x9')](),controller[_0xfb73('0x14')]);router['delete']('/:id',auth[_0xfb73('0x9')](),controller[_0xfb73('0x15')]);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 b0e36b3..afd9c57 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 _0xabd1=['exports','STRING','sequelize'];(function(_0x13399d,_0x40e456){var _0x100818=function(_0x4e59bb){while(--_0x4e59bb){_0x13399d['push'](_0x13399d['shift']());}};_0x100818(++_0x40e456);}(_0xabd1,0x1e2));var _0x1abd=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xabd1[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0x1abd('0x0'));module[_0x1abd('0x1')]={'name':{'type':Sequelize[_0x1abd('0x2')]},'description':{'type':Sequelize[_0x1abd('0x2')]}}; \ No newline at end of file +var _0xde3e=['STRING','sequelize'];(function(_0xf1f2e0,_0x37c415){var _0x991373=function(_0x5baf7f){while(--_0x5baf7f){_0xf1f2e0['push'](_0xf1f2e0['shift']());}};_0x991373(++_0x37c415);}(_0xde3e,0x17f));var _0xede3=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xde3e[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0xede3('0x0'));module['exports']={'name':{'type':Sequelize[_0xede3('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 a1938b6..d4830ba 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 _0xca85=['moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','show','params','includeAll','merge','find','create','body','findOne','ServicenowField','pick','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch'];(function(_0x188c59,_0x1e64a8){var _0x25caba=function(_0x5f420f){while(--_0x5f420f){_0x188c59['push'](_0x188c59['shift']());}};_0x25caba(++_0x1e64a8);}(_0xca85,0x95));var _0x5ca8=function(_0x7373f4,_0x1b3715){_0x7373f4=_0x7373f4-0x0;var _0xa2dc37=_0xca85[_0x7373f4];return _0xa2dc37;};'use strict';var emlformat=require(_0x5ca8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ca8('0x1'));var jsonpatch=require(_0x5ca8('0x2'));var rp=require('request-promise');var moment=require(_0x5ca8('0x3'));var BPromise=require(_0x5ca8('0x4'));var Mustache=require('mustache');var util=require(_0x5ca8('0x5'));var path=require(_0x5ca8('0x6'));var sox=require(_0x5ca8('0x7'));var csv=require(_0x5ca8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ca8('0x9'));var _=require(_0x5ca8('0xa'));var squel=require(_0x5ca8('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ca8('0xc'));var deskjs=require(_0x5ca8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5ca8('0xe'));var Papa=require('papaparse');var Redis=require(_0x5ca8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ca8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ca8('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5ca8('0x12'));var licenseUtil=require(_0x5ca8('0x13'));var db=require(_0x5ca8('0x14'))['db'];function respondWithStatusCode(_0x2a9774,_0x280b2f){_0x280b2f=_0x280b2f||0xcc;return function(_0x160c8c){if(_0x160c8c){return _0x2a9774['sendStatus'](_0x280b2f);}return _0x2a9774[_0x5ca8('0x15')](_0x280b2f)['end']();};}function respondWithResult(_0x2d9707,_0x48a55b){_0x48a55b=_0x48a55b||0xc8;return function(_0x201ff4){if(_0x201ff4){return _0x2d9707[_0x5ca8('0x15')](_0x48a55b)[_0x5ca8('0x16')](_0x201ff4);}};}function respondWithFilteredResult(_0x1d0413,_0x2cc5f5){return function(_0x36e003){if(_0x36e003){var _0x4dea09=typeof _0x2cc5f5['offset']===_0x5ca8('0x17')&&typeof _0x2cc5f5[_0x5ca8('0x18')]===_0x5ca8('0x17');var _0x27c025=_0x36e003[_0x5ca8('0x19')];var _0x283374=_0x4dea09?0x0:_0x2cc5f5['offset'];var _0x1002fe=_0x4dea09?_0x36e003[_0x5ca8('0x19')]:_0x2cc5f5['offset']+_0x2cc5f5[_0x5ca8('0x18')];var _0x2a1596;if(_0x1002fe>=_0x27c025){_0x1002fe=_0x27c025;_0x2a1596=0xc8;}else{_0x2a1596=0xce;}_0x1d0413[_0x5ca8('0x15')](_0x2a1596);return _0x1d0413[_0x5ca8('0x1a')](_0x5ca8('0x1b'),_0x283374+'-'+_0x1002fe+'/'+_0x27c025)[_0x5ca8('0x16')](_0x36e003);}return null;};}function patchUpdates(_0x30314d){return function(_0x504178){try{jsonpatch[_0x5ca8('0x1c')](_0x504178,_0x30314d,!![]);}catch(_0x51e0cf){return BPromise[_0x5ca8('0x1d')](_0x51e0cf);}return _0x504178['save']();};}function saveUpdates(_0x268080,_0x386cfa){return function(_0x16c4d3){if(_0x16c4d3){return _0x16c4d3[_0x5ca8('0x1e')](_0x268080)[_0x5ca8('0x1f')](function(_0x3a2574){return _0x3a2574;});}return null;};}function removeEntity(_0x538e58,_0x46a971){return function(_0x5d2c09){if(_0x5d2c09){return _0x5d2c09[_0x5ca8('0x20')]()[_0x5ca8('0x1f')](function(){_0x538e58[_0x5ca8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4afd81,_0x42e342){return function(_0x551e46){if(!_0x551e46){_0x4afd81['sendStatus'](0x194);}return _0x551e46;};}function handleError(_0x4ddc63,_0x4e56ad){_0x4e56ad=_0x4e56ad||0x1f4;return function(_0xb1b542){logger[_0x5ca8('0x21')](_0xb1b542['stack']);if(_0xb1b542[_0x5ca8('0x22')]){delete _0xb1b542['name'];}_0x4ddc63['status'](_0x4e56ad)[_0x5ca8('0x23')](_0xb1b542);};}exports[_0x5ca8('0x24')]=function(_0x5def92,_0x3ecd83){var _0x48bfa9={},_0x1e5b0c={},_0xab9eb6={'count':0x0,'rows':[]};var _0x1229f5=_['map'](db[_0x5ca8('0x25')][_0x5ca8('0x26')],function(_0x2fb71a){return{'name':_0x2fb71a[_0x5ca8('0x27')],'type':_0x2fb71a[_0x5ca8('0x28')][_0x5ca8('0x29')]};});_0x1e5b0c[_0x5ca8('0x2a')]=_[_0x5ca8('0x2b')](_0x1229f5,_0x5ca8('0x22'));_0x1e5b0c[_0x5ca8('0x2c')]=_[_0x5ca8('0x2d')](_0x5def92[_0x5ca8('0x2c')]);_0x1e5b0c[_0x5ca8('0x2e')]=_[_0x5ca8('0x2f')](_0x1e5b0c['model'],_0x1e5b0c[_0x5ca8('0x2c')]);_0x48bfa9['attributes']=_[_0x5ca8('0x2f')](_0x1e5b0c[_0x5ca8('0x2a')],qs[_0x5ca8('0x30')](_0x5def92[_0x5ca8('0x2c')][_0x5ca8('0x30')]));_0x48bfa9[_0x5ca8('0x31')]=_0x48bfa9[_0x5ca8('0x31')][_0x5ca8('0x32')]?_0x48bfa9[_0x5ca8('0x31')]:_0x1e5b0c[_0x5ca8('0x2a')];if(!_0x5def92[_0x5ca8('0x2c')][_0x5ca8('0x33')](_0x5ca8('0x34'))){_0x48bfa9[_0x5ca8('0x18')]=qs[_0x5ca8('0x18')](_0x5def92[_0x5ca8('0x2c')][_0x5ca8('0x18')]);_0x48bfa9[_0x5ca8('0x35')]=qs['offset'](_0x5def92[_0x5ca8('0x2c')][_0x5ca8('0x35')]);}_0x48bfa9[_0x5ca8('0x36')]=qs[_0x5ca8('0x37')](_0x5def92['query'][_0x5ca8('0x37')]);_0x48bfa9[_0x5ca8('0x38')]=qs[_0x5ca8('0x2e')](_['pick'](_0x5def92[_0x5ca8('0x2c')],_0x1e5b0c[_0x5ca8('0x2e')]),_0x1229f5);if(_0x5def92[_0x5ca8('0x2c')][_0x5ca8('0x39')]){_0x48bfa9[_0x5ca8('0x38')]=_['merge'](_0x48bfa9[_0x5ca8('0x38')],{'$or':_[_0x5ca8('0x2b')](_0x1229f5,function(_0x5eaf95){if(_0x5eaf95[_0x5ca8('0x28')]!==_0x5ca8('0x3a')){var _0x1fd898={};_0x1fd898[_0x5eaf95[_0x5ca8('0x22')]]={'$like':'%'+_0x5def92['query'][_0x5ca8('0x39')]+'%'};return _0x1fd898;}})});}_0x48bfa9=_['merge']({},_0x48bfa9,_0x5def92[_0x5ca8('0x3b')]);var _0x291982={'where':_0x48bfa9[_0x5ca8('0x38')]};return db[_0x5ca8('0x25')]['count'](_0x291982)[_0x5ca8('0x1f')](function(_0x47c6ad){_0xab9eb6[_0x5ca8('0x19')]=_0x47c6ad;if(_0x5def92[_0x5ca8('0x2c')]['includeAll']){_0x48bfa9[_0x5ca8('0x3c')]=[{'all':!![]}];}return db[_0x5ca8('0x25')][_0x5ca8('0x3d')](_0x48bfa9);})['then'](function(_0x4832cb){_0xab9eb6['rows']=_0x4832cb;return _0xab9eb6;})[_0x5ca8('0x1f')](respondWithFilteredResult(_0x3ecd83,_0x48bfa9))[_0x5ca8('0x3e')](handleError(_0x3ecd83,null));};exports[_0x5ca8('0x3f')]=function(_0x50f5e5,_0x2cf3d5){var _0x4aceb5={'raw':![],'where':{'id':_0x50f5e5[_0x5ca8('0x40')]['id']}},_0x3ec944={};_0x3ec944[_0x5ca8('0x2a')]=_[_0x5ca8('0x2d')](db[_0x5ca8('0x25')][_0x5ca8('0x26')]);_0x3ec944[_0x5ca8('0x2c')]=_['keys'](_0x50f5e5[_0x5ca8('0x2c')]);_0x3ec944[_0x5ca8('0x2e')]=_[_0x5ca8('0x2f')](_0x3ec944[_0x5ca8('0x2a')],_0x3ec944[_0x5ca8('0x2c')]);_0x4aceb5['attributes']=_[_0x5ca8('0x2f')](_0x3ec944[_0x5ca8('0x2a')],qs[_0x5ca8('0x30')](_0x50f5e5[_0x5ca8('0x2c')][_0x5ca8('0x30')]));_0x4aceb5[_0x5ca8('0x31')]=_0x4aceb5['attributes'][_0x5ca8('0x32')]?_0x4aceb5['attributes']:_0x3ec944[_0x5ca8('0x2a')];if(_0x50f5e5[_0x5ca8('0x2c')][_0x5ca8('0x41')]){_0x4aceb5[_0x5ca8('0x3c')]=[{'all':!![]}];}_0x4aceb5=_[_0x5ca8('0x42')]({},_0x4aceb5,_0x50f5e5[_0x5ca8('0x3b')]);return db[_0x5ca8('0x25')][_0x5ca8('0x43')](_0x4aceb5)[_0x5ca8('0x1f')](handleEntityNotFound(_0x2cf3d5,null))[_0x5ca8('0x1f')](respondWithResult(_0x2cf3d5,null))[_0x5ca8('0x3e')](handleError(_0x2cf3d5,null));};exports[_0x5ca8('0x44')]=function(_0x5935f0,_0x3679d2){return db['ServicenowConfiguration'][_0x5ca8('0x44')](_0x5935f0[_0x5ca8('0x45')],{})[_0x5ca8('0x1f')](respondWithResult(_0x3679d2,0xc9))[_0x5ca8('0x3e')](handleError(_0x3679d2,null));};exports['update']=function(_0x531980,_0x5e6d6a){if(_0x531980[_0x5ca8('0x45')]['id']){delete _0x531980[_0x5ca8('0x45')]['id'];}return db[_0x5ca8('0x25')][_0x5ca8('0x43')]({'where':{'id':_0x531980[_0x5ca8('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e6d6a,null))[_0x5ca8('0x1f')](saveUpdates(_0x531980['body'],null))[_0x5ca8('0x1f')](respondWithResult(_0x5e6d6a,null))[_0x5ca8('0x3e')](handleError(_0x5e6d6a,null));};exports[_0x5ca8('0x20')]=function(_0x102893,_0x424747){return db[_0x5ca8('0x25')][_0x5ca8('0x43')]({'where':{'id':_0x102893[_0x5ca8('0x40')]['id']}})[_0x5ca8('0x1f')](handleEntityNotFound(_0x424747,null))['then'](removeEntity(_0x424747,null))[_0x5ca8('0x3e')](handleError(_0x424747,null));};exports['getFields']=function(_0x533aca,_0x336c74,_0x538ad4){var _0x38c45f={};var _0x5d5283={};var _0x16649d;var _0x3ce49e;return db[_0x5ca8('0x25')][_0x5ca8('0x46')]({'where':{'id':_0x533aca[_0x5ca8('0x40')]['id']}})[_0x5ca8('0x1f')](handleEntityNotFound(_0x336c74,null))[_0x5ca8('0x1f')](function(_0x5ac573){if(_0x5ac573){_0x16649d=_0x5ac573;_0x5d5283[_0x5ca8('0x2a')]=_[_0x5ca8('0x2d')](db[_0x5ca8('0x47')][_0x5ca8('0x26')]);_0x5d5283[_0x5ca8('0x2c')]=_[_0x5ca8('0x2d')](_0x533aca['query']);_0x5d5283[_0x5ca8('0x2e')]=_[_0x5ca8('0x2f')](_0x5d5283[_0x5ca8('0x2a')],_0x5d5283['query']);_0x38c45f[_0x5ca8('0x31')]=_[_0x5ca8('0x2f')](_0x5d5283[_0x5ca8('0x2a')],qs[_0x5ca8('0x30')](_0x533aca[_0x5ca8('0x2c')][_0x5ca8('0x30')]));_0x38c45f[_0x5ca8('0x31')]=_0x38c45f[_0x5ca8('0x31')]['length']?_0x38c45f['attributes']:_0x5d5283[_0x5ca8('0x2a')];_0x38c45f[_0x5ca8('0x36')]=qs[_0x5ca8('0x37')](_0x533aca['query'][_0x5ca8('0x37')]);_0x38c45f[_0x5ca8('0x38')]=qs[_0x5ca8('0x2e')](_[_0x5ca8('0x48')](_0x533aca[_0x5ca8('0x2c')],_0x5d5283[_0x5ca8('0x2e')]));if(_0x533aca[_0x5ca8('0x2c')][_0x5ca8('0x39')]){_0x38c45f[_0x5ca8('0x38')]=_[_0x5ca8('0x42')](_0x38c45f[_0x5ca8('0x38')],{'$or':_['map'](_0x38c45f[_0x5ca8('0x31')],function(_0x4003ff){var _0x16ef05={};_0x16ef05[_0x4003ff]={'$like':'%'+_0x533aca[_0x5ca8('0x2c')][_0x5ca8('0x39')]+'%'};return _0x16ef05;})});}_0x38c45f=_['merge']({},_0x38c45f,_0x533aca[_0x5ca8('0x3b')]);return _0x16649d[_0x5ca8('0x49')](_0x38c45f);}})[_0x5ca8('0x1f')](function(_0x945910){if(_0x945910){_0x3ce49e=_0x945910[_0x5ca8('0x32')];if(!_0x533aca[_0x5ca8('0x2c')][_0x5ca8('0x33')](_0x5ca8('0x34'))){_0x38c45f[_0x5ca8('0x18')]=qs[_0x5ca8('0x18')](_0x533aca[_0x5ca8('0x2c')]['limit']);_0x38c45f[_0x5ca8('0x35')]=qs[_0x5ca8('0x35')](_0x533aca[_0x5ca8('0x2c')][_0x5ca8('0x35')]);}return _0x16649d[_0x5ca8('0x49')](_0x38c45f);}})['then'](function(_0x51dcb4){if(_0x51dcb4){return _0x51dcb4?{'count':_0x3ce49e,'rows':_0x51dcb4}:null;}})['then'](respondWithResult(_0x336c74,null))[_0x5ca8('0x3e')](handleError(_0x336c74,null));};exports['getSubjects']=function(_0x59602b,_0x3d587d,_0x5c5ab4){var _0x569e32={};var _0x2dad75={};var _0x264632;var _0x1e85fb;return db[_0x5ca8('0x25')][_0x5ca8('0x46')]({'where':{'id':_0x59602b[_0x5ca8('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d587d,null))['then'](function(_0x5ee084){if(_0x5ee084){_0x264632=_0x5ee084;_0x2dad75[_0x5ca8('0x2a')]=_[_0x5ca8('0x2d')](db[_0x5ca8('0x47')][_0x5ca8('0x26')]);_0x2dad75['query']=_[_0x5ca8('0x2d')](_0x59602b[_0x5ca8('0x2c')]);_0x2dad75[_0x5ca8('0x2e')]=_['intersection'](_0x2dad75[_0x5ca8('0x2a')],_0x2dad75['query']);_0x569e32[_0x5ca8('0x31')]=_[_0x5ca8('0x2f')](_0x2dad75[_0x5ca8('0x2a')],qs[_0x5ca8('0x30')](_0x59602b[_0x5ca8('0x2c')][_0x5ca8('0x30')]));_0x569e32[_0x5ca8('0x31')]=_0x569e32[_0x5ca8('0x31')][_0x5ca8('0x32')]?_0x569e32[_0x5ca8('0x31')]:_0x2dad75[_0x5ca8('0x2a')];_0x569e32[_0x5ca8('0x36')]=qs[_0x5ca8('0x37')](_0x59602b[_0x5ca8('0x2c')][_0x5ca8('0x37')]);_0x569e32[_0x5ca8('0x38')]=qs[_0x5ca8('0x2e')](_[_0x5ca8('0x48')](_0x59602b[_0x5ca8('0x2c')],_0x2dad75['filters']));if(_0x59602b[_0x5ca8('0x2c')][_0x5ca8('0x39')]){_0x569e32[_0x5ca8('0x38')]=_[_0x5ca8('0x42')](_0x569e32[_0x5ca8('0x38')],{'$or':_[_0x5ca8('0x2b')](_0x569e32[_0x5ca8('0x31')],function(_0x206a5d){var _0x576c1c={};_0x576c1c[_0x206a5d]={'$like':'%'+_0x59602b[_0x5ca8('0x2c')][_0x5ca8('0x39')]+'%'};return _0x576c1c;})});}_0x569e32=_[_0x5ca8('0x42')]({},_0x569e32,_0x59602b[_0x5ca8('0x3b')]);return _0x264632[_0x5ca8('0x4a')](_0x569e32);}})[_0x5ca8('0x1f')](function(_0x56217e){if(_0x56217e){_0x1e85fb=_0x56217e[_0x5ca8('0x32')];if(!_0x59602b[_0x5ca8('0x2c')][_0x5ca8('0x33')](_0x5ca8('0x34'))){_0x569e32[_0x5ca8('0x18')]=qs[_0x5ca8('0x18')](_0x59602b['query'][_0x5ca8('0x18')]);_0x569e32['offset']=qs[_0x5ca8('0x35')](_0x59602b[_0x5ca8('0x2c')][_0x5ca8('0x35')]);}return _0x264632['getSubjects'](_0x569e32);}})[_0x5ca8('0x1f')](function(_0x13785f){if(_0x13785f){return _0x13785f?{'count':_0x1e85fb,'rows':_0x13785f}:null;}})['then'](respondWithResult(_0x3d587d,null))[_0x5ca8('0x3e')](handleError(_0x3d587d,null));};exports[_0x5ca8('0x4b')]=function(_0x166cdf,_0x3dc65f,_0x4df575){var _0x4efa14={};var _0x21462d={};var _0x1e31b5;var _0x476fa9;return db[_0x5ca8('0x25')][_0x5ca8('0x46')]({'where':{'id':_0x166cdf[_0x5ca8('0x40')]['id']}})[_0x5ca8('0x1f')](handleEntityNotFound(_0x3dc65f,null))[_0x5ca8('0x1f')](function(_0x5304df){if(_0x5304df){_0x1e31b5=_0x5304df;_0x21462d[_0x5ca8('0x2a')]=_[_0x5ca8('0x2d')](db[_0x5ca8('0x47')]['rawAttributes']);_0x21462d['query']=_[_0x5ca8('0x2d')](_0x166cdf[_0x5ca8('0x2c')]);_0x21462d['filters']=_[_0x5ca8('0x2f')](_0x21462d['model'],_0x21462d[_0x5ca8('0x2c')]);_0x4efa14[_0x5ca8('0x31')]=_[_0x5ca8('0x2f')](_0x21462d[_0x5ca8('0x2a')],qs[_0x5ca8('0x30')](_0x166cdf['query']['fields']));_0x4efa14[_0x5ca8('0x31')]=_0x4efa14[_0x5ca8('0x31')][_0x5ca8('0x32')]?_0x4efa14[_0x5ca8('0x31')]:_0x21462d[_0x5ca8('0x2a')];_0x4efa14[_0x5ca8('0x36')]=qs['sort'](_0x166cdf[_0x5ca8('0x2c')]['sort']);_0x4efa14[_0x5ca8('0x38')]=qs['filters'](_[_0x5ca8('0x48')](_0x166cdf[_0x5ca8('0x2c')],_0x21462d[_0x5ca8('0x2e')]));if(_0x166cdf[_0x5ca8('0x2c')][_0x5ca8('0x39')]){_0x4efa14[_0x5ca8('0x38')]=_[_0x5ca8('0x42')](_0x4efa14[_0x5ca8('0x38')],{'$or':_[_0x5ca8('0x2b')](_0x4efa14[_0x5ca8('0x31')],function(_0x1a6085){var _0x4b5d77={};_0x4b5d77[_0x1a6085]={'$like':'%'+_0x166cdf['query'][_0x5ca8('0x39')]+'%'};return _0x4b5d77;})});}_0x4efa14=_[_0x5ca8('0x42')]({},_0x4efa14,_0x166cdf['options']);return _0x1e31b5[_0x5ca8('0x4b')](_0x4efa14);}})['then'](function(_0xa7264b){if(_0xa7264b){_0x476fa9=_0xa7264b[_0x5ca8('0x32')];if(!_0x166cdf[_0x5ca8('0x2c')][_0x5ca8('0x33')](_0x5ca8('0x34'))){_0x4efa14['limit']=qs['limit'](_0x166cdf['query'][_0x5ca8('0x18')]);_0x4efa14[_0x5ca8('0x35')]=qs['offset'](_0x166cdf[_0x5ca8('0x2c')][_0x5ca8('0x35')]);}return _0x1e31b5[_0x5ca8('0x4b')](_0x4efa14);}})['then'](function(_0x119796){if(_0x119796){return _0x119796?{'count':_0x476fa9,'rows':_0x119796}:null;}})[_0x5ca8('0x1f')](respondWithResult(_0x3dc65f,null))[_0x5ca8('0x3e')](handleError(_0x3dc65f,null));}; \ No newline at end of file +var _0xbced=['rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','ServicenowConfiguration','find','body','getFields','findOne','ServicenowField','length','getSubjects','getDescriptions','eml-format','rimraf','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../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','save','update','index'];(function(_0x3c2b91,_0x5dd910){var _0x519192=function(_0x1a5f9a){while(--_0x1a5f9a){_0x3c2b91['push'](_0x3c2b91['shift']());}};_0x519192(++_0x5dd910);}(_0xbced,0x185));var _0xdbce=function(_0x5c5d9b,_0x2fbfb1){_0x5c5d9b=_0x5c5d9b-0x0;var _0x40ca79=_0xbced[_0x5c5d9b];return _0x40ca79;};'use strict';var emlformat=require(_0xdbce('0x0'));var rimraf=require(_0xdbce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbce('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdbce('0x3'));var sox=require('sox');var csv=require(_0xdbce('0x4'));var ejs=require(_0xdbce('0x5'));var fs=require('fs');var fs_extra=require(_0xdbce('0x6'));var _=require(_0xdbce('0x7'));var squel=require('squel');var crypto=require(_0xdbce('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xdbce('0x9'));var toCsv=require(_0xdbce('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbce('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbce('0xb'));var logger=require(_0xdbce('0xc'))('api');var utils=require(_0xdbce('0xd'));var config=require(_0xdbce('0xe'));var licenseUtil=require(_0xdbce('0xf'));var db=require(_0xdbce('0x10'))['db'];function respondWithStatusCode(_0x192370,_0x25a895){_0x25a895=_0x25a895||0xcc;return function(_0x5cdce0){if(_0x5cdce0){return _0x192370[_0xdbce('0x11')](_0x25a895);}return _0x192370[_0xdbce('0x12')](_0x25a895)[_0xdbce('0x13')]();};}function respondWithResult(_0x2dbb42,_0x293fe8){_0x293fe8=_0x293fe8||0xc8;return function(_0x46342b){if(_0x46342b){return _0x2dbb42['status'](_0x293fe8)[_0xdbce('0x14')](_0x46342b);}};}function respondWithFilteredResult(_0x1bf427,_0x2ca6f0){return function(_0x56a716){if(_0x56a716){var _0x1302ca=typeof _0x2ca6f0['offset']===_0xdbce('0x15')&&typeof _0x2ca6f0[_0xdbce('0x16')]===_0xdbce('0x15');var _0x2eb063=_0x56a716[_0xdbce('0x17')];var _0x913359=_0x1302ca?0x0:_0x2ca6f0[_0xdbce('0x18')];var _0x26f44b=_0x1302ca?_0x56a716[_0xdbce('0x17')]:_0x2ca6f0[_0xdbce('0x18')]+_0x2ca6f0[_0xdbce('0x16')];var _0x5cee36;if(_0x26f44b>=_0x2eb063){_0x26f44b=_0x2eb063;_0x5cee36=0xc8;}else{_0x5cee36=0xce;}_0x1bf427['status'](_0x5cee36);return _0x1bf427[_0xdbce('0x19')](_0xdbce('0x1a'),_0x913359+'-'+_0x26f44b+'/'+_0x2eb063)[_0xdbce('0x14')](_0x56a716);}return null;};}function patchUpdates(_0x3361ea){return function(_0x4da8e4){try{jsonpatch[_0xdbce('0x1b')](_0x4da8e4,_0x3361ea,!![]);}catch(_0x56c3d7){return BPromise['reject'](_0x56c3d7);}return _0x4da8e4[_0xdbce('0x1c')]();};}function saveUpdates(_0x26d4e5,_0x2349fb){return function(_0x1b2bc5){if(_0x1b2bc5){return _0x1b2bc5[_0xdbce('0x1d')](_0x26d4e5)['then'](function(_0x151b84){return _0x151b84;});}return null;};}function removeEntity(_0x5ace02,_0x309fd4){return function(_0x2a69d8){if(_0x2a69d8){return _0x2a69d8['destroy']()['then'](function(){_0x5ace02['status'](0xcc)[_0xdbce('0x13')]();});}};}function handleEntityNotFound(_0x5bc57e,_0x24564a){return function(_0x348e99){if(!_0x348e99){_0x5bc57e[_0xdbce('0x11')](0x194);}return _0x348e99;};}function handleError(_0x464413,_0x33fcfe){_0x33fcfe=_0x33fcfe||0x1f4;return function(_0x39f864){logger['error'](_0x39f864['stack']);if(_0x39f864['name']){delete _0x39f864['name'];}_0x464413[_0xdbce('0x12')](_0x33fcfe)['send'](_0x39f864);};}exports[_0xdbce('0x1e')]=function(_0x40c3fb,_0x30a766){var _0xcc6bef={},_0x27ce51={},_0x5b83e8={'count':0x0,'rows':[]};var _0x4ce881=_['map'](db['ServicenowConfiguration'][_0xdbce('0x1f')],function(_0x407e75){return{'name':_0x407e75[_0xdbce('0x20')],'type':_0x407e75['type'][_0xdbce('0x21')]};});_0x27ce51[_0xdbce('0x22')]=_[_0xdbce('0x23')](_0x4ce881,_0xdbce('0x24'));_0x27ce51['query']=_[_0xdbce('0x25')](_0x40c3fb[_0xdbce('0x26')]);_0x27ce51[_0xdbce('0x27')]=_[_0xdbce('0x28')](_0x27ce51[_0xdbce('0x22')],_0x27ce51[_0xdbce('0x26')]);_0xcc6bef[_0xdbce('0x29')]=_[_0xdbce('0x28')](_0x27ce51[_0xdbce('0x22')],qs[_0xdbce('0x2a')](_0x40c3fb[_0xdbce('0x26')][_0xdbce('0x2a')]));_0xcc6bef[_0xdbce('0x29')]=_0xcc6bef[_0xdbce('0x29')]['length']?_0xcc6bef[_0xdbce('0x29')]:_0x27ce51[_0xdbce('0x22')];if(!_0x40c3fb['query'][_0xdbce('0x2b')](_0xdbce('0x2c'))){_0xcc6bef[_0xdbce('0x16')]=qs[_0xdbce('0x16')](_0x40c3fb[_0xdbce('0x26')]['limit']);_0xcc6bef[_0xdbce('0x18')]=qs[_0xdbce('0x18')](_0x40c3fb[_0xdbce('0x26')]['offset']);}_0xcc6bef[_0xdbce('0x2d')]=qs[_0xdbce('0x2e')](_0x40c3fb[_0xdbce('0x26')]['sort']);_0xcc6bef[_0xdbce('0x2f')]=qs[_0xdbce('0x27')](_[_0xdbce('0x30')](_0x40c3fb['query'],_0x27ce51[_0xdbce('0x27')]),_0x4ce881);if(_0x40c3fb[_0xdbce('0x26')][_0xdbce('0x31')]){_0xcc6bef[_0xdbce('0x2f')]=_[_0xdbce('0x32')](_0xcc6bef['where'],{'$or':_[_0xdbce('0x23')](_0x4ce881,function(_0x3dad68){if(_0x3dad68[_0xdbce('0x33')]!==_0xdbce('0x34')){var _0x3998f5={};_0x3998f5[_0x3dad68[_0xdbce('0x24')]]={'$like':'%'+_0x40c3fb[_0xdbce('0x26')][_0xdbce('0x31')]+'%'};return _0x3998f5;}})});}_0xcc6bef=_[_0xdbce('0x32')]({},_0xcc6bef,_0x40c3fb[_0xdbce('0x35')]);var _0x229db6={'where':_0xcc6bef[_0xdbce('0x2f')]};return db['ServicenowConfiguration'][_0xdbce('0x17')](_0x229db6)[_0xdbce('0x36')](function(_0x7b478b){_0x5b83e8['count']=_0x7b478b;if(_0x40c3fb[_0xdbce('0x26')][_0xdbce('0x37')]){_0xcc6bef[_0xdbce('0x38')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0xcc6bef);})[_0xdbce('0x36')](function(_0x4d7fca){_0x5b83e8[_0xdbce('0x39')]=_0x4d7fca;return _0x5b83e8;})[_0xdbce('0x36')](respondWithFilteredResult(_0x30a766,_0xcc6bef))[_0xdbce('0x3a')](handleError(_0x30a766,null));};exports[_0xdbce('0x3b')]=function(_0x2aef7b,_0x4a76f8){var _0x3ba60d={'raw':![],'where':{'id':_0x2aef7b[_0xdbce('0x3c')]['id']}},_0x568303={};_0x568303[_0xdbce('0x22')]=_[_0xdbce('0x25')](db['ServicenowConfiguration'][_0xdbce('0x1f')]);_0x568303[_0xdbce('0x26')]=_[_0xdbce('0x25')](_0x2aef7b[_0xdbce('0x26')]);_0x568303[_0xdbce('0x27')]=_[_0xdbce('0x28')](_0x568303[_0xdbce('0x22')],_0x568303[_0xdbce('0x26')]);_0x3ba60d[_0xdbce('0x29')]=_[_0xdbce('0x28')](_0x568303[_0xdbce('0x22')],qs[_0xdbce('0x2a')](_0x2aef7b[_0xdbce('0x26')]['fields']));_0x3ba60d[_0xdbce('0x29')]=_0x3ba60d[_0xdbce('0x29')]['length']?_0x3ba60d['attributes']:_0x568303[_0xdbce('0x22')];if(_0x2aef7b[_0xdbce('0x26')][_0xdbce('0x37')]){_0x3ba60d['include']=[{'all':!![]}];}_0x3ba60d=_[_0xdbce('0x32')]({},_0x3ba60d,_0x2aef7b[_0xdbce('0x35')]);return db[_0xdbce('0x3d')][_0xdbce('0x3e')](_0x3ba60d)[_0xdbce('0x36')](handleEntityNotFound(_0x4a76f8,null))['then'](respondWithResult(_0x4a76f8,null))[_0xdbce('0x3a')](handleError(_0x4a76f8,null));};exports['create']=function(_0x2f0d40,_0x170049){return db[_0xdbce('0x3d')]['create'](_0x2f0d40[_0xdbce('0x3f')],{})[_0xdbce('0x36')](respondWithResult(_0x170049,0xc9))['catch'](handleError(_0x170049,null));};exports['update']=function(_0x25abaa,_0x1019ec){if(_0x25abaa[_0xdbce('0x3f')]['id']){delete _0x25abaa[_0xdbce('0x3f')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x25abaa['params']['id']}})[_0xdbce('0x36')](handleEntityNotFound(_0x1019ec,null))[_0xdbce('0x36')](saveUpdates(_0x25abaa[_0xdbce('0x3f')],null))[_0xdbce('0x36')](respondWithResult(_0x1019ec,null))[_0xdbce('0x3a')](handleError(_0x1019ec,null));};exports['destroy']=function(_0x3a3eb3,_0x3213be){return db[_0xdbce('0x3d')][_0xdbce('0x3e')]({'where':{'id':_0x3a3eb3['params']['id']}})['then'](handleEntityNotFound(_0x3213be,null))[_0xdbce('0x36')](removeEntity(_0x3213be,null))[_0xdbce('0x3a')](handleError(_0x3213be,null));};exports[_0xdbce('0x40')]=function(_0x407ab7,_0x57f1d0,_0x395243){var _0x316d3a={};var _0xf89ce={};var _0x3462fd;var _0x2f66c9;return db[_0xdbce('0x3d')][_0xdbce('0x41')]({'where':{'id':_0x407ab7['params']['id']}})[_0xdbce('0x36')](handleEntityNotFound(_0x57f1d0,null))[_0xdbce('0x36')](function(_0x26d2ca){if(_0x26d2ca){_0x3462fd=_0x26d2ca;_0xf89ce[_0xdbce('0x22')]=_[_0xdbce('0x25')](db[_0xdbce('0x42')]['rawAttributes']);_0xf89ce[_0xdbce('0x26')]=_[_0xdbce('0x25')](_0x407ab7[_0xdbce('0x26')]);_0xf89ce[_0xdbce('0x27')]=_['intersection'](_0xf89ce[_0xdbce('0x22')],_0xf89ce[_0xdbce('0x26')]);_0x316d3a[_0xdbce('0x29')]=_['intersection'](_0xf89ce[_0xdbce('0x22')],qs[_0xdbce('0x2a')](_0x407ab7[_0xdbce('0x26')][_0xdbce('0x2a')]));_0x316d3a[_0xdbce('0x29')]=_0x316d3a[_0xdbce('0x29')][_0xdbce('0x43')]?_0x316d3a[_0xdbce('0x29')]:_0xf89ce[_0xdbce('0x22')];_0x316d3a['order']=qs[_0xdbce('0x2e')](_0x407ab7['query'][_0xdbce('0x2e')]);_0x316d3a[_0xdbce('0x2f')]=qs[_0xdbce('0x27')](_[_0xdbce('0x30')](_0x407ab7[_0xdbce('0x26')],_0xf89ce['filters']));if(_0x407ab7['query']['filter']){_0x316d3a[_0xdbce('0x2f')]=_[_0xdbce('0x32')](_0x316d3a['where'],{'$or':_['map'](_0x316d3a[_0xdbce('0x29')],function(_0x1a8953){var _0x46420f={};_0x46420f[_0x1a8953]={'$like':'%'+_0x407ab7[_0xdbce('0x26')][_0xdbce('0x31')]+'%'};return _0x46420f;})});}_0x316d3a=_[_0xdbce('0x32')]({},_0x316d3a,_0x407ab7[_0xdbce('0x35')]);return _0x3462fd['getFields'](_0x316d3a);}})[_0xdbce('0x36')](function(_0x475843){if(_0x475843){_0x2f66c9=_0x475843[_0xdbce('0x43')];if(!_0x407ab7['query']['hasOwnProperty'](_0xdbce('0x2c'))){_0x316d3a['limit']=qs['limit'](_0x407ab7[_0xdbce('0x26')]['limit']);_0x316d3a[_0xdbce('0x18')]=qs[_0xdbce('0x18')](_0x407ab7[_0xdbce('0x26')]['offset']);}return _0x3462fd[_0xdbce('0x40')](_0x316d3a);}})['then'](function(_0x134614){if(_0x134614){return _0x134614?{'count':_0x2f66c9,'rows':_0x134614}:null;}})[_0xdbce('0x36')](respondWithResult(_0x57f1d0,null))[_0xdbce('0x3a')](handleError(_0x57f1d0,null));};exports[_0xdbce('0x44')]=function(_0x59d467,_0x565ef3,_0x2d22ac){var _0x5b6ed2={};var _0xd5edac={};var _0x1e041a;var _0x5bfd07;return db[_0xdbce('0x3d')]['findOne']({'where':{'id':_0x59d467[_0xdbce('0x3c')]['id']}})['then'](handleEntityNotFound(_0x565ef3,null))[_0xdbce('0x36')](function(_0x18a79a){if(_0x18a79a){_0x1e041a=_0x18a79a;_0xd5edac[_0xdbce('0x22')]=_[_0xdbce('0x25')](db[_0xdbce('0x42')][_0xdbce('0x1f')]);_0xd5edac['query']=_['keys'](_0x59d467[_0xdbce('0x26')]);_0xd5edac[_0xdbce('0x27')]=_[_0xdbce('0x28')](_0xd5edac[_0xdbce('0x22')],_0xd5edac[_0xdbce('0x26')]);_0x5b6ed2[_0xdbce('0x29')]=_[_0xdbce('0x28')](_0xd5edac[_0xdbce('0x22')],qs['fields'](_0x59d467['query']['fields']));_0x5b6ed2[_0xdbce('0x29')]=_0x5b6ed2[_0xdbce('0x29')][_0xdbce('0x43')]?_0x5b6ed2[_0xdbce('0x29')]:_0xd5edac['model'];_0x5b6ed2[_0xdbce('0x2d')]=qs[_0xdbce('0x2e')](_0x59d467[_0xdbce('0x26')][_0xdbce('0x2e')]);_0x5b6ed2[_0xdbce('0x2f')]=qs[_0xdbce('0x27')](_[_0xdbce('0x30')](_0x59d467[_0xdbce('0x26')],_0xd5edac[_0xdbce('0x27')]));if(_0x59d467[_0xdbce('0x26')][_0xdbce('0x31')]){_0x5b6ed2['where']=_[_0xdbce('0x32')](_0x5b6ed2[_0xdbce('0x2f')],{'$or':_['map'](_0x5b6ed2[_0xdbce('0x29')],function(_0x1fa1ba){var _0x19d7a7={};_0x19d7a7[_0x1fa1ba]={'$like':'%'+_0x59d467['query'][_0xdbce('0x31')]+'%'};return _0x19d7a7;})});}_0x5b6ed2=_['merge']({},_0x5b6ed2,_0x59d467[_0xdbce('0x35')]);return _0x1e041a[_0xdbce('0x44')](_0x5b6ed2);}})[_0xdbce('0x36')](function(_0x2887ec){if(_0x2887ec){_0x5bfd07=_0x2887ec[_0xdbce('0x43')];if(!_0x59d467['query'][_0xdbce('0x2b')](_0xdbce('0x2c'))){_0x5b6ed2[_0xdbce('0x16')]=qs['limit'](_0x59d467[_0xdbce('0x26')]['limit']);_0x5b6ed2[_0xdbce('0x18')]=qs[_0xdbce('0x18')](_0x59d467[_0xdbce('0x26')][_0xdbce('0x18')]);}return _0x1e041a['getSubjects'](_0x5b6ed2);}})[_0xdbce('0x36')](function(_0xcb7e39){if(_0xcb7e39){return _0xcb7e39?{'count':_0x5bfd07,'rows':_0xcb7e39}:null;}})[_0xdbce('0x36')](respondWithResult(_0x565ef3,null))['catch'](handleError(_0x565ef3,null));};exports['getDescriptions']=function(_0x30b48e,_0x469d21,_0x176a30){var _0x54c768={};var _0x343a52={};var _0x5f09af;var _0x24ce94;return db['ServicenowConfiguration'][_0xdbce('0x41')]({'where':{'id':_0x30b48e['params']['id']}})[_0xdbce('0x36')](handleEntityNotFound(_0x469d21,null))[_0xdbce('0x36')](function(_0x2e5d1f){if(_0x2e5d1f){_0x5f09af=_0x2e5d1f;_0x343a52[_0xdbce('0x22')]=_[_0xdbce('0x25')](db['ServicenowField'][_0xdbce('0x1f')]);_0x343a52[_0xdbce('0x26')]=_[_0xdbce('0x25')](_0x30b48e[_0xdbce('0x26')]);_0x343a52['filters']=_[_0xdbce('0x28')](_0x343a52[_0xdbce('0x22')],_0x343a52[_0xdbce('0x26')]);_0x54c768['attributes']=_[_0xdbce('0x28')](_0x343a52['model'],qs['fields'](_0x30b48e[_0xdbce('0x26')][_0xdbce('0x2a')]));_0x54c768[_0xdbce('0x29')]=_0x54c768[_0xdbce('0x29')][_0xdbce('0x43')]?_0x54c768['attributes']:_0x343a52['model'];_0x54c768[_0xdbce('0x2d')]=qs['sort'](_0x30b48e['query'][_0xdbce('0x2e')]);_0x54c768[_0xdbce('0x2f')]=qs['filters'](_[_0xdbce('0x30')](_0x30b48e['query'],_0x343a52['filters']));if(_0x30b48e[_0xdbce('0x26')][_0xdbce('0x31')]){_0x54c768['where']=_[_0xdbce('0x32')](_0x54c768[_0xdbce('0x2f')],{'$or':_[_0xdbce('0x23')](_0x54c768[_0xdbce('0x29')],function(_0x4a5c3e){var _0x57ab5b={};_0x57ab5b[_0x4a5c3e]={'$like':'%'+_0x30b48e[_0xdbce('0x26')]['filter']+'%'};return _0x57ab5b;})});}_0x54c768=_[_0xdbce('0x32')]({},_0x54c768,_0x30b48e['options']);return _0x5f09af[_0xdbce('0x45')](_0x54c768);}})[_0xdbce('0x36')](function(_0x417536){if(_0x417536){_0x24ce94=_0x417536['length'];if(!_0x30b48e[_0xdbce('0x26')]['hasOwnProperty'](_0xdbce('0x2c'))){_0x54c768[_0xdbce('0x16')]=qs['limit'](_0x30b48e[_0xdbce('0x26')][_0xdbce('0x16')]);_0x54c768[_0xdbce('0x18')]=qs[_0xdbce('0x18')](_0x30b48e[_0xdbce('0x26')]['offset']);}return _0x5f09af['getDescriptions'](_0x54c768);}})['then'](function(_0x25b45f){if(_0x25b45f){return _0x25b45f?{'count':_0x24ce94,'rows':_0x25b45f}:null;}})[_0xdbce('0x36')](respondWithResult(_0x469d21,null))[_0xdbce('0x3a')](handleError(_0x469d21,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ae98f93..cc1fff0 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 _0x8769=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','bluebird','request-promise','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x501f5c,_0x2292e4){var _0x2b988c=function(_0x5abe6f){while(--_0x5abe6f){_0x501f5c['push'](_0x501f5c['shift']());}};_0x2b988c(++_0x2292e4);}(_0x8769,0x110));var _0x9876=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x8769[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x9876('0x0'));var util=require(_0x9876('0x1'));var logger=require('../../config/logger')(_0x9876('0x2'));var moment=require('moment');var BPromise=require(_0x9876('0x3'));var rp=require(_0x9876('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9876('0x5'));var attributes=require(_0x9876('0x6'));module['exports']=function(_0x179357,_0x5a4149){return _0x179357['define'](_0x9876('0x7'),attributes,{'tableName':_0x9876('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb74=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b6760,_0x29b6e0){var _0x4fd8cc=function(_0x327a8a){while(--_0x327a8a){_0x3b6760['push'](_0x3b6760['shift']());}};_0x4fd8cc(++_0x29b6e0);}(_0xeb74,0xe3));var _0x4eb7=function(_0x4d0e7c,_0x244e80){_0x4d0e7c=_0x4d0e7c-0x0;var _0x49bcc0=_0xeb74[_0x4d0e7c];return _0x49bcc0;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var logger=require(_0x4eb7('0x2'))(_0x4eb7('0x3'));var moment=require(_0x4eb7('0x4'));var BPromise=require(_0x4eb7('0x5'));var rp=require(_0x4eb7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var attributes=require(_0x4eb7('0x9'));module[_0x4eb7('0xa')]=function(_0xa6e086,_0x563d6e){return _0xa6e086[_0x4eb7('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0x4eb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 1535ffe..2796a51 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 _0x6224=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6224,0x178));var _0x4622=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x6224[_0x205e5a];return _0x10da58;};'use strict';var _=require(_0x4622('0x0'));var util=require(_0x4622('0x1'));var moment=require(_0x4622('0x2'));var BPromise=require(_0x4622('0x3'));var rs=require(_0x4622('0x4'));var fs=require('fs');var Redis=require(_0x4622('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4622('0x6'))(_0x4622('0x7'));var config=require(_0x4622('0x8'));var jayson=require(_0x4622('0x9'));var client=jayson[_0x4622('0xa')][_0x4622('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x342ae4,_0x1e6672,_0x16146b){return new BPromise(function(_0x362012,_0x29fb8b){return client[_0x4622('0xc')](_0x342ae4,_0x16146b)[_0x4622('0xd')](function(_0x4a0932){logger[_0x4622('0xe')](_0x4622('0xf'),_0x1e6672,_0x4622('0x10'));logger[_0x4622('0x11')](_0x4622('0x12'),_0x1e6672,_0x4622('0x10'),JSON[_0x4622('0x13')](_0x4a0932));if(_0x4a0932['error']){if(_0x4a0932[_0x4622('0x14')]['code']===0x1f4){logger['error'](_0x4622('0xf'),_0x1e6672,_0x4a0932[_0x4622('0x14')][_0x4622('0x15')]);return _0x29fb8b(_0x4a0932[_0x4622('0x14')][_0x4622('0x15')]);}logger[_0x4622('0x14')](_0x4622('0xf'),_0x1e6672,_0x4a0932['error'][_0x4622('0x15')]);return _0x362012(_0x4a0932[_0x4622('0x14')][_0x4622('0x15')]);}else{logger[_0x4622('0xe')](_0x4622('0xf'),_0x1e6672,_0x4622('0x10'));_0x362012(_0x4a0932[_0x4622('0x16')][_0x4622('0x15')]);}})[_0x4622('0x17')](function(_0x21f64e){logger[_0x4622('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1e6672,_0x21f64e);_0x29fb8b(_0x21f64e);});});} \ No newline at end of file +var _0xdfb4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdfb4,0x169));var _0x4dfb=function(_0x131d07,_0x5ebdb2){_0x131d07=_0x131d07-0x0;var _0x5eba7c=_0xdfb4[_0x131d07];return _0x5eba7c;};'use strict';var _=require(_0x4dfb('0x0'));var util=require(_0x4dfb('0x1'));var moment=require(_0x4dfb('0x2'));var BPromise=require(_0x4dfb('0x3'));var rs=require(_0x4dfb('0x4'));var fs=require('fs');var Redis=require(_0x4dfb('0x5'));var db=require(_0x4dfb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dfb('0x7'))(_0x4dfb('0x8'));var config=require(_0x4dfb('0x9'));var jayson=require(_0x4dfb('0xa'));var client=jayson[_0x4dfb('0xb')][_0x4dfb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xded468,_0x193187,_0x2d5620){return new BPromise(function(_0x547363,_0x37e86b){return client[_0x4dfb('0xd')](_0xded468,_0x2d5620)[_0x4dfb('0xe')](function(_0x34efe7){logger[_0x4dfb('0xf')](_0x4dfb('0x10'),_0x193187,_0x4dfb('0x11'));logger[_0x4dfb('0x12')](_0x4dfb('0x13'),_0x193187,_0x4dfb('0x11'),JSON[_0x4dfb('0x14')](_0x34efe7));if(_0x34efe7['error']){if(_0x34efe7[_0x4dfb('0x15')][_0x4dfb('0x16')]===0x1f4){logger[_0x4dfb('0x15')](_0x4dfb('0x10'),_0x193187,_0x34efe7[_0x4dfb('0x15')][_0x4dfb('0x17')]);return _0x37e86b(_0x34efe7[_0x4dfb('0x15')][_0x4dfb('0x17')]);}logger[_0x4dfb('0x15')](_0x4dfb('0x10'),_0x193187,_0x34efe7[_0x4dfb('0x15')][_0x4dfb('0x17')]);return _0x547363(_0x34efe7['error'][_0x4dfb('0x17')]);}else{logger['info'](_0x4dfb('0x10'),_0x193187,_0x4dfb('0x11'));_0x547363(_0x34efe7[_0x4dfb('0x18')]['message']);}})[_0x4dfb('0x19')](function(_0x154c6e){logger[_0x4dfb('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0x193187,_0x154c6e);_0x37e86b(_0x154c6e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4705936..be88043 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 _0x6a72=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy'];(function(_0x20ec0c,_0x3b2c26){var _0x3b52a0=function(_0x1e02ab){while(--_0x1e02ab){_0x20ec0c['push'](_0x20ec0c['shift']());}};_0x3b52a0(++_0x3b2c26);}(_0x6a72,0xd8));var _0x26a7=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x6a72[_0x38854e];return _0x3f8415;};'use strict';var multer=require(_0x26a7('0x0'));var util=require(_0x26a7('0x1'));var path=require('path');var timeout=require(_0x26a7('0x2'));var express=require(_0x26a7('0x3'));var router=express[_0x26a7('0x4')]();var fs_extra=require(_0x26a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x26a7('0x6'));var config=require(_0x26a7('0x7'));var controller=require('./intServicenowField.controller');router[_0x26a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x26a7('0x9')]);router[_0x26a7('0x8')](_0x26a7('0xa'),auth['isAuthenticated'](),controller[_0x26a7('0xb')]);router[_0x26a7('0xc')]('/',auth[_0x26a7('0xd')](),controller[_0x26a7('0xe')]);router[_0x26a7('0xf')]('/:id',auth[_0x26a7('0xd')](),controller[_0x26a7('0x10')]);router['delete'](_0x26a7('0xa'),auth[_0x26a7('0xd')](),controller[_0x26a7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x30a3=['util','path','express','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30a3,0x1b4));var _0x330a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x330a('0x0'));var util=require(_0x330a('0x1'));var path=require(_0x330a('0x2'));var timeout=require('connect-timeout');var express=require(_0x330a('0x3'));var router=express[_0x330a('0x4')]();var fs_extra=require(_0x330a('0x5'));var auth=require(_0x330a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x330a('0x7'));router[_0x330a('0x8')]('/',auth[_0x330a('0x9')](),controller[_0x330a('0xa')]);router[_0x330a('0x8')](_0x330a('0xb'),auth[_0x330a('0x9')](),controller[_0x330a('0xc')]);router['post']('/',auth[_0x330a('0x9')](),controller[_0x330a('0xd')]);router[_0x330a('0xe')]('/:id',auth[_0x330a('0x9')](),controller[_0x330a('0xf')]);router[_0x330a('0x10')]('/:id',auth[_0x330a('0x9')](),controller[_0x330a('0x11')]);module[_0x330a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 54ccc8f..07e1dbe 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 _0x06a6=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x06a6,0x1b2));var _0x606a=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x06a6[_0xb0fe92];return _0x41787f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x606a('0x0'),_0x606a('0x1'),_0x606a('0x2'),_0x606a('0x3'),'picklist'),'defaultValue':_0x606a('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x606a('0x4')]},'keyType':{'type':Sequelize[_0x606a('0x5')]('string',_0x606a('0x1'),_0x606a('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x606a('0x4')]},'nameField':{'type':Sequelize[_0x606a('0x4')]},'customField':{'type':Sequelize[_0x606a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x606a('0x4')]}}; \ No newline at end of file +var _0xa670=['BOOLEAN','sequelize','string','variable','customVariable','keyValue','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa670,0x143));var _0x0a67=function(_0x3cf148,_0x4c301f){_0x3cf148=_0x3cf148-0x0;var _0x1f5ac1=_0xa670[_0x3cf148];return _0x1f5ac1;};'use strict';var Sequelize=require(_0x0a67('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0a67('0x1'),_0x0a67('0x2'),_0x0a67('0x3'),_0x0a67('0x4'),'picklist'),'defaultValue':_0x0a67('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0a67('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x0a67('0x1'),_0x0a67('0x2'),_0x0a67('0x3'))},'keyContent':{'type':Sequelize[_0x0a67('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0a67('0x5')]},'customField':{'type':Sequelize[_0x0a67('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a67('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index bb84bca..9f86f6f 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 _0x618a=['map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','ServicenowField','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x618a,0x1e0));var _0xa618=function(_0x1df956,_0x2944cd){_0x1df956=_0x1df956-0x0;var _0x2eadc7=_0x618a[_0x1df956];return _0x2eadc7;};'use strict';var emlformat=require(_0xa618('0x0'));var rimraf=require(_0xa618('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa618('0x2'));var rp=require(_0xa618('0x3'));var moment=require(_0xa618('0x4'));var BPromise=require(_0xa618('0x5'));var Mustache=require(_0xa618('0x6'));var util=require(_0xa618('0x7'));var path=require(_0xa618('0x8'));var sox=require(_0xa618('0x9'));var csv=require('to-csv');var ejs=require(_0xa618('0xa'));var fs=require('fs');var fs_extra=require(_0xa618('0xb'));var _=require(_0xa618('0xc'));var squel=require(_0xa618('0xd'));var crypto=require(_0xa618('0xe'));var jsforce=require(_0xa618('0xf'));var deskjs=require(_0xa618('0x10'));var toCsv=require(_0xa618('0x11'));var querystring=require(_0xa618('0x12'));var Papa=require('papaparse');var Redis=require(_0xa618('0x13'));var authService=require(_0xa618('0x14'));var qs=require(_0xa618('0x15'));var as=require(_0xa618('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa618('0x17'))(_0xa618('0x18'));var utils=require(_0xa618('0x19'));var config=require(_0xa618('0x1a'));var licenseUtil=require(_0xa618('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557ebf,_0x4e2902){_0x4e2902=_0x4e2902||0xcc;return function(_0x152998){if(_0x152998){return _0x557ebf[_0xa618('0x1c')](_0x4e2902);}return _0x557ebf[_0xa618('0x1d')](_0x4e2902)['end']();};}function respondWithResult(_0x1cb71c,_0x5239ca){_0x5239ca=_0x5239ca||0xc8;return function(_0x2548aa){if(_0x2548aa){return _0x1cb71c[_0xa618('0x1d')](_0x5239ca)[_0xa618('0x1e')](_0x2548aa);}};}function respondWithFilteredResult(_0x7656b6,_0x59bf6b){return function(_0x4e757a){if(_0x4e757a){var _0x1922a1=typeof _0x59bf6b[_0xa618('0x1f')]==='undefined'&&typeof _0x59bf6b[_0xa618('0x20')]==='undefined';var _0x29d7ca=_0x4e757a['count'];var _0x58dea6=_0x1922a1?0x0:_0x59bf6b['offset'];var _0x5814f1=_0x1922a1?_0x4e757a['count']:_0x59bf6b[_0xa618('0x1f')]+_0x59bf6b[_0xa618('0x20')];var _0x2465b5;if(_0x5814f1>=_0x29d7ca){_0x5814f1=_0x29d7ca;_0x2465b5=0xc8;}else{_0x2465b5=0xce;}_0x7656b6[_0xa618('0x1d')](_0x2465b5);return _0x7656b6[_0xa618('0x21')](_0xa618('0x22'),_0x58dea6+'-'+_0x5814f1+'/'+_0x29d7ca)[_0xa618('0x1e')](_0x4e757a);}return null;};}function patchUpdates(_0x1b6368){return function(_0x20f624){try{jsonpatch[_0xa618('0x23')](_0x20f624,_0x1b6368,!![]);}catch(_0x21abaa){return BPromise[_0xa618('0x24')](_0x21abaa);}return _0x20f624[_0xa618('0x25')]();};}function saveUpdates(_0x5e2adc,_0x232ac4){return function(_0x241959){if(_0x241959){return _0x241959[_0xa618('0x26')](_0x5e2adc)['then'](function(_0x42eaf9){return _0x42eaf9;});}return null;};}function removeEntity(_0x28c664,_0x22dcbc){return function(_0x5a00f7){if(_0x5a00f7){return _0x5a00f7[_0xa618('0x27')]()[_0xa618('0x28')](function(){_0x28c664[_0xa618('0x1d')](0xcc)[_0xa618('0x29')]();});}};}function handleEntityNotFound(_0x34c487,_0x1089fb){return function(_0x39d098){if(!_0x39d098){_0x34c487[_0xa618('0x1c')](0x194);}return _0x39d098;};}function handleError(_0x2bacfc,_0x2a2c4f){_0x2a2c4f=_0x2a2c4f||0x1f4;return function(_0x17ad54){logger['error'](_0x17ad54[_0xa618('0x2a')]);if(_0x17ad54[_0xa618('0x2b')]){delete _0x17ad54[_0xa618('0x2b')];}_0x2bacfc[_0xa618('0x1d')](_0x2a2c4f)[_0xa618('0x2c')](_0x17ad54);};}exports['index']=function(_0xc70466,_0xd2c5b7){var _0x3ab82a={},_0x2131f1={},_0x32c2e4={'count':0x0,'rows':[]};var _0x58c450=_[_0xa618('0x2d')](db['ServicenowField'][_0xa618('0x2e')],function(_0x135b9c){return{'name':_0x135b9c[_0xa618('0x2f')],'type':_0x135b9c[_0xa618('0x30')]['key']};});_0x2131f1['model']=_[_0xa618('0x2d')](_0x58c450,'name');_0x2131f1[_0xa618('0x31')]=_[_0xa618('0x32')](_0xc70466['query']);_0x2131f1[_0xa618('0x33')]=_[_0xa618('0x34')](_0x2131f1['model'],_0x2131f1[_0xa618('0x31')]);_0x3ab82a[_0xa618('0x35')]=_[_0xa618('0x34')](_0x2131f1[_0xa618('0x36')],qs[_0xa618('0x37')](_0xc70466[_0xa618('0x31')]['fields']));_0x3ab82a[_0xa618('0x35')]=_0x3ab82a[_0xa618('0x35')][_0xa618('0x38')]?_0x3ab82a[_0xa618('0x35')]:_0x2131f1[_0xa618('0x36')];if(!_0xc70466['query']['hasOwnProperty'](_0xa618('0x39'))){_0x3ab82a[_0xa618('0x20')]=qs[_0xa618('0x20')](_0xc70466[_0xa618('0x31')]['limit']);_0x3ab82a[_0xa618('0x1f')]=qs[_0xa618('0x1f')](_0xc70466[_0xa618('0x31')][_0xa618('0x1f')]);}_0x3ab82a[_0xa618('0x3a')]=qs[_0xa618('0x3b')](_0xc70466['query']['sort']);_0x3ab82a[_0xa618('0x3c')]=qs[_0xa618('0x33')](_[_0xa618('0x3d')](_0xc70466[_0xa618('0x31')],_0x2131f1[_0xa618('0x33')]),_0x58c450);if(_0xc70466[_0xa618('0x31')][_0xa618('0x3e')]){_0x3ab82a[_0xa618('0x3c')]=_[_0xa618('0x3f')](_0x3ab82a[_0xa618('0x3c')],{'$or':_[_0xa618('0x2d')](_0x58c450,function(_0x3fd50c){if(_0x3fd50c[_0xa618('0x30')]!=='VIRTUAL'){var _0x4db058={};_0x4db058[_0x3fd50c[_0xa618('0x2b')]]={'$like':'%'+_0xc70466[_0xa618('0x31')]['filter']+'%'};return _0x4db058;}})});}_0x3ab82a=_['merge']({},_0x3ab82a,_0xc70466['options']);var _0x2dc31f={'where':_0x3ab82a['where']};return db[_0xa618('0x40')]['count'](_0x2dc31f)[_0xa618('0x28')](function(_0x23fd05){_0x32c2e4['count']=_0x23fd05;if(_0xc70466[_0xa618('0x31')][_0xa618('0x41')]){_0x3ab82a['include']=[{'all':!![]}];}return db[_0xa618('0x40')][_0xa618('0x42')](_0x3ab82a);})[_0xa618('0x28')](function(_0x57f797){_0x32c2e4[_0xa618('0x43')]=_0x57f797;return _0x32c2e4;})[_0xa618('0x28')](respondWithFilteredResult(_0xd2c5b7,_0x3ab82a))[_0xa618('0x44')](handleError(_0xd2c5b7,null));};exports[_0xa618('0x45')]=function(_0x2ed3dd,_0x52357e){var _0x41e0f6={'raw':!![],'where':{'id':_0x2ed3dd[_0xa618('0x46')]['id']}},_0x1b1aa8={};_0x1b1aa8['model']=_[_0xa618('0x32')](db['ServicenowField'][_0xa618('0x2e')]);_0x1b1aa8[_0xa618('0x31')]=_[_0xa618('0x32')](_0x2ed3dd[_0xa618('0x31')]);_0x1b1aa8[_0xa618('0x33')]=_[_0xa618('0x34')](_0x1b1aa8[_0xa618('0x36')],_0x1b1aa8[_0xa618('0x31')]);_0x41e0f6[_0xa618('0x35')]=_[_0xa618('0x34')](_0x1b1aa8['model'],qs[_0xa618('0x37')](_0x2ed3dd[_0xa618('0x31')][_0xa618('0x37')]));_0x41e0f6[_0xa618('0x35')]=_0x41e0f6[_0xa618('0x35')]['length']?_0x41e0f6[_0xa618('0x35')]:_0x1b1aa8[_0xa618('0x36')];if(_0x2ed3dd[_0xa618('0x31')][_0xa618('0x41')]){_0x41e0f6[_0xa618('0x47')]=[{'all':!![]}];}_0x41e0f6=_['merge']({},_0x41e0f6,_0x2ed3dd['options']);return db['ServicenowField'][_0xa618('0x48')](_0x41e0f6)[_0xa618('0x28')](handleEntityNotFound(_0x52357e,null))['then'](respondWithResult(_0x52357e,null))['catch'](handleError(_0x52357e,null));};exports[_0xa618('0x49')]=function(_0x22eb2d,_0x5a4af3){return db['ServicenowField'][_0xa618('0x49')](_0x22eb2d[_0xa618('0x4a')],{})[_0xa618('0x28')](respondWithResult(_0x5a4af3,0xc9))['catch'](handleError(_0x5a4af3,null));};exports[_0xa618('0x26')]=function(_0x461235,_0x49b134){if(_0x461235['body']['id']){delete _0x461235[_0xa618('0x4a')]['id'];}return db['ServicenowField'][_0xa618('0x48')]({'where':{'id':_0x461235[_0xa618('0x46')]['id']}})[_0xa618('0x28')](handleEntityNotFound(_0x49b134,null))['then'](saveUpdates(_0x461235[_0xa618('0x4a')],null))[_0xa618('0x28')](respondWithResult(_0x49b134,null))[_0xa618('0x44')](handleError(_0x49b134,null));};exports[_0xa618('0x27')]=function(_0x2c0c88,_0x5486c9){return db[_0xa618('0x40')][_0xa618('0x48')]({'where':{'id':_0x2c0c88[_0xa618('0x46')]['id']}})['then'](handleEntityNotFound(_0x5486c9,null))[_0xa618('0x28')](removeEntity(_0x5486c9,null))[_0xa618('0x44')](handleError(_0x5486c9,null));}; \ No newline at end of file +var _0x00ff=['fs-extra','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','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','stack','name','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x24890e,_0x34a7bc){var _0x4da125=function(_0x239166){while(--_0x239166){_0x24890e['push'](_0x24890e['shift']());}};_0x4da125(++_0x34a7bc);}(_0x00ff,0x199));var _0xf00f=function(_0x131c16,_0xd46eed){_0x131c16=_0x131c16-0x0;var _0x5df325=_0x00ff[_0x131c16];return _0x5df325;};'use strict';var emlformat=require(_0xf00f('0x0'));var rimraf=require(_0xf00f('0x1'));var zipdir=require(_0xf00f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf00f('0x3'));var moment=require(_0xf00f('0x4'));var BPromise=require(_0xf00f('0x5'));var Mustache=require(_0xf00f('0x6'));var util=require('util');var path=require(_0xf00f('0x7'));var sox=require(_0xf00f('0x8'));var csv=require(_0xf00f('0x9'));var ejs=require(_0xf00f('0xa'));var fs=require('fs');var fs_extra=require(_0xf00f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf00f('0xc'));var toCsv=require(_0xf00f('0x9'));var querystring=require(_0xf00f('0xd'));var Papa=require(_0xf00f('0xe'));var Redis=require(_0xf00f('0xf'));var authService=require(_0xf00f('0x10'));var qs=require(_0xf00f('0x11'));var as=require(_0xf00f('0x12'));var hardwareService=require(_0xf00f('0x13'));var logger=require(_0xf00f('0x14'))(_0xf00f('0x15'));var utils=require(_0xf00f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf00f('0x17'));var db=require(_0xf00f('0x18'))['db'];function respondWithStatusCode(_0x561c39,_0x3aca94){_0x3aca94=_0x3aca94||0xcc;return function(_0x2121a3){if(_0x2121a3){return _0x561c39['sendStatus'](_0x3aca94);}return _0x561c39[_0xf00f('0x19')](_0x3aca94)[_0xf00f('0x1a')]();};}function respondWithResult(_0x54f923,_0x12b684){_0x12b684=_0x12b684||0xc8;return function(_0x37384c){if(_0x37384c){return _0x54f923[_0xf00f('0x19')](_0x12b684)[_0xf00f('0x1b')](_0x37384c);}};}function respondWithFilteredResult(_0x2a311f,_0x2a7cf6){return function(_0x659d36){if(_0x659d36){var _0x3dd4dc=typeof _0x2a7cf6[_0xf00f('0x1c')]==='undefined'&&typeof _0x2a7cf6[_0xf00f('0x1d')]===_0xf00f('0x1e');var _0xfbe17c=_0x659d36[_0xf00f('0x1f')];var _0x91ef61=_0x3dd4dc?0x0:_0x2a7cf6[_0xf00f('0x1c')];var _0x371b00=_0x3dd4dc?_0x659d36[_0xf00f('0x1f')]:_0x2a7cf6[_0xf00f('0x1c')]+_0x2a7cf6[_0xf00f('0x1d')];var _0x1d84e7;if(_0x371b00>=_0xfbe17c){_0x371b00=_0xfbe17c;_0x1d84e7=0xc8;}else{_0x1d84e7=0xce;}_0x2a311f[_0xf00f('0x19')](_0x1d84e7);return _0x2a311f[_0xf00f('0x20')]('Content-Range',_0x91ef61+'-'+_0x371b00+'/'+_0xfbe17c)[_0xf00f('0x1b')](_0x659d36);}return null;};}function patchUpdates(_0x287668){return function(_0xe7104e){try{jsonpatch[_0xf00f('0x21')](_0xe7104e,_0x287668,!![]);}catch(_0x2daab7){return BPromise[_0xf00f('0x22')](_0x2daab7);}return _0xe7104e[_0xf00f('0x23')]();};}function saveUpdates(_0x5d3f2a,_0x5bff38){return function(_0x30b042){if(_0x30b042){return _0x30b042[_0xf00f('0x24')](_0x5d3f2a)['then'](function(_0x3ba5ee){return _0x3ba5ee;});}return null;};}function removeEntity(_0x48ade9,_0xb7db3b){return function(_0x239926){if(_0x239926){return _0x239926['destroy']()[_0xf00f('0x25')](function(){_0x48ade9[_0xf00f('0x19')](0xcc)[_0xf00f('0x1a')]();});}};}function handleEntityNotFound(_0x21ba29,_0xfbfe4b){return function(_0x29bf09){if(!_0x29bf09){_0x21ba29[_0xf00f('0x26')](0x194);}return _0x29bf09;};}function handleError(_0x180313,_0x5e99e6){_0x5e99e6=_0x5e99e6||0x1f4;return function(_0x136d42){logger['error'](_0x136d42[_0xf00f('0x27')]);if(_0x136d42[_0xf00f('0x28')]){delete _0x136d42[_0xf00f('0x28')];}_0x180313[_0xf00f('0x19')](_0x5e99e6)['send'](_0x136d42);};}exports['index']=function(_0x3c0b4a,_0x3b3263){var _0xacdb7c={},_0x306269={},_0x4d5d52={'count':0x0,'rows':[]};var _0x116677=_[_0xf00f('0x29')](db[_0xf00f('0x2a')][_0xf00f('0x2b')],function(_0x459930){return{'name':_0x459930[_0xf00f('0x2c')],'type':_0x459930[_0xf00f('0x2d')][_0xf00f('0x2e')]};});_0x306269[_0xf00f('0x2f')]=_[_0xf00f('0x29')](_0x116677,_0xf00f('0x28'));_0x306269['query']=_['keys'](_0x3c0b4a[_0xf00f('0x30')]);_0x306269[_0xf00f('0x31')]=_[_0xf00f('0x32')](_0x306269[_0xf00f('0x2f')],_0x306269[_0xf00f('0x30')]);_0xacdb7c[_0xf00f('0x33')]=_[_0xf00f('0x32')](_0x306269['model'],qs['fields'](_0x3c0b4a['query'][_0xf00f('0x34')]));_0xacdb7c[_0xf00f('0x33')]=_0xacdb7c[_0xf00f('0x33')][_0xf00f('0x35')]?_0xacdb7c[_0xf00f('0x33')]:_0x306269[_0xf00f('0x2f')];if(!_0x3c0b4a['query'][_0xf00f('0x36')]('nolimit')){_0xacdb7c[_0xf00f('0x1d')]=qs[_0xf00f('0x1d')](_0x3c0b4a[_0xf00f('0x30')][_0xf00f('0x1d')]);_0xacdb7c[_0xf00f('0x1c')]=qs[_0xf00f('0x1c')](_0x3c0b4a[_0xf00f('0x30')]['offset']);}_0xacdb7c[_0xf00f('0x37')]=qs['sort'](_0x3c0b4a[_0xf00f('0x30')][_0xf00f('0x38')]);_0xacdb7c[_0xf00f('0x39')]=qs['filters'](_['pick'](_0x3c0b4a[_0xf00f('0x30')],_0x306269[_0xf00f('0x31')]),_0x116677);if(_0x3c0b4a[_0xf00f('0x30')]['filter']){_0xacdb7c['where']=_[_0xf00f('0x3a')](_0xacdb7c['where'],{'$or':_[_0xf00f('0x29')](_0x116677,function(_0x5b6123){if(_0x5b6123['type']!==_0xf00f('0x3b')){var _0x39b537={};_0x39b537[_0x5b6123[_0xf00f('0x28')]]={'$like':'%'+_0x3c0b4a[_0xf00f('0x30')][_0xf00f('0x3c')]+'%'};return _0x39b537;}})});}_0xacdb7c=_[_0xf00f('0x3a')]({},_0xacdb7c,_0x3c0b4a['options']);var _0x3779c4={'where':_0xacdb7c[_0xf00f('0x39')]};return db[_0xf00f('0x2a')][_0xf00f('0x1f')](_0x3779c4)[_0xf00f('0x25')](function(_0x42cb51){_0x4d5d52[_0xf00f('0x1f')]=_0x42cb51;if(_0x3c0b4a[_0xf00f('0x30')][_0xf00f('0x3d')]){_0xacdb7c['include']=[{'all':!![]}];}return db['ServicenowField'][_0xf00f('0x3e')](_0xacdb7c);})['then'](function(_0x343833){_0x4d5d52['rows']=_0x343833;return _0x4d5d52;})[_0xf00f('0x25')](respondWithFilteredResult(_0x3b3263,_0xacdb7c))['catch'](handleError(_0x3b3263,null));};exports['show']=function(_0x13096e,_0x540a68){var _0x24f2ff={'raw':!![],'where':{'id':_0x13096e[_0xf00f('0x3f')]['id']}},_0x165630={};_0x165630[_0xf00f('0x2f')]=_['keys'](db[_0xf00f('0x2a')][_0xf00f('0x2b')]);_0x165630['query']=_[_0xf00f('0x40')](_0x13096e['query']);_0x165630[_0xf00f('0x31')]=_[_0xf00f('0x32')](_0x165630['model'],_0x165630[_0xf00f('0x30')]);_0x24f2ff[_0xf00f('0x33')]=_[_0xf00f('0x32')](_0x165630[_0xf00f('0x2f')],qs[_0xf00f('0x34')](_0x13096e[_0xf00f('0x30')][_0xf00f('0x34')]));_0x24f2ff[_0xf00f('0x33')]=_0x24f2ff[_0xf00f('0x33')]['length']?_0x24f2ff[_0xf00f('0x33')]:_0x165630[_0xf00f('0x2f')];if(_0x13096e[_0xf00f('0x30')][_0xf00f('0x3d')]){_0x24f2ff['include']=[{'all':!![]}];}_0x24f2ff=_[_0xf00f('0x3a')]({},_0x24f2ff,_0x13096e[_0xf00f('0x41')]);return db[_0xf00f('0x2a')][_0xf00f('0x42')](_0x24f2ff)[_0xf00f('0x25')](handleEntityNotFound(_0x540a68,null))[_0xf00f('0x25')](respondWithResult(_0x540a68,null))[_0xf00f('0x43')](handleError(_0x540a68,null));};exports[_0xf00f('0x44')]=function(_0x3c7b2c,_0xb8980c){return db[_0xf00f('0x2a')][_0xf00f('0x44')](_0x3c7b2c[_0xf00f('0x45')],{})[_0xf00f('0x25')](respondWithResult(_0xb8980c,0xc9))['catch'](handleError(_0xb8980c,null));};exports['update']=function(_0xbee72,_0x4dac54){if(_0xbee72[_0xf00f('0x45')]['id']){delete _0xbee72[_0xf00f('0x45')]['id'];}return db[_0xf00f('0x2a')]['find']({'where':{'id':_0xbee72['params']['id']}})[_0xf00f('0x25')](handleEntityNotFound(_0x4dac54,null))[_0xf00f('0x25')](saveUpdates(_0xbee72[_0xf00f('0x45')],null))['then'](respondWithResult(_0x4dac54,null))['catch'](handleError(_0x4dac54,null));};exports['destroy']=function(_0x43fd10,_0x432ae3){return db[_0xf00f('0x2a')]['find']({'where':{'id':_0x43fd10[_0xf00f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x432ae3,null))[_0xf00f('0x25')](removeEntity(_0x432ae3,null))[_0xf00f('0x43')](handleError(_0x432ae3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index fe43860..9234d3b 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 _0xde97=['./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','FieldId','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x28cf8e,_0x304f57){var _0xbb995c=function(_0x28d9ca){while(--_0x28d9ca){_0x28cf8e['push'](_0x28cf8e['shift']());}};_0xbb995c(++_0x304f57);}(_0xde97,0x192));var _0x7de9=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xde97[_0x309d93];return _0x2dd61d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7de9('0x0'))('api');var moment=require(_0x7de9('0x1'));var BPromise=require(_0x7de9('0x2'));var rp=require(_0x7de9('0x3'));var fs=require('fs');var path=require(_0x7de9('0x4'));var rimraf=require('rimraf');var config=require(_0x7de9('0x5'));var attributes=require(_0x7de9('0x6'));module[_0x7de9('0x7')]=function(_0x2a97f0,_0x18c3e7){return _0x2a97f0[_0x7de9('0x8')](_0x7de9('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x7de9('0xa'),'fields':['idField',_0x7de9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42cf=['bluebird','path','rimraf','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','api','moment'];(function(_0x57142b,_0x458e84){var _0x136771=function(_0x285644){while(--_0x285644){_0x57142b['push'](_0x57142b['shift']());}};_0x136771(++_0x458e84);}(_0x42cf,0x99));var _0xf42c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x42cf[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xf42c('0x0'));var logger=require('../../config/logger')(_0xf42c('0x1'));var moment=require(_0xf42c('0x2'));var BPromise=require(_0xf42c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf42c('0x4'));var rimraf=require(_0xf42c('0x5'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0xf42c('0x6')]=function(_0x3aea7c,_0x32c88b){return _0x3aea7c[_0xf42c('0x7')](_0xf42c('0x8'),attributes,{'tableName':_0xf42c('0x9'),'paranoid':![],'indexes':[{'name':_0xf42c('0xa'),'fields':[_0xf42c('0xb'),_0xf42c('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 cb41110..18d5e2b 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x30b4a6,_0x1adb56){var _0x4bb363=function(_0x1cfd41){while(--_0x1cfd41){_0x30b4a6['push'](_0x30b4a6['shift']());}};_0x4bb363(++_0x1adb56);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac4a,0x13f));var _0xaac4=function(_0x36cc58,_0x5f53a4){_0x36cc58=_0x36cc58-0x0;var _0x5ba405=_0xac4a[_0x36cc58];return _0x5ba405;};'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 99ae776..f026334 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(_0x5a5a61,_0x59f816){var _0x46a0d2=function(_0x1b5614){while(--_0x1b5614){_0x5a5a61['push'](_0x5a5a61['shift']());}};_0x46a0d2(++_0x59f816);}(_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/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(_0x37ee8f,_0x510e5a){var _0x293538=function(_0x25e726){while(--_0x25e726){_0x37ee8f['push'](_0x37ee8f['shift']());}};_0x293538(++_0x510e5a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5a9920e..ba47b5e 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(_0x31a3a4,_0x50c39a){var _0x2b9db0=function(_0xe5e3d3){while(--_0xe5e3d3){_0x31a3a4['push'](_0x31a3a4['shift']());}};_0x2b9db0(++_0x50c39a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x56c182,_0x2679ef){var _0x5cc5a0=function(_0x2902e6){while(--_0x2902e6){_0x56c182['push'](_0x56c182['shift']());}};_0x5cc5a0(++_0x2679ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 ae0c0fb..a0e5e43 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 _0x85d2=['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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','zip-dir'];(function(_0x5e71ec,_0x420604){var _0x3c3eb5=function(_0x26570d){while(--_0x26570d){_0x5e71ec['push'](_0x5e71ec['shift']());}};_0x3c3eb5(++_0x420604);}(_0x85d2,0x176));var _0x285d=function(_0x3fade8,_0x294e51){_0x3fade8=_0x3fade8-0x0;var _0x26fa53=_0x85d2[_0x3fade8];return _0x26fa53;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x285d('0x0'));var jsonpatch=require(_0x285d('0x1'));var rp=require(_0x285d('0x2'));var moment=require(_0x285d('0x3'));var BPromise=require(_0x285d('0x4'));var Mustache=require(_0x285d('0x5'));var util=require(_0x285d('0x6'));var path=require(_0x285d('0x7'));var sox=require(_0x285d('0x8'));var csv=require(_0x285d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x285d('0xa'));var _=require(_0x285d('0xb'));var squel=require(_0x285d('0xc'));var crypto=require(_0x285d('0xd'));var jsforce=require(_0x285d('0xe'));var deskjs=require(_0x285d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x285d('0x10'));var Papa=require(_0x285d('0x11'));var Redis=require('ioredis');var authService=require(_0x285d('0x12'));var qs=require(_0x285d('0x13'));var as=require(_0x285d('0x14'));var hardwareService=require(_0x285d('0x15'));var logger=require(_0x285d('0x16'))(_0x285d('0x17'));var utils=require(_0x285d('0x18'));var config=require(_0x285d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x285d('0x1a'))['db'];var integrations=require(_0x285d('0x1b'));function respondWithStatusCode(_0x43d77b,_0x92dc6b){_0x92dc6b=_0x92dc6b||0xcc;return function(_0x356005){if(_0x356005){return _0x43d77b[_0x285d('0x1c')](_0x92dc6b);}return _0x43d77b[_0x285d('0x1d')](_0x92dc6b)[_0x285d('0x1e')]();};}function respondWithResult(_0x16b286,_0x30480d){_0x30480d=_0x30480d||0xc8;return function(_0x5a99ce){if(_0x5a99ce){return _0x16b286[_0x285d('0x1d')](_0x30480d)['json'](_0x5a99ce);}};}function respondWithFilteredResult(_0x1462fe,_0x90fded){return function(_0x5c4f67){if(_0x5c4f67){var _0x408d9f=typeof _0x90fded[_0x285d('0x1f')]==='undefined'&&typeof _0x90fded[_0x285d('0x20')]===_0x285d('0x21');var _0x25f976=_0x5c4f67[_0x285d('0x22')];var _0x48a266=_0x408d9f?0x0:_0x90fded[_0x285d('0x1f')];var _0x5677d7=_0x408d9f?_0x5c4f67['count']:_0x90fded['offset']+_0x90fded[_0x285d('0x20')];var _0xd909c7;if(_0x5677d7>=_0x25f976){_0x5677d7=_0x25f976;_0xd909c7=0xc8;}else{_0xd909c7=0xce;}_0x1462fe[_0x285d('0x1d')](_0xd909c7);return _0x1462fe[_0x285d('0x23')](_0x285d('0x24'),_0x48a266+'-'+_0x5677d7+'/'+_0x25f976)[_0x285d('0x25')](_0x5c4f67);}return null;};}function patchUpdates(_0x130e6f){return function(_0x15d13a){try{jsonpatch[_0x285d('0x26')](_0x15d13a,_0x130e6f,!![]);}catch(_0x3dd71a){return BPromise['reject'](_0x3dd71a);}return _0x15d13a[_0x285d('0x27')]();};}function saveUpdates(_0x5765d6,_0x5d915a){return function(_0x521639){if(_0x521639){return _0x521639[_0x285d('0x28')](_0x5765d6)[_0x285d('0x29')](function(_0x401dd8){return _0x401dd8;});}return null;};}function removeEntity(_0x300dfb,_0x2ec52b){return function(_0xfc2004){if(_0xfc2004){return _0xfc2004['destroy']()['then'](function(){_0x300dfb[_0x285d('0x1d')](0xcc)[_0x285d('0x1e')]();});}};}function handleEntityNotFound(_0x5042e6,_0x2a9bca){return function(_0x10bd9e){if(!_0x10bd9e){_0x5042e6[_0x285d('0x1c')](0x194);}return _0x10bd9e;};}function handleError(_0x1b39dc,_0x5bea9c){_0x5bea9c=_0x5bea9c||0x1f4;return function(_0x1c27d3){logger['error'](_0x1c27d3['stack']);if(_0x1c27d3[_0x285d('0x2a')]){delete _0x1c27d3[_0x285d('0x2a')];}_0x1b39dc['status'](_0x5bea9c)[_0x285d('0x2b')](_0x1c27d3);};}exports[_0x285d('0x2c')]=function(_0x1e4baa,_0x56b5b9){var _0x50b799={},_0x3ca113={},_0x283a7e={'count':0x0,'rows':[]};var _0x592dd8=_[_0x285d('0x2d')](db[_0x285d('0x2e')][_0x285d('0x2f')],function(_0x455ae2){return{'name':_0x455ae2[_0x285d('0x30')],'type':_0x455ae2[_0x285d('0x31')]['key']};});_0x3ca113['model']=_['map'](_0x592dd8,'name');_0x3ca113['query']=_['keys'](_0x1e4baa[_0x285d('0x32')]);_0x3ca113[_0x285d('0x33')]=_[_0x285d('0x34')](_0x3ca113['model'],_0x3ca113[_0x285d('0x32')]);_0x50b799[_0x285d('0x35')]=_['intersection'](_0x3ca113[_0x285d('0x36')],qs['fields'](_0x1e4baa[_0x285d('0x32')][_0x285d('0x37')]));_0x50b799[_0x285d('0x35')]=_0x50b799[_0x285d('0x35')][_0x285d('0x38')]?_0x50b799[_0x285d('0x35')]:_0x3ca113[_0x285d('0x36')];if(!_0x1e4baa['query'][_0x285d('0x39')](_0x285d('0x3a'))){_0x50b799[_0x285d('0x20')]=qs[_0x285d('0x20')](_0x1e4baa[_0x285d('0x32')][_0x285d('0x20')]);_0x50b799[_0x285d('0x1f')]=qs[_0x285d('0x1f')](_0x1e4baa[_0x285d('0x32')][_0x285d('0x1f')]);}_0x50b799[_0x285d('0x3b')]=qs[_0x285d('0x3c')](_0x1e4baa[_0x285d('0x32')][_0x285d('0x3c')]);_0x50b799[_0x285d('0x3d')]=qs[_0x285d('0x33')](_[_0x285d('0x3e')](_0x1e4baa['query'],_0x3ca113[_0x285d('0x33')]),_0x592dd8);if(_0x1e4baa[_0x285d('0x32')][_0x285d('0x3f')]){_0x50b799[_0x285d('0x3d')]=_[_0x285d('0x40')](_0x50b799[_0x285d('0x3d')],{'$or':_[_0x285d('0x2d')](_0x592dd8,function(_0x3cae53){if(_0x3cae53['type']!==_0x285d('0x41')){var _0x5adfbb={};_0x5adfbb[_0x3cae53[_0x285d('0x2a')]]={'$like':'%'+_0x1e4baa['query'][_0x285d('0x3f')]+'%'};return _0x5adfbb;}})});}_0x50b799=_[_0x285d('0x40')]({},_0x50b799,_0x1e4baa[_0x285d('0x42')]);var _0x5c05b0={'where':_0x50b799['where']};return db['SugarcrmAccount'][_0x285d('0x22')](_0x5c05b0)['then'](function(_0x3bec9a){_0x283a7e['count']=_0x3bec9a;if(_0x1e4baa['query'][_0x285d('0x43')]){_0x50b799[_0x285d('0x44')]=[{'all':!![]}];}return db[_0x285d('0x2e')][_0x285d('0x45')](_0x50b799);})[_0x285d('0x29')](function(_0x2112a8){_0x283a7e['rows']=_0x2112a8;return _0x283a7e;})['then'](respondWithFilteredResult(_0x56b5b9,_0x50b799))[_0x285d('0x46')](handleError(_0x56b5b9,null));};exports[_0x285d('0x47')]=function(_0x10f186,_0x5bf01a){var _0x37a432={'raw':![],'where':{'id':_0x10f186[_0x285d('0x48')]['id']}},_0x39588a={};_0x39588a[_0x285d('0x36')]=_[_0x285d('0x49')](db[_0x285d('0x2e')]['rawAttributes']);_0x39588a[_0x285d('0x32')]=_['keys'](_0x10f186[_0x285d('0x32')]);_0x39588a['filters']=_[_0x285d('0x34')](_0x39588a['model'],_0x39588a[_0x285d('0x32')]);_0x37a432[_0x285d('0x35')]=_[_0x285d('0x34')](_0x39588a[_0x285d('0x36')],qs[_0x285d('0x37')](_0x10f186[_0x285d('0x32')][_0x285d('0x37')]));_0x37a432['attributes']=_0x37a432[_0x285d('0x35')][_0x285d('0x38')]?_0x37a432['attributes']:_0x39588a[_0x285d('0x36')];if(_0x10f186[_0x285d('0x32')][_0x285d('0x43')]){_0x37a432['include']=[{'all':!![]}];}_0x37a432=_[_0x285d('0x40')]({},_0x37a432,_0x10f186[_0x285d('0x42')]);return db['SugarcrmAccount'][_0x285d('0x4a')](_0x37a432)[_0x285d('0x29')](handleEntityNotFound(_0x5bf01a,null))[_0x285d('0x29')](respondWithResult(_0x5bf01a,null))['catch'](handleError(_0x5bf01a,null));};exports[_0x285d('0x4b')]=function(_0x3e2eb3,_0x343423){return db[_0x285d('0x2e')][_0x285d('0x4b')](_0x3e2eb3[_0x285d('0x4c')],{})[_0x285d('0x29')](respondWithResult(_0x343423,0xc9))['catch'](handleError(_0x343423,null));};exports[_0x285d('0x28')]=function(_0x2354b3,_0x29b78f){if(_0x2354b3[_0x285d('0x4c')]['id']){delete _0x2354b3[_0x285d('0x4c')]['id'];}return db['SugarcrmAccount'][_0x285d('0x4a')]({'where':{'id':_0x2354b3[_0x285d('0x48')]['id']}})[_0x285d('0x29')](handleEntityNotFound(_0x29b78f,null))[_0x285d('0x29')](saveUpdates(_0x2354b3[_0x285d('0x4c')],null))[_0x285d('0x29')](respondWithResult(_0x29b78f,null))[_0x285d('0x46')](handleError(_0x29b78f,null));};exports[_0x285d('0x4d')]=function(_0x52aea3,_0x17541b){return db[_0x285d('0x2e')][_0x285d('0x4a')]({'where':{'id':_0x52aea3[_0x285d('0x48')]['id']}})[_0x285d('0x29')](handleEntityNotFound(_0x17541b,null))[_0x285d('0x29')](removeEntity(_0x17541b,null))['catch'](handleError(_0x17541b,null));};exports[_0x285d('0x4e')]=function(_0x53edb0,_0x52f05a,_0x2bc82a){var _0x7db49f={};var _0x368883={};var _0x52c226;var _0x3210d2;return db[_0x285d('0x2e')][_0x285d('0x4f')]({'where':{'id':_0x53edb0['params']['id']}})['then'](handleEntityNotFound(_0x52f05a,null))['then'](function(_0x14ea9b){if(_0x14ea9b){_0x52c226=_0x14ea9b;_0x368883[_0x285d('0x36')]=_[_0x285d('0x49')](db[_0x285d('0x50')][_0x285d('0x2f')]);_0x368883[_0x285d('0x32')]=_[_0x285d('0x49')](_0x53edb0[_0x285d('0x32')]);_0x368883[_0x285d('0x33')]=_['intersection'](_0x368883['model'],_0x368883['query']);_0x7db49f[_0x285d('0x35')]=_[_0x285d('0x34')](_0x368883[_0x285d('0x36')],qs[_0x285d('0x37')](_0x53edb0[_0x285d('0x32')][_0x285d('0x37')]));_0x7db49f[_0x285d('0x35')]=_0x7db49f[_0x285d('0x35')][_0x285d('0x38')]?_0x7db49f[_0x285d('0x35')]:_0x368883[_0x285d('0x36')];_0x7db49f[_0x285d('0x3b')]=qs['sort'](_0x53edb0[_0x285d('0x32')][_0x285d('0x3c')]);_0x7db49f[_0x285d('0x3d')]=qs['filters'](_[_0x285d('0x3e')](_0x53edb0[_0x285d('0x32')],_0x368883[_0x285d('0x33')]));if(_0x53edb0['query'][_0x285d('0x3f')]){_0x7db49f['where']=_[_0x285d('0x40')](_0x7db49f[_0x285d('0x3d')],{'$or':_[_0x285d('0x2d')](_0x7db49f[_0x285d('0x35')],function(_0x3b38a0){var _0x11f3a0={};_0x11f3a0[_0x3b38a0]={'$like':'%'+_0x53edb0[_0x285d('0x32')][_0x285d('0x3f')]+'%'};return _0x11f3a0;})});}_0x7db49f=_[_0x285d('0x40')]({},_0x7db49f,_0x53edb0[_0x285d('0x42')]);return _0x52c226[_0x285d('0x4e')](_0x7db49f);}})['then'](function(_0x592208){if(_0x592208){_0x3210d2=_0x592208[_0x285d('0x38')];if(!_0x53edb0[_0x285d('0x32')][_0x285d('0x39')](_0x285d('0x3a'))){_0x7db49f[_0x285d('0x20')]=qs['limit'](_0x53edb0['query']['limit']);_0x7db49f[_0x285d('0x1f')]=qs[_0x285d('0x1f')](_0x53edb0[_0x285d('0x32')][_0x285d('0x1f')]);}return _0x52c226[_0x285d('0x4e')](_0x7db49f);}})['then'](function(_0x50ad45){if(_0x50ad45){return _0x50ad45?{'count':_0x3210d2,'rows':_0x50ad45}:null;}})[_0x285d('0x29')](respondWithResult(_0x52f05a,null))['catch'](handleError(_0x52f05a,null));};exports[_0x285d('0x51')]=function(_0x1ac880,_0xcf9b16,_0x43e37a){if(_0x1ac880[_0x285d('0x4c')]['id']){delete _0x1ac880[_0x285d('0x4c')]['id'];}return db[_0x285d('0x2e')]['findOne']({'where':{'id':_0x1ac880[_0x285d('0x48')]['id']}})[_0x285d('0x29')](handleEntityNotFound(_0xcf9b16,null))[_0x285d('0x29')](function(_0x3a558e){if(_0x3a558e){_0x1ac880[_0x285d('0x4c')][_0x285d('0x52')]=_0x3a558e['id'];_0x1ac880['body']['Subjects']=integrations[_0x285d('0x53')](_0x1ac880[_0x285d('0x4c')][_0x285d('0x54')],_0x1ac880[_0x285d('0x4c')][_0x285d('0x31')]);_0x1ac880['body'][_0x285d('0x55')]=integrations[_0x285d('0x56')](_0x1ac880[_0x285d('0x4c')][_0x285d('0x54')],_0x1ac880['body']['type']);return db[_0x285d('0x50')][_0x285d('0x4b')](_0x1ac880[_0x285d('0x4c')],{'include':[{'model':db['SugarcrmField'],'as':_0x285d('0x57')},{'model':db[_0x285d('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xcf9b16,null))[_0x285d('0x46')](handleError(_0xcf9b16,null));};exports[_0x285d('0x59')]=function(_0x2f801f,_0x3b0c4d,_0x297b1b){var _0x2f6ea7='';var _0x4d8919=['id',_0x285d('0x2a'),_0x285d('0x5a'),_0x285d('0x5b'),_0x285d('0x5c'),'date_start','duration_hours',_0x285d('0x5d'),_0x285d('0x5e'),_0x285d('0x5f'),_0x285d('0x60'),_0x285d('0x61')];return db[_0x285d('0x2e')]['findOne']({'where':{'id':_0x2f801f[_0x285d('0x48')]['id']},'attributes':['id',_0x285d('0x62'),'password',_0x285d('0x63')]})[_0x285d('0x29')](handleEntityNotFound(_0x3b0c4d,null))[_0x285d('0x29')](function(_0x4354b9){if(_0x4354b9){_0x2f6ea7=_0x4354b9['remoteUri'];var _0x1796df=_0x2f6ea7['slice'](-0x1);if(_0x1796df==='/'){_0x2f6ea7=_0x2f6ea7['substring'](0x0,_0x2f6ea7[_0x285d('0x64')](_0x1796df));}return rp({'method':_0x285d('0x65'),'uri':util[_0x285d('0x66')](_0x285d('0x67'),_0x2f6ea7,_0x285d('0x68')),'json':!![],'form':{'method':_0x285d('0x69'),'input_type':'JSON','response_type':_0x285d('0x6a'),'rest_data':JSON[_0x285d('0x6b')]({'user_auth':{'user_name':_0x4354b9[_0x285d('0x62')],'password':_0x4354b9[_0x285d('0x6c')],'encryption':_0x285d('0x6d')},'application':_0x285d('0x6e')})}});}})[_0x285d('0x29')](function(_0xa4ad27){if(_0xa4ad27&&_0xa4ad27[_0x285d('0x2a')]!==_0x285d('0x6f')&&_0xa4ad27[_0x285d('0x2a')]!=='Password\x20Expired'){return rp({'method':_0x285d('0x65'),'uri':util[_0x285d('0x66')](_0x285d('0x67'),_0x2f6ea7,_0x285d('0x68')),'json':!![],'form':{'method':_0x285d('0x70'),'input_type':_0x285d('0x6a'),'response_type':'JSON','rest_data':JSON[_0x285d('0x6b')]({'session':_0xa4ad27['id'],'module_name':_0x285d('0x71')})}})[_0x285d('0x29')](function(_0x7b9aa5){if(_0x7b9aa5){var _0x53ab7a=_[_0x285d('0x72')](_0x7b9aa5[_0x285d('0x73')]);_[_0x285d('0x74')](_0x53ab7a,function(_0x37fac0){return _0x4d8919[_0x285d('0x75')](_0x37fac0[_0x285d('0x2a')]);});return{'count':_0x53ab7a[_0x285d('0x38')],'rows':_[_0x285d('0x2d')](_0x53ab7a,function(_0x28eaab){return{'id':_0x28eaab['name'],'name':_0x28eaab[_0x285d('0x76')],'custom':_[_0x285d('0x77')](_0x28eaab[_0x285d('0x2a')],'_c')?!![]:![],'options':_0x28eaab['options']?_[_0x285d('0x2d')](_[_0x285d('0x72')](_0x28eaab[_0x285d('0x42')]),function(_0x32be80){return{'name':_0x32be80[_0x285d('0x78')],'value':_0x32be80[_0x285d('0x2a')]};}):[]};})};}})[_0x285d('0x29')](respondWithResult(_0x3b0c4d,null))[_0x285d('0x46')](function(_0x2e86e8){var _0x55fae5=_0x2f801f[_0x285d('0x32')]['test']?0x1f4:_0x2e86e8[_0x285d('0x79')]||0x1f4;logger['error'](_0x285d('0x7a'),_0x285d('0x59'),_0x55fae5,JSON[_0x285d('0x6b')](_0x2e86e8));delete _0x2e86e8['name'];if(_0x55fae5===0x191){_0x55fae5=0x190;}_0x3b0c4d[_0x285d('0x1d')](_0x55fae5)[_0x285d('0x2b')](_0x2f801f['query'][_0x285d('0x7b')]?{'message':_0x285d('0x7c'),'statusCode':_0x2e86e8[_0x285d('0x79')]}:_0x2e86e8);});}else{var _0x768edc=0x1f4;_0x3b0c4d['status'](_0x768edc)[_0x285d('0x2b')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9c18=['destroy','status','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','findOne','password','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','Calls','module_fields','remove','includes','label','endsWith','values','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','count','limit','Content-Range','apply','reject','save','then'];(function(_0x30d618,_0x590668){var _0x39731a=function(_0x53e0fe){while(--_0x53e0fe){_0x30d618['push'](_0x30d618['shift']());}};_0x39731a(++_0x590668);}(_0x9c18,0x153));var _0x89c1=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x9c18[_0x28d18d];return _0x470640;};'use strict';var emlformat=require(_0x89c1('0x0'));var rimraf=require(_0x89c1('0x1'));var zipdir=require(_0x89c1('0x2'));var jsonpatch=require(_0x89c1('0x3'));var rp=require('request-promise');var moment=require(_0x89c1('0x4'));var BPromise=require(_0x89c1('0x5'));var Mustache=require(_0x89c1('0x6'));var util=require(_0x89c1('0x7'));var path=require('path');var sox=require(_0x89c1('0x8'));var csv=require(_0x89c1('0x9'));var ejs=require(_0x89c1('0xa'));var fs=require('fs');var fs_extra=require(_0x89c1('0xb'));var _=require(_0x89c1('0xc'));var squel=require(_0x89c1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x89c1('0xe'));var toCsv=require(_0x89c1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x89c1('0xf'));var authService=require(_0x89c1('0x10'));var qs=require(_0x89c1('0x11'));var as=require(_0x89c1('0x12'));var hardwareService=require(_0x89c1('0x13'));var logger=require(_0x89c1('0x14'))('api');var utils=require(_0x89c1('0x15'));var config=require(_0x89c1('0x16'));var licenseUtil=require(_0x89c1('0x17'));var db=require(_0x89c1('0x18'))['db'];var integrations=require(_0x89c1('0x19'));function respondWithStatusCode(_0x31fd1e,_0x502424){_0x502424=_0x502424||0xcc;return function(_0x1e6de7){if(_0x1e6de7){return _0x31fd1e[_0x89c1('0x1a')](_0x502424);}return _0x31fd1e['status'](_0x502424)['end']();};}function respondWithResult(_0x2daac1,_0x322986){_0x322986=_0x322986||0xc8;return function(_0x20bd4c){if(_0x20bd4c){return _0x2daac1['status'](_0x322986)[_0x89c1('0x1b')](_0x20bd4c);}};}function respondWithFilteredResult(_0x553f52,_0x5a6a39){return function(_0x14685a){if(_0x14685a){var _0x100bae=typeof _0x5a6a39[_0x89c1('0x1c')]==='undefined'&&typeof _0x5a6a39['limit']==='undefined';var _0xdc49ac=_0x14685a[_0x89c1('0x1d')];var _0x301115=_0x100bae?0x0:_0x5a6a39['offset'];var _0x350070=_0x100bae?_0x14685a['count']:_0x5a6a39[_0x89c1('0x1c')]+_0x5a6a39[_0x89c1('0x1e')];var _0x2b0592;if(_0x350070>=_0xdc49ac){_0x350070=_0xdc49ac;_0x2b0592=0xc8;}else{_0x2b0592=0xce;}_0x553f52['status'](_0x2b0592);return _0x553f52['set'](_0x89c1('0x1f'),_0x301115+'-'+_0x350070+'/'+_0xdc49ac)[_0x89c1('0x1b')](_0x14685a);}return null;};}function patchUpdates(_0x2a3dbc){return function(_0x2eacb4){try{jsonpatch[_0x89c1('0x20')](_0x2eacb4,_0x2a3dbc,!![]);}catch(_0x709778){return BPromise[_0x89c1('0x21')](_0x709778);}return _0x2eacb4[_0x89c1('0x22')]();};}function saveUpdates(_0x377d7c,_0x381327){return function(_0x1bc842){if(_0x1bc842){return _0x1bc842['update'](_0x377d7c)[_0x89c1('0x23')](function(_0x387f06){return _0x387f06;});}return null;};}function removeEntity(_0x42f5ff,_0x4e571b){return function(_0x15053f){if(_0x15053f){return _0x15053f[_0x89c1('0x24')]()[_0x89c1('0x23')](function(){_0x42f5ff[_0x89c1('0x25')](0xcc)[_0x89c1('0x26')]();});}};}function handleEntityNotFound(_0x579f3e,_0x33376c){return function(_0xc1917e){if(!_0xc1917e){_0x579f3e['sendStatus'](0x194);}return _0xc1917e;};}function handleError(_0x47c7c8,_0xb74115){_0xb74115=_0xb74115||0x1f4;return function(_0x548e7d){logger[_0x89c1('0x27')](_0x548e7d[_0x89c1('0x28')]);if(_0x548e7d[_0x89c1('0x29')]){delete _0x548e7d['name'];}_0x47c7c8[_0x89c1('0x25')](_0xb74115)['send'](_0x548e7d);};}exports[_0x89c1('0x2a')]=function(_0x442042,_0xb7f9b7){var _0x543749={},_0x1f7bc7={},_0x429cfa={'count':0x0,'rows':[]};var _0x4b18ee=_[_0x89c1('0x2b')](db['SugarcrmAccount'][_0x89c1('0x2c')],function(_0x290eef){return{'name':_0x290eef[_0x89c1('0x2d')],'type':_0x290eef[_0x89c1('0x2e')][_0x89c1('0x2f')]};});_0x1f7bc7[_0x89c1('0x30')]=_[_0x89c1('0x2b')](_0x4b18ee,_0x89c1('0x29'));_0x1f7bc7[_0x89c1('0x31')]=_[_0x89c1('0x32')](_0x442042['query']);_0x1f7bc7[_0x89c1('0x33')]=_[_0x89c1('0x34')](_0x1f7bc7['model'],_0x1f7bc7[_0x89c1('0x31')]);_0x543749[_0x89c1('0x35')]=_[_0x89c1('0x34')](_0x1f7bc7[_0x89c1('0x30')],qs['fields'](_0x442042[_0x89c1('0x31')][_0x89c1('0x36')]));_0x543749['attributes']=_0x543749[_0x89c1('0x35')][_0x89c1('0x37')]?_0x543749[_0x89c1('0x35')]:_0x1f7bc7['model'];if(!_0x442042[_0x89c1('0x31')][_0x89c1('0x38')](_0x89c1('0x39'))){_0x543749['limit']=qs[_0x89c1('0x1e')](_0x442042[_0x89c1('0x31')][_0x89c1('0x1e')]);_0x543749[_0x89c1('0x1c')]=qs[_0x89c1('0x1c')](_0x442042[_0x89c1('0x31')]['offset']);}_0x543749[_0x89c1('0x3a')]=qs[_0x89c1('0x3b')](_0x442042[_0x89c1('0x31')][_0x89c1('0x3b')]);_0x543749[_0x89c1('0x3c')]=qs[_0x89c1('0x33')](_[_0x89c1('0x3d')](_0x442042['query'],_0x1f7bc7[_0x89c1('0x33')]),_0x4b18ee);if(_0x442042[_0x89c1('0x31')]['filter']){_0x543749['where']=_[_0x89c1('0x3e')](_0x543749[_0x89c1('0x3c')],{'$or':_[_0x89c1('0x2b')](_0x4b18ee,function(_0x335808){if(_0x335808[_0x89c1('0x2e')]!==_0x89c1('0x3f')){var _0x4b04b5={};_0x4b04b5[_0x335808[_0x89c1('0x29')]]={'$like':'%'+_0x442042[_0x89c1('0x31')][_0x89c1('0x40')]+'%'};return _0x4b04b5;}})});}_0x543749=_[_0x89c1('0x3e')]({},_0x543749,_0x442042['options']);var _0x1c0f3c={'where':_0x543749['where']};return db[_0x89c1('0x41')][_0x89c1('0x1d')](_0x1c0f3c)[_0x89c1('0x23')](function(_0x2b1f55){_0x429cfa[_0x89c1('0x1d')]=_0x2b1f55;if(_0x442042[_0x89c1('0x31')][_0x89c1('0x42')]){_0x543749[_0x89c1('0x43')]=[{'all':!![]}];}return db[_0x89c1('0x41')][_0x89c1('0x44')](_0x543749);})['then'](function(_0x2a8dd0){_0x429cfa[_0x89c1('0x45')]=_0x2a8dd0;return _0x429cfa;})[_0x89c1('0x23')](respondWithFilteredResult(_0xb7f9b7,_0x543749))[_0x89c1('0x46')](handleError(_0xb7f9b7,null));};exports[_0x89c1('0x47')]=function(_0x3ffdcb,_0x5d7b96){var _0x14cb8e={'raw':![],'where':{'id':_0x3ffdcb[_0x89c1('0x48')]['id']}},_0x4f569c={};_0x4f569c[_0x89c1('0x30')]=_[_0x89c1('0x32')](db[_0x89c1('0x41')][_0x89c1('0x2c')]);_0x4f569c['query']=_['keys'](_0x3ffdcb[_0x89c1('0x31')]);_0x4f569c[_0x89c1('0x33')]=_[_0x89c1('0x34')](_0x4f569c[_0x89c1('0x30')],_0x4f569c[_0x89c1('0x31')]);_0x14cb8e[_0x89c1('0x35')]=_[_0x89c1('0x34')](_0x4f569c[_0x89c1('0x30')],qs[_0x89c1('0x36')](_0x3ffdcb[_0x89c1('0x31')][_0x89c1('0x36')]));_0x14cb8e[_0x89c1('0x35')]=_0x14cb8e['attributes'][_0x89c1('0x37')]?_0x14cb8e[_0x89c1('0x35')]:_0x4f569c['model'];if(_0x3ffdcb[_0x89c1('0x31')][_0x89c1('0x42')]){_0x14cb8e['include']=[{'all':!![]}];}_0x14cb8e=_[_0x89c1('0x3e')]({},_0x14cb8e,_0x3ffdcb[_0x89c1('0x49')]);return db[_0x89c1('0x41')][_0x89c1('0x4a')](_0x14cb8e)['then'](handleEntityNotFound(_0x5d7b96,null))[_0x89c1('0x23')](respondWithResult(_0x5d7b96,null))['catch'](handleError(_0x5d7b96,null));};exports[_0x89c1('0x4b')]=function(_0x396e31,_0x40f918){return db['SugarcrmAccount'][_0x89c1('0x4b')](_0x396e31[_0x89c1('0x4c')],{})['then'](respondWithResult(_0x40f918,0xc9))[_0x89c1('0x46')](handleError(_0x40f918,null));};exports[_0x89c1('0x4d')]=function(_0x1f9f89,_0x1d6d20){if(_0x1f9f89[_0x89c1('0x4c')]['id']){delete _0x1f9f89[_0x89c1('0x4c')]['id'];}return db[_0x89c1('0x41')][_0x89c1('0x4a')]({'where':{'id':_0x1f9f89[_0x89c1('0x48')]['id']}})[_0x89c1('0x23')](handleEntityNotFound(_0x1d6d20,null))[_0x89c1('0x23')](saveUpdates(_0x1f9f89[_0x89c1('0x4c')],null))[_0x89c1('0x23')](respondWithResult(_0x1d6d20,null))[_0x89c1('0x46')](handleError(_0x1d6d20,null));};exports['destroy']=function(_0x516740,_0x5d5c33){return db[_0x89c1('0x41')][_0x89c1('0x4a')]({'where':{'id':_0x516740[_0x89c1('0x48')]['id']}})[_0x89c1('0x23')](handleEntityNotFound(_0x5d5c33,null))[_0x89c1('0x23')](removeEntity(_0x5d5c33,null))[_0x89c1('0x46')](handleError(_0x5d5c33,null));};exports[_0x89c1('0x4e')]=function(_0x347261,_0x4ece4b,_0x369871){var _0x559a73={};var _0x142415={};var _0x3d50b2;var _0x120b6c;return db[_0x89c1('0x41')]['findOne']({'where':{'id':_0x347261[_0x89c1('0x48')]['id']}})[_0x89c1('0x23')](handleEntityNotFound(_0x4ece4b,null))[_0x89c1('0x23')](function(_0x196b23){if(_0x196b23){_0x3d50b2=_0x196b23;_0x142415['model']=_[_0x89c1('0x32')](db['SugarcrmConfiguration'][_0x89c1('0x2c')]);_0x142415[_0x89c1('0x31')]=_[_0x89c1('0x32')](_0x347261[_0x89c1('0x31')]);_0x142415[_0x89c1('0x33')]=_[_0x89c1('0x34')](_0x142415[_0x89c1('0x30')],_0x142415[_0x89c1('0x31')]);_0x559a73[_0x89c1('0x35')]=_[_0x89c1('0x34')](_0x142415[_0x89c1('0x30')],qs[_0x89c1('0x36')](_0x347261[_0x89c1('0x31')][_0x89c1('0x36')]));_0x559a73[_0x89c1('0x35')]=_0x559a73[_0x89c1('0x35')][_0x89c1('0x37')]?_0x559a73[_0x89c1('0x35')]:_0x142415[_0x89c1('0x30')];_0x559a73[_0x89c1('0x3a')]=qs[_0x89c1('0x3b')](_0x347261['query'][_0x89c1('0x3b')]);_0x559a73[_0x89c1('0x3c')]=qs['filters'](_[_0x89c1('0x3d')](_0x347261['query'],_0x142415['filters']));if(_0x347261['query'][_0x89c1('0x40')]){_0x559a73['where']=_['merge'](_0x559a73['where'],{'$or':_[_0x89c1('0x2b')](_0x559a73[_0x89c1('0x35')],function(_0x82a11a){var _0x184025={};_0x184025[_0x82a11a]={'$like':'%'+_0x347261[_0x89c1('0x31')][_0x89c1('0x40')]+'%'};return _0x184025;})});}_0x559a73=_[_0x89c1('0x3e')]({},_0x559a73,_0x347261['options']);return _0x3d50b2[_0x89c1('0x4e')](_0x559a73);}})[_0x89c1('0x23')](function(_0x5c9aa1){if(_0x5c9aa1){_0x120b6c=_0x5c9aa1[_0x89c1('0x37')];if(!_0x347261[_0x89c1('0x31')][_0x89c1('0x38')](_0x89c1('0x39'))){_0x559a73['limit']=qs[_0x89c1('0x1e')](_0x347261['query'][_0x89c1('0x1e')]);_0x559a73['offset']=qs['offset'](_0x347261[_0x89c1('0x31')][_0x89c1('0x1c')]);}return _0x3d50b2[_0x89c1('0x4e')](_0x559a73);}})[_0x89c1('0x23')](function(_0x20b570){if(_0x20b570){return _0x20b570?{'count':_0x120b6c,'rows':_0x20b570}:null;}})[_0x89c1('0x23')](respondWithResult(_0x4ece4b,null))[_0x89c1('0x46')](handleError(_0x4ece4b,null));};exports[_0x89c1('0x4f')]=function(_0x288eeb,_0x12cf0e,_0x312dad){if(_0x288eeb[_0x89c1('0x4c')]['id']){delete _0x288eeb['body']['id'];}return db[_0x89c1('0x41')]['findOne']({'where':{'id':_0x288eeb[_0x89c1('0x48')]['id']}})[_0x89c1('0x23')](handleEntityNotFound(_0x12cf0e,null))[_0x89c1('0x23')](function(_0x372122){if(_0x372122){_0x288eeb[_0x89c1('0x4c')]['AccountId']=_0x372122['id'];_0x288eeb['body'][_0x89c1('0x50')]=integrations[_0x89c1('0x51')](_0x288eeb[_0x89c1('0x4c')][_0x89c1('0x52')],_0x288eeb[_0x89c1('0x4c')][_0x89c1('0x2e')]);_0x288eeb['body'][_0x89c1('0x53')]=integrations[_0x89c1('0x54')](_0x288eeb['body']['channel'],_0x288eeb[_0x89c1('0x4c')][_0x89c1('0x2e')]);return db[_0x89c1('0x55')]['create'](_0x288eeb[_0x89c1('0x4c')],{'include':[{'model':db['SugarcrmField'],'as':_0x89c1('0x50')},{'model':db[_0x89c1('0x56')],'as':_0x89c1('0x53')}]});}return null;})['then'](respondWithResult(_0x12cf0e,null))[_0x89c1('0x46')](handleError(_0x12cf0e,null));};exports[_0x89c1('0x57')]=function(_0x55200e,_0x370ced,_0x52fea7){var _0x4d38a6='';var _0x3ed40a=['id',_0x89c1('0x29'),_0x89c1('0x58'),_0x89c1('0x59'),_0x89c1('0x5a'),'date_start',_0x89c1('0x5b'),_0x89c1('0x5c'),'parent_id',_0x89c1('0x5d'),_0x89c1('0x5e'),_0x89c1('0x5f')];return db[_0x89c1('0x41')][_0x89c1('0x60')]({'where':{'id':_0x55200e['params']['id']},'attributes':['id','username',_0x89c1('0x61'),'remoteUri']})[_0x89c1('0x23')](handleEntityNotFound(_0x370ced,null))[_0x89c1('0x23')](function(_0x3d6134){if(_0x3d6134){_0x4d38a6=_0x3d6134['remoteUri'];var _0x9b2d09=_0x4d38a6[_0x89c1('0x62')](-0x1);if(_0x9b2d09==='/'){_0x4d38a6=_0x4d38a6['substring'](0x0,_0x4d38a6[_0x89c1('0x63')](_0x9b2d09));}return rp({'method':_0x89c1('0x64'),'uri':util[_0x89c1('0x65')](_0x89c1('0x66'),_0x4d38a6,_0x89c1('0x67')),'json':!![],'form':{'method':_0x89c1('0x68'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x89c1('0x69')]({'user_auth':{'user_name':_0x3d6134[_0x89c1('0x6a')],'password':_0x3d6134[_0x89c1('0x61')],'encryption':_0x89c1('0x6b')},'application':_0x89c1('0x6c')})}});}})[_0x89c1('0x23')](function(_0x4b81f2){if(_0x4b81f2&&_0x4b81f2[_0x89c1('0x29')]!==_0x89c1('0x6d')&&_0x4b81f2[_0x89c1('0x29')]!==_0x89c1('0x6e')){return rp({'method':_0x89c1('0x64'),'uri':util['format']('%s%s',_0x4d38a6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x89c1('0x6f'),'input_type':_0x89c1('0x70'),'response_type':_0x89c1('0x70'),'rest_data':JSON[_0x89c1('0x69')]({'session':_0x4b81f2['id'],'module_name':_0x89c1('0x71')})}})[_0x89c1('0x23')](function(_0x779244){if(_0x779244){var _0x528c1c=_['values'](_0x779244[_0x89c1('0x72')]);_[_0x89c1('0x73')](_0x528c1c,function(_0x4d2524){return _0x3ed40a[_0x89c1('0x74')](_0x4d2524[_0x89c1('0x29')]);});return{'count':_0x528c1c[_0x89c1('0x37')],'rows':_[_0x89c1('0x2b')](_0x528c1c,function(_0x96f302){return{'id':_0x96f302[_0x89c1('0x29')],'name':_0x96f302[_0x89c1('0x75')],'custom':_[_0x89c1('0x76')](_0x96f302[_0x89c1('0x29')],'_c')?!![]:![],'options':_0x96f302['options']?_[_0x89c1('0x2b')](_[_0x89c1('0x77')](_0x96f302[_0x89c1('0x49')]),function(_0x3fdc6e){return{'name':_0x3fdc6e['value'],'value':_0x3fdc6e[_0x89c1('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x370ced,null))[_0x89c1('0x46')](function(_0x23306a){var _0x21a48b=_0x55200e[_0x89c1('0x31')]['test']?0x1f4:_0x23306a['statusCode']||0x1f4;logger[_0x89c1('0x27')](_0x89c1('0x78'),_0x89c1('0x57'),_0x21a48b,JSON[_0x89c1('0x69')](_0x23306a));delete _0x23306a[_0x89c1('0x29')];if(_0x21a48b===0x191){_0x21a48b=0x190;}_0x370ced[_0x89c1('0x25')](_0x21a48b)['send'](_0x55200e[_0x89c1('0x31')][_0x89c1('0x79')]?{'message':_0x89c1('0x7a'),'statusCode':_0x23306a[_0x89c1('0x7b')]}:_0x23306a);});}else{var _0x103a0a=0x1f4;_0x370ced[_0x89c1('0x25')](_0x103a0a)[_0x89c1('0x7c')]({'message':_0x89c1('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index f273f31..9ed6b0f 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 _0xf9c9=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf9c9,0x1b3));var _0x9f9c=function(_0x295317,_0x46aebf){_0x295317=_0x295317-0x0;var _0x458246=_0xf9c9[_0x295317];return _0x458246;};'use strict';var _=require(_0x9f9c('0x0'));var util=require(_0x9f9c('0x1'));var logger=require(_0x9f9c('0x2'))(_0x9f9c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f9c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f9c('0x5'));var config=require(_0x9f9c('0x6'));var attributes=require(_0x9f9c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x9f9c('0x8')]=function(_0x3847f4,_0x364575){return _0x3847f4[_0x9f9c('0x9')](_0x9f9c('0xa'),attributes,{'tableName':_0x9f9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c90=['bluebird','request-promise','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x17d33d,_0x5b117e){var _0x26a637=function(_0x12c043){while(--_0x12c043){_0x17d33d['push'](_0x17d33d['shift']());}};_0x26a637(++_0x5b117e);}(_0x9c90,0x1e7));var _0x09c9=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x9c90[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x09c9('0x0'));var util=require(_0x09c9('0x1'));var logger=require(_0x09c9('0x2'))(_0x09c9('0x3'));var moment=require(_0x09c9('0x4'));var BPromise=require(_0x09c9('0x5'));var rp=require(_0x09c9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09c9('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x09c9('0x8')]=function(_0xfcfd8b,_0xc75e70){return _0xfcfd8b[_0x09c9('0x9')](_0x09c9('0xa'),attributes,{'tableName':_0x09c9('0xb'),'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 56639d7..0c64ac7 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 _0x5c9b=['include','model','map','then','catch','find','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes'];(function(_0x586a03,_0x39a933){var _0x2cd523=function(_0x50c3d){while(--_0x50c3d){_0x586a03['push'](_0x586a03['shift']());}};_0x2cd523(++_0x39a933);}(_0x5c9b,0x1c4));var _0xb5c9=function(_0x1506c7,_0x456425){_0x1506c7=_0x1506c7-0x0;var _0x616f41=_0x5c9b[_0x1506c7];return _0x616f41;};'use strict';var _=require(_0xb5c9('0x0'));var util=require(_0xb5c9('0x1'));var moment=require(_0xb5c9('0x2'));var BPromise=require(_0xb5c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5c9('0x4'));var db=require(_0xb5c9('0x5'))['db'];var utils=require(_0xb5c9('0x6'));var logger=require(_0xb5c9('0x7'))(_0xb5c9('0x8'));var config=require(_0xb5c9('0x9'));var jayson=require(_0xb5c9('0xa'));var client=jayson[_0xb5c9('0xb')][_0xb5c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x487a58,_0x4f8009,_0x2a08dc){return new BPromise(function(_0x25362c,_0x57fc31){return client['request'](_0x487a58,_0x2a08dc)['then'](function(_0x20eed8){logger[_0xb5c9('0xd')](_0xb5c9('0xe'),_0x4f8009,'request\x20sent');logger[_0xb5c9('0xf')](_0xb5c9('0x10'),_0x4f8009,_0xb5c9('0x11'),JSON[_0xb5c9('0x12')](_0x20eed8));if(_0x20eed8[_0xb5c9('0x13')]){if(_0x20eed8[_0xb5c9('0x13')][_0xb5c9('0x14')]===0x1f4){logger['error'](_0xb5c9('0xe'),_0x4f8009,_0x20eed8[_0xb5c9('0x13')][_0xb5c9('0x15')]);return _0x57fc31(_0x20eed8[_0xb5c9('0x13')]['message']);}logger['error'](_0xb5c9('0xe'),_0x4f8009,_0x20eed8[_0xb5c9('0x13')][_0xb5c9('0x15')]);return _0x25362c(_0x20eed8[_0xb5c9('0x13')]['message']);}else{logger[_0xb5c9('0xd')](_0xb5c9('0xe'),_0x4f8009,_0xb5c9('0x11'));_0x25362c(_0x20eed8[_0xb5c9('0x16')][_0xb5c9('0x15')]);}})['catch'](function(_0x160161){logger[_0xb5c9('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f8009,_0x160161);_0x57fc31(_0x160161);});});}exports[_0xb5c9('0x17')]=function(_0x2f71dc){var _0x45b203=this;return new Promise(function(_0x1b561e,_0x4b3c84){return db[_0xb5c9('0x18')][_0xb5c9('0x19')]({'raw':_0x2f71dc['options']?_0x2f71dc[_0xb5c9('0x1a')][_0xb5c9('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f71dc[_0xb5c9('0x1a')]?_0x2f71dc[_0xb5c9('0x1a')]['where']||null:null,'attributes':_0x2f71dc[_0xb5c9('0x1a')]?_0x2f71dc[_0xb5c9('0x1a')][_0xb5c9('0x1c')]||null:null,'limit':_0x2f71dc['options']?_0x2f71dc['options']['limit']||null:null,'include':_0x2f71dc[_0xb5c9('0x1a')]?_0x2f71dc[_0xb5c9('0x1a')][_0xb5c9('0x1d')]?_['map'](_0x2f71dc[_0xb5c9('0x1a')][_0xb5c9('0x1d')],function(_0x5b444c){return{'model':db[_0x5b444c[_0xb5c9('0x1e')]],'as':_0x5b444c['as'],'attributes':_0x5b444c['attributes'],'include':_0x5b444c[_0xb5c9('0x1d')]?_['map'](_0x5b444c['include'],function(_0x2d0d8d){return{'model':db[_0x2d0d8d[_0xb5c9('0x1e')]],'as':_0x2d0d8d['as'],'attributes':_0x2d0d8d[_0xb5c9('0x1c')],'include':_0x2d0d8d[_0xb5c9('0x1d')]?_[_0xb5c9('0x1f')](_0x2d0d8d[_0xb5c9('0x1d')],function(_0xc1c111){return{'model':db[_0xc1c111[_0xb5c9('0x1e')]],'as':_0xc1c111['as'],'attributes':_0xc1c111[_0xb5c9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb5c9('0x20')](function(_0x4f7f59){logger[_0xb5c9('0xd')](_0xb5c9('0x17'),_0x2f71dc);logger['debug'](_0xb5c9('0x17'),_0x2f71dc,JSON[_0xb5c9('0x12')](_0x4f7f59));_0x1b561e(_0x4f7f59);})[_0xb5c9('0x21')](function(_0x5aa14c){logger[_0xb5c9('0x13')]('GetSugarcrmAccount',_0x5aa14c[_0xb5c9('0x15')],_0x2f71dc);_0x4b3c84(_0x45b203[_0xb5c9('0x13')](0x1f4,_0x5aa14c[_0xb5c9('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x5de933){var _0x28c369=this;return new Promise(function(_0x5dacc2,_0x578dc7){return db[_0xb5c9('0x18')][_0xb5c9('0x22')]({'raw':_0x5de933[_0xb5c9('0x1a')]?_0x5de933[_0xb5c9('0x1a')][_0xb5c9('0x1b')]===undefined?!![]:![]:!![],'where':_0x5de933['options']?_0x5de933['options'][_0xb5c9('0x23')]||null:null,'attributes':_0x5de933['options']?_0x5de933[_0xb5c9('0x1a')]['attributes']||null:null,'include':_0x5de933[_0xb5c9('0x1a')]?_0x5de933[_0xb5c9('0x1a')][_0xb5c9('0x1d')]?_[_0xb5c9('0x1f')](_0x5de933[_0xb5c9('0x1a')][_0xb5c9('0x1d')],function(_0x45e625){return{'model':db[_0x45e625[_0xb5c9('0x1e')]],'as':_0x45e625['as'],'attributes':_0x45e625[_0xb5c9('0x1c')],'include':_0x45e625[_0xb5c9('0x1d')]?_['map'](_0x45e625[_0xb5c9('0x1d')],function(_0x21d8f4){return{'model':db[_0x21d8f4[_0xb5c9('0x1e')]],'as':_0x21d8f4['as'],'attributes':_0x21d8f4[_0xb5c9('0x1c')],'include':_0x21d8f4[_0xb5c9('0x1d')]?_[_0xb5c9('0x1f')](_0x21d8f4['include'],function(_0x205784){return{'model':db[_0x205784[_0xb5c9('0x1e')]],'as':_0x205784['as'],'attributes':_0x205784[_0xb5c9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb5c9('0x20')](function(_0x3b8a3f){logger[_0xb5c9('0xd')](_0xb5c9('0x24'),_0x5de933);logger[_0xb5c9('0xf')](_0xb5c9('0x24'),_0x5de933,JSON['stringify'](_0x3b8a3f));_0x5dacc2(_0x3b8a3f);})['catch'](function(_0x55ec31){logger[_0xb5c9('0x13')](_0xb5c9('0x24'),_0x55ec31[_0xb5c9('0x15')],_0x5de933);_0x578dc7(_0x28c369[_0xb5c9('0x13')](0x1f4,_0x55ec31['message']));});});}; \ No newline at end of file +var _0x4038=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','options','raw','attributes','model','include','map','stringify','SugarcrmAccount','find','where','ShowSugarcrmAccount','moment','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x35a6f8,_0x2a19d0){var _0x11d2da=function(_0x83f33e){while(--_0x83f33e){_0x35a6f8['push'](_0x35a6f8['shift']());}};_0x11d2da(++_0x2a19d0);}(_0x4038,0x141));var _0x8403=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4038[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8403('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8403('0x1'))['db'];var utils=require(_0x8403('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8403('0x3'));var client=jayson[_0x8403('0x4')][_0x8403('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x548c4f,_0x37e69a,_0x2c185e){return new BPromise(function(_0x13caeb,_0x2ec12){return client[_0x8403('0x6')](_0x548c4f,_0x2c185e)[_0x8403('0x7')](function(_0x58faa7){logger[_0x8403('0x8')](_0x8403('0x9'),_0x37e69a,_0x8403('0xa'));logger[_0x8403('0xb')](_0x8403('0xc'),_0x37e69a,_0x8403('0xa'),JSON['stringify'](_0x58faa7));if(_0x58faa7[_0x8403('0xd')]){if(_0x58faa7['error'][_0x8403('0xe')]===0x1f4){logger[_0x8403('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x37e69a,_0x58faa7['error'][_0x8403('0xf')]);return _0x2ec12(_0x58faa7[_0x8403('0xd')][_0x8403('0xf')]);}logger[_0x8403('0xd')](_0x8403('0x9'),_0x37e69a,_0x58faa7['error'][_0x8403('0xf')]);return _0x13caeb(_0x58faa7[_0x8403('0xd')][_0x8403('0xf')]);}else{logger[_0x8403('0x8')]('SugarcrmAccount,\x20%s,\x20%s',_0x37e69a,_0x8403('0xa'));_0x13caeb(_0x58faa7[_0x8403('0x10')][_0x8403('0xf')]);}})[_0x8403('0x11')](function(_0x361fca){logger[_0x8403('0xd')](_0x8403('0x9'),_0x37e69a,_0x361fca);_0x2ec12(_0x361fca);});});}exports[_0x8403('0x12')]=function(_0x53008b){var _0x7db9f=this;return new Promise(function(_0x187dd6,_0x190d22){return db['SugarcrmAccount']['findAll']({'raw':_0x53008b[_0x8403('0x13')]?_0x53008b['options'][_0x8403('0x14')]===undefined?!![]:![]:!![],'where':_0x53008b[_0x8403('0x13')]?_0x53008b[_0x8403('0x13')]['where']||null:null,'attributes':_0x53008b['options']?_0x53008b[_0x8403('0x13')][_0x8403('0x15')]||null:null,'limit':_0x53008b[_0x8403('0x13')]?_0x53008b[_0x8403('0x13')]['limit']||null:null,'include':_0x53008b['options']?_0x53008b['options']['include']?_['map'](_0x53008b['options']['include'],function(_0x1176f7){return{'model':db[_0x1176f7[_0x8403('0x16')]],'as':_0x1176f7['as'],'attributes':_0x1176f7['attributes'],'include':_0x1176f7[_0x8403('0x17')]?_[_0x8403('0x18')](_0x1176f7[_0x8403('0x17')],function(_0x56d3fe){return{'model':db[_0x56d3fe['model']],'as':_0x56d3fe['as'],'attributes':_0x56d3fe['attributes'],'include':_0x56d3fe[_0x8403('0x17')]?_[_0x8403('0x18')](_0x56d3fe[_0x8403('0x17')],function(_0x3172d9){return{'model':db[_0x3172d9[_0x8403('0x16')]],'as':_0x3172d9['as'],'attributes':_0x3172d9[_0x8403('0x15')]};}):[]};}):[]};}):[]:[]})[_0x8403('0x7')](function(_0x360136){logger[_0x8403('0x8')](_0x8403('0x12'),_0x53008b);logger['debug'](_0x8403('0x12'),_0x53008b,JSON[_0x8403('0x19')](_0x360136));_0x187dd6(_0x360136);})[_0x8403('0x11')](function(_0x41a144){logger[_0x8403('0xd')](_0x8403('0x12'),_0x41a144[_0x8403('0xf')],_0x53008b);_0x190d22(_0x7db9f[_0x8403('0xd')](0x1f4,_0x41a144[_0x8403('0xf')]));});});};exports['ShowSugarcrmAccount']=function(_0x1aafa8){var _0x223065=this;return new Promise(function(_0x2e8ad2,_0x5c0aca){return db[_0x8403('0x1a')][_0x8403('0x1b')]({'raw':_0x1aafa8[_0x8403('0x13')]?_0x1aafa8[_0x8403('0x13')][_0x8403('0x14')]===undefined?!![]:![]:!![],'where':_0x1aafa8[_0x8403('0x13')]?_0x1aafa8[_0x8403('0x13')][_0x8403('0x1c')]||null:null,'attributes':_0x1aafa8[_0x8403('0x13')]?_0x1aafa8['options'][_0x8403('0x15')]||null:null,'include':_0x1aafa8[_0x8403('0x13')]?_0x1aafa8[_0x8403('0x13')]['include']?_[_0x8403('0x18')](_0x1aafa8[_0x8403('0x13')]['include'],function(_0x427309){return{'model':db[_0x427309[_0x8403('0x16')]],'as':_0x427309['as'],'attributes':_0x427309[_0x8403('0x15')],'include':_0x427309[_0x8403('0x17')]?_[_0x8403('0x18')](_0x427309[_0x8403('0x17')],function(_0x27a7d1){return{'model':db[_0x27a7d1['model']],'as':_0x27a7d1['as'],'attributes':_0x27a7d1[_0x8403('0x15')],'include':_0x27a7d1['include']?_['map'](_0x27a7d1[_0x8403('0x17')],function(_0x45d5fe){return{'model':db[_0x45d5fe[_0x8403('0x16')]],'as':_0x45d5fe['as'],'attributes':_0x45d5fe[_0x8403('0x15')]};}):[]};}):[]};}):[]:[]})[_0x8403('0x7')](function(_0xba6bdc){logger[_0x8403('0x8')]('ShowSugarcrmAccount',_0x1aafa8);logger[_0x8403('0xb')]('ShowSugarcrmAccount',_0x1aafa8,JSON['stringify'](_0xba6bdc));_0x2e8ad2(_0xba6bdc);})[_0x8403('0x11')](function(_0x4bcd1a){logger[_0x8403('0xd')](_0x8403('0x1d'),_0x4bcd1a[_0x8403('0xf')],_0x1aafa8);_0x5c0aca(_0x223065[_0x8403('0xd')](0x1f4,_0x4bcd1a[_0x8403('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 69994bd..ba7e75d 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 _0x47ec=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x47ec,0x12d));var _0xc47e=function(_0x34dc48,_0x102b49){_0x34dc48=_0x34dc48-0x0;var _0xf7149f=_0x47ec[_0x34dc48];return _0xf7149f;};'use strict';var multer=require(_0xc47e('0x0'));var util=require(_0xc47e('0x1'));var path=require(_0xc47e('0x2'));var timeout=require(_0xc47e('0x3'));var express=require('express');var router=express[_0xc47e('0x4')]();var fs_extra=require(_0xc47e('0x5'));var auth=require(_0xc47e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xc47e('0x7')]('/',auth['isAuthenticated'](),controller[_0xc47e('0x8')]);router['get'](_0xc47e('0x9'),auth[_0xc47e('0xa')](),controller[_0xc47e('0xb')]);router[_0xc47e('0x7')]('/:id/fields',auth[_0xc47e('0xa')](),controller[_0xc47e('0xc')]);router[_0xc47e('0x7')](_0xc47e('0xd'),auth[_0xc47e('0xa')](),controller[_0xc47e('0xe')]);router['get'](_0xc47e('0xf'),auth['isAuthenticated'](),controller[_0xc47e('0x10')]);router[_0xc47e('0x11')]('/',auth['isAuthenticated'](),controller[_0xc47e('0x12')]);router[_0xc47e('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc47e('0x14')](_0xc47e('0x9'),auth[_0xc47e('0xa')](),controller[_0xc47e('0x15')]);module[_0xc47e('0x16')]=router; \ No newline at end of file +var _0x0467=['index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x10385f,_0x1f7083){var _0xa48457=function(_0x5dceba){while(--_0x5dceba){_0x10385f['push'](_0x10385f['shift']());}};_0xa48457(++_0x1f7083);}(_0x0467,0xfd));var _0x7046=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0467[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7046('0x0'));var util=require('util');var path=require(_0x7046('0x1'));var timeout=require(_0x7046('0x2'));var express=require(_0x7046('0x3'));var router=express[_0x7046('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7046('0x5'));var interaction=require(_0x7046('0x6'));var config=require(_0x7046('0x7'));var controller=require(_0x7046('0x8'));router[_0x7046('0x9')]('/',auth[_0x7046('0xa')](),controller[_0x7046('0xb')]);router[_0x7046('0x9')](_0x7046('0xc'),auth[_0x7046('0xa')](),controller[_0x7046('0xd')]);router[_0x7046('0x9')](_0x7046('0xe'),auth[_0x7046('0xa')](),controller[_0x7046('0xf')]);router[_0x7046('0x9')]('/:id/subjects',auth[_0x7046('0xa')](),controller['getSubjects']);router[_0x7046('0x9')](_0x7046('0x10'),auth[_0x7046('0xa')](),controller[_0x7046('0x11')]);router[_0x7046('0x12')]('/',auth[_0x7046('0xa')](),controller['create']);router['put'](_0x7046('0xc'),auth[_0x7046('0xa')](),controller[_0x7046('0x13')]);router[_0x7046('0x14')]('/:id',auth[_0x7046('0xa')](),controller['destroy']);module[_0x7046('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 10a0c8a..b61fb8b 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 _0xe38e=['exports','STRING'];(function(_0xb580c1,_0x45a964){var _0x3f22c0=function(_0x4f45f4){while(--_0x4f45f4){_0xb580c1['push'](_0xb580c1['shift']());}};_0x3f22c0(++_0x45a964);}(_0xe38e,0xb0));var _0xee38=function(_0x177918,_0x76f6d1){_0x177918=_0x177918-0x0;var _0x135306=_0xe38e[_0x177918];return _0x135306;};'use strict';var Sequelize=require('sequelize');module[_0xee38('0x0')]={'name':{'type':Sequelize[_0xee38('0x1')]},'description':{'type':Sequelize[_0xee38('0x1')]}}; \ No newline at end of file +var _0x3855=['STRING','sequelize'];(function(_0x3d44bc,_0x1c68ac){var _0x4e6b31=function(_0x121596){while(--_0x121596){_0x3d44bc['push'](_0x3d44bc['shift']());}};_0x4e6b31(++_0x1c68ac);}(_0x3855,0x83));var _0x5385=function(_0x5ce517,_0x7211eb){_0x5ce517=_0x5ce517-0x0;var _0x31321e=_0x3855[_0x5ce517];return _0x31321e;};'use strict';var Sequelize=require(_0x5385('0x0'));module['exports']={'name':{'type':Sequelize[_0x5385('0x1')]},'description':{'type':Sequelize[_0x5385('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c528d16..54eee01 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 _0x074d=['then','destroy','error','stack','send','index','map','rawAttributes','type','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','SugarcrmConfiguration','includeAll','include','findAll','show','params','options','find','catch','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update'];(function(_0x31708d,_0x1e383d){var _0x29be7d=function(_0x36a9e8){while(--_0x36a9e8){_0x31708d['push'](_0x31708d['shift']());}};_0x29be7d(++_0x1e383d);}(_0x074d,0x11c));var _0xd074=function(_0x17d995,_0x3bd90c){_0x17d995=_0x17d995-0x0;var _0x5a1ab1=_0x074d[_0x17d995];return _0x5a1ab1;};'use strict';var emlformat=require(_0xd074('0x0'));var rimraf=require(_0xd074('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd074('0x2'));var rp=require(_0xd074('0x3'));var moment=require(_0xd074('0x4'));var BPromise=require(_0xd074('0x5'));var Mustache=require('mustache');var util=require(_0xd074('0x6'));var path=require('path');var sox=require(_0xd074('0x7'));var csv=require(_0xd074('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd074('0x9'));var _=require('lodash');var squel=require(_0xd074('0xa'));var crypto=require('crypto');var jsforce=require(_0xd074('0xb'));var deskjs=require(_0xd074('0xc'));var toCsv=require(_0xd074('0x8'));var querystring=require(_0xd074('0xd'));var Papa=require(_0xd074('0xe'));var Redis=require(_0xd074('0xf'));var authService=require(_0xd074('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd074('0x11'));var hardwareService=require(_0xd074('0x12'));var logger=require(_0xd074('0x13'))(_0xd074('0x14'));var utils=require(_0xd074('0x15'));var config=require(_0xd074('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd074('0x17'))['db'];function respondWithStatusCode(_0x33fbb9,_0x1805f6){_0x1805f6=_0x1805f6||0xcc;return function(_0x222863){if(_0x222863){return _0x33fbb9[_0xd074('0x18')](_0x1805f6);}return _0x33fbb9[_0xd074('0x19')](_0x1805f6)[_0xd074('0x1a')]();};}function respondWithResult(_0x2ba356,_0x35b7af){_0x35b7af=_0x35b7af||0xc8;return function(_0x21aff1){if(_0x21aff1){return _0x2ba356[_0xd074('0x19')](_0x35b7af)[_0xd074('0x1b')](_0x21aff1);}};}function respondWithFilteredResult(_0x354b86,_0x5c3d75){return function(_0x5e3c06){if(_0x5e3c06){var _0xb21db=typeof _0x5c3d75[_0xd074('0x1c')]===_0xd074('0x1d')&&typeof _0x5c3d75['limit']===_0xd074('0x1d');var _0x46af79=_0x5e3c06[_0xd074('0x1e')];var _0x2038ed=_0xb21db?0x0:_0x5c3d75[_0xd074('0x1c')];var _0x308f10=_0xb21db?_0x5e3c06[_0xd074('0x1e')]:_0x5c3d75['offset']+_0x5c3d75['limit'];var _0x159f96;if(_0x308f10>=_0x46af79){_0x308f10=_0x46af79;_0x159f96=0xc8;}else{_0x159f96=0xce;}_0x354b86[_0xd074('0x19')](_0x159f96);return _0x354b86[_0xd074('0x1f')](_0xd074('0x20'),_0x2038ed+'-'+_0x308f10+'/'+_0x46af79)[_0xd074('0x1b')](_0x5e3c06);}return null;};}function patchUpdates(_0x499c48){return function(_0x477a60){try{jsonpatch[_0xd074('0x21')](_0x477a60,_0x499c48,!![]);}catch(_0x21ffcd){return BPromise[_0xd074('0x22')](_0x21ffcd);}return _0x477a60['save']();};}function saveUpdates(_0x168195,_0xb9f2d3){return function(_0x49c6b8){if(_0x49c6b8){return _0x49c6b8[_0xd074('0x23')](_0x168195)[_0xd074('0x24')](function(_0x41dbce){return _0x41dbce;});}return null;};}function removeEntity(_0x58853d,_0x11e4bc){return function(_0x272fc3){if(_0x272fc3){return _0x272fc3[_0xd074('0x25')]()['then'](function(){_0x58853d[_0xd074('0x19')](0xcc)[_0xd074('0x1a')]();});}};}function handleEntityNotFound(_0x1c06b4,_0x54094c){return function(_0x2dd163){if(!_0x2dd163){_0x1c06b4[_0xd074('0x18')](0x194);}return _0x2dd163;};}function handleError(_0x42ffad,_0x40abec){_0x40abec=_0x40abec||0x1f4;return function(_0x1cfa5c){logger[_0xd074('0x26')](_0x1cfa5c[_0xd074('0x27')]);if(_0x1cfa5c['name']){delete _0x1cfa5c['name'];}_0x42ffad['status'](_0x40abec)[_0xd074('0x28')](_0x1cfa5c);};}exports[_0xd074('0x29')]=function(_0x1ff785,_0x2e2915){var _0x252096={},_0x407f41={},_0x489c8e={'count':0x0,'rows':[]};var _0x229d9f=_[_0xd074('0x2a')](db['SugarcrmConfiguration'][_0xd074('0x2b')],function(_0x3a57d6){return{'name':_0x3a57d6['fieldName'],'type':_0x3a57d6[_0xd074('0x2c')]['key']};});_0x407f41[_0xd074('0x2d')]=_[_0xd074('0x2a')](_0x229d9f,_0xd074('0x2e'));_0x407f41['query']=_[_0xd074('0x2f')](_0x1ff785['query']);_0x407f41['filters']=_['intersection'](_0x407f41[_0xd074('0x2d')],_0x407f41[_0xd074('0x30')]);_0x252096['attributes']=_[_0xd074('0x31')](_0x407f41[_0xd074('0x2d')],qs['fields'](_0x1ff785[_0xd074('0x30')][_0xd074('0x32')]));_0x252096[_0xd074('0x33')]=_0x252096['attributes'][_0xd074('0x34')]?_0x252096[_0xd074('0x33')]:_0x407f41[_0xd074('0x2d')];if(!_0x1ff785['query'][_0xd074('0x35')](_0xd074('0x36'))){_0x252096['limit']=qs[_0xd074('0x37')](_0x1ff785[_0xd074('0x30')]['limit']);_0x252096[_0xd074('0x1c')]=qs['offset'](_0x1ff785[_0xd074('0x30')][_0xd074('0x1c')]);}_0x252096[_0xd074('0x38')]=qs[_0xd074('0x39')](_0x1ff785[_0xd074('0x30')]['sort']);_0x252096['where']=qs[_0xd074('0x3a')](_['pick'](_0x1ff785[_0xd074('0x30')],_0x407f41[_0xd074('0x3a')]),_0x229d9f);if(_0x1ff785['query']['filter']){_0x252096[_0xd074('0x3b')]=_[_0xd074('0x3c')](_0x252096['where'],{'$or':_[_0xd074('0x2a')](_0x229d9f,function(_0x44aa4c){if(_0x44aa4c[_0xd074('0x2c')]!==_0xd074('0x3d')){var _0x3d4c0c={};_0x3d4c0c[_0x44aa4c[_0xd074('0x2e')]]={'$like':'%'+_0x1ff785[_0xd074('0x30')][_0xd074('0x3e')]+'%'};return _0x3d4c0c;}})});}_0x252096=_[_0xd074('0x3c')]({},_0x252096,_0x1ff785['options']);var _0x1dddc4={'where':_0x252096[_0xd074('0x3b')]};return db[_0xd074('0x3f')][_0xd074('0x1e')](_0x1dddc4)[_0xd074('0x24')](function(_0x54cc1c){_0x489c8e[_0xd074('0x1e')]=_0x54cc1c;if(_0x1ff785[_0xd074('0x30')][_0xd074('0x40')]){_0x252096[_0xd074('0x41')]=[{'all':!![]}];}return db[_0xd074('0x3f')][_0xd074('0x42')](_0x252096);})[_0xd074('0x24')](function(_0x257e88){_0x489c8e['rows']=_0x257e88;return _0x489c8e;})[_0xd074('0x24')](respondWithFilteredResult(_0x2e2915,_0x252096))['catch'](handleError(_0x2e2915,null));};exports[_0xd074('0x43')]=function(_0x9e20a1,_0x4b0f6d){var _0x36545b={'raw':![],'where':{'id':_0x9e20a1[_0xd074('0x44')]['id']}},_0x2e4ce2={};_0x2e4ce2[_0xd074('0x2d')]=_[_0xd074('0x2f')](db[_0xd074('0x3f')]['rawAttributes']);_0x2e4ce2[_0xd074('0x30')]=_[_0xd074('0x2f')](_0x9e20a1['query']);_0x2e4ce2[_0xd074('0x3a')]=_[_0xd074('0x31')](_0x2e4ce2[_0xd074('0x2d')],_0x2e4ce2[_0xd074('0x30')]);_0x36545b[_0xd074('0x33')]=_['intersection'](_0x2e4ce2[_0xd074('0x2d')],qs[_0xd074('0x32')](_0x9e20a1['query'][_0xd074('0x32')]));_0x36545b[_0xd074('0x33')]=_0x36545b[_0xd074('0x33')]['length']?_0x36545b[_0xd074('0x33')]:_0x2e4ce2[_0xd074('0x2d')];if(_0x9e20a1[_0xd074('0x30')][_0xd074('0x40')]){_0x36545b['include']=[{'all':!![]}];}_0x36545b=_[_0xd074('0x3c')]({},_0x36545b,_0x9e20a1[_0xd074('0x45')]);return db['SugarcrmConfiguration'][_0xd074('0x46')](_0x36545b)[_0xd074('0x24')](handleEntityNotFound(_0x4b0f6d,null))['then'](respondWithResult(_0x4b0f6d,null))[_0xd074('0x47')](handleError(_0x4b0f6d,null));};exports[_0xd074('0x48')]=function(_0x499bdd,_0x4641e7){return db['SugarcrmConfiguration']['create'](_0x499bdd['body'],{})[_0xd074('0x24')](respondWithResult(_0x4641e7,0xc9))[_0xd074('0x47')](handleError(_0x4641e7,null));};exports[_0xd074('0x23')]=function(_0x3f306c,_0x5ae0ed){if(_0x3f306c[_0xd074('0x49')]['id']){delete _0x3f306c['body']['id'];}return db[_0xd074('0x3f')]['find']({'where':{'id':_0x3f306c[_0xd074('0x44')]['id']}})[_0xd074('0x24')](handleEntityNotFound(_0x5ae0ed,null))[_0xd074('0x24')](saveUpdates(_0x3f306c['body'],null))[_0xd074('0x24')](respondWithResult(_0x5ae0ed,null))['catch'](handleError(_0x5ae0ed,null));};exports[_0xd074('0x25')]=function(_0x5a26fd,_0x1be7f1){return db[_0xd074('0x3f')][_0xd074('0x46')]({'where':{'id':_0x5a26fd[_0xd074('0x44')]['id']}})[_0xd074('0x24')](handleEntityNotFound(_0x1be7f1,null))[_0xd074('0x24')](removeEntity(_0x1be7f1,null))['catch'](handleError(_0x1be7f1,null));};exports[_0xd074('0x4a')]=function(_0x10742e,_0x586e65,_0x3a7a53){var _0x7b6061={};var _0x4d7588={};var _0x1cb7c8;var _0x3526ea;return db[_0xd074('0x3f')][_0xd074('0x4b')]({'where':{'id':_0x10742e[_0xd074('0x44')]['id']}})[_0xd074('0x24')](handleEntityNotFound(_0x586e65,null))[_0xd074('0x24')](function(_0x5a493e){if(_0x5a493e){_0x1cb7c8=_0x5a493e;_0x4d7588['model']=_[_0xd074('0x2f')](db[_0xd074('0x4c')][_0xd074('0x2b')]);_0x4d7588[_0xd074('0x30')]=_[_0xd074('0x2f')](_0x10742e[_0xd074('0x30')]);_0x4d7588[_0xd074('0x3a')]=_[_0xd074('0x31')](_0x4d7588[_0xd074('0x2d')],_0x4d7588['query']);_0x7b6061[_0xd074('0x33')]=_[_0xd074('0x31')](_0x4d7588[_0xd074('0x2d')],qs['fields'](_0x10742e[_0xd074('0x30')][_0xd074('0x32')]));_0x7b6061[_0xd074('0x33')]=_0x7b6061[_0xd074('0x33')]['length']?_0x7b6061['attributes']:_0x4d7588[_0xd074('0x2d')];_0x7b6061[_0xd074('0x38')]=qs[_0xd074('0x39')](_0x10742e[_0xd074('0x30')]['sort']);_0x7b6061['where']=qs[_0xd074('0x3a')](_[_0xd074('0x4d')](_0x10742e[_0xd074('0x30')],_0x4d7588[_0xd074('0x3a')]));if(_0x10742e[_0xd074('0x30')][_0xd074('0x3e')]){_0x7b6061[_0xd074('0x3b')]=_[_0xd074('0x3c')](_0x7b6061['where'],{'$or':_[_0xd074('0x2a')](_0x7b6061['attributes'],function(_0x48bcfb){var _0x5b67b9={};_0x5b67b9[_0x48bcfb]={'$like':'%'+_0x10742e['query'][_0xd074('0x3e')]+'%'};return _0x5b67b9;})});}_0x7b6061=_[_0xd074('0x3c')]({},_0x7b6061,_0x10742e[_0xd074('0x45')]);return _0x1cb7c8[_0xd074('0x4a')](_0x7b6061);}})[_0xd074('0x24')](function(_0x4137b0){if(_0x4137b0){_0x3526ea=_0x4137b0[_0xd074('0x34')];if(!_0x10742e[_0xd074('0x30')][_0xd074('0x35')](_0xd074('0x36'))){_0x7b6061['limit']=qs[_0xd074('0x37')](_0x10742e[_0xd074('0x30')][_0xd074('0x37')]);_0x7b6061[_0xd074('0x1c')]=qs[_0xd074('0x1c')](_0x10742e['query']['offset']);}return _0x1cb7c8[_0xd074('0x4a')](_0x7b6061);}})[_0xd074('0x24')](function(_0xedff17){if(_0xedff17){return _0xedff17?{'count':_0x3526ea,'rows':_0xedff17}:null;}})[_0xd074('0x24')](respondWithResult(_0x586e65,null))[_0xd074('0x47')](handleError(_0x586e65,null));};exports['getSubjects']=function(_0x7cdba4,_0x4b183d,_0xe3e68){var _0x5c8bec={};var _0x5dfd24={};var _0x4de1f6;var _0x4fa51c;return db[_0xd074('0x3f')]['findOne']({'where':{'id':_0x7cdba4[_0xd074('0x44')]['id']}})[_0xd074('0x24')](handleEntityNotFound(_0x4b183d,null))['then'](function(_0x32c65d){if(_0x32c65d){_0x4de1f6=_0x32c65d;_0x5dfd24[_0xd074('0x2d')]=_[_0xd074('0x2f')](db[_0xd074('0x4c')]['rawAttributes']);_0x5dfd24[_0xd074('0x30')]=_[_0xd074('0x2f')](_0x7cdba4[_0xd074('0x30')]);_0x5dfd24[_0xd074('0x3a')]=_['intersection'](_0x5dfd24[_0xd074('0x2d')],_0x5dfd24[_0xd074('0x30')]);_0x5c8bec[_0xd074('0x33')]=_[_0xd074('0x31')](_0x5dfd24[_0xd074('0x2d')],qs['fields'](_0x7cdba4['query'][_0xd074('0x32')]));_0x5c8bec[_0xd074('0x33')]=_0x5c8bec[_0xd074('0x33')]['length']?_0x5c8bec['attributes']:_0x5dfd24['model'];_0x5c8bec[_0xd074('0x38')]=qs['sort'](_0x7cdba4[_0xd074('0x30')][_0xd074('0x39')]);_0x5c8bec['where']=qs[_0xd074('0x3a')](_[_0xd074('0x4d')](_0x7cdba4['query'],_0x5dfd24['filters']));if(_0x7cdba4['query']['filter']){_0x5c8bec[_0xd074('0x3b')]=_[_0xd074('0x3c')](_0x5c8bec[_0xd074('0x3b')],{'$or':_[_0xd074('0x2a')](_0x5c8bec['attributes'],function(_0x140967){var _0x491fcb={};_0x491fcb[_0x140967]={'$like':'%'+_0x7cdba4['query']['filter']+'%'};return _0x491fcb;})});}_0x5c8bec=_[_0xd074('0x3c')]({},_0x5c8bec,_0x7cdba4[_0xd074('0x45')]);return _0x4de1f6[_0xd074('0x4e')](_0x5c8bec);}})['then'](function(_0x15d50a){if(_0x15d50a){_0x4fa51c=_0x15d50a[_0xd074('0x34')];if(!_0x7cdba4['query']['hasOwnProperty'](_0xd074('0x36'))){_0x5c8bec['limit']=qs[_0xd074('0x37')](_0x7cdba4['query'][_0xd074('0x37')]);_0x5c8bec[_0xd074('0x1c')]=qs[_0xd074('0x1c')](_0x7cdba4['query']['offset']);}return _0x4de1f6['getSubjects'](_0x5c8bec);}})[_0xd074('0x24')](function(_0x219281){if(_0x219281){return _0x219281?{'count':_0x4fa51c,'rows':_0x219281}:null;}})[_0xd074('0x24')](respondWithResult(_0x4b183d,null))[_0xd074('0x47')](handleError(_0x4b183d,null));};exports[_0xd074('0x4f')]=function(_0x30e897,_0x116fa3,_0x52c2d3){var _0x24c764={};var _0x5c17df={};var _0x45e92f;var _0x5a3009;return db['SugarcrmConfiguration'][_0xd074('0x4b')]({'where':{'id':_0x30e897[_0xd074('0x44')]['id']}})[_0xd074('0x24')](handleEntityNotFound(_0x116fa3,null))[_0xd074('0x24')](function(_0xcfa7fe){if(_0xcfa7fe){_0x45e92f=_0xcfa7fe;_0x5c17df['model']=_['keys'](db['SugarcrmField'][_0xd074('0x2b')]);_0x5c17df['query']=_[_0xd074('0x2f')](_0x30e897[_0xd074('0x30')]);_0x5c17df['filters']=_['intersection'](_0x5c17df[_0xd074('0x2d')],_0x5c17df[_0xd074('0x30')]);_0x24c764[_0xd074('0x33')]=_[_0xd074('0x31')](_0x5c17df['model'],qs[_0xd074('0x32')](_0x30e897['query'][_0xd074('0x32')]));_0x24c764['attributes']=_0x24c764[_0xd074('0x33')][_0xd074('0x34')]?_0x24c764[_0xd074('0x33')]:_0x5c17df[_0xd074('0x2d')];_0x24c764[_0xd074('0x38')]=qs[_0xd074('0x39')](_0x30e897['query']['sort']);_0x24c764[_0xd074('0x3b')]=qs[_0xd074('0x3a')](_[_0xd074('0x4d')](_0x30e897[_0xd074('0x30')],_0x5c17df[_0xd074('0x3a')]));if(_0x30e897[_0xd074('0x30')][_0xd074('0x3e')]){_0x24c764[_0xd074('0x3b')]=_['merge'](_0x24c764[_0xd074('0x3b')],{'$or':_[_0xd074('0x2a')](_0x24c764[_0xd074('0x33')],function(_0x2cd9d3){var _0x4fbfe3={};_0x4fbfe3[_0x2cd9d3]={'$like':'%'+_0x30e897[_0xd074('0x30')][_0xd074('0x3e')]+'%'};return _0x4fbfe3;})});}_0x24c764=_[_0xd074('0x3c')]({},_0x24c764,_0x30e897['options']);return _0x45e92f[_0xd074('0x4f')](_0x24c764);}})[_0xd074('0x24')](function(_0x4d26b6){if(_0x4d26b6){_0x5a3009=_0x4d26b6[_0xd074('0x34')];if(!_0x30e897['query']['hasOwnProperty'](_0xd074('0x36'))){_0x24c764[_0xd074('0x37')]=qs['limit'](_0x30e897['query'][_0xd074('0x37')]);_0x24c764[_0xd074('0x1c')]=qs['offset'](_0x30e897['query'][_0xd074('0x1c')]);}return _0x45e92f[_0xd074('0x4f')](_0x24c764);}})[_0xd074('0x24')](function(_0x4ce9c3){if(_0x4ce9c3){return _0x4ce9c3?{'count':_0x5a3009,'rows':_0x4ce9c3}:null;}})[_0xd074('0x24')](respondWithResult(_0x116fa3,null))[_0xd074('0x47')](handleError(_0x116fa3,null));}; \ No newline at end of file +var _0x19a4=['getDescriptions','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','getFields','findOne','SugarcrmField','filter','nolimit','getSubjects'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x19a4,0x1db));var _0x419a=function(_0x9101ec,_0x214313){_0x9101ec=_0x9101ec-0x0;var _0xfa829d=_0x19a4[_0x9101ec];return _0xfa829d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x419a('0x0'));var zipdir=require(_0x419a('0x1'));var jsonpatch=require(_0x419a('0x2'));var rp=require('request-promise');var moment=require(_0x419a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x419a('0x4'));var path=require(_0x419a('0x5'));var sox=require(_0x419a('0x6'));var csv=require(_0x419a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x419a('0x8'));var _=require('lodash');var squel=require(_0x419a('0x9'));var crypto=require(_0x419a('0xa'));var jsforce=require(_0x419a('0xb'));var deskjs=require(_0x419a('0xc'));var toCsv=require(_0x419a('0x7'));var querystring=require(_0x419a('0xd'));var Papa=require(_0x419a('0xe'));var Redis=require('ioredis');var authService=require(_0x419a('0xf'));var qs=require(_0x419a('0x10'));var as=require(_0x419a('0x11'));var hardwareService=require(_0x419a('0x12'));var logger=require(_0x419a('0x13'))(_0x419a('0x14'));var utils=require(_0x419a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x419a('0x16'))['db'];function respondWithStatusCode(_0x121413,_0x2e718a){_0x2e718a=_0x2e718a||0xcc;return function(_0x58121e){if(_0x58121e){return _0x121413['sendStatus'](_0x2e718a);}return _0x121413[_0x419a('0x17')](_0x2e718a)[_0x419a('0x18')]();};}function respondWithResult(_0x22d0e6,_0x6a145){_0x6a145=_0x6a145||0xc8;return function(_0x4cc2ed){if(_0x4cc2ed){return _0x22d0e6[_0x419a('0x17')](_0x6a145)['json'](_0x4cc2ed);}};}function respondWithFilteredResult(_0x12037b,_0x20d782){return function(_0xa9c66){if(_0xa9c66){var _0x5eb4ae=typeof _0x20d782[_0x419a('0x19')]===_0x419a('0x1a')&&typeof _0x20d782[_0x419a('0x1b')]===_0x419a('0x1a');var _0x5470cb=_0xa9c66[_0x419a('0x1c')];var _0x4d3fb9=_0x5eb4ae?0x0:_0x20d782[_0x419a('0x19')];var _0x232a99=_0x5eb4ae?_0xa9c66[_0x419a('0x1c')]:_0x20d782[_0x419a('0x19')]+_0x20d782['limit'];var _0xa8ede2;if(_0x232a99>=_0x5470cb){_0x232a99=_0x5470cb;_0xa8ede2=0xc8;}else{_0xa8ede2=0xce;}_0x12037b[_0x419a('0x17')](_0xa8ede2);return _0x12037b[_0x419a('0x1d')](_0x419a('0x1e'),_0x4d3fb9+'-'+_0x232a99+'/'+_0x5470cb)[_0x419a('0x1f')](_0xa9c66);}return null;};}function patchUpdates(_0x37dae7){return function(_0x3e72f5){try{jsonpatch[_0x419a('0x20')](_0x3e72f5,_0x37dae7,!![]);}catch(_0x1217ca){return BPromise[_0x419a('0x21')](_0x1217ca);}return _0x3e72f5[_0x419a('0x22')]();};}function saveUpdates(_0x31167f,_0x5deaf6){return function(_0x34f55d){if(_0x34f55d){return _0x34f55d['update'](_0x31167f)[_0x419a('0x23')](function(_0x294825){return _0x294825;});}return null;};}function removeEntity(_0x369505,_0x11f6fc){return function(_0x2654c0){if(_0x2654c0){return _0x2654c0[_0x419a('0x24')]()[_0x419a('0x23')](function(){_0x369505[_0x419a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8b8ac3,_0x2427a8){return function(_0x16a3cd){if(!_0x16a3cd){_0x8b8ac3['sendStatus'](0x194);}return _0x16a3cd;};}function handleError(_0x576794,_0x592476){_0x592476=_0x592476||0x1f4;return function(_0x384265){logger['error'](_0x384265[_0x419a('0x25')]);if(_0x384265[_0x419a('0x26')]){delete _0x384265[_0x419a('0x26')];}_0x576794[_0x419a('0x17')](_0x592476)[_0x419a('0x27')](_0x384265);};}exports['index']=function(_0x26e5d9,_0x1a3020){var _0x551db1={},_0x51f8d6={},_0x5c57ee={'count':0x0,'rows':[]};var _0x28f702=_[_0x419a('0x28')](db[_0x419a('0x29')][_0x419a('0x2a')],function(_0x50db92){return{'name':_0x50db92[_0x419a('0x2b')],'type':_0x50db92[_0x419a('0x2c')][_0x419a('0x2d')]};});_0x51f8d6[_0x419a('0x2e')]=_['map'](_0x28f702,'name');_0x51f8d6[_0x419a('0x2f')]=_[_0x419a('0x30')](_0x26e5d9[_0x419a('0x2f')]);_0x51f8d6['filters']=_[_0x419a('0x31')](_0x51f8d6['model'],_0x51f8d6[_0x419a('0x2f')]);_0x551db1[_0x419a('0x32')]=_[_0x419a('0x31')](_0x51f8d6[_0x419a('0x2e')],qs[_0x419a('0x33')](_0x26e5d9[_0x419a('0x2f')][_0x419a('0x33')]));_0x551db1[_0x419a('0x32')]=_0x551db1[_0x419a('0x32')]['length']?_0x551db1['attributes']:_0x51f8d6['model'];if(!_0x26e5d9[_0x419a('0x2f')][_0x419a('0x34')]('nolimit')){_0x551db1[_0x419a('0x1b')]=qs[_0x419a('0x1b')](_0x26e5d9['query'][_0x419a('0x1b')]);_0x551db1[_0x419a('0x19')]=qs[_0x419a('0x19')](_0x26e5d9[_0x419a('0x2f')]['offset']);}_0x551db1[_0x419a('0x35')]=qs['sort'](_0x26e5d9['query'][_0x419a('0x36')]);_0x551db1[_0x419a('0x37')]=qs[_0x419a('0x38')](_[_0x419a('0x39')](_0x26e5d9[_0x419a('0x2f')],_0x51f8d6[_0x419a('0x38')]),_0x28f702);if(_0x26e5d9[_0x419a('0x2f')]['filter']){_0x551db1[_0x419a('0x37')]=_[_0x419a('0x3a')](_0x551db1[_0x419a('0x37')],{'$or':_[_0x419a('0x28')](_0x28f702,function(_0x45ab0b){if(_0x45ab0b[_0x419a('0x2c')]!==_0x419a('0x3b')){var _0x5db222={};_0x5db222[_0x45ab0b[_0x419a('0x26')]]={'$like':'%'+_0x26e5d9[_0x419a('0x2f')]['filter']+'%'};return _0x5db222;}})});}_0x551db1=_[_0x419a('0x3a')]({},_0x551db1,_0x26e5d9[_0x419a('0x3c')]);var _0x20e20e={'where':_0x551db1[_0x419a('0x37')]};return db[_0x419a('0x29')][_0x419a('0x1c')](_0x20e20e)[_0x419a('0x23')](function(_0x58eeb1){_0x5c57ee[_0x419a('0x1c')]=_0x58eeb1;if(_0x26e5d9[_0x419a('0x2f')][_0x419a('0x3d')]){_0x551db1[_0x419a('0x3e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x419a('0x3f')](_0x551db1);})[_0x419a('0x23')](function(_0x2877da){_0x5c57ee[_0x419a('0x40')]=_0x2877da;return _0x5c57ee;})[_0x419a('0x23')](respondWithFilteredResult(_0x1a3020,_0x551db1))['catch'](handleError(_0x1a3020,null));};exports[_0x419a('0x41')]=function(_0xfae654,_0x1dd451){var _0x142d68={'raw':![],'where':{'id':_0xfae654['params']['id']}},_0x48bd47={};_0x48bd47['model']=_[_0x419a('0x30')](db[_0x419a('0x29')][_0x419a('0x2a')]);_0x48bd47['query']=_[_0x419a('0x30')](_0xfae654['query']);_0x48bd47[_0x419a('0x38')]=_[_0x419a('0x31')](_0x48bd47[_0x419a('0x2e')],_0x48bd47['query']);_0x142d68['attributes']=_['intersection'](_0x48bd47[_0x419a('0x2e')],qs['fields'](_0xfae654[_0x419a('0x2f')][_0x419a('0x33')]));_0x142d68[_0x419a('0x32')]=_0x142d68[_0x419a('0x32')][_0x419a('0x42')]?_0x142d68['attributes']:_0x48bd47[_0x419a('0x2e')];if(_0xfae654[_0x419a('0x2f')][_0x419a('0x3d')]){_0x142d68[_0x419a('0x3e')]=[{'all':!![]}];}_0x142d68=_[_0x419a('0x3a')]({},_0x142d68,_0xfae654[_0x419a('0x3c')]);return db[_0x419a('0x29')][_0x419a('0x43')](_0x142d68)[_0x419a('0x23')](handleEntityNotFound(_0x1dd451,null))[_0x419a('0x23')](respondWithResult(_0x1dd451,null))[_0x419a('0x44')](handleError(_0x1dd451,null));};exports['create']=function(_0x5e8aea,_0x5df708){return db[_0x419a('0x29')][_0x419a('0x45')](_0x5e8aea['body'],{})['then'](respondWithResult(_0x5df708,0xc9))[_0x419a('0x44')](handleError(_0x5df708,null));};exports['update']=function(_0x5e1bd5,_0x4b67b6){if(_0x5e1bd5['body']['id']){delete _0x5e1bd5[_0x419a('0x46')]['id'];}return db[_0x419a('0x29')][_0x419a('0x43')]({'where':{'id':_0x5e1bd5[_0x419a('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b67b6,null))['then'](saveUpdates(_0x5e1bd5[_0x419a('0x46')],null))[_0x419a('0x23')](respondWithResult(_0x4b67b6,null))[_0x419a('0x44')](handleError(_0x4b67b6,null));};exports['destroy']=function(_0xd70019,_0x4b86db){return db[_0x419a('0x29')][_0x419a('0x43')]({'where':{'id':_0xd70019[_0x419a('0x47')]['id']}})[_0x419a('0x23')](handleEntityNotFound(_0x4b86db,null))[_0x419a('0x23')](removeEntity(_0x4b86db,null))[_0x419a('0x44')](handleError(_0x4b86db,null));};exports[_0x419a('0x48')]=function(_0x25c048,_0x123955,_0x599ccc){var _0x1860e3={};var _0x2e68dc={};var _0x5a25a0;var _0x2e3bb4;return db['SugarcrmConfiguration'][_0x419a('0x49')]({'where':{'id':_0x25c048[_0x419a('0x47')]['id']}})['then'](handleEntityNotFound(_0x123955,null))[_0x419a('0x23')](function(_0x34c8b1){if(_0x34c8b1){_0x5a25a0=_0x34c8b1;_0x2e68dc['model']=_['keys'](db[_0x419a('0x4a')][_0x419a('0x2a')]);_0x2e68dc[_0x419a('0x2f')]=_['keys'](_0x25c048[_0x419a('0x2f')]);_0x2e68dc[_0x419a('0x38')]=_[_0x419a('0x31')](_0x2e68dc[_0x419a('0x2e')],_0x2e68dc['query']);_0x1860e3[_0x419a('0x32')]=_[_0x419a('0x31')](_0x2e68dc[_0x419a('0x2e')],qs[_0x419a('0x33')](_0x25c048[_0x419a('0x2f')][_0x419a('0x33')]));_0x1860e3[_0x419a('0x32')]=_0x1860e3['attributes'][_0x419a('0x42')]?_0x1860e3[_0x419a('0x32')]:_0x2e68dc[_0x419a('0x2e')];_0x1860e3[_0x419a('0x35')]=qs[_0x419a('0x36')](_0x25c048[_0x419a('0x2f')][_0x419a('0x36')]);_0x1860e3[_0x419a('0x37')]=qs[_0x419a('0x38')](_['pick'](_0x25c048[_0x419a('0x2f')],_0x2e68dc[_0x419a('0x38')]));if(_0x25c048[_0x419a('0x2f')][_0x419a('0x4b')]){_0x1860e3['where']=_[_0x419a('0x3a')](_0x1860e3[_0x419a('0x37')],{'$or':_[_0x419a('0x28')](_0x1860e3[_0x419a('0x32')],function(_0x15e595){var _0x2c0d0e={};_0x2c0d0e[_0x15e595]={'$like':'%'+_0x25c048[_0x419a('0x2f')][_0x419a('0x4b')]+'%'};return _0x2c0d0e;})});}_0x1860e3=_[_0x419a('0x3a')]({},_0x1860e3,_0x25c048['options']);return _0x5a25a0[_0x419a('0x48')](_0x1860e3);}})['then'](function(_0x24295d){if(_0x24295d){_0x2e3bb4=_0x24295d[_0x419a('0x42')];if(!_0x25c048[_0x419a('0x2f')][_0x419a('0x34')](_0x419a('0x4c'))){_0x1860e3[_0x419a('0x1b')]=qs[_0x419a('0x1b')](_0x25c048[_0x419a('0x2f')][_0x419a('0x1b')]);_0x1860e3[_0x419a('0x19')]=qs[_0x419a('0x19')](_0x25c048[_0x419a('0x2f')][_0x419a('0x19')]);}return _0x5a25a0['getFields'](_0x1860e3);}})[_0x419a('0x23')](function(_0xe8805e){if(_0xe8805e){return _0xe8805e?{'count':_0x2e3bb4,'rows':_0xe8805e}:null;}})[_0x419a('0x23')](respondWithResult(_0x123955,null))[_0x419a('0x44')](handleError(_0x123955,null));};exports[_0x419a('0x4d')]=function(_0xed0a76,_0x5efc5d,_0x40f7d1){var _0x20407f={};var _0x56d8ff={};var _0x172d14;var _0x5c24e2;return db['SugarcrmConfiguration'][_0x419a('0x49')]({'where':{'id':_0xed0a76['params']['id']}})[_0x419a('0x23')](handleEntityNotFound(_0x5efc5d,null))['then'](function(_0xd23a5a){if(_0xd23a5a){_0x172d14=_0xd23a5a;_0x56d8ff['model']=_[_0x419a('0x30')](db['SugarcrmField'][_0x419a('0x2a')]);_0x56d8ff[_0x419a('0x2f')]=_[_0x419a('0x30')](_0xed0a76['query']);_0x56d8ff[_0x419a('0x38')]=_[_0x419a('0x31')](_0x56d8ff[_0x419a('0x2e')],_0x56d8ff[_0x419a('0x2f')]);_0x20407f[_0x419a('0x32')]=_['intersection'](_0x56d8ff['model'],qs[_0x419a('0x33')](_0xed0a76['query'][_0x419a('0x33')]));_0x20407f[_0x419a('0x32')]=_0x20407f[_0x419a('0x32')][_0x419a('0x42')]?_0x20407f['attributes']:_0x56d8ff[_0x419a('0x2e')];_0x20407f[_0x419a('0x35')]=qs[_0x419a('0x36')](_0xed0a76['query'][_0x419a('0x36')]);_0x20407f[_0x419a('0x37')]=qs[_0x419a('0x38')](_[_0x419a('0x39')](_0xed0a76[_0x419a('0x2f')],_0x56d8ff[_0x419a('0x38')]));if(_0xed0a76[_0x419a('0x2f')][_0x419a('0x4b')]){_0x20407f[_0x419a('0x37')]=_[_0x419a('0x3a')](_0x20407f[_0x419a('0x37')],{'$or':_[_0x419a('0x28')](_0x20407f[_0x419a('0x32')],function(_0x2308a4){var _0x22f788={};_0x22f788[_0x2308a4]={'$like':'%'+_0xed0a76[_0x419a('0x2f')][_0x419a('0x4b')]+'%'};return _0x22f788;})});}_0x20407f=_[_0x419a('0x3a')]({},_0x20407f,_0xed0a76[_0x419a('0x3c')]);return _0x172d14[_0x419a('0x4d')](_0x20407f);}})[_0x419a('0x23')](function(_0x4151ca){if(_0x4151ca){_0x5c24e2=_0x4151ca['length'];if(!_0xed0a76[_0x419a('0x2f')][_0x419a('0x34')](_0x419a('0x4c'))){_0x20407f['limit']=qs[_0x419a('0x1b')](_0xed0a76[_0x419a('0x2f')][_0x419a('0x1b')]);_0x20407f['offset']=qs[_0x419a('0x19')](_0xed0a76[_0x419a('0x2f')][_0x419a('0x19')]);}return _0x172d14[_0x419a('0x4d')](_0x20407f);}})['then'](function(_0x5b31f3){if(_0x5b31f3){return _0x5b31f3?{'count':_0x5c24e2,'rows':_0x5b31f3}:null;}})['then'](respondWithResult(_0x5efc5d,null))['catch'](handleError(_0x5efc5d,null));};exports[_0x419a('0x4e')]=function(_0xf85464,_0x109ad3,_0x4dc32c){var _0x1245a0={};var _0x26c957={};var _0x46fb8c;var _0x18f39d;return db[_0x419a('0x29')][_0x419a('0x49')]({'where':{'id':_0xf85464[_0x419a('0x47')]['id']}})['then'](handleEntityNotFound(_0x109ad3,null))['then'](function(_0x260b2d){if(_0x260b2d){_0x46fb8c=_0x260b2d;_0x26c957['model']=_[_0x419a('0x30')](db['SugarcrmField'][_0x419a('0x2a')]);_0x26c957[_0x419a('0x2f')]=_[_0x419a('0x30')](_0xf85464[_0x419a('0x2f')]);_0x26c957[_0x419a('0x38')]=_[_0x419a('0x31')](_0x26c957[_0x419a('0x2e')],_0x26c957[_0x419a('0x2f')]);_0x1245a0[_0x419a('0x32')]=_[_0x419a('0x31')](_0x26c957[_0x419a('0x2e')],qs['fields'](_0xf85464[_0x419a('0x2f')]['fields']));_0x1245a0[_0x419a('0x32')]=_0x1245a0[_0x419a('0x32')]['length']?_0x1245a0[_0x419a('0x32')]:_0x26c957[_0x419a('0x2e')];_0x1245a0[_0x419a('0x35')]=qs[_0x419a('0x36')](_0xf85464[_0x419a('0x2f')]['sort']);_0x1245a0[_0x419a('0x37')]=qs[_0x419a('0x38')](_[_0x419a('0x39')](_0xf85464['query'],_0x26c957[_0x419a('0x38')]));if(_0xf85464['query'][_0x419a('0x4b')]){_0x1245a0['where']=_['merge'](_0x1245a0['where'],{'$or':_['map'](_0x1245a0[_0x419a('0x32')],function(_0x26aaa4){var _0x5c63bc={};_0x5c63bc[_0x26aaa4]={'$like':'%'+_0xf85464[_0x419a('0x2f')][_0x419a('0x4b')]+'%'};return _0x5c63bc;})});}_0x1245a0=_[_0x419a('0x3a')]({},_0x1245a0,_0xf85464['options']);return _0x46fb8c[_0x419a('0x4e')](_0x1245a0);}})[_0x419a('0x23')](function(_0x5da86f){if(_0x5da86f){_0x18f39d=_0x5da86f[_0x419a('0x42')];if(!_0xf85464[_0x419a('0x2f')][_0x419a('0x34')](_0x419a('0x4c'))){_0x1245a0[_0x419a('0x1b')]=qs[_0x419a('0x1b')](_0xf85464[_0x419a('0x2f')][_0x419a('0x1b')]);_0x1245a0[_0x419a('0x19')]=qs[_0x419a('0x19')](_0xf85464[_0x419a('0x2f')][_0x419a('0x19')]);}return _0x46fb8c[_0x419a('0x4e')](_0x1245a0);}})[_0x419a('0x23')](function(_0x2fbd7b){if(_0x2fbd7b){return _0x2fbd7b?{'count':_0x18f39d,'rows':_0x2fbd7b}:null;}})['then'](respondWithResult(_0x109ad3,null))['catch'](handleError(_0x109ad3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5f1ca81..80c69da 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 _0x8282=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1daee2,_0x5a8b7d){var _0x336184=function(_0x542dc6){while(--_0x542dc6){_0x1daee2['push'](_0x1daee2['shift']());}};_0x336184(++_0x5a8b7d);}(_0x8282,0x12d));var _0x2828=function(_0x26df88,_0x2b3da4){_0x26df88=_0x26df88-0x0;var _0xe44d79=_0x8282[_0x26df88];return _0xe44d79;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2828('0x0'))(_0x2828('0x1'));var moment=require(_0x2828('0x2'));var BPromise=require(_0x2828('0x3'));var rp=require(_0x2828('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2828('0x5'));var attributes=require(_0x2828('0x6'));module[_0x2828('0x7')]=function(_0x3e1bc9,_0x2db1e3){return _0x3e1bc9[_0x2828('0x8')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0721=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0721,0x1d8));var _0x1072=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0x0721[_0x2daef6];return _0x62d030;};'use strict';var _=require(_0x1072('0x0'));var util=require(_0x1072('0x1'));var logger=require(_0x1072('0x2'))(_0x1072('0x3'));var moment=require(_0x1072('0x4'));var BPromise=require(_0x1072('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1072('0x6'));var attributes=require(_0x1072('0x7'));module[_0x1072('0x8')]=function(_0xa8d599,_0x2764a9){return _0xa8d599[_0x1072('0x9')](_0x1072('0xa'),attributes,{'tableName':_0x1072('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 3ddf3c9..c155cb3 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 _0x2a50=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2a50,0x1df));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x02a5('0x0'));var moment=require('moment');var BPromise=require(_0x02a5('0x1'));var rs=require(_0x02a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x02a5('0x4'))(_0x02a5('0x5'));var config=require('../../config/environment');var jayson=require(_0x02a5('0x6'));var client=jayson[_0x02a5('0x7')][_0x02a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x447cd0,_0x24cc14,_0x143d5f){return new BPromise(function(_0x460ffd,_0x5e9ccb){return client['request'](_0x447cd0,_0x143d5f)['then'](function(_0x53ea03){logger[_0x02a5('0x9')](_0x02a5('0xa'),_0x24cc14,_0x02a5('0xb'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x24cc14,'request\x20sent',JSON['stringify'](_0x53ea03));if(_0x53ea03[_0x02a5('0xc')]){if(_0x53ea03['error'][_0x02a5('0xd')]===0x1f4){logger[_0x02a5('0xc')](_0x02a5('0xa'),_0x24cc14,_0x53ea03['error'][_0x02a5('0xe')]);return _0x5e9ccb(_0x53ea03[_0x02a5('0xc')][_0x02a5('0xe')]);}logger[_0x02a5('0xc')](_0x02a5('0xa'),_0x24cc14,_0x53ea03['error'][_0x02a5('0xe')]);return _0x460ffd(_0x53ea03[_0x02a5('0xc')][_0x02a5('0xe')]);}else{logger[_0x02a5('0x9')](_0x02a5('0xa'),_0x24cc14,_0x02a5('0xb'));_0x460ffd(_0x53ea03[_0x02a5('0xf')][_0x02a5('0xe')]);}})[_0x02a5('0x10')](function(_0xf367bf){logger[_0x02a5('0xc')](_0x02a5('0xa'),_0x24cc14,_0xf367bf);_0x5e9ccb(_0xf367bf);});});} \ No newline at end of file +var _0x9b2c=['then','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x380891,_0x6a4035){var _0x1d4101=function(_0x363ac6){while(--_0x363ac6){_0x380891['push'](_0x380891['shift']());}};_0x1d4101(++_0x6a4035);}(_0x9b2c,0x6b));var _0xc9b2=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x9b2c[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xc9b2('0x0'));var util=require(_0xc9b2('0x1'));var moment=require('moment');var BPromise=require(_0xc9b2('0x2'));var rs=require(_0xc9b2('0x3'));var fs=require('fs');var Redis=require(_0xc9b2('0x4'));var db=require(_0xc9b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9b2('0x6'))(_0xc9b2('0x7'));var config=require(_0xc9b2('0x8'));var jayson=require(_0xc9b2('0x9'));var client=jayson[_0xc9b2('0xa')][_0xc9b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aac34,_0x5e7617,_0x78c7a9){return new BPromise(function(_0x170fdd,_0x22c30c){return client[_0xc9b2('0xc')](_0x5aac34,_0x78c7a9)[_0xc9b2('0xd')](function(_0x580ca4){logger['info'](_0xc9b2('0xe'),_0x5e7617,'request\x20sent');logger[_0xc9b2('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5e7617,_0xc9b2('0x10'),JSON[_0xc9b2('0x11')](_0x580ca4));if(_0x580ca4[_0xc9b2('0x12')]){if(_0x580ca4[_0xc9b2('0x12')][_0xc9b2('0x13')]===0x1f4){logger['error'](_0xc9b2('0xe'),_0x5e7617,_0x580ca4[_0xc9b2('0x12')][_0xc9b2('0x14')]);return _0x22c30c(_0x580ca4['error'][_0xc9b2('0x14')]);}logger[_0xc9b2('0x12')](_0xc9b2('0xe'),_0x5e7617,_0x580ca4[_0xc9b2('0x12')][_0xc9b2('0x14')]);return _0x170fdd(_0x580ca4['error'][_0xc9b2('0x14')]);}else{logger[_0xc9b2('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e7617,'request\x20sent');_0x170fdd(_0x580ca4[_0xc9b2('0x16')][_0xc9b2('0x14')]);}})[_0xc9b2('0x17')](function(_0x2c6ced){logger[_0xc9b2('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e7617,_0x2c6ced);_0x22c30c(_0x2c6ced);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 90e9eca..bbdfdec 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 _0x5f63=['../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x337403,_0xb2614a){var _0x362caf=function(_0x10d4c6){while(--_0x10d4c6){_0x337403['push'](_0x337403['shift']());}};_0x362caf(++_0xb2614a);}(_0x5f63,0xcb));var _0x35f6=function(_0x192b15,_0x43f5d1){_0x192b15=_0x192b15-0x0;var _0x10ca4e=_0x5f63[_0x192b15];return _0x10ca4e;};'use strict';var multer=require(_0x35f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35f6('0x1'));var express=require(_0x35f6('0x2'));var router=express[_0x35f6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35f6('0x4'));var interaction=require(_0x35f6('0x5'));var config=require(_0x35f6('0x6'));var controller=require(_0x35f6('0x7'));router[_0x35f6('0x8')]('/',auth['isAuthenticated'](),controller[_0x35f6('0x9')]);router[_0x35f6('0x8')]('/:id',auth[_0x35f6('0xa')](),controller[_0x35f6('0xb')]);router[_0x35f6('0xc')]('/',auth[_0x35f6('0xa')](),controller[_0x35f6('0xd')]);router[_0x35f6('0xe')](_0x35f6('0xf'),auth['isAuthenticated'](),controller[_0x35f6('0x10')]);router[_0x35f6('0x11')](_0x35f6('0xf'),auth[_0x35f6('0xa')](),controller[_0x35f6('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbbb0=['get','isAuthenticated','index','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','../../config/environment'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xbbb0,0xf9));var _0x0bbb=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xbbb0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0bbb('0x0'));var util=require('util');var path=require(_0x0bbb('0x1'));var timeout=require(_0x0bbb('0x2'));var express=require(_0x0bbb('0x3'));var router=express[_0x0bbb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0bbb('0x5'));var controller=require('./intSugarcrmField.controller');router[_0x0bbb('0x6')]('/',auth[_0x0bbb('0x7')](),controller[_0x0bbb('0x8')]);router[_0x0bbb('0x6')]('/:id',auth[_0x0bbb('0x7')](),controller[_0x0bbb('0x9')]);router[_0x0bbb('0xa')]('/',auth[_0x0bbb('0x7')](),controller[_0x0bbb('0xb')]);router[_0x0bbb('0xc')]('/:id',auth[_0x0bbb('0x7')](),controller[_0x0bbb('0xd')]);router['delete']('/:id',auth[_0x0bbb('0x7')](),controller['destroy']);module[_0x0bbb('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0445241..2d856a7 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 _0xfad6=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xfad6,0x18b));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6fad('0x0'));module[_0x6fad('0x1')]={'type':{'type':Sequelize[_0x6fad('0x2')](_0x6fad('0x3'),_0x6fad('0x4'),_0x6fad('0x5'),_0x6fad('0x6'),_0x6fad('0x7')),'defaultValue':_0x6fad('0x3')},'content':{'type':Sequelize[_0x6fad('0x8')]},'key':{'type':Sequelize[_0x6fad('0x8')]},'keyType':{'type':Sequelize[_0x6fad('0x2')](_0x6fad('0x3'),_0x6fad('0x4'),_0x6fad('0x5'))},'keyContent':{'type':Sequelize[_0x6fad('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6fad('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6fad('0x8')]}}; \ No newline at end of file +var _0xe025=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x48b41d,_0x2f433f){var _0x10732e=function(_0x506329){while(--_0x506329){_0x48b41d['push'](_0x48b41d['shift']());}};_0x10732e(++_0x2f433f);}(_0xe025,0x155));var _0x5e02=function(_0x3f3821,_0x5e9f6c){_0x3f3821=_0x3f3821-0x0;var _0x4a58dd=_0xe025[_0x3f3821];return _0x4a58dd;};'use strict';var Sequelize=require(_0x5e02('0x0'));module['exports']={'type':{'type':Sequelize[_0x5e02('0x1')](_0x5e02('0x2'),_0x5e02('0x3'),_0x5e02('0x4'),_0x5e02('0x5'),_0x5e02('0x6')),'defaultValue':_0x5e02('0x2')},'content':{'type':Sequelize[_0x5e02('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5e02('0x1')]('string',_0x5e02('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x5e02('0x7')]},'idField':{'type':Sequelize[_0x5e02('0x7')]},'nameField':{'type':Sequelize[_0x5e02('0x7')]},'customField':{'type':Sequelize[_0x5e02('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c954fc9..ccd9f72 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 _0x39af=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create'];(function(_0x115d8c,_0xcb6b48){var _0x4c523b=function(_0x37e715){while(--_0x37e715){_0x115d8c['push'](_0x115d8c['shift']());}};_0x4c523b(++_0xcb6b48);}(_0x39af,0x9b));var _0xf39a=function(_0x43ef00,_0x1ad584){_0x43ef00=_0x43ef00-0x0;var _0x3303c1=_0x39af[_0x43ef00];return _0x3303c1;};'use strict';var emlformat=require(_0xf39a('0x0'));var rimraf=require(_0xf39a('0x1'));var zipdir=require(_0xf39a('0x2'));var jsonpatch=require(_0xf39a('0x3'));var rp=require(_0xf39a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf39a('0x5'));var util=require(_0xf39a('0x6'));var path=require(_0xf39a('0x7'));var sox=require(_0xf39a('0x8'));var csv=require(_0xf39a('0x9'));var ejs=require(_0xf39a('0xa'));var fs=require('fs');var fs_extra=require(_0xf39a('0xb'));var _=require(_0xf39a('0xc'));var squel=require(_0xf39a('0xd'));var crypto=require('crypto');var jsforce=require(_0xf39a('0xe'));var deskjs=require(_0xf39a('0xf'));var toCsv=require(_0xf39a('0x9'));var querystring=require(_0xf39a('0x10'));var Papa=require(_0xf39a('0x11'));var Redis=require(_0xf39a('0x12'));var authService=require(_0xf39a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf39a('0x14'));var hardwareService=require(_0xf39a('0x15'));var logger=require(_0xf39a('0x16'))(_0xf39a('0x17'));var utils=require('../../config/utils');var config=require(_0xf39a('0x18'));var licenseUtil=require(_0xf39a('0x19'));var db=require(_0xf39a('0x1a'))['db'];function respondWithStatusCode(_0x32f703,_0x434723){_0x434723=_0x434723||0xcc;return function(_0x45a297){if(_0x45a297){return _0x32f703[_0xf39a('0x1b')](_0x434723);}return _0x32f703['status'](_0x434723)[_0xf39a('0x1c')]();};}function respondWithResult(_0x587eac,_0x592080){_0x592080=_0x592080||0xc8;return function(_0x1595c8){if(_0x1595c8){return _0x587eac[_0xf39a('0x1d')](_0x592080)['json'](_0x1595c8);}};}function respondWithFilteredResult(_0x529e57,_0x17f11b){return function(_0x1fd4bd){if(_0x1fd4bd){var _0x5f4de4=typeof _0x17f11b[_0xf39a('0x1e')]===_0xf39a('0x1f')&&typeof _0x17f11b[_0xf39a('0x20')]===_0xf39a('0x1f');var _0x30955b=_0x1fd4bd[_0xf39a('0x21')];var _0x5a30df=_0x5f4de4?0x0:_0x17f11b[_0xf39a('0x1e')];var _0x3155d4=_0x5f4de4?_0x1fd4bd[_0xf39a('0x21')]:_0x17f11b['offset']+_0x17f11b['limit'];var _0x397310;if(_0x3155d4>=_0x30955b){_0x3155d4=_0x30955b;_0x397310=0xc8;}else{_0x397310=0xce;}_0x529e57[_0xf39a('0x1d')](_0x397310);return _0x529e57[_0xf39a('0x22')](_0xf39a('0x23'),_0x5a30df+'-'+_0x3155d4+'/'+_0x30955b)[_0xf39a('0x24')](_0x1fd4bd);}return null;};}function patchUpdates(_0x30c380){return function(_0x5ed7ee){try{jsonpatch[_0xf39a('0x25')](_0x5ed7ee,_0x30c380,!![]);}catch(_0x1b6e35){return BPromise[_0xf39a('0x26')](_0x1b6e35);}return _0x5ed7ee[_0xf39a('0x27')]();};}function saveUpdates(_0x4cf067,_0x1c0230){return function(_0x3e6a98){if(_0x3e6a98){return _0x3e6a98[_0xf39a('0x28')](_0x4cf067)[_0xf39a('0x29')](function(_0x4efb44){return _0x4efb44;});}return null;};}function removeEntity(_0x14a529,_0x2764d1){return function(_0x282588){if(_0x282588){return _0x282588[_0xf39a('0x2a')]()[_0xf39a('0x29')](function(){_0x14a529[_0xf39a('0x1d')](0xcc)[_0xf39a('0x1c')]();});}};}function handleEntityNotFound(_0x4642a0,_0x2cc078){return function(_0x33a02e){if(!_0x33a02e){_0x4642a0[_0xf39a('0x1b')](0x194);}return _0x33a02e;};}function handleError(_0x34130c,_0x4592f1){_0x4592f1=_0x4592f1||0x1f4;return function(_0x1603fd){logger['error'](_0x1603fd[_0xf39a('0x2b')]);if(_0x1603fd['name']){delete _0x1603fd[_0xf39a('0x2c')];}_0x34130c[_0xf39a('0x1d')](_0x4592f1)['send'](_0x1603fd);};}exports['index']=function(_0x1f523f,_0x58fcbf){var _0x4a024d={},_0x170109={},_0x24f72f={'count':0x0,'rows':[]};var _0x33c533=_[_0xf39a('0x2d')](db[_0xf39a('0x2e')][_0xf39a('0x2f')],function(_0x5add75){return{'name':_0x5add75[_0xf39a('0x30')],'type':_0x5add75[_0xf39a('0x31')][_0xf39a('0x32')]};});_0x170109[_0xf39a('0x33')]=_[_0xf39a('0x2d')](_0x33c533,_0xf39a('0x2c'));_0x170109['query']=_['keys'](_0x1f523f[_0xf39a('0x34')]);_0x170109[_0xf39a('0x35')]=_['intersection'](_0x170109[_0xf39a('0x33')],_0x170109['query']);_0x4a024d[_0xf39a('0x36')]=_[_0xf39a('0x37')](_0x170109['model'],qs[_0xf39a('0x38')](_0x1f523f[_0xf39a('0x34')][_0xf39a('0x38')]));_0x4a024d['attributes']=_0x4a024d[_0xf39a('0x36')][_0xf39a('0x39')]?_0x4a024d['attributes']:_0x170109[_0xf39a('0x33')];if(!_0x1f523f[_0xf39a('0x34')][_0xf39a('0x3a')]('nolimit')){_0x4a024d['limit']=qs[_0xf39a('0x20')](_0x1f523f['query'][_0xf39a('0x20')]);_0x4a024d[_0xf39a('0x1e')]=qs[_0xf39a('0x1e')](_0x1f523f[_0xf39a('0x34')][_0xf39a('0x1e')]);}_0x4a024d[_0xf39a('0x3b')]=qs[_0xf39a('0x3c')](_0x1f523f[_0xf39a('0x34')]['sort']);_0x4a024d[_0xf39a('0x3d')]=qs[_0xf39a('0x35')](_[_0xf39a('0x3e')](_0x1f523f[_0xf39a('0x34')],_0x170109[_0xf39a('0x35')]),_0x33c533);if(_0x1f523f[_0xf39a('0x34')][_0xf39a('0x3f')]){_0x4a024d[_0xf39a('0x3d')]=_[_0xf39a('0x40')](_0x4a024d['where'],{'$or':_['map'](_0x33c533,function(_0x5574e5){if(_0x5574e5[_0xf39a('0x31')]!==_0xf39a('0x41')){var _0x6238d2={};_0x6238d2[_0x5574e5[_0xf39a('0x2c')]]={'$like':'%'+_0x1f523f[_0xf39a('0x34')]['filter']+'%'};return _0x6238d2;}})});}_0x4a024d=_[_0xf39a('0x40')]({},_0x4a024d,_0x1f523f[_0xf39a('0x42')]);var _0x24d69e={'where':_0x4a024d[_0xf39a('0x3d')]};return db[_0xf39a('0x2e')][_0xf39a('0x21')](_0x24d69e)[_0xf39a('0x29')](function(_0x1db0d2){_0x24f72f[_0xf39a('0x21')]=_0x1db0d2;if(_0x1f523f[_0xf39a('0x34')][_0xf39a('0x43')]){_0x4a024d['include']=[{'all':!![]}];}return db[_0xf39a('0x2e')]['findAll'](_0x4a024d);})[_0xf39a('0x29')](function(_0x5f12f5){_0x24f72f[_0xf39a('0x44')]=_0x5f12f5;return _0x24f72f;})['then'](respondWithFilteredResult(_0x58fcbf,_0x4a024d))[_0xf39a('0x45')](handleError(_0x58fcbf,null));};exports[_0xf39a('0x46')]=function(_0x36eec6,_0x40c1b2){var _0x2b7792={'raw':!![],'where':{'id':_0x36eec6[_0xf39a('0x47')]['id']}},_0x37495e={};_0x37495e[_0xf39a('0x33')]=_[_0xf39a('0x48')](db[_0xf39a('0x2e')][_0xf39a('0x2f')]);_0x37495e[_0xf39a('0x34')]=_[_0xf39a('0x48')](_0x36eec6[_0xf39a('0x34')]);_0x37495e[_0xf39a('0x35')]=_[_0xf39a('0x37')](_0x37495e[_0xf39a('0x33')],_0x37495e[_0xf39a('0x34')]);_0x2b7792[_0xf39a('0x36')]=_[_0xf39a('0x37')](_0x37495e[_0xf39a('0x33')],qs['fields'](_0x36eec6[_0xf39a('0x34')]['fields']));_0x2b7792[_0xf39a('0x36')]=_0x2b7792[_0xf39a('0x36')][_0xf39a('0x39')]?_0x2b7792[_0xf39a('0x36')]:_0x37495e[_0xf39a('0x33')];if(_0x36eec6[_0xf39a('0x34')][_0xf39a('0x43')]){_0x2b7792[_0xf39a('0x49')]=[{'all':!![]}];}_0x2b7792=_['merge']({},_0x2b7792,_0x36eec6['options']);return db[_0xf39a('0x2e')][_0xf39a('0x4a')](_0x2b7792)['then'](handleEntityNotFound(_0x40c1b2,null))[_0xf39a('0x29')](respondWithResult(_0x40c1b2,null))[_0xf39a('0x45')](handleError(_0x40c1b2,null));};exports[_0xf39a('0x4b')]=function(_0x1bffdb,_0x161402){return db[_0xf39a('0x2e')]['create'](_0x1bffdb[_0xf39a('0x4c')],{})[_0xf39a('0x29')](respondWithResult(_0x161402,0xc9))[_0xf39a('0x45')](handleError(_0x161402,null));};exports[_0xf39a('0x28')]=function(_0x324b28,_0x329a14){if(_0x324b28[_0xf39a('0x4c')]['id']){delete _0x324b28[_0xf39a('0x4c')]['id'];}return db[_0xf39a('0x2e')][_0xf39a('0x4a')]({'where':{'id':_0x324b28['params']['id']}})[_0xf39a('0x29')](handleEntityNotFound(_0x329a14,null))[_0xf39a('0x29')](saveUpdates(_0x324b28[_0xf39a('0x4c')],null))[_0xf39a('0x29')](respondWithResult(_0x329a14,null))[_0xf39a('0x45')](handleError(_0x329a14,null));};exports[_0xf39a('0x2a')]=function(_0x31abf8,_0xd48bcd){return db[_0xf39a('0x2e')]['find']({'where':{'id':_0x31abf8[_0xf39a('0x47')]['id']}})[_0xf39a('0x29')](handleEntityNotFound(_0xd48bcd,null))[_0xf39a('0x29')](removeEntity(_0xd48bcd,null))['catch'](handleError(_0xd48bcd,null));}; \ No newline at end of file +var _0x7795=['limit','set','Content-Range','reject','update','then','end','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','include','findAll','rows','catch','includeAll','options','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0xb71203,_0x1ba794){var _0x185483=function(_0x48efb9){while(--_0x48efb9){_0xb71203['push'](_0xb71203['shift']());}};_0x185483(++_0x1ba794);}(_0x7795,0x14b));var _0x5779=function(_0x15d3e9,_0x5785f7){_0x15d3e9=_0x15d3e9-0x0;var _0x13fb5c=_0x7795[_0x15d3e9];return _0x13fb5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5779('0x0'));var zipdir=require(_0x5779('0x1'));var jsonpatch=require(_0x5779('0x2'));var rp=require(_0x5779('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5779('0x4'));var util=require(_0x5779('0x5'));var path=require('path');var sox=require(_0x5779('0x6'));var csv=require('to-csv');var ejs=require(_0x5779('0x7'));var fs=require('fs');var fs_extra=require(_0x5779('0x8'));var _=require(_0x5779('0x9'));var squel=require(_0x5779('0xa'));var crypto=require(_0x5779('0xb'));var jsforce=require(_0x5779('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5779('0xd'));var querystring=require(_0x5779('0xe'));var Papa=require(_0x5779('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5779('0x10'));var as=require(_0x5779('0x11'));var hardwareService=require(_0x5779('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5779('0x13'));var config=require(_0x5779('0x14'));var licenseUtil=require(_0x5779('0x15'));var db=require(_0x5779('0x16'))['db'];function respondWithStatusCode(_0x48a8f1,_0x26a7e9){_0x26a7e9=_0x26a7e9||0xcc;return function(_0x52e90e){if(_0x52e90e){return _0x48a8f1[_0x5779('0x17')](_0x26a7e9);}return _0x48a8f1['status'](_0x26a7e9)['end']();};}function respondWithResult(_0x59973a,_0x1214e9){_0x1214e9=_0x1214e9||0xc8;return function(_0x6f95cb){if(_0x6f95cb){return _0x59973a[_0x5779('0x18')](_0x1214e9)[_0x5779('0x19')](_0x6f95cb);}};}function respondWithFilteredResult(_0x2d00da,_0x5391e8){return function(_0x24a948){if(_0x24a948){var _0x270f5f=typeof _0x5391e8[_0x5779('0x1a')]===_0x5779('0x1b')&&typeof _0x5391e8['limit']===_0x5779('0x1b');var _0x2c694b=_0x24a948[_0x5779('0x1c')];var _0x25caa6=_0x270f5f?0x0:_0x5391e8[_0x5779('0x1a')];var _0x510057=_0x270f5f?_0x24a948[_0x5779('0x1c')]:_0x5391e8[_0x5779('0x1a')]+_0x5391e8[_0x5779('0x1d')];var _0x8be4d;if(_0x510057>=_0x2c694b){_0x510057=_0x2c694b;_0x8be4d=0xc8;}else{_0x8be4d=0xce;}_0x2d00da[_0x5779('0x18')](_0x8be4d);return _0x2d00da[_0x5779('0x1e')](_0x5779('0x1f'),_0x25caa6+'-'+_0x510057+'/'+_0x2c694b)['json'](_0x24a948);}return null;};}function patchUpdates(_0x57c053){return function(_0x54d720){try{jsonpatch['apply'](_0x54d720,_0x57c053,!![]);}catch(_0x3d11a4){return BPromise[_0x5779('0x20')](_0x3d11a4);}return _0x54d720['save']();};}function saveUpdates(_0x256d76,_0x4ad627){return function(_0x1017ad){if(_0x1017ad){return _0x1017ad[_0x5779('0x21')](_0x256d76)[_0x5779('0x22')](function(_0x2ee212){return _0x2ee212;});}return null;};}function removeEntity(_0x44b5dd,_0x5c2483){return function(_0x251618){if(_0x251618){return _0x251618['destroy']()['then'](function(){_0x44b5dd['status'](0xcc)[_0x5779('0x23')]();});}};}function handleEntityNotFound(_0xd8d99c,_0x4ee375){return function(_0x254cec){if(!_0x254cec){_0xd8d99c[_0x5779('0x17')](0x194);}return _0x254cec;};}function handleError(_0x204ae7,_0x14faf3){_0x14faf3=_0x14faf3||0x1f4;return function(_0x28e334){logger[_0x5779('0x24')](_0x28e334[_0x5779('0x25')]);if(_0x28e334[_0x5779('0x26')]){delete _0x28e334['name'];}_0x204ae7[_0x5779('0x18')](_0x14faf3)[_0x5779('0x27')](_0x28e334);};}exports[_0x5779('0x28')]=function(_0x5262e4,_0x5f1e58){var _0x4cf26a={},_0x6c0adc={},_0x58ff21={'count':0x0,'rows':[]};var _0x1dd601=_['map'](db[_0x5779('0x29')][_0x5779('0x2a')],function(_0x26b8e7){return{'name':_0x26b8e7[_0x5779('0x2b')],'type':_0x26b8e7['type'][_0x5779('0x2c')]};});_0x6c0adc['model']=_[_0x5779('0x2d')](_0x1dd601,'name');_0x6c0adc[_0x5779('0x2e')]=_[_0x5779('0x2f')](_0x5262e4[_0x5779('0x2e')]);_0x6c0adc['filters']=_[_0x5779('0x30')](_0x6c0adc[_0x5779('0x31')],_0x6c0adc[_0x5779('0x2e')]);_0x4cf26a[_0x5779('0x32')]=_[_0x5779('0x30')](_0x6c0adc[_0x5779('0x31')],qs[_0x5779('0x33')](_0x5262e4[_0x5779('0x2e')][_0x5779('0x33')]));_0x4cf26a['attributes']=_0x4cf26a['attributes'][_0x5779('0x34')]?_0x4cf26a[_0x5779('0x32')]:_0x6c0adc[_0x5779('0x31')];if(!_0x5262e4[_0x5779('0x2e')][_0x5779('0x35')](_0x5779('0x36'))){_0x4cf26a[_0x5779('0x1d')]=qs[_0x5779('0x1d')](_0x5262e4[_0x5779('0x2e')][_0x5779('0x1d')]);_0x4cf26a['offset']=qs[_0x5779('0x1a')](_0x5262e4[_0x5779('0x2e')]['offset']);}_0x4cf26a['order']=qs[_0x5779('0x37')](_0x5262e4[_0x5779('0x2e')][_0x5779('0x37')]);_0x4cf26a[_0x5779('0x38')]=qs[_0x5779('0x39')](_['pick'](_0x5262e4[_0x5779('0x2e')],_0x6c0adc[_0x5779('0x39')]),_0x1dd601);if(_0x5262e4['query'][_0x5779('0x3a')]){_0x4cf26a[_0x5779('0x38')]=_[_0x5779('0x3b')](_0x4cf26a[_0x5779('0x38')],{'$or':_[_0x5779('0x2d')](_0x1dd601,function(_0x53605f){if(_0x53605f[_0x5779('0x3c')]!==_0x5779('0x3d')){var _0x1a43ed={};_0x1a43ed[_0x53605f[_0x5779('0x26')]]={'$like':'%'+_0x5262e4[_0x5779('0x2e')]['filter']+'%'};return _0x1a43ed;}})});}_0x4cf26a=_[_0x5779('0x3b')]({},_0x4cf26a,_0x5262e4['options']);var _0x56828f={'where':_0x4cf26a[_0x5779('0x38')]};return db[_0x5779('0x29')]['count'](_0x56828f)['then'](function(_0x1992de){_0x58ff21[_0x5779('0x1c')]=_0x1992de;if(_0x5262e4[_0x5779('0x2e')]['includeAll']){_0x4cf26a[_0x5779('0x3e')]=[{'all':!![]}];}return db[_0x5779('0x29')][_0x5779('0x3f')](_0x4cf26a);})['then'](function(_0x231d82){_0x58ff21[_0x5779('0x40')]=_0x231d82;return _0x58ff21;})['then'](respondWithFilteredResult(_0x5f1e58,_0x4cf26a))[_0x5779('0x41')](handleError(_0x5f1e58,null));};exports['show']=function(_0x3c1f8d,_0x4cee2d){var _0x59ac6d={'raw':!![],'where':{'id':_0x3c1f8d['params']['id']}},_0x365e08={};_0x365e08[_0x5779('0x31')]=_[_0x5779('0x2f')](db[_0x5779('0x29')][_0x5779('0x2a')]);_0x365e08[_0x5779('0x2e')]=_[_0x5779('0x2f')](_0x3c1f8d[_0x5779('0x2e')]);_0x365e08['filters']=_[_0x5779('0x30')](_0x365e08[_0x5779('0x31')],_0x365e08[_0x5779('0x2e')]);_0x59ac6d['attributes']=_[_0x5779('0x30')](_0x365e08[_0x5779('0x31')],qs[_0x5779('0x33')](_0x3c1f8d[_0x5779('0x2e')][_0x5779('0x33')]));_0x59ac6d['attributes']=_0x59ac6d['attributes']['length']?_0x59ac6d[_0x5779('0x32')]:_0x365e08[_0x5779('0x31')];if(_0x3c1f8d['query'][_0x5779('0x42')]){_0x59ac6d[_0x5779('0x3e')]=[{'all':!![]}];}_0x59ac6d=_[_0x5779('0x3b')]({},_0x59ac6d,_0x3c1f8d[_0x5779('0x43')]);return db[_0x5779('0x29')]['find'](_0x59ac6d)[_0x5779('0x22')](handleEntityNotFound(_0x4cee2d,null))[_0x5779('0x22')](respondWithResult(_0x4cee2d,null))[_0x5779('0x41')](handleError(_0x4cee2d,null));};exports[_0x5779('0x44')]=function(_0x42a4a3,_0x39d0bf){return db[_0x5779('0x29')][_0x5779('0x44')](_0x42a4a3[_0x5779('0x45')],{})['then'](respondWithResult(_0x39d0bf,0xc9))[_0x5779('0x41')](handleError(_0x39d0bf,null));};exports[_0x5779('0x21')]=function(_0x40d736,_0x476360){if(_0x40d736[_0x5779('0x45')]['id']){delete _0x40d736[_0x5779('0x45')]['id'];}return db[_0x5779('0x29')][_0x5779('0x46')]({'where':{'id':_0x40d736['params']['id']}})['then'](handleEntityNotFound(_0x476360,null))[_0x5779('0x22')](saveUpdates(_0x40d736['body'],null))[_0x5779('0x22')](respondWithResult(_0x476360,null))['catch'](handleError(_0x476360,null));};exports[_0x5779('0x47')]=function(_0xf88585,_0x45dad2){return db[_0x5779('0x29')][_0x5779('0x46')]({'where':{'id':_0xf88585['params']['id']}})[_0x5779('0x22')](handleEntityNotFound(_0x45dad2,null))[_0x5779('0x22')](removeEntity(_0x45dad2,null))['catch'](handleError(_0x45dad2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 2a7ea2d..40accba 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 _0x2c81=['exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','api','bluebird','path'];(function(_0x46dafe,_0x4b06c6){var _0x5c87fc=function(_0x24ce17){while(--_0x24ce17){_0x46dafe['push'](_0x46dafe['shift']());}};_0x5c87fc(++_0x4b06c6);}(_0x2c81,0xc4));var _0x12c8=function(_0xa8617e,_0x2d8fe6){_0xa8617e=_0xa8617e-0x0;var _0x519c96=_0x2c81[_0xa8617e];return _0x519c96;};'use strict';var _=require('lodash');var util=require(_0x12c8('0x0'));var logger=require('../../config/logger')(_0x12c8('0x1'));var moment=require('moment');var BPromise=require(_0x12c8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12c8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x12c8('0x4')]=function(_0x1907bd,_0x470fcf){return _0x1907bd['define'](_0x12c8('0x5'),attributes,{'tableName':_0x12c8('0x6'),'paranoid':![],'indexes':[{'name':_0x12c8('0x7'),'fields':[_0x12c8('0x8'),_0x12c8('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b5e=['int_sugarcrm_fields','sugarcrm_unique_index','idField','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x576139,_0x4d401d){var _0x3519cc=function(_0x45c718){while(--_0x45c718){_0x576139['push'](_0x576139['shift']());}};_0x3519cc(++_0x4d401d);}(_0x2b5e,0xf5));var _0xe2b5=function(_0x5d8cb7,_0x2851f7){_0x5d8cb7=_0x5d8cb7-0x0;var _0xece05d=_0x2b5e[_0x5d8cb7];return _0xece05d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe2b5('0x0'))(_0xe2b5('0x1'));var moment=require('moment');var BPromise=require(_0xe2b5('0x2'));var rp=require(_0xe2b5('0x3'));var fs=require('fs');var path=require(_0xe2b5('0x4'));var rimraf=require(_0xe2b5('0x5'));var config=require(_0xe2b5('0x6'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x62edaa,_0x3870cb){return _0x62edaa[_0xe2b5('0x7')]('SugarcrmField',attributes,{'tableName':_0xe2b5('0x8'),'paranoid':![],'indexes':[{'name':_0xe2b5('0x9'),'fields':[_0xe2b5('0xa'),'FieldId'],'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 8d2d51a..ac149b1 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 _0x97bf=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x18b9a8,_0x1770b6){var _0x4a0a8f=function(_0x80ea93){while(--_0x80ea93){_0x18b9a8['push'](_0x18b9a8['shift']());}};_0x4a0a8f(++_0x1770b6);}(_0x97bf,0xf0));var _0xf97b=function(_0x45a259,_0x25e284){_0x45a259=_0x45a259-0x0;var _0x3dadd4=_0x97bf[_0x45a259];return _0x3dadd4;};'use strict';var _=require('lodash');var util=require(_0xf97b('0x0'));var moment=require(_0xf97b('0x1'));var BPromise=require(_0xf97b('0x2'));var rs=require(_0xf97b('0x3'));var fs=require('fs');var Redis=require(_0xf97b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf97b('0x5'));var logger=require(_0xf97b('0x6'))(_0xf97b('0x7'));var config=require(_0xf97b('0x8'));var jayson=require(_0xf97b('0x9'));var client=jayson[_0xf97b('0xa')][_0xf97b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13461e,_0x510367,_0x33af48){return new BPromise(function(_0x4e7bfe,_0x4e8289){return client['request'](_0x13461e,_0x33af48)[_0xf97b('0xc')](function(_0x281409){logger[_0xf97b('0xd')](_0xf97b('0xe'),_0x510367,_0xf97b('0xf'));logger['debug'](_0xf97b('0x10'),_0x510367,'request\x20sent',JSON[_0xf97b('0x11')](_0x281409));if(_0x281409[_0xf97b('0x12')]){if(_0x281409[_0xf97b('0x12')][_0xf97b('0x13')]===0x1f4){logger[_0xf97b('0x12')](_0xf97b('0xe'),_0x510367,_0x281409[_0xf97b('0x12')][_0xf97b('0x14')]);return _0x4e8289(_0x281409[_0xf97b('0x12')][_0xf97b('0x14')]);}logger[_0xf97b('0x12')](_0xf97b('0xe'),_0x510367,_0x281409['error']['message']);return _0x4e7bfe(_0x281409[_0xf97b('0x12')][_0xf97b('0x14')]);}else{logger[_0xf97b('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x510367,'request\x20sent');_0x4e7bfe(_0x281409[_0xf97b('0x15')][_0xf97b('0x14')]);}})[_0xf97b('0x16')](function(_0x292d42){logger[_0xf97b('0x12')](_0xf97b('0xe'),_0x510367,_0x292d42);_0x4e8289(_0x292d42);});});} \ No newline at end of file +var _0xba18=['request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d5693,_0x366839){var _0x3610e7=function(_0x1b3a1a){while(--_0x1b3a1a){_0x3d5693['push'](_0x3d5693['shift']());}};_0x3610e7(++_0x366839);}(_0xba18,0x159));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require('util');var moment=require(_0x8ba1('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ba1('0x2'));var fs=require('fs');var Redis=require(_0x8ba1('0x3'));var db=require(_0x8ba1('0x4'))['db'];var utils=require(_0x8ba1('0x5'));var logger=require(_0x8ba1('0x6'))(_0x8ba1('0x7'));var config=require(_0x8ba1('0x8'));var jayson=require(_0x8ba1('0x9'));var client=jayson[_0x8ba1('0xa')][_0x8ba1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb6ba2d,_0x51d9e9,_0x10a17a){return new BPromise(function(_0x16d20c,_0x5089dc){return client['request'](_0xb6ba2d,_0x10a17a)['then'](function(_0x204572){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x51d9e9,_0x8ba1('0xc'));logger['debug'](_0x8ba1('0xd'),_0x51d9e9,_0x8ba1('0xc'),JSON[_0x8ba1('0xe')](_0x204572));if(_0x204572['error']){if(_0x204572[_0x8ba1('0xf')][_0x8ba1('0x10')]===0x1f4){logger[_0x8ba1('0xf')](_0x8ba1('0x11'),_0x51d9e9,_0x204572[_0x8ba1('0xf')]['message']);return _0x5089dc(_0x204572['error']['message']);}logger[_0x8ba1('0xf')](_0x8ba1('0x11'),_0x51d9e9,_0x204572[_0x8ba1('0xf')][_0x8ba1('0x12')]);return _0x16d20c(_0x204572[_0x8ba1('0xf')][_0x8ba1('0x12')]);}else{logger[_0x8ba1('0x13')](_0x8ba1('0x11'),_0x51d9e9,'request\x20sent');_0x16d20c(_0x204572['result'][_0x8ba1('0x12')]);}})[_0x8ba1('0x14')](function(_0x4c93dd){logger['error'](_0x8ba1('0x11'),_0x51d9e9,_0x4c93dd);_0x5089dc(_0x4c93dd);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index d0b8025..cc06fe1 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 _0x26bc=['getConfigurations','/:id/fields','getFields','create','post','addConfiguration','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations'];(function(_0x51cf64,_0x303dab){var _0x2c982b=function(_0x471301){while(--_0x471301){_0x51cf64['push'](_0x51cf64['shift']());}};_0x2c982b(++_0x303dab);}(_0x26bc,0x162));var _0xc26b=function(_0xff0f79,_0x2996cd){_0xff0f79=_0xff0f79-0x0;var _0xe7a68=_0x26bc[_0xff0f79];return _0xe7a68;};'use strict';var multer=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var path=require(_0xc26b('0x2'));var timeout=require(_0xc26b('0x3'));var express=require(_0xc26b('0x4'));var router=express['Router']();var fs_extra=require(_0xc26b('0x5'));var auth=require(_0xc26b('0x6'));var interaction=require(_0xc26b('0x7'));var config=require('../../config/environment');var controller=require(_0xc26b('0x8'));router['get']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router[_0xc26b('0xb')]('/:id',auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0xb')](_0xc26b('0xd'),auth[_0xc26b('0x9')](),controller[_0xc26b('0xe')]);router[_0xc26b('0xb')](_0xc26b('0xf'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x10')]);router['post']('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0x11')]);router[_0xc26b('0x12')](_0xc26b('0xd'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x13')]);router['put'](_0xc26b('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xc26b('0x15')](_0xc26b('0x14'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x818f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x818f,0x1da));var _0xf818=function(_0x4d464e,_0xf11e70){_0x4d464e=_0x4d464e-0x0;var _0x8e991a=_0x818f[_0x4d464e];return _0x8e991a;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf818('0x6'));var interaction=require(_0xf818('0x7'));var config=require(_0xf818('0x8'));var controller=require(_0xf818('0x9'));router[_0xf818('0xa')]('/',auth[_0xf818('0xb')](),controller[_0xf818('0xc')]);router[_0xf818('0xa')](_0xf818('0xd'),auth['isAuthenticated'](),controller[_0xf818('0xe')]);router[_0xf818('0xa')](_0xf818('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf818('0xa')](_0xf818('0x10'),auth[_0xf818('0xb')](),controller[_0xf818('0x11')]);router[_0xf818('0x12')]('/',auth['isAuthenticated'](),controller[_0xf818('0x13')]);router[_0xf818('0x12')](_0xf818('0xf'),auth[_0xf818('0xb')](),controller[_0xf818('0x14')]);router['put']('/:id',auth[_0xf818('0xb')](),controller[_0xf818('0x15')]);router[_0xf818('0x16')](_0xf818('0xd'),auth['isAuthenticated'](),controller[_0xf818('0x17')]);module[_0xf818('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1359521..6d17f19 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 _0xd87b=['HelpDesk','exports','STRING'];(function(_0x227b67,_0x5c4075){var _0x16f616=function(_0x46e857){while(--_0x46e857){_0x227b67['push'](_0x227b67['shift']());}};_0x16f616(++_0x5c4075);}(_0xd87b,0x1e7));var _0xbd87=function(_0x4a9684,_0x97335b){_0x4a9684=_0x4a9684-0x0;var _0x1a4eef=_0xd87b[_0x4a9684];return _0x1a4eef;};'use strict';var Sequelize=require('sequelize');module[_0xbd87('0x0')]={'name':{'type':Sequelize[_0xbd87('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbd87('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbd87('0x1')],'allowNull':![],'defaultValue':_0xbd87('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xbd87('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xbd87('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd89e=['HelpDesk','sequelize','exports','STRING'];(function(_0x3c1622,_0x329031){var _0x4eb7ae=function(_0xedf616){while(--_0xedf616){_0x3c1622['push'](_0x3c1622['shift']());}};_0x4eb7ae(++_0x329031);}(_0xd89e,0x181));var _0xed89=function(_0x4bdc37,_0x2fdc2b){_0x4bdc37=_0x4bdc37-0x0;var _0x502412=_0xd89e[_0x4bdc37];return _0x502412;};'use strict';var Sequelize=require(_0xed89('0x0'));module[_0xed89('0x1')]={'name':{'type':Sequelize[_0xed89('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xed89('0x2')]},'username':{'type':Sequelize[_0xed89('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xed89('0x2')],'allowNull':![],'defaultValue':_0xed89('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xed89('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xed89('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 2a70bfc..b6dd13e 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 _0x80d5=['label','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','Content-Range','save','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','limit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','intersection','options','find','create','body','params','destroy','getConfigurations','findOne','VtigerConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','accessKey','moduleName','remoteUri','slice','substring','format','GET','success','POST','result','token','describe','sessionName','autogenerated','includes','editable','false','startsWith','picklistValues'];(function(_0x18410c,_0x998c69){var _0x1b482b=function(_0x440a97){while(--_0x440a97){_0x18410c['push'](_0x18410c['shift']());}};_0x1b482b(++_0x998c69);}(_0x80d5,0x1cc));var _0x580d=function(_0x219629,_0x57805a){_0x219629=_0x219629-0x0;var _0x38b66e=_0x80d5[_0x219629];return _0x38b66e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x580d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x580d('0x1'));var rp=require(_0x580d('0x2'));var moment=require(_0x580d('0x3'));var BPromise=require(_0x580d('0x4'));var Mustache=require(_0x580d('0x5'));var util=require(_0x580d('0x6'));var path=require('path');var sox=require(_0x580d('0x7'));var csv=require('to-csv');var ejs=require(_0x580d('0x8'));var fs=require('fs');var fs_extra=require(_0x580d('0x9'));var _=require(_0x580d('0xa'));var squel=require(_0x580d('0xb'));var crypto=require(_0x580d('0xc'));var jsforce=require(_0x580d('0xd'));var deskjs=require(_0x580d('0xe'));var toCsv=require(_0x580d('0xf'));var querystring=require(_0x580d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x580d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x580d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x580d('0x13'));var config=require(_0x580d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16cda2,_0x108aed){_0x108aed=_0x108aed||0xcc;return function(_0x2f65e6){if(_0x2f65e6){return _0x16cda2[_0x580d('0x15')](_0x108aed);}return _0x16cda2[_0x580d('0x16')](_0x108aed)[_0x580d('0x17')]();};}function respondWithResult(_0x2f2fcc,_0x258a4c){_0x258a4c=_0x258a4c||0xc8;return function(_0x5d47f4){if(_0x5d47f4){return _0x2f2fcc[_0x580d('0x16')](_0x258a4c)[_0x580d('0x18')](_0x5d47f4);}};}function respondWithFilteredResult(_0x29e1d5,_0x5a32e4){return function(_0x3b363c){if(_0x3b363c){var _0x1de049=typeof _0x5a32e4[_0x580d('0x19')]===_0x580d('0x1a')&&typeof _0x5a32e4['limit']===_0x580d('0x1a');var _0x501db9=_0x3b363c['count'];var _0x3d4628=_0x1de049?0x0:_0x5a32e4['offset'];var _0x5d50b4=_0x1de049?_0x3b363c[_0x580d('0x1b')]:_0x5a32e4[_0x580d('0x19')]+_0x5a32e4['limit'];var _0x510f42;if(_0x5d50b4>=_0x501db9){_0x5d50b4=_0x501db9;_0x510f42=0xc8;}else{_0x510f42=0xce;}_0x29e1d5['status'](_0x510f42);return _0x29e1d5['set'](_0x580d('0x1c'),_0x3d4628+'-'+_0x5d50b4+'/'+_0x501db9)[_0x580d('0x18')](_0x3b363c);}return null;};}function patchUpdates(_0x5aeecc){return function(_0x562da7){try{jsonpatch['apply'](_0x562da7,_0x5aeecc,!![]);}catch(_0x1667f6){return BPromise['reject'](_0x1667f6);}return _0x562da7[_0x580d('0x1d')]();};}function saveUpdates(_0x440697,_0x839b04){return function(_0x4f76ce){if(_0x4f76ce){return _0x4f76ce[_0x580d('0x1e')](_0x440697)[_0x580d('0x1f')](function(_0x369c75){return _0x369c75;});}return null;};}function removeEntity(_0x5b4080,_0x3548b8){return function(_0x5de213){if(_0x5de213){return _0x5de213['destroy']()[_0x580d('0x1f')](function(){_0x5b4080[_0x580d('0x16')](0xcc)[_0x580d('0x17')]();});}};}function handleEntityNotFound(_0x43158f,_0x3f5e48){return function(_0x267754){if(!_0x267754){_0x43158f[_0x580d('0x15')](0x194);}return _0x267754;};}function handleError(_0x62acb4,_0x435339){_0x435339=_0x435339||0x1f4;return function(_0x1d18a9){logger[_0x580d('0x20')](_0x1d18a9[_0x580d('0x21')]);if(_0x1d18a9['name']){delete _0x1d18a9[_0x580d('0x22')];}_0x62acb4[_0x580d('0x16')](_0x435339)[_0x580d('0x23')](_0x1d18a9);};}exports[_0x580d('0x24')]=function(_0x15ded5,_0x4cc348){var _0x1b1052={},_0x2945c8={},_0x11e129={'count':0x0,'rows':[]};var _0x11cfde=_[_0x580d('0x25')](db[_0x580d('0x26')][_0x580d('0x27')],function(_0x2ebfba){return{'name':_0x2ebfba['fieldName'],'type':_0x2ebfba[_0x580d('0x28')][_0x580d('0x29')]};});_0x2945c8['model']=_['map'](_0x11cfde,'name');_0x2945c8[_0x580d('0x2a')]=_[_0x580d('0x2b')](_0x15ded5[_0x580d('0x2a')]);_0x2945c8['filters']=_['intersection'](_0x2945c8[_0x580d('0x2c')],_0x2945c8[_0x580d('0x2a')]);_0x1b1052[_0x580d('0x2d')]=_['intersection'](_0x2945c8[_0x580d('0x2c')],qs[_0x580d('0x2e')](_0x15ded5['query']['fields']));_0x1b1052[_0x580d('0x2d')]=_0x1b1052[_0x580d('0x2d')][_0x580d('0x2f')]?_0x1b1052[_0x580d('0x2d')]:_0x2945c8[_0x580d('0x2c')];if(!_0x15ded5[_0x580d('0x2a')][_0x580d('0x30')]('nolimit')){_0x1b1052[_0x580d('0x31')]=qs[_0x580d('0x31')](_0x15ded5[_0x580d('0x2a')][_0x580d('0x31')]);_0x1b1052[_0x580d('0x19')]=qs['offset'](_0x15ded5[_0x580d('0x2a')]['offset']);}_0x1b1052[_0x580d('0x32')]=qs['sort'](_0x15ded5[_0x580d('0x2a')]['sort']);_0x1b1052[_0x580d('0x33')]=qs[_0x580d('0x34')](_[_0x580d('0x35')](_0x15ded5[_0x580d('0x2a')],_0x2945c8[_0x580d('0x34')]),_0x11cfde);if(_0x15ded5[_0x580d('0x2a')][_0x580d('0x36')]){_0x1b1052[_0x580d('0x33')]=_[_0x580d('0x37')](_0x1b1052[_0x580d('0x33')],{'$or':_['map'](_0x11cfde,function(_0x5c8a4f){if(_0x5c8a4f['type']!==_0x580d('0x38')){var _0x5db2d9={};_0x5db2d9[_0x5c8a4f[_0x580d('0x22')]]={'$like':'%'+_0x15ded5['query'][_0x580d('0x36')]+'%'};return _0x5db2d9;}})});}_0x1b1052=_[_0x580d('0x37')]({},_0x1b1052,_0x15ded5['options']);var _0x57fd3f={'where':_0x1b1052[_0x580d('0x33')]};return db[_0x580d('0x26')][_0x580d('0x1b')](_0x57fd3f)['then'](function(_0x37290a){_0x11e129[_0x580d('0x1b')]=_0x37290a;if(_0x15ded5[_0x580d('0x2a')][_0x580d('0x39')]){_0x1b1052[_0x580d('0x3a')]=[{'all':!![]}];}return db[_0x580d('0x26')][_0x580d('0x3b')](_0x1b1052);})[_0x580d('0x1f')](function(_0x3c26b7){_0x11e129[_0x580d('0x3c')]=_0x3c26b7;return _0x11e129;})['then'](respondWithFilteredResult(_0x4cc348,_0x1b1052))[_0x580d('0x3d')](handleError(_0x4cc348,null));};exports[_0x580d('0x3e')]=function(_0x758d2e,_0x36028f){var _0xbd6537={'raw':![],'where':{'id':_0x758d2e['params']['id']}},_0x25d118={};_0x25d118[_0x580d('0x2c')]=_[_0x580d('0x2b')](db['VtigerAccount'][_0x580d('0x27')]);_0x25d118[_0x580d('0x2a')]=_[_0x580d('0x2b')](_0x758d2e[_0x580d('0x2a')]);_0x25d118[_0x580d('0x34')]=_[_0x580d('0x3f')](_0x25d118['model'],_0x25d118[_0x580d('0x2a')]);_0xbd6537['attributes']=_[_0x580d('0x3f')](_0x25d118['model'],qs[_0x580d('0x2e')](_0x758d2e['query'][_0x580d('0x2e')]));_0xbd6537[_0x580d('0x2d')]=_0xbd6537['attributes']['length']?_0xbd6537[_0x580d('0x2d')]:_0x25d118[_0x580d('0x2c')];if(_0x758d2e[_0x580d('0x2a')][_0x580d('0x39')]){_0xbd6537['include']=[{'all':!![]}];}_0xbd6537=_[_0x580d('0x37')]({},_0xbd6537,_0x758d2e[_0x580d('0x40')]);return db[_0x580d('0x26')][_0x580d('0x41')](_0xbd6537)[_0x580d('0x1f')](handleEntityNotFound(_0x36028f,null))[_0x580d('0x1f')](respondWithResult(_0x36028f,null))['catch'](handleError(_0x36028f,null));};exports['create']=function(_0x48907e,_0xfec9af){return db[_0x580d('0x26')][_0x580d('0x42')](_0x48907e[_0x580d('0x43')],{})[_0x580d('0x1f')](respondWithResult(_0xfec9af,0xc9))[_0x580d('0x3d')](handleError(_0xfec9af,null));};exports[_0x580d('0x1e')]=function(_0x2db028,_0x2821c1){if(_0x2db028['body']['id']){delete _0x2db028[_0x580d('0x43')]['id'];}return db[_0x580d('0x26')][_0x580d('0x41')]({'where':{'id':_0x2db028[_0x580d('0x44')]['id']}})[_0x580d('0x1f')](handleEntityNotFound(_0x2821c1,null))[_0x580d('0x1f')](saveUpdates(_0x2db028[_0x580d('0x43')],null))[_0x580d('0x1f')](respondWithResult(_0x2821c1,null))[_0x580d('0x3d')](handleError(_0x2821c1,null));};exports[_0x580d('0x45')]=function(_0x2baffb,_0x5b9656){return db['VtigerAccount'][_0x580d('0x41')]({'where':{'id':_0x2baffb['params']['id']}})['then'](handleEntityNotFound(_0x5b9656,null))[_0x580d('0x1f')](removeEntity(_0x5b9656,null))['catch'](handleError(_0x5b9656,null));};exports[_0x580d('0x46')]=function(_0x4370e5,_0x5e21a2,_0x369441){var _0x560a77={};var _0x1165dc={};var _0x127aa5;var _0x2bebaa;return db['VtigerAccount'][_0x580d('0x47')]({'where':{'id':_0x4370e5['params']['id']}})['then'](handleEntityNotFound(_0x5e21a2,null))['then'](function(_0x500379){if(_0x500379){_0x127aa5=_0x500379;_0x1165dc[_0x580d('0x2c')]=_['keys'](db[_0x580d('0x48')]['rawAttributes']);_0x1165dc[_0x580d('0x2a')]=_[_0x580d('0x2b')](_0x4370e5['query']);_0x1165dc[_0x580d('0x34')]=_[_0x580d('0x3f')](_0x1165dc[_0x580d('0x2c')],_0x1165dc[_0x580d('0x2a')]);_0x560a77[_0x580d('0x2d')]=_[_0x580d('0x3f')](_0x1165dc[_0x580d('0x2c')],qs[_0x580d('0x2e')](_0x4370e5[_0x580d('0x2a')][_0x580d('0x2e')]));_0x560a77[_0x580d('0x2d')]=_0x560a77[_0x580d('0x2d')][_0x580d('0x2f')]?_0x560a77[_0x580d('0x2d')]:_0x1165dc[_0x580d('0x2c')];_0x560a77[_0x580d('0x32')]=qs['sort'](_0x4370e5[_0x580d('0x2a')][_0x580d('0x49')]);_0x560a77[_0x580d('0x33')]=qs[_0x580d('0x34')](_[_0x580d('0x35')](_0x4370e5[_0x580d('0x2a')],_0x1165dc[_0x580d('0x34')]));if(_0x4370e5['query']['filter']){_0x560a77['where']=_[_0x580d('0x37')](_0x560a77[_0x580d('0x33')],{'$or':_[_0x580d('0x25')](_0x560a77[_0x580d('0x2d')],function(_0x5ce777){var _0x5951c7={};_0x5951c7[_0x5ce777]={'$like':'%'+_0x4370e5[_0x580d('0x2a')]['filter']+'%'};return _0x5951c7;})});}_0x560a77=_[_0x580d('0x37')]({},_0x560a77,_0x4370e5['options']);return _0x127aa5[_0x580d('0x46')](_0x560a77);}})[_0x580d('0x1f')](function(_0x4591da){if(_0x4591da){_0x2bebaa=_0x4591da[_0x580d('0x2f')];if(!_0x4370e5['query'][_0x580d('0x30')]('nolimit')){_0x560a77[_0x580d('0x31')]=qs['limit'](_0x4370e5[_0x580d('0x2a')][_0x580d('0x31')]);_0x560a77[_0x580d('0x19')]=qs[_0x580d('0x19')](_0x4370e5[_0x580d('0x2a')]['offset']);}return _0x127aa5['getConfigurations'](_0x560a77);}})[_0x580d('0x1f')](function(_0x55dcc4){if(_0x55dcc4){return _0x55dcc4?{'count':_0x2bebaa,'rows':_0x55dcc4}:null;}})['then'](respondWithResult(_0x5e21a2,null))[_0x580d('0x3d')](handleError(_0x5e21a2,null));};exports[_0x580d('0x4a')]=function(_0x1977ea,_0x5d40dd,_0x27cc29){if(_0x1977ea[_0x580d('0x43')]['id']){delete _0x1977ea[_0x580d('0x43')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x1977ea['params']['id']}})[_0x580d('0x1f')](handleEntityNotFound(_0x5d40dd,null))[_0x580d('0x1f')](function(_0x58eae0){if(_0x58eae0){_0x1977ea[_0x580d('0x43')][_0x580d('0x4b')]=_0x58eae0['id'];_0x1977ea[_0x580d('0x43')][_0x580d('0x4c')]=integrations[_0x580d('0x4d')](_0x1977ea['body']['channel'],_0x1977ea['body'][_0x580d('0x28')]);_0x1977ea['body'][_0x580d('0x4e')]=integrations[_0x580d('0x4f')](_0x1977ea[_0x580d('0x43')][_0x580d('0x50')],_0x1977ea[_0x580d('0x43')][_0x580d('0x28')]);return db[_0x580d('0x48')][_0x580d('0x42')](_0x1977ea[_0x580d('0x43')],{'include':[{'model':db[_0x580d('0x51')],'as':_0x580d('0x4c')},{'model':db['VtigerField'],'as':_0x580d('0x4e')}]});}return null;})['then'](respondWithResult(_0x5d40dd,null))[_0x580d('0x3d')](handleError(_0x5d40dd,null));};var md5=require(_0x580d('0x52'));exports[_0x580d('0x53')]=function(_0x17df8c,_0x134578,_0xc5b37b){var _0x40ca32=null;var _0x25cced=null;var _0x86b0ff=null;var _0x1e796d=null;var _0x2b8e2d='';return db[_0x580d('0x26')][_0x580d('0x47')]({'where':{'id':_0x17df8c[_0x580d('0x44')]['id']},'attributes':['id','name',_0x580d('0x54'),_0x580d('0x55'),'moduleName','remoteUri','serverUrl',_0x580d('0x56')]})[_0x580d('0x1f')](handleEntityNotFound(_0x134578,null))[_0x580d('0x1f')](function(_0x52020c){if(_0x52020c){_0x40ca32=_0x52020c['username'];_0x25cced=_0x52020c[_0x580d('0x56')];_0x86b0ff=_0x52020c[_0x580d('0x57')];_0x2b8e2d=_0x52020c[_0x580d('0x58')];var _0xb2d294=_0x2b8e2d[_0x580d('0x59')](-0x1);if(_0xb2d294==='/'){_0x2b8e2d=_0x2b8e2d[_0x580d('0x5a')](0x0,_0x2b8e2d['lastIndexOf'](_0xb2d294));}_0x1e796d=util[_0x580d('0x5b')]('%s/webservice.php',_0x2b8e2d);var _0x371089={'method':_0x580d('0x5c'),'uri':_0x1e796d,'qs':{'operation':'getchallenge','username':_0x52020c['username']},'json':!![]};return rp(_0x371089);}})['then'](function(_0x57aeb6){if(_0x57aeb6[_0x580d('0x5d')]){var _0xd32a53={'method':_0x580d('0x5e'),'uri':_0x1e796d,'form':{'operation':'login','username':_0x40ca32,'accessKey':md5(_0x57aeb6[_0x580d('0x5f')][_0x580d('0x60')]+_0x25cced)},'json':!![]};return rp(_0xd32a53);}})[_0x580d('0x1f')](function(_0x310174){if(_0x310174[_0x580d('0x5d')]){var _0x4a034e={'method':_0x580d('0x5c'),'uri':_0x1e796d,'qs':{'operation':_0x580d('0x61'),'username':_0x40ca32,'sessionName':_0x310174[_0x580d('0x5f')][_0x580d('0x62')],'elementType':_0x86b0ff},'json':!![]};return rp(_0x4a034e);}})['then'](function(_0x326f46){if(_0x326f46[_0x580d('0x5d')]){var _0x2037ea=[_0x580d('0x63'),'reference','owner'];_['remove'](_0x326f46['result']['fields'],function(_0x457319){return _0x2037ea[_0x580d('0x64')](_0x457319[_0x580d('0x28')][_0x580d('0x22')]);});_['remove'](_0x326f46['result']['fields'],function(_0x12537b){return _0x12537b[_0x580d('0x65')]===_0x580d('0x66');});return{'count':_0x326f46[_0x580d('0x5f')][_0x580d('0x2e')][_0x580d('0x2f')],'rows':_[_0x580d('0x25')](_0x326f46[_0x580d('0x5f')][_0x580d('0x2e')],function(_0x4dfb5b){return{'id':_0x4dfb5b['name'],'name':_0x4dfb5b['label'],'custom':_[_0x580d('0x67')](_0x4dfb5b['name'],'cf_')?!![]:![],'options':_0x4dfb5b[_0x580d('0x28')][_0x580d('0x22')]==='picklist'&&_0x4dfb5b[_0x580d('0x28')][_0x580d('0x68')][_0x580d('0x2f')]>0x0?_[_0x580d('0x25')](_0x4dfb5b[_0x580d('0x28')][_0x580d('0x68')],function(_0x842619){return{'name':_0x842619[_0x580d('0x69')],'value':_0x842619[_0x580d('0x6a')]};}):[]};})};}})[_0x580d('0x1f')](respondWithResult(_0x134578,null))['catch'](function(_0x8b0503){console[_0x580d('0x6b')](_0x580d('0x6c')+_0x8b0503);var _0x32e5a6=_0x17df8c[_0x580d('0x2a')][_0x580d('0x6d')]?0x1f4:_0x8b0503[_0x580d('0x6e')]||0x1f4;logger[_0x580d('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x580d('0x53'),_0x32e5a6,JSON[_0x580d('0x6f')](_0x8b0503));delete _0x8b0503[_0x580d('0x22')];if(_0x32e5a6===0x191){_0x32e5a6=0x190;}_0x134578['status'](_0x32e5a6)[_0x580d('0x23')](_0x17df8c[_0x580d('0x2a')][_0x580d('0x6d')]?{'message':_0x580d('0x70'),'statusCode':_0x8b0503[_0x580d('0x6e')]}:_0x8b0503);});}; \ No newline at end of file +var _0x2ee9=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','VtigerAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','catch','create','body','params','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','username','success','POST','login','result','token','GET','describe','sessionName','owner','remove','editable','false','label','startsWith','picklist','picklistValues','log','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2ee9,0x1e4));var _0x92ee=function(_0x505a98,_0x351f8d){_0x505a98=_0x505a98-0x0;var _0x541994=_0x2ee9[_0x505a98];return _0x541994;};'use strict';var emlformat=require(_0x92ee('0x0'));var rimraf=require(_0x92ee('0x1'));var zipdir=require(_0x92ee('0x2'));var jsonpatch=require(_0x92ee('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92ee('0x4'));var Mustache=require(_0x92ee('0x5'));var util=require(_0x92ee('0x6'));var path=require(_0x92ee('0x7'));var sox=require('sox');var csv=require(_0x92ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92ee('0x9'));var _=require(_0x92ee('0xa'));var squel=require(_0x92ee('0xb'));var crypto=require(_0x92ee('0xc'));var jsforce=require(_0x92ee('0xd'));var deskjs=require(_0x92ee('0xe'));var toCsv=require(_0x92ee('0x8'));var querystring=require(_0x92ee('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x92ee('0x10'));var qs=require(_0x92ee('0x11'));var as=require(_0x92ee('0x12'));var hardwareService=require(_0x92ee('0x13'));var logger=require(_0x92ee('0x14'))(_0x92ee('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x92ee('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x92ee('0x17'));function respondWithStatusCode(_0x11a477,_0x2efc23){_0x2efc23=_0x2efc23||0xcc;return function(_0x41612d){if(_0x41612d){return _0x11a477[_0x92ee('0x18')](_0x2efc23);}return _0x11a477[_0x92ee('0x19')](_0x2efc23)[_0x92ee('0x1a')]();};}function respondWithResult(_0x5246a0,_0x33ab1b){_0x33ab1b=_0x33ab1b||0xc8;return function(_0x5c1c3e){if(_0x5c1c3e){return _0x5246a0[_0x92ee('0x19')](_0x33ab1b)[_0x92ee('0x1b')](_0x5c1c3e);}};}function respondWithFilteredResult(_0x514b4d,_0x2a856c){return function(_0x18deaf){if(_0x18deaf){var _0x4c6556=typeof _0x2a856c['offset']==='undefined'&&typeof _0x2a856c[_0x92ee('0x1c')]==='undefined';var _0x1d3b0e=_0x18deaf[_0x92ee('0x1d')];var _0x3b28a1=_0x4c6556?0x0:_0x2a856c[_0x92ee('0x1e')];var _0x33c633=_0x4c6556?_0x18deaf[_0x92ee('0x1d')]:_0x2a856c[_0x92ee('0x1e')]+_0x2a856c[_0x92ee('0x1c')];var _0x20b928;if(_0x33c633>=_0x1d3b0e){_0x33c633=_0x1d3b0e;_0x20b928=0xc8;}else{_0x20b928=0xce;}_0x514b4d[_0x92ee('0x19')](_0x20b928);return _0x514b4d['set'](_0x92ee('0x1f'),_0x3b28a1+'-'+_0x33c633+'/'+_0x1d3b0e)[_0x92ee('0x1b')](_0x18deaf);}return null;};}function patchUpdates(_0x478dd5){return function(_0x4f2c4f){try{jsonpatch[_0x92ee('0x20')](_0x4f2c4f,_0x478dd5,!![]);}catch(_0x3a7d84){return BPromise[_0x92ee('0x21')](_0x3a7d84);}return _0x4f2c4f[_0x92ee('0x22')]();};}function saveUpdates(_0x161397,_0xe79712){return function(_0x5e52e7){if(_0x5e52e7){return _0x5e52e7[_0x92ee('0x23')](_0x161397)['then'](function(_0x720673){return _0x720673;});}return null;};}function removeEntity(_0x486680,_0x1438a2){return function(_0x8959f9){if(_0x8959f9){return _0x8959f9[_0x92ee('0x24')]()[_0x92ee('0x25')](function(){_0x486680[_0x92ee('0x19')](0xcc)[_0x92ee('0x1a')]();});}};}function handleEntityNotFound(_0x31d0bd,_0x13e5c9){return function(_0x2dba4b){if(!_0x2dba4b){_0x31d0bd[_0x92ee('0x18')](0x194);}return _0x2dba4b;};}function handleError(_0x3a6621,_0x3c7ed6){_0x3c7ed6=_0x3c7ed6||0x1f4;return function(_0xb2434e){logger['error'](_0xb2434e[_0x92ee('0x26')]);if(_0xb2434e[_0x92ee('0x27')]){delete _0xb2434e['name'];}_0x3a6621[_0x92ee('0x19')](_0x3c7ed6)[_0x92ee('0x28')](_0xb2434e);};}exports[_0x92ee('0x29')]=function(_0x321e52,_0x4578a7){var _0x4e5a2e={},_0x3f1c54={},_0x2ba9ab={'count':0x0,'rows':[]};var _0x48bb16=_[_0x92ee('0x2a')](db[_0x92ee('0x2b')]['rawAttributes'],function(_0x28c156){return{'name':_0x28c156[_0x92ee('0x2c')],'type':_0x28c156['type'][_0x92ee('0x2d')]};});_0x3f1c54[_0x92ee('0x2e')]=_['map'](_0x48bb16,'name');_0x3f1c54[_0x92ee('0x2f')]=_[_0x92ee('0x30')](_0x321e52[_0x92ee('0x2f')]);_0x3f1c54[_0x92ee('0x31')]=_['intersection'](_0x3f1c54['model'],_0x3f1c54['query']);_0x4e5a2e[_0x92ee('0x32')]=_[_0x92ee('0x33')](_0x3f1c54[_0x92ee('0x2e')],qs[_0x92ee('0x34')](_0x321e52['query'][_0x92ee('0x34')]));_0x4e5a2e[_0x92ee('0x32')]=_0x4e5a2e[_0x92ee('0x32')][_0x92ee('0x35')]?_0x4e5a2e['attributes']:_0x3f1c54[_0x92ee('0x2e')];if(!_0x321e52['query']['hasOwnProperty']('nolimit')){_0x4e5a2e[_0x92ee('0x1c')]=qs[_0x92ee('0x1c')](_0x321e52[_0x92ee('0x2f')]['limit']);_0x4e5a2e['offset']=qs[_0x92ee('0x1e')](_0x321e52[_0x92ee('0x2f')][_0x92ee('0x1e')]);}_0x4e5a2e[_0x92ee('0x36')]=qs[_0x92ee('0x37')](_0x321e52[_0x92ee('0x2f')]['sort']);_0x4e5a2e['where']=qs[_0x92ee('0x31')](_[_0x92ee('0x38')](_0x321e52[_0x92ee('0x2f')],_0x3f1c54[_0x92ee('0x31')]),_0x48bb16);if(_0x321e52['query'][_0x92ee('0x39')]){_0x4e5a2e['where']=_[_0x92ee('0x3a')](_0x4e5a2e[_0x92ee('0x3b')],{'$or':_[_0x92ee('0x2a')](_0x48bb16,function(_0x402209){if(_0x402209[_0x92ee('0x3c')]!==_0x92ee('0x3d')){var _0x1e6c43={};_0x1e6c43[_0x402209[_0x92ee('0x27')]]={'$like':'%'+_0x321e52[_0x92ee('0x2f')][_0x92ee('0x39')]+'%'};return _0x1e6c43;}})});}_0x4e5a2e=_[_0x92ee('0x3a')]({},_0x4e5a2e,_0x321e52[_0x92ee('0x3e')]);var _0xa7a186={'where':_0x4e5a2e[_0x92ee('0x3b')]};return db[_0x92ee('0x2b')][_0x92ee('0x1d')](_0xa7a186)[_0x92ee('0x25')](function(_0xfb9c71){_0x2ba9ab[_0x92ee('0x1d')]=_0xfb9c71;if(_0x321e52[_0x92ee('0x2f')][_0x92ee('0x3f')]){_0x4e5a2e[_0x92ee('0x40')]=[{'all':!![]}];}return db[_0x92ee('0x2b')]['findAll'](_0x4e5a2e);})[_0x92ee('0x25')](function(_0x49863f){_0x2ba9ab[_0x92ee('0x41')]=_0x49863f;return _0x2ba9ab;})[_0x92ee('0x25')](respondWithFilteredResult(_0x4578a7,_0x4e5a2e))['catch'](handleError(_0x4578a7,null));};exports[_0x92ee('0x42')]=function(_0x504aea,_0x3b4f4c){var _0x5d92ac={'raw':![],'where':{'id':_0x504aea['params']['id']}},_0x3ba30c={};_0x3ba30c[_0x92ee('0x2e')]=_['keys'](db['VtigerAccount'][_0x92ee('0x43')]);_0x3ba30c[_0x92ee('0x2f')]=_[_0x92ee('0x30')](_0x504aea['query']);_0x3ba30c[_0x92ee('0x31')]=_[_0x92ee('0x33')](_0x3ba30c[_0x92ee('0x2e')],_0x3ba30c[_0x92ee('0x2f')]);_0x5d92ac[_0x92ee('0x32')]=_[_0x92ee('0x33')](_0x3ba30c[_0x92ee('0x2e')],qs[_0x92ee('0x34')](_0x504aea[_0x92ee('0x2f')][_0x92ee('0x34')]));_0x5d92ac[_0x92ee('0x32')]=_0x5d92ac['attributes']['length']?_0x5d92ac[_0x92ee('0x32')]:_0x3ba30c['model'];if(_0x504aea['query']['includeAll']){_0x5d92ac[_0x92ee('0x40')]=[{'all':!![]}];}_0x5d92ac=_['merge']({},_0x5d92ac,_0x504aea[_0x92ee('0x3e')]);return db['VtigerAccount'][_0x92ee('0x44')](_0x5d92ac)[_0x92ee('0x25')](handleEntityNotFound(_0x3b4f4c,null))[_0x92ee('0x25')](respondWithResult(_0x3b4f4c,null))[_0x92ee('0x45')](handleError(_0x3b4f4c,null));};exports[_0x92ee('0x46')]=function(_0xd85ada,_0x179fc4){return db[_0x92ee('0x2b')]['create'](_0xd85ada[_0x92ee('0x47')],{})['then'](respondWithResult(_0x179fc4,0xc9))['catch'](handleError(_0x179fc4,null));};exports[_0x92ee('0x23')]=function(_0x4f9ee7,_0x58185b){if(_0x4f9ee7[_0x92ee('0x47')]['id']){delete _0x4f9ee7['body']['id'];}return db[_0x92ee('0x2b')][_0x92ee('0x44')]({'where':{'id':_0x4f9ee7['params']['id']}})['then'](handleEntityNotFound(_0x58185b,null))[_0x92ee('0x25')](saveUpdates(_0x4f9ee7[_0x92ee('0x47')],null))[_0x92ee('0x25')](respondWithResult(_0x58185b,null))['catch'](handleError(_0x58185b,null));};exports['destroy']=function(_0x5bcea9,_0x30adfd){return db['VtigerAccount'][_0x92ee('0x44')]({'where':{'id':_0x5bcea9[_0x92ee('0x48')]['id']}})['then'](handleEntityNotFound(_0x30adfd,null))['then'](removeEntity(_0x30adfd,null))[_0x92ee('0x45')](handleError(_0x30adfd,null));};exports[_0x92ee('0x49')]=function(_0x2ffda9,_0xa24cc2,_0x2437fc){var _0x1c85ca={};var _0x5a1f5c={};var _0x5375e5;var _0x5a724e;return db['VtigerAccount'][_0x92ee('0x4a')]({'where':{'id':_0x2ffda9[_0x92ee('0x48')]['id']}})[_0x92ee('0x25')](handleEntityNotFound(_0xa24cc2,null))['then'](function(_0x4136d7){if(_0x4136d7){_0x5375e5=_0x4136d7;_0x5a1f5c[_0x92ee('0x2e')]=_[_0x92ee('0x30')](db[_0x92ee('0x4b')][_0x92ee('0x43')]);_0x5a1f5c['query']=_['keys'](_0x2ffda9[_0x92ee('0x2f')]);_0x5a1f5c[_0x92ee('0x31')]=_[_0x92ee('0x33')](_0x5a1f5c[_0x92ee('0x2e')],_0x5a1f5c[_0x92ee('0x2f')]);_0x1c85ca[_0x92ee('0x32')]=_[_0x92ee('0x33')](_0x5a1f5c[_0x92ee('0x2e')],qs[_0x92ee('0x34')](_0x2ffda9[_0x92ee('0x2f')][_0x92ee('0x34')]));_0x1c85ca['attributes']=_0x1c85ca[_0x92ee('0x32')]['length']?_0x1c85ca['attributes']:_0x5a1f5c[_0x92ee('0x2e')];_0x1c85ca[_0x92ee('0x36')]=qs['sort'](_0x2ffda9[_0x92ee('0x2f')][_0x92ee('0x37')]);_0x1c85ca[_0x92ee('0x3b')]=qs['filters'](_[_0x92ee('0x38')](_0x2ffda9[_0x92ee('0x2f')],_0x5a1f5c['filters']));if(_0x2ffda9[_0x92ee('0x2f')][_0x92ee('0x39')]){_0x1c85ca[_0x92ee('0x3b')]=_[_0x92ee('0x3a')](_0x1c85ca[_0x92ee('0x3b')],{'$or':_[_0x92ee('0x2a')](_0x1c85ca['attributes'],function(_0x331375){var _0x2e4a28={};_0x2e4a28[_0x331375]={'$like':'%'+_0x2ffda9[_0x92ee('0x2f')][_0x92ee('0x39')]+'%'};return _0x2e4a28;})});}_0x1c85ca=_[_0x92ee('0x3a')]({},_0x1c85ca,_0x2ffda9[_0x92ee('0x3e')]);return _0x5375e5[_0x92ee('0x49')](_0x1c85ca);}})['then'](function(_0x1fabb8){if(_0x1fabb8){_0x5a724e=_0x1fabb8[_0x92ee('0x35')];if(!_0x2ffda9['query'][_0x92ee('0x4c')](_0x92ee('0x4d'))){_0x1c85ca[_0x92ee('0x1c')]=qs[_0x92ee('0x1c')](_0x2ffda9[_0x92ee('0x2f')][_0x92ee('0x1c')]);_0x1c85ca[_0x92ee('0x1e')]=qs[_0x92ee('0x1e')](_0x2ffda9['query'][_0x92ee('0x1e')]);}return _0x5375e5['getConfigurations'](_0x1c85ca);}})[_0x92ee('0x25')](function(_0x1ac5b5){if(_0x1ac5b5){return _0x1ac5b5?{'count':_0x5a724e,'rows':_0x1ac5b5}:null;}})[_0x92ee('0x25')](respondWithResult(_0xa24cc2,null))[_0x92ee('0x45')](handleError(_0xa24cc2,null));};exports[_0x92ee('0x4e')]=function(_0x30f8c9,_0x18101a,_0x116796){if(_0x30f8c9[_0x92ee('0x47')]['id']){delete _0x30f8c9['body']['id'];}return db[_0x92ee('0x2b')][_0x92ee('0x4a')]({'where':{'id':_0x30f8c9[_0x92ee('0x48')]['id']}})[_0x92ee('0x25')](handleEntityNotFound(_0x18101a,null))[_0x92ee('0x25')](function(_0x1ede43){if(_0x1ede43){_0x30f8c9['body'][_0x92ee('0x4f')]=_0x1ede43['id'];_0x30f8c9['body'][_0x92ee('0x50')]=integrations[_0x92ee('0x51')](_0x30f8c9[_0x92ee('0x47')][_0x92ee('0x52')],_0x30f8c9[_0x92ee('0x47')]['type']);_0x30f8c9[_0x92ee('0x47')]['Descriptions']=integrations[_0x92ee('0x53')](_0x30f8c9['body']['channel'],_0x30f8c9['body'][_0x92ee('0x3c')]);return db[_0x92ee('0x4b')][_0x92ee('0x46')](_0x30f8c9['body'],{'include':[{'model':db[_0x92ee('0x54')],'as':_0x92ee('0x50')},{'model':db[_0x92ee('0x54')],'as':_0x92ee('0x55')}]});}return null;})['then'](respondWithResult(_0x18101a,null))['catch'](handleError(_0x18101a,null));};var md5=require(_0x92ee('0x56'));exports[_0x92ee('0x57')]=function(_0x2116b9,_0x2caf62,_0x31a264){var _0x3f9f1f=null;var _0x3f6acc=null;var _0x2c953c=null;var _0x59ec62=null;var _0xdd4c43='';return db[_0x92ee('0x2b')][_0x92ee('0x4a')]({'where':{'id':_0x2116b9[_0x92ee('0x48')]['id']},'attributes':['id',_0x92ee('0x27'),'username',_0x92ee('0x58'),_0x92ee('0x59'),_0x92ee('0x5a'),_0x92ee('0x5b'),_0x92ee('0x5c')]})['then'](handleEntityNotFound(_0x2caf62,null))[_0x92ee('0x25')](function(_0x23a362){if(_0x23a362){_0x3f9f1f=_0x23a362['username'];_0x3f6acc=_0x23a362[_0x92ee('0x5c')];_0x2c953c=_0x23a362[_0x92ee('0x59')];_0xdd4c43=_0x23a362[_0x92ee('0x5a')];var _0x2c575e=_0xdd4c43['slice'](-0x1);if(_0x2c575e==='/'){_0xdd4c43=_0xdd4c43[_0x92ee('0x5d')](0x0,_0xdd4c43[_0x92ee('0x5e')](_0x2c575e));}_0x59ec62=util[_0x92ee('0x5f')](_0x92ee('0x60'),_0xdd4c43);var _0x384ba6={'method':'GET','uri':_0x59ec62,'qs':{'operation':_0x92ee('0x61'),'username':_0x23a362[_0x92ee('0x62')]},'json':!![]};return rp(_0x384ba6);}})[_0x92ee('0x25')](function(_0x1c49f7){if(_0x1c49f7[_0x92ee('0x63')]){var _0x58bb73={'method':_0x92ee('0x64'),'uri':_0x59ec62,'form':{'operation':_0x92ee('0x65'),'username':_0x3f9f1f,'accessKey':md5(_0x1c49f7[_0x92ee('0x66')][_0x92ee('0x67')]+_0x3f6acc)},'json':!![]};return rp(_0x58bb73);}})[_0x92ee('0x25')](function(_0x27a48b){if(_0x27a48b['success']){var _0x1b728a={'method':_0x92ee('0x68'),'uri':_0x59ec62,'qs':{'operation':_0x92ee('0x69'),'username':_0x3f9f1f,'sessionName':_0x27a48b['result'][_0x92ee('0x6a')],'elementType':_0x2c953c},'json':!![]};return rp(_0x1b728a);}})[_0x92ee('0x25')](function(_0x2028a2){if(_0x2028a2[_0x92ee('0x63')]){var _0xd7a2ca=['autogenerated','reference',_0x92ee('0x6b')];_[_0x92ee('0x6c')](_0x2028a2[_0x92ee('0x66')]['fields'],function(_0x1be913){return _0xd7a2ca['includes'](_0x1be913['type'][_0x92ee('0x27')]);});_[_0x92ee('0x6c')](_0x2028a2[_0x92ee('0x66')][_0x92ee('0x34')],function(_0x21493c){return _0x21493c[_0x92ee('0x6d')]===_0x92ee('0x6e');});return{'count':_0x2028a2[_0x92ee('0x66')][_0x92ee('0x34')][_0x92ee('0x35')],'rows':_['map'](_0x2028a2[_0x92ee('0x66')]['fields'],function(_0xa2a86){return{'id':_0xa2a86[_0x92ee('0x27')],'name':_0xa2a86[_0x92ee('0x6f')],'custom':_[_0x92ee('0x70')](_0xa2a86[_0x92ee('0x27')],'cf_')?!![]:![],'options':_0xa2a86[_0x92ee('0x3c')][_0x92ee('0x27')]===_0x92ee('0x71')&&_0xa2a86['type']['picklistValues']['length']>0x0?_['map'](_0xa2a86[_0x92ee('0x3c')][_0x92ee('0x72')],function(_0x3f2277){return{'name':_0x3f2277[_0x92ee('0x6f')],'value':_0x3f2277['value']};}):[]};})};}})[_0x92ee('0x25')](respondWithResult(_0x2caf62,null))[_0x92ee('0x45')](function(_0x55f30c){console[_0x92ee('0x73')]('vTiger\x20error:\x20'+_0x55f30c);var _0x4664d6=_0x2116b9['query']['test']?0x1f4:_0x55f30c[_0x92ee('0x74')]||0x1f4;logger[_0x92ee('0x75')](_0x92ee('0x76'),'getFields',_0x4664d6,JSON[_0x92ee('0x77')](_0x55f30c));delete _0x55f30c['name'];if(_0x4664d6===0x191){_0x4664d6=0x190;}_0x2caf62[_0x92ee('0x19')](_0x4664d6)[_0x92ee('0x28')](_0x2116b9[_0x92ee('0x2f')][_0x92ee('0x78')]?{'message':_0x92ee('0x79'),'statusCode':_0x55f30c[_0x92ee('0x74')]}:_0x55f30c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 475f9c9..957ce6c 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 _0x59d9=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x24e42e,_0x253bcd){var _0x5d1e11=function(_0x17f624){while(--_0x17f624){_0x24e42e['push'](_0x24e42e['shift']());}};_0x5d1e11(++_0x253bcd);}(_0x59d9,0x1f0));var _0x959d=function(_0x4b7f6b,_0x5ecebe){_0x4b7f6b=_0x4b7f6b-0x0;var _0x4e516a=_0x59d9[_0x4b7f6b];return _0x4e516a;};'use strict';var _=require(_0x959d('0x0'));var util=require(_0x959d('0x1'));var logger=require(_0x959d('0x2'))(_0x959d('0x3'));var moment=require(_0x959d('0x4'));var BPromise=require('bluebird');var rp=require(_0x959d('0x5'));var fs=require('fs');var path=require(_0x959d('0x6'));var rimraf=require(_0x959d('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x959d('0x8')]=function(_0x234105,_0x216e80){return _0x234105[_0x959d('0x9')](_0x959d('0xa'),attributes,{'tableName':_0x959d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf86=['api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xcf86,0x165));var _0x6cf8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xcf86[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x6cf8('0x0'));var util=require(_0x6cf8('0x1'));var logger=require(_0x6cf8('0x2'))(_0x6cf8('0x3'));var moment=require(_0x6cf8('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cf8('0x5'));var fs=require('fs');var path=require(_0x6cf8('0x6'));var rimraf=require(_0x6cf8('0x7'));var config=require(_0x6cf8('0x8'));var attributes=require(_0x6cf8('0x9'));var integrations=require(_0x6cf8('0xa'));module[_0x6cf8('0xb')]=function(_0x989abd,_0x33c512){return _0x989abd[_0x6cf8('0xc')](_0x6cf8('0xd'),attributes,{'tableName':_0x6cf8('0xe'),'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 71eecfb..786f58c 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x4122e2,_0x105191){var _0x572cc0=function(_0x444c69){while(--_0x444c69){_0x4122e2['push'](_0x4122e2['shift']());}};_0x572cc0(++_0x105191);}(_0x0bb5,0x148));var _0x50bb=function(_0x57dbff,_0x275587){_0x57dbff=_0x57dbff-0x0;var _0x3a5af4=_0x0bb5[_0x57dbff];return _0x3a5af4;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['GetVtigerAccount']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['VtigerAccount']['findAll']({'raw':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24ba19[_0x50bb('0x16')]?_0x24ba19['options'][_0x50bb('0x18')]||null:null,'attributes':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')]['attributes']||null:null,'limit':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x19')]||null:null,'include':_0x24ba19['options']?_0x24ba19[_0x50bb('0x16')]['include']?_[_0x50bb('0x1a')](_0x24ba19[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x2ee87a){return{'model':db[_0x2ee87a[_0x50bb('0x1c')]],'as':_0x2ee87a['as'],'attributes':_0x2ee87a[_0x50bb('0x1d')],'include':_0x2ee87a['include']?_[_0x50bb('0x1a')](_0x2ee87a[_0x50bb('0x1b')],function(_0x284a76){return{'model':db[_0x284a76[_0x50bb('0x1c')]],'as':_0x284a76['as'],'attributes':_0x284a76['attributes'],'include':_0x284a76[_0x50bb('0x1b')]?_['map'](_0x284a76['include'],function(_0x2befd9){return{'model':db[_0x2befd9['model']],'as':_0x2befd9['as'],'attributes':_0x2befd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x12ee2c){logger[_0x50bb('0xb')](_0x50bb('0x1e'),_0x24ba19);logger[_0x50bb('0xd')](_0x50bb('0x1e'),_0x24ba19,JSON[_0x50bb('0x10')](_0x12ee2c));_0x301f61(_0x12ee2c);})[_0x50bb('0x15')](function(_0x4f7514){logger[_0x50bb('0x11')](_0x50bb('0x1e'),_0x4f7514[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4f7514['message']));});});};exports[_0x50bb('0x1f')]=function(_0x1a62fb){var _0xc38da5=this;return new Promise(function(_0xb3c3ba,_0x3fd5f6){return db[_0x50bb('0x20')][_0x50bb('0x21')]({'raw':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')]['where']||null:null,'attributes':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1d')]||null:null,'include':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x1cc4e2){return{'model':db[_0x1cc4e2[_0x50bb('0x1c')]],'as':_0x1cc4e2['as'],'attributes':_0x1cc4e2['attributes'],'include':_0x1cc4e2[_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1cc4e2[_0x50bb('0x1b')],function(_0x2bfb54){return{'model':db[_0x2bfb54[_0x50bb('0x1c')]],'as':_0x2bfb54['as'],'attributes':_0x2bfb54[_0x50bb('0x1d')],'include':_0x2bfb54['include']?_['map'](_0x2bfb54[_0x50bb('0x1b')],function(_0x5ed0b4){return{'model':db[_0x5ed0b4[_0x50bb('0x1c')]],'as':_0x5ed0b4['as'],'attributes':_0x5ed0b4[_0x50bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x171c6b){logger[_0x50bb('0xb')]('ShowVtigerAccount',_0x1a62fb);logger[_0x50bb('0xd')]('ShowVtigerAccount',_0x1a62fb,JSON[_0x50bb('0x10')](_0x171c6b));_0xb3c3ba(_0x171c6b);})[_0x50bb('0x15')](function(_0x280e5a){logger['error']('ShowVtigerAccount',_0x280e5a[_0x50bb('0x13')],_0x1a62fb);_0x3fd5f6(_0xc38da5[_0x50bb('0x11')](0x1f4,_0x280e5a[_0x50bb('0x13')]));});});}; \ No newline at end of file +var _0x282b=['map','model','ShowVtigerAccount','VtigerAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include'];(function(_0x255b2b,_0x2d0210){var _0x18fa2f=function(_0x134c82){while(--_0x134c82){_0x255b2b['push'](_0x255b2b['shift']());}};_0x18fa2f(++_0x2d0210);}(_0x282b,0xec));var _0xb282=function(_0x295dfc,_0x35886a){_0x295dfc=_0x295dfc-0x0;var _0x598182=_0x282b[_0x295dfc];return _0x598182;};'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});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['VtigerAccount'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0b3b885..1b90709 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 _0xfa2c=['get','index','/:id','/:id/fields','getFields','/:id/descriptions','isAuthenticated','getDescriptions','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x5ac1e5,_0xa037ab){var _0x1769cd=function(_0x2014ce){while(--_0x2014ce){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1769cd(++_0xa037ab);}(_0xfa2c,0x11e));var _0xcfa2=function(_0x5b477f,_0x255533){_0x5b477f=_0x5b477f-0x0;var _0x1fdc23=_0xfa2c[_0x5b477f];return _0x1fdc23;};'use strict';var multer=require(_0xcfa2('0x0'));var util=require(_0xcfa2('0x1'));var path=require('path');var timeout=require(_0xcfa2('0x2'));var express=require(_0xcfa2('0x3'));var router=express[_0xcfa2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcfa2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcfa2('0x6'));var controller=require(_0xcfa2('0x7'));router[_0xcfa2('0x8')]('/',auth['isAuthenticated'](),controller[_0xcfa2('0x9')]);router[_0xcfa2('0x8')](_0xcfa2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcfa2('0x8')](_0xcfa2('0xb'),auth['isAuthenticated'](),controller[_0xcfa2('0xc')]);router[_0xcfa2('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xcfa2('0xd'),auth[_0xcfa2('0xe')](),controller[_0xcfa2('0xf')]);router[_0xcfa2('0x10')]('/',auth[_0xcfa2('0xe')](),controller[_0xcfa2('0x11')]);router[_0xcfa2('0x12')](_0xcfa2('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcfa2('0xa'),auth['isAuthenticated'](),controller[_0xcfa2('0x13')]);module[_0xcfa2('0x14')]=router; \ No newline at end of file +var _0x21ab=['../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x57eebd,_0x561057){var _0x343a79=function(_0x5e2cb4){while(--_0x5e2cb4){_0x57eebd['push'](_0x57eebd['shift']());}};_0x343a79(++_0x561057);}(_0x21ab,0x8e));var _0xb21a=function(_0x16ae34,_0x1dc6d){_0x16ae34=_0x16ae34-0x0;var _0x184836=_0x21ab[_0x16ae34];return _0x184836;};'use strict';var multer=require(_0xb21a('0x0'));var util=require(_0xb21a('0x1'));var path=require(_0xb21a('0x2'));var timeout=require(_0xb21a('0x3'));var express=require(_0xb21a('0x4'));var router=express[_0xb21a('0x5')]();var fs_extra=require(_0xb21a('0x6'));var auth=require(_0xb21a('0x7'));var interaction=require(_0xb21a('0x8'));var config=require('../../config/environment');var controller=require(_0xb21a('0x9'));router[_0xb21a('0xa')]('/',auth[_0xb21a('0xb')](),controller['index']);router['get'](_0xb21a('0xc'),auth[_0xb21a('0xb')](),controller[_0xb21a('0xd')]);router[_0xb21a('0xa')](_0xb21a('0xe'),auth[_0xb21a('0xb')](),controller['getFields']);router[_0xb21a('0xa')](_0xb21a('0xf'),auth[_0xb21a('0xb')](),controller[_0xb21a('0x10')]);router['get'](_0xb21a('0x11'),auth[_0xb21a('0xb')](),controller[_0xb21a('0x12')]);router[_0xb21a('0x13')]('/',auth['isAuthenticated'](),controller[_0xb21a('0x14')]);router[_0xb21a('0x15')](_0xb21a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb21a('0x16')](_0xb21a('0xc'),auth['isAuthenticated'](),controller[_0xb21a('0x17')]);module[_0xb21a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 3023bfa..700b916 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 _0x51d0=['STRING','sequelize'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x51d0,0x12f));var _0x051d=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x51d0[_0x18cac4];return _0x2227c6;};'use strict';var Sequelize=require(_0x051d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x051d('0x1')]}}; \ No newline at end of file +var _0x40a4=['STRING','sequelize','exports'];(function(_0x30977b,_0x22be64){var _0x339a92=function(_0x2d7a68){while(--_0x2d7a68){_0x30977b['push'](_0x30977b['shift']());}};_0x339a92(++_0x22be64);}(_0x40a4,0x1ba));var _0x440a=function(_0x2ef783,_0x36aa54){_0x2ef783=_0x2ef783-0x0;var _0x2aa8f5=_0x40a4[_0x2ef783];return _0x2aa8f5;};'use strict';var Sequelize=require(_0x440a('0x0'));module[_0x440a('0x1')]={'name':{'type':Sequelize[_0x440a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 89e93f3..2be7bf2 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 _0x35a9=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','getFields','VtigerField','findOne','getSubjects','getDescriptions','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','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key'];(function(_0x2e261d,_0x29f447){var _0x247240=function(_0x1f7e9f){while(--_0x1f7e9f){_0x2e261d['push'](_0x2e261d['shift']());}};_0x247240(++_0x29f447);}(_0x35a9,0x73));var _0x935a=function(_0x57096d,_0x1a8245){_0x57096d=_0x57096d-0x0;var _0x2e10ef=_0x35a9[_0x57096d];return _0x2e10ef;};'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(){_0x13e62a['status'](0xcc)[_0x935a('0x19')]();});}};}function handleEntityNotFound(_0x46b6b8,_0x5a29df){return function(_0xa2c3f5){if(!_0xa2c3f5){_0x46b6b8[_0x935a('0x17')](0x194);}return _0xa2c3f5;};}function handleError(_0x34fb6f,_0x33f8c3){_0x33f8c3=_0x33f8c3||0x1f4;return function(_0x45ffc1){logger[_0x935a('0x26')](_0x45ffc1[_0x935a('0x27')]);if(_0x45ffc1[_0x935a('0x28')]){delete _0x45ffc1[_0x935a('0x28')];}_0x34fb6f[_0x935a('0x18')](_0x33f8c3)[_0x935a('0x29')](_0x45ffc1);};}exports[_0x935a('0x2a')]=function(_0x595b1c,_0x39c72c){var _0x43d93b={},_0x18a9dc={},_0x4f53af={'count':0x0,'rows':[]};var _0x261a8a=_[_0x935a('0x2b')](db[_0x935a('0x2c')][_0x935a('0x2d')],function(_0x48c9b5){return{'name':_0x48c9b5[_0x935a('0x2e')],'type':_0x48c9b5[_0x935a('0x2f')][_0x935a('0x30')]};});_0x18a9dc[_0x935a('0x31')]=_['map'](_0x261a8a,'name');_0x18a9dc[_0x935a('0x32')]=_[_0x935a('0x33')](_0x595b1c['query']);_0x18a9dc['filters']=_[_0x935a('0x34')](_0x18a9dc[_0x935a('0x31')],_0x18a9dc['query']);_0x43d93b[_0x935a('0x35')]=_['intersection'](_0x18a9dc[_0x935a('0x31')],qs['fields'](_0x595b1c[_0x935a('0x32')][_0x935a('0x36')]));_0x43d93b['attributes']=_0x43d93b['attributes'][_0x935a('0x37')]?_0x43d93b[_0x935a('0x35')]:_0x18a9dc[_0x935a('0x31')];if(!_0x595b1c[_0x935a('0x32')][_0x935a('0x38')](_0x935a('0x39'))){_0x43d93b[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x595b1c[_0x935a('0x32')][_0x935a('0x1e')]);_0x43d93b['offset']=qs['offset'](_0x595b1c['query'][_0x935a('0x1b')]);}_0x43d93b[_0x935a('0x3a')]=qs[_0x935a('0x3b')](_0x595b1c[_0x935a('0x32')][_0x935a('0x3b')]);_0x43d93b[_0x935a('0x3c')]=qs['filters'](_[_0x935a('0x3d')](_0x595b1c['query'],_0x18a9dc[_0x935a('0x3e')]),_0x261a8a);if(_0x595b1c[_0x935a('0x32')][_0x935a('0x3f')]){_0x43d93b[_0x935a('0x3c')]=_['merge'](_0x43d93b[_0x935a('0x3c')],{'$or':_[_0x935a('0x2b')](_0x261a8a,function(_0x319642){if(_0x319642[_0x935a('0x2f')]!==_0x935a('0x40')){var _0x4dc91c={};_0x4dc91c[_0x319642['name']]={'$like':'%'+_0x595b1c[_0x935a('0x32')][_0x935a('0x3f')]+'%'};return _0x4dc91c;}})});}_0x43d93b=_[_0x935a('0x41')]({},_0x43d93b,_0x595b1c[_0x935a('0x42')]);var _0x1a2ae6={'where':_0x43d93b[_0x935a('0x3c')]};return db[_0x935a('0x2c')][_0x935a('0x1d')](_0x1a2ae6)[_0x935a('0x24')](function(_0x20584f){_0x4f53af[_0x935a('0x1d')]=_0x20584f;if(_0x595b1c['query'][_0x935a('0x43')]){_0x43d93b['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x935a('0x44')](_0x43d93b);})['then'](function(_0x3f5653){_0x4f53af[_0x935a('0x45')]=_0x3f5653;return _0x4f53af;})[_0x935a('0x24')](respondWithFilteredResult(_0x39c72c,_0x43d93b))[_0x935a('0x46')](handleError(_0x39c72c,null));};exports[_0x935a('0x47')]=function(_0x43ea46,_0x329719){var _0x57f870={'raw':![],'where':{'id':_0x43ea46['params']['id']}},_0x2d734d={};_0x2d734d[_0x935a('0x31')]=_[_0x935a('0x33')](db[_0x935a('0x2c')][_0x935a('0x2d')]);_0x2d734d[_0x935a('0x32')]=_[_0x935a('0x33')](_0x43ea46['query']);_0x2d734d[_0x935a('0x3e')]=_['intersection'](_0x2d734d[_0x935a('0x31')],_0x2d734d['query']);_0x57f870[_0x935a('0x35')]=_[_0x935a('0x34')](_0x2d734d['model'],qs[_0x935a('0x36')](_0x43ea46[_0x935a('0x32')][_0x935a('0x36')]));_0x57f870[_0x935a('0x35')]=_0x57f870[_0x935a('0x35')][_0x935a('0x37')]?_0x57f870['attributes']:_0x2d734d['model'];if(_0x43ea46[_0x935a('0x32')]['includeAll']){_0x57f870[_0x935a('0x48')]=[{'all':!![]}];}_0x57f870=_[_0x935a('0x41')]({},_0x57f870,_0x43ea46[_0x935a('0x42')]);return db[_0x935a('0x2c')][_0x935a('0x49')](_0x57f870)[_0x935a('0x24')](handleEntityNotFound(_0x329719,null))[_0x935a('0x24')](respondWithResult(_0x329719,null))[_0x935a('0x46')](handleError(_0x329719,null));};exports['create']=function(_0x27aa52,_0x21e2c3){return db[_0x935a('0x2c')][_0x935a('0x4a')](_0x27aa52[_0x935a('0x4b')],{})[_0x935a('0x24')](respondWithResult(_0x21e2c3,0xc9))[_0x935a('0x46')](handleError(_0x21e2c3,null));};exports[_0x935a('0x23')]=function(_0x479124,_0x23e85f){if(_0x479124['body']['id']){delete _0x479124['body']['id'];}return db['VtigerConfiguration'][_0x935a('0x49')]({'where':{'id':_0x479124[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x23e85f,null))[_0x935a('0x24')](saveUpdates(_0x479124['body'],null))[_0x935a('0x24')](respondWithResult(_0x23e85f,null))['catch'](handleError(_0x23e85f,null));};exports['destroy']=function(_0x41c5dc,_0x17d5ef){return db[_0x935a('0x2c')][_0x935a('0x49')]({'where':{'id':_0x41c5dc[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x17d5ef,null))[_0x935a('0x24')](removeEntity(_0x17d5ef,null))['catch'](handleError(_0x17d5ef,null));};exports[_0x935a('0x4d')]=function(_0x209cd8,_0x5bde42,_0x114e54){var _0x5c777b={};var _0x57118f={};var _0x5151e6;var _0x33eb76;return db[_0x935a('0x2c')]['findOne']({'where':{'id':_0x209cd8[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x5bde42,null))[_0x935a('0x24')](function(_0x2108cf){if(_0x2108cf){_0x5151e6=_0x2108cf;_0x57118f[_0x935a('0x31')]=_[_0x935a('0x33')](db[_0x935a('0x4e')][_0x935a('0x2d')]);_0x57118f[_0x935a('0x32')]=_[_0x935a('0x33')](_0x209cd8[_0x935a('0x32')]);_0x57118f['filters']=_[_0x935a('0x34')](_0x57118f[_0x935a('0x31')],_0x57118f[_0x935a('0x32')]);_0x5c777b[_0x935a('0x35')]=_[_0x935a('0x34')](_0x57118f['model'],qs['fields'](_0x209cd8[_0x935a('0x32')]['fields']));_0x5c777b[_0x935a('0x35')]=_0x5c777b[_0x935a('0x35')]['length']?_0x5c777b[_0x935a('0x35')]:_0x57118f[_0x935a('0x31')];_0x5c777b[_0x935a('0x3a')]=qs[_0x935a('0x3b')](_0x209cd8[_0x935a('0x32')][_0x935a('0x3b')]);_0x5c777b['where']=qs['filters'](_[_0x935a('0x3d')](_0x209cd8['query'],_0x57118f[_0x935a('0x3e')]));if(_0x209cd8[_0x935a('0x32')][_0x935a('0x3f')]){_0x5c777b['where']=_['merge'](_0x5c777b[_0x935a('0x3c')],{'$or':_[_0x935a('0x2b')](_0x5c777b[_0x935a('0x35')],function(_0x438107){var _0x14d018={};_0x14d018[_0x438107]={'$like':'%'+_0x209cd8[_0x935a('0x32')][_0x935a('0x3f')]+'%'};return _0x14d018;})});}_0x5c777b=_['merge']({},_0x5c777b,_0x209cd8[_0x935a('0x42')]);return _0x5151e6[_0x935a('0x4d')](_0x5c777b);}})[_0x935a('0x24')](function(_0x434942){if(_0x434942){_0x33eb76=_0x434942[_0x935a('0x37')];if(!_0x209cd8[_0x935a('0x32')][_0x935a('0x38')](_0x935a('0x39'))){_0x5c777b[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x209cd8[_0x935a('0x32')][_0x935a('0x1e')]);_0x5c777b[_0x935a('0x1b')]=qs[_0x935a('0x1b')](_0x209cd8[_0x935a('0x32')]['offset']);}return _0x5151e6[_0x935a('0x4d')](_0x5c777b);}})[_0x935a('0x24')](function(_0x5983f9){if(_0x5983f9){return _0x5983f9?{'count':_0x33eb76,'rows':_0x5983f9}:null;}})[_0x935a('0x24')](respondWithResult(_0x5bde42,null))[_0x935a('0x46')](handleError(_0x5bde42,null));};exports['getSubjects']=function(_0x180bc4,_0x20d4c7,_0x38a5d5){var _0x1ecf4f={};var _0x177334={};var _0x1e384e;var _0x359878;return db[_0x935a('0x2c')][_0x935a('0x4f')]({'where':{'id':_0x180bc4[_0x935a('0x4c')]['id']}})[_0x935a('0x24')](handleEntityNotFound(_0x20d4c7,null))['then'](function(_0x5f5077){if(_0x5f5077){_0x1e384e=_0x5f5077;_0x177334[_0x935a('0x31')]=_[_0x935a('0x33')](db[_0x935a('0x4e')][_0x935a('0x2d')]);_0x177334[_0x935a('0x32')]=_['keys'](_0x180bc4[_0x935a('0x32')]);_0x177334[_0x935a('0x3e')]=_['intersection'](_0x177334[_0x935a('0x31')],_0x177334['query']);_0x1ecf4f[_0x935a('0x35')]=_['intersection'](_0x177334[_0x935a('0x31')],qs[_0x935a('0x36')](_0x180bc4['query'][_0x935a('0x36')]));_0x1ecf4f[_0x935a('0x35')]=_0x1ecf4f[_0x935a('0x35')][_0x935a('0x37')]?_0x1ecf4f[_0x935a('0x35')]:_0x177334[_0x935a('0x31')];_0x1ecf4f[_0x935a('0x3a')]=qs[_0x935a('0x3b')](_0x180bc4['query'][_0x935a('0x3b')]);_0x1ecf4f['where']=qs[_0x935a('0x3e')](_[_0x935a('0x3d')](_0x180bc4[_0x935a('0x32')],_0x177334[_0x935a('0x3e')]));if(_0x180bc4[_0x935a('0x32')][_0x935a('0x3f')]){_0x1ecf4f[_0x935a('0x3c')]=_[_0x935a('0x41')](_0x1ecf4f[_0x935a('0x3c')],{'$or':_[_0x935a('0x2b')](_0x1ecf4f[_0x935a('0x35')],function(_0x1ab2e2){var _0x221cfe={};_0x221cfe[_0x1ab2e2]={'$like':'%'+_0x180bc4['query'][_0x935a('0x3f')]+'%'};return _0x221cfe;})});}_0x1ecf4f=_[_0x935a('0x41')]({},_0x1ecf4f,_0x180bc4[_0x935a('0x42')]);return _0x1e384e[_0x935a('0x50')](_0x1ecf4f);}})[_0x935a('0x24')](function(_0x5f28b2){if(_0x5f28b2){_0x359878=_0x5f28b2[_0x935a('0x37')];if(!_0x180bc4[_0x935a('0x32')][_0x935a('0x38')]('nolimit')){_0x1ecf4f[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x180bc4[_0x935a('0x32')][_0x935a('0x1e')]);_0x1ecf4f['offset']=qs[_0x935a('0x1b')](_0x180bc4[_0x935a('0x32')][_0x935a('0x1b')]);}return _0x1e384e[_0x935a('0x50')](_0x1ecf4f);}})[_0x935a('0x24')](function(_0x368173){if(_0x368173){return _0x368173?{'count':_0x359878,'rows':_0x368173}:null;}})[_0x935a('0x24')](respondWithResult(_0x20d4c7,null))[_0x935a('0x46')](handleError(_0x20d4c7,null));};exports['getDescriptions']=function(_0x53bc43,_0x3e2712,_0x1b172e){var _0x2d87b1={};var _0xa7dece={};var _0x3f82ee;var _0x484035;return db[_0x935a('0x2c')][_0x935a('0x4f')]({'where':{'id':_0x53bc43[_0x935a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3e2712,null))['then'](function(_0x3f8800){if(_0x3f8800){_0x3f82ee=_0x3f8800;_0xa7dece[_0x935a('0x31')]=_[_0x935a('0x33')](db[_0x935a('0x4e')]['rawAttributes']);_0xa7dece[_0x935a('0x32')]=_[_0x935a('0x33')](_0x53bc43[_0x935a('0x32')]);_0xa7dece['filters']=_[_0x935a('0x34')](_0xa7dece[_0x935a('0x31')],_0xa7dece[_0x935a('0x32')]);_0x2d87b1[_0x935a('0x35')]=_[_0x935a('0x34')](_0xa7dece[_0x935a('0x31')],qs[_0x935a('0x36')](_0x53bc43[_0x935a('0x32')][_0x935a('0x36')]));_0x2d87b1['attributes']=_0x2d87b1[_0x935a('0x35')][_0x935a('0x37')]?_0x2d87b1[_0x935a('0x35')]:_0xa7dece['model'];_0x2d87b1[_0x935a('0x3a')]=qs[_0x935a('0x3b')](_0x53bc43['query']['sort']);_0x2d87b1[_0x935a('0x3c')]=qs[_0x935a('0x3e')](_[_0x935a('0x3d')](_0x53bc43[_0x935a('0x32')],_0xa7dece[_0x935a('0x3e')]));if(_0x53bc43[_0x935a('0x32')]['filter']){_0x2d87b1[_0x935a('0x3c')]=_['merge'](_0x2d87b1[_0x935a('0x3c')],{'$or':_['map'](_0x2d87b1[_0x935a('0x35')],function(_0x4d4c0a){var _0x55826f={};_0x55826f[_0x4d4c0a]={'$like':'%'+_0x53bc43[_0x935a('0x32')][_0x935a('0x3f')]+'%'};return _0x55826f;})});}_0x2d87b1=_[_0x935a('0x41')]({},_0x2d87b1,_0x53bc43[_0x935a('0x42')]);return _0x3f82ee['getDescriptions'](_0x2d87b1);}})[_0x935a('0x24')](function(_0x44cc08){if(_0x44cc08){_0x484035=_0x44cc08[_0x935a('0x37')];if(!_0x53bc43[_0x935a('0x32')][_0x935a('0x38')](_0x935a('0x39'))){_0x2d87b1[_0x935a('0x1e')]=qs[_0x935a('0x1e')](_0x53bc43[_0x935a('0x32')]['limit']);_0x2d87b1[_0x935a('0x1b')]=qs[_0x935a('0x1b')](_0x53bc43[_0x935a('0x32')][_0x935a('0x1b')]);}return _0x3f82ee[_0x935a('0x51')](_0x2d87b1);}})[_0x935a('0x24')](function(_0x1bd053){if(_0x1bd053){return _0x1bd053?{'count':_0x484035,'rows':_0x1bd053}:null;}})[_0x935a('0x24')](respondWithResult(_0x3e2712,null))[_0x935a('0x46')](handleError(_0x3e2712,null));}; \ No newline at end of file +var _0xac55=['sendStatus','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','status','error','stack','name','send','index','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','getFields','VtigerField','map','nolimit','getSubjects','findOne','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0xac55,0x1c8));var _0x5ac5=function(_0x3f442a,_0x3198db){_0x3f442a=_0x3f442a-0x0;var _0x4a8aac=_0xac55[_0x3f442a];return _0x4a8aac;};'use strict';var emlformat=require(_0x5ac5('0x0'));var rimraf=require(_0x5ac5('0x1'));var zipdir=require(_0x5ac5('0x2'));var jsonpatch=require(_0x5ac5('0x3'));var rp=require('request-promise');var moment=require(_0x5ac5('0x4'));var BPromise=require(_0x5ac5('0x5'));var Mustache=require(_0x5ac5('0x6'));var util=require(_0x5ac5('0x7'));var path=require(_0x5ac5('0x8'));var sox=require(_0x5ac5('0x9'));var csv=require(_0x5ac5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ac5('0xb'));var squel=require(_0x5ac5('0xc'));var crypto=require(_0x5ac5('0xd'));var jsforce=require(_0x5ac5('0xe'));var deskjs=require(_0x5ac5('0xf'));var toCsv=require(_0x5ac5('0xa'));var querystring=require(_0x5ac5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ac5('0x11'));var qs=require(_0x5ac5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ac5('0x13'));var logger=require(_0x5ac5('0x14'))('api');var utils=require(_0x5ac5('0x15'));var config=require(_0x5ac5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ac5('0x17'))['db'];function respondWithStatusCode(_0x1d2b5f,_0x7c4f62){_0x7c4f62=_0x7c4f62||0xcc;return function(_0x13fad8){if(_0x13fad8){return _0x1d2b5f[_0x5ac5('0x18')](_0x7c4f62);}return _0x1d2b5f['status'](_0x7c4f62)[_0x5ac5('0x19')]();};}function respondWithResult(_0x56db18,_0x1ce256){_0x1ce256=_0x1ce256||0xc8;return function(_0x40ee8a){if(_0x40ee8a){return _0x56db18['status'](_0x1ce256)[_0x5ac5('0x1a')](_0x40ee8a);}};}function respondWithFilteredResult(_0x57377b,_0x2a145d){return function(_0x340195){if(_0x340195){var _0x30244d=typeof _0x2a145d[_0x5ac5('0x1b')]===_0x5ac5('0x1c')&&typeof _0x2a145d[_0x5ac5('0x1d')]===_0x5ac5('0x1c');var _0x5510ef=_0x340195[_0x5ac5('0x1e')];var _0x5364a6=_0x30244d?0x0:_0x2a145d[_0x5ac5('0x1b')];var _0x14d164=_0x30244d?_0x340195['count']:_0x2a145d[_0x5ac5('0x1b')]+_0x2a145d['limit'];var _0x264422;if(_0x14d164>=_0x5510ef){_0x14d164=_0x5510ef;_0x264422=0xc8;}else{_0x264422=0xce;}_0x57377b['status'](_0x264422);return _0x57377b['set'](_0x5ac5('0x1f'),_0x5364a6+'-'+_0x14d164+'/'+_0x5510ef)['json'](_0x340195);}return null;};}function patchUpdates(_0x39f3cf){return function(_0x3cb669){try{jsonpatch['apply'](_0x3cb669,_0x39f3cf,!![]);}catch(_0x4066f5){return BPromise['reject'](_0x4066f5);}return _0x3cb669[_0x5ac5('0x20')]();};}function saveUpdates(_0x40bdbc,_0x47993e){return function(_0x47a898){if(_0x47a898){return _0x47a898[_0x5ac5('0x21')](_0x40bdbc)[_0x5ac5('0x22')](function(_0x400308){return _0x400308;});}return null;};}function removeEntity(_0x182683,_0xee1c62){return function(_0x4dec2f){if(_0x4dec2f){return _0x4dec2f[_0x5ac5('0x23')]()[_0x5ac5('0x22')](function(){_0x182683[_0x5ac5('0x24')](0xcc)[_0x5ac5('0x19')]();});}};}function handleEntityNotFound(_0x4b81e2,_0x22398f){return function(_0x4eda97){if(!_0x4eda97){_0x4b81e2[_0x5ac5('0x18')](0x194);}return _0x4eda97;};}function handleError(_0x74f32b,_0x1d78cf){_0x1d78cf=_0x1d78cf||0x1f4;return function(_0x2cb82f){logger[_0x5ac5('0x25')](_0x2cb82f[_0x5ac5('0x26')]);if(_0x2cb82f['name']){delete _0x2cb82f[_0x5ac5('0x27')];}_0x74f32b['status'](_0x1d78cf)[_0x5ac5('0x28')](_0x2cb82f);};}exports[_0x5ac5('0x29')]=function(_0x35535f,_0x509db7){var _0x283c41={},_0x229941={},_0x21df31={'count':0x0,'rows':[]};var _0x21307c=_['map'](db[_0x5ac5('0x2a')]['rawAttributes'],function(_0x3414ba){return{'name':_0x3414ba[_0x5ac5('0x2b')],'type':_0x3414ba[_0x5ac5('0x2c')][_0x5ac5('0x2d')]};});_0x229941[_0x5ac5('0x2e')]=_['map'](_0x21307c,_0x5ac5('0x27'));_0x229941[_0x5ac5('0x2f')]=_[_0x5ac5('0x30')](_0x35535f['query']);_0x229941[_0x5ac5('0x31')]=_['intersection'](_0x229941[_0x5ac5('0x2e')],_0x229941[_0x5ac5('0x2f')]);_0x283c41[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x229941[_0x5ac5('0x2e')],qs['fields'](_0x35535f[_0x5ac5('0x2f')]['fields']));_0x283c41[_0x5ac5('0x32')]=_0x283c41['attributes'][_0x5ac5('0x34')]?_0x283c41[_0x5ac5('0x32')]:_0x229941['model'];if(!_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x35')]('nolimit')){_0x283c41['limit']=qs[_0x5ac5('0x1d')](_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x1d')]);_0x283c41[_0x5ac5('0x1b')]=qs[_0x5ac5('0x1b')](_0x35535f[_0x5ac5('0x2f')]['offset']);}_0x283c41['order']=qs['sort'](_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x36')]);_0x283c41['where']=qs[_0x5ac5('0x31')](_[_0x5ac5('0x37')](_0x35535f[_0x5ac5('0x2f')],_0x229941[_0x5ac5('0x31')]),_0x21307c);if(_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x38')]){_0x283c41[_0x5ac5('0x39')]=_[_0x5ac5('0x3a')](_0x283c41[_0x5ac5('0x39')],{'$or':_['map'](_0x21307c,function(_0x1b991e){if(_0x1b991e['type']!==_0x5ac5('0x3b')){var _0x432740={};_0x432740[_0x1b991e[_0x5ac5('0x27')]]={'$like':'%'+_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x38')]+'%'};return _0x432740;}})});}_0x283c41=_[_0x5ac5('0x3a')]({},_0x283c41,_0x35535f[_0x5ac5('0x3c')]);var _0x37cfad={'where':_0x283c41[_0x5ac5('0x39')]};return db['VtigerConfiguration'][_0x5ac5('0x1e')](_0x37cfad)[_0x5ac5('0x22')](function(_0x4c245b){_0x21df31['count']=_0x4c245b;if(_0x35535f[_0x5ac5('0x2f')]['includeAll']){_0x283c41[_0x5ac5('0x3d')]=[{'all':!![]}];}return db[_0x5ac5('0x2a')]['findAll'](_0x283c41);})['then'](function(_0x1e261d){_0x21df31[_0x5ac5('0x3e')]=_0x1e261d;return _0x21df31;})[_0x5ac5('0x22')](respondWithFilteredResult(_0x509db7,_0x283c41))[_0x5ac5('0x3f')](handleError(_0x509db7,null));};exports[_0x5ac5('0x40')]=function(_0x34bd04,_0x151c5e){var _0x5a86a0={'raw':![],'where':{'id':_0x34bd04[_0x5ac5('0x41')]['id']}},_0x1d4ef5={};_0x1d4ef5[_0x5ac5('0x2e')]=_[_0x5ac5('0x30')](db[_0x5ac5('0x2a')][_0x5ac5('0x42')]);_0x1d4ef5['query']=_[_0x5ac5('0x30')](_0x34bd04[_0x5ac5('0x2f')]);_0x1d4ef5[_0x5ac5('0x31')]=_[_0x5ac5('0x33')](_0x1d4ef5['model'],_0x1d4ef5[_0x5ac5('0x2f')]);_0x5a86a0[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x1d4ef5['model'],qs['fields'](_0x34bd04[_0x5ac5('0x2f')][_0x5ac5('0x43')]));_0x5a86a0[_0x5ac5('0x32')]=_0x5a86a0[_0x5ac5('0x32')]['length']?_0x5a86a0[_0x5ac5('0x32')]:_0x1d4ef5['model'];if(_0x34bd04[_0x5ac5('0x2f')][_0x5ac5('0x44')]){_0x5a86a0['include']=[{'all':!![]}];}_0x5a86a0=_[_0x5ac5('0x3a')]({},_0x5a86a0,_0x34bd04['options']);return db[_0x5ac5('0x2a')][_0x5ac5('0x45')](_0x5a86a0)[_0x5ac5('0x22')](handleEntityNotFound(_0x151c5e,null))['then'](respondWithResult(_0x151c5e,null))['catch'](handleError(_0x151c5e,null));};exports[_0x5ac5('0x46')]=function(_0x1229c3,_0xd6ae55){return db[_0x5ac5('0x2a')][_0x5ac5('0x46')](_0x1229c3[_0x5ac5('0x47')],{})[_0x5ac5('0x22')](respondWithResult(_0xd6ae55,0xc9))[_0x5ac5('0x3f')](handleError(_0xd6ae55,null));};exports[_0x5ac5('0x21')]=function(_0x536765,_0x2d6aa5){if(_0x536765[_0x5ac5('0x47')]['id']){delete _0x536765[_0x5ac5('0x47')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x536765[_0x5ac5('0x41')]['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x2d6aa5,null))[_0x5ac5('0x22')](saveUpdates(_0x536765['body'],null))[_0x5ac5('0x22')](respondWithResult(_0x2d6aa5,null))[_0x5ac5('0x3f')](handleError(_0x2d6aa5,null));};exports[_0x5ac5('0x23')]=function(_0x2a3396,_0x326f60){return db[_0x5ac5('0x2a')][_0x5ac5('0x45')]({'where':{'id':_0x2a3396['params']['id']}})['then'](handleEntityNotFound(_0x326f60,null))['then'](removeEntity(_0x326f60,null))[_0x5ac5('0x3f')](handleError(_0x326f60,null));};exports[_0x5ac5('0x48')]=function(_0xc76fbd,_0x503623,_0x1973f6){var _0x31345e={};var _0x270825={};var _0x286304;var _0x137ec3;return db['VtigerConfiguration']['findOne']({'where':{'id':_0xc76fbd['params']['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x503623,null))[_0x5ac5('0x22')](function(_0x307827){if(_0x307827){_0x286304=_0x307827;_0x270825[_0x5ac5('0x2e')]=_[_0x5ac5('0x30')](db[_0x5ac5('0x49')][_0x5ac5('0x42')]);_0x270825[_0x5ac5('0x2f')]=_[_0x5ac5('0x30')](_0xc76fbd[_0x5ac5('0x2f')]);_0x270825[_0x5ac5('0x31')]=_[_0x5ac5('0x33')](_0x270825[_0x5ac5('0x2e')],_0x270825[_0x5ac5('0x2f')]);_0x31345e[_0x5ac5('0x32')]=_['intersection'](_0x270825[_0x5ac5('0x2e')],qs[_0x5ac5('0x43')](_0xc76fbd['query'][_0x5ac5('0x43')]));_0x31345e[_0x5ac5('0x32')]=_0x31345e[_0x5ac5('0x32')][_0x5ac5('0x34')]?_0x31345e[_0x5ac5('0x32')]:_0x270825[_0x5ac5('0x2e')];_0x31345e['order']=qs[_0x5ac5('0x36')](_0xc76fbd[_0x5ac5('0x2f')][_0x5ac5('0x36')]);_0x31345e['where']=qs[_0x5ac5('0x31')](_[_0x5ac5('0x37')](_0xc76fbd['query'],_0x270825[_0x5ac5('0x31')]));if(_0xc76fbd[_0x5ac5('0x2f')]['filter']){_0x31345e['where']=_['merge'](_0x31345e[_0x5ac5('0x39')],{'$or':_[_0x5ac5('0x4a')](_0x31345e[_0x5ac5('0x32')],function(_0x6df231){var _0x465621={};_0x465621[_0x6df231]={'$like':'%'+_0xc76fbd[_0x5ac5('0x2f')]['filter']+'%'};return _0x465621;})});}_0x31345e=_[_0x5ac5('0x3a')]({},_0x31345e,_0xc76fbd[_0x5ac5('0x3c')]);return _0x286304[_0x5ac5('0x48')](_0x31345e);}})[_0x5ac5('0x22')](function(_0x1f9b9b){if(_0x1f9b9b){_0x137ec3=_0x1f9b9b['length'];if(!_0xc76fbd['query']['hasOwnProperty'](_0x5ac5('0x4b'))){_0x31345e[_0x5ac5('0x1d')]=qs[_0x5ac5('0x1d')](_0xc76fbd[_0x5ac5('0x2f')]['limit']);_0x31345e[_0x5ac5('0x1b')]=qs[_0x5ac5('0x1b')](_0xc76fbd[_0x5ac5('0x2f')]['offset']);}return _0x286304['getFields'](_0x31345e);}})['then'](function(_0x2190e2){if(_0x2190e2){return _0x2190e2?{'count':_0x137ec3,'rows':_0x2190e2}:null;}})[_0x5ac5('0x22')](respondWithResult(_0x503623,null))[_0x5ac5('0x3f')](handleError(_0x503623,null));};exports[_0x5ac5('0x4c')]=function(_0x387cab,_0x3b7e70,_0x53a641){var _0x8ce51b={};var _0x5532d6={};var _0x492179;var _0x3eda7f;return db[_0x5ac5('0x2a')][_0x5ac5('0x4d')]({'where':{'id':_0x387cab[_0x5ac5('0x41')]['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x3b7e70,null))[_0x5ac5('0x22')](function(_0xb02e95){if(_0xb02e95){_0x492179=_0xb02e95;_0x5532d6[_0x5ac5('0x2e')]=_[_0x5ac5('0x30')](db[_0x5ac5('0x49')][_0x5ac5('0x42')]);_0x5532d6[_0x5ac5('0x2f')]=_[_0x5ac5('0x30')](_0x387cab[_0x5ac5('0x2f')]);_0x5532d6[_0x5ac5('0x31')]=_[_0x5ac5('0x33')](_0x5532d6[_0x5ac5('0x2e')],_0x5532d6[_0x5ac5('0x2f')]);_0x8ce51b[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x5532d6[_0x5ac5('0x2e')],qs['fields'](_0x387cab[_0x5ac5('0x2f')]['fields']));_0x8ce51b[_0x5ac5('0x32')]=_0x8ce51b['attributes'][_0x5ac5('0x34')]?_0x8ce51b['attributes']:_0x5532d6['model'];_0x8ce51b[_0x5ac5('0x4e')]=qs['sort'](_0x387cab[_0x5ac5('0x2f')][_0x5ac5('0x36')]);_0x8ce51b['where']=qs[_0x5ac5('0x31')](_[_0x5ac5('0x37')](_0x387cab[_0x5ac5('0x2f')],_0x5532d6[_0x5ac5('0x31')]));if(_0x387cab[_0x5ac5('0x2f')][_0x5ac5('0x38')]){_0x8ce51b['where']=_[_0x5ac5('0x3a')](_0x8ce51b['where'],{'$or':_[_0x5ac5('0x4a')](_0x8ce51b[_0x5ac5('0x32')],function(_0xb7aa89){var _0x4dd4a4={};_0x4dd4a4[_0xb7aa89]={'$like':'%'+_0x387cab[_0x5ac5('0x2f')][_0x5ac5('0x38')]+'%'};return _0x4dd4a4;})});}_0x8ce51b=_[_0x5ac5('0x3a')]({},_0x8ce51b,_0x387cab['options']);return _0x492179[_0x5ac5('0x4c')](_0x8ce51b);}})[_0x5ac5('0x22')](function(_0x36b2c8){if(_0x36b2c8){_0x3eda7f=_0x36b2c8[_0x5ac5('0x34')];if(!_0x387cab[_0x5ac5('0x2f')]['hasOwnProperty']('nolimit')){_0x8ce51b[_0x5ac5('0x1d')]=qs[_0x5ac5('0x1d')](_0x387cab[_0x5ac5('0x2f')][_0x5ac5('0x1d')]);_0x8ce51b[_0x5ac5('0x1b')]=qs[_0x5ac5('0x1b')](_0x387cab['query'][_0x5ac5('0x1b')]);}return _0x492179[_0x5ac5('0x4c')](_0x8ce51b);}})[_0x5ac5('0x22')](function(_0x38b1a4){if(_0x38b1a4){return _0x38b1a4?{'count':_0x3eda7f,'rows':_0x38b1a4}:null;}})[_0x5ac5('0x22')](respondWithResult(_0x3b7e70,null))[_0x5ac5('0x3f')](handleError(_0x3b7e70,null));};exports[_0x5ac5('0x4f')]=function(_0x4189c5,_0x422f43,_0x2aae0c){var _0x579499={};var _0x38e4fc={};var _0x173656;var _0x48cad2;return db['VtigerConfiguration'][_0x5ac5('0x4d')]({'where':{'id':_0x4189c5[_0x5ac5('0x41')]['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x422f43,null))[_0x5ac5('0x22')](function(_0x33143d){if(_0x33143d){_0x173656=_0x33143d;_0x38e4fc[_0x5ac5('0x2e')]=_[_0x5ac5('0x30')](db['VtigerField'][_0x5ac5('0x42')]);_0x38e4fc['query']=_[_0x5ac5('0x30')](_0x4189c5[_0x5ac5('0x2f')]);_0x38e4fc[_0x5ac5('0x31')]=_[_0x5ac5('0x33')](_0x38e4fc['model'],_0x38e4fc[_0x5ac5('0x2f')]);_0x579499['attributes']=_[_0x5ac5('0x33')](_0x38e4fc[_0x5ac5('0x2e')],qs[_0x5ac5('0x43')](_0x4189c5['query'][_0x5ac5('0x43')]));_0x579499['attributes']=_0x579499[_0x5ac5('0x32')][_0x5ac5('0x34')]?_0x579499[_0x5ac5('0x32')]:_0x38e4fc[_0x5ac5('0x2e')];_0x579499['order']=qs['sort'](_0x4189c5[_0x5ac5('0x2f')]['sort']);_0x579499['where']=qs[_0x5ac5('0x31')](_[_0x5ac5('0x37')](_0x4189c5[_0x5ac5('0x2f')],_0x38e4fc[_0x5ac5('0x31')]));if(_0x4189c5['query'][_0x5ac5('0x38')]){_0x579499[_0x5ac5('0x39')]=_[_0x5ac5('0x3a')](_0x579499['where'],{'$or':_[_0x5ac5('0x4a')](_0x579499[_0x5ac5('0x32')],function(_0x516c32){var _0x164709={};_0x164709[_0x516c32]={'$like':'%'+_0x4189c5['query'][_0x5ac5('0x38')]+'%'};return _0x164709;})});}_0x579499=_[_0x5ac5('0x3a')]({},_0x579499,_0x4189c5[_0x5ac5('0x3c')]);return _0x173656[_0x5ac5('0x4f')](_0x579499);}})['then'](function(_0x375fd3){if(_0x375fd3){_0x48cad2=_0x375fd3['length'];if(!_0x4189c5[_0x5ac5('0x2f')][_0x5ac5('0x35')](_0x5ac5('0x4b'))){_0x579499['limit']=qs[_0x5ac5('0x1d')](_0x4189c5[_0x5ac5('0x2f')][_0x5ac5('0x1d')]);_0x579499[_0x5ac5('0x1b')]=qs[_0x5ac5('0x1b')](_0x4189c5[_0x5ac5('0x2f')]['offset']);}return _0x173656[_0x5ac5('0x4f')](_0x579499);}})[_0x5ac5('0x22')](function(_0x4ada39){if(_0x4ada39){return _0x4ada39?{'count':_0x48cad2,'rows':_0x4ada39}:null;}})[_0x5ac5('0x22')](respondWithResult(_0x422f43,null))[_0x5ac5('0x3f')](handleError(_0x422f43,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d700516..01646ce 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 _0x4419=['bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','util','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4419,0x155));var _0x9441=function(_0x97c7a4,_0x3a49e9){_0x97c7a4=_0x97c7a4-0x0;var _0x1a2a83=_0x4419[_0x97c7a4];return _0x1a2a83;};'use strict';var _=require('lodash');var util=require(_0x9441('0x0'));var logger=require('../../config/logger')(_0x9441('0x1'));var moment=require(_0x9441('0x2'));var BPromise=require(_0x9441('0x3'));var rp=require(_0x9441('0x4'));var fs=require('fs');var path=require(_0x9441('0x5'));var rimraf=require(_0x9441('0x6'));var config=require('../../config/environment');var attributes=require(_0x9441('0x7'));module['exports']=function(_0x5c638b,_0x464173){return _0x5c638b['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eca=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x1eca,0xc7));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa1ec('0x0'));var util=require(_0xa1ec('0x1'));var logger=require(_0xa1ec('0x2'))(_0xa1ec('0x3'));var moment=require(_0xa1ec('0x4'));var BPromise=require(_0xa1ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa1ec('0x6'));var config=require(_0xa1ec('0x7'));var attributes=require(_0xa1ec('0x8'));module[_0xa1ec('0x9')]=function(_0x39fded,_0x1ae8d9){return _0x39fded['define']('VtigerConfiguration',attributes,{'tableName':_0xa1ec('0xa'),'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 10dbf95..f866398 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 _0xdbb0=['rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x94eb16,_0x47a7ba){var _0x19db9b=function(_0x1b1c76){while(--_0x1b1c76){_0x94eb16['push'](_0x94eb16['shift']());}};_0x19db9b(++_0x47a7ba);}(_0xdbb0,0x1ba));var _0x0dbb=function(_0x55540e,_0x49bbe6){_0x55540e=_0x55540e-0x0;var _0x14be13=_0xdbb0[_0x55540e];return _0x14be13;};'use strict';var _=require(_0x0dbb('0x0'));var util=require(_0x0dbb('0x1'));var moment=require(_0x0dbb('0x2'));var BPromise=require(_0x0dbb('0x3'));var rs=require(_0x0dbb('0x4'));var fs=require('fs');var Redis=require(_0x0dbb('0x5'));var db=require(_0x0dbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0dbb('0x7'))(_0x0dbb('0x8'));var config=require(_0x0dbb('0x9'));var jayson=require(_0x0dbb('0xa'));var client=jayson[_0x0dbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x384337,_0x8a6f8b,_0x35f047){return new BPromise(function(_0x3b171d,_0x12aa91){return client[_0x0dbb('0xc')](_0x384337,_0x35f047)[_0x0dbb('0xd')](function(_0x3f68d6){logger[_0x0dbb('0xe')](_0x0dbb('0xf'),_0x8a6f8b,_0x0dbb('0x10'));logger[_0x0dbb('0x11')](_0x0dbb('0x12'),_0x8a6f8b,'request\x20sent',JSON[_0x0dbb('0x13')](_0x3f68d6));if(_0x3f68d6[_0x0dbb('0x14')]){if(_0x3f68d6[_0x0dbb('0x14')][_0x0dbb('0x15')]===0x1f4){logger[_0x0dbb('0x14')](_0x0dbb('0xf'),_0x8a6f8b,_0x3f68d6[_0x0dbb('0x14')][_0x0dbb('0x16')]);return _0x12aa91(_0x3f68d6[_0x0dbb('0x14')]['message']);}logger[_0x0dbb('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x8a6f8b,_0x3f68d6['error']['message']);return _0x3b171d(_0x3f68d6[_0x0dbb('0x14')][_0x0dbb('0x16')]);}else{logger[_0x0dbb('0xe')](_0x0dbb('0xf'),_0x8a6f8b,_0x0dbb('0x10'));_0x3b171d(_0x3f68d6[_0x0dbb('0x17')][_0x0dbb('0x16')]);}})[_0x0dbb('0x18')](function(_0x5aecfa){logger[_0x0dbb('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x8a6f8b,_0x5aecfa);_0x12aa91(_0x5aecfa);});});} \ No newline at end of file +var _0x06f3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3d17aa,_0xd68082){var _0x4154bc=function(_0x402001){while(--_0x402001){_0x3d17aa['push'](_0x3d17aa['shift']());}};_0x4154bc(++_0xd68082);}(_0x06f3,0x160));var _0x306f=function(_0x55a777,_0x2c95f7){_0x55a777=_0x55a777-0x0;var _0x8ca6a1=_0x06f3[_0x55a777];return _0x8ca6a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x306f('0x0'));var BPromise=require(_0x306f('0x1'));var rs=require(_0x306f('0x2'));var fs=require('fs');var Redis=require(_0x306f('0x3'));var db=require(_0x306f('0x4'))['db'];var utils=require(_0x306f('0x5'));var logger=require(_0x306f('0x6'))('rpc');var config=require(_0x306f('0x7'));var jayson=require(_0x306f('0x8'));var client=jayson[_0x306f('0x9')][_0x306f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15bef9,_0x21114a,_0x4d0726){return new BPromise(function(_0x3216a6,_0x2e73c1){return client['request'](_0x15bef9,_0x4d0726)[_0x306f('0xb')](function(_0x4781a7){logger[_0x306f('0xc')](_0x306f('0xd'),_0x21114a,_0x306f('0xe'));logger[_0x306f('0xf')](_0x306f('0x10'),_0x21114a,_0x306f('0xe'),JSON[_0x306f('0x11')](_0x4781a7));if(_0x4781a7[_0x306f('0x12')]){if(_0x4781a7[_0x306f('0x12')]['code']===0x1f4){logger[_0x306f('0x12')](_0x306f('0xd'),_0x21114a,_0x4781a7['error'][_0x306f('0x13')]);return _0x2e73c1(_0x4781a7[_0x306f('0x12')][_0x306f('0x13')]);}logger[_0x306f('0x12')](_0x306f('0xd'),_0x21114a,_0x4781a7[_0x306f('0x12')][_0x306f('0x13')]);return _0x3216a6(_0x4781a7[_0x306f('0x12')][_0x306f('0x13')]);}else{logger['info'](_0x306f('0xd'),_0x21114a,_0x306f('0xe'));_0x3216a6(_0x4781a7[_0x306f('0x14')][_0x306f('0x13')]);}})[_0x306f('0x15')](function(_0x59fdbf){logger['error'](_0x306f('0xd'),_0x21114a,_0x59fdbf);_0x2e73c1(_0x59fdbf);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 15fea32..b5b49cc 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 _0xa22f=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xa22f,0x13e));var _0xfa22=function(_0x3bf96a,_0x5880c7){_0x3bf96a=_0x3bf96a-0x0;var _0x14379f=_0xa22f[_0x3bf96a];return _0x14379f;};'use strict';var multer=require(_0xfa22('0x0'));var util=require(_0xfa22('0x1'));var path=require(_0xfa22('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa22('0x3'));var router=express[_0xfa22('0x4')]();var fs_extra=require(_0xfa22('0x5'));var auth=require(_0xfa22('0x6'));var interaction=require(_0xfa22('0x7'));var config=require('../../config/environment');var controller=require(_0xfa22('0x8'));router[_0xfa22('0x9')]('/',auth[_0xfa22('0xa')](),controller[_0xfa22('0xb')]);router[_0xfa22('0x9')]('/:id',auth[_0xfa22('0xa')](),controller[_0xfa22('0xc')]);router[_0xfa22('0xd')]('/',auth[_0xfa22('0xa')](),controller[_0xfa22('0xe')]);router[_0xfa22('0xf')](_0xfa22('0x10'),auth[_0xfa22('0xa')](),controller[_0xfa22('0x11')]);router[_0xfa22('0x12')](_0xfa22('0x10'),auth[_0xfa22('0xa')](),controller[_0xfa22('0x13')]);module[_0xfa22('0x14')]=router; \ No newline at end of file +var _0xc113=['./intVtigerField.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xc113,0x14a));var _0x3c11=function(_0x59aeec,_0x35b0ed){_0x59aeec=_0x59aeec-0x0;var _0xb99a5a=_0xc113[_0x59aeec];return _0xb99a5a;};'use strict';var multer=require(_0x3c11('0x0'));var util=require('util');var path=require(_0x3c11('0x1'));var timeout=require(_0x3c11('0x2'));var express=require('express');var router=express[_0x3c11('0x3')]();var fs_extra=require(_0x3c11('0x4'));var auth=require(_0x3c11('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c11('0x6'));router[_0x3c11('0x7')]('/',auth[_0x3c11('0x8')](),controller['index']);router[_0x3c11('0x7')](_0x3c11('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3c11('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3c11('0xb')](_0x3c11('0x9'),auth[_0x3c11('0x8')](),controller[_0x3c11('0xc')]);router[_0x3c11('0xd')](_0x3c11('0x9'),auth['isAuthenticated'](),controller[_0x3c11('0xe')]);module[_0x3c11('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4453bc7..45bee7d 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 _0x7f6c=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x31ed12,_0x2a38f9){var _0x1afd40=function(_0x23a8ca){while(--_0x23a8ca){_0x31ed12['push'](_0x31ed12['shift']());}};_0x1afd40(++_0x2a38f9);}(_0x7f6c,0x19c));var _0xc7f6=function(_0x3e68f7,_0x42750a){_0x3e68f7=_0x3e68f7-0x0;var _0xbbaa3c=_0x7f6c[_0x3e68f7];return _0xbbaa3c;};'use strict';var Sequelize=require(_0xc7f6('0x0'));module[_0xc7f6('0x1')]={'type':{'type':Sequelize[_0xc7f6('0x2')](_0xc7f6('0x3'),'variable',_0xc7f6('0x4'),_0xc7f6('0x5'),'picklist'),'defaultValue':_0xc7f6('0x3')},'content':{'type':Sequelize[_0xc7f6('0x6')]},'key':{'type':Sequelize[_0xc7f6('0x6')]},'keyType':{'type':Sequelize[_0xc7f6('0x2')](_0xc7f6('0x3'),'variable',_0xc7f6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc7f6('0x6')]},'nameField':{'type':Sequelize[_0xc7f6('0x6')]},'customField':{'type':Sequelize[_0xc7f6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc7f6('0x6')]}}; \ No newline at end of file +var _0xbb03=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x56da70,_0x445385){var _0x475ac7=function(_0x3b50d0){while(--_0x3b50d0){_0x56da70['push'](_0x56da70['shift']());}};_0x475ac7(++_0x445385);}(_0xbb03,0x8b));var _0x3bb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3bb0('0x0'));module[_0x3bb0('0x1')]={'type':{'type':Sequelize[_0x3bb0('0x2')](_0x3bb0('0x3'),_0x3bb0('0x4'),_0x3bb0('0x5'),_0x3bb0('0x6'),_0x3bb0('0x7')),'defaultValue':_0x3bb0('0x3')},'content':{'type':Sequelize[_0x3bb0('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3bb0('0x2')](_0x3bb0('0x3'),_0x3bb0('0x4'),_0x3bb0('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3bb0('0x8')]},'nameField':{'type':Sequelize[_0x3bb0('0x8')]},'customField':{'type':Sequelize[_0x3bb0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3bb0('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 079ac5b..d677608 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 _0x040e=['nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','rimraf','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','sendStatus','stack','name','send','index','VtigerField','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x040e,0x130));var _0xe040=function(_0x365e53,_0x1f449c){_0x365e53=_0x365e53-0x0;var _0x30b4be=_0x040e[_0x365e53];return _0x30b4be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe040('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe040('0x1'));var moment=require(_0xe040('0x2'));var BPromise=require(_0xe040('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe040('0x4'));var sox=require('sox');var csv=require(_0xe040('0x5'));var ejs=require(_0xe040('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe040('0x7'));var squel=require(_0xe040('0x8'));var crypto=require(_0xe040('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe040('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe040('0xb'));var Redis=require(_0xe040('0xc'));var authService=require(_0xe040('0xd'));var qs=require(_0xe040('0xe'));var as=require(_0xe040('0xf'));var hardwareService=require(_0xe040('0x10'));var logger=require(_0xe040('0x11'))(_0xe040('0x12'));var utils=require(_0xe040('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14507e,_0x4c8ee4){_0x4c8ee4=_0x4c8ee4||0xcc;return function(_0x40b20c){if(_0x40b20c){return _0x14507e['sendStatus'](_0x4c8ee4);}return _0x14507e[_0xe040('0x14')](_0x4c8ee4)[_0xe040('0x15')]();};}function respondWithResult(_0x1ebb7e,_0x18284c){_0x18284c=_0x18284c||0xc8;return function(_0x5064ab){if(_0x5064ab){return _0x1ebb7e[_0xe040('0x14')](_0x18284c)[_0xe040('0x16')](_0x5064ab);}};}function respondWithFilteredResult(_0x3e41c1,_0x2e444b){return function(_0x2ea1ba){if(_0x2ea1ba){var _0x23915c=typeof _0x2e444b[_0xe040('0x17')]==='undefined'&&typeof _0x2e444b['limit']===_0xe040('0x18');var _0x3f1552=_0x2ea1ba['count'];var _0x14e827=_0x23915c?0x0:_0x2e444b[_0xe040('0x17')];var _0x3c7853=_0x23915c?_0x2ea1ba[_0xe040('0x19')]:_0x2e444b[_0xe040('0x17')]+_0x2e444b['limit'];var _0x4a5524;if(_0x3c7853>=_0x3f1552){_0x3c7853=_0x3f1552;_0x4a5524=0xc8;}else{_0x4a5524=0xce;}_0x3e41c1[_0xe040('0x14')](_0x4a5524);return _0x3e41c1[_0xe040('0x1a')]('Content-Range',_0x14e827+'-'+_0x3c7853+'/'+_0x3f1552)['json'](_0x2ea1ba);}return null;};}function patchUpdates(_0x3bdb5a){return function(_0x3904d0){try{jsonpatch[_0xe040('0x1b')](_0x3904d0,_0x3bdb5a,!![]);}catch(_0x768f06){return BPromise[_0xe040('0x1c')](_0x768f06);}return _0x3904d0[_0xe040('0x1d')]();};}function saveUpdates(_0x175275,_0x595742){return function(_0x4216d4){if(_0x4216d4){return _0x4216d4[_0xe040('0x1e')](_0x175275)[_0xe040('0x1f')](function(_0x178428){return _0x178428;});}return null;};}function removeEntity(_0x5197bb,_0x565f68){return function(_0x5cf192){if(_0x5cf192){return _0x5cf192['destroy']()[_0xe040('0x1f')](function(){_0x5197bb[_0xe040('0x14')](0xcc)[_0xe040('0x15')]();});}};}function handleEntityNotFound(_0x301152,_0x3d0a8a){return function(_0x47313e){if(!_0x47313e){_0x301152[_0xe040('0x20')](0x194);}return _0x47313e;};}function handleError(_0x5189a9,_0x221342){_0x221342=_0x221342||0x1f4;return function(_0x5656a6){logger['error'](_0x5656a6[_0xe040('0x21')]);if(_0x5656a6[_0xe040('0x22')]){delete _0x5656a6[_0xe040('0x22')];}_0x5189a9['status'](_0x221342)[_0xe040('0x23')](_0x5656a6);};}exports[_0xe040('0x24')]=function(_0xafb640,_0x34b2a2){var _0x196d23={},_0x70c07d={},_0x1f3c17={'count':0x0,'rows':[]};var _0x4398cf=_['map'](db[_0xe040('0x25')][_0xe040('0x26')],function(_0x465c18){return{'name':_0x465c18[_0xe040('0x27')],'type':_0x465c18['type'][_0xe040('0x28')]};});_0x70c07d['model']=_[_0xe040('0x29')](_0x4398cf,_0xe040('0x22'));_0x70c07d[_0xe040('0x2a')]=_[_0xe040('0x2b')](_0xafb640['query']);_0x70c07d[_0xe040('0x2c')]=_[_0xe040('0x2d')](_0x70c07d['model'],_0x70c07d[_0xe040('0x2a')]);_0x196d23[_0xe040('0x2e')]=_[_0xe040('0x2d')](_0x70c07d[_0xe040('0x2f')],qs[_0xe040('0x30')](_0xafb640[_0xe040('0x2a')][_0xe040('0x30')]));_0x196d23['attributes']=_0x196d23[_0xe040('0x2e')][_0xe040('0x31')]?_0x196d23[_0xe040('0x2e')]:_0x70c07d['model'];if(!_0xafb640[_0xe040('0x2a')][_0xe040('0x32')](_0xe040('0x33'))){_0x196d23[_0xe040('0x34')]=qs[_0xe040('0x34')](_0xafb640[_0xe040('0x2a')][_0xe040('0x34')]);_0x196d23[_0xe040('0x17')]=qs['offset'](_0xafb640[_0xe040('0x2a')][_0xe040('0x17')]);}_0x196d23[_0xe040('0x35')]=qs['sort'](_0xafb640['query']['sort']);_0x196d23[_0xe040('0x36')]=qs[_0xe040('0x2c')](_[_0xe040('0x37')](_0xafb640[_0xe040('0x2a')],_0x70c07d[_0xe040('0x2c')]),_0x4398cf);if(_0xafb640[_0xe040('0x2a')][_0xe040('0x38')]){_0x196d23[_0xe040('0x36')]=_[_0xe040('0x39')](_0x196d23[_0xe040('0x36')],{'$or':_[_0xe040('0x29')](_0x4398cf,function(_0x767a89){if(_0x767a89[_0xe040('0x3a')]!==_0xe040('0x3b')){var _0x2d2eb7={};_0x2d2eb7[_0x767a89['name']]={'$like':'%'+_0xafb640[_0xe040('0x2a')][_0xe040('0x38')]+'%'};return _0x2d2eb7;}})});}_0x196d23=_[_0xe040('0x39')]({},_0x196d23,_0xafb640[_0xe040('0x3c')]);var _0x202ab4={'where':_0x196d23[_0xe040('0x36')]};return db[_0xe040('0x25')][_0xe040('0x19')](_0x202ab4)[_0xe040('0x1f')](function(_0x18fb7c){_0x1f3c17[_0xe040('0x19')]=_0x18fb7c;if(_0xafb640[_0xe040('0x2a')][_0xe040('0x3d')]){_0x196d23[_0xe040('0x3e')]=[{'all':!![]}];}return db[_0xe040('0x25')][_0xe040('0x3f')](_0x196d23);})[_0xe040('0x1f')](function(_0x531fc7){_0x1f3c17[_0xe040('0x40')]=_0x531fc7;return _0x1f3c17;})[_0xe040('0x1f')](respondWithFilteredResult(_0x34b2a2,_0x196d23))[_0xe040('0x41')](handleError(_0x34b2a2,null));};exports['show']=function(_0x182d8d,_0xc02932){var _0x4deff5={'raw':!![],'where':{'id':_0x182d8d[_0xe040('0x42')]['id']}},_0x2f1389={};_0x2f1389[_0xe040('0x2f')]=_[_0xe040('0x2b')](db['VtigerField'][_0xe040('0x26')]);_0x2f1389['query']=_[_0xe040('0x2b')](_0x182d8d[_0xe040('0x2a')]);_0x2f1389[_0xe040('0x2c')]=_['intersection'](_0x2f1389[_0xe040('0x2f')],_0x2f1389['query']);_0x4deff5['attributes']=_[_0xe040('0x2d')](_0x2f1389[_0xe040('0x2f')],qs[_0xe040('0x30')](_0x182d8d[_0xe040('0x2a')][_0xe040('0x30')]));_0x4deff5[_0xe040('0x2e')]=_0x4deff5[_0xe040('0x2e')][_0xe040('0x31')]?_0x4deff5[_0xe040('0x2e')]:_0x2f1389[_0xe040('0x2f')];if(_0x182d8d[_0xe040('0x2a')][_0xe040('0x3d')]){_0x4deff5[_0xe040('0x3e')]=[{'all':!![]}];}_0x4deff5=_[_0xe040('0x39')]({},_0x4deff5,_0x182d8d[_0xe040('0x3c')]);return db[_0xe040('0x25')][_0xe040('0x43')](_0x4deff5)['then'](handleEntityNotFound(_0xc02932,null))[_0xe040('0x1f')](respondWithResult(_0xc02932,null))[_0xe040('0x41')](handleError(_0xc02932,null));};exports[_0xe040('0x44')]=function(_0x10c992,_0x2a1c9f){return db[_0xe040('0x25')][_0xe040('0x44')](_0x10c992[_0xe040('0x45')],{})[_0xe040('0x1f')](respondWithResult(_0x2a1c9f,0xc9))[_0xe040('0x41')](handleError(_0x2a1c9f,null));};exports[_0xe040('0x1e')]=function(_0x51ea9b,_0x486761){if(_0x51ea9b[_0xe040('0x45')]['id']){delete _0x51ea9b[_0xe040('0x45')]['id'];}return db[_0xe040('0x25')][_0xe040('0x43')]({'where':{'id':_0x51ea9b[_0xe040('0x42')]['id']}})[_0xe040('0x1f')](handleEntityNotFound(_0x486761,null))[_0xe040('0x1f')](saveUpdates(_0x51ea9b[_0xe040('0x45')],null))[_0xe040('0x1f')](respondWithResult(_0x486761,null))[_0xe040('0x41')](handleError(_0x486761,null));};exports[_0xe040('0x46')]=function(_0x1f0124,_0xe2a76a){return db['VtigerField'][_0xe040('0x43')]({'where':{'id':_0x1f0124[_0xe040('0x42')]['id']}})['then'](handleEntityNotFound(_0xe2a76a,null))['then'](removeEntity(_0xe2a76a,null))[_0xe040('0x41')](handleError(_0xe2a76a,null));}; \ No newline at end of file +var _0x9664=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x18a772,_0x1a4d3f){var _0xbaac04=function(_0x467aa6){while(--_0x467aa6){_0x18a772['push'](_0x18a772['shift']());}};_0xbaac04(++_0x1a4d3f);}(_0x9664,0xc3));var _0x4966=function(_0x20d09d,_0x1d1757){_0x20d09d=_0x20d09d-0x0;var _0x466749=_0x9664[_0x20d09d];return _0x466749;};'use strict';var emlformat=require(_0x4966('0x0'));var rimraf=require(_0x4966('0x1'));var zipdir=require(_0x4966('0x2'));var jsonpatch=require(_0x4966('0x3'));var rp=require(_0x4966('0x4'));var moment=require(_0x4966('0x5'));var BPromise=require(_0x4966('0x6'));var Mustache=require(_0x4966('0x7'));var util=require(_0x4966('0x8'));var path=require(_0x4966('0x9'));var sox=require('sox');var csv=require(_0x4966('0xa'));var ejs=require(_0x4966('0xb'));var fs=require('fs');var fs_extra=require(_0x4966('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4966('0xd'));var deskjs=require(_0x4966('0xe'));var toCsv=require(_0x4966('0xa'));var querystring=require(_0x4966('0xf'));var Papa=require(_0x4966('0x10'));var Redis=require(_0x4966('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4966('0x12'));var as=require(_0x4966('0x13'));var hardwareService=require(_0x4966('0x14'));var logger=require(_0x4966('0x15'))(_0x4966('0x16'));var utils=require(_0x4966('0x17'));var config=require(_0x4966('0x18'));var licenseUtil=require(_0x4966('0x19'));var db=require(_0x4966('0x1a'))['db'];function respondWithStatusCode(_0x31c5fd,_0x2ca7e8){_0x2ca7e8=_0x2ca7e8||0xcc;return function(_0x2b736c){if(_0x2b736c){return _0x31c5fd[_0x4966('0x1b')](_0x2ca7e8);}return _0x31c5fd[_0x4966('0x1c')](_0x2ca7e8)[_0x4966('0x1d')]();};}function respondWithResult(_0x339a6d,_0x59bc0f){_0x59bc0f=_0x59bc0f||0xc8;return function(_0x5e6550){if(_0x5e6550){return _0x339a6d[_0x4966('0x1c')](_0x59bc0f)['json'](_0x5e6550);}};}function respondWithFilteredResult(_0x49f461,_0xb9a408){return function(_0xb428a0){if(_0xb428a0){var _0x29face=typeof _0xb9a408[_0x4966('0x1e')]==='undefined'&&typeof _0xb9a408[_0x4966('0x1f')]===_0x4966('0x20');var _0x37e9c9=_0xb428a0[_0x4966('0x21')];var _0x6a41d9=_0x29face?0x0:_0xb9a408[_0x4966('0x1e')];var _0x2f359b=_0x29face?_0xb428a0[_0x4966('0x21')]:_0xb9a408[_0x4966('0x1e')]+_0xb9a408[_0x4966('0x1f')];var _0x3859b8;if(_0x2f359b>=_0x37e9c9){_0x2f359b=_0x37e9c9;_0x3859b8=0xc8;}else{_0x3859b8=0xce;}_0x49f461[_0x4966('0x1c')](_0x3859b8);return _0x49f461[_0x4966('0x22')]('Content-Range',_0x6a41d9+'-'+_0x2f359b+'/'+_0x37e9c9)['json'](_0xb428a0);}return null;};}function patchUpdates(_0xb7424){return function(_0x3aba23){try{jsonpatch[_0x4966('0x23')](_0x3aba23,_0xb7424,!![]);}catch(_0x545328){return BPromise[_0x4966('0x24')](_0x545328);}return _0x3aba23[_0x4966('0x25')]();};}function saveUpdates(_0x68131,_0x4f11e3){return function(_0x1a78f4){if(_0x1a78f4){return _0x1a78f4['update'](_0x68131)[_0x4966('0x26')](function(_0x31e061){return _0x31e061;});}return null;};}function removeEntity(_0x2bf1eb,_0x5291f4){return function(_0x2b6254){if(_0x2b6254){return _0x2b6254[_0x4966('0x27')]()[_0x4966('0x26')](function(){_0x2bf1eb[_0x4966('0x1c')](0xcc)[_0x4966('0x1d')]();});}};}function handleEntityNotFound(_0x129d94,_0x2aec30){return function(_0x1cdf94){if(!_0x1cdf94){_0x129d94['sendStatus'](0x194);}return _0x1cdf94;};}function handleError(_0x522a22,_0x2e329a){_0x2e329a=_0x2e329a||0x1f4;return function(_0x57a4d0){logger['error'](_0x57a4d0[_0x4966('0x28')]);if(_0x57a4d0['name']){delete _0x57a4d0[_0x4966('0x29')];}_0x522a22[_0x4966('0x1c')](_0x2e329a)[_0x4966('0x2a')](_0x57a4d0);};}exports[_0x4966('0x2b')]=function(_0x49cdc3,_0x469340){var _0x55e296={},_0x3dbcbd={},_0x1d6d1e={'count':0x0,'rows':[]};var _0x159ce1=_[_0x4966('0x2c')](db[_0x4966('0x2d')][_0x4966('0x2e')],function(_0x5642ad){return{'name':_0x5642ad[_0x4966('0x2f')],'type':_0x5642ad[_0x4966('0x30')][_0x4966('0x31')]};});_0x3dbcbd[_0x4966('0x32')]=_['map'](_0x159ce1,'name');_0x3dbcbd['query']=_[_0x4966('0x33')](_0x49cdc3[_0x4966('0x34')]);_0x3dbcbd['filters']=_[_0x4966('0x35')](_0x3dbcbd[_0x4966('0x32')],_0x3dbcbd[_0x4966('0x34')]);_0x55e296[_0x4966('0x36')]=_[_0x4966('0x35')](_0x3dbcbd[_0x4966('0x32')],qs[_0x4966('0x37')](_0x49cdc3[_0x4966('0x34')][_0x4966('0x37')]));_0x55e296[_0x4966('0x36')]=_0x55e296['attributes'][_0x4966('0x38')]?_0x55e296['attributes']:_0x3dbcbd[_0x4966('0x32')];if(!_0x49cdc3[_0x4966('0x34')]['hasOwnProperty'](_0x4966('0x39'))){_0x55e296['limit']=qs[_0x4966('0x1f')](_0x49cdc3[_0x4966('0x34')][_0x4966('0x1f')]);_0x55e296[_0x4966('0x1e')]=qs['offset'](_0x49cdc3[_0x4966('0x34')]['offset']);}_0x55e296[_0x4966('0x3a')]=qs['sort'](_0x49cdc3[_0x4966('0x34')]['sort']);_0x55e296[_0x4966('0x3b')]=qs['filters'](_['pick'](_0x49cdc3[_0x4966('0x34')],_0x3dbcbd['filters']),_0x159ce1);if(_0x49cdc3[_0x4966('0x34')][_0x4966('0x3c')]){_0x55e296[_0x4966('0x3b')]=_[_0x4966('0x3d')](_0x55e296[_0x4966('0x3b')],{'$or':_['map'](_0x159ce1,function(_0x1011fc){if(_0x1011fc[_0x4966('0x30')]!==_0x4966('0x3e')){var _0xdefc5b={};_0xdefc5b[_0x1011fc['name']]={'$like':'%'+_0x49cdc3[_0x4966('0x34')]['filter']+'%'};return _0xdefc5b;}})});}_0x55e296=_['merge']({},_0x55e296,_0x49cdc3[_0x4966('0x3f')]);var _0x2d4a96={'where':_0x55e296['where']};return db[_0x4966('0x2d')]['count'](_0x2d4a96)[_0x4966('0x26')](function(_0x3052a4){_0x1d6d1e[_0x4966('0x21')]=_0x3052a4;if(_0x49cdc3[_0x4966('0x34')]['includeAll']){_0x55e296[_0x4966('0x40')]=[{'all':!![]}];}return db[_0x4966('0x2d')]['findAll'](_0x55e296);})[_0x4966('0x26')](function(_0x411c14){_0x1d6d1e[_0x4966('0x41')]=_0x411c14;return _0x1d6d1e;})[_0x4966('0x26')](respondWithFilteredResult(_0x469340,_0x55e296))[_0x4966('0x42')](handleError(_0x469340,null));};exports[_0x4966('0x43')]=function(_0xa43d23,_0x3be33b){var _0x31dd62={'raw':!![],'where':{'id':_0xa43d23[_0x4966('0x44')]['id']}},_0x48c11c={};_0x48c11c[_0x4966('0x32')]=_[_0x4966('0x33')](db['VtigerField'][_0x4966('0x2e')]);_0x48c11c[_0x4966('0x34')]=_[_0x4966('0x33')](_0xa43d23[_0x4966('0x34')]);_0x48c11c['filters']=_['intersection'](_0x48c11c['model'],_0x48c11c[_0x4966('0x34')]);_0x31dd62['attributes']=_['intersection'](_0x48c11c[_0x4966('0x32')],qs[_0x4966('0x37')](_0xa43d23['query'][_0x4966('0x37')]));_0x31dd62['attributes']=_0x31dd62[_0x4966('0x36')][_0x4966('0x38')]?_0x31dd62[_0x4966('0x36')]:_0x48c11c[_0x4966('0x32')];if(_0xa43d23['query'][_0x4966('0x45')]){_0x31dd62[_0x4966('0x40')]=[{'all':!![]}];}_0x31dd62=_[_0x4966('0x3d')]({},_0x31dd62,_0xa43d23['options']);return db['VtigerField'][_0x4966('0x46')](_0x31dd62)[_0x4966('0x26')](handleEntityNotFound(_0x3be33b,null))[_0x4966('0x26')](respondWithResult(_0x3be33b,null))[_0x4966('0x42')](handleError(_0x3be33b,null));};exports['create']=function(_0x21f489,_0x20c781){return db[_0x4966('0x2d')]['create'](_0x21f489[_0x4966('0x47')],{})[_0x4966('0x26')](respondWithResult(_0x20c781,0xc9))[_0x4966('0x42')](handleError(_0x20c781,null));};exports[_0x4966('0x48')]=function(_0x4a5c94,_0x498442){if(_0x4a5c94[_0x4966('0x47')]['id']){delete _0x4a5c94[_0x4966('0x47')]['id'];}return db[_0x4966('0x2d')][_0x4966('0x46')]({'where':{'id':_0x4a5c94[_0x4966('0x44')]['id']}})[_0x4966('0x26')](handleEntityNotFound(_0x498442,null))['then'](saveUpdates(_0x4a5c94[_0x4966('0x47')],null))['then'](respondWithResult(_0x498442,null))[_0x4966('0x42')](handleError(_0x498442,null));};exports[_0x4966('0x27')]=function(_0x2a5dab,_0x213671){return db[_0x4966('0x2d')][_0x4966('0x46')]({'where':{'id':_0x2a5dab[_0x4966('0x44')]['id']}})['then'](handleEntityNotFound(_0x213671,null))[_0x4966('0x26')](removeEntity(_0x213671,null))['catch'](handleError(_0x213671,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 900adcd..e790096 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 _0x4073=['FieldId','lodash','api','moment','bluebird','path','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x4073,0x105));var _0x3407=function(_0x4fe2cb,_0x2f0c32){_0x4fe2cb=_0x4fe2cb-0x0;var _0x55a679=_0x4073[_0x4fe2cb];return _0x55a679;};'use strict';var _=require(_0x3407('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3407('0x1'));var moment=require(_0x3407('0x2'));var BPromise=require(_0x3407('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3407('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module['exports']=function(_0xb24b1d,_0x3b7950){return _0xb24b1d['define'](_0x3407('0x5'),attributes,{'tableName':_0x3407('0x6'),'paranoid':![],'indexes':[{'name':_0x3407('0x7'),'fields':[_0x3407('0x8'),_0x3407('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e3d=['exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','moment','bluebird','request-promise','path','./intVtigerField.attributes'];(function(_0x1c4756,_0xb50fa8){var _0x94138a=function(_0xa58e6f){while(--_0xa58e6f){_0x1c4756['push'](_0x1c4756['shift']());}};_0x94138a(++_0xb50fa8);}(_0x3e3d,0x132));var _0xd3e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3e3d[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xd3e3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd3e3('0x1'));var BPromise=require(_0xd3e3('0x2'));var rp=require(_0xd3e3('0x3'));var fs=require('fs');var path=require(_0xd3e3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3e3('0x5'));module[_0xd3e3('0x6')]=function(_0x582183,_0x17c3e6){return _0x582183[_0xd3e3('0x7')]('VtigerField',attributes,{'tableName':_0xd3e3('0x8'),'paranoid':![],'indexes':[{'name':_0xd3e3('0x9'),'fields':[_0xd3e3('0xa'),_0xd3e3('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index c8d5a3c..e7ed8cd 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 _0x44fe=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util'];(function(_0x32ff7e,_0x77bcb5){var _0xdf5f81=function(_0x2e6367){while(--_0x2e6367){_0x32ff7e['push'](_0x32ff7e['shift']());}};_0xdf5f81(++_0x77bcb5);}(_0x44fe,0x174));var _0xe44f=function(_0x27d1e4,_0x35fd10){_0x27d1e4=_0x27d1e4-0x0;var _0x1437b8=_0x44fe[_0x27d1e4];return _0x1437b8;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var moment=require(_0xe44f('0x2'));var BPromise=require(_0xe44f('0x3'));var rs=require(_0xe44f('0x4'));var fs=require('fs');var Redis=require(_0xe44f('0x5'));var db=require(_0xe44f('0x6'))['db'];var utils=require(_0xe44f('0x7'));var logger=require('../../config/logger')(_0xe44f('0x8'));var config=require(_0xe44f('0x9'));var jayson=require(_0xe44f('0xa'));var client=jayson['client'][_0xe44f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f81d4,_0x4c4f74,_0x1c74ca){return new BPromise(function(_0x2fa8ae,_0x323ea6){return client[_0xe44f('0xc')](_0x3f81d4,_0x1c74ca)[_0xe44f('0xd')](function(_0x52aef2){logger['info'](_0xe44f('0xe'),_0x4c4f74,'request\x20sent');logger[_0xe44f('0xf')](_0xe44f('0x10'),_0x4c4f74,'request\x20sent',JSON['stringify'](_0x52aef2));if(_0x52aef2[_0xe44f('0x11')]){if(_0x52aef2[_0xe44f('0x11')][_0xe44f('0x12')]===0x1f4){logger[_0xe44f('0x11')]('VtigerField,\x20%s,\x20%s',_0x4c4f74,_0x52aef2[_0xe44f('0x11')][_0xe44f('0x13')]);return _0x323ea6(_0x52aef2[_0xe44f('0x11')][_0xe44f('0x13')]);}logger[_0xe44f('0x11')](_0xe44f('0xe'),_0x4c4f74,_0x52aef2[_0xe44f('0x11')][_0xe44f('0x13')]);return _0x2fa8ae(_0x52aef2[_0xe44f('0x11')][_0xe44f('0x13')]);}else{logger[_0xe44f('0x14')](_0xe44f('0xe'),_0x4c4f74,'request\x20sent');_0x2fa8ae(_0x52aef2[_0xe44f('0x15')][_0xe44f('0x13')]);}})['catch'](function(_0x27f1b9){logger[_0xe44f('0x11')](_0xe44f('0xe'),_0x4c4f74,_0x27f1b9);_0x323ea6(_0x27f1b9);});});} \ No newline at end of file +var _0x2f59=['http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x2f59,0x157));var _0x92f5=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x2f59[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0x92f5('0x0'));var util=require(_0x92f5('0x1'));var moment=require('moment');var BPromise=require(_0x92f5('0x2'));var rs=require(_0x92f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92f5('0x4'))['db'];var utils=require(_0x92f5('0x5'));var logger=require('../../config/logger')(_0x92f5('0x6'));var config=require(_0x92f5('0x7'));var jayson=require(_0x92f5('0x8'));var client=jayson['client'][_0x92f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bd197,_0x176bf1,_0x1e17e1){return new BPromise(function(_0x5d2dba,_0x3b4767){return client[_0x92f5('0xa')](_0x2bd197,_0x1e17e1)[_0x92f5('0xb')](function(_0x401a2b){logger[_0x92f5('0xc')](_0x92f5('0xd'),_0x176bf1,'request\x20sent');logger[_0x92f5('0xe')](_0x92f5('0xf'),_0x176bf1,_0x92f5('0x10'),JSON['stringify'](_0x401a2b));if(_0x401a2b[_0x92f5('0x11')]){if(_0x401a2b['error'][_0x92f5('0x12')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x176bf1,_0x401a2b[_0x92f5('0x11')][_0x92f5('0x13')]);return _0x3b4767(_0x401a2b[_0x92f5('0x11')][_0x92f5('0x13')]);}logger['error'](_0x92f5('0xd'),_0x176bf1,_0x401a2b['error'][_0x92f5('0x13')]);return _0x5d2dba(_0x401a2b[_0x92f5('0x11')][_0x92f5('0x13')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x176bf1,_0x92f5('0x10'));_0x5d2dba(_0x401a2b[_0x92f5('0x14')][_0x92f5('0x13')]);}})[_0x92f5('0x15')](function(_0x467021){logger['error'](_0x92f5('0xd'),_0x176bf1,_0x467021);_0x3b4767(_0x467021);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c4eaba8..83fd124 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 _0x28ff=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','post','put','update'];(function(_0x54ca51,_0x450937){var _0x5da6e5=function(_0x1e0f2a){while(--_0x1e0f2a){_0x54ca51['push'](_0x54ca51['shift']());}};_0x5da6e5(++_0x450937);}(_0x28ff,0x7a));var _0xf28f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x28ff[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0xf28f('0x0'));var path=require(_0xf28f('0x1'));var timeout=require(_0xf28f('0x2'));var express=require('express');var router=express[_0xf28f('0x3')]();var fs_extra=require(_0xf28f('0x4'));var auth=require(_0xf28f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf28f('0x6'));var controller=require(_0xf28f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf28f('0x8')]);router[_0xf28f('0x9')](_0xf28f('0xa'),auth['isAuthenticated'](),controller[_0xf28f('0xb')]);router['get'](_0xf28f('0xc'),auth[_0xf28f('0xd')](),controller[_0xf28f('0xe')]);router['get']('/:id/fields',auth[_0xf28f('0xd')](),controller['getFields']);router[_0xf28f('0xf')]('/',auth[_0xf28f('0xd')](),controller['create']);router[_0xf28f('0xf')]('/:id/configurations',auth[_0xf28f('0xd')](),controller['addConfiguration']);router[_0xf28f('0x10')](_0xf28f('0xa'),auth[_0xf28f('0xd')](),controller[_0xf28f('0x11')]);router['delete'](_0xf28f('0xa'),auth[_0xf28f('0xd')](),controller[_0xf28f('0x12')]);module[_0xf28f('0x13')]=router; \ No newline at end of file +var _0x0e8a=['/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations'];(function(_0x1eeead,_0x1529c2){var _0x249c52=function(_0x2f24af){while(--_0x2f24af){_0x1eeead['push'](_0x1eeead['shift']());}};_0x249c52(++_0x1529c2);}(_0x0e8a,0x1e6));var _0xa0e8=function(_0x564523,_0x5db1c8){_0x564523=_0x564523-0x0;var _0x404d2a=_0x0e8a[_0x564523];return _0x404d2a;};'use strict';var multer=require(_0xa0e8('0x0'));var util=require(_0xa0e8('0x1'));var path=require(_0xa0e8('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0e8('0x4'));var interaction=require(_0xa0e8('0x5'));var config=require(_0xa0e8('0x6'));var controller=require(_0xa0e8('0x7'));router[_0xa0e8('0x8')]('/',auth[_0xa0e8('0x9')](),controller[_0xa0e8('0xa')]);router[_0xa0e8('0x8')]('/:id',auth[_0xa0e8('0x9')](),controller[_0xa0e8('0xb')]);router[_0xa0e8('0x8')](_0xa0e8('0xc'),auth[_0xa0e8('0x9')](),controller[_0xa0e8('0xd')]);router[_0xa0e8('0x8')](_0xa0e8('0xe'),auth[_0xa0e8('0x9')](),controller[_0xa0e8('0xf')]);router[_0xa0e8('0x10')]('/',auth[_0xa0e8('0x9')](),controller[_0xa0e8('0x11')]);router['post'](_0xa0e8('0xc'),auth[_0xa0e8('0x9')](),controller[_0xa0e8('0x12')]);router[_0xa0e8('0x13')](_0xa0e8('0x14'),auth[_0xa0e8('0x9')](),controller[_0xa0e8('0x15')]);router[_0xa0e8('0x16')]('/:id',auth[_0xa0e8('0x9')](),controller[_0xa0e8('0x17')]);module[_0xa0e8('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 549bf1a..32a369a 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 _0xdfb1=['token','password','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x53f84e,_0x714b5a){var _0xc691d1=function(_0x513d58){while(--_0x513d58){_0x53f84e['push'](_0x53f84e['shift']());}};_0xc691d1(++_0x714b5a);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x8b5a2b,_0x1a36b1){_0x8b5a2b=_0x8b5a2b-0x0;var _0x217206=_0xdfb1[_0x8b5a2b];return _0x217206;};'use strict';var Sequelize=require(_0x1dfb('0x0'));module[_0x1dfb('0x1')]={'name':{'type':Sequelize[_0x1dfb('0x2')]},'description':{'type':Sequelize[_0x1dfb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1dfb('0x3')},'password':{'type':Sequelize[_0x1dfb('0x2')]},'token':{'type':Sequelize[_0x1dfb('0x2')]},'remoteUri':{'type':Sequelize[_0x1dfb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x1dfb('0x4')),'defaultValue':_0x1dfb('0x5')},'serverUrl':{'type':Sequelize[_0x1dfb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1dfb('0x6'),_0x1dfb('0x7')),'defaultValue':_0x1dfb('0x6')}}; \ No newline at end of file +var _0xcd05=['username','remoteUri','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x52c5fd,_0x399a61){var _0x349e4e=function(_0x44865d){while(--_0x44865d){_0x52c5fd['push'](_0x52c5fd['shift']());}};_0x349e4e(++_0x399a61);}(_0xcd05,0x163));var _0x5cd0=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0xcd05[_0x413727];return _0x5f46d7;};'use strict';var Sequelize=require(_0x5cd0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5cd0('0x1')],'unique':_0x5cd0('0x2')},'password':{'type':Sequelize[_0x5cd0('0x1')]},'token':{'type':Sequelize[_0x5cd0('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5cd0('0x3')},'authType':{'type':Sequelize[_0x5cd0('0x4')]('password','token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x5cd0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5cd0('0x4')](_0x5cd0('0x5'),_0x5cd0('0x6')),'defaultValue':_0x5cd0('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 7845fad..e626cc1 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x9a3122,_0x34884d){var _0x20aab6=function(_0x573abb){while(--_0x573abb){_0x9a3122['push'](_0x9a3122['shift']());}};_0x20aab6(++_0x34884d);}(_0x04b8,0x159));var _0x804b=function(_0x592f1f,_0x119d8a){_0x592f1f=_0x592f1f-0x0;var _0x4c6a3e=_0x04b8[_0x592f1f];return _0x4c6a3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file +var _0xb7e7=['channel','getDescriptions','ZendeskField','Subjects','Descriptions','password','token','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','%s:%s','username','base64','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','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','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskAccount','findAll','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','options','AccountId','getSubjects'];(function(_0x1bf094,_0x52ebdb){var _0x192f02=function(_0x5813f2){while(--_0x5813f2){_0x1bf094['push'](_0x1bf094['shift']());}};_0x192f02(++_0x52ebdb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];var integrations=require(_0x7b7e('0x19'));function respondWithStatusCode(_0x54d8ce,_0x267446){_0x267446=_0x267446||0xcc;return function(_0x430eab){if(_0x430eab){return _0x54d8ce['sendStatus'](_0x267446);}return _0x54d8ce[_0x7b7e('0x1a')](_0x267446)['end']();};}function respondWithResult(_0x4c6011,_0x2889ed){_0x2889ed=_0x2889ed||0xc8;return function(_0xd304f5){if(_0xd304f5){return _0x4c6011[_0x7b7e('0x1a')](_0x2889ed)[_0x7b7e('0x1b')](_0xd304f5);}};}function respondWithFilteredResult(_0x3d2fb2,_0x5703fd){return function(_0x51baf6){if(_0x51baf6){var _0xc7f087=typeof _0x5703fd[_0x7b7e('0x1c')]===_0x7b7e('0x1d')&&typeof _0x5703fd[_0x7b7e('0x1e')]===_0x7b7e('0x1d');var _0x3bf2f0=_0x51baf6[_0x7b7e('0x1f')];var _0x200ef7=_0xc7f087?0x0:_0x5703fd[_0x7b7e('0x1c')];var _0x429a0e=_0xc7f087?_0x51baf6[_0x7b7e('0x1f')]:_0x5703fd[_0x7b7e('0x1c')]+_0x5703fd[_0x7b7e('0x1e')];var _0x3bec7d;if(_0x429a0e>=_0x3bf2f0){_0x429a0e=_0x3bf2f0;_0x3bec7d=0xc8;}else{_0x3bec7d=0xce;}_0x3d2fb2[_0x7b7e('0x1a')](_0x3bec7d);return _0x3d2fb2[_0x7b7e('0x20')](_0x7b7e('0x21'),_0x200ef7+'-'+_0x429a0e+'/'+_0x3bf2f0)['json'](_0x51baf6);}return null;};}function patchUpdates(_0x69262b){return function(_0x43db4f){try{jsonpatch[_0x7b7e('0x22')](_0x43db4f,_0x69262b,!![]);}catch(_0x4c0647){return BPromise[_0x7b7e('0x23')](_0x4c0647);}return _0x43db4f[_0x7b7e('0x24')]();};}function saveUpdates(_0x14243b,_0x200156){return function(_0x2b7211){if(_0x2b7211){return _0x2b7211[_0x7b7e('0x25')](_0x14243b)[_0x7b7e('0x26')](function(_0x10a66a){return _0x10a66a;});}return null;};}function removeEntity(_0x53bbb3,_0x5d6215){return function(_0x4a836a){if(_0x4a836a){return _0x4a836a[_0x7b7e('0x27')]()[_0x7b7e('0x26')](function(){_0x53bbb3[_0x7b7e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d3b1,_0x5dadbb){return function(_0x182245){if(!_0x182245){_0x51d3b1[_0x7b7e('0x28')](0x194);}return _0x182245;};}function handleError(_0x16a3c7,_0x7aa71){_0x7aa71=_0x7aa71||0x1f4;return function(_0x3ceaf5){logger['error'](_0x3ceaf5[_0x7b7e('0x29')]);if(_0x3ceaf5[_0x7b7e('0x2a')]){delete _0x3ceaf5['name'];}_0x16a3c7['status'](_0x7aa71)['send'](_0x3ceaf5);};}exports[_0x7b7e('0x2b')]=function(_0x423832,_0x503625){var _0x3db8c4={},_0x51d4b5={},_0x1b4341={'count':0x0,'rows':[]};var _0xb9b6bf=_[_0x7b7e('0x2c')](db['ZendeskAccount'][_0x7b7e('0x2d')],function(_0xe31336){return{'name':_0xe31336[_0x7b7e('0x2e')],'type':_0xe31336[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x51d4b5['model']=_[_0x7b7e('0x2c')](_0xb9b6bf,'name');_0x51d4b5[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x423832[_0x7b7e('0x31')]);_0x51d4b5[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x51d4b5[_0x7b7e('0x35')],_0x51d4b5[_0x7b7e('0x31')]);_0x3db8c4['attributes']=_['intersection'](_0x51d4b5[_0x7b7e('0x35')],qs[_0x7b7e('0x36')](_0x423832['query'][_0x7b7e('0x36')]));_0x3db8c4[_0x7b7e('0x37')]=_0x3db8c4[_0x7b7e('0x37')]['length']?_0x3db8c4[_0x7b7e('0x37')]:_0x51d4b5[_0x7b7e('0x35')];if(!_0x423832[_0x7b7e('0x31')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x3db8c4[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x423832[_0x7b7e('0x31')][_0x7b7e('0x1e')]);_0x3db8c4[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x423832[_0x7b7e('0x31')][_0x7b7e('0x1c')]);}_0x3db8c4[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x423832[_0x7b7e('0x31')]['sort']);_0x3db8c4[_0x7b7e('0x3c')]=qs[_0x7b7e('0x33')](_[_0x7b7e('0x3d')](_0x423832[_0x7b7e('0x31')],_0x51d4b5[_0x7b7e('0x33')]),_0xb9b6bf);if(_0x423832[_0x7b7e('0x31')][_0x7b7e('0x3e')]){_0x3db8c4[_0x7b7e('0x3c')]=_[_0x7b7e('0x3f')](_0x3db8c4[_0x7b7e('0x3c')],{'$or':_['map'](_0xb9b6bf,function(_0x3d6571){if(_0x3d6571[_0x7b7e('0x2f')]!==_0x7b7e('0x40')){var _0x1d43da={};_0x1d43da[_0x3d6571['name']]={'$like':'%'+_0x423832[_0x7b7e('0x31')][_0x7b7e('0x3e')]+'%'};return _0x1d43da;}})});}_0x3db8c4=_[_0x7b7e('0x3f')]({},_0x3db8c4,_0x423832['options']);var _0x4a2888={'where':_0x3db8c4[_0x7b7e('0x3c')]};return db['ZendeskAccount'][_0x7b7e('0x1f')](_0x4a2888)[_0x7b7e('0x26')](function(_0x4de331){_0x1b4341[_0x7b7e('0x1f')]=_0x4de331;if(_0x423832[_0x7b7e('0x31')][_0x7b7e('0x41')]){_0x3db8c4[_0x7b7e('0x42')]=[{'all':!![]}];}return db[_0x7b7e('0x43')][_0x7b7e('0x44')](_0x3db8c4);})[_0x7b7e('0x26')](function(_0x1d9bb9){_0x1b4341[_0x7b7e('0x45')]=_0x1d9bb9;return _0x1b4341;})['then'](respondWithFilteredResult(_0x503625,_0x3db8c4))['catch'](handleError(_0x503625,null));};exports[_0x7b7e('0x46')]=function(_0x550ea6,_0x41c8a6){var _0x5e8b5d={'raw':![],'where':{'id':_0x550ea6[_0x7b7e('0x47')]['id']}},_0x48dd74={};_0x48dd74['model']=_[_0x7b7e('0x32')](db['ZendeskAccount'][_0x7b7e('0x2d')]);_0x48dd74[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x550ea6[_0x7b7e('0x31')]);_0x48dd74['filters']=_[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x35')],_0x48dd74[_0x7b7e('0x31')]);_0x5e8b5d[_0x7b7e('0x37')]=_[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x35')],qs['fields'](_0x550ea6['query']['fields']));_0x5e8b5d[_0x7b7e('0x37')]=_0x5e8b5d[_0x7b7e('0x37')][_0x7b7e('0x48')]?_0x5e8b5d[_0x7b7e('0x37')]:_0x48dd74[_0x7b7e('0x35')];if(_0x550ea6[_0x7b7e('0x31')]['includeAll']){_0x5e8b5d[_0x7b7e('0x42')]=[{'all':!![]}];}_0x5e8b5d=_[_0x7b7e('0x3f')]({},_0x5e8b5d,_0x550ea6['options']);return db['ZendeskAccount'][_0x7b7e('0x49')](_0x5e8b5d)[_0x7b7e('0x26')](handleEntityNotFound(_0x41c8a6,null))[_0x7b7e('0x26')](respondWithResult(_0x41c8a6,null))[_0x7b7e('0x4a')](handleError(_0x41c8a6,null));};exports[_0x7b7e('0x4b')]=function(_0xb46776,_0x590154){return db[_0x7b7e('0x43')]['create'](_0xb46776[_0x7b7e('0x4c')],{})[_0x7b7e('0x26')](respondWithResult(_0x590154,0xc9))[_0x7b7e('0x4a')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x58e4e6,_0x3b649e){if(_0x58e4e6[_0x7b7e('0x4c')]['id']){delete _0x58e4e6[_0x7b7e('0x4c')]['id'];}return db[_0x7b7e('0x43')][_0x7b7e('0x49')]({'where':{'id':_0x58e4e6['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3b649e,null))[_0x7b7e('0x26')](saveUpdates(_0x58e4e6[_0x7b7e('0x4c')],null))[_0x7b7e('0x26')](respondWithResult(_0x3b649e,null))[_0x7b7e('0x4a')](handleError(_0x3b649e,null));};exports['destroy']=function(_0x1d6d18,_0x29024e){return db[_0x7b7e('0x43')][_0x7b7e('0x49')]({'where':{'id':_0x1d6d18[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x29024e,null))[_0x7b7e('0x26')](removeEntity(_0x29024e,null))['catch'](handleError(_0x29024e,null));};exports[_0x7b7e('0x4d')]=function(_0x5d7c89,_0x16730c,_0x766a54){var _0x570303={};var _0x36f1be={};var _0x44e3a0;var _0x16c81d;return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x5d7c89[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x16730c,null))['then'](function(_0xbf044d){if(_0xbf044d){_0x44e3a0=_0xbf044d;_0x36f1be[_0x7b7e('0x35')]=_[_0x7b7e('0x32')](db[_0x7b7e('0x4f')]['rawAttributes']);_0x36f1be['query']=_['keys'](_0x5d7c89[_0x7b7e('0x31')]);_0x36f1be[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x36f1be['model'],_0x36f1be['query']);_0x570303[_0x7b7e('0x37')]=_[_0x7b7e('0x34')](_0x36f1be['model'],qs[_0x7b7e('0x36')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x36')]));_0x570303['attributes']=_0x570303[_0x7b7e('0x37')][_0x7b7e('0x48')]?_0x570303['attributes']:_0x36f1be[_0x7b7e('0x35')];_0x570303[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3b')]);_0x570303[_0x7b7e('0x3c')]=qs[_0x7b7e('0x33')](_[_0x7b7e('0x3d')](_0x5d7c89[_0x7b7e('0x31')],_0x36f1be['filters']));if(_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3e')]){_0x570303['where']=_[_0x7b7e('0x3f')](_0x570303[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x2c')](_0x570303['attributes'],function(_0x1729e0){var _0x4fc349={};_0x4fc349[_0x1729e0]={'$like':'%'+_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3e')]+'%'};return _0x4fc349;})});}_0x570303=_['merge']({},_0x570303,_0x5d7c89[_0x7b7e('0x50')]);return _0x44e3a0[_0x7b7e('0x4d')](_0x570303);}})['then'](function(_0x2dcb35){if(_0x2dcb35){_0x16c81d=_0x2dcb35[_0x7b7e('0x48')];if(!_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x38')]('nolimit')){_0x570303[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x1e')]);_0x570303[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x1c')]);}return _0x44e3a0[_0x7b7e('0x4d')](_0x570303);}})[_0x7b7e('0x26')](function(_0x5b9010){if(_0x5b9010){return _0x5b9010?{'count':_0x16c81d,'rows':_0x5b9010}:null;}})[_0x7b7e('0x26')](respondWithResult(_0x16730c,null))['catch'](handleError(_0x16730c,null));};exports['addConfiguration']=function(_0x2b105a,_0x7cbe6c,_0x1eb4b1){if(_0x2b105a[_0x7b7e('0x4c')]['id']){delete _0x2b105a['body']['id'];}return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x2b105a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x7cbe6c,null))[_0x7b7e('0x26')](function(_0x2b2afd){if(_0x2b2afd){_0x2b105a['body'][_0x7b7e('0x51')]=_0x2b2afd['id'];_0x2b105a['body']['Subjects']=integrations[_0x7b7e('0x52')](_0x2b105a['body'][_0x7b7e('0x53')],_0x2b105a['body'][_0x7b7e('0x2f')]);_0x2b105a[_0x7b7e('0x4c')]['Descriptions']=integrations[_0x7b7e('0x54')](_0x2b105a[_0x7b7e('0x4c')]['channel'],_0x2b105a[_0x7b7e('0x4c')][_0x7b7e('0x2f')]);return db[_0x7b7e('0x4f')][_0x7b7e('0x4b')](_0x2b105a[_0x7b7e('0x4c')],{'include':[{'model':db[_0x7b7e('0x55')],'as':_0x7b7e('0x56')},{'model':db[_0x7b7e('0x55')],'as':_0x7b7e('0x57')}]});}return null;})[_0x7b7e('0x26')](respondWithResult(_0x7cbe6c,null))['catch'](handleError(_0x7cbe6c,null));};exports['getFields']=function(_0x34e7df,_0x46ac1f,_0x2c6e3a){var _0x348c77='';return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x34e7df[_0x7b7e('0x47')]['id']},'attributes':['id','username',_0x7b7e('0x58'),_0x7b7e('0x59'),'authType',_0x7b7e('0x5a')]})[_0x7b7e('0x26')](handleEntityNotFound(_0x46ac1f,null))[_0x7b7e('0x26')](function(_0x271318){if(_0x271318){_0x348c77=_0x271318[_0x7b7e('0x5a')];var _0x40f65e=_0x348c77[_0x7b7e('0x5b')](-0x1);if(_0x40f65e==='/'){_0x348c77=_0x348c77[_0x7b7e('0x5c')](0x0,_0x348c77[_0x7b7e('0x5d')](_0x40f65e));}var _0x3b6bc6={'method':_0x7b7e('0x5e'),'uri':util['format'](_0x7b7e('0x5f'),_0x348c77,_0x7b7e('0x60')),'json':!![]};switch(_0x271318[_0x7b7e('0x61')]){case _0x7b7e('0x58'):_0x3b6bc6[_0x7b7e('0x62')]={'Authorization':util[_0x7b7e('0x63')](_0x7b7e('0x64'),new Buffer(util['format'](_0x7b7e('0x65'),_0x271318[_0x7b7e('0x66')],_0x271318[_0x7b7e('0x58')]))['toString'](_0x7b7e('0x67')))};break;case _0x7b7e('0x59'):_0x3b6bc6[_0x7b7e('0x62')]={'Authorization':util[_0x7b7e('0x63')](_0x7b7e('0x64'),new Buffer(util['format']('%s/token:%s',_0x271318['username'],_0x271318[_0x7b7e('0x59')]))[_0x7b7e('0x68')](_0x7b7e('0x67')))};break;default:throw new db['Sequelize'][(_0x7b7e('0x69'))](_0x7b7e('0x6a'));}return rp(_0x3b6bc6);}})[_0x7b7e('0x26')](function(_0x5bf4d1){if(_0x5bf4d1){var _0x2983bf=[_0x7b7e('0x6b'),_0x7b7e('0x6c'),_0x7b7e('0x6d'),'assignee'];_[_0x7b7e('0x6e')](_0x5bf4d1[_0x7b7e('0x60')],function(_0xa52b93){return _0x2983bf[_0x7b7e('0x6f')](_0xa52b93['type']);});return{'count':_0x5bf4d1['ticket_fields'][_0x7b7e('0x48')],'rows':_['map'](_0x5bf4d1[_0x7b7e('0x60')],function(_0x4215b5){return{'id':_0x4215b5['id'],'name':_0x4215b5[_0x7b7e('0x70')]>0x7?_0x4215b5[_0x7b7e('0x71')]:_0x4215b5['type'],'custom':_0x4215b5[_0x7b7e('0x70')]>0x7?!![]:![],'options':_0x4215b5[_0x7b7e('0x72')]?_0x4215b5[_0x7b7e('0x72')]:_0x4215b5[_0x7b7e('0x73')]?_0x4215b5[_0x7b7e('0x73')]:[]};})};}})[_0x7b7e('0x26')](respondWithResult(_0x46ac1f,null))[_0x7b7e('0x4a')](function(_0x372478){var _0x44d8c4=_0x34e7df[_0x7b7e('0x31')][_0x7b7e('0x74')]?0x1f4:_0x372478[_0x7b7e('0x75')]||0x1f4;logger[_0x7b7e('0x76')](_0x7b7e('0x77'),_0x7b7e('0x78'),_0x44d8c4,JSON[_0x7b7e('0x79')](_0x372478));delete _0x372478['name'];if(_0x44d8c4===0x191){_0x44d8c4=0x190;}_0x46ac1f[_0x7b7e('0x1a')](_0x44d8c4)[_0x7b7e('0x7a')](_0x34e7df[_0x7b7e('0x31')][_0x7b7e('0x74')]?{'message':_0x7b7e('0x7b'),'statusCode':_0x372478[_0x7b7e('0x75')]}:_0x372478);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f2f264f..904e2ff 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 _0xf6a7=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x560a65,_0x23ad23){var _0x2450b4=function(_0x370218){while(--_0x370218){_0x560a65['push'](_0x560a65['shift']());}};_0x2450b4(++_0x23ad23);}(_0xf6a7,0x1b3));var _0x7f6a=function(_0x313711,_0x36c1c5){_0x313711=_0x313711-0x0;var _0xd33e3c=_0xf6a7[_0x313711];return _0xd33e3c;};'use strict';var _=require(_0x7f6a('0x0'));var util=require(_0x7f6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f6a('0x2'));var BPromise=require(_0x7f6a('0x3'));var rp=require(_0x7f6a('0x4'));var fs=require('fs');var path=require(_0x7f6a('0x5'));var rimraf=require(_0x7f6a('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f6a('0x7'));var integrations=require(_0x7f6a('0x8'));module[_0x7f6a('0x9')]=function(_0x406998,_0x30e047){return _0x406998[_0x7f6a('0xa')](_0x7f6a('0xb'),attributes,{'tableName':_0x7f6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2397=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2397,0x125));var _0x7239=function(_0x5981e9,_0x38afa3){_0x5981e9=_0x5981e9-0x0;var _0x189659=_0x2397[_0x5981e9];return _0x189659;};'use strict';var _=require(_0x7239('0x0'));var util=require(_0x7239('0x1'));var logger=require(_0x7239('0x2'))(_0x7239('0x3'));var moment=require('moment');var BPromise=require(_0x7239('0x4'));var rp=require(_0x7239('0x5'));var fs=require('fs');var path=require(_0x7239('0x6'));var rimraf=require(_0x7239('0x7'));var config=require(_0x7239('0x8'));var attributes=require(_0x7239('0x9'));var integrations=require(_0x7239('0xa'));module[_0x7239('0xb')]=function(_0x257602,_0x2aa13b){return _0x257602[_0x7239('0xc')]('ZendeskAccount',attributes,{'tableName':_0x7239('0xd'),'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 df8a575..66c6ac7 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 _0x2f78=['result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','map','include','model','attributes','catch','ShowZendeskAccount','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','ZendeskAccount,\x20%s,\x20%s','message'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x2f78,0xa8));var _0x82f7=function(_0x4c0afb,_0x39fc98){_0x4c0afb=_0x4c0afb-0x0;var _0x388475=_0x2f78[_0x4c0afb];return _0x388475;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var moment=require(_0x82f7('0x1'));var BPromise=require(_0x82f7('0x2'));var rs=require(_0x82f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x82f7('0x4'));var logger=require(_0x82f7('0x5'))(_0x82f7('0x6'));var config=require(_0x82f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x82f7('0x8')][_0x82f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d796c,_0x5b91a6,_0x3de02f){return new BPromise(function(_0x4e48cf,_0x1259c3){return client['request'](_0x5d796c,_0x3de02f)[_0x82f7('0xa')](function(_0x15649a){logger[_0x82f7('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x5b91a6,_0x82f7('0xc'));logger[_0x82f7('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5b91a6,_0x82f7('0xc'),JSON[_0x82f7('0xe')](_0x15649a));if(_0x15649a[_0x82f7('0xf')]){if(_0x15649a['error']['code']===0x1f4){logger[_0x82f7('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x5b91a6,_0x15649a[_0x82f7('0xf')]['message']);return _0x1259c3(_0x15649a['error']['message']);}logger['error'](_0x82f7('0x10'),_0x5b91a6,_0x15649a[_0x82f7('0xf')][_0x82f7('0x11')]);return _0x4e48cf(_0x15649a[_0x82f7('0xf')][_0x82f7('0x11')]);}else{logger['info'](_0x82f7('0x10'),_0x5b91a6,_0x82f7('0xc'));_0x4e48cf(_0x15649a[_0x82f7('0x12')][_0x82f7('0x11')]);}})['catch'](function(_0x2cbcde){logger[_0x82f7('0xf')](_0x82f7('0x10'),_0x5b91a6,_0x2cbcde);_0x1259c3(_0x2cbcde);});});}exports[_0x82f7('0x13')]=function(_0x21e8eb){var _0x15f0df=this;return new Promise(function(_0x4de587,_0x124386){return db[_0x82f7('0x14')][_0x82f7('0x15')]({'raw':_0x21e8eb['options']?_0x21e8eb[_0x82f7('0x16')][_0x82f7('0x17')]===undefined?!![]:![]:!![],'where':_0x21e8eb[_0x82f7('0x16')]?_0x21e8eb[_0x82f7('0x16')][_0x82f7('0x18')]||null:null,'attributes':_0x21e8eb['options']?_0x21e8eb[_0x82f7('0x16')]['attributes']||null:null,'limit':_0x21e8eb[_0x82f7('0x16')]?_0x21e8eb[_0x82f7('0x16')]['limit']||null:null,'include':_0x21e8eb[_0x82f7('0x16')]?_0x21e8eb[_0x82f7('0x16')]['include']?_[_0x82f7('0x19')](_0x21e8eb[_0x82f7('0x16')][_0x82f7('0x1a')],function(_0x136434){return{'model':db[_0x136434[_0x82f7('0x1b')]],'as':_0x136434['as'],'attributes':_0x136434['attributes'],'include':_0x136434[_0x82f7('0x1a')]?_['map'](_0x136434[_0x82f7('0x1a')],function(_0x3558d8){return{'model':db[_0x3558d8['model']],'as':_0x3558d8['as'],'attributes':_0x3558d8[_0x82f7('0x1c')],'include':_0x3558d8['include']?_[_0x82f7('0x19')](_0x3558d8[_0x82f7('0x1a')],function(_0x2a982f){return{'model':db[_0x2a982f[_0x82f7('0x1b')]],'as':_0x2a982f['as'],'attributes':_0x2a982f[_0x82f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x82f7('0xa')](function(_0x372861){logger['info']('GetZendeskAccount',_0x21e8eb);logger[_0x82f7('0xd')](_0x82f7('0x13'),_0x21e8eb,JSON['stringify'](_0x372861));_0x4de587(_0x372861);})[_0x82f7('0x1d')](function(_0x315e4f){logger[_0x82f7('0xf')](_0x82f7('0x13'),_0x315e4f[_0x82f7('0x11')],_0x21e8eb);_0x124386(_0x15f0df[_0x82f7('0xf')](0x1f4,_0x315e4f[_0x82f7('0x11')]));});});};exports[_0x82f7('0x1e')]=function(_0x224c00){var _0x1eb33f=this;return new Promise(function(_0x468f34,_0x228ee5){return db[_0x82f7('0x14')]['find']({'raw':_0x224c00[_0x82f7('0x16')]?_0x224c00[_0x82f7('0x16')][_0x82f7('0x17')]===undefined?!![]:![]:!![],'where':_0x224c00[_0x82f7('0x16')]?_0x224c00[_0x82f7('0x16')][_0x82f7('0x18')]||null:null,'attributes':_0x224c00[_0x82f7('0x16')]?_0x224c00[_0x82f7('0x16')][_0x82f7('0x1c')]||null:null,'include':_0x224c00[_0x82f7('0x16')]?_0x224c00[_0x82f7('0x16')][_0x82f7('0x1a')]?_['map'](_0x224c00['options'][_0x82f7('0x1a')],function(_0xf00d91){return{'model':db[_0xf00d91[_0x82f7('0x1b')]],'as':_0xf00d91['as'],'attributes':_0xf00d91[_0x82f7('0x1c')],'include':_0xf00d91[_0x82f7('0x1a')]?_[_0x82f7('0x19')](_0xf00d91[_0x82f7('0x1a')],function(_0x3906bb){return{'model':db[_0x3906bb[_0x82f7('0x1b')]],'as':_0x3906bb['as'],'attributes':_0x3906bb[_0x82f7('0x1c')],'include':_0x3906bb[_0x82f7('0x1a')]?_[_0x82f7('0x19')](_0x3906bb['include'],function(_0x3e4129){return{'model':db[_0x3e4129[_0x82f7('0x1b')]],'as':_0x3e4129['as'],'attributes':_0x3e4129[_0x82f7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c394c){logger[_0x82f7('0xb')](_0x82f7('0x1e'),_0x224c00);logger[_0x82f7('0xd')](_0x82f7('0x1e'),_0x224c00,JSON['stringify'](_0x4c394c));_0x468f34(_0x4c394c);})['catch'](function(_0x3613db){logger[_0x82f7('0xf')]('ShowZendeskAccount',_0x3613db[_0x82f7('0x11')],_0x224c00);_0x228ee5(_0x1eb33f[_0x82f7('0xf')](0x1f4,_0x3613db[_0x82f7('0x11')]));});});}; \ No newline at end of file +var _0x09f3=['request\x20sent','debug','stringify','code','error','message','info','result','catch','GetZendeskAccount','raw','options','where','attributes','limit','include','map','ShowZendeskAccount','ZendeskAccount','find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s'];(function(_0x498dd7,_0x5f4eff){var _0x3c89c3=function(_0x186f6c){while(--_0x186f6c){_0x498dd7['push'](_0x498dd7['shift']());}};_0x3c89c3(++_0x5f4eff);}(_0x09f3,0x1c5));var _0x309f=function(_0x5794c4,_0x309b7a){_0x5794c4=_0x5794c4-0x0;var _0x537506=_0x09f3[_0x5794c4];return _0x537506;};'use strict';var _=require(_0x309f('0x0'));var util=require(_0x309f('0x1'));var moment=require(_0x309f('0x2'));var BPromise=require(_0x309f('0x3'));var rs=require(_0x309f('0x4'));var fs=require('fs');var Redis=require(_0x309f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x309f('0x6'));var logger=require('../../config/logger')(_0x309f('0x7'));var config=require(_0x309f('0x8'));var jayson=require(_0x309f('0x9'));var client=jayson[_0x309f('0xa')][_0x309f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x220237,_0x3a6e85,_0x5412ed){return new BPromise(function(_0x110f98,_0x1748d0){return client[_0x309f('0xc')](_0x220237,_0x5412ed)[_0x309f('0xd')](function(_0x2634d9){logger['info'](_0x309f('0xe'),_0x3a6e85,_0x309f('0xf'));logger[_0x309f('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3a6e85,'request\x20sent',JSON[_0x309f('0x11')](_0x2634d9));if(_0x2634d9['error']){if(_0x2634d9['error'][_0x309f('0x12')]===0x1f4){logger[_0x309f('0x13')](_0x309f('0xe'),_0x3a6e85,_0x2634d9[_0x309f('0x13')][_0x309f('0x14')]);return _0x1748d0(_0x2634d9[_0x309f('0x13')][_0x309f('0x14')]);}logger[_0x309f('0x13')](_0x309f('0xe'),_0x3a6e85,_0x2634d9[_0x309f('0x13')][_0x309f('0x14')]);return _0x110f98(_0x2634d9['error']['message']);}else{logger[_0x309f('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x3a6e85,_0x309f('0xf'));_0x110f98(_0x2634d9[_0x309f('0x16')]['message']);}})[_0x309f('0x17')](function(_0x337eb3){logger['error'](_0x309f('0xe'),_0x3a6e85,_0x337eb3);_0x1748d0(_0x337eb3);});});}exports[_0x309f('0x18')]=function(_0xa529df){var _0x1a548a=this;return new Promise(function(_0x1233b3,_0x4676b3){return db['ZendeskAccount']['findAll']({'raw':_0xa529df['options']?_0xa529df['options'][_0x309f('0x19')]===undefined?!![]:![]:!![],'where':_0xa529df[_0x309f('0x1a')]?_0xa529df[_0x309f('0x1a')][_0x309f('0x1b')]||null:null,'attributes':_0xa529df[_0x309f('0x1a')]?_0xa529df[_0x309f('0x1a')][_0x309f('0x1c')]||null:null,'limit':_0xa529df['options']?_0xa529df[_0x309f('0x1a')][_0x309f('0x1d')]||null:null,'include':_0xa529df['options']?_0xa529df['options'][_0x309f('0x1e')]?_[_0x309f('0x1f')](_0xa529df[_0x309f('0x1a')]['include'],function(_0x143cc9){return{'model':db[_0x143cc9['model']],'as':_0x143cc9['as'],'attributes':_0x143cc9[_0x309f('0x1c')],'include':_0x143cc9[_0x309f('0x1e')]?_[_0x309f('0x1f')](_0x143cc9['include'],function(_0x358769){return{'model':db[_0x358769['model']],'as':_0x358769['as'],'attributes':_0x358769[_0x309f('0x1c')],'include':_0x358769['include']?_['map'](_0x358769[_0x309f('0x1e')],function(_0xd1c487){return{'model':db[_0xd1c487['model']],'as':_0xd1c487['as'],'attributes':_0xd1c487[_0x309f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x309f('0xd')](function(_0x551b38){logger[_0x309f('0x15')](_0x309f('0x18'),_0xa529df);logger['debug'](_0x309f('0x18'),_0xa529df,JSON[_0x309f('0x11')](_0x551b38));_0x1233b3(_0x551b38);})[_0x309f('0x17')](function(_0x56cd95){logger[_0x309f('0x13')]('GetZendeskAccount',_0x56cd95['message'],_0xa529df);_0x4676b3(_0x1a548a[_0x309f('0x13')](0x1f4,_0x56cd95['message']));});});};exports[_0x309f('0x20')]=function(_0x5d0bb9){var _0x2de736=this;return new Promise(function(_0x341a92,_0x4dc382){return db[_0x309f('0x21')][_0x309f('0x22')]({'raw':_0x5d0bb9[_0x309f('0x1a')]?_0x5d0bb9[_0x309f('0x1a')][_0x309f('0x19')]===undefined?!![]:![]:!![],'where':_0x5d0bb9[_0x309f('0x1a')]?_0x5d0bb9[_0x309f('0x1a')][_0x309f('0x1b')]||null:null,'attributes':_0x5d0bb9[_0x309f('0x1a')]?_0x5d0bb9[_0x309f('0x1a')][_0x309f('0x1c')]||null:null,'include':_0x5d0bb9['options']?_0x5d0bb9[_0x309f('0x1a')][_0x309f('0x1e')]?_[_0x309f('0x1f')](_0x5d0bb9['options'][_0x309f('0x1e')],function(_0x190263){return{'model':db[_0x190263[_0x309f('0x23')]],'as':_0x190263['as'],'attributes':_0x190263['attributes'],'include':_0x190263['include']?_[_0x309f('0x1f')](_0x190263[_0x309f('0x1e')],function(_0x397d6b){return{'model':db[_0x397d6b[_0x309f('0x23')]],'as':_0x397d6b['as'],'attributes':_0x397d6b[_0x309f('0x1c')],'include':_0x397d6b['include']?_['map'](_0x397d6b[_0x309f('0x1e')],function(_0x4b9d79){return{'model':db[_0x4b9d79[_0x309f('0x23')]],'as':_0x4b9d79['as'],'attributes':_0x4b9d79['attributes']};}):[]};}):[]};}):[]:[]})[_0x309f('0xd')](function(_0x59bfda){logger[_0x309f('0x15')](_0x309f('0x20'),_0x5d0bb9);logger[_0x309f('0x10')]('ShowZendeskAccount',_0x5d0bb9,JSON['stringify'](_0x59bfda));_0x341a92(_0x59bfda);})[_0x309f('0x17')](function(_0x23712e){logger['error'](_0x309f('0x20'),_0x23712e[_0x309f('0x14')],_0x5d0bb9);_0x4dc382(_0x2de736[_0x309f('0x13')](0x1f4,_0x23712e['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2e333d6..3640ac4 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 _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x39f98a,_0x4d9488){_0x39f98a=_0x39f98a-0x0;var _0xea60ed=_0x9ffd[_0x39f98a];return _0xea60ed;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x14d76d,_0x63c5e9){_0x14d76d=_0x14d76d-0x0;var _0x450290=_0x9ffd[_0x14d76d];return _0x450290;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b26df28..6c200fd 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 _0x96be=['sequelize','exports','STRING'];(function(_0x19551c,_0x78259a){var _0x5bfa2c=function(_0x5c1757){while(--_0x5c1757){_0x19551c['push'](_0x19551c['shift']());}};_0x5bfa2c(++_0x78259a);}(_0x96be,0xba));var _0xe96b=function(_0x2d1194,_0x76c1f){_0x2d1194=_0x2d1194-0x0;var _0xab4333=_0x96be[_0x2d1194];return _0xab4333;};'use strict';var Sequelize=require(_0xe96b('0x0'));module[_0xe96b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe96b('0x2')]}}; \ No newline at end of file +var _0x518b=['STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x518b,0x14f));var _0xb518=function(_0x467379,_0x2c8374){_0x467379=_0x467379-0x0;var _0x2a8d22=_0x518b[_0x467379];return _0x2a8d22;};'use strict';var Sequelize=require(_0xb518('0x0'));module['exports']={'name':{'type':Sequelize[_0xb518('0x1')]},'description':{'type':Sequelize[_0xb518('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 00342b6..acfdb03 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 _0x5db8=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','keys','include','find','catch','create','body','params','destroy','getFields','findOne','ZendeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5db8,0xed));var _0x85db=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0x5db8[_0x329905];return _0x3aa42;};'use strict';var emlformat=require(_0x85db('0x0'));var rimraf=require(_0x85db('0x1'));var zipdir=require(_0x85db('0x2'));var jsonpatch=require(_0x85db('0x3'));var rp=require(_0x85db('0x4'));var moment=require(_0x85db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x85db('0x6'));var util=require('util');var path=require(_0x85db('0x7'));var sox=require('sox');var csv=require(_0x85db('0x8'));var ejs=require(_0x85db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x85db('0xb'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xc'));var Papa=require('papaparse');var Redis=require(_0x85db('0xd'));var authService=require(_0x85db('0xe'));var qs=require(_0x85db('0xf'));var as=require(_0x85db('0x10'));var hardwareService=require(_0x85db('0x11'));var logger=require(_0x85db('0x12'))(_0x85db('0x13'));var utils=require(_0x85db('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x85db('0x15'));var db=require(_0x85db('0x16'))['db'];function respondWithStatusCode(_0x1bec78,_0x49b21c){_0x49b21c=_0x49b21c||0xcc;return function(_0x429057){if(_0x429057){return _0x1bec78['sendStatus'](_0x49b21c);}return _0x1bec78[_0x85db('0x17')](_0x49b21c)[_0x85db('0x18')]();};}function respondWithResult(_0x548b4c,_0x54c0ae){_0x54c0ae=_0x54c0ae||0xc8;return function(_0x291d53){if(_0x291d53){return _0x548b4c[_0x85db('0x17')](_0x54c0ae)[_0x85db('0x19')](_0x291d53);}};}function respondWithFilteredResult(_0x10ed85,_0x572f4a){return function(_0x5268af){if(_0x5268af){var _0x1b85df=typeof _0x572f4a[_0x85db('0x1a')]===_0x85db('0x1b')&&typeof _0x572f4a['limit']===_0x85db('0x1b');var _0x5ccaf5=_0x5268af['count'];var _0x58f998=_0x1b85df?0x0:_0x572f4a[_0x85db('0x1a')];var _0x48cccc=_0x1b85df?_0x5268af['count']:_0x572f4a[_0x85db('0x1a')]+_0x572f4a['limit'];var _0x4768f5;if(_0x48cccc>=_0x5ccaf5){_0x48cccc=_0x5ccaf5;_0x4768f5=0xc8;}else{_0x4768f5=0xce;}_0x10ed85['status'](_0x4768f5);return _0x10ed85[_0x85db('0x1c')](_0x85db('0x1d'),_0x58f998+'-'+_0x48cccc+'/'+_0x5ccaf5)[_0x85db('0x19')](_0x5268af);}return null;};}function patchUpdates(_0x12e13c){return function(_0x367d48){try{jsonpatch[_0x85db('0x1e')](_0x367d48,_0x12e13c,!![]);}catch(_0x503c5d){return BPromise[_0x85db('0x1f')](_0x503c5d);}return _0x367d48[_0x85db('0x20')]();};}function saveUpdates(_0x2803b1,_0x150ff4){return function(_0x402d29){if(_0x402d29){return _0x402d29['update'](_0x2803b1)[_0x85db('0x21')](function(_0x21f40e){return _0x21f40e;});}return null;};}function removeEntity(_0xfed66a,_0x49e5b8){return function(_0x435b4e){if(_0x435b4e){return _0x435b4e['destroy']()[_0x85db('0x21')](function(){_0xfed66a['status'](0xcc)[_0x85db('0x18')]();});}};}function handleEntityNotFound(_0x2aef95,_0x44c44a){return function(_0x4bd3de){if(!_0x4bd3de){_0x2aef95[_0x85db('0x22')](0x194);}return _0x4bd3de;};}function handleError(_0x452e11,_0xda42d7){_0xda42d7=_0xda42d7||0x1f4;return function(_0x5ee83d){logger[_0x85db('0x23')](_0x5ee83d[_0x85db('0x24')]);if(_0x5ee83d[_0x85db('0x25')]){delete _0x5ee83d['name'];}_0x452e11[_0x85db('0x17')](_0xda42d7)[_0x85db('0x26')](_0x5ee83d);};}exports[_0x85db('0x27')]=function(_0x1f818d,_0x3f1bd6){var _0x3442ed={},_0x1c697a={},_0x474caf={'count':0x0,'rows':[]};var _0x201ccb=_['map'](db[_0x85db('0x28')][_0x85db('0x29')],function(_0x3b8c9c){return{'name':_0x3b8c9c[_0x85db('0x2a')],'type':_0x3b8c9c[_0x85db('0x2b')][_0x85db('0x2c')]};});_0x1c697a[_0x85db('0x2d')]=_[_0x85db('0x2e')](_0x201ccb,_0x85db('0x25'));_0x1c697a[_0x85db('0x2f')]=_['keys'](_0x1f818d[_0x85db('0x2f')]);_0x1c697a[_0x85db('0x30')]=_[_0x85db('0x31')](_0x1c697a[_0x85db('0x2d')],_0x1c697a['query']);_0x3442ed[_0x85db('0x32')]=_[_0x85db('0x31')](_0x1c697a['model'],qs['fields'](_0x1f818d[_0x85db('0x2f')][_0x85db('0x33')]));_0x3442ed['attributes']=_0x3442ed[_0x85db('0x32')][_0x85db('0x34')]?_0x3442ed[_0x85db('0x32')]:_0x1c697a[_0x85db('0x2d')];if(!_0x1f818d['query']['hasOwnProperty'](_0x85db('0x35'))){_0x3442ed[_0x85db('0x36')]=qs[_0x85db('0x36')](_0x1f818d[_0x85db('0x2f')]['limit']);_0x3442ed[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x1f818d[_0x85db('0x2f')]['offset']);}_0x3442ed['order']=qs[_0x85db('0x37')](_0x1f818d[_0x85db('0x2f')]['sort']);_0x3442ed[_0x85db('0x38')]=qs[_0x85db('0x30')](_[_0x85db('0x39')](_0x1f818d[_0x85db('0x2f')],_0x1c697a[_0x85db('0x30')]),_0x201ccb);if(_0x1f818d['query']['filter']){_0x3442ed[_0x85db('0x38')]=_[_0x85db('0x3a')](_0x3442ed[_0x85db('0x38')],{'$or':_[_0x85db('0x2e')](_0x201ccb,function(_0x2ea513){if(_0x2ea513[_0x85db('0x2b')]!==_0x85db('0x3b')){var _0x5a9034={};_0x5a9034[_0x2ea513[_0x85db('0x25')]]={'$like':'%'+_0x1f818d['query'][_0x85db('0x3c')]+'%'};return _0x5a9034;}})});}_0x3442ed=_[_0x85db('0x3a')]({},_0x3442ed,_0x1f818d[_0x85db('0x3d')]);var _0x2ea931={'where':_0x3442ed[_0x85db('0x38')]};return db[_0x85db('0x28')][_0x85db('0x3e')](_0x2ea931)['then'](function(_0x4ea075){_0x474caf[_0x85db('0x3e')]=_0x4ea075;if(_0x1f818d['query'][_0x85db('0x3f')]){_0x3442ed['include']=[{'all':!![]}];}return db[_0x85db('0x28')][_0x85db('0x40')](_0x3442ed);})[_0x85db('0x21')](function(_0x182d3e){_0x474caf[_0x85db('0x41')]=_0x182d3e;return _0x474caf;})[_0x85db('0x21')](respondWithFilteredResult(_0x3f1bd6,_0x3442ed))['catch'](handleError(_0x3f1bd6,null));};exports[_0x85db('0x42')]=function(_0xc17963,_0x2e6b3e){var _0x1a4bf7={'raw':![],'where':{'id':_0xc17963['params']['id']}},_0xf62104={};_0xf62104['model']=_[_0x85db('0x43')](db[_0x85db('0x28')]['rawAttributes']);_0xf62104[_0x85db('0x2f')]=_[_0x85db('0x43')](_0xc17963['query']);_0xf62104[_0x85db('0x30')]=_['intersection'](_0xf62104[_0x85db('0x2d')],_0xf62104[_0x85db('0x2f')]);_0x1a4bf7['attributes']=_[_0x85db('0x31')](_0xf62104[_0x85db('0x2d')],qs[_0x85db('0x33')](_0xc17963[_0x85db('0x2f')][_0x85db('0x33')]));_0x1a4bf7[_0x85db('0x32')]=_0x1a4bf7['attributes']['length']?_0x1a4bf7[_0x85db('0x32')]:_0xf62104[_0x85db('0x2d')];if(_0xc17963[_0x85db('0x2f')]['includeAll']){_0x1a4bf7[_0x85db('0x44')]=[{'all':!![]}];}_0x1a4bf7=_[_0x85db('0x3a')]({},_0x1a4bf7,_0xc17963[_0x85db('0x3d')]);return db[_0x85db('0x28')][_0x85db('0x45')](_0x1a4bf7)[_0x85db('0x21')](handleEntityNotFound(_0x2e6b3e,null))[_0x85db('0x21')](respondWithResult(_0x2e6b3e,null))[_0x85db('0x46')](handleError(_0x2e6b3e,null));};exports[_0x85db('0x47')]=function(_0x5758ee,_0x1f5b70){return db[_0x85db('0x28')]['create'](_0x5758ee['body'],{})[_0x85db('0x21')](respondWithResult(_0x1f5b70,0xc9))[_0x85db('0x46')](handleError(_0x1f5b70,null));};exports['update']=function(_0x547023,_0x29f46a){if(_0x547023[_0x85db('0x48')]['id']){delete _0x547023['body']['id'];}return db[_0x85db('0x28')][_0x85db('0x45')]({'where':{'id':_0x547023[_0x85db('0x49')]['id']}})[_0x85db('0x21')](handleEntityNotFound(_0x29f46a,null))[_0x85db('0x21')](saveUpdates(_0x547023[_0x85db('0x48')],null))[_0x85db('0x21')](respondWithResult(_0x29f46a,null))['catch'](handleError(_0x29f46a,null));};exports[_0x85db('0x4a')]=function(_0x5cc8b2,_0x554739){return db[_0x85db('0x28')][_0x85db('0x45')]({'where':{'id':_0x5cc8b2[_0x85db('0x49')]['id']}})[_0x85db('0x21')](handleEntityNotFound(_0x554739,null))[_0x85db('0x21')](removeEntity(_0x554739,null))[_0x85db('0x46')](handleError(_0x554739,null));};exports[_0x85db('0x4b')]=function(_0x27a2a3,_0x2f4f89,_0x36b2d5){var _0x542ea1={};var _0x1831ff={};var _0x111a6a;var _0x2208eb;return db[_0x85db('0x28')][_0x85db('0x4c')]({'where':{'id':_0x27a2a3[_0x85db('0x49')]['id']}})[_0x85db('0x21')](handleEntityNotFound(_0x2f4f89,null))[_0x85db('0x21')](function(_0x5af653){if(_0x5af653){_0x111a6a=_0x5af653;_0x1831ff[_0x85db('0x2d')]=_['keys'](db[_0x85db('0x4d')][_0x85db('0x29')]);_0x1831ff[_0x85db('0x2f')]=_[_0x85db('0x43')](_0x27a2a3[_0x85db('0x2f')]);_0x1831ff['filters']=_[_0x85db('0x31')](_0x1831ff[_0x85db('0x2d')],_0x1831ff[_0x85db('0x2f')]);_0x542ea1['attributes']=_[_0x85db('0x31')](_0x1831ff[_0x85db('0x2d')],qs['fields'](_0x27a2a3['query'][_0x85db('0x33')]));_0x542ea1[_0x85db('0x32')]=_0x542ea1[_0x85db('0x32')][_0x85db('0x34')]?_0x542ea1[_0x85db('0x32')]:_0x1831ff[_0x85db('0x2d')];_0x542ea1[_0x85db('0x4e')]=qs['sort'](_0x27a2a3[_0x85db('0x2f')]['sort']);_0x542ea1['where']=qs[_0x85db('0x30')](_[_0x85db('0x39')](_0x27a2a3[_0x85db('0x2f')],_0x1831ff[_0x85db('0x30')]));if(_0x27a2a3[_0x85db('0x2f')]['filter']){_0x542ea1[_0x85db('0x38')]=_[_0x85db('0x3a')](_0x542ea1[_0x85db('0x38')],{'$or':_['map'](_0x542ea1[_0x85db('0x32')],function(_0x488a69){var _0x3b7ffd={};_0x3b7ffd[_0x488a69]={'$like':'%'+_0x27a2a3['query']['filter']+'%'};return _0x3b7ffd;})});}_0x542ea1=_[_0x85db('0x3a')]({},_0x542ea1,_0x27a2a3[_0x85db('0x3d')]);return _0x111a6a[_0x85db('0x4b')](_0x542ea1);}})[_0x85db('0x21')](function(_0x241260){if(_0x241260){_0x2208eb=_0x241260[_0x85db('0x34')];if(!_0x27a2a3[_0x85db('0x2f')][_0x85db('0x4f')]('nolimit')){_0x542ea1[_0x85db('0x36')]=qs[_0x85db('0x36')](_0x27a2a3[_0x85db('0x2f')][_0x85db('0x36')]);_0x542ea1[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x27a2a3[_0x85db('0x2f')]['offset']);}return _0x111a6a[_0x85db('0x4b')](_0x542ea1);}})[_0x85db('0x21')](function(_0x296b4f){if(_0x296b4f){return _0x296b4f?{'count':_0x2208eb,'rows':_0x296b4f}:null;}})['then'](respondWithResult(_0x2f4f89,null))[_0x85db('0x46')](handleError(_0x2f4f89,null));};exports[_0x85db('0x50')]=function(_0x4122e8,_0x10c1ec,_0x7b8434){var _0x582acd={};var _0x360482={};var _0x4b5005;var _0x41ca43;return db['ZendeskConfiguration'][_0x85db('0x4c')]({'where':{'id':_0x4122e8[_0x85db('0x49')]['id']}})[_0x85db('0x21')](handleEntityNotFound(_0x10c1ec,null))['then'](function(_0x1b591e){if(_0x1b591e){_0x4b5005=_0x1b591e;_0x360482['model']=_[_0x85db('0x43')](db[_0x85db('0x4d')][_0x85db('0x29')]);_0x360482[_0x85db('0x2f')]=_['keys'](_0x4122e8[_0x85db('0x2f')]);_0x360482[_0x85db('0x30')]=_['intersection'](_0x360482['model'],_0x360482[_0x85db('0x2f')]);_0x582acd[_0x85db('0x32')]=_[_0x85db('0x31')](_0x360482[_0x85db('0x2d')],qs[_0x85db('0x33')](_0x4122e8[_0x85db('0x2f')][_0x85db('0x33')]));_0x582acd[_0x85db('0x32')]=_0x582acd[_0x85db('0x32')]['length']?_0x582acd[_0x85db('0x32')]:_0x360482[_0x85db('0x2d')];_0x582acd[_0x85db('0x4e')]=qs[_0x85db('0x37')](_0x4122e8[_0x85db('0x2f')]['sort']);_0x582acd[_0x85db('0x38')]=qs[_0x85db('0x30')](_[_0x85db('0x39')](_0x4122e8[_0x85db('0x2f')],_0x360482['filters']));if(_0x4122e8[_0x85db('0x2f')]['filter']){_0x582acd[_0x85db('0x38')]=_['merge'](_0x582acd[_0x85db('0x38')],{'$or':_[_0x85db('0x2e')](_0x582acd['attributes'],function(_0x11d6e1){var _0x2266eb={};_0x2266eb[_0x11d6e1]={'$like':'%'+_0x4122e8['query'][_0x85db('0x3c')]+'%'};return _0x2266eb;})});}_0x582acd=_[_0x85db('0x3a')]({},_0x582acd,_0x4122e8[_0x85db('0x3d')]);return _0x4b5005[_0x85db('0x50')](_0x582acd);}})[_0x85db('0x21')](function(_0x50666d){if(_0x50666d){_0x41ca43=_0x50666d[_0x85db('0x34')];if(!_0x4122e8[_0x85db('0x2f')]['hasOwnProperty']('nolimit')){_0x582acd['limit']=qs[_0x85db('0x36')](_0x4122e8[_0x85db('0x2f')]['limit']);_0x582acd[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x4122e8[_0x85db('0x2f')]['offset']);}return _0x4b5005[_0x85db('0x50')](_0x582acd);}})['then'](function(_0x254d7c){if(_0x254d7c){return _0x254d7c?{'count':_0x41ca43,'rows':_0x254d7c}:null;}})[_0x85db('0x21')](respondWithResult(_0x10c1ec,null))[_0x85db('0x46')](handleError(_0x10c1ec,null));};exports[_0x85db('0x51')]=function(_0x4b5a7b,_0x39a407,_0x1b92dd){var _0x4f545a={};var _0x490663={};var _0x19338f;var _0x3c96c0;return db[_0x85db('0x28')][_0x85db('0x4c')]({'where':{'id':_0x4b5a7b[_0x85db('0x49')]['id']}})['then'](handleEntityNotFound(_0x39a407,null))['then'](function(_0x4120c9){if(_0x4120c9){_0x19338f=_0x4120c9;_0x490663[_0x85db('0x2d')]=_[_0x85db('0x43')](db[_0x85db('0x4d')]['rawAttributes']);_0x490663[_0x85db('0x2f')]=_['keys'](_0x4b5a7b[_0x85db('0x2f')]);_0x490663['filters']=_[_0x85db('0x31')](_0x490663[_0x85db('0x2d')],_0x490663[_0x85db('0x2f')]);_0x4f545a[_0x85db('0x32')]=_[_0x85db('0x31')](_0x490663[_0x85db('0x2d')],qs['fields'](_0x4b5a7b[_0x85db('0x2f')]['fields']));_0x4f545a[_0x85db('0x32')]=_0x4f545a[_0x85db('0x32')][_0x85db('0x34')]?_0x4f545a[_0x85db('0x32')]:_0x490663[_0x85db('0x2d')];_0x4f545a[_0x85db('0x4e')]=qs[_0x85db('0x37')](_0x4b5a7b['query']['sort']);_0x4f545a[_0x85db('0x38')]=qs[_0x85db('0x30')](_[_0x85db('0x39')](_0x4b5a7b[_0x85db('0x2f')],_0x490663[_0x85db('0x30')]));if(_0x4b5a7b[_0x85db('0x2f')][_0x85db('0x3c')]){_0x4f545a[_0x85db('0x38')]=_[_0x85db('0x3a')](_0x4f545a[_0x85db('0x38')],{'$or':_[_0x85db('0x2e')](_0x4f545a['attributes'],function(_0x5ac8f9){var _0x4c5f87={};_0x4c5f87[_0x5ac8f9]={'$like':'%'+_0x4b5a7b[_0x85db('0x2f')][_0x85db('0x3c')]+'%'};return _0x4c5f87;})});}_0x4f545a=_[_0x85db('0x3a')]({},_0x4f545a,_0x4b5a7b['options']);return _0x19338f['getDescriptions'](_0x4f545a);}})['then'](function(_0x576774){if(_0x576774){_0x3c96c0=_0x576774[_0x85db('0x34')];if(!_0x4b5a7b[_0x85db('0x2f')]['hasOwnProperty']('nolimit')){_0x4f545a[_0x85db('0x36')]=qs[_0x85db('0x36')](_0x4b5a7b[_0x85db('0x2f')][_0x85db('0x36')]);_0x4f545a['offset']=qs['offset'](_0x4b5a7b[_0x85db('0x2f')][_0x85db('0x1a')]);}return _0x19338f['getDescriptions'](_0x4f545a);}})[_0x85db('0x21')](function(_0x18b7f3){if(_0x18b7f3){return _0x18b7f3?{'count':_0x3c96c0,'rows':_0x18b7f3}:null;}})[_0x85db('0x21')](respondWithResult(_0x39a407,null))[_0x85db('0x46')](handleError(_0x39a407,null));};exports[_0x85db('0x52')]=function(_0x3b66b4,_0x2d4202,_0x397a90){var _0x517d25={};var _0x14114c={};var _0x121968;var _0x2e2a06;return db[_0x85db('0x28')][_0x85db('0x4c')]({'where':{'id':_0x3b66b4[_0x85db('0x49')]['id']}})[_0x85db('0x21')](handleEntityNotFound(_0x2d4202,null))[_0x85db('0x21')](function(_0x2168df){if(_0x2168df){_0x121968=_0x2168df;_0x14114c['model']=_[_0x85db('0x43')](db[_0x85db('0x53')][_0x85db('0x29')]);_0x14114c[_0x85db('0x2f')]=_[_0x85db('0x43')](_0x3b66b4[_0x85db('0x2f')]);_0x14114c[_0x85db('0x30')]=_['intersection'](_0x14114c[_0x85db('0x2d')],_0x14114c['query']);_0x517d25['attributes']=_[_0x85db('0x31')](_0x14114c[_0x85db('0x2d')],qs['fields'](_0x3b66b4['query'][_0x85db('0x33')]));_0x517d25[_0x85db('0x32')]=_0x517d25['attributes'][_0x85db('0x34')]?_0x517d25['attributes']:_0x14114c[_0x85db('0x2d')];_0x517d25[_0x85db('0x4e')]=qs[_0x85db('0x37')](_0x3b66b4[_0x85db('0x2f')]['sort']);_0x517d25[_0x85db('0x38')]=qs['filters'](_[_0x85db('0x39')](_0x3b66b4[_0x85db('0x2f')],_0x14114c[_0x85db('0x30')]));if(_0x3b66b4[_0x85db('0x2f')]['filter']){_0x517d25[_0x85db('0x38')]=_['merge'](_0x517d25[_0x85db('0x38')],{'$or':_[_0x85db('0x2e')](_0x517d25[_0x85db('0x32')],function(_0x4dfffd){var _0x192574={};_0x192574[_0x4dfffd]={'$like':'%'+_0x3b66b4[_0x85db('0x2f')][_0x85db('0x3c')]+'%'};return _0x192574;})});}_0x517d25=_['merge']({},_0x517d25,_0x3b66b4[_0x85db('0x3d')]);return _0x121968['getTags'](_0x517d25);}})[_0x85db('0x21')](function(_0x42d162){if(_0x42d162){_0x2e2a06=_0x42d162['length'];if(!_0x3b66b4[_0x85db('0x2f')][_0x85db('0x4f')](_0x85db('0x35'))){_0x517d25[_0x85db('0x36')]=qs[_0x85db('0x36')](_0x3b66b4[_0x85db('0x2f')][_0x85db('0x36')]);_0x517d25[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x3b66b4[_0x85db('0x2f')][_0x85db('0x1a')]);}return _0x121968[_0x85db('0x52')](_0x517d25);}})[_0x85db('0x21')](function(_0x41e04f){if(_0x41e04f){return _0x41e04f?{'count':_0x2e2a06,'rows':_0x41e04f}:null;}})[_0x85db('0x21')](respondWithResult(_0x2d4202,null))[_0x85db('0x46')](handleError(_0x2d4202,null));};exports[_0x85db('0x54')]=function(_0x4dd1c1,_0x519cf4,_0x5c8473){if(_0x4dd1c1[_0x85db('0x48')]['id']){delete _0x4dd1c1[_0x85db('0x48')]['id'];}return db[_0x85db('0x28')][_0x85db('0x4c')]({'where':{'id':_0x4dd1c1['params']['id']}})['then'](handleEntityNotFound(_0x519cf4,null))[_0x85db('0x21')](function(_0x468677){if(_0x468677){return _0x468677[_0x85db('0x54')](_0x4dd1c1['body']['ids']||[]);}return null;})[_0x85db('0x21')](respondWithResult(_0x519cf4,null))[_0x85db('0x46')](handleError(_0x519cf4,null));}; \ No newline at end of file +var _0x9fd2=['destroy','then','sendStatus','stack','name','send','index','ZendeskConfiguration','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','body','update','getFields','findOne','getSubjects','getDescriptions','ZendeskField','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x1cfb3d,_0x362c36){var _0x30f313=function(_0x3d2c17){while(--_0x3d2c17){_0x1cfb3d['push'](_0x1cfb3d['shift']());}};_0x30f313(++_0x362c36);}(_0x9fd2,0x1c8));var _0x29fd=function(_0x3328d8,_0x4cb87f){_0x3328d8=_0x3328d8-0x0;var _0x8175fe=_0x9fd2[_0x3328d8];return _0x8175fe;};'use strict';var emlformat=require(_0x29fd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29fd('0x1'));var rp=require(_0x29fd('0x2'));var moment=require('moment');var BPromise=require(_0x29fd('0x3'));var Mustache=require(_0x29fd('0x4'));var util=require(_0x29fd('0x5'));var path=require('path');var sox=require(_0x29fd('0x6'));var csv=require(_0x29fd('0x7'));var ejs=require(_0x29fd('0x8'));var fs=require('fs');var fs_extra=require(_0x29fd('0x9'));var _=require(_0x29fd('0xa'));var squel=require(_0x29fd('0xb'));var crypto=require(_0x29fd('0xc'));var jsforce=require(_0x29fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x29fd('0xe'));var Papa=require('papaparse');var Redis=require(_0x29fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x29fd('0x10'));var as=require(_0x29fd('0x11'));var hardwareService=require(_0x29fd('0x12'));var logger=require(_0x29fd('0x13'))(_0x29fd('0x14'));var utils=require(_0x29fd('0x15'));var config=require(_0x29fd('0x16'));var licenseUtil=require(_0x29fd('0x17'));var db=require(_0x29fd('0x18'))['db'];function respondWithStatusCode(_0x487f02,_0x5cc75d){_0x5cc75d=_0x5cc75d||0xcc;return function(_0xd44824){if(_0xd44824){return _0x487f02['sendStatus'](_0x5cc75d);}return _0x487f02[_0x29fd('0x19')](_0x5cc75d)[_0x29fd('0x1a')]();};}function respondWithResult(_0x5ee76f,_0x5b7be8){_0x5b7be8=_0x5b7be8||0xc8;return function(_0x45084b){if(_0x45084b){return _0x5ee76f[_0x29fd('0x19')](_0x5b7be8)[_0x29fd('0x1b')](_0x45084b);}};}function respondWithFilteredResult(_0x57763b,_0x36d347){return function(_0x23e589){if(_0x23e589){var _0x233826=typeof _0x36d347[_0x29fd('0x1c')]===_0x29fd('0x1d')&&typeof _0x36d347['limit']===_0x29fd('0x1d');var _0x5ce5d4=_0x23e589[_0x29fd('0x1e')];var _0x4cb1a0=_0x233826?0x0:_0x36d347[_0x29fd('0x1c')];var _0x345def=_0x233826?_0x23e589[_0x29fd('0x1e')]:_0x36d347[_0x29fd('0x1c')]+_0x36d347[_0x29fd('0x1f')];var _0x54ec40;if(_0x345def>=_0x5ce5d4){_0x345def=_0x5ce5d4;_0x54ec40=0xc8;}else{_0x54ec40=0xce;}_0x57763b[_0x29fd('0x19')](_0x54ec40);return _0x57763b['set'](_0x29fd('0x20'),_0x4cb1a0+'-'+_0x345def+'/'+_0x5ce5d4)[_0x29fd('0x1b')](_0x23e589);}return null;};}function patchUpdates(_0x52ae60){return function(_0x41d147){try{jsonpatch[_0x29fd('0x21')](_0x41d147,_0x52ae60,!![]);}catch(_0x21458f){return BPromise[_0x29fd('0x22')](_0x21458f);}return _0x41d147[_0x29fd('0x23')]();};}function saveUpdates(_0x482dea,_0x1381e0){return function(_0x338ef0){if(_0x338ef0){return _0x338ef0['update'](_0x482dea)['then'](function(_0x4a0e92){return _0x4a0e92;});}return null;};}function removeEntity(_0x27c1e5,_0x487c24){return function(_0x42d6bf){if(_0x42d6bf){return _0x42d6bf[_0x29fd('0x24')]()[_0x29fd('0x25')](function(){_0x27c1e5['status'](0xcc)[_0x29fd('0x1a')]();});}};}function handleEntityNotFound(_0x48b18a,_0x7cb060){return function(_0x3d3540){if(!_0x3d3540){_0x48b18a[_0x29fd('0x26')](0x194);}return _0x3d3540;};}function handleError(_0x453461,_0x43667b){_0x43667b=_0x43667b||0x1f4;return function(_0xbbc34a){logger['error'](_0xbbc34a[_0x29fd('0x27')]);if(_0xbbc34a[_0x29fd('0x28')]){delete _0xbbc34a['name'];}_0x453461[_0x29fd('0x19')](_0x43667b)[_0x29fd('0x29')](_0xbbc34a);};}exports[_0x29fd('0x2a')]=function(_0x4cc172,_0x4b8858){var _0xbb123c={},_0x5f4ddd={},_0x22efb9={'count':0x0,'rows':[]};var _0x4a23b5=_['map'](db[_0x29fd('0x2b')][_0x29fd('0x2c')],function(_0x5b6311){return{'name':_0x5b6311['fieldName'],'type':_0x5b6311[_0x29fd('0x2d')]['key']};});_0x5f4ddd[_0x29fd('0x2e')]=_[_0x29fd('0x2f')](_0x4a23b5,_0x29fd('0x28'));_0x5f4ddd['query']=_[_0x29fd('0x30')](_0x4cc172[_0x29fd('0x31')]);_0x5f4ddd[_0x29fd('0x32')]=_[_0x29fd('0x33')](_0x5f4ddd[_0x29fd('0x2e')],_0x5f4ddd[_0x29fd('0x31')]);_0xbb123c[_0x29fd('0x34')]=_['intersection'](_0x5f4ddd[_0x29fd('0x2e')],qs[_0x29fd('0x35')](_0x4cc172['query'][_0x29fd('0x35')]));_0xbb123c[_0x29fd('0x34')]=_0xbb123c[_0x29fd('0x34')][_0x29fd('0x36')]?_0xbb123c[_0x29fd('0x34')]:_0x5f4ddd[_0x29fd('0x2e')];if(!_0x4cc172[_0x29fd('0x31')][_0x29fd('0x37')](_0x29fd('0x38'))){_0xbb123c[_0x29fd('0x1f')]=qs['limit'](_0x4cc172[_0x29fd('0x31')]['limit']);_0xbb123c[_0x29fd('0x1c')]=qs[_0x29fd('0x1c')](_0x4cc172[_0x29fd('0x31')][_0x29fd('0x1c')]);}_0xbb123c[_0x29fd('0x39')]=qs[_0x29fd('0x3a')](_0x4cc172[_0x29fd('0x31')][_0x29fd('0x3a')]);_0xbb123c['where']=qs[_0x29fd('0x32')](_[_0x29fd('0x3b')](_0x4cc172[_0x29fd('0x31')],_0x5f4ddd[_0x29fd('0x32')]),_0x4a23b5);if(_0x4cc172[_0x29fd('0x31')][_0x29fd('0x3c')]){_0xbb123c[_0x29fd('0x3d')]=_[_0x29fd('0x3e')](_0xbb123c[_0x29fd('0x3d')],{'$or':_[_0x29fd('0x2f')](_0x4a23b5,function(_0x4863b4){if(_0x4863b4['type']!==_0x29fd('0x3f')){var _0xd1a22a={};_0xd1a22a[_0x4863b4[_0x29fd('0x28')]]={'$like':'%'+_0x4cc172[_0x29fd('0x31')][_0x29fd('0x3c')]+'%'};return _0xd1a22a;}})});}_0xbb123c=_[_0x29fd('0x3e')]({},_0xbb123c,_0x4cc172[_0x29fd('0x40')]);var _0x5a87d1={'where':_0xbb123c[_0x29fd('0x3d')]};return db[_0x29fd('0x2b')][_0x29fd('0x1e')](_0x5a87d1)[_0x29fd('0x25')](function(_0x5a5b3b){_0x22efb9[_0x29fd('0x1e')]=_0x5a5b3b;if(_0x4cc172[_0x29fd('0x31')][_0x29fd('0x41')]){_0xbb123c['include']=[{'all':!![]}];}return db[_0x29fd('0x2b')]['findAll'](_0xbb123c);})[_0x29fd('0x25')](function(_0x52d56e){_0x22efb9[_0x29fd('0x42')]=_0x52d56e;return _0x22efb9;})[_0x29fd('0x25')](respondWithFilteredResult(_0x4b8858,_0xbb123c))[_0x29fd('0x43')](handleError(_0x4b8858,null));};exports['show']=function(_0x513291,_0x51fdc4){var _0x18eb83={'raw':![],'where':{'id':_0x513291[_0x29fd('0x44')]['id']}},_0x1e953b={};_0x1e953b['model']=_['keys'](db[_0x29fd('0x2b')]['rawAttributes']);_0x1e953b[_0x29fd('0x31')]=_[_0x29fd('0x30')](_0x513291[_0x29fd('0x31')]);_0x1e953b[_0x29fd('0x32')]=_['intersection'](_0x1e953b[_0x29fd('0x2e')],_0x1e953b[_0x29fd('0x31')]);_0x18eb83['attributes']=_[_0x29fd('0x33')](_0x1e953b['model'],qs['fields'](_0x513291['query'][_0x29fd('0x35')]));_0x18eb83['attributes']=_0x18eb83[_0x29fd('0x34')][_0x29fd('0x36')]?_0x18eb83[_0x29fd('0x34')]:_0x1e953b[_0x29fd('0x2e')];if(_0x513291[_0x29fd('0x31')][_0x29fd('0x41')]){_0x18eb83[_0x29fd('0x45')]=[{'all':!![]}];}_0x18eb83=_[_0x29fd('0x3e')]({},_0x18eb83,_0x513291['options']);return db[_0x29fd('0x2b')][_0x29fd('0x46')](_0x18eb83)['then'](handleEntityNotFound(_0x51fdc4,null))['then'](respondWithResult(_0x51fdc4,null))[_0x29fd('0x43')](handleError(_0x51fdc4,null));};exports['create']=function(_0x594136,_0x2d6353){return db['ZendeskConfiguration']['create'](_0x594136[_0x29fd('0x47')],{})['then'](respondWithResult(_0x2d6353,0xc9))[_0x29fd('0x43')](handleError(_0x2d6353,null));};exports[_0x29fd('0x48')]=function(_0x4d8671,_0x453ec5){if(_0x4d8671[_0x29fd('0x47')]['id']){delete _0x4d8671[_0x29fd('0x47')]['id'];}return db[_0x29fd('0x2b')]['find']({'where':{'id':_0x4d8671[_0x29fd('0x44')]['id']}})[_0x29fd('0x25')](handleEntityNotFound(_0x453ec5,null))[_0x29fd('0x25')](saveUpdates(_0x4d8671[_0x29fd('0x47')],null))[_0x29fd('0x25')](respondWithResult(_0x453ec5,null))['catch'](handleError(_0x453ec5,null));};exports['destroy']=function(_0x1966cc,_0xba48e5){return db[_0x29fd('0x2b')][_0x29fd('0x46')]({'where':{'id':_0x1966cc[_0x29fd('0x44')]['id']}})[_0x29fd('0x25')](handleEntityNotFound(_0xba48e5,null))[_0x29fd('0x25')](removeEntity(_0xba48e5,null))[_0x29fd('0x43')](handleError(_0xba48e5,null));};exports[_0x29fd('0x49')]=function(_0x54a161,_0x21a6ce,_0x56e511){var _0x586bb4={};var _0x25b4a9={};var _0x2fcc2a;var _0x5d1de4;return db[_0x29fd('0x2b')][_0x29fd('0x4a')]({'where':{'id':_0x54a161['params']['id']}})[_0x29fd('0x25')](handleEntityNotFound(_0x21a6ce,null))[_0x29fd('0x25')](function(_0x237ffb){if(_0x237ffb){_0x2fcc2a=_0x237ffb;_0x25b4a9['model']=_[_0x29fd('0x30')](db['ZendeskField'][_0x29fd('0x2c')]);_0x25b4a9[_0x29fd('0x31')]=_['keys'](_0x54a161[_0x29fd('0x31')]);_0x25b4a9['filters']=_[_0x29fd('0x33')](_0x25b4a9[_0x29fd('0x2e')],_0x25b4a9[_0x29fd('0x31')]);_0x586bb4[_0x29fd('0x34')]=_[_0x29fd('0x33')](_0x25b4a9['model'],qs[_0x29fd('0x35')](_0x54a161[_0x29fd('0x31')][_0x29fd('0x35')]));_0x586bb4[_0x29fd('0x34')]=_0x586bb4['attributes']['length']?_0x586bb4[_0x29fd('0x34')]:_0x25b4a9[_0x29fd('0x2e')];_0x586bb4[_0x29fd('0x39')]=qs[_0x29fd('0x3a')](_0x54a161['query']['sort']);_0x586bb4[_0x29fd('0x3d')]=qs[_0x29fd('0x32')](_['pick'](_0x54a161[_0x29fd('0x31')],_0x25b4a9[_0x29fd('0x32')]));if(_0x54a161['query']['filter']){_0x586bb4[_0x29fd('0x3d')]=_[_0x29fd('0x3e')](_0x586bb4[_0x29fd('0x3d')],{'$or':_['map'](_0x586bb4[_0x29fd('0x34')],function(_0x3eacf8){var _0x517cc6={};_0x517cc6[_0x3eacf8]={'$like':'%'+_0x54a161[_0x29fd('0x31')][_0x29fd('0x3c')]+'%'};return _0x517cc6;})});}_0x586bb4=_[_0x29fd('0x3e')]({},_0x586bb4,_0x54a161['options']);return _0x2fcc2a[_0x29fd('0x49')](_0x586bb4);}})[_0x29fd('0x25')](function(_0x3d932d){if(_0x3d932d){_0x5d1de4=_0x3d932d[_0x29fd('0x36')];if(!_0x54a161[_0x29fd('0x31')][_0x29fd('0x37')](_0x29fd('0x38'))){_0x586bb4[_0x29fd('0x1f')]=qs['limit'](_0x54a161['query']['limit']);_0x586bb4[_0x29fd('0x1c')]=qs[_0x29fd('0x1c')](_0x54a161[_0x29fd('0x31')][_0x29fd('0x1c')]);}return _0x2fcc2a[_0x29fd('0x49')](_0x586bb4);}})[_0x29fd('0x25')](function(_0x46857b){if(_0x46857b){return _0x46857b?{'count':_0x5d1de4,'rows':_0x46857b}:null;}})[_0x29fd('0x25')](respondWithResult(_0x21a6ce,null))[_0x29fd('0x43')](handleError(_0x21a6ce,null));};exports[_0x29fd('0x4b')]=function(_0x579fc8,_0x2b314a,_0x5691ee){var _0x2dc8ca={};var _0x4180cc={};var _0x335eaf;var _0x2ac293;return db[_0x29fd('0x2b')][_0x29fd('0x4a')]({'where':{'id':_0x579fc8['params']['id']}})[_0x29fd('0x25')](handleEntityNotFound(_0x2b314a,null))['then'](function(_0x48b278){if(_0x48b278){_0x335eaf=_0x48b278;_0x4180cc[_0x29fd('0x2e')]=_['keys'](db['ZendeskField'][_0x29fd('0x2c')]);_0x4180cc['query']=_[_0x29fd('0x30')](_0x579fc8['query']);_0x4180cc[_0x29fd('0x32')]=_[_0x29fd('0x33')](_0x4180cc[_0x29fd('0x2e')],_0x4180cc[_0x29fd('0x31')]);_0x2dc8ca['attributes']=_[_0x29fd('0x33')](_0x4180cc['model'],qs[_0x29fd('0x35')](_0x579fc8[_0x29fd('0x31')][_0x29fd('0x35')]));_0x2dc8ca[_0x29fd('0x34')]=_0x2dc8ca[_0x29fd('0x34')][_0x29fd('0x36')]?_0x2dc8ca['attributes']:_0x4180cc[_0x29fd('0x2e')];_0x2dc8ca[_0x29fd('0x39')]=qs[_0x29fd('0x3a')](_0x579fc8['query'][_0x29fd('0x3a')]);_0x2dc8ca[_0x29fd('0x3d')]=qs[_0x29fd('0x32')](_[_0x29fd('0x3b')](_0x579fc8[_0x29fd('0x31')],_0x4180cc['filters']));if(_0x579fc8[_0x29fd('0x31')][_0x29fd('0x3c')]){_0x2dc8ca['where']=_['merge'](_0x2dc8ca['where'],{'$or':_[_0x29fd('0x2f')](_0x2dc8ca[_0x29fd('0x34')],function(_0x26aaed){var _0x3c0300={};_0x3c0300[_0x26aaed]={'$like':'%'+_0x579fc8['query']['filter']+'%'};return _0x3c0300;})});}_0x2dc8ca=_[_0x29fd('0x3e')]({},_0x2dc8ca,_0x579fc8[_0x29fd('0x40')]);return _0x335eaf[_0x29fd('0x4b')](_0x2dc8ca);}})['then'](function(_0x2673fa){if(_0x2673fa){_0x2ac293=_0x2673fa[_0x29fd('0x36')];if(!_0x579fc8[_0x29fd('0x31')][_0x29fd('0x37')](_0x29fd('0x38'))){_0x2dc8ca[_0x29fd('0x1f')]=qs['limit'](_0x579fc8[_0x29fd('0x31')][_0x29fd('0x1f')]);_0x2dc8ca['offset']=qs[_0x29fd('0x1c')](_0x579fc8[_0x29fd('0x31')][_0x29fd('0x1c')]);}return _0x335eaf[_0x29fd('0x4b')](_0x2dc8ca);}})[_0x29fd('0x25')](function(_0x1d4803){if(_0x1d4803){return _0x1d4803?{'count':_0x2ac293,'rows':_0x1d4803}:null;}})[_0x29fd('0x25')](respondWithResult(_0x2b314a,null))['catch'](handleError(_0x2b314a,null));};exports[_0x29fd('0x4c')]=function(_0x36fbd4,_0x2c5dcc,_0x4aa19c){var _0x449a86={};var _0xe967be={};var _0x2d3fa6;var _0x1dacb6;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x36fbd4[_0x29fd('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c5dcc,null))[_0x29fd('0x25')](function(_0xf374da){if(_0xf374da){_0x2d3fa6=_0xf374da;_0xe967be[_0x29fd('0x2e')]=_[_0x29fd('0x30')](db[_0x29fd('0x4d')][_0x29fd('0x2c')]);_0xe967be['query']=_['keys'](_0x36fbd4[_0x29fd('0x31')]);_0xe967be[_0x29fd('0x32')]=_[_0x29fd('0x33')](_0xe967be[_0x29fd('0x2e')],_0xe967be[_0x29fd('0x31')]);_0x449a86[_0x29fd('0x34')]=_['intersection'](_0xe967be['model'],qs[_0x29fd('0x35')](_0x36fbd4[_0x29fd('0x31')]['fields']));_0x449a86[_0x29fd('0x34')]=_0x449a86['attributes'][_0x29fd('0x36')]?_0x449a86[_0x29fd('0x34')]:_0xe967be['model'];_0x449a86[_0x29fd('0x39')]=qs['sort'](_0x36fbd4['query'][_0x29fd('0x3a')]);_0x449a86[_0x29fd('0x3d')]=qs[_0x29fd('0x32')](_[_0x29fd('0x3b')](_0x36fbd4['query'],_0xe967be['filters']));if(_0x36fbd4[_0x29fd('0x31')][_0x29fd('0x3c')]){_0x449a86[_0x29fd('0x3d')]=_[_0x29fd('0x3e')](_0x449a86['where'],{'$or':_[_0x29fd('0x2f')](_0x449a86[_0x29fd('0x34')],function(_0x27f948){var _0x24b425={};_0x24b425[_0x27f948]={'$like':'%'+_0x36fbd4['query'][_0x29fd('0x3c')]+'%'};return _0x24b425;})});}_0x449a86=_[_0x29fd('0x3e')]({},_0x449a86,_0x36fbd4[_0x29fd('0x40')]);return _0x2d3fa6[_0x29fd('0x4c')](_0x449a86);}})[_0x29fd('0x25')](function(_0x43c64){if(_0x43c64){_0x1dacb6=_0x43c64['length'];if(!_0x36fbd4[_0x29fd('0x31')][_0x29fd('0x37')](_0x29fd('0x38'))){_0x449a86[_0x29fd('0x1f')]=qs[_0x29fd('0x1f')](_0x36fbd4['query'][_0x29fd('0x1f')]);_0x449a86['offset']=qs[_0x29fd('0x1c')](_0x36fbd4[_0x29fd('0x31')][_0x29fd('0x1c')]);}return _0x2d3fa6[_0x29fd('0x4c')](_0x449a86);}})[_0x29fd('0x25')](function(_0x329e0a){if(_0x329e0a){return _0x329e0a?{'count':_0x1dacb6,'rows':_0x329e0a}:null;}})['then'](respondWithResult(_0x2c5dcc,null))[_0x29fd('0x43')](handleError(_0x2c5dcc,null));};exports['getTags']=function(_0x2c6115,_0x410cea,_0x13479b){var _0xfed1b7={};var _0x2b8454={};var _0x11451d;var _0x1a14e5;return db[_0x29fd('0x2b')][_0x29fd('0x4a')]({'where':{'id':_0x2c6115[_0x29fd('0x44')]['id']}})[_0x29fd('0x25')](handleEntityNotFound(_0x410cea,null))[_0x29fd('0x25')](function(_0x375421){if(_0x375421){_0x11451d=_0x375421;_0x2b8454[_0x29fd('0x2e')]=_[_0x29fd('0x30')](db[_0x29fd('0x4e')]['rawAttributes']);_0x2b8454[_0x29fd('0x31')]=_[_0x29fd('0x30')](_0x2c6115[_0x29fd('0x31')]);_0x2b8454['filters']=_['intersection'](_0x2b8454['model'],_0x2b8454['query']);_0xfed1b7['attributes']=_[_0x29fd('0x33')](_0x2b8454[_0x29fd('0x2e')],qs[_0x29fd('0x35')](_0x2c6115[_0x29fd('0x31')]['fields']));_0xfed1b7['attributes']=_0xfed1b7[_0x29fd('0x34')][_0x29fd('0x36')]?_0xfed1b7[_0x29fd('0x34')]:_0x2b8454[_0x29fd('0x2e')];_0xfed1b7['order']=qs[_0x29fd('0x3a')](_0x2c6115[_0x29fd('0x31')][_0x29fd('0x3a')]);_0xfed1b7[_0x29fd('0x3d')]=qs[_0x29fd('0x32')](_[_0x29fd('0x3b')](_0x2c6115[_0x29fd('0x31')],_0x2b8454[_0x29fd('0x32')]));if(_0x2c6115[_0x29fd('0x31')][_0x29fd('0x3c')]){_0xfed1b7[_0x29fd('0x3d')]=_[_0x29fd('0x3e')](_0xfed1b7[_0x29fd('0x3d')],{'$or':_['map'](_0xfed1b7['attributes'],function(_0x3ce64b){var _0x6d0ac4={};_0x6d0ac4[_0x3ce64b]={'$like':'%'+_0x2c6115[_0x29fd('0x31')][_0x29fd('0x3c')]+'%'};return _0x6d0ac4;})});}_0xfed1b7=_['merge']({},_0xfed1b7,_0x2c6115[_0x29fd('0x40')]);return _0x11451d['getTags'](_0xfed1b7);}})[_0x29fd('0x25')](function(_0x40f008){if(_0x40f008){_0x1a14e5=_0x40f008[_0x29fd('0x36')];if(!_0x2c6115['query'][_0x29fd('0x37')](_0x29fd('0x38'))){_0xfed1b7[_0x29fd('0x1f')]=qs[_0x29fd('0x1f')](_0x2c6115[_0x29fd('0x31')][_0x29fd('0x1f')]);_0xfed1b7[_0x29fd('0x1c')]=qs[_0x29fd('0x1c')](_0x2c6115[_0x29fd('0x31')][_0x29fd('0x1c')]);}return _0x11451d[_0x29fd('0x4f')](_0xfed1b7);}})['then'](function(_0x57cb0c){if(_0x57cb0c){return _0x57cb0c?{'count':_0x1a14e5,'rows':_0x57cb0c}:null;}})['then'](respondWithResult(_0x410cea,null))[_0x29fd('0x43')](handleError(_0x410cea,null));};exports[_0x29fd('0x50')]=function(_0xc91b0e,_0x51a452,_0x31f042){if(_0xc91b0e[_0x29fd('0x47')]['id']){delete _0xc91b0e[_0x29fd('0x47')]['id'];}return db[_0x29fd('0x2b')]['findOne']({'where':{'id':_0xc91b0e[_0x29fd('0x44')]['id']}})[_0x29fd('0x25')](handleEntityNotFound(_0x51a452,null))[_0x29fd('0x25')](function(_0x199460){if(_0x199460){return _0x199460[_0x29fd('0x50')](_0xc91b0e['body'][_0x29fd('0x51')]||[]);}return null;})[_0x29fd('0x25')](respondWithResult(_0x51a452,null))[_0x29fd('0x43')](handleError(_0x51a452,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 60d3083..1b0263b 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 _0xab40=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xab40,0xcd));var _0x0ab4=function(_0x10e214,_0x11bb76){_0x10e214=_0x10e214-0x0;var _0x5ad0cc=_0xab40[_0x10e214];return _0x5ad0cc;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0xb279b7,_0x1b909b){var _0x2e8738=function(_0x3dd93a){while(--_0x3dd93a){_0xb279b7['push'](_0xb279b7['shift']());}};_0x2e8738(++_0x1b909b);}(_0x8603,0x190));var _0x3860=function(_0x3cd2c6,_0x33890a){_0x3cd2c6=_0x3cd2c6-0x0;var _0x407bdb=_0x8603[_0x3cd2c6];return _0x407bdb;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 7603a00..5f75083 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 _0x67db=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x67db,0x8c));var _0xb67d=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x67db[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0xb67d('0x0'));var moment=require(_0xb67d('0x1'));var BPromise=require('bluebird');var rs=require(_0xb67d('0x2'));var fs=require('fs');var Redis=require(_0xb67d('0x3'));var db=require(_0xb67d('0x4'))['db'];var utils=require(_0xb67d('0x5'));var logger=require('../../config/logger')(_0xb67d('0x6'));var config=require(_0xb67d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb67d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4901f7,_0x50bef1,_0x13d8db){return new BPromise(function(_0x312ef8,_0x4067bd){return client[_0xb67d('0x9')](_0x4901f7,_0x13d8db)['then'](function(_0x4dbe39){logger[_0xb67d('0xa')](_0xb67d('0xb'),_0x50bef1,'request\x20sent');logger[_0xb67d('0xc')](_0xb67d('0xd'),_0x50bef1,_0xb67d('0xe'),JSON['stringify'](_0x4dbe39));if(_0x4dbe39['error']){if(_0x4dbe39[_0xb67d('0xf')][_0xb67d('0x10')]===0x1f4){logger[_0xb67d('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50bef1,_0x4dbe39[_0xb67d('0xf')][_0xb67d('0x11')]);return _0x4067bd(_0x4dbe39[_0xb67d('0xf')]['message']);}logger[_0xb67d('0xf')](_0xb67d('0xb'),_0x50bef1,_0x4dbe39['error'][_0xb67d('0x11')]);return _0x312ef8(_0x4dbe39['error']['message']);}else{logger['info'](_0xb67d('0xb'),_0x50bef1,_0xb67d('0xe'));_0x312ef8(_0x4dbe39[_0xb67d('0x12')][_0xb67d('0x11')]);}})[_0xb67d('0x13')](function(_0x4f12c1){logger[_0xb67d('0xf')](_0xb67d('0xb'),_0x50bef1,_0x4f12c1);_0x4067bd(_0x4f12c1);});});} \ No newline at end of file +var _0x1594=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0x1594,0xdb));var _0x4159=function(_0x3635c5,_0x54c942){_0x3635c5=_0x3635c5-0x0;var _0x5aa4ee=_0x1594[_0x3635c5];return _0x5aa4ee;};'use strict';var _=require(_0x4159('0x0'));var util=require('util');var moment=require(_0x4159('0x1'));var BPromise=require(_0x4159('0x2'));var rs=require(_0x4159('0x3'));var fs=require('fs');var Redis=require(_0x4159('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4159('0x5'));var logger=require('../../config/logger')(_0x4159('0x6'));var config=require(_0x4159('0x7'));var jayson=require(_0x4159('0x8'));var client=jayson[_0x4159('0x9')][_0x4159('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eee43,_0x31f0c5,_0x18ad66){return new BPromise(function(_0x47232e,_0x40a375){return client['request'](_0x4eee43,_0x18ad66)['then'](function(_0xc59103){logger[_0x4159('0xb')](_0x4159('0xc'),_0x31f0c5,_0x4159('0xd'));logger[_0x4159('0xe')](_0x4159('0xf'),_0x31f0c5,_0x4159('0xd'),JSON['stringify'](_0xc59103));if(_0xc59103['error']){if(_0xc59103[_0x4159('0x10')][_0x4159('0x11')]===0x1f4){logger[_0x4159('0x10')](_0x4159('0xc'),_0x31f0c5,_0xc59103[_0x4159('0x10')][_0x4159('0x12')]);return _0x40a375(_0xc59103[_0x4159('0x10')][_0x4159('0x12')]);}logger[_0x4159('0x10')](_0x4159('0xc'),_0x31f0c5,_0xc59103[_0x4159('0x10')][_0x4159('0x12')]);return _0x47232e(_0xc59103[_0x4159('0x10')][_0x4159('0x12')]);}else{logger[_0x4159('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x31f0c5,_0x4159('0xd'));_0x47232e(_0xc59103['result']['message']);}})[_0x4159('0x13')](function(_0x38737c){logger[_0x4159('0x10')](_0x4159('0xc'),_0x31f0c5,_0x38737c);_0x40a375(_0x38737c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 070c5e7..0a2ed7f 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 _0xff7c=['get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff7c,0xd3));var _0xcff7=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xff7c[_0x119d5a];return _0x15bff4;};'use strict';var multer=require('multer');var util=require(_0xcff7('0x0'));var path=require(_0xcff7('0x1'));var timeout=require(_0xcff7('0x2'));var express=require(_0xcff7('0x3'));var router=express['Router']();var fs_extra=require(_0xcff7('0x4'));var auth=require(_0xcff7('0x5'));var interaction=require(_0xcff7('0x6'));var config=require(_0xcff7('0x7'));var controller=require(_0xcff7('0x8'));router[_0xcff7('0x9')]('/',auth['isAuthenticated'](),controller[_0xcff7('0xa')]);router[_0xcff7('0x9')](_0xcff7('0xb'),auth[_0xcff7('0xc')](),controller[_0xcff7('0xd')]);router[_0xcff7('0xe')]('/',auth[_0xcff7('0xc')](),controller[_0xcff7('0xf')]);router[_0xcff7('0x10')](_0xcff7('0xb'),auth[_0xcff7('0xc')](),controller['update']);router[_0xcff7('0x11')](_0xcff7('0xb'),auth['isAuthenticated'](),controller[_0xcff7('0x12')]);module[_0xcff7('0x13')]=router; \ No newline at end of file +var _0x8758=['/:id','show','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index'];(function(_0x2f1a6e,_0x3082cb){var _0x5865e5=function(_0x459f1a){while(--_0x459f1a){_0x2f1a6e['push'](_0x2f1a6e['shift']());}};_0x5865e5(++_0x3082cb);}(_0x8758,0x1e2));var _0x8875=function(_0x474d14,_0x582e9b){_0x474d14=_0x474d14-0x0;var _0x4e6a42=_0x8758[_0x474d14];return _0x4e6a42;};'use strict';var multer=require('multer');var util=require(_0x8875('0x0'));var path=require(_0x8875('0x1'));var timeout=require(_0x8875('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8875('0x3'));var auth=require(_0x8875('0x4'));var interaction=require(_0x8875('0x5'));var config=require(_0x8875('0x6'));var controller=require(_0x8875('0x7'));router[_0x8875('0x8')]('/',auth[_0x8875('0x9')](),controller[_0x8875('0xa')]);router[_0x8875('0x8')](_0x8875('0xb'),auth[_0x8875('0x9')](),controller[_0x8875('0xc')]);router['post']('/',auth[_0x8875('0x9')](),controller[_0x8875('0xd')]);router[_0x8875('0xe')]('/:id',auth[_0x8875('0x9')](),controller[_0x8875('0xf')]);router['delete'](_0x8875('0xb'),auth[_0x8875('0x9')](),controller['destroy']);module[_0x8875('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5a6920a..ca114ba 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 _0xff41=['keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x401bd1,_0x486a2b){var _0x32bad7=function(_0x6d3b1){while(--_0x6d3b1){_0x401bd1['push'](_0x401bd1['shift']());}};_0x32bad7(++_0x486a2b);}(_0xff41,0xde));var _0x1ff4=function(_0x5a7935,_0x52c4c1){_0x5a7935=_0x5a7935-0x0;var _0x1ab434=_0xff41[_0x5a7935];return _0x1ab434;};'use strict';var Sequelize=require(_0x1ff4('0x0'));module[_0x1ff4('0x1')]={'type':{'type':Sequelize[_0x1ff4('0x2')]('string','variable','customVariable',_0x1ff4('0x3'),_0x1ff4('0x4')),'defaultValue':_0x1ff4('0x5')},'content':{'type':Sequelize[_0x1ff4('0x6')]},'key':{'type':Sequelize[_0x1ff4('0x6')]},'keyType':{'type':Sequelize[_0x1ff4('0x2')](_0x1ff4('0x5'),_0x1ff4('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x1ff4('0x6')]},'idField':{'type':Sequelize[_0x1ff4('0x6')]},'nameField':{'type':Sequelize[_0x1ff4('0x6')]},'customField':{'type':Sequelize[_0x1ff4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ff4('0x6')]}}; \ No newline at end of file +var _0x37a1=['keyValue','picklist','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x1c1562,_0x44e84d){var _0x1a8d20=function(_0x11eb7d){while(--_0x11eb7d){_0x1c1562['push'](_0x1c1562['shift']());}};_0x1a8d20(++_0x44e84d);}(_0x37a1,0x176));var _0x137a=function(_0x3f49fc,_0x5a8013){_0x3f49fc=_0x3f49fc-0x0;var _0x40e4fb=_0x37a1[_0x3f49fc];return _0x40e4fb;};'use strict';var Sequelize=require('sequelize');module[_0x137a('0x0')]={'type':{'type':Sequelize[_0x137a('0x1')](_0x137a('0x2'),_0x137a('0x3'),'customVariable',_0x137a('0x4'),_0x137a('0x5')),'defaultValue':_0x137a('0x2')},'content':{'type':Sequelize[_0x137a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x137a('0x1')](_0x137a('0x2'),_0x137a('0x3'),_0x137a('0x7'))},'keyContent':{'type':Sequelize[_0x137a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x137a('0x6')]},'customField':{'type':Sequelize[_0x137a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x137a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b4c32f2..d49ef7a 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 _0x588f=['fields','length','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x588f,0x194));var _0xf588=function(_0x3fe2be,_0x24cfba){_0x3fe2be=_0x3fe2be-0x0;var _0x16b3ca=_0x588f[_0x3fe2be];return _0x16b3ca;};'use strict';var emlformat=require(_0xf588('0x0'));var rimraf=require(_0xf588('0x1'));var zipdir=require(_0xf588('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf588('0x3'));var moment=require('moment');var BPromise=require(_0xf588('0x4'));var Mustache=require(_0xf588('0x5'));var util=require(_0xf588('0x6'));var path=require(_0xf588('0x7'));var sox=require(_0xf588('0x8'));var csv=require(_0xf588('0x9'));var ejs=require(_0xf588('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf588('0xb'));var squel=require(_0xf588('0xc'));var crypto=require(_0xf588('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf588('0x9'));var querystring=require(_0xf588('0xe'));var Papa=require('papaparse');var Redis=require(_0xf588('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf588('0x10'));var as=require(_0xf588('0x11'));var hardwareService=require(_0xf588('0x12'));var logger=require(_0xf588('0x13'))(_0xf588('0x14'));var utils=require(_0xf588('0x15'));var config=require(_0xf588('0x16'));var licenseUtil=require(_0xf588('0x17'));var db=require(_0xf588('0x18'))['db'];function respondWithStatusCode(_0x490786,_0x3fecd9){_0x3fecd9=_0x3fecd9||0xcc;return function(_0x60dfa0){if(_0x60dfa0){return _0x490786['sendStatus'](_0x3fecd9);}return _0x490786[_0xf588('0x19')](_0x3fecd9)[_0xf588('0x1a')]();};}function respondWithResult(_0x40bc93,_0x5a20b){_0x5a20b=_0x5a20b||0xc8;return function(_0x37eed7){if(_0x37eed7){return _0x40bc93[_0xf588('0x19')](_0x5a20b)[_0xf588('0x1b')](_0x37eed7);}};}function respondWithFilteredResult(_0x47f959,_0x4ec945){return function(_0x16dea0){if(_0x16dea0){var _0x4f7d57=typeof _0x4ec945['offset']===_0xf588('0x1c')&&typeof _0x4ec945['limit']==='undefined';var _0x3fa21f=_0x16dea0['count'];var _0x5eda34=_0x4f7d57?0x0:_0x4ec945[_0xf588('0x1d')];var _0x2f4697=_0x4f7d57?_0x16dea0[_0xf588('0x1e')]:_0x4ec945[_0xf588('0x1d')]+_0x4ec945[_0xf588('0x1f')];var _0x1144cd;if(_0x2f4697>=_0x3fa21f){_0x2f4697=_0x3fa21f;_0x1144cd=0xc8;}else{_0x1144cd=0xce;}_0x47f959[_0xf588('0x19')](_0x1144cd);return _0x47f959[_0xf588('0x20')](_0xf588('0x21'),_0x5eda34+'-'+_0x2f4697+'/'+_0x3fa21f)[_0xf588('0x1b')](_0x16dea0);}return null;};}function patchUpdates(_0x57431d){return function(_0x5619bf){try{jsonpatch[_0xf588('0x22')](_0x5619bf,_0x57431d,!![]);}catch(_0x4e27b5){return BPromise[_0xf588('0x23')](_0x4e27b5);}return _0x5619bf[_0xf588('0x24')]();};}function saveUpdates(_0xcc230c,_0x4efb55){return function(_0x3ea065){if(_0x3ea065){return _0x3ea065[_0xf588('0x25')](_0xcc230c)[_0xf588('0x26')](function(_0x3a5a7d){return _0x3a5a7d;});}return null;};}function removeEntity(_0x28ac2a,_0x1fcd7f){return function(_0x27c6fc){if(_0x27c6fc){return _0x27c6fc[_0xf588('0x27')]()[_0xf588('0x26')](function(){_0x28ac2a[_0xf588('0x19')](0xcc)[_0xf588('0x1a')]();});}};}function handleEntityNotFound(_0x48579b,_0xc77b4c){return function(_0x41eac5){if(!_0x41eac5){_0x48579b[_0xf588('0x28')](0x194);}return _0x41eac5;};}function handleError(_0x32e9be,_0x59117f){_0x59117f=_0x59117f||0x1f4;return function(_0x5d222d){logger[_0xf588('0x29')](_0x5d222d[_0xf588('0x2a')]);if(_0x5d222d[_0xf588('0x2b')]){delete _0x5d222d[_0xf588('0x2b')];}_0x32e9be['status'](_0x59117f)[_0xf588('0x2c')](_0x5d222d);};}exports[_0xf588('0x2d')]=function(_0x23c2fb,_0x2d2a55){var _0x6e5b4={},_0x17cece={},_0x2dfb10={'count':0x0,'rows':[]};var _0x181bc2=_[_0xf588('0x2e')](db[_0xf588('0x2f')][_0xf588('0x30')],function(_0x5adc34){return{'name':_0x5adc34[_0xf588('0x31')],'type':_0x5adc34[_0xf588('0x32')][_0xf588('0x33')]};});_0x17cece[_0xf588('0x34')]=_[_0xf588('0x2e')](_0x181bc2,'name');_0x17cece['query']=_[_0xf588('0x35')](_0x23c2fb['query']);_0x17cece[_0xf588('0x36')]=_[_0xf588('0x37')](_0x17cece[_0xf588('0x34')],_0x17cece[_0xf588('0x38')]);_0x6e5b4[_0xf588('0x39')]=_[_0xf588('0x37')](_0x17cece[_0xf588('0x34')],qs[_0xf588('0x3a')](_0x23c2fb[_0xf588('0x38')][_0xf588('0x3a')]));_0x6e5b4[_0xf588('0x39')]=_0x6e5b4[_0xf588('0x39')][_0xf588('0x3b')]?_0x6e5b4[_0xf588('0x39')]:_0x17cece['model'];if(!_0x23c2fb[_0xf588('0x38')]['hasOwnProperty']('nolimit')){_0x6e5b4['limit']=qs['limit'](_0x23c2fb[_0xf588('0x38')][_0xf588('0x1f')]);_0x6e5b4[_0xf588('0x1d')]=qs[_0xf588('0x1d')](_0x23c2fb[_0xf588('0x38')][_0xf588('0x1d')]);}_0x6e5b4[_0xf588('0x3c')]=qs[_0xf588('0x3d')](_0x23c2fb[_0xf588('0x38')][_0xf588('0x3d')]);_0x6e5b4['where']=qs[_0xf588('0x36')](_[_0xf588('0x3e')](_0x23c2fb[_0xf588('0x38')],_0x17cece[_0xf588('0x36')]),_0x181bc2);if(_0x23c2fb[_0xf588('0x38')][_0xf588('0x3f')]){_0x6e5b4[_0xf588('0x40')]=_[_0xf588('0x41')](_0x6e5b4[_0xf588('0x40')],{'$or':_[_0xf588('0x2e')](_0x181bc2,function(_0x1ba73a){if(_0x1ba73a['type']!==_0xf588('0x42')){var _0x2e32d6={};_0x2e32d6[_0x1ba73a[_0xf588('0x2b')]]={'$like':'%'+_0x23c2fb['query'][_0xf588('0x3f')]+'%'};return _0x2e32d6;}})});}_0x6e5b4=_['merge']({},_0x6e5b4,_0x23c2fb['options']);var _0x2a9aac={'where':_0x6e5b4['where']};return db[_0xf588('0x2f')][_0xf588('0x1e')](_0x2a9aac)[_0xf588('0x26')](function(_0x311f8a){_0x2dfb10[_0xf588('0x1e')]=_0x311f8a;if(_0x23c2fb['query']['includeAll']){_0x6e5b4[_0xf588('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0xf588('0x44')](_0x6e5b4);})['then'](function(_0x443474){_0x2dfb10[_0xf588('0x45')]=_0x443474;return _0x2dfb10;})['then'](respondWithFilteredResult(_0x2d2a55,_0x6e5b4))[_0xf588('0x46')](handleError(_0x2d2a55,null));};exports['show']=function(_0x5aa3ad,_0x233a81){var _0x5ea801={'raw':!![],'where':{'id':_0x5aa3ad[_0xf588('0x47')]['id']}},_0x4615c7={};_0x4615c7['model']=_['keys'](db['ZendeskField'][_0xf588('0x30')]);_0x4615c7[_0xf588('0x38')]=_['keys'](_0x5aa3ad[_0xf588('0x38')]);_0x4615c7[_0xf588('0x36')]=_['intersection'](_0x4615c7[_0xf588('0x34')],_0x4615c7[_0xf588('0x38')]);_0x5ea801[_0xf588('0x39')]=_['intersection'](_0x4615c7[_0xf588('0x34')],qs['fields'](_0x5aa3ad[_0xf588('0x38')][_0xf588('0x3a')]));_0x5ea801[_0xf588('0x39')]=_0x5ea801[_0xf588('0x39')][_0xf588('0x3b')]?_0x5ea801['attributes']:_0x4615c7[_0xf588('0x34')];if(_0x5aa3ad['query'][_0xf588('0x48')]){_0x5ea801['include']=[{'all':!![]}];}_0x5ea801=_[_0xf588('0x41')]({},_0x5ea801,_0x5aa3ad[_0xf588('0x49')]);return db[_0xf588('0x2f')][_0xf588('0x4a')](_0x5ea801)[_0xf588('0x26')](handleEntityNotFound(_0x233a81,null))[_0xf588('0x26')](respondWithResult(_0x233a81,null))[_0xf588('0x46')](handleError(_0x233a81,null));};exports[_0xf588('0x4b')]=function(_0x2fc543,_0x210fb6){return db[_0xf588('0x2f')][_0xf588('0x4b')](_0x2fc543[_0xf588('0x4c')],{})[_0xf588('0x26')](respondWithResult(_0x210fb6,0xc9))[_0xf588('0x46')](handleError(_0x210fb6,null));};exports[_0xf588('0x25')]=function(_0x2ada7b,_0x3e6c38){if(_0x2ada7b[_0xf588('0x4c')]['id']){delete _0x2ada7b['body']['id'];}return db[_0xf588('0x2f')][_0xf588('0x4a')]({'where':{'id':_0x2ada7b[_0xf588('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e6c38,null))[_0xf588('0x26')](saveUpdates(_0x2ada7b['body'],null))['then'](respondWithResult(_0x3e6c38,null))[_0xf588('0x46')](handleError(_0x3e6c38,null));};exports[_0xf588('0x27')]=function(_0x3a2b34,_0x218987){return db['ZendeskField'][_0xf588('0x4a')]({'where':{'id':_0x3a2b34[_0xf588('0x47')]['id']}})['then'](handleEntityNotFound(_0x218987,null))['then'](removeEntity(_0x218987,null))[_0xf588('0x46')](handleError(_0x218987,null));}; \ No newline at end of file +var _0x81f5=['undefined','limit','count','set','apply','save','update','destroy','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x30797c,_0x4d85f0){var _0x245872=function(_0x841ea0){while(--_0x841ea0){_0x30797c['push'](_0x30797c['shift']());}};_0x245872(++_0x4d85f0);}(_0x81f5,0x77));var _0x581f=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x81f5[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x581f('0x0'));var rimraf=require(_0x581f('0x1'));var zipdir=require(_0x581f('0x2'));var jsonpatch=require(_0x581f('0x3'));var rp=require(_0x581f('0x4'));var moment=require(_0x581f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x581f('0x6'));var util=require(_0x581f('0x7'));var path=require(_0x581f('0x8'));var sox=require(_0x581f('0x9'));var csv=require(_0x581f('0xa'));var ejs=require(_0x581f('0xb'));var fs=require('fs');var fs_extra=require(_0x581f('0xc'));var _=require(_0x581f('0xd'));var squel=require(_0x581f('0xe'));var crypto=require('crypto');var jsforce=require(_0x581f('0xf'));var deskjs=require(_0x581f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x581f('0x11'));var Papa=require(_0x581f('0x12'));var Redis=require(_0x581f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x581f('0x14'));var as=require(_0x581f('0x15'));var hardwareService=require(_0x581f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x581f('0x17'));var config=require(_0x581f('0x18'));var licenseUtil=require(_0x581f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cfe6f,_0x249a79){_0x249a79=_0x249a79||0xcc;return function(_0xf8cfe9){if(_0xf8cfe9){return _0x4cfe6f[_0x581f('0x1a')](_0x249a79);}return _0x4cfe6f[_0x581f('0x1b')](_0x249a79)[_0x581f('0x1c')]();};}function respondWithResult(_0x44c7ec,_0x57fef9){_0x57fef9=_0x57fef9||0xc8;return function(_0x5b90af){if(_0x5b90af){return _0x44c7ec[_0x581f('0x1b')](_0x57fef9)[_0x581f('0x1d')](_0x5b90af);}};}function respondWithFilteredResult(_0x781853,_0x3ce459){return function(_0x12bdc3){if(_0x12bdc3){var _0x7a867e=typeof _0x3ce459[_0x581f('0x1e')]===_0x581f('0x1f')&&typeof _0x3ce459[_0x581f('0x20')]===_0x581f('0x1f');var _0x2564c8=_0x12bdc3[_0x581f('0x21')];var _0x143fe0=_0x7a867e?0x0:_0x3ce459[_0x581f('0x1e')];var _0xb70df6=_0x7a867e?_0x12bdc3['count']:_0x3ce459[_0x581f('0x1e')]+_0x3ce459[_0x581f('0x20')];var _0x345dd7;if(_0xb70df6>=_0x2564c8){_0xb70df6=_0x2564c8;_0x345dd7=0xc8;}else{_0x345dd7=0xce;}_0x781853[_0x581f('0x1b')](_0x345dd7);return _0x781853[_0x581f('0x22')]('Content-Range',_0x143fe0+'-'+_0xb70df6+'/'+_0x2564c8)[_0x581f('0x1d')](_0x12bdc3);}return null;};}function patchUpdates(_0x10f439){return function(_0x25b3b1){try{jsonpatch[_0x581f('0x23')](_0x25b3b1,_0x10f439,!![]);}catch(_0x4163e2){return BPromise['reject'](_0x4163e2);}return _0x25b3b1[_0x581f('0x24')]();};}function saveUpdates(_0x328b74,_0x508933){return function(_0x22dd22){if(_0x22dd22){return _0x22dd22[_0x581f('0x25')](_0x328b74)['then'](function(_0x18ea1d){return _0x18ea1d;});}return null;};}function removeEntity(_0x27e7bf,_0x3d0a62){return function(_0xc8e38a){if(_0xc8e38a){return _0xc8e38a[_0x581f('0x26')]()[_0x581f('0x27')](function(){_0x27e7bf[_0x581f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57cc07,_0xd1d380){return function(_0x1d8abb){if(!_0x1d8abb){_0x57cc07[_0x581f('0x1a')](0x194);}return _0x1d8abb;};}function handleError(_0x80a877,_0x1092fb){_0x1092fb=_0x1092fb||0x1f4;return function(_0x3e4b65){logger['error'](_0x3e4b65[_0x581f('0x28')]);if(_0x3e4b65['name']){delete _0x3e4b65[_0x581f('0x29')];}_0x80a877['status'](_0x1092fb)[_0x581f('0x2a')](_0x3e4b65);};}exports[_0x581f('0x2b')]=function(_0x2b4619,_0x3009af){var _0x4fedde={},_0xabbf34={},_0x2dec70={'count':0x0,'rows':[]};var _0x174819=_[_0x581f('0x2c')](db[_0x581f('0x2d')][_0x581f('0x2e')],function(_0x4e383a){return{'name':_0x4e383a[_0x581f('0x2f')],'type':_0x4e383a[_0x581f('0x30')][_0x581f('0x31')]};});_0xabbf34[_0x581f('0x32')]=_[_0x581f('0x2c')](_0x174819,'name');_0xabbf34[_0x581f('0x33')]=_[_0x581f('0x34')](_0x2b4619[_0x581f('0x33')]);_0xabbf34['filters']=_[_0x581f('0x35')](_0xabbf34[_0x581f('0x32')],_0xabbf34['query']);_0x4fedde[_0x581f('0x36')]=_[_0x581f('0x35')](_0xabbf34[_0x581f('0x32')],qs[_0x581f('0x37')](_0x2b4619[_0x581f('0x33')][_0x581f('0x37')]));_0x4fedde[_0x581f('0x36')]=_0x4fedde['attributes'][_0x581f('0x38')]?_0x4fedde[_0x581f('0x36')]:_0xabbf34['model'];if(!_0x2b4619[_0x581f('0x33')]['hasOwnProperty'](_0x581f('0x39'))){_0x4fedde[_0x581f('0x20')]=qs['limit'](_0x2b4619[_0x581f('0x33')][_0x581f('0x20')]);_0x4fedde[_0x581f('0x1e')]=qs[_0x581f('0x1e')](_0x2b4619[_0x581f('0x33')][_0x581f('0x1e')]);}_0x4fedde['order']=qs[_0x581f('0x3a')](_0x2b4619[_0x581f('0x33')][_0x581f('0x3a')]);_0x4fedde[_0x581f('0x3b')]=qs['filters'](_[_0x581f('0x3c')](_0x2b4619[_0x581f('0x33')],_0xabbf34[_0x581f('0x3d')]),_0x174819);if(_0x2b4619[_0x581f('0x33')][_0x581f('0x3e')]){_0x4fedde[_0x581f('0x3b')]=_['merge'](_0x4fedde[_0x581f('0x3b')],{'$or':_[_0x581f('0x2c')](_0x174819,function(_0x4dd253){if(_0x4dd253['type']!==_0x581f('0x3f')){var _0xdaa9f9={};_0xdaa9f9[_0x4dd253[_0x581f('0x29')]]={'$like':'%'+_0x2b4619[_0x581f('0x33')][_0x581f('0x3e')]+'%'};return _0xdaa9f9;}})});}_0x4fedde=_['merge']({},_0x4fedde,_0x2b4619[_0x581f('0x40')]);var _0x2f752a={'where':_0x4fedde[_0x581f('0x3b')]};return db['ZendeskField'][_0x581f('0x21')](_0x2f752a)[_0x581f('0x27')](function(_0x43ecf7){_0x2dec70[_0x581f('0x21')]=_0x43ecf7;if(_0x2b4619['query'][_0x581f('0x41')]){_0x4fedde[_0x581f('0x42')]=[{'all':!![]}];}return db['ZendeskField'][_0x581f('0x43')](_0x4fedde);})[_0x581f('0x27')](function(_0x30d527){_0x2dec70[_0x581f('0x44')]=_0x30d527;return _0x2dec70;})['then'](respondWithFilteredResult(_0x3009af,_0x4fedde))[_0x581f('0x45')](handleError(_0x3009af,null));};exports[_0x581f('0x46')]=function(_0x5a4658,_0x171fa1){var _0x3988ba={'raw':!![],'where':{'id':_0x5a4658[_0x581f('0x47')]['id']}},_0x4216ba={};_0x4216ba[_0x581f('0x32')]=_[_0x581f('0x34')](db[_0x581f('0x2d')][_0x581f('0x2e')]);_0x4216ba['query']=_[_0x581f('0x34')](_0x5a4658[_0x581f('0x33')]);_0x4216ba[_0x581f('0x3d')]=_[_0x581f('0x35')](_0x4216ba[_0x581f('0x32')],_0x4216ba[_0x581f('0x33')]);_0x3988ba[_0x581f('0x36')]=_[_0x581f('0x35')](_0x4216ba[_0x581f('0x32')],qs['fields'](_0x5a4658[_0x581f('0x33')][_0x581f('0x37')]));_0x3988ba[_0x581f('0x36')]=_0x3988ba[_0x581f('0x36')][_0x581f('0x38')]?_0x3988ba['attributes']:_0x4216ba[_0x581f('0x32')];if(_0x5a4658[_0x581f('0x33')]['includeAll']){_0x3988ba[_0x581f('0x42')]=[{'all':!![]}];}_0x3988ba=_['merge']({},_0x3988ba,_0x5a4658[_0x581f('0x40')]);return db[_0x581f('0x2d')][_0x581f('0x48')](_0x3988ba)[_0x581f('0x27')](handleEntityNotFound(_0x171fa1,null))[_0x581f('0x27')](respondWithResult(_0x171fa1,null))[_0x581f('0x45')](handleError(_0x171fa1,null));};exports[_0x581f('0x49')]=function(_0x370384,_0x5be2df){return db[_0x581f('0x2d')]['create'](_0x370384[_0x581f('0x4a')],{})['then'](respondWithResult(_0x5be2df,0xc9))[_0x581f('0x45')](handleError(_0x5be2df,null));};exports[_0x581f('0x25')]=function(_0x4b1f4e,_0x3e9471){if(_0x4b1f4e[_0x581f('0x4a')]['id']){delete _0x4b1f4e['body']['id'];}return db[_0x581f('0x2d')][_0x581f('0x48')]({'where':{'id':_0x4b1f4e[_0x581f('0x47')]['id']}})[_0x581f('0x27')](handleEntityNotFound(_0x3e9471,null))[_0x581f('0x27')](saveUpdates(_0x4b1f4e['body'],null))['then'](respondWithResult(_0x3e9471,null))[_0x581f('0x45')](handleError(_0x3e9471,null));};exports[_0x581f('0x26')]=function(_0x505964,_0x5073cf){return db['ZendeskField']['find']({'where':{'id':_0x505964[_0x581f('0x47')]['id']}})[_0x581f('0x27')](handleEntityNotFound(_0x5073cf,null))[_0x581f('0x27')](removeEntity(_0x5073cf,null))['catch'](handleError(_0x5073cf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 38d8cb3..3c4bf32 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 _0xf54c=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf54c,0x1bb));var _0xcf54=function(_0x250665,_0x464740){_0x250665=_0x250665-0x0;var _0x35734e=_0xf54c[_0x250665];return _0x35734e;};'use strict';var _=require(_0xcf54('0x0'));var util=require(_0xcf54('0x1'));var logger=require(_0xcf54('0x2'))(_0xcf54('0x3'));var moment=require(_0xcf54('0x4'));var BPromise=require(_0xcf54('0x5'));var rp=require(_0xcf54('0x6'));var fs=require('fs');var path=require(_0xcf54('0x7'));var rimraf=require(_0xcf54('0x8'));var config=require(_0xcf54('0x9'));var attributes=require(_0xcf54('0xa'));module[_0xcf54('0xb')]=function(_0x225218,_0x4785b0){return _0x225218['define'](_0xcf54('0xc'),attributes,{'tableName':_0xcf54('0xd'),'paranoid':![],'indexes':[{'name':_0xcf54('0xe'),'fields':[_0xcf54('0xf'),_0xcf54('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfeae=['./intZendeskField.attributes','exports','ZendeskField','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3fadd9,_0x1135b8){var _0x10e441=function(_0x124f9a){while(--_0x124f9a){_0x3fadd9['push'](_0x3fadd9['shift']());}};_0x10e441(++_0x1135b8);}(_0xfeae,0xe0));var _0xefea=function(_0x44b806,_0x419e7a){_0x44b806=_0x44b806-0x0;var _0x2c2cd9=_0xfeae[_0x44b806];return _0x2c2cd9;};'use strict';var _=require(_0xefea('0x0'));var util=require(_0xefea('0x1'));var logger=require(_0xefea('0x2'))(_0xefea('0x3'));var moment=require('moment');var BPromise=require(_0xefea('0x4'));var rp=require(_0xefea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefea('0x6'));var config=require('../../config/environment');var attributes=require(_0xefea('0x7'));module[_0xefea('0x8')]=function(_0x45d289,_0x3a3dc0){return _0x45d289['define'](_0xefea('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xefea('0xa'),'FieldId'],'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 8e481e5..ed42dbe 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 _0xe6d0=['result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskField,\x20%s,\x20%s'];(function(_0x3dfa03,_0x146829){var _0x40bd9d=function(_0x5a1788){while(--_0x5a1788){_0x3dfa03['push'](_0x3dfa03['shift']());}};_0x40bd9d(++_0x146829);}(_0xe6d0,0x6b));var _0x0e6d=function(_0x2e23fb,_0x313875){_0x2e23fb=_0x2e23fb-0x0;var _0x1b3460=_0xe6d0[_0x2e23fb];return _0x1b3460;};'use strict';var _=require(_0x0e6d('0x0'));var util=require(_0x0e6d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0e6d('0x2'));var fs=require('fs');var Redis=require(_0x0e6d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e6d('0x4'));var logger=require(_0x0e6d('0x5'))(_0x0e6d('0x6'));var config=require(_0x0e6d('0x7'));var jayson=require(_0x0e6d('0x8'));var client=jayson[_0x0e6d('0x9')][_0x0e6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a7e2,_0x2d748f,_0x8bbe33){return new BPromise(function(_0x33afba,_0x7293cc){return client[_0x0e6d('0xb')](_0x18a7e2,_0x8bbe33)['then'](function(_0x3cc000){logger[_0x0e6d('0xc')]('ZendeskField,\x20%s,\x20%s',_0x2d748f,_0x0e6d('0xd'));logger['debug'](_0x0e6d('0xe'),_0x2d748f,_0x0e6d('0xd'),JSON[_0x0e6d('0xf')](_0x3cc000));if(_0x3cc000[_0x0e6d('0x10')]){if(_0x3cc000[_0x0e6d('0x10')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x2d748f,_0x3cc000[_0x0e6d('0x10')][_0x0e6d('0x11')]);return _0x7293cc(_0x3cc000[_0x0e6d('0x10')]['message']);}logger[_0x0e6d('0x10')]('ZendeskField,\x20%s,\x20%s',_0x2d748f,_0x3cc000[_0x0e6d('0x10')][_0x0e6d('0x11')]);return _0x33afba(_0x3cc000[_0x0e6d('0x10')][_0x0e6d('0x11')]);}else{logger['info'](_0x0e6d('0x12'),_0x2d748f,'request\x20sent');_0x33afba(_0x3cc000[_0x0e6d('0x13')]['message']);}})[_0x0e6d('0x14')](function(_0x2db8ff){logger[_0x0e6d('0x10')]('ZendeskField,\x20%s,\x20%s',_0x2d748f,_0x2db8ff);_0x7293cc(_0x2db8ff);});});} \ No newline at end of file +var _0x37e0=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4f21c4,_0x960024){var _0x2f9fa6=function(_0x26f914){while(--_0x26f914){_0x4f21c4['push'](_0x4f21c4['shift']());}};_0x2f9fa6(++_0x960024);}(_0x37e0,0x1e4));var _0x037e=function(_0x803664,_0x1824d6){_0x803664=_0x803664-0x0;var _0x264362=_0x37e0[_0x803664];return _0x264362;};'use strict';var _=require('lodash');var util=require(_0x037e('0x0'));var moment=require(_0x037e('0x1'));var BPromise=require(_0x037e('0x2'));var rs=require(_0x037e('0x3'));var fs=require('fs');var Redis=require(_0x037e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x037e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x037e('0x6'));var jayson=require(_0x037e('0x7'));var client=jayson[_0x037e('0x8')][_0x037e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307836,_0x5b7459,_0x1a149e){return new BPromise(function(_0x4ba86b,_0x13f075){return client[_0x037e('0xa')](_0x307836,_0x1a149e)[_0x037e('0xb')](function(_0x199c68){logger[_0x037e('0xc')](_0x037e('0xd'),_0x5b7459,_0x037e('0xe'));logger[_0x037e('0xf')](_0x037e('0x10'),_0x5b7459,_0x037e('0xe'),JSON[_0x037e('0x11')](_0x199c68));if(_0x199c68['error']){if(_0x199c68[_0x037e('0x12')][_0x037e('0x13')]===0x1f4){logger['error'](_0x037e('0xd'),_0x5b7459,_0x199c68[_0x037e('0x12')][_0x037e('0x14')]);return _0x13f075(_0x199c68[_0x037e('0x12')][_0x037e('0x14')]);}logger[_0x037e('0x12')](_0x037e('0xd'),_0x5b7459,_0x199c68[_0x037e('0x12')]['message']);return _0x4ba86b(_0x199c68[_0x037e('0x12')][_0x037e('0x14')]);}else{logger[_0x037e('0xc')](_0x037e('0xd'),_0x5b7459,_0x037e('0xe'));_0x4ba86b(_0x199c68[_0x037e('0x15')]['message']);}})['catch'](function(_0x2e6752){logger[_0x037e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x5b7459,_0x2e6752);_0x13f075(_0x2e6752);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 86fe861..ca5cf79 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 _0xb0c4=['./intZohoAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ab481,_0x4bf8fd){var _0x1b9ac4=function(_0x1ff17){while(--_0x1ff17){_0x2ab481['push'](_0x2ab481['shift']());}};_0x1b9ac4(++_0x4bf8fd);}(_0xb0c4,0x87));var _0x4b0c=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0xb0c4[_0x5b64a1];return _0x4b6f55;};'use strict';var multer=require(_0x4b0c('0x0'));var util=require(_0x4b0c('0x1'));var path=require('path');var timeout=require(_0x4b0c('0x2'));var express=require(_0x4b0c('0x3'));var router=express[_0x4b0c('0x4')]();var fs_extra=require(_0x4b0c('0x5'));var auth=require(_0x4b0c('0x6'));var interaction=require(_0x4b0c('0x7'));var config=require(_0x4b0c('0x8'));var controller=require(_0x4b0c('0x9'));router[_0x4b0c('0xa')]('/',auth[_0x4b0c('0xb')](),controller['index']);router[_0x4b0c('0xa')]('/:id',auth[_0x4b0c('0xb')](),controller[_0x4b0c('0xc')]);router['get'](_0x4b0c('0xd'),auth[_0x4b0c('0xb')](),controller[_0x4b0c('0xe')]);router['get']('/:id/fields',auth[_0x4b0c('0xb')](),controller[_0x4b0c('0xf')]);router[_0x4b0c('0x10')]('/',auth['isAuthenticated'](),controller[_0x4b0c('0x11')]);router[_0x4b0c('0x10')](_0x4b0c('0xd'),auth[_0x4b0c('0xb')](),controller['addConfiguration']);router[_0x4b0c('0x12')](_0x4b0c('0x13'),auth['isAuthenticated'](),controller[_0x4b0c('0x14')]);router[_0x4b0c('0x15')](_0x4b0c('0x13'),auth[_0x4b0c('0xb')](),controller[_0x4b0c('0x16')]);module[_0x4b0c('0x17')]=router; \ No newline at end of file +var _0x15a4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x3d14d1,_0x23aa69){var _0xc78d1f=function(_0x40edbe){while(--_0x40edbe){_0x3d14d1['push'](_0x3d14d1['shift']());}};_0xc78d1f(++_0x23aa69);}(_0x15a4,0x6d));var _0x415a=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x15a4[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require(_0x415a('0x0'));var util=require(_0x415a('0x1'));var path=require(_0x415a('0x2'));var timeout=require(_0x415a('0x3'));var express=require(_0x415a('0x4'));var router=express[_0x415a('0x5')]();var fs_extra=require(_0x415a('0x6'));var auth=require(_0x415a('0x7'));var interaction=require(_0x415a('0x8'));var config=require(_0x415a('0x9'));var controller=require(_0x415a('0xa'));router[_0x415a('0xb')]('/',auth[_0x415a('0xc')](),controller[_0x415a('0xd')]);router[_0x415a('0xb')]('/:id',auth[_0x415a('0xc')](),controller[_0x415a('0xe')]);router[_0x415a('0xb')]('/:id/configurations',auth[_0x415a('0xc')](),controller[_0x415a('0xf')]);router[_0x415a('0xb')](_0x415a('0x10'),auth[_0x415a('0xc')](),controller[_0x415a('0x11')]);router[_0x415a('0x12')]('/',auth[_0x415a('0xc')](),controller[_0x415a('0x13')]);router[_0x415a('0x12')](_0x415a('0x14'),auth['isAuthenticated'](),controller[_0x415a('0x15')]);router[_0x415a('0x16')]('/:id',auth[_0x415a('0xc')](),controller[_0x415a('0x17')]);router[_0x415a('0x18')](_0x415a('0x19'),auth[_0x415a('0xc')](),controller[_0x415a('0x1a')]);module[_0x415a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b4ce7ed..5489f3b 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x9117b6,_0x1f15e0){var _0x2068d3=function(_0x10da80){while(--_0x10da80){_0x9117b6['push'](_0x9117b6['shift']());}};_0x2068d3(++_0x1f15e0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0x00bb=['STRING','sequelize','exports'];(function(_0x31469c,_0x1739e4){var _0x334df2=function(_0x1eae39){while(--_0x1eae39){_0x31469c['push'](_0x31469c['shift']());}};_0x334df2(++_0x1739e4);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 6daf8b9..9330a44 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 _0x8d7d=['clientSecret','access_token','serverUrl','code','host','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','picklist','pick_list_values','test','getFields','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','Content-Range','apply','update','then','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0x8d7d,0x9e));var _0xd8d7=function(_0x2f1498,_0x295045){_0x2f1498=_0x2f1498-0x0;var _0x4d5648=_0x8d7d[_0x2f1498];return _0x4d5648;};'use strict';var emlformat=require(_0xd8d7('0x0'));var rimraf=require(_0xd8d7('0x1'));var zipdir=require(_0xd8d7('0x2'));var jsonpatch=require(_0xd8d7('0x3'));var rp=require(_0xd8d7('0x4'));var moment=require(_0xd8d7('0x5'));var BPromise=require(_0xd8d7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd8d7('0x7'));var csv=require('to-csv');var ejs=require(_0xd8d7('0x8'));var fs=require('fs');var fs_extra=require(_0xd8d7('0x9'));var _=require(_0xd8d7('0xa'));var squel=require(_0xd8d7('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8d7('0xc'));var deskjs=require(_0xd8d7('0xd'));var toCsv=require(_0xd8d7('0xe'));var querystring=require(_0xd8d7('0xf'));var Papa=require(_0xd8d7('0x10'));var Redis=require(_0xd8d7('0x11'));var authService=require(_0xd8d7('0x12'));var qs=require(_0xd8d7('0x13'));var as=require(_0xd8d7('0x14'));var hardwareService=require(_0xd8d7('0x15'));var logger=require(_0xd8d7('0x16'))('api');var utils=require(_0xd8d7('0x17'));var config=require(_0xd8d7('0x18'));var licenseUtil=require(_0xd8d7('0x19'));var db=require(_0xd8d7('0x1a'))['db'];var integrations=require(_0xd8d7('0x1b'));function respondWithStatusCode(_0x41b885,_0xb90b77){_0xb90b77=_0xb90b77||0xcc;return function(_0x41e5ae){if(_0x41e5ae){return _0x41b885[_0xd8d7('0x1c')](_0xb90b77);}return _0x41b885[_0xd8d7('0x1d')](_0xb90b77)['end']();};}function respondWithResult(_0x3ceeed,_0x1dee2d){_0x1dee2d=_0x1dee2d||0xc8;return function(_0x4186cc){if(_0x4186cc){return _0x3ceeed['status'](_0x1dee2d)[_0xd8d7('0x1e')](_0x4186cc);}};}function respondWithFilteredResult(_0x2eaeb3,_0x1993be){return function(_0x231011){if(_0x231011){var _0x7918a9=typeof _0x1993be[_0xd8d7('0x1f')]==='undefined'&&typeof _0x1993be[_0xd8d7('0x20')]==='undefined';var _0x575f16=_0x231011['count'];var _0x1877d=_0x7918a9?0x0:_0x1993be[_0xd8d7('0x1f')];var _0x2ac45a=_0x7918a9?_0x231011[_0xd8d7('0x21')]:_0x1993be[_0xd8d7('0x1f')]+_0x1993be[_0xd8d7('0x20')];var _0x2607f0;if(_0x2ac45a>=_0x575f16){_0x2ac45a=_0x575f16;_0x2607f0=0xc8;}else{_0x2607f0=0xce;}_0x2eaeb3[_0xd8d7('0x1d')](_0x2607f0);return _0x2eaeb3['set'](_0xd8d7('0x22'),_0x1877d+'-'+_0x2ac45a+'/'+_0x575f16)[_0xd8d7('0x1e')](_0x231011);}return null;};}function patchUpdates(_0x40f8a7){return function(_0x4753c5){try{jsonpatch[_0xd8d7('0x23')](_0x4753c5,_0x40f8a7,!![]);}catch(_0x587d9b){return BPromise['reject'](_0x587d9b);}return _0x4753c5['save']();};}function saveUpdates(_0x1d3dc0,_0x1d0123){return function(_0xdc7972){if(_0xdc7972){return _0xdc7972[_0xd8d7('0x24')](_0x1d3dc0)[_0xd8d7('0x25')](function(_0x4ab8c9){return _0x4ab8c9;});}return null;};}function removeEntity(_0x46fae8,_0x13eaa2){return function(_0x4c65d2){if(_0x4c65d2){return _0x4c65d2['destroy']()[_0xd8d7('0x25')](function(){_0x46fae8[_0xd8d7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42fe81,_0x6e75ea){return function(_0x9b0a19){if(!_0x9b0a19){_0x42fe81[_0xd8d7('0x1c')](0x194);}return _0x9b0a19;};}function handleError(_0x2b8ebc,_0xdca6b3){_0xdca6b3=_0xdca6b3||0x1f4;return function(_0x5256cd){logger[_0xd8d7('0x26')](_0x5256cd[_0xd8d7('0x27')]);if(_0x5256cd[_0xd8d7('0x28')]){delete _0x5256cd[_0xd8d7('0x28')];}_0x2b8ebc[_0xd8d7('0x1d')](_0xdca6b3)['send'](_0x5256cd);};}exports[_0xd8d7('0x29')]=function(_0x219adb,_0x57dd63){var _0x3d7802={},_0x26b1ed={},_0x5db7ab={'count':0x0,'rows':[]};var _0x169e3f=_[_0xd8d7('0x2a')](db[_0xd8d7('0x2b')][_0xd8d7('0x2c')],function(_0x29692b){return{'name':_0x29692b[_0xd8d7('0x2d')],'type':_0x29692b[_0xd8d7('0x2e')][_0xd8d7('0x2f')]};});_0x26b1ed[_0xd8d7('0x30')]=_['map'](_0x169e3f,_0xd8d7('0x28'));_0x26b1ed[_0xd8d7('0x31')]=_[_0xd8d7('0x32')](_0x219adb[_0xd8d7('0x31')]);_0x26b1ed[_0xd8d7('0x33')]=_['intersection'](_0x26b1ed[_0xd8d7('0x30')],_0x26b1ed[_0xd8d7('0x31')]);_0x3d7802[_0xd8d7('0x34')]=_['intersection'](_0x26b1ed['model'],qs['fields'](_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x35')]));_0x3d7802[_0xd8d7('0x34')]=_0x3d7802['attributes'][_0xd8d7('0x36')]?_0x3d7802[_0xd8d7('0x34')]:_0x26b1ed[_0xd8d7('0x30')];if(!_0x219adb['query'][_0xd8d7('0x37')]('nolimit')){_0x3d7802[_0xd8d7('0x20')]=qs[_0xd8d7('0x20')](_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x20')]);_0x3d7802[_0xd8d7('0x1f')]=qs['offset'](_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x1f')]);}_0x3d7802['order']=qs['sort'](_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x38')]);_0x3d7802[_0xd8d7('0x39')]=qs[_0xd8d7('0x33')](_[_0xd8d7('0x3a')](_0x219adb[_0xd8d7('0x31')],_0x26b1ed[_0xd8d7('0x33')]),_0x169e3f);if(_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x3b')]){_0x3d7802[_0xd8d7('0x39')]=_[_0xd8d7('0x3c')](_0x3d7802[_0xd8d7('0x39')],{'$or':_[_0xd8d7('0x2a')](_0x169e3f,function(_0x47037e){if(_0x47037e[_0xd8d7('0x2e')]!==_0xd8d7('0x3d')){var _0x500099={};_0x500099[_0x47037e[_0xd8d7('0x28')]]={'$like':'%'+_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x3b')]+'%'};return _0x500099;}})});}_0x3d7802=_['merge']({},_0x3d7802,_0x219adb[_0xd8d7('0x3e')]);var _0x440590={'where':_0x3d7802[_0xd8d7('0x39')]};return db['ZohoAccount'][_0xd8d7('0x21')](_0x440590)[_0xd8d7('0x25')](function(_0x1ec02a){_0x5db7ab[_0xd8d7('0x21')]=_0x1ec02a;if(_0x219adb[_0xd8d7('0x31')][_0xd8d7('0x3f')]){_0x3d7802['include']=[{'all':!![]}];}return db[_0xd8d7('0x2b')][_0xd8d7('0x40')](_0x3d7802);})[_0xd8d7('0x25')](function(_0x48da5c){_0x5db7ab[_0xd8d7('0x41')]=_0x48da5c;return _0x5db7ab;})[_0xd8d7('0x25')](respondWithFilteredResult(_0x57dd63,_0x3d7802))[_0xd8d7('0x42')](handleError(_0x57dd63,null));};exports[_0xd8d7('0x43')]=function(_0x13b40e,_0x3eab10){var _0x3f8ba0={'raw':![],'where':{'id':_0x13b40e[_0xd8d7('0x44')]['id']}},_0x36a4c1={};_0x36a4c1['model']=_[_0xd8d7('0x32')](db[_0xd8d7('0x2b')][_0xd8d7('0x2c')]);_0x36a4c1[_0xd8d7('0x31')]=_[_0xd8d7('0x32')](_0x13b40e[_0xd8d7('0x31')]);_0x36a4c1[_0xd8d7('0x33')]=_[_0xd8d7('0x45')](_0x36a4c1[_0xd8d7('0x30')],_0x36a4c1[_0xd8d7('0x31')]);_0x3f8ba0[_0xd8d7('0x34')]=_['intersection'](_0x36a4c1[_0xd8d7('0x30')],qs[_0xd8d7('0x35')](_0x13b40e[_0xd8d7('0x31')][_0xd8d7('0x35')]));_0x3f8ba0['attributes']=_0x3f8ba0[_0xd8d7('0x34')][_0xd8d7('0x36')]?_0x3f8ba0[_0xd8d7('0x34')]:_0x36a4c1['model'];if(_0x13b40e[_0xd8d7('0x31')][_0xd8d7('0x3f')]){_0x3f8ba0[_0xd8d7('0x46')]=[{'all':!![]}];}_0x3f8ba0=_['merge']({},_0x3f8ba0,_0x13b40e['options']);return db[_0xd8d7('0x2b')][_0xd8d7('0x47')](_0x3f8ba0)['then'](handleEntityNotFound(_0x3eab10,null))[_0xd8d7('0x25')](respondWithResult(_0x3eab10,null))['catch'](handleError(_0x3eab10,null));};exports[_0xd8d7('0x48')]=function(_0xe8da7a,_0x4d5754){return db['ZohoAccount'][_0xd8d7('0x48')](_0xe8da7a[_0xd8d7('0x49')],{})[_0xd8d7('0x25')](respondWithResult(_0x4d5754,0xc9))[_0xd8d7('0x42')](handleError(_0x4d5754,null));};exports['update']=function(_0x581be1,_0xbdae6b){if(_0x581be1['body']['id']){delete _0x581be1[_0xd8d7('0x49')]['id'];}return db[_0xd8d7('0x2b')][_0xd8d7('0x47')]({'where':{'id':_0x581be1[_0xd8d7('0x44')]['id']}})[_0xd8d7('0x25')](handleEntityNotFound(_0xbdae6b,null))['then'](saveUpdates(_0x581be1[_0xd8d7('0x49')],null))[_0xd8d7('0x25')](respondWithResult(_0xbdae6b,null))[_0xd8d7('0x42')](handleError(_0xbdae6b,null));};exports[_0xd8d7('0x4a')]=function(_0x2ed109,_0x4cf105){return db[_0xd8d7('0x2b')]['find']({'where':{'id':_0x2ed109[_0xd8d7('0x44')]['id']}})[_0xd8d7('0x25')](handleEntityNotFound(_0x4cf105,null))['then'](removeEntity(_0x4cf105,null))[_0xd8d7('0x42')](handleError(_0x4cf105,null));};exports[_0xd8d7('0x4b')]=function(_0x5c26a0,_0x2e8473,_0x317d30){var _0x575e9a={};var _0xf8c3dc={};var _0x578322;var _0x2c2f3a;return db['ZohoAccount'][_0xd8d7('0x4c')]({'where':{'id':_0x5c26a0[_0xd8d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e8473,null))[_0xd8d7('0x25')](function(_0x465954){if(_0x465954){_0x578322=_0x465954;_0xf8c3dc[_0xd8d7('0x30')]=_[_0xd8d7('0x32')](db[_0xd8d7('0x4d')][_0xd8d7('0x2c')]);_0xf8c3dc[_0xd8d7('0x31')]=_['keys'](_0x5c26a0[_0xd8d7('0x31')]);_0xf8c3dc[_0xd8d7('0x33')]=_['intersection'](_0xf8c3dc[_0xd8d7('0x30')],_0xf8c3dc[_0xd8d7('0x31')]);_0x575e9a[_0xd8d7('0x34')]=_[_0xd8d7('0x45')](_0xf8c3dc[_0xd8d7('0x30')],qs[_0xd8d7('0x35')](_0x5c26a0[_0xd8d7('0x31')][_0xd8d7('0x35')]));_0x575e9a['attributes']=_0x575e9a[_0xd8d7('0x34')]['length']?_0x575e9a[_0xd8d7('0x34')]:_0xf8c3dc[_0xd8d7('0x30')];_0x575e9a[_0xd8d7('0x4e')]=qs[_0xd8d7('0x38')](_0x5c26a0[_0xd8d7('0x31')][_0xd8d7('0x38')]);_0x575e9a[_0xd8d7('0x39')]=qs[_0xd8d7('0x33')](_[_0xd8d7('0x3a')](_0x5c26a0[_0xd8d7('0x31')],_0xf8c3dc[_0xd8d7('0x33')]));if(_0x5c26a0['query'][_0xd8d7('0x3b')]){_0x575e9a[_0xd8d7('0x39')]=_[_0xd8d7('0x3c')](_0x575e9a[_0xd8d7('0x39')],{'$or':_['map'](_0x575e9a[_0xd8d7('0x34')],function(_0x46dd75){var _0x3bd981={};_0x3bd981[_0x46dd75]={'$like':'%'+_0x5c26a0[_0xd8d7('0x31')]['filter']+'%'};return _0x3bd981;})});}_0x575e9a=_[_0xd8d7('0x3c')]({},_0x575e9a,_0x5c26a0[_0xd8d7('0x3e')]);return _0x578322[_0xd8d7('0x4b')](_0x575e9a);}})[_0xd8d7('0x25')](function(_0x36a352){if(_0x36a352){_0x2c2f3a=_0x36a352[_0xd8d7('0x36')];if(!_0x5c26a0[_0xd8d7('0x31')][_0xd8d7('0x37')](_0xd8d7('0x4f'))){_0x575e9a[_0xd8d7('0x20')]=qs[_0xd8d7('0x20')](_0x5c26a0['query']['limit']);_0x575e9a[_0xd8d7('0x1f')]=qs[_0xd8d7('0x1f')](_0x5c26a0[_0xd8d7('0x31')][_0xd8d7('0x1f')]);}return _0x578322['getConfigurations'](_0x575e9a);}})[_0xd8d7('0x25')](function(_0x58421b){if(_0x58421b){return _0x58421b?{'count':_0x2c2f3a,'rows':_0x58421b}:null;}})[_0xd8d7('0x25')](respondWithResult(_0x2e8473,null))['catch'](handleError(_0x2e8473,null));};exports[_0xd8d7('0x50')]=function(_0x583981,_0x44c497,_0x530eae){if(_0x583981[_0xd8d7('0x49')]['id']){delete _0x583981[_0xd8d7('0x49')]['id'];}return db[_0xd8d7('0x2b')][_0xd8d7('0x4c')]({'where':{'id':_0x583981[_0xd8d7('0x44')]['id']}})[_0xd8d7('0x25')](handleEntityNotFound(_0x44c497,null))[_0xd8d7('0x25')](function(_0x3f7266){if(_0x3f7266){_0x583981[_0xd8d7('0x49')][_0xd8d7('0x51')]=_0x3f7266['id'];_0x583981[_0xd8d7('0x49')][_0xd8d7('0x52')]=integrations[_0xd8d7('0x53')](_0x583981['body'][_0xd8d7('0x54')],_0x583981[_0xd8d7('0x49')]['type']);_0x583981[_0xd8d7('0x49')][_0xd8d7('0x55')]=integrations['getDescriptions'](_0x583981[_0xd8d7('0x49')][_0xd8d7('0x54')],_0x583981[_0xd8d7('0x49')][_0xd8d7('0x2e')]);return db[_0xd8d7('0x4d')][_0xd8d7('0x48')](_0x583981[_0xd8d7('0x49')],{'include':[{'model':db[_0xd8d7('0x56')],'as':_0xd8d7('0x52')},{'model':db[_0xd8d7('0x56')],'as':_0xd8d7('0x55')}]});}return null;})[_0xd8d7('0x25')](respondWithResult(_0x44c497,null))[_0xd8d7('0x42')](handleError(_0x44c497,null));};function getAccessToken(_0x10cf82){return new Promise(function(_0xda4c4,_0xd945a6){var _0x58495e;switch(_0x10cf82[_0xd8d7('0x57')]){case'US':_0x58495e=_0xd8d7('0x58');break;case'AU':_0x58495e=_0xd8d7('0x59');break;case'EU':_0x58495e=_0xd8d7('0x5a');break;case'IN':_0x58495e='https://accounts.zoho.in';break;case'CN':_0x58495e='https://accounts.zoho.com.cn';break;default:_0x58495e='https://accounts.zoho.eu';break;}var _0x3aebd3={'method':'POST','uri':_0x58495e+_0xd8d7('0x5b'),'qs':{'refresh_token':_0x10cf82[_0xd8d7('0x5c')],'client_id':_0x10cf82[_0xd8d7('0x5d')],'client_secret':_0x10cf82[_0xd8d7('0x5e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3aebd3)[_0xd8d7('0x25')](function(_0x53ef59){if(_0x53ef59[_0xd8d7('0x5f')]){_0xda4c4(_0x53ef59[_0xd8d7('0x5f')]);}else{_0xd945a6('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd8d7('0x42')](function(_0x553e45){_0xd945a6(_0x553e45);});});}exports['getFields']=function(_0x1cd210,_0x23e399,_0x2d2e47){var _0x3b9cc4,_0x3c9bd2,_0x167e5a,_0x1ab0cd,_0xc3d40d;return db[_0xd8d7('0x2b')][_0xd8d7('0x4c')]({'where':{'id':_0x1cd210[_0xd8d7('0x44')]['id']},'attributes':['id','host',_0xd8d7('0x57'),'clientId',_0xd8d7('0x5e'),_0xd8d7('0x60'),_0xd8d7('0x61'),_0xd8d7('0x5c')]})[_0xd8d7('0x25')](handleEntityNotFound(_0x23e399,null))[_0xd8d7('0x25')](function(_0xc96692){_0xc3d40d=_0xc96692;_0x3b9cc4=_0xc3d40d[_0xd8d7('0x62')];_0x3c9bd2=_0x3b9cc4==='zoho.eu'?'eu':_0xd8d7('0x63');_0x167e5a=_0xc3d40d[_0xd8d7('0x60')];var _0x2901b3=_0x167e5a['slice'](-0x1);if(_0x2901b3==='/'||_0x2901b3==='\x5c'||_0x2901b3===':'){_0x167e5a=_0x167e5a[_0xd8d7('0x64')](0x0,_0x167e5a[_0xd8d7('0x65')](_0x2901b3));}if(!_0xc3d40d['refreshToken']){throw new Error(_0xd8d7('0x66'));}return getAccessToken(_0xc3d40d);})['then'](function(_0x373546){if(_0x373546){return rp({'method':'GET','uri':util[_0xd8d7('0x67')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3c9bd2),'qs':{'module':_0xd8d7('0x68')},'headers':{'Authorization':_0xd8d7('0x69')+_0x373546},'json':!![]});}})['then'](function(_0x214d12){if(_0x214d12){if(_0x214d12[_0xd8d7('0x6a')]&&_0x214d12[_0xd8d7('0x6a')][_0xd8d7('0x26')]){throw new Error(_0x214d12[_0xd8d7('0x6a')][_0xd8d7('0x26')][_0xd8d7('0x6b')]);}var _0x11640f=[];var _0x26ba7b=[];var _0x460451=[_0xd8d7('0x6c'),_0xd8d7('0x6d'),'Description',_0xd8d7('0x6e'),'Call_Duration',_0xd8d7('0x6f'),_0xd8d7('0x70'),_0xd8d7('0x71')];_0x26ba7b=_['remove'](_0x214d12['fields'],function(_0x2ec30c){return _0x460451[_0xd8d7('0x72')](_0x2ec30c[_0xd8d7('0x73')]);});for(var _0x41901a=0x0;_0x41901a<_0x26ba7b['length'];_0x41901a++){if(_0x26ba7b[_0x41901a][_0xd8d7('0x74')]===![]){_0x11640f[_0xd8d7('0x75')]({'id':_0x26ba7b[_0x41901a]['id'],'name':_0x26ba7b[_0x41901a]['display_label'],'custom':_0x26ba7b[_0x41901a]['custom_field'],'options':_0x26ba7b[_0x41901a]['data_type']===_0xd8d7('0x76')&&_0x26ba7b[_0x41901a][_0xd8d7('0x77')][_0xd8d7('0x36')]>-0x1?_[_0xd8d7('0x2a')](_0x26ba7b[_0x41901a]['pick_list_values'],function(_0x125d27){return{'name':_0x125d27,'value':_0x125d27};}):[]});}}return{'count':_0x11640f[_0xd8d7('0x36')],'rows':_0x11640f};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x23e399,null))[_0xd8d7('0x42')](function(_0x5f2da3){var _0xff1a7=_0x1cd210['query'][_0xd8d7('0x78')]?0x1f4:_0x5f2da3['statusCode']||0x1f4;logger[_0xd8d7('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xd8d7('0x79'),_0xff1a7,JSON[_0xd8d7('0x7a')](_0x5f2da3));delete _0x5f2da3[_0xd8d7('0x28')];if(_0xff1a7===0x191){_0xff1a7=0x190;}_0x23e399['status'](_0xff1a7)[_0xd8d7('0x7b')](_0x1cd210[_0xd8d7('0x31')][_0xd8d7('0x78')]?{'message':_0xd8d7('0x7c'),'statusCode':_0x5f2da3[_0xd8d7('0x7d')]}:_0x5f2da3);});}; \ No newline at end of file +var _0xd128=['options','includeAll','findAll','catch','show','keys','rawAttributes','find','create','body','params','ZohoConfiguration','order','pick','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','com','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_Duration','Call_Result','Call_Start_Time','Call_Type','api_name','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','save','update','destroy','then','end','error','name','send','index','map','ZohoAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xd128,0x1b2));var _0x8d12=function(_0x5b7a2c,_0x1fee8b){_0x5b7a2c=_0x5b7a2c-0x0;var _0x1179fc=_0xd128[_0x5b7a2c];return _0x1179fc;};'use strict';var emlformat=require(_0x8d12('0x0'));var rimraf=require(_0x8d12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d12('0x2'));var rp=require(_0x8d12('0x3'));var moment=require('moment');var BPromise=require(_0x8d12('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8d12('0x5'));var sox=require(_0x8d12('0x6'));var csv=require(_0x8d12('0x7'));var ejs=require(_0x8d12('0x8'));var fs=require('fs');var fs_extra=require(_0x8d12('0x9'));var _=require('lodash');var squel=require(_0x8d12('0xa'));var crypto=require(_0x8d12('0xb'));var jsforce=require(_0x8d12('0xc'));var deskjs=require(_0x8d12('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d12('0xe'));var Papa=require(_0x8d12('0xf'));var Redis=require('ioredis');var authService=require(_0x8d12('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8d12('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d12('0x12'))(_0x8d12('0x13'));var utils=require(_0x8d12('0x14'));var config=require(_0x8d12('0x15'));var licenseUtil=require(_0x8d12('0x16'));var db=require(_0x8d12('0x17'))['db'];var integrations=require(_0x8d12('0x18'));function respondWithStatusCode(_0x32a611,_0x26f7e8){_0x26f7e8=_0x26f7e8||0xcc;return function(_0x3b7b9b){if(_0x3b7b9b){return _0x32a611[_0x8d12('0x19')](_0x26f7e8);}return _0x32a611[_0x8d12('0x1a')](_0x26f7e8)['end']();};}function respondWithResult(_0x4e5fe2,_0x19141e){_0x19141e=_0x19141e||0xc8;return function(_0x270423){if(_0x270423){return _0x4e5fe2['status'](_0x19141e)[_0x8d12('0x1b')](_0x270423);}};}function respondWithFilteredResult(_0x366961,_0x1a694e){return function(_0x3a5b44){if(_0x3a5b44){var _0x3c2a7c=typeof _0x1a694e[_0x8d12('0x1c')]===_0x8d12('0x1d')&&typeof _0x1a694e['limit']==='undefined';var _0x433199=_0x3a5b44[_0x8d12('0x1e')];var _0x4e0143=_0x3c2a7c?0x0:_0x1a694e['offset'];var _0x2dcf07=_0x3c2a7c?_0x3a5b44['count']:_0x1a694e[_0x8d12('0x1c')]+_0x1a694e[_0x8d12('0x1f')];var _0xa241c;if(_0x2dcf07>=_0x433199){_0x2dcf07=_0x433199;_0xa241c=0xc8;}else{_0xa241c=0xce;}_0x366961['status'](_0xa241c);return _0x366961[_0x8d12('0x20')]('Content-Range',_0x4e0143+'-'+_0x2dcf07+'/'+_0x433199)[_0x8d12('0x1b')](_0x3a5b44);}return null;};}function patchUpdates(_0x40fa9a){return function(_0x51b977){try{jsonpatch['apply'](_0x51b977,_0x40fa9a,!![]);}catch(_0x2a19b8){return BPromise['reject'](_0x2a19b8);}return _0x51b977[_0x8d12('0x21')]();};}function saveUpdates(_0x57cc6b,_0x3b4c97){return function(_0x1fd3ed){if(_0x1fd3ed){return _0x1fd3ed[_0x8d12('0x22')](_0x57cc6b)['then'](function(_0x3e3256){return _0x3e3256;});}return null;};}function removeEntity(_0x2c761,_0x1f6099){return function(_0x3428a3){if(_0x3428a3){return _0x3428a3[_0x8d12('0x23')]()[_0x8d12('0x24')](function(){_0x2c761['status'](0xcc)[_0x8d12('0x25')]();});}};}function handleEntityNotFound(_0x5a8e36,_0x311abf){return function(_0x4a7790){if(!_0x4a7790){_0x5a8e36[_0x8d12('0x19')](0x194);}return _0x4a7790;};}function handleError(_0x24221c,_0x44a31e){_0x44a31e=_0x44a31e||0x1f4;return function(_0x5ef0d0){logger[_0x8d12('0x26')](_0x5ef0d0['stack']);if(_0x5ef0d0[_0x8d12('0x27')]){delete _0x5ef0d0[_0x8d12('0x27')];}_0x24221c['status'](_0x44a31e)[_0x8d12('0x28')](_0x5ef0d0);};}exports[_0x8d12('0x29')]=function(_0x1a0fc,_0x35d0e5){var _0x39d18a={},_0x11e25f={},_0x244bb5={'count':0x0,'rows':[]};var _0x2faa72=_[_0x8d12('0x2a')](db[_0x8d12('0x2b')]['rawAttributes'],function(_0x2850d6){return{'name':_0x2850d6[_0x8d12('0x2c')],'type':_0x2850d6[_0x8d12('0x2d')]['key']};});_0x11e25f[_0x8d12('0x2e')]=_[_0x8d12('0x2a')](_0x2faa72,_0x8d12('0x27'));_0x11e25f[_0x8d12('0x2f')]=_['keys'](_0x1a0fc['query']);_0x11e25f[_0x8d12('0x30')]=_[_0x8d12('0x31')](_0x11e25f[_0x8d12('0x2e')],_0x11e25f['query']);_0x39d18a[_0x8d12('0x32')]=_[_0x8d12('0x31')](_0x11e25f[_0x8d12('0x2e')],qs[_0x8d12('0x33')](_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x33')]));_0x39d18a[_0x8d12('0x32')]=_0x39d18a[_0x8d12('0x32')][_0x8d12('0x34')]?_0x39d18a[_0x8d12('0x32')]:_0x11e25f[_0x8d12('0x2e')];if(!_0x1a0fc[_0x8d12('0x2f')]['hasOwnProperty']('nolimit')){_0x39d18a['limit']=qs[_0x8d12('0x1f')](_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x1f')]);_0x39d18a['offset']=qs[_0x8d12('0x1c')](_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x1c')]);}_0x39d18a['order']=qs['sort'](_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x35')]);_0x39d18a[_0x8d12('0x36')]=qs[_0x8d12('0x30')](_['pick'](_0x1a0fc[_0x8d12('0x2f')],_0x11e25f[_0x8d12('0x30')]),_0x2faa72);if(_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x37')]){_0x39d18a[_0x8d12('0x36')]=_[_0x8d12('0x38')](_0x39d18a[_0x8d12('0x36')],{'$or':_[_0x8d12('0x2a')](_0x2faa72,function(_0x215ddd){if(_0x215ddd[_0x8d12('0x2d')]!==_0x8d12('0x39')){var _0x4580e8={};_0x4580e8[_0x215ddd[_0x8d12('0x27')]]={'$like':'%'+_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x37')]+'%'};return _0x4580e8;}})});}_0x39d18a=_[_0x8d12('0x38')]({},_0x39d18a,_0x1a0fc[_0x8d12('0x3a')]);var _0xe74244={'where':_0x39d18a[_0x8d12('0x36')]};return db[_0x8d12('0x2b')][_0x8d12('0x1e')](_0xe74244)['then'](function(_0x284db6){_0x244bb5[_0x8d12('0x1e')]=_0x284db6;if(_0x1a0fc[_0x8d12('0x2f')][_0x8d12('0x3b')]){_0x39d18a['include']=[{'all':!![]}];}return db[_0x8d12('0x2b')][_0x8d12('0x3c')](_0x39d18a);})[_0x8d12('0x24')](function(_0x101f93){_0x244bb5['rows']=_0x101f93;return _0x244bb5;})[_0x8d12('0x24')](respondWithFilteredResult(_0x35d0e5,_0x39d18a))[_0x8d12('0x3d')](handleError(_0x35d0e5,null));};exports[_0x8d12('0x3e')]=function(_0x4b3998,_0x138399){var _0x35b1f1={'raw':![],'where':{'id':_0x4b3998['params']['id']}},_0x703917={};_0x703917[_0x8d12('0x2e')]=_[_0x8d12('0x3f')](db['ZohoAccount'][_0x8d12('0x40')]);_0x703917[_0x8d12('0x2f')]=_[_0x8d12('0x3f')](_0x4b3998[_0x8d12('0x2f')]);_0x703917[_0x8d12('0x30')]=_[_0x8d12('0x31')](_0x703917[_0x8d12('0x2e')],_0x703917[_0x8d12('0x2f')]);_0x35b1f1[_0x8d12('0x32')]=_['intersection'](_0x703917[_0x8d12('0x2e')],qs['fields'](_0x4b3998['query'][_0x8d12('0x33')]));_0x35b1f1[_0x8d12('0x32')]=_0x35b1f1['attributes']['length']?_0x35b1f1[_0x8d12('0x32')]:_0x703917[_0x8d12('0x2e')];if(_0x4b3998[_0x8d12('0x2f')]['includeAll']){_0x35b1f1['include']=[{'all':!![]}];}_0x35b1f1=_[_0x8d12('0x38')]({},_0x35b1f1,_0x4b3998[_0x8d12('0x3a')]);return db[_0x8d12('0x2b')][_0x8d12('0x41')](_0x35b1f1)[_0x8d12('0x24')](handleEntityNotFound(_0x138399,null))[_0x8d12('0x24')](respondWithResult(_0x138399,null))[_0x8d12('0x3d')](handleError(_0x138399,null));};exports[_0x8d12('0x42')]=function(_0x55a4c5,_0x448022){return db[_0x8d12('0x2b')][_0x8d12('0x42')](_0x55a4c5[_0x8d12('0x43')],{})[_0x8d12('0x24')](respondWithResult(_0x448022,0xc9))['catch'](handleError(_0x448022,null));};exports[_0x8d12('0x22')]=function(_0x3d4b8a,_0x3be296){if(_0x3d4b8a[_0x8d12('0x43')]['id']){delete _0x3d4b8a[_0x8d12('0x43')]['id'];}return db[_0x8d12('0x2b')][_0x8d12('0x41')]({'where':{'id':_0x3d4b8a[_0x8d12('0x44')]['id']}})[_0x8d12('0x24')](handleEntityNotFound(_0x3be296,null))[_0x8d12('0x24')](saveUpdates(_0x3d4b8a[_0x8d12('0x43')],null))[_0x8d12('0x24')](respondWithResult(_0x3be296,null))[_0x8d12('0x3d')](handleError(_0x3be296,null));};exports[_0x8d12('0x23')]=function(_0x39d8cc,_0x3a471e){return db[_0x8d12('0x2b')]['find']({'where':{'id':_0x39d8cc[_0x8d12('0x44')]['id']}})[_0x8d12('0x24')](handleEntityNotFound(_0x3a471e,null))['then'](removeEntity(_0x3a471e,null))[_0x8d12('0x3d')](handleError(_0x3a471e,null));};exports['getConfigurations']=function(_0x429cd1,_0x1e1200,_0x14dd05){var _0xccf96c={};var _0x39e16d={};var _0x552a9e;var _0x2b3954;return db[_0x8d12('0x2b')]['findOne']({'where':{'id':_0x429cd1[_0x8d12('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e1200,null))['then'](function(_0x12341f){if(_0x12341f){_0x552a9e=_0x12341f;_0x39e16d[_0x8d12('0x2e')]=_[_0x8d12('0x3f')](db[_0x8d12('0x45')][_0x8d12('0x40')]);_0x39e16d[_0x8d12('0x2f')]=_[_0x8d12('0x3f')](_0x429cd1['query']);_0x39e16d[_0x8d12('0x30')]=_['intersection'](_0x39e16d[_0x8d12('0x2e')],_0x39e16d[_0x8d12('0x2f')]);_0xccf96c[_0x8d12('0x32')]=_[_0x8d12('0x31')](_0x39e16d[_0x8d12('0x2e')],qs[_0x8d12('0x33')](_0x429cd1[_0x8d12('0x2f')]['fields']));_0xccf96c[_0x8d12('0x32')]=_0xccf96c[_0x8d12('0x32')][_0x8d12('0x34')]?_0xccf96c['attributes']:_0x39e16d[_0x8d12('0x2e')];_0xccf96c[_0x8d12('0x46')]=qs[_0x8d12('0x35')](_0x429cd1['query']['sort']);_0xccf96c['where']=qs[_0x8d12('0x30')](_[_0x8d12('0x47')](_0x429cd1[_0x8d12('0x2f')],_0x39e16d[_0x8d12('0x30')]));if(_0x429cd1[_0x8d12('0x2f')][_0x8d12('0x37')]){_0xccf96c[_0x8d12('0x36')]=_[_0x8d12('0x38')](_0xccf96c[_0x8d12('0x36')],{'$or':_[_0x8d12('0x2a')](_0xccf96c[_0x8d12('0x32')],function(_0x46b43a){var _0x27760a={};_0x27760a[_0x46b43a]={'$like':'%'+_0x429cd1[_0x8d12('0x2f')]['filter']+'%'};return _0x27760a;})});}_0xccf96c=_['merge']({},_0xccf96c,_0x429cd1['options']);return _0x552a9e[_0x8d12('0x48')](_0xccf96c);}})[_0x8d12('0x24')](function(_0x10f368){if(_0x10f368){_0x2b3954=_0x10f368[_0x8d12('0x34')];if(!_0x429cd1[_0x8d12('0x2f')][_0x8d12('0x49')]('nolimit')){_0xccf96c[_0x8d12('0x1f')]=qs['limit'](_0x429cd1[_0x8d12('0x2f')][_0x8d12('0x1f')]);_0xccf96c['offset']=qs['offset'](_0x429cd1[_0x8d12('0x2f')]['offset']);}return _0x552a9e[_0x8d12('0x48')](_0xccf96c);}})['then'](function(_0x5f4bb7){if(_0x5f4bb7){return _0x5f4bb7?{'count':_0x2b3954,'rows':_0x5f4bb7}:null;}})[_0x8d12('0x24')](respondWithResult(_0x1e1200,null))[_0x8d12('0x3d')](handleError(_0x1e1200,null));};exports['addConfiguration']=function(_0xd5e771,_0x48014e,_0x54ee1e){if(_0xd5e771[_0x8d12('0x43')]['id']){delete _0xd5e771[_0x8d12('0x43')]['id'];}return db[_0x8d12('0x2b')][_0x8d12('0x4a')]({'where':{'id':_0xd5e771[_0x8d12('0x44')]['id']}})['then'](handleEntityNotFound(_0x48014e,null))[_0x8d12('0x24')](function(_0x2c3e45){if(_0x2c3e45){_0xd5e771[_0x8d12('0x43')][_0x8d12('0x4b')]=_0x2c3e45['id'];_0xd5e771[_0x8d12('0x43')][_0x8d12('0x4c')]=integrations[_0x8d12('0x4d')](_0xd5e771[_0x8d12('0x43')]['channel'],_0xd5e771['body'][_0x8d12('0x2d')]);_0xd5e771[_0x8d12('0x43')][_0x8d12('0x4e')]=integrations['getDescriptions'](_0xd5e771['body'][_0x8d12('0x4f')],_0xd5e771[_0x8d12('0x43')][_0x8d12('0x2d')]);return db[_0x8d12('0x45')]['create'](_0xd5e771[_0x8d12('0x43')],{'include':[{'model':db[_0x8d12('0x50')],'as':'Subjects'},{'model':db[_0x8d12('0x50')],'as':_0x8d12('0x4e')}]});}return null;})[_0x8d12('0x24')](respondWithResult(_0x48014e,null))[_0x8d12('0x3d')](handleError(_0x48014e,null));};function getAccessToken(_0x125ea4){return new Promise(function(_0x26c348,_0x223d58){var _0x5ef8fb;switch(_0x125ea4[_0x8d12('0x51')]){case'US':_0x5ef8fb=_0x8d12('0x52');break;case'AU':_0x5ef8fb=_0x8d12('0x53');break;case'EU':_0x5ef8fb=_0x8d12('0x54');break;case'IN':_0x5ef8fb='https://accounts.zoho.in';break;case'CN':_0x5ef8fb=_0x8d12('0x55');break;default:_0x5ef8fb='https://accounts.zoho.eu';break;}var _0x36cf44={'method':_0x8d12('0x56'),'uri':_0x5ef8fb+_0x8d12('0x57'),'qs':{'refresh_token':_0x125ea4[_0x8d12('0x58')],'client_id':_0x125ea4[_0x8d12('0x59')],'client_secret':_0x125ea4[_0x8d12('0x5a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x36cf44)['then'](function(_0x5908dc){if(_0x5908dc[_0x8d12('0x5b')]){_0x26c348(_0x5908dc[_0x8d12('0x5b')]);}else{_0x223d58(_0x8d12('0x5c'));}})[_0x8d12('0x3d')](function(_0x59c25f){_0x223d58(_0x59c25f);});});}exports['getFields']=function(_0x4bcbe0,_0x71c817,_0x4117f8){var _0x318ea2,_0x28295d,_0x2282cc,_0x181aec,_0x69c7bc;return db[_0x8d12('0x2b')][_0x8d12('0x4a')]({'where':{'id':_0x4bcbe0[_0x8d12('0x44')]['id']},'attributes':['id',_0x8d12('0x5d'),_0x8d12('0x51'),_0x8d12('0x59'),_0x8d12('0x5a'),_0x8d12('0x5e'),_0x8d12('0x5f'),'refreshToken']})['then'](handleEntityNotFound(_0x71c817,null))[_0x8d12('0x24')](function(_0x41e417){_0x69c7bc=_0x41e417;_0x318ea2=_0x69c7bc[_0x8d12('0x5d')];_0x28295d=_0x318ea2==='zoho.eu'?'eu':_0x8d12('0x60');_0x2282cc=_0x69c7bc['serverUrl'];var _0x1f4ad6=_0x2282cc['slice'](-0x1);if(_0x1f4ad6==='/'||_0x1f4ad6==='\x5c'||_0x1f4ad6===':'){_0x2282cc=_0x2282cc['substring'](0x0,_0x2282cc['lastIndexOf'](_0x1f4ad6));}if(!_0x69c7bc[_0x8d12('0x58')]){throw new Error(_0x8d12('0x61'));}return getAccessToken(_0x69c7bc);})[_0x8d12('0x24')](function(_0x418a2c){if(_0x418a2c){return rp({'method':_0x8d12('0x62'),'uri':util[_0x8d12('0x63')](_0x8d12('0x64'),_0x28295d),'qs':{'module':_0x8d12('0x65')},'headers':{'Authorization':_0x8d12('0x66')+_0x418a2c},'json':!![]});}})[_0x8d12('0x24')](function(_0x3986b6){if(_0x3986b6){if(_0x3986b6['response']&&_0x3986b6[_0x8d12('0x67')][_0x8d12('0x26')]){throw new Error(_0x3986b6[_0x8d12('0x67')][_0x8d12('0x26')][_0x8d12('0x68')]);}var _0x463a7c=[];var _0x37c930=[];var _0x4a6b84=[_0x8d12('0x69'),_0x8d12('0x6a'),_0x8d12('0x6b'),_0x8d12('0x6c'),_0x8d12('0x6d'),_0x8d12('0x6e'),_0x8d12('0x6f'),_0x8d12('0x70')];_0x37c930=_['remove'](_0x3986b6[_0x8d12('0x33')],function(_0x4060fc){return _0x4a6b84['includes'](_0x4060fc[_0x8d12('0x71')]);});for(var _0x5ecc38=0x0;_0x5ecc38<_0x37c930[_0x8d12('0x34')];_0x5ecc38++){if(_0x37c930[_0x5ecc38]['system_mandatory']===![]){_0x463a7c[_0x8d12('0x72')]({'id':_0x37c930[_0x5ecc38]['id'],'name':_0x37c930[_0x5ecc38][_0x8d12('0x73')],'custom':_0x37c930[_0x5ecc38][_0x8d12('0x74')],'options':_0x37c930[_0x5ecc38][_0x8d12('0x75')]==='picklist'&&_0x37c930[_0x5ecc38][_0x8d12('0x76')][_0x8d12('0x34')]>-0x1?_['map'](_0x37c930[_0x5ecc38][_0x8d12('0x76')],function(_0x560886){return{'name':_0x560886,'value':_0x560886};}):[]});}}return{'count':_0x463a7c[_0x8d12('0x34')],'rows':_0x463a7c};}else{return{'count':0x0,'rows':[]};}})[_0x8d12('0x24')](respondWithResult(_0x71c817,null))[_0x8d12('0x3d')](function(_0x2bdfaf){var _0x391ade=_0x4bcbe0[_0x8d12('0x2f')]['test']?0x1f4:_0x2bdfaf[_0x8d12('0x77')]||0x1f4;logger[_0x8d12('0x26')](_0x8d12('0x78'),'getFields',_0x391ade,JSON['stringify'](_0x2bdfaf));delete _0x2bdfaf[_0x8d12('0x27')];if(_0x391ade===0x191){_0x391ade=0x190;}_0x71c817['status'](_0x391ade)['send'](_0x4bcbe0[_0x8d12('0x2f')][_0x8d12('0x79')]?{'message':_0x8d12('0x7a'),'statusCode':_0x2bdfaf['statusCode']}:_0x2bdfaf);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e8f7800..4b32af5 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 _0xb0f5=['application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','zone','host','lastIndexOf','POST','then','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','slice','substring','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'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb0f5,0xc5));var _0x5b0f=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xb0f5[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x5b0f('0x0'));var util=require(_0x5b0f('0x1'));var logger=require(_0x5b0f('0x2'))(_0x5b0f('0x3'));var moment=require('moment');var BPromise=require(_0x5b0f('0x4'));var rp=require(_0x5b0f('0x5'));var fs=require('fs');var path=require(_0x5b0f('0x6'));var rimraf=require(_0x5b0f('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b0f('0x8'));var integrations=require(_0x5b0f('0x9'));module[_0x5b0f('0xa')]=function(_0x1f80a2,_0x2a9a66){return _0x1f80a2[_0x5b0f('0xb')](_0x5b0f('0xc'),attributes,{'tableName':_0x5b0f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26e58c,_0x36e595,_0x1a7ce3){if(_0x26e58c[_0x5b0f('0xe')]('zone')||_0x26e58c[_0x5b0f('0xe')](_0x5b0f('0xf'))||_0x26e58c[_0x5b0f('0xe')](_0x5b0f('0x10'))||_0x26e58c[_0x5b0f('0xe')](_0x5b0f('0x11'))||_0x26e58c[_0x5b0f('0xe')](_0x5b0f('0x12'))||_0x26e58c['changed']('host')){var _0x9d7b50,_0x61d192;_0x9d7b50=_0x26e58c[_0x5b0f('0xf')];var _0x16d1b0=_0x9d7b50[_0x5b0f('0x13')](-0x1);if(_0x16d1b0==='/'||_0x16d1b0==='\x5c'||_0x16d1b0===':'){_0x9d7b50=_0x9d7b50[_0x5b0f('0x14')](0x0,_0x9d7b50['lastIndexOf'](_0x16d1b0));}switch(_0x26e58c['zone']){case'US':_0x61d192=_0x5b0f('0x15');break;case'AU':_0x61d192=_0x5b0f('0x16');break;case'IN':_0x61d192=_0x5b0f('0x17');break;case'CN':_0x61d192=_0x5b0f('0x18');break;default:_0x61d192=_0x5b0f('0x19');break;}var _0xf9e8ab={'method':'POST','uri':_0x61d192+_0x5b0f('0x1a'),'form':{'grant_type':_0x5b0f('0x1b'),'client_id':_0x26e58c['clientId'],'client_secret':_0x26e58c[_0x5b0f('0x11')],'redirect_uri':_0x26e58c['serverUrl'],'code':_0x26e58c[_0x5b0f('0x12')]},'headers':{'Content-Type':_0x5b0f('0x1c')}};return rp(_0xf9e8ab)['then'](function(_0x4c9820){var _0xd9437e=JSON[_0x5b0f('0x1d')](_0x4c9820);if(_0xd9437e[_0x5b0f('0x1e')]){_0x26e58c[_0x5b0f('0x1f')]=_0xd9437e[_0x5b0f('0x1e')];logger[_0x5b0f('0x20')](util['format'](_0x5b0f('0x21'),_0x26e58c['name'],_0x26e58c['id']));}else{logger[_0x5b0f('0x22')](util[_0x5b0f('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26e58c['name'],_0x26e58c['id']),util['inspect'](_0xd9437e,{'showHidden':![],'depth':null}));}return _0x1a7ce3(null,_0x36e595);})['catch'](function(_0x1cbf80){logger['error'](util[_0x5b0f('0x23')](_0x5b0f('0x24'),_0x26e58c[_0x5b0f('0x25')],_0x26e58c['id']),util[_0x5b0f('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1a7ce3(_0x1cbf80);});}else{return _0x1a7ce3(null,_0x36e595);}},'beforeUpdate':function(_0x5b4bdf,_0xfaff85,_0x42281b){if(_0x5b4bdf[_0x5b0f('0xe')](_0x5b0f('0x27'))||_0x5b4bdf[_0x5b0f('0xe')](_0x5b0f('0xf'))||_0x5b4bdf[_0x5b0f('0xe')](_0x5b0f('0x10'))||_0x5b4bdf['changed'](_0x5b0f('0x11'))||_0x5b4bdf[_0x5b0f('0xe')]('code')||_0x5b4bdf[_0x5b0f('0xe')](_0x5b0f('0x28'))){var _0x3cb757,_0x158221;_0x3cb757=_0x5b4bdf[_0x5b0f('0xf')];var _0x5789b6=_0x3cb757[_0x5b0f('0x13')](-0x1);if(_0x5789b6==='/'||_0x5789b6==='\x5c'||_0x5789b6===':'){_0x3cb757=_0x3cb757[_0x5b0f('0x14')](0x0,_0x3cb757[_0x5b0f('0x29')](_0x5789b6));}switch(_0x5b4bdf['zone']){case'US':_0x158221='https://accounts.zoho.com';break;case'AU':_0x158221=_0x5b0f('0x16');break;case'IN':_0x158221=_0x5b0f('0x17');break;case'CN':_0x158221=_0x5b0f('0x18');break;default:_0x158221=_0x5b0f('0x19');break;}var _0x20aaee={'method':_0x5b0f('0x2a'),'uri':_0x158221+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5b4bdf[_0x5b0f('0x10')],'client_secret':_0x5b4bdf['clientSecret'],'redirect_uri':_0x5b4bdf[_0x5b0f('0xf')],'code':_0x5b4bdf['code']},'headers':{'Content-Type':_0x5b0f('0x1c')}};return rp(_0x20aaee)[_0x5b0f('0x2b')](function(_0x3cad48){var _0x86fece=JSON[_0x5b0f('0x1d')](_0x3cad48);if(_0x86fece[_0x5b0f('0x1e')]){_0x5b4bdf['refreshToken']=_0x86fece[_0x5b0f('0x1e')];logger[_0x5b0f('0x20')](util[_0x5b0f('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5b4bdf[_0x5b0f('0x25')],_0x5b4bdf['id']));}else{logger['error'](util['format'](_0x5b0f('0x24'),_0x5b4bdf[_0x5b0f('0x25')],_0x5b4bdf['id']),util[_0x5b0f('0x26')](_0x86fece,{'showHidden':![],'depth':null}));}return _0x42281b(null,_0xfaff85);})[_0x5b0f('0x2c')](function(_0xa00eb6){logger[_0x5b0f('0x22')](util[_0x5b0f('0x23')](_0x5b0f('0x24'),_0x5b4bdf[_0x5b0f('0x25')],_0x5b4bdf['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x42281b(_0xa00eb6);});}else{return _0x42281b(null,_0xfaff85);}}}});}; \ No newline at end of file +var _0x523e=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','host','slice','https://accounts.zoho.in','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x523e,0x146));var _0xe523=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x523e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xe523('0x0'));var util=require(_0xe523('0x1'));var logger=require(_0xe523('0x2'))(_0xe523('0x3'));var moment=require(_0xe523('0x4'));var BPromise=require(_0xe523('0x5'));var rp=require(_0xe523('0x6'));var fs=require('fs');var path=require(_0xe523('0x7'));var rimraf=require(_0xe523('0x8'));var config=require(_0xe523('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xe523('0xa'));module[_0xe523('0xb')]=function(_0x5720c7,_0x4dc2a5){return _0x5720c7['define'](_0xe523('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f801c,_0x52e5af,_0x55726a){if(_0x4f801c[_0xe523('0xd')](_0xe523('0xe'))||_0x4f801c[_0xe523('0xd')](_0xe523('0xf'))||_0x4f801c[_0xe523('0xd')](_0xe523('0x10'))||_0x4f801c[_0xe523('0xd')](_0xe523('0x11'))||_0x4f801c['changed']('code')||_0x4f801c[_0xe523('0xd')]('host')){var _0x37cc65,_0x2f43a4;_0x37cc65=_0x4f801c[_0xe523('0xf')];var _0x25d7da=_0x37cc65['slice'](-0x1);if(_0x25d7da==='/'||_0x25d7da==='\x5c'||_0x25d7da===':'){_0x37cc65=_0x37cc65['substring'](0x0,_0x37cc65[_0xe523('0x12')](_0x25d7da));}switch(_0x4f801c[_0xe523('0xe')]){case'US':_0x2f43a4=_0xe523('0x13');break;case'AU':_0x2f43a4=_0xe523('0x14');break;case'IN':_0x2f43a4='https://accounts.zoho.in';break;case'CN':_0x2f43a4=_0xe523('0x15');break;default:_0x2f43a4=_0xe523('0x16');break;}var _0x462d60={'method':_0xe523('0x17'),'uri':_0x2f43a4+_0xe523('0x18'),'form':{'grant_type':_0xe523('0x19'),'client_id':_0x4f801c[_0xe523('0x10')],'client_secret':_0x4f801c[_0xe523('0x11')],'redirect_uri':_0x4f801c[_0xe523('0xf')],'code':_0x4f801c[_0xe523('0x1a')]},'headers':{'Content-Type':_0xe523('0x1b')}};return rp(_0x462d60)[_0xe523('0x1c')](function(_0x2edb40){var _0x1f562c=JSON[_0xe523('0x1d')](_0x2edb40);if(_0x1f562c['refresh_token']){_0x4f801c[_0xe523('0x1e')]=_0x1f562c[_0xe523('0x1f')];logger['info'](util[_0xe523('0x20')](_0xe523('0x21'),_0x4f801c[_0xe523('0x22')],_0x4f801c['id']));}else{logger[_0xe523('0x23')](util[_0xe523('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f801c['name'],_0x4f801c['id']),util[_0xe523('0x24')](_0x1f562c,{'showHidden':![],'depth':null}));}return _0x55726a(null,_0x52e5af);})[_0xe523('0x25')](function(_0x16bfa1){logger[_0xe523('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f801c[_0xe523('0x22')],_0x4f801c['id']),util[_0xe523('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x55726a(_0x16bfa1);});}else{return _0x55726a(null,_0x52e5af);}},'beforeUpdate':function(_0x1dd3d4,_0x2a5105,_0x32d848){if(_0x1dd3d4[_0xe523('0xd')](_0xe523('0xe'))||_0x1dd3d4[_0xe523('0xd')](_0xe523('0xf'))||_0x1dd3d4[_0xe523('0xd')]('clientId')||_0x1dd3d4[_0xe523('0xd')](_0xe523('0x11'))||_0x1dd3d4[_0xe523('0xd')](_0xe523('0x1a'))||_0x1dd3d4['changed'](_0xe523('0x26'))){var _0x4704af,_0x17e79a;_0x4704af=_0x1dd3d4[_0xe523('0xf')];var _0x1864cc=_0x4704af[_0xe523('0x27')](-0x1);if(_0x1864cc==='/'||_0x1864cc==='\x5c'||_0x1864cc===':'){_0x4704af=_0x4704af['substring'](0x0,_0x4704af[_0xe523('0x12')](_0x1864cc));}switch(_0x1dd3d4[_0xe523('0xe')]){case'US':_0x17e79a=_0xe523('0x13');break;case'AU':_0x17e79a='https://accounts.zoho.com.au';break;case'IN':_0x17e79a=_0xe523('0x28');break;case'CN':_0x17e79a='https://accounts.zoho.com.cn';break;default:_0x17e79a=_0xe523('0x16');break;}var _0x334304={'method':'POST','uri':_0x17e79a+'/oauth/v2/token','form':{'grant_type':_0xe523('0x19'),'client_id':_0x1dd3d4[_0xe523('0x10')],'client_secret':_0x1dd3d4[_0xe523('0x11')],'redirect_uri':_0x1dd3d4['serverUrl'],'code':_0x1dd3d4[_0xe523('0x1a')]},'headers':{'Content-Type':_0xe523('0x1b')}};return rp(_0x334304)[_0xe523('0x1c')](function(_0x112fec){var _0x5f2872=JSON[_0xe523('0x1d')](_0x112fec);if(_0x5f2872[_0xe523('0x1f')]){_0x1dd3d4[_0xe523('0x1e')]=_0x5f2872[_0xe523('0x1f')];logger[_0xe523('0x29')](util[_0xe523('0x20')](_0xe523('0x21'),_0x1dd3d4['name'],_0x1dd3d4['id']));}else{logger[_0xe523('0x23')](util['format'](_0xe523('0x2a'),_0x1dd3d4[_0xe523('0x22')],_0x1dd3d4['id']),util[_0xe523('0x24')](_0x5f2872,{'showHidden':![],'depth':null}));}return _0x32d848(null,_0x2a5105);})['catch'](function(_0x3c9210){logger[_0xe523('0x23')](util[_0xe523('0x20')](_0xe523('0x2a'),_0x1dd3d4['name'],_0x1dd3d4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x32d848(_0x3c9210);});}else{return _0x32d848(null,_0x2a5105);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a410830..c6559a5 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 _0xb7f0=['where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','options','raw','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount'];(function(_0x5da8f4,_0x5abe4f){var _0x22c079=function(_0x139b43){while(--_0x139b43){_0x5da8f4['push'](_0x5da8f4['shift']());}};_0x22c079(++_0x5abe4f);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x269fba,_0xa68777){_0x269fba=_0x269fba-0x0;var _0x1eeb74=_0xb7f0[_0x269fba];return _0x1eeb74;};'use strict';var _=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var moment=require(_0x0b7f('0x2'));var BPromise=require(_0x0b7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7f('0x4'))['db'];var utils=require(_0x0b7f('0x5'));var logger=require(_0x0b7f('0x6'))(_0x0b7f('0x7'));var config=require(_0x0b7f('0x8'));var jayson=require(_0x0b7f('0x9'));var client=jayson[_0x0b7f('0xa')][_0x0b7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10dc6c,_0x36ff5c,_0x53f9a5){return new BPromise(function(_0x98065a,_0x65287){return client['request'](_0x10dc6c,_0x53f9a5)[_0x0b7f('0xc')](function(_0x3b44bd){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x36ff5c,'request\x20sent');logger[_0x0b7f('0xd')](_0x0b7f('0xe'),_0x36ff5c,_0x0b7f('0xf'),JSON[_0x0b7f('0x10')](_0x3b44bd));if(_0x3b44bd[_0x0b7f('0x11')]){if(_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x12')]===0x1f4){logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);return _0x65287(_0x3b44bd['error'][_0x0b7f('0x14')]);}logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);return _0x98065a(_0x3b44bd[_0x0b7f('0x11')][_0x0b7f('0x14')]);}else{logger[_0x0b7f('0x15')]('ZohoAccount,\x20%s,\x20%s',_0x36ff5c,_0x0b7f('0xf'));_0x98065a(_0x3b44bd[_0x0b7f('0x16')][_0x0b7f('0x14')]);}})[_0x0b7f('0x17')](function(_0x58c901){logger[_0x0b7f('0x11')](_0x0b7f('0x13'),_0x36ff5c,_0x58c901);_0x65287(_0x58c901);});});}exports[_0x0b7f('0x18')]=function(_0x168e7e){var _0x166520=this;return new Promise(function(_0x50cee2,_0x4545aa){return db['ZohoAccount']['findAll']({'raw':_0x168e7e[_0x0b7f('0x19')]?_0x168e7e[_0x0b7f('0x19')][_0x0b7f('0x1a')]===undefined?!![]:![]:!![],'where':_0x168e7e[_0x0b7f('0x19')]?_0x168e7e[_0x0b7f('0x19')]['where']||null:null,'attributes':_0x168e7e['options']?_0x168e7e[_0x0b7f('0x19')][_0x0b7f('0x1b')]||null:null,'limit':_0x168e7e[_0x0b7f('0x19')]?_0x168e7e['options'][_0x0b7f('0x1c')]||null:null,'include':_0x168e7e[_0x0b7f('0x19')]?_0x168e7e[_0x0b7f('0x19')][_0x0b7f('0x1d')]?_[_0x0b7f('0x1e')](_0x168e7e[_0x0b7f('0x19')][_0x0b7f('0x1d')],function(_0x45ab0e){return{'model':db[_0x45ab0e[_0x0b7f('0x1f')]],'as':_0x45ab0e['as'],'attributes':_0x45ab0e['attributes'],'include':_0x45ab0e[_0x0b7f('0x1d')]?_[_0x0b7f('0x1e')](_0x45ab0e['include'],function(_0x50776a){return{'model':db[_0x50776a['model']],'as':_0x50776a['as'],'attributes':_0x50776a[_0x0b7f('0x1b')],'include':_0x50776a[_0x0b7f('0x1d')]?_['map'](_0x50776a[_0x0b7f('0x1d')],function(_0x3cda59){return{'model':db[_0x3cda59[_0x0b7f('0x1f')]],'as':_0x3cda59['as'],'attributes':_0x3cda59[_0x0b7f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0b7f('0xc')](function(_0x6d31ba){logger[_0x0b7f('0x15')](_0x0b7f('0x18'),_0x168e7e);logger[_0x0b7f('0xd')]('GetZohoAccount',_0x168e7e,JSON['stringify'](_0x6d31ba));_0x50cee2(_0x6d31ba);})['catch'](function(_0x3ea675){logger['error'](_0x0b7f('0x18'),_0x3ea675[_0x0b7f('0x14')],_0x168e7e);_0x4545aa(_0x166520[_0x0b7f('0x11')](0x1f4,_0x3ea675[_0x0b7f('0x14')]));});});};exports[_0x0b7f('0x20')]=function(_0x2df0c6){var _0x2d90f0=this;return new Promise(function(_0x5ca44b,_0x4fa338){return db[_0x0b7f('0x21')]['find']({'raw':_0x2df0c6[_0x0b7f('0x19')]?_0x2df0c6[_0x0b7f('0x19')][_0x0b7f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2df0c6[_0x0b7f('0x19')]?_0x2df0c6[_0x0b7f('0x19')][_0x0b7f('0x22')]||null:null,'attributes':_0x2df0c6[_0x0b7f('0x19')]?_0x2df0c6[_0x0b7f('0x19')][_0x0b7f('0x1b')]||null:null,'include':_0x2df0c6['options']?_0x2df0c6['options'][_0x0b7f('0x1d')]?_[_0x0b7f('0x1e')](_0x2df0c6[_0x0b7f('0x19')][_0x0b7f('0x1d')],function(_0x1489fc){return{'model':db[_0x1489fc[_0x0b7f('0x1f')]],'as':_0x1489fc['as'],'attributes':_0x1489fc[_0x0b7f('0x1b')],'include':_0x1489fc[_0x0b7f('0x1d')]?_[_0x0b7f('0x1e')](_0x1489fc['include'],function(_0x5b6535){return{'model':db[_0x5b6535[_0x0b7f('0x1f')]],'as':_0x5b6535['as'],'attributes':_0x5b6535['attributes'],'include':_0x5b6535[_0x0b7f('0x1d')]?_['map'](_0x5b6535[_0x0b7f('0x1d')],function(_0x2777a0){return{'model':db[_0x2777a0[_0x0b7f('0x1f')]],'as':_0x2777a0['as'],'attributes':_0x2777a0[_0x0b7f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0b7f('0xc')](function(_0x423d35){logger[_0x0b7f('0x15')](_0x0b7f('0x20'),_0x2df0c6);logger[_0x0b7f('0xd')]('ShowZohoAccount',_0x2df0c6,JSON['stringify'](_0x423d35));_0x5ca44b(_0x423d35);})['catch'](function(_0x17e7f7){logger['error'](_0x0b7f('0x20'),_0x17e7f7[_0x0b7f('0x14')],_0x2df0c6);_0x4fa338(_0x2d90f0[_0x0b7f('0x11')](0x1f4,_0x17e7f7[_0x0b7f('0x14')]));});});}; \ No newline at end of file +var _0x5fdc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','info','GetZohoAccount','ZohoAccount','options','raw','attributes','include','map','model','ShowZohoAccount','find','where','catch','lodash'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0x5fdc,0x127));var _0xc5fd=function(_0x934dfd,_0x366aa5){_0x934dfd=_0x934dfd-0x0;var _0x1a44ed=_0x5fdc[_0x934dfd];return _0x1a44ed;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15ffe7,_0x5a2eb4,_0x5d86e5){return new BPromise(function(_0x493389,_0x224801){return client[_0xc5fd('0xe')](_0x15ffe7,_0x5d86e5)[_0xc5fd('0xf')](function(_0x45c91f){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x5a2eb4,_0xc5fd('0x10'));logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x5a2eb4,_0xc5fd('0x10'),JSON[_0xc5fd('0x13')](_0x45c91f));if(_0x45c91f[_0xc5fd('0x14')]){if(_0x45c91f['error'][_0xc5fd('0x15')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x224801(_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);}logger[_0xc5fd('0x14')](_0xc5fd('0x17'),_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x493389(_0x45c91f['error'][_0xc5fd('0x16')]);}else{logger[_0xc5fd('0x18')](_0xc5fd('0x17'),_0x5a2eb4,_0xc5fd('0x10'));_0x493389(_0x45c91f['result']['message']);}})['catch'](function(_0x5529b3){logger['error'](_0xc5fd('0x17'),_0x5a2eb4,_0x5529b3);_0x224801(_0x5529b3);});});}exports[_0xc5fd('0x19')]=function(_0x27f611){var _0xd0a9f1=this;return new Promise(function(_0x2ee392,_0x3f981f){return db[_0xc5fd('0x1a')]['findAll']({'raw':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')]['where']||null:null,'attributes':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1d')]||null:null,'limit':_0x27f611[_0xc5fd('0x1b')]?_0x27f611['options']['limit']||null:null,'include':_0x27f611[_0xc5fd('0x1b')]?_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x27f611[_0xc5fd('0x1b')][_0xc5fd('0x1e')],function(_0x56d473){return{'model':db[_0x56d473[_0xc5fd('0x20')]],'as':_0x56d473['as'],'attributes':_0x56d473[_0xc5fd('0x1d')],'include':_0x56d473[_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x56d473[_0xc5fd('0x1e')],function(_0x4020af){return{'model':db[_0x4020af[_0xc5fd('0x20')]],'as':_0x4020af['as'],'attributes':_0x4020af['attributes'],'include':_0x4020af[_0xc5fd('0x1e')]?_['map'](_0x4020af[_0xc5fd('0x1e')],function(_0x231368){return{'model':db[_0x231368[_0xc5fd('0x20')]],'as':_0x231368['as'],'attributes':_0x231368[_0xc5fd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x176313){logger[_0xc5fd('0x18')](_0xc5fd('0x19'),_0x27f611);logger[_0xc5fd('0x11')](_0xc5fd('0x19'),_0x27f611,JSON[_0xc5fd('0x13')](_0x176313));_0x2ee392(_0x176313);})['catch'](function(_0x412ef7){logger['error']('GetZohoAccount',_0x412ef7[_0xc5fd('0x16')],_0x27f611);_0x3f981f(_0xd0a9f1[_0xc5fd('0x14')](0x1f4,_0x412ef7[_0xc5fd('0x16')]));});});};exports[_0xc5fd('0x21')]=function(_0x7693c4){var _0x85fa81=this;return new Promise(function(_0x2a891d,_0x321eea){return db['ZohoAccount'][_0xc5fd('0x22')]({'raw':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x23')]||null:null,'attributes':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x1d')]||null:null,'include':_0x7693c4[_0xc5fd('0x1b')]?_0x7693c4[_0xc5fd('0x1b')]['include']?_[_0xc5fd('0x1f')](_0x7693c4[_0xc5fd('0x1b')][_0xc5fd('0x1e')],function(_0x1fa329){return{'model':db[_0x1fa329[_0xc5fd('0x20')]],'as':_0x1fa329['as'],'attributes':_0x1fa329[_0xc5fd('0x1d')],'include':_0x1fa329[_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x1fa329[_0xc5fd('0x1e')],function(_0x545bfc){return{'model':db[_0x545bfc[_0xc5fd('0x20')]],'as':_0x545bfc['as'],'attributes':_0x545bfc[_0xc5fd('0x1d')],'include':_0x545bfc[_0xc5fd('0x1e')]?_[_0xc5fd('0x1f')](_0x545bfc[_0xc5fd('0x1e')],function(_0x52267e){return{'model':db[_0x52267e[_0xc5fd('0x20')]],'as':_0x52267e['as'],'attributes':_0x52267e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5fd('0xf')](function(_0xac7c40){logger['info'](_0xc5fd('0x21'),_0x7693c4);logger['debug'](_0xc5fd('0x21'),_0x7693c4,JSON[_0xc5fd('0x13')](_0xac7c40));_0x2a891d(_0xac7c40);})[_0xc5fd('0x24')](function(_0x4cafb1){logger[_0xc5fd('0x14')](_0xc5fd('0x21'),_0x4cafb1['message'],_0x7693c4);_0x321eea(_0x85fa81[_0xc5fd('0x14')](0x1f4,_0x4cafb1[_0xc5fd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index e1f4526..376cdfa 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 _0x0cf8=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','destroy','exports','multer'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x0cf8,0x1cd));var _0x80cf=function(_0x4188df,_0x5467c8){_0x4188df=_0x4188df-0x0;var _0xc7fa=_0x0cf8[_0x4188df];return _0xc7fa;};'use strict';var multer=require(_0x80cf('0x0'));var util=require(_0x80cf('0x1'));var path=require('path');var timeout=require(_0x80cf('0x2'));var express=require(_0x80cf('0x3'));var router=express[_0x80cf('0x4')]();var fs_extra=require(_0x80cf('0x5'));var auth=require(_0x80cf('0x6'));var interaction=require(_0x80cf('0x7'));var config=require('../../config/environment');var controller=require(_0x80cf('0x8'));router[_0x80cf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x80cf('0x9')]('/:id',auth[_0x80cf('0xa')](),controller['show']);router[_0x80cf('0x9')](_0x80cf('0xb'),auth[_0x80cf('0xa')](),controller[_0x80cf('0xc')]);router[_0x80cf('0x9')](_0x80cf('0xd'),auth[_0x80cf('0xa')](),controller[_0x80cf('0xe')]);router[_0x80cf('0x9')](_0x80cf('0xf'),auth[_0x80cf('0xa')](),controller[_0x80cf('0x10')]);router['post']('/',auth[_0x80cf('0xa')](),controller['create']);router[_0x80cf('0x11')](_0x80cf('0x12'),auth[_0x80cf('0xa')](),controller[_0x80cf('0x13')]);router['delete']('/:id',auth[_0x80cf('0xa')](),controller[_0x80cf('0x14')]);module[_0x80cf('0x15')]=router; \ No newline at end of file +var _0x6c0f=['getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x6c0f,0x10e));var _0xf6c0=function(_0x5db71c,_0x49f6d8){_0x5db71c=_0x5db71c-0x0;var _0x3b685d=_0x6c0f[_0x5db71c];return _0x3b685d;};'use strict';var multer=require(_0xf6c0('0x0'));var util=require(_0xf6c0('0x1'));var path=require(_0xf6c0('0x2'));var timeout=require(_0xf6c0('0x3'));var express=require(_0xf6c0('0x4'));var router=express[_0xf6c0('0x5')]();var fs_extra=require(_0xf6c0('0x6'));var auth=require(_0xf6c0('0x7'));var interaction=require(_0xf6c0('0x8'));var config=require(_0xf6c0('0x9'));var controller=require('./intZohoConfiguration.controller');router[_0xf6c0('0xa')]('/',auth[_0xf6c0('0xb')](),controller['index']);router['get'](_0xf6c0('0xc'),auth[_0xf6c0('0xb')](),controller[_0xf6c0('0xd')]);router[_0xf6c0('0xa')](_0xf6c0('0xe'),auth[_0xf6c0('0xb')](),controller[_0xf6c0('0xf')]);router['get'](_0xf6c0('0x10'),auth[_0xf6c0('0xb')](),controller[_0xf6c0('0x11')]);router['get']('/:id/descriptions',auth[_0xf6c0('0xb')](),controller[_0xf6c0('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf6c0('0x13')]);router[_0xf6c0('0x14')](_0xf6c0('0xc'),auth[_0xf6c0('0xb')](),controller['update']);router[_0xf6c0('0x15')](_0xf6c0('0xc'),auth[_0xf6c0('0xb')](),controller[_0xf6c0('0x16')]);module[_0xf6c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 75c3375..c3af954 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 _0xf03c=['contact','nothing','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x2eab1d,_0x54edd4){var _0x37cfed=function(_0xda2e04){while(--_0xda2e04){_0x2eab1d['push'](_0x2eab1d['shift']());}};_0x37cfed(++_0x54edd4);}(_0xf03c,0x1eb));var _0xcf03=function(_0x2a374b,_0x35c7c6){_0x2a374b=_0x2a374b-0x0;var _0xc9f78b=_0xf03c[_0x2a374b];return _0xc9f78b;};'use strict';var Sequelize=require(_0xcf03('0x0'));module[_0xcf03('0x1')]={'name':{'type':Sequelize[_0xcf03('0x2')]},'moduleCreate':{'type':Sequelize[_0xcf03('0x3')](_0xcf03('0x4'),_0xcf03('0x5'),_0xcf03('0x6')),'defaultValue':_0xcf03('0x4')},'moduleSearch':{'type':Sequelize[_0xcf03('0x3')](_0xcf03('0x7'),_0xcf03('0x5'),'lead'),'defaultValue':_0xcf03('0x7')},'description':{'type':Sequelize[_0xcf03('0x2')]}}; \ No newline at end of file +var _0x374f=['exports','ENUM','lead','contact','nothing','contact_lead','STRING','sequelize'];(function(_0x43446f,_0x2af360){var _0x2a1369=function(_0x2ba4e4){while(--_0x2ba4e4){_0x43446f['push'](_0x43446f['shift']());}};_0x2a1369(++_0x2af360);}(_0x374f,0x13f));var _0xf374=function(_0x49fb83,_0x1dac2a){_0x49fb83=_0x49fb83-0x0;var _0x4dfd29=_0x374f[_0x49fb83];return _0x4dfd29;};'use strict';var Sequelize=require(_0xf374('0x0'));module[_0xf374('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf374('0x2')](_0xf374('0x3'),_0xf374('0x4'),_0xf374('0x5')),'defaultValue':_0xf374('0x3')},'moduleSearch':{'type':Sequelize[_0xf374('0x2')](_0xf374('0x6'),_0xf374('0x4'),_0xf374('0x3')),'defaultValue':_0xf374('0x6')},'description':{'type':Sequelize[_0xf374('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5d2c0c6..7819d68 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 _0xa684=['hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','body','findOne','ZohoField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','length','attributes'];(function(_0x8afe8a,_0xde88c9){var _0x13a2df=function(_0x4a15eb){while(--_0x4a15eb){_0x8afe8a['push'](_0x8afe8a['shift']());}};_0x13a2df(++_0xde88c9);}(_0xa684,0x1e4));var _0x4a68=function(_0x2d0589,_0x1bdd0f){_0x2d0589=_0x2d0589-0x0;var _0x464506=_0xa684[_0x2d0589];return _0x464506;};'use strict';var emlformat=require(_0x4a68('0x0'));var rimraf=require(_0x4a68('0x1'));var zipdir=require(_0x4a68('0x2'));var jsonpatch=require(_0x4a68('0x3'));var rp=require(_0x4a68('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4a68('0x5'));var csv=require('to-csv');var ejs=require(_0x4a68('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a68('0x7'));var squel=require('squel');var crypto=require(_0x4a68('0x8'));var jsforce=require(_0x4a68('0x9'));var deskjs=require(_0x4a68('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4a68('0xb'));var Papa=require(_0x4a68('0xc'));var Redis=require(_0x4a68('0xd'));var authService=require(_0x4a68('0xe'));var qs=require(_0x4a68('0xf'));var as=require(_0x4a68('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a68('0x11'));var utils=require(_0x4a68('0x12'));var config=require(_0x4a68('0x13'));var licenseUtil=require(_0x4a68('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3b62,_0x594c38){_0x594c38=_0x594c38||0xcc;return function(_0x48685f){if(_0x48685f){return _0x1b3b62[_0x4a68('0x15')](_0x594c38);}return _0x1b3b62[_0x4a68('0x16')](_0x594c38)[_0x4a68('0x17')]();};}function respondWithResult(_0x193bed,_0xf832f2){_0xf832f2=_0xf832f2||0xc8;return function(_0x7dfb46){if(_0x7dfb46){return _0x193bed[_0x4a68('0x16')](_0xf832f2)[_0x4a68('0x18')](_0x7dfb46);}};}function respondWithFilteredResult(_0x28c84e,_0xb2cd84){return function(_0x569400){if(_0x569400){var _0x37fa1e=typeof _0xb2cd84[_0x4a68('0x19')]===_0x4a68('0x1a')&&typeof _0xb2cd84['limit']===_0x4a68('0x1a');var _0x2f4b01=_0x569400[_0x4a68('0x1b')];var _0xf02558=_0x37fa1e?0x0:_0xb2cd84['offset'];var _0x386924=_0x37fa1e?_0x569400[_0x4a68('0x1b')]:_0xb2cd84['offset']+_0xb2cd84[_0x4a68('0x1c')];var _0x1a691d;if(_0x386924>=_0x2f4b01){_0x386924=_0x2f4b01;_0x1a691d=0xc8;}else{_0x1a691d=0xce;}_0x28c84e[_0x4a68('0x16')](_0x1a691d);return _0x28c84e[_0x4a68('0x1d')](_0x4a68('0x1e'),_0xf02558+'-'+_0x386924+'/'+_0x2f4b01)[_0x4a68('0x18')](_0x569400);}return null;};}function patchUpdates(_0x91334f){return function(_0x247841){try{jsonpatch[_0x4a68('0x1f')](_0x247841,_0x91334f,!![]);}catch(_0x1ada18){return BPromise[_0x4a68('0x20')](_0x1ada18);}return _0x247841[_0x4a68('0x21')]();};}function saveUpdates(_0x4a3928,_0x293ce3){return function(_0x25c1de){if(_0x25c1de){return _0x25c1de[_0x4a68('0x22')](_0x4a3928)[_0x4a68('0x23')](function(_0xc53bf2){return _0xc53bf2;});}return null;};}function removeEntity(_0x4524ec,_0x2d1ebc){return function(_0x3c49b7){if(_0x3c49b7){return _0x3c49b7[_0x4a68('0x24')]()[_0x4a68('0x23')](function(){_0x4524ec[_0x4a68('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x288ee9,_0x244e07){return function(_0x140df1){if(!_0x140df1){_0x288ee9[_0x4a68('0x15')](0x194);}return _0x140df1;};}function handleError(_0x3c1f14,_0x32572a){_0x32572a=_0x32572a||0x1f4;return function(_0x1e21a0){logger[_0x4a68('0x25')](_0x1e21a0[_0x4a68('0x26')]);if(_0x1e21a0['name']){delete _0x1e21a0['name'];}_0x3c1f14[_0x4a68('0x16')](_0x32572a)[_0x4a68('0x27')](_0x1e21a0);};}exports['index']=function(_0x43a26d,_0x4e173a){var _0x42db52={},_0x414a8d={},_0x46ae68={'count':0x0,'rows':[]};var _0x4ec48e=_['map'](db[_0x4a68('0x28')][_0x4a68('0x29')],function(_0x18edbb){return{'name':_0x18edbb[_0x4a68('0x2a')],'type':_0x18edbb[_0x4a68('0x2b')][_0x4a68('0x2c')]};});_0x414a8d[_0x4a68('0x2d')]=_[_0x4a68('0x2e')](_0x4ec48e,_0x4a68('0x2f'));_0x414a8d[_0x4a68('0x30')]=_[_0x4a68('0x31')](_0x43a26d[_0x4a68('0x30')]);_0x414a8d[_0x4a68('0x32')]=_[_0x4a68('0x33')](_0x414a8d[_0x4a68('0x2d')],_0x414a8d[_0x4a68('0x30')]);_0x42db52['attributes']=_['intersection'](_0x414a8d[_0x4a68('0x2d')],qs[_0x4a68('0x34')](_0x43a26d[_0x4a68('0x30')][_0x4a68('0x34')]));_0x42db52['attributes']=_0x42db52['attributes'][_0x4a68('0x35')]?_0x42db52[_0x4a68('0x36')]:_0x414a8d[_0x4a68('0x2d')];if(!_0x43a26d[_0x4a68('0x30')][_0x4a68('0x37')]('nolimit')){_0x42db52[_0x4a68('0x1c')]=qs[_0x4a68('0x1c')](_0x43a26d[_0x4a68('0x30')]['limit']);_0x42db52['offset']=qs[_0x4a68('0x19')](_0x43a26d[_0x4a68('0x30')]['offset']);}_0x42db52[_0x4a68('0x38')]=qs[_0x4a68('0x39')](_0x43a26d[_0x4a68('0x30')][_0x4a68('0x39')]);_0x42db52[_0x4a68('0x3a')]=qs[_0x4a68('0x32')](_[_0x4a68('0x3b')](_0x43a26d[_0x4a68('0x30')],_0x414a8d[_0x4a68('0x32')]),_0x4ec48e);if(_0x43a26d['query'][_0x4a68('0x3c')]){_0x42db52[_0x4a68('0x3a')]=_['merge'](_0x42db52[_0x4a68('0x3a')],{'$or':_[_0x4a68('0x2e')](_0x4ec48e,function(_0x234c2c){if(_0x234c2c[_0x4a68('0x2b')]!=='VIRTUAL'){var _0x4287ca={};_0x4287ca[_0x234c2c[_0x4a68('0x2f')]]={'$like':'%'+_0x43a26d[_0x4a68('0x30')][_0x4a68('0x3c')]+'%'};return _0x4287ca;}})});}_0x42db52=_[_0x4a68('0x3d')]({},_0x42db52,_0x43a26d['options']);var _0x39ae11={'where':_0x42db52[_0x4a68('0x3a')]};return db['ZohoConfiguration'][_0x4a68('0x1b')](_0x39ae11)['then'](function(_0x4818bb){_0x46ae68[_0x4a68('0x1b')]=_0x4818bb;if(_0x43a26d[_0x4a68('0x30')][_0x4a68('0x3e')]){_0x42db52[_0x4a68('0x3f')]=[{'all':!![]}];}return db[_0x4a68('0x28')]['findAll'](_0x42db52);})[_0x4a68('0x23')](function(_0x9afb2){_0x46ae68[_0x4a68('0x40')]=_0x9afb2;return _0x46ae68;})[_0x4a68('0x23')](respondWithFilteredResult(_0x4e173a,_0x42db52))[_0x4a68('0x41')](handleError(_0x4e173a,null));};exports[_0x4a68('0x42')]=function(_0x3f6b06,_0x38c7b1){var _0x4120fe={'raw':![],'where':{'id':_0x3f6b06[_0x4a68('0x43')]['id']}},_0x18d583={};_0x18d583[_0x4a68('0x2d')]=_[_0x4a68('0x31')](db[_0x4a68('0x28')][_0x4a68('0x29')]);_0x18d583[_0x4a68('0x30')]=_[_0x4a68('0x31')](_0x3f6b06['query']);_0x18d583[_0x4a68('0x32')]=_[_0x4a68('0x33')](_0x18d583[_0x4a68('0x2d')],_0x18d583[_0x4a68('0x30')]);_0x4120fe[_0x4a68('0x36')]=_[_0x4a68('0x33')](_0x18d583[_0x4a68('0x2d')],qs[_0x4a68('0x34')](_0x3f6b06[_0x4a68('0x30')]['fields']));_0x4120fe[_0x4a68('0x36')]=_0x4120fe[_0x4a68('0x36')]['length']?_0x4120fe[_0x4a68('0x36')]:_0x18d583[_0x4a68('0x2d')];if(_0x3f6b06[_0x4a68('0x30')][_0x4a68('0x3e')]){_0x4120fe[_0x4a68('0x3f')]=[{'all':!![]}];}_0x4120fe=_[_0x4a68('0x3d')]({},_0x4120fe,_0x3f6b06[_0x4a68('0x44')]);return db[_0x4a68('0x28')][_0x4a68('0x45')](_0x4120fe)[_0x4a68('0x23')](handleEntityNotFound(_0x38c7b1,null))[_0x4a68('0x23')](respondWithResult(_0x38c7b1,null))[_0x4a68('0x41')](handleError(_0x38c7b1,null));};exports['create']=function(_0x4fcb5b,_0x404d46){return db['ZohoConfiguration']['create'](_0x4fcb5b[_0x4a68('0x46')],{})[_0x4a68('0x23')](respondWithResult(_0x404d46,0xc9))[_0x4a68('0x41')](handleError(_0x404d46,null));};exports[_0x4a68('0x22')]=function(_0x54aa6a,_0x1aeaea){if(_0x54aa6a['body']['id']){delete _0x54aa6a[_0x4a68('0x46')]['id'];}return db[_0x4a68('0x28')]['find']({'where':{'id':_0x54aa6a[_0x4a68('0x43')]['id']}})['then'](handleEntityNotFound(_0x1aeaea,null))[_0x4a68('0x23')](saveUpdates(_0x54aa6a['body'],null))[_0x4a68('0x23')](respondWithResult(_0x1aeaea,null))[_0x4a68('0x41')](handleError(_0x1aeaea,null));};exports[_0x4a68('0x24')]=function(_0x16bf70,_0xf72835){return db[_0x4a68('0x28')][_0x4a68('0x45')]({'where':{'id':_0x16bf70[_0x4a68('0x43')]['id']}})[_0x4a68('0x23')](handleEntityNotFound(_0xf72835,null))[_0x4a68('0x23')](removeEntity(_0xf72835,null))[_0x4a68('0x41')](handleError(_0xf72835,null));};exports['getFields']=function(_0x2c3ef2,_0x385350,_0x54be12){var _0x20278d={};var _0xba8834={};var _0x590b41;var _0x5bbc8f;return db[_0x4a68('0x28')][_0x4a68('0x47')]({'where':{'id':_0x2c3ef2[_0x4a68('0x43')]['id']}})[_0x4a68('0x23')](handleEntityNotFound(_0x385350,null))[_0x4a68('0x23')](function(_0x405e16){if(_0x405e16){_0x590b41=_0x405e16;_0xba8834[_0x4a68('0x2d')]=_[_0x4a68('0x31')](db[_0x4a68('0x48')]['rawAttributes']);_0xba8834[_0x4a68('0x30')]=_[_0x4a68('0x31')](_0x2c3ef2[_0x4a68('0x30')]);_0xba8834[_0x4a68('0x32')]=_['intersection'](_0xba8834['model'],_0xba8834[_0x4a68('0x30')]);_0x20278d[_0x4a68('0x36')]=_[_0x4a68('0x33')](_0xba8834[_0x4a68('0x2d')],qs[_0x4a68('0x34')](_0x2c3ef2[_0x4a68('0x30')][_0x4a68('0x34')]));_0x20278d[_0x4a68('0x36')]=_0x20278d[_0x4a68('0x36')][_0x4a68('0x35')]?_0x20278d['attributes']:_0xba8834['model'];_0x20278d[_0x4a68('0x38')]=qs[_0x4a68('0x39')](_0x2c3ef2['query'][_0x4a68('0x39')]);_0x20278d['where']=qs[_0x4a68('0x32')](_[_0x4a68('0x3b')](_0x2c3ef2['query'],_0xba8834[_0x4a68('0x32')]));if(_0x2c3ef2[_0x4a68('0x30')][_0x4a68('0x3c')]){_0x20278d['where']=_[_0x4a68('0x3d')](_0x20278d['where'],{'$or':_['map'](_0x20278d['attributes'],function(_0x15fd06){var _0x178d72={};_0x178d72[_0x15fd06]={'$like':'%'+_0x2c3ef2[_0x4a68('0x30')][_0x4a68('0x3c')]+'%'};return _0x178d72;})});}_0x20278d=_[_0x4a68('0x3d')]({},_0x20278d,_0x2c3ef2[_0x4a68('0x44')]);return _0x590b41[_0x4a68('0x49')](_0x20278d);}})[_0x4a68('0x23')](function(_0x1ae7f6){if(_0x1ae7f6){_0x5bbc8f=_0x1ae7f6['length'];if(!_0x2c3ef2[_0x4a68('0x30')][_0x4a68('0x37')](_0x4a68('0x4a'))){_0x20278d['limit']=qs[_0x4a68('0x1c')](_0x2c3ef2['query'][_0x4a68('0x1c')]);_0x20278d[_0x4a68('0x19')]=qs[_0x4a68('0x19')](_0x2c3ef2[_0x4a68('0x30')][_0x4a68('0x19')]);}return _0x590b41[_0x4a68('0x49')](_0x20278d);}})[_0x4a68('0x23')](function(_0x50571c){if(_0x50571c){return _0x50571c?{'count':_0x5bbc8f,'rows':_0x50571c}:null;}})[_0x4a68('0x23')](respondWithResult(_0x385350,null))[_0x4a68('0x41')](handleError(_0x385350,null));};exports[_0x4a68('0x4b')]=function(_0x5827f3,_0x171109,_0x5dfdfd){var _0x599387={};var _0x3b0969={};var _0x44553b;var _0x3ee534;return db['ZohoConfiguration'][_0x4a68('0x47')]({'where':{'id':_0x5827f3[_0x4a68('0x43')]['id']}})[_0x4a68('0x23')](handleEntityNotFound(_0x171109,null))[_0x4a68('0x23')](function(_0x366a7d){if(_0x366a7d){_0x44553b=_0x366a7d;_0x3b0969['model']=_[_0x4a68('0x31')](db[_0x4a68('0x48')][_0x4a68('0x29')]);_0x3b0969[_0x4a68('0x30')]=_['keys'](_0x5827f3[_0x4a68('0x30')]);_0x3b0969[_0x4a68('0x32')]=_[_0x4a68('0x33')](_0x3b0969['model'],_0x3b0969['query']);_0x599387[_0x4a68('0x36')]=_[_0x4a68('0x33')](_0x3b0969[_0x4a68('0x2d')],qs[_0x4a68('0x34')](_0x5827f3['query'][_0x4a68('0x34')]));_0x599387[_0x4a68('0x36')]=_0x599387[_0x4a68('0x36')][_0x4a68('0x35')]?_0x599387[_0x4a68('0x36')]:_0x3b0969['model'];_0x599387[_0x4a68('0x38')]=qs[_0x4a68('0x39')](_0x5827f3[_0x4a68('0x30')][_0x4a68('0x39')]);_0x599387[_0x4a68('0x3a')]=qs[_0x4a68('0x32')](_[_0x4a68('0x3b')](_0x5827f3[_0x4a68('0x30')],_0x3b0969[_0x4a68('0x32')]));if(_0x5827f3[_0x4a68('0x30')][_0x4a68('0x3c')]){_0x599387[_0x4a68('0x3a')]=_[_0x4a68('0x3d')](_0x599387['where'],{'$or':_[_0x4a68('0x2e')](_0x599387[_0x4a68('0x36')],function(_0x458e36){var _0x2d6966={};_0x2d6966[_0x458e36]={'$like':'%'+_0x5827f3[_0x4a68('0x30')]['filter']+'%'};return _0x2d6966;})});}_0x599387=_[_0x4a68('0x3d')]({},_0x599387,_0x5827f3[_0x4a68('0x44')]);return _0x44553b[_0x4a68('0x4b')](_0x599387);}})['then'](function(_0xdb86a6){if(_0xdb86a6){_0x3ee534=_0xdb86a6[_0x4a68('0x35')];if(!_0x5827f3[_0x4a68('0x30')][_0x4a68('0x37')](_0x4a68('0x4a'))){_0x599387[_0x4a68('0x1c')]=qs['limit'](_0x5827f3[_0x4a68('0x30')]['limit']);_0x599387[_0x4a68('0x19')]=qs[_0x4a68('0x19')](_0x5827f3[_0x4a68('0x30')][_0x4a68('0x19')]);}return _0x44553b[_0x4a68('0x4b')](_0x599387);}})[_0x4a68('0x23')](function(_0x365b16){if(_0x365b16){return _0x365b16?{'count':_0x3ee534,'rows':_0x365b16}:null;}})[_0x4a68('0x23')](respondWithResult(_0x171109,null))[_0x4a68('0x41')](handleError(_0x171109,null));};exports['getDescriptions']=function(_0x3dffd6,_0x256917,_0x3a4cb6){var _0x31305a={};var _0x9ebeca={};var _0x5646db;var _0x281340;return db[_0x4a68('0x28')]['findOne']({'where':{'id':_0x3dffd6[_0x4a68('0x43')]['id']}})[_0x4a68('0x23')](handleEntityNotFound(_0x256917,null))[_0x4a68('0x23')](function(_0x1715cc){if(_0x1715cc){_0x5646db=_0x1715cc;_0x9ebeca[_0x4a68('0x2d')]=_[_0x4a68('0x31')](db[_0x4a68('0x48')][_0x4a68('0x29')]);_0x9ebeca[_0x4a68('0x30')]=_[_0x4a68('0x31')](_0x3dffd6['query']);_0x9ebeca[_0x4a68('0x32')]=_['intersection'](_0x9ebeca[_0x4a68('0x2d')],_0x9ebeca[_0x4a68('0x30')]);_0x31305a['attributes']=_['intersection'](_0x9ebeca[_0x4a68('0x2d')],qs[_0x4a68('0x34')](_0x3dffd6[_0x4a68('0x30')]['fields']));_0x31305a[_0x4a68('0x36')]=_0x31305a[_0x4a68('0x36')]['length']?_0x31305a[_0x4a68('0x36')]:_0x9ebeca[_0x4a68('0x2d')];_0x31305a['order']=qs[_0x4a68('0x39')](_0x3dffd6[_0x4a68('0x30')]['sort']);_0x31305a['where']=qs[_0x4a68('0x32')](_[_0x4a68('0x3b')](_0x3dffd6[_0x4a68('0x30')],_0x9ebeca['filters']));if(_0x3dffd6['query'][_0x4a68('0x3c')]){_0x31305a[_0x4a68('0x3a')]=_[_0x4a68('0x3d')](_0x31305a['where'],{'$or':_[_0x4a68('0x2e')](_0x31305a['attributes'],function(_0x40b169){var _0x53e44b={};_0x53e44b[_0x40b169]={'$like':'%'+_0x3dffd6[_0x4a68('0x30')]['filter']+'%'};return _0x53e44b;})});}_0x31305a=_[_0x4a68('0x3d')]({},_0x31305a,_0x3dffd6[_0x4a68('0x44')]);return _0x5646db[_0x4a68('0x4c')](_0x31305a);}})[_0x4a68('0x23')](function(_0x42f234){if(_0x42f234){_0x281340=_0x42f234[_0x4a68('0x35')];if(!_0x3dffd6[_0x4a68('0x30')][_0x4a68('0x37')](_0x4a68('0x4a'))){_0x31305a[_0x4a68('0x1c')]=qs[_0x4a68('0x1c')](_0x3dffd6[_0x4a68('0x30')]['limit']);_0x31305a['offset']=qs[_0x4a68('0x19')](_0x3dffd6['query'][_0x4a68('0x19')]);}return _0x5646db[_0x4a68('0x4c')](_0x31305a);}})[_0x4a68('0x23')](function(_0x474282){if(_0x474282){return _0x474282?{'count':_0x281340,'rows':_0x474282}:null;}})[_0x4a68('0x23')](respondWithResult(_0x256917,null))[_0x4a68('0x41')](handleError(_0x256917,null));}; \ No newline at end of file +var _0xc3f5=['merge','includeAll','findAll','rows','params','keys','options','catch','create','body','find','rawAttributes','order','getFields','getSubjects','findOne','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoConfiguration','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL'];(function(_0x4c0fe7,_0x19f374){var _0xf782f1=function(_0x45e6e8){while(--_0x45e6e8){_0x4c0fe7['push'](_0x4c0fe7['shift']());}};_0xf782f1(++_0x19f374);}(_0xc3f5,0x19d));var _0x5c3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc3f5[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x5c3f('0x0'));var rimraf=require(_0x5c3f('0x1'));var zipdir=require(_0x5c3f('0x2'));var jsonpatch=require(_0x5c3f('0x3'));var rp=require(_0x5c3f('0x4'));var moment=require(_0x5c3f('0x5'));var BPromise=require(_0x5c3f('0x6'));var Mustache=require(_0x5c3f('0x7'));var util=require(_0x5c3f('0x8'));var path=require(_0x5c3f('0x9'));var sox=require('sox');var csv=require(_0x5c3f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c3f('0xb'));var _=require('lodash');var squel=require(_0x5c3f('0xc'));var crypto=require(_0x5c3f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5c3f('0xa'));var querystring=require(_0x5c3f('0xe'));var Papa=require(_0x5c3f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c3f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c3f('0x11'));var logger=require(_0x5c3f('0x12'))(_0x5c3f('0x13'));var utils=require(_0x5c3f('0x14'));var config=require(_0x5c3f('0x15'));var licenseUtil=require(_0x5c3f('0x16'));var db=require(_0x5c3f('0x17'))['db'];function respondWithStatusCode(_0x380a79,_0x84f283){_0x84f283=_0x84f283||0xcc;return function(_0x30bb58){if(_0x30bb58){return _0x380a79[_0x5c3f('0x18')](_0x84f283);}return _0x380a79[_0x5c3f('0x19')](_0x84f283)[_0x5c3f('0x1a')]();};}function respondWithResult(_0x34c0ae,_0x1c11fb){_0x1c11fb=_0x1c11fb||0xc8;return function(_0x1a015b){if(_0x1a015b){return _0x34c0ae[_0x5c3f('0x19')](_0x1c11fb)[_0x5c3f('0x1b')](_0x1a015b);}};}function respondWithFilteredResult(_0x4d9028,_0x2e5c98){return function(_0x1b1ce3){if(_0x1b1ce3){var _0x359287=typeof _0x2e5c98[_0x5c3f('0x1c')]===_0x5c3f('0x1d')&&typeof _0x2e5c98['limit']===_0x5c3f('0x1d');var _0x1dc38d=_0x1b1ce3[_0x5c3f('0x1e')];var _0x2d79ef=_0x359287?0x0:_0x2e5c98[_0x5c3f('0x1c')];var _0xc6d3aa=_0x359287?_0x1b1ce3[_0x5c3f('0x1e')]:_0x2e5c98[_0x5c3f('0x1c')]+_0x2e5c98[_0x5c3f('0x1f')];var _0x1aa225;if(_0xc6d3aa>=_0x1dc38d){_0xc6d3aa=_0x1dc38d;_0x1aa225=0xc8;}else{_0x1aa225=0xce;}_0x4d9028['status'](_0x1aa225);return _0x4d9028[_0x5c3f('0x20')]('Content-Range',_0x2d79ef+'-'+_0xc6d3aa+'/'+_0x1dc38d)[_0x5c3f('0x1b')](_0x1b1ce3);}return null;};}function patchUpdates(_0x55c531){return function(_0x1f26e2){try{jsonpatch[_0x5c3f('0x21')](_0x1f26e2,_0x55c531,!![]);}catch(_0x127b77){return BPromise[_0x5c3f('0x22')](_0x127b77);}return _0x1f26e2[_0x5c3f('0x23')]();};}function saveUpdates(_0x3eed9a,_0x2c9192){return function(_0x1c1455){if(_0x1c1455){return _0x1c1455[_0x5c3f('0x24')](_0x3eed9a)[_0x5c3f('0x25')](function(_0x3f8a69){return _0x3f8a69;});}return null;};}function removeEntity(_0x4bb758,_0x8f62be){return function(_0x435e23){if(_0x435e23){return _0x435e23[_0x5c3f('0x26')]()[_0x5c3f('0x25')](function(){_0x4bb758[_0x5c3f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3556ed,_0x47ab26){return function(_0x399f80){if(!_0x399f80){_0x3556ed[_0x5c3f('0x18')](0x194);}return _0x399f80;};}function handleError(_0x93f7a9,_0x1ab9af){_0x1ab9af=_0x1ab9af||0x1f4;return function(_0x2cb0c0){logger['error'](_0x2cb0c0[_0x5c3f('0x27')]);if(_0x2cb0c0[_0x5c3f('0x28')]){delete _0x2cb0c0[_0x5c3f('0x28')];}_0x93f7a9[_0x5c3f('0x19')](_0x1ab9af)[_0x5c3f('0x29')](_0x2cb0c0);};}exports[_0x5c3f('0x2a')]=function(_0x5018fd,_0x3b23a0){var _0x3b934f={},_0x426e80={},_0x208bbf={'count':0x0,'rows':[]};var _0x20ded8=_[_0x5c3f('0x2b')](db[_0x5c3f('0x2c')]['rawAttributes'],function(_0xd2b393){return{'name':_0xd2b393['fieldName'],'type':_0xd2b393['type'][_0x5c3f('0x2d')]};});_0x426e80[_0x5c3f('0x2e')]=_[_0x5c3f('0x2b')](_0x20ded8,'name');_0x426e80['query']=_['keys'](_0x5018fd[_0x5c3f('0x2f')]);_0x426e80[_0x5c3f('0x30')]=_[_0x5c3f('0x31')](_0x426e80['model'],_0x426e80[_0x5c3f('0x2f')]);_0x3b934f['attributes']=_[_0x5c3f('0x31')](_0x426e80[_0x5c3f('0x2e')],qs[_0x5c3f('0x32')](_0x5018fd[_0x5c3f('0x2f')][_0x5c3f('0x32')]));_0x3b934f[_0x5c3f('0x33')]=_0x3b934f[_0x5c3f('0x33')][_0x5c3f('0x34')]?_0x3b934f['attributes']:_0x426e80[_0x5c3f('0x2e')];if(!_0x5018fd['query'][_0x5c3f('0x35')](_0x5c3f('0x36'))){_0x3b934f[_0x5c3f('0x1f')]=qs['limit'](_0x5018fd[_0x5c3f('0x2f')]['limit']);_0x3b934f['offset']=qs[_0x5c3f('0x1c')](_0x5018fd[_0x5c3f('0x2f')]['offset']);}_0x3b934f['order']=qs['sort'](_0x5018fd['query'][_0x5c3f('0x37')]);_0x3b934f[_0x5c3f('0x38')]=qs['filters'](_[_0x5c3f('0x39')](_0x5018fd[_0x5c3f('0x2f')],_0x426e80['filters']),_0x20ded8);if(_0x5018fd[_0x5c3f('0x2f')][_0x5c3f('0x3a')]){_0x3b934f[_0x5c3f('0x38')]=_['merge'](_0x3b934f[_0x5c3f('0x38')],{'$or':_[_0x5c3f('0x2b')](_0x20ded8,function(_0xeedbcd){if(_0xeedbcd[_0x5c3f('0x3b')]!==_0x5c3f('0x3c')){var _0x4ae3e0={};_0x4ae3e0[_0xeedbcd[_0x5c3f('0x28')]]={'$like':'%'+_0x5018fd['query'][_0x5c3f('0x3a')]+'%'};return _0x4ae3e0;}})});}_0x3b934f=_[_0x5c3f('0x3d')]({},_0x3b934f,_0x5018fd['options']);var _0x3bc460={'where':_0x3b934f[_0x5c3f('0x38')]};return db[_0x5c3f('0x2c')][_0x5c3f('0x1e')](_0x3bc460)[_0x5c3f('0x25')](function(_0x4898c0){_0x208bbf[_0x5c3f('0x1e')]=_0x4898c0;if(_0x5018fd[_0x5c3f('0x2f')][_0x5c3f('0x3e')]){_0x3b934f['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x5c3f('0x3f')](_0x3b934f);})[_0x5c3f('0x25')](function(_0x3832aa){_0x208bbf[_0x5c3f('0x40')]=_0x3832aa;return _0x208bbf;})[_0x5c3f('0x25')](respondWithFilteredResult(_0x3b23a0,_0x3b934f))['catch'](handleError(_0x3b23a0,null));};exports['show']=function(_0x3122ed,_0x31dcea){var _0x21b8ba={'raw':![],'where':{'id':_0x3122ed[_0x5c3f('0x41')]['id']}},_0x12f5eb={};_0x12f5eb[_0x5c3f('0x2e')]=_[_0x5c3f('0x42')](db[_0x5c3f('0x2c')]['rawAttributes']);_0x12f5eb['query']=_[_0x5c3f('0x42')](_0x3122ed[_0x5c3f('0x2f')]);_0x12f5eb[_0x5c3f('0x30')]=_[_0x5c3f('0x31')](_0x12f5eb[_0x5c3f('0x2e')],_0x12f5eb[_0x5c3f('0x2f')]);_0x21b8ba['attributes']=_[_0x5c3f('0x31')](_0x12f5eb['model'],qs[_0x5c3f('0x32')](_0x3122ed['query'][_0x5c3f('0x32')]));_0x21b8ba[_0x5c3f('0x33')]=_0x21b8ba['attributes']['length']?_0x21b8ba[_0x5c3f('0x33')]:_0x12f5eb[_0x5c3f('0x2e')];if(_0x3122ed[_0x5c3f('0x2f')]['includeAll']){_0x21b8ba['include']=[{'all':!![]}];}_0x21b8ba=_['merge']({},_0x21b8ba,_0x3122ed[_0x5c3f('0x43')]);return db[_0x5c3f('0x2c')]['find'](_0x21b8ba)[_0x5c3f('0x25')](handleEntityNotFound(_0x31dcea,null))[_0x5c3f('0x25')](respondWithResult(_0x31dcea,null))[_0x5c3f('0x44')](handleError(_0x31dcea,null));};exports[_0x5c3f('0x45')]=function(_0x77b249,_0x4e6396){return db[_0x5c3f('0x2c')][_0x5c3f('0x45')](_0x77b249[_0x5c3f('0x46')],{})['then'](respondWithResult(_0x4e6396,0xc9))['catch'](handleError(_0x4e6396,null));};exports[_0x5c3f('0x24')]=function(_0x59490d,_0x787271){if(_0x59490d['body']['id']){delete _0x59490d[_0x5c3f('0x46')]['id'];}return db['ZohoConfiguration'][_0x5c3f('0x47')]({'where':{'id':_0x59490d['params']['id']}})[_0x5c3f('0x25')](handleEntityNotFound(_0x787271,null))[_0x5c3f('0x25')](saveUpdates(_0x59490d[_0x5c3f('0x46')],null))[_0x5c3f('0x25')](respondWithResult(_0x787271,null))[_0x5c3f('0x44')](handleError(_0x787271,null));};exports[_0x5c3f('0x26')]=function(_0x53b8e4,_0x45d31a){return db[_0x5c3f('0x2c')][_0x5c3f('0x47')]({'where':{'id':_0x53b8e4['params']['id']}})['then'](handleEntityNotFound(_0x45d31a,null))[_0x5c3f('0x25')](removeEntity(_0x45d31a,null))[_0x5c3f('0x44')](handleError(_0x45d31a,null));};exports['getFields']=function(_0x40f952,_0x245d41,_0x22329f){var _0x4560e1={};var _0x417a48={};var _0x20ecb2;var _0x23a9f0;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x40f952[_0x5c3f('0x41')]['id']}})['then'](handleEntityNotFound(_0x245d41,null))[_0x5c3f('0x25')](function(_0x2cbcf8){if(_0x2cbcf8){_0x20ecb2=_0x2cbcf8;_0x417a48[_0x5c3f('0x2e')]=_[_0x5c3f('0x42')](db['ZohoField'][_0x5c3f('0x48')]);_0x417a48[_0x5c3f('0x2f')]=_[_0x5c3f('0x42')](_0x40f952[_0x5c3f('0x2f')]);_0x417a48[_0x5c3f('0x30')]=_[_0x5c3f('0x31')](_0x417a48['model'],_0x417a48[_0x5c3f('0x2f')]);_0x4560e1[_0x5c3f('0x33')]=_[_0x5c3f('0x31')](_0x417a48[_0x5c3f('0x2e')],qs[_0x5c3f('0x32')](_0x40f952[_0x5c3f('0x2f')][_0x5c3f('0x32')]));_0x4560e1[_0x5c3f('0x33')]=_0x4560e1[_0x5c3f('0x33')][_0x5c3f('0x34')]?_0x4560e1[_0x5c3f('0x33')]:_0x417a48[_0x5c3f('0x2e')];_0x4560e1[_0x5c3f('0x49')]=qs[_0x5c3f('0x37')](_0x40f952[_0x5c3f('0x2f')]['sort']);_0x4560e1[_0x5c3f('0x38')]=qs[_0x5c3f('0x30')](_[_0x5c3f('0x39')](_0x40f952['query'],_0x417a48[_0x5c3f('0x30')]));if(_0x40f952[_0x5c3f('0x2f')]['filter']){_0x4560e1[_0x5c3f('0x38')]=_[_0x5c3f('0x3d')](_0x4560e1[_0x5c3f('0x38')],{'$or':_[_0x5c3f('0x2b')](_0x4560e1[_0x5c3f('0x33')],function(_0x38db73){var _0x43f760={};_0x43f760[_0x38db73]={'$like':'%'+_0x40f952[_0x5c3f('0x2f')][_0x5c3f('0x3a')]+'%'};return _0x43f760;})});}_0x4560e1=_[_0x5c3f('0x3d')]({},_0x4560e1,_0x40f952[_0x5c3f('0x43')]);return _0x20ecb2[_0x5c3f('0x4a')](_0x4560e1);}})['then'](function(_0x57bd4){if(_0x57bd4){_0x23a9f0=_0x57bd4[_0x5c3f('0x34')];if(!_0x40f952[_0x5c3f('0x2f')]['hasOwnProperty'](_0x5c3f('0x36'))){_0x4560e1[_0x5c3f('0x1f')]=qs[_0x5c3f('0x1f')](_0x40f952[_0x5c3f('0x2f')][_0x5c3f('0x1f')]);_0x4560e1[_0x5c3f('0x1c')]=qs[_0x5c3f('0x1c')](_0x40f952[_0x5c3f('0x2f')][_0x5c3f('0x1c')]);}return _0x20ecb2[_0x5c3f('0x4a')](_0x4560e1);}})['then'](function(_0x23e633){if(_0x23e633){return _0x23e633?{'count':_0x23a9f0,'rows':_0x23e633}:null;}})['then'](respondWithResult(_0x245d41,null))[_0x5c3f('0x44')](handleError(_0x245d41,null));};exports[_0x5c3f('0x4b')]=function(_0x4eab90,_0xa17694,_0x4bb04e){var _0x5d6023={};var _0x40f2c2={};var _0x141e8b;var _0x30235d;return db[_0x5c3f('0x2c')][_0x5c3f('0x4c')]({'where':{'id':_0x4eab90[_0x5c3f('0x41')]['id']}})[_0x5c3f('0x25')](handleEntityNotFound(_0xa17694,null))[_0x5c3f('0x25')](function(_0x4dfe10){if(_0x4dfe10){_0x141e8b=_0x4dfe10;_0x40f2c2['model']=_[_0x5c3f('0x42')](db[_0x5c3f('0x4d')][_0x5c3f('0x48')]);_0x40f2c2['query']=_[_0x5c3f('0x42')](_0x4eab90['query']);_0x40f2c2[_0x5c3f('0x30')]=_[_0x5c3f('0x31')](_0x40f2c2[_0x5c3f('0x2e')],_0x40f2c2[_0x5c3f('0x2f')]);_0x5d6023[_0x5c3f('0x33')]=_['intersection'](_0x40f2c2['model'],qs['fields'](_0x4eab90[_0x5c3f('0x2f')][_0x5c3f('0x32')]));_0x5d6023[_0x5c3f('0x33')]=_0x5d6023[_0x5c3f('0x33')][_0x5c3f('0x34')]?_0x5d6023['attributes']:_0x40f2c2['model'];_0x5d6023['order']=qs[_0x5c3f('0x37')](_0x4eab90[_0x5c3f('0x2f')]['sort']);_0x5d6023[_0x5c3f('0x38')]=qs[_0x5c3f('0x30')](_[_0x5c3f('0x39')](_0x4eab90[_0x5c3f('0x2f')],_0x40f2c2['filters']));if(_0x4eab90[_0x5c3f('0x2f')][_0x5c3f('0x3a')]){_0x5d6023[_0x5c3f('0x38')]=_[_0x5c3f('0x3d')](_0x5d6023['where'],{'$or':_[_0x5c3f('0x2b')](_0x5d6023[_0x5c3f('0x33')],function(_0x19fbce){var _0x1f7480={};_0x1f7480[_0x19fbce]={'$like':'%'+_0x4eab90[_0x5c3f('0x2f')]['filter']+'%'};return _0x1f7480;})});}_0x5d6023=_[_0x5c3f('0x3d')]({},_0x5d6023,_0x4eab90['options']);return _0x141e8b[_0x5c3f('0x4b')](_0x5d6023);}})[_0x5c3f('0x25')](function(_0x31b520){if(_0x31b520){_0x30235d=_0x31b520[_0x5c3f('0x34')];if(!_0x4eab90[_0x5c3f('0x2f')]['hasOwnProperty'](_0x5c3f('0x36'))){_0x5d6023[_0x5c3f('0x1f')]=qs[_0x5c3f('0x1f')](_0x4eab90['query'][_0x5c3f('0x1f')]);_0x5d6023['offset']=qs['offset'](_0x4eab90[_0x5c3f('0x2f')][_0x5c3f('0x1c')]);}return _0x141e8b[_0x5c3f('0x4b')](_0x5d6023);}})[_0x5c3f('0x25')](function(_0x4a174f){if(_0x4a174f){return _0x4a174f?{'count':_0x30235d,'rows':_0x4a174f}:null;}})[_0x5c3f('0x25')](respondWithResult(_0xa17694,null))[_0x5c3f('0x44')](handleError(_0xa17694,null));};exports[_0x5c3f('0x4e')]=function(_0x3aa84c,_0x48a978,_0x32f5cb){var _0x15a1e4={};var _0x47e6c1={};var _0x391cfd;var _0x6e385a;return db[_0x5c3f('0x2c')][_0x5c3f('0x4c')]({'where':{'id':_0x3aa84c['params']['id']}})[_0x5c3f('0x25')](handleEntityNotFound(_0x48a978,null))[_0x5c3f('0x25')](function(_0x36ebfc){if(_0x36ebfc){_0x391cfd=_0x36ebfc;_0x47e6c1[_0x5c3f('0x2e')]=_['keys'](db[_0x5c3f('0x4d')][_0x5c3f('0x48')]);_0x47e6c1['query']=_[_0x5c3f('0x42')](_0x3aa84c[_0x5c3f('0x2f')]);_0x47e6c1[_0x5c3f('0x30')]=_['intersection'](_0x47e6c1['model'],_0x47e6c1[_0x5c3f('0x2f')]);_0x15a1e4[_0x5c3f('0x33')]=_[_0x5c3f('0x31')](_0x47e6c1[_0x5c3f('0x2e')],qs['fields'](_0x3aa84c['query'][_0x5c3f('0x32')]));_0x15a1e4['attributes']=_0x15a1e4['attributes']['length']?_0x15a1e4[_0x5c3f('0x33')]:_0x47e6c1[_0x5c3f('0x2e')];_0x15a1e4[_0x5c3f('0x49')]=qs[_0x5c3f('0x37')](_0x3aa84c[_0x5c3f('0x2f')][_0x5c3f('0x37')]);_0x15a1e4[_0x5c3f('0x38')]=qs['filters'](_['pick'](_0x3aa84c[_0x5c3f('0x2f')],_0x47e6c1[_0x5c3f('0x30')]));if(_0x3aa84c[_0x5c3f('0x2f')][_0x5c3f('0x3a')]){_0x15a1e4['where']=_[_0x5c3f('0x3d')](_0x15a1e4['where'],{'$or':_[_0x5c3f('0x2b')](_0x15a1e4[_0x5c3f('0x33')],function(_0x360e84){var _0x3a0ae0={};_0x3a0ae0[_0x360e84]={'$like':'%'+_0x3aa84c[_0x5c3f('0x2f')][_0x5c3f('0x3a')]+'%'};return _0x3a0ae0;})});}_0x15a1e4=_[_0x5c3f('0x3d')]({},_0x15a1e4,_0x3aa84c[_0x5c3f('0x43')]);return _0x391cfd[_0x5c3f('0x4e')](_0x15a1e4);}})[_0x5c3f('0x25')](function(_0x545656){if(_0x545656){_0x6e385a=_0x545656[_0x5c3f('0x34')];if(!_0x3aa84c[_0x5c3f('0x2f')]['hasOwnProperty'](_0x5c3f('0x36'))){_0x15a1e4[_0x5c3f('0x1f')]=qs['limit'](_0x3aa84c['query']['limit']);_0x15a1e4[_0x5c3f('0x1c')]=qs[_0x5c3f('0x1c')](_0x3aa84c['query'][_0x5c3f('0x1c')]);}return _0x391cfd[_0x5c3f('0x4e')](_0x15a1e4);}})['then'](function(_0x46ae58){if(_0x46ae58){return _0x46ae58?{'count':_0x6e385a,'rows':_0x46ae58}:null;}})[_0x5c3f('0x25')](respondWithResult(_0x48a978,null))[_0x5c3f('0x44')](handleError(_0x48a978,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3b07184..ec8bbaa 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 _0x1398=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1398,0x14e));var _0x8139=function(_0x5df9fd,_0x3b2673){_0x5df9fd=_0x5df9fd-0x0;var _0x33a628=_0x1398[_0x5df9fd];return _0x33a628;};'use strict';var _=require(_0x8139('0x0'));var util=require(_0x8139('0x1'));var logger=require(_0x8139('0x2'))('api');var moment=require(_0x8139('0x3'));var BPromise=require(_0x8139('0x4'));var rp=require(_0x8139('0x5'));var fs=require('fs');var path=require(_0x8139('0x6'));var rimraf=require('rimraf');var config=require(_0x8139('0x7'));var attributes=require(_0x8139('0x8'));module[_0x8139('0x9')]=function(_0x525dcd,_0x66bdad){return _0x525dcd[_0x8139('0xa')](_0x8139('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac90=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xac90,0x1ed));var _0x0ac9=function(_0x405717,_0x3f9938){_0x405717=_0x405717-0x0;var _0xda0b7d=_0xac90[_0x405717];return _0xda0b7d;};'use strict';var _=require(_0x0ac9('0x0'));var util=require(_0x0ac9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0ac9('0x2'));var BPromise=require(_0x0ac9('0x3'));var rp=require(_0x0ac9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ac9('0x5'));var config=require(_0x0ac9('0x6'));var attributes=require(_0x0ac9('0x7'));module['exports']=function(_0x3f91ed,_0x207242){return _0x3f91ed[_0x0ac9('0x8')](_0x0ac9('0x9'),attributes,{'tableName':_0x0ac9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index dfcaaa3..9a57426 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 _0x94ac=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0xf6eda5,_0x3b2921){var _0x1dd6d9=function(_0x26e364){while(--_0x26e364){_0xf6eda5['push'](_0xf6eda5['shift']());}};_0x1dd6d9(++_0x3b2921);}(_0x94ac,0xe4));var _0xc94a=function(_0x4ba90d,_0x41bf2e){_0x4ba90d=_0x4ba90d-0x0;var _0x7e2b40=_0x94ac[_0x4ba90d];return _0x7e2b40;};'use strict';var _=require(_0xc94a('0x0'));var util=require('util');var moment=require(_0xc94a('0x1'));var BPromise=require(_0xc94a('0x2'));var rs=require(_0xc94a('0x3'));var fs=require('fs');var Redis=require(_0xc94a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc94a('0x5'));var logger=require(_0xc94a('0x6'))(_0xc94a('0x7'));var config=require(_0xc94a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x232074,_0x2460b7,_0x21f4b1){return new BPromise(function(_0x109be5,_0x4865c7){return client[_0xc94a('0x9')](_0x232074,_0x21f4b1)[_0xc94a('0xa')](function(_0x456103){logger[_0xc94a('0xb')](_0xc94a('0xc'),_0x2460b7,_0xc94a('0xd'));logger[_0xc94a('0xe')](_0xc94a('0xf'),_0x2460b7,_0xc94a('0xd'),JSON['stringify'](_0x456103));if(_0x456103['error']){if(_0x456103[_0xc94a('0x10')][_0xc94a('0x11')]===0x1f4){logger['error'](_0xc94a('0xc'),_0x2460b7,_0x456103['error']['message']);return _0x4865c7(_0x456103[_0xc94a('0x10')][_0xc94a('0x12')]);}logger[_0xc94a('0x10')](_0xc94a('0xc'),_0x2460b7,_0x456103[_0xc94a('0x10')][_0xc94a('0x12')]);return _0x109be5(_0x456103['error'][_0xc94a('0x12')]);}else{logger[_0xc94a('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x2460b7,_0xc94a('0xd'));_0x109be5(_0x456103[_0xc94a('0x13')][_0xc94a('0x12')]);}})[_0xc94a('0x14')](function(_0x3c1585){logger['error'](_0xc94a('0xc'),_0x2460b7,_0x3c1585);_0x4865c7(_0x3c1585);});});} \ No newline at end of file +var _0xb250=['client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0xb250,0x1bf));var _0x0b25=function(_0x229ce9,_0x2c9bb3){_0x229ce9=_0x229ce9-0x0;var _0x52194b=_0xb250[_0x229ce9];return _0x52194b;};'use strict';var _=require(_0x0b25('0x0'));var util=require(_0x0b25('0x1'));var moment=require('moment');var BPromise=require(_0x0b25('0x2'));var rs=require(_0x0b25('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b25('0x4'))['db'];var utils=require(_0x0b25('0x5'));var logger=require(_0x0b25('0x6'))('rpc');var config=require(_0x0b25('0x7'));var jayson=require(_0x0b25('0x8'));var client=jayson[_0x0b25('0x9')][_0x0b25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7aede8,_0x2bd7ef,_0x28a97f){return new BPromise(function(_0x2e2d89,_0x1fba95){return client[_0x0b25('0xb')](_0x7aede8,_0x28a97f)[_0x0b25('0xc')](function(_0x39c3e1){logger[_0x0b25('0xd')](_0x0b25('0xe'),_0x2bd7ef,'request\x20sent');logger[_0x0b25('0xf')](_0x0b25('0x10'),_0x2bd7ef,_0x0b25('0x11'),JSON[_0x0b25('0x12')](_0x39c3e1));if(_0x39c3e1[_0x0b25('0x13')]){if(_0x39c3e1['error'][_0x0b25('0x14')]===0x1f4){logger['error'](_0x0b25('0xe'),_0x2bd7ef,_0x39c3e1[_0x0b25('0x13')][_0x0b25('0x15')]);return _0x1fba95(_0x39c3e1[_0x0b25('0x13')][_0x0b25('0x15')]);}logger[_0x0b25('0x13')](_0x0b25('0xe'),_0x2bd7ef,_0x39c3e1[_0x0b25('0x13')][_0x0b25('0x15')]);return _0x2e2d89(_0x39c3e1['error'][_0x0b25('0x15')]);}else{logger[_0x0b25('0xd')](_0x0b25('0xe'),_0x2bd7ef,_0x0b25('0x11'));_0x2e2d89(_0x39c3e1[_0x0b25('0x16')][_0x0b25('0x15')]);}})[_0x0b25('0x17')](function(_0x18241e){logger[_0x0b25('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x2bd7ef,_0x18241e);_0x1fba95(_0x18241e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c299e1e..c53ac89 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 _0x306b=['../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xbf2e46,_0x2f902d){var _0x9940a1=function(_0x3db5dc){while(--_0x3db5dc){_0xbf2e46['push'](_0xbf2e46['shift']());}};_0x9940a1(++_0x2f902d);}(_0x306b,0x128));var _0xb306=function(_0x4e7571,_0x357694){_0x4e7571=_0x4e7571-0x0;var _0x924c7c=_0x306b[_0x4e7571];return _0x924c7c;};'use strict';var multer=require(_0xb306('0x0'));var util=require(_0xb306('0x1'));var path=require(_0xb306('0x2'));var timeout=require(_0xb306('0x3'));var express=require('express');var router=express[_0xb306('0x4')]();var fs_extra=require(_0xb306('0x5'));var auth=require(_0xb306('0x6'));var interaction=require(_0xb306('0x7'));var config=require(_0xb306('0x8'));var controller=require(_0xb306('0x9'));router[_0xb306('0xa')]('/',auth[_0xb306('0xb')](),controller['index']);router[_0xb306('0xa')](_0xb306('0xc'),auth[_0xb306('0xb')](),controller[_0xb306('0xd')]);router[_0xb306('0xe')]('/',auth[_0xb306('0xb')](),controller[_0xb306('0xf')]);router[_0xb306('0x10')](_0xb306('0xc'),auth[_0xb306('0xb')](),controller[_0xb306('0x11')]);router[_0xb306('0x12')](_0xb306('0xc'),auth[_0xb306('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2aa6=['isAuthenticated','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x2aa6,0x106));var _0x62aa=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x2aa6[_0x1cd47d];return _0x29d52f;};'use strict';var multer=require(_0x62aa('0x0'));var util=require(_0x62aa('0x1'));var path=require(_0x62aa('0x2'));var timeout=require(_0x62aa('0x3'));var express=require(_0x62aa('0x4'));var router=express[_0x62aa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x62aa('0x6'));var interaction=require(_0x62aa('0x7'));var config=require('../../config/environment');var controller=require(_0x62aa('0x8'));router[_0x62aa('0x9')]('/',auth[_0x62aa('0xa')](),controller['index']);router[_0x62aa('0x9')](_0x62aa('0xb'),auth[_0x62aa('0xa')](),controller[_0x62aa('0xc')]);router[_0x62aa('0xd')]('/',auth[_0x62aa('0xa')](),controller['create']);router[_0x62aa('0xe')](_0x62aa('0xb'),auth[_0x62aa('0xa')](),controller['update']);router[_0x62aa('0xf')](_0x62aa('0xb'),auth[_0x62aa('0xa')](),controller['destroy']);module[_0x62aa('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2e4a917..f45a1bc 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 _0x264c=['variable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x2e2079,_0x4c18ea){var _0x1b7d98=function(_0x414034){while(--_0x414034){_0x2e2079['push'](_0x2e2079['shift']());}};_0x1b7d98(++_0x4c18ea);}(_0x264c,0x1e5));var _0xc264=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x264c[_0x257a28];return _0x13bccc;};'use strict';var Sequelize=require(_0xc264('0x0'));module['exports']={'type':{'type':Sequelize[_0xc264('0x1')](_0xc264('0x2'),_0xc264('0x3'),'customVariable',_0xc264('0x4'),_0xc264('0x5')),'defaultValue':_0xc264('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc264('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc264('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc264('0x6')]},'idField':{'type':Sequelize[_0xc264('0x6')]},'nameField':{'type':Sequelize[_0xc264('0x6')]},'customField':{'type':Sequelize[_0xc264('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecc8=['STRING','ENUM','variable','customVariable','BOOLEAN','string','keyValue'];(function(_0x39a73c,_0x4ec34a){var _0x920fa0=function(_0x122c29){while(--_0x122c29){_0x39a73c['push'](_0x39a73c['shift']());}};_0x920fa0(++_0x4ec34a);}(_0xecc8,0x9f));var _0x8ecc=function(_0x4db9be,_0x3850a5){_0x4db9be=_0x4db9be-0x0;var _0x2d0cdc=_0xecc8[_0x4db9be];return _0x2d0cdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x8ecc('0x0'),'variable','customVariable',_0x8ecc('0x1'),'picklist'),'defaultValue':_0x8ecc('0x0')},'content':{'type':Sequelize[_0x8ecc('0x2')]},'key':{'type':Sequelize[_0x8ecc('0x2')]},'keyType':{'type':Sequelize[_0x8ecc('0x3')](_0x8ecc('0x0'),_0x8ecc('0x4'),_0x8ecc('0x5'))},'keyContent':{'type':Sequelize[_0x8ecc('0x2')]},'idField':{'type':Sequelize[_0x8ecc('0x2')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8ecc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ecc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 35635ae..10b82c6 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 _0xb345=['request-promise','moment','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','ZohoField','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','body','update','eml-format','fast-json-patch'];(function(_0x15e03c,_0x44aad7){var _0xc86d9a=function(_0xb89fae){while(--_0xb89fae){_0x15e03c['push'](_0x15e03c['shift']());}};_0xc86d9a(++_0x44aad7);}(_0xb345,0x15c));var _0x5b34=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb345[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x5b34('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b34('0x1'));var rp=require(_0x5b34('0x2'));var moment=require(_0x5b34('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b34('0x4'));var path=require(_0x5b34('0x5'));var sox=require(_0x5b34('0x6'));var csv=require(_0x5b34('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5b34('0x8'));var crypto=require('crypto');var jsforce=require(_0x5b34('0x9'));var deskjs=require(_0x5b34('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b34('0xb'));var Redis=require(_0x5b34('0xc'));var authService=require(_0x5b34('0xd'));var qs=require(_0x5b34('0xe'));var as=require(_0x5b34('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b34('0x10'))(_0x5b34('0x11'));var utils=require(_0x5b34('0x12'));var config=require(_0x5b34('0x13'));var licenseUtil=require(_0x5b34('0x14'));var db=require(_0x5b34('0x15'))['db'];function respondWithStatusCode(_0x174076,_0x282b66){_0x282b66=_0x282b66||0xcc;return function(_0x1c1944){if(_0x1c1944){return _0x174076['sendStatus'](_0x282b66);}return _0x174076[_0x5b34('0x16')](_0x282b66)[_0x5b34('0x17')]();};}function respondWithResult(_0x552f89,_0xb52d81){_0xb52d81=_0xb52d81||0xc8;return function(_0xa99336){if(_0xa99336){return _0x552f89[_0x5b34('0x16')](_0xb52d81)[_0x5b34('0x18')](_0xa99336);}};}function respondWithFilteredResult(_0x9de398,_0x3d748d){return function(_0x12c7af){if(_0x12c7af){var _0x5a17d1=typeof _0x3d748d['offset']===_0x5b34('0x19')&&typeof _0x3d748d[_0x5b34('0x1a')]===_0x5b34('0x19');var _0x14c673=_0x12c7af[_0x5b34('0x1b')];var _0x201100=_0x5a17d1?0x0:_0x3d748d[_0x5b34('0x1c')];var _0x1bff87=_0x5a17d1?_0x12c7af[_0x5b34('0x1b')]:_0x3d748d[_0x5b34('0x1c')]+_0x3d748d[_0x5b34('0x1a')];var _0x4d4b8e;if(_0x1bff87>=_0x14c673){_0x1bff87=_0x14c673;_0x4d4b8e=0xc8;}else{_0x4d4b8e=0xce;}_0x9de398[_0x5b34('0x16')](_0x4d4b8e);return _0x9de398[_0x5b34('0x1d')](_0x5b34('0x1e'),_0x201100+'-'+_0x1bff87+'/'+_0x14c673)[_0x5b34('0x18')](_0x12c7af);}return null;};}function patchUpdates(_0x5b4e74){return function(_0x179b9a){try{jsonpatch[_0x5b34('0x1f')](_0x179b9a,_0x5b4e74,!![]);}catch(_0x1a363c){return BPromise[_0x5b34('0x20')](_0x1a363c);}return _0x179b9a[_0x5b34('0x21')]();};}function saveUpdates(_0x21bdea,_0x4a356e){return function(_0x3929e8){if(_0x3929e8){return _0x3929e8['update'](_0x21bdea)[_0x5b34('0x22')](function(_0x79fa40){return _0x79fa40;});}return null;};}function removeEntity(_0x27aa7d,_0x1ce30a){return function(_0x2073fb){if(_0x2073fb){return _0x2073fb[_0x5b34('0x23')]()[_0x5b34('0x22')](function(){_0x27aa7d[_0x5b34('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f929,_0x2b416d){return function(_0x5439da){if(!_0x5439da){_0x17f929[_0x5b34('0x24')](0x194);}return _0x5439da;};}function handleError(_0x4a3928,_0x6bcd77){_0x6bcd77=_0x6bcd77||0x1f4;return function(_0x601f81){logger['error'](_0x601f81['stack']);if(_0x601f81[_0x5b34('0x25')]){delete _0x601f81[_0x5b34('0x25')];}_0x4a3928['status'](_0x6bcd77)[_0x5b34('0x26')](_0x601f81);};}exports['index']=function(_0x3c5092,_0x5bc281){var _0x3c240f={},_0xea2412={},_0x1ee0ba={'count':0x0,'rows':[]};var _0x4bb23b=_['map'](db[_0x5b34('0x27')]['rawAttributes'],function(_0x15f701){return{'name':_0x15f701['fieldName'],'type':_0x15f701['type'][_0x5b34('0x28')]};});_0xea2412['model']=_[_0x5b34('0x29')](_0x4bb23b,'name');_0xea2412[_0x5b34('0x2a')]=_['keys'](_0x3c5092[_0x5b34('0x2a')]);_0xea2412[_0x5b34('0x2b')]=_[_0x5b34('0x2c')](_0xea2412[_0x5b34('0x2d')],_0xea2412['query']);_0x3c240f[_0x5b34('0x2e')]=_[_0x5b34('0x2c')](_0xea2412[_0x5b34('0x2d')],qs[_0x5b34('0x2f')](_0x3c5092['query']['fields']));_0x3c240f[_0x5b34('0x2e')]=_0x3c240f[_0x5b34('0x2e')]['length']?_0x3c240f[_0x5b34('0x2e')]:_0xea2412[_0x5b34('0x2d')];if(!_0x3c5092[_0x5b34('0x2a')]['hasOwnProperty'](_0x5b34('0x30'))){_0x3c240f[_0x5b34('0x1a')]=qs['limit'](_0x3c5092[_0x5b34('0x2a')][_0x5b34('0x1a')]);_0x3c240f[_0x5b34('0x1c')]=qs[_0x5b34('0x1c')](_0x3c5092[_0x5b34('0x2a')][_0x5b34('0x1c')]);}_0x3c240f[_0x5b34('0x31')]=qs[_0x5b34('0x32')](_0x3c5092[_0x5b34('0x2a')][_0x5b34('0x32')]);_0x3c240f[_0x5b34('0x33')]=qs[_0x5b34('0x2b')](_['pick'](_0x3c5092[_0x5b34('0x2a')],_0xea2412['filters']),_0x4bb23b);if(_0x3c5092[_0x5b34('0x2a')][_0x5b34('0x34')]){_0x3c240f[_0x5b34('0x33')]=_[_0x5b34('0x35')](_0x3c240f[_0x5b34('0x33')],{'$or':_[_0x5b34('0x29')](_0x4bb23b,function(_0x134fd9){if(_0x134fd9[_0x5b34('0x36')]!==_0x5b34('0x37')){var _0xd4e124={};_0xd4e124[_0x134fd9[_0x5b34('0x25')]]={'$like':'%'+_0x3c5092[_0x5b34('0x2a')][_0x5b34('0x34')]+'%'};return _0xd4e124;}})});}_0x3c240f=_[_0x5b34('0x35')]({},_0x3c240f,_0x3c5092[_0x5b34('0x38')]);var _0x3fe117={'where':_0x3c240f[_0x5b34('0x33')]};return db[_0x5b34('0x27')][_0x5b34('0x1b')](_0x3fe117)[_0x5b34('0x22')](function(_0x1dce4a){_0x1ee0ba[_0x5b34('0x1b')]=_0x1dce4a;if(_0x3c5092[_0x5b34('0x2a')][_0x5b34('0x39')]){_0x3c240f[_0x5b34('0x3a')]=[{'all':!![]}];}return db['ZohoField'][_0x5b34('0x3b')](_0x3c240f);})[_0x5b34('0x22')](function(_0x25a2cb){_0x1ee0ba['rows']=_0x25a2cb;return _0x1ee0ba;})['then'](respondWithFilteredResult(_0x5bc281,_0x3c240f))[_0x5b34('0x3c')](handleError(_0x5bc281,null));};exports[_0x5b34('0x3d')]=function(_0x21b9dc,_0x7bccf0){var _0x4faef6={'raw':!![],'where':{'id':_0x21b9dc[_0x5b34('0x3e')]['id']}},_0x15409e={};_0x15409e[_0x5b34('0x2d')]=_[_0x5b34('0x3f')](db[_0x5b34('0x27')][_0x5b34('0x40')]);_0x15409e['query']=_[_0x5b34('0x3f')](_0x21b9dc[_0x5b34('0x2a')]);_0x15409e[_0x5b34('0x2b')]=_[_0x5b34('0x2c')](_0x15409e[_0x5b34('0x2d')],_0x15409e['query']);_0x4faef6[_0x5b34('0x2e')]=_['intersection'](_0x15409e['model'],qs[_0x5b34('0x2f')](_0x21b9dc[_0x5b34('0x2a')][_0x5b34('0x2f')]));_0x4faef6[_0x5b34('0x2e')]=_0x4faef6[_0x5b34('0x2e')][_0x5b34('0x41')]?_0x4faef6[_0x5b34('0x2e')]:_0x15409e[_0x5b34('0x2d')];if(_0x21b9dc[_0x5b34('0x2a')]['includeAll']){_0x4faef6[_0x5b34('0x3a')]=[{'all':!![]}];}_0x4faef6=_['merge']({},_0x4faef6,_0x21b9dc[_0x5b34('0x38')]);return db[_0x5b34('0x27')][_0x5b34('0x42')](_0x4faef6)[_0x5b34('0x22')](handleEntityNotFound(_0x7bccf0,null))[_0x5b34('0x22')](respondWithResult(_0x7bccf0,null))['catch'](handleError(_0x7bccf0,null));};exports[_0x5b34('0x43')]=function(_0x4f6f40,_0x42fb8b){return db[_0x5b34('0x27')][_0x5b34('0x43')](_0x4f6f40[_0x5b34('0x44')],{})[_0x5b34('0x22')](respondWithResult(_0x42fb8b,0xc9))['catch'](handleError(_0x42fb8b,null));};exports[_0x5b34('0x45')]=function(_0x2caa64,_0x43defc){if(_0x2caa64[_0x5b34('0x44')]['id']){delete _0x2caa64[_0x5b34('0x44')]['id'];}return db[_0x5b34('0x27')][_0x5b34('0x42')]({'where':{'id':_0x2caa64[_0x5b34('0x3e')]['id']}})[_0x5b34('0x22')](handleEntityNotFound(_0x43defc,null))[_0x5b34('0x22')](saveUpdates(_0x2caa64[_0x5b34('0x44')],null))[_0x5b34('0x22')](respondWithResult(_0x43defc,null))[_0x5b34('0x3c')](handleError(_0x43defc,null));};exports[_0x5b34('0x23')]=function(_0x5c4fba,_0x5c65d7){return db[_0x5b34('0x27')][_0x5b34('0x42')]({'where':{'id':_0x5c4fba[_0x5b34('0x3e')]['id']}})[_0x5b34('0x22')](handleEntityNotFound(_0x5c65d7,null))[_0x5b34('0x22')](removeEntity(_0x5c65d7,null))[_0x5b34('0x3c')](handleError(_0x5c65d7,null));}; \ No newline at end of file +var _0x13e6=['find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','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','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','pick','where','merge','VIRTUAL','ZohoField','includeAll','include','findAll','rows','show'];(function(_0x560da8,_0xa92f){var _0x252ea3=function(_0x187e6a){while(--_0x187e6a){_0x560da8['push'](_0x560da8['shift']());}};_0x252ea3(++_0xa92f);}(_0x13e6,0x1a3));var _0x613e=function(_0x50e822,_0x1e62a2){_0x50e822=_0x50e822-0x0;var _0x429b9b=_0x13e6[_0x50e822];return _0x429b9b;};'use strict';var emlformat=require(_0x613e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x613e('0x1'));var jsonpatch=require(_0x613e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x613e('0x3'));var Mustache=require(_0x613e('0x4'));var util=require(_0x613e('0x5'));var path=require(_0x613e('0x6'));var sox=require('sox');var csv=require(_0x613e('0x7'));var ejs=require(_0x613e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x613e('0x9'));var crypto=require('crypto');var jsforce=require(_0x613e('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x613e('0xb'));var Papa=require(_0x613e('0xc'));var Redis=require('ioredis');var authService=require(_0x613e('0xd'));var qs=require(_0x613e('0xe'));var as=require(_0x613e('0xf'));var hardwareService=require(_0x613e('0x10'));var logger=require(_0x613e('0x11'))(_0x613e('0x12'));var utils=require(_0x613e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613e('0x14'));var db=require(_0x613e('0x15'))['db'];function respondWithStatusCode(_0x4ef8aa,_0x5e8654){_0x5e8654=_0x5e8654||0xcc;return function(_0x419463){if(_0x419463){return _0x4ef8aa[_0x613e('0x16')](_0x5e8654);}return _0x4ef8aa[_0x613e('0x17')](_0x5e8654)[_0x613e('0x18')]();};}function respondWithResult(_0x3ffed6,_0xc0220){_0xc0220=_0xc0220||0xc8;return function(_0x355d59){if(_0x355d59){return _0x3ffed6['status'](_0xc0220)['json'](_0x355d59);}};}function respondWithFilteredResult(_0x38bc19,_0x4abb30){return function(_0x342a1c){if(_0x342a1c){var _0xb91841=typeof _0x4abb30[_0x613e('0x19')]===_0x613e('0x1a')&&typeof _0x4abb30['limit']===_0x613e('0x1a');var _0x14b8bd=_0x342a1c[_0x613e('0x1b')];var _0x3abe84=_0xb91841?0x0:_0x4abb30['offset'];var _0x3fb770=_0xb91841?_0x342a1c['count']:_0x4abb30['offset']+_0x4abb30[_0x613e('0x1c')];var _0x27b3c6;if(_0x3fb770>=_0x14b8bd){_0x3fb770=_0x14b8bd;_0x27b3c6=0xc8;}else{_0x27b3c6=0xce;}_0x38bc19['status'](_0x27b3c6);return _0x38bc19[_0x613e('0x1d')](_0x613e('0x1e'),_0x3abe84+'-'+_0x3fb770+'/'+_0x14b8bd)[_0x613e('0x1f')](_0x342a1c);}return null;};}function patchUpdates(_0x4fffc4){return function(_0x58b114){try{jsonpatch[_0x613e('0x20')](_0x58b114,_0x4fffc4,!![]);}catch(_0x2d6831){return BPromise[_0x613e('0x21')](_0x2d6831);}return _0x58b114['save']();};}function saveUpdates(_0x47dd56,_0x36e956){return function(_0x52a37b){if(_0x52a37b){return _0x52a37b[_0x613e('0x22')](_0x47dd56)[_0x613e('0x23')](function(_0x20991a){return _0x20991a;});}return null;};}function removeEntity(_0x4172b3,_0x29f7cf){return function(_0x3fd48d){if(_0x3fd48d){return _0x3fd48d[_0x613e('0x24')]()[_0x613e('0x23')](function(){_0x4172b3[_0x613e('0x17')](0xcc)[_0x613e('0x18')]();});}};}function handleEntityNotFound(_0xe5a65,_0x18608d){return function(_0x51364){if(!_0x51364){_0xe5a65[_0x613e('0x16')](0x194);}return _0x51364;};}function handleError(_0x217f3c,_0x25c04d){_0x25c04d=_0x25c04d||0x1f4;return function(_0x5f1447){logger[_0x613e('0x25')](_0x5f1447['stack']);if(_0x5f1447[_0x613e('0x26')]){delete _0x5f1447[_0x613e('0x26')];}_0x217f3c[_0x613e('0x17')](_0x25c04d)[_0x613e('0x27')](_0x5f1447);};}exports['index']=function(_0x36aecd,_0x47f727){var _0x55b32a={},_0x466e7d={},_0x350c66={'count':0x0,'rows':[]};var _0x31a58d=_[_0x613e('0x28')](db['ZohoField'][_0x613e('0x29')],function(_0x5333f4){return{'name':_0x5333f4['fieldName'],'type':_0x5333f4[_0x613e('0x2a')][_0x613e('0x2b')]};});_0x466e7d[_0x613e('0x2c')]=_[_0x613e('0x28')](_0x31a58d,_0x613e('0x26'));_0x466e7d[_0x613e('0x2d')]=_[_0x613e('0x2e')](_0x36aecd[_0x613e('0x2d')]);_0x466e7d[_0x613e('0x2f')]=_[_0x613e('0x30')](_0x466e7d['model'],_0x466e7d[_0x613e('0x2d')]);_0x55b32a['attributes']=_[_0x613e('0x30')](_0x466e7d['model'],qs['fields'](_0x36aecd['query'][_0x613e('0x31')]));_0x55b32a['attributes']=_0x55b32a['attributes'][_0x613e('0x32')]?_0x55b32a[_0x613e('0x33')]:_0x466e7d[_0x613e('0x2c')];if(!_0x36aecd[_0x613e('0x2d')][_0x613e('0x34')]('nolimit')){_0x55b32a[_0x613e('0x1c')]=qs[_0x613e('0x1c')](_0x36aecd[_0x613e('0x2d')]['limit']);_0x55b32a[_0x613e('0x19')]=qs[_0x613e('0x19')](_0x36aecd[_0x613e('0x2d')]['offset']);}_0x55b32a[_0x613e('0x35')]=qs['sort'](_0x36aecd[_0x613e('0x2d')]['sort']);_0x55b32a['where']=qs[_0x613e('0x2f')](_[_0x613e('0x36')](_0x36aecd['query'],_0x466e7d[_0x613e('0x2f')]),_0x31a58d);if(_0x36aecd[_0x613e('0x2d')]['filter']){_0x55b32a[_0x613e('0x37')]=_[_0x613e('0x38')](_0x55b32a[_0x613e('0x37')],{'$or':_[_0x613e('0x28')](_0x31a58d,function(_0x4b1c38){if(_0x4b1c38[_0x613e('0x2a')]!==_0x613e('0x39')){var _0x3abe72={};_0x3abe72[_0x4b1c38[_0x613e('0x26')]]={'$like':'%'+_0x36aecd[_0x613e('0x2d')]['filter']+'%'};return _0x3abe72;}})});}_0x55b32a=_[_0x613e('0x38')]({},_0x55b32a,_0x36aecd['options']);var _0x319d2a={'where':_0x55b32a['where']};return db[_0x613e('0x3a')][_0x613e('0x1b')](_0x319d2a)[_0x613e('0x23')](function(_0x49beb5){_0x350c66[_0x613e('0x1b')]=_0x49beb5;if(_0x36aecd[_0x613e('0x2d')][_0x613e('0x3b')]){_0x55b32a[_0x613e('0x3c')]=[{'all':!![]}];}return db[_0x613e('0x3a')][_0x613e('0x3d')](_0x55b32a);})[_0x613e('0x23')](function(_0x5b6c62){_0x350c66[_0x613e('0x3e')]=_0x5b6c62;return _0x350c66;})[_0x613e('0x23')](respondWithFilteredResult(_0x47f727,_0x55b32a))['catch'](handleError(_0x47f727,null));};exports[_0x613e('0x3f')]=function(_0x30e69d,_0x228d6f){var _0x56e64c={'raw':!![],'where':{'id':_0x30e69d['params']['id']}},_0x3b2f25={};_0x3b2f25['model']=_[_0x613e('0x2e')](db[_0x613e('0x3a')][_0x613e('0x29')]);_0x3b2f25['query']=_[_0x613e('0x2e')](_0x30e69d[_0x613e('0x2d')]);_0x3b2f25['filters']=_[_0x613e('0x30')](_0x3b2f25[_0x613e('0x2c')],_0x3b2f25[_0x613e('0x2d')]);_0x56e64c[_0x613e('0x33')]=_[_0x613e('0x30')](_0x3b2f25['model'],qs[_0x613e('0x31')](_0x30e69d['query'][_0x613e('0x31')]));_0x56e64c[_0x613e('0x33')]=_0x56e64c['attributes'][_0x613e('0x32')]?_0x56e64c[_0x613e('0x33')]:_0x3b2f25[_0x613e('0x2c')];if(_0x30e69d[_0x613e('0x2d')][_0x613e('0x3b')]){_0x56e64c[_0x613e('0x3c')]=[{'all':!![]}];}_0x56e64c=_[_0x613e('0x38')]({},_0x56e64c,_0x30e69d['options']);return db[_0x613e('0x3a')][_0x613e('0x40')](_0x56e64c)[_0x613e('0x23')](handleEntityNotFound(_0x228d6f,null))['then'](respondWithResult(_0x228d6f,null))[_0x613e('0x41')](handleError(_0x228d6f,null));};exports['create']=function(_0x3fe849,_0x277387){return db[_0x613e('0x3a')][_0x613e('0x42')](_0x3fe849[_0x613e('0x43')],{})['then'](respondWithResult(_0x277387,0xc9))[_0x613e('0x41')](handleError(_0x277387,null));};exports['update']=function(_0x591490,_0x3df3fb){if(_0x591490[_0x613e('0x43')]['id']){delete _0x591490[_0x613e('0x43')]['id'];}return db[_0x613e('0x3a')][_0x613e('0x40')]({'where':{'id':_0x591490[_0x613e('0x44')]['id']}})[_0x613e('0x23')](handleEntityNotFound(_0x3df3fb,null))[_0x613e('0x23')](saveUpdates(_0x591490[_0x613e('0x43')],null))[_0x613e('0x23')](respondWithResult(_0x3df3fb,null))[_0x613e('0x41')](handleError(_0x3df3fb,null));};exports['destroy']=function(_0x175bf0,_0x5a9e33){return db[_0x613e('0x3a')][_0x613e('0x40')]({'where':{'id':_0x175bf0['params']['id']}})[_0x613e('0x23')](handleEntityNotFound(_0x5a9e33,null))[_0x613e('0x23')](removeEntity(_0x5a9e33,null))['catch'](handleError(_0x5a9e33,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 48f2877..1ef52af 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 _0x7096=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','util','api','bluebird','request-promise','path'];(function(_0x15b168,_0x3d31a0){var _0x408ac2=function(_0x253c56){while(--_0x253c56){_0x15b168['push'](_0x15b168['shift']());}};_0x408ac2(++_0x3d31a0);}(_0x7096,0x10c));var _0x6709=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7096[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27a0=['../../config/logger','api','moment','bluebird','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27a0,0xbf));var _0x027a=function(_0x5dfa21,_0x3f6ae5){_0x5dfa21=_0x5dfa21-0x0;var _0x32e28f=_0x27a0[_0x5dfa21];return _0x32e28f;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x027a('0x9'),'fields':[_0x027a('0xa'),_0x027a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 1dd461e..064372a 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 _0xbebd=['ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x5801ca,_0x7a4caa){var _0x6301c3=function(_0x47c9f8){while(--_0x47c9f8){_0x5801ca['push'](_0x5801ca['shift']());}};_0x6301c3(++_0x7a4caa);}(_0xbebd,0x9b));var _0xdbeb=function(_0x4085e1,_0x3b131e){_0x4085e1=_0x4085e1-0x0;var _0x26bfe6=_0xbebd[_0x4085e1];return _0x26bfe6;};'use strict';var _=require('lodash');var util=require(_0xdbeb('0x0'));var moment=require(_0xdbeb('0x1'));var BPromise=require(_0xdbeb('0x2'));var rs=require(_0xdbeb('0x3'));var fs=require('fs');var Redis=require(_0xdbeb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbeb('0x5'));var logger=require(_0xdbeb('0x6'))(_0xdbeb('0x7'));var config=require(_0xdbeb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdbeb('0x9')][_0xdbeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3768ce,_0x5d3e56,_0x3640ba){return new BPromise(function(_0x586569,_0x375e62){return client['request'](_0x3768ce,_0x3640ba)[_0xdbeb('0xb')](function(_0x53e9c6){logger[_0xdbeb('0xc')](_0xdbeb('0xd'),_0x5d3e56,_0xdbeb('0xe'));logger['debug'](_0xdbeb('0xf'),_0x5d3e56,_0xdbeb('0xe'),JSON[_0xdbeb('0x10')](_0x53e9c6));if(_0x53e9c6[_0xdbeb('0x11')]){if(_0x53e9c6[_0xdbeb('0x11')][_0xdbeb('0x12')]===0x1f4){logger[_0xdbeb('0x11')](_0xdbeb('0xd'),_0x5d3e56,_0x53e9c6[_0xdbeb('0x11')][_0xdbeb('0x13')]);return _0x375e62(_0x53e9c6[_0xdbeb('0x11')][_0xdbeb('0x13')]);}logger['error'](_0xdbeb('0xd'),_0x5d3e56,_0x53e9c6[_0xdbeb('0x11')][_0xdbeb('0x13')]);return _0x586569(_0x53e9c6[_0xdbeb('0x11')][_0xdbeb('0x13')]);}else{logger['info'](_0xdbeb('0xd'),_0x5d3e56,_0xdbeb('0xe'));_0x586569(_0x53e9c6[_0xdbeb('0x14')][_0xdbeb('0x13')]);}})['catch'](function(_0x61c3a8){logger[_0xdbeb('0x11')]('ZohoField,\x20%s,\x20%s',_0x5d3e56,_0x61c3a8);_0x375e62(_0x61c3a8);});});} \ No newline at end of file +var _0xae34=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0xae34,0x99));var _0x4ae3=function(_0x564194,_0x4fff54){_0x564194=_0x564194-0x0;var _0x2aef62=_0xae34[_0x564194];return _0x2aef62;};'use strict';var _=require(_0x4ae3('0x0'));var util=require(_0x4ae3('0x1'));var moment=require('moment');var BPromise=require(_0x4ae3('0x2'));var rs=require(_0x4ae3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ae3('0x4'))['db'];var utils=require(_0x4ae3('0x5'));var logger=require(_0x4ae3('0x6'))(_0x4ae3('0x7'));var config=require('../../config/environment');var jayson=require(_0x4ae3('0x8'));var client=jayson[_0x4ae3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a9133,_0xaee597,_0x5d6ebc){return new BPromise(function(_0x135848,_0x55fad6){return client[_0x4ae3('0xa')](_0x4a9133,_0x5d6ebc)[_0x4ae3('0xb')](function(_0x1a3932){logger[_0x4ae3('0xc')](_0x4ae3('0xd'),_0xaee597,'request\x20sent');logger[_0x4ae3('0xe')](_0x4ae3('0xf'),_0xaee597,_0x4ae3('0x10'),JSON[_0x4ae3('0x11')](_0x1a3932));if(_0x1a3932[_0x4ae3('0x12')]){if(_0x1a3932[_0x4ae3('0x12')][_0x4ae3('0x13')]===0x1f4){logger[_0x4ae3('0x12')](_0x4ae3('0xd'),_0xaee597,_0x1a3932['error'][_0x4ae3('0x14')]);return _0x55fad6(_0x1a3932[_0x4ae3('0x12')][_0x4ae3('0x14')]);}logger[_0x4ae3('0x12')](_0x4ae3('0xd'),_0xaee597,_0x1a3932[_0x4ae3('0x12')]['message']);return _0x135848(_0x1a3932['error'][_0x4ae3('0x14')]);}else{logger[_0x4ae3('0xc')](_0x4ae3('0xd'),_0xaee597,_0x4ae3('0x10'));_0x135848(_0x1a3932[_0x4ae3('0x15')][_0x4ae3('0x14')]);}})['catch'](function(_0xf65499){logger[_0x4ae3('0x12')](_0x4ae3('0xd'),_0xaee597,_0xf65499);_0x55fad6(_0xf65499);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 89e25be..3b96ad0 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x361a0d,_0x161c0f){var _0x2bdbb8=function(_0x1a8419){while(--_0x1a8419){_0x361a0d['push'](_0x361a0d['shift']());}};_0x2bdbb8(++_0x161c0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x29776c,_0x4837fb){var _0xffa3ef=function(_0x36f962){while(--_0x36f962){_0x29776c['push'](_0x29776c['shift']());}};_0xffa3ef(++_0x4837fb);}(_0xe706,0xa3));var _0x6e70=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0xe706[_0x3d0016];return _0x1dcb28;};'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 a558bf2..0163587 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 _0x699c=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x699c,0xdd));var _0xc699=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x699c[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xc699('0x0'));module[_0xc699('0x1')]={'name':{'type':Sequelize[_0xc699('0x2')],'allowNull':![],'unique':_0xc699('0x3')},'version':{'type':Sequelize[_0xc699('0x2')],'allowNull':![],'unique':_0xc699('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xc699('0x4')},'filename':{'type':Sequelize[_0xc699('0x2')]},'path':{'type':Sequelize[_0xc699('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xc699('0x5')]},'active':{'type':Sequelize[_0xc699('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xc699('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc699('0x2')],'unique':_0xc699('0x7')},'description':{'type':Sequelize[_0xc699('0x2')]},'title':{'type':Sequelize[_0xc699('0x2')]},'remoteUri':{'type':Sequelize[_0xc699('0x2')]},'link':{'type':Sequelize[_0xc699('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x06a0=['BOOLEAN','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x06a0,0x1e1));var _0x006a=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x06a0[_0x2cc8bb];return _0x140e40;};'use strict';var Sequelize=require(_0x006a('0x0'));module['exports']={'name':{'type':Sequelize[_0x006a('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x006a('0x2')},'main':{'type':Sequelize[_0x006a('0x1')],'defaultValue':_0x006a('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x006a('0x1')]},'size':{'type':Sequelize[_0x006a('0x4')]},'active':{'type':Sequelize[_0x006a('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x006a('0x1')]},'logo':{'type':Sequelize[_0x006a('0x1')]},'state':{'type':Sequelize[_0x006a('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x006a('0x1')]},'remoteUri':{'type':Sequelize[_0x006a('0x1')]},'link':{'type':Sequelize[_0x006a('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 01af4f3..85309a3 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 _0x57ca=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Integration','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0x5521a7,_0x1b320d){var _0x38a39c=function(_0x436b1a){while(--_0x436b1a){_0x5521a7['push'](_0x5521a7['shift']());}};_0x38a39c(++_0x1b320d);}(_0x57ca,0x108));var _0xa57c=function(_0xd9fb1d,_0x122874){_0xd9fb1d=_0xd9fb1d-0x0;var _0x26ef43=_0x57ca[_0xd9fb1d];return _0x26ef43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['Integration']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['Integration'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));}; \ No newline at end of file +var _0xfdbd=['findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x1cfada,_0x23456e){var _0x4a2870=function(_0x59533a){while(--_0x59533a){_0x1cfada['push'](_0x1cfada['shift']());}};_0x4a2870(++_0x23456e);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2ef251,_0x3687e5){_0x2ef251=_0x2ef251-0x0;var _0x5c931b=_0xfdbd[_0x2ef251];return _0x5c931b;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['Integration'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['Integration']['create'](_0x1c08fb[_0xdfdb('0x4b')],{})[_0xdfdb('0x26')](respondWithResult(_0x273477,0xc9))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports['update']=function(_0x36149e,_0x4d4c90){if(_0x36149e[_0xdfdb('0x4b')]['id']){delete _0x36149e[_0xdfdb('0x4b')]['id'];}return db['Integration'][_0xdfdb('0x48')]({'where':{'id':_0x36149e[_0xdfdb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d4c90,null))[_0xdfdb('0x26')](saveUpdates(_0x36149e[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x4d4c90,null))[_0xdfdb('0x49')](handleError(_0x4d4c90,null));};exports[_0xdfdb('0x25')]=function(_0x10b490,_0x17dfdb){return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'id':_0x10b490['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x17dfdb,null))['then'](removeEntity(_0x17dfdb,null))[_0xdfdb('0x49')](handleError(_0x17dfdb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 84fdd77..d87e254 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 _0x3b50=['define','Integration','integrations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./integration.attributes','exports'];(function(_0x512661,_0x4b4012){var _0x1debde=function(_0x1ed401){while(--_0x1ed401){_0x512661['push'](_0x512661['shift']());}};_0x1debde(++_0x4b4012);}(_0x3b50,0x1e3));var _0x03b5=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x3b50[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0x03b5('0x0'));var util=require(_0x03b5('0x1'));var logger=require(_0x03b5('0x2'))('api');var moment=require(_0x03b5('0x3'));var BPromise=require('bluebird');var rp=require(_0x03b5('0x4'));var fs=require('fs');var path=require(_0x03b5('0x5'));var rimraf=require(_0x03b5('0x6'));var config=require('../../config/environment');var attributes=require(_0x03b5('0x7'));module[_0x03b5('0x8')]=function(_0x3d056f,_0xf26e32){return _0x3d056f[_0x03b5('0x9')](_0x03b5('0xa'),attributes,{'tableName':_0x03b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c1c=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Integration','integrations'];(function(_0x3f118f,_0x44db4b){var _0x4ca584=function(_0x370dbd){while(--_0x370dbd){_0x3f118f['push'](_0x3f118f['shift']());}};_0x4ca584(++_0x44db4b);}(_0x4c1c,0x1a4));var _0xc4c1=function(_0x17dbdd,_0x8a27d5){_0x17dbdd=_0x17dbdd-0x0;var _0x15ed0c=_0x4c1c[_0x17dbdd];return _0x15ed0c;};'use strict';var _=require(_0xc4c1('0x0'));var util=require(_0xc4c1('0x1'));var logger=require('../../config/logger')(_0xc4c1('0x2'));var moment=require(_0xc4c1('0x3'));var BPromise=require(_0xc4c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c1('0x5'));var rimraf=require(_0xc4c1('0x6'));var config=require(_0xc4c1('0x7'));var attributes=require('./integration.attributes');module[_0xc4c1('0x8')]=function(_0x12597a,_0x4ba2e3){return _0x12597a[_0xc4c1('0x9')](_0xc4c1('0xa'),attributes,{'tableName':_0xc4c1('0xb'),'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 eb4cea8..82ce27d 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x119d65,_0x2c4afa){var _0x1da5e4=function(_0x2d5b4e){while(--_0x2d5b4e){_0x119d65['push'](_0x119d65['shift']());}};_0x1da5e4(++_0x2c4afa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x22ac45,_0x13e41b){_0x22ac45=_0x22ac45-0x0;var _0x2fe065=_0x5f2f[_0x22ac45];return _0x2fe065;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1e8c55,_0x2a539f){var _0x57c717=function(_0x3e977f){while(--_0x3e977f){_0x1e8c55['push'](_0x1e8c55['shift']());}};_0x57c717(++_0x2a539f);}(_0x57ca,0x108));var _0xa57c=function(_0xb953a0,_0x8fccb8){_0xb953a0=_0xb953a0-0x0;var _0x285d4f=_0x57ca[_0xb953a0];return _0x285d4f;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a0addff..04ce456 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 _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x194975,_0x4aa525){var _0x28be7f=function(_0xecea65){while(--_0xecea65){_0x194975['push'](_0x194975['shift']());}};_0x28be7f(++_0x4aa525);}(_0x57ca,0x108));var _0xa57c=function(_0x16eafc,_0x3cad00){_0x16eafc=_0x16eafc-0x0;var _0x9f2ab9=_0x57ca[_0x16eafc];return _0x9f2ab9;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x1786d6,_0xb77965){var _0x13cc2c=function(_0x5bd14c){while(--_0x5bd14c){_0x1786d6['push'](_0x1786d6['shift']());}};_0x13cc2c(++_0xb77965);}(_0x524e,0x15e));var _0xe524=function(_0x22d3d5,_0x850e3a){_0x22d3d5=_0x22d3d5-0x0;var _0x4fdf99=_0x524e[_0x22d3d5];return _0x4fdf99;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0fc1c2e..ac36821 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 _0x9b0a=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','STRING'];(function(_0x44a8df,_0x2a8cd9){var _0x5db92e=function(_0x26f459){while(--_0x26f459){_0x44a8df['push'](_0x44a8df['shift']());}};_0x5db92e(++_0x2a8cd9);}(_0x9b0a,0x120));var _0xa9b0=function(_0x328305,_0x19098d){_0x328305=_0x328305-0x0;var _0xf0347=_0x9b0a[_0x328305];return _0xf0347;};'use strict';var Sequelize=require(_0xa9b0('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xa9b0('0x1')]},'exitStatus':{'type':Sequelize[_0xa9b0('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xa9b0('0x2')]},'contacts':{'type':Sequelize[_0xa9b0('0x1')]},'uniqueid':{'type':Sequelize[_0xa9b0('0x1')]},'calleridnum':{'type':Sequelize[_0xa9b0('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa9b0('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa9b0('0x3')]},'holdtime':{'type':Sequelize[_0xa9b0('0x2')]},'agentcomplete':{'type':Sequelize[_0xa9b0('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa9b0('0x3')]},'talktime':{'type':Sequelize[_0xa9b0('0x2')]},'agentacw':{'type':Sequelize[_0xa9b0('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa9b0('0x2')]},'reason':{'type':Sequelize[_0xa9b0('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa9b0('0x3')]},'agentdump':{'type':Sequelize[_0xa9b0('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa9b0('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa9b0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa9b0('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa9b0('0x1')]},'accountcode':{'type':Sequelize[_0xa9b0('0x1')]},'context':{'type':Sequelize[_0xa9b0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa9b0('0x1')]},'destchannel':{'type':Sequelize[_0xa9b0('0x1')]},'destchannelstate':{'type':Sequelize[_0xa9b0('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa9b0('0x1')]},'destcalleridname':{'type':Sequelize[_0xa9b0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xa9b0('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa9b0('0x1')]},'destcontext':{'type':Sequelize[_0xa9b0('0x1')]},'destexten':{'type':Sequelize[_0xa9b0('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa9b0('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xa9b0('0x1')]},'subject':{'type':Sequelize[_0xa9b0('0x1')]},'from':{'type':Sequelize[_0xa9b0('0x1')]},'to':{'type':Sequelize[_0xa9b0('0x1')]},'cc':{'type':Sequelize[_0xa9b0('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa9b0('0x5')]},'text':{'type':Sequelize[_0xa9b0('0x5')]},'status':{'type':Sequelize[_0xa9b0('0x6')](_0xa9b0('0x7'),_0xa9b0('0x8'),'RECEIVED',_0xa9b0('0x9'))},'url':{'type':Sequelize[_0xa9b0('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xa9b0('0x2')]}}; \ No newline at end of file +var _0x2264=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x2e9e42,_0x28cf81){var _0x270816=function(_0x2b441f){while(--_0x2b441f){_0x2e9e42['push'](_0x2e9e42['shift']());}};_0x270816(++_0x28cf81);}(_0x2264,0x103));var _0x4226=function(_0x3cb40e,_0x53eb07){_0x3cb40e=_0x3cb40e-0x0;var _0x3371e8=_0x2264[_0x3cb40e];return _0x3371e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4226('0x0')]},'exitStatus':{'type':Sequelize[_0x4226('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x4226('0x1')]},'contacts':{'type':Sequelize[_0x4226('0x0')]},'uniqueid':{'type':Sequelize[_0x4226('0x0')]},'calleridnum':{'type':Sequelize[_0x4226('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4226('0x0')]},'interface':{'type':Sequelize[_0x4226('0x0')]},'membername':{'type':Sequelize[_0x4226('0x0')]},'agentcalledAt':{'type':Sequelize[_0x4226('0x2')]},'agentconnectAt':{'type':Sequelize[_0x4226('0x2')]},'holdtime':{'type':Sequelize[_0x4226('0x1')]},'agentcomplete':{'type':Sequelize[_0x4226('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x4226('0x1')]},'agentacw':{'type':Sequelize[_0x4226('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4226('0x1')]},'reason':{'type':Sequelize[_0x4226('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x4226('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4226('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4226('0x2')]},'lastevent':{'type':Sequelize[_0x4226('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4226('0x1')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4226('0x0')]},'connectedlinename':{'type':Sequelize[_0x4226('0x0')]},'language':{'type':Sequelize[_0x4226('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4226('0x0')]},'exten':{'type':Sequelize[_0x4226('0x0')]},'priority':{'type':Sequelize[_0x4226('0x0')]},'destchannel':{'type':Sequelize[_0x4226('0x0')]},'destchannelstate':{'type':Sequelize[_0x4226('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x4226('0x0')]},'destcalleridnum':{'type':Sequelize[_0x4226('0x0')]},'destcalleridname':{'type':Sequelize[_0x4226('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x4226('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x4226('0x0')]},'destlanguage':{'type':Sequelize[_0x4226('0x0')]},'destaccountcode':{'type':Sequelize[_0x4226('0x0')]},'destcontext':{'type':Sequelize[_0x4226('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4226('0x0')]},'destuniqueid':{'type':Sequelize[_0x4226('0x0')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4226('0x0')]},'subject':{'type':Sequelize[_0x4226('0x0')]},'from':{'type':Sequelize[_0x4226('0x0')]},'to':{'type':Sequelize[_0x4226('0x0')]},'cc':{'type':Sequelize[_0x4226('0x0')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4226('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x4226('0x5')]('SENT',_0x4226('0x6'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x4226('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 98dcd4f..7dd0067 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 _0x0244=['set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x0244,0x122));var _0x4024=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x0244[_0x4f3b2d];return _0x3dddfa;};'use strict';var emlformat=require(_0x4024('0x0'));var rimraf=require(_0x4024('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4024('0x2'));var rp=require(_0x4024('0x3'));var moment=require(_0x4024('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4024('0x5'));var path=require('path');var sox=require(_0x4024('0x6'));var csv=require(_0x4024('0x7'));var ejs=require(_0x4024('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4024('0x9'));var squel=require(_0x4024('0xa'));var crypto=require(_0x4024('0xb'));var jsforce=require(_0x4024('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4024('0x7'));var querystring=require(_0x4024('0xd'));var Papa=require(_0x4024('0xe'));var Redis=require(_0x4024('0xf'));var authService=require(_0x4024('0x10'));var qs=require(_0x4024('0x11'));var as=require(_0x4024('0x12'));var hardwareService=require(_0x4024('0x13'));var logger=require(_0x4024('0x14'))(_0x4024('0x15'));var utils=require(_0x4024('0x16'));var config=require(_0x4024('0x17'));var licenseUtil=require(_0x4024('0x18'));var db=require(_0x4024('0x19'))['db'];function respondWithStatusCode(_0x5f5902,_0x5d548a){_0x5d548a=_0x5d548a||0xcc;return function(_0x20592d){if(_0x20592d){return _0x5f5902[_0x4024('0x1a')](_0x5d548a);}return _0x5f5902[_0x4024('0x1b')](_0x5d548a)[_0x4024('0x1c')]();};}function respondWithResult(_0x3af419,_0x1dffe0){_0x1dffe0=_0x1dffe0||0xc8;return function(_0x597698){if(_0x597698){return _0x3af419[_0x4024('0x1b')](_0x1dffe0)[_0x4024('0x1d')](_0x597698);}};}function respondWithFilteredResult(_0x216a32,_0x61dabf){return function(_0x16ebc1){if(_0x16ebc1){var _0x1784f6=typeof _0x61dabf['offset']===_0x4024('0x1e')&&typeof _0x61dabf[_0x4024('0x1f')]==='undefined';var _0x39d07c=_0x16ebc1[_0x4024('0x20')];var _0x550f07=_0x1784f6?0x0:_0x61dabf[_0x4024('0x21')];var _0x41950d=_0x1784f6?_0x16ebc1[_0x4024('0x20')]:_0x61dabf[_0x4024('0x21')]+_0x61dabf[_0x4024('0x1f')];var _0x354d42;if(_0x41950d>=_0x39d07c){_0x41950d=_0x39d07c;_0x354d42=0xc8;}else{_0x354d42=0xce;}_0x216a32[_0x4024('0x1b')](_0x354d42);return _0x216a32[_0x4024('0x22')](_0x4024('0x23'),_0x550f07+'-'+_0x41950d+'/'+_0x39d07c)[_0x4024('0x1d')](_0x16ebc1);}return null;};}function patchUpdates(_0x30c077){return function(_0x379d57){try{jsonpatch[_0x4024('0x24')](_0x379d57,_0x30c077,!![]);}catch(_0x132bc3){return BPromise[_0x4024('0x25')](_0x132bc3);}return _0x379d57[_0x4024('0x26')]();};}function saveUpdates(_0x2f7389,_0x51f97d){return function(_0x519cc8){if(_0x519cc8){return _0x519cc8[_0x4024('0x27')](_0x2f7389)[_0x4024('0x28')](function(_0x3c0ab6){return _0x3c0ab6;});}return null;};}function removeEntity(_0x546ca9,_0x1dd686){return function(_0x5dfe1e){if(_0x5dfe1e){return _0x5dfe1e['destroy']()[_0x4024('0x28')](function(){_0x546ca9[_0x4024('0x1b')](0xcc)[_0x4024('0x1c')]();});}};}function handleEntityNotFound(_0x3e665e,_0x18a1ef){return function(_0x3b95c4){if(!_0x3b95c4){_0x3e665e['sendStatus'](0x194);}return _0x3b95c4;};}function handleError(_0x5aed42,_0x5d264c){_0x5d264c=_0x5d264c||0x1f4;return function(_0x969d23){logger[_0x4024('0x29')](_0x969d23[_0x4024('0x2a')]);if(_0x969d23[_0x4024('0x2b')]){delete _0x969d23[_0x4024('0x2b')];}_0x5aed42[_0x4024('0x1b')](_0x5d264c)[_0x4024('0x2c')](_0x969d23);};}exports[_0x4024('0x2d')]=function(_0x1b5927,_0x69f291){var _0x176536={},_0x1ee659={},_0x272b9={'count':0x0,'rows':[]};var _0x35637c=_[_0x4024('0x2e')](db[_0x4024('0x2f')][_0x4024('0x30')],function(_0x56cfc5){return{'name':_0x56cfc5[_0x4024('0x31')],'type':_0x56cfc5[_0x4024('0x32')]['key']};});_0x1ee659[_0x4024('0x33')]=_[_0x4024('0x2e')](_0x35637c,_0x4024('0x2b'));_0x1ee659[_0x4024('0x34')]=_[_0x4024('0x35')](_0x1b5927[_0x4024('0x34')]);_0x1ee659[_0x4024('0x36')]=_[_0x4024('0x37')](_0x1ee659[_0x4024('0x33')],_0x1ee659[_0x4024('0x34')]);_0x176536['attributes']=_[_0x4024('0x37')](_0x1ee659[_0x4024('0x33')],qs['fields'](_0x1b5927[_0x4024('0x34')][_0x4024('0x38')]));_0x176536[_0x4024('0x39')]=_0x176536['attributes']['length']?_0x176536[_0x4024('0x39')]:_0x1ee659[_0x4024('0x33')];if(!_0x1b5927[_0x4024('0x34')][_0x4024('0x3a')](_0x4024('0x3b'))){_0x176536[_0x4024('0x1f')]=qs[_0x4024('0x1f')](_0x1b5927[_0x4024('0x34')][_0x4024('0x1f')]);_0x176536[_0x4024('0x21')]=qs['offset'](_0x1b5927['query'][_0x4024('0x21')]);}_0x176536[_0x4024('0x3c')]=qs['sort'](_0x1b5927[_0x4024('0x34')][_0x4024('0x3d')]);_0x176536[_0x4024('0x3e')]=qs[_0x4024('0x36')](_[_0x4024('0x3f')](_0x1b5927['query'],_0x1ee659[_0x4024('0x36')]),_0x35637c);if(_0x1b5927[_0x4024('0x34')][_0x4024('0x40')]){_0x176536['where']=_['merge'](_0x176536[_0x4024('0x3e')],{'$or':_['map'](_0x35637c,function(_0x3f1bb2){if(_0x3f1bb2[_0x4024('0x32')]!==_0x4024('0x41')){var _0x193c17={};_0x193c17[_0x3f1bb2[_0x4024('0x2b')]]={'$like':'%'+_0x1b5927['query'][_0x4024('0x40')]+'%'};return _0x193c17;}})});}_0x176536=_[_0x4024('0x42')]({},_0x176536,_0x1b5927[_0x4024('0x43')]);var _0x5d090a={'where':_0x176536['where']};return db[_0x4024('0x2f')][_0x4024('0x20')](_0x5d090a)[_0x4024('0x28')](function(_0x177f17){_0x272b9[_0x4024('0x20')]=_0x177f17;if(_0x1b5927['query'][_0x4024('0x44')]){_0x176536[_0x4024('0x45')]=[{'all':!![]}];}return db[_0x4024('0x2f')][_0x4024('0x46')](_0x176536);})['then'](function(_0x1b8a61){_0x272b9[_0x4024('0x47')]=_0x1b8a61;return _0x272b9;})[_0x4024('0x28')](respondWithFilteredResult(_0x69f291,_0x176536))['catch'](handleError(_0x69f291,null));};exports[_0x4024('0x48')]=function(_0x5a78ae,_0x23e77d){var _0x5652b4={'raw':![],'where':{'id':_0x5a78ae['params']['id']}},_0x28cdce={};_0x28cdce[_0x4024('0x33')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x28cdce[_0x4024('0x34')]=_[_0x4024('0x35')](_0x5a78ae[_0x4024('0x34')]);_0x28cdce[_0x4024('0x36')]=_[_0x4024('0x37')](_0x28cdce[_0x4024('0x33')],_0x28cdce[_0x4024('0x34')]);_0x5652b4[_0x4024('0x39')]=_['intersection'](_0x28cdce['model'],qs[_0x4024('0x38')](_0x5a78ae['query'][_0x4024('0x38')]));_0x5652b4[_0x4024('0x39')]=_0x5652b4[_0x4024('0x39')][_0x4024('0x49')]?_0x5652b4['attributes']:_0x28cdce[_0x4024('0x33')];if(_0x5a78ae[_0x4024('0x34')][_0x4024('0x44')]){_0x5652b4[_0x4024('0x45')]=[{'all':!![]}];}_0x5652b4=_[_0x4024('0x42')]({},_0x5652b4,_0x5a78ae[_0x4024('0x43')]);return db['IntegrationReport'][_0x4024('0x4a')](_0x5652b4)[_0x4024('0x28')](handleEntityNotFound(_0x23e77d,null))[_0x4024('0x28')](respondWithResult(_0x23e77d,null))[_0x4024('0x4b')](handleError(_0x23e77d,null));};exports[_0x4024('0x4c')]=function(_0x3b7db4,_0xfdd393){return db[_0x4024('0x2f')]['create'](_0x3b7db4[_0x4024('0x4d')],{})['then'](respondWithResult(_0xfdd393,0xc9))[_0x4024('0x4b')](handleError(_0xfdd393,null));};exports[_0x4024('0x27')]=function(_0x1d5f59,_0xcf60a){if(_0x1d5f59[_0x4024('0x4d')]['id']){delete _0x1d5f59[_0x4024('0x4d')]['id'];}return db[_0x4024('0x2f')][_0x4024('0x4a')]({'where':{'id':_0x1d5f59[_0x4024('0x4e')]['id']}})[_0x4024('0x28')](handleEntityNotFound(_0xcf60a,null))[_0x4024('0x28')](saveUpdates(_0x1d5f59[_0x4024('0x4d')],null))[_0x4024('0x28')](respondWithResult(_0xcf60a,null))[_0x4024('0x4b')](handleError(_0xcf60a,null));};exports[_0x4024('0x4f')]=function(_0x2b39d2,_0x429a78){return db['IntegrationReport'][_0x4024('0x4a')]({'where':{'id':_0x2b39d2[_0x4024('0x4e')]['id']}})['then'](handleEntityNotFound(_0x429a78,null))[_0x4024('0x28')](removeEntity(_0x429a78,null))[_0x4024('0x4b')](handleError(_0x429a78,null));};exports['describe']=function(_0x39ee98,_0x2d3b38){return db[_0x4024('0x2f')][_0x4024('0x50')]()[_0x4024('0x28')](respondWithResult(_0x2d3b38,null))[_0x4024('0x4b')](handleError(_0x2d3b38,null));}; \ No newline at end of file +var _0xe7c1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x2879af,_0xde22c8){var _0x3fe016=function(_0x587ef4){while(--_0x587ef4){_0x2879af['push'](_0x2879af['shift']());}};_0x3fe016(++_0xde22c8);}(_0xe7c1,0x1cf));var _0x1e7c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe7c1[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x1e7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e7c('0x1'));var jsonpatch=require(_0x1e7c('0x2'));var rp=require(_0x1e7c('0x3'));var moment=require(_0x1e7c('0x4'));var BPromise=require(_0x1e7c('0x5'));var Mustache=require(_0x1e7c('0x6'));var util=require(_0x1e7c('0x7'));var path=require(_0x1e7c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e7c('0x9'));var fs=require('fs');var fs_extra=require(_0x1e7c('0xa'));var _=require('lodash');var squel=require(_0x1e7c('0xb'));var crypto=require(_0x1e7c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e7c('0xd'));var querystring=require(_0x1e7c('0xe'));var Papa=require(_0x1e7c('0xf'));var Redis=require('ioredis');var authService=require(_0x1e7c('0x10'));var qs=require(_0x1e7c('0x11'));var as=require(_0x1e7c('0x12'));var hardwareService=require(_0x1e7c('0x13'));var logger=require(_0x1e7c('0x14'))(_0x1e7c('0x15'));var utils=require(_0x1e7c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1e7c('0x17'));var db=require(_0x1e7c('0x18'))['db'];function respondWithStatusCode(_0x2c2b9a,_0xfcca82){_0xfcca82=_0xfcca82||0xcc;return function(_0x1b7b8c){if(_0x1b7b8c){return _0x2c2b9a[_0x1e7c('0x19')](_0xfcca82);}return _0x2c2b9a['status'](_0xfcca82)[_0x1e7c('0x1a')]();};}function respondWithResult(_0x21cc3c,_0x4ab3e8){_0x4ab3e8=_0x4ab3e8||0xc8;return function(_0x1998d7){if(_0x1998d7){return _0x21cc3c['status'](_0x4ab3e8)['json'](_0x1998d7);}};}function respondWithFilteredResult(_0xa95a94,_0x5aa2a5){return function(_0x14d591){if(_0x14d591){var _0x692e6c=typeof _0x5aa2a5[_0x1e7c('0x1b')]===_0x1e7c('0x1c')&&typeof _0x5aa2a5[_0x1e7c('0x1d')]===_0x1e7c('0x1c');var _0x44c4e9=_0x14d591[_0x1e7c('0x1e')];var _0x8fb7e4=_0x692e6c?0x0:_0x5aa2a5[_0x1e7c('0x1b')];var _0x1ce082=_0x692e6c?_0x14d591[_0x1e7c('0x1e')]:_0x5aa2a5['offset']+_0x5aa2a5[_0x1e7c('0x1d')];var _0x2a2e8d;if(_0x1ce082>=_0x44c4e9){_0x1ce082=_0x44c4e9;_0x2a2e8d=0xc8;}else{_0x2a2e8d=0xce;}_0xa95a94[_0x1e7c('0x1f')](_0x2a2e8d);return _0xa95a94[_0x1e7c('0x20')](_0x1e7c('0x21'),_0x8fb7e4+'-'+_0x1ce082+'/'+_0x44c4e9)[_0x1e7c('0x22')](_0x14d591);}return null;};}function patchUpdates(_0x256464){return function(_0x566d8e){try{jsonpatch[_0x1e7c('0x23')](_0x566d8e,_0x256464,!![]);}catch(_0x106454){return BPromise[_0x1e7c('0x24')](_0x106454);}return _0x566d8e[_0x1e7c('0x25')]();};}function saveUpdates(_0x5868a8,_0xda9e1a){return function(_0x2edec5){if(_0x2edec5){return _0x2edec5[_0x1e7c('0x26')](_0x5868a8)[_0x1e7c('0x27')](function(_0x211777){return _0x211777;});}return null;};}function removeEntity(_0x23da1a,_0x277ee4){return function(_0x4ed338){if(_0x4ed338){return _0x4ed338[_0x1e7c('0x28')]()[_0x1e7c('0x27')](function(){_0x23da1a[_0x1e7c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef789,_0x4b2cf5){return function(_0x1e4eb2){if(!_0x1e4eb2){_0x2ef789[_0x1e7c('0x19')](0x194);}return _0x1e4eb2;};}function handleError(_0x228d0b,_0x54a001){_0x54a001=_0x54a001||0x1f4;return function(_0x596a9d){logger[_0x1e7c('0x29')](_0x596a9d[_0x1e7c('0x2a')]);if(_0x596a9d[_0x1e7c('0x2b')]){delete _0x596a9d[_0x1e7c('0x2b')];}_0x228d0b[_0x1e7c('0x1f')](_0x54a001)[_0x1e7c('0x2c')](_0x596a9d);};}exports[_0x1e7c('0x2d')]=function(_0x5b9c08,_0x312e07){var _0x388816={},_0x371521={},_0x267991={'count':0x0,'rows':[]};var _0x78b414=_['map'](db[_0x1e7c('0x2e')][_0x1e7c('0x2f')],function(_0x27054c){return{'name':_0x27054c[_0x1e7c('0x30')],'type':_0x27054c[_0x1e7c('0x31')][_0x1e7c('0x32')]};});_0x371521[_0x1e7c('0x33')]=_[_0x1e7c('0x34')](_0x78b414,_0x1e7c('0x2b'));_0x371521[_0x1e7c('0x35')]=_['keys'](_0x5b9c08['query']);_0x371521[_0x1e7c('0x36')]=_[_0x1e7c('0x37')](_0x371521['model'],_0x371521[_0x1e7c('0x35')]);_0x388816[_0x1e7c('0x38')]=_[_0x1e7c('0x37')](_0x371521[_0x1e7c('0x33')],qs[_0x1e7c('0x39')](_0x5b9c08[_0x1e7c('0x35')]['fields']));_0x388816[_0x1e7c('0x38')]=_0x388816[_0x1e7c('0x38')][_0x1e7c('0x3a')]?_0x388816['attributes']:_0x371521[_0x1e7c('0x33')];if(!_0x5b9c08[_0x1e7c('0x35')][_0x1e7c('0x3b')](_0x1e7c('0x3c'))){_0x388816[_0x1e7c('0x1d')]=qs[_0x1e7c('0x1d')](_0x5b9c08[_0x1e7c('0x35')]['limit']);_0x388816[_0x1e7c('0x1b')]=qs[_0x1e7c('0x1b')](_0x5b9c08[_0x1e7c('0x35')][_0x1e7c('0x1b')]);}_0x388816[_0x1e7c('0x3d')]=qs[_0x1e7c('0x3e')](_0x5b9c08[_0x1e7c('0x35')][_0x1e7c('0x3e')]);_0x388816[_0x1e7c('0x3f')]=qs[_0x1e7c('0x36')](_[_0x1e7c('0x40')](_0x5b9c08['query'],_0x371521[_0x1e7c('0x36')]),_0x78b414);if(_0x5b9c08[_0x1e7c('0x35')][_0x1e7c('0x41')]){_0x388816[_0x1e7c('0x3f')]=_['merge'](_0x388816['where'],{'$or':_['map'](_0x78b414,function(_0x58bb1a){if(_0x58bb1a[_0x1e7c('0x31')]!=='VIRTUAL'){var _0x1e45e4={};_0x1e45e4[_0x58bb1a[_0x1e7c('0x2b')]]={'$like':'%'+_0x5b9c08[_0x1e7c('0x35')][_0x1e7c('0x41')]+'%'};return _0x1e45e4;}})});}_0x388816=_[_0x1e7c('0x42')]({},_0x388816,_0x5b9c08[_0x1e7c('0x43')]);var _0x594d49={'where':_0x388816['where']};return db[_0x1e7c('0x2e')][_0x1e7c('0x1e')](_0x594d49)[_0x1e7c('0x27')](function(_0x52e264){_0x267991[_0x1e7c('0x1e')]=_0x52e264;if(_0x5b9c08['query'][_0x1e7c('0x44')]){_0x388816[_0x1e7c('0x45')]=[{'all':!![]}];}return db[_0x1e7c('0x2e')][_0x1e7c('0x46')](_0x388816);})[_0x1e7c('0x27')](function(_0x4bb588){_0x267991[_0x1e7c('0x47')]=_0x4bb588;return _0x267991;})['then'](respondWithFilteredResult(_0x312e07,_0x388816))[_0x1e7c('0x48')](handleError(_0x312e07,null));};exports[_0x1e7c('0x49')]=function(_0x1b6785,_0x29bb59){var _0x4461e0={'raw':![],'where':{'id':_0x1b6785[_0x1e7c('0x4a')]['id']}},_0x3adb3b={};_0x3adb3b[_0x1e7c('0x33')]=_[_0x1e7c('0x4b')](db[_0x1e7c('0x2e')][_0x1e7c('0x2f')]);_0x3adb3b['query']=_[_0x1e7c('0x4b')](_0x1b6785[_0x1e7c('0x35')]);_0x3adb3b[_0x1e7c('0x36')]=_[_0x1e7c('0x37')](_0x3adb3b[_0x1e7c('0x33')],_0x3adb3b['query']);_0x4461e0[_0x1e7c('0x38')]=_[_0x1e7c('0x37')](_0x3adb3b[_0x1e7c('0x33')],qs[_0x1e7c('0x39')](_0x1b6785[_0x1e7c('0x35')]['fields']));_0x4461e0[_0x1e7c('0x38')]=_0x4461e0[_0x1e7c('0x38')][_0x1e7c('0x3a')]?_0x4461e0[_0x1e7c('0x38')]:_0x3adb3b[_0x1e7c('0x33')];if(_0x1b6785[_0x1e7c('0x35')]['includeAll']){_0x4461e0[_0x1e7c('0x45')]=[{'all':!![]}];}_0x4461e0=_[_0x1e7c('0x42')]({},_0x4461e0,_0x1b6785[_0x1e7c('0x43')]);return db[_0x1e7c('0x2e')][_0x1e7c('0x4c')](_0x4461e0)[_0x1e7c('0x27')](handleEntityNotFound(_0x29bb59,null))['then'](respondWithResult(_0x29bb59,null))[_0x1e7c('0x48')](handleError(_0x29bb59,null));};exports['create']=function(_0xc6cc1d,_0x3495ee){return db[_0x1e7c('0x2e')][_0x1e7c('0x4d')](_0xc6cc1d[_0x1e7c('0x4e')],{})['then'](respondWithResult(_0x3495ee,0xc9))['catch'](handleError(_0x3495ee,null));};exports[_0x1e7c('0x26')]=function(_0x4e89f0,_0xed9f2e){if(_0x4e89f0['body']['id']){delete _0x4e89f0[_0x1e7c('0x4e')]['id'];}return db[_0x1e7c('0x2e')][_0x1e7c('0x4c')]({'where':{'id':_0x4e89f0[_0x1e7c('0x4a')]['id']}})[_0x1e7c('0x27')](handleEntityNotFound(_0xed9f2e,null))['then'](saveUpdates(_0x4e89f0[_0x1e7c('0x4e')],null))[_0x1e7c('0x27')](respondWithResult(_0xed9f2e,null))['catch'](handleError(_0xed9f2e,null));};exports[_0x1e7c('0x28')]=function(_0x374fbb,_0x4c045d){return db['IntegrationReport'][_0x1e7c('0x4c')]({'where':{'id':_0x374fbb['params']['id']}})[_0x1e7c('0x27')](handleEntityNotFound(_0x4c045d,null))[_0x1e7c('0x27')](removeEntity(_0x4c045d,null))[_0x1e7c('0x48')](handleError(_0x4c045d,null));};exports['describe']=function(_0x4aeb81,_0x539b59){return db['IntegrationReport'][_0x1e7c('0x4f')]()[_0x1e7c('0x27')](respondWithResult(_0x539b59,null))[_0x1e7c('0x48')](handleError(_0x539b59,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index e25f971..f480f3d 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 _0xcd46=['define','lodash','bluebird','../../config/environment','./integrationReport.attributes','exports'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xcd46,0x157));var _0x6cd4=function(_0x12dd05,_0x4332f4){_0x12dd05=_0x12dd05-0x0;var _0x3a11f6=_0xcd46[_0x12dd05];return _0x3a11f6;};'use strict';var _=require(_0x6cd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6cd4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6cd4('0x2'));var attributes=require(_0x6cd4('0x3'));module[_0x6cd4('0x4')]=function(_0x404a2c,_0x1cea44){return _0x404a2c[_0x6cd4('0x5')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcef8=['path','rimraf','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','request-promise'];(function(_0x44f3c8,_0x327245){var _0x33ddff=function(_0x5b87a7){while(--_0x5b87a7){_0x44f3c8['push'](_0x44f3c8['shift']());}};_0x33ddff(++_0x327245);}(_0xcef8,0x74));var _0x8cef=function(_0x3d13dc,_0xf59f6){_0x3d13dc=_0x3d13dc-0x0;var _0x353e76=_0xcef8[_0x3d13dc];return _0x353e76;};'use strict';var _=require(_0x8cef('0x0'));var util=require('util');var logger=require(_0x8cef('0x1'))(_0x8cef('0x2'));var moment=require(_0x8cef('0x3'));var BPromise=require('bluebird');var rp=require(_0x8cef('0x4'));var fs=require('fs');var path=require(_0x8cef('0x5'));var rimraf=require(_0x8cef('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x8cef('0x7')]=function(_0x380d97,_0x3e8fbd){return _0x380d97[_0x8cef('0x8')](_0x8cef('0x9'),attributes,{'tableName':_0x8cef('0xa'),'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 cd9807e..bcf3466 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x2c9858,_0x98dfa1){var _0xa0adf9=function(_0x5b5d85){while(--_0x5b5d85){_0x2c9858['push'](_0x2c9858['shift']());}};_0xa0adf9(++_0x98dfa1);}(_0xba34,0x119));var _0x4ba3=function(_0x41cfe4,_0x4ed6aa){_0x41cfe4=_0x41cfe4-0x0;var _0x455487=_0xba34[_0x41cfe4];return _0x455487;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x57f545,_0x13d2fc){var _0x41d8c8=function(_0xc53686){while(--_0xc53686){_0x57f545['push'](_0x57f545['shift']());}};_0x41d8c8(++_0x13d2fc);}(_0x1261,0x144));var _0x1126=function(_0x4cfb78,_0x4c1da6){_0x4cfb78=_0x4cfb78-0x0;var _0xc1250e=_0x1261[_0x4cfb78];return _0xc1250e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 59cefdb..dc31190 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 _0x234f=['get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','util','path','connect-timeout','express','../../config/environment','./interval.controller'];(function(_0x593f67,_0x432c9a){var _0x309e70=function(_0x4a0b00){while(--_0x4a0b00){_0x593f67['push'](_0x593f67['shift']());}};_0x309e70(++_0x432c9a);}(_0x234f,0xb6));var _0xf234=function(_0x52d611,_0x50e31a){_0x52d611=_0x52d611-0x0;var _0x358aed=_0x234f[_0x52d611];return _0x358aed;};'use strict';var multer=require(_0xf234('0x0'));var util=require(_0xf234('0x1'));var path=require(_0xf234('0x2'));var timeout=require(_0xf234('0x3'));var express=require(_0xf234('0x4'));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(_0xf234('0x5'));var controller=require(_0xf234('0x6'));router[_0xf234('0x7')]('/',auth[_0xf234('0x8')](),controller[_0xf234('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf234('0xa')]);router[_0xf234('0x7')](_0xf234('0xb'),auth[_0xf234('0x8')](),controller[_0xf234('0xc')]);router[_0xf234('0xd')]('/',auth[_0xf234('0x8')](),controller[_0xf234('0xe')]);router[_0xf234('0xd')](_0xf234('0xb'),auth[_0xf234('0x8')](),controller[_0xf234('0xf')]);router['post'](_0xf234('0x10'),auth[_0xf234('0x8')](),controller[_0xf234('0x11')]);router[_0xf234('0x12')]('/:id',auth[_0xf234('0x8')](),controller['update']);router[_0xf234('0x13')]('/:id',auth[_0xf234('0x8')](),controller[_0xf234('0x14')]);module['exports']=router; \ No newline at end of file +var _0x236e=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create'];(function(_0xaa7629,_0x219723){var _0x487c07=function(_0x36959c){while(--_0x36959c){_0xaa7629['push'](_0xaa7629['shift']());}};_0x487c07(++_0x219723);}(_0x236e,0x148));var _0xe236=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x236e[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0xe236('0x0'));var util=require(_0xe236('0x1'));var path=require(_0xe236('0x2'));var timeout=require(_0xe236('0x3'));var express=require('express');var router=express[_0xe236('0x4')]();var fs_extra=require(_0xe236('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe236('0x6'));var config=require(_0xe236('0x7'));var controller=require(_0xe236('0x8'));router[_0xe236('0x9')]('/',auth[_0xe236('0xa')](),controller[_0xe236('0xb')]);router[_0xe236('0x9')](_0xe236('0xc'),auth[_0xe236('0xa')](),controller['show']);router[_0xe236('0x9')](_0xe236('0xd'),auth['isAuthenticated'](),controller[_0xe236('0xe')]);router[_0xe236('0xf')]('/',auth[_0xe236('0xa')](),controller[_0xe236('0x10')]);router[_0xe236('0xf')]('/:id/sub_intervals',auth[_0xe236('0xa')](),controller[_0xe236('0x11')]);router[_0xe236('0xf')](_0xe236('0x12'),auth[_0xe236('0xa')](),controller[_0xe236('0x13')]);router[_0xe236('0x14')](_0xe236('0xc'),auth[_0xe236('0xa')](),controller[_0xe236('0x15')]);router['delete'](_0xe236('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe236('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index fe29bd0..31c8c52 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 _0x45f3=['STRING','sequelize','exports'];(function(_0x578bf7,_0x11139a){var _0x576f36=function(_0x173311){while(--_0x173311){_0x578bf7['push'](_0x578bf7['shift']());}};_0x576f36(++_0x11139a);}(_0x45f3,0x88));var _0x345f=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x45f3[_0xb1cf84];return _0x4bad2e;};'use strict';var Sequelize=require(_0x345f('0x0'));module[_0x345f('0x1')]={'name':{'type':Sequelize[_0x345f('0x2')]},'description':{'type':Sequelize[_0x345f('0x2')]},'interval':{'type':Sequelize[_0x345f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc794=['sequelize','exports','STRING'];(function(_0x5f2a50,_0x4700e0){var _0x7577ca=function(_0x45f47e){while(--_0x45f47e){_0x5f2a50['push'](_0x5f2a50['shift']());}};_0x7577ca(++_0x4700e0);}(_0xc794,0xb4));var _0x4c79=function(_0x4c9fe9,_0x4d0033){_0x4c9fe9=_0x4c9fe9-0x0;var _0x5038cf=_0xc794[_0x4c9fe9];return _0x5038cf;};'use strict';var Sequelize=require(_0x4c79('0x0'));module[_0x4c79('0x1')]={'name':{'type':Sequelize[_0x4c79('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4c79('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 4e53cba..5c844c0 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 _0x3fcc=['filter','options','includeAll','include','findAll','rows','params','intersection','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','rawAttributes','pick','addIntervals','sequelize','transaction','bulkCreate','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','destroy','then','Intervals','UserProfileResource','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x479b33,_0x49671f){var _0x45e817=function(_0x36dd56){while(--_0x36dd56){_0x479b33['push'](_0x479b33['shift']());}};_0x45e817(++_0x49671f);}(_0x3fcc,0x19c));var _0xc3fc=function(_0x41c3e2,_0x6cbd75){_0x41c3e2=_0x41c3e2-0x0;var _0x109c89=_0x3fcc[_0x41c3e2];return _0x109c89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3fc('0x0'));var zipdir=require(_0xc3fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3fc('0x2'));var moment=require(_0xc3fc('0x3'));var BPromise=require(_0xc3fc('0x4'));var Mustache=require(_0xc3fc('0x5'));var util=require(_0xc3fc('0x6'));var path=require(_0xc3fc('0x7'));var sox=require(_0xc3fc('0x8'));var csv=require(_0xc3fc('0x9'));var ejs=require(_0xc3fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3fc('0xb'));var squel=require('squel');var crypto=require(_0xc3fc('0xc'));var jsforce=require(_0xc3fc('0xd'));var deskjs=require(_0xc3fc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3fc('0xf'));var Redis=require(_0xc3fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc3fc('0x11'));var as=require(_0xc3fc('0x12'));var hardwareService=require(_0xc3fc('0x13'));var logger=require(_0xc3fc('0x14'))('api');var utils=require(_0xc3fc('0x15'));var config=require(_0xc3fc('0x16'));var licenseUtil=require(_0xc3fc('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0xc3fc('0x18'));function respondWithStatusCode(_0x5264bc,_0x28f495){_0x28f495=_0x28f495||0xcc;return function(_0x3d948f){if(_0x3d948f){return _0x5264bc[_0xc3fc('0x19')](_0x28f495);}return _0x5264bc['status'](_0x28f495)[_0xc3fc('0x1a')]();};}function respondWithResult(_0x4fcd7a,_0x2dbf14){_0x2dbf14=_0x2dbf14||0xc8;return function(_0x5bc4e3){if(_0x5bc4e3){return _0x4fcd7a['status'](_0x2dbf14)[_0xc3fc('0x1b')](_0x5bc4e3);}};}function respondWithFilteredResult(_0x21a0a1,_0x45c4ae){return function(_0x54d474){if(_0x54d474){var _0x2af1a4=typeof _0x45c4ae[_0xc3fc('0x1c')]==='undefined'&&typeof _0x45c4ae[_0xc3fc('0x1d')]===_0xc3fc('0x1e');var _0x4fded5=_0x54d474[_0xc3fc('0x1f')];var _0x21f2f7=_0x2af1a4?0x0:_0x45c4ae[_0xc3fc('0x1c')];var _0x342609=_0x2af1a4?_0x54d474[_0xc3fc('0x1f')]:_0x45c4ae[_0xc3fc('0x1c')]+_0x45c4ae[_0xc3fc('0x1d')];var _0x258802;if(_0x342609>=_0x4fded5){_0x342609=_0x4fded5;_0x258802=0xc8;}else{_0x258802=0xce;}_0x21a0a1[_0xc3fc('0x20')](_0x258802);return _0x21a0a1[_0xc3fc('0x21')](_0xc3fc('0x22'),_0x21f2f7+'-'+_0x342609+'/'+_0x4fded5)[_0xc3fc('0x1b')](_0x54d474);}return null;};}function patchUpdates(_0x252a8d){return function(_0x1e18d1){try{jsonpatch[_0xc3fc('0x23')](_0x1e18d1,_0x252a8d,!![]);}catch(_0x58f8c2){return BPromise[_0xc3fc('0x24')](_0x58f8c2);}return _0x1e18d1['save']();};}function saveUpdates(_0x2e228a,_0x49bdbe){return function(_0xf8b3ef){if(_0xf8b3ef){return _0xf8b3ef[_0xc3fc('0x25')](_0x2e228a)['then'](function(_0x4a6d74){return _0x4a6d74;});}return null;};}function removeEntity(_0x545e17,_0x523420){return function(_0x1d6504){if(_0x1d6504){return _0x1d6504[_0xc3fc('0x26')]()[_0xc3fc('0x27')](function(){var _0x356826=_0x1d6504['get']({'plain':!![]});var _0x5b0bd3=_0xc3fc('0x28');return db[_0xc3fc('0x29')][_0xc3fc('0x26')]({'where':{'type':_0x5b0bd3,'resourceId':_0x356826['id']}})[_0xc3fc('0x27')](function(){return _0x1d6504;});})[_0xc3fc('0x27')](function(){_0x545e17[_0xc3fc('0x20')](0xcc)[_0xc3fc('0x1a')]();});}};}function handleEntityNotFound(_0x33cbc7,_0x37fdff){return function(_0x2e983b){if(!_0x2e983b){_0x33cbc7[_0xc3fc('0x19')](0x194);}return _0x2e983b;};}function handleError(_0x45dc34,_0x5d9963){_0x5d9963=_0x5d9963||0x1f4;return function(_0xbe4b77){logger['error'](_0xbe4b77[_0xc3fc('0x2a')]);if(_0xbe4b77[_0xc3fc('0x2b')]){delete _0xbe4b77[_0xc3fc('0x2b')];}_0x45dc34['status'](_0x5d9963)[_0xc3fc('0x2c')](_0xbe4b77);};}exports[_0xc3fc('0x2d')]=function(_0x5f2851,_0x3864e8){var _0x15a84b={},_0x35ac72={},_0x5a8152={'count':0x0,'rows':[]};var _0x19f052=_[_0xc3fc('0x2e')](db[_0xc3fc('0x2f')]['rawAttributes'],function(_0x2d7224){return{'name':_0x2d7224[_0xc3fc('0x30')],'type':_0x2d7224[_0xc3fc('0x31')][_0xc3fc('0x32')]};});_0x35ac72[_0xc3fc('0x33')]=_[_0xc3fc('0x2e')](_0x19f052,_0xc3fc('0x2b'));_0x35ac72[_0xc3fc('0x34')]=_[_0xc3fc('0x35')](_0x5f2851['query']);_0x35ac72[_0xc3fc('0x36')]=_['intersection'](_0x35ac72['model'],_0x35ac72[_0xc3fc('0x34')]);_0x15a84b[_0xc3fc('0x37')]=_['intersection'](_0x35ac72[_0xc3fc('0x33')],qs[_0xc3fc('0x38')](_0x5f2851['query'][_0xc3fc('0x38')]));_0x15a84b['attributes']=_0x15a84b['attributes'][_0xc3fc('0x39')]?_0x15a84b[_0xc3fc('0x37')]:_0x35ac72[_0xc3fc('0x33')];if(!_0x5f2851[_0xc3fc('0x34')][_0xc3fc('0x3a')](_0xc3fc('0x3b'))){_0x15a84b[_0xc3fc('0x1d')]=qs['limit'](_0x5f2851[_0xc3fc('0x34')]['limit']);_0x15a84b[_0xc3fc('0x1c')]=qs['offset'](_0x5f2851[_0xc3fc('0x34')]['offset']);}_0x15a84b[_0xc3fc('0x3c')]=qs[_0xc3fc('0x3d')](_0x5f2851[_0xc3fc('0x34')]['sort']);_0x15a84b[_0xc3fc('0x3e')]=qs['filters'](_['pick'](_0x5f2851['query'],_0x35ac72[_0xc3fc('0x36')]),_0x19f052);if(_0x5f2851['query'][_0xc3fc('0x3f')]){_0x15a84b[_0xc3fc('0x3e')]=_['merge'](_0x15a84b[_0xc3fc('0x3e')],{'$or':_[_0xc3fc('0x2e')](_0x19f052,function(_0x3166cf){if(_0x3166cf[_0xc3fc('0x31')]!=='VIRTUAL'){var _0x28f81d={};_0x28f81d[_0x3166cf[_0xc3fc('0x2b')]]={'$like':'%'+_0x5f2851[_0xc3fc('0x34')]['filter']+'%'};return _0x28f81d;}})});}_0x15a84b=_['merge']({},_0x15a84b,_0x5f2851[_0xc3fc('0x40')]);var _0x1efbfc={'where':_0x15a84b[_0xc3fc('0x3e')]};return db[_0xc3fc('0x2f')][_0xc3fc('0x1f')](_0x1efbfc)[_0xc3fc('0x27')](function(_0x686d4b){_0x5a8152[_0xc3fc('0x1f')]=_0x686d4b;if(_0x5f2851['query'][_0xc3fc('0x41')]){_0x15a84b[_0xc3fc('0x42')]=[{'all':!![]}];}return db[_0xc3fc('0x2f')][_0xc3fc('0x43')](_0x15a84b);})[_0xc3fc('0x27')](function(_0xeb5ab9){_0x5a8152[_0xc3fc('0x44')]=_0xeb5ab9;return _0x5a8152;})[_0xc3fc('0x27')](respondWithFilteredResult(_0x3864e8,_0x15a84b))['catch'](handleError(_0x3864e8,null));};exports['show']=function(_0xc7544c,_0x470cda){var _0x5116a9={'raw':!![],'where':{'id':_0xc7544c[_0xc3fc('0x45')]['id']}},_0x313f2a={};_0x313f2a['model']=_[_0xc3fc('0x35')](db['Interval']['rawAttributes']);_0x313f2a[_0xc3fc('0x34')]=_[_0xc3fc('0x35')](_0xc7544c[_0xc3fc('0x34')]);_0x313f2a[_0xc3fc('0x36')]=_[_0xc3fc('0x46')](_0x313f2a[_0xc3fc('0x33')],_0x313f2a[_0xc3fc('0x34')]);_0x5116a9['attributes']=_[_0xc3fc('0x46')](_0x313f2a[_0xc3fc('0x33')],qs[_0xc3fc('0x38')](_0xc7544c[_0xc3fc('0x34')]['fields']));_0x5116a9[_0xc3fc('0x37')]=_0x5116a9[_0xc3fc('0x37')]['length']?_0x5116a9['attributes']:_0x313f2a[_0xc3fc('0x33')];if(_0xc7544c[_0xc3fc('0x34')][_0xc3fc('0x41')]){_0x5116a9[_0xc3fc('0x42')]=[{'all':!![]}];}_0x5116a9=_[_0xc3fc('0x47')]({},_0x5116a9,_0xc7544c[_0xc3fc('0x40')]);return db['Interval'][_0xc3fc('0x48')](_0x5116a9)[_0xc3fc('0x27')](handleEntityNotFound(_0x470cda,null))['then'](respondWithResult(_0x470cda,null))[_0xc3fc('0x49')](handleError(_0x470cda,null));};exports['create']=function(_0x5d99c0,_0x1e240b){return db[_0xc3fc('0x2f')][_0xc3fc('0x4a')](_0x5d99c0[_0xc3fc('0x4b')],{})['then'](function(_0xb847f9){var _0x205092=_0x5d99c0[_0xc3fc('0x4c')][_0xc3fc('0x4d')]({'plain':!![]});if(!_0x205092)throw new Error(_0xc3fc('0x4e'));if(_0x205092[_0xc3fc('0x4f')]==='user'){var _0x26a9f5=_0xb847f9[_0xc3fc('0x4d')]({'plain':!![]});var _0x3d056b=_0xc3fc('0x28');return db[_0xc3fc('0x50')][_0xc3fc('0x48')]({'where':{'name':_0x3d056b,'userProfileId':_0x205092[_0xc3fc('0x51')]},'raw':!![]})[_0xc3fc('0x27')](function(_0x1e5389){if(_0x1e5389&&_0x1e5389[_0xc3fc('0x52')]===0x0){return db['UserProfileResource'][_0xc3fc('0x4a')]({'name':_0x26a9f5[_0xc3fc('0x2b')],'resourceId':_0x26a9f5['id'],'type':_0x1e5389[_0xc3fc('0x2b')],'sectionId':_0x1e5389['id']},{})['then'](function(){return _0xb847f9;});}else{return _0xb847f9;}})[_0xc3fc('0x49')](function(_0x529bdb){logger[_0xc3fc('0x53')](_0xc3fc('0x54'),_0x529bdb);throw _0x529bdb;});}return _0xb847f9;})[_0xc3fc('0x27')](respondWithResult(_0x1e240b,0xc9))[_0xc3fc('0x49')](handleError(_0x1e240b,null));};exports[_0xc3fc('0x25')]=function(_0x27f035,_0x1ad795){if(_0x27f035[_0xc3fc('0x4b')]['id']){delete _0x27f035[_0xc3fc('0x4b')]['id'];}return db[_0xc3fc('0x2f')]['find']({'where':{'id':_0x27f035[_0xc3fc('0x45')]['id']}})[_0xc3fc('0x27')](handleEntityNotFound(_0x1ad795,null))[_0xc3fc('0x27')](saveUpdates(_0x27f035['body'],null))['then'](respondWithResult(_0x1ad795,null))[_0xc3fc('0x49')](handleError(_0x1ad795,null));};exports[_0xc3fc('0x26')]=function(_0x4139ca,_0x206905){return db[_0xc3fc('0x2f')][_0xc3fc('0x48')]({'where':{'id':_0x4139ca[_0xc3fc('0x45')]['id']}})[_0xc3fc('0x27')](handleEntityNotFound(_0x206905,null))[_0xc3fc('0x27')](removeEntity(_0x206905,null))[_0xc3fc('0x49')](handleError(_0x206905,null));};exports[_0xc3fc('0x55')]=function(_0x1657d5,_0x15bfc5,_0x3de028){if(_0x1657d5[_0xc3fc('0x4b')]['id']){delete _0x1657d5[_0xc3fc('0x4b')]['id'];}return db[_0xc3fc('0x2f')]['find']({'where':{'id':_0x1657d5[_0xc3fc('0x45')]['id']}})[_0xc3fc('0x27')](handleEntityNotFound(_0x15bfc5,null))[_0xc3fc('0x27')](function(_0x2f3a47){if(_0x2f3a47){_0x1657d5['body'][_0xc3fc('0x56')]=_0x2f3a47['id'];return db[_0xc3fc('0x2f')][_0xc3fc('0x4a')](_0x1657d5[_0xc3fc('0x4b')]);}})[_0xc3fc('0x27')](respondWithResult(_0x15bfc5,null))[_0xc3fc('0x49')](handleError(_0x15bfc5,null));};exports[_0xc3fc('0x57')]=function(_0x50f98f,_0x4859e4,_0x1097c5){var _0x5f193a={};var _0x47cedb={};var _0xf4d637;var _0x212544;return db[_0xc3fc('0x2f')][_0xc3fc('0x58')]({'where':{'id':_0x50f98f[_0xc3fc('0x45')]['id']}})[_0xc3fc('0x27')](handleEntityNotFound(_0x4859e4,null))[_0xc3fc('0x27')](function(_0x46b751){if(_0x46b751){_0xf4d637=_0x46b751;_0x47cedb[_0xc3fc('0x33')]=_[_0xc3fc('0x35')](db[_0xc3fc('0x2f')][_0xc3fc('0x59')]);_0x47cedb['query']=_['keys'](_0x50f98f['query']);_0x47cedb['filters']=_[_0xc3fc('0x46')](_0x47cedb[_0xc3fc('0x33')],_0x47cedb[_0xc3fc('0x34')]);_0x5f193a['attributes']=_[_0xc3fc('0x46')](_0x47cedb['model'],qs[_0xc3fc('0x38')](_0x50f98f['query'][_0xc3fc('0x38')]));_0x5f193a[_0xc3fc('0x37')]=_0x5f193a[_0xc3fc('0x37')]['length']?_0x5f193a[_0xc3fc('0x37')]:_0x47cedb['model'];_0x5f193a[_0xc3fc('0x3c')]=qs[_0xc3fc('0x3d')](_0x50f98f[_0xc3fc('0x34')][_0xc3fc('0x3d')]);_0x5f193a[_0xc3fc('0x3e')]=qs['filters'](_[_0xc3fc('0x5a')](_0x50f98f[_0xc3fc('0x34')],_0x47cedb[_0xc3fc('0x36')]));if(_0x50f98f[_0xc3fc('0x34')]['filter']){_0x5f193a['where']=_[_0xc3fc('0x47')](_0x5f193a[_0xc3fc('0x3e')],{'$or':_['map'](_0x5f193a['attributes'],function(_0x2fd02c){var _0x240130={};_0x240130[_0x2fd02c]={'$like':'%'+_0x50f98f[_0xc3fc('0x34')][_0xc3fc('0x3f')]+'%'};return _0x240130;})});}_0x5f193a=_[_0xc3fc('0x47')]({},_0x5f193a,_0x50f98f['options']);return _0xf4d637[_0xc3fc('0x57')](_0x5f193a);}})[_0xc3fc('0x27')](function(_0x40a932){if(_0x40a932){_0x212544=_0x40a932[_0xc3fc('0x39')];if(!_0x50f98f[_0xc3fc('0x34')][_0xc3fc('0x3a')]('nolimit')){_0x5f193a[_0xc3fc('0x1d')]=qs[_0xc3fc('0x1d')](_0x50f98f['query'][_0xc3fc('0x1d')]);_0x5f193a[_0xc3fc('0x1c')]=qs[_0xc3fc('0x1c')](_0x50f98f['query']['offset']);}return _0xf4d637['getIntervals'](_0x5f193a);}})[_0xc3fc('0x27')](function(_0x21af75){if(_0x21af75){return _0x21af75?{'count':_0x212544,'rows':_0x21af75}:null;}})['then'](respondWithResult(_0x4859e4,null))[_0xc3fc('0x49')](handleError(_0x4859e4,null));};exports[_0xc3fc('0x5b')]=function(_0x35529e,_0x4fb2eb,_0xef151){return db[_0xc3fc('0x2f')][_0xc3fc('0x58')]({'where':{'id':_0x35529e[_0xc3fc('0x45')]['id']}})[_0xc3fc('0x27')](handleEntityNotFound(_0x4fb2eb,null))['then'](function(_0x1b976c){if(_0x1b976c){return db[_0xc3fc('0x5c')][_0xc3fc('0x5d')](function(_0x4375a6){return db[_0xc3fc('0x2f')][_0xc3fc('0x26')]({'where':{'IntervalId':_0x35529e['params']['id']},'transaction':_0x4375a6})[_0xc3fc('0x27')](function(_0x4ed092){var _0x37e0de=_[_0xc3fc('0x2e')](_0x35529e[_0xc3fc('0x4b')],function(_0x35ec50){delete _0x35ec50['id'];_0x35ec50[_0xc3fc('0x56')]=_0x35529e[_0xc3fc('0x45')]['id'];return _0x35ec50;});return db[_0xc3fc('0x2f')][_0xc3fc('0x5e')](_0x37e0de,{'transaction':_0x4375a6});});})[_0xc3fc('0x27')](function(){return db[_0xc3fc('0x2f')]['findAll']({'where':{'IntervalId':_0x35529e[_0xc3fc('0x45')]['id']}});});}})[_0xc3fc('0x27')](respondWithResult(_0x4fb2eb,null))[_0xc3fc('0x49')](handleError(_0x4fb2eb,null));}; \ No newline at end of file +var _0x67da=['key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Interval','findAll','show','params','keys','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','destroy','stack','name','map','fieldName','type'];(function(_0x13b672,_0xd85410){var _0x4ee046=function(_0x402f96){while(--_0x402f96){_0x13b672['push'](_0x13b672['shift']());}};_0x4ee046(++_0xd85410);}(_0x67da,0x12f));var _0xa67d=function(_0xa5fd3c,_0x44ce96){_0xa5fd3c=_0xa5fd3c-0x0;var _0x545edc=_0x67da[_0xa5fd3c];return _0x545edc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa67d('0x0'));var rp=require(_0xa67d('0x1'));var moment=require(_0xa67d('0x2'));var BPromise=require(_0xa67d('0x3'));var Mustache=require(_0xa67d('0x4'));var util=require('util');var path=require(_0xa67d('0x5'));var sox=require('sox');var csv=require(_0xa67d('0x6'));var ejs=require(_0xa67d('0x7'));var fs=require('fs');var fs_extra=require(_0xa67d('0x8'));var _=require(_0xa67d('0x9'));var squel=require('squel');var crypto=require(_0xa67d('0xa'));var jsforce=require(_0xa67d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa67d('0xc'));var Papa=require('papaparse');var Redis=require(_0xa67d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa67d('0xe'));var as=require(_0xa67d('0xf'));var hardwareService=require(_0xa67d('0x10'));var logger=require(_0xa67d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xa67d('0x12'));var licenseUtil=require(_0xa67d('0x13'));var db=require(_0xa67d('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xe8c28c,_0x1bfaeb){_0x1bfaeb=_0x1bfaeb||0xcc;return function(_0x286a31){if(_0x286a31){return _0xe8c28c[_0xa67d('0x15')](_0x1bfaeb);}return _0xe8c28c['status'](_0x1bfaeb)[_0xa67d('0x16')]();};}function respondWithResult(_0xd483e4,_0x5f010d){_0x5f010d=_0x5f010d||0xc8;return function(_0x583c91){if(_0x583c91){return _0xd483e4[_0xa67d('0x17')](_0x5f010d)['json'](_0x583c91);}};}function respondWithFilteredResult(_0x19262f,_0x24ebec){return function(_0x35e99b){if(_0x35e99b){var _0x204cbd=typeof _0x24ebec['offset']==='undefined'&&typeof _0x24ebec[_0xa67d('0x18')]===_0xa67d('0x19');var _0x3cf2e7=_0x35e99b[_0xa67d('0x1a')];var _0x45c9d9=_0x204cbd?0x0:_0x24ebec[_0xa67d('0x1b')];var _0x291cf5=_0x204cbd?_0x35e99b[_0xa67d('0x1a')]:_0x24ebec[_0xa67d('0x1b')]+_0x24ebec[_0xa67d('0x18')];var _0x17ba17;if(_0x291cf5>=_0x3cf2e7){_0x291cf5=_0x3cf2e7;_0x17ba17=0xc8;}else{_0x17ba17=0xce;}_0x19262f[_0xa67d('0x17')](_0x17ba17);return _0x19262f['set'](_0xa67d('0x1c'),_0x45c9d9+'-'+_0x291cf5+'/'+_0x3cf2e7)['json'](_0x35e99b);}return null;};}function patchUpdates(_0x5e3b42){return function(_0x46fd51){try{jsonpatch[_0xa67d('0x1d')](_0x46fd51,_0x5e3b42,!![]);}catch(_0x39e10e){return BPromise[_0xa67d('0x1e')](_0x39e10e);}return _0x46fd51[_0xa67d('0x1f')]();};}function saveUpdates(_0x217caf,_0x4acfa7){return function(_0x4a8e8e){if(_0x4a8e8e){return _0x4a8e8e[_0xa67d('0x20')](_0x217caf)[_0xa67d('0x21')](function(_0x10e74d){return _0x10e74d;});}return null;};}function removeEntity(_0x2ccce1,_0x3ee8e4){return function(_0x10f667){if(_0x10f667){return _0x10f667['destroy']()['then'](function(){var _0x132178=_0x10f667[_0xa67d('0x22')]({'plain':!![]});var _0x3a25ff='Intervals';return db['UserProfileResource'][_0xa67d('0x23')]({'where':{'type':_0x3a25ff,'resourceId':_0x132178['id']}})['then'](function(){return _0x10f667;});})[_0xa67d('0x21')](function(){_0x2ccce1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b990d,_0x17aa5a){return function(_0x366f39){if(!_0x366f39){_0x4b990d[_0xa67d('0x15')](0x194);}return _0x366f39;};}function handleError(_0x105061,_0x1fc26b){_0x1fc26b=_0x1fc26b||0x1f4;return function(_0x22fe85){logger['error'](_0x22fe85[_0xa67d('0x24')]);if(_0x22fe85[_0xa67d('0x25')]){delete _0x22fe85[_0xa67d('0x25')];}_0x105061[_0xa67d('0x17')](_0x1fc26b)['send'](_0x22fe85);};}exports['index']=function(_0x134ab,_0x3c6b65){var _0x476e35={},_0x1a4dde={},_0x3cb764={'count':0x0,'rows':[]};var _0x566e39=_[_0xa67d('0x26')](db['Interval']['rawAttributes'],function(_0xa65b8e){return{'name':_0xa65b8e[_0xa67d('0x27')],'type':_0xa65b8e[_0xa67d('0x28')][_0xa67d('0x29')]};});_0x1a4dde[_0xa67d('0x2a')]=_[_0xa67d('0x26')](_0x566e39,'name');_0x1a4dde[_0xa67d('0x2b')]=_['keys'](_0x134ab['query']);_0x1a4dde[_0xa67d('0x2c')]=_[_0xa67d('0x2d')](_0x1a4dde[_0xa67d('0x2a')],_0x1a4dde[_0xa67d('0x2b')]);_0x476e35[_0xa67d('0x2e')]=_[_0xa67d('0x2d')](_0x1a4dde[_0xa67d('0x2a')],qs[_0xa67d('0x2f')](_0x134ab[_0xa67d('0x2b')][_0xa67d('0x2f')]));_0x476e35['attributes']=_0x476e35[_0xa67d('0x2e')]['length']?_0x476e35[_0xa67d('0x2e')]:_0x1a4dde[_0xa67d('0x2a')];if(!_0x134ab['query']['hasOwnProperty'](_0xa67d('0x30'))){_0x476e35['limit']=qs[_0xa67d('0x18')](_0x134ab[_0xa67d('0x2b')][_0xa67d('0x18')]);_0x476e35[_0xa67d('0x1b')]=qs[_0xa67d('0x1b')](_0x134ab['query']['offset']);}_0x476e35[_0xa67d('0x31')]=qs[_0xa67d('0x32')](_0x134ab[_0xa67d('0x2b')]['sort']);_0x476e35[_0xa67d('0x33')]=qs[_0xa67d('0x2c')](_[_0xa67d('0x34')](_0x134ab[_0xa67d('0x2b')],_0x1a4dde['filters']),_0x566e39);if(_0x134ab['query'][_0xa67d('0x35')]){_0x476e35[_0xa67d('0x33')]=_['merge'](_0x476e35['where'],{'$or':_[_0xa67d('0x26')](_0x566e39,function(_0xa7ff9a){if(_0xa7ff9a[_0xa67d('0x28')]!==_0xa67d('0x36')){var _0x3d3622={};_0x3d3622[_0xa7ff9a[_0xa67d('0x25')]]={'$like':'%'+_0x134ab[_0xa67d('0x2b')][_0xa67d('0x35')]+'%'};return _0x3d3622;}})});}_0x476e35=_[_0xa67d('0x37')]({},_0x476e35,_0x134ab[_0xa67d('0x38')]);var _0x49c26c={'where':_0x476e35[_0xa67d('0x33')]};return db['Interval'][_0xa67d('0x1a')](_0x49c26c)[_0xa67d('0x21')](function(_0x401df3){_0x3cb764[_0xa67d('0x1a')]=_0x401df3;if(_0x134ab[_0xa67d('0x2b')][_0xa67d('0x39')]){_0x476e35[_0xa67d('0x3a')]=[{'all':!![]}];}return db[_0xa67d('0x3b')][_0xa67d('0x3c')](_0x476e35);})[_0xa67d('0x21')](function(_0x4e8de3){_0x3cb764['rows']=_0x4e8de3;return _0x3cb764;})['then'](respondWithFilteredResult(_0x3c6b65,_0x476e35))['catch'](handleError(_0x3c6b65,null));};exports[_0xa67d('0x3d')]=function(_0x16592c,_0x56e932){var _0xc99beb={'raw':!![],'where':{'id':_0x16592c[_0xa67d('0x3e')]['id']}},_0x3f05e6={};_0x3f05e6[_0xa67d('0x2a')]=_[_0xa67d('0x3f')](db[_0xa67d('0x3b')][_0xa67d('0x40')]);_0x3f05e6[_0xa67d('0x2b')]=_['keys'](_0x16592c[_0xa67d('0x2b')]);_0x3f05e6[_0xa67d('0x2c')]=_[_0xa67d('0x2d')](_0x3f05e6[_0xa67d('0x2a')],_0x3f05e6[_0xa67d('0x2b')]);_0xc99beb['attributes']=_['intersection'](_0x3f05e6[_0xa67d('0x2a')],qs[_0xa67d('0x2f')](_0x16592c[_0xa67d('0x2b')][_0xa67d('0x2f')]));_0xc99beb['attributes']=_0xc99beb['attributes'][_0xa67d('0x41')]?_0xc99beb[_0xa67d('0x2e')]:_0x3f05e6[_0xa67d('0x2a')];if(_0x16592c[_0xa67d('0x2b')]['includeAll']){_0xc99beb[_0xa67d('0x3a')]=[{'all':!![]}];}_0xc99beb=_[_0xa67d('0x37')]({},_0xc99beb,_0x16592c['options']);return db[_0xa67d('0x3b')][_0xa67d('0x42')](_0xc99beb)[_0xa67d('0x21')](handleEntityNotFound(_0x56e932,null))['then'](respondWithResult(_0x56e932,null))[_0xa67d('0x43')](handleError(_0x56e932,null));};exports[_0xa67d('0x44')]=function(_0x25d96a,_0x3075f7){return db[_0xa67d('0x3b')][_0xa67d('0x44')](_0x25d96a[_0xa67d('0x45')],{})[_0xa67d('0x21')](function(_0x1a107e){var _0x1a5cc4=_0x25d96a[_0xa67d('0x46')][_0xa67d('0x22')]({'plain':!![]});if(!_0x1a5cc4)throw new Error(_0xa67d('0x47'));if(_0x1a5cc4[_0xa67d('0x48')]===_0xa67d('0x46')){var _0x2967fd=_0x1a107e[_0xa67d('0x22')]({'plain':!![]});var _0x5ea673=_0xa67d('0x49');return db[_0xa67d('0x4a')]['find']({'where':{'name':_0x5ea673,'userProfileId':_0x1a5cc4[_0xa67d('0x4b')]},'raw':!![]})['then'](function(_0xac46d0){if(_0xac46d0&&_0xac46d0[_0xa67d('0x4c')]===0x0){return db[_0xa67d('0x4d')][_0xa67d('0x44')]({'name':_0x2967fd[_0xa67d('0x25')],'resourceId':_0x2967fd['id'],'type':_0xac46d0[_0xa67d('0x25')],'sectionId':_0xac46d0['id']},{})['then'](function(){return _0x1a107e;});}else{return _0x1a107e;}})['catch'](function(_0x10d9ac){logger['error'](_0xa67d('0x4e'),_0x10d9ac);throw _0x10d9ac;});}return _0x1a107e;})[_0xa67d('0x21')](respondWithResult(_0x3075f7,0xc9))[_0xa67d('0x43')](handleError(_0x3075f7,null));};exports[_0xa67d('0x20')]=function(_0x4a927a,_0xa73001){if(_0x4a927a[_0xa67d('0x45')]['id']){delete _0x4a927a[_0xa67d('0x45')]['id'];}return db[_0xa67d('0x3b')][_0xa67d('0x42')]({'where':{'id':_0x4a927a['params']['id']}})['then'](handleEntityNotFound(_0xa73001,null))['then'](saveUpdates(_0x4a927a[_0xa67d('0x45')],null))['then'](respondWithResult(_0xa73001,null))[_0xa67d('0x43')](handleError(_0xa73001,null));};exports[_0xa67d('0x23')]=function(_0x12cd41,_0x16ea5f){return db[_0xa67d('0x3b')]['find']({'where':{'id':_0x12cd41[_0xa67d('0x3e')]['id']}})[_0xa67d('0x21')](handleEntityNotFound(_0x16ea5f,null))['then'](removeEntity(_0x16ea5f,null))[_0xa67d('0x43')](handleError(_0x16ea5f,null));};exports['addInterval']=function(_0x3ac1bc,_0x32c218,_0x46bc05){if(_0x3ac1bc[_0xa67d('0x45')]['id']){delete _0x3ac1bc[_0xa67d('0x45')]['id'];}return db[_0xa67d('0x3b')][_0xa67d('0x42')]({'where':{'id':_0x3ac1bc[_0xa67d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x32c218,null))['then'](function(_0x5c69b8){if(_0x5c69b8){_0x3ac1bc[_0xa67d('0x45')][_0xa67d('0x4f')]=_0x5c69b8['id'];return db[_0xa67d('0x3b')][_0xa67d('0x44')](_0x3ac1bc[_0xa67d('0x45')]);}})[_0xa67d('0x21')](respondWithResult(_0x32c218,null))[_0xa67d('0x43')](handleError(_0x32c218,null));};exports[_0xa67d('0x50')]=function(_0x21e086,_0x28c92a,_0x95185b){var _0x50a73e={};var _0x420378={};var _0x412ddb;var _0x1daa86;return db[_0xa67d('0x3b')]['findOne']({'where':{'id':_0x21e086[_0xa67d('0x3e')]['id']}})[_0xa67d('0x21')](handleEntityNotFound(_0x28c92a,null))[_0xa67d('0x21')](function(_0x43edd3){if(_0x43edd3){_0x412ddb=_0x43edd3;_0x420378[_0xa67d('0x2a')]=_[_0xa67d('0x3f')](db[_0xa67d('0x3b')][_0xa67d('0x40')]);_0x420378[_0xa67d('0x2b')]=_['keys'](_0x21e086[_0xa67d('0x2b')]);_0x420378['filters']=_['intersection'](_0x420378[_0xa67d('0x2a')],_0x420378['query']);_0x50a73e['attributes']=_[_0xa67d('0x2d')](_0x420378[_0xa67d('0x2a')],qs[_0xa67d('0x2f')](_0x21e086['query']['fields']));_0x50a73e[_0xa67d('0x2e')]=_0x50a73e[_0xa67d('0x2e')][_0xa67d('0x41')]?_0x50a73e[_0xa67d('0x2e')]:_0x420378[_0xa67d('0x2a')];_0x50a73e[_0xa67d('0x31')]=qs[_0xa67d('0x32')](_0x21e086[_0xa67d('0x2b')][_0xa67d('0x32')]);_0x50a73e[_0xa67d('0x33')]=qs[_0xa67d('0x2c')](_[_0xa67d('0x34')](_0x21e086['query'],_0x420378[_0xa67d('0x2c')]));if(_0x21e086[_0xa67d('0x2b')][_0xa67d('0x35')]){_0x50a73e[_0xa67d('0x33')]=_[_0xa67d('0x37')](_0x50a73e['where'],{'$or':_['map'](_0x50a73e[_0xa67d('0x2e')],function(_0x6a0cd8){var _0x89c3e0={};_0x89c3e0[_0x6a0cd8]={'$like':'%'+_0x21e086[_0xa67d('0x2b')][_0xa67d('0x35')]+'%'};return _0x89c3e0;})});}_0x50a73e=_[_0xa67d('0x37')]({},_0x50a73e,_0x21e086[_0xa67d('0x38')]);return _0x412ddb[_0xa67d('0x50')](_0x50a73e);}})[_0xa67d('0x21')](function(_0x3dd9ca){if(_0x3dd9ca){_0x1daa86=_0x3dd9ca[_0xa67d('0x41')];if(!_0x21e086['query']['hasOwnProperty'](_0xa67d('0x30'))){_0x50a73e[_0xa67d('0x18')]=qs[_0xa67d('0x18')](_0x21e086[_0xa67d('0x2b')][_0xa67d('0x18')]);_0x50a73e[_0xa67d('0x1b')]=qs['offset'](_0x21e086[_0xa67d('0x2b')][_0xa67d('0x1b')]);}return _0x412ddb[_0xa67d('0x50')](_0x50a73e);}})[_0xa67d('0x21')](function(_0xe603b7){if(_0xe603b7){return _0xe603b7?{'count':_0x1daa86,'rows':_0xe603b7}:null;}})[_0xa67d('0x21')](respondWithResult(_0x28c92a,null))[_0xa67d('0x43')](handleError(_0x28c92a,null));};exports[_0xa67d('0x51')]=function(_0x5042e4,_0x3b0957,_0x2bbda2){return db['Interval'][_0xa67d('0x52')]({'where':{'id':_0x5042e4['params']['id']}})[_0xa67d('0x21')](handleEntityNotFound(_0x3b0957,null))[_0xa67d('0x21')](function(_0x593611){if(_0x593611){return db[_0xa67d('0x53')][_0xa67d('0x54')](function(_0x1c950d){return db['Interval'][_0xa67d('0x23')]({'where':{'IntervalId':_0x5042e4[_0xa67d('0x3e')]['id']},'transaction':_0x1c950d})[_0xa67d('0x21')](function(_0x1e7180){var _0x464e5b=_[_0xa67d('0x26')](_0x5042e4[_0xa67d('0x45')],function(_0x28346d){delete _0x28346d['id'];_0x28346d[_0xa67d('0x4f')]=_0x5042e4[_0xa67d('0x3e')]['id'];return _0x28346d;});return db[_0xa67d('0x3b')][_0xa67d('0x55')](_0x464e5b,{'transaction':_0x1c950d});});})[_0xa67d('0x21')](function(){return db[_0xa67d('0x3b')][_0xa67d('0x3c')]({'where':{'IntervalId':_0x5042e4['params']['id']}});});}})['then'](respondWithResult(_0x3b0957,null))[_0xa67d('0x43')](handleError(_0x3b0957,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 5715d26..c3471d2 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 _0x1b71=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./interval.attributes','define','Interval','tools_intervals','rewrite','lodash','util'];(function(_0x28ac9d,_0x10c052){var _0x201d5f=function(_0x20d7f1){while(--_0x20d7f1){_0x28ac9d['push'](_0x28ac9d['shift']());}};_0x201d5f(++_0x10c052);}(_0x1b71,0x8a));var _0x11b7=function(_0x9cec5a,_0x28b6cf){_0x9cec5a=_0x9cec5a-0x0;var _0x19c878=_0x1b71[_0x9cec5a];return _0x19c878;};'use strict';var _=require(_0x11b7('0x0'));var util=require(_0x11b7('0x1'));var logger=require(_0x11b7('0x2'))(_0x11b7('0x3'));var moment=require(_0x11b7('0x4'));var BPromise=require(_0x11b7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11b7('0x6'));var rimraf=require(_0x11b7('0x7'));var config=require(_0x11b7('0x8'));var attributes=require(_0x11b7('0x9'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x5d40c7,_0x2aa5a9){return _0x5d40c7[_0x11b7('0xa')](_0x11b7('0xb'),attributes,{'tableName':_0x11b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x419f38,_0x368dbc){extensions['rewrite'](_0x5d40c7,_0x419f38);},'afterBulkCreate':function(_0x2098f9,_0x148165,_0x2cd11c){_0x2cd11c();extensions[_0x11b7('0xd')](_0x5d40c7,_0x2098f9[0x0]);},'afterUpdate':function(_0x11370e,_0x23c046){extensions[_0x11b7('0xd')](_0x5d40c7,_0x11370e);},'afterDestroy':function(_0x1460fb,_0x4a77c2){extensions[_0x11b7('0xd')](_0x5d40c7,_0x1460fb);}}});}; \ No newline at end of file +var _0x4bfc=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite'];(function(_0x1c9696,_0x33f977){var _0x1d17a5=function(_0x4caa30){while(--_0x4caa30){_0x1c9696['push'](_0x1c9696['shift']());}};_0x1d17a5(++_0x33f977);}(_0x4bfc,0x134));var _0xc4bf=function(_0x41886d,_0x478588){_0x41886d=_0x41886d-0x0;var _0x26f4a1=_0x4bfc[_0x41886d];return _0x26f4a1;};'use strict';var _=require('lodash');var util=require(_0xc4bf('0x0'));var logger=require(_0xc4bf('0x1'))(_0xc4bf('0x2'));var moment=require(_0xc4bf('0x3'));var BPromise=require(_0xc4bf('0x4'));var rp=require(_0xc4bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4bf('0x6'));var config=require(_0xc4bf('0x7'));var attributes=require(_0xc4bf('0x8'));var extensions=require(_0xc4bf('0x9'));module[_0xc4bf('0xa')]=function(_0x10977a,_0x2b4769){return _0x10977a[_0xc4bf('0xb')](_0xc4bf('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d6b43,_0x8585db){extensions[_0xc4bf('0xd')](_0x10977a,_0x5d6b43);},'afterBulkCreate':function(_0x581e8b,_0x2a0794,_0x15182e){_0x15182e();extensions['rewrite'](_0x10977a,_0x581e8b[0x0]);},'afterUpdate':function(_0x3f1f33,_0x39fb9e){extensions[_0xc4bf('0xd')](_0x10977a,_0x3f1f33);},'afterDestroy':function(_0x2cc3b7,_0x131a9d){extensions[_0xc4bf('0xd')](_0x10977a,_0x2cc3b7);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9d31f20..e24710f 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index fffd47e..0e7d68d 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x382c13,_0x4988b6){var _0x55dd9b=function(_0x20ae76){while(--_0x20ae76){_0x382c13['push'](_0x382c13['shift']());}};_0x55dd9b(++_0x4988b6);}(_0xdb28,0x106));var _0x8db2=function(_0x25cb41,_0x52512f){_0x25cb41=_0x25cb41-0x0;var _0xd43bd4=_0xdb28[_0x25cb41];return _0xd43bd4;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x2c5ee9,_0x4cac7c){var _0x217cc0=function(_0x115f9f){while(--_0x115f9f){_0x2c5ee9['push'](_0x2c5ee9['shift']());}};_0x217cc0(++_0x4cac7c);}(_0x2032,0xd9));var _0x2203=function(_0x8018ea,_0x1b235b){_0x8018ea=_0x8018ea-0x0;var _0x2a6ded=_0x2032[_0x8018ea];return _0x2a6ded;};'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 07e5d6e..e171d0e 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 _0xbfca=['Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','status','statusCode','json','parse','api.jira','write','end','openIssue','body','x-forwarded-for','connection','socket','remoteAddress','https','../../config/logger','api','key','MOTGUI','summary','Report','description','stringify','issuetype'];(function(_0x4874c1,_0x3d1071){var _0x3212a5=function(_0x3c9cc4){while(--_0x3c9cc4){_0x4874c1['push'](_0x4874c1['shift']());}};_0x3212a5(++_0x3d1071);}(_0xbfca,0x19a));var _0xabfc=function(_0x257837,_0x17c15b){_0x257837=_0x257837-0x0;var _0x4c9cb8=_0xbfca[_0x257837];return _0x4c9cb8;};'use strict';var BPromise=require('bluebird');var https=require(_0xabfc('0x0'));var logger=require(_0xabfc('0x1'))(_0xabfc('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x51daea,_0x4e8265){var _0x97bb04={'fields':{'project':{'key':_0x51daea[_0xabfc('0x3')]||_0xabfc('0x4')},'summary':(_0x51daea[_0xabfc('0x5')]||_0xabfc('0x6'))+'\x20from\x20'+_0x51daea['ip'],'description':_0x51daea[_0xabfc('0x7')]||JSON[_0xabfc('0x8')](_0x51daea),'issuetype':{'name':_0x51daea[_0xabfc('0x9')]||_0xabfc('0xa')}}};_0x97bb04[_0xabfc('0xb')][_0xabfc('0xc')]=_0x51daea['email'];_0x97bb04[_0xabfc('0xb')]['customfield_11501']=_0x51daea[_0xabfc('0xd')];_0x97bb04[_0xabfc('0xb')][_0xabfc('0xe')]=_0x51daea[_0xabfc('0xf')];_0x97bb04['fields'][_0xabfc('0x10')]=_0x51daea[_0xabfc('0x11')];_0x97bb04[_0xabfc('0xb')][_0xabfc('0x12')]=_0x51daea[_0xabfc('0x13')];_0x97bb04['fields'][_0xabfc('0x14')]=_0x51daea['ip'];var _0x9903cb={'host':_0xabfc('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xabfc('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xabfc('0x17'),'Authorization':_0xabfc('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xabfc('0x19')]('base64')}};var _0x1b8776=JSON['stringify'](_0x97bb04);var _0x21095f=https[_0xabfc('0x1a')](_0x9903cb,function(_0x1e5c92){_0x1e5c92[_0xabfc('0x1b')](_0xabfc('0x1c'));var _0x2712af='';_0x1e5c92['on']('data',function(_0x1ad796){_0x2712af+=_0x1ad796;});_0x1e5c92['on']('end',function(){if(_0x4e8265){return _0x4e8265[_0xabfc('0x1d')](_0x1e5c92[_0xabfc('0x1e')])[_0xabfc('0x1f')](JSON[_0xabfc('0x20')](_0x2712af));}});});_0x21095f['on']('error',function(_0x279b8e){if(_0x4e8265){return _0x4e8265[_0xabfc('0x1d')](0x1f4)[_0xabfc('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xabfc('0x21')}]});}});_0x21095f[_0xabfc('0x22')](_0x1b8776);_0x21095f[_0xabfc('0x23')]();}exports[_0xabfc('0x24')]=openIssue;exports['send']=function(_0x23309d,_0x26366e){_0x23309d[_0xabfc('0x25')]['ip']=_0x23309d['headers'][_0xabfc('0x26')]||_0x23309d[_0xabfc('0x27')]['remoteAddress']||_0x23309d[_0xabfc('0x28')][_0xabfc('0x29')]||_0x23309d[_0xabfc('0x27')][_0xabfc('0x28')][_0xabfc('0x29')];return openIssue(_0x23309d[_0xabfc('0x25')],_0x26366e);}; \ No newline at end of file +var _0x39a4=['customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','utf8','data','json','error','status','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11502','customfield_11503','name','reason'];(function(_0xe33e38,_0x8b4992){var _0xe3db22=function(_0x4932c9){while(--_0x4932c9){_0xe33e38['push'](_0xe33e38['shift']());}};_0xe3db22(++_0x8b4992);}(_0x39a4,0xd3));var _0x439a=function(_0x2b368a,_0x22262b){_0x2b368a=_0x2b368a-0x0;var _0x9a5c23=_0x39a4[_0x2b368a];return _0x9a5c23;};'use strict';var BPromise=require(_0x439a('0x0'));var https=require(_0x439a('0x1'));var logger=require(_0x439a('0x2'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5b76c8,_0x1b312f){var _0x5c7ce5={'fields':{'project':{'key':_0x5b76c8[_0x439a('0x3')]||_0x439a('0x4')},'summary':(_0x5b76c8[_0x439a('0x5')]||'Report')+_0x439a('0x6')+_0x5b76c8['ip'],'description':_0x5b76c8[_0x439a('0x7')]||JSON[_0x439a('0x8')](_0x5b76c8),'issuetype':{'name':_0x5b76c8[_0x439a('0x9')]||_0x439a('0xa')}}};_0x5c7ce5[_0x439a('0xb')][_0x439a('0xc')]=_0x5b76c8['email'];_0x5c7ce5['fields']['customfield_11501']=_0x5b76c8['oldToken'];_0x5c7ce5[_0x439a('0xb')][_0x439a('0xd')]=_0x5b76c8['newToken'];_0x5c7ce5[_0x439a('0xb')][_0x439a('0xe')]=_0x5b76c8[_0x439a('0xf')];_0x5c7ce5[_0x439a('0xb')]['customfield_11504']=_0x5b76c8[_0x439a('0x10')];_0x5c7ce5[_0x439a('0xb')][_0x439a('0x11')]=_0x5b76c8['ip'];var _0x4edeb2={'host':_0x439a('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x439a('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x439a('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x439a('0x15')](_0x439a('0x16'))}};var _0x32ff46=JSON[_0x439a('0x8')](_0x5c7ce5);var _0x36cfb6=https[_0x439a('0x17')](_0x4edeb2,function(_0x48445e){_0x48445e['setEncoding'](_0x439a('0x18'));var _0xaa233d='';_0x48445e['on'](_0x439a('0x19'),function(_0x5c173c){_0xaa233d+=_0x5c173c;});_0x48445e['on']('end',function(){if(_0x1b312f){return _0x1b312f['status'](_0x48445e['statusCode'])[_0x439a('0x1a')](JSON['parse'](_0xaa233d));}});});_0x36cfb6['on'](_0x439a('0x1b'),function(_0x4235f2){if(_0x1b312f){return _0x1b312f[_0x439a('0x1c')](0x1f4)[_0x439a('0x1a')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x36cfb6[_0x439a('0x1d')](_0x32ff46);_0x36cfb6['end']();}exports[_0x439a('0x1e')]=openIssue;exports[_0x439a('0x1f')]=function(_0x1ea6d3,_0x42668b){_0x1ea6d3[_0x439a('0x20')]['ip']=_0x1ea6d3[_0x439a('0x21')][_0x439a('0x22')]||_0x1ea6d3[_0x439a('0x23')][_0x439a('0x24')]||_0x1ea6d3[_0x439a('0x25')][_0x439a('0x24')]||_0x1ea6d3[_0x439a('0x23')][_0x439a('0x25')][_0x439a('0x24')];return openIssue(_0x1ea6d3[_0x439a('0x20')],_0x42668b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 03d98be..e3a8a03 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 _0x54ef=['/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','get'];(function(_0x271790,_0x3e2036){var _0x573e22=function(_0x5ec260){while(--_0x5ec260){_0x271790['push'](_0x271790['shift']());}};_0x573e22(++_0x3e2036);}(_0x54ef,0x112));var _0xf54e=function(_0x3cb08a,_0xd6327d){_0x3cb08a=_0x3cb08a-0x0;var _0x4c94d3=_0x54ef[_0x3cb08a];return _0x4c94d3;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['get'](_0xf54e('0xe'),auth[_0xf54e('0xf')](),controller['show']);router[_0xf54e('0x10')]('/',auth[_0xf54e('0xf')](),controller[_0xf54e('0x11')]);router[_0xf54e('0x12')]('/:id',auth[_0xf54e('0xf')](),controller[_0xf54e('0x13')]);router[_0xf54e('0x14')](_0xf54e('0xe'),auth['isAuthenticated'](),controller[_0xf54e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x5c6252,_0x488206){var _0x534df7=function(_0x5bafae){while(--_0x5bafae){_0x5c6252['push'](_0x5c6252['shift']());}};_0x534df7(++_0x488206);}(_0xe706,0xa3));var _0x6e70=function(_0x4a281d,_0x27cde8){_0x4a281d=_0x4a281d-0x0;var _0x3033e7=_0xe706[_0x4a281d];return _0x3033e7;};'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'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('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 b0b863c..17f76c8 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x4a50f6,_0x35854a){_0x4a50f6=_0x4a50f6-0x0;var _0x5b25ea=_0x7a54[_0x4a50f6];return _0x5b25ea;};'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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0xfa516,_0x369241){_0xfa516=_0xfa516-0x0;var _0x29487=_0x7a54[_0xfa516];return _0x29487;};'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 558b113..6303cc2 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 _0x7f94=['JscriptyAnswerReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','merge','options','include','findAll','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x37c37d,_0x82e988){var _0x2383c2=function(_0x13b5b7){while(--_0x13b5b7){_0x37c37d['push'](_0x37c37d['shift']());}};_0x2383c2(++_0x82e988);}(_0x7f94,0x65));var _0x47f9=function(_0x5cb992,_0x40e046){_0x5cb992=_0x5cb992-0x0;var _0x450e90=_0x7f94[_0x5cb992];return _0x450e90;};'use strict';var emlformat=require(_0x47f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47f9('0x1'));var jsonpatch=require(_0x47f9('0x2'));var rp=require(_0x47f9('0x3'));var moment=require(_0x47f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47f9('0x5'));var util=require(_0x47f9('0x6'));var path=require(_0x47f9('0x7'));var sox=require(_0x47f9('0x8'));var csv=require(_0x47f9('0x9'));var ejs=require(_0x47f9('0xa'));var fs=require('fs');var fs_extra=require(_0x47f9('0xb'));var _=require('lodash');var squel=require(_0x47f9('0xc'));var crypto=require(_0x47f9('0xd'));var jsforce=require(_0x47f9('0xe'));var deskjs=require(_0x47f9('0xf'));var toCsv=require(_0x47f9('0x9'));var querystring=require(_0x47f9('0x10'));var Papa=require(_0x47f9('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(_0x47f9('0x12'));var logger=require(_0x47f9('0x13'))(_0x47f9('0x14'));var utils=require(_0x47f9('0x15'));var config=require(_0x47f9('0x16'));var licenseUtil=require(_0x47f9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a8bac,_0x1002f7){_0x1002f7=_0x1002f7||0xcc;return function(_0x49c33c){if(_0x49c33c){return _0x5a8bac['sendStatus'](_0x1002f7);}return _0x5a8bac['status'](_0x1002f7)[_0x47f9('0x18')]();};}function respondWithResult(_0x43e4db,_0x4d44dd){_0x4d44dd=_0x4d44dd||0xc8;return function(_0x166860){if(_0x166860){return _0x43e4db[_0x47f9('0x19')](_0x4d44dd)[_0x47f9('0x1a')](_0x166860);}};}function respondWithFilteredResult(_0x2a6444,_0x48cc81){return function(_0x3320d1){if(_0x3320d1){var _0x3703e1=typeof _0x48cc81[_0x47f9('0x1b')]===_0x47f9('0x1c')&&typeof _0x48cc81[_0x47f9('0x1d')]==='undefined';var _0x56775f=_0x3320d1['count'];var _0xd80474=_0x3703e1?0x0:_0x48cc81[_0x47f9('0x1b')];var _0x32bb57=_0x3703e1?_0x3320d1[_0x47f9('0x1e')]:_0x48cc81[_0x47f9('0x1b')]+_0x48cc81[_0x47f9('0x1d')];var _0x29700e;if(_0x32bb57>=_0x56775f){_0x32bb57=_0x56775f;_0x29700e=0xc8;}else{_0x29700e=0xce;}_0x2a6444[_0x47f9('0x19')](_0x29700e);return _0x2a6444[_0x47f9('0x1f')](_0x47f9('0x20'),_0xd80474+'-'+_0x32bb57+'/'+_0x56775f)[_0x47f9('0x1a')](_0x3320d1);}return null;};}function patchUpdates(_0x328d14){return function(_0x397dd5){try{jsonpatch['apply'](_0x397dd5,_0x328d14,!![]);}catch(_0x4d35bf){return BPromise[_0x47f9('0x21')](_0x4d35bf);}return _0x397dd5['save']();};}function saveUpdates(_0x2e2b69,_0x29b7f8){return function(_0x2ecf99){if(_0x2ecf99){return _0x2ecf99[_0x47f9('0x22')](_0x2e2b69)[_0x47f9('0x23')](function(_0x11ef91){return _0x11ef91;});}return null;};}function removeEntity(_0x6a49d,_0x3c4778){return function(_0x4fd2b1){if(_0x4fd2b1){return _0x4fd2b1[_0x47f9('0x24')]()[_0x47f9('0x23')](function(){_0x6a49d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bd84,_0x4c16e0){return function(_0x76077d){if(!_0x76077d){_0x26bd84['sendStatus'](0x194);}return _0x76077d;};}function handleError(_0x26174a,_0x1a8c4b){_0x1a8c4b=_0x1a8c4b||0x1f4;return function(_0x5dbdda){logger[_0x47f9('0x25')](_0x5dbdda[_0x47f9('0x26')]);if(_0x5dbdda[_0x47f9('0x27')]){delete _0x5dbdda[_0x47f9('0x27')];}_0x26174a[_0x47f9('0x19')](_0x1a8c4b)[_0x47f9('0x28')](_0x5dbdda);};}exports[_0x47f9('0x29')]=function(_0x52927a,_0x53e951){var _0x4c37d2={},_0x481ccb={},_0x1a5b58={'count':0x0,'rows':[]};var _0x5818a6=_[_0x47f9('0x2a')](db[_0x47f9('0x2b')][_0x47f9('0x2c')],function(_0xaf0fea){return{'name':_0xaf0fea[_0x47f9('0x2d')],'type':_0xaf0fea[_0x47f9('0x2e')]['key']};});_0x481ccb['model']=_[_0x47f9('0x2a')](_0x5818a6,_0x47f9('0x27'));_0x481ccb['query']=_[_0x47f9('0x2f')](_0x52927a[_0x47f9('0x30')]);_0x481ccb[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],_0x481ccb[_0x47f9('0x30')]);_0x4c37d2[_0x47f9('0x34')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],qs[_0x47f9('0x35')](_0x52927a[_0x47f9('0x30')][_0x47f9('0x35')]));_0x4c37d2[_0x47f9('0x34')]=_0x4c37d2['attributes'][_0x47f9('0x36')]?_0x4c37d2[_0x47f9('0x34')]:_0x481ccb['model'];if(!_0x52927a[_0x47f9('0x30')][_0x47f9('0x37')]('nolimit')){_0x4c37d2[_0x47f9('0x1d')]=qs['limit'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1d')]);_0x4c37d2[_0x47f9('0x1b')]=qs['offset'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1b')]);}_0x4c37d2[_0x47f9('0x38')]=qs[_0x47f9('0x39')](_0x52927a[_0x47f9('0x30')]['sort']);_0x4c37d2['where']=qs['filters'](_[_0x47f9('0x3a')](_0x52927a[_0x47f9('0x30')],_0x481ccb[_0x47f9('0x31')]),_0x5818a6);if(_0x52927a['query']['filter']){_0x4c37d2[_0x47f9('0x3b')]=_['merge'](_0x4c37d2[_0x47f9('0x3b')],{'$or':_['map'](_0x5818a6,function(_0x563492){if(_0x563492[_0x47f9('0x2e')]!=='VIRTUAL'){var _0xfe4480={};_0xfe4480[_0x563492[_0x47f9('0x27')]]={'$like':'%'+_0x52927a[_0x47f9('0x30')][_0x47f9('0x3c')]+'%'};return _0xfe4480;}})});}_0x4c37d2=_[_0x47f9('0x3d')]({},_0x4c37d2,_0x52927a[_0x47f9('0x3e')]);var _0x27ca33={'where':_0x4c37d2['where']};return db['JscriptyAnswerReport'][_0x47f9('0x1e')](_0x27ca33)[_0x47f9('0x23')](function(_0x118db1){_0x1a5b58[_0x47f9('0x1e')]=_0x118db1;if(_0x52927a[_0x47f9('0x30')]['includeAll']){_0x4c37d2[_0x47f9('0x3f')]=[{'all':!![]}];}return db[_0x47f9('0x2b')][_0x47f9('0x40')](_0x4c37d2);})[_0x47f9('0x23')](function(_0x3128bc){_0x1a5b58[_0x47f9('0x41')]=_0x3128bc;return _0x1a5b58;})[_0x47f9('0x23')](respondWithFilteredResult(_0x53e951,_0x4c37d2))[_0x47f9('0x42')](handleError(_0x53e951,null));};exports['show']=function(_0x311975,_0xc61254){var _0x55443d={'raw':!![],'where':{'id':_0x311975['params']['id']}},_0x587a7f={};_0x587a7f[_0x47f9('0x33')]=_[_0x47f9('0x2f')](db[_0x47f9('0x2b')][_0x47f9('0x2c')]);_0x587a7f[_0x47f9('0x30')]=_[_0x47f9('0x2f')](_0x311975[_0x47f9('0x30')]);_0x587a7f[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x587a7f[_0x47f9('0x33')],_0x587a7f['query']);_0x55443d['attributes']=_['intersection'](_0x587a7f[_0x47f9('0x33')],qs['fields'](_0x311975[_0x47f9('0x30')][_0x47f9('0x35')]));_0x55443d['attributes']=_0x55443d[_0x47f9('0x34')][_0x47f9('0x36')]?_0x55443d['attributes']:_0x587a7f[_0x47f9('0x33')];if(_0x311975[_0x47f9('0x30')]['includeAll']){_0x55443d[_0x47f9('0x3f')]=[{'all':!![]}];}_0x55443d=_[_0x47f9('0x3d')]({},_0x55443d,_0x311975[_0x47f9('0x3e')]);return db[_0x47f9('0x2b')][_0x47f9('0x43')](_0x55443d)[_0x47f9('0x23')](handleEntityNotFound(_0xc61254,null))[_0x47f9('0x23')](respondWithResult(_0xc61254,null))[_0x47f9('0x42')](handleError(_0xc61254,null));};exports[_0x47f9('0x44')]=function(_0x411695,_0x38d61d){return db[_0x47f9('0x2b')][_0x47f9('0x44')](_0x411695[_0x47f9('0x45')],{})[_0x47f9('0x23')](respondWithResult(_0x38d61d,0xc9))['catch'](handleError(_0x38d61d,null));};exports[_0x47f9('0x22')]=function(_0x1c6e21,_0x58fc09){if(_0x1c6e21[_0x47f9('0x45')]['id']){delete _0x1c6e21[_0x47f9('0x45')]['id'];}return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x1c6e21['params']['id']}})[_0x47f9('0x23')](handleEntityNotFound(_0x58fc09,null))['then'](saveUpdates(_0x1c6e21[_0x47f9('0x45')],null))['then'](respondWithResult(_0x58fc09,null))['catch'](handleError(_0x58fc09,null));};exports[_0x47f9('0x24')]=function(_0x2bd2c7,_0x1b1029){return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x2bd2c7[_0x47f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b1029,null))['then'](removeEntity(_0x1b1029,null))[_0x47f9('0x42')](handleError(_0x1b1029,null));};exports[_0x47f9('0x47')]=function(_0x43eb5b,_0x3d796c){return db[_0x47f9('0x2b')][_0x47f9('0x47')]()['then'](respondWithResult(_0x3d796c,null))[_0x47f9('0x42')](handleError(_0x3d796c,null));}; \ No newline at end of file +var _0x2070=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis'];(function(_0x2e33d3,_0x4375d2){var _0x5cd87d=function(_0x2ae53c){while(--_0x2ae53c){_0x2e33d3['push'](_0x2e33d3['shift']());}};_0x5cd87d(++_0x4375d2);}(_0x2070,0x1a2));var _0x0207=function(_0x430222,_0x2b4850){_0x430222=_0x430222-0x0;var _0x1c82b2=_0x2070[_0x430222];return _0x1c82b2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0207('0x0'));var jsonpatch=require(_0x0207('0x1'));var rp=require(_0x0207('0x2'));var moment=require('moment');var BPromise=require(_0x0207('0x3'));var Mustache=require(_0x0207('0x4'));var util=require('util');var path=require(_0x0207('0x5'));var sox=require(_0x0207('0x6'));var csv=require('to-csv');var ejs=require(_0x0207('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0207('0x8'));var crypto=require(_0x0207('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0207('0xa'));var toCsv=require(_0x0207('0xb'));var querystring=require('querystring');var Papa=require(_0x0207('0xc'));var Redis=require(_0x0207('0xd'));var authService=require(_0x0207('0xe'));var qs=require(_0x0207('0xf'));var as=require(_0x0207('0x10'));var hardwareService=require(_0x0207('0x11'));var logger=require(_0x0207('0x12'))(_0x0207('0x13'));var utils=require(_0x0207('0x14'));var config=require(_0x0207('0x15'));var licenseUtil=require(_0x0207('0x16'));var db=require(_0x0207('0x17'))['db'];function respondWithStatusCode(_0x22be26,_0x7c84b){_0x7c84b=_0x7c84b||0xcc;return function(_0x5bb744){if(_0x5bb744){return _0x22be26[_0x0207('0x18')](_0x7c84b);}return _0x22be26['status'](_0x7c84b)[_0x0207('0x19')]();};}function respondWithResult(_0x3bd0c4,_0x3ffc3a){_0x3ffc3a=_0x3ffc3a||0xc8;return function(_0x1748a1){if(_0x1748a1){return _0x3bd0c4[_0x0207('0x1a')](_0x3ffc3a)['json'](_0x1748a1);}};}function respondWithFilteredResult(_0x3cb346,_0x1cbefd){return function(_0x5e8d17){if(_0x5e8d17){var _0x2bb662=typeof _0x1cbefd[_0x0207('0x1b')]===_0x0207('0x1c')&&typeof _0x1cbefd[_0x0207('0x1d')]==='undefined';var _0x1bdc25=_0x5e8d17[_0x0207('0x1e')];var _0x171122=_0x2bb662?0x0:_0x1cbefd[_0x0207('0x1b')];var _0x45bb5d=_0x2bb662?_0x5e8d17[_0x0207('0x1e')]:_0x1cbefd[_0x0207('0x1b')]+_0x1cbefd[_0x0207('0x1d')];var _0x4255bb;if(_0x45bb5d>=_0x1bdc25){_0x45bb5d=_0x1bdc25;_0x4255bb=0xc8;}else{_0x4255bb=0xce;}_0x3cb346[_0x0207('0x1a')](_0x4255bb);return _0x3cb346[_0x0207('0x1f')](_0x0207('0x20'),_0x171122+'-'+_0x45bb5d+'/'+_0x1bdc25)[_0x0207('0x21')](_0x5e8d17);}return null;};}function patchUpdates(_0xfc201){return function(_0x3474f3){try{jsonpatch['apply'](_0x3474f3,_0xfc201,!![]);}catch(_0x2c8567){return BPromise['reject'](_0x2c8567);}return _0x3474f3[_0x0207('0x22')]();};}function saveUpdates(_0x1421e7,_0x37c050){return function(_0x56a158){if(_0x56a158){return _0x56a158[_0x0207('0x23')](_0x1421e7)[_0x0207('0x24')](function(_0x5cd2bc){return _0x5cd2bc;});}return null;};}function removeEntity(_0x16bf24,_0x11bb0f){return function(_0x40224d){if(_0x40224d){return _0x40224d[_0x0207('0x25')]()[_0x0207('0x24')](function(){_0x16bf24['status'](0xcc)[_0x0207('0x19')]();});}};}function handleEntityNotFound(_0x4089f1,_0x4a0b93){return function(_0x94e0e1){if(!_0x94e0e1){_0x4089f1['sendStatus'](0x194);}return _0x94e0e1;};}function handleError(_0x3ae0af,_0x3cfd1b){_0x3cfd1b=_0x3cfd1b||0x1f4;return function(_0x2e496f){logger['error'](_0x2e496f[_0x0207('0x26')]);if(_0x2e496f[_0x0207('0x27')]){delete _0x2e496f[_0x0207('0x27')];}_0x3ae0af[_0x0207('0x1a')](_0x3cfd1b)[_0x0207('0x28')](_0x2e496f);};}exports['index']=function(_0x33b7dc,_0x527cdb){var _0x3a7dbd={},_0x873259={},_0x435e79={'count':0x0,'rows':[]};var _0x4e5e7b=_[_0x0207('0x29')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x9cd617){return{'name':_0x9cd617[_0x0207('0x2a')],'type':_0x9cd617[_0x0207('0x2b')][_0x0207('0x2c')]};});_0x873259[_0x0207('0x2d')]=_['map'](_0x4e5e7b,_0x0207('0x27'));_0x873259[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x33b7dc[_0x0207('0x2e')]);_0x873259['filters']=_[_0x0207('0x30')](_0x873259[_0x0207('0x2d')],_0x873259[_0x0207('0x2e')]);_0x3a7dbd[_0x0207('0x31')]=_[_0x0207('0x30')](_0x873259[_0x0207('0x2d')],qs['fields'](_0x33b7dc['query'][_0x0207('0x32')]));_0x3a7dbd['attributes']=_0x3a7dbd[_0x0207('0x31')][_0x0207('0x33')]?_0x3a7dbd[_0x0207('0x31')]:_0x873259[_0x0207('0x2d')];if(!_0x33b7dc['query'][_0x0207('0x34')]('nolimit')){_0x3a7dbd['limit']=qs[_0x0207('0x1d')](_0x33b7dc[_0x0207('0x2e')][_0x0207('0x1d')]);_0x3a7dbd[_0x0207('0x1b')]=qs[_0x0207('0x1b')](_0x33b7dc[_0x0207('0x2e')][_0x0207('0x1b')]);}_0x3a7dbd['order']=qs[_0x0207('0x35')](_0x33b7dc[_0x0207('0x2e')][_0x0207('0x35')]);_0x3a7dbd[_0x0207('0x36')]=qs['filters'](_['pick'](_0x33b7dc['query'],_0x873259[_0x0207('0x37')]),_0x4e5e7b);if(_0x33b7dc[_0x0207('0x2e')][_0x0207('0x38')]){_0x3a7dbd[_0x0207('0x36')]=_['merge'](_0x3a7dbd[_0x0207('0x36')],{'$or':_[_0x0207('0x29')](_0x4e5e7b,function(_0x21c9a1){if(_0x21c9a1[_0x0207('0x2b')]!=='VIRTUAL'){var _0x59aaae={};_0x59aaae[_0x21c9a1[_0x0207('0x27')]]={'$like':'%'+_0x33b7dc['query']['filter']+'%'};return _0x59aaae;}})});}_0x3a7dbd=_[_0x0207('0x39')]({},_0x3a7dbd,_0x33b7dc[_0x0207('0x3a')]);var _0x360052={'where':_0x3a7dbd['where']};return db[_0x0207('0x3b')][_0x0207('0x1e')](_0x360052)[_0x0207('0x24')](function(_0x9527d7){_0x435e79['count']=_0x9527d7;if(_0x33b7dc[_0x0207('0x2e')][_0x0207('0x3c')]){_0x3a7dbd[_0x0207('0x3d')]=[{'all':!![]}];}return db[_0x0207('0x3b')][_0x0207('0x3e')](_0x3a7dbd);})['then'](function(_0x3dc87d){_0x435e79[_0x0207('0x3f')]=_0x3dc87d;return _0x435e79;})[_0x0207('0x24')](respondWithFilteredResult(_0x527cdb,_0x3a7dbd))[_0x0207('0x40')](handleError(_0x527cdb,null));};exports[_0x0207('0x41')]=function(_0x5a532b,_0x121e5c){var _0x151bfa={'raw':!![],'where':{'id':_0x5a532b[_0x0207('0x42')]['id']}},_0x4cce6a={};_0x4cce6a[_0x0207('0x2d')]=_[_0x0207('0x2f')](db[_0x0207('0x3b')][_0x0207('0x43')]);_0x4cce6a[_0x0207('0x2e')]=_[_0x0207('0x2f')](_0x5a532b[_0x0207('0x2e')]);_0x4cce6a[_0x0207('0x37')]=_[_0x0207('0x30')](_0x4cce6a[_0x0207('0x2d')],_0x4cce6a[_0x0207('0x2e')]);_0x151bfa[_0x0207('0x31')]=_['intersection'](_0x4cce6a[_0x0207('0x2d')],qs[_0x0207('0x32')](_0x5a532b[_0x0207('0x2e')][_0x0207('0x32')]));_0x151bfa['attributes']=_0x151bfa['attributes'][_0x0207('0x33')]?_0x151bfa['attributes']:_0x4cce6a[_0x0207('0x2d')];if(_0x5a532b[_0x0207('0x2e')]['includeAll']){_0x151bfa[_0x0207('0x3d')]=[{'all':!![]}];}_0x151bfa=_[_0x0207('0x39')]({},_0x151bfa,_0x5a532b[_0x0207('0x3a')]);return db['JscriptyAnswerReport'][_0x0207('0x44')](_0x151bfa)[_0x0207('0x24')](handleEntityNotFound(_0x121e5c,null))[_0x0207('0x24')](respondWithResult(_0x121e5c,null))['catch'](handleError(_0x121e5c,null));};exports[_0x0207('0x45')]=function(_0x25b94c,_0x33f716){return db[_0x0207('0x3b')]['create'](_0x25b94c[_0x0207('0x46')],{})[_0x0207('0x24')](respondWithResult(_0x33f716,0xc9))['catch'](handleError(_0x33f716,null));};exports['update']=function(_0x4ad321,_0x567782){if(_0x4ad321['body']['id']){delete _0x4ad321['body']['id'];}return db[_0x0207('0x3b')][_0x0207('0x44')]({'where':{'id':_0x4ad321[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x567782,null))[_0x0207('0x24')](saveUpdates(_0x4ad321[_0x0207('0x46')],null))['then'](respondWithResult(_0x567782,null))['catch'](handleError(_0x567782,null));};exports[_0x0207('0x25')]=function(_0x22b375,_0x583536){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x22b375[_0x0207('0x42')]['id']}})[_0x0207('0x24')](handleEntityNotFound(_0x583536,null))[_0x0207('0x24')](removeEntity(_0x583536,null))[_0x0207('0x40')](handleError(_0x583536,null));};exports[_0x0207('0x47')]=function(_0x3bdf14,_0x20f479){return db[_0x0207('0x3b')][_0x0207('0x47')]()['then'](respondWithResult(_0x20f479,null))[_0x0207('0x40')](handleError(_0x20f479,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e6ac017..6dea22f 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 _0xe113=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','lodash','util','api','moment'];(function(_0x309595,_0xc8e481){var _0x4db831=function(_0xcec989){while(--_0xcec989){_0x309595['push'](_0x309595['shift']());}};_0x4db831(++_0xc8e481);}(_0xe113,0x1f4));var _0x3e11=function(_0x2b8d01,_0x14d5b5){_0x2b8d01=_0x2b8d01-0x0;var _0x4ce32d=_0xe113[_0x2b8d01];return _0x4ce32d;};'use strict';var _=require(_0x3e11('0x0'));var util=require(_0x3e11('0x1'));var logger=require('../../config/logger')(_0x3e11('0x2'));var moment=require(_0x3e11('0x3'));var BPromise=require(_0x3e11('0x4'));var rp=require(_0x3e11('0x5'));var fs=require('fs');var path=require(_0x3e11('0x6'));var rimraf=require(_0x3e11('0x7'));var config=require(_0x3e11('0x8'));var attributes=require(_0x3e11('0x9'));module[_0x3e11('0xa')]=function(_0x3327fd,_0x3d314c){return _0x3327fd[_0x3e11('0xb')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x511d=['api','moment','request-promise','path','rimraf','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x2de0ec,_0x38812f){var _0x13aa7b=function(_0x340176){while(--_0x340176){_0x2de0ec['push'](_0x2de0ec['shift']());}};_0x13aa7b(++_0x38812f);}(_0x511d,0x1e1));var _0xd511=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x511d[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xd511('0x0'));var util=require(_0xd511('0x1'));var logger=require(_0xd511('0x2'))(_0xd511('0x3'));var moment=require(_0xd511('0x4'));var BPromise=require('bluebird');var rp=require(_0xd511('0x5'));var fs=require('fs');var path=require(_0xd511('0x6'));var rimraf=require(_0xd511('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xd511('0x8')]=function(_0x37591d,_0x1cb277){return _0x37591d['define'](_0xd511('0x9'),attributes,{'tableName':_0xd511('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 0f28311..ac0993b 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 _0xd825=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd825,0x8f));var _0x5d82=function(_0x3608d0,_0x5d0852){_0x3608d0=_0x3608d0-0x0;var _0x1b3cd8=_0xd825[_0x3608d0];return _0x1b3cd8;};'use strict';var _=require(_0x5d82('0x0'));var util=require(_0x5d82('0x1'));var moment=require('moment');var BPromise=require(_0x5d82('0x2'));var rs=require(_0x5d82('0x3'));var fs=require('fs');var Redis=require(_0x5d82('0x4'));var db=require(_0x5d82('0x5'))['db'];var utils=require(_0x5d82('0x6'));var logger=require(_0x5d82('0x7'))(_0x5d82('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d82('0x9'));var client=jayson[_0x5d82('0xa')][_0x5d82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5dfc,_0x53b0dc,_0x214fdc){return new BPromise(function(_0x119e1d,_0x176a80){return client['request'](_0x5b5dfc,_0x214fdc)[_0x5d82('0xc')](function(_0x520bc9){logger[_0x5d82('0xd')](_0x5d82('0xe'),_0x53b0dc,'request\x20sent');logger['debug'](_0x5d82('0xf'),_0x53b0dc,_0x5d82('0x10'),JSON['stringify'](_0x520bc9));if(_0x520bc9[_0x5d82('0x11')]){if(_0x520bc9[_0x5d82('0x11')]['code']===0x1f4){logger['error'](_0x5d82('0xe'),_0x53b0dc,_0x520bc9['error'][_0x5d82('0x12')]);return _0x176a80(_0x520bc9[_0x5d82('0x11')][_0x5d82('0x12')]);}logger[_0x5d82('0x11')](_0x5d82('0xe'),_0x53b0dc,_0x520bc9['error'][_0x5d82('0x12')]);return _0x119e1d(_0x520bc9[_0x5d82('0x11')][_0x5d82('0x12')]);}else{logger[_0x5d82('0xd')](_0x5d82('0xe'),_0x53b0dc,_0x5d82('0x10'));_0x119e1d(_0x520bc9[_0x5d82('0x13')][_0x5d82('0x12')]);}})['catch'](function(_0x1e1d7f){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x53b0dc,_0x1e1d7f);_0x176a80(_0x1e1d7f);});});} \ No newline at end of file +var _0x8ee6=['code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error'];(function(_0x5d96fb,_0x3e4f9f){var _0x16a820=function(_0x5e31e4){while(--_0x5e31e4){_0x5d96fb['push'](_0x5d96fb['shift']());}};_0x16a820(++_0x3e4f9f);}(_0x8ee6,0x101));var _0x68ee=function(_0x11adb0,_0x48a6f9){_0x11adb0=_0x11adb0-0x0;var _0x7b8422=_0x8ee6[_0x11adb0];return _0x7b8422;};'use strict';var _=require(_0x68ee('0x0'));var util=require('util');var moment=require(_0x68ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x68ee('0x2'));var fs=require('fs');var Redis=require(_0x68ee('0x3'));var db=require(_0x68ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ee('0x5'))(_0x68ee('0x6'));var config=require(_0x68ee('0x7'));var jayson=require(_0x68ee('0x8'));var client=jayson[_0x68ee('0x9')][_0x68ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x228f70,_0x1bf6b2,_0x366773){return new BPromise(function(_0x5020a0,_0x551cf3){return client[_0x68ee('0xb')](_0x228f70,_0x366773)[_0x68ee('0xc')](function(_0x397856){logger[_0x68ee('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1bf6b2,_0x68ee('0xe'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1bf6b2,_0x68ee('0xe'),JSON['stringify'](_0x397856));if(_0x397856[_0x68ee('0xf')]){if(_0x397856[_0x68ee('0xf')][_0x68ee('0x10')]===0x1f4){logger[_0x68ee('0xf')](_0x68ee('0x11'),_0x1bf6b2,_0x397856[_0x68ee('0xf')][_0x68ee('0x12')]);return _0x551cf3(_0x397856['error'][_0x68ee('0x12')]);}logger[_0x68ee('0xf')](_0x68ee('0x11'),_0x1bf6b2,_0x397856[_0x68ee('0xf')][_0x68ee('0x12')]);return _0x5020a0(_0x397856[_0x68ee('0xf')]['message']);}else{logger['info'](_0x68ee('0x11'),_0x1bf6b2,_0x68ee('0xe'));_0x5020a0(_0x397856[_0x68ee('0x13')][_0x68ee('0x12')]);}})[_0x68ee('0x14')](function(_0x32eeb4){logger[_0x68ee('0xf')](_0x68ee('0x11'),_0x1bf6b2,_0x32eeb4);_0x551cf3(_0x32eeb4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d71649b..86cece8 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 _0xfb7b=['create','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb7b,0x10d));var _0xbfb7=function(_0x3799b6,_0x1c2939){_0x3799b6=_0x3799b6-0x0;var _0xa17589=_0xfb7b[_0x3799b6];return _0xa17589;};'use strict';var multer=require(_0xbfb7('0x0'));var util=require('util');var path=require(_0xbfb7('0x1'));var timeout=require(_0xbfb7('0x2'));var express=require('express');var router=express[_0xbfb7('0x3')]();var fs_extra=require(_0xbfb7('0x4'));var auth=require(_0xbfb7('0x5'));var interaction=require(_0xbfb7('0x6'));var config=require('../../config/environment');var controller=require(_0xbfb7('0x7'));router[_0xbfb7('0x8')]('/',auth[_0xbfb7('0x9')](),controller['index']);router[_0xbfb7('0x8')]('/:id',auth[_0xbfb7('0x9')](),controller[_0xbfb7('0xa')]);router[_0xbfb7('0x8')](_0xbfb7('0xb'),auth[_0xbfb7('0x9')](),controller[_0xbfb7('0xc')]);router[_0xbfb7('0x8')]('/:id/answers',auth[_0xbfb7('0x9')](),controller[_0xbfb7('0xd')]);router[_0xbfb7('0x8')](_0xbfb7('0xe'),auth[_0xbfb7('0x9')](),timeout(_0xbfb7('0xf')),controller['getSummary']);router[_0xbfb7('0x10')]('/',auth[_0xbfb7('0x9')](),controller[_0xbfb7('0x11')]);router[_0xbfb7('0x10')](_0xbfb7('0x12'),auth['isAuthenticated'](),controller[_0xbfb7('0x13')]);router[_0xbfb7('0x14')](_0xbfb7('0x15'),auth['isAuthenticated'](),controller[_0xbfb7('0x16')]);router[_0xbfb7('0x17')](_0xbfb7('0x15'),auth[_0xbfb7('0x9')](),controller[_0xbfb7('0x18')]);module[_0xbfb7('0x19')]=router; \ No newline at end of file +var _0xbd9b=['multer','util','path','connect-timeout','express','Router','../../config/environment','index','/:id','isAuthenticated','show','get','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','create','post','/:id/clone','update','delete','destroy','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xbd9b,0x180));var _0xbbd9=function(_0x4cdfd4,_0x3dec7c){_0x4cdfd4=_0x4cdfd4-0x0;var _0x49845a=_0xbd9b[_0x4cdfd4];return _0x49845a;};'use strict';var multer=require(_0xbbd9('0x0'));var util=require(_0xbbd9('0x1'));var path=require(_0xbbd9('0x2'));var timeout=require(_0xbbd9('0x3'));var express=require(_0xbbd9('0x4'));var router=express[_0xbbd9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbbd9('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbbd9('0x7')]);router['get'](_0xbbd9('0x8'),auth[_0xbbd9('0x9')](),controller[_0xbbd9('0xa')]);router[_0xbbd9('0xb')](_0xbbd9('0xc'),auth['isAuthenticated'](),controller[_0xbbd9('0xd')]);router[_0xbbd9('0xb')](_0xbbd9('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xbbd9('0xb')](_0xbbd9('0xf'),auth[_0xbbd9('0x9')](),timeout(_0xbbd9('0x10')),controller['getSummary']);router['post']('/',auth[_0xbbd9('0x9')](),controller[_0xbbd9('0x11')]);router[_0xbbd9('0x12')](_0xbbd9('0x13'),auth['isAuthenticated'](),controller['clone']);router['put']('/:id',auth[_0xbbd9('0x9')](),controller[_0xbbd9('0x14')]);router[_0xbbd9('0x15')]('/:id',auth[_0xbbd9('0x9')](),controller[_0xbbd9('0x16')]);module[_0xbbd9('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 326f5cd..5e664d9 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 _0x25d7=['TEXT','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports','STRING','name'];(function(_0xd26500,_0xfa64ae){var _0x16cdba=function(_0x398c67){while(--_0x398c67){_0xd26500['push'](_0xd26500['shift']());}};_0x16cdba(++_0xfa64ae);}(_0x25d7,0x191));var _0x725d=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x25d7[_0x3b3a82];return _0x267063;};'use strict';var Sequelize=require(_0x725d('0x0'));var _=require('lodash');var util=require(_0x725d('0x1'));module[_0x725d('0x2')]={'name':{'type':Sequelize[_0x725d('0x3')],'unique':_0x725d('0x4')},'description':{'type':Sequelize[_0x725d('0x3')]},'formData':{'type':Sequelize[_0x725d('0x5')](_0x725d('0x6')),'set':function(_0x442622){if(_['isObjectLike'](_0x442622)){this[_0x725d('0x7')](_0x725d('0x8'),JSON[_0x725d('0x9')](_0x442622));}else if(_['isString'](_0x442622)){this[_0x725d('0x7')](_0x725d('0x8'),_0x442622);}else{this[_0x725d('0x7')](_0x725d('0x8'),util[_0x725d('0xa')](_0x725d('0xb'),this['getDataValue'](_0x725d('0x4'))||'',this[_0x725d('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x725d('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x00af=['setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','STRING','name','long','isObjectLike'];(function(_0x2f38ba,_0x22b8a7){var _0x58e237=function(_0x2f71b4){while(--_0x2f71b4){_0x2f38ba['push'](_0x2f38ba['shift']());}};_0x58e237(++_0x22b8a7);}(_0x00af,0x9f));var _0xf00a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00af[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xf00a('0x0'));var _=require('lodash');var util=require(_0xf00a('0x1'));module['exports']={'name':{'type':Sequelize[_0xf00a('0x2')],'unique':_0xf00a('0x3')},'description':{'type':Sequelize[_0xf00a('0x2')]},'formData':{'type':Sequelize['TEXT'](_0xf00a('0x4')),'set':function(_0x5aa26d){if(_[_0xf00a('0x5')](_0x5aa26d)){this[_0xf00a('0x6')](_0xf00a('0x7'),JSON[_0xf00a('0x8')](_0x5aa26d));}else if(_[_0xf00a('0x9')](_0x5aa26d)){this[_0xf00a('0x6')](_0xf00a('0x7'),_0x5aa26d);}else{this['setDataValue'](_0xf00a('0x7'),util[_0xf00a('0xa')](_0xf00a('0xb'),this['getDataValue'](_0xf00a('0x3'))||'',this[_0xf00a('0xc')](_0xf00a('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf00a('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf00a('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 33d6af8..f0a1ea6 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 _0x6f75=['moment','bluebird','util','path','sox','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','map','fieldName','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','JscriptyProject','findAll','rows','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','clone','fields','omit','createdAt','updatedAt','body','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','rawAttributes','ProjectId','JscriptySessionReport','getAnswers','nolimit','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','starttime','format','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5e1fa4,_0x20eacd){var _0x279484=function(_0x2108aa){while(--_0x2108aa){_0x5e1fa4['push'](_0x5e1fa4['shift']());}};_0x279484(++_0x20eacd);}(_0x6f75,0x71));var _0x56f7=function(_0x5ec3e2,_0x5307fe){_0x5ec3e2=_0x5ec3e2-0x0;var _0x4c2f0e=_0x6f75[_0x5ec3e2];return _0x4c2f0e;};'use strict';var emlformat=require(_0x56f7('0x0'));var rimraf=require(_0x56f7('0x1'));var zipdir=require(_0x56f7('0x2'));var jsonpatch=require(_0x56f7('0x3'));var rp=require(_0x56f7('0x4'));var moment=require(_0x56f7('0x5'));var BPromise=require(_0x56f7('0x6'));var Mustache=require('mustache');var util=require(_0x56f7('0x7'));var path=require(_0x56f7('0x8'));var sox=require(_0x56f7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56f7('0xa'));var squel=require(_0x56f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x56f7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x56f7('0xd'));var Papa=require(_0x56f7('0xe'));var Redis=require(_0x56f7('0xf'));var authService=require(_0x56f7('0x10'));var qs=require(_0x56f7('0x11'));var as=require(_0x56f7('0x12'));var hardwareService=require(_0x56f7('0x13'));var logger=require(_0x56f7('0x14'))(_0x56f7('0x15'));var utils=require(_0x56f7('0x16'));var config=require(_0x56f7('0x17'));var licenseUtil=require(_0x56f7('0x18'));var db=require(_0x56f7('0x19'))['db'];function respondWithStatusCode(_0x14f1f9,_0x574007){_0x574007=_0x574007||0xcc;return function(_0x133eb9){if(_0x133eb9){return _0x14f1f9[_0x56f7('0x1a')](_0x574007);}return _0x14f1f9[_0x56f7('0x1b')](_0x574007)[_0x56f7('0x1c')]();};}function respondWithResult(_0x24ba13,_0x2940e4){_0x2940e4=_0x2940e4||0xc8;return function(_0x1616d9){if(_0x1616d9){return _0x24ba13[_0x56f7('0x1b')](_0x2940e4)[_0x56f7('0x1d')](_0x1616d9);}};}function respondWithFilteredResult(_0x519336,_0x53878e){return function(_0x1ecd09){if(_0x1ecd09){var _0x26c83a=typeof _0x53878e[_0x56f7('0x1e')]===_0x56f7('0x1f')&&typeof _0x53878e[_0x56f7('0x20')]===_0x56f7('0x1f');var _0x5c26ff=_0x1ecd09[_0x56f7('0x21')];var _0x789c67=_0x26c83a?0x0:_0x53878e['offset'];var _0x5af8cf=_0x26c83a?_0x1ecd09[_0x56f7('0x21')]:_0x53878e[_0x56f7('0x1e')]+_0x53878e['limit'];var _0x103306;if(_0x5af8cf>=_0x5c26ff){_0x5af8cf=_0x5c26ff;_0x103306=0xc8;}else{_0x103306=0xce;}_0x519336[_0x56f7('0x1b')](_0x103306);return _0x519336[_0x56f7('0x22')]('Content-Range',_0x789c67+'-'+_0x5af8cf+'/'+_0x5c26ff)['json'](_0x1ecd09);}return null;};}function patchUpdates(_0x5cf936){return function(_0x17ec96){try{jsonpatch[_0x56f7('0x23')](_0x17ec96,_0x5cf936,!![]);}catch(_0x19e132){return BPromise[_0x56f7('0x24')](_0x19e132);}return _0x17ec96[_0x56f7('0x25')]();};}function saveUpdates(_0x474196,_0x4ea835){return function(_0x4a9fed){if(_0x4a9fed){return _0x4a9fed[_0x56f7('0x26')](_0x474196)[_0x56f7('0x27')](function(_0x258f08){return _0x258f08;});}return null;};}function removeEntity(_0x4b2f7f,_0x1cfaca){return function(_0x675b5a){if(_0x675b5a){return _0x675b5a[_0x56f7('0x28')]()[_0x56f7('0x27')](function(){var _0x3e06b4=_0x675b5a[_0x56f7('0x29')]({'plain':!![]});var _0x2209d9=_0x56f7('0x2a');return db[_0x56f7('0x2b')][_0x56f7('0x28')]({'where':{'type':_0x2209d9,'resourceId':_0x3e06b4['id']}})[_0x56f7('0x27')](function(){return _0x675b5a;});})['then'](function(){_0x4b2f7f[_0x56f7('0x1b')](0xcc)[_0x56f7('0x1c')]();});}};}function handleEntityNotFound(_0x584590,_0xc27563){return function(_0xfec74c){if(!_0xfec74c){_0x584590[_0x56f7('0x1a')](0x194);}return _0xfec74c;};}function handleError(_0x3b12c3,_0x345684){_0x345684=_0x345684||0x1f4;return function(_0x1712fb){logger[_0x56f7('0x2c')](_0x1712fb[_0x56f7('0x2d')]);if(_0x1712fb['name']){delete _0x1712fb[_0x56f7('0x2e')];}_0x3b12c3[_0x56f7('0x1b')](_0x345684)['send'](_0x1712fb);};}exports['index']=function(_0x47699e,_0x2eb0ce){var _0x4c985b={},_0x219a2b={},_0x1bd0c2={'count':0x0,'rows':[]};var _0x38fbe7=_[_0x56f7('0x2f')](db['JscriptyProject']['rawAttributes'],function(_0x5acd7b){return{'name':_0x5acd7b[_0x56f7('0x30')],'type':_0x5acd7b['type']['key']};});_0x219a2b['model']=_[_0x56f7('0x2f')](_0x38fbe7,_0x56f7('0x2e'));_0x219a2b[_0x56f7('0x31')]=_[_0x56f7('0x32')](_0x47699e['query']);_0x219a2b[_0x56f7('0x33')]=_[_0x56f7('0x34')](_0x219a2b[_0x56f7('0x35')],_0x219a2b[_0x56f7('0x31')]);_0x4c985b[_0x56f7('0x36')]=_['intersection'](_0x219a2b[_0x56f7('0x35')],qs['fields'](_0x47699e[_0x56f7('0x31')]['fields']));_0x4c985b['attributes']=_0x4c985b[_0x56f7('0x36')][_0x56f7('0x37')]?_0x4c985b[_0x56f7('0x36')]:_0x219a2b[_0x56f7('0x35')];if(!_0x47699e[_0x56f7('0x31')][_0x56f7('0x38')]('nolimit')){_0x4c985b[_0x56f7('0x20')]=qs[_0x56f7('0x20')](_0x47699e['query']['limit']);_0x4c985b[_0x56f7('0x1e')]=qs[_0x56f7('0x1e')](_0x47699e[_0x56f7('0x31')]['offset']);}_0x4c985b[_0x56f7('0x39')]=qs[_0x56f7('0x3a')](_0x47699e[_0x56f7('0x31')][_0x56f7('0x3a')]);_0x4c985b['where']=qs[_0x56f7('0x33')](_[_0x56f7('0x3b')](_0x47699e[_0x56f7('0x31')],_0x219a2b[_0x56f7('0x33')]),_0x38fbe7);if(_0x47699e[_0x56f7('0x31')][_0x56f7('0x3c')]){_0x4c985b['where']=_[_0x56f7('0x3d')](_0x4c985b[_0x56f7('0x3e')],{'$or':_[_0x56f7('0x2f')](_0x38fbe7,function(_0x25983b){if(_0x25983b['type']!==_0x56f7('0x3f')){var _0x477996={};_0x477996[_0x25983b[_0x56f7('0x2e')]]={'$like':'%'+_0x47699e['query']['filter']+'%'};return _0x477996;}})});}_0x4c985b=_['merge']({},_0x4c985b,_0x47699e[_0x56f7('0x40')]);var _0x243d8f={'where':_0x4c985b['where']};return db['JscriptyProject'][_0x56f7('0x21')](_0x243d8f)[_0x56f7('0x27')](function(_0x6d8054){_0x1bd0c2['count']=_0x6d8054;if(_0x47699e['query'][_0x56f7('0x41')]){_0x4c985b['include']=[{'all':!![]}];}return db[_0x56f7('0x42')][_0x56f7('0x43')](_0x4c985b);})[_0x56f7('0x27')](function(_0x4e8e56){_0x1bd0c2[_0x56f7('0x44')]=_0x4e8e56;return _0x1bd0c2;})[_0x56f7('0x27')](respondWithFilteredResult(_0x2eb0ce,_0x4c985b))[_0x56f7('0x45')](handleError(_0x2eb0ce,null));};exports[_0x56f7('0x46')]=function(_0x2d285e,_0x2893fd){var _0x4a932a={'raw':![],'where':{'id':_0x2d285e[_0x56f7('0x47')]['id']}},_0x3d2c61={};_0x3d2c61[_0x56f7('0x35')]=_['keys'](db[_0x56f7('0x42')]['rawAttributes']);_0x3d2c61[_0x56f7('0x31')]=_[_0x56f7('0x32')](_0x2d285e['query']);_0x3d2c61[_0x56f7('0x33')]=_[_0x56f7('0x34')](_0x3d2c61[_0x56f7('0x35')],_0x3d2c61[_0x56f7('0x31')]);_0x4a932a[_0x56f7('0x36')]=_['intersection'](_0x3d2c61[_0x56f7('0x35')],qs['fields'](_0x2d285e[_0x56f7('0x31')]['fields']));_0x4a932a[_0x56f7('0x36')]=_0x4a932a['attributes'][_0x56f7('0x37')]?_0x4a932a[_0x56f7('0x36')]:_0x3d2c61[_0x56f7('0x35')];if(_0x2d285e['query']['includeAll']){_0x4a932a[_0x56f7('0x48')]=[{'all':!![]}];}_0x4a932a=_[_0x56f7('0x3d')]({},_0x4a932a,_0x2d285e['options']);return db[_0x56f7('0x42')]['find'](_0x4a932a)[_0x56f7('0x27')](handleEntityNotFound(_0x2893fd,null))['then'](respondWithResult(_0x2893fd,null))['catch'](handleError(_0x2893fd,null));};exports[_0x56f7('0x49')]=function(_0x119337,_0x4bd9d3){return db[_0x56f7('0x42')][_0x56f7('0x49')](_0x119337['body'],{})[_0x56f7('0x27')](function(_0x5603c4){var _0x214a49=_0x119337[_0x56f7('0x4a')][_0x56f7('0x29')]({'plain':!![]});if(!_0x214a49)throw new Error(_0x56f7('0x4b'));if(_0x214a49[_0x56f7('0x4c')]==='user'){var _0x5dbdb7=_0x5603c4[_0x56f7('0x29')]({'plain':!![]});var _0x3cd29b='Projects';return db[_0x56f7('0x4d')][_0x56f7('0x4e')]({'where':{'name':_0x3cd29b,'userProfileId':_0x214a49['userProfileId']},'raw':!![]})[_0x56f7('0x27')](function(_0xef688f){if(_0xef688f&&_0xef688f[_0x56f7('0x4f')]===0x0){return db['UserProfileResource'][_0x56f7('0x49')]({'name':_0x5dbdb7[_0x56f7('0x2e')],'resourceId':_0x5dbdb7['id'],'type':_0xef688f[_0x56f7('0x2e')],'sectionId':_0xef688f['id']},{})[_0x56f7('0x27')](function(){return _0x5603c4;});}else{return _0x5603c4;}})['catch'](function(_0x4a8a65){logger[_0x56f7('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a8a65);throw _0x4a8a65;});}return _0x5603c4;})['then'](respondWithResult(_0x4bd9d3,0xc9))[_0x56f7('0x45')](handleError(_0x4bd9d3,null));};exports[_0x56f7('0x50')]=function(_0x5e65fe,_0x4fcf26){var _0x324fd4={'where':{'id':_0x5e65fe[_0x56f7('0x47')]['id']}},_0x11cb0f={};_0x11cb0f[_0x56f7('0x35')]=_[_0x56f7('0x32')](db[_0x56f7('0x42')]['rawAttributes']);_0x324fd4['attributes']=_[_0x56f7('0x34')](_0x11cb0f[_0x56f7('0x35')],qs[_0x56f7('0x51')](_0x5e65fe[_0x56f7('0x31')][_0x56f7('0x51')]));_0x324fd4[_0x56f7('0x36')]=_0x324fd4[_0x56f7('0x36')]['length']?_0x324fd4[_0x56f7('0x36')]:_0x11cb0f[_0x56f7('0x35')];if(_0x5e65fe[_0x56f7('0x31')][_0x56f7('0x41')]){_0x324fd4[_0x56f7('0x48')]=[{'all':!![]}];}_0x324fd4=_[_0x56f7('0x3d')]({},_0x324fd4,_0x5e65fe['options']);return db['JscriptyProject'][_0x56f7('0x4e')](_0x324fd4)[_0x56f7('0x27')](handleEntityNotFound(_0x4fcf26,null))['then'](function(_0x154995){if(_0x154995){var _0x5ab0e0=_0x154995['get']({'plain':!![]});_0x5ab0e0=qs[_0x56f7('0x52')](_0x5ab0e0,['id',_0x56f7('0x53'),_0x56f7('0x54')]);_0x5e65fe[_0x56f7('0x55')]=_[_0x56f7('0x52')](_0x5e65fe[_0x56f7('0x55')],['id',_0x56f7('0x53'),_0x56f7('0x54')]);return db['JscriptyProject'][_0x56f7('0x49')](_[_0x56f7('0x3d')](_0x5ab0e0,_0x5e65fe[_0x56f7('0x55')]),{'include':_0x5e65fe['query'][_0x56f7('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x435fbb){var _0x478e08=_0x5e65fe[_0x56f7('0x4a')][_0x56f7('0x29')]({'plain':!![]});if(!_0x478e08)throw new Error(_0x56f7('0x4b'));if(_0x478e08[_0x56f7('0x4c')]==='user'){var _0x3c7139=_0x435fbb[_0x56f7('0x29')]({'plain':!![]});var _0x37da8b='Projects';return db[_0x56f7('0x4d')][_0x56f7('0x4e')]({'where':{'name':_0x37da8b,'userProfileId':_0x478e08[_0x56f7('0x56')]},'raw':!![]})[_0x56f7('0x27')](function(_0x5b2f71){if(_0x5b2f71&&_0x5b2f71[_0x56f7('0x4f')]===0x0){return db[_0x56f7('0x2b')][_0x56f7('0x49')]({'name':_0x3c7139[_0x56f7('0x2e')],'resourceId':_0x3c7139['id'],'type':_0x5b2f71[_0x56f7('0x2e')],'sectionId':_0x5b2f71['id']},{})[_0x56f7('0x27')](function(){return _0x435fbb;});}else{return _0x435fbb;}})[_0x56f7('0x45')](function(_0x5ab70f){logger[_0x56f7('0x2c')](_0x56f7('0x57'),_0x5ab70f);throw _0x5ab70f;});}return _0x435fbb;});}})[_0x56f7('0x27')](respondWithResult(_0x4fcf26,0xc9))['catch'](handleError(_0x4fcf26,null));};exports[_0x56f7('0x26')]=function(_0x3ca56d,_0x134aac){if(_0x3ca56d[_0x56f7('0x55')]['id']){delete _0x3ca56d[_0x56f7('0x55')]['id'];}return db[_0x56f7('0x42')][_0x56f7('0x4e')]({'where':{'id':_0x3ca56d[_0x56f7('0x47')]['id']}})[_0x56f7('0x27')](handleEntityNotFound(_0x134aac,null))[_0x56f7('0x27')](saveUpdates(_0x3ca56d['body'],null))[_0x56f7('0x27')](respondWithResult(_0x134aac,null))[_0x56f7('0x45')](handleError(_0x134aac,null));};exports[_0x56f7('0x28')]=function(_0x3095ef,_0x5498af){return db[_0x56f7('0x42')][_0x56f7('0x4e')]({'where':{'id':_0x3095ef[_0x56f7('0x47')]['id']}})[_0x56f7('0x27')](handleEntityNotFound(_0x5498af,null))[_0x56f7('0x27')](removeEntity(_0x5498af,null))['catch'](handleError(_0x5498af,null));};exports[_0x56f7('0x58')]=function(_0x2a3e9c,_0x5b0abf,_0x330973){var _0x3d6e23={'raw':!![],'where':{}};var _0x223a1b={};var _0x662758={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x56f7('0x59')]({'where':{'id':_0x2a3e9c[_0x56f7('0x47')]['id']}})[_0x56f7('0x27')](handleEntityNotFound(_0x5b0abf,null))['then'](function(_0x525041){if(_0x525041){_0x223a1b[_0x56f7('0x35')]=_[_0x56f7('0x32')](db['JscriptySessionReport'][_0x56f7('0x5a')]);_0x223a1b[_0x56f7('0x31')]=_[_0x56f7('0x32')](_0x2a3e9c[_0x56f7('0x31')]);_0x223a1b[_0x56f7('0x33')]=_[_0x56f7('0x34')](_0x223a1b[_0x56f7('0x35')],_0x223a1b[_0x56f7('0x31')]);_0x3d6e23['attributes']=_[_0x56f7('0x34')](_0x223a1b[_0x56f7('0x35')],qs['fields'](_0x2a3e9c['query'][_0x56f7('0x51')]));_0x3d6e23[_0x56f7('0x36')]=_0x3d6e23[_0x56f7('0x36')]['length']?_0x3d6e23['attributes']:_0x223a1b[_0x56f7('0x35')];if(!_0x2a3e9c[_0x56f7('0x31')]['hasOwnProperty']('nolimit')){_0x3d6e23['limit']=qs[_0x56f7('0x20')](_0x2a3e9c[_0x56f7('0x31')][_0x56f7('0x20')]);_0x3d6e23[_0x56f7('0x1e')]=qs['offset'](_0x2a3e9c[_0x56f7('0x31')][_0x56f7('0x1e')]);}_0x3d6e23[_0x56f7('0x39')]=qs['sort'](_0x2a3e9c[_0x56f7('0x31')][_0x56f7('0x3a')]);_0x3d6e23[_0x56f7('0x3e')]=qs[_0x56f7('0x33')](_[_0x56f7('0x3b')](_0x2a3e9c[_0x56f7('0x31')],_0x223a1b[_0x56f7('0x33')]));_0x3d6e23[_0x56f7('0x3e')][_0x56f7('0x5b')]=_0x525041['id'];if(_0x2a3e9c['query'][_0x56f7('0x3c')]){_0x3d6e23[_0x56f7('0x3e')]=_['merge'](_0x3d6e23['where'],{'$or':_[_0x56f7('0x2f')](_0x3d6e23['attributes'],function(_0x1cc2d0){var _0x24cbe8={};_0x24cbe8[_0x1cc2d0]={'$like':'%'+_0x2a3e9c[_0x56f7('0x31')]['filter']+'%'};return _0x24cbe8;})});}_0x3d6e23=_[_0x56f7('0x3d')]({},_0x3d6e23,_0x2a3e9c[_0x56f7('0x40')]);return db[_0x56f7('0x5c')]['count']({'where':_0x3d6e23[_0x56f7('0x3e')]})[_0x56f7('0x27')](function(_0x55dec5){_0x662758[_0x56f7('0x21')]=_0x55dec5;if(_0x2a3e9c['query']['includeAll']){_0x3d6e23[_0x56f7('0x48')]=[{'all':!![]}];}return db[_0x56f7('0x5c')][_0x56f7('0x43')](_0x3d6e23);})[_0x56f7('0x27')](function(_0x2dd3c6){_0x662758['rows']=_0x2dd3c6;return _0x662758;});}})[_0x56f7('0x27')](respondWithFilteredResult(_0x5b0abf,_0x3d6e23))[_0x56f7('0x45')](handleError(_0x5b0abf,null));};exports[_0x56f7('0x5d')]=function(_0x468048,_0x55409d,_0x47d5e0){var _0x1c839a={'raw':!![],'where':{}};var _0xf7b5c5={};var _0x4819aa={'count':0x0,'rows':[]};return db[_0x56f7('0x42')][_0x56f7('0x59')]({'where':{'id':_0x468048[_0x56f7('0x47')]['id']}})[_0x56f7('0x27')](handleEntityNotFound(_0x55409d,null))[_0x56f7('0x27')](function(_0x179f91){if(_0x179f91){_0xf7b5c5['model']=_[_0x56f7('0x32')](db['JscriptyAnswerReport'][_0x56f7('0x5a')]);_0xf7b5c5[_0x56f7('0x31')]=_[_0x56f7('0x32')](_0x468048[_0x56f7('0x31')]);_0xf7b5c5[_0x56f7('0x33')]=_['intersection'](_0xf7b5c5[_0x56f7('0x35')],_0xf7b5c5[_0x56f7('0x31')]);_0x1c839a[_0x56f7('0x36')]=_[_0x56f7('0x34')](_0xf7b5c5[_0x56f7('0x35')],qs[_0x56f7('0x51')](_0x468048[_0x56f7('0x31')][_0x56f7('0x51')]));_0x1c839a['attributes']=_0x1c839a[_0x56f7('0x36')]['length']?_0x1c839a[_0x56f7('0x36')]:_0xf7b5c5['model'];if(!_0x468048[_0x56f7('0x31')][_0x56f7('0x38')](_0x56f7('0x5e'))){_0x1c839a[_0x56f7('0x20')]=qs[_0x56f7('0x20')](_0x468048['query'][_0x56f7('0x20')]);_0x1c839a[_0x56f7('0x1e')]=qs[_0x56f7('0x1e')](_0x468048[_0x56f7('0x31')]['offset']);}_0x1c839a[_0x56f7('0x39')]=qs[_0x56f7('0x3a')](_0x468048['query'][_0x56f7('0x3a')]);_0x1c839a[_0x56f7('0x3e')]=qs[_0x56f7('0x33')](_[_0x56f7('0x3b')](_0x468048['query'],_0xf7b5c5[_0x56f7('0x33')]));_0x1c839a['where'][_0x56f7('0x5b')]=_0x179f91['id'];if(_0x468048[_0x56f7('0x31')][_0x56f7('0x3c')]){_0x1c839a['where']=_[_0x56f7('0x3d')](_0x1c839a[_0x56f7('0x3e')],{'$or':_['map'](_0x1c839a[_0x56f7('0x36')],function(_0xda9656){var _0x2c2a96={};_0x2c2a96[_0xda9656]={'$like':'%'+_0x468048[_0x56f7('0x31')][_0x56f7('0x3c')]+'%'};return _0x2c2a96;})});}_0x1c839a=_[_0x56f7('0x3d')]({},_0x1c839a,_0x468048[_0x56f7('0x40')]);return db[_0x56f7('0x5f')][_0x56f7('0x21')]({'where':_0x1c839a['where']})[_0x56f7('0x27')](function(_0xa02b87){_0x4819aa[_0x56f7('0x21')]=_0xa02b87;if(_0x468048[_0x56f7('0x31')][_0x56f7('0x41')]){_0x1c839a[_0x56f7('0x48')]=[{'all':!![]}];}return db[_0x56f7('0x5f')][_0x56f7('0x43')](_0x1c839a);})['then'](function(_0xb1de49){_0x4819aa['rows']=_0xb1de49;return _0x4819aa;});}})[_0x56f7('0x27')](respondWithFilteredResult(_0x55409d,_0x1c839a))[_0x56f7('0x45')](handleError(_0x55409d,null));};function char(_0x4118fb){return _0x56f7('0x60')===typeof _0x4118fb?String[_0x56f7('0x61')][_0x56f7('0x23')](null,arguments):_0x4118fb;}function needsEncapsulation(_0x7bb24a){return!!_0x7bb24a&&(_0x7bb24a[_0x56f7('0x62')]()['indexOf'](char(0xd))>=0x0||_0x7bb24a[_0x56f7('0x62')]()[_0x56f7('0x63')](char(0xa))>=0x0||_0x7bb24a[_0x56f7('0x62')]()[_0x56f7('0x63')](char(0x2c))>=0x0||_0x7bb24a[_0x56f7('0x62')]()[_0x56f7('0x63')](char(0x22))>=0x0);}function encapsulate(_0x511392){var _0x2baf8c=char(0x22),_0x50353c='\x5c'+char(0x22),_0x10ca03=_0x511392[_0x56f7('0x62')]()['replace'](new RegExp(_0x2baf8c,'g'),_0x50353c);return _0x2baf8c+_0x10ca03+_0x2baf8c;}exports[_0x56f7('0x64')]=function(_0x4e9060,_0x217626,_0x386be4){var _0x4fc56d,_0x217bc5;var _0x27057a={'where':{'ProjectId':_0x4e9060[_0x56f7('0x47')]['id']}};if(_0x4e9060['query'][_0x56f7('0x65')]){_0x27057a['where']['starttime']=JSON[_0x56f7('0x66')](_0x4e9060[_0x56f7('0x31')][_0x56f7('0x65')]);}return db[_0x56f7('0x5c')]['findAll'](_0x27057a)[_0x56f7('0x27')](handleEntityNotFound(_0x217626,null))[_0x56f7('0x27')](function(_0x2be80e){if(_0x2be80e){_0x4fc56d=_0x2be80e;return db[_0x56f7('0x67')][_0x56f7('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x4fc56d,'id')},'ProjectId':_0x4e9060[_0x56f7('0x47')]['id']},'order':'-createdAt'});}})[_0x56f7('0x27')](handleEntityNotFound(_0x217626,null))[_0x56f7('0x27')](function(_0x5b6a0b){if(_0x5b6a0b){_0x217bc5=_0x5b6a0b;var _0x36bf50={};for(var _0x32894c=0x0,_0xade793=_0x217bc5['length'];_0x32894c<_0xade793;_0x32894c++){if(!_0x36bf50[_0x56f7('0x38')](_0x217bc5[_0x32894c][_0x56f7('0x68')])){_0x36bf50[_0x217bc5[_0x32894c][_0x56f7('0x68')]]=needsEncapsulation(_0x217bc5[_0x32894c][_0x56f7('0x69')])?encapsulate(_0x217bc5[_0x32894c][_0x56f7('0x69')]):_0x217bc5[_0x32894c][_0x56f7('0x69')];}}var _0x2557f6=[],_0x1347ce={};for(var _0x3bcf20=0x0,_0x267775=_0x4fc56d[_0x56f7('0x37')];_0x3bcf20<_0x267775;_0x3bcf20++){_0x1347ce={'ProjectId':_0x4e9060[_0x56f7('0x47')]['id'],'SessionId':_0x4fc56d[_0x3bcf20]['id'],'StartTime':moment(_0x4fc56d[_0x3bcf20][_0x56f7('0x6a')])[_0x56f7('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0xdd78f7=0x0,_0x2880c1=_0x217bc5[_0x56f7('0x37')];_0xdd78f7<_0x2880c1;_0xdd78f7++){if(_0x217bc5[_0xdd78f7][_0x56f7('0x6c')]==_0x4fc56d[_0x3bcf20]['id']&&_0x36bf50[_0x56f7('0x38')](_0x217bc5[_0xdd78f7][_0x56f7('0x68')])){_0x1347ce[_0x36bf50[_0x217bc5[_0xdd78f7][_0x56f7('0x68')]]]=_0x217bc5[_0xdd78f7][_0x56f7('0x6d')];}}for(var _0x511e24 in _0x36bf50){if(!_0x1347ce[_0x56f7('0x38')](_0x36bf50[_0x511e24])){_0x1347ce[_0x36bf50[_0x511e24]]=null;}}_0x2557f6['push'](_0x1347ce);}return _0x2557f6;}})[_0x56f7('0x27')](function(_0x3caacb){if(!_[_0x56f7('0x6e')](_0x3caacb)){var _0x13ada7=toCsv(_0x3caacb);var _0x289649=Date[_0x56f7('0x6f')]();fs[_0x56f7('0x70')](util[_0x56f7('0x6b')](_0x56f7('0x71'),_0x4e9060[_0x56f7('0x47')]['id'],_0x289649),_0x13ada7);_0x217626[_0x56f7('0x72')](_0x56f7('0x73'),'attachment;\x20filename='+util[_0x56f7('0x6b')]('Jscripty_Project_%d_Summary_%s.csv',_0x4e9060[_0x56f7('0x47')]['id'],_0x289649));_0x217626[_0x56f7('0x72')](_0x56f7('0x74'),_0x56f7('0x75'));return _0x217626['download'](util[_0x56f7('0x6b')](_0x56f7('0x71'),_0x4e9060['params']['id'],_0x289649));}else{return _0x217626[_0x56f7('0x1a')](0xcc);}})[_0x56f7('0x45')](handleError(_0x217626,null));}; \ No newline at end of file +var _0xf960=['rows','params','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','update','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','nolimit','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf960,0x193));var _0x0f96=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xf960[_0x4d35f3];return _0x382fea;};'use strict';var emlformat=require(_0x0f96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f96('0x2'));var moment=require(_0x0f96('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f96('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0f96('0x5'));var csv=require(_0x0f96('0x6'));var ejs=require(_0x0f96('0x7'));var fs=require('fs');var fs_extra=require(_0x0f96('0x8'));var _=require(_0x0f96('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f96('0xa'));var deskjs=require(_0x0f96('0xb'));var toCsv=require(_0x0f96('0x6'));var querystring=require(_0x0f96('0xc'));var Papa=require(_0x0f96('0xd'));var Redis=require(_0x0f96('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0f96('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f96('0x10'));var logger=require('../../config/logger')(_0x0f96('0x11'));var utils=require(_0x0f96('0x12'));var config=require(_0x0f96('0x13'));var licenseUtil=require(_0x0f96('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe8aee6,_0x23182a){_0x23182a=_0x23182a||0xcc;return function(_0x1c0283){if(_0x1c0283){return _0xe8aee6[_0x0f96('0x15')](_0x23182a);}return _0xe8aee6['status'](_0x23182a)[_0x0f96('0x16')]();};}function respondWithResult(_0x103185,_0x36d1ca){_0x36d1ca=_0x36d1ca||0xc8;return function(_0x386943){if(_0x386943){return _0x103185[_0x0f96('0x17')](_0x36d1ca)[_0x0f96('0x18')](_0x386943);}};}function respondWithFilteredResult(_0x5080c3,_0x232d94){return function(_0x47ba05){if(_0x47ba05){var _0x4f55cf=typeof _0x232d94[_0x0f96('0x19')]===_0x0f96('0x1a')&&typeof _0x232d94[_0x0f96('0x1b')]===_0x0f96('0x1a');var _0x3f1273=_0x47ba05[_0x0f96('0x1c')];var _0x2dc06c=_0x4f55cf?0x0:_0x232d94[_0x0f96('0x19')];var _0x36ded7=_0x4f55cf?_0x47ba05[_0x0f96('0x1c')]:_0x232d94[_0x0f96('0x19')]+_0x232d94[_0x0f96('0x1b')];var _0x173f3c;if(_0x36ded7>=_0x3f1273){_0x36ded7=_0x3f1273;_0x173f3c=0xc8;}else{_0x173f3c=0xce;}_0x5080c3[_0x0f96('0x17')](_0x173f3c);return _0x5080c3['set'](_0x0f96('0x1d'),_0x2dc06c+'-'+_0x36ded7+'/'+_0x3f1273)[_0x0f96('0x18')](_0x47ba05);}return null;};}function patchUpdates(_0x125b50){return function(_0xea96e0){try{jsonpatch['apply'](_0xea96e0,_0x125b50,!![]);}catch(_0x210a93){return BPromise[_0x0f96('0x1e')](_0x210a93);}return _0xea96e0[_0x0f96('0x1f')]();};}function saveUpdates(_0x47993c,_0x25494f){return function(_0x201226){if(_0x201226){return _0x201226['update'](_0x47993c)[_0x0f96('0x20')](function(_0x142de1){return _0x142de1;});}return null;};}function removeEntity(_0x366146,_0x21bd49){return function(_0x4b3d9f){if(_0x4b3d9f){return _0x4b3d9f[_0x0f96('0x21')]()[_0x0f96('0x20')](function(){var _0x213c30=_0x4b3d9f[_0x0f96('0x22')]({'plain':!![]});var _0x262353=_0x0f96('0x23');return db[_0x0f96('0x24')]['destroy']({'where':{'type':_0x262353,'resourceId':_0x213c30['id']}})[_0x0f96('0x20')](function(){return _0x4b3d9f;});})[_0x0f96('0x20')](function(){_0x366146[_0x0f96('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43128e,_0x25e743){return function(_0x44b861){if(!_0x44b861){_0x43128e[_0x0f96('0x15')](0x194);}return _0x44b861;};}function handleError(_0x1b05f7,_0x591c91){_0x591c91=_0x591c91||0x1f4;return function(_0x2961e1){logger[_0x0f96('0x25')](_0x2961e1[_0x0f96('0x26')]);if(_0x2961e1[_0x0f96('0x27')]){delete _0x2961e1[_0x0f96('0x27')];}_0x1b05f7[_0x0f96('0x17')](_0x591c91)[_0x0f96('0x28')](_0x2961e1);};}exports[_0x0f96('0x29')]=function(_0x1bd85b,_0x163f5f){var _0x5432e0={},_0x12b6f4={},_0x42de95={'count':0x0,'rows':[]};var _0x56bbc7=_[_0x0f96('0x2a')](db[_0x0f96('0x2b')]['rawAttributes'],function(_0x47162c){return{'name':_0x47162c[_0x0f96('0x2c')],'type':_0x47162c[_0x0f96('0x2d')][_0x0f96('0x2e')]};});_0x12b6f4[_0x0f96('0x2f')]=_[_0x0f96('0x2a')](_0x56bbc7,_0x0f96('0x27'));_0x12b6f4['query']=_['keys'](_0x1bd85b[_0x0f96('0x30')]);_0x12b6f4['filters']=_['intersection'](_0x12b6f4['model'],_0x12b6f4[_0x0f96('0x30')]);_0x5432e0[_0x0f96('0x31')]=_[_0x0f96('0x32')](_0x12b6f4['model'],qs[_0x0f96('0x33')](_0x1bd85b[_0x0f96('0x30')][_0x0f96('0x33')]));_0x5432e0[_0x0f96('0x31')]=_0x5432e0[_0x0f96('0x31')][_0x0f96('0x34')]?_0x5432e0[_0x0f96('0x31')]:_0x12b6f4[_0x0f96('0x2f')];if(!_0x1bd85b['query'][_0x0f96('0x35')]('nolimit')){_0x5432e0[_0x0f96('0x1b')]=qs[_0x0f96('0x1b')](_0x1bd85b[_0x0f96('0x30')][_0x0f96('0x1b')]);_0x5432e0[_0x0f96('0x19')]=qs[_0x0f96('0x19')](_0x1bd85b[_0x0f96('0x30')]['offset']);}_0x5432e0['order']=qs[_0x0f96('0x36')](_0x1bd85b[_0x0f96('0x30')][_0x0f96('0x36')]);_0x5432e0[_0x0f96('0x37')]=qs['filters'](_[_0x0f96('0x38')](_0x1bd85b[_0x0f96('0x30')],_0x12b6f4[_0x0f96('0x39')]),_0x56bbc7);if(_0x1bd85b[_0x0f96('0x30')][_0x0f96('0x3a')]){_0x5432e0[_0x0f96('0x37')]=_[_0x0f96('0x3b')](_0x5432e0[_0x0f96('0x37')],{'$or':_[_0x0f96('0x2a')](_0x56bbc7,function(_0x59e0a7){if(_0x59e0a7[_0x0f96('0x2d')]!==_0x0f96('0x3c')){var _0x524385={};_0x524385[_0x59e0a7[_0x0f96('0x27')]]={'$like':'%'+_0x1bd85b[_0x0f96('0x30')][_0x0f96('0x3a')]+'%'};return _0x524385;}})});}_0x5432e0=_['merge']({},_0x5432e0,_0x1bd85b[_0x0f96('0x3d')]);var _0x13d33c={'where':_0x5432e0['where']};return db[_0x0f96('0x2b')][_0x0f96('0x1c')](_0x13d33c)['then'](function(_0x24a4d9){_0x42de95['count']=_0x24a4d9;if(_0x1bd85b['query'][_0x0f96('0x3e')]){_0x5432e0[_0x0f96('0x3f')]=[{'all':!![]}];}return db[_0x0f96('0x2b')][_0x0f96('0x40')](_0x5432e0);})[_0x0f96('0x20')](function(_0x1e6b76){_0x42de95[_0x0f96('0x41')]=_0x1e6b76;return _0x42de95;})[_0x0f96('0x20')](respondWithFilteredResult(_0x163f5f,_0x5432e0))['catch'](handleError(_0x163f5f,null));};exports['show']=function(_0x273a0a,_0x5ecc6c){var _0x3c9021={'raw':![],'where':{'id':_0x273a0a[_0x0f96('0x42')]['id']}},_0x1f0718={};_0x1f0718[_0x0f96('0x2f')]=_[_0x0f96('0x43')](db[_0x0f96('0x2b')][_0x0f96('0x44')]);_0x1f0718['query']=_[_0x0f96('0x43')](_0x273a0a[_0x0f96('0x30')]);_0x1f0718[_0x0f96('0x39')]=_[_0x0f96('0x32')](_0x1f0718[_0x0f96('0x2f')],_0x1f0718[_0x0f96('0x30')]);_0x3c9021[_0x0f96('0x31')]=_[_0x0f96('0x32')](_0x1f0718[_0x0f96('0x2f')],qs[_0x0f96('0x33')](_0x273a0a[_0x0f96('0x30')][_0x0f96('0x33')]));_0x3c9021['attributes']=_0x3c9021['attributes'][_0x0f96('0x34')]?_0x3c9021[_0x0f96('0x31')]:_0x1f0718[_0x0f96('0x2f')];if(_0x273a0a['query'][_0x0f96('0x3e')]){_0x3c9021[_0x0f96('0x3f')]=[{'all':!![]}];}_0x3c9021=_[_0x0f96('0x3b')]({},_0x3c9021,_0x273a0a[_0x0f96('0x3d')]);return db[_0x0f96('0x2b')]['find'](_0x3c9021)[_0x0f96('0x20')](handleEntityNotFound(_0x5ecc6c,null))[_0x0f96('0x20')](respondWithResult(_0x5ecc6c,null))['catch'](handleError(_0x5ecc6c,null));};exports['create']=function(_0x26a29a,_0x3fce0c){return db[_0x0f96('0x2b')][_0x0f96('0x45')](_0x26a29a[_0x0f96('0x46')],{})['then'](function(_0x3a59dd){var _0x3fb81e=_0x26a29a[_0x0f96('0x47')][_0x0f96('0x22')]({'plain':!![]});if(!_0x3fb81e)throw new Error(_0x0f96('0x48'));if(_0x3fb81e[_0x0f96('0x49')]===_0x0f96('0x47')){var _0xc61a62=_0x3a59dd['get']({'plain':!![]});var _0x10ec90='Projects';return db[_0x0f96('0x4a')][_0x0f96('0x4b')]({'where':{'name':_0x10ec90,'userProfileId':_0x3fb81e[_0x0f96('0x4c')]},'raw':!![]})[_0x0f96('0x20')](function(_0x332ff2){if(_0x332ff2&&_0x332ff2['autoAssociation']===0x0){return db[_0x0f96('0x24')]['create']({'name':_0xc61a62['name'],'resourceId':_0xc61a62['id'],'type':_0x332ff2[_0x0f96('0x27')],'sectionId':_0x332ff2['id']},{})[_0x0f96('0x20')](function(){return _0x3a59dd;});}else{return _0x3a59dd;}})[_0x0f96('0x4d')](function(_0x5e307c){logger['error'](_0x0f96('0x4e'),_0x5e307c);throw _0x5e307c;});}return _0x3a59dd;})['then'](respondWithResult(_0x3fce0c,0xc9))[_0x0f96('0x4d')](handleError(_0x3fce0c,null));};exports[_0x0f96('0x4f')]=function(_0x5eb63b,_0x58f1b8){var _0x515c93={'where':{'id':_0x5eb63b[_0x0f96('0x42')]['id']}},_0x4ffb51={};_0x4ffb51[_0x0f96('0x2f')]=_[_0x0f96('0x43')](db[_0x0f96('0x2b')][_0x0f96('0x44')]);_0x515c93[_0x0f96('0x31')]=_[_0x0f96('0x32')](_0x4ffb51[_0x0f96('0x2f')],qs[_0x0f96('0x33')](_0x5eb63b['query'][_0x0f96('0x33')]));_0x515c93['attributes']=_0x515c93[_0x0f96('0x31')][_0x0f96('0x34')]?_0x515c93['attributes']:_0x4ffb51[_0x0f96('0x2f')];if(_0x5eb63b['query'][_0x0f96('0x3e')]){_0x515c93['include']=[{'all':!![]}];}_0x515c93=_[_0x0f96('0x3b')]({},_0x515c93,_0x5eb63b[_0x0f96('0x3d')]);return db[_0x0f96('0x2b')]['find'](_0x515c93)[_0x0f96('0x20')](handleEntityNotFound(_0x58f1b8,null))[_0x0f96('0x20')](function(_0x441c92){if(_0x441c92){var _0x3eebc9=_0x441c92[_0x0f96('0x22')]({'plain':!![]});_0x3eebc9=qs[_0x0f96('0x50')](_0x3eebc9,['id',_0x0f96('0x51'),'updatedAt']);_0x5eb63b[_0x0f96('0x46')]=_['omit'](_0x5eb63b[_0x0f96('0x46')],['id',_0x0f96('0x51'),_0x0f96('0x52')]);return db[_0x0f96('0x2b')]['create'](_[_0x0f96('0x3b')](_0x3eebc9,_0x5eb63b['body']),{'include':_0x5eb63b[_0x0f96('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x0f96('0x20')](function(_0x2e9333){var _0x5df686=_0x5eb63b['user'][_0x0f96('0x22')]({'plain':!![]});if(!_0x5df686)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5df686['role']==='user'){var _0x590888=_0x2e9333['get']({'plain':!![]});var _0x27a191=_0x0f96('0x23');return db[_0x0f96('0x4a')][_0x0f96('0x4b')]({'where':{'name':_0x27a191,'userProfileId':_0x5df686[_0x0f96('0x4c')]},'raw':!![]})[_0x0f96('0x20')](function(_0x240db3){if(_0x240db3&&_0x240db3[_0x0f96('0x53')]===0x0){return db['UserProfileResource'][_0x0f96('0x45')]({'name':_0x590888[_0x0f96('0x27')],'resourceId':_0x590888['id'],'type':_0x240db3[_0x0f96('0x27')],'sectionId':_0x240db3['id']},{})['then'](function(){return _0x2e9333;});}else{return _0x2e9333;}})[_0x0f96('0x4d')](function(_0x3e69ee){logger[_0x0f96('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e69ee);throw _0x3e69ee;});}return _0x2e9333;});}})[_0x0f96('0x20')](respondWithResult(_0x58f1b8,0xc9))['catch'](handleError(_0x58f1b8,null));};exports[_0x0f96('0x54')]=function(_0x3ec026,_0x4de794){if(_0x3ec026[_0x0f96('0x46')]['id']){delete _0x3ec026['body']['id'];}return db[_0x0f96('0x2b')][_0x0f96('0x4b')]({'where':{'id':_0x3ec026[_0x0f96('0x42')]['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x4de794,null))['then'](saveUpdates(_0x3ec026[_0x0f96('0x46')],null))['then'](respondWithResult(_0x4de794,null))[_0x0f96('0x4d')](handleError(_0x4de794,null));};exports[_0x0f96('0x21')]=function(_0x44ee2c,_0x4ec124){return db['JscriptyProject']['find']({'where':{'id':_0x44ee2c['params']['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x4ec124,null))[_0x0f96('0x20')](removeEntity(_0x4ec124,null))['catch'](handleError(_0x4ec124,null));};exports[_0x0f96('0x55')]=function(_0x2b83f4,_0x4e5e27,_0x201074){var _0x3ff7b5={'raw':!![],'where':{}};var _0x137c87={};var _0x5d0c55={'count':0x0,'rows':[]};return db[_0x0f96('0x2b')][_0x0f96('0x56')]({'where':{'id':_0x2b83f4['params']['id']}})['then'](handleEntityNotFound(_0x4e5e27,null))[_0x0f96('0x20')](function(_0x42a42f){if(_0x42a42f){_0x137c87[_0x0f96('0x2f')]=_[_0x0f96('0x43')](db[_0x0f96('0x57')][_0x0f96('0x44')]);_0x137c87[_0x0f96('0x30')]=_[_0x0f96('0x43')](_0x2b83f4[_0x0f96('0x30')]);_0x137c87[_0x0f96('0x39')]=_[_0x0f96('0x32')](_0x137c87[_0x0f96('0x2f')],_0x137c87[_0x0f96('0x30')]);_0x3ff7b5[_0x0f96('0x31')]=_[_0x0f96('0x32')](_0x137c87[_0x0f96('0x2f')],qs[_0x0f96('0x33')](_0x2b83f4[_0x0f96('0x30')][_0x0f96('0x33')]));_0x3ff7b5[_0x0f96('0x31')]=_0x3ff7b5[_0x0f96('0x31')][_0x0f96('0x34')]?_0x3ff7b5[_0x0f96('0x31')]:_0x137c87[_0x0f96('0x2f')];if(!_0x2b83f4[_0x0f96('0x30')][_0x0f96('0x35')]('nolimit')){_0x3ff7b5[_0x0f96('0x1b')]=qs[_0x0f96('0x1b')](_0x2b83f4[_0x0f96('0x30')][_0x0f96('0x1b')]);_0x3ff7b5[_0x0f96('0x19')]=qs[_0x0f96('0x19')](_0x2b83f4[_0x0f96('0x30')][_0x0f96('0x19')]);}_0x3ff7b5[_0x0f96('0x58')]=qs[_0x0f96('0x36')](_0x2b83f4['query'][_0x0f96('0x36')]);_0x3ff7b5[_0x0f96('0x37')]=qs[_0x0f96('0x39')](_[_0x0f96('0x38')](_0x2b83f4[_0x0f96('0x30')],_0x137c87[_0x0f96('0x39')]));_0x3ff7b5[_0x0f96('0x37')][_0x0f96('0x59')]=_0x42a42f['id'];if(_0x2b83f4[_0x0f96('0x30')]['filter']){_0x3ff7b5[_0x0f96('0x37')]=_[_0x0f96('0x3b')](_0x3ff7b5['where'],{'$or':_[_0x0f96('0x2a')](_0x3ff7b5[_0x0f96('0x31')],function(_0xbd932f){var _0x31ee52={};_0x31ee52[_0xbd932f]={'$like':'%'+_0x2b83f4[_0x0f96('0x30')][_0x0f96('0x3a')]+'%'};return _0x31ee52;})});}_0x3ff7b5=_[_0x0f96('0x3b')]({},_0x3ff7b5,_0x2b83f4['options']);return db[_0x0f96('0x57')][_0x0f96('0x1c')]({'where':_0x3ff7b5[_0x0f96('0x37')]})[_0x0f96('0x20')](function(_0x5e0286){_0x5d0c55[_0x0f96('0x1c')]=_0x5e0286;if(_0x2b83f4[_0x0f96('0x30')][_0x0f96('0x3e')]){_0x3ff7b5['include']=[{'all':!![]}];}return db[_0x0f96('0x57')][_0x0f96('0x40')](_0x3ff7b5);})['then'](function(_0x1979cb){_0x5d0c55['rows']=_0x1979cb;return _0x5d0c55;});}})[_0x0f96('0x20')](respondWithFilteredResult(_0x4e5e27,_0x3ff7b5))[_0x0f96('0x4d')](handleError(_0x4e5e27,null));};exports['getAnswers']=function(_0x5d6b89,_0x2665ea,_0x1f8d8c){var _0x1b2dac={'raw':!![],'where':{}};var _0x3eda76={};var _0x1ca9be={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0f96('0x56')]({'where':{'id':_0x5d6b89[_0x0f96('0x42')]['id']}})[_0x0f96('0x20')](handleEntityNotFound(_0x2665ea,null))[_0x0f96('0x20')](function(_0x5226e7){if(_0x5226e7){_0x3eda76[_0x0f96('0x2f')]=_[_0x0f96('0x43')](db[_0x0f96('0x5a')][_0x0f96('0x44')]);_0x3eda76[_0x0f96('0x30')]=_[_0x0f96('0x43')](_0x5d6b89[_0x0f96('0x30')]);_0x3eda76[_0x0f96('0x39')]=_['intersection'](_0x3eda76['model'],_0x3eda76[_0x0f96('0x30')]);_0x1b2dac[_0x0f96('0x31')]=_[_0x0f96('0x32')](_0x3eda76[_0x0f96('0x2f')],qs[_0x0f96('0x33')](_0x5d6b89[_0x0f96('0x30')]['fields']));_0x1b2dac[_0x0f96('0x31')]=_0x1b2dac[_0x0f96('0x31')]['length']?_0x1b2dac[_0x0f96('0x31')]:_0x3eda76[_0x0f96('0x2f')];if(!_0x5d6b89['query']['hasOwnProperty'](_0x0f96('0x5b'))){_0x1b2dac[_0x0f96('0x1b')]=qs[_0x0f96('0x1b')](_0x5d6b89[_0x0f96('0x30')][_0x0f96('0x1b')]);_0x1b2dac[_0x0f96('0x19')]=qs[_0x0f96('0x19')](_0x5d6b89[_0x0f96('0x30')][_0x0f96('0x19')]);}_0x1b2dac[_0x0f96('0x58')]=qs[_0x0f96('0x36')](_0x5d6b89[_0x0f96('0x30')][_0x0f96('0x36')]);_0x1b2dac[_0x0f96('0x37')]=qs[_0x0f96('0x39')](_[_0x0f96('0x38')](_0x5d6b89[_0x0f96('0x30')],_0x3eda76[_0x0f96('0x39')]));_0x1b2dac['where'][_0x0f96('0x59')]=_0x5226e7['id'];if(_0x5d6b89[_0x0f96('0x30')]['filter']){_0x1b2dac[_0x0f96('0x37')]=_[_0x0f96('0x3b')](_0x1b2dac[_0x0f96('0x37')],{'$or':_[_0x0f96('0x2a')](_0x1b2dac['attributes'],function(_0x45beb0){var _0x5ddd4a={};_0x5ddd4a[_0x45beb0]={'$like':'%'+_0x5d6b89[_0x0f96('0x30')][_0x0f96('0x3a')]+'%'};return _0x5ddd4a;})});}_0x1b2dac=_[_0x0f96('0x3b')]({},_0x1b2dac,_0x5d6b89['options']);return db[_0x0f96('0x5a')][_0x0f96('0x1c')]({'where':_0x1b2dac[_0x0f96('0x37')]})[_0x0f96('0x20')](function(_0x15281f){_0x1ca9be[_0x0f96('0x1c')]=_0x15281f;if(_0x5d6b89[_0x0f96('0x30')][_0x0f96('0x3e')]){_0x1b2dac['include']=[{'all':!![]}];}return db[_0x0f96('0x5a')][_0x0f96('0x40')](_0x1b2dac);})[_0x0f96('0x20')](function(_0x3a1708){_0x1ca9be['rows']=_0x3a1708;return _0x1ca9be;});}})[_0x0f96('0x20')](respondWithFilteredResult(_0x2665ea,_0x1b2dac))[_0x0f96('0x4d')](handleError(_0x2665ea,null));};function char(_0x60b60){return'number'===typeof _0x60b60?String[_0x0f96('0x5c')][_0x0f96('0x5d')](null,arguments):_0x60b60;}function needsEncapsulation(_0x403ea1){return!!_0x403ea1&&(_0x403ea1[_0x0f96('0x5e')]()[_0x0f96('0x5f')](char(0xd))>=0x0||_0x403ea1[_0x0f96('0x5e')]()[_0x0f96('0x5f')](char(0xa))>=0x0||_0x403ea1['toString']()['indexOf'](char(0x2c))>=0x0||_0x403ea1[_0x0f96('0x5e')]()[_0x0f96('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x4699fc){var _0x545039=char(0x22),_0x4b1b72='\x5c'+char(0x22),_0x493767=_0x4699fc[_0x0f96('0x5e')]()[_0x0f96('0x60')](new RegExp(_0x545039,'g'),_0x4b1b72);return _0x545039+_0x493767+_0x545039;}exports[_0x0f96('0x61')]=function(_0x307d2f,_0x4b2c3b,_0x2bb4ee){var _0x5d70cd,_0x3ae039;var _0x48ba88={'where':{'ProjectId':_0x307d2f['params']['id']}};if(_0x307d2f[_0x0f96('0x30')][_0x0f96('0x62')]){_0x48ba88[_0x0f96('0x37')][_0x0f96('0x63')]=JSON[_0x0f96('0x64')](_0x307d2f['query'][_0x0f96('0x62')]);}return db['JscriptySessionReport']['findAll'](_0x48ba88)[_0x0f96('0x20')](handleEntityNotFound(_0x4b2c3b,null))[_0x0f96('0x20')](function(_0x3b2c0f){if(_0x3b2c0f){_0x5d70cd=_0x3b2c0f;return db[_0x0f96('0x65')][_0x0f96('0x40')]({'where':{'SessionId':{'$in':_[_0x0f96('0x2a')](_0x5d70cd,'id')},'ProjectId':_0x307d2f[_0x0f96('0x42')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x4b2c3b,null))[_0x0f96('0x20')](function(_0x55e502){if(_0x55e502){_0x3ae039=_0x55e502;var _0x364203={};for(var _0x538f38=0x0,_0x32561d=_0x3ae039[_0x0f96('0x34')];_0x538f38<_0x32561d;_0x538f38++){if(!_0x364203[_0x0f96('0x35')](_0x3ae039[_0x538f38][_0x0f96('0x66')])){_0x364203[_0x3ae039[_0x538f38][_0x0f96('0x66')]]=needsEncapsulation(_0x3ae039[_0x538f38][_0x0f96('0x67')])?encapsulate(_0x3ae039[_0x538f38]['question']):_0x3ae039[_0x538f38][_0x0f96('0x67')];}}var _0x1fe817=[],_0x1feb13={};for(var _0x3e1627=0x0,_0x148c93=_0x5d70cd[_0x0f96('0x34')];_0x3e1627<_0x148c93;_0x3e1627++){_0x1feb13={'ProjectId':_0x307d2f[_0x0f96('0x42')]['id'],'SessionId':_0x5d70cd[_0x3e1627]['id'],'StartTime':moment(_0x5d70cd[_0x3e1627][_0x0f96('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x49730d=0x0,_0x31e7ce=_0x3ae039['length'];_0x49730d<_0x31e7ce;_0x49730d++){if(_0x3ae039[_0x49730d]['SessionId']==_0x5d70cd[_0x3e1627]['id']&&_0x364203['hasOwnProperty'](_0x3ae039[_0x49730d][_0x0f96('0x66')])){_0x1feb13[_0x364203[_0x3ae039[_0x49730d][_0x0f96('0x66')]]]=_0x3ae039[_0x49730d][_0x0f96('0x68')];}}for(var _0x268706 in _0x364203){if(!_0x1feb13[_0x0f96('0x35')](_0x364203[_0x268706])){_0x1feb13[_0x364203[_0x268706]]=null;}}_0x1fe817[_0x0f96('0x69')](_0x1feb13);}return _0x1fe817;}})['then'](function(_0x520669){if(!_[_0x0f96('0x6a')](_0x520669)){var _0x4fb016=toCsv(_0x520669);var _0xd06eb9=Date[_0x0f96('0x6b')]();fs[_0x0f96('0x6c')](util[_0x0f96('0x6d')](_0x0f96('0x6e'),_0x307d2f['params']['id'],_0xd06eb9),_0x4fb016);_0x4b2c3b[_0x0f96('0x6f')](_0x0f96('0x70'),'attachment;\x20filename='+util['format'](_0x0f96('0x71'),_0x307d2f['params']['id'],_0xd06eb9));_0x4b2c3b[_0x0f96('0x6f')](_0x0f96('0x72'),_0x0f96('0x73'));return _0x4b2c3b[_0x0f96('0x74')](util[_0x0f96('0x6d')](_0x0f96('0x6e'),_0x307d2f[_0x0f96('0x42')]['id'],_0xd06eb9));}else{return _0x4b2c3b[_0x0f96('0x15')](0xcc);}})['catch'](handleError(_0x4b2c3b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1e3502f..0de1396 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 _0xe8f7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x1ec836,_0x1ce2d6){var _0x4baf71=function(_0x5b640e){while(--_0x5b640e){_0x1ec836['push'](_0x1ec836['shift']());}};_0x4baf71(++_0x1ce2d6);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e8f('0x0'));var util=require('util');var logger=require(_0x7e8f('0x1'))(_0x7e8f('0x2'));var moment=require(_0x7e8f('0x3'));var BPromise=require(_0x7e8f('0x4'));var rp=require(_0x7e8f('0x5'));var fs=require('fs');var path=require(_0x7e8f('0x6'));var rimraf=require(_0x7e8f('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x7e8f('0x8')]=function(_0x26595e,_0x4c084e){return _0x26595e[_0x7e8f('0x9')](_0x7e8f('0xa'),attributes,{'tableName':_0x7e8f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a61=['JscriptyProject','jscripty_projects','lodash','../../config/logger','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define'];(function(_0x1125ef,_0x89658){var _0x5155e8=function(_0x562f5c){while(--_0x562f5c){_0x1125ef['push'](_0x1125ef['shift']());}};_0x5155e8(++_0x89658);}(_0x1a61,0x1e6));var _0x11a6=function(_0x31c290,_0x100972){_0x31c290=_0x31c290-0x0;var _0x34ef07=_0x1a61[_0x31c290];return _0x34ef07;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var logger=require(_0x11a6('0x1'))('api');var moment=require(_0x11a6('0x2'));var BPromise=require(_0x11a6('0x3'));var rp=require(_0x11a6('0x4'));var fs=require('fs');var path=require(_0x11a6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x11a6('0x6'));module[_0x11a6('0x7')]=function(_0x5b72a1,_0x41e03d){return _0x5b72a1[_0x11a6('0x8')](_0x11a6('0x9'),attributes,{'tableName':_0x11a6('0xa'),'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 2f3f917..d3a7c62 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0xda3f,0xec));var _0xfda3=function(_0xcf238f,_0x271a08){_0xcf238f=_0xcf238f-0x0;var _0x5a82f8=_0xda3f[_0xcf238f];return _0x5a82f8;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0xb6fead,_0x4c390e){var _0x4da025=function(_0x193224){while(--_0x193224){_0xb6fead['push'](_0xb6fead['shift']());}};_0x4da025(++_0x4c390e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xcb91[_0x30f5bb];return _0x1cfc00;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 89bf9c2..42bdc5c 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 _0xace1=['fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x56f086,_0x580fb8){var _0x5a80a1=function(_0x5a4bd4){while(--_0x5a4bd4){_0x56f086['push'](_0x56f086['shift']());}};_0x5a80a1(++_0x580fb8);}(_0xace1,0x18a));var _0x1ace=function(_0x5813c8,_0x150e9d){_0x5813c8=_0x5813c8-0x0;var _0x1e8d16=_0xace1[_0x5813c8];return _0x1e8d16;};'use strict';var multer=require(_0x1ace('0x0'));var util=require('util');var path=require(_0x1ace('0x1'));var timeout=require(_0x1ace('0x2'));var express=require(_0x1ace('0x3'));var router=express[_0x1ace('0x4')]();var fs_extra=require(_0x1ace('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1ace('0x6'));var config=require(_0x1ace('0x7'));var controller=require(_0x1ace('0x8'));router['get']('/',auth[_0x1ace('0x9')](),controller[_0x1ace('0xa')]);router[_0x1ace('0xb')](_0x1ace('0xc'),auth[_0x1ace('0x9')](),controller['describe']);router['get'](_0x1ace('0xd'),auth[_0x1ace('0x9')](),controller[_0x1ace('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1ace('0xf')]);router[_0x1ace('0x10')](_0x1ace('0xd'),auth[_0x1ace('0x9')](),controller[_0x1ace('0x11')]);router[_0x1ace('0x12')](_0x1ace('0xd'),auth[_0x1ace('0x9')](),controller[_0x1ace('0x13')]);module[_0x1ace('0x14')]=router; \ No newline at end of file +var _0x3a61=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index'];(function(_0x16a45b,_0x3725a3){var _0x31628a=function(_0x4148a2){while(--_0x4148a2){_0x16a45b['push'](_0x16a45b['shift']());}};_0x31628a(++_0x3725a3);}(_0x3a61,0x1a4));var _0x13a6=function(_0x45e94d,_0x1fb9d0){_0x45e94d=_0x45e94d-0x0;var _0x31209d=_0x3a61[_0x45e94d];return _0x31209d;};'use strict';var multer=require(_0x13a6('0x0'));var util=require(_0x13a6('0x1'));var path=require(_0x13a6('0x2'));var timeout=require(_0x13a6('0x3'));var express=require(_0x13a6('0x4'));var router=express[_0x13a6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x13a6('0x6'));var interaction=require(_0x13a6('0x7'));var config=require(_0x13a6('0x8'));var controller=require(_0x13a6('0x9'));router[_0x13a6('0xa')]('/',auth['isAuthenticated'](),controller[_0x13a6('0xb')]);router['get'](_0x13a6('0xc'),auth[_0x13a6('0xd')](),controller[_0x13a6('0xe')]);router['get'](_0x13a6('0xf'),auth['isAuthenticated'](),controller[_0x13a6('0x10')]);router[_0x13a6('0x11')]('/',auth[_0x13a6('0xd')](),controller[_0x13a6('0x12')]);router[_0x13a6('0x13')](_0x13a6('0xf'),auth[_0x13a6('0xd')](),controller[_0x13a6('0x14')]);router[_0x13a6('0x15')](_0x13a6('0xf'),auth[_0x13a6('0xd')](),controller[_0x13a6('0x16')]);module[_0x13a6('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 01e1d6f..3e8fe86 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x5ca1f6,_0x16ab6f){_0x5ca1f6=_0x5ca1f6-0x0;var _0x166778=_0x7a54[_0x5ca1f6];return _0x166778;};'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(_0x4e9e26,_0x2ac497){_0x4e9e26=_0x4e9e26-0x0;var _0x4be10f=_0x7a54[_0x4e9e26];return _0x4be10f;};'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 38c3857..ff6f55f 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 _0x6096=['to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox'];(function(_0x13a875,_0x3c8620){var _0x35f68a=function(_0x22629c){while(--_0x22629c){_0x13a875['push'](_0x13a875['shift']());}};_0x35f68a(++_0x3c8620);}(_0x6096,0x131));var _0x6609=function(_0x590deb,_0x249ee5){_0x590deb=_0x590deb-0x0;var _0x1b0022=_0x6096[_0x590deb];return _0x1b0022;};'use strict';var emlformat=require(_0x6609('0x0'));var rimraf=require(_0x6609('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6609('0x2'));var rp=require(_0x6609('0x3'));var moment=require('moment');var BPromise=require(_0x6609('0x4'));var Mustache=require(_0x6609('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6609('0x6'));var csv=require(_0x6609('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6609('0x8'));var _=require(_0x6609('0x9'));var squel=require(_0x6609('0xa'));var crypto=require(_0x6609('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6609('0x7'));var querystring=require(_0x6609('0xc'));var Papa=require(_0x6609('0xd'));var Redis=require(_0x6609('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6609('0xf'));var as=require(_0x6609('0x10'));var hardwareService=require(_0x6609('0x11'));var logger=require(_0x6609('0x12'))(_0x6609('0x13'));var utils=require('../../config/utils');var config=require(_0x6609('0x14'));var licenseUtil=require(_0x6609('0x15'));var db=require(_0x6609('0x16'))['db'];function respondWithStatusCode(_0x7353db,_0x5062af){_0x5062af=_0x5062af||0xcc;return function(_0x3848a7){if(_0x3848a7){return _0x7353db[_0x6609('0x17')](_0x5062af);}return _0x7353db['status'](_0x5062af)[_0x6609('0x18')]();};}function respondWithResult(_0x17899b,_0x234d8c){_0x234d8c=_0x234d8c||0xc8;return function(_0x103674){if(_0x103674){return _0x17899b[_0x6609('0x19')](_0x234d8c)[_0x6609('0x1a')](_0x103674);}};}function respondWithFilteredResult(_0x49078c,_0x2b9764){return function(_0x1f5f30){if(_0x1f5f30){var _0xa8747e=typeof _0x2b9764[_0x6609('0x1b')]===_0x6609('0x1c')&&typeof _0x2b9764[_0x6609('0x1d')]==='undefined';var _0x40bee1=_0x1f5f30[_0x6609('0x1e')];var _0x1771f4=_0xa8747e?0x0:_0x2b9764[_0x6609('0x1b')];var _0x23505f=_0xa8747e?_0x1f5f30['count']:_0x2b9764[_0x6609('0x1b')]+_0x2b9764['limit'];var _0x31bfe9;if(_0x23505f>=_0x40bee1){_0x23505f=_0x40bee1;_0x31bfe9=0xc8;}else{_0x31bfe9=0xce;}_0x49078c['status'](_0x31bfe9);return _0x49078c[_0x6609('0x1f')](_0x6609('0x20'),_0x1771f4+'-'+_0x23505f+'/'+_0x40bee1)['json'](_0x1f5f30);}return null;};}function patchUpdates(_0x5b8bd0){return function(_0x16c90c){try{jsonpatch[_0x6609('0x21')](_0x16c90c,_0x5b8bd0,!![]);}catch(_0x53a796){return BPromise[_0x6609('0x22')](_0x53a796);}return _0x16c90c[_0x6609('0x23')]();};}function saveUpdates(_0x27bd8c,_0x2d0fab){return function(_0x31eae3){if(_0x31eae3){return _0x31eae3[_0x6609('0x24')](_0x27bd8c)[_0x6609('0x25')](function(_0x2f7edb){return _0x2f7edb;});}return null;};}function removeEntity(_0x553daf,_0x12154e){return function(_0xf1a57c){if(_0xf1a57c){return _0xf1a57c[_0x6609('0x26')]()[_0x6609('0x25')](function(){_0x553daf[_0x6609('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429a68,_0x17e792){return function(_0x1291a1){if(!_0x1291a1){_0x429a68[_0x6609('0x17')](0x194);}return _0x1291a1;};}function handleError(_0x1a5fc1,_0x52f22e){_0x52f22e=_0x52f22e||0x1f4;return function(_0x428e74){logger[_0x6609('0x27')](_0x428e74[_0x6609('0x28')]);if(_0x428e74[_0x6609('0x29')]){delete _0x428e74['name'];}_0x1a5fc1['status'](_0x52f22e)[_0x6609('0x2a')](_0x428e74);};}exports[_0x6609('0x2b')]=function(_0x1480e3,_0x195d4f){var _0x2e9a83={},_0x32214c={},_0x2f1269={'count':0x0,'rows':[]};var _0x4df8c7=_['map'](db[_0x6609('0x2c')]['rawAttributes'],function(_0x58c39b){return{'name':_0x58c39b[_0x6609('0x2d')],'type':_0x58c39b[_0x6609('0x2e')]['key']};});_0x32214c[_0x6609('0x2f')]=_['map'](_0x4df8c7,_0x6609('0x29'));_0x32214c[_0x6609('0x30')]=_[_0x6609('0x31')](_0x1480e3[_0x6609('0x30')]);_0x32214c[_0x6609('0x32')]=_[_0x6609('0x33')](_0x32214c[_0x6609('0x2f')],_0x32214c['query']);_0x2e9a83[_0x6609('0x34')]=_['intersection'](_0x32214c[_0x6609('0x2f')],qs['fields'](_0x1480e3['query'][_0x6609('0x35')]));_0x2e9a83[_0x6609('0x34')]=_0x2e9a83['attributes'][_0x6609('0x36')]?_0x2e9a83['attributes']:_0x32214c['model'];if(!_0x1480e3[_0x6609('0x30')][_0x6609('0x37')](_0x6609('0x38'))){_0x2e9a83[_0x6609('0x1d')]=qs[_0x6609('0x1d')](_0x1480e3[_0x6609('0x30')][_0x6609('0x1d')]);_0x2e9a83[_0x6609('0x1b')]=qs['offset'](_0x1480e3[_0x6609('0x30')][_0x6609('0x1b')]);}_0x2e9a83[_0x6609('0x39')]=qs[_0x6609('0x3a')](_0x1480e3[_0x6609('0x30')][_0x6609('0x3a')]);_0x2e9a83['where']=qs[_0x6609('0x32')](_[_0x6609('0x3b')](_0x1480e3[_0x6609('0x30')],_0x32214c['filters']),_0x4df8c7);if(_0x1480e3['query'][_0x6609('0x3c')]){_0x2e9a83['where']=_[_0x6609('0x3d')](_0x2e9a83[_0x6609('0x3e')],{'$or':_[_0x6609('0x3f')](_0x4df8c7,function(_0x556679){if(_0x556679[_0x6609('0x2e')]!==_0x6609('0x40')){var _0x414c13={};_0x414c13[_0x556679[_0x6609('0x29')]]={'$like':'%'+_0x1480e3[_0x6609('0x30')][_0x6609('0x3c')]+'%'};return _0x414c13;}})});}_0x2e9a83=_[_0x6609('0x3d')]({},_0x2e9a83,_0x1480e3['options']);var _0x58adac={'where':_0x2e9a83[_0x6609('0x3e')]};return db[_0x6609('0x2c')][_0x6609('0x1e')](_0x58adac)['then'](function(_0x20d6a8){_0x2f1269['count']=_0x20d6a8;if(_0x1480e3['query'][_0x6609('0x41')]){_0x2e9a83[_0x6609('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6609('0x43')](_0x2e9a83);})[_0x6609('0x25')](function(_0x50a7eb){_0x2f1269[_0x6609('0x44')]=_0x50a7eb;return _0x2f1269;})[_0x6609('0x25')](respondWithFilteredResult(_0x195d4f,_0x2e9a83))[_0x6609('0x45')](handleError(_0x195d4f,null));};exports[_0x6609('0x46')]=function(_0x1ff2ee,_0x4e4984){var _0x2d2606={'raw':!![],'where':{'id':_0x1ff2ee[_0x6609('0x47')]['id']}},_0x4a146a={};_0x4a146a[_0x6609('0x2f')]=_[_0x6609('0x31')](db[_0x6609('0x2c')][_0x6609('0x48')]);_0x4a146a['query']=_[_0x6609('0x31')](_0x1ff2ee['query']);_0x4a146a['filters']=_[_0x6609('0x33')](_0x4a146a[_0x6609('0x2f')],_0x4a146a[_0x6609('0x30')]);_0x2d2606['attributes']=_['intersection'](_0x4a146a[_0x6609('0x2f')],qs[_0x6609('0x35')](_0x1ff2ee['query'][_0x6609('0x35')]));_0x2d2606[_0x6609('0x34')]=_0x2d2606['attributes'][_0x6609('0x36')]?_0x2d2606[_0x6609('0x34')]:_0x4a146a[_0x6609('0x2f')];if(_0x1ff2ee[_0x6609('0x30')]['includeAll']){_0x2d2606[_0x6609('0x42')]=[{'all':!![]}];}_0x2d2606=_[_0x6609('0x3d')]({},_0x2d2606,_0x1ff2ee[_0x6609('0x49')]);return db[_0x6609('0x2c')]['find'](_0x2d2606)[_0x6609('0x25')](handleEntityNotFound(_0x4e4984,null))[_0x6609('0x25')](respondWithResult(_0x4e4984,null))[_0x6609('0x45')](handleError(_0x4e4984,null));};exports[_0x6609('0x4a')]=function(_0x3d8683,_0x64c1){return db[_0x6609('0x2c')]['create'](_0x3d8683[_0x6609('0x4b')],{})[_0x6609('0x25')](respondWithResult(_0x64c1,0xc9))['catch'](handleError(_0x64c1,null));};exports[_0x6609('0x24')]=function(_0x4ca77f,_0x520678){if(_0x4ca77f['body']['id']){delete _0x4ca77f[_0x6609('0x4b')]['id'];}return db[_0x6609('0x2c')]['find']({'where':{'id':_0x4ca77f[_0x6609('0x47')]['id']}})[_0x6609('0x25')](handleEntityNotFound(_0x520678,null))['then'](saveUpdates(_0x4ca77f['body'],null))[_0x6609('0x25')](respondWithResult(_0x520678,null))[_0x6609('0x45')](handleError(_0x520678,null));};exports[_0x6609('0x26')]=function(_0x5d8625,_0x41f68e){return db['JscriptyQuestionReport'][_0x6609('0x4c')]({'where':{'id':_0x5d8625[_0x6609('0x47')]['id']}})[_0x6609('0x25')](handleEntityNotFound(_0x41f68e,null))[_0x6609('0x25')](removeEntity(_0x41f68e,null))['catch'](handleError(_0x41f68e,null));};exports[_0x6609('0x4d')]=function(_0x33477,_0x358a61){return db[_0x6609('0x2c')][_0x6609('0x4d')]()[_0x6609('0x25')](respondWithResult(_0x358a61,null))[_0x6609('0x45')](handleError(_0x358a61,null));}; \ No newline at end of file +var _0xf413=['end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xf413,0x160));var _0x3f41=function(_0x20eb0e,_0x956000){_0x20eb0e=_0x20eb0e-0x0;var _0x3c5ce7=_0xf413[_0x20eb0e];return _0x3c5ce7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f41('0x0'));var zipdir=require(_0x3f41('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f41('0x2'));var moment=require(_0x3f41('0x3'));var BPromise=require(_0x3f41('0x4'));var Mustache=require(_0x3f41('0x5'));var util=require('util');var path=require(_0x3f41('0x6'));var sox=require(_0x3f41('0x7'));var csv=require(_0x3f41('0x8'));var ejs=require(_0x3f41('0x9'));var fs=require('fs');var fs_extra=require(_0x3f41('0xa'));var _=require(_0x3f41('0xb'));var squel=require(_0x3f41('0xc'));var crypto=require(_0x3f41('0xd'));var jsforce=require(_0x3f41('0xe'));var deskjs=require(_0x3f41('0xf'));var toCsv=require(_0x3f41('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f41('0x10'));var authService=require(_0x3f41('0x11'));var qs=require(_0x3f41('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f41('0x13'));var logger=require(_0x3f41('0x14'))(_0x3f41('0x15'));var utils=require(_0x3f41('0x16'));var config=require(_0x3f41('0x17'));var licenseUtil=require(_0x3f41('0x18'));var db=require(_0x3f41('0x19'))['db'];function respondWithStatusCode(_0x146dce,_0x3f34a7){_0x3f34a7=_0x3f34a7||0xcc;return function(_0x56c1dc){if(_0x56c1dc){return _0x146dce[_0x3f41('0x1a')](_0x3f34a7);}return _0x146dce[_0x3f41('0x1b')](_0x3f34a7)[_0x3f41('0x1c')]();};}function respondWithResult(_0x4a8aed,_0x128abe){_0x128abe=_0x128abe||0xc8;return function(_0xc11936){if(_0xc11936){return _0x4a8aed[_0x3f41('0x1b')](_0x128abe)['json'](_0xc11936);}};}function respondWithFilteredResult(_0x23b907,_0x1a9c9b){return function(_0x326b6f){if(_0x326b6f){var _0x1f19b9=typeof _0x1a9c9b[_0x3f41('0x1d')]===_0x3f41('0x1e')&&typeof _0x1a9c9b[_0x3f41('0x1f')]===_0x3f41('0x1e');var _0x508e66=_0x326b6f[_0x3f41('0x20')];var _0x587efa=_0x1f19b9?0x0:_0x1a9c9b[_0x3f41('0x1d')];var _0x58abb1=_0x1f19b9?_0x326b6f[_0x3f41('0x20')]:_0x1a9c9b[_0x3f41('0x1d')]+_0x1a9c9b[_0x3f41('0x1f')];var _0x22bdbc;if(_0x58abb1>=_0x508e66){_0x58abb1=_0x508e66;_0x22bdbc=0xc8;}else{_0x22bdbc=0xce;}_0x23b907[_0x3f41('0x1b')](_0x22bdbc);return _0x23b907[_0x3f41('0x21')](_0x3f41('0x22'),_0x587efa+'-'+_0x58abb1+'/'+_0x508e66)['json'](_0x326b6f);}return null;};}function patchUpdates(_0x391387){return function(_0x38a8dc){try{jsonpatch[_0x3f41('0x23')](_0x38a8dc,_0x391387,!![]);}catch(_0x1e5304){return BPromise[_0x3f41('0x24')](_0x1e5304);}return _0x38a8dc[_0x3f41('0x25')]();};}function saveUpdates(_0x5a3ab6,_0x3c1273){return function(_0x234aa6){if(_0x234aa6){return _0x234aa6[_0x3f41('0x26')](_0x5a3ab6)[_0x3f41('0x27')](function(_0x3c764b){return _0x3c764b;});}return null;};}function removeEntity(_0x33f448,_0x4ae63b){return function(_0x39eeff){if(_0x39eeff){return _0x39eeff['destroy']()[_0x3f41('0x27')](function(){_0x33f448['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22dcb9,_0x2d2adc){return function(_0x898e89){if(!_0x898e89){_0x22dcb9[_0x3f41('0x1a')](0x194);}return _0x898e89;};}function handleError(_0x50a0a5,_0x4c4493){_0x4c4493=_0x4c4493||0x1f4;return function(_0x358ae9){logger['error'](_0x358ae9[_0x3f41('0x28')]);if(_0x358ae9[_0x3f41('0x29')]){delete _0x358ae9[_0x3f41('0x29')];}_0x50a0a5['status'](_0x4c4493)['send'](_0x358ae9);};}exports['index']=function(_0x4c1cd0,_0x214f9b){var _0xa5a1d0={},_0x4460d4={},_0xedd029={'count':0x0,'rows':[]};var _0x511f1c=_[_0x3f41('0x2a')](db['JscriptyQuestionReport'][_0x3f41('0x2b')],function(_0x1cbd3c){return{'name':_0x1cbd3c[_0x3f41('0x2c')],'type':_0x1cbd3c[_0x3f41('0x2d')]['key']};});_0x4460d4[_0x3f41('0x2e')]=_[_0x3f41('0x2a')](_0x511f1c,_0x3f41('0x29'));_0x4460d4[_0x3f41('0x2f')]=_[_0x3f41('0x30')](_0x4c1cd0['query']);_0x4460d4['filters']=_[_0x3f41('0x31')](_0x4460d4['model'],_0x4460d4[_0x3f41('0x2f')]);_0xa5a1d0[_0x3f41('0x32')]=_[_0x3f41('0x31')](_0x4460d4[_0x3f41('0x2e')],qs[_0x3f41('0x33')](_0x4c1cd0[_0x3f41('0x2f')][_0x3f41('0x33')]));_0xa5a1d0[_0x3f41('0x32')]=_0xa5a1d0[_0x3f41('0x32')][_0x3f41('0x34')]?_0xa5a1d0[_0x3f41('0x32')]:_0x4460d4['model'];if(!_0x4c1cd0['query'][_0x3f41('0x35')]('nolimit')){_0xa5a1d0[_0x3f41('0x1f')]=qs[_0x3f41('0x1f')](_0x4c1cd0['query'][_0x3f41('0x1f')]);_0xa5a1d0[_0x3f41('0x1d')]=qs[_0x3f41('0x1d')](_0x4c1cd0[_0x3f41('0x2f')][_0x3f41('0x1d')]);}_0xa5a1d0[_0x3f41('0x36')]=qs['sort'](_0x4c1cd0[_0x3f41('0x2f')][_0x3f41('0x37')]);_0xa5a1d0[_0x3f41('0x38')]=qs[_0x3f41('0x39')](_[_0x3f41('0x3a')](_0x4c1cd0[_0x3f41('0x2f')],_0x4460d4[_0x3f41('0x39')]),_0x511f1c);if(_0x4c1cd0[_0x3f41('0x2f')][_0x3f41('0x3b')]){_0xa5a1d0[_0x3f41('0x38')]=_[_0x3f41('0x3c')](_0xa5a1d0['where'],{'$or':_[_0x3f41('0x2a')](_0x511f1c,function(_0x3f4e83){if(_0x3f4e83[_0x3f41('0x2d')]!==_0x3f41('0x3d')){var _0x1e82c3={};_0x1e82c3[_0x3f4e83[_0x3f41('0x29')]]={'$like':'%'+_0x4c1cd0[_0x3f41('0x2f')][_0x3f41('0x3b')]+'%'};return _0x1e82c3;}})});}_0xa5a1d0=_[_0x3f41('0x3c')]({},_0xa5a1d0,_0x4c1cd0[_0x3f41('0x3e')]);var _0x232fc3={'where':_0xa5a1d0[_0x3f41('0x38')]};return db[_0x3f41('0x3f')]['count'](_0x232fc3)[_0x3f41('0x27')](function(_0x8d4d2d){_0xedd029['count']=_0x8d4d2d;if(_0x4c1cd0[_0x3f41('0x2f')][_0x3f41('0x40')]){_0xa5a1d0[_0x3f41('0x41')]=[{'all':!![]}];}return db[_0x3f41('0x3f')][_0x3f41('0x42')](_0xa5a1d0);})[_0x3f41('0x27')](function(_0x5714b2){_0xedd029[_0x3f41('0x43')]=_0x5714b2;return _0xedd029;})[_0x3f41('0x27')](respondWithFilteredResult(_0x214f9b,_0xa5a1d0))[_0x3f41('0x44')](handleError(_0x214f9b,null));};exports[_0x3f41('0x45')]=function(_0x5f2fd8,_0x1d8ee8){var _0x2f7685={'raw':!![],'where':{'id':_0x5f2fd8[_0x3f41('0x46')]['id']}},_0x357c7c={};_0x357c7c['model']=_[_0x3f41('0x30')](db[_0x3f41('0x3f')][_0x3f41('0x2b')]);_0x357c7c[_0x3f41('0x2f')]=_[_0x3f41('0x30')](_0x5f2fd8[_0x3f41('0x2f')]);_0x357c7c['filters']=_[_0x3f41('0x31')](_0x357c7c['model'],_0x357c7c['query']);_0x2f7685['attributes']=_['intersection'](_0x357c7c[_0x3f41('0x2e')],qs[_0x3f41('0x33')](_0x5f2fd8['query'][_0x3f41('0x33')]));_0x2f7685[_0x3f41('0x32')]=_0x2f7685[_0x3f41('0x32')][_0x3f41('0x34')]?_0x2f7685['attributes']:_0x357c7c[_0x3f41('0x2e')];if(_0x5f2fd8[_0x3f41('0x2f')]['includeAll']){_0x2f7685['include']=[{'all':!![]}];}_0x2f7685=_[_0x3f41('0x3c')]({},_0x2f7685,_0x5f2fd8[_0x3f41('0x3e')]);return db[_0x3f41('0x3f')][_0x3f41('0x47')](_0x2f7685)[_0x3f41('0x27')](handleEntityNotFound(_0x1d8ee8,null))[_0x3f41('0x27')](respondWithResult(_0x1d8ee8,null))['catch'](handleError(_0x1d8ee8,null));};exports[_0x3f41('0x48')]=function(_0x1ced8a,_0x23469a){return db[_0x3f41('0x3f')][_0x3f41('0x48')](_0x1ced8a[_0x3f41('0x49')],{})[_0x3f41('0x27')](respondWithResult(_0x23469a,0xc9))['catch'](handleError(_0x23469a,null));};exports['update']=function(_0x2cfd8f,_0x17a98b){if(_0x2cfd8f['body']['id']){delete _0x2cfd8f['body']['id'];}return db[_0x3f41('0x3f')][_0x3f41('0x47')]({'where':{'id':_0x2cfd8f['params']['id']}})[_0x3f41('0x27')](handleEntityNotFound(_0x17a98b,null))['then'](saveUpdates(_0x2cfd8f[_0x3f41('0x49')],null))[_0x3f41('0x27')](respondWithResult(_0x17a98b,null))['catch'](handleError(_0x17a98b,null));};exports[_0x3f41('0x4a')]=function(_0x39d8a9,_0x36da6b){return db[_0x3f41('0x3f')]['find']({'where':{'id':_0x39d8a9[_0x3f41('0x46')]['id']}})['then'](handleEntityNotFound(_0x36da6b,null))[_0x3f41('0x27')](removeEntity(_0x36da6b,null))[_0x3f41('0x44')](handleError(_0x36da6b,null));};exports[_0x3f41('0x4b')]=function(_0x2a766f,_0x10f616){return db['JscriptyQuestionReport'][_0x3f41('0x4b')]()[_0x3f41('0x27')](respondWithResult(_0x10f616,null))[_0x3f41('0x44')](handleError(_0x10f616,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 55e74e9..6b014c4 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 _0x7c35=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x35f47c,_0x777455){var _0x2410e2=function(_0x2712e0){while(--_0x2712e0){_0x35f47c['push'](_0x35f47c['shift']());}};_0x2410e2(++_0x777455);}(_0x7c35,0x148));var _0x57c3=function(_0x48e91c,_0x1a0c1e){_0x48e91c=_0x48e91c-0x0;var _0x3f4bd4=_0x7c35[_0x48e91c];return _0x3f4bd4;};'use strict';var _=require(_0x57c3('0x0'));var util=require(_0x57c3('0x1'));var logger=require(_0x57c3('0x2'))(_0x57c3('0x3'));var moment=require(_0x57c3('0x4'));var BPromise=require(_0x57c3('0x5'));var rp=require(_0x57c3('0x6'));var fs=require('fs');var path=require(_0x57c3('0x7'));var rimraf=require('rimraf');var config=require(_0x57c3('0x8'));var attributes=require(_0x57c3('0x9'));module[_0x57c3('0xa')]=function(_0x364182,_0x424694){return _0x364182[_0x57c3('0xb')](_0x57c3('0xc'),attributes,{'tableName':_0x57c3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce52=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport'];(function(_0x80be61,_0x458506){var _0x4df1a=function(_0x236a9c){while(--_0x236a9c){_0x80be61['push'](_0x80be61['shift']());}};_0x4df1a(++_0x458506);}(_0xce52,0xd1));var _0x2ce5=function(_0x1f2d04,_0x4ea9ae){_0x1f2d04=_0x1f2d04-0x0;var _0x4e5de2=_0xce52[_0x1f2d04];return _0x4e5de2;};'use strict';var _=require(_0x2ce5('0x0'));var util=require(_0x2ce5('0x1'));var logger=require(_0x2ce5('0x2'))(_0x2ce5('0x3'));var moment=require(_0x2ce5('0x4'));var BPromise=require('bluebird');var rp=require(_0x2ce5('0x5'));var fs=require('fs');var path=require(_0x2ce5('0x6'));var rimraf=require(_0x2ce5('0x7'));var config=require(_0x2ce5('0x8'));var attributes=require(_0x2ce5('0x9'));module['exports']=function(_0x3ff785,_0x24de67){return _0x3ff785[_0x2ce5('0xa')](_0x2ce5('0xb'),attributes,{'tableName':_0x2ce5('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 89910ab..d2de39a 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 _0x506b=['rpc','../../config/environment','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2935b2,_0x23ac93){var _0x3cc82c=function(_0x24423c){while(--_0x24423c){_0x2935b2['push'](_0x2935b2['shift']());}};_0x3cc82c(++_0x23ac93);}(_0x506b,0xe9));var _0xb506=function(_0x16d4c3,_0x1d78d8){_0x16d4c3=_0x16d4c3-0x0;var _0x195daa=_0x506b[_0x16d4c3];return _0x195daa;};'use strict';var _=require(_0xb506('0x0'));var util=require('util');var moment=require(_0xb506('0x1'));var BPromise=require('bluebird');var rs=require(_0xb506('0x2'));var fs=require('fs');var Redis=require(_0xb506('0x3'));var db=require(_0xb506('0x4'))['db'];var utils=require(_0xb506('0x5'));var logger=require(_0xb506('0x6'))(_0xb506('0x7'));var config=require(_0xb506('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb506('0x9')][_0xb506('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c89db,_0x26bb51,_0xf69457){return new BPromise(function(_0x256260,_0x7783f4){return client[_0xb506('0xb')](_0x2c89db,_0xf69457)['then'](function(_0x313485){logger['info'](_0xb506('0xc'),_0x26bb51,_0xb506('0xd'));logger[_0xb506('0xe')](_0xb506('0xf'),_0x26bb51,'request\x20sent',JSON['stringify'](_0x313485));if(_0x313485[_0xb506('0x10')]){if(_0x313485[_0xb506('0x10')][_0xb506('0x11')]===0x1f4){logger[_0xb506('0x10')](_0xb506('0xc'),_0x26bb51,_0x313485[_0xb506('0x10')][_0xb506('0x12')]);return _0x7783f4(_0x313485[_0xb506('0x10')][_0xb506('0x12')]);}logger[_0xb506('0x10')](_0xb506('0xc'),_0x26bb51,_0x313485[_0xb506('0x10')]['message']);return _0x256260(_0x313485[_0xb506('0x10')]['message']);}else{logger['info'](_0xb506('0xc'),_0x26bb51,_0xb506('0xd'));_0x256260(_0x313485[_0xb506('0x13')]['message']);}})['catch'](function(_0x2f4bb5){logger[_0xb506('0x10')](_0xb506('0xc'),_0x26bb51,_0x2f4bb5);_0x7783f4(_0x2f4bb5);});});} \ No newline at end of file +var _0xc3bd=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3bd,0xe4));var _0xdc3b=function(_0x15078f,_0xe9adbb){_0x15078f=_0x15078f-0x0;var _0xaad20=_0xc3bd[_0x15078f];return _0xaad20;};'use strict';var _=require(_0xdc3b('0x0'));var util=require(_0xdc3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc3b('0x2'));var fs=require('fs');var Redis=require(_0xdc3b('0x3'));var db=require(_0xdc3b('0x4'))['db'];var utils=require(_0xdc3b('0x5'));var logger=require('../../config/logger')(_0xdc3b('0x6'));var config=require('../../config/environment');var jayson=require(_0xdc3b('0x7'));var client=jayson[_0xdc3b('0x8')][_0xdc3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x170e4c,_0x474ac5,_0x13c4d4){return new BPromise(function(_0x4c1869,_0x2401c6){return client['request'](_0x170e4c,_0x13c4d4)[_0xdc3b('0xa')](function(_0x16c312){logger[_0xdc3b('0xb')](_0xdc3b('0xc'),_0x474ac5,_0xdc3b('0xd'));logger[_0xdc3b('0xe')](_0xdc3b('0xf'),_0x474ac5,'request\x20sent',JSON[_0xdc3b('0x10')](_0x16c312));if(_0x16c312[_0xdc3b('0x11')]){if(_0x16c312[_0xdc3b('0x11')][_0xdc3b('0x12')]===0x1f4){logger[_0xdc3b('0x11')](_0xdc3b('0xc'),_0x474ac5,_0x16c312[_0xdc3b('0x11')]['message']);return _0x2401c6(_0x16c312[_0xdc3b('0x11')][_0xdc3b('0x13')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x474ac5,_0x16c312[_0xdc3b('0x11')]['message']);return _0x4c1869(_0x16c312[_0xdc3b('0x11')][_0xdc3b('0x13')]);}else{logger[_0xdc3b('0xb')](_0xdc3b('0xc'),_0x474ac5,_0xdc3b('0xd'));_0x4c1869(_0x16c312[_0xdc3b('0x14')][_0xdc3b('0x13')]);}})[_0xdc3b('0x15')](function(_0x1ca59b){logger[_0xdc3b('0x11')](_0xdc3b('0xc'),_0x474ac5,_0x1ca59b);_0x2401c6(_0x1ca59b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2a55113..7cff9f7 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 _0x6dcf=['/describe','describe','show','/:id/questions','getQuestions','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2b252f,_0x15b5f8){var _0x5aa51c=function(_0x2e42a4){while(--_0x2e42a4){_0x2b252f['push'](_0x2b252f['shift']());}};_0x5aa51c(++_0x15b5f8);}(_0x6dcf,0x17b));var _0xf6dc=function(_0x2b082f,_0x65ad67){_0x2b082f=_0x2b082f-0x0;var _0x133d03=_0x6dcf[_0x2b082f];return _0x133d03;};'use strict';var multer=require(_0xf6dc('0x0'));var util=require(_0xf6dc('0x1'));var path=require(_0xf6dc('0x2'));var timeout=require(_0xf6dc('0x3'));var express=require(_0xf6dc('0x4'));var router=express[_0xf6dc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf6dc('0x6'));var interaction=require(_0xf6dc('0x7'));var config=require(_0xf6dc('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xf6dc('0x9')]('/',auth[_0xf6dc('0xa')](),controller[_0xf6dc('0xb')]);router[_0xf6dc('0x9')](_0xf6dc('0xc'),auth[_0xf6dc('0xa')](),controller[_0xf6dc('0xd')]);router[_0xf6dc('0x9')]('/:id',auth[_0xf6dc('0xa')](),controller[_0xf6dc('0xe')]);router['get'](_0xf6dc('0xf'),auth[_0xf6dc('0xa')](),controller[_0xf6dc('0x10')]);router[_0xf6dc('0x11')]('/',auth[_0xf6dc('0xa')](),controller['create']);router[_0xf6dc('0x12')](_0xf6dc('0x13'),auth[_0xf6dc('0xa')](),controller[_0xf6dc('0x14')]);router['delete'](_0xf6dc('0x13'),auth[_0xf6dc('0xa')](),controller[_0xf6dc('0x15')]);module[_0xf6dc('0x16')]=router; \ No newline at end of file +var _0x98e9=['/:id/questions','getQuestions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','/:id'];(function(_0x20034d,_0x287bfd){var _0x1f3f8a=function(_0x3c557e){while(--_0x3c557e){_0x20034d['push'](_0x20034d['shift']());}};_0x1f3f8a(++_0x287bfd);}(_0x98e9,0xbc));var _0x998e=function(_0xa0116d,_0x58b427){_0xa0116d=_0xa0116d-0x0;var _0x22b5a2=_0x98e9[_0xa0116d];return _0x22b5a2;};'use strict';var multer=require(_0x998e('0x0'));var util=require(_0x998e('0x1'));var path=require('path');var timeout=require(_0x998e('0x2'));var express=require(_0x998e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x998e('0x4'));var interaction=require(_0x998e('0x5'));var config=require(_0x998e('0x6'));var controller=require(_0x998e('0x7'));router[_0x998e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x998e('0x9'),auth[_0x998e('0xa')](),controller['describe']);router[_0x998e('0x8')](_0x998e('0xb'),auth[_0x998e('0xa')](),controller['show']);router[_0x998e('0x8')](_0x998e('0xc'),auth[_0x998e('0xa')](),controller[_0x998e('0xd')]);router[_0x998e('0xe')]('/',auth[_0x998e('0xa')](),controller[_0x998e('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x998e('0x10')]);router[_0x998e('0x11')](_0x998e('0xb'),auth[_0x998e('0xa')](),controller[_0x998e('0x12')]);module[_0x998e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f585fcf..c251174 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 _0x3a29=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','exports','DATE','setDataValue'];(function(_0x29d498,_0x2b3de8){var _0x67cf7d=function(_0x43a232){while(--_0x43a232){_0x29d498['push'](_0x29d498['shift']());}};_0x67cf7d(++_0x2b3de8);}(_0x3a29,0xe3));var _0x93a2=function(_0x48447b,_0x225972){_0x48447b=_0x48447b-0x0;var _0x4f607=_0x3a29[_0x48447b];return _0x4f607;};'use strict';var moment=require(_0x93a2('0x0'));var Sequelize=require('sequelize');module[_0x93a2('0x1')]={'starttime':{'type':Sequelize[_0x93a2('0x2')],'set':function(_0x251a61){this['setDataValue']('starttime',_0x251a61);this[_0x93a2('0x3')]('endtime',moment()[_0x93a2('0x4')](_0x93a2('0x5')));}},'endtime':{'type':Sequelize[_0x93a2('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x93a2('0x6')]},'queue':{'type':Sequelize[_0x93a2('0x6')]},'uniqueid':{'type':Sequelize[_0x93a2('0x6')]},'calleridname':{'type':Sequelize[_0x93a2('0x6')]},'calleridnum':{'type':Sequelize[_0x93a2('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x30d4=['starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x4bf675,_0x207936){var _0x49cb35=function(_0x27fbbf){while(--_0x27fbbf){_0x4bf675['push'](_0x4bf675['shift']());}};_0x49cb35(++_0x207936);}(_0x30d4,0xed));var _0x430d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x30d4[_0x126558];return _0x1f6d14;};'use strict';var moment=require(_0x430d('0x0'));var Sequelize=require(_0x430d('0x1'));module[_0x430d('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xe250fc){this['setDataValue'](_0x430d('0x3'),_0xe250fc);this[_0x430d('0x4')]('endtime',moment()[_0x430d('0x5')](_0x430d('0x6')));}},'endtime':{'type':Sequelize[_0x430d('0x7')]},'membername':{'type':Sequelize[_0x430d('0x8')]},'projectname':{'type':Sequelize[_0x430d('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x430d('0x8')]},'calleridname':{'type':Sequelize[_0x430d('0x8')]},'calleridnum':{'type':Sequelize[_0x430d('0x8')]},'completed':{'type':Sequelize[_0x430d('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 4baf11b..931f597 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 _0x3d81=['error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','attributes','merge','find','create','body','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus'];(function(_0x3422bf,_0x21b1da){var _0x4de668=function(_0x271cce){while(--_0x271cce){_0x3422bf['push'](_0x3422bf['shift']());}};_0x4de668(++_0x21b1da);}(_0x3d81,0x76));var _0x13d8=function(_0xfd8522,_0x17712e){_0xfd8522=_0xfd8522-0x0;var _0x2bf81e=_0x3d81[_0xfd8522];return _0x2bf81e;};'use strict';var emlformat=require(_0x13d8('0x0'));var rimraf=require(_0x13d8('0x1'));var zipdir=require(_0x13d8('0x2'));var jsonpatch=require(_0x13d8('0x3'));var rp=require(_0x13d8('0x4'));var moment=require('moment');var BPromise=require(_0x13d8('0x5'));var Mustache=require(_0x13d8('0x6'));var util=require(_0x13d8('0x7'));var path=require(_0x13d8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x13d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13d8('0xa'));var squel=require('squel');var crypto=require(_0x13d8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x13d8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x13d8('0xd'));var Papa=require(_0x13d8('0xe'));var Redis=require(_0x13d8('0xf'));var authService=require(_0x13d8('0x10'));var qs=require(_0x13d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13d8('0x12'));var logger=require(_0x13d8('0x13'))(_0x13d8('0x14'));var utils=require('../../config/utils');var config=require(_0x13d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x13d8('0x16'))['db'];function respondWithStatusCode(_0x4502f2,_0x2c9ef8){_0x2c9ef8=_0x2c9ef8||0xcc;return function(_0x26d5a1){if(_0x26d5a1){return _0x4502f2['sendStatus'](_0x2c9ef8);}return _0x4502f2[_0x13d8('0x17')](_0x2c9ef8)[_0x13d8('0x18')]();};}function respondWithResult(_0x45eeed,_0x375b2b){_0x375b2b=_0x375b2b||0xc8;return function(_0x4b221e){if(_0x4b221e){return _0x45eeed['status'](_0x375b2b)['json'](_0x4b221e);}};}function respondWithFilteredResult(_0x570206,_0x526b11){return function(_0x9f909){if(_0x9f909){var _0x2b9e97=typeof _0x526b11[_0x13d8('0x19')]===_0x13d8('0x1a')&&typeof _0x526b11[_0x13d8('0x1b')]==='undefined';var _0x850e4f=_0x9f909[_0x13d8('0x1c')];var _0x57a537=_0x2b9e97?0x0:_0x526b11[_0x13d8('0x19')];var _0x1cecbd=_0x2b9e97?_0x9f909[_0x13d8('0x1c')]:_0x526b11[_0x13d8('0x19')]+_0x526b11[_0x13d8('0x1b')];var _0x173280;if(_0x1cecbd>=_0x850e4f){_0x1cecbd=_0x850e4f;_0x173280=0xc8;}else{_0x173280=0xce;}_0x570206[_0x13d8('0x17')](_0x173280);return _0x570206[_0x13d8('0x1d')]('Content-Range',_0x57a537+'-'+_0x1cecbd+'/'+_0x850e4f)['json'](_0x9f909);}return null;};}function patchUpdates(_0x329ba5){return function(_0x599837){try{jsonpatch[_0x13d8('0x1e')](_0x599837,_0x329ba5,!![]);}catch(_0x193268){return BPromise[_0x13d8('0x1f')](_0x193268);}return _0x599837['save']();};}function saveUpdates(_0x1dd321,_0x34f507){return function(_0x1aee60){if(_0x1aee60){return _0x1aee60[_0x13d8('0x20')](_0x1dd321)[_0x13d8('0x21')](function(_0xf04b3){return _0xf04b3;});}return null;};}function removeEntity(_0x5920bb,_0x404534){return function(_0x53ffbb){if(_0x53ffbb){return _0x53ffbb[_0x13d8('0x22')]()['then'](function(){_0x5920bb['status'](0xcc)[_0x13d8('0x18')]();});}};}function handleEntityNotFound(_0x46dc98,_0x50f910){return function(_0x491bfb){if(!_0x491bfb){_0x46dc98[_0x13d8('0x23')](0x194);}return _0x491bfb;};}function handleError(_0x254663,_0x44e87d){_0x44e87d=_0x44e87d||0x1f4;return function(_0x24f8b8){logger[_0x13d8('0x24')](_0x24f8b8[_0x13d8('0x25')]);if(_0x24f8b8[_0x13d8('0x26')]){delete _0x24f8b8[_0x13d8('0x26')];}_0x254663[_0x13d8('0x17')](_0x44e87d)[_0x13d8('0x27')](_0x24f8b8);};}exports[_0x13d8('0x28')]=function(_0x5240d3,_0x48ab59){var _0x12e97c={},_0xa3893d={},_0x5092b0={'count':0x0,'rows':[]};var _0x36fe19=_[_0x13d8('0x29')](db[_0x13d8('0x2a')][_0x13d8('0x2b')],function(_0x168f30){return{'name':_0x168f30[_0x13d8('0x2c')],'type':_0x168f30[_0x13d8('0x2d')][_0x13d8('0x2e')]};});_0xa3893d[_0x13d8('0x2f')]=_['map'](_0x36fe19,_0x13d8('0x26'));_0xa3893d[_0x13d8('0x30')]=_[_0x13d8('0x31')](_0x5240d3[_0x13d8('0x30')]);_0xa3893d[_0x13d8('0x32')]=_[_0x13d8('0x33')](_0xa3893d[_0x13d8('0x2f')],_0xa3893d[_0x13d8('0x30')]);_0x12e97c['attributes']=_[_0x13d8('0x33')](_0xa3893d[_0x13d8('0x2f')],qs[_0x13d8('0x34')](_0x5240d3[_0x13d8('0x30')]['fields']));_0x12e97c['attributes']=_0x12e97c['attributes'][_0x13d8('0x35')]?_0x12e97c['attributes']:_0xa3893d[_0x13d8('0x2f')];if(!_0x5240d3[_0x13d8('0x30')][_0x13d8('0x36')](_0x13d8('0x37'))){_0x12e97c[_0x13d8('0x1b')]=qs[_0x13d8('0x1b')](_0x5240d3['query']['limit']);_0x12e97c[_0x13d8('0x19')]=qs[_0x13d8('0x19')](_0x5240d3[_0x13d8('0x30')]['offset']);}_0x12e97c[_0x13d8('0x38')]=qs['sort'](_0x5240d3['query'][_0x13d8('0x39')]);_0x12e97c[_0x13d8('0x3a')]=qs[_0x13d8('0x32')](_[_0x13d8('0x3b')](_0x5240d3['query'],_0xa3893d[_0x13d8('0x32')]),_0x36fe19);if(_0x5240d3[_0x13d8('0x30')][_0x13d8('0x3c')]){_0x12e97c[_0x13d8('0x3a')]=_['merge'](_0x12e97c[_0x13d8('0x3a')],{'$or':_['map'](_0x36fe19,function(_0x440423){if(_0x440423[_0x13d8('0x2d')]!==_0x13d8('0x3d')){var _0x5dd88c={};_0x5dd88c[_0x440423[_0x13d8('0x26')]]={'$like':'%'+_0x5240d3['query'][_0x13d8('0x3c')]+'%'};return _0x5dd88c;}})});}_0x12e97c=_['merge']({},_0x12e97c,_0x5240d3[_0x13d8('0x3e')]);var _0x406626={'where':_0x12e97c[_0x13d8('0x3a')]};return db[_0x13d8('0x2a')][_0x13d8('0x1c')](_0x406626)[_0x13d8('0x21')](function(_0x26d8a6){_0x5092b0[_0x13d8('0x1c')]=_0x26d8a6;if(_0x5240d3[_0x13d8('0x30')][_0x13d8('0x3f')]){_0x12e97c[_0x13d8('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x13d8('0x41')](_0x12e97c);})['then'](function(_0x37a3ed){_0x5092b0['rows']=_0x37a3ed;return _0x5092b0;})[_0x13d8('0x21')](respondWithFilteredResult(_0x48ab59,_0x12e97c))[_0x13d8('0x42')](handleError(_0x48ab59,null));};exports[_0x13d8('0x43')]=function(_0x2e3c9f,_0x3676d2){var _0x486023={'raw':!![],'where':{'id':_0x2e3c9f[_0x13d8('0x44')]['id']}},_0x216c13={};_0x216c13[_0x13d8('0x2f')]=_[_0x13d8('0x31')](db[_0x13d8('0x2a')][_0x13d8('0x2b')]);_0x216c13[_0x13d8('0x30')]=_['keys'](_0x2e3c9f['query']);_0x216c13[_0x13d8('0x32')]=_[_0x13d8('0x33')](_0x216c13[_0x13d8('0x2f')],_0x216c13['query']);_0x486023['attributes']=_['intersection'](_0x216c13[_0x13d8('0x2f')],qs[_0x13d8('0x34')](_0x2e3c9f[_0x13d8('0x30')]['fields']));_0x486023[_0x13d8('0x45')]=_0x486023[_0x13d8('0x45')][_0x13d8('0x35')]?_0x486023[_0x13d8('0x45')]:_0x216c13[_0x13d8('0x2f')];if(_0x2e3c9f[_0x13d8('0x30')][_0x13d8('0x3f')]){_0x486023[_0x13d8('0x40')]=[{'all':!![]}];}_0x486023=_[_0x13d8('0x46')]({},_0x486023,_0x2e3c9f[_0x13d8('0x3e')]);return db[_0x13d8('0x2a')][_0x13d8('0x47')](_0x486023)[_0x13d8('0x21')](handleEntityNotFound(_0x3676d2,null))['then'](respondWithResult(_0x3676d2,null))[_0x13d8('0x42')](handleError(_0x3676d2,null));};exports[_0x13d8('0x48')]=function(_0x4a2a89,_0x7d21f6){return db[_0x13d8('0x2a')][_0x13d8('0x48')](_0x4a2a89[_0x13d8('0x49')],{})[_0x13d8('0x21')](respondWithResult(_0x7d21f6,0xc9))[_0x13d8('0x42')](handleError(_0x7d21f6,null));};exports[_0x13d8('0x20')]=function(_0x52de60,_0x182c91){if(_0x52de60['body']['id']){delete _0x52de60[_0x13d8('0x49')]['id'];}return db[_0x13d8('0x2a')][_0x13d8('0x47')]({'where':{'id':_0x52de60[_0x13d8('0x44')]['id']}})[_0x13d8('0x21')](handleEntityNotFound(_0x182c91,null))[_0x13d8('0x21')](saveUpdates(_0x52de60[_0x13d8('0x49')],null))['then'](respondWithResult(_0x182c91,null))[_0x13d8('0x42')](handleError(_0x182c91,null));};exports[_0x13d8('0x22')]=function(_0x29f188,_0x2a177f){return db[_0x13d8('0x2a')][_0x13d8('0x47')]({'where':{'id':_0x29f188[_0x13d8('0x44')]['id']}})[_0x13d8('0x21')](handleEntityNotFound(_0x2a177f,null))['then'](removeEntity(_0x2a177f,null))[_0x13d8('0x42')](handleError(_0x2a177f,null));};exports[_0x13d8('0x4a')]=function(_0x1ee5fb,_0x2a9028){return db[_0x13d8('0x2a')][_0x13d8('0x4a')]()['then'](respondWithResult(_0x2a9028,null))['catch'](handleError(_0x2a9028,null));};exports['getQuestions']=function(_0x13b7fb,_0x5d5665,_0x1b4654){var _0x16086b={'raw':!![],'where':{}};var _0x5677b7={};var _0x3c41a2={'count':0x0,'rows':[]};return db[_0x13d8('0x2a')][_0x13d8('0x4b')]({'where':{'id':_0x13b7fb[_0x13d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d5665,null))[_0x13d8('0x21')](function(_0x37e5cc){if(_0x37e5cc){_0x5677b7['model']=_['keys'](db[_0x13d8('0x4c')]['rawAttributes']);_0x5677b7['query']=_[_0x13d8('0x31')](_0x13b7fb[_0x13d8('0x30')]);_0x5677b7[_0x13d8('0x32')]=_[_0x13d8('0x33')](_0x5677b7[_0x13d8('0x2f')],_0x5677b7[_0x13d8('0x30')]);_0x16086b[_0x13d8('0x45')]=_[_0x13d8('0x33')](_0x5677b7[_0x13d8('0x2f')],qs['fields'](_0x13b7fb[_0x13d8('0x30')]['fields']));_0x16086b[_0x13d8('0x45')]=_0x16086b['attributes'][_0x13d8('0x35')]?_0x16086b[_0x13d8('0x45')]:_0x5677b7[_0x13d8('0x2f')];if(!_0x13b7fb[_0x13d8('0x30')][_0x13d8('0x36')](_0x13d8('0x37'))){_0x16086b[_0x13d8('0x1b')]=qs[_0x13d8('0x1b')](_0x13b7fb[_0x13d8('0x30')]['limit']);_0x16086b['offset']=qs[_0x13d8('0x19')](_0x13b7fb[_0x13d8('0x30')][_0x13d8('0x19')]);}_0x16086b[_0x13d8('0x38')]=qs['sort'](_0x13b7fb[_0x13d8('0x30')][_0x13d8('0x39')]);_0x16086b['where']=qs[_0x13d8('0x32')](_[_0x13d8('0x3b')](_0x13b7fb['query'],_0x5677b7[_0x13d8('0x32')]));_0x16086b['where']['SessionId']=_0x37e5cc['id'];if(_0x13b7fb[_0x13d8('0x30')][_0x13d8('0x3c')]){_0x16086b[_0x13d8('0x3a')]=_['merge'](_0x16086b['where'],{'$or':_[_0x13d8('0x29')](_0x16086b[_0x13d8('0x45')],function(_0x1a4a7c){var _0x456732={};_0x456732[_0x1a4a7c]={'$like':'%'+_0x13b7fb[_0x13d8('0x30')]['filter']+'%'};return _0x456732;})});}_0x16086b=_[_0x13d8('0x46')]({},_0x16086b,_0x13b7fb[_0x13d8('0x3e')]);return db[_0x13d8('0x4c')]['count']({'where':_0x16086b[_0x13d8('0x3a')]})['then'](function(_0x8465f9){_0x3c41a2[_0x13d8('0x1c')]=_0x8465f9;if(_0x13b7fb['query']['includeAll']){_0x16086b['include']=[{'all':!![]}];}return db[_0x13d8('0x4c')][_0x13d8('0x41')](_0x16086b);})['then'](function(_0x519b68){_0x3c41a2['rows']=_0x519b68;return _0x3c41a2;});}})['then'](respondWithFilteredResult(_0x5d5665,_0x16086b))[_0x13d8('0x42')](handleError(_0x5d5665,null));}; \ No newline at end of file +var _0x2283=['include','options','find','create','update','body','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','zip-dir','fast-json-patch','moment','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','JscriptySessionReport','includeAll','findAll','rows','catch','show','params'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x2283,0x1da));var _0x3228=function(_0x4dfb1b,_0x26850a){_0x4dfb1b=_0x4dfb1b-0x0;var _0x4dc88=_0x2283[_0x4dfb1b];return _0x4dc88;};'use strict';var emlformat=require(_0x3228('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3228('0x1'));var jsonpatch=require(_0x3228('0x2'));var rp=require('request-promise');var moment=require(_0x3228('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3228('0x4'));var csv=require('to-csv');var ejs=require(_0x3228('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3228('0x6'));var crypto=require(_0x3228('0x7'));var jsforce=require(_0x3228('0x8'));var deskjs=require(_0x3228('0x9'));var toCsv=require(_0x3228('0xa'));var querystring=require(_0x3228('0xb'));var Papa=require(_0x3228('0xc'));var Redis=require(_0x3228('0xd'));var authService=require(_0x3228('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3228('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3228('0x10'));var utils=require(_0x3228('0x11'));var config=require(_0x3228('0x12'));var licenseUtil=require(_0x3228('0x13'));var db=require(_0x3228('0x14'))['db'];function respondWithStatusCode(_0x14e58b,_0x133b7b){_0x133b7b=_0x133b7b||0xcc;return function(_0x72ae68){if(_0x72ae68){return _0x14e58b[_0x3228('0x15')](_0x133b7b);}return _0x14e58b[_0x3228('0x16')](_0x133b7b)[_0x3228('0x17')]();};}function respondWithResult(_0x40fe06,_0x289225){_0x289225=_0x289225||0xc8;return function(_0x2fb6d2){if(_0x2fb6d2){return _0x40fe06[_0x3228('0x16')](_0x289225)['json'](_0x2fb6d2);}};}function respondWithFilteredResult(_0x3b33d8,_0x4afb88){return function(_0x47d805){if(_0x47d805){var _0xf0c914=typeof _0x4afb88['offset']==='undefined'&&typeof _0x4afb88[_0x3228('0x18')]===_0x3228('0x19');var _0x4e8df2=_0x47d805[_0x3228('0x1a')];var _0x561921=_0xf0c914?0x0:_0x4afb88[_0x3228('0x1b')];var _0x546308=_0xf0c914?_0x47d805[_0x3228('0x1a')]:_0x4afb88[_0x3228('0x1b')]+_0x4afb88[_0x3228('0x18')];var _0x4a154c;if(_0x546308>=_0x4e8df2){_0x546308=_0x4e8df2;_0x4a154c=0xc8;}else{_0x4a154c=0xce;}_0x3b33d8[_0x3228('0x16')](_0x4a154c);return _0x3b33d8[_0x3228('0x1c')](_0x3228('0x1d'),_0x561921+'-'+_0x546308+'/'+_0x4e8df2)['json'](_0x47d805);}return null;};}function patchUpdates(_0x2b4b45){return function(_0x57576f){try{jsonpatch['apply'](_0x57576f,_0x2b4b45,!![]);}catch(_0x147469){return BPromise[_0x3228('0x1e')](_0x147469);}return _0x57576f[_0x3228('0x1f')]();};}function saveUpdates(_0x2c7d10,_0x195326){return function(_0x261d21){if(_0x261d21){return _0x261d21['update'](_0x2c7d10)['then'](function(_0x293e8a){return _0x293e8a;});}return null;};}function removeEntity(_0xd61349,_0x4c10c4){return function(_0x1e932f){if(_0x1e932f){return _0x1e932f[_0x3228('0x20')]()[_0x3228('0x21')](function(){_0xd61349[_0x3228('0x16')](0xcc)[_0x3228('0x17')]();});}};}function handleEntityNotFound(_0x2d10a8,_0x3da990){return function(_0x1edeae){if(!_0x1edeae){_0x2d10a8['sendStatus'](0x194);}return _0x1edeae;};}function handleError(_0x558178,_0x19bc23){_0x19bc23=_0x19bc23||0x1f4;return function(_0xd8413e){logger['error'](_0xd8413e[_0x3228('0x22')]);if(_0xd8413e[_0x3228('0x23')]){delete _0xd8413e[_0x3228('0x23')];}_0x558178['status'](_0x19bc23)[_0x3228('0x24')](_0xd8413e);};}exports[_0x3228('0x25')]=function(_0x11b10d,_0x49f8ed){var _0x3bed91={},_0x4e2e7a={},_0x2920ea={'count':0x0,'rows':[]};var _0x4e619c=_[_0x3228('0x26')](db['JscriptySessionReport'][_0x3228('0x27')],function(_0x71685f){return{'name':_0x71685f[_0x3228('0x28')],'type':_0x71685f['type'][_0x3228('0x29')]};});_0x4e2e7a[_0x3228('0x2a')]=_[_0x3228('0x26')](_0x4e619c,_0x3228('0x23'));_0x4e2e7a[_0x3228('0x2b')]=_[_0x3228('0x2c')](_0x11b10d['query']);_0x4e2e7a[_0x3228('0x2d')]=_[_0x3228('0x2e')](_0x4e2e7a[_0x3228('0x2a')],_0x4e2e7a[_0x3228('0x2b')]);_0x3bed91[_0x3228('0x2f')]=_[_0x3228('0x2e')](_0x4e2e7a[_0x3228('0x2a')],qs[_0x3228('0x30')](_0x11b10d[_0x3228('0x2b')][_0x3228('0x30')]));_0x3bed91[_0x3228('0x2f')]=_0x3bed91[_0x3228('0x2f')][_0x3228('0x31')]?_0x3bed91['attributes']:_0x4e2e7a[_0x3228('0x2a')];if(!_0x11b10d[_0x3228('0x2b')][_0x3228('0x32')]('nolimit')){_0x3bed91[_0x3228('0x18')]=qs[_0x3228('0x18')](_0x11b10d[_0x3228('0x2b')]['limit']);_0x3bed91[_0x3228('0x1b')]=qs[_0x3228('0x1b')](_0x11b10d[_0x3228('0x2b')]['offset']);}_0x3bed91[_0x3228('0x33')]=qs[_0x3228('0x34')](_0x11b10d[_0x3228('0x2b')][_0x3228('0x34')]);_0x3bed91[_0x3228('0x35')]=qs[_0x3228('0x2d')](_['pick'](_0x11b10d['query'],_0x4e2e7a[_0x3228('0x2d')]),_0x4e619c);if(_0x11b10d['query'][_0x3228('0x36')]){_0x3bed91[_0x3228('0x35')]=_[_0x3228('0x37')](_0x3bed91[_0x3228('0x35')],{'$or':_['map'](_0x4e619c,function(_0x206ea7){if(_0x206ea7[_0x3228('0x38')]!==_0x3228('0x39')){var _0x22bcda={};_0x22bcda[_0x206ea7[_0x3228('0x23')]]={'$like':'%'+_0x11b10d[_0x3228('0x2b')]['filter']+'%'};return _0x22bcda;}})});}_0x3bed91=_['merge']({},_0x3bed91,_0x11b10d['options']);var _0x4795bd={'where':_0x3bed91[_0x3228('0x35')]};return db[_0x3228('0x3a')][_0x3228('0x1a')](_0x4795bd)[_0x3228('0x21')](function(_0x3113f4){_0x2920ea[_0x3228('0x1a')]=_0x3113f4;if(_0x11b10d['query'][_0x3228('0x3b')]){_0x3bed91['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3228('0x3c')](_0x3bed91);})[_0x3228('0x21')](function(_0x12f4d5){_0x2920ea[_0x3228('0x3d')]=_0x12f4d5;return _0x2920ea;})[_0x3228('0x21')](respondWithFilteredResult(_0x49f8ed,_0x3bed91))[_0x3228('0x3e')](handleError(_0x49f8ed,null));};exports[_0x3228('0x3f')]=function(_0x1d332c,_0x4f75ca){var _0x24bce1={'raw':!![],'where':{'id':_0x1d332c[_0x3228('0x40')]['id']}},_0x35a812={};_0x35a812[_0x3228('0x2a')]=_['keys'](db[_0x3228('0x3a')][_0x3228('0x27')]);_0x35a812['query']=_[_0x3228('0x2c')](_0x1d332c[_0x3228('0x2b')]);_0x35a812[_0x3228('0x2d')]=_[_0x3228('0x2e')](_0x35a812[_0x3228('0x2a')],_0x35a812['query']);_0x24bce1[_0x3228('0x2f')]=_[_0x3228('0x2e')](_0x35a812[_0x3228('0x2a')],qs['fields'](_0x1d332c['query']['fields']));_0x24bce1['attributes']=_0x24bce1['attributes']['length']?_0x24bce1[_0x3228('0x2f')]:_0x35a812[_0x3228('0x2a')];if(_0x1d332c[_0x3228('0x2b')][_0x3228('0x3b')]){_0x24bce1[_0x3228('0x41')]=[{'all':!![]}];}_0x24bce1=_[_0x3228('0x37')]({},_0x24bce1,_0x1d332c[_0x3228('0x42')]);return db['JscriptySessionReport'][_0x3228('0x43')](_0x24bce1)[_0x3228('0x21')](handleEntityNotFound(_0x4f75ca,null))[_0x3228('0x21')](respondWithResult(_0x4f75ca,null))[_0x3228('0x3e')](handleError(_0x4f75ca,null));};exports[_0x3228('0x44')]=function(_0x30b525,_0x3e7f8c){return db[_0x3228('0x3a')][_0x3228('0x44')](_0x30b525['body'],{})[_0x3228('0x21')](respondWithResult(_0x3e7f8c,0xc9))['catch'](handleError(_0x3e7f8c,null));};exports[_0x3228('0x45')]=function(_0x57b6cc,_0x4056ea){if(_0x57b6cc[_0x3228('0x46')]['id']){delete _0x57b6cc['body']['id'];}return db[_0x3228('0x3a')][_0x3228('0x43')]({'where':{'id':_0x57b6cc[_0x3228('0x40')]['id']}})[_0x3228('0x21')](handleEntityNotFound(_0x4056ea,null))[_0x3228('0x21')](saveUpdates(_0x57b6cc[_0x3228('0x46')],null))[_0x3228('0x21')](respondWithResult(_0x4056ea,null))['catch'](handleError(_0x4056ea,null));};exports[_0x3228('0x20')]=function(_0xe9a075,_0x4feccd){return db[_0x3228('0x3a')][_0x3228('0x43')]({'where':{'id':_0xe9a075['params']['id']}})[_0x3228('0x21')](handleEntityNotFound(_0x4feccd,null))[_0x3228('0x21')](removeEntity(_0x4feccd,null))['catch'](handleError(_0x4feccd,null));};exports['describe']=function(_0x52fee2,_0x2aca94){return db['JscriptySessionReport'][_0x3228('0x47')]()[_0x3228('0x21')](respondWithResult(_0x2aca94,null))[_0x3228('0x3e')](handleError(_0x2aca94,null));};exports[_0x3228('0x48')]=function(_0x28e2ff,_0x337b50,_0x402824){var _0x3e55c9={'raw':!![],'where':{}};var _0x28abb3={};var _0x366239={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3228('0x49')]({'where':{'id':_0x28e2ff[_0x3228('0x40')]['id']}})[_0x3228('0x21')](handleEntityNotFound(_0x337b50,null))[_0x3228('0x21')](function(_0xb59c86){if(_0xb59c86){_0x28abb3['model']=_[_0x3228('0x2c')](db[_0x3228('0x4a')]['rawAttributes']);_0x28abb3['query']=_[_0x3228('0x2c')](_0x28e2ff[_0x3228('0x2b')]);_0x28abb3[_0x3228('0x2d')]=_[_0x3228('0x2e')](_0x28abb3[_0x3228('0x2a')],_0x28abb3[_0x3228('0x2b')]);_0x3e55c9[_0x3228('0x2f')]=_[_0x3228('0x2e')](_0x28abb3[_0x3228('0x2a')],qs[_0x3228('0x30')](_0x28e2ff[_0x3228('0x2b')][_0x3228('0x30')]));_0x3e55c9[_0x3228('0x2f')]=_0x3e55c9[_0x3228('0x2f')][_0x3228('0x31')]?_0x3e55c9[_0x3228('0x2f')]:_0x28abb3[_0x3228('0x2a')];if(!_0x28e2ff[_0x3228('0x2b')][_0x3228('0x32')]('nolimit')){_0x3e55c9[_0x3228('0x18')]=qs[_0x3228('0x18')](_0x28e2ff[_0x3228('0x2b')][_0x3228('0x18')]);_0x3e55c9[_0x3228('0x1b')]=qs[_0x3228('0x1b')](_0x28e2ff[_0x3228('0x2b')][_0x3228('0x1b')]);}_0x3e55c9[_0x3228('0x33')]=qs['sort'](_0x28e2ff['query'][_0x3228('0x34')]);_0x3e55c9['where']=qs['filters'](_[_0x3228('0x4b')](_0x28e2ff[_0x3228('0x2b')],_0x28abb3[_0x3228('0x2d')]));_0x3e55c9['where'][_0x3228('0x4c')]=_0xb59c86['id'];if(_0x28e2ff[_0x3228('0x2b')]['filter']){_0x3e55c9[_0x3228('0x35')]=_[_0x3228('0x37')](_0x3e55c9[_0x3228('0x35')],{'$or':_[_0x3228('0x26')](_0x3e55c9[_0x3228('0x2f')],function(_0x9c2c8b){var _0x54f44a={};_0x54f44a[_0x9c2c8b]={'$like':'%'+_0x28e2ff[_0x3228('0x2b')]['filter']+'%'};return _0x54f44a;})});}_0x3e55c9=_[_0x3228('0x37')]({},_0x3e55c9,_0x28e2ff[_0x3228('0x42')]);return db[_0x3228('0x4a')][_0x3228('0x1a')]({'where':_0x3e55c9[_0x3228('0x35')]})['then'](function(_0x31af41){_0x366239[_0x3228('0x1a')]=_0x31af41;if(_0x28e2ff[_0x3228('0x2b')][_0x3228('0x3b')]){_0x3e55c9[_0x3228('0x41')]=[{'all':!![]}];}return db[_0x3228('0x4a')][_0x3228('0x3c')](_0x3e55c9);})[_0x3228('0x21')](function(_0xc939f9){_0x366239['rows']=_0xc939f9;return _0x366239;});}})[_0x3228('0x21')](respondWithFilteredResult(_0x337b50,_0x3e55c9))[_0x3228('0x3e')](handleError(_0x337b50,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c4bc9dc..d26aee9 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 _0x723e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x3ae96c,_0x5f1e7e){var _0x1b0c90=function(_0x1ecc83){while(--_0x1ecc83){_0x3ae96c['push'](_0x3ae96c['shift']());}};_0x1b0c90(++_0x5f1e7e);}(_0x723e,0x179));var _0xe723=function(_0x2ec5b9,_0x56e0a3){_0x2ec5b9=_0x2ec5b9-0x0;var _0x10dcea=_0x723e[_0x2ec5b9];return _0x10dcea;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x2bd8,0x130));var _0x82bd=function(_0x2e444a,_0x3edfc4){_0x2e444a=_0x2e444a-0x0;var _0x37a2c0=_0x2bd8[_0x2e444a];return _0x37a2c0;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('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 db94897..43792b2 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 _0x0a6b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','randomstring'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x25237a,_0x5a4bfe){_0x25237a=_0x25237a-0x0;var _0x433d0f=_0x0a6b[_0x25237a];return _0x433d0f;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('JscriptySessionReport,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});} \ No newline at end of file +var _0xb016=['error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4e13f7,_0x91020f){var _0x39282f=function(_0x39cc5d){while(--_0x39cc5d){_0x4e13f7['push'](_0x4e13f7['shift']());}};_0x39282f(++_0x91020f);}(_0xb016,0x159));var _0x6b01=function(_0x309fc3,_0x4a49c6){_0x309fc3=_0x309fc3-0x0;var _0x1bc3a4=_0xb016[_0x309fc3];return _0x1bc3a4;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f43221b..5c04e79 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 _0xdc6c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','index','isAuthenticated','update','/download_log_file','exports','multer','path','connect-timeout','express'];(function(_0x278170,_0x275aea){var _0x42f081=function(_0x437ef9){while(--_0x437ef9){_0x278170['push'](_0x278170['shift']());}};_0x42f081(++_0x275aea);}(_0xdc6c,0xdc));var _0xcdc6=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xdc6c[_0x1bc0ae];return _0x501104;};'use strict';var multer=require(_0xcdc6('0x0'));var util=require('util');var path=require(_0xcdc6('0x1'));var timeout=require(_0xcdc6('0x2'));var express=require(_0xcdc6('0x3'));var router=express[_0xcdc6('0x4')]();var fs_extra=require(_0xcdc6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcdc6('0x6'));var config=require(_0xcdc6('0x7'));var controller=require(_0xcdc6('0x8'));router['get']('/',controller[_0xcdc6('0x9')]);router['put']('/:id',auth[_0xcdc6('0xa')](),controller[_0xcdc6('0xb')]);router['get'](_0xcdc6('0xc'),auth[_0xcdc6('0xa')](),controller['downloadLogFile']);module[_0xcdc6('0xd')]=router; \ No newline at end of file +var _0x72b2=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','put','/:id','update','isAuthenticated','downloadLogFile','exports','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x72b2,0x17d));var _0x272b=function(_0x1c522c,_0x2776f5){_0x1c522c=_0x1c522c-0x0;var _0x3bd977=_0x72b2[_0x1c522c];return _0x3bd977;};'use strict';var multer=require('multer');var util=require(_0x272b('0x0'));var path=require(_0x272b('0x1'));var timeout=require(_0x272b('0x2'));var express=require(_0x272b('0x3'));var router=express[_0x272b('0x4')]();var fs_extra=require(_0x272b('0x5'));var auth=require(_0x272b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x272b('0x7'));var controller=require('./license.controller');router[_0x272b('0x8')]('/',controller[_0x272b('0x9')]);router[_0x272b('0xa')](_0x272b('0xb'),auth['isAuthenticated'](),controller[_0x272b('0xc')]);router[_0x272b('0x8')]('/download_log_file',auth[_0x272b('0xd')](),controller[_0x272b('0xe')]);module[_0x272b('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index aa08e2c..c0e10cd 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 _0xe8af=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe8af,0xe2));var _0xfe8a=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xe8af[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0xfe8a('0x0'));module[_0xfe8a('0x1')]={'license':{'type':Sequelize[_0xfe8a('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xfe8a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xfe8a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d74=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x129ff1,_0x39287d){var _0x39037e=function(_0x5a710b){while(--_0x5a710b){_0x129ff1['push'](_0x129ff1['shift']());}};_0x39037e(++_0x39287d);}(_0x9d74,0x95));var _0x49d7=function(_0x359d3e,_0x9d9e5b){_0x359d3e=_0x359d3e-0x0;var _0x533931=_0x9d74[_0x359d3e];return _0x533931;};'use strict';var Sequelize=require(_0x49d7('0x0'));module[_0x49d7('0x1')]={'license':{'type':Sequelize[_0x49d7('0x2')]},'data1':{'type':Sequelize[_0x49d7('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x49d7('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 196a2ab..4f21364 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 _0x98dc=['query','filters','intersection','fields','attributes','options','getLicense','catch','body','find','params','get','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','error','stack','name','../../config/license/util','index','model','keys','License','rawAttributes'];(function(_0x57e046,_0x256721){var _0x33b93b=function(_0x18fe98){while(--_0x18fe98){_0x57e046['push'](_0x57e046['shift']());}};_0x33b93b(++_0x256721);}(_0x98dc,0x18c));var _0xc98d=function(_0x508df2,_0x301400){_0x508df2=_0x508df2-0x0;var _0x407025=_0x98dc[_0x508df2];return _0x407025;};'use strict';var emlformat=require(_0xc98d('0x0'));var rimraf=require(_0xc98d('0x1'));var zipdir=require(_0xc98d('0x2'));var jsonpatch=require(_0xc98d('0x3'));var rp=require(_0xc98d('0x4'));var moment=require(_0xc98d('0x5'));var BPromise=require(_0xc98d('0x6'));var Mustache=require(_0xc98d('0x7'));var util=require(_0xc98d('0x8'));var path=require('path');var sox=require(_0xc98d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc98d('0xa'));var _=require(_0xc98d('0xb'));var squel=require(_0xc98d('0xc'));var crypto=require(_0xc98d('0xd'));var jsforce=require(_0xc98d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc98d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc98d('0x10'));var authService=require(_0xc98d('0x11'));var qs=require(_0xc98d('0x12'));var as=require(_0xc98d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc98d('0x14'))(_0xc98d('0x15'));var utils=require(_0xc98d('0x16'));var config=require(_0xc98d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc98d('0x18'))['db'];function respondWithStatusCode(_0x465e6f,_0x4eb885){_0x4eb885=_0x4eb885||0xcc;return function(_0xd0651f){if(_0xd0651f){return _0x465e6f[_0xc98d('0x19')](_0x4eb885);}return _0x465e6f[_0xc98d('0x1a')](_0x4eb885)[_0xc98d('0x1b')]();};}function respondWithResult(_0x39ec1e,_0x5c7dcf){_0x5c7dcf=_0x5c7dcf||0xc8;return function(_0x1185e0){if(_0x1185e0){return _0x39ec1e[_0xc98d('0x1a')](_0x5c7dcf)[_0xc98d('0x1c')](_0x1185e0);}};}function respondWithFilteredResult(_0x568e96,_0x287d4a){return function(_0xee87c){if(_0xee87c){var _0x4ea92a=typeof _0x287d4a['offset']===_0xc98d('0x1d')&&typeof _0x287d4a[_0xc98d('0x1e')]==='undefined';var _0x4bf8e3=_0xee87c[_0xc98d('0x1f')];var _0x147885=_0x4ea92a?0x0:_0x287d4a[_0xc98d('0x20')];var _0x15337c=_0x4ea92a?_0xee87c[_0xc98d('0x1f')]:_0x287d4a['offset']+_0x287d4a[_0xc98d('0x1e')];var _0x2e0443;if(_0x15337c>=_0x4bf8e3){_0x15337c=_0x4bf8e3;_0x2e0443=0xc8;}else{_0x2e0443=0xce;}_0x568e96['status'](_0x2e0443);return _0x568e96['set'](_0xc98d('0x21'),_0x147885+'-'+_0x15337c+'/'+_0x4bf8e3)[_0xc98d('0x1c')](_0xee87c);}return null;};}function patchUpdates(_0x288ba0){return function(_0x5a8aca){try{jsonpatch[_0xc98d('0x22')](_0x5a8aca,_0x288ba0,!![]);}catch(_0x37232d){return BPromise[_0xc98d('0x23')](_0x37232d);}return _0x5a8aca['save']();};}function saveUpdates(_0x4038bd,_0x36ce95){return function(_0x47af2d){if(_0x47af2d){return _0x47af2d[_0xc98d('0x24')](_0x4038bd)['then'](function(_0x5f13ed){return _0x5f13ed;});}return null;};}function removeEntity(_0x508d15,_0x3c4a03){return function(_0x2c0438){if(_0x2c0438){return _0x2c0438[_0xc98d('0x25')]()[_0xc98d('0x26')](function(){_0x508d15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xeea33a,_0x141f0a){return function(_0xf361f0){if(!_0xf361f0){_0xeea33a[_0xc98d('0x19')](0x194);}return _0xf361f0;};}function handleError(_0x5adec9,_0x4e9b0b){_0x4e9b0b=_0x4e9b0b||0x1f4;return function(_0x16564a){logger[_0xc98d('0x27')](_0x16564a[_0xc98d('0x28')]);if(_0x16564a[_0xc98d('0x29')]){delete _0x16564a[_0xc98d('0x29')];}_0x5adec9['status'](_0x4e9b0b)['send'](_0x16564a);};}var utilLicense=require(_0xc98d('0x2a'));exports[_0xc98d('0x2b')]=function(_0xec8da0,_0x5b2078){var _0x898a50={'raw':!![],'where':{'id':0x1}},_0x15ff29={};_0x15ff29[_0xc98d('0x2c')]=_[_0xc98d('0x2d')](db[_0xc98d('0x2e')][_0xc98d('0x2f')]);_0x15ff29[_0xc98d('0x30')]=_[_0xc98d('0x2d')](_0xec8da0[_0xc98d('0x30')]);_0x15ff29[_0xc98d('0x31')]=_[_0xc98d('0x32')](_0x15ff29[_0xc98d('0x2c')],_0x15ff29[_0xc98d('0x30')]);_0x898a50['attributes']=_[_0xc98d('0x32')](_0x15ff29['model'],qs[_0xc98d('0x33')](_0xec8da0[_0xc98d('0x30')][_0xc98d('0x33')]));_0x898a50[_0xc98d('0x34')]=_0x898a50[_0xc98d('0x34')]['length']?_0x898a50[_0xc98d('0x34')]:_0x15ff29['model'];_0x898a50=_['merge']({},_0x898a50,_0xec8da0[_0xc98d('0x35')]);return utilLicense[_0xc98d('0x36')](_0x898a50)[_0xc98d('0x26')](respondWithResult(_0x5b2078,null))[_0xc98d('0x37')](handleError(_0x5b2078,null));};exports[_0xc98d('0x24')]=function(_0x437162,_0xa310f9){if(_0x437162['body']['id']){delete _0x437162[_0xc98d('0x38')]['id'];}return db[_0xc98d('0x2e')][_0xc98d('0x39')]({'where':{'id':_0x437162[_0xc98d('0x3a')]['id']}})[_0xc98d('0x26')](handleEntityNotFound(_0xa310f9,null))[_0xc98d('0x26')](function(_0xbdf40){var _0x474ad0=_0xbdf40[_0xc98d('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x474ad0,_0x437162[_0xc98d('0x38')][_0xc98d('0x3c')]);})['then'](function(_0x549031){if(!_0x549031[_0xc98d('0x3d')]){return saveUpdates(_0x437162[_0xc98d('0x38')],null);}return _0x549031;})[_0xc98d('0x26')](respondWithResult(_0xa310f9,null))['catch'](handleError(_0xa310f9,null));};exports[_0xc98d('0x3e')]=function(_0x303b02,_0x1f36d5){var _0x39cdb8=_0xc98d('0x3f');var _0x26b1de=path[_0xc98d('0x40')](_0xc98d('0x41'),_0xc98d('0x42'),_0xc98d('0x43'),_0x39cdb8);_0x1f36d5[_0xc98d('0x44')](_0xc98d('0x45'),_0xc98d('0x46')+_0x39cdb8);_0x1f36d5[_0xc98d('0x47')](_0xc98d('0x48'),_0xc98d('0x49'));_0x1f36d5['download'](_0x26b1de);}; \ No newline at end of file +var _0x5466=['end','error','stack','name','send','index','model','keys','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','License','find','params','get','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','save','then','destroy'];(function(_0x93097e,_0x540809){var _0x19598b=function(_0x17ed18){while(--_0x17ed18){_0x93097e['push'](_0x93097e['shift']());}};_0x19598b(++_0x540809);}(_0x5466,0x130));var _0x6546=function(_0x3be99a,_0x2bb191){_0x3be99a=_0x3be99a-0x0;var _0x293907=_0x5466[_0x3be99a];return _0x293907;};'use strict';var emlformat=require(_0x6546('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6546('0x1'));var jsonpatch=require(_0x6546('0x2'));var rp=require(_0x6546('0x3'));var moment=require(_0x6546('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6546('0x5'));var util=require(_0x6546('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6546('0x7'));var ejs=require(_0x6546('0x8'));var fs=require('fs');var fs_extra=require(_0x6546('0x9'));var _=require(_0x6546('0xa'));var squel=require(_0x6546('0xb'));var crypto=require('crypto');var jsforce=require(_0x6546('0xc'));var deskjs=require(_0x6546('0xd'));var toCsv=require(_0x6546('0x7'));var querystring=require(_0x6546('0xe'));var Papa=require(_0x6546('0xf'));var Redis=require(_0x6546('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6546('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6546('0x12'))(_0x6546('0x13'));var utils=require(_0x6546('0x14'));var config=require(_0x6546('0x15'));var licenseUtil=require(_0x6546('0x16'));var db=require(_0x6546('0x17'))['db'];function respondWithStatusCode(_0x51ca52,_0x35327f){_0x35327f=_0x35327f||0xcc;return function(_0x597372){if(_0x597372){return _0x51ca52[_0x6546('0x18')](_0x35327f);}return _0x51ca52['status'](_0x35327f)['end']();};}function respondWithResult(_0x2f0b02,_0x7e81b1){_0x7e81b1=_0x7e81b1||0xc8;return function(_0x3bb2c0){if(_0x3bb2c0){return _0x2f0b02[_0x6546('0x19')](_0x7e81b1)['json'](_0x3bb2c0);}};}function respondWithFilteredResult(_0x2f366e,_0x1b4d83){return function(_0x431a42){if(_0x431a42){var _0x4a397d=typeof _0x1b4d83[_0x6546('0x1a')]===_0x6546('0x1b')&&typeof _0x1b4d83['limit']===_0x6546('0x1b');var _0x45ea06=_0x431a42[_0x6546('0x1c')];var _0x3f80a8=_0x4a397d?0x0:_0x1b4d83['offset'];var _0x229160=_0x4a397d?_0x431a42[_0x6546('0x1c')]:_0x1b4d83[_0x6546('0x1a')]+_0x1b4d83[_0x6546('0x1d')];var _0x31a73b;if(_0x229160>=_0x45ea06){_0x229160=_0x45ea06;_0x31a73b=0xc8;}else{_0x31a73b=0xce;}_0x2f366e[_0x6546('0x19')](_0x31a73b);return _0x2f366e[_0x6546('0x1e')]('Content-Range',_0x3f80a8+'-'+_0x229160+'/'+_0x45ea06)[_0x6546('0x1f')](_0x431a42);}return null;};}function patchUpdates(_0x5cdd54){return function(_0x33c610){try{jsonpatch[_0x6546('0x20')](_0x33c610,_0x5cdd54,!![]);}catch(_0x569534){return BPromise['reject'](_0x569534);}return _0x33c610[_0x6546('0x21')]();};}function saveUpdates(_0x2285aa,_0x64d841){return function(_0x295e89){if(_0x295e89){return _0x295e89['update'](_0x2285aa)[_0x6546('0x22')](function(_0x489e24){return _0x489e24;});}return null;};}function removeEntity(_0x587f9f,_0x59746c){return function(_0x3fabad){if(_0x3fabad){return _0x3fabad[_0x6546('0x23')]()[_0x6546('0x22')](function(){_0x587f9f[_0x6546('0x19')](0xcc)[_0x6546('0x24')]();});}};}function handleEntityNotFound(_0x5db633,_0x9e94cb){return function(_0x4cea6c){if(!_0x4cea6c){_0x5db633['sendStatus'](0x194);}return _0x4cea6c;};}function handleError(_0x1ca618,_0x86fdc2){_0x86fdc2=_0x86fdc2||0x1f4;return function(_0x4c9ee2){logger[_0x6546('0x25')](_0x4c9ee2[_0x6546('0x26')]);if(_0x4c9ee2[_0x6546('0x27')]){delete _0x4c9ee2['name'];}_0x1ca618['status'](_0x86fdc2)[_0x6546('0x28')](_0x4c9ee2);};}var utilLicense=require('../../config/license/util');exports[_0x6546('0x29')]=function(_0x3a8cc9,_0x3240a2){var _0x17b8f7={'raw':!![],'where':{'id':0x1}},_0x1b9c79={};_0x1b9c79[_0x6546('0x2a')]=_[_0x6546('0x2b')](db['License']['rawAttributes']);_0x1b9c79[_0x6546('0x2c')]=_[_0x6546('0x2b')](_0x3a8cc9[_0x6546('0x2c')]);_0x1b9c79['filters']=_[_0x6546('0x2d')](_0x1b9c79[_0x6546('0x2a')],_0x1b9c79[_0x6546('0x2c')]);_0x17b8f7[_0x6546('0x2e')]=_[_0x6546('0x2d')](_0x1b9c79[_0x6546('0x2a')],qs[_0x6546('0x2f')](_0x3a8cc9[_0x6546('0x2c')][_0x6546('0x2f')]));_0x17b8f7[_0x6546('0x2e')]=_0x17b8f7[_0x6546('0x2e')][_0x6546('0x30')]?_0x17b8f7['attributes']:_0x1b9c79[_0x6546('0x2a')];_0x17b8f7=_[_0x6546('0x31')]({},_0x17b8f7,_0x3a8cc9[_0x6546('0x32')]);return utilLicense[_0x6546('0x33')](_0x17b8f7)[_0x6546('0x22')](respondWithResult(_0x3240a2,null))[_0x6546('0x34')](handleError(_0x3240a2,null));};exports['update']=function(_0x1c88e3,_0x2e2eb0){if(_0x1c88e3[_0x6546('0x35')]['id']){delete _0x1c88e3[_0x6546('0x35')]['id'];}return db[_0x6546('0x36')][_0x6546('0x37')]({'where':{'id':_0x1c88e3[_0x6546('0x38')]['id']}})[_0x6546('0x22')](handleEntityNotFound(_0x2e2eb0,null))[_0x6546('0x22')](function(_0x268637){var _0x18b713=_0x268637[_0x6546('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x18b713,_0x1c88e3[_0x6546('0x35')][_0x6546('0x3a')]);})[_0x6546('0x22')](function(_0x39d154){if(!_0x39d154[_0x6546('0x3b')]){return saveUpdates(_0x1c88e3[_0x6546('0x35')],null);}return _0x39d154;})[_0x6546('0x22')](respondWithResult(_0x2e2eb0,null))['catch'](handleError(_0x2e2eb0,null));};exports[_0x6546('0x3c')]=function(_0xdecf79,_0x3633dc){var _0x2a5668=_0x6546('0x3d');var _0x31a71b=path[_0x6546('0x3e')](_0x6546('0x3f'),_0x6546('0x40'),'xcally',_0x2a5668);_0x3633dc[_0x6546('0x41')](_0x6546('0x42'),'attachment;\x20filename='+_0x2a5668);_0x3633dc[_0x6546('0x1e')]('Content-Type','text/plain');_0x3633dc[_0x6546('0x43')](_0x31a71b);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d0a6ba4..60d7d41 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 _0xa99a=['./license.attributes','define','license','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0xa99a,0xa8));var _0xaa99=function(_0x2f4b0e,_0x55dc8c){_0x2f4b0e=_0x2f4b0e-0x0;var _0x55acd5=_0xa99a[_0x2f4b0e];return _0x55acd5;};'use strict';var _=require(_0xaa99('0x0'));var util=require('util');var logger=require(_0xaa99('0x1'))(_0xaa99('0x2'));var moment=require(_0xaa99('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa99('0x4'));var fs=require('fs');var path=require(_0xaa99('0x5'));var rimraf=require(_0xaa99('0x6'));var config=require(_0xaa99('0x7'));var attributes=require(_0xaa99('0x8'));module['exports']=function(_0x39d744,_0x368b66){return _0x39d744[_0xaa99('0x9')]('License',attributes,{'tableName':_0xaa99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb3=['../../config/environment','define','License','lodash','api','moment','bluebird','path','rimraf'];(function(_0xa4d51f,_0xb8d9d1){var _0x5ad085=function(_0x1c7e85){while(--_0x1c7e85){_0xa4d51f['push'](_0xa4d51f['shift']());}};_0x5ad085(++_0xb8d9d1);}(_0xdbb3,0xb7));var _0x3dbb=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xdbb3[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x3dbb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3dbb('0x1'));var moment=require(_0x3dbb('0x2'));var BPromise=require(_0x3dbb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dbb('0x4'));var rimraf=require(_0x3dbb('0x5'));var config=require(_0x3dbb('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x575cb2,_0x7288ee){return _0x575cb2[_0x3dbb('0x7')](_0x3dbb('0x8'),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 a6bc864..707a844 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 _0xf111=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf111,0x15b));var _0x1f11=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xf111[_0xcf4569];return _0x7fef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f11('0x0'));var BPromise=require(_0x1f11('0x1'));var rs=require(_0x1f11('0x2'));var fs=require('fs');var Redis=require(_0x1f11('0x3'));var db=require(_0x1f11('0x4'))['db'];var utils=require(_0x1f11('0x5'));var logger=require(_0x1f11('0x6'))(_0x1f11('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f11('0x8'));var client=jayson[_0x1f11('0x9')][_0x1f11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f91de,_0x2fdfb6,_0x29d456){return new BPromise(function(_0x4fd816,_0x1995dc){return client['request'](_0x2f91de,_0x29d456)[_0x1f11('0xb')](function(_0x22e28c){logger[_0x1f11('0xc')](_0x1f11('0xd'),_0x2fdfb6,_0x1f11('0xe'));logger[_0x1f11('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x2fdfb6,_0x1f11('0xe'),JSON[_0x1f11('0x10')](_0x22e28c));if(_0x22e28c[_0x1f11('0x11')]){if(_0x22e28c[_0x1f11('0x11')][_0x1f11('0x12')]===0x1f4){logger[_0x1f11('0x11')]('License,\x20%s,\x20%s',_0x2fdfb6,_0x22e28c[_0x1f11('0x11')][_0x1f11('0x13')]);return _0x1995dc(_0x22e28c[_0x1f11('0x11')][_0x1f11('0x13')]);}logger[_0x1f11('0x11')](_0x1f11('0xd'),_0x2fdfb6,_0x22e28c[_0x1f11('0x11')][_0x1f11('0x13')]);return _0x4fd816(_0x22e28c[_0x1f11('0x11')]['message']);}else{logger[_0x1f11('0xc')](_0x1f11('0xd'),_0x2fdfb6,_0x1f11('0xe'));_0x4fd816(_0x22e28c[_0x1f11('0x14')]['message']);}})[_0x1f11('0x15')](function(_0x5a55f0){logger[_0x1f11('0x11')]('License,\x20%s,\x20%s',_0x2fdfb6,_0x5a55f0);_0x1995dc(_0x5a55f0);});});} \ No newline at end of file +var _0xbefd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5e34fb,_0x5de501){var _0x59c123=function(_0x491ad6){while(--_0x491ad6){_0x5e34fb['push'](_0x5e34fb['shift']());}};_0x59c123(++_0x5de501);}(_0xbefd,0x1c7));var _0xdbef=function(_0x251651,_0x280cdc){_0x251651=_0x251651-0x0;var _0x4d6462=_0xbefd[_0x251651];return _0x4d6462;};'use strict';var _=require(_0xdbef('0x0'));var util=require(_0xdbef('0x1'));var moment=require(_0xdbef('0x2'));var BPromise=require(_0xdbef('0x3'));var rs=require(_0xdbef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdbef('0x6'))(_0xdbef('0x7'));var config=require(_0xdbef('0x8'));var jayson=require(_0xdbef('0x9'));var client=jayson['client'][_0xdbef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c0739,_0x24e703,_0x63e5f2){return new BPromise(function(_0x8303c3,_0x53a093){return client[_0xdbef('0xb')](_0x4c0739,_0x63e5f2)[_0xdbef('0xc')](function(_0x2155a5){logger['info'](_0xdbef('0xd'),_0x24e703,_0xdbef('0xe'));logger[_0xdbef('0xf')](_0xdbef('0x10'),_0x24e703,'request\x20sent',JSON[_0xdbef('0x11')](_0x2155a5));if(_0x2155a5['error']){if(_0x2155a5[_0xdbef('0x12')][_0xdbef('0x13')]===0x1f4){logger['error'](_0xdbef('0xd'),_0x24e703,_0x2155a5[_0xdbef('0x12')][_0xdbef('0x14')]);return _0x53a093(_0x2155a5[_0xdbef('0x12')][_0xdbef('0x14')]);}logger[_0xdbef('0x12')](_0xdbef('0xd'),_0x24e703,_0x2155a5[_0xdbef('0x12')]['message']);return _0x8303c3(_0x2155a5[_0xdbef('0x12')][_0xdbef('0x14')]);}else{logger['info'](_0xdbef('0xd'),_0x24e703,_0xdbef('0xe'));_0x8303c3(_0x2155a5[_0xdbef('0x15')]['message']);}})[_0xdbef('0x16')](function(_0x4048f0){logger[_0xdbef('0x12')](_0xdbef('0xd'),_0x24e703,_0x4048f0);_0x53a093(_0x4048f0);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 850a553..f2acff2 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 _0x1829=['/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','addAgents','put','removeDispositions','removeAnswers','delete','removeImap','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x1829,0x73));var _0x9182=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x1829[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x9182('0x0'));var util=require('util');var path=require(_0x9182('0x1'));var timeout=require(_0x9182('0x2'));var express=require(_0x9182('0x3'));var router=express[_0x9182('0x4')]();var fs_extra=require(_0x9182('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9182('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x9182('0x7')](),controller[_0x9182('0x8')]);router[_0x9182('0x9')](_0x9182('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9182('0x9')](_0x9182('0xb'),auth['isAuthenticated'](),controller[_0x9182('0xc')]);router[_0x9182('0x9')](_0x9182('0xd'),auth['isAuthenticated'](),controller[_0x9182('0xe')]);router[_0x9182('0x9')](_0x9182('0xf'),auth['isAuthenticated'](),controller[_0x9182('0x10')]);router['get'](_0x9182('0x11'),auth[_0x9182('0x7')](),controller[_0x9182('0x12')]);router[_0x9182('0x9')]('/:id/out_servers',auth[_0x9182('0x7')](),controller[_0x9182('0x13')]);router[_0x9182('0x9')](_0x9182('0x14'),auth[_0x9182('0x7')](),controller[_0x9182('0x15')]);router[_0x9182('0x9')](_0x9182('0x16'),auth[_0x9182('0x7')](),controller[_0x9182('0x17')]);router[_0x9182('0x9')](_0x9182('0x18'),auth[_0x9182('0x7')](),controller[_0x9182('0x19')]);router[_0x9182('0x9')](_0x9182('0x1a'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x9182('0x9')](_0x9182('0x1b'),auth[_0x9182('0x7')](),controller[_0x9182('0x1c')]);router[_0x9182('0x1d')](_0x9182('0xd'),auth['isAuthenticated'](),controller[_0x9182('0x1e')]);router['post']('/:id/canned_answers',auth[_0x9182('0x7')](),controller[_0x9182('0x1f')]);router[_0x9182('0x1d')]('/',auth[_0x9182('0x7')](),controller[_0x9182('0x20')]);router[_0x9182('0x1d')](_0x9182('0x11'),auth[_0x9182('0x7')](),controller[_0x9182('0x21')]);router[_0x9182('0x1d')](_0x9182('0x22'),auth[_0x9182('0x7')](),controller[_0x9182('0x23')]);router[_0x9182('0x1d')](_0x9182('0x14'),auth[_0x9182('0x7')](),controller[_0x9182('0x24')]);router[_0x9182('0x1d')](_0x9182('0x16'),auth[_0x9182('0x7')](),controller['addApplications']);router[_0x9182('0x1d')](_0x9182('0x25'),auth[_0x9182('0x7')](),controller[_0x9182('0x26')]);router[_0x9182('0x1d')](_0x9182('0x1b'),auth['isAuthenticated'](),controller[_0x9182('0x27')]);router[_0x9182('0x28')](_0x9182('0xb'),auth[_0x9182('0x7')](),controller['update']);router['delete'](_0x9182('0xd'),auth[_0x9182('0x7')](),controller[_0x9182('0x29')]);router['delete'](_0x9182('0xf'),auth['isAuthenticated'](),controller[_0x9182('0x2a')]);router[_0x9182('0x2b')](_0x9182('0x11'),auth[_0x9182('0x7')](),controller[_0x9182('0x2c')]);router[_0x9182('0x2b')](_0x9182('0x22'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x9182('0x2b')](_0x9182('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x9182('0x2b')](_0x9182('0x1b'),auth[_0x9182('0x7')](),controller[_0x9182('0x2d')]);module[_0x9182('0x2e')]=router; \ No newline at end of file +var _0xc141=['destroy','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','index','/describe','isAuthenticated','show','get','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/in_servers','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xc141,0x65));var _0x1c14=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0xc141[_0x2b4448];return _0xb4b465;};'use strict';var multer=require(_0x1c14('0x0'));var util=require(_0x1c14('0x1'));var path=require('path');var timeout=require(_0x1c14('0x2'));var express=require(_0x1c14('0x3'));var router=express['Router']();var fs_extra=require(_0x1c14('0x4'));var auth=require(_0x1c14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c14('0x6'));var controller=require(_0x1c14('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c14('0x8')]);router['get'](_0x1c14('0x9'),auth[_0x1c14('0xa')](),controller['describe']);router['get']('/:id',auth[_0x1c14('0xa')](),controller[_0x1c14('0xb')]);router[_0x1c14('0xc')](_0x1c14('0xd'),auth[_0x1c14('0xa')](),controller['getDispositions']);router[_0x1c14('0xc')](_0x1c14('0xe'),auth['isAuthenticated'](),controller[_0x1c14('0xf')]);router[_0x1c14('0xc')]('/:id/in_servers',auth[_0x1c14('0xa')](),controller[_0x1c14('0x10')]);router['get']('/:id/out_servers',auth[_0x1c14('0xa')](),controller[_0x1c14('0x11')]);router['get'](_0x1c14('0x12'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x13')]);router['get'](_0x1c14('0x14'),auth['isAuthenticated'](),controller[_0x1c14('0x15')]);router[_0x1c14('0xc')](_0x1c14('0x16'),auth['isAuthenticated'](),controller['getMessages']);router[_0x1c14('0xc')](_0x1c14('0x17'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x18')]);router[_0x1c14('0xc')](_0x1c14('0x19'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x1a')]);router[_0x1c14('0x1b')](_0x1c14('0xd'),auth[_0x1c14('0xa')](),controller['addDisposition']);router[_0x1c14('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1c14('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1c14('0x1d')]);router[_0x1c14('0x1b')](_0x1c14('0x1e'),auth[_0x1c14('0xa')](),controller['addImap']);router[_0x1c14('0x1b')](_0x1c14('0x1f'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x20')]);router['post'](_0x1c14('0x12'),auth['isAuthenticated'](),controller[_0x1c14('0x21')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x1c14('0x22')]);router[_0x1c14('0x1b')](_0x1c14('0x23'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x24')]);router['post'](_0x1c14('0x19'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x25')]);router[_0x1c14('0x26')](_0x1c14('0x27'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x28')]);router['delete'](_0x1c14('0xd'),auth['isAuthenticated'](),controller[_0x1c14('0x29')]);router[_0x1c14('0x2a')](_0x1c14('0xe'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x2b')]);router[_0x1c14('0x2a')]('/:id/in_servers',auth[_0x1c14('0xa')](),controller[_0x1c14('0x2c')]);router['delete'](_0x1c14('0x1f'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x2d')]);router['delete'](_0x1c14('0x27'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x2e')]);router[_0x1c14('0x2a')](_0x1c14('0x19'),auth[_0x1c14('0xa')](),controller[_0x1c14('0x2f')]);module[_0x1c14('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3ca1af1..938acd0 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 _0x595b=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','ENUM','gmail','hotmail','getDataValue','provider','setDataValue','sequelize'];(function(_0x58c7f4,_0x4457cc){var _0x4fea33=function(_0x1c2ba1){while(--_0x1c2ba1){_0x58c7f4['push'](_0x58c7f4['shift']());}};_0x4fea33(++_0x4457cc);}(_0x595b,0x12f));var _0xb595=function(_0x52fe71,_0x496a16){_0x52fe71=_0x52fe71-0x0;var _0xfa726c=_0x595b[_0x52fe71];return _0xfa726c;};'use strict';var Sequelize=require(_0xb595('0x0'));module[_0xb595('0x1')]={'description':{'type':Sequelize[_0xb595('0x2')]},'name':{'type':Sequelize[_0xb595('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xb595('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb595('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xb595('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xb595('0x4')]},'markAsUnread':{'type':Sequelize[_0xb595('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb595('0x2')],'allowNull':![],'defaultValue':_0xb595('0x5')},'fontSize':{'type':Sequelize[_0xb595('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb595('0x4')],'defaultValue':function(){return _0xb595('0x7');}},'notificationSound':{'type':Sequelize[_0xb595('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb595('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb595('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb595('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb595('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb595('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f2f51){if(!_0x3f2f51)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xb595('0x9'),_0x3f2f51);}},'provider':{'type':Sequelize[_0xb595('0xa')](_0xb595('0xb'),_0xb595('0xc'),'yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0xb595('0xd')](_0xb595('0xe')))return'custom';return this[_0xb595('0xd')](_0xb595('0xe'));},'set':function(_0x5e69ed){if(_0x5e69ed==='custom')_0x5e69ed=null;return this[_0xb595('0xf')]('provider',_0x5e69ed);}}}; \ No newline at end of file +var _0x6a39=['UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0x6a39,0x198));var _0x96a3=function(_0xb819a5,_0x40af38){_0xb819a5=_0xb819a5-0x0;var _0x27a3a0=_0x6a39[_0xb819a5];return _0x27a3a0;};'use strict';var Sequelize=require(_0x96a3('0x0'));module[_0x96a3('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x96a3('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x96a3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x96a3('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x96a3('0x2')],'allowNull':![],'defaultValue':_0x96a3('0x4')},'fontSize':{'type':Sequelize[_0x96a3('0x5')](0x2)[_0x96a3('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x96a3('0x7')],'defaultValue':function(){return _0x96a3('0x8');}},'notificationSound':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x96a3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x96a3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x96a3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x96a3('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x96a3('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x96a3('0xa'),'set':function(_0x148e2b){if(!_0x148e2b)this[_0x96a3('0xb')](_0x96a3('0xc'),null);this[_0x96a3('0xb')]('mandatoryDisposition',_0x148e2b);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail',_0x96a3('0xd'),_0x96a3('0xe')),'defaultValue':null,'get':function(){if(!this[_0x96a3('0xf')]('provider'))return _0x96a3('0x10');return this['getDataValue'](_0x96a3('0x11'));},'set':function(_0x2e6391){if(_0x2e6391==='custom')_0x2e6391=null;return this[_0x96a3('0xb')](_0x96a3('0x11'),_0x2e6391);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 18e2768..80ff31e 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 _0x1fd8=['Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','get','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','find','body','modernAuthentication','CloudProviderId','Pause','update','describe','params','Disposition','create','findOne','pick','MailAccountId','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','provider','custom','email','ListId','isNil','active','description','user','username','pass','password','service','port','authentication','host','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','Tags','color','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','messageId','out','Interaction','Messages','verifySmtp','CloudProvider','OAuth2','data5','destroy'];(function(_0x2ad4e0,_0x52fd3c){var _0x1c5eff=function(_0x42ecc2){while(--_0x42ecc2){_0x2ad4e0['push'](_0x2ad4e0['shift']());}};_0x1c5eff(++_0x52fd3c);}(_0x1fd8,0x179));var _0x81fd=function(_0x41196a,_0x390a35){_0x41196a=_0x41196a-0x0;var _0x2ffd61=_0x1fd8[_0x41196a];return _0x2ffd61;};'use strict';var moment=require(_0x81fd('0x0'));var BPromise=require('bluebird');var util=require(_0x81fd('0x1'));var path=require(_0x81fd('0x2'));var _=require(_0x81fd('0x3'));var juice=require(_0x81fd('0x4'));var Redis=require(_0x81fd('0x5'));var qs=require(_0x81fd('0x6'));var logger=require(_0x81fd('0x7'))(_0x81fd('0x8'));var config=require(_0x81fd('0x9'));var db=require(_0x81fd('0xa'))['db'];config['redis']=_[_0x81fd('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81fd('0xc'))(new Redis(config[_0x81fd('0xd')]));require('./mailAccount.socket')[_0x81fd('0xe')](socket);var jayson=require(_0x81fd('0xf'));var client=jayson['client'][_0x81fd('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x2889c3,_0x1cefe9,_0x7bc07b,_0x30a922){return new BPromise(function(_0xce781d,_0x55ee54){var _0x339cfe=_0x30a922||client;return _0x339cfe[_0x81fd('0x11')](_0x2889c3,_0x7bc07b)['then'](function(_0x2d9ba5){logger['info'](_0x81fd('0x12'),_0x1cefe9,_0x81fd('0x13'));logger[_0x81fd('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1cefe9,_0x81fd('0x13'),JSON[_0x81fd('0x15')](_0x2d9ba5));if(_0x2d9ba5['error']){if(_0x2d9ba5[_0x81fd('0x16')][_0x81fd('0x17')]===0x1f4){logger[_0x81fd('0x16')]('MailAccount,\x20%s,\x20%s',_0x1cefe9,_0x2d9ba5['error']['message']);return _0x55ee54(_0x2d9ba5[_0x81fd('0x16')][_0x81fd('0x18')]);}logger[_0x81fd('0x16')](_0x81fd('0x12'),_0x1cefe9,_0x2d9ba5[_0x81fd('0x16')][_0x81fd('0x18')]);return _0xce781d(_0x2d9ba5[_0x81fd('0x16')]['message']);}else{logger['info'](_0x81fd('0x12'),_0x1cefe9,_0x81fd('0x13'));_0xce781d(_0x2d9ba5[_0x81fd('0x19')][_0x81fd('0x18')]);}})[_0x81fd('0x1a')](function(_0x17e627){logger['error'](_0x81fd('0x12'),_0x1cefe9,_0x17e627);_0x55ee54(_0x17e627);});});}function respondWithStatusCode(_0x195626,_0x5c2208){_0x5c2208=_0x5c2208||0xcc;return function(_0x37622c){if(_0x37622c){return _0x195626[_0x81fd('0x1b')](_0x5c2208);}return _0x195626[_0x81fd('0x1c')](_0x5c2208)[_0x81fd('0x1d')]();};}function respondWithResult(_0xc7d6dd,_0x207b73){_0x207b73=_0x207b73||0xc8;return function(_0x299d74){if(_0x299d74){return _0xc7d6dd[_0x81fd('0x1c')](_0x207b73)[_0x81fd('0x1e')](_0x299d74);}};}function respondWithFilteredResult(_0x3856c9,_0x28abf7){return function(_0x4a1387){if(_0x4a1387){var _0x385eaf=typeof _0x28abf7['offset']===_0x81fd('0x1f')&&typeof _0x28abf7[_0x81fd('0x20')]===_0x81fd('0x1f');var _0x15d540=_0x4a1387[_0x81fd('0x21')];var _0x347082=_0x385eaf?0x0:_0x28abf7[_0x81fd('0x22')];var _0x45dc04=_0x385eaf?_0x4a1387[_0x81fd('0x21')]:_0x28abf7[_0x81fd('0x22')]+_0x28abf7[_0x81fd('0x20')];var _0x4240ce;if(_0x45dc04>=_0x15d540){_0x45dc04=_0x15d540;_0x4240ce=0xc8;}else{_0x4240ce=0xce;}_0x3856c9[_0x81fd('0x1c')](_0x4240ce);return _0x3856c9[_0x81fd('0x23')](_0x81fd('0x24'),_0x347082+'-'+_0x45dc04+'/'+_0x15d540)[_0x81fd('0x1e')](_0x4a1387);}return null;};}function saveUpdates(_0x51a766){return function(_0x1f140b){if(_0x1f140b){return _0x1f140b['update'](_0x51a766)[_0x81fd('0x25')](function(_0x2f82fe){return _0x2f82fe;});}return null;};}function removeEntity(_0x4f4b3b){return function(_0x234706){if(_0x234706){return _0x234706['destroy']()[_0x81fd('0x25')](function(){var _0x339d7c=_0x234706[_0x81fd('0x26')]({'plain':!![]});var _0xfd8fda='MailAccounts';return db[_0x81fd('0x27')]['destroy']({'where':{'type':_0xfd8fda,'resourceId':_0x339d7c['id']}})[_0x81fd('0x25')](function(){return _0x234706;});})[_0x81fd('0x25')](function(){_0x4f4b3b['status'](0xcc)[_0x81fd('0x1d')]();});}};}function handleEntityNotFound(_0x545b0c){return function(_0x14bf18){if(!_0x14bf18){_0x545b0c[_0x81fd('0x1b')](0x194);}return _0x14bf18;};}function handleError(_0x417cf7,_0x473cb7){_0x473cb7=_0x473cb7||0x1f4;return function(_0x2f1920){logger[_0x81fd('0x16')](_0x2f1920[_0x81fd('0x28')]);if(_0x2f1920[_0x81fd('0x29')]){delete _0x2f1920[_0x81fd('0x29')];}_0x417cf7[_0x81fd('0x1c')](_0x473cb7)[_0x81fd('0x2a')](_0x2f1920);};}exports[_0x81fd('0x2b')]=function(_0x3ce9b4,_0x1ad227){var _0x1e7e60={'include':[{'model':db[_0x81fd('0x2c')],'as':_0x81fd('0x2d')},{'model':db[_0x81fd('0x2e')],'as':_0x81fd('0x2f')},{'model':db['Pause'],'as':_0x81fd('0x30')}]},_0x1a05b9={},_0x4f1311={'count':0x0,'rows':[]};var _0x346761=_[_0x81fd('0x31')](db[_0x81fd('0x32')][_0x81fd('0x33')],function(_0x4281c6){return{'name':_0x4281c6[_0x81fd('0x34')],'type':_0x4281c6[_0x81fd('0x35')][_0x81fd('0x36')]};});_0x1a05b9[_0x81fd('0x37')]=_[_0x81fd('0x31')](_0x346761,_0x81fd('0x29'));_0x1a05b9[_0x81fd('0x38')]=_[_0x81fd('0x39')](_0x3ce9b4['query']);_0x1a05b9[_0x81fd('0x3a')]=_[_0x81fd('0x3b')](_0x1a05b9[_0x81fd('0x37')],_0x1a05b9[_0x81fd('0x38')]);_0x1e7e60['attributes']=_[_0x81fd('0x3b')](_0x1a05b9[_0x81fd('0x37')],qs[_0x81fd('0x3c')](_0x3ce9b4[_0x81fd('0x38')][_0x81fd('0x3c')]));_0x1e7e60['attributes']=_0x1e7e60[_0x81fd('0x3d')][_0x81fd('0x3e')]?_0x1e7e60[_0x81fd('0x3d')]:_0x1a05b9['model'];if(!_0x3ce9b4[_0x81fd('0x38')][_0x81fd('0x3f')](_0x81fd('0x40'))){_0x1e7e60['limit']=qs[_0x81fd('0x20')](_0x3ce9b4['query'][_0x81fd('0x20')]);_0x1e7e60['offset']=qs[_0x81fd('0x22')](_0x3ce9b4[_0x81fd('0x38')][_0x81fd('0x22')]);}_0x1e7e60[_0x81fd('0x41')]=qs['sort'](_0x3ce9b4[_0x81fd('0x38')][_0x81fd('0x42')]);_0x1e7e60[_0x81fd('0x43')]=qs[_0x81fd('0x3a')](_['pick'](_0x3ce9b4[_0x81fd('0x38')],_0x1a05b9['filters']),_0x346761);if(_0x3ce9b4[_0x81fd('0x38')][_0x81fd('0x44')]){_0x1e7e60[_0x81fd('0x43')]=_['merge'](_0x1e7e60[_0x81fd('0x43')],{'$or':_[_0x81fd('0x31')](_0x346761,function(_0x2e5a89){if(_0x2e5a89['type']!==_0x81fd('0x45')){var _0x636f08={};_0x636f08[_0x2e5a89['name']]={'$like':'%'+_0x3ce9b4['query'][_0x81fd('0x44')]+'%'};return _0x636f08;}})});}_0x1e7e60=_[_0x81fd('0x46')]({},_0x1e7e60,_0x3ce9b4[_0x81fd('0x47')]);var _0x2c06b6={'where':_0x1e7e60[_0x81fd('0x43')]};return db[_0x81fd('0x32')][_0x81fd('0x21')](_0x2c06b6)[_0x81fd('0x25')](function(_0x214db4){_0x4f1311[_0x81fd('0x21')]=_0x214db4;if(_0x3ce9b4[_0x81fd('0x38')]['includeAll']){_0x1e7e60[_0x81fd('0x48')]=[{'all':!![]}];}return db['MailAccount'][_0x81fd('0x49')](_0x1e7e60);})['then'](function(_0x2d9479){_0x4f1311[_0x81fd('0x4a')]=_0x2d9479;return _0x4f1311;})[_0x81fd('0x25')](respondWithFilteredResult(_0x1ad227,_0x1e7e60))['catch'](handleError(_0x1ad227,null));};exports[_0x81fd('0x4b')]=function(_0xf1694a,_0x16f3e1){var _0x1905fe={'raw':![],'where':{'id':_0xf1694a['params']['id']},'include':[{'model':db[_0x81fd('0x2c')],'as':_0x81fd('0x2d')},{'model':db[_0x81fd('0x2e')],'as':_0x81fd('0x2f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3ba943={};_0x3ba943[_0x81fd('0x37')]=_['keys'](db[_0x81fd('0x32')][_0x81fd('0x33')]);_0x3ba943[_0x81fd('0x38')]=_['keys'](_0xf1694a[_0x81fd('0x38')]);_0x3ba943[_0x81fd('0x3a')]=_[_0x81fd('0x3b')](_0x3ba943['model'],_0x3ba943[_0x81fd('0x38')]);_0x1905fe[_0x81fd('0x3d')]=_[_0x81fd('0x3b')](_0x3ba943[_0x81fd('0x37')],qs[_0x81fd('0x3c')](_0xf1694a[_0x81fd('0x38')][_0x81fd('0x3c')]));_0x1905fe['attributes']=_0x1905fe[_0x81fd('0x3d')]['length']?_0x1905fe[_0x81fd('0x3d')]:_0x3ba943['model'];if(_0xf1694a['query']['includeAll']){_0x1905fe[_0x81fd('0x48')]=[{'all':!![]}];}_0x1905fe=_['merge']({},_0x1905fe,_0xf1694a[_0x81fd('0x47')]);return db[_0x81fd('0x32')][_0x81fd('0x4c')](_0x1905fe)[_0x81fd('0x25')](handleEntityNotFound(_0x16f3e1,null))[_0x81fd('0x25')](respondWithResult(_0x16f3e1,null))[_0x81fd('0x1a')](handleError(_0x16f3e1,null));};exports['update']=function(_0x31b130,_0x49a1f3){if(_0x31b130[_0x81fd('0x4d')]['id']){delete _0x31b130[_0x81fd('0x4d')]['id'];}if(_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2d')]){if(!_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2d')][_0x81fd('0x4e')]){_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2d')][_0x81fd('0x4f')]=null;}}if(_0x31b130['body']['Smtp']){if(!_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2f')][_0x81fd('0x4e')]){_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2f')][_0x81fd('0x4f')]=null;}}return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0x31b130['params']['id']},'include':[{'model':db[_0x81fd('0x2c')],'as':_0x81fd('0x2d')},{'model':db[_0x81fd('0x2e')],'as':'Smtp'},{'model':db[_0x81fd('0x50')],'as':_0x81fd('0x30')}]})['then'](handleEntityNotFound(_0x49a1f3,null))[_0x81fd('0x25')](saveUpdates(_0x31b130[_0x81fd('0x4d')],null))[_0x81fd('0x25')](function(_0x40e836){if(_0x40e836&&_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2d')]){return db[_0x81fd('0x2c')][_0x81fd('0x51')](_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2d')],{'where':{'MailAccountId':_0x40e836['id']}})[_0x81fd('0x25')](function(){return _0x40e836;});}return _0x40e836;})[_0x81fd('0x25')](function(_0x439a8e){if(_0x439a8e&&_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2f')]){return db['MailServerOut'][_0x81fd('0x51')](_0x31b130[_0x81fd('0x4d')][_0x81fd('0x2f')],{'where':{'MailAccountId':_0x439a8e['id']}})['then'](function(){return _0x439a8e;});}return _0x439a8e;})[_0x81fd('0x25')](respondWithResult(_0x49a1f3,null))[_0x81fd('0x1a')](handleError(_0x49a1f3,null));};exports['describe']=function(_0x38c5b0,_0x309a61){return db[_0x81fd('0x32')][_0x81fd('0x52')]()[_0x81fd('0x25')](respondWithResult(_0x309a61,null))[_0x81fd('0x1a')](handleError(_0x309a61,null));};exports['addDisposition']=function(_0x41f816,_0x1fd101){if(_0x41f816['body']['id']){delete _0x41f816[_0x81fd('0x4d')]['id'];}return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0x41f816[_0x81fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fd101,null))['then'](function(_0x430292){if(_0x430292){_0x41f816[_0x81fd('0x4d')]['MailAccountId']=_0x430292['id'];return db[_0x81fd('0x54')][_0x81fd('0x55')](_0x41f816[_0x81fd('0x4d')]);}})[_0x81fd('0x25')](respondWithResult(_0x1fd101,null))['catch'](handleError(_0x1fd101,null));};exports['getDispositions']=function(_0x1a8139,_0x34a8e1){var _0x493b73={'raw':![],'where':{}};var _0x82e73c={};var _0x11b10d={'count':0x0,'rows':[]};return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0x1a8139['params']['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x34a8e1,null))['then'](function(_0x51c486){if(_0x51c486){_0x82e73c[_0x81fd('0x37')]=_[_0x81fd('0x39')](db[_0x81fd('0x54')][_0x81fd('0x33')]);_0x82e73c[_0x81fd('0x38')]=_[_0x81fd('0x39')](_0x1a8139[_0x81fd('0x38')]);_0x82e73c[_0x81fd('0x3a')]=_[_0x81fd('0x3b')](_0x82e73c[_0x81fd('0x37')],_0x82e73c[_0x81fd('0x38')]);_0x493b73[_0x81fd('0x3d')]=_[_0x81fd('0x3b')](_0x82e73c[_0x81fd('0x37')],qs[_0x81fd('0x3c')](_0x1a8139['query'][_0x81fd('0x3c')]));_0x493b73[_0x81fd('0x3d')]=_0x493b73[_0x81fd('0x3d')][_0x81fd('0x3e')]?_0x493b73[_0x81fd('0x3d')]:_0x82e73c[_0x81fd('0x37')];if(!_0x1a8139['query']['hasOwnProperty'](_0x81fd('0x40'))){_0x493b73[_0x81fd('0x20')]=qs['limit'](_0x1a8139[_0x81fd('0x38')][_0x81fd('0x20')]);_0x493b73['offset']=qs['offset'](_0x1a8139['query'][_0x81fd('0x22')]);}_0x493b73[_0x81fd('0x41')]=qs['sort'](_0x1a8139[_0x81fd('0x38')][_0x81fd('0x42')]);_0x493b73[_0x81fd('0x43')]=qs[_0x81fd('0x3a')](_[_0x81fd('0x57')](_0x1a8139[_0x81fd('0x38')],_0x82e73c[_0x81fd('0x3a')]));_0x493b73[_0x81fd('0x43')][_0x81fd('0x58')]=_0x51c486['id'];if(_0x1a8139['query'][_0x81fd('0x44')]){_0x493b73['where']=_[_0x81fd('0x46')](_0x493b73['where'],{'$or':_['map'](_0x493b73[_0x81fd('0x3d')],function(_0x4e8e2d){var _0x30adc8={};_0x30adc8[_0x4e8e2d]={'$like':'%'+_0x1a8139[_0x81fd('0x38')][_0x81fd('0x44')]+'%'};return _0x30adc8;})});}_0x493b73=_[_0x81fd('0x46')]({},_0x493b73,_0x1a8139['options']);return db[_0x81fd('0x54')][_0x81fd('0x21')]({'where':_0x493b73[_0x81fd('0x43')]})['then'](function(_0x5d3351){_0x11b10d[_0x81fd('0x21')]=_0x5d3351;if(_0x1a8139[_0x81fd('0x38')][_0x81fd('0x59')]){_0x493b73['include']=[{'all':!![]}];}return db[_0x81fd('0x54')][_0x81fd('0x49')](_0x493b73);})[_0x81fd('0x25')](function(_0x1b18df){_0x11b10d[_0x81fd('0x4a')]=_0x1b18df;return _0x11b10d;});}})[_0x81fd('0x25')](respondWithFilteredResult(_0x34a8e1,_0x493b73))[_0x81fd('0x1a')](handleError(_0x34a8e1,null));};exports[_0x81fd('0x5a')]=function(_0x506404,_0x1a39ec){return db[_0x81fd('0x32')]['find']({'where':{'id':_0x506404[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x1a39ec,null))[_0x81fd('0x25')](function(_0x2ddd65){if(_0x2ddd65){return _0x2ddd65['removeDispositions'](_0x506404[_0x81fd('0x38')][_0x81fd('0x5b')]);}})['then'](respondWithStatusCode(_0x1a39ec,null))[_0x81fd('0x1a')](handleError(_0x1a39ec,null));};exports[_0x81fd('0x5c')]=function(_0x2b6ce5,_0x107c7c){if(_0x2b6ce5[_0x81fd('0x4d')]['id']){delete _0x2b6ce5['body']['id'];}return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0x2b6ce5[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x107c7c,null))[_0x81fd('0x25')](function(_0x6d7a6b){if(_0x6d7a6b){_0x2b6ce5[_0x81fd('0x4d')][_0x81fd('0x58')]=_0x6d7a6b['id'];return db[_0x81fd('0x5d')][_0x81fd('0x55')](_0x2b6ce5['body']);}})[_0x81fd('0x25')](respondWithResult(_0x107c7c,null))[_0x81fd('0x1a')](handleError(_0x107c7c,null));};exports[_0x81fd('0x5e')]=function(_0x56c07e,_0x4c8ef5){var _0x23ff26={'raw':![],'where':{}};var _0x507878={};var _0x5151e9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x56c07e['params']['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x4c8ef5,null))['then'](function(_0x593a3f){if(_0x593a3f){_0x507878[_0x81fd('0x37')]=_[_0x81fd('0x39')](db[_0x81fd('0x5d')][_0x81fd('0x33')]);_0x507878[_0x81fd('0x38')]=_[_0x81fd('0x39')](_0x56c07e[_0x81fd('0x38')]);_0x507878[_0x81fd('0x3a')]=_[_0x81fd('0x3b')](_0x507878[_0x81fd('0x37')],_0x507878[_0x81fd('0x38')]);_0x23ff26[_0x81fd('0x3d')]=_['intersection'](_0x507878['model'],qs[_0x81fd('0x3c')](_0x56c07e[_0x81fd('0x38')]['fields']));_0x23ff26[_0x81fd('0x3d')]=_0x23ff26[_0x81fd('0x3d')][_0x81fd('0x3e')]?_0x23ff26['attributes']:_0x507878[_0x81fd('0x37')];if(!_0x56c07e[_0x81fd('0x38')]['hasOwnProperty'](_0x81fd('0x40'))){_0x23ff26[_0x81fd('0x20')]=qs[_0x81fd('0x20')](_0x56c07e[_0x81fd('0x38')][_0x81fd('0x20')]);_0x23ff26[_0x81fd('0x22')]=qs['offset'](_0x56c07e[_0x81fd('0x38')]['offset']);}_0x23ff26[_0x81fd('0x41')]=qs[_0x81fd('0x42')](_0x56c07e[_0x81fd('0x38')]['sort']);_0x23ff26[_0x81fd('0x43')]=qs[_0x81fd('0x3a')](_[_0x81fd('0x57')](_0x56c07e[_0x81fd('0x38')],_0x507878[_0x81fd('0x3a')]));_0x23ff26[_0x81fd('0x43')][_0x81fd('0x58')]=_0x593a3f['id'];if(_0x56c07e[_0x81fd('0x38')][_0x81fd('0x44')]){_0x23ff26['where']=_['merge'](_0x23ff26['where'],{'$or':_[_0x81fd('0x31')](_0x23ff26[_0x81fd('0x3d')],function(_0x24c579){var _0x37239f={};_0x37239f[_0x24c579]={'$like':'%'+_0x56c07e[_0x81fd('0x38')][_0x81fd('0x44')]+'%'};return _0x37239f;})});}_0x23ff26=_[_0x81fd('0x46')]({},_0x23ff26,_0x56c07e['options']);return db[_0x81fd('0x5d')]['count']({'where':_0x23ff26[_0x81fd('0x43')]})[_0x81fd('0x25')](function(_0xaacd1a){_0x5151e9[_0x81fd('0x21')]=_0xaacd1a;if(_0x56c07e['query']['includeAll']){_0x23ff26[_0x81fd('0x48')]=[{'all':!![]}];}return db[_0x81fd('0x5d')][_0x81fd('0x49')](_0x23ff26);})[_0x81fd('0x25')](function(_0x257e1a){_0x5151e9[_0x81fd('0x4a')]=_0x257e1a;return _0x5151e9;});}})['then'](respondWithFilteredResult(_0x4c8ef5,_0x23ff26))[_0x81fd('0x1a')](handleError(_0x4c8ef5,null));};exports[_0x81fd('0x5f')]=function(_0xb52c61,_0x5353f9){return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0xb52c61[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x5353f9,null))[_0x81fd('0x25')](function(_0xf63ae){if(_0xf63ae){return _0xf63ae[_0x81fd('0x5f')](_0xb52c61['query'][_0x81fd('0x5b')]);}})[_0x81fd('0x25')](respondWithStatusCode(_0x5353f9,null))['catch'](handleError(_0x5353f9,null));};exports[_0x81fd('0x55')]=function(_0x300d9e,_0x19f664){var _0x4b3c07={'name':_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x29')],'key':_0x300d9e[_0x81fd('0x4d')]['key'],'provider':_0x300d9e['body'][_0x81fd('0x60')]===_0x81fd('0x61')?null:_0x300d9e[_0x81fd('0x4d')]['provider'],'email':_0x300d9e['body'][_0x81fd('0x62')],'ListId':_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x63')],'active':!_[_0x81fd('0x64')](_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x65')])?_0x300d9e['body'][_0x81fd('0x65')]:!![],'description':_0x300d9e['body'][_0x81fd('0x66')]||null,'Imap':{},'Smtp':{}};if(_0x4b3c07['provider']){_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x67')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x67')]=_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x68')];_0x4b3c07['Imap']['password']=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x69')]=_0x300d9e['body'][_0x81fd('0x6a')];if(_0x300d9e[_0x81fd('0x4d')]['modernAuthentication']){_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x4e')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x4e')]=!![];_0x4b3c07[_0x81fd('0x2d')]['CloudProviderId']=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x4f')]=_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x4f')];_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x6a')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x69')]=null;}else{_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x4f')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x4f')]=null;}_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x6b')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x6b')]=null;_0x4b3c07[_0x81fd('0x2d')]['host']=_0x4b3c07[_0x81fd('0x2f')]['host']=null;_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x6c')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x6c')]=null;}else{if(_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x6d')]){_0x4b3c07['Imap'][_0x81fd('0x67')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x67')]=_0x300d9e['body'][_0x81fd('0x68')];_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x6a')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x69')]=_0x300d9e['body']['password'];}else{_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x6d')]=_0x4b3c07[_0x81fd('0x2f')]['authentication']=![];_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x67')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x67')]=null;_0x4b3c07[_0x81fd('0x2d')][_0x81fd('0x6a')]=_0x4b3c07[_0x81fd('0x2f')][_0x81fd('0x69')]=null;}_0x4b3c07['Imap'][_0x81fd('0x6e')]=_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x2d')][_0x81fd('0x6e')];_0x4b3c07[_0x81fd('0x2d')]['port']=_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x2d')]['port'];_0x4b3c07['Smtp']['host']=_0x300d9e['body'][_0x81fd('0x2f')][_0x81fd('0x6e')];_0x4b3c07['Smtp'][_0x81fd('0x6c')]=_0x300d9e[_0x81fd('0x4d')][_0x81fd('0x2f')][_0x81fd('0x6c')];}return db['MailAccount']['create'](_0x4b3c07,{'include':[{'model':db[_0x81fd('0x2e')],'as':_0x81fd('0x2f')},{'model':db['MailServerIn'],'as':_0x81fd('0x2d')}]})[_0x81fd('0x25')](function(_0x1b6c2d){var _0x3d543f=_0x300d9e[_0x81fd('0x67')][_0x81fd('0x26')]({'plain':!![]});if(!_0x3d543f)throw new Error(_0x81fd('0x6f'));if(_0x3d543f[_0x81fd('0x70')]===_0x81fd('0x67')){var _0x31f580=_0x1b6c2d[_0x81fd('0x26')]({'plain':!![]});return db[_0x81fd('0x71')][_0x81fd('0x4c')]({'where':{'name':'MailAccounts','userProfileId':_0x3d543f['userProfileId']},'raw':!![]})['then'](function(_0xd18ce7){if(_0xd18ce7&&_0xd18ce7[_0x81fd('0x72')]===0x0){return db[_0x81fd('0x27')][_0x81fd('0x55')]({'name':_0x31f580['name'],'resourceId':_0x31f580['id'],'type':_0xd18ce7[_0x81fd('0x29')],'sectionId':_0xd18ce7['id']},{})[_0x81fd('0x25')](function(){return _0x1b6c2d;});}else{return _0x1b6c2d;}})['catch'](function(_0xb5f91b){logger[_0x81fd('0x16')](_0x81fd('0x73'),_0xb5f91b);throw _0xb5f91b;});}return _0x1b6c2d;})['then'](respondWithResult(_0x19f664,0xc9))[_0x81fd('0x1a')](handleError(_0x19f664,null));};exports[_0x81fd('0x74')]=function(_0x47d5ea,_0x11ba39){return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0x47d5ea[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x11ba39,null))[_0x81fd('0x25')](function(_0x414269){if(_0x414269){return _0x414269[_0x81fd('0x74')]();}return null;})[_0x81fd('0x25')](respondWithResult(_0x11ba39,null))[_0x81fd('0x1a')](handleError(_0x11ba39,null));};exports[_0x81fd('0x75')]=function(_0x6c495e,_0xfa55f5){if(_0x6c495e['body']['id']){delete _0x6c495e[_0x81fd('0x4d')]['id'];}return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0x6c495e[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0xfa55f5,null))[_0x81fd('0x25')](function(_0x30f1ab){if(_0x30f1ab){_0x6c495e[_0x81fd('0x4d')][_0x81fd('0x58')]=_0x30f1ab['id'];return db[_0x81fd('0x2c')]['create'](_0x6c495e[_0x81fd('0x4d')]);}})[_0x81fd('0x25')](respondWithResult(_0xfa55f5,null))['catch'](handleError(_0xfa55f5,null));};exports[_0x81fd('0x76')]=function(_0x195c49,_0x5a7cad){return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0x195c49[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x5a7cad,null))[_0x81fd('0x25')](function(_0xcc5443){if(_0xcc5443){return _0xcc5443[_0x81fd('0x77')](null);}return null;})[_0x81fd('0x25')](respondWithStatusCode(_0x5a7cad,null))[_0x81fd('0x1a')](handleError(_0x5a7cad,null));};exports[_0x81fd('0x78')]=function(_0x18ff26,_0x1eea4c){return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0x18ff26[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x1eea4c,null))[_0x81fd('0x25')](function(_0x557344){if(_0x557344){return _0x557344[_0x81fd('0x78')]();}return null;})[_0x81fd('0x25')](respondWithResult(_0x1eea4c,null))['catch'](handleError(_0x1eea4c,null));};exports[_0x81fd('0x79')]=function(_0x1b8ac4,_0x51e834){if(_0x1b8ac4[_0x81fd('0x4d')]['id']){delete _0x1b8ac4['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x1b8ac4['params']['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x51e834,null))['then'](function(_0x4d502f){if(_0x4d502f){_0x1b8ac4['body'][_0x81fd('0x58')]=_0x4d502f['id'];return db[_0x81fd('0x2e')][_0x81fd('0x55')](_0x1b8ac4[_0x81fd('0x4d')]);}})['then'](respondWithResult(_0x51e834,null))[_0x81fd('0x1a')](handleError(_0x51e834,null));};exports[_0x81fd('0x7a')]=function(_0x14a4e5,_0x5dec22){return db[_0x81fd('0x32')]['findOne']({'where':{'id':_0x14a4e5[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x5dec22,null))['then'](function(_0x27dc7d){if(_0x27dc7d){return _0x27dc7d[_0x81fd('0x7b')](null);}return null;})[_0x81fd('0x25')](respondWithStatusCode(_0x5dec22,null))['catch'](handleError(_0x5dec22,null));};exports[_0x81fd('0x7c')]=function(_0x2d9180,_0x5f3ef1){return db[_0x81fd('0x7d')][_0x81fd('0x4c')]({'where':{'id':_0x2d9180[_0x81fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f3ef1,null))['then'](function(_0x1a8d76){if(_0x1a8d76){return _0x1a8d76[_0x81fd('0x7c')](_0x2d9180[_0x81fd('0x4d')][_0x81fd('0x5b')],_[_0x81fd('0x7e')](_0x2d9180['body'],[_0x81fd('0x5b'),'id'])||{});}})[_0x81fd('0x25')](respondWithResult(_0x5f3ef1,null))[_0x81fd('0x1a')](handleError(_0x5f3ef1,null));};exports[_0x81fd('0x7f')]=function(_0x18df7e,_0x4712cb){var _0x37397c={'raw':![],'where':{}};var _0x8b371c={};var _0x3258c3={'count':0x0,'rows':[]};return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0x18df7e[_0x81fd('0x53')]['id']}})['then'](handleEntityNotFound(_0x4712cb,null))[_0x81fd('0x25')](function(_0x570a56){if(_0x570a56){_0x8b371c[_0x81fd('0x37')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x8b371c[_0x81fd('0x38')]=_['keys'](_0x18df7e[_0x81fd('0x38')]);_0x8b371c[_0x81fd('0x3a')]=_['intersection'](_0x8b371c[_0x81fd('0x37')],_0x8b371c[_0x81fd('0x38')]);_0x37397c['attributes']=_[_0x81fd('0x3b')](_0x8b371c[_0x81fd('0x37')],qs['fields'](_0x18df7e[_0x81fd('0x38')][_0x81fd('0x3c')]));_0x37397c[_0x81fd('0x3d')]=_0x37397c[_0x81fd('0x3d')][_0x81fd('0x3e')]?_0x37397c[_0x81fd('0x3d')]:_0x8b371c['model'];if(!_0x18df7e[_0x81fd('0x38')][_0x81fd('0x3f')](_0x81fd('0x40'))){_0x37397c[_0x81fd('0x20')]=qs[_0x81fd('0x20')](_0x18df7e['query'][_0x81fd('0x20')]);_0x37397c[_0x81fd('0x22')]=qs['offset'](_0x18df7e['query'][_0x81fd('0x22')]);}_0x37397c['order']=qs['sort'](_0x18df7e[_0x81fd('0x38')]['sort']);_0x37397c[_0x81fd('0x43')]=qs[_0x81fd('0x3a')](_[_0x81fd('0x57')](_0x18df7e['query'],_0x8b371c[_0x81fd('0x3a')]));_0x37397c['where'][_0x81fd('0x58')]=_0x570a56['id'];if(_0x18df7e['query']['filter']){_0x37397c[_0x81fd('0x43')]=_[_0x81fd('0x46')](_0x37397c[_0x81fd('0x43')],{'$or':_['map'](_0x37397c[_0x81fd('0x3d')],function(_0x139f2c){var _0x221071={};_0x221071[_0x139f2c]={'$like':'%'+_0x18df7e['query'][_0x81fd('0x44')]+'%'};return _0x221071;})});}_0x37397c=_[_0x81fd('0x46')]({},_0x37397c,_0x18df7e[_0x81fd('0x47')]);return db[_0x81fd('0x7d')]['count']({'where':_0x37397c[_0x81fd('0x43')]})[_0x81fd('0x25')](function(_0xb24b52){_0x3258c3[_0x81fd('0x21')]=_0xb24b52;if(_0x18df7e[_0x81fd('0x38')][_0x81fd('0x59')]){_0x37397c[_0x81fd('0x48')]=[{'model':db[_0x81fd('0x80')],'as':_0x81fd('0x81'),'required':![]},{'model':db[_0x81fd('0x82')],'as':_0x81fd('0x83'),'attributes':[_0x81fd('0x29'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x81fd('0x84'),'attributes':['id','name',_0x81fd('0x85')],'where':_0x18df7e[_0x81fd('0x38')]['tag']?{'id':_0x18df7e[_0x81fd('0x38')]['tag']}:undefined,'required':_0x18df7e['query']['tag']?!![]:![]}];}return db[_0x81fd('0x7d')]['findAll'](_0x37397c);})[_0x81fd('0x25')](function(_0x5e8249){_0x3258c3['rows']=_0x5e8249;return _0x3258c3;});}})[_0x81fd('0x25')](respondWithFilteredResult(_0x4712cb,_0x37397c))[_0x81fd('0x1a')](handleError(_0x4712cb,null));};exports['addApplications']=function addApplications(_0x27ebf6,_0x5eaca2){var _0x10d51a=_0x27ebf6[_0x81fd('0x53')]['id'];var _0x395a2a=_0x27ebf6['body'];var _0xa9f9ae=0xc8;var _0x50b168=null;return db[_0x81fd('0x86')][_0x81fd('0x87')]({'isolationLevel':db[_0x81fd('0x86')][_0x81fd('0x88')][_0x81fd('0x89')]['READ_COMMITTED']},function(_0x4b06a3){return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0x10d51a},'transaction':_0x4b06a3})[_0x81fd('0x25')](function(_0x1e80cb){if(_0x1e80cb){return db[_0x81fd('0x8a')]['destroy']({'where':{'MailAccountId':_0x10d51a},'transaction':_0x4b06a3})[_0x81fd('0x25')](function(){var _0x16cf86=_[_0x81fd('0x31')](_0x395a2a,function(_0x6bafb7){_0x6bafb7[_0x81fd('0x58')]=_0x10d51a;return _0x6bafb7;});return db['MailApplication'][_0x81fd('0x8b')](_0x16cf86,{'transaction':_0x4b06a3});});}else{_0xa9f9ae=0x194;_0x50b168=[];}});})[_0x81fd('0x25')](function(){if(_0xa9f9ae!==0x194){return db[_0x81fd('0x8a')][_0x81fd('0x8c')]({'where':{'MailAccountId':_0x10d51a},'order':_0x81fd('0x8d')})[_0x81fd('0x25')](function(_0x2ba526){_0x50b168=_0x2ba526;});}})[_0x81fd('0x1a')](function(_0x2cf986){_0xa9f9ae=0x1f4;logger['error'](_0x2cf986[_0x81fd('0x28')]);if(_0x2cf986['name']){delete _0x2cf986['name'];}_0x50b168=_0x2cf986;})[_0x81fd('0x8e')](function(){if(_0x50b168===null){_0x5eaca2[_0x81fd('0x1b')](_0xa9f9ae);}else{if(_0xa9f9ae===0x1f4){_0x5eaca2[_0x81fd('0x1c')](_0xa9f9ae)[_0x81fd('0x2a')](_0x50b168);}else{_0x5eaca2[_0x81fd('0x1c')](_0xa9f9ae)[_0x81fd('0x1e')](_0x50b168);}}});};exports[_0x81fd('0x8f')]=function(_0x47dc94,_0x3db208){var _0x466505={};var _0x38d82e={};var _0x380aaa;var _0x93b1b9;return db[_0x81fd('0x32')]['findOne']({'where':{'id':_0x47dc94[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x3db208,null))['then'](function(_0x201905){if(_0x201905){_0x380aaa=_0x201905;_0x38d82e['model']=_['keys'](db[_0x81fd('0x8a')][_0x81fd('0x33')]);_0x38d82e[_0x81fd('0x38')]=_[_0x81fd('0x39')](_0x47dc94[_0x81fd('0x38')]);_0x38d82e['filters']=_['intersection'](_0x38d82e[_0x81fd('0x37')],_0x38d82e[_0x81fd('0x38')]);_0x466505[_0x81fd('0x3d')]=_[_0x81fd('0x3b')](_0x38d82e[_0x81fd('0x37')],qs[_0x81fd('0x3c')](_0x47dc94['query']['fields']));_0x466505[_0x81fd('0x3d')]=_0x466505['attributes'][_0x81fd('0x3e')]?_0x466505[_0x81fd('0x3d')]:_0x38d82e[_0x81fd('0x37')];_0x466505['order']=qs[_0x81fd('0x42')](_0x47dc94[_0x81fd('0x38')][_0x81fd('0x42')]);_0x466505[_0x81fd('0x43')]=qs['filters'](_[_0x81fd('0x57')](_0x47dc94[_0x81fd('0x38')],_0x38d82e[_0x81fd('0x3a')]));if(_0x47dc94[_0x81fd('0x38')][_0x81fd('0x44')]){_0x466505[_0x81fd('0x43')]=_['merge'](_0x466505['where'],{'$or':_['map'](_0x466505[_0x81fd('0x3d')],function(_0x5388e9){var _0x2fc329={};_0x2fc329[_0x5388e9]={'$like':'%'+_0x47dc94['query'][_0x81fd('0x44')]+'%'};return _0x2fc329;})});}_0x466505=_[_0x81fd('0x46')]({},_0x466505,_0x47dc94[_0x81fd('0x47')]);return _0x380aaa[_0x81fd('0x8f')](_0x466505);}})[_0x81fd('0x25')](function(_0x4deb80){if(_0x4deb80){_0x93b1b9=_0x4deb80[_0x81fd('0x3e')];if(!_0x47dc94['query'][_0x81fd('0x3f')](_0x81fd('0x40'))){_0x466505[_0x81fd('0x20')]=qs['limit'](_0x47dc94[_0x81fd('0x38')][_0x81fd('0x20')]);_0x466505['offset']=qs[_0x81fd('0x22')](_0x47dc94[_0x81fd('0x38')][_0x81fd('0x22')]);}return _0x380aaa[_0x81fd('0x8f')](_0x466505);}})[_0x81fd('0x25')](function(_0xa29ebf){if(_0xa29ebf){return _0xa29ebf?{'count':_0x93b1b9,'rows':_0xa29ebf}:null;}})[_0x81fd('0x25')](respondWithResult(_0x3db208,null))[_0x81fd('0x1a')](handleError(_0x3db208,null));};exports[_0x81fd('0x90')]=function(_0xe890c4,_0x1d3191){var _0x1cf888={'raw':!![],'where':{}};var _0x3060fa={};var _0x35d14f={'count':0x0,'rows':[]};return db[_0x81fd('0x32')][_0x81fd('0x56')]({'where':{'id':_0xe890c4[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x1d3191,null))[_0x81fd('0x25')](function(_0x350266){if(_0x350266){_0x3060fa[_0x81fd('0x37')]=_[_0x81fd('0x39')](db[_0x81fd('0x91')][_0x81fd('0x33')]);_0x3060fa[_0x81fd('0x38')]=_[_0x81fd('0x39')](_0xe890c4[_0x81fd('0x38')]);_0x3060fa[_0x81fd('0x3a')]=_[_0x81fd('0x3b')](_0x3060fa[_0x81fd('0x37')],_0x3060fa[_0x81fd('0x38')]);_0x1cf888[_0x81fd('0x3d')]=_[_0x81fd('0x3b')](_0x3060fa[_0x81fd('0x37')],qs[_0x81fd('0x3c')](_0xe890c4[_0x81fd('0x38')][_0x81fd('0x3c')]));_0x1cf888[_0x81fd('0x3d')]=_0x1cf888[_0x81fd('0x3d')][_0x81fd('0x3e')]?_0x1cf888[_0x81fd('0x3d')]:_0x3060fa[_0x81fd('0x37')];if(!_0xe890c4[_0x81fd('0x38')][_0x81fd('0x3f')](_0x81fd('0x40'))){_0x1cf888['limit']=qs['limit'](_0xe890c4[_0x81fd('0x38')][_0x81fd('0x20')]);_0x1cf888[_0x81fd('0x22')]=qs[_0x81fd('0x22')](_0xe890c4['query'][_0x81fd('0x22')]);}_0x1cf888[_0x81fd('0x41')]=qs[_0x81fd('0x42')](_0xe890c4[_0x81fd('0x38')][_0x81fd('0x42')]);_0x1cf888[_0x81fd('0x43')]=qs['filters'](_[_0x81fd('0x57')](_0xe890c4[_0x81fd('0x38')],_0x3060fa['filters']));_0x1cf888[_0x81fd('0x43')]['MailAccountId']=_0x350266['id'];if(_0xe890c4[_0x81fd('0x38')][_0x81fd('0x44')]){_0x1cf888[_0x81fd('0x43')]=_['merge'](_0x1cf888[_0x81fd('0x43')],{'$or':_[_0x81fd('0x31')](_0x1cf888[_0x81fd('0x3d')],function(_0x3c7f16){var _0x58e9a2={};_0x58e9a2[_0x3c7f16]={'$like':'%'+_0xe890c4[_0x81fd('0x38')][_0x81fd('0x44')]+'%'};return _0x58e9a2;})});}if(_0xe890c4[_0x81fd('0x38')]['$gte']){var _0x423c73=_0xe890c4[_0x81fd('0x38')][_0x81fd('0x92')][_0x81fd('0x93')](',');var _0x42d8bf={};_0x42d8bf[_0x423c73[0x0]]={'$gte':moment(_0x423c73[0x1])[_0x81fd('0x94')](_0x81fd('0x95'))};_0x1cf888[_0x81fd('0x43')]=_['merge'](_0x1cf888[_0x81fd('0x43')],_0x42d8bf);}_0x1cf888=_[_0x81fd('0x46')]({},_0x1cf888,_0xe890c4[_0x81fd('0x47')]);return db['MailMessage'][_0x81fd('0x21')]({'where':_0x1cf888[_0x81fd('0x43')]})['then'](function(_0x382c9e){_0x35d14f['count']=_0x382c9e;if(_0xe890c4[_0x81fd('0x38')]['includeAll']){_0x1cf888[_0x81fd('0x48')]=[{'all':!![]}];}return db[_0x81fd('0x91')]['findAll'](_0x1cf888);})[_0x81fd('0x25')](function(_0x1c80d0){if(_0xe890c4[_0x81fd('0x38')][_0x81fd('0x96')]==='true'){for(var _0xc6078c=0x0;_0xc6078c<_0x1c80d0[_0x81fd('0x3e')];_0xc6078c++){_0x1c80d0[_0xc6078c][_0x81fd('0x4d')]=juice(_0x1c80d0[_0xc6078c]['body']);}}_0x35d14f['rows']=_0x1c80d0;return _0x35d14f;});}})[_0x81fd('0x25')](respondWithFilteredResult(_0x1d3191,_0x1cf888))[_0x81fd('0x1a')](handleError(_0x1d3191,null));};exports[_0x81fd('0x2a')]=function(_0x42a9ee,_0x258ab7){var _0x41fac9,_0x1dc18e={},_0x24a302;if(_0x42a9ee['body']['to']){_0x24a302=_0x42a9ee[_0x81fd('0x4d')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x81fd('0x4c')]({'where':{'id':_0x42a9ee[_0x81fd('0x53')]['id']},'include':[{'model':db[_0x81fd('0x97')],'as':_0x81fd('0x98'),'include':[{'model':db[_0x81fd('0x80')],'as':_0x81fd('0x99'),'where':{'email':_0x24a302},'limit':0x1,'order':[[_0x81fd('0x9a'),_0x81fd('0x9b')]]}]},{'model':db[_0x81fd('0x2e')],'as':_0x81fd('0x2f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x258ab7,null))[_0x81fd('0x25')](function(_0x6539ce){if(_0x6539ce){_0x41fac9=_0x6539ce;if(_0x6539ce[_0x81fd('0x2f')]){if(_[_0x81fd('0x64')](_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0x9c')])){_0x42a9ee['body'][_0x81fd('0x9c')]=util['format'](_0x81fd('0x9d'),_0x6539ce['name'],_0x6539ce[_0x81fd('0x62')]||_0x6539ce[_0x81fd('0x2f')]['user']);}if(_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0x9e')]&&_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0x9e')][_0x81fd('0x3e')]){for(var _0x437b5=0x0;_0x437b5<_0x42a9ee['body'][_0x81fd('0x9e')][_0x81fd('0x3e')];_0x437b5+=0x1){_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0x9e')][_0x437b5]={'filename':_0x42a9ee[_0x81fd('0x4d')]['attachments'][_0x437b5][_0x81fd('0x29')],'path':path['join'](config[_0x81fd('0x9f')],_0x81fd('0xa0'),_0x42a9ee['body']['attachments'][_0x437b5][_0x81fd('0xa1')])};}}var _0x46ae5f={'tls':{'rejectUnauthorized':![]}};if(_[_0x81fd('0x64')](_0x6539ce[_0x81fd('0x2f')]['service'])){if(_0x6539ce[_0x81fd('0x2f')][_0x81fd('0x6d')]){_0x46ae5f[_0x81fd('0xa2')]={'user':_0x6539ce[_0x81fd('0x2f')][_0x81fd('0x67')],'pass':_0x6539ce[_0x81fd('0x2f')][_0x81fd('0x69')]};}_0x46ae5f[_0x81fd('0x6e')]=_0x6539ce[_0x81fd('0x2f')][_0x81fd('0x6e')];_0x46ae5f[_0x81fd('0x6c')]=_0x6539ce[_0x81fd('0x2f')][_0x81fd('0x6c')];_0x46ae5f[_0x81fd('0xa3')]=_0x6539ce[_0x81fd('0x2f')][_0x81fd('0xa3')];}else{_0x46ae5f[_0x81fd('0x6b')]=_0x6539ce['Smtp']['service'];_0x46ae5f[_0x81fd('0xa2')]={'user':_0x6539ce[_0x81fd('0x2f')]['user'],'pass':_0x6539ce['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0x81fd('0xa4'),{'account':_0x46ae5f,'message':_0x42a9ee['body']});}else{throw new Error(_0x81fd('0xa5'));}}})[_0x81fd('0x25')](function(_0x5a779d){if(_0x5a779d){_0x1dc18e=_0x5a779d;if(_0x41fac9[_0x81fd('0x98')]){if(_0x41fac9[_0x81fd('0x98')][_0x81fd('0x99')][_0x81fd('0x3e')]){return _0x41fac9['List'][_0x81fd('0x99')][0x0];}else{return db[_0x81fd('0x80')][_0x81fd('0x55')](_[_0x81fd('0xb')](_0x42a9ee[_0x81fd('0x4d')],{'firstName':_0x42a9ee[_0x81fd('0x4d')]['to'],'email':_0x42a9ee[_0x81fd('0x4d')]['to'],'phone':_0x42a9ee[_0x81fd('0x4d')]['to'],'ListId':_0x41fac9[_0x81fd('0x63')]}));}}else{throw new Error(_0x81fd('0xa5'));}}})[_0x81fd('0x25')](function(_0x5e8b95){if(_0x5e8b95){var _0x9e2770={'UserId':_0x42a9ee[_0x81fd('0x67')]['id'],'ContactId':_0x5e8b95['id'],'MailAccountId':_0x41fac9['id'],'inReplyTo':_0x1dc18e[_0x81fd('0xa6')],'to':_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0x9c')],'cc':_0x42a9ee[_0x81fd('0x4d')]['cc'],'subject':_0x42a9ee[_0x81fd('0x4d')]['subject'],'attach':_0x42a9ee['body']['attach'],'firstMsgDirection':_0x81fd('0xa7'),'lastMsgAt':moment()['format'](_0x81fd('0x95')),'lastMsgDirection':_0x81fd('0xa7'),'Messages':[_[_0x81fd('0x46')](_0x42a9ee['body'],{'messageId':_0x1dc18e[_0x81fd('0xa6')],'sentAt':moment()['format'](_0x81fd('0x95')),'read':!![],'MailAccountId':_0x41fac9['id'],'UserId':_0x42a9ee['user']['id'],'ContactId':_0x5e8b95['id']})]};if(_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0xa8')]){_0x9e2770=_[_0x81fd('0x46')](_0x9e2770,_0x42a9ee[_0x81fd('0x4d')][_0x81fd('0xa8')]);}return db[_0x81fd('0x7d')][_0x81fd('0x55')](_0x9e2770,{'include':[{'model':db[_0x81fd('0x91')],'as':_0x81fd('0xa9')}]});}})['then'](respondWithResult(_0x258ab7,null))[_0x81fd('0x1a')](handleError(_0x258ab7,null));};exports[_0x81fd('0xaa')]=function(_0xce2ae6,_0x5cf14e){return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0xce2ae6[_0x81fd('0x53')]['id']},'include':[{'model':db[_0x81fd('0x2e')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x81fd('0xab')],'as':_0x81fd('0xab'),'raw':!![]}]}]})[_0x81fd('0x25')](handleEntityNotFound(_0x5cf14e,null))[_0x81fd('0x25')](function(_0x5e8dbc){if(!_0x5e8dbc[_0x81fd('0x2f')])return;var _0x28ea22={'id':_0x5e8dbc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5e8dbc[_0x81fd('0x60')]!==_0x81fd('0x61')){_0x28ea22[_0x81fd('0x6b')]=_0x5e8dbc[_0x81fd('0x60')];}else{_0x28ea22[_0x81fd('0x6e')]=_0x5e8dbc[_0x81fd('0x2f')][_0x81fd('0x6e')];_0x28ea22[_0x81fd('0x6c')]=_0x5e8dbc[_0x81fd('0x2f')][_0x81fd('0x6c')];_0x28ea22[_0x81fd('0xa3')]=_0x5e8dbc['Smtp'][_0x81fd('0xa3')];}if(_0x5e8dbc[_0x81fd('0x2f')]['authentication']){if(_0x5e8dbc[_0x81fd('0x2f')][_0x81fd('0x4e')]){_0x28ea22[_0x81fd('0xa2')]={'type':_0x81fd('0xac'),'user':_0x5e8dbc[_0x81fd('0x2f')][_0x81fd('0x67')],'accessToken':_0x5e8dbc[_0x81fd('0x2f')][_0x81fd('0xab')][_0x81fd('0xad')]};}else{_0x28ea22[_0x81fd('0xa2')]={'user':_0x5e8dbc['Smtp']['user'],'pass':_0x5e8dbc[_0x81fd('0x2f')][_0x81fd('0x69')]};}}return respondWithRpcPromise('VerifySmtp',_0x81fd('0xaa'),{'account':_0x28ea22});})[_0x81fd('0x25')](respondWithResult(_0x5cf14e,null))[_0x81fd('0x1a')](handleError(_0x5cf14e,null));};exports[_0x81fd('0xae')]=function(_0x1e6553,_0x3e13d5){return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0x1e6553['params']['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x3e13d5,null))[_0x81fd('0x25')](function(_0x247fb3){if(_0x247fb3&&_0x247fb3[_0x81fd('0x6b')]){throw new db[(_0x81fd('0xaf'))][(_0x81fd('0xb0'))](_0x81fd('0xb1'));}return _0x247fb3;})[_0x81fd('0x25')](removeEntity(_0x3e13d5,null))['catch'](handleError(_0x3e13d5,null));};exports[_0x81fd('0xb2')]=function(_0x3351d5,_0x1c1da0){return db[_0x81fd('0x32')][_0x81fd('0x4c')]({'where':{'id':_0x3351d5[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0x1c1da0,null))[_0x81fd('0x25')](function(_0x20841b){if(_0x20841b){return _0x20841b[_0x81fd('0xb2')](_0x3351d5[_0x81fd('0x4d')][_0x81fd('0x5b')],_['omit'](_0x3351d5[_0x81fd('0x4d')],['ids','id'])||{})[_0x81fd('0xb3')](function(_0x8861e1){for(var _0x55a388=0x0;_0x55a388<_0x3351d5[_0x81fd('0x4d')][_0x81fd('0x5b')][_0x81fd('0x3e')];_0x55a388+=0x1){socket[_0x81fd('0xb4')]('userMailAccount:save',{'UserId':Number(_0x3351d5[_0x81fd('0x4d')][_0x81fd('0x5b')][_0x55a388]),'MailAccountId':Number(_0x3351d5['params']['id'])});}return _0x8861e1;});}})['then'](respondWithResult(_0x1c1da0,null))[_0x81fd('0x1a')](handleError(_0x1c1da0,null));};exports['removeAgents']=function(_0xbee374,_0xbd1d63){return db['MailAccount'][_0x81fd('0x4c')]({'where':{'id':_0xbee374[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0xbd1d63,null))['then'](function(_0x3b6e92){if(_0x3b6e92){return _0x3b6e92[_0x81fd('0xb5')](_0xbee374['query'][_0x81fd('0x5b')])[_0x81fd('0x25')](function(){if(_['isArray'](_0xbee374[_0x81fd('0x38')][_0x81fd('0x5b')])){for(var _0x330405=0x0;_0x330405<_0xbee374[_0x81fd('0x38')]['ids'][_0x81fd('0x3e')];_0x330405+=0x1){socket['emit'](_0x81fd('0xb6'),{'UserId':Number(_0xbee374[_0x81fd('0x38')]['ids'][_0x330405]),'MailAccountId':Number(_0xbee374[_0x81fd('0x53')]['id'])});}}else{socket[_0x81fd('0xb4')](_0x81fd('0xb6'),{'UserId':Number(_0xbee374[_0x81fd('0x38')]['ids']),'MailAccountId':Number(_0xbee374['params']['id'])});}});}})[_0x81fd('0x25')](respondWithStatusCode(_0xbd1d63,null))[_0x81fd('0x1a')](handleError(_0xbd1d63,null));};exports[_0x81fd('0xb7')]=function(_0x488833,_0xea412c){var _0x21e64a={};var _0x204951={};var _0x25ca52;var _0x1480f9;return db['MailAccount'][_0x81fd('0x56')]({'where':{'id':_0x488833[_0x81fd('0x53')]['id']}})[_0x81fd('0x25')](handleEntityNotFound(_0xea412c,null))[_0x81fd('0x25')](function(_0x496a2c){if(_0x496a2c){_0x25ca52=_0x496a2c;_0x204951[_0x81fd('0x37')]=_[_0x81fd('0x39')](db[_0x81fd('0x82')][_0x81fd('0x33')]);_0x204951[_0x81fd('0x38')]=_[_0x81fd('0x39')](_0x488833[_0x81fd('0x38')]);_0x204951[_0x81fd('0x3a')]=_[_0x81fd('0x3b')](_0x204951[_0x81fd('0x37')],_0x204951['query']);_0x21e64a['attributes']=_['intersection'](_0x204951[_0x81fd('0x37')],qs['fields'](_0x488833[_0x81fd('0x38')]['fields']));_0x21e64a[_0x81fd('0x3d')]=_0x21e64a[_0x81fd('0x3d')][_0x81fd('0x3e')]?_0x21e64a[_0x81fd('0x3d')]:_0x204951[_0x81fd('0x37')];_0x21e64a[_0x81fd('0x41')]=qs[_0x81fd('0x42')](_0x488833[_0x81fd('0x38')][_0x81fd('0x42')]);_0x21e64a[_0x81fd('0x43')]=qs[_0x81fd('0x3a')](_[_0x81fd('0x57')](_0x488833['query'],_0x204951[_0x81fd('0x3a')]));if(_0x488833[_0x81fd('0x38')]['filter']){_0x21e64a[_0x81fd('0x43')]=_['merge'](_0x21e64a[_0x81fd('0x43')],{'$or':_[_0x81fd('0x31')](_0x21e64a[_0x81fd('0x3d')],function(_0x5f23e8){var _0x5cfc11={};_0x5cfc11[_0x5f23e8]={'$like':'%'+_0x488833[_0x81fd('0x38')][_0x81fd('0x44')]+'%'};return _0x5cfc11;})});}_0x21e64a=_[_0x81fd('0x46')]({},_0x21e64a,_0x488833[_0x81fd('0x47')]);return _0x25ca52[_0x81fd('0xb7')](_0x21e64a);}})['then'](function(_0x1e1330){if(_0x1e1330){_0x1480f9=_0x1e1330['length'];if(!_0x488833['query'][_0x81fd('0x3f')](_0x81fd('0x40'))){_0x21e64a[_0x81fd('0x20')]=qs[_0x81fd('0x20')](_0x488833[_0x81fd('0x38')][_0x81fd('0x20')]);_0x21e64a[_0x81fd('0x22')]=qs['offset'](_0x488833['query'][_0x81fd('0x22')]);}return _0x25ca52[_0x81fd('0xb7')](_0x21e64a);}})[_0x81fd('0x25')](function(_0xe09ced){if(_0xe09ced){return _0xe09ced?{'count':_0x1480f9,'rows':_0xe09ced}:null;}})['then'](respondWithResult(_0xea412c,null))[_0x81fd('0x1a')](handleError(_0xea412c,null));}; \ No newline at end of file +var _0x293a=['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','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','findAll','show','params','Imap','Smtp','rawAttributes','include','find','update','body','modernAuthentication','CloudProviderId','MailServerIn','MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','includeAll','rows','removeAnswers','provider','custom','email','ListId','active','user','username','password','pass','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','List','CmContact','Contacts','isNil','attachments','join','root','server/files/attachments','basename','secure','List\x20not\x20found','messageId','subject','out','format','Interaction','Messages','CloudProvider','auth','OAuth2','data5','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove'];(function(_0x29d2ff,_0x354e85){var _0xcc06c5=function(_0xef0ef3){while(--_0xef0ef3){_0x29d2ff['push'](_0x29d2ff['shift']());}};_0xcc06c5(++_0x354e85);}(_0x293a,0x16b));var _0xa293=function(_0xcf4260,_0xe48af6){_0xcf4260=_0xcf4260-0x0;var _0x5ad781=_0x293a[_0xcf4260];return _0x5ad781;};'use strict';var moment=require(_0xa293('0x0'));var BPromise=require('bluebird');var util=require(_0xa293('0x1'));var path=require(_0xa293('0x2'));var _=require(_0xa293('0x3'));var juice=require(_0xa293('0x4'));var Redis=require(_0xa293('0x5'));var qs=require(_0xa293('0x6'));var logger=require(_0xa293('0x7'))(_0xa293('0x8'));var config=require(_0xa293('0x9'));var db=require('../../mysqldb')['db'];config[_0xa293('0xa')]=_[_0xa293('0xb')](config[_0xa293('0xa')],{'host':_0xa293('0xc'),'port':0x18eb});var socket=require(_0xa293('0xd'))(new Redis(config[_0xa293('0xa')]));require(_0xa293('0xe'))[_0xa293('0xf')](socket);var jayson=require(_0xa293('0x10'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x38488a,_0x3de756,_0x93cba,_0x366fc8){return new BPromise(function(_0x3ac5af,_0x503350){var _0x424009=_0x366fc8||client;return _0x424009['request'](_0x38488a,_0x93cba)['then'](function(_0x5bc0fd){logger['info'](_0xa293('0x11'),_0x3de756,_0xa293('0x12'));logger[_0xa293('0x13')](_0xa293('0x14'),_0x3de756,'request\x20sent',JSON[_0xa293('0x15')](_0x5bc0fd));if(_0x5bc0fd[_0xa293('0x16')]){if(_0x5bc0fd[_0xa293('0x16')][_0xa293('0x17')]===0x1f4){logger[_0xa293('0x16')](_0xa293('0x11'),_0x3de756,_0x5bc0fd['error']['message']);return _0x503350(_0x5bc0fd[_0xa293('0x16')][_0xa293('0x18')]);}logger[_0xa293('0x16')](_0xa293('0x11'),_0x3de756,_0x5bc0fd[_0xa293('0x16')][_0xa293('0x18')]);return _0x3ac5af(_0x5bc0fd[_0xa293('0x16')]['message']);}else{logger[_0xa293('0x19')]('MailAccount,\x20%s,\x20%s',_0x3de756,_0xa293('0x12'));_0x3ac5af(_0x5bc0fd[_0xa293('0x1a')][_0xa293('0x18')]);}})[_0xa293('0x1b')](function(_0x2396df){logger['error'](_0xa293('0x11'),_0x3de756,_0x2396df);_0x503350(_0x2396df);});});}function respondWithStatusCode(_0x18e906,_0x363831){_0x363831=_0x363831||0xcc;return function(_0x543d4e){if(_0x543d4e){return _0x18e906[_0xa293('0x1c')](_0x363831);}return _0x18e906[_0xa293('0x1d')](_0x363831)['end']();};}function respondWithResult(_0x398cfa,_0x11d3d4){_0x11d3d4=_0x11d3d4||0xc8;return function(_0x4ade35){if(_0x4ade35){return _0x398cfa[_0xa293('0x1d')](_0x11d3d4)[_0xa293('0x1e')](_0x4ade35);}};}function respondWithFilteredResult(_0x35022f,_0x1d19dc){return function(_0x116fd4){if(_0x116fd4){var _0x1a9e85=typeof _0x1d19dc[_0xa293('0x1f')]==='undefined'&&typeof _0x1d19dc[_0xa293('0x20')]===_0xa293('0x21');var _0xa2b274=_0x116fd4[_0xa293('0x22')];var _0x1b1636=_0x1a9e85?0x0:_0x1d19dc['offset'];var _0x1e408b=_0x1a9e85?_0x116fd4['count']:_0x1d19dc[_0xa293('0x1f')]+_0x1d19dc[_0xa293('0x20')];var _0x542d1c;if(_0x1e408b>=_0xa2b274){_0x1e408b=_0xa2b274;_0x542d1c=0xc8;}else{_0x542d1c=0xce;}_0x35022f[_0xa293('0x1d')](_0x542d1c);return _0x35022f[_0xa293('0x23')](_0xa293('0x24'),_0x1b1636+'-'+_0x1e408b+'/'+_0xa2b274)['json'](_0x116fd4);}return null;};}function saveUpdates(_0x2dbd6a){return function(_0x5d8181){if(_0x5d8181){return _0x5d8181['update'](_0x2dbd6a)[_0xa293('0x25')](function(_0x4a7dde){return _0x4a7dde;});}return null;};}function removeEntity(_0x4d666c){return function(_0x149a52){if(_0x149a52){return _0x149a52[_0xa293('0x26')]()['then'](function(){var _0x3126d8=_0x149a52['get']({'plain':!![]});var _0x3536f3='MailAccounts';return db[_0xa293('0x27')][_0xa293('0x26')]({'where':{'type':_0x3536f3,'resourceId':_0x3126d8['id']}})['then'](function(){return _0x149a52;});})['then'](function(){_0x4d666c[_0xa293('0x1d')](0xcc)[_0xa293('0x28')]();});}};}function handleEntityNotFound(_0x208dd7){return function(_0x426272){if(!_0x426272){_0x208dd7[_0xa293('0x1c')](0x194);}return _0x426272;};}function handleError(_0xa299b9,_0x222144){_0x222144=_0x222144||0x1f4;return function(_0x2ee765){logger[_0xa293('0x16')](_0x2ee765['stack']);if(_0x2ee765['name']){delete _0x2ee765[_0xa293('0x29')];}_0xa299b9['status'](_0x222144)[_0xa293('0x2a')](_0x2ee765);};}exports[_0xa293('0x2b')]=function(_0x40d98f,_0x2058fb){var _0x59cae7={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa293('0x2c')],'as':_0xa293('0x2d')}]},_0x117fcd={},_0x47cc11={'count':0x0,'rows':[]};var _0x55f3ad=_[_0xa293('0x2e')](db['MailAccount']['rawAttributes'],function(_0x5e18e6){return{'name':_0x5e18e6[_0xa293('0x2f')],'type':_0x5e18e6[_0xa293('0x30')][_0xa293('0x31')]};});_0x117fcd[_0xa293('0x32')]=_[_0xa293('0x2e')](_0x55f3ad,_0xa293('0x29'));_0x117fcd[_0xa293('0x33')]=_[_0xa293('0x34')](_0x40d98f[_0xa293('0x33')]);_0x117fcd[_0xa293('0x35')]=_['intersection'](_0x117fcd['model'],_0x117fcd[_0xa293('0x33')]);_0x59cae7[_0xa293('0x36')]=_[_0xa293('0x37')](_0x117fcd[_0xa293('0x32')],qs[_0xa293('0x38')](_0x40d98f[_0xa293('0x33')][_0xa293('0x38')]));_0x59cae7['attributes']=_0x59cae7[_0xa293('0x36')][_0xa293('0x39')]?_0x59cae7[_0xa293('0x36')]:_0x117fcd[_0xa293('0x32')];if(!_0x40d98f['query'][_0xa293('0x3a')](_0xa293('0x3b'))){_0x59cae7[_0xa293('0x20')]=qs[_0xa293('0x20')](_0x40d98f[_0xa293('0x33')][_0xa293('0x20')]);_0x59cae7[_0xa293('0x1f')]=qs[_0xa293('0x1f')](_0x40d98f['query'][_0xa293('0x1f')]);}_0x59cae7['order']=qs[_0xa293('0x3c')](_0x40d98f[_0xa293('0x33')][_0xa293('0x3c')]);_0x59cae7[_0xa293('0x3d')]=qs[_0xa293('0x35')](_[_0xa293('0x3e')](_0x40d98f[_0xa293('0x33')],_0x117fcd[_0xa293('0x35')]),_0x55f3ad);if(_0x40d98f['query'][_0xa293('0x3f')]){_0x59cae7[_0xa293('0x3d')]=_[_0xa293('0x40')](_0x59cae7[_0xa293('0x3d')],{'$or':_[_0xa293('0x2e')](_0x55f3ad,function(_0x551d7c){if(_0x551d7c[_0xa293('0x30')]!==_0xa293('0x41')){var _0x2fbd27={};_0x2fbd27[_0x551d7c[_0xa293('0x29')]]={'$like':'%'+_0x40d98f[_0xa293('0x33')][_0xa293('0x3f')]+'%'};return _0x2fbd27;}})});}_0x59cae7=_[_0xa293('0x40')]({},_0x59cae7,_0x40d98f[_0xa293('0x42')]);var _0x2896bb={'where':_0x59cae7['where']};return db[_0xa293('0x43')][_0xa293('0x22')](_0x2896bb)['then'](function(_0x2d14e7){_0x47cc11['count']=_0x2d14e7;if(_0x40d98f['query']['includeAll']){_0x59cae7['include']=[{'all':!![]}];}return db[_0xa293('0x43')][_0xa293('0x44')](_0x59cae7);})['then'](function(_0x170ecf){_0x47cc11['rows']=_0x170ecf;return _0x47cc11;})[_0xa293('0x25')](respondWithFilteredResult(_0x2058fb,_0x59cae7))[_0xa293('0x1b')](handleError(_0x2058fb,null));};exports[_0xa293('0x45')]=function(_0x3b94a0,_0x1bae95){var _0x12de57={'raw':![],'where':{'id':_0x3b94a0[_0xa293('0x46')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa293('0x47')},{'model':db['MailServerOut'],'as':_0xa293('0x48')},{'model':db[_0xa293('0x2c')],'as':_0xa293('0x2d')}]},_0x42fcc7={};_0x42fcc7['model']=_[_0xa293('0x34')](db[_0xa293('0x43')][_0xa293('0x49')]);_0x42fcc7['query']=_[_0xa293('0x34')](_0x3b94a0[_0xa293('0x33')]);_0x42fcc7[_0xa293('0x35')]=_[_0xa293('0x37')](_0x42fcc7[_0xa293('0x32')],_0x42fcc7[_0xa293('0x33')]);_0x12de57[_0xa293('0x36')]=_[_0xa293('0x37')](_0x42fcc7[_0xa293('0x32')],qs[_0xa293('0x38')](_0x3b94a0[_0xa293('0x33')][_0xa293('0x38')]));_0x12de57[_0xa293('0x36')]=_0x12de57[_0xa293('0x36')][_0xa293('0x39')]?_0x12de57['attributes']:_0x42fcc7[_0xa293('0x32')];if(_0x3b94a0[_0xa293('0x33')]['includeAll']){_0x12de57[_0xa293('0x4a')]=[{'all':!![]}];}_0x12de57=_[_0xa293('0x40')]({},_0x12de57,_0x3b94a0[_0xa293('0x42')]);return db[_0xa293('0x43')][_0xa293('0x4b')](_0x12de57)[_0xa293('0x25')](handleEntityNotFound(_0x1bae95,null))[_0xa293('0x25')](respondWithResult(_0x1bae95,null))['catch'](handleError(_0x1bae95,null));};exports[_0xa293('0x4c')]=function(_0x288969,_0x29394d){if(_0x288969[_0xa293('0x4d')]['id']){delete _0x288969['body']['id'];}if(_0x288969[_0xa293('0x4d')][_0xa293('0x47')]){if(!_0x288969[_0xa293('0x4d')][_0xa293('0x47')][_0xa293('0x4e')]){_0x288969[_0xa293('0x4d')]['Imap'][_0xa293('0x4f')]=null;}}if(_0x288969['body'][_0xa293('0x48')]){if(!_0x288969['body'][_0xa293('0x48')][_0xa293('0x4e')]){_0x288969[_0xa293('0x4d')][_0xa293('0x48')]['CloudProviderId']=null;}}return db[_0xa293('0x43')][_0xa293('0x4b')]({'where':{'id':_0x288969[_0xa293('0x46')]['id']},'include':[{'model':db[_0xa293('0x50')],'as':_0xa293('0x47')},{'model':db[_0xa293('0x51')],'as':_0xa293('0x48')},{'model':db[_0xa293('0x2c')],'as':_0xa293('0x2d')}]})[_0xa293('0x25')](handleEntityNotFound(_0x29394d,null))[_0xa293('0x25')](saveUpdates(_0x288969[_0xa293('0x4d')],null))[_0xa293('0x25')](function(_0x469599){if(_0x469599&&_0x288969['body']['Imap']){return db[_0xa293('0x50')][_0xa293('0x4c')](_0x288969[_0xa293('0x4d')][_0xa293('0x47')],{'where':{'MailAccountId':_0x469599['id']}})[_0xa293('0x25')](function(){return _0x469599;});}return _0x469599;})['then'](function(_0x42a4ca){if(_0x42a4ca&&_0x288969[_0xa293('0x4d')][_0xa293('0x48')]){return db['MailServerOut']['update'](_0x288969[_0xa293('0x4d')][_0xa293('0x48')],{'where':{'MailAccountId':_0x42a4ca['id']}})[_0xa293('0x25')](function(){return _0x42a4ca;});}return _0x42a4ca;})[_0xa293('0x25')](respondWithResult(_0x29394d,null))['catch'](handleError(_0x29394d,null));};exports[_0xa293('0x52')]=function(_0x239434,_0x300212){return db['MailAccount'][_0xa293('0x52')]()['then'](respondWithResult(_0x300212,null))[_0xa293('0x1b')](handleError(_0x300212,null));};exports[_0xa293('0x53')]=function(_0x214d5a,_0x453b21){if(_0x214d5a[_0xa293('0x4d')]['id']){delete _0x214d5a[_0xa293('0x4d')]['id'];}return db[_0xa293('0x43')][_0xa293('0x4b')]({'where':{'id':_0x214d5a[_0xa293('0x46')]['id']}})['then'](handleEntityNotFound(_0x453b21,null))['then'](function(_0x296570){if(_0x296570){_0x214d5a['body'][_0xa293('0x54')]=_0x296570['id'];return db[_0xa293('0x55')][_0xa293('0x56')](_0x214d5a[_0xa293('0x4d')]);}})['then'](respondWithResult(_0x453b21,null))[_0xa293('0x1b')](handleError(_0x453b21,null));};exports[_0xa293('0x57')]=function(_0x190ee9,_0x5c80b6){var _0x2e7bb6={'raw':![],'where':{}};var _0x554a5a={};var _0xea11c5={'count':0x0,'rows':[]};return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x190ee9[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x5c80b6,null))[_0xa293('0x25')](function(_0x50e61d){if(_0x50e61d){_0x554a5a[_0xa293('0x32')]=_[_0xa293('0x34')](db[_0xa293('0x55')][_0xa293('0x49')]);_0x554a5a[_0xa293('0x33')]=_[_0xa293('0x34')](_0x190ee9[_0xa293('0x33')]);_0x554a5a[_0xa293('0x35')]=_[_0xa293('0x37')](_0x554a5a[_0xa293('0x32')],_0x554a5a['query']);_0x2e7bb6['attributes']=_['intersection'](_0x554a5a['model'],qs['fields'](_0x190ee9[_0xa293('0x33')][_0xa293('0x38')]));_0x2e7bb6[_0xa293('0x36')]=_0x2e7bb6[_0xa293('0x36')]['length']?_0x2e7bb6[_0xa293('0x36')]:_0x554a5a['model'];if(!_0x190ee9[_0xa293('0x33')]['hasOwnProperty'](_0xa293('0x3b'))){_0x2e7bb6[_0xa293('0x20')]=qs[_0xa293('0x20')](_0x190ee9[_0xa293('0x33')][_0xa293('0x20')]);_0x2e7bb6[_0xa293('0x1f')]=qs['offset'](_0x190ee9[_0xa293('0x33')][_0xa293('0x1f')]);}_0x2e7bb6[_0xa293('0x59')]=qs[_0xa293('0x3c')](_0x190ee9['query'][_0xa293('0x3c')]);_0x2e7bb6[_0xa293('0x3d')]=qs[_0xa293('0x35')](_[_0xa293('0x3e')](_0x190ee9[_0xa293('0x33')],_0x554a5a[_0xa293('0x35')]));_0x2e7bb6[_0xa293('0x3d')][_0xa293('0x54')]=_0x50e61d['id'];if(_0x190ee9[_0xa293('0x33')]['filter']){_0x2e7bb6[_0xa293('0x3d')]=_[_0xa293('0x40')](_0x2e7bb6[_0xa293('0x3d')],{'$or':_[_0xa293('0x2e')](_0x2e7bb6['attributes'],function(_0xedbb0c){var _0x2cb71e={};_0x2cb71e[_0xedbb0c]={'$like':'%'+_0x190ee9[_0xa293('0x33')][_0xa293('0x3f')]+'%'};return _0x2cb71e;})});}_0x2e7bb6=_['merge']({},_0x2e7bb6,_0x190ee9[_0xa293('0x42')]);return db[_0xa293('0x55')][_0xa293('0x22')]({'where':_0x2e7bb6[_0xa293('0x3d')]})[_0xa293('0x25')](function(_0xb127e1){_0xea11c5[_0xa293('0x22')]=_0xb127e1;if(_0x190ee9['query']['includeAll']){_0x2e7bb6[_0xa293('0x4a')]=[{'all':!![]}];}return db[_0xa293('0x55')][_0xa293('0x44')](_0x2e7bb6);})['then'](function(_0x1b0332){_0xea11c5['rows']=_0x1b0332;return _0xea11c5;});}})[_0xa293('0x25')](respondWithFilteredResult(_0x5c80b6,_0x2e7bb6))[_0xa293('0x1b')](handleError(_0x5c80b6,null));};exports[_0xa293('0x5a')]=function(_0x45287e,_0x1a55d0){return db[_0xa293('0x43')]['find']({'where':{'id':_0x45287e[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x1a55d0,null))[_0xa293('0x25')](function(_0x1eb643){if(_0x1eb643){return _0x1eb643[_0xa293('0x5a')](_0x45287e[_0xa293('0x33')]['ids']);}})[_0xa293('0x25')](respondWithStatusCode(_0x1a55d0,null))['catch'](handleError(_0x1a55d0,null));};exports[_0xa293('0x5b')]=function(_0x17f834,_0x5ef39a){if(_0x17f834[_0xa293('0x4d')]['id']){delete _0x17f834[_0xa293('0x4d')]['id'];}return db[_0xa293('0x43')][_0xa293('0x4b')]({'where':{'id':_0x17f834[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x5ef39a,null))['then'](function(_0x1516ff){if(_0x1516ff){_0x17f834[_0xa293('0x4d')][_0xa293('0x54')]=_0x1516ff['id'];return db['CannedAnswer'][_0xa293('0x56')](_0x17f834[_0xa293('0x4d')]);}})[_0xa293('0x25')](respondWithResult(_0x5ef39a,null))[_0xa293('0x1b')](handleError(_0x5ef39a,null));};exports['getAnswers']=function(_0x23e041,_0x4eedc7){var _0x8f24e0={'raw':![],'where':{}};var _0x30863d={};var _0x59e826={'count':0x0,'rows':[]};return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x23e041['params']['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x4eedc7,null))[_0xa293('0x25')](function(_0x442fb8){if(_0x442fb8){_0x30863d[_0xa293('0x32')]=_[_0xa293('0x34')](db[_0xa293('0x5c')][_0xa293('0x49')]);_0x30863d[_0xa293('0x33')]=_[_0xa293('0x34')](_0x23e041[_0xa293('0x33')]);_0x30863d[_0xa293('0x35')]=_['intersection'](_0x30863d[_0xa293('0x32')],_0x30863d[_0xa293('0x33')]);_0x8f24e0['attributes']=_[_0xa293('0x37')](_0x30863d[_0xa293('0x32')],qs[_0xa293('0x38')](_0x23e041[_0xa293('0x33')][_0xa293('0x38')]));_0x8f24e0[_0xa293('0x36')]=_0x8f24e0[_0xa293('0x36')][_0xa293('0x39')]?_0x8f24e0[_0xa293('0x36')]:_0x30863d['model'];if(!_0x23e041[_0xa293('0x33')][_0xa293('0x3a')](_0xa293('0x3b'))){_0x8f24e0[_0xa293('0x20')]=qs['limit'](_0x23e041[_0xa293('0x33')][_0xa293('0x20')]);_0x8f24e0['offset']=qs[_0xa293('0x1f')](_0x23e041[_0xa293('0x33')][_0xa293('0x1f')]);}_0x8f24e0[_0xa293('0x59')]=qs[_0xa293('0x3c')](_0x23e041['query']['sort']);_0x8f24e0[_0xa293('0x3d')]=qs[_0xa293('0x35')](_[_0xa293('0x3e')](_0x23e041[_0xa293('0x33')],_0x30863d['filters']));_0x8f24e0[_0xa293('0x3d')][_0xa293('0x54')]=_0x442fb8['id'];if(_0x23e041[_0xa293('0x33')][_0xa293('0x3f')]){_0x8f24e0[_0xa293('0x3d')]=_[_0xa293('0x40')](_0x8f24e0[_0xa293('0x3d')],{'$or':_[_0xa293('0x2e')](_0x8f24e0[_0xa293('0x36')],function(_0x227d03){var _0x25fb5c={};_0x25fb5c[_0x227d03]={'$like':'%'+_0x23e041[_0xa293('0x33')][_0xa293('0x3f')]+'%'};return _0x25fb5c;})});}_0x8f24e0=_[_0xa293('0x40')]({},_0x8f24e0,_0x23e041[_0xa293('0x42')]);return db[_0xa293('0x5c')][_0xa293('0x22')]({'where':_0x8f24e0[_0xa293('0x3d')]})[_0xa293('0x25')](function(_0x49ecee){_0x59e826['count']=_0x49ecee;if(_0x23e041[_0xa293('0x33')][_0xa293('0x5d')]){_0x8f24e0[_0xa293('0x4a')]=[{'all':!![]}];}return db[_0xa293('0x5c')]['findAll'](_0x8f24e0);})['then'](function(_0xeeaec9){_0x59e826[_0xa293('0x5e')]=_0xeeaec9;return _0x59e826;});}})['then'](respondWithFilteredResult(_0x4eedc7,_0x8f24e0))[_0xa293('0x1b')](handleError(_0x4eedc7,null));};exports[_0xa293('0x5f')]=function(_0x3fd4aa,_0x2e1526){return db['MailAccount'][_0xa293('0x4b')]({'where':{'id':_0x3fd4aa[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x2e1526,null))[_0xa293('0x25')](function(_0xa3bd7b){if(_0xa3bd7b){return _0xa3bd7b['removeAnswers'](_0x3fd4aa[_0xa293('0x33')]['ids']);}})[_0xa293('0x25')](respondWithStatusCode(_0x2e1526,null))[_0xa293('0x1b')](handleError(_0x2e1526,null));};exports['create']=function(_0x5706c5,_0x11e6a2){var _0x31873e={'name':_0x5706c5[_0xa293('0x4d')][_0xa293('0x29')],'key':_0x5706c5[_0xa293('0x4d')][_0xa293('0x31')],'provider':_0x5706c5['body'][_0xa293('0x60')]===_0xa293('0x61')?null:_0x5706c5[_0xa293('0x4d')]['provider'],'email':_0x5706c5[_0xa293('0x4d')][_0xa293('0x62')],'ListId':_0x5706c5['body'][_0xa293('0x63')],'active':!_['isNil'](_0x5706c5['body'][_0xa293('0x64')])?_0x5706c5[_0xa293('0x4d')][_0xa293('0x64')]:!![],'description':_0x5706c5[_0xa293('0x4d')]['description']||null,'Imap':{},'Smtp':{}};if(_0x31873e['provider']){_0x31873e[_0xa293('0x47')][_0xa293('0x65')]=_0x31873e['Smtp']['user']=_0x5706c5[_0xa293('0x4d')][_0xa293('0x66')];_0x31873e['Imap'][_0xa293('0x67')]=_0x31873e['Smtp'][_0xa293('0x68')]=_0x5706c5[_0xa293('0x4d')][_0xa293('0x67')];if(_0x5706c5[_0xa293('0x4d')][_0xa293('0x4e')]){_0x31873e[_0xa293('0x47')][_0xa293('0x4e')]=_0x31873e[_0xa293('0x48')][_0xa293('0x4e')]=!![];_0x31873e['Imap']['CloudProviderId']=_0x31873e[_0xa293('0x48')]['CloudProviderId']=_0x5706c5[_0xa293('0x4d')]['CloudProviderId'];_0x31873e[_0xa293('0x47')]['password']=_0x31873e[_0xa293('0x48')][_0xa293('0x68')]=null;}else{_0x31873e[_0xa293('0x47')]['CloudProviderId']=_0x31873e[_0xa293('0x48')][_0xa293('0x4f')]=null;}_0x31873e['Imap'][_0xa293('0x69')]=_0x31873e[_0xa293('0x48')]['service']=null;_0x31873e[_0xa293('0x47')][_0xa293('0x6a')]=_0x31873e[_0xa293('0x48')][_0xa293('0x6a')]=null;_0x31873e[_0xa293('0x47')]['port']=_0x31873e[_0xa293('0x48')][_0xa293('0x6b')]=null;}else{if(_0x5706c5[_0xa293('0x4d')][_0xa293('0x6c')]){_0x31873e[_0xa293('0x47')][_0xa293('0x65')]=_0x31873e[_0xa293('0x48')][_0xa293('0x65')]=_0x5706c5[_0xa293('0x4d')][_0xa293('0x66')];_0x31873e[_0xa293('0x47')][_0xa293('0x67')]=_0x31873e['Smtp'][_0xa293('0x68')]=_0x5706c5['body'][_0xa293('0x67')];}else{_0x31873e['Imap'][_0xa293('0x6c')]=_0x31873e[_0xa293('0x48')][_0xa293('0x6c')]=![];_0x31873e[_0xa293('0x47')][_0xa293('0x65')]=_0x31873e[_0xa293('0x48')][_0xa293('0x65')]=null;_0x31873e[_0xa293('0x47')][_0xa293('0x67')]=_0x31873e['Smtp'][_0xa293('0x68')]=null;}_0x31873e[_0xa293('0x47')][_0xa293('0x6a')]=_0x5706c5[_0xa293('0x4d')][_0xa293('0x47')][_0xa293('0x6a')];_0x31873e['Imap'][_0xa293('0x6b')]=_0x5706c5[_0xa293('0x4d')]['Imap'][_0xa293('0x6b')];_0x31873e[_0xa293('0x48')][_0xa293('0x6a')]=_0x5706c5[_0xa293('0x4d')]['Smtp']['host'];_0x31873e[_0xa293('0x48')][_0xa293('0x6b')]=_0x5706c5[_0xa293('0x4d')][_0xa293('0x48')][_0xa293('0x6b')];}return db[_0xa293('0x43')][_0xa293('0x56')](_0x31873e,{'include':[{'model':db['MailServerOut'],'as':_0xa293('0x48')},{'model':db['MailServerIn'],'as':'Imap'}]})['then'](function(_0x182433){var _0x4d6e85=_0x5706c5[_0xa293('0x65')]['get']({'plain':!![]});if(!_0x4d6e85)throw new Error(_0xa293('0x6d'));if(_0x4d6e85[_0xa293('0x6e')]==='user'){var _0x57061c=_0x182433[_0xa293('0x6f')]({'plain':!![]});return db[_0xa293('0x70')]['find']({'where':{'name':_0xa293('0x71'),'userProfileId':_0x4d6e85[_0xa293('0x72')]},'raw':!![]})[_0xa293('0x25')](function(_0x3ef5f1){if(_0x3ef5f1&&_0x3ef5f1[_0xa293('0x73')]===0x0){return db['UserProfileResource'][_0xa293('0x56')]({'name':_0x57061c[_0xa293('0x29')],'resourceId':_0x57061c['id'],'type':_0x3ef5f1[_0xa293('0x29')],'sectionId':_0x3ef5f1['id']},{})[_0xa293('0x25')](function(){return _0x182433;});}else{return _0x182433;}})[_0xa293('0x1b')](function(_0xeba121){logger[_0xa293('0x16')](_0xa293('0x74'),_0xeba121);throw _0xeba121;});}return _0x182433;})['then'](respondWithResult(_0x11e6a2,0xc9))[_0xa293('0x1b')](handleError(_0x11e6a2,null));};exports[_0xa293('0x75')]=function(_0x472cf7,_0x3f5ad9){return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x472cf7[_0xa293('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f5ad9,null))[_0xa293('0x25')](function(_0x54fa70){if(_0x54fa70){return _0x54fa70[_0xa293('0x75')]();}return null;})['then'](respondWithResult(_0x3f5ad9,null))[_0xa293('0x1b')](handleError(_0x3f5ad9,null));};exports['addImap']=function(_0x1fac56,_0xd88832){if(_0x1fac56[_0xa293('0x4d')]['id']){delete _0x1fac56[_0xa293('0x4d')]['id'];}return db[_0xa293('0x43')]['find']({'where':{'id':_0x1fac56[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0xd88832,null))[_0xa293('0x25')](function(_0x438e96){if(_0x438e96){_0x1fac56['body'][_0xa293('0x54')]=_0x438e96['id'];return db[_0xa293('0x50')][_0xa293('0x56')](_0x1fac56[_0xa293('0x4d')]);}})[_0xa293('0x25')](respondWithResult(_0xd88832,null))[_0xa293('0x1b')](handleError(_0xd88832,null));};exports[_0xa293('0x76')]=function(_0x501320,_0x4d5c97){return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x501320[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x4d5c97,null))[_0xa293('0x25')](function(_0x195cf9){if(_0x195cf9){return _0x195cf9[_0xa293('0x77')](null);}return null;})['then'](respondWithStatusCode(_0x4d5c97,null))[_0xa293('0x1b')](handleError(_0x4d5c97,null));};exports[_0xa293('0x78')]=function(_0x21f0a0,_0x155cc7){return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x21f0a0['params']['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x155cc7,null))[_0xa293('0x25')](function(_0x228959){if(_0x228959){return _0x228959['getSmtp']();}return null;})[_0xa293('0x25')](respondWithResult(_0x155cc7,null))[_0xa293('0x1b')](handleError(_0x155cc7,null));};exports[_0xa293('0x79')]=function(_0x5925d8,_0x481b4c){if(_0x5925d8[_0xa293('0x4d')]['id']){delete _0x5925d8['body']['id'];}return db['MailAccount'][_0xa293('0x4b')]({'where':{'id':_0x5925d8['params']['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x481b4c,null))[_0xa293('0x25')](function(_0xf3ffa2){if(_0xf3ffa2){_0x5925d8[_0xa293('0x4d')]['MailAccountId']=_0xf3ffa2['id'];return db[_0xa293('0x51')]['create'](_0x5925d8[_0xa293('0x4d')]);}})['then'](respondWithResult(_0x481b4c,null))[_0xa293('0x1b')](handleError(_0x481b4c,null));};exports['removeSmtp']=function(_0x1df9e4,_0xcb68b4){return db[_0xa293('0x43')]['findOne']({'where':{'id':_0x1df9e4[_0xa293('0x46')]['id']}})['then'](handleEntityNotFound(_0xcb68b4,null))[_0xa293('0x25')](function(_0xc3fe52){if(_0xc3fe52){return _0xc3fe52[_0xa293('0x7a')](null);}return null;})[_0xa293('0x25')](respondWithStatusCode(_0xcb68b4,null))['catch'](handleError(_0xcb68b4,null));};exports[_0xa293('0x7b')]=function(_0xc7b173,_0x42866b){return db[_0xa293('0x7c')][_0xa293('0x4b')]({'where':{'id':_0xc7b173[_0xa293('0x46')]['id']}})['then'](handleEntityNotFound(_0x42866b,null))[_0xa293('0x25')](function(_0x5e3873){if(_0x5e3873){return _0x5e3873[_0xa293('0x7b')](_0xc7b173['body'][_0xa293('0x7d')],_[_0xa293('0x7e')](_0xc7b173[_0xa293('0x4d')],[_0xa293('0x7d'),'id'])||{});}})[_0xa293('0x25')](respondWithResult(_0x42866b,null))['catch'](handleError(_0x42866b,null));};exports['getInteractions']=function(_0x2b3f1f,_0x3277f7){var _0x171637={'raw':![],'where':{}};var _0x44ed50={};var _0x14e0be={'count':0x0,'rows':[]};return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x2b3f1f[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x3277f7,null))[_0xa293('0x25')](function(_0x256566){if(_0x256566){_0x44ed50[_0xa293('0x32')]=_['keys'](db[_0xa293('0x7c')][_0xa293('0x49')]);_0x44ed50[_0xa293('0x33')]=_[_0xa293('0x34')](_0x2b3f1f['query']);_0x44ed50[_0xa293('0x35')]=_['intersection'](_0x44ed50['model'],_0x44ed50[_0xa293('0x33')]);_0x171637[_0xa293('0x36')]=_[_0xa293('0x37')](_0x44ed50[_0xa293('0x32')],qs[_0xa293('0x38')](_0x2b3f1f['query'][_0xa293('0x38')]));_0x171637[_0xa293('0x36')]=_0x171637[_0xa293('0x36')][_0xa293('0x39')]?_0x171637['attributes']:_0x44ed50[_0xa293('0x32')];if(!_0x2b3f1f['query'][_0xa293('0x3a')](_0xa293('0x3b'))){_0x171637[_0xa293('0x20')]=qs['limit'](_0x2b3f1f[_0xa293('0x33')][_0xa293('0x20')]);_0x171637[_0xa293('0x1f')]=qs[_0xa293('0x1f')](_0x2b3f1f[_0xa293('0x33')]['offset']);}_0x171637[_0xa293('0x59')]=qs[_0xa293('0x3c')](_0x2b3f1f['query'][_0xa293('0x3c')]);_0x171637[_0xa293('0x3d')]=qs[_0xa293('0x35')](_[_0xa293('0x3e')](_0x2b3f1f['query'],_0x44ed50[_0xa293('0x35')]));_0x171637['where'][_0xa293('0x54')]=_0x256566['id'];if(_0x2b3f1f[_0xa293('0x33')][_0xa293('0x3f')]){_0x171637[_0xa293('0x3d')]=_[_0xa293('0x40')](_0x171637['where'],{'$or':_[_0xa293('0x2e')](_0x171637['attributes'],function(_0x177fb0){var _0x5528f0={};_0x5528f0[_0x177fb0]={'$like':'%'+_0x2b3f1f[_0xa293('0x33')]['filter']+'%'};return _0x5528f0;})});}_0x171637=_['merge']({},_0x171637,_0x2b3f1f[_0xa293('0x42')]);return db['MailInteraction'][_0xa293('0x22')]({'where':_0x171637[_0xa293('0x3d')]})[_0xa293('0x25')](function(_0x2675c6){_0x14e0be[_0xa293('0x22')]=_0x2675c6;if(_0x2b3f1f['query'][_0xa293('0x5d')]){_0x171637[_0xa293('0x4a')]=[{'model':db['CmContact'],'as':_0xa293('0x7f'),'required':![]},{'model':db[_0xa293('0x80')],'as':_0xa293('0x81'),'attributes':[_0xa293('0x29'),_0xa293('0x82'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xa293('0x83'),'attributes':['id',_0xa293('0x29'),_0xa293('0x84')],'where':_0x2b3f1f[_0xa293('0x33')]['tag']?{'id':_0x2b3f1f[_0xa293('0x33')][_0xa293('0x85')]}:undefined,'required':_0x2b3f1f['query'][_0xa293('0x85')]?!![]:![]}];}return db[_0xa293('0x7c')][_0xa293('0x44')](_0x171637);})[_0xa293('0x25')](function(_0x5c09f0){_0x14e0be[_0xa293('0x5e')]=_0x5c09f0;return _0x14e0be;});}})[_0xa293('0x25')](respondWithFilteredResult(_0x3277f7,_0x171637))['catch'](handleError(_0x3277f7,null));};exports[_0xa293('0x86')]=function addApplications(_0xbc3937,_0x49fc03){var _0x42e6ad=_0xbc3937[_0xa293('0x46')]['id'];var _0x1a45fa=_0xbc3937['body'];var _0x19df0d=0xc8;var _0x16cbde=null;return db[_0xa293('0x87')]['transaction']({'isolationLevel':db[_0xa293('0x87')]['Transaction'][_0xa293('0x88')][_0xa293('0x89')]},function(_0x56d3ed){return db[_0xa293('0x43')]['findOne']({'where':{'id':_0x42e6ad},'transaction':_0x56d3ed})[_0xa293('0x25')](function(_0x3f5024){if(_0x3f5024){return db['MailApplication'][_0xa293('0x26')]({'where':{'MailAccountId':_0x42e6ad},'transaction':_0x56d3ed})[_0xa293('0x25')](function(){var _0x510735=_[_0xa293('0x2e')](_0x1a45fa,function(_0x1b0bd7){_0x1b0bd7['MailAccountId']=_0x42e6ad;return _0x1b0bd7;});return db[_0xa293('0x8a')][_0xa293('0x8b')](_0x510735,{'transaction':_0x56d3ed});});}else{_0x19df0d=0x194;_0x16cbde=[];}});})[_0xa293('0x25')](function(){if(_0x19df0d!==0x194){return db[_0xa293('0x8a')][_0xa293('0x8c')]({'where':{'MailAccountId':_0x42e6ad},'order':_0xa293('0x8d')})[_0xa293('0x25')](function(_0x2f8f21){_0x16cbde=_0x2f8f21;});}})[_0xa293('0x1b')](function(_0x2278ce){_0x19df0d=0x1f4;logger[_0xa293('0x16')](_0x2278ce['stack']);if(_0x2278ce[_0xa293('0x29')]){delete _0x2278ce['name'];}_0x16cbde=_0x2278ce;})[_0xa293('0x8e')](function(){if(_0x16cbde===null){_0x49fc03[_0xa293('0x1c')](_0x19df0d);}else{if(_0x19df0d===0x1f4){_0x49fc03['status'](_0x19df0d)[_0xa293('0x2a')](_0x16cbde);}else{_0x49fc03[_0xa293('0x1d')](_0x19df0d)['json'](_0x16cbde);}}});};exports[_0xa293('0x8f')]=function(_0x3056aa,_0x56a5a6){var _0x2240f1={};var _0x1a84c1={};var _0x4acaf0;var _0x45d93a;return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x3056aa[_0xa293('0x46')]['id']}})['then'](handleEntityNotFound(_0x56a5a6,null))['then'](function(_0x1b276a){if(_0x1b276a){_0x4acaf0=_0x1b276a;_0x1a84c1[_0xa293('0x32')]=_[_0xa293('0x34')](db['MailApplication']['rawAttributes']);_0x1a84c1[_0xa293('0x33')]=_[_0xa293('0x34')](_0x3056aa[_0xa293('0x33')]);_0x1a84c1[_0xa293('0x35')]=_[_0xa293('0x37')](_0x1a84c1['model'],_0x1a84c1[_0xa293('0x33')]);_0x2240f1['attributes']=_[_0xa293('0x37')](_0x1a84c1[_0xa293('0x32')],qs['fields'](_0x3056aa[_0xa293('0x33')][_0xa293('0x38')]));_0x2240f1[_0xa293('0x36')]=_0x2240f1[_0xa293('0x36')][_0xa293('0x39')]?_0x2240f1[_0xa293('0x36')]:_0x1a84c1[_0xa293('0x32')];_0x2240f1['order']=qs[_0xa293('0x3c')](_0x3056aa[_0xa293('0x33')][_0xa293('0x3c')]);_0x2240f1['where']=qs['filters'](_[_0xa293('0x3e')](_0x3056aa[_0xa293('0x33')],_0x1a84c1['filters']));if(_0x3056aa[_0xa293('0x33')][_0xa293('0x3f')]){_0x2240f1[_0xa293('0x3d')]=_[_0xa293('0x40')](_0x2240f1[_0xa293('0x3d')],{'$or':_['map'](_0x2240f1[_0xa293('0x36')],function(_0x39bbd7){var _0x4fb53e={};_0x4fb53e[_0x39bbd7]={'$like':'%'+_0x3056aa['query'][_0xa293('0x3f')]+'%'};return _0x4fb53e;})});}_0x2240f1=_['merge']({},_0x2240f1,_0x3056aa[_0xa293('0x42')]);return _0x4acaf0['getApplications'](_0x2240f1);}})[_0xa293('0x25')](function(_0x455bb2){if(_0x455bb2){_0x45d93a=_0x455bb2[_0xa293('0x39')];if(!_0x3056aa['query'][_0xa293('0x3a')](_0xa293('0x3b'))){_0x2240f1[_0xa293('0x20')]=qs[_0xa293('0x20')](_0x3056aa[_0xa293('0x33')][_0xa293('0x20')]);_0x2240f1[_0xa293('0x1f')]=qs[_0xa293('0x1f')](_0x3056aa[_0xa293('0x33')][_0xa293('0x1f')]);}return _0x4acaf0[_0xa293('0x8f')](_0x2240f1);}})[_0xa293('0x25')](function(_0x1eafed){if(_0x1eafed){return _0x1eafed?{'count':_0x45d93a,'rows':_0x1eafed}:null;}})['then'](respondWithResult(_0x56a5a6,null))[_0xa293('0x1b')](handleError(_0x56a5a6,null));};exports['getMessages']=function(_0xc74012,_0x271332){var _0xeaa3e9={'raw':!![],'where':{}};var _0x368020={};var _0x19cb63={'count':0x0,'rows':[]};return db['MailAccount'][_0xa293('0x58')]({'where':{'id':_0xc74012[_0xa293('0x46')]['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x271332,null))[_0xa293('0x25')](function(_0x485c43){if(_0x485c43){_0x368020[_0xa293('0x32')]=_[_0xa293('0x34')](db[_0xa293('0x90')][_0xa293('0x49')]);_0x368020[_0xa293('0x33')]=_[_0xa293('0x34')](_0xc74012[_0xa293('0x33')]);_0x368020[_0xa293('0x35')]=_[_0xa293('0x37')](_0x368020[_0xa293('0x32')],_0x368020[_0xa293('0x33')]);_0xeaa3e9[_0xa293('0x36')]=_[_0xa293('0x37')](_0x368020['model'],qs[_0xa293('0x38')](_0xc74012['query'][_0xa293('0x38')]));_0xeaa3e9[_0xa293('0x36')]=_0xeaa3e9[_0xa293('0x36')][_0xa293('0x39')]?_0xeaa3e9[_0xa293('0x36')]:_0x368020['model'];if(!_0xc74012[_0xa293('0x33')][_0xa293('0x3a')]('nolimit')){_0xeaa3e9[_0xa293('0x20')]=qs[_0xa293('0x20')](_0xc74012['query'][_0xa293('0x20')]);_0xeaa3e9['offset']=qs[_0xa293('0x1f')](_0xc74012[_0xa293('0x33')][_0xa293('0x1f')]);}_0xeaa3e9[_0xa293('0x59')]=qs[_0xa293('0x3c')](_0xc74012[_0xa293('0x33')][_0xa293('0x3c')]);_0xeaa3e9[_0xa293('0x3d')]=qs[_0xa293('0x35')](_[_0xa293('0x3e')](_0xc74012['query'],_0x368020[_0xa293('0x35')]));_0xeaa3e9[_0xa293('0x3d')][_0xa293('0x54')]=_0x485c43['id'];if(_0xc74012[_0xa293('0x33')][_0xa293('0x3f')]){_0xeaa3e9[_0xa293('0x3d')]=_[_0xa293('0x40')](_0xeaa3e9['where'],{'$or':_['map'](_0xeaa3e9[_0xa293('0x36')],function(_0x334694){var _0x5b8195={};_0x5b8195[_0x334694]={'$like':'%'+_0xc74012[_0xa293('0x33')][_0xa293('0x3f')]+'%'};return _0x5b8195;})});}if(_0xc74012[_0xa293('0x33')]['$gte']){var _0x18e385=_0xc74012[_0xa293('0x33')][_0xa293('0x91')]['split'](',');var _0x55c270={};_0x55c270[_0x18e385[0x0]]={'$gte':moment(_0x18e385[0x1])['format'](_0xa293('0x92'))};_0xeaa3e9[_0xa293('0x3d')]=_[_0xa293('0x40')](_0xeaa3e9[_0xa293('0x3d')],_0x55c270);}_0xeaa3e9=_[_0xa293('0x40')]({},_0xeaa3e9,_0xc74012[_0xa293('0x42')]);return db[_0xa293('0x90')][_0xa293('0x22')]({'where':_0xeaa3e9[_0xa293('0x3d')]})[_0xa293('0x25')](function(_0x25441b){_0x19cb63['count']=_0x25441b;if(_0xc74012['query'][_0xa293('0x5d')]){_0xeaa3e9[_0xa293('0x4a')]=[{'all':!![]}];}return db[_0xa293('0x90')][_0xa293('0x44')](_0xeaa3e9);})[_0xa293('0x25')](function(_0x1d2275){if(_0xc74012[_0xa293('0x33')][_0xa293('0x93')]==='true'){for(var _0x1a8926=0x0;_0x1a8926<_0x1d2275[_0xa293('0x39')];_0x1a8926++){_0x1d2275[_0x1a8926][_0xa293('0x4d')]=juice(_0x1d2275[_0x1a8926][_0xa293('0x4d')]);}}_0x19cb63['rows']=_0x1d2275;return _0x19cb63;});}})[_0xa293('0x25')](respondWithFilteredResult(_0x271332,_0xeaa3e9))[_0xa293('0x1b')](handleError(_0x271332,null));};exports['send']=function(_0x376856,_0x34101e){var _0x269113,_0x2ad71b={},_0x427fb9;if(_0x376856[_0xa293('0x4d')]['to']){_0x427fb9=_0x376856['body']['to'][_0xa293('0x94')](',')[0x0];}return db[_0xa293('0x43')][_0xa293('0x4b')]({'where':{'id':_0x376856['params']['id']},'include':[{'model':db['CmList'],'as':_0xa293('0x95'),'include':[{'model':db[_0xa293('0x96')],'as':_0xa293('0x97'),'where':{'email':_0x427fb9},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xa293('0x51')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x34101e,null))[_0xa293('0x25')](function(_0xb69e9f){if(_0xb69e9f){_0x269113=_0xb69e9f;if(_0xb69e9f[_0xa293('0x48')]){if(_[_0xa293('0x98')](_0x376856[_0xa293('0x4d')]['from'])){_0x376856[_0xa293('0x4d')]['from']=util['format']('%s\x20<%s>',_0xb69e9f['name'],_0xb69e9f['email']||_0xb69e9f['Smtp'][_0xa293('0x65')]);}if(_0x376856[_0xa293('0x4d')][_0xa293('0x99')]&&_0x376856['body'][_0xa293('0x99')]['length']){for(var _0x2e9260=0x0;_0x2e9260<_0x376856[_0xa293('0x4d')][_0xa293('0x99')][_0xa293('0x39')];_0x2e9260+=0x1){_0x376856['body'][_0xa293('0x99')][_0x2e9260]={'filename':_0x376856['body'][_0xa293('0x99')][_0x2e9260]['name'],'path':path[_0xa293('0x9a')](config[_0xa293('0x9b')],_0xa293('0x9c'),_0x376856[_0xa293('0x4d')][_0xa293('0x99')][_0x2e9260][_0xa293('0x9d')])};}}var _0x38f00d={'tls':{'rejectUnauthorized':![]}};if(_[_0xa293('0x98')](_0xb69e9f[_0xa293('0x48')][_0xa293('0x69')])){if(_0xb69e9f[_0xa293('0x48')][_0xa293('0x6c')]){_0x38f00d['auth']={'user':_0xb69e9f[_0xa293('0x48')][_0xa293('0x65')],'pass':_0xb69e9f['Smtp'][_0xa293('0x68')]};}_0x38f00d[_0xa293('0x6a')]=_0xb69e9f[_0xa293('0x48')]['host'];_0x38f00d['port']=_0xb69e9f['Smtp'][_0xa293('0x6b')];_0x38f00d[_0xa293('0x9e')]=_0xb69e9f[_0xa293('0x48')]['secure'];}else{_0x38f00d[_0xa293('0x69')]=_0xb69e9f['Smtp']['service'];_0x38f00d['auth']={'user':_0xb69e9f[_0xa293('0x48')][_0xa293('0x65')],'pass':_0xb69e9f['Smtp'][_0xa293('0x68')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x38f00d,'message':_0x376856[_0xa293('0x4d')]});}else{throw new Error(_0xa293('0x9f'));}}})[_0xa293('0x25')](function(_0x5549ef){if(_0x5549ef){_0x2ad71b=_0x5549ef;if(_0x269113[_0xa293('0x95')]){if(_0x269113['List'][_0xa293('0x97')]['length']){return _0x269113['List']['Contacts'][0x0];}else{return db[_0xa293('0x96')]['create'](_[_0xa293('0xb')](_0x376856[_0xa293('0x4d')],{'firstName':_0x376856['body']['to'],'email':_0x376856[_0xa293('0x4d')]['to'],'phone':_0x376856['body']['to'],'ListId':_0x269113[_0xa293('0x63')]}));}}else{throw new Error(_0xa293('0x9f'));}}})['then'](function(_0x3d8d85){if(_0x3d8d85){var _0x5ee89c={'UserId':_0x376856[_0xa293('0x65')]['id'],'ContactId':_0x3d8d85['id'],'MailAccountId':_0x269113['id'],'inReplyTo':_0x2ad71b[_0xa293('0xa0')],'to':_0x376856['body']['from'],'cc':_0x376856[_0xa293('0x4d')]['cc'],'subject':_0x376856['body'][_0xa293('0xa1')],'attach':_0x376856[_0xa293('0x4d')]['attach'],'firstMsgDirection':_0xa293('0xa2'),'lastMsgAt':moment()[_0xa293('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xa293('0xa2'),'Messages':[_[_0xa293('0x40')](_0x376856[_0xa293('0x4d')],{'messageId':_0x2ad71b[_0xa293('0xa0')],'sentAt':moment()[_0xa293('0xa3')](_0xa293('0x92')),'read':!![],'MailAccountId':_0x269113['id'],'UserId':_0x376856[_0xa293('0x65')]['id'],'ContactId':_0x3d8d85['id']})]};if(_0x376856[_0xa293('0x4d')][_0xa293('0xa4')]){_0x5ee89c=_['merge'](_0x5ee89c,_0x376856[_0xa293('0x4d')][_0xa293('0xa4')]);}return db['MailInteraction']['create'](_0x5ee89c,{'include':[{'model':db['MailMessage'],'as':_0xa293('0xa5')}]});}})[_0xa293('0x25')](respondWithResult(_0x34101e,null))[_0xa293('0x1b')](handleError(_0x34101e,null));};exports['verifySmtp']=function(_0x425c42,_0x4e0cd2){return db['MailAccount'][_0xa293('0x4b')]({'where':{'id':_0x425c42[_0xa293('0x46')]['id']},'include':[{'model':db[_0xa293('0x51')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa293('0xa6')],'as':_0xa293('0xa6'),'raw':!![]}]}]})[_0xa293('0x25')](handleEntityNotFound(_0x4e0cd2,null))[_0xa293('0x25')](function(_0x1d9adf){if(!_0x1d9adf[_0xa293('0x48')])return;var _0x3a460e={'id':_0x1d9adf['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1d9adf[_0xa293('0x60')]!=='custom'){_0x3a460e['service']=_0x1d9adf['provider'];}else{_0x3a460e[_0xa293('0x6a')]=_0x1d9adf[_0xa293('0x48')]['host'];_0x3a460e[_0xa293('0x6b')]=_0x1d9adf['Smtp'][_0xa293('0x6b')];_0x3a460e[_0xa293('0x9e')]=_0x1d9adf[_0xa293('0x48')]['secure'];}if(_0x1d9adf[_0xa293('0x48')][_0xa293('0x6c')]){if(_0x1d9adf[_0xa293('0x48')][_0xa293('0x4e')]){_0x3a460e[_0xa293('0xa7')]={'type':_0xa293('0xa8'),'user':_0x1d9adf[_0xa293('0x48')][_0xa293('0x65')],'accessToken':_0x1d9adf[_0xa293('0x48')][_0xa293('0xa6')][_0xa293('0xa9')]};}else{_0x3a460e[_0xa293('0xa7')]={'user':_0x1d9adf[_0xa293('0x48')][_0xa293('0x65')],'pass':_0x1d9adf[_0xa293('0x48')][_0xa293('0x68')]};}}return respondWithRpcPromise(_0xa293('0xaa'),_0xa293('0xab'),{'account':_0x3a460e});})[_0xa293('0x25')](respondWithResult(_0x4e0cd2,null))[_0xa293('0x1b')](handleError(_0x4e0cd2,null));};exports[_0xa293('0x26')]=function(_0x257768,_0x384237){return db[_0xa293('0x43')][_0xa293('0x4b')]({'where':{'id':_0x257768['params']['id']}})['then'](handleEntityNotFound(_0x384237,null))[_0xa293('0x25')](function(_0x3fd411){if(_0x3fd411&&_0x3fd411[_0xa293('0x69')]){throw new db[(_0xa293('0xac'))][(_0xa293('0xad'))](_0xa293('0xae'));}return _0x3fd411;})[_0xa293('0x25')](removeEntity(_0x384237,null))[_0xa293('0x1b')](handleError(_0x384237,null));};exports[_0xa293('0xaf')]=function(_0x1b68e8,_0x467c45){return db['MailAccount'][_0xa293('0x4b')]({'where':{'id':_0x1b68e8[_0xa293('0x46')]['id']}})['then'](handleEntityNotFound(_0x467c45,null))['then'](function(_0x1b565f){if(_0x1b565f){return _0x1b565f[_0xa293('0xaf')](_0x1b68e8[_0xa293('0x4d')]['ids'],_[_0xa293('0x7e')](_0x1b68e8[_0xa293('0x4d')],[_0xa293('0x7d'),'id'])||{})[_0xa293('0xb0')](function(_0x32653a){for(var _0x5b2e51=0x0;_0x5b2e51<_0x1b68e8[_0xa293('0x4d')][_0xa293('0x7d')][_0xa293('0x39')];_0x5b2e51+=0x1){socket[_0xa293('0xb1')]('userMailAccount:save',{'UserId':Number(_0x1b68e8[_0xa293('0x4d')]['ids'][_0x5b2e51]),'MailAccountId':Number(_0x1b68e8[_0xa293('0x46')]['id'])});}return _0x32653a;});}})[_0xa293('0x25')](respondWithResult(_0x467c45,null))[_0xa293('0x1b')](handleError(_0x467c45,null));};exports['removeAgents']=function(_0x5a2de2,_0x238c30){return db['MailAccount']['find']({'where':{'id':_0x5a2de2['params']['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x238c30,null))[_0xa293('0x25')](function(_0x53aba0){if(_0x53aba0){return _0x53aba0[_0xa293('0xb2')](_0x5a2de2[_0xa293('0x33')][_0xa293('0x7d')])[_0xa293('0x25')](function(){if(_['isArray'](_0x5a2de2[_0xa293('0x33')][_0xa293('0x7d')])){for(var _0x2c858d=0x0;_0x2c858d<_0x5a2de2[_0xa293('0x33')][_0xa293('0x7d')][_0xa293('0x39')];_0x2c858d+=0x1){socket[_0xa293('0xb1')]('userMailAccount:remove',{'UserId':Number(_0x5a2de2[_0xa293('0x33')]['ids'][_0x2c858d]),'MailAccountId':Number(_0x5a2de2['params']['id'])});}}else{socket[_0xa293('0xb1')](_0xa293('0xb3'),{'UserId':Number(_0x5a2de2[_0xa293('0x33')]['ids']),'MailAccountId':Number(_0x5a2de2[_0xa293('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x238c30,null))[_0xa293('0x1b')](handleError(_0x238c30,null));};exports[_0xa293('0xb4')]=function(_0x8c593b,_0x46ed04){var _0x1c9779={};var _0x144763={};var _0xecda3c;var _0x299129;return db[_0xa293('0x43')][_0xa293('0x58')]({'where':{'id':_0x8c593b['params']['id']}})[_0xa293('0x25')](handleEntityNotFound(_0x46ed04,null))[_0xa293('0x25')](function(_0x575b97){if(_0x575b97){_0xecda3c=_0x575b97;_0x144763[_0xa293('0x32')]=_['keys'](db[_0xa293('0x80')][_0xa293('0x49')]);_0x144763[_0xa293('0x33')]=_['keys'](_0x8c593b[_0xa293('0x33')]);_0x144763[_0xa293('0x35')]=_[_0xa293('0x37')](_0x144763['model'],_0x144763[_0xa293('0x33')]);_0x1c9779['attributes']=_[_0xa293('0x37')](_0x144763[_0xa293('0x32')],qs[_0xa293('0x38')](_0x8c593b['query']['fields']));_0x1c9779['attributes']=_0x1c9779[_0xa293('0x36')][_0xa293('0x39')]?_0x1c9779[_0xa293('0x36')]:_0x144763[_0xa293('0x32')];_0x1c9779[_0xa293('0x59')]=qs[_0xa293('0x3c')](_0x8c593b[_0xa293('0x33')]['sort']);_0x1c9779[_0xa293('0x3d')]=qs[_0xa293('0x35')](_[_0xa293('0x3e')](_0x8c593b[_0xa293('0x33')],_0x144763['filters']));if(_0x8c593b[_0xa293('0x33')][_0xa293('0x3f')]){_0x1c9779[_0xa293('0x3d')]=_[_0xa293('0x40')](_0x1c9779[_0xa293('0x3d')],{'$or':_['map'](_0x1c9779[_0xa293('0x36')],function(_0xace7cf){var _0x10fdde={};_0x10fdde[_0xace7cf]={'$like':'%'+_0x8c593b[_0xa293('0x33')][_0xa293('0x3f')]+'%'};return _0x10fdde;})});}_0x1c9779=_[_0xa293('0x40')]({},_0x1c9779,_0x8c593b['options']);return _0xecda3c[_0xa293('0xb4')](_0x1c9779);}})[_0xa293('0x25')](function(_0xede548){if(_0xede548){_0x299129=_0xede548['length'];if(!_0x8c593b[_0xa293('0x33')][_0xa293('0x3a')](_0xa293('0x3b'))){_0x1c9779[_0xa293('0x20')]=qs[_0xa293('0x20')](_0x8c593b[_0xa293('0x33')][_0xa293('0x20')]);_0x1c9779[_0xa293('0x1f')]=qs[_0xa293('0x1f')](_0x8c593b['query'][_0xa293('0x1f')]);}return _0xecda3c[_0xa293('0xb4')](_0x1c9779);}})[_0xa293('0x25')](function(_0x434142){if(_0x434142){return _0x434142?{'count':_0x299129,'rows':_0x434142}:null;}})[_0xa293('0x25')](respondWithResult(_0x46ed04,null))['catch'](handleError(_0x46ed04,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e5f7569..c6f17ec 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 _0x539d=['hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','remove','emit'];(function(_0x128c0c,_0x4e3f98){var _0x43a438=function(_0x31ee5c){while(--_0x31ee5c){_0x128c0c['push'](_0x128c0c['shift']());}};_0x43a438(++_0x4e3f98);}(_0x539d,0x17b));var _0xd539=function(_0x2b012b,_0x463e28){_0x2b012b=_0x2b012b-0x0;var _0x32c4cf=_0x539d[_0x2b012b];return _0x32c4cf;};'use strict';var EventEmitter=require(_0xd539('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xd539('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd539('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd539('0x3')};function emitEvent(_0x2a38d5){return function(_0xe8e6e4,_0x19ae25,_0x2f9d1f){MailAccountEvents['emit'](_0x2a38d5+':'+_0xe8e6e4['id'],_0xe8e6e4);MailAccountEvents[_0xd539('0x4')](_0x2a38d5,_0xe8e6e4);_0x2f9d1f(null);};}for(var e in events){if(events[_0xd539('0x5')](e)){var event=events[e];MailAccount[_0xd539('0x6')](e,emitEvent(event));}}module[_0xd539('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x16a2=['events','../../mysqldb','MailAccount','setMaxListeners','save','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16a2,0x1d0));var _0x216a=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x16a2[_0xb83ec2];return _0x4d2fbf;};'use strict';var EventEmitter=require(_0x216a('0x0'));var MailAccount=require(_0x216a('0x1'))['db'][_0x216a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x216a('0x3')](0x0);var events={'afterCreate':_0x216a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4522fa){return function(_0x22c4a1,_0x34d8e7,_0x188a8d){MailAccountEvents['emit'](_0x4522fa+':'+_0x22c4a1['id'],_0x22c4a1);MailAccountEvents['emit'](_0x4522fa,_0x22c4a1);_0x188a8d(null);};}for(var e in events){if(events[_0x216a('0x5')](e)){var event=events[e];MailAccount[_0x216a('0x6')](e,emitEvent(event));}}module[_0x216a('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2d006f5..d14bc5b 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 _0xd93e=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./mailAccount.attributes','exports','define','mail_accounts','lodash'];(function(_0x22ea66,_0x30123a){var _0x529757=function(_0x2340e){while(--_0x2340e){_0x22ea66['push'](_0x22ea66['shift']());}};_0x529757(++_0x30123a);}(_0xd93e,0x1a1));var _0xed93=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd93e[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var logger=require(_0xed93('0x2'))('api');var moment=require(_0xed93('0x3'));var BPromise=require(_0xed93('0x4'));var rp=require(_0xed93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed93('0x6'));var config=require('../../config/environment');var attributes=require(_0xed93('0x7'));module[_0xed93('0x8')]=function(_0x31dd58,_0x56edf0){return _0x31dd58[_0xed93('0x9')]('MailAccount',attributes,{'tableName':_0xed93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe25b=['mail_accounts','lodash','util','api','moment','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0xdff763,_0x477c10){var _0x99390e=function(_0x344514){while(--_0x344514){_0xdff763['push'](_0xdff763['shift']());}};_0x99390e(++_0x477c10);}(_0xe25b,0xf3));var _0xbe25=function(_0x619e53,_0x3cdbd2){_0x619e53=_0x619e53-0x0;var _0x24c385=_0xe25b[_0x619e53];return _0x24c385;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var logger=require('../../config/logger')(_0xbe25('0x2'));var moment=require(_0xbe25('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe25('0x4'));var rimraf=require(_0xbe25('0x5'));var config=require(_0xbe25('0x6'));var attributes=require(_0xbe25('0x7'));module[_0xbe25('0x8')]=function(_0x352c34,_0x1dbf8a){return _0x352c34[_0xbe25('0x9')]('MailAccount',attributes,{'tableName':_0xbe25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 740d717..87d1836 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 _0x1b83=['waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','options','raw','where','include','map','model','attributes','catch','ShowMailAccount','MailAccount','find','NotifyMailAccount','mail','difference','CmContact','createdAt','updatedAt','CompanyId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','List','Contacts','DESC','MailServerOut','omit','Applications','list','applications','orderBy','priority','asc','push','length','autoclose','*,*,*,*','from','create','List\x20not\x20found','contact','messageId','generate','attach','format','Messages','inReplyTo','MailInteraction','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name'];(function(_0x51e6a7,_0x312fab){var _0x4d1ca6=function(_0x1019fc){while(--_0x1019fc){_0x51e6a7['push'](_0x51e6a7['shift']());}};_0x4d1ca6(++_0x312fab);}(_0x1b83,0x6e));var _0x31b8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1b83[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x31b8('0x0'));var moment=require(_0x31b8('0x1'));var BPromise=require(_0x31b8('0x2'));var rs=require(_0x31b8('0x3'));var fs=require('fs');var Redis=require(_0x31b8('0x4'));var db=require(_0x31b8('0x5'))['db'];var utils=require(_0x31b8('0x6'));var logger=require(_0x31b8('0x7'))(_0x31b8('0x8'));var config=require(_0x31b8('0x9'));var jayson=require(_0x31b8('0xa'));var client=jayson[_0x31b8('0xb')][_0x31b8('0xc')]({'port':0x232c});config[_0x31b8('0xd')]=_[_0x31b8('0xe')](config[_0x31b8('0xd')],{'host':_0x31b8('0xf'),'port':0x18eb});var socket=require(_0x31b8('0x10'))(new Redis(config[_0x31b8('0xd')]));require(_0x31b8('0x11'))[_0x31b8('0x12')](socket);function respondWithRpcPromise(_0x1df89d,_0x5831c4,_0x31d7e1){return new BPromise(function(_0x3cdfc4,_0x5b907f){return client[_0x31b8('0x13')](_0x1df89d,_0x31d7e1)[_0x31b8('0x14')](function(_0x3d0edb){logger[_0x31b8('0x15')]('MailAccount,\x20%s,\x20%s',_0x5831c4,_0x31b8('0x16'));logger[_0x31b8('0x17')](_0x31b8('0x18'),_0x5831c4,'request\x20sent',JSON[_0x31b8('0x19')](_0x3d0edb));if(_0x3d0edb[_0x31b8('0x1a')]){if(_0x3d0edb['error'][_0x31b8('0x1b')]===0x1f4){logger[_0x31b8('0x1a')](_0x31b8('0x1c'),_0x5831c4,_0x3d0edb[_0x31b8('0x1a')][_0x31b8('0x1d')]);return _0x5b907f(_0x3d0edb[_0x31b8('0x1a')]['message']);}logger['error'](_0x31b8('0x1c'),_0x5831c4,_0x3d0edb[_0x31b8('0x1a')][_0x31b8('0x1d')]);return _0x3cdfc4(_0x3d0edb[_0x31b8('0x1a')]['message']);}else{logger[_0x31b8('0x15')](_0x31b8('0x1c'),_0x5831c4,_0x31b8('0x16'));_0x3cdfc4(_0x3d0edb[_0x31b8('0x1e')]['message']);}})['catch'](function(_0x2bdb59){logger[_0x31b8('0x1a')](_0x31b8('0x1c'),_0x5831c4,_0x2bdb59);_0x5b907f(_0x2bdb59);});});}exports[_0x31b8('0x1f')]=function(_0x18763d){var _0x3586c6=this;return new Promise(function(_0x287aa2,_0x4fbf5e){return db['MailAccount']['findAll']({'raw':_0x18763d[_0x31b8('0x20')]?_0x18763d['options'][_0x31b8('0x21')]===undefined?!![]:![]:!![],'where':_0x18763d[_0x31b8('0x20')]?_0x18763d[_0x31b8('0x20')][_0x31b8('0x22')]||null:null,'attributes':_0x18763d[_0x31b8('0x20')]?_0x18763d[_0x31b8('0x20')]['attributes']||null:null,'limit':_0x18763d[_0x31b8('0x20')]?_0x18763d[_0x31b8('0x20')]['limit']||null:null,'include':_0x18763d['options']?_0x18763d[_0x31b8('0x20')][_0x31b8('0x23')]?_[_0x31b8('0x24')](_0x18763d[_0x31b8('0x20')][_0x31b8('0x23')],function(_0x1c0ae2){return{'model':db[_0x1c0ae2[_0x31b8('0x25')]],'as':_0x1c0ae2['as'],'attributes':_0x1c0ae2[_0x31b8('0x26')],'include':_0x1c0ae2[_0x31b8('0x23')]?_[_0x31b8('0x24')](_0x1c0ae2[_0x31b8('0x23')],function(_0x130d8){return{'model':db[_0x130d8[_0x31b8('0x25')]],'as':_0x130d8['as'],'attributes':_0x130d8['attributes'],'include':_0x130d8[_0x31b8('0x23')]?_[_0x31b8('0x24')](_0x130d8[_0x31b8('0x23')],function(_0xfad905){return{'model':db[_0xfad905[_0x31b8('0x25')]],'as':_0xfad905['as'],'attributes':_0xfad905['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x516b50){logger['info'](_0x31b8('0x1f'),_0x18763d);logger[_0x31b8('0x17')](_0x31b8('0x1f'),_0x18763d,JSON['stringify'](_0x516b50));_0x287aa2(_0x516b50);})[_0x31b8('0x27')](function(_0x5e33){logger[_0x31b8('0x1a')](_0x31b8('0x1f'),_0x5e33['message'],_0x18763d);_0x4fbf5e(_0x3586c6[_0x31b8('0x1a')](0x1f4,_0x5e33[_0x31b8('0x1d')]));});});};exports[_0x31b8('0x28')]=function(_0x10ef09){var _0x189f67=this;return new Promise(function(_0x19f4d7,_0x2e0396){return db[_0x31b8('0x29')][_0x31b8('0x2a')]({'raw':_0x10ef09[_0x31b8('0x20')]?_0x10ef09[_0x31b8('0x20')][_0x31b8('0x21')]===undefined?!![]:![]:!![],'where':_0x10ef09[_0x31b8('0x20')]?_0x10ef09[_0x31b8('0x20')]['where']||null:null,'attributes':_0x10ef09['options']?_0x10ef09[_0x31b8('0x20')]['attributes']||null:null,'include':_0x10ef09['options']?_0x10ef09['options'][_0x31b8('0x23')]?_[_0x31b8('0x24')](_0x10ef09[_0x31b8('0x20')][_0x31b8('0x23')],function(_0x436d6b){return{'model':db[_0x436d6b[_0x31b8('0x25')]],'as':_0x436d6b['as'],'attributes':_0x436d6b['attributes'],'include':_0x436d6b[_0x31b8('0x23')]?_[_0x31b8('0x24')](_0x436d6b[_0x31b8('0x23')],function(_0x5857b6){return{'model':db[_0x5857b6[_0x31b8('0x25')]],'as':_0x5857b6['as'],'attributes':_0x5857b6[_0x31b8('0x26')],'include':_0x5857b6[_0x31b8('0x23')]?_['map'](_0x5857b6[_0x31b8('0x23')],function(_0x5c5837){return{'model':db[_0x5c5837[_0x31b8('0x25')]],'as':_0x5c5837['as'],'attributes':_0x5c5837[_0x31b8('0x26')]};}):[]};}):[]};}):[]:[]})[_0x31b8('0x14')](function(_0x17d1ac){logger[_0x31b8('0x15')](_0x31b8('0x28'),_0x10ef09);logger[_0x31b8('0x17')](_0x31b8('0x28'),_0x10ef09,JSON[_0x31b8('0x19')](_0x17d1ac));_0x19f4d7(_0x17d1ac);})[_0x31b8('0x27')](function(_0x3ebd00){logger[_0x31b8('0x1a')]('ShowMailAccount',_0x3ebd00['message'],_0x10ef09);_0x2e0396(_0x189f67['error'](0x1f4,_0x3ebd00[_0x31b8('0x1d')]));});});};exports[_0x31b8('0x2b')]=function(_0x3d0fe){var _0x4ea90b=this;return new Promise(function(_0x5c97bf,_0x35f558){var _0x2e0e14={'body':_0x3d0fe['body'],'channel':_0x31b8('0x2c')};var _0x3bebf7=_[_0x31b8('0x2d')](_['keys'](db[_0x31b8('0x2e')]['rawAttributes']),[_0x31b8('0x2f'),_0x31b8('0x30'),_0x31b8('0x31'),'ListId']);var _0x3d33bc=![];if(_0x3d0fe[_0x31b8('0x32')]['id']){delete _0x3d0fe[_0x31b8('0x32')]['id'];}if(_[_0x31b8('0x33')](_0x3d0fe[_0x31b8('0x32')]['from'])){return _0x35f558(_0x4ea90b['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x31b8('0x33')](_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x32')])||_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x32')]===''){return _0x35f558(_0x4ea90b[_0x31b8('0x1a')](0x1f4,_0x31b8('0x34')));}if(_['isNil'](_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x35')])){return _0x35f558(_0x4ea90b[_0x31b8('0x1a')](0x1f4,_0x31b8('0x36')+_0x3bebf7));}if(!_[_0x31b8('0x37')](_0x3bebf7,_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x35')])){return _0x35f558(_0x4ea90b['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3bebf7));}var _0x873728={};_0x873728[_0x3d0fe['body'][_0x31b8('0x35')]]=_0x3d0fe[_0x31b8('0x32')]['from'];return db['MailAccount'][_0x31b8('0x2a')]({'where':{'id':_0x3d0fe[_0x31b8('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x31b8('0x39'),'include':[{'model':db[_0x31b8('0x2e')],'as':_0x31b8('0x3a'),'where':_0x873728,'limit':0x1,'order':[[_0x31b8('0x30'),_0x31b8('0x3b')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x31b8('0x3c')],'as':'Smtp'}]})[_0x31b8('0x14')](function(_0x52f3d1){if(_0x52f3d1&&_0x52f3d1[_0x31b8('0x39')]){var _0x9bc2ff=_0x52f3d1['get']({'plain':!![]});_0x2e0e14[_0x31b8('0x38')]=_[_0x31b8('0x3d')](_0x9bc2ff,['Applications',_0x31b8('0x39')]);_0x2e0e14['applications']=_0x9bc2ff[_0x31b8('0x3e')];_0x2e0e14[_0x31b8('0x3f')]=_0x9bc2ff[_0x31b8('0x39')];_0x2e0e14[_0x31b8('0x40')]=_[_0x31b8('0x41')](_0x2e0e14[_0x31b8('0x40')],[_0x31b8('0x42')],[_0x31b8('0x43')]);if(_0x2e0e14['account']&&_0x2e0e14[_0x31b8('0x38')]['autoclose']){_0x2e0e14[_0x31b8('0x40')][_0x31b8('0x44')]({'id':0x0,'priority':_0x2e0e14[_0x31b8('0x40')][_0x31b8('0x45')]+0x1,'app':'close','appdata':_0x31b8('0x46'),'interval':_0x31b8('0x47')});}if(_0x2e0e14['account'][_0x31b8('0x3e')]){delete _0x2e0e14[_0x31b8('0x38')][_0x31b8('0x3e')];}if(_0x2e0e14[_0x31b8('0x38')][_0x31b8('0x39')]){delete _0x2e0e14['account'][_0x31b8('0x39')];}if(_0x9bc2ff['List'][_0x31b8('0x3a')][_0x31b8('0x45')]){return _0x9bc2ff[_0x31b8('0x39')]['Contacts'][0x0];}var _0x35c21c=_[_0x31b8('0xe')](_0x3d0fe[_0x31b8('0x32')],{'firstName':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x48')],'ListId':_0x9bc2ff['ListId']});_0x35c21c[_0x3d0fe[_0x31b8('0x32')]['mapKey']]=_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x48')];return db['CmContact'][_0x31b8('0x49')](_0x35c21c);}else{throw new Error(_0x31b8('0x4a'));}})[_0x31b8('0x14')](function(_0x3d0290){_0x2e0e14[_0x31b8('0x4b')]=_0x3d0290;if(_0x3d0290){if(!_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')]['messageId']){_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x4c')]=rs[_0x31b8('0x4d')]()+'\x20'+_0x3d0fe[_0x31b8('0x32')]['message'][_0x31b8('0x48')];}var _0x3f7af0={'ContactId':_0x3d0290['id'],'MailAccountId':_0x3d0fe['account']['id'],'inReplyTo':_0x3d0fe[_0x31b8('0x32')]['message'][_0x31b8('0x4c')],'to':_0x3d0fe['body'][_0x31b8('0x1d')]['from'],'cc':_0x3d0fe['body'][_0x31b8('0x1d')]['cc'],'subject':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')]['subject'],'attach':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x4e')],'lastMsgAt':moment()[_0x31b8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x31b8('0x2a')]({'where':{'closed':![],'MailAccountId':_0x3d0fe['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x31b8('0x50'),'attributes':['messageId'],'where':{'messageId':_0x3d0fe[_0x31b8('0x32')]['message'][_0x31b8('0x51')]}}]})[_0x31b8('0x14')](function(_0x4f09ec){if(_0x4f09ec){return[_0x4f09ec,![]];}return db[_0x31b8('0x52')][_0x31b8('0x49')](_0x3f7af0)[_0x31b8('0x14')](function(_0x242043){return[_0x242043,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x31b8('0x53')](function(_0xbee1e2,_0x1a7916){if(_0xbee1e2){_0x3d33bc=_0x1a7916;if(!_0x1a7916){return _0xbee1e2[_0x31b8('0x54')]({'inReplyTo':_0x3d0fe['body'][_0x31b8('0x1d')][_0x31b8('0x4c')],'to':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x48')],'cc':_0x3d0fe[_0x31b8('0x32')]['message']['cc'],'subject':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x55')],'attach':_0xbee1e2[_0x31b8('0x4e')]?_0xbee1e2[_0x31b8('0x4e')]:_0x3d0fe[_0x31b8('0x32')]['message'][_0x31b8('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0x31b8('0x56')),'lastMsgAt':moment()[_0x31b8('0x4f')](_0x31b8('0x56')),'lastMsgDirection':'in'});}else{return _0xbee1e2;}}})['then'](function(_0x1cce61){_0x2e0e14[_0x31b8('0x57')]=_0x1cce61[_0x31b8('0x58')]({'plain':!![]});_0x2e0e14[_0x31b8('0x57')][_0x31b8('0x59')]=_0x3d33bc;return db['MailMessage']['create']({'body':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x32')],'MailAccountId':_0x3d0fe[_0x31b8('0x38')]['id'],'MailInteractionId':_0x1cce61['id'],'direction':'in','ContactId':_0x2e0e14[_0x31b8('0x4b')]['id'],'messageId':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x4c')],'from':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x48')],'to':_0x3d0fe['body'][_0x31b8('0x1d')]['to'],'cc':_0x3d0fe[_0x31b8('0x32')]['message']['cc'],'subject':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x55')],'attach':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x4e')],'Attachments':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x5a')],'originTo':_0x3d0fe['body'][_0x31b8('0x1d')]['originTo'],'originCc':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x5b')],'bcc':_0x3d0fe['body'][_0x31b8('0x1d')][_0x31b8('0x5c')],'ChatWebsiteId':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x5d')]||null,'originChannel':_0x3d0fe[_0x31b8('0x32')]['message'][_0x31b8('0x5e')]||_0x31b8('0x5f'),'ChatOfflineMessageId':_0x3d0fe[_0x31b8('0x32')][_0x31b8('0x1d')][_0x31b8('0x60')]||null},{'include':[{'model':db[_0x31b8('0x61')],'as':_0x31b8('0x62')}]});})[_0x31b8('0x14')](function(_0x53335a){_0x2e0e14[_0x31b8('0x1d')]=_0x53335a;if(_0x2e0e14[_0x31b8('0x57')][_0x31b8('0x63')]){return db[_0x31b8('0x64')][_0x31b8('0x2a')]({'attributes':['id','name'],'where':{'id':_0x2e0e14[_0x31b8('0x57')][_0x31b8('0x63')]}})['then'](function(_0x4583b0){if(_0x4583b0){_0x2e0e14[_0x31b8('0x40')][_0x31b8('0x65')]({'id':0x0,'priority':0x0,'app':_0x31b8('0x66'),'appdata':_0x4583b0[_0x31b8('0x67')]+','+(_0x2e0e14['account'][_0x31b8('0x68')]||0xa),'interval':_0x31b8('0x47')});}return respondWithRpcPromise(_0x31b8('0x69'),_0x31b8('0x6a'),_0x2e0e14);});}return respondWithRpcPromise(_0x31b8('0x69'),_0x31b8('0x6a'),_0x2e0e14);})[_0x31b8('0x14')](function(_0xd5257){_0x5c97bf(_0xd5257);})[_0x31b8('0x27')](function(_0x302207){_0x35f558(_0x4ea90b['error'](0x1f4,_0x302207[_0x31b8('0x1d')]));});});}; \ No newline at end of file +var _0x14e3=['length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','MailInteraction','create','Contact\x20not\x20found','update','interaction','created','attachments','originTo','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','User','name','UserId','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','orderBy','priority','asc','autoclose','*,*,*,*'];(function(_0xfdac30,_0x3bbd13){var _0x31aa35=function(_0x21ef79){while(--_0x21ef79){_0xfdac30['push'](_0xfdac30['shift']());}};_0x31aa35(++_0x3bbd13);}(_0x14e3,0x87));var _0x314e=function(_0x56758e,_0x2f6ab9){_0x56758e=_0x56758e-0x0;var _0x2c4516=_0x14e3[_0x56758e];return _0x2c4516;};'use strict';var _=require(_0x314e('0x0'));var util=require(_0x314e('0x1'));var moment=require(_0x314e('0x2'));var BPromise=require('bluebird');var rs=require(_0x314e('0x3'));var fs=require('fs');var Redis=require(_0x314e('0x4'));var db=require(_0x314e('0x5'))['db'];var utils=require(_0x314e('0x6'));var logger=require('../../config/logger')(_0x314e('0x7'));var config=require(_0x314e('0x8'));var jayson=require(_0x314e('0x9'));var client=jayson[_0x314e('0xa')][_0x314e('0xb')]({'port':0x232c});config[_0x314e('0xc')]=_[_0x314e('0xd')](config[_0x314e('0xc')],{'host':_0x314e('0xe'),'port':0x18eb});var socket=require(_0x314e('0xf'))(new Redis(config[_0x314e('0xc')]));require('./mailAccount.socket')[_0x314e('0x10')](socket);function respondWithRpcPromise(_0x4b441e,_0x64bc6d,_0x49d8d8){return new BPromise(function(_0x488448,_0x15e44e){return client[_0x314e('0x11')](_0x4b441e,_0x49d8d8)['then'](function(_0x198fd8){logger[_0x314e('0x12')](_0x314e('0x13'),_0x64bc6d,_0x314e('0x14'));logger[_0x314e('0x15')](_0x314e('0x16'),_0x64bc6d,'request\x20sent',JSON[_0x314e('0x17')](_0x198fd8));if(_0x198fd8[_0x314e('0x18')]){if(_0x198fd8[_0x314e('0x18')][_0x314e('0x19')]===0x1f4){logger[_0x314e('0x18')]('MailAccount,\x20%s,\x20%s',_0x64bc6d,_0x198fd8[_0x314e('0x18')]['message']);return _0x15e44e(_0x198fd8['error'][_0x314e('0x1a')]);}logger['error'](_0x314e('0x13'),_0x64bc6d,_0x198fd8['error'][_0x314e('0x1a')]);return _0x488448(_0x198fd8[_0x314e('0x18')][_0x314e('0x1a')]);}else{logger[_0x314e('0x12')]('MailAccount,\x20%s,\x20%s',_0x64bc6d,_0x314e('0x14'));_0x488448(_0x198fd8[_0x314e('0x1b')][_0x314e('0x1a')]);}})['catch'](function(_0x15a672){logger[_0x314e('0x18')](_0x314e('0x13'),_0x64bc6d,_0x15a672);_0x15e44e(_0x15a672);});});}exports[_0x314e('0x1c')]=function(_0x74100){var _0x534a36=this;return new Promise(function(_0xc1ec4c,_0x5d066c){return db[_0x314e('0x1d')][_0x314e('0x1e')]({'raw':_0x74100[_0x314e('0x1f')]?_0x74100[_0x314e('0x1f')][_0x314e('0x20')]===undefined?!![]:![]:!![],'where':_0x74100['options']?_0x74100[_0x314e('0x1f')][_0x314e('0x21')]||null:null,'attributes':_0x74100['options']?_0x74100['options'][_0x314e('0x22')]||null:null,'limit':_0x74100[_0x314e('0x1f')]?_0x74100['options'][_0x314e('0x23')]||null:null,'include':_0x74100[_0x314e('0x1f')]?_0x74100['options']['include']?_['map'](_0x74100[_0x314e('0x1f')][_0x314e('0x24')],function(_0x236d53){return{'model':db[_0x236d53['model']],'as':_0x236d53['as'],'attributes':_0x236d53[_0x314e('0x22')],'include':_0x236d53['include']?_[_0x314e('0x25')](_0x236d53[_0x314e('0x24')],function(_0x3d3f08){return{'model':db[_0x3d3f08[_0x314e('0x26')]],'as':_0x3d3f08['as'],'attributes':_0x3d3f08[_0x314e('0x22')],'include':_0x3d3f08[_0x314e('0x24')]?_[_0x314e('0x25')](_0x3d3f08[_0x314e('0x24')],function(_0x559c32){return{'model':db[_0x559c32[_0x314e('0x26')]],'as':_0x559c32['as'],'attributes':_0x559c32[_0x314e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x314e('0x27')](function(_0x5cc599){logger[_0x314e('0x12')](_0x314e('0x1c'),_0x74100);logger[_0x314e('0x15')](_0x314e('0x1c'),_0x74100,JSON[_0x314e('0x17')](_0x5cc599));_0xc1ec4c(_0x5cc599);})[_0x314e('0x28')](function(_0x21efd0){logger[_0x314e('0x18')](_0x314e('0x1c'),_0x21efd0['message'],_0x74100);_0x5d066c(_0x534a36[_0x314e('0x18')](0x1f4,_0x21efd0[_0x314e('0x1a')]));});});};exports[_0x314e('0x29')]=function(_0x3bf4d4){var _0x41aab8=this;return new Promise(function(_0x1a9668,_0x273356){return db[_0x314e('0x1d')][_0x314e('0x2a')]({'raw':_0x3bf4d4[_0x314e('0x1f')]?_0x3bf4d4[_0x314e('0x1f')][_0x314e('0x20')]===undefined?!![]:![]:!![],'where':_0x3bf4d4[_0x314e('0x1f')]?_0x3bf4d4[_0x314e('0x1f')][_0x314e('0x21')]||null:null,'attributes':_0x3bf4d4['options']?_0x3bf4d4[_0x314e('0x1f')][_0x314e('0x22')]||null:null,'include':_0x3bf4d4[_0x314e('0x1f')]?_0x3bf4d4[_0x314e('0x1f')][_0x314e('0x24')]?_['map'](_0x3bf4d4['options'][_0x314e('0x24')],function(_0x2fd97d){return{'model':db[_0x2fd97d['model']],'as':_0x2fd97d['as'],'attributes':_0x2fd97d[_0x314e('0x22')],'include':_0x2fd97d[_0x314e('0x24')]?_[_0x314e('0x25')](_0x2fd97d[_0x314e('0x24')],function(_0x18be42){return{'model':db[_0x18be42[_0x314e('0x26')]],'as':_0x18be42['as'],'attributes':_0x18be42[_0x314e('0x22')],'include':_0x18be42[_0x314e('0x24')]?_['map'](_0x18be42[_0x314e('0x24')],function(_0x28e584){return{'model':db[_0x28e584['model']],'as':_0x28e584['as'],'attributes':_0x28e584[_0x314e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32c9a2){logger['info']('ShowMailAccount',_0x3bf4d4);logger['debug']('ShowMailAccount',_0x3bf4d4,JSON[_0x314e('0x17')](_0x32c9a2));_0x1a9668(_0x32c9a2);})[_0x314e('0x28')](function(_0x20edc7){logger[_0x314e('0x18')]('ShowMailAccount',_0x20edc7[_0x314e('0x1a')],_0x3bf4d4);_0x273356(_0x41aab8[_0x314e('0x18')](0x1f4,_0x20edc7[_0x314e('0x1a')]));});});};exports[_0x314e('0x2b')]=function(_0x200e7d){var _0x2ba9db=this;return new Promise(function(_0xcf6982,_0x3c4949){var _0x3b66f5={'body':_0x200e7d[_0x314e('0x2c')],'channel':_0x314e('0x2d')};var _0x5284eb=_['difference'](_[_0x314e('0x2e')](db[_0x314e('0x2f')][_0x314e('0x30')]),[_0x314e('0x31'),_0x314e('0x32'),_0x314e('0x33'),'ListId']);var _0x4471b0=![];if(_0x200e7d['body']['id']){delete _0x200e7d[_0x314e('0x2c')]['id'];}if(_[_0x314e('0x34')](_0x200e7d[_0x314e('0x2c')]['from'])){return _0x3c4949(_0x2ba9db['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x314e('0x34')](_0x200e7d[_0x314e('0x2c')]['body'])||_0x200e7d['body']['body']===''){return _0x3c4949(_0x2ba9db[_0x314e('0x18')](0x1f4,_0x314e('0x35')));}if(_[_0x314e('0x34')](_0x200e7d[_0x314e('0x2c')][_0x314e('0x36')])){return _0x3c4949(_0x2ba9db['error'](0x1f4,_0x314e('0x37')+_0x5284eb));}if(!_[_0x314e('0x38')](_0x5284eb,_0x200e7d['body'][_0x314e('0x36')])){return _0x3c4949(_0x2ba9db[_0x314e('0x18')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5284eb));}var _0x326b68={};_0x326b68[_0x200e7d[_0x314e('0x2c')][_0x314e('0x36')]]=_0x200e7d['body'][_0x314e('0x39')];return db['MailAccount'][_0x314e('0x2a')]({'where':{'id':_0x200e7d[_0x314e('0x3a')]['id']},'include':[{'model':db[_0x314e('0x3b')],'as':_0x314e('0x3c'),'include':[{'model':db[_0x314e('0x2f')],'as':_0x314e('0x3d'),'where':_0x326b68,'limit':0x1,'order':[[_0x314e('0x32'),'DESC']]}]},{'model':db[_0x314e('0x3e')],'as':_0x314e('0x3f')},{'model':db[_0x314e('0x40')],'as':_0x314e('0x41')}]})[_0x314e('0x27')](function(_0x3f2701){if(_0x3f2701&&_0x3f2701[_0x314e('0x3c')]){var _0xfbee0d=_0x3f2701[_0x314e('0x42')]({'plain':!![]});_0x3b66f5[_0x314e('0x3a')]=_[_0x314e('0x43')](_0xfbee0d,[_0x314e('0x3f'),_0x314e('0x3c')]);_0x3b66f5['applications']=_0xfbee0d[_0x314e('0x3f')];_0x3b66f5[_0x314e('0x44')]=_0xfbee0d['List'];_0x3b66f5[_0x314e('0x45')]=_[_0x314e('0x46')](_0x3b66f5[_0x314e('0x45')],[_0x314e('0x47')],[_0x314e('0x48')]);if(_0x3b66f5[_0x314e('0x3a')]&&_0x3b66f5[_0x314e('0x3a')][_0x314e('0x49')]){_0x3b66f5[_0x314e('0x45')]['push']({'id':0x0,'priority':_0x3b66f5[_0x314e('0x45')]['length']+0x1,'app':'close','appdata':'autoclose','interval':_0x314e('0x4a')});}if(_0x3b66f5['account'][_0x314e('0x3f')]){delete _0x3b66f5[_0x314e('0x3a')][_0x314e('0x3f')];}if(_0x3b66f5[_0x314e('0x3a')][_0x314e('0x3c')]){delete _0x3b66f5['account'][_0x314e('0x3c')];}if(_0xfbee0d['List']['Contacts'][_0x314e('0x4b')]){return _0xfbee0d[_0x314e('0x3c')]['Contacts'][0x0];}var _0x503afb=_[_0x314e('0xd')](_0x200e7d[_0x314e('0x2c')],{'firstName':_0x200e7d[_0x314e('0x2c')]['from'],'ListId':_0xfbee0d['ListId']});_0x503afb[_0x200e7d[_0x314e('0x2c')][_0x314e('0x36')]]=_0x200e7d[_0x314e('0x2c')][_0x314e('0x39')];return db[_0x314e('0x2f')]['create'](_0x503afb);}else{throw new Error(_0x314e('0x4c'));}})[_0x314e('0x27')](function(_0x3cd233){_0x3b66f5[_0x314e('0x4d')]=_0x3cd233;if(_0x3cd233){if(!_0x200e7d['body'][_0x314e('0x1a')][_0x314e('0x4e')]){_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x4e')]=rs[_0x314e('0x4f')]()+'\x20'+_0x200e7d[_0x314e('0x2c')]['message'][_0x314e('0x39')];}var _0x49e065={'ContactId':_0x3cd233['id'],'MailAccountId':_0x200e7d[_0x314e('0x3a')]['id'],'inReplyTo':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x4e')],'to':_0x200e7d[_0x314e('0x2c')]['message'][_0x314e('0x39')],'cc':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')]['cc'],'subject':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x50')],'attach':_0x200e7d['body']['message'][_0x314e('0x51')],'lastMsgAt':moment()[_0x314e('0x52')](_0x314e('0x53')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x314e('0x2a')]({'where':{'closed':![],'MailAccountId':_0x200e7d[_0x314e('0x3a')]['id']},'include':[{'model':db[_0x314e('0x54')],'as':_0x314e('0x55'),'attributes':[_0x314e('0x4e')],'where':{'messageId':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')]['inReplyTo']}}]})[_0x314e('0x27')](function(_0x515468){if(_0x515468){return[_0x515468,![]];}return db[_0x314e('0x56')][_0x314e('0x57')](_0x49e065)[_0x314e('0x27')](function(_0x48bc2c){return[_0x48bc2c,!![]];});});}else{throw new Error(_0x314e('0x58'));}})['spread'](function(_0x4503c1,_0x255da8){if(_0x4503c1){_0x4471b0=_0x255da8;if(!_0x255da8){return _0x4503c1[_0x314e('0x59')]({'inReplyTo':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x4e')],'to':_0x200e7d['body']['message'][_0x314e('0x39')],'cc':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')]['cc'],'subject':_0x200e7d['body']['message'][_0x314e('0x50')],'attach':_0x4503c1[_0x314e('0x51')]?_0x4503c1['attach']:_0x200e7d[_0x314e('0x2c')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x314e('0x52')](_0x314e('0x53')),'lastMsgAt':moment()[_0x314e('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x4503c1;}}})['then'](function(_0x45e3b9){_0x3b66f5[_0x314e('0x5a')]=_0x45e3b9[_0x314e('0x42')]({'plain':!![]});_0x3b66f5[_0x314e('0x5a')][_0x314e('0x5b')]=_0x4471b0;return db['MailMessage'][_0x314e('0x57')]({'body':_0x200e7d[_0x314e('0x2c')][_0x314e('0x2c')],'MailAccountId':_0x200e7d[_0x314e('0x3a')]['id'],'MailInteractionId':_0x45e3b9['id'],'direction':'in','ContactId':_0x3b66f5['contact']['id'],'messageId':_0x200e7d[_0x314e('0x2c')]['message'][_0x314e('0x4e')],'from':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x39')],'to':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')]['to'],'cc':_0x200e7d['body'][_0x314e('0x1a')]['cc'],'subject':_0x200e7d['body'][_0x314e('0x1a')][_0x314e('0x50')],'attach':_0x200e7d['body']['message'][_0x314e('0x51')],'Attachments':_0x200e7d[_0x314e('0x2c')]['message'][_0x314e('0x5c')],'originTo':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x5d')],'originCc':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')]['originCc'],'bcc':_0x200e7d[_0x314e('0x2c')]['message'][_0x314e('0x5e')],'ChatWebsiteId':_0x200e7d[_0x314e('0x2c')][_0x314e('0x1a')][_0x314e('0x5f')]||null,'originChannel':_0x200e7d[_0x314e('0x2c')]['message']['originChannel']||_0x314e('0x60'),'ChatOfflineMessageId':_0x200e7d[_0x314e('0x2c')]['message'][_0x314e('0x61')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})['then'](function(_0x2207c3){_0x3b66f5[_0x314e('0x1a')]=_0x2207c3;if(_0x3b66f5[_0x314e('0x5a')]['UserId']){return db[_0x314e('0x62')][_0x314e('0x2a')]({'attributes':['id',_0x314e('0x63')],'where':{'id':_0x3b66f5['interaction'][_0x314e('0x64')]}})[_0x314e('0x27')](function(_0x4f648b){if(_0x4f648b){_0x3b66f5['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x314e('0x65'),'appdata':_0x4f648b[_0x314e('0x63')]+','+(_0x3b66f5[_0x314e('0x3a')][_0x314e('0x66')]||0xa),'interval':_0x314e('0x4a')});}return respondWithRpcPromise('Start',_0x314e('0x67'),_0x3b66f5);});}return respondWithRpcPromise(_0x314e('0x68'),_0x314e('0x67'),_0x3b66f5);})['then'](function(_0x4e7ed6){_0xcf6982(_0x4e7ed6);})[_0x314e('0x28')](function(_0x4da65d){_0x3c4949(_0x2ba9db[_0x314e('0x18')](0x1f4,_0x4da65d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 8f2c8da..5cb0841 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 _0x6f1e=['./mailAccount.events','save','emit','removeListener','register'];(function(_0x5a3e24,_0x351fc5){var _0x66702d=function(_0x653d4a){while(--_0x653d4a){_0x5a3e24['push'](_0x5a3e24['shift']());}};_0x66702d(++_0x351fc5);}(_0x6f1e,0x78));var _0xe6f1=function(_0x20a7da,_0x200463){_0x20a7da=_0x20a7da-0x0;var _0xd1597b=_0x6f1e[_0x20a7da];return _0xd1597b;};'use strict';var MailAccountEvents=require(_0xe6f1('0x0'));var events=[_0xe6f1('0x1'),'remove','update'];function createListener(_0x5c9277,_0x59c150){return function(_0x535983){_0x59c150[_0xe6f1('0x2')](_0x5c9277,_0x535983);};}function removeListener(_0x227638,_0x433d04){return function(){MailAccountEvents[_0xe6f1('0x3')](_0x227638,_0x433d04);};}exports[_0xe6f1('0x4')]=function(_0x2d32cb){for(var _0x1e654f=0x0,_0xffdcce=events['length'];_0x1e654f<_0xffdcce;_0x1e654f++){var _0x34e739=events[_0x1e654f];var _0x4fc6c4=createListener('mailAccount:'+_0x34e739,_0x2d32cb);MailAccountEvents['on'](_0x34e739,_0x4fc6c4);}}; \ No newline at end of file +var _0x5ea2=['emit','length','mailAccount:','./mailAccount.events','update'];(function(_0x5d0bec,_0x608fd9){var _0x295116=function(_0x2abfb2){while(--_0x2abfb2){_0x5d0bec['push'](_0x5d0bec['shift']());}};_0x295116(++_0x608fd9);}(_0x5ea2,0x99));var _0x25ea=function(_0x141300,_0x5b7c34){_0x141300=_0x141300-0x0;var _0x57c606=_0x5ea2[_0x141300];return _0x57c606;};'use strict';var MailAccountEvents=require(_0x25ea('0x0'));var events=['save','remove',_0x25ea('0x1')];function createListener(_0x1e98ea,_0x2d4927){return function(_0x3cafcb){_0x2d4927[_0x25ea('0x2')](_0x1e98ea,_0x3cafcb);};}function removeListener(_0x54a252,_0x37e956){return function(){MailAccountEvents['removeListener'](_0x54a252,_0x37e956);};}exports['register']=function(_0x3e32e9){for(var _0x310a27=0x0,_0x3ca48f=events[_0x25ea('0x3')];_0x310a27<_0x3ca48f;_0x310a27++){var _0x274f48=events[_0x310a27];var _0x254d54=createListener(_0x25ea('0x4')+_0x274f48,_0x3e32e9);MailAccountEvents['on'](_0x274f48,_0x254d54);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e799668..306dd89 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 _0x5f45=['path','express','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports','multer'];(function(_0x34c215,_0x4c611f){var _0xf6c318=function(_0x4594d3){while(--_0x4594d3){_0x34c215['push'](_0x34c215['shift']());}};_0xf6c318(++_0x4c611f);}(_0x5f45,0x192));var _0x55f4=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x5f45[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x55f4('0x0'));var util=require('util');var path=require(_0x55f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x55f4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x55f4('0x3'));var config=require(_0x55f4('0x4'));var controller=require(_0x55f4('0x5'));router[_0x55f4('0x6')](_0x55f4('0x7'),auth[_0x55f4('0x8')](),controller[_0x55f4('0x9')]);router[_0x55f4('0xa')](_0x55f4('0x7'),auth[_0x55f4('0x8')](),controller['update']);router['delete'](_0x55f4('0x7'),auth[_0x55f4('0x8')](),controller[_0x55f4('0xb')]);module[_0x55f4('0xc')]=router; \ No newline at end of file +var _0xd78c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','fs-extra'];(function(_0x4a7f48,_0x142979){var _0x1e1b80=function(_0xcfcfde){while(--_0xcfcfde){_0x4a7f48['push'](_0x4a7f48['shift']());}};_0x1e1b80(++_0x142979);}(_0xd78c,0xbf));var _0xcd78=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd78c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xcd78('0x0'));var path=require(_0xcd78('0x1'));var timeout=require(_0xcd78('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcd78('0x3'));var auth=require(_0xcd78('0x4'));var interaction=require(_0xcd78('0x5'));var config=require(_0xcd78('0x6'));var controller=require(_0xcd78('0x7'));router[_0xcd78('0x8')](_0xcd78('0x9'),auth[_0xcd78('0xa')](),controller['show']);router['put'](_0xcd78('0x9'),auth[_0xcd78('0xa')](),controller[_0xcd78('0xb')]);router[_0xcd78('0xc')]('/:id',auth[_0xcd78('0xa')](),controller[_0xcd78('0xd')]);module[_0xcd78('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 0592744..795880e 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 _0x2b09=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x2b7675,_0x5969c9){var _0x4c4f97=function(_0x233188){while(--_0x233188){_0x2b7675['push'](_0x2b7675['shift']());}};_0x4c4f97(++_0x5969c9);}(_0x2b09,0x7b));var _0x92b0=function(_0x1259c6,_0x39bd9f){_0x1259c6=_0x1259c6-0x0;var _0x2ddd47=_0x2b09[_0x1259c6];return _0x2ddd47;};'use strict';var Sequelize=require(_0x92b0('0x0'));module[_0x92b0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x92b0('0x2')],'allowNull':![],'defaultValue':_0x92b0('0x3')},'appdata':{'type':Sequelize[_0x92b0('0x4')]()},'description':{'type':Sequelize[_0x92b0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x92b0('0x5')}}; \ No newline at end of file +var _0x59b5=['sequelize','INTEGER','noop','TEXT','*,*,*,*'];(function(_0x10235f,_0x16ac3){var _0x2fb978=function(_0x86b562){while(--_0x86b562){_0x10235f['push'](_0x10235f['shift']());}};_0x2fb978(++_0x16ac3);}(_0x59b5,0xaa));var _0x559b=function(_0xb701ea,_0x3cfaac){_0xb701ea=_0xb701ea-0x0;var _0x23d0a3=_0x59b5[_0xb701ea];return _0x23d0a3;};'use strict';var Sequelize=require(_0x559b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x559b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x559b('0x2')},'appdata':{'type':Sequelize[_0x559b('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x559b('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ac36c96..2475085 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xaa88[_0x12c280];return _0x3638d3;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x351b23,_0x121daf){var _0x277545=function(_0x385e2c){while(--_0x385e2c){_0x351b23['push'](_0x351b23['shift']());}};_0x277545(++_0x121daf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ecb1515..191a454 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 _0x55ce=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x5137dc,_0x576757){var _0x2d2d96=function(_0x5316b2){while(--_0x5316b2){_0x5137dc['push'](_0x5137dc['shift']());}};_0x2d2d96(++_0x576757);}(_0x55ce,0x76));var _0xe55c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x55ce[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe55c('0x0'));var util=require(_0xe55c('0x1'));var logger=require(_0xe55c('0x2'))(_0xe55c('0x3'));var moment=require('moment');var BPromise=require(_0xe55c('0x4'));var rp=require(_0xe55c('0x5'));var fs=require('fs');var path=require(_0xe55c('0x6'));var rimraf=require(_0xe55c('0x7'));var config=require(_0xe55c('0x8'));var attributes=require('./mailApplication.attributes');module[_0xe55c('0x9')]=function(_0x31642f,_0x45df3a){return _0x31642f[_0xe55c('0xa')](_0xe55c('0xb'),attributes,{'tableName':_0xe55c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe55c('0xd'),'collate':_0xe55c('0xe')});}; \ No newline at end of file +var _0x729a=['rimraf','../../config/environment','exports','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path'];(function(_0x33d87c,_0x31811c){var _0x592d94=function(_0x1f74b2){while(--_0x1f74b2){_0x33d87c['push'](_0x33d87c['shift']());}};_0x592d94(++_0x31811c);}(_0x729a,0x19e));var _0xa729=function(_0x3aaa9f,_0x3ad344){_0x3aaa9f=_0x3aaa9f-0x0;var _0x35b2bc=_0x729a[_0x3aaa9f];return _0x35b2bc;};'use strict';var _=require(_0xa729('0x0'));var util=require(_0xa729('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa729('0x2'));var BPromise=require(_0xa729('0x3'));var rp=require(_0xa729('0x4'));var fs=require('fs');var path=require(_0xa729('0x5'));var rimraf=require(_0xa729('0x6'));var config=require(_0xa729('0x7'));var attributes=require('./mailApplication.attributes');module[_0xa729('0x8')]=function(_0x202263,_0x2fb7b3){return _0x202263['define'](_0xa729('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa729('0xa'),'collate':_0xa729('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ffd9c5b..5b70165 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 _0x9e8e=['lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http','request','then','debug','error','code','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','stringify'];(function(_0xbbd8fa,_0xa80e63){var _0x2423f6=function(_0xd9cf7d){while(--_0xd9cf7d){_0xbbd8fa['push'](_0xbbd8fa['shift']());}};_0x2423f6(++_0xa80e63);}(_0x9e8e,0x179));var _0xe9e8=function(_0x2c4a88,_0x48aaee){_0x2c4a88=_0x2c4a88-0x0;var _0x3aa5c2=_0x9e8e[_0x2c4a88];return _0x3aa5c2;};'use strict';var _=require(_0xe9e8('0x0'));var util=require(_0xe9e8('0x1'));var moment=require(_0xe9e8('0x2'));var BPromise=require(_0xe9e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9e8('0x5'));var config=require('../../config/environment');var jayson=require(_0xe9e8('0x6'));var client=jayson[_0xe9e8('0x7')][_0xe9e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509703,_0x3e4e11,_0x10b283){return new BPromise(function(_0x5d73da,_0x3496db){return client[_0xe9e8('0x9')](_0x509703,_0x10b283)[_0xe9e8('0xa')](function(_0x5a5617){logger['info']('MailApplication,\x20%s,\x20%s',_0x3e4e11,'request\x20sent');logger[_0xe9e8('0xb')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3e4e11,'request\x20sent',JSON['stringify'](_0x5a5617));if(_0x5a5617['error']){if(_0x5a5617[_0xe9e8('0xc')][_0xe9e8('0xd')]===0x1f4){logger[_0xe9e8('0xc')](_0xe9e8('0xe'),_0x3e4e11,_0x5a5617['error'][_0xe9e8('0xf')]);return _0x3496db(_0x5a5617[_0xe9e8('0xc')][_0xe9e8('0xf')]);}logger['error'](_0xe9e8('0xe'),_0x3e4e11,_0x5a5617['error'][_0xe9e8('0xf')]);return _0x5d73da(_0x5a5617[_0xe9e8('0xc')][_0xe9e8('0xf')]);}else{logger[_0xe9e8('0x10')](_0xe9e8('0xe'),_0x3e4e11,'request\x20sent');_0x5d73da(_0x5a5617[_0xe9e8('0x11')]['message']);}})[_0xe9e8('0x12')](function(_0x130488){logger['error'](_0xe9e8('0xe'),_0x3e4e11,_0x130488);_0x3496db(_0x130488);});});}exports[_0xe9e8('0x13')]=function(_0x42178b){var _0x5318b7=this;return new Promise(function(_0x597fbe,_0x544b92){return db[_0xe9e8('0x14')][_0xe9e8('0x15')](_0x42178b[_0xe9e8('0x16')],{'raw':_0x42178b[_0xe9e8('0x17')]?_0x42178b['options'][_0xe9e8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42178b[_0xe9e8('0x17')]?_0x42178b[_0xe9e8('0x17')][_0xe9e8('0x19')]||null:null,'attributes':_0x42178b[_0xe9e8('0x17')]?_0x42178b[_0xe9e8('0x17')][_0xe9e8('0x1a')]||null:null,'limit':_0x42178b[_0xe9e8('0x17')]?_0x42178b[_0xe9e8('0x17')][_0xe9e8('0x1b')]||null:null})[_0xe9e8('0xa')](function(_0x1a3da3){logger['info'](_0xe9e8('0x13'),_0x42178b);logger[_0xe9e8('0xb')]('UpdateMailApplication',_0x42178b,JSON[_0xe9e8('0x1c')](_0x1a3da3));_0x597fbe(_0x1a3da3);})[_0xe9e8('0x12')](function(_0x24035e){logger[_0xe9e8('0xc')](_0xe9e8('0x13'),_0x24035e[_0xe9e8('0xf')],_0x42178b);_0x544b92(_0x5318b7['error'](0x1f4,_0x24035e[_0xe9e8('0xf')]));});});}; \ No newline at end of file +var _0xd857=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','body','options','raw','where','limit','UpdateMailApplication','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0xd857,0xe7));var _0x7d85=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd857[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x7d85('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7d85('0x1'));var rs=require(_0x7d85('0x2'));var fs=require('fs');var Redis=require(_0x7d85('0x3'));var db=require(_0x7d85('0x4'))['db'];var utils=require(_0x7d85('0x5'));var logger=require(_0x7d85('0x6'))(_0x7d85('0x7'));var config=require('../../config/environment');var jayson=require(_0x7d85('0x8'));var client=jayson[_0x7d85('0x9')][_0x7d85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20fcdc,_0x5409ca,_0x371d4b){return new BPromise(function(_0x5b483f,_0x377398){return client[_0x7d85('0xb')](_0x20fcdc,_0x371d4b)['then'](function(_0x4d7840){logger['info'](_0x7d85('0xc'),_0x5409ca,_0x7d85('0xd'));logger[_0x7d85('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x5409ca,_0x7d85('0xd'),JSON[_0x7d85('0xf')](_0x4d7840));if(_0x4d7840['error']){if(_0x4d7840[_0x7d85('0x10')]['code']===0x1f4){logger[_0x7d85('0x10')](_0x7d85('0xc'),_0x5409ca,_0x4d7840['error'][_0x7d85('0x11')]);return _0x377398(_0x4d7840[_0x7d85('0x10')][_0x7d85('0x11')]);}logger[_0x7d85('0x10')](_0x7d85('0xc'),_0x5409ca,_0x4d7840['error'][_0x7d85('0x11')]);return _0x5b483f(_0x4d7840[_0x7d85('0x10')]['message']);}else{logger[_0x7d85('0x12')]('MailApplication,\x20%s,\x20%s',_0x5409ca,_0x7d85('0xd'));_0x5b483f(_0x4d7840[_0x7d85('0x13')][_0x7d85('0x11')]);}})[_0x7d85('0x14')](function(_0x2c4e2f){logger['error']('MailApplication,\x20%s,\x20%s',_0x5409ca,_0x2c4e2f);_0x377398(_0x2c4e2f);});});}exports['UpdateMailApplication']=function(_0x4a34ed){var _0x12522d=this;return new Promise(function(_0x2405fc,_0x44a557){return db['MailApplication']['update'](_0x4a34ed[_0x7d85('0x15')],{'raw':_0x4a34ed[_0x7d85('0x16')]?_0x4a34ed['options'][_0x7d85('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a34ed[_0x7d85('0x16')]?_0x4a34ed['options'][_0x7d85('0x18')]||null:null,'attributes':_0x4a34ed[_0x7d85('0x16')]?_0x4a34ed[_0x7d85('0x16')]['attributes']||null:null,'limit':_0x4a34ed[_0x7d85('0x16')]?_0x4a34ed['options'][_0x7d85('0x19')]||null:null})['then'](function(_0x4cc78c){logger[_0x7d85('0x12')](_0x7d85('0x1a'),_0x4a34ed);logger[_0x7d85('0xe')](_0x7d85('0x1a'),_0x4a34ed,JSON[_0x7d85('0xf')](_0x4cc78c));_0x2405fc(_0x4cc78c);})[_0x7d85('0x14')](function(_0x3517a2){logger[_0x7d85('0x10')]('UpdateMailApplication',_0x3517a2[_0x7d85('0x11')],_0x4a34ed);_0x44a557(_0x12522d[_0x7d85('0x10')](0x1f4,_0x3517a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index aa7bdd8..33f29e0 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 _0xf452=['mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','addTags','put','tracked','mailinteraction:update','update','delete'];(function(_0x15441b,_0x245843){var _0x51aa3f=function(_0x33dd98){while(--_0x33dd98){_0x15441b['push'](_0x15441b['shift']());}};_0x51aa3f(++_0x245843);}(_0xf452,0xe3));var _0x2f45=function(_0x10d06f,_0x2e2eaf){_0x10d06f=_0x10d06f-0x0;var _0x4bc4ba=_0xf452[_0x10d06f];return _0x4bc4ba;};'use strict';var express=require(_0x2f45('0x0'));var router=express['Router']();var auth=require(_0x2f45('0x1'));var interaction=require(_0x2f45('0x2'));var controller=require(_0x2f45('0x3'));router[_0x2f45('0x4')]('/',auth[_0x2f45('0x5')](),controller['index']);router[_0x2f45('0x4')](_0x2f45('0x6'),auth[_0x2f45('0x5')](),controller[_0x2f45('0x7')]);router[_0x2f45('0x4')](_0x2f45('0x8'),auth['isAuthenticated'](),controller[_0x2f45('0x9')]);router[_0x2f45('0x4')](_0x2f45('0xa'),auth['isAuthenticated'](),controller[_0x2f45('0xb')]);router[_0x2f45('0x4')](_0x2f45('0xc'),auth[_0x2f45('0x5')](),controller[_0x2f45('0xd')]);router[_0x2f45('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f45('0xf')]);router[_0x2f45('0xe')](_0x2f45('0xa'),auth[_0x2f45('0x5')](),controller[_0x2f45('0x10')]);router['post'](_0x2f45('0x11'),auth[_0x2f45('0x5')](),interaction['tracked'](_0x2f45('0x12'),'mailinteraction:addtags'),controller[_0x2f45('0x13')]);router[_0x2f45('0x14')](_0x2f45('0x8'),auth[_0x2f45('0x5')](),interaction[_0x2f45('0x15')](_0x2f45('0x12'),_0x2f45('0x16')),controller[_0x2f45('0x17')]);router[_0x2f45('0x18')](_0x2f45('0x8'),auth[_0x2f45('0x5')](),interaction[_0x2f45('0x15')](_0x2f45('0x12'),_0x2f45('0x19')),controller[_0x2f45('0x1a')]);router[_0x2f45('0x18')](_0x2f45('0x11'),auth[_0x2f45('0x5')](),controller[_0x2f45('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x318b=['get','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','create','post','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','update','mailinteraction:destroy','destroy','delete','/:id/tags','exports','Router','../../components/auth/service','index'];(function(_0x5a97b8,_0x5a7945){var _0x54b165=function(_0x3cc5ca){while(--_0x3cc5ca){_0x5a97b8['push'](_0x5a97b8['shift']());}};_0x54b165(++_0x5a7945);}(_0x318b,0x18d));var _0xb318=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x318b[_0x3d73ba];return _0x47e406;};'use strict';var express=require('express');var router=express[_0xb318('0x0')]();var auth=require(_0xb318('0x1'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb318('0x2')]);router[_0xb318('0x3')]('/describe',auth['isAuthenticated'](),controller[_0xb318('0x4')]);router[_0xb318('0x3')](_0xb318('0x5'),auth['isAuthenticated'](),controller[_0xb318('0x6')]);router['get'](_0xb318('0x7'),auth[_0xb318('0x8')](),controller[_0xb318('0x9')]);router['get'](_0xb318('0xa'),auth[_0xb318('0x8')](),controller['download']);router['post']('/',auth[_0xb318('0x8')](),controller[_0xb318('0xb')]);router[_0xb318('0xc')](_0xb318('0x7'),auth[_0xb318('0x8')](),controller[_0xb318('0xd')]);router[_0xb318('0xc')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xb318('0xe')](_0xb318('0xf'),_0xb318('0x10')),controller[_0xb318('0x11')]);router[_0xb318('0x12')](_0xb318('0x5'),auth['isAuthenticated'](),interaction[_0xb318('0xe')](_0xb318('0xf'),'mailinteraction:update'),controller[_0xb318('0x13')]);router['delete'](_0xb318('0x5'),auth['isAuthenticated'](),interaction['tracked'](_0xb318('0xf'),_0xb318('0x14')),controller[_0xb318('0x15')]);router[_0xb318('0x16')](_0xb318('0x17'),auth['isAuthenticated'](),controller['removeTags']);module[_0xb318('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 68fdfb5..939e844 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 _0x3327=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize'];(function(_0x26f2af,_0x2d0a8f){var _0x14374b=function(_0x476930){while(--_0x476930){_0x26f2af['push'](_0x26f2af['shift']());}};_0x14374b(++_0x2d0a8f);}(_0x3327,0x6b));var _0x7332=function(_0x23df30,_0x5369eb){_0x23df30=_0x23df30-0x0;var _0x4e042c=_0x3327[_0x23df30];return _0x4e042c;};'use strict';var Sequelize=require(_0x7332('0x0'));var iconv=require(_0x7332('0x1'));module[_0x7332('0x2')]={'closed':{'type':Sequelize[_0x7332('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7332('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7332('0x5')]},'note':{'type':Sequelize[_0x7332('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x7332('0x5')]},'cc':{'type':Sequelize[_0x7332('0x6')]('long')},'subject':{'type':Sequelize[_0x7332('0x6')]()},'attach':{'type':Sequelize[_0x7332('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7332('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x7332('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7332('0x7')]('in',_0x7332('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7332('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7332('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf9cc=['BOOLEAN','STRING','long','TEXT','DATE','ENUM','out','iconv','exports'];(function(_0x39be14,_0x4af086){var _0x20f3ed=function(_0x43c901){while(--_0x43c901){_0x39be14['push'](_0x39be14['shift']());}};_0x20f3ed(++_0x4af086);}(_0xf9cc,0xa0));var _0xcf9c=function(_0x329d8d,_0x48b6c2){_0x329d8d=_0x329d8d-0x0;var _0x3bf18f=_0xf9cc[_0x329d8d];return _0x3bf18f;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xcf9c('0x0'));module[_0xcf9c('0x1')]={'closed':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcf9c('0x3')]},'secondDisposition':{'type':Sequelize[_0xcf9c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcf9c('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcf9c('0x3')](0x1fe)},'to':{'type':Sequelize[_0xcf9c('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xcf9c('0x4'))},'subject':{'type':Sequelize[_0xcf9c('0x5')]()},'attach':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xcf9c('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xcf9c('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xcf9c('0x7')]('in',_0xcf9c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcf9c('0x7')]('in',_0xcf9c('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcf9c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f09cf83..42bbbac 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 _0x16ce=['root','files','tmp','server','attachments','transcript-%d-%s.zip','Messages','bcc','subject','get','mkdirSync','each','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','build','writeFileSync','message%d.eml','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','destroy','then','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','MailInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','Tag','union','User','buildExpression','start','some','isEmpty','MailAccountId','where','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','rows','includeAll','merge','options','body','update','params','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','MailInteractionId','filter','$gte','include','inlineCss','setTags','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join'];(function(_0xf46ea,_0xd97598){var _0x363349=function(_0x405ad8){while(--_0x405ad8){_0xf46ea['push'](_0xf46ea['shift']());}};_0x363349(++_0xd97598);}(_0x16ce,0xfb));var _0xe16c=function(_0x3edd83,_0x56ddda){_0x3edd83=_0x3edd83-0x0;var _0x3c9226=_0x16ce[_0x3edd83];return _0x3c9226;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe16c('0x0'));var zipdir=require(_0xe16c('0x1'));var moment=require(_0xe16c('0x2'));var BPromise=require(_0xe16c('0x3'));var util=require(_0xe16c('0x4'));var path=require(_0xe16c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require('juice');var Redis=require(_0xe16c('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0xe16c('0x7'));var logger=require(_0xe16c('0x8'))(_0xe16c('0x9'));var config=require(_0xe16c('0xa'));var db=require(_0xe16c('0xb'))['db'];var htmlEntities=require(_0xe16c('0xc'));config[_0xe16c('0xd')]=_[_0xe16c('0xe')](config['redis'],{'host':_0xe16c('0xf'),'port':0x18eb});var socket=require(_0xe16c('0x10'))(new Redis(config[_0xe16c('0xd')]));require(_0xe16c('0x11'))[_0xe16c('0x12')](socket);function respondWithStatusCode(_0x280e21,_0x36d6b9){_0x36d6b9=_0x36d6b9||0xcc;return function(_0x3d601a){if(_0x3d601a){return _0x280e21[_0xe16c('0x13')](_0x36d6b9);}return _0x280e21[_0xe16c('0x14')](_0x36d6b9)[_0xe16c('0x15')]();};}function respondWithResult(_0x4841c1,_0x160a2d){_0x160a2d=_0x160a2d||0xc8;return function(_0x3cbc7e){if(_0x3cbc7e){return _0x4841c1[_0xe16c('0x14')](_0x160a2d)[_0xe16c('0x16')](_0x3cbc7e);}};}function respondWithFilteredResult(_0x54c1b3,_0x54c384){return function(_0xbc2d25){if(_0xbc2d25){var _0x1db688=typeof _0x54c384[_0xe16c('0x17')]===_0xe16c('0x18')&&typeof _0x54c384['limit']===_0xe16c('0x18');var _0x4955f8=_0xbc2d25[_0xe16c('0x19')];var _0x7a62b9=_0x1db688?0x0:_0x54c384[_0xe16c('0x17')];var _0x5b7439=_0x1db688?_0xbc2d25[_0xe16c('0x19')]:_0x54c384[_0xe16c('0x17')]+_0x54c384[_0xe16c('0x1a')];var _0x3bb637;if(_0x5b7439>=_0x4955f8){_0x5b7439=_0x4955f8;_0x3bb637=0xc8;}else{_0x3bb637=0xce;}_0x54c1b3[_0xe16c('0x14')](_0x3bb637);return _0x54c1b3['set'](_0xe16c('0x1b'),_0x7a62b9+'-'+_0x5b7439+'/'+_0x4955f8)[_0xe16c('0x16')](_0xbc2d25);}return null;};}function saveUpdates(_0x22fe04){return function(_0x51068c){if(_0x51068c){return _0x51068c['update'](_0x22fe04)['then'](function(_0x30e657){return _0x30e657;});}return null;};}function removeEntity(_0x23fe64){return function(_0x611939){if(_0x611939){return _0x611939[_0xe16c('0x1c')]()[_0xe16c('0x1d')](function(){_0x23fe64[_0xe16c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bee3b){return function(_0xf660c0){if(!_0xf660c0){_0x2bee3b[_0xe16c('0x13')](0x194);}return _0xf660c0;};}function handleError(_0x9909dc,_0x5a88ed){_0x5a88ed=_0x5a88ed||0x1f4;return function(_0x27eb44){logger[_0xe16c('0x1e')](_0x27eb44[_0xe16c('0x1f')]);if(_0x27eb44[_0xe16c('0x20')]){delete _0x27eb44[_0xe16c('0x20')];}_0x9909dc[_0xe16c('0x14')](_0x5a88ed)[_0xe16c('0x21')](_0x27eb44);};}function getInteractionUsers(_0x8a9b36,_0x545d72){return new BPromise(function(_0x262f20,_0x9fd053){try{if(_0x545d72[_0x8a9b36['id']]){_0x8a9b36['Users']=_[_0xe16c('0x22')](_0x545d72[_0x8a9b36['id']],function(_0x5b6ca6){return{'id':_0x5b6ca6['id'],'fullname':_0x5b6ca6[_0xe16c('0x23')]};});}}catch(_0x4f8a2f){_0x9fd053(_0x4f8a2f);}_0x262f20(_0x8a9b36);});}function getInteractionTags(_0x27cc66,_0x2b9300){return new BPromise(function(_0x234c26,_0x156de3){try{if(_0x27cc66[_0xe16c('0x24')]){_0x27cc66[_0xe16c('0x25')]=[];_0x27cc66[_0xe16c('0x24')][_0xe16c('0x26')](',')[_0xe16c('0x27')](function(_0x1dbb43){_0x27cc66['Tags'][_0xe16c('0x28')](_0x2b9300[_0x1dbb43]);});}delete _0x27cc66[_0xe16c('0x24')];}catch(_0x397682){_0x156de3(_0x397682);}_0x234c26(_0x27cc66);});}function getLastMessageText(_0x53469e){return new BPromise(function(_0x209692,_0x48d6b3){return db['MailMessage'][_0xe16c('0x29')]({'where':{'$and':[{'MailInteractionId':_0x53469e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe16c('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xe16c('0x2b'),'raw':!![]})[_0xe16c('0x1d')](function(_0x18af56){if(_0x18af56&&_0x18af56[_0xe16c('0x2c')]){_0x53469e[_0xe16c('0x2d')]=_[_0xe16c('0x2e')](_0x18af56['plainBody']);}_0x209692(_0x53469e);})[_0xe16c('0x2f')](function(_0x19c8de){_0x48d6b3(_0x19c8de);});});}function updateMailInteraction(_0x5c326b,_0x320f91,_0x437a08,_0x2ba475){return new BPromise(function(_0x14729b,_0x1ff3f7){return getInteractionUsers(_0x5c326b,_0x437a08)[_0xe16c('0x1d')](function(_0x15d54a){return getInteractionTags(_0x15d54a,_0x320f91);})['then'](function(_0x290bd4){return getStateInteraction(_0x290bd4);})[_0xe16c('0x1d')](function(_0x1bf4e3){if(_0x2ba475){_0x14729b(getLastMessageText(_0x1bf4e3));}else{_0x14729b(_0x1bf4e3);}})[_0xe16c('0x2f')](function(_0x25cc75){_0x1ff3f7(_0x25cc75);});});}function getStateInteraction(_0x465c23){return new BPromise(function(_0x15564e){_0x465c23[_0xe16c('0x30')]=0x0;_0x465c23[_0xe16c('0x31')]=0x0;_0x465c23[_0xe16c('0x32')]=0x0;_0x465c23[_0xe16c('0x33')]=0x0;_0x465c23[_0xe16c('0x34')]=0x0;if(!_0x465c23[_0xe16c('0x35')]&&!_0x465c23[_0xe16c('0x36')]){_0x465c23[_0xe16c('0x30')]+=0x1;}if(!_0x465c23[_0xe16c('0x35')]&&_0x465c23['UserId']){_0x465c23[_0xe16c('0x31')]+=0x1;if(_0x465c23[_0xe16c('0x30')]){_0x465c23[_0xe16c('0x30')]-=0x1;}}if(_0x465c23[_0xe16c('0x35')]&&_0x465c23[_0xe16c('0x36')]){_0x465c23['answered']+=0x1;if(_0x465c23['talking']){_0x465c23[_0xe16c('0x31')]-=0x1;}}if(_0x465c23[_0xe16c('0x35')]&&!_0x465c23[_0xe16c('0x36')]){_0x465c23[_0xe16c('0x33')]+=0x1;if(_0x465c23[_0xe16c('0x30')]){_0x465c23['waiting']-=0x1;}}_0x465c23[_0xe16c('0x34')]+=0x1;_0x15564e(_0x465c23);});}exports[_0xe16c('0x37')]=function(_0x34a4e6,_0x5b1782){var _0x1de71a={},_0x32d72f={},_0xb817aa={'count':0x0,'rows':[]};var _0x8ed1f5=_['map'](db[_0xe16c('0x38')][_0xe16c('0x39')],function(_0x365210){return{'name':_0x365210[_0xe16c('0x3a')],'type':_0x365210[_0xe16c('0x3b')][_0xe16c('0x3c')]};});_0x32d72f['model']=_[_0xe16c('0x22')](_0x8ed1f5,'name');_0x32d72f[_0xe16c('0x3d')]=_[_0xe16c('0x3e')](_0x34a4e6[_0xe16c('0x3d')]);_0x32d72f[_0xe16c('0x3f')]=_[_0xe16c('0x40')](_0x32d72f['model'],_0x32d72f[_0xe16c('0x3d')]);_0x1de71a[_0xe16c('0x41')]=_[_0xe16c('0x40')](_0x32d72f['model'],qs[_0xe16c('0x42')](_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x42')]));_0x1de71a[_0xe16c('0x41')]=_0x1de71a['attributes'][_0xe16c('0x43')]?_0x1de71a[_0xe16c('0x41')]:_0x32d72f[_0xe16c('0x44')];if(!_0x34a4e6[_0xe16c('0x3d')]['hasOwnProperty'](_0xe16c('0x45'))){_0x1de71a[_0xe16c('0x1a')]=qs[_0xe16c('0x1a')](_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x1a')]);_0x1de71a[_0xe16c('0x17')]=qs[_0xe16c('0x17')](_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x17')]);}_0x1de71a[_0xe16c('0x46')]=qs['sort'](_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x47')]);_0x1de71a['where']=qs['filters'](_[_0xe16c('0x48')](_0x34a4e6[_0xe16c('0x3d')],_0x32d72f[_0xe16c('0x3f')]),_0x8ed1f5);var _0x3fa5f=[];var _0x36149e=squel[_0xe16c('0x49')]()[_0xe16c('0x4a')]('id')[_0xe16c('0x4a')](_0xe16c('0x20'))[_0xe16c('0x4a')](_0xe16c('0x4b'))[_0xe16c('0x4c')](_0xe16c('0x4d'));var _0x548e7f=squel[_0xe16c('0x49')]()[_0xe16c('0x4a')](_0xe16c('0x4e'))[_0xe16c('0x4a')](_0xe16c('0x4f'))[_0xe16c('0x4a')](_0xe16c('0x50'))[_0xe16c('0x4c')](_0xe16c('0x51'),'ui')[_0xe16c('0x52')](_0xe16c('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x57805c=squel['select']()[_0xe16c('0x4c')](_0xe16c('0x54'),'i')[_0xe16c('0x52')](_0xe16c('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe16c('0x52')]('users','o',_0xe16c('0x56'))[_0xe16c('0x52')]('mail_accounts','a','a.id\x20=\x20i.MailAccountId')['left_join']('mail_messages','me',_0xe16c('0x57'))[_0xe16c('0x52')](_0xe16c('0x58'),'it',_0xe16c('0x59'))[_0xe16c('0x52')](_0xe16c('0x4d'),'t',_0xe16c('0x5a'));var _0x5ecaa8=squel['expr']();var _0x1b92a8=[];var _0x20d46a=squel[_0xe16c('0x5b')]();var _0x2bbf98;if(_0x34a4e6[_0xe16c('0x3d')]['search']){_0x2bbf98=as['parseSearch'](_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x5c')]);var _0x1410a8=_0x2bbf98[_0xe16c('0x5d')];for(var _0x126a2f=0x0;_0x126a2f<_0x2bbf98[_0xe16c('0x5e')][_0xe16c('0x43')];_0x126a2f++){var _0x5d5134=_0x2bbf98[_0xe16c('0x5e')][_0x126a2f];var _0x2f76c0='i';var _0x23c143=_[_0xe16c('0x5f')](_0x8ed1f5,['name',_0x5d5134[_0xe16c('0x4a')]]);if(!_0x23c143){switch(_0x5d5134['field']){case _0xe16c('0x60'):if(_0x5d5134[_0xe16c('0x61')]==0x1){_0x57805c[_0xe16c('0x62')]('`'+_0x5d5134[_0xe16c('0x4a')]+_0xe16c('0x63'));}else{_0x57805c['having']('`'+_0x5d5134[_0xe16c('0x4a')]+_0xe16c('0x64'));}break;case'Contact':if(_0x5d5134[_0xe16c('0x65')]===_0xe16c('0x66')){if(_0x5d5134[_0xe16c('0x61')][_0xe16c('0x26')]('\x20')[_0xe16c('0x43')]>0x1){_0x5ecaa8[_0x1410a8](_0xe16c('0x67'),qs[_0xe16c('0x68')](_0x5d5134[_0xe16c('0x61')]),null);}else{var _0x43baa2='%'+_0x5d5134[_0xe16c('0x61')]+'%';_0x5ecaa8[_0x1410a8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x43baa2,_0x43baa2,_0x43baa2);}}else{_0x23c143=_[_0xe16c('0x5f')](_0x8ed1f5,[_0xe16c('0x20'),_0xe16c('0x69')]);_0x5d5134[_0xe16c('0x4a')]='ContactId';_0x40f636=as['buildExpression'](_0x2f76c0,_0x23c143['type'],_0x5d5134);_0x5ecaa8[_0x1410a8](_0x40f636[_0xe16c('0x6a')],_0x40f636[_0xe16c('0x61')]['start'],_0x40f636['value'][_0xe16c('0x15')]);}break;case _0xe16c('0x6b'):var _0x1413ac=_0x5d5134[_0xe16c('0x61')][_0xe16c('0x26')](',')[_0xe16c('0x22')](function(_0x5f4b6b){return Number(_0x5f4b6b);});_0x1413ac[_0xe16c('0x27')](function(_0x1fa5a6){_0x20d46a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1fa5a6+',%');});_0x1b92a8=_[_0xe16c('0x6c')](_0x1b92a8,_0x1413ac);break;case _0xe16c('0x6d'):if(_0x5d5134[_0xe16c('0x65')]==='$substring'){_0x5ecaa8[_0x1410a8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5d5134['value']+'%',null);}else{_0x23c143=_[_0xe16c('0x5f')](_0x8ed1f5,['name','UserId']);_0x5d5134[_0xe16c('0x4a')]=_0xe16c('0x36');_0x40f636=as[_0xe16c('0x6e')](_0x2f76c0,_0x23c143[_0xe16c('0x3b')],_0x5d5134);_0x5ecaa8[_0x1410a8](_0x40f636['text'],_0x40f636[_0xe16c('0x61')]['start'],_0x40f636[_0xe16c('0x61')][_0xe16c('0x15')]);}break;case _0xe16c('0x2c'):_0x40f636=as['buildExpression']('me',null,_0x5d5134);_0x5ecaa8[_0x1410a8](_0x40f636[_0xe16c('0x6a')],_0x40f636['value'][_0xe16c('0x6f')],_0x40f636[_0xe16c('0x61')][_0xe16c('0x15')]);break;}}else{var _0x40f636=as['buildExpression'](_0x2f76c0,_0x23c143[_0xe16c('0x3b')],_0x5d5134);_0x5ecaa8[_0x1410a8](_0x40f636[_0xe16c('0x6a')],_0x40f636['value'][_0xe16c('0x6f')],_0x40f636['value'][_0xe16c('0x15')]);}}}else{var _0x18ed00=_(_0x34a4e6[_0xe16c('0x3d')])[_0xe16c('0x3e')]()['map'](function(_0x4cf852){return _[_0xe16c('0x70')](_0x8ed1f5,[_0xe16c('0x20'),_0x4cf852])?_0x4cf852:undefined;})['compact']()[_0xe16c('0x61')]();if(!_[_0xe16c('0x71')](_0x18ed00)){_0x18ed00['forEach'](function(_0x5c8c71){if(_0x5c8c71===_0xe16c('0x72')){_0x57805c[_0xe16c('0x73')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x34a4e6['query'][_0x5c8c71]));}else if(_0x5c8c71===_0xe16c('0x74')){var _0x1c07d0=JSON['parse'](_0x34a4e6[_0xe16c('0x3d')][_0x5c8c71])['$gte'];var _0x73ac76=JSON[_0xe16c('0x75')](_0x34a4e6[_0xe16c('0x3d')][_0x5c8c71])[_0xe16c('0x76')];_0x57805c[_0xe16c('0x73')](_0xe16c('0x77'),_0x1c07d0,_0x73ac76);}else{if(_0x34a4e6['query'][_0x5c8c71]===_0xe16c('0x78')){_0x57805c[_0xe16c('0x73')]('i.'+_0x5c8c71+_0xe16c('0x79'));}else{_0x57805c[_0xe16c('0x73')]('i.'+_0x5c8c71+_0xe16c('0x7a'),_0x34a4e6[_0xe16c('0x3d')][_0x5c8c71]);}}});}if(_0x34a4e6[_0xe16c('0x3d')]['read']){if(_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x7b')]==0x1){_0x57805c[_0xe16c('0x62')](_0xe16c('0x7c'));}else{_0x57805c[_0xe16c('0x62')](_0xe16c('0x7d'));}}if(_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x7e')]){_0x1b92a8=_['isArray'](_0x34a4e6['query'][_0xe16c('0x7e')])?_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x7e')]:new Array(_0x34a4e6[_0xe16c('0x3d')]['tag']);_0x1b92a8[_0xe16c('0x27')](function(_0x5c47fe){_0x20d46a['or'](_0xe16c('0x7f'),'%,'+_0x5c47fe+',%');});}if(_0x34a4e6[_0xe16c('0x3d')]['filter']){var _0x11e954=_0x34a4e6['query']['filter'][_0xe16c('0x80')]('\x5c','\x5c\x5c')[_0xe16c('0x80')](/'/g,'\x27\x27');if(qs[_0xe16c('0x81')](_0x11e954)){_0x5ecaa8['or'](_0xe16c('0x82'),_0x11e954+'%');}else if(qs[_0xe16c('0x83')](_0x11e954)){_0x5ecaa8['or'](_0xe16c('0x84'),_0x11e954+'%');}else{_0x5ecaa8['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe16c('0x68')](_0x11e954))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x11e954));}}}_0x57805c['where'](_0x5ecaa8);_0x57805c['group'](_0xe16c('0x85'));var _0x452876={'type':db[_0xe16c('0x86')]['QueryTypes']['SELECT'],'raw':!![]};var _0x188926=_0x57805c[_0xe16c('0x87')]();_0x188926[_0xe16c('0x4a')](_0xe16c('0x85'));_0x188926[_0xe16c('0x4a')](_0xe16c('0x88'),_0xe16c('0x60'));if(_0x1de71a[_0xe16c('0x46')]){_0x1de71a[_0xe16c('0x46')][_0xe16c('0x27')](function(_0x2e20fa){var _0x25b2e1=_0x2e20fa[0x0]==='contactName'?_0x2e20fa[0x0]:'i.'+_0x2e20fa[0x0];_0x57805c['order'](_0x25b2e1,_0x2e20fa[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe16c('0x71')](_0x1b92a8)){_0x57805c[_0xe16c('0x62')](_0x20d46a);_0x188926[_0xe16c('0x73')](_0xe16c('0x89'),_0x1b92a8);}BPromise['resolve']()[_0xe16c('0x1d')](function(){if(!_0x2bbf98){if(_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x72')])return;_0x188926[_0xe16c('0x73')](_0xe16c('0x8a'));_0x57805c[_0xe16c('0x73')](_0xe16c('0x8a'));return;}if(_0x34a4e6[_0xe16c('0x8b')][_0xe16c('0x8c')]!=='agent')return;return _0x34a4e6[_0xe16c('0x8b')][_0xe16c('0x8d')]({'attributes':['id'],'raw':!![]})[_0xe16c('0x1d')](function(_0x4539b0){if(_[_0xe16c('0x71')](_0x4539b0)){_0x188926['where'](_0xe16c('0x8e'));_0x57805c[_0xe16c('0x73')](_0xe16c('0x8e'));}else{_0x188926[_0xe16c('0x73')](_0xe16c('0x8f'),_[_0xe16c('0x22')](_0x4539b0,'id'));_0x57805c[_0xe16c('0x73')]('i.MailAccountId\x20IN\x20?',_[_0xe16c('0x22')](_0x4539b0,'id'));}});})['then'](function(){if(_0x34a4e6[_0xe16c('0x8b')]['role']==='agent'&&!_0x2bbf98&&!_0x34a4e6[_0xe16c('0x3d')]['MailAccountId'])return[];return db[_0xe16c('0x90')][_0xe16c('0x3d')](_0x188926[_0xe16c('0x91')](),_0x452876);})[_0xe16c('0x1d')](function(_0x190e21){_0xb817aa[_0xe16c('0x19')]=_0x190e21[_0xe16c('0x43')];if(_0xb817aa[_0xe16c('0x19')]===0x0)return[];return db[_0xe16c('0x90')]['query'](_0x36149e[_0xe16c('0x91')](),_0x452876)[_0xe16c('0x1d')](function(_0x4c28ba){_0x3fa5f=_[_0xe16c('0x92')](_0x4c28ba,'id');_0x452876=_['merge'](_0x452876,{'model':db[_0xe16c('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34a4e6[_0xe16c('0x3d')][_0xe16c('0x42')]){_0x1de71a[_0xe16c('0x41')]['forEach'](function(_0x5346b8){_0x57805c[_0xe16c('0x4a')]('i.'+_0x5346b8);});}else{_0x57805c[_0xe16c('0x4a')](_0xe16c('0x88'),_0xe16c('0x60'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x93'),'Account.key');_0x57805c[_0xe16c('0x4a')](_0xe16c('0x94'),_0xe16c('0x95'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x96'),_0xe16c('0x97'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x85'));_0x57805c['field'](_0xe16c('0x98'));_0x57805c[_0xe16c('0x4a')]('i.updatedAt');_0x57805c['field'](_0xe16c('0x99'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x9a'));_0x57805c['field']('i.attach');_0x57805c[_0xe16c('0x4a')](_0xe16c('0x9b'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x9c'));_0x57805c['field'](_0xe16c('0x9d'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x9e'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0x9f'));_0x57805c[_0xe16c('0x4a')]('i.thirdDisposition');_0x57805c['field'](_0xe16c('0xa0'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0xa1'));_0x57805c[_0xe16c('0x4a')]('i.ContactId');_0x57805c['field']('i.MailAccountId');_0x57805c[_0xe16c('0x4a')](_0xe16c('0xa2'));_0x57805c[_0xe16c('0x4a')]('c.firstName',_0xe16c('0xa3'));_0x57805c[_0xe16c('0x4a')]('c.lastName',_0xe16c('0xa4'));_0x57805c['field'](_0xe16c('0xa5'),_0xe16c('0xa6'));_0x57805c['field'](_0xe16c('0xa7'),_0xe16c('0xa8'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0xa9'),_0xe16c('0xaa'));_0x57805c[_0xe16c('0x4a')]('c.fax',_0xe16c('0xab'));_0x57805c['field'](_0xe16c('0xac'),_0xe16c('0xad'));_0x57805c[_0xe16c('0x4a')](_0xe16c('0xae'),_0xe16c('0xaf'));_0x57805c[_0xe16c('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1de71a[_0xe16c('0x1a')])_0x57805c[_0xe16c('0x1a')](_0x1de71a[_0xe16c('0x1a')]);if(_0x1de71a[_0xe16c('0x17')])_0x57805c[_0xe16c('0x17')](_0x1de71a['offset']);return db['sequelize']['query'](_0x57805c[_0xe16c('0x91')](),_0x452876);})[_0xe16c('0x1d')](function(_0x29ff4b){if(_0x29ff4b[_0xe16c('0x43')]>0x0)_0x548e7f[_0xe16c('0x73')](_0xe16c('0xb0'),_['map'](_0x29ff4b,'id'));return db['sequelize'][_0xe16c('0x3d')](_0x548e7f[_0xe16c('0x91')](),_0x452876)[_0xe16c('0x1d')](function(_0x558b53){var _0xf387c6=_[_0xe16c('0xb1')](_0x558b53,'MailInteractionId');var _0x46741c=[];return db[_0xe16c('0xb2')][_0xe16c('0x29')]({'attributes':[_0xe16c('0xb3')],'raw':!![]})[_0xe16c('0x1d')](function(_0x53da4a){var _0x46d2e3=_0x53da4a['enableEmailPreview'];_0x29ff4b[_0xe16c('0x27')](function(_0x179ade){_0x46741c['push'](updateMailInteraction(_0x179ade,_0x3fa5f,_0xf387c6,_0x46d2e3));});return BPromise['all'](_0x46741c);});});});})[_0xe16c('0x1d')](function(_0x52538f){_0xb817aa[_0xe16c('0xb4')]=_0x52538f;return _0xb817aa;})[_0xe16c('0x1d')](respondWithFilteredResult(_0x5b1782,_0x1de71a))[_0xe16c('0x2f')](handleError(_0x5b1782,null));};exports['show']=function(_0x2b4f73,_0x11e432){var _0xcb1c3={'raw':![],'where':{'id':_0x2b4f73['params']['id']}},_0x342465={};_0x342465['model']=_[_0xe16c('0x3e')](db[_0xe16c('0x38')][_0xe16c('0x39')]);_0x342465[_0xe16c('0x3d')]=_[_0xe16c('0x3e')](_0x2b4f73[_0xe16c('0x3d')]);_0x342465[_0xe16c('0x3f')]=_[_0xe16c('0x40')](_0x342465[_0xe16c('0x44')],_0x342465[_0xe16c('0x3d')]);_0xcb1c3[_0xe16c('0x41')]=_['intersection'](_0x342465[_0xe16c('0x44')],qs['fields'](_0x2b4f73['query'][_0xe16c('0x42')]));_0xcb1c3['attributes']=_0xcb1c3[_0xe16c('0x41')]['length']?_0xcb1c3[_0xe16c('0x41')]:_0x342465[_0xe16c('0x44')];if(_0x2b4f73[_0xe16c('0x3d')][_0xe16c('0xb5')]){_0xcb1c3['include']=[{'all':!![]}];}_0xcb1c3=_[_0xe16c('0xb6')]({},_0xcb1c3,_0x2b4f73[_0xe16c('0xb7')]);return db[_0xe16c('0x38')][_0xe16c('0x5f')](_0xcb1c3)['then'](handleEntityNotFound(_0x11e432,null))[_0xe16c('0x1d')](respondWithResult(_0x11e432,null))[_0xe16c('0x2f')](handleError(_0x11e432,null));};exports['create']=function(_0x1db695,_0x25ed83){return db[_0xe16c('0x38')]['create'](_0x1db695[_0xe16c('0xb8')],{})[_0xe16c('0x1d')](respondWithResult(_0x25ed83,0xc9))[_0xe16c('0x2f')](handleError(_0x25ed83,null));};exports[_0xe16c('0xb9')]=function(_0x4addfc,_0x1913fc){if(_0x4addfc[_0xe16c('0xb8')]['id']){delete _0x4addfc[_0xe16c('0xb8')]['id'];}return db['MailInteraction'][_0xe16c('0x5f')]({'where':{'id':_0x4addfc[_0xe16c('0xba')]['id']}})[_0xe16c('0x1d')](handleEntityNotFound(_0x1913fc,null))['then'](saveUpdates(_0x4addfc['body'],null))[_0xe16c('0x1d')](respondWithResult(_0x1913fc,null))['catch'](handleError(_0x1913fc,null));};exports[_0xe16c('0x1c')]=function(_0x57f4e1,_0xcdb243){return db[_0xe16c('0x38')][_0xe16c('0x5f')]({'where':{'id':_0x57f4e1[_0xe16c('0xba')]['id']}})[_0xe16c('0x1d')](handleEntityNotFound(_0xcdb243,null))[_0xe16c('0x1d')](removeEntity(_0xcdb243,null))[_0xe16c('0x2f')](handleError(_0xcdb243,null));};exports[_0xe16c('0xbb')]=function(_0x2a5c9d,_0x59bd26){return db['MailInteraction'][_0xe16c('0xbb')]()[_0xe16c('0x1d')](respondWithResult(_0x59bd26,null))['catch'](handleError(_0x59bd26,null));};exports[_0xe16c('0xbc')]=function(_0x163510,_0x10a20f){return db[_0xe16c('0xbd')][_0xe16c('0x5f')]({'where':{'id':_0x163510[_0xe16c('0xba')]['id']}})[_0xe16c('0x1d')](handleEntityNotFound(_0x10a20f,null))[_0xe16c('0x1d')](function(_0x1bfab6){if(_0x1bfab6){return _0x1bfab6[_0xe16c('0xbc')](_0x163510[_0xe16c('0xb8')][_0xe16c('0xbe')],_[_0xe16c('0xbf')](_0x163510[_0xe16c('0xb8')],['ids','id'])||{});}})[_0xe16c('0x1d')](respondWithResult(_0x10a20f,null))[_0xe16c('0x2f')](handleError(_0x10a20f,null));};exports[_0xe16c('0xc0')]=function(_0x1c81c3,_0x2c6f01){var _0x5e3eb3={'raw':![],'where':{}};var _0x385f46={};var _0x63db24={'count':0x0,'rows':[]};return db[_0xe16c('0x38')][_0xe16c('0x29')]({'where':{'id':_0x1c81c3[_0xe16c('0xba')]['id']}})[_0xe16c('0x1d')](handleEntityNotFound(_0x2c6f01,null))[_0xe16c('0x1d')](function(_0x55347f){if(_0x55347f){_0x385f46[_0xe16c('0x44')]=_[_0xe16c('0x3e')](db['MailMessage'][_0xe16c('0x39')]);_0x385f46['query']=_[_0xe16c('0x3e')](_0x1c81c3[_0xe16c('0x3d')]);_0x385f46[_0xe16c('0x3f')]=_[_0xe16c('0x40')](_0x385f46[_0xe16c('0x44')],_0x385f46[_0xe16c('0x3d')]);_0x5e3eb3['attributes']=_[_0xe16c('0x40')](_0x385f46[_0xe16c('0x44')],qs['fields'](_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0x42')]));_0x5e3eb3[_0xe16c('0x41')]=_0x5e3eb3[_0xe16c('0x41')][_0xe16c('0x43')]?_0x5e3eb3[_0xe16c('0x41')]:_0x385f46['model'];if(!_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0xc1')](_0xe16c('0x45'))){_0x5e3eb3[_0xe16c('0x1a')]=qs[_0xe16c('0x1a')](_0x1c81c3['query'][_0xe16c('0x1a')]);_0x5e3eb3['offset']=qs[_0xe16c('0x17')](_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0x17')]);}_0x5e3eb3['order']=qs['sort'](_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0x47')]);_0x5e3eb3[_0xe16c('0x73')]=qs['filters'](_[_0xe16c('0x48')](_0x1c81c3[_0xe16c('0x3d')],_0x385f46[_0xe16c('0x3f')]));_0x5e3eb3[_0xe16c('0x73')][_0xe16c('0xc2')]=_0x55347f['id'];if(_0x1c81c3['query'][_0xe16c('0xc3')]){_0x5e3eb3[_0xe16c('0x73')]=_[_0xe16c('0xb6')](_0x5e3eb3[_0xe16c('0x73')],{'$or':_[_0xe16c('0x22')](_0x5e3eb3[_0xe16c('0x41')],function(_0x4c75d4){var _0x5ae342={};_0x5ae342[_0x4c75d4]={'$like':'%'+_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0xc3')]+'%'};return _0x5ae342;})});}if(_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0xc4')]){var _0x14188b=_0x1c81c3['query'][_0xe16c('0xc4')][_0xe16c('0x26')](',');var _0x24fef1={};_0x24fef1[_0x14188b[0x0]]={'$gte':moment(_0x14188b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5e3eb3[_0xe16c('0x73')]=_[_0xe16c('0xb6')](_0x5e3eb3[_0xe16c('0x73')],_0x24fef1);}_0x5e3eb3=_[_0xe16c('0xb6')]({},_0x5e3eb3,_0x1c81c3[_0xe16c('0xb7')]);return db['MailMessage'][_0xe16c('0x19')]({'where':_0x5e3eb3[_0xe16c('0x73')]})[_0xe16c('0x1d')](function(_0x450514){_0x63db24['count']=_0x450514;if(_0x1c81c3[_0xe16c('0x3d')]['includeAll']){_0x5e3eb3[_0xe16c('0xc5')]=[{'all':!![]}];}return db[_0xe16c('0xbd')]['findAll'](_0x5e3eb3);})[_0xe16c('0x1d')](function(_0x205dfc){if(_0x1c81c3[_0xe16c('0x3d')][_0xe16c('0xc6')]==='true'){for(var _0x4a5ad0=0x0;_0x4a5ad0<_0x205dfc[_0xe16c('0x43')];_0x4a5ad0++){_0x205dfc[_0x4a5ad0][_0xe16c('0xb8')]=juice(_0x205dfc[_0x4a5ad0][_0xe16c('0xb8')]);}}_0x63db24[_0xe16c('0xb4')]=_0x205dfc;return _0x63db24;});}})[_0xe16c('0x1d')](respondWithFilteredResult(_0x2c6f01,_0x5e3eb3))[_0xe16c('0x2f')](handleError(_0x2c6f01,null));};exports['addTags']=function(_0x4c5a74,_0x5a683c){return db[_0xe16c('0x38')]['find']({'where':{'id':_0x4c5a74[_0xe16c('0xba')]['id']}})[_0xe16c('0x1d')](handleEntityNotFound(_0x5a683c,null))[_0xe16c('0x1d')](function(_0xdca4e6){if(_0xdca4e6){return _0xdca4e6[_0xe16c('0xc7')](_0x4c5a74[_0xe16c('0xb8')][_0xe16c('0xbe')],_[_0xe16c('0xbf')](_0x4c5a74['body'],[_0xe16c('0xbe'),'id'])||{})['spread'](function(){return db[_0xe16c('0x6b')][_0xe16c('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x4c5a74['body'][_0xe16c('0xbe')]}});})[_0xe16c('0x1d')](function(_0x376282){socket[_0xe16c('0xc9')](_0xe16c('0xca'),{'id':Number(_0x4c5a74[_0xe16c('0xba')]['id']),'tags':_0x376282||[]});return{'id':Number(_0x4c5a74[_0xe16c('0xba')]['id']),'tags':_0x376282||[]};});}})[_0xe16c('0x1d')](respondWithResult(_0x5a683c,null))[_0xe16c('0x2f')](handleError(_0x5a683c,null));};exports['removeTags']=function(_0x2ac420,_0x417c2c){return db[_0xe16c('0x38')][_0xe16c('0x5f')]({'where':{'id':_0x2ac420[_0xe16c('0xba')]['id']}})[_0xe16c('0x1d')](handleEntityNotFound(_0x417c2c,null))[_0xe16c('0x1d')](function(_0x18a0f0){if(_0x18a0f0){return _0x18a0f0[_0xe16c('0xcb')](_0x2ac420['query']['ids']);}})['then'](respondWithStatusCode(_0x417c2c,null))[_0xe16c('0x2f')](handleError(_0x417c2c,null));};exports[_0xe16c('0xcc')]=function(_0x3df4ba,_0x2deb5b){var _0x27dc2e=moment()[_0xe16c('0xcd')]()[_0xe16c('0x91')]();var _0x4dd45b=path[_0xe16c('0xce')](config[_0xe16c('0xcf')],'server',_0xe16c('0xd0'),_0xe16c('0xd1'));var _0x2700bd=path[_0xe16c('0xce')](config['root'],_0xe16c('0xd2'),'files',_0xe16c('0xd3'));var _0x24fd1b=path['join'](_0x4dd45b,_0x27dc2e);var _0x5966f6=util['format'](_0xe16c('0xd4'),_0x3df4ba[_0xe16c('0xba')]['id'],_0x27dc2e);var _0x573ff3=path[_0xe16c('0xce')](_0x4dd45b,_0x5966f6);var _0x23a95e=[];if(_0x3df4ba[_0xe16c('0x3d')]['attachments']){_0x23a95e[_0xe16c('0x28')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x10fdeb=[{'model':db['MailMessage'],'as':_0xe16c('0xd5'),'attributes':['id',_0xe16c('0xb8'),_0xe16c('0x4c'),'to','cc',_0xe16c('0xd6'),_0xe16c('0xd7'),_0xe16c('0x74')],'where':{'secret':![]},'order':qs[_0xe16c('0x47')]('id'),'include':_0x23a95e}];return db[_0xe16c('0x38')][_0xe16c('0x5f')]({'where':{'id':_0x3df4ba[_0xe16c('0xba')]['id']},'include':_0x10fdeb})[_0xe16c('0x1d')](handleEntityNotFound(_0x2deb5b,null))[_0xe16c('0x1d')](function(_0xf2868b){if(_0xf2868b&&_0xf2868b[_0xe16c('0xd5')]){var _0x11a00c=_0xf2868b[_0xe16c('0xd8')]({'plain':!![]});fs[_0xe16c('0xd9')](_0x24fd1b);return BPromise[_0xe16c('0xda')](_0x11a00c[_0xe16c('0xd5')],function(_0xb9088c,_0x8a03ec){var _0x2c1a30={'from':_0xb9088c['from'],'to':_0xb9088c['to'],'subject':_0xb9088c[_0xe16c('0xd7')],'html':htmlEntities[_0xe16c('0xdb')](_0xb9088c['body']),'headers':{'Date':moment(_0xb9088c['createdAt'])[_0xe16c('0xdc')](_0xe16c('0xdd'))},'attachments':[]};if(_0xb9088c['cc']){_0x2c1a30[_0xe16c('0xde')]['Cc']=_0xb9088c['cc'];}if(_0xb9088c['bcc']){_0x2c1a30[_0xe16c('0xde')][_0xe16c('0xdf')]=_0xb9088c[_0xe16c('0xd6')];}return new BPromise(function(_0x48102f,_0xe671c5){if(_0xb9088c['Attachments']){for(var _0x1250ed=0x0;_0x1250ed<_0xb9088c['Attachments']['length'];_0x1250ed++){var _0x224b39=_0xb9088c[_0xe16c('0xe0')][_0x1250ed];var _0x1a729d=path[_0xe16c('0xce')](_0x2700bd,_0x224b39['basename']);if(fs[_0xe16c('0xe1')](_0x1a729d)){_0x2c1a30['attachments']['push']({'name':_0x224b39[_0xe16c('0x20')],'contentType':_0x224b39[_0xe16c('0x3b')],'data':fs['readFileSync'](_0x1a729d)});}}}emlformat[_0xe16c('0xe2')](_0x2c1a30,function(_0x1eaf60,_0x405751){if(_0x1eaf60)return _0xe671c5(_0x1eaf60);fs[_0xe16c('0xe3')](path[_0xe16c('0xce')](_0x24fd1b,util[_0xe16c('0xdc')](_0xe16c('0xe4'),_0x8a03ec)),_0x405751);return _0x48102f(_0x405751);});});})['then'](function(){return new BPromise(function(_0x2f9b84,_0x272ef6){zipdir(_0x24fd1b,{'saveTo':_0x573ff3},function(_0x2bdb08,_0x3603ca){if(_0x2bdb08)return _0x272ef6(_0x2bdb08);return _0x2f9b84(_0x3603ca);});})['then'](function(){return new BPromise(function(_0x3d6fe1,_0x2adb7f){rimraf(_0x24fd1b,function(_0x45d9ec){if(_0x45d9ec)_0x2adb7f(_0x45d9ec);return _0x3d6fe1();});});})[_0xe16c('0x1d')](function(){return _0x2deb5b['download'](_0x573ff3,_0x5966f6,function(_0x42439c){if(!_0x42439c)fs['unlinkSync'](_0x573ff3);});});});}else{return _0x2deb5b[_0xe16c('0x13')](0xc8);}})[_0xe16c('0x2f')](handleError(_0x2deb5b,null));}; \ No newline at end of file +var _0x236d=['$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','type','compact','isEmpty','MailAccountId','concat','parse','$gte','$lte','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','clone','i.id','order','contactName','role','user','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','agent','sequelize','toString','MailInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','rows','show','fields','includeAll','include','merge','create','body','params','describe','addMessage','ids','omit','getMessages','filters','pick','MailInteractionId','options','findAll','inlineCss','true','addTags','setTags','spread','emit','removeTags','download','join','root','server','files','attachments','Attachment','Messages','subject','createdAt','get','mkdirSync','each','decode','headers','bcc','Attachments','basename','readFileSync','build','writeFileSync','format','message%d.eml','unlinkSync','eml-format','rimraf','moment','util','path','lodash','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','localhost','./mailInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','name','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','ui.MailInteractionId','user_has_mail_interactions','left_join','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','Contact','operator'];(function(_0x4dbfce,_0xaf8cdf){var _0x1f3e53=function(_0x589c63){while(--_0x589c63){_0x4dbfce['push'](_0x4dbfce['shift']());}};_0x1f3e53(++_0xaf8cdf);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var moment=require(_0xd236('0x2'));var BPromise=require('bluebird');var util=require(_0xd236('0x3'));var path=require(_0xd236('0x4'));var fs=require('fs');var _=require(_0xd236('0x5'));var squel=require(_0xd236('0x6'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xd236('0x7'));var as=require(_0xd236('0x8'));var logger=require(_0xd236('0x9'))(_0xd236('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xd236('0xb'));config[_0xd236('0xc')]=_['defaults'](config[_0xd236('0xc')],{'host':_0xd236('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd236('0xc')]));require(_0xd236('0xe'))[_0xd236('0xf')](socket);function respondWithStatusCode(_0x594013,_0x470524){_0x470524=_0x470524||0xcc;return function(_0x2e4986){if(_0x2e4986){return _0x594013[_0xd236('0x10')](_0x470524);}return _0x594013['status'](_0x470524)[_0xd236('0x11')]();};}function respondWithResult(_0x2fe18d,_0x3d1076){_0x3d1076=_0x3d1076||0xc8;return function(_0x160cb1){if(_0x160cb1){return _0x2fe18d[_0xd236('0x12')](_0x3d1076)[_0xd236('0x13')](_0x160cb1);}};}function respondWithFilteredResult(_0x206b35,_0x974c47){return function(_0x22435c){if(_0x22435c){var _0x3d7465=typeof _0x974c47[_0xd236('0x14')]===_0xd236('0x15')&&typeof _0x974c47[_0xd236('0x16')]===_0xd236('0x15');var _0xd851b5=_0x22435c[_0xd236('0x17')];var _0x2a076d=_0x3d7465?0x0:_0x974c47[_0xd236('0x14')];var _0x24ce6e=_0x3d7465?_0x22435c[_0xd236('0x17')]:_0x974c47['offset']+_0x974c47['limit'];var _0x216a25;if(_0x24ce6e>=_0xd851b5){_0x24ce6e=_0xd851b5;_0x216a25=0xc8;}else{_0x216a25=0xce;}_0x206b35[_0xd236('0x12')](_0x216a25);return _0x206b35['set'](_0xd236('0x18'),_0x2a076d+'-'+_0x24ce6e+'/'+_0xd851b5)[_0xd236('0x13')](_0x22435c);}return null;};}function saveUpdates(_0x132752){return function(_0x595fd4){if(_0x595fd4){return _0x595fd4[_0xd236('0x19')](_0x132752)[_0xd236('0x1a')](function(_0x31f0bb){return _0x31f0bb;});}return null;};}function removeEntity(_0x551b53){return function(_0x25220d){if(_0x25220d){return _0x25220d[_0xd236('0x1b')]()[_0xd236('0x1a')](function(){_0x551b53[_0xd236('0x12')](0xcc)[_0xd236('0x11')]();});}};}function handleEntityNotFound(_0x58cc3f){return function(_0x2a1255){if(!_0x2a1255){_0x58cc3f[_0xd236('0x10')](0x194);}return _0x2a1255;};}function handleError(_0x1e4ddb,_0x3d1e4e){_0x3d1e4e=_0x3d1e4e||0x1f4;return function(_0xf28313){logger['error'](_0xf28313['stack']);if(_0xf28313[_0xd236('0x1c')]){delete _0xf28313['name'];}_0x1e4ddb[_0xd236('0x12')](_0x3d1e4e)['send'](_0xf28313);};}function getInteractionUsers(_0x2be060,_0x2174f5){return new BPromise(function(_0x234930,_0x49d822){try{if(_0x2174f5[_0x2be060['id']]){_0x2be060[_0xd236('0x1d')]=_[_0xd236('0x1e')](_0x2174f5[_0x2be060['id']],function(_0x6d3372){return{'id':_0x6d3372['id'],'fullname':_0x6d3372[_0xd236('0x1f')]};});}}catch(_0x3a30d8){_0x49d822(_0x3a30d8);}_0x234930(_0x2be060);});}function getInteractionTags(_0x17f927,_0x41cf34){return new BPromise(function(_0x21eeab,_0x2cbb03){try{if(_0x17f927[_0xd236('0x20')]){_0x17f927[_0xd236('0x21')]=[];_0x17f927[_0xd236('0x20')][_0xd236('0x22')](',')[_0xd236('0x23')](function(_0x3108f4){_0x17f927[_0xd236('0x21')][_0xd236('0x24')](_0x41cf34[_0x3108f4]);});}delete _0x17f927[_0xd236('0x20')];}catch(_0x463fc8){_0x2cbb03(_0x463fc8);}_0x21eeab(_0x17f927);});}function getLastMessageText(_0x98d8b0){return new BPromise(function(_0x119de7,_0x37b099){return db[_0xd236('0x25')][_0xd236('0x26')]({'where':{'$and':[{'MailInteractionId':_0x98d8b0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd236('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd236('0x28')],'order':_0xd236('0x29'),'raw':!![]})[_0xd236('0x1a')](function(_0x3d5f6d){if(_0x3d5f6d&&_0x3d5f6d['plainBody']){_0x98d8b0[_0xd236('0x2a')]=_['trimStart'](_0x3d5f6d[_0xd236('0x28')]);}_0x119de7(_0x98d8b0);})[_0xd236('0x2b')](function(_0x73a2fb){_0x37b099(_0x73a2fb);});});}function updateMailInteraction(_0x58cfb7,_0x1c1692,_0x37b5f7,_0x3bba5d){return new BPromise(function(_0x33400d,_0x2b8e83){return getInteractionUsers(_0x58cfb7,_0x37b5f7)[_0xd236('0x1a')](function(_0x42361d){return getInteractionTags(_0x42361d,_0x1c1692);})['then'](function(_0x2fa782){return getStateInteraction(_0x2fa782);})['then'](function(_0x284748){if(_0x3bba5d){_0x33400d(getLastMessageText(_0x284748));}else{_0x33400d(_0x284748);}})['catch'](function(_0x1fd01b){_0x2b8e83(_0x1fd01b);});});}function getStateInteraction(_0xb75faa){return new BPromise(function(_0x366128){_0xb75faa[_0xd236('0x2c')]=0x0;_0xb75faa[_0xd236('0x2d')]=0x0;_0xb75faa[_0xd236('0x2e')]=0x0;_0xb75faa[_0xd236('0x2f')]=0x0;_0xb75faa[_0xd236('0x30')]=0x0;if(!_0xb75faa[_0xd236('0x31')]&&!_0xb75faa[_0xd236('0x32')]){_0xb75faa[_0xd236('0x2c')]+=0x1;}if(!_0xb75faa[_0xd236('0x31')]&&_0xb75faa[_0xd236('0x32')]){_0xb75faa['talking']+=0x1;if(_0xb75faa[_0xd236('0x2c')]){_0xb75faa[_0xd236('0x2c')]-=0x1;}}if(_0xb75faa[_0xd236('0x31')]&&_0xb75faa['UserId']){_0xb75faa[_0xd236('0x2e')]+=0x1;if(_0xb75faa[_0xd236('0x2d')]){_0xb75faa[_0xd236('0x2d')]-=0x1;}}if(_0xb75faa[_0xd236('0x31')]&&!_0xb75faa[_0xd236('0x32')]){_0xb75faa[_0xd236('0x2f')]+=0x1;if(_0xb75faa['waiting']){_0xb75faa[_0xd236('0x2c')]-=0x1;}}_0xb75faa[_0xd236('0x30')]+=0x1;_0x366128(_0xb75faa);});}exports[_0xd236('0x33')]=function(_0x3c798f,_0x3c74f1){var _0x222495={},_0x4a9d27={},_0x35b950={'count':0x0,'rows':[]};var _0x2cd22e=_[_0xd236('0x1e')](db['MailInteraction'][_0xd236('0x34')],function(_0x5a8b18){return{'name':_0x5a8b18[_0xd236('0x35')],'type':_0x5a8b18['type']['key']};});_0x4a9d27[_0xd236('0x36')]=_[_0xd236('0x1e')](_0x2cd22e,_0xd236('0x1c'));_0x4a9d27[_0xd236('0x37')]=_[_0xd236('0x38')](_0x3c798f['query']);_0x4a9d27['filters']=_[_0xd236('0x39')](_0x4a9d27[_0xd236('0x36')],_0x4a9d27['query']);_0x222495[_0xd236('0x3a')]=_[_0xd236('0x39')](_0x4a9d27[_0xd236('0x36')],qs['fields'](_0x3c798f['query']['fields']));_0x222495[_0xd236('0x3a')]=_0x222495['attributes']['length']?_0x222495[_0xd236('0x3a')]:_0x4a9d27[_0xd236('0x36')];if(!_0x3c798f[_0xd236('0x37')][_0xd236('0x3b')](_0xd236('0x3c'))){_0x222495['limit']=qs['limit'](_0x3c798f[_0xd236('0x37')][_0xd236('0x16')]);_0x222495[_0xd236('0x14')]=qs[_0xd236('0x14')](_0x3c798f[_0xd236('0x37')][_0xd236('0x14')]);}_0x222495['order']=qs[_0xd236('0x3d')](_0x3c798f['query'][_0xd236('0x3d')]);_0x222495[_0xd236('0x3e')]=qs['filters'](_['pick'](_0x3c798f['query'],_0x4a9d27['filters']),_0x2cd22e);var _0x43ba74=[];var _0x11afc6=squel[_0xd236('0x3f')]()[_0xd236('0x40')]('id')[_0xd236('0x40')]('name')['field'](_0xd236('0x41'))[_0xd236('0x42')](_0xd236('0x43'));var _0x208548=squel[_0xd236('0x3f')]()[_0xd236('0x40')]('u.id')[_0xd236('0x40')]('u.fullname')[_0xd236('0x40')](_0xd236('0x44'))['from'](_0xd236('0x45'),'ui')[_0xd236('0x46')]('users','u','u.id\x20=\x20ui.UserId');var _0x135cfc=squel[_0xd236('0x3f')]()[_0xd236('0x42')](_0xd236('0x47'),'i')['left_join'](_0xd236('0x48'),'c',_0xd236('0x49'))[_0xd236('0x46')](_0xd236('0x4a'),'o',_0xd236('0x4b'))[_0xd236('0x46')]('mail_accounts','a','a.id\x20=\x20i.MailAccountId')[_0xd236('0x46')]('mail_messages','me',_0xd236('0x4c'))[_0xd236('0x46')]('mail_interaction_has_tags','it',_0xd236('0x4d'))[_0xd236('0x46')]('tools_tags','t',_0xd236('0x4e'));var _0x2d6549=squel[_0xd236('0x4f')]();var _0x3246b9=[];var _0x5b9337=squel['expr']();var _0x20b51b;if(_0x3c798f[_0xd236('0x37')]['search']){_0x20b51b=as[_0xd236('0x50')](_0x3c798f[_0xd236('0x37')][_0xd236('0x51')]);var _0x26b0c9=_0x20b51b[_0xd236('0x52')];for(var _0x54f23f=0x0;_0x54f23f<_0x20b51b[_0xd236('0x53')][_0xd236('0x54')];_0x54f23f++){var _0x2eefac=_0x20b51b['conditions'][_0x54f23f];var _0x284e3f='i';var _0x524d53=_['find'](_0x2cd22e,[_0xd236('0x1c'),_0x2eefac[_0xd236('0x40')]]);if(!_0x524d53){switch(_0x2eefac[_0xd236('0x40')]){case _0xd236('0x55'):if(_0x2eefac[_0xd236('0x56')]==0x1){_0x135cfc[_0xd236('0x57')]('`'+_0x2eefac[_0xd236('0x40')]+'`\x20=\x200');}else{_0x135cfc[_0xd236('0x57')]('`'+_0x2eefac[_0xd236('0x40')]+_0xd236('0x58'));}break;case _0xd236('0x59'):if(_0x2eefac[_0xd236('0x5a')]===_0xd236('0x5b')){if(_0x2eefac['value'][_0xd236('0x22')]('\x20')[_0xd236('0x54')]>0x1){_0x2d6549[_0x26b0c9](_0xd236('0x5c'),qs['getFullTextValue'](_0x2eefac[_0xd236('0x56')]),null);}else{var _0x6f83a2='%'+_0x2eefac[_0xd236('0x56')]+'%';_0x2d6549[_0x26b0c9]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x6f83a2,_0x6f83a2,_0x6f83a2);}}else{_0x524d53=_[_0xd236('0x5d')](_0x2cd22e,[_0xd236('0x1c'),_0xd236('0x5e')]);_0x2eefac[_0xd236('0x40')]='ContactId';_0x13e6cd=as[_0xd236('0x5f')](_0x284e3f,_0x524d53['type'],_0x2eefac);_0x2d6549[_0x26b0c9](_0x13e6cd[_0xd236('0x60')],_0x13e6cd['value'][_0xd236('0x61')],_0x13e6cd['value'][_0xd236('0x11')]);}break;case _0xd236('0x62'):var _0x5a1653=_0x2eefac[_0xd236('0x56')]['split'](',')[_0xd236('0x1e')](function(_0xe32357){return Number(_0xe32357);});_0x5a1653['forEach'](function(_0xc0c0f0){_0x5b9337['or'](_0xd236('0x63'),'%,'+_0xc0c0f0+',%');});_0x3246b9=_['union'](_0x3246b9,_0x5a1653);break;case'User':if(_0x2eefac[_0xd236('0x5a')]===_0xd236('0x5b')){_0x2d6549[_0x26b0c9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2eefac[_0xd236('0x56')]+'%',null);}else{_0x524d53=_['find'](_0x2cd22e,[_0xd236('0x1c'),_0xd236('0x32')]);_0x2eefac['field']=_0xd236('0x32');_0x13e6cd=as[_0xd236('0x5f')](_0x284e3f,_0x524d53[_0xd236('0x64')],_0x2eefac);_0x2d6549[_0x26b0c9](_0x13e6cd[_0xd236('0x60')],_0x13e6cd['value'][_0xd236('0x61')],_0x13e6cd[_0xd236('0x56')][_0xd236('0x11')]);}break;case'plainBody':_0x13e6cd=as[_0xd236('0x5f')]('me',null,_0x2eefac);_0x2d6549[_0x26b0c9](_0x13e6cd['text'],_0x13e6cd[_0xd236('0x56')][_0xd236('0x61')],_0x13e6cd[_0xd236('0x56')]['end']);break;}}else{var _0x13e6cd=as[_0xd236('0x5f')](_0x284e3f,_0x524d53[_0xd236('0x64')],_0x2eefac);_0x2d6549[_0x26b0c9](_0x13e6cd[_0xd236('0x60')],_0x13e6cd['value'][_0xd236('0x61')],_0x13e6cd[_0xd236('0x56')][_0xd236('0x11')]);}}}else{var _0x350711=_(_0x3c798f['query'])[_0xd236('0x38')]()[_0xd236('0x1e')](function(_0x5ec566){return _['some'](_0x2cd22e,[_0xd236('0x1c'),_0x5ec566])?_0x5ec566:undefined;})[_0xd236('0x65')]()[_0xd236('0x56')]();if(!_[_0xd236('0x66')](_0x350711)){_0x350711[_0xd236('0x23')](function(_0x372d9a){if(_0x372d9a===_0xd236('0x67')){_0x135cfc[_0xd236('0x3e')]('i.MailAccountId\x20IN\x20?',[][_0xd236('0x68')](_0x3c798f[_0xd236('0x37')][_0x372d9a]));}else if(_0x372d9a==='createdAt'){var _0x11712e=JSON[_0xd236('0x69')](_0x3c798f['query'][_0x372d9a])[_0xd236('0x6a')];var _0x1cdc97=JSON['parse'](_0x3c798f[_0xd236('0x37')][_0x372d9a])[_0xd236('0x6b')];_0x135cfc[_0xd236('0x3e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x11712e,_0x1cdc97);}else{if(_0x3c798f['query'][_0x372d9a]==='null'){_0x135cfc[_0xd236('0x3e')]('i.'+_0x372d9a+'\x20IS\x20NULL');}else{_0x135cfc['where']('i.'+_0x372d9a+_0xd236('0x6c'),_0x3c798f[_0xd236('0x37')][_0x372d9a]);}}});}if(_0x3c798f[_0xd236('0x37')][_0xd236('0x6d')]){if(_0x3c798f['query'][_0xd236('0x6d')]==0x1){_0x135cfc[_0xd236('0x57')](_0xd236('0x6e'));}else{_0x135cfc['having'](_0xd236('0x6f'));}}if(_0x3c798f[_0xd236('0x37')][_0xd236('0x70')]){_0x3246b9=_[_0xd236('0x71')](_0x3c798f[_0xd236('0x37')]['tag'])?_0x3c798f['query'][_0xd236('0x70')]:new Array(_0x3c798f['query'][_0xd236('0x70')]);_0x3246b9[_0xd236('0x23')](function(_0x114afa){_0x5b9337['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x114afa+',%');});}if(_0x3c798f[_0xd236('0x37')][_0xd236('0x72')]){var _0x516bb1=_0x3c798f[_0xd236('0x37')][_0xd236('0x72')]['replace']('\x5c','\x5c\x5c')[_0xd236('0x73')](/'/g,'\x27\x27');if(qs[_0xd236('0x74')](_0x516bb1)){_0x2d6549['or']('i.id\x20LIKE\x20?',_0x516bb1+'%');}else if(qs['isEmail'](_0x516bb1)){_0x2d6549['or'](_0xd236('0x75'),_0x516bb1+'%');}else{_0x2d6549['or'](_0xd236('0x76'),qs['getFullTextValue'](_0x516bb1))['or'](_0xd236('0x77'),qs['getFullTextValue'](_0x516bb1));}}}_0x135cfc[_0xd236('0x3e')](_0x2d6549);_0x135cfc[_0xd236('0x78')]('i.id');var _0x26f817={'type':db[_0xd236('0x79')]['QueryTypes'][_0xd236('0x7a')],'raw':!![]};var _0x5864d9=_0x135cfc[_0xd236('0x7b')]();_0x5864d9[_0xd236('0x40')](_0xd236('0x7c'));_0x5864d9[_0xd236('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x222495[_0xd236('0x7d')]){_0x222495['order'][_0xd236('0x23')](function(_0x1677b1){var _0x58d0a0=_0x1677b1[0x0]===_0xd236('0x7e')?_0x1677b1[0x0]:'i.'+_0x1677b1[0x0];_0x135cfc[_0xd236('0x7d')](_0x58d0a0,_0x1677b1[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd236('0x66')](_0x3246b9)){_0x135cfc[_0xd236('0x57')](_0x5b9337);_0x5864d9[_0xd236('0x3e')]('t.id\x20IN\x20?',_0x3246b9);}BPromise['resolve']()[_0xd236('0x1a')](function(){if(!_0x20b51b){if(_0x3c798f[_0xd236('0x37')][_0xd236('0x67')])return;_0x5864d9[_0xd236('0x3e')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x135cfc[_0xd236('0x3e')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3c798f['user'][_0xd236('0x7f')]!=='agent')return;return _0x3c798f[_0xd236('0x80')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xd236('0x1a')](function(_0x7f9b05){if(_[_0xd236('0x66')](_0x7f9b05)){_0x5864d9[_0xd236('0x3e')](_0xd236('0x81'));_0x135cfc['where'](_0xd236('0x81'));}else{_0x5864d9[_0xd236('0x3e')](_0xd236('0x82'),_[_0xd236('0x1e')](_0x7f9b05,'id'));_0x135cfc['where'](_0xd236('0x82'),_[_0xd236('0x1e')](_0x7f9b05,'id'));}});})[_0xd236('0x1a')](function(){if(_0x3c798f[_0xd236('0x80')][_0xd236('0x7f')]===_0xd236('0x83')&&!_0x20b51b&&!_0x3c798f[_0xd236('0x37')][_0xd236('0x67')])return[];return db[_0xd236('0x84')][_0xd236('0x37')](_0x5864d9[_0xd236('0x85')](),_0x26f817);})[_0xd236('0x1a')](function(_0x487546){_0x35b950[_0xd236('0x17')]=_0x487546[_0xd236('0x54')];if(_0x35b950[_0xd236('0x17')]===0x0)return[];return db[_0xd236('0x84')][_0xd236('0x37')](_0x11afc6[_0xd236('0x85')](),_0x26f817)[_0xd236('0x1a')](function(_0x4a4339){_0x43ba74=_['keyBy'](_0x4a4339,'id');_0x26f817=_['merge'](_0x26f817,{'model':db[_0xd236('0x86')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c798f[_0xd236('0x37')]['fields']){_0x222495[_0xd236('0x3a')][_0xd236('0x23')](function(_0x6f16c6){_0x135cfc[_0xd236('0x40')]('i.'+_0x6f16c6);});}else{_0x135cfc['field'](_0xd236('0x87'),_0xd236('0x55'));_0x135cfc[_0xd236('0x40')](_0xd236('0x88'),_0xd236('0x89'));_0x135cfc[_0xd236('0x40')](_0xd236('0x8a'),_0xd236('0x8b'));_0x135cfc[_0xd236('0x40')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x135cfc[_0xd236('0x40')](_0xd236('0x7c'));_0x135cfc['field'](_0xd236('0x8c'));_0x135cfc[_0xd236('0x40')]('i.updatedAt');_0x135cfc[_0xd236('0x40')]('i.closed');_0x135cfc['field'](_0xd236('0x8d'));_0x135cfc[_0xd236('0x40')](_0xd236('0x8e'));_0x135cfc['field'](_0xd236('0x8f'));_0x135cfc[_0xd236('0x40')](_0xd236('0x90'));_0x135cfc[_0xd236('0x40')](_0xd236('0x91'));_0x135cfc[_0xd236('0x40')]('i.disposition');_0x135cfc[_0xd236('0x40')](_0xd236('0x92'));_0x135cfc[_0xd236('0x40')](_0xd236('0x93'));_0x135cfc['field'](_0xd236('0x94'));_0x135cfc[_0xd236('0x40')](_0xd236('0x95'));_0x135cfc[_0xd236('0x40')](_0xd236('0x96'));_0x135cfc['field'](_0xd236('0x97'));_0x135cfc[_0xd236('0x40')](_0xd236('0x98'));_0x135cfc['field'](_0xd236('0x99'),'Contact.firstName');_0x135cfc['field'](_0xd236('0x9a'),_0xd236('0x9b'));_0x135cfc[_0xd236('0x40')](_0xd236('0x9c'),_0xd236('0x9d'));_0x135cfc[_0xd236('0x40')]('c.phone',_0xd236('0x9e'));_0x135cfc[_0xd236('0x40')]('c.mobile',_0xd236('0x9f'));_0x135cfc[_0xd236('0x40')]('c.fax',_0xd236('0xa0'));_0x135cfc[_0xd236('0x40')](_0xd236('0xa1'),'Owner.fullname');_0x135cfc[_0xd236('0x40')](_0xd236('0xa2'),_0xd236('0xa3'));_0x135cfc[_0xd236('0x40')](_0xd236('0xa4'),_0xd236('0x20'));}if(_0x222495[_0xd236('0x16')])_0x135cfc[_0xd236('0x16')](_0x222495[_0xd236('0x16')]);if(_0x222495['offset'])_0x135cfc[_0xd236('0x14')](_0x222495[_0xd236('0x14')]);return db[_0xd236('0x84')][_0xd236('0x37')](_0x135cfc[_0xd236('0x85')](),_0x26f817);})[_0xd236('0x1a')](function(_0x491807){if(_0x491807[_0xd236('0x54')]>0x0)_0x208548[_0xd236('0x3e')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x491807,'id'));return db[_0xd236('0x84')]['query'](_0x208548[_0xd236('0x85')](),_0x26f817)['then'](function(_0x45d366){var _0x1d9e32=_[_0xd236('0xa5')](_0x45d366,'MailInteractionId');var _0x5bb55c=[];return db[_0xd236('0xa6')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0xd236('0x1a')](function(_0x5680a3){var _0x530560=_0x5680a3['enableEmailPreview'];_0x491807[_0xd236('0x23')](function(_0xa3995f){_0x5bb55c['push'](updateMailInteraction(_0xa3995f,_0x43ba74,_0x1d9e32,_0x530560));});return BPromise['all'](_0x5bb55c);});});});})[_0xd236('0x1a')](function(_0x175b35){_0x35b950[_0xd236('0xa7')]=_0x175b35;return _0x35b950;})[_0xd236('0x1a')](respondWithFilteredResult(_0x3c74f1,_0x222495))[_0xd236('0x2b')](handleError(_0x3c74f1,null));};exports[_0xd236('0xa8')]=function(_0x36697b,_0x4710d8){var _0x399309={'raw':![],'where':{'id':_0x36697b['params']['id']}},_0x3889a3={};_0x3889a3[_0xd236('0x36')]=_[_0xd236('0x38')](db[_0xd236('0x86')][_0xd236('0x34')]);_0x3889a3[_0xd236('0x37')]=_[_0xd236('0x38')](_0x36697b[_0xd236('0x37')]);_0x3889a3['filters']=_[_0xd236('0x39')](_0x3889a3[_0xd236('0x36')],_0x3889a3['query']);_0x399309[_0xd236('0x3a')]=_[_0xd236('0x39')](_0x3889a3[_0xd236('0x36')],qs[_0xd236('0xa9')](_0x36697b[_0xd236('0x37')][_0xd236('0xa9')]));_0x399309[_0xd236('0x3a')]=_0x399309[_0xd236('0x3a')][_0xd236('0x54')]?_0x399309[_0xd236('0x3a')]:_0x3889a3[_0xd236('0x36')];if(_0x36697b[_0xd236('0x37')][_0xd236('0xaa')]){_0x399309[_0xd236('0xab')]=[{'all':!![]}];}_0x399309=_[_0xd236('0xac')]({},_0x399309,_0x36697b['options']);return db[_0xd236('0x86')][_0xd236('0x5d')](_0x399309)[_0xd236('0x1a')](handleEntityNotFound(_0x4710d8,null))[_0xd236('0x1a')](respondWithResult(_0x4710d8,null))[_0xd236('0x2b')](handleError(_0x4710d8,null));};exports[_0xd236('0xad')]=function(_0x2577d0,_0x3e9162){return db[_0xd236('0x86')][_0xd236('0xad')](_0x2577d0['body'],{})['then'](respondWithResult(_0x3e9162,0xc9))[_0xd236('0x2b')](handleError(_0x3e9162,null));};exports[_0xd236('0x19')]=function(_0x3c3e73,_0x3d0378){if(_0x3c3e73[_0xd236('0xae')]['id']){delete _0x3c3e73[_0xd236('0xae')]['id'];}return db[_0xd236('0x86')]['find']({'where':{'id':_0x3c3e73[_0xd236('0xaf')]['id']}})[_0xd236('0x1a')](handleEntityNotFound(_0x3d0378,null))['then'](saveUpdates(_0x3c3e73['body'],null))[_0xd236('0x1a')](respondWithResult(_0x3d0378,null))[_0xd236('0x2b')](handleError(_0x3d0378,null));};exports[_0xd236('0x1b')]=function(_0x592eae,_0x2c4598){return db['MailInteraction'][_0xd236('0x5d')]({'where':{'id':_0x592eae[_0xd236('0xaf')]['id']}})[_0xd236('0x1a')](handleEntityNotFound(_0x2c4598,null))[_0xd236('0x1a')](removeEntity(_0x2c4598,null))[_0xd236('0x2b')](handleError(_0x2c4598,null));};exports['describe']=function(_0x591378,_0x1f1fcb){return db[_0xd236('0x86')][_0xd236('0xb0')]()[_0xd236('0x1a')](respondWithResult(_0x1f1fcb,null))['catch'](handleError(_0x1f1fcb,null));};exports[_0xd236('0xb1')]=function(_0x192a5a,_0x1cb3c8){return db[_0xd236('0x25')][_0xd236('0x5d')]({'where':{'id':_0x192a5a[_0xd236('0xaf')]['id']}})[_0xd236('0x1a')](handleEntityNotFound(_0x1cb3c8,null))[_0xd236('0x1a')](function(_0x2748d9){if(_0x2748d9){return _0x2748d9[_0xd236('0xb1')](_0x192a5a[_0xd236('0xae')][_0xd236('0xb2')],_[_0xd236('0xb3')](_0x192a5a[_0xd236('0xae')],[_0xd236('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x1cb3c8,null))[_0xd236('0x2b')](handleError(_0x1cb3c8,null));};exports[_0xd236('0xb4')]=function(_0x5c2fbd,_0x2d0759){var _0x1d4aac={'raw':![],'where':{}};var _0x35db65={};var _0x5580aa={'count':0x0,'rows':[]};return db[_0xd236('0x86')]['findOne']({'where':{'id':_0x5c2fbd[_0xd236('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2d0759,null))[_0xd236('0x1a')](function(_0x275928){if(_0x275928){_0x35db65[_0xd236('0x36')]=_[_0xd236('0x38')](db[_0xd236('0x25')][_0xd236('0x34')]);_0x35db65[_0xd236('0x37')]=_['keys'](_0x5c2fbd['query']);_0x35db65[_0xd236('0xb5')]=_[_0xd236('0x39')](_0x35db65[_0xd236('0x36')],_0x35db65[_0xd236('0x37')]);_0x1d4aac[_0xd236('0x3a')]=_[_0xd236('0x39')](_0x35db65[_0xd236('0x36')],qs[_0xd236('0xa9')](_0x5c2fbd['query'][_0xd236('0xa9')]));_0x1d4aac[_0xd236('0x3a')]=_0x1d4aac[_0xd236('0x3a')][_0xd236('0x54')]?_0x1d4aac[_0xd236('0x3a')]:_0x35db65[_0xd236('0x36')];if(!_0x5c2fbd[_0xd236('0x37')][_0xd236('0x3b')]('nolimit')){_0x1d4aac['limit']=qs[_0xd236('0x16')](_0x5c2fbd[_0xd236('0x37')]['limit']);_0x1d4aac['offset']=qs['offset'](_0x5c2fbd[_0xd236('0x37')][_0xd236('0x14')]);}_0x1d4aac[_0xd236('0x7d')]=qs['sort'](_0x5c2fbd[_0xd236('0x37')]['sort']);_0x1d4aac[_0xd236('0x3e')]=qs[_0xd236('0xb5')](_[_0xd236('0xb6')](_0x5c2fbd['query'],_0x35db65[_0xd236('0xb5')]));_0x1d4aac['where'][_0xd236('0xb7')]=_0x275928['id'];if(_0x5c2fbd[_0xd236('0x37')][_0xd236('0x72')]){_0x1d4aac[_0xd236('0x3e')]=_[_0xd236('0xac')](_0x1d4aac[_0xd236('0x3e')],{'$or':_[_0xd236('0x1e')](_0x1d4aac['attributes'],function(_0x2ccb10){var _0x25d144={};_0x25d144[_0x2ccb10]={'$like':'%'+_0x5c2fbd[_0xd236('0x37')]['filter']+'%'};return _0x25d144;})});}if(_0x5c2fbd[_0xd236('0x37')]['$gte']){var _0x3ca52a=_0x5c2fbd[_0xd236('0x37')][_0xd236('0x6a')][_0xd236('0x22')](',');var _0x72c65b={};_0x72c65b[_0x3ca52a[0x0]]={'$gte':moment(_0x3ca52a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1d4aac[_0xd236('0x3e')]=_[_0xd236('0xac')](_0x1d4aac[_0xd236('0x3e')],_0x72c65b);}_0x1d4aac=_[_0xd236('0xac')]({},_0x1d4aac,_0x5c2fbd[_0xd236('0xb8')]);return db['MailMessage'][_0xd236('0x17')]({'where':_0x1d4aac[_0xd236('0x3e')]})['then'](function(_0x4a973e){_0x5580aa[_0xd236('0x17')]=_0x4a973e;if(_0x5c2fbd['query'][_0xd236('0xaa')]){_0x1d4aac[_0xd236('0xab')]=[{'all':!![]}];}return db[_0xd236('0x25')][_0xd236('0xb9')](_0x1d4aac);})[_0xd236('0x1a')](function(_0x517093){if(_0x5c2fbd[_0xd236('0x37')][_0xd236('0xba')]===_0xd236('0xbb')){for(var _0x49db9b=0x0;_0x49db9b<_0x517093[_0xd236('0x54')];_0x49db9b++){_0x517093[_0x49db9b][_0xd236('0xae')]=juice(_0x517093[_0x49db9b][_0xd236('0xae')]);}}_0x5580aa[_0xd236('0xa7')]=_0x517093;return _0x5580aa;});}})[_0xd236('0x1a')](respondWithFilteredResult(_0x2d0759,_0x1d4aac))[_0xd236('0x2b')](handleError(_0x2d0759,null));};exports[_0xd236('0xbc')]=function(_0x3d5640,_0x5675cd){return db[_0xd236('0x86')][_0xd236('0x5d')]({'where':{'id':_0x3d5640[_0xd236('0xaf')]['id']}})[_0xd236('0x1a')](handleEntityNotFound(_0x5675cd,null))[_0xd236('0x1a')](function(_0x417baf){if(_0x417baf){return _0x417baf[_0xd236('0xbd')](_0x3d5640['body']['ids'],_[_0xd236('0xb3')](_0x3d5640[_0xd236('0xae')],[_0xd236('0xb2'),'id'])||{})[_0xd236('0xbe')](function(){return db[_0xd236('0x62')]['findAll']({'attributes':['id',_0xd236('0x1c'),_0xd236('0x41')],'where':{'id':_0x3d5640[_0xd236('0xae')][_0xd236('0xb2')]}});})[_0xd236('0x1a')](function(_0x463d8e){socket[_0xd236('0xbf')]('mailInteractionTags:save',{'id':Number(_0x3d5640[_0xd236('0xaf')]['id']),'tags':_0x463d8e||[]});return{'id':Number(_0x3d5640[_0xd236('0xaf')]['id']),'tags':_0x463d8e||[]};});}})[_0xd236('0x1a')](respondWithResult(_0x5675cd,null))[_0xd236('0x2b')](handleError(_0x5675cd,null));};exports[_0xd236('0xc0')]=function(_0x79f609,_0x20186a){return db['MailInteraction'][_0xd236('0x5d')]({'where':{'id':_0x79f609[_0xd236('0xaf')]['id']}})[_0xd236('0x1a')](handleEntityNotFound(_0x20186a,null))[_0xd236('0x1a')](function(_0x4af2c5){if(_0x4af2c5){return _0x4af2c5['removeTags'](_0x79f609['query'][_0xd236('0xb2')]);}})[_0xd236('0x1a')](respondWithStatusCode(_0x20186a,null))['catch'](handleError(_0x20186a,null));};exports[_0xd236('0xc1')]=function(_0x7b1bf1,_0x3a48ca){var _0x3ff47e=moment()['unix']()['toString']();var _0x5575cd=path[_0xd236('0xc2')](config[_0xd236('0xc3')],_0xd236('0xc4'),_0xd236('0xc5'),'tmp');var _0xd4b52d=path['join'](config['root'],_0xd236('0xc4'),'files',_0xd236('0xc6'));var _0x463764=path['join'](_0x5575cd,_0x3ff47e);var _0x3f72ad=util['format']('transcript-%d-%s.zip',_0x7b1bf1[_0xd236('0xaf')]['id'],_0x3ff47e);var _0x922e0e=path[_0xd236('0xc2')](_0x5575cd,_0x3f72ad);var _0x4f4996=[];if(_0x7b1bf1['query'][_0xd236('0xc6')]){_0x4f4996[_0xd236('0x24')]({'model':db[_0xd236('0xc7')],'as':'Attachments','raw':!![]});}var _0x1a6e2f=[{'model':db[_0xd236('0x25')],'as':_0xd236('0xc8'),'attributes':['id',_0xd236('0xae'),_0xd236('0x42'),'to','cc','bcc',_0xd236('0xc9'),_0xd236('0xca')],'where':{'secret':![]},'order':qs[_0xd236('0x3d')]('id'),'include':_0x4f4996}];return db[_0xd236('0x86')][_0xd236('0x5d')]({'where':{'id':_0x7b1bf1['params']['id']},'include':_0x1a6e2f})[_0xd236('0x1a')](handleEntityNotFound(_0x3a48ca,null))[_0xd236('0x1a')](function(_0x586d6e){if(_0x586d6e&&_0x586d6e[_0xd236('0xc8')]){var _0x5beaee=_0x586d6e[_0xd236('0xcb')]({'plain':!![]});fs[_0xd236('0xcc')](_0x463764);return BPromise[_0xd236('0xcd')](_0x5beaee['Messages'],function(_0x16f7cb,_0x3c1ff1){var _0xa831ea={'from':_0x16f7cb['from'],'to':_0x16f7cb['to'],'subject':_0x16f7cb[_0xd236('0xc9')],'html':htmlEntities[_0xd236('0xce')](_0x16f7cb[_0xd236('0xae')]),'headers':{'Date':moment(_0x16f7cb[_0xd236('0xca')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x16f7cb['cc']){_0xa831ea[_0xd236('0xcf')]['Cc']=_0x16f7cb['cc'];}if(_0x16f7cb[_0xd236('0xd0')]){_0xa831ea[_0xd236('0xcf')]['Bcc']=_0x16f7cb[_0xd236('0xd0')];}return new BPromise(function(_0x22ace9,_0x2c49f7){if(_0x16f7cb[_0xd236('0xd1')]){for(var _0x51f67e=0x0;_0x51f67e<_0x16f7cb[_0xd236('0xd1')]['length'];_0x51f67e++){var _0x3d7dc0=_0x16f7cb[_0xd236('0xd1')][_0x51f67e];var _0x1bfb28=path[_0xd236('0xc2')](_0xd4b52d,_0x3d7dc0[_0xd236('0xd2')]);if(fs['existsSync'](_0x1bfb28)){_0xa831ea[_0xd236('0xc6')][_0xd236('0x24')]({'name':_0x3d7dc0[_0xd236('0x1c')],'contentType':_0x3d7dc0['type'],'data':fs[_0xd236('0xd3')](_0x1bfb28)});}}}emlformat[_0xd236('0xd4')](_0xa831ea,function(_0x260a1d,_0x14692a){if(_0x260a1d)return _0x2c49f7(_0x260a1d);fs[_0xd236('0xd5')](path[_0xd236('0xc2')](_0x463764,util[_0xd236('0xd6')](_0xd236('0xd7'),_0x3c1ff1)),_0x14692a);return _0x22ace9(_0x14692a);});});})[_0xd236('0x1a')](function(){return new BPromise(function(_0x8caef1,_0x247f4a){zipdir(_0x463764,{'saveTo':_0x922e0e},function(_0x4d3958,_0x11045c){if(_0x4d3958)return _0x247f4a(_0x4d3958);return _0x8caef1(_0x11045c);});})['then'](function(){return new BPromise(function(_0x8e697f,_0x40360f){rimraf(_0x463764,function(_0x464e3b){if(_0x464e3b)_0x40360f(_0x464e3b);return _0x8e697f();});});})[_0xd236('0x1a')](function(){return _0x3a48ca['download'](_0x922e0e,_0x3f72ad,function(_0x5d8108){if(!_0x5d8108)fs[_0xd236('0xd8')](_0x922e0e);});});});}else{return _0x3a48ca[_0xd236('0x10')](0xc8);}})[_0xd236('0x2b')](handleError(_0x3a48ca,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 31be30c..3702452 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 _0xdc45=['hook','MailInteraction','../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0xdc45,0xc1));var _0x5dc4=function(_0x4e19ec,_0x5aa2c8){_0x4e19ec=_0x4e19ec-0x0;var _0x1bf0ab=_0xdc45[_0x4e19ec];return _0x1bf0ab;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x5dc4('0x0')];var MailMessage=require(_0x5dc4('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5dc4('0x2')](0x0);var events={'afterCreate':_0x5dc4('0x3'),'afterUpdate':'update','afterDestroy':_0x5dc4('0x4')};function emitEvent(_0x11aac8){return function(_0x5e4d0b,_0x36107e,_0xf91e69){_0x5e4d0b[_0x5dc4('0x5')]({'attributes':['id'],'raw':!![]})[_0x5dc4('0x6')](function(_0x3b5ef0){_0x5e4d0b[_0x5dc4('0x7')](_0x5dc4('0x8'),_0x3b5ef0[_0x5dc4('0x9')](function(_0x65bbb5){return{'id':_0x65bbb5['id']};}));return MailMessage[_0x5dc4('0xa')]({'where':{'MailInteractionId':_0x5e4d0b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5edc9d){_0x5e4d0b['setDataValue']('unreadMessages',_0x5edc9d[_0x5dc4('0xb')]);MailInteractionEvents[_0x5dc4('0xc')](_0x11aac8+':'+_0x5e4d0b['id'],_0x5e4d0b);MailInteractionEvents['emit'](_0x11aac8,_0x5e4d0b);_0xf91e69(null);})[_0x5dc4('0xd')](_0xf91e69(null));};}for(var e in events){if(events[_0x5dc4('0xe')](e)){var event=events[e];MailInteraction[_0x5dc4('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x971f=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','catch'];(function(_0x53d8c1,_0xc0e94a){var _0x351e4a=function(_0x1abe09){while(--_0x1abe09){_0x53d8c1['push'](_0x53d8c1['shift']());}};_0x351e4a(++_0xc0e94a);}(_0x971f,0xf3));var _0xf971=function(_0x28d508,_0x5bc1e7){_0x28d508=_0x28d508-0x0;var _0x3d6f24=_0x971f[_0x28d508];return _0x3d6f24;};'use strict';var EventEmitter=require(_0xf971('0x0'));var MailInteraction=require(_0xf971('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xf971('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf971('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf971('0x4')};function emitEvent(_0xad4f3a){return function(_0x336144,_0x48a6c7,_0x3c3b9f){_0x336144[_0xf971('0x5')]({'attributes':['id'],'raw':!![]})[_0xf971('0x6')](function(_0x4acbdd){_0x336144[_0xf971('0x7')](_0xf971('0x8'),_0x4acbdd['map'](function(_0x1efe94){return{'id':_0x1efe94['id']};}));return MailMessage[_0xf971('0x9')]({'where':{'MailInteractionId':_0x336144['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf971('0x6')](function(_0x175831){_0x336144[_0xf971('0x7')](_0xf971('0xa'),_0x175831[_0xf971('0xb')]);MailInteractionEvents['emit'](_0xad4f3a+':'+_0x336144['id'],_0x336144);MailInteractionEvents['emit'](_0xad4f3a,_0x336144);_0x3c3b9f(null);})[_0xf971('0xc')](_0x3c3b9f(null));};}for(var e in events){if(events[_0xf971('0xd')](e)){var event=events[e];MailInteraction[_0xf971('0xe')](e,emitEvent(event));}}module[_0xf971('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b316d39..760419b 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 _0x9b07=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','models','closed','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0x9b07,0x15f));var _0x79b0=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9b07[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x79b0('0x0'));var util=require(_0x79b0('0x1'));var logger=require(_0x79b0('0x2'))(_0x79b0('0x3'));var moment=require(_0x79b0('0x4'));var BPromise=require(_0x79b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79b0('0x6'));var rimraf=require('rimraf');var config=require(_0x79b0('0x7'));var attributes=require(_0x79b0('0x8'));module['exports']=function(_0x2284ab,_0x53e5a4){return _0x2284ab['define'](_0x79b0('0x9'),attributes,{'tableName':_0x79b0('0xa'),'paranoid':![],'indexes':[{'name':_0x79b0('0xb'),'fields':[_0x79b0('0xc'),'to'],'type':_0x79b0('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x647baf,_0x2b14dc,_0x2fe5ad){if(_0x647baf[_0x79b0('0xe')]){_0x647baf[_0x79b0('0xf')]=moment()[_0x79b0('0x10')](_0x79b0('0x11'));}if(_0x647baf['closed']){_0x647baf[_0x79b0('0x12')]=moment()['format'](_0x79b0('0x11'));}_0x2fe5ad(null,_0x2b14dc);},'beforeUpdate':function(_0x531a75,_0x4d28d7,_0x37bb8f){if(_0x531a75[_0x79b0('0x13')](_0x79b0('0xe'))){_0x531a75['substatusAt']=_0x531a75[_0x79b0('0xe')]?moment()[_0x79b0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x531a75[_0x79b0('0x13')]('closed')){_0x531a75[_0x79b0('0x12')]=moment()[_0x79b0('0x10')](_0x79b0('0x11'));_0x531a75[_0x79b0('0xe')]=null;_0x531a75[_0x79b0('0xf')]=null;}_0x37bb8f(null,_0x531a75);},'afterUpdate':function(_0x1d5718,_0x25169e,_0x10cf25){var _0x544ea0=_0x2284ab[_0x79b0('0x14')];var _0x2cb9f1=_0x1d5718['get']({'plain':!![]});if(_0x2cb9f1[_0x79b0('0x15')]){return _0x544ea0[_0x79b0('0x16')][_0x79b0('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x2cb9f1['id']}})[_0x79b0('0x18')](function(){_0x10cf25();})[_0x79b0('0x19')](function(_0x54b5d1){_0x10cf25(_0x54b5d1);});}else{_0x10cf25();}}},'charset':'utf8mb4','collate':_0x79b0('0x1a')});}; \ No newline at end of file +var _0x79b5=['substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT'];(function(_0x3f4bcb,_0x30ab38){var _0x31ff0c=function(_0x1cc868){while(--_0x1cc868){_0x3f4bcb['push'](_0x3f4bcb['shift']());}};_0x31ff0c(++_0x30ab38);}(_0x79b5,0xdb));var _0x579b=function(_0x5a4b2d,_0x3f21d5){_0x5a4b2d=_0x5a4b2d-0x0;var _0xbb7498=_0x79b5[_0x5a4b2d];return _0xbb7498;};'use strict';var _=require(_0x579b('0x0'));var util=require(_0x579b('0x1'));var logger=require('../../config/logger')(_0x579b('0x2'));var moment=require(_0x579b('0x3'));var BPromise=require('bluebird');var rp=require(_0x579b('0x4'));var fs=require('fs');var path=require(_0x579b('0x5'));var rimraf=require(_0x579b('0x6'));var config=require(_0x579b('0x7'));var attributes=require(_0x579b('0x8'));module[_0x579b('0x9')]=function(_0x2f5abf,_0x594fd6){return _0x2f5abf[_0x579b('0xa')](_0x579b('0xb'),attributes,{'tableName':_0x579b('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x579b('0xd'),'to'],'type':_0x579b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4607dc,_0x5dafc7,_0x1c47d0){if(_0x4607dc[_0x579b('0xf')]){_0x4607dc['substatusAt']=moment()[_0x579b('0x10')](_0x579b('0x11'));}if(_0x4607dc[_0x579b('0x12')]){_0x4607dc[_0x579b('0x13')]=moment()[_0x579b('0x10')](_0x579b('0x11'));}_0x1c47d0(null,_0x5dafc7);},'beforeUpdate':function(_0xf5e9d2,_0x1d99ad,_0x3ef555){if(_0xf5e9d2[_0x579b('0x14')]('substatus')){_0xf5e9d2['substatusAt']=_0xf5e9d2[_0x579b('0xf')]?moment()[_0x579b('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xf5e9d2[_0x579b('0x14')](_0x579b('0x12'))){_0xf5e9d2[_0x579b('0x13')]=moment()[_0x579b('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0xf5e9d2[_0x579b('0xf')]=null;_0xf5e9d2['substatusAt']=null;}_0x3ef555(null,_0xf5e9d2);},'afterUpdate':function(_0x2174f1,_0x36f352,_0x5ee5c8){var _0x3b7bc1=_0x2f5abf['models'];var _0x375f4d=_0x2174f1['get']({'plain':!![]});if(_0x375f4d[_0x579b('0x12')]){return _0x3b7bc1[_0x579b('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x375f4d['id']}})[_0x579b('0x16')](function(){_0x5ee5c8();})[_0x579b('0x17')](function(_0x3b9647){_0x5ee5c8(_0x3b9647);});}else{_0x5ee5c8();}}},'charset':_0x579b('0x18'),'collate':_0x579b('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ad15d71..149d5cf 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 _0x1396=['raw','where','attributes','limit','debug','AddTagsToMailInteraction','addTags','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x248d46,_0xba08ec){var _0x354942=function(_0x1b52a1){while(--_0x1b52a1){_0x248d46['push'](_0x248d46['shift']());}};_0x354942(++_0xba08ec);}(_0x1396,0x1ea));var _0x6139=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x1396[_0x5027b1];return _0x4a46cf;};'use strict';var _=require(_0x6139('0x0'));var util=require('util');var moment=require(_0x6139('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6139('0x2'));var db=require(_0x6139('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6139('0x4'))('rpc');var config=require(_0x6139('0x5'));var jayson=require(_0x6139('0x6'));var client=jayson[_0x6139('0x7')][_0x6139('0x8')]({'port':0x232a});config[_0x6139('0x9')]=_[_0x6139('0xa')](config[_0x6139('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6139('0xb'))(new Redis(config['redis']));require(_0x6139('0xc'))[_0x6139('0xd')](socket);function respondWithRpcPromise(_0x9a2eb7,_0x58dd96,_0x3878cc){return new BPromise(function(_0x163235,_0x34e658){return client[_0x6139('0xe')](_0x9a2eb7,_0x3878cc)[_0x6139('0xf')](function(_0x359ed2){logger[_0x6139('0x10')](_0x6139('0x11'),_0x58dd96,'request\x20sent');logger['debug'](_0x6139('0x12'),_0x58dd96,_0x6139('0x13'),JSON[_0x6139('0x14')](_0x359ed2));if(_0x359ed2[_0x6139('0x15')]){if(_0x359ed2['error'][_0x6139('0x16')]===0x1f4){logger[_0x6139('0x15')](_0x6139('0x11'),_0x58dd96,_0x359ed2[_0x6139('0x15')][_0x6139('0x17')]);return _0x34e658(_0x359ed2[_0x6139('0x15')][_0x6139('0x17')]);}logger[_0x6139('0x15')](_0x6139('0x11'),_0x58dd96,_0x359ed2[_0x6139('0x15')]['message']);return _0x163235(_0x359ed2[_0x6139('0x15')][_0x6139('0x17')]);}else{logger[_0x6139('0x10')]('MailInteraction,\x20%s,\x20%s',_0x58dd96,_0x6139('0x13'));_0x163235(_0x359ed2['result'][_0x6139('0x17')]);}})[_0x6139('0x18')](function(_0x27317f){logger[_0x6139('0x15')](_0x6139('0x11'),_0x58dd96,_0x27317f);_0x34e658(_0x27317f);});});}exports[_0x6139('0x19')]=function(_0x55eb11){var _0x4f0d14=this;return new Promise(function(_0x140fca,_0x59f23d){return db[_0x6139('0x1a')][_0x6139('0x1b')](_0x55eb11[_0x6139('0x1c')],{'raw':_0x55eb11[_0x6139('0x1d')]?_0x55eb11['options'][_0x6139('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55eb11[_0x6139('0x1d')]?_0x55eb11['options'][_0x6139('0x1f')]||null:null,'attributes':_0x55eb11[_0x6139('0x1d')]?_0x55eb11[_0x6139('0x1d')][_0x6139('0x20')]||null:null,'limit':_0x55eb11['options']?_0x55eb11[_0x6139('0x1d')][_0x6139('0x21')]||null:null})[_0x6139('0xf')](function(_0x44126c){logger[_0x6139('0x10')](_0x6139('0x19'),_0x55eb11);logger[_0x6139('0x22')]('UpdateMailInteraction',_0x55eb11,JSON['stringify'](_0x44126c));_0x140fca(_0x44126c);})[_0x6139('0x18')](function(_0x5a3242){logger[_0x6139('0x15')]('UpdateMailInteraction',_0x5a3242[_0x6139('0x17')],_0x55eb11);_0x59f23d(_0x4f0d14[_0x6139('0x15')](0x1f4,_0x5a3242[_0x6139('0x17')]));});});};exports[_0x6139('0x23')]=function(_0x2b8325){return new Promise(function(_0x371a1f,_0x1d3af6){return db['MailInteraction']['find']({'where':_0x2b8325[_0x6139('0x1d')]?_0x2b8325['options'][_0x6139('0x1f')]||null:null})[_0x6139('0xf')](function(_0x5e3d3a){if(_0x5e3d3a){return _0x5e3d3a[_0x6139('0x24')](_0x2b8325[_0x6139('0x1c')][_0x6139('0x25')],_['omit'](_0x2b8325[_0x6139('0x1c')],[_0x6139('0x25'),'id'])||{});}})[_0x6139('0x26')](function(_0x86740a){logger[_0x6139('0x10')](_0x6139('0x27'),_0x2b8325);logger[_0x6139('0x22')]('AddTags',_0x2b8325,JSON[_0x6139('0x14')](_0x86740a));_0x371a1f(_0x86740a);})[_0x6139('0x18')](function(_0x3eb8c9){logger['error'](_0x6139('0x27'),_0x3eb8c9['message'],_0x2b8325);_0x1d3af6(_this[_0x6139('0x15')](0x1f4,_0x3eb8c9[_0x6139('0x17')]));});});}; \ No newline at end of file +var _0xc11a=['request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','find','addTags','omit','ids','spread','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc11a,0x10b));var _0xac11=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xc11a[_0x11e05d];return _0x335588;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac11('0x0'));var BPromise=require(_0xac11('0x1'));var rs=require(_0xac11('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac11('0x3'));var logger=require('../../config/logger')(_0xac11('0x4'));var config=require(_0xac11('0x5'));var jayson=require(_0xac11('0x6'));var client=jayson['client'][_0xac11('0x7')]({'port':0x232a});config[_0xac11('0x8')]=_[_0xac11('0x9')](config[_0xac11('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xac11('0xa'))(new Redis(config[_0xac11('0x8')]));require(_0xac11('0xb'))[_0xac11('0xc')](socket);function respondWithRpcPromise(_0xaa6660,_0x542c74,_0x362cad){return new BPromise(function(_0x47f7bd,_0x2df67f){return client[_0xac11('0xd')](_0xaa6660,_0x362cad)[_0xac11('0xe')](function(_0x5b2470){logger[_0xac11('0xf')](_0xac11('0x10'),_0x542c74,'request\x20sent');logger[_0xac11('0x11')](_0xac11('0x12'),_0x542c74,_0xac11('0x13'),JSON[_0xac11('0x14')](_0x5b2470));if(_0x5b2470[_0xac11('0x15')]){if(_0x5b2470[_0xac11('0x15')][_0xac11('0x16')]===0x1f4){logger[_0xac11('0x15')](_0xac11('0x10'),_0x542c74,_0x5b2470[_0xac11('0x15')][_0xac11('0x17')]);return _0x2df67f(_0x5b2470[_0xac11('0x15')][_0xac11('0x17')]);}logger[_0xac11('0x15')](_0xac11('0x10'),_0x542c74,_0x5b2470[_0xac11('0x15')]['message']);return _0x47f7bd(_0x5b2470[_0xac11('0x15')][_0xac11('0x17')]);}else{logger['info'](_0xac11('0x10'),_0x542c74,_0xac11('0x13'));_0x47f7bd(_0x5b2470[_0xac11('0x18')][_0xac11('0x17')]);}})[_0xac11('0x19')](function(_0x5ad337){logger[_0xac11('0x15')](_0xac11('0x10'),_0x542c74,_0x5ad337);_0x2df67f(_0x5ad337);});});}exports[_0xac11('0x1a')]=function(_0x10254d){var _0xc3583f=this;return new Promise(function(_0x58b151,_0x4e9030){return db[_0xac11('0x1b')][_0xac11('0x1c')](_0x10254d[_0xac11('0x1d')],{'raw':_0x10254d[_0xac11('0x1e')]?_0x10254d['options'][_0xac11('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10254d['options']?_0x10254d[_0xac11('0x1e')][_0xac11('0x20')]||null:null,'attributes':_0x10254d[_0xac11('0x1e')]?_0x10254d[_0xac11('0x1e')][_0xac11('0x21')]||null:null,'limit':_0x10254d[_0xac11('0x1e')]?_0x10254d[_0xac11('0x1e')][_0xac11('0x22')]||null:null})[_0xac11('0xe')](function(_0x4e0553){logger[_0xac11('0xf')](_0xac11('0x1a'),_0x10254d);logger[_0xac11('0x11')]('UpdateMailInteraction',_0x10254d,JSON[_0xac11('0x14')](_0x4e0553));_0x58b151(_0x4e0553);})[_0xac11('0x19')](function(_0x21a81a){logger[_0xac11('0x15')]('UpdateMailInteraction',_0x21a81a[_0xac11('0x17')],_0x10254d);_0x4e9030(_0xc3583f[_0xac11('0x15')](0x1f4,_0x21a81a[_0xac11('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x3488e6){return new Promise(function(_0x25a475,_0x598401){return db[_0xac11('0x1b')][_0xac11('0x23')]({'where':_0x3488e6[_0xac11('0x1e')]?_0x3488e6[_0xac11('0x1e')][_0xac11('0x20')]||null:null})['then'](function(_0x299a11){if(_0x299a11){return _0x299a11[_0xac11('0x24')](_0x3488e6[_0xac11('0x1d')]['ids'],_[_0xac11('0x25')](_0x3488e6[_0xac11('0x1d')],[_0xac11('0x26'),'id'])||{});}})[_0xac11('0x27')](function(_0x1a8655){logger[_0xac11('0xf')]('AddTags',_0x3488e6);logger[_0xac11('0x11')]('AddTags',_0x3488e6,JSON[_0xac11('0x14')](_0x1a8655));_0x25a475(_0x1a8655);})['catch'](function(_0x29eda0){logger[_0xac11('0x15')]('AddTags',_0x29eda0[_0xac11('0x17')],_0x3488e6);_0x598401(_this['error'](0x1f4,_0x29eda0[_0xac11('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 926b840..e776e08 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 _0x7ae8=['./mailInteraction.events','save','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x3eeac7,_0x1b7053){var _0x16eec6=function(_0x25e76d){while(--_0x25e76d){_0x3eeac7['push'](_0x3eeac7['shift']());}};_0x16eec6(++_0x1b7053);}(_0x7ae8,0x88));var _0x87ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ae8[_0x20a584];return _0x4b41a8;};'use strict';var MailInteractionEvents=require(_0x87ae('0x0'));var events=[_0x87ae('0x1'),'remove',_0x87ae('0x2')];function createListener(_0x60fc79,_0x44a5f0){return function(_0x13cb96){_0x44a5f0[_0x87ae('0x3')](_0x60fc79,_0x13cb96);};}function removeListener(_0x62f25,_0x47f685){return function(){MailInteractionEvents[_0x87ae('0x4')](_0x62f25,_0x47f685);};}exports[_0x87ae('0x5')]=function(_0x41995a){for(var _0x407ff6=0x0,_0x1512f5=events[_0x87ae('0x6')];_0x407ff6<_0x1512f5;_0x407ff6++){var _0x272fda=events[_0x407ff6];var _0x9a2f6d=createListener(_0x87ae('0x7')+_0x272fda,_0x41995a);MailInteractionEvents['on'](_0x272fda,_0x9a2f6d);}}; \ No newline at end of file +var _0x2a8a=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x199196,_0x36a42d){var _0x259f56=function(_0x20896d){while(--_0x20896d){_0x199196['push'](_0x199196['shift']());}};_0x259f56(++_0x36a42d);}(_0x2a8a,0x10a));var _0xa2a8=function(_0x441f76,_0x59413a){_0x441f76=_0x441f76-0x0;var _0x184f89=_0x2a8a[_0x441f76];return _0x184f89;};'use strict';var MailInteractionEvents=require(_0xa2a8('0x0'));var events=[_0xa2a8('0x1'),_0xa2a8('0x2'),_0xa2a8('0x3')];function createListener(_0x545c4f,_0x52decd){return function(_0x24f212){_0x52decd[_0xa2a8('0x4')](_0x545c4f,_0x24f212);};}function removeListener(_0x1cc17a,_0x365838){return function(){MailInteractionEvents[_0xa2a8('0x5')](_0x1cc17a,_0x365838);};}exports['register']=function(_0x40486b){for(var _0x19d970=0x0,_0x4cd0a9=events[_0xa2a8('0x6')];_0x19d970<_0x4cd0a9;_0x19d970++){var _0x27b821=events[_0x19d970];var _0x4f06b0=createListener(_0xa2a8('0x7')+_0x27b821,_0x40486b);MailInteractionEvents['on'](_0x27b821,_0x4f06b0);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6533da2..34ac9c5 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 _0xe356=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','mailmessage:create','create','put','update','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5f2faf,_0x2d3480){var _0xa2551=function(_0x3d3c6d){while(--_0x3d3c6d){_0x5f2faf['push'](_0x5f2faf['shift']());}};_0xa2551(++_0x2d3480);}(_0xe356,0x1ee));var _0x6e35=function(_0x4b109e,_0x40be63){_0x4b109e=_0x4b109e-0x0;var _0x83c855=_0xe356[_0x4b109e];return _0x83c855;};'use strict';var multer=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var path=require(_0x6e35('0x2'));var timeout=require(_0x6e35('0x3'));var express=require('express');var router=express[_0x6e35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e35('0x5'));var interaction=require(_0x6e35('0x6'));var config=require(_0x6e35('0x7'));var controller=require('./mailMessage.controller');router[_0x6e35('0x8')]('/',auth[_0x6e35('0x9')](),controller['index']);router[_0x6e35('0x8')](_0x6e35('0xa'),auth[_0x6e35('0x9')](),controller[_0x6e35('0xb')]);router['get'](_0x6e35('0xc'),auth['isAuthenticated'](),controller[_0x6e35('0xd')]);router['get'](_0x6e35('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x6e35('0xf')]('/',auth[_0x6e35('0x9')](),interaction['tracked']('mail',_0x6e35('0x10')),controller[_0x6e35('0x11')]);router[_0x6e35('0x12')]('/:id',auth[_0x6e35('0x9')](),controller[_0x6e35('0x13')]);router[_0x6e35('0x12')]('/:id/accept',auth[_0x6e35('0x9')](),controller[_0x6e35('0x14')]);router[_0x6e35('0x12')]('/:id/reject',auth[_0x6e35('0x9')](),controller[_0x6e35('0x15')]);router[_0x6e35('0x16')]('/:id',auth[_0x6e35('0x9')](),controller[_0x6e35('0x17')]);module[_0x6e35('0x18')]=router; \ No newline at end of file +var _0x51f4=['mailmessage:create','create','update','/:id/accept','accept','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','mail'];(function(_0x4db6d7,_0x5f4e37){var _0x32ab94=function(_0x29d868){while(--_0x29d868){_0x4db6d7['push'](_0x4db6d7['shift']());}};_0x32ab94(++_0x5f4e37);}(_0x51f4,0x1c2));var _0x451f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51f4[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x451f('0x0'));var util=require(_0x451f('0x1'));var path=require(_0x451f('0x2'));var timeout=require('connect-timeout');var express=require(_0x451f('0x3'));var router=express[_0x451f('0x4')]();var fs_extra=require(_0x451f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x451f('0x6'));var config=require('../../config/environment');var controller=require(_0x451f('0x7'));router[_0x451f('0x8')]('/',auth[_0x451f('0x9')](),controller['index']);router[_0x451f('0x8')](_0x451f('0xa'),auth[_0x451f('0x9')](),controller['describe']);router[_0x451f('0x8')](_0x451f('0xb'),auth[_0x451f('0x9')](),controller[_0x451f('0xc')]);router['get'](_0x451f('0xd'),auth['isAuthenticated'](),controller[_0x451f('0xe')]);router[_0x451f('0xf')]('/',auth[_0x451f('0x9')](),interaction[_0x451f('0x10')](_0x451f('0x11'),_0x451f('0x12')),controller[_0x451f('0x13')]);router['put'](_0x451f('0xb'),auth[_0x451f('0x9')](),controller[_0x451f('0x14')]);router['put'](_0x451f('0x15'),auth[_0x451f('0x9')](),controller[_0x451f('0x16')]);router[_0x451f('0x17')]('/:id/reject',auth[_0x451f('0x9')](),controller['reject']);router[_0x451f('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x451f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d9dd9c4..e697b9c 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 _0x35c1=['Email','Chat','sequelize','lodash','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER'];(function(_0x2a6e5c,_0x28c1e1){var _0x2e1027=function(_0x2d818c){while(--_0x2d818c){_0x2a6e5c['push'](_0x2a6e5c['shift']());}};_0x2e1027(++_0x28c1e1);}(_0x35c1,0x113));var _0x135c=function(_0x2a7bf1,_0x2c1220){_0x2a7bf1=_0x2a7bf1-0x0;var _0x4d5458=_0x35c1[_0x2a7bf1];return _0x4d5458;};'use strict';var Sequelize=require(_0x135c('0x0'));var _=require(_0x135c('0x1'));module['exports']={'body':{'type':Sequelize[_0x135c('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x135c('0x3'))},'read':{'type':Sequelize[_0x135c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x135c('0x5')]('in',_0x135c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x135c('0x7')](0x1fe)},'from':{'type':Sequelize[_0x135c('0x7')]},'to':{'type':Sequelize[_0x135c('0x2')](_0x135c('0x8'))},'cc':{'type':Sequelize[_0x135c('0x2')](_0x135c('0x8'))},'bcc':{'type':Sequelize[_0x135c('0x2')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x135c('0x9')]},'attach':{'type':Sequelize[_0x135c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x135c('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x135c('0x8'))},'originCc':{'type':Sequelize[_0x135c('0x2')](_0x135c('0x8'))},'originChannel':{'type':Sequelize[_0x135c('0x5')](_0x135c('0xb'),_0x135c('0xc')),'defaultValue':_0x135c('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xf93d=['BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','exports','TEXT','long','medium'];(function(_0x330b1a,_0x3206ee){var _0x16b9c8=function(_0x33d1e6){while(--_0x33d1e6){_0x330b1a['push'](_0x330b1a['shift']());}};_0x16b9c8(++_0x3206ee);}(_0xf93d,0x1b8));var _0xdf93=function(_0x36b12e,_0x6118de){_0x36b12e=_0x36b12e-0x0;var _0x13a360=_0xf93d[_0x36b12e];return _0x13a360;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xdf93('0x0')]={'body':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x3'))},'read':{'type':Sequelize[_0xdf93('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdf93('0x5')]('in',_0xdf93('0x6')),'defaultValue':_0xdf93('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xdf93('0x7')]},'to':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x2'))},'cc':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x2'))},'bcc':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x2'))},'subject':{'type':Sequelize[_0xdf93('0x1')]},'sentAt':{'type':Sequelize[_0xdf93('0x8')]},'attach':{'type':Sequelize[_0xdf93('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdf93('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x2'))},'originCc':{'type':Sequelize[_0xdf93('0x1')](_0xdf93('0x2'))},'originChannel':{'type':Sequelize[_0xdf93('0x5')](_0xdf93('0xa'),_0xdf93('0xb')),'defaultValue':_0xdf93('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6e19249..85b079c 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 _0x9831=['rows','show','params','find','body','destroy','describe','create','out','secret','CmList','List','CmContact','DESC','MailServerOut','Smtp','service','host','port','secure','auth','user','pass','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','format','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','reject','fromString','download','unix','toString','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','html-entities','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','status','json','limit','undefined','count','offset','set','Content-Range','update','end','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x9831,0x100));var _0x1983=function(_0x30bc12,_0x14b2be){_0x30bc12=_0x30bc12-0x0;var _0x763896=_0x9831[_0x30bc12];return _0x763896;};'use strict';var emlformat=require(_0x1983('0x0'));var moment=require(_0x1983('0x1'));var BPromise=require('bluebird');var util=require(_0x1983('0x2'));var path=require(_0x1983('0x3'));var fs=require('fs');var _=require(_0x1983('0x4'));var Redis=require(_0x1983('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x1983('0x6'));var logger=require(_0x1983('0x7'))(_0x1983('0x8'));var interaction_log=require(_0x1983('0x7'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x1983('0x9'))['db'];config[_0x1983('0xa')]=_[_0x1983('0xb')](config[_0x1983('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1983('0xa')]));var htmlEntities=require(_0x1983('0xc'));require('./mailMessage.socket')[_0x1983('0xd')](socket);var jayson=require(_0x1983('0xe'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x1983('0xf')]['http']({'port':0x232b});var client9002=jayson['client'][_0x1983('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x497943,_0xf7cee8,_0x3b1173,_0x1f6191){return new BPromise(function(_0x5e9857,_0x3cfe44){var _0x11fcb7=_0x1f6191||client;return _0x11fcb7['request'](_0x497943,_0x3b1173)[_0x1983('0x11')](function(_0x3b3d94){logger[_0x1983('0x12')](_0x1983('0x13'),_0xf7cee8,'request\x20sent');logger['debug'](_0x1983('0x14'),_0xf7cee8,'request\x20sent',JSON[_0x1983('0x15')](_0x3b3d94));if(_0x3b3d94[_0x1983('0x16')]){if(_0x3b3d94['error']['code']===0x1f4){logger[_0x1983('0x16')]('MailMessage,\x20%s,\x20%s',_0xf7cee8,_0x3b3d94[_0x1983('0x16')][_0x1983('0x17')]);return _0x3cfe44(_0x3b3d94[_0x1983('0x16')][_0x1983('0x17')]);}logger[_0x1983('0x16')](_0x1983('0x13'),_0xf7cee8,_0x3b3d94[_0x1983('0x16')]['message']);return _0x5e9857(_0x3b3d94[_0x1983('0x16')]['message']);}else{logger[_0x1983('0x12')](_0x1983('0x13'),_0xf7cee8,_0x1983('0x18'));_0x5e9857(_0x3b3d94['result'][_0x1983('0x17')]);}})[_0x1983('0x19')](function(_0x2514cd){logger[_0x1983('0x16')](_0x1983('0x13'),_0xf7cee8,_0x2514cd);_0x3cfe44(_0x2514cd);});});}function respondWithResult(_0x1cfa17,_0x724b94){_0x724b94=_0x724b94||0xc8;return function(_0xd39ca3){if(_0xd39ca3){return _0x1cfa17[_0x1983('0x1a')](_0x724b94)[_0x1983('0x1b')](_0xd39ca3);}};}function respondWithFilteredResult(_0x5a8f58,_0x5b626b){return function(_0x5d18fa){if(_0x5d18fa){var _0x35a061=typeof _0x5b626b['offset']==='undefined'&&typeof _0x5b626b[_0x1983('0x1c')]===_0x1983('0x1d');var _0xcc6ada=_0x5d18fa[_0x1983('0x1e')];var _0x1b7521=_0x35a061?0x0:_0x5b626b[_0x1983('0x1f')];var _0x477db9=_0x35a061?_0x5d18fa[_0x1983('0x1e')]:_0x5b626b['offset']+_0x5b626b[_0x1983('0x1c')];var _0xec0cf3;if(_0x477db9>=_0xcc6ada){_0x477db9=_0xcc6ada;_0xec0cf3=0xc8;}else{_0xec0cf3=0xce;}_0x5a8f58[_0x1983('0x1a')](_0xec0cf3);return _0x5a8f58[_0x1983('0x20')](_0x1983('0x21'),_0x1b7521+'-'+_0x477db9+'/'+_0xcc6ada)[_0x1983('0x1b')](_0x5d18fa);}return null;};}function saveUpdates(_0x1bed09){return function(_0x2c3feb){if(_0x2c3feb){return _0x2c3feb[_0x1983('0x22')](_0x1bed09)[_0x1983('0x11')](function(_0x3bf812){return _0x3bf812;});}return null;};}function removeEntity(_0x290215){return function(_0x4c5e57){if(_0x4c5e57){return _0x4c5e57['destroy']()['then'](function(){_0x290215['status'](0xcc)[_0x1983('0x23')]();});}};}function handleEntityNotFound(_0x42c314){return function(_0xacf144){if(!_0xacf144){_0x42c314[_0x1983('0x24')](0x194);}return _0xacf144;};}function handleError(_0x481d57,_0x2c0e35){_0x2c0e35=_0x2c0e35||0x1f4;return function(_0x3f1d5a){logger[_0x1983('0x16')](_0x3f1d5a['stack']);if(_0x3f1d5a[_0x1983('0x25')]){delete _0x3f1d5a[_0x1983('0x25')];}_0x481d57[_0x1983('0x1a')](_0x2c0e35)[_0x1983('0x26')](_0x3f1d5a);};}exports['index']=function(_0x1eb22c,_0x526134){var _0x23b282={},_0x31ea2d={},_0x4b9047={'count':0x0,'rows':[]};var _0x275cc5=_[_0x1983('0x27')](db['MailMessage'][_0x1983('0x28')],function(_0xa80f37){return{'name':_0xa80f37[_0x1983('0x29')],'type':_0xa80f37[_0x1983('0x2a')][_0x1983('0x2b')]};});_0x31ea2d[_0x1983('0x2c')]=_[_0x1983('0x27')](_0x275cc5,_0x1983('0x25'));_0x31ea2d[_0x1983('0x2d')]=_[_0x1983('0x2e')](_0x1eb22c[_0x1983('0x2d')]);_0x31ea2d[_0x1983('0x2f')]=_[_0x1983('0x30')](_0x31ea2d['model'],_0x31ea2d['query']);_0x23b282[_0x1983('0x31')]=_['intersection'](_0x31ea2d['model'],qs[_0x1983('0x32')](_0x1eb22c[_0x1983('0x2d')][_0x1983('0x32')]));_0x23b282['attributes']=_0x23b282[_0x1983('0x31')][_0x1983('0x33')]?_0x23b282[_0x1983('0x31')]:_0x31ea2d[_0x1983('0x2c')];if(!_0x1eb22c[_0x1983('0x2d')][_0x1983('0x34')](_0x1983('0x35'))){_0x23b282[_0x1983('0x1c')]=qs['limit'](_0x1eb22c[_0x1983('0x2d')][_0x1983('0x1c')]);_0x23b282[_0x1983('0x1f')]=qs['offset'](_0x1eb22c[_0x1983('0x2d')][_0x1983('0x1f')]);}_0x23b282[_0x1983('0x36')]=qs[_0x1983('0x37')](_0x1eb22c[_0x1983('0x2d')][_0x1983('0x37')]);_0x23b282[_0x1983('0x38')]=qs[_0x1983('0x2f')](_[_0x1983('0x39')](_0x1eb22c[_0x1983('0x2d')],_0x31ea2d['filters']),_0x275cc5);if(_0x1eb22c[_0x1983('0x2d')][_0x1983('0x3a')]){_0x23b282['where']=_[_0x1983('0x3b')](_0x23b282[_0x1983('0x38')],{'$or':_['map'](_0x275cc5,function(_0x48cab1){if(_0x48cab1['type']!==_0x1983('0x3c')){var _0x36ab2d={};_0x36ab2d[_0x48cab1[_0x1983('0x25')]]={'$like':'%'+_0x1eb22c['query'][_0x1983('0x3a')]+'%'};return _0x36ab2d;}})});}_0x23b282=_['merge']({},_0x23b282,_0x1eb22c[_0x1983('0x3d')]);var _0x1b6793={'where':_0x23b282[_0x1983('0x38')]};return db[_0x1983('0x3e')][_0x1983('0x1e')](_0x1b6793)[_0x1983('0x11')](function(_0x389193){_0x4b9047[_0x1983('0x1e')]=_0x389193;if(_0x1eb22c[_0x1983('0x2d')][_0x1983('0x3f')]){_0x23b282[_0x1983('0x40')]=[{'all':!![]}];}return db[_0x1983('0x3e')][_0x1983('0x41')](_0x23b282);})[_0x1983('0x11')](function(_0x28d893){_0x4b9047[_0x1983('0x42')]=_0x28d893;return _0x4b9047;})[_0x1983('0x11')](respondWithFilteredResult(_0x526134,_0x23b282))[_0x1983('0x19')](handleError(_0x526134,null));};exports[_0x1983('0x43')]=function(_0x2bbc9e,_0x1dcfe4){var _0x1a20ec={'raw':!![],'where':{'id':_0x2bbc9e[_0x1983('0x44')]['id']}},_0x4f6ddb={};_0x4f6ddb[_0x1983('0x2c')]=_[_0x1983('0x2e')](db[_0x1983('0x3e')][_0x1983('0x28')]);_0x4f6ddb['query']=_[_0x1983('0x2e')](_0x2bbc9e['query']);_0x4f6ddb[_0x1983('0x2f')]=_[_0x1983('0x30')](_0x4f6ddb[_0x1983('0x2c')],_0x4f6ddb[_0x1983('0x2d')]);_0x1a20ec[_0x1983('0x31')]=_[_0x1983('0x30')](_0x4f6ddb[_0x1983('0x2c')],qs[_0x1983('0x32')](_0x2bbc9e[_0x1983('0x2d')][_0x1983('0x32')]));_0x1a20ec[_0x1983('0x31')]=_0x1a20ec[_0x1983('0x31')][_0x1983('0x33')]?_0x1a20ec[_0x1983('0x31')]:_0x4f6ddb[_0x1983('0x2c')];if(_0x2bbc9e[_0x1983('0x2d')]['includeAll']){_0x1a20ec[_0x1983('0x40')]=[{'all':!![]}];}_0x1a20ec=_['merge']({},_0x1a20ec,_0x2bbc9e['options']);return db[_0x1983('0x3e')][_0x1983('0x45')](_0x1a20ec)['then'](handleEntityNotFound(_0x1dcfe4,null))[_0x1983('0x11')](respondWithResult(_0x1dcfe4,null))[_0x1983('0x19')](handleError(_0x1dcfe4,null));};exports['update']=function(_0x4ea9b7,_0x3fc97a){if(_0x4ea9b7[_0x1983('0x46')]['id']){delete _0x4ea9b7[_0x1983('0x46')]['id'];}return db[_0x1983('0x3e')]['find']({'where':{'id':_0x4ea9b7[_0x1983('0x44')]['id']}})['then'](handleEntityNotFound(_0x3fc97a,null))[_0x1983('0x11')](saveUpdates(_0x4ea9b7[_0x1983('0x46')],null))[_0x1983('0x11')](respondWithResult(_0x3fc97a,null))[_0x1983('0x19')](handleError(_0x3fc97a,null));};exports[_0x1983('0x47')]=function(_0x2c1c8f,_0x453772){return db['MailMessage'][_0x1983('0x45')]({'where':{'id':_0x2c1c8f[_0x1983('0x44')]['id']}})[_0x1983('0x11')](handleEntityNotFound(_0x453772,null))['then'](removeEntity(_0x453772,null))[_0x1983('0x19')](handleError(_0x453772,null));};exports[_0x1983('0x48')]=function(_0x47fc97,_0xf99b62){return db[_0x1983('0x3e')][_0x1983('0x48')]()[_0x1983('0x11')](respondWithResult(_0xf99b62,null))[_0x1983('0x19')](handleError(_0xf99b62,null));};exports[_0x1983('0x49')]=function(_0x2feb4d,_0x209f85){return db[_0x1983('0x3e')][_0x1983('0x49')](_0x2feb4d[_0x1983('0x46')])[_0x1983('0x11')](function(_0x542908){if(_0x542908){if(_0x542908['direction']===_0x1983('0x4a')&&!_0x542908[_0x1983('0x4b')]){var _0x56e707,_0x5afd13,_0x1067a3;if(_0x2feb4d[_0x1983('0x46')]['to']){_0x5afd13=_0x2feb4d[_0x1983('0x46')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x542908['MailAccountId']},'include':[{'model':db[_0x1983('0x4c')],'as':_0x1983('0x4d'),'include':[{'model':db[_0x1983('0x4e')],'as':'Contacts','where':{'email':_0x5afd13},'limit':0x1,'order':[['updatedAt',_0x1983('0x4f')]]}]},{'model':db[_0x1983('0x50')],'as':'Smtp','raw':!![]}]})[_0x1983('0x11')](function(_0x397ed4){_0x56e707=_0x397ed4;if(_0x56e707&&_0x56e707['Smtp']){var _0x4b09de={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x56e707[_0x1983('0x51')][_0x1983('0x52')])){_0x4b09de[_0x1983('0x53')]=_0x56e707['Smtp'][_0x1983('0x53')];_0x4b09de[_0x1983('0x54')]=_0x56e707[_0x1983('0x51')][_0x1983('0x54')];_0x4b09de[_0x1983('0x55')]=_0x56e707['Smtp'][_0x1983('0x55')];if(_0x56e707[_0x1983('0x51')]['authentication']){_0x4b09de[_0x1983('0x56')]={'user':_0x56e707[_0x1983('0x51')][_0x1983('0x57')],'pass':_0x56e707[_0x1983('0x51')][_0x1983('0x58')]};}}else{_0x4b09de[_0x1983('0x52')]=_0x56e707[_0x1983('0x51')][_0x1983('0x52')];_0x4b09de['auth']={'user':_0x56e707[_0x1983('0x51')][_0x1983('0x57')],'pass':_0x56e707[_0x1983('0x51')][_0x1983('0x58')]};_0x4b09de[_0x1983('0x55')]=_0x56e707[_0x1983('0x51')][_0x1983('0x55')];}if(_0x2feb4d[_0x1983('0x46')]['attachments']&&_0x2feb4d[_0x1983('0x46')][_0x1983('0x59')][_0x1983('0x33')]){for(var _0x295cf7=0x0;_0x295cf7<_0x2feb4d[_0x1983('0x46')][_0x1983('0x59')][_0x1983('0x33')];_0x295cf7+=0x1){_0x2feb4d[_0x1983('0x46')][_0x1983('0x59')][_0x295cf7]={'filename':_0x2feb4d[_0x1983('0x46')][_0x1983('0x59')][_0x295cf7][_0x1983('0x25')],'path':path[_0x1983('0x5a')](config[_0x1983('0x5b')],_0x1983('0x5c'),_0x2feb4d[_0x1983('0x46')][_0x1983('0x59')][_0x295cf7][_0x1983('0x5d')])};}}_0x1067a3={'account':_0x4b09de,'message':_0x2feb4d[_0x1983('0x46')]};return;}})[_0x1983('0x11')](function(){if(_0x56e707['List']){if(_0x56e707[_0x1983('0x4d')][_0x1983('0x5e')][_0x1983('0x33')]){return _0x56e707[_0x1983('0x4d')]['Contacts'][0x0];}else{return db[_0x1983('0x4e')]['create'](_['defaults'](_0x2feb4d[_0x1983('0x46')],{'firstName':_0x2feb4d['body']['to'],'email':_0x2feb4d[_0x1983('0x46')]['to'],'phone':_0x2feb4d[_0x1983('0x46')]['to'],'ListId':_0x56e707[_0x1983('0x5f')]}));}}else{throw new Error(_0x1983('0x60'));}})[_0x1983('0x11')](function(){if(_0x1067a3){return respondWithRpcPromise(_0x1983('0x61'),_0x1983('0x62'),_0x1067a3,client9003)['then'](function(_0x3009a5){return _0x542908[_0x1983('0x22')]({'read':!![],'messageId':_0x3009a5[_0x1983('0x63')],'sentAt':moment()['format'](_0x1983('0x64'))});})[_0x1983('0x19')](function(_0x4ef23f){logger['error']('%s',JSON[_0x1983('0x15')](_0x4ef23f));return _0x542908;});}return _0x542908;});}return _0x542908;}})[_0x1983('0x11')](respondWithResult(_0x209f85,0xc9))[_0x1983('0x19')](handleError(_0x209f85,null));};exports[_0x1983('0x65')]=function(_0x24ae08,_0x593dc0){var _0x3c17d1={'agent':{},'channel':'mail'};if(_0x24ae08[_0x1983('0x46')]['id']){delete _0x24ae08['body']['id'];}_0x24ae08[_0x1983('0x46')][_0x1983('0x66')]=!![];_0x24ae08[_0x1983('0x46')][_0x1983('0x67')]=moment()[_0x1983('0x68')](_0x1983('0x64'));_0x24ae08['body'][_0x1983('0x69')]=_0x24ae08[_0x1983('0x46')][_0x1983('0x69')]||_0x24ae08['user']['id'];_0x3c17d1[_0x1983('0x6a')]['id']=_0x24ae08[_0x1983('0x46')][_0x1983('0x69')];return db[_0x1983('0x3e')][_0x1983('0x45')]({'where':{'id':_0x24ae08[_0x1983('0x44')]['id'],'UserId':null}})[_0x1983('0x11')](handleEntityNotFound(_0x593dc0,null))[_0x1983('0x11')](saveUpdates(_0x24ae08[_0x1983('0x46')],null))[_0x1983('0x11')](function(_0x35619a){if(_0x35619a){_0x3c17d1[_0x1983('0x17')]=_0x35619a[_0x1983('0x6b')]({'plain':!![]});return db[_0x1983('0x6c')][_0x1983('0x45')]({'where':{'id':_0x35619a[_0x1983('0x6d')]}});}return null;})[_0x1983('0x11')](handleEntityNotFound(_0x593dc0,null))[_0x1983('0x11')](function(_0x4bf161){if(_0x4bf161){return _0x4bf161[_0x1983('0x22')]({'UserId':_0x24ae08[_0x1983('0x46')][_0x1983('0x69')],'read1stAt':_[_0x1983('0x6e')](_0x4bf161[_0x1983('0x6f')])?moment()[_0x1983('0x68')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1983('0x11')](function(_0x4ba49b){if(_0x4ba49b){_0x3c17d1[_0x1983('0x70')]=_0x4ba49b[_0x1983('0x6b')]({'plain':!![]});interaction_log[_0x1983('0x12')](_0x1983('0x71'),_0x24ae08['user']['id'],_0x24ae08[_0x1983('0x57')][_0x1983('0x25')],_0x24ae08[_0x1983('0x57')][_0x1983('0x72')],_0x3c17d1[_0x1983('0x70')]['id'],_0x24ae08[_0x1983('0x46')]?JSON[_0x1983('0x15')](_0x24ae08['body']):_0x1983('0x73'));return respondWithRpcPromise(_0x1983('0x74'),_0x1983('0x75'),_0x3c17d1);}return null;})[_0x1983('0x11')](function(_0x5c1ba5){var _0x116480='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c1ba5[_0x1983('0x17')]['ContactId'];return db[_0x1983('0x76')][_0x1983('0x2d')](_0x116480,{'type':db['Sequelize'][_0x1983('0x77')][_0x1983('0x78')],'raw':!![]})['then'](function(_0x5d461f){return _0x5d461f;});})[_0x1983('0x11')](function(_0x5281ef){if(_0x5281ef){_0x3c17d1[_0x1983('0x17')][_0x1983('0x79')]=_0x5281ef[0x0];if(!_0x24ae08['body'][_0x1983('0x69')])return;return db[_0x1983('0x7a')][_0x1983('0x45')]({'where':{'id':_0x24ae08[_0x1983('0x46')]['UserId'],'role':'agent'},'attributes':['id',_0x1983('0x25'),_0x1983('0x7b'),'email',_0x1983('0x7c')],'raw':!![]});}return null;})[_0x1983('0x11')](function(_0x1a7b41){if(!_0x1a7b41)return null;_0x3c17d1['message'][_0x1983('0x6a')]=_0x1a7b41;return _0x3c17d1;})[_0x1983('0x11')](function(_0x21f3a0){if(_0x21f3a0){if(_0x24ae08['body']['manual']){_0x3c17d1['message'][_0x1983('0x7d')]=util['format'](_0x1983('0x7e'),_0x24ae08[_0x1983('0x57')][_0x1983('0x25')]);_0x3c17d1['message'][_0x1983('0x7f')]=_0x3c17d1[_0x1983('0x7f')];_0x3c17d1[_0x1983('0x17')][_0x1983('0x80')]=_0x3c17d1[_0x1983('0x7f')];_0x3c17d1[_0x1983('0x17')][_0x1983('0x81')]=_0x1983('0x65');_0x3c17d1[_0x1983('0x17')][_0x1983('0x46')]=htmlToText['fromString'](_0x3c17d1['message'][_0x1983('0x46')]);return respondWithRpcPromise(_0x1983('0x82'),_0x1983('0x82'),{'event':_0x1983('0x83'),'message':_0x3c17d1[_0x1983('0x17')]},client9002)[_0x1983('0x11')](function(){return _0x3c17d1;});}return _0x3c17d1;}return null;})[_0x1983('0x11')](respondWithResult(_0x593dc0,null))[_0x1983('0x19')](handleError(_0x593dc0,null));};exports['reject']=function(_0x3e3e18,_0x432b30){var _0x2964a1={'agent':{},'channel':_0x1983('0x84')};if(_0x3e3e18[_0x1983('0x46')]['id']){delete _0x3e3e18[_0x1983('0x46')]['id'];}_0x3e3e18[_0x1983('0x46')]['UserId']=_0x3e3e18[_0x1983('0x46')][_0x1983('0x69')]||_0x3e3e18[_0x1983('0x57')]['id'];_0x2964a1[_0x1983('0x6a')]['id']=_0x3e3e18[_0x1983('0x46')][_0x1983('0x69')];return db[_0x1983('0x3e')]['find']({'where':{'id':_0x3e3e18[_0x1983('0x44')]['id'],'UserId':null}})[_0x1983('0x11')](handleEntityNotFound(_0x432b30,null))[_0x1983('0x11')](function(_0x5c96ad){if(_0x5c96ad){_0x2964a1[_0x1983('0x17')]=_0x5c96ad[_0x1983('0x6b')]({'plain':!![]});return db[_0x1983('0x6c')][_0x1983('0x45')]({'where':{'id':_0x5c96ad[_0x1983('0x6d')]}});}return null;})[_0x1983('0x11')](handleEntityNotFound(_0x432b30,null))[_0x1983('0x11')](function(_0x548195){if(_0x548195){_0x2964a1[_0x1983('0x70')]=_0x548195[_0x1983('0x6b')]({'plain':!![]});interaction_log[_0x1983('0x12')](_0x1983('0x85'),_0x3e3e18[_0x1983('0x57')]['id'],_0x3e3e18['user'][_0x1983('0x25')],_0x3e3e18[_0x1983('0x57')][_0x1983('0x72')],_0x2964a1['interaction']['id'],_0x3e3e18[_0x1983('0x46')]?JSON[_0x1983('0x15')](_0x3e3e18[_0x1983('0x46')]):_0x1983('0x73'));return respondWithRpcPromise(_0x1983('0x86'),_0x1983('0x87'),_0x2964a1);}return null;})['then'](function(_0x2f3afc){var _0x4c8f28=_0x1983('0x88')+_0x2f3afc[_0x1983('0x17')][_0x1983('0x89')];return db['sequelize'][_0x1983('0x2d')](_0x4c8f28,{'type':db[_0x1983('0x8a')]['QueryTypes']['SELECT'],'raw':!![]})[_0x1983('0x11')](function(_0x36495b){return _0x36495b;});})['then'](function(_0x5a9abb){if(_0x5a9abb){_0x2964a1[_0x1983('0x17')][_0x1983('0x79')]=_0x5a9abb[0x0];if(!_0x3e3e18['body']['UserId'])return;return db[_0x1983('0x7a')][_0x1983('0x45')]({'where':{'id':_0x3e3e18['body']['UserId'],'role':_0x1983('0x6a')},'attributes':['id',_0x1983('0x25'),'fullname','email',_0x1983('0x7c')],'raw':!![]});}return null;})[_0x1983('0x11')](function(_0x2b51cc){if(!_0x2b51cc)return null;_0x2964a1[_0x1983('0x17')][_0x1983('0x6a')]=_0x2b51cc;return _0x2964a1;})[_0x1983('0x11')](function(_0xe00bc1){if(_0xe00bc1){_0xe00bc1[_0x1983('0x17')][_0x1983('0x7d')]=util[_0x1983('0x68')]('SIP/%s',_0x3e3e18[_0x1983('0x57')][_0x1983('0x25')]);_0xe00bc1[_0x1983('0x17')][_0x1983('0x7f')]=_0x2964a1['channel'];_0xe00bc1['message'][_0x1983('0x80')]=_0x2964a1[_0x1983('0x7f')];_0xe00bc1[_0x1983('0x17')]['event']=_0x1983('0x8b');_0xe00bc1[_0x1983('0x17')][_0x1983('0x46')]=htmlToText[_0x1983('0x8c')](_0x2964a1[_0x1983('0x17')][_0x1983('0x46')]);respondWithRpcPromise(_0x1983('0x82'),_0x1983('0x82'),{'event':'rejectmessage','message':_0xe00bc1[_0x1983('0x17')]},client9002);return _0x2964a1;}return null;})[_0x1983('0x11')](respondWithResult(_0x432b30,null))[_0x1983('0x19')](handleError(_0x432b30,null));};exports[_0x1983('0x8d')]=function(_0x3a28d3,_0x1debe4){var _0x25b5e0=moment()[_0x1983('0x8e')]()[_0x1983('0x8f')]();var _0x1f39d3=path['join'](config[_0x1983('0x5b')],_0x1983('0x90'),'files',_0x1983('0x91'));var _0x4385f1=path[_0x1983('0x5a')](config[_0x1983('0x5b')],_0x1983('0x90'),_0x1983('0x92'),_0x1983('0x59'));var _0x5a6cf7=util['format'](_0x1983('0x93'),_0x25b5e0);return db[_0x1983('0x3e')][_0x1983('0x45')]({'where':{'id':_0x3a28d3[_0x1983('0x44')]['id']},'attributes':['id',_0x1983('0x46'),_0x1983('0x94'),'to','cc',_0x1983('0x95'),'subject',_0x1983('0x96')],'include':_0x3a28d3[_0x1983('0x2d')][_0x1983('0x59')]?[{'model':db[_0x1983('0x97')],'as':_0x1983('0x98')}]:undefined})[_0x1983('0x11')](handleEntityNotFound(_0x1debe4,null))[_0x1983('0x11')](function(_0xf87cd0){if(_0xf87cd0){var _0x2a63b7=_0xf87cd0;var _0x2615ec={'from':_0x2a63b7['from'],'to':_0x2a63b7['to'],'subject':_0x2a63b7[_0x1983('0x99')],'html':htmlEntities[_0x1983('0x9a')](_0x2a63b7[_0x1983('0x46')]),'headers':{'Date':moment(_0x2a63b7['createdAt'])['format'](_0x1983('0x9b'))},'attachments':[]};if(_0xf87cd0['cc']){_0x2615ec[_0x1983('0x9c')]['Cc']=_0xf87cd0['cc'];}if(_0xf87cd0[_0x1983('0x95')]){_0x2615ec[_0x1983('0x9c')][_0x1983('0x9d')]=_0xf87cd0['bcc'];}return new BPromise(function(_0x17511c,_0x57f538){if(_0xf87cd0[_0x1983('0x98')]){for(var _0x11163d=0x0;_0x11163d<_0xf87cd0[_0x1983('0x98')]['length'];_0x11163d++){var _0x1ff805=_0xf87cd0[_0x1983('0x98')][_0x11163d];var _0x332079=path[_0x1983('0x5a')](_0x4385f1,_0x1ff805['basename']);if(fs['existsSync'](_0x332079)){_0x2615ec[_0x1983('0x59')][_0x1983('0x9e')]({'name':_0x1ff805[_0x1983('0x25')],'contentType':_0x1ff805[_0x1983('0x2a')],'data':fs['readFileSync'](_0x332079)});}}}emlformat['build'](_0x2615ec,function(_0xe3b8d,_0x3e529a){if(_0xe3b8d)return _0x57f538(_0xe3b8d);fs[_0x1983('0x9f')](path['join'](_0x1f39d3,_0x5a6cf7),_0x3e529a);return _0x17511c(_0x3e529a);});});}})[_0x1983('0x11')](function(_0x13df9e){if(_0x13df9e){return _0x1debe4[_0x1983('0x8d')](path[_0x1983('0x5a')](_0x1f39d3,_0x5a6cf7),_0x5a6cf7,function(_0x1117f0){if(!_0x1117f0)fs[_0x1983('0xa0')](path[_0x1983('0x5a')](_0x1f39d3,_0x5a6cf7));});}})[_0x1983('0x19')](handleError(_0x1debe4,null));}; \ No newline at end of file +var _0xd960=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','readFileSync','build','unlinkSync','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','html-entities','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','status','json','limit','undefined','count','offset','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','MailMessage','includeAll','include','rows','show','params','keys','intersection','fields','find','body','describe','create','out','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','user','pass','service','auth','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','MailInteractionId','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','download','unix','toString','server','files','tmp','root','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode'];(function(_0x36e28b,_0x304625){var _0x15d532=function(_0x373c0d){while(--_0x373c0d){_0x36e28b['push'](_0x36e28b['shift']());}};_0x15d532(++_0x304625);}(_0xd960,0x139));var _0x0d96=function(_0x498a84,_0x4875f0){_0x498a84=_0x498a84-0x0;var _0x4e6796=_0xd960[_0x498a84];return _0x4e6796;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x0d96('0x0'));var util=require(_0x0d96('0x1'));var path=require(_0x0d96('0x2'));var fs=require('fs');var _=require(_0x0d96('0x3'));var Redis=require(_0x0d96('0x4'));var htmlToText=require(_0x0d96('0x5'));var qs=require(_0x0d96('0x6'));var logger=require(_0x0d96('0x7'))('api');var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x0d96('0x8'));var db=require(_0x0d96('0x9'))['db'];config[_0x0d96('0xa')]=_['defaults'](config[_0x0d96('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d96('0xa')]));var htmlEntities=require(_0x0d96('0xb'));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x0d96('0xc'));var client=jayson[_0x0d96('0xd')][_0x0d96('0xe')]({'port':0x232c});var client9003=jayson[_0x0d96('0xd')][_0x0d96('0xe')]({'port':0x232b});var client9002=jayson[_0x0d96('0xd')][_0x0d96('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x1256fc,_0x27bd65,_0x2e7e54,_0x569451){return new BPromise(function(_0x75e444,_0x452451){var _0x34e417=_0x569451||client;return _0x34e417['request'](_0x1256fc,_0x2e7e54)[_0x0d96('0xf')](function(_0x34d9c2){logger[_0x0d96('0x10')](_0x0d96('0x11'),_0x27bd65,'request\x20sent');logger[_0x0d96('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x27bd65,_0x0d96('0x13'),JSON[_0x0d96('0x14')](_0x34d9c2));if(_0x34d9c2[_0x0d96('0x15')]){if(_0x34d9c2['error']['code']===0x1f4){logger[_0x0d96('0x15')]('MailMessage,\x20%s,\x20%s',_0x27bd65,_0x34d9c2['error']['message']);return _0x452451(_0x34d9c2[_0x0d96('0x15')][_0x0d96('0x16')]);}logger[_0x0d96('0x15')]('MailMessage,\x20%s,\x20%s',_0x27bd65,_0x34d9c2[_0x0d96('0x15')][_0x0d96('0x16')]);return _0x75e444(_0x34d9c2[_0x0d96('0x15')][_0x0d96('0x16')]);}else{logger[_0x0d96('0x10')](_0x0d96('0x11'),_0x27bd65,_0x0d96('0x13'));_0x75e444(_0x34d9c2['result'][_0x0d96('0x16')]);}})[_0x0d96('0x17')](function(_0x152fc1){logger[_0x0d96('0x15')](_0x0d96('0x11'),_0x27bd65,_0x152fc1);_0x452451(_0x152fc1);});});}function respondWithResult(_0x5c94e8,_0x398d5c){_0x398d5c=_0x398d5c||0xc8;return function(_0x28a665){if(_0x28a665){return _0x5c94e8[_0x0d96('0x18')](_0x398d5c)[_0x0d96('0x19')](_0x28a665);}};}function respondWithFilteredResult(_0x5985a3,_0x3b5edf){return function(_0xcc1d59){if(_0xcc1d59){var _0x1dba74=typeof _0x3b5edf['offset']==='undefined'&&typeof _0x3b5edf[_0x0d96('0x1a')]===_0x0d96('0x1b');var _0xd34c4=_0xcc1d59[_0x0d96('0x1c')];var _0x7c1663=_0x1dba74?0x0:_0x3b5edf['offset'];var _0x5bbf4c=_0x1dba74?_0xcc1d59[_0x0d96('0x1c')]:_0x3b5edf[_0x0d96('0x1d')]+_0x3b5edf['limit'];var _0x13d232;if(_0x5bbf4c>=_0xd34c4){_0x5bbf4c=_0xd34c4;_0x13d232=0xc8;}else{_0x13d232=0xce;}_0x5985a3[_0x0d96('0x18')](_0x13d232);return _0x5985a3['set'](_0x0d96('0x1e'),_0x7c1663+'-'+_0x5bbf4c+'/'+_0xd34c4)[_0x0d96('0x19')](_0xcc1d59);}return null;};}function saveUpdates(_0x366596){return function(_0x2b99e5){if(_0x2b99e5){return _0x2b99e5[_0x0d96('0x1f')](_0x366596)['then'](function(_0x7c9b1a){return _0x7c9b1a;});}return null;};}function removeEntity(_0x4ae09e){return function(_0x21cfb8){if(_0x21cfb8){return _0x21cfb8[_0x0d96('0x20')]()[_0x0d96('0xf')](function(){_0x4ae09e['status'](0xcc)[_0x0d96('0x21')]();});}};}function handleEntityNotFound(_0x20173d){return function(_0x5538d4){if(!_0x5538d4){_0x20173d[_0x0d96('0x22')](0x194);}return _0x5538d4;};}function handleError(_0x44bba7,_0x47898e){_0x47898e=_0x47898e||0x1f4;return function(_0x401d3d){logger['error'](_0x401d3d[_0x0d96('0x23')]);if(_0x401d3d['name']){delete _0x401d3d[_0x0d96('0x24')];}_0x44bba7[_0x0d96('0x18')](_0x47898e)[_0x0d96('0x25')](_0x401d3d);};}exports[_0x0d96('0x26')]=function(_0x27d1f9,_0x7ef479){var _0x2aa89e={},_0x3f75de={},_0x20fbe3={'count':0x0,'rows':[]};var _0x3f5d5a=_[_0x0d96('0x27')](db['MailMessage'][_0x0d96('0x28')],function(_0x2492f1){return{'name':_0x2492f1[_0x0d96('0x29')],'type':_0x2492f1[_0x0d96('0x2a')]['key']};});_0x3f75de['model']=_[_0x0d96('0x27')](_0x3f5d5a,_0x0d96('0x24'));_0x3f75de[_0x0d96('0x2b')]=_['keys'](_0x27d1f9[_0x0d96('0x2b')]);_0x3f75de[_0x0d96('0x2c')]=_['intersection'](_0x3f75de[_0x0d96('0x2d')],_0x3f75de[_0x0d96('0x2b')]);_0x2aa89e[_0x0d96('0x2e')]=_['intersection'](_0x3f75de[_0x0d96('0x2d')],qs['fields'](_0x27d1f9[_0x0d96('0x2b')]['fields']));_0x2aa89e[_0x0d96('0x2e')]=_0x2aa89e[_0x0d96('0x2e')][_0x0d96('0x2f')]?_0x2aa89e['attributes']:_0x3f75de['model'];if(!_0x27d1f9[_0x0d96('0x2b')]['hasOwnProperty'](_0x0d96('0x30'))){_0x2aa89e['limit']=qs[_0x0d96('0x1a')](_0x27d1f9[_0x0d96('0x2b')][_0x0d96('0x1a')]);_0x2aa89e[_0x0d96('0x1d')]=qs['offset'](_0x27d1f9[_0x0d96('0x2b')][_0x0d96('0x1d')]);}_0x2aa89e[_0x0d96('0x31')]=qs['sort'](_0x27d1f9[_0x0d96('0x2b')]['sort']);_0x2aa89e[_0x0d96('0x32')]=qs[_0x0d96('0x2c')](_[_0x0d96('0x33')](_0x27d1f9[_0x0d96('0x2b')],_0x3f75de[_0x0d96('0x2c')]),_0x3f5d5a);if(_0x27d1f9['query']['filter']){_0x2aa89e[_0x0d96('0x32')]=_[_0x0d96('0x34')](_0x2aa89e[_0x0d96('0x32')],{'$or':_[_0x0d96('0x27')](_0x3f5d5a,function(_0x56e603){if(_0x56e603[_0x0d96('0x2a')]!==_0x0d96('0x35')){var _0x1ecaec={};_0x1ecaec[_0x56e603[_0x0d96('0x24')]]={'$like':'%'+_0x27d1f9['query'][_0x0d96('0x36')]+'%'};return _0x1ecaec;}})});}_0x2aa89e=_[_0x0d96('0x34')]({},_0x2aa89e,_0x27d1f9[_0x0d96('0x37')]);var _0x15f77b={'where':_0x2aa89e[_0x0d96('0x32')]};return db[_0x0d96('0x38')][_0x0d96('0x1c')](_0x15f77b)[_0x0d96('0xf')](function(_0x3f1c99){_0x20fbe3[_0x0d96('0x1c')]=_0x3f1c99;if(_0x27d1f9[_0x0d96('0x2b')][_0x0d96('0x39')]){_0x2aa89e[_0x0d96('0x3a')]=[{'all':!![]}];}return db[_0x0d96('0x38')]['findAll'](_0x2aa89e);})[_0x0d96('0xf')](function(_0x5cb459){_0x20fbe3[_0x0d96('0x3b')]=_0x5cb459;return _0x20fbe3;})[_0x0d96('0xf')](respondWithFilteredResult(_0x7ef479,_0x2aa89e))[_0x0d96('0x17')](handleError(_0x7ef479,null));};exports[_0x0d96('0x3c')]=function(_0x6727d3,_0x5ca7f9){var _0x255cc3={'raw':!![],'where':{'id':_0x6727d3[_0x0d96('0x3d')]['id']}},_0x58c0ee={};_0x58c0ee[_0x0d96('0x2d')]=_[_0x0d96('0x3e')](db[_0x0d96('0x38')][_0x0d96('0x28')]);_0x58c0ee[_0x0d96('0x2b')]=_['keys'](_0x6727d3[_0x0d96('0x2b')]);_0x58c0ee[_0x0d96('0x2c')]=_['intersection'](_0x58c0ee['model'],_0x58c0ee['query']);_0x255cc3[_0x0d96('0x2e')]=_[_0x0d96('0x3f')](_0x58c0ee['model'],qs[_0x0d96('0x40')](_0x6727d3[_0x0d96('0x2b')][_0x0d96('0x40')]));_0x255cc3[_0x0d96('0x2e')]=_0x255cc3['attributes'][_0x0d96('0x2f')]?_0x255cc3[_0x0d96('0x2e')]:_0x58c0ee['model'];if(_0x6727d3[_0x0d96('0x2b')]['includeAll']){_0x255cc3[_0x0d96('0x3a')]=[{'all':!![]}];}_0x255cc3=_[_0x0d96('0x34')]({},_0x255cc3,_0x6727d3[_0x0d96('0x37')]);return db['MailMessage'][_0x0d96('0x41')](_0x255cc3)[_0x0d96('0xf')](handleEntityNotFound(_0x5ca7f9,null))[_0x0d96('0xf')](respondWithResult(_0x5ca7f9,null))[_0x0d96('0x17')](handleError(_0x5ca7f9,null));};exports['update']=function(_0x4209b3,_0x3ba2f6){if(_0x4209b3['body']['id']){delete _0x4209b3[_0x0d96('0x42')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4209b3[_0x0d96('0x3d')]['id']}})[_0x0d96('0xf')](handleEntityNotFound(_0x3ba2f6,null))['then'](saveUpdates(_0x4209b3[_0x0d96('0x42')],null))[_0x0d96('0xf')](respondWithResult(_0x3ba2f6,null))[_0x0d96('0x17')](handleError(_0x3ba2f6,null));};exports['destroy']=function(_0x5bc1fe,_0x42952f){return db['MailMessage'][_0x0d96('0x41')]({'where':{'id':_0x5bc1fe[_0x0d96('0x3d')]['id']}})[_0x0d96('0xf')](handleEntityNotFound(_0x42952f,null))[_0x0d96('0xf')](removeEntity(_0x42952f,null))[_0x0d96('0x17')](handleError(_0x42952f,null));};exports[_0x0d96('0x43')]=function(_0x338e3a,_0x131dbd){return db[_0x0d96('0x38')][_0x0d96('0x43')]()[_0x0d96('0xf')](respondWithResult(_0x131dbd,null))['catch'](handleError(_0x131dbd,null));};exports[_0x0d96('0x44')]=function(_0x5b2b76,_0x2d3d0e){return db[_0x0d96('0x38')][_0x0d96('0x44')](_0x5b2b76['body'])[_0x0d96('0xf')](function(_0x2dca5a){if(_0x2dca5a){if(_0x2dca5a['direction']===_0x0d96('0x45')&&!_0x2dca5a['secret']){var _0x43a1eb,_0x1cffb7,_0x133d8e;if(_0x5b2b76[_0x0d96('0x42')]['to']){_0x1cffb7=_0x5b2b76['body']['to'][_0x0d96('0x46')](',')[0x0];}return db[_0x0d96('0x47')]['findOne']({'where':{'id':_0x2dca5a[_0x0d96('0x48')]},'include':[{'model':db[_0x0d96('0x49')],'as':_0x0d96('0x4a'),'include':[{'model':db[_0x0d96('0x4b')],'as':'Contacts','where':{'email':_0x1cffb7},'limit':0x1,'order':[[_0x0d96('0x4c'),_0x0d96('0x4d')]]}]},{'model':db[_0x0d96('0x4e')],'as':'Smtp','raw':!![]}]})[_0x0d96('0xf')](function(_0x1a51c7){_0x43a1eb=_0x1a51c7;if(_0x43a1eb&&_0x43a1eb[_0x0d96('0x4f')]){var _0x3ab6ea={'tls':{'rejectUnauthorized':![]}};if(_[_0x0d96('0x50')](_0x43a1eb['Smtp']['service'])){_0x3ab6ea[_0x0d96('0x51')]=_0x43a1eb['Smtp'][_0x0d96('0x51')];_0x3ab6ea[_0x0d96('0x52')]=_0x43a1eb[_0x0d96('0x4f')][_0x0d96('0x52')];_0x3ab6ea[_0x0d96('0x53')]=_0x43a1eb[_0x0d96('0x4f')][_0x0d96('0x53')];if(_0x43a1eb[_0x0d96('0x4f')]['authentication']){_0x3ab6ea['auth']={'user':_0x43a1eb['Smtp'][_0x0d96('0x54')],'pass':_0x43a1eb[_0x0d96('0x4f')][_0x0d96('0x55')]};}}else{_0x3ab6ea[_0x0d96('0x56')]=_0x43a1eb[_0x0d96('0x4f')]['service'];_0x3ab6ea[_0x0d96('0x57')]={'user':_0x43a1eb[_0x0d96('0x4f')][_0x0d96('0x54')],'pass':_0x43a1eb[_0x0d96('0x4f')]['pass']};_0x3ab6ea[_0x0d96('0x53')]=_0x43a1eb['Smtp'][_0x0d96('0x53')];}if(_0x5b2b76[_0x0d96('0x42')][_0x0d96('0x58')]&&_0x5b2b76[_0x0d96('0x42')]['attachments']['length']){for(var _0x156cb3=0x0;_0x156cb3<_0x5b2b76[_0x0d96('0x42')][_0x0d96('0x58')]['length'];_0x156cb3+=0x1){_0x5b2b76[_0x0d96('0x42')][_0x0d96('0x58')][_0x156cb3]={'filename':_0x5b2b76[_0x0d96('0x42')][_0x0d96('0x58')][_0x156cb3]['name'],'path':path[_0x0d96('0x59')](config['root'],_0x0d96('0x5a'),_0x5b2b76[_0x0d96('0x42')]['attachments'][_0x156cb3][_0x0d96('0x5b')])};}}_0x133d8e={'account':_0x3ab6ea,'message':_0x5b2b76[_0x0d96('0x42')]};return;}})[_0x0d96('0xf')](function(){if(_0x43a1eb[_0x0d96('0x4a')]){if(_0x43a1eb[_0x0d96('0x4a')]['Contacts'][_0x0d96('0x2f')]){return _0x43a1eb['List']['Contacts'][0x0];}else{return db[_0x0d96('0x4b')][_0x0d96('0x44')](_[_0x0d96('0x5c')](_0x5b2b76[_0x0d96('0x42')],{'firstName':_0x5b2b76[_0x0d96('0x42')]['to'],'email':_0x5b2b76[_0x0d96('0x42')]['to'],'phone':_0x5b2b76['body']['to'],'ListId':_0x43a1eb[_0x0d96('0x5d')]}));}}else{throw new Error(_0x0d96('0x5e'));}})[_0x0d96('0xf')](function(){if(_0x133d8e){return respondWithRpcPromise('SendMail','sendMail',_0x133d8e,client9003)[_0x0d96('0xf')](function(_0x19b689){return _0x2dca5a[_0x0d96('0x1f')]({'read':!![],'messageId':_0x19b689['messageId'],'sentAt':moment()[_0x0d96('0x5f')](_0x0d96('0x60'))});})[_0x0d96('0x17')](function(_0x2f4be8){logger[_0x0d96('0x15')]('%s',JSON[_0x0d96('0x14')](_0x2f4be8));return _0x2dca5a;});}return _0x2dca5a;});}return _0x2dca5a;}})[_0x0d96('0xf')](respondWithResult(_0x2d3d0e,0xc9))[_0x0d96('0x17')](handleError(_0x2d3d0e,null));};exports['accept']=function(_0x156e8f,_0x14a42d){var _0x2da260={'agent':{},'channel':_0x0d96('0x61')};if(_0x156e8f['body']['id']){delete _0x156e8f[_0x0d96('0x42')]['id'];}_0x156e8f[_0x0d96('0x42')][_0x0d96('0x62')]=!![];_0x156e8f[_0x0d96('0x42')]['readAt']=moment()[_0x0d96('0x5f')](_0x0d96('0x60'));_0x156e8f[_0x0d96('0x42')][_0x0d96('0x63')]=_0x156e8f[_0x0d96('0x42')][_0x0d96('0x63')]||_0x156e8f[_0x0d96('0x54')]['id'];_0x2da260['agent']['id']=_0x156e8f['body']['UserId'];return db[_0x0d96('0x38')]['find']({'where':{'id':_0x156e8f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14a42d,null))['then'](saveUpdates(_0x156e8f[_0x0d96('0x42')],null))[_0x0d96('0xf')](function(_0x567376){if(_0x567376){_0x2da260[_0x0d96('0x16')]=_0x567376['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x567376[_0x0d96('0x64')]}});}return null;})[_0x0d96('0xf')](handleEntityNotFound(_0x14a42d,null))[_0x0d96('0xf')](function(_0x37cdf3){if(_0x37cdf3){return _0x37cdf3[_0x0d96('0x1f')]({'UserId':_0x156e8f[_0x0d96('0x42')][_0x0d96('0x63')],'read1stAt':_[_0x0d96('0x50')](_0x37cdf3['read1stAt'])?moment()[_0x0d96('0x5f')](_0x0d96('0x60')):undefined});}return null;})[_0x0d96('0xf')](function(_0x52d31a){if(_0x52d31a){_0x2da260[_0x0d96('0x65')]=_0x52d31a[_0x0d96('0x66')]({'plain':!![]});interaction_log['info'](_0x0d96('0x67'),_0x156e8f['user']['id'],_0x156e8f[_0x0d96('0x54')][_0x0d96('0x24')],_0x156e8f[_0x0d96('0x54')][_0x0d96('0x68')],_0x2da260[_0x0d96('0x65')]['id'],_0x156e8f[_0x0d96('0x42')]?JSON[_0x0d96('0x14')](_0x156e8f[_0x0d96('0x42')]):_0x0d96('0x69'));return respondWithRpcPromise(_0x0d96('0x6a'),_0x0d96('0x6b'),_0x2da260);}return null;})['then'](function(_0x23e9d9){var _0x47da6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x23e9d9[_0x0d96('0x16')][_0x0d96('0x6c')];return db[_0x0d96('0x6d')][_0x0d96('0x2b')](_0x47da6,{'type':db[_0x0d96('0x6e')][_0x0d96('0x6f')][_0x0d96('0x70')],'raw':!![]})[_0x0d96('0xf')](function(_0xc412dd){return _0xc412dd;});})['then'](function(_0x4d25b8){if(_0x4d25b8){_0x2da260[_0x0d96('0x16')][_0x0d96('0x71')]=_0x4d25b8[0x0];if(!_0x156e8f[_0x0d96('0x42')][_0x0d96('0x63')])return;return db['User'][_0x0d96('0x41')]({'where':{'id':_0x156e8f[_0x0d96('0x42')][_0x0d96('0x63')],'role':_0x0d96('0x72')},'attributes':['id','name',_0x0d96('0x73'),_0x0d96('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x59811c){if(!_0x59811c)return null;_0x2da260[_0x0d96('0x16')]['agent']=_0x59811c;return _0x2da260;})[_0x0d96('0xf')](function(_0x686bf3){if(_0x686bf3){if(_0x156e8f['body']['manual']){_0x2da260['message'][_0x0d96('0x75')]=util['format'](_0x0d96('0x76'),_0x156e8f[_0x0d96('0x54')][_0x0d96('0x24')]);_0x2da260['message']['channel']=_0x2da260[_0x0d96('0x77')];_0x2da260['message'][_0x0d96('0x78')]=_0x2da260[_0x0d96('0x77')];_0x2da260[_0x0d96('0x16')][_0x0d96('0x79')]=_0x0d96('0x7a');_0x2da260[_0x0d96('0x16')]['body']=htmlToText['fromString'](_0x2da260[_0x0d96('0x16')][_0x0d96('0x42')]);return respondWithRpcPromise(_0x0d96('0x7b'),_0x0d96('0x7b'),{'event':_0x0d96('0x7c'),'message':_0x2da260[_0x0d96('0x16')]},client9002)[_0x0d96('0xf')](function(){return _0x2da260;});}return _0x2da260;}return null;})[_0x0d96('0xf')](respondWithResult(_0x14a42d,null))['catch'](handleError(_0x14a42d,null));};exports[_0x0d96('0x7d')]=function(_0x14320e,_0x1d3426){var _0x5b3f50={'agent':{},'channel':_0x0d96('0x61')};if(_0x14320e[_0x0d96('0x42')]['id']){delete _0x14320e['body']['id'];}_0x14320e['body'][_0x0d96('0x63')]=_0x14320e[_0x0d96('0x42')][_0x0d96('0x63')]||_0x14320e[_0x0d96('0x54')]['id'];_0x5b3f50[_0x0d96('0x72')]['id']=_0x14320e['body'][_0x0d96('0x63')];return db['MailMessage'][_0x0d96('0x41')]({'where':{'id':_0x14320e['params']['id'],'UserId':null}})[_0x0d96('0xf')](handleEntityNotFound(_0x1d3426,null))[_0x0d96('0xf')](function(_0x15bcc3){if(_0x15bcc3){_0x5b3f50['message']=_0x15bcc3[_0x0d96('0x66')]({'plain':!![]});return db[_0x0d96('0x7e')][_0x0d96('0x41')]({'where':{'id':_0x15bcc3[_0x0d96('0x64')]}});}return null;})[_0x0d96('0xf')](handleEntityNotFound(_0x1d3426,null))[_0x0d96('0xf')](function(_0x461689){if(_0x461689){_0x5b3f50[_0x0d96('0x65')]=_0x461689[_0x0d96('0x66')]({'plain':!![]});interaction_log[_0x0d96('0x10')](_0x0d96('0x7f'),_0x14320e[_0x0d96('0x54')]['id'],_0x14320e[_0x0d96('0x54')]['name'],_0x14320e[_0x0d96('0x54')][_0x0d96('0x68')],_0x5b3f50['interaction']['id'],_0x14320e['body']?JSON[_0x0d96('0x14')](_0x14320e[_0x0d96('0x42')]):_0x0d96('0x69'));return respondWithRpcPromise(_0x0d96('0x80'),_0x0d96('0x81'),_0x5b3f50);}return null;})[_0x0d96('0xf')](function(_0x2431a5){var _0x4fe3b9=_0x0d96('0x82')+_0x2431a5['message'][_0x0d96('0x6c')];return db[_0x0d96('0x6d')]['query'](_0x4fe3b9,{'type':db[_0x0d96('0x6e')][_0x0d96('0x6f')][_0x0d96('0x70')],'raw':!![]})[_0x0d96('0xf')](function(_0x216a8b){return _0x216a8b;});})['then'](function(_0x354277){if(_0x354277){_0x5b3f50[_0x0d96('0x16')][_0x0d96('0x71')]=_0x354277[0x0];if(!_0x14320e['body'][_0x0d96('0x63')])return;return db['User'][_0x0d96('0x41')]({'where':{'id':_0x14320e[_0x0d96('0x42')]['UserId'],'role':'agent'},'attributes':['id',_0x0d96('0x24'),'fullname',_0x0d96('0x74'),'internal'],'raw':!![]});}return null;})[_0x0d96('0xf')](function(_0x1e83b8){if(!_0x1e83b8)return null;_0x5b3f50['message'][_0x0d96('0x72')]=_0x1e83b8;return _0x5b3f50;})[_0x0d96('0xf')](function(_0x4deeff){if(_0x4deeff){_0x4deeff[_0x0d96('0x16')][_0x0d96('0x75')]=util[_0x0d96('0x5f')](_0x0d96('0x76'),_0x14320e[_0x0d96('0x54')]['name']);_0x4deeff[_0x0d96('0x16')][_0x0d96('0x77')]=_0x5b3f50['channel'];_0x4deeff[_0x0d96('0x16')][_0x0d96('0x78')]=_0x5b3f50[_0x0d96('0x77')];_0x4deeff[_0x0d96('0x16')][_0x0d96('0x79')]=_0x0d96('0x7d');_0x4deeff[_0x0d96('0x16')][_0x0d96('0x42')]=htmlToText['fromString'](_0x5b3f50[_0x0d96('0x16')][_0x0d96('0x42')]);respondWithRpcPromise(_0x0d96('0x7b'),_0x0d96('0x7b'),{'event':_0x0d96('0x83'),'message':_0x4deeff['message']},client9002);return _0x5b3f50;}return null;})['then'](respondWithResult(_0x1d3426,null))['catch'](handleError(_0x1d3426,null));};exports[_0x0d96('0x84')]=function(_0x3523f2,_0x232559){var _0x46540a=moment()[_0x0d96('0x85')]()[_0x0d96('0x86')]();var _0x3d3756=path[_0x0d96('0x59')](config['root'],_0x0d96('0x87'),_0x0d96('0x88'),_0x0d96('0x89'));var _0x192f94=path['join'](config[_0x0d96('0x8a')],_0x0d96('0x87'),_0x0d96('0x88'),_0x0d96('0x58'));var _0x17b84c=util['format'](_0x0d96('0x8b'),_0x46540a);return db['MailMessage']['find']({'where':{'id':_0x3523f2['params']['id']},'attributes':['id',_0x0d96('0x42'),_0x0d96('0x8c'),'to','cc',_0x0d96('0x8d'),_0x0d96('0x8e'),_0x0d96('0x8f')],'include':_0x3523f2['query'][_0x0d96('0x58')]?[{'model':db[_0x0d96('0x90')],'as':'Attachments'}]:undefined})[_0x0d96('0xf')](handleEntityNotFound(_0x232559,null))[_0x0d96('0xf')](function(_0x2b5358){if(_0x2b5358){var _0x330af8=_0x2b5358;var _0x43b810={'from':_0x330af8[_0x0d96('0x8c')],'to':_0x330af8['to'],'subject':_0x330af8[_0x0d96('0x8e')],'html':htmlEntities[_0x0d96('0x91')](_0x330af8[_0x0d96('0x42')]),'headers':{'Date':moment(_0x330af8[_0x0d96('0x8f')])['format'](_0x0d96('0x92'))},'attachments':[]};if(_0x2b5358['cc']){_0x43b810[_0x0d96('0x93')]['Cc']=_0x2b5358['cc'];}if(_0x2b5358[_0x0d96('0x8d')]){_0x43b810[_0x0d96('0x93')][_0x0d96('0x94')]=_0x2b5358[_0x0d96('0x8d')];}return new BPromise(function(_0x52b1e7,_0x4d7e44){if(_0x2b5358[_0x0d96('0x95')]){for(var _0x48624b=0x0;_0x48624b<_0x2b5358['Attachments'][_0x0d96('0x2f')];_0x48624b++){var _0x8fcd2e=_0x2b5358['Attachments'][_0x48624b];var _0x55c546=path[_0x0d96('0x59')](_0x192f94,_0x8fcd2e[_0x0d96('0x5b')]);if(fs['existsSync'](_0x55c546)){_0x43b810[_0x0d96('0x58')]['push']({'name':_0x8fcd2e[_0x0d96('0x24')],'contentType':_0x8fcd2e[_0x0d96('0x2a')],'data':fs[_0x0d96('0x96')](_0x55c546)});}}}emlformat[_0x0d96('0x97')](_0x43b810,function(_0x2f638d,_0x1ea4d3){if(_0x2f638d)return _0x4d7e44(_0x2f638d);fs['writeFileSync'](path['join'](_0x3d3756,_0x17b84c),_0x1ea4d3);return _0x52b1e7(_0x1ea4d3);});});}})['then'](function(_0x17a9f0){if(_0x17a9f0){return _0x232559[_0x0d96('0x84')](path[_0x0d96('0x59')](_0x3d3756,_0x17b84c),_0x17b84c,function(_0x59b0c1){if(!_0x59b0c1)fs[_0x0d96('0x98')](path['join'](_0x3d3756,_0x17b84c));});}})['catch'](handleError(_0x232559,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 57de5b3..ea57368 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 _0xccfc=['hasOwnProperty','hook','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xccfc,0x1d6));var _0xcccf=function(_0x3e22db,_0x923bd5){_0x3e22db=_0x3e22db-0x0;var _0x9f4c07=_0xccfc[_0x3e22db];return _0x9f4c07;};'use strict';var EventEmitter=require(_0xcccf('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xcccf('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcccf('0x2')](0x0);var events={'afterCreate':_0xcccf('0x3'),'afterUpdate':_0xcccf('0x4'),'afterDestroy':_0xcccf('0x5')};function emitEvent(_0x5b4688){return function(_0x187d65,_0x595b52,_0x36bf6e){MailMessageEvents[_0xcccf('0x6')](_0x5b4688+':'+_0x187d65['id'],_0x187d65);MailMessageEvents[_0xcccf('0x6')](_0x5b4688,_0x187d65);_0x36bf6e(null);};}for(var e in events){if(events[_0xcccf('0x7')](e)){var event=events[e];MailMessage[_0xcccf('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x1617=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x230640,_0x3c7c76){var _0xa26e13=function(_0x40bc12){while(--_0x40bc12){_0x230640['push'](_0x230640['shift']());}};_0xa26e13(++_0x3c7c76);}(_0x1617,0x176));var _0x7161=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x1617[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0x7161('0x0'));var MailMessage=require(_0x7161('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7161('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7161('0x3'),'afterDestroy':_0x7161('0x4')};function emitEvent(_0x35eb32){return function(_0x536a4d,_0x4aa188,_0x28cf85){MailMessageEvents[_0x7161('0x5')](_0x35eb32+':'+_0x536a4d['id'],_0x536a4d);MailMessageEvents['emit'](_0x35eb32,_0x536a4d);_0x28cf85(null);};}for(var e in events){if(events[_0x7161('0x6')](e)){var event=events[e];MailMessage[_0x7161('0x7')](e,emitEvent(event));}}module[_0x7161('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index dccaf7a..ee6702b 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 _0xf84c=['moment','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','get','direction','secret','MailInteraction','MailInteractionId','then','toLowerCase','catch','error','utf8mb4_unicode_ci','lodash','util'];(function(_0x37bf43,_0x5b2339){var _0x4101c5=function(_0x382432){while(--_0x382432){_0x37bf43['push'](_0x37bf43['shift']());}};_0x4101c5(++_0x5b2339);}(_0xf84c,0x127));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf84('0x0'));var util=require(_0xcf84('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf84('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xcf84('0x3'));var rimraf=require('rimraf');var config=require(_0xcf84('0x4'));var attributes=require(_0xcf84('0x5'));module[_0xcf84('0x6')]=function(_0x1c2752,_0x581aa8){return _0x1c2752[_0xcf84('0x7')](_0xcf84('0x8'),attributes,{'tableName':_0xcf84('0x9'),'paranoid':![],'indexes':[{'name':_0xcf84('0xa'),'fields':[_0xcf84('0xa')]},{'name':_0xcf84('0xb'),'fields':['plainBody',_0xcf84('0xc')],'type':_0xcf84('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4bab3f,_0x4b0f7d,_0x2e9679){if(_0x4bab3f[_0xcf84('0xe')]){_0x4bab3f[_0xcf84('0xf')]=htmlToText[_0xcf84('0x10')](_0x4bab3f['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2e9679(null,_0x4b0f7d);},'afterCreate':function(_0x1761d6,_0x3cdfe5,_0x5797ff){var _0x65a1f7=_0x1c2752['models'];var _0x51d842=_0x1761d6[_0xcf84('0x11')]({'plain':!![]});if(_0x51d842[_0xcf84('0x12')]['toLowerCase']()==='in'||_0x51d842['direction']['toLowerCase']()==='out'&&!_0x51d842[_0xcf84('0x13')]&&!_['isNil'](_0x51d842['UserId'])){_0x65a1f7[_0xcf84('0x14')]['findOne']({'where':{'id':_0x51d842[_0xcf84('0x15')]}})[_0xcf84('0x16')](function(_0x27dc21){if(_0x27dc21){_0x27dc21['update']({'lastMsgAt':_0x51d842['createdAt'],'lastMsgDirection':_0x51d842[_0xcf84('0x12')][_0xcf84('0x17')]()});}})[_0xcf84('0x18')](function(_0x6c2123){console[_0xcf84('0x19')](_0x6c2123);});}_0x5797ff();}},'charset':'utf8mb4','collate':_0xcf84('0x1a')});}; \ No newline at end of file +var _0xea3a=['catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','direction','toLowerCase','out','UserId','MailInteraction','findOne','then','createdAt'];(function(_0x41e469,_0x4dbcef){var _0x2566bb=function(_0x3fd97b){while(--_0x3fd97b){_0x41e469['push'](_0x41e469['shift']());}};_0x2566bb(++_0x4dbcef);}(_0xea3a,0xeb));var _0xaea3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xea3a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xaea3('0x0'));var util=require(_0xaea3('0x1'));var logger=require(_0xaea3('0x2'))(_0xaea3('0x3'));var moment=require('moment');var BPromise=require(_0xaea3('0x4'));var rp=require(_0xaea3('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xaea3('0x6'));var rimraf=require('rimraf');var config=require(_0xaea3('0x7'));var attributes=require(_0xaea3('0x8'));module[_0xaea3('0x9')]=function(_0x3bc2b5,_0x3b7e20){return _0x3bc2b5[_0xaea3('0xa')](_0xaea3('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xaea3('0xc'),'fields':[_0xaea3('0xc')]},{'name':_0xaea3('0xd'),'fields':['plainBody','subject'],'type':_0xaea3('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39aa68,_0x1b4e72,_0x29889e){if(_0x39aa68[_0xaea3('0xf')]){_0x39aa68[_0xaea3('0x10')]=htmlToText[_0xaea3('0x11')](_0x39aa68['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x29889e(null,_0x1b4e72);},'afterCreate':function(_0x545f66,_0x42b8cc,_0x3893b6){var _0x10724b=_0x3bc2b5['models'];var _0x52861d=_0x545f66['get']({'plain':!![]});if(_0x52861d[_0xaea3('0x12')]['toLowerCase']()==='in'||_0x52861d[_0xaea3('0x12')][_0xaea3('0x13')]()===_0xaea3('0x14')&&!_0x52861d['secret']&&!_['isNil'](_0x52861d[_0xaea3('0x15')])){_0x10724b[_0xaea3('0x16')][_0xaea3('0x17')]({'where':{'id':_0x52861d['MailInteractionId']}})[_0xaea3('0x18')](function(_0x559eec){if(_0x559eec){_0x559eec['update']({'lastMsgAt':_0x52861d[_0xaea3('0x19')],'lastMsgDirection':_0x52861d[_0xaea3('0x12')]['toLowerCase']()});}})[_0xaea3('0x1a')](function(_0x1b086b){console[_0xaea3('0x1b')](_0x1b086b);});}_0x3893b6();}},'charset':'utf8mb4','collate':_0xaea3('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e51545a..bdaa5c4 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 _0xdd4f=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x50a0eb,_0x1e8d72){_0x50a0eb=_0x50a0eb-0x0;var _0x24642f=_0xdd4f[_0x50a0eb];return _0x24642f;};'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});config[_0xfdd4('0x9')]=_[_0xfdd4('0xa')](config['redis'],{'host':_0xfdd4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdd4('0x9')]));require(_0xfdd4('0xc'))[_0xfdd4('0xd')](socket);function respondWithRpcPromise(_0x4ee02f,_0x3d06c9,_0x4b4f1d){return new BPromise(function(_0x27a9f3,_0x3ce77a){return client[_0xfdd4('0xe')](_0x4ee02f,_0x4b4f1d)[_0xfdd4('0xf')](function(_0x35e22d){logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));logger[_0xfdd4('0x13')](_0xfdd4('0x14'),_0x3d06c9,_0xfdd4('0x12'),JSON['stringify'](_0x35e22d));if(_0x35e22d[_0xfdd4('0x15')]){if(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x16')]===0x1f4){logger['error'](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error'][_0xfdd4('0x17')]);return _0x3ce77a(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x17')]);}logger[_0xfdd4('0x15')](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error']['message']);return _0x27a9f3(_0x35e22d['error'][_0xfdd4('0x17')]);}else{logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));_0x27a9f3(_0x35e22d[_0xfdd4('0x18')][_0xfdd4('0x17')]);}})[_0xfdd4('0x19')](function(_0x2ffd5f){logger[_0xfdd4('0x15')]('MailMessage,\x20%s,\x20%s',_0x3d06c9,_0x2ffd5f);_0x3ce77a(_0x2ffd5f);});});}exports[_0xfdd4('0x1a')]=function(_0x3e8eac){var _0x2dc51c=this;return new Promise(function(_0x36e611,_0x1454f1){return db[_0xfdd4('0x1b')][_0xfdd4('0x1c')](_0x3e8eac[_0xfdd4('0x1d')],{'raw':_0x3e8eac['options']?_0x3e8eac[_0xfdd4('0x1e')][_0xfdd4('0x1f')]===undefined?!![]:![]:!![]})[_0xfdd4('0xf')](function(_0x16e81b){logger[_0xfdd4('0x10')](_0xfdd4('0x1a'),_0x3e8eac);logger[_0xfdd4('0x13')](_0xfdd4('0x1a'),_0x3e8eac,JSON['stringify'](_0x16e81b));_0x36e611(_0x16e81b);})[_0xfdd4('0x19')](function(_0x1112e8){logger[_0xfdd4('0x15')]('CreateMailMessage',_0x1112e8[_0xfdd4('0x17')],_0x3e8eac);_0x1454f1(_0x2dc51c[_0xfdd4('0x15')](0x1f4,_0x1112e8[_0xfdd4('0x17')]));});});}; \ No newline at end of file +var _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a8cc8,_0x1c9b17){var _0x4374ac=function(_0x22922f){while(--_0x22922f){_0x1a8cc8['push'](_0x1a8cc8['shift']());}};_0x4374ac(++_0x1c9b17);}(_0x5f2f,0x73));var _0xf5f2=function(_0x95ccb6,_0x50e816){_0x95ccb6=_0x95ccb6-0x0;var _0x2fbf1e=_0x5f2f[_0x95ccb6];return _0x2fbf1e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./mailMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateMailMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 47e8165..38af32b 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 _0x39cb=['length','save','remove','emit','removeListener','register'];(function(_0x4a02b2,_0x3d283d){var _0x136723=function(_0x108578){while(--_0x108578){_0x4a02b2['push'](_0x4a02b2['shift']());}};_0x136723(++_0x3d283d);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xb39c('0x0'),_0xb39c('0x1'),'update'];function createListener(_0x266bb4,_0x3aacb4){return function(_0x5bb582){_0x3aacb4[_0xb39c('0x2')](_0x266bb4,_0x5bb582);};}function removeListener(_0x285eca,_0x398d07){return function(){MailMessageEvents[_0xb39c('0x3')](_0x285eca,_0x398d07);};}exports[_0xb39c('0x4')]=function(_0x4ae4cf){for(var _0x32cdcd=0x0,_0x2fc868=events[_0xb39c('0x5')];_0x32cdcd<_0x2fc868;_0x32cdcd++){var _0x3f2fbe=events[_0x32cdcd];var _0x47d6d7=createListener('mailMessage:'+_0x3f2fbe,_0x4ae4cf);MailMessageEvents['on'](_0x3f2fbe,_0x47d6d7);}}; \ No newline at end of file +var _0x4c32=['register','length','mailMessage:','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x354761,_0x14a9de){var _0x1a0f62=function(_0x10ed35){while(--_0x10ed35){_0x354761['push'](_0x354761['shift']());}};_0x1a0f62(++_0x14a9de);}(_0x4c32,0x1d3));var _0x24c3=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x4c32[_0xabfec4];return _0x7bafa2;};'use strict';var MailMessageEvents=require(_0x24c3('0x0'));var events=[_0x24c3('0x1'),_0x24c3('0x2'),'update'];function createListener(_0x1e4475,_0x2a90dd){return function(_0x4b246e){_0x2a90dd[_0x24c3('0x3')](_0x1e4475,_0x4b246e);};}function removeListener(_0x585b05,_0x5cd010){return function(){MailMessageEvents[_0x24c3('0x4')](_0x585b05,_0x5cd010);};}exports[_0x24c3('0x5')]=function(_0x272a3b){for(var _0x224852=0x0,_0x162ab4=events[_0x24c3('0x6')];_0x224852<_0x162ab4;_0x224852++){var _0x3eacb3=events[_0x224852];var _0x2d70b4=createListener(_0x24c3('0x7')+_0x3eacb3,_0x272a3b);MailMessageEvents['on'](_0x3eacb3,_0x2d70b4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 93c669c..2e86228 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 _0x485b=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeAgents','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x485b,0x15d));var _0xb485=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x485b[_0x3cea78];return _0x33b66b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb485('0x0'));var timeout=require(_0xb485('0x1'));var express=require(_0xb485('0x2'));var router=express[_0xb485('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb485('0x4'));var config=require(_0xb485('0x5'));var controller=require(_0xb485('0x6'));router['get']('/',auth[_0xb485('0x7')](),controller[_0xb485('0x8')]);router[_0xb485('0x9')](_0xb485('0xa'),auth[_0xb485('0x7')](),controller[_0xb485('0xb')]);router[_0xb485('0x9')]('/:id',auth[_0xb485('0x7')](),controller[_0xb485('0xc')]);router[_0xb485('0x9')](_0xb485('0xd'),auth[_0xb485('0x7')](),controller[_0xb485('0xe')]);router[_0xb485('0x9')](_0xb485('0xf'),auth[_0xb485('0x7')](),controller[_0xb485('0x10')]);router['get'](_0xb485('0x11'),auth[_0xb485('0x7')](),controller[_0xb485('0x12')]);router[_0xb485('0x13')]('/',auth[_0xb485('0x7')](),controller[_0xb485('0x14')]);router[_0xb485('0x13')](_0xb485('0xf'),auth['isAuthenticated'](),controller[_0xb485('0x15')]);router[_0xb485('0x13')]('/:id/users',auth[_0xb485('0x7')](),controller['addAgents']);router[_0xb485('0x16')]('/:id',auth[_0xb485('0x7')](),controller[_0xb485('0x17')]);router[_0xb485('0x18')]('/:id',auth[_0xb485('0x7')](),controller['destroy']);router[_0xb485('0x18')](_0xb485('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xb485('0x7')](),controller[_0xb485('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf4e0=['describe','get','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x1b895b,_0x6c2982){var _0x92e0eb=function(_0x2f8d74){while(--_0x2f8d74){_0x1b895b['push'](_0x1b895b['shift']());}};_0x92e0eb(++_0x6c2982);}(_0xf4e0,0xa7));var _0x0f4e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf4e0[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x0f4e('0x0'));var util=require(_0x0f4e('0x1'));var path=require(_0x0f4e('0x2'));var timeout=require(_0x0f4e('0x3'));var express=require(_0x0f4e('0x4'));var router=express[_0x0f4e('0x5')]();var fs_extra=require(_0x0f4e('0x6'));var auth=require(_0x0f4e('0x7'));var interaction=require(_0x0f4e('0x8'));var config=require(_0x0f4e('0x9'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0x0f4e('0xa')](),controller[_0x0f4e('0xb')]);router['get'](_0x0f4e('0xc'),auth[_0x0f4e('0xa')](),controller[_0x0f4e('0xd')]);router[_0x0f4e('0xe')](_0x0f4e('0xf'),auth[_0x0f4e('0xa')](),controller['show']);router[_0x0f4e('0xe')](_0x0f4e('0x10'),auth[_0x0f4e('0xa')](),controller['getMembers']);router['get'](_0x0f4e('0x11'),auth[_0x0f4e('0xa')](),controller[_0x0f4e('0x12')]);router[_0x0f4e('0xe')](_0x0f4e('0x13'),auth[_0x0f4e('0xa')](),controller[_0x0f4e('0x14')]);router['post']('/',auth[_0x0f4e('0xa')](),controller['create']);router[_0x0f4e('0x15')](_0x0f4e('0x11'),auth[_0x0f4e('0xa')](),controller[_0x0f4e('0x16')]);router[_0x0f4e('0x15')](_0x0f4e('0x13'),auth[_0x0f4e('0xa')](),controller[_0x0f4e('0x17')]);router[_0x0f4e('0x18')](_0x0f4e('0xf'),auth['isAuthenticated'](),controller[_0x0f4e('0x19')]);router['delete']('/:id',auth[_0x0f4e('0xa')](),controller[_0x0f4e('0x1a')]);router[_0x0f4e('0x1b')](_0x0f4e('0x11'),auth[_0x0f4e('0xa')](),controller[_0x0f4e('0x1c')]);router[_0x0f4e('0x1b')](_0x0f4e('0x13'),auth['isAuthenticated'](),controller[_0x0f4e('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index c9b38d7..8f2cdac 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 _0x038a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x038a,0x12c));var _0xa038=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x038a[_0x7ad123];return _0x37d073;};'use strict';var Sequelize=require(_0xa038('0x0'));module[_0xa038('0x1')]={'name':{'type':Sequelize[_0xa038('0x2')],'unique':_0xa038('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa038('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa038('0x4')](_0xa038('0x5'),_0xa038('0x6'),_0xa038('0x7'))}}; \ No newline at end of file +var _0x55ea=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x5c7ee3,_0x2b942b){var _0x1b99a9=function(_0x5c8081){while(--_0x5c8081){_0x5c7ee3['push'](_0x5c7ee3['shift']());}};_0x1b99a9(++_0x2b942b);}(_0x55ea,0x1b6));var _0xa55e=function(_0x2164a9,_0xa3d221){_0x2164a9=_0x2164a9-0x0;var _0x2f168e=_0x55ea[_0x2164a9];return _0x2f168e;};'use strict';var Sequelize=require(_0xa55e('0x0'));module[_0xa55e('0x1')]={'name':{'type':Sequelize[_0xa55e('0x2')],'unique':_0xa55e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa55e('0x2')]},'timeout':{'type':Sequelize[_0xa55e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa55e('0x5')](_0xa55e('0x6'),_0xa55e('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6624850..6538a1a 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 _0x0848=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','findOne','MailQueueId','User','UserId','agent','mailPause','updatedAt','format','createdAt','getTeams','Team','ids','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','Agents','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x104d47,_0x230647){var _0x22853a=function(_0x4eaa30){while(--_0x4eaa30){_0x104d47['push'](_0x104d47['shift']());}};_0x22853a(++_0x230647);}(_0x0848,0x15d));var _0x8084=function(_0x1b0846,_0x1ff7f2){_0x1b0846=_0x1b0846-0x0;var _0x2717a3=_0x0848[_0x1b0846];return _0x2717a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8084('0x0'));var zipdir=require(_0x8084('0x1'));var jsonpatch=require(_0x8084('0x2'));var rp=require(_0x8084('0x3'));var moment=require(_0x8084('0x4'));var BPromise=require(_0x8084('0x5'));var Mustache=require(_0x8084('0x6'));var util=require('util');var path=require(_0x8084('0x7'));var sox=require('sox');var csv=require(_0x8084('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8084('0x9'));var _=require('lodash');var squel=require(_0x8084('0xa'));var crypto=require(_0x8084('0xb'));var jsforce=require(_0x8084('0xc'));var deskjs=require(_0x8084('0xd'));var toCsv=require(_0x8084('0x8'));var querystring=require(_0x8084('0xe'));var Papa=require('papaparse');var Redis=require(_0x8084('0xf'));var authService=require(_0x8084('0x10'));var qs=require(_0x8084('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8084('0x12'));var logger=require(_0x8084('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8084('0x14'));var db=require('../../mysqldb')['db'];config[_0x8084('0x15')]=_['defaults'](config[_0x8084('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x8084('0x16'))(new Redis(config[_0x8084('0x15')]));require(_0x8084('0x17'))[_0x8084('0x18')](socket);function respondWithStatusCode(_0x4cbe55,_0x1c70b6){_0x1c70b6=_0x1c70b6||0xcc;return function(_0x5b3f15){if(_0x5b3f15){return _0x4cbe55[_0x8084('0x19')](_0x1c70b6);}return _0x4cbe55[_0x8084('0x1a')](_0x1c70b6)[_0x8084('0x1b')]();};}function respondWithResult(_0x4d7bd1,_0xc950c1){_0xc950c1=_0xc950c1||0xc8;return function(_0x69698){if(_0x69698){return _0x4d7bd1[_0x8084('0x1a')](_0xc950c1)[_0x8084('0x1c')](_0x69698);}};}function respondWithFilteredResult(_0xc27461,_0x1d7a68){return function(_0x59946f){if(_0x59946f){var _0x31548f=typeof _0x1d7a68[_0x8084('0x1d')]===_0x8084('0x1e')&&typeof _0x1d7a68[_0x8084('0x1f')]===_0x8084('0x1e');var _0x33511c=_0x59946f[_0x8084('0x20')];var _0x9271c6=_0x31548f?0x0:_0x1d7a68[_0x8084('0x1d')];var _0xa7f54a=_0x31548f?_0x59946f[_0x8084('0x20')]:_0x1d7a68[_0x8084('0x1d')]+_0x1d7a68['limit'];var _0x24d835;if(_0xa7f54a>=_0x33511c){_0xa7f54a=_0x33511c;_0x24d835=0xc8;}else{_0x24d835=0xce;}_0xc27461[_0x8084('0x1a')](_0x24d835);return _0xc27461[_0x8084('0x21')](_0x8084('0x22'),_0x9271c6+'-'+_0xa7f54a+'/'+_0x33511c)[_0x8084('0x1c')](_0x59946f);}return null;};}function patchUpdates(_0x2b8a69){return function(_0x625c93){try{jsonpatch[_0x8084('0x23')](_0x625c93,_0x2b8a69,!![]);}catch(_0x5661b7){return BPromise[_0x8084('0x24')](_0x5661b7);}return _0x625c93[_0x8084('0x25')]();};}function saveUpdates(_0x1911e0,_0xe7afac){return function(_0x224fea){if(_0x224fea){return _0x224fea['update'](_0x1911e0)[_0x8084('0x26')](function(_0x58e351){return _0x58e351;});}return null;};}function removeEntity(_0x30c0b4,_0xdbf2b9){return function(_0x117333){if(_0x117333){return _0x117333[_0x8084('0x27')]()[_0x8084('0x26')](function(){var _0x1f3a39=_0x117333['get']({'plain':!![]});var _0x2477ed=_0x8084('0x28');return db[_0x8084('0x29')][_0x8084('0x27')]({'where':{'type':_0x2477ed,'resourceId':_0x1f3a39['id']}})[_0x8084('0x26')](function(){return _0x117333;});})['then'](function(){_0x30c0b4[_0x8084('0x1a')](0xcc)[_0x8084('0x1b')]();});}};}function handleEntityNotFound(_0xce6dc,_0x1a9950){return function(_0x12eafb){if(!_0x12eafb){_0xce6dc[_0x8084('0x19')](0x194);}return _0x12eafb;};}function handleError(_0x47d95e,_0x16b26f){_0x16b26f=_0x16b26f||0x1f4;return function(_0x20467f){logger['error'](_0x20467f[_0x8084('0x2a')]);if(_0x20467f[_0x8084('0x2b')]){delete _0x20467f[_0x8084('0x2b')];}_0x47d95e[_0x8084('0x1a')](_0x16b26f)[_0x8084('0x2c')](_0x20467f);};}exports[_0x8084('0x2d')]=function(_0x4c9a75,_0x30ecaf){var _0x54dfb6={},_0x4dfa5c={},_0x59998b={'count':0x0,'rows':[]};var _0x1ed2ec=_[_0x8084('0x2e')](db[_0x8084('0x2f')][_0x8084('0x30')],function(_0x3d067f){return{'name':_0x3d067f[_0x8084('0x31')],'type':_0x3d067f[_0x8084('0x32')][_0x8084('0x33')]};});_0x4dfa5c[_0x8084('0x34')]=_[_0x8084('0x2e')](_0x1ed2ec,_0x8084('0x2b'));_0x4dfa5c[_0x8084('0x35')]=_[_0x8084('0x36')](_0x4c9a75[_0x8084('0x35')]);_0x4dfa5c[_0x8084('0x37')]=_[_0x8084('0x38')](_0x4dfa5c[_0x8084('0x34')],_0x4dfa5c[_0x8084('0x35')]);_0x54dfb6[_0x8084('0x39')]=_[_0x8084('0x38')](_0x4dfa5c[_0x8084('0x34')],qs['fields'](_0x4c9a75[_0x8084('0x35')][_0x8084('0x3a')]));_0x54dfb6['attributes']=_0x54dfb6[_0x8084('0x39')][_0x8084('0x3b')]?_0x54dfb6['attributes']:_0x4dfa5c['model'];if(!_0x4c9a75[_0x8084('0x35')][_0x8084('0x3c')](_0x8084('0x3d'))){_0x54dfb6[_0x8084('0x1f')]=qs[_0x8084('0x1f')](_0x4c9a75[_0x8084('0x35')][_0x8084('0x1f')]);_0x54dfb6[_0x8084('0x1d')]=qs[_0x8084('0x1d')](_0x4c9a75[_0x8084('0x35')][_0x8084('0x1d')]);}_0x54dfb6[_0x8084('0x3e')]=qs[_0x8084('0x3f')](_0x4c9a75['query'][_0x8084('0x3f')]);_0x54dfb6['where']=qs[_0x8084('0x37')](_[_0x8084('0x40')](_0x4c9a75['query'],_0x4dfa5c[_0x8084('0x37')]),_0x1ed2ec);if(_0x4c9a75[_0x8084('0x35')][_0x8084('0x41')]){_0x54dfb6[_0x8084('0x42')]=_[_0x8084('0x43')](_0x54dfb6[_0x8084('0x42')],{'$or':_[_0x8084('0x2e')](_0x1ed2ec,function(_0x4244e4){if(_0x4244e4[_0x8084('0x32')]!=='VIRTUAL'){var _0x566253={};_0x566253[_0x4244e4[_0x8084('0x2b')]]={'$like':'%'+_0x4c9a75[_0x8084('0x35')][_0x8084('0x41')]+'%'};return _0x566253;}})});}_0x54dfb6=_[_0x8084('0x43')]({},_0x54dfb6,_0x4c9a75['options']);var _0x55bf94={'where':_0x54dfb6[_0x8084('0x42')]};return db[_0x8084('0x2f')][_0x8084('0x20')](_0x55bf94)[_0x8084('0x26')](function(_0xc26ae6){_0x59998b[_0x8084('0x20')]=_0xc26ae6;if(_0x4c9a75[_0x8084('0x35')][_0x8084('0x44')]){_0x54dfb6[_0x8084('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0x8084('0x46')](_0x54dfb6);})['then'](function(_0xc91f75){_0x59998b[_0x8084('0x47')]=_0xc91f75;return _0x59998b;})['then'](respondWithFilteredResult(_0x30ecaf,_0x54dfb6))[_0x8084('0x48')](handleError(_0x30ecaf,null));};exports[_0x8084('0x49')]=function(_0x1752fb,_0xd6db2b){var _0x35ba28={'raw':!![],'where':{'id':_0x1752fb[_0x8084('0x4a')]['id']}},_0x4597d1={};_0x4597d1[_0x8084('0x34')]=_[_0x8084('0x36')](db[_0x8084('0x2f')][_0x8084('0x30')]);_0x4597d1['query']=_['keys'](_0x1752fb['query']);_0x4597d1[_0x8084('0x37')]=_['intersection'](_0x4597d1[_0x8084('0x34')],_0x4597d1[_0x8084('0x35')]);_0x35ba28[_0x8084('0x39')]=_['intersection'](_0x4597d1[_0x8084('0x34')],qs['fields'](_0x1752fb[_0x8084('0x35')][_0x8084('0x3a')]));_0x35ba28[_0x8084('0x39')]=_0x35ba28[_0x8084('0x39')]['length']?_0x35ba28['attributes']:_0x4597d1[_0x8084('0x34')];if(_0x1752fb[_0x8084('0x35')][_0x8084('0x44')]){_0x35ba28[_0x8084('0x45')]=[{'all':!![]}];}_0x35ba28=_[_0x8084('0x43')]({},_0x35ba28,_0x1752fb[_0x8084('0x4b')]);return db[_0x8084('0x2f')][_0x8084('0x4c')](_0x35ba28)[_0x8084('0x26')](handleEntityNotFound(_0xd6db2b,null))[_0x8084('0x26')](respondWithResult(_0xd6db2b,null))[_0x8084('0x48')](handleError(_0xd6db2b,null));};exports[_0x8084('0x4d')]=function(_0x5a6e81,_0x162b68){return db['MailQueue'][_0x8084('0x4d')](_0x5a6e81['body'],{})['then'](function(_0x29e58e){var _0x5cea6d=_0x5a6e81['user'][_0x8084('0x4e')]({'plain':!![]});if(!_0x5cea6d)throw new Error(_0x8084('0x4f'));if(_0x5cea6d[_0x8084('0x50')]==='user'){var _0x29aa65=_0x29e58e[_0x8084('0x4e')]({'plain':!![]});var _0x3a135e=_0x8084('0x28');return db[_0x8084('0x51')]['find']({'where':{'name':_0x3a135e,'userProfileId':_0x5cea6d[_0x8084('0x52')]},'raw':!![]})['then'](function(_0x20f610){if(_0x20f610&&_0x20f610[_0x8084('0x53')]===0x0){return db[_0x8084('0x29')][_0x8084('0x4d')]({'name':_0x29aa65[_0x8084('0x2b')],'resourceId':_0x29aa65['id'],'type':_0x20f610[_0x8084('0x2b')],'sectionId':_0x20f610['id']},{})[_0x8084('0x26')](function(){return _0x29e58e;});}else{return _0x29e58e;}})['catch'](function(_0x1341b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1341b3);throw _0x1341b3;});}return _0x29e58e;})[_0x8084('0x26')](respondWithResult(_0x162b68,0xc9))[_0x8084('0x48')](handleError(_0x162b68,null));};exports[_0x8084('0x54')]=function(_0x437eb2,_0x56303c){if(_0x437eb2[_0x8084('0x55')]['id']){delete _0x437eb2[_0x8084('0x55')]['id'];}return db['MailQueue'][_0x8084('0x4c')]({'where':{'id':_0x437eb2[_0x8084('0x4a')]['id']}})[_0x8084('0x26')](handleEntityNotFound(_0x56303c,null))[_0x8084('0x26')](saveUpdates(_0x437eb2['body'],null))[_0x8084('0x26')](respondWithResult(_0x56303c,null))[_0x8084('0x48')](handleError(_0x56303c,null));};exports['destroy']=function(_0x20b106,_0x1746c1){return db[_0x8084('0x2f')]['find']({'where':{'id':_0x20b106[_0x8084('0x4a')]['id']}})[_0x8084('0x26')](handleEntityNotFound(_0x1746c1,null))[_0x8084('0x26')](removeEntity(_0x1746c1,null))[_0x8084('0x48')](handleError(_0x1746c1,null));};exports[_0x8084('0x56')]=function(_0x1f0494,_0x33b092){return db[_0x8084('0x2f')][_0x8084('0x56')]()[_0x8084('0x26')](respondWithResult(_0x33b092,null))[_0x8084('0x48')](handleError(_0x33b092,null));};exports['getMembers']=function(_0x5bc93d,_0x3dc1d6,_0x24045b){var _0x3b45fe={'raw':!![],'where':{}},_0x576838={},_0x71c445;return db[_0x8084('0x2f')][_0x8084('0x57')]({'where':{'id':_0x5bc93d[_0x8084('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dc1d6,null))[_0x8084('0x26')](function(_0x2c01d6){if(_0x2c01d6){_0x71c445=_0x2c01d6[_0x8084('0x4e')]({'plain':!![]});_0x576838['model']=_[_0x8084('0x36')](db['UserMailQueue'][_0x8084('0x30')]);_0x576838['query']=_[_0x8084('0x36')](_0x5bc93d['query']);_0x576838['filters']=_[_0x8084('0x38')](_0x576838['model'],_0x576838[_0x8084('0x35')]);_0x3b45fe[_0x8084('0x39')]=_[_0x8084('0x38')](_0x576838[_0x8084('0x34')],qs['fields'](_0x5bc93d[_0x8084('0x35')][_0x8084('0x3a')]));_0x3b45fe[_0x8084('0x39')]=_0x3b45fe[_0x8084('0x39')][_0x8084('0x3b')]?_0x3b45fe['attributes']:_0x576838[_0x8084('0x34')];if(!_0x5bc93d[_0x8084('0x35')]['hasOwnProperty'](_0x8084('0x3d'))){_0x3b45fe['limit']=qs[_0x8084('0x1f')](_0x5bc93d['query']['limit']);_0x3b45fe[_0x8084('0x1d')]=qs[_0x8084('0x1d')](_0x5bc93d[_0x8084('0x35')][_0x8084('0x1d')]);}_0x3b45fe[_0x8084('0x3e')]=qs[_0x8084('0x3f')](_0x5bc93d[_0x8084('0x35')][_0x8084('0x3f')]);_0x3b45fe['where']=qs[_0x8084('0x37')](_[_0x8084('0x40')](_0x5bc93d['query'],_0x576838['filters']));_0x3b45fe[_0x8084('0x42')][_0x8084('0x58')]=_0x2c01d6['id'];if(_0x5bc93d[_0x8084('0x35')][_0x8084('0x41')]){_0x3b45fe[_0x8084('0x42')]=_['merge'](_0x3b45fe[_0x8084('0x42')],{'$or':_[_0x8084('0x2e')](_0x3b45fe[_0x8084('0x39')],function(_0x30d6e1){var _0x2cb5b8={};_0x2cb5b8[_0x30d6e1]={'$like':'%'+_0x5bc93d[_0x8084('0x35')][_0x8084('0x41')]+'%'};return _0x2cb5b8;})});}_0x3b45fe=_[_0x8084('0x43')]({},_0x3b45fe,_0x5bc93d[_0x8084('0x4b')]);return db['UserMailQueue'][_0x8084('0x46')](_0x3b45fe);}})[_0x8084('0x26')](function(_0x25cd0f){if(_0x25cd0f){return db[_0x8084('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0x25cd0f,_0x8084('0x5a')),'role':_0x8084('0x5b')},'attributes':['id','name',_0x8084('0x5c'),_0x8084('0x5d'),'createdAt']});}})[_0x8084('0x26')](function(_0x296280){if(_0x296280){return{'count':_0x296280[_0x8084('0x20')],'rows':_['map'](_0x296280[_0x8084('0x47')],function(_0x410e5d){return{'membername':_0x410e5d[_0x8084('0x2b')],'UserId':_0x410e5d['id'],'queue_name':_0x71c445[_0x8084('0x2b')],'MailQueueId':_0x71c445['id'],'interface':util[_0x8084('0x5e')]('%s/%s','SIP',_0x410e5d['name']),'penalty':0x0,'paused':_0x410e5d[_0x8084('0x5c')],'createdAt':_0x410e5d[_0x8084('0x5f')],'updatedAt':_0x410e5d[_0x8084('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8084('0x26')](respondWithFilteredResult(_0x3dc1d6,_0x3b45fe))[_0x8084('0x48')](handleError(_0x3dc1d6,null));};exports[_0x8084('0x60')]=function(_0x56a275,_0xa9142c,_0x2f208c){var _0x4bcb5b={};var _0x4e995f={};var _0x551895;var _0x1f814c;return db['MailQueue'][_0x8084('0x57')]({'where':{'id':_0x56a275['params']['id']}})['then'](handleEntityNotFound(_0xa9142c,null))['then'](function(_0x2786c0){if(_0x2786c0){_0x551895=_0x2786c0;_0x4e995f[_0x8084('0x34')]=_[_0x8084('0x36')](db[_0x8084('0x61')]['rawAttributes']);_0x4e995f['query']=_[_0x8084('0x36')](_0x56a275[_0x8084('0x35')]);_0x4e995f[_0x8084('0x37')]=_['intersection'](_0x4e995f[_0x8084('0x34')],_0x4e995f[_0x8084('0x35')]);_0x4bcb5b['attributes']=_[_0x8084('0x38')](_0x4e995f['model'],qs['fields'](_0x56a275[_0x8084('0x35')][_0x8084('0x3a')]));_0x4bcb5b[_0x8084('0x39')]=_0x4bcb5b[_0x8084('0x39')][_0x8084('0x3b')]?_0x4bcb5b[_0x8084('0x39')]:_0x4e995f[_0x8084('0x34')];_0x4bcb5b[_0x8084('0x3e')]=qs[_0x8084('0x3f')](_0x56a275[_0x8084('0x35')]['sort']);_0x4bcb5b[_0x8084('0x42')]=qs[_0x8084('0x37')](_[_0x8084('0x40')](_0x56a275['query'],_0x4e995f['filters']));if(_0x56a275['query'][_0x8084('0x41')]){_0x4bcb5b['where']=_['merge'](_0x4bcb5b[_0x8084('0x42')],{'$or':_[_0x8084('0x2e')](_0x4bcb5b[_0x8084('0x39')],function(_0x1a028d){var _0x1c1095={};_0x1c1095[_0x1a028d]={'$like':'%'+_0x56a275[_0x8084('0x35')][_0x8084('0x41')]+'%'};return _0x1c1095;})});}_0x4bcb5b=_[_0x8084('0x43')]({},_0x4bcb5b,_0x56a275[_0x8084('0x4b')]);return _0x551895[_0x8084('0x60')](_0x4bcb5b);}})['then'](function(_0x4f42f4){if(_0x4f42f4){_0x1f814c=_0x4f42f4[_0x8084('0x3b')];if(!_0x56a275[_0x8084('0x35')][_0x8084('0x3c')]('nolimit')){_0x4bcb5b[_0x8084('0x1f')]=qs[_0x8084('0x1f')](_0x56a275['query'][_0x8084('0x1f')]);_0x4bcb5b['offset']=qs[_0x8084('0x1d')](_0x56a275[_0x8084('0x35')]['offset']);}return _0x551895[_0x8084('0x60')](_0x4bcb5b);}})['then'](function(_0x592531){if(_0x592531){return _0x592531?{'count':_0x1f814c,'rows':_0x592531}:null;}})[_0x8084('0x26')](respondWithResult(_0xa9142c,null))['catch'](handleError(_0xa9142c,null));};exports['addTeams']=function(_0x2f6887,_0x1b4d7a,_0xa19842){var _0x1ea5c4=_0x2f6887[_0x8084('0x55')][_0x8084('0x62')];return db[_0x8084('0x61')][_0x8084('0x46')]({'where':{'id':_0x1ea5c4},'attributes':['id'],'include':[{'model':db[_0x8084('0x59')],'as':'Agents','attributes':['id','name',_0x8084('0x63'),_0x8084('0x64'),_0x8084('0x65')],'raw':!![]}]})[_0x8084('0x26')](function(_0x300b5e){if(_0x300b5e){var _0x12ff2e=_[_0x8084('0x66')](_0x300b5e,function(_0x51ce89){var _0x1a2a83=_0x51ce89[_0x8084('0x4e')]({'plain':!![]});return _0x1a2a83['Agents'];});return db[_0x8084('0x2f')][_0x8084('0x4c')]({'where':{'id':_0x2f6887[_0x8084('0x4a')]['id']}})[_0x8084('0x26')](function(_0x19f486){return db[_0x8084('0x67')][_0x8084('0x68')](function(_0x451f7c){return _0x19f486['addTeams'](_0x1ea5c4,{'transaction':_0x451f7c})['then'](function(){return BPromise['each'](_0x12ff2e,function(_0x332266){return db['UserMailQueue'][_0x8084('0x69')]({'where':{'UserId':_0x332266['id'],'MailQueueId':_0x2f6887[_0x8084('0x4a')]['id']},'transaction':_0x451f7c});});})[_0x8084('0x26')](function(){_0x12ff2e[_0x8084('0x6a')](function(_0x15cb35){socket[_0x8084('0x6b')](_0x8084('0x6c'),{'UserId':_0x15cb35['id'],'MailQueueId':_0x19f486['id']});});});});});}})[_0x8084('0x26')](respondWithStatusCode(_0x1b4d7a,null))[_0x8084('0x48')](handleError(_0x1b4d7a,null));};exports['removeTeams']=function(_0x1f6d24,_0x983f32,_0x32b45f){return db[_0x8084('0x61')][_0x8084('0x46')]({'where':{'id':_0x1f6d24[_0x8084('0x35')][_0x8084('0x62')]},'attributes':['id'],'include':[{'model':db[_0x8084('0x59')],'as':_0x8084('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x8084('0x26')](handleEntityNotFound(_0x983f32,null))['then'](function(_0x222cbf){var _0x21b1f3=_[_0x8084('0x2e')](_0x222cbf,'id');var _0x16f80b=[];var _0x50b37f=[];var _0x1fcb59=squel['select']();_0x1fcb59[_0x8084('0x6e')](_0x8084('0x6f'))[_0x8084('0x70')](_0x8084('0x71'),'tq')[_0x8084('0x72')](_0x8084('0x73'),'ut',_0x8084('0x74'))[_0x8084('0x42')](_0x8084('0x75'),_0x1f6d24[_0x8084('0x4a')]['id']);for(var _0x365edb=0x0;_0x365edb<_0x222cbf['length'];_0x365edb+=0x1){let _0x396731=_0x222cbf[_0x365edb];for(var _0x1657b4=0x0;_0x1657b4<_0x396731[_0x8084('0x6d')][_0x8084('0x3b')];_0x1657b4+=0x1){let _0x48261e=_0x396731['Agents'][_0x1657b4];var _0x2ae83f=_0x1fcb59[_0x8084('0x76')]();_0x2ae83f[_0x8084('0x42')](_0x8084('0x77'),_0x48261e['id']);_0x50b37f['push'](db['sequelize'][_0x8084('0x35')](_0x2ae83f[_0x8084('0x78')](),{'type':db[_0x8084('0x67')][_0x8084('0x79')][_0x8084('0x7a')]})[_0x8084('0x26')](function(_0x441c2e){if(_0x441c2e[_0x8084('0x3b')]===0x1){return _0x48261e['id'];}else{var _0x3b6b97=_[_0x8084('0x7b')](_[_0x8084('0x2e')](_0x441c2e,_0x8084('0x7c')),function(_0x49fded){return _['includes'](_0x21b1f3,_0x49fded);});if(_0x3b6b97){return _0x48261e['id'];}}}));}}return BPromise[_0x8084('0x7d')](_0x50b37f)[_0x8084('0x26')](function(_0x54d92c){_0x16f80b=_(_0x16f80b)[_0x8084('0x7e')](_0x54d92c)[_0x8084('0x7f')]()[_0x8084('0x80')]();return db[_0x8084('0x2f')][_0x8084('0x4c')]({'where':{'id':_0x1f6d24[_0x8084('0x4a')]['id']}})[_0x8084('0x26')](function(_0x1361b3){return db[_0x8084('0x67')]['transaction'](function(_0x29e774){return _0x1361b3['removeTeams'](_0x1f6d24['query'][_0x8084('0x62')],{'transaction':_0x29e774})['then'](function(){if(!_['isEmpty'](_0x16f80b)){return _0x1361b3['removeAgents'](_0x16f80b,{'transaction':_0x29e774});}})['then'](function(){_0x16f80b[_0x8084('0x6a')](function(_0x3be37e){socket[_0x8084('0x6b')](_0x8084('0x81'),{'UserId':_0x3be37e,'MailQueueId':_0x1361b3['id']});});});});});});})[_0x8084('0x26')](respondWithStatusCode(_0x983f32,null))['catch'](handleError(_0x983f32,null));};exports[_0x8084('0x82')]=function(_0x1bb17c,_0x4ebcd8,_0x2db258){return db[_0x8084('0x2f')][_0x8084('0x4c')]({'where':{'id':_0x1bb17c['params']['id']}})[_0x8084('0x26')](handleEntityNotFound(_0x4ebcd8,null))[_0x8084('0x26')](function(_0xb8b67b){if(_0xb8b67b){return _0xb8b67b[_0x8084('0x82')](_0x1bb17c[_0x8084('0x55')][_0x8084('0x62')],_[_0x8084('0x83')](_0x1bb17c[_0x8084('0x55')],[_0x8084('0x62'),'id'])||{})[_0x8084('0x84')](function(_0x2a7e6c){for(var _0x13ac30=0x0;_0x13ac30<_0x1bb17c[_0x8084('0x55')][_0x8084('0x62')]['length'];_0x13ac30+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x1bb17c['body']['ids'][_0x13ac30]),'MailQueueId':Number(_0x1bb17c[_0x8084('0x4a')]['id'])});}return _0x2a7e6c;});}})[_0x8084('0x26')](respondWithResult(_0x4ebcd8,null))['catch'](handleError(_0x4ebcd8,null));};exports[_0x8084('0x85')]=function(_0x184678,_0x20866e,_0x5a94a8){return db[_0x8084('0x2f')][_0x8084('0x4c')]({'where':{'id':_0x184678[_0x8084('0x4a')]['id']}})[_0x8084('0x26')](handleEntityNotFound(_0x20866e,null))[_0x8084('0x26')](function(_0x78ea23){if(_0x78ea23){return _0x78ea23['removeAgents'](_0x184678[_0x8084('0x35')][_0x8084('0x62')])[_0x8084('0x26')](function(){if(_[_0x8084('0x86')](_0x184678[_0x8084('0x35')][_0x8084('0x62')])){for(var _0x5c48fe=0x0;_0x5c48fe<_0x184678[_0x8084('0x35')][_0x8084('0x62')][_0x8084('0x3b')];_0x5c48fe+=0x1){socket[_0x8084('0x6b')](_0x8084('0x81'),{'UserId':Number(_0x184678[_0x8084('0x35')]['ids'][_0x5c48fe]),'MailQueueId':Number(_0x184678[_0x8084('0x4a')]['id'])});}}else{socket['emit'](_0x8084('0x81'),{'UserId':Number(_0x184678[_0x8084('0x35')][_0x8084('0x62')]),'MailQueueId':Number(_0x184678[_0x8084('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x20866e,null))[_0x8084('0x48')](handleError(_0x20866e,null));};exports[_0x8084('0x87')]=function(_0x3178e3,_0x47f33c,_0x2b0056){var _0x32c6f6={};var _0x3baf96={};var _0x26c9f5;var _0x47e250;return db['MailQueue'][_0x8084('0x57')]({'where':{'id':_0x3178e3[_0x8084('0x4a')]['id']}})[_0x8084('0x26')](handleEntityNotFound(_0x47f33c,null))[_0x8084('0x26')](function(_0x1f28a8){if(_0x1f28a8){_0x26c9f5=_0x1f28a8;_0x3baf96[_0x8084('0x34')]=_[_0x8084('0x36')](db[_0x8084('0x59')][_0x8084('0x30')]);_0x3baf96['query']=_['keys'](_0x3178e3[_0x8084('0x35')]);_0x3baf96[_0x8084('0x37')]=_['intersection'](_0x3baf96['model'],_0x3baf96[_0x8084('0x35')]);_0x32c6f6[_0x8084('0x39')]=_['intersection'](_0x3baf96[_0x8084('0x34')],qs[_0x8084('0x3a')](_0x3178e3[_0x8084('0x35')][_0x8084('0x3a')]));_0x32c6f6[_0x8084('0x39')]=_0x32c6f6[_0x8084('0x39')][_0x8084('0x3b')]?_0x32c6f6[_0x8084('0x39')]:_0x3baf96[_0x8084('0x34')];_0x32c6f6[_0x8084('0x3e')]=qs[_0x8084('0x3f')](_0x3178e3[_0x8084('0x35')][_0x8084('0x3f')]);_0x32c6f6[_0x8084('0x42')]=qs[_0x8084('0x37')](_['pick'](_0x3178e3[_0x8084('0x35')],_0x3baf96[_0x8084('0x37')]));if(_0x3178e3[_0x8084('0x35')]['filter']){_0x32c6f6['where']=_[_0x8084('0x43')](_0x32c6f6[_0x8084('0x42')],{'$or':_[_0x8084('0x2e')](_0x32c6f6[_0x8084('0x39')],function(_0x2260c4){var _0x4c39fa={};_0x4c39fa[_0x2260c4]={'$like':'%'+_0x3178e3[_0x8084('0x35')]['filter']+'%'};return _0x4c39fa;})});}_0x32c6f6=_[_0x8084('0x43')]({},_0x32c6f6,_0x3178e3[_0x8084('0x4b')]);return _0x26c9f5[_0x8084('0x87')](_0x32c6f6);}})[_0x8084('0x26')](function(_0x2fac04){if(_0x2fac04){_0x47e250=_0x2fac04[_0x8084('0x3b')];if(!_0x3178e3[_0x8084('0x35')]['hasOwnProperty'](_0x8084('0x3d'))){_0x32c6f6['limit']=qs[_0x8084('0x1f')](_0x3178e3[_0x8084('0x35')][_0x8084('0x1f')]);_0x32c6f6[_0x8084('0x1d')]=qs[_0x8084('0x1d')](_0x3178e3[_0x8084('0x35')]['offset']);}return _0x26c9f5[_0x8084('0x87')](_0x32c6f6);}})['then'](function(_0x16ebae){if(_0x16ebae){return _0x16ebae?{'count':_0x47e250,'rows':_0x16ebae}:null;}})[_0x8084('0x26')](respondWithResult(_0x47f33c,null))['catch'](handleError(_0x47f33c,null));}; \ No newline at end of file +var _0x3773=['field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','QueryTypes','TeamId','all','union','compact','value','ids','isEmpty','addAgents','omit','spread','userMailQueue:save','removeAgents','userMailQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./mailQueue.socket','end','status','undefined','limit','count','offset','apply','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','send','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','name','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','order','MailQueueId','UserMailQueue','User','agent','mailPause','updatedAt','createdAt','SIP','getTeams','Team','options','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3773,0x1a9));var _0x3377=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3773[_0x46698a];return _0x356db0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3377('0x0'));var zipdir=require(_0x3377('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3377('0x2'));var moment=require(_0x3377('0x3'));var BPromise=require(_0x3377('0x4'));var Mustache=require(_0x3377('0x5'));var util=require(_0x3377('0x6'));var path=require(_0x3377('0x7'));var sox=require(_0x3377('0x8'));var csv=require('to-csv');var ejs=require(_0x3377('0x9'));var fs=require('fs');var fs_extra=require(_0x3377('0xa'));var _=require(_0x3377('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3377('0xc'));var deskjs=require(_0x3377('0xd'));var toCsv=require(_0x3377('0xe'));var querystring=require(_0x3377('0xf'));var Papa=require(_0x3377('0x10'));var Redis=require(_0x3377('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3377('0x12'));var hardwareService=require(_0x3377('0x13'));var logger=require(_0x3377('0x14'))(_0x3377('0x15'));var utils=require('../../config/utils');var config=require(_0x3377('0x16'));var licenseUtil=require(_0x3377('0x17'));var db=require(_0x3377('0x18'))['db'];config[_0x3377('0x19')]=_['defaults'](config[_0x3377('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3377('0x1a'))['register'](socket);function respondWithStatusCode(_0x37dd34,_0x319638){_0x319638=_0x319638||0xcc;return function(_0x4143e8){if(_0x4143e8){return _0x37dd34['sendStatus'](_0x319638);}return _0x37dd34['status'](_0x319638)[_0x3377('0x1b')]();};}function respondWithResult(_0x49fb17,_0x561df0){_0x561df0=_0x561df0||0xc8;return function(_0x6e50f8){if(_0x6e50f8){return _0x49fb17[_0x3377('0x1c')](_0x561df0)['json'](_0x6e50f8);}};}function respondWithFilteredResult(_0x3774e3,_0x569891){return function(_0x16b959){if(_0x16b959){var _0xf4073c=typeof _0x569891['offset']===_0x3377('0x1d')&&typeof _0x569891[_0x3377('0x1e')]==='undefined';var _0x845eb7=_0x16b959[_0x3377('0x1f')];var _0x314af7=_0xf4073c?0x0:_0x569891[_0x3377('0x20')];var _0x503760=_0xf4073c?_0x16b959[_0x3377('0x1f')]:_0x569891[_0x3377('0x20')]+_0x569891[_0x3377('0x1e')];var _0x307992;if(_0x503760>=_0x845eb7){_0x503760=_0x845eb7;_0x307992=0xc8;}else{_0x307992=0xce;}_0x3774e3[_0x3377('0x1c')](_0x307992);return _0x3774e3['set']('Content-Range',_0x314af7+'-'+_0x503760+'/'+_0x845eb7)['json'](_0x16b959);}return null;};}function patchUpdates(_0x3343b5){return function(_0x139d30){try{jsonpatch[_0x3377('0x21')](_0x139d30,_0x3343b5,!![]);}catch(_0x4ac578){return BPromise['reject'](_0x4ac578);}return _0x139d30[_0x3377('0x22')]();};}function saveUpdates(_0x152453,_0x4156a0){return function(_0x1674ae){if(_0x1674ae){return _0x1674ae[_0x3377('0x23')](_0x152453)['then'](function(_0x3c37e6){return _0x3c37e6;});}return null;};}function removeEntity(_0x1204d0,_0x5035e4){return function(_0x5e3578){if(_0x5e3578){return _0x5e3578[_0x3377('0x24')]()[_0x3377('0x25')](function(){var _0x4709c7=_0x5e3578[_0x3377('0x26')]({'plain':!![]});var _0x170661='MailQueues';return db[_0x3377('0x27')][_0x3377('0x24')]({'where':{'type':_0x170661,'resourceId':_0x4709c7['id']}})['then'](function(){return _0x5e3578;});})[_0x3377('0x25')](function(){_0x1204d0['status'](0xcc)[_0x3377('0x1b')]();});}};}function handleEntityNotFound(_0x49070c,_0x3d673b){return function(_0x239a98){if(!_0x239a98){_0x49070c[_0x3377('0x28')](0x194);}return _0x239a98;};}function handleError(_0x12cbdd,_0x22503f){_0x22503f=_0x22503f||0x1f4;return function(_0x4cc256){logger['error'](_0x4cc256[_0x3377('0x29')]);if(_0x4cc256['name']){delete _0x4cc256['name'];}_0x12cbdd[_0x3377('0x1c')](_0x22503f)[_0x3377('0x2a')](_0x4cc256);};}exports['index']=function(_0x368998,_0x281fbb){var _0x2a7dbd={},_0x2f3884={},_0x3d3387={'count':0x0,'rows':[]};var _0x5a2b4b=_[_0x3377('0x2b')](db[_0x3377('0x2c')][_0x3377('0x2d')],function(_0x2e1b64){return{'name':_0x2e1b64[_0x3377('0x2e')],'type':_0x2e1b64['type'][_0x3377('0x2f')]};});_0x2f3884[_0x3377('0x30')]=_['map'](_0x5a2b4b,'name');_0x2f3884[_0x3377('0x31')]=_[_0x3377('0x32')](_0x368998[_0x3377('0x31')]);_0x2f3884['filters']=_[_0x3377('0x33')](_0x2f3884['model'],_0x2f3884['query']);_0x2a7dbd['attributes']=_[_0x3377('0x33')](_0x2f3884[_0x3377('0x30')],qs[_0x3377('0x34')](_0x368998[_0x3377('0x31')]['fields']));_0x2a7dbd[_0x3377('0x35')]=_0x2a7dbd[_0x3377('0x35')][_0x3377('0x36')]?_0x2a7dbd[_0x3377('0x35')]:_0x2f3884[_0x3377('0x30')];if(!_0x368998[_0x3377('0x31')][_0x3377('0x37')](_0x3377('0x38'))){_0x2a7dbd[_0x3377('0x1e')]=qs['limit'](_0x368998[_0x3377('0x31')]['limit']);_0x2a7dbd[_0x3377('0x20')]=qs['offset'](_0x368998[_0x3377('0x31')][_0x3377('0x20')]);}_0x2a7dbd['order']=qs[_0x3377('0x39')](_0x368998[_0x3377('0x31')]['sort']);_0x2a7dbd[_0x3377('0x3a')]=qs[_0x3377('0x3b')](_[_0x3377('0x3c')](_0x368998[_0x3377('0x31')],_0x2f3884[_0x3377('0x3b')]),_0x5a2b4b);if(_0x368998[_0x3377('0x31')][_0x3377('0x3d')]){_0x2a7dbd['where']=_[_0x3377('0x3e')](_0x2a7dbd[_0x3377('0x3a')],{'$or':_[_0x3377('0x2b')](_0x5a2b4b,function(_0x287271){if(_0x287271[_0x3377('0x3f')]!==_0x3377('0x40')){var _0x492b20={};_0x492b20[_0x287271['name']]={'$like':'%'+_0x368998[_0x3377('0x31')][_0x3377('0x3d')]+'%'};return _0x492b20;}})});}_0x2a7dbd=_[_0x3377('0x3e')]({},_0x2a7dbd,_0x368998['options']);var _0x5d2b53={'where':_0x2a7dbd['where']};return db[_0x3377('0x2c')][_0x3377('0x1f')](_0x5d2b53)[_0x3377('0x25')](function(_0x1abeac){_0x3d3387[_0x3377('0x1f')]=_0x1abeac;if(_0x368998['query'][_0x3377('0x41')]){_0x2a7dbd['include']=[{'all':!![]}];}return db['MailQueue'][_0x3377('0x42')](_0x2a7dbd);})[_0x3377('0x25')](function(_0x5ef78e){_0x3d3387[_0x3377('0x43')]=_0x5ef78e;return _0x3d3387;})[_0x3377('0x25')](respondWithFilteredResult(_0x281fbb,_0x2a7dbd))['catch'](handleError(_0x281fbb,null));};exports['show']=function(_0x27f0bf,_0x491674){var _0x536e34={'raw':!![],'where':{'id':_0x27f0bf['params']['id']}},_0x1e8b3f={};_0x1e8b3f[_0x3377('0x30')]=_[_0x3377('0x32')](db['MailQueue'][_0x3377('0x2d')]);_0x1e8b3f[_0x3377('0x31')]=_[_0x3377('0x32')](_0x27f0bf[_0x3377('0x31')]);_0x1e8b3f[_0x3377('0x3b')]=_['intersection'](_0x1e8b3f[_0x3377('0x30')],_0x1e8b3f[_0x3377('0x31')]);_0x536e34['attributes']=_[_0x3377('0x33')](_0x1e8b3f[_0x3377('0x30')],qs[_0x3377('0x34')](_0x27f0bf['query'][_0x3377('0x34')]));_0x536e34[_0x3377('0x35')]=_0x536e34[_0x3377('0x35')][_0x3377('0x36')]?_0x536e34[_0x3377('0x35')]:_0x1e8b3f[_0x3377('0x30')];if(_0x27f0bf['query'][_0x3377('0x41')]){_0x536e34[_0x3377('0x44')]=[{'all':!![]}];}_0x536e34=_[_0x3377('0x3e')]({},_0x536e34,_0x27f0bf['options']);return db[_0x3377('0x2c')][_0x3377('0x45')](_0x536e34)[_0x3377('0x25')](handleEntityNotFound(_0x491674,null))[_0x3377('0x25')](respondWithResult(_0x491674,null))['catch'](handleError(_0x491674,null));};exports[_0x3377('0x46')]=function(_0x1407b0,_0x5e748f){return db[_0x3377('0x2c')][_0x3377('0x46')](_0x1407b0['body'],{})[_0x3377('0x25')](function(_0x4d29c0){var _0x1e75dd=_0x1407b0['user'][_0x3377('0x26')]({'plain':!![]});if(!_0x1e75dd)throw new Error(_0x3377('0x47'));if(_0x1e75dd[_0x3377('0x48')]===_0x3377('0x49')){var _0x2651a1=_0x4d29c0['get']({'plain':!![]});var _0x24d7ef=_0x3377('0x4a');return db[_0x3377('0x4b')][_0x3377('0x45')]({'where':{'name':_0x24d7ef,'userProfileId':_0x1e75dd['userProfileId']},'raw':!![]})[_0x3377('0x25')](function(_0x293f09){if(_0x293f09&&_0x293f09['autoAssociation']===0x0){return db[_0x3377('0x27')][_0x3377('0x46')]({'name':_0x2651a1[_0x3377('0x4c')],'resourceId':_0x2651a1['id'],'type':_0x293f09['name'],'sectionId':_0x293f09['id']},{})[_0x3377('0x25')](function(){return _0x4d29c0;});}else{return _0x4d29c0;}})[_0x3377('0x4d')](function(_0x33bea7){logger[_0x3377('0x4e')](_0x3377('0x4f'),_0x33bea7);throw _0x33bea7;});}return _0x4d29c0;})[_0x3377('0x25')](respondWithResult(_0x5e748f,0xc9))[_0x3377('0x4d')](handleError(_0x5e748f,null));};exports[_0x3377('0x23')]=function(_0x43d93d,_0x55d4ef){if(_0x43d93d[_0x3377('0x50')]['id']){delete _0x43d93d[_0x3377('0x50')]['id'];}return db[_0x3377('0x2c')][_0x3377('0x45')]({'where':{'id':_0x43d93d[_0x3377('0x51')]['id']}})[_0x3377('0x25')](handleEntityNotFound(_0x55d4ef,null))['then'](saveUpdates(_0x43d93d[_0x3377('0x50')],null))[_0x3377('0x25')](respondWithResult(_0x55d4ef,null))[_0x3377('0x4d')](handleError(_0x55d4ef,null));};exports['destroy']=function(_0x2a46b0,_0x6b0f16){return db[_0x3377('0x2c')][_0x3377('0x45')]({'where':{'id':_0x2a46b0[_0x3377('0x51')]['id']}})[_0x3377('0x25')](handleEntityNotFound(_0x6b0f16,null))[_0x3377('0x25')](removeEntity(_0x6b0f16,null))[_0x3377('0x4d')](handleError(_0x6b0f16,null));};exports[_0x3377('0x52')]=function(_0x316971,_0x5b400f){return db[_0x3377('0x2c')][_0x3377('0x52')]()['then'](respondWithResult(_0x5b400f,null))[_0x3377('0x4d')](handleError(_0x5b400f,null));};exports[_0x3377('0x53')]=function(_0x3ac7d6,_0x156b89,_0x3df36e){var _0x27f9fe={'raw':!![],'where':{}},_0x5e9407={},_0xa9d4d1;return db[_0x3377('0x2c')][_0x3377('0x54')]({'where':{'id':_0x3ac7d6[_0x3377('0x51')]['id']}})['then'](handleEntityNotFound(_0x156b89,null))[_0x3377('0x25')](function(_0x242912){if(_0x242912){_0xa9d4d1=_0x242912[_0x3377('0x26')]({'plain':!![]});_0x5e9407[_0x3377('0x30')]=_['keys'](db['UserMailQueue'][_0x3377('0x2d')]);_0x5e9407[_0x3377('0x31')]=_['keys'](_0x3ac7d6[_0x3377('0x31')]);_0x5e9407[_0x3377('0x3b')]=_[_0x3377('0x33')](_0x5e9407[_0x3377('0x30')],_0x5e9407[_0x3377('0x31')]);_0x27f9fe[_0x3377('0x35')]=_[_0x3377('0x33')](_0x5e9407[_0x3377('0x30')],qs[_0x3377('0x34')](_0x3ac7d6[_0x3377('0x31')][_0x3377('0x34')]));_0x27f9fe['attributes']=_0x27f9fe[_0x3377('0x35')][_0x3377('0x36')]?_0x27f9fe[_0x3377('0x35')]:_0x5e9407['model'];if(!_0x3ac7d6[_0x3377('0x31')][_0x3377('0x37')](_0x3377('0x38'))){_0x27f9fe['limit']=qs[_0x3377('0x1e')](_0x3ac7d6[_0x3377('0x31')][_0x3377('0x1e')]);_0x27f9fe[_0x3377('0x20')]=qs['offset'](_0x3ac7d6[_0x3377('0x31')][_0x3377('0x20')]);}_0x27f9fe[_0x3377('0x55')]=qs[_0x3377('0x39')](_0x3ac7d6[_0x3377('0x31')][_0x3377('0x39')]);_0x27f9fe[_0x3377('0x3a')]=qs[_0x3377('0x3b')](_[_0x3377('0x3c')](_0x3ac7d6['query'],_0x5e9407[_0x3377('0x3b')]));_0x27f9fe[_0x3377('0x3a')][_0x3377('0x56')]=_0x242912['id'];if(_0x3ac7d6[_0x3377('0x31')][_0x3377('0x3d')]){_0x27f9fe[_0x3377('0x3a')]=_['merge'](_0x27f9fe[_0x3377('0x3a')],{'$or':_[_0x3377('0x2b')](_0x27f9fe[_0x3377('0x35')],function(_0x5a163b){var _0x161ab3={};_0x161ab3[_0x5a163b]={'$like':'%'+_0x3ac7d6[_0x3377('0x31')][_0x3377('0x3d')]+'%'};return _0x161ab3;})});}_0x27f9fe=_['merge']({},_0x27f9fe,_0x3ac7d6['options']);return db[_0x3377('0x57')][_0x3377('0x42')](_0x27f9fe);}})[_0x3377('0x25')](function(_0x1a1d3b){if(_0x1a1d3b){return db[_0x3377('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x1a1d3b,'UserId'),'role':_0x3377('0x59')},'attributes':['id','name',_0x3377('0x5a'),_0x3377('0x5b'),_0x3377('0x5c')]});}})[_0x3377('0x25')](function(_0x58f1fe){if(_0x58f1fe){return{'count':_0x58f1fe[_0x3377('0x1f')],'rows':_[_0x3377('0x2b')](_0x58f1fe['rows'],function(_0xd67d2d){return{'membername':_0xd67d2d[_0x3377('0x4c')],'UserId':_0xd67d2d['id'],'queue_name':_0xa9d4d1[_0x3377('0x4c')],'MailQueueId':_0xa9d4d1['id'],'interface':util['format']('%s/%s',_0x3377('0x5d'),_0xd67d2d[_0x3377('0x4c')]),'penalty':0x0,'paused':_0xd67d2d['mailPause'],'createdAt':_0xd67d2d[_0x3377('0x5c')],'updatedAt':_0xd67d2d[_0x3377('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3377('0x25')](respondWithFilteredResult(_0x156b89,_0x27f9fe))[_0x3377('0x4d')](handleError(_0x156b89,null));};exports[_0x3377('0x5e')]=function(_0x4c1d8c,_0x5e90aa,_0x1d00b8){var _0x3ba74d={};var _0x4f2121={};var _0x27745d;var _0x5436fa;return db[_0x3377('0x2c')]['findOne']({'where':{'id':_0x4c1d8c[_0x3377('0x51')]['id']}})[_0x3377('0x25')](handleEntityNotFound(_0x5e90aa,null))[_0x3377('0x25')](function(_0x4bf7f1){if(_0x4bf7f1){_0x27745d=_0x4bf7f1;_0x4f2121[_0x3377('0x30')]=_['keys'](db[_0x3377('0x5f')]['rawAttributes']);_0x4f2121[_0x3377('0x31')]=_['keys'](_0x4c1d8c[_0x3377('0x31')]);_0x4f2121[_0x3377('0x3b')]=_[_0x3377('0x33')](_0x4f2121[_0x3377('0x30')],_0x4f2121['query']);_0x3ba74d[_0x3377('0x35')]=_[_0x3377('0x33')](_0x4f2121[_0x3377('0x30')],qs['fields'](_0x4c1d8c[_0x3377('0x31')][_0x3377('0x34')]));_0x3ba74d[_0x3377('0x35')]=_0x3ba74d[_0x3377('0x35')]['length']?_0x3ba74d[_0x3377('0x35')]:_0x4f2121['model'];_0x3ba74d[_0x3377('0x55')]=qs[_0x3377('0x39')](_0x4c1d8c['query'][_0x3377('0x39')]);_0x3ba74d[_0x3377('0x3a')]=qs[_0x3377('0x3b')](_[_0x3377('0x3c')](_0x4c1d8c[_0x3377('0x31')],_0x4f2121[_0x3377('0x3b')]));if(_0x4c1d8c[_0x3377('0x31')][_0x3377('0x3d')]){_0x3ba74d[_0x3377('0x3a')]=_[_0x3377('0x3e')](_0x3ba74d[_0x3377('0x3a')],{'$or':_['map'](_0x3ba74d['attributes'],function(_0x2c93a0){var _0x132b28={};_0x132b28[_0x2c93a0]={'$like':'%'+_0x4c1d8c[_0x3377('0x31')][_0x3377('0x3d')]+'%'};return _0x132b28;})});}_0x3ba74d=_[_0x3377('0x3e')]({},_0x3ba74d,_0x4c1d8c[_0x3377('0x60')]);return _0x27745d[_0x3377('0x5e')](_0x3ba74d);}})['then'](function(_0x1511f9){if(_0x1511f9){_0x5436fa=_0x1511f9[_0x3377('0x36')];if(!_0x4c1d8c[_0x3377('0x31')]['hasOwnProperty'](_0x3377('0x38'))){_0x3ba74d['limit']=qs['limit'](_0x4c1d8c[_0x3377('0x31')][_0x3377('0x1e')]);_0x3ba74d[_0x3377('0x20')]=qs[_0x3377('0x20')](_0x4c1d8c['query']['offset']);}return _0x27745d[_0x3377('0x5e')](_0x3ba74d);}})['then'](function(_0x17e7f4){if(_0x17e7f4){return _0x17e7f4?{'count':_0x5436fa,'rows':_0x17e7f4}:null;}})[_0x3377('0x25')](respondWithResult(_0x5e90aa,null))[_0x3377('0x4d')](handleError(_0x5e90aa,null));};exports['addTeams']=function(_0x5e33d9,_0x24dd1c,_0x99f1a){var _0x1405b0=_0x5e33d9[_0x3377('0x50')]['ids'];return db[_0x3377('0x5f')][_0x3377('0x42')]({'where':{'id':_0x1405b0},'attributes':['id'],'include':[{'model':db[_0x3377('0x58')],'as':_0x3377('0x61'),'attributes':['id',_0x3377('0x4c'),_0x3377('0x62'),_0x3377('0x63'),_0x3377('0x64')],'raw':!![]}]})[_0x3377('0x25')](function(_0x11df46){if(_0x11df46){var _0x39fd8b=_[_0x3377('0x65')](_0x11df46,function(_0x4c4ba5){var _0x4b6125=_0x4c4ba5[_0x3377('0x26')]({'plain':!![]});return _0x4b6125['Agents'];});return db[_0x3377('0x2c')][_0x3377('0x45')]({'where':{'id':_0x5e33d9[_0x3377('0x51')]['id']}})[_0x3377('0x25')](function(_0x333ee3){return db[_0x3377('0x66')][_0x3377('0x67')](function(_0x1d5c7e){return _0x333ee3[_0x3377('0x68')](_0x1405b0,{'transaction':_0x1d5c7e})[_0x3377('0x25')](function(){return BPromise[_0x3377('0x69')](_0x39fd8b,function(_0x3f96e3){return db[_0x3377('0x57')][_0x3377('0x6a')]({'where':{'UserId':_0x3f96e3['id'],'MailQueueId':_0x5e33d9[_0x3377('0x51')]['id']},'transaction':_0x1d5c7e});});})['then'](function(){_0x39fd8b[_0x3377('0x6b')](function(_0x2e6639){socket[_0x3377('0x6c')]('userMailQueue:save',{'UserId':_0x2e6639['id'],'MailQueueId':_0x333ee3['id']});});});});});}})['then'](respondWithStatusCode(_0x24dd1c,null))[_0x3377('0x4d')](handleError(_0x24dd1c,null));};exports[_0x3377('0x6d')]=function(_0x51ee26,_0x429a15,_0x14e783){return db['Team'][_0x3377('0x42')]({'where':{'id':_0x51ee26['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3377('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3377('0x25')](handleEntityNotFound(_0x429a15,null))[_0x3377('0x25')](function(_0x213776){var _0x595691=_[_0x3377('0x2b')](_0x213776,'id');var _0x54be59=[];var _0x3ecf8e=[];var _0xe688ce=squel[_0x3377('0x6e')]();_0xe688ce[_0x3377('0x6f')]('tq.TeamId')[_0x3377('0x70')](_0x3377('0x71'),'tq')[_0x3377('0x72')]('user_has_teams','ut',_0x3377('0x73'))[_0x3377('0x3a')](_0x3377('0x74'),_0x51ee26['params']['id']);for(var _0x10625b=0x0;_0x10625b<_0x213776[_0x3377('0x36')];_0x10625b+=0x1){let _0x2b5404=_0x213776[_0x10625b];for(var _0x9258f2=0x0;_0x9258f2<_0x2b5404['Agents'][_0x3377('0x36')];_0x9258f2+=0x1){let _0x1ae3f4=_0x2b5404['Agents'][_0x9258f2];var _0x1eae4b=_0xe688ce[_0x3377('0x75')]();_0x1eae4b[_0x3377('0x3a')]('ut.UserId\x20=\x20?',_0x1ae3f4['id']);_0x3ecf8e[_0x3377('0x76')](db[_0x3377('0x66')][_0x3377('0x31')](_0x1eae4b['toString'](),{'type':db[_0x3377('0x66')][_0x3377('0x77')]['SELECT']})[_0x3377('0x25')](function(_0x315ad1){if(_0x315ad1[_0x3377('0x36')]===0x1){return _0x1ae3f4['id'];}else{var _0x40564e=_['every'](_[_0x3377('0x2b')](_0x315ad1,_0x3377('0x78')),function(_0x13e1f0){return _['includes'](_0x595691,_0x13e1f0);});if(_0x40564e){return _0x1ae3f4['id'];}}}));}}return BPromise[_0x3377('0x79')](_0x3ecf8e)['then'](function(_0x4f573d){_0x54be59=_(_0x54be59)[_0x3377('0x7a')](_0x4f573d)[_0x3377('0x7b')]()[_0x3377('0x7c')]();return db[_0x3377('0x2c')]['find']({'where':{'id':_0x51ee26[_0x3377('0x51')]['id']}})[_0x3377('0x25')](function(_0x376bfd){return db[_0x3377('0x66')][_0x3377('0x67')](function(_0x2ff317){return _0x376bfd[_0x3377('0x6d')](_0x51ee26[_0x3377('0x31')][_0x3377('0x7d')],{'transaction':_0x2ff317})['then'](function(){if(!_[_0x3377('0x7e')](_0x54be59)){return _0x376bfd['removeAgents'](_0x54be59,{'transaction':_0x2ff317});}})[_0x3377('0x25')](function(){_0x54be59['forEach'](function(_0x350ee){socket[_0x3377('0x6c')]('userMailQueue:remove',{'UserId':_0x350ee,'MailQueueId':_0x376bfd['id']});});});});});});})[_0x3377('0x25')](respondWithStatusCode(_0x429a15,null))[_0x3377('0x4d')](handleError(_0x429a15,null));};exports['addAgents']=function(_0x434046,_0xb798b0,_0x5b5a74){return db['MailQueue'][_0x3377('0x45')]({'where':{'id':_0x434046[_0x3377('0x51')]['id']}})[_0x3377('0x25')](handleEntityNotFound(_0xb798b0,null))[_0x3377('0x25')](function(_0x1d1c8b){if(_0x1d1c8b){return _0x1d1c8b[_0x3377('0x7f')](_0x434046[_0x3377('0x50')][_0x3377('0x7d')],_[_0x3377('0x80')](_0x434046[_0x3377('0x50')],[_0x3377('0x7d'),'id'])||{})[_0x3377('0x81')](function(_0x58abc9){for(var _0x1028d9=0x0;_0x1028d9<_0x434046[_0x3377('0x50')][_0x3377('0x7d')]['length'];_0x1028d9+=0x1){socket['emit'](_0x3377('0x82'),{'UserId':Number(_0x434046['body'][_0x3377('0x7d')][_0x1028d9]),'MailQueueId':Number(_0x434046[_0x3377('0x51')]['id'])});}return _0x58abc9;});}})['then'](respondWithResult(_0xb798b0,null))[_0x3377('0x4d')](handleError(_0xb798b0,null));};exports['removeAgents']=function(_0x36fbf9,_0x217820,_0x3d5859){return db[_0x3377('0x2c')][_0x3377('0x45')]({'where':{'id':_0x36fbf9[_0x3377('0x51')]['id']}})[_0x3377('0x25')](handleEntityNotFound(_0x217820,null))[_0x3377('0x25')](function(_0x30432a){if(_0x30432a){return _0x30432a[_0x3377('0x83')](_0x36fbf9[_0x3377('0x31')][_0x3377('0x7d')])['then'](function(){if(_['isArray'](_0x36fbf9[_0x3377('0x31')][_0x3377('0x7d')])){for(var _0xcc833f=0x0;_0xcc833f<_0x36fbf9['query'][_0x3377('0x7d')]['length'];_0xcc833f+=0x1){socket[_0x3377('0x6c')](_0x3377('0x84'),{'UserId':Number(_0x36fbf9[_0x3377('0x31')]['ids'][_0xcc833f]),'MailQueueId':Number(_0x36fbf9[_0x3377('0x51')]['id'])});}}else{socket[_0x3377('0x6c')]('userMailQueue:remove',{'UserId':Number(_0x36fbf9['query']['ids']),'MailQueueId':Number(_0x36fbf9[_0x3377('0x51')]['id'])});}});}})[_0x3377('0x25')](respondWithStatusCode(_0x217820,null))[_0x3377('0x4d')](handleError(_0x217820,null));};exports['getAgents']=function(_0xe52892,_0x13b19f,_0x28c6a0){var _0x225456={};var _0x5637af={};var _0x5d152a;var _0x4460e0;return db[_0x3377('0x2c')]['findOne']({'where':{'id':_0xe52892[_0x3377('0x51')]['id']}})['then'](handleEntityNotFound(_0x13b19f,null))[_0x3377('0x25')](function(_0x2dbe0b){if(_0x2dbe0b){_0x5d152a=_0x2dbe0b;_0x5637af[_0x3377('0x30')]=_[_0x3377('0x32')](db[_0x3377('0x58')]['rawAttributes']);_0x5637af[_0x3377('0x31')]=_['keys'](_0xe52892[_0x3377('0x31')]);_0x5637af[_0x3377('0x3b')]=_['intersection'](_0x5637af[_0x3377('0x30')],_0x5637af['query']);_0x225456['attributes']=_[_0x3377('0x33')](_0x5637af['model'],qs[_0x3377('0x34')](_0xe52892[_0x3377('0x31')][_0x3377('0x34')]));_0x225456['attributes']=_0x225456[_0x3377('0x35')][_0x3377('0x36')]?_0x225456[_0x3377('0x35')]:_0x5637af[_0x3377('0x30')];_0x225456[_0x3377('0x55')]=qs['sort'](_0xe52892[_0x3377('0x31')]['sort']);_0x225456['where']=qs['filters'](_[_0x3377('0x3c')](_0xe52892[_0x3377('0x31')],_0x5637af['filters']));if(_0xe52892[_0x3377('0x31')][_0x3377('0x3d')]){_0x225456['where']=_[_0x3377('0x3e')](_0x225456['where'],{'$or':_['map'](_0x225456[_0x3377('0x35')],function(_0x5dc369){var _0x48f97f={};_0x48f97f[_0x5dc369]={'$like':'%'+_0xe52892[_0x3377('0x31')]['filter']+'%'};return _0x48f97f;})});}_0x225456=_[_0x3377('0x3e')]({},_0x225456,_0xe52892[_0x3377('0x60')]);return _0x5d152a[_0x3377('0x85')](_0x225456);}})['then'](function(_0x4173bc){if(_0x4173bc){_0x4460e0=_0x4173bc['length'];if(!_0xe52892[_0x3377('0x31')][_0x3377('0x37')]('nolimit')){_0x225456[_0x3377('0x1e')]=qs['limit'](_0xe52892[_0x3377('0x31')]['limit']);_0x225456['offset']=qs['offset'](_0xe52892[_0x3377('0x31')][_0x3377('0x20')]);}return _0x5d152a[_0x3377('0x85')](_0x225456);}})[_0x3377('0x25')](function(_0x17351e){if(_0x17351e){return _0x17351e?{'count':_0x4460e0,'rows':_0x17351e}:null;}})[_0x3377('0x25')](respondWithResult(_0x13b19f,null))[_0x3377('0x4d')](handleError(_0x13b19f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index df4933f..edbad75 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 _0xda07=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0xda07,0xd4));var _0x7da0=function(_0x30615f,_0x50f28c){_0x30615f=_0x30615f-0x0;var _0x5e7443=_0xda07[_0x30615f];return _0x5e7443;};'use strict';var EventEmitter=require(_0x7da0('0x0'));var MailQueue=require(_0x7da0('0x1'))['db'][_0x7da0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7da0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7da0('0x4'),'afterDestroy':_0x7da0('0x5')};function emitEvent(_0x70e91d){return function(_0x44adeb,_0x42b64d,_0x40d961){MailQueueEvents[_0x7da0('0x6')](_0x70e91d+':'+_0x44adeb['id'],_0x44adeb);MailQueueEvents[_0x7da0('0x6')](_0x70e91d,_0x44adeb);_0x40d961(null);};}for(var e in events){if(events[_0x7da0('0x7')](e)){var event=events[e];MailQueue[_0x7da0('0x8')](e,emitEvent(event));}}module[_0x7da0('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x6cc5=['../../mysqldb','MailQueue','save','remove','emit','hook','exports'];(function(_0x3a0ab8,_0x57339d){var _0x2e772e=function(_0x526f79){while(--_0x526f79){_0x3a0ab8['push'](_0x3a0ab8['shift']());}};_0x2e772e(++_0x57339d);}(_0x6cc5,0x1f1));var _0x56cc=function(_0x147259,_0x27b351){_0x147259=_0x147259-0x0;var _0x5383a0=_0x6cc5[_0x147259];return _0x5383a0;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x56cc('0x0'))['db'][_0x56cc('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56cc('0x2'),'afterUpdate':'update','afterDestroy':_0x56cc('0x3')};function emitEvent(_0x4cfcca){return function(_0x18eeb7,_0x57dfa7,_0x10fc42){MailQueueEvents[_0x56cc('0x4')](_0x4cfcca+':'+_0x18eeb7['id'],_0x18eeb7);MailQueueEvents['emit'](_0x4cfcca,_0x18eeb7);_0x10fc42(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x56cc('0x5')](e,emitEvent(event));}}module[_0x56cc('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 d0aa8bb..b7b0660 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 _0x0733=['bluebird','request-promise','rimraf','../../config/environment','exports','mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3ad3f1,_0x263c97){var _0x40ef7f=function(_0x346d19){while(--_0x346d19){_0x3ad3f1['push'](_0x3ad3f1['shift']());}};_0x40ef7f(++_0x263c97);}(_0x0733,0x145));var _0x3073=function(_0xfd8f94,_0x21bc28){_0xfd8f94=_0xfd8f94-0x0;var _0xb64e3a=_0x0733[_0xfd8f94];return _0xb64e3a;};'use strict';var _=require(_0x3073('0x0'));var util=require(_0x3073('0x1'));var logger=require(_0x3073('0x2'))(_0x3073('0x3'));var moment=require(_0x3073('0x4'));var BPromise=require(_0x3073('0x5'));var rp=require(_0x3073('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3073('0x7'));var config=require(_0x3073('0x8'));var attributes=require('./mailQueue.attributes');module[_0x3073('0x9')]=function(_0x21f397,_0x1ff0eb){return _0x21f397['define']('MailQueue',attributes,{'tableName':_0x3073('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8ef=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','define','MailQueue','mail_queues'];(function(_0x5d84fa,_0x2f583d){var _0x248801=function(_0xd7882f){while(--_0xd7882f){_0x5d84fa['push'](_0x5d84fa['shift']());}};_0x248801(++_0x2f583d);}(_0xc8ef,0x176));var _0xfc8e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xc8ef[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xfc8e('0x0'));var util=require('util');var logger=require(_0xfc8e('0x1'))('api');var moment=require(_0xfc8e('0x2'));var BPromise=require(_0xfc8e('0x3'));var rp=require(_0xfc8e('0x4'));var fs=require('fs');var path=require(_0xfc8e('0x5'));var rimraf=require(_0xfc8e('0x6'));var config=require('../../config/environment');var attributes=require(_0xfc8e('0x7'));module['exports']=function(_0x32d28b,_0x18ea41){return _0x32d28b[_0xfc8e('0x8')](_0xfc8e('0x9'),attributes,{'tableName':_0xfc8e('0xa'),'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 3b2ca7d..a079f7d 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 _0xf074=['./mailQueue.socket','register','request','then','request\x20sent','error','MailQueue,\x20%s,\x20%s','message','result','MailQueue','options','raw','where','attributes','limit','include','map','model','info','debug','stringify','catch','GetMailQueue','find','ShowMailQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf074,0xb9));var _0x4f07=function(_0x4b554e,_0x2d8a54){_0x4b554e=_0x4b554e-0x0;var _0xd2c592=_0xf074[_0x4b554e];return _0xd2c592;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f07('0x0'));var BPromise=require(_0x4f07('0x1'));var rs=require(_0x4f07('0x2'));var fs=require('fs');var Redis=require(_0x4f07('0x3'));var db=require(_0x4f07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f07('0x5'))(_0x4f07('0x6'));var config=require(_0x4f07('0x7'));var jayson=require(_0x4f07('0x8'));var client=jayson[_0x4f07('0x9')][_0x4f07('0xa')]({'port':0x232a});config[_0x4f07('0xb')]=_[_0x4f07('0xc')](config[_0x4f07('0xb')],{'host':_0x4f07('0xd'),'port':0x18eb});var socket=require(_0x4f07('0xe'))(new Redis(config['redis']));require(_0x4f07('0xf'))[_0x4f07('0x10')](socket);function respondWithRpcPromise(_0x36e3e0,_0x833a80,_0x132527){return new BPromise(function(_0x41d008,_0x45fa42){return client[_0x4f07('0x11')](_0x36e3e0,_0x132527)[_0x4f07('0x12')](function(_0x33b3a7){logger['info']('MailQueue,\x20%s,\x20%s',_0x833a80,_0x4f07('0x13'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x833a80,_0x4f07('0x13'),JSON['stringify'](_0x33b3a7));if(_0x33b3a7[_0x4f07('0x14')]){if(_0x33b3a7[_0x4f07('0x14')]['code']===0x1f4){logger['error'](_0x4f07('0x15'),_0x833a80,_0x33b3a7[_0x4f07('0x14')][_0x4f07('0x16')]);return _0x45fa42(_0x33b3a7[_0x4f07('0x14')]['message']);}logger[_0x4f07('0x14')](_0x4f07('0x15'),_0x833a80,_0x33b3a7[_0x4f07('0x14')]['message']);return _0x41d008(_0x33b3a7[_0x4f07('0x14')]['message']);}else{logger['info'](_0x4f07('0x15'),_0x833a80,_0x4f07('0x13'));_0x41d008(_0x33b3a7[_0x4f07('0x17')][_0x4f07('0x16')]);}})['catch'](function(_0xeac330){logger[_0x4f07('0x14')]('MailQueue,\x20%s,\x20%s',_0x833a80,_0xeac330);_0x45fa42(_0xeac330);});});}exports['GetMailQueue']=function(_0x59125e){var _0x4bfe28=this;return new Promise(function(_0x2a2527,_0x473fab){return db[_0x4f07('0x18')]['findAll']({'raw':_0x59125e[_0x4f07('0x19')]?_0x59125e[_0x4f07('0x19')][_0x4f07('0x1a')]===undefined?!![]:![]:!![],'where':_0x59125e['options']?_0x59125e[_0x4f07('0x19')][_0x4f07('0x1b')]||null:null,'attributes':_0x59125e[_0x4f07('0x19')]?_0x59125e['options'][_0x4f07('0x1c')]||null:null,'limit':_0x59125e['options']?_0x59125e['options'][_0x4f07('0x1d')]||null:null,'include':_0x59125e[_0x4f07('0x19')]?_0x59125e['options'][_0x4f07('0x1e')]?_[_0x4f07('0x1f')](_0x59125e[_0x4f07('0x19')][_0x4f07('0x1e')],function(_0x3d8d72){return{'model':db[_0x3d8d72[_0x4f07('0x20')]],'as':_0x3d8d72['as'],'attributes':_0x3d8d72['attributes'],'include':_0x3d8d72[_0x4f07('0x1e')]?_[_0x4f07('0x1f')](_0x3d8d72[_0x4f07('0x1e')],function(_0x4a480e){return{'model':db[_0x4a480e[_0x4f07('0x20')]],'as':_0x4a480e['as'],'attributes':_0x4a480e[_0x4f07('0x1c')],'include':_0x4a480e[_0x4f07('0x1e')]?_[_0x4f07('0x1f')](_0x4a480e[_0x4f07('0x1e')],function(_0x46dd38){return{'model':db[_0x46dd38[_0x4f07('0x20')]],'as':_0x46dd38['as'],'attributes':_0x46dd38[_0x4f07('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4f07('0x12')](function(_0x45ba1a){logger[_0x4f07('0x21')]('GetMailQueue',_0x59125e);logger[_0x4f07('0x22')]('GetMailQueue',_0x59125e,JSON[_0x4f07('0x23')](_0x45ba1a));_0x2a2527(_0x45ba1a);})[_0x4f07('0x24')](function(_0x486bef){logger[_0x4f07('0x14')](_0x4f07('0x25'),_0x486bef['message'],_0x59125e);_0x473fab(_0x4bfe28[_0x4f07('0x14')](0x1f4,_0x486bef['message']));});});};exports['ShowMailQueue']=function(_0x5bdeee){var _0x17bd97=this;return new Promise(function(_0x553068,_0x32d5d2){return db[_0x4f07('0x18')][_0x4f07('0x26')]({'raw':_0x5bdeee['options']?_0x5bdeee[_0x4f07('0x19')][_0x4f07('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bdeee[_0x4f07('0x19')]?_0x5bdeee[_0x4f07('0x19')][_0x4f07('0x1b')]||null:null,'attributes':_0x5bdeee[_0x4f07('0x19')]?_0x5bdeee['options'][_0x4f07('0x1c')]||null:null,'include':_0x5bdeee['options']?_0x5bdeee[_0x4f07('0x19')][_0x4f07('0x1e')]?_[_0x4f07('0x1f')](_0x5bdeee[_0x4f07('0x19')][_0x4f07('0x1e')],function(_0x10371f){return{'model':db[_0x10371f[_0x4f07('0x20')]],'as':_0x10371f['as'],'attributes':_0x10371f[_0x4f07('0x1c')],'include':_0x10371f['include']?_[_0x4f07('0x1f')](_0x10371f[_0x4f07('0x1e')],function(_0x1df011){return{'model':db[_0x1df011[_0x4f07('0x20')]],'as':_0x1df011['as'],'attributes':_0x1df011[_0x4f07('0x1c')],'include':_0x1df011[_0x4f07('0x1e')]?_[_0x4f07('0x1f')](_0x1df011[_0x4f07('0x1e')],function(_0x4cdb84){return{'model':db[_0x4cdb84[_0x4f07('0x20')]],'as':_0x4cdb84['as'],'attributes':_0x4cdb84[_0x4f07('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4381ae){logger[_0x4f07('0x21')](_0x4f07('0x27'),_0x5bdeee);logger[_0x4f07('0x22')](_0x4f07('0x27'),_0x5bdeee,JSON['stringify'](_0x4381ae));_0x553068(_0x4381ae);})[_0x4f07('0x24')](function(_0x510336){logger[_0x4f07('0x14')](_0x4f07('0x27'),_0x510336[_0x4f07('0x16')],_0x5bdeee);_0x32d5d2(_0x17bd97['error'](0x1f4,_0x510336[_0x4f07('0x16')]));});});}; \ No newline at end of file +var _0x830c=['GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0xcb9df0,_0x3f9ef9){var _0x4372ab=function(_0x5163cc){while(--_0x5163cc){_0xcb9df0['push'](_0xcb9df0['shift']());}};_0x4372ab(++_0x3f9ef9);}(_0x830c,0xf7));var _0xc830=function(_0x149eb3,_0x2967fa){_0x149eb3=_0x149eb3-0x0;var _0xcebde1=_0x830c[_0x149eb3];return _0xcebde1;};'use strict';var _=require(_0xc830('0x0'));var util=require(_0xc830('0x1'));var moment=require(_0xc830('0x2'));var BPromise=require(_0xc830('0x3'));var rs=require(_0xc830('0x4'));var fs=require('fs');var Redis=require(_0xc830('0x5'));var db=require(_0xc830('0x6'))['db'];var utils=require(_0xc830('0x7'));var logger=require(_0xc830('0x8'))('rpc');var config=require(_0xc830('0x9'));var jayson=require(_0xc830('0xa'));var client=jayson['client'][_0xc830('0xb')]({'port':0x232a});config[_0xc830('0xc')]=_[_0xc830('0xd')](config[_0xc830('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc830('0xc')]));require(_0xc830('0xe'))[_0xc830('0xf')](socket);function respondWithRpcPromise(_0x591bcf,_0x2640ac,_0x4ee530){return new BPromise(function(_0x257771,_0x3056cd){return client[_0xc830('0x10')](_0x591bcf,_0x4ee530)[_0xc830('0x11')](function(_0xf9340d){logger[_0xc830('0x12')](_0xc830('0x13'),_0x2640ac,'request\x20sent');logger[_0xc830('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2640ac,_0xc830('0x15'),JSON['stringify'](_0xf9340d));if(_0xf9340d[_0xc830('0x16')]){if(_0xf9340d[_0xc830('0x16')]['code']===0x1f4){logger[_0xc830('0x16')]('MailQueue,\x20%s,\x20%s',_0x2640ac,_0xf9340d[_0xc830('0x16')]['message']);return _0x3056cd(_0xf9340d[_0xc830('0x16')][_0xc830('0x17')]);}logger[_0xc830('0x16')](_0xc830('0x13'),_0x2640ac,_0xf9340d[_0xc830('0x16')][_0xc830('0x17')]);return _0x257771(_0xf9340d[_0xc830('0x16')][_0xc830('0x17')]);}else{logger[_0xc830('0x12')]('MailQueue,\x20%s,\x20%s',_0x2640ac,_0xc830('0x15'));_0x257771(_0xf9340d[_0xc830('0x18')]['message']);}})[_0xc830('0x19')](function(_0x38acde){logger[_0xc830('0x16')](_0xc830('0x13'),_0x2640ac,_0x38acde);_0x3056cd(_0x38acde);});});}exports[_0xc830('0x1a')]=function(_0x423744){var _0x39755b=this;return new Promise(function(_0x47503d,_0x4026e7){return db[_0xc830('0x1b')][_0xc830('0x1c')]({'raw':_0x423744[_0xc830('0x1d')]?_0x423744[_0xc830('0x1d')][_0xc830('0x1e')]===undefined?!![]:![]:!![],'where':_0x423744[_0xc830('0x1d')]?_0x423744['options'][_0xc830('0x1f')]||null:null,'attributes':_0x423744['options']?_0x423744[_0xc830('0x1d')][_0xc830('0x20')]||null:null,'limit':_0x423744[_0xc830('0x1d')]?_0x423744[_0xc830('0x1d')]['limit']||null:null,'include':_0x423744[_0xc830('0x1d')]?_0x423744[_0xc830('0x1d')][_0xc830('0x21')]?_[_0xc830('0x22')](_0x423744[_0xc830('0x1d')]['include'],function(_0x25f66d){return{'model':db[_0x25f66d[_0xc830('0x23')]],'as':_0x25f66d['as'],'attributes':_0x25f66d['attributes'],'include':_0x25f66d[_0xc830('0x21')]?_[_0xc830('0x22')](_0x25f66d[_0xc830('0x21')],function(_0x3ad664){return{'model':db[_0x3ad664[_0xc830('0x23')]],'as':_0x3ad664['as'],'attributes':_0x3ad664['attributes'],'include':_0x3ad664[_0xc830('0x21')]?_[_0xc830('0x22')](_0x3ad664[_0xc830('0x21')],function(_0x2fd7a7){return{'model':db[_0x2fd7a7[_0xc830('0x23')]],'as':_0x2fd7a7['as'],'attributes':_0x2fd7a7[_0xc830('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc830('0x11')](function(_0x2fa5d8){logger[_0xc830('0x12')](_0xc830('0x1a'),_0x423744);logger[_0xc830('0x14')](_0xc830('0x1a'),_0x423744,JSON[_0xc830('0x24')](_0x2fa5d8));_0x47503d(_0x2fa5d8);})[_0xc830('0x19')](function(_0x5cac1e){logger[_0xc830('0x16')](_0xc830('0x1a'),_0x5cac1e[_0xc830('0x17')],_0x423744);_0x4026e7(_0x39755b[_0xc830('0x16')](0x1f4,_0x5cac1e[_0xc830('0x17')]));});});};exports[_0xc830('0x25')]=function(_0x476522){var _0x9b9123=this;return new Promise(function(_0x106a58,_0xb23dad){return db[_0xc830('0x1b')][_0xc830('0x26')]({'raw':_0x476522[_0xc830('0x1d')]?_0x476522[_0xc830('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x476522[_0xc830('0x1d')]?_0x476522['options'][_0xc830('0x1f')]||null:null,'attributes':_0x476522[_0xc830('0x1d')]?_0x476522[_0xc830('0x1d')][_0xc830('0x20')]||null:null,'include':_0x476522[_0xc830('0x1d')]?_0x476522[_0xc830('0x1d')][_0xc830('0x21')]?_[_0xc830('0x22')](_0x476522[_0xc830('0x1d')][_0xc830('0x21')],function(_0x57d3b6){return{'model':db[_0x57d3b6[_0xc830('0x23')]],'as':_0x57d3b6['as'],'attributes':_0x57d3b6[_0xc830('0x20')],'include':_0x57d3b6[_0xc830('0x21')]?_['map'](_0x57d3b6['include'],function(_0x284b3e){return{'model':db[_0x284b3e[_0xc830('0x23')]],'as':_0x284b3e['as'],'attributes':_0x284b3e[_0xc830('0x20')],'include':_0x284b3e[_0xc830('0x21')]?_[_0xc830('0x22')](_0x284b3e['include'],function(_0xb26528){return{'model':db[_0xb26528[_0xc830('0x23')]],'as':_0xb26528['as'],'attributes':_0xb26528[_0xc830('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc830('0x11')](function(_0x385c70){logger[_0xc830('0x12')](_0xc830('0x25'),_0x476522);logger[_0xc830('0x14')]('ShowMailQueue',_0x476522,JSON[_0xc830('0x24')](_0x385c70));_0x106a58(_0x385c70);})[_0xc830('0x19')](function(_0x51eb5f){logger[_0xc830('0x16')](_0xc830('0x25'),_0x51eb5f[_0xc830('0x17')],_0x476522);_0xb23dad(_0x9b9123[_0xc830('0x16')](0x1f4,_0x51eb5f[_0xc830('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d04a9fc..6c5509a 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 _0x5a36=['register','./mailQueue.events','save','remove','update','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5a36,0x133));var _0x65a3=function(_0x556bca,_0x573fb9){_0x556bca=_0x556bca-0x0;var _0x16c8fd=_0x5a36[_0x556bca];return _0x16c8fd;};'use strict';var MailQueueEvents=require(_0x65a3('0x0'));var events=[_0x65a3('0x1'),_0x65a3('0x2'),_0x65a3('0x3')];function createListener(_0x2495f8,_0x5188bb){return function(_0x5ed140){_0x5188bb[_0x65a3('0x4')](_0x2495f8,_0x5ed140);};}function removeListener(_0x1a018b,_0x431d44){return function(){MailQueueEvents['removeListener'](_0x1a018b,_0x431d44);};}exports[_0x65a3('0x5')]=function(_0x3d1b8c){for(var _0x3b61e4=0x0,_0x326c4e=events['length'];_0x3b61e4<_0x326c4e;_0x3b61e4++){var _0x2e4464=events[_0x3b61e4];var _0x19614f=createListener('mailQueue:'+_0x2e4464,_0x3d1b8c);MailQueueEvents['on'](_0x2e4464,_0x19614f);}}; \ No newline at end of file +var _0x8dab=['removeListener','register','./mailQueue.events','save','remove','update','emit'];(function(_0x4bb453,_0x2daa3f){var _0x8a330d=function(_0x316295){while(--_0x316295){_0x4bb453['push'](_0x4bb453['shift']());}};_0x8a330d(++_0x2daa3f);}(_0x8dab,0x1ec));var _0xb8da=function(_0x1d6a3b,_0x2c90ff){_0x1d6a3b=_0x1d6a3b-0x0;var _0x1a192d=_0x8dab[_0x1d6a3b];return _0x1a192d;};'use strict';var MailQueueEvents=require(_0xb8da('0x0'));var events=[_0xb8da('0x1'),_0xb8da('0x2'),_0xb8da('0x3')];function createListener(_0x174030,_0x10fd67){return function(_0x159646){_0x10fd67[_0xb8da('0x4')](_0x174030,_0x159646);};}function removeListener(_0xf267da,_0x10fad9){return function(){MailQueueEvents[_0xb8da('0x5')](_0xf267da,_0x10fad9);};}exports[_0xb8da('0x6')]=function(_0x2b9d8f){for(var _0x3c9e7b=0x0,_0x4c2021=events['length'];_0x3c9e7b<_0x4c2021;_0x3c9e7b++){var _0x5f06e3=events[_0x3c9e7b];var _0x33b72e=createListener('mailQueue:'+_0x5f06e3,_0x2b9d8f);MailQueueEvents['on'](_0x5f06e3,_0x33b72e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index af3d06b..2fee9d3 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 _0xd30e=['../../config/environment','get','index','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x446919,_0x32b3f4){var _0x27c2fc=function(_0x347d24){while(--_0x347d24){_0x446919['push'](_0x446919['shift']());}};_0x27c2fc(++_0x32b3f4);}(_0xd30e,0x1b0));var _0xed30=function(_0x4c3f4a,_0x553db2){_0x4c3f4a=_0x4c3f4a-0x0;var _0x2c82d1=_0xd30e[_0x4c3f4a];return _0x2c82d1;};'use strict';var multer=require(_0xed30('0x0'));var util=require(_0xed30('0x1'));var path=require(_0xed30('0x2'));var timeout=require(_0xed30('0x3'));var express=require(_0xed30('0x4'));var router=express[_0xed30('0x5')]();var fs_extra=require(_0xed30('0x6'));var auth=require(_0xed30('0x7'));var interaction=require(_0xed30('0x8'));var config=require(_0xed30('0x9'));var controller=require('./mailQueueReport.controller');router[_0xed30('0xa')]('/',auth['isAuthenticated'](),controller[_0xed30('0xb')]);router[_0xed30('0xa')]('/describe',auth[_0xed30('0xc')](),controller[_0xed30('0xd')]);router[_0xed30('0xa')](_0xed30('0xe'),auth['isAuthenticated'](),controller[_0xed30('0xf')]);router['post']('/',auth[_0xed30('0xc')](),controller[_0xed30('0x10')]);router['put']('/:id',auth[_0xed30('0xc')](),controller[_0xed30('0x11')]);router[_0xed30('0x12')](_0xed30('0xe'),auth['isAuthenticated'](),controller[_0xed30('0x13')]);module[_0xed30('0x14')]=router; \ No newline at end of file +var _0xf65e=['create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show'];(function(_0x5a84fa,_0x539650){var _0x543b31=function(_0x1aeb35){while(--_0x1aeb35){_0x5a84fa['push'](_0x5a84fa['shift']());}};_0x543b31(++_0x539650);}(_0xf65e,0x1e3));var _0xef65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf65e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xef65('0x0'));var util=require(_0xef65('0x1'));var path=require(_0xef65('0x2'));var timeout=require(_0xef65('0x3'));var express=require(_0xef65('0x4'));var router=express[_0xef65('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xef65('0x6'));var config=require(_0xef65('0x7'));var controller=require('./mailQueueReport.controller');router[_0xef65('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xef65('0x8')](_0xef65('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xef65('0xa'),auth[_0xef65('0xb')](),controller[_0xef65('0xc')]);router['post']('/',auth[_0xef65('0xb')](),controller[_0xef65('0xd')]);router['put'](_0xef65('0xa'),auth[_0xef65('0xb')](),controller['update']);router['delete']('/:id',auth[_0xef65('0xb')](),controller[_0xef65('0xe')]);module[_0xef65('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a54a8d4..6504c5a 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 _0x18d4=['exports','STRING','DATE','moment'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x18d4,0x1ab));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x418d('0x0'));var Sequelize=require('sequelize');module[_0x418d('0x1')]={'uniqueid':{'type':Sequelize[_0x418d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x418d('0x2')]},'joinAt':{'type':Sequelize[_0x418d('0x3')]},'leaveAt':{'type':Sequelize[_0x418d('0x3')]},'acceptAt':{'type':Sequelize[_0x418d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x418d('0x2')]}}; \ No newline at end of file +var _0x3e30=['exports','STRING','DATE','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e30,0x1cb));var _0x03e3=function(_0x205dd4,_0x269d4a){_0x205dd4=_0x205dd4-0x0;var _0x561d69=_0x3e30[_0x205dd4];return _0x561d69;};'use strict';var moment=require('moment');var Sequelize=require(_0x03e3('0x0'));module[_0x03e3('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x03e3('0x2')]},'joinAt':{'type':Sequelize[_0x03e3('0x3')]},'leaveAt':{'type':Sequelize[_0x03e3('0x3')]},'acceptAt':{'type':Sequelize[_0x03e3('0x3')]},'exitAt':{'type':Sequelize[_0x03e3('0x3')]},'reason':{'type':Sequelize[_0x03e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c11eb55..8d79bd9 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 _0x160f=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','type','key','map','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','MailQueueReport','include','findAll','rows','show','params','keys','fields','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x29c556,_0x5174ad){var _0x595e4d=function(_0x12b798){while(--_0x12b798){_0x29c556['push'](_0x29c556['shift']());}};_0x595e4d(++_0x5174ad);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];function respondWithStatusCode(_0x3b09ea,_0x2d8854){_0x2d8854=_0x2d8854||0xcc;return function(_0x523af5){if(_0x523af5){return _0x3b09ea[_0xf160('0x17')](_0x2d8854);}return _0x3b09ea['status'](_0x2d8854)[_0xf160('0x18')]();};}function respondWithResult(_0x26951a,_0x12549a){_0x12549a=_0x12549a||0xc8;return function(_0x2bb6c7){if(_0x2bb6c7){return _0x26951a[_0xf160('0x19')](_0x12549a)[_0xf160('0x1a')](_0x2bb6c7);}};}function respondWithFilteredResult(_0x2643ba,_0x172337){return function(_0x1396ba){if(_0x1396ba){var _0x59ac02=typeof _0x172337[_0xf160('0x1b')]===_0xf160('0x1c')&&typeof _0x172337[_0xf160('0x1d')]===_0xf160('0x1c');var _0x51824b=_0x1396ba[_0xf160('0x1e')];var _0x4b8185=_0x59ac02?0x0:_0x172337[_0xf160('0x1b')];var _0x1cf6ba=_0x59ac02?_0x1396ba[_0xf160('0x1e')]:_0x172337[_0xf160('0x1b')]+_0x172337[_0xf160('0x1d')];var _0x205afa;if(_0x1cf6ba>=_0x51824b){_0x1cf6ba=_0x51824b;_0x205afa=0xc8;}else{_0x205afa=0xce;}_0x2643ba[_0xf160('0x19')](_0x205afa);return _0x2643ba[_0xf160('0x1f')](_0xf160('0x20'),_0x4b8185+'-'+_0x1cf6ba+'/'+_0x51824b)['json'](_0x1396ba);}return null;};}function patchUpdates(_0x40ccf0){return function(_0xa20d5a){try{jsonpatch[_0xf160('0x21')](_0xa20d5a,_0x40ccf0,!![]);}catch(_0x5ad173){return BPromise[_0xf160('0x22')](_0x5ad173);}return _0xa20d5a[_0xf160('0x23')]();};}function saveUpdates(_0x454e63,_0x36d0cb){return function(_0x2e03c8){if(_0x2e03c8){return _0x2e03c8[_0xf160('0x24')](_0x454e63)[_0xf160('0x25')](function(_0x5a72d1){return _0x5a72d1;});}return null;};}function removeEntity(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(_0x305f6a){return _0x305f6a[_0xf160('0x26')]()['then'](function(){_0x3d1f6c[_0xf160('0x19')](0xcc)[_0xf160('0x18')]();});}};}function handleEntityNotFound(_0x4a8003,_0x487c0c){return function(_0x168a09){if(!_0x168a09){_0x4a8003[_0xf160('0x17')](0x194);}return _0x168a09;};}function handleError(_0x39c0e3,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0xcfa9bd){logger[_0xf160('0x27')](_0xcfa9bd[_0xf160('0x28')]);if(_0xcfa9bd[_0xf160('0x29')]){delete _0xcfa9bd[_0xf160('0x29')];}_0x39c0e3[_0xf160('0x19')](_0x4c0c51)['send'](_0xcfa9bd);};}exports['index']=function(_0x48145e,_0x26e7b9){var _0x16a5fa={},_0xcaab39={},_0x26e06b={'count':0x0,'rows':[]};var _0x399cce=_['map'](db['MailQueueReport'][_0xf160('0x2a')],function(_0x558596){return{'name':_0x558596['fieldName'],'type':_0x558596[_0xf160('0x2b')][_0xf160('0x2c')]};});_0xcaab39['model']=_[_0xf160('0x2d')](_0x399cce,_0xf160('0x29'));_0xcaab39['query']=_['keys'](_0x48145e['query']);_0xcaab39['filters']=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],_0xcaab39[_0xf160('0x30')]);_0x16a5fa[_0xf160('0x31')]=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],qs['fields'](_0x48145e['query']['fields']));_0x16a5fa[_0xf160('0x31')]=_0x16a5fa['attributes']['length']?_0x16a5fa[_0xf160('0x31')]:_0xcaab39[_0xf160('0x2f')];if(!_0x48145e['query'][_0xf160('0x32')](_0xf160('0x33'))){_0x16a5fa[_0xf160('0x1d')]=qs[_0xf160('0x1d')](_0x48145e[_0xf160('0x30')]['limit']);_0x16a5fa[_0xf160('0x1b')]=qs[_0xf160('0x1b')](_0x48145e[_0xf160('0x30')]['offset']);}_0x16a5fa[_0xf160('0x34')]=qs[_0xf160('0x35')](_0x48145e[_0xf160('0x30')][_0xf160('0x35')]);_0x16a5fa[_0xf160('0x36')]=qs[_0xf160('0x37')](_['pick'](_0x48145e['query'],_0xcaab39[_0xf160('0x37')]),_0x399cce);if(_0x48145e[_0xf160('0x30')][_0xf160('0x38')]){_0x16a5fa[_0xf160('0x36')]=_[_0xf160('0x39')](_0x16a5fa[_0xf160('0x36')],{'$or':_[_0xf160('0x2d')](_0x399cce,function(_0x38a33e){if(_0x38a33e[_0xf160('0x2b')]!==_0xf160('0x3a')){var _0x1e65d4={};_0x1e65d4[_0x38a33e[_0xf160('0x29')]]={'$like':'%'+_0x48145e[_0xf160('0x30')][_0xf160('0x38')]+'%'};return _0x1e65d4;}})});}_0x16a5fa=_[_0xf160('0x39')]({},_0x16a5fa,_0x48145e[_0xf160('0x3b')]);var _0x161f06={'where':_0x16a5fa[_0xf160('0x36')]};return db[_0xf160('0x3c')][_0xf160('0x1e')](_0x161f06)[_0xf160('0x25')](function(_0x8fe1de){_0x26e06b[_0xf160('0x1e')]=_0x8fe1de;if(_0x48145e[_0xf160('0x30')]['includeAll']){_0x16a5fa[_0xf160('0x3d')]=[{'all':!![]}];}return db[_0xf160('0x3c')][_0xf160('0x3e')](_0x16a5fa);})[_0xf160('0x25')](function(_0x3d273d){_0x26e06b[_0xf160('0x3f')]=_0x3d273d;return _0x26e06b;})[_0xf160('0x25')](respondWithFilteredResult(_0x26e7b9,_0x16a5fa))['catch'](handleError(_0x26e7b9,null));};exports[_0xf160('0x40')]=function(_0x5be7ce,_0xa80a5f){var _0x477ded={'raw':!![],'where':{'id':_0x5be7ce[_0xf160('0x41')]['id']}},_0x530fc5={};_0x530fc5[_0xf160('0x2f')]=_[_0xf160('0x42')](db[_0xf160('0x3c')][_0xf160('0x2a')]);_0x530fc5[_0xf160('0x30')]=_[_0xf160('0x42')](_0x5be7ce['query']);_0x530fc5[_0xf160('0x37')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],_0x530fc5[_0xf160('0x30')]);_0x477ded[_0xf160('0x31')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],qs[_0xf160('0x43')](_0x5be7ce[_0xf160('0x30')][_0xf160('0x43')]));_0x477ded[_0xf160('0x31')]=_0x477ded['attributes']['length']?_0x477ded[_0xf160('0x31')]:_0x530fc5[_0xf160('0x2f')];if(_0x5be7ce[_0xf160('0x30')][_0xf160('0x44')]){_0x477ded[_0xf160('0x3d')]=[{'all':!![]}];}_0x477ded=_[_0xf160('0x39')]({},_0x477ded,_0x5be7ce['options']);return db[_0xf160('0x3c')]['find'](_0x477ded)['then'](handleEntityNotFound(_0xa80a5f,null))[_0xf160('0x25')](respondWithResult(_0xa80a5f,null))[_0xf160('0x45')](handleError(_0xa80a5f,null));};exports['create']=function(_0x5ea49d,_0x2f1648){return db[_0xf160('0x3c')][_0xf160('0x46')](_0x5ea49d[_0xf160('0x47')],{})['then'](respondWithResult(_0x2f1648,0xc9))['catch'](handleError(_0x2f1648,null));};exports['update']=function(_0x50a97d,_0x406494){if(_0x50a97d['body']['id']){delete _0x50a97d[_0xf160('0x47')]['id'];}return db[_0xf160('0x3c')][_0xf160('0x48')]({'where':{'id':_0x50a97d[_0xf160('0x41')]['id']}})['then'](handleEntityNotFound(_0x406494,null))[_0xf160('0x25')](saveUpdates(_0x50a97d[_0xf160('0x47')],null))[_0xf160('0x25')](respondWithResult(_0x406494,null))['catch'](handleError(_0x406494,null));};exports[_0xf160('0x26')]=function(_0x40f855,_0x87ad7e){return db['MailQueueReport'][_0xf160('0x48')]({'where':{'id':_0x40f855[_0xf160('0x41')]['id']}})[_0xf160('0x25')](handleEntityNotFound(_0x87ad7e,null))[_0xf160('0x25')](removeEntity(_0x87ad7e,null))[_0xf160('0x45')](handleError(_0x87ad7e,null));};exports['describe']=function(_0x4c90ab,_0x3c8765){return db['MailQueueReport'][_0xf160('0x49')]()[_0xf160('0x25')](respondWithResult(_0x3c8765,null))['catch'](handleError(_0x3c8765,null));}; \ No newline at end of file +var _0xa46e=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create'];(function(_0x585c00,_0x219fea){var _0x5527c4=function(_0xb737de){while(--_0xb737de){_0x585c00['push'](_0x585c00['shift']());}};_0x5527c4(++_0x219fea);}(_0xa46e,0x8a));var _0xea46=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xa46e[_0xd4636c];return _0x5ee17d;};'use strict';var emlformat=require(_0xea46('0x0'));var rimraf=require(_0xea46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea46('0x2'));var rp=require(_0xea46('0x3'));var moment=require(_0xea46('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea46('0x5'));var util=require('util');var path=require(_0xea46('0x6'));var sox=require('sox');var csv=require(_0xea46('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea46('0x8'));var _=require(_0xea46('0x9'));var squel=require('squel');var crypto=require(_0xea46('0xa'));var jsforce=require(_0xea46('0xb'));var deskjs=require(_0xea46('0xc'));var toCsv=require(_0xea46('0x7'));var querystring=require(_0xea46('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea46('0xe'));var as=require(_0xea46('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea46('0x10'))(_0xea46('0x11'));var utils=require(_0xea46('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xea46('0x13'));var db=require(_0xea46('0x14'))['db'];function respondWithStatusCode(_0x4e10f3,_0x13390c){_0x13390c=_0x13390c||0xcc;return function(_0x1a4fe2){if(_0x1a4fe2){return _0x4e10f3['sendStatus'](_0x13390c);}return _0x4e10f3[_0xea46('0x15')](_0x13390c)['end']();};}function respondWithResult(_0x3024af,_0x42c328){_0x42c328=_0x42c328||0xc8;return function(_0x6c4bc4){if(_0x6c4bc4){return _0x3024af[_0xea46('0x15')](_0x42c328)[_0xea46('0x16')](_0x6c4bc4);}};}function respondWithFilteredResult(_0x2ef436,_0x81ee45){return function(_0x20a79c){if(_0x20a79c){var _0x176ad2=typeof _0x81ee45['offset']===_0xea46('0x17')&&typeof _0x81ee45[_0xea46('0x18')]===_0xea46('0x17');var _0x59f28e=_0x20a79c['count'];var _0x19d5c1=_0x176ad2?0x0:_0x81ee45[_0xea46('0x19')];var _0x5cf5dd=_0x176ad2?_0x20a79c['count']:_0x81ee45[_0xea46('0x19')]+_0x81ee45[_0xea46('0x18')];var _0x4ff93d;if(_0x5cf5dd>=_0x59f28e){_0x5cf5dd=_0x59f28e;_0x4ff93d=0xc8;}else{_0x4ff93d=0xce;}_0x2ef436[_0xea46('0x15')](_0x4ff93d);return _0x2ef436[_0xea46('0x1a')](_0xea46('0x1b'),_0x19d5c1+'-'+_0x5cf5dd+'/'+_0x59f28e)[_0xea46('0x16')](_0x20a79c);}return null;};}function patchUpdates(_0x53b8db){return function(_0x2b6491){try{jsonpatch['apply'](_0x2b6491,_0x53b8db,!![]);}catch(_0x515e32){return BPromise[_0xea46('0x1c')](_0x515e32);}return _0x2b6491['save']();};}function saveUpdates(_0x4cc673,_0x5064d8){return function(_0x3b25fe){if(_0x3b25fe){return _0x3b25fe[_0xea46('0x1d')](_0x4cc673)[_0xea46('0x1e')](function(_0x5beb44){return _0x5beb44;});}return null;};}function removeEntity(_0x16f8fa,_0x59b10d){return function(_0x12e688){if(_0x12e688){return _0x12e688[_0xea46('0x1f')]()['then'](function(){_0x16f8fa[_0xea46('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3a8f,_0x114bf9){return function(_0xd4cf78){if(!_0xd4cf78){_0x2b3a8f['sendStatus'](0x194);}return _0xd4cf78;};}function handleError(_0x5d2de1,_0x44e797){_0x44e797=_0x44e797||0x1f4;return function(_0x38ac07){logger['error'](_0x38ac07[_0xea46('0x20')]);if(_0x38ac07['name']){delete _0x38ac07[_0xea46('0x21')];}_0x5d2de1['status'](_0x44e797)[_0xea46('0x22')](_0x38ac07);};}exports[_0xea46('0x23')]=function(_0x6710ae,_0x44517d){var _0x146995={},_0x174345={},_0x4a5149={'count':0x0,'rows':[]};var _0x382bbc=_[_0xea46('0x24')](db[_0xea46('0x25')]['rawAttributes'],function(_0x3e7856){return{'name':_0x3e7856[_0xea46('0x26')],'type':_0x3e7856[_0xea46('0x27')]['key']};});_0x174345['model']=_['map'](_0x382bbc,_0xea46('0x21'));_0x174345[_0xea46('0x28')]=_[_0xea46('0x29')](_0x6710ae[_0xea46('0x28')]);_0x174345[_0xea46('0x2a')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],_0x174345[_0xea46('0x28')]);_0x146995[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],qs['fields'](_0x6710ae[_0xea46('0x28')][_0xea46('0x2e')]));_0x146995[_0xea46('0x2d')]=_0x146995[_0xea46('0x2d')][_0xea46('0x2f')]?_0x146995[_0xea46('0x2d')]:_0x174345[_0xea46('0x2c')];if(!_0x6710ae['query'][_0xea46('0x30')](_0xea46('0x31'))){_0x146995[_0xea46('0x18')]=qs[_0xea46('0x18')](_0x6710ae[_0xea46('0x28')]['limit']);_0x146995['offset']=qs[_0xea46('0x19')](_0x6710ae[_0xea46('0x28')]['offset']);}_0x146995[_0xea46('0x32')]=qs[_0xea46('0x33')](_0x6710ae[_0xea46('0x28')][_0xea46('0x33')]);_0x146995['where']=qs['filters'](_[_0xea46('0x34')](_0x6710ae['query'],_0x174345[_0xea46('0x2a')]),_0x382bbc);if(_0x6710ae[_0xea46('0x28')]['filter']){_0x146995[_0xea46('0x35')]=_[_0xea46('0x36')](_0x146995['where'],{'$or':_[_0xea46('0x24')](_0x382bbc,function(_0xefad3e){if(_0xefad3e['type']!==_0xea46('0x37')){var _0x41e9e8={};_0x41e9e8[_0xefad3e[_0xea46('0x21')]]={'$like':'%'+_0x6710ae[_0xea46('0x28')]['filter']+'%'};return _0x41e9e8;}})});}_0x146995=_[_0xea46('0x36')]({},_0x146995,_0x6710ae[_0xea46('0x38')]);var _0x338c2d={'where':_0x146995[_0xea46('0x35')]};return db[_0xea46('0x25')]['count'](_0x338c2d)[_0xea46('0x1e')](function(_0xdb2e11){_0x4a5149['count']=_0xdb2e11;if(_0x6710ae[_0xea46('0x28')][_0xea46('0x39')]){_0x146995[_0xea46('0x3a')]=[{'all':!![]}];}return db[_0xea46('0x25')]['findAll'](_0x146995);})[_0xea46('0x1e')](function(_0x1cc8f8){_0x4a5149[_0xea46('0x3b')]=_0x1cc8f8;return _0x4a5149;})['then'](respondWithFilteredResult(_0x44517d,_0x146995))[_0xea46('0x3c')](handleError(_0x44517d,null));};exports[_0xea46('0x3d')]=function(_0x2c9491,_0x32c81c){var _0x3164c5={'raw':!![],'where':{'id':_0x2c9491[_0xea46('0x3e')]['id']}},_0xc45d74={};_0xc45d74[_0xea46('0x2c')]=_[_0xea46('0x29')](db[_0xea46('0x25')][_0xea46('0x3f')]);_0xc45d74[_0xea46('0x28')]=_[_0xea46('0x29')](_0x2c9491[_0xea46('0x28')]);_0xc45d74[_0xea46('0x2a')]=_['intersection'](_0xc45d74['model'],_0xc45d74[_0xea46('0x28')]);_0x3164c5[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0xc45d74[_0xea46('0x2c')],qs['fields'](_0x2c9491['query']['fields']));_0x3164c5[_0xea46('0x2d')]=_0x3164c5[_0xea46('0x2d')]['length']?_0x3164c5[_0xea46('0x2d')]:_0xc45d74[_0xea46('0x2c')];if(_0x2c9491[_0xea46('0x28')][_0xea46('0x39')]){_0x3164c5[_0xea46('0x3a')]=[{'all':!![]}];}_0x3164c5=_['merge']({},_0x3164c5,_0x2c9491[_0xea46('0x38')]);return db['MailQueueReport'][_0xea46('0x40')](_0x3164c5)[_0xea46('0x1e')](handleEntityNotFound(_0x32c81c,null))[_0xea46('0x1e')](respondWithResult(_0x32c81c,null))[_0xea46('0x3c')](handleError(_0x32c81c,null));};exports[_0xea46('0x41')]=function(_0x1260d1,_0x36f697){return db['MailQueueReport'][_0xea46('0x41')](_0x1260d1[_0xea46('0x42')],{})['then'](respondWithResult(_0x36f697,0xc9))[_0xea46('0x3c')](handleError(_0x36f697,null));};exports[_0xea46('0x1d')]=function(_0x24d929,_0x548572){if(_0x24d929['body']['id']){delete _0x24d929[_0xea46('0x42')]['id'];}return db[_0xea46('0x25')][_0xea46('0x40')]({'where':{'id':_0x24d929[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x548572,null))[_0xea46('0x1e')](saveUpdates(_0x24d929[_0xea46('0x42')],null))[_0xea46('0x1e')](respondWithResult(_0x548572,null))[_0xea46('0x3c')](handleError(_0x548572,null));};exports[_0xea46('0x1f')]=function(_0x48ad1c,_0x2144a0){return db['MailQueueReport'][_0xea46('0x40')]({'where':{'id':_0x48ad1c[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x2144a0,null))['then'](removeEntity(_0x2144a0,null))[_0xea46('0x3c')](handleError(_0x2144a0,null));};exports[_0xea46('0x43')]=function(_0x334937,_0x2f49c8){return db['MailQueueReport']['describe']()[_0xea46('0x1e')](respondWithResult(_0x2f49c8,null))[_0xea46('0x3c')](handleError(_0x2f49c8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8874008..3bdde98 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 _0x33d4=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueueReport','uniqueid'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x33d4,0x1a4));var _0x433d=function(_0x27654b,_0x5884b1){_0x27654b=_0x27654b-0x0;var _0x48a6e5=_0x33d4[_0x27654b];return _0x48a6e5;};'use strict';var _=require('lodash');var util=require(_0x433d('0x0'));var logger=require(_0x433d('0x1'))(_0x433d('0x2'));var moment=require(_0x433d('0x3'));var BPromise=require(_0x433d('0x4'));var rp=require(_0x433d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x433d('0x6'));var config=require(_0x433d('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x433d('0x8')]=function(_0x417843,_0x227dcd){return _0x417843[_0x433d('0x9')](_0x433d('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x433d('0xb'),'fields':[_0x433d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8cd=['define','MailQueueReport','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1b8258,_0x5139aa){var _0x3ac43d=function(_0x3f8415){while(--_0x3f8415){_0x1b8258['push'](_0x1b8258['shift']());}};_0x3ac43d(++_0x5139aa);}(_0xf8cd,0x153));var _0xdf8c=function(_0x153be5,_0x223310){_0x153be5=_0x153be5-0x0;var _0x3b14b6=_0xf8cd[_0x153be5];return _0x3b14b6;};'use strict';var _=require(_0xdf8c('0x0'));var util=require('util');var logger=require(_0xdf8c('0x1'))(_0xdf8c('0x2'));var moment=require(_0xdf8c('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf8c('0x4'));var fs=require('fs');var path=require(_0xdf8c('0x5'));var rimraf=require(_0xdf8c('0x6'));var config=require(_0xdf8c('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xdf8c('0x8')]=function(_0xd3f55f,_0xa9b662){return _0xd3f55f[_0xdf8c('0x9')](_0xdf8c('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xdf8c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a74be9b..7db861f 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x2a292e,_0x37afac){var _0x848feb=function(_0x580ef3){while(--_0x580ef3){_0x2a292e['push'](_0x2a292e['shift']());}};_0x848feb(++_0x37afac);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf2b987,_0xfa878f){_0xf2b987=_0xf2b987-0x0;var _0x4deed4=_0x5f2f[_0xf2b987];return _0x4deed4;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ 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(_0xc17d60,_0x4d3616){var _0x462396=function(_0x23d12e){while(--_0x23d12e){_0xc17d60['push'](_0xc17d60['shift']());}};_0x462396(++_0x4d3616);}(_0xdb28,0x106));var _0x8db2=function(_0x37b16b,_0x2495a8){_0x37b16b=_0x37b16b-0x0;var _0x40c9da=_0xdb28[_0x37b16b];return _0x40c9da;};'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 0dd7e77..81124d3 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x356b68,_0x5da037){var _0x208a4b=function(_0xbc8560){while(--_0xbc8560){_0x356b68['push'](_0x356b68['shift']());}};_0x208a4b(++_0x5da037);}(_0xe706,0xa3));var _0x6e70=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0xe706[_0x1903aa];return _0x51fe28;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x570938,_0x1a2a68){var _0x24751a=function(_0x170aeb){while(--_0x170aeb){_0x570938['push'](_0x570938['shift']());}};_0x24751a(++_0x1a2a68);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xcb91[_0x1ee62e];return _0x27c6c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9ae3759..c07eb4e 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 _0x7692=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7692,0x82));var _0x2769=function(_0x47d6c8,_0x4195c5){_0x47d6c8=_0x47d6c8-0x0;var _0x42e495=_0x7692[_0x47d6c8];return _0x42e495;};'use strict';var Sequelize=require(_0x2769('0x0'));module[_0x2769('0x1')]={'description':{'type':Sequelize[_0x2769('0x2')]},'host':{'type':Sequelize[_0x2769('0x2')]},'authentication':{'type':Sequelize[_0x2769('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2769('0x2')]},'password':{'type':Sequelize[_0x2769('0x2')]},'port':{'type':Sequelize[_0x2769('0x4')]},'tls':{'type':Sequelize[_0x2769('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2769('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x2769('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2769('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0c24=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0c24,0xce));var _0x40c2=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x0c24[_0xed4881];return _0x7fcbd5;};'use strict';var Sequelize=require(_0x40c2('0x0'));module['exports']={'description':{'type':Sequelize[_0x40c2('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x40c2('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x40c2('0x1')]},'password':{'type':Sequelize[_0x40c2('0x1')]},'port':{'type':Sequelize[_0x40c2('0x3')]},'tls':{'type':Sequelize[_0x40c2('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x40c2('0x1')],'defaultValue':_0x40c2('0x4')},'connTimeout':{'type':Sequelize[_0x40c2('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x40c2('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x40c2('0x1')]},'modernAuthentication':{'type':Sequelize[_0x40c2('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5da2b62..f60eb73 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 _0x7b74=['moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x1c6d1b,_0x123265){var _0x1e7009=function(_0x2e7576){while(--_0x2e7576){_0x1c6d1b['push'](_0x1c6d1b['shift']());}};_0x1e7009(++_0x123265);}(_0x7b74,0x192));var _0x47b7=function(_0x170f61,_0x1000ea){_0x170f61=_0x170f61-0x0;var _0x48e487=_0x7b74[_0x170f61];return _0x48e487;};'use strict';var _=require(_0x47b7('0x0'));var util=require(_0x47b7('0x1'));var logger=require(_0x47b7('0x2'))(_0x47b7('0x3'));var moment=require(_0x47b7('0x4'));var BPromise=require(_0x47b7('0x5'));var rp=require(_0x47b7('0x6'));var fs=require('fs');var path=require(_0x47b7('0x7'));var rimraf=require(_0x47b7('0x8'));var config=require('../../config/environment');var attributes=require(_0x47b7('0x9'));module[_0x47b7('0xa')]=function(_0x5d34bc,_0x1b2587){return _0x5d34bc[_0x47b7('0xb')](_0x47b7('0xc'),attributes,{'tableName':_0x47b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c88=['moment','bluebird','path','rimraf','./mailServerIn.attributes','define','mail_servers_in','lodash','util','api'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x6c88,0x1a1));var _0x86c8=function(_0x5211cd,_0x266b93){_0x5211cd=_0x5211cd-0x0;var _0x366c0f=_0x6c88[_0x5211cd];return _0x366c0f;};'use strict';var _=require(_0x86c8('0x0'));var util=require(_0x86c8('0x1'));var logger=require('../../config/logger')(_0x86c8('0x2'));var moment=require(_0x86c8('0x3'));var BPromise=require(_0x86c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86c8('0x5'));var rimraf=require(_0x86c8('0x6'));var config=require('../../config/environment');var attributes=require(_0x86c8('0x7'));module['exports']=function(_0x118a77,_0x266585){return _0x118a77[_0x86c8('0x8')]('MailServerIn',attributes,{'tableName':_0x86c8('0x9'),'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 e8dc828..0ba25b4 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 _0xbb5f=['findAll','raw','options','where','attributes','limit','include','model','map','then','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn','MailServerIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb5f,0x16a));var _0xfbb5=function(_0x15e5e2,_0x217d3e){_0x15e5e2=_0x15e5e2-0x0;var _0x2e6d95=_0xbb5f[_0x15e5e2];return _0x2e6d95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbb5('0x0'));var BPromise=require('bluebird');var rs=require(_0xfbb5('0x1'));var fs=require('fs');var Redis=require(_0xfbb5('0x2'));var db=require(_0xfbb5('0x3'))['db'];var utils=require(_0xfbb5('0x4'));var logger=require(_0xfbb5('0x5'))(_0xfbb5('0x6'));var config=require(_0xfbb5('0x7'));var jayson=require(_0xfbb5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5026,_0x284080,_0x42228f){return new BPromise(function(_0x419540,_0x4785d4){return client[_0xfbb5('0x9')](_0x2c5026,_0x42228f)['then'](function(_0x5d9932){logger['info']('MailServerIn,\x20%s,\x20%s',_0x284080,_0xfbb5('0xa'));logger[_0xfbb5('0xb')](_0xfbb5('0xc'),_0x284080,_0xfbb5('0xa'),JSON[_0xfbb5('0xd')](_0x5d9932));if(_0x5d9932[_0xfbb5('0xe')]){if(_0x5d9932['error']['code']===0x1f4){logger[_0xfbb5('0xe')](_0xfbb5('0xf'),_0x284080,_0x5d9932[_0xfbb5('0xe')][_0xfbb5('0x10')]);return _0x4785d4(_0x5d9932[_0xfbb5('0xe')]['message']);}logger[_0xfbb5('0xe')]('MailServerIn,\x20%s,\x20%s',_0x284080,_0x5d9932['error']['message']);return _0x419540(_0x5d9932['error']['message']);}else{logger[_0xfbb5('0x11')](_0xfbb5('0xf'),_0x284080,_0xfbb5('0xa'));_0x419540(_0x5d9932[_0xfbb5('0x12')][_0xfbb5('0x10')]);}})[_0xfbb5('0x13')](function(_0x2f8505){logger[_0xfbb5('0xe')]('MailServerIn,\x20%s,\x20%s',_0x284080,_0x2f8505);_0x4785d4(_0x2f8505);});});}exports[_0xfbb5('0x14')]=function(_0x49e42d){var _0x102298=this;return new Promise(function(_0x2b8e69,_0x30f9bb){return db[_0xfbb5('0x15')][_0xfbb5('0x16')]({'raw':_0x49e42d['options']?_0x49e42d['options'][_0xfbb5('0x17')]===undefined?!![]:![]:!![],'where':_0x49e42d[_0xfbb5('0x18')]?_0x49e42d['options'][_0xfbb5('0x19')]||null:null,'attributes':_0x49e42d['options']?_0x49e42d['options'][_0xfbb5('0x1a')]||null:null,'limit':_0x49e42d[_0xfbb5('0x18')]?_0x49e42d[_0xfbb5('0x18')][_0xfbb5('0x1b')]||null:null,'include':_0x49e42d['options']?_0x49e42d[_0xfbb5('0x18')][_0xfbb5('0x1c')]?_['map'](_0x49e42d['options']['include'],function(_0x2bd066){return{'model':db[_0x2bd066[_0xfbb5('0x1d')]],'as':_0x2bd066['as'],'attributes':_0x2bd066[_0xfbb5('0x1a')],'include':_0x2bd066['include']?_[_0xfbb5('0x1e')](_0x2bd066[_0xfbb5('0x1c')],function(_0x2f8552){return{'model':db[_0x2f8552[_0xfbb5('0x1d')]],'as':_0x2f8552['as'],'attributes':_0x2f8552[_0xfbb5('0x1a')],'include':_0x2f8552[_0xfbb5('0x1c')]?_[_0xfbb5('0x1e')](_0x2f8552[_0xfbb5('0x1c')],function(_0x51dad7){return{'model':db[_0x51dad7[_0xfbb5('0x1d')]],'as':_0x51dad7['as'],'attributes':_0x51dad7[_0xfbb5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfbb5('0x1f')](function(_0x2a99eb){logger[_0xfbb5('0x11')](_0xfbb5('0x14'),_0x49e42d);logger[_0xfbb5('0xb')](_0xfbb5('0x14'),_0x49e42d,JSON[_0xfbb5('0xd')](_0x2a99eb));_0x2b8e69(_0x2a99eb);})[_0xfbb5('0x13')](function(_0x1abd73){logger['error'](_0xfbb5('0x14'),_0x1abd73[_0xfbb5('0x10')],_0x49e42d);_0x30f9bb(_0x102298['error'](0x1f4,_0x1abd73['message']));});});}; \ No newline at end of file +var _0x949d=['then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailServerIn','findAll','options','attributes','include','map','model','GetMailServerIn','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x949d,0x162));var _0xd949=function(_0x179d44,_0x19bdb8){_0x179d44=_0x179d44-0x0;var _0x862011=_0x949d[_0x179d44];return _0x862011;};'use strict';var _=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var moment=require(_0xd949('0x2'));var BPromise=require(_0xd949('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd949('0x4'))['db'];var utils=require(_0xd949('0x5'));var logger=require('../../config/logger')(_0xd949('0x6'));var config=require(_0xd949('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd949('0x8')][_0xd949('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6e8175,_0x5e90f2,_0x208942){return new BPromise(function(_0x158cc2,_0x49b70a){return client['request'](_0x6e8175,_0x208942)[_0xd949('0xa')](function(_0x1bbff8){logger[_0xd949('0xb')](_0xd949('0xc'),_0x5e90f2,_0xd949('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5e90f2,_0xd949('0xd'),JSON[_0xd949('0xe')](_0x1bbff8));if(_0x1bbff8[_0xd949('0xf')]){if(_0x1bbff8[_0xd949('0xf')]['code']===0x1f4){logger[_0xd949('0xf')](_0xd949('0xc'),_0x5e90f2,_0x1bbff8[_0xd949('0xf')][_0xd949('0x10')]);return _0x49b70a(_0x1bbff8[_0xd949('0xf')][_0xd949('0x10')]);}logger[_0xd949('0xf')](_0xd949('0xc'),_0x5e90f2,_0x1bbff8['error'][_0xd949('0x10')]);return _0x158cc2(_0x1bbff8[_0xd949('0xf')][_0xd949('0x10')]);}else{logger[_0xd949('0xb')]('MailServerIn,\x20%s,\x20%s',_0x5e90f2,_0xd949('0xd'));_0x158cc2(_0x1bbff8[_0xd949('0x11')][_0xd949('0x10')]);}})[_0xd949('0x12')](function(_0xf5af){logger[_0xd949('0xf')](_0xd949('0xc'),_0x5e90f2,_0xf5af);_0x49b70a(_0xf5af);});});}exports['GetMailServerIn']=function(_0x37614d){var _0x2a2859=this;return new Promise(function(_0x5a0790,_0x3fac6a){return db[_0xd949('0x13')][_0xd949('0x14')]({'raw':_0x37614d[_0xd949('0x15')]?_0x37614d[_0xd949('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x37614d[_0xd949('0x15')]?_0x37614d[_0xd949('0x15')]['where']||null:null,'attributes':_0x37614d['options']?_0x37614d[_0xd949('0x15')][_0xd949('0x16')]||null:null,'limit':_0x37614d[_0xd949('0x15')]?_0x37614d[_0xd949('0x15')]['limit']||null:null,'include':_0x37614d['options']?_0x37614d[_0xd949('0x15')][_0xd949('0x17')]?_[_0xd949('0x18')](_0x37614d[_0xd949('0x15')][_0xd949('0x17')],function(_0x38978f){return{'model':db[_0x38978f[_0xd949('0x19')]],'as':_0x38978f['as'],'attributes':_0x38978f['attributes'],'include':_0x38978f[_0xd949('0x17')]?_[_0xd949('0x18')](_0x38978f[_0xd949('0x17')],function(_0x32701a){return{'model':db[_0x32701a['model']],'as':_0x32701a['as'],'attributes':_0x32701a[_0xd949('0x16')],'include':_0x32701a[_0xd949('0x17')]?_[_0xd949('0x18')](_0x32701a[_0xd949('0x17')],function(_0x31811d){return{'model':db[_0x31811d['model']],'as':_0x31811d['as'],'attributes':_0x31811d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd949('0xa')](function(_0x3f5239){logger['info'](_0xd949('0x1a'),_0x37614d);logger[_0xd949('0x1b')]('GetMailServerIn',_0x37614d,JSON['stringify'](_0x3f5239));_0x5a0790(_0x3f5239);})[_0xd949('0x12')](function(_0x263a42){logger[_0xd949('0xf')](_0xd949('0x1a'),_0x263a42['message'],_0x37614d);_0x3fac6a(_0x2a2859[_0xd949('0xf')](0x1f4,_0x263a42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3aaf123..0c83fa5 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(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x12aebf,_0x2088aa){_0x12aebf=_0x12aebf-0x0;var _0x7f6ab2=_0x7a54[_0x12aebf];return _0x7f6ab2;};'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(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 3426805..3d6f58f 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 _0x3c81=['STRING','BOOLEAN','sequelize','exports'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x3c81,0x102));var _0x13c8=function(_0x5150db,_0x5de41f){_0x5150db=_0x5150db-0x0;var _0x55542a=_0x3c81[_0x5150db];return _0x55542a;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'user':{'type':Sequelize[_0x13c8('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8603=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x1f7e7d,_0x17c02e){var _0x3f2d9f=function(_0x3e2506){while(--_0x3e2506){_0x1f7e7d['push'](_0x1f7e7d['shift']());}};_0x3f2d9f(++_0x17c02e);}(_0x8603,0x190));var _0x3860=function(_0x5b0fad,_0x577006){_0x5b0fad=_0x5b0fad-0x0;var _0x54ecd9=_0x8603[_0x5b0fad];return _0x54ecd9;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'description':{'type':Sequelize[_0x3860('0x1')]},'host':{'type':Sequelize[_0x3860('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3860('0x2')]},'secure':{'type':Sequelize[_0x3860('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x3860('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3860('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 4bdc45c..2bf293a 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 _0xb611=['length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','MailServerOut','rows','show','params','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xb611,0x16f));var _0x1b61=function(_0xc4ea75,_0x273753){_0xc4ea75=_0xc4ea75-0x0;var _0x52ea5e=_0xb611[_0xc4ea75];return _0x52ea5e;};'use strict';var emlformat=require(_0x1b61('0x0'));var rimraf=require(_0x1b61('0x1'));var zipdir=require(_0x1b61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b61('0x3'));var moment=require(_0x1b61('0x4'));var BPromise=require(_0x1b61('0x5'));var Mustache=require(_0x1b61('0x6'));var util=require(_0x1b61('0x7'));var path=require(_0x1b61('0x8'));var sox=require(_0x1b61('0x9'));var csv=require(_0x1b61('0xa'));var ejs=require(_0x1b61('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b61('0xc'));var squel=require(_0x1b61('0xd'));var crypto=require('crypto');var jsforce=require(_0x1b61('0xe'));var deskjs=require(_0x1b61('0xf'));var toCsv=require(_0x1b61('0xa'));var querystring=require(_0x1b61('0x10'));var Papa=require('papaparse');var Redis=require(_0x1b61('0x11'));var authService=require(_0x1b61('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1b61('0x13'));var hardwareService=require(_0x1b61('0x14'));var logger=require('../../config/logger')(_0x1b61('0x15'));var utils=require(_0x1b61('0x16'));var config=require(_0x1b61('0x17'));var licenseUtil=require(_0x1b61('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x231571,_0x378fa9){_0x378fa9=_0x378fa9||0xcc;return function(_0x3231e4){if(_0x3231e4){return _0x231571['sendStatus'](_0x378fa9);}return _0x231571[_0x1b61('0x19')](_0x378fa9)[_0x1b61('0x1a')]();};}function respondWithResult(_0x2ff213,_0x193c01){_0x193c01=_0x193c01||0xc8;return function(_0x4ca2e1){if(_0x4ca2e1){return _0x2ff213[_0x1b61('0x19')](_0x193c01)[_0x1b61('0x1b')](_0x4ca2e1);}};}function respondWithFilteredResult(_0x1cc061,_0x3cd911){return function(_0x4c14af){if(_0x4c14af){var _0x43deeb=typeof _0x3cd911[_0x1b61('0x1c')]==='undefined'&&typeof _0x3cd911[_0x1b61('0x1d')]==='undefined';var _0x210b74=_0x4c14af[_0x1b61('0x1e')];var _0x2a6b55=_0x43deeb?0x0:_0x3cd911[_0x1b61('0x1c')];var _0x5bc8f0=_0x43deeb?_0x4c14af[_0x1b61('0x1e')]:_0x3cd911[_0x1b61('0x1c')]+_0x3cd911['limit'];var _0x33ca3a;if(_0x5bc8f0>=_0x210b74){_0x5bc8f0=_0x210b74;_0x33ca3a=0xc8;}else{_0x33ca3a=0xce;}_0x1cc061[_0x1b61('0x19')](_0x33ca3a);return _0x1cc061[_0x1b61('0x1f')](_0x1b61('0x20'),_0x2a6b55+'-'+_0x5bc8f0+'/'+_0x210b74)[_0x1b61('0x1b')](_0x4c14af);}return null;};}function patchUpdates(_0x5d4b4e){return function(_0x277c01){try{jsonpatch['apply'](_0x277c01,_0x5d4b4e,!![]);}catch(_0x32f992){return BPromise[_0x1b61('0x21')](_0x32f992);}return _0x277c01[_0x1b61('0x22')]();};}function saveUpdates(_0xe24d27,_0x574219){return function(_0x316d40){if(_0x316d40){return _0x316d40[_0x1b61('0x23')](_0xe24d27)[_0x1b61('0x24')](function(_0xb38b90){return _0xb38b90;});}return null;};}function removeEntity(_0x163046,_0x316dfe){return function(_0x1cab58){if(_0x1cab58){return _0x1cab58[_0x1b61('0x25')]()[_0x1b61('0x24')](function(){_0x163046[_0x1b61('0x19')](0xcc)[_0x1b61('0x1a')]();});}};}function handleEntityNotFound(_0x58bbdd,_0x52fb66){return function(_0xb4598a){if(!_0xb4598a){_0x58bbdd[_0x1b61('0x26')](0x194);}return _0xb4598a;};}function handleError(_0x2b0a76,_0x4d6a41){_0x4d6a41=_0x4d6a41||0x1f4;return function(_0x1d4c8c){logger[_0x1b61('0x27')](_0x1d4c8c[_0x1b61('0x28')]);if(_0x1d4c8c[_0x1b61('0x29')]){delete _0x1d4c8c['name'];}_0x2b0a76[_0x1b61('0x19')](_0x4d6a41)['send'](_0x1d4c8c);};}exports['index']=function(_0x4d260c,_0x4375d8){var _0x1e7c53={},_0x1969e4={},_0x1eb289={'count':0x0,'rows':[]};var _0x3d472c=_[_0x1b61('0x2a')](db['MailServerOut'][_0x1b61('0x2b')],function(_0x13d0f4){return{'name':_0x13d0f4['fieldName'],'type':_0x13d0f4[_0x1b61('0x2c')][_0x1b61('0x2d')]};});_0x1969e4[_0x1b61('0x2e')]=_[_0x1b61('0x2a')](_0x3d472c,_0x1b61('0x29'));_0x1969e4['query']=_[_0x1b61('0x2f')](_0x4d260c[_0x1b61('0x30')]);_0x1969e4[_0x1b61('0x31')]=_[_0x1b61('0x32')](_0x1969e4[_0x1b61('0x2e')],_0x1969e4[_0x1b61('0x30')]);_0x1e7c53['attributes']=_[_0x1b61('0x32')](_0x1969e4[_0x1b61('0x2e')],qs['fields'](_0x4d260c[_0x1b61('0x30')][_0x1b61('0x33')]));_0x1e7c53[_0x1b61('0x34')]=_0x1e7c53['attributes'][_0x1b61('0x35')]?_0x1e7c53['attributes']:_0x1969e4['model'];if(!_0x4d260c[_0x1b61('0x30')]['hasOwnProperty']('nolimit')){_0x1e7c53[_0x1b61('0x1d')]=qs[_0x1b61('0x1d')](_0x4d260c['query']['limit']);_0x1e7c53[_0x1b61('0x1c')]=qs['offset'](_0x4d260c['query'][_0x1b61('0x1c')]);}_0x1e7c53['order']=qs[_0x1b61('0x36')](_0x4d260c[_0x1b61('0x30')][_0x1b61('0x36')]);_0x1e7c53[_0x1b61('0x37')]=qs[_0x1b61('0x31')](_[_0x1b61('0x38')](_0x4d260c['query'],_0x1969e4[_0x1b61('0x31')]),_0x3d472c);if(_0x4d260c['query']['filter']){_0x1e7c53['where']=_[_0x1b61('0x39')](_0x1e7c53[_0x1b61('0x37')],{'$or':_[_0x1b61('0x2a')](_0x3d472c,function(_0x451836){if(_0x451836[_0x1b61('0x2c')]!==_0x1b61('0x3a')){var _0x1d7797={};_0x1d7797[_0x451836['name']]={'$like':'%'+_0x4d260c[_0x1b61('0x30')][_0x1b61('0x3b')]+'%'};return _0x1d7797;}})});}_0x1e7c53=_[_0x1b61('0x39')]({},_0x1e7c53,_0x4d260c[_0x1b61('0x3c')]);var _0x2c5a4c={'where':_0x1e7c53[_0x1b61('0x37')]};return db['MailServerOut'][_0x1b61('0x1e')](_0x2c5a4c)[_0x1b61('0x24')](function(_0xce47ed){_0x1eb289[_0x1b61('0x1e')]=_0xce47ed;if(_0x4d260c['query'][_0x1b61('0x3d')]){_0x1e7c53[_0x1b61('0x3e')]=[{'all':!![]}];}return db[_0x1b61('0x3f')]['findAll'](_0x1e7c53);})['then'](function(_0x43dd11){_0x1eb289[_0x1b61('0x40')]=_0x43dd11;return _0x1eb289;})[_0x1b61('0x24')](respondWithFilteredResult(_0x4375d8,_0x1e7c53))['catch'](handleError(_0x4375d8,null));};exports[_0x1b61('0x41')]=function(_0x4c2bc1,_0x3203ea){var _0x4d5056={'raw':!![],'where':{'id':_0x4c2bc1[_0x1b61('0x42')]['id']}},_0x494a1e={};_0x494a1e[_0x1b61('0x2e')]=_[_0x1b61('0x2f')](db[_0x1b61('0x3f')][_0x1b61('0x2b')]);_0x494a1e[_0x1b61('0x30')]=_[_0x1b61('0x2f')](_0x4c2bc1[_0x1b61('0x30')]);_0x494a1e[_0x1b61('0x31')]=_[_0x1b61('0x32')](_0x494a1e[_0x1b61('0x2e')],_0x494a1e[_0x1b61('0x30')]);_0x4d5056['attributes']=_['intersection'](_0x494a1e[_0x1b61('0x2e')],qs[_0x1b61('0x33')](_0x4c2bc1['query']['fields']));_0x4d5056[_0x1b61('0x34')]=_0x4d5056[_0x1b61('0x34')][_0x1b61('0x35')]?_0x4d5056[_0x1b61('0x34')]:_0x494a1e[_0x1b61('0x2e')];if(_0x4c2bc1[_0x1b61('0x30')]['includeAll']){_0x4d5056[_0x1b61('0x3e')]=[{'all':!![]}];}_0x4d5056=_[_0x1b61('0x39')]({},_0x4d5056,_0x4c2bc1[_0x1b61('0x3c')]);return db[_0x1b61('0x3f')][_0x1b61('0x43')](_0x4d5056)['then'](handleEntityNotFound(_0x3203ea,null))['then'](respondWithResult(_0x3203ea,null))['catch'](handleError(_0x3203ea,null));};exports['create']=function(_0x3c4ff6,_0x11119b){return db['MailServerOut']['create'](_0x3c4ff6[_0x1b61('0x44')],{})['then'](respondWithResult(_0x11119b,0xc9))['catch'](handleError(_0x11119b,null));};exports[_0x1b61('0x23')]=function(_0x5b5646,_0x12c6fd){if(_0x5b5646[_0x1b61('0x44')]['id']){delete _0x5b5646[_0x1b61('0x44')]['id'];}return db['MailServerOut'][_0x1b61('0x43')]({'where':{'id':_0x5b5646['params']['id']}})['then'](handleEntityNotFound(_0x12c6fd,null))[_0x1b61('0x24')](saveUpdates(_0x5b5646[_0x1b61('0x44')],null))[_0x1b61('0x24')](respondWithResult(_0x12c6fd,null))[_0x1b61('0x45')](handleError(_0x12c6fd,null));};exports[_0x1b61('0x25')]=function(_0x9f61de,_0x246cd6){return db[_0x1b61('0x3f')][_0x1b61('0x43')]({'where':{'id':_0x9f61de[_0x1b61('0x42')]['id']}})[_0x1b61('0x24')](handleEntityNotFound(_0x246cd6,null))['then'](removeEntity(_0x246cd6,null))[_0x1b61('0x45')](handleError(_0x246cd6,null));}; \ No newline at end of file +var _0xd928=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','index','rawAttributes','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','filter','merge','map','options','includeAll','include','MailServerOut','findAll','rows','catch','show','params','fields','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xd928,0x82));var _0x8d92=function(_0x357bfa,_0x627922){_0x357bfa=_0x357bfa-0x0;var _0x507b74=_0xd928[_0x357bfa];return _0x507b74;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d92('0x0'));var jsonpatch=require(_0x8d92('0x1'));var rp=require(_0x8d92('0x2'));var moment=require(_0x8d92('0x3'));var BPromise=require(_0x8d92('0x4'));var Mustache=require(_0x8d92('0x5'));var util=require(_0x8d92('0x6'));var path=require(_0x8d92('0x7'));var sox=require(_0x8d92('0x8'));var csv=require(_0x8d92('0x9'));var ejs=require(_0x8d92('0xa'));var fs=require('fs');var fs_extra=require(_0x8d92('0xb'));var _=require(_0x8d92('0xc'));var squel=require(_0x8d92('0xd'));var crypto=require(_0x8d92('0xe'));var jsforce=require(_0x8d92('0xf'));var deskjs=require(_0x8d92('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d92('0x11'));var Papa=require('papaparse');var Redis=require(_0x8d92('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8d92('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d92('0x14'))(_0x8d92('0x15'));var utils=require('../../config/utils');var config=require(_0x8d92('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d92('0x17'))['db'];function respondWithStatusCode(_0x1c9f63,_0x5a95f5){_0x5a95f5=_0x5a95f5||0xcc;return function(_0x20dec0){if(_0x20dec0){return _0x1c9f63[_0x8d92('0x18')](_0x5a95f5);}return _0x1c9f63[_0x8d92('0x19')](_0x5a95f5)['end']();};}function respondWithResult(_0x1a7fba,_0x3e965a){_0x3e965a=_0x3e965a||0xc8;return function(_0x39cb3d){if(_0x39cb3d){return _0x1a7fba[_0x8d92('0x19')](_0x3e965a)['json'](_0x39cb3d);}};}function respondWithFilteredResult(_0x150b96,_0x520215){return function(_0x544006){if(_0x544006){var _0x20d601=typeof _0x520215[_0x8d92('0x1a')]===_0x8d92('0x1b')&&typeof _0x520215['limit']===_0x8d92('0x1b');var _0x2f8423=_0x544006[_0x8d92('0x1c')];var _0xa099d4=_0x20d601?0x0:_0x520215[_0x8d92('0x1a')];var _0x25b20e=_0x20d601?_0x544006['count']:_0x520215[_0x8d92('0x1a')]+_0x520215[_0x8d92('0x1d')];var _0x478b6a;if(_0x25b20e>=_0x2f8423){_0x25b20e=_0x2f8423;_0x478b6a=0xc8;}else{_0x478b6a=0xce;}_0x150b96[_0x8d92('0x19')](_0x478b6a);return _0x150b96[_0x8d92('0x1e')](_0x8d92('0x1f'),_0xa099d4+'-'+_0x25b20e+'/'+_0x2f8423)[_0x8d92('0x20')](_0x544006);}return null;};}function patchUpdates(_0xebd7c3){return function(_0x57f2f5){try{jsonpatch[_0x8d92('0x21')](_0x57f2f5,_0xebd7c3,!![]);}catch(_0x2abd69){return BPromise[_0x8d92('0x22')](_0x2abd69);}return _0x57f2f5['save']();};}function saveUpdates(_0x124e9b,_0x3c59d1){return function(_0x351d2e){if(_0x351d2e){return _0x351d2e[_0x8d92('0x23')](_0x124e9b)[_0x8d92('0x24')](function(_0x4a73b0){return _0x4a73b0;});}return null;};}function removeEntity(_0x170316,_0x2a4e4f){return function(_0x52c239){if(_0x52c239){return _0x52c239[_0x8d92('0x25')]()[_0x8d92('0x24')](function(){_0x170316[_0x8d92('0x19')](0xcc)[_0x8d92('0x26')]();});}};}function handleEntityNotFound(_0x2e3753,_0x485094){return function(_0x4abb27){if(!_0x4abb27){_0x2e3753[_0x8d92('0x18')](0x194);}return _0x4abb27;};}function handleError(_0x49d44e,_0x3ee5f8){_0x3ee5f8=_0x3ee5f8||0x1f4;return function(_0x40f4b3){logger[_0x8d92('0x27')](_0x40f4b3[_0x8d92('0x28')]);if(_0x40f4b3['name']){delete _0x40f4b3[_0x8d92('0x29')];}_0x49d44e[_0x8d92('0x19')](_0x3ee5f8)['send'](_0x40f4b3);};}exports[_0x8d92('0x2a')]=function(_0x4d93cf,_0x24786e){var _0x5bab69={},_0x4e5adf={},_0x2143ff={'count':0x0,'rows':[]};var _0x581e87=_['map'](db['MailServerOut'][_0x8d92('0x2b')],function(_0x5d8122){return{'name':_0x5d8122['fieldName'],'type':_0x5d8122[_0x8d92('0x2c')]['key']};});_0x4e5adf['model']=_['map'](_0x581e87,'name');_0x4e5adf[_0x8d92('0x2d')]=_[_0x8d92('0x2e')](_0x4d93cf[_0x8d92('0x2d')]);_0x4e5adf[_0x8d92('0x2f')]=_[_0x8d92('0x30')](_0x4e5adf[_0x8d92('0x31')],_0x4e5adf[_0x8d92('0x2d')]);_0x5bab69[_0x8d92('0x32')]=_[_0x8d92('0x30')](_0x4e5adf[_0x8d92('0x31')],qs['fields'](_0x4d93cf[_0x8d92('0x2d')]['fields']));_0x5bab69[_0x8d92('0x32')]=_0x5bab69[_0x8d92('0x32')][_0x8d92('0x33')]?_0x5bab69[_0x8d92('0x32')]:_0x4e5adf[_0x8d92('0x31')];if(!_0x4d93cf[_0x8d92('0x2d')][_0x8d92('0x34')]('nolimit')){_0x5bab69['limit']=qs[_0x8d92('0x1d')](_0x4d93cf['query'][_0x8d92('0x1d')]);_0x5bab69['offset']=qs[_0x8d92('0x1a')](_0x4d93cf[_0x8d92('0x2d')][_0x8d92('0x1a')]);}_0x5bab69['order']=qs['sort'](_0x4d93cf[_0x8d92('0x2d')][_0x8d92('0x35')]);_0x5bab69[_0x8d92('0x36')]=qs['filters'](_['pick'](_0x4d93cf[_0x8d92('0x2d')],_0x4e5adf['filters']),_0x581e87);if(_0x4d93cf[_0x8d92('0x2d')][_0x8d92('0x37')]){_0x5bab69[_0x8d92('0x36')]=_[_0x8d92('0x38')](_0x5bab69['where'],{'$or':_[_0x8d92('0x39')](_0x581e87,function(_0x2b96cd){if(_0x2b96cd[_0x8d92('0x2c')]!=='VIRTUAL'){var _0x4285fe={};_0x4285fe[_0x2b96cd['name']]={'$like':'%'+_0x4d93cf[_0x8d92('0x2d')][_0x8d92('0x37')]+'%'};return _0x4285fe;}})});}_0x5bab69=_[_0x8d92('0x38')]({},_0x5bab69,_0x4d93cf[_0x8d92('0x3a')]);var _0x5df51a={'where':_0x5bab69[_0x8d92('0x36')]};return db['MailServerOut']['count'](_0x5df51a)[_0x8d92('0x24')](function(_0x15e199){_0x2143ff['count']=_0x15e199;if(_0x4d93cf[_0x8d92('0x2d')][_0x8d92('0x3b')]){_0x5bab69[_0x8d92('0x3c')]=[{'all':!![]}];}return db[_0x8d92('0x3d')][_0x8d92('0x3e')](_0x5bab69);})[_0x8d92('0x24')](function(_0x2056fd){_0x2143ff[_0x8d92('0x3f')]=_0x2056fd;return _0x2143ff;})['then'](respondWithFilteredResult(_0x24786e,_0x5bab69))[_0x8d92('0x40')](handleError(_0x24786e,null));};exports[_0x8d92('0x41')]=function(_0x12df53,_0xda59d4){var _0x503852={'raw':!![],'where':{'id':_0x12df53[_0x8d92('0x42')]['id']}},_0x47e4c1={};_0x47e4c1[_0x8d92('0x31')]=_['keys'](db[_0x8d92('0x3d')][_0x8d92('0x2b')]);_0x47e4c1[_0x8d92('0x2d')]=_[_0x8d92('0x2e')](_0x12df53['query']);_0x47e4c1[_0x8d92('0x2f')]=_['intersection'](_0x47e4c1[_0x8d92('0x31')],_0x47e4c1[_0x8d92('0x2d')]);_0x503852[_0x8d92('0x32')]=_['intersection'](_0x47e4c1[_0x8d92('0x31')],qs[_0x8d92('0x43')](_0x12df53[_0x8d92('0x2d')][_0x8d92('0x43')]));_0x503852['attributes']=_0x503852[_0x8d92('0x32')]['length']?_0x503852[_0x8d92('0x32')]:_0x47e4c1['model'];if(_0x12df53[_0x8d92('0x2d')][_0x8d92('0x3b')]){_0x503852['include']=[{'all':!![]}];}_0x503852=_['merge']({},_0x503852,_0x12df53[_0x8d92('0x3a')]);return db['MailServerOut'][_0x8d92('0x44')](_0x503852)['then'](handleEntityNotFound(_0xda59d4,null))['then'](respondWithResult(_0xda59d4,null))['catch'](handleError(_0xda59d4,null));};exports[_0x8d92('0x45')]=function(_0x450b95,_0x233208){return db[_0x8d92('0x3d')][_0x8d92('0x45')](_0x450b95[_0x8d92('0x46')],{})[_0x8d92('0x24')](respondWithResult(_0x233208,0xc9))[_0x8d92('0x40')](handleError(_0x233208,null));};exports[_0x8d92('0x23')]=function(_0xf8ccdc,_0x26ee17){if(_0xf8ccdc[_0x8d92('0x46')]['id']){delete _0xf8ccdc[_0x8d92('0x46')]['id'];}return db[_0x8d92('0x3d')][_0x8d92('0x44')]({'where':{'id':_0xf8ccdc['params']['id']}})[_0x8d92('0x24')](handleEntityNotFound(_0x26ee17,null))['then'](saveUpdates(_0xf8ccdc['body'],null))['then'](respondWithResult(_0x26ee17,null))[_0x8d92('0x40')](handleError(_0x26ee17,null));};exports[_0x8d92('0x25')]=function(_0x4acd9a,_0xc49643){return db[_0x8d92('0x3d')][_0x8d92('0x44')]({'where':{'id':_0x4acd9a[_0x8d92('0x42')]['id']}})[_0x8d92('0x24')](handleEntityNotFound(_0xc49643,null))[_0x8d92('0x24')](removeEntity(_0xc49643,null))['catch'](handleError(_0xc49643,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 54c3c57..e9f296a 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 _0x3d27=['MailServerOut','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x38db92,_0x593c17){var _0x544d98=function(_0x5885eb){while(--_0x5885eb){_0x38db92['push'](_0x38db92['shift']());}};_0x544d98(++_0x593c17);}(_0x3d27,0x160));var _0x73d2=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x3d27[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x73d2('0x0'));var util=require('util');var logger=require(_0x73d2('0x1'))(_0x73d2('0x2'));var moment=require(_0x73d2('0x3'));var BPromise=require(_0x73d2('0x4'));var rp=require(_0x73d2('0x5'));var fs=require('fs');var path=require(_0x73d2('0x6'));var rimraf=require(_0x73d2('0x7'));var config=require(_0x73d2('0x8'));var attributes=require(_0x73d2('0x9'));module[_0x73d2('0xa')]=function(_0x4a9ceb,_0x50bdec){return _0x4a9ceb[_0x73d2('0xb')](_0x73d2('0xc'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4dc=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./mailServerOut.attributes','define','MailServerOut','mail_servers_out'];(function(_0x3c5e8b,_0x17513d){var _0x1784b6=function(_0x31cb23){while(--_0x31cb23){_0x3c5e8b['push'](_0x3c5e8b['shift']());}};_0x1784b6(++_0x17513d);}(_0xe4dc,0x155));var _0xce4d=function(_0x596dd9,_0x4125ba){_0x596dd9=_0x596dd9-0x0;var _0x2331ca=_0xe4dc[_0x596dd9];return _0x2331ca;};'use strict';var _=require(_0xce4d('0x0'));var util=require(_0xce4d('0x1'));var logger=require(_0xce4d('0x2'))('api');var moment=require(_0xce4d('0x3'));var BPromise=require('bluebird');var rp=require(_0xce4d('0x4'));var fs=require('fs');var path=require(_0xce4d('0x5'));var rimraf=require(_0xce4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce4d('0x7'));module['exports']=function(_0xb3c2e5,_0x509e28){return _0xb3c2e5[_0xce4d('0x8')](_0xce4d('0x9'),attributes,{'tableName':_0xce4d('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 bea170a..03216da 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3acb63,_0x17ba67){var _0x4fda59=function(_0xb88094){while(--_0xb88094){_0x3acb63['push'](_0x3acb63['shift']());}};_0x4fda59(++_0x17ba67);}(_0x1261,0x144));var _0x1126=function(_0x51b2f7,_0x303ad2){_0x51b2f7=_0x51b2f7-0x0;var _0x556d95=_0x1261[_0x51b2f7];return _0x556d95;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x59072f,_0x58bd47){var _0x7e46c2=function(_0x53b23c){while(--_0x53b23c){_0x59072f['push'](_0x59072f['shift']());}};_0x7e46c2(++_0x58bd47);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2cf14ac..8f626ce 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 _0x674d=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','util','path'];(function(_0x3ca401,_0x533084){var _0x31797a=function(_0x2b293a){while(--_0x2b293a){_0x3ca401['push'](_0x3ca401['shift']());}};_0x31797a(++_0x533084);}(_0x674d,0xa9));var _0xd674=function(_0xf46ea,_0xd97598){_0xf46ea=_0xf46ea-0x0;var _0x363349=_0x674d[_0xf46ea];return _0x363349;};'use strict';var multer=require('multer');var util=require(_0xd674('0x0'));var path=require(_0xd674('0x1'));var timeout=require(_0xd674('0x2'));var express=require(_0xd674('0x3'));var router=express['Router']();var fs_extra=require(_0xd674('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd674('0x5'));var config=require(_0xd674('0x6'));var controller=require(_0xd674('0x7'));router[_0xd674('0x8')]('/',auth[_0xd674('0x9')](),controller[_0xd674('0xa')]);router[_0xd674('0x8')](_0xd674('0xb'),auth[_0xd674('0x9')](),controller[_0xd674('0xc')]);router['get'](_0xd674('0xd'),auth[_0xd674('0x9')](),controller[_0xd674('0xe')]);router[_0xd674('0xf')]('/',auth[_0xd674('0x9')](),controller['create']);router[_0xd674('0x10')](_0xd674('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd674('0x11')](_0xd674('0xd'),auth[_0xd674('0x9')](),controller[_0xd674('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd657=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete','exports'];(function(_0x8a5d2b,_0x4bfcf3){var _0x30041b=function(_0x321109){while(--_0x321109){_0x8a5d2b['push'](_0x8a5d2b['shift']());}};_0x30041b(++_0x4bfcf3);}(_0xd657,0x168));var _0x7d65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd657[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7d65('0x0'));var path=require('path');var timeout=require(_0x7d65('0x1'));var express=require(_0x7d65('0x2'));var router=express[_0x7d65('0x3')]();var fs_extra=require(_0x7d65('0x4'));var auth=require(_0x7d65('0x5'));var interaction=require(_0x7d65('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x7d65('0x7')](),controller[_0x7d65('0x8')]);router[_0x7d65('0x9')](_0x7d65('0xa'),auth[_0x7d65('0x7')](),controller[_0x7d65('0xb')]);router['get'](_0x7d65('0xc'),auth['isAuthenticated'](),controller[_0x7d65('0xd')]);router['post']('/',auth[_0x7d65('0x7')](),controller[_0x7d65('0xe')]);router[_0x7d65('0xf')]('/:id',auth[_0x7d65('0x7')](),controller['update']);router[_0x7d65('0x10')](_0x7d65('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7d65('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0c4882d..17f289b 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 _0xef17=['STRING','name','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef17,0x136));var _0x7ef1=function(_0x2d8916,_0x412ebe){_0x2d8916=_0x2d8916-0x0;var _0x2c1890=_0xef17[_0x2d8916];return _0x2c1890;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'unique':_0x7ef1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file +var _0xb091=['exports','STRING','name'];(function(_0xd0716a,_0x1f7fad){var _0x4e6ec1=function(_0x382c71){while(--_0x382c71){_0xd0716a['push'](_0xd0716a['shift']());}};_0x4e6ec1(++_0x1f7fad);}(_0xb091,0x16e));var _0x1b09=function(_0x35ee30,_0x2ee24c){_0x35ee30=_0x35ee30-0x0;var _0x557de5=_0xb091[_0x35ee30];return _0x557de5;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'unique':_0x1b09('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b09('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 91350b1..07d5e33 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 _0x553d=['path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x50628b,_0x1a385e){var _0x2ea4b3=function(_0x306e28){while(--_0x306e28){_0x50628b['push'](_0x50628b['shift']());}};_0x2ea4b3(++_0x1a385e);}(_0x553d,0x90));var _0xd553=function(_0x141850,_0xd4bab3){_0x141850=_0x141850-0x0;var _0x2a6257=_0x553d[_0x141850];return _0x2a6257;};'use strict';var emlformat=require(_0xd553('0x0'));var rimraf=require(_0xd553('0x1'));var zipdir=require(_0xd553('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd553('0x3'));var moment=require(_0xd553('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd553('0x5'));var util=require('util');var path=require(_0xd553('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd553('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd553('0x8'));var squel=require('squel');var crypto=require(_0xd553('0x9'));var jsforce=require(_0xd553('0xa'));var deskjs=require(_0xd553('0xb'));var toCsv=require(_0xd553('0xc'));var querystring=require('querystring');var Papa=require(_0xd553('0xd'));var Redis=require(_0xd553('0xe'));var authService=require(_0xd553('0xf'));var qs=require(_0xd553('0x10'));var as=require(_0xd553('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd553('0x12'))(_0xd553('0x13'));var utils=require(_0xd553('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53529f,_0x11e2b2){_0x11e2b2=_0x11e2b2||0xcc;return function(_0x1a724a){if(_0x1a724a){return _0x53529f[_0xd553('0x15')](_0x11e2b2);}return _0x53529f[_0xd553('0x16')](_0x11e2b2)[_0xd553('0x17')]();};}function respondWithResult(_0x187419,_0x1e94d3){_0x1e94d3=_0x1e94d3||0xc8;return function(_0x4fadd9){if(_0x4fadd9){return _0x187419[_0xd553('0x16')](_0x1e94d3)[_0xd553('0x18')](_0x4fadd9);}};}function respondWithFilteredResult(_0x3897e9,_0xe4a02b){return function(_0x28d1d2){if(_0x28d1d2){var _0x1df184=typeof _0xe4a02b['offset']==='undefined'&&typeof _0xe4a02b['limit']===_0xd553('0x19');var _0x196e55=_0x28d1d2[_0xd553('0x1a')];var _0xf49c4a=_0x1df184?0x0:_0xe4a02b[_0xd553('0x1b')];var _0x4dbe78=_0x1df184?_0x28d1d2[_0xd553('0x1a')]:_0xe4a02b[_0xd553('0x1b')]+_0xe4a02b[_0xd553('0x1c')];var _0x1ed3a6;if(_0x4dbe78>=_0x196e55){_0x4dbe78=_0x196e55;_0x1ed3a6=0xc8;}else{_0x1ed3a6=0xce;}_0x3897e9[_0xd553('0x16')](_0x1ed3a6);return _0x3897e9[_0xd553('0x1d')](_0xd553('0x1e'),_0xf49c4a+'-'+_0x4dbe78+'/'+_0x196e55)[_0xd553('0x18')](_0x28d1d2);}return null;};}function patchUpdates(_0x2a8073){return function(_0x58941b){try{jsonpatch[_0xd553('0x1f')](_0x58941b,_0x2a8073,!![]);}catch(_0x481cdd){return BPromise[_0xd553('0x20')](_0x481cdd);}return _0x58941b[_0xd553('0x21')]();};}function saveUpdates(_0x1ede36,_0x2d10b5){return function(_0x3a8f89){if(_0x3a8f89){return _0x3a8f89[_0xd553('0x22')](_0x1ede36)[_0xd553('0x23')](function(_0x42e2ee){return _0x42e2ee;});}return null;};}function removeEntity(_0x4f0e2d,_0x4d034a){return function(_0x55e3fe){if(_0x55e3fe){return _0x55e3fe[_0xd553('0x24')]()[_0xd553('0x23')](function(){_0x4f0e2d[_0xd553('0x16')](0xcc)[_0xd553('0x17')]();});}};}function handleEntityNotFound(_0x13cb3f,_0x53ad7d){return function(_0x4f3ac1){if(!_0x4f3ac1){_0x13cb3f[_0xd553('0x15')](0x194);}return _0x4f3ac1;};}function handleError(_0x5328e8,_0x4ffa8c){_0x4ffa8c=_0x4ffa8c||0x1f4;return function(_0x3a94fe){logger[_0xd553('0x25')](_0x3a94fe[_0xd553('0x26')]);if(_0x3a94fe[_0xd553('0x27')]){delete _0x3a94fe[_0xd553('0x27')];}_0x5328e8[_0xd553('0x16')](_0x4ffa8c)[_0xd553('0x28')](_0x3a94fe);};}exports[_0xd553('0x29')]=function(_0x241b4f,_0x4299f9){var _0x390373={},_0x43e082={},_0x2bf142={'count':0x0,'rows':[]};var _0x59ac57=_[_0xd553('0x2a')](db[_0xd553('0x2b')][_0xd553('0x2c')],function(_0xda67f6){return{'name':_0xda67f6[_0xd553('0x2d')],'type':_0xda67f6[_0xd553('0x2e')][_0xd553('0x2f')]};});_0x43e082[_0xd553('0x30')]=_[_0xd553('0x2a')](_0x59ac57,_0xd553('0x27'));_0x43e082['query']=_[_0xd553('0x31')](_0x241b4f[_0xd553('0x32')]);_0x43e082[_0xd553('0x33')]=_[_0xd553('0x34')](_0x43e082[_0xd553('0x30')],_0x43e082['query']);_0x390373[_0xd553('0x35')]=_[_0xd553('0x34')](_0x43e082[_0xd553('0x30')],qs[_0xd553('0x36')](_0x241b4f[_0xd553('0x32')][_0xd553('0x36')]));_0x390373[_0xd553('0x35')]=_0x390373['attributes']['length']?_0x390373[_0xd553('0x35')]:_0x43e082[_0xd553('0x30')];if(!_0x241b4f[_0xd553('0x32')]['hasOwnProperty'](_0xd553('0x37'))){_0x390373[_0xd553('0x1c')]=qs[_0xd553('0x1c')](_0x241b4f[_0xd553('0x32')][_0xd553('0x1c')]);_0x390373['offset']=qs['offset'](_0x241b4f[_0xd553('0x32')][_0xd553('0x1b')]);}_0x390373[_0xd553('0x38')]=qs['sort'](_0x241b4f[_0xd553('0x32')][_0xd553('0x39')]);_0x390373['where']=qs[_0xd553('0x33')](_[_0xd553('0x3a')](_0x241b4f['query'],_0x43e082[_0xd553('0x33')]),_0x59ac57);if(_0x241b4f[_0xd553('0x32')]['filter']){_0x390373['where']=_[_0xd553('0x3b')](_0x390373[_0xd553('0x3c')],{'$or':_[_0xd553('0x2a')](_0x59ac57,function(_0x6ce966){if(_0x6ce966['type']!==_0xd553('0x3d')){var _0x5b2847={};_0x5b2847[_0x6ce966[_0xd553('0x27')]]={'$like':'%'+_0x241b4f[_0xd553('0x32')][_0xd553('0x3e')]+'%'};return _0x5b2847;}})});}_0x390373=_[_0xd553('0x3b')]({},_0x390373,_0x241b4f[_0xd553('0x3f')]);var _0x4b295e={'where':_0x390373[_0xd553('0x3c')]};return db[_0xd553('0x2b')][_0xd553('0x1a')](_0x4b295e)['then'](function(_0x878727){_0x2bf142[_0xd553('0x1a')]=_0x878727;if(_0x241b4f[_0xd553('0x32')][_0xd553('0x40')]){_0x390373[_0xd553('0x41')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x390373);})[_0xd553('0x23')](function(_0x3124a0){_0x2bf142[_0xd553('0x42')]=_0x3124a0;return _0x2bf142;})[_0xd553('0x23')](respondWithFilteredResult(_0x4299f9,_0x390373))[_0xd553('0x43')](handleError(_0x4299f9,null));};exports[_0xd553('0x44')]=function(_0x557ee6,_0x42353d){var _0x59d226={'raw':!![],'where':{'id':_0x557ee6[_0xd553('0x45')]['id']}},_0x1720db={};_0x1720db[_0xd553('0x30')]=_[_0xd553('0x31')](db[_0xd553('0x2b')][_0xd553('0x2c')]);_0x1720db[_0xd553('0x32')]=_[_0xd553('0x31')](_0x557ee6['query']);_0x1720db[_0xd553('0x33')]=_[_0xd553('0x34')](_0x1720db['model'],_0x1720db[_0xd553('0x32')]);_0x59d226[_0xd553('0x35')]=_[_0xd553('0x34')](_0x1720db[_0xd553('0x30')],qs['fields'](_0x557ee6[_0xd553('0x32')][_0xd553('0x36')]));_0x59d226[_0xd553('0x35')]=_0x59d226['attributes'][_0xd553('0x46')]?_0x59d226['attributes']:_0x1720db[_0xd553('0x30')];if(_0x557ee6['query'][_0xd553('0x40')]){_0x59d226[_0xd553('0x41')]=[{'all':!![]}];}_0x59d226=_['merge']({},_0x59d226,_0x557ee6[_0xd553('0x3f')]);return db[_0xd553('0x2b')][_0xd553('0x47')](_0x59d226)[_0xd553('0x23')](handleEntityNotFound(_0x42353d,null))[_0xd553('0x23')](respondWithResult(_0x42353d,null))[_0xd553('0x43')](handleError(_0x42353d,null));};exports['create']=function(_0x305c60,_0x16bd24){return db[_0xd553('0x2b')][_0xd553('0x48')](_0x305c60[_0xd553('0x49')],{})['then'](respondWithResult(_0x16bd24,0xc9))['catch'](handleError(_0x16bd24,null));};exports[_0xd553('0x22')]=function(_0x2c4ab8,_0x242691){if(_0x2c4ab8[_0xd553('0x49')]['id']){delete _0x2c4ab8['body']['id'];}return db[_0xd553('0x2b')][_0xd553('0x47')]({'where':{'id':_0x2c4ab8['params']['id']}})[_0xd553('0x23')](handleEntityNotFound(_0x242691,null))[_0xd553('0x23')](saveUpdates(_0x2c4ab8[_0xd553('0x49')],null))[_0xd553('0x23')](respondWithResult(_0x242691,null))[_0xd553('0x43')](handleError(_0x242691,null));};exports[_0xd553('0x24')]=function(_0x4351fa,_0x996c8f){return db['MailSubstatus'][_0xd553('0x47')]({'where':{'id':_0x4351fa['params']['id']}})[_0xd553('0x23')](handleEntityNotFound(_0x996c8f,null))[_0xd553('0x23')](removeEntity(_0x996c8f,null))['catch'](handleError(_0x996c8f,null));};exports[_0xd553('0x4a')]=function(_0x29fd30,_0x240cf1){return db['MailSubstatus'][_0xd553('0x4a')]()[_0xd553('0x23')](respondWithResult(_0x240cf1,null))['catch'](handleError(_0x240cf1,null));}; \ No newline at end of file +var _0x1a29=['pick','merge','type','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','MailSubstatus','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1a29,0xa2));var _0x91a2=function(_0x5c3a3f,_0x3adaf8){_0x5c3a3f=_0x5c3a3f-0x0;var _0x1f6105=_0x1a29[_0x5c3a3f];return _0x1f6105;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x91a2('0x0'));var rp=require(_0x91a2('0x1'));var moment=require(_0x91a2('0x2'));var BPromise=require(_0x91a2('0x3'));var Mustache=require(_0x91a2('0x4'));var util=require(_0x91a2('0x5'));var path=require(_0x91a2('0x6'));var sox=require(_0x91a2('0x7'));var csv=require(_0x91a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91a2('0x9'));var squel=require('squel');var crypto=require(_0x91a2('0xa'));var jsforce=require(_0x91a2('0xb'));var deskjs=require(_0x91a2('0xc'));var toCsv=require(_0x91a2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91a2('0xd'));var qs=require(_0x91a2('0xe'));var as=require(_0x91a2('0xf'));var hardwareService=require(_0x91a2('0x10'));var logger=require(_0x91a2('0x11'))(_0x91a2('0x12'));var utils=require(_0x91a2('0x13'));var config=require(_0x91a2('0x14'));var licenseUtil=require(_0x91a2('0x15'));var db=require(_0x91a2('0x16'))['db'];function respondWithStatusCode(_0x14d702,_0x417545){_0x417545=_0x417545||0xcc;return function(_0x3e59ca){if(_0x3e59ca){return _0x14d702[_0x91a2('0x17')](_0x417545);}return _0x14d702[_0x91a2('0x18')](_0x417545)[_0x91a2('0x19')]();};}function respondWithResult(_0x316061,_0x7d50dd){_0x7d50dd=_0x7d50dd||0xc8;return function(_0x4350d3){if(_0x4350d3){return _0x316061[_0x91a2('0x18')](_0x7d50dd)[_0x91a2('0x1a')](_0x4350d3);}};}function respondWithFilteredResult(_0x5b80cd,_0x1e3371){return function(_0x4036ae){if(_0x4036ae){var _0x10b6b3=typeof _0x1e3371[_0x91a2('0x1b')]===_0x91a2('0x1c')&&typeof _0x1e3371[_0x91a2('0x1d')]===_0x91a2('0x1c');var _0x363097=_0x4036ae[_0x91a2('0x1e')];var _0x1a29f5=_0x10b6b3?0x0:_0x1e3371[_0x91a2('0x1b')];var _0x3ae638=_0x10b6b3?_0x4036ae[_0x91a2('0x1e')]:_0x1e3371[_0x91a2('0x1b')]+_0x1e3371[_0x91a2('0x1d')];var _0x3c9bb0;if(_0x3ae638>=_0x363097){_0x3ae638=_0x363097;_0x3c9bb0=0xc8;}else{_0x3c9bb0=0xce;}_0x5b80cd[_0x91a2('0x18')](_0x3c9bb0);return _0x5b80cd[_0x91a2('0x1f')](_0x91a2('0x20'),_0x1a29f5+'-'+_0x3ae638+'/'+_0x363097)[_0x91a2('0x1a')](_0x4036ae);}return null;};}function patchUpdates(_0x4afe7a){return function(_0x2d2861){try{jsonpatch[_0x91a2('0x21')](_0x2d2861,_0x4afe7a,!![]);}catch(_0x509b52){return BPromise[_0x91a2('0x22')](_0x509b52);}return _0x2d2861['save']();};}function saveUpdates(_0x5d0eca,_0x2a25df){return function(_0x2001e6){if(_0x2001e6){return _0x2001e6[_0x91a2('0x23')](_0x5d0eca)[_0x91a2('0x24')](function(_0x211daa){return _0x211daa;});}return null;};}function removeEntity(_0x1f46cf,_0x43075f){return function(_0x281ae5){if(_0x281ae5){return _0x281ae5['destroy']()[_0x91a2('0x24')](function(){_0x1f46cf['status'](0xcc)[_0x91a2('0x19')]();});}};}function handleEntityNotFound(_0x8d3901,_0x1f522f){return function(_0x510601){if(!_0x510601){_0x8d3901['sendStatus'](0x194);}return _0x510601;};}function handleError(_0x5b68b1,_0x3165a5){_0x3165a5=_0x3165a5||0x1f4;return function(_0x4d4698){logger['error'](_0x4d4698[_0x91a2('0x25')]);if(_0x4d4698[_0x91a2('0x26')]){delete _0x4d4698[_0x91a2('0x26')];}_0x5b68b1[_0x91a2('0x18')](_0x3165a5)[_0x91a2('0x27')](_0x4d4698);};}exports[_0x91a2('0x28')]=function(_0x408bb0,_0x3cdbf7){var _0x44e79d={},_0x55bc02={},_0x2c0b5f={'count':0x0,'rows':[]};var _0x208010=_[_0x91a2('0x29')](db[_0x91a2('0x2a')]['rawAttributes'],function(_0x496000){return{'name':_0x496000[_0x91a2('0x2b')],'type':_0x496000['type'][_0x91a2('0x2c')]};});_0x55bc02[_0x91a2('0x2d')]=_[_0x91a2('0x29')](_0x208010,'name');_0x55bc02[_0x91a2('0x2e')]=_[_0x91a2('0x2f')](_0x408bb0['query']);_0x55bc02[_0x91a2('0x30')]=_[_0x91a2('0x31')](_0x55bc02[_0x91a2('0x2d')],_0x55bc02[_0x91a2('0x2e')]);_0x44e79d[_0x91a2('0x32')]=_[_0x91a2('0x31')](_0x55bc02[_0x91a2('0x2d')],qs[_0x91a2('0x33')](_0x408bb0[_0x91a2('0x2e')]['fields']));_0x44e79d['attributes']=_0x44e79d[_0x91a2('0x32')][_0x91a2('0x34')]?_0x44e79d['attributes']:_0x55bc02[_0x91a2('0x2d')];if(!_0x408bb0[_0x91a2('0x2e')][_0x91a2('0x35')]('nolimit')){_0x44e79d[_0x91a2('0x1d')]=qs[_0x91a2('0x1d')](_0x408bb0[_0x91a2('0x2e')][_0x91a2('0x1d')]);_0x44e79d['offset']=qs[_0x91a2('0x1b')](_0x408bb0[_0x91a2('0x2e')]['offset']);}_0x44e79d[_0x91a2('0x36')]=qs['sort'](_0x408bb0[_0x91a2('0x2e')][_0x91a2('0x37')]);_0x44e79d[_0x91a2('0x38')]=qs[_0x91a2('0x30')](_[_0x91a2('0x39')](_0x408bb0['query'],_0x55bc02[_0x91a2('0x30')]),_0x208010);if(_0x408bb0[_0x91a2('0x2e')]['filter']){_0x44e79d['where']=_[_0x91a2('0x3a')](_0x44e79d[_0x91a2('0x38')],{'$or':_['map'](_0x208010,function(_0x5d73fd){if(_0x5d73fd[_0x91a2('0x3b')]!=='VIRTUAL'){var _0x43fc68={};_0x43fc68[_0x5d73fd[_0x91a2('0x26')]]={'$like':'%'+_0x408bb0[_0x91a2('0x2e')][_0x91a2('0x3c')]+'%'};return _0x43fc68;}})});}_0x44e79d=_['merge']({},_0x44e79d,_0x408bb0[_0x91a2('0x3d')]);var _0x9efbf3={'where':_0x44e79d[_0x91a2('0x38')]};return db['MailSubstatus'][_0x91a2('0x1e')](_0x9efbf3)['then'](function(_0x584d3c){_0x2c0b5f[_0x91a2('0x1e')]=_0x584d3c;if(_0x408bb0[_0x91a2('0x2e')][_0x91a2('0x3e')]){_0x44e79d['include']=[{'all':!![]}];}return db[_0x91a2('0x2a')][_0x91a2('0x3f')](_0x44e79d);})[_0x91a2('0x24')](function(_0x43c56d){_0x2c0b5f[_0x91a2('0x40')]=_0x43c56d;return _0x2c0b5f;})[_0x91a2('0x24')](respondWithFilteredResult(_0x3cdbf7,_0x44e79d))[_0x91a2('0x41')](handleError(_0x3cdbf7,null));};exports[_0x91a2('0x42')]=function(_0x18f3e9,_0xc0aeb4){var _0xedfcd1={'raw':!![],'where':{'id':_0x18f3e9[_0x91a2('0x43')]['id']}},_0x5827ac={};_0x5827ac[_0x91a2('0x2d')]=_[_0x91a2('0x2f')](db['MailSubstatus']['rawAttributes']);_0x5827ac['query']=_[_0x91a2('0x2f')](_0x18f3e9[_0x91a2('0x2e')]);_0x5827ac[_0x91a2('0x30')]=_['intersection'](_0x5827ac[_0x91a2('0x2d')],_0x5827ac[_0x91a2('0x2e')]);_0xedfcd1[_0x91a2('0x32')]=_['intersection'](_0x5827ac[_0x91a2('0x2d')],qs[_0x91a2('0x33')](_0x18f3e9[_0x91a2('0x2e')]['fields']));_0xedfcd1[_0x91a2('0x32')]=_0xedfcd1[_0x91a2('0x32')]['length']?_0xedfcd1[_0x91a2('0x32')]:_0x5827ac['model'];if(_0x18f3e9[_0x91a2('0x2e')]['includeAll']){_0xedfcd1[_0x91a2('0x44')]=[{'all':!![]}];}_0xedfcd1=_['merge']({},_0xedfcd1,_0x18f3e9['options']);return db[_0x91a2('0x2a')]['find'](_0xedfcd1)['then'](handleEntityNotFound(_0xc0aeb4,null))[_0x91a2('0x24')](respondWithResult(_0xc0aeb4,null))['catch'](handleError(_0xc0aeb4,null));};exports[_0x91a2('0x45')]=function(_0x2a346e,_0x5cd8c2){return db['MailSubstatus'][_0x91a2('0x45')](_0x2a346e[_0x91a2('0x46')],{})[_0x91a2('0x24')](respondWithResult(_0x5cd8c2,0xc9))[_0x91a2('0x41')](handleError(_0x5cd8c2,null));};exports[_0x91a2('0x23')]=function(_0x1d7fa2,_0x203ed7){if(_0x1d7fa2[_0x91a2('0x46')]['id']){delete _0x1d7fa2[_0x91a2('0x46')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x1d7fa2['params']['id']}})[_0x91a2('0x24')](handleEntityNotFound(_0x203ed7,null))[_0x91a2('0x24')](saveUpdates(_0x1d7fa2['body'],null))[_0x91a2('0x24')](respondWithResult(_0x203ed7,null))[_0x91a2('0x41')](handleError(_0x203ed7,null));};exports['destroy']=function(_0x450768,_0x1aefac){return db['MailSubstatus'][_0x91a2('0x47')]({'where':{'id':_0x450768[_0x91a2('0x43')]['id']}})[_0x91a2('0x24')](handleEntityNotFound(_0x1aefac,null))['then'](removeEntity(_0x1aefac,null))['catch'](handleError(_0x1aefac,null));};exports[_0x91a2('0x48')]=function(_0x4c8a21,_0x549332){return db['MailSubstatus'][_0x91a2('0x48')]()[_0x91a2('0x24')](respondWithResult(_0x549332,null))[_0x91a2('0x41')](handleError(_0x549332,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index bea6ea7..265d416 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 _0xfb53=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xac7dc,_0x3aa839){var _0x26974a=function(_0x1453f0){while(--_0x1453f0){_0xac7dc['push'](_0xac7dc['shift']());}};_0x26974a(++_0x3aa839);}(_0xfb53,0xf2));var _0x3fb5=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0xfb53[_0x5459b0];return _0x675a35;};'use strict';var EventEmitter=require(_0x3fb5('0x0'));var MailSubstatus=require(_0x3fb5('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3fb5('0x2')](0x0);var events={'afterUpdate':_0x3fb5('0x3')};function emitEvent(_0x498154){return function(_0x44942d,_0x1bb90d,_0x42bfa7){MailSubstatusEvents[_0x3fb5('0x4')](_0x498154+':'+_0x44942d['id'],_0x44942d);MailSubstatusEvents[_0x3fb5('0x4')](_0x498154,_0x44942d);_0x42bfa7(null);};}for(var e in events){if(events[_0x3fb5('0x5')](e)){var event=events[e];MailSubstatus[_0x3fb5('0x6')](e,emitEvent(event));}}module[_0x3fb5('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x29c5=['setMaxListeners','emit','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x3aca8a,_0x20c80c){var _0x4e3e53=function(_0x329ac1){while(--_0x329ac1){_0x3aca8a['push'](_0x3aca8a['shift']());}};_0x4e3e53(++_0x20c80c);}(_0x29c5,0xc8));var _0x529c=function(_0x1312e7,_0x5410bc){_0x1312e7=_0x1312e7-0x0;var _0x39fcbc=_0x29c5[_0x1312e7];return _0x39fcbc;};'use strict';var EventEmitter=require(_0x529c('0x0'));var MailSubstatus=require(_0x529c('0x1'))['db'][_0x529c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x529c('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x444139){return function(_0x5a528b,_0x2a42ee,_0x595447){MailSubstatusEvents[_0x529c('0x4')](_0x444139+':'+_0x5a528b['id'],_0x5a528b);MailSubstatusEvents[_0x529c('0x4')](_0x444139,_0x5a528b);_0x595447(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x529c('0x5')](e,emitEvent(event));}}module[_0x529c('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 b2e5d8e..541dcdd 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 _0x3869=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x3869,0x115));var _0x9386=function(_0x250960,_0xdf40d8){_0x250960=_0x250960-0x0;var _0x4af2ef=_0x3869[_0x250960];return _0x4af2ef;};'use strict';var attributes=require(_0x9386('0x0'));module[_0x9386('0x1')]=function(_0x2e0e71){var _0x22d291=_0x2e0e71[_0x9386('0x2')];return _0x2e0e71[_0x9386('0x3')](_0x9386('0x4'),attributes,{'tableName':_0x9386('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x410ff8,_0x2afb08,_0x2f739a){return _0x22d291[_0x9386('0x6')][_0x9386('0x7')]({'value':_0x410ff8[_0x9386('0x8')]},{'where':{'field':_0x9386('0x9'),'value':_0x410ff8[_0x9386('0xa')][_0x9386('0x8')]}})[_0x9386('0xb')](function(){_0x2f739a();})[_0x9386('0xc')](function(_0x40c6e8){_0x2f739a(_0x40c6e8);});}}});}; \ No newline at end of file +var _0xe643=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','catch'];(function(_0x1d79c3,_0x3992a9){var _0x5ed06c=function(_0x148fec){while(--_0x148fec){_0x1d79c3['push'](_0x1d79c3['shift']());}};_0x5ed06c(++_0x3992a9);}(_0xe643,0x84));var _0x3e64=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe643[_0x138adb];return _0x1b27f2;};'use strict';var attributes=require(_0x3e64('0x0'));module[_0x3e64('0x1')]=function(_0x5f2e9d){var _0x328a0f=_0x5f2e9d['models'];return _0x5f2e9d[_0x3e64('0x2')](_0x3e64('0x3'),attributes,{'tableName':_0x3e64('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x12eb74,_0x13b250,_0x5d4a4e){return _0x328a0f[_0x3e64('0x5')][_0x3e64('0x6')]({'value':_0x12eb74[_0x3e64('0x7')]},{'where':{'field':_0x3e64('0x8'),'value':_0x12eb74[_0x3e64('0x9')][_0x3e64('0x7')]}})['then'](function(){_0x5d4a4e();})[_0x3e64('0xa')](function(_0x2ddf0e){_0x5d4a4e(_0x2ddf0e);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c9601c9..0d81f9f 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 _0xba41=['http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x206f6b,_0x3f689b){var _0xf2450=function(_0x17642f){while(--_0x17642f){_0x206f6b['push'](_0x206f6b['shift']());}};_0xf2450(++_0x3f689b);}(_0xba41,0xdd));var _0x1ba4=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xba41[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0x1ba4('0x0'));var moment=require(_0x1ba4('0x1'));var BPromise=require(_0x1ba4('0x2'));var rs=require(_0x1ba4('0x3'));var fs=require('fs');var Redis=require(_0x1ba4('0x4'));var db=require(_0x1ba4('0x5'))['db'];var utils=require(_0x1ba4('0x6'));var logger=require(_0x1ba4('0x7'))('rpc');var config=require(_0x1ba4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1ba4('0x9')][_0x1ba4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b3763,_0x17bc3b,_0x19d1e3){return new BPromise(function(_0x5375aa,_0x458a11){return client['request'](_0x4b3763,_0x19d1e3)[_0x1ba4('0xb')](function(_0x28e22b){logger[_0x1ba4('0xc')](_0x1ba4('0xd'),_0x17bc3b,_0x1ba4('0xe'));logger[_0x1ba4('0xf')](_0x1ba4('0x10'),_0x17bc3b,_0x1ba4('0xe'),JSON['stringify'](_0x28e22b));if(_0x28e22b[_0x1ba4('0x11')]){if(_0x28e22b[_0x1ba4('0x11')]['code']===0x1f4){logger[_0x1ba4('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17bc3b,_0x28e22b[_0x1ba4('0x11')][_0x1ba4('0x12')]);return _0x458a11(_0x28e22b[_0x1ba4('0x11')][_0x1ba4('0x12')]);}logger[_0x1ba4('0x11')](_0x1ba4('0xd'),_0x17bc3b,_0x28e22b[_0x1ba4('0x11')][_0x1ba4('0x12')]);return _0x5375aa(_0x28e22b[_0x1ba4('0x11')][_0x1ba4('0x12')]);}else{logger['info'](_0x1ba4('0xd'),_0x17bc3b,_0x1ba4('0xe'));_0x5375aa(_0x28e22b[_0x1ba4('0x13')][_0x1ba4('0x12')]);}})[_0x1ba4('0x14')](function(_0x20c691){logger[_0x1ba4('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17bc3b,_0x20c691);_0x458a11(_0x20c691);});});} \ No newline at end of file +var _0xdad9=['rpc','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x874a49,_0x5b07bc){var _0x343d2f=function(_0x351928){while(--_0x351928){_0x874a49['push'](_0x874a49['shift']());}};_0x343d2f(++_0x5b07bc);}(_0xdad9,0xad));var _0x9dad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdad9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9dad('0x0'));var moment=require(_0x9dad('0x1'));var BPromise=require(_0x9dad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dad('0x3'));var db=require(_0x9dad('0x4'))['db'];var utils=require(_0x9dad('0x5'));var logger=require(_0x9dad('0x6'))(_0x9dad('0x7'));var config=require(_0x9dad('0x8'));var jayson=require(_0x9dad('0x9'));var client=jayson[_0x9dad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x597ac1,_0x300965,_0x5d2bbc){return new BPromise(function(_0x2b9ac6,_0x416586){return client['request'](_0x597ac1,_0x5d2bbc)[_0x9dad('0xb')](function(_0x4e520c){logger[_0x9dad('0xc')](_0x9dad('0xd'),_0x300965,_0x9dad('0xe'));logger[_0x9dad('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x300965,_0x9dad('0xe'),JSON['stringify'](_0x4e520c));if(_0x4e520c[_0x9dad('0x10')]){if(_0x4e520c[_0x9dad('0x10')][_0x9dad('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x300965,_0x4e520c[_0x9dad('0x10')]['message']);return _0x416586(_0x4e520c['error'][_0x9dad('0x12')]);}logger[_0x9dad('0x10')](_0x9dad('0xd'),_0x300965,_0x4e520c['error'][_0x9dad('0x12')]);return _0x2b9ac6(_0x4e520c['error'][_0x9dad('0x12')]);}else{logger[_0x9dad('0xc')](_0x9dad('0xd'),_0x300965,'request\x20sent');_0x2b9ac6(_0x4e520c[_0x9dad('0x13')][_0x9dad('0x12')]);}})['catch'](function(_0x503367){logger[_0x9dad('0x10')](_0x9dad('0xd'),_0x300965,_0x503367);_0x416586(_0x503367);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 24e37e2..ce59e20 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 _0x635b=['/:id','delete','multer','util','path','connect-timeout','express','../../components/interaction/service','./mailTransferReport.controller','index','/describe','isAuthenticated','describe','get','show','post','create'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x635b,0x189));var _0xb635=function(_0x23beca,_0x5bb35d){_0x23beca=_0x23beca-0x0;var _0x2f62fa=_0x635b[_0x23beca];return _0x2f62fa;};'use strict';var multer=require(_0xb635('0x0'));var util=require(_0xb635('0x1'));var path=require(_0xb635('0x2'));var timeout=require(_0xb635('0x3'));var express=require(_0xb635('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb635('0x5'));var config=require('../../config/environment');var controller=require(_0xb635('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb635('0x7')]);router['get'](_0xb635('0x8'),auth[_0xb635('0x9')](),controller[_0xb635('0xa')]);router[_0xb635('0xb')]('/:id',auth[_0xb635('0x9')](),controller[_0xb635('0xc')]);router[_0xb635('0xd')]('/',auth['isAuthenticated'](),controller[_0xb635('0xe')]);router['put'](_0xb635('0xf'),auth[_0xb635('0x9')](),controller['update']);router[_0xb635('0x10')](_0xb635('0xf'),auth[_0xb635('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa231=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','describe','show','post','create','put','update','delete'];(function(_0x177c0f,_0x324360){var _0x1f4d28=function(_0x49d3f0){while(--_0x49d3f0){_0x177c0f['push'](_0x177c0f['shift']());}};_0x1f4d28(++_0x324360);}(_0xa231,0x141));var _0x1a23=function(_0x3ff59d,_0x209599){_0x3ff59d=_0x3ff59d-0x0;var _0x221f59=_0xa231[_0x3ff59d];return _0x221f59;};'use strict';var multer=require(_0x1a23('0x0'));var util=require(_0x1a23('0x1'));var path=require(_0x1a23('0x2'));var timeout=require(_0x1a23('0x3'));var express=require('express');var router=express[_0x1a23('0x4')]();var fs_extra=require(_0x1a23('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a23('0x6'));var config=require(_0x1a23('0x7'));var controller=require(_0x1a23('0x8'));router[_0x1a23('0x9')]('/',auth['isAuthenticated'](),controller[_0x1a23('0xa')]);router[_0x1a23('0x9')]('/describe',auth[_0x1a23('0xb')](),controller[_0x1a23('0xc')]);router[_0x1a23('0x9')]('/:id',auth[_0x1a23('0xb')](),controller[_0x1a23('0xd')]);router[_0x1a23('0xe')]('/',auth[_0x1a23('0xb')](),controller[_0x1a23('0xf')]);router[_0x1a23('0x10')]('/:id',auth[_0x1a23('0xb')](),controller[_0x1a23('0x11')]);router[_0x1a23('0x12')]('/:id',auth[_0x1a23('0xb')](),controller['destroy']);module[_0x1a23('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a3bb68a..d80b389 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x27dd06,_0x2a4324){var _0x5f4446=function(_0x352126){while(--_0x352126){_0x27dd06['push'](_0x27dd06['shift']());}};_0x5f4446(++_0x2a4324);}(_0xaa88,0x137));var _0x8aa8=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xaa88[_0x1e3671];return _0x48d5f5;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x6c7f37,_0x3bc627){var _0x10ecba=function(_0x2959e7){while(--_0x2959e7){_0x6c7f37['push'](_0x6c7f37['shift']());}};_0x10ecba(++_0x3bc627);}(_0xedd9,0xfc));var _0x9edd=function(_0x5c5e95,_0x740a18){_0x5c5e95=_0x5c5e95-0x0;var _0x55c9aa=_0xedd9[_0x5c5e95];return _0x55c9aa;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8b0aaf9..bf4012f 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 _0xe9c3=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','ioredis'];(function(_0xf174bf,_0x1003c3){var _0xf5a82a=function(_0x300cc7){while(--_0x300cc7){_0xf174bf['push'](_0xf174bf['shift']());}};_0xf5a82a(++_0x1003c3);}(_0xe9c3,0x19c));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3e9c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3e9c('0x1'));var rp=require(_0x3e9c('0x2'));var moment=require(_0x3e9c('0x3'));var BPromise=require(_0x3e9c('0x4'));var Mustache=require(_0x3e9c('0x5'));var util=require(_0x3e9c('0x6'));var path=require(_0x3e9c('0x7'));var sox=require(_0x3e9c('0x8'));var csv=require(_0x3e9c('0x9'));var ejs=require(_0x3e9c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e9c('0xb'));var squel=require('squel');var crypto=require(_0x3e9c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3e9c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e9c('0xd'));var authService=require(_0x3e9c('0xe'));var qs=require(_0x3e9c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e9c('0x10'))(_0x3e9c('0x11'));var utils=require(_0x3e9c('0x12'));var config=require(_0x3e9c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e9c('0x14'))['db'];function respondWithStatusCode(_0x17caf5,_0x224f70){_0x224f70=_0x224f70||0xcc;return function(_0x24c3f6){if(_0x24c3f6){return _0x17caf5[_0x3e9c('0x15')](_0x224f70);}return _0x17caf5[_0x3e9c('0x16')](_0x224f70)[_0x3e9c('0x17')]();};}function respondWithResult(_0x49ca7a,_0x4f58de){_0x4f58de=_0x4f58de||0xc8;return function(_0x52fa4a){if(_0x52fa4a){return _0x49ca7a[_0x3e9c('0x16')](_0x4f58de)[_0x3e9c('0x18')](_0x52fa4a);}};}function respondWithFilteredResult(_0x43f69e,_0x42f8de){return function(_0x11d508){if(_0x11d508){var _0x53af96=typeof _0x42f8de['offset']===_0x3e9c('0x19')&&typeof _0x42f8de[_0x3e9c('0x1a')]==='undefined';var _0x5c8a08=_0x11d508[_0x3e9c('0x1b')];var _0x31f266=_0x53af96?0x0:_0x42f8de[_0x3e9c('0x1c')];var _0xf982c7=_0x53af96?_0x11d508[_0x3e9c('0x1b')]:_0x42f8de['offset']+_0x42f8de[_0x3e9c('0x1a')];var _0x27ffe6;if(_0xf982c7>=_0x5c8a08){_0xf982c7=_0x5c8a08;_0x27ffe6=0xc8;}else{_0x27ffe6=0xce;}_0x43f69e[_0x3e9c('0x16')](_0x27ffe6);return _0x43f69e[_0x3e9c('0x1d')](_0x3e9c('0x1e'),_0x31f266+'-'+_0xf982c7+'/'+_0x5c8a08)['json'](_0x11d508);}return null;};}function patchUpdates(_0x3c5473){return function(_0xa827da){try{jsonpatch['apply'](_0xa827da,_0x3c5473,!![]);}catch(_0x33c133){return BPromise[_0x3e9c('0x1f')](_0x33c133);}return _0xa827da['save']();};}function saveUpdates(_0x24457a,_0x1fe305){return function(_0x4954ff){if(_0x4954ff){return _0x4954ff[_0x3e9c('0x20')](_0x24457a)[_0x3e9c('0x21')](function(_0x3a5d20){return _0x3a5d20;});}return null;};}function removeEntity(_0x52d10f,_0x24f3b0){return function(_0x387cbb){if(_0x387cbb){return _0x387cbb['destroy']()[_0x3e9c('0x21')](function(){_0x52d10f[_0x3e9c('0x16')](0xcc)[_0x3e9c('0x17')]();});}};}function handleEntityNotFound(_0x16ff50,_0x461cdc){return function(_0x507027){if(!_0x507027){_0x16ff50[_0x3e9c('0x15')](0x194);}return _0x507027;};}function handleError(_0x5d8a8b,_0x45fcbc){_0x45fcbc=_0x45fcbc||0x1f4;return function(_0x3bb954){logger[_0x3e9c('0x22')](_0x3bb954[_0x3e9c('0x23')]);if(_0x3bb954[_0x3e9c('0x24')]){delete _0x3bb954['name'];}_0x5d8a8b[_0x3e9c('0x16')](_0x45fcbc)['send'](_0x3bb954);};}exports[_0x3e9c('0x25')]=function(_0xcc0610,_0x42581b){var _0x1e7327={},_0x1baf0e={},_0x126174={'count':0x0,'rows':[]};var _0x34e545=_[_0x3e9c('0x26')](db[_0x3e9c('0x27')][_0x3e9c('0x28')],function(_0x20bcb8){return{'name':_0x20bcb8[_0x3e9c('0x29')],'type':_0x20bcb8[_0x3e9c('0x2a')][_0x3e9c('0x2b')]};});_0x1baf0e[_0x3e9c('0x2c')]=_['map'](_0x34e545,_0x3e9c('0x24'));_0x1baf0e[_0x3e9c('0x2d')]=_[_0x3e9c('0x2e')](_0xcc0610[_0x3e9c('0x2d')]);_0x1baf0e[_0x3e9c('0x2f')]=_[_0x3e9c('0x30')](_0x1baf0e[_0x3e9c('0x2c')],_0x1baf0e[_0x3e9c('0x2d')]);_0x1e7327[_0x3e9c('0x31')]=_[_0x3e9c('0x30')](_0x1baf0e[_0x3e9c('0x2c')],qs[_0x3e9c('0x32')](_0xcc0610[_0x3e9c('0x2d')]['fields']));_0x1e7327[_0x3e9c('0x31')]=_0x1e7327[_0x3e9c('0x31')]['length']?_0x1e7327['attributes']:_0x1baf0e[_0x3e9c('0x2c')];if(!_0xcc0610['query'][_0x3e9c('0x33')]('nolimit')){_0x1e7327[_0x3e9c('0x1a')]=qs[_0x3e9c('0x1a')](_0xcc0610['query'][_0x3e9c('0x1a')]);_0x1e7327[_0x3e9c('0x1c')]=qs[_0x3e9c('0x1c')](_0xcc0610[_0x3e9c('0x2d')][_0x3e9c('0x1c')]);}_0x1e7327[_0x3e9c('0x34')]=qs[_0x3e9c('0x35')](_0xcc0610[_0x3e9c('0x2d')][_0x3e9c('0x35')]);_0x1e7327['where']=qs[_0x3e9c('0x2f')](_[_0x3e9c('0x36')](_0xcc0610[_0x3e9c('0x2d')],_0x1baf0e[_0x3e9c('0x2f')]),_0x34e545);if(_0xcc0610[_0x3e9c('0x2d')]['filter']){_0x1e7327[_0x3e9c('0x37')]=_[_0x3e9c('0x38')](_0x1e7327['where'],{'$or':_['map'](_0x34e545,function(_0x43a6ef){if(_0x43a6ef[_0x3e9c('0x2a')]!=='VIRTUAL'){var _0x46f4c8={};_0x46f4c8[_0x43a6ef[_0x3e9c('0x24')]]={'$like':'%'+_0xcc0610[_0x3e9c('0x2d')]['filter']+'%'};return _0x46f4c8;}})});}_0x1e7327=_[_0x3e9c('0x38')]({},_0x1e7327,_0xcc0610[_0x3e9c('0x39')]);var _0x539e79={'where':_0x1e7327[_0x3e9c('0x37')]};return db[_0x3e9c('0x27')][_0x3e9c('0x1b')](_0x539e79)[_0x3e9c('0x21')](function(_0xf3f0de){_0x126174[_0x3e9c('0x1b')]=_0xf3f0de;if(_0xcc0610[_0x3e9c('0x2d')][_0x3e9c('0x3a')]){_0x1e7327[_0x3e9c('0x3b')]=[{'all':!![]}];}return db[_0x3e9c('0x27')][_0x3e9c('0x3c')](_0x1e7327);})[_0x3e9c('0x21')](function(_0x1486db){_0x126174[_0x3e9c('0x3d')]=_0x1486db;return _0x126174;})[_0x3e9c('0x21')](respondWithFilteredResult(_0x42581b,_0x1e7327))[_0x3e9c('0x3e')](handleError(_0x42581b,null));};exports[_0x3e9c('0x3f')]=function(_0x5365fa,_0x11bd6f){var _0x4d1559={'raw':!![],'where':{'id':_0x5365fa['params']['id']}},_0x57dd0e={};_0x57dd0e[_0x3e9c('0x2c')]=_[_0x3e9c('0x2e')](db[_0x3e9c('0x27')][_0x3e9c('0x28')]);_0x57dd0e[_0x3e9c('0x2d')]=_['keys'](_0x5365fa[_0x3e9c('0x2d')]);_0x57dd0e[_0x3e9c('0x2f')]=_[_0x3e9c('0x30')](_0x57dd0e[_0x3e9c('0x2c')],_0x57dd0e[_0x3e9c('0x2d')]);_0x4d1559['attributes']=_[_0x3e9c('0x30')](_0x57dd0e[_0x3e9c('0x2c')],qs[_0x3e9c('0x32')](_0x5365fa['query'][_0x3e9c('0x32')]));_0x4d1559[_0x3e9c('0x31')]=_0x4d1559[_0x3e9c('0x31')][_0x3e9c('0x40')]?_0x4d1559[_0x3e9c('0x31')]:_0x57dd0e[_0x3e9c('0x2c')];if(_0x5365fa['query'][_0x3e9c('0x3a')]){_0x4d1559[_0x3e9c('0x3b')]=[{'all':!![]}];}_0x4d1559=_[_0x3e9c('0x38')]({},_0x4d1559,_0x5365fa['options']);return db['MailTransferReport'][_0x3e9c('0x41')](_0x4d1559)['then'](handleEntityNotFound(_0x11bd6f,null))[_0x3e9c('0x21')](respondWithResult(_0x11bd6f,null))[_0x3e9c('0x3e')](handleError(_0x11bd6f,null));};exports[_0x3e9c('0x42')]=function(_0x401f9e,_0x2e4cd3){return db[_0x3e9c('0x27')]['create'](_0x401f9e[_0x3e9c('0x43')],{})['then'](respondWithResult(_0x2e4cd3,0xc9))[_0x3e9c('0x3e')](handleError(_0x2e4cd3,null));};exports[_0x3e9c('0x20')]=function(_0x5c2ccc,_0x1cccca){if(_0x5c2ccc['body']['id']){delete _0x5c2ccc['body']['id'];}return db[_0x3e9c('0x27')][_0x3e9c('0x41')]({'where':{'id':_0x5c2ccc[_0x3e9c('0x44')]['id']}})[_0x3e9c('0x21')](handleEntityNotFound(_0x1cccca,null))[_0x3e9c('0x21')](saveUpdates(_0x5c2ccc[_0x3e9c('0x43')],null))[_0x3e9c('0x21')](respondWithResult(_0x1cccca,null))[_0x3e9c('0x3e')](handleError(_0x1cccca,null));};exports[_0x3e9c('0x45')]=function(_0x3a0ff3,_0xf9323){return db[_0x3e9c('0x27')][_0x3e9c('0x41')]({'where':{'id':_0x3a0ff3['params']['id']}})[_0x3e9c('0x21')](handleEntityNotFound(_0xf9323,null))[_0x3e9c('0x21')](removeEntity(_0xf9323,null))[_0x3e9c('0x3e')](handleError(_0xf9323,null));};exports[_0x3e9c('0x46')]=function(_0x20f827,_0x5bde56){return db['MailTransferReport']['describe']()[_0x3e9c('0x21')](respondWithResult(_0x5bde56,null))[_0x3e9c('0x3e')](handleError(_0x5bde56,null));}; \ No newline at end of file +var _0x3bcb=['attributes','fields','length','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','fieldName','type','model','query','keys','intersection'];(function(_0x2703e0,_0x21d8e6){var _0x30ac40=function(_0x5cdb24){while(--_0x5cdb24){_0x2703e0['push'](_0x2703e0['shift']());}};_0x30ac40(++_0x21d8e6);}(_0x3bcb,0x1c7));var _0xb3bc=function(_0x44d62d,_0x128717){_0x44d62d=_0x44d62d-0x0;var _0xd4383f=_0x3bcb[_0x44d62d];return _0xd4383f;};'use strict';var emlformat=require(_0xb3bc('0x0'));var rimraf=require(_0xb3bc('0x1'));var zipdir=require(_0xb3bc('0x2'));var jsonpatch=require(_0xb3bc('0x3'));var rp=require(_0xb3bc('0x4'));var moment=require(_0xb3bc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb3bc('0x6'));var util=require(_0xb3bc('0x7'));var path=require(_0xb3bc('0x8'));var sox=require('sox');var csv=require(_0xb3bc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3bc('0xa'));var _=require(_0xb3bc('0xb'));var squel=require(_0xb3bc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb3bc('0xd'));var toCsv=require(_0xb3bc('0x9'));var querystring=require(_0xb3bc('0xe'));var Papa=require('papaparse');var Redis=require(_0xb3bc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb3bc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3bc('0x11'));var logger=require(_0xb3bc('0x12'))(_0xb3bc('0x13'));var utils=require(_0xb3bc('0x14'));var config=require(_0xb3bc('0x15'));var licenseUtil=require(_0xb3bc('0x16'));var db=require(_0xb3bc('0x17'))['db'];function respondWithStatusCode(_0x23083c,_0x1ffb74){_0x1ffb74=_0x1ffb74||0xcc;return function(_0x4b4125){if(_0x4b4125){return _0x23083c[_0xb3bc('0x18')](_0x1ffb74);}return _0x23083c['status'](_0x1ffb74)['end']();};}function respondWithResult(_0x3753ac,_0x18a1e5){_0x18a1e5=_0x18a1e5||0xc8;return function(_0x3a99d8){if(_0x3a99d8){return _0x3753ac[_0xb3bc('0x19')](_0x18a1e5)[_0xb3bc('0x1a')](_0x3a99d8);}};}function respondWithFilteredResult(_0xe71a65,_0x5d1b0d){return function(_0x283567){if(_0x283567){var _0x34a9a8=typeof _0x5d1b0d['offset']===_0xb3bc('0x1b')&&typeof _0x5d1b0d['limit']==='undefined';var _0x5b3ca9=_0x283567[_0xb3bc('0x1c')];var _0x160488=_0x34a9a8?0x0:_0x5d1b0d[_0xb3bc('0x1d')];var _0x4cc758=_0x34a9a8?_0x283567['count']:_0x5d1b0d[_0xb3bc('0x1d')]+_0x5d1b0d[_0xb3bc('0x1e')];var _0x34bfdb;if(_0x4cc758>=_0x5b3ca9){_0x4cc758=_0x5b3ca9;_0x34bfdb=0xc8;}else{_0x34bfdb=0xce;}_0xe71a65[_0xb3bc('0x19')](_0x34bfdb);return _0xe71a65[_0xb3bc('0x1f')](_0xb3bc('0x20'),_0x160488+'-'+_0x4cc758+'/'+_0x5b3ca9)[_0xb3bc('0x1a')](_0x283567);}return null;};}function patchUpdates(_0x67adc6){return function(_0x471d91){try{jsonpatch[_0xb3bc('0x21')](_0x471d91,_0x67adc6,!![]);}catch(_0x58bf4d){return BPromise[_0xb3bc('0x22')](_0x58bf4d);}return _0x471d91['save']();};}function saveUpdates(_0x2f5cb5,_0x4f61f4){return function(_0x223fbd){if(_0x223fbd){return _0x223fbd[_0xb3bc('0x23')](_0x2f5cb5)[_0xb3bc('0x24')](function(_0x54c7c1){return _0x54c7c1;});}return null;};}function removeEntity(_0x28d23e,_0x40df65){return function(_0x5287ff){if(_0x5287ff){return _0x5287ff[_0xb3bc('0x25')]()[_0xb3bc('0x24')](function(){_0x28d23e[_0xb3bc('0x19')](0xcc)[_0xb3bc('0x26')]();});}};}function handleEntityNotFound(_0xad7abf,_0x205908){return function(_0x4dd693){if(!_0x4dd693){_0xad7abf[_0xb3bc('0x18')](0x194);}return _0x4dd693;};}function handleError(_0x167748,_0x189997){_0x189997=_0x189997||0x1f4;return function(_0x2b3c6f){logger['error'](_0x2b3c6f[_0xb3bc('0x27')]);if(_0x2b3c6f['name']){delete _0x2b3c6f['name'];}_0x167748[_0xb3bc('0x19')](_0x189997)[_0xb3bc('0x28')](_0x2b3c6f);};}exports[_0xb3bc('0x29')]=function(_0xf8c482,_0x2a3111){var _0x32b950={},_0x3616fa={},_0x452a8e={'count':0x0,'rows':[]};var _0x3a4325=_[_0xb3bc('0x2a')](db['MailTransferReport']['rawAttributes'],function(_0x1fbcee){return{'name':_0x1fbcee[_0xb3bc('0x2b')],'type':_0x1fbcee[_0xb3bc('0x2c')]['key']};});_0x3616fa[_0xb3bc('0x2d')]=_[_0xb3bc('0x2a')](_0x3a4325,'name');_0x3616fa[_0xb3bc('0x2e')]=_[_0xb3bc('0x2f')](_0xf8c482['query']);_0x3616fa['filters']=_[_0xb3bc('0x30')](_0x3616fa[_0xb3bc('0x2d')],_0x3616fa[_0xb3bc('0x2e')]);_0x32b950[_0xb3bc('0x31')]=_['intersection'](_0x3616fa[_0xb3bc('0x2d')],qs[_0xb3bc('0x32')](_0xf8c482['query'][_0xb3bc('0x32')]));_0x32b950[_0xb3bc('0x31')]=_0x32b950['attributes'][_0xb3bc('0x33')]?_0x32b950[_0xb3bc('0x31')]:_0x3616fa['model'];if(!_0xf8c482[_0xb3bc('0x2e')]['hasOwnProperty']('nolimit')){_0x32b950['limit']=qs[_0xb3bc('0x1e')](_0xf8c482[_0xb3bc('0x2e')][_0xb3bc('0x1e')]);_0x32b950['offset']=qs[_0xb3bc('0x1d')](_0xf8c482[_0xb3bc('0x2e')]['offset']);}_0x32b950[_0xb3bc('0x34')]=qs['sort'](_0xf8c482[_0xb3bc('0x2e')][_0xb3bc('0x35')]);_0x32b950['where']=qs[_0xb3bc('0x36')](_['pick'](_0xf8c482[_0xb3bc('0x2e')],_0x3616fa['filters']),_0x3a4325);if(_0xf8c482['query'][_0xb3bc('0x37')]){_0x32b950[_0xb3bc('0x38')]=_[_0xb3bc('0x39')](_0x32b950[_0xb3bc('0x38')],{'$or':_[_0xb3bc('0x2a')](_0x3a4325,function(_0x3a47dd){if(_0x3a47dd[_0xb3bc('0x2c')]!==_0xb3bc('0x3a')){var _0x5cb4a9={};_0x5cb4a9[_0x3a47dd['name']]={'$like':'%'+_0xf8c482['query'][_0xb3bc('0x37')]+'%'};return _0x5cb4a9;}})});}_0x32b950=_[_0xb3bc('0x39')]({},_0x32b950,_0xf8c482[_0xb3bc('0x3b')]);var _0xb0a7e9={'where':_0x32b950[_0xb3bc('0x38')]};return db['MailTransferReport'][_0xb3bc('0x1c')](_0xb0a7e9)[_0xb3bc('0x24')](function(_0x561c50){_0x452a8e[_0xb3bc('0x1c')]=_0x561c50;if(_0xf8c482[_0xb3bc('0x2e')][_0xb3bc('0x3c')]){_0x32b950[_0xb3bc('0x3d')]=[{'all':!![]}];}return db[_0xb3bc('0x3e')][_0xb3bc('0x3f')](_0x32b950);})['then'](function(_0x4d2784){_0x452a8e[_0xb3bc('0x40')]=_0x4d2784;return _0x452a8e;})[_0xb3bc('0x24')](respondWithFilteredResult(_0x2a3111,_0x32b950))['catch'](handleError(_0x2a3111,null));};exports[_0xb3bc('0x41')]=function(_0xf2774,_0x2d2df7){var _0x49b082={'raw':!![],'where':{'id':_0xf2774['params']['id']}},_0x5b644d={};_0x5b644d[_0xb3bc('0x2d')]=_[_0xb3bc('0x2f')](db[_0xb3bc('0x3e')]['rawAttributes']);_0x5b644d['query']=_[_0xb3bc('0x2f')](_0xf2774[_0xb3bc('0x2e')]);_0x5b644d[_0xb3bc('0x36')]=_['intersection'](_0x5b644d['model'],_0x5b644d[_0xb3bc('0x2e')]);_0x49b082['attributes']=_[_0xb3bc('0x30')](_0x5b644d['model'],qs[_0xb3bc('0x32')](_0xf2774[_0xb3bc('0x2e')][_0xb3bc('0x32')]));_0x49b082[_0xb3bc('0x31')]=_0x49b082[_0xb3bc('0x31')]['length']?_0x49b082[_0xb3bc('0x31')]:_0x5b644d[_0xb3bc('0x2d')];if(_0xf2774[_0xb3bc('0x2e')][_0xb3bc('0x3c')]){_0x49b082[_0xb3bc('0x3d')]=[{'all':!![]}];}_0x49b082=_[_0xb3bc('0x39')]({},_0x49b082,_0xf2774['options']);return db['MailTransferReport'][_0xb3bc('0x42')](_0x49b082)['then'](handleEntityNotFound(_0x2d2df7,null))[_0xb3bc('0x24')](respondWithResult(_0x2d2df7,null))[_0xb3bc('0x43')](handleError(_0x2d2df7,null));};exports[_0xb3bc('0x44')]=function(_0x14705c,_0x556adb){return db[_0xb3bc('0x3e')][_0xb3bc('0x44')](_0x14705c[_0xb3bc('0x45')],{})[_0xb3bc('0x24')](respondWithResult(_0x556adb,0xc9))[_0xb3bc('0x43')](handleError(_0x556adb,null));};exports['update']=function(_0x1a901a,_0x565440){if(_0x1a901a[_0xb3bc('0x45')]['id']){delete _0x1a901a[_0xb3bc('0x45')]['id'];}return db[_0xb3bc('0x3e')][_0xb3bc('0x42')]({'where':{'id':_0x1a901a[_0xb3bc('0x46')]['id']}})[_0xb3bc('0x24')](handleEntityNotFound(_0x565440,null))[_0xb3bc('0x24')](saveUpdates(_0x1a901a[_0xb3bc('0x45')],null))[_0xb3bc('0x24')](respondWithResult(_0x565440,null))[_0xb3bc('0x43')](handleError(_0x565440,null));};exports[_0xb3bc('0x25')]=function(_0x229786,_0x1089ed){return db[_0xb3bc('0x3e')][_0xb3bc('0x42')]({'where':{'id':_0x229786[_0xb3bc('0x46')]['id']}})[_0xb3bc('0x24')](handleEntityNotFound(_0x1089ed,null))[_0xb3bc('0x24')](removeEntity(_0x1089ed,null))[_0xb3bc('0x43')](handleError(_0x1089ed,null));};exports[_0xb3bc('0x47')]=function(_0x220a73,_0x3dd766){return db['MailTransferReport'][_0xb3bc('0x47')]()[_0xb3bc('0x24')](respondWithResult(_0x3dd766,null))[_0xb3bc('0x43')](handleError(_0x3dd766,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1241ca6..6814d89 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 _0xcc92=['moment','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x32de65,_0xb6661e){var _0x57785b=function(_0x1b6c82){while(--_0x1b6c82){_0x32de65['push'](_0x32de65['shift']());}};_0x57785b(++_0xb6661e);}(_0xcc92,0x141));var _0x2cc9=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0xcc92[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0x2cc9('0x0'));var util=require(_0x2cc9('0x1'));var logger=require(_0x2cc9('0x2'))('api');var moment=require(_0x2cc9('0x3'));var BPromise=require(_0x2cc9('0x4'));var rp=require(_0x2cc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2cc9('0x6'));var attributes=require(_0x2cc9('0x7'));module['exports']=function(_0x2260b6,_0x5f3e9c){return _0x2260b6[_0x2cc9('0x8')](_0x2cc9('0x9'),attributes,{'tableName':_0x2cc9('0xa'),'paranoid':![],'indexes':[{'name':_0x2cc9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe700=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','MailTransferReport','uniqueid','lodash'];(function(_0x2865ee,_0xffa5d1){var _0x5660da=function(_0x319fbb){while(--_0x319fbb){_0x2865ee['push'](_0x2865ee['shift']());}};_0x5660da(++_0xffa5d1);}(_0xe700,0x16a));var _0x0e70=function(_0x4ef10e,_0x227f53){_0x4ef10e=_0x4ef10e-0x0;var _0x46ebdf=_0xe700[_0x4ef10e];return _0x46ebdf;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e70('0x6'));var config=require(_0x0e70('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xf3ba11,_0xc96045){return _0xf3ba11[_0x0e70('0x8')](_0x0e70('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x0e70('0xa'),'fields':[_0x0e70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9cfaec9..2533444 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 _0xc22d=['../../config/logger','rpc','../../config/environment','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28c638,_0x14847a){var _0x59f094=function(_0x590342){while(--_0x590342){_0x28c638['push'](_0x28c638['shift']());}};_0x59f094(++_0x14847a);}(_0xc22d,0x88));var _0xdc22=function(_0x2f5131,_0x309841){_0x2f5131=_0x2f5131-0x0;var _0x5f1550=_0xc22d[_0x2f5131];return _0x5f1550;};'use strict';var _=require(_0xdc22('0x0'));var util=require(_0xdc22('0x1'));var moment=require(_0xdc22('0x2'));var BPromise=require(_0xdc22('0x3'));var rs=require(_0xdc22('0x4'));var fs=require('fs');var Redis=require(_0xdc22('0x5'));var db=require(_0xdc22('0x6'))['db'];var utils=require(_0xdc22('0x7'));var logger=require(_0xdc22('0x8'))(_0xdc22('0x9'));var config=require(_0xdc22('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdc22('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b9b12,_0x258d41,_0x31181){return new BPromise(function(_0x116343,_0x548be9){return client[_0xdc22('0xc')](_0x5b9b12,_0x31181)[_0xdc22('0xd')](function(_0x250500){logger[_0xdc22('0xe')](_0xdc22('0xf'),_0x258d41,_0xdc22('0x10'));logger[_0xdc22('0x11')](_0xdc22('0x12'),_0x258d41,_0xdc22('0x10'),JSON[_0xdc22('0x13')](_0x250500));if(_0x250500[_0xdc22('0x14')]){if(_0x250500['error'][_0xdc22('0x15')]===0x1f4){logger[_0xdc22('0x14')](_0xdc22('0xf'),_0x258d41,_0x250500['error'][_0xdc22('0x16')]);return _0x548be9(_0x250500[_0xdc22('0x14')][_0xdc22('0x16')]);}logger[_0xdc22('0x14')](_0xdc22('0xf'),_0x258d41,_0x250500[_0xdc22('0x14')][_0xdc22('0x16')]);return _0x116343(_0x250500['error'][_0xdc22('0x16')]);}else{logger[_0xdc22('0xe')](_0xdc22('0xf'),_0x258d41,_0xdc22('0x10'));_0x116343(_0x250500['result'][_0xdc22('0x16')]);}})[_0xdc22('0x17')](function(_0x421fe9){logger[_0xdc22('0x14')](_0xdc22('0xf'),_0x258d41,_0x421fe9);_0x548be9(_0x421fe9);});});} \ No newline at end of file +var _0xc139=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','MailTransferReport,\x20%s,\x20%s'];(function(_0x7d04b7,_0x2ece84){var _0x5e1c03=function(_0x3b3b33){while(--_0x3b3b33){_0x7d04b7['push'](_0x7d04b7['shift']());}};_0x5e1c03(++_0x2ece84);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9c13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c13('0x1'));var rs=require(_0x9c13('0x2'));var fs=require('fs');var Redis=require(_0x9c13('0x3'));var db=require(_0x9c13('0x4'))['db'];var utils=require(_0x9c13('0x5'));var logger=require(_0x9c13('0x6'))(_0x9c13('0x7'));var config=require(_0x9c13('0x8'));var jayson=require(_0x9c13('0x9'));var client=jayson[_0x9c13('0xa')][_0x9c13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b1dd3,_0x383f9d,_0x1e4d86){return new BPromise(function(_0x50d2a2,_0x546056){return client[_0x9c13('0xc')](_0x2b1dd3,_0x1e4d86)[_0x9c13('0xd')](function(_0x57e500){logger[_0x9c13('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x383f9d,_0x9c13('0xf'));logger[_0x9c13('0x10')](_0x9c13('0x11'),_0x383f9d,_0x9c13('0xf'),JSON['stringify'](_0x57e500));if(_0x57e500[_0x9c13('0x12')]){if(_0x57e500['error']['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x383f9d,_0x57e500[_0x9c13('0x12')]['message']);return _0x546056(_0x57e500[_0x9c13('0x12')][_0x9c13('0x13')]);}logger[_0x9c13('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x383f9d,_0x57e500[_0x9c13('0x12')][_0x9c13('0x13')]);return _0x50d2a2(_0x57e500[_0x9c13('0x12')][_0x9c13('0x13')]);}else{logger[_0x9c13('0xe')](_0x9c13('0x14'),_0x383f9d,_0x9c13('0xf'));_0x50d2a2(_0x57e500[_0x9c13('0x15')]['message']);}})['catch'](function(_0x3a0737){logger[_0x9c13('0x12')](_0x9c13('0x14'),_0x383f9d,_0x3a0737);_0x546056(_0x3a0737);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index aa82f80..af407aa 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 _0x624a=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x30eb19,_0xe70c5d){var _0x4fd794=function(_0x7e4f0d){while(--_0x7e4f0d){_0x30eb19['push'](_0x30eb19['shift']());}};_0x4fd794(++_0xe70c5d);}(_0x624a,0x96));var _0xa624=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x624a[_0x582274];return _0x8f14d3;};'use strict';var multer=require(_0xa624('0x0'));var util=require('util');var path=require(_0xa624('0x1'));var timeout=require(_0xa624('0x2'));var express=require(_0xa624('0x3'));var router=express[_0xa624('0x4')]();var fs_extra=require(_0xa624('0x5'));var auth=require(_0xa624('0x6'));var interaction=require(_0xa624('0x7'));var config=require(_0xa624('0x8'));var controller=require(_0xa624('0x9'));router[_0xa624('0xa')]('/',auth[_0xa624('0xb')](),controller['index']);router['get'](_0xa624('0xc'),auth['isAuthenticated'](),controller[_0xa624('0xd')]);router['get'](_0xa624('0xe'),auth['isAuthenticated'](),controller[_0xa624('0xf')]);router[_0xa624('0x10')]('/',auth[_0xa624('0xb')](),controller[_0xa624('0x11')]);router['put'](_0xa624('0xe'),auth[_0xa624('0xb')](),controller[_0xa624('0x12')]);router[_0xa624('0x13')](_0xa624('0xe'),auth[_0xa624('0xb')](),controller['destroy']);module[_0xa624('0x14')]=router; \ No newline at end of file +var _0xa8ba=['/describe','describe','show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index'];(function(_0x3ddf1e,_0x2c8459){var _0x3396a3=function(_0x441283){while(--_0x441283){_0x3ddf1e['push'](_0x3ddf1e['shift']());}};_0x3396a3(++_0x2c8459);}(_0xa8ba,0xab));var _0xaa8b=function(_0x44e9fe,_0x3b1b15){_0x44e9fe=_0x44e9fe-0x0;var _0x10b28c=_0xa8ba[_0x44e9fe];return _0x10b28c;};'use strict';var multer=require(_0xaa8b('0x0'));var util=require('util');var path=require(_0xaa8b('0x1'));var timeout=require(_0xaa8b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa8b('0x3'));var config=require(_0xaa8b('0x4'));var controller=require(_0xaa8b('0x5'));router[_0xaa8b('0x6')]('/',auth[_0xaa8b('0x7')](),controller[_0xaa8b('0x8')]);router[_0xaa8b('0x6')](_0xaa8b('0x9'),auth[_0xaa8b('0x7')](),controller[_0xaa8b('0xa')]);router[_0xaa8b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xaa8b('0xb')]);router[_0xaa8b('0xc')]('/',auth[_0xaa8b('0x7')](),controller['create']);router[_0xaa8b('0xd')](_0xaa8b('0xe'),auth[_0xaa8b('0x7')](),controller[_0xaa8b('0xf')]);router[_0xaa8b('0x10')](_0xaa8b('0xe'),auth[_0xaa8b('0x7')](),controller['destroy']);module[_0xaa8b('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a2cf92b..0befb25 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 _0xcd72=['seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt'];(function(_0x32cc6f,_0x375beb){var _0x392c11=function(_0x9a68a){while(--_0x9a68a){_0x32cc6f['push'](_0x32cc6f['shift']());}};_0x392c11(++_0x375beb);}(_0xcd72,0xe8));var _0x2cd7=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0xcd72[_0x1ac77b];return _0x161584;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2cd7('0x0'));module[_0x2cd7('0x1')]={'channel':{'type':Sequelize[_0x2cd7('0x2')]},'membername':{'type':Sequelize[_0x2cd7('0x2')]},'interface':{'type':Sequelize[_0x2cd7('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x2cd7('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x2cd7('0x4')]},'enterAt':{'type':Sequelize[_0x2cd7('0x5')]},'exitAt':{'type':Sequelize[_0x2cd7('0x5')],'set':function(_0x240c40){var _0x2cc6c3=moment(_0x240c40);var _0x3dfdb5=moment(this[_0x2cd7('0x6')](_0x2cd7('0x7')));var _0x2d3e37=_0x2cc6c3['diff'](_0x3dfdb5,_0x2cd7('0x8'));this[_0x2cd7('0x9')](_0x2cd7('0xa'),_0x240c40);this[_0x2cd7('0x9')](_0x2cd7('0xb'),_0x2d3e37>=0x0?_0x2d3e37:null);}},'data1':{'type':Sequelize[_0x2cd7('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x2cd7('0x2')],'comment':_0x2cd7('0xc')},'data3':{'type':Sequelize[_0x2cd7('0x2')],'comment':_0x2cd7('0xd')},'data4':{'type':Sequelize[_0x2cd7('0x2')],'comment':_0x2cd7('0xe')},'data5':{'type':Sequelize[_0x2cd7('0x2')],'comment':_0x2cd7('0xf')},'role':{'type':Sequelize[_0x2cd7('0x2')]},'internal':{'type':Sequelize[_0x2cd7('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x616c=['seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x5cbfed,_0x2b8ba5){var _0x462d98=function(_0xf4bce9){while(--_0xf4bce9){_0x5cbfed['push'](_0x5cbfed['shift']());}};_0x462d98(++_0x2b8ba5);}(_0x616c,0xc6));var _0xc616=function(_0x5b6807,_0x5b28af){_0x5b6807=_0x5b6807-0x0;var _0x2e5cdb=_0x616c[_0x5b6807];return _0x2e5cdb;};'use strict';var Sequelize=require(_0xc616('0x0'));var moment=require(_0xc616('0x1'));module['exports']={'channel':{'type':Sequelize[_0xc616('0x2')]},'membername':{'type':Sequelize[_0xc616('0x2')]},'interface':{'type':Sequelize[_0xc616('0x2')]},'type':{'type':Sequelize[_0xc616('0x2')],'defaultValue':_0xc616('0x3'),'comment':_0xc616('0x4')},'duration':{'type':Sequelize[_0xc616('0x5')]},'enterAt':{'type':Sequelize[_0xc616('0x6')]},'exitAt':{'type':Sequelize[_0xc616('0x6')],'set':function(_0x71349c){var _0x2ef5b8=moment(_0x71349c);var _0x2c3823=moment(this[_0xc616('0x7')](_0xc616('0x8')));var _0x4e6b2a=_0x2ef5b8[_0xc616('0x9')](_0x2c3823,_0xc616('0xa'));this[_0xc616('0xb')]('exitAt',_0x71349c);this[_0xc616('0xb')](_0xc616('0xc'),_0x4e6b2a>=0x0?_0x4e6b2a:null);}},'data1':{'type':Sequelize[_0xc616('0x2')],'comment':_0xc616('0xd')},'data2':{'type':Sequelize[_0xc616('0x2')],'comment':_0xc616('0xe')},'data3':{'type':Sequelize[_0xc616('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0xc616('0xf')},'data5':{'type':Sequelize[_0xc616('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xc616('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 142f6a8..2916afe 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e830b,_0x3e3e53){_0x2e830b=_0x2e830b-0x0;var _0x5d93d5=_0xedd9[_0x2e830b];return _0x5d93d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7b9d1bf..36e3fd9 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 _0x0fcd=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','report_member','membername','interface','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0fcd,0x129));var _0xd0fc=function(_0x3977e3,_0x33f475){_0x3977e3=_0x3977e3-0x0;var _0x38add8=_0x0fcd[_0x3977e3];return _0x38add8;};'use strict';var _=require('lodash');var util=require(_0xd0fc('0x0'));var logger=require(_0xd0fc('0x1'))(_0xd0fc('0x2'));var moment=require(_0xd0fc('0x3'));var BPromise=require(_0xd0fc('0x4'));var rp=require(_0xd0fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0fc('0x6'));var config=require(_0xd0fc('0x7'));var attributes=require(_0xd0fc('0x8'));module[_0xd0fc('0x9')]=function(_0x5507ff,_0x32b1c5){return _0x5507ff['define']('MemberReport',attributes,{'tableName':_0xd0fc('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xd0fc('0xb'),_0xd0fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b21=['api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','membername_interface','lodash','util','../../config/logger'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x6b21,0x75));var _0x16b2=function(_0x3a87a7,_0x2ff2d4){_0x3a87a7=_0x3a87a7-0x0;var _0x417b0a=_0x6b21[_0x3a87a7];return _0x417b0a;};'use strict';var _=require(_0x16b2('0x0'));var util=require(_0x16b2('0x1'));var logger=require(_0x16b2('0x2'))(_0x16b2('0x3'));var moment=require('moment');var BPromise=require(_0x16b2('0x4'));var rp=require(_0x16b2('0x5'));var fs=require('fs');var path=require(_0x16b2('0x6'));var rimraf=require('rimraf');var config=require(_0x16b2('0x7'));var attributes=require(_0x16b2('0x8'));module[_0x16b2('0x9')]=function(_0x560d96,_0x5ac94b){return _0x560d96['define'](_0x16b2('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x16b2('0xb'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e111c99..9bbd342 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 _0x8ad5=['code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','map','include','model','CreateMemberReport','body','UpdateMemberReport','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xc628fc,_0x254be0){var _0x58802c=function(_0x552ed2){while(--_0x552ed2){_0xc628fc['push'](_0xc628fc['shift']());}};_0x58802c(++_0x254be0);}(_0x8ad5,0xf1));var _0x58ad=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8ad5[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x58ad('0x0'));var util=require(_0x58ad('0x1'));var moment=require(_0x58ad('0x2'));var BPromise=require(_0x58ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58ad('0x4'))['db'];var utils=require(_0x58ad('0x5'));var logger=require(_0x58ad('0x6'))(_0x58ad('0x7'));var config=require(_0x58ad('0x8'));var jayson=require(_0x58ad('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x394972,_0x22c63f,_0x220c5f){return new BPromise(function(_0x2033a3,_0xe5d483){return client[_0x58ad('0xa')](_0x394972,_0x220c5f)[_0x58ad('0xb')](function(_0x14fa03){logger[_0x58ad('0xc')]('MemberReport,\x20%s,\x20%s',_0x22c63f,_0x58ad('0xd'));logger[_0x58ad('0xe')](_0x58ad('0xf'),_0x22c63f,_0x58ad('0xd'),JSON[_0x58ad('0x10')](_0x14fa03));if(_0x14fa03[_0x58ad('0x11')]){if(_0x14fa03[_0x58ad('0x11')][_0x58ad('0x12')]===0x1f4){logger['error'](_0x58ad('0x13'),_0x22c63f,_0x14fa03[_0x58ad('0x11')][_0x58ad('0x14')]);return _0xe5d483(_0x14fa03[_0x58ad('0x11')][_0x58ad('0x14')]);}logger[_0x58ad('0x11')](_0x58ad('0x13'),_0x22c63f,_0x14fa03[_0x58ad('0x11')]['message']);return _0x2033a3(_0x14fa03['error']['message']);}else{logger['info'](_0x58ad('0x13'),_0x22c63f,'request\x20sent');_0x2033a3(_0x14fa03[_0x58ad('0x15')][_0x58ad('0x14')]);}})[_0x58ad('0x16')](function(_0x280618){logger[_0x58ad('0x11')]('MemberReport,\x20%s,\x20%s',_0x22c63f,_0x280618);_0xe5d483(_0x280618);});});}exports[_0x58ad('0x17')]=function(_0x24fbe0){var _0x3233d8=this;return new Promise(function(_0xc8b034,_0x397027){return db[_0x58ad('0x18')][_0x58ad('0x19')]({'raw':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0['options'][_0x58ad('0x1b')]===undefined?!![]:![]:!![],'where':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0[_0x58ad('0x1a')]['where']||null:null,'attributes':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0[_0x58ad('0x1a')][_0x58ad('0x1c')]||null:null,'limit':_0x24fbe0['options']?_0x24fbe0[_0x58ad('0x1a')][_0x58ad('0x1d')]||null:null,'include':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0[_0x58ad('0x1a')]['include']?_[_0x58ad('0x1e')](_0x24fbe0[_0x58ad('0x1a')][_0x58ad('0x1f')],function(_0x5f7669){return{'model':db[_0x5f7669[_0x58ad('0x20')]],'as':_0x5f7669['as'],'attributes':_0x5f7669[_0x58ad('0x1c')],'include':_0x5f7669[_0x58ad('0x1f')]?_[_0x58ad('0x1e')](_0x5f7669['include'],function(_0x13220b){return{'model':db[_0x13220b['model']],'as':_0x13220b['as'],'attributes':_0x13220b[_0x58ad('0x1c')],'include':_0x13220b['include']?_['map'](_0x13220b[_0x58ad('0x1f')],function(_0x3d7d74){return{'model':db[_0x3d7d74[_0x58ad('0x20')]],'as':_0x3d7d74['as'],'attributes':_0x3d7d74[_0x58ad('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x58ad('0xb')](function(_0x4332c){logger[_0x58ad('0xc')](_0x58ad('0x17'),_0x24fbe0);logger[_0x58ad('0xe')](_0x58ad('0x17'),_0x24fbe0,JSON[_0x58ad('0x10')](_0x4332c));_0xc8b034(_0x4332c);})['catch'](function(_0x2bffbd){logger[_0x58ad('0x11')](_0x58ad('0x17'),_0x2bffbd[_0x58ad('0x14')],_0x24fbe0);_0x397027(_0x3233d8[_0x58ad('0x11')](0x1f4,_0x2bffbd['message']));});});};exports[_0x58ad('0x21')]=function(_0x35ee58){var _0x3850d4=this;return new Promise(function(_0x7dacc4,_0x370d12){return db['MemberReport']['create'](_0x35ee58[_0x58ad('0x22')],{'raw':_0x35ee58[_0x58ad('0x1a')]?_0x35ee58[_0x58ad('0x1a')][_0x58ad('0x1b')]===undefined?!![]:![]:!![]})[_0x58ad('0xb')](function(_0x2aa6df){logger[_0x58ad('0xc')](_0x58ad('0x21'),_0x35ee58);logger['debug'](_0x58ad('0x21'),_0x35ee58,JSON[_0x58ad('0x10')](_0x2aa6df));_0x7dacc4(_0x2aa6df);})[_0x58ad('0x16')](function(_0x512281){logger[_0x58ad('0x11')]('CreateMemberReport',_0x512281[_0x58ad('0x14')],_0x35ee58);_0x370d12(_0x3850d4[_0x58ad('0x11')](0x1f4,_0x512281['message']));});});};exports[_0x58ad('0x23')]=function(_0x305c1f){var _0x4b0d2d=this;return new Promise(function(_0x4caf7b,_0x1d6ddd){return db[_0x58ad('0x18')]['update'](_0x305c1f[_0x58ad('0x22')],{'raw':_0x305c1f['options']?_0x305c1f['options'][_0x58ad('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x305c1f[_0x58ad('0x1a')]?_0x305c1f[_0x58ad('0x1a')][_0x58ad('0x24')]||null:null,'attributes':_0x305c1f[_0x58ad('0x1a')]?_0x305c1f['options'][_0x58ad('0x1c')]||null:null,'limit':_0x305c1f[_0x58ad('0x1a')]?_0x305c1f[_0x58ad('0x1a')][_0x58ad('0x1d')]||null:null})[_0x58ad('0xb')](function(_0x572a61){logger[_0x58ad('0xc')](_0x58ad('0x23'),_0x305c1f);logger[_0x58ad('0xe')]('UpdateMemberReport',_0x305c1f,JSON['stringify'](_0x572a61));_0x4caf7b(_0x572a61);})['catch'](function(_0x9693ee){logger['error'](_0x58ad('0x23'),_0x9693ee[_0x58ad('0x14')],_0x305c1f);_0x1d6ddd(_0x4b0d2d[_0x58ad('0x11')](0x1f4,_0x9693ee[_0x58ad('0x14')]));});});}; \ No newline at end of file +var _0xfd50=['CreateMemberReport','create','UpdateMemberReport','update','body','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MemberReport','options','raw','attributes','limit','include','model','map','GetMemberReport'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfd50,0x178));var _0x0fd5=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xfd50[_0x1347f8];return _0x218368;};'use strict';var _=require('lodash');var util=require(_0x0fd5('0x0'));var moment=require(_0x0fd5('0x1'));var BPromise=require(_0x0fd5('0x2'));var rs=require(_0x0fd5('0x3'));var fs=require('fs');var Redis=require(_0x0fd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd5('0x5'));var logger=require(_0x0fd5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0fd5('0x7'));var client=jayson[_0x0fd5('0x8')][_0x0fd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24319e,_0x50c54f,_0x1baf7){return new BPromise(function(_0x6a536,_0x4e8f2f){return client[_0x0fd5('0xa')](_0x24319e,_0x1baf7)[_0x0fd5('0xb')](function(_0x3b7b62){logger[_0x0fd5('0xc')](_0x0fd5('0xd'),_0x50c54f,_0x0fd5('0xe'));logger[_0x0fd5('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x50c54f,_0x0fd5('0xe'),JSON[_0x0fd5('0x10')](_0x3b7b62));if(_0x3b7b62['error']){if(_0x3b7b62[_0x0fd5('0x11')][_0x0fd5('0x12')]===0x1f4){logger[_0x0fd5('0x11')](_0x0fd5('0xd'),_0x50c54f,_0x3b7b62[_0x0fd5('0x11')][_0x0fd5('0x13')]);return _0x4e8f2f(_0x3b7b62[_0x0fd5('0x11')]['message']);}logger['error'](_0x0fd5('0xd'),_0x50c54f,_0x3b7b62['error'][_0x0fd5('0x13')]);return _0x6a536(_0x3b7b62[_0x0fd5('0x11')][_0x0fd5('0x13')]);}else{logger[_0x0fd5('0xc')](_0x0fd5('0xd'),_0x50c54f,'request\x20sent');_0x6a536(_0x3b7b62[_0x0fd5('0x14')][_0x0fd5('0x13')]);}})[_0x0fd5('0x15')](function(_0x2a9cb7){logger[_0x0fd5('0x11')](_0x0fd5('0xd'),_0x50c54f,_0x2a9cb7);_0x4e8f2f(_0x2a9cb7);});});}exports['GetMemberReport']=function(_0x977f7d){var _0x8cee=this;return new Promise(function(_0x3f1843,_0x442815){return db[_0x0fd5('0x16')]['findAll']({'raw':_0x977f7d[_0x0fd5('0x17')]?_0x977f7d[_0x0fd5('0x17')][_0x0fd5('0x18')]===undefined?!![]:![]:!![],'where':_0x977f7d[_0x0fd5('0x17')]?_0x977f7d[_0x0fd5('0x17')]['where']||null:null,'attributes':_0x977f7d[_0x0fd5('0x17')]?_0x977f7d['options'][_0x0fd5('0x19')]||null:null,'limit':_0x977f7d[_0x0fd5('0x17')]?_0x977f7d['options'][_0x0fd5('0x1a')]||null:null,'include':_0x977f7d[_0x0fd5('0x17')]?_0x977f7d[_0x0fd5('0x17')][_0x0fd5('0x1b')]?_['map'](_0x977f7d[_0x0fd5('0x17')][_0x0fd5('0x1b')],function(_0x216034){return{'model':db[_0x216034[_0x0fd5('0x1c')]],'as':_0x216034['as'],'attributes':_0x216034['attributes'],'include':_0x216034[_0x0fd5('0x1b')]?_[_0x0fd5('0x1d')](_0x216034[_0x0fd5('0x1b')],function(_0x2235d0){return{'model':db[_0x2235d0[_0x0fd5('0x1c')]],'as':_0x2235d0['as'],'attributes':_0x2235d0[_0x0fd5('0x19')],'include':_0x2235d0[_0x0fd5('0x1b')]?_[_0x0fd5('0x1d')](_0x2235d0[_0x0fd5('0x1b')],function(_0x8bc104){return{'model':db[_0x8bc104[_0x0fd5('0x1c')]],'as':_0x8bc104['as'],'attributes':_0x8bc104[_0x0fd5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0fd5('0xb')](function(_0x52a6a2){logger['info']('GetMemberReport',_0x977f7d);logger[_0x0fd5('0xf')](_0x0fd5('0x1e'),_0x977f7d,JSON['stringify'](_0x52a6a2));_0x3f1843(_0x52a6a2);})[_0x0fd5('0x15')](function(_0x28199e){logger[_0x0fd5('0x11')](_0x0fd5('0x1e'),_0x28199e['message'],_0x977f7d);_0x442815(_0x8cee[_0x0fd5('0x11')](0x1f4,_0x28199e[_0x0fd5('0x13')]));});});};exports[_0x0fd5('0x1f')]=function(_0x4cc40b){var _0x3e41d4=this;return new Promise(function(_0x126337,_0x6698ee){return db[_0x0fd5('0x16')][_0x0fd5('0x20')](_0x4cc40b['body'],{'raw':_0x4cc40b[_0x0fd5('0x17')]?_0x4cc40b['options']['raw']===undefined?!![]:![]:!![]})[_0x0fd5('0xb')](function(_0x50e03e){logger[_0x0fd5('0xc')](_0x0fd5('0x1f'),_0x4cc40b);logger[_0x0fd5('0xf')](_0x0fd5('0x1f'),_0x4cc40b,JSON[_0x0fd5('0x10')](_0x50e03e));_0x126337(_0x50e03e);})[_0x0fd5('0x15')](function(_0x4081dd){logger[_0x0fd5('0x11')]('CreateMemberReport',_0x4081dd[_0x0fd5('0x13')],_0x4cc40b);_0x6698ee(_0x3e41d4[_0x0fd5('0x11')](0x1f4,_0x4081dd[_0x0fd5('0x13')]));});});};exports[_0x0fd5('0x21')]=function(_0x440cd3){var _0x37f1da=this;return new Promise(function(_0x248d29,_0x319970){return db[_0x0fd5('0x16')][_0x0fd5('0x22')](_0x440cd3[_0x0fd5('0x23')],{'raw':_0x440cd3[_0x0fd5('0x17')]?_0x440cd3[_0x0fd5('0x17')][_0x0fd5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x440cd3['options']?_0x440cd3['options'][_0x0fd5('0x24')]||null:null,'attributes':_0x440cd3['options']?_0x440cd3['options'][_0x0fd5('0x19')]||null:null,'limit':_0x440cd3[_0x0fd5('0x17')]?_0x440cd3[_0x0fd5('0x17')][_0x0fd5('0x1a')]||null:null})[_0x0fd5('0xb')](function(_0x4736b0){logger[_0x0fd5('0xc')](_0x0fd5('0x21'),_0x440cd3);logger[_0x0fd5('0xf')](_0x0fd5('0x21'),_0x440cd3,JSON[_0x0fd5('0x10')](_0x4736b0));_0x248d29(_0x4736b0);})[_0x0fd5('0x15')](function(_0x3eb4bc){logger[_0x0fd5('0x11')](_0x0fd5('0x21'),_0x3eb4bc[_0x0fd5('0x13')],_0x440cd3);_0x319970(_0x37f1da['error'](0x1f4,_0x3eb4bc[_0x0fd5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1e70c9d..cdfbc83 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 _0x8dab=['get','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x46d12e,_0x1ba18e){var _0x403915=function(_0x42b9a4){while(--_0x42b9a4){_0x46d12e['push'](_0x46d12e['shift']());}};_0x403915(++_0x1ba18e);}(_0x8dab,0xd3));var _0xb8da=function(_0x1394e7,_0xb1001a){_0x1394e7=_0x1394e7-0x0;var _0x296d52=_0x8dab[_0x1394e7];return _0x296d52;};'use strict';var multer=require(_0xb8da('0x0'));var util=require(_0xb8da('0x1'));var path=require('path');var timeout=require(_0xb8da('0x2'));var express=require(_0xb8da('0x3'));var router=express[_0xb8da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb8da('0x5'));var interaction=require(_0xb8da('0x6'));var config=require(_0xb8da('0x7'));var controller=require(_0xb8da('0x8'));router[_0xb8da('0x9')]('/',controller['index']);module[_0xb8da('0xa')]=router; \ No newline at end of file +var _0x0913=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports','multer','util'];(function(_0x59033b,_0x3f85af){var _0x1720a3=function(_0x36fbfc){while(--_0x36fbfc){_0x59033b['push'](_0x59033b['shift']());}};_0x1720a3(++_0x3f85af);}(_0x0913,0x1a5));var _0x3091=function(_0x2baf40,_0x5ebef2){_0x2baf40=_0x2baf40-0x0;var _0x2bb2cb=_0x0913[_0x2baf40];return _0x2bb2cb;};'use strict';var multer=require(_0x3091('0x0'));var util=require(_0x3091('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3091('0x2'));var auth=require(_0x3091('0x3'));var interaction=require(_0x3091('0x4'));var config=require(_0x3091('0x5'));var controller=require('./migration.controller');router[_0x3091('0x6')]('/',controller[_0x3091('0x7')]);module[_0x3091('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0ff5e7e..c4896af 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 _0x27ef=['STRING','sequelize','exports'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0x27ef,0x82));var _0xf27e=function(_0x5c64a1,_0x10a799){_0x5c64a1=_0x5c64a1-0x0;var _0x3cc675=_0x27ef[_0x5c64a1];return _0x3cc675;};'use strict';var Sequelize=require(_0xf27e('0x0'));module[_0xf27e('0x1')]={'version':{'type':Sequelize[_0xf27e('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x499a=['sequelize','exports','STRING','version'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x499a,0xc0));var _0xa499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x499a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa499('0x0'));module[_0xa499('0x1')]={'version':{'type':Sequelize[_0xa499('0x2')],'unique':_0xa499('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7cc0d38..5452c98 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 _0x55d0=['apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x58d662,_0x213b06){var _0xa398ce=function(_0x5ccc1d){while(--_0x5ccc1d){_0x58d662['push'](_0x58d662['shift']());}};_0xa398ce(++_0x213b06);}(_0x55d0,0x1ee));var _0x055d=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x55d0[_0x4a73f2];return _0x4190ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x055d('0x0'));var zipdir=require(_0x055d('0x1'));var jsonpatch=require(_0x055d('0x2'));var rp=require(_0x055d('0x3'));var moment=require('moment');var BPromise=require(_0x055d('0x4'));var Mustache=require(_0x055d('0x5'));var util=require('util');var path=require(_0x055d('0x6'));var sox=require(_0x055d('0x7'));var csv=require('to-csv');var ejs=require(_0x055d('0x8'));var fs=require('fs');var fs_extra=require(_0x055d('0x9'));var _=require(_0x055d('0xa'));var squel=require('squel');var crypto=require(_0x055d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x055d('0xc'));var toCsv=require(_0x055d('0xd'));var querystring=require(_0x055d('0xe'));var Papa=require(_0x055d('0xf'));var Redis=require(_0x055d('0x10'));var authService=require(_0x055d('0x11'));var qs=require(_0x055d('0x12'));var as=require(_0x055d('0x13'));var hardwareService=require(_0x055d('0x14'));var logger=require(_0x055d('0x15'))(_0x055d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x055d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bfe4d,_0x3769f9){_0x3769f9=_0x3769f9||0xcc;return function(_0x3263a9){if(_0x3263a9){return _0x4bfe4d[_0x055d('0x18')](_0x3769f9);}return _0x4bfe4d[_0x055d('0x19')](_0x3769f9)[_0x055d('0x1a')]();};}function respondWithResult(_0x3741db,_0x10710a){_0x10710a=_0x10710a||0xc8;return function(_0x29aaf1){if(_0x29aaf1){return _0x3741db[_0x055d('0x19')](_0x10710a)[_0x055d('0x1b')](_0x29aaf1);}};}function respondWithFilteredResult(_0x5e0117,_0x2ef0eb){return function(_0x351ef2){if(_0x351ef2){var _0x1d9de4=typeof _0x2ef0eb['offset']===_0x055d('0x1c')&&typeof _0x2ef0eb[_0x055d('0x1d')]==='undefined';var _0x1157ab=_0x351ef2[_0x055d('0x1e')];var _0x3e3861=_0x1d9de4?0x0:_0x2ef0eb[_0x055d('0x1f')];var _0x45df9c=_0x1d9de4?_0x351ef2[_0x055d('0x1e')]:_0x2ef0eb[_0x055d('0x1f')]+_0x2ef0eb[_0x055d('0x1d')];var _0x1b6adb;if(_0x45df9c>=_0x1157ab){_0x45df9c=_0x1157ab;_0x1b6adb=0xc8;}else{_0x1b6adb=0xce;}_0x5e0117[_0x055d('0x19')](_0x1b6adb);return _0x5e0117[_0x055d('0x20')](_0x055d('0x21'),_0x3e3861+'-'+_0x45df9c+'/'+_0x1157ab)[_0x055d('0x1b')](_0x351ef2);}return null;};}function patchUpdates(_0x1f0a4c){return function(_0x13c7df){try{jsonpatch[_0x055d('0x22')](_0x13c7df,_0x1f0a4c,!![]);}catch(_0x35f206){return BPromise[_0x055d('0x23')](_0x35f206);}return _0x13c7df[_0x055d('0x24')]();};}function saveUpdates(_0x268a8e,_0x389de4){return function(_0x51a551){if(_0x51a551){return _0x51a551[_0x055d('0x25')](_0x268a8e)[_0x055d('0x26')](function(_0x57e351){return _0x57e351;});}return null;};}function removeEntity(_0x4b7560,_0x417389){return function(_0x188ece){if(_0x188ece){return _0x188ece['destroy']()[_0x055d('0x26')](function(){_0x4b7560['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f5689,_0x54ece5){return function(_0x4f3c8c){if(!_0x4f3c8c){_0x5f5689[_0x055d('0x18')](0x194);}return _0x4f3c8c;};}function handleError(_0x5d69b8,_0x48853c){_0x48853c=_0x48853c||0x1f4;return function(_0x453377){logger['error'](_0x453377['stack']);if(_0x453377[_0x055d('0x27')]){delete _0x453377[_0x055d('0x27')];}_0x5d69b8[_0x055d('0x19')](_0x48853c)[_0x055d('0x28')](_0x453377);};}exports[_0x055d('0x29')]=function(_0x55d629,_0x2ab985){var _0x58a165={},_0x27d424={},_0x3f2f90={'count':0x0,'rows':[]};var _0x5b99a4=_[_0x055d('0x2a')](db['Migration'][_0x055d('0x2b')],function(_0x4abe23){return{'name':_0x4abe23[_0x055d('0x2c')],'type':_0x4abe23[_0x055d('0x2d')]['key']};});_0x27d424[_0x055d('0x2e')]=_[_0x055d('0x2a')](_0x5b99a4,_0x055d('0x27'));_0x27d424[_0x055d('0x2f')]=_['keys'](_0x55d629[_0x055d('0x2f')]);_0x27d424['filters']=_[_0x055d('0x30')](_0x27d424['model'],_0x27d424[_0x055d('0x2f')]);_0x58a165[_0x055d('0x31')]=_[_0x055d('0x30')](_0x27d424[_0x055d('0x2e')],qs[_0x055d('0x32')](_0x55d629[_0x055d('0x2f')][_0x055d('0x32')]));_0x58a165[_0x055d('0x31')]=_0x58a165[_0x055d('0x31')]['length']?_0x58a165['attributes']:_0x27d424[_0x055d('0x2e')];if(!_0x55d629[_0x055d('0x2f')][_0x055d('0x33')](_0x055d('0x34'))){_0x58a165[_0x055d('0x1d')]=qs[_0x055d('0x1d')](_0x55d629[_0x055d('0x2f')][_0x055d('0x1d')]);_0x58a165[_0x055d('0x1f')]=qs[_0x055d('0x1f')](_0x55d629[_0x055d('0x2f')]['offset']);}_0x58a165[_0x055d('0x35')]=qs[_0x055d('0x36')](_0x55d629[_0x055d('0x2f')][_0x055d('0x36')]);_0x58a165['where']=qs[_0x055d('0x37')](_[_0x055d('0x38')](_0x55d629[_0x055d('0x2f')],_0x27d424[_0x055d('0x37')]),_0x5b99a4);if(_0x55d629['query'][_0x055d('0x39')]){_0x58a165['where']=_[_0x055d('0x3a')](_0x58a165[_0x055d('0x3b')],{'$or':_[_0x055d('0x2a')](_0x5b99a4,function(_0x4b4d47){if(_0x4b4d47[_0x055d('0x2d')]!==_0x055d('0x3c')){var _0x4bc43d={};_0x4bc43d[_0x4b4d47[_0x055d('0x27')]]={'$like':'%'+_0x55d629[_0x055d('0x2f')][_0x055d('0x39')]+'%'};return _0x4bc43d;}})});}_0x58a165=_[_0x055d('0x3a')]({},_0x58a165,_0x55d629[_0x055d('0x3d')]);var _0x394634={'where':_0x58a165[_0x055d('0x3b')]};return db['Migration'][_0x055d('0x1e')](_0x394634)[_0x055d('0x26')](function(_0x2e4439){_0x3f2f90['count']=_0x2e4439;if(_0x55d629[_0x055d('0x2f')][_0x055d('0x3e')]){_0x58a165['include']=[{'all':!![]}];}return db['Migration'][_0x055d('0x3f')](_0x58a165);})[_0x055d('0x26')](function(_0x46ee6d){_0x3f2f90[_0x055d('0x40')]=_0x46ee6d;return _0x3f2f90;})[_0x055d('0x26')](respondWithFilteredResult(_0x2ab985,_0x58a165))[_0x055d('0x41')](handleError(_0x2ab985,null));}; \ No newline at end of file +var _0xeed7=['status','end','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','type','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb'];(function(_0x1a6c10,_0x2280bb){var _0x13be9c=function(_0x2e5d11){while(--_0x2e5d11){_0x1a6c10['push'](_0x1a6c10['shift']());}};_0x13be9c(++_0x2280bb);}(_0xeed7,0x1f2));var _0x7eed=function(_0x48b838,_0x3d6111){_0x48b838=_0x48b838-0x0;var _0x330ebd=_0xeed7[_0x48b838];return _0x330ebd;};'use strict';var emlformat=require(_0x7eed('0x0'));var rimraf=require(_0x7eed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7eed('0x2'));var rp=require(_0x7eed('0x3'));var moment=require(_0x7eed('0x4'));var BPromise=require(_0x7eed('0x5'));var Mustache=require('mustache');var util=require(_0x7eed('0x6'));var path=require('path');var sox=require(_0x7eed('0x7'));var csv=require(_0x7eed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eed('0x9'));var _=require(_0x7eed('0xa'));var squel=require(_0x7eed('0xb'));var crypto=require('crypto');var jsforce=require(_0x7eed('0xc'));var deskjs=require(_0x7eed('0xd'));var toCsv=require(_0x7eed('0x8'));var querystring=require(_0x7eed('0xe'));var Papa=require(_0x7eed('0xf'));var Redis=require(_0x7eed('0x10'));var authService=require(_0x7eed('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7eed('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eed('0x13'))(_0x7eed('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7eed('0x15'))['db'];function respondWithStatusCode(_0x40e966,_0x354eaa){_0x354eaa=_0x354eaa||0xcc;return function(_0x426fed){if(_0x426fed){return _0x40e966['sendStatus'](_0x354eaa);}return _0x40e966[_0x7eed('0x16')](_0x354eaa)[_0x7eed('0x17')]();};}function respondWithResult(_0x24bf26,_0x569de3){_0x569de3=_0x569de3||0xc8;return function(_0x500057){if(_0x500057){return _0x24bf26[_0x7eed('0x16')](_0x569de3)[_0x7eed('0x18')](_0x500057);}};}function respondWithFilteredResult(_0x31f733,_0xb8e20f){return function(_0x4bd444){if(_0x4bd444){var _0x4f2cd2=typeof _0xb8e20f[_0x7eed('0x19')]==='undefined'&&typeof _0xb8e20f['limit']==='undefined';var _0x5578e6=_0x4bd444[_0x7eed('0x1a')];var _0x5348d5=_0x4f2cd2?0x0:_0xb8e20f[_0x7eed('0x19')];var _0x3ea005=_0x4f2cd2?_0x4bd444[_0x7eed('0x1a')]:_0xb8e20f[_0x7eed('0x19')]+_0xb8e20f[_0x7eed('0x1b')];var _0x137f47;if(_0x3ea005>=_0x5578e6){_0x3ea005=_0x5578e6;_0x137f47=0xc8;}else{_0x137f47=0xce;}_0x31f733[_0x7eed('0x16')](_0x137f47);return _0x31f733[_0x7eed('0x1c')](_0x7eed('0x1d'),_0x5348d5+'-'+_0x3ea005+'/'+_0x5578e6)[_0x7eed('0x18')](_0x4bd444);}return null;};}function patchUpdates(_0x36131d){return function(_0x5afc62){try{jsonpatch['apply'](_0x5afc62,_0x36131d,!![]);}catch(_0x51cd29){return BPromise[_0x7eed('0x1e')](_0x51cd29);}return _0x5afc62[_0x7eed('0x1f')]();};}function saveUpdates(_0x541df9,_0x3b507a){return function(_0x304175){if(_0x304175){return _0x304175[_0x7eed('0x20')](_0x541df9)[_0x7eed('0x21')](function(_0x21f26c){return _0x21f26c;});}return null;};}function removeEntity(_0x5404f6,_0x5c9839){return function(_0xb72528){if(_0xb72528){return _0xb72528[_0x7eed('0x22')]()['then'](function(){_0x5404f6[_0x7eed('0x16')](0xcc)[_0x7eed('0x17')]();});}};}function handleEntityNotFound(_0x43de62,_0x63d483){return function(_0xa5aa90){if(!_0xa5aa90){_0x43de62['sendStatus'](0x194);}return _0xa5aa90;};}function handleError(_0x27f75e,_0x5db82d){_0x5db82d=_0x5db82d||0x1f4;return function(_0x1223fb){logger[_0x7eed('0x23')](_0x1223fb[_0x7eed('0x24')]);if(_0x1223fb['name']){delete _0x1223fb[_0x7eed('0x25')];}_0x27f75e[_0x7eed('0x16')](_0x5db82d)[_0x7eed('0x26')](_0x1223fb);};}exports[_0x7eed('0x27')]=function(_0x91468e,_0x4cb761){var _0x14ad65={},_0x11fb56={},_0x258018={'count':0x0,'rows':[]};var _0x2e6694=_[_0x7eed('0x28')](db[_0x7eed('0x29')][_0x7eed('0x2a')],function(_0x58d667){return{'name':_0x58d667['fieldName'],'type':_0x58d667[_0x7eed('0x2b')][_0x7eed('0x2c')]};});_0x11fb56['model']=_['map'](_0x2e6694,_0x7eed('0x25'));_0x11fb56[_0x7eed('0x2d')]=_['keys'](_0x91468e[_0x7eed('0x2d')]);_0x11fb56[_0x7eed('0x2e')]=_['intersection'](_0x11fb56['model'],_0x11fb56[_0x7eed('0x2d')]);_0x14ad65['attributes']=_[_0x7eed('0x2f')](_0x11fb56[_0x7eed('0x30')],qs['fields'](_0x91468e[_0x7eed('0x2d')][_0x7eed('0x31')]));_0x14ad65['attributes']=_0x14ad65['attributes'][_0x7eed('0x32')]?_0x14ad65[_0x7eed('0x33')]:_0x11fb56[_0x7eed('0x30')];if(!_0x91468e[_0x7eed('0x2d')][_0x7eed('0x34')](_0x7eed('0x35'))){_0x14ad65[_0x7eed('0x1b')]=qs[_0x7eed('0x1b')](_0x91468e['query'][_0x7eed('0x1b')]);_0x14ad65[_0x7eed('0x19')]=qs[_0x7eed('0x19')](_0x91468e[_0x7eed('0x2d')][_0x7eed('0x19')]);}_0x14ad65[_0x7eed('0x36')]=qs[_0x7eed('0x37')](_0x91468e[_0x7eed('0x2d')]['sort']);_0x14ad65['where']=qs[_0x7eed('0x2e')](_[_0x7eed('0x38')](_0x91468e[_0x7eed('0x2d')],_0x11fb56[_0x7eed('0x2e')]),_0x2e6694);if(_0x91468e['query'][_0x7eed('0x39')]){_0x14ad65['where']=_[_0x7eed('0x3a')](_0x14ad65[_0x7eed('0x3b')],{'$or':_[_0x7eed('0x28')](_0x2e6694,function(_0x6976ec){if(_0x6976ec[_0x7eed('0x2b')]!==_0x7eed('0x3c')){var _0x809e87={};_0x809e87[_0x6976ec[_0x7eed('0x25')]]={'$like':'%'+_0x91468e['query'][_0x7eed('0x39')]+'%'};return _0x809e87;}})});}_0x14ad65=_[_0x7eed('0x3a')]({},_0x14ad65,_0x91468e['options']);var _0x31995d={'where':_0x14ad65[_0x7eed('0x3b')]};return db[_0x7eed('0x29')][_0x7eed('0x1a')](_0x31995d)[_0x7eed('0x21')](function(_0x51a654){_0x258018['count']=_0x51a654;if(_0x91468e['query'][_0x7eed('0x3d')]){_0x14ad65['include']=[{'all':!![]}];}return db[_0x7eed('0x29')][_0x7eed('0x3e')](_0x14ad65);})[_0x7eed('0x21')](function(_0x133bbe){_0x258018[_0x7eed('0x3f')]=_0x133bbe;return _0x258018;})[_0x7eed('0x21')](respondWithFilteredResult(_0x4cb761,_0x14ad65))[_0x7eed('0x40')](handleError(_0x4cb761,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ac2415d..b59ebea 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 _0x407b=['./migration.attributes','define','migrations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x596e10,_0x49bfa6){var _0x2da107=function(_0x5891c8){while(--_0x5891c8){_0x596e10['push'](_0x596e10['shift']());}};_0x2da107(++_0x49bfa6);}(_0x407b,0xdf));var _0xb407=function(_0x4c2f82,_0x5b8b9a){_0x4c2f82=_0x4c2f82-0x0;var _0x29e716=_0x407b[_0x4c2f82];return _0x29e716;};'use strict';var _=require(_0xb407('0x0'));var util=require(_0xb407('0x1'));var logger=require(_0xb407('0x2'))('api');var moment=require(_0xb407('0x3'));var BPromise=require('bluebird');var rp=require(_0xb407('0x4'));var fs=require('fs');var path=require(_0xb407('0x5'));var rimraf=require(_0xb407('0x6'));var config=require(_0xb407('0x7'));var attributes=require(_0xb407('0x8'));module['exports']=function(_0x16f172,_0x442d7f){return _0x16f172[_0xb407('0x9')]('Migration',attributes,{'tableName':_0xb407('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb076=['define','Migration','migrations','lodash','util','../../config/logger','api','moment','path','rimraf','exports'];(function(_0x28beae,_0x5ba3d1){var _0x1531cb=function(_0x1344f9){while(--_0x1344f9){_0x28beae['push'](_0x28beae['shift']());}};_0x1531cb(++_0x5ba3d1);}(_0xb076,0x137));var _0x6b07=function(_0x3cc90b,_0x1b69d9){_0x3cc90b=_0x3cc90b-0x0;var _0x34051b=_0xb076[_0x3cc90b];return _0x34051b;};'use strict';var _=require(_0x6b07('0x0'));var util=require(_0x6b07('0x1'));var logger=require(_0x6b07('0x2'))(_0x6b07('0x3'));var moment=require(_0x6b07('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b07('0x5'));var rimraf=require(_0x6b07('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x6b07('0x7')]=function(_0x3f2f6b,_0x5a2672){return _0x3f2f6b[_0x6b07('0x8')](_0x6b07('0x9'),attributes,{'tableName':_0x6b07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index d82fefa..31ae92d 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 _0x85cf=['jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x53f6f2,_0x364bcf){var _0x14c5d3=function(_0x9b343a){while(--_0x9b343a){_0x53f6f2['push'](_0x53f6f2['shift']());}};_0x14c5d3(++_0x364bcf);}(_0x85cf,0x76));var _0xf85c=function(_0x1b713a,_0x252e46){_0x1b713a=_0x1b713a-0x0;var _0x1cbda5=_0x85cf[_0x1b713a];return _0x1cbda5;};'use strict';var _=require('lodash');var util=require(_0xf85c('0x0'));var moment=require(_0xf85c('0x1'));var BPromise=require(_0xf85c('0x2'));var rs=require(_0xf85c('0x3'));var fs=require('fs');var Redis=require(_0xf85c('0x4'));var db=require(_0xf85c('0x5'))['db'];var utils=require(_0xf85c('0x6'));var logger=require(_0xf85c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf85c('0x8'));var client=jayson[_0xf85c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x386a60,_0x41d08d,_0xe1be83){return new BPromise(function(_0x1bebcf,_0x1857d9){return client[_0xf85c('0xa')](_0x386a60,_0xe1be83)['then'](function(_0x25aa6e){logger[_0xf85c('0xb')]('Migration,\x20%s,\x20%s',_0x41d08d,'request\x20sent');logger[_0xf85c('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x41d08d,_0xf85c('0xd'),JSON[_0xf85c('0xe')](_0x25aa6e));if(_0x25aa6e[_0xf85c('0xf')]){if(_0x25aa6e['error'][_0xf85c('0x10')]===0x1f4){logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x25aa6e[_0xf85c('0xf')]['message']);return _0x1857d9(_0x25aa6e[_0xf85c('0xf')][_0xf85c('0x12')]);}logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x25aa6e['error'][_0xf85c('0x12')]);return _0x1bebcf(_0x25aa6e['error'][_0xf85c('0x12')]);}else{logger['info'](_0xf85c('0x11'),_0x41d08d,'request\x20sent');_0x1bebcf(_0x25aa6e[_0xf85c('0x13')]['message']);}})[_0xf85c('0x14')](function(_0x30b768){logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x30b768);_0x1857d9(_0x30b768);});});} \ No newline at end of file +var _0x0ca5=['request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a07a9,_0x1018a8){var _0x9c0b45=function(_0x31819c){while(--_0x31819c){_0x2a07a9['push'](_0x2a07a9['shift']());}};_0x9c0b45(++_0x1018a8);}(_0x0ca5,0xfc));var _0x50ca=function(_0x54b68d,_0x4a0df4){_0x54b68d=_0x54b68d-0x0;var _0x21252e=_0x0ca5[_0x54b68d];return _0x21252e;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var moment=require(_0x50ca('0x2'));var BPromise=require(_0x50ca('0x3'));var rs=require(_0x50ca('0x4'));var fs=require('fs');var Redis=require(_0x50ca('0x5'));var db=require(_0x50ca('0x6'))['db'];var utils=require(_0x50ca('0x7'));var logger=require('../../config/logger')(_0x50ca('0x8'));var config=require(_0x50ca('0x9'));var jayson=require(_0x50ca('0xa'));var client=jayson[_0x50ca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7d2c,_0x18142d,_0x47e1b1){return new BPromise(function(_0x14709d,_0x56e57a){return client[_0x50ca('0xc')](_0x4e7d2c,_0x47e1b1)['then'](function(_0x3ab7a0){logger[_0x50ca('0xd')](_0x50ca('0xe'),_0x18142d,_0x50ca('0xf'));logger[_0x50ca('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x18142d,'request\x20sent',JSON[_0x50ca('0x11')](_0x3ab7a0));if(_0x3ab7a0[_0x50ca('0x12')]){if(_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x13')]===0x1f4){logger[_0x50ca('0x12')](_0x50ca('0xe'),_0x18142d,_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);return _0x56e57a(_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);}logger[_0x50ca('0x12')](_0x50ca('0xe'),_0x18142d,_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);return _0x14709d(_0x3ab7a0[_0x50ca('0x12')]['message']);}else{logger[_0x50ca('0xd')](_0x50ca('0xe'),_0x18142d,_0x50ca('0xf'));_0x14709d(_0x3ab7a0[_0x50ca('0x15')][_0x50ca('0x14')]);}})['catch'](function(_0x1566f4){logger['error'](_0x50ca('0xe'),_0x18142d,_0x1566f4);_0x56e57a(_0x1566f4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c2d3c00..a41744e 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 _0x71af=['index','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3452fb,_0x577c34){var _0x2314ab=function(_0x5992a0){while(--_0x5992a0){_0x3452fb['push'](_0x3452fb['shift']());}};_0x2314ab(++_0x577c34);}(_0x71af,0x194));var _0xf71a=function(_0x11d4a1,_0x4da04d){_0x11d4a1=_0x11d4a1-0x0;var _0x2f18b1=_0x71af[_0x11d4a1];return _0x2f18b1;};'use strict';var multer=require(_0xf71a('0x0'));var util=require(_0xf71a('0x1'));var path=require('path');var timeout=require(_0xf71a('0x2'));var express=require(_0xf71a('0x3'));var router=express[_0xf71a('0x4')]();var fs_extra=require(_0xf71a('0x5'));var auth=require(_0xf71a('0x6'));var interaction=require(_0xf71a('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xf71a('0x8')]('/',auth[_0xf71a('0x9')](),controller[_0xf71a('0xa')]);router[_0xf71a('0x8')](_0xf71a('0xb'),auth[_0xf71a('0x9')](),controller[_0xf71a('0xc')]);router[_0xf71a('0xd')]('/',auth[_0xf71a('0x9')](),controller[_0xf71a('0xe')]);router['put'](_0xf71a('0xb'),auth[_0xf71a('0x9')](),controller['update']);router[_0xf71a('0xf')](_0xf71a('0xb'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x10')]);module[_0xf71a('0x11')]=router; \ No newline at end of file +var _0xf30f=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./network.controller','get'];(function(_0x29849a,_0x5f5950){var _0x200fc3=function(_0x44c3b2){while(--_0x44c3b2){_0x29849a['push'](_0x29849a['shift']());}};_0x200fc3(++_0x5f5950);}(_0xf30f,0x1a2));var _0xff30=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xf30f[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0xff30('0x0'));var util=require(_0xff30('0x1'));var path=require(_0xff30('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xff30('0x3'));var interaction=require(_0xff30('0x4'));var config=require('../../config/environment');var controller=require(_0xff30('0x5'));router[_0xff30('0x6')]('/',auth[_0xff30('0x7')](),controller[_0xff30('0x8')]);router[_0xff30('0x6')](_0xff30('0x9'),auth[_0xff30('0x7')](),controller[_0xff30('0xa')]);router[_0xff30('0xb')]('/',auth[_0xff30('0x7')](),controller[_0xff30('0xc')]);router[_0xff30('0xd')]('/:id',auth[_0xff30('0x7')](),controller['update']);router[_0xff30('0xe')](_0xff30('0x9'),auth[_0xff30('0x7')](),controller[_0xff30('0xf')]);module[_0xff30('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 777bbd8..27b23dc 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 _0x0776=['localnet','externip','turn','STRING','sequelize','exports','ENUM'];(function(_0x2ff38f,_0xefceba){var _0x19a75f=function(_0x22c3b1){while(--_0x22c3b1){_0x2ff38f['push'](_0x2ff38f['shift']());}};_0x19a75f(++_0xefceba);}(_0x0776,0x100));var _0x6077=function(_0x59cd4c,_0x10709f){_0x59cd4c=_0x59cd4c-0x0;var _0x70d848=_0x0776[_0x59cd4c];return _0x70d848;};'use strict';var Sequelize=require(_0x6077('0x0'));module[_0x6077('0x1')]={'type':{'type':Sequelize[_0x6077('0x2')](_0x6077('0x3'),_0x6077('0x4'),'stun',_0x6077('0x5'))},'value':{'type':Sequelize[_0x6077('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0b4=['localnet','externip','stun','STRING','sequelize','exports','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe0b4,0x17e));var _0x4e0b=function(_0x1c4fd9,_0x518329){_0x1c4fd9=_0x1c4fd9-0x0;var _0x5b109e=_0xe0b4[_0x1c4fd9];return _0x5b109e;};'use strict';var Sequelize=require(_0x4e0b('0x0'));module[_0x4e0b('0x1')]={'type':{'type':Sequelize[_0x4e0b('0x2')](_0x4e0b('0x3'),_0x4e0b('0x4'),_0x4e0b('0x5'),'turn')},'value':{'type':Sequelize[_0x4e0b('0x6')]},'username':{'type':Sequelize[_0x4e0b('0x6')]},'password':{'type':Sequelize[_0x4e0b('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 07cd27d..e2093b4 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 _0x93ac=['destroy','name','send','index','map','Network','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','filters','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','format','toLowerCase','chan_sip.so','update','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x93ac,0x9e));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc93a('0x0'));var rimraf=require(_0xc93a('0x1'));var zipdir=require(_0xc93a('0x2'));var jsonpatch=require(_0xc93a('0x3'));var rp=require('request-promise');var moment=require(_0xc93a('0x4'));var BPromise=require(_0xc93a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc93a('0x6'));var sox=require(_0xc93a('0x7'));var csv=require(_0xc93a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc93a('0x9'));var squel=require(_0xc93a('0xa'));var crypto=require(_0xc93a('0xb'));var jsforce=require(_0xc93a('0xc'));var deskjs=require(_0xc93a('0xd'));var toCsv=require(_0xc93a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc93a('0xe'));var qs=require(_0xc93a('0xf'));var as=require(_0xc93a('0x10'));var hardwareService=require(_0xc93a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc93a('0x12'));var config=require(_0xc93a('0x13'));var licenseUtil=require(_0xc93a('0x14'));var db=require(_0xc93a('0x15'))['db'];var jayson=require(_0xc93a('0x16'));var client=jayson[_0xc93a('0x17')][_0xc93a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5cf96d,_0x290c2d,_0x5870b5,_0x2ea4a7){return new BPromise(function(_0x4b7f08,_0x1c9041){var _0x19db34=_0x2ea4a7||client;return _0x19db34['request'](_0x5cf96d,_0x5870b5)[_0xc93a('0x19')](function(_0x11cca4){logger[_0xc93a('0x1a')](_0xc93a('0x1b'),_0x290c2d,_0xc93a('0x1c'));logger[_0xc93a('0x1d')](_0xc93a('0x1e'),_0x290c2d,'request\x20sent',JSON[_0xc93a('0x1f')](_0x11cca4));if(_0x11cca4[_0xc93a('0x20')]){if(_0x11cca4['error']['code']===0x1f4){logger['error'](_0xc93a('0x1b'),_0x290c2d,_0x11cca4[_0xc93a('0x20')][_0xc93a('0x21')]);return _0x1c9041(_0x11cca4[_0xc93a('0x20')][_0xc93a('0x21')]);}logger[_0xc93a('0x20')](_0xc93a('0x1b'),_0x290c2d,_0x11cca4[_0xc93a('0x20')]['message']);return _0x4b7f08(_0x11cca4[_0xc93a('0x20')][_0xc93a('0x21')]);}else{logger[_0xc93a('0x1a')]('Network,\x20%s,\x20%s',_0x290c2d,'request\x20sent');_0x4b7f08(_0x11cca4[_0xc93a('0x22')][_0xc93a('0x21')]);}})['catch'](function(_0x4aa595){logger[_0xc93a('0x20')](_0xc93a('0x1b'),_0x290c2d,_0x4aa595);_0x1c9041(_0x4aa595);});});}function respondWithStatusCode(_0xe1984e,_0x48fb77){_0x48fb77=_0x48fb77||0xcc;return function(_0x2accfc){if(_0x2accfc){return _0xe1984e[_0xc93a('0x23')](_0x48fb77);}return _0xe1984e[_0xc93a('0x24')](_0x48fb77)[_0xc93a('0x25')]();};}function respondWithResult(_0x148c94,_0x3095b4){_0x3095b4=_0x3095b4||0xc8;return function(_0x3ec456){if(_0x3ec456){return _0x148c94[_0xc93a('0x24')](_0x3095b4)['json'](_0x3ec456);}};}function respondWithFilteredResult(_0x48f190,_0x87db57){return function(_0x25e8b7){if(_0x25e8b7){var _0x1e4ae3=typeof _0x87db57[_0xc93a('0x26')]==='undefined'&&typeof _0x87db57[_0xc93a('0x27')]===_0xc93a('0x28');var _0x1771c8=_0x25e8b7['count'];var _0x43d38d=_0x1e4ae3?0x0:_0x87db57[_0xc93a('0x26')];var _0x3b0a15=_0x1e4ae3?_0x25e8b7[_0xc93a('0x29')]:_0x87db57[_0xc93a('0x26')]+_0x87db57[_0xc93a('0x27')];var _0x195d0d;if(_0x3b0a15>=_0x1771c8){_0x3b0a15=_0x1771c8;_0x195d0d=0xc8;}else{_0x195d0d=0xce;}_0x48f190[_0xc93a('0x24')](_0x195d0d);return _0x48f190[_0xc93a('0x2a')]('Content-Range',_0x43d38d+'-'+_0x3b0a15+'/'+_0x1771c8)[_0xc93a('0x2b')](_0x25e8b7);}return null;};}function patchUpdates(_0x396374){return function(_0x887201){try{jsonpatch[_0xc93a('0x2c')](_0x887201,_0x396374,!![]);}catch(_0x1daba7){return BPromise['reject'](_0x1daba7);}return _0x887201[_0xc93a('0x2d')]();};}function saveUpdates(_0x659b40,_0x51ac5e){return function(_0x577196){if(_0x577196){return _0x577196['update'](_0x659b40)['then'](function(_0x10748b){return _0x10748b;});}return null;};}function removeEntity(_0x5174f5,_0x403334){return function(_0x330a00){if(_0x330a00){return _0x330a00[_0xc93a('0x2e')]()[_0xc93a('0x19')](function(){_0x5174f5[_0xc93a('0x24')](0xcc)[_0xc93a('0x25')]();});}};}function handleEntityNotFound(_0x43fbb1,_0x4b4865){return function(_0x5cf9a9){if(!_0x5cf9a9){_0x43fbb1[_0xc93a('0x23')](0x194);}return _0x5cf9a9;};}function handleError(_0x1932aa,_0x4c576e){_0x4c576e=_0x4c576e||0x1f4;return function(_0x405426){logger[_0xc93a('0x20')](_0x405426['stack']);if(_0x405426[_0xc93a('0x2f')]){delete _0x405426['name'];}_0x1932aa['status'](_0x4c576e)[_0xc93a('0x30')](_0x405426);};}exports[_0xc93a('0x31')]=function(_0x20ef22,_0x508920){var _0x14618e={},_0x1ee1d4={},_0x469e50={'count':0x0,'rows':[]};var _0x437ed9=_[_0xc93a('0x32')](db[_0xc93a('0x33')]['rawAttributes'],function(_0x19711c){return{'name':_0x19711c[_0xc93a('0x34')],'type':_0x19711c[_0xc93a('0x35')][_0xc93a('0x36')]};});_0x1ee1d4[_0xc93a('0x37')]=_[_0xc93a('0x32')](_0x437ed9,_0xc93a('0x2f'));_0x1ee1d4[_0xc93a('0x38')]=_[_0xc93a('0x39')](_0x20ef22['query']);_0x1ee1d4['filters']=_[_0xc93a('0x3a')](_0x1ee1d4[_0xc93a('0x37')],_0x1ee1d4[_0xc93a('0x38')]);_0x14618e['attributes']=_[_0xc93a('0x3a')](_0x1ee1d4[_0xc93a('0x37')],qs[_0xc93a('0x3b')](_0x20ef22[_0xc93a('0x38')][_0xc93a('0x3b')]));_0x14618e[_0xc93a('0x3c')]=_0x14618e['attributes'][_0xc93a('0x3d')]?_0x14618e[_0xc93a('0x3c')]:_0x1ee1d4[_0xc93a('0x37')];if(!_0x20ef22[_0xc93a('0x38')]['hasOwnProperty'](_0xc93a('0x3e'))){_0x14618e[_0xc93a('0x27')]=qs[_0xc93a('0x27')](_0x20ef22[_0xc93a('0x38')][_0xc93a('0x27')]);_0x14618e[_0xc93a('0x26')]=qs[_0xc93a('0x26')](_0x20ef22[_0xc93a('0x38')][_0xc93a('0x26')]);}_0x14618e[_0xc93a('0x3f')]=qs[_0xc93a('0x40')](_0x20ef22[_0xc93a('0x38')]['sort']);_0x14618e['where']=qs['filters'](_[_0xc93a('0x41')](_0x20ef22['query'],_0x1ee1d4['filters']),_0x437ed9);if(_0x20ef22[_0xc93a('0x38')][_0xc93a('0x42')]){_0x14618e[_0xc93a('0x43')]=_[_0xc93a('0x44')](_0x14618e['where'],{'$or':_[_0xc93a('0x32')](_0x437ed9,function(_0x188226){if(_0x188226[_0xc93a('0x35')]!==_0xc93a('0x45')){var _0xbf9afb={};_0xbf9afb[_0x188226[_0xc93a('0x2f')]]={'$like':'%'+_0x20ef22[_0xc93a('0x38')][_0xc93a('0x42')]+'%'};return _0xbf9afb;}})});}_0x14618e=_[_0xc93a('0x44')]({},_0x14618e,_0x20ef22[_0xc93a('0x46')]);var _0x2e7eb9={'where':_0x14618e['where']};return db[_0xc93a('0x33')][_0xc93a('0x29')](_0x2e7eb9)[_0xc93a('0x19')](function(_0x4b8689){_0x469e50[_0xc93a('0x29')]=_0x4b8689;if(_0x20ef22[_0xc93a('0x38')][_0xc93a('0x47')]){_0x14618e['include']=[{'all':!![]}];}return db['Network'][_0xc93a('0x48')](_0x14618e);})[_0xc93a('0x19')](function(_0xa31e1f){_0x469e50['rows']=_0xa31e1f;return _0x469e50;})['then'](respondWithFilteredResult(_0x508920,_0x14618e))[_0xc93a('0x49')](handleError(_0x508920,null));};exports[_0xc93a('0x4a')]=function(_0x2679be,_0x2cef44){var _0x40ac5c={'raw':!![],'where':{'id':_0x2679be[_0xc93a('0x4b')]['id']}},_0xae2199={};_0xae2199[_0xc93a('0x37')]=_[_0xc93a('0x39')](db[_0xc93a('0x33')][_0xc93a('0x4c')]);_0xae2199['query']=_[_0xc93a('0x39')](_0x2679be[_0xc93a('0x38')]);_0xae2199[_0xc93a('0x4d')]=_['intersection'](_0xae2199[_0xc93a('0x37')],_0xae2199[_0xc93a('0x38')]);_0x40ac5c[_0xc93a('0x3c')]=_[_0xc93a('0x3a')](_0xae2199['model'],qs[_0xc93a('0x3b')](_0x2679be[_0xc93a('0x38')][_0xc93a('0x3b')]));_0x40ac5c['attributes']=_0x40ac5c['attributes'][_0xc93a('0x3d')]?_0x40ac5c['attributes']:_0xae2199[_0xc93a('0x37')];if(_0x2679be[_0xc93a('0x38')][_0xc93a('0x47')]){_0x40ac5c['include']=[{'all':!![]}];}_0x40ac5c=_['merge']({},_0x40ac5c,_0x2679be['options']);return db['Network'][_0xc93a('0x4e')](_0x40ac5c)[_0xc93a('0x19')](handleEntityNotFound(_0x2cef44,null))[_0xc93a('0x19')](respondWithResult(_0x2cef44,null))[_0xc93a('0x49')](handleError(_0x2cef44,null));};exports[_0xc93a('0x4f')]=function(_0x468911,_0x371647,_0xaf0e5f){var _0xf2e405;return db['sequelize'][_0xc93a('0x50')](function(_0x1abfa4){return db[_0xc93a('0x33')][_0xc93a('0x4f')](_0x468911[_0xc93a('0x51')],{'raw':!![]})[_0xc93a('0x19')](function(_0x2941aa){_0xf2e405=_0x2941aa;return db[_0xc93a('0x33')][_0xc93a('0x48')]({'where':{'type':_0x468911[_0xc93a('0x51')]['type']},'raw':!![]});})[_0xc93a('0x19')](function(_0xb82e97){if(_0xf2e405[_0xc93a('0x35')][_0xc93a('0x52')]()==_0xc93a('0x53')){var _0x4fe159=fs[_0xc93a('0x54')](path[_0xc93a('0x55')](config[_0xc93a('0x56')],'server/files/templates/stun_multiple.ejs'),_0xc93a('0x57'));var _0x101145=ejs[_0xc93a('0x58')](_0x4fe159,{'networks':_0xb82e97||[]});fs[_0xc93a('0x59')](_0xc93a('0x5a'),_0x101145);return respondWithRpcPromise(_0xc93a('0x5b'),_0xc93a('0x4f'),{'module':'res_stun_monitor.so'});}else if(_0xf2e405[_0xc93a('0x35')]['toUpperCase']()==_0xc93a('0x5c')){var _0x5bdb25=fs['readFileSync'](path[_0xc93a('0x55')](config[_0xc93a('0x56')],_0xc93a('0x5d')),_0xc93a('0x57'));var _0x1ee275=ejs[_0xc93a('0x58')](_0x5bdb25,{'networks':_0xb82e97||[]});fs[_0xc93a('0x59')]('/etc/asterisk/turn_xcally.conf',_0x1ee275);return respondWithRpcPromise('Reload',_0xc93a('0x4f'),{'module':_0xc93a('0x5e')});}else{var _0x48a9d3=fs[_0xc93a('0x54')](path[_0xc93a('0x55')](config[_0xc93a('0x56')],'server/files/templates/network.ejs'),_0xc93a('0x57'));var _0x44b28e=ejs[_0xc93a('0x58')](_0x48a9d3,{'networks':_0xb82e97||[]});fs[_0xc93a('0x59')](util[_0xc93a('0x5f')]('/etc/asterisk/sip_xcally_%s.conf',_0x468911['body'][_0xc93a('0x35')][_0xc93a('0x60')]()),_0x44b28e);return respondWithRpcPromise('Reload','create',{'module':_0xc93a('0x61')});}return null;})[_0xc93a('0x19')](function(){return _0xf2e405;});})['then'](respondWithResult(_0x371647,0xc9))[_0xc93a('0x49')](handleError(_0x371647,null));};exports[_0xc93a('0x62')]=function(_0x1c2a4d,_0x4ef3f2,_0x39ef6c){var _0x30878d;return db['sequelize'][_0xc93a('0x50')](function(_0x2610af){return db[_0xc93a('0x33')][_0xc93a('0x4e')]({'where':{'id':_0x1c2a4d['params']['id']}})[_0xc93a('0x19')](handleEntityNotFound(_0x4ef3f2,null))[_0xc93a('0x19')](saveUpdates(_0x1c2a4d[_0xc93a('0x51')],null))[_0xc93a('0x19')](function(_0x573026){if(_0x573026){_0x30878d=_0x573026;return db[_0xc93a('0x33')][_0xc93a('0x48')]({'where':{'type':_0x30878d[_0xc93a('0x35')]},'raw':!![]});}return null;})[_0xc93a('0x19')](function(_0x3cc288){if(_0x30878d[_0xc93a('0x35')][_0xc93a('0x52')]()=='STUN'){var _0x3a66a4=fs['readFileSync'](path[_0xc93a('0x55')](config[_0xc93a('0x56')],'server/files/templates/stun_multiple.ejs'),_0xc93a('0x57'));var _0xec6345=ejs[_0xc93a('0x58')](_0x3a66a4,{'networks':_0x3cc288||[]});fs[_0xc93a('0x59')](_0xc93a('0x5a'),_0xec6345);return respondWithRpcPromise('Reload',_0xc93a('0x62'),{'module':_0xc93a('0x5e')});}else if(_0x30878d['type']['toUpperCase']()=='TURN'){var _0x435cff=fs[_0xc93a('0x54')](path[_0xc93a('0x55')](config['root'],_0xc93a('0x5d')),_0xc93a('0x57'));var _0xcad056=ejs[_0xc93a('0x58')](_0x435cff,{'networks':_0x3cc288||[]});fs[_0xc93a('0x59')]('/etc/asterisk/turn_xcally.conf',_0xcad056);return respondWithRpcPromise(_0xc93a('0x5b'),_0xc93a('0x62'),{'module':_0xc93a('0x5e')});}else{var _0x332317=fs['readFileSync'](path[_0xc93a('0x55')](config[_0xc93a('0x56')],'server/files/templates/network.ejs'),_0xc93a('0x57'));var _0x2ed952=ejs['render'](_0x332317,{'networks':_0x3cc288||[]});fs['writeFileSync'](util[_0xc93a('0x5f')](_0xc93a('0x63'),_0x1c2a4d[_0xc93a('0x51')][_0xc93a('0x35')][_0xc93a('0x60')]()),_0x2ed952);return respondWithRpcPromise(_0xc93a('0x5b'),_0xc93a('0x62'),{'module':'chan_sip.so'});}return null;})[_0xc93a('0x19')](function(_0x4a7968){if(_0x4a7968){return _0x30878d;}return null;});})[_0xc93a('0x19')](respondWithResult(_0x4ef3f2,null))['catch'](handleError(_0x4ef3f2,null));};exports[_0xc93a('0x2e')]=function(_0x1ce767,_0x23f1d8,_0x4ba14f){var _0x724460;return db[_0xc93a('0x33')]['find']({'where':{'id':_0x1ce767[_0xc93a('0x4b')]['id']}})[_0xc93a('0x19')](function(_0x568c5a){_0x724460=_0x568c5a;return _0x568c5a;})['then'](handleEntityNotFound(_0x23f1d8,null))['then'](removeEntity(_0x23f1d8,null))[_0xc93a('0x19')](function(){if(_0x724460){return db[_0xc93a('0x33')]['findAll']({'where':{'type':_0x724460[_0xc93a('0x35')]},'raw':!![]});}})[_0xc93a('0x19')](function(_0x2adf78){if(_0x724460[_0xc93a('0x35')][_0xc93a('0x52')]()=='STUN'){var _0xb49aec=fs[_0xc93a('0x54')](path[_0xc93a('0x55')](config[_0xc93a('0x56')],_0xc93a('0x64')),_0xc93a('0x57'));var _0xcd6fdd=ejs[_0xc93a('0x58')](_0xb49aec,{'networks':_0x2adf78||[]});fs[_0xc93a('0x59')](_0xc93a('0x5a'),_0xcd6fdd);return respondWithRpcPromise(_0xc93a('0x5b'),_0xc93a('0x2e'),{'module':_0xc93a('0x5e')});}else if(_0x724460[_0xc93a('0x35')]['toUpperCase']()=='TURN'){var _0x2d0329=fs[_0xc93a('0x54')](path[_0xc93a('0x55')](config[_0xc93a('0x56')],_0xc93a('0x5d')),'utf8');var _0x42133e=ejs[_0xc93a('0x58')](_0x2d0329,{'networks':_0x2adf78||[]});fs[_0xc93a('0x59')]('/etc/asterisk/turn_xcally.conf',_0x42133e);return respondWithRpcPromise(_0xc93a('0x5b'),_0xc93a('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0x25d761=fs[_0xc93a('0x54')](path[_0xc93a('0x55')](config[_0xc93a('0x56')],_0xc93a('0x65')),_0xc93a('0x57'));var _0x3644ba=ejs[_0xc93a('0x58')](_0x25d761,{'networks':_0x2adf78||[]});fs[_0xc93a('0x59')](util[_0xc93a('0x5f')](_0xc93a('0x63'),_0x1ce767[_0xc93a('0x51')][_0xc93a('0x35')]['toLowerCase']()),_0x3644ba);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});}return null;})[_0xc93a('0x49')](handleError(_0x23f1d8,null));}; \ No newline at end of file +var _0x8fd9=['update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','sequelize','transaction','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x42b605,_0xeac8ad){var _0x5928eb=function(_0x118f0f){while(--_0x118f0f){_0x42b605['push'](_0x42b605['shift']());}};_0x5928eb(++_0xeac8ad);}(_0x8fd9,0x18c));var _0x98fd=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0x8fd9[_0x5ba74f];return _0x534d79;};'use strict';var emlformat=require(_0x98fd('0x0'));var rimraf=require(_0x98fd('0x1'));var zipdir=require(_0x98fd('0x2'));var jsonpatch=require(_0x98fd('0x3'));var rp=require('request-promise');var moment=require(_0x98fd('0x4'));var BPromise=require(_0x98fd('0x5'));var Mustache=require(_0x98fd('0x6'));var util=require('util');var path=require(_0x98fd('0x7'));var sox=require(_0x98fd('0x8'));var csv=require(_0x98fd('0x9'));var ejs=require(_0x98fd('0xa'));var fs=require('fs');var fs_extra=require(_0x98fd('0xb'));var _=require(_0x98fd('0xc'));var squel=require(_0x98fd('0xd'));var crypto=require(_0x98fd('0xe'));var jsforce=require(_0x98fd('0xf'));var deskjs=require(_0x98fd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98fd('0x11'));var Papa=require(_0x98fd('0x12'));var Redis=require(_0x98fd('0x13'));var authService=require(_0x98fd('0x14'));var qs=require(_0x98fd('0x15'));var as=require(_0x98fd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98fd('0x17'))(_0x98fd('0x18'));var utils=require(_0x98fd('0x19'));var config=require(_0x98fd('0x1a'));var licenseUtil=require(_0x98fd('0x1b'));var db=require(_0x98fd('0x1c'))['db'];var jayson=require(_0x98fd('0x1d'));var client=jayson[_0x98fd('0x1e')][_0x98fd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x191df4,_0x161412,_0x533e87,_0x646a7c){return new BPromise(function(_0x2aed3a,_0x5a74ff){var _0x1383d7=_0x646a7c||client;return _0x1383d7[_0x98fd('0x20')](_0x191df4,_0x533e87)[_0x98fd('0x21')](function(_0x103342){logger[_0x98fd('0x22')]('Network,\x20%s,\x20%s',_0x161412,_0x98fd('0x23'));logger[_0x98fd('0x24')](_0x98fd('0x25'),_0x161412,_0x98fd('0x23'),JSON['stringify'](_0x103342));if(_0x103342[_0x98fd('0x26')]){if(_0x103342[_0x98fd('0x26')][_0x98fd('0x27')]===0x1f4){logger[_0x98fd('0x26')](_0x98fd('0x28'),_0x161412,_0x103342[_0x98fd('0x26')][_0x98fd('0x29')]);return _0x5a74ff(_0x103342[_0x98fd('0x26')]['message']);}logger[_0x98fd('0x26')](_0x98fd('0x28'),_0x161412,_0x103342[_0x98fd('0x26')][_0x98fd('0x29')]);return _0x2aed3a(_0x103342[_0x98fd('0x26')][_0x98fd('0x29')]);}else{logger[_0x98fd('0x22')](_0x98fd('0x28'),_0x161412,_0x98fd('0x23'));_0x2aed3a(_0x103342[_0x98fd('0x2a')][_0x98fd('0x29')]);}})[_0x98fd('0x2b')](function(_0x5a9c2e){logger[_0x98fd('0x26')](_0x98fd('0x28'),_0x161412,_0x5a9c2e);_0x5a74ff(_0x5a9c2e);});});}function respondWithStatusCode(_0x3eaba0,_0x5ef193){_0x5ef193=_0x5ef193||0xcc;return function(_0x82cd50){if(_0x82cd50){return _0x3eaba0[_0x98fd('0x2c')](_0x5ef193);}return _0x3eaba0[_0x98fd('0x2d')](_0x5ef193)[_0x98fd('0x2e')]();};}function respondWithResult(_0xd2b221,_0x394b10){_0x394b10=_0x394b10||0xc8;return function(_0x3b5656){if(_0x3b5656){return _0xd2b221[_0x98fd('0x2d')](_0x394b10)[_0x98fd('0x2f')](_0x3b5656);}};}function respondWithFilteredResult(_0x48066d,_0x483b11){return function(_0x10b2e9){if(_0x10b2e9){var _0x1437e2=typeof _0x483b11[_0x98fd('0x30')]===_0x98fd('0x31')&&typeof _0x483b11[_0x98fd('0x32')]===_0x98fd('0x31');var _0x19df6d=_0x10b2e9[_0x98fd('0x33')];var _0x5a7e2c=_0x1437e2?0x0:_0x483b11[_0x98fd('0x30')];var _0x4fe118=_0x1437e2?_0x10b2e9[_0x98fd('0x33')]:_0x483b11[_0x98fd('0x30')]+_0x483b11[_0x98fd('0x32')];var _0x3ebefb;if(_0x4fe118>=_0x19df6d){_0x4fe118=_0x19df6d;_0x3ebefb=0xc8;}else{_0x3ebefb=0xce;}_0x48066d[_0x98fd('0x2d')](_0x3ebefb);return _0x48066d[_0x98fd('0x34')]('Content-Range',_0x5a7e2c+'-'+_0x4fe118+'/'+_0x19df6d)[_0x98fd('0x2f')](_0x10b2e9);}return null;};}function patchUpdates(_0x1b2303){return function(_0x576386){try{jsonpatch[_0x98fd('0x35')](_0x576386,_0x1b2303,!![]);}catch(_0x301498){return BPromise[_0x98fd('0x36')](_0x301498);}return _0x576386[_0x98fd('0x37')]();};}function saveUpdates(_0x59e36d,_0x2493da){return function(_0x52801a){if(_0x52801a){return _0x52801a[_0x98fd('0x38')](_0x59e36d)['then'](function(_0x272f61){return _0x272f61;});}return null;};}function removeEntity(_0x18f410,_0x489767){return function(_0x21cf5c){if(_0x21cf5c){return _0x21cf5c[_0x98fd('0x39')]()['then'](function(){_0x18f410[_0x98fd('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3010c7,_0x20615a){return function(_0x3f8409){if(!_0x3f8409){_0x3010c7[_0x98fd('0x2c')](0x194);}return _0x3f8409;};}function handleError(_0x373c6e,_0x401c7b){_0x401c7b=_0x401c7b||0x1f4;return function(_0x4a7d4c){logger[_0x98fd('0x26')](_0x4a7d4c[_0x98fd('0x3a')]);if(_0x4a7d4c['name']){delete _0x4a7d4c[_0x98fd('0x3b')];}_0x373c6e[_0x98fd('0x2d')](_0x401c7b)[_0x98fd('0x3c')](_0x4a7d4c);};}exports[_0x98fd('0x3d')]=function(_0xa19165,_0x2da1cc){var _0xd7998d={},_0x4deb57={},_0x3f21c4={'count':0x0,'rows':[]};var _0x3ace9c=_['map'](db[_0x98fd('0x3e')][_0x98fd('0x3f')],function(_0x565966){return{'name':_0x565966[_0x98fd('0x40')],'type':_0x565966[_0x98fd('0x41')]['key']};});_0x4deb57[_0x98fd('0x42')]=_[_0x98fd('0x43')](_0x3ace9c,_0x98fd('0x3b'));_0x4deb57[_0x98fd('0x44')]=_[_0x98fd('0x45')](_0xa19165['query']);_0x4deb57[_0x98fd('0x46')]=_[_0x98fd('0x47')](_0x4deb57[_0x98fd('0x42')],_0x4deb57[_0x98fd('0x44')]);_0xd7998d[_0x98fd('0x48')]=_[_0x98fd('0x47')](_0x4deb57[_0x98fd('0x42')],qs[_0x98fd('0x49')](_0xa19165[_0x98fd('0x44')][_0x98fd('0x49')]));_0xd7998d[_0x98fd('0x48')]=_0xd7998d[_0x98fd('0x48')][_0x98fd('0x4a')]?_0xd7998d[_0x98fd('0x48')]:_0x4deb57[_0x98fd('0x42')];if(!_0xa19165[_0x98fd('0x44')]['hasOwnProperty'](_0x98fd('0x4b'))){_0xd7998d[_0x98fd('0x32')]=qs[_0x98fd('0x32')](_0xa19165[_0x98fd('0x44')][_0x98fd('0x32')]);_0xd7998d[_0x98fd('0x30')]=qs['offset'](_0xa19165['query'][_0x98fd('0x30')]);}_0xd7998d[_0x98fd('0x4c')]=qs[_0x98fd('0x4d')](_0xa19165[_0x98fd('0x44')][_0x98fd('0x4d')]);_0xd7998d['where']=qs[_0x98fd('0x46')](_[_0x98fd('0x4e')](_0xa19165['query'],_0x4deb57[_0x98fd('0x46')]),_0x3ace9c);if(_0xa19165[_0x98fd('0x44')][_0x98fd('0x4f')]){_0xd7998d[_0x98fd('0x50')]=_[_0x98fd('0x51')](_0xd7998d[_0x98fd('0x50')],{'$or':_[_0x98fd('0x43')](_0x3ace9c,function(_0x2ad121){if(_0x2ad121[_0x98fd('0x41')]!==_0x98fd('0x52')){var _0xe797c8={};_0xe797c8[_0x2ad121[_0x98fd('0x3b')]]={'$like':'%'+_0xa19165[_0x98fd('0x44')]['filter']+'%'};return _0xe797c8;}})});}_0xd7998d=_[_0x98fd('0x51')]({},_0xd7998d,_0xa19165['options']);var _0x77b0af={'where':_0xd7998d[_0x98fd('0x50')]};return db[_0x98fd('0x3e')][_0x98fd('0x33')](_0x77b0af)[_0x98fd('0x21')](function(_0x16037c){_0x3f21c4['count']=_0x16037c;if(_0xa19165[_0x98fd('0x44')][_0x98fd('0x53')]){_0xd7998d[_0x98fd('0x54')]=[{'all':!![]}];}return db[_0x98fd('0x3e')][_0x98fd('0x55')](_0xd7998d);})['then'](function(_0x47fc78){_0x3f21c4[_0x98fd('0x56')]=_0x47fc78;return _0x3f21c4;})['then'](respondWithFilteredResult(_0x2da1cc,_0xd7998d))[_0x98fd('0x2b')](handleError(_0x2da1cc,null));};exports['show']=function(_0x5129a2,_0x2d92af){var _0x4eda73={'raw':!![],'where':{'id':_0x5129a2[_0x98fd('0x57')]['id']}},_0x4fd2a9={};_0x4fd2a9['model']=_[_0x98fd('0x45')](db[_0x98fd('0x3e')][_0x98fd('0x3f')]);_0x4fd2a9[_0x98fd('0x44')]=_['keys'](_0x5129a2[_0x98fd('0x44')]);_0x4fd2a9[_0x98fd('0x46')]=_[_0x98fd('0x47')](_0x4fd2a9[_0x98fd('0x42')],_0x4fd2a9[_0x98fd('0x44')]);_0x4eda73[_0x98fd('0x48')]=_[_0x98fd('0x47')](_0x4fd2a9[_0x98fd('0x42')],qs[_0x98fd('0x49')](_0x5129a2[_0x98fd('0x44')]['fields']));_0x4eda73[_0x98fd('0x48')]=_0x4eda73[_0x98fd('0x48')][_0x98fd('0x4a')]?_0x4eda73[_0x98fd('0x48')]:_0x4fd2a9[_0x98fd('0x42')];if(_0x5129a2[_0x98fd('0x44')][_0x98fd('0x53')]){_0x4eda73[_0x98fd('0x54')]=[{'all':!![]}];}_0x4eda73=_['merge']({},_0x4eda73,_0x5129a2[_0x98fd('0x58')]);return db[_0x98fd('0x3e')][_0x98fd('0x59')](_0x4eda73)[_0x98fd('0x21')](handleEntityNotFound(_0x2d92af,null))[_0x98fd('0x21')](respondWithResult(_0x2d92af,null))['catch'](handleError(_0x2d92af,null));};exports['create']=function(_0x522378,_0x5ddf55,_0x1bc970){var _0x100e1c;return db[_0x98fd('0x5a')][_0x98fd('0x5b')](function(_0x3e7d1f){return db[_0x98fd('0x3e')][_0x98fd('0x5c')](_0x522378['body'],{'raw':!![]})['then'](function(_0x5a4cbf){_0x100e1c=_0x5a4cbf;return db[_0x98fd('0x3e')]['findAll']({'where':{'type':_0x522378[_0x98fd('0x5d')][_0x98fd('0x41')]},'raw':!![]});})[_0x98fd('0x21')](function(_0x4e542f){if(_0x100e1c[_0x98fd('0x41')][_0x98fd('0x5e')]()=='STUN'){var _0x1b0039=fs[_0x98fd('0x5f')](path[_0x98fd('0x60')](config[_0x98fd('0x61')],_0x98fd('0x62')),_0x98fd('0x63'));var _0x5148a7=ejs[_0x98fd('0x64')](_0x1b0039,{'networks':_0x4e542f||[]});fs['writeFileSync'](_0x98fd('0x65'),_0x5148a7);return respondWithRpcPromise(_0x98fd('0x66'),'create',{'module':_0x98fd('0x67')});}else if(_0x100e1c[_0x98fd('0x41')][_0x98fd('0x5e')]()==_0x98fd('0x68')){var _0xcebc53=fs[_0x98fd('0x5f')](path[_0x98fd('0x60')](config[_0x98fd('0x61')],_0x98fd('0x69')),_0x98fd('0x63'));var _0x3077f4=ejs[_0x98fd('0x64')](_0xcebc53,{'networks':_0x4e542f||[]});fs[_0x98fd('0x6a')](_0x98fd('0x6b'),_0x3077f4);return respondWithRpcPromise('Reload',_0x98fd('0x5c'),{'module':_0x98fd('0x67')});}else{var _0x207622=fs[_0x98fd('0x5f')](path['join'](config[_0x98fd('0x61')],_0x98fd('0x6c')),_0x98fd('0x63'));var _0x1c4b7d=ejs[_0x98fd('0x64')](_0x207622,{'networks':_0x4e542f||[]});fs['writeFileSync'](util[_0x98fd('0x6d')](_0x98fd('0x6e'),_0x522378['body'][_0x98fd('0x41')][_0x98fd('0x6f')]()),_0x1c4b7d);return respondWithRpcPromise('Reload',_0x98fd('0x5c'),{'module':_0x98fd('0x70')});}return null;})[_0x98fd('0x21')](function(){return _0x100e1c;});})[_0x98fd('0x21')](respondWithResult(_0x5ddf55,0xc9))[_0x98fd('0x2b')](handleError(_0x5ddf55,null));};exports['update']=function(_0x4128f0,_0x5c0cdb,_0x2927cd){var _0x439371;return db[_0x98fd('0x5a')][_0x98fd('0x5b')](function(_0x58b8de){return db[_0x98fd('0x3e')]['find']({'where':{'id':_0x4128f0[_0x98fd('0x57')]['id']}})[_0x98fd('0x21')](handleEntityNotFound(_0x5c0cdb,null))[_0x98fd('0x21')](saveUpdates(_0x4128f0[_0x98fd('0x5d')],null))[_0x98fd('0x21')](function(_0x341a9e){if(_0x341a9e){_0x439371=_0x341a9e;return db[_0x98fd('0x3e')]['findAll']({'where':{'type':_0x439371[_0x98fd('0x41')]},'raw':!![]});}return null;})['then'](function(_0x3da587){if(_0x439371[_0x98fd('0x41')][_0x98fd('0x5e')]()=='STUN'){var _0x1cceed=fs['readFileSync'](path['join'](config[_0x98fd('0x61')],_0x98fd('0x62')),_0x98fd('0x63'));var _0x35b727=ejs[_0x98fd('0x64')](_0x1cceed,{'networks':_0x3da587||[]});fs['writeFileSync'](_0x98fd('0x65'),_0x35b727);return respondWithRpcPromise(_0x98fd('0x66'),'update',{'module':_0x98fd('0x67')});}else if(_0x439371[_0x98fd('0x41')][_0x98fd('0x5e')]()==_0x98fd('0x68')){var _0x562962=fs['readFileSync'](path['join'](config[_0x98fd('0x61')],_0x98fd('0x69')),'utf8');var _0x502118=ejs[_0x98fd('0x64')](_0x562962,{'networks':_0x3da587||[]});fs[_0x98fd('0x6a')](_0x98fd('0x6b'),_0x502118);return respondWithRpcPromise(_0x98fd('0x66'),_0x98fd('0x38'),{'module':_0x98fd('0x67')});}else{var _0x28d0ef=fs[_0x98fd('0x5f')](path['join'](config['root'],_0x98fd('0x6c')),_0x98fd('0x63'));var _0x5d05b1=ejs['render'](_0x28d0ef,{'networks':_0x3da587||[]});fs[_0x98fd('0x6a')](util['format'](_0x98fd('0x6e'),_0x4128f0[_0x98fd('0x5d')][_0x98fd('0x41')][_0x98fd('0x6f')]()),_0x5d05b1);return respondWithRpcPromise(_0x98fd('0x66'),_0x98fd('0x38'),{'module':'chan_sip.so'});}return null;})[_0x98fd('0x21')](function(_0x4402f8){if(_0x4402f8){return _0x439371;}return null;});})[_0x98fd('0x21')](respondWithResult(_0x5c0cdb,null))[_0x98fd('0x2b')](handleError(_0x5c0cdb,null));};exports[_0x98fd('0x39')]=function(_0x26e2c0,_0x42050e,_0xb6f3){var _0x489683;return db[_0x98fd('0x3e')][_0x98fd('0x59')]({'where':{'id':_0x26e2c0['params']['id']}})[_0x98fd('0x21')](function(_0x4f7159){_0x489683=_0x4f7159;return _0x4f7159;})[_0x98fd('0x21')](handleEntityNotFound(_0x42050e,null))[_0x98fd('0x21')](removeEntity(_0x42050e,null))[_0x98fd('0x21')](function(){if(_0x489683){return db[_0x98fd('0x3e')][_0x98fd('0x55')]({'where':{'type':_0x489683['type']},'raw':!![]});}})[_0x98fd('0x21')](function(_0x51b129){if(_0x489683[_0x98fd('0x41')][_0x98fd('0x5e')]()=='STUN'){var _0x19c027=fs[_0x98fd('0x5f')](path['join'](config[_0x98fd('0x61')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x54f4c7=ejs[_0x98fd('0x64')](_0x19c027,{'networks':_0x51b129||[]});fs[_0x98fd('0x6a')](_0x98fd('0x65'),_0x54f4c7);return respondWithRpcPromise(_0x98fd('0x66'),_0x98fd('0x39'),{'module':'res_stun_monitor.so'});}else if(_0x489683[_0x98fd('0x41')]['toUpperCase']()=='TURN'){var _0x5a72ef=fs[_0x98fd('0x5f')](path[_0x98fd('0x60')](config[_0x98fd('0x61')],_0x98fd('0x69')),_0x98fd('0x63'));var _0x2548df=ejs[_0x98fd('0x64')](_0x5a72ef,{'networks':_0x51b129||[]});fs[_0x98fd('0x6a')](_0x98fd('0x6b'),_0x2548df);return respondWithRpcPromise(_0x98fd('0x66'),_0x98fd('0x39'),{'module':_0x98fd('0x67')});}else{var _0x2ab956=fs[_0x98fd('0x5f')](path[_0x98fd('0x60')](config[_0x98fd('0x61')],_0x98fd('0x6c')),_0x98fd('0x63'));var _0x5ec438=ejs[_0x98fd('0x64')](_0x2ab956,{'networks':_0x51b129||[]});fs['writeFileSync'](util[_0x98fd('0x6d')](_0x98fd('0x6e'),_0x26e2c0['body']['type'][_0x98fd('0x6f')]()),_0x5ec438);return respondWithRpcPromise(_0x98fd('0x66'),_0x98fd('0x39'),{'module':'chan_sip.so'});}return null;})[_0x98fd('0x2b')](handleError(_0x42050e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 663403e..8b90a7c 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports','Network','util'];(function(_0x1cee9d,_0x2d5ad5){var _0x2100c1=function(_0x495b1a){while(--_0x495b1a){_0x1cee9d['push'](_0x1cee9d['shift']());}};_0x2100c1(++_0x2d5ad5);}(_0xedd9,0xfc));var _0x9edd=function(_0x37d391,_0x3497c1){_0x37d391=_0x37d391-0x0;var _0x1f4ede=_0xedd9[_0x37d391];return _0x1f4ede;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee3=['define','Network','network','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xbee3,0xd5));var _0x3bee=function(_0x6ce516,_0x45661c){_0x6ce516=_0x6ce516-0x0;var _0x5cfcdb=_0xbee3[_0x6ce516];return _0x5cfcdb;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3bee('0x1'));var BPromise=require(_0x3bee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bee('0x3'));var rimraf=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var attributes=require('./network.attributes');module[_0x3bee('0x6')]=function(_0x3baf77,_0x4c5ef5){return _0x3baf77[_0x3bee('0x7')](_0x3bee('0x8'),attributes,{'tableName':_0x3bee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index d5e0952..1133a47 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x405a7f,_0x42b6ae){var _0x499ad0=function(_0x21cbf4){while(--_0x21cbf4){_0x405a7f['push'](_0x405a7f['shift']());}};_0x499ad0(++_0x42b6ae);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x29f845,_0x54b02d){_0x29f845=_0x29f845-0x0;var _0x188312=_0x7a54[_0x29f845];return _0x188312;};'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 c5c3f6a..9632744 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 _0xe3d9=['send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addAgents'];(function(_0x4a71b6,_0x23120f){var _0x290de9=function(_0x53eabc){while(--_0x53eabc){_0x4a71b6['push'](_0x4a71b6['shift']());}};_0x290de9(++_0x23120f);}(_0xe3d9,0x1b5));var _0x9e3d=function(_0xe5f6d8,_0x14d787){_0xe5f6d8=_0xe5f6d8-0x0;var _0x239ce6=_0xe3d9[_0xe5f6d8];return _0x239ce6;};'use strict';var multer=require(_0x9e3d('0x0'));var util=require(_0x9e3d('0x1'));var path=require(_0x9e3d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e3d('0x3'));var router=express[_0x9e3d('0x4')]();var fs_extra=require(_0x9e3d('0x5'));var auth=require(_0x9e3d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e3d('0x7'));router[_0x9e3d('0x8')]('/',auth[_0x9e3d('0x9')](),controller[_0x9e3d('0xa')]);router['get'](_0x9e3d('0xb'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0xc')]);router[_0x9e3d('0x8')](_0x9e3d('0xd'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0xe')]);router[_0x9e3d('0x8')](_0x9e3d('0xf'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x10')]);router[_0x9e3d('0x8')](_0x9e3d('0x11'),auth[_0x9e3d('0x9')](),controller['getAnswers']);router['get'](_0x9e3d('0x12'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x13')]);router[_0x9e3d('0x8')](_0x9e3d('0x14'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x15')]);router[_0x9e3d('0x8')](_0x9e3d('0x16'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x17')]);router[_0x9e3d('0x18')]('/',auth['isAuthenticated'](),controller[_0x9e3d('0x19')]);router[_0x9e3d('0x18')]('/:id/dispositions',auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x1a')]);router[_0x9e3d('0x18')](_0x9e3d('0x11'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x1b')]);router[_0x9e3d('0x18')](_0x9e3d('0x1c'),controller[_0x9e3d('0x1d')]);router['post'](_0x9e3d('0x12'),auth[_0x9e3d('0x9')](),controller['addApplications']);router[_0x9e3d('0x18')]('/:id/users',auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x1e')]);router[_0x9e3d('0x18')]('/:id/send',auth['isAuthenticated'](),controller[_0x9e3d('0x1f')]);router[_0x9e3d('0x20')](_0x9e3d('0xd'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x21')]);router[_0x9e3d('0x22')](_0x9e3d('0xd'),auth['isAuthenticated'](),controller[_0x9e3d('0x23')]);router[_0x9e3d('0x22')](_0x9e3d('0xf'),auth[_0x9e3d('0x9')](),controller['removeDispositions']);router['delete'](_0x9e3d('0x11'),auth[_0x9e3d('0x9')](),controller[_0x9e3d('0x24')]);router[_0x9e3d('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0x9e3d('0x25')]);module[_0x9e3d('0x26')]=router; \ No newline at end of file +var _0x2ba1=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','notify','addApplications','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bdef0,_0x505f38){var _0x25d734=function(_0x3658db){while(--_0x3658db){_0x3bdef0['push'](_0x3bdef0['shift']());}};_0x25d734(++_0x505f38);}(_0x2ba1,0x89));var _0x12ba=function(_0x4343d1,_0x3fdc79){_0x4343d1=_0x4343d1-0x0;var _0x1496de=_0x2ba1[_0x4343d1];return _0x1496de;};'use strict';var multer=require('multer');var util=require(_0x12ba('0x0'));var path=require('path');var timeout=require(_0x12ba('0x1'));var express=require(_0x12ba('0x2'));var router=express[_0x12ba('0x3')]();var fs_extra=require(_0x12ba('0x4'));var auth=require(_0x12ba('0x5'));var interaction=require(_0x12ba('0x6'));var config=require(_0x12ba('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x12ba('0x8')](),controller[_0x12ba('0x9')]);router[_0x12ba('0xa')](_0x12ba('0xb'),auth['isAuthenticated'](),controller[_0x12ba('0xc')]);router[_0x12ba('0xa')](_0x12ba('0xd'),auth[_0x12ba('0x8')](),controller[_0x12ba('0xe')]);router[_0x12ba('0xa')]('/:id/dispositions',auth[_0x12ba('0x8')](),controller[_0x12ba('0xf')]);router[_0x12ba('0xa')](_0x12ba('0x10'),auth[_0x12ba('0x8')](),controller['getAnswers']);router[_0x12ba('0xa')](_0x12ba('0x11'),auth['isAuthenticated'](),controller[_0x12ba('0x12')]);router[_0x12ba('0xa')](_0x12ba('0x13'),auth[_0x12ba('0x8')](),controller[_0x12ba('0x14')]);router[_0x12ba('0xa')](_0x12ba('0x15'),auth[_0x12ba('0x8')](),controller[_0x12ba('0x16')]);router[_0x12ba('0x17')]('/',auth[_0x12ba('0x8')](),controller[_0x12ba('0x18')]);router['post'](_0x12ba('0x19'),auth[_0x12ba('0x8')](),controller['addDisposition']);router[_0x12ba('0x17')](_0x12ba('0x10'),auth['isAuthenticated'](),controller[_0x12ba('0x1a')]);router[_0x12ba('0x17')]('/:id/notify',controller[_0x12ba('0x1b')]);router[_0x12ba('0x17')]('/:id/applications',auth[_0x12ba('0x8')](),controller[_0x12ba('0x1c')]);router['post']('/:id/users',auth[_0x12ba('0x8')](),controller['addAgents']);router[_0x12ba('0x17')](_0x12ba('0x1d'),auth[_0x12ba('0x8')](),controller['send']);router[_0x12ba('0x1e')]('/:id',auth[_0x12ba('0x8')](),controller[_0x12ba('0x1f')]);router[_0x12ba('0x20')]('/:id',auth[_0x12ba('0x8')](),controller['destroy']);router[_0x12ba('0x20')](_0x12ba('0x19'),auth[_0x12ba('0x8')](),controller[_0x12ba('0x21')]);router[_0x12ba('0x20')]('/:id/canned_answers',auth[_0x12ba('0x8')](),controller[_0x12ba('0x22')]);router['delete']('/:id/users',auth[_0x12ba('0x8')](),controller[_0x12ba('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d7d5449..4c079ca 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 _0x18c0=['name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x26a815,_0xcde2b9){var _0x539ed1=function(_0x66f759){while(--_0x66f759){_0x26a815['push'](_0x26a815['shift']());}};_0x539ed1(++_0xcde2b9);}(_0x18c0,0x15c));var _0x018c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x18c0[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x018c('0x0'));var rs=require(_0x018c('0x1'));module[_0x018c('0x2')]={'name':{'type':Sequelize[_0x018c('0x3')],'unique':_0x018c('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x018c('0x3')]},'token':{'type':Sequelize[_0x018c('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x018c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x018c('0x5');}},'notificationSound':{'type':Sequelize[_0x018c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x018c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x018c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x018c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x018c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x018c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x018c('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x018c('0x6')],'defaultValue':![],'comment':_0x018c('0x8'),'set':function(_0x1171d3){if(!_0x1171d3)this[_0x018c('0x9')]('mandatoryDispositionPauseId',null);this[_0x018c('0x9')](_0x018c('0xa'),_0x1171d3);}}}; \ No newline at end of file +var _0x567c=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT'];(function(_0x480396,_0x3a3c99){var _0x3e60a8=function(_0xae463c){while(--_0xae463c){_0x480396['push'](_0x480396['shift']());}};_0x3e60a8(++_0x3a3c99);}(_0x567c,0xfd));var _0xc567=function(_0x3d3d84,_0x4228f6){_0x3d3d84=_0x3d3d84-0x0;var _0x4d8e6d=_0x567c[_0x3d3d84];return _0x4d8e6d;};'use strict';var Sequelize=require(_0xc567('0x0'));var rs=require(_0xc567('0x1'));module[_0xc567('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xc567('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc567('0x4')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc567('0x5')]();}},'replyUri':{'type':Sequelize[_0xc567('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc567('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc567('0x6')],'defaultValue':function(){return _0xc567('0x7');}},'notificationSound':{'type':Sequelize[_0xc567('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc567('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc567('0x4')]},'queueTransfer':{'type':Sequelize[_0xc567('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc567('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc567('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc567('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x60ae20){if(!_0x60ae20)this[_0xc567('0xb')]('mandatoryDispositionPauseId',null);this[_0xc567('0xb')](_0xc567('0xc'),_0x60ae20);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d0d7d36..43e0a77 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 _0x79b4=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','Applications','account','applications','list','orderBy','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','Start','EventManager','addApplications','transaction','Transaction','READ_COMMITTED','findOne','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','Messages','push','dataValues','eml-format','zip-dir','moment','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','show','params','rawAttributes','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','addDisposition','getDispositions','Disposition','order','OpenchannelAccountId','rows','ids','CannedAnswer','getAnswers','pick','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError'];(function(_0x27a1c6,_0x562006){var _0x34af1f=function(_0x1ec21f){while(--_0x1ec21f){_0x27a1c6['push'](_0x27a1c6['shift']());}};_0x34af1f(++_0x562006);}(_0x79b4,0x113));var _0x479b=function(_0x5479df,_0xb0275f){_0x5479df=_0x5479df-0x0;var _0x30023d=_0x79b4[_0x5479df];return _0x30023d;};'use strict';var emlformat=require(_0x479b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x479b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x479b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x479b('0x3'));var util=require(_0x479b('0x4'));var path=require('path');var sox=require(_0x479b('0x5'));var csv=require(_0x479b('0x6'));var ejs=require(_0x479b('0x7'));var fs=require('fs');var fs_extra=require(_0x479b('0x8'));var _=require(_0x479b('0x9'));var squel=require(_0x479b('0xa'));var crypto=require('crypto');var jsforce=require(_0x479b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x479b('0xc'));var Papa=require(_0x479b('0xd'));var Redis=require(_0x479b('0xe'));var authService=require(_0x479b('0xf'));var qs=require(_0x479b('0x10'));var as=require(_0x479b('0x11'));var hardwareService=require(_0x479b('0x12'));var logger=require(_0x479b('0x13'))(_0x479b('0x14'));var utils=require(_0x479b('0x15'));var config=require(_0x479b('0x16'));var licenseUtil=require(_0x479b('0x17'));var db=require(_0x479b('0x18'))['db'];config[_0x479b('0x19')]=_[_0x479b('0x1a')](config[_0x479b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x479b('0x1b'))(new Redis(config[_0x479b('0x19')]));require(_0x479b('0x1c'))[_0x479b('0x1d')](socket);var jayson=require(_0x479b('0x1e'));var client=jayson[_0x479b('0x1f')][_0x479b('0x20')]({'port':0x232c});var client9002=jayson[_0x479b('0x1f')][_0x479b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x11040a,_0x403c7a,_0x4ccef2,_0x3d8479){return new BPromise(function(_0x1474d8,_0x11daaa){var _0x374e48=_0x3d8479||client;return _0x374e48[_0x479b('0x21')](_0x11040a,_0x4ccef2)['then'](function(_0x5e8738){logger[_0x479b('0x22')](_0x479b('0x23'),_0x403c7a,_0x479b('0x24'));logger[_0x479b('0x25')](_0x479b('0x26'),_0x403c7a,_0x479b('0x24'),JSON[_0x479b('0x27')](_0x5e8738));if(_0x5e8738[_0x479b('0x28')]){if(_0x5e8738[_0x479b('0x28')][_0x479b('0x29')]===0x1f4){logger[_0x479b('0x28')](_0x479b('0x23'),_0x403c7a,_0x5e8738[_0x479b('0x28')]['message']);return _0x11daaa(_0x5e8738[_0x479b('0x28')][_0x479b('0x2a')]);}logger[_0x479b('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x403c7a,_0x5e8738[_0x479b('0x28')][_0x479b('0x2a')]);return _0x1474d8(_0x5e8738[_0x479b('0x28')]['message']);}else{logger['info'](_0x479b('0x23'),_0x403c7a,'request\x20sent');_0x1474d8(_0x5e8738['result']['message']);}})[_0x479b('0x2b')](function(_0x2d6728){logger[_0x479b('0x28')](_0x479b('0x23'),_0x403c7a,_0x2d6728);_0x11daaa(_0x2d6728);});});}function respondWithStatusCode(_0x2e83e1,_0x2e120f){_0x2e120f=_0x2e120f||0xcc;return function(_0x29bfd6){if(_0x29bfd6){return _0x2e83e1[_0x479b('0x2c')](_0x2e120f);}return _0x2e83e1[_0x479b('0x2d')](_0x2e120f)[_0x479b('0x2e')]();};}function respondWithResult(_0x12ab0f,_0x5bb3ce){_0x5bb3ce=_0x5bb3ce||0xc8;return function(_0x3d35e9){if(_0x3d35e9){return _0x12ab0f[_0x479b('0x2d')](_0x5bb3ce)[_0x479b('0x2f')](_0x3d35e9);}};}function respondWithFilteredResult(_0x22105c,_0x1ca882){return function(_0x20f9dd){if(_0x20f9dd){var _0x25b617=typeof _0x1ca882[_0x479b('0x30')]===_0x479b('0x31')&&typeof _0x1ca882[_0x479b('0x32')]===_0x479b('0x31');var _0x23e4f1=_0x20f9dd['count'];var _0x1d358f=_0x25b617?0x0:_0x1ca882[_0x479b('0x30')];var _0x5aba6e=_0x25b617?_0x20f9dd[_0x479b('0x33')]:_0x1ca882['offset']+_0x1ca882[_0x479b('0x32')];var _0x2dbc20;if(_0x5aba6e>=_0x23e4f1){_0x5aba6e=_0x23e4f1;_0x2dbc20=0xc8;}else{_0x2dbc20=0xce;}_0x22105c['status'](_0x2dbc20);return _0x22105c[_0x479b('0x34')](_0x479b('0x35'),_0x1d358f+'-'+_0x5aba6e+'/'+_0x23e4f1)[_0x479b('0x2f')](_0x20f9dd);}return null;};}function patchUpdates(_0x496445){return function(_0x2068dc){try{jsonpatch[_0x479b('0x36')](_0x2068dc,_0x496445,!![]);}catch(_0x2e0933){return BPromise[_0x479b('0x37')](_0x2e0933);}return _0x2068dc[_0x479b('0x38')]();};}function saveUpdates(_0x14c0f2,_0x1f77f4){return function(_0x43aa95){if(_0x43aa95){return _0x43aa95[_0x479b('0x39')](_0x14c0f2)[_0x479b('0x3a')](function(_0x5501ae){return _0x5501ae;});}return null;};}function removeEntity(_0x1e8575,_0x46129a){return function(_0x1d0352){if(_0x1d0352){return _0x1d0352[_0x479b('0x3b')]()[_0x479b('0x3a')](function(){var _0x19eac7=_0x1d0352[_0x479b('0x3c')]({'plain':!![]});var _0xb3c37e=_0x479b('0x3d');return db[_0x479b('0x3e')][_0x479b('0x3b')]({'where':{'type':_0xb3c37e,'resourceId':_0x19eac7['id']}})[_0x479b('0x3a')](function(){return _0x1d0352;});})[_0x479b('0x3a')](function(){_0x1e8575['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a2027,_0x5e9243){return function(_0x63a3aa){if(!_0x63a3aa){_0x4a2027['sendStatus'](0x194);}return _0x63a3aa;};}function handleError(_0x1baa0f,_0xac4458){_0xac4458=_0xac4458||0x1f4;return function(_0x16f344){logger[_0x479b('0x28')](_0x16f344[_0x479b('0x3f')]);if(_0x16f344[_0x479b('0x40')]){delete _0x16f344[_0x479b('0x40')];}_0x1baa0f['status'](_0xac4458)[_0x479b('0x41')](_0x16f344);};}exports[_0x479b('0x42')]=function(_0x5abfcc,_0x313283){var _0x4d9914={'include':[{'model':db['Pause'],'as':_0x479b('0x43')}]},_0x3bb379={},_0x132bb0={'count':0x0,'rows':[]};var _0x358dfc=_[_0x479b('0x44')](db[_0x479b('0x45')]['rawAttributes'],function(_0xf5c9f2){return{'name':_0xf5c9f2[_0x479b('0x46')],'type':_0xf5c9f2[_0x479b('0x47')][_0x479b('0x48')]};});_0x3bb379[_0x479b('0x49')]=_[_0x479b('0x44')](_0x358dfc,'name');_0x3bb379['query']=_[_0x479b('0x4a')](_0x5abfcc[_0x479b('0x4b')]);_0x3bb379[_0x479b('0x4c')]=_['intersection'](_0x3bb379[_0x479b('0x49')],_0x3bb379['query']);_0x4d9914['attributes']=_[_0x479b('0x4d')](_0x3bb379[_0x479b('0x49')],qs[_0x479b('0x4e')](_0x5abfcc[_0x479b('0x4b')][_0x479b('0x4e')]));_0x4d9914[_0x479b('0x4f')]=_0x4d9914['attributes'][_0x479b('0x50')]?_0x4d9914[_0x479b('0x4f')]:_0x3bb379[_0x479b('0x49')];if(!_0x5abfcc[_0x479b('0x4b')][_0x479b('0x51')](_0x479b('0x52'))){_0x4d9914[_0x479b('0x32')]=qs['limit'](_0x5abfcc['query']['limit']);_0x4d9914[_0x479b('0x30')]=qs['offset'](_0x5abfcc[_0x479b('0x4b')][_0x479b('0x30')]);}_0x4d9914['order']=qs[_0x479b('0x53')](_0x5abfcc[_0x479b('0x4b')][_0x479b('0x53')]);_0x4d9914[_0x479b('0x54')]=qs['filters'](_['pick'](_0x5abfcc['query'],_0x3bb379['filters']),_0x358dfc);if(_0x5abfcc['query'][_0x479b('0x55')]){_0x4d9914[_0x479b('0x54')]=_['merge'](_0x4d9914[_0x479b('0x54')],{'$or':_[_0x479b('0x44')](_0x358dfc,function(_0x4b7b5d){if(_0x4b7b5d[_0x479b('0x47')]!==_0x479b('0x56')){var _0x6941ca={};_0x6941ca[_0x4b7b5d['name']]={'$like':'%'+_0x5abfcc[_0x479b('0x4b')][_0x479b('0x55')]+'%'};return _0x6941ca;}})});}_0x4d9914=_[_0x479b('0x57')]({},_0x4d9914,_0x5abfcc['options']);var _0x1f7cf9={'where':_0x4d9914[_0x479b('0x54')]};return db[_0x479b('0x45')][_0x479b('0x33')](_0x1f7cf9)[_0x479b('0x3a')](function(_0xd7b82f){_0x132bb0[_0x479b('0x33')]=_0xd7b82f;if(_0x5abfcc[_0x479b('0x4b')][_0x479b('0x58')]){_0x4d9914['include']=[{'all':!![]}];}return db[_0x479b('0x45')][_0x479b('0x59')](_0x4d9914);})['then'](function(_0x1debd3){_0x132bb0['rows']=_0x1debd3;return _0x132bb0;})[_0x479b('0x3a')](respondWithFilteredResult(_0x313283,_0x4d9914))['catch'](handleError(_0x313283,null));};exports[_0x479b('0x5a')]=function(_0x4c7e72,_0x26dfed){var _0x38671b={'raw':![],'where':{'id':_0x4c7e72[_0x479b('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x479b('0x43')}]},_0x11beff={};_0x11beff['model']=_[_0x479b('0x4a')](db['OpenchannelAccount'][_0x479b('0x5c')]);_0x11beff[_0x479b('0x4b')]=_['keys'](_0x4c7e72[_0x479b('0x4b')]);_0x11beff[_0x479b('0x4c')]=_[_0x479b('0x4d')](_0x11beff[_0x479b('0x49')],_0x11beff['query']);_0x38671b[_0x479b('0x4f')]=_['intersection'](_0x11beff[_0x479b('0x49')],qs[_0x479b('0x4e')](_0x4c7e72['query'][_0x479b('0x4e')]));_0x38671b['attributes']=_0x38671b[_0x479b('0x4f')][_0x479b('0x50')]?_0x38671b['attributes']:_0x11beff[_0x479b('0x49')];if(_0x4c7e72[_0x479b('0x4b')]['includeAll']){_0x38671b[_0x479b('0x5d')]=[{'all':!![]}];}_0x38671b=_[_0x479b('0x57')]({},_0x38671b,_0x4c7e72[_0x479b('0x5e')]);return db[_0x479b('0x45')]['find'](_0x38671b)[_0x479b('0x3a')](handleEntityNotFound(_0x26dfed,null))[_0x479b('0x3a')](respondWithResult(_0x26dfed,null))[_0x479b('0x2b')](handleError(_0x26dfed,null));};exports['create']=function(_0xf1c69f,_0x3d3d2a){return db[_0x479b('0x45')][_0x479b('0x5f')](_0xf1c69f[_0x479b('0x60')],{})['then'](function(_0x37810a){var _0x553404=_0xf1c69f[_0x479b('0x61')][_0x479b('0x3c')]({'plain':!![]});if(!_0x553404)throw new Error(_0x479b('0x62'));if(_0x553404['role']===_0x479b('0x61')){var _0x5c16f8=_0x37810a[_0x479b('0x3c')]({'plain':!![]});var _0x5ce56e=_0x479b('0x3d');return db[_0x479b('0x63')][_0x479b('0x64')]({'where':{'name':_0x5ce56e,'userProfileId':_0x553404[_0x479b('0x65')]},'raw':!![]})[_0x479b('0x3a')](function(_0x373d0c){if(_0x373d0c&&_0x373d0c['autoAssociation']===0x0){return db[_0x479b('0x3e')]['create']({'name':_0x5c16f8['name'],'resourceId':_0x5c16f8['id'],'type':_0x373d0c[_0x479b('0x40')],'sectionId':_0x373d0c['id']},{})[_0x479b('0x3a')](function(){return _0x37810a;});}else{return _0x37810a;}})[_0x479b('0x2b')](function(_0x4ca267){logger[_0x479b('0x28')](_0x479b('0x66'),_0x4ca267);throw _0x4ca267;});}return _0x37810a;})['then'](respondWithResult(_0x3d3d2a,0xc9))['catch'](handleError(_0x3d3d2a,null));};exports[_0x479b('0x39')]=function(_0x3fddfc,_0x5c92d8){if(_0x3fddfc[_0x479b('0x60')]['id']){delete _0x3fddfc[_0x479b('0x60')]['id'];}return db[_0x479b('0x45')][_0x479b('0x64')]({'where':{'id':_0x3fddfc[_0x479b('0x5b')]['id']},'include':[{'model':db[_0x479b('0x67')],'as':_0x479b('0x43')}]})[_0x479b('0x3a')](handleEntityNotFound(_0x5c92d8,null))[_0x479b('0x3a')](saveUpdates(_0x3fddfc[_0x479b('0x60')],null))[_0x479b('0x3a')](respondWithResult(_0x5c92d8,null))[_0x479b('0x2b')](handleError(_0x5c92d8,null));};exports['destroy']=function(_0xc294a3,_0x110e1e){return db[_0x479b('0x45')]['find']({'where':{'id':_0xc294a3['params']['id']}})['then'](handleEntityNotFound(_0x110e1e,null))[_0x479b('0x3a')](removeEntity(_0x110e1e,null))[_0x479b('0x2b')](handleError(_0x110e1e,null));};exports['describe']=function(_0x3f46fc,_0x486414){return db[_0x479b('0x45')]['describe']()[_0x479b('0x3a')](respondWithResult(_0x486414,null))[_0x479b('0x2b')](handleError(_0x486414,null));};exports[_0x479b('0x68')]=function(_0x2f4835,_0x3d2c3d,_0x5ceffd){if(_0x2f4835['body']['id']){delete _0x2f4835[_0x479b('0x60')]['id'];}return db['OpenchannelAccount'][_0x479b('0x64')]({'where':{'id':_0x2f4835[_0x479b('0x5b')]['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x3d2c3d,null))[_0x479b('0x3a')](function(_0x5cc0e2){if(_0x5cc0e2){_0x2f4835[_0x479b('0x60')]['OpenchannelAccountId']=_0x5cc0e2['id'];return db['Disposition']['create'](_0x2f4835['body']);}})[_0x479b('0x3a')](respondWithResult(_0x3d2c3d,null))['catch'](handleError(_0x3d2c3d,null));};exports[_0x479b('0x69')]=function(_0x3a6b07,_0x593022,_0x2b34e8){var _0x326f09={'raw':![],'where':{}};var _0x40e94b={};var _0x23f694={'count':0x0,'rows':[]};return db[_0x479b('0x45')]['findOne']({'where':{'id':_0x3a6b07[_0x479b('0x5b')]['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x593022,null))[_0x479b('0x3a')](function(_0x4298ad){if(_0x4298ad){_0x40e94b[_0x479b('0x49')]=_[_0x479b('0x4a')](db[_0x479b('0x6a')][_0x479b('0x5c')]);_0x40e94b['query']=_[_0x479b('0x4a')](_0x3a6b07[_0x479b('0x4b')]);_0x40e94b[_0x479b('0x4c')]=_['intersection'](_0x40e94b[_0x479b('0x49')],_0x40e94b['query']);_0x326f09['attributes']=_[_0x479b('0x4d')](_0x40e94b[_0x479b('0x49')],qs[_0x479b('0x4e')](_0x3a6b07[_0x479b('0x4b')][_0x479b('0x4e')]));_0x326f09['attributes']=_0x326f09[_0x479b('0x4f')][_0x479b('0x50')]?_0x326f09[_0x479b('0x4f')]:_0x40e94b[_0x479b('0x49')];if(!_0x3a6b07[_0x479b('0x4b')][_0x479b('0x51')](_0x479b('0x52'))){_0x326f09[_0x479b('0x32')]=qs[_0x479b('0x32')](_0x3a6b07[_0x479b('0x4b')][_0x479b('0x32')]);_0x326f09[_0x479b('0x30')]=qs[_0x479b('0x30')](_0x3a6b07[_0x479b('0x4b')][_0x479b('0x30')]);}_0x326f09[_0x479b('0x6b')]=qs['sort'](_0x3a6b07['query']['sort']);_0x326f09['where']=qs['filters'](_['pick'](_0x3a6b07[_0x479b('0x4b')],_0x40e94b[_0x479b('0x4c')]));_0x326f09[_0x479b('0x54')][_0x479b('0x6c')]=_0x4298ad['id'];if(_0x3a6b07[_0x479b('0x4b')]['filter']){_0x326f09[_0x479b('0x54')]=_[_0x479b('0x57')](_0x326f09[_0x479b('0x54')],{'$or':_['map'](_0x326f09[_0x479b('0x4f')],function(_0x4c6b7d){var _0x49a166={};_0x49a166[_0x4c6b7d]={'$like':'%'+_0x3a6b07[_0x479b('0x4b')][_0x479b('0x55')]+'%'};return _0x49a166;})});}_0x326f09=_[_0x479b('0x57')]({},_0x326f09,_0x3a6b07['options']);return db['Disposition'][_0x479b('0x33')]({'where':_0x326f09[_0x479b('0x54')]})[_0x479b('0x3a')](function(_0x2c5eef){_0x23f694['count']=_0x2c5eef;if(_0x3a6b07[_0x479b('0x4b')][_0x479b('0x58')]){_0x326f09[_0x479b('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x479b('0x59')](_0x326f09);})[_0x479b('0x3a')](function(_0x10f5db){_0x23f694[_0x479b('0x6d')]=_0x10f5db;return _0x23f694;});}})[_0x479b('0x3a')](respondWithFilteredResult(_0x593022,_0x326f09))[_0x479b('0x2b')](handleError(_0x593022,null));};exports['removeDispositions']=function(_0x5eb9ba,_0x42ef17,_0x30742e){return db[_0x479b('0x45')][_0x479b('0x64')]({'where':{'id':_0x5eb9ba[_0x479b('0x5b')]['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x42ef17,null))[_0x479b('0x3a')](function(_0x1f9c6f){if(_0x1f9c6f){return _0x1f9c6f['removeDispositions'](_0x5eb9ba[_0x479b('0x4b')][_0x479b('0x6e')]);}})[_0x479b('0x3a')](respondWithStatusCode(_0x42ef17,null))[_0x479b('0x2b')](handleError(_0x42ef17,null));};exports['addAnswer']=function(_0x15decb,_0x2cf362,_0xd5a262){if(_0x15decb[_0x479b('0x60')]['id']){delete _0x15decb['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x15decb['params']['id']}})['then'](handleEntityNotFound(_0x2cf362,null))[_0x479b('0x3a')](function(_0x58c935){if(_0x58c935){_0x15decb[_0x479b('0x60')][_0x479b('0x6c')]=_0x58c935['id'];return db[_0x479b('0x6f')][_0x479b('0x5f')](_0x15decb['body']);}})[_0x479b('0x3a')](respondWithResult(_0x2cf362,null))[_0x479b('0x2b')](handleError(_0x2cf362,null));};exports[_0x479b('0x70')]=function(_0x1c7ad8,_0x16e3a8,_0x5ba79b){var _0x35dc06={'raw':![],'where':{}};var _0x359e06={};var _0x1b5459={'count':0x0,'rows':[]};return db[_0x479b('0x45')]['findOne']({'where':{'id':_0x1c7ad8[_0x479b('0x5b')]['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x16e3a8,null))['then'](function(_0x42aa9a){if(_0x42aa9a){_0x359e06[_0x479b('0x49')]=_['keys'](db['CannedAnswer'][_0x479b('0x5c')]);_0x359e06[_0x479b('0x4b')]=_['keys'](_0x1c7ad8[_0x479b('0x4b')]);_0x359e06[_0x479b('0x4c')]=_[_0x479b('0x4d')](_0x359e06[_0x479b('0x49')],_0x359e06[_0x479b('0x4b')]);_0x35dc06[_0x479b('0x4f')]=_[_0x479b('0x4d')](_0x359e06['model'],qs[_0x479b('0x4e')](_0x1c7ad8[_0x479b('0x4b')]['fields']));_0x35dc06[_0x479b('0x4f')]=_0x35dc06[_0x479b('0x4f')][_0x479b('0x50')]?_0x35dc06['attributes']:_0x359e06['model'];if(!_0x1c7ad8[_0x479b('0x4b')][_0x479b('0x51')](_0x479b('0x52'))){_0x35dc06[_0x479b('0x32')]=qs[_0x479b('0x32')](_0x1c7ad8[_0x479b('0x4b')]['limit']);_0x35dc06[_0x479b('0x30')]=qs[_0x479b('0x30')](_0x1c7ad8['query']['offset']);}_0x35dc06[_0x479b('0x6b')]=qs['sort'](_0x1c7ad8[_0x479b('0x4b')][_0x479b('0x53')]);_0x35dc06[_0x479b('0x54')]=qs[_0x479b('0x4c')](_[_0x479b('0x71')](_0x1c7ad8[_0x479b('0x4b')],_0x359e06['filters']));_0x35dc06[_0x479b('0x54')]['OpenchannelAccountId']=_0x42aa9a['id'];if(_0x1c7ad8[_0x479b('0x4b')]['filter']){_0x35dc06['where']=_['merge'](_0x35dc06[_0x479b('0x54')],{'$or':_[_0x479b('0x44')](_0x35dc06[_0x479b('0x4f')],function(_0x2509ff){var _0x4941f2={};_0x4941f2[_0x2509ff]={'$like':'%'+_0x1c7ad8['query']['filter']+'%'};return _0x4941f2;})});}_0x35dc06=_[_0x479b('0x57')]({},_0x35dc06,_0x1c7ad8['options']);return db['CannedAnswer']['count']({'where':_0x35dc06[_0x479b('0x54')]})[_0x479b('0x3a')](function(_0x1cac97){_0x1b5459[_0x479b('0x33')]=_0x1cac97;if(_0x1c7ad8[_0x479b('0x4b')]['includeAll']){_0x35dc06[_0x479b('0x5d')]=[{'all':!![]}];}return db[_0x479b('0x6f')][_0x479b('0x59')](_0x35dc06);})['then'](function(_0xdc38d6){_0x1b5459[_0x479b('0x6d')]=_0xdc38d6;return _0x1b5459;});}})[_0x479b('0x3a')](respondWithFilteredResult(_0x16e3a8,_0x35dc06))[_0x479b('0x2b')](handleError(_0x16e3a8,null));};exports[_0x479b('0x72')]=function(_0xd07517,_0x50114e,_0x46902c){return db['OpenchannelAccount'][_0x479b('0x64')]({'where':{'id':_0xd07517['params']['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x50114e,null))[_0x479b('0x3a')](function(_0x378b4b){if(_0x378b4b){return _0x378b4b['removeAnswers'](_0xd07517[_0x479b('0x4b')][_0x479b('0x6e')]);}})[_0x479b('0x3a')](respondWithStatusCode(_0x50114e,null))[_0x479b('0x2b')](handleError(_0x50114e,null));};exports[_0x479b('0x73')]=function(_0x29d2f8,_0x423cea,_0x3e2510){var _0x47aced={'body':_0x29d2f8['body'],'channel':_0x479b('0x74')};var _0x3e56d6=[];var _0x4e020b=[];var _0x208772={};var _0x2a0ffb=![];return db[_0x479b('0x75')][_0x479b('0x76')]()[_0x479b('0x3a')](function(_0x554a30){if(!_0x554a30){throw new db[(_0x479b('0x77'))][(_0x479b('0x78'))](_0x479b('0x79'));}_0x3e56d6=_[_0x479b('0x7a')](_[_0x479b('0x4a')](_0x554a30),[_0x479b('0x7b'),_0x479b('0x7c')]);_0x4e020b=_[_0x479b('0x7a')](_[_0x479b('0x4a')](_0x554a30),[_0x479b('0x7b'),'updatedAt',_0x479b('0x7d'),_0x479b('0x7e')]);if(_0x29d2f8[_0x479b('0x60')]['id']){delete _0x29d2f8['body']['id'];}if(_[_0x479b('0x7f')](_0x29d2f8[_0x479b('0x60')][_0x479b('0x80')])){throw new db['Sequelize'][(_0x479b('0x78'))](_0x479b('0x81'));}if(_[_0x479b('0x7f')](_0x29d2f8['body'][_0x479b('0x60')])||_0x29d2f8[_0x479b('0x60')][_0x479b('0x60')]===''){throw new db[(_0x479b('0x77'))]['ValidationError'](_0x479b('0x82'));}if(_[_0x479b('0x7f')](_0x29d2f8['body'][_0x479b('0x83')])){throw new db['Sequelize'][(_0x479b('0x78'))](_0x479b('0x84')+_0x4e020b);}if(!_[_0x479b('0x85')](_0x4e020b,_0x29d2f8[_0x479b('0x60')]['mapKey'])){throw new db[(_0x479b('0x77'))][(_0x479b('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e020b);}_0x208772[_0x29d2f8['body']['mapKey']]=_0x29d2f8[_0x479b('0x60')][_0x479b('0x80')];})[_0x479b('0x3a')](function(){return db[_0x479b('0x45')][_0x479b('0x64')]({'where':{'id':_0x29d2f8[_0x479b('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x479b('0x86'),'include':[{'model':db['CmContact'],'as':_0x479b('0x87'),'where':_0x208772,'limit':0x1,'order':[[_0x479b('0x7c'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x479b('0x88')}]});})['then'](handleEntityNotFound(_0x423cea,null))[_0x479b('0x3a')](function(_0x10ca06){if(_0x10ca06&&_0x10ca06[_0x479b('0x86')]){_0x47aced[_0x479b('0x89')]=_0x10ca06;_0x47aced[_0x479b('0x8a')]=_0x10ca06[_0x479b('0x88')];_0x47aced[_0x479b('0x8b')]=_0x10ca06[_0x479b('0x86')];_0x47aced[_0x479b('0x8a')]=_[_0x479b('0x8c')](_0x47aced['applications'],[_0x479b('0x8d')],[_0x479b('0x8e')]);if(_0x47aced['account'][_0x479b('0x88')]){delete _0x47aced[_0x479b('0x89')][_0x479b('0x88')];}if(_0x47aced['account'][_0x479b('0x86')]&&_0x47aced[_0x479b('0x89')][_0x479b('0x86')]['Contacts'][_0x479b('0x50')]){return _0x47aced[_0x479b('0x89')]['List']['Contacts'][0x0];}var _0x5201c4=_[_0x479b('0x1a')](_0x29d2f8['body'],{'firstName':_0x29d2f8['body'][_0x479b('0x80')],'ListId':_0x10ca06[_0x479b('0x7e')]});_0x5201c4[_0x29d2f8['body']['mapKey']]=_0x29d2f8[_0x479b('0x60')]['from'];return db[_0x479b('0x75')][_0x479b('0x5f')](_0x5201c4,{'fields':_0x3e56d6,'raw':!![]});}})[_0x479b('0x3a')](handleEntityNotFound(_0x423cea,null))[_0x479b('0x3a')](function(_0x8131e0){_0x47aced['contact']=_0x8131e0;if(_0x8131e0){var _0x35a239={'ContactId':_0x8131e0['id'],'OpenchannelAccountId':_0x29d2f8[_0x479b('0x5b')]['id'],'from':(_0x8131e0[_0x479b('0x8f')]||'')+'\x20'+(_0x8131e0['lastName']||'')};var _0x30d3fe={'OpenchannelAccountId':_0x29d2f8['params']['id'],'closed':![]};if(_0x29d2f8[_0x479b('0x60')][_0x479b('0x90')]){_0x30d3fe[_0x479b('0x90')]=_0x29d2f8[_0x479b('0x60')][_0x479b('0x90')];return db[_0x479b('0x91')][_0x479b('0x64')]({'where':_0x30d3fe})['then'](function(_0x2a8d88){if(_0x2a8d88){return[_0x2a8d88,![]];}_0x35a239[_0x479b('0x90')]=_0x29d2f8[_0x479b('0x60')][_0x479b('0x90')];_0x35a239['externalUrl']=_0x29d2f8[_0x479b('0x60')][_0x479b('0x92')];return db['OpenchannelInteraction']['create'](_0x35a239)[_0x479b('0x3a')](function(_0x31abd2){return[_0x31abd2,!![]];});});}else{_0x30d3fe['threadId']=null;}_0x30d3fe[_0x479b('0x93')]=_0x8131e0['id'];return db['OpenchannelInteraction']['find']({'where':_0x30d3fe})['then'](function(_0x573e00){if(_0x573e00){return[_0x573e00,![]];}return db[_0x479b('0x91')][_0x479b('0x5f')](_0x35a239)[_0x479b('0x3a')](function(_0x43a527){return[_0x43a527,!![]];});});}})[_0x479b('0x94')](function(_0x11b557,_0x361960){if(_0x11b557){_0x2a0ffb=_0x361960;if(!_0x361960){var _0x5d129f={'from':(_0x47aced[_0x479b('0x95')][_0x479b('0x8f')]||'')+'\x20'+(_0x47aced[_0x479b('0x95')][_0x479b('0x96')]||'')};if(_0x29d2f8[_0x479b('0x60')]['threadId']&&_0x29d2f8[_0x479b('0x60')][_0x479b('0x97')]&&_0x29d2f8[_0x479b('0x60')][_0x479b('0x90')]!=_0x29d2f8[_0x479b('0x60')][_0x479b('0x97')]){_0x5d129f['threadId']=_0x29d2f8[_0x479b('0x60')][_0x479b('0x97')];}return _0x11b557[_0x479b('0x39')](_0x5d129f);}else{return _0x11b557;}}})[_0x479b('0x3a')](function(_0x42b779){_0x47aced[_0x479b('0x98')]=_0x42b779[_0x479b('0x3c')]({'plain':!![]});_0x47aced[_0x479b('0x98')][_0x479b('0x99')]=_0x2a0ffb;if(_0x47aced[_0x479b('0x98')][_0x479b('0x99')]){if(_0x47aced[_0x479b('0x89')][_0x479b('0x9a')]){_0x47aced[_0x479b('0x8a')]['push']({'id':0x0,'priority':_0x47aced[_0x479b('0x8a')]['length']+0x1,'app':_0x479b('0x9b'),'appdata':_0x479b('0x9c'),'interval':_0x479b('0x9d')});}}return db[_0x479b('0x9e')]['create']({'body':_0x29d2f8['body']['body'],'OpenchannelAccountId':_0x29d2f8[_0x479b('0x5b')]['id'],'OpenchannelInteractionId':_0x42b779['id'],'direction':'in','ContactId':_0x47aced[_0x479b('0x95')]['id'],'AttachmentId':_0x29d2f8[_0x479b('0x60')][_0x479b('0x9f')]});})[_0x479b('0x3a')](function(_0x483bbb){_0x47aced[_0x479b('0x2a')]=_0x483bbb;if(_0x47aced[_0x479b('0x98')][_0x479b('0xa0')]){return db[_0x479b('0xa1')][_0x479b('0x64')]({'attributes':['id','name'],'where':{'id':_0x47aced[_0x479b('0x98')][_0x479b('0xa0')]}})[_0x479b('0x3a')](function(_0x1027fa){if(_0x1027fa){_0x47aced[_0x479b('0x8a')][_0x479b('0xa2')]({'id':0x0,'priority':0x0,'app':_0x479b('0xa3'),'appdata':_0x1027fa['name']+','+(_0x47aced['account']['waitForTheAssignedAgent']||0xa),'interval':_0x479b('0x9d')});_0x47aced[_0x479b('0xa4')]=![];}return respondWithRpcPromise('Start',_0x479b('0xa5'),_0x47aced);});}return respondWithRpcPromise(_0x479b('0xa6'),_0x479b('0xa5'),_0x47aced);})[_0x479b('0x3a')](function(_0x2391b2){respondWithRpcPromise(_0x479b('0xa7'),_0x479b('0xa7'),{'event':'notify','message':_0x2391b2},client9002);return _0x2391b2;})[_0x479b('0x3a')](respondWithResult(_0x423cea,null))[_0x479b('0x2b')](handleError(_0x423cea,null));};exports[_0x479b('0xa8')]=function(_0x341485,_0x313fcd){var _0x3869e6=_0x341485[_0x479b('0x5b')]['id'];var _0x1bf3ff=_0x341485[_0x479b('0x60')];var _0x5bee00=0xc8;var _0x23020e=null;return db['sequelize'][_0x479b('0xa9')]({'isolationLevel':db['sequelize'][_0x479b('0xaa')]['ISOLATION_LEVELS'][_0x479b('0xab')]},function(_0x8b5d6d){return db[_0x479b('0x45')][_0x479b('0xac')]({'where':{'id':_0x3869e6},'transaction':_0x8b5d6d})['then'](function(_0x41a86e){if(_0x41a86e){return db[_0x479b('0xad')]['destroy']({'where':{'OpenchannelAccountId':_0x3869e6},'transaction':_0x8b5d6d})[_0x479b('0x3a')](function(){var _0x3f4218=_['map'](_0x1bf3ff,function(_0x2579c5){_0x2579c5[_0x479b('0x6c')]=_0x3869e6;return _0x2579c5;});return db[_0x479b('0xad')][_0x479b('0xae')](_0x3f4218,{'transaction':_0x8b5d6d});});}else{_0x5bee00=0x194;_0x23020e=[];}});})['then'](function(){if(_0x5bee00!==0x194){return db[_0x479b('0xad')][_0x479b('0xaf')]({'where':{'OpenchannelAccountId':_0x3869e6},'order':_0x479b('0x8d')})[_0x479b('0x3a')](function(_0xa53a26){_0x23020e=_0xa53a26;});}})['catch'](function(_0x484b7f){_0x5bee00=0x1f4;logger['error'](_0x484b7f[_0x479b('0x3f')]);if(_0x484b7f['name']){delete _0x484b7f['name'];}_0x23020e=_0x484b7f;})[_0x479b('0xb0')](function(){if(_0x23020e===null){_0x313fcd[_0x479b('0x2c')](_0x5bee00);}else{if(_0x5bee00===0x1f4){_0x313fcd[_0x479b('0x2d')](_0x5bee00)[_0x479b('0x41')](_0x23020e);}else{_0x313fcd['status'](_0x5bee00)[_0x479b('0x2f')](_0x23020e);}}});};exports[_0x479b('0xb1')]=function(_0x2b00f4,_0x419a63,_0x4c74fa){var _0x12ca10={};var _0x3b10e0={};var _0x246929;var _0x15855d;return db[_0x479b('0x45')]['findOne']({'where':{'id':_0x2b00f4['params']['id']}})['then'](handleEntityNotFound(_0x419a63,null))[_0x479b('0x3a')](function(_0x37678d){if(_0x37678d){_0x246929=_0x37678d;_0x3b10e0[_0x479b('0x49')]=_[_0x479b('0x4a')](db['OpenchannelApplication'][_0x479b('0x5c')]);_0x3b10e0[_0x479b('0x4b')]=_['keys'](_0x2b00f4['query']);_0x3b10e0[_0x479b('0x4c')]=_[_0x479b('0x4d')](_0x3b10e0['model'],_0x3b10e0['query']);_0x12ca10[_0x479b('0x4f')]=_[_0x479b('0x4d')](_0x3b10e0[_0x479b('0x49')],qs['fields'](_0x2b00f4['query'][_0x479b('0x4e')]));_0x12ca10[_0x479b('0x4f')]=_0x12ca10['attributes'][_0x479b('0x50')]?_0x12ca10[_0x479b('0x4f')]:_0x3b10e0[_0x479b('0x49')];_0x12ca10['order']=qs[_0x479b('0x53')](_0x2b00f4[_0x479b('0x4b')][_0x479b('0x53')]);_0x12ca10[_0x479b('0x54')]=qs[_0x479b('0x4c')](_['pick'](_0x2b00f4[_0x479b('0x4b')],_0x3b10e0[_0x479b('0x4c')]));if(_0x2b00f4['query'][_0x479b('0x55')]){_0x12ca10[_0x479b('0x54')]=_[_0x479b('0x57')](_0x12ca10[_0x479b('0x54')],{'$or':_[_0x479b('0x44')](_0x12ca10[_0x479b('0x4f')],function(_0x5c50c3){var _0x5c3221={};_0x5c3221[_0x5c50c3]={'$like':'%'+_0x2b00f4[_0x479b('0x4b')][_0x479b('0x55')]+'%'};return _0x5c3221;})});}_0x12ca10=_['merge']({},_0x12ca10,_0x2b00f4[_0x479b('0x5e')]);return _0x246929[_0x479b('0xb1')](_0x12ca10);}})[_0x479b('0x3a')](function(_0x1c62b5){if(_0x1c62b5){_0x15855d=_0x1c62b5[_0x479b('0x50')];if(!_0x2b00f4[_0x479b('0x4b')]['hasOwnProperty'](_0x479b('0x52'))){_0x12ca10[_0x479b('0x32')]=qs[_0x479b('0x32')](_0x2b00f4[_0x479b('0x4b')][_0x479b('0x32')]);_0x12ca10[_0x479b('0x30')]=qs[_0x479b('0x30')](_0x2b00f4['query'][_0x479b('0x30')]);}return _0x246929[_0x479b('0xb1')](_0x12ca10);}})['then'](function(_0x3d519d){if(_0x3d519d){return _0x3d519d?{'count':_0x15855d,'rows':_0x3d519d}:null;}})[_0x479b('0x3a')](respondWithResult(_0x419a63,null))[_0x479b('0x2b')](handleError(_0x419a63,null));};exports[_0x479b('0xb2')]=function(_0x1f6614,_0x5c423a,_0x3e1f94){var _0x4f97f8={'raw':![],'where':{}};var _0x7a7eaf={};var _0x1b66db={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x479b('0xac')]({'where':{'id':_0x1f6614[_0x479b('0x5b')]['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x5c423a,null))['then'](function(_0x56c5ef){if(_0x56c5ef){_0x7a7eaf[_0x479b('0x49')]=_[_0x479b('0x4a')](db[_0x479b('0x91')]['rawAttributes']);_0x7a7eaf[_0x479b('0x4b')]=_[_0x479b('0x4a')](_0x1f6614[_0x479b('0x4b')]);_0x7a7eaf['filters']=_[_0x479b('0x4d')](_0x7a7eaf['model'],_0x7a7eaf[_0x479b('0x4b')]);_0x4f97f8[_0x479b('0x4f')]=_[_0x479b('0x4d')](_0x7a7eaf[_0x479b('0x49')],qs[_0x479b('0x4e')](_0x1f6614[_0x479b('0x4b')][_0x479b('0x4e')]));_0x4f97f8[_0x479b('0x4f')]=_0x4f97f8[_0x479b('0x4f')][_0x479b('0x50')]?_0x4f97f8[_0x479b('0x4f')]:_0x7a7eaf[_0x479b('0x49')];if(!_0x1f6614['query'][_0x479b('0x51')](_0x479b('0x52'))){_0x4f97f8[_0x479b('0x32')]=qs[_0x479b('0x32')](_0x1f6614['query'][_0x479b('0x32')]);_0x4f97f8[_0x479b('0x30')]=qs[_0x479b('0x30')](_0x1f6614[_0x479b('0x4b')][_0x479b('0x30')]);}_0x4f97f8[_0x479b('0x6b')]=qs[_0x479b('0x53')](_0x1f6614[_0x479b('0x4b')][_0x479b('0x53')]);_0x4f97f8['where']=qs[_0x479b('0x4c')](_[_0x479b('0x71')](_0x1f6614[_0x479b('0x4b')],_0x7a7eaf[_0x479b('0x4c')]));_0x4f97f8[_0x479b('0x54')][_0x479b('0x6c')]=_0x56c5ef['id'];if(_0x1f6614['query'][_0x479b('0x55')]){_0x4f97f8[_0x479b('0x54')]=_['merge'](_0x4f97f8['where'],{'$or':_[_0x479b('0x44')](_0x4f97f8[_0x479b('0x4f')],function(_0x13b2a3){var _0x58df67={};_0x58df67[_0x13b2a3]={'$like':'%'+_0x1f6614[_0x479b('0x4b')][_0x479b('0x55')]+'%'};return _0x58df67;})});}_0x4f97f8=_[_0x479b('0x57')]({},_0x4f97f8,_0x1f6614['options']);return db[_0x479b('0x91')][_0x479b('0x33')]({'where':_0x4f97f8[_0x479b('0x54')]})[_0x479b('0x3a')](function(_0x55da50){_0x1b66db[_0x479b('0x33')]=_0x55da50;if(_0x1f6614['query'][_0x479b('0x58')]){_0x4f97f8[_0x479b('0x5d')]=[{'model':db[_0x479b('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x479b('0xb3'),'attributes':[_0x479b('0x40'),'fullname',_0x479b('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x479b('0xb5'),'attributes':['id',_0x479b('0x40'),_0x479b('0xb6')],'where':_0x1f6614[_0x479b('0x4b')][_0x479b('0xb7')]?{'id':_0x1f6614[_0x479b('0x4b')][_0x479b('0xb7')]}:undefined,'required':_0x1f6614[_0x479b('0x4b')]['tag']?!![]:![]}];}return db[_0x479b('0x91')][_0x479b('0x59')](_0x4f97f8);})[_0x479b('0x3a')](function(_0x1174a1){_0x1b66db[_0x479b('0x6d')]=_0x1174a1;return _0x1b66db;});}})['then'](respondWithFilteredResult(_0x5c423a,_0x4f97f8))[_0x479b('0x2b')](handleError(_0x5c423a,null));};exports[_0x479b('0xb8')]=function(_0x2cd4e3,_0x17a479,_0x1ab050){return db['OpenchannelAccount'][_0x479b('0x64')]({'where':{'id':_0x2cd4e3['params']['id']}})['then'](handleEntityNotFound(_0x17a479,null))['then'](function(_0x2e642e){if(_0x2e642e){return _0x2e642e['addAgents'](_0x2cd4e3['body'][_0x479b('0x6e')],_[_0x479b('0xb9')](_0x2cd4e3['body'],[_0x479b('0x6e'),'id'])||{})[_0x479b('0x94')](function(_0x142a2d){for(var _0x96caf8=0x0;_0x96caf8<_0x2cd4e3[_0x479b('0x60')][_0x479b('0x6e')][_0x479b('0x50')];_0x96caf8+=0x1){socket[_0x479b('0xba')](_0x479b('0xbb'),{'UserId':Number(_0x2cd4e3[_0x479b('0x60')][_0x479b('0x6e')][_0x96caf8]),'OpenchannelAccountId':Number(_0x2cd4e3['params']['id'])});}return _0x142a2d;});}})[_0x479b('0x3a')](respondWithResult(_0x17a479,null))['catch'](handleError(_0x17a479,null));};exports[_0x479b('0xbc')]=function(_0xd73e65,_0x558f11,_0x583045){return db[_0x479b('0x45')][_0x479b('0x64')]({'where':{'id':_0xd73e65[_0x479b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x558f11,null))[_0x479b('0x3a')](function(_0x25bca4){if(_0x25bca4){return _0x25bca4[_0x479b('0xbc')](_0xd73e65[_0x479b('0x4b')][_0x479b('0x6e')])[_0x479b('0x3a')](function(){if(_[_0x479b('0xbd')](_0xd73e65[_0x479b('0x4b')][_0x479b('0x6e')])){for(var _0x132178=0x0;_0x132178<_0xd73e65[_0x479b('0x4b')][_0x479b('0x6e')][_0x479b('0x50')];_0x132178+=0x1){socket[_0x479b('0xba')](_0x479b('0xbe'),{'UserId':Number(_0xd73e65[_0x479b('0x4b')][_0x479b('0x6e')][_0x132178]),'OpenchannelAccountId':Number(_0xd73e65[_0x479b('0x5b')]['id'])});}}else{socket['emit'](_0x479b('0xbe'),{'UserId':Number(_0xd73e65['query'][_0x479b('0x6e')]),'OpenchannelAccountId':Number(_0xd73e65[_0x479b('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x558f11,null))[_0x479b('0x2b')](handleError(_0x558f11,null));};exports[_0x479b('0xbf')]=function(_0x342c8b,_0x21b0e3,_0x43667c){var _0x1b303f={};var _0x487816={};var _0x2b8b9f;var _0x5547c5;return db['OpenchannelAccount'][_0x479b('0xac')]({'where':{'id':_0x342c8b['params']['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x21b0e3,null))['then'](function(_0x1ff638){if(_0x1ff638){_0x2b8b9f=_0x1ff638;_0x487816[_0x479b('0x49')]=_[_0x479b('0x4a')](db[_0x479b('0xa1')][_0x479b('0x5c')]);_0x487816[_0x479b('0x4b')]=_[_0x479b('0x4a')](_0x342c8b[_0x479b('0x4b')]);_0x487816[_0x479b('0x4c')]=_[_0x479b('0x4d')](_0x487816[_0x479b('0x49')],_0x487816['query']);_0x1b303f[_0x479b('0x4f')]=_[_0x479b('0x4d')](_0x487816[_0x479b('0x49')],qs[_0x479b('0x4e')](_0x342c8b[_0x479b('0x4b')][_0x479b('0x4e')]));_0x1b303f['attributes']=_0x1b303f['attributes'][_0x479b('0x50')]?_0x1b303f[_0x479b('0x4f')]:_0x487816['model'];_0x1b303f[_0x479b('0x6b')]=qs[_0x479b('0x53')](_0x342c8b[_0x479b('0x4b')]['sort']);_0x1b303f['where']=qs[_0x479b('0x4c')](_[_0x479b('0x71')](_0x342c8b[_0x479b('0x4b')],_0x487816[_0x479b('0x4c')]));if(_0x342c8b[_0x479b('0x4b')][_0x479b('0x55')]){_0x1b303f['where']=_[_0x479b('0x57')](_0x1b303f[_0x479b('0x54')],{'$or':_[_0x479b('0x44')](_0x1b303f[_0x479b('0x4f')],function(_0x28ab98){var _0x4552bd={};_0x4552bd[_0x28ab98]={'$like':'%'+_0x342c8b[_0x479b('0x4b')][_0x479b('0x55')]+'%'};return _0x4552bd;})});}_0x1b303f=_[_0x479b('0x57')]({},_0x1b303f,_0x342c8b['options']);return _0x2b8b9f['getAgents'](_0x1b303f);}})['then'](function(_0x3926b5){if(_0x3926b5){_0x5547c5=_0x3926b5[_0x479b('0x50')];if(!_0x342c8b[_0x479b('0x4b')][_0x479b('0x51')]('nolimit')){_0x1b303f[_0x479b('0x32')]=qs['limit'](_0x342c8b[_0x479b('0x4b')][_0x479b('0x32')]);_0x1b303f[_0x479b('0x30')]=qs[_0x479b('0x30')](_0x342c8b['query'][_0x479b('0x30')]);}return _0x2b8b9f['getAgents'](_0x1b303f);}})[_0x479b('0x3a')](function(_0x33a6d1){if(_0x33a6d1){return _0x33a6d1?{'count':_0x5547c5,'rows':_0x33a6d1}:null;}})[_0x479b('0x3a')](respondWithResult(_0x21b0e3,null))[_0x479b('0x2b')](handleError(_0x21b0e3,null));};exports[_0x479b('0x41')]=function(_0x147a12,_0x4e4bb2,_0x37293c){var _0x29769f,_0xcab3f8,_0xd83034;if(_[_0x479b('0x7f')](_0x147a12['body'][_0x479b('0x60')])||_0x147a12['body']['body']===''){throw new db[(_0x479b('0x77'))]['ValidationError'](_0x479b('0x82'));}if(_[_0x479b('0x7f')](_0x147a12[_0x479b('0x60')]['to'])){}_0x29769f=_0x147a12[_0x479b('0x60')]['to'];return db[_0x479b('0x45')][_0x479b('0xac')]({'where':{'id':_0x147a12[_0x479b('0x5b')]['id']}})[_0x479b('0x3a')](handleEntityNotFound(_0x4e4bb2,null))['then'](function(_0x2b016c){if(_0x2b016c){return db['OpenchannelAccount'][_0x479b('0x64')]({'where':{'id':_0x2b016c['id']},'include':[{'model':db[_0x479b('0xc0')],'as':_0x479b('0x86'),'include':[{'model':db[_0x479b('0x75')],'as':_0x479b('0x87'),'where':{[_0x2b016c[_0x479b('0x83')]]:_0x29769f},'limit':0x1,'order':[[_0x479b('0x7c'),_0x479b('0xc1')]]}]}]})['then'](handleEntityNotFound(_0x4e4bb2,null))['then'](function(_0x2d323b){if(_0x2d323b&&_0x2d323b['List']){_0xcab3f8=_0x2d323b[_0x479b('0x3c')]({'plain':!![]});if(_0xcab3f8['List']&&_0xcab3f8[_0x479b('0x86')]['Contacts']['length']){return _0xcab3f8['List'][_0x479b('0x87')][0x0];}return db[_0x479b('0x75')][_0x479b('0x5f')](_[_0x479b('0x1a')](_0x147a12[_0x479b('0x60')],{'firstName':_0x29769f,[_0x2d323b[_0x479b('0x83')]]:_0x29769f,'phone':_0x29769f,'ListId':_0xcab3f8[_0x479b('0x7e')]}));}})[_0x479b('0x3a')](handleEntityNotFound(_0x4e4bb2,null))[_0x479b('0x3a')](function(_0x405017){if(_0x405017){_0xd83034=_0x405017;return db[_0x479b('0x91')][_0x479b('0x64')]({'where':{'ContactId':_0xd83034['id'],'closed':![],'OpenchannelAccountId':_0xcab3f8['id']}})['then'](function(_0x13f97e){if(_0x13f97e){return[_0x13f97e,![]];}return db[_0x479b('0x91')][_0x479b('0x5f')]({'UserId':_0x147a12[_0x479b('0x61')]['id'],'ContactId':_0xd83034['id'],'OpenchannelAccountId':_0xcab3f8['id'],'lastMsgDirection':_0x479b('0xc2'),'Messages':[_[_0x479b('0x57')](_0x147a12[_0x479b('0x60')],{'read':![],'body':_0x147a12[_0x479b('0x60')][_0x479b('0x60')],'OpenchannelAccountId':_0xcab3f8['id'],'UserId':_0x147a12[_0x479b('0x61')]['id'],'ContactId':_0xd83034['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x479b('0xc3')}]})[_0x479b('0x3a')](function(_0xee6c09){return[_0xee6c09,!![]];});});}})['spread'](function(_0x55d205,_0x150026){if(_0x150026){return _0x55d205;}return db[_0x479b('0x9e')][_0x479b('0x5f')](_['merge'](_0x147a12[_0x479b('0x60')],{'read':![],'body':_0x147a12[_0x479b('0x60')]['body'],'OpenchannelAccountId':_0xcab3f8['id'],'OpenchannelInteractionId':_0x55d205['id'],'UserId':_0x147a12['user']['id'],'ContactId':_0xd83034['id']}))[_0x479b('0x3a')](function(_0x3e8051){_0x55d205['dataValues'][_0x479b('0xc3')]=[];_0x55d205['dataValues']['Messages'][_0x479b('0xc4')](_0x3e8051[_0x479b('0xc5')]);return _0x55d205;});});}})[_0x479b('0x3a')](respondWithResult(_0x4e4bb2,null))[_0x479b('0x2b')](handleError(_0x4e4bb2,null));}; \ No newline at end of file +var _0x2f2a=['openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','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','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','ListId','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','undefined','count','offset','set','update','destroy','get','UserProfileResource','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','merge','options','include','rows','show','params','mandatoryDispositionPause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','order','filter','findAll','removeDispositions','getAnswers','CannedAnswer','pick','removeAnswers','ids','notify'];(function(_0x36f5b7,_0x1514ca){var _0x495dfb=function(_0xace77){while(--_0xace77){_0x36f5b7['push'](_0x36f5b7['shift']());}};_0x495dfb(++_0x1514ca);}(_0x2f2a,0x10a));var _0xa2f2=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x2f2a[_0x5cc8];return _0x450661;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2f2('0x0'));var zipdir=require(_0xa2f2('0x1'));var jsonpatch=require(_0xa2f2('0x2'));var rp=require(_0xa2f2('0x3'));var moment=require(_0xa2f2('0x4'));var BPromise=require(_0xa2f2('0x5'));var Mustache=require('mustache');var util=require(_0xa2f2('0x6'));var path=require(_0xa2f2('0x7'));var sox=require(_0xa2f2('0x8'));var csv=require(_0xa2f2('0x9'));var ejs=require(_0xa2f2('0xa'));var fs=require('fs');var fs_extra=require(_0xa2f2('0xb'));var _=require(_0xa2f2('0xc'));var squel=require('squel');var crypto=require(_0xa2f2('0xd'));var jsforce=require(_0xa2f2('0xe'));var deskjs=require(_0xa2f2('0xf'));var toCsv=require(_0xa2f2('0x9'));var querystring=require(_0xa2f2('0x10'));var Papa=require(_0xa2f2('0x11'));var Redis=require(_0xa2f2('0x12'));var authService=require(_0xa2f2('0x13'));var qs=require(_0xa2f2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa2f2('0x15'));var utils=require(_0xa2f2('0x16'));var config=require(_0xa2f2('0x17'));var licenseUtil=require(_0xa2f2('0x18'));var db=require(_0xa2f2('0x19'))['db'];config[_0xa2f2('0x1a')]=_[_0xa2f2('0x1b')](config[_0xa2f2('0x1a')],{'host':_0xa2f2('0x1c'),'port':0x18eb});var socket=require(_0xa2f2('0x1d'))(new Redis(config[_0xa2f2('0x1a')]));require(_0xa2f2('0x1e'))[_0xa2f2('0x1f')](socket);var jayson=require(_0xa2f2('0x20'));var client=jayson[_0xa2f2('0x21')][_0xa2f2('0x22')]({'port':0x232c});var client9002=jayson[_0xa2f2('0x21')][_0xa2f2('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2739af,_0x5912e0,_0x2ec224,_0x2d6ead){return new BPromise(function(_0x294e01,_0x5250e6){var _0x4b84f2=_0x2d6ead||client;return _0x4b84f2[_0xa2f2('0x23')](_0x2739af,_0x2ec224)[_0xa2f2('0x24')](function(_0x229187){logger[_0xa2f2('0x25')](_0xa2f2('0x26'),_0x5912e0,_0xa2f2('0x27'));logger[_0xa2f2('0x28')](_0xa2f2('0x29'),_0x5912e0,_0xa2f2('0x27'),JSON['stringify'](_0x229187));if(_0x229187[_0xa2f2('0x2a')]){if(_0x229187['error'][_0xa2f2('0x2b')]===0x1f4){logger[_0xa2f2('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x5912e0,_0x229187[_0xa2f2('0x2a')][_0xa2f2('0x2c')]);return _0x5250e6(_0x229187[_0xa2f2('0x2a')][_0xa2f2('0x2c')]);}logger[_0xa2f2('0x2a')](_0xa2f2('0x26'),_0x5912e0,_0x229187[_0xa2f2('0x2a')][_0xa2f2('0x2c')]);return _0x294e01(_0x229187[_0xa2f2('0x2a')][_0xa2f2('0x2c')]);}else{logger['info'](_0xa2f2('0x26'),_0x5912e0,_0xa2f2('0x27'));_0x294e01(_0x229187['result'][_0xa2f2('0x2c')]);}})[_0xa2f2('0x2d')](function(_0xf3363f){logger[_0xa2f2('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x5912e0,_0xf3363f);_0x5250e6(_0xf3363f);});});}function respondWithStatusCode(_0x3f09e1,_0x47104d){_0x47104d=_0x47104d||0xcc;return function(_0xe01f1b){if(_0xe01f1b){return _0x3f09e1[_0xa2f2('0x2e')](_0x47104d);}return _0x3f09e1['status'](_0x47104d)[_0xa2f2('0x2f')]();};}function respondWithResult(_0x4846e9,_0x88856b){_0x88856b=_0x88856b||0xc8;return function(_0x3e9b60){if(_0x3e9b60){return _0x4846e9[_0xa2f2('0x30')](_0x88856b)['json'](_0x3e9b60);}};}function respondWithFilteredResult(_0xb6b939,_0x3e02af){return function(_0x3fd17a){if(_0x3fd17a){var _0x12e3fa=typeof _0x3e02af['offset']==='undefined'&&typeof _0x3e02af['limit']===_0xa2f2('0x31');var _0x6b14b=_0x3fd17a[_0xa2f2('0x32')];var _0x2640fb=_0x12e3fa?0x0:_0x3e02af[_0xa2f2('0x33')];var _0x4ff659=_0x12e3fa?_0x3fd17a[_0xa2f2('0x32')]:_0x3e02af[_0xa2f2('0x33')]+_0x3e02af['limit'];var _0x5dc9ed;if(_0x4ff659>=_0x6b14b){_0x4ff659=_0x6b14b;_0x5dc9ed=0xc8;}else{_0x5dc9ed=0xce;}_0xb6b939[_0xa2f2('0x30')](_0x5dc9ed);return _0xb6b939[_0xa2f2('0x34')]('Content-Range',_0x2640fb+'-'+_0x4ff659+'/'+_0x6b14b)['json'](_0x3fd17a);}return null;};}function patchUpdates(_0x55845c){return function(_0x4d6e0e){try{jsonpatch['apply'](_0x4d6e0e,_0x55845c,!![]);}catch(_0x3e1c0d){return BPromise['reject'](_0x3e1c0d);}return _0x4d6e0e['save']();};}function saveUpdates(_0xffcfe8,_0x2bf1a6){return function(_0x47d4a2){if(_0x47d4a2){return _0x47d4a2[_0xa2f2('0x35')](_0xffcfe8)['then'](function(_0x51f3c8){return _0x51f3c8;});}return null;};}function removeEntity(_0x525cc5,_0x1d880d){return function(_0x39e6ad){if(_0x39e6ad){return _0x39e6ad[_0xa2f2('0x36')]()['then'](function(){var _0x498e3f=_0x39e6ad[_0xa2f2('0x37')]({'plain':!![]});var _0x23fe2e='OpenchannelAccounts';return db[_0xa2f2('0x38')][_0xa2f2('0x36')]({'where':{'type':_0x23fe2e,'resourceId':_0x498e3f['id']}})[_0xa2f2('0x24')](function(){return _0x39e6ad;});})['then'](function(){_0x525cc5[_0xa2f2('0x30')](0xcc)[_0xa2f2('0x2f')]();});}};}function handleEntityNotFound(_0x1d172a,_0x26194a){return function(_0x1636b0){if(!_0x1636b0){_0x1d172a[_0xa2f2('0x2e')](0x194);}return _0x1636b0;};}function handleError(_0x5d3102,_0xf23fd5){_0xf23fd5=_0xf23fd5||0x1f4;return function(_0x439700){logger[_0xa2f2('0x2a')](_0x439700['stack']);if(_0x439700[_0xa2f2('0x39')]){delete _0x439700['name'];}_0x5d3102[_0xa2f2('0x30')](_0xf23fd5)[_0xa2f2('0x3a')](_0x439700);};}exports[_0xa2f2('0x3b')]=function(_0x39dc51,_0x5d8fcc){var _0x3f1fdb={'include':[{'model':db[_0xa2f2('0x3c')],'as':'mandatoryDispositionPause'}]},_0x29f5b7={},_0x238a27={'count':0x0,'rows':[]};var _0x2c0070=_[_0xa2f2('0x3d')](db[_0xa2f2('0x3e')][_0xa2f2('0x3f')],function(_0x273e19){return{'name':_0x273e19[_0xa2f2('0x40')],'type':_0x273e19[_0xa2f2('0x41')][_0xa2f2('0x42')]};});_0x29f5b7[_0xa2f2('0x43')]=_[_0xa2f2('0x3d')](_0x2c0070,_0xa2f2('0x39'));_0x29f5b7['query']=_[_0xa2f2('0x44')](_0x39dc51[_0xa2f2('0x45')]);_0x29f5b7['filters']=_[_0xa2f2('0x46')](_0x29f5b7[_0xa2f2('0x43')],_0x29f5b7[_0xa2f2('0x45')]);_0x3f1fdb[_0xa2f2('0x47')]=_[_0xa2f2('0x46')](_0x29f5b7[_0xa2f2('0x43')],qs[_0xa2f2('0x48')](_0x39dc51[_0xa2f2('0x45')][_0xa2f2('0x48')]));_0x3f1fdb[_0xa2f2('0x47')]=_0x3f1fdb[_0xa2f2('0x47')][_0xa2f2('0x49')]?_0x3f1fdb[_0xa2f2('0x47')]:_0x29f5b7[_0xa2f2('0x43')];if(!_0x39dc51[_0xa2f2('0x45')][_0xa2f2('0x4a')](_0xa2f2('0x4b'))){_0x3f1fdb[_0xa2f2('0x4c')]=qs['limit'](_0x39dc51['query']['limit']);_0x3f1fdb[_0xa2f2('0x33')]=qs['offset'](_0x39dc51[_0xa2f2('0x45')][_0xa2f2('0x33')]);}_0x3f1fdb['order']=qs['sort'](_0x39dc51['query'][_0xa2f2('0x4d')]);_0x3f1fdb[_0xa2f2('0x4e')]=qs[_0xa2f2('0x4f')](_['pick'](_0x39dc51[_0xa2f2('0x45')],_0x29f5b7['filters']),_0x2c0070);if(_0x39dc51[_0xa2f2('0x45')]['filter']){_0x3f1fdb[_0xa2f2('0x4e')]=_['merge'](_0x3f1fdb['where'],{'$or':_[_0xa2f2('0x3d')](_0x2c0070,function(_0x12279c){if(_0x12279c['type']!=='VIRTUAL'){var _0x4c4091={};_0x4c4091[_0x12279c['name']]={'$like':'%'+_0x39dc51['query']['filter']+'%'};return _0x4c4091;}})});}_0x3f1fdb=_[_0xa2f2('0x50')]({},_0x3f1fdb,_0x39dc51[_0xa2f2('0x51')]);var _0x36cc4d={'where':_0x3f1fdb[_0xa2f2('0x4e')]};return db['OpenchannelAccount']['count'](_0x36cc4d)[_0xa2f2('0x24')](function(_0x1eb018){_0x238a27['count']=_0x1eb018;if(_0x39dc51[_0xa2f2('0x45')]['includeAll']){_0x3f1fdb[_0xa2f2('0x52')]=[{'all':!![]}];}return db[_0xa2f2('0x3e')]['findAll'](_0x3f1fdb);})[_0xa2f2('0x24')](function(_0x1d978c){_0x238a27[_0xa2f2('0x53')]=_0x1d978c;return _0x238a27;})[_0xa2f2('0x24')](respondWithFilteredResult(_0x5d8fcc,_0x3f1fdb))[_0xa2f2('0x2d')](handleError(_0x5d8fcc,null));};exports[_0xa2f2('0x54')]=function(_0x567fec,_0x58159b){var _0x169434={'raw':![],'where':{'id':_0x567fec[_0xa2f2('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xa2f2('0x56')}]},_0x132510={};_0x132510['model']=_[_0xa2f2('0x44')](db[_0xa2f2('0x3e')][_0xa2f2('0x3f')]);_0x132510['query']=_[_0xa2f2('0x44')](_0x567fec[_0xa2f2('0x45')]);_0x132510[_0xa2f2('0x4f')]=_[_0xa2f2('0x46')](_0x132510[_0xa2f2('0x43')],_0x132510['query']);_0x169434[_0xa2f2('0x47')]=_[_0xa2f2('0x46')](_0x132510[_0xa2f2('0x43')],qs[_0xa2f2('0x48')](_0x567fec[_0xa2f2('0x45')][_0xa2f2('0x48')]));_0x169434[_0xa2f2('0x47')]=_0x169434['attributes']['length']?_0x169434[_0xa2f2('0x47')]:_0x132510[_0xa2f2('0x43')];if(_0x567fec['query'][_0xa2f2('0x57')]){_0x169434[_0xa2f2('0x52')]=[{'all':!![]}];}_0x169434=_['merge']({},_0x169434,_0x567fec[_0xa2f2('0x51')]);return db[_0xa2f2('0x3e')][_0xa2f2('0x58')](_0x169434)['then'](handleEntityNotFound(_0x58159b,null))[_0xa2f2('0x24')](respondWithResult(_0x58159b,null))[_0xa2f2('0x2d')](handleError(_0x58159b,null));};exports[_0xa2f2('0x59')]=function(_0x2017de,_0x14282e){return db[_0xa2f2('0x3e')][_0xa2f2('0x59')](_0x2017de[_0xa2f2('0x5a')],{})[_0xa2f2('0x24')](function(_0x30000a){var _0x46ca2a=_0x2017de[_0xa2f2('0x5b')]['get']({'plain':!![]});if(!_0x46ca2a)throw new Error(_0xa2f2('0x5c'));if(_0x46ca2a[_0xa2f2('0x5d')]===_0xa2f2('0x5b')){var _0x1a419d=_0x30000a[_0xa2f2('0x37')]({'plain':!![]});var _0xbe9899=_0xa2f2('0x5e');return db['UserProfileSection'][_0xa2f2('0x58')]({'where':{'name':_0xbe9899,'userProfileId':_0x46ca2a[_0xa2f2('0x5f')]},'raw':!![]})[_0xa2f2('0x24')](function(_0x35ac00){if(_0x35ac00&&_0x35ac00[_0xa2f2('0x60')]===0x0){return db[_0xa2f2('0x38')][_0xa2f2('0x59')]({'name':_0x1a419d[_0xa2f2('0x39')],'resourceId':_0x1a419d['id'],'type':_0x35ac00[_0xa2f2('0x39')],'sectionId':_0x35ac00['id']},{})[_0xa2f2('0x24')](function(){return _0x30000a;});}else{return _0x30000a;}})[_0xa2f2('0x2d')](function(_0x5304ac){logger[_0xa2f2('0x2a')](_0xa2f2('0x61'),_0x5304ac);throw _0x5304ac;});}return _0x30000a;})[_0xa2f2('0x24')](respondWithResult(_0x14282e,0xc9))[_0xa2f2('0x2d')](handleError(_0x14282e,null));};exports[_0xa2f2('0x35')]=function(_0x41643f,_0x1592c6){if(_0x41643f[_0xa2f2('0x5a')]['id']){delete _0x41643f[_0xa2f2('0x5a')]['id'];}return db[_0xa2f2('0x3e')]['find']({'where':{'id':_0x41643f[_0xa2f2('0x55')]['id']},'include':[{'model':db[_0xa2f2('0x3c')],'as':_0xa2f2('0x56')}]})['then'](handleEntityNotFound(_0x1592c6,null))[_0xa2f2('0x24')](saveUpdates(_0x41643f['body'],null))[_0xa2f2('0x24')](respondWithResult(_0x1592c6,null))[_0xa2f2('0x2d')](handleError(_0x1592c6,null));};exports['destroy']=function(_0x402529,_0x4dabe6){return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x402529[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x4dabe6,null))['then'](removeEntity(_0x4dabe6,null))[_0xa2f2('0x2d')](handleError(_0x4dabe6,null));};exports[_0xa2f2('0x62')]=function(_0x510c02,_0x555e7a){return db[_0xa2f2('0x3e')]['describe']()[_0xa2f2('0x24')](respondWithResult(_0x555e7a,null))[_0xa2f2('0x2d')](handleError(_0x555e7a,null));};exports['addDisposition']=function(_0x14b0b8,_0x56b582,_0x399e6a){if(_0x14b0b8[_0xa2f2('0x5a')]['id']){delete _0x14b0b8[_0xa2f2('0x5a')]['id'];}return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x14b0b8[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x56b582,null))[_0xa2f2('0x24')](function(_0x327bde){if(_0x327bde){_0x14b0b8['body'][_0xa2f2('0x63')]=_0x327bde['id'];return db['Disposition'][_0xa2f2('0x59')](_0x14b0b8[_0xa2f2('0x5a')]);}})[_0xa2f2('0x24')](respondWithResult(_0x56b582,null))['catch'](handleError(_0x56b582,null));};exports[_0xa2f2('0x64')]=function(_0x388877,_0x9970f3,_0x2110ef){var _0x34a414={'raw':![],'where':{}};var _0x3bf154={};var _0x367cd6={'count':0x0,'rows':[]};return db[_0xa2f2('0x3e')][_0xa2f2('0x65')]({'where':{'id':_0x388877[_0xa2f2('0x55')]['id']}})['then'](handleEntityNotFound(_0x9970f3,null))[_0xa2f2('0x24')](function(_0x9a6a20){if(_0x9a6a20){_0x3bf154[_0xa2f2('0x43')]=_[_0xa2f2('0x44')](db['Disposition']['rawAttributes']);_0x3bf154[_0xa2f2('0x45')]=_['keys'](_0x388877[_0xa2f2('0x45')]);_0x3bf154[_0xa2f2('0x4f')]=_[_0xa2f2('0x46')](_0x3bf154['model'],_0x3bf154[_0xa2f2('0x45')]);_0x34a414[_0xa2f2('0x47')]=_[_0xa2f2('0x46')](_0x3bf154['model'],qs['fields'](_0x388877[_0xa2f2('0x45')][_0xa2f2('0x48')]));_0x34a414[_0xa2f2('0x47')]=_0x34a414[_0xa2f2('0x47')][_0xa2f2('0x49')]?_0x34a414['attributes']:_0x3bf154[_0xa2f2('0x43')];if(!_0x388877['query'][_0xa2f2('0x4a')](_0xa2f2('0x4b'))){_0x34a414[_0xa2f2('0x4c')]=qs['limit'](_0x388877[_0xa2f2('0x45')][_0xa2f2('0x4c')]);_0x34a414[_0xa2f2('0x33')]=qs[_0xa2f2('0x33')](_0x388877[_0xa2f2('0x45')]['offset']);}_0x34a414[_0xa2f2('0x66')]=qs[_0xa2f2('0x4d')](_0x388877[_0xa2f2('0x45')][_0xa2f2('0x4d')]);_0x34a414[_0xa2f2('0x4e')]=qs[_0xa2f2('0x4f')](_['pick'](_0x388877[_0xa2f2('0x45')],_0x3bf154[_0xa2f2('0x4f')]));_0x34a414[_0xa2f2('0x4e')][_0xa2f2('0x63')]=_0x9a6a20['id'];if(_0x388877[_0xa2f2('0x45')][_0xa2f2('0x67')]){_0x34a414[_0xa2f2('0x4e')]=_[_0xa2f2('0x50')](_0x34a414[_0xa2f2('0x4e')],{'$or':_[_0xa2f2('0x3d')](_0x34a414[_0xa2f2('0x47')],function(_0x5ab3d7){var _0x511f02={};_0x511f02[_0x5ab3d7]={'$like':'%'+_0x388877['query'][_0xa2f2('0x67')]+'%'};return _0x511f02;})});}_0x34a414=_[_0xa2f2('0x50')]({},_0x34a414,_0x388877['options']);return db['Disposition'][_0xa2f2('0x32')]({'where':_0x34a414['where']})[_0xa2f2('0x24')](function(_0x3c4bd9){_0x367cd6[_0xa2f2('0x32')]=_0x3c4bd9;if(_0x388877[_0xa2f2('0x45')][_0xa2f2('0x57')]){_0x34a414[_0xa2f2('0x52')]=[{'all':!![]}];}return db['Disposition'][_0xa2f2('0x68')](_0x34a414);})['then'](function(_0xa898b4){_0x367cd6[_0xa2f2('0x53')]=_0xa898b4;return _0x367cd6;});}})[_0xa2f2('0x24')](respondWithFilteredResult(_0x9970f3,_0x34a414))['catch'](handleError(_0x9970f3,null));};exports[_0xa2f2('0x69')]=function(_0x97f247,_0x427396,_0x228d0a){return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x97f247[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x427396,null))['then'](function(_0x1b0262){if(_0x1b0262){return _0x1b0262[_0xa2f2('0x69')](_0x97f247[_0xa2f2('0x45')]['ids']);}})[_0xa2f2('0x24')](respondWithStatusCode(_0x427396,null))[_0xa2f2('0x2d')](handleError(_0x427396,null));};exports['addAnswer']=function(_0x371284,_0x2b74d3,_0x1f0839){if(_0x371284['body']['id']){delete _0x371284[_0xa2f2('0x5a')]['id'];}return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x371284[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x2b74d3,null))[_0xa2f2('0x24')](function(_0x59cf87){if(_0x59cf87){_0x371284[_0xa2f2('0x5a')][_0xa2f2('0x63')]=_0x59cf87['id'];return db['CannedAnswer'][_0xa2f2('0x59')](_0x371284[_0xa2f2('0x5a')]);}})[_0xa2f2('0x24')](respondWithResult(_0x2b74d3,null))[_0xa2f2('0x2d')](handleError(_0x2b74d3,null));};exports[_0xa2f2('0x6a')]=function(_0x19ffc5,_0x26bed0,_0x112e02){var _0x3e2205={'raw':![],'where':{}};var _0x17d2f8={};var _0x10f190={'count':0x0,'rows':[]};return db[_0xa2f2('0x3e')][_0xa2f2('0x65')]({'where':{'id':_0x19ffc5[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x26bed0,null))[_0xa2f2('0x24')](function(_0x269c67){if(_0x269c67){_0x17d2f8[_0xa2f2('0x43')]=_[_0xa2f2('0x44')](db[_0xa2f2('0x6b')]['rawAttributes']);_0x17d2f8['query']=_[_0xa2f2('0x44')](_0x19ffc5[_0xa2f2('0x45')]);_0x17d2f8[_0xa2f2('0x4f')]=_[_0xa2f2('0x46')](_0x17d2f8[_0xa2f2('0x43')],_0x17d2f8['query']);_0x3e2205[_0xa2f2('0x47')]=_['intersection'](_0x17d2f8[_0xa2f2('0x43')],qs['fields'](_0x19ffc5[_0xa2f2('0x45')][_0xa2f2('0x48')]));_0x3e2205[_0xa2f2('0x47')]=_0x3e2205[_0xa2f2('0x47')][_0xa2f2('0x49')]?_0x3e2205[_0xa2f2('0x47')]:_0x17d2f8[_0xa2f2('0x43')];if(!_0x19ffc5[_0xa2f2('0x45')][_0xa2f2('0x4a')]('nolimit')){_0x3e2205[_0xa2f2('0x4c')]=qs['limit'](_0x19ffc5[_0xa2f2('0x45')]['limit']);_0x3e2205[_0xa2f2('0x33')]=qs[_0xa2f2('0x33')](_0x19ffc5[_0xa2f2('0x45')][_0xa2f2('0x33')]);}_0x3e2205[_0xa2f2('0x66')]=qs[_0xa2f2('0x4d')](_0x19ffc5[_0xa2f2('0x45')][_0xa2f2('0x4d')]);_0x3e2205[_0xa2f2('0x4e')]=qs[_0xa2f2('0x4f')](_[_0xa2f2('0x6c')](_0x19ffc5[_0xa2f2('0x45')],_0x17d2f8['filters']));_0x3e2205[_0xa2f2('0x4e')][_0xa2f2('0x63')]=_0x269c67['id'];if(_0x19ffc5[_0xa2f2('0x45')][_0xa2f2('0x67')]){_0x3e2205[_0xa2f2('0x4e')]=_[_0xa2f2('0x50')](_0x3e2205[_0xa2f2('0x4e')],{'$or':_['map'](_0x3e2205[_0xa2f2('0x47')],function(_0x2577aa){var _0x4b49a0={};_0x4b49a0[_0x2577aa]={'$like':'%'+_0x19ffc5['query'][_0xa2f2('0x67')]+'%'};return _0x4b49a0;})});}_0x3e2205=_['merge']({},_0x3e2205,_0x19ffc5['options']);return db[_0xa2f2('0x6b')][_0xa2f2('0x32')]({'where':_0x3e2205[_0xa2f2('0x4e')]})[_0xa2f2('0x24')](function(_0x124b53){_0x10f190[_0xa2f2('0x32')]=_0x124b53;if(_0x19ffc5[_0xa2f2('0x45')][_0xa2f2('0x57')]){_0x3e2205[_0xa2f2('0x52')]=[{'all':!![]}];}return db[_0xa2f2('0x6b')]['findAll'](_0x3e2205);})[_0xa2f2('0x24')](function(_0x2f1dca){_0x10f190[_0xa2f2('0x53')]=_0x2f1dca;return _0x10f190;});}})['then'](respondWithFilteredResult(_0x26bed0,_0x3e2205))[_0xa2f2('0x2d')](handleError(_0x26bed0,null));};exports[_0xa2f2('0x6d')]=function(_0x5c268d,_0x47e0ff,_0x1f16d1){return db[_0xa2f2('0x3e')]['find']({'where':{'id':_0x5c268d[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x47e0ff,null))[_0xa2f2('0x24')](function(_0x2dc120){if(_0x2dc120){return _0x2dc120[_0xa2f2('0x6d')](_0x5c268d[_0xa2f2('0x45')][_0xa2f2('0x6e')]);}})['then'](respondWithStatusCode(_0x47e0ff,null))['catch'](handleError(_0x47e0ff,null));};exports[_0xa2f2('0x6f')]=function(_0x579975,_0x4f0105,_0x413878){var _0xbbaa34={'body':_0x579975[_0xa2f2('0x5a')],'channel':_0xa2f2('0x70')};var _0x1e8a2e=[];var _0x52c108=[];var _0x898763={};var _0xd2a381=![];return db['CmContact'][_0xa2f2('0x62')]()[_0xa2f2('0x24')](function(_0xb5e287){if(!_0xb5e287){throw new db['Sequelize'][(_0xa2f2('0x71'))](_0xa2f2('0x72'));}_0x1e8a2e=_[_0xa2f2('0x73')](_['keys'](_0xb5e287),[_0xa2f2('0x74'),_0xa2f2('0x75')]);_0x52c108=_[_0xa2f2('0x73')](_[_0xa2f2('0x44')](_0xb5e287),[_0xa2f2('0x74'),_0xa2f2('0x75'),_0xa2f2('0x76'),'ListId']);if(_0x579975[_0xa2f2('0x5a')]['id']){delete _0x579975[_0xa2f2('0x5a')]['id'];}if(_['isNil'](_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x77')])){throw new db[(_0xa2f2('0x78'))][(_0xa2f2('0x71'))]('from\x20is\x20mandatory');}if(_[_0xa2f2('0x79')](_0x579975[_0xa2f2('0x5a')]['body'])||_0x579975[_0xa2f2('0x5a')]['body']===''){throw new db['Sequelize'][(_0xa2f2('0x71'))](_0xa2f2('0x7a'));}if(_[_0xa2f2('0x79')](_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x7b')])){throw new db[(_0xa2f2('0x78'))][(_0xa2f2('0x71'))](_0xa2f2('0x7c')+_0x52c108);}if(!_[_0xa2f2('0x7d')](_0x52c108,_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x7b')])){throw new db['Sequelize']['ValidationError'](_0xa2f2('0x7e')+_0x52c108);}_0x898763[_0x579975[_0xa2f2('0x5a')]['mapKey']]=_0x579975['body'][_0xa2f2('0x77')];})[_0xa2f2('0x24')](function(){return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x579975[_0xa2f2('0x55')]['id']},'include':[{'model':db[_0xa2f2('0x7f')],'as':_0xa2f2('0x80'),'include':[{'model':db[_0xa2f2('0x81')],'as':_0xa2f2('0x82'),'where':_0x898763,'limit':0x1,'order':[[_0xa2f2('0x75'),_0xa2f2('0x83')]]}]},{'model':db[_0xa2f2('0x84')],'as':_0xa2f2('0x85')}]});})[_0xa2f2('0x24')](handleEntityNotFound(_0x4f0105,null))[_0xa2f2('0x24')](function(_0x1ea090){if(_0x1ea090&&_0x1ea090[_0xa2f2('0x80')]){_0xbbaa34[_0xa2f2('0x86')]=_0x1ea090;_0xbbaa34[_0xa2f2('0x87')]=_0x1ea090[_0xa2f2('0x85')];_0xbbaa34[_0xa2f2('0x88')]=_0x1ea090['List'];_0xbbaa34['applications']=_[_0xa2f2('0x89')](_0xbbaa34['applications'],['priority'],[_0xa2f2('0x8a')]);if(_0xbbaa34[_0xa2f2('0x86')][_0xa2f2('0x85')]){delete _0xbbaa34[_0xa2f2('0x86')][_0xa2f2('0x85')];}if(_0xbbaa34[_0xa2f2('0x86')][_0xa2f2('0x80')]&&_0xbbaa34[_0xa2f2('0x86')][_0xa2f2('0x80')][_0xa2f2('0x82')][_0xa2f2('0x49')]){return _0xbbaa34[_0xa2f2('0x86')][_0xa2f2('0x80')]['Contacts'][0x0];}var _0x496c20=_[_0xa2f2('0x1b')](_0x579975['body'],{'firstName':_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x77')],'ListId':_0x1ea090['ListId']});_0x496c20[_0x579975[_0xa2f2('0x5a')]['mapKey']]=_0x579975[_0xa2f2('0x5a')]['from'];return db[_0xa2f2('0x81')][_0xa2f2('0x59')](_0x496c20,{'fields':_0x1e8a2e,'raw':!![]});}})[_0xa2f2('0x24')](handleEntityNotFound(_0x4f0105,null))[_0xa2f2('0x24')](function(_0x248396){_0xbbaa34[_0xa2f2('0x8b')]=_0x248396;if(_0x248396){var _0x171c1f={'ContactId':_0x248396['id'],'OpenchannelAccountId':_0x579975[_0xa2f2('0x55')]['id'],'from':(_0x248396[_0xa2f2('0x8c')]||'')+'\x20'+(_0x248396[_0xa2f2('0x8d')]||'')};var _0x25d5a2={'OpenchannelAccountId':_0x579975[_0xa2f2('0x55')]['id'],'closed':![]};if(_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x8e')]){_0x25d5a2[_0xa2f2('0x8e')]=_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x8e')];return db[_0xa2f2('0x8f')][_0xa2f2('0x58')]({'where':_0x25d5a2})[_0xa2f2('0x24')](function(_0x56827e){if(_0x56827e){return[_0x56827e,![]];}_0x171c1f[_0xa2f2('0x8e')]=_0x579975['body'][_0xa2f2('0x8e')];_0x171c1f[_0xa2f2('0x90')]=_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x90')];return db[_0xa2f2('0x8f')][_0xa2f2('0x59')](_0x171c1f)[_0xa2f2('0x24')](function(_0x2ea4a7){return[_0x2ea4a7,!![]];});});}else{_0x25d5a2[_0xa2f2('0x8e')]=null;}_0x25d5a2[_0xa2f2('0x91')]=_0x248396['id'];return db[_0xa2f2('0x8f')]['find']({'where':_0x25d5a2})[_0xa2f2('0x24')](function(_0x35e911){if(_0x35e911){return[_0x35e911,![]];}return db['OpenchannelInteraction']['create'](_0x171c1f)['then'](function(_0xd7e44a){return[_0xd7e44a,!![]];});});}})[_0xa2f2('0x92')](function(_0x338c98,_0x3d96db){if(_0x338c98){_0xd2a381=_0x3d96db;if(!_0x3d96db){var _0x368416={'from':(_0xbbaa34[_0xa2f2('0x8b')]['firstName']||'')+'\x20'+(_0xbbaa34[_0xa2f2('0x8b')][_0xa2f2('0x8d')]||'')};if(_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x8e')]&&_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x93')]&&_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x8e')]!=_0x579975[_0xa2f2('0x5a')][_0xa2f2('0x93')]){_0x368416['threadId']=_0x579975['body']['messageId'];}return _0x338c98[_0xa2f2('0x35')](_0x368416);}else{return _0x338c98;}}})[_0xa2f2('0x24')](function(_0x476da2){_0xbbaa34['interaction']=_0x476da2['get']({'plain':!![]});_0xbbaa34[_0xa2f2('0x94')][_0xa2f2('0x95')]=_0xd2a381;if(_0xbbaa34[_0xa2f2('0x94')][_0xa2f2('0x95')]){if(_0xbbaa34['account'][_0xa2f2('0x96')]){_0xbbaa34[_0xa2f2('0x87')][_0xa2f2('0x97')]({'id':0x0,'priority':_0xbbaa34[_0xa2f2('0x87')]['length']+0x1,'app':_0xa2f2('0x98'),'appdata':_0xa2f2('0x99'),'interval':_0xa2f2('0x9a')});}}return db[_0xa2f2('0x9b')][_0xa2f2('0x59')]({'body':_0x579975[_0xa2f2('0x5a')]['body'],'OpenchannelAccountId':_0x579975[_0xa2f2('0x55')]['id'],'OpenchannelInteractionId':_0x476da2['id'],'direction':'in','ContactId':_0xbbaa34[_0xa2f2('0x8b')]['id'],'AttachmentId':_0x579975[_0xa2f2('0x5a')]['AttachmentId']});})[_0xa2f2('0x24')](function(_0x5714c9){_0xbbaa34[_0xa2f2('0x2c')]=_0x5714c9;if(_0xbbaa34[_0xa2f2('0x94')][_0xa2f2('0x9c')]){return db['User'][_0xa2f2('0x58')]({'attributes':['id',_0xa2f2('0x39')],'where':{'id':_0xbbaa34[_0xa2f2('0x94')][_0xa2f2('0x9c')]}})[_0xa2f2('0x24')](function(_0x2cc97f){if(_0x2cc97f){_0xbbaa34[_0xa2f2('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa2f2('0x9d'),'appdata':_0x2cc97f[_0xa2f2('0x39')]+','+(_0xbbaa34[_0xa2f2('0x86')][_0xa2f2('0x9e')]||0xa),'interval':_0xa2f2('0x9a')});_0xbbaa34[_0xa2f2('0x9f')]=![];}return respondWithRpcPromise('Start',_0xa2f2('0xa0'),_0xbbaa34);});}return respondWithRpcPromise(_0xa2f2('0xa1'),_0xa2f2('0xa0'),_0xbbaa34);})[_0xa2f2('0x24')](function(_0x5af524){respondWithRpcPromise(_0xa2f2('0xa2'),'EventManager',{'event':'notify','message':_0x5af524},client9002);return _0x5af524;})[_0xa2f2('0x24')](respondWithResult(_0x4f0105,null))[_0xa2f2('0x2d')](handleError(_0x4f0105,null));};exports['addApplications']=function(_0x3c5228,_0x109a48){var _0x227eb9=_0x3c5228['params']['id'];var _0xf19c44=_0x3c5228['body'];var _0x426eab=0xc8;var _0xb64094=null;return db[_0xa2f2('0xa3')][_0xa2f2('0xa4')]({'isolationLevel':db[_0xa2f2('0xa3')]['Transaction'][_0xa2f2('0xa5')][_0xa2f2('0xa6')]},function(_0x409055){return db[_0xa2f2('0x3e')][_0xa2f2('0x65')]({'where':{'id':_0x227eb9},'transaction':_0x409055})[_0xa2f2('0x24')](function(_0x1079ad){if(_0x1079ad){return db[_0xa2f2('0x84')][_0xa2f2('0x36')]({'where':{'OpenchannelAccountId':_0x227eb9},'transaction':_0x409055})['then'](function(){var _0xfcbcbf=_['map'](_0xf19c44,function(_0x2aab46){_0x2aab46['OpenchannelAccountId']=_0x227eb9;return _0x2aab46;});return db[_0xa2f2('0x84')]['bulkCreate'](_0xfcbcbf,{'transaction':_0x409055});});}else{_0x426eab=0x194;_0xb64094=[];}});})['then'](function(){if(_0x426eab!==0x194){return db[_0xa2f2('0x84')][_0xa2f2('0xa7')]({'where':{'OpenchannelAccountId':_0x227eb9},'order':_0xa2f2('0xa8')})[_0xa2f2('0x24')](function(_0x43c8bc){_0xb64094=_0x43c8bc;});}})[_0xa2f2('0x2d')](function(_0x3f8ec4){_0x426eab=0x1f4;logger[_0xa2f2('0x2a')](_0x3f8ec4['stack']);if(_0x3f8ec4['name']){delete _0x3f8ec4[_0xa2f2('0x39')];}_0xb64094=_0x3f8ec4;})[_0xa2f2('0xa9')](function(){if(_0xb64094===null){_0x109a48[_0xa2f2('0x2e')](_0x426eab);}else{if(_0x426eab===0x1f4){_0x109a48[_0xa2f2('0x30')](_0x426eab)[_0xa2f2('0x3a')](_0xb64094);}else{_0x109a48['status'](_0x426eab)['json'](_0xb64094);}}});};exports['getApplications']=function(_0xdebe2e,_0x530ab8,_0x351944){var _0x3634d0={};var _0x8c4ee0={};var _0x451317;var _0x15e0b7;return db[_0xa2f2('0x3e')][_0xa2f2('0x65')]({'where':{'id':_0xdebe2e[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x530ab8,null))[_0xa2f2('0x24')](function(_0x39c43c){if(_0x39c43c){_0x451317=_0x39c43c;_0x8c4ee0[_0xa2f2('0x43')]=_['keys'](db[_0xa2f2('0x84')][_0xa2f2('0x3f')]);_0x8c4ee0['query']=_['keys'](_0xdebe2e[_0xa2f2('0x45')]);_0x8c4ee0[_0xa2f2('0x4f')]=_[_0xa2f2('0x46')](_0x8c4ee0['model'],_0x8c4ee0[_0xa2f2('0x45')]);_0x3634d0[_0xa2f2('0x47')]=_[_0xa2f2('0x46')](_0x8c4ee0[_0xa2f2('0x43')],qs[_0xa2f2('0x48')](_0xdebe2e[_0xa2f2('0x45')][_0xa2f2('0x48')]));_0x3634d0[_0xa2f2('0x47')]=_0x3634d0['attributes'][_0xa2f2('0x49')]?_0x3634d0[_0xa2f2('0x47')]:_0x8c4ee0['model'];_0x3634d0[_0xa2f2('0x66')]=qs[_0xa2f2('0x4d')](_0xdebe2e[_0xa2f2('0x45')][_0xa2f2('0x4d')]);_0x3634d0[_0xa2f2('0x4e')]=qs[_0xa2f2('0x4f')](_[_0xa2f2('0x6c')](_0xdebe2e[_0xa2f2('0x45')],_0x8c4ee0[_0xa2f2('0x4f')]));if(_0xdebe2e[_0xa2f2('0x45')]['filter']){_0x3634d0[_0xa2f2('0x4e')]=_[_0xa2f2('0x50')](_0x3634d0[_0xa2f2('0x4e')],{'$or':_[_0xa2f2('0x3d')](_0x3634d0[_0xa2f2('0x47')],function(_0x26ce51){var _0x2b77c5={};_0x2b77c5[_0x26ce51]={'$like':'%'+_0xdebe2e['query'][_0xa2f2('0x67')]+'%'};return _0x2b77c5;})});}_0x3634d0=_[_0xa2f2('0x50')]({},_0x3634d0,_0xdebe2e['options']);return _0x451317[_0xa2f2('0xaa')](_0x3634d0);}})['then'](function(_0x2f50d9){if(_0x2f50d9){_0x15e0b7=_0x2f50d9[_0xa2f2('0x49')];if(!_0xdebe2e['query'][_0xa2f2('0x4a')](_0xa2f2('0x4b'))){_0x3634d0[_0xa2f2('0x4c')]=qs[_0xa2f2('0x4c')](_0xdebe2e[_0xa2f2('0x45')][_0xa2f2('0x4c')]);_0x3634d0[_0xa2f2('0x33')]=qs[_0xa2f2('0x33')](_0xdebe2e[_0xa2f2('0x45')][_0xa2f2('0x33')]);}return _0x451317[_0xa2f2('0xaa')](_0x3634d0);}})[_0xa2f2('0x24')](function(_0x3c88b0){if(_0x3c88b0){return _0x3c88b0?{'count':_0x15e0b7,'rows':_0x3c88b0}:null;}})['then'](respondWithResult(_0x530ab8,null))[_0xa2f2('0x2d')](handleError(_0x530ab8,null));};exports[_0xa2f2('0xab')]=function(_0x3d5901,_0xd556eb,_0x4b5966){var _0x3c0466={'raw':![],'where':{}};var _0x482f7a={};var _0x46187e={'count':0x0,'rows':[]};return db[_0xa2f2('0x3e')][_0xa2f2('0x65')]({'where':{'id':_0x3d5901[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0xd556eb,null))[_0xa2f2('0x24')](function(_0x43618b){if(_0x43618b){_0x482f7a[_0xa2f2('0x43')]=_[_0xa2f2('0x44')](db[_0xa2f2('0x8f')]['rawAttributes']);_0x482f7a[_0xa2f2('0x45')]=_['keys'](_0x3d5901[_0xa2f2('0x45')]);_0x482f7a['filters']=_[_0xa2f2('0x46')](_0x482f7a[_0xa2f2('0x43')],_0x482f7a[_0xa2f2('0x45')]);_0x3c0466['attributes']=_[_0xa2f2('0x46')](_0x482f7a[_0xa2f2('0x43')],qs[_0xa2f2('0x48')](_0x3d5901[_0xa2f2('0x45')]['fields']));_0x3c0466[_0xa2f2('0x47')]=_0x3c0466[_0xa2f2('0x47')][_0xa2f2('0x49')]?_0x3c0466[_0xa2f2('0x47')]:_0x482f7a['model'];if(!_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0x4a')](_0xa2f2('0x4b'))){_0x3c0466['limit']=qs[_0xa2f2('0x4c')](_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0x4c')]);_0x3c0466[_0xa2f2('0x33')]=qs['offset'](_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0x33')]);}_0x3c0466[_0xa2f2('0x66')]=qs[_0xa2f2('0x4d')](_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0x4d')]);_0x3c0466[_0xa2f2('0x4e')]=qs[_0xa2f2('0x4f')](_[_0xa2f2('0x6c')](_0x3d5901[_0xa2f2('0x45')],_0x482f7a[_0xa2f2('0x4f')]));_0x3c0466[_0xa2f2('0x4e')][_0xa2f2('0x63')]=_0x43618b['id'];if(_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0x67')]){_0x3c0466[_0xa2f2('0x4e')]=_[_0xa2f2('0x50')](_0x3c0466[_0xa2f2('0x4e')],{'$or':_[_0xa2f2('0x3d')](_0x3c0466[_0xa2f2('0x47')],function(_0x15b81f){var _0x233ffe={};_0x233ffe[_0x15b81f]={'$like':'%'+_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0x67')]+'%'};return _0x233ffe;})});}_0x3c0466=_[_0xa2f2('0x50')]({},_0x3c0466,_0x3d5901[_0xa2f2('0x51')]);return db[_0xa2f2('0x8f')][_0xa2f2('0x32')]({'where':_0x3c0466[_0xa2f2('0x4e')]})['then'](function(_0x342270){_0x46187e['count']=_0x342270;if(_0x3d5901['query']['includeAll']){_0x3c0466[_0xa2f2('0x52')]=[{'model':db[_0xa2f2('0x81')],'as':_0xa2f2('0xac'),'required':![]},{'model':db[_0xa2f2('0xad')],'as':_0xa2f2('0xae'),'attributes':['name',_0xa2f2('0xaf'),_0xa2f2('0xb0')],'required':![]},{'model':db['Tag'],'as':_0xa2f2('0xb1'),'attributes':['id',_0xa2f2('0x39'),_0xa2f2('0xb2')],'where':_0x3d5901['query'][_0xa2f2('0xb3')]?{'id':_0x3d5901['query']['tag']}:undefined,'required':_0x3d5901[_0xa2f2('0x45')][_0xa2f2('0xb3')]?!![]:![]}];}return db[_0xa2f2('0x8f')][_0xa2f2('0x68')](_0x3c0466);})[_0xa2f2('0x24')](function(_0x1061f7){_0x46187e[_0xa2f2('0x53')]=_0x1061f7;return _0x46187e;});}})['then'](respondWithFilteredResult(_0xd556eb,_0x3c0466))['catch'](handleError(_0xd556eb,null));};exports[_0xa2f2('0xb4')]=function(_0x2a07d2,_0x1ac630,_0x83ccc9){return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x2a07d2[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x1ac630,null))['then'](function(_0x2237db){if(_0x2237db){return _0x2237db[_0xa2f2('0xb4')](_0x2a07d2[_0xa2f2('0x5a')][_0xa2f2('0x6e')],_['omit'](_0x2a07d2['body'],[_0xa2f2('0x6e'),'id'])||{})[_0xa2f2('0x92')](function(_0x1a632b){for(var _0x300c64=0x0;_0x300c64<_0x2a07d2[_0xa2f2('0x5a')][_0xa2f2('0x6e')][_0xa2f2('0x49')];_0x300c64+=0x1){socket[_0xa2f2('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x2a07d2[_0xa2f2('0x5a')][_0xa2f2('0x6e')][_0x300c64]),'OpenchannelAccountId':Number(_0x2a07d2['params']['id'])});}return _0x1a632b;});}})[_0xa2f2('0x24')](respondWithResult(_0x1ac630,null))[_0xa2f2('0x2d')](handleError(_0x1ac630,null));};exports[_0xa2f2('0xb6')]=function(_0x5113e2,_0x3aac2b,_0x3e556a){return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x5113e2['params']['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x3aac2b,null))[_0xa2f2('0x24')](function(_0x53b1e7){if(_0x53b1e7){return _0x53b1e7[_0xa2f2('0xb6')](_0x5113e2[_0xa2f2('0x45')][_0xa2f2('0x6e')])[_0xa2f2('0x24')](function(){if(_[_0xa2f2('0xb7')](_0x5113e2[_0xa2f2('0x45')][_0xa2f2('0x6e')])){for(var _0x4c0eb4=0x0;_0x4c0eb4<_0x5113e2['query'][_0xa2f2('0x6e')][_0xa2f2('0x49')];_0x4c0eb4+=0x1){socket[_0xa2f2('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5113e2[_0xa2f2('0x45')][_0xa2f2('0x6e')][_0x4c0eb4]),'OpenchannelAccountId':Number(_0x5113e2[_0xa2f2('0x55')]['id'])});}}else{socket[_0xa2f2('0xb5')](_0xa2f2('0xb8'),{'UserId':Number(_0x5113e2[_0xa2f2('0x45')][_0xa2f2('0x6e')]),'OpenchannelAccountId':Number(_0x5113e2[_0xa2f2('0x55')]['id'])});}});}})[_0xa2f2('0x24')](respondWithStatusCode(_0x3aac2b,null))[_0xa2f2('0x2d')](handleError(_0x3aac2b,null));};exports['getAgents']=function(_0x34cb16,_0x5058a6,_0x5de39a){var _0x404264={};var _0x331024={};var _0x116cfe;var _0x3e96b3;return db['OpenchannelAccount'][_0xa2f2('0x65')]({'where':{'id':_0x34cb16[_0xa2f2('0x55')]['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0x5058a6,null))[_0xa2f2('0x24')](function(_0xf233ef){if(_0xf233ef){_0x116cfe=_0xf233ef;_0x331024[_0xa2f2('0x43')]=_[_0xa2f2('0x44')](db[_0xa2f2('0xad')][_0xa2f2('0x3f')]);_0x331024[_0xa2f2('0x45')]=_['keys'](_0x34cb16[_0xa2f2('0x45')]);_0x331024['filters']=_[_0xa2f2('0x46')](_0x331024[_0xa2f2('0x43')],_0x331024['query']);_0x404264['attributes']=_[_0xa2f2('0x46')](_0x331024['model'],qs[_0xa2f2('0x48')](_0x34cb16[_0xa2f2('0x45')]['fields']));_0x404264[_0xa2f2('0x47')]=_0x404264['attributes'][_0xa2f2('0x49')]?_0x404264[_0xa2f2('0x47')]:_0x331024[_0xa2f2('0x43')];_0x404264[_0xa2f2('0x66')]=qs['sort'](_0x34cb16[_0xa2f2('0x45')][_0xa2f2('0x4d')]);_0x404264[_0xa2f2('0x4e')]=qs[_0xa2f2('0x4f')](_['pick'](_0x34cb16[_0xa2f2('0x45')],_0x331024[_0xa2f2('0x4f')]));if(_0x34cb16['query'][_0xa2f2('0x67')]){_0x404264[_0xa2f2('0x4e')]=_[_0xa2f2('0x50')](_0x404264['where'],{'$or':_['map'](_0x404264[_0xa2f2('0x47')],function(_0x4ebe0d){var _0x25966e={};_0x25966e[_0x4ebe0d]={'$like':'%'+_0x34cb16[_0xa2f2('0x45')][_0xa2f2('0x67')]+'%'};return _0x25966e;})});}_0x404264=_[_0xa2f2('0x50')]({},_0x404264,_0x34cb16[_0xa2f2('0x51')]);return _0x116cfe[_0xa2f2('0xb9')](_0x404264);}})['then'](function(_0x1683ed){if(_0x1683ed){_0x3e96b3=_0x1683ed[_0xa2f2('0x49')];if(!_0x34cb16[_0xa2f2('0x45')][_0xa2f2('0x4a')]('nolimit')){_0x404264['limit']=qs[_0xa2f2('0x4c')](_0x34cb16[_0xa2f2('0x45')][_0xa2f2('0x4c')]);_0x404264['offset']=qs[_0xa2f2('0x33')](_0x34cb16[_0xa2f2('0x45')][_0xa2f2('0x33')]);}return _0x116cfe['getAgents'](_0x404264);}})[_0xa2f2('0x24')](function(_0x471c66){if(_0x471c66){return _0x471c66?{'count':_0x3e96b3,'rows':_0x471c66}:null;}})[_0xa2f2('0x24')](respondWithResult(_0x5058a6,null))[_0xa2f2('0x2d')](handleError(_0x5058a6,null));};exports[_0xa2f2('0x3a')]=function(_0x2c85c6,_0xcb40fa,_0x523964){var _0x2d2763,_0x75a4c4,_0x195a27;if(_[_0xa2f2('0x79')](_0x2c85c6[_0xa2f2('0x5a')]['body'])||_0x2c85c6[_0xa2f2('0x5a')][_0xa2f2('0x5a')]===''){throw new db[(_0xa2f2('0x78'))][(_0xa2f2('0x71'))](_0xa2f2('0x7a'));}if(_['isNil'](_0x2c85c6['body']['to'])){}_0x2d2763=_0x2c85c6[_0xa2f2('0x5a')]['to'];return db[_0xa2f2('0x3e')][_0xa2f2('0x65')]({'where':{'id':_0x2c85c6['params']['id']}})[_0xa2f2('0x24')](handleEntityNotFound(_0xcb40fa,null))['then'](function(_0x1ef6ea){if(_0x1ef6ea){return db[_0xa2f2('0x3e')][_0xa2f2('0x58')]({'where':{'id':_0x1ef6ea['id']},'include':[{'model':db[_0xa2f2('0x7f')],'as':_0xa2f2('0x80'),'include':[{'model':db[_0xa2f2('0x81')],'as':_0xa2f2('0x82'),'where':{[_0x1ef6ea[_0xa2f2('0x7b')]]:_0x2d2763},'limit':0x1,'order':[[_0xa2f2('0x75'),_0xa2f2('0x83')]]}]}]})[_0xa2f2('0x24')](handleEntityNotFound(_0xcb40fa,null))[_0xa2f2('0x24')](function(_0x19078f){if(_0x19078f&&_0x19078f['List']){_0x75a4c4=_0x19078f['get']({'plain':!![]});if(_0x75a4c4[_0xa2f2('0x80')]&&_0x75a4c4['List'][_0xa2f2('0x82')][_0xa2f2('0x49')]){return _0x75a4c4[_0xa2f2('0x80')][_0xa2f2('0x82')][0x0];}return db[_0xa2f2('0x81')][_0xa2f2('0x59')](_[_0xa2f2('0x1b')](_0x2c85c6[_0xa2f2('0x5a')],{'firstName':_0x2d2763,[_0x19078f[_0xa2f2('0x7b')]]:_0x2d2763,'phone':_0x2d2763,'ListId':_0x75a4c4[_0xa2f2('0xba')]}));}})[_0xa2f2('0x24')](handleEntityNotFound(_0xcb40fa,null))[_0xa2f2('0x24')](function(_0x3da866){if(_0x3da866){_0x195a27=_0x3da866;return db[_0xa2f2('0x8f')][_0xa2f2('0x58')]({'where':{'ContactId':_0x195a27['id'],'closed':![],'OpenchannelAccountId':_0x75a4c4['id']}})[_0xa2f2('0x24')](function(_0x5bd5ce){if(_0x5bd5ce){return[_0x5bd5ce,![]];}return db[_0xa2f2('0x8f')][_0xa2f2('0x59')]({'UserId':_0x2c85c6['user']['id'],'ContactId':_0x195a27['id'],'OpenchannelAccountId':_0x75a4c4['id'],'lastMsgDirection':'out','Messages':[_[_0xa2f2('0x50')](_0x2c85c6[_0xa2f2('0x5a')],{'read':![],'body':_0x2c85c6['body'][_0xa2f2('0x5a')],'OpenchannelAccountId':_0x75a4c4['id'],'UserId':_0x2c85c6['user']['id'],'ContactId':_0x195a27['id']})]},{'include':[{'model':db[_0xa2f2('0x9b')],'as':_0xa2f2('0xbb')}]})['then'](function(_0x334652){return[_0x334652,!![]];});});}})[_0xa2f2('0x92')](function(_0x5b08a0,_0x473ee0){if(_0x473ee0){return _0x5b08a0;}return db[_0xa2f2('0x9b')][_0xa2f2('0x59')](_['merge'](_0x2c85c6[_0xa2f2('0x5a')],{'read':![],'body':_0x2c85c6[_0xa2f2('0x5a')][_0xa2f2('0x5a')],'OpenchannelAccountId':_0x75a4c4['id'],'OpenchannelInteractionId':_0x5b08a0['id'],'UserId':_0x2c85c6[_0xa2f2('0x5b')]['id'],'ContactId':_0x195a27['id']}))[_0xa2f2('0x24')](function(_0x185ee8){_0x5b08a0[_0xa2f2('0xbc')][_0xa2f2('0xbb')]=[];_0x5b08a0[_0xa2f2('0xbc')][_0xa2f2('0xbb')][_0xa2f2('0x97')](_0x185ee8['dataValues']);return _0x5b08a0;});});}})[_0xa2f2('0x24')](respondWithResult(_0xcb40fa,null))[_0xa2f2('0x2d')](handleError(_0xcb40fa,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 784400a..e9c94ee 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 _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xda55,0x6d));var _0x5da5=function(_0x4f5a01,_0x590de4){_0x4f5a01=_0x4f5a01-0x0;var _0x3c882a=_0xda55[_0x4f5a01];return _0x3c882a;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xec56=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xec56,0x1bd));var _0x6ec5=function(_0x26d2e0,_0x34e9d8){_0x26d2e0=_0x26d2e0-0x0;var _0x3ea2ea=_0xec56[_0x26d2e0];return _0x3ea2ea;};'use strict';var EventEmitter=require(_0x6ec5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6ec5('0x1')](0x0);var events={'afterCreate':_0x6ec5('0x2'),'afterUpdate':_0x6ec5('0x3'),'afterDestroy':_0x6ec5('0x4')};function emitEvent(_0x43c2cd){return function(_0x399441,_0x469679,_0x173aeb){OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd+':'+_0x399441['id'],_0x399441);OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd,_0x399441);_0x173aeb(null);};}for(var e in events){if(events[_0x6ec5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x6ec5('0x7')](e,emitEvent(event));}}module[_0x6ec5('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8d41be8..0bcc762 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(_0x48ff84,_0x3cf168){var _0x1dfdd0=function(_0x22ca9a){while(--_0x22ca9a){_0x48ff84['push'](_0x48ff84['shift']());}};_0x1dfdd0(++_0x3cf168);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x539eed,_0x31bb95){var _0x102baf=function(_0x5d8aa2){while(--_0x5d8aa2){_0x539eed['push'](_0x539eed['shift']());}};_0x102baf(++_0x31bb95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 070af0c..8277bd4 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 _0xcf66=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then'];(function(_0x56c25a,_0x15157d){var _0x4f1914=function(_0x597c5c){while(--_0x597c5c){_0x56c25a['push'](_0x56c25a['shift']());}};_0x4f1914(++_0x15157d);}(_0xcf66,0x71));var _0x6cf6=function(_0x54615d,_0x484a97){_0x54615d=_0x54615d-0x0;var _0x2afd34=_0xcf66[_0x54615d];return _0x2afd34;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});config['redis']=_[_0x6cf6('0xa')](config[_0x6cf6('0xb')],{'host':_0x6cf6('0xc'),'port':0x18eb});var socket=require(_0x6cf6('0xd'))(new Redis(config[_0x6cf6('0xb')]));require(_0x6cf6('0xe'))['register'](socket);function respondWithRpcPromise(_0x58378c,_0x5b7f4e,_0x8e90e){return new BPromise(function(_0x504c98,_0x1fdf80){return client[_0x6cf6('0xf')](_0x58378c,_0x8e90e)[_0x6cf6('0x10')](function(_0x3f7fc1){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5b7f4e,'request\x20sent');logger[_0x6cf6('0x11')](_0x6cf6('0x12'),_0x5b7f4e,_0x6cf6('0x13'),JSON[_0x6cf6('0x14')](_0x3f7fc1));if(_0x3f7fc1[_0x6cf6('0x15')]){if(_0x3f7fc1[_0x6cf6('0x15')]['code']===0x1f4){logger[_0x6cf6('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b7f4e,_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);return _0x1fdf80(_0x3f7fc1['error'][_0x6cf6('0x16')]);}logger[_0x6cf6('0x15')](_0x6cf6('0x17'),_0x5b7f4e,_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);return _0x504c98(_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);}else{logger[_0x6cf6('0x18')](_0x6cf6('0x17'),_0x5b7f4e,_0x6cf6('0x13'));_0x504c98(_0x3f7fc1['result'][_0x6cf6('0x16')]);}})[_0x6cf6('0x19')](function(_0x22ab0){logger['error'](_0x6cf6('0x17'),_0x5b7f4e,_0x22ab0);_0x1fdf80(_0x22ab0);});});} \ No newline at end of file +var _0x4227=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x4227,0x89));var _0x7422=function(_0x2de482,_0x478c1d){_0x2de482=_0x2de482-0x0;var _0xd4b24f=_0x4227[_0x2de482];return _0xd4b24f;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});config[_0x7422('0xa')]=_[_0x7422('0xb')](config[_0x7422('0xa')],{'host':_0x7422('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7422('0xa')]));require(_0x7422('0xd'))[_0x7422('0xe')](socket);function respondWithRpcPromise(_0x511340,_0x1603ee,_0x5f27cb){return new BPromise(function(_0x3cc76d,_0x37be02){return client[_0x7422('0xf')](_0x511340,_0x5f27cb)[_0x7422('0x10')](function(_0x15a472){logger['info'](_0x7422('0x11'),_0x1603ee,_0x7422('0x12'));logger['debug'](_0x7422('0x13'),_0x1603ee,_0x7422('0x12'),JSON['stringify'](_0x15a472));if(_0x15a472[_0x7422('0x14')]){if(_0x15a472[_0x7422('0x14')]['code']===0x1f4){logger['error'](_0x7422('0x11'),_0x1603ee,_0x15a472['error'][_0x7422('0x15')]);return _0x37be02(_0x15a472[_0x7422('0x14')]['message']);}logger[_0x7422('0x14')](_0x7422('0x11'),_0x1603ee,_0x15a472[_0x7422('0x14')][_0x7422('0x15')]);return _0x3cc76d(_0x15a472[_0x7422('0x14')][_0x7422('0x15')]);}else{logger['info'](_0x7422('0x11'),_0x1603ee,_0x7422('0x12'));_0x3cc76d(_0x15a472[_0x7422('0x16')][_0x7422('0x15')]);}})['catch'](function(_0x1f9e09){logger['error'](_0x7422('0x11'),_0x1603ee,_0x1f9e09);_0x37be02(_0x1f9e09);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b1fc97e..9615cc5 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 _0xc2cc=['update','emit','register','openchannelAccount:','save','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc2cc,0x70));var _0xcc2c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc2cc[_0x2c91e9];return _0x13f0ff;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xcc2c('0x0'),_0xcc2c('0x1'),_0xcc2c('0x2')];function createListener(_0x5aad8f,_0x2a1a4a){return function(_0x52a81b){_0x2a1a4a[_0xcc2c('0x3')](_0x5aad8f,_0x52a81b);};}function removeListener(_0x47c883,_0x1dc5ec){return function(){OpenchannelAccountEvents['removeListener'](_0x47c883,_0x1dc5ec);};}exports[_0xcc2c('0x4')]=function(_0x539095){for(var _0x5855cc=0x0,_0x475a85=events['length'];_0x5855cc<_0x475a85;_0x5855cc++){var _0x144b90=events[_0x5855cc];var _0x5a276f=createListener(_0xcc2c('0x5')+_0x144b90,_0x539095);OpenchannelAccountEvents['on'](_0x144b90,_0x5a276f);}}; \ No newline at end of file +var _0xa9e5=['length','openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0x47157f,_0x2f55ad){var _0x44b211=function(_0xb6736){while(--_0xb6736){_0x47157f['push'](_0x47157f['shift']());}};_0x44b211(++_0x2f55ad);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x103cdc,_0x81d4a4){_0x103cdc=_0x103cdc-0x0;var _0x570854=_0xa9e5[_0x103cdc];return _0x570854;};'use strict';var OpenchannelAccountEvents=require(_0x5a9e('0x0'));var events=[_0x5a9e('0x1'),'remove',_0x5a9e('0x2')];function createListener(_0x4153cc,_0x31f045){return function(_0x1dc619){_0x31f045[_0x5a9e('0x3')](_0x4153cc,_0x1dc619);};}function removeListener(_0x2fdfab,_0x3ce605){return function(){OpenchannelAccountEvents[_0x5a9e('0x4')](_0x2fdfab,_0x3ce605);};}exports[_0x5a9e('0x5')]=function(_0x34a9ed){for(var _0x1fb122=0x0,_0x36831b=events[_0x5a9e('0x6')];_0x1fb122<_0x36831b;_0x1fb122++){var _0xa3e37b=events[_0x1fb122];var _0x4e1213=createListener(_0x5a9e('0x7')+_0xa3e37b,_0x34a9ed);OpenchannelAccountEvents['on'](_0xa3e37b,_0x4e1213);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index e32a00e..36ae18c 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 _0xd759=['/:id','show','post','create','put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd759,0xe7));var _0x9d75=function(_0x53538f,_0x3b129d){_0x53538f=_0x53538f-0x0;var _0x4a5ffc=_0xd759[_0x53538f];return _0x4a5ffc;};'use strict';var multer=require('multer');var util=require(_0x9d75('0x0'));var path=require(_0x9d75('0x1'));var timeout=require(_0x9d75('0x2'));var express=require(_0x9d75('0x3'));var router=express['Router']();var fs_extra=require(_0x9d75('0x4'));var auth=require(_0x9d75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d75('0x6'));var controller=require('./openchannelApplication.controller');router[_0x9d75('0x7')]('/',auth[_0x9d75('0x8')](),controller['index']);router[_0x9d75('0x7')](_0x9d75('0x9'),auth[_0x9d75('0x8')](),controller[_0x9d75('0xa')]);router[_0x9d75('0xb')]('/',auth[_0x9d75('0x8')](),controller[_0x9d75('0xc')]);router[_0x9d75('0xd')]('/:id',auth[_0x9d75('0x8')](),controller['update']);router[_0x9d75('0xe')](_0x9d75('0x9'),auth[_0x9d75('0x8')](),controller['destroy']);module[_0x9d75('0xf')]=router; \ No newline at end of file +var _0x7a58=['Router','fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x3a4b1f,_0x5cf288){var _0x1081c0=function(_0x4d964a){while(--_0x4d964a){_0x3a4b1f['push'](_0x3a4b1f['shift']());}};_0x1081c0(++_0x5cf288);}(_0x7a58,0x11c));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x87a5('0x0'));var util=require(_0x87a5('0x1'));var path=require(_0x87a5('0x2'));var timeout=require(_0x87a5('0x3'));var express=require(_0x87a5('0x4'));var router=express[_0x87a5('0x5')]();var fs_extra=require(_0x87a5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x87a5('0x7'));var controller=require(_0x87a5('0x8'));router[_0x87a5('0x9')]('/',auth[_0x87a5('0xa')](),controller[_0x87a5('0xb')]);router[_0x87a5('0x9')](_0x87a5('0xc'),auth[_0x87a5('0xa')](),controller['show']);router[_0x87a5('0xd')]('/',auth[_0x87a5('0xa')](),controller['create']);router['put'](_0x87a5('0xc'),auth[_0x87a5('0xa')](),controller[_0x87a5('0xe')]);router[_0x87a5('0xf')](_0x87a5('0xc'),auth[_0x87a5('0xa')](),controller[_0x87a5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ec05d20..8951f29 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 _0x0de3=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x0de3,0x184));var _0x30de=function(_0x348281,_0xc1733a){_0x348281=_0x348281-0x0;var _0x2e27cc=_0x0de3[_0x348281];return _0x2e27cc;};'use strict';var Sequelize=require(_0x30de('0x0'));module[_0x30de('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x30de('0x2')],'allowNull':![],'defaultValue':_0x30de('0x3')},'appdata':{'type':Sequelize[_0x30de('0x4')]()},'description':{'type':Sequelize[_0x30de('0x2')]},'interval':{'type':Sequelize[_0x30de('0x2')],'defaultValue':_0x30de('0x5')}}; \ No newline at end of file +var _0x9895=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x9895,0x113));var _0x5989=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9895[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x5989('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5989('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5989('0x2')],'allowNull':![],'defaultValue':_0x5989('0x3')},'appdata':{'type':Sequelize[_0x5989('0x4')]()},'description':{'type':Sequelize[_0x5989('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5989('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e8257f2..e56fd32 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 _0x87fd=['then','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy'];(function(_0x24f86f,_0x3f1847){var _0x2b594a=function(_0x1c4d39){while(--_0x1c4d39){_0x24f86f['push'](_0x24f86f['shift']());}};_0x2b594a(++_0x3f1847);}(_0x87fd,0x105));var _0xd87f=function(_0x2dcc0f,_0x52c5fb){_0x2dcc0f=_0x2dcc0f-0x0;var _0x306ee5=_0x87fd[_0x2dcc0f];return _0x306ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd87f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd87f('0x1'));var rp=require(_0xd87f('0x2'));var moment=require(_0xd87f('0x3'));var BPromise=require(_0xd87f('0x4'));var Mustache=require(_0xd87f('0x5'));var util=require('util');var path=require(_0xd87f('0x6'));var sox=require(_0xd87f('0x7'));var csv=require(_0xd87f('0x8'));var ejs=require(_0xd87f('0x9'));var fs=require('fs');var fs_extra=require(_0xd87f('0xa'));var _=require('lodash');var squel=require(_0xd87f('0xb'));var crypto=require(_0xd87f('0xc'));var jsforce=require(_0xd87f('0xd'));var deskjs=require(_0xd87f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd87f('0xf'));var Papa=require(_0xd87f('0x10'));var Redis=require(_0xd87f('0x11'));var authService=require(_0xd87f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd87f('0x13'));var hardwareService=require(_0xd87f('0x14'));var logger=require(_0xd87f('0x15'))(_0xd87f('0x16'));var utils=require(_0xd87f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd87f('0x18'))['db'];function respondWithStatusCode(_0x44f532,_0x4c5a34){_0x4c5a34=_0x4c5a34||0xcc;return function(_0x2ba31f){if(_0x2ba31f){return _0x44f532[_0xd87f('0x19')](_0x4c5a34);}return _0x44f532['status'](_0x4c5a34)[_0xd87f('0x1a')]();};}function respondWithResult(_0x437fda,_0x593cb1){_0x593cb1=_0x593cb1||0xc8;return function(_0x18073e){if(_0x18073e){return _0x437fda[_0xd87f('0x1b')](_0x593cb1)[_0xd87f('0x1c')](_0x18073e);}};}function respondWithFilteredResult(_0xdb9c62,_0x910093){return function(_0x19e2a5){if(_0x19e2a5){var _0x1e1f84=typeof _0x910093[_0xd87f('0x1d')]==='undefined'&&typeof _0x910093[_0xd87f('0x1e')]===_0xd87f('0x1f');var _0x2c18b6=_0x19e2a5[_0xd87f('0x20')];var _0x4675cc=_0x1e1f84?0x0:_0x910093[_0xd87f('0x1d')];var _0x236a80=_0x1e1f84?_0x19e2a5['count']:_0x910093[_0xd87f('0x1d')]+_0x910093['limit'];var _0x5a04c1;if(_0x236a80>=_0x2c18b6){_0x236a80=_0x2c18b6;_0x5a04c1=0xc8;}else{_0x5a04c1=0xce;}_0xdb9c62['status'](_0x5a04c1);return _0xdb9c62[_0xd87f('0x21')](_0xd87f('0x22'),_0x4675cc+'-'+_0x236a80+'/'+_0x2c18b6)[_0xd87f('0x1c')](_0x19e2a5);}return null;};}function patchUpdates(_0x1fbe9c){return function(_0x2fb924){try{jsonpatch['apply'](_0x2fb924,_0x1fbe9c,!![]);}catch(_0x1dd2d0){return BPromise[_0xd87f('0x23')](_0x1dd2d0);}return _0x2fb924[_0xd87f('0x24')]();};}function saveUpdates(_0x12cf7b,_0x4c1903){return function(_0x162d55){if(_0x162d55){return _0x162d55[_0xd87f('0x25')](_0x12cf7b)['then'](function(_0x4b6c27){return _0x4b6c27;});}return null;};}function removeEntity(_0x47bbc0,_0x156efe){return function(_0x32a728){if(_0x32a728){return _0x32a728[_0xd87f('0x26')]()[_0xd87f('0x27')](function(){_0x47bbc0['status'](0xcc)[_0xd87f('0x1a')]();});}};}function handleEntityNotFound(_0x2d3859,_0x2098b5){return function(_0x23c181){if(!_0x23c181){_0x2d3859['sendStatus'](0x194);}return _0x23c181;};}function handleError(_0x44a973,_0x41b398){_0x41b398=_0x41b398||0x1f4;return function(_0x577d51){logger[_0xd87f('0x28')](_0x577d51['stack']);if(_0x577d51[_0xd87f('0x29')]){delete _0x577d51['name'];}_0x44a973[_0xd87f('0x1b')](_0x41b398)['send'](_0x577d51);};}exports[_0xd87f('0x2a')]=function(_0xb5deb1,_0x4229ba){var _0x5ebcd3={},_0x1dbb3e={},_0x5bfc15={'count':0x0,'rows':[]};var _0x33b377=_[_0xd87f('0x2b')](db[_0xd87f('0x2c')][_0xd87f('0x2d')],function(_0x4ee794){return{'name':_0x4ee794[_0xd87f('0x2e')],'type':_0x4ee794[_0xd87f('0x2f')][_0xd87f('0x30')]};});_0x1dbb3e[_0xd87f('0x31')]=_[_0xd87f('0x2b')](_0x33b377,_0xd87f('0x29'));_0x1dbb3e[_0xd87f('0x32')]=_['keys'](_0xb5deb1[_0xd87f('0x32')]);_0x1dbb3e[_0xd87f('0x33')]=_[_0xd87f('0x34')](_0x1dbb3e[_0xd87f('0x31')],_0x1dbb3e[_0xd87f('0x32')]);_0x5ebcd3[_0xd87f('0x35')]=_[_0xd87f('0x34')](_0x1dbb3e[_0xd87f('0x31')],qs[_0xd87f('0x36')](_0xb5deb1[_0xd87f('0x32')][_0xd87f('0x36')]));_0x5ebcd3[_0xd87f('0x35')]=_0x5ebcd3[_0xd87f('0x35')][_0xd87f('0x37')]?_0x5ebcd3[_0xd87f('0x35')]:_0x1dbb3e[_0xd87f('0x31')];if(!_0xb5deb1[_0xd87f('0x32')]['hasOwnProperty']('nolimit')){_0x5ebcd3[_0xd87f('0x1e')]=qs[_0xd87f('0x1e')](_0xb5deb1[_0xd87f('0x32')]['limit']);_0x5ebcd3[_0xd87f('0x1d')]=qs[_0xd87f('0x1d')](_0xb5deb1['query'][_0xd87f('0x1d')]);}_0x5ebcd3[_0xd87f('0x38')]=qs[_0xd87f('0x39')](_0xb5deb1[_0xd87f('0x32')][_0xd87f('0x39')]);_0x5ebcd3[_0xd87f('0x3a')]=qs[_0xd87f('0x33')](_[_0xd87f('0x3b')](_0xb5deb1[_0xd87f('0x32')],_0x1dbb3e['filters']),_0x33b377);if(_0xb5deb1[_0xd87f('0x32')][_0xd87f('0x3c')]){_0x5ebcd3[_0xd87f('0x3a')]=_[_0xd87f('0x3d')](_0x5ebcd3['where'],{'$or':_[_0xd87f('0x2b')](_0x33b377,function(_0x3577ca){if(_0x3577ca[_0xd87f('0x2f')]!==_0xd87f('0x3e')){var _0x41cc7e={};_0x41cc7e[_0x3577ca[_0xd87f('0x29')]]={'$like':'%'+_0xb5deb1[_0xd87f('0x32')]['filter']+'%'};return _0x41cc7e;}})});}_0x5ebcd3=_['merge']({},_0x5ebcd3,_0xb5deb1[_0xd87f('0x3f')]);var _0x3b30c4={'where':_0x5ebcd3[_0xd87f('0x3a')]};return db[_0xd87f('0x2c')][_0xd87f('0x20')](_0x3b30c4)[_0xd87f('0x27')](function(_0x584158){_0x5bfc15['count']=_0x584158;if(_0xb5deb1[_0xd87f('0x32')][_0xd87f('0x40')]){_0x5ebcd3['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xd87f('0x41')](_0x5ebcd3);})['then'](function(_0xa0e0d9){_0x5bfc15[_0xd87f('0x42')]=_0xa0e0d9;return _0x5bfc15;})[_0xd87f('0x27')](respondWithFilteredResult(_0x4229ba,_0x5ebcd3))[_0xd87f('0x43')](handleError(_0x4229ba,null));};exports[_0xd87f('0x44')]=function(_0x448e39,_0x56570a){var _0x3dc109={'raw':!![],'where':{'id':_0x448e39['params']['id']}},_0x5521c3={};_0x5521c3[_0xd87f('0x31')]=_[_0xd87f('0x45')](db[_0xd87f('0x2c')][_0xd87f('0x2d')]);_0x5521c3[_0xd87f('0x32')]=_[_0xd87f('0x45')](_0x448e39[_0xd87f('0x32')]);_0x5521c3[_0xd87f('0x33')]=_['intersection'](_0x5521c3[_0xd87f('0x31')],_0x5521c3[_0xd87f('0x32')]);_0x3dc109[_0xd87f('0x35')]=_[_0xd87f('0x34')](_0x5521c3[_0xd87f('0x31')],qs[_0xd87f('0x36')](_0x448e39[_0xd87f('0x32')]['fields']));_0x3dc109[_0xd87f('0x35')]=_0x3dc109[_0xd87f('0x35')][_0xd87f('0x37')]?_0x3dc109[_0xd87f('0x35')]:_0x5521c3[_0xd87f('0x31')];if(_0x448e39['query'][_0xd87f('0x40')]){_0x3dc109[_0xd87f('0x46')]=[{'all':!![]}];}_0x3dc109=_[_0xd87f('0x3d')]({},_0x3dc109,_0x448e39[_0xd87f('0x3f')]);return db[_0xd87f('0x2c')][_0xd87f('0x47')](_0x3dc109)[_0xd87f('0x27')](handleEntityNotFound(_0x56570a,null))[_0xd87f('0x27')](respondWithResult(_0x56570a,null))['catch'](handleError(_0x56570a,null));};exports[_0xd87f('0x48')]=function(_0x3e695c,_0xc19455){return db[_0xd87f('0x2c')][_0xd87f('0x48')](_0x3e695c[_0xd87f('0x49')],{})[_0xd87f('0x27')](respondWithResult(_0xc19455,0xc9))[_0xd87f('0x43')](handleError(_0xc19455,null));};exports[_0xd87f('0x25')]=function(_0x1fd44f,_0x494fa8){if(_0x1fd44f[_0xd87f('0x49')]['id']){delete _0x1fd44f[_0xd87f('0x49')]['id'];}return db[_0xd87f('0x2c')][_0xd87f('0x47')]({'where':{'id':_0x1fd44f[_0xd87f('0x4a')]['id']}})[_0xd87f('0x27')](handleEntityNotFound(_0x494fa8,null))[_0xd87f('0x27')](saveUpdates(_0x1fd44f[_0xd87f('0x49')],null))[_0xd87f('0x27')](respondWithResult(_0x494fa8,null))[_0xd87f('0x43')](handleError(_0x494fa8,null));};exports['destroy']=function(_0x4f8c54,_0x139e2a){return db[_0xd87f('0x2c')][_0xd87f('0x47')]({'where':{'id':_0x4f8c54[_0xd87f('0x4a')]['id']}})[_0xd87f('0x27')](handleEntityNotFound(_0x139e2a,null))['then'](removeEntity(_0x139e2a,null))[_0xd87f('0x43')](handleError(_0x139e2a,null));}; \ No newline at end of file +var _0x65ef=['offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x1acfb9,_0x52bc80){var _0x1416e3=function(_0x1909d1){while(--_0x1909d1){_0x1acfb9['push'](_0x1acfb9['shift']());}};_0x1416e3(++_0x52bc80);}(_0x65ef,0x10b));var _0xf65e=function(_0x2170fd,_0x471b22){_0x2170fd=_0x2170fd-0x0;var _0x169314=_0x65ef[_0x2170fd];return _0x169314;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf65e('0x0'));var zipdir=require(_0xf65e('0x1'));var jsonpatch=require(_0xf65e('0x2'));var rp=require(_0xf65e('0x3'));var moment=require(_0xf65e('0x4'));var BPromise=require(_0xf65e('0x5'));var Mustache=require(_0xf65e('0x6'));var util=require(_0xf65e('0x7'));var path=require('path');var sox=require(_0xf65e('0x8'));var csv=require(_0xf65e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf65e('0xa'));var squel=require(_0xf65e('0xb'));var crypto=require(_0xf65e('0xc'));var jsforce=require(_0xf65e('0xd'));var deskjs=require(_0xf65e('0xe'));var toCsv=require(_0xf65e('0x9'));var querystring=require(_0xf65e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf65e('0x10'));var qs=require(_0xf65e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf65e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf65e('0x13'));var config=require(_0xf65e('0x14'));var licenseUtil=require(_0xf65e('0x15'));var db=require(_0xf65e('0x16'))['db'];function respondWithStatusCode(_0x335e1c,_0x18e00e){_0x18e00e=_0x18e00e||0xcc;return function(_0x40f441){if(_0x40f441){return _0x335e1c['sendStatus'](_0x18e00e);}return _0x335e1c[_0xf65e('0x17')](_0x18e00e)['end']();};}function respondWithResult(_0x5c268b,_0x590913){_0x590913=_0x590913||0xc8;return function(_0x2976f9){if(_0x2976f9){return _0x5c268b[_0xf65e('0x17')](_0x590913)[_0xf65e('0x18')](_0x2976f9);}};}function respondWithFilteredResult(_0x4492c2,_0x4db927){return function(_0x2fe71c){if(_0x2fe71c){var _0x7ffa6c=typeof _0x4db927[_0xf65e('0x19')]==='undefined'&&typeof _0x4db927[_0xf65e('0x1a')]===_0xf65e('0x1b');var _0x3b2fbd=_0x2fe71c[_0xf65e('0x1c')];var _0x3b3005=_0x7ffa6c?0x0:_0x4db927[_0xf65e('0x19')];var _0x3a9b95=_0x7ffa6c?_0x2fe71c[_0xf65e('0x1c')]:_0x4db927[_0xf65e('0x19')]+_0x4db927['limit'];var _0x2656a4;if(_0x3a9b95>=_0x3b2fbd){_0x3a9b95=_0x3b2fbd;_0x2656a4=0xc8;}else{_0x2656a4=0xce;}_0x4492c2[_0xf65e('0x17')](_0x2656a4);return _0x4492c2[_0xf65e('0x1d')](_0xf65e('0x1e'),_0x3b3005+'-'+_0x3a9b95+'/'+_0x3b2fbd)[_0xf65e('0x18')](_0x2fe71c);}return null;};}function patchUpdates(_0x42cfe7){return function(_0x33c342){try{jsonpatch['apply'](_0x33c342,_0x42cfe7,!![]);}catch(_0x33bcb5){return BPromise[_0xf65e('0x1f')](_0x33bcb5);}return _0x33c342[_0xf65e('0x20')]();};}function saveUpdates(_0x21e557,_0x2504f9){return function(_0x34860d){if(_0x34860d){return _0x34860d[_0xf65e('0x21')](_0x21e557)['then'](function(_0x170862){return _0x170862;});}return null;};}function removeEntity(_0x4bb6af,_0x322dd){return function(_0x5c276f){if(_0x5c276f){return _0x5c276f[_0xf65e('0x22')]()[_0xf65e('0x23')](function(){_0x4bb6af[_0xf65e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f55bd,_0x14def6){return function(_0x3e50e1){if(!_0x3e50e1){_0x5f55bd[_0xf65e('0x24')](0x194);}return _0x3e50e1;};}function handleError(_0x2c2409,_0x5df028){_0x5df028=_0x5df028||0x1f4;return function(_0x3a3f6d){logger[_0xf65e('0x25')](_0x3a3f6d['stack']);if(_0x3a3f6d['name']){delete _0x3a3f6d[_0xf65e('0x26')];}_0x2c2409[_0xf65e('0x17')](_0x5df028)[_0xf65e('0x27')](_0x3a3f6d);};}exports[_0xf65e('0x28')]=function(_0x2904b7,_0x38f64e){var _0x9108ca={},_0x4fc222={},_0x324e8c={'count':0x0,'rows':[]};var _0xe96657=_[_0xf65e('0x29')](db[_0xf65e('0x2a')][_0xf65e('0x2b')],function(_0x219694){return{'name':_0x219694[_0xf65e('0x2c')],'type':_0x219694[_0xf65e('0x2d')][_0xf65e('0x2e')]};});_0x4fc222['model']=_[_0xf65e('0x29')](_0xe96657,_0xf65e('0x26'));_0x4fc222[_0xf65e('0x2f')]=_[_0xf65e('0x30')](_0x2904b7[_0xf65e('0x2f')]);_0x4fc222[_0xf65e('0x31')]=_[_0xf65e('0x32')](_0x4fc222[_0xf65e('0x33')],_0x4fc222[_0xf65e('0x2f')]);_0x9108ca[_0xf65e('0x34')]=_[_0xf65e('0x32')](_0x4fc222[_0xf65e('0x33')],qs['fields'](_0x2904b7[_0xf65e('0x2f')][_0xf65e('0x35')]));_0x9108ca[_0xf65e('0x34')]=_0x9108ca[_0xf65e('0x34')]['length']?_0x9108ca['attributes']:_0x4fc222[_0xf65e('0x33')];if(!_0x2904b7[_0xf65e('0x2f')][_0xf65e('0x36')](_0xf65e('0x37'))){_0x9108ca[_0xf65e('0x1a')]=qs[_0xf65e('0x1a')](_0x2904b7[_0xf65e('0x2f')][_0xf65e('0x1a')]);_0x9108ca[_0xf65e('0x19')]=qs['offset'](_0x2904b7['query'][_0xf65e('0x19')]);}_0x9108ca[_0xf65e('0x38')]=qs[_0xf65e('0x39')](_0x2904b7['query'][_0xf65e('0x39')]);_0x9108ca[_0xf65e('0x3a')]=qs[_0xf65e('0x31')](_['pick'](_0x2904b7[_0xf65e('0x2f')],_0x4fc222[_0xf65e('0x31')]),_0xe96657);if(_0x2904b7[_0xf65e('0x2f')][_0xf65e('0x3b')]){_0x9108ca['where']=_[_0xf65e('0x3c')](_0x9108ca['where'],{'$or':_[_0xf65e('0x29')](_0xe96657,function(_0x139163){if(_0x139163[_0xf65e('0x2d')]!==_0xf65e('0x3d')){var _0x262d97={};_0x262d97[_0x139163[_0xf65e('0x26')]]={'$like':'%'+_0x2904b7[_0xf65e('0x2f')][_0xf65e('0x3b')]+'%'};return _0x262d97;}})});}_0x9108ca=_[_0xf65e('0x3c')]({},_0x9108ca,_0x2904b7[_0xf65e('0x3e')]);var _0x189b8c={'where':_0x9108ca[_0xf65e('0x3a')]};return db[_0xf65e('0x2a')][_0xf65e('0x1c')](_0x189b8c)[_0xf65e('0x23')](function(_0x2ee7db){_0x324e8c[_0xf65e('0x1c')]=_0x2ee7db;if(_0x2904b7[_0xf65e('0x2f')][_0xf65e('0x3f')]){_0x9108ca['include']=[{'all':!![]}];}return db[_0xf65e('0x2a')]['findAll'](_0x9108ca);})[_0xf65e('0x23')](function(_0x4fd2cb){_0x324e8c[_0xf65e('0x40')]=_0x4fd2cb;return _0x324e8c;})[_0xf65e('0x23')](respondWithFilteredResult(_0x38f64e,_0x9108ca))[_0xf65e('0x41')](handleError(_0x38f64e,null));};exports[_0xf65e('0x42')]=function(_0x4ad97d,_0x56d48b){var _0x46d3d6={'raw':!![],'where':{'id':_0x4ad97d[_0xf65e('0x43')]['id']}},_0x641b69={};_0x641b69[_0xf65e('0x33')]=_[_0xf65e('0x30')](db[_0xf65e('0x2a')]['rawAttributes']);_0x641b69[_0xf65e('0x2f')]=_[_0xf65e('0x30')](_0x4ad97d[_0xf65e('0x2f')]);_0x641b69[_0xf65e('0x31')]=_[_0xf65e('0x32')](_0x641b69[_0xf65e('0x33')],_0x641b69[_0xf65e('0x2f')]);_0x46d3d6['attributes']=_[_0xf65e('0x32')](_0x641b69[_0xf65e('0x33')],qs[_0xf65e('0x35')](_0x4ad97d[_0xf65e('0x2f')]['fields']));_0x46d3d6[_0xf65e('0x34')]=_0x46d3d6[_0xf65e('0x34')][_0xf65e('0x44')]?_0x46d3d6['attributes']:_0x641b69[_0xf65e('0x33')];if(_0x4ad97d[_0xf65e('0x2f')][_0xf65e('0x3f')]){_0x46d3d6[_0xf65e('0x45')]=[{'all':!![]}];}_0x46d3d6=_[_0xf65e('0x3c')]({},_0x46d3d6,_0x4ad97d['options']);return db[_0xf65e('0x2a')][_0xf65e('0x46')](_0x46d3d6)['then'](handleEntityNotFound(_0x56d48b,null))[_0xf65e('0x23')](respondWithResult(_0x56d48b,null))['catch'](handleError(_0x56d48b,null));};exports[_0xf65e('0x47')]=function(_0x298053,_0x2ca8cd){return db[_0xf65e('0x2a')][_0xf65e('0x47')](_0x298053[_0xf65e('0x48')],{})[_0xf65e('0x23')](respondWithResult(_0x2ca8cd,0xc9))[_0xf65e('0x41')](handleError(_0x2ca8cd,null));};exports['update']=function(_0x4265bf,_0x5762a8){if(_0x4265bf[_0xf65e('0x48')]['id']){delete _0x4265bf['body']['id'];}return db[_0xf65e('0x2a')][_0xf65e('0x46')]({'where':{'id':_0x4265bf['params']['id']}})[_0xf65e('0x23')](handleEntityNotFound(_0x5762a8,null))[_0xf65e('0x23')](saveUpdates(_0x4265bf[_0xf65e('0x48')],null))[_0xf65e('0x23')](respondWithResult(_0x5762a8,null))['catch'](handleError(_0x5762a8,null));};exports['destroy']=function(_0x391d45,_0x203f9f){return db[_0xf65e('0x2a')][_0xf65e('0x46')]({'where':{'id':_0x391d45['params']['id']}})[_0xf65e('0x23')](handleEntityNotFound(_0x203f9f,null))[_0xf65e('0x23')](removeEntity(_0x203f9f,null))[_0xf65e('0x41')](handleError(_0x203f9f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 24e4047..22e7039 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 _0x68ee=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x68ee,0x83));var _0xe68e=function(_0x2ba365,_0x904db1){_0x2ba365=_0x2ba365-0x0;var _0x2920ab=_0x68ee[_0x2ba365];return _0x2920ab;};'use strict';var _=require('lodash');var util=require(_0xe68e('0x0'));var logger=require(_0xe68e('0x1'))('api');var moment=require(_0xe68e('0x2'));var BPromise=require(_0xe68e('0x3'));var rp=require(_0xe68e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe68e('0x5'));var attributes=require(_0xe68e('0x6'));module['exports']=function(_0x498865,_0x590b6e){return _0x498865[_0xe68e('0x7')](_0xe68e('0x8'),attributes,{'tableName':_0xe68e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe68e('0xa'),'collate':_0xe68e('0xb')});}; \ No newline at end of file +var _0xca18=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelApplication'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xca18,0xb7));var _0x8ca1=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0xca18[_0xbd3a05];return _0x101f90;};'use strict';var _=require(_0x8ca1('0x0'));var util=require(_0x8ca1('0x1'));var logger=require(_0x8ca1('0x2'))(_0x8ca1('0x3'));var moment=require(_0x8ca1('0x4'));var BPromise=require(_0x8ca1('0x5'));var rp=require(_0x8ca1('0x6'));var fs=require('fs');var path=require(_0x8ca1('0x7'));var rimraf=require(_0x8ca1('0x8'));var config=require(_0x8ca1('0x9'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x34188e,_0x52a6bb){return _0x34188e[_0x8ca1('0xa')](_0x8ca1('0xb'),attributes,{'tableName':_0x8ca1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ca1('0xd'),'collate':_0x8ca1('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5b5d802..24c64c5 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 _0xb33b=['request\x20sent','result','UpdateOpenchannelApplication','options','raw','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x110e42,_0x134a3e){var _0x343f58=function(_0x58f189){while(--_0x58f189){_0x110e42['push'](_0x110e42['shift']());}};_0x343f58(++_0x134a3e);}(_0xb33b,0xa9));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb33('0x0'));var util=require(_0xbb33('0x1'));var moment=require(_0xbb33('0x2'));var BPromise=require(_0xbb33('0x3'));var rs=require(_0xbb33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb33('0x6'))(_0xbb33('0x7'));var config=require(_0xbb33('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb33('0x9')][_0xbb33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x293feb,_0x53989f,_0x5673d0){return new BPromise(function(_0xc87d35,_0x177aed){return client[_0xbb33('0xb')](_0x293feb,_0x5673d0)[_0xbb33('0xc')](function(_0x14e1f9){logger[_0xbb33('0xd')](_0xbb33('0xe'),_0x53989f,'request\x20sent');logger[_0xbb33('0xf')](_0xbb33('0x10'),_0x53989f,'request\x20sent',JSON[_0xbb33('0x11')](_0x14e1f9));if(_0x14e1f9[_0xbb33('0x12')]){if(_0x14e1f9[_0xbb33('0x12')]['code']===0x1f4){logger[_0xbb33('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x53989f,_0x14e1f9[_0xbb33('0x12')][_0xbb33('0x13')]);return _0x177aed(_0x14e1f9[_0xbb33('0x12')][_0xbb33('0x13')]);}logger[_0xbb33('0x12')](_0xbb33('0xe'),_0x53989f,_0x14e1f9[_0xbb33('0x12')][_0xbb33('0x13')]);return _0xc87d35(_0x14e1f9[_0xbb33('0x12')]['message']);}else{logger[_0xbb33('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x53989f,_0xbb33('0x14'));_0xc87d35(_0x14e1f9[_0xbb33('0x15')][_0xbb33('0x13')]);}})['catch'](function(_0x43f326){logger['error'](_0xbb33('0xe'),_0x53989f,_0x43f326);_0x177aed(_0x43f326);});});}exports[_0xbb33('0x16')]=function(_0x212d9a){var _0xcda8ab=this;return new Promise(function(_0x463d93,_0x1e6c17){return db['OpenchannelApplication']['update'](_0x212d9a['body'],{'raw':_0x212d9a[_0xbb33('0x17')]?_0x212d9a[_0xbb33('0x17')][_0xbb33('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212d9a[_0xbb33('0x17')]?_0x212d9a[_0xbb33('0x17')]['where']||null:null,'attributes':_0x212d9a[_0xbb33('0x17')]?_0x212d9a[_0xbb33('0x17')][_0xbb33('0x19')]||null:null,'limit':_0x212d9a[_0xbb33('0x17')]?_0x212d9a[_0xbb33('0x17')]['limit']||null:null})[_0xbb33('0xc')](function(_0x3ee5bd){logger['info'](_0xbb33('0x16'),_0x212d9a);logger[_0xbb33('0xf')]('UpdateOpenchannelApplication',_0x212d9a,JSON[_0xbb33('0x11')](_0x3ee5bd));_0x463d93(_0x3ee5bd);})[_0xbb33('0x1a')](function(_0x3585c9){logger[_0xbb33('0x12')]('UpdateOpenchannelApplication',_0x3585c9[_0xbb33('0x13')],_0x212d9a);_0x1e6c17(_0xcda8ab[_0xbb33('0x12')](0x1f4,_0x3585c9[_0xbb33('0x13')]));});});}; \ No newline at end of file +var _0xdfc3=['request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','limit','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xdfc3,0x148));var _0x3dfc=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xdfc3[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require(_0x3dfc('0x0'));var moment=require('moment');var BPromise=require(_0x3dfc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dfc('0x2'))['db'];var utils=require(_0x3dfc('0x3'));var logger=require(_0x3dfc('0x4'))(_0x3dfc('0x5'));var config=require('../../config/environment');var jayson=require(_0x3dfc('0x6'));var client=jayson[_0x3dfc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfeb2a1,_0x31917c,_0x5aa17b){return new BPromise(function(_0x92fcc7,_0x240738){return client[_0x3dfc('0x8')](_0xfeb2a1,_0x5aa17b)[_0x3dfc('0x9')](function(_0x5b3926){logger['info'](_0x3dfc('0xa'),_0x31917c,'request\x20sent');logger[_0x3dfc('0xb')](_0x3dfc('0xc'),_0x31917c,_0x3dfc('0xd'),JSON[_0x3dfc('0xe')](_0x5b3926));if(_0x5b3926['error']){if(_0x5b3926[_0x3dfc('0xf')][_0x3dfc('0x10')]===0x1f4){logger[_0x3dfc('0xf')](_0x3dfc('0xa'),_0x31917c,_0x5b3926[_0x3dfc('0xf')][_0x3dfc('0x11')]);return _0x240738(_0x5b3926[_0x3dfc('0xf')][_0x3dfc('0x11')]);}logger[_0x3dfc('0xf')](_0x3dfc('0xa'),_0x31917c,_0x5b3926['error'][_0x3dfc('0x11')]);return _0x92fcc7(_0x5b3926['error'][_0x3dfc('0x11')]);}else{logger[_0x3dfc('0x12')](_0x3dfc('0xa'),_0x31917c,_0x3dfc('0xd'));_0x92fcc7(_0x5b3926[_0x3dfc('0x13')][_0x3dfc('0x11')]);}})[_0x3dfc('0x14')](function(_0x2882ed){logger[_0x3dfc('0xf')](_0x3dfc('0xa'),_0x31917c,_0x2882ed);_0x240738(_0x2882ed);});});}exports[_0x3dfc('0x15')]=function(_0x175a9d){var _0x9df9d0=this;return new Promise(function(_0x2c5123,_0x5e3a74){return db['OpenchannelApplication'][_0x3dfc('0x16')](_0x175a9d[_0x3dfc('0x17')],{'raw':_0x175a9d[_0x3dfc('0x18')]?_0x175a9d[_0x3dfc('0x18')][_0x3dfc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175a9d['options']?_0x175a9d[_0x3dfc('0x18')][_0x3dfc('0x1a')]||null:null,'attributes':_0x175a9d[_0x3dfc('0x18')]?_0x175a9d[_0x3dfc('0x18')]['attributes']||null:null,'limit':_0x175a9d[_0x3dfc('0x18')]?_0x175a9d['options'][_0x3dfc('0x1b')]||null:null})['then'](function(_0x4023af){logger[_0x3dfc('0x12')](_0x3dfc('0x15'),_0x175a9d);logger[_0x3dfc('0xb')](_0x3dfc('0x15'),_0x175a9d,JSON[_0x3dfc('0xe')](_0x4023af));_0x2c5123(_0x4023af);})[_0x3dfc('0x14')](function(_0x5df540){logger[_0x3dfc('0xf')](_0x3dfc('0x15'),_0x5df540[_0x3dfc('0x11')],_0x175a9d);_0x5e3a74(_0x9df9d0['error'](0x1f4,_0x5df540[_0x3dfc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ca7f7a5..25bfd78 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 _0x3d93=['../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','delete','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x114c9b,_0x201968){var _0x593ef9=function(_0x57de26){while(--_0x57de26){_0x114c9b['push'](_0x114c9b['shift']());}};_0x593ef9(++_0x201968);}(_0x3d93,0xf1));var _0x33d9=function(_0x37c3ce,_0xcd551a){_0x37c3ce=_0x37c3ce-0x0;var _0x2d13d9=_0x3d93[_0x37c3ce];return _0x2d13d9;};'use strict';var multer=require(_0x33d9('0x0'));var util=require(_0x33d9('0x1'));var path=require('path');var timeout=require(_0x33d9('0x2'));var express=require(_0x33d9('0x3'));var router=express['Router']();var fs_extra=require(_0x33d9('0x4'));var auth=require(_0x33d9('0x5'));var interaction=require(_0x33d9('0x6'));var config=require(_0x33d9('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x33d9('0x8')](),controller[_0x33d9('0x9')]);router[_0x33d9('0xa')](_0x33d9('0xb'),auth['isAuthenticated'](),controller[_0x33d9('0xc')]);router[_0x33d9('0xa')]('/:id',auth[_0x33d9('0x8')](),controller[_0x33d9('0xd')]);router[_0x33d9('0xa')](_0x33d9('0xe'),auth[_0x33d9('0x8')](),controller[_0x33d9('0xf')]);router[_0x33d9('0xa')](_0x33d9('0x10'),auth[_0x33d9('0x8')](),controller[_0x33d9('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x33d9('0x12')](_0x33d9('0xe'),auth[_0x33d9('0x8')](),controller[_0x33d9('0x13')]);router[_0x33d9('0x12')](_0x33d9('0x14'),auth[_0x33d9('0x8')](),interaction[_0x33d9('0x15')](_0x33d9('0x16'),_0x33d9('0x17')),controller[_0x33d9('0x18')]);router[_0x33d9('0x19')](_0x33d9('0x1a'),auth[_0x33d9('0x8')](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller['update']);router[_0x33d9('0x1b')](_0x33d9('0x1a'),auth[_0x33d9('0x8')](),interaction['tracked']('openchannel','openchannelinteraction:destroy'),controller[_0x33d9('0x1c')]);router['delete'](_0x33d9('0x14'),auth[_0x33d9('0x8')](),controller[_0x33d9('0x1d')]);module[_0x33d9('0x1e')]=router; \ No newline at end of file +var _0xd0f3=['describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0xd0f3,0x82));var _0x3d0f=function(_0x28e919,_0x145939){_0x28e919=_0x28e919-0x0;var _0x692b7e=_0xd0f3[_0x28e919];return _0x692b7e;};'use strict';var multer=require(_0x3d0f('0x0'));var util=require(_0x3d0f('0x1'));var path=require(_0x3d0f('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d0f('0x3'));var router=express[_0x3d0f('0x4')]();var fs_extra=require(_0x3d0f('0x5'));var auth=require(_0x3d0f('0x6'));var interaction=require(_0x3d0f('0x7'));var config=require(_0x3d0f('0x8'));var controller=require(_0x3d0f('0x9'));router[_0x3d0f('0xa')]('/',auth[_0x3d0f('0xb')](),controller[_0x3d0f('0xc')]);router[_0x3d0f('0xa')](_0x3d0f('0xd'),auth[_0x3d0f('0xb')](),controller[_0x3d0f('0xe')]);router[_0x3d0f('0xa')](_0x3d0f('0xf'),auth['isAuthenticated'](),controller[_0x3d0f('0x10')]);router[_0x3d0f('0xa')](_0x3d0f('0x11'),auth['isAuthenticated'](),controller[_0x3d0f('0x12')]);router[_0x3d0f('0xa')]('/:id/download',auth[_0x3d0f('0xb')](),controller[_0x3d0f('0x13')]);router['post']('/',auth[_0x3d0f('0xb')](),controller[_0x3d0f('0x14')]);router[_0x3d0f('0x15')](_0x3d0f('0x11'),auth['isAuthenticated'](),controller[_0x3d0f('0x16')]);router[_0x3d0f('0x15')](_0x3d0f('0x17'),auth[_0x3d0f('0xb')](),interaction[_0x3d0f('0x18')](_0x3d0f('0x19'),_0x3d0f('0x1a')),controller[_0x3d0f('0x1b')]);router[_0x3d0f('0x1c')](_0x3d0f('0xf'),auth[_0x3d0f('0xb')](),interaction[_0x3d0f('0x18')]('openchannel',_0x3d0f('0x1d')),controller[_0x3d0f('0x1e')]);router[_0x3d0f('0x1f')](_0x3d0f('0xf'),auth['isAuthenticated'](),interaction[_0x3d0f('0x18')]('openchannel',_0x3d0f('0x20')),controller[_0x3d0f('0x21')]);router[_0x3d0f('0x1f')](_0x3d0f('0x17'),auth[_0x3d0f('0xb')](),controller[_0x3d0f('0x22')]);module[_0x3d0f('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 6e6675f..cb092d0 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 _0x7070=['STRING','DATE','ENUM','out','BOOLEAN'];(function(_0x5871af,_0x28b139){var _0x15a31d=function(_0x4899c1){while(--_0x4899c1){_0x5871af['push'](_0x5871af['shift']());}};_0x15a31d(++_0x28b139);}(_0x7070,0xa4));var _0x0707=function(_0x4b2954,_0x23fca4){_0x4b2954=_0x4b2954-0x0;var _0x4c4cc8=_0x7070[_0x4b2954];return _0x4c4cc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x0707('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0707('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0707('0x1')]},'note':{'type':Sequelize[_0x0707('0x1')]},'read1stAt':{'type':Sequelize[_0x0707('0x2')]},'threadId':{'type':Sequelize[_0x0707('0x1')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x0707('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0707('0x3')]('in',_0x0707('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0707('0x1')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xacb8=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x5a75e7,_0x3ad506){var _0x15c695=function(_0x4ba933){while(--_0x4ba933){_0x5a75e7['push'](_0x5a75e7['shift']());}};_0x15c695(++_0x3ad506);}(_0xacb8,0x119));var _0x8acb=function(_0x20a547,_0x222692){_0x20a547=_0x20a547-0x0;var _0x58fb1d=_0xacb8[_0x20a547];return _0x58fb1d;};'use strict';var Sequelize=require(_0x8acb('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8acb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8acb('0x2')]},'disposition':{'type':Sequelize[_0x8acb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8acb('0x3')]},'note':{'type':Sequelize[_0x8acb('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8acb('0x3')]},'externalUrl':{'type':Sequelize[_0x8acb('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8acb('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8acb('0x4')]('in',_0x8acb('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8acb('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 25d7536..4106869 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 _0x380e=['i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','push','all','show','params','include','create','update','body','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','hasOwnProperty','OpenchannelInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','setTags','omit','spread','Tag','findAll','color','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','System','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','pick','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','agent','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0x48b308,_0xc424ea){var _0x3ea12e=function(_0x378588){while(--_0x378588){_0x48b308['push'](_0x48b308['shift']());}};_0x3ea12e(++_0xc424ea);}(_0x380e,0x150));var _0xe380=function(_0x1925a5,_0xcd2508){_0x1925a5=_0x1925a5-0x0;var _0x51d6b9=_0x380e[_0x1925a5];return _0x51d6b9;};'use strict';var emlformat=require(_0xe380('0x0'));var rimraf=require(_0xe380('0x1'));var zipdir=require(_0xe380('0x2'));var jsonpatch=require(_0xe380('0x3'));var rp=require(_0xe380('0x4'));var moment=require('moment');var BPromise=require(_0xe380('0x5'));var Mustache=require(_0xe380('0x6'));var util=require(_0xe380('0x7'));var path=require('path');var sox=require(_0xe380('0x8'));var csv=require(_0xe380('0x9'));var ejs=require(_0xe380('0xa'));var fs=require('fs');var fs_extra=require(_0xe380('0xb'));var _=require('lodash');var squel=require(_0xe380('0xc'));var crypto=require(_0xe380('0xd'));var jsforce=require(_0xe380('0xe'));var deskjs=require(_0xe380('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe380('0x10'));var Papa=require(_0xe380('0x11'));var Redis=require(_0xe380('0x12'));var authService=require(_0xe380('0x13'));var qs=require(_0xe380('0x14'));var as=require(_0xe380('0x15'));var pdf=require(_0xe380('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe380('0x17'))(_0xe380('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe380('0x19'))['db'];config[_0xe380('0x1a')]=_['defaults'](config[_0xe380('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe380('0x1b'))(new Redis(config[_0xe380('0x1a')]));require(_0xe380('0x1c'))['register'](socket);function respondWithStatusCode(_0x59a8ac,_0x3cc92a){_0x3cc92a=_0x3cc92a||0xcc;return function(_0x1cca0a){if(_0x1cca0a){return _0x59a8ac[_0xe380('0x1d')](_0x3cc92a);}return _0x59a8ac['status'](_0x3cc92a)[_0xe380('0x1e')]();};}function respondWithResult(_0x26cffc,_0x397d9b){_0x397d9b=_0x397d9b||0xc8;return function(_0x4b7c2d){if(_0x4b7c2d){return _0x26cffc[_0xe380('0x1f')](_0x397d9b)[_0xe380('0x20')](_0x4b7c2d);}};}function respondWithFilteredResult(_0x273e46,_0x2de90c){return function(_0x6e6c89){if(_0x6e6c89){var _0x2b4a9a=typeof _0x2de90c[_0xe380('0x21')]==='undefined'&&typeof _0x2de90c[_0xe380('0x22')]===_0xe380('0x23');var _0x3e8c75=_0x6e6c89[_0xe380('0x24')];var _0x273019=_0x2b4a9a?0x0:_0x2de90c['offset'];var _0x1cead7=_0x2b4a9a?_0x6e6c89[_0xe380('0x24')]:_0x2de90c[_0xe380('0x21')]+_0x2de90c[_0xe380('0x22')];var _0x195cb4;if(_0x1cead7>=_0x3e8c75){_0x1cead7=_0x3e8c75;_0x195cb4=0xc8;}else{_0x195cb4=0xce;}_0x273e46[_0xe380('0x1f')](_0x195cb4);return _0x273e46[_0xe380('0x25')]('Content-Range',_0x273019+'-'+_0x1cead7+'/'+_0x3e8c75)[_0xe380('0x20')](_0x6e6c89);}return null;};}function patchUpdates(_0x4c4505){return function(_0x57272b){try{jsonpatch[_0xe380('0x26')](_0x57272b,_0x4c4505,!![]);}catch(_0x27a61b){return BPromise['reject'](_0x27a61b);}return _0x57272b['save']();};}function saveUpdates(_0xa047bd,_0x59f916){return function(_0x1bf6cc){if(_0x1bf6cc){return _0x1bf6cc['update'](_0xa047bd)[_0xe380('0x27')](function(_0x4c6212){return _0x4c6212;});}return null;};}function removeEntity(_0x348e28,_0x182b9e){return function(_0x36b918){if(_0x36b918){return _0x36b918['destroy']()['then'](function(){_0x348e28[_0xe380('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df5a3,_0x1f3c16){return function(_0x26c580){if(!_0x26c580){_0x2df5a3[_0xe380('0x1d')](0x194);}return _0x26c580;};}function handleError(_0x194d50,_0x115146){_0x115146=_0x115146||0x1f4;return function(_0x4b4ed3){logger[_0xe380('0x28')](_0x4b4ed3[_0xe380('0x29')]);if(_0x4b4ed3[_0xe380('0x2a')]){delete _0x4b4ed3[_0xe380('0x2a')];}_0x194d50[_0xe380('0x1f')](_0x115146)[_0xe380('0x2b')](_0x4b4ed3);};}function getInteractionUsers(_0x1335ae,_0x27a209){return new BPromise(function(_0xa14c4e,_0x564f63){try{if(_0x27a209[_0x1335ae['id']]){_0x1335ae[_0xe380('0x2c')]=_['map'](_0x27a209[_0x1335ae['id']],function(_0x2677e3){return{'id':_0x2677e3['id'],'fullname':_0x2677e3[_0xe380('0x2d')]};});}}catch(_0x628cfb){_0x564f63(_0x628cfb);}_0xa14c4e(_0x1335ae);});}function getInteractionTags(_0x4b7e84,_0x336246){return new BPromise(function(_0x3ba807,_0x3bbd50){try{if(_0x4b7e84[_0xe380('0x2e')]){_0x4b7e84[_0xe380('0x2f')]=[];_0x4b7e84[_0xe380('0x2e')][_0xe380('0x30')](',')[_0xe380('0x31')](function(_0xcea280){_0x4b7e84['Tags']['push'](_0x336246[_0xcea280]);});}delete _0x4b7e84[_0xe380('0x2e')];}catch(_0x26c7e6){_0x3bbd50(_0x26c7e6);}_0x3ba807(_0x4b7e84);});}function updateOpenchannelInteraction(_0x246c62,_0x3df7b8,_0x4d89ec){return new BPromise(function(_0x17d97a,_0x27b6d2){return getInteractionUsers(_0x246c62,_0x4d89ec)['then'](function(_0x384d95){return getInteractionTags(_0x384d95,_0x3df7b8);})[_0xe380('0x27')](function(_0x3955cb){return getStateInteraction(_0x3955cb);})[_0xe380('0x27')](function(_0x2115f6){_0x17d97a(_0x2115f6);})[_0xe380('0x32')](function(_0x182155){_0x27b6d2(_0x182155);});});}function getStateInteraction(_0x347e11){return new BPromise(function(_0x4db177){_0x347e11[_0xe380('0x33')]=0x0;_0x347e11[_0xe380('0x34')]=0x0;_0x347e11[_0xe380('0x35')]=0x0;_0x347e11[_0xe380('0x36')]=0x0;_0x347e11[_0xe380('0x37')]=0x0;if(!_0x347e11['closed']&&!_0x347e11['UserId']){_0x347e11['waiting']+=0x1;}if(!_0x347e11[_0xe380('0x38')]&&_0x347e11[_0xe380('0x39')]){_0x347e11[_0xe380('0x34')]+=0x1;if(_0x347e11[_0xe380('0x33')]){_0x347e11[_0xe380('0x33')]-=0x1;}}if(_0x347e11[_0xe380('0x38')]&&_0x347e11[_0xe380('0x39')]){_0x347e11[_0xe380('0x35')]+=0x1;if(_0x347e11[_0xe380('0x34')]){_0x347e11['talking']-=0x1;}}if(_0x347e11[_0xe380('0x38')]&&!_0x347e11[_0xe380('0x39')]){_0x347e11[_0xe380('0x36')]+=0x1;if(_0x347e11[_0xe380('0x33')]){_0x347e11[_0xe380('0x33')]-=0x1;}}_0x347e11['total']+=0x1;_0x4db177(_0x347e11);});}exports[_0xe380('0x3a')]=function(_0x52cc42,_0x35dce8){var _0x3d7842={},_0x5a1626={},_0x3961f8={'count':0x0,'rows':[]};var _0x56dfa9=_[_0xe380('0x3b')](db[_0xe380('0x3c')][_0xe380('0x3d')],function(_0x1a7ac3){return{'name':_0x1a7ac3[_0xe380('0x3e')],'type':_0x1a7ac3[_0xe380('0x3f')]['key']};});_0x5a1626[_0xe380('0x40')]=_[_0xe380('0x3b')](_0x56dfa9,_0xe380('0x2a'));_0x5a1626['query']=_[_0xe380('0x41')](_0x52cc42['query']);_0x5a1626[_0xe380('0x42')]=_[_0xe380('0x43')](_0x5a1626['model'],_0x5a1626[_0xe380('0x44')]);_0x3d7842[_0xe380('0x45')]=_['intersection'](_0x5a1626[_0xe380('0x40')],qs[_0xe380('0x46')](_0x52cc42[_0xe380('0x44')][_0xe380('0x46')]));_0x3d7842[_0xe380('0x45')]=_0x3d7842[_0xe380('0x45')]['length']?_0x3d7842[_0xe380('0x45')]:_0x5a1626[_0xe380('0x40')];if(!_0x52cc42['query']['hasOwnProperty'](_0xe380('0x47'))){_0x3d7842[_0xe380('0x22')]=qs[_0xe380('0x22')](_0x52cc42['query']['limit']);_0x3d7842[_0xe380('0x21')]=qs[_0xe380('0x21')](_0x52cc42[_0xe380('0x44')][_0xe380('0x21')]);}_0x3d7842['order']=qs[_0xe380('0x48')](_0x52cc42['query'][_0xe380('0x48')]);_0x3d7842[_0xe380('0x49')]=qs['filters'](_[_0xe380('0x4a')](_0x52cc42['query'],_0x5a1626[_0xe380('0x42')]),_0x56dfa9);var _0x314f00=[];var _0x390fca=squel['select']()[_0xe380('0x4b')]('id')[_0xe380('0x4b')](_0xe380('0x2a'))[_0xe380('0x4b')]('color')[_0xe380('0x4c')](_0xe380('0x4d'));var _0x24c6f5=squel['select']()['field'](_0xe380('0x4e'))[_0xe380('0x4b')](_0xe380('0x4f'))[_0xe380('0x4b')](_0xe380('0x50'))[_0xe380('0x4c')]('user_has_openchannel_interactions','ui')[_0xe380('0x51')](_0xe380('0x52'),'u',_0xe380('0x53'));var _0x2e9dc2=squel[_0xe380('0x54')]()[_0xe380('0x4c')](_0xe380('0x55'),'i')[_0xe380('0x51')](_0xe380('0x56'),'c',_0xe380('0x57'))[_0xe380('0x51')](_0xe380('0x52'),'o',_0xe380('0x58'))[_0xe380('0x51')](_0xe380('0x59'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xe380('0x51')](_0xe380('0x5a'),'me',_0xe380('0x5b'))['left_join'](_0xe380('0x5c'),'it',_0xe380('0x5d'))[_0xe380('0x51')](_0xe380('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x2646b1=squel[_0xe380('0x5e')]();var _0x3c9da7=[];var _0x117bba=squel[_0xe380('0x5e')]();var _0x520ce7;if(_0x52cc42[_0xe380('0x44')][_0xe380('0x5f')]){_0x520ce7=as['parseSearch'](_0x52cc42[_0xe380('0x44')][_0xe380('0x5f')]);var _0x6d22f4=_0x520ce7[_0xe380('0x60')];for(var _0x21a0aa=0x0;_0x21a0aa<_0x520ce7[_0xe380('0x61')][_0xe380('0x62')];_0x21a0aa++){var _0x41ff74=_0x520ce7['conditions'][_0x21a0aa];var _0x50c37c='i';var _0x103f43=_[_0xe380('0x63')](_0x56dfa9,[_0xe380('0x2a'),_0x41ff74[_0xe380('0x4b')]]);if(!_0x103f43){switch(_0x41ff74[_0xe380('0x4b')]){case _0xe380('0x64'):if(_0x41ff74['value']==0x1){_0x2e9dc2[_0xe380('0x65')]('`'+_0x41ff74[_0xe380('0x4b')]+_0xe380('0x66'));}else{_0x2e9dc2[_0xe380('0x65')]('`'+_0x41ff74[_0xe380('0x4b')]+'`\x20>\x200');}break;case _0xe380('0x67'):if(_0x41ff74[_0xe380('0x68')]==='$substring'){if(_0x41ff74[_0xe380('0x69')][_0xe380('0x30')]('\x20')['length']>0x1){_0x2646b1[_0x6d22f4](_0xe380('0x6a'),qs[_0xe380('0x6b')](_0x41ff74[_0xe380('0x69')]),null);}else{var _0x3f3ccd='%'+_0x41ff74['value']+'%';_0x2646b1[_0x6d22f4](_0xe380('0x6c'),_0x3f3ccd,_0x3f3ccd,_0x3f3ccd);}}else{_0x103f43=_[_0xe380('0x63')](_0x56dfa9,[_0xe380('0x2a'),_0xe380('0x6d')]);_0x41ff74['field']=_0xe380('0x6d');_0xe0c14=as[_0xe380('0x6e')](_0x50c37c,_0x103f43[_0xe380('0x3f')],_0x41ff74);_0x2646b1[_0x6d22f4](_0xe0c14[_0xe380('0x6f')],_0xe0c14[_0xe380('0x69')]['start'],_0xe0c14['value'][_0xe380('0x1e')]);}break;case'Tag':var _0x2a3526=_0x41ff74[_0xe380('0x69')][_0xe380('0x30')](',')['map'](function(_0xc5128a){return Number(_0xc5128a);});_0x2a3526['forEach'](function(_0x3accfa){_0x117bba['or'](_0xe380('0x70'),'%,'+_0x3accfa+',%');});_0x3c9da7=_[_0xe380('0x71')](_0x3c9da7,_0x2a3526);break;case _0xe380('0x72'):if(_0x41ff74['operator']==='$substring'){_0x2646b1[_0x6d22f4](_0xe380('0x73'),'%'+_0x41ff74[_0xe380('0x69')]+'%',null);}else{_0x103f43=_[_0xe380('0x63')](_0x56dfa9,[_0xe380('0x2a'),_0xe380('0x39')]);_0x41ff74[_0xe380('0x4b')]='UserId';_0xe0c14=as[_0xe380('0x6e')](_0x50c37c,_0x103f43[_0xe380('0x3f')],_0x41ff74);_0x2646b1[_0x6d22f4](_0xe0c14[_0xe380('0x6f')],_0xe0c14['value'][_0xe380('0x74')],_0xe0c14[_0xe380('0x69')]['end']);}break;case'body':_0xe0c14=as[_0xe380('0x6e')]('me',null,_0x41ff74);_0x2646b1[_0x6d22f4](_0xe0c14[_0xe380('0x6f')],_0xe0c14[_0xe380('0x69')][_0xe380('0x74')],_0xe0c14[_0xe380('0x69')][_0xe380('0x1e')]);break;}}else{var _0xe0c14=as[_0xe380('0x6e')](_0x50c37c,_0x103f43[_0xe380('0x3f')],_0x41ff74);_0x2646b1[_0x6d22f4](_0xe0c14['text'],_0xe0c14[_0xe380('0x69')][_0xe380('0x74')],_0xe0c14[_0xe380('0x69')][_0xe380('0x1e')]);}}}else{var _0x42ad83=_(_0x52cc42['query'])[_0xe380('0x41')]()[_0xe380('0x3b')](function(_0x4d2e7a){return _['some'](_0x56dfa9,[_0xe380('0x2a'),_0x4d2e7a])?_0x4d2e7a:undefined;})[_0xe380('0x75')]()[_0xe380('0x69')]();if(!_[_0xe380('0x76')](_0x42ad83)){_0x42ad83['forEach'](function(_0x459caa){if(_0x459caa===_0xe380('0x77')){_0x2e9dc2[_0xe380('0x49')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xe380('0x78')](_0x52cc42[_0xe380('0x44')][_0x459caa]));}else if(_0x459caa===_0xe380('0x79')){var _0x2668ac=JSON[_0xe380('0x7a')](_0x52cc42[_0xe380('0x44')][_0x459caa])[_0xe380('0x7b')];var _0x3b2d8e=JSON[_0xe380('0x7a')](_0x52cc42[_0xe380('0x44')][_0x459caa])[_0xe380('0x7c')];_0x2e9dc2[_0xe380('0x49')](_0xe380('0x7d'),_0x2668ac,_0x3b2d8e);}else{if(_0x52cc42['query'][_0x459caa]===_0xe380('0x7e')){_0x2e9dc2[_0xe380('0x49')]('i.'+_0x459caa+'\x20IS\x20NULL');}else{_0x2e9dc2[_0xe380('0x49')]('i.'+_0x459caa+_0xe380('0x7f'),_0x52cc42['query'][_0x459caa]);}}});}if(_0x52cc42[_0xe380('0x44')]['read']){if(_0x52cc42[_0xe380('0x44')]['read']==0x1){_0x2e9dc2[_0xe380('0x65')](_0xe380('0x80'));}else{_0x2e9dc2['having'](_0xe380('0x81'));}}if(_0x52cc42[_0xe380('0x44')][_0xe380('0x82')]){_0x3c9da7=_[_0xe380('0x83')](_0x52cc42[_0xe380('0x44')][_0xe380('0x82')])?_0x52cc42['query'][_0xe380('0x82')]:new Array(_0x52cc42[_0xe380('0x44')][_0xe380('0x82')]);_0x3c9da7[_0xe380('0x31')](function(_0x1208f1){_0x117bba['or'](_0xe380('0x70'),'%,'+_0x1208f1+',%');});}if(_0x52cc42[_0xe380('0x44')][_0xe380('0x84')]){var _0x46162f=_0x52cc42[_0xe380('0x44')]['filter']['replace']('\x5c','\x5c\x5c')[_0xe380('0x85')](/'/g,'\x27\x27');if(qs[_0xe380('0x86')](_0x46162f)){_0x2646b1['or'](_0xe380('0x87'),_0x46162f+'%');}else{_0x2646b1['or'](_0xe380('0x88'),qs['getFullTextValue'](_0x46162f))['or'](_0xe380('0x89'),_0x46162f+'%')['or'](_0xe380('0x8a'),_0x46162f+'%');}}}_0x2e9dc2[_0xe380('0x49')](_0x2646b1);_0x2e9dc2['group'](_0xe380('0x8b'));var _0x1758a8={'type':db[_0xe380('0x8c')]['QueryTypes'][_0xe380('0x8d')],'raw':!![]};var _0x1a6ddc=_0x2e9dc2[_0xe380('0x8e')]();_0x1a6ddc[_0xe380('0x4b')](_0xe380('0x8b'));_0x1a6ddc['field'](_0xe380('0x8f'),_0xe380('0x64'));if(_0x3d7842[_0xe380('0x90')]){_0x3d7842['order']['forEach'](function(_0x8d3c07){var _0x4bb1e1=_0x8d3c07[0x0]===_0xe380('0x91')?_0x8d3c07[0x0]:'i.'+_0x8d3c07[0x0];_0x2e9dc2[_0xe380('0x90')](_0x4bb1e1,_0x8d3c07[0x1]===_0xe380('0x92')?![]:!![]);});}if(!_[_0xe380('0x76')](_0x3c9da7)){_0x2e9dc2[_0xe380('0x65')](_0x117bba);_0x1a6ddc[_0xe380('0x49')](_0xe380('0x93'),_0x3c9da7);}BPromise[_0xe380('0x94')]()['then'](function(){if(!_0x520ce7){if(_0x52cc42[_0xe380('0x44')]['OpenchannelAccountId'])return;_0x1a6ddc[_0xe380('0x49')](_0xe380('0x95'));_0x2e9dc2[_0xe380('0x49')](_0xe380('0x95'));return;}if(_0x52cc42['user']['role']!=='agent')return;return _0x52cc42[_0xe380('0x96')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xe380('0x27')](function(_0x406393){if(_['isEmpty'](_0x406393)){_0x1a6ddc[_0xe380('0x49')](_0xe380('0x97'));_0x2e9dc2[_0xe380('0x49')](_0xe380('0x97'));}else{_0x1a6ddc[_0xe380('0x49')](_0xe380('0x98'),_['map'](_0x406393,'id'));_0x2e9dc2['where'](_0xe380('0x98'),_[_0xe380('0x3b')](_0x406393,'id'));}});})['then'](function(){if(_0x52cc42[_0xe380('0x96')][_0xe380('0x99')]===_0xe380('0x9a')&&!_0x520ce7&&!_0x52cc42[_0xe380('0x44')][_0xe380('0x77')])return[];return db[_0xe380('0x9b')][_0xe380('0x44')](_0x1a6ddc[_0xe380('0x9c')](),_0x1758a8);})[_0xe380('0x27')](function(_0x1864d2){_0x3961f8[_0xe380('0x24')]=_0x1864d2[_0xe380('0x62')];if(_0x3961f8['count']===0x0)return[];return db[_0xe380('0x9b')][_0xe380('0x44')](_0x390fca['toString'](),_0x1758a8)['then'](function(_0x1af892){_0x314f00=_[_0xe380('0x9d')](_0x1af892,'id');_0x1758a8=_['merge'](_0x1758a8,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52cc42[_0xe380('0x44')][_0xe380('0x46')]){_0x3d7842['attributes'][_0xe380('0x31')](function(_0x2ff669){_0x2e9dc2['field']('i.'+_0x2ff669);});}else{_0x2e9dc2[_0xe380('0x4b')](_0xe380('0x8f'),_0xe380('0x64'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0x9e'),_0xe380('0x9f'));_0x2e9dc2['field']('a.mandatoryDisposition',_0xe380('0xa0'));_0x2e9dc2['field'](_0xe380('0xa1'),_0xe380('0x91'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xa2'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xa3'),'Contact.firstName');_0x2e9dc2['field'](_0xe380('0xa4'),_0xe380('0xa5'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xa6'),_0xe380('0xa7'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xa8'),_0xe380('0xa9'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xaa'),_0xe380('0xab'));_0x2e9dc2['field'](_0xe380('0xac'),_0xe380('0xad'));_0x2e9dc2[_0xe380('0x4b')]('o.fullname',_0xe380('0xae'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xaf'),_0xe380('0xb0'));_0x2e9dc2[_0xe380('0x4b')](_0xe380('0xb1'),_0xe380('0x2e'));}if(_0x3d7842[_0xe380('0x22')])_0x2e9dc2[_0xe380('0x22')](_0x3d7842['limit']);if(_0x3d7842[_0xe380('0x21')])_0x2e9dc2[_0xe380('0x21')](_0x3d7842[_0xe380('0x21')]);return db[_0xe380('0x9b')][_0xe380('0x44')](_0x2e9dc2[_0xe380('0x9c')](),_0x1758a8);})[_0xe380('0x27')](function(_0x4d3062){if(_0x4d3062[_0xe380('0x62')]>0x0)_0x24c6f5[_0xe380('0x49')](_0xe380('0xb2'),_['map'](_0x4d3062,'id'));return db[_0xe380('0x9b')][_0xe380('0x44')](_0x24c6f5[_0xe380('0x9c')](),_0x1758a8)['then'](function(_0x5e7ddf){var _0x308911=_['groupBy'](_0x5e7ddf,'OpenchannelInteractionId');var _0x293537=[];_0x4d3062[_0xe380('0x31')](function(_0x3183d0){_0x293537[_0xe380('0xb3')](updateOpenchannelInteraction(_0x3183d0,_0x314f00,_0x308911));});return BPromise[_0xe380('0xb4')](_0x293537);});});})['then'](function(_0x453686){_0x3961f8['rows']=_0x453686;return _0x3961f8;})['then'](respondWithFilteredResult(_0x35dce8,_0x3d7842))[_0xe380('0x32')](handleError(_0x35dce8,null));};exports[_0xe380('0xb5')]=function(_0x2b3b66,_0x4e8585){var _0x51172c={};if(_0x2b3b66[_0xe380('0x44')][_0xe380('0x3f')]&&_0x2b3b66[_0xe380('0x44')][_0xe380('0x3f')]===_0xe380('0x4c')){_0x51172c[_0xe380('0x4c')]=_0x2b3b66['params']['id'];}else{_0x51172c['id']=_0x2b3b66[_0xe380('0xb6')]['id'];}var _0x49ccdd={'raw':![],'where':_0x51172c},_0x13808a={};_0x13808a[_0xe380('0x40')]=_[_0xe380('0x41')](db['OpenchannelInteraction'][_0xe380('0x3d')]);_0x13808a[_0xe380('0x44')]=_[_0xe380('0x41')](_0x2b3b66['query']);_0x13808a['filters']=_[_0xe380('0x43')](_0x13808a['model'],_0x13808a[_0xe380('0x44')]);_0x49ccdd[_0xe380('0x45')]=_['intersection'](_0x13808a['model'],qs[_0xe380('0x46')](_0x2b3b66['query'][_0xe380('0x46')]));_0x49ccdd[_0xe380('0x45')]=_0x49ccdd['attributes'][_0xe380('0x62')]?_0x49ccdd['attributes']:_0x13808a[_0xe380('0x40')];if(_0x2b3b66[_0xe380('0x44')]['includeAll']){_0x49ccdd[_0xe380('0xb7')]=[{'all':!![]}];}_0x49ccdd=_['merge']({},_0x49ccdd,_0x2b3b66['options']);return db[_0xe380('0x3c')][_0xe380('0x63')](_0x49ccdd)['then'](handleEntityNotFound(_0x4e8585,null))[_0xe380('0x27')](respondWithResult(_0x4e8585,null))['catch'](handleError(_0x4e8585,null));};exports[_0xe380('0xb8')]=function(_0x57e605,_0x11c210){return db['OpenchannelInteraction'][_0xe380('0xb8')](_0x57e605['body'],{})['then'](respondWithResult(_0x11c210,0xc9))[_0xe380('0x32')](handleError(_0x11c210,null));};exports[_0xe380('0xb9')]=function(_0x9afbbf,_0x3d041b){if(_0x9afbbf[_0xe380('0xba')]['id']){delete _0x9afbbf[_0xe380('0xba')]['id'];}return db[_0xe380('0x3c')][_0xe380('0x63')]({'where':{'id':_0x9afbbf[_0xe380('0xb6')]['id']}})[_0xe380('0x27')](handleEntityNotFound(_0x3d041b,null))['then'](saveUpdates(_0x9afbbf['body'],null))[_0xe380('0x27')](respondWithResult(_0x3d041b,null))[_0xe380('0x32')](handleError(_0x3d041b,null));};exports[_0xe380('0xbb')]=function(_0x10655e,_0x53703e){return db[_0xe380('0x3c')][_0xe380('0x63')]({'where':{'id':_0x10655e['params']['id']}})[_0xe380('0x27')](handleEntityNotFound(_0x53703e,null))[_0xe380('0x27')](removeEntity(_0x53703e,null))[_0xe380('0x32')](handleError(_0x53703e,null));};exports[_0xe380('0xbc')]=function(_0x3d50aa,_0x14af50){return db[_0xe380('0x3c')][_0xe380('0xbc')]()[_0xe380('0x27')](respondWithResult(_0x14af50,null))[_0xe380('0x32')](handleError(_0x14af50,null));};exports[_0xe380('0xbd')]=function(_0x2ff264,_0x47bb0b,_0x43e3b0){return db[_0xe380('0xbe')][_0xe380('0x63')]({'where':{'id':_0x2ff264[_0xe380('0xb6')]['id']}})[_0xe380('0x27')](handleEntityNotFound(_0x47bb0b,null))[_0xe380('0x27')](function(_0x5877a5){if(_0x5877a5){return _0x5877a5[_0xe380('0xbd')](_0x2ff264[_0xe380('0xba')][_0xe380('0xbf')],_['omit'](_0x2ff264[_0xe380('0xba')],[_0xe380('0xbf'),'id'])||{});}})[_0xe380('0x27')](respondWithResult(_0x47bb0b,null))[_0xe380('0x32')](handleError(_0x47bb0b,null));};exports[_0xe380('0xc0')]=function(_0x38511a,_0x3f48c6,_0x56cfb2){var _0x173fdd={'raw':![],'where':{}};var _0x1bdc7b={};var _0x497b6c={'count':0x0,'rows':[]};return db[_0xe380('0x3c')]['findOne']({'where':{'id':_0x38511a[_0xe380('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3f48c6,null))['then'](function(_0x445124){if(_0x445124){_0x1bdc7b['model']=_[_0xe380('0x41')](db[_0xe380('0xbe')][_0xe380('0x3d')]);_0x1bdc7b[_0xe380('0x44')]=_['keys'](_0x38511a[_0xe380('0x44')]);_0x1bdc7b[_0xe380('0x42')]=_[_0xe380('0x43')](_0x1bdc7b['model'],_0x1bdc7b['query']);_0x173fdd[_0xe380('0x45')]=_[_0xe380('0x43')](_0x1bdc7b[_0xe380('0x40')],qs['fields'](_0x38511a[_0xe380('0x44')][_0xe380('0x46')]));_0x173fdd[_0xe380('0x45')]=_0x173fdd[_0xe380('0x45')][_0xe380('0x62')]?_0x173fdd[_0xe380('0x45')]:_0x1bdc7b['model'];if(!_0x38511a[_0xe380('0x44')][_0xe380('0xc1')](_0xe380('0x47'))){_0x173fdd[_0xe380('0x22')]=qs[_0xe380('0x22')](_0x38511a[_0xe380('0x44')][_0xe380('0x22')]);_0x173fdd['offset']=qs[_0xe380('0x21')](_0x38511a[_0xe380('0x44')][_0xe380('0x21')]);}_0x173fdd[_0xe380('0x90')]=qs[_0xe380('0x48')](_0x38511a[_0xe380('0x44')][_0xe380('0x48')]);_0x173fdd[_0xe380('0x49')]=qs[_0xe380('0x42')](_[_0xe380('0x4a')](_0x38511a[_0xe380('0x44')],_0x1bdc7b[_0xe380('0x42')]));_0x173fdd[_0xe380('0x49')][_0xe380('0xc2')]=_0x445124['id'];if(_0x38511a['query'][_0xe380('0x84')]){_0x173fdd[_0xe380('0x49')]=_[_0xe380('0xc3')](_0x173fdd['where'],{'$or':_[_0xe380('0x3b')](_0x173fdd[_0xe380('0x45')],function(_0x598163){var _0x444152={};_0x444152[_0x598163]={'$like':'%'+_0x38511a[_0xe380('0x44')][_0xe380('0x84')]+'%'};return _0x444152;})});}if(_0x38511a[_0xe380('0x44')][_0xe380('0x7b')]){var _0x10142b=_0x38511a[_0xe380('0x44')][_0xe380('0x7b')][_0xe380('0x30')](',');var _0x2913d7={};_0x2913d7[_0x10142b[0x0]]={'$gte':moment(_0x10142b[0x1])[_0xe380('0xc4')](_0xe380('0xc5'))};_0x173fdd['where']=_[_0xe380('0xc3')](_0x173fdd['where'],_0x2913d7);}_0x173fdd=_[_0xe380('0xc3')]({},_0x173fdd,_0x38511a[_0xe380('0xc6')]);return db[_0xe380('0xbe')]['count']({'where':_0x173fdd[_0xe380('0x49')]})[_0xe380('0x27')](function(_0x3c89d5){_0x497b6c[_0xe380('0x24')]=_0x3c89d5;if(_0x38511a[_0xe380('0x44')][_0xe380('0xc7')]){_0x173fdd['include']=[{'all':!![]}];}return db[_0xe380('0xbe')]['findAll'](_0x173fdd);})['then'](function(_0xb2cfbb){_0x497b6c[_0xe380('0xc8')]=_0xb2cfbb;return _0x497b6c;});}})[_0xe380('0x27')](respondWithFilteredResult(_0x3f48c6,_0x173fdd))[_0xe380('0x32')](handleError(_0x3f48c6,null));};exports['addTags']=function(_0x4ec669,_0xc6a6c9,_0x2bb70c){return db[_0xe380('0x3c')][_0xe380('0x63')]({'where':{'id':_0x4ec669['params']['id']}})[_0xe380('0x27')](handleEntityNotFound(_0xc6a6c9,null))[_0xe380('0x27')](function(_0x193784){if(_0x193784){return _0x193784[_0xe380('0xc9')](_0x4ec669[_0xe380('0xba')][_0xe380('0xbf')],_[_0xe380('0xca')](_0x4ec669[_0xe380('0xba')],[_0xe380('0xbf'),'id'])||{})[_0xe380('0xcb')](function(){return db[_0xe380('0xcc')][_0xe380('0xcd')]({'attributes':['id',_0xe380('0x2a'),_0xe380('0xce')],'where':{'id':_0x4ec669[_0xe380('0xba')][_0xe380('0xbf')]}});})[_0xe380('0x27')](function(_0x136884){socket['emit'](_0xe380('0xcf'),{'id':Number(_0x4ec669['params']['id']),'tags':_0x136884||[]});return{'id':Number(_0x4ec669[_0xe380('0xb6')]['id']),'tags':_0x136884||[]};});}})[_0xe380('0x27')](respondWithResult(_0xc6a6c9,null))[_0xe380('0x32')](handleError(_0xc6a6c9,null));};exports[_0xe380('0xd0')]=function(_0x5b09fc,_0x375118,_0x1db0d8){return db['OpenchannelInteraction'][_0xe380('0x63')]({'where':{'id':_0x5b09fc['params']['id']}})[_0xe380('0x27')](handleEntityNotFound(_0x375118,null))[_0xe380('0x27')](function(_0x2ed155){if(_0x2ed155){return _0x2ed155[_0xe380('0xd0')](_0x5b09fc[_0xe380('0x44')][_0xe380('0xbf')]);}})['then'](respondWithStatusCode(_0x375118,null))[_0xe380('0x32')](handleError(_0x375118,null));};exports[_0xe380('0xd1')]=function(_0x386c93,_0x1c98bd){var _0xac5ceb=moment()[_0xe380('0xd2')]()['toString']();var _0x8300a8=path[_0xe380('0xd3')](config[_0xe380('0xd4')],_0xe380('0xd5'),_0xe380('0xd6'),_0xe380('0xd7'));var _0x5b2366=path[_0xe380('0xd3')](config[_0xe380('0xd4')],'server',_0xe380('0xd6'),'attachments');var _0x106825=path['join'](_0x8300a8,_0xac5ceb);var _0x4f5a0c=util[_0xe380('0xc4')](_0xe380('0xd8'),_0x386c93[_0xe380('0xb6')]['id'],_0xac5ceb);var _0x5ca46f=path[_0xe380('0xd3')](_0x8300a8,_0x4f5a0c);var _0x2a569b=[];_0x2a569b[_0xe380('0xb3')]({'model':db[_0xe380('0x72')],'as':_0xe380('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x2a569b[_0xe380('0xb3')]({'model':db[_0xe380('0xd9')],'as':_0xe380('0x67'),'attributes':['id',_0xe380('0xda'),_0xe380('0xdb')],'raw':!![]});if(_0x386c93[_0xe380('0x44')][_0xe380('0xdc')]){_0x2a569b['push']({'model':db[_0xe380('0xdd')],'as':'Attachment','raw':!![]});}var _0x3a83c6=[{'model':db[_0xe380('0xbe')],'as':_0xe380('0xde'),'attributes':['id',_0xe380('0xba'),_0xe380('0x79'),_0xe380('0xdf'),_0xe380('0xe0'),_0xe380('0xe1')],'include':_0x2a569b}];_0x3a83c6[_0xe380('0xb3')]({'model':db[_0xe380('0xe2')],'as':_0xe380('0xe3'),'attributes':['id',_0xe380('0x2a')]});_0x3a83c6[_0xe380('0xb3')]({'model':db[_0xe380('0x72')],'as':_0xe380('0xe4'),'attributes':['id',_0xe380('0x2d')]});return db[_0xe380('0x3c')]['find']({'where':{'id':_0x386c93[_0xe380('0xb6')]['id']},'include':_0x3a83c6})[_0xe380('0x27')](handleEntityNotFound(_0x1c98bd,null))[_0xe380('0x27')](function(_0x4138f5){if(_0x4138f5){var _0x4f1def=_0x4138f5[_0xe380('0xe5')]({'plain':!![]});fs[_0xe380('0xe6')](_0x106825);var _0x54d125={'channel':_0xe380('0xe7'),'account':_0x4f1def[_0xe380('0xe3')]['name'],'agent':_0x4f1def[_0xe380('0xe4')]?_0x4f1def[_0xe380('0xe4')][_0xe380('0x2d')]:_0xe380('0xe8'),'createdAt':moment(_0x4f1def[_0xe380('0x79')])[_0xe380('0xc4')](_0xe380('0xc5'))[_0xe380('0x9c')](),'closedAt':_0x4f1def[_0xe380('0x38')]?moment(_0x4f1def[_0xe380('0xe9')])[_0xe380('0xc4')](_0xe380('0xc5'))[_0xe380('0x9c')]():'','disposition':_0x4f1def['disposition'],'visibility':_0x4f1def[_0xe380('0xea')]?_0xe380('0xeb'):_0xe380('0xec'),'messages':_(_0x4f1def[_0xe380('0xde')])[_0xe380('0x84')]({'secret':![]})['map'](function(_0x13b7c2){if(_0x13b7c2['Attachment']){var _0x1a00f0=path[_0xe380('0xd3')](_0x5b2366,_0x13b7c2[_0xe380('0xdd')][_0xe380('0xed')]);if(fs[_0xe380('0xee')](_0x1a00f0)){fs['createReadStream'](_0x1a00f0)[_0xe380('0xef')](fs[_0xe380('0xf0')](path[_0xe380('0xd3')](_0x106825,_0x13b7c2[_0xe380('0xdd')][_0xe380('0xed')])));}}return{'date':moment(_0x13b7c2['createdAt'])[_0xe380('0xc4')](_0xe380('0xc5'))[_0xe380('0x9c')](),'sender':_0x13b7c2[_0xe380('0xdf')]===_0xe380('0xf1')?_0x13b7c2[_0xe380('0x72')]?_0x13b7c2[_0xe380('0x72')]['fullname']:_0xe380('0xf2'):_0x13b7c2[_0xe380('0x67')][_0xe380('0xda')]+(_0x13b7c2['Contact'][_0xe380('0xdb')]?'\x20'+_0x13b7c2['Contact'][_0xe380('0xdb')]:''),'body':_0x13b7c2['Attachment']?_0x13b7c2[_0xe380('0xdd')][_0xe380('0xed')]:_0x13b7c2[_0xe380('0xba')],'direction':_0x13b7c2[_0xe380('0xdf')]===_0xe380('0xf1')?'A':'C','secret':_0x13b7c2[_0xe380('0xe0')],'read':_0x13b7c2[_0xe380('0xe1')],'attachment':_0x13b7c2[_0xe380('0xdd')]};})[_0xe380('0x69')]()};return ejs['renderFile'](path[_0xe380('0xd3')](config[_0xe380('0xd4')],_0xe380('0xd5'),'views',_0xe380('0xf3')),{'interaction':_0x54d125})[_0xe380('0x27')](function(_0x192af3){var _0x4d01b4=path[_0xe380('0xd3')](_0x106825,_0xe380('0xf4')+_0x4f1def['id']+'-'+_0xac5ceb+_0xe380('0xf5'));var _0x517fd2={'path':_0x4d01b4,'channel':_0xe380('0xe7'),'interactionId':_0x4f1def['id']};return pdf[_0xe380('0xf6')](_0x192af3,_0x517fd2);})['then'](function(){return new BPromise(function(_0x314b59,_0x1f7231){zipdir(_0x106825,{'saveTo':_0x5ca46f},function(_0x35ec3a,_0x3d8348){if(_0x35ec3a)return _0x1f7231(_0x35ec3a);return _0x314b59(_0x3d8348);});})[_0xe380('0x27')](function(){return new BPromise(function(_0xb80324,_0x4613b9){rimraf(_0x106825,function(_0x25c0b0){if(_0x25c0b0)_0x4613b9(_0x25c0b0);return _0xb80324();});});})[_0xe380('0x27')](function(){return _0x1c98bd[_0xe380('0xd1')](_0x5ca46f,_0x4f5a0c,function(_0x49e631){if(_0x49e631){console[_0xe380('0xf7')]('err',_0x49e631);}else{fs[_0xe380('0xf8')](_0x5ca46f);}});});});}else{return _0x1c98bd[_0xe380('0x1d')](0xc8);}})[_0xe380('0x32')](handleError(_0x1c98bd,null));}; \ No newline at end of file +var _0x2709=['findAll','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','root','tmp','join','server','transcript-%d-%s.zip','User','CmContact','firstName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','catch','talking','answered','closed','UserId','waiting','unmanaged','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','select','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','show','params','intersection','includeAll','include','merge','options','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','sort','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5e281f,_0x137c9b){var _0x219e36=function(_0x2e90f2){while(--_0x2e90f2){_0x5e281f['push'](_0x5e281f['shift']());}};_0x219e36(++_0x137c9b);}(_0x2709,0x12d));var _0x9270=function(_0x39b8ed,_0x1db7c0){_0x39b8ed=_0x39b8ed-0x0;var _0x339dac=_0x2709[_0x39b8ed];return _0x339dac;};'use strict';var emlformat=require(_0x9270('0x0'));var rimraf=require(_0x9270('0x1'));var zipdir=require(_0x9270('0x2'));var jsonpatch=require(_0x9270('0x3'));var rp=require('request-promise');var moment=require(_0x9270('0x4'));var BPromise=require(_0x9270('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9270('0x6'));var sox=require(_0x9270('0x7'));var csv=require(_0x9270('0x8'));var ejs=require(_0x9270('0x9'));var fs=require('fs');var fs_extra=require(_0x9270('0xa'));var _=require(_0x9270('0xb'));var squel=require('squel');var crypto=require(_0x9270('0xc'));var jsforce=require(_0x9270('0xd'));var deskjs=require(_0x9270('0xe'));var toCsv=require(_0x9270('0x8'));var querystring=require(_0x9270('0xf'));var Papa=require(_0x9270('0x10'));var Redis=require(_0x9270('0x11'));var authService=require(_0x9270('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9270('0x13'));var pdf=require(_0x9270('0x14'));var hardwareService=require(_0x9270('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x9270('0x16'));var config=require(_0x9270('0x17'));var licenseUtil=require(_0x9270('0x18'));var db=require('../../mysqldb')['db'];config[_0x9270('0x19')]=_[_0x9270('0x1a')](config[_0x9270('0x19')],{'host':_0x9270('0x1b'),'port':0x18eb});var socket=require(_0x9270('0x1c'))(new Redis(config[_0x9270('0x19')]));require(_0x9270('0x1d'))[_0x9270('0x1e')](socket);function respondWithStatusCode(_0x3f1b9a,_0x4c7418){_0x4c7418=_0x4c7418||0xcc;return function(_0x6b8cb7){if(_0x6b8cb7){return _0x3f1b9a['sendStatus'](_0x4c7418);}return _0x3f1b9a[_0x9270('0x1f')](_0x4c7418)[_0x9270('0x20')]();};}function respondWithResult(_0x588ba7,_0x2a8714){_0x2a8714=_0x2a8714||0xc8;return function(_0x600927){if(_0x600927){return _0x588ba7[_0x9270('0x1f')](_0x2a8714)[_0x9270('0x21')](_0x600927);}};}function respondWithFilteredResult(_0x39fd41,_0x32dfa1){return function(_0x55b7db){if(_0x55b7db){var _0x37049c=typeof _0x32dfa1[_0x9270('0x22')]===_0x9270('0x23')&&typeof _0x32dfa1['limit']===_0x9270('0x23');var _0x39b152=_0x55b7db['count'];var _0x42e6fb=_0x37049c?0x0:_0x32dfa1[_0x9270('0x22')];var _0x54a0d8=_0x37049c?_0x55b7db['count']:_0x32dfa1[_0x9270('0x22')]+_0x32dfa1['limit'];var _0xba6120;if(_0x54a0d8>=_0x39b152){_0x54a0d8=_0x39b152;_0xba6120=0xc8;}else{_0xba6120=0xce;}_0x39fd41[_0x9270('0x1f')](_0xba6120);return _0x39fd41[_0x9270('0x24')](_0x9270('0x25'),_0x42e6fb+'-'+_0x54a0d8+'/'+_0x39b152)[_0x9270('0x21')](_0x55b7db);}return null;};}function patchUpdates(_0x933ffe){return function(_0x373d9d){try{jsonpatch[_0x9270('0x26')](_0x373d9d,_0x933ffe,!![]);}catch(_0x336a40){return BPromise[_0x9270('0x27')](_0x336a40);}return _0x373d9d[_0x9270('0x28')]();};}function saveUpdates(_0x16a6d8,_0x4b4a1e){return function(_0xf5a8f0){if(_0xf5a8f0){return _0xf5a8f0[_0x9270('0x29')](_0x16a6d8)[_0x9270('0x2a')](function(_0x5c8189){return _0x5c8189;});}return null;};}function removeEntity(_0x34fb77,_0x5dc2ec){return function(_0x334e05){if(_0x334e05){return _0x334e05[_0x9270('0x2b')]()['then'](function(){_0x34fb77[_0x9270('0x1f')](0xcc)[_0x9270('0x20')]();});}};}function handleEntityNotFound(_0x15daba,_0x30e17e){return function(_0x154621){if(!_0x154621){_0x15daba['sendStatus'](0x194);}return _0x154621;};}function handleError(_0x4d5023,_0x2fa6b1){_0x2fa6b1=_0x2fa6b1||0x1f4;return function(_0x5f0ad4){logger[_0x9270('0x2c')](_0x5f0ad4[_0x9270('0x2d')]);if(_0x5f0ad4[_0x9270('0x2e')]){delete _0x5f0ad4['name'];}_0x4d5023[_0x9270('0x1f')](_0x2fa6b1)[_0x9270('0x2f')](_0x5f0ad4);};}function getInteractionUsers(_0x21bf9f,_0x2fb683){return new BPromise(function(_0x41c667,_0x46137b){try{if(_0x2fb683[_0x21bf9f['id']]){_0x21bf9f[_0x9270('0x30')]=_['map'](_0x2fb683[_0x21bf9f['id']],function(_0x487ef5){return{'id':_0x487ef5['id'],'fullname':_0x487ef5[_0x9270('0x31')]};});}}catch(_0x18dc5c){_0x46137b(_0x18dc5c);}_0x41c667(_0x21bf9f);});}function getInteractionTags(_0x296cd8,_0x3c9115){return new BPromise(function(_0x77ee4f,_0x3b8705){try{if(_0x296cd8[_0x9270('0x32')]){_0x296cd8[_0x9270('0x33')]=[];_0x296cd8[_0x9270('0x32')]['split'](',')[_0x9270('0x34')](function(_0xdf7c23){_0x296cd8[_0x9270('0x33')]['push'](_0x3c9115[_0xdf7c23]);});}delete _0x296cd8['TagIds'];}catch(_0x159616){_0x3b8705(_0x159616);}_0x77ee4f(_0x296cd8);});}function updateOpenchannelInteraction(_0x48aca9,_0x3da880,_0x59add7){return new BPromise(function(_0x3a147d,_0x26c8c4){return getInteractionUsers(_0x48aca9,_0x59add7)[_0x9270('0x2a')](function(_0x48feef){return getInteractionTags(_0x48feef,_0x3da880);})[_0x9270('0x2a')](function(_0x49066e){return getStateInteraction(_0x49066e);})[_0x9270('0x2a')](function(_0x32179a){_0x3a147d(_0x32179a);})[_0x9270('0x35')](function(_0x5ec2eb){_0x26c8c4(_0x5ec2eb);});});}function getStateInteraction(_0x28b224){return new BPromise(function(_0x4854b6){_0x28b224['waiting']=0x0;_0x28b224[_0x9270('0x36')]=0x0;_0x28b224[_0x9270('0x37')]=0x0;_0x28b224['unmanaged']=0x0;_0x28b224['total']=0x0;if(!_0x28b224[_0x9270('0x38')]&&!_0x28b224[_0x9270('0x39')]){_0x28b224[_0x9270('0x3a')]+=0x1;}if(!_0x28b224[_0x9270('0x38')]&&_0x28b224[_0x9270('0x39')]){_0x28b224['talking']+=0x1;if(_0x28b224['waiting']){_0x28b224[_0x9270('0x3a')]-=0x1;}}if(_0x28b224[_0x9270('0x38')]&&_0x28b224[_0x9270('0x39')]){_0x28b224[_0x9270('0x37')]+=0x1;if(_0x28b224['talking']){_0x28b224['talking']-=0x1;}}if(_0x28b224[_0x9270('0x38')]&&!_0x28b224[_0x9270('0x39')]){_0x28b224[_0x9270('0x3b')]+=0x1;if(_0x28b224[_0x9270('0x3a')]){_0x28b224[_0x9270('0x3a')]-=0x1;}}_0x28b224['total']+=0x1;_0x4854b6(_0x28b224);});}exports[_0x9270('0x3c')]=function(_0x18b095,_0xb4ecdf){var _0x422055={},_0xd1a51a={},_0x3f7c20={'count':0x0,'rows':[]};var _0x2d1999=_[_0x9270('0x3d')](db[_0x9270('0x3e')][_0x9270('0x3f')],function(_0x38a3e6){return{'name':_0x38a3e6[_0x9270('0x40')],'type':_0x38a3e6[_0x9270('0x41')]['key']};});_0xd1a51a[_0x9270('0x42')]=_[_0x9270('0x3d')](_0x2d1999,_0x9270('0x2e'));_0xd1a51a[_0x9270('0x43')]=_[_0x9270('0x44')](_0x18b095['query']);_0xd1a51a[_0x9270('0x45')]=_['intersection'](_0xd1a51a[_0x9270('0x42')],_0xd1a51a['query']);_0x422055[_0x9270('0x46')]=_['intersection'](_0xd1a51a['model'],qs['fields'](_0x18b095[_0x9270('0x43')]['fields']));_0x422055[_0x9270('0x46')]=_0x422055[_0x9270('0x46')][_0x9270('0x47')]?_0x422055[_0x9270('0x46')]:_0xd1a51a['model'];if(!_0x18b095['query'][_0x9270('0x48')](_0x9270('0x49'))){_0x422055['limit']=qs[_0x9270('0x4a')](_0x18b095[_0x9270('0x43')]['limit']);_0x422055[_0x9270('0x22')]=qs['offset'](_0x18b095['query'][_0x9270('0x22')]);}_0x422055[_0x9270('0x4b')]=qs['sort'](_0x18b095[_0x9270('0x43')]['sort']);_0x422055[_0x9270('0x4c')]=qs[_0x9270('0x45')](_[_0x9270('0x4d')](_0x18b095[_0x9270('0x43')],_0xd1a51a[_0x9270('0x45')]),_0x2d1999);var _0x214882=[];var _0x768ac=squel[_0x9270('0x4e')]()[_0x9270('0x4f')]('id')[_0x9270('0x4f')]('name')[_0x9270('0x4f')](_0x9270('0x50'))[_0x9270('0x51')]('tools_tags');var _0xd92185=squel[_0x9270('0x4e')]()[_0x9270('0x4f')](_0x9270('0x52'))[_0x9270('0x4f')]('u.fullname')[_0x9270('0x4f')](_0x9270('0x53'))['from'](_0x9270('0x54'),'ui')[_0x9270('0x55')](_0x9270('0x56'),'u',_0x9270('0x57'));var _0xb7ef44=squel[_0x9270('0x4e')]()[_0x9270('0x51')](_0x9270('0x58'),'i')[_0x9270('0x55')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9270('0x55')](_0x9270('0x56'),'o',_0x9270('0x59'))[_0x9270('0x55')](_0x9270('0x5a'),'a',_0x9270('0x5b'))['left_join'](_0x9270('0x5c'),'me',_0x9270('0x5d'))[_0x9270('0x55')]('openchannel_interaction_has_tags','it',_0x9270('0x5e'))['left_join']('tools_tags','t',_0x9270('0x5f'));var _0x248b5f=squel['expr']();var _0x45d848=[];var _0x4c28b9=squel[_0x9270('0x60')]();var _0x481479;if(_0x18b095[_0x9270('0x43')][_0x9270('0x61')]){_0x481479=as[_0x9270('0x62')](_0x18b095[_0x9270('0x43')][_0x9270('0x61')]);var _0x2dbe18=_0x481479[_0x9270('0x63')];for(var _0x1e8635=0x0;_0x1e8635<_0x481479[_0x9270('0x64')][_0x9270('0x47')];_0x1e8635++){var _0x184c08=_0x481479[_0x9270('0x64')][_0x1e8635];var _0x538f3b='i';var _0x5837f3=_[_0x9270('0x65')](_0x2d1999,['name',_0x184c08[_0x9270('0x4f')]]);if(!_0x5837f3){switch(_0x184c08[_0x9270('0x4f')]){case'unreadMessages':if(_0x184c08[_0x9270('0x66')]==0x1){_0xb7ef44[_0x9270('0x67')]('`'+_0x184c08[_0x9270('0x4f')]+'`\x20=\x200');}else{_0xb7ef44[_0x9270('0x67')]('`'+_0x184c08[_0x9270('0x4f')]+_0x9270('0x68'));}break;case _0x9270('0x69'):if(_0x184c08[_0x9270('0x6a')]===_0x9270('0x6b')){if(_0x184c08[_0x9270('0x66')][_0x9270('0x6c')]('\x20')[_0x9270('0x47')]>0x1){_0x248b5f[_0x2dbe18](_0x9270('0x6d'),qs[_0x9270('0x6e')](_0x184c08[_0x9270('0x66')]),null);}else{var _0x2299fa='%'+_0x184c08[_0x9270('0x66')]+'%';_0x248b5f[_0x2dbe18]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2299fa,_0x2299fa,_0x2299fa);}}else{_0x5837f3=_[_0x9270('0x65')](_0x2d1999,[_0x9270('0x2e'),_0x9270('0x6f')]);_0x184c08[_0x9270('0x4f')]='ContactId';_0x357633=as[_0x9270('0x70')](_0x538f3b,_0x5837f3[_0x9270('0x41')],_0x184c08);_0x248b5f[_0x2dbe18](_0x357633[_0x9270('0x71')],_0x357633[_0x9270('0x66')][_0x9270('0x72')],_0x357633['value']['end']);}break;case'Tag':var _0x462700=_0x184c08[_0x9270('0x66')][_0x9270('0x6c')](',')[_0x9270('0x3d')](function(_0x40d151){return Number(_0x40d151);});_0x462700[_0x9270('0x34')](function(_0x3a44b2){_0x4c28b9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3a44b2+',%');});_0x45d848=_[_0x9270('0x73')](_0x45d848,_0x462700);break;case'User':if(_0x184c08[_0x9270('0x6a')]===_0x9270('0x6b')){_0x248b5f[_0x2dbe18](_0x9270('0x74'),'%'+_0x184c08[_0x9270('0x66')]+'%',null);}else{_0x5837f3=_[_0x9270('0x65')](_0x2d1999,[_0x9270('0x2e'),'UserId']);_0x184c08['field']='UserId';_0x357633=as[_0x9270('0x70')](_0x538f3b,_0x5837f3[_0x9270('0x41')],_0x184c08);_0x248b5f[_0x2dbe18](_0x357633[_0x9270('0x71')],_0x357633['value'][_0x9270('0x72')],_0x357633[_0x9270('0x66')][_0x9270('0x20')]);}break;case _0x9270('0x75'):_0x357633=as[_0x9270('0x70')]('me',null,_0x184c08);_0x248b5f[_0x2dbe18](_0x357633[_0x9270('0x71')],_0x357633['value'][_0x9270('0x72')],_0x357633[_0x9270('0x66')][_0x9270('0x20')]);break;}}else{var _0x357633=as[_0x9270('0x70')](_0x538f3b,_0x5837f3['type'],_0x184c08);_0x248b5f[_0x2dbe18](_0x357633[_0x9270('0x71')],_0x357633[_0x9270('0x66')]['start'],_0x357633['value'][_0x9270('0x20')]);}}}else{var _0x1620e0=_(_0x18b095[_0x9270('0x43')])[_0x9270('0x44')]()[_0x9270('0x3d')](function(_0x1ff258){return _[_0x9270('0x76')](_0x2d1999,['name',_0x1ff258])?_0x1ff258:undefined;})[_0x9270('0x77')]()[_0x9270('0x66')]();if(!_[_0x9270('0x78')](_0x1620e0)){_0x1620e0[_0x9270('0x34')](function(_0x4491d7){if(_0x4491d7==='OpenchannelAccountId'){_0xb7ef44[_0x9270('0x4c')](_0x9270('0x79'),[][_0x9270('0x7a')](_0x18b095[_0x9270('0x43')][_0x4491d7]));}else if(_0x4491d7===_0x9270('0x7b')){var _0x4b9657=JSON[_0x9270('0x7c')](_0x18b095[_0x9270('0x43')][_0x4491d7])[_0x9270('0x7d')];var _0x3d1640=JSON['parse'](_0x18b095['query'][_0x4491d7])[_0x9270('0x7e')];_0xb7ef44[_0x9270('0x4c')](_0x9270('0x7f'),_0x4b9657,_0x3d1640);}else{if(_0x18b095['query'][_0x4491d7]===_0x9270('0x80')){_0xb7ef44[_0x9270('0x4c')]('i.'+_0x4491d7+'\x20IS\x20NULL');}else{_0xb7ef44[_0x9270('0x4c')]('i.'+_0x4491d7+_0x9270('0x81'),_0x18b095[_0x9270('0x43')][_0x4491d7]);}}});}if(_0x18b095[_0x9270('0x43')]['read']){if(_0x18b095[_0x9270('0x43')][_0x9270('0x82')]==0x1){_0xb7ef44[_0x9270('0x67')](_0x9270('0x83'));}else{_0xb7ef44['having'](_0x9270('0x84'));}}if(_0x18b095[_0x9270('0x43')][_0x9270('0x85')]){_0x45d848=_[_0x9270('0x86')](_0x18b095['query']['tag'])?_0x18b095['query'][_0x9270('0x85')]:new Array(_0x18b095[_0x9270('0x43')][_0x9270('0x85')]);_0x45d848[_0x9270('0x34')](function(_0x492585){_0x4c28b9['or'](_0x9270('0x87'),'%,'+_0x492585+',%');});}if(_0x18b095[_0x9270('0x43')]['filter']){var _0x1654cd=_0x18b095[_0x9270('0x43')][_0x9270('0x88')]['replace']('\x5c','\x5c\x5c')[_0x9270('0x89')](/'/g,'\x27\x27');if(qs[_0x9270('0x8a')](_0x1654cd)){_0x248b5f['or'](_0x9270('0x8b'),_0x1654cd+'%');}else{_0x248b5f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1654cd))['or'](_0x9270('0x8c'),_0x1654cd+'%')['or'](_0x9270('0x8d'),_0x1654cd+'%');}}}_0xb7ef44[_0x9270('0x4c')](_0x248b5f);_0xb7ef44[_0x9270('0x8e')](_0x9270('0x8f'));var _0x3a4b1b={'type':db[_0x9270('0x90')]['QueryTypes'][_0x9270('0x91')],'raw':!![]};var _0x2c8197=_0xb7ef44[_0x9270('0x92')]();_0x2c8197['field'](_0x9270('0x8f'));_0x2c8197[_0x9270('0x4f')](_0x9270('0x93'),_0x9270('0x94'));if(_0x422055[_0x9270('0x4b')]){_0x422055[_0x9270('0x4b')][_0x9270('0x34')](function(_0x914a65){var _0x40cceb=_0x914a65[0x0]===_0x9270('0x95')?_0x914a65[0x0]:'i.'+_0x914a65[0x0];_0xb7ef44['order'](_0x40cceb,_0x914a65[0x1]===_0x9270('0x96')?![]:!![]);});}if(!_[_0x9270('0x78')](_0x45d848)){_0xb7ef44['having'](_0x4c28b9);_0x2c8197[_0x9270('0x4c')](_0x9270('0x97'),_0x45d848);}BPromise[_0x9270('0x98')]()[_0x9270('0x2a')](function(){if(!_0x481479){if(_0x18b095[_0x9270('0x43')][_0x9270('0x99')])return;_0x2c8197[_0x9270('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0xb7ef44['where'](_0x9270('0x9a'));return;}if(_0x18b095[_0x9270('0x9b')]['role']!==_0x9270('0x9c'))return;return _0x18b095[_0x9270('0x9b')][_0x9270('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32ecad){if(_[_0x9270('0x78')](_0x32ecad)){_0x2c8197[_0x9270('0x4c')](_0x9270('0x9e'));_0xb7ef44['where'](_0x9270('0x9e'));}else{_0x2c8197[_0x9270('0x4c')](_0x9270('0x79'),_[_0x9270('0x3d')](_0x32ecad,'id'));_0xb7ef44[_0x9270('0x4c')](_0x9270('0x79'),_[_0x9270('0x3d')](_0x32ecad,'id'));}});})[_0x9270('0x2a')](function(){if(_0x18b095['user'][_0x9270('0x9f')]===_0x9270('0x9c')&&!_0x481479&&!_0x18b095[_0x9270('0x43')]['OpenchannelAccountId'])return[];return db[_0x9270('0xa0')][_0x9270('0x43')](_0x2c8197[_0x9270('0xa1')](),_0x3a4b1b);})['then'](function(_0xe019db){_0x3f7c20['count']=_0xe019db[_0x9270('0x47')];if(_0x3f7c20['count']===0x0)return[];return db[_0x9270('0xa0')][_0x9270('0x43')](_0x768ac[_0x9270('0xa1')](),_0x3a4b1b)[_0x9270('0x2a')](function(_0x14640f){_0x214882=_['keyBy'](_0x14640f,'id');_0x3a4b1b=_['merge'](_0x3a4b1b,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18b095[_0x9270('0x43')][_0x9270('0xa2')]){_0x422055['attributes'][_0x9270('0x34')](function(_0x57a26f){_0xb7ef44[_0x9270('0x4f')]('i.'+_0x57a26f);});}else{_0xb7ef44[_0x9270('0x4f')](_0x9270('0x93'),'unreadMessages');_0xb7ef44[_0x9270('0x4f')](_0x9270('0xa3'),_0x9270('0xa4'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xa5'),_0x9270('0xa6'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xa7'),'contactName');_0xb7ef44[_0x9270('0x4f')](_0x9270('0xa8'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xa9'),_0x9270('0xaa'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xab'),'Contact.lastName');_0xb7ef44['field'](_0x9270('0xac'),_0x9270('0xad'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xae'),_0x9270('0xaf'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xb0'),_0x9270('0xb1'));_0xb7ef44['field'](_0x9270('0xb2'),'Contact.fax');_0xb7ef44['field'](_0x9270('0xb3'),_0x9270('0xb4'));_0xb7ef44[_0x9270('0x4f')](_0x9270('0xb5'),_0x9270('0xb6'));_0xb7ef44['field'](_0x9270('0xb7'),_0x9270('0x32'));}if(_0x422055[_0x9270('0x4a')])_0xb7ef44[_0x9270('0x4a')](_0x422055['limit']);if(_0x422055['offset'])_0xb7ef44[_0x9270('0x22')](_0x422055[_0x9270('0x22')]);return db[_0x9270('0xa0')][_0x9270('0x43')](_0xb7ef44[_0x9270('0xa1')](),_0x3a4b1b);})['then'](function(_0x34e707){if(_0x34e707['length']>0x0)_0xd92185[_0x9270('0x4c')](_0x9270('0xb8'),_[_0x9270('0x3d')](_0x34e707,'id'));return db[_0x9270('0xa0')]['query'](_0xd92185[_0x9270('0xa1')](),_0x3a4b1b)[_0x9270('0x2a')](function(_0x3aec87){var _0xdb5a27=_[_0x9270('0xb9')](_0x3aec87,_0x9270('0xba'));var _0x2eaa66=[];_0x34e707[_0x9270('0x34')](function(_0x4f7b69){_0x2eaa66[_0x9270('0xbb')](updateOpenchannelInteraction(_0x4f7b69,_0x214882,_0xdb5a27));});return BPromise[_0x9270('0xbc')](_0x2eaa66);});});})[_0x9270('0x2a')](function(_0x538b72){_0x3f7c20['rows']=_0x538b72;return _0x3f7c20;})[_0x9270('0x2a')](respondWithFilteredResult(_0xb4ecdf,_0x422055))['catch'](handleError(_0xb4ecdf,null));};exports[_0x9270('0xbd')]=function(_0x55b0c7,_0x3c683e){var _0x4f074b={};if(_0x55b0c7[_0x9270('0x43')][_0x9270('0x41')]&&_0x55b0c7['query']['type']==='from'){_0x4f074b['from']=_0x55b0c7[_0x9270('0xbe')]['id'];}else{_0x4f074b['id']=_0x55b0c7['params']['id'];}var _0x3d532a={'raw':![],'where':_0x4f074b},_0x504485={};_0x504485[_0x9270('0x42')]=_[_0x9270('0x44')](db['OpenchannelInteraction']['rawAttributes']);_0x504485[_0x9270('0x43')]=_[_0x9270('0x44')](_0x55b0c7['query']);_0x504485['filters']=_['intersection'](_0x504485[_0x9270('0x42')],_0x504485[_0x9270('0x43')]);_0x3d532a[_0x9270('0x46')]=_[_0x9270('0xbf')](_0x504485[_0x9270('0x42')],qs[_0x9270('0xa2')](_0x55b0c7[_0x9270('0x43')][_0x9270('0xa2')]));_0x3d532a[_0x9270('0x46')]=_0x3d532a[_0x9270('0x46')][_0x9270('0x47')]?_0x3d532a[_0x9270('0x46')]:_0x504485[_0x9270('0x42')];if(_0x55b0c7[_0x9270('0x43')][_0x9270('0xc0')]){_0x3d532a[_0x9270('0xc1')]=[{'all':!![]}];}_0x3d532a=_[_0x9270('0xc2')]({},_0x3d532a,_0x55b0c7[_0x9270('0xc3')]);return db[_0x9270('0x3e')][_0x9270('0x65')](_0x3d532a)[_0x9270('0x2a')](handleEntityNotFound(_0x3c683e,null))[_0x9270('0x2a')](respondWithResult(_0x3c683e,null))[_0x9270('0x35')](handleError(_0x3c683e,null));};exports['create']=function(_0x541b61,_0x30d71e){return db[_0x9270('0x3e')][_0x9270('0xc4')](_0x541b61[_0x9270('0x75')],{})[_0x9270('0x2a')](respondWithResult(_0x30d71e,0xc9))[_0x9270('0x35')](handleError(_0x30d71e,null));};exports[_0x9270('0x29')]=function(_0x567c68,_0x7cd97b){if(_0x567c68['body']['id']){delete _0x567c68[_0x9270('0x75')]['id'];}return db[_0x9270('0x3e')]['find']({'where':{'id':_0x567c68['params']['id']}})[_0x9270('0x2a')](handleEntityNotFound(_0x7cd97b,null))['then'](saveUpdates(_0x567c68[_0x9270('0x75')],null))[_0x9270('0x2a')](respondWithResult(_0x7cd97b,null))['catch'](handleError(_0x7cd97b,null));};exports['destroy']=function(_0x108f68,_0x22726a){return db[_0x9270('0x3e')][_0x9270('0x65')]({'where':{'id':_0x108f68['params']['id']}})[_0x9270('0x2a')](handleEntityNotFound(_0x22726a,null))['then'](removeEntity(_0x22726a,null))[_0x9270('0x35')](handleError(_0x22726a,null));};exports[_0x9270('0xc5')]=function(_0x275e96,_0x4a64c2){return db[_0x9270('0x3e')][_0x9270('0xc5')]()[_0x9270('0x2a')](respondWithResult(_0x4a64c2,null))['catch'](handleError(_0x4a64c2,null));};exports[_0x9270('0xc6')]=function(_0x5d8d88,_0x2f1c39,_0xb5204){return db[_0x9270('0xc7')]['find']({'where':{'id':_0x5d8d88[_0x9270('0xbe')]['id']}})[_0x9270('0x2a')](handleEntityNotFound(_0x2f1c39,null))['then'](function(_0x3b797e){if(_0x3b797e){return _0x3b797e[_0x9270('0xc6')](_0x5d8d88['body']['ids'],_[_0x9270('0xc8')](_0x5d8d88[_0x9270('0x75')],[_0x9270('0xc9'),'id'])||{});}})[_0x9270('0x2a')](respondWithResult(_0x2f1c39,null))[_0x9270('0x35')](handleError(_0x2f1c39,null));};exports[_0x9270('0xca')]=function(_0x3dfceb,_0x441053,_0x364251){var _0x398139={'raw':![],'where':{}};var _0x2aff48={};var _0x2f3db8={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x9270('0xcb')]({'where':{'id':_0x3dfceb['params']['id']}})[_0x9270('0x2a')](handleEntityNotFound(_0x441053,null))[_0x9270('0x2a')](function(_0x107589){if(_0x107589){_0x2aff48[_0x9270('0x42')]=_[_0x9270('0x44')](db[_0x9270('0xc7')][_0x9270('0x3f')]);_0x2aff48[_0x9270('0x43')]=_[_0x9270('0x44')](_0x3dfceb[_0x9270('0x43')]);_0x2aff48['filters']=_[_0x9270('0xbf')](_0x2aff48[_0x9270('0x42')],_0x2aff48[_0x9270('0x43')]);_0x398139['attributes']=_[_0x9270('0xbf')](_0x2aff48[_0x9270('0x42')],qs[_0x9270('0xa2')](_0x3dfceb['query'][_0x9270('0xa2')]));_0x398139[_0x9270('0x46')]=_0x398139[_0x9270('0x46')]['length']?_0x398139[_0x9270('0x46')]:_0x2aff48[_0x9270('0x42')];if(!_0x3dfceb[_0x9270('0x43')][_0x9270('0x48')](_0x9270('0x49'))){_0x398139['limit']=qs[_0x9270('0x4a')](_0x3dfceb[_0x9270('0x43')][_0x9270('0x4a')]);_0x398139[_0x9270('0x22')]=qs[_0x9270('0x22')](_0x3dfceb[_0x9270('0x43')][_0x9270('0x22')]);}_0x398139[_0x9270('0x4b')]=qs[_0x9270('0xcc')](_0x3dfceb[_0x9270('0x43')][_0x9270('0xcc')]);_0x398139[_0x9270('0x4c')]=qs[_0x9270('0x45')](_[_0x9270('0x4d')](_0x3dfceb['query'],_0x2aff48[_0x9270('0x45')]));_0x398139[_0x9270('0x4c')][_0x9270('0xba')]=_0x107589['id'];if(_0x3dfceb[_0x9270('0x43')][_0x9270('0x88')]){_0x398139['where']=_[_0x9270('0xc2')](_0x398139[_0x9270('0x4c')],{'$or':_[_0x9270('0x3d')](_0x398139[_0x9270('0x46')],function(_0x35eb56){var _0x5267e3={};_0x5267e3[_0x35eb56]={'$like':'%'+_0x3dfceb[_0x9270('0x43')]['filter']+'%'};return _0x5267e3;})});}if(_0x3dfceb[_0x9270('0x43')]['$gte']){var _0x4af907=_0x3dfceb[_0x9270('0x43')][_0x9270('0x7d')][_0x9270('0x6c')](',');var _0x22120d={};_0x22120d[_0x4af907[0x0]]={'$gte':moment(_0x4af907[0x1])[_0x9270('0xcd')](_0x9270('0xce'))};_0x398139[_0x9270('0x4c')]=_[_0x9270('0xc2')](_0x398139['where'],_0x22120d);}_0x398139=_[_0x9270('0xc2')]({},_0x398139,_0x3dfceb['options']);return db[_0x9270('0xc7')]['count']({'where':_0x398139[_0x9270('0x4c')]})[_0x9270('0x2a')](function(_0x4980c6){_0x2f3db8['count']=_0x4980c6;if(_0x3dfceb[_0x9270('0x43')][_0x9270('0xc0')]){_0x398139[_0x9270('0xc1')]=[{'all':!![]}];}return db[_0x9270('0xc7')][_0x9270('0xcf')](_0x398139);})[_0x9270('0x2a')](function(_0x356b34){_0x2f3db8['rows']=_0x356b34;return _0x2f3db8;});}})[_0x9270('0x2a')](respondWithFilteredResult(_0x441053,_0x398139))[_0x9270('0x35')](handleError(_0x441053,null));};exports['addTags']=function(_0x176687,_0x52ec9a,_0x1b3f78){return db[_0x9270('0x3e')][_0x9270('0x65')]({'where':{'id':_0x176687['params']['id']}})[_0x9270('0x2a')](handleEntityNotFound(_0x52ec9a,null))['then'](function(_0x3dad11){if(_0x3dad11){return _0x3dad11['setTags'](_0x176687[_0x9270('0x75')][_0x9270('0xc9')],_[_0x9270('0xc8')](_0x176687[_0x9270('0x75')],[_0x9270('0xc9'),'id'])||{})[_0x9270('0xd0')](function(){return db[_0x9270('0xd1')]['findAll']({'attributes':['id',_0x9270('0x2e'),_0x9270('0x50')],'where':{'id':_0x176687[_0x9270('0x75')]['ids']}});})[_0x9270('0x2a')](function(_0xb2a2af){socket[_0x9270('0xd2')](_0x9270('0xd3'),{'id':Number(_0x176687['params']['id']),'tags':_0xb2a2af||[]});return{'id':Number(_0x176687['params']['id']),'tags':_0xb2a2af||[]};});}})[_0x9270('0x2a')](respondWithResult(_0x52ec9a,null))[_0x9270('0x35')](handleError(_0x52ec9a,null));};exports[_0x9270('0xd4')]=function(_0xa6206f,_0x331a44,_0x540298){return db[_0x9270('0x3e')][_0x9270('0x65')]({'where':{'id':_0xa6206f[_0x9270('0xbe')]['id']}})[_0x9270('0x2a')](handleEntityNotFound(_0x331a44,null))[_0x9270('0x2a')](function(_0xcf2761){if(_0xcf2761){return _0xcf2761['removeTags'](_0xa6206f[_0x9270('0x43')]['ids']);}})[_0x9270('0x2a')](respondWithStatusCode(_0x331a44,null))[_0x9270('0x35')](handleError(_0x331a44,null));};exports[_0x9270('0xd5')]=function(_0x5f9d76,_0xedf27e){var _0x3a1ff4=moment()[_0x9270('0xd6')]()[_0x9270('0xa1')]();var _0x5f1558=path['join'](config[_0x9270('0xd7')],'server','files',_0x9270('0xd8'));var _0x45006b=path[_0x9270('0xd9')](config['root'],_0x9270('0xda'),'files','attachments');var _0x289c8b=path[_0x9270('0xd9')](_0x5f1558,_0x3a1ff4);var _0x196327=util['format'](_0x9270('0xdb'),_0x5f9d76['params']['id'],_0x3a1ff4);var _0xd1de75=path[_0x9270('0xd9')](_0x5f1558,_0x196327);var _0x375ec4=[];_0x375ec4[_0x9270('0xbb')]({'model':db[_0x9270('0xdc')],'as':_0x9270('0xdc'),'attributes':['id',_0x9270('0x31')],'raw':!![]});_0x375ec4['push']({'model':db[_0x9270('0xdd')],'as':_0x9270('0x69'),'attributes':['id',_0x9270('0xde'),'lastName'],'raw':!![]});if(_0x5f9d76[_0x9270('0x43')][_0x9270('0xdf')]){_0x375ec4[_0x9270('0xbb')]({'model':db['Attachment'],'as':_0x9270('0xe0'),'raw':!![]});}var _0x8c39a6=[{'model':db[_0x9270('0xc7')],'as':_0x9270('0xe1'),'attributes':['id','body',_0x9270('0x7b'),_0x9270('0xe2'),_0x9270('0xe3'),_0x9270('0x82')],'include':_0x375ec4}];_0x8c39a6['push']({'model':db[_0x9270('0xe4')],'as':_0x9270('0xe5'),'attributes':['id',_0x9270('0x2e')]});_0x8c39a6[_0x9270('0xbb')]({'model':db[_0x9270('0xdc')],'as':_0x9270('0xe6'),'attributes':['id',_0x9270('0x31')]});return db[_0x9270('0x3e')][_0x9270('0x65')]({'where':{'id':_0x5f9d76[_0x9270('0xbe')]['id']},'include':_0x8c39a6})[_0x9270('0x2a')](handleEntityNotFound(_0xedf27e,null))['then'](function(_0x2b86a4){if(_0x2b86a4){var _0x11af22=_0x2b86a4['get']({'plain':!![]});fs[_0x9270('0xe7')](_0x289c8b);var _0x498e31={'channel':_0x9270('0xe8'),'account':_0x11af22[_0x9270('0xe5')][_0x9270('0x2e')],'agent':_0x11af22[_0x9270('0xe6')]?_0x11af22[_0x9270('0xe6')][_0x9270('0x31')]:_0x9270('0xe9'),'createdAt':moment(_0x11af22[_0x9270('0x7b')])[_0x9270('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x11af22[_0x9270('0x38')]?moment(_0x11af22['closedAt'])[_0x9270('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9270('0xa1')]():'','disposition':_0x11af22[_0x9270('0xea')],'visibility':_0x11af22[_0x9270('0xeb')]?'Public':_0x9270('0xec'),'messages':_(_0x11af22[_0x9270('0xe1')])[_0x9270('0x88')]({'secret':![]})[_0x9270('0x3d')](function(_0x5f2e7d){if(_0x5f2e7d[_0x9270('0xe0')]){var _0x12d24e=path[_0x9270('0xd9')](_0x45006b,_0x5f2e7d['Attachment'][_0x9270('0xed')]);if(fs[_0x9270('0xee')](_0x12d24e)){fs[_0x9270('0xef')](_0x12d24e)[_0x9270('0xf0')](fs[_0x9270('0xf1')](path['join'](_0x289c8b,_0x5f2e7d[_0x9270('0xe0')]['basename'])));}}return{'date':moment(_0x5f2e7d[_0x9270('0x7b')])[_0x9270('0xcd')](_0x9270('0xce'))[_0x9270('0xa1')](),'sender':_0x5f2e7d[_0x9270('0xe2')]===_0x9270('0xf2')?_0x5f2e7d[_0x9270('0xdc')]?_0x5f2e7d[_0x9270('0xdc')]['fullname']:_0x9270('0xf3'):_0x5f2e7d['Contact'][_0x9270('0xde')]+(_0x5f2e7d[_0x9270('0x69')][_0x9270('0xf4')]?'\x20'+_0x5f2e7d[_0x9270('0x69')][_0x9270('0xf4')]:''),'body':_0x5f2e7d['Attachment']?_0x5f2e7d[_0x9270('0xe0')][_0x9270('0xed')]:_0x5f2e7d[_0x9270('0x75')],'direction':_0x5f2e7d[_0x9270('0xe2')]===_0x9270('0xf2')?'A':'C','secret':_0x5f2e7d['secret'],'read':_0x5f2e7d[_0x9270('0x82')],'attachment':_0x5f2e7d[_0x9270('0xe0')]};})[_0x9270('0x66')]()};return ejs[_0x9270('0xf5')](path[_0x9270('0xd9')](config['root'],_0x9270('0xda'),_0x9270('0xf6'),_0x9270('0xf7')),{'interaction':_0x498e31})[_0x9270('0x2a')](function(_0x3bce38){var _0x81dc08=path[_0x9270('0xd9')](_0x289c8b,_0x9270('0xf8')+_0x11af22['id']+'-'+_0x3a1ff4+_0x9270('0xf9'));var _0x24d7b0={'path':_0x81dc08,'channel':'Openchannel','interactionId':_0x11af22['id']};return pdf[_0x9270('0xfa')](_0x3bce38,_0x24d7b0);})['then'](function(){return new BPromise(function(_0x598705,_0x2e1dc0){zipdir(_0x289c8b,{'saveTo':_0xd1de75},function(_0x32eec9,_0x5cb752){if(_0x32eec9)return _0x2e1dc0(_0x32eec9);return _0x598705(_0x5cb752);});})['then'](function(){return new BPromise(function(_0x10c12c,_0x38283a){rimraf(_0x289c8b,function(_0x5ef521){if(_0x5ef521)_0x38283a(_0x5ef521);return _0x10c12c();});});})[_0x9270('0x2a')](function(){return _0xedf27e[_0x9270('0xd5')](_0xd1de75,_0x196327,function(_0x325198){if(_0x325198){console[_0x9270('0xfb')]('err',_0x325198);}else{fs[_0x9270('0xfc')](_0xd1de75);}});});});}else{return _0xedf27e[_0x9270('0xfd')](0xc8);}})[_0x9270('0x35')](handleError(_0xedf27e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ee9a8c5..c647afa 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 _0xbfac=['map','findAll','unreadMessages','length','emit','catch','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0x1365e5,_0x2cc56b){var _0xe2d8dc=function(_0x25149a){while(--_0x25149a){_0x1365e5['push'](_0x1365e5['shift']());}};_0xe2d8dc(++_0x2cc56b);}(_0xbfac,0x67));var _0xcbfa=function(_0x95cf71,_0x597e5b){_0x95cf71=_0x95cf71-0x0;var _0x979b54=_0xbfac[_0x95cf71];return _0x979b54;};'use strict';var EventEmitter=require(_0xcbfa('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xcbfa('0x1')];var OpenchannelMessage=require(_0xcbfa('0x2'))['db'][_0xcbfa('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcbfa('0x4')](0x0);var events={'afterCreate':_0xcbfa('0x5'),'afterUpdate':_0xcbfa('0x6'),'afterDestroy':_0xcbfa('0x7')};function emitEvent(_0x204e7e){return function(_0x5d7bf8,_0xd55da,_0x5e7204){_0x5d7bf8['getUsers']({'attributes':['id'],'raw':!![]})[_0xcbfa('0x8')](function(_0x5c2d3a){_0x5d7bf8[_0xcbfa('0x9')](_0xcbfa('0xa'),_0x5c2d3a[_0xcbfa('0xb')](function(_0x109676){return{'id':_0x109676['id']};}));return OpenchannelMessage[_0xcbfa('0xc')]({'where':{'OpenchannelInteractionId':_0x5d7bf8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e9f95){_0x5d7bf8[_0xcbfa('0x9')](_0xcbfa('0xd'),_0x3e9f95[_0xcbfa('0xe')]);OpenchannelInteractionEvents[_0xcbfa('0xf')](_0x204e7e+':'+_0x5d7bf8['id'],_0x5d7bf8);OpenchannelInteractionEvents[_0xcbfa('0xf')](_0x204e7e,_0x5d7bf8);_0x5e7204(null);})[_0xcbfa('0x10')](_0x5e7204(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xcbfa('0x11')](e,emitEvent(event));}}module[_0xcbfa('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6466=['Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x21517c,_0x36acc1){var _0x20e4a3=function(_0x2beb59){while(--_0x2beb59){_0x21517c['push'](_0x21517c['shift']());}};_0x20e4a3(++_0x36acc1);}(_0x6466,0xaa));var _0x6646=function(_0x455d61,_0x34e24b){_0x455d61=_0x455d61-0x0;var _0x5425c2=_0x6466[_0x455d61];return _0x5425c2;};'use strict';var EventEmitter=require(_0x6646('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x6646('0x1')];var OpenchannelMessage=require(_0x6646('0x2'))['db'][_0x6646('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6646('0x4')](0x0);var events={'afterCreate':_0x6646('0x5'),'afterUpdate':_0x6646('0x6'),'afterDestroy':_0x6646('0x7')};function emitEvent(_0x101fe1){return function(_0x5433be,_0x5bfaa5,_0x5307bb){_0x5433be[_0x6646('0x8')]({'attributes':['id'],'raw':!![]})[_0x6646('0x9')](function(_0x2dfab9){_0x5433be['setDataValue'](_0x6646('0xa'),_0x2dfab9[_0x6646('0xb')](function(_0x124a72){return{'id':_0x124a72['id']};}));return OpenchannelMessage[_0x6646('0xc')]({'where':{'OpenchannelInteractionId':_0x5433be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2b5751){_0x5433be[_0x6646('0xd')](_0x6646('0xe'),_0x2b5751[_0x6646('0xf')]);OpenchannelInteractionEvents[_0x6646('0x10')](_0x101fe1+':'+_0x5433be['id'],_0x5433be);OpenchannelInteractionEvents['emit'](_0x101fe1,_0x5433be);_0x5307bb(null);})[_0x6646('0x11')](_0x5307bb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a3d460d..7fa7d15 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 _0xe941=['utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xe941,0xc4));var _0x1e94=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe941[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x1e94('0x0'));var logger=require(_0x1e94('0x1'))(_0x1e94('0x2'));var moment=require(_0x1e94('0x3'));var BPromise=require(_0x1e94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e94('0x5'));var rimraf=require(_0x1e94('0x6'));var config=require(_0x1e94('0x7'));var attributes=require(_0x1e94('0x8'));module[_0x1e94('0x9')]=function(_0xb5aa55,_0x501440){return _0xb5aa55[_0x1e94('0xa')](_0x1e94('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e94('0xc'),'collate':_0x1e94('0xd'),'hooks':{'beforeUpdate':function(_0x48e23e,_0x11ae7b,_0x5199b0){if(_0x48e23e[_0x1e94('0xe')](_0x1e94('0xf'))){_0x48e23e[_0x1e94('0x10')]=moment()[_0x1e94('0x11')](_0x1e94('0x12'));}_0x5199b0(null,_0x48e23e);}}});}; \ No newline at end of file +var _0x8fed=['./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fed,0x17e));var _0xd8fe=function(_0x35a270,_0x1eb7e4){_0x35a270=_0x35a270-0x0;var _0x21d38e=_0x8fed[_0x35a270];return _0x21d38e;};'use strict';var _=require(_0xd8fe('0x0'));var util=require(_0xd8fe('0x1'));var logger=require(_0xd8fe('0x2'))('api');var moment=require(_0xd8fe('0x3'));var BPromise=require(_0xd8fe('0x4'));var rp=require(_0xd8fe('0x5'));var fs=require('fs');var path=require(_0xd8fe('0x6'));var rimraf=require('rimraf');var config=require(_0xd8fe('0x7'));var attributes=require(_0xd8fe('0x8'));module[_0xd8fe('0x9')]=function(_0x55dee7,_0x463b56){return _0x55dee7['define']('OpenchannelInteraction',attributes,{'tableName':_0xd8fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd8fe('0xb'),'collate':_0xd8fe('0xc'),'hooks':{'beforeUpdate':function(_0x371136,_0x6e2e43,_0x14663d){if(_0x371136['changed']('closed')){_0x371136['closedAt']=moment()[_0xd8fe('0xd')](_0xd8fe('0xe'));}_0x14663d(null,_0x371136);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8a0edf7..901251d 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 _0x04f5=['socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','limit','find','addTags','ids','omit','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x15d32f,_0x52dd06){var _0x27f983=function(_0x327187){while(--_0x327187){_0x15d32f['push'](_0x15d32f['shift']());}};_0x27f983(++_0x52dd06);}(_0x04f5,0x11d));var _0x504f=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x04f5[_0x4cce65];return _0x4d1b45;};'use strict';var _=require(_0x504f('0x0'));var util=require(_0x504f('0x1'));var moment=require(_0x504f('0x2'));var BPromise=require(_0x504f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x504f('0x4'));var db=require(_0x504f('0x5'))['db'];var utils=require(_0x504f('0x6'));var logger=require(_0x504f('0x7'))(_0x504f('0x8'));var config=require(_0x504f('0x9'));var jayson=require(_0x504f('0xa'));var client=jayson[_0x504f('0xb')][_0x504f('0xc')]({'port':0x232a});config['redis']=_[_0x504f('0xd')](config[_0x504f('0xe')],{'host':_0x504f('0xf'),'port':0x18eb});var socket=require(_0x504f('0x10'))(new Redis(config[_0x504f('0xe')]));require(_0x504f('0x11'))[_0x504f('0x12')](socket);function respondWithRpcPromise(_0x5f56f,_0x2792e3,_0xcbef55){return new BPromise(function(_0x2c7df5,_0x2b55db){return client[_0x504f('0x13')](_0x5f56f,_0xcbef55)[_0x504f('0x14')](function(_0x5152cd){logger[_0x504f('0x15')](_0x504f('0x16'),_0x2792e3,'request\x20sent');logger['debug'](_0x504f('0x17'),_0x2792e3,_0x504f('0x18'),JSON[_0x504f('0x19')](_0x5152cd));if(_0x5152cd['error']){if(_0x5152cd[_0x504f('0x1a')]['code']===0x1f4){logger['error'](_0x504f('0x16'),_0x2792e3,_0x5152cd[_0x504f('0x1a')]['message']);return _0x2b55db(_0x5152cd[_0x504f('0x1a')][_0x504f('0x1b')]);}logger[_0x504f('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2792e3,_0x5152cd[_0x504f('0x1a')][_0x504f('0x1b')]);return _0x2c7df5(_0x5152cd[_0x504f('0x1a')][_0x504f('0x1b')]);}else{logger[_0x504f('0x15')](_0x504f('0x16'),_0x2792e3,'request\x20sent');_0x2c7df5(_0x5152cd[_0x504f('0x1c')][_0x504f('0x1b')]);}})[_0x504f('0x1d')](function(_0x42ba31){logger[_0x504f('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2792e3,_0x42ba31);_0x2b55db(_0x42ba31);});});}exports[_0x504f('0x1e')]=function(_0x22eeea){var _0x3bbfc6=this;return new Promise(function(_0x304ef9,_0x340c63){return db[_0x504f('0x1f')]['update'](_0x22eeea[_0x504f('0x20')],{'raw':_0x22eeea[_0x504f('0x21')]?_0x22eeea['options'][_0x504f('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22eeea[_0x504f('0x21')]?_0x22eeea[_0x504f('0x21')][_0x504f('0x23')]||null:null,'attributes':_0x22eeea[_0x504f('0x21')]?_0x22eeea[_0x504f('0x21')]['attributes']||null:null,'limit':_0x22eeea['options']?_0x22eeea[_0x504f('0x21')][_0x504f('0x24')]||null:null})[_0x504f('0x14')](function(_0x411e01){logger[_0x504f('0x15')](_0x504f('0x1e'),_0x22eeea);logger['debug'](_0x504f('0x1e'),_0x22eeea,JSON[_0x504f('0x19')](_0x411e01));_0x304ef9(_0x411e01);})['catch'](function(_0x5b0184){logger[_0x504f('0x1a')]('UpdateOpenchannelInteraction',_0x5b0184[_0x504f('0x1b')],_0x22eeea);_0x340c63(_0x3bbfc6[_0x504f('0x1a')](0x1f4,_0x5b0184['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x478396){return new Promise(function(_0x298e38,_0x4d9a15){return db[_0x504f('0x1f')][_0x504f('0x25')]({'where':_0x478396['options']?_0x478396[_0x504f('0x21')][_0x504f('0x23')]||null:null})['then'](function(_0x18f1b9){if(_0x18f1b9){return _0x18f1b9[_0x504f('0x26')](_0x478396[_0x504f('0x20')][_0x504f('0x27')],_[_0x504f('0x28')](_0x478396['body'],[_0x504f('0x27'),'id'])||{});}})['spread'](function(_0x3d34fa){logger[_0x504f('0x15')](_0x504f('0x29'),_0x478396);logger[_0x504f('0x2a')](_0x504f('0x29'),_0x478396,JSON[_0x504f('0x19')](_0x3d34fa));_0x298e38(_0x3d34fa);})[_0x504f('0x1d')](function(_0x370c66){logger['error'](_0x504f('0x29'),_0x370c66['message'],_0x478396);_0x4d9a15(_this['error'](0x1f4,_0x370c66[_0x504f('0x1b')]));});});}; \ No newline at end of file +var _0xad51=['raw','attributes','debug','AddTagsToOpenchannelInteraction','find','where','body','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options'];(function(_0x30381e,_0x2a1f30){var _0x9fb2f3=function(_0x467138){while(--_0x467138){_0x30381e['push'](_0x30381e['shift']());}};_0x9fb2f3(++_0x2a1f30);}(_0xad51,0x17c));var _0x1ad5=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xad51[_0x257a28];return _0x13bccc;};'use strict';var _=require(_0x1ad5('0x0'));var util=require(_0x1ad5('0x1'));var moment=require(_0x1ad5('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ad5('0x3'));var fs=require('fs');var Redis=require(_0x1ad5('0x4'));var db=require(_0x1ad5('0x5'))['db'];var utils=require(_0x1ad5('0x6'));var logger=require('../../config/logger')(_0x1ad5('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ad5('0x8'));var client=jayson[_0x1ad5('0x9')][_0x1ad5('0xa')]({'port':0x232a});config[_0x1ad5('0xb')]=_[_0x1ad5('0xc')](config[_0x1ad5('0xb')],{'host':_0x1ad5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ad5('0xb')]));require(_0x1ad5('0xe'))[_0x1ad5('0xf')](socket);function respondWithRpcPromise(_0x382d15,_0x5d6c5e,_0xc285b7){return new BPromise(function(_0x3ade0c,_0x434cee){return client[_0x1ad5('0x10')](_0x382d15,_0xc285b7)[_0x1ad5('0x11')](function(_0x5e38ba){logger[_0x1ad5('0x12')](_0x1ad5('0x13'),_0x5d6c5e,_0x1ad5('0x14'));logger['debug'](_0x1ad5('0x15'),_0x5d6c5e,_0x1ad5('0x14'),JSON[_0x1ad5('0x16')](_0x5e38ba));if(_0x5e38ba[_0x1ad5('0x17')]){if(_0x5e38ba[_0x1ad5('0x17')]['code']===0x1f4){logger[_0x1ad5('0x17')](_0x1ad5('0x13'),_0x5d6c5e,_0x5e38ba['error'][_0x1ad5('0x18')]);return _0x434cee(_0x5e38ba[_0x1ad5('0x17')][_0x1ad5('0x18')]);}logger[_0x1ad5('0x17')](_0x1ad5('0x13'),_0x5d6c5e,_0x5e38ba[_0x1ad5('0x17')][_0x1ad5('0x18')]);return _0x3ade0c(_0x5e38ba['error']['message']);}else{logger[_0x1ad5('0x12')](_0x1ad5('0x13'),_0x5d6c5e,'request\x20sent');_0x3ade0c(_0x5e38ba['result'][_0x1ad5('0x18')]);}})[_0x1ad5('0x19')](function(_0x4a2d3c){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5d6c5e,_0x4a2d3c);_0x434cee(_0x4a2d3c);});});}exports[_0x1ad5('0x1a')]=function(_0x12c4f9){var _0xe7df26=this;return new Promise(function(_0x5f1f11,_0x5c34f1){return db[_0x1ad5('0x1b')][_0x1ad5('0x1c')](_0x12c4f9['body'],{'raw':_0x12c4f9[_0x1ad5('0x1d')]?_0x12c4f9[_0x1ad5('0x1d')][_0x1ad5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c4f9[_0x1ad5('0x1d')]?_0x12c4f9['options']['where']||null:null,'attributes':_0x12c4f9[_0x1ad5('0x1d')]?_0x12c4f9[_0x1ad5('0x1d')][_0x1ad5('0x1f')]||null:null,'limit':_0x12c4f9['options']?_0x12c4f9[_0x1ad5('0x1d')]['limit']||null:null})[_0x1ad5('0x11')](function(_0x384bf7){logger[_0x1ad5('0x12')](_0x1ad5('0x1a'),_0x12c4f9);logger[_0x1ad5('0x20')](_0x1ad5('0x1a'),_0x12c4f9,JSON[_0x1ad5('0x16')](_0x384bf7));_0x5f1f11(_0x384bf7);})[_0x1ad5('0x19')](function(_0x21ec8e){logger['error'](_0x1ad5('0x1a'),_0x21ec8e[_0x1ad5('0x18')],_0x12c4f9);_0x5c34f1(_0xe7df26['error'](0x1f4,_0x21ec8e[_0x1ad5('0x18')]));});});};exports[_0x1ad5('0x21')]=function(_0x35d9d0){return new Promise(function(_0x3dafe4,_0x33c6e8){return db[_0x1ad5('0x1b')][_0x1ad5('0x22')]({'where':_0x35d9d0[_0x1ad5('0x1d')]?_0x35d9d0[_0x1ad5('0x1d')][_0x1ad5('0x23')]||null:null})[_0x1ad5('0x11')](function(_0x328e8d){if(_0x328e8d){return _0x328e8d['addTags'](_0x35d9d0[_0x1ad5('0x24')]['ids'],_[_0x1ad5('0x25')](_0x35d9d0['body'],[_0x1ad5('0x26'),'id'])||{});}})[_0x1ad5('0x27')](function(_0x53610a){logger[_0x1ad5('0x12')](_0x1ad5('0x28'),_0x35d9d0);logger[_0x1ad5('0x20')](_0x1ad5('0x28'),_0x35d9d0,JSON[_0x1ad5('0x16')](_0x53610a));_0x3dafe4(_0x53610a);})[_0x1ad5('0x19')](function(_0x4a3bea){logger[_0x1ad5('0x17')]('AddTags',_0x4a3bea[_0x1ad5('0x18')],_0x35d9d0);_0x33c6e8(_this[_0x1ad5('0x17')](0x1f4,_0x4a3bea[_0x1ad5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c2a7d97..63e64a1 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 _0x40d7=['save','remove','emit','length','./openchannelInteraction.events'];(function(_0x1eb115,_0x37d12b){var _0x54a74f=function(_0x102f5b){while(--_0x102f5b){_0x1eb115['push'](_0x1eb115['shift']());}};_0x54a74f(++_0x37d12b);}(_0x40d7,0x130));var _0x740d=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x40d7[_0x5550b3];return _0x4b8fc4;};'use strict';var OpenchannelInteractionEvents=require(_0x740d('0x0'));var events=[_0x740d('0x1'),_0x740d('0x2'),'update'];function createListener(_0x4fac08,_0x131e0e){return function(_0x28389a){_0x131e0e[_0x740d('0x3')](_0x4fac08,_0x28389a);};}function removeListener(_0x518d6a,_0x35f63a){return function(){OpenchannelInteractionEvents['removeListener'](_0x518d6a,_0x35f63a);};}exports['register']=function(_0x96df6d){for(var _0xc15965=0x0,_0x336603=events[_0x740d('0x4')];_0xc15965<_0x336603;_0xc15965++){var _0x46771a=events[_0xc15965];var _0x581c5c=createListener('openchannelInteraction:'+_0x46771a,_0x96df6d);OpenchannelInteractionEvents['on'](_0x46771a,_0x581c5c);}}; \ No newline at end of file +var _0xe433=['emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x2ff62a,_0x1c2808){var _0x222a2a=function(_0x1ec379){while(--_0x1ec379){_0x2ff62a['push'](_0x2ff62a['shift']());}};_0x222a2a(++_0x1c2808);}(_0xe433,0xc8));var _0x3e43=function(_0x1876e0,_0x20f888){_0x1876e0=_0x1876e0-0x0;var _0x262ddf=_0xe433[_0x1876e0];return _0x262ddf;};'use strict';var OpenchannelInteractionEvents=require(_0x3e43('0x0'));var events=[_0x3e43('0x1'),_0x3e43('0x2'),'update'];function createListener(_0x5e8a90,_0x341c16){return function(_0x326493){_0x341c16[_0x3e43('0x3')](_0x5e8a90,_0x326493);};}function removeListener(_0x45d63c,_0x58a23b){return function(){OpenchannelInteractionEvents[_0x3e43('0x4')](_0x45d63c,_0x58a23b);};}exports[_0x3e43('0x5')]=function(_0xbc918){for(var _0x536664=0x0,_0x3e088c=events['length'];_0x536664<_0x3e088c;_0x536664++){var _0x1b3c1d=events[_0x536664];var _0x496932=createListener(_0x3e43('0x6')+_0x1b3c1d,_0xbc918);OpenchannelInteractionEvents['on'](_0x1b3c1d,_0x496932);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b0a07b8..657ee3d 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x5ecb82,_0x180c9b){var _0x2ad0a0=function(_0x21acc8){while(--_0x21acc8){_0x5ecb82['push'](_0x5ecb82['shift']());}};_0x2ad0a0(++_0x180c9b);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d66b4,_0x2a7cd9){_0x1d66b4=_0x1d66b4-0x0;var _0x28bcfb=_0xedd9[_0x1d66b4];return _0x28bcfb;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x50e8c0,_0x52ceb9){_0x50e8c0=_0x50e8c0-0x0;var _0x30b416=_0x70e0[_0x50e8c0];return _0x30b416;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);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 4a6f6c8..5156236 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 _0x0825=['TEXT','sequelize','exports','BOOLEAN','out','DATE','STRING'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x0825,0x1e4));var _0x5082=function(_0x1c4f21,_0x300004){_0x1c4f21=_0x1c4f21-0x0;var _0x38f017=_0x0825[_0x1c4f21];return _0x38f017;};'use strict';var Sequelize=require(_0x5082('0x0'));module[_0x5082('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5082('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5082('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5082('0x3')),'defaultValue':_0x5082('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5082('0x4')]},'providerName':{'type':Sequelize[_0x5082('0x5')]},'providerResponse':{'type':Sequelize[_0x5082('0x6')]}}; \ No newline at end of file +var _0xae87=['STRING','TEXT','BOOLEAN','out'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xae87,0x1ce));var _0x7ae8=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xae87[_0x141e03];return _0x2074e3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7ae8('0x0')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7ae8('0x0')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7ae8('0x1')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7ae8('0x2')]},'providerResponse':{'type':Sequelize[_0x7ae8('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 25952b8..cf2612b 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 _0x9a3d=['model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','findAll','rows','show','params','length','include','create','body','update','find','describe','openchannel-interactions','openchannel','read','readAt','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','sequelize','QueryTypes','event','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','key'];(function(_0x5cdf72,_0x537fe4){var _0x3058ee=function(_0x394808){while(--_0x394808){_0x5cdf72['push'](_0x5cdf72['shift']());}};_0x3058ee(++_0x537fe4);}(_0x9a3d,0x14e));var _0xd9a3=function(_0x493ea0,_0x80a728){_0x493ea0=_0x493ea0-0x0;var _0x105e0f=_0x9a3d[_0x493ea0];return _0x105e0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9a3('0x0'));var zipdir=require(_0xd9a3('0x1'));var jsonpatch=require(_0xd9a3('0x2'));var rp=require(_0xd9a3('0x3'));var moment=require(_0xd9a3('0x4'));var BPromise=require(_0xd9a3('0x5'));var Mustache=require('mustache');var util=require(_0xd9a3('0x6'));var path=require(_0xd9a3('0x7'));var sox=require(_0xd9a3('0x8'));var csv=require(_0xd9a3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9a3('0xa'));var _=require(_0xd9a3('0xb'));var squel=require(_0xd9a3('0xc'));var crypto=require(_0xd9a3('0xd'));var jsforce=require(_0xd9a3('0xe'));var deskjs=require(_0xd9a3('0xf'));var toCsv=require(_0xd9a3('0x9'));var querystring=require(_0xd9a3('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9a3('0x11'));var authService=require(_0xd9a3('0x12'));var qs=require(_0xd9a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a3('0x14'));var logger=require(_0xd9a3('0x15'))('api');var utils=require(_0xd9a3('0x16'));var config=require(_0xd9a3('0x17'));var licenseUtil=require(_0xd9a3('0x18'));var db=require(_0xd9a3('0x19'))['db'];config[_0xd9a3('0x1a')]=_[_0xd9a3('0x1b')](config[_0xd9a3('0x1a')],{'host':_0xd9a3('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9a3('0x1a')]));require(_0xd9a3('0x1d'))[_0xd9a3('0x1e')](socket);var jayson=require(_0xd9a3('0x1f'));var client=jayson[_0xd9a3('0x20')][_0xd9a3('0x21')]({'port':0x232c});var client9002=jayson[_0xd9a3('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f497a,_0x5107ee,_0x5ab52d,_0x441acb){return new BPromise(function(_0x4a1a5a,_0x544e09){var _0xbdeb3e=_0x441acb||client;return _0xbdeb3e[_0xd9a3('0x22')](_0x2f497a,_0x5ab52d)['then'](function(_0x4a3b56){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5107ee,'request\x20sent');logger[_0xd9a3('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5107ee,_0xd9a3('0x24'),JSON[_0xd9a3('0x25')](_0x4a3b56));if(_0x4a3b56['error']){if(_0x4a3b56[_0xd9a3('0x26')][_0xd9a3('0x27')]===0x1f4){logger[_0xd9a3('0x26')](_0xd9a3('0x28'),_0x5107ee,_0x4a3b56[_0xd9a3('0x26')][_0xd9a3('0x29')]);return _0x544e09(_0x4a3b56[_0xd9a3('0x26')]['message']);}logger[_0xd9a3('0x26')](_0xd9a3('0x28'),_0x5107ee,_0x4a3b56[_0xd9a3('0x26')][_0xd9a3('0x29')]);return _0x4a1a5a(_0x4a3b56[_0xd9a3('0x26')][_0xd9a3('0x29')]);}else{logger['info'](_0xd9a3('0x28'),_0x5107ee,_0xd9a3('0x24'));_0x4a1a5a(_0x4a3b56[_0xd9a3('0x2a')][_0xd9a3('0x29')]);}})[_0xd9a3('0x2b')](function(_0x41baff){logger[_0xd9a3('0x26')](_0xd9a3('0x28'),_0x5107ee,_0x41baff);_0x544e09(_0x41baff);});});}function respondWithStatusCode(_0x4864a6,_0x10250a){_0x10250a=_0x10250a||0xcc;return function(_0x31ebd5){if(_0x31ebd5){return _0x4864a6[_0xd9a3('0x2c')](_0x10250a);}return _0x4864a6['status'](_0x10250a)[_0xd9a3('0x2d')]();};}function respondWithResult(_0x4c57fa,_0x41369e){_0x41369e=_0x41369e||0xc8;return function(_0x3c7673){if(_0x3c7673){return _0x4c57fa[_0xd9a3('0x2e')](_0x41369e)[_0xd9a3('0x2f')](_0x3c7673);}};}function respondWithFilteredResult(_0x12f0e6,_0x374222){return function(_0x1e9500){if(_0x1e9500){var _0x3c99f8=typeof _0x374222['offset']===_0xd9a3('0x30')&&typeof _0x374222[_0xd9a3('0x31')]===_0xd9a3('0x30');var _0x5e8555=_0x1e9500[_0xd9a3('0x32')];var _0x3024a6=_0x3c99f8?0x0:_0x374222['offset'];var _0x479c48=_0x3c99f8?_0x1e9500[_0xd9a3('0x32')]:_0x374222[_0xd9a3('0x33')]+_0x374222[_0xd9a3('0x31')];var _0x5a77bf;if(_0x479c48>=_0x5e8555){_0x479c48=_0x5e8555;_0x5a77bf=0xc8;}else{_0x5a77bf=0xce;}_0x12f0e6[_0xd9a3('0x2e')](_0x5a77bf);return _0x12f0e6[_0xd9a3('0x34')](_0xd9a3('0x35'),_0x3024a6+'-'+_0x479c48+'/'+_0x5e8555)[_0xd9a3('0x2f')](_0x1e9500);}return null;};}function patchUpdates(_0x255d1d){return function(_0x20e7cb){try{jsonpatch['apply'](_0x20e7cb,_0x255d1d,!![]);}catch(_0x45e143){return BPromise[_0xd9a3('0x36')](_0x45e143);}return _0x20e7cb[_0xd9a3('0x37')]();};}function saveUpdates(_0x5426e3,_0x24507d){return function(_0x1188cd){if(_0x1188cd){return _0x1188cd['update'](_0x5426e3)[_0xd9a3('0x38')](function(_0x31bc82){return _0x31bc82;});}return null;};}function removeEntity(_0x5557be,_0x568468){return function(_0x51921b){if(_0x51921b){return _0x51921b[_0xd9a3('0x39')]()[_0xd9a3('0x38')](function(){_0x5557be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2ff1,_0x204cfa){return function(_0x219fc2){if(!_0x219fc2){_0x5c2ff1['sendStatus'](0x194);}return _0x219fc2;};}function handleError(_0x15ae5b,_0xd85174){_0xd85174=_0xd85174||0x1f4;return function(_0x19d3a4){logger[_0xd9a3('0x26')](_0x19d3a4[_0xd9a3('0x3a')]);if(_0x19d3a4[_0xd9a3('0x3b')]){delete _0x19d3a4[_0xd9a3('0x3b')];}_0x15ae5b[_0xd9a3('0x2e')](_0xd85174)[_0xd9a3('0x3c')](_0x19d3a4);};}exports['index']=function(_0x301486,_0x24ddfc){var _0x7c4ba0={},_0x4e4f71={},_0x272735={'count':0x0,'rows':[]};var _0x9633fd=_[_0xd9a3('0x3d')](db[_0xd9a3('0x3e')][_0xd9a3('0x3f')],function(_0xe0a174){return{'name':_0xe0a174['fieldName'],'type':_0xe0a174['type'][_0xd9a3('0x40')]};});_0x4e4f71[_0xd9a3('0x41')]=_[_0xd9a3('0x3d')](_0x9633fd,'name');_0x4e4f71['query']=_[_0xd9a3('0x42')](_0x301486[_0xd9a3('0x43')]);_0x4e4f71[_0xd9a3('0x44')]=_[_0xd9a3('0x45')](_0x4e4f71['model'],_0x4e4f71['query']);_0x7c4ba0[_0xd9a3('0x46')]=_[_0xd9a3('0x45')](_0x4e4f71[_0xd9a3('0x41')],qs[_0xd9a3('0x47')](_0x301486[_0xd9a3('0x43')][_0xd9a3('0x47')]));_0x7c4ba0[_0xd9a3('0x46')]=_0x7c4ba0[_0xd9a3('0x46')]['length']?_0x7c4ba0[_0xd9a3('0x46')]:_0x4e4f71[_0xd9a3('0x41')];if(!_0x301486[_0xd9a3('0x43')][_0xd9a3('0x48')]('nolimit')){_0x7c4ba0[_0xd9a3('0x31')]=qs[_0xd9a3('0x31')](_0x301486[_0xd9a3('0x43')][_0xd9a3('0x31')]);_0x7c4ba0[_0xd9a3('0x33')]=qs[_0xd9a3('0x33')](_0x301486[_0xd9a3('0x43')][_0xd9a3('0x33')]);}_0x7c4ba0[_0xd9a3('0x49')]=qs[_0xd9a3('0x4a')](_0x301486[_0xd9a3('0x43')][_0xd9a3('0x4a')]);_0x7c4ba0[_0xd9a3('0x4b')]=qs[_0xd9a3('0x44')](_[_0xd9a3('0x4c')](_0x301486[_0xd9a3('0x43')],_0x4e4f71['filters']),_0x9633fd);if(_0x301486[_0xd9a3('0x43')][_0xd9a3('0x4d')]){_0x7c4ba0[_0xd9a3('0x4b')]=_['merge'](_0x7c4ba0[_0xd9a3('0x4b')],{'$or':_[_0xd9a3('0x3d')](_0x9633fd,function(_0x13304b){if(_0x13304b[_0xd9a3('0x4e')]!==_0xd9a3('0x4f')){var _0x24b6c4={};_0x24b6c4[_0x13304b[_0xd9a3('0x3b')]]={'$like':'%'+_0x301486['query']['filter']+'%'};return _0x24b6c4;}})});}_0x7c4ba0=_[_0xd9a3('0x50')]({},_0x7c4ba0,_0x301486[_0xd9a3('0x51')]);var _0x360aaf={'where':_0x7c4ba0[_0xd9a3('0x4b')]};return db[_0xd9a3('0x3e')][_0xd9a3('0x32')](_0x360aaf)[_0xd9a3('0x38')](function(_0x3f712d){_0x272735[_0xd9a3('0x32')]=_0x3f712d;if(_0x301486[_0xd9a3('0x43')]['includeAll']){_0x7c4ba0['include']=[{'all':!![]}];}return db[_0xd9a3('0x3e')][_0xd9a3('0x52')](_0x7c4ba0);})[_0xd9a3('0x38')](function(_0x4131c5){_0x272735[_0xd9a3('0x53')]=_0x4131c5;return _0x272735;})[_0xd9a3('0x38')](respondWithFilteredResult(_0x24ddfc,_0x7c4ba0))['catch'](handleError(_0x24ddfc,null));};exports[_0xd9a3('0x54')]=function(_0x266d7a,_0x15e2ce){var _0x556a59={'raw':!![],'where':{'id':_0x266d7a[_0xd9a3('0x55')]['id']}},_0x4d5c5d={};_0x4d5c5d[_0xd9a3('0x41')]=_['keys'](db[_0xd9a3('0x3e')]['rawAttributes']);_0x4d5c5d[_0xd9a3('0x43')]=_['keys'](_0x266d7a[_0xd9a3('0x43')]);_0x4d5c5d[_0xd9a3('0x44')]=_[_0xd9a3('0x45')](_0x4d5c5d['model'],_0x4d5c5d[_0xd9a3('0x43')]);_0x556a59[_0xd9a3('0x46')]=_[_0xd9a3('0x45')](_0x4d5c5d['model'],qs[_0xd9a3('0x47')](_0x266d7a['query'][_0xd9a3('0x47')]));_0x556a59[_0xd9a3('0x46')]=_0x556a59[_0xd9a3('0x46')][_0xd9a3('0x56')]?_0x556a59[_0xd9a3('0x46')]:_0x4d5c5d[_0xd9a3('0x41')];if(_0x266d7a[_0xd9a3('0x43')]['includeAll']){_0x556a59[_0xd9a3('0x57')]=[{'all':!![]}];}_0x556a59=_['merge']({},_0x556a59,_0x266d7a[_0xd9a3('0x51')]);return db[_0xd9a3('0x3e')]['find'](_0x556a59)[_0xd9a3('0x38')](handleEntityNotFound(_0x15e2ce,null))[_0xd9a3('0x38')](respondWithResult(_0x15e2ce,null))[_0xd9a3('0x2b')](handleError(_0x15e2ce,null));};exports[_0xd9a3('0x58')]=function(_0x5eb9cd,_0xcbdb78){return db['OpenchannelMessage'][_0xd9a3('0x58')](_0x5eb9cd[_0xd9a3('0x59')],{})[_0xd9a3('0x38')](respondWithResult(_0xcbdb78,0xc9))[_0xd9a3('0x2b')](handleError(_0xcbdb78,null));};exports[_0xd9a3('0x5a')]=function(_0x345bc5,_0x1fd643){if(_0x345bc5[_0xd9a3('0x59')]['id']){delete _0x345bc5[_0xd9a3('0x59')]['id'];}return db[_0xd9a3('0x3e')][_0xd9a3('0x5b')]({'where':{'id':_0x345bc5[_0xd9a3('0x55')]['id']}})[_0xd9a3('0x38')](handleEntityNotFound(_0x1fd643,null))[_0xd9a3('0x38')](saveUpdates(_0x345bc5[_0xd9a3('0x59')],null))['then'](respondWithResult(_0x1fd643,null))[_0xd9a3('0x2b')](handleError(_0x1fd643,null));};exports['destroy']=function(_0x5a59da,_0xeed477){return db[_0xd9a3('0x3e')]['find']({'where':{'id':_0x5a59da[_0xd9a3('0x55')]['id']}})[_0xd9a3('0x38')](handleEntityNotFound(_0xeed477,null))[_0xd9a3('0x38')](removeEntity(_0xeed477,null))['catch'](handleError(_0xeed477,null));};exports[_0xd9a3('0x5c')]=function(_0x1ccd3e,_0x112df8){return db[_0xd9a3('0x3e')][_0xd9a3('0x5c')]()[_0xd9a3('0x38')](respondWithResult(_0x112df8,null))[_0xd9a3('0x2b')](handleError(_0x112df8,null));};var interaction_log=require(_0xd9a3('0x15'))(_0xd9a3('0x5d'));exports['accept']=function(_0x340c77,_0x30d0a4,_0x284a6a){var _0x5561f5={'agent':{},'channel':_0xd9a3('0x5e')};if(_0x340c77[_0xd9a3('0x59')]['id']){delete _0x340c77[_0xd9a3('0x59')]['id'];}_0x340c77[_0xd9a3('0x59')][_0xd9a3('0x5f')]=!![];_0x340c77[_0xd9a3('0x59')][_0xd9a3('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x340c77[_0xd9a3('0x59')][_0xd9a3('0x61')]=_0x340c77['body'][_0xd9a3('0x61')]||_0x340c77[_0xd9a3('0x62')]['id'];_0x5561f5[_0xd9a3('0x63')]['id']=_0x340c77['body'][_0xd9a3('0x61')];return db[_0xd9a3('0x3e')][_0xd9a3('0x5b')]({'where':{'id':_0x340c77[_0xd9a3('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30d0a4,null))[_0xd9a3('0x38')](saveUpdates(_0x340c77['body'],null))['then'](function(_0x2fac70){if(_0x2fac70){_0x5561f5[_0xd9a3('0x29')]=_0x2fac70[_0xd9a3('0x64')]({'plain':!![]});return db[_0xd9a3('0x65')][_0xd9a3('0x5b')]({'where':{'id':_0x2fac70[_0xd9a3('0x66')]}});}return null;})[_0xd9a3('0x38')](handleEntityNotFound(_0x30d0a4,null))[_0xd9a3('0x38')](function(_0x18ac11){if(_0x18ac11){return _0x18ac11['update']({'UserId':_0x340c77[_0xd9a3('0x59')][_0xd9a3('0x61')],'read1stAt':_[_0xd9a3('0x67')](_0x18ac11[_0xd9a3('0x68')])?moment()[_0xd9a3('0x69')](_0xd9a3('0x6a')):undefined});}return null;})['then'](function(_0x2911a5){if(_0x2911a5){_0x5561f5[_0xd9a3('0x6b')]=_0x2911a5[_0xd9a3('0x64')]({'plain':!![]});interaction_log[_0xd9a3('0x6c')](_0xd9a3('0x6d'),_0x340c77[_0xd9a3('0x62')]['id'],_0x340c77['user'][_0xd9a3('0x3b')],_0x340c77[_0xd9a3('0x62')]['role'],_0x5561f5[_0xd9a3('0x6b')]['id'],_0x340c77[_0xd9a3('0x59')]?JSON[_0xd9a3('0x25')](_0x340c77[_0xd9a3('0x59')]):_0xd9a3('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5561f5);}return null;})[_0xd9a3('0x38')](function(_0x3fc109){var _0x2406f3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3fc109[_0xd9a3('0x29')][_0xd9a3('0x6f')];return db['sequelize'][_0xd9a3('0x43')](_0x2406f3,{'type':db[_0xd9a3('0x70')]['QueryTypes'][_0xd9a3('0x71')],'raw':!![]})[_0xd9a3('0x38')](function(_0x76d565){return _0x76d565;});})[_0xd9a3('0x38')](function(_0x58db31){if(_0x58db31){_0x5561f5[_0xd9a3('0x29')][_0xd9a3('0x72')]=_0x58db31[0x0];if(!_0x340c77['body'][_0xd9a3('0x61')])return;return db[_0xd9a3('0x73')][_0xd9a3('0x5b')]({'where':{'id':_0x340c77[_0xd9a3('0x59')][_0xd9a3('0x61')],'role':'agent'},'attributes':['id',_0xd9a3('0x3b'),_0xd9a3('0x74'),_0xd9a3('0x75'),_0xd9a3('0x76')],'raw':!![]});}return null;})[_0xd9a3('0x38')](function(_0x20b66f){if(!_0x20b66f)return null;_0x5561f5[_0xd9a3('0x29')][_0xd9a3('0x63')]=_0x20b66f;return _0x5561f5;})[_0xd9a3('0x38')](function(_0x415604){if(_0x415604){if(_0x340c77[_0xd9a3('0x59')][_0xd9a3('0x77')]){_0x5561f5[_0xd9a3('0x29')][_0xd9a3('0x78')]=util[_0xd9a3('0x69')](_0xd9a3('0x79'),_0x340c77[_0xd9a3('0x62')][_0xd9a3('0x3b')]);_0x5561f5[_0xd9a3('0x29')][_0xd9a3('0x7a')]=_0x5561f5[_0xd9a3('0x7a')];_0x5561f5[_0xd9a3('0x29')][_0xd9a3('0x7b')]=_0x5561f5[_0xd9a3('0x7a')];_0x5561f5[_0xd9a3('0x29')]['event']=_0xd9a3('0x7c');return respondWithRpcPromise(_0xd9a3('0x7d'),_0xd9a3('0x7d'),{'event':_0xd9a3('0x7e'),'message':_0x5561f5[_0xd9a3('0x29')]},client9002)['then'](function(){return _0x5561f5;});}return _0x5561f5;}return null;})[_0xd9a3('0x38')](respondWithResult(_0x30d0a4,null))['catch'](handleError(_0x30d0a4,null));};var interaction_log=require('../../config/logger')(_0xd9a3('0x5d'));exports[_0xd9a3('0x36')]=function(_0x567450,_0x2ed884,_0x2d8f24){var _0x508eb7={'agent':{},'channel':'openchannel'};if(_0x567450[_0xd9a3('0x59')]['id']){delete _0x567450[_0xd9a3('0x59')]['id'];}_0x567450[_0xd9a3('0x59')][_0xd9a3('0x61')]=_0x567450[_0xd9a3('0x59')][_0xd9a3('0x61')]||_0x567450['user']['id'];_0x508eb7[_0xd9a3('0x63')]['id']=_0x567450[_0xd9a3('0x59')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x567450[_0xd9a3('0x55')]['id'],'UserId':null}})[_0xd9a3('0x38')](handleEntityNotFound(_0x2ed884,null))[_0xd9a3('0x38')](function(_0x643a64){if(_0x643a64){_0x508eb7[_0xd9a3('0x29')]=_0x643a64[_0xd9a3('0x64')]({'plain':!![]});return db[_0xd9a3('0x65')]['find']({'where':{'id':_0x643a64[_0xd9a3('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2ed884,null))[_0xd9a3('0x38')](function(_0x336b21){if(_0x336b21){_0x508eb7['interaction']=_0x336b21[_0xd9a3('0x64')]({'plain':!![]});interaction_log['info'](_0xd9a3('0x7f'),_0x567450[_0xd9a3('0x62')]['id'],_0x567450[_0xd9a3('0x62')][_0xd9a3('0x3b')],_0x567450[_0xd9a3('0x62')][_0xd9a3('0x80')],_0x508eb7[_0xd9a3('0x6b')]['id'],_0x567450['body']?JSON[_0xd9a3('0x25')](_0x567450[_0xd9a3('0x59')]):_0xd9a3('0x6e'));return respondWithRpcPromise('RejectMessage',_0xd9a3('0x81'),_0x508eb7);}return null;})[_0xd9a3('0x38')](function(_0x5b11b8){var _0x4fd99e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b11b8[_0xd9a3('0x29')][_0xd9a3('0x6f')];return db[_0xd9a3('0x82')]['query'](_0x4fd99e,{'type':db[_0xd9a3('0x70')][_0xd9a3('0x83')][_0xd9a3('0x71')],'raw':!![]})[_0xd9a3('0x38')](function(_0x2d021f){return _0x2d021f;});})[_0xd9a3('0x38')](function(_0x60d2d3){if(_0x60d2d3){_0x508eb7[_0xd9a3('0x29')][_0xd9a3('0x72')]=_0x60d2d3[0x0];if(!_0x567450[_0xd9a3('0x59')][_0xd9a3('0x61')])return;return db['User'][_0xd9a3('0x5b')]({'where':{'id':_0x567450[_0xd9a3('0x59')][_0xd9a3('0x61')],'role':_0xd9a3('0x63')},'attributes':['id',_0xd9a3('0x3b'),_0xd9a3('0x74'),_0xd9a3('0x75'),_0xd9a3('0x76')],'raw':!![]});}return null;})[_0xd9a3('0x38')](function(_0x43993c){if(!_0x43993c)return null;_0x508eb7[_0xd9a3('0x29')]['agent']=_0x43993c;return _0x508eb7;})[_0xd9a3('0x38')](function(_0x257842){if(_0x257842){_0x257842[_0xd9a3('0x29')][_0xd9a3('0x78')]=util[_0xd9a3('0x69')](_0xd9a3('0x79'),_0x567450[_0xd9a3('0x62')][_0xd9a3('0x3b')]);_0x257842[_0xd9a3('0x29')]['channel']=_0x508eb7['channel'];_0x257842[_0xd9a3('0x29')]['motionChannel']=_0x508eb7['channel'];_0x257842['message'][_0xd9a3('0x84')]=_0xd9a3('0x36');respondWithRpcPromise('EventManager',_0xd9a3('0x7d'),{'event':'rejectmessage','message':_0x257842[_0xd9a3('0x29')]},client9002);return _0x508eb7;}return null;})[_0xd9a3('0x38')](respondWithResult(_0x2ed884,null))[_0xd9a3('0x2b')](handleError(_0x2ed884,null));}; \ No newline at end of file +var _0x0a29=['sort','filter','where','type','VIRTUAL','options','includeAll','show','include','merge','create','body','params','destroy','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','contact','email','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','stack','name','index','map','OpenchannelMessage','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit'];(function(_0x21eb04,_0x5c34ed){var _0x16c749=function(_0x284e90){while(--_0x284e90){_0x21eb04['push'](_0x21eb04['shift']());}};_0x16c749(++_0x5c34ed);}(_0x0a29,0x134));var _0x90a2=function(_0x1a7304,_0x2baac7){_0x1a7304=_0x1a7304-0x0;var _0x1bce5c=_0x0a29[_0x1a7304];return _0x1bce5c;};'use strict';var emlformat=require(_0x90a2('0x0'));var rimraf=require(_0x90a2('0x1'));var zipdir=require(_0x90a2('0x2'));var jsonpatch=require(_0x90a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x90a2('0x4'));var Mustache=require(_0x90a2('0x5'));var util=require('util');var path=require(_0x90a2('0x6'));var sox=require('sox');var csv=require(_0x90a2('0x7'));var ejs=require(_0x90a2('0x8'));var fs=require('fs');var fs_extra=require(_0x90a2('0x9'));var _=require(_0x90a2('0xa'));var squel=require('squel');var crypto=require(_0x90a2('0xb'));var jsforce=require(_0x90a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x90a2('0x7'));var querystring=require(_0x90a2('0xd'));var Papa=require(_0x90a2('0xe'));var Redis=require(_0x90a2('0xf'));var authService=require(_0x90a2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x90a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90a2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x90a2('0x13'));var licenseUtil=require(_0x90a2('0x14'));var db=require('../../mysqldb')['db'];config[_0x90a2('0x15')]=_[_0x90a2('0x16')](config[_0x90a2('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x90a2('0x17'))(new Redis(config[_0x90a2('0x15')]));require(_0x90a2('0x18'))['register'](socket);var jayson=require(_0x90a2('0x19'));var client=jayson[_0x90a2('0x1a')][_0x90a2('0x1b')]({'port':0x232c});var client9002=jayson[_0x90a2('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f195,_0x496a83,_0x254ae6,_0x15850b){return new BPromise(function(_0xac4c87,_0x2215bb){var _0x28e948=_0x15850b||client;return _0x28e948[_0x90a2('0x1c')](_0x17f195,_0x254ae6)[_0x90a2('0x1d')](function(_0x5c42cc){logger[_0x90a2('0x1e')](_0x90a2('0x1f'),_0x496a83,'request\x20sent');logger[_0x90a2('0x20')](_0x90a2('0x21'),_0x496a83,_0x90a2('0x22'),JSON['stringify'](_0x5c42cc));if(_0x5c42cc['error']){if(_0x5c42cc[_0x90a2('0x23')][_0x90a2('0x24')]===0x1f4){logger[_0x90a2('0x23')](_0x90a2('0x1f'),_0x496a83,_0x5c42cc[_0x90a2('0x23')]['message']);return _0x2215bb(_0x5c42cc['error'][_0x90a2('0x25')]);}logger[_0x90a2('0x23')](_0x90a2('0x1f'),_0x496a83,_0x5c42cc[_0x90a2('0x23')][_0x90a2('0x25')]);return _0xac4c87(_0x5c42cc['error']['message']);}else{logger[_0x90a2('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x496a83,_0x90a2('0x22'));_0xac4c87(_0x5c42cc[_0x90a2('0x26')][_0x90a2('0x25')]);}})[_0x90a2('0x27')](function(_0x535919){logger[_0x90a2('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x496a83,_0x535919);_0x2215bb(_0x535919);});});}function respondWithStatusCode(_0x1e1f2e,_0x2e7f40){_0x2e7f40=_0x2e7f40||0xcc;return function(_0x5718f7){if(_0x5718f7){return _0x1e1f2e[_0x90a2('0x28')](_0x2e7f40);}return _0x1e1f2e['status'](_0x2e7f40)[_0x90a2('0x29')]();};}function respondWithResult(_0x5ebbe9,_0x5228a0){_0x5228a0=_0x5228a0||0xc8;return function(_0x58b265){if(_0x58b265){return _0x5ebbe9[_0x90a2('0x2a')](_0x5228a0)[_0x90a2('0x2b')](_0x58b265);}};}function respondWithFilteredResult(_0x234d8d,_0x476758){return function(_0x31644c){if(_0x31644c){var _0x28a979=typeof _0x476758['offset']==='undefined'&&typeof _0x476758[_0x90a2('0x2c')]===_0x90a2('0x2d');var _0x5f269d=_0x31644c[_0x90a2('0x2e')];var _0x1f5af7=_0x28a979?0x0:_0x476758['offset'];var _0x58d133=_0x28a979?_0x31644c[_0x90a2('0x2e')]:_0x476758[_0x90a2('0x2f')]+_0x476758[_0x90a2('0x2c')];var _0x4ee0d4;if(_0x58d133>=_0x5f269d){_0x58d133=_0x5f269d;_0x4ee0d4=0xc8;}else{_0x4ee0d4=0xce;}_0x234d8d[_0x90a2('0x2a')](_0x4ee0d4);return _0x234d8d[_0x90a2('0x30')](_0x90a2('0x31'),_0x1f5af7+'-'+_0x58d133+'/'+_0x5f269d)[_0x90a2('0x2b')](_0x31644c);}return null;};}function patchUpdates(_0x1fcb35){return function(_0x276253){try{jsonpatch[_0x90a2('0x32')](_0x276253,_0x1fcb35,!![]);}catch(_0x5acfa7){return BPromise[_0x90a2('0x33')](_0x5acfa7);}return _0x276253[_0x90a2('0x34')]();};}function saveUpdates(_0x13b7b7,_0x150f5a){return function(_0x402db7){if(_0x402db7){return _0x402db7[_0x90a2('0x35')](_0x13b7b7)['then'](function(_0x25f039){return _0x25f039;});}return null;};}function removeEntity(_0x3bf358,_0x44595c){return function(_0xab2ad6){if(_0xab2ad6){return _0xab2ad6['destroy']()[_0x90a2('0x1d')](function(){_0x3bf358[_0x90a2('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4470df,_0x3f0a19){return function(_0x4757d5){if(!_0x4757d5){_0x4470df[_0x90a2('0x28')](0x194);}return _0x4757d5;};}function handleError(_0x33f035,_0x345e29){_0x345e29=_0x345e29||0x1f4;return function(_0x3356bb){logger[_0x90a2('0x23')](_0x3356bb[_0x90a2('0x36')]);if(_0x3356bb[_0x90a2('0x37')]){delete _0x3356bb['name'];}_0x33f035[_0x90a2('0x2a')](_0x345e29)['send'](_0x3356bb);};}exports[_0x90a2('0x38')]=function(_0x9c9f33,_0x20fd55){var _0x524b7d={},_0xed06ac={},_0xdc0187={'count':0x0,'rows':[]};var _0x570d36=_[_0x90a2('0x39')](db[_0x90a2('0x3a')][_0x90a2('0x3b')],function(_0x18c9bb){return{'name':_0x18c9bb['fieldName'],'type':_0x18c9bb['type'][_0x90a2('0x3c')]};});_0xed06ac['model']=_[_0x90a2('0x39')](_0x570d36,_0x90a2('0x37'));_0xed06ac[_0x90a2('0x3d')]=_[_0x90a2('0x3e')](_0x9c9f33[_0x90a2('0x3d')]);_0xed06ac[_0x90a2('0x3f')]=_['intersection'](_0xed06ac[_0x90a2('0x40')],_0xed06ac[_0x90a2('0x3d')]);_0x524b7d[_0x90a2('0x41')]=_[_0x90a2('0x42')](_0xed06ac[_0x90a2('0x40')],qs['fields'](_0x9c9f33['query'][_0x90a2('0x43')]));_0x524b7d['attributes']=_0x524b7d[_0x90a2('0x41')][_0x90a2('0x44')]?_0x524b7d[_0x90a2('0x41')]:_0xed06ac['model'];if(!_0x9c9f33[_0x90a2('0x3d')]['hasOwnProperty'](_0x90a2('0x45'))){_0x524b7d[_0x90a2('0x2c')]=qs[_0x90a2('0x2c')](_0x9c9f33[_0x90a2('0x3d')][_0x90a2('0x2c')]);_0x524b7d[_0x90a2('0x2f')]=qs['offset'](_0x9c9f33[_0x90a2('0x3d')][_0x90a2('0x2f')]);}_0x524b7d['order']=qs[_0x90a2('0x46')](_0x9c9f33[_0x90a2('0x3d')][_0x90a2('0x46')]);_0x524b7d['where']=qs[_0x90a2('0x3f')](_['pick'](_0x9c9f33['query'],_0xed06ac[_0x90a2('0x3f')]),_0x570d36);if(_0x9c9f33['query'][_0x90a2('0x47')]){_0x524b7d[_0x90a2('0x48')]=_['merge'](_0x524b7d[_0x90a2('0x48')],{'$or':_[_0x90a2('0x39')](_0x570d36,function(_0x2ad063){if(_0x2ad063[_0x90a2('0x49')]!==_0x90a2('0x4a')){var _0x11aadf={};_0x11aadf[_0x2ad063['name']]={'$like':'%'+_0x9c9f33[_0x90a2('0x3d')][_0x90a2('0x47')]+'%'};return _0x11aadf;}})});}_0x524b7d=_['merge']({},_0x524b7d,_0x9c9f33[_0x90a2('0x4b')]);var _0x44ce69={'where':_0x524b7d[_0x90a2('0x48')]};return db['OpenchannelMessage']['count'](_0x44ce69)[_0x90a2('0x1d')](function(_0x2de722){_0xdc0187[_0x90a2('0x2e')]=_0x2de722;if(_0x9c9f33['query'][_0x90a2('0x4c')]){_0x524b7d['include']=[{'all':!![]}];}return db[_0x90a2('0x3a')]['findAll'](_0x524b7d);})[_0x90a2('0x1d')](function(_0xef0a93){_0xdc0187['rows']=_0xef0a93;return _0xdc0187;})[_0x90a2('0x1d')](respondWithFilteredResult(_0x20fd55,_0x524b7d))[_0x90a2('0x27')](handleError(_0x20fd55,null));};exports[_0x90a2('0x4d')]=function(_0x535a28,_0x331585){var _0x2620f2={'raw':!![],'where':{'id':_0x535a28['params']['id']}},_0x20f1bd={};_0x20f1bd[_0x90a2('0x40')]=_['keys'](db[_0x90a2('0x3a')]['rawAttributes']);_0x20f1bd[_0x90a2('0x3d')]=_['keys'](_0x535a28['query']);_0x20f1bd[_0x90a2('0x3f')]=_[_0x90a2('0x42')](_0x20f1bd['model'],_0x20f1bd['query']);_0x2620f2['attributes']=_[_0x90a2('0x42')](_0x20f1bd[_0x90a2('0x40')],qs[_0x90a2('0x43')](_0x535a28[_0x90a2('0x3d')][_0x90a2('0x43')]));_0x2620f2['attributes']=_0x2620f2[_0x90a2('0x41')][_0x90a2('0x44')]?_0x2620f2[_0x90a2('0x41')]:_0x20f1bd[_0x90a2('0x40')];if(_0x535a28[_0x90a2('0x3d')][_0x90a2('0x4c')]){_0x2620f2[_0x90a2('0x4e')]=[{'all':!![]}];}_0x2620f2=_[_0x90a2('0x4f')]({},_0x2620f2,_0x535a28[_0x90a2('0x4b')]);return db[_0x90a2('0x3a')]['find'](_0x2620f2)['then'](handleEntityNotFound(_0x331585,null))[_0x90a2('0x1d')](respondWithResult(_0x331585,null))[_0x90a2('0x27')](handleError(_0x331585,null));};exports[_0x90a2('0x50')]=function(_0x200a52,_0x4534e0){return db[_0x90a2('0x3a')][_0x90a2('0x50')](_0x200a52['body'],{})[_0x90a2('0x1d')](respondWithResult(_0x4534e0,0xc9))[_0x90a2('0x27')](handleError(_0x4534e0,null));};exports[_0x90a2('0x35')]=function(_0x59cfc3,_0x26a6b4){if(_0x59cfc3['body']['id']){delete _0x59cfc3[_0x90a2('0x51')]['id'];}return db[_0x90a2('0x3a')]['find']({'where':{'id':_0x59cfc3[_0x90a2('0x52')]['id']}})['then'](handleEntityNotFound(_0x26a6b4,null))[_0x90a2('0x1d')](saveUpdates(_0x59cfc3['body'],null))['then'](respondWithResult(_0x26a6b4,null))[_0x90a2('0x27')](handleError(_0x26a6b4,null));};exports[_0x90a2('0x53')]=function(_0x361814,_0x3be749){return db[_0x90a2('0x3a')][_0x90a2('0x54')]({'where':{'id':_0x361814[_0x90a2('0x52')]['id']}})[_0x90a2('0x1d')](handleEntityNotFound(_0x3be749,null))[_0x90a2('0x1d')](removeEntity(_0x3be749,null))[_0x90a2('0x27')](handleError(_0x3be749,null));};exports['describe']=function(_0xee384f,_0x159aca){return db['OpenchannelMessage'][_0x90a2('0x55')]()[_0x90a2('0x1d')](respondWithResult(_0x159aca,null))['catch'](handleError(_0x159aca,null));};var interaction_log=require(_0x90a2('0x12'))(_0x90a2('0x56'));exports[_0x90a2('0x57')]=function(_0x5cd261,_0x295292,_0x365d12){var _0x331a3b={'agent':{},'channel':_0x90a2('0x58')};if(_0x5cd261[_0x90a2('0x51')]['id']){delete _0x5cd261[_0x90a2('0x51')]['id'];}_0x5cd261[_0x90a2('0x51')][_0x90a2('0x59')]=!![];_0x5cd261[_0x90a2('0x51')][_0x90a2('0x5a')]=moment()[_0x90a2('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cd261[_0x90a2('0x51')]['UserId']=_0x5cd261[_0x90a2('0x51')][_0x90a2('0x5c')]||_0x5cd261[_0x90a2('0x5d')]['id'];_0x331a3b[_0x90a2('0x5e')]['id']=_0x5cd261[_0x90a2('0x51')][_0x90a2('0x5c')];return db[_0x90a2('0x3a')][_0x90a2('0x54')]({'where':{'id':_0x5cd261[_0x90a2('0x52')]['id'],'UserId':null}})[_0x90a2('0x1d')](handleEntityNotFound(_0x295292,null))[_0x90a2('0x1d')](saveUpdates(_0x5cd261[_0x90a2('0x51')],null))[_0x90a2('0x1d')](function(_0x2b05ed){if(_0x2b05ed){_0x331a3b[_0x90a2('0x25')]=_0x2b05ed['get']({'plain':!![]});return db[_0x90a2('0x5f')][_0x90a2('0x54')]({'where':{'id':_0x2b05ed[_0x90a2('0x60')]}});}return null;})[_0x90a2('0x1d')](handleEntityNotFound(_0x295292,null))[_0x90a2('0x1d')](function(_0x4af10e){if(_0x4af10e){return _0x4af10e[_0x90a2('0x35')]({'UserId':_0x5cd261[_0x90a2('0x51')][_0x90a2('0x5c')],'read1stAt':_['isNil'](_0x4af10e['read1stAt'])?moment()[_0x90a2('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x40e298){if(_0x40e298){_0x331a3b[_0x90a2('0x61')]=_0x40e298[_0x90a2('0x62')]({'plain':!![]});interaction_log['info'](_0x90a2('0x63'),_0x5cd261[_0x90a2('0x5d')]['id'],_0x5cd261[_0x90a2('0x5d')][_0x90a2('0x37')],_0x5cd261['user'][_0x90a2('0x64')],_0x331a3b[_0x90a2('0x61')]['id'],_0x5cd261[_0x90a2('0x51')]?JSON[_0x90a2('0x65')](_0x5cd261['body']):_0x90a2('0x66'));return respondWithRpcPromise(_0x90a2('0x67'),_0x90a2('0x68'),_0x331a3b);}return null;})[_0x90a2('0x1d')](function(_0x5e9446){var _0x3d60e7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e9446['message'][_0x90a2('0x69')];return db[_0x90a2('0x6a')][_0x90a2('0x3d')](_0x3d60e7,{'type':db['Sequelize'][_0x90a2('0x6b')][_0x90a2('0x6c')],'raw':!![]})[_0x90a2('0x1d')](function(_0x5d22a2){return _0x5d22a2;});})[_0x90a2('0x1d')](function(_0x5d6141){if(_0x5d6141){_0x331a3b['message']['contact']=_0x5d6141[0x0];if(!_0x5cd261['body']['UserId'])return;return db[_0x90a2('0x6d')][_0x90a2('0x54')]({'where':{'id':_0x5cd261[_0x90a2('0x51')][_0x90a2('0x5c')],'role':_0x90a2('0x5e')},'attributes':['id',_0x90a2('0x37'),'fullname','email',_0x90a2('0x6e')],'raw':!![]});}return null;})['then'](function(_0x19da40){if(!_0x19da40)return null;_0x331a3b[_0x90a2('0x25')][_0x90a2('0x5e')]=_0x19da40;return _0x331a3b;})[_0x90a2('0x1d')](function(_0x523c8b){if(_0x523c8b){if(_0x5cd261[_0x90a2('0x51')][_0x90a2('0x6f')]){_0x331a3b[_0x90a2('0x25')][_0x90a2('0x70')]=util[_0x90a2('0x5b')](_0x90a2('0x71'),_0x5cd261['user'][_0x90a2('0x37')]);_0x331a3b['message'][_0x90a2('0x72')]=_0x331a3b['channel'];_0x331a3b[_0x90a2('0x25')][_0x90a2('0x73')]=_0x331a3b['channel'];_0x331a3b[_0x90a2('0x25')][_0x90a2('0x74')]=_0x90a2('0x57');return respondWithRpcPromise(_0x90a2('0x75'),_0x90a2('0x75'),{'event':_0x90a2('0x76'),'message':_0x331a3b['message']},client9002)[_0x90a2('0x1d')](function(){return _0x331a3b;});}return _0x331a3b;}return null;})[_0x90a2('0x1d')](respondWithResult(_0x295292,null))['catch'](handleError(_0x295292,null));};var interaction_log=require(_0x90a2('0x12'))('openchannel-interactions');exports[_0x90a2('0x33')]=function(_0x593a0e,_0x54939f,_0x170676){var _0x25b149={'agent':{},'channel':'openchannel'};if(_0x593a0e['body']['id']){delete _0x593a0e[_0x90a2('0x51')]['id'];}_0x593a0e[_0x90a2('0x51')]['UserId']=_0x593a0e[_0x90a2('0x51')][_0x90a2('0x5c')]||_0x593a0e[_0x90a2('0x5d')]['id'];_0x25b149[_0x90a2('0x5e')]['id']=_0x593a0e[_0x90a2('0x51')]['UserId'];return db[_0x90a2('0x3a')][_0x90a2('0x54')]({'where':{'id':_0x593a0e[_0x90a2('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54939f,null))[_0x90a2('0x1d')](function(_0x15a09a){if(_0x15a09a){_0x25b149[_0x90a2('0x25')]=_0x15a09a[_0x90a2('0x62')]({'plain':!![]});return db[_0x90a2('0x5f')]['find']({'where':{'id':_0x15a09a[_0x90a2('0x60')]}});}return null;})[_0x90a2('0x1d')](handleEntityNotFound(_0x54939f,null))[_0x90a2('0x1d')](function(_0x352c32){if(_0x352c32){_0x25b149['interaction']=_0x352c32[_0x90a2('0x62')]({'plain':!![]});interaction_log[_0x90a2('0x1e')](_0x90a2('0x77'),_0x593a0e[_0x90a2('0x5d')]['id'],_0x593a0e['user'][_0x90a2('0x37')],_0x593a0e['user'][_0x90a2('0x64')],_0x25b149[_0x90a2('0x61')]['id'],_0x593a0e['body']?JSON['stringify'](_0x593a0e[_0x90a2('0x51')]):'null');return respondWithRpcPromise(_0x90a2('0x78'),_0x90a2('0x79'),_0x25b149);}return null;})['then'](function(_0x472b1c){var _0xc03faa=_0x90a2('0x7a')+_0x472b1c[_0x90a2('0x25')][_0x90a2('0x69')];return db['sequelize'][_0x90a2('0x3d')](_0xc03faa,{'type':db[_0x90a2('0x7b')][_0x90a2('0x6b')]['SELECT'],'raw':!![]})[_0x90a2('0x1d')](function(_0xda9371){return _0xda9371;});})[_0x90a2('0x1d')](function(_0x1ff9d7){if(_0x1ff9d7){_0x25b149[_0x90a2('0x25')][_0x90a2('0x7c')]=_0x1ff9d7[0x0];if(!_0x593a0e[_0x90a2('0x51')][_0x90a2('0x5c')])return;return db[_0x90a2('0x6d')][_0x90a2('0x54')]({'where':{'id':_0x593a0e[_0x90a2('0x51')]['UserId'],'role':_0x90a2('0x5e')},'attributes':['id','name','fullname',_0x90a2('0x7d'),_0x90a2('0x6e')],'raw':!![]});}return null;})[_0x90a2('0x1d')](function(_0x3df567){if(!_0x3df567)return null;_0x25b149[_0x90a2('0x25')][_0x90a2('0x5e')]=_0x3df567;return _0x25b149;})['then'](function(_0x213589){if(_0x213589){_0x213589['message']['interface']=util[_0x90a2('0x5b')]('SIP/%s',_0x593a0e[_0x90a2('0x5d')]['name']);_0x213589['message']['channel']=_0x25b149['channel'];_0x213589['message'][_0x90a2('0x73')]=_0x25b149[_0x90a2('0x72')];_0x213589['message'][_0x90a2('0x74')]=_0x90a2('0x33');respondWithRpcPromise('EventManager',_0x90a2('0x75'),{'event':'rejectmessage','message':_0x213589[_0x90a2('0x25')]},client9002);return _0x25b149;}return null;})[_0x90a2('0x1d')](respondWithResult(_0x54939f,null))[_0x90a2('0x27')](handleError(_0x54939f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8ce658c..bf93e5d 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 _0x0ce3=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0x53a6b4,_0x251898){var _0x4526c2=function(_0x4faeac){while(--_0x4faeac){_0x53a6b4['push'](_0x53a6b4['shift']());}};_0x4526c2(++_0x251898);}(_0x0ce3,0x147));var _0x30ce=function(_0x21eb7e,_0x97b820){_0x21eb7e=_0x21eb7e-0x0;var _0x19fda4=_0x0ce3[_0x21eb7e];return _0x19fda4;};'use strict';var EventEmitter=require(_0x30ce('0x0'));var OpenchannelMessage=require(_0x30ce('0x1'))['db'][_0x30ce('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x30ce('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x30ce('0x4'),'afterDestroy':_0x30ce('0x5')};function emitEvent(_0x97b907){return function(_0x130e1c,_0x5c7a85,_0x54eb11){OpenchannelMessageEvents[_0x30ce('0x6')](_0x97b907+':'+_0x130e1c['id'],_0x130e1c);OpenchannelMessageEvents['emit'](_0x97b907,_0x130e1c);_0x54eb11(null);};}for(var e in events){if(events[_0x30ce('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x30ce('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xa6e6=['hasOwnProperty','hook','events','OpenchannelMessage','update','remove','emit'];(function(_0x5e3f0f,_0x16c6c7){var _0xbd8d66=function(_0x3f4da4){while(--_0x3f4da4){_0x5e3f0f['push'](_0x5e3f0f['shift']());}};_0xbd8d66(++_0x16c6c7);}(_0xa6e6,0x183));var _0x6a6e=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xa6e6[_0x16771d];return _0x386f11;};'use strict';var EventEmitter=require(_0x6a6e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6a6e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a6e('0x2'),'afterDestroy':_0x6a6e('0x3')};function emitEvent(_0x9f5ae4){return function(_0x468de8,_0x33e637,_0x1f372d){OpenchannelMessageEvents['emit'](_0x9f5ae4+':'+_0x468de8['id'],_0x468de8);OpenchannelMessageEvents[_0x6a6e('0x4')](_0x9f5ae4,_0x468de8);_0x1f372d(null);};}for(var e in events){if(events[_0x6a6e('0x5')](e)){var event=events[e];OpenchannelMessage[_0x6a6e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index ff32d23..6499352 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 _0x1eba=['format','Interaction','omit','POST','replyUri','method','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','toLowerCase','direction','secret','isNil','OpenchannelInteraction','then','update','createdAt','catch','error','out','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x4fc8d6,_0x22aacf){var _0xcf9bca=function(_0x5f3697){while(--_0x5f3697){_0x4fc8d6['push'](_0x4fc8d6['shift']());}};_0xcf9bca(++_0x22aacf);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x1eba[_0x1dfa63];return _0x26f2a9;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[{'name':_0xa1eb('0xd'),'fields':[_0xa1eb('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ecd20,_0x4d4aaf,_0x219802){var _0x54cdad=_0x2933d0[_0xa1eb('0xf')];var _0x5d7101=_0x1ecd20[_0xa1eb('0x10')]({'plain':!![]});if(_0x5d7101['direction'][_0xa1eb('0x11')]()==='in'||_0x5d7101[_0xa1eb('0x12')][_0xa1eb('0x11')]()==='out'&&!_0x5d7101[_0xa1eb('0x13')]&&!_[_0xa1eb('0x14')](_0x5d7101['UserId'])){_0x54cdad[_0xa1eb('0x15')]['findOne']({'where':{'id':_0x5d7101['OpenchannelInteractionId']}})[_0xa1eb('0x16')](function(_0x4c7983){if(_0x4c7983){_0x4c7983[_0xa1eb('0x17')]({'lastMsgAt':_0x5d7101[_0xa1eb('0x18')],'lastMsgDirection':_0x5d7101[_0xa1eb('0x12')][_0xa1eb('0x11')]()});}})[_0xa1eb('0x19')](function(_0x44f37d){console[_0xa1eb('0x1a')](_0x44f37d);});}if(_0x5d7101[_0xa1eb('0x12')]===_0xa1eb('0x1b')&&!_0x5d7101['secret']){var _0xbd6a6b;_0x54cdad['CmContact'][_0xa1eb('0x1c')]()[_0xa1eb('0x16')](function(_0x33c4e3){return _0x54cdad[_0xa1eb('0x1d')]['find']({'where':{'id':_0x5d7101[_0xa1eb('0x1e')]},'include':[{'model':_0x54cdad[_0xa1eb('0x15')],'as':_0xa1eb('0x1f'),'where':{'id':_0x5d7101[_0xa1eb('0x20')]},'limit':0x1,'include':[{'model':_0x54cdad[_0xa1eb('0x21')],'as':_0xa1eb('0x22'),'attributes':_[_0xa1eb('0x23')](_0x33c4e3)}]}]});})[_0xa1eb('0x16')](function(_0x4fc14a){_0xbd6a6b=_0x4fc14a[_0xa1eb('0x10')]({'plain':!![]});if(_0xbd6a6b&&_0xbd6a6b['replyUri']){logger[_0xa1eb('0x24')](_0xa1eb('0x25'),_0xa1eb('0x26'),util[_0xa1eb('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5d7101['id'],_0xbd6a6b['replyUri']));if(_0xbd6a6b[_0xa1eb('0x1f')]&&_0xbd6a6b[_0xa1eb('0x1f')]['length']){_0x5d7101[_0xa1eb('0x28')]=_[_0xa1eb('0x29')](_0xbd6a6b[_0xa1eb('0x1f')][0x0],_0xa1eb('0x22'));_0x5d7101[_0xa1eb('0x22')]=_0xbd6a6b[_0xa1eb('0x1f')][0x0][_0xa1eb('0x22')];}var _0x4d4aaf={'method':_0xa1eb('0x2a'),'uri':encodeURI(_0xbd6a6b[_0xa1eb('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d4aaf[_0xa1eb('0x2c')]){case _0xa1eb('0x2d'):_0x4d4aaf['qs']=_0x5d7101;break;case'POST':_0x4d4aaf[_0xa1eb('0xe')]=_0x5d7101;break;}return rp(_0x4d4aaf)[_0xa1eb('0x16')](function(_0x491f37){logger[_0xa1eb('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xa1eb('0x26'),util[_0xa1eb('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x5d7101['id'],_0xbd6a6b[_0xa1eb('0x2b')]));if(_0x491f37[_0xa1eb('0xe')][_0xa1eb('0x2e')]&&_0x491f37['body'][_0xa1eb('0x2e')]!=_0x5d7101[_0xa1eb('0x28')]['threadId']){return _0x54cdad[_0xa1eb('0x15')][_0xa1eb('0x17')]({'threadId':_0x491f37[_0xa1eb('0xe')][_0xa1eb('0x2e')]},{'logging':!![],'where':{'id':_0x5d7101[_0xa1eb('0x28')]['id']}});}else{return;}})['then'](function(){return _0x1ecd20[_0xa1eb('0x17')]({'read':!![]});})[_0xa1eb('0x19')](function(_0x198fdb){logger[_0xa1eb('0x1a')](_0xa1eb('0x25'),_0xa1eb('0x26'),util[_0xa1eb('0x2f')](_0x198fdb,{'showHidden':![],'depth':null}));_0x219802();});}else{_0x219802();}})[_0xa1eb('0x30')](function(){_0x219802();});}else{_0x219802();}}},'charset':_0xa1eb('0x31'),'collate':_0xa1eb('0x32')});}; \ No newline at end of file +var _0xb10b=['OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','method','GET','POST','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','out','CmContact','describe','then'];(function(_0x1eac95,_0x58d1eb){var _0xca1238=function(_0x4e2302){while(--_0x4e2302){_0x1eac95['push'](_0x1eac95['shift']());}};_0xca1238(++_0x58d1eb);}(_0xb10b,0x12a));var _0xbb10=function(_0xbc86fc,_0x1bb24d){_0xbc86fc=_0xbc86fc-0x0;var _0x549976=_0xb10b[_0xbc86fc];return _0x549976;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xd')],'type':_0xbb10('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2353ef,_0x1ce33e,_0x229887){var _0xa3adc8=_0x481979['models'];var _0x4e47f8=_0x2353ef[_0xbb10('0xf')]({'plain':!![]});if(_0x4e47f8[_0xbb10('0x10')][_0xbb10('0x11')]()==='in'||_0x4e47f8['direction'][_0xbb10('0x11')]()==='out'&&!_0x4e47f8[_0xbb10('0x12')]&&!_[_0xbb10('0x13')](_0x4e47f8[_0xbb10('0x14')])){_0xa3adc8[_0xbb10('0x15')][_0xbb10('0x16')]({'where':{'id':_0x4e47f8[_0xbb10('0x17')]}})['then'](function(_0x26e021){if(_0x26e021){_0x26e021[_0xbb10('0x18')]({'lastMsgAt':_0x4e47f8[_0xbb10('0x19')],'lastMsgDirection':_0x4e47f8[_0xbb10('0x10')][_0xbb10('0x11')]()});}})[_0xbb10('0x1a')](function(_0x24a57b){console[_0xbb10('0x1b')](_0x24a57b);});}if(_0x4e47f8[_0xbb10('0x10')]===_0xbb10('0x1c')&&!_0x4e47f8['secret']){var _0x2eca0f;_0xa3adc8[_0xbb10('0x1d')][_0xbb10('0x1e')]()[_0xbb10('0x1f')](function(_0x378da8){return _0xa3adc8[_0xbb10('0x20')][_0xbb10('0x21')]({'where':{'id':_0x4e47f8[_0xbb10('0x22')]},'include':[{'model':_0xa3adc8[_0xbb10('0x15')],'as':_0xbb10('0x23'),'where':{'id':_0x4e47f8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xa3adc8[_0xbb10('0x1d')],'as':_0xbb10('0x24'),'attributes':_[_0xbb10('0x25')](_0x378da8)}]}]});})[_0xbb10('0x1f')](function(_0xdf237d){_0x2eca0f=_0xdf237d[_0xbb10('0xf')]({'plain':!![]});if(_0x2eca0f&&_0x2eca0f['replyUri']){logger[_0xbb10('0x26')](_0xbb10('0x27'),'afterCreate',util['format'](_0xbb10('0x28'),_0x4e47f8['id'],_0x2eca0f[_0xbb10('0x29')]));if(_0x2eca0f[_0xbb10('0x23')]&&_0x2eca0f[_0xbb10('0x23')][_0xbb10('0x2a')]){_0x4e47f8[_0xbb10('0x2b')]=_[_0xbb10('0x2c')](_0x2eca0f[_0xbb10('0x23')][0x0],_0xbb10('0x24'));_0x4e47f8[_0xbb10('0x24')]=_0x2eca0f[_0xbb10('0x23')][0x0][_0xbb10('0x24')];}var _0x1ce33e={'method':'POST','uri':encodeURI(_0x2eca0f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1ce33e[_0xbb10('0x2d')]){case _0xbb10('0x2e'):_0x1ce33e['qs']=_0x4e47f8;break;case _0xbb10('0x2f'):_0x1ce33e['body']=_0x4e47f8;break;}return rp(_0x1ce33e)[_0xbb10('0x1f')](function(_0x24d586){logger[_0xbb10('0x26')](_0xbb10('0x27'),_0xbb10('0x30'),util[_0xbb10('0x31')](_0xbb10('0x32'),_0x4e47f8['id'],_0x2eca0f['replyUri']));if(_0x24d586[_0xbb10('0xd')][_0xbb10('0x33')]&&_0x24d586[_0xbb10('0xd')][_0xbb10('0x33')]!=_0x4e47f8[_0xbb10('0x2b')][_0xbb10('0x33')]){return _0xa3adc8['OpenchannelInteraction'][_0xbb10('0x18')]({'threadId':_0x24d586['body'][_0xbb10('0x33')]},{'logging':!![],'where':{'id':_0x4e47f8['Interaction']['id']}});}else{return;}})[_0xbb10('0x1f')](function(){return _0x2353ef[_0xbb10('0x18')]({'read':!![]});})[_0xbb10('0x1a')](function(_0x491db4){logger['error'](_0xbb10('0x27'),_0xbb10('0x30'),util['inspect'](_0x491db4,{'showHidden':![],'depth':null}));_0x229887();});}else{_0x229887();}})[_0xbb10('0x34')](function(){_0x229887();});}else{_0x229887();}}},'charset':_0xbb10('0x35'),'collate':_0xbb10('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6e905c5..14b437c 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x320546,_0x57a694){var _0x4514a0=function(_0x5a486c){while(--_0x5a486c){_0x320546['push'](_0x320546['shift']());}};_0x4514a0(++_0x57a694);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x322718,_0x228645){var _0x5f43d1=function(_0x450782){while(--_0x450782){_0x322718['push'](_0x322718['shift']());}};_0x5f43d1(++_0x228645);}(_0x2ef3,0xba));var _0x32ef=function(_0x51053a,_0x5871f0){_0x51053a=_0x51053a-0x0;var _0x39554d=_0x2ef3[_0x51053a];return _0x39554d;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 95aed13..cf27ba5 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 _0xdaa7=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x19bbd9,_0x2b3640){var _0x5d0eba=function(_0x242702){while(--_0x242702){_0x19bbd9['push'](_0x19bbd9['shift']());}};_0x5d0eba(++_0x2b3640);}(_0xdaa7,0x68));var _0x7daa=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0xdaa7[_0x2ac4af];return _0x3a36df;};'use strict';var OpenchannelMessageEvents=require(_0x7daa('0x0'));var events=[_0x7daa('0x1'),_0x7daa('0x2'),_0x7daa('0x3')];function createListener(_0x3315ba,_0x1a8370){return function(_0x3b2098){_0x1a8370[_0x7daa('0x4')](_0x3315ba,_0x3b2098);};}function removeListener(_0x20fac9,_0x5276cc){return function(){OpenchannelMessageEvents[_0x7daa('0x5')](_0x20fac9,_0x5276cc);};}exports[_0x7daa('0x6')]=function(_0x18d29e){for(var _0x180839=0x0,_0x48e0d8=events[_0x7daa('0x7')];_0x180839<_0x48e0d8;_0x180839++){var _0x50ba35=events[_0x180839];var _0x2d7b27=createListener(_0x7daa('0x8')+_0x50ba35,_0x18d29e);OpenchannelMessageEvents['on'](_0x50ba35,_0x2d7b27);}}; \ No newline at end of file +var _0x8ac9=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener','register','length'];(function(_0xb49cb8,_0x39474b){var _0x879ead=function(_0x596639){while(--_0x596639){_0xb49cb8['push'](_0xb49cb8['shift']());}};_0x879ead(++_0x39474b);}(_0x8ac9,0x199));var _0x98ac=function(_0xec72cf,_0x3e3f0d){_0xec72cf=_0xec72cf-0x0;var _0x41302c=_0x8ac9[_0xec72cf];return _0x41302c;};'use strict';var OpenchannelMessageEvents=require(_0x98ac('0x0'));var events=[_0x98ac('0x1'),_0x98ac('0x2'),'update'];function createListener(_0x48dbda,_0x4496e8){return function(_0x16fcd8){_0x4496e8[_0x98ac('0x3')](_0x48dbda,_0x16fcd8);};}function removeListener(_0x59f76b,_0x4bac60){return function(){OpenchannelMessageEvents[_0x98ac('0x4')](_0x59f76b,_0x4bac60);};}exports[_0x98ac('0x5')]=function(_0x349708){for(var _0x5b9b0c=0x0,_0x556d23=events[_0x98ac('0x6')];_0x5b9b0c<_0x556d23;_0x5b9b0c++){var _0x1702d6=events[_0x5b9b0c];var _0x3e025e=createListener(_0x98ac('0x7')+_0x1702d6,_0x349708);OpenchannelMessageEvents['on'](_0x1702d6,_0x3e025e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5aef28a..34d943b 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 _0x447b=['/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x5134ed,_0x3bafe4){var _0x53a816=function(_0x4044b7){while(--_0x4044b7){_0x5134ed['push'](_0x5134ed['shift']());}};_0x53a816(++_0x3bafe4);}(_0x447b,0x131));var _0xb447=function(_0x135bcc,_0x59cc48){_0x135bcc=_0x135bcc-0x0;var _0xb03ff=_0x447b[_0x135bcc];return _0xb03ff;};'use strict';var multer=require('multer');var util=require(_0xb447('0x0'));var path=require(_0xb447('0x1'));var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express['Router']();var fs_extra=require(_0xb447('0x4'));var auth=require(_0xb447('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb447('0x6'));var controller=require(_0xb447('0x7'));router['get']('/',auth[_0xb447('0x8')](),controller[_0xb447('0x9')]);router[_0xb447('0xa')]('/describe',auth[_0xb447('0x8')](),controller[_0xb447('0xb')]);router[_0xb447('0xa')](_0xb447('0xc'),auth[_0xb447('0x8')](),controller[_0xb447('0xd')]);router[_0xb447('0xa')](_0xb447('0xe'),auth[_0xb447('0x8')](),controller[_0xb447('0xf')]);router[_0xb447('0xa')]('/:id/teams',auth[_0xb447('0x8')](),controller[_0xb447('0x10')]);router[_0xb447('0xa')](_0xb447('0x11'),auth[_0xb447('0x8')](),controller[_0xb447('0x12')]);router[_0xb447('0x13')]('/',auth[_0xb447('0x8')](),controller[_0xb447('0x14')]);router[_0xb447('0x13')](_0xb447('0x15'),auth[_0xb447('0x8')](),controller[_0xb447('0x16')]);router[_0xb447('0x13')](_0xb447('0x11'),auth['isAuthenticated'](),controller[_0xb447('0x17')]);router[_0xb447('0x18')](_0xb447('0xc'),auth['isAuthenticated'](),controller[_0xb447('0x19')]);router[_0xb447('0x1a')](_0xb447('0xc'),auth[_0xb447('0x8')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xb447('0x1b')]);router[_0xb447('0x1a')](_0xb447('0x11'),auth[_0xb447('0x8')](),controller['removeAgents']);module[_0xb447('0x1c')]=router; \ No newline at end of file +var _0x0352=['post','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x213fc5,_0x5e62d0){var _0x25af1c=function(_0x50f34a){while(--_0x50f34a){_0x213fc5['push'](_0x213fc5['shift']());}};_0x25af1c(++_0x5e62d0);}(_0x0352,0x165));var _0x2035=function(_0x1538eb,_0x18a987){_0x1538eb=_0x1538eb-0x0;var _0xe60c62=_0x0352[_0x1538eb];return _0xe60c62;};'use strict';var multer=require('multer');var util=require(_0x2035('0x0'));var path=require(_0x2035('0x1'));var timeout=require('connect-timeout');var express=require(_0x2035('0x2'));var router=express[_0x2035('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2035('0x4'));var interaction=require(_0x2035('0x5'));var config=require(_0x2035('0x6'));var controller=require(_0x2035('0x7'));router[_0x2035('0x8')]('/',auth[_0x2035('0x9')](),controller[_0x2035('0xa')]);router['get'](_0x2035('0xb'),auth[_0x2035('0x9')](),controller[_0x2035('0xc')]);router[_0x2035('0x8')](_0x2035('0xd'),auth['isAuthenticated'](),controller[_0x2035('0xe')]);router[_0x2035('0x8')](_0x2035('0xf'),auth[_0x2035('0x9')](),controller[_0x2035('0x10')]);router[_0x2035('0x8')](_0x2035('0x11'),auth[_0x2035('0x9')](),controller[_0x2035('0x12')]);router['get']('/:id/users',auth[_0x2035('0x9')](),controller[_0x2035('0x13')]);router[_0x2035('0x14')]('/',auth[_0x2035('0x9')](),controller['create']);router[_0x2035('0x14')]('/:id/teams',auth[_0x2035('0x9')](),controller[_0x2035('0x15')]);router[_0x2035('0x14')](_0x2035('0x16'),auth[_0x2035('0x9')](),controller[_0x2035('0x17')]);router[_0x2035('0x18')](_0x2035('0xd'),auth['isAuthenticated'](),controller[_0x2035('0x19')]);router[_0x2035('0x1a')](_0x2035('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x2035('0x1a')](_0x2035('0x11'),auth['isAuthenticated'](),controller[_0x2035('0x1b')]);router[_0x2035('0x1a')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x2035('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3f3fa87..d518004 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 _0x8f93=['STRING','name','ENUM','rrmemory','sequelize','exports'];(function(_0x55c8c2,_0xcd1486){var _0x24d34d=function(_0x7a389){while(--_0x7a389){_0x55c8c2['push'](_0x55c8c2['shift']());}};_0x24d34d(++_0xcd1486);}(_0x8f93,0x184));var _0x38f9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f93[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x38f9('0x0'));module[_0x38f9('0x1')]={'name':{'type':Sequelize[_0x38f9('0x2')],'unique':_0x38f9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x38f9('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x38f9('0x4')](_0x38f9('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x617d=['sequelize','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x34e343,_0x2f43e3){var _0x468b72=function(_0x128aca){while(--_0x128aca){_0x34e343['push'](_0x34e343['shift']());}};_0x468b72(++_0x2f43e3);}(_0x617d,0x173));var _0xd617=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x617d[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xd617('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd617('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd617('0x2')]},'timeout':{'type':Sequelize[_0xd617('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd617('0x4')](_0xd617('0x5'),_0xd617('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9e73931..a6d2dff 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 _0xeb60=['body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','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','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','OpenchannelQueue','includeAll','include','findAll','rows','catch','params','keys','length','options','find','create'];(function(_0x30a457,_0x2aa6b5){var _0x2ae5cd=function(_0x1181e6){while(--_0x1181e6){_0x30a457['push'](_0x30a457['shift']());}};_0x2ae5cd(++_0x2aa6b5);}(_0xeb60,0xcb));var _0x0eb6=function(_0x33ff88,_0x5d0269){_0x33ff88=_0x33ff88-0x0;var _0x172447=_0xeb60[_0x33ff88];return _0x172447;};'use strict';var emlformat=require(_0x0eb6('0x0'));var rimraf=require(_0x0eb6('0x1'));var zipdir=require(_0x0eb6('0x2'));var jsonpatch=require(_0x0eb6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0eb6('0x4'));var Mustache=require('mustache');var util=require(_0x0eb6('0x5'));var path=require(_0x0eb6('0x6'));var sox=require('sox');var csv=require(_0x0eb6('0x7'));var ejs=require(_0x0eb6('0x8'));var fs=require('fs');var fs_extra=require(_0x0eb6('0x9'));var _=require(_0x0eb6('0xa'));var squel=require(_0x0eb6('0xb'));var crypto=require(_0x0eb6('0xc'));var jsforce=require(_0x0eb6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0eb6('0xe'));var Redis=require(_0x0eb6('0xf'));var authService=require(_0x0eb6('0x10'));var qs=require(_0x0eb6('0x11'));var as=require(_0x0eb6('0x12'));var hardwareService=require(_0x0eb6('0x13'));var logger=require(_0x0eb6('0x14'))(_0x0eb6('0x15'));var utils=require('../../config/utils');var config=require(_0x0eb6('0x16'));var licenseUtil=require(_0x0eb6('0x17'));var db=require(_0x0eb6('0x18'))['db'];config[_0x0eb6('0x19')]=_['defaults'](config['redis'],{'host':_0x0eb6('0x1a'),'port':0x18eb});var socket=require(_0x0eb6('0x1b'))(new Redis(config[_0x0eb6('0x19')]));require(_0x0eb6('0x1c'))[_0x0eb6('0x1d')](socket);function respondWithStatusCode(_0x283ca2,_0x397d7d){_0x397d7d=_0x397d7d||0xcc;return function(_0x4e4ca8){if(_0x4e4ca8){return _0x283ca2['sendStatus'](_0x397d7d);}return _0x283ca2['status'](_0x397d7d)[_0x0eb6('0x1e')]();};}function respondWithResult(_0x1d5274,_0x56aa44){_0x56aa44=_0x56aa44||0xc8;return function(_0x7739e7){if(_0x7739e7){return _0x1d5274[_0x0eb6('0x1f')](_0x56aa44)[_0x0eb6('0x20')](_0x7739e7);}};}function respondWithFilteredResult(_0x83140c,_0x456f8f){return function(_0x4be7b1){if(_0x4be7b1){var _0x4bf650=typeof _0x456f8f[_0x0eb6('0x21')]==='undefined'&&typeof _0x456f8f[_0x0eb6('0x22')]===_0x0eb6('0x23');var _0x3622a3=_0x4be7b1[_0x0eb6('0x24')];var _0x3a9370=_0x4bf650?0x0:_0x456f8f[_0x0eb6('0x21')];var _0x556248=_0x4bf650?_0x4be7b1[_0x0eb6('0x24')]:_0x456f8f[_0x0eb6('0x21')]+_0x456f8f['limit'];var _0x21b031;if(_0x556248>=_0x3622a3){_0x556248=_0x3622a3;_0x21b031=0xc8;}else{_0x21b031=0xce;}_0x83140c[_0x0eb6('0x1f')](_0x21b031);return _0x83140c[_0x0eb6('0x25')]('Content-Range',_0x3a9370+'-'+_0x556248+'/'+_0x3622a3)['json'](_0x4be7b1);}return null;};}function patchUpdates(_0x204e94){return function(_0x1ed6f5){try{jsonpatch[_0x0eb6('0x26')](_0x1ed6f5,_0x204e94,!![]);}catch(_0x2305fa){return BPromise[_0x0eb6('0x27')](_0x2305fa);}return _0x1ed6f5[_0x0eb6('0x28')]();};}function saveUpdates(_0xcf16fa,_0x3c589d){return function(_0x5dae3a){if(_0x5dae3a){return _0x5dae3a[_0x0eb6('0x29')](_0xcf16fa)[_0x0eb6('0x2a')](function(_0x8832){return _0x8832;});}return null;};}function removeEntity(_0x56b5f4,_0xd20b48){return function(_0x3c30da){if(_0x3c30da){return _0x3c30da[_0x0eb6('0x2b')]()['then'](function(){var _0x35dc72=_0x3c30da[_0x0eb6('0x2c')]({'plain':!![]});var _0x20d544=_0x0eb6('0x2d');return db[_0x0eb6('0x2e')][_0x0eb6('0x2b')]({'where':{'type':_0x20d544,'resourceId':_0x35dc72['id']}})[_0x0eb6('0x2a')](function(){return _0x3c30da;});})['then'](function(){_0x56b5f4[_0x0eb6('0x1f')](0xcc)[_0x0eb6('0x1e')]();});}};}function handleEntityNotFound(_0x17acc7,_0x496a3e){return function(_0x27f397){if(!_0x27f397){_0x17acc7['sendStatus'](0x194);}return _0x27f397;};}function handleError(_0x2cc920,_0x307edb){_0x307edb=_0x307edb||0x1f4;return function(_0x1e986d){logger[_0x0eb6('0x2f')](_0x1e986d[_0x0eb6('0x30')]);if(_0x1e986d[_0x0eb6('0x31')]){delete _0x1e986d[_0x0eb6('0x31')];}_0x2cc920['status'](_0x307edb)['send'](_0x1e986d);};}exports[_0x0eb6('0x32')]=function(_0x59c65a,_0x2e4f9b){var _0x522b2d={},_0x5b888e={},_0x56d3b4={'count':0x0,'rows':[]};var _0x2f2300=_[_0x0eb6('0x33')](db['OpenchannelQueue'][_0x0eb6('0x34')],function(_0x5a536b){return{'name':_0x5a536b[_0x0eb6('0x35')],'type':_0x5a536b[_0x0eb6('0x36')][_0x0eb6('0x37')]};});_0x5b888e[_0x0eb6('0x38')]=_[_0x0eb6('0x33')](_0x2f2300,_0x0eb6('0x31'));_0x5b888e[_0x0eb6('0x39')]=_['keys'](_0x59c65a[_0x0eb6('0x39')]);_0x5b888e['filters']=_[_0x0eb6('0x3a')](_0x5b888e[_0x0eb6('0x38')],_0x5b888e[_0x0eb6('0x39')]);_0x522b2d[_0x0eb6('0x3b')]=_[_0x0eb6('0x3a')](_0x5b888e[_0x0eb6('0x38')],qs[_0x0eb6('0x3c')](_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x3c')]));_0x522b2d['attributes']=_0x522b2d[_0x0eb6('0x3b')]['length']?_0x522b2d[_0x0eb6('0x3b')]:_0x5b888e['model'];if(!_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x3d')](_0x0eb6('0x3e'))){_0x522b2d[_0x0eb6('0x22')]=qs[_0x0eb6('0x22')](_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x22')]);_0x522b2d[_0x0eb6('0x21')]=qs[_0x0eb6('0x21')](_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x21')]);}_0x522b2d[_0x0eb6('0x3f')]=qs[_0x0eb6('0x40')](_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x40')]);_0x522b2d['where']=qs[_0x0eb6('0x41')](_[_0x0eb6('0x42')](_0x59c65a['query'],_0x5b888e[_0x0eb6('0x41')]),_0x2f2300);if(_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x43')]){_0x522b2d['where']=_[_0x0eb6('0x44')](_0x522b2d[_0x0eb6('0x45')],{'$or':_[_0x0eb6('0x33')](_0x2f2300,function(_0x479662){if(_0x479662[_0x0eb6('0x36')]!==_0x0eb6('0x46')){var _0x24871={};_0x24871[_0x479662['name']]={'$like':'%'+_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x43')]+'%'};return _0x24871;}})});}_0x522b2d=_[_0x0eb6('0x44')]({},_0x522b2d,_0x59c65a['options']);var _0x337548={'where':_0x522b2d[_0x0eb6('0x45')]};return db[_0x0eb6('0x47')][_0x0eb6('0x24')](_0x337548)[_0x0eb6('0x2a')](function(_0x254703){_0x56d3b4[_0x0eb6('0x24')]=_0x254703;if(_0x59c65a[_0x0eb6('0x39')][_0x0eb6('0x48')]){_0x522b2d[_0x0eb6('0x49')]=[{'all':!![]}];}return db[_0x0eb6('0x47')][_0x0eb6('0x4a')](_0x522b2d);})['then'](function(_0xe469b1){_0x56d3b4[_0x0eb6('0x4b')]=_0xe469b1;return _0x56d3b4;})[_0x0eb6('0x2a')](respondWithFilteredResult(_0x2e4f9b,_0x522b2d))[_0x0eb6('0x4c')](handleError(_0x2e4f9b,null));};exports['show']=function(_0x32fe21,_0x576293){var _0x42179a={'raw':!![],'where':{'id':_0x32fe21[_0x0eb6('0x4d')]['id']}},_0x3fdd73={};_0x3fdd73['model']=_['keys'](db[_0x0eb6('0x47')]['rawAttributes']);_0x3fdd73['query']=_[_0x0eb6('0x4e')](_0x32fe21[_0x0eb6('0x39')]);_0x3fdd73[_0x0eb6('0x41')]=_[_0x0eb6('0x3a')](_0x3fdd73[_0x0eb6('0x38')],_0x3fdd73[_0x0eb6('0x39')]);_0x42179a[_0x0eb6('0x3b')]=_[_0x0eb6('0x3a')](_0x3fdd73[_0x0eb6('0x38')],qs[_0x0eb6('0x3c')](_0x32fe21['query'][_0x0eb6('0x3c')]));_0x42179a['attributes']=_0x42179a['attributes'][_0x0eb6('0x4f')]?_0x42179a[_0x0eb6('0x3b')]:_0x3fdd73[_0x0eb6('0x38')];if(_0x32fe21['query']['includeAll']){_0x42179a['include']=[{'all':!![]}];}_0x42179a=_[_0x0eb6('0x44')]({},_0x42179a,_0x32fe21[_0x0eb6('0x50')]);return db[_0x0eb6('0x47')][_0x0eb6('0x51')](_0x42179a)[_0x0eb6('0x2a')](handleEntityNotFound(_0x576293,null))['then'](respondWithResult(_0x576293,null))[_0x0eb6('0x4c')](handleError(_0x576293,null));};exports[_0x0eb6('0x52')]=function(_0x84235e,_0x4b7397){return db[_0x0eb6('0x47')][_0x0eb6('0x52')](_0x84235e[_0x0eb6('0x53')],{})[_0x0eb6('0x2a')](function(_0x5bf312){var _0x1a7501=_0x84235e['user'][_0x0eb6('0x2c')]({'plain':!![]});if(!_0x1a7501)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a7501[_0x0eb6('0x54')]===_0x0eb6('0x55')){var _0x1e8914=_0x5bf312[_0x0eb6('0x2c')]({'plain':!![]});var _0xbc2f0b=_0x0eb6('0x2d');return db[_0x0eb6('0x56')]['find']({'where':{'name':_0xbc2f0b,'userProfileId':_0x1a7501[_0x0eb6('0x57')]},'raw':!![]})[_0x0eb6('0x2a')](function(_0x1c1c6f){if(_0x1c1c6f&&_0x1c1c6f['autoAssociation']===0x0){return db[_0x0eb6('0x2e')][_0x0eb6('0x52')]({'name':_0x1e8914[_0x0eb6('0x31')],'resourceId':_0x1e8914['id'],'type':_0x1c1c6f[_0x0eb6('0x31')],'sectionId':_0x1c1c6f['id']},{})[_0x0eb6('0x2a')](function(){return _0x5bf312;});}else{return _0x5bf312;}})[_0x0eb6('0x4c')](function(_0x33910d){logger[_0x0eb6('0x2f')](_0x0eb6('0x58'),_0x33910d);throw _0x33910d;});}return _0x5bf312;})[_0x0eb6('0x2a')](respondWithResult(_0x4b7397,0xc9))[_0x0eb6('0x4c')](handleError(_0x4b7397,null));};exports['update']=function(_0x223e38,_0x2f7eae){if(_0x223e38[_0x0eb6('0x53')]['id']){delete _0x223e38[_0x0eb6('0x53')]['id'];}return db[_0x0eb6('0x47')][_0x0eb6('0x51')]({'where':{'id':_0x223e38[_0x0eb6('0x4d')]['id']}})[_0x0eb6('0x2a')](handleEntityNotFound(_0x2f7eae,null))[_0x0eb6('0x2a')](saveUpdates(_0x223e38[_0x0eb6('0x53')],null))[_0x0eb6('0x2a')](respondWithResult(_0x2f7eae,null))[_0x0eb6('0x4c')](handleError(_0x2f7eae,null));};exports[_0x0eb6('0x2b')]=function(_0x3a7106,_0x2049af){return db[_0x0eb6('0x47')][_0x0eb6('0x51')]({'where':{'id':_0x3a7106['params']['id']}})[_0x0eb6('0x2a')](handleEntityNotFound(_0x2049af,null))[_0x0eb6('0x2a')](removeEntity(_0x2049af,null))[_0x0eb6('0x4c')](handleError(_0x2049af,null));};exports['describe']=function(_0x30e2d3,_0xe6f663){return db['OpenchannelQueue'][_0x0eb6('0x59')]()[_0x0eb6('0x2a')](respondWithResult(_0xe6f663,null))['catch'](handleError(_0xe6f663,null));};exports[_0x0eb6('0x5a')]=function(_0x1b8cf8,_0x3f939a,_0x2468f8){var _0x5d34cc={'raw':!![],'where':{}},_0x4efaf5={},_0x1bff48;return db[_0x0eb6('0x47')][_0x0eb6('0x5b')]({'where':{'id':_0x1b8cf8[_0x0eb6('0x4d')]['id']}})[_0x0eb6('0x2a')](handleEntityNotFound(_0x3f939a,null))[_0x0eb6('0x2a')](function(_0x239724){if(_0x239724){_0x1bff48=_0x239724[_0x0eb6('0x2c')]({'plain':!![]});_0x4efaf5[_0x0eb6('0x38')]=_['keys'](db[_0x0eb6('0x5c')]['rawAttributes']);_0x4efaf5[_0x0eb6('0x39')]=_[_0x0eb6('0x4e')](_0x1b8cf8['query']);_0x4efaf5[_0x0eb6('0x41')]=_[_0x0eb6('0x3a')](_0x4efaf5[_0x0eb6('0x38')],_0x4efaf5[_0x0eb6('0x39')]);_0x5d34cc[_0x0eb6('0x3b')]=_['intersection'](_0x4efaf5[_0x0eb6('0x38')],qs['fields'](_0x1b8cf8[_0x0eb6('0x39')]['fields']));_0x5d34cc[_0x0eb6('0x3b')]=_0x5d34cc[_0x0eb6('0x3b')][_0x0eb6('0x4f')]?_0x5d34cc[_0x0eb6('0x3b')]:_0x4efaf5[_0x0eb6('0x38')];if(!_0x1b8cf8[_0x0eb6('0x39')][_0x0eb6('0x3d')](_0x0eb6('0x3e'))){_0x5d34cc[_0x0eb6('0x22')]=qs[_0x0eb6('0x22')](_0x1b8cf8[_0x0eb6('0x39')][_0x0eb6('0x22')]);_0x5d34cc[_0x0eb6('0x21')]=qs[_0x0eb6('0x21')](_0x1b8cf8[_0x0eb6('0x39')][_0x0eb6('0x21')]);}_0x5d34cc['order']=qs[_0x0eb6('0x40')](_0x1b8cf8[_0x0eb6('0x39')][_0x0eb6('0x40')]);_0x5d34cc[_0x0eb6('0x45')]=qs[_0x0eb6('0x41')](_[_0x0eb6('0x42')](_0x1b8cf8['query'],_0x4efaf5[_0x0eb6('0x41')]));_0x5d34cc[_0x0eb6('0x45')][_0x0eb6('0x5d')]=_0x239724['id'];if(_0x1b8cf8[_0x0eb6('0x39')][_0x0eb6('0x43')]){_0x5d34cc[_0x0eb6('0x45')]=_[_0x0eb6('0x44')](_0x5d34cc[_0x0eb6('0x45')],{'$or':_[_0x0eb6('0x33')](_0x5d34cc[_0x0eb6('0x3b')],function(_0x33b7ae){var _0x32d226={};_0x32d226[_0x33b7ae]={'$like':'%'+_0x1b8cf8[_0x0eb6('0x39')]['filter']+'%'};return _0x32d226;})});}_0x5d34cc=_[_0x0eb6('0x44')]({},_0x5d34cc,_0x1b8cf8['options']);return db[_0x0eb6('0x5c')]['findAll'](_0x5d34cc);}})[_0x0eb6('0x2a')](function(_0x360643){if(_0x360643){return db[_0x0eb6('0x5e')][_0x0eb6('0x5f')]({'where':{'id':_[_0x0eb6('0x33')](_0x360643,_0x0eb6('0x60')),'role':_0x0eb6('0x61')},'attributes':['id',_0x0eb6('0x31'),_0x0eb6('0x62'),'updatedAt',_0x0eb6('0x63')]});}})[_0x0eb6('0x2a')](function(_0x460d43){if(_0x460d43){return{'count':_0x460d43[_0x0eb6('0x24')],'rows':_[_0x0eb6('0x33')](_0x460d43[_0x0eb6('0x4b')],function(_0x5d4013){return{'membername':_0x5d4013[_0x0eb6('0x31')],'UserId':_0x5d4013['id'],'queue_name':_0x1bff48[_0x0eb6('0x31')],'OpenchannelQueueId':_0x1bff48['id'],'interface':util[_0x0eb6('0x64')](_0x0eb6('0x65'),_0x0eb6('0x66'),_0x5d4013[_0x0eb6('0x31')]),'penalty':0x0,'paused':_0x5d4013[_0x0eb6('0x62')],'createdAt':_0x5d4013['createdAt'],'updatedAt':_0x5d4013[_0x0eb6('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f939a,_0x5d34cc))[_0x0eb6('0x4c')](handleError(_0x3f939a,null));};exports[_0x0eb6('0x68')]=function(_0x13972d,_0x16553d,_0x5b49a9){var _0xff2d7e={};var _0x19c4c5={};var _0x1e333c;var _0x2c0c78;return db[_0x0eb6('0x47')]['findOne']({'where':{'id':_0x13972d[_0x0eb6('0x4d')]['id']}})[_0x0eb6('0x2a')](handleEntityNotFound(_0x16553d,null))[_0x0eb6('0x2a')](function(_0x2b749f){if(_0x2b749f){_0x1e333c=_0x2b749f;_0x19c4c5[_0x0eb6('0x38')]=_['keys'](db[_0x0eb6('0x69')][_0x0eb6('0x34')]);_0x19c4c5[_0x0eb6('0x39')]=_[_0x0eb6('0x4e')](_0x13972d[_0x0eb6('0x39')]);_0x19c4c5[_0x0eb6('0x41')]=_[_0x0eb6('0x3a')](_0x19c4c5[_0x0eb6('0x38')],_0x19c4c5[_0x0eb6('0x39')]);_0xff2d7e[_0x0eb6('0x3b')]=_[_0x0eb6('0x3a')](_0x19c4c5['model'],qs[_0x0eb6('0x3c')](_0x13972d['query'][_0x0eb6('0x3c')]));_0xff2d7e[_0x0eb6('0x3b')]=_0xff2d7e[_0x0eb6('0x3b')][_0x0eb6('0x4f')]?_0xff2d7e['attributes']:_0x19c4c5['model'];_0xff2d7e[_0x0eb6('0x3f')]=qs['sort'](_0x13972d[_0x0eb6('0x39')][_0x0eb6('0x40')]);_0xff2d7e[_0x0eb6('0x45')]=qs[_0x0eb6('0x41')](_[_0x0eb6('0x42')](_0x13972d[_0x0eb6('0x39')],_0x19c4c5[_0x0eb6('0x41')]));if(_0x13972d[_0x0eb6('0x39')][_0x0eb6('0x43')]){_0xff2d7e[_0x0eb6('0x45')]=_['merge'](_0xff2d7e['where'],{'$or':_[_0x0eb6('0x33')](_0xff2d7e[_0x0eb6('0x3b')],function(_0x1bdd73){var _0x3a276b={};_0x3a276b[_0x1bdd73]={'$like':'%'+_0x13972d[_0x0eb6('0x39')][_0x0eb6('0x43')]+'%'};return _0x3a276b;})});}_0xff2d7e=_[_0x0eb6('0x44')]({},_0xff2d7e,_0x13972d[_0x0eb6('0x50')]);return _0x1e333c['getTeams'](_0xff2d7e);}})['then'](function(_0x3161a2){if(_0x3161a2){_0x2c0c78=_0x3161a2[_0x0eb6('0x4f')];if(!_0x13972d[_0x0eb6('0x39')][_0x0eb6('0x3d')](_0x0eb6('0x3e'))){_0xff2d7e[_0x0eb6('0x22')]=qs['limit'](_0x13972d[_0x0eb6('0x39')]['limit']);_0xff2d7e['offset']=qs[_0x0eb6('0x21')](_0x13972d[_0x0eb6('0x39')][_0x0eb6('0x21')]);}return _0x1e333c[_0x0eb6('0x68')](_0xff2d7e);}})[_0x0eb6('0x2a')](function(_0x422155){if(_0x422155){return _0x422155?{'count':_0x2c0c78,'rows':_0x422155}:null;}})[_0x0eb6('0x2a')](respondWithResult(_0x16553d,null))[_0x0eb6('0x4c')](handleError(_0x16553d,null));};exports[_0x0eb6('0x6a')]=function(_0x3de261,_0x327ece,_0x1e08c8){var _0x53577a=_0x3de261[_0x0eb6('0x53')]['ids'];return db[_0x0eb6('0x69')][_0x0eb6('0x4a')]({'where':{'id':_0x53577a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0eb6('0x6b'),'attributes':['id',_0x0eb6('0x31'),_0x0eb6('0x6c'),'voicePause',_0x0eb6('0x6d')],'raw':!![]}]})[_0x0eb6('0x2a')](function(_0x2b0192){if(_0x2b0192){var _0x2529d6=_[_0x0eb6('0x6e')](_0x2b0192,function(_0x195ea6){var _0x569665=_0x195ea6[_0x0eb6('0x2c')]({'plain':!![]});return _0x569665[_0x0eb6('0x6b')];});return db['OpenchannelQueue'][_0x0eb6('0x51')]({'where':{'id':_0x3de261['params']['id']}})['then'](function(_0x290ded){return db[_0x0eb6('0x6f')][_0x0eb6('0x70')](function(_0x3ba31a){return _0x290ded[_0x0eb6('0x6a')](_0x53577a,{'transaction':_0x3ba31a})[_0x0eb6('0x2a')](function(){return BPromise[_0x0eb6('0x71')](_0x2529d6,function(_0x50bcf8){return db[_0x0eb6('0x5c')]['findOrCreate']({'where':{'UserId':_0x50bcf8['id'],'OpenchannelQueueId':_0x3de261[_0x0eb6('0x4d')]['id']},'transaction':_0x3ba31a});});})[_0x0eb6('0x2a')](function(){_0x2529d6[_0x0eb6('0x72')](function(_0x156718){socket[_0x0eb6('0x73')](_0x0eb6('0x74'),{'UserId':_0x156718['id'],'OpenchannelQueueId':_0x290ded['id']});});});});});}})[_0x0eb6('0x2a')](respondWithStatusCode(_0x327ece,null))[_0x0eb6('0x4c')](handleError(_0x327ece,null));};exports[_0x0eb6('0x75')]=function(_0x84e9cb,_0x4a7a54,_0xad6e2b){return db[_0x0eb6('0x69')][_0x0eb6('0x4a')]({'where':{'id':_0x84e9cb['query'][_0x0eb6('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0eb6('0x2a')](handleEntityNotFound(_0x4a7a54,null))[_0x0eb6('0x2a')](function(_0x56c191){var _0x209cf7=_[_0x0eb6('0x33')](_0x56c191,'id');var _0x4601fd=[];var _0x408eed=[];var _0x2a7262=squel[_0x0eb6('0x77')]();_0x2a7262[_0x0eb6('0x78')](_0x0eb6('0x79'))[_0x0eb6('0x7a')](_0x0eb6('0x7b'),'tq')[_0x0eb6('0x7c')](_0x0eb6('0x7d'),'ut',_0x0eb6('0x7e'))[_0x0eb6('0x45')]('OpenchannelQueueId\x20=\x20?',_0x84e9cb[_0x0eb6('0x4d')]['id']);for(var _0x1183e1=0x0;_0x1183e1<_0x56c191[_0x0eb6('0x4f')];_0x1183e1+=0x1){let _0x193020=_0x56c191[_0x1183e1];for(var _0x301ac5=0x0;_0x301ac5<_0x193020[_0x0eb6('0x6b')][_0x0eb6('0x4f')];_0x301ac5+=0x1){let _0x1204a4=_0x193020['Agents'][_0x301ac5];var _0x52d6a4=_0x2a7262[_0x0eb6('0x7f')]();_0x52d6a4[_0x0eb6('0x45')](_0x0eb6('0x80'),_0x1204a4['id']);_0x408eed[_0x0eb6('0x81')](db[_0x0eb6('0x6f')]['query'](_0x52d6a4[_0x0eb6('0x82')](),{'type':db[_0x0eb6('0x6f')]['QueryTypes'][_0x0eb6('0x83')]})[_0x0eb6('0x2a')](function(_0x4178de){if(_0x4178de[_0x0eb6('0x4f')]===0x1){return _0x1204a4['id'];}else{var _0x914b9a=_[_0x0eb6('0x84')](_['map'](_0x4178de,_0x0eb6('0x85')),function(_0x3ba4c3){return _[_0x0eb6('0x86')](_0x209cf7,_0x3ba4c3);});if(_0x914b9a){return _0x1204a4['id'];}}}));}}return BPromise[_0x0eb6('0x87')](_0x408eed)[_0x0eb6('0x2a')](function(_0x5d302c){_0x4601fd=_(_0x4601fd)['union'](_0x5d302c)['compact']()[_0x0eb6('0x88')]();return db['OpenchannelQueue'][_0x0eb6('0x51')]({'where':{'id':_0x84e9cb[_0x0eb6('0x4d')]['id']}})[_0x0eb6('0x2a')](function(_0x3e6961){return db[_0x0eb6('0x6f')][_0x0eb6('0x70')](function(_0x173944){return _0x3e6961[_0x0eb6('0x75')](_0x84e9cb[_0x0eb6('0x39')][_0x0eb6('0x76')],{'transaction':_0x173944})[_0x0eb6('0x2a')](function(){if(!_[_0x0eb6('0x89')](_0x4601fd)){return _0x3e6961[_0x0eb6('0x8a')](_0x4601fd,{'transaction':_0x173944});}})[_0x0eb6('0x2a')](function(){_0x4601fd['forEach'](function(_0x4771f5){socket[_0x0eb6('0x73')](_0x0eb6('0x8b'),{'UserId':_0x4771f5,'OpenchannelQueueId':_0x3e6961['id']});});});});});});})[_0x0eb6('0x2a')](respondWithStatusCode(_0x4a7a54,null))[_0x0eb6('0x4c')](handleError(_0x4a7a54,null));};exports[_0x0eb6('0x8c')]=function(_0x50f44d,_0x2a0399,_0x582c6a){return db[_0x0eb6('0x47')][_0x0eb6('0x51')]({'where':{'id':_0x50f44d[_0x0eb6('0x4d')]['id']}})[_0x0eb6('0x2a')](handleEntityNotFound(_0x2a0399,null))[_0x0eb6('0x2a')](function(_0x3ed4ec){if(_0x3ed4ec){return _0x3ed4ec[_0x0eb6('0x8c')](_0x50f44d['body']['ids'],_[_0x0eb6('0x8d')](_0x50f44d[_0x0eb6('0x53')],[_0x0eb6('0x76'),'id'])||{})['spread'](function(_0x482df3){for(var _0x1cd0ef=0x0;_0x1cd0ef<_0x50f44d[_0x0eb6('0x53')]['ids'][_0x0eb6('0x4f')];_0x1cd0ef+=0x1){socket[_0x0eb6('0x73')](_0x0eb6('0x74'),{'UserId':Number(_0x50f44d[_0x0eb6('0x53')][_0x0eb6('0x76')][_0x1cd0ef]),'OpenchannelQueueId':Number(_0x50f44d[_0x0eb6('0x4d')]['id'])});}return _0x482df3;});}})[_0x0eb6('0x2a')](respondWithResult(_0x2a0399,null))[_0x0eb6('0x4c')](handleError(_0x2a0399,null));};exports[_0x0eb6('0x8a')]=function(_0xef9fe1,_0x30330f,_0x47b16d){return db[_0x0eb6('0x47')][_0x0eb6('0x51')]({'where':{'id':_0xef9fe1['params']['id']}})['then'](handleEntityNotFound(_0x30330f,null))[_0x0eb6('0x2a')](function(_0x34f542){if(_0x34f542){return _0x34f542[_0x0eb6('0x8a')](_0xef9fe1['query'][_0x0eb6('0x76')])[_0x0eb6('0x2a')](function(){if(_['isArray'](_0xef9fe1['query'][_0x0eb6('0x76')])){for(var _0x5987d9=0x0;_0x5987d9<_0xef9fe1[_0x0eb6('0x39')][_0x0eb6('0x76')][_0x0eb6('0x4f')];_0x5987d9+=0x1){socket[_0x0eb6('0x73')](_0x0eb6('0x8b'),{'UserId':Number(_0xef9fe1['query'][_0x0eb6('0x76')][_0x5987d9]),'OpenchannelQueueId':Number(_0xef9fe1['params']['id'])});}}else{socket['emit'](_0x0eb6('0x8b'),{'UserId':Number(_0xef9fe1[_0x0eb6('0x39')][_0x0eb6('0x76')]),'OpenchannelQueueId':Number(_0xef9fe1['params']['id'])});}});}})[_0x0eb6('0x2a')](respondWithStatusCode(_0x30330f,null))[_0x0eb6('0x4c')](handleError(_0x30330f,null));};exports[_0x0eb6('0x8e')]=function(_0x1379bd,_0x1dc58f,_0x25d112){var _0x7d673a={};var _0x2d26a8={};var _0x57c3f1;var _0x103b3f;return db[_0x0eb6('0x47')][_0x0eb6('0x5b')]({'where':{'id':_0x1379bd[_0x0eb6('0x4d')]['id']}})[_0x0eb6('0x2a')](handleEntityNotFound(_0x1dc58f,null))[_0x0eb6('0x2a')](function(_0x587382){if(_0x587382){_0x57c3f1=_0x587382;_0x2d26a8[_0x0eb6('0x38')]=_[_0x0eb6('0x4e')](db[_0x0eb6('0x5e')]['rawAttributes']);_0x2d26a8['query']=_[_0x0eb6('0x4e')](_0x1379bd[_0x0eb6('0x39')]);_0x2d26a8[_0x0eb6('0x41')]=_[_0x0eb6('0x3a')](_0x2d26a8[_0x0eb6('0x38')],_0x2d26a8[_0x0eb6('0x39')]);_0x7d673a[_0x0eb6('0x3b')]=_[_0x0eb6('0x3a')](_0x2d26a8[_0x0eb6('0x38')],qs[_0x0eb6('0x3c')](_0x1379bd[_0x0eb6('0x39')][_0x0eb6('0x3c')]));_0x7d673a['attributes']=_0x7d673a[_0x0eb6('0x3b')][_0x0eb6('0x4f')]?_0x7d673a[_0x0eb6('0x3b')]:_0x2d26a8[_0x0eb6('0x38')];_0x7d673a['order']=qs['sort'](_0x1379bd[_0x0eb6('0x39')][_0x0eb6('0x40')]);_0x7d673a[_0x0eb6('0x45')]=qs['filters'](_['pick'](_0x1379bd['query'],_0x2d26a8[_0x0eb6('0x41')]));if(_0x1379bd[_0x0eb6('0x39')][_0x0eb6('0x43')]){_0x7d673a[_0x0eb6('0x45')]=_[_0x0eb6('0x44')](_0x7d673a['where'],{'$or':_[_0x0eb6('0x33')](_0x7d673a[_0x0eb6('0x3b')],function(_0x18270d){var _0x59b256={};_0x59b256[_0x18270d]={'$like':'%'+_0x1379bd[_0x0eb6('0x39')][_0x0eb6('0x43')]+'%'};return _0x59b256;})});}_0x7d673a=_[_0x0eb6('0x44')]({},_0x7d673a,_0x1379bd[_0x0eb6('0x50')]);return _0x57c3f1[_0x0eb6('0x8e')](_0x7d673a);}})[_0x0eb6('0x2a')](function(_0x12a689){if(_0x12a689){_0x103b3f=_0x12a689[_0x0eb6('0x4f')];if(!_0x1379bd[_0x0eb6('0x39')]['hasOwnProperty'](_0x0eb6('0x3e'))){_0x7d673a[_0x0eb6('0x22')]=qs[_0x0eb6('0x22')](_0x1379bd[_0x0eb6('0x39')][_0x0eb6('0x22')]);_0x7d673a[_0x0eb6('0x21')]=qs[_0x0eb6('0x21')](_0x1379bd[_0x0eb6('0x39')][_0x0eb6('0x21')]);}return _0x57c3f1[_0x0eb6('0x8e')](_0x7d673a);}})[_0x0eb6('0x2a')](function(_0x166940){if(_0x166940){return _0x166940?{'count':_0x103b3f,'rows':_0x166940}:null;}})['then'](respondWithResult(_0x1dc58f,null))[_0x0eb6('0x4c')](handleError(_0x1dc58f,null));}; \ No newline at end of file +var _0x35aa=['getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','userOpenchannelQueue:save','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','removeAgents','emit','userOpenchannelQueue:remove','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','status','json','undefined','count','offset','limit','set','Content-Range','save','then','get','OpenchannelQueues','destroy','end','sendStatus','stack','name','send','index','OpenchannelQueue','fieldName','key','map','keys','query','intersection','model','length','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','attributes','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','describe','getMembers','findOne','hasOwnProperty','pick','OpenchannelQueueId','UserOpenchannelQueue','User','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team'];(function(_0x16ced5,_0x4e113a){var _0xc55063=function(_0x2a0518){while(--_0x2a0518){_0x16ced5['push'](_0x16ced5['shift']());}};_0xc55063(++_0x4e113a);}(_0x35aa,0x1be));var _0xa35a=function(_0x3b4638,_0x2d8442){_0x3b4638=_0x3b4638-0x0;var _0x445338=_0x35aa[_0x3b4638];return _0x445338;};'use strict';var emlformat=require(_0xa35a('0x0'));var rimraf=require(_0xa35a('0x1'));var zipdir=require(_0xa35a('0x2'));var jsonpatch=require(_0xa35a('0x3'));var rp=require(_0xa35a('0x4'));var moment=require(_0xa35a('0x5'));var BPromise=require(_0xa35a('0x6'));var Mustache=require(_0xa35a('0x7'));var util=require(_0xa35a('0x8'));var path=require(_0xa35a('0x9'));var sox=require(_0xa35a('0xa'));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(_0xa35a('0xb'));var crypto=require(_0xa35a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa35a('0xd'));var toCsv=require(_0xa35a('0xe'));var querystring=require(_0xa35a('0xf'));var Papa=require(_0xa35a('0x10'));var Redis=require(_0xa35a('0x11'));var authService=require(_0xa35a('0x12'));var qs=require(_0xa35a('0x13'));var as=require(_0xa35a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa35a('0x15'));var utils=require('../../config/utils');var config=require(_0xa35a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa35a('0x17'))['db'];config[_0xa35a('0x18')]=_['defaults'](config[_0xa35a('0x18')],{'host':_0xa35a('0x19'),'port':0x18eb});var socket=require(_0xa35a('0x1a'))(new Redis(config[_0xa35a('0x18')]));require(_0xa35a('0x1b'))['register'](socket);function respondWithStatusCode(_0x3a7009,_0x217da7){_0x217da7=_0x217da7||0xcc;return function(_0x26e61d){if(_0x26e61d){return _0x3a7009['sendStatus'](_0x217da7);}return _0x3a7009[_0xa35a('0x1c')](_0x217da7)['end']();};}function respondWithResult(_0xe0ecb3,_0x67a699){_0x67a699=_0x67a699||0xc8;return function(_0x7db98f){if(_0x7db98f){return _0xe0ecb3[_0xa35a('0x1c')](_0x67a699)[_0xa35a('0x1d')](_0x7db98f);}};}function respondWithFilteredResult(_0x4c1807,_0x27d352){return function(_0xff5189){if(_0xff5189){var _0x577697=typeof _0x27d352['offset']==='undefined'&&typeof _0x27d352['limit']===_0xa35a('0x1e');var _0x57d3f4=_0xff5189[_0xa35a('0x1f')];var _0x418c26=_0x577697?0x0:_0x27d352[_0xa35a('0x20')];var _0x3105bc=_0x577697?_0xff5189['count']:_0x27d352[_0xa35a('0x20')]+_0x27d352[_0xa35a('0x21')];var _0x4bf16e;if(_0x3105bc>=_0x57d3f4){_0x3105bc=_0x57d3f4;_0x4bf16e=0xc8;}else{_0x4bf16e=0xce;}_0x4c1807[_0xa35a('0x1c')](_0x4bf16e);return _0x4c1807[_0xa35a('0x22')](_0xa35a('0x23'),_0x418c26+'-'+_0x3105bc+'/'+_0x57d3f4)[_0xa35a('0x1d')](_0xff5189);}return null;};}function patchUpdates(_0x4399ef){return function(_0x21e532){try{jsonpatch['apply'](_0x21e532,_0x4399ef,!![]);}catch(_0x415045){return BPromise['reject'](_0x415045);}return _0x21e532[_0xa35a('0x24')]();};}function saveUpdates(_0x217bd5,_0x979010){return function(_0x2e673c){if(_0x2e673c){return _0x2e673c['update'](_0x217bd5)[_0xa35a('0x25')](function(_0x13e800){return _0x13e800;});}return null;};}function removeEntity(_0x1b03bc,_0x3887cf){return function(_0x39624a){if(_0x39624a){return _0x39624a['destroy']()[_0xa35a('0x25')](function(){var _0x3d7731=_0x39624a[_0xa35a('0x26')]({'plain':!![]});var _0x460604=_0xa35a('0x27');return db['UserProfileResource'][_0xa35a('0x28')]({'where':{'type':_0x460604,'resourceId':_0x3d7731['id']}})['then'](function(){return _0x39624a;});})['then'](function(){_0x1b03bc['status'](0xcc)[_0xa35a('0x29')]();});}};}function handleEntityNotFound(_0x43fdb4,_0x1cff9d){return function(_0x3e3339){if(!_0x3e3339){_0x43fdb4[_0xa35a('0x2a')](0x194);}return _0x3e3339;};}function handleError(_0x91df2d,_0x3e5962){_0x3e5962=_0x3e5962||0x1f4;return function(_0x40db0b){logger['error'](_0x40db0b[_0xa35a('0x2b')]);if(_0x40db0b[_0xa35a('0x2c')]){delete _0x40db0b[_0xa35a('0x2c')];}_0x91df2d[_0xa35a('0x1c')](_0x3e5962)[_0xa35a('0x2d')](_0x40db0b);};}exports[_0xa35a('0x2e')]=function(_0x2bba00,_0x556260){var _0x5e4f66={},_0x2acaeb={},_0x54548c={'count':0x0,'rows':[]};var _0x1c844f=_['map'](db[_0xa35a('0x2f')]['rawAttributes'],function(_0x4b253d){return{'name':_0x4b253d[_0xa35a('0x30')],'type':_0x4b253d['type'][_0xa35a('0x31')]};});_0x2acaeb['model']=_[_0xa35a('0x32')](_0x1c844f,_0xa35a('0x2c'));_0x2acaeb['query']=_[_0xa35a('0x33')](_0x2bba00[_0xa35a('0x34')]);_0x2acaeb['filters']=_[_0xa35a('0x35')](_0x2acaeb[_0xa35a('0x36')],_0x2acaeb[_0xa35a('0x34')]);_0x5e4f66['attributes']=_[_0xa35a('0x35')](_0x2acaeb[_0xa35a('0x36')],qs['fields'](_0x2bba00['query']['fields']));_0x5e4f66['attributes']=_0x5e4f66['attributes'][_0xa35a('0x37')]?_0x5e4f66['attributes']:_0x2acaeb['model'];if(!_0x2bba00[_0xa35a('0x34')]['hasOwnProperty'](_0xa35a('0x38'))){_0x5e4f66[_0xa35a('0x21')]=qs[_0xa35a('0x21')](_0x2bba00[_0xa35a('0x34')]['limit']);_0x5e4f66['offset']=qs[_0xa35a('0x20')](_0x2bba00['query']['offset']);}_0x5e4f66[_0xa35a('0x39')]=qs[_0xa35a('0x3a')](_0x2bba00[_0xa35a('0x34')][_0xa35a('0x3a')]);_0x5e4f66['where']=qs[_0xa35a('0x3b')](_['pick'](_0x2bba00[_0xa35a('0x34')],_0x2acaeb[_0xa35a('0x3b')]),_0x1c844f);if(_0x2bba00[_0xa35a('0x34')]['filter']){_0x5e4f66[_0xa35a('0x3c')]=_[_0xa35a('0x3d')](_0x5e4f66[_0xa35a('0x3c')],{'$or':_[_0xa35a('0x32')](_0x1c844f,function(_0x3f88ef){if(_0x3f88ef['type']!==_0xa35a('0x3e')){var _0x4db7ca={};_0x4db7ca[_0x3f88ef['name']]={'$like':'%'+_0x2bba00[_0xa35a('0x34')][_0xa35a('0x3f')]+'%'};return _0x4db7ca;}})});}_0x5e4f66=_[_0xa35a('0x3d')]({},_0x5e4f66,_0x2bba00[_0xa35a('0x40')]);var _0x4fc155={'where':_0x5e4f66[_0xa35a('0x3c')]};return db[_0xa35a('0x2f')]['count'](_0x4fc155)[_0xa35a('0x25')](function(_0x5c135a){_0x54548c[_0xa35a('0x1f')]=_0x5c135a;if(_0x2bba00['query'][_0xa35a('0x41')]){_0x5e4f66['include']=[{'all':!![]}];}return db[_0xa35a('0x2f')][_0xa35a('0x42')](_0x5e4f66);})[_0xa35a('0x25')](function(_0x44377a){_0x54548c[_0xa35a('0x43')]=_0x44377a;return _0x54548c;})[_0xa35a('0x25')](respondWithFilteredResult(_0x556260,_0x5e4f66))[_0xa35a('0x44')](handleError(_0x556260,null));};exports[_0xa35a('0x45')]=function(_0x496cf4,_0x1ead1e){var _0x48f2b4={'raw':!![],'where':{'id':_0x496cf4[_0xa35a('0x46')]['id']}},_0x57a608={};_0x57a608[_0xa35a('0x36')]=_['keys'](db[_0xa35a('0x2f')][_0xa35a('0x47')]);_0x57a608[_0xa35a('0x34')]=_['keys'](_0x496cf4[_0xa35a('0x34')]);_0x57a608[_0xa35a('0x3b')]=_['intersection'](_0x57a608['model'],_0x57a608['query']);_0x48f2b4[_0xa35a('0x48')]=_[_0xa35a('0x35')](_0x57a608['model'],qs[_0xa35a('0x49')](_0x496cf4[_0xa35a('0x34')][_0xa35a('0x49')]));_0x48f2b4[_0xa35a('0x48')]=_0x48f2b4[_0xa35a('0x48')][_0xa35a('0x37')]?_0x48f2b4[_0xa35a('0x48')]:_0x57a608['model'];if(_0x496cf4[_0xa35a('0x34')]['includeAll']){_0x48f2b4[_0xa35a('0x4a')]=[{'all':!![]}];}_0x48f2b4=_['merge']({},_0x48f2b4,_0x496cf4[_0xa35a('0x40')]);return db['OpenchannelQueue'][_0xa35a('0x4b')](_0x48f2b4)[_0xa35a('0x25')](handleEntityNotFound(_0x1ead1e,null))['then'](respondWithResult(_0x1ead1e,null))['catch'](handleError(_0x1ead1e,null));};exports[_0xa35a('0x4c')]=function(_0x7cba7c,_0x480281){return db[_0xa35a('0x2f')][_0xa35a('0x4c')](_0x7cba7c[_0xa35a('0x4d')],{})[_0xa35a('0x25')](function(_0x442606){var _0x5dc611=_0x7cba7c[_0xa35a('0x4e')][_0xa35a('0x26')]({'plain':!![]});if(!_0x5dc611)throw new Error(_0xa35a('0x4f'));if(_0x5dc611['role']===_0xa35a('0x4e')){var _0x1ab270=_0x442606[_0xa35a('0x26')]({'plain':!![]});var _0x4e1e0b=_0xa35a('0x27');return db[_0xa35a('0x50')][_0xa35a('0x4b')]({'where':{'name':_0x4e1e0b,'userProfileId':_0x5dc611[_0xa35a('0x51')]},'raw':!![]})['then'](function(_0xc217fd){if(_0xc217fd&&_0xc217fd[_0xa35a('0x52')]===0x0){return db[_0xa35a('0x53')][_0xa35a('0x4c')]({'name':_0x1ab270[_0xa35a('0x2c')],'resourceId':_0x1ab270['id'],'type':_0xc217fd[_0xa35a('0x2c')],'sectionId':_0xc217fd['id']},{})[_0xa35a('0x25')](function(){return _0x442606;});}else{return _0x442606;}})[_0xa35a('0x44')](function(_0x50c0ae){logger[_0xa35a('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50c0ae);throw _0x50c0ae;});}return _0x442606;})[_0xa35a('0x25')](respondWithResult(_0x480281,0xc9))[_0xa35a('0x44')](handleError(_0x480281,null));};exports[_0xa35a('0x55')]=function(_0x3da24c,_0x1ea425){if(_0x3da24c[_0xa35a('0x4d')]['id']){delete _0x3da24c[_0xa35a('0x4d')]['id'];}return db[_0xa35a('0x2f')][_0xa35a('0x4b')]({'where':{'id':_0x3da24c[_0xa35a('0x46')]['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x1ea425,null))['then'](saveUpdates(_0x3da24c[_0xa35a('0x4d')],null))[_0xa35a('0x25')](respondWithResult(_0x1ea425,null))[_0xa35a('0x44')](handleError(_0x1ea425,null));};exports[_0xa35a('0x28')]=function(_0x3cd28c,_0x1c02b8){return db[_0xa35a('0x2f')][_0xa35a('0x4b')]({'where':{'id':_0x3cd28c['params']['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x1c02b8,null))[_0xa35a('0x25')](removeEntity(_0x1c02b8,null))[_0xa35a('0x44')](handleError(_0x1c02b8,null));};exports[_0xa35a('0x56')]=function(_0x5d59a2,_0x122c2a){return db[_0xa35a('0x2f')]['describe']()[_0xa35a('0x25')](respondWithResult(_0x122c2a,null))[_0xa35a('0x44')](handleError(_0x122c2a,null));};exports[_0xa35a('0x57')]=function(_0x43d137,_0x56a747,_0x41f7f1){var _0x1d39ec={'raw':!![],'where':{}},_0x455f8c={},_0x312403;return db[_0xa35a('0x2f')][_0xa35a('0x58')]({'where':{'id':_0x43d137['params']['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x56a747,null))[_0xa35a('0x25')](function(_0x4f617c){if(_0x4f617c){_0x312403=_0x4f617c[_0xa35a('0x26')]({'plain':!![]});_0x455f8c[_0xa35a('0x36')]=_[_0xa35a('0x33')](db['UserOpenchannelQueue']['rawAttributes']);_0x455f8c[_0xa35a('0x34')]=_[_0xa35a('0x33')](_0x43d137[_0xa35a('0x34')]);_0x455f8c[_0xa35a('0x3b')]=_[_0xa35a('0x35')](_0x455f8c['model'],_0x455f8c[_0xa35a('0x34')]);_0x1d39ec[_0xa35a('0x48')]=_[_0xa35a('0x35')](_0x455f8c[_0xa35a('0x36')],qs[_0xa35a('0x49')](_0x43d137['query']['fields']));_0x1d39ec['attributes']=_0x1d39ec[_0xa35a('0x48')]['length']?_0x1d39ec[_0xa35a('0x48')]:_0x455f8c['model'];if(!_0x43d137[_0xa35a('0x34')][_0xa35a('0x59')]('nolimit')){_0x1d39ec[_0xa35a('0x21')]=qs[_0xa35a('0x21')](_0x43d137[_0xa35a('0x34')][_0xa35a('0x21')]);_0x1d39ec[_0xa35a('0x20')]=qs[_0xa35a('0x20')](_0x43d137[_0xa35a('0x34')]['offset']);}_0x1d39ec[_0xa35a('0x39')]=qs[_0xa35a('0x3a')](_0x43d137[_0xa35a('0x34')][_0xa35a('0x3a')]);_0x1d39ec['where']=qs[_0xa35a('0x3b')](_[_0xa35a('0x5a')](_0x43d137['query'],_0x455f8c[_0xa35a('0x3b')]));_0x1d39ec[_0xa35a('0x3c')][_0xa35a('0x5b')]=_0x4f617c['id'];if(_0x43d137[_0xa35a('0x34')][_0xa35a('0x3f')]){_0x1d39ec[_0xa35a('0x3c')]=_[_0xa35a('0x3d')](_0x1d39ec[_0xa35a('0x3c')],{'$or':_[_0xa35a('0x32')](_0x1d39ec['attributes'],function(_0x2c9ab4){var _0x4933b6={};_0x4933b6[_0x2c9ab4]={'$like':'%'+_0x43d137['query'][_0xa35a('0x3f')]+'%'};return _0x4933b6;})});}_0x1d39ec=_['merge']({},_0x1d39ec,_0x43d137[_0xa35a('0x40')]);return db[_0xa35a('0x5c')][_0xa35a('0x42')](_0x1d39ec);}})['then'](function(_0x56d29b){if(_0x56d29b){return db[_0xa35a('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x56d29b,'UserId'),'role':_0xa35a('0x5e')},'attributes':['id',_0xa35a('0x2c'),_0xa35a('0x5f'),_0xa35a('0x60'),_0xa35a('0x61')]});}})[_0xa35a('0x25')](function(_0x4c6531){if(_0x4c6531){return{'count':_0x4c6531[_0xa35a('0x1f')],'rows':_[_0xa35a('0x32')](_0x4c6531[_0xa35a('0x43')],function(_0x1639e4){return{'membername':_0x1639e4[_0xa35a('0x2c')],'UserId':_0x1639e4['id'],'queue_name':_0x312403['name'],'OpenchannelQueueId':_0x312403['id'],'interface':util[_0xa35a('0x62')](_0xa35a('0x63'),_0xa35a('0x64'),_0x1639e4[_0xa35a('0x2c')]),'penalty':0x0,'paused':_0x1639e4['openchannelPause'],'createdAt':_0x1639e4['createdAt'],'updatedAt':_0x1639e4[_0xa35a('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa35a('0x25')](respondWithFilteredResult(_0x56a747,_0x1d39ec))[_0xa35a('0x44')](handleError(_0x56a747,null));};exports['getTeams']=function(_0x216676,_0x105593,_0x5163f6){var _0x41f962={};var _0x33abf3={};var _0x1ca2ee;var _0x45997c;return db[_0xa35a('0x2f')]['findOne']({'where':{'id':_0x216676[_0xa35a('0x46')]['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x105593,null))['then'](function(_0x4b1c91){if(_0x4b1c91){_0x1ca2ee=_0x4b1c91;_0x33abf3[_0xa35a('0x36')]=_[_0xa35a('0x33')](db[_0xa35a('0x65')][_0xa35a('0x47')]);_0x33abf3[_0xa35a('0x34')]=_[_0xa35a('0x33')](_0x216676[_0xa35a('0x34')]);_0x33abf3[_0xa35a('0x3b')]=_['intersection'](_0x33abf3[_0xa35a('0x36')],_0x33abf3[_0xa35a('0x34')]);_0x41f962['attributes']=_['intersection'](_0x33abf3[_0xa35a('0x36')],qs[_0xa35a('0x49')](_0x216676[_0xa35a('0x34')][_0xa35a('0x49')]));_0x41f962['attributes']=_0x41f962[_0xa35a('0x48')][_0xa35a('0x37')]?_0x41f962[_0xa35a('0x48')]:_0x33abf3[_0xa35a('0x36')];_0x41f962['order']=qs[_0xa35a('0x3a')](_0x216676['query'][_0xa35a('0x3a')]);_0x41f962[_0xa35a('0x3c')]=qs[_0xa35a('0x3b')](_[_0xa35a('0x5a')](_0x216676[_0xa35a('0x34')],_0x33abf3['filters']));if(_0x216676[_0xa35a('0x34')]['filter']){_0x41f962['where']=_['merge'](_0x41f962['where'],{'$or':_['map'](_0x41f962[_0xa35a('0x48')],function(_0x285c0a){var _0x1b4a83={};_0x1b4a83[_0x285c0a]={'$like':'%'+_0x216676['query'][_0xa35a('0x3f')]+'%'};return _0x1b4a83;})});}_0x41f962=_[_0xa35a('0x3d')]({},_0x41f962,_0x216676[_0xa35a('0x40')]);return _0x1ca2ee[_0xa35a('0x66')](_0x41f962);}})[_0xa35a('0x25')](function(_0x23801c){if(_0x23801c){_0x45997c=_0x23801c[_0xa35a('0x37')];if(!_0x216676[_0xa35a('0x34')][_0xa35a('0x59')](_0xa35a('0x38'))){_0x41f962['limit']=qs[_0xa35a('0x21')](_0x216676[_0xa35a('0x34')][_0xa35a('0x21')]);_0x41f962[_0xa35a('0x20')]=qs[_0xa35a('0x20')](_0x216676[_0xa35a('0x34')][_0xa35a('0x20')]);}return _0x1ca2ee[_0xa35a('0x66')](_0x41f962);}})['then'](function(_0x5db7c4){if(_0x5db7c4){return _0x5db7c4?{'count':_0x45997c,'rows':_0x5db7c4}:null;}})['then'](respondWithResult(_0x105593,null))[_0xa35a('0x44')](handleError(_0x105593,null));};exports[_0xa35a('0x67')]=function(_0x2d2c80,_0x40592a,_0x1a6636){var _0x5a3465=_0x2d2c80[_0xa35a('0x4d')][_0xa35a('0x68')];return db[_0xa35a('0x65')]['findAll']({'where':{'id':_0x5a3465},'attributes':['id'],'include':[{'model':db[_0xa35a('0x5d')],'as':_0xa35a('0x69'),'attributes':['id',_0xa35a('0x2c'),_0xa35a('0x6a'),_0xa35a('0x6b'),'interface'],'raw':!![]}]})[_0xa35a('0x25')](function(_0x242092){if(_0x242092){var _0xf840bd=_[_0xa35a('0x6c')](_0x242092,function(_0x20fca0){var _0x4ec466=_0x20fca0[_0xa35a('0x26')]({'plain':!![]});return _0x4ec466[_0xa35a('0x69')];});return db[_0xa35a('0x2f')][_0xa35a('0x4b')]({'where':{'id':_0x2d2c80[_0xa35a('0x46')]['id']}})[_0xa35a('0x25')](function(_0x4140d1){return db[_0xa35a('0x6d')]['transaction'](function(_0x616383){return _0x4140d1[_0xa35a('0x67')](_0x5a3465,{'transaction':_0x616383})[_0xa35a('0x25')](function(){return BPromise[_0xa35a('0x6e')](_0xf840bd,function(_0x38abf0){return db[_0xa35a('0x5c')][_0xa35a('0x6f')]({'where':{'UserId':_0x38abf0['id'],'OpenchannelQueueId':_0x2d2c80[_0xa35a('0x46')]['id']},'transaction':_0x616383});});})['then'](function(){_0xf840bd['forEach'](function(_0x3db89e){socket['emit'](_0xa35a('0x70'),{'UserId':_0x3db89e['id'],'OpenchannelQueueId':_0x4140d1['id']});});});});});}})[_0xa35a('0x25')](respondWithStatusCode(_0x40592a,null))[_0xa35a('0x44')](handleError(_0x40592a,null));};exports['removeTeams']=function(_0xf04df5,_0x2acaca,_0x2cac83){return db[_0xa35a('0x65')][_0xa35a('0x42')]({'where':{'id':_0xf04df5[_0xa35a('0x34')][_0xa35a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa35a('0x5d')],'as':_0xa35a('0x69'),'attributes':['id'],'raw':!![]}]})[_0xa35a('0x25')](handleEntityNotFound(_0x2acaca,null))['then'](function(_0xd6d1ee){var _0x787506=_['map'](_0xd6d1ee,'id');var _0x11c437=[];var _0x579af0=[];var _0x126bf7=squel[_0xa35a('0x71')]();_0x126bf7[_0xa35a('0x72')]('tq.TeamId')[_0xa35a('0x73')](_0xa35a('0x74'),'tq')[_0xa35a('0x75')](_0xa35a('0x76'),'ut',_0xa35a('0x77'))[_0xa35a('0x3c')]('OpenchannelQueueId\x20=\x20?',_0xf04df5['params']['id']);for(var _0x106b1=0x0;_0x106b1<_0xd6d1ee[_0xa35a('0x37')];_0x106b1+=0x1){let _0x3c9da6=_0xd6d1ee[_0x106b1];for(var _0x4726a4=0x0;_0x4726a4<_0x3c9da6['Agents'][_0xa35a('0x37')];_0x4726a4+=0x1){let _0x4fc270=_0x3c9da6[_0xa35a('0x69')][_0x4726a4];var _0x516ed0=_0x126bf7['clone']();_0x516ed0[_0xa35a('0x3c')](_0xa35a('0x78'),_0x4fc270['id']);_0x579af0['push'](db[_0xa35a('0x6d')][_0xa35a('0x34')](_0x516ed0['toString'](),{'type':db['sequelize'][_0xa35a('0x79')][_0xa35a('0x7a')]})[_0xa35a('0x25')](function(_0x200c88){if(_0x200c88[_0xa35a('0x37')]===0x1){return _0x4fc270['id'];}else{var _0x13ef84=_[_0xa35a('0x7b')](_[_0xa35a('0x32')](_0x200c88,'TeamId'),function(_0x44f331){return _[_0xa35a('0x7c')](_0x787506,_0x44f331);});if(_0x13ef84){return _0x4fc270['id'];}}}));}}return BPromise[_0xa35a('0x7d')](_0x579af0)['then'](function(_0x2b2c4b){_0x11c437=_(_0x11c437)[_0xa35a('0x7e')](_0x2b2c4b)[_0xa35a('0x7f')]()[_0xa35a('0x80')]();return db['OpenchannelQueue'][_0xa35a('0x4b')]({'where':{'id':_0xf04df5['params']['id']}})[_0xa35a('0x25')](function(_0x1580e1){return db[_0xa35a('0x6d')][_0xa35a('0x81')](function(_0xa2fbfd){return _0x1580e1[_0xa35a('0x82')](_0xf04df5[_0xa35a('0x34')][_0xa35a('0x68')],{'transaction':_0xa2fbfd})[_0xa35a('0x25')](function(){if(!_['isEmpty'](_0x11c437)){return _0x1580e1[_0xa35a('0x83')](_0x11c437,{'transaction':_0xa2fbfd});}})[_0xa35a('0x25')](function(){_0x11c437['forEach'](function(_0x2b622a){socket[_0xa35a('0x84')](_0xa35a('0x85'),{'UserId':_0x2b622a,'OpenchannelQueueId':_0x1580e1['id']});});});});});});})[_0xa35a('0x25')](respondWithStatusCode(_0x2acaca,null))[_0xa35a('0x44')](handleError(_0x2acaca,null));};exports['addAgents']=function(_0x5f3147,_0x3ee75d,_0xd9d806){return db[_0xa35a('0x2f')][_0xa35a('0x4b')]({'where':{'id':_0x5f3147[_0xa35a('0x46')]['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x3ee75d,null))[_0xa35a('0x25')](function(_0x198c2f){if(_0x198c2f){return _0x198c2f['addAgents'](_0x5f3147[_0xa35a('0x4d')][_0xa35a('0x68')],_[_0xa35a('0x86')](_0x5f3147[_0xa35a('0x4d')],[_0xa35a('0x68'),'id'])||{})[_0xa35a('0x87')](function(_0x1c363b){for(var _0x3ac43c=0x0;_0x3ac43c<_0x5f3147[_0xa35a('0x4d')][_0xa35a('0x68')][_0xa35a('0x37')];_0x3ac43c+=0x1){socket[_0xa35a('0x84')](_0xa35a('0x70'),{'UserId':Number(_0x5f3147[_0xa35a('0x4d')][_0xa35a('0x68')][_0x3ac43c]),'OpenchannelQueueId':Number(_0x5f3147[_0xa35a('0x46')]['id'])});}return _0x1c363b;});}})[_0xa35a('0x25')](respondWithResult(_0x3ee75d,null))[_0xa35a('0x44')](handleError(_0x3ee75d,null));};exports[_0xa35a('0x83')]=function(_0x4a54d8,_0x523294,_0x446387){return db[_0xa35a('0x2f')][_0xa35a('0x4b')]({'where':{'id':_0x4a54d8['params']['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x523294,null))[_0xa35a('0x25')](function(_0x3008bb){if(_0x3008bb){return _0x3008bb[_0xa35a('0x83')](_0x4a54d8[_0xa35a('0x34')][_0xa35a('0x68')])['then'](function(){if(_['isArray'](_0x4a54d8[_0xa35a('0x34')][_0xa35a('0x68')])){for(var _0x1541f0=0x0;_0x1541f0<_0x4a54d8[_0xa35a('0x34')][_0xa35a('0x68')][_0xa35a('0x37')];_0x1541f0+=0x1){socket[_0xa35a('0x84')](_0xa35a('0x85'),{'UserId':Number(_0x4a54d8[_0xa35a('0x34')][_0xa35a('0x68')][_0x1541f0]),'OpenchannelQueueId':Number(_0x4a54d8[_0xa35a('0x46')]['id'])});}}else{socket[_0xa35a('0x84')](_0xa35a('0x85'),{'UserId':Number(_0x4a54d8[_0xa35a('0x34')][_0xa35a('0x68')]),'OpenchannelQueueId':Number(_0x4a54d8[_0xa35a('0x46')]['id'])});}});}})[_0xa35a('0x25')](respondWithStatusCode(_0x523294,null))['catch'](handleError(_0x523294,null));};exports[_0xa35a('0x88')]=function(_0x3a3f7e,_0x57832e,_0x4a20d2){var _0x3d490f={};var _0xdbaa87={};var _0x3fb774;var _0x28ad06;return db[_0xa35a('0x2f')]['findOne']({'where':{'id':_0x3a3f7e[_0xa35a('0x46')]['id']}})[_0xa35a('0x25')](handleEntityNotFound(_0x57832e,null))[_0xa35a('0x25')](function(_0x513a53){if(_0x513a53){_0x3fb774=_0x513a53;_0xdbaa87[_0xa35a('0x36')]=_['keys'](db[_0xa35a('0x5d')][_0xa35a('0x47')]);_0xdbaa87[_0xa35a('0x34')]=_[_0xa35a('0x33')](_0x3a3f7e[_0xa35a('0x34')]);_0xdbaa87[_0xa35a('0x3b')]=_[_0xa35a('0x35')](_0xdbaa87[_0xa35a('0x36')],_0xdbaa87[_0xa35a('0x34')]);_0x3d490f['attributes']=_[_0xa35a('0x35')](_0xdbaa87[_0xa35a('0x36')],qs[_0xa35a('0x49')](_0x3a3f7e[_0xa35a('0x34')]['fields']));_0x3d490f[_0xa35a('0x48')]=_0x3d490f[_0xa35a('0x48')][_0xa35a('0x37')]?_0x3d490f[_0xa35a('0x48')]:_0xdbaa87[_0xa35a('0x36')];_0x3d490f['order']=qs[_0xa35a('0x3a')](_0x3a3f7e[_0xa35a('0x34')][_0xa35a('0x3a')]);_0x3d490f[_0xa35a('0x3c')]=qs[_0xa35a('0x3b')](_[_0xa35a('0x5a')](_0x3a3f7e[_0xa35a('0x34')],_0xdbaa87[_0xa35a('0x3b')]));if(_0x3a3f7e[_0xa35a('0x34')][_0xa35a('0x3f')]){_0x3d490f[_0xa35a('0x3c')]=_[_0xa35a('0x3d')](_0x3d490f[_0xa35a('0x3c')],{'$or':_[_0xa35a('0x32')](_0x3d490f['attributes'],function(_0x5ece5a){var _0x530701={};_0x530701[_0x5ece5a]={'$like':'%'+_0x3a3f7e[_0xa35a('0x34')][_0xa35a('0x3f')]+'%'};return _0x530701;})});}_0x3d490f=_[_0xa35a('0x3d')]({},_0x3d490f,_0x3a3f7e[_0xa35a('0x40')]);return _0x3fb774[_0xa35a('0x88')](_0x3d490f);}})[_0xa35a('0x25')](function(_0x4f13a5){if(_0x4f13a5){_0x28ad06=_0x4f13a5[_0xa35a('0x37')];if(!_0x3a3f7e[_0xa35a('0x34')]['hasOwnProperty']('nolimit')){_0x3d490f[_0xa35a('0x21')]=qs[_0xa35a('0x21')](_0x3a3f7e[_0xa35a('0x34')][_0xa35a('0x21')]);_0x3d490f[_0xa35a('0x20')]=qs[_0xa35a('0x20')](_0x3a3f7e[_0xa35a('0x34')][_0xa35a('0x20')]);}return _0x3fb774[_0xa35a('0x88')](_0x3d490f);}})[_0xa35a('0x25')](function(_0x361a9b){if(_0x361a9b){return _0x361a9b?{'count':_0x28ad06,'rows':_0x361a9b}:null;}})[_0xa35a('0x25')](respondWithResult(_0x57832e,null))[_0xa35a('0x44')](handleError(_0x57832e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 5dff319..7b2f649 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 _0xef54=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','remove'];(function(_0x2505c4,_0x5f1183){var _0x8e9396=function(_0x56fcfe){while(--_0x56fcfe){_0x2505c4['push'](_0x2505c4['shift']());}};_0x8e9396(++_0x5f1183);}(_0xef54,0x1cb));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x4ef5('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ef5('0x1'),'afterUpdate':'update','afterDestroy':_0x4ef5('0x2')};function emitEvent(_0x38d208){return function(_0x12b439,_0x4ca9e4,_0x57cf20){OpenchannelQueueEvents['emit'](_0x38d208+':'+_0x12b439['id'],_0x12b439);OpenchannelQueueEvents[_0x4ef5('0x3')](_0x38d208,_0x12b439);_0x57cf20(null);};}for(var e in events){if(events[_0x4ef5('0x4')](e)){var event=events[e];OpenchannelQueue[_0x4ef5('0x5')](e,emitEvent(event));}}module[_0x4ef5('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb89c=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb89c,0x1c4));var _0xcb89=function(_0xe7ac50,_0x51fed6){_0xe7ac50=_0xe7ac50-0x0;var _0x46f6e3=_0xb89c[_0xe7ac50];return _0x46f6e3;};'use strict';var EventEmitter=require(_0xcb89('0x0'));var OpenchannelQueue=require(_0xcb89('0x1'))['db'][_0xcb89('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xcb89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb89('0x4'),'afterDestroy':_0xcb89('0x5')};function emitEvent(_0x3b780d){return function(_0x52e58b,_0x3e1e11,_0x31eae8){OpenchannelQueueEvents[_0xcb89('0x6')](_0x3b780d+':'+_0x52e58b['id'],_0x52e58b);OpenchannelQueueEvents[_0xcb89('0x6')](_0x3b780d,_0x52e58b);_0x31eae8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xcb89('0x7')](e,emitEvent(event));}}module[_0xcb89('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b39ee50..420bd24 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 _0xb352=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','OpenchannelQueue','openchannel_queues'];(function(_0x9c3e39,_0x4dfd75){var _0xe6f5a9=function(_0x4377e5){while(--_0x4377e5){_0x9c3e39['push'](_0x9c3e39['shift']());}};_0xe6f5a9(++_0x4dfd75);}(_0xb352,0xa5));var _0x2b35=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb352[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x2b35('0x0'));var util=require(_0x2b35('0x1'));var logger=require('../../config/logger')(_0x2b35('0x2'));var moment=require(_0x2b35('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b35('0x4'));var fs=require('fs');var path=require(_0x2b35('0x5'));var rimraf=require(_0x2b35('0x6'));var config=require(_0x2b35('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x2b35('0x8')]=function(_0x4320fb,_0xea37d0){return _0x4320fb['define'](_0x2b35('0x9'),attributes,{'tableName':_0x2b35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f0e=['exports','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7f0e,0xff));var _0xe7f0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7f0e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xe7f0('0x0'));var util=require('util');var logger=require(_0xe7f0('0x1'))(_0xe7f0('0x2'));var moment=require(_0xe7f0('0x3'));var BPromise=require(_0xe7f0('0x4'));var rp=require(_0xe7f0('0x5'));var fs=require('fs');var path=require(_0xe7f0('0x6'));var rimraf=require('rimraf');var config=require(_0xe7f0('0x7'));var attributes=require(_0xe7f0('0x8'));module[_0xe7f0('0x9')]=function(_0x4e9d8d,_0x27dd6a){return _0x4e9d8d['define']('OpenchannelQueue',attributes,{'tableName':_0xe7f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 5b0b389..5141b9b 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 _0x814e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','map','include','model','ShowOpenchannelQueue','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x814e,0x189));var _0xe814=function(_0x5aa870,_0x15df2b){_0x5aa870=_0x5aa870-0x0;var _0x101d68=_0x814e[_0x5aa870];return _0x101d68;};'use strict';var _=require(_0xe814('0x0'));var util=require(_0xe814('0x1'));var moment=require(_0xe814('0x2'));var BPromise=require(_0xe814('0x3'));var rs=require(_0xe814('0x4'));var fs=require('fs');var Redis=require(_0xe814('0x5'));var db=require(_0xe814('0x6'))['db'];var utils=require(_0xe814('0x7'));var logger=require(_0xe814('0x8'))('rpc');var config=require(_0xe814('0x9'));var jayson=require(_0xe814('0xa'));var client=jayson[_0xe814('0xb')]['http']({'port':0x232a});config['redis']=_[_0xe814('0xc')](config[_0xe814('0xd')],{'host':_0xe814('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xe814('0xf')](socket);function respondWithRpcPromise(_0x17ace9,_0x1094a9,_0x2733c3){return new BPromise(function(_0x1282e6,_0x2bdf12){return client[_0xe814('0x10')](_0x17ace9,_0x2733c3)[_0xe814('0x11')](function(_0x56ef83){logger[_0xe814('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1094a9,_0xe814('0x13'));logger[_0xe814('0x14')](_0xe814('0x15'),_0x1094a9,'request\x20sent',JSON[_0xe814('0x16')](_0x56ef83));if(_0x56ef83[_0xe814('0x17')]){if(_0x56ef83[_0xe814('0x17')][_0xe814('0x18')]===0x1f4){logger[_0xe814('0x17')](_0xe814('0x19'),_0x1094a9,_0x56ef83['error'][_0xe814('0x1a')]);return _0x2bdf12(_0x56ef83[_0xe814('0x17')]['message']);}logger[_0xe814('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x1094a9,_0x56ef83[_0xe814('0x17')][_0xe814('0x1a')]);return _0x1282e6(_0x56ef83['error'][_0xe814('0x1a')]);}else{logger['info'](_0xe814('0x19'),_0x1094a9,_0xe814('0x13'));_0x1282e6(_0x56ef83[_0xe814('0x1b')]['message']);}})[_0xe814('0x1c')](function(_0x29de88){logger[_0xe814('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x1094a9,_0x29de88);_0x2bdf12(_0x29de88);});});}exports[_0xe814('0x1d')]=function(_0xfd93a3){var _0x264f29=this;return new Promise(function(_0xc5b461,_0x241260){return db[_0xe814('0x1e')][_0xe814('0x1f')]({'raw':_0xfd93a3[_0xe814('0x20')]?_0xfd93a3[_0xe814('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xfd93a3[_0xe814('0x20')]?_0xfd93a3[_0xe814('0x20')]['where']||null:null,'attributes':_0xfd93a3[_0xe814('0x20')]?_0xfd93a3[_0xe814('0x20')][_0xe814('0x21')]||null:null,'limit':_0xfd93a3[_0xe814('0x20')]?_0xfd93a3['options']['limit']||null:null,'include':_0xfd93a3['options']?_0xfd93a3[_0xe814('0x20')]['include']?_[_0xe814('0x22')](_0xfd93a3[_0xe814('0x20')][_0xe814('0x23')],function(_0x48c865){return{'model':db[_0x48c865[_0xe814('0x24')]],'as':_0x48c865['as'],'attributes':_0x48c865[_0xe814('0x21')],'include':_0x48c865[_0xe814('0x23')]?_[_0xe814('0x22')](_0x48c865[_0xe814('0x23')],function(_0x2f2590){return{'model':db[_0x2f2590['model']],'as':_0x2f2590['as'],'attributes':_0x2f2590[_0xe814('0x21')],'include':_0x2f2590[_0xe814('0x23')]?_[_0xe814('0x22')](_0x2f2590[_0xe814('0x23')],function(_0x21cfff){return{'model':db[_0x21cfff['model']],'as':_0x21cfff['as'],'attributes':_0x21cfff[_0xe814('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe814('0x11')](function(_0x5938ce){logger[_0xe814('0x12')](_0xe814('0x1d'),_0xfd93a3);logger['debug'](_0xe814('0x1d'),_0xfd93a3,JSON[_0xe814('0x16')](_0x5938ce));_0xc5b461(_0x5938ce);})[_0xe814('0x1c')](function(_0x5e6f7c){logger[_0xe814('0x17')](_0xe814('0x1d'),_0x5e6f7c['message'],_0xfd93a3);_0x241260(_0x264f29[_0xe814('0x17')](0x1f4,_0x5e6f7c[_0xe814('0x1a')]));});});};exports[_0xe814('0x25')]=function(_0x44b25d){var _0x4f264e=this;return new Promise(function(_0x1e974d,_0xb8a77){return db['OpenchannelQueue']['find']({'raw':_0x44b25d[_0xe814('0x20')]?_0x44b25d[_0xe814('0x20')][_0xe814('0x26')]===undefined?!![]:![]:!![],'where':_0x44b25d['options']?_0x44b25d['options'][_0xe814('0x27')]||null:null,'attributes':_0x44b25d[_0xe814('0x20')]?_0x44b25d[_0xe814('0x20')][_0xe814('0x21')]||null:null,'include':_0x44b25d[_0xe814('0x20')]?_0x44b25d[_0xe814('0x20')]['include']?_[_0xe814('0x22')](_0x44b25d[_0xe814('0x20')]['include'],function(_0x370503){return{'model':db[_0x370503['model']],'as':_0x370503['as'],'attributes':_0x370503[_0xe814('0x21')],'include':_0x370503['include']?_[_0xe814('0x22')](_0x370503['include'],function(_0x2584fa){return{'model':db[_0x2584fa['model']],'as':_0x2584fa['as'],'attributes':_0x2584fa['attributes'],'include':_0x2584fa[_0xe814('0x23')]?_['map'](_0x2584fa[_0xe814('0x23')],function(_0x194df1){return{'model':db[_0x194df1['model']],'as':_0x194df1['as'],'attributes':_0x194df1[_0xe814('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe814('0x11')](function(_0x311762){logger['info'](_0xe814('0x25'),_0x44b25d);logger[_0xe814('0x14')](_0xe814('0x25'),_0x44b25d,JSON[_0xe814('0x16')](_0x311762));_0x1e974d(_0x311762);})['catch'](function(_0x73aeb3){logger['error']('ShowOpenchannelQueue',_0x73aeb3['message'],_0x44b25d);_0xb8a77(_0x4f264e[_0xe814('0x17')](0x1f4,_0x73aeb3[_0xe814('0x1a')]));});});}; \ No newline at end of file +var _0xe87e=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','model','attributes','then','ShowOpenchannelQueue','find','map','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request'];(function(_0x351b10,_0x28e6f0){var _0x53e131=function(_0x55804e){while(--_0x55804e){_0x351b10['push'](_0x351b10['shift']());}};_0x53e131(++_0x28e6f0);}(_0xe87e,0xb8));var _0xee87=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xe87e[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var moment=require(_0xee87('0x2'));var BPromise=require(_0xee87('0x3'));var rs=require(_0xee87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee87('0x5'));var logger=require(_0xee87('0x6'))(_0xee87('0x7'));var config=require('../../config/environment');var jayson=require(_0xee87('0x8'));var client=jayson[_0xee87('0x9')][_0xee87('0xa')]({'port':0x232a});config[_0xee87('0xb')]=_[_0xee87('0xc')](config[_0xee87('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xee87('0xd'))(new Redis(config[_0xee87('0xb')]));require(_0xee87('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c4fb9,_0xa0f36f,_0x403bd8){return new BPromise(function(_0x46f2b2,_0x9868aa){return client[_0xee87('0xf')](_0x1c4fb9,_0x403bd8)['then'](function(_0x2bb842){logger[_0xee87('0x10')](_0xee87('0x11'),_0xa0f36f,_0xee87('0x12'));logger[_0xee87('0x13')](_0xee87('0x14'),_0xa0f36f,_0xee87('0x12'),JSON[_0xee87('0x15')](_0x2bb842));if(_0x2bb842['error']){if(_0x2bb842[_0xee87('0x16')][_0xee87('0x17')]===0x1f4){logger['error'](_0xee87('0x11'),_0xa0f36f,_0x2bb842[_0xee87('0x16')][_0xee87('0x18')]);return _0x9868aa(_0x2bb842[_0xee87('0x16')][_0xee87('0x18')]);}logger[_0xee87('0x16')](_0xee87('0x11'),_0xa0f36f,_0x2bb842[_0xee87('0x16')][_0xee87('0x18')]);return _0x46f2b2(_0x2bb842[_0xee87('0x16')]['message']);}else{logger[_0xee87('0x10')](_0xee87('0x11'),_0xa0f36f,_0xee87('0x12'));_0x46f2b2(_0x2bb842[_0xee87('0x19')][_0xee87('0x18')]);}})[_0xee87('0x1a')](function(_0x535cfd){logger['error'](_0xee87('0x11'),_0xa0f36f,_0x535cfd);_0x9868aa(_0x535cfd);});});}exports[_0xee87('0x1b')]=function(_0xcfa49b){var _0x510b2c=this;return new Promise(function(_0x3dd3d9,_0xc92b99){return db[_0xee87('0x1c')][_0xee87('0x1d')]({'raw':_0xcfa49b[_0xee87('0x1e')]?_0xcfa49b[_0xee87('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xcfa49b[_0xee87('0x1e')]?_0xcfa49b[_0xee87('0x1e')][_0xee87('0x1f')]||null:null,'attributes':_0xcfa49b[_0xee87('0x1e')]?_0xcfa49b['options']['attributes']||null:null,'limit':_0xcfa49b[_0xee87('0x1e')]?_0xcfa49b[_0xee87('0x1e')][_0xee87('0x20')]||null:null,'include':_0xcfa49b[_0xee87('0x1e')]?_0xcfa49b[_0xee87('0x1e')][_0xee87('0x21')]?_['map'](_0xcfa49b['options'][_0xee87('0x21')],function(_0x2d7c19){return{'model':db[_0x2d7c19[_0xee87('0x22')]],'as':_0x2d7c19['as'],'attributes':_0x2d7c19['attributes'],'include':_0x2d7c19[_0xee87('0x21')]?_['map'](_0x2d7c19[_0xee87('0x21')],function(_0x5a0f28){return{'model':db[_0x5a0f28[_0xee87('0x22')]],'as':_0x5a0f28['as'],'attributes':_0x5a0f28[_0xee87('0x23')],'include':_0x5a0f28[_0xee87('0x21')]?_['map'](_0x5a0f28[_0xee87('0x21')],function(_0x15ad13){return{'model':db[_0x15ad13[_0xee87('0x22')]],'as':_0x15ad13['as'],'attributes':_0x15ad13['attributes']};}):[]};}):[]};}):[]:[]})[_0xee87('0x24')](function(_0x484bc4){logger[_0xee87('0x10')](_0xee87('0x1b'),_0xcfa49b);logger[_0xee87('0x13')](_0xee87('0x1b'),_0xcfa49b,JSON['stringify'](_0x484bc4));_0x3dd3d9(_0x484bc4);})['catch'](function(_0x131ff1){logger[_0xee87('0x16')](_0xee87('0x1b'),_0x131ff1[_0xee87('0x18')],_0xcfa49b);_0xc92b99(_0x510b2c[_0xee87('0x16')](0x1f4,_0x131ff1[_0xee87('0x18')]));});});};exports[_0xee87('0x25')]=function(_0x2d4445){var _0x59d2ce=this;return new Promise(function(_0x18bbf4,_0x3ecab2){return db[_0xee87('0x1c')][_0xee87('0x26')]({'raw':_0x2d4445[_0xee87('0x1e')]?_0x2d4445[_0xee87('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2d4445[_0xee87('0x1e')]?_0x2d4445[_0xee87('0x1e')]['where']||null:null,'attributes':_0x2d4445[_0xee87('0x1e')]?_0x2d4445[_0xee87('0x1e')][_0xee87('0x23')]||null:null,'include':_0x2d4445[_0xee87('0x1e')]?_0x2d4445[_0xee87('0x1e')][_0xee87('0x21')]?_[_0xee87('0x27')](_0x2d4445[_0xee87('0x1e')][_0xee87('0x21')],function(_0x1c77a){return{'model':db[_0x1c77a[_0xee87('0x22')]],'as':_0x1c77a['as'],'attributes':_0x1c77a[_0xee87('0x23')],'include':_0x1c77a['include']?_['map'](_0x1c77a[_0xee87('0x21')],function(_0x12f1f3){return{'model':db[_0x12f1f3[_0xee87('0x22')]],'as':_0x12f1f3['as'],'attributes':_0x12f1f3[_0xee87('0x23')],'include':_0x12f1f3['include']?_[_0xee87('0x27')](_0x12f1f3[_0xee87('0x21')],function(_0x44396e){return{'model':db[_0x44396e[_0xee87('0x22')]],'as':_0x44396e['as'],'attributes':_0x44396e[_0xee87('0x23')]};}):[]};}):[]};}):[]:[]})[_0xee87('0x24')](function(_0x53d12f){logger[_0xee87('0x10')]('ShowOpenchannelQueue',_0x2d4445);logger[_0xee87('0x13')](_0xee87('0x25'),_0x2d4445,JSON[_0xee87('0x15')](_0x53d12f));_0x18bbf4(_0x53d12f);})[_0xee87('0x1a')](function(_0x4129e0){logger[_0xee87('0x16')]('ShowOpenchannelQueue',_0x4129e0[_0xee87('0x18')],_0x2d4445);_0x3ecab2(_0x59d2ce[_0xee87('0x16')](0x1f4,_0x4129e0[_0xee87('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2b99439..3bac69f 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 _0x6e91=['./openchannelQueue.events','save','remove','emit','removeListener','register','length','openchannelQueue:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6e91,0x88));var _0x16e9=function(_0x5b36fc,_0x15bc05){_0x5b36fc=_0x5b36fc-0x0;var _0x53265c=_0x6e91[_0x5b36fc];return _0x53265c;};'use strict';var OpenchannelQueueEvents=require(_0x16e9('0x0'));var events=[_0x16e9('0x1'),_0x16e9('0x2'),'update'];function createListener(_0x5e1e7b,_0x1dd452){return function(_0x5651db){_0x1dd452[_0x16e9('0x3')](_0x5e1e7b,_0x5651db);};}function removeListener(_0x2ea130,_0x4bf1b0){return function(){OpenchannelQueueEvents[_0x16e9('0x4')](_0x2ea130,_0x4bf1b0);};}exports[_0x16e9('0x5')]=function(_0x4735f8){for(var _0xa755cb=0x0,_0x1f16be=events[_0x16e9('0x6')];_0xa755cb<_0x1f16be;_0xa755cb++){var _0x1929e8=events[_0xa755cb];var _0x5273e0=createListener(_0x16e9('0x7')+_0x1929e8,_0x4735f8);OpenchannelQueueEvents['on'](_0x1929e8,_0x5273e0);}}; \ No newline at end of file +var _0x6dec=['./openchannelQueue.events','save','remove','update','removeListener','length','openchannelQueue:'];(function(_0x11f597,_0x4c7be4){var _0x529041=function(_0x14cfb0){while(--_0x14cfb0){_0x11f597['push'](_0x11f597['shift']());}};_0x529041(++_0x4c7be4);}(_0x6dec,0x1dc));var _0xc6de=function(_0xad09ce,_0x2e4293){_0xad09ce=_0xad09ce-0x0;var _0x3e6c4c=_0x6dec[_0xad09ce];return _0x3e6c4c;};'use strict';var OpenchannelQueueEvents=require(_0xc6de('0x0'));var events=[_0xc6de('0x1'),_0xc6de('0x2'),_0xc6de('0x3')];function createListener(_0x22782d,_0x233624){return function(_0x2600c0){_0x233624['emit'](_0x22782d,_0x2600c0);};}function removeListener(_0x319d37,_0x4606f5){return function(){OpenchannelQueueEvents[_0xc6de('0x4')](_0x319d37,_0x4606f5);};}exports['register']=function(_0x2af1b2){for(var _0x42aa6e=0x0,_0x1f30af=events[_0xc6de('0x5')];_0x42aa6e<_0x1f30af;_0x42aa6e++){var _0x42fafe=events[_0x42aa6e];var _0x10fb82=createListener(_0xc6de('0x6')+_0x42fafe,_0x2af1b2);OpenchannelQueueEvents['on'](_0x42fafe,_0x10fb82);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2ced7ed..b7ceed6 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 _0xe0dc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','describe','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42c66d,_0x3feb6d){var _0x4f2b5f=function(_0x401103){while(--_0x401103){_0x42c66d['push'](_0x42c66d['shift']());}};_0x4f2b5f(++_0x3feb6d);}(_0xe0dc,0x88));var _0xce0d=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0xe0dc[_0x413f2a];return _0x1932ec;};'use strict';var multer=require(_0xce0d('0x0'));var util=require(_0xce0d('0x1'));var path=require(_0xce0d('0x2'));var timeout=require(_0xce0d('0x3'));var express=require('express');var router=express[_0xce0d('0x4')]();var fs_extra=require(_0xce0d('0x5'));var auth=require(_0xce0d('0x6'));var interaction=require(_0xce0d('0x7'));var config=require('../../config/environment');var controller=require(_0xce0d('0x8'));router[_0xce0d('0x9')]('/',auth['isAuthenticated'](),controller[_0xce0d('0xa')]);router[_0xce0d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xce0d('0xb')]);router[_0xce0d('0x9')]('/:id',auth[_0xce0d('0xc')](),controller['show']);router[_0xce0d('0xd')]('/',auth[_0xce0d('0xc')](),controller['create']);router[_0xce0d('0xe')](_0xce0d('0xf'),auth[_0xce0d('0xc')](),controller[_0xce0d('0x10')]);router[_0xce0d('0x11')]('/:id',auth[_0xce0d('0xc')](),controller[_0xce0d('0x12')]);module[_0xce0d('0x13')]=router; \ No newline at end of file +var _0xecc6=['isAuthenticated','describe','show','post','create','put','/:id','update','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','get','index','/describe'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xecc6,0x106));var _0x6ecc=function(_0x47e1e6,_0x45c503){_0x47e1e6=_0x47e1e6-0x0;var _0x15ed50=_0xecc6[_0x47e1e6];return _0x15ed50;};'use strict';var multer=require('multer');var util=require(_0x6ecc('0x0'));var path=require(_0x6ecc('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ecc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6ecc('0x3'));var interaction=require(_0x6ecc('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x6ecc('0x5')]('/',auth['isAuthenticated'](),controller[_0x6ecc('0x6')]);router['get'](_0x6ecc('0x7'),auth[_0x6ecc('0x8')](),controller[_0x6ecc('0x9')]);router['get']('/:id',auth[_0x6ecc('0x8')](),controller[_0x6ecc('0xa')]);router[_0x6ecc('0xb')]('/',auth[_0x6ecc('0x8')](),controller[_0x6ecc('0xc')]);router[_0x6ecc('0xd')](_0x6ecc('0xe'),auth[_0x6ecc('0x8')](),controller[_0x6ecc('0xf')]);router[_0x6ecc('0x10')](_0x6ecc('0xe'),auth[_0x6ecc('0x8')](),controller['destroy']);module[_0x6ecc('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 44cad4c..cd03a50 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 _0x4b47=['moment','exports','STRING','DATE'];(function(_0x4d818e,_0x333e9e){var _0x1b8716=function(_0x43fe63){while(--_0x43fe63){_0x4d818e['push'](_0x4d818e['shift']());}};_0x1b8716(++_0x333e9e);}(_0x4b47,0x1b4));var _0x74b4=function(_0xcb53a4,_0x2c7578){_0xcb53a4=_0xcb53a4-0x0;var _0x1d5112=_0x4b47[_0xcb53a4];return _0x1d5112;};'use strict';var moment=require(_0x74b4('0x0'));var Sequelize=require('sequelize');module[_0x74b4('0x1')]={'uniqueid':{'type':Sequelize[_0x74b4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x74b4('0x2')]},'joinAt':{'type':Sequelize[_0x74b4('0x3')]},'leaveAt':{'type':Sequelize[_0x74b4('0x3')]},'acceptAt':{'type':Sequelize[_0x74b4('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8e13=['moment','sequelize','STRING','DATE'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x8e13,0x1ac));var _0x38e1=function(_0x335431,_0x26da18){_0x335431=_0x335431-0x0;var _0xe0b9c7=_0x8e13[_0x335431];return _0xe0b9c7;};'use strict';var moment=require(_0x38e1('0x0'));var Sequelize=require(_0x38e1('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x38e1('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x38e1('0x3')]},'leaveAt':{'type':Sequelize[_0x38e1('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x38e1('0x3')]},'reason':{'type':Sequelize[_0x38e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 854c8eb..a95819f 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 _0x4242=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','map','merge','options','includeAll','include','findAll','rows','catch','keys','OpenchannelQueueReport','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply'];(function(_0x107f5a,_0x43aa79){var _0x4452fc=function(_0x12f4dd){while(--_0x12f4dd){_0x107f5a['push'](_0x107f5a['shift']());}};_0x4452fc(++_0x43aa79);}(_0x4242,0x1c4));var _0x2424=function(_0xd0d83d,_0x58eaa7){_0xd0d83d=_0xd0d83d-0x0;var _0x776533=_0x4242[_0xd0d83d];return _0x776533;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2424('0x0'));var zipdir=require(_0x2424('0x1'));var jsonpatch=require(_0x2424('0x2'));var rp=require(_0x2424('0x3'));var moment=require(_0x2424('0x4'));var BPromise=require(_0x2424('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2424('0x6'));var csv=require(_0x2424('0x7'));var ejs=require(_0x2424('0x8'));var fs=require('fs');var fs_extra=require(_0x2424('0x9'));var _=require(_0x2424('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2424('0xb'));var toCsv=require(_0x2424('0x7'));var querystring=require(_0x2424('0xc'));var Papa=require(_0x2424('0xd'));var Redis=require(_0x2424('0xe'));var authService=require(_0x2424('0xf'));var qs=require(_0x2424('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2424('0x11'));var logger=require(_0x2424('0x12'))('api');var utils=require(_0x2424('0x13'));var config=require(_0x2424('0x14'));var licenseUtil=require(_0x2424('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aa97b,_0x6b2166){_0x6b2166=_0x6b2166||0xcc;return function(_0x306959){if(_0x306959){return _0x2aa97b['sendStatus'](_0x6b2166);}return _0x2aa97b[_0x2424('0x16')](_0x6b2166)[_0x2424('0x17')]();};}function respondWithResult(_0x311958,_0x45206f){_0x45206f=_0x45206f||0xc8;return function(_0x541cfc){if(_0x541cfc){return _0x311958[_0x2424('0x16')](_0x45206f)[_0x2424('0x18')](_0x541cfc);}};}function respondWithFilteredResult(_0x3ebf20,_0x219b63){return function(_0x417948){if(_0x417948){var _0x5b83d8=typeof _0x219b63[_0x2424('0x19')]===_0x2424('0x1a')&&typeof _0x219b63['limit']==='undefined';var _0xc70025=_0x417948[_0x2424('0x1b')];var _0x5f1ed0=_0x5b83d8?0x0:_0x219b63[_0x2424('0x19')];var _0x2e8aa2=_0x5b83d8?_0x417948[_0x2424('0x1b')]:_0x219b63[_0x2424('0x19')]+_0x219b63[_0x2424('0x1c')];var _0xffd55a;if(_0x2e8aa2>=_0xc70025){_0x2e8aa2=_0xc70025;_0xffd55a=0xc8;}else{_0xffd55a=0xce;}_0x3ebf20[_0x2424('0x16')](_0xffd55a);return _0x3ebf20[_0x2424('0x1d')]('Content-Range',_0x5f1ed0+'-'+_0x2e8aa2+'/'+_0xc70025)[_0x2424('0x18')](_0x417948);}return null;};}function patchUpdates(_0x4cb752){return function(_0x4c95d5){try{jsonpatch[_0x2424('0x1e')](_0x4c95d5,_0x4cb752,!![]);}catch(_0x1eb493){return BPromise[_0x2424('0x1f')](_0x1eb493);}return _0x4c95d5[_0x2424('0x20')]();};}function saveUpdates(_0x25be6d,_0x48ff34){return function(_0x1c1821){if(_0x1c1821){return _0x1c1821[_0x2424('0x21')](_0x25be6d)[_0x2424('0x22')](function(_0x39411a){return _0x39411a;});}return null;};}function removeEntity(_0x143e18,_0x3b635c){return function(_0x2f5439){if(_0x2f5439){return _0x2f5439[_0x2424('0x23')]()[_0x2424('0x22')](function(){_0x143e18['status'](0xcc)[_0x2424('0x17')]();});}};}function handleEntityNotFound(_0x2a78e6,_0x540436){return function(_0x17d968){if(!_0x17d968){_0x2a78e6[_0x2424('0x24')](0x194);}return _0x17d968;};}function handleError(_0x364452,_0x1f683b){_0x1f683b=_0x1f683b||0x1f4;return function(_0x1d0554){logger[_0x2424('0x25')](_0x1d0554[_0x2424('0x26')]);if(_0x1d0554[_0x2424('0x27')]){delete _0x1d0554['name'];}_0x364452[_0x2424('0x16')](_0x1f683b)[_0x2424('0x28')](_0x1d0554);};}exports['index']=function(_0x5549b5,_0x244539){var _0x4fd17e={},_0x1cd99e={},_0x585bbc={'count':0x0,'rows':[]};var _0x5340c6=_['map'](db['OpenchannelQueueReport'][_0x2424('0x29')],function(_0x21eae3){return{'name':_0x21eae3[_0x2424('0x2a')],'type':_0x21eae3[_0x2424('0x2b')]['key']};});_0x1cd99e[_0x2424('0x2c')]=_['map'](_0x5340c6,_0x2424('0x27'));_0x1cd99e['query']=_['keys'](_0x5549b5[_0x2424('0x2d')]);_0x1cd99e['filters']=_[_0x2424('0x2e')](_0x1cd99e[_0x2424('0x2c')],_0x1cd99e[_0x2424('0x2d')]);_0x4fd17e['attributes']=_['intersection'](_0x1cd99e[_0x2424('0x2c')],qs[_0x2424('0x2f')](_0x5549b5['query']['fields']));_0x4fd17e[_0x2424('0x30')]=_0x4fd17e['attributes'][_0x2424('0x31')]?_0x4fd17e[_0x2424('0x30')]:_0x1cd99e[_0x2424('0x2c')];if(!_0x5549b5['query']['hasOwnProperty']('nolimit')){_0x4fd17e[_0x2424('0x1c')]=qs[_0x2424('0x1c')](_0x5549b5[_0x2424('0x2d')][_0x2424('0x1c')]);_0x4fd17e['offset']=qs[_0x2424('0x19')](_0x5549b5['query']['offset']);}_0x4fd17e[_0x2424('0x32')]=qs[_0x2424('0x33')](_0x5549b5[_0x2424('0x2d')][_0x2424('0x33')]);_0x4fd17e[_0x2424('0x34')]=qs[_0x2424('0x35')](_[_0x2424('0x36')](_0x5549b5[_0x2424('0x2d')],_0x1cd99e[_0x2424('0x35')]),_0x5340c6);if(_0x5549b5[_0x2424('0x2d')]['filter']){_0x4fd17e['where']=_['merge'](_0x4fd17e[_0x2424('0x34')],{'$or':_[_0x2424('0x37')](_0x5340c6,function(_0x39e927){if(_0x39e927[_0x2424('0x2b')]!=='VIRTUAL'){var _0xbbcad3={};_0xbbcad3[_0x39e927['name']]={'$like':'%'+_0x5549b5[_0x2424('0x2d')]['filter']+'%'};return _0xbbcad3;}})});}_0x4fd17e=_[_0x2424('0x38')]({},_0x4fd17e,_0x5549b5[_0x2424('0x39')]);var _0x582cbb={'where':_0x4fd17e['where']};return db['OpenchannelQueueReport']['count'](_0x582cbb)[_0x2424('0x22')](function(_0xfedd1f){_0x585bbc['count']=_0xfedd1f;if(_0x5549b5['query'][_0x2424('0x3a')]){_0x4fd17e[_0x2424('0x3b')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x2424('0x3c')](_0x4fd17e);})['then'](function(_0x956d3){_0x585bbc[_0x2424('0x3d')]=_0x956d3;return _0x585bbc;})[_0x2424('0x22')](respondWithFilteredResult(_0x244539,_0x4fd17e))[_0x2424('0x3e')](handleError(_0x244539,null));};exports['show']=function(_0x4973c9,_0x3a856b){var _0x375976={'raw':!![],'where':{'id':_0x4973c9['params']['id']}},_0x55a203={};_0x55a203[_0x2424('0x2c')]=_[_0x2424('0x3f')](db[_0x2424('0x40')][_0x2424('0x29')]);_0x55a203[_0x2424('0x2d')]=_[_0x2424('0x3f')](_0x4973c9[_0x2424('0x2d')]);_0x55a203[_0x2424('0x35')]=_['intersection'](_0x55a203['model'],_0x55a203[_0x2424('0x2d')]);_0x375976[_0x2424('0x30')]=_[_0x2424('0x2e')](_0x55a203[_0x2424('0x2c')],qs[_0x2424('0x2f')](_0x4973c9[_0x2424('0x2d')][_0x2424('0x2f')]));_0x375976[_0x2424('0x30')]=_0x375976[_0x2424('0x30')][_0x2424('0x31')]?_0x375976[_0x2424('0x30')]:_0x55a203[_0x2424('0x2c')];if(_0x4973c9['query'][_0x2424('0x3a')]){_0x375976['include']=[{'all':!![]}];}_0x375976=_[_0x2424('0x38')]({},_0x375976,_0x4973c9['options']);return db['OpenchannelQueueReport']['find'](_0x375976)[_0x2424('0x22')](handleEntityNotFound(_0x3a856b,null))[_0x2424('0x22')](respondWithResult(_0x3a856b,null))[_0x2424('0x3e')](handleError(_0x3a856b,null));};exports['create']=function(_0x4c165e,_0x1e4ced){return db[_0x2424('0x40')]['create'](_0x4c165e[_0x2424('0x41')],{})[_0x2424('0x22')](respondWithResult(_0x1e4ced,0xc9))['catch'](handleError(_0x1e4ced,null));};exports[_0x2424('0x21')]=function(_0x3b89a6,_0x1614b7){if(_0x3b89a6[_0x2424('0x41')]['id']){delete _0x3b89a6[_0x2424('0x41')]['id'];}return db[_0x2424('0x40')][_0x2424('0x42')]({'where':{'id':_0x3b89a6[_0x2424('0x43')]['id']}})[_0x2424('0x22')](handleEntityNotFound(_0x1614b7,null))[_0x2424('0x22')](saveUpdates(_0x3b89a6[_0x2424('0x41')],null))[_0x2424('0x22')](respondWithResult(_0x1614b7,null))[_0x2424('0x3e')](handleError(_0x1614b7,null));};exports[_0x2424('0x23')]=function(_0x4b42a4,_0x449621){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x4b42a4['params']['id']}})[_0x2424('0x22')](handleEntityNotFound(_0x449621,null))[_0x2424('0x22')](removeEntity(_0x449621,null))[_0x2424('0x3e')](handleError(_0x449621,null));};exports[_0x2424('0x44')]=function(_0x4e1694,_0x5bce37){return db['OpenchannelQueueReport']['describe']()[_0x2424('0x22')](respondWithResult(_0x5bce37,null))[_0x2424('0x3e')](handleError(_0x5bce37,null));}; \ No newline at end of file +var _0xa521=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1d0184,_0x3fa782){var _0x364129=function(_0x14475f){while(--_0x14475f){_0x1d0184['push'](_0x1d0184['shift']());}};_0x364129(++_0x3fa782);}(_0xa521,0x1c0));var _0x1a52=function(_0x3f377b,_0x197ac1){_0x3f377b=_0x3f377b-0x0;var _0x394626=_0xa521[_0x3f377b];return _0x394626;};'use strict';var emlformat=require(_0x1a52('0x0'));var rimraf=require(_0x1a52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a52('0x2'));var moment=require(_0x1a52('0x3'));var BPromise=require(_0x1a52('0x4'));var Mustache=require('mustache');var util=require(_0x1a52('0x5'));var path=require('path');var sox=require(_0x1a52('0x6'));var csv=require(_0x1a52('0x7'));var ejs=require(_0x1a52('0x8'));var fs=require('fs');var fs_extra=require(_0x1a52('0x9'));var _=require(_0x1a52('0xa'));var squel=require(_0x1a52('0xb'));var crypto=require(_0x1a52('0xc'));var jsforce=require(_0x1a52('0xd'));var deskjs=require(_0x1a52('0xe'));var toCsv=require(_0x1a52('0x7'));var querystring=require(_0x1a52('0xf'));var Papa=require(_0x1a52('0x10'));var Redis=require(_0x1a52('0x11'));var authService=require(_0x1a52('0x12'));var qs=require(_0x1a52('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a52('0x14'));var logger=require(_0x1a52('0x15'))(_0x1a52('0x16'));var utils=require(_0x1a52('0x17'));var config=require(_0x1a52('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a52('0x19'))['db'];function respondWithStatusCode(_0x543aed,_0x214408){_0x214408=_0x214408||0xcc;return function(_0x34b9dc){if(_0x34b9dc){return _0x543aed[_0x1a52('0x1a')](_0x214408);}return _0x543aed[_0x1a52('0x1b')](_0x214408)[_0x1a52('0x1c')]();};}function respondWithResult(_0x5c01bb,_0x3cccec){_0x3cccec=_0x3cccec||0xc8;return function(_0x31d999){if(_0x31d999){return _0x5c01bb[_0x1a52('0x1b')](_0x3cccec)['json'](_0x31d999);}};}function respondWithFilteredResult(_0x238b9f,_0x74b35){return function(_0x273506){if(_0x273506){var _0x5b7283=typeof _0x74b35[_0x1a52('0x1d')]===_0x1a52('0x1e')&&typeof _0x74b35[_0x1a52('0x1f')]===_0x1a52('0x1e');var _0xe22ca1=_0x273506[_0x1a52('0x20')];var _0x3aa539=_0x5b7283?0x0:_0x74b35[_0x1a52('0x1d')];var _0x3f4d9e=_0x5b7283?_0x273506['count']:_0x74b35['offset']+_0x74b35[_0x1a52('0x1f')];var _0x5904b3;if(_0x3f4d9e>=_0xe22ca1){_0x3f4d9e=_0xe22ca1;_0x5904b3=0xc8;}else{_0x5904b3=0xce;}_0x238b9f[_0x1a52('0x1b')](_0x5904b3);return _0x238b9f[_0x1a52('0x21')]('Content-Range',_0x3aa539+'-'+_0x3f4d9e+'/'+_0xe22ca1)[_0x1a52('0x22')](_0x273506);}return null;};}function patchUpdates(_0x381c66){return function(_0xaf42a6){try{jsonpatch[_0x1a52('0x23')](_0xaf42a6,_0x381c66,!![]);}catch(_0x31276c){return BPromise[_0x1a52('0x24')](_0x31276c);}return _0xaf42a6[_0x1a52('0x25')]();};}function saveUpdates(_0x4b5f2c,_0x3f3a4c){return function(_0x421601){if(_0x421601){return _0x421601[_0x1a52('0x26')](_0x4b5f2c)[_0x1a52('0x27')](function(_0x2850c0){return _0x2850c0;});}return null;};}function removeEntity(_0x4e2cfc,_0x1e268f){return function(_0x1998b4){if(_0x1998b4){return _0x1998b4['destroy']()[_0x1a52('0x27')](function(){_0x4e2cfc[_0x1a52('0x1b')](0xcc)[_0x1a52('0x1c')]();});}};}function handleEntityNotFound(_0x418f57,_0x923d01){return function(_0x537b84){if(!_0x537b84){_0x418f57[_0x1a52('0x1a')](0x194);}return _0x537b84;};}function handleError(_0x2322b2,_0x427951){_0x427951=_0x427951||0x1f4;return function(_0x478dec){logger[_0x1a52('0x28')](_0x478dec['stack']);if(_0x478dec[_0x1a52('0x29')]){delete _0x478dec[_0x1a52('0x29')];}_0x2322b2[_0x1a52('0x1b')](_0x427951)['send'](_0x478dec);};}exports[_0x1a52('0x2a')]=function(_0x3b1f,_0x25edb4){var _0x4b0c45={},_0x25d260={},_0x2618b0={'count':0x0,'rows':[]};var _0x192802=_[_0x1a52('0x2b')](db[_0x1a52('0x2c')][_0x1a52('0x2d')],function(_0x27e8a2){return{'name':_0x27e8a2[_0x1a52('0x2e')],'type':_0x27e8a2[_0x1a52('0x2f')][_0x1a52('0x30')]};});_0x25d260[_0x1a52('0x31')]=_[_0x1a52('0x2b')](_0x192802,_0x1a52('0x29'));_0x25d260['query']=_['keys'](_0x3b1f[_0x1a52('0x32')]);_0x25d260[_0x1a52('0x33')]=_[_0x1a52('0x34')](_0x25d260[_0x1a52('0x31')],_0x25d260[_0x1a52('0x32')]);_0x4b0c45[_0x1a52('0x35')]=_['intersection'](_0x25d260[_0x1a52('0x31')],qs[_0x1a52('0x36')](_0x3b1f[_0x1a52('0x32')][_0x1a52('0x36')]));_0x4b0c45[_0x1a52('0x35')]=_0x4b0c45['attributes'][_0x1a52('0x37')]?_0x4b0c45[_0x1a52('0x35')]:_0x25d260[_0x1a52('0x31')];if(!_0x3b1f[_0x1a52('0x32')][_0x1a52('0x38')](_0x1a52('0x39'))){_0x4b0c45[_0x1a52('0x1f')]=qs[_0x1a52('0x1f')](_0x3b1f[_0x1a52('0x32')][_0x1a52('0x1f')]);_0x4b0c45[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x3b1f[_0x1a52('0x32')][_0x1a52('0x1d')]);}_0x4b0c45[_0x1a52('0x3a')]=qs['sort'](_0x3b1f['query'][_0x1a52('0x3b')]);_0x4b0c45[_0x1a52('0x3c')]=qs[_0x1a52('0x33')](_[_0x1a52('0x3d')](_0x3b1f[_0x1a52('0x32')],_0x25d260[_0x1a52('0x33')]),_0x192802);if(_0x3b1f[_0x1a52('0x32')][_0x1a52('0x3e')]){_0x4b0c45['where']=_[_0x1a52('0x3f')](_0x4b0c45[_0x1a52('0x3c')],{'$or':_[_0x1a52('0x2b')](_0x192802,function(_0x3aa062){if(_0x3aa062['type']!==_0x1a52('0x40')){var _0x59e8b0={};_0x59e8b0[_0x3aa062[_0x1a52('0x29')]]={'$like':'%'+_0x3b1f[_0x1a52('0x32')][_0x1a52('0x3e')]+'%'};return _0x59e8b0;}})});}_0x4b0c45=_['merge']({},_0x4b0c45,_0x3b1f[_0x1a52('0x41')]);var _0x2d81ec={'where':_0x4b0c45[_0x1a52('0x3c')]};return db[_0x1a52('0x2c')][_0x1a52('0x20')](_0x2d81ec)[_0x1a52('0x27')](function(_0x35a936){_0x2618b0[_0x1a52('0x20')]=_0x35a936;if(_0x3b1f[_0x1a52('0x32')][_0x1a52('0x42')]){_0x4b0c45[_0x1a52('0x43')]=[{'all':!![]}];}return db[_0x1a52('0x2c')][_0x1a52('0x44')](_0x4b0c45);})[_0x1a52('0x27')](function(_0x94484c){_0x2618b0[_0x1a52('0x45')]=_0x94484c;return _0x2618b0;})[_0x1a52('0x27')](respondWithFilteredResult(_0x25edb4,_0x4b0c45))[_0x1a52('0x46')](handleError(_0x25edb4,null));};exports['show']=function(_0x3c45cb,_0x206dc4){var _0x3f314f={'raw':!![],'where':{'id':_0x3c45cb[_0x1a52('0x47')]['id']}},_0x2f15f7={};_0x2f15f7['model']=_['keys'](db['OpenchannelQueueReport'][_0x1a52('0x2d')]);_0x2f15f7['query']=_[_0x1a52('0x48')](_0x3c45cb[_0x1a52('0x32')]);_0x2f15f7[_0x1a52('0x33')]=_[_0x1a52('0x34')](_0x2f15f7[_0x1a52('0x31')],_0x2f15f7[_0x1a52('0x32')]);_0x3f314f[_0x1a52('0x35')]=_[_0x1a52('0x34')](_0x2f15f7[_0x1a52('0x31')],qs[_0x1a52('0x36')](_0x3c45cb[_0x1a52('0x32')][_0x1a52('0x36')]));_0x3f314f[_0x1a52('0x35')]=_0x3f314f[_0x1a52('0x35')][_0x1a52('0x37')]?_0x3f314f['attributes']:_0x2f15f7[_0x1a52('0x31')];if(_0x3c45cb[_0x1a52('0x32')]['includeAll']){_0x3f314f[_0x1a52('0x43')]=[{'all':!![]}];}_0x3f314f=_[_0x1a52('0x3f')]({},_0x3f314f,_0x3c45cb[_0x1a52('0x41')]);return db[_0x1a52('0x2c')]['find'](_0x3f314f)[_0x1a52('0x27')](handleEntityNotFound(_0x206dc4,null))[_0x1a52('0x27')](respondWithResult(_0x206dc4,null))[_0x1a52('0x46')](handleError(_0x206dc4,null));};exports['create']=function(_0x22efed,_0x3ef074){return db[_0x1a52('0x2c')][_0x1a52('0x49')](_0x22efed[_0x1a52('0x4a')],{})[_0x1a52('0x27')](respondWithResult(_0x3ef074,0xc9))[_0x1a52('0x46')](handleError(_0x3ef074,null));};exports['update']=function(_0x438ca8,_0x5e4d15){if(_0x438ca8['body']['id']){delete _0x438ca8[_0x1a52('0x4a')]['id'];}return db[_0x1a52('0x2c')][_0x1a52('0x4b')]({'where':{'id':_0x438ca8[_0x1a52('0x47')]['id']}})[_0x1a52('0x27')](handleEntityNotFound(_0x5e4d15,null))[_0x1a52('0x27')](saveUpdates(_0x438ca8[_0x1a52('0x4a')],null))[_0x1a52('0x27')](respondWithResult(_0x5e4d15,null))[_0x1a52('0x46')](handleError(_0x5e4d15,null));};exports['destroy']=function(_0x30466d,_0x49297f){return db[_0x1a52('0x2c')][_0x1a52('0x4b')]({'where':{'id':_0x30466d[_0x1a52('0x47')]['id']}})['then'](handleEntityNotFound(_0x49297f,null))[_0x1a52('0x27')](removeEntity(_0x49297f,null))['catch'](handleError(_0x49297f,null));};exports[_0x1a52('0x4c')]=function(_0xcb8b0d,_0x1363a0){return db[_0x1a52('0x2c')][_0x1a52('0x4c')]()['then'](respondWithResult(_0x1363a0,null))[_0x1a52('0x46')](handleError(_0x1363a0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 0889b73..f20a247 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2ef2a0,_0x30088b){var _0x405f56=function(_0x2e6b3d){while(--_0x2e6b3d){_0x2ef2a0['push'](_0x2ef2a0['shift']());}};_0x405f56(++_0x30088b);}(_0x7a54,0x106));var _0x47a5=function(_0xcd362,_0x1b50cb){_0xcd362=_0xcd362-0x0;var _0x33c9ee=_0x7a54[_0xcd362];return _0x33c9ee;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x490abd,_0x110975){var _0x368f37=function(_0xfd34af){while(--_0xfd34af){_0x490abd['push'](_0x490abd['shift']());}};_0x368f37(++_0x110975);}(_0x326f,0xd1));var _0xf326=function(_0x1ee27a,_0x1cac44){_0x1ee27a=_0x1ee27a-0x0;var _0x489b4c=_0x326f[_0x1ee27a];return _0x489b4c;};'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':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ec4f4d4..ee2b72e 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 _0x49db=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','lodash'];(function(_0x3e9470,_0x3f71e0){var _0x350559=function(_0x25f9f4){while(--_0x25f9f4){_0x3e9470['push'](_0x3e9470['shift']());}};_0x350559(++_0x3f71e0);}(_0x49db,0xc5));var _0xb49d=function(_0x5dac80,_0x34a0dd){_0x5dac80=_0x5dac80-0x0;var _0xbfb463=_0x49db[_0x5dac80];return _0xbfb463;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var moment=require(_0xb49d('0x2'));var BPromise=require(_0xb49d('0x3'));var rs=require(_0xb49d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb49d('0x5'))['db'];var utils=require(_0xb49d('0x6'));var logger=require(_0xb49d('0x7'))('rpc');var config=require(_0xb49d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb49d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4180c8,_0x15f52f,_0x572ee4){return new BPromise(function(_0x12e114,_0x128caa){return client[_0xb49d('0xa')](_0x4180c8,_0x572ee4)[_0xb49d('0xb')](function(_0x3d4825){logger[_0xb49d('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x15f52f,'request\x20sent');logger[_0xb49d('0xd')](_0xb49d('0xe'),_0x15f52f,_0xb49d('0xf'),JSON[_0xb49d('0x10')](_0x3d4825));if(_0x3d4825[_0xb49d('0x11')]){if(_0x3d4825[_0xb49d('0x11')][_0xb49d('0x12')]===0x1f4){logger[_0xb49d('0x11')](_0xb49d('0x13'),_0x15f52f,_0x3d4825['error'][_0xb49d('0x14')]);return _0x128caa(_0x3d4825[_0xb49d('0x11')][_0xb49d('0x14')]);}logger[_0xb49d('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x15f52f,_0x3d4825[_0xb49d('0x11')][_0xb49d('0x14')]);return _0x12e114(_0x3d4825['error'][_0xb49d('0x14')]);}else{logger[_0xb49d('0xc')](_0xb49d('0x13'),_0x15f52f,_0xb49d('0xf'));_0x12e114(_0x3d4825[_0xb49d('0x15')][_0xb49d('0x14')]);}})[_0xb49d('0x16')](function(_0x584ade){logger[_0xb49d('0x11')](_0xb49d('0x13'),_0x15f52f,_0x584ade);_0x128caa(_0x584ade);});});}exports[_0xb49d('0x17')]=function(_0xf0bdff){var _0x4abce4=this;return new Promise(function(_0x4f3988,_0xfd7a95){return db[_0xb49d('0x18')][_0xb49d('0x19')](_0xf0bdff[_0xb49d('0x1a')],{'raw':_0xf0bdff[_0xb49d('0x1b')]?_0xf0bdff['options'][_0xb49d('0x1c')]===undefined?!![]:![]:!![]})[_0xb49d('0xb')](function(_0x3bf7a2){logger[_0xb49d('0xc')](_0xb49d('0x17'),_0xf0bdff);logger[_0xb49d('0xd')](_0xb49d('0x17'),_0xf0bdff,JSON[_0xb49d('0x10')](_0x3bf7a2));_0x4f3988(_0x3bf7a2);})[_0xb49d('0x16')](function(_0x38be04){logger[_0xb49d('0x11')](_0xb49d('0x17'),_0x38be04[_0xb49d('0x14')],_0xf0bdff);_0xfd7a95(_0x4abce4[_0xb49d('0x11')](0x1f4,_0x38be04[_0xb49d('0x14')]));});});};exports[_0xb49d('0x1d')]=function(_0x26db55){var _0x21c0e1=this;return new Promise(function(_0x165ec2,_0x1ae086){return db[_0xb49d('0x18')][_0xb49d('0x1e')](_0x26db55['body'],{'raw':_0x26db55[_0xb49d('0x1b')]?_0x26db55['options'][_0xb49d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26db55[_0xb49d('0x1b')]?_0x26db55['options'][_0xb49d('0x1f')]||null:null,'attributes':_0x26db55[_0xb49d('0x1b')]?_0x26db55[_0xb49d('0x1b')][_0xb49d('0x20')]||null:null,'limit':_0x26db55[_0xb49d('0x1b')]?_0x26db55[_0xb49d('0x1b')]['limit']||null:null})[_0xb49d('0xb')](function(_0xf734e1){logger[_0xb49d('0xc')](_0xb49d('0x1d'),_0x26db55);logger[_0xb49d('0xd')](_0xb49d('0x1d'),_0x26db55,JSON[_0xb49d('0x10')](_0xf734e1));_0x165ec2(_0xf734e1);})['catch'](function(_0x3f1796){logger['error'](_0xb49d('0x1d'),_0x3f1796[_0xb49d('0x14')],_0x26db55);_0x1ae086(_0x21c0e1[_0xb49d('0x11')](0x1f4,_0x3f1796[_0xb49d('0x14')]));});});}; \ No newline at end of file +var _0xe493=['where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','create','options','raw','OpenchannelQueueReport','update','body'];(function(_0x3b1a4e,_0x2b3800){var _0x250a21=function(_0x4c94b6){while(--_0x4c94b6){_0x3b1a4e['push'](_0x3b1a4e['shift']());}};_0x250a21(++_0x2b3800);}(_0xe493,0x7e));var _0x3e49=function(_0x4cb843,_0x556f2d){_0x4cb843=_0x4cb843-0x0;var _0x3a42d8=_0xe493[_0x4cb843];return _0x3a42d8;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});}exports[_0x3e49('0x16')]=function(_0x3ae5f4){var _0x448c36=this;return new Promise(function(_0x4e1cdf,_0xf33205){return db['OpenchannelQueueReport'][_0x3e49('0x17')](_0x3ae5f4['body'],{'raw':_0x3ae5f4[_0x3e49('0x18')]?_0x3ae5f4['options'][_0x3e49('0x19')]===undefined?!![]:![]:!![]})[_0x3e49('0xb')](function(_0x420d7b){logger['info'](_0x3e49('0x16'),_0x3ae5f4);logger['debug'](_0x3e49('0x16'),_0x3ae5f4,JSON[_0x3e49('0x11')](_0x420d7b));_0x4e1cdf(_0x420d7b);})[_0x3e49('0x15')](function(_0x5e0f1d){logger['error'](_0x3e49('0x16'),_0x5e0f1d['message'],_0x3ae5f4);_0xf33205(_0x448c36[_0x3e49('0x12')](0x1f4,_0x5e0f1d[_0x3e49('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5b85df){var _0xdfb7b7=this;return new Promise(function(_0x57706b,_0x285237){return db[_0x3e49('0x1a')][_0x3e49('0x1b')](_0x5b85df[_0x3e49('0x1c')],{'raw':_0x5b85df['options']?_0x5b85df[_0x3e49('0x18')][_0x3e49('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b85df[_0x3e49('0x18')]?_0x5b85df[_0x3e49('0x18')][_0x3e49('0x1d')]||null:null,'attributes':_0x5b85df[_0x3e49('0x18')]?_0x5b85df[_0x3e49('0x18')][_0x3e49('0x1e')]||null:null,'limit':_0x5b85df[_0x3e49('0x18')]?_0x5b85df['options']['limit']||null:null})['then'](function(_0x1d6680){logger[_0x3e49('0xc')]('UpdateOpenchannelQueueReport',_0x5b85df);logger[_0x3e49('0xf')]('UpdateOpenchannelQueueReport',_0x5b85df,JSON[_0x3e49('0x11')](_0x1d6680));_0x57706b(_0x1d6680);})[_0x3e49('0x15')](function(_0x1f635a){logger[_0x3e49('0x12')]('UpdateOpenchannelQueueReport',_0x1f635a[_0x3e49('0x13')],_0x5b85df);_0x285237(_0xdfb7b7['error'](0x1f4,_0x1f635a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 925a958..dc5c3d6 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 _0xb3b3=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','describe','show','post','create'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xb3b3,0xc6));var _0x3b3b=function(_0x10b0fd,_0xb83c17){_0x10b0fd=_0x10b0fd-0x0;var _0x366871=_0xb3b3[_0x10b0fd];return _0x366871;};'use strict';var multer=require(_0x3b3b('0x0'));var util=require(_0x3b3b('0x1'));var path=require(_0x3b3b('0x2'));var timeout=require(_0x3b3b('0x3'));var express=require(_0x3b3b('0x4'));var router=express[_0x3b3b('0x5')]();var fs_extra=require(_0x3b3b('0x6'));var auth=require(_0x3b3b('0x7'));var interaction=require(_0x3b3b('0x8'));var config=require(_0x3b3b('0x9'));var controller=require(_0x3b3b('0xa'));router['get']('/',auth[_0x3b3b('0xb')](),controller['index']);router[_0x3b3b('0xc')](_0x3b3b('0xd'),auth[_0x3b3b('0xb')](),controller[_0x3b3b('0xe')]);router[_0x3b3b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x3b3b('0xf')]);router[_0x3b3b('0x10')]('/',auth[_0x3b3b('0xb')](),controller[_0x3b3b('0x11')]);router[_0x3b3b('0x12')]('/:id',auth[_0x3b3b('0xb')](),controller[_0x3b3b('0x13')]);router[_0x3b3b('0x14')](_0x3b3b('0x15'),auth[_0x3b3b('0xb')](),controller[_0x3b3b('0x16')]);module[_0x3b3b('0x17')]=router; \ No newline at end of file +var _0xa9bd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x3f0962,_0x4074a0){var _0x476c15=function(_0x171187){while(--_0x171187){_0x3f0962['push'](_0x3f0962['shift']());}};_0x476c15(++_0x4074a0);}(_0xa9bd,0xfa));var _0xda9b=function(_0x49cc23,_0x3812e2){_0x49cc23=_0x49cc23-0x0;var _0x57fbca=_0xa9bd[_0x49cc23];return _0x57fbca;};'use strict';var multer=require(_0xda9b('0x0'));var util=require(_0xda9b('0x1'));var path=require(_0xda9b('0x2'));var timeout=require(_0xda9b('0x3'));var express=require(_0xda9b('0x4'));var router=express[_0xda9b('0x5')]();var fs_extra=require(_0xda9b('0x6'));var auth=require(_0xda9b('0x7'));var interaction=require(_0xda9b('0x8'));var config=require(_0xda9b('0x9'));var controller=require(_0xda9b('0xa'));router['get']('/',auth[_0xda9b('0xb')](),controller[_0xda9b('0xc')]);router[_0xda9b('0xd')]('/describe',auth[_0xda9b('0xb')](),controller['describe']);router[_0xda9b('0xd')](_0xda9b('0xe'),auth[_0xda9b('0xb')](),controller[_0xda9b('0xf')]);router['post']('/',auth[_0xda9b('0xb')](),controller[_0xda9b('0x10')]);router['put'](_0xda9b('0xe'),auth[_0xda9b('0xb')](),controller[_0xda9b('0x11')]);router[_0xda9b('0x12')]('/:id',auth[_0xda9b('0xb')](),controller[_0xda9b('0x13')]);module[_0xda9b('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c9f18cc..8b217d3 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3320c3,_0x2a84bf){var _0x3fb7f3=function(_0x132a51){while(--_0x132a51){_0x3320c3['push'](_0x3320c3['shift']());}};_0x3fb7f3(++_0x2a84bf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c262221..e94d5fd 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 _0x0bde=['end','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','OpenchannelTransferReport','include','findAll','rows','catch','params','length','includeAll','merge','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x155341,_0x4c9b9e){var _0x297a60=function(_0x5f4c09){while(--_0x5f4c09){_0x155341['push'](_0x155341['shift']());}};_0x297a60(++_0x4c9b9e);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0bd('0x1'));var jsonpatch=require(_0xe0bd('0x2'));var rp=require('request-promise');var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require(_0xe0bd('0xd'));var jsforce=require(_0xe0bd('0xe'));var deskjs=require(_0xe0bd('0xf'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0x10'));var Papa=require(_0xe0bd('0x11'));var Redis=require('ioredis');var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x14'));var logger=require('../../config/logger')(_0xe0bd('0x15'));var utils=require(_0xe0bd('0x16'));var config=require(_0xe0bd('0x17'));var licenseUtil=require(_0xe0bd('0x18'));var db=require(_0xe0bd('0x19'))['db'];function respondWithStatusCode(_0x16c3a9,_0x1905b2){_0x1905b2=_0x1905b2||0xcc;return function(_0x500a9e){if(_0x500a9e){return _0x16c3a9[_0xe0bd('0x1a')](_0x1905b2);}return _0x16c3a9[_0xe0bd('0x1b')](_0x1905b2)[_0xe0bd('0x1c')]();};}function respondWithResult(_0x5c76f1,_0x479438){_0x479438=_0x479438||0xc8;return function(_0x48afde){if(_0x48afde){return _0x5c76f1[_0xe0bd('0x1b')](_0x479438)[_0xe0bd('0x1d')](_0x48afde);}};}function respondWithFilteredResult(_0x3f5ef7,_0x3042e1){return function(_0x361429){if(_0x361429){var _0x302f5f=typeof _0x3042e1[_0xe0bd('0x1e')]===_0xe0bd('0x1f')&&typeof _0x3042e1['limit']==='undefined';var _0x2d2ba3=_0x361429[_0xe0bd('0x20')];var _0x1c4533=_0x302f5f?0x0:_0x3042e1[_0xe0bd('0x1e')];var _0xa6be32=_0x302f5f?_0x361429[_0xe0bd('0x20')]:_0x3042e1['offset']+_0x3042e1['limit'];var _0x29bd21;if(_0xa6be32>=_0x2d2ba3){_0xa6be32=_0x2d2ba3;_0x29bd21=0xc8;}else{_0x29bd21=0xce;}_0x3f5ef7[_0xe0bd('0x1b')](_0x29bd21);return _0x3f5ef7[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x1c4533+'-'+_0xa6be32+'/'+_0x2d2ba3)[_0xe0bd('0x1d')](_0x361429);}return null;};}function patchUpdates(_0x154480){return function(_0x3dbd98){try{jsonpatch['apply'](_0x3dbd98,_0x154480,!![]);}catch(_0x5ad8bf){return BPromise[_0xe0bd('0x23')](_0x5ad8bf);}return _0x3dbd98[_0xe0bd('0x24')]();};}function saveUpdates(_0x3927ab,_0xdcb789){return function(_0x290c1e){if(_0x290c1e){return _0x290c1e['update'](_0x3927ab)[_0xe0bd('0x25')](function(_0x4795ac){return _0x4795ac;});}return null;};}function removeEntity(_0x242cbe,_0x296f64){return function(_0x3f24b6){if(_0x3f24b6){return _0x3f24b6['destroy']()[_0xe0bd('0x25')](function(){_0x242cbe[_0xe0bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca10,_0x5e6496){return function(_0x2debcb){if(!_0x2debcb){_0x41ca10['sendStatus'](0x194);}return _0x2debcb;};}function handleError(_0x198a1c,_0x72e284){_0x72e284=_0x72e284||0x1f4;return function(_0x3c851d){logger['error'](_0x3c851d[_0xe0bd('0x26')]);if(_0x3c851d['name']){delete _0x3c851d[_0xe0bd('0x27')];}_0x198a1c[_0xe0bd('0x1b')](_0x72e284)['send'](_0x3c851d);};}exports['index']=function(_0x273b95,_0x3789a1){var _0x441475={},_0x23a317={},_0x2d7f2f={'count':0x0,'rows':[]};var _0x17e614=_[_0xe0bd('0x28')](db['OpenchannelTransferReport'][_0xe0bd('0x29')],function(_0x137206){return{'name':_0x137206[_0xe0bd('0x2a')],'type':_0x137206[_0xe0bd('0x2b')][_0xe0bd('0x2c')]};});_0x23a317[_0xe0bd('0x2d')]=_['map'](_0x17e614,_0xe0bd('0x27'));_0x23a317[_0xe0bd('0x2e')]=_[_0xe0bd('0x2f')](_0x273b95[_0xe0bd('0x2e')]);_0x23a317[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x23a317[_0xe0bd('0x2d')],_0x23a317[_0xe0bd('0x2e')]);_0x441475['attributes']=_['intersection'](_0x23a317[_0xe0bd('0x2d')],qs[_0xe0bd('0x32')](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x441475[_0xe0bd('0x33')]=_0x441475['attributes']['length']?_0x441475['attributes']:_0x23a317[_0xe0bd('0x2d')];if(!_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x34')](_0xe0bd('0x35'))){_0x441475[_0xe0bd('0x36')]=qs[_0xe0bd('0x36')](_0x273b95['query'][_0xe0bd('0x36')]);_0x441475[_0xe0bd('0x1e')]=qs[_0xe0bd('0x1e')](_0x273b95['query'][_0xe0bd('0x1e')]);}_0x441475[_0xe0bd('0x37')]=qs['sort'](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x38')]);_0x441475[_0xe0bd('0x39')]=qs['filters'](_[_0xe0bd('0x3a')](_0x273b95['query'],_0x23a317[_0xe0bd('0x30')]),_0x17e614);if(_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x3b')]){_0x441475[_0xe0bd('0x39')]=_['merge'](_0x441475[_0xe0bd('0x39')],{'$or':_[_0xe0bd('0x28')](_0x17e614,function(_0x7f9272){if(_0x7f9272['type']!=='VIRTUAL'){var _0x23064a={};_0x23064a[_0x7f9272[_0xe0bd('0x27')]]={'$like':'%'+_0x273b95[_0xe0bd('0x2e')]['filter']+'%'};return _0x23064a;}})});}_0x441475=_['merge']({},_0x441475,_0x273b95[_0xe0bd('0x3c')]);var _0x383b08={'where':_0x441475[_0xe0bd('0x39')]};return db[_0xe0bd('0x3d')]['count'](_0x383b08)[_0xe0bd('0x25')](function(_0x23b596){_0x2d7f2f[_0xe0bd('0x20')]=_0x23b596;if(_0x273b95['query']['includeAll']){_0x441475[_0xe0bd('0x3e')]=[{'all':!![]}];}return db[_0xe0bd('0x3d')][_0xe0bd('0x3f')](_0x441475);})[_0xe0bd('0x25')](function(_0x5ada76){_0x2d7f2f[_0xe0bd('0x40')]=_0x5ada76;return _0x2d7f2f;})[_0xe0bd('0x25')](respondWithFilteredResult(_0x3789a1,_0x441475))[_0xe0bd('0x41')](handleError(_0x3789a1,null));};exports['show']=function(_0x499e16,_0x27a582){var _0x52a0af={'raw':!![],'where':{'id':_0x499e16[_0xe0bd('0x42')]['id']}},_0x24be53={};_0x24be53['model']=_[_0xe0bd('0x2f')](db[_0xe0bd('0x3d')][_0xe0bd('0x29')]);_0x24be53['query']=_[_0xe0bd('0x2f')](_0x499e16[_0xe0bd('0x2e')]);_0x24be53[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x24be53[_0xe0bd('0x2d')],_0x24be53[_0xe0bd('0x2e')]);_0x52a0af[_0xe0bd('0x33')]=_[_0xe0bd('0x31')](_0x24be53['model'],qs[_0xe0bd('0x32')](_0x499e16[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x52a0af[_0xe0bd('0x33')]=_0x52a0af[_0xe0bd('0x33')][_0xe0bd('0x43')]?_0x52a0af[_0xe0bd('0x33')]:_0x24be53[_0xe0bd('0x2d')];if(_0x499e16['query'][_0xe0bd('0x44')]){_0x52a0af[_0xe0bd('0x3e')]=[{'all':!![]}];}_0x52a0af=_[_0xe0bd('0x45')]({},_0x52a0af,_0x499e16[_0xe0bd('0x3c')]);return db[_0xe0bd('0x3d')]['find'](_0x52a0af)[_0xe0bd('0x25')](handleEntityNotFound(_0x27a582,null))['then'](respondWithResult(_0x27a582,null))['catch'](handleError(_0x27a582,null));};exports['create']=function(_0x2d7e00,_0x55dd83){return db['OpenchannelTransferReport'][_0xe0bd('0x46')](_0x2d7e00[_0xe0bd('0x47')],{})[_0xe0bd('0x25')](respondWithResult(_0x55dd83,0xc9))[_0xe0bd('0x41')](handleError(_0x55dd83,null));};exports[_0xe0bd('0x48')]=function(_0x220147,_0xe2b989){if(_0x220147[_0xe0bd('0x47')]['id']){delete _0x220147[_0xe0bd('0x47')]['id'];}return db[_0xe0bd('0x3d')]['find']({'where':{'id':_0x220147[_0xe0bd('0x42')]['id']}})['then'](handleEntityNotFound(_0xe2b989,null))['then'](saveUpdates(_0x220147[_0xe0bd('0x47')],null))[_0xe0bd('0x25')](respondWithResult(_0xe2b989,null))[_0xe0bd('0x41')](handleError(_0xe2b989,null));};exports['destroy']=function(_0x281a60,_0x3fe076){return db[_0xe0bd('0x3d')][_0xe0bd('0x49')]({'where':{'id':_0x281a60[_0xe0bd('0x42')]['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x3fe076,null))[_0xe0bd('0x25')](removeEntity(_0x3fe076,null))[_0xe0bd('0x41')](handleError(_0x3fe076,null));};exports[_0xe0bd('0x4a')]=function(_0x1f85ef,_0x29c7f8){return db[_0xe0bd('0x3d')]['describe']()[_0xe0bd('0x25')](respondWithResult(_0x29c7f8,null))[_0xe0bd('0x41')](handleError(_0x29c7f8,null));}; \ No newline at end of file +var _0x0532=['set','Content-Range','reject','update','then','destroy','end','sendStatus','stack','name','send','map','OpenchannelTransferReport','fieldName','type','key','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','include','findAll','catch','params','rawAttributes','intersection','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit'];(function(_0x3ed349,_0x103dd8){var _0x1cbdf9=function(_0x29e4bf){while(--_0x29e4bf){_0x3ed349['push'](_0x3ed349['shift']());}};_0x1cbdf9(++_0x103dd8);}(_0x0532,0x79));var _0x2053=function(_0x22d728,_0x498c86){_0x22d728=_0x22d728-0x0;var _0x4fa902=_0x0532[_0x22d728];return _0x4fa902;};'use strict';var emlformat=require(_0x2053('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2053('0x1'));var jsonpatch=require(_0x2053('0x2'));var rp=require(_0x2053('0x3'));var moment=require(_0x2053('0x4'));var BPromise=require(_0x2053('0x5'));var Mustache=require(_0x2053('0x6'));var util=require(_0x2053('0x7'));var path=require(_0x2053('0x8'));var sox=require(_0x2053('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2053('0xa'));var _=require(_0x2053('0xb'));var squel=require(_0x2053('0xc'));var crypto=require(_0x2053('0xd'));var jsforce=require(_0x2053('0xe'));var deskjs=require(_0x2053('0xf'));var toCsv=require(_0x2053('0x10'));var querystring=require(_0x2053('0x11'));var Papa=require(_0x2053('0x12'));var Redis=require(_0x2053('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2053('0x14'));var as=require(_0x2053('0x15'));var hardwareService=require(_0x2053('0x16'));var logger=require(_0x2053('0x17'))(_0x2053('0x18'));var utils=require(_0x2053('0x19'));var config=require(_0x2053('0x1a'));var licenseUtil=require(_0x2053('0x1b'));var db=require(_0x2053('0x1c'))['db'];function respondWithStatusCode(_0x399b5e,_0xa43b62){_0xa43b62=_0xa43b62||0xcc;return function(_0x313f17){if(_0x313f17){return _0x399b5e['sendStatus'](_0xa43b62);}return _0x399b5e['status'](_0xa43b62)['end']();};}function respondWithResult(_0x28677c,_0x49da52){_0x49da52=_0x49da52||0xc8;return function(_0x438c96){if(_0x438c96){return _0x28677c[_0x2053('0x1d')](_0x49da52)[_0x2053('0x1e')](_0x438c96);}};}function respondWithFilteredResult(_0x2b5f4e,_0x545354){return function(_0x1aba4a){if(_0x1aba4a){var _0x4845ed=typeof _0x545354[_0x2053('0x1f')]==='undefined'&&typeof _0x545354['limit']===_0x2053('0x20');var _0x275f0b=_0x1aba4a[_0x2053('0x21')];var _0x5616ef=_0x4845ed?0x0:_0x545354[_0x2053('0x1f')];var _0x5a1fe0=_0x4845ed?_0x1aba4a[_0x2053('0x21')]:_0x545354[_0x2053('0x1f')]+_0x545354[_0x2053('0x22')];var _0x580fa0;if(_0x5a1fe0>=_0x275f0b){_0x5a1fe0=_0x275f0b;_0x580fa0=0xc8;}else{_0x580fa0=0xce;}_0x2b5f4e['status'](_0x580fa0);return _0x2b5f4e[_0x2053('0x23')](_0x2053('0x24'),_0x5616ef+'-'+_0x5a1fe0+'/'+_0x275f0b)[_0x2053('0x1e')](_0x1aba4a);}return null;};}function patchUpdates(_0x949bc9){return function(_0x38b261){try{jsonpatch['apply'](_0x38b261,_0x949bc9,!![]);}catch(_0xe5f871){return BPromise[_0x2053('0x25')](_0xe5f871);}return _0x38b261['save']();};}function saveUpdates(_0x5e8174,_0x3c7523){return function(_0x3524e9){if(_0x3524e9){return _0x3524e9[_0x2053('0x26')](_0x5e8174)[_0x2053('0x27')](function(_0x2877cc){return _0x2877cc;});}return null;};}function removeEntity(_0x23c8bd,_0xb2ace0){return function(_0x2afea4){if(_0x2afea4){return _0x2afea4[_0x2053('0x28')]()[_0x2053('0x27')](function(){_0x23c8bd[_0x2053('0x1d')](0xcc)[_0x2053('0x29')]();});}};}function handleEntityNotFound(_0x3cd287,_0x1eaef6){return function(_0x22e442){if(!_0x22e442){_0x3cd287[_0x2053('0x2a')](0x194);}return _0x22e442;};}function handleError(_0x16a27,_0x15532d){_0x15532d=_0x15532d||0x1f4;return function(_0x30c399){logger['error'](_0x30c399[_0x2053('0x2b')]);if(_0x30c399[_0x2053('0x2c')]){delete _0x30c399[_0x2053('0x2c')];}_0x16a27[_0x2053('0x1d')](_0x15532d)[_0x2053('0x2d')](_0x30c399);};}exports['index']=function(_0x1d8c11,_0xdd2c3d){var _0x243503={},_0x505871={},_0x170163={'count':0x0,'rows':[]};var _0x3a59d6=_[_0x2053('0x2e')](db[_0x2053('0x2f')]['rawAttributes'],function(_0x5abffe){return{'name':_0x5abffe[_0x2053('0x30')],'type':_0x5abffe[_0x2053('0x31')][_0x2053('0x32')]};});_0x505871['model']=_[_0x2053('0x2e')](_0x3a59d6,_0x2053('0x2c'));_0x505871['query']=_[_0x2053('0x33')](_0x1d8c11[_0x2053('0x34')]);_0x505871['filters']=_['intersection'](_0x505871[_0x2053('0x35')],_0x505871[_0x2053('0x34')]);_0x243503[_0x2053('0x36')]=_['intersection'](_0x505871[_0x2053('0x35')],qs[_0x2053('0x37')](_0x1d8c11['query'][_0x2053('0x37')]));_0x243503[_0x2053('0x36')]=_0x243503[_0x2053('0x36')][_0x2053('0x38')]?_0x243503[_0x2053('0x36')]:_0x505871[_0x2053('0x35')];if(!_0x1d8c11['query'][_0x2053('0x39')](_0x2053('0x3a'))){_0x243503[_0x2053('0x22')]=qs['limit'](_0x1d8c11[_0x2053('0x34')][_0x2053('0x22')]);_0x243503['offset']=qs[_0x2053('0x1f')](_0x1d8c11[_0x2053('0x34')][_0x2053('0x1f')]);}_0x243503[_0x2053('0x3b')]=qs[_0x2053('0x3c')](_0x1d8c11[_0x2053('0x34')][_0x2053('0x3c')]);_0x243503['where']=qs['filters'](_[_0x2053('0x3d')](_0x1d8c11[_0x2053('0x34')],_0x505871[_0x2053('0x3e')]),_0x3a59d6);if(_0x1d8c11['query'][_0x2053('0x3f')]){_0x243503[_0x2053('0x40')]=_['merge'](_0x243503[_0x2053('0x40')],{'$or':_['map'](_0x3a59d6,function(_0x308090){if(_0x308090[_0x2053('0x31')]!==_0x2053('0x41')){var _0x2eb9ee={};_0x2eb9ee[_0x308090[_0x2053('0x2c')]]={'$like':'%'+_0x1d8c11[_0x2053('0x34')]['filter']+'%'};return _0x2eb9ee;}})});}_0x243503=_[_0x2053('0x42')]({},_0x243503,_0x1d8c11[_0x2053('0x43')]);var _0x3bbada={'where':_0x243503[_0x2053('0x40')]};return db[_0x2053('0x2f')][_0x2053('0x21')](_0x3bbada)[_0x2053('0x27')](function(_0x11ac2b){_0x170163[_0x2053('0x21')]=_0x11ac2b;if(_0x1d8c11[_0x2053('0x34')]['includeAll']){_0x243503[_0x2053('0x44')]=[{'all':!![]}];}return db[_0x2053('0x2f')][_0x2053('0x45')](_0x243503);})[_0x2053('0x27')](function(_0x2f3fd4){_0x170163['rows']=_0x2f3fd4;return _0x170163;})['then'](respondWithFilteredResult(_0xdd2c3d,_0x243503))[_0x2053('0x46')](handleError(_0xdd2c3d,null));};exports['show']=function(_0x296489,_0x3a0870){var _0x36f2da={'raw':!![],'where':{'id':_0x296489[_0x2053('0x47')]['id']}},_0x58fd2d={};_0x58fd2d[_0x2053('0x35')]=_['keys'](db[_0x2053('0x2f')][_0x2053('0x48')]);_0x58fd2d[_0x2053('0x34')]=_[_0x2053('0x33')](_0x296489['query']);_0x58fd2d[_0x2053('0x3e')]=_[_0x2053('0x49')](_0x58fd2d[_0x2053('0x35')],_0x58fd2d[_0x2053('0x34')]);_0x36f2da[_0x2053('0x36')]=_['intersection'](_0x58fd2d[_0x2053('0x35')],qs[_0x2053('0x37')](_0x296489[_0x2053('0x34')][_0x2053('0x37')]));_0x36f2da[_0x2053('0x36')]=_0x36f2da['attributes'][_0x2053('0x38')]?_0x36f2da[_0x2053('0x36')]:_0x58fd2d['model'];if(_0x296489[_0x2053('0x34')][_0x2053('0x4a')]){_0x36f2da[_0x2053('0x44')]=[{'all':!![]}];}_0x36f2da=_[_0x2053('0x42')]({},_0x36f2da,_0x296489[_0x2053('0x43')]);return db[_0x2053('0x2f')][_0x2053('0x4b')](_0x36f2da)[_0x2053('0x27')](handleEntityNotFound(_0x3a0870,null))[_0x2053('0x27')](respondWithResult(_0x3a0870,null))[_0x2053('0x46')](handleError(_0x3a0870,null));};exports['create']=function(_0x5208c4,_0x1cd7ae){return db[_0x2053('0x2f')][_0x2053('0x4c')](_0x5208c4[_0x2053('0x4d')],{})[_0x2053('0x27')](respondWithResult(_0x1cd7ae,0xc9))[_0x2053('0x46')](handleError(_0x1cd7ae,null));};exports['update']=function(_0x194e46,_0x3624b0){if(_0x194e46[_0x2053('0x4d')]['id']){delete _0x194e46[_0x2053('0x4d')]['id'];}return db[_0x2053('0x2f')][_0x2053('0x4b')]({'where':{'id':_0x194e46[_0x2053('0x47')]['id']}})[_0x2053('0x27')](handleEntityNotFound(_0x3624b0,null))[_0x2053('0x27')](saveUpdates(_0x194e46['body'],null))['then'](respondWithResult(_0x3624b0,null))[_0x2053('0x46')](handleError(_0x3624b0,null));};exports['destroy']=function(_0x4aa1c3,_0x29f255){return db[_0x2053('0x2f')][_0x2053('0x4b')]({'where':{'id':_0x4aa1c3[_0x2053('0x47')]['id']}})[_0x2053('0x27')](handleEntityNotFound(_0x29f255,null))[_0x2053('0x27')](removeEntity(_0x29f255,null))[_0x2053('0x46')](handleError(_0x29f255,null));};exports['describe']=function(_0x269b65,_0x36ef5d){return db[_0x2053('0x2f')]['describe']()[_0x2053('0x27')](respondWithResult(_0x36ef5d,null))[_0x2053('0x46')](handleError(_0x36ef5d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a59afc1..a23bcc4 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 _0x7937=['moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util'];(function(_0x49f790,_0x27de72){var _0x5a9c0e=function(_0x1cbe57){while(--_0x1cbe57){_0x49f790['push'](_0x49f790['shift']());}};_0x5a9c0e(++_0x27de72);}(_0x7937,0xe2));var _0x7793=function(_0x2c9e61,_0x2d13f5){_0x2c9e61=_0x2c9e61-0x0;var _0x4d55d6=_0x7937[_0x2c9e61];return _0x4d55d6;};'use strict';var _=require(_0x7793('0x0'));var util=require(_0x7793('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7793('0x2'));var BPromise=require(_0x7793('0x3'));var rp=require(_0x7793('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7793('0x5'));var config=require(_0x7793('0x6'));var attributes=require(_0x7793('0x7'));module[_0x7793('0x8')]=function(_0x5bcfdf,_0x2ea7bc){return _0x5bcfdf[_0x7793('0x9')](_0x7793('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7793('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe731=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe731,0x1b4));var _0x1e73=function(_0x528b22,_0x368945){_0x528b22=_0x528b22-0x0;var _0x20fafc=_0xe731[_0x528b22];return _0x20fafc;};'use strict';var _=require(_0x1e73('0x0'));var util=require('util');var logger=require(_0x1e73('0x1'))(_0x1e73('0x2'));var moment=require(_0x1e73('0x3'));var BPromise=require(_0x1e73('0x4'));var rp=require(_0x1e73('0x5'));var fs=require('fs');var path=require(_0x1e73('0x6'));var rimraf=require(_0x1e73('0x7'));var config=require(_0x1e73('0x8'));var attributes=require(_0x1e73('0x9'));module['exports']=function(_0x5c47e4,_0x5043f9){return _0x5c47e4[_0x1e73('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x1e73('0xb'),'paranoid':![],'indexes':[{'name':_0x1e73('0xc'),'fields':[_0x1e73('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 98b3e24..ce8e825 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 _0x5b20=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x530cd4,_0x8adac9){var _0x91b5ad=function(_0xf9d838){while(--_0xf9d838){_0x530cd4['push'](_0x530cd4['shift']());}};_0x91b5ad(++_0x8adac9);}(_0x5b20,0x86));var _0x05b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5b20[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var moment=require(_0x05b2('0x2'));var BPromise=require(_0x05b2('0x3'));var rs=require(_0x05b2('0x4'));var fs=require('fs');var Redis=require(_0x05b2('0x5'));var db=require(_0x05b2('0x6'))['db'];var utils=require(_0x05b2('0x7'));var logger=require(_0x05b2('0x8'))(_0x05b2('0x9'));var config=require(_0x05b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05b2('0xb')][_0x05b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x541855,_0x24f11f,_0x43cd94){return new BPromise(function(_0x3be69a,_0x1b66e4){return client[_0x05b2('0xd')](_0x541855,_0x43cd94)[_0x05b2('0xe')](function(_0xfe6680){logger[_0x05b2('0xf')](_0x05b2('0x10'),_0x24f11f,_0x05b2('0x11'));logger[_0x05b2('0x12')](_0x05b2('0x13'),_0x24f11f,_0x05b2('0x11'),JSON[_0x05b2('0x14')](_0xfe6680));if(_0xfe6680[_0x05b2('0x15')]){if(_0xfe6680[_0x05b2('0x15')]['code']===0x1f4){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);return _0x1b66e4(_0xfe6680['error'][_0x05b2('0x16')]);}logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680['error']['message']);return _0x3be69a(_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x24f11f,_0x05b2('0x11'));_0x3be69a(_0xfe6680[_0x05b2('0x17')][_0x05b2('0x16')]);}})[_0x05b2('0x18')](function(_0x234843){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0x234843);_0x1b66e4(_0x234843);});});} \ No newline at end of file +var _0x943c=['stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x14cafe,_0x11aa6a){var _0x45277f=function(_0x42c097){while(--_0x42c097){_0x14cafe['push'](_0x14cafe['shift']());}};_0x45277f(++_0x11aa6a);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var moment=require(_0xc943('0x2'));var BPromise=require(_0xc943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc943('0x4'))['db'];var utils=require(_0xc943('0x5'));var logger=require(_0xc943('0x6'))('rpc');var config=require(_0xc943('0x7'));var jayson=require(_0xc943('0x8'));var client=jayson[_0xc943('0x9')][_0xc943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b73ad,_0x4091fd,_0x3f718f){return new BPromise(function(_0x56e665,_0x3ec7da){return client[_0xc943('0xb')](_0x1b73ad,_0x3f718f)[_0xc943('0xc')](function(_0x455eed){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));logger[_0xc943('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4091fd,'request\x20sent',JSON[_0xc943('0xf')](_0x455eed));if(_0x455eed[_0xc943('0x10')]){if(_0x455eed[_0xc943('0x10')][_0xc943('0x11')]===0x1f4){logger[_0xc943('0x10')](_0xc943('0x12'),_0x4091fd,_0x455eed['error'][_0xc943('0x13')]);return _0x3ec7da(_0x455eed[_0xc943('0x10')]['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0x455eed[_0xc943('0x10')][_0xc943('0x13')]);return _0x56e665(_0x455eed['error'][_0xc943('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));_0x56e665(_0x455eed['result'][_0xc943('0x13')]);}})[_0xc943('0x14')](function(_0x1eb50a){logger[_0xc943('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4091fd,_0x1eb50a);_0x3ec7da(_0x1eb50a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 31bccf4..bd776e3 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 _0x3443=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3443,0x116));var _0x3344=function(_0x2f5810,_0x36dc97){_0x2f5810=_0x2f5810-0x0;var _0x4845cf=_0x3443[_0x2f5810];return _0x4845cf;};'use strict';var multer=require(_0x3344('0x0'));var util=require(_0x3344('0x1'));var path=require(_0x3344('0x2'));var timeout=require(_0x3344('0x3'));var express=require(_0x3344('0x4'));var router=express['Router']();var fs_extra=require(_0x3344('0x5'));var auth=require(_0x3344('0x6'));var interaction=require(_0x3344('0x7'));var config=require(_0x3344('0x8'));var controller=require(_0x3344('0x9'));router[_0x3344('0xa')]('/',auth[_0x3344('0xb')](),controller[_0x3344('0xc')]);router[_0x3344('0xa')](_0x3344('0xd'),auth[_0x3344('0xb')](),controller[_0x3344('0xe')]);router['post']('/',auth[_0x3344('0xb')](),controller[_0x3344('0xf')]);router[_0x3344('0x10')](_0x3344('0xd'),auth[_0x3344('0xb')](),controller[_0x3344('0x11')]);router[_0x3344('0x12')](_0x3344('0xd'),auth['isAuthenticated'](),controller[_0x3344('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7ee3=['put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7ee3,0xf3));var _0x37ee=function(_0x9bd1eb,_0x24ccb4){_0x9bd1eb=_0x9bd1eb-0x0;var _0x51b468=_0x7ee3[_0x9bd1eb];return _0x51b468;};'use strict';var multer=require('multer');var util=require(_0x37ee('0x0'));var path=require(_0x37ee('0x1'));var timeout=require(_0x37ee('0x2'));var express=require(_0x37ee('0x3'));var router=express[_0x37ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x37ee('0x5'));var interaction=require(_0x37ee('0x6'));var config=require(_0x37ee('0x7'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x37ee('0x8')](_0x37ee('0x9'),auth[_0x37ee('0xa')](),controller[_0x37ee('0xb')]);router['post']('/',auth[_0x37ee('0xa')](),controller['create']);router[_0x37ee('0xc')](_0x37ee('0x9'),auth[_0x37ee('0xa')](),controller['update']);router[_0x37ee('0xd')](_0x37ee('0x9'),auth[_0x37ee('0xa')](),controller['destroy']);module[_0x37ee('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9409e91..6fe78cd 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 _0x8006=['STRING','sequelize'];(function(_0x23e84c,_0x4059cf){var _0xfa43f3=function(_0x153d28){while(--_0x153d28){_0x23e84c['push'](_0x23e84c['shift']());}};_0xfa43f3(++_0x4059cf);}(_0x8006,0xfd));var _0x6800=function(_0x56bac0,_0x537e9d){_0x56bac0=_0x56bac0-0x0;var _0x258e8e=_0x8006[_0x56bac0];return _0x258e8e;};'use strict';var Sequelize=require(_0x6800('0x0'));module['exports']={'name':{'type':Sequelize[_0x6800('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6800('0x1')]}}; \ No newline at end of file +var _0x7a48=['name'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x7a48,0xb7));var _0x87a4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7a48[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x87a4('0x0'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 57d55b6..82ccdfc 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 _0x9788=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','Pause','findAll','rows','show','attributes','length','find','create','user','UserProfileSection','userProfileId','UserProfileResource','catch','update','body','params','eml-format','rimraf','zip-dir','moment'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x9788,0x144));var _0x8978=function(_0x52c795,_0x57ec23){_0x52c795=_0x52c795-0x0;var _0x1ee75d=_0x9788[_0x52c795];return _0x1ee75d;};'use strict';var emlformat=require(_0x8978('0x0'));var rimraf=require(_0x8978('0x1'));var zipdir=require(_0x8978('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8978('0x3'));var BPromise=require(_0x8978('0x4'));var Mustache=require('mustache');var util=require(_0x8978('0x5'));var path=require(_0x8978('0x6'));var sox=require(_0x8978('0x7'));var csv=require(_0x8978('0x8'));var ejs=require(_0x8978('0x9'));var fs=require('fs');var fs_extra=require(_0x8978('0xa'));var _=require(_0x8978('0xb'));var squel=require(_0x8978('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8978('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8978('0xe'));var Papa=require(_0x8978('0xf'));var Redis=require(_0x8978('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8978('0x11'));var as=require(_0x8978('0x12'));var hardwareService=require(_0x8978('0x13'));var logger=require('../../config/logger')(_0x8978('0x14'));var utils=require(_0x8978('0x15'));var config=require(_0x8978('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8978('0x17'))['db'];function respondWithStatusCode(_0x57a8a3,_0x215271){_0x215271=_0x215271||0xcc;return function(_0x47161a){if(_0x47161a){return _0x57a8a3[_0x8978('0x18')](_0x215271);}return _0x57a8a3[_0x8978('0x19')](_0x215271)[_0x8978('0x1a')]();};}function respondWithResult(_0x28b48b,_0x29d06c){_0x29d06c=_0x29d06c||0xc8;return function(_0x4f5aab){if(_0x4f5aab){return _0x28b48b[_0x8978('0x19')](_0x29d06c)[_0x8978('0x1b')](_0x4f5aab);}};}function respondWithFilteredResult(_0x39496c,_0x3c268e){return function(_0x21fdd0){if(_0x21fdd0){var _0x270ffa=typeof _0x3c268e[_0x8978('0x1c')]===_0x8978('0x1d')&&typeof _0x3c268e['limit']==='undefined';var _0x40938e=_0x21fdd0[_0x8978('0x1e')];var _0x556c6a=_0x270ffa?0x0:_0x3c268e['offset'];var _0x2aa264=_0x270ffa?_0x21fdd0[_0x8978('0x1e')]:_0x3c268e[_0x8978('0x1c')]+_0x3c268e[_0x8978('0x1f')];var _0x329d3d;if(_0x2aa264>=_0x40938e){_0x2aa264=_0x40938e;_0x329d3d=0xc8;}else{_0x329d3d=0xce;}_0x39496c[_0x8978('0x19')](_0x329d3d);return _0x39496c[_0x8978('0x20')](_0x8978('0x21'),_0x556c6a+'-'+_0x2aa264+'/'+_0x40938e)[_0x8978('0x1b')](_0x21fdd0);}return null;};}function patchUpdates(_0x13930d){return function(_0xdfaa22){try{jsonpatch[_0x8978('0x22')](_0xdfaa22,_0x13930d,!![]);}catch(_0x4a7ad3){return BPromise['reject'](_0x4a7ad3);}return _0xdfaa22[_0x8978('0x23')]();};}function saveUpdates(_0xf99a90,_0x341ba0){return function(_0x58e655){if(_0x58e655){return _0x58e655['update'](_0xf99a90)[_0x8978('0x24')](function(_0x142486){return _0x142486;});}return null;};}function removeEntity(_0x5b6084,_0x2fb9e7){return function(_0x16d594){if(_0x16d594){return _0x16d594[_0x8978('0x25')]()[_0x8978('0x24')](function(){var _0x24423d=_0x16d594[_0x8978('0x26')]({'plain':!![]});var _0x52662b='Pauses';return db['UserProfileResource'][_0x8978('0x25')]({'where':{'type':_0x52662b,'resourceId':_0x24423d['id']}})[_0x8978('0x24')](function(){return _0x16d594;});})[_0x8978('0x24')](function(){_0x5b6084[_0x8978('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf24df,_0x22d4eb){return function(_0x3fd045){if(!_0x3fd045){_0xbf24df[_0x8978('0x18')](0x194);}return _0x3fd045;};}function handleError(_0xfd5b,_0x9835af){_0x9835af=_0x9835af||0x1f4;return function(_0x2bc1aa){logger[_0x8978('0x27')](_0x2bc1aa[_0x8978('0x28')]);if(_0x2bc1aa['name']){delete _0x2bc1aa[_0x8978('0x29')];}_0xfd5b['status'](_0x9835af)[_0x8978('0x2a')](_0x2bc1aa);};}exports[_0x8978('0x2b')]=function(_0x39a3bd,_0x2f917a){var _0x32b546={},_0x1c2d3a={},_0x559c69={'count':0x0,'rows':[]};var _0x17281d=_[_0x8978('0x2c')](db['Pause'][_0x8978('0x2d')],function(_0x5a7721){return{'name':_0x5a7721[_0x8978('0x2e')],'type':_0x5a7721['type'][_0x8978('0x2f')]};});_0x1c2d3a[_0x8978('0x30')]=_[_0x8978('0x2c')](_0x17281d,_0x8978('0x29'));_0x1c2d3a[_0x8978('0x31')]=_[_0x8978('0x32')](_0x39a3bd['query']);_0x1c2d3a[_0x8978('0x33')]=_[_0x8978('0x34')](_0x1c2d3a[_0x8978('0x30')],_0x1c2d3a[_0x8978('0x31')]);_0x32b546['attributes']=_[_0x8978('0x34')](_0x1c2d3a[_0x8978('0x30')],qs[_0x8978('0x35')](_0x39a3bd[_0x8978('0x31')][_0x8978('0x35')]));_0x32b546['attributes']=_0x32b546['attributes']['length']?_0x32b546['attributes']:_0x1c2d3a['model'];if(!_0x39a3bd['query'][_0x8978('0x36')](_0x8978('0x37'))){_0x32b546[_0x8978('0x1f')]=qs[_0x8978('0x1f')](_0x39a3bd[_0x8978('0x31')]['limit']);_0x32b546['offset']=qs[_0x8978('0x1c')](_0x39a3bd[_0x8978('0x31')][_0x8978('0x1c')]);}_0x32b546[_0x8978('0x38')]=qs['sort'](_0x39a3bd['query']['sort']);_0x32b546['where']=qs[_0x8978('0x33')](_[_0x8978('0x39')](_0x39a3bd[_0x8978('0x31')],_0x1c2d3a['filters']),_0x17281d);if(_0x39a3bd[_0x8978('0x31')][_0x8978('0x3a')]){_0x32b546[_0x8978('0x3b')]=_[_0x8978('0x3c')](_0x32b546[_0x8978('0x3b')],{'$or':_[_0x8978('0x2c')](_0x17281d,function(_0x3667f4){if(_0x3667f4[_0x8978('0x3d')]!==_0x8978('0x3e')){var _0x3438cb={};_0x3438cb[_0x3667f4[_0x8978('0x29')]]={'$like':'%'+_0x39a3bd[_0x8978('0x31')]['filter']+'%'};return _0x3438cb;}})});}_0x32b546=_[_0x8978('0x3c')]({},_0x32b546,_0x39a3bd[_0x8978('0x3f')]);var _0x13a38f={'where':_0x32b546[_0x8978('0x3b')]};return db['Pause'][_0x8978('0x1e')](_0x13a38f)[_0x8978('0x24')](function(_0x2ffadc){_0x559c69['count']=_0x2ffadc;if(_0x39a3bd[_0x8978('0x31')][_0x8978('0x40')]){_0x32b546[_0x8978('0x41')]=[{'all':!![]}];}return db[_0x8978('0x42')][_0x8978('0x43')](_0x32b546);})[_0x8978('0x24')](function(_0x4052f9){_0x559c69[_0x8978('0x44')]=_0x4052f9;return _0x559c69;})[_0x8978('0x24')](respondWithFilteredResult(_0x2f917a,_0x32b546))['catch'](handleError(_0x2f917a,null));};exports[_0x8978('0x45')]=function(_0x59ec13,_0x31c3e0){var _0x34bcf9={'raw':!![],'where':{'id':_0x59ec13['params']['id']}},_0x2ec9ef={};_0x2ec9ef[_0x8978('0x30')]=_[_0x8978('0x32')](db[_0x8978('0x42')][_0x8978('0x2d')]);_0x2ec9ef[_0x8978('0x31')]=_[_0x8978('0x32')](_0x59ec13[_0x8978('0x31')]);_0x2ec9ef[_0x8978('0x33')]=_['intersection'](_0x2ec9ef[_0x8978('0x30')],_0x2ec9ef[_0x8978('0x31')]);_0x34bcf9[_0x8978('0x46')]=_[_0x8978('0x34')](_0x2ec9ef[_0x8978('0x30')],qs['fields'](_0x59ec13[_0x8978('0x31')][_0x8978('0x35')]));_0x34bcf9[_0x8978('0x46')]=_0x34bcf9[_0x8978('0x46')][_0x8978('0x47')]?_0x34bcf9[_0x8978('0x46')]:_0x2ec9ef[_0x8978('0x30')];if(_0x59ec13[_0x8978('0x31')]['includeAll']){_0x34bcf9[_0x8978('0x41')]=[{'all':!![]}];}_0x34bcf9=_[_0x8978('0x3c')]({},_0x34bcf9,_0x59ec13[_0x8978('0x3f')]);return db['Pause'][_0x8978('0x48')](_0x34bcf9)[_0x8978('0x24')](handleEntityNotFound(_0x31c3e0,null))[_0x8978('0x24')](respondWithResult(_0x31c3e0,null))['catch'](handleError(_0x31c3e0,null));};exports['create']=function(_0x593d2f,_0x4de8f5){return db[_0x8978('0x42')][_0x8978('0x49')](_0x593d2f['body'],{})['then'](function(_0x2d4b48){var _0x3a762f=_0x593d2f[_0x8978('0x4a')]['get']({'plain':!![]});if(!_0x3a762f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a762f['role']===_0x8978('0x4a')){var _0x4c7d82=_0x2d4b48[_0x8978('0x26')]({'plain':!![]});var _0x3937a3='Pauses';return db[_0x8978('0x4b')][_0x8978('0x48')]({'where':{'name':_0x3937a3,'userProfileId':_0x3a762f[_0x8978('0x4c')]},'raw':!![]})[_0x8978('0x24')](function(_0x6b5ed0){if(_0x6b5ed0&&_0x6b5ed0['autoAssociation']===0x0){return db[_0x8978('0x4d')][_0x8978('0x49')]({'name':_0x4c7d82[_0x8978('0x29')],'resourceId':_0x4c7d82['id'],'type':_0x6b5ed0['name'],'sectionId':_0x6b5ed0['id']},{})[_0x8978('0x24')](function(){return _0x2d4b48;});}else{return _0x2d4b48;}})['catch'](function(_0xcb0ff1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcb0ff1);throw _0xcb0ff1;});}return _0x2d4b48;})['then'](respondWithResult(_0x4de8f5,0xc9))[_0x8978('0x4e')](handleError(_0x4de8f5,null));};exports[_0x8978('0x4f')]=function(_0x374999,_0x34a649){if(_0x374999[_0x8978('0x50')]['id']){delete _0x374999[_0x8978('0x50')]['id'];}return db['Pause']['find']({'where':{'id':_0x374999[_0x8978('0x51')]['id']}})[_0x8978('0x24')](handleEntityNotFound(_0x34a649,null))['then'](saveUpdates(_0x374999[_0x8978('0x50')],null))[_0x8978('0x24')](respondWithResult(_0x34a649,null))[_0x8978('0x4e')](handleError(_0x34a649,null));};exports[_0x8978('0x25')]=function(_0x3be2a1,_0x89f910){return db[_0x8978('0x42')][_0x8978('0x48')]({'where':{'id':_0x3be2a1[_0x8978('0x51')]['id']}})[_0x8978('0x24')](handleEntityNotFound(_0x89f910,null))[_0x8978('0x24')](removeEntity(_0x89f910,null))[_0x8978('0x4e')](handleError(_0x89f910,null));}; \ No newline at end of file +var _0x969b=['moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Pauses','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','Pause','rows','catch','show','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','update','params','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x969b,0x1ee));var _0xb969=function(_0x30daa4,_0x2d2945){_0x30daa4=_0x30daa4-0x0;var _0x2ceab0=_0x969b[_0x30daa4];return _0x2ceab0;};'use strict';var emlformat=require(_0xb969('0x0'));var rimraf=require(_0xb969('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb969('0x2'));var rp=require(_0xb969('0x3'));var moment=require(_0xb969('0x4'));var BPromise=require(_0xb969('0x5'));var Mustache=require(_0xb969('0x6'));var util=require(_0xb969('0x7'));var path=require(_0xb969('0x8'));var sox=require('sox');var csv=require(_0xb969('0x9'));var ejs=require(_0xb969('0xa'));var fs=require('fs');var fs_extra=require(_0xb969('0xb'));var _=require(_0xb969('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb969('0xd'));var deskjs=require(_0xb969('0xe'));var toCsv=require(_0xb969('0x9'));var querystring=require(_0xb969('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb969('0x10'));var as=require(_0xb969('0x11'));var hardwareService=require(_0xb969('0x12'));var logger=require(_0xb969('0x13'))(_0xb969('0x14'));var utils=require(_0xb969('0x15'));var config=require(_0xb969('0x16'));var licenseUtil=require(_0xb969('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dedfc,_0x590db3){_0x590db3=_0x590db3||0xcc;return function(_0x117dc1){if(_0x117dc1){return _0x4dedfc[_0xb969('0x18')](_0x590db3);}return _0x4dedfc['status'](_0x590db3)[_0xb969('0x19')]();};}function respondWithResult(_0x242e5e,_0x183c8a){_0x183c8a=_0x183c8a||0xc8;return function(_0x1feb3e){if(_0x1feb3e){return _0x242e5e[_0xb969('0x1a')](_0x183c8a)[_0xb969('0x1b')](_0x1feb3e);}};}function respondWithFilteredResult(_0x1476bf,_0x4df316){return function(_0xc16195){if(_0xc16195){var _0x16cad7=typeof _0x4df316[_0xb969('0x1c')]===_0xb969('0x1d')&&typeof _0x4df316[_0xb969('0x1e')]===_0xb969('0x1d');var _0x78d0ff=_0xc16195[_0xb969('0x1f')];var _0x58390c=_0x16cad7?0x0:_0x4df316[_0xb969('0x1c')];var _0x3950c0=_0x16cad7?_0xc16195[_0xb969('0x1f')]:_0x4df316[_0xb969('0x1c')]+_0x4df316['limit'];var _0x70faa1;if(_0x3950c0>=_0x78d0ff){_0x3950c0=_0x78d0ff;_0x70faa1=0xc8;}else{_0x70faa1=0xce;}_0x1476bf[_0xb969('0x1a')](_0x70faa1);return _0x1476bf[_0xb969('0x20')](_0xb969('0x21'),_0x58390c+'-'+_0x3950c0+'/'+_0x78d0ff)[_0xb969('0x1b')](_0xc16195);}return null;};}function patchUpdates(_0x3a52ea){return function(_0x591a29){try{jsonpatch[_0xb969('0x22')](_0x591a29,_0x3a52ea,!![]);}catch(_0x4fc36d){return BPromise[_0xb969('0x23')](_0x4fc36d);}return _0x591a29[_0xb969('0x24')]();};}function saveUpdates(_0x679598,_0xddb9e1){return function(_0x36c931){if(_0x36c931){return _0x36c931['update'](_0x679598)[_0xb969('0x25')](function(_0x59f9df){return _0x59f9df;});}return null;};}function removeEntity(_0x5b342e,_0x296dda){return function(_0x5bc0fd){if(_0x5bc0fd){return _0x5bc0fd[_0xb969('0x26')]()[_0xb969('0x25')](function(){var _0xc2a916=_0x5bc0fd['get']({'plain':!![]});var _0x2e75c6=_0xb969('0x27');return db['UserProfileResource'][_0xb969('0x26')]({'where':{'type':_0x2e75c6,'resourceId':_0xc2a916['id']}})['then'](function(){return _0x5bc0fd;});})[_0xb969('0x25')](function(){_0x5b342e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea40b,_0x50b8b6){return function(_0x234045){if(!_0x234045){_0x2ea40b[_0xb969('0x18')](0x194);}return _0x234045;};}function handleError(_0x54a5de,_0x30b05c){_0x30b05c=_0x30b05c||0x1f4;return function(_0x21dabc){logger[_0xb969('0x28')](_0x21dabc[_0xb969('0x29')]);if(_0x21dabc['name']){delete _0x21dabc[_0xb969('0x2a')];}_0x54a5de[_0xb969('0x1a')](_0x30b05c)[_0xb969('0x2b')](_0x21dabc);};}exports['index']=function(_0x550563,_0x2738d8){var _0x18fc96={},_0x1baf9c={},_0x544664={'count':0x0,'rows':[]};var _0x1d3dc9=_['map'](db['Pause'][_0xb969('0x2c')],function(_0x21c07a){return{'name':_0x21c07a[_0xb969('0x2d')],'type':_0x21c07a[_0xb969('0x2e')][_0xb969('0x2f')]};});_0x1baf9c['model']=_[_0xb969('0x30')](_0x1d3dc9,_0xb969('0x2a'));_0x1baf9c[_0xb969('0x31')]=_['keys'](_0x550563[_0xb969('0x31')]);_0x1baf9c[_0xb969('0x32')]=_[_0xb969('0x33')](_0x1baf9c[_0xb969('0x34')],_0x1baf9c[_0xb969('0x31')]);_0x18fc96['attributes']=_[_0xb969('0x33')](_0x1baf9c[_0xb969('0x34')],qs['fields'](_0x550563[_0xb969('0x31')][_0xb969('0x35')]));_0x18fc96[_0xb969('0x36')]=_0x18fc96['attributes'][_0xb969('0x37')]?_0x18fc96[_0xb969('0x36')]:_0x1baf9c[_0xb969('0x34')];if(!_0x550563[_0xb969('0x31')]['hasOwnProperty'](_0xb969('0x38'))){_0x18fc96[_0xb969('0x1e')]=qs[_0xb969('0x1e')](_0x550563[_0xb969('0x31')][_0xb969('0x1e')]);_0x18fc96[_0xb969('0x1c')]=qs[_0xb969('0x1c')](_0x550563['query']['offset']);}_0x18fc96[_0xb969('0x39')]=qs['sort'](_0x550563[_0xb969('0x31')][_0xb969('0x3a')]);_0x18fc96[_0xb969('0x3b')]=qs[_0xb969('0x32')](_[_0xb969('0x3c')](_0x550563[_0xb969('0x31')],_0x1baf9c[_0xb969('0x32')]),_0x1d3dc9);if(_0x550563[_0xb969('0x31')]['filter']){_0x18fc96[_0xb969('0x3b')]=_['merge'](_0x18fc96['where'],{'$or':_['map'](_0x1d3dc9,function(_0x323c02){if(_0x323c02['type']!==_0xb969('0x3d')){var _0x3efd3b={};_0x3efd3b[_0x323c02[_0xb969('0x2a')]]={'$like':'%'+_0x550563[_0xb969('0x31')][_0xb969('0x3e')]+'%'};return _0x3efd3b;}})});}_0x18fc96=_[_0xb969('0x3f')]({},_0x18fc96,_0x550563['options']);var _0x1041d2={'where':_0x18fc96['where']};return db['Pause'][_0xb969('0x1f')](_0x1041d2)['then'](function(_0x2bfe30){_0x544664['count']=_0x2bfe30;if(_0x550563[_0xb969('0x31')][_0xb969('0x40')]){_0x18fc96[_0xb969('0x41')]=[{'all':!![]}];}return db[_0xb969('0x42')]['findAll'](_0x18fc96);})[_0xb969('0x25')](function(_0x49d2e3){_0x544664[_0xb969('0x43')]=_0x49d2e3;return _0x544664;})[_0xb969('0x25')](respondWithFilteredResult(_0x2738d8,_0x18fc96))[_0xb969('0x44')](handleError(_0x2738d8,null));};exports[_0xb969('0x45')]=function(_0x47a079,_0x3e316c){var _0x159364={'raw':!![],'where':{'id':_0x47a079['params']['id']}},_0x983b5c={};_0x983b5c[_0xb969('0x34')]=_[_0xb969('0x46')](db[_0xb969('0x42')][_0xb969('0x2c')]);_0x983b5c[_0xb969('0x31')]=_['keys'](_0x47a079[_0xb969('0x31')]);_0x983b5c['filters']=_[_0xb969('0x33')](_0x983b5c[_0xb969('0x34')],_0x983b5c[_0xb969('0x31')]);_0x159364[_0xb969('0x36')]=_[_0xb969('0x33')](_0x983b5c['model'],qs[_0xb969('0x35')](_0x47a079['query'][_0xb969('0x35')]));_0x159364['attributes']=_0x159364['attributes'][_0xb969('0x37')]?_0x159364[_0xb969('0x36')]:_0x983b5c[_0xb969('0x34')];if(_0x47a079[_0xb969('0x31')][_0xb969('0x40')]){_0x159364[_0xb969('0x41')]=[{'all':!![]}];}_0x159364=_[_0xb969('0x3f')]({},_0x159364,_0x47a079['options']);return db['Pause']['find'](_0x159364)[_0xb969('0x25')](handleEntityNotFound(_0x3e316c,null))[_0xb969('0x25')](respondWithResult(_0x3e316c,null))[_0xb969('0x44')](handleError(_0x3e316c,null));};exports[_0xb969('0x47')]=function(_0x367e92,_0x48f258){return db['Pause'][_0xb969('0x47')](_0x367e92[_0xb969('0x48')],{})[_0xb969('0x25')](function(_0x542221){var _0x1afee3=_0x367e92[_0xb969('0x49')][_0xb969('0x4a')]({'plain':!![]});if(!_0x1afee3)throw new Error(_0xb969('0x4b'));if(_0x1afee3[_0xb969('0x4c')]==='user'){var _0x5beb4d=_0x542221[_0xb969('0x4a')]({'plain':!![]});var _0x2d5ff0=_0xb969('0x27');return db['UserProfileSection'][_0xb969('0x4d')]({'where':{'name':_0x2d5ff0,'userProfileId':_0x1afee3[_0xb969('0x4e')]},'raw':!![]})[_0xb969('0x25')](function(_0x53a7ce){if(_0x53a7ce&&_0x53a7ce[_0xb969('0x4f')]===0x0){return db[_0xb969('0x50')][_0xb969('0x47')]({'name':_0x5beb4d[_0xb969('0x2a')],'resourceId':_0x5beb4d['id'],'type':_0x53a7ce['name'],'sectionId':_0x53a7ce['id']},{})[_0xb969('0x25')](function(){return _0x542221;});}else{return _0x542221;}})[_0xb969('0x44')](function(_0x1d914a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d914a);throw _0x1d914a;});}return _0x542221;})[_0xb969('0x25')](respondWithResult(_0x48f258,0xc9))[_0xb969('0x44')](handleError(_0x48f258,null));};exports[_0xb969('0x51')]=function(_0xc2930b,_0x2be3b1){if(_0xc2930b[_0xb969('0x48')]['id']){delete _0xc2930b['body']['id'];}return db[_0xb969('0x42')][_0xb969('0x4d')]({'where':{'id':_0xc2930b[_0xb969('0x52')]['id']}})[_0xb969('0x25')](handleEntityNotFound(_0x2be3b1,null))[_0xb969('0x25')](saveUpdates(_0xc2930b[_0xb969('0x48')],null))['then'](respondWithResult(_0x2be3b1,null))['catch'](handleError(_0x2be3b1,null));};exports[_0xb969('0x26')]=function(_0x359ff7,_0x135ef5){return db[_0xb969('0x42')]['find']({'where':{'id':_0x359ff7[_0xb969('0x52')]['id']}})[_0xb969('0x25')](handleEntityNotFound(_0x135ef5,null))[_0xb969('0x25')](removeEntity(_0x135ef5,null))[_0xb969('0x44')](handleError(_0x135ef5,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 47c0cfc..9e0e076 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_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 logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6aa7,0x178));var _0x76aa=function(_0x1fdd6f,_0x2ce562){_0x1fdd6f=_0x1fdd6f-0x0;var _0x4c497a=_0x6aa7[_0x1fdd6f];return _0x4c497a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 e9ea4c5..cb1061b 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5c45ef,_0x6315ea){var _0x5c6d76=function(_0x27804e){while(--_0x27804e){_0x5c45ef['push'](_0x5c45ef['shift']());}};_0x5c6d76(++_0x6315ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b9af6,_0x475a9b){_0x2b9af6=_0x2b9af6-0x0;var _0x20ed39=_0xb10b[_0x2b9af6];return _0x20ed39;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2602d9,_0x1e17a6){var _0x53e8d0=function(_0x3e7b40){while(--_0x3e7b40){_0x2602d9['push'](_0x2602d9['shift']());}};_0x53e8d0(++_0x1e17a6);}(_0x7a54,0x106));var _0x47a5=function(_0x3a2011,_0x362122){_0x3a2011=_0x3a2011-0x0;var _0x160555=_0x7a54[_0x3a2011];return _0x160555;};'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 5373e61..eca3277 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 _0xfd28=['webhookPost','put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/:id','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','/webhook'];(function(_0x313352,_0x4f9bd4){var _0x217947=function(_0x5c63fe){while(--_0x5c63fe){_0x313352['push'](_0x313352['shift']());}};_0x217947(++_0x4f9bd4);}(_0xfd28,0x148));var _0x8fd2=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xfd28[_0xe15270];return _0x1e813b;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/webhook',controller['webhookGet']);router[_0x8fd2('0x7')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['show']);router[_0x8fd2('0x7')]('/:id/download',auth[_0x8fd2('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x8fd2('0xb')]({'destination':function(_0x4fdf0b,_0x1ca2a1,_0x5244ed){_0x5244ed(null,path[_0x8fd2('0xc')](config['root'],_0x8fd2('0xd')));},'filename':function(_0x207298,_0xfd78d,_0xa6d7ca){_0xfd78d[_0x8fd2('0xe')]=_0xfd78d[_0x8fd2('0xe')][_0x8fd2('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa6d7ca(null,util[_0x8fd2('0x10')](_0x8fd2('0x11'),path[_0x8fd2('0x12')](_0xfd78d[_0x8fd2('0xe')],path[_0x8fd2('0x13')](_0xfd78d[_0x8fd2('0xe')])),Date[_0x8fd2('0x14')](),path[_0x8fd2('0x13')](_0xfd78d['originalname'])));}})});router[_0x8fd2('0x15')]('/',upload['single']('file'),controller['upload']);router[_0x8fd2('0x15')](_0x8fd2('0x16'),controller[_0x8fd2('0x17')]);router[_0x8fd2('0x18')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x19')]);router[_0x8fd2('0x1a')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x9b9b=['single','file','webhookPost','put','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname','format','basename','extname','now','post'];(function(_0x472351,_0x272e77){var _0x104310=function(_0x16b897){while(--_0x16b897){_0x472351['push'](_0x472351['shift']());}};_0x104310(++_0x272e77);}(_0x9b9b,0x114));var _0xb9b9=function(_0xcf098d,_0x1b9e69){_0xcf098d=_0xcf098d-0x0;var _0x99daff=_0x9b9b[_0xcf098d];return _0x99daff;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['show']);router['get'](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3949d0,_0x3b6bb9,_0x1122bb){_0x1122bb(null,path['join'](config[_0xb9b9('0x10')],_0xb9b9('0x11')));},'filename':function(_0xbc5a42,_0x26fa04,_0x230fea){_0x26fa04[_0xb9b9('0x12')]=_0x26fa04['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x230fea(null,util[_0xb9b9('0x13')]('%s-%s%s',path[_0xb9b9('0x14')](_0x26fa04['originalname'],path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])),Date[_0xb9b9('0x16')](),path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])));}})});router[_0xb9b9('0x17')]('/',upload[_0xb9b9('0x18')](_0xb9b9('0x19')),controller['upload']);router[_0xb9b9('0x17')]('/webhook',controller[_0xb9b9('0x1a')]);router[_0xb9b9('0x1b')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['update']);router[_0xb9b9('0x1c')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x1c')]);module[_0xb9b9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ff9c9e5..aa01da4 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 _0xc035=['script','TEXT','STRING','BOOLEAN','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0xc035,0xf2));var _0x5c03=function(_0x2186dd,_0x3d1ece){_0x2186dd=_0x2186dd-0x0;var _0x2037c2=_0xc035[_0x2186dd];return _0x2037c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5c03('0x0')]('html',_0x5c03('0x1'))},'description':{'type':Sequelize[_0x5c03('0x2')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5c03('0x3')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5c03('0x4')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5c03('0x0')]('adminOnly',_0x5c03('0x5'),_0x5c03('0x6'),_0x5c03('0x7')),'defaultValue':_0x5c03('0x6'),'comment':_0x5c03('0x8')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x5c03('0x3')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5c03('0x3')]},'scriptPath':{'type':Sequelize[_0x5c03('0x3')]}}; \ No newline at end of file +var _0xa9e1=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x160b02,_0x463382){var _0x3b92af=function(_0x59a7d2){while(--_0x59a7d2){_0x160b02['push'](_0x160b02['shift']());}};_0x3b92af(++_0x463382);}(_0xa9e1,0x1bd));var _0x1a9e=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xa9e1[_0x3b76f7];return _0x43984e;};'use strict';var Sequelize=require(_0x1a9e('0x0'));module[_0x1a9e('0x1')]={'name':{'type':Sequelize[_0x1a9e('0x2')]},'type':{'type':Sequelize[_0x1a9e('0x3')](_0x1a9e('0x4'),'script')},'description':{'type':Sequelize[_0x1a9e('0x5')]},'version':{'type':Sequelize[_0x1a9e('0x5')]},'path':{'type':Sequelize[_0x1a9e('0x2')],'comment':_0x1a9e('0x6')},'active':{'type':Sequelize[_0x1a9e('0x7')],'defaultValue':0x0,'comment':_0x1a9e('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x1a9e('0x9'),_0x1a9e('0xa'),'always',_0x1a9e('0xb')),'defaultValue':_0x1a9e('0xc'),'comment':_0x1a9e('0xd')},'icon':{'type':Sequelize[_0x1a9e('0x2')]},'adminUrl':{'type':Sequelize[_0x1a9e('0x2')]},'agentUrl':{'type':Sequelize[_0x1a9e('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index cb2d69d..a55e63a 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 _0xaab2=['querystring','papaparse','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','Plugins','UserProfileResource','then','name','status','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','catch','show','params','length','include','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x5a9596,_0x1f8dec){var _0x214e55=function(_0x5acdcc){while(--_0x5acdcc){_0x5a9596['push'](_0x5a9596['shift']());}};_0x214e55(++_0x1f8dec);}(_0xaab2,0x9c));var _0x2aab=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xaab2[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0x2aab('0x0'));var rimraf=require(_0x2aab('0x1'));var zipdir=require(_0x2aab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2aab('0x3'));var BPromise=require(_0x2aab('0x4'));var Mustache=require(_0x2aab('0x5'));var util=require(_0x2aab('0x6'));var path=require(_0x2aab('0x7'));var sox=require(_0x2aab('0x8'));var csv=require(_0x2aab('0x9'));var ejs=require(_0x2aab('0xa'));var fs=require('fs');var fs_extra=require(_0x2aab('0xb'));var _=require(_0x2aab('0xc'));var squel=require(_0x2aab('0xd'));var crypto=require(_0x2aab('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2aab('0xf'));var toCsv=require(_0x2aab('0x9'));var querystring=require(_0x2aab('0x10'));var Papa=require(_0x2aab('0x11'));var extract=require('extract-zip');var rimraf=require(_0x2aab('0x1'));var archiver=require(_0x2aab('0x12'));var Redis=require('ioredis');var authService=require(_0x2aab('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2aab('0x14'));var hardwareService=require(_0x2aab('0x15'));var logger=require(_0x2aab('0x16'))(_0x2aab('0x17'));var utils=require(_0x2aab('0x18'));var config=require(_0x2aab('0x19'));var licenseUtil=require(_0x2aab('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2aab('0x1b')]=_[_0x2aab('0x1c')](config[_0x2aab('0x1b')],{'host':_0x2aab('0x1d'),'port':0x18eb});var socket=require(_0x2aab('0x1e'))(new Redis(config[_0x2aab('0x1b')]));require(_0x2aab('0x1f'))[_0x2aab('0x20')](socket);function respondWithStatusCode(_0x4e58df,_0x5261c0){_0x5261c0=_0x5261c0||0xcc;return function(_0x1e633b){if(_0x1e633b){return _0x4e58df[_0x2aab('0x21')](_0x5261c0);}return _0x4e58df['status'](_0x5261c0)[_0x2aab('0x22')]();};}function respondWithResult(_0x200243,_0x52dc86){_0x52dc86=_0x52dc86||0xc8;return function(_0x2c2416){if(_0x2c2416){return _0x200243['status'](_0x52dc86)[_0x2aab('0x23')](_0x2c2416);}};}function respondWithFilteredResult(_0x48c9c6,_0x2a3f22){return function(_0x3917b2){if(_0x3917b2){var _0x3345b4=typeof _0x2a3f22[_0x2aab('0x24')]===_0x2aab('0x25')&&typeof _0x2a3f22[_0x2aab('0x26')]===_0x2aab('0x25');var _0x405fe4=_0x3917b2['count'];var _0x7ae2be=_0x3345b4?0x0:_0x2a3f22[_0x2aab('0x24')];var _0x11a55a=_0x3345b4?_0x3917b2[_0x2aab('0x27')]:_0x2a3f22[_0x2aab('0x24')]+_0x2a3f22['limit'];var _0x154c12;if(_0x11a55a>=_0x405fe4){_0x11a55a=_0x405fe4;_0x154c12=0xc8;}else{_0x154c12=0xce;}_0x48c9c6['status'](_0x154c12);return _0x48c9c6['set'](_0x2aab('0x28'),_0x7ae2be+'-'+_0x11a55a+'/'+_0x405fe4)[_0x2aab('0x23')](_0x3917b2);}return null;};}function patchUpdates(_0xb75ffe){return function(_0x1502f4){try{jsonpatch[_0x2aab('0x29')](_0x1502f4,_0xb75ffe,!![]);}catch(_0x3d9b69){return BPromise['reject'](_0x3d9b69);}return _0x1502f4[_0x2aab('0x2a')]();};}function saveUpdates(_0x12be25,_0x489c40){return function(_0x430972){if(_0x430972){return _0x430972[_0x2aab('0x2b')](_0x12be25)['then'](function(_0x260837){return _0x260837;});}return null;};}function removeEntity(_0x27dbd5,_0x2ef5fe){return function(_0x29e3d0){if(_0x29e3d0){return _0x29e3d0[_0x2aab('0x2c')]()['then'](function(){var _0x317fda=_0x29e3d0[_0x2aab('0x2d')]({'plain':!![]});var _0x3568bb=_0x2aab('0x2e');return db[_0x2aab('0x2f')][_0x2aab('0x2c')]({'where':{'type':_0x3568bb,'resourceId':_0x317fda['id']}})[_0x2aab('0x30')](function(){return _0x29e3d0;});})['then'](function(){_0x27dbd5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x567026,_0x1b4ebd){return function(_0xfc1e00){if(!_0xfc1e00){_0x567026[_0x2aab('0x21')](0x194);}return _0xfc1e00;};}function handleError(_0x5118dc,_0x1a03e1){_0x1a03e1=_0x1a03e1||0x1f4;return function(_0x5d1590){logger['error'](_0x5d1590['stack']);if(_0x5d1590[_0x2aab('0x31')]){delete _0x5d1590['name'];}_0x5118dc[_0x2aab('0x32')](_0x1a03e1)[_0x2aab('0x33')](_0x5d1590);};}exports[_0x2aab('0x34')]=function(_0x251677,_0x4ddb0c){var _0x36a047={},_0x51ac76={},_0x476aaf={'count':0x0,'rows':[]};var _0x304b35=_[_0x2aab('0x35')](db[_0x2aab('0x36')][_0x2aab('0x37')],function(_0x6cd9aa){return{'name':_0x6cd9aa[_0x2aab('0x38')],'type':_0x6cd9aa[_0x2aab('0x39')][_0x2aab('0x3a')]};});_0x51ac76[_0x2aab('0x3b')]=_[_0x2aab('0x35')](_0x304b35,_0x2aab('0x31'));_0x51ac76[_0x2aab('0x3c')]=_[_0x2aab('0x3d')](_0x251677[_0x2aab('0x3c')]);_0x51ac76['filters']=_[_0x2aab('0x3e')](_0x51ac76[_0x2aab('0x3b')],_0x51ac76['query']);_0x36a047['attributes']=_[_0x2aab('0x3e')](_0x51ac76[_0x2aab('0x3b')],qs['fields'](_0x251677['query'][_0x2aab('0x3f')]));_0x36a047[_0x2aab('0x40')]=_0x36a047[_0x2aab('0x40')]['length']?_0x36a047[_0x2aab('0x40')]:_0x51ac76['model'];if(!_0x251677['query'][_0x2aab('0x41')](_0x2aab('0x42'))){_0x36a047[_0x2aab('0x26')]=qs[_0x2aab('0x26')](_0x251677[_0x2aab('0x3c')]['limit']);_0x36a047[_0x2aab('0x24')]=qs['offset'](_0x251677[_0x2aab('0x3c')][_0x2aab('0x24')]);}_0x36a047[_0x2aab('0x43')]=qs[_0x2aab('0x44')](_0x251677[_0x2aab('0x3c')][_0x2aab('0x44')]);_0x36a047[_0x2aab('0x45')]=qs[_0x2aab('0x46')](_['pick'](_0x251677[_0x2aab('0x3c')],_0x51ac76[_0x2aab('0x46')]),_0x304b35);if(_0x251677['query'][_0x2aab('0x47')]){_0x36a047[_0x2aab('0x45')]=_[_0x2aab('0x48')](_0x36a047[_0x2aab('0x45')],{'$or':_['map'](_0x304b35,function(_0x5869c7){if(_0x5869c7[_0x2aab('0x39')]!==_0x2aab('0x49')){var _0x398c72={};_0x398c72[_0x5869c7[_0x2aab('0x31')]]={'$like':'%'+_0x251677[_0x2aab('0x3c')][_0x2aab('0x47')]+'%'};return _0x398c72;}})});}_0x36a047=_[_0x2aab('0x48')]({},_0x36a047,_0x251677['options']);var _0x259c1a={'where':_0x36a047[_0x2aab('0x45')]};return db[_0x2aab('0x36')][_0x2aab('0x27')](_0x259c1a)[_0x2aab('0x30')](function(_0x929b29){_0x476aaf['count']=_0x929b29;if(_0x251677['query']['includeAll']){_0x36a047['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x36a047);})['then'](function(_0x3160ed){_0x476aaf['rows']=_0x3160ed;return _0x476aaf;})[_0x2aab('0x30')](respondWithFilteredResult(_0x4ddb0c,_0x36a047))[_0x2aab('0x4a')](handleError(_0x4ddb0c,null));};exports[_0x2aab('0x4b')]=function(_0x5773dc,_0xe24cd8){var _0x5d992b={'raw':!![],'where':{'id':_0x5773dc[_0x2aab('0x4c')]['id']}},_0x215d9f={};_0x215d9f['model']=_['keys'](db[_0x2aab('0x36')][_0x2aab('0x37')]);_0x215d9f[_0x2aab('0x3c')]=_[_0x2aab('0x3d')](_0x5773dc[_0x2aab('0x3c')]);_0x215d9f[_0x2aab('0x46')]=_[_0x2aab('0x3e')](_0x215d9f[_0x2aab('0x3b')],_0x215d9f[_0x2aab('0x3c')]);_0x5d992b[_0x2aab('0x40')]=_[_0x2aab('0x3e')](_0x215d9f[_0x2aab('0x3b')],qs[_0x2aab('0x3f')](_0x5773dc[_0x2aab('0x3c')]['fields']));_0x5d992b[_0x2aab('0x40')]=_0x5d992b['attributes'][_0x2aab('0x4d')]?_0x5d992b[_0x2aab('0x40')]:_0x215d9f[_0x2aab('0x3b')];if(_0x5773dc[_0x2aab('0x3c')]['includeAll']){_0x5d992b[_0x2aab('0x4e')]=[{'all':!![]}];}_0x5d992b=_[_0x2aab('0x48')]({},_0x5d992b,_0x5773dc['options']);return db[_0x2aab('0x36')][_0x2aab('0x4f')](_0x5d992b)[_0x2aab('0x30')](handleEntityNotFound(_0xe24cd8,null))[_0x2aab('0x30')](respondWithResult(_0xe24cd8,null))[_0x2aab('0x4a')](handleError(_0xe24cd8,null));};exports[_0x2aab('0x50')]=function(_0x371e8e,_0x2ca813,_0x49ddb3){return db[_0x2aab('0x36')][_0x2aab('0x4f')]({'where':{'id':_0x371e8e[_0x2aab('0x4c')]['id']},'attributes':[_0x2aab('0x31'),_0x2aab('0x7')],'raw':!![]})[_0x2aab('0x30')](handleEntityNotFound(_0x2ca813,null))[_0x2aab('0x30')](function(_0x2fe3a6){if(_0x2fe3a6){var _0x5e4b0f=path[_0x2aab('0x51')](config[_0x2aab('0x52')],'server/files/plugins',util[_0x2aab('0x53')](_0x2aab('0x54'),path[_0x2aab('0x55')](_0x2fe3a6['path'])));var _0x90f6e7=fs[_0x2aab('0x56')](_0x5e4b0f);var _0x3ea146=archiver(_0x2aab('0x57'),{'zlib':{'level':0x9}});_0x3ea146['on']('warning',function(_0x12bb41){if(_0x12bb41[_0x2aab('0x58')]===_0x2aab('0x59')){logger[_0x2aab('0x5a')](_0x12bb41);}else{throw new db[(_0x2aab('0x5b'))][(_0x2aab('0x5c'))](_0x2aab('0x5d'));}});_0x3ea146['on']('error',function(_0x109570){throw new db[(_0x2aab('0x5b'))][(_0x2aab('0x5c'))](_0x2aab('0x5d'));});_0x3ea146[_0x2aab('0x5e')](_0x90f6e7);_0x3ea146['glob'](_0x2aab('0x5f'),{'cwd':path[_0x2aab('0x51')](config[_0x2aab('0x52')],_0x2aab('0x60'),path[_0x2aab('0x61')](_0x2fe3a6['path'])),'ignore':[path[_0x2aab('0x51')](path[_0x2aab('0x55')](_0x2fe3a6[_0x2aab('0x7')]),_0x2aab('0x62')),path[_0x2aab('0x51')](path[_0x2aab('0x55')](_0x2fe3a6[_0x2aab('0x7')]),_0x2aab('0x63'))],'nodir':!![]})[_0x2aab('0x64')]();_0x90f6e7['on'](_0x2aab('0x65'),function(){if(!fs[_0x2aab('0x66')](_0x5e4b0f)){throw new db[(_0x2aab('0x5b'))][(_0x2aab('0x5c'))](_0x2aab('0x67'));}return _0x2ca813[_0x2aab('0x50')](_0x5e4b0f,util[_0x2aab('0x53')]('%s.zip',path['basename'](_0x2fe3a6[_0x2aab('0x7')])),function(_0x2bec8b){if(_0x2bec8b){throw new db[(_0x2aab('0x5b'))][(_0x2aab('0x5c'))](_0x2aab('0x68'));}fs['unlinkSync'](_0x5e4b0f);logger[_0x2aab('0x69')](_0x2aab('0x6a'));logger[_0x2aab('0x69')](_0x2aab('0x6b'));});});}return null;})[_0x2aab('0x4a')](handleError(_0x2ca813,null));};exports[_0x2aab('0x6c')]=function(_0x486fff,_0x1897af,_0x551976){var _0x11c449=path['basename'](_0x486fff['file'][_0x2aab('0x6d')],path['extname'](_0x486fff['file'][_0x2aab('0x6d')]));var _0x29e9b2=path[_0x2aab('0x51')](config['root'],_0x2aab('0x60'),_0x486fff['file'][_0x2aab('0x6d')]);var _0x489c12=path[_0x2aab('0x51')](config[_0x2aab('0x52')],_0x2aab('0x60'),_0x11c449);logger[_0x2aab('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x29e9b2);logger[_0x2aab('0x69')](_0x2aab('0x6e'),_0x489c12);try{fs[_0x2aab('0x6f')](_0x29e9b2,parseInt(_0x2aab('0x70'),0x8));extract(_0x29e9b2,{'dir':_0x489c12},function(_0x514c73){if(_0x514c73){logger[_0x2aab('0x5a')](_0x514c73);handleError(_0x514c73,!![]);};var _0x332f7d=fs[_0x2aab('0x71')](_0x489c12);if(_0x332f7d['length']>0x1){removeReferences(_0x29e9b2,_0x489c12);logger['error'](_0x2aab('0x72'));return _0x551976(new Error(_0x2aab('0x72')));}var _0x3c0dd4=fs[_0x2aab('0x73')](path['join'](_0x489c12,_0x332f7d[0x0]));if(_0x3c0dd4[_0x2aab('0x74')]()){removeReferences(_0x29e9b2,_0x489c12);logger[_0x2aab('0x5a')](_0x2aab('0x72'));return _0x551976(new Error(_0x2aab('0x72')));}if(_0x3c0dd4[_0x2aab('0x75')]()){var _0x7ac834=fs[_0x2aab('0x71')](path['join'](_0x489c12,_0x332f7d[0x0]));if(_0x7ac834['length']===0x0){removeReferences(_0x29e9b2,_0x489c12);logger[_0x2aab('0x5a')](_0x2aab('0x72'));return _0x551976(new Error(_0x2aab('0x72')));}var _0x5cc633=_0x7ac834[_0x2aab('0x76')](function(_0x3d8be9){return _0x3d8be9===_0x2aab('0x77');});if(!_0x5cc633){return _0x551976(new Error(_0x2aab('0x78')));}var _0x3c70c3=fs['readFileSync'](path[_0x2aab('0x51')](_0x489c12,_0x332f7d[0x0],'manifest.json'));var _0x5533e7=JSON[_0x2aab('0x79')](_0x3c70c3);if('undefined'==typeof _0x5533e7['name']){return _0x551976(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x2aab('0x25')==typeof _0x5533e7[_0x2aab('0x39')]){return _0x551976(new Error(_0x2aab('0x7a')));}if(_0x2aab('0x25')==typeof _0x5533e7['version']){return _0x551976(new Error(_0x2aab('0x7b')));}if('undefined'==typeof _0x5533e7[_0x2aab('0x7c')]){return _0x551976(new Error(_0x2aab('0x7d')));}if(_0x5533e7[_0x2aab('0x39')]===_0x2aab('0x7e')){if(_0x2aab('0x25')==typeof _0x5533e7[_0x2aab('0x7c')][_0x2aab('0x7f')]){return _0x551976(new Error(_0x2aab('0x80')));}if('undefined'==typeof _0x5533e7[_0x2aab('0x7c')]['views'][_0x2aab('0x81')]&&_0x2aab('0x25')==typeof _0x5533e7['parameters'][_0x2aab('0x7f')][_0x2aab('0x82')]){return _0x551976(new Error(_0x2aab('0x83')));}}else if(_0x5533e7[_0x2aab('0x39')]===_0x2aab('0x84')){if('undefined'==typeof _0x5533e7[_0x2aab('0x7c')][_0x2aab('0x85')]){return _0x551976(new Error(_0x2aab('0x86')));}if(_0x2aab('0x25')==typeof _0x5533e7[_0x2aab('0x7c')][_0x2aab('0x87')]){return _0x551976(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x551976(new Error(_0x2aab('0x88')));}var _0x59f292=_0x5533e7[_0x2aab('0x31')];var _0x5e5cb3=_0x5533e7[_0x2aab('0x89')];var _0x4a7f55=_0x5533e7[_0x2aab('0x39')];var _0x5c7c21=_0x5533e7[_0x2aab('0x8a')]?_0x5533e7[_0x2aab('0x8a')]:_0x2aab('0x8b');var _0x57ea94=_0x5533e7[_0x2aab('0x8c')]?_0x5533e7[_0x2aab('0x8c')]:_0x2aab('0x8d');var _0x4ac296='';var _0x6041b7='';var _0x1056ec='';var _0x256272='';var _0x17c411=_0x5533e7[_0x2aab('0x8e')];if(_0x4a7f55===_0x2aab('0x7e')){if(_0x2aab('0x25')!=typeof _0x5533e7[_0x2aab('0x7c')][_0x2aab('0x7f')][_0x2aab('0x81')]){var _0x394235=_0x5533e7[_0x2aab('0x7c')][_0x2aab('0x7f')][_0x2aab('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x2aab('0x8f')](_0x394235)){_0x4ac296=path['join'](_0x2aab('0x90'),_0x11c449,_0x332f7d[0x0],_0x394235);}else{_0x4ac296=_0x394235;}}else{logger[_0x2aab('0x69')](_0x2aab('0x91'));}if(_0x2aab('0x25')!=typeof _0x5533e7['parameters'][_0x2aab('0x7f')][_0x2aab('0x82')]){var _0x5e587f=_0x5533e7[_0x2aab('0x7c')][_0x2aab('0x7f')][_0x2aab('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x2aab('0x8f')](_0x5e587f)){_0x6041b7=path[_0x2aab('0x51')]('plugins',_0x11c449,_0x332f7d[0x0],_0x5e587f);}else{_0x6041b7=_0x5e587f;}}else{logger[_0x2aab('0x69')](_0x2aab('0x92'));}}else if(_0x4a7f55===_0x2aab('0x84')){_0x1056ec=_0x5533e7[_0x2aab('0x7c')][_0x2aab('0x85')];_0x256272=_0x5533e7[_0x2aab('0x7c')][_0x2aab('0x87')];if('undefined'!=typeof _0x5533e7[_0x2aab('0x7c')]['views']){if(_0x2aab('0x25')!=typeof _0x5533e7[_0x2aab('0x7c')]['views']['admin']){var _0x394235=_0x5533e7['parameters'][_0x2aab('0x7f')][_0x2aab('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x2aab('0x8f')](_0x394235)){_0x4ac296=path[_0x2aab('0x51')](_0x2aab('0x90'),_0x11c449,_0x332f7d[0x0],_0x394235);}else{_0x4ac296=_0x394235;}}if(_0x2aab('0x25')!=typeof _0x5533e7[_0x2aab('0x7c')]['views'][_0x2aab('0x82')]){var _0x5e587f=_0x5533e7[_0x2aab('0x7c')][_0x2aab('0x7f')][_0x2aab('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x2aab('0x8f')](_0x5e587f)){_0x6041b7=path[_0x2aab('0x51')](_0x2aab('0x90'),_0x11c449,_0x332f7d[0x0],_0x5e587f);}else{_0x6041b7=_0x5e587f;}}}}var _0x3e1d2e={'name':_0x59f292,'description':_0x5e5cb3,'path':path[_0x2aab('0x51')](_0x11c449,_0x332f7d[0x0]),'type':_0x4a7f55,'sidebar':_0x5c7c21,'icon':_0x57ea94,'adminUrl':_0x4ac296,'agentUrl':_0x6041b7,'scriptName':_0x1056ec,'scriptPath':_0x256272,'version':_0x17c411};removeReferences(_0x29e9b2,null);return db['Plugin'][_0x2aab('0x93')](_0x3e1d2e)[_0x2aab('0x30')](function(_0x4506b6){var _0x58836a={'role':_0x486fff[_0x2aab('0x94')][_0x2aab('0x95')],'userProfileId':_0x486fff[_0x2aab('0x94')][_0x2aab('0x96')]};if(!_0x58836a)throw new Error(_0x2aab('0x97'));if(_0x58836a[_0x2aab('0x95')]==='user'){var _0x5d33c2=_0x4506b6[_0x2aab('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0x2aab('0x4f')]({'where':{'name':_0x2aab('0x2e'),'userProfileId':_0x58836a['userProfileId']},'raw':!![]})[_0x2aab('0x30')](function(_0x54e795){if(_0x54e795&&_0x54e795['autoAssociation']===0x0){return db[_0x2aab('0x2f')]['create']({'name':_0x5d33c2[_0x2aab('0x31')],'resourceId':_0x5d33c2['id'],'type':_0x54e795[_0x2aab('0x31')],'sectionId':_0x54e795['id']},{})[_0x2aab('0x30')](function(){return _0x4506b6;});}else{return _0x4506b6;}})['catch'](function(_0x232927){logger[_0x2aab('0x5a')](_0x2aab('0x98'),_0x232927);throw _0x232927;});}return _0x4506b6;})[_0x2aab('0x30')](respondWithResult(_0x1897af,null))[_0x2aab('0x4a')](handleError(_0x1897af,null));}});}catch(_0x384872){_0x1897af[_0x2aab('0x32')](0x1f4)[_0x2aab('0x33')](_0x384872);}};function removeReferences(_0x3a6200,_0x409f5c){try{if(_0x3a6200){fs[_0x2aab('0x99')](_0x3a6200);logger[_0x2aab('0x69')](_0x2aab('0x9a'));}if(_0x409f5c){rimraf(_0x409f5c,function(){});logger[_0x2aab('0x69')](_0x2aab('0x9b'));}}catch(_0x3e3f33){logger[_0x2aab('0x5a')](_0x3e3f33);}}exports[_0x2aab('0x2b')]=function(_0x37f5a7,_0x1840c6,_0x4f61de){return db[_0x2aab('0x36')][_0x2aab('0x4f')]({'where':{'id':_0x37f5a7[_0x2aab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1840c6,null))[_0x2aab('0x30')](saveUpdates(_0x37f5a7[_0x2aab('0x94')],null))[_0x2aab('0x30')](respondWithResult(_0x1840c6,null))[_0x2aab('0x4a')](handleError(_0x1840c6,null));};exports['delete']=function(_0x16123f,_0x2f9265,_0x35a51e){return db[_0x2aab('0x36')][_0x2aab('0x4f')]({'where':{'id':_0x16123f[_0x2aab('0x4c')]['id']}})[_0x2aab('0x30')](function(_0x4feb63){if(_0x4feb63){return _0x4feb63['destroy']();}})[_0x2aab('0x30')](function(_0x507380){rimraf(path[_0x2aab('0x51')](config[_0x2aab('0x52')],_0x2aab('0x60'),path[_0x2aab('0x61')](_0x507380['path'])),function(){});return _0x507380;})['then'](handleEntityNotFound(_0x2f9265,null))[_0x2aab('0x30')](respondWithStatusCode(_0x2f9265,null))[_0x2aab('0x4a')](handleError(_0x2f9265,null));};exports['webhookGet']=function(_0x285f10,_0x46af88,_0x49dbe6){return BPromise[_0x2aab('0x9c')]()[_0x2aab('0x30')](function(){if(!_0x285f10['query'][_0x2aab('0x7')]){throw new Error(_0x2aab('0x9d'));}if(!_0x285f10[_0x2aab('0x3c')][_0x2aab('0x9e')]){throw new Error(_0x2aab('0x9f'));}var _0x48c250=_0x285f10[_0x2aab('0x3c')][_0x2aab('0xa0')]?_0x285f10[_0x2aab('0x3c')][_0x2aab('0xa0')]+':'+_0x285f10[_0x2aab('0x3c')][_0x2aab('0x9e')]:_0x2aab('0xa1')+_0x285f10[_0x2aab('0x3c')][_0x2aab('0x9e')];var _0x109555=_0x285f10[_0x2aab('0x3c')][_0x2aab('0x23')]?_0x285f10[_0x2aab('0x3c')][_0x2aab('0x23')]:!![];var _0x66209b=_0x285f10[_0x2aab('0x3c')][_0x2aab('0xa2')]?_0x285f10[_0x2aab('0x3c')][_0x2aab('0xa2')]:null;var _0xdf2f56={'method':_0x285f10[_0x2aab('0xa3')],'uri':util[_0x2aab('0x53')](_0x2aab('0xa4'),_0x48c250,_0x285f10[_0x2aab('0x3c')][_0x2aab('0x7')]),'json':_0x109555,'resolveWithFullResponse':!![],'encoding':_0x66209b,'qs':_0x285f10[_0x2aab('0x3c')]};if(_0x285f10['headers']){_0xdf2f56['headers']=_0x285f10[_0x2aab('0xa5')];if(_0xdf2f56['headers'][_0x2aab('0xa6')]){delete _0xdf2f56[_0x2aab('0xa5')][_0x2aab('0xa6')];}}if(_0xdf2f56[_0x2aab('0xa5')][_0x2aab('0xa7')]){delete _0xdf2f56['headers'][_0x2aab('0xa7')];}return rp(_0xdf2f56);})[_0x2aab('0x30')](function(_0x2ce9a5){if(_0x2ce9a5){_0x46af88[_0x2aab('0xa8')](_0x2ce9a5[_0x2aab('0xa5')]);logger[_0x2aab('0x69')](_0x2ce9a5[_0x2aab('0x94')]);if(_[_0x2aab('0xa9')](_0x285f10['query'][_0x2aab('0x7')],_0x2aab('0x50'))&&_0x2ce9a5['statusCode']==0x1f4){return _0x46af88[_0x2aab('0x21')](_0x2ce9a5[_0x2aab('0xaa')]);}else{return _0x46af88[_0x2aab('0x32')](_0x2ce9a5[_0x2aab('0xaa')])[_0x2aab('0x33')](_0x2ce9a5[_0x2aab('0x94')]);}}else{return _0x46af88[_0x2aab('0x21')](0xc8);}})['catch'](handleError(_0x46af88,null));};exports[_0x2aab('0xab')]=function(_0x1a8621,_0x49acbe,_0x13885a){return BPromise[_0x2aab('0x9c')]()[_0x2aab('0x30')](function(){if(!_0x1a8621[_0x2aab('0x3c')]['path']){throw new Error(_0x2aab('0x9d'));}if(!_0x1a8621['query'][_0x2aab('0x9e')]){throw new Error(_0x2aab('0x9f'));}var _0x4afed7=_0x1a8621['query']['hostname']?_0x1a8621[_0x2aab('0x3c')][_0x2aab('0xa0')]+':'+_0x1a8621[_0x2aab('0x3c')][_0x2aab('0x9e')]:'http://localhost:'+_0x1a8621[_0x2aab('0x3c')][_0x2aab('0x9e')];var _0x46b1ad=_0x1a8621[_0x2aab('0x3c')][_0x2aab('0x23')]?_0x1a8621[_0x2aab('0x3c')]['json']:!![];var _0x134f07=_0x1a8621[_0x2aab('0x3c')][_0x2aab('0xa2')]?_0x1a8621[_0x2aab('0x3c')][_0x2aab('0xa2')]:null;var _0x3a63af={'method':_0x1a8621[_0x2aab('0xa3')],'uri':util[_0x2aab('0x53')](_0x2aab('0xa4'),_0x4afed7,_0x1a8621[_0x2aab('0x3c')][_0x2aab('0x7')]),'json':_0x46b1ad,'resolveWithFullResponse':!![],'encoding':_0x134f07,'body':_0x1a8621[_0x2aab('0x94')]};if(_0x1a8621[_0x2aab('0xa5')]){_0x3a63af['headers']=_0x1a8621[_0x2aab('0xa5')];if(_0x3a63af[_0x2aab('0xa5')]['content-length']){delete _0x3a63af[_0x2aab('0xa5')][_0x2aab('0xa6')];}}if(_0x3a63af[_0x2aab('0xa5')][_0x2aab('0xa7')]){delete _0x3a63af[_0x2aab('0xa5')][_0x2aab('0xa7')];}return rp(_0x3a63af);})[_0x2aab('0x30')](function(_0x2c9644){if(_0x2c9644){_0x49acbe['set'](_0x2c9644[_0x2aab('0xa5')]);logger['info'](_0x2c9644[_0x2aab('0x94')]);return _0x49acbe[_0x2aab('0x32')](_0x2c9644['statusCode'])[_0x2aab('0x33')](_0x2c9644['body']);}else{return _0x49acbe[_0x2aab('0x21')](0xc8);}})['catch'](handleError(_0x49acbe,null));}; \ No newline at end of file +var _0xbcc3=['reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','find','download','path','join','server/files/plugins','format','%s.zip','basename','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','root','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','end','status','json','undefined','count','offset','set','Content-Range','apply'];(function(_0x36598b,_0x49b978){var _0x26ddb7=function(_0x547c34){while(--_0x547c34){_0x36598b['push'](_0x36598b['shift']());}};_0x26ddb7(++_0x49b978);}(_0xbcc3,0x127));var _0x3bcc=function(_0x1b98b4,_0xb1826a){_0x1b98b4=_0x1b98b4-0x0;var _0x448bb3=_0xbcc3[_0x1b98b4];return _0x448bb3;};'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('request-promise');var moment=require(_0x3bcc('0x0'));var BPromise=require(_0x3bcc('0x1'));var Mustache=require(_0x3bcc('0x2'));var util=require(_0x3bcc('0x3'));var path=require('path');var sox=require(_0x3bcc('0x4'));var csv=require(_0x3bcc('0x5'));var ejs=require(_0x3bcc('0x6'));var fs=require('fs');var fs_extra=require(_0x3bcc('0x7'));var _=require(_0x3bcc('0x8'));var squel=require(_0x3bcc('0x9'));var crypto=require(_0x3bcc('0xa'));var jsforce=require(_0x3bcc('0xb'));var deskjs=require(_0x3bcc('0xc'));var toCsv=require(_0x3bcc('0x5'));var querystring=require(_0x3bcc('0xd'));var Papa=require(_0x3bcc('0xe'));var extract=require(_0x3bcc('0xf'));var rimraf=require(_0x3bcc('0x10'));var archiver=require(_0x3bcc('0x11'));var Redis=require(_0x3bcc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3bcc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bcc('0x14'));var logger=require(_0x3bcc('0x15'))(_0x3bcc('0x16'));var utils=require(_0x3bcc('0x17'));var config=require(_0x3bcc('0x18'));var licenseUtil=require(_0x3bcc('0x19'));var db=require('../../mysqldb')['db'];config[_0x3bcc('0x1a')]=_['defaults'](config[_0x3bcc('0x1a')],{'host':_0x3bcc('0x1b'),'port':0x18eb});var socket=require(_0x3bcc('0x1c'))(new Redis(config['redis']));require('./plugin.socket')[_0x3bcc('0x1d')](socket);function respondWithStatusCode(_0x3fce17,_0xddf840){_0xddf840=_0xddf840||0xcc;return function(_0x180b0d){if(_0x180b0d){return _0x3fce17['sendStatus'](_0xddf840);}return _0x3fce17['status'](_0xddf840)[_0x3bcc('0x1e')]();};}function respondWithResult(_0x5ceb1a,_0x14e2ec){_0x14e2ec=_0x14e2ec||0xc8;return function(_0x5727ef){if(_0x5727ef){return _0x5ceb1a[_0x3bcc('0x1f')](_0x14e2ec)[_0x3bcc('0x20')](_0x5727ef);}};}function respondWithFilteredResult(_0x133bd1,_0x1db277){return function(_0x3679a8){if(_0x3679a8){var _0x193480=typeof _0x1db277['offset']===_0x3bcc('0x21')&&typeof _0x1db277['limit']===_0x3bcc('0x21');var _0x3f95c4=_0x3679a8[_0x3bcc('0x22')];var _0x313f7d=_0x193480?0x0:_0x1db277[_0x3bcc('0x23')];var _0x1df7f4=_0x193480?_0x3679a8[_0x3bcc('0x22')]:_0x1db277[_0x3bcc('0x23')]+_0x1db277['limit'];var _0x4e7c6d;if(_0x1df7f4>=_0x3f95c4){_0x1df7f4=_0x3f95c4;_0x4e7c6d=0xc8;}else{_0x4e7c6d=0xce;}_0x133bd1[_0x3bcc('0x1f')](_0x4e7c6d);return _0x133bd1[_0x3bcc('0x24')](_0x3bcc('0x25'),_0x313f7d+'-'+_0x1df7f4+'/'+_0x3f95c4)[_0x3bcc('0x20')](_0x3679a8);}return null;};}function patchUpdates(_0x3b92d3){return function(_0x45b917){try{jsonpatch[_0x3bcc('0x26')](_0x45b917,_0x3b92d3,!![]);}catch(_0x39f104){return BPromise[_0x3bcc('0x27')](_0x39f104);}return _0x45b917[_0x3bcc('0x28')]();};}function saveUpdates(_0x534a20,_0x4b4b4e){return function(_0x20a861){if(_0x20a861){return _0x20a861[_0x3bcc('0x29')](_0x534a20)[_0x3bcc('0x2a')](function(_0xbb52b7){return _0xbb52b7;});}return null;};}function removeEntity(_0x400675,_0x2c4184){return function(_0x40636c){if(_0x40636c){return _0x40636c[_0x3bcc('0x2b')]()[_0x3bcc('0x2a')](function(){var _0x259a83=_0x40636c[_0x3bcc('0x2c')]({'plain':!![]});var _0x2ce06b=_0x3bcc('0x2d');return db[_0x3bcc('0x2e')][_0x3bcc('0x2b')]({'where':{'type':_0x2ce06b,'resourceId':_0x259a83['id']}})[_0x3bcc('0x2a')](function(){return _0x40636c;});})[_0x3bcc('0x2a')](function(){_0x400675['status'](0xcc)[_0x3bcc('0x1e')]();});}};}function handleEntityNotFound(_0x47a034,_0x2f32df){return function(_0x46bb35){if(!_0x46bb35){_0x47a034[_0x3bcc('0x2f')](0x194);}return _0x46bb35;};}function handleError(_0x329a48,_0x1960a4){_0x1960a4=_0x1960a4||0x1f4;return function(_0x5707f4){logger['error'](_0x5707f4[_0x3bcc('0x30')]);if(_0x5707f4[_0x3bcc('0x31')]){delete _0x5707f4[_0x3bcc('0x31')];}_0x329a48[_0x3bcc('0x1f')](_0x1960a4)[_0x3bcc('0x32')](_0x5707f4);};}exports[_0x3bcc('0x33')]=function(_0x1cddd8,_0x3ec1d5){var _0x42e19c={},_0x2ee9c2={},_0x49503d={'count':0x0,'rows':[]};var _0x2d48aa=_[_0x3bcc('0x34')](db[_0x3bcc('0x35')][_0x3bcc('0x36')],function(_0x60dbb9){return{'name':_0x60dbb9[_0x3bcc('0x37')],'type':_0x60dbb9[_0x3bcc('0x38')]['key']};});_0x2ee9c2[_0x3bcc('0x39')]=_[_0x3bcc('0x34')](_0x2d48aa,'name');_0x2ee9c2[_0x3bcc('0x3a')]=_[_0x3bcc('0x3b')](_0x1cddd8[_0x3bcc('0x3a')]);_0x2ee9c2[_0x3bcc('0x3c')]=_['intersection'](_0x2ee9c2[_0x3bcc('0x39')],_0x2ee9c2[_0x3bcc('0x3a')]);_0x42e19c[_0x3bcc('0x3d')]=_[_0x3bcc('0x3e')](_0x2ee9c2[_0x3bcc('0x39')],qs['fields'](_0x1cddd8['query']['fields']));_0x42e19c[_0x3bcc('0x3d')]=_0x42e19c[_0x3bcc('0x3d')][_0x3bcc('0x3f')]?_0x42e19c[_0x3bcc('0x3d')]:_0x2ee9c2[_0x3bcc('0x39')];if(!_0x1cddd8[_0x3bcc('0x3a')][_0x3bcc('0x40')](_0x3bcc('0x41'))){_0x42e19c[_0x3bcc('0x42')]=qs[_0x3bcc('0x42')](_0x1cddd8[_0x3bcc('0x3a')][_0x3bcc('0x42')]);_0x42e19c['offset']=qs[_0x3bcc('0x23')](_0x1cddd8['query'][_0x3bcc('0x23')]);}_0x42e19c[_0x3bcc('0x43')]=qs[_0x3bcc('0x44')](_0x1cddd8[_0x3bcc('0x3a')]['sort']);_0x42e19c[_0x3bcc('0x45')]=qs[_0x3bcc('0x3c')](_[_0x3bcc('0x46')](_0x1cddd8['query'],_0x2ee9c2[_0x3bcc('0x3c')]),_0x2d48aa);if(_0x1cddd8[_0x3bcc('0x3a')][_0x3bcc('0x47')]){_0x42e19c['where']=_[_0x3bcc('0x48')](_0x42e19c['where'],{'$or':_[_0x3bcc('0x34')](_0x2d48aa,function(_0x1797c5){if(_0x1797c5[_0x3bcc('0x38')]!==_0x3bcc('0x49')){var _0x4f7d3a={};_0x4f7d3a[_0x1797c5['name']]={'$like':'%'+_0x1cddd8[_0x3bcc('0x3a')][_0x3bcc('0x47')]+'%'};return _0x4f7d3a;}})});}_0x42e19c=_[_0x3bcc('0x48')]({},_0x42e19c,_0x1cddd8[_0x3bcc('0x4a')]);var _0x1ee981={'where':_0x42e19c[_0x3bcc('0x45')]};return db[_0x3bcc('0x35')][_0x3bcc('0x22')](_0x1ee981)[_0x3bcc('0x2a')](function(_0x5f42dd){_0x49503d[_0x3bcc('0x22')]=_0x5f42dd;if(_0x1cddd8[_0x3bcc('0x3a')]['includeAll']){_0x42e19c[_0x3bcc('0x4b')]=[{'all':!![]}];}return db[_0x3bcc('0x35')][_0x3bcc('0x4c')](_0x42e19c);})['then'](function(_0x25e295){_0x49503d['rows']=_0x25e295;return _0x49503d;})[_0x3bcc('0x2a')](respondWithFilteredResult(_0x3ec1d5,_0x42e19c))[_0x3bcc('0x4d')](handleError(_0x3ec1d5,null));};exports[_0x3bcc('0x4e')]=function(_0x1e355c,_0x3b5e9f){var _0x5bfd69={'raw':!![],'where':{'id':_0x1e355c[_0x3bcc('0x4f')]['id']}},_0x7ddb26={};_0x7ddb26[_0x3bcc('0x39')]=_['keys'](db['Plugin'][_0x3bcc('0x36')]);_0x7ddb26[_0x3bcc('0x3a')]=_[_0x3bcc('0x3b')](_0x1e355c[_0x3bcc('0x3a')]);_0x7ddb26[_0x3bcc('0x3c')]=_[_0x3bcc('0x3e')](_0x7ddb26[_0x3bcc('0x39')],_0x7ddb26[_0x3bcc('0x3a')]);_0x5bfd69[_0x3bcc('0x3d')]=_[_0x3bcc('0x3e')](_0x7ddb26[_0x3bcc('0x39')],qs[_0x3bcc('0x50')](_0x1e355c[_0x3bcc('0x3a')][_0x3bcc('0x50')]));_0x5bfd69[_0x3bcc('0x3d')]=_0x5bfd69[_0x3bcc('0x3d')]['length']?_0x5bfd69[_0x3bcc('0x3d')]:_0x7ddb26[_0x3bcc('0x39')];if(_0x1e355c['query'][_0x3bcc('0x51')]){_0x5bfd69[_0x3bcc('0x4b')]=[{'all':!![]}];}_0x5bfd69=_['merge']({},_0x5bfd69,_0x1e355c[_0x3bcc('0x4a')]);return db['Plugin'][_0x3bcc('0x52')](_0x5bfd69)[_0x3bcc('0x2a')](handleEntityNotFound(_0x3b5e9f,null))[_0x3bcc('0x2a')](respondWithResult(_0x3b5e9f,null))[_0x3bcc('0x4d')](handleError(_0x3b5e9f,null));};exports[_0x3bcc('0x53')]=function(_0x4d9364,_0x32b203,_0x582b8d){return db[_0x3bcc('0x35')][_0x3bcc('0x52')]({'where':{'id':_0x4d9364[_0x3bcc('0x4f')]['id']},'attributes':[_0x3bcc('0x31'),_0x3bcc('0x54')],'raw':!![]})[_0x3bcc('0x2a')](handleEntityNotFound(_0x32b203,null))[_0x3bcc('0x2a')](function(_0x30a9ef){if(_0x30a9ef){var _0xd8e886=path[_0x3bcc('0x55')](config['root'],_0x3bcc('0x56'),util[_0x3bcc('0x57')](_0x3bcc('0x58'),path[_0x3bcc('0x59')](_0x30a9ef[_0x3bcc('0x54')])));var _0x17d622=fs['createWriteStream'](_0xd8e886);var _0x5977ff=archiver('zip',{'zlib':{'level':0x9}});_0x5977ff['on'](_0x3bcc('0x5a'),function(_0xa2f463){if(_0xa2f463[_0x3bcc('0x5b')]==='ENOENT'){logger[_0x3bcc('0x5c')](_0xa2f463);}else{throw new db[(_0x3bcc('0x5d'))][(_0x3bcc('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5977ff['on'](_0x3bcc('0x5c'),function(_0x16822b){throw new db[(_0x3bcc('0x5d'))][(_0x3bcc('0x5e'))](_0x3bcc('0x5f'));});_0x5977ff[_0x3bcc('0x60')](_0x17d622);_0x5977ff[_0x3bcc('0x61')]('**/*',{'cwd':path['join'](config[_0x3bcc('0x62')],_0x3bcc('0x56'),path[_0x3bcc('0x63')](_0x30a9ef[_0x3bcc('0x54')])),'ignore':[path[_0x3bcc('0x55')](path['basename'](_0x30a9ef[_0x3bcc('0x54')]),_0x3bcc('0x64')),path[_0x3bcc('0x55')](path[_0x3bcc('0x59')](_0x30a9ef[_0x3bcc('0x54')]),_0x3bcc('0x65'))],'nodir':!![]})['finalize']();_0x17d622['on'](_0x3bcc('0x66'),function(){if(!fs[_0x3bcc('0x67')](_0xd8e886)){throw new db[(_0x3bcc('0x5d'))][(_0x3bcc('0x5e'))](_0x3bcc('0x68'));}return _0x32b203[_0x3bcc('0x53')](_0xd8e886,util[_0x3bcc('0x57')]('%s.zip',path[_0x3bcc('0x59')](_0x30a9ef[_0x3bcc('0x54')])),function(_0x4e2b93){if(_0x4e2b93){throw new db[(_0x3bcc('0x5d'))][(_0x3bcc('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x3bcc('0x69')](_0xd8e886);logger[_0x3bcc('0x6a')]('Download\x20completed');logger[_0x3bcc('0x6a')]('Temporary\x20file\x20removed');});});}return null;})[_0x3bcc('0x4d')](handleError(_0x32b203,null));};exports[_0x3bcc('0x6b')]=function(_0x149f9d,_0x5cd8b8,_0x3c6710){var _0xe6149f=path[_0x3bcc('0x59')](_0x149f9d[_0x3bcc('0x6c')][_0x3bcc('0x6d')],path[_0x3bcc('0x6e')](_0x149f9d[_0x3bcc('0x6c')]['filename']));var _0xfc1c86=path[_0x3bcc('0x55')](config['root'],_0x3bcc('0x56'),_0x149f9d[_0x3bcc('0x6c')]['filename']);var _0x237121=path[_0x3bcc('0x55')](config['root'],'server/files/plugins',_0xe6149f);logger[_0x3bcc('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0xfc1c86);logger[_0x3bcc('0x6a')](_0x3bcc('0x6f'),_0x237121);try{fs[_0x3bcc('0x70')](_0xfc1c86,parseInt(_0x3bcc('0x71'),0x8));extract(_0xfc1c86,{'dir':_0x237121},function(_0x2e3b7b){if(_0x2e3b7b){logger[_0x3bcc('0x5c')](_0x2e3b7b);handleError(_0x2e3b7b,!![]);};var _0x3c5b90=fs['readdirSync'](_0x237121);if(_0x3c5b90[_0x3bcc('0x3f')]>0x1){removeReferences(_0xfc1c86,_0x237121);logger['error'](_0x3bcc('0x72'));return _0x3c6710(new Error(_0x3bcc('0x72')));}var _0x3783ab=fs[_0x3bcc('0x73')](path[_0x3bcc('0x55')](_0x237121,_0x3c5b90[0x0]));if(_0x3783ab[_0x3bcc('0x74')]()){removeReferences(_0xfc1c86,_0x237121);logger['error'](_0x3bcc('0x72'));return _0x3c6710(new Error(_0x3bcc('0x72')));}if(_0x3783ab['isDirectory']()){var _0x37e0dc=fs[_0x3bcc('0x75')](path['join'](_0x237121,_0x3c5b90[0x0]));if(_0x37e0dc[_0x3bcc('0x3f')]===0x0){removeReferences(_0xfc1c86,_0x237121);logger['error'](_0x3bcc('0x72'));return _0x3c6710(new Error('Invalid\x20plugin\x20structure'));}var _0x22c135=_0x37e0dc[_0x3bcc('0x76')](function(_0x2ffff3){return _0x2ffff3===_0x3bcc('0x77');});if(!_0x22c135){return _0x3c6710(new Error(_0x3bcc('0x78')));}var _0x120ed0=fs[_0x3bcc('0x79')](path[_0x3bcc('0x55')](_0x237121,_0x3c5b90[0x0],_0x3bcc('0x77')));var _0x12864c=JSON['parse'](_0x120ed0);if('undefined'==typeof _0x12864c[_0x3bcc('0x31')]){return _0x3c6710(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x12864c[_0x3bcc('0x38')]){return _0x3c6710(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x3bcc('0x21')==typeof _0x12864c[_0x3bcc('0x7a')]){return _0x3c6710(new Error(_0x3bcc('0x7b')));}if(_0x3bcc('0x21')==typeof _0x12864c[_0x3bcc('0x7c')]){return _0x3c6710(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x12864c[_0x3bcc('0x38')]===_0x3bcc('0x7d')){if(_0x3bcc('0x21')==typeof _0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')]){return _0x3c6710(new Error(_0x3bcc('0x7f')));}if(_0x3bcc('0x21')==typeof _0x12864c['parameters'][_0x3bcc('0x7e')][_0x3bcc('0x80')]&&'undefined'==typeof _0x12864c['parameters'][_0x3bcc('0x7e')]['agent']){return _0x3c6710(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x12864c[_0x3bcc('0x38')]===_0x3bcc('0x81')){if(_0x3bcc('0x21')==typeof _0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x82')]){return _0x3c6710(new Error(_0x3bcc('0x83')));}if('undefined'==typeof _0x12864c['parameters'][_0x3bcc('0x84')]){return _0x3c6710(new Error(_0x3bcc('0x85')));}}else{return _0x3c6710(new Error(_0x3bcc('0x86')));}var _0x4fbe69=_0x12864c[_0x3bcc('0x31')];var _0x4625fa=_0x12864c[_0x3bcc('0x87')];var _0x4dc722=_0x12864c[_0x3bcc('0x38')];var _0x47ec58=_0x12864c[_0x3bcc('0x88')]?_0x12864c[_0x3bcc('0x88')]:'always';var _0x3decdc=_0x12864c[_0x3bcc('0x89')]?_0x12864c['icon']:_0x3bcc('0x8a');var _0x55f6c6='';var _0x1013c3='';var _0x28018f='';var _0x27fb61='';var _0x369173=_0x12864c[_0x3bcc('0x7a')];if(_0x4dc722===_0x3bcc('0x7d')){if('undefined'!=typeof _0x12864c[_0x3bcc('0x7c')]['views'][_0x3bcc('0x80')]){var _0x5b1e2d=_0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3bcc('0x8b')](_0x5b1e2d)){_0x55f6c6=path[_0x3bcc('0x55')](_0x3bcc('0x8c'),_0xe6149f,_0x3c5b90[0x0],_0x5b1e2d);}else{_0x55f6c6=_0x5b1e2d;}}else{logger[_0x3bcc('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x3bcc('0x21')!=typeof _0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')][_0x3bcc('0x8d')]){var _0x21d4a0=_0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')][_0x3bcc('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x3bcc('0x8b')](_0x21d4a0)){_0x1013c3=path['join'](_0x3bcc('0x8c'),_0xe6149f,_0x3c5b90[0x0],_0x21d4a0);}else{_0x1013c3=_0x21d4a0;}}else{logger[_0x3bcc('0x6a')](_0x3bcc('0x8e'));}}else if(_0x4dc722===_0x3bcc('0x81')){_0x28018f=_0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x82')];_0x27fb61=_0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x84')];if('undefined'!=typeof _0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')]){if(_0x3bcc('0x21')!=typeof _0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')][_0x3bcc('0x80')]){var _0x5b1e2d=_0x12864c[_0x3bcc('0x7c')]['views'][_0x3bcc('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x3bcc('0x8b')](_0x5b1e2d)){_0x55f6c6=path['join'](_0x3bcc('0x8c'),_0xe6149f,_0x3c5b90[0x0],_0x5b1e2d);}else{_0x55f6c6=_0x5b1e2d;}}if('undefined'!=typeof _0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')]['agent']){var _0x21d4a0=_0x12864c[_0x3bcc('0x7c')][_0x3bcc('0x7e')][_0x3bcc('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x3bcc('0x8b')](_0x21d4a0)){_0x1013c3=path[_0x3bcc('0x55')](_0x3bcc('0x8c'),_0xe6149f,_0x3c5b90[0x0],_0x21d4a0);}else{_0x1013c3=_0x21d4a0;}}}}var _0x50437e={'name':_0x4fbe69,'description':_0x4625fa,'path':path[_0x3bcc('0x55')](_0xe6149f,_0x3c5b90[0x0]),'type':_0x4dc722,'sidebar':_0x47ec58,'icon':_0x3decdc,'adminUrl':_0x55f6c6,'agentUrl':_0x1013c3,'scriptName':_0x28018f,'scriptPath':_0x27fb61,'version':_0x369173};removeReferences(_0xfc1c86,null);return db[_0x3bcc('0x35')]['create'](_0x50437e)[_0x3bcc('0x2a')](function(_0x305f07){var _0x2bbdce={'role':_0x149f9d[_0x3bcc('0x8f')]['role'],'userProfileId':_0x149f9d[_0x3bcc('0x8f')]['userProfileId']};if(!_0x2bbdce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bbdce[_0x3bcc('0x90')]===_0x3bcc('0x91')){var _0x45bcad=_0x305f07[_0x3bcc('0x2c')]({'plain':!![]});return db[_0x3bcc('0x92')][_0x3bcc('0x52')]({'where':{'name':'Plugins','userProfileId':_0x2bbdce[_0x3bcc('0x93')]},'raw':!![]})[_0x3bcc('0x2a')](function(_0x50508c){if(_0x50508c&&_0x50508c['autoAssociation']===0x0){return db['UserProfileResource'][_0x3bcc('0x94')]({'name':_0x45bcad[_0x3bcc('0x31')],'resourceId':_0x45bcad['id'],'type':_0x50508c[_0x3bcc('0x31')],'sectionId':_0x50508c['id']},{})[_0x3bcc('0x2a')](function(){return _0x305f07;});}else{return _0x305f07;}})[_0x3bcc('0x4d')](function(_0x2e2dab){logger[_0x3bcc('0x5c')](_0x3bcc('0x95'),_0x2e2dab);throw _0x2e2dab;});}return _0x305f07;})['then'](respondWithResult(_0x5cd8b8,null))[_0x3bcc('0x4d')](handleError(_0x5cd8b8,null));}});}catch(_0x35ebd0){_0x5cd8b8[_0x3bcc('0x1f')](0x1f4)[_0x3bcc('0x32')](_0x35ebd0);}};function removeReferences(_0x326174,_0x2d84d3){try{if(_0x326174){fs[_0x3bcc('0x69')](_0x326174);logger[_0x3bcc('0x6a')]('Zip\x20archive\x20removed');}if(_0x2d84d3){rimraf(_0x2d84d3,function(){});logger[_0x3bcc('0x6a')](_0x3bcc('0x96'));}}catch(_0x52ba71){logger[_0x3bcc('0x5c')](_0x52ba71);}}exports[_0x3bcc('0x29')]=function(_0x4a532e,_0x143972,_0x4ed04c){return db[_0x3bcc('0x35')]['find']({'where':{'id':_0x4a532e[_0x3bcc('0x4f')]['id']}})[_0x3bcc('0x2a')](handleEntityNotFound(_0x143972,null))[_0x3bcc('0x2a')](saveUpdates(_0x4a532e[_0x3bcc('0x8f')],null))[_0x3bcc('0x2a')](respondWithResult(_0x143972,null))[_0x3bcc('0x4d')](handleError(_0x143972,null));};exports[_0x3bcc('0x97')]=function(_0x1c5444,_0xa05cde,_0x56a443){return db[_0x3bcc('0x35')][_0x3bcc('0x52')]({'where':{'id':_0x1c5444['params']['id']}})[_0x3bcc('0x2a')](function(_0x2fac8){if(_0x2fac8){return _0x2fac8[_0x3bcc('0x2b')]();}})[_0x3bcc('0x2a')](function(_0x23771f){rimraf(path[_0x3bcc('0x55')](config[_0x3bcc('0x62')],_0x3bcc('0x56'),path[_0x3bcc('0x63')](_0x23771f[_0x3bcc('0x54')])),function(){});return _0x23771f;})[_0x3bcc('0x2a')](handleEntityNotFound(_0xa05cde,null))[_0x3bcc('0x2a')](respondWithStatusCode(_0xa05cde,null))[_0x3bcc('0x4d')](handleError(_0xa05cde,null));};exports['webhookGet']=function(_0x2081d5,_0x16e752,_0x2d1eab){return BPromise[_0x3bcc('0x98')]()[_0x3bcc('0x2a')](function(){if(!_0x2081d5['query'][_0x3bcc('0x54')]){throw new Error(_0x3bcc('0x99'));}if(!_0x2081d5[_0x3bcc('0x3a')][_0x3bcc('0x9a')]){throw new Error(_0x3bcc('0x9b'));}var _0x3b1df9=_0x2081d5[_0x3bcc('0x3a')][_0x3bcc('0x9c')]?_0x2081d5[_0x3bcc('0x3a')][_0x3bcc('0x9c')]+':'+_0x2081d5[_0x3bcc('0x3a')][_0x3bcc('0x9a')]:_0x3bcc('0x9d')+_0x2081d5[_0x3bcc('0x3a')]['port'];var _0xc68721=_0x2081d5[_0x3bcc('0x3a')]['json']?_0x2081d5[_0x3bcc('0x3a')][_0x3bcc('0x20')]:!![];var _0x44d8a3=_0x2081d5['query'][_0x3bcc('0x9e')]?_0x2081d5[_0x3bcc('0x3a')][_0x3bcc('0x9e')]:null;var _0x1ebac8={'method':_0x2081d5[_0x3bcc('0x9f')],'uri':util[_0x3bcc('0x57')](_0x3bcc('0xa0'),_0x3b1df9,_0x2081d5['query'][_0x3bcc('0x54')]),'json':_0xc68721,'resolveWithFullResponse':!![],'encoding':_0x44d8a3,'qs':_0x2081d5[_0x3bcc('0x3a')]};if(_0x2081d5[_0x3bcc('0xa1')]){_0x1ebac8[_0x3bcc('0xa1')]=_0x2081d5[_0x3bcc('0xa1')];if(_0x1ebac8[_0x3bcc('0xa1')][_0x3bcc('0xa2')]){delete _0x1ebac8[_0x3bcc('0xa1')][_0x3bcc('0xa2')];}}if(_0x1ebac8['headers'][_0x3bcc('0xa3')]){delete _0x1ebac8[_0x3bcc('0xa1')][_0x3bcc('0xa3')];}return rp(_0x1ebac8);})[_0x3bcc('0x2a')](function(_0x570936){if(_0x570936){_0x16e752[_0x3bcc('0x24')](_0x570936[_0x3bcc('0xa1')]);logger[_0x3bcc('0x6a')](_0x570936['body']);if(_[_0x3bcc('0xa4')](_0x2081d5['query'][_0x3bcc('0x54')],'download')&&_0x570936[_0x3bcc('0xa5')]==0x1f4){return _0x16e752[_0x3bcc('0x2f')](_0x570936[_0x3bcc('0xa5')]);}else{return _0x16e752[_0x3bcc('0x1f')](_0x570936[_0x3bcc('0xa5')])[_0x3bcc('0x32')](_0x570936['body']);}}else{return _0x16e752[_0x3bcc('0x2f')](0xc8);}})[_0x3bcc('0x4d')](handleError(_0x16e752,null));};exports[_0x3bcc('0xa6')]=function(_0x3747c4,_0x57edd1,_0xcf7d52){return BPromise['resolve']()[_0x3bcc('0x2a')](function(){if(!_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x54')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x9a')]){throw new Error(_0x3bcc('0x9b'));}var _0x2f7f40=_0x3747c4['query'][_0x3bcc('0x9c')]?_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x9c')]+':'+_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x9a')]:'http://localhost:'+_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x9a')];var _0x11cb2f=_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x20')]?_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x20')]:!![];var _0x2a70de=_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x9e')]?_0x3747c4['query'][_0x3bcc('0x9e')]:null;var _0x188749={'method':_0x3747c4[_0x3bcc('0x9f')],'uri':util[_0x3bcc('0x57')](_0x3bcc('0xa0'),_0x2f7f40,_0x3747c4[_0x3bcc('0x3a')][_0x3bcc('0x54')]),'json':_0x11cb2f,'resolveWithFullResponse':!![],'encoding':_0x2a70de,'body':_0x3747c4['body']};if(_0x3747c4[_0x3bcc('0xa1')]){_0x188749[_0x3bcc('0xa1')]=_0x3747c4[_0x3bcc('0xa1')];if(_0x188749[_0x3bcc('0xa1')]['content-length']){delete _0x188749[_0x3bcc('0xa1')][_0x3bcc('0xa2')];}}if(_0x188749['headers'][_0x3bcc('0xa3')]){delete _0x188749[_0x3bcc('0xa1')][_0x3bcc('0xa3')];}return rp(_0x188749);})[_0x3bcc('0x2a')](function(_0x513da0){if(_0x513da0){_0x57edd1[_0x3bcc('0x24')](_0x513da0[_0x3bcc('0xa1')]);logger['info'](_0x513da0[_0x3bcc('0x8f')]);return _0x57edd1[_0x3bcc('0x1f')](_0x513da0[_0x3bcc('0xa5')])[_0x3bcc('0x32')](_0x513da0[_0x3bcc('0x8f')]);}else{return _0x57edd1[_0x3bcc('0x2f')](0xc8);}})[_0x3bcc('0x4d')](handleError(_0x57edd1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index cd296f6..b29ccbd 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 _0x5b5a=['emit','hasOwnProperty','hook','../../mysqldb','Plugin','save','update','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5b5a,0xc3));var _0xa5b5=function(_0xe08054,_0x22c584){_0xe08054=_0xe08054-0x0;var _0x5c3e9d=_0x5b5a[_0xe08054];return _0x5c3e9d;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa5b5('0x0'))['db'][_0xa5b5('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa5b5('0x2'),'afterUpdate':_0xa5b5('0x3'),'afterDestroy':_0xa5b5('0x4')};function emitEvent(_0x1b4884){return function(_0x1c76ae,_0x45f433,_0x1b87bf){PluginEvents[_0xa5b5('0x5')](_0x1b4884+':'+_0x1c76ae['id'],_0x1c76ae);PluginEvents['emit'](_0x1b4884,_0x1c76ae);_0x1b87bf(null);};}for(var e in events){if(events[_0xa5b5('0x6')](e)){var event=events[e];Plugin[_0xa5b5('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x1224=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x38ec30,_0x5c8b03){var _0x4f36b2=function(_0x23f092){while(--_0x23f092){_0x38ec30['push'](_0x38ec30['shift']());}};_0x4f36b2(++_0x5c8b03);}(_0x1224,0x10d));var _0x4122=function(_0x13bd92,_0x4eea2b){_0x13bd92=_0x13bd92-0x0;var _0x4a35c2=_0x1224[_0x13bd92];return _0x4a35c2;};'use strict';var EventEmitter=require(_0x4122('0x0'));var Plugin=require(_0x4122('0x1'))['db'][_0x4122('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x4122('0x3')](0x0);var events={'afterCreate':_0x4122('0x4'),'afterUpdate':_0x4122('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b3b05){return function(_0x1f1533,_0x2f506b,_0x4d5e5b){PluginEvents[_0x4122('0x6')](_0x1b3b05+':'+_0x1f1533['id'],_0x1f1533);PluginEvents[_0x4122('0x6')](_0x1b3b05,_0x1f1533);_0x4d5e5b(null);};}for(var e in events){if(events[_0x4122('0x7')](e)){var event=events[e];Plugin[_0x4122('0x8')](e,emitEvent(event));}}module[_0x4122('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1fb4b5a..11e4f4e 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 _0x6935=['api','bluebird','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x2a8737,_0x3fe99e){var _0x5db802=function(_0x17e591){while(--_0x17e591){_0x2a8737['push'](_0x2a8737['shift']());}};_0x5db802(++_0x3fe99e);}(_0x6935,0x1c5));var _0x5693=function(_0x20b25e,_0x797bf6){_0x20b25e=_0x20b25e-0x0;var _0x25236=_0x6935[_0x20b25e];return _0x25236;};'use strict';var _=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var logger=require(_0x5693('0x2'))(_0x5693('0x3'));var moment=require('moment');var BPromise=require(_0x5693('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5693('0x5'));var rimraf=require(_0x5693('0x6'));var config=require(_0x5693('0x7'));var attributes=require(_0x5693('0x8'));module['exports']=function(_0x40d8ed,_0x247998){return _0x40d8ed[_0x5693('0x9')](_0x5693('0xa'),attributes,{'tableName':_0x5693('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc0=['Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x200a4c,_0x10084a){var _0x9e90ef=function(_0x52678a){while(--_0x52678a){_0x200a4c['push'](_0x200a4c['shift']());}};_0x9e90ef(++_0x10084a);}(_0x0fc0,0x13a));var _0x00fc=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x0fc0[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x00fc('0x0'));var util=require(_0x00fc('0x1'));var logger=require(_0x00fc('0x2'))(_0x00fc('0x3'));var moment=require(_0x00fc('0x4'));var BPromise=require(_0x00fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00fc('0x6'));var rimraf=require(_0x00fc('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x00fc('0x8')]=function(_0x1f3ee2,_0x265fc1){return _0x1f3ee2[_0x00fc('0x9')](_0x00fc('0xa'),attributes,{'tableName':_0x00fc('0xb'),'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 ed91e88..3e0304c 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 _0x95a1=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create','body','options','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x95a1,0x129));var _0x195a=function(_0x486647,_0xc5b7c){_0x486647=_0x486647-0x0;var _0x1934dc=_0x95a1[_0x486647];return _0x1934dc;};'use strict';var _=require(_0x195a('0x0'));var util=require(_0x195a('0x1'));var moment=require(_0x195a('0x2'));var BPromise=require(_0x195a('0x3'));var rs=require(_0x195a('0x4'));var fs=require('fs');var Redis=require(_0x195a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x195a('0x6'));var logger=require(_0x195a('0x7'))(_0x195a('0x8'));var config=require(_0x195a('0x9'));var jayson=require(_0x195a('0xa'));var client=jayson[_0x195a('0xb')][_0x195a('0xc')]({'port':0x232a});config[_0x195a('0xd')]=_[_0x195a('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x195a('0xf'))(new Redis(config['redis']));require(_0x195a('0x10'))['register'](socket);function respondWithRpcPromise(_0xa6c403,_0x178a5d,_0x48ef13){return new BPromise(function(_0x55f152,_0x184530){return client[_0x195a('0x11')](_0xa6c403,_0x48ef13)[_0x195a('0x12')](function(_0x4041c3){logger[_0x195a('0x13')](_0x195a('0x14'),_0x178a5d,_0x195a('0x15'));logger[_0x195a('0x16')](_0x195a('0x17'),_0x178a5d,_0x195a('0x15'),JSON[_0x195a('0x18')](_0x4041c3));if(_0x4041c3[_0x195a('0x19')]){if(_0x4041c3[_0x195a('0x19')][_0x195a('0x1a')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x178a5d,_0x4041c3[_0x195a('0x19')]['message']);return _0x184530(_0x4041c3['error'][_0x195a('0x1b')]);}logger[_0x195a('0x19')](_0x195a('0x14'),_0x178a5d,_0x4041c3['error'][_0x195a('0x1b')]);return _0x55f152(_0x4041c3[_0x195a('0x19')][_0x195a('0x1b')]);}else{logger[_0x195a('0x13')]('Plugin,\x20%s,\x20%s',_0x178a5d,_0x195a('0x15'));_0x55f152(_0x4041c3[_0x195a('0x1c')][_0x195a('0x1b')]);}})[_0x195a('0x1d')](function(_0x15c6d2){logger[_0x195a('0x19')](_0x195a('0x14'),_0x178a5d,_0x15c6d2);_0x184530(_0x15c6d2);});});}exports['CreatePlugin']=function(_0x4a8def){var _0x32608e=this;return new Promise(function(_0x332b00,_0x2c8207){return db[_0x195a('0x1e')][_0x195a('0x1f')](_0x4a8def[_0x195a('0x20')],{'raw':_0x4a8def['options']?_0x4a8def[_0x195a('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x195a('0x12')](function(_0x548b0f){logger[_0x195a('0x13')](_0x195a('0x22'),_0x4a8def);logger['debug'](_0x195a('0x22'),_0x4a8def,JSON[_0x195a('0x18')](_0x548b0f));_0x332b00(_0x548b0f);})['catch'](function(_0x3226f7){logger['error'](_0x195a('0x22'),_0x3226f7[_0x195a('0x1b')],_0x4a8def);_0x2c8207(_0x32608e[_0x195a('0x19')](0x1f4,_0x3226f7[_0x195a('0x1b')]));});});}; \ No newline at end of file +var _0x3cbc=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','body','options','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x3cbc,0xc9));var _0xc3cb=function(_0x4f35f8,_0xf40d60){_0x4f35f8=_0x4f35f8-0x0;var _0x47f700=_0x3cbc[_0x4f35f8];return _0x47f700;};'use strict';var _=require(_0xc3cb('0x0'));var util=require(_0xc3cb('0x1'));var moment=require(_0xc3cb('0x2'));var BPromise=require(_0xc3cb('0x3'));var rs=require(_0xc3cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3cb('0x5'))['db'];var utils=require(_0xc3cb('0x6'));var logger=require(_0xc3cb('0x7'))(_0xc3cb('0x8'));var config=require(_0xc3cb('0x9'));var jayson=require(_0xc3cb('0xa'));var client=jayson[_0xc3cb('0xb')][_0xc3cb('0xc')]({'port':0x232a});config[_0xc3cb('0xd')]=_[_0xc3cb('0xe')](config[_0xc3cb('0xd')],{'host':_0xc3cb('0xf'),'port':0x18eb});var socket=require(_0xc3cb('0x10'))(new Redis(config['redis']));require(_0xc3cb('0x11'))[_0xc3cb('0x12')](socket);function respondWithRpcPromise(_0xb50867,_0x23b165,_0x3bf68d){return new BPromise(function(_0x49c536,_0x4ab6e5){return client['request'](_0xb50867,_0x3bf68d)[_0xc3cb('0x13')](function(_0x501327){logger[_0xc3cb('0x14')](_0xc3cb('0x15'),_0x23b165,_0xc3cb('0x16'));logger['debug'](_0xc3cb('0x17'),_0x23b165,'request\x20sent',JSON[_0xc3cb('0x18')](_0x501327));if(_0x501327[_0xc3cb('0x19')]){if(_0x501327['error'][_0xc3cb('0x1a')]===0x1f4){logger[_0xc3cb('0x19')]('Plugin,\x20%s,\x20%s',_0x23b165,_0x501327['error'][_0xc3cb('0x1b')]);return _0x4ab6e5(_0x501327[_0xc3cb('0x19')][_0xc3cb('0x1b')]);}logger[_0xc3cb('0x19')]('Plugin,\x20%s,\x20%s',_0x23b165,_0x501327[_0xc3cb('0x19')][_0xc3cb('0x1b')]);return _0x49c536(_0x501327[_0xc3cb('0x19')][_0xc3cb('0x1b')]);}else{logger['info'](_0xc3cb('0x15'),_0x23b165,'request\x20sent');_0x49c536(_0x501327[_0xc3cb('0x1c')][_0xc3cb('0x1b')]);}})[_0xc3cb('0x1d')](function(_0x24ec36){logger['error'](_0xc3cb('0x15'),_0x23b165,_0x24ec36);_0x4ab6e5(_0x24ec36);});});}exports[_0xc3cb('0x1e')]=function(_0x3c6d03){var _0xec5f97=this;return new Promise(function(_0x5e43db,_0x47e43c){return db['Plugin'][_0xc3cb('0x1f')](_0x3c6d03[_0xc3cb('0x20')],{'raw':_0x3c6d03[_0xc3cb('0x21')]?_0x3c6d03[_0xc3cb('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xc3cb('0x13')](function(_0x36ecbd){logger[_0xc3cb('0x14')](_0xc3cb('0x1e'),_0x3c6d03);logger[_0xc3cb('0x22')](_0xc3cb('0x1e'),_0x3c6d03,JSON['stringify'](_0x36ecbd));_0x5e43db(_0x36ecbd);})['catch'](function(_0x40202b){logger['error']('CreatePlugin',_0x40202b['message'],_0x3c6d03);_0x47e43c(_0xec5f97[_0xc3cb('0x19')](0x1f4,_0x40202b[_0xc3cb('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f41c54f..9db162b 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 _0x7544=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0x7544,0xed));var _0x4754=function(_0x110945,_0x59d050){_0x110945=_0x110945-0x0;var _0xf70f9a=_0x7544[_0x110945];return _0xf70f9a;};'use strict';var PluginEvents=require(_0x4754('0x0'));var events=[_0x4754('0x1'),_0x4754('0x2'),'update'];function createListener(_0x3d85be,_0x109469){return function(_0x2c25d2){_0x109469[_0x4754('0x3')](_0x3d85be,_0x2c25d2);};}function removeListener(_0x50bc05,_0x2c74b8){return function(){PluginEvents[_0x4754('0x4')](_0x50bc05,_0x2c74b8);};}exports[_0x4754('0x5')]=function(_0xcfe6cd){for(var _0x42d852=0x0,_0x5f52e0=events[_0x4754('0x6')];_0x42d852<_0x5f52e0;_0x42d852++){var _0x47847a=events[_0x42d852];var _0x5e9f73=createListener(_0x4754('0x7')+_0x47847a,_0xcfe6cd);PluginEvents['on'](_0x47847a,_0x5e9f73);}}; \ No newline at end of file +var _0xbd7b=['length','plugin:','save','remove','update','emit','removeListener'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0xbd7b,0xd4));var _0xbbd7=function(_0x5dc0c5,_0x4c2e85){_0x5dc0c5=_0x5dc0c5-0x0;var _0x218d06=_0xbd7b[_0x5dc0c5];return _0x218d06;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xbbd7('0x0'),_0xbbd7('0x1'),_0xbbd7('0x2')];function createListener(_0x1d613a,_0x2450ec){return function(_0x41a7b5){_0x2450ec[_0xbbd7('0x3')](_0x1d613a,_0x41a7b5);};}function removeListener(_0x59ca0f,_0x11bf1b){return function(){PluginEvents[_0xbbd7('0x4')](_0x59ca0f,_0x11bf1b);};}exports['register']=function(_0x5c76fb){for(var _0xf74810=0x0,_0x11b17d=events[_0xbbd7('0x5')];_0xf74810<_0x11b17d;_0xf74810++){var _0x4383fd=events[_0xf74810];var _0x1713b1=createListener(_0xbbd7('0x6')+_0x4383fd,_0x5c76fb);PluginEvents['on'](_0x4383fd,_0x1713b1);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index db65733..7295f01 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(_0x219074,_0x1b92c7){var _0x29e10b=function(_0x161dcb){while(--_0x161dcb){_0x219074['push'](_0x219074['shift']());}};_0x29e10b(++_0x1b92c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x1f159a,_0x469311){var _0x1f46b9=function(_0xcb1945){while(--_0xcb1945){_0x1f159a['push'](_0x1f159a['shift']());}};_0x1f46b9(++_0x469311);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 087f2de..126a147 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 _0xf109=['name','send','info','index','list','express','motion2','then','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','restart','stop','hasOwnProperty','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0xf109,0xce));var _0x9f10=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xf109[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0x9f10('0x0'));var pm2=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x9f10('0x3')];var BPromise=require(_0x9f10('0x4'));function handleEntityNotFound(_0x74d0ee,_0x26f01c){return function(_0x4027f4){if(!_0x4027f4){_0x74d0ee[_0x9f10('0x5')](0x194);;}return _0x4027f4;};}function respondWithResult(_0x408fe8,_0xd3137b){_0xd3137b=_0xd3137b||0xc8;return function(_0x227a29){if(_0x227a29){return _0x408fe8[_0x9f10('0x6')](_0xd3137b)[_0x9f10('0x7')](_0x227a29);}return null;};}function handleError(_0x5c8719,_0x42a8cd){_0x42a8cd=_0x42a8cd||0x1f4;return function(_0x3019eb){logger[_0x9f10('0x8')](_0x3019eb[_0x9f10('0x9')]);if(_0x3019eb[_0x9f10('0xa')]){delete _0x3019eb['name'];}_0x5c8719[_0x9f10('0x6')](_0x42a8cd)[_0x9f10('0xb')](_0x3019eb);};}function execChildProcess(){return new BPromise(function(_0x4522d9,_0x4e577d){exec('npm\x20install',function(_0x3fac2b,_0x311935,_0x407336){logger['info'](_0x311935);logger[_0x9f10('0xc')](_0x407336);if(_0x3fac2b){logger[_0x9f10('0x8')](_0x3fac2b);return _0x4e577d(_0x3fac2b);}return _0x4522d9(_0x311935);});});}exports[_0x9f10('0xd')]=function(_0x58067f,_0x9a3ae6){return pm2[_0x9f10('0xe')]()['then'](function(_0x40a48a){if(_0x40a48a){var _0x236e28=_['reject'](_0x40a48a,function(_0x59bcad){return _0x59bcad[_0x9f10('0xa')]===_0x9f10('0xf')||_0x59bcad['name']===_0x9f10('0x10');});return{'rows':_0x236e28,'count':_0x236e28['length']};}return null;})[_0x9f10('0x11')](respondWithResult(_0x9a3ae6,null))[_0x9f10('0x12')](handleError(_0x9a3ae6,null));};exports['show']=function(_0x11cc56,_0xd2950c){return pm2['describe'](_0x11cc56[_0x9f10('0x13')]['id'])['then'](respondWithResult(_0xd2950c,null))[_0x9f10('0x11')](handleEntityNotFound(_0xd2950c,null))['catch'](handleError(_0xd2950c,null));};exports[_0x9f10('0x14')]=function(_0x56fb44,_0x54c262){if(_0x56fb44[_0x9f10('0x15')][_0x9f10('0xa')]&&_0x56fb44[_0x9f10('0x15')][_0x9f10('0x16')]){var _0xa810c=path[_0x9f10('0x17')](__dirname,_0x9f10('0x18'),_0x56fb44['body'][_0x9f10('0x16')]);var _0x58e6ba=process[_0x9f10('0x19')]();process[_0x9f10('0x1a')](path[_0x9f10('0x1b')](_0xa810c));return execChildProcess()['then'](function(_0x2f31fb){process[_0x9f10('0x1a')](_0x58e6ba);return pm2[_0x9f10('0x1c')]({'name':_0x56fb44['body'][_0x9f10('0xa')],'script':_0xa810c});})[_0x9f10('0x11')](function(_0x44b99d){pm2['dump']();return _0x44b99d[0x0];})[_0x9f10('0x11')](respondWithResult(_0x54c262,0xc9))[_0x9f10('0x12')](handleError(_0x54c262,null));}else{return _0x54c262[_0x9f10('0x6')](0x1f4)[_0x9f10('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x5c1800,_0x385a39){if(_0x5c1800['body']['id']){delete _0x5c1800[_0x9f10('0x15')]['id'];}var _0x1de75a={'online':_0x9f10('0x1d'),'stopped':_0x9f10('0x1e')};if(_0x1de75a[_0x9f10('0x1f')](_0x5c1800['body'][_0x9f10('0x6')])){return pm2[_0x1de75a[_0x5c1800[_0x9f10('0x15')][_0x9f10('0x6')]]](_0x5c1800[_0x9f10('0x13')]['id'])[_0x9f10('0x11')](respondWithResult(_0x385a39,0xc8))[_0x9f10('0x12')](handleError(_0x385a39,null));}else{return _0x385a39['status'](0x1f4)[_0x9f10('0xb')]({'message':_0x9f10('0x20')});}};exports[_0x9f10('0x21')]=function(_0x1b03ee,_0x49b3f4){if(_0x1b03ee[_0x9f10('0x15')]['id']){delete _0x1b03ee[_0x9f10('0x15')]['id'];}if(_0x1b03ee[_0x9f10('0x13')]['id']){return pm2['delete'](_0x1b03ee[_0x9f10('0x13')]['id'])['then'](function(_0x1069ba){pm2[_0x9f10('0x22')]();return _0x1069ba[0x0];})[_0x9f10('0x11')](respondWithResult(_0x49b3f4,null))['catch'](handleError(_0x49b3f4,null));}else{return _0x49b3f4[_0x9f10('0x6')](0x1f4)[_0x9f10('0xb')]({'message':_0x9f10('0x23')});}}; \ No newline at end of file +var _0x750a=['restart','stop','Unknown\x20status','delete','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','error','index','list','then','reject','express','length','describe','params','body','../../files/plugins','chdir','start','dump','catch','Missing\x20name\x20and/or\x20path','update'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x750a,0x140));var _0xa750=function(_0xc7de08,_0x32245a){_0xc7de08=_0xc7de08-0x0;var _0x20275b=_0x750a[_0xc7de08];return _0x20275b;};'use strict';var _=require('lodash');var pm2=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var path=require(_0xa750('0x1'));var exec=require(_0xa750('0x2'))[_0xa750('0x3')];var BPromise=require(_0xa750('0x4'));function handleEntityNotFound(_0x457cae,_0x43d704){return function(_0x562911){if(!_0x562911){_0x457cae[_0xa750('0x5')](0x194);;}return _0x562911;};}function respondWithResult(_0x10b4d9,_0x2497df){_0x2497df=_0x2497df||0xc8;return function(_0x197299){if(_0x197299){return _0x10b4d9[_0xa750('0x6')](_0x2497df)[_0xa750('0x7')](_0x197299);}return null;};}function handleError(_0x47a4dd,_0x53f2cb){_0x53f2cb=_0x53f2cb||0x1f4;return function(_0x2678ff){logger['error'](_0x2678ff[_0xa750('0x8')]);if(_0x2678ff[_0xa750('0x9')]){delete _0x2678ff['name'];}_0x47a4dd[_0xa750('0x6')](_0x53f2cb)[_0xa750('0xa')](_0x2678ff);};}function execChildProcess(){return new BPromise(function(_0x5870f0,_0x5aca9c){exec(_0xa750('0xb'),function(_0x4b19a1,_0x174fd0,_0x5adaae){logger['info'](_0x174fd0);logger[_0xa750('0xc')](_0x5adaae);if(_0x4b19a1){logger[_0xa750('0xd')](_0x4b19a1);return _0x5aca9c(_0x4b19a1);}return _0x5870f0(_0x174fd0);});});}exports[_0xa750('0xe')]=function(_0x567c51,_0x2f670f){return pm2[_0xa750('0xf')]()[_0xa750('0x10')](function(_0x24e48a){if(_0x24e48a){var _0xa66181=_[_0xa750('0x11')](_0x24e48a,function(_0x5806ed){return _0x5806ed[_0xa750('0x9')]===_0xa750('0x12')||_0x5806ed[_0xa750('0x9')]==='motion2';});return{'rows':_0xa66181,'count':_0xa66181[_0xa750('0x13')]};}return null;})[_0xa750('0x10')](respondWithResult(_0x2f670f,null))['catch'](handleError(_0x2f670f,null));};exports['show']=function(_0x321eb2,_0x5b1e6b){return pm2[_0xa750('0x14')](_0x321eb2[_0xa750('0x15')]['id'])['then'](respondWithResult(_0x5b1e6b,null))[_0xa750('0x10')](handleEntityNotFound(_0x5b1e6b,null))['catch'](handleError(_0x5b1e6b,null));};exports['create']=function(_0x25e335,_0x5d0935){if(_0x25e335[_0xa750('0x16')]['name']&&_0x25e335[_0xa750('0x16')]['script']){var _0x3dc7f1=path['join'](__dirname,_0xa750('0x17'),_0x25e335['body']['script']);var _0xaa9d3e=process['cwd']();process[_0xa750('0x18')](path['dirname'](_0x3dc7f1));return execChildProcess()['then'](function(_0x5b433d){process['chdir'](_0xaa9d3e);return pm2[_0xa750('0x19')]({'name':_0x25e335[_0xa750('0x16')][_0xa750('0x9')],'script':_0x3dc7f1});})[_0xa750('0x10')](function(_0x1b80a5){pm2[_0xa750('0x1a')]();return _0x1b80a5[0x0];})[_0xa750('0x10')](respondWithResult(_0x5d0935,0xc9))[_0xa750('0x1b')](handleError(_0x5d0935,null));}else{return _0x5d0935[_0xa750('0x6')](0x1f4)[_0xa750('0xa')]({'message':_0xa750('0x1c')});}};exports[_0xa750('0x1d')]=function(_0x31ea63,_0x3f7d6d){if(_0x31ea63[_0xa750('0x16')]['id']){delete _0x31ea63['body']['id'];}var _0x3d3923={'online':_0xa750('0x1e'),'stopped':_0xa750('0x1f')};if(_0x3d3923['hasOwnProperty'](_0x31ea63[_0xa750('0x16')][_0xa750('0x6')])){return pm2[_0x3d3923[_0x31ea63[_0xa750('0x16')][_0xa750('0x6')]]](_0x31ea63['params']['id'])[_0xa750('0x10')](respondWithResult(_0x3f7d6d,0xc8))[_0xa750('0x1b')](handleError(_0x3f7d6d,null));}else{return _0x3f7d6d[_0xa750('0x6')](0x1f4)[_0xa750('0xa')]({'message':_0xa750('0x20')});}};exports['destroy']=function(_0x46cc11,_0x4c2c9e){if(_0x46cc11[_0xa750('0x16')]['id']){delete _0x46cc11[_0xa750('0x16')]['id'];}if(_0x46cc11['params']['id']){return pm2[_0xa750('0x21')](_0x46cc11[_0xa750('0x15')]['id'])[_0xa750('0x10')](function(_0x314f88){pm2[_0xa750('0x1a')]();return _0x314f88[0x0];})[_0xa750('0x10')](respondWithResult(_0x4c2c9e,null))[_0xa750('0x1b')](handleError(_0x4c2c9e,null));}else{return _0x4c2c9e[_0xa750('0x6')](0x1f4)['send']({'message':_0xa750('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f2c9d60..9d502d6 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 _0xb648=['/agents','getAgents','/queues','isAuthenticated','exports','express','Router','./realtime.controller','get'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb648,0x71));var _0x8b64=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0xb648[_0x15af0f];return _0x2bd1cb;};'use strict';var express=require(_0x8b64('0x0'));var router=express[_0x8b64('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8b64('0x2'));router[_0x8b64('0x3')](_0x8b64('0x4'),auth['isAuthenticated'](),controller[_0x8b64('0x5')]);router[_0x8b64('0x3')](_0x8b64('0x6'),auth[_0x8b64('0x7')](),controller['getQueues']);module[_0x8b64('0x8')]=router; \ No newline at end of file +var _0x6e01=['./realtime.controller','/agents','isAuthenticated','get','getQueues','exports','Router'];(function(_0x200d3b,_0x28b9a3){var _0x422991=function(_0x127dcf){while(--_0x127dcf){_0x200d3b['push'](_0x200d3b['shift']());}};_0x422991(++_0x28b9a3);}(_0x6e01,0xa0));var _0x16e0=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x6e01[_0x531e48];return _0x202971;};'use strict';var express=require('express');var router=express[_0x16e0('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x16e0('0x1'));router['get'](_0x16e0('0x2'),auth[_0x16e0('0x3')](),controller['getAgents']);router[_0x16e0('0x4')]('/queues',auth[_0x16e0('0x3')](),controller[_0x16e0('0x5')]);module[_0x16e0('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 18bbafe..a90379f 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 _0x5fab=['pause','every','faxStatus','mailStatus','whatsappStatus','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','internal','address','mailPause','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','fieldName','type','role','agent','query','getOptions','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','sms','openchannel','fax','channel','includes','toLowerCase','rawAttributes','key','QueueCampaigns','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','map','get','agents','busy','pick','filter','queue','toString','find','UserId','accountcode','online','voiceStatus','User','Queue','QueueId','length','loggedInDb','idle','unknown','unavailable','ringing','isNil','chatPause','openchannelPause','voicePause','whatsappPause'];(function(_0x6acb69,_0xd36dbf){var _0x29a021=function(_0x374293){while(--_0x374293){_0x6acb69['push'](_0x6acb69['shift']());}};_0x29a021(++_0xd36dbf);}(_0x5fab,0x177));var _0xb5fa=function(_0x4e9df2,_0x36818e){_0x4e9df2=_0x4e9df2-0x0;var _0x9fe790=_0x5fab[_0x4e9df2];return _0x9fe790;};'use strict';var util=require(_0xb5fa('0x0'));var _=require(_0xb5fa('0x1'));var jayson=require('jayson/promise');var qs=require(_0xb5fa('0x2'));var logger=require(_0xb5fa('0x3'))(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var amiClient=jayson[_0xb5fa('0x6')][_0xb5fa('0x7')]({'port':0x232a});var routingClient=jayson[_0xb5fa('0x6')][_0xb5fa('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x10361d,_0x44df89){return function(_0x4a0249){if(_0x4a0249){var _0x5d70f6=typeof _0x44df89[_0xb5fa('0x8')]===_0xb5fa('0x9')&&typeof _0x44df89[_0xb5fa('0xa')]==='undefined';var _0x410eff=_0x4a0249[_0xb5fa('0xb')];var _0x2cf4a5=_0x5d70f6?0x0:_0x44df89['offset'];var _0x5b5ea8=_0x5d70f6?_0x4a0249[_0xb5fa('0xb')]:_0x44df89[_0xb5fa('0x8')]+_0x44df89[_0xb5fa('0xa')];var _0x44e6c8;if(_0x5b5ea8>=_0x410eff){_0x5b5ea8=_0x410eff;_0x44e6c8=0xc8;}else{_0x44e6c8=0xce;}_0x10361d[_0xb5fa('0xc')](_0x44e6c8);return _0x10361d[_0xb5fa('0xd')](_0xb5fa('0xe'),_0x2cf4a5+'-'+_0x5b5ea8+'/'+_0x410eff)[_0xb5fa('0xf')](_0x4a0249);}return null;};}function handleError(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0x1f4;return function(_0x2ad830){logger[_0xb5fa('0x10')](_0x2ad830['stack']);if(_0x2ad830[_0xb5fa('0x11')]){delete _0x2ad830['name'];}_0x309740[_0xb5fa('0xc')](_0x4d3576)[_0xb5fa('0x12')](_0x2ad830);};}function getRealtimeAgents(){return new Promise(function(_0x40c914,_0xca8d82){return amiClient[_0xb5fa('0x13')]('Agents',{})['then'](function(_0x38e964){if(_0x38e964[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x14'));var _0x27c8f7=_0x38e964['result'];return routingClient['request'](_0xb5fa('0x15'),{})[_0xb5fa('0x16')](function(_0x32e9e5){if(_0x32e9e5[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x17'));var _0x13e82b=_0x32e9e5[_0xb5fa('0x18')];return _0x40c914(_[_0xb5fa('0x19')]({},_0x27c8f7,_0x13e82b));});})[_0xb5fa('0x1a')](function(_0x368cb1){_0xca8d82(_0x368cb1);});});}function getRealtimeQueues(_0x3c8d53,_0x1f5064){return new Promise(function(_0x5cd822,_0x432bfa){var _0x519e20=_0x1f5064===_0xb5fa('0x1b')?amiClient:routingClient;return _0x519e20['request'](_[_0xb5fa('0x1c')](_0x1f5064)+_0xb5fa('0x1d'),_0x3c8d53)['then'](function(_0x40dfdf){if(_0x40dfdf[_0xb5fa('0x10')])throw new Error(util[_0xb5fa('0x1e')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1f5064));return _0x5cd822(_0x40dfdf[_0xb5fa('0x18')]);})[_0xb5fa('0x1a')](function(_0x444237){_0x432bfa(_0x444237);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x542348,_0x224ec8){return amiClient['request'](_0xb5fa('0x1f'),{})[_0xb5fa('0x16')](function(_0x11053a){if(_0x11053a[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x20'));return _0x542348(_0x11053a[_0xb5fa('0x18')]);})[_0xb5fa('0x1a')](function(_0x20d649){_0x224ec8(_0x20d649);});});}function initializeQueues(_0x568870,_0x4ec294,_0x5bdf11,_0x5a1c39){var _0x28a350=[_0xb5fa('0x21'),_0xb5fa('0x22'),_0xb5fa('0x23'),_0xb5fa('0x24'),_0xb5fa('0x25')];if(_0x5bdf11===_0xb5fa('0x1b')&&_0x5a1c39===_0xb5fa('0x26')){_0x28a350[_0xb5fa('0x27')](_0xb5fa('0x28'),_0xb5fa('0x29'),_0xb5fa('0x2a'),_0xb5fa('0x2b'),_0xb5fa('0x2c'),_0xb5fa('0x2d'),_0xb5fa('0x2e'),_0xb5fa('0x2f'),_0xb5fa('0x30'),_0xb5fa('0x31'),_0xb5fa('0x32'),_0xb5fa('0x33'),_0xb5fa('0x34'),_0xb5fa('0x35'),_0xb5fa('0x36'),'predictiveIntervalAvailable',_0xb5fa('0x37'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0xb5fa('0x38'),'predictiveIntervalAvgTalktime');}return _0x568870[_0xb5fa('0x39')](function(_0x5876f1){var _0x5518b1=_0x5876f1[_0xb5fa('0x3a')]({'plain':!![]});_0x5518b1[_0xb5fa('0x3b')]=[];_0x5518b1['paused']=0x0;_0x5518b1['loggedInDb']=0x0;_0x5518b1[_0xb5fa('0x21')]=0x0;_0x5518b1[_0xb5fa('0x22')]=0x0;_0x5518b1[_0xb5fa('0x23')]=0x0;if(_0x5bdf11==='voice'){_0x5518b1[_0xb5fa('0x24')]=0x0;_0x5518b1[_0xb5fa('0x3c')]=0x0;if(_0x5a1c39==='outbound'){_0x5518b1[_0xb5fa('0x28')]=0x0;_0x5518b1[_0xb5fa('0x29')]=0x0;}}var _0x204d6b=_['find'](_0x4ec294,['id',_0x5518b1['id']]);if(_0x204d6b)_[_0xb5fa('0x19')](_0x5518b1,_[_0xb5fa('0x3d')](_0x204d6b,_0x28a350));return _0x5518b1;});}function updateAgentVoiceStatus(_0x24ef11,_0x55bdb7,_0x117694){var _0x1c818f=_[_0xb5fa('0x3e')](_0x117694,[_0xb5fa('0x3f'),_0x55bdb7['name']]);if(_0x1c818f['length']===0x0)return _0x24ef11['busy']=!![];if(_['some'](_0x1c818f,['connectedlinenum',_0x24ef11['internal'][_0xb5fa('0x40')]()]))return _0x24ef11['talking']=!![];if(!_0x24ef11[_0xb5fa('0x24')])return _0x24ef11[_0xb5fa('0x3c')]=!![];}function getVoiceQueueAgents(_0x36db1a,_0x30b288,_0x40c1c0,_0x269d21){var _0x4b4c4c=_['find'](_0x30b288,['id',_0x36db1a['id']]);if(!_0x4b4c4c)return _0x36db1a;return _0x4b4c4c['getMembers']({'raw':!![]})[_0xb5fa('0x16')](function(_0x4d23f1){for(var _0x73d425=0x0;_0x73d425<_0x4d23f1['length'];_0x73d425++){var _0x58aa97=_[_0xb5fa('0x41')](_0x40c1c0,['id',_0x4d23f1[_0x73d425][_0xb5fa('0x42')]]);if(!_0x58aa97){_0x58aa97={'id':_0x4d23f1[_0x73d425][_0xb5fa('0x42')],'name':_0x4d23f1[_0x73d425][_0xb5fa('0x42')],'accountcode':'','online':![]};}var _0x5bc93f={'id':_0x58aa97['id'],'name':_0x58aa97[_0xb5fa('0x11')],'internal':_0x58aa97[_0xb5fa('0x43')],'online':Boolean(_0x58aa97[_0xb5fa('0x44')]),'paused':Boolean(_0x4d23f1[_0x73d425][_0xb5fa('0x25')])};if(_0x58aa97[_0xb5fa('0x45')]==='talking')updateAgentVoiceStatus(_0x5bc93f,_0x36db1a,_0x269d21);if(_0x5bc93f[_0xb5fa('0x44')])_0x36db1a['loggedInDb']++;if(_0x5bc93f[_0xb5fa('0x3c')])_0x36db1a[_0xb5fa('0x3c')]++;if(_0x5bc93f[_0xb5fa('0x25')]&&!_0x5bc93f[_0xb5fa('0x3c')]&&!_0x5bc93f[_0xb5fa('0x24')])_0x36db1a[_0xb5fa('0x25')]++;_0x36db1a[_0xb5fa('0x3b')][_0xb5fa('0x27')](_0x5bc93f);}return _0x36db1a;});}function getQueueAgents(_0x4da448,_0x1c3c2c,_0xc03e44){var _0x59ae64=_0xb5fa('0x46')+_['startCase'](_0xc03e44)+_0xb5fa('0x47');var _0x5ae45a=_0xc03e44+'Pause';return db[_0x59ae64]['findAll']({'where':{[_[_0xb5fa('0x1c')](_0xc03e44)+_0xb5fa('0x48')]:_0x4da448['id']},'raw':!![]})[_0xb5fa('0x16')](function(_0x19e662){for(var _0x430f46=0x0;_0x430f46<_0x19e662[_0xb5fa('0x49')];_0x430f46++){var _0x10f354=_[_0xb5fa('0x41')](_0x1c3c2c,['id',_0x19e662[_0x430f46]['UserId']]);if(!_0x10f354){_0x10f354={'id':_0x19e662[_0x430f46][_0xb5fa('0x42')],'name':_0x19e662[_0x430f46][_0xb5fa('0x42')],'online':![],['pauseField']:![]};}var _0x4e0fe7={'id':_0x10f354['id'],'name':_0x10f354[_0xb5fa('0x11')],'online':Boolean(_0x10f354[_0xb5fa('0x44')]),'paused':Boolean(_0x10f354[_0x5ae45a])};if(_0x4e0fe7[_0xb5fa('0x44')])_0x4da448[_0xb5fa('0x4a')]++;_0x4da448[_0xb5fa('0x3b')][_0xb5fa('0x27')](_0x4e0fe7);}return _0x4da448;});}function isIdle(_0x1e1c2){return _0x1e1c2===_0xb5fa('0x4b')||_0x1e1c2===_0xb5fa('0x4c')||_0x1e1c2===_0xb5fa('0x4d')||_0x1e1c2===_0xb5fa('0x4e')||_[_0xb5fa('0x4f')](_0x1e1c2);}function isAgentPaused(_0x6ae261,_0x23be4c){var _0x42a359=[_0x6ae261[_0xb5fa('0x50')],_0x6ae261['faxPause'],_0x6ae261['mailPause'],_0x6ae261[_0xb5fa('0x51')],_0x6ae261['smsPause'],_0x6ae261[_0xb5fa('0x52')],_0x6ae261[_0xb5fa('0x53')]];if(!_0x23be4c)return _['every'](_0x42a359);var _0x4ef1d0=_[_0xb5fa('0x3e')](_0x42a359);return _0x4ef1d0[_0xb5fa('0x49')]>0x0&&_0x4ef1d0[_0xb5fa('0x49')]<_0x42a359[_0xb5fa('0x49')]?!![]:![];}function isAgentIdle(_0x3ffee0){if(_0x3ffee0['voiceStatus']!==_0xb5fa('0x4b')&&_0x3ffee0['voicePause']){_0x3ffee0[_0xb5fa('0x45')]=_0xb5fa('0x54');return![];}return _[_0xb5fa('0x55')]([_0x3ffee0['chatStatus'],_0x3ffee0[_0xb5fa('0x56')],_0x3ffee0[_0xb5fa('0x57')],_0x3ffee0['openchannelStatus'],_0x3ffee0['smsStatus'],_0x3ffee0[_0xb5fa('0x45')],_0x3ffee0[_0xb5fa('0x58')]],isIdle);}function getAgentStatus(_0x320745){var _0x3ffdb5=_0xb5fa('0x4c');if(isAgentPaused(_0x320745))_0x3ffdb5=_0xb5fa('0x54');else if(isAgentPaused(_0x320745,!![]))_0x3ffdb5=_0xb5fa('0x59');else if(isAgentIdle(_0x320745))_0x3ffdb5=_0xb5fa('0x4b');else _0x3ffdb5=_0xb5fa('0x3c');return _0x3ffdb5;}exports[_0xb5fa('0x5a')]=function(_0x25de19,_0x35cf5a){var _0x3ccfd1={'count':0x0,'rows':[]},_0x2799e7={},_0x23f235,_0x42c34f,_0x10830a=['userpic',_0xb5fa('0x44'),_0xb5fa('0x5b'),_0xb5fa('0x5c'),_0xb5fa('0x5d'),_0xb5fa('0x5c'),_0xb5fa('0x5e'),_0xb5fa('0x5f'),_0xb5fa('0x50'),_0xb5fa('0x51'),_0xb5fa('0x60'),'smsPause','whatsappPause',_0xb5fa('0x61'),_0xb5fa('0x52'),_0xb5fa('0x62'),'openchannelCapacity',_0xb5fa('0x63'),_0xb5fa('0x64'),_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'smsCurrentCapacity',_0xb5fa('0x6a'),_0xb5fa('0x6b'),'chatStatus',_0xb5fa('0x6c'),_0xb5fa('0x57'),'smsStatus',_0xb5fa('0x58'),_0xb5fa('0x56'),_0xb5fa('0x45'),_0xb5fa('0x6d'),_0xb5fa('0x6e'),_0xb5fa('0x6f'),_0xb5fa('0x70'),_0xb5fa('0x71'),_0xb5fa('0x72'),_0xb5fa('0x73'),_0xb5fa('0x3f'),_0xb5fa('0x74'),_0xb5fa('0x75'),_0xb5fa('0x76'),_0xb5fa('0x77'),_0xb5fa('0x78')],_0x24acea=[_0xb5fa('0x50'),_0xb5fa('0x51'),_0xb5fa('0x60'),_0xb5fa('0x79'),_0xb5fa('0x53'),_0xb5fa('0x61'),'voicePause',_0xb5fa('0x44')];Promise[_0xb5fa('0x7a')]()[_0xb5fa('0x16')](function(){var _0x580d1a=_[_0xb5fa('0x39')](db[_0xb5fa('0x46')]['rawAttributes'],function(_0x44fd4a){return{'name':_0x44fd4a[_0xb5fa('0x7b')],'type':_0x44fd4a[_0xb5fa('0x7c')]['key']};});_0x25de19['query'][_0xb5fa('0x7d')]=_0xb5fa('0x7e');_0x25de19[_0xb5fa('0x7f')]['online']=!![];_0x2799e7=qs[_0xb5fa('0x80')](_0x580d1a,_0x25de19);_0x2799e7[_0xb5fa('0x81')]=!![];if(_0x25de19[_0xb5fa('0x82')][_0xb5fa('0x7d')]==='user'){var _0x55000b={'params':{'id':_0x25de19['user'][_0xb5fa('0x83')]},'query':{'section':_0xb5fa('0x15'),'role':_0xb5fa('0x7e'),'online':!![],'nolimit':_0x25de19['query'][_0xb5fa('0x84')],'sort':_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x85')],'filter':_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x3e')],'raw':!![]}};return db[_0xb5fa('0x86')][_0xb5fa('0x87')](_0x55000b);}return db[_0xb5fa('0x46')][_0xb5fa('0x88')](_0x2799e7);})[_0xb5fa('0x16')](function(_0x3a1db9){_0x3ccfd1[_0xb5fa('0xb')]=_0x3a1db9[_0xb5fa('0xb')];_0x23f235=_0x3a1db9[_0xb5fa('0x89')];return getRealtimeAgents();})[_0xb5fa('0x16')](function(_0x5eeaa1){_0x42c34f=_0x5eeaa1[_0xb5fa('0x89')];return _0x23f235['map'](function(_0x47193c){var _0x209213=_[_0xb5fa('0x41')](_0x42c34f,['id',_0x47193c['id']]);if(_0x209213)_[_0xb5fa('0x19')](_0x47193c,_[_0xb5fa('0x3d')](_['omit'](_0x209213,_0x24acea),_0x10830a));_0x47193c[_0xb5fa('0x8a')]=getAgentStatus(_0x47193c);return _0x47193c;});})['then'](function(_0x77a831){if(_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x8b')]){var _0x394386=_['filter'](_0x77a831,['globalStatus',_0x25de19['query'][_0xb5fa('0x8b')]]);if(_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x8c')]){_0x394386=_[_0xb5fa('0x3e')](_0x394386,[_0xb5fa('0x5d'),_0x25de19[_0xb5fa('0x7f')]['pauseTypeFilter']]);}}_0x3ccfd1[_0xb5fa('0x89')]=_0x394386||_0x77a831;return _0x3ccfd1;})['then'](respondWithFilteredResult(_0x35cf5a,_0x2799e7))['catch'](handleError(_0x35cf5a,null));};exports[_0xb5fa('0x8d')]=function(_0x4cba86,_0x5d11bb){var _0x4e2253=[_0xb5fa('0x8e'),'chat',_0xb5fa('0x8f'),_0xb5fa('0x90'),_0xb5fa('0x91'),'whatsapp','voice'];var _0xb1fcac={'count':0x0,'rows':[]},_0x2abe24={},_0x4c70d1,_0x2d0c95,_0x3c7cb4,_0x244892,_0x2aaa2c;Promise['resolve']()[_0xb5fa('0x16')](function(){if(_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x92')]){if(!_[_0xb5fa('0x93')](_0x4e2253,_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x92')][_0xb5fa('0x94')]()))throw new Error('Invalid\x20channel');_0x4c70d1=_0x4cba86[_0xb5fa('0x7f')]['channel'][_0xb5fa('0x94')]();}var _0x45790c=_['startCase'](_0x4c70d1)+_0xb5fa('0x47');var _0x212d4e=_[_0xb5fa('0x39')](db[_0x45790c][_0xb5fa('0x95')],function(_0x3034b0){return{'name':_0x3034b0[_0xb5fa('0x7b')],'type':_0x3034b0[_0xb5fa('0x7c')][_0xb5fa('0x96')]};});_0x2abe24=qs['getOptions'](_0x212d4e,_0x4cba86);if(_0x4cba86[_0xb5fa('0x82')][_0xb5fa('0x7d')]===_0xb5fa('0x82')){var _0x20ffa1={'params':{'id':_0x4cba86['user']['userProfileId']},'query':{'section':_0x4c70d1==='voice'&&_0x4cba86['query'][_0xb5fa('0x7c')]===_0xb5fa('0x26')?_0xb5fa('0x97'):_[_0xb5fa('0x1c')](_0x4c70d1)+'Queues','type':_0x4cba86['query'][_0xb5fa('0x7c')],'nolimit':!![],'sort':'name','filter':_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x3e')]}};return db[_0xb5fa('0x86')][_0xb5fa('0x87')](_0x20ffa1);}return db[_0x45790c]['findAndCountAll'](_0x2abe24);})[_0xb5fa('0x16')](function(_0x5c6b09){_0xb1fcac[_0xb5fa('0xb')]=_0x5c6b09[_0xb5fa('0xb')];_0x2d0c95=_0x5c6b09['rows'];return getRealtimeQueues(_0x4cba86,_0x4c70d1);})['then'](function(_0x391412){_0x244892=_0x391412[_0xb5fa('0x89')];return getRealtimeAgents();})[_0xb5fa('0x16')](function(_0x1bcca7){_0x3c7cb4=_0x1bcca7[_0xb5fa('0x89')];if(_0x4c70d1!=_0xb5fa('0x1b'))return;return getRealtimeVoiceQueueChannels();})[_0xb5fa('0x16')](function(_0x25b278){_0x2aaa2c=_0x25b278?_0x25b278[_0xb5fa('0x89')]:[];return initializeQueues(_0x2d0c95,_0x244892,_0x4c70d1,_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x7c')]);})[_0xb5fa('0x16')](function(_0x86dfe9){var _0x53c7b5=_0x86dfe9['map'](function(_0x3dd9ab){if(_0x4c70d1==='voice')return getVoiceQueueAgents(_0x3dd9ab,_0x2d0c95,_0x3c7cb4,_0x2aaa2c);else return getQueueAgents(_0x3dd9ab,_0x3c7cb4,_0x4c70d1);});return Promise[_0xb5fa('0x98')](_0x53c7b5);})[_0xb5fa('0x16')](function(_0x502946){_0xb1fcac[_0xb5fa('0x89')]=_0x502946;return _0xb1fcac;})[_0xb5fa('0x16')](respondWithFilteredResult(_0x5d11bb,_0x2abe24))['catch'](handleError(_0x5d11bb,null));}; \ No newline at end of file +var _0xfdbd=['loggedIn','voice','busy','find','pick','filter','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','agents','User','Queue','QueueId','idle','unknown','isNil','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','smsPause','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','fieldName','query','getOptions','raw','user','userProfileId','agent','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','mail','chat','sms','resolve','channel','includes','Invalid\x20channel','toLowerCase','rawAttributes','type','QueueCampaigns','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','offset','status','set','json','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','outbound','push','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','paused','loggedInDb'];(function(_0x575730,_0x1862bb){var _0x4c2e0c=function(_0x54625f){while(--_0x54625f){_0x575730['push'](_0x575730['shift']());}};_0x4c2e0c(++_0x1862bb);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xfdbd[_0x2c3255];return _0x282aba;};'use strict';var util=require(_0xdfdb('0x0'));var _=require(_0xdfdb('0x1'));var jayson=require(_0xdfdb('0x2'));var qs=require(_0xdfdb('0x3'));var logger=require(_0xdfdb('0x4'))(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var amiClient=jayson[_0xdfdb('0x7')][_0xdfdb('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0xdfdb('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x4a4a3f,_0x453ef6){return function(_0x41bd5e){if(_0x41bd5e){var _0x489f19=typeof _0x453ef6['offset']==='undefined'&&typeof _0x453ef6[_0xdfdb('0x9')]===_0xdfdb('0xa');var _0x47c629=_0x41bd5e[_0xdfdb('0xb')];var _0x444c19=_0x489f19?0x0:_0x453ef6[_0xdfdb('0xc')];var _0x27ddcd=_0x489f19?_0x41bd5e[_0xdfdb('0xb')]:_0x453ef6[_0xdfdb('0xc')]+_0x453ef6[_0xdfdb('0x9')];var _0x47dccc;if(_0x27ddcd>=_0x47c629){_0x27ddcd=_0x47c629;_0x47dccc=0xc8;}else{_0x47dccc=0xce;}_0x4a4a3f[_0xdfdb('0xd')](_0x47dccc);return _0x4a4a3f[_0xdfdb('0xe')]('Content-Range',_0x444c19+'-'+_0x27ddcd+'/'+_0x47c629)[_0xdfdb('0xf')](_0x41bd5e);}return null;};}function handleError(_0x33a706,_0x2bee3b){_0x2bee3b=_0x2bee3b||0x1f4;return function(_0x1918c1){logger[_0xdfdb('0x10')](_0x1918c1[_0xdfdb('0x11')]);if(_0x1918c1[_0xdfdb('0x12')]){delete _0x1918c1[_0xdfdb('0x12')];}_0x33a706['status'](_0x2bee3b)['send'](_0x1918c1);};}function getRealtimeAgents(){return new Promise(function(_0x2c44dc,_0x4b1ff7){return amiClient[_0xdfdb('0x13')](_0xdfdb('0x14'),{})[_0xdfdb('0x15')](function(_0x40bc8a){if(_0x40bc8a[_0xdfdb('0x10')])throw new Error(_0xdfdb('0x16'));var _0x54ff23=_0x40bc8a['result'];return routingClient[_0xdfdb('0x13')](_0xdfdb('0x14'),{})[_0xdfdb('0x15')](function(_0x55ab5a){if(_0x55ab5a[_0xdfdb('0x10')])throw new Error(_0xdfdb('0x17'));var _0x467653=_0x55ab5a[_0xdfdb('0x18')];return _0x2c44dc(_[_0xdfdb('0x19')]({},_0x54ff23,_0x467653));});})[_0xdfdb('0x1a')](function(_0x693a2c){_0x4b1ff7(_0x693a2c);});});}function getRealtimeQueues(_0x29a639,_0x5b8cb5){return new Promise(function(_0x14638a,_0xb7417c){var _0x172c63=_0x5b8cb5==='voice'?amiClient:routingClient;return _0x172c63[_0xdfdb('0x13')](_[_0xdfdb('0x1b')](_0x5b8cb5)+_0xdfdb('0x1c'),_0x29a639)['then'](function(_0x280e53){if(_0x280e53[_0xdfdb('0x10')])throw new Error(util[_0xdfdb('0x1d')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5b8cb5));return _0x14638a(_0x280e53[_0xdfdb('0x18')]);})['catch'](function(_0x2db1c1){_0xb7417c(_0x2db1c1);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x145350,_0x1fa2f3){return amiClient[_0xdfdb('0x13')]('VoiceQueuesChannels',{})[_0xdfdb('0x15')](function(_0x4363d8){if(_0x4363d8[_0xdfdb('0x10')])throw new Error(_0xdfdb('0x1e'));return _0x145350(_0x4363d8[_0xdfdb('0x18')]);})[_0xdfdb('0x1a')](function(_0x57d24f){_0x1fa2f3(_0x57d24f);});});}function initializeQueues(_0xec4d22,_0x2d5fe2,_0xdf3a5c,_0x4f8057){var _0x466932=['loggedIn',_0xdfdb('0x1f'),_0xdfdb('0x20'),_0xdfdb('0x21'),'paused'];if(_0xdf3a5c==='voice'&&_0x4f8057===_0xdfdb('0x22')){_0x466932[_0xdfdb('0x23')](_0xdfdb('0x24'),_0xdfdb('0x25'),_0xdfdb('0x26'),_0xdfdb('0x27'),'dialMethod',_0xdfdb('0x28'),_0xdfdb('0x29'),_0xdfdb('0x2a'),_0xdfdb('0x2b'),_0xdfdb('0x2c'),_0xdfdb('0x2d'),_0xdfdb('0x2e'),_0xdfdb('0x2f'),_0xdfdb('0x30'),_0xdfdb('0x31'),_0xdfdb('0x32'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xdfdb('0x33'),'predictiveIntervalDroppedCallsCallersExit',_0xdfdb('0x34'),_0xdfdb('0x35'));}return _0xec4d22[_0xdfdb('0x36')](function(_0x36d91f){var _0x514232=_0x36d91f[_0xdfdb('0x37')]({'plain':!![]});_0x514232['agents']=[];_0x514232[_0xdfdb('0x38')]=0x0;_0x514232[_0xdfdb('0x39')]=0x0;_0x514232[_0xdfdb('0x3a')]=0x0;_0x514232[_0xdfdb('0x1f')]=0x0;_0x514232[_0xdfdb('0x20')]=0x0;if(_0xdf3a5c===_0xdfdb('0x3b')){_0x514232['talking']=0x0;_0x514232[_0xdfdb('0x3c')]=0x0;if(_0x4f8057===_0xdfdb('0x22')){_0x514232['pTalking']=0x0;_0x514232[_0xdfdb('0x25')]=0x0;}}var _0x4377d6=_[_0xdfdb('0x3d')](_0x2d5fe2,['id',_0x514232['id']]);if(_0x4377d6)_[_0xdfdb('0x19')](_0x514232,_[_0xdfdb('0x3e')](_0x4377d6,_0x466932));return _0x514232;});}function updateAgentVoiceStatus(_0x286fdb,_0x16d5b8,_0x1d1f4f){var _0x21f4c7=_[_0xdfdb('0x3f')](_0x1d1f4f,[_0xdfdb('0x40'),_0x16d5b8['name']]);if(_0x21f4c7[_0xdfdb('0x41')]===0x0)return _0x286fdb[_0xdfdb('0x3c')]=!![];if(_[_0xdfdb('0x42')](_0x21f4c7,[_0xdfdb('0x43'),_0x286fdb[_0xdfdb('0x44')][_0xdfdb('0x45')]()]))return _0x286fdb[_0xdfdb('0x21')]=!![];if(!_0x286fdb[_0xdfdb('0x21')])return _0x286fdb['busy']=!![];}function getVoiceQueueAgents(_0x55d707,_0x435557,_0x2146b2,_0x16e100){var _0x1e7688=_[_0xdfdb('0x3d')](_0x435557,['id',_0x55d707['id']]);if(!_0x1e7688)return _0x55d707;return _0x1e7688[_0xdfdb('0x46')]({'raw':!![]})[_0xdfdb('0x15')](function(_0x2eb46c){for(var _0xcee274=0x0;_0xcee274<_0x2eb46c['length'];_0xcee274++){var _0x175f57=_[_0xdfdb('0x3d')](_0x2146b2,['id',_0x2eb46c[_0xcee274][_0xdfdb('0x47')]]);if(!_0x175f57){_0x175f57={'id':_0x2eb46c[_0xcee274][_0xdfdb('0x47')],'name':_0x2eb46c[_0xcee274][_0xdfdb('0x47')],'accountcode':'','online':![]};}var _0x5a1bee={'id':_0x175f57['id'],'name':_0x175f57[_0xdfdb('0x12')],'internal':_0x175f57[_0xdfdb('0x48')],'online':Boolean(_0x175f57[_0xdfdb('0x49')]),'paused':Boolean(_0x2eb46c[_0xcee274][_0xdfdb('0x38')])};if(_0x175f57[_0xdfdb('0x4a')]==='talking')updateAgentVoiceStatus(_0x5a1bee,_0x55d707,_0x16e100);if(_0x5a1bee[_0xdfdb('0x49')])_0x55d707[_0xdfdb('0x39')]++;if(_0x5a1bee[_0xdfdb('0x3c')])_0x55d707['busy']++;if(_0x5a1bee[_0xdfdb('0x38')]&&!_0x5a1bee['busy']&&!_0x5a1bee[_0xdfdb('0x21')])_0x55d707['paused']++;_0x55d707[_0xdfdb('0x4b')][_0xdfdb('0x23')](_0x5a1bee);}return _0x55d707;});}function getQueueAgents(_0x5c14a1,_0xc92f82,_0x4e8ead){var _0xfea790=_0xdfdb('0x4c')+_[_0xdfdb('0x1b')](_0x4e8ead)+_0xdfdb('0x4d');var _0x25cc2f=_0x4e8ead+'Pause';return db[_0xfea790]['findAll']({'where':{[_[_0xdfdb('0x1b')](_0x4e8ead)+_0xdfdb('0x4e')]:_0x5c14a1['id']},'raw':!![]})['then'](function(_0x2b0a8b){for(var _0x59d0c3=0x0;_0x59d0c3<_0x2b0a8b[_0xdfdb('0x41')];_0x59d0c3++){var _0x158407=_[_0xdfdb('0x3d')](_0xc92f82,['id',_0x2b0a8b[_0x59d0c3][_0xdfdb('0x47')]]);if(!_0x158407){_0x158407={'id':_0x2b0a8b[_0x59d0c3][_0xdfdb('0x47')],'name':_0x2b0a8b[_0x59d0c3][_0xdfdb('0x47')],'online':![],['pauseField']:![]};}var _0x41701c={'id':_0x158407['id'],'name':_0x158407[_0xdfdb('0x12')],'online':Boolean(_0x158407[_0xdfdb('0x49')]),'paused':Boolean(_0x158407[_0x25cc2f])};if(_0x41701c[_0xdfdb('0x49')])_0x5c14a1[_0xdfdb('0x39')]++;_0x5c14a1[_0xdfdb('0x4b')][_0xdfdb('0x23')](_0x41701c);}return _0x5c14a1;});}function isIdle(_0x202c25){return _0x202c25===_0xdfdb('0x4f')||_0x202c25===_0xdfdb('0x50')||_0x202c25==='unavailable'||_0x202c25==='ringing'||_[_0xdfdb('0x51')](_0x202c25);}function isAgentPaused(_0x1aff71,_0x2f1d06){var _0x4bbb88=[_0x1aff71[_0xdfdb('0x52')],_0x1aff71[_0xdfdb('0x53')],_0x1aff71[_0xdfdb('0x54')],_0x1aff71[_0xdfdb('0x55')],_0x1aff71['smsPause'],_0x1aff71[_0xdfdb('0x56')],_0x1aff71[_0xdfdb('0x57')]];if(!_0x2f1d06)return _['every'](_0x4bbb88);var _0x3a6ce2=_[_0xdfdb('0x3f')](_0x4bbb88);return _0x3a6ce2[_0xdfdb('0x41')]>0x0&&_0x3a6ce2[_0xdfdb('0x41')]<_0x4bbb88[_0xdfdb('0x41')]?!![]:![];}function isAgentIdle(_0x10b490){if(_0x10b490[_0xdfdb('0x4a')]!==_0xdfdb('0x4f')&&_0x10b490[_0xdfdb('0x56')]){_0x10b490['voiceStatus']=_0xdfdb('0x58');return![];}return _['every']([_0x10b490[_0xdfdb('0x59')],_0x10b490[_0xdfdb('0x5a')],_0x10b490[_0xdfdb('0x5b')],_0x10b490[_0xdfdb('0x5c')],_0x10b490[_0xdfdb('0x5d')],_0x10b490[_0xdfdb('0x4a')],_0x10b490[_0xdfdb('0x5e')]],isIdle);}function getAgentStatus(_0x480e98){var _0x2a5803=_0xdfdb('0x50');if(isAgentPaused(_0x480e98))_0x2a5803=_0xdfdb('0x58');else if(isAgentPaused(_0x480e98,!![]))_0x2a5803=_0xdfdb('0x5f');else if(isAgentIdle(_0x480e98))_0x2a5803=_0xdfdb('0x4f');else _0x2a5803='busy';return _0x2a5803;}exports[_0xdfdb('0x60')]=function(_0x4df3b6,_0x9bbf0e){var _0x1331eb={'count':0x0,'rows':[]},_0xdd48cd={},_0x6d7407,_0x3f10fe,_0x5e7388=[_0xdfdb('0x61'),'online',_0xdfdb('0x62'),_0xdfdb('0x63'),_0xdfdb('0x64'),'lastPauseAt',_0xdfdb('0x44'),_0xdfdb('0x65'),_0xdfdb('0x52'),_0xdfdb('0x55'),_0xdfdb('0x54'),_0xdfdb('0x66'),'whatsappPause','faxPause',_0xdfdb('0x56'),'chatCapacity','openchannelCapacity','mailCapacity',_0xdfdb('0x67'),_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e'),_0xdfdb('0x6f'),'chatStatus','openchannelStatus',_0xdfdb('0x5b'),'smsStatus',_0xdfdb('0x5e'),_0xdfdb('0x5a'),_0xdfdb('0x4a'),'chatStatusTime',_0xdfdb('0x70'),_0xdfdb('0x71'),_0xdfdb('0x72'),_0xdfdb('0x73'),_0xdfdb('0x74'),_0xdfdb('0x75'),_0xdfdb('0x40'),_0xdfdb('0x76'),'screenrecording',_0xdfdb('0x77'),_0xdfdb('0x78'),'routealias'],_0x3fbbb5=[_0xdfdb('0x52'),_0xdfdb('0x55'),_0xdfdb('0x54'),_0xdfdb('0x66'),'whatsappPause','faxPause',_0xdfdb('0x56'),_0xdfdb('0x49')];Promise['resolve']()[_0xdfdb('0x15')](function(){var _0x2b8776=_[_0xdfdb('0x36')](db['User']['rawAttributes'],function(_0x42ad97){return{'name':_0x42ad97[_0xdfdb('0x79')],'type':_0x42ad97['type']['key']};});_0x4df3b6[_0xdfdb('0x7a')]['role']='agent';_0x4df3b6[_0xdfdb('0x7a')]['online']=!![];_0xdd48cd=qs[_0xdfdb('0x7b')](_0x2b8776,_0x4df3b6);_0xdd48cd[_0xdfdb('0x7c')]=!![];if(_0x4df3b6['user']['role']===_0xdfdb('0x7d')){var _0x2a218a={'params':{'id':_0x4df3b6['user'][_0xdfdb('0x7e')]},'query':{'section':_0xdfdb('0x14'),'role':_0xdfdb('0x7f'),'online':!![],'nolimit':_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x80')],'sort':_0x4df3b6['query']['sort'],'filter':_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x3f')],'raw':!![]}};return db[_0xdfdb('0x81')][_0xdfdb('0x82')](_0x2a218a);}return db[_0xdfdb('0x4c')][_0xdfdb('0x83')](_0xdd48cd);})['then'](function(_0xd226af){_0x1331eb[_0xdfdb('0xb')]=_0xd226af[_0xdfdb('0xb')];_0x6d7407=_0xd226af[_0xdfdb('0x84')];return getRealtimeAgents();})[_0xdfdb('0x15')](function(_0x1bcfdd){_0x3f10fe=_0x1bcfdd[_0xdfdb('0x84')];return _0x6d7407[_0xdfdb('0x36')](function(_0x38fa9c){var _0x3eca7f=_['find'](_0x3f10fe,['id',_0x38fa9c['id']]);if(_0x3eca7f)_[_0xdfdb('0x19')](_0x38fa9c,_[_0xdfdb('0x3e')](_[_0xdfdb('0x85')](_0x3eca7f,_0x3fbbb5),_0x5e7388));_0x38fa9c[_0xdfdb('0x86')]=getAgentStatus(_0x38fa9c);return _0x38fa9c;});})[_0xdfdb('0x15')](function(_0x590a16){if(_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x87')]){var _0x234882=_[_0xdfdb('0x3f')](_0x590a16,['globalStatus',_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x87')]]);if(_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x88')]){_0x234882=_[_0xdfdb('0x3f')](_0x234882,[_0xdfdb('0x64'),_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x88')]]);}}_0x1331eb[_0xdfdb('0x84')]=_0x234882||_0x590a16;return _0x1331eb;})[_0xdfdb('0x15')](respondWithFilteredResult(_0x9bbf0e,_0xdd48cd))[_0xdfdb('0x1a')](handleError(_0x9bbf0e,null));};exports['getQueues']=function(_0x1bf0d2,_0x616d29){var _0x5ad38a=[_0xdfdb('0x89'),_0xdfdb('0x8a'),_0xdfdb('0x8b'),'openchannel','fax','whatsapp',_0xdfdb('0x3b')];var _0x465565={'count':0x0,'rows':[]},_0x1c7964={},_0x8e68a8,_0xd4b817,_0x394536,_0xf60176,_0x4b2c31;Promise[_0xdfdb('0x8c')]()[_0xdfdb('0x15')](function(){if(_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x8d')]){if(!_[_0xdfdb('0x8e')](_0x5ad38a,_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x8d')]['toLowerCase']()))throw new Error(_0xdfdb('0x8f'));_0x8e68a8=_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x8d')][_0xdfdb('0x90')]();}var _0x275e5f=_['startCase'](_0x8e68a8)+_0xdfdb('0x4d');var _0x56a633=_[_0xdfdb('0x36')](db[_0x275e5f][_0xdfdb('0x91')],function(_0x18c6d1){return{'name':_0x18c6d1[_0xdfdb('0x79')],'type':_0x18c6d1[_0xdfdb('0x92')]['key']};});_0x1c7964=qs[_0xdfdb('0x7b')](_0x56a633,_0x1bf0d2);if(_0x1bf0d2[_0xdfdb('0x7d')]['role']==='user'){var _0x284439={'params':{'id':_0x1bf0d2['user']['userProfileId']},'query':{'section':_0x8e68a8===_0xdfdb('0x3b')&&_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x92')]===_0xdfdb('0x22')?_0xdfdb('0x93'):_[_0xdfdb('0x1b')](_0x8e68a8)+_0xdfdb('0x1c'),'type':_0x1bf0d2[_0xdfdb('0x7a')]['type'],'nolimit':!![],'sort':_0xdfdb('0x12'),'filter':_0x1bf0d2['query'][_0xdfdb('0x3f')]}};return db[_0xdfdb('0x81')][_0xdfdb('0x82')](_0x284439);}return db[_0x275e5f][_0xdfdb('0x83')](_0x1c7964);})[_0xdfdb('0x15')](function(_0x52a8a5){_0x465565[_0xdfdb('0xb')]=_0x52a8a5[_0xdfdb('0xb')];_0xd4b817=_0x52a8a5[_0xdfdb('0x84')];return getRealtimeQueues(_0x1bf0d2,_0x8e68a8);})[_0xdfdb('0x15')](function(_0x36241c){_0xf60176=_0x36241c['rows'];return getRealtimeAgents();})['then'](function(_0x231f20){_0x394536=_0x231f20[_0xdfdb('0x84')];if(_0x8e68a8!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xdfdb('0x15')](function(_0x50d5d4){_0x4b2c31=_0x50d5d4?_0x50d5d4[_0xdfdb('0x84')]:[];return initializeQueues(_0xd4b817,_0xf60176,_0x8e68a8,_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x92')]);})['then'](function(_0x2828a5){var _0x53ca83=_0x2828a5['map'](function(_0x3eb36e){if(_0x8e68a8==='voice')return getVoiceQueueAgents(_0x3eb36e,_0xd4b817,_0x394536,_0x4b2c31);else return getQueueAgents(_0x3eb36e,_0x394536,_0x8e68a8);});return Promise[_0xdfdb('0x94')](_0x53ca83);})[_0xdfdb('0x15')](function(_0x162eeb){_0x465565[_0xdfdb('0x84')]=_0x162eeb;return _0x465565;})[_0xdfdb('0x15')](respondWithFilteredResult(_0x616d29,_0x1c7964))[_0xdfdb('0x1a')](handleError(_0x616d29,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2cb4c5c..9eabc27 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(_0x3eac74,_0x300383){var _0x365ec9=function(_0xd70261){while(--_0xd70261){_0x3eac74['push'](_0x3eac74['shift']());}};_0x365ec9(++_0x300383);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x9e050,_0x299c51){var _0x324934=function(_0x291ced){while(--_0x291ced){_0x9e050['push'](_0x9e050['shift']());}};_0x324934(++_0x299c51);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6170747..3436417 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 _0xbdb9=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x25ea94,_0x5ddc2a){var _0x10a151=function(_0x4d8188){while(--_0x4d8188){_0x25ea94['push'](_0x25ea94['shift']());}};_0x10a151(++_0x5ddc2a);}(_0xbdb9,0xac));var _0x9bdb=function(_0xe1e1cc,_0x2ad5ec){_0xe1e1cc=_0xe1e1cc-0x0;var _0x2fe248=_0xbdb9[_0xe1e1cc];return _0x2fe248;};'use strict';var Sequelize=require(_0x9bdb('0x0'));module[_0x9bdb('0x1')]={'state':{'type':Sequelize[_0x9bdb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9bdb('0x3')]},'scheduledat':{'type':Sequelize[_0x9bdb('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9bdb('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9bdb('0x3')]}}; \ No newline at end of file +var _0x1883=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x4b6492,_0x287d67){var _0xb16db9=function(_0x3facac){while(--_0x3facac){_0x4b6492['push'](_0x4b6492['shift']());}};_0xb16db9(++_0x287d67);}(_0x1883,0xab));var _0x3188=function(_0x11536c,_0x5dd752){_0x11536c=_0x11536c-0x0;var _0x14cb23=_0x1883[_0x11536c];return _0x14cb23;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'state':{'type':Sequelize[_0x3188('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3188('0x3')]},'scheduledat':{'type':Sequelize[_0x3188('0x4')]},'uniqueid':{'type':Sequelize[_0x3188('0x3')]},'starttime':{'type':Sequelize[_0x3188('0x4')]},'responsetime':{'type':Sequelize[_0x3188('0x4')]},'ringtime':{'type':Sequelize[_0x3188('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3188('0x3')]},'campaigntype':{'type':Sequelize[_0x3188('0x3')]},'membername':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0ae78c4..df2b50a 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 _0x52e0=['request-promise','path','rimraf','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0x52e0,0xde));var _0x052e=function(_0x4b9f85,_0xba7b98){_0x4b9f85=_0x4b9f85-0x0;var _0x140712=_0x52e0[_0x4b9f85];return _0x140712;};'use strict';var _=require(_0x052e('0x0'));var util=require(_0x052e('0x1'));var logger=require(_0x052e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x052e('0x3'));var fs=require('fs');var path=require(_0x052e('0x4'));var rimraf=require(_0x052e('0x5'));var config=require('../../config/environment');var attributes=require(_0x052e('0x6'));module['exports']=function(_0x5f543f,_0x2acac1){return _0x5f543f[_0x052e('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x052e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee7=['report_agent_preview','lodash','util','bluebird','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x4cde9e,_0x57150a){var _0x38df0c=function(_0x50cdb6){while(--_0x50cdb6){_0x4cde9e['push'](_0x4cde9e['shift']());}};_0x38df0c(++_0x57150a);}(_0x4ee7,0x184));var _0x74ee=function(_0x578ba3,_0x5f3e45){_0x578ba3=_0x578ba3-0x0;var _0x3c3094=_0x4ee7[_0x578ba3];return _0x3c3094;};'use strict';var _=require(_0x74ee('0x0'));var util=require(_0x74ee('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x74ee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x74ee('0x3'));var attributes=require(_0x74ee('0x4'));module[_0x74ee('0x5')]=function(_0x150304,_0x116db1){return _0x150304[_0x74ee('0x6')](_0x74ee('0x7'),attributes,{'tableName':_0x74ee('0x8'),'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 ef8b343..48fc0bd 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 _0x2fa8=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','catch','util'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x2fa8,0x1af));var _0x82fa=function(_0x180cb8,_0x51fa2f){_0x180cb8=_0x180cb8-0x0;var _0x50f852=_0x2fa8[_0x180cb8];return _0x50f852;};'use strict';var _=require('lodash');var util=require(_0x82fa('0x0'));var moment=require(_0x82fa('0x1'));var BPromise=require(_0x82fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82fa('0x3'))['db'];var utils=require(_0x82fa('0x4'));var logger=require(_0x82fa('0x5'))(_0x82fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x82fa('0x7'));var client=jayson[_0x82fa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x75d462,_0x3c7944,_0x5e1ed5){return new BPromise(function(_0x2b275f,_0x19521f){return client[_0x82fa('0x9')](_0x75d462,_0x5e1ed5)[_0x82fa('0xa')](function(_0x100919){logger[_0x82fa('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c7944,_0x82fa('0xc'));logger[_0x82fa('0xd')](_0x82fa('0xe'),_0x3c7944,_0x82fa('0xc'),JSON[_0x82fa('0xf')](_0x100919));if(_0x100919[_0x82fa('0x10')]){if(_0x100919[_0x82fa('0x10')][_0x82fa('0x11')]===0x1f4){logger[_0x82fa('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c7944,_0x100919[_0x82fa('0x10')][_0x82fa('0x12')]);return _0x19521f(_0x100919[_0x82fa('0x10')]['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3c7944,_0x100919['error'][_0x82fa('0x12')]);return _0x2b275f(_0x100919[_0x82fa('0x10')][_0x82fa('0x12')]);}else{logger['info'](_0x82fa('0x13'),_0x3c7944,_0x82fa('0xc'));_0x2b275f(_0x100919[_0x82fa('0x14')][_0x82fa('0x12')]);}})['catch'](function(_0x56d57b){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3c7944,_0x56d57b);_0x19521f(_0x56d57b);});});}exports[_0x82fa('0x15')]=function(_0x477a7e){var _0x38c61f=this;return new Promise(function(_0x2012a0,_0x38c930){return db[_0x82fa('0x16')][_0x82fa('0x17')](_0x477a7e['body'],{'raw':_0x477a7e[_0x82fa('0x18')]?_0x477a7e[_0x82fa('0x18')][_0x82fa('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x48435d){logger['info'](_0x82fa('0x15'),_0x477a7e);logger[_0x82fa('0xd')](_0x82fa('0x15'),_0x477a7e,JSON[_0x82fa('0xf')](_0x48435d));_0x2012a0(_0x48435d);})[_0x82fa('0x1a')](function(_0x14f2ce){logger[_0x82fa('0x10')]('CreateReportAgentPreview',_0x14f2ce[_0x82fa('0x12')],_0x477a7e);_0x38c930(_0x38c61f[_0x82fa('0x10')](0x1f4,_0x14f2ce[_0x82fa('0x12')]));});});}; \ No newline at end of file +var _0xf1ad=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2388af,_0x41fe08){var _0x5aca35=function(_0x35e676){while(--_0x35e676){_0x2388af['push'](_0x2388af['shift']());}};_0x5aca35(++_0x41fe08);}(_0xf1ad,0xe2));var _0xdf1a=function(_0x4c63dc,_0x836ede){_0x4c63dc=_0x4c63dc-0x0;var _0x5f1d98=_0xf1ad[_0x4c63dc];return _0x5f1d98;};'use strict';var _=require(_0xdf1a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf1a('0x1'));var rs=require(_0xdf1a('0x2'));var fs=require('fs');var Redis=require(_0xdf1a('0x3'));var db=require(_0xdf1a('0x4'))['db'];var utils=require(_0xdf1a('0x5'));var logger=require(_0xdf1a('0x6'))(_0xdf1a('0x7'));var config=require(_0xdf1a('0x8'));var jayson=require(_0xdf1a('0x9'));var client=jayson[_0xdf1a('0xa')][_0xdf1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcc570c,_0x4df766,_0x108204){return new BPromise(function(_0x41e822,_0x2314ec){return client[_0xdf1a('0xc')](_0xcc570c,_0x108204)[_0xdf1a('0xd')](function(_0xec5b83){logger[_0xdf1a('0xe')](_0xdf1a('0xf'),_0x4df766,'request\x20sent');logger['debug'](_0xdf1a('0x10'),_0x4df766,'request\x20sent',JSON[_0xdf1a('0x11')](_0xec5b83));if(_0xec5b83[_0xdf1a('0x12')]){if(_0xec5b83[_0xdf1a('0x12')][_0xdf1a('0x13')]===0x1f4){logger[_0xdf1a('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x4df766,_0xec5b83[_0xdf1a('0x12')]['message']);return _0x2314ec(_0xec5b83[_0xdf1a('0x12')]['message']);}logger[_0xdf1a('0x12')](_0xdf1a('0xf'),_0x4df766,_0xec5b83['error'][_0xdf1a('0x14')]);return _0x41e822(_0xec5b83[_0xdf1a('0x12')][_0xdf1a('0x14')]);}else{logger['info'](_0xdf1a('0xf'),_0x4df766,'request\x20sent');_0x41e822(_0xec5b83[_0xdf1a('0x15')][_0xdf1a('0x14')]);}})[_0xdf1a('0x16')](function(_0x4f73b0){logger[_0xdf1a('0x12')](_0xdf1a('0xf'),_0x4df766,_0x4f73b0);_0x2314ec(_0x4f73b0);});});}exports[_0xdf1a('0x17')]=function(_0x8df3e1){var _0x281b2f=this;return new Promise(function(_0x5c3b76,_0x4b9dd7){return db[_0xdf1a('0x18')][_0xdf1a('0x19')](_0x8df3e1[_0xdf1a('0x1a')],{'raw':_0x8df3e1[_0xdf1a('0x1b')]?_0x8df3e1[_0xdf1a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xdf1a('0xd')](function(_0x266225){logger[_0xdf1a('0xe')](_0xdf1a('0x17'),_0x8df3e1);logger[_0xdf1a('0x1c')]('CreateReportAgentPreview',_0x8df3e1,JSON['stringify'](_0x266225));_0x5c3b76(_0x266225);})['catch'](function(_0x3b8eb3){logger[_0xdf1a('0x12')]('CreateReportAgentPreview',_0x3b8eb3[_0xdf1a('0x14')],_0x8df3e1);_0x4b9dd7(_0x281b2f[_0xdf1a('0x12')](0x1f4,_0x3b8eb3[_0xdf1a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d64d8ce..e95a309 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 _0x4f9d=['get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller'];(function(_0x5c468e,_0x2be7ac){var _0x4d5336=function(_0x40c57b){while(--_0x40c57b){_0x5c468e['push'](_0x5c468e['shift']());}};_0x4d5336(++_0x2be7ac);}(_0x4f9d,0xe7));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd4f9('0x0'));var util=require(_0xd4f9('0x1'));var path=require(_0xd4f9('0x2'));var express=require(_0xd4f9('0x3'));var router=express['Router']();var auth=require(_0xd4f9('0x4'));var controller=require(_0xd4f9('0x5'));router[_0xd4f9('0x6')]('/voice/channels',auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x8')]);router[_0xd4f9('0x6')](_0xd4f9('0x9'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0xa')]);router[_0xd4f9('0x6')](_0xd4f9('0xb'),auth[_0xd4f9('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xd4f9('0x6')](_0xd4f9('0xc'),auth[_0xd4f9('0x7')](),controller['voiceQueues']);router[_0xd4f9('0x6')](_0xd4f9('0xd'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0xe')]);router[_0xd4f9('0x6')](_0xd4f9('0xf'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x10')]);router[_0xd4f9('0x6')](_0xd4f9('0x11'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x12')]);router['get'](_0xd4f9('0x13'),auth[_0xd4f9('0x7')](),controller['openchannelQueues']);router[_0xd4f9('0x6')](_0xd4f9('0x14'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x15')]);router[_0xd4f9('0x6')](_0xd4f9('0x16'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x17')]);router[_0xd4f9('0x6')](_0xd4f9('0x18'),auth[_0xd4f9('0x7')](),controller['faxQueues']);router[_0xd4f9('0x6')]('/voice/queues/preview/:id',auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x19')]);router['get'](_0xd4f9('0x1a'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x1b')]);router[_0xd4f9('0x6')](_0xd4f9('0x1c'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x1d')]);router['get'](_0xd4f9('0x1e'),auth[_0xd4f9('0x7')](),controller['voiceQueuesChannelHangup']);router[_0xd4f9('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xd4f9('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xd4f9('0x6')]('/voice/queues/:id',auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x1f')]);router[_0xd4f9('0x20')](_0xd4f9('0x21'),auth['isAuthenticated'](),controller[_0xd4f9('0x22')]);router['get'](_0xd4f9('0x23'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x24')]);router[_0xd4f9('0x6')](_0xd4f9('0x25'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x26')]);router[_0xd4f9('0x6')](_0xd4f9('0x27'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x28')]);router[_0xd4f9('0x20')](_0xd4f9('0x29'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x2a')]);router[_0xd4f9('0x6')](_0xd4f9('0x2b'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x2c')]);router[_0xd4f9('0x6')](_0xd4f9('0x2d'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x2e')]);router[_0xd4f9('0x6')](_0xd4f9('0x2f'),auth['isAuthenticated'](),controller[_0xd4f9('0x30')]);router[_0xd4f9('0x6')]('/fax/accounts',auth[_0xd4f9('0x7')](),controller['faxAccounts']);router[_0xd4f9('0x6')](_0xd4f9('0x31'),auth['isAuthenticated'](),controller[_0xd4f9('0x32')]);router['get']('/mail/queues/waitinginteractions',auth[_0xd4f9('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xd4f9('0x6')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xd4f9('0x33'),auth[_0xd4f9('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xd4f9('0x6')](_0xd4f9('0x34'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x35')]);router[_0xd4f9('0x6')](_0xd4f9('0x36'),auth[_0xd4f9('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xd4f9('0x6')](_0xd4f9('0x37'),auth['isAuthenticated'](),controller[_0xd4f9('0x38')]);router['post']('/mail/queues/:id/notify',auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x39')](_0xd4f9('0x3a')));router['get']('/mail/queues/:id',auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x3b')]);router[_0xd4f9('0x3c')](_0xd4f9('0x3d'),auth['isAuthenticated'](),controller[_0xd4f9('0x39')](_0xd4f9('0x3e')));router['get'](_0xd4f9('0x3f'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x40')]);router[_0xd4f9('0x3c')]('/fax/queues/:id/notify',auth[_0xd4f9('0x7')](),controller['queueNotify'](_0xd4f9('0x41')));router[_0xd4f9('0x6')](_0xd4f9('0x42'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x43')]);router['post'](_0xd4f9('0x44'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x39')]('openchannel'));router[_0xd4f9('0x6')](_0xd4f9('0x45'),auth[_0xd4f9('0x7')](),controller[_0xd4f9('0x46')]);router[_0xd4f9('0x3c')]('/sms/queues/:id/notify',auth[_0xd4f9('0x7')](),controller['queueNotify'](_0xd4f9('0x47')));router[_0xd4f9('0x3c')](_0xd4f9('0x48'),auth[_0xd4f9('0x7')](),controller['queueNotify'](_0xd4f9('0x49')));router['get'](_0xd4f9('0x4a'),auth['isAuthenticated'](),controller[_0xd4f9('0x4b')]);router[_0xd4f9('0x6')](_0xd4f9('0x4c'),auth[_0xd4f9('0x7')](),controller['showWhatsappQueues']);router[_0xd4f9('0x3c')](_0xd4f9('0x4d'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xd4f9('0x4e')]=router; \ No newline at end of file +var _0xeb01=['/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','agents','telephones','/trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xeb01,0x1b0));var _0x1eb0=function(_0x2d1992,_0x460a51){_0x2d1992=_0x2d1992-0x0;var _0x38f458=_0xeb01[_0x2d1992];return _0x38f458;};'use strict';var multer=require('multer');var util=require(_0x1eb0('0x0'));var path=require(_0x1eb0('0x1'));var express=require(_0x1eb0('0x2'));var router=express[_0x1eb0('0x3')]();var auth=require(_0x1eb0('0x4'));var controller=require(_0x1eb0('0x5'));router[_0x1eb0('0x6')](_0x1eb0('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x1eb0('0x6')](_0x1eb0('0x8'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0xa')]);router[_0x1eb0('0x6')](_0x1eb0('0xb'),auth['isAuthenticated'](),controller[_0x1eb0('0xc')]);router[_0x1eb0('0x6')](_0x1eb0('0xd'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0xe')]);router[_0x1eb0('0x6')](_0x1eb0('0xf'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x10')]);router[_0x1eb0('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0x1eb0('0x11')]);router[_0x1eb0('0x6')](_0x1eb0('0x12'),auth['isAuthenticated'](),controller[_0x1eb0('0x13')]);router['get'](_0x1eb0('0x14'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x15')]);router[_0x1eb0('0x6')](_0x1eb0('0x16'),auth[_0x1eb0('0x9')](),controller['smsQueues']);router[_0x1eb0('0x6')](_0x1eb0('0x17'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x18')]);router[_0x1eb0('0x6')](_0x1eb0('0x19'),auth['isAuthenticated'](),controller[_0x1eb0('0x1a')]);router[_0x1eb0('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x1eb0('0x1b')]);router['get']('/voice/queues/channels',auth[_0x1eb0('0x9')](),controller['voiceQueuesChannels']);router[_0x1eb0('0x6')](_0x1eb0('0x1c'),auth['isAuthenticated'](),controller[_0x1eb0('0x1d')]);router[_0x1eb0('0x6')](_0x1eb0('0x1e'),auth['isAuthenticated'](),controller[_0x1eb0('0x1f')]);router[_0x1eb0('0x6')](_0x1eb0('0x20'),auth[_0x1eb0('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0x1eb0('0x6')](_0x1eb0('0x21'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x22')]);router[_0x1eb0('0x23')](_0x1eb0('0x21'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x24')]);router[_0x1eb0('0x6')]('/outbound',auth[_0x1eb0('0x9')](),controller['outbound']);router['get'](_0x1eb0('0x25'),auth[_0x1eb0('0x9')](),controller['outboundChannels']);router[_0x1eb0('0x6')]('/agents',auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x26')]);router[_0x1eb0('0x23')]('/agents/:id/capacity',auth[_0x1eb0('0x9')](),controller['agentCapacity']);router[_0x1eb0('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0x1eb0('0x27')]);router[_0x1eb0('0x6')](_0x1eb0('0x28'),auth[_0x1eb0('0x9')](),controller['trunks']);router[_0x1eb0('0x6')](_0x1eb0('0x29'),auth[_0x1eb0('0x9')](),controller['campaigns']);router[_0x1eb0('0x6')](_0x1eb0('0x2a'),auth['isAuthenticated'](),controller['faxAccounts']);router['get'](_0x1eb0('0x2b'),auth[_0x1eb0('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x1eb0('0x6')]('/mail/queues/waitinginteractions',auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x2c')]);router[_0x1eb0('0x6')](_0x1eb0('0x2d'),auth[_0x1eb0('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x1eb0('0x2e'),auth[_0x1eb0('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x1eb0('0x6')](_0x1eb0('0x2f'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x30')]);router[_0x1eb0('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x31')]);router[_0x1eb0('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1eb0('0x32')]);router[_0x1eb0('0x33')](_0x1eb0('0x34'),auth[_0x1eb0('0x9')](),controller['queueNotify'](_0x1eb0('0x35')));router[_0x1eb0('0x6')](_0x1eb0('0x36'),auth[_0x1eb0('0x9')](),controller['showMailQueues']);router['post']('/chat/queues/:id/notify',auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x37')](_0x1eb0('0x38')));router[_0x1eb0('0x6')](_0x1eb0('0x39'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x3a')]);router[_0x1eb0('0x33')](_0x1eb0('0x3b'),auth[_0x1eb0('0x9')](),controller['queueNotify'](_0x1eb0('0x3c')));router[_0x1eb0('0x6')](_0x1eb0('0x3d'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x3e')]);router[_0x1eb0('0x33')](_0x1eb0('0x3f'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x37')](_0x1eb0('0x40')));router['get'](_0x1eb0('0x41'),auth[_0x1eb0('0x9')](),controller['showOpenchannelQueues']);router[_0x1eb0('0x33')]('/sms/queues/:id/notify',auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x37')](_0x1eb0('0x42')));router[_0x1eb0('0x33')](_0x1eb0('0x43'),auth[_0x1eb0('0x9')](),controller['queueNotify'](_0x1eb0('0x44')));router[_0x1eb0('0x6')](_0x1eb0('0x45'),auth['isAuthenticated'](),controller[_0x1eb0('0x46')]);router[_0x1eb0('0x6')](_0x1eb0('0x47'),auth[_0x1eb0('0x9')](),controller[_0x1eb0('0x48')]);router[_0x1eb0('0x33')](_0x1eb0('0x49'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x1eb0('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e5ac814..20bcea1 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 _0xdbf5=['SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Account','QueueId','TransferReport','create','agentNotify','Website','Agent\x20not\x20found','MessageId','Start','moment','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','status','json','stack','name','send','isNil','rows','find','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','interaction','user','MemberReport','findAll','INTERACTION','length','findOrCreate','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x968cc9,_0x27253c){_0x968cc9=_0x968cc9-0x0;var _0x39ca97=_0xdbf5[_0x968cc9];return _0x39ca97;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5dbf('0x0'));var _=require('lodash');var util=require('util');var db=require(_0x5dbf('0x1'))['db'];var logger=require(_0x5dbf('0x2'))(_0x5dbf('0x3'));var jayson=require(_0x5dbf('0x4'));var amiClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232a});var mailClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232b});var routingClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){var _0x501cb1=_0x93e657?_0x93e657:amiClient;return _0x501cb1[_0x5dbf('0x7')](_0x209b7d,_0x88128e)[_0x5dbf('0x8')](function(_0x264007){if(_0x264007[_0x5dbf('0x9')]){if(_0x264007['error'][_0x5dbf('0xa')]===0x1f4){return _0x134810(_0x264007['error']['message']);}return _0x52b039(_0x264007[_0x5dbf('0x9')]['message']);}else{_0x52b039(_0x264007['result']);}})[_0x5dbf('0xb')](function(_0x490b38){_0x134810(_0x490b38);});});}function respondWithResult(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xc8;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0xc')](_0x2bb7ed)[_0x5dbf('0xd')](_0x1453a9);}return _0x182cec['sendStatus'](0x194);};}function handleError(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0x1f4;return function(_0x3480c8){logger['error'](_0x3480c8[_0x5dbf('0xe')]);if(_0x3480c8[_0x5dbf('0xf')]){delete _0x3480c8[_0x5dbf('0xf')];}_0x4803ca[_0x5dbf('0xc')](_0x2b4e1c)[_0x5dbf('0x10')](_0x3480c8);};}function findById(_0x472eb9){return function(_0x2d32cc){if(!_['isNil'](_0x472eb9)&&!_['isNil'](_0x2d32cc)&&!_[_0x5dbf('0x11')](_0x2d32cc[_0x5dbf('0x12')])){return _[_0x5dbf('0x13')](_0x2d32cc[_0x5dbf('0x12')],function(_0x20c2b0){return _0x20c2b0['id']==_0x472eb9;});}return null;};}exports['voiceChannels']=function(_0x11cd00,_0x4dd03c){return respondWithRpcPromise('VoiceChannels',_0x11cd00['query'])[_0x5dbf('0x8')](respondWithResult(_0x4dd03c,null))[_0x5dbf('0xb')](handleError(_0x4dd03c,null));};exports[_0x5dbf('0x14')]=function(_0x2ab57c,_0x1e3cce){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x5dbf('0x15')](_0x2ab57c['query'],_0x2ab57c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x1e3cce,null))[_0x5dbf('0xb')](handleError(_0x1e3cce,null));};exports[_0x5dbf('0x17')]=function(_0x3b763c,_0x2f154e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x5dbf('0x15')](_0x3b763c[_0x5dbf('0x18')],_0x3b763c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x2f154e,null))[_0x5dbf('0xb')](handleError(_0x2f154e,null));};exports[_0x5dbf('0x19')]=function(_0x290456,_0x20ab1b){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x290456[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x20ab1b,null))[_0x5dbf('0xb')](handleError(_0x20ab1b,null));};exports[_0x5dbf('0x1b')]=function(_0x407741,_0x729d8f){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x407741[_0x5dbf('0x18')])[_0x5dbf('0x8')](findById(_0x407741[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x729d8f,null))[_0x5dbf('0xb')](handleError(_0x729d8f,null));};exports[_0x5dbf('0x1c')]=function(_0x21cd00,_0x5768b7){return respondWithRpcPromise(_0x5dbf('0x1d'),_[_0x5dbf('0x15')](_0x21cd00[_0x5dbf('0x1e')],_0x21cd00[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x5768b7,null))[_0x5dbf('0xb')](handleError(_0x5768b7,null));};exports[_0x5dbf('0x1f')]=function(_0x31d57a,_0x406ce6){return respondWithRpcPromise(_0x5dbf('0x20'),_[_0x5dbf('0x15')](_0x31d57a['query'],_0x31d57a['params']))[_0x5dbf('0x8')](respondWithResult(_0x406ce6,null))[_0x5dbf('0xb')](handleError(_0x406ce6,null));};exports[_0x5dbf('0x21')]=function(_0x3b73ad,_0x37cf25){return respondWithRpcPromise('VoiceQueuesChannels',_0x3b73ad['query'])[_0x5dbf('0x8')](respondWithResult(_0x37cf25,null))[_0x5dbf('0xb')](handleError(_0x37cf25,null));};exports['voiceQueuesChannel']=function(_0x3531a2,_0x2a0491){return respondWithRpcPromise(_0x5dbf('0x22'),_[_0x5dbf('0x15')](_0x3531a2[_0x5dbf('0x18')],_0x3531a2['params']))[_0x5dbf('0x8')](respondWithResult(_0x2a0491,null))[_0x5dbf('0xb')](handleError(_0x2a0491,null));};exports[_0x5dbf('0x23')]=function(_0x273577,_0x3a8196){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x5dbf('0x15')](_0x273577[_0x5dbf('0x18')],_0x273577[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x3a8196,null))['catch'](handleError(_0x3a8196,null));};exports[_0x5dbf('0x24')]=function(_0x1e9a4e,_0x302dda){return respondWithRpcPromise(_0x5dbf('0x25'),_[_0x5dbf('0x15')](_0x1e9a4e[_0x5dbf('0x18')],_0x1e9a4e[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x302dda,null))[_0x5dbf('0xb')](handleError(_0x302dda,null));};exports[_0x5dbf('0x26')]=function(_0x1ba835,_0x51c667){return respondWithRpcPromise(_0x5dbf('0x27'),_0x1ba835[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x51c667,null))['catch'](handleError(_0x51c667,null));};exports[_0x5dbf('0x28')]=function(_0x43954b,_0x2e4e67){return respondWithRpcPromise('OutboundChannels',_0x43954b[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x2e4e67,null))[_0x5dbf('0xb')](handleError(_0x2e4e67,null));};exports['agents']=function(_0x4527fb,_0x29a62d){var _0x2ac162;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb[_0x5dbf('0x18')])[_0x5dbf('0x8')](function(_0x321ae3){_0x2ac162=_0x321ae3;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb['query'],routingClient);})['then'](function(_0x57ee72){return _['merge']({},_0x57ee72,_0x2ac162);})[_0x5dbf('0x8')](respondWithResult(_0x29a62d,null))[_0x5dbf('0xb')](handleError(_0x29a62d,null));};exports['agentCapacity']=function(_0x3ef0eb,_0x229abf){if(_0x3ef0eb['body']&&_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]&&_0x3ef0eb[_0x5dbf('0x2b')]&&_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]){for(var _0x7c390d in _0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]){if(_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]['hasOwnProperty'](_0x7c390d)){db[_0x5dbf('0x2c')][_0x5dbf('0x2d')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'exitAt':null,'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d]&&_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x5dbf('0x2f')]?{'$notIn':_0x3ef0eb['body'][_0x5dbf('0x2a')][_0x7c390d]}:{'$ne':null}}})[_0x5dbf('0x8')](function(_0x2d046b){var _0xcc1815=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x118ae6=0x0,_0x43f5e8=_0x2d046b[_0x5dbf('0x2f')];_0x118ae6<_0x43f5e8;_0x118ae6+=0x1){_0x2d046b[_0x118ae6]['updateAttributes']({'exitAt':_0xcc1815});}});for(var _0x2e241d=0x0;_0x2e241d<_0x3ef0eb['body']['interaction'][_0x7c390d]['length'];_0x2e241d+=0x1){db['MemberReport'][_0x5dbf('0x30')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x2e241d],'exitAt':null},'defaults':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')],'interface':_['isNil'](_0x3ef0eb[_0x5dbf('0x2b')]['interface'])?util['format'](_0x5dbf('0x31'),_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]):_0x3ef0eb['user']['interface'],'type':_0x5dbf('0x2e'),'enterAt':moment()[_0x5dbf('0x32')](_0x5dbf('0x33')),'role':_0x5dbf('0x34'),'internal':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0x35')],'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d][_0x2e241d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3ef0eb[_0x5dbf('0x16')]['id'],'capacity':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x36')]},routingClient)[_0x5dbf('0x8')](respondWithResult(_0x229abf,null))[_0x5dbf('0xb')](handleError(_0x229abf,null));};exports[_0x5dbf('0x37')]=function(_0x328dc5,_0x59f825){return respondWithRpcPromise(_0x5dbf('0x38'),_0x328dc5['query'])[_0x5dbf('0x8')](respondWithResult(_0x59f825,null))[_0x5dbf('0xb')](handleError(_0x59f825,null));};exports[_0x5dbf('0x39')]=function(_0x770c54,_0x78ab84){return respondWithRpcPromise(_0x5dbf('0x3a'),_0x770c54[_0x5dbf('0x18')])['then'](respondWithResult(_0x78ab84,null))['catch'](handleError(_0x78ab84,null));};exports['campaigns']=function(_0x1e1876,_0xfdacc7){return respondWithRpcPromise(_0x5dbf('0x3b'),_0x1e1876['query'])['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0xb')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x3c')]=function(_0x344df5,_0x5d70cc){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x344df5['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5d70cc,null))[_0x5dbf('0xb')](handleError(_0x5d70cc,null));};exports[_0x5dbf('0x3e')]=function(_0x5da14b,_0x55fd51){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x5da14b[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x5da14b[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0x55fd51,null))[_0x5dbf('0xb')](handleError(_0x55fd51,null));};exports[_0x5dbf('0x3f')]=function(_0x478cc1,_0x5485f3){return respondWithRpcPromise(_0x5dbf('0x40'),_0x478cc1[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5485f3,null))[_0x5dbf('0xb')](handleError(_0x5485f3,null));};exports[_0x5dbf('0x41')]=function(_0x4711d5,_0x50a029){return respondWithRpcPromise(_0x5dbf('0x40'),_0x4711d5['query'],routingClient)['then'](findById(_0x4711d5['params']['id']))[_0x5dbf('0x8')](respondWithResult(_0x50a029,null))['catch'](handleError(_0x50a029,null));};exports[_0x5dbf('0x42')]=function(_0x275c1d,_0x1c60ac){return respondWithRpcPromise(_0x5dbf('0x43'),_0x275c1d[_0x5dbf('0x18')],mailClient)[_0x5dbf('0x8')](respondWithResult(_0x1c60ac,null))[_0x5dbf('0xb')](handleError(_0x1c60ac,null));};exports[_0x5dbf('0x44')]=function(_0x2c84d6,_0x1d91de){return respondWithRpcPromise(_0x5dbf('0x45'),_0x2c84d6[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1d91de,null))[_0x5dbf('0xb')](handleError(_0x1d91de,null));};exports[_0x5dbf('0x46')]=function(_0x53ab1a,_0x3fbc3d){return respondWithRpcPromise('OpenchannelQueues',_0x53ab1a[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x53ab1a[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3fbc3d,null))['catch'](handleError(_0x3fbc3d,null));};exports[_0x5dbf('0x47')]=function(_0x1ade34,_0x4362c6){return respondWithRpcPromise(_0x5dbf('0x48'),_0x1ade34[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x4362c6,null))['catch'](handleError(_0x4362c6,null));};exports[_0x5dbf('0x49')]=function(_0x3e5a96,_0x3b0465){return respondWithRpcPromise(_0x5dbf('0x48'),_0x3e5a96[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x3e5a96[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3b0465,null))[_0x5dbf('0xb')](handleError(_0x3b0465,null));};exports[_0x5dbf('0x4a')]=function(_0x13c8ab,_0x2997a8){return respondWithRpcPromise('WhatsappQueues',_0x13c8ab['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x2997a8,null))[_0x5dbf('0xb')](handleError(_0x2997a8,null));};exports[_0x5dbf('0x4b')]=function(_0x110713,_0xc000ee){return respondWithRpcPromise(_0x5dbf('0x4c'),_0x110713[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x110713[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0xc000ee,null))['catch'](handleError(_0xc000ee,null));};exports['faxQueues']=function(_0x4f4aa3,_0x408b51){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x4f4aa3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x408b51,null))[_0x5dbf('0xb')](handleError(_0x408b51,null));};exports[_0x5dbf('0x4e')]=function(_0x5331ff,_0x5bb990){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x5331ff[_0x5dbf('0x18')],routingClient)['then'](findById(_0x5331ff[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x5bb990,null))[_0x5dbf('0xb')](handleError(_0x5bb990,null));};exports[_0x5dbf('0x4f')]=function(_0x569d9c,_0x431f08){return respondWithRpcPromise(_0x5dbf('0x50'),_0x569d9c[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x431f08,null))[_0x5dbf('0xb')](handleError(_0x431f08,null));};exports['chatQueuesWaitingInteractions']=function(_0x42478c,_0x3fce29){return respondWithRpcPromise(_0x5dbf('0x51'),_0x42478c[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x3fce29,null))[_0x5dbf('0xb')](handleError(_0x3fce29,null));};exports['mailQueuesWaitingInteractions']=function(_0x2ba37f,_0x118e56){return respondWithRpcPromise(_0x5dbf('0x52'),_0x2ba37f['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x118e56,null))[_0x5dbf('0xb')](handleError(_0x118e56,null));};exports[_0x5dbf('0x53')]=function(_0x1270f3,_0x50db0b){return respondWithRpcPromise(_0x5dbf('0x54'),_0x1270f3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x50db0b,null))[_0x5dbf('0xb')](handleError(_0x50db0b,null));};exports[_0x5dbf('0x55')]=function(_0xf84095,_0x560d62){return respondWithRpcPromise(_0x5dbf('0x54'),_0xf84095[_0x5dbf('0x18')],routingClient)['then'](function(_0x30469c){if(_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')]!==undefined){var _0x3457de=_(_0x30469c[_0x5dbf('0x12')])[_0x5dbf('0x57')]([_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')],_0xf84095[_0x5dbf('0x16')]['id']])[_0x5dbf('0x58')](_0x5dbf('0x59'))[_0x5dbf('0x5a')]()[_0x5dbf('0x5b')]();return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x37c1a3){return _0x3457de['indexOf'](_0x37c1a3[_0x5dbf('0x59')])>-0x1;});}else{return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x2e7115){return _0x2e7115['queue_id']===parseInt(_0xf84095[_0x5dbf('0x16')]['id']);});}})[_0x5dbf('0x8')](respondWithResult(_0x560d62,null))[_0x5dbf('0xb')](handleError(_0x560d62,null));};exports[_0x5dbf('0x5c')]=function(_0x1ccdae,_0x525930){return respondWithRpcPromise(_0x5dbf('0x5d'),_0x1ccdae[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x525930,null))['catch'](handleError(_0x525930,null));};exports[_0x5dbf('0x5e')]=function(_0x39c0a7,_0x1efe3f){return respondWithRpcPromise(_0x5dbf('0x5f'),_0x39c0a7[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1efe3f,null))[_0x5dbf('0xb')](handleError(_0x1efe3f,null));};exports['faxQueuesWaitingInteractions']=function(_0x310078,_0x3b01c0){return respondWithRpcPromise(_0x5dbf('0x60'),_0x310078[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x3b01c0,null))[_0x5dbf('0xb')](handleError(_0x3b01c0,null));};exports['queueNotify']=function(_0x625875){return function(_0x2a0c11,_0x43ca42){var _0x2c5a6e,_0x255ab0;var _0x5a27d2=_[_0x5dbf('0x61')](_0x625875);var _0x550bd1=_0x625875==='chat'?'Website':'Account';return db[_0x5a27d2+_0x5dbf('0x62')][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x2a0c11[_0x5dbf('0x16')]['id']}})[_0x5dbf('0x8')](function(_0x4333db){if(_['isNil'](_0x4333db)){throw new Error(_0x5a27d2+'\x20Queue\x20not\x20found');}_0x2c5a6e=_0x4333db;return db[_0x5a27d2+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x2a0c11[_0x5dbf('0x1e')][_0x5dbf('0x65')]},'include':[{'model':db[_0x5a27d2+'Interaction'],'as':_0x5dbf('0x66')},{'model':db[_0x5a27d2+_0x550bd1],'as':'Account'}]});})[_0x5dbf('0x8')](function(_0x24d90a){if(_[_0x5dbf('0x11')](_0x24d90a)){throw new Error(_0x5a27d2+_0x5dbf('0x67'));}_0x255ab0=_0x24d90a;return _0x24d90a[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x22b520={'uniqueid':_0x625875+'.'+_0x255ab0['id']+'.'+_0x255ab0[_0x5dbf('0x66')]['id'],'FromUserId':_0x2a0c11[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69')};_0x22b520[_0x5a27d2+'MessageId']=_0x255ab0['id'];_0x22b520[_0x5a27d2+_0x5dbf('0x6a')]=_0x255ab0[_0x5dbf('0x66')]['id'];_0x22b520[_0x5dbf('0x6b')+_0x5a27d2+_0x550bd1+'Id']=_0x255ab0[_0x5dbf('0x6c')]['id'];_0x22b520['To'+_0x5a27d2+_0x5dbf('0x6d')]=_0x2c5a6e['id'];return db[_0x5a27d2+_0x5dbf('0x6e')][_0x5dbf('0x6f')](_0x22b520);})[_0x5dbf('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x625875,'interaction':_0x255ab0['Interaction'],'message':_0x255ab0,'account':_0x255ab0[_0x5dbf('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x69'),'appdata':_0x2c5a6e[_0x5dbf('0xf')]+','+(_0x255ab0['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x43ca42,null))[_0x5dbf('0xb')](handleError(_0x43ca42,null));};};exports[_0x5dbf('0x70')]=function(_0x4713b4,_0x12757d){var _0x13fcf5,_0x5ba5bb;if(_[_0x5dbf('0x11')](_0x4713b4[_0x5dbf('0x1e')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x289cc1=_0x4713b4['body']['channel'];var _0x3a27c4=_[_0x5dbf('0x61')](_0x289cc1);var _0x3722b9=_0x289cc1==='chat'?_0x5dbf('0x71'):_0x5dbf('0x6c');return db['User'][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x4713b4[_0x5dbf('0x16')]['id'],'role':_0x5dbf('0x34')}})[_0x5dbf('0x8')](function(_0x7957cb){if(_[_0x5dbf('0x11')](_0x7957cb)){throw new Error(_0x5dbf('0x72'));}_0x13fcf5=_0x7957cb;return db[_0x3a27c4+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x4713b4['body']['messageId']},'include':[{'model':db[_0x3a27c4+_0x5dbf('0x66')],'as':_0x5dbf('0x66')},{'model':db[_0x3a27c4+_0x3722b9],'as':_0x5dbf('0x6c')}]});})[_0x5dbf('0x8')](function(_0x400d98){if(_[_0x5dbf('0x11')](_0x400d98)){throw new Error(_0x3a27c4+_0x5dbf('0x67'));}_0x5ba5bb=_0x400d98;return _0x400d98[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5dbf('0x8')](function(){var _0x990814={'uniqueid':_0x289cc1+'.'+_0x5ba5bb['id']+'.'+_0x5ba5bb['Interaction']['id'],'FromUserId':_0x4713b4[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69'),'ToUserId':_0x13fcf5['id']};_0x990814[_0x3a27c4+_0x5dbf('0x73')]=_0x5ba5bb['id'];_0x990814[_0x3a27c4+_0x5dbf('0x6a')]=_0x5ba5bb[_0x5dbf('0x66')]['id'];_0x990814[_0x5dbf('0x6b')+_0x3a27c4+_0x3722b9+'Id']=_0x5ba5bb[_0x5dbf('0x6c')]['id'];return db[_0x3a27c4+_0x5dbf('0x6e')]['create'](_0x990814);})['then'](function(){return respondWithRpcPromise(_0x5dbf('0x74'),{'channel':_0x289cc1,'interaction':_0x5ba5bb['Interaction'],'message':_0x5ba5bb,'account':_0x5ba5bb['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x34'),'appdata':_0x13fcf5['name']+','+(_0x5ba5bb['Account']['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x12757d,null))['catch'](handleError(_0x12757d,null));}; \ No newline at end of file +var _0xb4c7=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','format','SIP/%s','interface','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','messageId','queue','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels'];(function(_0x32cb7d,_0x1a9bd4){var _0xfe4f18=function(_0x6e14c1){while(--_0x6e14c1){_0x32cb7d['push'](_0x32cb7d['shift']());}};_0xfe4f18(++_0x1a9bd4);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4bbce0,_0x38c5ed){_0x4bbce0=_0x4bbce0-0x0;var _0x4171f9=_0xb4c7[_0x4bbce0];return _0x4171f9;};'use strict';var BPromise=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var util=require(_0x7b4c('0x3'));var db=require(_0x7b4c('0x4'))['db'];var logger=require('../../config/logger')(_0x7b4c('0x5'));var jayson=require(_0x7b4c('0x6'));var amiClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232a});var mailClient=jayson[_0x7b4c('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x7b4c('0x7')][_0x7b4c('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){var _0x433aa2=_0x2d7b7e?_0x2d7b7e:amiClient;return _0x433aa2[_0x7b4c('0x9')](_0x2dd5c7,_0x4bf85d)[_0x7b4c('0xa')](function(_0x237e28){if(_0x237e28[_0x7b4c('0xb')]){if(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xc')]===0x1f4){return _0x570daa(_0x237e28[_0x7b4c('0xb')][_0x7b4c('0xd')]);}return _0x21687f(_0x237e28[_0x7b4c('0xb')]['message']);}else{_0x21687f(_0x237e28['result']);}})[_0x7b4c('0xe')](function(_0x18342b){_0x570daa(_0x18342b);});});}function respondWithResult(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xc8;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0xf')](_0x1722ad)[_0x7b4c('0x10')](_0x3e1558);}return _0x38656b[_0x7b4c('0x11')](0x194);};}function handleError(_0x25b90b,_0x387488){_0x387488=_0x387488||0x1f4;return function(_0x593a19){logger[_0x7b4c('0xb')](_0x593a19[_0x7b4c('0x12')]);if(_0x593a19[_0x7b4c('0x13')]){delete _0x593a19[_0x7b4c('0x13')];}_0x25b90b[_0x7b4c('0xf')](_0x387488)[_0x7b4c('0x14')](_0x593a19);};}function findById(_0x1642e1){return function(_0x22c409){if(!_['isNil'](_0x1642e1)&&!_[_0x7b4c('0x15')](_0x22c409)&&!_[_0x7b4c('0x15')](_0x22c409[_0x7b4c('0x16')])){return _[_0x7b4c('0x17')](_0x22c409['rows'],function(_0x3ce10c){return _0x3ce10c['id']==_0x1642e1;});}return null;};}exports[_0x7b4c('0x18')]=function(_0x32110e,_0x380b79){return respondWithRpcPromise(_0x7b4c('0x19'),_0x32110e[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x380b79,null))[_0x7b4c('0xe')](handleError(_0x380b79,null));};exports[_0x7b4c('0x1b')]=function(_0x55e3df,_0x1f06ec){return respondWithRpcPromise(_0x7b4c('0x1c'),_[_0x7b4c('0x1d')](_0x55e3df[_0x7b4c('0x1a')],_0x55e3df[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x1f06ec,null))[_0x7b4c('0xe')](handleError(_0x1f06ec,null));};exports[_0x7b4c('0x1f')]=function(_0x2ab9e1,_0x2c267c){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7b4c('0x1d')](_0x2ab9e1[_0x7b4c('0x1a')],_0x2ab9e1[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x2c267c,null))[_0x7b4c('0xe')](handleError(_0x2c267c,null));};exports[_0x7b4c('0x20')]=function(_0x37c059,_0x459eb4){return respondWithRpcPromise(_0x7b4c('0x21'),_0x37c059[_0x7b4c('0x1a')])[_0x7b4c('0xa')](respondWithResult(_0x459eb4,null))[_0x7b4c('0xe')](handleError(_0x459eb4,null));};exports[_0x7b4c('0x22')]=function(_0x501f75,_0x27f361){return respondWithRpcPromise(_0x7b4c('0x21'),_0x501f75[_0x7b4c('0x1a')])[_0x7b4c('0xa')](findById(_0x501f75[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x27f361,null))[_0x7b4c('0xe')](handleError(_0x27f361,null));};exports[_0x7b4c('0x23')]=function(_0x3e4a46,_0x9a799b){return respondWithRpcPromise(_0x7b4c('0x24'),_[_0x7b4c('0x1d')](_0x3e4a46[_0x7b4c('0x25')],_0x3e4a46[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9a799b,null))[_0x7b4c('0xe')](handleError(_0x9a799b,null));};exports[_0x7b4c('0x26')]=function(_0xce5781,_0x9d3d31){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0xce5781['query'],_0xce5781[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x9d3d31,null))[_0x7b4c('0xe')](handleError(_0x9d3d31,null));};exports[_0x7b4c('0x27')]=function(_0x498391,_0x6e66e3){return respondWithRpcPromise(_0x7b4c('0x28'),_0x498391['query'])[_0x7b4c('0xa')](respondWithResult(_0x6e66e3,null))['catch'](handleError(_0x6e66e3,null));};exports[_0x7b4c('0x29')]=function(_0x3b9149,_0x159001){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x7b4c('0x1d')](_0x3b9149[_0x7b4c('0x1a')],_0x3b9149['params']))[_0x7b4c('0xa')](respondWithResult(_0x159001,null))[_0x7b4c('0xe')](handleError(_0x159001,null));};exports[_0x7b4c('0x2a')]=function(_0x2e0835,_0x56ff38){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x7b4c('0x1d')](_0x2e0835[_0x7b4c('0x1a')],_0x2e0835['params']))[_0x7b4c('0xa')](respondWithResult(_0x56ff38,null))['catch'](handleError(_0x56ff38,null));};exports['voiceQueuesChannelRedirect']=function(_0x11ca38,_0x16ae89){return respondWithRpcPromise(_0x7b4c('0x2b'),_[_0x7b4c('0x1d')](_0x11ca38['query'],_0x11ca38[_0x7b4c('0x1e')]))[_0x7b4c('0xa')](respondWithResult(_0x16ae89,null))[_0x7b4c('0xe')](handleError(_0x16ae89,null));};exports[_0x7b4c('0x2c')]=function(_0x346e0c,_0xddd16){return respondWithRpcPromise(_0x7b4c('0x2d'),_0x346e0c['query'])['then'](respondWithResult(_0xddd16,null))[_0x7b4c('0xe')](handleError(_0xddd16,null));};exports[_0x7b4c('0x2e')]=function(_0x31ef1e,_0x123a3a){return respondWithRpcPromise(_0x7b4c('0x2f'),_0x31ef1e['query'])[_0x7b4c('0xa')](respondWithResult(_0x123a3a,null))[_0x7b4c('0xe')](handleError(_0x123a3a,null));};exports[_0x7b4c('0x30')]=function(_0x26346a,_0x22f71b){var _0x25659d;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a[_0x7b4c('0x1a')])[_0x7b4c('0xa')](function(_0x54cd10){_0x25659d=_0x54cd10;return respondWithRpcPromise(_0x7b4c('0x31'),_0x26346a['query'],routingClient);})[_0x7b4c('0xa')](function(_0x4dc71f){return _[_0x7b4c('0x1d')]({},_0x4dc71f,_0x25659d);})[_0x7b4c('0xa')](respondWithResult(_0x22f71b,null))['catch'](handleError(_0x22f71b,null));};exports['agentCapacity']=function(_0x354578,_0x4314b6){if(_0x354578[_0x7b4c('0x25')]&&_0x354578[_0x7b4c('0x25')]['interaction']&&_0x354578[_0x7b4c('0x32')]&&_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')]){for(var _0x5d4ed8 in _0x354578[_0x7b4c('0x25')]['interaction']){if(_0x354578['body'][_0x7b4c('0x33')]['hasOwnProperty'](_0x5d4ed8)){db[_0x7b4c('0x34')][_0x7b4c('0x35')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'exitAt':null,'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]&&_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8]['length']?{'$notIn':_0x354578[_0x7b4c('0x25')]['interaction'][_0x5d4ed8]}:{'$ne':null}}})['then'](function(_0x23372c){var _0x1f1653=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x255cca=0x0,_0x2ce694=_0x23372c[_0x7b4c('0x37')];_0x255cca<_0x2ce694;_0x255cca+=0x1){_0x23372c[_0x255cca][_0x7b4c('0x38')]({'exitAt':_0x1f1653});}});for(var _0x8ebf9b=0x0;_0x8ebf9b<_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x7b4c('0x37')];_0x8ebf9b+=0x1){db['MemberReport'][_0x7b4c('0x39')]({'where':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'type':_0x7b4c('0x36'),'uniqueid':_0x354578[_0x7b4c('0x25')][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b],'exitAt':null},'defaults':{'channel':_0x5d4ed8,'membername':_0x354578[_0x7b4c('0x32')][_0x7b4c('0x13')],'interface':_[_0x7b4c('0x15')](_0x354578['user']['interface'])?util[_0x7b4c('0x3a')](_0x7b4c('0x3b'),_0x354578[_0x7b4c('0x32')]['name']):_0x354578[_0x7b4c('0x32')][_0x7b4c('0x3c')],'type':'INTERACTION','enterAt':moment()[_0x7b4c('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x7b4c('0x3d'),'internal':_0x354578['user'][_0x7b4c('0x3e')],'uniqueid':_0x354578['body'][_0x7b4c('0x33')][_0x5d4ed8][_0x8ebf9b]}});}}}}return respondWithRpcPromise(_0x7b4c('0x3f'),{'id':_0x354578['params']['id'],'capacity':_0x354578['body'][_0x7b4c('0x40')]},routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4314b6,null))[_0x7b4c('0xe')](handleError(_0x4314b6,null));};exports['telephones']=function(_0x56233b,_0x2fc5b5){return respondWithRpcPromise(_0x7b4c('0x41'),_0x56233b['query'])['then'](respondWithResult(_0x2fc5b5,null))[_0x7b4c('0xe')](handleError(_0x2fc5b5,null));};exports[_0x7b4c('0x42')]=function(_0x166fd1,_0x4b2207){return respondWithRpcPromise(_0x7b4c('0x43'),_0x166fd1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x4b2207,null))['catch'](handleError(_0x4b2207,null));};exports[_0x7b4c('0x44')]=function(_0x4d8491,_0x59db20){return respondWithRpcPromise(_0x7b4c('0x45'),_0x4d8491['query'])['then'](respondWithResult(_0x59db20,null))[_0x7b4c('0xe')](handleError(_0x59db20,null));};exports[_0x7b4c('0x46')]=function(_0xde9f5,_0x17af17){return respondWithRpcPromise('ChatQueues',_0xde9f5['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x17af17,null))[_0x7b4c('0xe')](handleError(_0x17af17,null));};exports[_0x7b4c('0x47')]=function(_0x59b358,_0x255262){return respondWithRpcPromise(_0x7b4c('0x48'),_0x59b358[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x59b358[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x255262,null))['catch'](handleError(_0x255262,null));};exports[_0x7b4c('0x49')]=function(_0x186e7d,_0x30de26){return respondWithRpcPromise(_0x7b4c('0x4a'),_0x186e7d[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x30de26,null))[_0x7b4c('0xe')](handleError(_0x30de26,null));};exports['showMailQueues']=function(_0x4443d0,_0x2dc79a){return respondWithRpcPromise('MailQueues',_0x4443d0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x4443d0[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x2dc79a,null))['catch'](handleError(_0x2dc79a,null));};exports[_0x7b4c('0x4b')]=function(_0x4e84a3,_0x542b85){return respondWithRpcPromise(_0x7b4c('0x4c'),_0x4e84a3[_0x7b4c('0x1a')],mailClient)[_0x7b4c('0xa')](respondWithResult(_0x542b85,null))[_0x7b4c('0xe')](handleError(_0x542b85,null));};exports[_0x7b4c('0x4d')]=function(_0x5b24f6,_0x4fcc9d){return respondWithRpcPromise(_0x7b4c('0x4e'),_0x5b24f6[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x4fcc9d,null))['catch'](handleError(_0x4fcc9d,null));};exports[_0x7b4c('0x4f')]=function(_0xc4dae0,_0x36fc5d){return respondWithRpcPromise('OpenchannelQueues',_0xc4dae0[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0xc4dae0[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x36fc5d,null))[_0x7b4c('0xe')](handleError(_0x36fc5d,null));};exports[_0x7b4c('0x50')]=function(_0x4ac03e,_0x1c64d5){return respondWithRpcPromise('SmsQueues',_0x4ac03e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x1c64d5,null))[_0x7b4c('0xe')](handleError(_0x1c64d5,null));};exports['showSmsQueues']=function(_0x5af2af,_0x237921){return respondWithRpcPromise(_0x7b4c('0x51'),_0x5af2af[_0x7b4c('0x1a')],routingClient)['then'](findById(_0x5af2af[_0x7b4c('0x1e')]['id']))['then'](respondWithResult(_0x237921,null))[_0x7b4c('0xe')](handleError(_0x237921,null));};exports[_0x7b4c('0x52')]=function(_0x1315bd,_0x5f3ed5){return respondWithRpcPromise(_0x7b4c('0x53'),_0x1315bd['query'],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x5f3ed5,null))[_0x7b4c('0xe')](handleError(_0x5f3ed5,null));};exports['showWhatsappQueues']=function(_0x7a38e,_0x13a882){return respondWithRpcPromise(_0x7b4c('0x53'),_0x7a38e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x7a38e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x13a882,null))[_0x7b4c('0xe')](handleError(_0x13a882,null));};exports['faxQueues']=function(_0x10d5b3,_0x2dc9a4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x10d5b3[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x2dc9a4,null))[_0x7b4c('0xe')](handleError(_0x2dc9a4,null));};exports[_0x7b4c('0x55')]=function(_0x2a5f6e,_0x34fce4){return respondWithRpcPromise(_0x7b4c('0x54'),_0x2a5f6e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](findById(_0x2a5f6e[_0x7b4c('0x1e')]['id']))[_0x7b4c('0xa')](respondWithResult(_0x34fce4,null))[_0x7b4c('0xe')](handleError(_0x34fce4,null));};exports[_0x7b4c('0x56')]=function(_0x168aa1,_0x36c7d9){return respondWithRpcPromise(_0x7b4c('0x57'),_0x168aa1[_0x7b4c('0x1a')])['then'](respondWithResult(_0x36c7d9,null))['catch'](handleError(_0x36c7d9,null));};exports[_0x7b4c('0x58')]=function(_0x15033e,_0x50069b){return respondWithRpcPromise(_0x7b4c('0x59'),_0x15033e[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x50069b,null))[_0x7b4c('0xe')](handleError(_0x50069b,null));};exports[_0x7b4c('0x5a')]=function(_0x15df66,_0x22a254){return respondWithRpcPromise(_0x7b4c('0x5b'),_0x15df66[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x22a254,null))[_0x7b4c('0xe')](handleError(_0x22a254,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x35067f,_0x5477e3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x35067f[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x5477e3,null))['catch'](handleError(_0x5477e3,null));};exports[_0x7b4c('0x5c')]=function(_0x2d17ed,_0x328948){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2d17ed[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](function(_0x10e789){if(_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')]!==undefined){var _0x2837aa=_(_0x10e789[_0x7b4c('0x16')])[_0x7b4c('0x5e')]([_0x2d17ed[_0x7b4c('0x1a')][_0x7b4c('0x5d')],_0x2d17ed[_0x7b4c('0x1e')]['id']])[_0x7b4c('0x5f')](_0x7b4c('0x60'))[_0x7b4c('0x61')]()['value']();return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x35e94a){return _0x2837aa[_0x7b4c('0x62')](_0x35e94a['queue_id'])>-0x1;});}else{return _0x10e789[_0x7b4c('0x16')][_0x7b4c('0x5e')](function(_0x149d53){return _0x149d53[_0x7b4c('0x60')]===parseInt(_0x2d17ed[_0x7b4c('0x1e')]['id']);});}})[_0x7b4c('0xa')](respondWithResult(_0x328948,null))[_0x7b4c('0xe')](handleError(_0x328948,null));};exports['smsQueuesWaitingInteractions']=function(_0x11c809,_0x108c99){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x11c809['query'],routingClient)['then'](respondWithResult(_0x108c99,null))[_0x7b4c('0xe')](handleError(_0x108c99,null));};exports[_0x7b4c('0x63')]=function(_0x24d4f9,_0x19804d){return respondWithRpcPromise(_0x7b4c('0x64'),_0x24d4f9[_0x7b4c('0x1a')],routingClient)[_0x7b4c('0xa')](respondWithResult(_0x19804d,null))[_0x7b4c('0xe')](handleError(_0x19804d,null));};exports[_0x7b4c('0x65')]=function(_0x2bc889,_0x83e8bb){return respondWithRpcPromise(_0x7b4c('0x66'),_0x2bc889[_0x7b4c('0x1a')],routingClient)['then'](respondWithResult(_0x83e8bb,null))[_0x7b4c('0xe')](handleError(_0x83e8bb,null));};exports[_0x7b4c('0x67')]=function(_0x2afaa0){return function(_0x5dc6e6,_0x39c01d){var _0x392656,_0x1faa6f;var _0x3999bf=_[_0x7b4c('0x68')](_0x2afaa0);var _0x57f1a0=_0x2afaa0===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x3999bf+_0x7b4c('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x5dc6e6[_0x7b4c('0x1e')]['id']}})[_0x7b4c('0xa')](function(_0xdfa0bc){if(_['isNil'](_0xdfa0bc)){throw new Error(_0x3999bf+_0x7b4c('0x6d'));}_0x392656=_0xdfa0bc;return db[_0x3999bf+_0x7b4c('0x6e')][_0x7b4c('0x6f')]({'where':{'id':_0x5dc6e6[_0x7b4c('0x25')]['messageId']},'include':[{'model':db[_0x3999bf+_0x7b4c('0x70')],'as':_0x7b4c('0x70')},{'model':db[_0x3999bf+_0x57f1a0],'as':_0x7b4c('0x6b')}]});})[_0x7b4c('0xa')](function(_0x50c382){if(_[_0x7b4c('0x15')](_0x50c382)){throw new Error(_0x3999bf+'\x20Message\x20not\x20found');}_0x1faa6f=_0x50c382;return _0x50c382[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x24690a={'uniqueid':_0x2afaa0+'.'+_0x1faa6f['id']+'.'+_0x1faa6f[_0x7b4c('0x70')]['id'],'FromUserId':_0x5dc6e6[_0x7b4c('0x32')]['id'],'type':'queue'};_0x24690a[_0x3999bf+_0x7b4c('0x72')]=_0x1faa6f['id'];_0x24690a[_0x3999bf+'InteractionId']=_0x1faa6f[_0x7b4c('0x70')]['id'];_0x24690a[_0x7b4c('0x73')+_0x3999bf+_0x57f1a0+'Id']=_0x1faa6f['Account']['id'];_0x24690a['To'+_0x3999bf+_0x7b4c('0x74')]=_0x392656['id'];return db[_0x3999bf+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x24690a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x2afaa0,'interaction':_0x1faa6f[_0x7b4c('0x70')],'message':_0x1faa6f,'account':_0x1faa6f[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x392656[_0x7b4c('0x13')]+','+(_0x1faa6f[_0x7b4c('0x6b')][_0x7b4c('0x77')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x39c01d,null))[_0x7b4c('0xe')](handleError(_0x39c01d,null));};};exports[_0x7b4c('0x79')]=function(_0x4e9781,_0x5ec399){var _0xdb202,_0x433d74;if(_[_0x7b4c('0x15')](_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x228b2b=_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7a')];var _0x331db1=_['capitalize'](_0x228b2b);var _0x56ba6f=_0x228b2b===_0x7b4c('0x69')?_0x7b4c('0x6a'):_0x7b4c('0x6b');return db[_0x7b4c('0x7b')][_0x7b4c('0x6f')]({'raw':!![],'where':{'id':_0x4e9781['params']['id'],'role':_0x7b4c('0x3d')}})[_0x7b4c('0xa')](function(_0x450eca){if(_[_0x7b4c('0x15')](_0x450eca)){throw new Error('Agent\x20not\x20found');}_0xdb202=_0x450eca;return db[_0x331db1+'Message']['findOne']({'where':{'id':_0x4e9781[_0x7b4c('0x25')][_0x7b4c('0x7c')]},'include':[{'model':db[_0x331db1+_0x7b4c('0x70')],'as':'Interaction'},{'model':db[_0x331db1+_0x56ba6f],'as':_0x7b4c('0x6b')}]});})['then'](function(_0x530030){if(_[_0x7b4c('0x15')](_0x530030)){throw new Error(_0x331db1+'\x20Message\x20not\x20found');}_0x433d74=_0x530030;return _0x530030[_0x7b4c('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7b4c('0xa')](function(){var _0x5e444a={'uniqueid':_0x228b2b+'.'+_0x433d74['id']+'.'+_0x433d74['Interaction']['id'],'FromUserId':_0x4e9781[_0x7b4c('0x32')]['id'],'type':_0x7b4c('0x7d'),'ToUserId':_0xdb202['id']};_0x5e444a[_0x331db1+_0x7b4c('0x72')]=_0x433d74['id'];_0x5e444a[_0x331db1+_0x7b4c('0x7e')]=_0x433d74['Interaction']['id'];_0x5e444a['From'+_0x331db1+_0x56ba6f+'Id']=_0x433d74[_0x7b4c('0x6b')]['id'];return db[_0x331db1+_0x7b4c('0x75')][_0x7b4c('0x76')](_0x5e444a);})[_0x7b4c('0xa')](function(){return respondWithRpcPromise(_0x7b4c('0x7f'),{'channel':_0x228b2b,'interaction':_0x433d74[_0x7b4c('0x70')],'message':_0x433d74,'account':_0x433d74[_0x7b4c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xdb202[_0x7b4c('0x13')]+','+(_0x433d74[_0x7b4c('0x6b')][_0x7b4c('0x80')]||0x12c),'interval':_0x7b4c('0x78')}]},routingClient);})[_0x7b4c('0xa')](respondWithResult(_0x5ec399,null))[_0x7b4c('0xe')](handleError(_0x5ec399,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 00b979e..a57fe19 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 _0x2d1a=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','run','put','/:id','delete','destroy','multer'];(function(_0xc96949,_0xbde403){var _0x4f6555=function(_0x22f736){while(--_0x22f736){_0xc96949['push'](_0xc96949['shift']());}};_0x4f6555(++_0xbde403);}(_0x2d1a,0x8f));var _0xa2d1=function(_0x1a4748,_0x40c46e){_0x1a4748=_0x1a4748-0x0;var _0x28ca99=_0x2d1a[_0x1a4748];return _0x28ca99;};'use strict';var multer=require(_0xa2d1('0x0'));var util=require(_0xa2d1('0x1'));var path=require(_0xa2d1('0x2'));var timeout=require(_0xa2d1('0x3'));var express=require('express');var router=express[_0xa2d1('0x4')]();var fs_extra=require(_0xa2d1('0x5'));var auth=require(_0xa2d1('0x6'));var interaction=require(_0xa2d1('0x7'));var config=require(_0xa2d1('0x8'));var controller=require(_0xa2d1('0x9'));router[_0xa2d1('0xa')]('/',auth[_0xa2d1('0xb')](),controller[_0xa2d1('0xc')]);router[_0xa2d1('0xa')]('/:id',auth[_0xa2d1('0xb')](),controller['show']);router[_0xa2d1('0xa')]('/:id/run',auth[_0xa2d1('0xb')](),controller[_0xa2d1('0xd')]);router['post']('/',auth[_0xa2d1('0xb')](),controller['create']);router[_0xa2d1('0xe')](_0xa2d1('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xa2d1('0x10')](_0xa2d1('0xf'),auth['isAuthenticated'](),controller[_0xa2d1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3646=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','isAuthenticated','/:id/run','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x43790f,_0x4838d1){var _0x15faa8=function(_0x4c9314){while(--_0x4c9314){_0x43790f['push'](_0x43790f['shift']());}};_0x15faa8(++_0x4838d1);}(_0x3646,0xe2));var _0x6364=function(_0x2b610f,_0x11bc02){_0x2b610f=_0x2b610f-0x0;var _0xe3fb7a=_0x3646[_0x2b610f];return _0xe3fb7a;};'use strict';var multer=require(_0x6364('0x0'));var util=require('util');var path=require(_0x6364('0x1'));var timeout=require(_0x6364('0x2'));var express=require(_0x6364('0x3'));var router=express[_0x6364('0x4')]();var fs_extra=require(_0x6364('0x5'));var auth=require(_0x6364('0x6'));var interaction=require(_0x6364('0x7'));var config=require(_0x6364('0x8'));var controller=require(_0x6364('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6364('0xa')](_0x6364('0xb'),auth[_0x6364('0xc')](),controller['show']);router[_0x6364('0xa')](_0x6364('0xd'),auth['isAuthenticated'](),controller['run']);router[_0x6364('0xe')]('/',auth[_0x6364('0xc')](),controller[_0x6364('0xf')]);router[_0x6364('0x10')](_0x6364('0xb'),auth[_0x6364('0xc')](),controller[_0x6364('0x11')]);router[_0x6364('0x12')]('/:id',auth[_0x6364('0xc')](),controller[_0x6364('0x13')]);module[_0x6364('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 2d6360e..f67a221 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 _0x739c=['years','quarters','hours','minutes','days','pdf','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x515032,_0x4be962){var _0x1f2cd0=function(_0x51e157){while(--_0x51e157){_0x515032['push'](_0x515032['shift']());}};_0x1f2cd0(++_0x4be962);}(_0x739c,0x1a9));var _0xc739=function(_0x1e7797,_0x310ac6){_0x1e7797=_0x1e7797-0x0;var _0x51eaf7=_0x739c[_0x1e7797];return _0x51eaf7;};'use strict';var Sequelize=require('sequelize');module[_0xc739('0x0')]={'name':{'type':Sequelize[_0xc739('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc739('0x1')]},'active':{'type':Sequelize[_0xc739('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc739('0x1')],'allowNull':![],'defaultValue':_0xc739('0x3')},'startAt':{'type':Sequelize[_0xc739('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc739('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc739('0x6')](_0xc739('0x7'),_0xc739('0x8'),'months','weeks','days',_0xc739('0x9'),_0xc739('0xa')),'allowNull':![],'defaultValue':_0xc739('0xb')},'output':{'type':Sequelize[_0xc739('0x6')]('csv',_0xc739('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xc739('0x6')](_0xc739('0xd'),_0xc739('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xc739('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc739('0x1')]},'cc':{'type':Sequelize[_0xc739('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xc739('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xec3a=['csv','pdf','xlsx','ENUM','default','custom','TEXT','exports','STRING','BOOLEAN','DATE','INTEGER','years','quarters','months','weeks','hours','minutes','days'];(function(_0x569a8f,_0x3d10fa){var _0x27bc32=function(_0x5da1ed){while(--_0x5da1ed){_0x569a8f['push'](_0x569a8f['shift']());}};_0x27bc32(++_0x3d10fa);}(_0xec3a,0x137));var _0xaec3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xec3a[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0xaec3('0x0')]={'name':{'type':Sequelize[_0xaec3('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xaec3('0x1')]},'active':{'type':Sequelize[_0xaec3('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xaec3('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xaec3('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xaec3('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xaec3('0x5'),_0xaec3('0x6'),_0xaec3('0x7'),_0xaec3('0x8'),'days',_0xaec3('0x9'),_0xaec3('0xa')),'allowNull':![],'defaultValue':_0xaec3('0xb')},'output':{'type':Sequelize['ENUM'](_0xaec3('0xc'),_0xaec3('0xd'),_0xaec3('0xe')),'allowNull':![],'defaultValue':_0xaec3('0xc')},'type':{'type':Sequelize[_0xaec3('0xf')]('custom',_0xaec3('0x10')),'allowNull':![],'defaultValue':_0xaec3('0x11')},'sendMail':{'type':Sequelize[_0xaec3('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xaec3('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xaec3('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 39d3040..ce4faad 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 _0x10b9=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','options','where','Schedule','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x482c95,_0x504190){var _0x38c2e8=function(_0x5685df){while(--_0x5685df){_0x482c95['push'](_0x482c95['shift']());}};_0x38c2e8(++_0x504190);}(_0x10b9,0x146));var _0x910b=function(_0x226d37,_0x27a759){_0x226d37=_0x226d37-0x0;var _0x208ef9=_0x10b9[_0x226d37];return _0x208ef9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x910b('0x0'));var zipdir=require(_0x910b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x910b('0x2'));var moment=require(_0x910b('0x3'));var BPromise=require(_0x910b('0x4'));var Mustache=require(_0x910b('0x5'));var util=require(_0x910b('0x6'));var path=require(_0x910b('0x7'));var sox=require(_0x910b('0x8'));var csv=require(_0x910b('0x9'));var ejs=require(_0x910b('0xa'));var fs=require('fs');var fs_extra=require(_0x910b('0xb'));var _=require(_0x910b('0xc'));var squel=require(_0x910b('0xd'));var crypto=require(_0x910b('0xe'));var jsforce=require(_0x910b('0xf'));var deskjs=require(_0x910b('0x10'));var toCsv=require(_0x910b('0x9'));var querystring=require(_0x910b('0x11'));var Papa=require(_0x910b('0x12'));var Redis=require(_0x910b('0x13'));var authService=require(_0x910b('0x14'));var qs=require(_0x910b('0x15'));var as=require(_0x910b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x910b('0x17'))(_0x910b('0x18'));var utils=require(_0x910b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x910b('0x1a'));var db=require(_0x910b('0x1b'))['db'];function respondWithStatusCode(_0x111c71,_0x9e2e07){_0x9e2e07=_0x9e2e07||0xcc;return function(_0x7cf7bb){if(_0x7cf7bb){return _0x111c71[_0x910b('0x1c')](_0x9e2e07);}return _0x111c71[_0x910b('0x1d')](_0x9e2e07)['end']();};}function respondWithResult(_0x38f40d,_0x546584){_0x546584=_0x546584||0xc8;return function(_0x3708e8){if(_0x3708e8){return _0x38f40d[_0x910b('0x1d')](_0x546584)[_0x910b('0x1e')](_0x3708e8);}};}function respondWithFilteredResult(_0xe53598,_0x5577a6){return function(_0x30a022){if(_0x30a022){var _0x2a55cc=typeof _0x5577a6[_0x910b('0x1f')]===_0x910b('0x20')&&typeof _0x5577a6['limit']==='undefined';var _0x1d39e6=_0x30a022['count'];var _0x2b7ebd=_0x2a55cc?0x0:_0x5577a6[_0x910b('0x1f')];var _0xf078c6=_0x2a55cc?_0x30a022[_0x910b('0x21')]:_0x5577a6[_0x910b('0x1f')]+_0x5577a6[_0x910b('0x22')];var _0x400efe;if(_0xf078c6>=_0x1d39e6){_0xf078c6=_0x1d39e6;_0x400efe=0xc8;}else{_0x400efe=0xce;}_0xe53598[_0x910b('0x1d')](_0x400efe);return _0xe53598['set'](_0x910b('0x23'),_0x2b7ebd+'-'+_0xf078c6+'/'+_0x1d39e6)[_0x910b('0x1e')](_0x30a022);}return null;};}function patchUpdates(_0x593d07){return function(_0xf80c0e){try{jsonpatch[_0x910b('0x24')](_0xf80c0e,_0x593d07,!![]);}catch(_0x5bcfdc){return BPromise[_0x910b('0x25')](_0x5bcfdc);}return _0xf80c0e[_0x910b('0x26')]();};}function saveUpdates(_0x1a719d,_0x47b5f8){return function(_0x1faeaf){if(_0x1faeaf){return _0x1faeaf['update'](_0x1a719d)[_0x910b('0x27')](function(_0x1c7f59){return _0x1c7f59;});}return null;};}function removeEntity(_0x127b5e,_0x277a6e){return function(_0x24a89b){if(_0x24a89b){return _0x24a89b[_0x910b('0x28')]()['then'](function(){var _0x18ceec=_0x24a89b[_0x910b('0x29')]({'plain':!![]});var _0x52af13=_0x910b('0x2a');return db[_0x910b('0x2b')][_0x910b('0x28')]({'where':{'type':_0x52af13,'resourceId':_0x18ceec['id']}})[_0x910b('0x27')](function(){return _0x24a89b;});})[_0x910b('0x27')](function(){_0x127b5e[_0x910b('0x1d')](0xcc)[_0x910b('0x2c')]();});}};}function handleEntityNotFound(_0x12c929,_0x436569){return function(_0x775d4f){if(!_0x775d4f){_0x12c929['sendStatus'](0x194);}return _0x775d4f;};}function handleError(_0x285090,_0x512c26){_0x512c26=_0x512c26||0x1f4;return function(_0x470f45){logger[_0x910b('0x2d')](_0x470f45[_0x910b('0x2e')]);if(_0x470f45['name']){delete _0x470f45[_0x910b('0x2f')];}_0x285090[_0x910b('0x1d')](_0x512c26)[_0x910b('0x30')](_0x470f45);};}exports[_0x910b('0x31')]=function(_0x4abca1,_0x4a6a6c){var _0xc29111={},_0x314e0a={},_0x3b617b={'count':0x0,'rows':[]};var _0x212cef=_[_0x910b('0x32')](db['Schedule'][_0x910b('0x33')],function(_0x14bfcc){return{'name':_0x14bfcc[_0x910b('0x34')],'type':_0x14bfcc[_0x910b('0x35')]['key']};});_0x314e0a[_0x910b('0x36')]=_[_0x910b('0x32')](_0x212cef,'name');_0x314e0a[_0x910b('0x37')]=_[_0x910b('0x38')](_0x4abca1[_0x910b('0x37')]);_0x314e0a[_0x910b('0x39')]=_[_0x910b('0x3a')](_0x314e0a[_0x910b('0x36')],_0x314e0a[_0x910b('0x37')]);_0xc29111[_0x910b('0x3b')]=_[_0x910b('0x3a')](_0x314e0a[_0x910b('0x36')],qs[_0x910b('0x3c')](_0x4abca1['query'][_0x910b('0x3c')]));_0xc29111[_0x910b('0x3b')]=_0xc29111[_0x910b('0x3b')][_0x910b('0x3d')]?_0xc29111[_0x910b('0x3b')]:_0x314e0a[_0x910b('0x36')];if(!_0x4abca1[_0x910b('0x37')][_0x910b('0x3e')]('nolimit')){_0xc29111['limit']=qs['limit'](_0x4abca1[_0x910b('0x37')][_0x910b('0x22')]);_0xc29111[_0x910b('0x1f')]=qs[_0x910b('0x1f')](_0x4abca1[_0x910b('0x37')][_0x910b('0x1f')]);}_0xc29111[_0x910b('0x3f')]=qs[_0x910b('0x40')](_0x4abca1[_0x910b('0x37')][_0x910b('0x40')]);_0xc29111['where']=qs['filters'](_['pick'](_0x4abca1[_0x910b('0x37')],_0x314e0a['filters']),_0x212cef);if(_0x4abca1[_0x910b('0x37')][_0x910b('0x41')]){_0xc29111['where']=_[_0x910b('0x42')](_0xc29111['where'],{'$or':_[_0x910b('0x32')](_0x212cef,function(_0x5c8962){if(_0x5c8962[_0x910b('0x35')]!==_0x910b('0x43')){var _0x6c01f6={};_0x6c01f6[_0x5c8962['name']]={'$like':'%'+_0x4abca1['query']['filter']+'%'};return _0x6c01f6;}})});}_0xc29111=_[_0x910b('0x42')]({},_0xc29111,_0x4abca1[_0x910b('0x44')]);var _0x4e463c={'where':_0xc29111[_0x910b('0x45')]};return db[_0x910b('0x46')][_0x910b('0x21')](_0x4e463c)[_0x910b('0x27')](function(_0x26d1d3){_0x3b617b[_0x910b('0x21')]=_0x26d1d3;if(_0x4abca1[_0x910b('0x37')]['includeAll']){_0xc29111[_0x910b('0x47')]=[{'all':!![]}];}return db[_0x910b('0x46')][_0x910b('0x48')](_0xc29111);})['then'](function(_0x2e3465){_0x3b617b[_0x910b('0x49')]=_0x2e3465;return _0x3b617b;})[_0x910b('0x27')](respondWithFilteredResult(_0x4a6a6c,_0xc29111))[_0x910b('0x4a')](handleError(_0x4a6a6c,null));};exports[_0x910b('0x4b')]=function(_0x38baf6,_0x12e94b){var _0x213dcd={'raw':![],'where':{'id':_0x38baf6[_0x910b('0x4c')]['id']}},_0x583706={};_0x583706[_0x910b('0x36')]=_[_0x910b('0x38')](db[_0x910b('0x46')][_0x910b('0x33')]);_0x583706[_0x910b('0x37')]=_[_0x910b('0x38')](_0x38baf6[_0x910b('0x37')]);_0x583706['filters']=_[_0x910b('0x3a')](_0x583706[_0x910b('0x36')],_0x583706['query']);_0x213dcd[_0x910b('0x3b')]=_[_0x910b('0x3a')](_0x583706[_0x910b('0x36')],qs[_0x910b('0x3c')](_0x38baf6[_0x910b('0x37')][_0x910b('0x3c')]));_0x213dcd[_0x910b('0x3b')]=_0x213dcd[_0x910b('0x3b')][_0x910b('0x3d')]?_0x213dcd[_0x910b('0x3b')]:_0x583706[_0x910b('0x36')];if(_0x38baf6[_0x910b('0x37')][_0x910b('0x4d')]){_0x213dcd[_0x910b('0x47')]=[{'all':!![]}];}_0x213dcd=_[_0x910b('0x42')]({},_0x213dcd,_0x38baf6[_0x910b('0x44')]);return db[_0x910b('0x46')][_0x910b('0x4e')](_0x213dcd)[_0x910b('0x27')](handleEntityNotFound(_0x12e94b,null))[_0x910b('0x27')](respondWithResult(_0x12e94b,null))[_0x910b('0x4a')](handleError(_0x12e94b,null));};exports[_0x910b('0x4f')]=function(_0x425740,_0x1538b6){return db[_0x910b('0x46')]['create'](_0x425740[_0x910b('0x50')],{})[_0x910b('0x27')](function(_0x277fae){var _0x3743f1=_0x425740[_0x910b('0x51')][_0x910b('0x29')]({'plain':!![]});if(!_0x3743f1)throw new Error(_0x910b('0x52'));if(_0x3743f1[_0x910b('0x53')]===_0x910b('0x51')){var _0x3e1871=_0x277fae[_0x910b('0x29')]({'plain':!![]});var _0x3d93eb=_0x910b('0x2a');return db[_0x910b('0x54')][_0x910b('0x4e')]({'where':{'name':_0x3d93eb,'userProfileId':_0x3743f1['userProfileId']},'raw':!![]})[_0x910b('0x27')](function(_0xd5dc68){if(_0xd5dc68&&_0xd5dc68[_0x910b('0x55')]===0x0){return db[_0x910b('0x2b')][_0x910b('0x4f')]({'name':_0x3e1871[_0x910b('0x2f')],'resourceId':_0x3e1871['id'],'type':_0xd5dc68[_0x910b('0x2f')],'sectionId':_0xd5dc68['id']},{})['then'](function(){return _0x277fae;});}else{return _0x277fae;}})[_0x910b('0x4a')](function(_0x563251){logger[_0x910b('0x2d')](_0x910b('0x56'),_0x563251);throw _0x563251;});}return _0x277fae;})['then'](respondWithResult(_0x1538b6,0xc9))[_0x910b('0x4a')](handleError(_0x1538b6,null));};exports['update']=function(_0x3b6829,_0x5eba36){if(_0x3b6829[_0x910b('0x50')]['id']){delete _0x3b6829[_0x910b('0x50')]['id'];}return db[_0x910b('0x46')][_0x910b('0x4e')]({'where':{'id':_0x3b6829[_0x910b('0x4c')]['id']}})[_0x910b('0x27')](handleEntityNotFound(_0x5eba36,null))[_0x910b('0x27')](saveUpdates(_0x3b6829['body'],null))[_0x910b('0x27')](respondWithResult(_0x5eba36,null))[_0x910b('0x4a')](handleError(_0x5eba36,null));};exports[_0x910b('0x28')]=function(_0x17f5ad,_0x284c8c){return db[_0x910b('0x46')][_0x910b('0x4e')]({'where':{'id':_0x17f5ad[_0x910b('0x4c')]['id']}})[_0x910b('0x27')](handleEntityNotFound(_0x284c8c,null))[_0x910b('0x27')](removeEntity(_0x284c8c,null))[_0x910b('0x4a')](handleError(_0x284c8c,null));};exports[_0x910b('0x57')]=function(_0x25a4f4,_0x335ade,_0x1dbc9d){var _0x5dd6e2=require(_0x910b('0x58'));return db[_0x910b('0x46')]['find']({'where':{'id':_0x25a4f4[_0x910b('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x335ade,null))[_0x910b('0x27')](function(){_0x5dd6e2[_0x910b('0x57')](_0x25a4f4[_0x910b('0x4c')]['id']);})[_0x910b('0x27')](respondWithStatusCode(_0x335ade,null))[_0x910b('0x4a')](handleError(_0x335ade,null));}; \ No newline at end of file +var _0xc5a6=['destroy','Scheduler','UserProfileResource','then','status','end','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','set','Content-Range','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5a6,0x1e6));var _0x6c5a=function(_0x4fcdc9,_0x555b22){_0x4fcdc9=_0x4fcdc9-0x0;var _0x28af07=_0xc5a6[_0x4fcdc9];return _0x28af07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c5a('0x0'));var zipdir=require(_0x6c5a('0x1'));var jsonpatch=require(_0x6c5a('0x2'));var rp=require(_0x6c5a('0x3'));var moment=require(_0x6c5a('0x4'));var BPromise=require(_0x6c5a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c5a('0x6'));var sox=require(_0x6c5a('0x7'));var csv=require(_0x6c5a('0x8'));var ejs=require(_0x6c5a('0x9'));var fs=require('fs');var fs_extra=require(_0x6c5a('0xa'));var _=require(_0x6c5a('0xb'));var squel=require(_0x6c5a('0xc'));var crypto=require(_0x6c5a('0xd'));var jsforce=require(_0x6c5a('0xe'));var deskjs=require(_0x6c5a('0xf'));var toCsv=require(_0x6c5a('0x8'));var querystring=require(_0x6c5a('0x10'));var Papa=require(_0x6c5a('0x11'));var Redis=require(_0x6c5a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c5a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c5a('0x14'));var logger=require('../../config/logger')(_0x6c5a('0x15'));var utils=require(_0x6c5a('0x16'));var config=require(_0x6c5a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c5a('0x18'))['db'];function respondWithStatusCode(_0x1b9ce0,_0x5b0658){_0x5b0658=_0x5b0658||0xcc;return function(_0x3f9999){if(_0x3f9999){return _0x1b9ce0[_0x6c5a('0x19')](_0x5b0658);}return _0x1b9ce0['status'](_0x5b0658)['end']();};}function respondWithResult(_0x5e2953,_0x28cbc0){_0x28cbc0=_0x28cbc0||0xc8;return function(_0x59f50b){if(_0x59f50b){return _0x5e2953['status'](_0x28cbc0)[_0x6c5a('0x1a')](_0x59f50b);}};}function respondWithFilteredResult(_0x258c5d,_0x3dd8da){return function(_0x5bbd20){if(_0x5bbd20){var _0x2cb1d4=typeof _0x3dd8da[_0x6c5a('0x1b')]==='undefined'&&typeof _0x3dd8da[_0x6c5a('0x1c')]===_0x6c5a('0x1d');var _0x1b0480=_0x5bbd20[_0x6c5a('0x1e')];var _0x1f3177=_0x2cb1d4?0x0:_0x3dd8da[_0x6c5a('0x1b')];var _0x107102=_0x2cb1d4?_0x5bbd20[_0x6c5a('0x1e')]:_0x3dd8da[_0x6c5a('0x1b')]+_0x3dd8da[_0x6c5a('0x1c')];var _0x40596d;if(_0x107102>=_0x1b0480){_0x107102=_0x1b0480;_0x40596d=0xc8;}else{_0x40596d=0xce;}_0x258c5d['status'](_0x40596d);return _0x258c5d[_0x6c5a('0x1f')](_0x6c5a('0x20'),_0x1f3177+'-'+_0x107102+'/'+_0x1b0480)[_0x6c5a('0x1a')](_0x5bbd20);}return null;};}function patchUpdates(_0x7ecae){return function(_0x4e0b24){try{jsonpatch['apply'](_0x4e0b24,_0x7ecae,!![]);}catch(_0xef9046){return BPromise[_0x6c5a('0x21')](_0xef9046);}return _0x4e0b24[_0x6c5a('0x22')]();};}function saveUpdates(_0x272373,_0x527288){return function(_0x970d28){if(_0x970d28){return _0x970d28[_0x6c5a('0x23')](_0x272373)['then'](function(_0x300764){return _0x300764;});}return null;};}function removeEntity(_0x408f62,_0x4161b0){return function(_0x3444c8){if(_0x3444c8){return _0x3444c8[_0x6c5a('0x24')]()['then'](function(){var _0x380fb8=_0x3444c8['get']({'plain':!![]});var _0x95be4f=_0x6c5a('0x25');return db[_0x6c5a('0x26')][_0x6c5a('0x24')]({'where':{'type':_0x95be4f,'resourceId':_0x380fb8['id']}})[_0x6c5a('0x27')](function(){return _0x3444c8;});})['then'](function(){_0x408f62[_0x6c5a('0x28')](0xcc)[_0x6c5a('0x29')]();});}};}function handleEntityNotFound(_0x3a4f95,_0x5f16e9){return function(_0x1f88f5){if(!_0x1f88f5){_0x3a4f95['sendStatus'](0x194);}return _0x1f88f5;};}function handleError(_0x3d9de0,_0x26bca0){_0x26bca0=_0x26bca0||0x1f4;return function(_0x51d983){logger['error'](_0x51d983[_0x6c5a('0x2a')]);if(_0x51d983[_0x6c5a('0x2b')]){delete _0x51d983['name'];}_0x3d9de0[_0x6c5a('0x28')](_0x26bca0)[_0x6c5a('0x2c')](_0x51d983);};}exports[_0x6c5a('0x2d')]=function(_0x1d252d,_0x13509a){var _0xfae3d0={},_0x4896f9={},_0x51450e={'count':0x0,'rows':[]};var _0xf1301a=_['map'](db[_0x6c5a('0x2e')][_0x6c5a('0x2f')],function(_0x2e8521){return{'name':_0x2e8521[_0x6c5a('0x30')],'type':_0x2e8521[_0x6c5a('0x31')][_0x6c5a('0x32')]};});_0x4896f9['model']=_['map'](_0xf1301a,_0x6c5a('0x2b'));_0x4896f9[_0x6c5a('0x33')]=_[_0x6c5a('0x34')](_0x1d252d[_0x6c5a('0x33')]);_0x4896f9[_0x6c5a('0x35')]=_[_0x6c5a('0x36')](_0x4896f9['model'],_0x4896f9[_0x6c5a('0x33')]);_0xfae3d0['attributes']=_[_0x6c5a('0x36')](_0x4896f9['model'],qs[_0x6c5a('0x37')](_0x1d252d[_0x6c5a('0x33')]['fields']));_0xfae3d0['attributes']=_0xfae3d0[_0x6c5a('0x38')][_0x6c5a('0x39')]?_0xfae3d0['attributes']:_0x4896f9[_0x6c5a('0x3a')];if(!_0x1d252d[_0x6c5a('0x33')][_0x6c5a('0x3b')](_0x6c5a('0x3c'))){_0xfae3d0['limit']=qs['limit'](_0x1d252d['query'][_0x6c5a('0x1c')]);_0xfae3d0[_0x6c5a('0x1b')]=qs[_0x6c5a('0x1b')](_0x1d252d[_0x6c5a('0x33')][_0x6c5a('0x1b')]);}_0xfae3d0[_0x6c5a('0x3d')]=qs[_0x6c5a('0x3e')](_0x1d252d[_0x6c5a('0x33')]['sort']);_0xfae3d0[_0x6c5a('0x3f')]=qs['filters'](_[_0x6c5a('0x40')](_0x1d252d[_0x6c5a('0x33')],_0x4896f9['filters']),_0xf1301a);if(_0x1d252d[_0x6c5a('0x33')][_0x6c5a('0x41')]){_0xfae3d0[_0x6c5a('0x3f')]=_[_0x6c5a('0x42')](_0xfae3d0[_0x6c5a('0x3f')],{'$or':_[_0x6c5a('0x43')](_0xf1301a,function(_0x17d269){if(_0x17d269[_0x6c5a('0x31')]!==_0x6c5a('0x44')){var _0x2c8d87={};_0x2c8d87[_0x17d269['name']]={'$like':'%'+_0x1d252d[_0x6c5a('0x33')]['filter']+'%'};return _0x2c8d87;}})});}_0xfae3d0=_[_0x6c5a('0x42')]({},_0xfae3d0,_0x1d252d[_0x6c5a('0x45')]);var _0x2b0095={'where':_0xfae3d0[_0x6c5a('0x3f')]};return db[_0x6c5a('0x2e')]['count'](_0x2b0095)[_0x6c5a('0x27')](function(_0x139330){_0x51450e[_0x6c5a('0x1e')]=_0x139330;if(_0x1d252d[_0x6c5a('0x33')][_0x6c5a('0x46')]){_0xfae3d0[_0x6c5a('0x47')]=[{'all':!![]}];}return db[_0x6c5a('0x2e')]['findAll'](_0xfae3d0);})['then'](function(_0x6f5ea7){_0x51450e[_0x6c5a('0x48')]=_0x6f5ea7;return _0x51450e;})[_0x6c5a('0x27')](respondWithFilteredResult(_0x13509a,_0xfae3d0))['catch'](handleError(_0x13509a,null));};exports[_0x6c5a('0x49')]=function(_0x5205ba,_0x26256d){var _0x37ad41={'raw':![],'where':{'id':_0x5205ba[_0x6c5a('0x4a')]['id']}},_0x425238={};_0x425238[_0x6c5a('0x3a')]=_[_0x6c5a('0x34')](db[_0x6c5a('0x2e')]['rawAttributes']);_0x425238[_0x6c5a('0x33')]=_['keys'](_0x5205ba['query']);_0x425238[_0x6c5a('0x35')]=_[_0x6c5a('0x36')](_0x425238[_0x6c5a('0x3a')],_0x425238[_0x6c5a('0x33')]);_0x37ad41[_0x6c5a('0x38')]=_[_0x6c5a('0x36')](_0x425238[_0x6c5a('0x3a')],qs[_0x6c5a('0x37')](_0x5205ba[_0x6c5a('0x33')][_0x6c5a('0x37')]));_0x37ad41[_0x6c5a('0x38')]=_0x37ad41[_0x6c5a('0x38')][_0x6c5a('0x39')]?_0x37ad41[_0x6c5a('0x38')]:_0x425238[_0x6c5a('0x3a')];if(_0x5205ba['query'][_0x6c5a('0x46')]){_0x37ad41['include']=[{'all':!![]}];}_0x37ad41=_[_0x6c5a('0x42')]({},_0x37ad41,_0x5205ba['options']);return db[_0x6c5a('0x2e')][_0x6c5a('0x4b')](_0x37ad41)[_0x6c5a('0x27')](handleEntityNotFound(_0x26256d,null))[_0x6c5a('0x27')](respondWithResult(_0x26256d,null))[_0x6c5a('0x4c')](handleError(_0x26256d,null));};exports[_0x6c5a('0x4d')]=function(_0xbdb933,_0x56c2d8){return db[_0x6c5a('0x2e')][_0x6c5a('0x4d')](_0xbdb933[_0x6c5a('0x4e')],{})['then'](function(_0x1f5142){var _0x1c72b7=_0xbdb933[_0x6c5a('0x4f')][_0x6c5a('0x50')]({'plain':!![]});if(!_0x1c72b7)throw new Error(_0x6c5a('0x51'));if(_0x1c72b7['role']==='user'){var _0xbaa3a4=_0x1f5142['get']({'plain':!![]});var _0x4666c7=_0x6c5a('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4666c7,'userProfileId':_0x1c72b7[_0x6c5a('0x52')]},'raw':!![]})['then'](function(_0x5b5d4c){if(_0x5b5d4c&&_0x5b5d4c[_0x6c5a('0x53')]===0x0){return db[_0x6c5a('0x26')][_0x6c5a('0x4d')]({'name':_0xbaa3a4[_0x6c5a('0x2b')],'resourceId':_0xbaa3a4['id'],'type':_0x5b5d4c[_0x6c5a('0x2b')],'sectionId':_0x5b5d4c['id']},{})[_0x6c5a('0x27')](function(){return _0x1f5142;});}else{return _0x1f5142;}})['catch'](function(_0x3a7739){logger['error'](_0x6c5a('0x54'),_0x3a7739);throw _0x3a7739;});}return _0x1f5142;})[_0x6c5a('0x27')](respondWithResult(_0x56c2d8,0xc9))['catch'](handleError(_0x56c2d8,null));};exports[_0x6c5a('0x23')]=function(_0x38e911,_0x560559){if(_0x38e911['body']['id']){delete _0x38e911['body']['id'];}return db[_0x6c5a('0x2e')][_0x6c5a('0x4b')]({'where':{'id':_0x38e911['params']['id']}})['then'](handleEntityNotFound(_0x560559,null))[_0x6c5a('0x27')](saveUpdates(_0x38e911[_0x6c5a('0x4e')],null))[_0x6c5a('0x27')](respondWithResult(_0x560559,null))[_0x6c5a('0x4c')](handleError(_0x560559,null));};exports[_0x6c5a('0x24')]=function(_0x5dbbb6,_0x490a0f){return db['Schedule'][_0x6c5a('0x4b')]({'where':{'id':_0x5dbbb6[_0x6c5a('0x4a')]['id']}})[_0x6c5a('0x27')](handleEntityNotFound(_0x490a0f,null))[_0x6c5a('0x27')](removeEntity(_0x490a0f,null))['catch'](handleError(_0x490a0f,null));};exports[_0x6c5a('0x55')]=function(_0x2ca955,_0x28a320,_0x4ebce5){var _0xc4060d=require(_0x6c5a('0x56'));return db[_0x6c5a('0x2e')]['find']({'where':{'id':_0x2ca955[_0x6c5a('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x28a320,null))[_0x6c5a('0x27')](function(){_0xc4060d['run'](_0x2ca955['params']['id']);})['then'](respondWithStatusCode(_0x28a320,null))[_0x6c5a('0x4c')](handleError(_0x28a320,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c128191..ef6c0b9 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 _0x292e=['../../config/environment','./schedule.attributes','define','tools_schedules','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x292e,0xae));var _0xe292=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x292e[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe292('0x0'))(_0xe292('0x1'));var moment=require('moment');var BPromise=require(_0xe292('0x2'));var rp=require(_0xe292('0x3'));var fs=require('fs');var path=require(_0xe292('0x4'));var rimraf=require(_0xe292('0x5'));var config=require(_0xe292('0x6'));var attributes=require(_0xe292('0x7'));module['exports']=function(_0x2135f8,_0x22133d){return _0x2135f8[_0xe292('0x8')]('Schedule',attributes,{'tableName':_0xe292('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aae=['rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x492e38,_0x3e2c16){var _0x2b1ffa=function(_0x1263e6){while(--_0x1263e6){_0x492e38['push'](_0x492e38['shift']());}};_0x2b1ffa(++_0x3e2c16);}(_0x6aae,0x15b));var _0xe6aa=function(_0xd6845f,_0x463f5f){_0xd6845f=_0xd6845f-0x0;var _0xe91109=_0x6aae[_0xd6845f];return _0xe91109;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe6aa('0x0'))('api');var moment=require(_0xe6aa('0x1'));var BPromise=require(_0xe6aa('0x2'));var rp=require(_0xe6aa('0x3'));var fs=require('fs');var path=require(_0xe6aa('0x4'));var rimraf=require(_0xe6aa('0x5'));var config=require(_0xe6aa('0x6'));var attributes=require(_0xe6aa('0x7'));module[_0xe6aa('0x8')]=function(_0x2dadb3,_0x5814b3){return _0x2dadb3[_0xe6aa('0x9')]('Schedule',attributes,{'tableName':_0xe6aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 645d405..f85d8e4 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 _0x6e0f=['http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4677e8,_0x2b383a){var _0x50af05=function(_0x2301c5){while(--_0x2301c5){_0x4677e8['push'](_0x4677e8['shift']());}};_0x50af05(++_0x2b383a);}(_0x6e0f,0x9d));var _0xf6e0=function(_0x3409c5,_0x39a750){_0x3409c5=_0x3409c5-0x0;var _0x3e0455=_0x6e0f[_0x3409c5];return _0x3e0455;};'use strict';var _=require('lodash');var util=require(_0xf6e0('0x0'));var moment=require(_0xf6e0('0x1'));var BPromise=require(_0xf6e0('0x2'));var rs=require(_0xf6e0('0x3'));var fs=require('fs');var Redis=require(_0xf6e0('0x4'));var db=require(_0xf6e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6e0('0x6'))(_0xf6e0('0x7'));var config=require(_0xf6e0('0x8'));var jayson=require(_0xf6e0('0x9'));var client=jayson[_0xf6e0('0xa')][_0xf6e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf59b46,_0x47d5c7,_0x5e703){return new BPromise(function(_0x2926dd,_0x2f72c1){return client[_0xf6e0('0xc')](_0xf59b46,_0x5e703)['then'](function(_0x4adbf8){logger[_0xf6e0('0xd')](_0xf6e0('0xe'),_0x47d5c7,_0xf6e0('0xf'));logger[_0xf6e0('0x10')](_0xf6e0('0x11'),_0x47d5c7,_0xf6e0('0xf'),JSON[_0xf6e0('0x12')](_0x4adbf8));if(_0x4adbf8['error']){if(_0x4adbf8[_0xf6e0('0x13')]['code']===0x1f4){logger[_0xf6e0('0x13')](_0xf6e0('0xe'),_0x47d5c7,_0x4adbf8[_0xf6e0('0x13')][_0xf6e0('0x14')]);return _0x2f72c1(_0x4adbf8[_0xf6e0('0x13')][_0xf6e0('0x14')]);}logger[_0xf6e0('0x13')](_0xf6e0('0xe'),_0x47d5c7,_0x4adbf8[_0xf6e0('0x13')]['message']);return _0x2926dd(_0x4adbf8[_0xf6e0('0x13')][_0xf6e0('0x14')]);}else{logger[_0xf6e0('0xd')](_0xf6e0('0xe'),_0x47d5c7,_0xf6e0('0xf'));_0x2926dd(_0x4adbf8['result'][_0xf6e0('0x14')]);}})['catch'](function(_0x1e06ca){logger[_0xf6e0('0x13')](_0xf6e0('0xe'),_0x47d5c7,_0x1e06ca);_0x2f72c1(_0x1e06ca);});});} \ No newline at end of file +var _0xe830=['stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe830,0x149));var _0x0e83=function(_0x30ae26,_0x365e23){_0x30ae26=_0x30ae26-0x0;var _0x47b0a1=_0xe830[_0x30ae26];return _0x47b0a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e83('0x0'));var BPromise=require(_0x0e83('0x1'));var rs=require(_0x0e83('0x2'));var fs=require('fs');var Redis=require(_0x0e83('0x3'));var db=require(_0x0e83('0x4'))['db'];var utils=require(_0x0e83('0x5'));var logger=require(_0x0e83('0x6'))(_0x0e83('0x7'));var config=require(_0x0e83('0x8'));var jayson=require(_0x0e83('0x9'));var client=jayson[_0x0e83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350c4b,_0x3ed162,_0x21b037){return new BPromise(function(_0x29777a,_0x1e7763){return client[_0x0e83('0xb')](_0x350c4b,_0x21b037)[_0x0e83('0xc')](function(_0x2452b9){logger[_0x0e83('0xd')]('Schedule,\x20%s,\x20%s',_0x3ed162,_0x0e83('0xe'));logger[_0x0e83('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3ed162,_0x0e83('0xe'),JSON[_0x0e83('0x10')](_0x2452b9));if(_0x2452b9[_0x0e83('0x11')]){if(_0x2452b9[_0x0e83('0x11')][_0x0e83('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3ed162,_0x2452b9['error'][_0x0e83('0x13')]);return _0x1e7763(_0x2452b9[_0x0e83('0x11')][_0x0e83('0x13')]);}logger['error'](_0x0e83('0x14'),_0x3ed162,_0x2452b9['error'][_0x0e83('0x13')]);return _0x29777a(_0x2452b9['error']['message']);}else{logger['info'](_0x0e83('0x14'),_0x3ed162,_0x0e83('0xe'));_0x29777a(_0x2452b9[_0x0e83('0x15')][_0x0e83('0x13')]);}})[_0x0e83('0x16')](function(_0x4be70e){logger[_0x0e83('0x11')](_0x0e83('0x14'),_0x3ed162,_0x4be70e);_0x1e7763(_0x4be70e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ca280c8..5bf3808 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 _0x7010=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x164140,_0xc55ad9){var _0x3606bb=function(_0x10127a){while(--_0x10127a){_0x164140['push'](_0x164140['shift']());}};_0x3606bb(++_0xc55ad9);}(_0x7010,0x1b8));var _0x0701=function(_0xf35672,_0x3833af){_0xf35672=_0xf35672-0x0;var _0x26afcf=_0x7010[_0xf35672];return _0x26afcf;};'use strict';var multer=require(_0x0701('0x0'));var util=require(_0x0701('0x1'));var path=require(_0x0701('0x2'));var timeout=require(_0x0701('0x3'));var express=require(_0x0701('0x4'));var router=express['Router']();var fs_extra=require(_0x0701('0x5'));var auth=require(_0x0701('0x6'));var interaction=require(_0x0701('0x7'));var config=require(_0x0701('0x8'));var controller=require(_0x0701('0x9'));router[_0x0701('0xa')]('/',auth[_0x0701('0xb')](),controller[_0x0701('0xc')]);router['get'](_0x0701('0xd'),auth['isAuthenticated'](),controller[_0x0701('0xe')]);router[_0x0701('0xa')](_0x0701('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x0701('0xa')]('/:id/download',auth[_0x0701('0xb')](),controller['download']);router[_0x0701('0x10')]('/',auth[_0x0701('0xb')](),controller['create']);router[_0x0701('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0701('0x12')]);router[_0x0701('0x13')](_0x0701('0xf'),auth[_0x0701('0xb')](),controller[_0x0701('0x14')]);module[_0x0701('0x15')]=router; \ No newline at end of file +var _0xef2a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe','/:id','isAuthenticated','show','download','post','create','put','delete','destroy','exports','multer'];(function(_0x2b67bf,_0xd3397b){var _0x55fa34=function(_0x18eb5a){while(--_0x18eb5a){_0x2b67bf['push'](_0x2b67bf['shift']());}};_0x55fa34(++_0xd3397b);}(_0xef2a,0xa7));var _0xaef2=function(_0x4b6e73,_0x3a49fa){_0x4b6e73=_0x4b6e73-0x0;var _0x1c1b8d=_0xef2a[_0x4b6e73];return _0x1c1b8d;};'use strict';var multer=require(_0xaef2('0x0'));var util=require('util');var path=require(_0xaef2('0x1'));var timeout=require(_0xaef2('0x2'));var express=require(_0xaef2('0x3'));var router=express[_0xaef2('0x4')]();var fs_extra=require(_0xaef2('0x5'));var auth=require(_0xaef2('0x6'));var interaction=require(_0xaef2('0x7'));var config=require(_0xaef2('0x8'));var controller=require(_0xaef2('0x9'));router[_0xaef2('0xa')]('/',auth['isAuthenticated'](),controller[_0xaef2('0xb')]);router[_0xaef2('0xa')](_0xaef2('0xc'),auth['isAuthenticated'](),controller[_0xaef2('0xd')]);router['get'](_0xaef2('0xe'),auth[_0xaef2('0xf')](),controller[_0xaef2('0x10')]);router['get']('/:id/download',auth[_0xaef2('0xf')](),controller[_0xaef2('0x11')]);router[_0xaef2('0x12')]('/',auth['isAuthenticated'](),controller[_0xaef2('0x13')]);router[_0xaef2('0x14')](_0xaef2('0xe'),auth[_0xaef2('0xf')](),controller['update']);router[_0xaef2('0x15')](_0xaef2('0xe'),auth[_0xaef2('0xf')](),controller[_0xaef2('0x16')]);module[_0xaef2('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ab49a84..7de2de4 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 _0xaf60=['value','STRING','replace','setDataValue','INTEGER','startedAt','format','toString','DATE','createdAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','VIRTUAL','extname','getDataValue'];(function(_0xed97f3,_0x1b4657){var _0x52f921=function(_0x5009e0){while(--_0x5009e0){_0xed97f3['push'](_0xed97f3['shift']());}};_0x52f921(++_0x1b4657);}(_0xaf60,0x82));var _0x0af6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xaf60[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x0af6('0x0'));var moment=require(_0x0af6('0x1'));var path=require(_0x0af6('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x0af6('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x0af6('0x4')](this[_0x0af6('0x5')](_0x0af6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x0af6('0x7')]},'channel':{'type':Sequelize[_0x0af6('0x7')]},'value':{'type':Sequelize[_0x0af6('0x7')],'set':function(_0x2eb218){var _0x52c997=_0x2eb218[_0x0af6('0x8')](/\\/g,'/');this[_0x0af6('0x9')]('value',_0x52c997);}},'rating':{'type':Sequelize[_0x0af6('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0af6('0xa')],'set':function(_0xe9d01a){this['setDataValue']('startedAt',moment()['subtract'](_0xe9d01a,'ms'));this[_0x0af6('0x9')]('closedAt',moment());this[_0x0af6('0x9')]('duration',_0xe9d01a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0af6('0x5')](_0x0af6('0xb')))[_0x0af6('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x0af6('0xd')]();}},'closedAt':{'type':Sequelize[_0x0af6('0xe')],'get':function(){return moment(this[_0x0af6('0x5')]('closedAt'))[_0x0af6('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x0af6('0xd')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0af6('0x5')](_0x0af6('0xf')))[_0x0af6('0xc')](_0x0af6('0x10'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))['format'](_0x0af6('0x10'))[_0x0af6('0xd')]();}}}; \ No newline at end of file +var _0x81b7=['DATE','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','moment','path','../../config/environment','exports','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','format','toString'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x81b7,0x1f2));var _0x781b=function(_0x527d3d,_0x5c1413){_0x527d3d=_0x527d3d-0x0;var _0x9f23cf=_0x81b7[_0x527d3d];return _0x9f23cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x781b('0x0'));var path=require(_0x781b('0x1'));var config=require(_0x781b('0x2'));module[_0x781b('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x781b('0x4')]('value')?path[_0x781b('0x5')](this[_0x781b('0x4')](_0x781b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x781b('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x781b('0x7')],'set':function(_0xd9d633){var _0x482803=_0xd9d633['replace'](/\\/g,'/');this[_0x781b('0x8')](_0x781b('0x6'),_0x482803);}},'rating':{'type':Sequelize[_0x781b('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x781b('0x9')],'set':function(_0x5591d9){this[_0x781b('0x8')](_0x781b('0xa'),moment()['subtract'](_0x5591d9,'ms'));this['setDataValue'](_0x781b('0xb'),moment());this['setDataValue'](_0x781b('0xc'),_0x5591d9);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x781b('0x4')]('startedAt'))[_0x781b('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x781b('0xe')]();}},'closedAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0xb')))[_0x781b('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x781b('0xe')]();}},'createdAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0x10')))['format'](_0x781b('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0x12')))['format'](_0x781b('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1e63981..1e1a075 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 _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x50309e,_0x5ab9fb){_0x50309e=_0x50309e-0x0;var _0x4080ae=_0xd0bb[_0x50309e];return _0x4080ae;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file +var _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x0e85,0x7c));var _0x50e8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0e85[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 91e14e4..51d85e4 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 _0x15ca=['rimraf','../../config/environment','./screenRecording.attributes','define','screen_recordings','interactionid','util','api','moment','path'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x15ca,0xe2));var _0xa15c=function(_0x40a55b,_0x36540b){_0x40a55b=_0x40a55b-0x0;var _0x25ef48=_0x15ca[_0x40a55b];return _0x25ef48;};'use strict';var _=require('lodash');var util=require(_0xa15c('0x0'));var logger=require('../../config/logger')(_0xa15c('0x1'));var moment=require(_0xa15c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa15c('0x3'));var rimraf=require(_0xa15c('0x4'));var config=require(_0xa15c('0x5'));var attributes=require(_0xa15c('0x6'));module['exports']=function(_0x55eed0,_0x3130e5){return _0x55eed0[_0xa15c('0x7')]('ScreenRecording',attributes,{'tableName':_0xa15c('0x8'),'paranoid':![],'indexes':[{'name':_0xa15c('0x9'),'fields':[_0xa15c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda4a=['interactionid','lodash','util','../../config/logger','moment','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x3a7638,_0x194c42){var _0x41125f=function(_0x117c55){while(--_0x117c55){_0x3a7638['push'](_0x3a7638['shift']());}};_0x41125f(++_0x194c42);}(_0xda4a,0x1b1));var _0xada4=function(_0x41b122,_0x417ce7){_0x41b122=_0x41b122-0x0;var _0xb4432a=_0xda4a[_0x41b122];return _0xb4432a;};'use strict';var _=require(_0xada4('0x0'));var util=require(_0xada4('0x1'));var logger=require(_0xada4('0x2'))('api');var moment=require(_0xada4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xada4('0x4'));var rimraf=require('rimraf');var config=require(_0xada4('0x5'));var attributes=require(_0xada4('0x6'));module[_0xada4('0x7')]=function(_0x53a281,_0x58981b){return _0x53a281[_0xada4('0x8')](_0xada4('0x9'),attributes,{'tableName':_0xada4('0xa'),'paranoid':![],'indexes':[{'name':_0xada4('0xb'),'fields':[_0xada4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 70ad2b6..c9864fb 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 _0x6bed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6bed,0x155));var _0xd6be=function(_0x1d31b0,_0xeab68d){_0x1d31b0=_0x1d31b0-0x0;var _0x355c3e=_0x6bed[_0x1d31b0];return _0x355c3e;};'use strict';var _=require(_0xd6be('0x0'));var util=require(_0xd6be('0x1'));var moment=require('moment');var BPromise=require(_0xd6be('0x2'));var rs=require(_0xd6be('0x3'));var fs=require('fs');var Redis=require(_0xd6be('0x4'));var db=require(_0xd6be('0x5'))['db'];var utils=require(_0xd6be('0x6'));var logger=require(_0xd6be('0x7'))(_0xd6be('0x8'));var config=require(_0xd6be('0x9'));var jayson=require(_0xd6be('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x549122,_0x5bb3ed,_0x3da469){return new BPromise(function(_0x2a3f0c,_0x3a23bf){return client[_0xd6be('0xb')](_0x549122,_0x3da469)[_0xd6be('0xc')](function(_0x58978b){logger[_0xd6be('0xd')](_0xd6be('0xe'),_0x5bb3ed,'request\x20sent');logger[_0xd6be('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x5bb3ed,_0xd6be('0x10'),JSON[_0xd6be('0x11')](_0x58978b));if(_0x58978b[_0xd6be('0x12')]){if(_0x58978b['error'][_0xd6be('0x13')]===0x1f4){logger[_0xd6be('0x12')](_0xd6be('0xe'),_0x5bb3ed,_0x58978b[_0xd6be('0x12')][_0xd6be('0x14')]);return _0x3a23bf(_0x58978b[_0xd6be('0x12')][_0xd6be('0x14')]);}logger['error'](_0xd6be('0xe'),_0x5bb3ed,_0x58978b[_0xd6be('0x12')][_0xd6be('0x14')]);return _0x2a3f0c(_0x58978b[_0xd6be('0x12')][_0xd6be('0x14')]);}else{logger['info'](_0xd6be('0xe'),_0x5bb3ed,_0xd6be('0x10'));_0x2a3f0c(_0x58978b[_0xd6be('0x15')][_0xd6be('0x14')]);}})[_0xd6be('0x16')](function(_0x92b6a0){logger[_0xd6be('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x5bb3ed,_0x92b6a0);_0x3a23bf(_0x92b6a0);});});} \ No newline at end of file +var _0x3200=['error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x43032f,_0x1a01bb){var _0x3fcd5c=function(_0x4b3202){while(--_0x4b3202){_0x43032f['push'](_0x43032f['shift']());}};_0x3fcd5c(++_0x1a01bb);}(_0x3200,0x1b9));var _0x0320=function(_0x5347ed,_0x404911){_0x5347ed=_0x5347ed-0x0;var _0x5e7a21=_0x3200[_0x5347ed];return _0x5e7a21;};'use strict';var _=require('lodash');var util=require(_0x0320('0x0'));var moment=require(_0x0320('0x1'));var BPromise=require(_0x0320('0x2'));var rs=require(_0x0320('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0320('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0320('0x5'))(_0x0320('0x6'));var config=require(_0x0320('0x7'));var jayson=require(_0x0320('0x8'));var client=jayson['client'][_0x0320('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48179d,_0x434e72,_0x19b1d8){return new BPromise(function(_0x5e0fcc,_0x16eba1){return client['request'](_0x48179d,_0x19b1d8)[_0x0320('0xa')](function(_0x32ecd8){logger[_0x0320('0xb')](_0x0320('0xc'),_0x434e72,_0x0320('0xd'));logger[_0x0320('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x434e72,_0x0320('0xd'),JSON['stringify'](_0x32ecd8));if(_0x32ecd8['error']){if(_0x32ecd8[_0x0320('0xf')][_0x0320('0x10')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x434e72,_0x32ecd8[_0x0320('0xf')][_0x0320('0x11')]);return _0x16eba1(_0x32ecd8['error'][_0x0320('0x11')]);}logger[_0x0320('0xf')](_0x0320('0xc'),_0x434e72,_0x32ecd8[_0x0320('0xf')][_0x0320('0x11')]);return _0x5e0fcc(_0x32ecd8[_0x0320('0xf')]['message']);}else{logger[_0x0320('0xb')](_0x0320('0xc'),_0x434e72,_0x0320('0xd'));_0x5e0fcc(_0x32ecd8['result']['message']);}})[_0x0320('0x12')](function(_0x1b5b90){logger[_0x0320('0xf')](_0x0320('0xc'),_0x434e72,_0x1b5b90);_0x16eba1(_0x1b5b90);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9a8e514..85b4292 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 _0xea82=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','extname','originalname','single','file','addLogo','%s%s','logologin','post','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xea82,0x9e));var _0x2ea8=function(_0x13af65,_0x500f64){_0x13af65=_0x13af65-0x0;var _0x5ca08b=_0xea82[_0x13af65];return _0x5ca08b;};'use strict';var multer=require(_0x2ea8('0x0'));var util=require(_0x2ea8('0x1'));var path=require('path');var timeout=require(_0x2ea8('0x2'));var express=require(_0x2ea8('0x3'));var router=express[_0x2ea8('0x4')]();var fs_extra=require(_0x2ea8('0x5'));var auth=require(_0x2ea8('0x6'));var interaction=require(_0x2ea8('0x7'));var config=require(_0x2ea8('0x8'));var controller=require('./setting.controller');router[_0x2ea8('0x9')]('/',auth[_0x2ea8('0xa')](),controller[_0x2ea8('0xb')]);router['get'](_0x2ea8('0xc'),controller['getDate']);router[_0x2ea8('0x9')](_0x2ea8('0xd'),controller[_0x2ea8('0xe')]);router[_0x2ea8('0x9')](_0x2ea8('0xf'),controller['getLogo']);router['get'](_0x2ea8('0x10'),controller[_0x2ea8('0x11')]);router[_0x2ea8('0x9')](_0x2ea8('0x12'),controller[_0x2ea8('0x13')]);router[_0x2ea8('0x9')](_0x2ea8('0x14'),controller[_0x2ea8('0x15')]);router['get'](_0x2ea8('0x16'),controller[_0x2ea8('0x17')]);var upload=multer({'storage':multer[_0x2ea8('0x18')]({'destination':function(_0x3dd745,_0x193fef,_0x3abd2b){_0x3abd2b(null,path[_0x2ea8('0x19')](config[_0x2ea8('0x1a')],_0x2ea8('0x1b')));},'filename':function(_0x39b3bf,_0x5040e1,_0x5071ea){_0x5071ea(null,util[_0x2ea8('0x1c')]('%s%s','logo',path[_0x2ea8('0x1d')](_0x5040e1[_0x2ea8('0x1e')])));}})});router['post']('/:id/logo',upload[_0x2ea8('0x1f')](_0x2ea8('0x20')),controller[_0x2ea8('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e5454,_0x5e3869,_0x397330){_0x397330(null,path['join'](config[_0x2ea8('0x1a')],_0x2ea8('0x1b')));},'filename':function(_0x272357,_0xba2257,_0x1d003a){_0x1d003a(null,util['format'](_0x2ea8('0x22'),_0x2ea8('0x23'),path[_0x2ea8('0x1d')](_0xba2257['originalname'])));}})});router[_0x2ea8('0x24')](_0x2ea8('0x10'),upload['single']('file'),controller[_0x2ea8('0x25')]);var upload=multer({'storage':multer[_0x2ea8('0x18')]({'destination':function(_0x1f2dc6,_0x1bd50e,_0x571b43){_0x571b43(null,path[_0x2ea8('0x19')](config[_0x2ea8('0x1a')],'server/files/images/logos/'));},'filename':function(_0x32b323,_0x566c89,_0x2c242f){_0x2c242f(null,util['format']('%s%s',_0x2ea8('0x26'),path[_0x2ea8('0x1d')](_0x566c89['originalname'])));}})});router[_0x2ea8('0x24')](_0x2ea8('0x14'),upload['single'](_0x2ea8('0x20')),controller[_0x2ea8('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ae0d3,_0x34353b,_0xbf15bf){_0xbf15bf(null,path[_0x2ea8('0x19')](config[_0x2ea8('0x1a')],_0x2ea8('0x1b')));},'filename':function(_0x1934ee,_0x158bd2,_0x4bda22){_0x4bda22(null,util['format']('%s%s',_0x2ea8('0x28'),path[_0x2ea8('0x1d')](_0x158bd2['originalname'])));}})});router[_0x2ea8('0x24')](_0x2ea8('0x16'),upload[_0x2ea8('0x1f')](_0x2ea8('0x20')),controller[_0x2ea8('0x29')]);router[_0x2ea8('0x2a')](_0x2ea8('0xd'),auth['isAuthenticated'](),controller[_0x2ea8('0x2b')]);module[_0x2ea8('0x2c')]=router; \ No newline at end of file +var _0x0cd7=['getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','join','root','format','logo','extname','originalname','post','single','file','diskStorage','%s%s','logologin','addLogoLogin','preferred','addPreferred','server/files/images/logos/','favicon','/:id/favicon','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x0cd7,0x9b));var _0x70cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0cd7[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x70cd('0x0'));var util=require(_0x70cd('0x1'));var path=require(_0x70cd('0x2'));var timeout=require(_0x70cd('0x3'));var express=require('express');var router=express[_0x70cd('0x4')]();var fs_extra=require(_0x70cd('0x5'));var auth=require(_0x70cd('0x6'));var interaction=require(_0x70cd('0x7'));var config=require(_0x70cd('0x8'));var controller=require('./setting.controller');router[_0x70cd('0x9')]('/',auth[_0x70cd('0xa')](),controller[_0x70cd('0xb')]);router[_0x70cd('0x9')](_0x70cd('0xc'),controller[_0x70cd('0xd')]);router['get'](_0x70cd('0xe'),controller[_0x70cd('0xf')]);router[_0x70cd('0x9')](_0x70cd('0x10'),controller[_0x70cd('0x11')]);router['get'](_0x70cd('0x12'),controller['getLogoLogin']);router[_0x70cd('0x9')]('/:id/gdpr',controller[_0x70cd('0x13')]);router['get'](_0x70cd('0x14'),controller[_0x70cd('0x15')]);router[_0x70cd('0x9')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f25f2,_0x578a31,_0x399ee3){_0x399ee3(null,path[_0x70cd('0x16')](config[_0x70cd('0x17')],'server/files/images/logos/'));},'filename':function(_0x3b120f,_0x1da009,_0x294ec5){_0x294ec5(null,util[_0x70cd('0x18')]('%s%s',_0x70cd('0x19'),path[_0x70cd('0x1a')](_0x1da009[_0x70cd('0x1b')])));}})});router[_0x70cd('0x1c')](_0x70cd('0x10'),upload[_0x70cd('0x1d')](_0x70cd('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x70cd('0x1f')]({'destination':function(_0x7da358,_0x51155b,_0x36b265){_0x36b265(null,path[_0x70cd('0x16')](config[_0x70cd('0x17')],'server/files/images/logos/'));},'filename':function(_0x4dac99,_0x569e3a,_0xc626f){_0xc626f(null,util[_0x70cd('0x18')](_0x70cd('0x20'),_0x70cd('0x21'),path['extname'](_0x569e3a[_0x70cd('0x1b')])));}})});router[_0x70cd('0x1c')](_0x70cd('0x12'),upload['single'](_0x70cd('0x1e')),controller[_0x70cd('0x22')]);var upload=multer({'storage':multer[_0x70cd('0x1f')]({'destination':function(_0x2a428f,_0x361e29,_0x4e66c8){_0x4e66c8(null,path['join'](config[_0x70cd('0x17')],'server/files/images/logos/'));},'filename':function(_0xc90274,_0x420c6c,_0x444846){_0x444846(null,util[_0x70cd('0x18')](_0x70cd('0x20'),_0x70cd('0x23'),path[_0x70cd('0x1a')](_0x420c6c[_0x70cd('0x1b')])));}})});router[_0x70cd('0x1c')]('/:id/preferred',upload['single']('file'),controller[_0x70cd('0x24')]);var upload=multer({'storage':multer[_0x70cd('0x1f')]({'destination':function(_0x350a31,_0x1682cf,_0x3fcfb7){_0x3fcfb7(null,path[_0x70cd('0x16')](config[_0x70cd('0x17')],_0x70cd('0x25')));},'filename':function(_0x5c9f0c,_0x1072e5,_0x4972b4){_0x4972b4(null,util[_0x70cd('0x18')]('%s%s',_0x70cd('0x26'),path['extname'](_0x1072e5['originalname'])));}})});router[_0x70cd('0x1c')](_0x70cd('0x27'),upload[_0x70cd('0x1d')](_0x70cd('0x1e')),controller['addFavicon']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70cd('0x28')]);module[_0x70cd('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index de62710..7dda6dd 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 _0xeb85=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports'];(function(_0x35c511,_0x2dd26c){var _0x2906fd=function(_0x27b127){while(--_0x27b127){_0x35c511['push'](_0x35c511['shift']());}};_0x2906fd(++_0x2dd26c);}(_0xeb85,0x167));var _0x5eb8=function(_0x556706,_0x1a4f67){_0x556706=_0x556706-0x0;var _0x3c2dcb=_0xeb85[_0x556706];return _0x3c2dcb;};'use strict';var Sequelize=require('sequelize');module[_0x5eb8('0x0')]={'min_internal':{'type':Sequelize[_0x5eb8('0x1')](0xb),'unique':_0x5eb8('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5eb8('0x1')](0xb),'unique':_0x5eb8('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5eb8('0x4')],'defaultValue':_0x5eb8('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5eb8('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5eb8('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5eb8('0x4')]},'turnaddr':{'type':Sequelize[_0x5eb8('0x4')]},'turnusername':{'type':Sequelize[_0x5eb8('0x4')]},'turnpassword':{'type':Sequelize[_0x5eb8('0x4')]},'pageTitle':{'type':Sequelize[_0x5eb8('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5eb8('0x4')],'defaultValue':_0x5eb8('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5eb8('0x4')],'defaultValue':_0x5eb8('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5eb8('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5eb8('0x1')]},'transcribeRegion':{'type':Sequelize[_0x5eb8('0x4')]},'sentiment':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5eb8('0x4')]},'bucket':{'type':Sequelize[_0x5eb8('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5eb8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5eb8('0x1')](0x2)[_0x5eb8('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5eb8('0x1')](0x2)[_0x5eb8('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5eb8('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5eb8('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x5eb8('0x1')],'defaultValue':0x14}}; \ No newline at end of file +var _0xc04a=['UNSIGNED','sequelize','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0x261d9e,_0x4f0942){var _0x3f8a2c=function(_0x28aaf8){while(--_0x28aaf8){_0x261d9e['push'](_0x261d9e['shift']());}};_0x3f8a2c(++_0x4f0942);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xac04('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xac04('0x1')](0xb),'unique':_0xac04('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xac04('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xac04('0x3')},'logo':{'type':Sequelize[_0xac04('0x4')]},'defaultLogo':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xac04('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xac04('0x4')]},'turnaddr':{'type':Sequelize[_0xac04('0x4')]},'turnusername':{'type':Sequelize[_0xac04('0x4')]},'turnpassword':{'type':Sequelize[_0xac04('0x4')]},'pageTitle':{'type':Sequelize[_0xac04('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xac04('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xac04('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xac04('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xac04('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xac04('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xac04('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xac04('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xac04('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xac04('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xac04('0x1')](0x2)[_0xac04('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xac04('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xac04('0x1')](0x2)[_0xac04('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xac04('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xac04('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xac04('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xac04('0x1')],'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 cdb619d..2fa6d1c 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 _0xd13e=['logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','custom','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','now','utcOffset','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Setting','rows','show','params','keys','intersection','body','addLogo','file','find','addLogoLogin','filename','server/files/images/logos','getLicense'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0xd13e,0x193));var _0xed13=function(_0x126530,_0x306f94){_0x126530=_0x126530-0x0;var _0x5a1168=_0xd13e[_0x126530];return _0x5a1168;};'use strict';var emlformat=require(_0xed13('0x0'));var rimraf=require(_0xed13('0x1'));var zipdir=require(_0xed13('0x2'));var jsonpatch=require(_0xed13('0x3'));var rp=require('request-promise');var moment=require(_0xed13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed13('0x5'));var util=require('util');var path=require(_0xed13('0x6'));var sox=require(_0xed13('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var licenseUtil=require(_0xed13('0x17'));var db=require(_0xed13('0x18'))['db'];var jayson=require(_0xed13('0x19'));var client=jayson[_0xed13('0x1a')][_0xed13('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5b950a,_0xdee482,_0x4a3ff4,_0x257074){return new BPromise(function(_0x56fdc6,_0x6e2978){var _0x56108d=_0x257074||client;return _0x56108d[_0xed13('0x1c')](_0x5b950a,_0x4a3ff4)['then'](function(_0x38901a){logger[_0xed13('0x1d')](_0xed13('0x1e'),_0xdee482,_0xed13('0x1f'));logger[_0xed13('0x20')](_0xed13('0x21'),_0xdee482,_0xed13('0x1f'),JSON[_0xed13('0x22')](_0x38901a));if(_0x38901a[_0xed13('0x23')]){if(_0x38901a[_0xed13('0x23')][_0xed13('0x24')]===0x1f4){logger[_0xed13('0x23')](_0xed13('0x1e'),_0xdee482,_0x38901a[_0xed13('0x23')][_0xed13('0x25')]);return _0x6e2978(_0x38901a[_0xed13('0x23')]['message']);}logger['error'](_0xed13('0x1e'),_0xdee482,_0x38901a[_0xed13('0x23')]['message']);return _0x56fdc6(_0x38901a[_0xed13('0x23')]['message']);}else{logger['info'](_0xed13('0x1e'),_0xdee482,_0xed13('0x1f'));_0x56fdc6(_0x38901a[_0xed13('0x26')][_0xed13('0x25')]);}})[_0xed13('0x27')](function(_0x2fc1e4){logger['error']('Setting,\x20%s,\x20%s',_0xdee482,_0x2fc1e4);_0x6e2978(_0x2fc1e4);});});}function respondWithStatusCode(_0x5d7ae1,_0x19d51b){_0x19d51b=_0x19d51b||0xcc;return function(_0x3b1f23){if(_0x3b1f23){return _0x5d7ae1[_0xed13('0x28')](_0x19d51b);}return _0x5d7ae1[_0xed13('0x29')](_0x19d51b)[_0xed13('0x2a')]();};}function respondWithResult(_0x28f8b8,_0x1f0405){_0x1f0405=_0x1f0405||0xc8;return function(_0x276c57){if(_0x276c57){return _0x28f8b8[_0xed13('0x29')](_0x1f0405)[_0xed13('0x2b')](_0x276c57);}};}function respondWithFilteredResult(_0x1f064c,_0x3bc666){return function(_0x2c6c33){if(_0x2c6c33){var _0x322fc3=typeof _0x3bc666['offset']==='undefined'&&typeof _0x3bc666[_0xed13('0x2c')]===_0xed13('0x2d');var _0x55a1f2=_0x2c6c33[_0xed13('0x2e')];var _0x40444a=_0x322fc3?0x0:_0x3bc666['offset'];var _0x7ce996=_0x322fc3?_0x2c6c33[_0xed13('0x2e')]:_0x3bc666[_0xed13('0x2f')]+_0x3bc666['limit'];var _0x3a5387;if(_0x7ce996>=_0x55a1f2){_0x7ce996=_0x55a1f2;_0x3a5387=0xc8;}else{_0x3a5387=0xce;}_0x1f064c[_0xed13('0x29')](_0x3a5387);return _0x1f064c['set'](_0xed13('0x30'),_0x40444a+'-'+_0x7ce996+'/'+_0x55a1f2)[_0xed13('0x2b')](_0x2c6c33);}return null;};}function patchUpdates(_0x56619a){return function(_0x11cb93){try{jsonpatch[_0xed13('0x31')](_0x11cb93,_0x56619a,!![]);}catch(_0x2bcc8b){return BPromise[_0xed13('0x32')](_0x2bcc8b);}return _0x11cb93[_0xed13('0x33')]();};}function saveUpdates(_0x40660d,_0xe332){return function(_0x5b3828){if(_0x5b3828){return _0x5b3828[_0xed13('0x34')](_0x40660d)['then'](function(_0x590a4a){return _0x590a4a;});}return null;};}function removeEntity(_0x3ac2f7,_0x378fd3){return function(_0x13e3bb){if(_0x13e3bb){return _0x13e3bb['destroy']()[_0xed13('0x35')](function(){_0x3ac2f7[_0xed13('0x29')](0xcc)[_0xed13('0x2a')]();});}};}function handleEntityNotFound(_0x5bf415,_0x2f5abf){return function(_0x1c6070){if(!_0x1c6070){_0x5bf415[_0xed13('0x28')](0x194);}return _0x1c6070;};}function handleError(_0x46570b,_0x5b8fee){_0x5b8fee=_0x5b8fee||0x1f4;return function(_0x1b7001){logger[_0xed13('0x23')](_0x1b7001[_0xed13('0x36')]);if(_0x1b7001[_0xed13('0x37')]){delete _0x1b7001[_0xed13('0x37')];}_0x46570b[_0xed13('0x29')](_0x5b8fee)[_0xed13('0x38')](_0x1b7001);};}exports[_0xed13('0x39')]=function(_0x2c9ce3,_0x358b32){var _0x5a09e4={},_0x2342a5={},_0x31f6e5={'count':0x0,'rows':[]};var _0x59384b=_['map'](db['Setting'][_0xed13('0x3a')],function(_0x199074){return{'name':_0x199074['fieldName'],'type':_0x199074['type'][_0xed13('0x3b')]};});_0x2342a5[_0xed13('0x3c')]=_[_0xed13('0x3d')](_0x59384b,_0xed13('0x37'));_0x2342a5[_0xed13('0x3e')]=_['keys'](_0x2c9ce3['query']);_0x2342a5[_0xed13('0x3f')]=_['intersection'](_0x2342a5[_0xed13('0x3c')],_0x2342a5['query']);_0x5a09e4[_0xed13('0x40')]=_['intersection'](_0x2342a5['model'],qs['fields'](_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x41')]));_0x5a09e4[_0xed13('0x40')]=_0x5a09e4[_0xed13('0x40')][_0xed13('0x42')]?_0x5a09e4['attributes']:_0x2342a5[_0xed13('0x3c')];if(!_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x43')](_0xed13('0x44'))){_0x5a09e4[_0xed13('0x2c')]=qs['limit'](_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x2c')]);_0x5a09e4[_0xed13('0x2f')]=qs[_0xed13('0x2f')](_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x2f')]);}_0x5a09e4['order']=qs[_0xed13('0x45')](_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x45')]);_0x5a09e4[_0xed13('0x46')]=qs[_0xed13('0x3f')](_[_0xed13('0x47')](_0x2c9ce3[_0xed13('0x3e')],_0x2342a5[_0xed13('0x3f')]),_0x59384b);if(_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x48')]){_0x5a09e4[_0xed13('0x46')]=_[_0xed13('0x49')](_0x5a09e4[_0xed13('0x46')],{'$or':_[_0xed13('0x3d')](_0x59384b,function(_0x5f37d6){if(_0x5f37d6[_0xed13('0x4a')]!==_0xed13('0x4b')){var _0x51e5ba={};_0x51e5ba[_0x5f37d6[_0xed13('0x37')]]={'$like':'%'+_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x48')]+'%'};return _0x51e5ba;}})});}_0x5a09e4=_['merge']({},_0x5a09e4,_0x2c9ce3[_0xed13('0x4c')]);var _0x2afab0={'where':_0x5a09e4[_0xed13('0x46')]};return db['Setting']['count'](_0x2afab0)[_0xed13('0x35')](function(_0x4574ab){_0x31f6e5['count']=_0x4574ab;if(_0x2c9ce3[_0xed13('0x3e')][_0xed13('0x4d')]){_0x5a09e4[_0xed13('0x4e')]=[{'all':!![]}];}return db[_0xed13('0x4f')]['findAll'](_0x5a09e4);})[_0xed13('0x35')](function(_0xf4ea89){_0x31f6e5[_0xed13('0x50')]=_0xf4ea89;return _0x31f6e5;})[_0xed13('0x35')](respondWithFilteredResult(_0x358b32,_0x5a09e4))['catch'](handleError(_0x358b32,null));};exports[_0xed13('0x51')]=function(_0x5a77db,_0x46dcef){var _0x50d12f={'raw':![],'where':{'id':_0x5a77db[_0xed13('0x52')]['id']}},_0x5a0828={};_0x5a0828[_0xed13('0x3c')]=_['keys'](db[_0xed13('0x4f')][_0xed13('0x3a')]);_0x5a0828[_0xed13('0x3e')]=_[_0xed13('0x53')](_0x5a77db['query']);_0x5a0828[_0xed13('0x3f')]=_['intersection'](_0x5a0828[_0xed13('0x3c')],_0x5a0828[_0xed13('0x3e')]);_0x50d12f[_0xed13('0x40')]=_[_0xed13('0x54')](_0x5a0828[_0xed13('0x3c')],qs[_0xed13('0x41')](_0x5a77db[_0xed13('0x3e')][_0xed13('0x41')]));_0x50d12f['attributes']=_0x50d12f[_0xed13('0x40')][_0xed13('0x42')]?_0x50d12f[_0xed13('0x40')]:_0x5a0828[_0xed13('0x3c')];if(_0x5a77db['query'][_0xed13('0x4d')]){_0x50d12f['include']=[{'all':!![]}];}_0x50d12f=_[_0xed13('0x49')]({},_0x50d12f,_0x5a77db['options']);return db['Setting']['find'](_0x50d12f)[_0xed13('0x35')](handleEntityNotFound(_0x46dcef,null))[_0xed13('0x35')](respondWithResult(_0x46dcef,null))[_0xed13('0x27')](handleError(_0x46dcef,null));};exports['update']=function(_0x9e371,_0x3b72b4){if(_0x9e371[_0xed13('0x55')]['id']){delete _0x9e371[_0xed13('0x55')]['id'];}return db[_0xed13('0x4f')]['find']({'where':{'id':_0x9e371[_0xed13('0x52')]['id']}})[_0xed13('0x35')](handleEntityNotFound(_0x3b72b4,null))[_0xed13('0x35')](saveUpdates(_0x9e371[_0xed13('0x55')],null))['then'](respondWithResult(_0x3b72b4,null))[_0xed13('0x27')](handleError(_0x3b72b4,null));};exports[_0xed13('0x56')]=function(_0x326b10,_0x24a00d,_0x170752){if(_0x326b10[_0xed13('0x57')]&&_0x326b10[_0xed13('0x57')]['filename']){_0x326b10[_0xed13('0x55')]['logo']=_0x326b10[_0xed13('0x57')]['filename'];}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0x326b10[_0xed13('0x52')]['id']}})[_0xed13('0x35')](handleEntityNotFound(_0x24a00d,null))[_0xed13('0x35')](saveUpdates(_0x326b10['body'],null))['then'](respondWithResult(_0x24a00d,null))[_0xed13('0x27')](handleError(_0x24a00d,null));};exports[_0xed13('0x59')]=function(_0xe2ae5d,_0x1d6de4,_0x3c9a51){if(_0xe2ae5d[_0xed13('0x57')]&&_0xe2ae5d[_0xed13('0x57')][_0xed13('0x5a')]){_0xe2ae5d[_0xed13('0x55')]['loginLogo']=_0xe2ae5d['file']['filename'];}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0xe2ae5d[_0xed13('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d6de4,null))['then'](saveUpdates(_0xe2ae5d[_0xed13('0x55')],null))[_0xed13('0x35')](respondWithResult(_0x1d6de4,null))[_0xed13('0x27')](handleError(_0x1d6de4,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x4ffe1f,_0x5289bc,_0x1c3d01){var _0x375e5a=_0xed13('0x5b');var _0x578772={'custom':![]};return utilLicense[_0xed13('0x5c')]()[_0xed13('0x35')](function(_0x50644e){if(_0x50644e){_0x578772=_0x50644e;}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0x4ffe1f[_0xed13('0x52')]['id']},'attributes':[_0xed13('0x5d'),_0xed13('0x5e'),_0xed13('0x5f'),_0xed13('0x60'),_0xed13('0x61'),_0xed13('0x62'),'defaultPreferred',_0xed13('0x63')],'raw':!![]});})[_0xed13('0x35')](handleEntityNotFound(_0x5289bc,null))[_0xed13('0x35')](function(_0xbe4de0){if(_0xbe4de0){var _0x57d0fa=_0xbe4de0['logo']&&fs['existsSync'](path[_0xed13('0x64')](config[_0xed13('0x65')],_0x375e5a,_[_0xed13('0x66')](_0xbe4de0[_0xed13('0x5d')])))?path[_0xed13('0x64')](config[_0xed13('0x65')],_0x375e5a,_[_0xed13('0x66')](_0xbe4de0[_0xed13('0x5d')])):path[_0xed13('0x64')](config[_0xed13('0x65')],_0x375e5a,_[_0xed13('0x66')](_0xed13('0x67')));var _0x2a17eb=_0xed13('0x68')+_[_0xed13('0x69')](_0xed13('0x5d'));if(_0xbe4de0[_0x2a17eb]||!_0x578772['custom']){_0x57d0fa=path[_0xed13('0x64')](config[_0xed13('0x65')],_0x375e5a,_[_0xed13('0x66')](_0xed13('0x67')));}if(!fs[_0xed13('0x6a')](_0x57d0fa)){throw new db[(_0xed13('0x6b'))][(_0xed13('0x6c'))](_['upperFirst']('logo')+_0xed13('0x6d'));}return _0x5289bc[_0xed13('0x6e')](_0x57d0fa);}})[_0xed13('0x27')](handleError(_0x5289bc,null));};var utilLicense=require(_0xed13('0x17'));exports[_0xed13('0x6f')]=function(_0x54f348,_0x487329,_0x34f24b){var _0x2b1285=_0xed13('0x5b');var _0x3d80ec={'custom':![]};return utilLicense[_0xed13('0x5c')]()['then'](function(_0x1a51fb){if(_0x1a51fb){_0x3d80ec=_0x1a51fb;}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0x54f348[_0xed13('0x52')]['id']},'attributes':[_0xed13('0x5d'),_0xed13('0x5e'),_0xed13('0x5f'),_0xed13('0x60'),_0xed13('0x61'),_0xed13('0x62'),_0xed13('0x70'),_0xed13('0x63')],'raw':!![]});})[_0xed13('0x35')](handleEntityNotFound(_0x487329,null))[_0xed13('0x35')](function(_0x57c172){if(_0x57c172){var _0x134463=_0x57c172[_0xed13('0x5e')]&&fs[_0xed13('0x6a')](path[_0xed13('0x64')](config['root'],_0x2b1285,_['toLower'](_0x57c172[_0xed13('0x5e')])))?path['join'](config[_0xed13('0x65')],_0x2b1285,_[_0xed13('0x66')](_0x57c172['loginLogo'])):path['join'](config[_0xed13('0x65')],_0x2b1285,_[_0xed13('0x66')](_0xed13('0x71')));var _0x891e75=_0xed13('0x68')+_['upperFirst'](_0xed13('0x5e'));if(_0x57c172[_0x891e75]||!_0x3d80ec[_0xed13('0x72')]){_0x134463=path[_0xed13('0x64')](config[_0xed13('0x65')],_0x2b1285,_[_0xed13('0x66')]('default_loginLogo.svg'));}if(!fs[_0xed13('0x6a')](_0x134463)){throw new db[(_0xed13('0x6b'))][(_0xed13('0x6c'))](_['upperFirst'](_0xed13('0x5e'))+_0xed13('0x6d'));}return _0x487329['download'](_0x134463);}})[_0xed13('0x27')](handleError(_0x487329,null));};exports['gdpr']=function(_0x48b75d,_0x1ee7b0){return db[_0xed13('0x4f')]['find']({'where':{'id':_0x48b75d[_0xed13('0x52')]['id']},'attributes':[_0xed13('0x73')]})[_0xed13('0x35')](respondWithResult(_0x1ee7b0,null))[_0xed13('0x27')](handleError(_0x1ee7b0,null));};exports[_0xed13('0x74')]=function(_0x5d1313,_0x1a4e5,_0x1cd9dc){if(_0x5d1313[_0xed13('0x57')]&&_0x5d1313[_0xed13('0x57')]['filename']){_0x5d1313[_0xed13('0x55')][_0xed13('0x5f')]=_0x5d1313[_0xed13('0x57')][_0xed13('0x5a')];}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0x5d1313['params']['id']}})[_0xed13('0x35')](handleEntityNotFound(_0x1a4e5,null))[_0xed13('0x35')](saveUpdates(_0x5d1313['body'],null))['then'](respondWithResult(_0x1a4e5,null))[_0xed13('0x27')](handleError(_0x1a4e5,null));};var utilLicense=require(_0xed13('0x17'));exports[_0xed13('0x75')]=function(_0x4316ae,_0x16d33b,_0x4136df){var _0x2036de='server/files/images/logos';var _0x45f398={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xbee984){if(_0xbee984){_0x45f398=_0xbee984;}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0x4316ae[_0xed13('0x52')]['id']},'attributes':[_0xed13('0x5d'),'loginLogo',_0xed13('0x5f'),'favicon','defaultLogo',_0xed13('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xed13('0x35')](handleEntityNotFound(_0x16d33b,null))[_0xed13('0x35')](function(_0x35b373){if(_0x35b373){var _0xd3597c=_0x35b373[_0xed13('0x5f')]&&fs[_0xed13('0x6a')](path[_0xed13('0x64')](config[_0xed13('0x65')],_0x2036de,_[_0xed13('0x66')](_0x35b373[_0xed13('0x5f')])))?path['join'](config['root'],_0x2036de,_['toLower'](_0x35b373[_0xed13('0x5f')])):path['join'](config['root'],_0x2036de,_[_0xed13('0x66')](_0xed13('0x76')));var _0x46201d=_0xed13('0x68')+_['upperFirst'](_0xed13('0x5f'));if(_0x35b373[_0x46201d]||!_0x45f398['custom']||!_0x45f398[_0xed13('0x5f')]){_0xd3597c=path['join'](config[_0xed13('0x65')],_0x2036de,_[_0xed13('0x66')]('default_preferred.png'));}if(!fs['existsSync'](_0xd3597c)){throw new db['Sequelize'][(_0xed13('0x6c'))](_[_0xed13('0x69')](_0xed13('0x5f'))+_0xed13('0x6d'));}return _0x16d33b['download'](_0xd3597c);}})['catch'](handleError(_0x16d33b,null));};exports['addFavicon']=function(_0x5d2535,_0x13cc9f,_0x27a6a7){if(_0x5d2535['file']&&_0x5d2535[_0xed13('0x57')][_0xed13('0x5a')]){_0x5d2535[_0xed13('0x55')]['favicon']=_0x5d2535['file'][_0xed13('0x5a')];}return db[_0xed13('0x4f')][_0xed13('0x58')]({'where':{'id':_0x5d2535[_0xed13('0x52')]['id']}})['then'](handleEntityNotFound(_0x13cc9f,null))['then'](saveUpdates(_0x5d2535['body'],null))[_0xed13('0x35')](respondWithResult(_0x13cc9f,null))[_0xed13('0x27')](handleError(_0x13cc9f,null));};var utilLicense=require(_0xed13('0x17'));exports[_0xed13('0x77')]=function(_0x29a256,_0x28d8cc,_0x3629a5){var _0x35e540='server/files/images/logos';var _0x3d5ccf={'custom':![]};return utilLicense[_0xed13('0x5c')]()[_0xed13('0x35')](function(_0x19baed){if(_0x19baed){_0x3d5ccf=_0x19baed;}return db['Setting'][_0xed13('0x58')]({'where':{'id':_0x29a256[_0xed13('0x52')]['id']},'attributes':['logo',_0xed13('0x5e'),_0xed13('0x5f'),_0xed13('0x60'),_0xed13('0x61'),_0xed13('0x62'),_0xed13('0x70'),_0xed13('0x63')],'raw':!![]});})[_0xed13('0x35')](handleEntityNotFound(_0x28d8cc,null))[_0xed13('0x35')](function(_0x1fb2c3){if(_0x1fb2c3){var _0x3d5d31=_0x1fb2c3['favicon']&&fs[_0xed13('0x6a')](path['join'](config[_0xed13('0x65')],_0x35e540,_[_0xed13('0x66')](_0x1fb2c3['favicon'])))?path[_0xed13('0x64')](config[_0xed13('0x65')],_0x35e540,_['toLower'](_0x1fb2c3[_0xed13('0x60')])):path[_0xed13('0x64')](config[_0xed13('0x65')],_0x35e540,_[_0xed13('0x66')](_0xed13('0x78')));var _0x4b03b6=_0xed13('0x68')+_[_0xed13('0x69')]('favicon');if(_0x1fb2c3[_0x4b03b6]||!_0x3d5ccf[_0xed13('0x72')]){_0x3d5d31=path[_0xed13('0x64')](config['root'],_0x35e540,_[_0xed13('0x66')]('default_favicon.ico'));}if(!fs[_0xed13('0x6a')](_0x3d5d31)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0xed13('0x60'))+_0xed13('0x6d'));}return _0x28d8cc['download'](_0x3d5d31);}})[_0xed13('0x27')](handleError(_0x28d8cc,null));};exports[_0xed13('0x79')]=function(_0x4eb5e6,_0x57be37){var _0x5105b8={'offset':moment()['utcOffset']()};_0x5105b8[_0xed13('0x7a')]=moment()[_0xed13('0x7b')](_0x5105b8['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x57be37[_0xed13('0x29')](0xc8)[_0xed13('0x38')](_0x5105b8);}; \ No newline at end of file +var _0xa9de=['defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','ValidationError','securePassword','getPreferred','default_preferred.png','addFavicon','favicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','stack','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','name','filter','options','includeAll','include','Setting','findAll','rows','params','find','body','addLogo','file','filename','logo','server/files/images/logos','getLicense','loginLogo','preferred','defaultLogo'];(function(_0x8fbe89,_0x260590){var _0x30aaf9=function(_0x448876){while(--_0x448876){_0x8fbe89['push'](_0x8fbe89['shift']());}};_0x30aaf9(++_0x260590);}(_0xa9de,0x99));var _0xea9d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa9de[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xea9d('0x0'));var rimraf=require(_0xea9d('0x1'));var zipdir=require(_0xea9d('0x2'));var jsonpatch=require(_0xea9d('0x3'));var rp=require('request-promise');var moment=require(_0xea9d('0x4'));var BPromise=require(_0xea9d('0x5'));var Mustache=require(_0xea9d('0x6'));var util=require(_0xea9d('0x7'));var path=require(_0xea9d('0x8'));var sox=require(_0xea9d('0x9'));var csv=require('to-csv');var ejs=require(_0xea9d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea9d('0xb'));var crypto=require(_0xea9d('0xc'));var jsforce=require(_0xea9d('0xd'));var deskjs=require(_0xea9d('0xe'));var toCsv=require(_0xea9d('0xf'));var querystring=require(_0xea9d('0x10'));var Papa=require(_0xea9d('0x11'));var Redis=require('ioredis');var authService=require(_0xea9d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xea9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea9d('0x14'));var utils=require(_0xea9d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xea9d('0x16'));var db=require(_0xea9d('0x17'))['db'];var jayson=require(_0xea9d('0x18'));var client=jayson['client'][_0xea9d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4c4440,_0x53a99d,_0x2d9afb,_0x2dc9ab){return new BPromise(function(_0x11d353,_0x1dfd67){var _0x5f4f19=_0x2dc9ab||client;return _0x5f4f19[_0xea9d('0x1a')](_0x4c4440,_0x2d9afb)['then'](function(_0x2635dc){logger[_0xea9d('0x1b')]('Setting,\x20%s,\x20%s',_0x53a99d,_0xea9d('0x1c'));logger[_0xea9d('0x1d')](_0xea9d('0x1e'),_0x53a99d,'request\x20sent',JSON[_0xea9d('0x1f')](_0x2635dc));if(_0x2635dc['error']){if(_0x2635dc['error'][_0xea9d('0x20')]===0x1f4){logger[_0xea9d('0x21')]('Setting,\x20%s,\x20%s',_0x53a99d,_0x2635dc[_0xea9d('0x21')][_0xea9d('0x22')]);return _0x1dfd67(_0x2635dc[_0xea9d('0x21')]['message']);}logger['error'](_0xea9d('0x23'),_0x53a99d,_0x2635dc[_0xea9d('0x21')][_0xea9d('0x22')]);return _0x11d353(_0x2635dc[_0xea9d('0x21')][_0xea9d('0x22')]);}else{logger[_0xea9d('0x1b')](_0xea9d('0x23'),_0x53a99d,'request\x20sent');_0x11d353(_0x2635dc[_0xea9d('0x24')]['message']);}})[_0xea9d('0x25')](function(_0x18a83c){logger['error']('Setting,\x20%s,\x20%s',_0x53a99d,_0x18a83c);_0x1dfd67(_0x18a83c);});});}function respondWithStatusCode(_0x15800f,_0x468115){_0x468115=_0x468115||0xcc;return function(_0x4c3f3c){if(_0x4c3f3c){return _0x15800f[_0xea9d('0x26')](_0x468115);}return _0x15800f[_0xea9d('0x27')](_0x468115)['end']();};}function respondWithResult(_0xe600f5,_0x390c1b){_0x390c1b=_0x390c1b||0xc8;return function(_0x10d09d){if(_0x10d09d){return _0xe600f5[_0xea9d('0x27')](_0x390c1b)['json'](_0x10d09d);}};}function respondWithFilteredResult(_0x571bf0,_0x481e59){return function(_0x533a4d){if(_0x533a4d){var _0x2d27c6=typeof _0x481e59[_0xea9d('0x28')]===_0xea9d('0x29')&&typeof _0x481e59[_0xea9d('0x2a')]===_0xea9d('0x29');var _0x18a049=_0x533a4d['count'];var _0x90ddcf=_0x2d27c6?0x0:_0x481e59[_0xea9d('0x28')];var _0x274539=_0x2d27c6?_0x533a4d[_0xea9d('0x2b')]:_0x481e59[_0xea9d('0x28')]+_0x481e59[_0xea9d('0x2a')];var _0x4fce4d;if(_0x274539>=_0x18a049){_0x274539=_0x18a049;_0x4fce4d=0xc8;}else{_0x4fce4d=0xce;}_0x571bf0['status'](_0x4fce4d);return _0x571bf0[_0xea9d('0x2c')](_0xea9d('0x2d'),_0x90ddcf+'-'+_0x274539+'/'+_0x18a049)[_0xea9d('0x2e')](_0x533a4d);}return null;};}function patchUpdates(_0x482cb8){return function(_0x8b1785){try{jsonpatch[_0xea9d('0x2f')](_0x8b1785,_0x482cb8,!![]);}catch(_0x4872ef){return BPromise['reject'](_0x4872ef);}return _0x8b1785[_0xea9d('0x30')]();};}function saveUpdates(_0x68da46,_0x4f02e5){return function(_0x3c65a5){if(_0x3c65a5){return _0x3c65a5[_0xea9d('0x31')](_0x68da46)[_0xea9d('0x32')](function(_0xf1519d){return _0xf1519d;});}return null;};}function removeEntity(_0x4533e0,_0x4de2ca){return function(_0x484596){if(_0x484596){return _0x484596[_0xea9d('0x33')]()[_0xea9d('0x32')](function(){_0x4533e0['status'](0xcc)[_0xea9d('0x34')]();});}};}function handleEntityNotFound(_0x581d56,_0x20c23b){return function(_0x441d2a){if(!_0x441d2a){_0x581d56['sendStatus'](0x194);}return _0x441d2a;};}function handleError(_0x3326e4,_0x50f032){_0x50f032=_0x50f032||0x1f4;return function(_0x5771b6){logger[_0xea9d('0x21')](_0x5771b6[_0xea9d('0x35')]);if(_0x5771b6['name']){delete _0x5771b6['name'];}_0x3326e4['status'](_0x50f032)['send'](_0x5771b6);};}exports[_0xea9d('0x36')]=function(_0x577a1c,_0x36f044){var _0x2e6904={},_0xad42e1={},_0x39ce5b={'count':0x0,'rows':[]};var _0x29e4b3=_[_0xea9d('0x37')](db['Setting'][_0xea9d('0x38')],function(_0x5d2bde){return{'name':_0x5d2bde[_0xea9d('0x39')],'type':_0x5d2bde[_0xea9d('0x3a')][_0xea9d('0x3b')]};});_0xad42e1[_0xea9d('0x3c')]=_['map'](_0x29e4b3,'name');_0xad42e1[_0xea9d('0x3d')]=_[_0xea9d('0x3e')](_0x577a1c['query']);_0xad42e1[_0xea9d('0x3f')]=_[_0xea9d('0x40')](_0xad42e1[_0xea9d('0x3c')],_0xad42e1[_0xea9d('0x3d')]);_0x2e6904[_0xea9d('0x41')]=_[_0xea9d('0x40')](_0xad42e1['model'],qs[_0xea9d('0x42')](_0x577a1c[_0xea9d('0x3d')]['fields']));_0x2e6904[_0xea9d('0x41')]=_0x2e6904[_0xea9d('0x41')][_0xea9d('0x43')]?_0x2e6904['attributes']:_0xad42e1[_0xea9d('0x3c')];if(!_0x577a1c[_0xea9d('0x3d')]['hasOwnProperty'](_0xea9d('0x44'))){_0x2e6904['limit']=qs[_0xea9d('0x2a')](_0x577a1c[_0xea9d('0x3d')]['limit']);_0x2e6904[_0xea9d('0x28')]=qs['offset'](_0x577a1c[_0xea9d('0x3d')][_0xea9d('0x28')]);}_0x2e6904['order']=qs['sort'](_0x577a1c[_0xea9d('0x3d')][_0xea9d('0x45')]);_0x2e6904[_0xea9d('0x46')]=qs[_0xea9d('0x3f')](_['pick'](_0x577a1c['query'],_0xad42e1[_0xea9d('0x3f')]),_0x29e4b3);if(_0x577a1c[_0xea9d('0x3d')]['filter']){_0x2e6904['where']=_[_0xea9d('0x47')](_0x2e6904[_0xea9d('0x46')],{'$or':_[_0xea9d('0x37')](_0x29e4b3,function(_0x53e0f3){if(_0x53e0f3['type']!==_0xea9d('0x48')){var _0x26b86c={};_0x26b86c[_0x53e0f3[_0xea9d('0x49')]]={'$like':'%'+_0x577a1c[_0xea9d('0x3d')][_0xea9d('0x4a')]+'%'};return _0x26b86c;}})});}_0x2e6904=_['merge']({},_0x2e6904,_0x577a1c[_0xea9d('0x4b')]);var _0x5a51d8={'where':_0x2e6904[_0xea9d('0x46')]};return db['Setting'][_0xea9d('0x2b')](_0x5a51d8)['then'](function(_0x450455){_0x39ce5b[_0xea9d('0x2b')]=_0x450455;if(_0x577a1c[_0xea9d('0x3d')][_0xea9d('0x4c')]){_0x2e6904[_0xea9d('0x4d')]=[{'all':!![]}];}return db[_0xea9d('0x4e')][_0xea9d('0x4f')](_0x2e6904);})[_0xea9d('0x32')](function(_0x173bfb){_0x39ce5b[_0xea9d('0x50')]=_0x173bfb;return _0x39ce5b;})[_0xea9d('0x32')](respondWithFilteredResult(_0x36f044,_0x2e6904))['catch'](handleError(_0x36f044,null));};exports['show']=function(_0xd74d1,_0x424014){var _0x1f3819={'raw':![],'where':{'id':_0xd74d1[_0xea9d('0x51')]['id']}},_0x2a3515={};_0x2a3515['model']=_[_0xea9d('0x3e')](db['Setting'][_0xea9d('0x38')]);_0x2a3515[_0xea9d('0x3d')]=_[_0xea9d('0x3e')](_0xd74d1[_0xea9d('0x3d')]);_0x2a3515[_0xea9d('0x3f')]=_[_0xea9d('0x40')](_0x2a3515['model'],_0x2a3515[_0xea9d('0x3d')]);_0x1f3819[_0xea9d('0x41')]=_[_0xea9d('0x40')](_0x2a3515[_0xea9d('0x3c')],qs[_0xea9d('0x42')](_0xd74d1[_0xea9d('0x3d')][_0xea9d('0x42')]));_0x1f3819[_0xea9d('0x41')]=_0x1f3819[_0xea9d('0x41')][_0xea9d('0x43')]?_0x1f3819[_0xea9d('0x41')]:_0x2a3515[_0xea9d('0x3c')];if(_0xd74d1['query'][_0xea9d('0x4c')]){_0x1f3819[_0xea9d('0x4d')]=[{'all':!![]}];}_0x1f3819=_[_0xea9d('0x47')]({},_0x1f3819,_0xd74d1[_0xea9d('0x4b')]);return db[_0xea9d('0x4e')][_0xea9d('0x52')](_0x1f3819)['then'](handleEntityNotFound(_0x424014,null))[_0xea9d('0x32')](respondWithResult(_0x424014,null))[_0xea9d('0x25')](handleError(_0x424014,null));};exports[_0xea9d('0x31')]=function(_0x3cbb49,_0x4c7aa4){if(_0x3cbb49[_0xea9d('0x53')]['id']){delete _0x3cbb49[_0xea9d('0x53')]['id'];}return db[_0xea9d('0x4e')][_0xea9d('0x52')]({'where':{'id':_0x3cbb49[_0xea9d('0x51')]['id']}})[_0xea9d('0x32')](handleEntityNotFound(_0x4c7aa4,null))[_0xea9d('0x32')](saveUpdates(_0x3cbb49['body'],null))['then'](respondWithResult(_0x4c7aa4,null))[_0xea9d('0x25')](handleError(_0x4c7aa4,null));};exports[_0xea9d('0x54')]=function(_0x16b15a,_0x2d2292,_0x10edcc){if(_0x16b15a[_0xea9d('0x55')]&&_0x16b15a[_0xea9d('0x55')][_0xea9d('0x56')]){_0x16b15a['body'][_0xea9d('0x57')]=_0x16b15a['file'][_0xea9d('0x56')];}return db['Setting'][_0xea9d('0x52')]({'where':{'id':_0x16b15a[_0xea9d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d2292,null))[_0xea9d('0x32')](saveUpdates(_0x16b15a[_0xea9d('0x53')],null))['then'](respondWithResult(_0x2d2292,null))['catch'](handleError(_0x2d2292,null));};exports['addLogoLogin']=function(_0x279ca9,_0x1851be,_0x298e67){if(_0x279ca9[_0xea9d('0x55')]&&_0x279ca9[_0xea9d('0x55')][_0xea9d('0x56')]){_0x279ca9['body']['loginLogo']=_0x279ca9[_0xea9d('0x55')][_0xea9d('0x56')];}return db[_0xea9d('0x4e')][_0xea9d('0x52')]({'where':{'id':_0x279ca9[_0xea9d('0x51')]['id']}})[_0xea9d('0x32')](handleEntityNotFound(_0x1851be,null))[_0xea9d('0x32')](saveUpdates(_0x279ca9[_0xea9d('0x53')],null))[_0xea9d('0x32')](respondWithResult(_0x1851be,null))[_0xea9d('0x25')](handleError(_0x1851be,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x1460a5,_0x46d316,_0x334bd8){var _0x2d4b6a=_0xea9d('0x58');var _0x430a61={'custom':![]};return utilLicense[_0xea9d('0x59')]()[_0xea9d('0x32')](function(_0x37bf59){if(_0x37bf59){_0x430a61=_0x37bf59;}return db['Setting'][_0xea9d('0x52')]({'where':{'id':_0x1460a5[_0xea9d('0x51')]['id']},'attributes':[_0xea9d('0x57'),_0xea9d('0x5a'),_0xea9d('0x5b'),'favicon',_0xea9d('0x5c'),_0xea9d('0x5d'),_0xea9d('0x5e'),_0xea9d('0x5f')],'raw':!![]});})[_0xea9d('0x32')](handleEntityNotFound(_0x46d316,null))[_0xea9d('0x32')](function(_0x45474f){if(_0x45474f){var _0x432dc2=_0x45474f[_0xea9d('0x57')]&&fs[_0xea9d('0x60')](path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x2d4b6a,_['toLower'](_0x45474f[_0xea9d('0x57')])))?path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x2d4b6a,_[_0xea9d('0x63')](_0x45474f[_0xea9d('0x57')])):path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x2d4b6a,_['toLower'](_0xea9d('0x64')));var _0x4e6518='default'+_[_0xea9d('0x65')](_0xea9d('0x57'));if(_0x45474f[_0x4e6518]||!_0x430a61[_0xea9d('0x66')]){_0x432dc2=path['join'](config['root'],_0x2d4b6a,_[_0xea9d('0x63')]('default_logo.svg'));}if(!fs['existsSync'](_0x432dc2)){throw new db[(_0xea9d('0x67'))]['ValidationError'](_[_0xea9d('0x65')](_0xea9d('0x57'))+_0xea9d('0x68'));}return _0x46d316[_0xea9d('0x69')](_0x432dc2);}})['catch'](handleError(_0x46d316,null));};var utilLicense=require(_0xea9d('0x16'));exports[_0xea9d('0x6a')]=function(_0x25b6f3,_0x4e466b,_0x1bda7d){var _0x5d7e82=_0xea9d('0x58');var _0x33fb8c={'custom':![]};return utilLicense[_0xea9d('0x59')]()['then'](function(_0xe5099c){if(_0xe5099c){_0x33fb8c=_0xe5099c;}return db[_0xea9d('0x4e')]['find']({'where':{'id':_0x25b6f3['params']['id']},'attributes':[_0xea9d('0x57'),'loginLogo','preferred','favicon',_0xea9d('0x5c'),_0xea9d('0x5d'),'defaultPreferred',_0xea9d('0x5f')],'raw':!![]});})[_0xea9d('0x32')](handleEntityNotFound(_0x4e466b,null))[_0xea9d('0x32')](function(_0x16e9d3){if(_0x16e9d3){var _0x585d47=_0x16e9d3['loginLogo']&&fs[_0xea9d('0x60')](path[_0xea9d('0x61')](config['root'],_0x5d7e82,_['toLower'](_0x16e9d3['loginLogo'])))?path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x5d7e82,_[_0xea9d('0x63')](_0x16e9d3[_0xea9d('0x5a')])):path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x5d7e82,_[_0xea9d('0x63')](_0xea9d('0x6b')));var _0x2a33dc=_0xea9d('0x6c')+_[_0xea9d('0x65')](_0xea9d('0x5a'));if(_0x16e9d3[_0x2a33dc]||!_0x33fb8c[_0xea9d('0x66')]){_0x585d47=path['join'](config['root'],_0x5d7e82,_[_0xea9d('0x63')](_0xea9d('0x6b')));}if(!fs[_0xea9d('0x60')](_0x585d47)){throw new db[(_0xea9d('0x67'))][(_0xea9d('0x6d'))](_[_0xea9d('0x65')](_0xea9d('0x5a'))+_0xea9d('0x68'));}return _0x4e466b['download'](_0x585d47);}})[_0xea9d('0x25')](handleError(_0x4e466b,null));};exports['gdpr']=function(_0x1c928d,_0x1cf9ed){return db[_0xea9d('0x4e')]['find']({'where':{'id':_0x1c928d[_0xea9d('0x51')]['id']},'attributes':[_0xea9d('0x6e')]})[_0xea9d('0x32')](respondWithResult(_0x1cf9ed,null))[_0xea9d('0x25')](handleError(_0x1cf9ed,null));};exports['addPreferred']=function(_0x3aa67b,_0x4c1502,_0x58cca4){if(_0x3aa67b['file']&&_0x3aa67b[_0xea9d('0x55')]['filename']){_0x3aa67b[_0xea9d('0x53')][_0xea9d('0x5b')]=_0x3aa67b['file'][_0xea9d('0x56')];}return db['Setting'][_0xea9d('0x52')]({'where':{'id':_0x3aa67b[_0xea9d('0x51')]['id']}})[_0xea9d('0x32')](handleEntityNotFound(_0x4c1502,null))[_0xea9d('0x32')](saveUpdates(_0x3aa67b[_0xea9d('0x53')],null))[_0xea9d('0x32')](respondWithResult(_0x4c1502,null))['catch'](handleError(_0x4c1502,null));};var utilLicense=require('../../config/license/util');exports[_0xea9d('0x6f')]=function(_0x401969,_0x321924,_0x339925){var _0x2d5ff9=_0xea9d('0x58');var _0x2cb79a={'custom':![]};return utilLicense[_0xea9d('0x59')]()[_0xea9d('0x32')](function(_0x4ad0d8){if(_0x4ad0d8){_0x2cb79a=_0x4ad0d8;}return db[_0xea9d('0x4e')][_0xea9d('0x52')]({'where':{'id':_0x401969['params']['id']},'attributes':[_0xea9d('0x57'),_0xea9d('0x5a'),_0xea9d('0x5b'),'favicon',_0xea9d('0x5c'),_0xea9d('0x5d'),_0xea9d('0x5e'),_0xea9d('0x5f')],'raw':!![]});})[_0xea9d('0x32')](handleEntityNotFound(_0x321924,null))['then'](function(_0x1ba9b9){if(_0x1ba9b9){var _0x44dfaa=_0x1ba9b9['preferred']&&fs['existsSync'](path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x2d5ff9,_[_0xea9d('0x63')](_0x1ba9b9['preferred'])))?path['join'](config['root'],_0x2d5ff9,_['toLower'](_0x1ba9b9[_0xea9d('0x5b')])):path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x2d5ff9,_[_0xea9d('0x63')]('default_preferred.png'));var _0x5ec9cb=_0xea9d('0x6c')+_[_0xea9d('0x65')](_0xea9d('0x5b'));if(_0x1ba9b9[_0x5ec9cb]||!_0x2cb79a[_0xea9d('0x66')]||!_0x2cb79a['preferred']){_0x44dfaa=path['join'](config[_0xea9d('0x62')],_0x2d5ff9,_['toLower'](_0xea9d('0x70')));}if(!fs[_0xea9d('0x60')](_0x44dfaa)){throw new db[(_0xea9d('0x67'))][(_0xea9d('0x6d'))](_[_0xea9d('0x65')]('preferred')+'\x20not\x20found');}return _0x321924[_0xea9d('0x69')](_0x44dfaa);}})[_0xea9d('0x25')](handleError(_0x321924,null));};exports[_0xea9d('0x71')]=function(_0x3f2631,_0xf0243a,_0x19e457){if(_0x3f2631[_0xea9d('0x55')]&&_0x3f2631[_0xea9d('0x55')]['filename']){_0x3f2631[_0xea9d('0x53')][_0xea9d('0x72')]=_0x3f2631[_0xea9d('0x55')][_0xea9d('0x56')];}return db['Setting'][_0xea9d('0x52')]({'where':{'id':_0x3f2631[_0xea9d('0x51')]['id']}})[_0xea9d('0x32')](handleEntityNotFound(_0xf0243a,null))[_0xea9d('0x32')](saveUpdates(_0x3f2631['body'],null))[_0xea9d('0x32')](respondWithResult(_0xf0243a,null))[_0xea9d('0x25')](handleError(_0xf0243a,null));};var utilLicense=require('../../config/license/util');exports[_0xea9d('0x73')]=function(_0x293693,_0x16a77d,_0x1b9b63){var _0x424e2f=_0xea9d('0x58');var _0x27eea3={'custom':![]};return utilLicense[_0xea9d('0x59')]()[_0xea9d('0x32')](function(_0x3ff6b1){if(_0x3ff6b1){_0x27eea3=_0x3ff6b1;}return db[_0xea9d('0x4e')][_0xea9d('0x52')]({'where':{'id':_0x293693['params']['id']},'attributes':['logo',_0xea9d('0x5a'),_0xea9d('0x5b'),_0xea9d('0x72'),_0xea9d('0x5c'),_0xea9d('0x5d'),_0xea9d('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x16a77d,null))[_0xea9d('0x32')](function(_0x383910){if(_0x383910){var _0x516451=_0x383910[_0xea9d('0x72')]&&fs['existsSync'](path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x424e2f,_[_0xea9d('0x63')](_0x383910['favicon'])))?path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x424e2f,_['toLower'](_0x383910[_0xea9d('0x72')])):path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x424e2f,_['toLower'](_0xea9d('0x74')));var _0x397e94=_0xea9d('0x6c')+_[_0xea9d('0x65')](_0xea9d('0x72'));if(_0x383910[_0x397e94]||!_0x27eea3['custom']){_0x516451=path[_0xea9d('0x61')](config[_0xea9d('0x62')],_0x424e2f,_[_0xea9d('0x63')]('default_favicon.ico'));}if(!fs[_0xea9d('0x60')](_0x516451)){throw new db[(_0xea9d('0x67'))]['ValidationError'](_['upperFirst'](_0xea9d('0x72'))+_0xea9d('0x68'));}return _0x16a77d['download'](_0x516451);}})[_0xea9d('0x25')](handleError(_0x16a77d,null));};exports[_0xea9d('0x75')]=function(_0x15d969,_0x481922){var _0x1d55c1={'offset':moment()[_0xea9d('0x76')]()};_0x1d55c1[_0xea9d('0x77')]=moment()['utcOffset'](_0x1d55c1['offset'])[_0xea9d('0x78')](_0xea9d('0x79'));return _0x481922[_0xea9d('0x27')](0xc8)[_0xea9d('0x7a')](_0x1d55c1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 172b0f2..a99ca01 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x55ca,0x126));var _0xa55c=function(_0x1aa883,_0x50f53b){_0x1aa883=_0x1aa883-0x0;var _0x5e9fb5=_0x55ca[_0x1aa883];return _0x5e9fb5;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x555c17,_0x2e6c2a){var _0x15a073=function(_0x411a4f){while(--_0x411a4f){_0x555c17['push'](_0x555c17['shift']());}};_0x15a073(++_0x2e6c2a);}(_0x008c,0x188));var _0xc008=function(_0x47dcf6,_0x2bd422){_0x47dcf6=_0x47dcf6-0x0;var _0x2dfdc5=_0x008c[_0x47dcf6];return _0x2dfdc5;};'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')]('Setting',attributes,{'tableName':_0xc008('0xc'),'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 880d2f9..ae2323b 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 _0x000b=['result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','info'];(function(_0x1e32ec,_0x253bdf){var _0x1b8295=function(_0x2542e3){while(--_0x2542e3){_0x1e32ec['push'](_0x1e32ec['shift']());}};_0x1b8295(++_0x253bdf);}(_0x000b,0x1ec));var _0xb000=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x000b[_0x546aaf];return _0x1cbf6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb000('0x0'));var BPromise=require(_0xb000('0x1'));var rs=require(_0xb000('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb000('0x3'))['db'];var utils=require(_0xb000('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb000('0x5'));var jayson=require(_0xb000('0x6'));var client=jayson['client'][_0xb000('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x164e3f,_0x274cdf,_0x31163c){return new BPromise(function(_0x1fc96d,_0x56e411){return client[_0xb000('0x8')](_0x164e3f,_0x31163c)[_0xb000('0x9')](function(_0x2cc236){logger['info']('Setting,\x20%s,\x20%s',_0x274cdf,_0xb000('0xa'));logger[_0xb000('0xb')](_0xb000('0xc'),_0x274cdf,_0xb000('0xa'),JSON[_0xb000('0xd')](_0x2cc236));if(_0x2cc236[_0xb000('0xe')]){if(_0x2cc236[_0xb000('0xe')]['code']===0x1f4){logger[_0xb000('0xe')](_0xb000('0xf'),_0x274cdf,_0x2cc236[_0xb000('0xe')]['message']);return _0x56e411(_0x2cc236['error'][_0xb000('0x10')]);}logger[_0xb000('0xe')](_0xb000('0xf'),_0x274cdf,_0x2cc236['error'][_0xb000('0x10')]);return _0x1fc96d(_0x2cc236[_0xb000('0xe')][_0xb000('0x10')]);}else{logger[_0xb000('0x11')](_0xb000('0xf'),_0x274cdf,'request\x20sent');_0x1fc96d(_0x2cc236[_0xb000('0x12')]['message']);}})[_0xb000('0x13')](function(_0x200ca4){logger[_0xb000('0xe')](_0xb000('0xf'),_0x274cdf,_0x200ca4);_0x56e411(_0x200ca4);});});}exports[_0xb000('0x14')]=function(_0xf58e8a){var _0x1ac451=this;return new Promise(function(_0x3e1b0a,_0x1d928a){return db[_0xb000('0x15')][_0xb000('0x16')]({'raw':_0xf58e8a[_0xb000('0x17')]?_0xf58e8a[_0xb000('0x17')][_0xb000('0x18')]===undefined?!![]:![]:!![],'where':_0xf58e8a[_0xb000('0x17')]?_0xf58e8a[_0xb000('0x17')][_0xb000('0x19')]||null:null,'attributes':_0xf58e8a['options']?_0xf58e8a[_0xb000('0x17')][_0xb000('0x1a')]||null:null,'include':_0xf58e8a[_0xb000('0x17')]?_0xf58e8a[_0xb000('0x17')][_0xb000('0x1b')]?_[_0xb000('0x1c')](_0xf58e8a[_0xb000('0x17')]['include'],function(_0x9a9408){return{'model':db[_0x9a9408[_0xb000('0x1d')]],'as':_0x9a9408['as'],'attributes':_0x9a9408['attributes'],'include':_0x9a9408['include']?_[_0xb000('0x1c')](_0x9a9408['include'],function(_0x57f5ab){return{'model':db[_0x57f5ab[_0xb000('0x1d')]],'as':_0x57f5ab['as'],'attributes':_0x57f5ab[_0xb000('0x1a')],'include':_0x57f5ab[_0xb000('0x1b')]?_['map'](_0x57f5ab['include'],function(_0xe2292e){return{'model':db[_0xe2292e['model']],'as':_0xe2292e['as'],'attributes':_0xe2292e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb000('0x9')](function(_0x23f5b9){logger[_0xb000('0x11')]('ShowSetting',_0xf58e8a);logger[_0xb000('0xb')](_0xb000('0x14'),_0xf58e8a,JSON[_0xb000('0xd')](_0x23f5b9));_0x3e1b0a(_0x23f5b9);})[_0xb000('0x13')](function(_0x7147e4){logger[_0xb000('0xe')](_0xb000('0x14'),_0x7147e4['message'],_0xf58e8a);_0x1d928a(_0x1ac451[_0xb000('0xe')](0x1f4,_0x7147e4[_0xb000('0x10')]));});});}; \ No newline at end of file +var _0x958e=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','Setting','options','raw','where','attributes','include','model','map','ShowSetting','lodash','util'];(function(_0x4bd408,_0xe3d4a){var _0x4ee9d4=function(_0x2e2cd4){while(--_0x2e2cd4){_0x4bd408['push'](_0x4bd408['shift']());}};_0x4ee9d4(++_0xe3d4a);}(_0x958e,0xd0));var _0xe958=function(_0x1a391e,_0x250328){_0x1a391e=_0x1a391e-0x0;var _0x1e8dd2=_0x958e[_0x1a391e];return _0x1e8dd2;};'use strict';var _=require(_0xe958('0x0'));var util=require(_0xe958('0x1'));var moment=require(_0xe958('0x2'));var BPromise=require(_0xe958('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe958('0x4'));var logger=require(_0xe958('0x5'))(_0xe958('0x6'));var config=require(_0xe958('0x7'));var jayson=require(_0xe958('0x8'));var client=jayson[_0xe958('0x9')][_0xe958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x475fe2,_0x39a3e4,_0x7a83c2){return new BPromise(function(_0x51ec70,_0x2bd233){return client[_0xe958('0xb')](_0x475fe2,_0x7a83c2)[_0xe958('0xc')](function(_0xb7f51d){logger[_0xe958('0xd')](_0xe958('0xe'),_0x39a3e4,_0xe958('0xf'));logger['debug'](_0xe958('0x10'),_0x39a3e4,_0xe958('0xf'),JSON['stringify'](_0xb7f51d));if(_0xb7f51d['error']){if(_0xb7f51d[_0xe958('0x11')]['code']===0x1f4){logger[_0xe958('0x11')](_0xe958('0xe'),_0x39a3e4,_0xb7f51d[_0xe958('0x11')]['message']);return _0x2bd233(_0xb7f51d[_0xe958('0x11')][_0xe958('0x12')]);}logger[_0xe958('0x11')](_0xe958('0xe'),_0x39a3e4,_0xb7f51d[_0xe958('0x11')]['message']);return _0x51ec70(_0xb7f51d[_0xe958('0x11')]['message']);}else{logger['info'](_0xe958('0xe'),_0x39a3e4,'request\x20sent');_0x51ec70(_0xb7f51d[_0xe958('0x13')]['message']);}})[_0xe958('0x14')](function(_0x488595){logger[_0xe958('0x11')](_0xe958('0xe'),_0x39a3e4,_0x488595);_0x2bd233(_0x488595);});});}exports['ShowSetting']=function(_0x331de8){var _0x478576=this;return new Promise(function(_0x5defdb,_0x43006b){return db[_0xe958('0x15')]['find']({'raw':_0x331de8['options']?_0x331de8[_0xe958('0x16')][_0xe958('0x17')]===undefined?!![]:![]:!![],'where':_0x331de8[_0xe958('0x16')]?_0x331de8[_0xe958('0x16')][_0xe958('0x18')]||null:null,'attributes':_0x331de8[_0xe958('0x16')]?_0x331de8[_0xe958('0x16')][_0xe958('0x19')]||null:null,'include':_0x331de8['options']?_0x331de8[_0xe958('0x16')][_0xe958('0x1a')]?_['map'](_0x331de8[_0xe958('0x16')][_0xe958('0x1a')],function(_0x4865d0){return{'model':db[_0x4865d0[_0xe958('0x1b')]],'as':_0x4865d0['as'],'attributes':_0x4865d0['attributes'],'include':_0x4865d0[_0xe958('0x1a')]?_[_0xe958('0x1c')](_0x4865d0['include'],function(_0x19874a){return{'model':db[_0x19874a[_0xe958('0x1b')]],'as':_0x19874a['as'],'attributes':_0x19874a['attributes'],'include':_0x19874a[_0xe958('0x1a')]?_[_0xe958('0x1c')](_0x19874a[_0xe958('0x1a')],function(_0x4f3de8){return{'model':db[_0x4f3de8[_0xe958('0x1b')]],'as':_0x4f3de8['as'],'attributes':_0x4f3de8[_0xe958('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d7353){logger[_0xe958('0xd')]('ShowSetting',_0x331de8);logger['debug'](_0xe958('0x1d'),_0x331de8,JSON['stringify'](_0x2d7353));_0x5defdb(_0x2d7353);})[_0xe958('0x14')](function(_0x3cbf73){logger[_0xe958('0x11')](_0xe958('0x1d'),_0x3cbf73[_0xe958('0x12')],_0x331de8);_0x43006b(_0x478576[_0xe958('0x11')](0x1f4,_0x3cbf73[_0xe958('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 487c227..5f2cb42 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x3707a4,_0x1e3f8c){_0x3707a4=_0x3707a4-0x0;var _0xe675e5=_0xf494[_0x3707a4];return _0xe675e5;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x2fbd55,_0x56bfdb){var _0x46147b=function(_0x439a7e){while(--_0x439a7e){_0x2fbd55['push'](_0x2fbd55['shift']());}};_0x46147b(++_0x56bfdb);}(_0x53ec,0x192));var _0xc53e=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0x53ec[_0x80f51a];return _0x327148;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index ed303bf..9697381 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 _0x47ee=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x47ee,0xeb));var _0xe47e=function(_0x4aaeac,_0x25bd02){_0x4aaeac=_0x4aaeac-0x0;var _0x4ea4dc=_0x47ee[_0x4aaeac];return _0x4ea4dc;};'use strict';var Sequelize=require(_0xe47e('0x0'));var rs=require(_0xe47e('0x1'));module['exports']={'name':{'type':Sequelize[_0xe47e('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':function(){return rs[_0xe47e('0x3')]();}},'phone':{'type':Sequelize[_0xe47e('0x2')]},'type':{'type':Sequelize[_0xe47e('0x4')](_0xe47e('0x5'),_0xe47e('0x6'),'connectel',_0xe47e('0x7'),_0xe47e('0x8'),_0xe47e('0x9'),_0xe47e('0xa'),_0xe47e('0xb'),_0xe47e('0xc'),_0xe47e('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xe47e('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xe47e('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xe47e('0x2')]},'applicationId':{'type':Sequelize[_0xe47e('0x2')]},'accountId':{'type':Sequelize[_0xe47e('0x2')]},'senderString':{'type':Sequelize[_0xe47e('0x2')]},'deliveryReport':{'type':Sequelize[_0xe47e('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xe47e('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe47e('0xf')],'defaultValue':function(){return _0xe47e('0x10');}},'notificationSound':{'type':Sequelize[_0xe47e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe47e('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe47e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe47e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe47e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe47e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe47e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe47e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe47e('0x11')],'comment':_0xe47e('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xe47e('0xe')],'defaultValue':![],'comment':_0xe47e('0x13'),'set':function(_0x326b4c){if(!_0x326b4c)this[_0xe47e('0x14')](_0xe47e('0x15'),null);this['setDataValue'](_0xe47e('0x16'),_0x326b4c);}}}; \ No newline at end of file +var _0x5de6=['clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby'];(function(_0x481d05,_0x4da922){var _0x82f03a=function(_0x54343b){while(--_0x54343b){_0x481d05['push'](_0x481d05['shift']());}};_0x82f03a(++_0x4da922);}(_0x5de6,0xf5));var _0x65de=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5de6[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x65de('0x0'));module[_0x65de('0x1')]={'name':{'type':Sequelize[_0x65de('0x2')],'unique':_0x65de('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x65de('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x65de('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x65de('0x2')],'defaultValue':function(){return rs[_0x65de('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x65de('0x5')](_0x65de('0x6'),_0x65de('0x7'),'connectel',_0x65de('0x8'),_0x65de('0x9'),_0x65de('0xa'),_0x65de('0xb'),_0x65de('0xc'),_0x65de('0xd'),_0x65de('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x65de('0x2')]},'authToken':{'type':Sequelize[_0x65de('0x2')]},'smsMethod':{'type':Sequelize[_0x65de('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x65de('0x2')]},'deliveryReport':{'type':Sequelize[_0x65de('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x65de('0x2')]},'notificationTemplate':{'type':Sequelize[_0x65de('0x10')],'defaultValue':function(){return _0x65de('0x11');}},'notificationSound':{'type':Sequelize[_0x65de('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x65de('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x65de('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x65de('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x65de('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x65de('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x65de('0xf')],'defaultValue':![],'comment':_0x65de('0x13'),'set':function(_0x325237){if(!_0x325237)this['setDataValue'](_0x65de('0x14'),null);this[_0x65de('0x15')](_0x65de('0x16'),_0x325237);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2a03750..aaf9eef 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 _0x71e4=['destroy','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','Pause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','SmsAccountId','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','Body','MessageSid','skebby','sender','connectel','messageId','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','applications','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','DESC','List','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','received\x20delivery\x20report\x20from','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update'];(function(_0x5a9a5f,_0x451aa9){var _0x50430e=function(_0x4e32d3){while(--_0x4e32d3){_0x5a9a5f['push'](_0x5a9a5f['shift']());}};_0x50430e(++_0x451aa9);}(_0x71e4,0x1a1));var _0x471e=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x71e4[_0x466af7];return _0x348c96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x471e('0x0'));var zipdir=require(_0x471e('0x1'));var jsonpatch=require(_0x471e('0x2'));var rp=require(_0x471e('0x3'));var moment=require(_0x471e('0x4'));var BPromise=require(_0x471e('0x5'));var Mustache=require(_0x471e('0x6'));var util=require(_0x471e('0x7'));var path=require(_0x471e('0x8'));var sox=require(_0x471e('0x9'));var csv=require(_0x471e('0xa'));var ejs=require(_0x471e('0xb'));var fs=require('fs');var fs_extra=require(_0x471e('0xc'));var _=require('lodash');var squel=require(_0x471e('0xd'));var crypto=require(_0x471e('0xe'));var jsforce=require(_0x471e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x471e('0xa'));var querystring=require(_0x471e('0x10'));var Papa=require(_0x471e('0x11'));var Redis=require(_0x471e('0x12'));var authService=require(_0x471e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x471e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x471e('0x15'));var utils=require(_0x471e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x471e('0x17'));var db=require('../../mysqldb')['db'];config[_0x471e('0x18')]=_['defaults'](config[_0x471e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x471e('0x19'))(new Redis(config[_0x471e('0x18')]));require(_0x471e('0x1a'))[_0x471e('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x471e('0x1c')][_0x471e('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5036b0,_0x3239d0,_0x4743ab,_0xc90e5a){return new BPromise(function(_0x4fb2f0,_0x1f7724){var _0x105bae=_0xc90e5a||client;return _0x105bae[_0x471e('0x1e')](_0x5036b0,_0x4743ab)[_0x471e('0x1f')](function(_0xd3f9f6){logger['info'](_0x471e('0x20'),_0x3239d0,_0x471e('0x21'));logger[_0x471e('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3239d0,_0x471e('0x21'),JSON[_0x471e('0x23')](_0xd3f9f6));if(_0xd3f9f6[_0x471e('0x24')]){if(_0xd3f9f6[_0x471e('0x24')][_0x471e('0x25')]===0x1f4){logger[_0x471e('0x24')]('SmsAccount,\x20%s,\x20%s',_0x3239d0,_0xd3f9f6[_0x471e('0x24')][_0x471e('0x26')]);return _0x1f7724(_0xd3f9f6[_0x471e('0x24')][_0x471e('0x26')]);}logger[_0x471e('0x24')](_0x471e('0x20'),_0x3239d0,_0xd3f9f6['error']['message']);return _0x4fb2f0(_0xd3f9f6[_0x471e('0x24')]['message']);}else{logger[_0x471e('0x27')](_0x471e('0x20'),_0x3239d0,_0x471e('0x21'));_0x4fb2f0(_0xd3f9f6[_0x471e('0x28')][_0x471e('0x26')]);}})[_0x471e('0x29')](function(_0x2e14bd){logger[_0x471e('0x24')](_0x471e('0x20'),_0x3239d0,_0x2e14bd);_0x1f7724(_0x2e14bd);});});}function respondWithStatusCode(_0xa585f9,_0x4a79ed){_0x4a79ed=_0x4a79ed||0xcc;return function(_0x3543d8){if(_0x3543d8){return _0xa585f9[_0x471e('0x2a')](_0x4a79ed);}return _0xa585f9['status'](_0x4a79ed)[_0x471e('0x2b')]();};}function respondWithResult(_0x284ecd,_0x31ae08){_0x31ae08=_0x31ae08||0xc8;return function(_0x11916f){if(_0x11916f){return _0x284ecd[_0x471e('0x2c')](_0x31ae08)[_0x471e('0x2d')](_0x11916f);}};}function respondWithFilteredResult(_0x534b1d,_0x25101b){return function(_0x48c5b0){if(_0x48c5b0){var _0x173b0f=typeof _0x25101b['offset']===_0x471e('0x2e')&&typeof _0x25101b[_0x471e('0x2f')]==='undefined';var _0x179c31=_0x48c5b0['count'];var _0x374874=_0x173b0f?0x0:_0x25101b[_0x471e('0x30')];var _0xcbeac=_0x173b0f?_0x48c5b0['count']:_0x25101b['offset']+_0x25101b['limit'];var _0x3fa453;if(_0xcbeac>=_0x179c31){_0xcbeac=_0x179c31;_0x3fa453=0xc8;}else{_0x3fa453=0xce;}_0x534b1d[_0x471e('0x2c')](_0x3fa453);return _0x534b1d[_0x471e('0x31')](_0x471e('0x32'),_0x374874+'-'+_0xcbeac+'/'+_0x179c31)[_0x471e('0x2d')](_0x48c5b0);}return null;};}function patchUpdates(_0x357dff){return function(_0x1661d9){try{jsonpatch[_0x471e('0x33')](_0x1661d9,_0x357dff,!![]);}catch(_0x5bcaa6){return BPromise[_0x471e('0x34')](_0x5bcaa6);}return _0x1661d9[_0x471e('0x35')]();};}function saveUpdates(_0x2d40da,_0x545ff8){return function(_0x43e48b){if(_0x43e48b){return _0x43e48b[_0x471e('0x36')](_0x2d40da)[_0x471e('0x1f')](function(_0xb8c984){return _0xb8c984;});}return null;};}function removeEntity(_0x672965,_0x258ff9){return function(_0x6d7d1d){if(_0x6d7d1d){return _0x6d7d1d[_0x471e('0x37')]()[_0x471e('0x1f')](function(){var _0x5cf59b=_0x6d7d1d['get']({'plain':!![]});var _0x44bff8=_0x471e('0x38');return db[_0x471e('0x39')]['destroy']({'where':{'type':_0x44bff8,'resourceId':_0x5cf59b['id']}})[_0x471e('0x1f')](function(){return _0x6d7d1d;});})[_0x471e('0x1f')](function(){_0x672965['status'](0xcc)[_0x471e('0x2b')]();});}};}function handleEntityNotFound(_0x427147,_0x126c92){return function(_0x2bd3a0){if(!_0x2bd3a0){_0x427147['sendStatus'](0x194);}return _0x2bd3a0;};}function handleError(_0x1f6ef8,_0x7c3325){_0x7c3325=_0x7c3325||0x1f4;return function(_0x31017e){logger[_0x471e('0x24')](_0x31017e[_0x471e('0x3a')]);if(_0x31017e[_0x471e('0x3b')]){delete _0x31017e[_0x471e('0x3b')];}_0x1f6ef8['status'](_0x7c3325)[_0x471e('0x3c')](_0x31017e);};}exports[_0x471e('0x3d')]=function(_0x2ff7a8,_0x51687e){var _0x30b71c={'include':[{'model':db['Pause'],'as':_0x471e('0x3e')}]},_0x32a62a={},_0x4799a1={'count':0x0,'rows':[]};var _0x5549ed=_['map'](db[_0x471e('0x3f')][_0x471e('0x40')],function(_0x3af7ac){return{'name':_0x3af7ac['fieldName'],'type':_0x3af7ac['type'][_0x471e('0x41')]};});_0x32a62a[_0x471e('0x42')]=_[_0x471e('0x43')](_0x5549ed,_0x471e('0x3b'));_0x32a62a[_0x471e('0x44')]=_[_0x471e('0x45')](_0x2ff7a8[_0x471e('0x44')]);_0x32a62a[_0x471e('0x46')]=_[_0x471e('0x47')](_0x32a62a[_0x471e('0x42')],_0x32a62a[_0x471e('0x44')]);_0x30b71c[_0x471e('0x48')]=_['intersection'](_0x32a62a[_0x471e('0x42')],qs[_0x471e('0x49')](_0x2ff7a8[_0x471e('0x44')][_0x471e('0x49')]));_0x30b71c[_0x471e('0x48')]=_0x30b71c[_0x471e('0x48')][_0x471e('0x4a')]?_0x30b71c[_0x471e('0x48')]:_0x32a62a[_0x471e('0x42')];if(!_0x2ff7a8['query']['hasOwnProperty'](_0x471e('0x4b'))){_0x30b71c[_0x471e('0x2f')]=qs['limit'](_0x2ff7a8[_0x471e('0x44')][_0x471e('0x2f')]);_0x30b71c[_0x471e('0x30')]=qs[_0x471e('0x30')](_0x2ff7a8[_0x471e('0x44')][_0x471e('0x30')]);}_0x30b71c[_0x471e('0x4c')]=qs['sort'](_0x2ff7a8[_0x471e('0x44')][_0x471e('0x4d')]);_0x30b71c['where']=qs['filters'](_[_0x471e('0x4e')](_0x2ff7a8['query'],_0x32a62a[_0x471e('0x46')]),_0x5549ed);if(_0x2ff7a8[_0x471e('0x44')][_0x471e('0x4f')]){_0x30b71c[_0x471e('0x50')]=_['merge'](_0x30b71c[_0x471e('0x50')],{'$or':_[_0x471e('0x43')](_0x5549ed,function(_0x5b8338){if(_0x5b8338[_0x471e('0x51')]!==_0x471e('0x52')){var _0x136107={};_0x136107[_0x5b8338[_0x471e('0x3b')]]={'$like':'%'+_0x2ff7a8[_0x471e('0x44')]['filter']+'%'};return _0x136107;}})});}_0x30b71c=_[_0x471e('0x53')]({},_0x30b71c,_0x2ff7a8[_0x471e('0x54')]);var _0x6e2dc6={'where':_0x30b71c[_0x471e('0x50')]};return db[_0x471e('0x3f')][_0x471e('0x55')](_0x6e2dc6)['then'](function(_0x3b2b38){_0x4799a1['count']=_0x3b2b38;if(_0x2ff7a8[_0x471e('0x44')][_0x471e('0x56')]){_0x30b71c[_0x471e('0x57')]=[{'all':!![]}];}return db[_0x471e('0x3f')][_0x471e('0x58')](_0x30b71c);})[_0x471e('0x1f')](function(_0x310880){_0x4799a1[_0x471e('0x59')]=_0x310880;return _0x4799a1;})[_0x471e('0x1f')](respondWithFilteredResult(_0x51687e,_0x30b71c))[_0x471e('0x29')](handleError(_0x51687e,null));};exports[_0x471e('0x5a')]=function(_0x321acf,_0x30c7d8){var _0x354ed5={'raw':![],'where':{'id':_0x321acf[_0x471e('0x5b')]['id']},'include':[{'model':db[_0x471e('0x5c')],'as':'mandatoryDispositionPause'}]},_0x1509fa={};_0x1509fa[_0x471e('0x42')]=_['keys'](db[_0x471e('0x3f')][_0x471e('0x40')]);_0x1509fa[_0x471e('0x44')]=_[_0x471e('0x45')](_0x321acf[_0x471e('0x44')]);_0x1509fa[_0x471e('0x46')]=_[_0x471e('0x47')](_0x1509fa[_0x471e('0x42')],_0x1509fa[_0x471e('0x44')]);_0x354ed5[_0x471e('0x48')]=_[_0x471e('0x47')](_0x1509fa[_0x471e('0x42')],qs[_0x471e('0x49')](_0x321acf[_0x471e('0x44')][_0x471e('0x49')]));_0x354ed5[_0x471e('0x48')]=_0x354ed5[_0x471e('0x48')][_0x471e('0x4a')]?_0x354ed5['attributes']:_0x1509fa[_0x471e('0x42')];if(_0x321acf[_0x471e('0x44')][_0x471e('0x56')]){_0x354ed5[_0x471e('0x57')]=[{'all':!![]}];}_0x354ed5=_[_0x471e('0x53')]({},_0x354ed5,_0x321acf[_0x471e('0x54')]);return db[_0x471e('0x3f')]['find'](_0x354ed5)[_0x471e('0x1f')](handleEntityNotFound(_0x30c7d8,null))['then'](respondWithResult(_0x30c7d8,null))[_0x471e('0x29')](handleError(_0x30c7d8,null));};exports[_0x471e('0x5d')]=function(_0x3ac544,_0x34c05e){return db[_0x471e('0x3f')]['create'](_0x3ac544[_0x471e('0x5e')],{})[_0x471e('0x1f')](function(_0x11deca){var _0x4807e6=_0x3ac544['user']['get']({'plain':!![]});if(!_0x4807e6)throw new Error(_0x471e('0x5f'));if(_0x4807e6[_0x471e('0x60')]===_0x471e('0x61')){var _0x3ff0a6=_0x11deca[_0x471e('0x62')]({'plain':!![]});var _0x5bef55='SmsAccounts';return db[_0x471e('0x63')][_0x471e('0x64')]({'where':{'name':_0x5bef55,'userProfileId':_0x4807e6[_0x471e('0x65')]},'raw':!![]})[_0x471e('0x1f')](function(_0x4d2506){if(_0x4d2506&&_0x4d2506['autoAssociation']===0x0){return db[_0x471e('0x39')][_0x471e('0x5d')]({'name':_0x3ff0a6[_0x471e('0x3b')],'resourceId':_0x3ff0a6['id'],'type':_0x4d2506[_0x471e('0x3b')],'sectionId':_0x4d2506['id']},{})[_0x471e('0x1f')](function(){return _0x11deca;});}else{return _0x11deca;}})[_0x471e('0x29')](function(_0x4cdc3b){logger['error'](_0x471e('0x66'),_0x4cdc3b);throw _0x4cdc3b;});}return _0x11deca;})[_0x471e('0x1f')](respondWithResult(_0x34c05e,0xc9))[_0x471e('0x29')](handleError(_0x34c05e,null));};exports[_0x471e('0x36')]=function(_0x3afe39,_0x4fbcb4){if(_0x3afe39['body']['id']){delete _0x3afe39[_0x471e('0x5e')]['id'];}return db['SmsAccount'][_0x471e('0x64')]({'where':{'id':_0x3afe39[_0x471e('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x471e('0x3e')}]})[_0x471e('0x1f')](handleEntityNotFound(_0x4fbcb4,null))[_0x471e('0x1f')](saveUpdates(_0x3afe39['body'],null))[_0x471e('0x1f')](respondWithResult(_0x4fbcb4,null))[_0x471e('0x29')](handleError(_0x4fbcb4,null));};exports[_0x471e('0x37')]=function(_0x298ce8,_0x9e3d63){return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x298ce8['params']['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x9e3d63,null))[_0x471e('0x1f')](removeEntity(_0x9e3d63,null))[_0x471e('0x29')](handleError(_0x9e3d63,null));};exports[_0x471e('0x67')]=function(_0x5c292c,_0x2077bd){return db[_0x471e('0x3f')][_0x471e('0x67')]()[_0x471e('0x1f')](respondWithResult(_0x2077bd,null))[_0x471e('0x29')](handleError(_0x2077bd,null));};exports[_0x471e('0x68')]=function(_0x15da21,_0x42eac3,_0x1fe60f){if(_0x15da21['body']['id']){delete _0x15da21['body']['id'];}return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x15da21[_0x471e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x42eac3,null))[_0x471e('0x1f')](function(_0x4e3002){if(_0x4e3002){_0x15da21[_0x471e('0x5e')]['SmsAccountId']=_0x4e3002['id'];return db[_0x471e('0x69')]['create'](_0x15da21[_0x471e('0x5e')]);}})[_0x471e('0x1f')](respondWithResult(_0x42eac3,null))[_0x471e('0x29')](handleError(_0x42eac3,null));};exports[_0x471e('0x6a')]=function(_0x22ed68,_0x5d8614,_0x4ef5fc){var _0x4a9146={'raw':![],'where':{}};var _0x236312={};var _0x7fab7a={'count':0x0,'rows':[]};return db[_0x471e('0x3f')][_0x471e('0x6b')]({'where':{'id':_0x22ed68[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x5d8614,null))['then'](function(_0x2b1914){if(_0x2b1914){_0x236312[_0x471e('0x42')]=_[_0x471e('0x45')](db[_0x471e('0x69')][_0x471e('0x40')]);_0x236312[_0x471e('0x44')]=_['keys'](_0x22ed68['query']);_0x236312['filters']=_[_0x471e('0x47')](_0x236312[_0x471e('0x42')],_0x236312['query']);_0x4a9146['attributes']=_['intersection'](_0x236312['model'],qs[_0x471e('0x49')](_0x22ed68[_0x471e('0x44')][_0x471e('0x49')]));_0x4a9146['attributes']=_0x4a9146[_0x471e('0x48')][_0x471e('0x4a')]?_0x4a9146['attributes']:_0x236312[_0x471e('0x42')];if(!_0x22ed68['query']['hasOwnProperty'](_0x471e('0x4b'))){_0x4a9146[_0x471e('0x2f')]=qs['limit'](_0x22ed68[_0x471e('0x44')][_0x471e('0x2f')]);_0x4a9146[_0x471e('0x30')]=qs['offset'](_0x22ed68['query']['offset']);}_0x4a9146['order']=qs[_0x471e('0x4d')](_0x22ed68['query'][_0x471e('0x4d')]);_0x4a9146['where']=qs[_0x471e('0x46')](_[_0x471e('0x4e')](_0x22ed68[_0x471e('0x44')],_0x236312[_0x471e('0x46')]));_0x4a9146[_0x471e('0x50')]['SmsAccountId']=_0x2b1914['id'];if(_0x22ed68[_0x471e('0x44')][_0x471e('0x4f')]){_0x4a9146[_0x471e('0x50')]=_[_0x471e('0x53')](_0x4a9146[_0x471e('0x50')],{'$or':_[_0x471e('0x43')](_0x4a9146['attributes'],function(_0x3e796c){var _0x61fcfe={};_0x61fcfe[_0x3e796c]={'$like':'%'+_0x22ed68[_0x471e('0x44')][_0x471e('0x4f')]+'%'};return _0x61fcfe;})});}_0x4a9146=_['merge']({},_0x4a9146,_0x22ed68[_0x471e('0x54')]);return db['Disposition'][_0x471e('0x55')]({'where':_0x4a9146['where']})[_0x471e('0x1f')](function(_0x86c12a){_0x7fab7a[_0x471e('0x55')]=_0x86c12a;if(_0x22ed68[_0x471e('0x44')][_0x471e('0x56')]){_0x4a9146[_0x471e('0x57')]=[{'all':!![]}];}return db[_0x471e('0x69')][_0x471e('0x58')](_0x4a9146);})[_0x471e('0x1f')](function(_0xff841b){_0x7fab7a[_0x471e('0x59')]=_0xff841b;return _0x7fab7a;});}})['then'](respondWithFilteredResult(_0x5d8614,_0x4a9146))[_0x471e('0x29')](handleError(_0x5d8614,null));};exports['removeDispositions']=function(_0x21340e,_0x474db7,_0x1f6f09){return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x21340e[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x474db7,null))['then'](function(_0xa88409){if(_0xa88409){return _0xa88409[_0x471e('0x6c')](_0x21340e['query']['ids']);}})[_0x471e('0x1f')](respondWithStatusCode(_0x474db7,null))[_0x471e('0x29')](handleError(_0x474db7,null));};exports['addAnswer']=function(_0x12df47,_0x2e9c98,_0x55b67b){if(_0x12df47[_0x471e('0x5e')]['id']){delete _0x12df47[_0x471e('0x5e')]['id'];}return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x12df47[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x2e9c98,null))['then'](function(_0x61e4f7){if(_0x61e4f7){_0x12df47[_0x471e('0x5e')][_0x471e('0x6d')]=_0x61e4f7['id'];return db['CannedAnswer'][_0x471e('0x5d')](_0x12df47['body']);}})[_0x471e('0x1f')](respondWithResult(_0x2e9c98,null))[_0x471e('0x29')](handleError(_0x2e9c98,null));};exports[_0x471e('0x6e')]=function(_0x1db95d,_0x126ea1,_0x1fab3f){var _0x45a789={'raw':![],'where':{}};var _0x3595e2={};var _0x478fa8={'count':0x0,'rows':[]};return db[_0x471e('0x3f')][_0x471e('0x6b')]({'where':{'id':_0x1db95d['params']['id']}})['then'](handleEntityNotFound(_0x126ea1,null))['then'](function(_0x47d5c9){if(_0x47d5c9){_0x3595e2[_0x471e('0x42')]=_[_0x471e('0x45')](db[_0x471e('0x6f')][_0x471e('0x40')]);_0x3595e2['query']=_[_0x471e('0x45')](_0x1db95d['query']);_0x3595e2[_0x471e('0x46')]=_[_0x471e('0x47')](_0x3595e2[_0x471e('0x42')],_0x3595e2[_0x471e('0x44')]);_0x45a789[_0x471e('0x48')]=_['intersection'](_0x3595e2[_0x471e('0x42')],qs[_0x471e('0x49')](_0x1db95d[_0x471e('0x44')][_0x471e('0x49')]));_0x45a789['attributes']=_0x45a789[_0x471e('0x48')][_0x471e('0x4a')]?_0x45a789[_0x471e('0x48')]:_0x3595e2[_0x471e('0x42')];if(!_0x1db95d[_0x471e('0x44')][_0x471e('0x70')](_0x471e('0x4b'))){_0x45a789[_0x471e('0x2f')]=qs[_0x471e('0x2f')](_0x1db95d[_0x471e('0x44')][_0x471e('0x2f')]);_0x45a789['offset']=qs['offset'](_0x1db95d['query'][_0x471e('0x30')]);}_0x45a789[_0x471e('0x4c')]=qs[_0x471e('0x4d')](_0x1db95d['query'][_0x471e('0x4d')]);_0x45a789[_0x471e('0x50')]=qs['filters'](_[_0x471e('0x4e')](_0x1db95d[_0x471e('0x44')],_0x3595e2[_0x471e('0x46')]));_0x45a789[_0x471e('0x50')][_0x471e('0x6d')]=_0x47d5c9['id'];if(_0x1db95d[_0x471e('0x44')][_0x471e('0x4f')]){_0x45a789[_0x471e('0x50')]=_[_0x471e('0x53')](_0x45a789['where'],{'$or':_[_0x471e('0x43')](_0x45a789['attributes'],function(_0x14cab8){var _0x1aef2b={};_0x1aef2b[_0x14cab8]={'$like':'%'+_0x1db95d['query'][_0x471e('0x4f')]+'%'};return _0x1aef2b;})});}_0x45a789=_[_0x471e('0x53')]({},_0x45a789,_0x1db95d['options']);return db[_0x471e('0x6f')][_0x471e('0x55')]({'where':_0x45a789[_0x471e('0x50')]})[_0x471e('0x1f')](function(_0x4c5417){_0x478fa8[_0x471e('0x55')]=_0x4c5417;if(_0x1db95d[_0x471e('0x44')]['includeAll']){_0x45a789['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x471e('0x58')](_0x45a789);})['then'](function(_0x570fe5){_0x478fa8[_0x471e('0x59')]=_0x570fe5;return _0x478fa8;});}})[_0x471e('0x1f')](respondWithFilteredResult(_0x126ea1,_0x45a789))[_0x471e('0x29')](handleError(_0x126ea1,null));};exports['removeAnswers']=function(_0x499763,_0x48dea0,_0x25fa69){return db[_0x471e('0x3f')]['find']({'where':{'id':_0x499763[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x48dea0,null))[_0x471e('0x1f')](function(_0x217b03){if(_0x217b03){return _0x217b03[_0x471e('0x71')](_0x499763[_0x471e('0x44')]['ids']);}})[_0x471e('0x1f')](respondWithStatusCode(_0x48dea0,null))[_0x471e('0x29')](handleError(_0x48dea0,null));};exports[_0x471e('0x72')]=function(_0x282c76,_0x40e90f,_0x3526f0){var _0x1c94d9={'channel':_0x471e('0x73')};var _0x20310b=[];var _0x5dceb9=[];var _0x5afe1e={};return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x282c76[_0x471e('0x5b')]['id']},'include':[{'model':db[_0x471e('0x74')],'as':'Applications'}]})[_0x471e('0x1f')](handleEntityNotFound(_0x40e90f,null))[_0x471e('0x1f')](function(_0x3daefe){_0x1c94d9['account']=_0x3daefe;_0x1c94d9['applications']=_[_0x471e('0x75')](_0x3daefe[_0x471e('0x76')],[_0x471e('0x77')],[_0x471e('0x78')]);if(_0x1c94d9['account'][_0x471e('0x76')]){delete _0x1c94d9[_0x471e('0x79')]['Applications'];}return db[_0x471e('0x7a')]['describe']();})['then'](function(_0x32a3f){if(!_0x32a3f){throw new db[(_0x471e('0x7b'))][(_0x471e('0x7c'))](_0x471e('0x7d'));}_0x20310b=_[_0x471e('0x7e')](_[_0x471e('0x45')](_0x32a3f),[_0x471e('0x7f'),'updatedAt']);_0x5dceb9=_[_0x471e('0x7e')](_[_0x471e('0x45')](_0x32a3f),[_0x471e('0x7f'),_0x471e('0x80'),'CompanyId',_0x471e('0x81')]);_0x1c94d9[_0x471e('0x5e')]={'mapKey':_0x471e('0x82')};if(_0x1c94d9['account'][_0x471e('0x51')]){switch(_0x1c94d9[_0x471e('0x79')][_0x471e('0x51')]){case'twilio':_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x84')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x85')];_0x1c94d9['body']['messageId']=_0x282c76['body'][_0x471e('0x86')];break;case _0x471e('0x87'):_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]='+'+_0x282c76[_0x471e('0x5e')][_0x471e('0x88')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76['body']['text'];break;case _0x471e('0x89'):_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x83')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x26')];break;case'clicksend':_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x83')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x5e')];_0x1c94d9['body'][_0x471e('0x8a')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x8b')];break;case'plivo':_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x84')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x8c')];_0x1c94d9[_0x471e('0x5e')]['messageId']=_0x282c76[_0x471e('0x5e')][_0x471e('0x8d')];break;case _0x471e('0x8e'):_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]='+'+_0x282c76[_0x471e('0x5e')][_0x471e('0x8f')][0x0][_0x471e('0x83')];_0x1c94d9[_0x471e('0x5e')]['body']=_0x282c76[_0x471e('0x5e')][_0x471e('0x8f')][0x0][_0x471e('0x90')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x8a')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x8f')][0x0][_0x471e('0x8a')];break;case _0x471e('0x91'):_0x1c94d9[_0x471e('0x5e')]['from']=_0x282c76[_0x471e('0x5e')]['originatingAddress'];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x92')][_0x471e('0x26')];break;case _0x471e('0x93'):_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x94')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x90')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x8a')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x95')];break;case _0x471e('0x96'):_0x1c94d9[_0x471e('0x5e')][_0x471e('0x8a')]=_0x282c76['body'][0x0][_0x471e('0x26')]['id'];_0x1c94d9[_0x471e('0x5e')]['from']=_0x282c76['body'][0x0][_0x471e('0x26')][_0x471e('0x83')];_0x1c94d9[_0x471e('0x5e')]['body']=_0x282c76[_0x471e('0x5e')][0x0][_0x471e('0x26')][_0x471e('0x90')];break;case _0x471e('0x97'):_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')]=_0x282c76['body']['from'];_0x1c94d9[_0x471e('0x5e')]['body']=_0x282c76['body'][_0x471e('0x26')];_0x1c94d9[_0x471e('0x5e')][_0x471e('0x8a')]=_0x282c76[_0x471e('0x5e')][_0x471e('0x98')];break;}}if(_0x1c94d9[_0x471e('0x5e')]['id']){delete _0x1c94d9['body']['id'];}if(_[_0x471e('0x99')](_0x1c94d9[_0x471e('0x5e')]['from'])){throw new db[(_0x471e('0x7b'))][(_0x471e('0x7c'))](_0x471e('0x9a'));}if(_[_0x471e('0x99')](_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')])||_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')]===''){throw new db[(_0x471e('0x7b'))][(_0x471e('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x471e('0x99')](_0x1c94d9[_0x471e('0x5e')][_0x471e('0x9b')])){throw new db[(_0x471e('0x7b'))][(_0x471e('0x7c'))](_0x471e('0x9c')+_0x5dceb9);}if(!_[_0x471e('0x9d')](_0x5dceb9,_0x1c94d9[_0x471e('0x5e')]['mapKey'])){throw new db[(_0x471e('0x7b'))]['ValidationError'](_0x471e('0x9e')+_0x5dceb9);}_0x5afe1e[_0x1c94d9[_0x471e('0x5e')][_0x471e('0x9b')]]=_0x1c94d9[_0x471e('0x5e')]['from'];return db['CmList']['find']({'where':{'id':_0x1c94d9[_0x471e('0x79')][_0x471e('0x81')]},'include':[{'model':db[_0x471e('0x7a')],'as':_0x471e('0x9f'),'where':_0x5afe1e,'limit':0x1,'order':[[_0x471e('0x80'),'DESC']]}]});})[_0x471e('0x1f')](handleEntityNotFound(_0x40e90f,null))[_0x471e('0x1f')](function(_0x5e695f){if(_0x5e695f){_0x1c94d9[_0x471e('0xa0')]=_['omit'](_0x5e695f,['Contacts']);if(_0x5e695f[_0x471e('0x9f')]['length']){return _0x5e695f[_0x471e('0x9f')][0x0];}var _0x54112e=_[_0x471e('0xa1')](_0x1c94d9['body'],{'firstName':_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')],'ListId':_0x5e695f['id']});_0x54112e[_0x1c94d9[_0x471e('0x5e')][_0x471e('0x9b')]]=_0x1c94d9[_0x471e('0x5e')]['from'];return db[_0x471e('0x7a')][_0x471e('0x5d')](_0x54112e,{'fields':_0x20310b,'raw':!![]});}})[_0x471e('0x1f')](handleEntityNotFound(_0x40e90f,null))['then'](function(_0x2b509b){if(_0x2b509b){_0x1c94d9[_0x471e('0xa2')]=_0x2b509b;var _0x1c004d={'ContactId':_0x2b509b['id'],'phone':_0x1c94d9[_0x471e('0x5e')][_0x471e('0x83')],'SmsAccountId':_0x282c76[_0x471e('0x5b')]['id']};var _0x271834={'ContactId':_0x2b509b['id'],'SmsAccountId':_0x282c76[_0x471e('0x5b')]['id'],'closed':![]};return db[_0x471e('0xa3')]['find']({'where':_0x271834})[_0x471e('0x1f')](function(_0xaf61f2){if(_0xaf61f2){return[_0xaf61f2,![]];}return db['SmsInteraction'][_0x471e('0x5d')](_0x1c004d)[_0x471e('0x1f')](function(_0x3cf143){return[_0x3cf143,!![]];});});}})[_0x471e('0xa4')](function(_0x2ce498,_0x2d1d79){_0x1c94d9[_0x471e('0xa5')]=_0x2ce498['get']({'plain':!![]});_0x1c94d9['interaction'][_0x471e('0xa6')]=![];if(_0x2d1d79){if(_0x1c94d9['account'][_0x471e('0xa7')]){_0x1c94d9['applications'][_0x471e('0xa8')]({'id':0x0,'priority':_0x1c94d9[_0x471e('0xa9')]['length']+0x1,'app':'close','appdata':_0x471e('0xaa'),'interval':_0x471e('0xab')});}_0x1c94d9[_0x471e('0xa5')]['created']=!![];}return db[_0x471e('0xac')][_0x471e('0x5d')]({'phone':_0x1c94d9[_0x471e('0x5e')]['from'],'messageId':_0x1c94d9[_0x471e('0x5e')]['messageId'],'body':_0x1c94d9[_0x471e('0x5e')][_0x471e('0x5e')],'SmsAccountId':_0x282c76[_0x471e('0x5b')]['id'],'SmsInteractionId':_0x2ce498['id'],'direction':'in','ContactId':_0x2ce498[_0x471e('0xad')],'AttachmentId':_0x1c94d9['body'][_0x471e('0xae')]});})[_0x471e('0x1f')](function(_0x2ae4e5){_0x1c94d9[_0x471e('0x26')]=_0x2ae4e5;if(_0x1c94d9[_0x471e('0xa5')][_0x471e('0xaf')]){return db[_0x471e('0xb0')][_0x471e('0x64')]({'attributes':['id','name'],'where':{'id':_0x1c94d9[_0x471e('0xa5')][_0x471e('0xaf')]}})[_0x471e('0x1f')](function(_0x3d72be){if(_0x3d72be){_0x1c94d9[_0x471e('0xa9')][_0x471e('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3d72be[_0x471e('0x3b')]+','+(_0x1c94d9[_0x471e('0x79')][_0x471e('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x471e('0xb3'),_0x471e('0xb4'),_0x1c94d9);});}return respondWithRpcPromise(_0x471e('0xb3'),_0x471e('0xb4'),_0x1c94d9);})[_0x471e('0x1f')](function(_0x2b6be1){if(_0x2b6be1){var _0xc627ae=0xc8;var _0x2a41c8=_0x471e('0xb5');logger[_0x471e('0x27')](_0x471e('0xb6'),_0x2a41c8,_0xc627ae,_0x471e('0xb7'));logger['debug'](_0x471e('0xb8'),_0x2a41c8,_0xc627ae,_0x471e('0xb7'),JSON['stringify'](_0x2b6be1));if(_0x1c94d9[_0x471e('0x79')][_0x471e('0x51')]===_0x471e('0xb9')){return _0x40e90f[_0x471e('0x2c')](_0xc627ae)[_0x471e('0x31')](_0x471e('0xba'),_0x471e('0xbb'))[_0x471e('0x3c')](_0x471e('0xbc'));}else{return _0x40e90f[_0x471e('0x2c')](_0xc627ae)[_0x471e('0x2d')](_0x2b6be1);}}})[_0x471e('0x29')](handleError(_0x40e90f,null));};exports[_0x471e('0xbd')]=function(_0x16bc24,_0x3471b3){var _0x1c7b63=_0x16bc24[_0x471e('0x5b')]['id'];var _0x2537b4=_0x16bc24[_0x471e('0x5e')];var _0x2df1e3=0xc8;var _0x171e7d=null;return db[_0x471e('0xbe')][_0x471e('0xbf')]({'isolationLevel':db[_0x471e('0xbe')]['Transaction'][_0x471e('0xc0')][_0x471e('0xc1')]},function(_0x256c02){return db['SmsAccount'][_0x471e('0x6b')]({'where':{'id':_0x1c7b63},'transaction':_0x256c02})[_0x471e('0x1f')](function(_0x20d73c){if(_0x20d73c){return db[_0x471e('0x74')]['destroy']({'where':{'SmsAccountId':_0x1c7b63},'transaction':_0x256c02})[_0x471e('0x1f')](function(){var _0x2d6d3d=_['map'](_0x2537b4,function(_0x346f52){_0x346f52[_0x471e('0x6d')]=_0x1c7b63;return _0x346f52;});return db['SmsApplication'][_0x471e('0xc2')](_0x2d6d3d,{'transaction':_0x256c02});});}else{_0x2df1e3=0x194;_0x171e7d=[];}});})['then'](function(){if(_0x2df1e3!==0x194){return db['SmsApplication'][_0x471e('0xc3')]({'where':{'SmsAccountId':_0x1c7b63},'order':'priority'})['then'](function(_0x185516){_0x171e7d=_0x185516;});}})[_0x471e('0x29')](function(_0x22b893){_0x2df1e3=0x1f4;logger[_0x471e('0x24')](_0x22b893[_0x471e('0x3a')]);if(_0x22b893[_0x471e('0x3b')]){delete _0x22b893[_0x471e('0x3b')];}_0x171e7d=_0x22b893;})[_0x471e('0xc4')](function(){if(_0x171e7d===null){_0x3471b3[_0x471e('0x2a')](_0x2df1e3);}else{if(_0x2df1e3===0x1f4){_0x3471b3['status'](_0x2df1e3)[_0x471e('0x3c')](_0x171e7d);}else{_0x3471b3[_0x471e('0x2c')](_0x2df1e3)['json'](_0x171e7d);}}});};exports[_0x471e('0xc5')]=function(_0x3d59b5,_0x3d0c36,_0x4830ae){var _0x3bdf16={};var _0x92f511={};var _0x223be0;var _0x77a40;return db[_0x471e('0x3f')][_0x471e('0x6b')]({'where':{'id':_0x3d59b5['params']['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x3d0c36,null))[_0x471e('0x1f')](function(_0x54692c){if(_0x54692c){_0x223be0=_0x54692c;_0x92f511['model']=_[_0x471e('0x45')](db[_0x471e('0x74')][_0x471e('0x40')]);_0x92f511[_0x471e('0x44')]=_[_0x471e('0x45')](_0x3d59b5[_0x471e('0x44')]);_0x92f511[_0x471e('0x46')]=_[_0x471e('0x47')](_0x92f511[_0x471e('0x42')],_0x92f511[_0x471e('0x44')]);_0x3bdf16[_0x471e('0x48')]=_['intersection'](_0x92f511[_0x471e('0x42')],qs[_0x471e('0x49')](_0x3d59b5[_0x471e('0x44')][_0x471e('0x49')]));_0x3bdf16['attributes']=_0x3bdf16['attributes'][_0x471e('0x4a')]?_0x3bdf16[_0x471e('0x48')]:_0x92f511[_0x471e('0x42')];_0x3bdf16[_0x471e('0x4c')]=qs['sort'](_0x3d59b5['query']['sort']);_0x3bdf16[_0x471e('0x50')]=qs['filters'](_[_0x471e('0x4e')](_0x3d59b5[_0x471e('0x44')],_0x92f511[_0x471e('0x46')]));if(_0x3d59b5[_0x471e('0x44')][_0x471e('0x4f')]){_0x3bdf16['where']=_[_0x471e('0x53')](_0x3bdf16[_0x471e('0x50')],{'$or':_[_0x471e('0x43')](_0x3bdf16[_0x471e('0x48')],function(_0x5623fa){var _0x4d4fe1={};_0x4d4fe1[_0x5623fa]={'$like':'%'+_0x3d59b5[_0x471e('0x44')][_0x471e('0x4f')]+'%'};return _0x4d4fe1;})});}_0x3bdf16=_[_0x471e('0x53')]({},_0x3bdf16,_0x3d59b5[_0x471e('0x54')]);return _0x223be0[_0x471e('0xc5')](_0x3bdf16);}})[_0x471e('0x1f')](function(_0x1a2925){if(_0x1a2925){_0x77a40=_0x1a2925[_0x471e('0x4a')];if(!_0x3d59b5[_0x471e('0x44')][_0x471e('0x70')]('nolimit')){_0x3bdf16[_0x471e('0x2f')]=qs['limit'](_0x3d59b5[_0x471e('0x44')][_0x471e('0x2f')]);_0x3bdf16[_0x471e('0x30')]=qs[_0x471e('0x30')](_0x3d59b5[_0x471e('0x44')][_0x471e('0x30')]);}return _0x223be0[_0x471e('0xc5')](_0x3bdf16);}})[_0x471e('0x1f')](function(_0x481f53){if(_0x481f53){return _0x481f53?{'count':_0x77a40,'rows':_0x481f53}:null;}})[_0x471e('0x1f')](respondWithResult(_0x3d0c36,null))[_0x471e('0x29')](handleError(_0x3d0c36,null));};exports[_0x471e('0xc6')]=function(_0x17e891,_0xf5a125,_0x1042e2){var _0x2a3d66={'raw':![],'where':{}};var _0x18c4d5={};var _0x378dc9={'count':0x0,'rows':[]};return db['SmsAccount'][_0x471e('0x6b')]({'where':{'id':_0x17e891[_0x471e('0x5b')]['id']}})['then'](handleEntityNotFound(_0xf5a125,null))[_0x471e('0x1f')](function(_0x2f8b79){if(_0x2f8b79){_0x18c4d5[_0x471e('0x42')]=_[_0x471e('0x45')](db['SmsInteraction'][_0x471e('0x40')]);_0x18c4d5['query']=_[_0x471e('0x45')](_0x17e891[_0x471e('0x44')]);_0x18c4d5[_0x471e('0x46')]=_[_0x471e('0x47')](_0x18c4d5[_0x471e('0x42')],_0x18c4d5[_0x471e('0x44')]);_0x2a3d66[_0x471e('0x48')]=_[_0x471e('0x47')](_0x18c4d5['model'],qs[_0x471e('0x49')](_0x17e891[_0x471e('0x44')][_0x471e('0x49')]));_0x2a3d66[_0x471e('0x48')]=_0x2a3d66[_0x471e('0x48')][_0x471e('0x4a')]?_0x2a3d66[_0x471e('0x48')]:_0x18c4d5[_0x471e('0x42')];if(!_0x17e891[_0x471e('0x44')]['hasOwnProperty']('nolimit')){_0x2a3d66['limit']=qs['limit'](_0x17e891[_0x471e('0x44')][_0x471e('0x2f')]);_0x2a3d66[_0x471e('0x30')]=qs[_0x471e('0x30')](_0x17e891['query'][_0x471e('0x30')]);}_0x2a3d66['order']=qs[_0x471e('0x4d')](_0x17e891[_0x471e('0x44')][_0x471e('0x4d')]);_0x2a3d66[_0x471e('0x50')]=qs[_0x471e('0x46')](_['pick'](_0x17e891[_0x471e('0x44')],_0x18c4d5[_0x471e('0x46')]));_0x2a3d66['where'][_0x471e('0x6d')]=_0x2f8b79['id'];if(_0x17e891['query'][_0x471e('0x4f')]){_0x2a3d66[_0x471e('0x50')]=_['merge'](_0x2a3d66[_0x471e('0x50')],{'$or':_['map'](_0x2a3d66[_0x471e('0x48')],function(_0x2d281d){var _0x5ceb10={};_0x5ceb10[_0x2d281d]={'$like':'%'+_0x17e891['query']['filter']+'%'};return _0x5ceb10;})});}_0x2a3d66=_['merge']({},_0x2a3d66,_0x17e891[_0x471e('0x54')]);return db['SmsInteraction'][_0x471e('0x55')]({'where':_0x2a3d66[_0x471e('0x50')]})[_0x471e('0x1f')](function(_0x29fc71){_0x378dc9['count']=_0x29fc71;if(_0x17e891[_0x471e('0x44')][_0x471e('0x56')]){_0x2a3d66[_0x471e('0x57')]=[{'model':db[_0x471e('0x7a')],'as':_0x471e('0xc7'),'required':![]},{'model':db[_0x471e('0xb0')],'as':_0x471e('0xc8'),'attributes':[_0x471e('0x3b'),_0x471e('0xc9'),_0x471e('0xca')],'required':![]},{'model':db[_0x471e('0xcb')],'as':_0x471e('0xcc'),'attributes':['id','name',_0x471e('0xcd')],'where':_0x17e891[_0x471e('0x44')][_0x471e('0xce')]?{'id':_0x17e891['query'][_0x471e('0xce')]}:undefined,'required':_0x17e891[_0x471e('0x44')][_0x471e('0xce')]?!![]:![]}];}return db[_0x471e('0xa3')][_0x471e('0x58')](_0x2a3d66);})[_0x471e('0x1f')](function(_0x55479e){_0x378dc9[_0x471e('0x59')]=_0x55479e;return _0x378dc9;});}})[_0x471e('0x1f')](respondWithFilteredResult(_0xf5a125,_0x2a3d66))[_0x471e('0x29')](handleError(_0xf5a125,null));};exports[_0x471e('0x3c')]=function(_0x127f90,_0x1106c2,_0x272f95){var _0x28e3c5,_0x846616,_0x3c3857;if(_['isNil'](_0x127f90[_0x471e('0x5e')][_0x471e('0x5e')])||_0x127f90[_0x471e('0x5e')]['body']===''){throw new db[(_0x471e('0x7b'))][(_0x471e('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x471e('0x99')](_0x127f90['body']['to'])){throw new db[(_0x471e('0x7b'))][(_0x471e('0x7c'))](_0x471e('0xcf'));}_0x28e3c5=_0x127f90[_0x471e('0x5e')]['to'];return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x127f90['params']['id']},'include':[{'model':db[_0x471e('0xd0')],'as':'List','include':[{'model':db[_0x471e('0x7a')],'as':_0x471e('0x9f'),'where':{'mobile':_0x28e3c5},'limit':0x1,'order':[[_0x471e('0x80'),_0x471e('0xd1')]]}]}]})[_0x471e('0x1f')](handleEntityNotFound(_0x1106c2,null))[_0x471e('0x1f')](function(_0x496a84){if(_0x496a84&&_0x496a84[_0x471e('0xd2')]){_0x846616=_0x496a84[_0x471e('0x62')]({'plain':!![]});if(_0x846616[_0x471e('0xd2')]&&_0x846616[_0x471e('0xd2')][_0x471e('0x9f')][_0x471e('0x4a')]){return _0x846616[_0x471e('0xd2')][_0x471e('0x9f')][0x0];}return db['CmContact'][_0x471e('0x5d')](_['defaults'](_0x127f90['body'],{'firstName':_0x28e3c5,'mobile':_0x28e3c5,'phone':_0x28e3c5,'ListId':_0x846616[_0x471e('0x81')]}));}})[_0x471e('0x1f')](handleEntityNotFound(_0x1106c2,null))[_0x471e('0x1f')](function(_0x4a1277){if(_0x4a1277){_0x3c3857=_0x4a1277;return db[_0x471e('0xa3')][_0x471e('0x64')]({'where':{'ContactId':_0x3c3857['id'],'closed':![],'SmsAccountId':_0x846616['id']}})[_0x471e('0x1f')](function(_0xf76f0a){if(_0xf76f0a){return[_0xf76f0a,![]];}return db[_0x471e('0xa3')][_0x471e('0x5d')]({'UserId':_0x127f90[_0x471e('0x61')]['id'],'ContactId':_0x3c3857['id'],'SmsAccountId':_0x846616['id'],'phone':_0x28e3c5,'firstMsgDirection':'out','Messages':[_[_0x471e('0x53')](_0x127f90[_0x471e('0x5e')],{'read':![],'body':_0x127f90[_0x471e('0x5e')][_0x471e('0x5e')],'phone':_0x28e3c5,'SmsAccountId':_0x846616['id'],'UserId':_0x127f90[_0x471e('0x61')]['id'],'ContactId':_0x3c3857['id']})]},{'include':[{'model':db[_0x471e('0xac')],'as':_0x471e('0xd3')}]})[_0x471e('0x1f')](function(_0x206aa8){return[_0x206aa8,!![]];});});}})[_0x471e('0xa4')](function(_0x50b67d,_0x5e7161){if(_0x5e7161){return _0x50b67d;}return db[_0x471e('0xac')]['create'](_[_0x471e('0x53')](_0x127f90[_0x471e('0x5e')],{'read':![],'body':_0x127f90[_0x471e('0x5e')][_0x471e('0x5e')],'phone':_0x28e3c5,'SmsAccountId':_0x846616['id'],'SmsInteractionId':_0x50b67d['id'],'UserId':_0x127f90[_0x471e('0x61')]['id'],'ContactId':_0x3c3857['id']}))['then'](function(_0x50e587){_0x50b67d[_0x471e('0xd4')][_0x471e('0xd3')]=[];_0x50b67d[_0x471e('0xd4')][_0x471e('0xd3')][_0x471e('0xa8')](_0x50e587[_0x471e('0xd4')]);return _0x50b67d;});})[_0x471e('0x1f')](respondWithResult(_0x1106c2,null))[_0x471e('0x29')](handleError(_0x1106c2,null));};exports[_0x471e('0x2c')]=function(_0x2e62d8,_0x4c97ca,_0x171c45){if(_0x2e62d8[_0x471e('0x5e')]['id']){delete _0x2e62d8[_0x471e('0x5e')]['id'];}var _0x259e42,_0x3b7794,_0x442285;return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x2e62d8['params']['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x4c97ca,null))[_0x471e('0x1f')](function(_0x5a41ed){if(_0x5a41ed){_0x442285=_0x5a41ed;logger[_0x471e('0x22')](_0x471e('0xb6'),_0x471e('0x2c'),'received\x20delivery\x20report\x20from',_0x5a41ed['type'],util[_0x471e('0xd5')](_0x2e62d8[_0x471e('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5a41ed[_0x471e('0x51')]){case _0x471e('0x87'):if(_0x2e62d8['body'][_0x471e('0xd6')]&&_0x2e62d8['body']['status']){_0x3b7794=_0x2e62d8[_0x471e('0x5e')][_0x471e('0x2c')];return db[_0x471e('0xac')][_0x471e('0x64')]({'where':{'messageId':_0x2e62d8[_0x471e('0x5e')][_0x471e('0xd6')]}});}break;case _0x471e('0x89'):if(_0x2e62d8[_0x471e('0x5e')][_0x471e('0xd7')]&&_0x2e62d8['body'][_0x471e('0xd8')]){_0x3b7794=_0x2e62d8['body'][_0x471e('0xd8')];return db[_0x471e('0xac')]['find']({'where':{'messageId':_0x2e62d8['body']['requestid']}});}break;case _0x471e('0xd9'):if(_0x2e62d8['body'][_0x471e('0x8b')]&&_0x2e62d8[_0x471e('0x5e')][_0x471e('0xda')]){_0x3b7794=_0x2e62d8[_0x471e('0x5e')][_0x471e('0xda')];return db[_0x471e('0xac')][_0x471e('0x64')]({'where':{'messageId':_0x2e62d8[_0x471e('0x5e')]['message_id']}});}break;case'infobip':var _0x2cc3ea=_0x2e62d8[_0x471e('0x5e')][_0x471e('0x8f')][0x0];if(_0x2cc3ea['messageId']&&_0x2cc3ea[_0x471e('0x2c')][_0x471e('0xdb')]===_0x471e('0xdc')){_0x3b7794=_0x2cc3ea['status'][_0x471e('0xdb')];return db[_0x471e('0xac')][_0x471e('0x64')]({'where':{'messageId':_0x2cc3ea[_0x471e('0x8a')]}});}break;case _0x471e('0x93'):if(_0x2e62d8[_0x471e('0x5e')]['messageId']&&_0x2e62d8['body']['status']){_0x3b7794=_0x2e62d8['body'][_0x471e('0x2c')];return db['SmsMessage'][_0x471e('0x64')]({'where':{'messageId':_0x2e62d8[_0x471e('0x5e')][_0x471e('0x8a')]}});}break;case _0x471e('0x96'):if(_0x2e62d8[_0x471e('0x5e')][0x0][_0x471e('0x26')]['id']){_0x3b7794=_0x2e62d8[_0x471e('0x5e')][0x0][_0x471e('0x51')];return db[_0x471e('0xac')][_0x471e('0x64')]({'where':{'messageId':_0x2e62d8['body'][0x0]['message']['id']}});}break;case _0x471e('0x97'):if(_0x2e62d8[_0x471e('0x5e')][_0x471e('0xdd')]&&_0x2e62d8[_0x471e('0x5e')][_0x471e('0x2c')]){_0x3b7794=_0x2e62d8[_0x471e('0x5e')][_0x471e('0x2c')];return db['SmsMessage'][_0x471e('0x64')]({'where':{'messageId':_0x2e62d8[_0x471e('0x5e')][_0x471e('0xdd')]}});}break;}}})[_0x471e('0x1f')](handleEntityNotFound(_0x4c97ca,null))[_0x471e('0x1f')](function(_0x22975b){if(_0x22975b){_0x259e42=_0x22975b;switch(_0x442285[_0x471e('0x51')]){case _0x471e('0x87'):if(_0x3b7794===_0x471e('0xdc')){return _0x259e42['update']({'read':!![]});}else{logger[_0x471e('0x24')](_0x471e('0xb6'),_0x471e('0x2c'),'skebby',util[_0x471e('0xd5')](_0x2e62d8[_0x471e('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x471e('0x89'):if(_0x3b7794==='1'){return _0x259e42['update']({'read':!![]});}else{logger[_0x471e('0x24')](_0x471e('0xb6'),_0x471e('0x2c'),_0x471e('0x87'),util[_0x471e('0xd5')](_0x2e62d8[_0x471e('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x471e('0xd9'):if(!_0x2e62d8[_0x471e('0x5e')][_0x471e('0xde')]&&_0x3b7794>=0xc8&&_0x3b7794<=0xce){return _0x259e42[_0x471e('0x36')]({'read':!![]});}else{logger[_0x471e('0x24')](_0x471e('0xb6'),'status',_0x471e('0xd9'),util['inspect'](_0x2e62d8['body'],{'showHidden':![],'depth':null}));}break;case _0x471e('0x8e'):var _0x1898ab=_0x2e62d8['body']['results'][0x0];if(_0x1898ab['status'][_0x471e('0xdb')]==='DELIVERED'){return _0x259e42[_0x471e('0x36')]({'read':!![]});}else{logger[_0x471e('0x24')](_0x471e('0xb6'),'status',_0x471e('0x8e'),util[_0x471e('0xd5')](_0x2e62d8['body'],{'showHidden':![],'depth':null}));}break;case _0x471e('0x93'):if(_0x3b7794=='DELIVERED_TO_GATEWAY'||_0x3b7794==_0x471e('0xdf')){return _0x259e42[_0x471e('0x36')]({'read':!![]});}else{logger[_0x471e('0x24')](_0x471e('0xb6'),_0x471e('0x2c'),'clickatell',util[_0x471e('0xd5')](_0x2e62d8[_0x471e('0x5e')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3b7794==_0x471e('0xe0')){return _0x259e42['update']({'read':!![]});}else{logger[_0x471e('0x24')](_0x471e('0xb6'),'status','bandwidth',util['inspect'](_0x2e62d8[_0x471e('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x471e('0x97'):if(_0x3b7794===_0x471e('0xe1')||_0x3b7794==='ACCEPTD'){return _0x259e42[_0x471e('0x36')]({'read':!![]});}else{logger[_0x471e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0x471e('0xd5')](_0x2e62d8[_0x471e('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x259e42;}})[_0x471e('0x1f')](respondWithResult(_0x4c97ca,null))[_0x471e('0x29')](handleError(_0x4c97ca,null));};exports[_0x471e('0xe2')]=function(_0x1579d7,_0x1e3a77,_0x1d93d4){var _0xfb774,_0x47912b,_0x30d470;return db[_0x471e('0x3f')][_0x471e('0x64')]({'where':{'id':_0x1579d7[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x1e3a77,null))[_0x471e('0x1f')](function(_0x19e63f){if(_0x19e63f){_0x30d470=_0x19e63f;logger[_0x471e('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x471e('0xe3'),_0x19e63f[_0x471e('0x51')],util['inspect'](_0x1579d7['query'],{'showHidden':![],'depth':null}));switch(_0x19e63f['type']){case _0x471e('0x91'):if(_0x1579d7[_0x471e('0x44')]['message-id']&&_0x1579d7[_0x471e('0x44')][_0x471e('0xe4')]){_0x47912b=_0x1579d7['query'][_0x471e('0xe4')];return db[_0x471e('0xac')][_0x471e('0x64')]({'where':{'messageId':_0x1579d7[_0x471e('0x44')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x1e3a77,null))[_0x471e('0x1f')](function(_0x14149d){if(_0x14149d){_0xfb774=_0x14149d;switch(_0x30d470[_0x471e('0x51')]){case _0x471e('0x91'):if(_0x47912b==='2'||_0x47912b==='6'){return _0xfb774['update']({'read':!![]});}else{logger[_0x471e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x471e('0x2c'),'csc',util[_0x471e('0xd5')](_0x1579d7['query'],{'showHidden':![],'depth':null}));};break;}return _0xfb774;}})[_0x471e('0x1f')](respondWithResult(_0x1e3a77,null))[_0x471e('0x29')](handleError(_0x1e3a77,null));};exports[_0x471e('0xe5')]=function(_0x3e1f62,_0x26273e,_0x59dfd8){return db[_0x471e('0x3f')]['find']({'where':{'id':_0x3e1f62[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x26273e,null))['then'](function(_0x1c8173){if(_0x1c8173){return _0x1c8173[_0x471e('0xe5')](_0x3e1f62[_0x471e('0x5e')][_0x471e('0xe6')],_['omit'](_0x3e1f62['body'],[_0x471e('0xe6'),'id'])||{})[_0x471e('0xa4')](function(_0x1f1658){for(var _0x7666f1=0x0;_0x7666f1<_0x3e1f62[_0x471e('0x5e')][_0x471e('0xe6')][_0x471e('0x4a')];_0x7666f1+=0x1){socket[_0x471e('0xe7')](_0x471e('0xe8'),{'UserId':Number(_0x3e1f62['body']['ids'][_0x7666f1]),'SmsAccountId':Number(_0x3e1f62[_0x471e('0x5b')]['id'])});}return _0x1f1658;});}})[_0x471e('0x1f')](respondWithResult(_0x26273e,null))[_0x471e('0x29')](handleError(_0x26273e,null));};exports[_0x471e('0xe9')]=function(_0x325e5d,_0xcf39cd,_0x33b312){return db[_0x471e('0x3f')]['find']({'where':{'id':_0x325e5d[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0xcf39cd,null))[_0x471e('0x1f')](function(_0x48754c){if(_0x48754c){return _0x48754c[_0x471e('0xe9')](_0x325e5d[_0x471e('0x44')][_0x471e('0xe6')])[_0x471e('0x1f')](function(){if(_['isArray'](_0x325e5d[_0x471e('0x44')][_0x471e('0xe6')])){for(var _0x2ec1a4=0x0;_0x2ec1a4<_0x325e5d[_0x471e('0x44')][_0x471e('0xe6')][_0x471e('0x4a')];_0x2ec1a4+=0x1){socket[_0x471e('0xe7')]('userSmsAccount:remove',{'UserId':Number(_0x325e5d[_0x471e('0x44')][_0x471e('0xe6')][_0x2ec1a4]),'SmsAccountId':Number(_0x325e5d['params']['id'])});}}else{socket[_0x471e('0xe7')](_0x471e('0xea'),{'UserId':Number(_0x325e5d[_0x471e('0x44')][_0x471e('0xe6')]),'SmsAccountId':Number(_0x325e5d[_0x471e('0x5b')]['id'])});}});}})[_0x471e('0x1f')](respondWithStatusCode(_0xcf39cd,null))[_0x471e('0x29')](handleError(_0xcf39cd,null));};exports[_0x471e('0xeb')]=function(_0x271ad5,_0x257cfc,_0x583771){var _0x4767b2={};var _0x424827={};var _0x47e2ad;var _0x56b56b;return db['SmsAccount'][_0x471e('0x6b')]({'where':{'id':_0x271ad5[_0x471e('0x5b')]['id']}})[_0x471e('0x1f')](handleEntityNotFound(_0x257cfc,null))[_0x471e('0x1f')](function(_0x107031){if(_0x107031){_0x47e2ad=_0x107031;_0x424827[_0x471e('0x42')]=_[_0x471e('0x45')](db['User']['rawAttributes']);_0x424827['query']=_[_0x471e('0x45')](_0x271ad5['query']);_0x424827['filters']=_[_0x471e('0x47')](_0x424827[_0x471e('0x42')],_0x424827['query']);_0x4767b2['attributes']=_['intersection'](_0x424827[_0x471e('0x42')],qs['fields'](_0x271ad5[_0x471e('0x44')][_0x471e('0x49')]));_0x4767b2[_0x471e('0x48')]=_0x4767b2['attributes'][_0x471e('0x4a')]?_0x4767b2[_0x471e('0x48')]:_0x424827[_0x471e('0x42')];_0x4767b2['order']=qs[_0x471e('0x4d')](_0x271ad5[_0x471e('0x44')][_0x471e('0x4d')]);_0x4767b2[_0x471e('0x50')]=qs['filters'](_[_0x471e('0x4e')](_0x271ad5[_0x471e('0x44')],_0x424827['filters']));if(_0x271ad5[_0x471e('0x44')][_0x471e('0x4f')]){_0x4767b2[_0x471e('0x50')]=_['merge'](_0x4767b2[_0x471e('0x50')],{'$or':_[_0x471e('0x43')](_0x4767b2['attributes'],function(_0x565378){var _0x2bc6dd={};_0x2bc6dd[_0x565378]={'$like':'%'+_0x271ad5[_0x471e('0x44')]['filter']+'%'};return _0x2bc6dd;})});}_0x4767b2=_[_0x471e('0x53')]({},_0x4767b2,_0x271ad5[_0x471e('0x54')]);return _0x47e2ad['getAgents'](_0x4767b2);}})[_0x471e('0x1f')](function(_0x3b0da1){if(_0x3b0da1){_0x56b56b=_0x3b0da1[_0x471e('0x4a')];if(!_0x271ad5[_0x471e('0x44')]['hasOwnProperty'](_0x471e('0x4b'))){_0x4767b2['limit']=qs['limit'](_0x271ad5[_0x471e('0x44')][_0x471e('0x2f')]);_0x4767b2['offset']=qs['offset'](_0x271ad5[_0x471e('0x44')][_0x471e('0x30')]);}return _0x47e2ad['getAgents'](_0x4767b2);}})[_0x471e('0x1f')](function(_0x2736f0){if(_0x2736f0){return _0x2736f0?{'count':_0x56b56b,'rows':_0x2736f0}:null;}})[_0x471e('0x1f')](respondWithResult(_0x257cfc,null))[_0x471e('0x29')](handleError(_0x257cfc,null));}; \ No newline at end of file +var _0xa3db=['addAnswer','getAnswers','CannedAnswer','hasOwnProperty','notify','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','MessageSid','text','connectel','messageId','Text','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Sequelize','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','redif','skebby','DELIVERED','error_code','infobip','SmsAccount,\x20%s,\x20%s,\x20%s','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','SmsAccount,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','SmsAccounts','name','index','Pause','map','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','merge','filter','options','SmsAccount','includeAll','include','findAll','rows','params','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','pick','removeDispositions','ids'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa3db,0x165));var _0xba3d=function(_0x3d5a78,_0x78862e){_0x3d5a78=_0x3d5a78-0x0;var _0x26eb14=_0xa3db[_0x3d5a78];return _0x26eb14;};'use strict';var emlformat=require(_0xba3d('0x0'));var rimraf=require(_0xba3d('0x1'));var zipdir=require(_0xba3d('0x2'));var jsonpatch=require(_0xba3d('0x3'));var rp=require(_0xba3d('0x4'));var moment=require(_0xba3d('0x5'));var BPromise=require(_0xba3d('0x6'));var Mustache=require(_0xba3d('0x7'));var util=require(_0xba3d('0x8'));var path=require(_0xba3d('0x9'));var sox=require(_0xba3d('0xa'));var csv=require('to-csv');var ejs=require(_0xba3d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba3d('0xc'));var squel=require(_0xba3d('0xd'));var crypto=require('crypto');var jsforce=require(_0xba3d('0xe'));var deskjs=require(_0xba3d('0xf'));var toCsv=require(_0xba3d('0x10'));var querystring=require(_0xba3d('0x11'));var Papa=require(_0xba3d('0x12'));var Redis=require(_0xba3d('0x13'));var authService=require(_0xba3d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xba3d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba3d('0x16'))('api');var utils=require(_0xba3d('0x17'));var config=require(_0xba3d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xba3d('0x19'))['db'];config[_0xba3d('0x1a')]=_['defaults'](config['redis'],{'host':_0xba3d('0x1b'),'port':0x18eb});var socket=require(_0xba3d('0x1c'))(new Redis(config[_0xba3d('0x1a')]));require(_0xba3d('0x1d'))[_0xba3d('0x1e')](socket);var jayson=require(_0xba3d('0x1f'));var client=jayson[_0xba3d('0x20')][_0xba3d('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x45bf4f,_0x11a3ef,_0x41a06b,_0x373f52){return new BPromise(function(_0x40ca92,_0x2102e8){var _0x5dfcb9=_0x373f52||client;return _0x5dfcb9[_0xba3d('0x22')](_0x45bf4f,_0x41a06b)['then'](function(_0x35c890){logger[_0xba3d('0x23')]('SmsAccount,\x20%s,\x20%s',_0x11a3ef,_0xba3d('0x24'));logger[_0xba3d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x11a3ef,_0xba3d('0x24'),JSON[_0xba3d('0x26')](_0x35c890));if(_0x35c890['error']){if(_0x35c890['error']['code']===0x1f4){logger['error'](_0xba3d('0x27'),_0x11a3ef,_0x35c890[_0xba3d('0x28')][_0xba3d('0x29')]);return _0x2102e8(_0x35c890[_0xba3d('0x28')][_0xba3d('0x29')]);}logger[_0xba3d('0x28')]('SmsAccount,\x20%s,\x20%s',_0x11a3ef,_0x35c890[_0xba3d('0x28')]['message']);return _0x40ca92(_0x35c890[_0xba3d('0x28')][_0xba3d('0x29')]);}else{logger[_0xba3d('0x23')]('SmsAccount,\x20%s,\x20%s',_0x11a3ef,_0xba3d('0x24'));_0x40ca92(_0x35c890[_0xba3d('0x2a')][_0xba3d('0x29')]);}})[_0xba3d('0x2b')](function(_0x331d79){logger[_0xba3d('0x28')](_0xba3d('0x27'),_0x11a3ef,_0x331d79);_0x2102e8(_0x331d79);});});}function respondWithStatusCode(_0x3101fc,_0x4ab93e){_0x4ab93e=_0x4ab93e||0xcc;return function(_0xda07a2){if(_0xda07a2){return _0x3101fc[_0xba3d('0x2c')](_0x4ab93e);}return _0x3101fc[_0xba3d('0x2d')](_0x4ab93e)[_0xba3d('0x2e')]();};}function respondWithResult(_0x1b515f,_0x1be0c0){_0x1be0c0=_0x1be0c0||0xc8;return function(_0xa0785f){if(_0xa0785f){return _0x1b515f[_0xba3d('0x2d')](_0x1be0c0)[_0xba3d('0x2f')](_0xa0785f);}};}function respondWithFilteredResult(_0x5ac9f6,_0x4bc232){return function(_0x261aa4){if(_0x261aa4){var _0xb8a3f0=typeof _0x4bc232[_0xba3d('0x30')]===_0xba3d('0x31')&&typeof _0x4bc232['limit']===_0xba3d('0x31');var _0x4f4473=_0x261aa4[_0xba3d('0x32')];var _0x4478ea=_0xb8a3f0?0x0:_0x4bc232[_0xba3d('0x30')];var _0x1ca313=_0xb8a3f0?_0x261aa4[_0xba3d('0x32')]:_0x4bc232[_0xba3d('0x30')]+_0x4bc232[_0xba3d('0x33')];var _0x12e734;if(_0x1ca313>=_0x4f4473){_0x1ca313=_0x4f4473;_0x12e734=0xc8;}else{_0x12e734=0xce;}_0x5ac9f6[_0xba3d('0x2d')](_0x12e734);return _0x5ac9f6[_0xba3d('0x34')](_0xba3d('0x35'),_0x4478ea+'-'+_0x1ca313+'/'+_0x4f4473)['json'](_0x261aa4);}return null;};}function patchUpdates(_0x2eb84d){return function(_0x11c07c){try{jsonpatch[_0xba3d('0x36')](_0x11c07c,_0x2eb84d,!![]);}catch(_0x2b08ec){return BPromise['reject'](_0x2b08ec);}return _0x11c07c[_0xba3d('0x37')]();};}function saveUpdates(_0x54c8b6,_0x65df8d){return function(_0x1ecd78){if(_0x1ecd78){return _0x1ecd78[_0xba3d('0x38')](_0x54c8b6)[_0xba3d('0x39')](function(_0x5816bc){return _0x5816bc;});}return null;};}function removeEntity(_0x3a52f1,_0x265259){return function(_0x20f7fb){if(_0x20f7fb){return _0x20f7fb[_0xba3d('0x3a')]()[_0xba3d('0x39')](function(){var _0x83cfe3=_0x20f7fb[_0xba3d('0x3b')]({'plain':!![]});var _0x433b59=_0xba3d('0x3c');return db['UserProfileResource'][_0xba3d('0x3a')]({'where':{'type':_0x433b59,'resourceId':_0x83cfe3['id']}})[_0xba3d('0x39')](function(){return _0x20f7fb;});})[_0xba3d('0x39')](function(){_0x3a52f1[_0xba3d('0x2d')](0xcc)[_0xba3d('0x2e')]();});}};}function handleEntityNotFound(_0x536ba8,_0x583b28){return function(_0x5f314e){if(!_0x5f314e){_0x536ba8[_0xba3d('0x2c')](0x194);}return _0x5f314e;};}function handleError(_0x1d0397,_0x1fab4d){_0x1fab4d=_0x1fab4d||0x1f4;return function(_0x1b1b1f){logger['error'](_0x1b1b1f['stack']);if(_0x1b1b1f[_0xba3d('0x3d')]){delete _0x1b1b1f[_0xba3d('0x3d')];}_0x1d0397[_0xba3d('0x2d')](_0x1fab4d)['send'](_0x1b1b1f);};}exports[_0xba3d('0x3e')]=function(_0xe0a0e4,_0xc74f28){var _0x3eaeca={'include':[{'model':db[_0xba3d('0x3f')],'as':'mandatoryDispositionPause'}]},_0x279833={},_0x401c0d={'count':0x0,'rows':[]};var _0x323f20=_[_0xba3d('0x40')](db['SmsAccount'][_0xba3d('0x41')],function(_0x5ea7fb){return{'name':_0x5ea7fb['fieldName'],'type':_0x5ea7fb[_0xba3d('0x42')][_0xba3d('0x43')]};});_0x279833['model']=_[_0xba3d('0x40')](_0x323f20,_0xba3d('0x3d'));_0x279833[_0xba3d('0x44')]=_[_0xba3d('0x45')](_0xe0a0e4['query']);_0x279833[_0xba3d('0x46')]=_['intersection'](_0x279833['model'],_0x279833['query']);_0x3eaeca[_0xba3d('0x47')]=_[_0xba3d('0x48')](_0x279833[_0xba3d('0x49')],qs[_0xba3d('0x4a')](_0xe0a0e4[_0xba3d('0x44')][_0xba3d('0x4a')]));_0x3eaeca[_0xba3d('0x47')]=_0x3eaeca['attributes'][_0xba3d('0x4b')]?_0x3eaeca['attributes']:_0x279833[_0xba3d('0x49')];if(!_0xe0a0e4[_0xba3d('0x44')]['hasOwnProperty'](_0xba3d('0x4c'))){_0x3eaeca['limit']=qs['limit'](_0xe0a0e4['query'][_0xba3d('0x33')]);_0x3eaeca[_0xba3d('0x30')]=qs[_0xba3d('0x30')](_0xe0a0e4['query'][_0xba3d('0x30')]);}_0x3eaeca[_0xba3d('0x4d')]=qs[_0xba3d('0x4e')](_0xe0a0e4[_0xba3d('0x44')][_0xba3d('0x4e')]);_0x3eaeca[_0xba3d('0x4f')]=qs[_0xba3d('0x46')](_['pick'](_0xe0a0e4[_0xba3d('0x44')],_0x279833[_0xba3d('0x46')]),_0x323f20);if(_0xe0a0e4['query']['filter']){_0x3eaeca['where']=_[_0xba3d('0x50')](_0x3eaeca['where'],{'$or':_[_0xba3d('0x40')](_0x323f20,function(_0x157a4){if(_0x157a4[_0xba3d('0x42')]!=='VIRTUAL'){var _0x3d6929={};_0x3d6929[_0x157a4['name']]={'$like':'%'+_0xe0a0e4[_0xba3d('0x44')][_0xba3d('0x51')]+'%'};return _0x3d6929;}})});}_0x3eaeca=_[_0xba3d('0x50')]({},_0x3eaeca,_0xe0a0e4[_0xba3d('0x52')]);var _0x3fe00b={'where':_0x3eaeca['where']};return db[_0xba3d('0x53')][_0xba3d('0x32')](_0x3fe00b)[_0xba3d('0x39')](function(_0x29a7ab){_0x401c0d[_0xba3d('0x32')]=_0x29a7ab;if(_0xe0a0e4[_0xba3d('0x44')][_0xba3d('0x54')]){_0x3eaeca[_0xba3d('0x55')]=[{'all':!![]}];}return db[_0xba3d('0x53')][_0xba3d('0x56')](_0x3eaeca);})['then'](function(_0xb47f87){_0x401c0d[_0xba3d('0x57')]=_0xb47f87;return _0x401c0d;})[_0xba3d('0x39')](respondWithFilteredResult(_0xc74f28,_0x3eaeca))[_0xba3d('0x2b')](handleError(_0xc74f28,null));};exports['show']=function(_0x2c5627,_0x10cccb){var _0x2689bc={'raw':![],'where':{'id':_0x2c5627[_0xba3d('0x58')]['id']},'include':[{'model':db[_0xba3d('0x3f')],'as':_0xba3d('0x59')}]},_0x294dc0={};_0x294dc0[_0xba3d('0x49')]=_[_0xba3d('0x45')](db[_0xba3d('0x53')][_0xba3d('0x41')]);_0x294dc0[_0xba3d('0x44')]=_[_0xba3d('0x45')](_0x2c5627[_0xba3d('0x44')]);_0x294dc0[_0xba3d('0x46')]=_[_0xba3d('0x48')](_0x294dc0['model'],_0x294dc0['query']);_0x2689bc[_0xba3d('0x47')]=_[_0xba3d('0x48')](_0x294dc0[_0xba3d('0x49')],qs[_0xba3d('0x4a')](_0x2c5627['query'][_0xba3d('0x4a')]));_0x2689bc[_0xba3d('0x47')]=_0x2689bc[_0xba3d('0x47')][_0xba3d('0x4b')]?_0x2689bc[_0xba3d('0x47')]:_0x294dc0[_0xba3d('0x49')];if(_0x2c5627['query'][_0xba3d('0x54')]){_0x2689bc[_0xba3d('0x55')]=[{'all':!![]}];}_0x2689bc=_[_0xba3d('0x50')]({},_0x2689bc,_0x2c5627[_0xba3d('0x52')]);return db['SmsAccount'][_0xba3d('0x5a')](_0x2689bc)[_0xba3d('0x39')](handleEntityNotFound(_0x10cccb,null))[_0xba3d('0x39')](respondWithResult(_0x10cccb,null))[_0xba3d('0x2b')](handleError(_0x10cccb,null));};exports[_0xba3d('0x5b')]=function(_0x2d05aa,_0x2c67fc){return db[_0xba3d('0x53')][_0xba3d('0x5b')](_0x2d05aa[_0xba3d('0x5c')],{})[_0xba3d('0x39')](function(_0x31f1a0){var _0x5a7ee8=_0x2d05aa['user'][_0xba3d('0x3b')]({'plain':!![]});if(!_0x5a7ee8)throw new Error(_0xba3d('0x5d'));if(_0x5a7ee8[_0xba3d('0x5e')]===_0xba3d('0x5f')){var _0x966388=_0x31f1a0[_0xba3d('0x3b')]({'plain':!![]});var _0x345a8a='SmsAccounts';return db[_0xba3d('0x60')]['find']({'where':{'name':_0x345a8a,'userProfileId':_0x5a7ee8['userProfileId']},'raw':!![]})[_0xba3d('0x39')](function(_0x239f78){if(_0x239f78&&_0x239f78[_0xba3d('0x61')]===0x0){return db[_0xba3d('0x62')][_0xba3d('0x5b')]({'name':_0x966388[_0xba3d('0x3d')],'resourceId':_0x966388['id'],'type':_0x239f78['name'],'sectionId':_0x239f78['id']},{})[_0xba3d('0x39')](function(){return _0x31f1a0;});}else{return _0x31f1a0;}})[_0xba3d('0x2b')](function(_0x1bfbff){logger['error'](_0xba3d('0x63'),_0x1bfbff);throw _0x1bfbff;});}return _0x31f1a0;})[_0xba3d('0x39')](respondWithResult(_0x2c67fc,0xc9))['catch'](handleError(_0x2c67fc,null));};exports[_0xba3d('0x38')]=function(_0x2909b1,_0x4f9f2c){if(_0x2909b1[_0xba3d('0x5c')]['id']){delete _0x2909b1[_0xba3d('0x5c')]['id'];}return db[_0xba3d('0x53')][_0xba3d('0x5a')]({'where':{'id':_0x2909b1['params']['id']},'include':[{'model':db[_0xba3d('0x3f')],'as':_0xba3d('0x59')}]})[_0xba3d('0x39')](handleEntityNotFound(_0x4f9f2c,null))[_0xba3d('0x39')](saveUpdates(_0x2909b1[_0xba3d('0x5c')],null))[_0xba3d('0x39')](respondWithResult(_0x4f9f2c,null))[_0xba3d('0x2b')](handleError(_0x4f9f2c,null));};exports[_0xba3d('0x3a')]=function(_0x144fe7,_0x532ad5){return db['SmsAccount']['find']({'where':{'id':_0x144fe7[_0xba3d('0x58')]['id']}})['then'](handleEntityNotFound(_0x532ad5,null))['then'](removeEntity(_0x532ad5,null))['catch'](handleError(_0x532ad5,null));};exports[_0xba3d('0x64')]=function(_0x502c1f,_0x1f6b7e){return db[_0xba3d('0x53')]['describe']()[_0xba3d('0x39')](respondWithResult(_0x1f6b7e,null))['catch'](handleError(_0x1f6b7e,null));};exports[_0xba3d('0x65')]=function(_0x46d0e1,_0x5d2209,_0x2fb6bd){if(_0x46d0e1['body']['id']){delete _0x46d0e1[_0xba3d('0x5c')]['id'];}return db['SmsAccount'][_0xba3d('0x5a')]({'where':{'id':_0x46d0e1['params']['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x5d2209,null))[_0xba3d('0x39')](function(_0x46e020){if(_0x46e020){_0x46d0e1['body'][_0xba3d('0x66')]=_0x46e020['id'];return db['Disposition'][_0xba3d('0x5b')](_0x46d0e1['body']);}})[_0xba3d('0x39')](respondWithResult(_0x5d2209,null))[_0xba3d('0x2b')](handleError(_0x5d2209,null));};exports[_0xba3d('0x67')]=function(_0x25a319,_0x524bcf,_0x292b3b){var _0x362b62={'raw':![],'where':{}};var _0x70ef66={};var _0x389707={'count':0x0,'rows':[]};return db[_0xba3d('0x53')][_0xba3d('0x68')]({'where':{'id':_0x25a319[_0xba3d('0x58')]['id']}})['then'](handleEntityNotFound(_0x524bcf,null))[_0xba3d('0x39')](function(_0x534b45){if(_0x534b45){_0x70ef66[_0xba3d('0x49')]=_[_0xba3d('0x45')](db[_0xba3d('0x69')][_0xba3d('0x41')]);_0x70ef66[_0xba3d('0x44')]=_[_0xba3d('0x45')](_0x25a319[_0xba3d('0x44')]);_0x70ef66['filters']=_[_0xba3d('0x48')](_0x70ef66[_0xba3d('0x49')],_0x70ef66[_0xba3d('0x44')]);_0x362b62[_0xba3d('0x47')]=_[_0xba3d('0x48')](_0x70ef66[_0xba3d('0x49')],qs['fields'](_0x25a319[_0xba3d('0x44')]['fields']));_0x362b62[_0xba3d('0x47')]=_0x362b62[_0xba3d('0x47')][_0xba3d('0x4b')]?_0x362b62[_0xba3d('0x47')]:_0x70ef66['model'];if(!_0x25a319[_0xba3d('0x44')]['hasOwnProperty'](_0xba3d('0x4c'))){_0x362b62[_0xba3d('0x33')]=qs['limit'](_0x25a319[_0xba3d('0x44')]['limit']);_0x362b62['offset']=qs[_0xba3d('0x30')](_0x25a319[_0xba3d('0x44')]['offset']);}_0x362b62[_0xba3d('0x4d')]=qs[_0xba3d('0x4e')](_0x25a319['query'][_0xba3d('0x4e')]);_0x362b62[_0xba3d('0x4f')]=qs[_0xba3d('0x46')](_[_0xba3d('0x6a')](_0x25a319[_0xba3d('0x44')],_0x70ef66[_0xba3d('0x46')]));_0x362b62[_0xba3d('0x4f')][_0xba3d('0x66')]=_0x534b45['id'];if(_0x25a319[_0xba3d('0x44')][_0xba3d('0x51')]){_0x362b62['where']=_[_0xba3d('0x50')](_0x362b62[_0xba3d('0x4f')],{'$or':_[_0xba3d('0x40')](_0x362b62['attributes'],function(_0x386d18){var _0x4798d4={};_0x4798d4[_0x386d18]={'$like':'%'+_0x25a319[_0xba3d('0x44')][_0xba3d('0x51')]+'%'};return _0x4798d4;})});}_0x362b62=_[_0xba3d('0x50')]({},_0x362b62,_0x25a319['options']);return db[_0xba3d('0x69')][_0xba3d('0x32')]({'where':_0x362b62[_0xba3d('0x4f')]})[_0xba3d('0x39')](function(_0x22b1c4){_0x389707[_0xba3d('0x32')]=_0x22b1c4;if(_0x25a319[_0xba3d('0x44')][_0xba3d('0x54')]){_0x362b62[_0xba3d('0x55')]=[{'all':!![]}];}return db[_0xba3d('0x69')][_0xba3d('0x56')](_0x362b62);})['then'](function(_0x714aa1){_0x389707[_0xba3d('0x57')]=_0x714aa1;return _0x389707;});}})[_0xba3d('0x39')](respondWithFilteredResult(_0x524bcf,_0x362b62))[_0xba3d('0x2b')](handleError(_0x524bcf,null));};exports[_0xba3d('0x6b')]=function(_0x541657,_0x5183bb,_0x23cf08){return db[_0xba3d('0x53')][_0xba3d('0x5a')]({'where':{'id':_0x541657[_0xba3d('0x58')]['id']}})['then'](handleEntityNotFound(_0x5183bb,null))[_0xba3d('0x39')](function(_0x4567dd){if(_0x4567dd){return _0x4567dd['removeDispositions'](_0x541657['query'][_0xba3d('0x6c')]);}})[_0xba3d('0x39')](respondWithStatusCode(_0x5183bb,null))[_0xba3d('0x2b')](handleError(_0x5183bb,null));};exports[_0xba3d('0x6d')]=function(_0x2c6f2d,_0x290882,_0xf56730){if(_0x2c6f2d[_0xba3d('0x5c')]['id']){delete _0x2c6f2d[_0xba3d('0x5c')]['id'];}return db['SmsAccount'][_0xba3d('0x5a')]({'where':{'id':_0x2c6f2d[_0xba3d('0x58')]['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x290882,null))['then'](function(_0x4640fc){if(_0x4640fc){_0x2c6f2d['body'][_0xba3d('0x66')]=_0x4640fc['id'];return db['CannedAnswer'][_0xba3d('0x5b')](_0x2c6f2d[_0xba3d('0x5c')]);}})[_0xba3d('0x39')](respondWithResult(_0x290882,null))[_0xba3d('0x2b')](handleError(_0x290882,null));};exports[_0xba3d('0x6e')]=function(_0x50fb32,_0x2b4f9d,_0xf808ae){var _0xcdec14={'raw':![],'where':{}};var _0x53e812={};var _0x96fe2f={'count':0x0,'rows':[]};return db[_0xba3d('0x53')]['findOne']({'where':{'id':_0x50fb32[_0xba3d('0x58')]['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x2b4f9d,null))[_0xba3d('0x39')](function(_0x1b8f24){if(_0x1b8f24){_0x53e812[_0xba3d('0x49')]=_[_0xba3d('0x45')](db[_0xba3d('0x6f')][_0xba3d('0x41')]);_0x53e812[_0xba3d('0x44')]=_[_0xba3d('0x45')](_0x50fb32[_0xba3d('0x44')]);_0x53e812[_0xba3d('0x46')]=_[_0xba3d('0x48')](_0x53e812[_0xba3d('0x49')],_0x53e812[_0xba3d('0x44')]);_0xcdec14['attributes']=_['intersection'](_0x53e812[_0xba3d('0x49')],qs[_0xba3d('0x4a')](_0x50fb32['query'][_0xba3d('0x4a')]));_0xcdec14[_0xba3d('0x47')]=_0xcdec14[_0xba3d('0x47')][_0xba3d('0x4b')]?_0xcdec14[_0xba3d('0x47')]:_0x53e812[_0xba3d('0x49')];if(!_0x50fb32[_0xba3d('0x44')][_0xba3d('0x70')](_0xba3d('0x4c'))){_0xcdec14['limit']=qs[_0xba3d('0x33')](_0x50fb32[_0xba3d('0x44')][_0xba3d('0x33')]);_0xcdec14[_0xba3d('0x30')]=qs[_0xba3d('0x30')](_0x50fb32[_0xba3d('0x44')]['offset']);}_0xcdec14[_0xba3d('0x4d')]=qs[_0xba3d('0x4e')](_0x50fb32['query']['sort']);_0xcdec14[_0xba3d('0x4f')]=qs[_0xba3d('0x46')](_['pick'](_0x50fb32[_0xba3d('0x44')],_0x53e812[_0xba3d('0x46')]));_0xcdec14['where']['SmsAccountId']=_0x1b8f24['id'];if(_0x50fb32['query']['filter']){_0xcdec14['where']=_['merge'](_0xcdec14['where'],{'$or':_[_0xba3d('0x40')](_0xcdec14[_0xba3d('0x47')],function(_0x1e62ed){var _0x5d5c1f={};_0x5d5c1f[_0x1e62ed]={'$like':'%'+_0x50fb32[_0xba3d('0x44')][_0xba3d('0x51')]+'%'};return _0x5d5c1f;})});}_0xcdec14=_[_0xba3d('0x50')]({},_0xcdec14,_0x50fb32[_0xba3d('0x52')]);return db[_0xba3d('0x6f')][_0xba3d('0x32')]({'where':_0xcdec14['where']})[_0xba3d('0x39')](function(_0x5ee105){_0x96fe2f['count']=_0x5ee105;if(_0x50fb32['query'][_0xba3d('0x54')]){_0xcdec14[_0xba3d('0x55')]=[{'all':!![]}];}return db[_0xba3d('0x6f')]['findAll'](_0xcdec14);})[_0xba3d('0x39')](function(_0x55657e){_0x96fe2f[_0xba3d('0x57')]=_0x55657e;return _0x96fe2f;});}})[_0xba3d('0x39')](respondWithFilteredResult(_0x2b4f9d,_0xcdec14))[_0xba3d('0x2b')](handleError(_0x2b4f9d,null));};exports['removeAnswers']=function(_0xa2e76c,_0x37021b,_0xdd86b2){return db[_0xba3d('0x53')]['find']({'where':{'id':_0xa2e76c['params']['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x37021b,null))['then'](function(_0x291814){if(_0x291814){return _0x291814['removeAnswers'](_0xa2e76c[_0xba3d('0x44')][_0xba3d('0x6c')]);}})[_0xba3d('0x39')](respondWithStatusCode(_0x37021b,null))[_0xba3d('0x2b')](handleError(_0x37021b,null));};exports[_0xba3d('0x71')]=function(_0x3ec402,_0x84ce38,_0x3d5fcc){var _0x13a262={'channel':'sms'};var _0x58425c=[];var _0xfb7faf=[];var _0x270c34={};return db[_0xba3d('0x53')]['find']({'where':{'id':_0x3ec402['params']['id']},'include':[{'model':db[_0xba3d('0x72')],'as':_0xba3d('0x73')}]})[_0xba3d('0x39')](handleEntityNotFound(_0x84ce38,null))[_0xba3d('0x39')](function(_0x48cdf3){_0x13a262[_0xba3d('0x74')]=_0x48cdf3;_0x13a262['applications']=_[_0xba3d('0x75')](_0x48cdf3[_0xba3d('0x73')],[_0xba3d('0x76')],[_0xba3d('0x77')]);if(_0x13a262[_0xba3d('0x74')][_0xba3d('0x73')]){delete _0x13a262[_0xba3d('0x74')][_0xba3d('0x73')];}return db[_0xba3d('0x78')]['describe']();})[_0xba3d('0x39')](function(_0x46258f){if(!_0x46258f){throw new db['Sequelize'][(_0xba3d('0x79'))]('no\x20available\x20attributes');}_0x58425c=_[_0xba3d('0x7a')](_['keys'](_0x46258f),[_0xba3d('0x7b'),_0xba3d('0x7c')]);_0xfb7faf=_['difference'](_[_0xba3d('0x45')](_0x46258f),['createdAt',_0xba3d('0x7c'),_0xba3d('0x7d'),_0xba3d('0x7e')]);_0x13a262['body']={'mapKey':_0xba3d('0x7f')};if(_0x13a262['account'][_0xba3d('0x42')]){switch(_0x13a262['account'][_0xba3d('0x42')]){case _0xba3d('0x80'):_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x82')];_0x13a262['body'][_0xba3d('0x5c')]=_0x3ec402[_0xba3d('0x5c')]['Body'];_0x13a262[_0xba3d('0x5c')]['messageId']=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x83')];break;case'skebby':_0x13a262['body'][_0xba3d('0x81')]='+'+_0x3ec402[_0xba3d('0x5c')]['sender'];_0x13a262[_0xba3d('0x5c')]['body']=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x84')];break;case _0xba3d('0x85'):_0x13a262['body'][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')]['from'];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x5c')]=_0x3ec402['body'][_0xba3d('0x29')];break;case'clicksend':_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x81')];_0x13a262['body'][_0xba3d('0x5c')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x5c')];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x86')]=_0x3ec402[_0xba3d('0x5c')]['message_id'];break;case'plivo':_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x82')];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x5c')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x87')];_0x13a262[_0xba3d('0x5c')]['messageId']=_0x3ec402[_0xba3d('0x5c')]['MessageUUID'];break;case'infobip':_0x13a262['body'][_0xba3d('0x81')]='+'+_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x88')][0x0][_0xba3d('0x81')];_0x13a262[_0xba3d('0x5c')]['body']=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x88')][0x0][_0xba3d('0x84')];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x86')]=_0x3ec402[_0xba3d('0x5c')]['results'][0x0][_0xba3d('0x86')];break;case _0xba3d('0x89'):_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')]['originatingAddress'];_0x13a262['body'][_0xba3d('0x5c')]=_0x3ec402['body'][_0xba3d('0x8a')][_0xba3d('0x29')];break;case _0xba3d('0x8b'):_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x8c')];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x5c')]=_0x3ec402[_0xba3d('0x5c')]['text'];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x86')]=_0x3ec402['body'][_0xba3d('0x8d')];break;case _0xba3d('0x8e'):_0x13a262[_0xba3d('0x5c')][_0xba3d('0x86')]=_0x3ec402['body'][0x0][_0xba3d('0x29')]['id'];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402[_0xba3d('0x5c')][0x0][_0xba3d('0x29')][_0xba3d('0x81')];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x5c')]=_0x3ec402[_0xba3d('0x5c')][0x0][_0xba3d('0x29')][_0xba3d('0x84')];break;case _0xba3d('0x8f'):_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')]=_0x3ec402['body'][_0xba3d('0x81')];_0x13a262[_0xba3d('0x5c')][_0xba3d('0x5c')]=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x29')];_0x13a262[_0xba3d('0x5c')]['messageId']=_0x3ec402[_0xba3d('0x5c')][_0xba3d('0x90')];break;}}if(_0x13a262[_0xba3d('0x5c')]['id']){delete _0x13a262[_0xba3d('0x5c')]['id'];}if(_['isNil'](_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')])){throw new db['Sequelize'][(_0xba3d('0x79'))](_0xba3d('0x91'));}if(_[_0xba3d('0x92')](_0x13a262[_0xba3d('0x5c')]['body'])||_0x13a262[_0xba3d('0x5c')]['body']===''){throw new db['Sequelize'][(_0xba3d('0x79'))](_0xba3d('0x93'));}if(_['isNil'](_0x13a262[_0xba3d('0x5c')][_0xba3d('0x94')])){throw new db['Sequelize'][(_0xba3d('0x79'))](_0xba3d('0x95')+_0xfb7faf);}if(!_['includes'](_0xfb7faf,_0x13a262[_0xba3d('0x5c')][_0xba3d('0x94')])){throw new db[(_0xba3d('0x96'))][(_0xba3d('0x79'))](_0xba3d('0x97')+_0xfb7faf);}_0x270c34[_0x13a262[_0xba3d('0x5c')][_0xba3d('0x94')]]=_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')];return db['CmList'][_0xba3d('0x5a')]({'where':{'id':_0x13a262[_0xba3d('0x74')]['ListId']},'include':[{'model':db['CmContact'],'as':_0xba3d('0x98'),'where':_0x270c34,'limit':0x1,'order':[[_0xba3d('0x7c'),_0xba3d('0x99')]]}]});})[_0xba3d('0x39')](handleEntityNotFound(_0x84ce38,null))['then'](function(_0x27cea3){if(_0x27cea3){_0x13a262[_0xba3d('0x9a')]=_['omit'](_0x27cea3,[_0xba3d('0x98')]);if(_0x27cea3[_0xba3d('0x98')]['length']){return _0x27cea3[_0xba3d('0x98')][0x0];}var _0x438ca5=_[_0xba3d('0x9b')](_0x13a262[_0xba3d('0x5c')],{'firstName':_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')],'ListId':_0x27cea3['id']});_0x438ca5[_0x13a262['body'][_0xba3d('0x94')]]=_0x13a262['body'][_0xba3d('0x81')];return db['CmContact'][_0xba3d('0x5b')](_0x438ca5,{'fields':_0x58425c,'raw':!![]});}})[_0xba3d('0x39')](handleEntityNotFound(_0x84ce38,null))[_0xba3d('0x39')](function(_0x3c067d){if(_0x3c067d){_0x13a262[_0xba3d('0x9c')]=_0x3c067d;var _0x187a3d={'ContactId':_0x3c067d['id'],'phone':_0x13a262[_0xba3d('0x5c')][_0xba3d('0x81')],'SmsAccountId':_0x3ec402[_0xba3d('0x58')]['id']};var _0x52c50b={'ContactId':_0x3c067d['id'],'SmsAccountId':_0x3ec402[_0xba3d('0x58')]['id'],'closed':![]};return db[_0xba3d('0x9d')][_0xba3d('0x5a')]({'where':_0x52c50b})[_0xba3d('0x39')](function(_0x57ff7b){if(_0x57ff7b){return[_0x57ff7b,![]];}return db[_0xba3d('0x9d')]['create'](_0x187a3d)[_0xba3d('0x39')](function(_0x5a8a37){return[_0x5a8a37,!![]];});});}})[_0xba3d('0x9e')](function(_0x227eb9,_0x21d241){_0x13a262[_0xba3d('0x9f')]=_0x227eb9['get']({'plain':!![]});_0x13a262[_0xba3d('0x9f')][_0xba3d('0xa0')]=![];if(_0x21d241){if(_0x13a262[_0xba3d('0x74')][_0xba3d('0xa1')]){_0x13a262[_0xba3d('0xa2')][_0xba3d('0xa3')]({'id':0x0,'priority':_0x13a262['applications']['length']+0x1,'app':_0xba3d('0xa4'),'appdata':'unmanaged','interval':_0xba3d('0xa5')});}_0x13a262[_0xba3d('0x9f')]['created']=!![];}return db[_0xba3d('0xa6')][_0xba3d('0x5b')]({'phone':_0x13a262['body'][_0xba3d('0x81')],'messageId':_0x13a262[_0xba3d('0x5c')][_0xba3d('0x86')],'body':_0x13a262[_0xba3d('0x5c')][_0xba3d('0x5c')],'SmsAccountId':_0x3ec402['params']['id'],'SmsInteractionId':_0x227eb9['id'],'direction':'in','ContactId':_0x227eb9[_0xba3d('0xa7')],'AttachmentId':_0x13a262['body'][_0xba3d('0xa8')]});})[_0xba3d('0x39')](function(_0x4be60a){_0x13a262['message']=_0x4be60a;if(_0x13a262[_0xba3d('0x9f')][_0xba3d('0xa9')]){return db[_0xba3d('0xaa')][_0xba3d('0x5a')]({'attributes':['id',_0xba3d('0x3d')],'where':{'id':_0x13a262[_0xba3d('0x9f')][_0xba3d('0xa9')]}})[_0xba3d('0x39')](function(_0x5102db){if(_0x5102db){_0x13a262[_0xba3d('0xa2')][_0xba3d('0xab')]({'id':0x0,'priority':0x0,'app':_0xba3d('0xac'),'appdata':_0x5102db[_0xba3d('0x3d')]+','+(_0x13a262[_0xba3d('0x74')][_0xba3d('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xba3d('0xae'),_0xba3d('0xaf'),_0x13a262);});}return respondWithRpcPromise('Start',_0xba3d('0xaf'),_0x13a262);})['then'](function(_0x59f20b){if(_0x59f20b){var _0x5ba22d=0xc8;var _0x3d21c4=_0xba3d('0xb0');logger[_0xba3d('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d21c4,_0x5ba22d,_0xba3d('0xb1'));logger[_0xba3d('0x25')](_0xba3d('0xb2'),_0x3d21c4,_0x5ba22d,_0xba3d('0xb1'),JSON[_0xba3d('0x26')](_0x59f20b));if(_0x13a262[_0xba3d('0x74')]['type']===_0xba3d('0x80')){return _0x84ce38['status'](_0x5ba22d)[_0xba3d('0x34')](_0xba3d('0xb3'),_0xba3d('0xb4'))[_0xba3d('0xb5')]('\x0a');}else{return _0x84ce38[_0xba3d('0x2d')](_0x5ba22d)[_0xba3d('0x2f')](_0x59f20b);}}})[_0xba3d('0x2b')](handleError(_0x84ce38,null));};exports[_0xba3d('0xb6')]=function(_0x3c6990,_0xb20063){var _0x3fdbee=_0x3c6990[_0xba3d('0x58')]['id'];var _0x40acc2=_0x3c6990[_0xba3d('0x5c')];var _0x3d16e0=0xc8;var _0x2bd024=null;return db[_0xba3d('0xb7')]['transaction']({'isolationLevel':db[_0xba3d('0xb7')][_0xba3d('0xb8')]['ISOLATION_LEVELS'][_0xba3d('0xb9')]},function(_0x202ac5){return db['SmsAccount'][_0xba3d('0x68')]({'where':{'id':_0x3fdbee},'transaction':_0x202ac5})[_0xba3d('0x39')](function(_0x44ae4b){if(_0x44ae4b){return db[_0xba3d('0x72')][_0xba3d('0x3a')]({'where':{'SmsAccountId':_0x3fdbee},'transaction':_0x202ac5})[_0xba3d('0x39')](function(){var _0x3e1b0a=_['map'](_0x40acc2,function(_0x44b65c){_0x44b65c['SmsAccountId']=_0x3fdbee;return _0x44b65c;});return db[_0xba3d('0x72')][_0xba3d('0xba')](_0x3e1b0a,{'transaction':_0x202ac5});});}else{_0x3d16e0=0x194;_0x2bd024=[];}});})['then'](function(){if(_0x3d16e0!==0x194){return db[_0xba3d('0x72')][_0xba3d('0xbb')]({'where':{'SmsAccountId':_0x3fdbee},'order':'priority'})['then'](function(_0x295f70){_0x2bd024=_0x295f70;});}})[_0xba3d('0x2b')](function(_0x563ac0){_0x3d16e0=0x1f4;logger[_0xba3d('0x28')](_0x563ac0[_0xba3d('0xbc')]);if(_0x563ac0['name']){delete _0x563ac0['name'];}_0x2bd024=_0x563ac0;})['finally'](function(){if(_0x2bd024===null){_0xb20063['sendStatus'](_0x3d16e0);}else{if(_0x3d16e0===0x1f4){_0xb20063[_0xba3d('0x2d')](_0x3d16e0)[_0xba3d('0xb5')](_0x2bd024);}else{_0xb20063[_0xba3d('0x2d')](_0x3d16e0)[_0xba3d('0x2f')](_0x2bd024);}}});};exports['getApplications']=function(_0x2409d1,_0xf2c11b,_0x45d913){var _0x421931={};var _0x225f36={};var _0x21a00e;var _0x422e64;return db[_0xba3d('0x53')][_0xba3d('0x68')]({'where':{'id':_0x2409d1['params']['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0xf2c11b,null))[_0xba3d('0x39')](function(_0x2891b7){if(_0x2891b7){_0x21a00e=_0x2891b7;_0x225f36['model']=_[_0xba3d('0x45')](db[_0xba3d('0x72')][_0xba3d('0x41')]);_0x225f36[_0xba3d('0x44')]=_['keys'](_0x2409d1[_0xba3d('0x44')]);_0x225f36[_0xba3d('0x46')]=_['intersection'](_0x225f36[_0xba3d('0x49')],_0x225f36['query']);_0x421931[_0xba3d('0x47')]=_[_0xba3d('0x48')](_0x225f36[_0xba3d('0x49')],qs['fields'](_0x2409d1[_0xba3d('0x44')][_0xba3d('0x4a')]));_0x421931[_0xba3d('0x47')]=_0x421931[_0xba3d('0x47')][_0xba3d('0x4b')]?_0x421931[_0xba3d('0x47')]:_0x225f36[_0xba3d('0x49')];_0x421931[_0xba3d('0x4d')]=qs[_0xba3d('0x4e')](_0x2409d1[_0xba3d('0x44')]['sort']);_0x421931[_0xba3d('0x4f')]=qs[_0xba3d('0x46')](_['pick'](_0x2409d1[_0xba3d('0x44')],_0x225f36['filters']));if(_0x2409d1[_0xba3d('0x44')][_0xba3d('0x51')]){_0x421931[_0xba3d('0x4f')]=_[_0xba3d('0x50')](_0x421931[_0xba3d('0x4f')],{'$or':_[_0xba3d('0x40')](_0x421931[_0xba3d('0x47')],function(_0x4597f7){var _0x5003ac={};_0x5003ac[_0x4597f7]={'$like':'%'+_0x2409d1[_0xba3d('0x44')][_0xba3d('0x51')]+'%'};return _0x5003ac;})});}_0x421931=_[_0xba3d('0x50')]({},_0x421931,_0x2409d1['options']);return _0x21a00e[_0xba3d('0xbd')](_0x421931);}})[_0xba3d('0x39')](function(_0x4abe19){if(_0x4abe19){_0x422e64=_0x4abe19[_0xba3d('0x4b')];if(!_0x2409d1[_0xba3d('0x44')][_0xba3d('0x70')](_0xba3d('0x4c'))){_0x421931[_0xba3d('0x33')]=qs[_0xba3d('0x33')](_0x2409d1[_0xba3d('0x44')][_0xba3d('0x33')]);_0x421931['offset']=qs[_0xba3d('0x30')](_0x2409d1[_0xba3d('0x44')]['offset']);}return _0x21a00e[_0xba3d('0xbd')](_0x421931);}})[_0xba3d('0x39')](function(_0x40fee0){if(_0x40fee0){return _0x40fee0?{'count':_0x422e64,'rows':_0x40fee0}:null;}})[_0xba3d('0x39')](respondWithResult(_0xf2c11b,null))[_0xba3d('0x2b')](handleError(_0xf2c11b,null));};exports[_0xba3d('0xbe')]=function(_0x2a1e66,_0x17c6ce,_0x523221){var _0x51e1f6={'raw':![],'where':{}};var _0x22a5ed={};var _0x300c2d={'count':0x0,'rows':[]};return db[_0xba3d('0x53')][_0xba3d('0x68')]({'where':{'id':_0x2a1e66['params']['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x17c6ce,null))[_0xba3d('0x39')](function(_0x323817){if(_0x323817){_0x22a5ed['model']=_[_0xba3d('0x45')](db[_0xba3d('0x9d')]['rawAttributes']);_0x22a5ed['query']=_[_0xba3d('0x45')](_0x2a1e66[_0xba3d('0x44')]);_0x22a5ed[_0xba3d('0x46')]=_['intersection'](_0x22a5ed[_0xba3d('0x49')],_0x22a5ed[_0xba3d('0x44')]);_0x51e1f6[_0xba3d('0x47')]=_[_0xba3d('0x48')](_0x22a5ed[_0xba3d('0x49')],qs['fields'](_0x2a1e66['query']['fields']));_0x51e1f6['attributes']=_0x51e1f6['attributes'][_0xba3d('0x4b')]?_0x51e1f6[_0xba3d('0x47')]:_0x22a5ed[_0xba3d('0x49')];if(!_0x2a1e66[_0xba3d('0x44')][_0xba3d('0x70')](_0xba3d('0x4c'))){_0x51e1f6[_0xba3d('0x33')]=qs[_0xba3d('0x33')](_0x2a1e66[_0xba3d('0x44')][_0xba3d('0x33')]);_0x51e1f6['offset']=qs[_0xba3d('0x30')](_0x2a1e66[_0xba3d('0x44')][_0xba3d('0x30')]);}_0x51e1f6['order']=qs[_0xba3d('0x4e')](_0x2a1e66['query']['sort']);_0x51e1f6[_0xba3d('0x4f')]=qs[_0xba3d('0x46')](_[_0xba3d('0x6a')](_0x2a1e66['query'],_0x22a5ed['filters']));_0x51e1f6[_0xba3d('0x4f')]['SmsAccountId']=_0x323817['id'];if(_0x2a1e66[_0xba3d('0x44')][_0xba3d('0x51')]){_0x51e1f6[_0xba3d('0x4f')]=_[_0xba3d('0x50')](_0x51e1f6['where'],{'$or':_[_0xba3d('0x40')](_0x51e1f6[_0xba3d('0x47')],function(_0x433412){var _0x24bfea={};_0x24bfea[_0x433412]={'$like':'%'+_0x2a1e66[_0xba3d('0x44')][_0xba3d('0x51')]+'%'};return _0x24bfea;})});}_0x51e1f6=_[_0xba3d('0x50')]({},_0x51e1f6,_0x2a1e66['options']);return db[_0xba3d('0x9d')][_0xba3d('0x32')]({'where':_0x51e1f6[_0xba3d('0x4f')]})['then'](function(_0x1d775b){_0x300c2d[_0xba3d('0x32')]=_0x1d775b;if(_0x2a1e66['query'][_0xba3d('0x54')]){_0x51e1f6[_0xba3d('0x55')]=[{'model':db[_0xba3d('0x78')],'as':_0xba3d('0xbf'),'required':![]},{'model':db['User'],'as':_0xba3d('0xc0'),'attributes':[_0xba3d('0x3d'),_0xba3d('0xc1'),_0xba3d('0xc2')],'required':![]},{'model':db[_0xba3d('0xc3')],'as':_0xba3d('0xc4'),'attributes':['id',_0xba3d('0x3d'),_0xba3d('0xc5')],'where':_0x2a1e66['query'][_0xba3d('0xc6')]?{'id':_0x2a1e66[_0xba3d('0x44')][_0xba3d('0xc6')]}:undefined,'required':_0x2a1e66['query'][_0xba3d('0xc6')]?!![]:![]}];}return db[_0xba3d('0x9d')][_0xba3d('0x56')](_0x51e1f6);})['then'](function(_0x246f6f){_0x300c2d['rows']=_0x246f6f;return _0x300c2d;});}})[_0xba3d('0x39')](respondWithFilteredResult(_0x17c6ce,_0x51e1f6))[_0xba3d('0x2b')](handleError(_0x17c6ce,null));};exports[_0xba3d('0xb5')]=function(_0x19b635,_0x12aa36,_0x1298cc){var _0x389a35,_0x152453,_0x500ded;if(_['isNil'](_0x19b635[_0xba3d('0x5c')][_0xba3d('0x5c')])||_0x19b635[_0xba3d('0x5c')]['body']===''){throw new db[(_0xba3d('0x96'))][(_0xba3d('0x79'))](_0xba3d('0x93'));}if(_[_0xba3d('0x92')](_0x19b635[_0xba3d('0x5c')]['to'])){throw new db[(_0xba3d('0x96'))][(_0xba3d('0x79'))](_0xba3d('0xc7'));}_0x389a35=_0x19b635['body']['to'];return db[_0xba3d('0x53')][_0xba3d('0x5a')]({'where':{'id':_0x19b635[_0xba3d('0x58')]['id']},'include':[{'model':db[_0xba3d('0xc8')],'as':_0xba3d('0xc9'),'include':[{'model':db['CmContact'],'as':_0xba3d('0x98'),'where':{'mobile':_0x389a35},'limit':0x1,'order':[['updatedAt',_0xba3d('0x99')]]}]}]})['then'](handleEntityNotFound(_0x12aa36,null))['then'](function(_0x46bd68){if(_0x46bd68&&_0x46bd68[_0xba3d('0xc9')]){_0x152453=_0x46bd68[_0xba3d('0x3b')]({'plain':!![]});if(_0x152453[_0xba3d('0xc9')]&&_0x152453[_0xba3d('0xc9')]['Contacts'][_0xba3d('0x4b')]){return _0x152453[_0xba3d('0xc9')][_0xba3d('0x98')][0x0];}return db[_0xba3d('0x78')][_0xba3d('0x5b')](_[_0xba3d('0x9b')](_0x19b635['body'],{'firstName':_0x389a35,'mobile':_0x389a35,'phone':_0x389a35,'ListId':_0x152453['ListId']}));}})[_0xba3d('0x39')](handleEntityNotFound(_0x12aa36,null))[_0xba3d('0x39')](function(_0x1761dc){if(_0x1761dc){_0x500ded=_0x1761dc;return db[_0xba3d('0x9d')][_0xba3d('0x5a')]({'where':{'ContactId':_0x500ded['id'],'closed':![],'SmsAccountId':_0x152453['id']}})[_0xba3d('0x39')](function(_0xa426f){if(_0xa426f){return[_0xa426f,![]];}return db[_0xba3d('0x9d')][_0xba3d('0x5b')]({'UserId':_0x19b635['user']['id'],'ContactId':_0x500ded['id'],'SmsAccountId':_0x152453['id'],'phone':_0x389a35,'firstMsgDirection':_0xba3d('0xca'),'Messages':[_['merge'](_0x19b635[_0xba3d('0x5c')],{'read':![],'body':_0x19b635['body'][_0xba3d('0x5c')],'phone':_0x389a35,'SmsAccountId':_0x152453['id'],'UserId':_0x19b635[_0xba3d('0x5f')]['id'],'ContactId':_0x500ded['id']})]},{'include':[{'model':db[_0xba3d('0xa6')],'as':_0xba3d('0xcb')}]})[_0xba3d('0x39')](function(_0x766ff8){return[_0x766ff8,!![]];});});}})[_0xba3d('0x9e')](function(_0x1ae769,_0x2bdc0a){if(_0x2bdc0a){return _0x1ae769;}return db[_0xba3d('0xa6')][_0xba3d('0x5b')](_['merge'](_0x19b635[_0xba3d('0x5c')],{'read':![],'body':_0x19b635[_0xba3d('0x5c')][_0xba3d('0x5c')],'phone':_0x389a35,'SmsAccountId':_0x152453['id'],'SmsInteractionId':_0x1ae769['id'],'UserId':_0x19b635[_0xba3d('0x5f')]['id'],'ContactId':_0x500ded['id']}))[_0xba3d('0x39')](function(_0x2a2e3e){_0x1ae769[_0xba3d('0xcc')][_0xba3d('0xcb')]=[];_0x1ae769[_0xba3d('0xcc')][_0xba3d('0xcb')][_0xba3d('0xa3')](_0x2a2e3e[_0xba3d('0xcc')]);return _0x1ae769;});})[_0xba3d('0x39')](respondWithResult(_0x12aa36,null))[_0xba3d('0x2b')](handleError(_0x12aa36,null));};exports[_0xba3d('0x2d')]=function(_0x5c7159,_0xc31a15,_0x5040c6){if(_0x5c7159[_0xba3d('0x5c')]['id']){delete _0x5c7159[_0xba3d('0x5c')]['id'];}var _0x2e1fc3,_0x59cd42,_0x596cf3;return db[_0xba3d('0x53')][_0xba3d('0x5a')]({'where':{'id':_0x5c7159[_0xba3d('0x58')]['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0xc31a15,null))[_0xba3d('0x39')](function(_0x37a15e){if(_0x37a15e){_0x596cf3=_0x37a15e;logger[_0xba3d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x37a15e[_0xba3d('0x42')],util[_0xba3d('0xcd')](_0x5c7159['body'],{'showHidden':![],'depth':null}));switch(_0x37a15e[_0xba3d('0x42')]){case'skebby':if(_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xce')]&&_0x5c7159[_0xba3d('0x5c')]['status']){_0x59cd42=_0x5c7159[_0xba3d('0x5c')][_0xba3d('0x2d')];return db['SmsMessage'][_0xba3d('0x5a')]({'where':{'messageId':_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xce')]}});}break;case _0xba3d('0x85'):if(_0x5c7159['body'][_0xba3d('0xcf')]&&_0x5c7159['body'][_0xba3d('0xd0')]){_0x59cd42=_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xd0')];return db['SmsMessage'][_0xba3d('0x5a')]({'where':{'messageId':_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xcf')]}});}break;case _0xba3d('0xd1'):if(_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xd2')]&&_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xd3')]){_0x59cd42=_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xd3')];return db[_0xba3d('0xa6')][_0xba3d('0x5a')]({'where':{'messageId':_0x5c7159['body']['message_id']}});}break;case'infobip':var _0x1689cc=_0x5c7159[_0xba3d('0x5c')][_0xba3d('0x88')][0x0];if(_0x1689cc['messageId']&&_0x1689cc[_0xba3d('0x2d')]['groupName']==='DELIVERED'){_0x59cd42=_0x1689cc[_0xba3d('0x2d')][_0xba3d('0xd4')];return db[_0xba3d('0xa6')][_0xba3d('0x5a')]({'where':{'messageId':_0x1689cc[_0xba3d('0x86')]}});}break;case _0xba3d('0x8b'):if(_0x5c7159[_0xba3d('0x5c')]['messageId']&&_0x5c7159[_0xba3d('0x5c')][_0xba3d('0x2d')]){_0x59cd42=_0x5c7159[_0xba3d('0x5c')][_0xba3d('0x2d')];return db[_0xba3d('0xa6')][_0xba3d('0x5a')]({'where':{'messageId':_0x5c7159[_0xba3d('0x5c')]['messageId']}});}break;case'bandwidth':if(_0x5c7159[_0xba3d('0x5c')][0x0]['message']['id']){_0x59cd42=_0x5c7159[_0xba3d('0x5c')][0x0]['type'];return db['SmsMessage']['find']({'where':{'messageId':_0x5c7159[_0xba3d('0x5c')][0x0][_0xba3d('0x29')]['id']}});}break;case _0xba3d('0x8f'):if(_0x5c7159['body'][_0xba3d('0xd5')]&&_0x5c7159[_0xba3d('0x5c')][_0xba3d('0x2d')]){_0x59cd42=_0x5c7159[_0xba3d('0x5c')][_0xba3d('0x2d')];return db[_0xba3d('0xa6')][_0xba3d('0x5a')]({'where':{'messageId':_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0xc31a15,null))[_0xba3d('0x39')](function(_0x505906){if(_0x505906){_0x2e1fc3=_0x505906;switch(_0x596cf3[_0xba3d('0x42')]){case _0xba3d('0xd6'):if(_0x59cd42===_0xba3d('0xd7')){return _0x2e1fc3[_0xba3d('0x38')]({'read':!![]});}else{logger[_0xba3d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xba3d('0x2d'),_0xba3d('0xd6'),util[_0xba3d('0xcd')](_0x5c7159[_0xba3d('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xba3d('0x85'):if(_0x59cd42==='1'){return _0x2e1fc3[_0xba3d('0x38')]({'read':!![]});}else{logger[_0xba3d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xba3d('0x2d'),'skebby',util[_0xba3d('0xcd')](_0x5c7159['body'],{'showHidden':![],'depth':null}));}break;case _0xba3d('0xd1'):if(!_0x5c7159[_0xba3d('0x5c')][_0xba3d('0xd8')]&&_0x59cd42>=0xc8&&_0x59cd42<=0xce){return _0x2e1fc3[_0xba3d('0x38')]({'read':!![]});}else{logger[_0xba3d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util['inspect'](_0x5c7159['body'],{'showHidden':![],'depth':null}));}break;case _0xba3d('0xd9'):var _0x590572=_0x5c7159['body'][_0xba3d('0x88')][0x0];if(_0x590572[_0xba3d('0x2d')]['groupName']===_0xba3d('0xd7')){return _0x2e1fc3['update']({'read':!![]});}else{logger['error'](_0xba3d('0xda'),_0xba3d('0x2d'),_0xba3d('0xd9'),util[_0xba3d('0xcd')](_0x5c7159[_0xba3d('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xba3d('0x8b'):if(_0x59cd42==_0xba3d('0xdb')||_0x59cd42==_0xba3d('0xdc')){return _0x2e1fc3[_0xba3d('0x38')]({'read':!![]});}else{logger[_0xba3d('0x28')](_0xba3d('0xda'),'status','clickatell',util[_0xba3d('0xcd')](_0x5c7159[_0xba3d('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xba3d('0x8e'):if(_0x59cd42==_0xba3d('0xdd')){return _0x2e1fc3[_0xba3d('0x38')]({'read':!![]});}else{logger['error'](_0xba3d('0xda'),_0xba3d('0x2d'),'bandwidth',util[_0xba3d('0xcd')](_0x5c7159[_0xba3d('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xba3d('0x8f'):if(_0x59cd42==='DELIVRD'||_0x59cd42===_0xba3d('0xde')){return _0x2e1fc3[_0xba3d('0x38')]({'read':!![]});}else{logger[_0xba3d('0x28')](_0xba3d('0xda'),_0xba3d('0x2d'),'intelepeer',util[_0xba3d('0xcd')](_0x5c7159[_0xba3d('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x2e1fc3;}})[_0xba3d('0x39')](respondWithResult(_0xc31a15,null))[_0xba3d('0x2b')](handleError(_0xc31a15,null));};exports[_0xba3d('0xdf')]=function(_0x1464c9,_0x5d02bf,_0x274691){var _0x35ced4,_0x40018c,_0x2aa34b;return db[_0xba3d('0x53')]['find']({'where':{'id':_0x1464c9[_0xba3d('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d02bf,null))[_0xba3d('0x39')](function(_0x53c3ff){if(_0x53c3ff){_0x2aa34b=_0x53c3ff;logger['debug'](_0xba3d('0xda'),_0xba3d('0x2d'),'received\x20delivery\x20report\x20from',_0x53c3ff[_0xba3d('0x42')],util[_0xba3d('0xcd')](_0x1464c9[_0xba3d('0x44')],{'showHidden':![],'depth':null}));switch(_0x53c3ff[_0xba3d('0x42')]){case _0xba3d('0x89'):if(_0x1464c9[_0xba3d('0x44')][_0xba3d('0xe0')]&&_0x1464c9[_0xba3d('0x44')][_0xba3d('0xe1')]){_0x40018c=_0x1464c9[_0xba3d('0x44')]['state'];return db['SmsMessage'][_0xba3d('0x5a')]({'where':{'messageId':_0x1464c9['query'][_0xba3d('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x5d02bf,null))[_0xba3d('0x39')](function(_0x348eba){if(_0x348eba){_0x35ced4=_0x348eba;switch(_0x2aa34b[_0xba3d('0x42')]){case _0xba3d('0x89'):if(_0x40018c==='2'||_0x40018c==='6'){return _0x35ced4[_0xba3d('0x38')]({'read':!![]});}else{logger[_0xba3d('0x28')](_0xba3d('0xda'),'status',_0xba3d('0x89'),util[_0xba3d('0xcd')](_0x1464c9[_0xba3d('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35ced4;}})[_0xba3d('0x39')](respondWithResult(_0x5d02bf,null))[_0xba3d('0x2b')](handleError(_0x5d02bf,null));};exports[_0xba3d('0xe2')]=function(_0x3406d4,_0x379b83,_0x101562){return db[_0xba3d('0x53')]['find']({'where':{'id':_0x3406d4['params']['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x379b83,null))['then'](function(_0xd0a5c9){if(_0xd0a5c9){return _0xd0a5c9[_0xba3d('0xe2')](_0x3406d4[_0xba3d('0x5c')][_0xba3d('0x6c')],_['omit'](_0x3406d4[_0xba3d('0x5c')],[_0xba3d('0x6c'),'id'])||{})[_0xba3d('0x9e')](function(_0x53348a){for(var _0x579782=0x0;_0x579782<_0x3406d4[_0xba3d('0x5c')][_0xba3d('0x6c')][_0xba3d('0x4b')];_0x579782+=0x1){socket['emit'](_0xba3d('0xe3'),{'UserId':Number(_0x3406d4['body'][_0xba3d('0x6c')][_0x579782]),'SmsAccountId':Number(_0x3406d4[_0xba3d('0x58')]['id'])});}return _0x53348a;});}})[_0xba3d('0x39')](respondWithResult(_0x379b83,null))['catch'](handleError(_0x379b83,null));};exports[_0xba3d('0xe4')]=function(_0x4a653b,_0x183485,_0x16866c){return db[_0xba3d('0x53')][_0xba3d('0x5a')]({'where':{'id':_0x4a653b[_0xba3d('0x58')]['id']}})['then'](handleEntityNotFound(_0x183485,null))[_0xba3d('0x39')](function(_0x7ab766){if(_0x7ab766){return _0x7ab766['removeAgents'](_0x4a653b[_0xba3d('0x44')][_0xba3d('0x6c')])[_0xba3d('0x39')](function(){if(_[_0xba3d('0xe5')](_0x4a653b['query'][_0xba3d('0x6c')])){for(var _0xcc43c9=0x0;_0xcc43c9<_0x4a653b[_0xba3d('0x44')]['ids']['length'];_0xcc43c9+=0x1){socket[_0xba3d('0xe6')](_0xba3d('0xe7'),{'UserId':Number(_0x4a653b[_0xba3d('0x44')][_0xba3d('0x6c')][_0xcc43c9]),'SmsAccountId':Number(_0x4a653b[_0xba3d('0x58')]['id'])});}}else{socket[_0xba3d('0xe6')](_0xba3d('0xe7'),{'UserId':Number(_0x4a653b['query'][_0xba3d('0x6c')]),'SmsAccountId':Number(_0x4a653b[_0xba3d('0x58')]['id'])});}});}})[_0xba3d('0x39')](respondWithStatusCode(_0x183485,null))[_0xba3d('0x2b')](handleError(_0x183485,null));};exports[_0xba3d('0xe8')]=function(_0x7ddcd,_0x55c780,_0x530115){var _0x34b743={};var _0x45697f={};var _0x4d8721;var _0x3954a3;return db[_0xba3d('0x53')][_0xba3d('0x68')]({'where':{'id':_0x7ddcd[_0xba3d('0x58')]['id']}})[_0xba3d('0x39')](handleEntityNotFound(_0x55c780,null))[_0xba3d('0x39')](function(_0x38929b){if(_0x38929b){_0x4d8721=_0x38929b;_0x45697f[_0xba3d('0x49')]=_['keys'](db[_0xba3d('0xaa')][_0xba3d('0x41')]);_0x45697f[_0xba3d('0x44')]=_[_0xba3d('0x45')](_0x7ddcd[_0xba3d('0x44')]);_0x45697f[_0xba3d('0x46')]=_[_0xba3d('0x48')](_0x45697f[_0xba3d('0x49')],_0x45697f[_0xba3d('0x44')]);_0x34b743[_0xba3d('0x47')]=_['intersection'](_0x45697f['model'],qs[_0xba3d('0x4a')](_0x7ddcd[_0xba3d('0x44')][_0xba3d('0x4a')]));_0x34b743['attributes']=_0x34b743['attributes']['length']?_0x34b743[_0xba3d('0x47')]:_0x45697f[_0xba3d('0x49')];_0x34b743[_0xba3d('0x4d')]=qs['sort'](_0x7ddcd[_0xba3d('0x44')]['sort']);_0x34b743['where']=qs['filters'](_['pick'](_0x7ddcd[_0xba3d('0x44')],_0x45697f[_0xba3d('0x46')]));if(_0x7ddcd[_0xba3d('0x44')]['filter']){_0x34b743[_0xba3d('0x4f')]=_[_0xba3d('0x50')](_0x34b743[_0xba3d('0x4f')],{'$or':_[_0xba3d('0x40')](_0x34b743[_0xba3d('0x47')],function(_0x4e53f5){var _0x973a36={};_0x973a36[_0x4e53f5]={'$like':'%'+_0x7ddcd[_0xba3d('0x44')][_0xba3d('0x51')]+'%'};return _0x973a36;})});}_0x34b743=_['merge']({},_0x34b743,_0x7ddcd[_0xba3d('0x52')]);return _0x4d8721[_0xba3d('0xe8')](_0x34b743);}})[_0xba3d('0x39')](function(_0x54fcc9){if(_0x54fcc9){_0x3954a3=_0x54fcc9[_0xba3d('0x4b')];if(!_0x7ddcd[_0xba3d('0x44')][_0xba3d('0x70')](_0xba3d('0x4c'))){_0x34b743[_0xba3d('0x33')]=qs[_0xba3d('0x33')](_0x7ddcd[_0xba3d('0x44')][_0xba3d('0x33')]);_0x34b743[_0xba3d('0x30')]=qs[_0xba3d('0x30')](_0x7ddcd['query']['offset']);}return _0x4d8721[_0xba3d('0xe8')](_0x34b743);}})[_0xba3d('0x39')](function(_0x2300dc){if(_0x2300dc){return _0x2300dc?{'count':_0x3954a3,'rows':_0x2300dc}:null;}})[_0xba3d('0x39')](respondWithResult(_0x55c780,null))[_0xba3d('0x2b')](handleError(_0x55c780,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 53ffa75..77fc603 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 _0x56eb=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x46c3d3,_0x53e62e){var _0x50cffd=function(_0x21e66f){while(--_0x21e66f){_0x46c3d3['push'](_0x46c3d3['shift']());}};_0x50cffd(++_0x53e62e);}(_0x56eb,0x11a));var _0xb56e=function(_0x33c410,_0x471df8){_0x33c410=_0x33c410-0x0;var _0x1d1dbc=_0x56eb[_0x33c410];return _0x1d1dbc;};'use strict';var EventEmitter=require(_0xb56e('0x0'));var SmsAccount=require(_0xb56e('0x1'))['db'][_0xb56e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb56e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb56e('0x4'),'afterDestroy':_0xb56e('0x5')};function emitEvent(_0x3e7c95){return function(_0x4d7b6,_0xca636c,_0x241608){SmsAccountEvents[_0xb56e('0x6')](_0x3e7c95+':'+_0x4d7b6['id'],_0x4d7b6);SmsAccountEvents[_0xb56e('0x6')](_0x3e7c95,_0x4d7b6);_0x241608(null);};}for(var e in events){if(events[_0xb56e('0x7')](e)){var event=events[e];SmsAccount[_0xb56e('0x8')](e,emitEvent(event));}}module[_0xb56e('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x4513=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','save','update'];(function(_0x259cad,_0x3dae11){var _0x4e6a68=function(_0x1669dc){while(--_0x1669dc){_0x259cad['push'](_0x259cad['shift']());}};_0x4e6a68(++_0x3dae11);}(_0x4513,0x112));var _0x3451=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4513[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x3451('0x0'));var SmsAccount=require(_0x3451('0x1'))['db'][_0x3451('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3451('0x3'),'afterUpdate':_0x3451('0x4'),'afterDestroy':_0x3451('0x5')};function emitEvent(_0x4dd78a){return function(_0x534c74,_0x504ab6,_0xc1cb76){SmsAccountEvents[_0x3451('0x6')](_0x4dd78a+':'+_0x534c74['id'],_0x534c74);SmsAccountEvents['emit'](_0x4dd78a,_0x534c74);_0xc1cb76(null);};}for(var e in events){if(events[_0x3451('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3451('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6257c86..652b207 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 _0x0058=['lodash','../../config/logger','moment','request-promise','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0058,0x1ae));var _0x8005=function(_0x4cefdc,_0x20dbbc){_0x4cefdc=_0x4cefdc-0x0;var _0x26d959=_0x0058[_0x4cefdc];return _0x26d959;};'use strict';var _=require(_0x8005('0x0'));var util=require('util');var logger=require(_0x8005('0x1'))('api');var moment=require(_0x8005('0x2'));var BPromise=require('bluebird');var rp=require(_0x8005('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8005('0x4'));var attributes=require(_0x8005('0x5'));module[_0x8005('0x6')]=function(_0x42eaa8,_0x311eea){return _0x42eaa8[_0x8005('0x7')](_0x8005('0x8'),attributes,{'tableName':_0x8005('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e28=['sms_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x52ea8e,_0xe42146){var _0x223296=function(_0x2bacfe){while(--_0x2bacfe){_0x52ea8e['push'](_0x52ea8e['shift']());}};_0x223296(++_0xe42146);}(_0x2e28,0x6f));var _0x82e2=function(_0x300ba2,_0xe84fce){_0x300ba2=_0x300ba2-0x0;var _0x4c780d=_0x2e28[_0x300ba2];return _0x4c780d;};'use strict';var _=require(_0x82e2('0x0'));var util=require(_0x82e2('0x1'));var logger=require('../../config/logger')(_0x82e2('0x2'));var moment=require(_0x82e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x82e2('0x4'));var fs=require('fs');var path=require(_0x82e2('0x5'));var rimraf=require(_0x82e2('0x6'));var config=require(_0x82e2('0x7'));var attributes=require(_0x82e2('0x8'));module[_0x82e2('0x9')]=function(_0x252617,_0x5142ff){return _0x252617['define']('SmsAccount',attributes,{'tableName':_0x82e2('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 e5103a6..57de80c 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 _0x8506=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','catch'];(function(_0x546882,_0x44155d){var _0x29c388=function(_0x10d7da){while(--_0x10d7da){_0x546882['push'](_0x546882['shift']());}};_0x29c388(++_0x44155d);}(_0x8506,0x1d4));var _0x6850=function(_0x133535,_0x47defd){_0x133535=_0x133535-0x0;var _0x30201a=_0x8506[_0x133535];return _0x30201a;};'use strict';var _=require(_0x6850('0x0'));var util=require(_0x6850('0x1'));var moment=require(_0x6850('0x2'));var BPromise=require(_0x6850('0x3'));var rs=require(_0x6850('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6850('0x5'))['db'];var utils=require(_0x6850('0x6'));var logger=require('../../config/logger')(_0x6850('0x7'));var config=require(_0x6850('0x8'));var jayson=require(_0x6850('0x9'));var client=jayson[_0x6850('0xa')][_0x6850('0xb')]({'port':0x232a});config[_0x6850('0xc')]=_[_0x6850('0xd')](config[_0x6850('0xc')],{'host':_0x6850('0xe'),'port':0x18eb});var socket=require(_0x6850('0xf'))(new Redis(config[_0x6850('0xc')]));require('./smsAccount.socket')[_0x6850('0x10')](socket);function respondWithRpcPromise(_0x309ad9,_0x2cbbe4,_0x3526e8){return new BPromise(function(_0xe02b04,_0x457276){return client['request'](_0x309ad9,_0x3526e8)[_0x6850('0x11')](function(_0x45cce8){logger[_0x6850('0x12')](_0x6850('0x13'),_0x2cbbe4,_0x6850('0x14'));logger[_0x6850('0x15')](_0x6850('0x16'),_0x2cbbe4,_0x6850('0x14'),JSON[_0x6850('0x17')](_0x45cce8));if(_0x45cce8[_0x6850('0x18')]){if(_0x45cce8[_0x6850('0x18')]['code']===0x1f4){logger[_0x6850('0x18')](_0x6850('0x13'),_0x2cbbe4,_0x45cce8[_0x6850('0x18')][_0x6850('0x19')]);return _0x457276(_0x45cce8[_0x6850('0x18')][_0x6850('0x19')]);}logger[_0x6850('0x18')](_0x6850('0x13'),_0x2cbbe4,_0x45cce8['error'][_0x6850('0x19')]);return _0xe02b04(_0x45cce8['error'][_0x6850('0x19')]);}else{logger['info'](_0x6850('0x13'),_0x2cbbe4,_0x6850('0x14'));_0xe02b04(_0x45cce8['result']['message']);}})['catch'](function(_0x10ea95){logger['error'](_0x6850('0x13'),_0x2cbbe4,_0x10ea95);_0x457276(_0x10ea95);});});}exports['ShowSmsAccount']=function(_0x1ac683){var _0xd11247=this;return new Promise(function(_0x458aeb,_0x3ef644){return db[_0x6850('0x1a')]['find']({'raw':_0x1ac683[_0x6850('0x1b')]?_0x1ac683['options'][_0x6850('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ac683[_0x6850('0x1b')]?_0x1ac683['options'][_0x6850('0x1d')]||null:null,'attributes':_0x1ac683[_0x6850('0x1b')]?_0x1ac683[_0x6850('0x1b')][_0x6850('0x1e')]||null:null,'include':_0x1ac683['options']?_0x1ac683[_0x6850('0x1b')][_0x6850('0x1f')]?_[_0x6850('0x20')](_0x1ac683[_0x6850('0x1b')][_0x6850('0x1f')],function(_0x1218c9){return{'model':db[_0x1218c9[_0x6850('0x21')]],'as':_0x1218c9['as'],'attributes':_0x1218c9[_0x6850('0x1e')],'include':_0x1218c9[_0x6850('0x1f')]?_[_0x6850('0x20')](_0x1218c9[_0x6850('0x1f')],function(_0x39d6eb){return{'model':db[_0x39d6eb[_0x6850('0x21')]],'as':_0x39d6eb['as'],'attributes':_0x39d6eb[_0x6850('0x1e')],'include':_0x39d6eb[_0x6850('0x1f')]?_[_0x6850('0x20')](_0x39d6eb[_0x6850('0x1f')],function(_0x521995){return{'model':db[_0x521995[_0x6850('0x21')]],'as':_0x521995['as'],'attributes':_0x521995[_0x6850('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6850('0x11')](function(_0x4d4a59){logger['info'](_0x6850('0x22'),_0x1ac683);logger[_0x6850('0x15')](_0x6850('0x22'),_0x1ac683,JSON[_0x6850('0x17')](_0x4d4a59));_0x458aeb(_0x4d4a59);})[_0x6850('0x23')](function(_0x44dc5e){logger['error']('ShowSmsAccount',_0x44dc5e['message'],_0x1ac683);_0x3ef644(_0xd11247[_0x6850('0x18')](0x1f4,_0x44dc5e[_0x6850('0x19')]));});});}; \ No newline at end of file +var _0x0515=['result','catch','SmsAccount','options','raw','attributes','map','include','model','ShowSmsAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsAccount.socket','register','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info'];(function(_0x3fae64,_0x232229){var _0x2c2f5b=function(_0x501d8a){while(--_0x501d8a){_0x3fae64['push'](_0x3fae64['shift']());}};_0x2c2f5b(++_0x232229);}(_0x0515,0xe8));var _0x5051=function(_0x5ea79d,_0x2b6657){_0x5ea79d=_0x5ea79d-0x0;var _0x3c2b27=_0x0515[_0x5ea79d];return _0x3c2b27;};'use strict';var _=require(_0x5051('0x0'));var util=require('util');var moment=require(_0x5051('0x1'));var BPromise=require(_0x5051('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5051('0x3'));var db=require(_0x5051('0x4'))['db'];var utils=require(_0x5051('0x5'));var logger=require(_0x5051('0x6'))(_0x5051('0x7'));var config=require(_0x5051('0x8'));var jayson=require(_0x5051('0x9'));var client=jayson[_0x5051('0xa')]['http']({'port':0x232a});config[_0x5051('0xb')]=_[_0x5051('0xc')](config[_0x5051('0xb')],{'host':_0x5051('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5051('0xb')]));require(_0x5051('0xe'))[_0x5051('0xf')](socket);function respondWithRpcPromise(_0x8ba117,_0x2de75e,_0x171e14){return new BPromise(function(_0x216007,_0x322bd1){return client[_0x5051('0x10')](_0x8ba117,_0x171e14)[_0x5051('0x11')](function(_0x21d880){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2de75e,_0x5051('0x12'));logger[_0x5051('0x13')](_0x5051('0x14'),_0x2de75e,_0x5051('0x12'),JSON[_0x5051('0x15')](_0x21d880));if(_0x21d880[_0x5051('0x16')]){if(_0x21d880[_0x5051('0x16')][_0x5051('0x17')]===0x1f4){logger[_0x5051('0x16')](_0x5051('0x18'),_0x2de75e,_0x21d880[_0x5051('0x16')]['message']);return _0x322bd1(_0x21d880['error'][_0x5051('0x19')]);}logger[_0x5051('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2de75e,_0x21d880[_0x5051('0x16')][_0x5051('0x19')]);return _0x216007(_0x21d880[_0x5051('0x16')]['message']);}else{logger[_0x5051('0x1a')]('SmsAccount,\x20%s,\x20%s',_0x2de75e,_0x5051('0x12'));_0x216007(_0x21d880[_0x5051('0x1b')][_0x5051('0x19')]);}})[_0x5051('0x1c')](function(_0x45999e){logger[_0x5051('0x16')](_0x5051('0x18'),_0x2de75e,_0x45999e);_0x322bd1(_0x45999e);});});}exports['ShowSmsAccount']=function(_0x9fa8cc){var _0x5645a2=this;return new Promise(function(_0x3b03df,_0x18e446){return db[_0x5051('0x1d')]['find']({'raw':_0x9fa8cc['options']?_0x9fa8cc[_0x5051('0x1e')][_0x5051('0x1f')]===undefined?!![]:![]:!![],'where':_0x9fa8cc[_0x5051('0x1e')]?_0x9fa8cc[_0x5051('0x1e')]['where']||null:null,'attributes':_0x9fa8cc['options']?_0x9fa8cc[_0x5051('0x1e')][_0x5051('0x20')]||null:null,'include':_0x9fa8cc[_0x5051('0x1e')]?_0x9fa8cc[_0x5051('0x1e')]['include']?_[_0x5051('0x21')](_0x9fa8cc[_0x5051('0x1e')][_0x5051('0x22')],function(_0x2c8005){return{'model':db[_0x2c8005[_0x5051('0x23')]],'as':_0x2c8005['as'],'attributes':_0x2c8005['attributes'],'include':_0x2c8005[_0x5051('0x22')]?_[_0x5051('0x21')](_0x2c8005[_0x5051('0x22')],function(_0x2891d9){return{'model':db[_0x2891d9[_0x5051('0x23')]],'as':_0x2891d9['as'],'attributes':_0x2891d9[_0x5051('0x20')],'include':_0x2891d9[_0x5051('0x22')]?_['map'](_0x2891d9['include'],function(_0x2d5d66){return{'model':db[_0x2d5d66[_0x5051('0x23')]],'as':_0x2d5d66['as'],'attributes':_0x2d5d66[_0x5051('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5051('0x11')](function(_0x499105){logger['info']('ShowSmsAccount',_0x9fa8cc);logger[_0x5051('0x13')](_0x5051('0x24'),_0x9fa8cc,JSON[_0x5051('0x15')](_0x499105));_0x3b03df(_0x499105);})[_0x5051('0x1c')](function(_0x59f81c){logger['error'](_0x5051('0x24'),_0x59f81c[_0x5051('0x19')],_0x9fa8cc);_0x18e446(_0x5645a2[_0x5051('0x16')](0x1f4,_0x59f81c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index fc75e06..cbcc55a 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 754845a..45c9668 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x473d12,_0x1e2381){var _0x46fb24=function(_0x5a53eb){while(--_0x5a53eb){_0x473d12['push'](_0x473d12['shift']());}};_0x46fb24(++_0x1e2381);}(_0xedd9,0xfc));var _0x9edd=function(_0x3929a2,_0x2a6002){_0x3929a2=_0x3929a2-0x0;var _0x23f137=_0xedd9[_0x3929a2];return _0x23f137;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x548ed2,_0x36e39c){var _0x4a4b37=function(_0x10bda5){while(--_0x10bda5){_0x548ed2['push'](_0x548ed2['shift']());}};_0x4a4b37(++_0x36e39c);}(_0xe14b,0x93));var _0xbe14=function(_0x50e1f1,_0x299510){_0x50e1f1=_0x50e1f1-0x0;var _0x31c87b=_0xe14b[_0x50e1f1];return _0x31c87b;};'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['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 34b9375..0148ce2 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 _0x8c4d=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0x8c4d,0x1f1));var _0xd8c4=function(_0x2ecea0,_0x36a83d){_0x2ecea0=_0x2ecea0-0x0;var _0x17ab22=_0x8c4d[_0x2ecea0];return _0x17ab22;};'use strict';var Sequelize=require(_0xd8c4('0x0'));module[_0xd8c4('0x1')]={'priority':{'type':Sequelize[_0xd8c4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd8c4('0x3')],'allowNull':![],'defaultValue':_0xd8c4('0x4')},'appdata':{'type':Sequelize[_0xd8c4('0x5')]()},'description':{'type':Sequelize[_0xd8c4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd8c4('0x6')}}; \ No newline at end of file +var _0x3267=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x24940f,_0x5873d2){var _0x4fb981=function(_0x5ab033){while(--_0x5ab033){_0x24940f['push'](_0x24940f['shift']());}};_0x4fb981(++_0x5873d2);}(_0x3267,0x1b5));var _0x7326=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x3267[_0xfd9b19];return _0x514918;};'use strict';var Sequelize=require(_0x7326('0x0'));module[_0x7326('0x1')]={'priority':{'type':Sequelize[_0x7326('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7326('0x3')],'allowNull':![],'defaultValue':_0x7326('0x4')},'appdata':{'type':Sequelize[_0x7326('0x5')]()},'description':{'type':Sequelize[_0x7326('0x3')]},'interval':{'type':Sequelize[_0x7326('0x3')],'defaultValue':_0x7326('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 804ae7e..57ac33b 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 _0xb1ca=['intersection','length','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','show','params'];(function(_0x238540,_0x135ede){var _0x9bc21a=function(_0x468b41){while(--_0x468b41){_0x238540['push'](_0x238540['shift']());}};_0x9bc21a(++_0x135ede);}(_0xb1ca,0x17f));var _0xab1c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb1ca[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0xab1c('0x0'));var rimraf=require(_0xab1c('0x1'));var zipdir=require(_0xab1c('0x2'));var jsonpatch=require(_0xab1c('0x3'));var rp=require(_0xab1c('0x4'));var moment=require(_0xab1c('0x5'));var BPromise=require(_0xab1c('0x6'));var Mustache=require('mustache');var util=require(_0xab1c('0x7'));var path=require(_0xab1c('0x8'));var sox=require(_0xab1c('0x9'));var csv=require(_0xab1c('0xa'));var ejs=require(_0xab1c('0xb'));var fs=require('fs');var fs_extra=require(_0xab1c('0xc'));var _=require(_0xab1c('0xd'));var squel=require('squel');var crypto=require(_0xab1c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xab1c('0xf'));var toCsv=require(_0xab1c('0xa'));var querystring=require(_0xab1c('0x10'));var Papa=require(_0xab1c('0x11'));var Redis=require(_0xab1c('0x12'));var authService=require(_0xab1c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab1c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xab1c('0x15'));var config=require(_0xab1c('0x16'));var licenseUtil=require(_0xab1c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x72db7,_0x45413a){_0x45413a=_0x45413a||0xcc;return function(_0x4a4339){if(_0x4a4339){return _0x72db7[_0xab1c('0x18')](_0x45413a);}return _0x72db7[_0xab1c('0x19')](_0x45413a)[_0xab1c('0x1a')]();};}function respondWithResult(_0x556d7a,_0x3e9fd7){_0x3e9fd7=_0x3e9fd7||0xc8;return function(_0x45bdd8){if(_0x45bdd8){return _0x556d7a[_0xab1c('0x19')](_0x3e9fd7)['json'](_0x45bdd8);}};}function respondWithFilteredResult(_0x5c2c28,_0x4725d8){return function(_0x2730d1){if(_0x2730d1){var _0x1ef89a=typeof _0x4725d8[_0xab1c('0x1b')]===_0xab1c('0x1c')&&typeof _0x4725d8[_0xab1c('0x1d')]===_0xab1c('0x1c');var _0x2830f6=_0x2730d1['count'];var _0x79e136=_0x1ef89a?0x0:_0x4725d8[_0xab1c('0x1b')];var _0xcaa6d2=_0x1ef89a?_0x2730d1[_0xab1c('0x1e')]:_0x4725d8[_0xab1c('0x1b')]+_0x4725d8['limit'];var _0x4b5c06;if(_0xcaa6d2>=_0x2830f6){_0xcaa6d2=_0x2830f6;_0x4b5c06=0xc8;}else{_0x4b5c06=0xce;}_0x5c2c28[_0xab1c('0x19')](_0x4b5c06);return _0x5c2c28['set']('Content-Range',_0x79e136+'-'+_0xcaa6d2+'/'+_0x2830f6)[_0xab1c('0x1f')](_0x2730d1);}return null;};}function patchUpdates(_0x14b45a){return function(_0x231864){try{jsonpatch[_0xab1c('0x20')](_0x231864,_0x14b45a,!![]);}catch(_0x21c37d){return BPromise[_0xab1c('0x21')](_0x21c37d);}return _0x231864[_0xab1c('0x22')]();};}function saveUpdates(_0x11b8b5,_0x144b83){return function(_0x3afa52){if(_0x3afa52){return _0x3afa52[_0xab1c('0x23')](_0x11b8b5)[_0xab1c('0x24')](function(_0x449cbb){return _0x449cbb;});}return null;};}function removeEntity(_0x58ee61,_0x12aed0){return function(_0x514abe){if(_0x514abe){return _0x514abe['destroy']()[_0xab1c('0x24')](function(){_0x58ee61[_0xab1c('0x19')](0xcc)[_0xab1c('0x1a')]();});}};}function handleEntityNotFound(_0x5a8eb0,_0x55c887){return function(_0x877b62){if(!_0x877b62){_0x5a8eb0[_0xab1c('0x18')](0x194);}return _0x877b62;};}function handleError(_0x2a7fce,_0x4e43b5){_0x4e43b5=_0x4e43b5||0x1f4;return function(_0x21092c){logger[_0xab1c('0x25')](_0x21092c[_0xab1c('0x26')]);if(_0x21092c['name']){delete _0x21092c[_0xab1c('0x27')];}_0x2a7fce[_0xab1c('0x19')](_0x4e43b5)['send'](_0x21092c);};}exports[_0xab1c('0x28')]=function(_0x1deff5,_0x33de06){var _0x23ef0b={},_0x37be2f={},_0x243601={'count':0x0,'rows':[]};var _0x3590b8=_[_0xab1c('0x29')](db[_0xab1c('0x2a')][_0xab1c('0x2b')],function(_0x14c4dc){return{'name':_0x14c4dc[_0xab1c('0x2c')],'type':_0x14c4dc[_0xab1c('0x2d')][_0xab1c('0x2e')]};});_0x37be2f[_0xab1c('0x2f')]=_[_0xab1c('0x29')](_0x3590b8,'name');_0x37be2f[_0xab1c('0x30')]=_[_0xab1c('0x31')](_0x1deff5[_0xab1c('0x30')]);_0x37be2f[_0xab1c('0x32')]=_['intersection'](_0x37be2f[_0xab1c('0x2f')],_0x37be2f[_0xab1c('0x30')]);_0x23ef0b['attributes']=_['intersection'](_0x37be2f['model'],qs[_0xab1c('0x33')](_0x1deff5[_0xab1c('0x30')][_0xab1c('0x33')]));_0x23ef0b[_0xab1c('0x34')]=_0x23ef0b[_0xab1c('0x34')]['length']?_0x23ef0b[_0xab1c('0x34')]:_0x37be2f[_0xab1c('0x2f')];if(!_0x1deff5[_0xab1c('0x30')][_0xab1c('0x35')](_0xab1c('0x36'))){_0x23ef0b[_0xab1c('0x1d')]=qs[_0xab1c('0x1d')](_0x1deff5[_0xab1c('0x30')][_0xab1c('0x1d')]);_0x23ef0b[_0xab1c('0x1b')]=qs['offset'](_0x1deff5[_0xab1c('0x30')][_0xab1c('0x1b')]);}_0x23ef0b[_0xab1c('0x37')]=qs[_0xab1c('0x38')](_0x1deff5['query']['sort']);_0x23ef0b['where']=qs[_0xab1c('0x32')](_[_0xab1c('0x39')](_0x1deff5[_0xab1c('0x30')],_0x37be2f[_0xab1c('0x32')]),_0x3590b8);if(_0x1deff5['query'][_0xab1c('0x3a')]){_0x23ef0b[_0xab1c('0x3b')]=_[_0xab1c('0x3c')](_0x23ef0b[_0xab1c('0x3b')],{'$or':_[_0xab1c('0x29')](_0x3590b8,function(_0x4a9283){if(_0x4a9283[_0xab1c('0x2d')]!=='VIRTUAL'){var _0x146b1e={};_0x146b1e[_0x4a9283[_0xab1c('0x27')]]={'$like':'%'+_0x1deff5[_0xab1c('0x30')][_0xab1c('0x3a')]+'%'};return _0x146b1e;}})});}_0x23ef0b=_[_0xab1c('0x3c')]({},_0x23ef0b,_0x1deff5['options']);var _0x20f9de={'where':_0x23ef0b[_0xab1c('0x3b')]};return db[_0xab1c('0x2a')][_0xab1c('0x1e')](_0x20f9de)[_0xab1c('0x24')](function(_0x54cac5){_0x243601[_0xab1c('0x1e')]=_0x54cac5;if(_0x1deff5[_0xab1c('0x30')]['includeAll']){_0x23ef0b[_0xab1c('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0xab1c('0x3e')](_0x23ef0b);})[_0xab1c('0x24')](function(_0x1b9218){_0x243601[_0xab1c('0x3f')]=_0x1b9218;return _0x243601;})[_0xab1c('0x24')](respondWithFilteredResult(_0x33de06,_0x23ef0b))[_0xab1c('0x40')](handleError(_0x33de06,null));};exports[_0xab1c('0x41')]=function(_0x423fb8,_0x2a5012){var _0x43da68={'raw':!![],'where':{'id':_0x423fb8[_0xab1c('0x42')]['id']}},_0x3d9feb={};_0x3d9feb[_0xab1c('0x2f')]=_[_0xab1c('0x31')](db[_0xab1c('0x2a')]['rawAttributes']);_0x3d9feb[_0xab1c('0x30')]=_[_0xab1c('0x31')](_0x423fb8[_0xab1c('0x30')]);_0x3d9feb[_0xab1c('0x32')]=_[_0xab1c('0x43')](_0x3d9feb[_0xab1c('0x2f')],_0x3d9feb[_0xab1c('0x30')]);_0x43da68[_0xab1c('0x34')]=_[_0xab1c('0x43')](_0x3d9feb['model'],qs[_0xab1c('0x33')](_0x423fb8[_0xab1c('0x30')][_0xab1c('0x33')]));_0x43da68[_0xab1c('0x34')]=_0x43da68['attributes'][_0xab1c('0x44')]?_0x43da68[_0xab1c('0x34')]:_0x3d9feb[_0xab1c('0x2f')];if(_0x423fb8[_0xab1c('0x30')][_0xab1c('0x45')]){_0x43da68[_0xab1c('0x3d')]=[{'all':!![]}];}_0x43da68=_[_0xab1c('0x3c')]({},_0x43da68,_0x423fb8[_0xab1c('0x46')]);return db[_0xab1c('0x2a')][_0xab1c('0x47')](_0x43da68)[_0xab1c('0x24')](handleEntityNotFound(_0x2a5012,null))[_0xab1c('0x24')](respondWithResult(_0x2a5012,null))[_0xab1c('0x40')](handleError(_0x2a5012,null));};exports[_0xab1c('0x48')]=function(_0x49a226,_0x1b069e){return db[_0xab1c('0x2a')]['create'](_0x49a226[_0xab1c('0x49')],{})[_0xab1c('0x24')](respondWithResult(_0x1b069e,0xc9))[_0xab1c('0x40')](handleError(_0x1b069e,null));};exports[_0xab1c('0x23')]=function(_0x1c0b29,_0x1950de){if(_0x1c0b29['body']['id']){delete _0x1c0b29[_0xab1c('0x49')]['id'];}return db[_0xab1c('0x2a')][_0xab1c('0x47')]({'where':{'id':_0x1c0b29[_0xab1c('0x42')]['id']}})[_0xab1c('0x24')](handleEntityNotFound(_0x1950de,null))['then'](saveUpdates(_0x1c0b29[_0xab1c('0x49')],null))['then'](respondWithResult(_0x1950de,null))[_0xab1c('0x40')](handleError(_0x1950de,null));};exports[_0xab1c('0x4a')]=function(_0x139058,_0x5d2499){return db[_0xab1c('0x2a')][_0xab1c('0x47')]({'where':{'id':_0x139058[_0xab1c('0x42')]['id']}})[_0xab1c('0x24')](handleEntityNotFound(_0x5d2499,null))[_0xab1c('0x24')](removeEntity(_0x5d2499,null))[_0xab1c('0x40')](handleError(_0x5d2499,null));}; \ No newline at end of file +var _0x5ab2=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','sendStatus','error','name','send','index','SmsApplication','fieldName','type','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce'];(function(_0x41037b,_0x1593b5){var _0xf1f5a3=function(_0x6df698){while(--_0x6df698){_0x41037b['push'](_0x41037b['shift']());}};_0xf1f5a3(++_0x1593b5);}(_0x5ab2,0x1f1));var _0x25ab=function(_0xc67d4,_0x1f3d6b){_0xc67d4=_0xc67d4-0x0;var _0x5434bf=_0x5ab2[_0xc67d4];return _0x5434bf;};'use strict';var emlformat=require(_0x25ab('0x0'));var rimraf=require(_0x25ab('0x1'));var zipdir=require(_0x25ab('0x2'));var jsonpatch=require(_0x25ab('0x3'));var rp=require(_0x25ab('0x4'));var moment=require(_0x25ab('0x5'));var BPromise=require(_0x25ab('0x6'));var Mustache=require(_0x25ab('0x7'));var util=require(_0x25ab('0x8'));var path=require('path');var sox=require(_0x25ab('0x9'));var csv=require(_0x25ab('0xa'));var ejs=require(_0x25ab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x25ab('0xc'));var jsforce=require(_0x25ab('0xd'));var deskjs=require(_0x25ab('0xe'));var toCsv=require(_0x25ab('0xa'));var querystring=require(_0x25ab('0xf'));var Papa=require(_0x25ab('0x10'));var Redis=require(_0x25ab('0x11'));var authService=require(_0x25ab('0x12'));var qs=require(_0x25ab('0x13'));var as=require(_0x25ab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25ab('0x15'))(_0x25ab('0x16'));var utils=require('../../config/utils');var config=require(_0x25ab('0x17'));var licenseUtil=require(_0x25ab('0x18'));var db=require(_0x25ab('0x19'))['db'];function respondWithStatusCode(_0x46f905,_0x2654c5){_0x2654c5=_0x2654c5||0xcc;return function(_0x229088){if(_0x229088){return _0x46f905['sendStatus'](_0x2654c5);}return _0x46f905[_0x25ab('0x1a')](_0x2654c5)[_0x25ab('0x1b')]();};}function respondWithResult(_0x58804c,_0x6704fa){_0x6704fa=_0x6704fa||0xc8;return function(_0x1e88df){if(_0x1e88df){return _0x58804c[_0x25ab('0x1a')](_0x6704fa)['json'](_0x1e88df);}};}function respondWithFilteredResult(_0x1f2f38,_0x21fc21){return function(_0x520a4d){if(_0x520a4d){var _0x5958e8=typeof _0x21fc21[_0x25ab('0x1c')]===_0x25ab('0x1d')&&typeof _0x21fc21[_0x25ab('0x1e')]===_0x25ab('0x1d');var _0x3ff144=_0x520a4d[_0x25ab('0x1f')];var _0x84d305=_0x5958e8?0x0:_0x21fc21['offset'];var _0x4d41d6=_0x5958e8?_0x520a4d[_0x25ab('0x1f')]:_0x21fc21[_0x25ab('0x1c')]+_0x21fc21[_0x25ab('0x1e')];var _0xf22fc2;if(_0x4d41d6>=_0x3ff144){_0x4d41d6=_0x3ff144;_0xf22fc2=0xc8;}else{_0xf22fc2=0xce;}_0x1f2f38[_0x25ab('0x1a')](_0xf22fc2);return _0x1f2f38[_0x25ab('0x20')]('Content-Range',_0x84d305+'-'+_0x4d41d6+'/'+_0x3ff144)[_0x25ab('0x21')](_0x520a4d);}return null;};}function patchUpdates(_0x2bffe1){return function(_0x2a6f8d){try{jsonpatch['apply'](_0x2a6f8d,_0x2bffe1,!![]);}catch(_0x439937){return BPromise[_0x25ab('0x22')](_0x439937);}return _0x2a6f8d[_0x25ab('0x23')]();};}function saveUpdates(_0x3f00f3,_0x43263e){return function(_0x212c0f){if(_0x212c0f){return _0x212c0f[_0x25ab('0x24')](_0x3f00f3)[_0x25ab('0x25')](function(_0x31e616){return _0x31e616;});}return null;};}function removeEntity(_0x3d9c26,_0x235d8f){return function(_0xe712f8){if(_0xe712f8){return _0xe712f8[_0x25ab('0x26')]()[_0x25ab('0x25')](function(){_0x3d9c26[_0x25ab('0x1a')](0xcc)[_0x25ab('0x1b')]();});}};}function handleEntityNotFound(_0x35611c,_0x833eed){return function(_0x234870){if(!_0x234870){_0x35611c[_0x25ab('0x27')](0x194);}return _0x234870;};}function handleError(_0x24799c,_0x20e7f5){_0x20e7f5=_0x20e7f5||0x1f4;return function(_0x1e6376){logger[_0x25ab('0x28')](_0x1e6376['stack']);if(_0x1e6376[_0x25ab('0x29')]){delete _0x1e6376[_0x25ab('0x29')];}_0x24799c[_0x25ab('0x1a')](_0x20e7f5)[_0x25ab('0x2a')](_0x1e6376);};}exports[_0x25ab('0x2b')]=function(_0x16e433,_0x3e9225){var _0x346fbe={},_0x8278c3={},_0x124974={'count':0x0,'rows':[]};var _0x1806b7=_['map'](db[_0x25ab('0x2c')]['rawAttributes'],function(_0x1b7a2b){return{'name':_0x1b7a2b[_0x25ab('0x2d')],'type':_0x1b7a2b[_0x25ab('0x2e')]['key']};});_0x8278c3[_0x25ab('0x2f')]=_[_0x25ab('0x30')](_0x1806b7,_0x25ab('0x29'));_0x8278c3['query']=_[_0x25ab('0x31')](_0x16e433[_0x25ab('0x32')]);_0x8278c3['filters']=_[_0x25ab('0x33')](_0x8278c3[_0x25ab('0x2f')],_0x8278c3[_0x25ab('0x32')]);_0x346fbe['attributes']=_[_0x25ab('0x33')](_0x8278c3[_0x25ab('0x2f')],qs[_0x25ab('0x34')](_0x16e433[_0x25ab('0x32')][_0x25ab('0x34')]));_0x346fbe[_0x25ab('0x35')]=_0x346fbe['attributes'][_0x25ab('0x36')]?_0x346fbe['attributes']:_0x8278c3[_0x25ab('0x2f')];if(!_0x16e433[_0x25ab('0x32')][_0x25ab('0x37')]('nolimit')){_0x346fbe[_0x25ab('0x1e')]=qs[_0x25ab('0x1e')](_0x16e433['query'][_0x25ab('0x1e')]);_0x346fbe[_0x25ab('0x1c')]=qs[_0x25ab('0x1c')](_0x16e433[_0x25ab('0x32')][_0x25ab('0x1c')]);}_0x346fbe[_0x25ab('0x38')]=qs['sort'](_0x16e433[_0x25ab('0x32')][_0x25ab('0x39')]);_0x346fbe['where']=qs[_0x25ab('0x3a')](_[_0x25ab('0x3b')](_0x16e433[_0x25ab('0x32')],_0x8278c3[_0x25ab('0x3a')]),_0x1806b7);if(_0x16e433[_0x25ab('0x32')][_0x25ab('0x3c')]){_0x346fbe[_0x25ab('0x3d')]=_[_0x25ab('0x3e')](_0x346fbe[_0x25ab('0x3d')],{'$or':_[_0x25ab('0x30')](_0x1806b7,function(_0x47669e){if(_0x47669e[_0x25ab('0x2e')]!==_0x25ab('0x3f')){var _0x21fda={};_0x21fda[_0x47669e[_0x25ab('0x29')]]={'$like':'%'+_0x16e433[_0x25ab('0x32')][_0x25ab('0x3c')]+'%'};return _0x21fda;}})});}_0x346fbe=_['merge']({},_0x346fbe,_0x16e433[_0x25ab('0x40')]);var _0x39324e={'where':_0x346fbe['where']};return db[_0x25ab('0x2c')][_0x25ab('0x1f')](_0x39324e)[_0x25ab('0x25')](function(_0x50041e){_0x124974[_0x25ab('0x1f')]=_0x50041e;if(_0x16e433[_0x25ab('0x32')]['includeAll']){_0x346fbe['include']=[{'all':!![]}];}return db[_0x25ab('0x2c')][_0x25ab('0x41')](_0x346fbe);})['then'](function(_0x40b935){_0x124974[_0x25ab('0x42')]=_0x40b935;return _0x124974;})[_0x25ab('0x25')](respondWithFilteredResult(_0x3e9225,_0x346fbe))[_0x25ab('0x43')](handleError(_0x3e9225,null));};exports[_0x25ab('0x44')]=function(_0x7c19e7,_0xa58e75){var _0x5e8570={'raw':!![],'where':{'id':_0x7c19e7[_0x25ab('0x45')]['id']}},_0x307392={};_0x307392[_0x25ab('0x2f')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x307392[_0x25ab('0x32')]=_['keys'](_0x7c19e7[_0x25ab('0x32')]);_0x307392[_0x25ab('0x3a')]=_[_0x25ab('0x33')](_0x307392['model'],_0x307392[_0x25ab('0x32')]);_0x5e8570[_0x25ab('0x35')]=_[_0x25ab('0x33')](_0x307392[_0x25ab('0x2f')],qs[_0x25ab('0x34')](_0x7c19e7[_0x25ab('0x32')][_0x25ab('0x34')]));_0x5e8570[_0x25ab('0x35')]=_0x5e8570[_0x25ab('0x35')][_0x25ab('0x36')]?_0x5e8570[_0x25ab('0x35')]:_0x307392[_0x25ab('0x2f')];if(_0x7c19e7[_0x25ab('0x32')][_0x25ab('0x46')]){_0x5e8570['include']=[{'all':!![]}];}_0x5e8570=_[_0x25ab('0x3e')]({},_0x5e8570,_0x7c19e7[_0x25ab('0x40')]);return db['SmsApplication'][_0x25ab('0x47')](_0x5e8570)['then'](handleEntityNotFound(_0xa58e75,null))[_0x25ab('0x25')](respondWithResult(_0xa58e75,null))[_0x25ab('0x43')](handleError(_0xa58e75,null));};exports['create']=function(_0x3c6f8c,_0x2c3cbf){return db[_0x25ab('0x2c')]['create'](_0x3c6f8c[_0x25ab('0x48')],{})[_0x25ab('0x25')](respondWithResult(_0x2c3cbf,0xc9))[_0x25ab('0x43')](handleError(_0x2c3cbf,null));};exports[_0x25ab('0x24')]=function(_0x5adf36,_0x3cae32){if(_0x5adf36['body']['id']){delete _0x5adf36[_0x25ab('0x48')]['id'];}return db[_0x25ab('0x2c')][_0x25ab('0x47')]({'where':{'id':_0x5adf36[_0x25ab('0x45')]['id']}})[_0x25ab('0x25')](handleEntityNotFound(_0x3cae32,null))['then'](saveUpdates(_0x5adf36[_0x25ab('0x48')],null))[_0x25ab('0x25')](respondWithResult(_0x3cae32,null))['catch'](handleError(_0x3cae32,null));};exports[_0x25ab('0x26')]=function(_0x32533b,_0x257405){return db[_0x25ab('0x2c')][_0x25ab('0x47')]({'where':{'id':_0x32533b['params']['id']}})[_0x25ab('0x25')](handleEntityNotFound(_0x257405,null))[_0x25ab('0x25')](removeEntity(_0x257405,null))[_0x25ab('0x43')](handleError(_0x257405,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index be83bac..e3e42bc 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 _0x362a=['sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x4a9c03,_0x2d0f14){var _0x39fe77=function(_0x3d4f4f){while(--_0x3d4f4f){_0x4a9c03['push'](_0x4a9c03['shift']());}};_0x39fe77(++_0x2d0f14);}(_0x362a,0x102));var _0xa362=function(_0x4fecf3,_0x17fdb0){_0x4fecf3=_0x4fecf3-0x0;var _0x50161f=_0x362a[_0x4fecf3];return _0x50161f;};'use strict';var _=require(_0xa362('0x0'));var util=require(_0xa362('0x1'));var logger=require(_0xa362('0x2'))(_0xa362('0x3'));var moment=require(_0xa362('0x4'));var BPromise=require(_0xa362('0x5'));var rp=require(_0xa362('0x6'));var fs=require('fs');var path=require(_0xa362('0x7'));var rimraf=require(_0xa362('0x8'));var config=require(_0xa362('0x9'));var attributes=require(_0xa362('0xa'));module[_0xa362('0xb')]=function(_0x560ea2,_0x1944a4){return _0x560ea2[_0xa362('0xc')](_0xa362('0xd'),attributes,{'tableName':_0xa362('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa362('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4277=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xe775be,_0x4822af){var _0x49e73c=function(_0x225efd){while(--_0x225efd){_0xe775be['push'](_0xe775be['shift']());}};_0x49e73c(++_0x4822af);}(_0x4277,0xc9));var _0x7427=function(_0x269039,_0x3fc6bf){_0x269039=_0x269039-0x0;var _0x3766bd=_0x4277[_0x269039];return _0x3766bd;};'use strict';var _=require(_0x7427('0x0'));var util=require(_0x7427('0x1'));var logger=require(_0x7427('0x2'))(_0x7427('0x3'));var moment=require(_0x7427('0x4'));var BPromise=require(_0x7427('0x5'));var rp=require(_0x7427('0x6'));var fs=require('fs');var path=require(_0x7427('0x7'));var rimraf=require(_0x7427('0x8'));var config=require(_0x7427('0x9'));var attributes=require(_0x7427('0xa'));module[_0x7427('0xb')]=function(_0x245045,_0x1b5e7f){return _0x245045[_0x7427('0xc')](_0x7427('0xd'),attributes,{'tableName':_0x7427('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7427('0xf'),'collate':_0x7427('0x10')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5f0da13..527a26f 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 _0x7a52=['request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x7a52,0x1bd));var _0x27a5=function(_0xb507dd,_0x318f09){_0xb507dd=_0xb507dd-0x0;var _0x3c584e=_0x7a52[_0xb507dd];return _0x3c584e;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var moment=require(_0x27a5('0x1'));var BPromise=require(_0x27a5('0x2'));var rs=require(_0x27a5('0x3'));var fs=require('fs');var Redis=require(_0x27a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27a5('0x5'));var logger=require(_0x27a5('0x6'))(_0x27a5('0x7'));var config=require(_0x27a5('0x8'));var jayson=require(_0x27a5('0x9'));var client=jayson[_0x27a5('0xa')][_0x27a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x568bbe,_0x26ddd,_0x2c49fe){return new BPromise(function(_0x4b6ef0,_0x47ab24){return client[_0x27a5('0xc')](_0x568bbe,_0x2c49fe)['then'](function(_0x2e1fe4){logger[_0x27a5('0xd')](_0x27a5('0xe'),_0x26ddd,'request\x20sent');logger[_0x27a5('0xf')](_0x27a5('0x10'),_0x26ddd,_0x27a5('0x11'),JSON['stringify'](_0x2e1fe4));if(_0x2e1fe4['error']){if(_0x2e1fe4[_0x27a5('0x12')]['code']===0x1f4){logger['error'](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);return _0x47ab24(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4['error'][_0x27a5('0x13')]);return _0x4b6ef0(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x26ddd,_0x27a5('0x11'));_0x4b6ef0(_0x2e1fe4[_0x27a5('0x14')][_0x27a5('0x13')]);}})[_0x27a5('0x15')](function(_0x398354){logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x398354);_0x47ab24(_0x398354);});});} \ No newline at end of file +var _0x4732=['SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug'];(function(_0x967533,_0x1c89d2){var _0x9ad562=function(_0x4d8b1a){while(--_0x4d8b1a){_0x967533['push'](_0x967533['shift']());}};_0x9ad562(++_0x1c89d2);}(_0x4732,0x17d));var _0x2473=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x4732[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x2473('0x0'));var util=require('util');var moment=require(_0x2473('0x1'));var BPromise=require('bluebird');var rs=require(_0x2473('0x2'));var fs=require('fs');var Redis=require(_0x2473('0x3'));var db=require(_0x2473('0x4'))['db'];var utils=require(_0x2473('0x5'));var logger=require(_0x2473('0x6'))(_0x2473('0x7'));var config=require(_0x2473('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2473('0x9')][_0x2473('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50e340,_0x4be81c,_0x593eba){return new BPromise(function(_0x10da0a,_0x29765a){return client[_0x2473('0xb')](_0x50e340,_0x593eba)[_0x2473('0xc')](function(_0x52fffe){logger['info'](_0x2473('0xd'),_0x4be81c,'request\x20sent');logger[_0x2473('0xe')](_0x2473('0xf'),_0x4be81c,'request\x20sent',JSON['stringify'](_0x52fffe));if(_0x52fffe[_0x2473('0x10')]){if(_0x52fffe[_0x2473('0x10')][_0x2473('0x11')]===0x1f4){logger[_0x2473('0x10')]('SmsApplication,\x20%s,\x20%s',_0x4be81c,_0x52fffe[_0x2473('0x10')][_0x2473('0x12')]);return _0x29765a(_0x52fffe[_0x2473('0x10')][_0x2473('0x12')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x4be81c,_0x52fffe['error'][_0x2473('0x12')]);return _0x10da0a(_0x52fffe[_0x2473('0x10')][_0x2473('0x12')]);}else{logger[_0x2473('0x13')](_0x2473('0xd'),_0x4be81c,_0x2473('0x14'));_0x10da0a(_0x52fffe['result'][_0x2473('0x12')]);}})[_0x2473('0x15')](function(_0x14fcf2){logger[_0x2473('0x10')](_0x2473('0xd'),_0x4be81c,_0x14fcf2);_0x29765a(_0x14fcf2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8f41e64..e00aaee 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','sms','addTags','put','tracked','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','express'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x123b2a,_0x52c1fc){_0x123b2a=_0x123b2a-0x0;var _0x4c83e1=_0xdd4f[_0x123b2a];return _0x4c83e1;};'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('./smsInteraction.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x11')](_0xfdd4('0xd'),auth[_0xfdd4('0x7')](),controller['addMessage']);router[_0xfdd4('0x11')](_0xfdd4('0x13'),auth[_0xfdd4('0x7')](),interaction['tracked'](_0xfdd4('0x14'),'smsinteraction:addtags'),controller[_0xfdd4('0x15')]);router[_0xfdd4('0x16')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')]('sms','smsinteraction:update'),controller['update']);router[_0xfdd4('0x18')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')](_0xfdd4('0x14'),_0xfdd4('0x19')),controller[_0xfdd4('0x1a')]);router[_0xfdd4('0x18')](_0xfdd4('0x13'),auth['isAuthenticated'](),controller[_0xfdd4('0x1b')]);module[_0xfdd4('0x1c')]=router; \ No newline at end of file +var _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x3c5f03,_0x28412c){var _0x417a07=function(_0x586fc1){while(--_0x586fc1){_0x3c5f03['push'](_0x3c5f03['shift']());}};_0x417a07(++_0x28412c);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5f29231..2c3f897 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 _0xc4aa=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0xac4a('0x0'));var moment=require(_0xac4a('0x1'));module[_0xac4a('0x2')]={'closed':{'type':Sequelize[_0xac4a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xac4a('0x4')]},'disposition':{'type':Sequelize[_0xac4a('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xac4a('0x5')]},'read1stAt':{'type':Sequelize[_0xac4a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xac4a('0x6')]('in',_0xac4a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xac4a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xac4a('0x6')]('in',_0xac4a('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xac4a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3baf=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5b7f48,_0x4d8a1d){_0x5b7f48=_0x5b7f48-0x0;var _0x2424b0=_0x3baf[_0x5b7f48];return _0x2424b0;};'use strict';var Sequelize=require(_0xf3ba('0x0'));var moment=require(_0xf3ba('0x1'));module[_0xf3ba('0x2')]={'closed':{'type':Sequelize[_0xf3ba('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf3ba('0x4')]},'disposition':{'type':Sequelize[_0xf3ba('0x5')]},'secondDisposition':{'type':Sequelize[_0xf3ba('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf3ba('0x5')]},'note':{'type':Sequelize[_0xf3ba('0x5')]},'phone':{'type':Sequelize[_0xf3ba('0x5')]},'read1stAt':{'type':Sequelize[_0xf3ba('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf3ba('0x6')]('in',_0xf3ba('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf3ba('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf3ba('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a0a7258..10820ff 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 _0x7f2b=['show','params','rawAttributes','include','options','create','describe','SmsMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','format','includeAll','findAll','addTags','omit','spread','emit','smsInteractionTags:save','removeTags','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Contact','firstName','lastName','Messages','direction','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','answered','unmanaged','total','closed','UserId','waiting','talking','index','SmsInteraction','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','field','from','tools_tags','select','u.fullname','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','sequelize','toString','merge','a.key','Account.key','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f2b,0x11d));var _0xb7f2=function(_0x53211e,_0x470046){_0x53211e=_0x53211e-0x0;var _0x25a03f=_0x7f2b[_0x53211e];return _0x25a03f;};'use strict';var emlformat=require(_0xb7f2('0x0'));var rimraf=require(_0xb7f2('0x1'));var zipdir=require(_0xb7f2('0x2'));var jsonpatch=require(_0xb7f2('0x3'));var rp=require(_0xb7f2('0x4'));var moment=require(_0xb7f2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb7f2('0x6'));var util=require('util');var path=require(_0xb7f2('0x7'));var sox=require(_0xb7f2('0x8'));var csv=require(_0xb7f2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7f2('0xa'));var _=require(_0xb7f2('0xb'));var squel=require(_0xb7f2('0xc'));var crypto=require(_0xb7f2('0xd'));var jsforce=require(_0xb7f2('0xe'));var deskjs=require(_0xb7f2('0xf'));var toCsv=require(_0xb7f2('0x9'));var querystring=require('querystring');var Papa=require(_0xb7f2('0x10'));var Redis=require(_0xb7f2('0x11'));var authService=require(_0xb7f2('0x12'));var qs=require(_0xb7f2('0x13'));var as=require(_0xb7f2('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb7f2('0x15'));var logger=require(_0xb7f2('0x16'))('api');var utils=require(_0xb7f2('0x17'));var config=require(_0xb7f2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb7f2('0x19')]=_[_0xb7f2('0x1a')](config[_0xb7f2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7f2('0x1b'))(new Redis(config[_0xb7f2('0x19')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x28d421,_0x10a377){_0x10a377=_0x10a377||0xcc;return function(_0x3f20cf){if(_0x3f20cf){return _0x28d421[_0xb7f2('0x1c')](_0x10a377);}return _0x28d421[_0xb7f2('0x1d')](_0x10a377)[_0xb7f2('0x1e')]();};}function respondWithResult(_0x9ccb9b,_0x250e49){_0x250e49=_0x250e49||0xc8;return function(_0x1e07bf){if(_0x1e07bf){return _0x9ccb9b[_0xb7f2('0x1d')](_0x250e49)[_0xb7f2('0x1f')](_0x1e07bf);}};}function respondWithFilteredResult(_0x4625f4,_0x171039){return function(_0xc3590e){if(_0xc3590e){var _0x320562=typeof _0x171039[_0xb7f2('0x20')]===_0xb7f2('0x21')&&typeof _0x171039[_0xb7f2('0x22')]===_0xb7f2('0x21');var _0xb91fdc=_0xc3590e[_0xb7f2('0x23')];var _0x22fdc3=_0x320562?0x0:_0x171039['offset'];var _0x42d066=_0x320562?_0xc3590e['count']:_0x171039['offset']+_0x171039[_0xb7f2('0x22')];var _0x3a8d56;if(_0x42d066>=_0xb91fdc){_0x42d066=_0xb91fdc;_0x3a8d56=0xc8;}else{_0x3a8d56=0xce;}_0x4625f4[_0xb7f2('0x1d')](_0x3a8d56);return _0x4625f4[_0xb7f2('0x24')](_0xb7f2('0x25'),_0x22fdc3+'-'+_0x42d066+'/'+_0xb91fdc)[_0xb7f2('0x1f')](_0xc3590e);}return null;};}function patchUpdates(_0x638508){return function(_0x437517){try{jsonpatch[_0xb7f2('0x26')](_0x437517,_0x638508,!![]);}catch(_0x524330){return BPromise[_0xb7f2('0x27')](_0x524330);}return _0x437517[_0xb7f2('0x28')]();};}function saveUpdates(_0x8a5e93,_0x4af04d){return function(_0x4b1236){if(_0x4b1236){return _0x4b1236[_0xb7f2('0x29')](_0x8a5e93)['then'](function(_0x36fed0){return _0x36fed0;});}return null;};}function removeEntity(_0x7fe04b,_0x3021de){return function(_0x416e00){if(_0x416e00){return _0x416e00[_0xb7f2('0x2a')]()[_0xb7f2('0x2b')](function(){_0x7fe04b['status'](0xcc)[_0xb7f2('0x1e')]();});}};}function handleEntityNotFound(_0x39f29f,_0x3dcf5f){return function(_0x2f5906){if(!_0x2f5906){_0x39f29f[_0xb7f2('0x1c')](0x194);}return _0x2f5906;};}function handleError(_0x52330b,_0xda7d4){_0xda7d4=_0xda7d4||0x1f4;return function(_0x76f5b6){logger['error'](_0x76f5b6[_0xb7f2('0x2c')]);if(_0x76f5b6[_0xb7f2('0x2d')]){delete _0x76f5b6[_0xb7f2('0x2d')];}_0x52330b['status'](_0xda7d4)['send'](_0x76f5b6);};}function getInteractionUsers(_0x4b12bb,_0x10c4d7){return new BPromise(function(_0x49d548,_0x4e6192){try{if(_0x10c4d7[_0x4b12bb['id']]){_0x4b12bb[_0xb7f2('0x2e')]=_[_0xb7f2('0x2f')](_0x10c4d7[_0x4b12bb['id']],function(_0x4ca4e8){return{'id':_0x4ca4e8['id'],'fullname':_0x4ca4e8[_0xb7f2('0x30')]};});}}catch(_0x4df33f){_0x4e6192(_0x4df33f);}_0x49d548(_0x4b12bb);});}function getInteractionTags(_0x5d0068,_0x88dbdb){return new BPromise(function(_0x586d02,_0x2b2a3e){try{if(_0x5d0068[_0xb7f2('0x31')]){_0x5d0068[_0xb7f2('0x32')]=[];_0x5d0068['TagIds'][_0xb7f2('0x33')](',')[_0xb7f2('0x34')](function(_0x216c64){_0x5d0068[_0xb7f2('0x32')][_0xb7f2('0x35')](_0x88dbdb[_0x216c64]);});}delete _0x5d0068[_0xb7f2('0x31')];}catch(_0xb0b708){_0x2b2a3e(_0xb0b708);}_0x586d02(_0x5d0068);});}function updateSmsInteraction(_0x356628,_0x11f6ea,_0x5ac7a3){return new BPromise(function(_0x382982,_0x33a301){return getInteractionUsers(_0x356628,_0x5ac7a3)[_0xb7f2('0x2b')](function(_0x356077){return getInteractionTags(_0x356077,_0x11f6ea);})[_0xb7f2('0x2b')](function(_0x73b219){return getStateInteraction(_0x73b219);})['then'](function(_0x3f50cf){_0x382982(_0x3f50cf);})[_0xb7f2('0x36')](function(_0x2f3885){_0x33a301(_0x2f3885);});});}function getStateInteraction(_0x32b6ed){return new BPromise(function(_0x409c1d){_0x32b6ed['waiting']=0x0;_0x32b6ed['talking']=0x0;_0x32b6ed[_0xb7f2('0x37')]=0x0;_0x32b6ed[_0xb7f2('0x38')]=0x0;_0x32b6ed[_0xb7f2('0x39')]=0x0;if(!_0x32b6ed[_0xb7f2('0x3a')]&&!_0x32b6ed[_0xb7f2('0x3b')]){_0x32b6ed[_0xb7f2('0x3c')]+=0x1;}if(!_0x32b6ed[_0xb7f2('0x3a')]&&_0x32b6ed['UserId']){_0x32b6ed[_0xb7f2('0x3d')]+=0x1;if(_0x32b6ed['waiting']){_0x32b6ed[_0xb7f2('0x3c')]-=0x1;}}if(_0x32b6ed['closed']&&_0x32b6ed[_0xb7f2('0x3b')]){_0x32b6ed[_0xb7f2('0x37')]+=0x1;if(_0x32b6ed[_0xb7f2('0x3d')]){_0x32b6ed[_0xb7f2('0x3d')]-=0x1;}}if(_0x32b6ed['closed']&&!_0x32b6ed['UserId']){_0x32b6ed['unmanaged']+=0x1;if(_0x32b6ed[_0xb7f2('0x3c')]){_0x32b6ed[_0xb7f2('0x3c')]-=0x1;}}_0x32b6ed[_0xb7f2('0x39')]+=0x1;_0x409c1d(_0x32b6ed);});}exports[_0xb7f2('0x3e')]=function(_0x5c8dfb,_0x17c759){var _0x517430={},_0x390f1a={},_0x2b990d={'count':0x0,'rows':[]};var _0x4df917=_[_0xb7f2('0x2f')](db[_0xb7f2('0x3f')]['rawAttributes'],function(_0x21e099){return{'name':_0x21e099[_0xb7f2('0x40')],'type':_0x21e099[_0xb7f2('0x41')]['key']};});_0x390f1a[_0xb7f2('0x42')]=_[_0xb7f2('0x2f')](_0x4df917,_0xb7f2('0x2d'));_0x390f1a[_0xb7f2('0x43')]=_['keys'](_0x5c8dfb[_0xb7f2('0x43')]);_0x390f1a[_0xb7f2('0x44')]=_[_0xb7f2('0x45')](_0x390f1a[_0xb7f2('0x42')],_0x390f1a['query']);_0x517430[_0xb7f2('0x46')]=_[_0xb7f2('0x45')](_0x390f1a['model'],qs['fields'](_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x47')]));_0x517430[_0xb7f2('0x46')]=_0x517430[_0xb7f2('0x46')][_0xb7f2('0x48')]?_0x517430[_0xb7f2('0x46')]:_0x390f1a[_0xb7f2('0x42')];if(!_0x5c8dfb[_0xb7f2('0x43')]['hasOwnProperty']('nolimit')){_0x517430[_0xb7f2('0x22')]=qs['limit'](_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x22')]);_0x517430['offset']=qs['offset'](_0x5c8dfb[_0xb7f2('0x43')]['offset']);}_0x517430[_0xb7f2('0x49')]=qs[_0xb7f2('0x4a')](_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x4a')]);_0x517430[_0xb7f2('0x4b')]=qs['filters'](_[_0xb7f2('0x4c')](_0x5c8dfb[_0xb7f2('0x43')],_0x390f1a[_0xb7f2('0x44')]),_0x4df917);var _0x33fab8=[];var _0x1c689c=squel['select']()['field']('id')[_0xb7f2('0x4d')](_0xb7f2('0x2d'))['field']('color')[_0xb7f2('0x4e')](_0xb7f2('0x4f'));var _0x325cee=squel[_0xb7f2('0x50')]()[_0xb7f2('0x4d')]('u.id')[_0xb7f2('0x4d')](_0xb7f2('0x51'))[_0xb7f2('0x4d')]('ui.SmsInteractionId')[_0xb7f2('0x4e')](_0xb7f2('0x52'),'ui')['left_join']('users','u',_0xb7f2('0x53'));var _0x546473=squel[_0xb7f2('0x50')]()['from'](_0xb7f2('0x54'),'i')[_0xb7f2('0x55')](_0xb7f2('0x56'),'c',_0xb7f2('0x57'))[_0xb7f2('0x55')]('users','o','o.id\x20=\x20i.UserId')[_0xb7f2('0x55')](_0xb7f2('0x58'),'a',_0xb7f2('0x59'))[_0xb7f2('0x55')]('sms_messages','me',_0xb7f2('0x5a'))[_0xb7f2('0x55')](_0xb7f2('0x5b'),'it',_0xb7f2('0x5c'))[_0xb7f2('0x55')]('tools_tags','t',_0xb7f2('0x5d'));var _0x3a6398=squel[_0xb7f2('0x5e')]();var _0x59682b=[];var _0x157fd5=squel[_0xb7f2('0x5e')]();var _0x7f1505;if(_0x5c8dfb[_0xb7f2('0x43')]['search']){_0x7f1505=as[_0xb7f2('0x5f')](_0x5c8dfb['query'][_0xb7f2('0x60')]);var _0x16d870=_0x7f1505[_0xb7f2('0x61')];for(var _0x28573b=0x0;_0x28573b<_0x7f1505['conditions'][_0xb7f2('0x48')];_0x28573b++){var _0x3fe3ce=_0x7f1505[_0xb7f2('0x62')][_0x28573b];var _0x28a714='i';var _0x3d8427=_['find'](_0x4df917,[_0xb7f2('0x2d'),_0x3fe3ce[_0xb7f2('0x4d')]]);if(!_0x3d8427){switch(_0x3fe3ce[_0xb7f2('0x4d')]){case'unreadMessages':if(_0x3fe3ce['value']==0x1){_0x546473[_0xb7f2('0x63')]('`'+_0x3fe3ce['field']+_0xb7f2('0x64'));}else{_0x546473[_0xb7f2('0x63')]('`'+_0x3fe3ce['field']+_0xb7f2('0x65'));}break;case'Contact':if(_0x3fe3ce[_0xb7f2('0x66')]==='$substring'){if(_0x3fe3ce[_0xb7f2('0x67')]['split']('\x20')[_0xb7f2('0x48')]>0x1){_0x3a6398[_0x16d870](_0xb7f2('0x68'),qs['getFullTextValue'](_0x3fe3ce[_0xb7f2('0x67')]),null);}else{var _0x2abb6f='%'+_0x3fe3ce[_0xb7f2('0x67')]+'%';_0x3a6398[_0x16d870](_0xb7f2('0x69'),_0x2abb6f,_0x2abb6f,_0x2abb6f);}}else{_0x3d8427=_[_0xb7f2('0x6a')](_0x4df917,[_0xb7f2('0x2d'),_0xb7f2('0x6b')]);_0x3fe3ce['field']=_0xb7f2('0x6b');_0x291cd4=as[_0xb7f2('0x6c')](_0x28a714,_0x3d8427['type'],_0x3fe3ce);_0x3a6398[_0x16d870](_0x291cd4[_0xb7f2('0x6d')],_0x291cd4[_0xb7f2('0x67')][_0xb7f2('0x6e')],_0x291cd4[_0xb7f2('0x67')][_0xb7f2('0x1e')]);}break;case _0xb7f2('0x6f'):var _0x4c1b8e=_0x3fe3ce[_0xb7f2('0x67')][_0xb7f2('0x33')](',')['map'](function(_0x4d80e9){return Number(_0x4d80e9);});_0x4c1b8e[_0xb7f2('0x34')](function(_0x3a1914){_0x157fd5['or'](_0xb7f2('0x70'),'%,'+_0x3a1914+',%');});_0x59682b=_['union'](_0x59682b,_0x4c1b8e);break;case _0xb7f2('0x71'):if(_0x3fe3ce['operator']===_0xb7f2('0x72')){_0x3a6398[_0x16d870](_0xb7f2('0x73'),'%'+_0x3fe3ce[_0xb7f2('0x67')]+'%',null);}else{_0x3d8427=_[_0xb7f2('0x6a')](_0x4df917,['name',_0xb7f2('0x3b')]);_0x3fe3ce[_0xb7f2('0x4d')]=_0xb7f2('0x3b');_0x291cd4=as[_0xb7f2('0x6c')](_0x28a714,_0x3d8427[_0xb7f2('0x41')],_0x3fe3ce);_0x3a6398[_0x16d870](_0x291cd4[_0xb7f2('0x6d')],_0x291cd4[_0xb7f2('0x67')][_0xb7f2('0x6e')],_0x291cd4['value'][_0xb7f2('0x1e')]);}break;case _0xb7f2('0x74'):_0x291cd4=as[_0xb7f2('0x6c')]('me',null,_0x3fe3ce);_0x3a6398[_0x16d870](_0x291cd4['text'],_0x291cd4['value'][_0xb7f2('0x6e')],_0x291cd4[_0xb7f2('0x67')]['end']);break;}}else{var _0x291cd4=as[_0xb7f2('0x6c')](_0x28a714,_0x3d8427[_0xb7f2('0x41')],_0x3fe3ce);_0x3a6398[_0x16d870](_0x291cd4[_0xb7f2('0x6d')],_0x291cd4[_0xb7f2('0x67')]['start'],_0x291cd4[_0xb7f2('0x67')][_0xb7f2('0x1e')]);}}}else{var _0x33ac3e=_(_0x5c8dfb['query'])[_0xb7f2('0x75')]()[_0xb7f2('0x2f')](function(_0x403bd9){return _['some'](_0x4df917,['name',_0x403bd9])?_0x403bd9:undefined;})[_0xb7f2('0x76')]()[_0xb7f2('0x67')]();if(!_[_0xb7f2('0x77')](_0x33ac3e)){_0x33ac3e[_0xb7f2('0x34')](function(_0x248c4e){if(_0x248c4e==='SmsAccountId'){_0x546473[_0xb7f2('0x4b')](_0xb7f2('0x78'),[][_0xb7f2('0x79')](_0x5c8dfb[_0xb7f2('0x43')][_0x248c4e]));}else if(_0x248c4e===_0xb7f2('0x7a')){var _0x38a1d8=JSON[_0xb7f2('0x7b')](_0x5c8dfb[_0xb7f2('0x43')][_0x248c4e])[_0xb7f2('0x7c')];var _0x4fc616=JSON[_0xb7f2('0x7b')](_0x5c8dfb['query'][_0x248c4e])[_0xb7f2('0x7d')];_0x546473[_0xb7f2('0x4b')](_0xb7f2('0x7e'),_0x38a1d8,_0x4fc616);}else{if(_0x5c8dfb[_0xb7f2('0x43')][_0x248c4e]===_0xb7f2('0x7f')){_0x546473[_0xb7f2('0x4b')]('i.'+_0x248c4e+_0xb7f2('0x80'));}else{_0x546473[_0xb7f2('0x4b')]('i.'+_0x248c4e+_0xb7f2('0x81'),_0x5c8dfb[_0xb7f2('0x43')][_0x248c4e]);}}});}if(_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x82')]){if(_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x82')]==0x1){_0x546473[_0xb7f2('0x63')](_0xb7f2('0x83'));}else{_0x546473[_0xb7f2('0x63')](_0xb7f2('0x84'));}}if(_0x5c8dfb[_0xb7f2('0x43')]['tag']){_0x59682b=_['isArray'](_0x5c8dfb[_0xb7f2('0x43')]['tag'])?_0x5c8dfb['query'][_0xb7f2('0x85')]:new Array(_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x85')]);_0x59682b[_0xb7f2('0x34')](function(_0x3dbe59){_0x157fd5['or'](_0xb7f2('0x70'),'%,'+_0x3dbe59+',%');});}if(_0x5c8dfb[_0xb7f2('0x43')]['filter']){var _0x290784=_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x86')][_0xb7f2('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb7f2('0x88')](_0x290784)){_0x3a6398['or'](_0xb7f2('0x89'),_0x290784+'%')['or'](_0xb7f2('0x8a'),_0x290784+'%');}else{_0x3a6398['or'](_0xb7f2('0x8b'),qs['getFullTextValue'](_0x290784))['or'](_0xb7f2('0x8c'),_0x290784+'%');}}}_0x546473[_0xb7f2('0x4b')](_0x3a6398);_0x546473[_0xb7f2('0x8d')](_0xb7f2('0x8e'));var _0x4b6e33={'type':db['Sequelize'][_0xb7f2('0x8f')][_0xb7f2('0x90')],'raw':!![]};var _0x2e65f2=_0x546473[_0xb7f2('0x91')]();_0x2e65f2['field'](_0xb7f2('0x8e'));_0x2e65f2['field'](_0xb7f2('0x92'),_0xb7f2('0x93'));if(_0x517430[_0xb7f2('0x49')]){_0x517430[_0xb7f2('0x49')][_0xb7f2('0x34')](function(_0x148eff){var _0xd1975=_0x148eff[0x0]===_0xb7f2('0x94')?_0x148eff[0x0]:'i.'+_0x148eff[0x0];_0x546473[_0xb7f2('0x49')](_0xd1975,_0x148eff[0x1]===_0xb7f2('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x59682b)){_0x546473['having'](_0x157fd5);_0x2e65f2[_0xb7f2('0x4b')](_0xb7f2('0x96'),_0x59682b);}BPromise['resolve']()[_0xb7f2('0x2b')](function(){if(!_0x7f1505){if(_0x5c8dfb[_0xb7f2('0x43')][_0xb7f2('0x97')])return;_0x2e65f2['where'](_0xb7f2('0x98'));_0x546473['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5c8dfb[_0xb7f2('0x99')][_0xb7f2('0x9a')]!=='agent')return;return _0x5c8dfb['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xb7f2('0x2b')](function(_0x465e3e){if(_[_0xb7f2('0x77')](_0x465e3e)){_0x2e65f2[_0xb7f2('0x4b')]('i.SmsAccountId\x20IS\x20NULL');_0x546473[_0xb7f2('0x4b')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2e65f2[_0xb7f2('0x4b')]('i.SmsAccountId\x20IN\x20?',_[_0xb7f2('0x2f')](_0x465e3e,'id'));_0x546473[_0xb7f2('0x4b')](_0xb7f2('0x78'),_[_0xb7f2('0x2f')](_0x465e3e,'id'));}});})['then'](function(){if(_0x5c8dfb[_0xb7f2('0x99')][_0xb7f2('0x9a')]==='agent'&&!_0x7f1505&&!_0x5c8dfb['query']['SmsAccountId'])return[];return db[_0xb7f2('0x9b')][_0xb7f2('0x43')](_0x2e65f2['toString'](),_0x4b6e33);})[_0xb7f2('0x2b')](function(_0x7911d4){_0x2b990d[_0xb7f2('0x23')]=_0x7911d4[_0xb7f2('0x48')];if(_0x2b990d[_0xb7f2('0x23')]===0x0)return[];return db[_0xb7f2('0x9b')][_0xb7f2('0x43')](_0x1c689c[_0xb7f2('0x9c')](),_0x4b6e33)[_0xb7f2('0x2b')](function(_0x5d0c53){_0x33fab8=_['keyBy'](_0x5d0c53,'id');_0x4b6e33=_[_0xb7f2('0x9d')](_0x4b6e33,{'model':db[_0xb7f2('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c8dfb['query']['fields']){_0x517430[_0xb7f2('0x46')][_0xb7f2('0x34')](function(_0x468aa8){_0x546473[_0xb7f2('0x4d')]('i.'+_0x468aa8);});}else{_0x546473[_0xb7f2('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb7f2('0x93'));_0x546473[_0xb7f2('0x4d')](_0xb7f2('0x9e'),_0xb7f2('0x9f'));_0x546473['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x546473[_0xb7f2('0x4d')]('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',_0xb7f2('0x94'));_0x546473[_0xb7f2('0x4d')](_0xb7f2('0xa0'));_0x546473[_0xb7f2('0x4d')]('c.firstName',_0xb7f2('0xa1'));_0x546473[_0xb7f2('0x4d')](_0xb7f2('0xa2'),_0xb7f2('0xa3'));_0x546473[_0xb7f2('0x4d')]('c.email',_0xb7f2('0xa4'));_0x546473['field']('c.phone',_0xb7f2('0xa5'));_0x546473['field'](_0xb7f2('0xa6'),'Contact.mobile');_0x546473[_0xb7f2('0x4d')](_0xb7f2('0xa7'),'Contact.fax');_0x546473[_0xb7f2('0x4d')](_0xb7f2('0xa8'),'Owner.fullname');_0x546473[_0xb7f2('0x4d')]('o.internal',_0xb7f2('0xa9'));_0x546473['field'](_0xb7f2('0xaa'),'TagIds');}if(_0x517430[_0xb7f2('0x22')])_0x546473[_0xb7f2('0x22')](_0x517430[_0xb7f2('0x22')]);if(_0x517430[_0xb7f2('0x20')])_0x546473['offset'](_0x517430[_0xb7f2('0x20')]);return db[_0xb7f2('0x9b')][_0xb7f2('0x43')](_0x546473[_0xb7f2('0x9c')](),_0x4b6e33);})[_0xb7f2('0x2b')](function(_0x3cec8f){if(_0x3cec8f[_0xb7f2('0x48')]>0x0)_0x325cee[_0xb7f2('0x4b')](_0xb7f2('0xab'),_['map'](_0x3cec8f,'id'));return db[_0xb7f2('0x9b')][_0xb7f2('0x43')](_0x325cee['toString'](),_0x4b6e33)['then'](function(_0x3d6e40){var _0x2dfe58=_[_0xb7f2('0xac')](_0x3d6e40,_0xb7f2('0xad'));var _0x3fc738=[];_0x3cec8f[_0xb7f2('0x34')](function(_0x1359b1){_0x3fc738['push'](updateSmsInteraction(_0x1359b1,_0x33fab8,_0x2dfe58));});return BPromise[_0xb7f2('0xae')](_0x3fc738);});});})[_0xb7f2('0x2b')](function(_0x1e56a9){_0x2b990d['rows']=_0x1e56a9;return _0x2b990d;})['then'](respondWithFilteredResult(_0x17c759,_0x517430))[_0xb7f2('0x36')](handleError(_0x17c759,null));};exports[_0xb7f2('0xaf')]=function(_0x5a4f75,_0x4988c7){var _0x2fde99={'raw':![],'where':{'id':_0x5a4f75[_0xb7f2('0xb0')]['id']}},_0x34d7b6={};_0x34d7b6[_0xb7f2('0x42')]=_['keys'](db[_0xb7f2('0x3f')][_0xb7f2('0xb1')]);_0x34d7b6[_0xb7f2('0x43')]=_[_0xb7f2('0x75')](_0x5a4f75['query']);_0x34d7b6[_0xb7f2('0x44')]=_[_0xb7f2('0x45')](_0x34d7b6['model'],_0x34d7b6[_0xb7f2('0x43')]);_0x2fde99[_0xb7f2('0x46')]=_[_0xb7f2('0x45')](_0x34d7b6[_0xb7f2('0x42')],qs[_0xb7f2('0x47')](_0x5a4f75['query'][_0xb7f2('0x47')]));_0x2fde99['attributes']=_0x2fde99['attributes'][_0xb7f2('0x48')]?_0x2fde99['attributes']:_0x34d7b6[_0xb7f2('0x42')];if(_0x5a4f75[_0xb7f2('0x43')]['includeAll']){_0x2fde99[_0xb7f2('0xb2')]=[{'all':!![]}];}_0x2fde99=_[_0xb7f2('0x9d')]({},_0x2fde99,_0x5a4f75[_0xb7f2('0xb3')]);return db[_0xb7f2('0x3f')][_0xb7f2('0x6a')](_0x2fde99)[_0xb7f2('0x2b')](handleEntityNotFound(_0x4988c7,null))['then'](respondWithResult(_0x4988c7,null))[_0xb7f2('0x36')](handleError(_0x4988c7,null));};exports[_0xb7f2('0xb4')]=function(_0xd30ab3,_0x13a2e6){return db['SmsInteraction'][_0xb7f2('0xb4')](_0xd30ab3[_0xb7f2('0x74')],{})[_0xb7f2('0x2b')](respondWithResult(_0x13a2e6,0xc9))[_0xb7f2('0x36')](handleError(_0x13a2e6,null));};exports['update']=function(_0x3c3817,_0x4755b3){if(_0x3c3817[_0xb7f2('0x74')]['id']){delete _0x3c3817[_0xb7f2('0x74')]['id'];}return db['SmsInteraction'][_0xb7f2('0x6a')]({'where':{'id':_0x3c3817['params']['id']}})['then'](handleEntityNotFound(_0x4755b3,null))[_0xb7f2('0x2b')](saveUpdates(_0x3c3817[_0xb7f2('0x74')],null))[_0xb7f2('0x2b')](respondWithResult(_0x4755b3,null))['catch'](handleError(_0x4755b3,null));};exports[_0xb7f2('0x2a')]=function(_0x2d0eed,_0x5159e2){return db[_0xb7f2('0x3f')][_0xb7f2('0x6a')]({'where':{'id':_0x2d0eed['params']['id']}})[_0xb7f2('0x2b')](handleEntityNotFound(_0x5159e2,null))[_0xb7f2('0x2b')](removeEntity(_0x5159e2,null))[_0xb7f2('0x36')](handleError(_0x5159e2,null));};exports[_0xb7f2('0xb5')]=function(_0x4f26d1,_0x23fc9f){return db[_0xb7f2('0x3f')][_0xb7f2('0xb5')]()[_0xb7f2('0x2b')](respondWithResult(_0x23fc9f,null))[_0xb7f2('0x36')](handleError(_0x23fc9f,null));};exports['addMessage']=function(_0x337e4d,_0xf21802,_0x2d2206){return db[_0xb7f2('0xb6')][_0xb7f2('0x6a')]({'where':{'id':_0x337e4d['params']['id']}})['then'](handleEntityNotFound(_0xf21802,null))['then'](function(_0x355e40){if(_0x355e40){return _0x355e40[_0xb7f2('0xb7')](_0x337e4d[_0xb7f2('0x74')][_0xb7f2('0xb8')],_['omit'](_0x337e4d[_0xb7f2('0x74')],[_0xb7f2('0xb8'),'id'])||{});}})[_0xb7f2('0x2b')](respondWithResult(_0xf21802,null))['catch'](handleError(_0xf21802,null));};exports[_0xb7f2('0xb9')]=function(_0x459964,_0x38888d,_0x29a0c4){var _0x2e0932={'raw':![],'where':{}};var _0x4f02c3={};var _0x361b50={'count':0x0,'rows':[]};return db[_0xb7f2('0x3f')][_0xb7f2('0xba')]({'where':{'id':_0x459964['params']['id']}})[_0xb7f2('0x2b')](handleEntityNotFound(_0x38888d,null))[_0xb7f2('0x2b')](function(_0xbc2d6e){if(_0xbc2d6e){_0x4f02c3[_0xb7f2('0x42')]=_[_0xb7f2('0x75')](db[_0xb7f2('0xb6')]['rawAttributes']);_0x4f02c3[_0xb7f2('0x43')]=_[_0xb7f2('0x75')](_0x459964[_0xb7f2('0x43')]);_0x4f02c3[_0xb7f2('0x44')]=_[_0xb7f2('0x45')](_0x4f02c3[_0xb7f2('0x42')],_0x4f02c3[_0xb7f2('0x43')]);_0x2e0932['attributes']=_[_0xb7f2('0x45')](_0x4f02c3[_0xb7f2('0x42')],qs['fields'](_0x459964[_0xb7f2('0x43')][_0xb7f2('0x47')]));_0x2e0932['attributes']=_0x2e0932['attributes']['length']?_0x2e0932[_0xb7f2('0x46')]:_0x4f02c3[_0xb7f2('0x42')];if(!_0x459964[_0xb7f2('0x43')][_0xb7f2('0xbb')](_0xb7f2('0xbc'))){_0x2e0932[_0xb7f2('0x22')]=qs[_0xb7f2('0x22')](_0x459964[_0xb7f2('0x43')][_0xb7f2('0x22')]);_0x2e0932[_0xb7f2('0x20')]=qs[_0xb7f2('0x20')](_0x459964[_0xb7f2('0x43')][_0xb7f2('0x20')]);}_0x2e0932[_0xb7f2('0x49')]=qs[_0xb7f2('0x4a')](_0x459964[_0xb7f2('0x43')][_0xb7f2('0x4a')]);_0x2e0932['where']=qs[_0xb7f2('0x44')](_[_0xb7f2('0x4c')](_0x459964[_0xb7f2('0x43')],_0x4f02c3[_0xb7f2('0x44')]));_0x2e0932[_0xb7f2('0x4b')][_0xb7f2('0xad')]=_0xbc2d6e['id'];if(_0x459964[_0xb7f2('0x43')]['filter']){_0x2e0932[_0xb7f2('0x4b')]=_[_0xb7f2('0x9d')](_0x2e0932['where'],{'$or':_[_0xb7f2('0x2f')](_0x2e0932[_0xb7f2('0x46')],function(_0x190c6b){var _0x452aca={};_0x452aca[_0x190c6b]={'$like':'%'+_0x459964['query']['filter']+'%'};return _0x452aca;})});}if(_0x459964['query'][_0xb7f2('0x7c')]){var _0x2ff2f1=_0x459964[_0xb7f2('0x43')]['$gte'][_0xb7f2('0x33')](',');var _0x110029={};_0x110029[_0x2ff2f1[0x0]]={'$gte':moment(_0x2ff2f1[0x1])[_0xb7f2('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2e0932[_0xb7f2('0x4b')]=_['merge'](_0x2e0932['where'],_0x110029);}_0x2e0932=_['merge']({},_0x2e0932,_0x459964[_0xb7f2('0xb3')]);return db[_0xb7f2('0xb6')][_0xb7f2('0x23')]({'where':_0x2e0932[_0xb7f2('0x4b')]})[_0xb7f2('0x2b')](function(_0x312c69){_0x361b50['count']=_0x312c69;if(_0x459964[_0xb7f2('0x43')][_0xb7f2('0xbe')]){_0x2e0932['include']=[{'all':!![]}];}return db[_0xb7f2('0xb6')][_0xb7f2('0xbf')](_0x2e0932);})[_0xb7f2('0x2b')](function(_0x3919df){_0x361b50['rows']=_0x3919df;return _0x361b50;});}})[_0xb7f2('0x2b')](respondWithFilteredResult(_0x38888d,_0x2e0932))[_0xb7f2('0x36')](handleError(_0x38888d,null));};exports[_0xb7f2('0xc0')]=function(_0x5a6c2f,_0x444a5b,_0x192477){return db['SmsInteraction'][_0xb7f2('0x6a')]({'where':{'id':_0x5a6c2f[_0xb7f2('0xb0')]['id']}})[_0xb7f2('0x2b')](handleEntityNotFound(_0x444a5b,null))[_0xb7f2('0x2b')](function(_0x41ae14){if(_0x41ae14){return _0x41ae14['setTags'](_0x5a6c2f[_0xb7f2('0x74')][_0xb7f2('0xb8')],_[_0xb7f2('0xc1')](_0x5a6c2f[_0xb7f2('0x74')],[_0xb7f2('0xb8'),'id'])||{})[_0xb7f2('0xc2')](function(){return db[_0xb7f2('0x6f')][_0xb7f2('0xbf')]({'attributes':['id',_0xb7f2('0x2d'),'color'],'where':{'id':_0x5a6c2f[_0xb7f2('0x74')][_0xb7f2('0xb8')]}});})['then'](function(_0x466502){socket[_0xb7f2('0xc3')](_0xb7f2('0xc4'),{'id':Number(_0x5a6c2f[_0xb7f2('0xb0')]['id']),'tags':_0x466502||[]});return{'id':Number(_0x5a6c2f[_0xb7f2('0xb0')]['id']),'tags':_0x466502||[]};});}})[_0xb7f2('0x2b')](respondWithResult(_0x444a5b,null))[_0xb7f2('0x36')](handleError(_0x444a5b,null));};exports['removeTags']=function(_0x1e16c0,_0x8412c,_0x21de67){return db[_0xb7f2('0x3f')][_0xb7f2('0x6a')]({'where':{'id':_0x1e16c0[_0xb7f2('0xb0')]['id']}})['then'](handleEntityNotFound(_0x8412c,null))['then'](function(_0x668544){if(_0x668544){return _0x668544[_0xb7f2('0xc5')](_0x1e16c0['query'][_0xb7f2('0xb8')]);}})[_0xb7f2('0x2b')](respondWithStatusCode(_0x8412c,null))[_0xb7f2('0x36')](handleError(_0x8412c,null));};exports['download']=function(_0x409b07,_0x106824){var _0x2ad8b3=moment()[_0xb7f2('0xc6')]()[_0xb7f2('0x9c')]();var _0x3ee400=path['join'](config[_0xb7f2('0xc7')],_0xb7f2('0xc8'),_0xb7f2('0xc9'),_0xb7f2('0xca'));var _0x5a64cc=path[_0xb7f2('0xcb')](config['root'],'server',_0xb7f2('0xc9'),'attachments');var _0x5f0402=path['join'](_0x3ee400,_0x2ad8b3);var _0x90269d=util[_0xb7f2('0xbd')](_0xb7f2('0xcc'),_0x409b07[_0xb7f2('0xb0')]['id'],_0x2ad8b3);var _0x57560e=path[_0xb7f2('0xcb')](_0x3ee400,_0x90269d);var _0x14cfc0=[];_0x14cfc0['push']({'model':db[_0xb7f2('0x71')],'as':'User','attributes':['id',_0xb7f2('0x30')],'raw':!![]});_0x14cfc0[_0xb7f2('0x35')]({'model':db['CmContact'],'as':_0xb7f2('0xcd'),'attributes':['id',_0xb7f2('0xce'),_0xb7f2('0xcf')],'raw':!![]});var _0x5d6c43=[{'model':db[_0xb7f2('0xb6')],'as':_0xb7f2('0xd0'),'attributes':['id','body',_0xb7f2('0x7a'),_0xb7f2('0xd1'),'secret',_0xb7f2('0x82')],'include':_0x14cfc0}];_0x5d6c43[_0xb7f2('0x35')]({'model':db[_0xb7f2('0xd2')],'as':'Account','attributes':['id',_0xb7f2('0x2d')]});_0x5d6c43[_0xb7f2('0x35')]({'model':db[_0xb7f2('0x71')],'as':_0xb7f2('0xd3'),'attributes':['id',_0xb7f2('0x30')]});return db['SmsInteraction'][_0xb7f2('0x6a')]({'where':{'id':_0x409b07[_0xb7f2('0xb0')]['id']},'include':_0x5d6c43})['then'](handleEntityNotFound(_0x106824,null))[_0xb7f2('0x2b')](function(_0x4d5851){if(_0x4d5851){var _0x5dae23=_0x4d5851[_0xb7f2('0xd4')]({'plain':!![]});fs[_0xb7f2('0xd5')](_0x5f0402);var _0x496869={'channel':_0xb7f2('0xd6'),'account':_0x5dae23[_0xb7f2('0xd7')]['name'],'agent':_0x5dae23[_0xb7f2('0xd3')]?_0x5dae23[_0xb7f2('0xd3')][_0xb7f2('0x30')]:_0xb7f2('0xd8'),'createdAt':moment(_0x5dae23[_0xb7f2('0x7a')])[_0xb7f2('0xbd')](_0xb7f2('0xd9'))[_0xb7f2('0x9c')](),'closedAt':_0x5dae23[_0xb7f2('0x3a')]?moment(_0x5dae23[_0xb7f2('0xda')])[_0xb7f2('0xbd')](_0xb7f2('0xd9'))[_0xb7f2('0x9c')]():'','disposition':_0x5dae23[_0xb7f2('0xdb')],'messages':_(_0x5dae23[_0xb7f2('0xd0')])[_0xb7f2('0x86')]({'secret':![]})[_0xb7f2('0x2f')](function(_0x20bcfa){return{'date':moment(_0x20bcfa[_0xb7f2('0x7a')])[_0xb7f2('0xbd')](_0xb7f2('0xd9'))[_0xb7f2('0x9c')](),'sender':_0x20bcfa['direction']===_0xb7f2('0xdc')?_0x20bcfa['User']?_0x20bcfa[_0xb7f2('0x71')]['fullname']:'System':_0x20bcfa[_0xb7f2('0xcd')][_0xb7f2('0xce')]+(_0x20bcfa['Contact'][_0xb7f2('0xcf')]?'\x20'+_0x20bcfa['Contact'][_0xb7f2('0xcf')]:''),'body':_0x20bcfa[_0xb7f2('0x74')],'direction':_0x20bcfa['direction']===_0xb7f2('0xdc')?'A':'C','secret':_0x20bcfa[_0xb7f2('0xdd')],'read':_0x20bcfa[_0xb7f2('0x82')]};})[_0xb7f2('0x67')]()};return ejs[_0xb7f2('0xde')](path[_0xb7f2('0xcb')](config['root'],'server',_0xb7f2('0xdf'),_0xb7f2('0xe0')),{'interaction':_0x496869})[_0xb7f2('0x2b')](function(_0x58be37){var _0x125bf1=path[_0xb7f2('0xcb')](_0x5f0402,'transcript-'+_0x5dae23['id']+'-'+_0x2ad8b3+_0xb7f2('0xe1'));var _0x4a04ee={'path':_0x125bf1,'channel':_0xb7f2('0xd6'),'interactionId':_0x5dae23['id']};return pdf[_0xb7f2('0xe2')](_0x58be37,_0x4a04ee);})[_0xb7f2('0x2b')](function(){return new BPromise(function(_0x37e780,_0x2226b9){zipdir(_0x5f0402,{'saveTo':_0x57560e},function(_0x100870,_0x53bcb1){if(_0x100870)return _0x2226b9(_0x100870);return _0x37e780(_0x53bcb1);});})[_0xb7f2('0x2b')](function(){return new BPromise(function(_0x51a23a,_0x5cd9be){rimraf(_0x5f0402,function(_0x13041a){if(_0x13041a)_0x5cd9be(_0x13041a);return _0x51a23a();});});})['then'](function(){return _0x106824[_0xb7f2('0xe3')](_0x57560e,_0x90269d,function(_0x442687){if(_0x442687){console[_0xb7f2('0xe4')](_0xb7f2('0xe5'),_0x442687);}else{fs['unlinkSync'](_0x57560e);}});});});}else{return _0x106824[_0xb7f2('0x1c')](0xc8);}})[_0xb7f2('0x36')](handleError(_0x106824,null));}; \ No newline at end of file +var _0xad75=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','offset','undefined','count','limit','Content-Range','apply','update','destroy','then','error','stack','name','status','Users','map','fullname','TagIds','split','forEach','Tags','catch','talking','answered','total','closed','UserId','waiting','unmanaged','index','SmsInteraction','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','toString','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','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','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','includeAll','include','options','params','describe','addMessage','SmsMessage','ids','omit','getMessages','rawAttributes','filters','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','Tag','findAll','emit','smsInteractionTags:save','removeTags','root','server','files','tmp','join','attachments','CmContact','lastName','direction','secret','Owner','get','mkdirSync','Sms','Account','N.A.','closedAt','disposition','Messages','out','System','firstName','renderFile','views','transcript-','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','jsforce','desk.js'];(function(_0x2f345b,_0x1503eb){var _0x2c556b=function(_0x378633){while(--_0x378633){_0x2f345b['push'](_0x2f345b['shift']());}};_0x2c556b(++_0x1503eb);}(_0xad75,0xdb));var _0x5ad7=function(_0x59b50d,_0x565e44){_0x59b50d=_0x59b50d-0x0;var _0x3ca93d=_0xad75[_0x59b50d];return _0x3ca93d;};'use strict';var emlformat=require(_0x5ad7('0x0'));var rimraf=require(_0x5ad7('0x1'));var zipdir=require(_0x5ad7('0x2'));var jsonpatch=require(_0x5ad7('0x3'));var rp=require(_0x5ad7('0x4'));var moment=require(_0x5ad7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5ad7('0x6'));var util=require(_0x5ad7('0x7'));var path=require(_0x5ad7('0x8'));var sox=require('sox');var csv=require(_0x5ad7('0x9'));var ejs=require(_0x5ad7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ad7('0xb'));var deskjs=require(_0x5ad7('0xc'));var toCsv=require(_0x5ad7('0x9'));var querystring=require(_0x5ad7('0xd'));var Papa=require(_0x5ad7('0xe'));var Redis=require(_0x5ad7('0xf'));var authService=require(_0x5ad7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5ad7('0x11'));var hardwareService=require(_0x5ad7('0x12'));var logger=require(_0x5ad7('0x13'))(_0x5ad7('0x14'));var utils=require(_0x5ad7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5ad7('0x16'));var db=require('../../mysqldb')['db'];config[_0x5ad7('0x17')]=_[_0x5ad7('0x18')](config[_0x5ad7('0x17')],{'host':_0x5ad7('0x19'),'port':0x18eb});var socket=require(_0x5ad7('0x1a'))(new Redis(config['redis']));require(_0x5ad7('0x1b'))[_0x5ad7('0x1c')](socket);function respondWithStatusCode(_0x5cee24,_0x3d39a6){_0x3d39a6=_0x3d39a6||0xcc;return function(_0x303b55){if(_0x303b55){return _0x5cee24[_0x5ad7('0x1d')](_0x3d39a6);}return _0x5cee24['status'](_0x3d39a6)[_0x5ad7('0x1e')]();};}function respondWithResult(_0x489b8d,_0x337eed){_0x337eed=_0x337eed||0xc8;return function(_0x2938d7){if(_0x2938d7){return _0x489b8d['status'](_0x337eed)[_0x5ad7('0x1f')](_0x2938d7);}};}function respondWithFilteredResult(_0x2a51d5,_0x340b46){return function(_0x417fe6){if(_0x417fe6){var _0x4123a3=typeof _0x340b46[_0x5ad7('0x20')]===_0x5ad7('0x21')&&typeof _0x340b46['limit']===_0x5ad7('0x21');var _0x46b3fd=_0x417fe6[_0x5ad7('0x22')];var _0x290a3f=_0x4123a3?0x0:_0x340b46[_0x5ad7('0x20')];var _0x1408e6=_0x4123a3?_0x417fe6[_0x5ad7('0x22')]:_0x340b46[_0x5ad7('0x20')]+_0x340b46[_0x5ad7('0x23')];var _0x9b6732;if(_0x1408e6>=_0x46b3fd){_0x1408e6=_0x46b3fd;_0x9b6732=0xc8;}else{_0x9b6732=0xce;}_0x2a51d5['status'](_0x9b6732);return _0x2a51d5['set'](_0x5ad7('0x24'),_0x290a3f+'-'+_0x1408e6+'/'+_0x46b3fd)['json'](_0x417fe6);}return null;};}function patchUpdates(_0x5d181f){return function(_0x364ed7){try{jsonpatch[_0x5ad7('0x25')](_0x364ed7,_0x5d181f,!![]);}catch(_0x51e37b){return BPromise['reject'](_0x51e37b);}return _0x364ed7['save']();};}function saveUpdates(_0x46d0d6,_0x6e1f89){return function(_0x592e89){if(_0x592e89){return _0x592e89[_0x5ad7('0x26')](_0x46d0d6)['then'](function(_0x22ac6a){return _0x22ac6a;});}return null;};}function removeEntity(_0x98881c,_0x58b2a5){return function(_0x278072){if(_0x278072){return _0x278072[_0x5ad7('0x27')]()[_0x5ad7('0x28')](function(){_0x98881c['status'](0xcc)[_0x5ad7('0x1e')]();});}};}function handleEntityNotFound(_0x4eb84b,_0x129ae6){return function(_0x3c8b77){if(!_0x3c8b77){_0x4eb84b[_0x5ad7('0x1d')](0x194);}return _0x3c8b77;};}function handleError(_0x50080b,_0x38da00){_0x38da00=_0x38da00||0x1f4;return function(_0x54a85a){logger[_0x5ad7('0x29')](_0x54a85a[_0x5ad7('0x2a')]);if(_0x54a85a[_0x5ad7('0x2b')]){delete _0x54a85a[_0x5ad7('0x2b')];}_0x50080b[_0x5ad7('0x2c')](_0x38da00)['send'](_0x54a85a);};}function getInteractionUsers(_0x437f96,_0x122e9a){return new BPromise(function(_0x135d17,_0x231aa8){try{if(_0x122e9a[_0x437f96['id']]){_0x437f96[_0x5ad7('0x2d')]=_[_0x5ad7('0x2e')](_0x122e9a[_0x437f96['id']],function(_0x5255fe){return{'id':_0x5255fe['id'],'fullname':_0x5255fe[_0x5ad7('0x2f')]};});}}catch(_0xce86c7){_0x231aa8(_0xce86c7);}_0x135d17(_0x437f96);});}function getInteractionTags(_0x521c96,_0x58d485){return new BPromise(function(_0x5d4e18,_0x1d6a45){try{if(_0x521c96[_0x5ad7('0x30')]){_0x521c96['Tags']=[];_0x521c96[_0x5ad7('0x30')][_0x5ad7('0x31')](',')[_0x5ad7('0x32')](function(_0x3b095e){_0x521c96[_0x5ad7('0x33')]['push'](_0x58d485[_0x3b095e]);});}delete _0x521c96['TagIds'];}catch(_0x52405f){_0x1d6a45(_0x52405f);}_0x5d4e18(_0x521c96);});}function updateSmsInteraction(_0x4c194c,_0x4bc746,_0x474fc0){return new BPromise(function(_0x28d859,_0x4d05ec){return getInteractionUsers(_0x4c194c,_0x474fc0)[_0x5ad7('0x28')](function(_0x47669b){return getInteractionTags(_0x47669b,_0x4bc746);})['then'](function(_0x4c9123){return getStateInteraction(_0x4c9123);})['then'](function(_0x3482bd){_0x28d859(_0x3482bd);})[_0x5ad7('0x34')](function(_0xda9069){_0x4d05ec(_0xda9069);});});}function getStateInteraction(_0x9a8760){return new BPromise(function(_0x16b825){_0x9a8760['waiting']=0x0;_0x9a8760[_0x5ad7('0x35')]=0x0;_0x9a8760[_0x5ad7('0x36')]=0x0;_0x9a8760['unmanaged']=0x0;_0x9a8760[_0x5ad7('0x37')]=0x0;if(!_0x9a8760[_0x5ad7('0x38')]&&!_0x9a8760[_0x5ad7('0x39')]){_0x9a8760[_0x5ad7('0x3a')]+=0x1;}if(!_0x9a8760[_0x5ad7('0x38')]&&_0x9a8760[_0x5ad7('0x39')]){_0x9a8760[_0x5ad7('0x35')]+=0x1;if(_0x9a8760['waiting']){_0x9a8760[_0x5ad7('0x3a')]-=0x1;}}if(_0x9a8760[_0x5ad7('0x38')]&&_0x9a8760[_0x5ad7('0x39')]){_0x9a8760[_0x5ad7('0x36')]+=0x1;if(_0x9a8760[_0x5ad7('0x35')]){_0x9a8760[_0x5ad7('0x35')]-=0x1;}}if(_0x9a8760[_0x5ad7('0x38')]&&!_0x9a8760[_0x5ad7('0x39')]){_0x9a8760[_0x5ad7('0x3b')]+=0x1;if(_0x9a8760[_0x5ad7('0x3a')]){_0x9a8760['waiting']-=0x1;}}_0x9a8760[_0x5ad7('0x37')]+=0x1;_0x16b825(_0x9a8760);});}exports[_0x5ad7('0x3c')]=function(_0x20ed70,_0x511b81){var _0x44fe4d={},_0x25c566={},_0xa2d2af={'count':0x0,'rows':[]};var _0x445909=_[_0x5ad7('0x2e')](db[_0x5ad7('0x3d')]['rawAttributes'],function(_0x192aea){return{'name':_0x192aea[_0x5ad7('0x3e')],'type':_0x192aea[_0x5ad7('0x3f')][_0x5ad7('0x40')]};});_0x25c566[_0x5ad7('0x41')]=_[_0x5ad7('0x2e')](_0x445909,_0x5ad7('0x2b'));_0x25c566[_0x5ad7('0x42')]=_[_0x5ad7('0x43')](_0x20ed70[_0x5ad7('0x42')]);_0x25c566['filters']=_[_0x5ad7('0x44')](_0x25c566[_0x5ad7('0x41')],_0x25c566[_0x5ad7('0x42')]);_0x44fe4d[_0x5ad7('0x45')]=_[_0x5ad7('0x44')](_0x25c566[_0x5ad7('0x41')],qs[_0x5ad7('0x46')](_0x20ed70['query'][_0x5ad7('0x46')]));_0x44fe4d[_0x5ad7('0x45')]=_0x44fe4d['attributes'][_0x5ad7('0x47')]?_0x44fe4d[_0x5ad7('0x45')]:_0x25c566[_0x5ad7('0x41')];if(!_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x48')]('nolimit')){_0x44fe4d[_0x5ad7('0x23')]=qs[_0x5ad7('0x23')](_0x20ed70['query'][_0x5ad7('0x23')]);_0x44fe4d['offset']=qs[_0x5ad7('0x20')](_0x20ed70[_0x5ad7('0x42')]['offset']);}_0x44fe4d[_0x5ad7('0x49')]=qs[_0x5ad7('0x4a')](_0x20ed70[_0x5ad7('0x42')]['sort']);_0x44fe4d[_0x5ad7('0x4b')]=qs['filters'](_[_0x5ad7('0x4c')](_0x20ed70[_0x5ad7('0x42')],_0x25c566['filters']),_0x445909);var _0x3ac856=[];var _0x351e89=squel[_0x5ad7('0x4d')]()[_0x5ad7('0x4e')]('id')['field'](_0x5ad7('0x2b'))['field'](_0x5ad7('0x4f'))[_0x5ad7('0x50')](_0x5ad7('0x51'));var _0x265050=squel[_0x5ad7('0x4d')]()[_0x5ad7('0x4e')](_0x5ad7('0x52'))[_0x5ad7('0x4e')](_0x5ad7('0x53'))[_0x5ad7('0x4e')]('ui.SmsInteractionId')[_0x5ad7('0x50')](_0x5ad7('0x54'),'ui')[_0x5ad7('0x55')]('users','u',_0x5ad7('0x56'));var _0x4a937d=squel[_0x5ad7('0x4d')]()[_0x5ad7('0x50')](_0x5ad7('0x57'),'i')['left_join'](_0x5ad7('0x58'),'c',_0x5ad7('0x59'))[_0x5ad7('0x55')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x5ad7('0x5a'),'a',_0x5ad7('0x5b'))[_0x5ad7('0x55')](_0x5ad7('0x5c'),'me',_0x5ad7('0x5d'))[_0x5ad7('0x55')](_0x5ad7('0x5e'),'it',_0x5ad7('0x5f'))[_0x5ad7('0x55')](_0x5ad7('0x51'),'t',_0x5ad7('0x60'));var _0x2b55ce=squel[_0x5ad7('0x61')]();var _0x3860b5=[];var _0x162996=squel[_0x5ad7('0x61')]();var _0xf3e2ba;if(_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x62')]){_0xf3e2ba=as[_0x5ad7('0x63')](_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x62')]);var _0x56d174=_0xf3e2ba[_0x5ad7('0x64')];for(var _0x3070c6=0x0;_0x3070c6<_0xf3e2ba['conditions'][_0x5ad7('0x47')];_0x3070c6++){var _0x54c2ff=_0xf3e2ba[_0x5ad7('0x65')][_0x3070c6];var _0x361695='i';var _0x2693ad=_[_0x5ad7('0x66')](_0x445909,[_0x5ad7('0x2b'),_0x54c2ff[_0x5ad7('0x4e')]]);if(!_0x2693ad){switch(_0x54c2ff[_0x5ad7('0x4e')]){case'unreadMessages':if(_0x54c2ff[_0x5ad7('0x67')]==0x1){_0x4a937d[_0x5ad7('0x68')]('`'+_0x54c2ff[_0x5ad7('0x4e')]+_0x5ad7('0x69'));}else{_0x4a937d[_0x5ad7('0x68')]('`'+_0x54c2ff['field']+_0x5ad7('0x6a'));}break;case _0x5ad7('0x6b'):if(_0x54c2ff[_0x5ad7('0x6c')]===_0x5ad7('0x6d')){if(_0x54c2ff[_0x5ad7('0x67')][_0x5ad7('0x31')]('\x20')[_0x5ad7('0x47')]>0x1){_0x2b55ce[_0x56d174](_0x5ad7('0x6e'),qs['getFullTextValue'](_0x54c2ff[_0x5ad7('0x67')]),null);}else{var _0x1ddfae='%'+_0x54c2ff['value']+'%';_0x2b55ce[_0x56d174](_0x5ad7('0x6f'),_0x1ddfae,_0x1ddfae,_0x1ddfae);}}else{_0x2693ad=_[_0x5ad7('0x66')](_0x445909,[_0x5ad7('0x2b'),'ContactId']);_0x54c2ff[_0x5ad7('0x4e')]=_0x5ad7('0x70');_0xb397f8=as[_0x5ad7('0x71')](_0x361695,_0x2693ad[_0x5ad7('0x3f')],_0x54c2ff);_0x2b55ce[_0x56d174](_0xb397f8[_0x5ad7('0x72')],_0xb397f8[_0x5ad7('0x67')][_0x5ad7('0x73')],_0xb397f8['value'][_0x5ad7('0x1e')]);}break;case'Tag':var _0x4761d1=_0x54c2ff[_0x5ad7('0x67')]['split'](',')[_0x5ad7('0x2e')](function(_0x310922){return Number(_0x310922);});_0x4761d1[_0x5ad7('0x32')](function(_0x4cd482){_0x162996['or'](_0x5ad7('0x74'),'%,'+_0x4cd482+',%');});_0x3860b5=_[_0x5ad7('0x75')](_0x3860b5,_0x4761d1);break;case _0x5ad7('0x76'):if(_0x54c2ff[_0x5ad7('0x6c')]==='$substring'){_0x2b55ce[_0x56d174](_0x5ad7('0x77'),'%'+_0x54c2ff[_0x5ad7('0x67')]+'%',null);}else{_0x2693ad=_[_0x5ad7('0x66')](_0x445909,[_0x5ad7('0x2b'),_0x5ad7('0x39')]);_0x54c2ff['field']=_0x5ad7('0x39');_0xb397f8=as[_0x5ad7('0x71')](_0x361695,_0x2693ad[_0x5ad7('0x3f')],_0x54c2ff);_0x2b55ce[_0x56d174](_0xb397f8['text'],_0xb397f8[_0x5ad7('0x67')][_0x5ad7('0x73')],_0xb397f8[_0x5ad7('0x67')][_0x5ad7('0x1e')]);}break;case _0x5ad7('0x78'):_0xb397f8=as[_0x5ad7('0x71')]('me',null,_0x54c2ff);_0x2b55ce[_0x56d174](_0xb397f8[_0x5ad7('0x72')],_0xb397f8[_0x5ad7('0x67')]['start'],_0xb397f8[_0x5ad7('0x67')][_0x5ad7('0x1e')]);break;}}else{var _0xb397f8=as[_0x5ad7('0x71')](_0x361695,_0x2693ad[_0x5ad7('0x3f')],_0x54c2ff);_0x2b55ce[_0x56d174](_0xb397f8[_0x5ad7('0x72')],_0xb397f8[_0x5ad7('0x67')][_0x5ad7('0x73')],_0xb397f8[_0x5ad7('0x67')]['end']);}}}else{var _0x19a1d4=_(_0x20ed70[_0x5ad7('0x42')])[_0x5ad7('0x43')]()[_0x5ad7('0x2e')](function(_0x30ebb1){return _[_0x5ad7('0x79')](_0x445909,[_0x5ad7('0x2b'),_0x30ebb1])?_0x30ebb1:undefined;})[_0x5ad7('0x7a')]()[_0x5ad7('0x67')]();if(!_[_0x5ad7('0x7b')](_0x19a1d4)){_0x19a1d4[_0x5ad7('0x32')](function(_0x16ed54){if(_0x16ed54==='SmsAccountId'){_0x4a937d[_0x5ad7('0x4b')]('i.SmsAccountId\x20IN\x20?',[][_0x5ad7('0x7c')](_0x20ed70[_0x5ad7('0x42')][_0x16ed54]));}else if(_0x16ed54===_0x5ad7('0x7d')){var _0x51ef0d=JSON['parse'](_0x20ed70[_0x5ad7('0x42')][_0x16ed54])['$gte'];var _0x59c0f4=JSON[_0x5ad7('0x7e')](_0x20ed70[_0x5ad7('0x42')][_0x16ed54])[_0x5ad7('0x7f')];_0x4a937d[_0x5ad7('0x4b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51ef0d,_0x59c0f4);}else{if(_0x20ed70[_0x5ad7('0x42')][_0x16ed54]===_0x5ad7('0x80')){_0x4a937d[_0x5ad7('0x4b')]('i.'+_0x16ed54+_0x5ad7('0x81'));}else{_0x4a937d[_0x5ad7('0x4b')]('i.'+_0x16ed54+_0x5ad7('0x82'),_0x20ed70[_0x5ad7('0x42')][_0x16ed54]);}}});}if(_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x83')]){if(_0x20ed70['query'][_0x5ad7('0x83')]==0x1){_0x4a937d[_0x5ad7('0x68')](_0x5ad7('0x84'));}else{_0x4a937d['having'](_0x5ad7('0x85'));}}if(_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x86')]){_0x3860b5=_[_0x5ad7('0x87')](_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x86')])?_0x20ed70['query'][_0x5ad7('0x86')]:new Array(_0x20ed70[_0x5ad7('0x42')]['tag']);_0x3860b5['forEach'](function(_0x861f7f){_0x162996['or'](_0x5ad7('0x74'),'%,'+_0x861f7f+',%');});}if(_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x88')]){var _0x320d59=_0x20ed70['query'][_0x5ad7('0x88')][_0x5ad7('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5ad7('0x8a')](_0x320d59)){_0x2b55ce['or'](_0x5ad7('0x8b'),_0x320d59+'%')['or']('i.phone\x20LIKE\x20?',_0x320d59+'%');}else{_0x2b55ce['or'](_0x5ad7('0x8c'),qs['getFullTextValue'](_0x320d59))['or'](_0x5ad7('0x8d'),_0x320d59+'%');}}}_0x4a937d[_0x5ad7('0x4b')](_0x2b55ce);_0x4a937d['group'](_0x5ad7('0x8e'));var _0x359c4e={'type':db[_0x5ad7('0x8f')][_0x5ad7('0x90')][_0x5ad7('0x91')],'raw':!![]};var _0x4e8366=_0x4a937d['clone']();_0x4e8366[_0x5ad7('0x4e')](_0x5ad7('0x8e'));_0x4e8366[_0x5ad7('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5ad7('0x92'));if(_0x44fe4d[_0x5ad7('0x49')]){_0x44fe4d[_0x5ad7('0x49')][_0x5ad7('0x32')](function(_0x4c2433){var _0xdbf60f=_0x4c2433[0x0]===_0x5ad7('0x93')?_0x4c2433[0x0]:'i.'+_0x4c2433[0x0];_0x4a937d[_0x5ad7('0x49')](_0xdbf60f,_0x4c2433[0x1]===_0x5ad7('0x94')?![]:!![]);});}if(!_[_0x5ad7('0x7b')](_0x3860b5)){_0x4a937d[_0x5ad7('0x68')](_0x162996);_0x4e8366[_0x5ad7('0x4b')](_0x5ad7('0x95'),_0x3860b5);}BPromise[_0x5ad7('0x96')]()['then'](function(){if(!_0xf3e2ba){if(_0x20ed70['query'][_0x5ad7('0x97')])return;_0x4e8366[_0x5ad7('0x4b')](_0x5ad7('0x98'));_0x4a937d[_0x5ad7('0x4b')](_0x5ad7('0x98'));return;}if(_0x20ed70[_0x5ad7('0x99')]['role']!==_0x5ad7('0x9a'))return;return _0x20ed70[_0x5ad7('0x99')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x5ad7('0x28')](function(_0x388f9d){if(_['isEmpty'](_0x388f9d)){_0x4e8366[_0x5ad7('0x4b')](_0x5ad7('0x9b'));_0x4a937d[_0x5ad7('0x4b')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x4e8366[_0x5ad7('0x4b')](_0x5ad7('0x9c'),_[_0x5ad7('0x2e')](_0x388f9d,'id'));_0x4a937d['where'](_0x5ad7('0x9c'),_[_0x5ad7('0x2e')](_0x388f9d,'id'));}});})[_0x5ad7('0x28')](function(){if(_0x20ed70[_0x5ad7('0x99')][_0x5ad7('0x9d')]===_0x5ad7('0x9a')&&!_0xf3e2ba&&!_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x97')])return[];return db['sequelize'][_0x5ad7('0x42')](_0x4e8366[_0x5ad7('0x9e')](),_0x359c4e);})[_0x5ad7('0x28')](function(_0x26a171){_0xa2d2af['count']=_0x26a171['length'];if(_0xa2d2af['count']===0x0)return[];return db[_0x5ad7('0x9f')][_0x5ad7('0x42')](_0x351e89[_0x5ad7('0x9e')](),_0x359c4e)[_0x5ad7('0x28')](function(_0x52b017){_0x3ac856=_[_0x5ad7('0xa0')](_0x52b017,'id');_0x359c4e=_[_0x5ad7('0xa1')](_0x359c4e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20ed70[_0x5ad7('0x42')][_0x5ad7('0x46')]){_0x44fe4d['attributes'][_0x5ad7('0x32')](function(_0x386b6f){_0x4a937d[_0x5ad7('0x4e')]('i.'+_0x386b6f);});}else{_0x4a937d[_0x5ad7('0x4e')](_0x5ad7('0xa2'),'unreadMessages');_0x4a937d['field'](_0x5ad7('0xa3'),'Account.key');_0x4a937d[_0x5ad7('0x4e')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4a937d[_0x5ad7('0x4e')](_0x5ad7('0xa4'),_0x5ad7('0x93'));_0x4a937d[_0x5ad7('0x4e')]('i.*');_0x4a937d[_0x5ad7('0x4e')](_0x5ad7('0xa5'),_0x5ad7('0xa6'));_0x4a937d[_0x5ad7('0x4e')]('c.lastName',_0x5ad7('0xa7'));_0x4a937d[_0x5ad7('0x4e')](_0x5ad7('0xa8'),'Contact.email');_0x4a937d[_0x5ad7('0x4e')]('c.phone',_0x5ad7('0xa9'));_0x4a937d['field']('c.mobile',_0x5ad7('0xaa'));_0x4a937d['field'](_0x5ad7('0xab'),'Contact.fax');_0x4a937d[_0x5ad7('0x4e')]('o.fullname',_0x5ad7('0xac'));_0x4a937d['field'](_0x5ad7('0xad'),'Owner.internal');_0x4a937d[_0x5ad7('0x4e')](_0x5ad7('0xae'),'TagIds');}if(_0x44fe4d['limit'])_0x4a937d[_0x5ad7('0x23')](_0x44fe4d['limit']);if(_0x44fe4d['offset'])_0x4a937d['offset'](_0x44fe4d[_0x5ad7('0x20')]);return db[_0x5ad7('0x9f')][_0x5ad7('0x42')](_0x4a937d[_0x5ad7('0x9e')](),_0x359c4e);})[_0x5ad7('0x28')](function(_0xfdde6a){if(_0xfdde6a[_0x5ad7('0x47')]>0x0)_0x265050['where'](_0x5ad7('0xaf'),_['map'](_0xfdde6a,'id'));return db[_0x5ad7('0x9f')][_0x5ad7('0x42')](_0x265050['toString'](),_0x359c4e)[_0x5ad7('0x28')](function(_0x573866){var _0x2e29a4=_[_0x5ad7('0xb0')](_0x573866,_0x5ad7('0xb1'));var _0x55f720=[];_0xfdde6a[_0x5ad7('0x32')](function(_0x558393){_0x55f720[_0x5ad7('0xb2')](updateSmsInteraction(_0x558393,_0x3ac856,_0x2e29a4));});return BPromise[_0x5ad7('0xb3')](_0x55f720);});});})[_0x5ad7('0x28')](function(_0xfd1bf8){_0xa2d2af[_0x5ad7('0xb4')]=_0xfd1bf8;return _0xa2d2af;})[_0x5ad7('0x28')](respondWithFilteredResult(_0x511b81,_0x44fe4d))[_0x5ad7('0x34')](handleError(_0x511b81,null));};exports['show']=function(_0x4b2d0c,_0x3f2253){var _0x2e7ce4={'raw':![],'where':{'id':_0x4b2d0c['params']['id']}},_0x2591e4={};_0x2591e4['model']=_['keys'](db[_0x5ad7('0x3d')]['rawAttributes']);_0x2591e4[_0x5ad7('0x42')]=_['keys'](_0x4b2d0c[_0x5ad7('0x42')]);_0x2591e4['filters']=_[_0x5ad7('0x44')](_0x2591e4['model'],_0x2591e4[_0x5ad7('0x42')]);_0x2e7ce4[_0x5ad7('0x45')]=_[_0x5ad7('0x44')](_0x2591e4[_0x5ad7('0x41')],qs['fields'](_0x4b2d0c[_0x5ad7('0x42')][_0x5ad7('0x46')]));_0x2e7ce4[_0x5ad7('0x45')]=_0x2e7ce4[_0x5ad7('0x45')]['length']?_0x2e7ce4[_0x5ad7('0x45')]:_0x2591e4[_0x5ad7('0x41')];if(_0x4b2d0c['query'][_0x5ad7('0xb5')]){_0x2e7ce4[_0x5ad7('0xb6')]=[{'all':!![]}];}_0x2e7ce4=_[_0x5ad7('0xa1')]({},_0x2e7ce4,_0x4b2d0c[_0x5ad7('0xb7')]);return db[_0x5ad7('0x3d')][_0x5ad7('0x66')](_0x2e7ce4)[_0x5ad7('0x28')](handleEntityNotFound(_0x3f2253,null))['then'](respondWithResult(_0x3f2253,null))['catch'](handleError(_0x3f2253,null));};exports['create']=function(_0x55a0c2,_0x3c0e77){return db['SmsInteraction']['create'](_0x55a0c2['body'],{})['then'](respondWithResult(_0x3c0e77,0xc9))[_0x5ad7('0x34')](handleError(_0x3c0e77,null));};exports[_0x5ad7('0x26')]=function(_0x4c5e21,_0x481a00){if(_0x4c5e21[_0x5ad7('0x78')]['id']){delete _0x4c5e21['body']['id'];}return db[_0x5ad7('0x3d')][_0x5ad7('0x66')]({'where':{'id':_0x4c5e21[_0x5ad7('0xb8')]['id']}})[_0x5ad7('0x28')](handleEntityNotFound(_0x481a00,null))['then'](saveUpdates(_0x4c5e21[_0x5ad7('0x78')],null))[_0x5ad7('0x28')](respondWithResult(_0x481a00,null))[_0x5ad7('0x34')](handleError(_0x481a00,null));};exports[_0x5ad7('0x27')]=function(_0x19c351,_0x464b98){return db[_0x5ad7('0x3d')][_0x5ad7('0x66')]({'where':{'id':_0x19c351['params']['id']}})['then'](handleEntityNotFound(_0x464b98,null))['then'](removeEntity(_0x464b98,null))[_0x5ad7('0x34')](handleError(_0x464b98,null));};exports[_0x5ad7('0xb9')]=function(_0x126e6f,_0x4cfd58){return db[_0x5ad7('0x3d')][_0x5ad7('0xb9')]()[_0x5ad7('0x28')](respondWithResult(_0x4cfd58,null))[_0x5ad7('0x34')](handleError(_0x4cfd58,null));};exports[_0x5ad7('0xba')]=function(_0x5e8729,_0x1c3651,_0x53ed7d){return db[_0x5ad7('0xbb')]['find']({'where':{'id':_0x5e8729[_0x5ad7('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1c3651,null))['then'](function(_0x17dba2){if(_0x17dba2){return _0x17dba2[_0x5ad7('0xba')](_0x5e8729[_0x5ad7('0x78')][_0x5ad7('0xbc')],_[_0x5ad7('0xbd')](_0x5e8729[_0x5ad7('0x78')],[_0x5ad7('0xbc'),'id'])||{});}})[_0x5ad7('0x28')](respondWithResult(_0x1c3651,null))[_0x5ad7('0x34')](handleError(_0x1c3651,null));};exports[_0x5ad7('0xbe')]=function(_0xe96406,_0x300f2c,_0xcef0d5){var _0xefd74f={'raw':![],'where':{}};var _0x279149={};var _0x63e998={'count':0x0,'rows':[]};return db[_0x5ad7('0x3d')]['findOne']({'where':{'id':_0xe96406[_0x5ad7('0xb8')]['id']}})[_0x5ad7('0x28')](handleEntityNotFound(_0x300f2c,null))[_0x5ad7('0x28')](function(_0x3b3c2a){if(_0x3b3c2a){_0x279149['model']=_[_0x5ad7('0x43')](db[_0x5ad7('0xbb')][_0x5ad7('0xbf')]);_0x279149[_0x5ad7('0x42')]=_[_0x5ad7('0x43')](_0xe96406['query']);_0x279149[_0x5ad7('0xc0')]=_[_0x5ad7('0x44')](_0x279149[_0x5ad7('0x41')],_0x279149[_0x5ad7('0x42')]);_0xefd74f[_0x5ad7('0x45')]=_[_0x5ad7('0x44')](_0x279149[_0x5ad7('0x41')],qs[_0x5ad7('0x46')](_0xe96406[_0x5ad7('0x42')][_0x5ad7('0x46')]));_0xefd74f[_0x5ad7('0x45')]=_0xefd74f[_0x5ad7('0x45')]['length']?_0xefd74f[_0x5ad7('0x45')]:_0x279149['model'];if(!_0xe96406[_0x5ad7('0x42')][_0x5ad7('0x48')]('nolimit')){_0xefd74f[_0x5ad7('0x23')]=qs[_0x5ad7('0x23')](_0xe96406[_0x5ad7('0x42')]['limit']);_0xefd74f[_0x5ad7('0x20')]=qs['offset'](_0xe96406[_0x5ad7('0x42')]['offset']);}_0xefd74f[_0x5ad7('0x49')]=qs[_0x5ad7('0x4a')](_0xe96406['query']['sort']);_0xefd74f[_0x5ad7('0x4b')]=qs[_0x5ad7('0xc0')](_[_0x5ad7('0x4c')](_0xe96406[_0x5ad7('0x42')],_0x279149[_0x5ad7('0xc0')]));_0xefd74f['where'][_0x5ad7('0xb1')]=_0x3b3c2a['id'];if(_0xe96406[_0x5ad7('0x42')][_0x5ad7('0x88')]){_0xefd74f[_0x5ad7('0x4b')]=_[_0x5ad7('0xa1')](_0xefd74f['where'],{'$or':_[_0x5ad7('0x2e')](_0xefd74f[_0x5ad7('0x45')],function(_0x155695){var _0x2de8c7={};_0x2de8c7[_0x155695]={'$like':'%'+_0xe96406['query'][_0x5ad7('0x88')]+'%'};return _0x2de8c7;})});}if(_0xe96406[_0x5ad7('0x42')][_0x5ad7('0xc1')]){var _0x4ad4af=_0xe96406['query']['$gte'][_0x5ad7('0x31')](',');var _0x4c81e9={};_0x4c81e9[_0x4ad4af[0x0]]={'$gte':moment(_0x4ad4af[0x1])[_0x5ad7('0xc2')](_0x5ad7('0xc3'))};_0xefd74f[_0x5ad7('0x4b')]=_[_0x5ad7('0xa1')](_0xefd74f[_0x5ad7('0x4b')],_0x4c81e9);}_0xefd74f=_[_0x5ad7('0xa1')]({},_0xefd74f,_0xe96406[_0x5ad7('0xb7')]);return db[_0x5ad7('0xbb')]['count']({'where':_0xefd74f[_0x5ad7('0x4b')]})[_0x5ad7('0x28')](function(_0x30d45e){_0x63e998['count']=_0x30d45e;if(_0xe96406[_0x5ad7('0x42')][_0x5ad7('0xb5')]){_0xefd74f[_0x5ad7('0xb6')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0xefd74f);})['then'](function(_0x6f7680){_0x63e998['rows']=_0x6f7680;return _0x63e998;});}})['then'](respondWithFilteredResult(_0x300f2c,_0xefd74f))[_0x5ad7('0x34')](handleError(_0x300f2c,null));};exports[_0x5ad7('0xc4')]=function(_0x4987e2,_0x5058b5,_0x120f39){return db[_0x5ad7('0x3d')][_0x5ad7('0x66')]({'where':{'id':_0x4987e2[_0x5ad7('0xb8')]['id']}})['then'](handleEntityNotFound(_0x5058b5,null))['then'](function(_0x49459a){if(_0x49459a){return _0x49459a[_0x5ad7('0xc5')](_0x4987e2['body'][_0x5ad7('0xbc')],_[_0x5ad7('0xbd')](_0x4987e2[_0x5ad7('0x78')],[_0x5ad7('0xbc'),'id'])||{})['spread'](function(){return db[_0x5ad7('0xc6')][_0x5ad7('0xc7')]({'attributes':['id',_0x5ad7('0x2b'),_0x5ad7('0x4f')],'where':{'id':_0x4987e2[_0x5ad7('0x78')][_0x5ad7('0xbc')]}});})[_0x5ad7('0x28')](function(_0xcf8509){socket[_0x5ad7('0xc8')](_0x5ad7('0xc9'),{'id':Number(_0x4987e2[_0x5ad7('0xb8')]['id']),'tags':_0xcf8509||[]});return{'id':Number(_0x4987e2['params']['id']),'tags':_0xcf8509||[]};});}})[_0x5ad7('0x28')](respondWithResult(_0x5058b5,null))[_0x5ad7('0x34')](handleError(_0x5058b5,null));};exports[_0x5ad7('0xca')]=function(_0x28d80f,_0x5697b6,_0xf35cc1){return db[_0x5ad7('0x3d')][_0x5ad7('0x66')]({'where':{'id':_0x28d80f[_0x5ad7('0xb8')]['id']}})[_0x5ad7('0x28')](handleEntityNotFound(_0x5697b6,null))[_0x5ad7('0x28')](function(_0x22689a){if(_0x22689a){return _0x22689a[_0x5ad7('0xca')](_0x28d80f['query'][_0x5ad7('0xbc')]);}})[_0x5ad7('0x28')](respondWithStatusCode(_0x5697b6,null))['catch'](handleError(_0x5697b6,null));};exports['download']=function(_0x4987d4,_0x882812){var _0x7dd601=moment()['unix']()[_0x5ad7('0x9e')]();var _0x48456d=path['join'](config[_0x5ad7('0xcb')],_0x5ad7('0xcc'),_0x5ad7('0xcd'),_0x5ad7('0xce'));var _0x4a1db6=path[_0x5ad7('0xcf')](config['root'],_0x5ad7('0xcc'),_0x5ad7('0xcd'),_0x5ad7('0xd0'));var _0x59df1d=path['join'](_0x48456d,_0x7dd601);var _0x11d904=util[_0x5ad7('0xc2')]('transcript-%d-%s.zip',_0x4987d4['params']['id'],_0x7dd601);var _0x27bde2=path[_0x5ad7('0xcf')](_0x48456d,_0x11d904);var _0x2c37c4=[];_0x2c37c4[_0x5ad7('0xb2')]({'model':db[_0x5ad7('0x76')],'as':_0x5ad7('0x76'),'attributes':['id',_0x5ad7('0x2f')],'raw':!![]});_0x2c37c4['push']({'model':db[_0x5ad7('0xd1')],'as':_0x5ad7('0x6b'),'attributes':['id','firstName',_0x5ad7('0xd2')],'raw':!![]});var _0x2f8195=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x5ad7('0x78'),_0x5ad7('0x7d'),_0x5ad7('0xd3'),_0x5ad7('0xd4'),_0x5ad7('0x83')],'include':_0x2c37c4}];_0x2f8195[_0x5ad7('0xb2')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x5ad7('0x2b')]});_0x2f8195[_0x5ad7('0xb2')]({'model':db[_0x5ad7('0x76')],'as':_0x5ad7('0xd5'),'attributes':['id','fullname']});return db[_0x5ad7('0x3d')][_0x5ad7('0x66')]({'where':{'id':_0x4987d4[_0x5ad7('0xb8')]['id']},'include':_0x2f8195})[_0x5ad7('0x28')](handleEntityNotFound(_0x882812,null))[_0x5ad7('0x28')](function(_0x2544c8){if(_0x2544c8){var _0x504887=_0x2544c8[_0x5ad7('0xd6')]({'plain':!![]});fs[_0x5ad7('0xd7')](_0x59df1d);var _0x5d020c={'channel':_0x5ad7('0xd8'),'account':_0x504887[_0x5ad7('0xd9')][_0x5ad7('0x2b')],'agent':_0x504887['Owner']?_0x504887[_0x5ad7('0xd5')]['fullname']:_0x5ad7('0xda'),'createdAt':moment(_0x504887[_0x5ad7('0x7d')])[_0x5ad7('0xc2')](_0x5ad7('0xc3'))[_0x5ad7('0x9e')](),'closedAt':_0x504887[_0x5ad7('0x38')]?moment(_0x504887[_0x5ad7('0xdb')])[_0x5ad7('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5ad7('0x9e')]():'','disposition':_0x504887[_0x5ad7('0xdc')],'messages':_(_0x504887[_0x5ad7('0xdd')])[_0x5ad7('0x88')]({'secret':![]})[_0x5ad7('0x2e')](function(_0x26dd09){return{'date':moment(_0x26dd09['createdAt'])[_0x5ad7('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5ad7('0x9e')](),'sender':_0x26dd09['direction']===_0x5ad7('0xde')?_0x26dd09[_0x5ad7('0x76')]?_0x26dd09[_0x5ad7('0x76')]['fullname']:_0x5ad7('0xdf'):_0x26dd09[_0x5ad7('0x6b')][_0x5ad7('0xe0')]+(_0x26dd09['Contact'][_0x5ad7('0xd2')]?'\x20'+_0x26dd09[_0x5ad7('0x6b')][_0x5ad7('0xd2')]:''),'body':_0x26dd09['body'],'direction':_0x26dd09[_0x5ad7('0xd3')]===_0x5ad7('0xde')?'A':'C','secret':_0x26dd09[_0x5ad7('0xd4')],'read':_0x26dd09[_0x5ad7('0x83')]};})[_0x5ad7('0x67')]()};return ejs[_0x5ad7('0xe1')](path[_0x5ad7('0xcf')](config[_0x5ad7('0xcb')],_0x5ad7('0xcc'),_0x5ad7('0xe2'),'downloadInteraction.ejs'),{'interaction':_0x5d020c})[_0x5ad7('0x28')](function(_0x4e10f7){var _0xd03d51=path[_0x5ad7('0xcf')](_0x59df1d,_0x5ad7('0xe3')+_0x504887['id']+'-'+_0x7dd601+'.pdf');var _0x2fc154={'path':_0xd03d51,'channel':_0x5ad7('0xd8'),'interactionId':_0x504887['id']};return pdf[_0x5ad7('0xe4')](_0x4e10f7,_0x2fc154);})[_0x5ad7('0x28')](function(){return new BPromise(function(_0xd61761,_0x49576e){zipdir(_0x59df1d,{'saveTo':_0x27bde2},function(_0x54a050,_0x2bf308){if(_0x54a050)return _0x49576e(_0x54a050);return _0xd61761(_0x2bf308);});})['then'](function(){return new BPromise(function(_0x1f4e69,_0x559563){rimraf(_0x59df1d,function(_0xe522a1){if(_0xe522a1)_0x559563(_0xe522a1);return _0x1f4e69();});});})[_0x5ad7('0x28')](function(){return _0x882812[_0x5ad7('0xe5')](_0x27bde2,_0x11d904,function(_0xb3fe8){if(_0xb3fe8){console['log'](_0x5ad7('0xe6'),_0xb3fe8);}else{fs[_0x5ad7('0xe7')](_0x27bde2);}});});});}else{return _0x882812[_0x5ad7('0x1d')](0xc8);}})['catch'](handleError(_0x882812,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e13790e..5c79b56 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 _0x4137=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x56b88c,_0x5b2aab){var _0x5a0854=function(_0x5786c6){while(--_0x5786c6){_0x56b88c['push'](_0x56b88c['shift']());}};_0x5a0854(++_0x5b2aab);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0x7413('0x0'));var SmsInteraction=require(_0x7413('0x1'))['db'][_0x7413('0x2')];var SmsMessage=require(_0x7413('0x1'))['db'][_0x7413('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7413('0x4')](0x0);var events={'afterCreate':_0x7413('0x5'),'afterUpdate':_0x7413('0x6'),'afterDestroy':_0x7413('0x7')};function emitEvent(_0x3dc48a){return function(_0x451a96,_0x3bb181,_0x4fbade){_0x451a96[_0x7413('0x8')]({'attributes':['id'],'raw':!![]})[_0x7413('0x9')](function(_0x5b39ac){_0x451a96[_0x7413('0xa')]('Users',_0x5b39ac[_0x7413('0xb')](function(_0x120dc2){return{'id':_0x120dc2['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x451a96['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7413('0x9')](function(_0x2f4b54){_0x451a96['setDataValue'](_0x7413('0xc'),_0x2f4b54[_0x7413('0xd')]);SmsInteractionEvents[_0x7413('0xe')](_0x3dc48a+':'+_0x451a96['id'],_0x451a96);SmsInteractionEvents[_0x7413('0xe')](_0x3dc48a,_0x451a96);_0x4fbade(null);})[_0x7413('0xf')](_0x4fbade(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x7413('0x10')](e,emitEvent(event));}}module[_0x7413('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xdb28=['Users','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','setDataValue'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xdb28,0x106));var _0x8db2=function(_0x3fa4b7,_0x3d262f){_0x3fa4b7=_0x3fa4b7-0x0;var _0x31e4d5=_0xdb28[_0x3fa4b7];return _0x31e4d5;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var SmsInteraction=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var SmsMessage=require(_0x8db2('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':_0x8db2('0x4'),'afterUpdate':_0x8db2('0x5'),'afterDestroy':_0x8db2('0x6')};function emitEvent(_0x11109e){return function(_0x52bf99,_0x21a03e,_0x1d2dd3){_0x52bf99['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x477f50){_0x52bf99[_0x8db2('0x7')](_0x8db2('0x8'),_0x477f50[_0x8db2('0x9')](function(_0x2f3f2f){return{'id':_0x2f3f2f['id']};}));return SmsMessage[_0x8db2('0xa')]({'where':{'SmsInteractionId':_0x52bf99['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8db2('0xb')](function(_0x4ba340){_0x52bf99[_0x8db2('0x7')](_0x8db2('0xc'),_0x4ba340[_0x8db2('0xd')]);SmsInteractionEvents['emit'](_0x11109e+':'+_0x52bf99['id'],_0x52bf99);SmsInteractionEvents[_0x8db2('0xe')](_0x11109e,_0x52bf99);_0x1d2dd3(null);})[_0x8db2('0xf')](_0x1d2dd3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8db2('0x10')](e,emitEvent(event));}}module[_0x8db2('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 914a610..dda0809 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 _0xf0c7=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x11bbbf,_0x259fb5){var _0x35237b=function(_0x3278c0){while(--_0x3278c0){_0x11bbbf['push'](_0x11bbbf['shift']());}};_0x35237b(++_0x259fb5);}(_0xf0c7,0xa3));var _0x7f0c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0c7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7f0c('0x0'));var util=require(_0x7f0c('0x1'));var logger=require(_0x7f0c('0x2'))('api');var moment=require(_0x7f0c('0x3'));var BPromise=require(_0x7f0c('0x4'));var rp=require(_0x7f0c('0x5'));var fs=require('fs');var path=require(_0x7f0c('0x6'));var rimraf=require('rimraf');var config=require(_0x7f0c('0x7'));var attributes=require(_0x7f0c('0x8'));module[_0x7f0c('0x9')]=function(_0x409f93,_0x47dccc){return _0x409f93[_0x7f0c('0xa')](_0x7f0c('0xb'),attributes,{'tableName':_0x7f0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x811605,_0x5ca59a,_0x555d1d){if(_0x811605['changed']('closed')){_0x811605[_0x7f0c('0xd')]=moment()['format'](_0x7f0c('0xe'));}_0x555d1d(null,_0x811605);}}});}; \ No newline at end of file +var _0x361b=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x361b,0xae));var _0xb361=function(_0x4f3129,_0x1e6cea){_0x4f3129=_0x4f3129-0x0;var _0xdcb62d=_0x361b[_0x4f3129];return _0xdcb62d;};'use strict';var _=require(_0xb361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb361('0x1'));var moment=require(_0xb361('0x2'));var BPromise=require(_0xb361('0x3'));var rp=require(_0xb361('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb361('0x5'));var config=require(_0xb361('0x6'));var attributes=require(_0xb361('0x7'));module[_0xb361('0x8')]=function(_0x1d9672,_0x20f7c7){return _0x1d9672[_0xb361('0x9')](_0xb361('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54c4c2,_0x151b9d,_0x256a31){if(_0x54c4c2[_0xb361('0xb')](_0xb361('0xc'))){_0x54c4c2[_0xb361('0xd')]=moment()[_0xb361('0xe')](_0xb361('0xf'));}_0x256a31(null,_0x54c4c2);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 372dd0c..5d1e39d 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 _0xe4c0=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','catch','AddTagsToSmsInteraction','find','ids','omit','AddTags','util','moment'];(function(_0x53be66,_0x9ec3be){var _0x9e5520=function(_0x5c4742){while(--_0x5c4742){_0x53be66['push'](_0x53be66['shift']());}};_0x9e5520(++_0x9ec3be);}(_0xe4c0,0x17a));var _0x0e4c=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xe4c0[_0x282a1f];return _0x296ea7;};'use strict';var _=require('lodash');var util=require(_0x0e4c('0x0'));var moment=require(_0x0e4c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e4c('0x2'));var db=require(_0x0e4c('0x3'))['db'];var utils=require(_0x0e4c('0x4'));var logger=require('../../config/logger')(_0x0e4c('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e4c('0x6'));var client=jayson[_0x0e4c('0x7')]['http']({'port':0x232a});config[_0x0e4c('0x8')]=_[_0x0e4c('0x9')](config[_0x0e4c('0x8')],{'host':_0x0e4c('0xa'),'port':0x18eb});var socket=require(_0x0e4c('0xb'))(new Redis(config[_0x0e4c('0x8')]));require(_0x0e4c('0xc'))[_0x0e4c('0xd')](socket);function respondWithRpcPromise(_0x452763,_0x1c8394,_0x4a36db){return new BPromise(function(_0x1deba4,_0x6d19dd){return client['request'](_0x452763,_0x4a36db)[_0x0e4c('0xe')](function(_0x5db88b){logger['info'](_0x0e4c('0xf'),_0x1c8394,_0x0e4c('0x10'));logger[_0x0e4c('0x11')](_0x0e4c('0x12'),_0x1c8394,'request\x20sent',JSON[_0x0e4c('0x13')](_0x5db88b));if(_0x5db88b[_0x0e4c('0x14')]){if(_0x5db88b[_0x0e4c('0x14')][_0x0e4c('0x15')]===0x1f4){logger[_0x0e4c('0x14')](_0x0e4c('0xf'),_0x1c8394,_0x5db88b[_0x0e4c('0x14')][_0x0e4c('0x16')]);return _0x6d19dd(_0x5db88b['error']['message']);}logger[_0x0e4c('0x14')](_0x0e4c('0xf'),_0x1c8394,_0x5db88b[_0x0e4c('0x14')][_0x0e4c('0x16')]);return _0x1deba4(_0x5db88b['error'][_0x0e4c('0x16')]);}else{logger[_0x0e4c('0x17')](_0x0e4c('0xf'),_0x1c8394,_0x0e4c('0x10'));_0x1deba4(_0x5db88b[_0x0e4c('0x18')][_0x0e4c('0x16')]);}})['catch'](function(_0x9c4fe8){logger['error'](_0x0e4c('0xf'),_0x1c8394,_0x9c4fe8);_0x6d19dd(_0x9c4fe8);});});}exports[_0x0e4c('0x19')]=function(_0x369acc){var _0x2927fe=this;return new Promise(function(_0x43d00f,_0x4718dd){return db[_0x0e4c('0x1a')][_0x0e4c('0x1b')](_0x369acc[_0x0e4c('0x1c')],{'raw':_0x369acc[_0x0e4c('0x1d')]?_0x369acc[_0x0e4c('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x369acc['options']?_0x369acc[_0x0e4c('0x1d')][_0x0e4c('0x1e')]||null:null,'attributes':_0x369acc['options']?_0x369acc[_0x0e4c('0x1d')][_0x0e4c('0x1f')]||null:null,'limit':_0x369acc['options']?_0x369acc['options']['limit']||null:null})[_0x0e4c('0xe')](function(_0x233cb2){logger['info'](_0x0e4c('0x19'),_0x369acc);logger['debug'](_0x0e4c('0x19'),_0x369acc,JSON[_0x0e4c('0x13')](_0x233cb2));_0x43d00f(_0x233cb2);})[_0x0e4c('0x20')](function(_0x5c5678){logger['error'](_0x0e4c('0x19'),_0x5c5678[_0x0e4c('0x16')],_0x369acc);_0x4718dd(_0x2927fe[_0x0e4c('0x14')](0x1f4,_0x5c5678['message']));});});};exports[_0x0e4c('0x21')]=function(_0x1d3a79){return new Promise(function(_0x195eaf,_0x289ad2){return db[_0x0e4c('0x1a')][_0x0e4c('0x22')]({'where':_0x1d3a79[_0x0e4c('0x1d')]?_0x1d3a79[_0x0e4c('0x1d')][_0x0e4c('0x1e')]||null:null})[_0x0e4c('0xe')](function(_0x4abd79){if(_0x4abd79){return _0x4abd79['addTags'](_0x1d3a79['body'][_0x0e4c('0x23')],_[_0x0e4c('0x24')](_0x1d3a79[_0x0e4c('0x1c')],[_0x0e4c('0x23'),'id'])||{});}})['spread'](function(_0x4f32af){logger[_0x0e4c('0x17')](_0x0e4c('0x25'),_0x1d3a79);logger['debug'](_0x0e4c('0x25'),_0x1d3a79,JSON['stringify'](_0x4f32af));_0x195eaf(_0x4f32af);})[_0x0e4c('0x20')](function(_0x55b4ac){logger['error'](_0x0e4c('0x25'),_0x55b4ac[_0x0e4c('0x16')],_0x1d3a79);_0x289ad2(_this[_0x0e4c('0x14')](0x1f4,_0x55b4ac[_0x0e4c('0x16')]));});});}; \ No newline at end of file +var _0xffd8=['limit','then','catch','find','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xffd8,0xf9));var _0x8ffd=function(_0x3cbe85,_0x4c3091){_0x3cbe85=_0x3cbe85-0x0;var _0x396936=_0xffd8[_0x3cbe85];return _0x396936;};'use strict';var _=require('lodash');var util=require(_0x8ffd('0x0'));var moment=require(_0x8ffd('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ffd('0x2'));var fs=require('fs');var Redis=require(_0x8ffd('0x3'));var db=require(_0x8ffd('0x4'))['db'];var utils=require(_0x8ffd('0x5'));var logger=require(_0x8ffd('0x6'))(_0x8ffd('0x7'));var config=require(_0x8ffd('0x8'));var jayson=require(_0x8ffd('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8ffd('0xa')](config[_0x8ffd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ffd('0xb')]));require(_0x8ffd('0xc'))['register'](socket);function respondWithRpcPromise(_0x39afbe,_0x223538,_0x585cbc){return new BPromise(function(_0x3d86ce,_0x5a1d90){return client[_0x8ffd('0xd')](_0x39afbe,_0x585cbc)['then'](function(_0x3f418f){logger[_0x8ffd('0xe')](_0x8ffd('0xf'),_0x223538,_0x8ffd('0x10'));logger[_0x8ffd('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x223538,_0x8ffd('0x10'),JSON[_0x8ffd('0x12')](_0x3f418f));if(_0x3f418f[_0x8ffd('0x13')]){if(_0x3f418f['error'][_0x8ffd('0x14')]===0x1f4){logger[_0x8ffd('0x13')](_0x8ffd('0xf'),_0x223538,_0x3f418f[_0x8ffd('0x13')]['message']);return _0x5a1d90(_0x3f418f[_0x8ffd('0x13')][_0x8ffd('0x15')]);}logger[_0x8ffd('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x223538,_0x3f418f[_0x8ffd('0x13')][_0x8ffd('0x15')]);return _0x3d86ce(_0x3f418f['error'][_0x8ffd('0x15')]);}else{logger[_0x8ffd('0xe')](_0x8ffd('0xf'),_0x223538,'request\x20sent');_0x3d86ce(_0x3f418f[_0x8ffd('0x16')][_0x8ffd('0x15')]);}})['catch'](function(_0x3e7856){logger[_0x8ffd('0x13')](_0x8ffd('0xf'),_0x223538,_0x3e7856);_0x5a1d90(_0x3e7856);});});}exports[_0x8ffd('0x17')]=function(_0x5ef1cc){var _0x536b8d=this;return new Promise(function(_0x51c942,_0x2f72e6){return db[_0x8ffd('0x18')][_0x8ffd('0x19')](_0x5ef1cc[_0x8ffd('0x1a')],{'raw':_0x5ef1cc[_0x8ffd('0x1b')]?_0x5ef1cc[_0x8ffd('0x1b')][_0x8ffd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ef1cc[_0x8ffd('0x1b')]?_0x5ef1cc[_0x8ffd('0x1b')][_0x8ffd('0x1d')]||null:null,'attributes':_0x5ef1cc[_0x8ffd('0x1b')]?_0x5ef1cc['options'][_0x8ffd('0x1e')]||null:null,'limit':_0x5ef1cc[_0x8ffd('0x1b')]?_0x5ef1cc['options'][_0x8ffd('0x1f')]||null:null})[_0x8ffd('0x20')](function(_0x5abbed){logger[_0x8ffd('0xe')](_0x8ffd('0x17'),_0x5ef1cc);logger[_0x8ffd('0x11')](_0x8ffd('0x17'),_0x5ef1cc,JSON[_0x8ffd('0x12')](_0x5abbed));_0x51c942(_0x5abbed);})[_0x8ffd('0x21')](function(_0x5497c5){logger['error']('UpdateSmsInteraction',_0x5497c5[_0x8ffd('0x15')],_0x5ef1cc);_0x2f72e6(_0x536b8d[_0x8ffd('0x13')](0x1f4,_0x5497c5['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x261aac){return new Promise(function(_0x5958d0,_0x2e9df4){return db['SmsInteraction'][_0x8ffd('0x22')]({'where':_0x261aac[_0x8ffd('0x1b')]?_0x261aac[_0x8ffd('0x1b')]['where']||null:null})[_0x8ffd('0x20')](function(_0x58555e){if(_0x58555e){return _0x58555e[_0x8ffd('0x23')](_0x261aac[_0x8ffd('0x1a')][_0x8ffd('0x24')],_[_0x8ffd('0x25')](_0x261aac[_0x8ffd('0x1a')],[_0x8ffd('0x24'),'id'])||{});}})[_0x8ffd('0x26')](function(_0x350405){logger[_0x8ffd('0xe')](_0x8ffd('0x27'),_0x261aac);logger[_0x8ffd('0x11')](_0x8ffd('0x27'),_0x261aac,JSON[_0x8ffd('0x12')](_0x350405));_0x5958d0(_0x350405);})[_0x8ffd('0x21')](function(_0x30410e){logger[_0x8ffd('0x13')](_0x8ffd('0x27'),_0x30410e['message'],_0x261aac);_0x2e9df4(_this['error'](0x1f4,_0x30410e[_0x8ffd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index eb65ac4..10dfa77 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 _0x5bbb=['removeListener','register','length','./smsInteraction.events','save','remove','update','emit'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x5bbb,0x133));var _0xb5bb=function(_0x151424,_0x35828c){_0x151424=_0x151424-0x0;var _0x5d159f=_0x5bbb[_0x151424];return _0x5d159f;};'use strict';var SmsInteractionEvents=require(_0xb5bb('0x0'));var events=[_0xb5bb('0x1'),_0xb5bb('0x2'),_0xb5bb('0x3')];function createListener(_0x562527,_0x194916){return function(_0x107f2d){_0x194916[_0xb5bb('0x4')](_0x562527,_0x107f2d);};}function removeListener(_0x478dc7,_0xd66acf){return function(){SmsInteractionEvents[_0xb5bb('0x5')](_0x478dc7,_0xd66acf);};}exports[_0xb5bb('0x6')]=function(_0x75a7c0){for(var _0xeed03c=0x0,_0x372163=events[_0xb5bb('0x7')];_0xeed03c<_0x372163;_0xeed03c++){var _0x5610b0=events[_0xeed03c];var _0x1dcbd1=createListener('smsInteraction:'+_0x5610b0,_0x75a7c0);SmsInteractionEvents['on'](_0x5610b0,_0x1dcbd1);}}; \ No newline at end of file +var _0xede6=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xede6,0x89));var _0x6ede=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xede6[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsInteractionEvents=require(_0x6ede('0x0'));var events=[_0x6ede('0x1'),_0x6ede('0x2'),_0x6ede('0x3')];function createListener(_0x1b29ce,_0x30d615){return function(_0x3a96de){_0x30d615[_0x6ede('0x4')](_0x1b29ce,_0x3a96de);};}function removeListener(_0x5bcfb6,_0x31332a){return function(){SmsInteractionEvents[_0x6ede('0x5')](_0x5bcfb6,_0x31332a);};}exports[_0x6ede('0x6')]=function(_0x1470a0){for(var _0x133ee1=0x0,_0x137557=events[_0x6ede('0x7')];_0x133ee1<_0x137557;_0x133ee1++){var _0x173261=events[_0x133ee1];var _0x2df4d7=createListener(_0x6ede('0x8')+_0x173261,_0x1470a0);SmsInteractionEvents['on'](_0x173261,_0x2df4d7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f2d783f..ecb4c02 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 _0xf87a=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x4244d2,_0x17a96d){var _0x2c855c=function(_0x2bf1f9){while(--_0x2bf1f9){_0x4244d2['push'](_0x4244d2['shift']());}};_0x2c855c(++_0x17a96d);}(_0xf87a,0x103));var _0xaf87=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf87a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xaf87('0x0'));var util=require(_0xaf87('0x1'));var path=require(_0xaf87('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf87('0x3'));var auth=require(_0xaf87('0x4'));var interaction=require(_0xaf87('0x5'));var config=require(_0xaf87('0x6'));var controller=require('./smsMessage.controller');router[_0xaf87('0x7')]('/',auth[_0xaf87('0x8')](),controller[_0xaf87('0x9')]);router[_0xaf87('0x7')](_0xaf87('0xa'),auth[_0xaf87('0x8')](),controller[_0xaf87('0xb')]);router[_0xaf87('0x7')](_0xaf87('0xc'),auth['isAuthenticated'](),controller[_0xaf87('0xd')]);router[_0xaf87('0xe')]('/',auth[_0xaf87('0x8')](),interaction[_0xaf87('0xf')](_0xaf87('0x10'),_0xaf87('0x11')),controller['create']);router[_0xaf87('0xe')](_0xaf87('0x12'),controller[_0xaf87('0x13')]);router[_0xaf87('0x14')](_0xaf87('0xc'),auth[_0xaf87('0x8')](),controller[_0xaf87('0x15')]);router[_0xaf87('0x14')](_0xaf87('0x16'),auth[_0xaf87('0x8')](),controller[_0xaf87('0x17')]);router['put'](_0xaf87('0x18'),auth[_0xaf87('0x8')](),controller[_0xaf87('0x19')]);router[_0xaf87('0x1a')](_0xaf87('0xc'),auth[_0xaf87('0x8')](),controller[_0xaf87('0x1b')]);module[_0xaf87('0x1c')]=router; \ No newline at end of file +var _0xc6c2=['put','/:id','update','accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','post','sms','smsmessage:create','create','/:id/status','status'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc6c2,0xf2));var _0x2c6c=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xc6c2[_0x4c6d6f];return _0x2d4478;};'use strict';var multer=require(_0x2c6c('0x0'));var util=require(_0x2c6c('0x1'));var path=require('path');var timeout=require(_0x2c6c('0x2'));var express=require(_0x2c6c('0x3'));var router=express[_0x2c6c('0x4')]();var fs_extra=require(_0x2c6c('0x5'));var auth=require(_0x2c6c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c6c('0x7'));var controller=require('./smsMessage.controller');router[_0x2c6c('0x8')]('/',auth[_0x2c6c('0x9')](),controller[_0x2c6c('0xa')]);router[_0x2c6c('0x8')](_0x2c6c('0xb'),auth[_0x2c6c('0x9')](),controller['describe']);router[_0x2c6c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2c6c('0xc')]('/',auth[_0x2c6c('0x9')](),interaction['tracked'](_0x2c6c('0xd'),_0x2c6c('0xe')),controller[_0x2c6c('0xf')]);router[_0x2c6c('0xc')](_0x2c6c('0x10'),controller[_0x2c6c('0x11')]);router[_0x2c6c('0x12')](_0x2c6c('0x13'),auth[_0x2c6c('0x9')](),controller[_0x2c6c('0x14')]);router['put']('/:id/accept',auth[_0x2c6c('0x9')](),controller[_0x2c6c('0x15')]);router['put']('/:id/reject',auth[_0x2c6c('0x9')](),controller[_0x2c6c('0x16')]);router[_0x2c6c('0x17')](_0x2c6c('0x13'),auth[_0x2c6c('0x9')](),controller[_0x2c6c('0x18')]);module[_0x2c6c('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4db1e94..8f697e8 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 _0x6c32=['STRING','sequelize','TEXT','BOOLEAN','out','DATE'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module['exports']={'body':{'type':Sequelize[_0x26c3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x26c3('0x3')),'defaultValue':_0x26c3('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x26c3('0x4')]},'secret':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x26c3('0x5')]},'providerResponse':{'type':Sequelize[_0x26c3('0x1')]}}; \ No newline at end of file +var _0x16c6=['medium','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x16c6,0x18d));var _0x616c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x16c6[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x616c('0x0'));module['exports']={'body':{'type':Sequelize[_0x616c('0x1')](_0x616c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x616c('0x3')]('in','out'),'defaultValue':_0x616c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x616c('0x5')](0xbe)},'phone':{'type':Sequelize[_0x616c('0x5')]},'readAt':{'type':Sequelize[_0x616c('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x616c('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 582774f..9d08d7a 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 _0xbc7a=['event','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','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/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','client','http','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','offset','undefined','limit','count','status','apply','reject','save','update','stack','send','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','include','findAll','rows','show','params','create','body','find','destroy','describe','sms-interactions','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','SmsInteractionId','stringify','RejectMessage','rejectMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc7a,0xa4));var _0xabc7=function(_0x59b6c1,_0x33258b){_0x59b6c1=_0x59b6c1-0x0;var _0x329560=_0xbc7a[_0x59b6c1];return _0x329560;};'use strict';var emlformat=require(_0xabc7('0x0'));var rimraf=require(_0xabc7('0x1'));var zipdir=require(_0xabc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabc7('0x3'));var moment=require(_0xabc7('0x4'));var BPromise=require(_0xabc7('0x5'));var Mustache=require(_0xabc7('0x6'));var util=require(_0xabc7('0x7'));var path=require(_0xabc7('0x8'));var sox=require('sox');var csv=require(_0xabc7('0x9'));var ejs=require(_0xabc7('0xa'));var fs=require('fs');var fs_extra=require(_0xabc7('0xb'));var _=require(_0xabc7('0xc'));var squel=require(_0xabc7('0xd'));var crypto=require(_0xabc7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xabc7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xabc7('0x10'));var Papa=require(_0xabc7('0x11'));var Redis=require(_0xabc7('0x12'));var authService=require(_0xabc7('0x13'));var qs=require(_0xabc7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xabc7('0x15'))('api');var utils=require(_0xabc7('0x16'));var config=require(_0xabc7('0x17'));var licenseUtil=require(_0xabc7('0x18'));var db=require('../../mysqldb')['db'];config[_0xabc7('0x19')]=_[_0xabc7('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xabc7('0x1b'))(new Redis(config[_0xabc7('0x19')]));require('./smsMessage.socket')[_0xabc7('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xabc7('0x1d')][_0xabc7('0x1e')]({'port':0x232c});var client9002=jayson[_0xabc7('0x1d')][_0xabc7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4b3575,_0x50027a,_0x42f77a,_0xa23fd){return new BPromise(function(_0x4216a2,_0x2d1e4e){var _0x5a184e=_0xa23fd||client;return _0x5a184e['request'](_0x4b3575,_0x42f77a)[_0xabc7('0x1f')](function(_0x181dd6){logger['info'](_0xabc7('0x20'),_0x50027a,_0xabc7('0x21'));logger['debug'](_0xabc7('0x22'),_0x50027a,_0xabc7('0x21'),JSON['stringify'](_0x181dd6));if(_0x181dd6[_0xabc7('0x23')]){if(_0x181dd6['error']['code']===0x1f4){logger['error'](_0xabc7('0x20'),_0x50027a,_0x181dd6['error'][_0xabc7('0x24')]);return _0x2d1e4e(_0x181dd6['error']['message']);}logger[_0xabc7('0x23')](_0xabc7('0x20'),_0x50027a,_0x181dd6[_0xabc7('0x23')]['message']);return _0x4216a2(_0x181dd6[_0xabc7('0x23')][_0xabc7('0x24')]);}else{logger[_0xabc7('0x25')](_0xabc7('0x20'),_0x50027a,_0xabc7('0x21'));_0x4216a2(_0x181dd6[_0xabc7('0x26')][_0xabc7('0x24')]);}})[_0xabc7('0x27')](function(_0x924f1b){logger['error'](_0xabc7('0x20'),_0x50027a,_0x924f1b);_0x2d1e4e(_0x924f1b);});});}function respondWithStatusCode(_0x2c66d2,_0x10bb9e){_0x10bb9e=_0x10bb9e||0xcc;return function(_0x5b5a59){if(_0x5b5a59){return _0x2c66d2[_0xabc7('0x28')](_0x10bb9e);}return _0x2c66d2['status'](_0x10bb9e)[_0xabc7('0x29')]();};}function respondWithResult(_0x2a0d86,_0x305cdb){_0x305cdb=_0x305cdb||0xc8;return function(_0x429144){if(_0x429144){return _0x2a0d86['status'](_0x305cdb)['json'](_0x429144);}};}function respondWithFilteredResult(_0x3b0bdc,_0x5dd2a3){return function(_0x5a4c1d){if(_0x5a4c1d){var _0x1fdbea=typeof _0x5dd2a3[_0xabc7('0x2a')]===_0xabc7('0x2b')&&typeof _0x5dd2a3[_0xabc7('0x2c')]===_0xabc7('0x2b');var _0x22d34e=_0x5a4c1d[_0xabc7('0x2d')];var _0x43b4a9=_0x1fdbea?0x0:_0x5dd2a3[_0xabc7('0x2a')];var _0xdcb9aa=_0x1fdbea?_0x5a4c1d['count']:_0x5dd2a3['offset']+_0x5dd2a3[_0xabc7('0x2c')];var _0x249dc4;if(_0xdcb9aa>=_0x22d34e){_0xdcb9aa=_0x22d34e;_0x249dc4=0xc8;}else{_0x249dc4=0xce;}_0x3b0bdc[_0xabc7('0x2e')](_0x249dc4);return _0x3b0bdc['set']('Content-Range',_0x43b4a9+'-'+_0xdcb9aa+'/'+_0x22d34e)['json'](_0x5a4c1d);}return null;};}function patchUpdates(_0x3976d2){return function(_0x233bcb){try{jsonpatch[_0xabc7('0x2f')](_0x233bcb,_0x3976d2,!![]);}catch(_0x212648){return BPromise[_0xabc7('0x30')](_0x212648);}return _0x233bcb[_0xabc7('0x31')]();};}function saveUpdates(_0x3572f6,_0x1810ec){return function(_0x17e125){if(_0x17e125){return _0x17e125[_0xabc7('0x32')](_0x3572f6)[_0xabc7('0x1f')](function(_0xf77b21){return _0xf77b21;});}return null;};}function removeEntity(_0x1426cd,_0x219eb7){return function(_0x67dbd2){if(_0x67dbd2){return _0x67dbd2['destroy']()[_0xabc7('0x1f')](function(){_0x1426cd[_0xabc7('0x2e')](0xcc)[_0xabc7('0x29')]();});}};}function handleEntityNotFound(_0xe68b4e,_0x33c64e){return function(_0xe55703){if(!_0xe55703){_0xe68b4e['sendStatus'](0x194);}return _0xe55703;};}function handleError(_0x1a46d9,_0x271779){_0x271779=_0x271779||0x1f4;return function(_0x468f37){logger[_0xabc7('0x23')](_0x468f37[_0xabc7('0x33')]);if(_0x468f37['name']){delete _0x468f37['name'];}_0x1a46d9[_0xabc7('0x2e')](_0x271779)[_0xabc7('0x34')](_0x468f37);};}exports['index']=function(_0x1f3c8a,_0x389c39){var _0x4112b3={},_0x286b6f={},_0xbbf5ad={'count':0x0,'rows':[]};var _0xe798fa=_['map'](db['SmsMessage'][_0xabc7('0x35')],function(_0x3110ab){return{'name':_0x3110ab[_0xabc7('0x36')],'type':_0x3110ab[_0xabc7('0x37')][_0xabc7('0x38')]};});_0x286b6f['model']=_[_0xabc7('0x39')](_0xe798fa,_0xabc7('0x3a'));_0x286b6f[_0xabc7('0x3b')]=_[_0xabc7('0x3c')](_0x1f3c8a['query']);_0x286b6f[_0xabc7('0x3d')]=_['intersection'](_0x286b6f[_0xabc7('0x3e')],_0x286b6f[_0xabc7('0x3b')]);_0x4112b3[_0xabc7('0x3f')]=_[_0xabc7('0x40')](_0x286b6f['model'],qs['fields'](_0x1f3c8a[_0xabc7('0x3b')][_0xabc7('0x41')]));_0x4112b3['attributes']=_0x4112b3[_0xabc7('0x3f')][_0xabc7('0x42')]?_0x4112b3[_0xabc7('0x3f')]:_0x286b6f[_0xabc7('0x3e')];if(!_0x1f3c8a['query']['hasOwnProperty'](_0xabc7('0x43'))){_0x4112b3[_0xabc7('0x2c')]=qs['limit'](_0x1f3c8a[_0xabc7('0x3b')][_0xabc7('0x2c')]);_0x4112b3[_0xabc7('0x2a')]=qs[_0xabc7('0x2a')](_0x1f3c8a[_0xabc7('0x3b')]['offset']);}_0x4112b3['order']=qs[_0xabc7('0x44')](_0x1f3c8a[_0xabc7('0x3b')]['sort']);_0x4112b3[_0xabc7('0x45')]=qs[_0xabc7('0x3d')](_[_0xabc7('0x46')](_0x1f3c8a[_0xabc7('0x3b')],_0x286b6f['filters']),_0xe798fa);if(_0x1f3c8a['query'][_0xabc7('0x47')]){_0x4112b3[_0xabc7('0x45')]=_[_0xabc7('0x48')](_0x4112b3['where'],{'$or':_[_0xabc7('0x39')](_0xe798fa,function(_0x41cca1){if(_0x41cca1[_0xabc7('0x37')]!==_0xabc7('0x49')){var _0x5be7af={};_0x5be7af[_0x41cca1[_0xabc7('0x3a')]]={'$like':'%'+_0x1f3c8a[_0xabc7('0x3b')][_0xabc7('0x47')]+'%'};return _0x5be7af;}})});}_0x4112b3=_[_0xabc7('0x48')]({},_0x4112b3,_0x1f3c8a[_0xabc7('0x4a')]);var _0x227f9c={'where':_0x4112b3[_0xabc7('0x45')]};return db[_0xabc7('0x4b')][_0xabc7('0x2d')](_0x227f9c)[_0xabc7('0x1f')](function(_0x20112f){_0xbbf5ad[_0xabc7('0x2d')]=_0x20112f;if(_0x1f3c8a[_0xabc7('0x3b')]['includeAll']){_0x4112b3[_0xabc7('0x4c')]=[{'all':!![]}];}return db[_0xabc7('0x4b')][_0xabc7('0x4d')](_0x4112b3);})[_0xabc7('0x1f')](function(_0x20a31f){_0xbbf5ad[_0xabc7('0x4e')]=_0x20a31f;return _0xbbf5ad;})[_0xabc7('0x1f')](respondWithFilteredResult(_0x389c39,_0x4112b3))['catch'](handleError(_0x389c39,null));};exports[_0xabc7('0x4f')]=function(_0xfab427,_0x2a4d89){var _0x559b65={'raw':!![],'where':{'id':_0xfab427[_0xabc7('0x50')]['id']}},_0x464a68={};_0x464a68['model']=_[_0xabc7('0x3c')](db[_0xabc7('0x4b')][_0xabc7('0x35')]);_0x464a68[_0xabc7('0x3b')]=_[_0xabc7('0x3c')](_0xfab427[_0xabc7('0x3b')]);_0x464a68['filters']=_['intersection'](_0x464a68[_0xabc7('0x3e')],_0x464a68['query']);_0x559b65[_0xabc7('0x3f')]=_[_0xabc7('0x40')](_0x464a68[_0xabc7('0x3e')],qs[_0xabc7('0x41')](_0xfab427['query'][_0xabc7('0x41')]));_0x559b65[_0xabc7('0x3f')]=_0x559b65['attributes']['length']?_0x559b65['attributes']:_0x464a68[_0xabc7('0x3e')];if(_0xfab427[_0xabc7('0x3b')]['includeAll']){_0x559b65[_0xabc7('0x4c')]=[{'all':!![]}];}_0x559b65=_[_0xabc7('0x48')]({},_0x559b65,_0xfab427['options']);return db[_0xabc7('0x4b')]['find'](_0x559b65)[_0xabc7('0x1f')](handleEntityNotFound(_0x2a4d89,null))[_0xabc7('0x1f')](respondWithResult(_0x2a4d89,null))[_0xabc7('0x27')](handleError(_0x2a4d89,null));};exports[_0xabc7('0x51')]=function(_0x10280f,_0x3b58b6){return db[_0xabc7('0x4b')][_0xabc7('0x51')](_0x10280f[_0xabc7('0x52')],{})['then'](respondWithResult(_0x3b58b6,0xc9))[_0xabc7('0x27')](handleError(_0x3b58b6,null));};exports['update']=function(_0x4af394,_0x553418){if(_0x4af394[_0xabc7('0x52')]['id']){delete _0x4af394[_0xabc7('0x52')]['id'];}return db[_0xabc7('0x4b')][_0xabc7('0x53')]({'where':{'id':_0x4af394['params']['id']}})[_0xabc7('0x1f')](handleEntityNotFound(_0x553418,null))['then'](saveUpdates(_0x4af394[_0xabc7('0x52')],null))['then'](respondWithResult(_0x553418,null))[_0xabc7('0x27')](handleError(_0x553418,null));};exports[_0xabc7('0x54')]=function(_0x4d266b,_0x314740){return db[_0xabc7('0x4b')][_0xabc7('0x53')]({'where':{'id':_0x4d266b['params']['id']}})[_0xabc7('0x1f')](handleEntityNotFound(_0x314740,null))['then'](removeEntity(_0x314740,null))['catch'](handleError(_0x314740,null));};exports[_0xabc7('0x55')]=function(_0x3fcf5a,_0x3ef95f){return db['SmsMessage'][_0xabc7('0x55')]()[_0xabc7('0x1f')](respondWithResult(_0x3ef95f,null))[_0xabc7('0x27')](handleError(_0x3ef95f,null));};var interaction_log=require('../../config/logger')(_0xabc7('0x56'));exports['accept']=function(_0x44a86a,_0x430279,_0x2f963a){var _0x3615af={'agent':{},'channel':_0xabc7('0x57')};if(_0x44a86a[_0xabc7('0x52')]['id']){delete _0x44a86a['body']['id'];}_0x44a86a[_0xabc7('0x52')]['read']=!![];_0x44a86a['body'][_0xabc7('0x58')]=moment()[_0xabc7('0x59')](_0xabc7('0x5a'));_0x44a86a[_0xabc7('0x52')][_0xabc7('0x5b')]=_0x44a86a[_0xabc7('0x52')]['UserId']||_0x44a86a[_0xabc7('0x5c')]['id'];_0x3615af[_0xabc7('0x5d')]['id']=_0x44a86a[_0xabc7('0x52')][_0xabc7('0x5b')];return db[_0xabc7('0x4b')][_0xabc7('0x53')]({'where':{'id':_0x44a86a[_0xabc7('0x50')]['id'],'UserId':null}})[_0xabc7('0x1f')](handleEntityNotFound(_0x430279,null))[_0xabc7('0x1f')](saveUpdates(_0x44a86a[_0xabc7('0x52')],null))[_0xabc7('0x1f')](function(_0x345f84){if(_0x345f84){_0x3615af[_0xabc7('0x24')]=_0x345f84[_0xabc7('0x5e')]({'plain':!![]});return db[_0xabc7('0x5f')]['find']({'where':{'id':_0x345f84['SmsInteractionId']}});}return null;})[_0xabc7('0x1f')](handleEntityNotFound(_0x430279,null))['then'](function(_0xe52f1c){if(_0xe52f1c){return _0xe52f1c['update']({'UserId':_0x44a86a[_0xabc7('0x52')][_0xabc7('0x5b')],'read1stAt':_[_0xabc7('0x60')](_0xe52f1c['read1stAt'])?moment()[_0xabc7('0x59')](_0xabc7('0x5a')):undefined});}return null;})[_0xabc7('0x1f')](function(_0x5be9a6){if(_0x5be9a6){_0x3615af[_0xabc7('0x61')]=_0x5be9a6[_0xabc7('0x5e')]({'plain':!![]});interaction_log['info'](_0xabc7('0x62'),_0x44a86a[_0xabc7('0x5c')]['id'],_0x44a86a[_0xabc7('0x5c')][_0xabc7('0x3a')],_0x44a86a[_0xabc7('0x5c')][_0xabc7('0x63')],_0x3615af[_0xabc7('0x61')]['id'],_0x44a86a[_0xabc7('0x52')]?JSON['stringify'](_0x44a86a[_0xabc7('0x52')]):_0xabc7('0x64'));return respondWithRpcPromise('AcceptMessage',_0xabc7('0x65'),_0x3615af);}return null;})[_0xabc7('0x1f')](function(_0x38c3ab){var _0x31338c=_0xabc7('0x66')+_0x38c3ab[_0xabc7('0x24')][_0xabc7('0x67')];return db[_0xabc7('0x68')][_0xabc7('0x3b')](_0x31338c,{'type':db[_0xabc7('0x69')][_0xabc7('0x6a')][_0xabc7('0x6b')],'raw':!![]})[_0xabc7('0x1f')](function(_0x51b26f){return _0x51b26f;});})[_0xabc7('0x1f')](function(_0x5ef6d6){if(_0x5ef6d6){_0x3615af[_0xabc7('0x24')][_0xabc7('0x6c')]=_0x5ef6d6[0x0];if(!_0x44a86a[_0xabc7('0x52')][_0xabc7('0x5b')])return;return db[_0xabc7('0x6d')][_0xabc7('0x53')]({'where':{'id':_0x44a86a[_0xabc7('0x52')][_0xabc7('0x5b')],'role':'agent'},'attributes':['id',_0xabc7('0x3a'),_0xabc7('0x6e'),_0xabc7('0x6f'),_0xabc7('0x70')],'raw':!![]});}return null;})[_0xabc7('0x1f')](function(_0x457be5){if(!_0x457be5)return null;_0x3615af[_0xabc7('0x24')]['agent']=_0x457be5;return _0x3615af;})[_0xabc7('0x1f')](function(_0x23e80a){if(_0x23e80a){if(_0x44a86a[_0xabc7('0x52')]['manual']){_0x3615af['message'][_0xabc7('0x71')]=util[_0xabc7('0x59')](_0xabc7('0x72'),_0x44a86a[_0xabc7('0x5c')][_0xabc7('0x3a')]);_0x3615af[_0xabc7('0x24')][_0xabc7('0x73')]=_0x3615af[_0xabc7('0x73')];_0x3615af[_0xabc7('0x24')][_0xabc7('0x74')]=_0x3615af[_0xabc7('0x73')];_0x3615af[_0xabc7('0x24')]['event']=_0xabc7('0x75');return respondWithRpcPromise(_0xabc7('0x76'),_0xabc7('0x76'),{'event':_0xabc7('0x77'),'message':_0x3615af[_0xabc7('0x24')]},client9002)[_0xabc7('0x1f')](function(){return _0x3615af;});}return _0x3615af;}return null;})['then'](respondWithResult(_0x430279,null))[_0xabc7('0x27')](handleError(_0x430279,null));};var interaction_log=require('../../config/logger')(_0xabc7('0x56'));exports[_0xabc7('0x30')]=function(_0x295582,_0x323a77,_0x284f1b){var _0x8ae4c6={'agent':{},'channel':_0xabc7('0x57')};if(_0x295582[_0xabc7('0x52')]['id']){delete _0x295582['body']['id'];}_0x295582[_0xabc7('0x52')][_0xabc7('0x5b')]=_0x295582[_0xabc7('0x52')][_0xabc7('0x5b')]||_0x295582[_0xabc7('0x5c')]['id'];_0x8ae4c6[_0xabc7('0x5d')]['id']=_0x295582['body'][_0xabc7('0x5b')];return db['SmsMessage']['find']({'where':{'id':_0x295582[_0xabc7('0x50')]['id'],'UserId':null}})[_0xabc7('0x1f')](handleEntityNotFound(_0x323a77,null))[_0xabc7('0x1f')](function(_0x49f00d){if(_0x49f00d){_0x8ae4c6[_0xabc7('0x24')]=_0x49f00d[_0xabc7('0x5e')]({'plain':!![]});return db[_0xabc7('0x5f')][_0xabc7('0x53')]({'where':{'id':_0x49f00d[_0xabc7('0x78')]}});}return null;})[_0xabc7('0x1f')](handleEntityNotFound(_0x323a77,null))[_0xabc7('0x1f')](function(_0xc8a3d8){if(_0xc8a3d8){_0x8ae4c6[_0xabc7('0x61')]=_0xc8a3d8[_0xabc7('0x5e')]({'plain':!![]});interaction_log[_0xabc7('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x295582[_0xabc7('0x5c')]['id'],_0x295582[_0xabc7('0x5c')]['name'],_0x295582[_0xabc7('0x5c')][_0xabc7('0x63')],_0x8ae4c6[_0xabc7('0x61')]['id'],_0x295582['body']?JSON[_0xabc7('0x79')](_0x295582['body']):'null');return respondWithRpcPromise(_0xabc7('0x7a'),_0xabc7('0x7b'),_0x8ae4c6);}return null;})[_0xabc7('0x1f')](function(_0x4785a4){var _0x3a0587=_0xabc7('0x66')+_0x4785a4[_0xabc7('0x24')][_0xabc7('0x67')];return db[_0xabc7('0x68')][_0xabc7('0x3b')](_0x3a0587,{'type':db[_0xabc7('0x69')][_0xabc7('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x26a799){return _0x26a799;});})[_0xabc7('0x1f')](function(_0x2e6d01){if(_0x2e6d01){_0x8ae4c6[_0xabc7('0x24')][_0xabc7('0x6c')]=_0x2e6d01[0x0];if(!_0x295582[_0xabc7('0x52')][_0xabc7('0x5b')])return;return db[_0xabc7('0x6d')][_0xabc7('0x53')]({'where':{'id':_0x295582[_0xabc7('0x52')][_0xabc7('0x5b')],'role':_0xabc7('0x5d')},'attributes':['id',_0xabc7('0x3a'),'fullname',_0xabc7('0x6f'),_0xabc7('0x70')],'raw':!![]});}return null;})[_0xabc7('0x1f')](function(_0x46f801){if(!_0x46f801)return null;_0x8ae4c6[_0xabc7('0x24')][_0xabc7('0x5d')]=_0x46f801;return _0x8ae4c6;})[_0xabc7('0x1f')](function(_0x4cf193){if(_0x4cf193){_0x4cf193['message']['interface']=util['format'](_0xabc7('0x72'),_0x295582[_0xabc7('0x5c')][_0xabc7('0x3a')]);_0x4cf193['message'][_0xabc7('0x73')]=_0x8ae4c6[_0xabc7('0x73')];_0x4cf193['message'][_0xabc7('0x74')]=_0x8ae4c6[_0xabc7('0x73')];_0x4cf193[_0xabc7('0x24')][_0xabc7('0x7c')]='reject';respondWithRpcPromise(_0xabc7('0x76'),'EventManager',{'event':_0xabc7('0x7d'),'message':_0x4cf193[_0xabc7('0x24')]},client9002);return _0x8ae4c6;}return null;})[_0xabc7('0x1f')](respondWithResult(_0x323a77,null))[_0xabc7('0x27')](handleError(_0x323a77,null));};exports[_0xabc7('0x2e')]=function(_0x145242,_0x4dfeea,_0x48e977){if(_0x145242['body']['id']){delete _0x145242[_0xabc7('0x52')]['id'];}var _0x4c1d32;return db[_0xabc7('0x4b')][_0xabc7('0x53')]({'where':{'id':_0x145242[_0xabc7('0x50')]['id']}})['then'](handleEntityNotFound(_0x4dfeea,null))[_0xabc7('0x1f')](function(_0x5b4a0c){if(_0x5b4a0c){_0x4c1d32=_0x5b4a0c;return db[_0xabc7('0x7e')]['find']({'where':{'id':_0x5b4a0c[_0xabc7('0x7f')]}});}})[_0xabc7('0x1f')](handleEntityNotFound(_0x4dfeea,null))[_0xabc7('0x1f')](function(_0x37803d){if(_0x37803d){logger['debug'](_0xabc7('0x22'),_0xabc7('0x2e'),'received\x20delivery\x20report\x20from',_0x37803d[_0xabc7('0x37')],util[_0xabc7('0x80')](_0x145242[_0xabc7('0x52')],{'showHidden':![],'depth':null}));switch(_0x37803d[_0xabc7('0x37')]){case _0xabc7('0x81'):if(_0x145242[_0xabc7('0x52')]['MessageSid']&&_0x145242['body'][_0xabc7('0x82')]===_0x4c1d32[_0xabc7('0x83')]){return _0x4c1d32[_0xabc7('0x32')]({'read':!![]});}else{logger[_0xabc7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xabc7('0x2e'),_0xabc7('0x81'),util[_0xabc7('0x80')](_0x145242[_0xabc7('0x52')],{'showHidden':![],'depth':null}));}break;case _0xabc7('0x84'):if(_0x145242['body'][_0xabc7('0x85')]&&_0x145242[_0xabc7('0x52')]['MessageUUID']===_0x4c1d32['messageId']&&_[_0xabc7('0x86')]([_0xabc7('0x87'),_0xabc7('0x88')],_0x145242['body'][_0xabc7('0x89')])>=0x0){return _0x4c1d32[_0xabc7('0x32')]({'read':!![]});}else{logger[_0xabc7('0x23')](_0xabc7('0x8a'),_0xabc7('0x2e'),_0xabc7('0x8b'),util[_0xabc7('0x80')](_0x145242[_0xabc7('0x52')],{'showHidden':![],'depth':null}));}break;case _0xabc7('0x8c'):var _0x2a8c63=_0x145242[_0xabc7('0x52')][_0xabc7('0x8d')][0x0];if(_0x2a8c63[_0xabc7('0x2e')][_0xabc7('0x8e')]===_0xabc7('0x8f')){return _0x4c1d32[_0xabc7('0x32')]({'read':!![]});}else{logger[_0xabc7('0x23')](_0xabc7('0x8a'),_0xabc7('0x2e'),_0xabc7('0x8c'),util[_0xabc7('0x80')](_0x145242[_0xabc7('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x4c1d32;}})['then'](respondWithResult(_0x4dfeea,null))[_0xabc7('0x27')](handleError(_0x4dfeea,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(_0x82305a,_0x46a9fb){var _0x5b57e6=function(_0x1139a9){while(--_0x1139a9){_0x82305a['push'](_0x82305a['shift']());}};_0x5b57e6(++_0x46a9fb);}(_0x6d5e,0x103));var _0xe6d5=function(_0x41590a,_0x5a2614){_0x41590a=_0x41590a-0x0;var _0x3094ac=_0x6d5e[_0x41590a];return _0x3094ac;};'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 6b2d2c6..5795f77 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 _0xfa75=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x57ff60,_0x2c89ed){var _0x2e9dc2=function(_0x216292){while(--_0x216292){_0x57ff60['push'](_0x57ff60['shift']());}};_0x2e9dc2(++_0x2c89ed);}(_0xfa75,0x156));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5fa7('0x0'));var SmsMessage=require(_0x5fa7('0x1'))['db'][_0x5fa7('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5fa7('0x3')](0x0);var events={'afterCreate':_0x5fa7('0x4'),'afterUpdate':_0x5fa7('0x5'),'afterDestroy':_0x5fa7('0x6')};function emitEvent(_0x25dd33){return function(_0x501039,_0x197fb1,_0x3cd133){SmsMessageEvents[_0x5fa7('0x7')](_0x25dd33+':'+_0x501039['id'],_0x501039);SmsMessageEvents[_0x5fa7('0x7')](_0x25dd33,_0x501039);_0x3cd133(null);};}for(var e in events){if(events[_0x5fa7('0x8')](e)){var event=events[e];SmsMessage[_0x5fa7('0x9')](e,emitEvent(event));}}module[_0x5fa7('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0x0336=['update','remove','emit','hook','events','SmsMessage','setMaxListeners','save'];(function(_0x153ea4,_0xf2b96d){var _0x23d1a6=function(_0x778538){while(--_0x778538){_0x153ea4['push'](_0x153ea4['shift']());}};_0x23d1a6(++_0xf2b96d);}(_0x0336,0x94));var _0x6033=function(_0x4c68d6,_0x3c8cc9){_0x4c68d6=_0x4c68d6-0x0;var _0x469635=_0x0336[_0x4c68d6];return _0x469635;};'use strict';var EventEmitter=require(_0x6033('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x6033('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6033('0x2')](0x0);var events={'afterCreate':_0x6033('0x3'),'afterUpdate':_0x6033('0x4'),'afterDestroy':_0x6033('0x5')};function emitEvent(_0x5cb0b6){return function(_0x51e5c0,_0x2d1b92,_0x4f51cb){SmsMessageEvents[_0x6033('0x6')](_0x5cb0b6+':'+_0x51e5c0['id'],_0x51e5c0);SmsMessageEvents[_0x6033('0x6')](_0x5cb0b6,_0x51e5c0);_0x4f51cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x6033('0x7')](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 4507dcb..75da41b 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 _0x4b4e=['uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','application/json','refid','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','find','SmsAccountId','type','twilio','phone','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','clickSend','Missing\x20parameters:\x20username,\x20password','authId','senderString','remote','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','keys','sort','length','createHash','md5','hex','signature=','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages'];(function(_0x46e82f,_0x8ff37e){var _0x14323c=function(_0x2aa4f4){while(--_0x2aa4f4){_0x46e82f['push'](_0x46e82f['shift']());}};_0x14323c(++_0x8ff37e);}(_0x4b4e,0x8b));var _0xe4b4=function(_0x51bb16,_0x477c76){_0x51bb16=_0x51bb16-0x0;var _0xf3a631=_0x4b4e[_0x51bb16];return _0xf3a631;};'use strict';var _=require(_0xe4b4('0x0'));var util=require(_0xe4b4('0x1'));var logger=require(_0xe4b4('0x2'))(_0xe4b4('0x3'));var moment=require(_0xe4b4('0x4'));var BPromise=require(_0xe4b4('0x5'));var rp=require(_0xe4b4('0x6'));var fs=require('fs');var path=require(_0xe4b4('0x7'));var rimraf=require('rimraf');var config=require(_0xe4b4('0x8'));var attributes=require(_0xe4b4('0x9'));module['exports']=function(_0x324e42,_0x1411d2){return _0x324e42[_0xe4b4('0xa')](_0xe4b4('0xb'),attributes,{'tableName':_0xe4b4('0xc'),'paranoid':![],'indexes':[{'name':_0xe4b4('0xd'),'fields':['messageId']},{'name':_0xe4b4('0xe'),'fields':[_0xe4b4('0xf')],'type':_0xe4b4('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ecdbe,_0x1542a8,_0x26d7d8){var _0x393f27=_0x324e42[_0xe4b4('0x11')];var _0x434922=_0x2ecdbe['get']({'plain':!![]});if(_0x434922[_0xe4b4('0x12')][_0xe4b4('0x13')]()==='in'||_0x434922[_0xe4b4('0x12')]['toLowerCase']()===_0xe4b4('0x14')&&!_0x434922[_0xe4b4('0x15')]&&!_[_0xe4b4('0x16')](_0x434922[_0xe4b4('0x17')])&&!_[_0xe4b4('0x16')](_0x434922[_0xe4b4('0x18')])){_0x393f27[_0xe4b4('0x19')][_0xe4b4('0x1a')]({'where':{'id':_0x434922[_0xe4b4('0x18')]}})[_0xe4b4('0x1b')](function(_0x4da864){if(_0x4da864){_0x4da864[_0xe4b4('0x1c')]({'lastMsgAt':_0x434922[_0xe4b4('0x1d')],'lastMsgDirection':_0x434922[_0xe4b4('0x12')]['toLowerCase']()});}})[_0xe4b4('0x1e')](function(_0x2dfd6e){console['error'](_0x2dfd6e);});}if(_0x434922[_0xe4b4('0x12')]==='out'&&!_0x434922[_0xe4b4('0x15')]){var _0x365a41;_0x393f27['SmsAccount'][_0xe4b4('0x1f')]({'where':{'id':_0x434922[_0xe4b4('0x20')]},'raw':!![]})[_0xe4b4('0x1b')](function(_0x3d73b9){_0x365a41=_0x3d73b9;if(_0x365a41&&_0x365a41[_0xe4b4('0x21')]){switch(_0x365a41[_0xe4b4('0x21')]){case _0xe4b4('0x22'):var _0x3b7571=require(_0xe4b4('0x22'));if(_0x365a41['accountSid']&&_0x365a41['authToken']&&_0x365a41[_0xe4b4('0x23')]){var _0x138e20=new _0x3b7571(_0x365a41['accountSid'],_0x365a41[_0xe4b4('0x24')]);_0x138e20[_0xe4b4('0x25')][_0xe4b4('0x26')]({'body':_0x434922[_0xe4b4('0xf')],'to':_0x434922[_0xe4b4('0x23')],'from':_0x365a41[_0xe4b4('0x23')],'statusCallback':_0x365a41['remote']+_0xe4b4('0x27')+_0x434922['id']+_0xe4b4('0x28')+_0x365a41[_0xe4b4('0x29')]})['then'](function(_0x1a1af9){if(_0x1a1af9[_0xe4b4('0x2a')]){return _0x2ecdbe[_0xe4b4('0x1c')]({'messageId':_0x1a1af9[_0xe4b4('0x2a')]});}})[_0xe4b4('0x1e')](function(_0x10b4f5){logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x22'),util[_0xe4b4('0x2e')](_0x10b4f5,{'showHidden':![],'depth':null}));});}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe4b4('0x2f'):var _0x34d625=_0xe4b4('0x30');if(_0x365a41[_0xe4b4('0x31')]&&_0x365a41[_0xe4b4('0x32')]){var _0x2c4f09={'recipient':[_0x434922['phone']],'message':_0x434922['body'],'message_type':_0x365a41['smsMethod']};if(_0x365a41['smsMethod']&&_0x365a41[_0xe4b4('0x33')]!=='SI'){_0x2c4f09[_0xe4b4('0x34')]=_0x365a41['phone'];}var _0x39dbdf={'url':_0x34d625+_0xe4b4('0x35')+_0x365a41[_0xe4b4('0x31')]+'&password='+_0x365a41[_0xe4b4('0x32')],'method':_0xe4b4('0x36')};rp(_0x39dbdf)['then'](function(_0x4ad1db){var _0x411232=_0x4ad1db[_0xe4b4('0x37')](';');var _0x408bf8={'user_key':_0x411232[0x0],'session_key':_0x411232[0x1]};_0x39dbdf={'url':_0x34d625+_0xe4b4('0x38'),'method':_0xe4b4('0x39'),'headers':{'user_key':_0x408bf8[_0xe4b4('0x3a')],'Session_key':_0x408bf8[_0xe4b4('0x3b')]},'json':!![],'body':_0x2c4f09};return rp(_0x39dbdf);})[_0xe4b4('0x1b')](function(_0x170062){if(_0x170062[_0xe4b4('0x3c')]>=0x1){var _0x44d31f={'messageId':_0x170062[_0xe4b4('0x3d')]};if(_0x365a41[_0xe4b4('0x33')]!=='GP'||!_0x365a41['deliveryReport']){_0x44d31f[_0xe4b4('0x3e')]=!![];}return _0x2ecdbe[_0xe4b4('0x1c')](_0x44d31f);}else{return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x2f'),util[_0xe4b4('0x2e')](_0x170062,{'showHidden':![],'depth':null}));}})[_0xe4b4('0x1e')](function(_0xefcbc3){return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),'afterCreate',_0xe4b4('0x2f'),util[_0xe4b4('0x2e')](_0xefcbc3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe4b4('0x3f'):if(_0x365a41['authToken']){var _0xbe403b={'recipient':_0x434922[_0xe4b4('0x23')],'message':_0x434922[_0xe4b4('0xf')],'sender':_0x365a41['senderString']||_0x365a41[_0xe4b4('0x23')],'authorization':_0x365a41[_0xe4b4('0x24')]};var _0x1542a8={'method':_0xe4b4('0x39'),'uri':_0xe4b4('0x40'),'body':_0xbe403b,'json':!![]};rp(_0x1542a8)[_0xe4b4('0x1b')](function(_0x42e0dc){var _0x2c14c6={'messageId':_0x42e0dc[_0xe4b4('0x41')]};if(!_0x365a41[_0xe4b4('0x42')]){_0x2c14c6[_0xe4b4('0x3e')]=!![];}return _0x2ecdbe['update'](_0x2c14c6);})[_0xe4b4('0x1e')](function(_0x24a71c){logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x3f'),util[_0xe4b4('0x2e')](_0x24a71c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe4b4('0x2c'),'afterCreate','connectel',_0xe4b4('0x43'));}break;case _0xe4b4('0x44'):if(_0x365a41['username']&&_0x365a41[_0xe4b4('0x32')]){var _0xbe403b={'messages':[{'source':_0xe4b4('0x45'),'to':_0x434922['phone'],'body':_0x434922[_0xe4b4('0xf')],'from':_0x365a41['senderString']||_0x365a41[_0xe4b4('0x23')]}]};var _0x32f39a=util[_0xe4b4('0x46')]('%s:%s',_0x365a41[_0xe4b4('0x31')],_0x365a41[_0xe4b4('0x32')]);var _0x1542a8={'method':_0xe4b4('0x39'),'uri':_0xe4b4('0x47'),'body':_0xbe403b,'headers':{'Authorization':util[_0xe4b4('0x46')](_0xe4b4('0x48'),new Buffer(_0x32f39a)[_0xe4b4('0x49')](_0xe4b4('0x4a')))},'json':!![]};rp(_0x1542a8)[_0xe4b4('0x1b')](function(_0x386385){if(_0x386385[_0xe4b4('0x4b')]>=0xc8&&_0x386385[_0xe4b4('0x4b')]<=0xce){if(_0x386385[_0xe4b4('0x4c')]&&_0x386385[_0xe4b4('0x4c')]['queued_count']>0x0){var _0x17abcd=_['head'](_0x386385['data'][_0xe4b4('0x25')]);var _0x5203e1={'messageId':_0x17abcd['message_id']};if(!_0x365a41[_0xe4b4('0x42')]){_0x5203e1[_0xe4b4('0x3e')]=!![];}return _0x2ecdbe[_0xe4b4('0x1c')](_0x5203e1);}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x4d'),util['inspect'](_0x386385,{'showHidden':![],'depth':null}));}}else{logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0x386385,{'showHidden':![],'depth':null}));}})['catch'](function(_0x79c9e5){logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe4b4('0x4d'),util[_0xe4b4('0x2e')](_0x79c9e5,{'showHidden':![],'depth':null}));});}else{logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe4b4('0x2d'),'clickSend',_0xe4b4('0x4e'));}break;case'plivo':if(_0x365a41[_0xe4b4('0x4f')]&&_0x365a41[_0xe4b4('0x24')]){var _0xbe403b={'dst':_0x434922['phone'],'text':_0x434922[_0xe4b4('0xf')],'src':_0x365a41[_0xe4b4('0x50')]||_0x365a41[_0xe4b4('0x23')],'url':_0x365a41[_0xe4b4('0x51')]+_0xe4b4('0x27')+_0x434922['id']+_0xe4b4('0x28')+_0x365a41[_0xe4b4('0x29')]};var _0x32f39a=util['format'](_0xe4b4('0x52'),_0x365a41[_0xe4b4('0x4f')],_0x365a41['authToken']);var _0x1542a8={'method':_0xe4b4('0x39'),'uri':util[_0xe4b4('0x46')](_0xe4b4('0x53'),_0x365a41[_0xe4b4('0x4f')]),'body':_0xbe403b,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x32f39a)[_0xe4b4('0x49')](_0xe4b4('0x4a')))},'json':!![]};rp(_0x1542a8)[_0xe4b4('0x1b')](function(_0x3f2a07){var _0x4e1e9e={'messageId':_0x3f2a07[_0xe4b4('0x54')][0x0]};return _0x2ecdbe[_0xe4b4('0x1c')](_0x4e1e9e);})['catch'](function(_0x38075b){logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe4b4('0x55'),util[_0xe4b4('0x2e')](_0x38075b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x55'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe4b4('0x56'):if(_0x365a41[_0xe4b4('0x31')]&&_0x365a41[_0xe4b4('0x32')]){if(_0x365a41['baseUrl']){var _0x2c7ba5={'method':_0xe4b4('0x39'),'uri':_0x365a41[_0xe4b4('0x57')]+'/auth/1/session','body':{'username':_0x365a41[_0xe4b4('0x31')],'password':_0x365a41['password']},'json':!![]};return rp(_0x2c7ba5)['then'](function(_0x55023d){var _0x44bc1f={'method':_0xe4b4('0x39'),'uri':_0x365a41[_0xe4b4('0x57')]+_0xe4b4('0x58'),'body':{'messages':[{'from':_0x365a41[_0xe4b4('0x23')],'destinations':[{'to':_0x434922[_0xe4b4('0x23')]}],'text':_0x434922[_0xe4b4('0xf')],'notifyUrl':_0x365a41[_0xe4b4('0x51')]+_0xe4b4('0x27')+_0x434922['id']+_0xe4b4('0x28')+_0x365a41['token'],'notifyContentType':'application/json','callbackData':_0x365a41[_0xe4b4('0x23')]+';'+_0x434922['body']}]},'headers':{'Authorization':_0xe4b4('0x59')+_0x55023d[_0xe4b4('0x29')]},'json':!![]};return rp(_0x44bc1f)['then'](function(_0x3f5a52){if(_0x3f5a52[_0xe4b4('0x25')]){var _0x301ab1={'messageId':_0x3f5a52['messages'][0x0][_0xe4b4('0xd')]};if(!_0x365a41['deliveryReport']){_0x301ab1[_0xe4b4('0x3e')]=!![];}return _0x2ecdbe[_0xe4b4('0x1c')](_0x301ab1);}else{return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),'afterCreate',_0xe4b4('0x56'),util[_0xe4b4('0x2e')](_0x3f5a52,{'showHidden':![],'depth':null}));}});})[_0xe4b4('0x1e')](function(_0x53d410){return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x56'),util[_0xe4b4('0x2e')](_0x53d410,{'showHidden':![],'depth':null}));});}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x56'),_0xe4b4('0x5a'));}}else{logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe4b4('0x2d'),_0xe4b4('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x40a5ec=require(_0xe4b4('0x5b'));if(_0x365a41[_0xe4b4('0x5c')]){var _0x96827c={};_0x96827c[_0xe4b4('0x5d')]=_0x365a41['username'];_0x96827c[_0xe4b4('0x23')]=_0x434922[_0xe4b4('0x23')];_0x96827c[_0xe4b4('0x34')]=_0x365a41['phone'];_0x96827c[_0xe4b4('0x5e')]=_0x434922['body'];_0x96827c['timestamp']=+new Date();var _0x1038d5='';var _0x385309='';var _0x598f67=Object[_0xe4b4('0x5f')](_0x96827c);_0x598f67[_0xe4b4('0x60')]();for(var _0x561b09=0x0;_0x561b09<_0x598f67[_0xe4b4('0x61')];_0x561b09++){if(_0x1038d5!=''){_0x1038d5+='&';}_0x1038d5+=_0x598f67[_0x561b09]+'='+encodeURIComponent(_0x96827c[_0x598f67[_0x561b09]]);_0x385309+=_0x96827c[_0x598f67[_0x561b09]];}_0x385309+=_0x365a41['apiKey'];_0x385309=_0x40a5ec[_0xe4b4('0x62')](_0xe4b4('0x63'))[_0xe4b4('0x1c')](_0x385309)['digest'](_0xe4b4('0x64'));if(_0x1038d5!==''){_0x1038d5+='&';}_0x1038d5+=_0xe4b4('0x65')+_0x385309;var _0x39dbdf={'method':'GET','uri':_0x365a41[_0xe4b4('0x57')]+'/external/get/send.php?'+_0x1038d5,'json':!![]};return rp(_0x39dbdf)['then'](function(_0x5ececa){var _0x2a31e8=Object[_0xe4b4('0x5f')](_0x5ececa);if(_0x5ececa[_0x2a31e8[0x0]]['error']&&parseInt(_0x5ececa[_0x2a31e8[0x0]]['error'])===0x0){var _0x5d17fa={'messageId':_0x5ececa[_0x2a31e8[0x0]][_0xe4b4('0x66')]};if(!_0x365a41['deliveryReport']){_0x5d17fa[_0xe4b4('0x3e')]=!![];}return _0x2ecdbe[_0xe4b4('0x1c')](_0x5d17fa);}else{return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),'afterCreate',_0xe4b4('0x67'),util[_0xe4b4('0x2e')](_0x5ececa['error'],{'showHidden':![],'depth':null}));}})[_0xe4b4('0x1e')](function(_0x360667){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe4b4('0x2d'),_0xe4b4('0x67'),util[_0xe4b4('0x2e')](_0x360667,{'showHidden':![],'depth':null}));});}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),'afterCreate',_0xe4b4('0x67'),_0xe4b4('0x68'));}break;case _0xe4b4('0x69'):if(_0x365a41[_0xe4b4('0x5c')]){var _0x36648f={'method':_0xe4b4('0x39'),'uri':_0xe4b4('0x6a'),'headers':{'Authorization':_0x365a41[_0xe4b4('0x5c')]},'body':{'content':_0x434922[_0xe4b4('0xf')],'to':[_0x434922[_0xe4b4('0x23')]],'from':_0x365a41[_0xe4b4('0x23')],'binary':![],'clientMessageId':_0xe4b4('0x6b'),'charset':_0xe4b4('0x6c')},'json':!![]};rp(_0x36648f)['then'](function(_0x5960b0){if(!_0x5960b0['error']){var _0x37a643={'messageId':_0x5960b0[_0xe4b4('0x25')][0x0]['apiMessageId']};if(!_0x365a41[_0xe4b4('0x42')]){_0x37a643[_0xe4b4('0x3e')]=!![];}return _0x2ecdbe[_0xe4b4('0x1c')](_0x37a643);}else{return logger['error'](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x69'),util[_0xe4b4('0x2e')](_0x5960b0['error'],{'showHidden':![],'depth':null}));}})[_0xe4b4('0x1e')](function(_0x2817c2){return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x69'),util['inspect'](_0x2817c2,{'showHidden':![],'depth':null}));});}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x69'),_0xe4b4('0x68'));}break;case _0xe4b4('0x6d'):if(_0x365a41[_0xe4b4('0x31')]&&_0x365a41[_0xe4b4('0x32')]){var _0x32f39a=util[_0xe4b4('0x46')]('%s:%s',_0x365a41[_0xe4b4('0x31')],_0x365a41[_0xe4b4('0x32')]);var _0x1542a8={'method':'POST','uri':_0xe4b4('0x6e')+_0x365a41[_0xe4b4('0x6f')]+_0xe4b4('0x70'),'body':{'to':[_0x434922[_0xe4b4('0x23')]],'text':_0x434922[_0xe4b4('0xf')],'from':_0x365a41[_0xe4b4('0x23')],'applicationId':_0x365a41[_0xe4b4('0x71')]},'headers':{'Authorization':util[_0xe4b4('0x46')]('Basic\x20%s',new Buffer(_0x32f39a)[_0xe4b4('0x49')]('base64'))},'json':!![]};rp(_0x1542a8)['then'](function(_0x3e2717){if(_0x3e2717['id']){var _0x3cb9d3={'messageId':_0x3e2717['id']};return _0x2ecdbe['update'](_0x3cb9d3);}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x6d'),util[_0xe4b4('0x2e')](_0x3e2717,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4c9fd0){logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe4b4('0x2d'),'bandwidth',util[_0xe4b4('0x2e')](_0x4c9fd0,{'showHidden':![],'depth':null}));});}else{logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),'afterCreate',_0xe4b4('0x6d'),_0xe4b4('0x4e'));}break;case _0xe4b4('0x72'):if(_0x365a41[_0xe4b4('0x5c')]){var _0x129048={};var _0x39dbdf={'method':_0xe4b4('0x39'),'uri':_0xe4b4('0x73'),'headers':{'Authorization':_0xe4b4('0x74')+_0x365a41[_0xe4b4('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x365a41['phone'],'to':_0x434922['phone'],'text':_0x434922['body']},'json':!![]};return rp(_0x39dbdf)[_0xe4b4('0x1b')](function(_0x3f578b){if(_0x3f578b[_0xe4b4('0x75')]==0xca){_0x129048[_0xe4b4('0x76')]=_0x3f578b;var _0x209ae9={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe4b4('0x74')+_0x365a41[_0xe4b4('0x5c')],'Content-Type':_0xe4b4('0x77')},'body':{'refid':_0x129048[_0xe4b4('0x76')][_0xe4b4('0x78')]},'json':!![]};return rp(_0x209ae9)[_0xe4b4('0x1b')](function(_0x489e11){_0x129048['status']=_0x489e11;var _0x4593b6={'messageId':_0x129048['message']['refid'],'read':!![]};return _0x2ecdbe['update'](_0x4593b6);});}else{return logger[_0xe4b4('0x2b')](_0xe4b4('0x2c'),_0xe4b4('0x2d'),'intelepeer',util[_0xe4b4('0x2e')](_0x3f578b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2167d4){return logger[_0xe4b4('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe4b4('0x72'),util['inspect'](_0x2167d4,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xe4b4('0x2c'),_0xe4b4('0x2d'),_0xe4b4('0x72'),'Token\x20not\x20received');}break;}}})[_0xe4b4('0x79')](function(){_0x26d7d8();});}else{_0x26d7d8();}}},'charset':_0xe4b4('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb1e9=['Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','out','secret','isNil','SmsInteractionId','SmsInteraction','update','createdAt','toLowerCase','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','accountSid','messages','remote','/api/sms/messages/','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/','password','smsMethod','sender','login?username=','username','&password=','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20'];(function(_0x328bfe,_0x7e3319){var _0x44e343=function(_0x558849){while(--_0x558849){_0x328bfe['push'](_0x328bfe['shift']());}};_0x44e343(++_0x7e3319);}(_0xb1e9,0x197));var _0x9b1e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb1e9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x9b1e('0x0'));var util=require(_0x9b1e('0x1'));var logger=require('../../config/logger')(_0x9b1e('0x2'));var moment=require(_0x9b1e('0x3'));var BPromise=require(_0x9b1e('0x4'));var rp=require(_0x9b1e('0x5'));var fs=require('fs');var path=require(_0x9b1e('0x6'));var rimraf=require(_0x9b1e('0x7'));var config=require(_0x9b1e('0x8'));var attributes=require(_0x9b1e('0x9'));module[_0x9b1e('0xa')]=function(_0x17d3b5,_0x20e4c3){return _0x17d3b5['define'](_0x9b1e('0xb'),attributes,{'tableName':_0x9b1e('0xc'),'paranoid':![],'indexes':[{'name':_0x9b1e('0xd'),'fields':[_0x9b1e('0xd')]},{'name':_0x9b1e('0xe'),'fields':[_0x9b1e('0xf')],'type':_0x9b1e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e26ce,_0x5918c4,_0x790505){var _0x56f553=_0x17d3b5['models'];var _0x936323=_0x5e26ce[_0x9b1e('0x11')]({'plain':!![]});if(_0x936323[_0x9b1e('0x12')]['toLowerCase']()==='in'||_0x936323[_0x9b1e('0x12')]['toLowerCase']()===_0x9b1e('0x13')&&!_0x936323[_0x9b1e('0x14')]&&!_['isNil'](_0x936323['UserId'])&&!_[_0x9b1e('0x15')](_0x936323[_0x9b1e('0x16')])){_0x56f553[_0x9b1e('0x17')]['findOne']({'where':{'id':_0x936323[_0x9b1e('0x16')]}})['then'](function(_0x1bdc6b){if(_0x1bdc6b){_0x1bdc6b[_0x9b1e('0x18')]({'lastMsgAt':_0x936323[_0x9b1e('0x19')],'lastMsgDirection':_0x936323['direction'][_0x9b1e('0x1a')]()});}})[_0x9b1e('0x1b')](function(_0x3347e0){console[_0x9b1e('0x1c')](_0x3347e0);});}if(_0x936323['direction']===_0x9b1e('0x13')&&!_0x936323[_0x9b1e('0x14')]){var _0x42d9a4;_0x56f553[_0x9b1e('0x1d')][_0x9b1e('0x1e')]({'where':{'id':_0x936323[_0x9b1e('0x1f')]},'raw':!![]})[_0x9b1e('0x20')](function(_0x5becd6){_0x42d9a4=_0x5becd6;if(_0x42d9a4&&_0x42d9a4[_0x9b1e('0x21')]){switch(_0x42d9a4[_0x9b1e('0x21')]){case _0x9b1e('0x22'):var _0x2e0a78=require(_0x9b1e('0x22'));if(_0x42d9a4['accountSid']&&_0x42d9a4[_0x9b1e('0x23')]&&_0x42d9a4[_0x9b1e('0x24')]){var _0x38d7ee=new _0x2e0a78(_0x42d9a4[_0x9b1e('0x25')],_0x42d9a4['authToken']);_0x38d7ee[_0x9b1e('0x26')]['create']({'body':_0x936323[_0x9b1e('0xf')],'to':_0x936323['phone'],'from':_0x42d9a4['phone'],'statusCallback':_0x42d9a4[_0x9b1e('0x27')]+_0x9b1e('0x28')+_0x936323['id']+'/status?token='+_0x42d9a4[_0x9b1e('0x29')]})['then'](function(_0x16e4bb){if(_0x16e4bb[_0x9b1e('0x2a')]){return _0x5e26ce[_0x9b1e('0x18')]({'messageId':_0x16e4bb[_0x9b1e('0x2a')]});}})[_0x9b1e('0x1b')](function(_0x250037){logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x22'),util[_0x9b1e('0x2d')](_0x250037,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x22'),_0x9b1e('0x2e'));}break;case _0x9b1e('0x2f'):var _0x4ad652=_0x9b1e('0x30');if(_0x42d9a4['username']&&_0x42d9a4[_0x9b1e('0x31')]){var _0x35cb68={'recipient':[_0x936323[_0x9b1e('0x24')]],'message':_0x936323[_0x9b1e('0xf')],'message_type':_0x42d9a4[_0x9b1e('0x32')]};if(_0x42d9a4[_0x9b1e('0x32')]&&_0x42d9a4[_0x9b1e('0x32')]!=='SI'){_0x35cb68[_0x9b1e('0x33')]=_0x42d9a4[_0x9b1e('0x24')];}var _0x9887e5={'url':_0x4ad652+_0x9b1e('0x34')+_0x42d9a4[_0x9b1e('0x35')]+_0x9b1e('0x36')+_0x42d9a4[_0x9b1e('0x31')],'method':_0x9b1e('0x37')};rp(_0x9887e5)[_0x9b1e('0x20')](function(_0x4ebda3){var _0x1a05c5=_0x4ebda3['split'](';');var _0x2f5a73={'user_key':_0x1a05c5[0x0],'session_key':_0x1a05c5[0x1]};_0x9887e5={'url':_0x4ad652+_0x9b1e('0x38'),'method':_0x9b1e('0x39'),'headers':{'user_key':_0x2f5a73[_0x9b1e('0x3a')],'Session_key':_0x2f5a73[_0x9b1e('0x3b')]},'json':!![],'body':_0x35cb68};return rp(_0x9887e5);})[_0x9b1e('0x20')](function(_0x2e7378){if(_0x2e7378[_0x9b1e('0x3c')]>=0x1){var _0x510cec={'messageId':_0x2e7378['internal_order_id']};if(_0x42d9a4[_0x9b1e('0x32')]!=='GP'||!_0x42d9a4[_0x9b1e('0x3d')]){_0x510cec[_0x9b1e('0x3e')]=!![];}return _0x5e26ce[_0x9b1e('0x18')](_0x510cec);}else{return logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x2f'),util[_0x9b1e('0x2d')](_0x2e7378,{'showHidden':![],'depth':null}));}})[_0x9b1e('0x1b')](function(_0x4907ee){return logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x2f'),util[_0x9b1e('0x2d')](_0x4907ee,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b1e('0x2c'),_0x9b1e('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9b1e('0x3f'):if(_0x42d9a4[_0x9b1e('0x23')]){var _0x1a343b={'recipient':_0x936323['phone'],'message':_0x936323['body'],'sender':_0x42d9a4[_0x9b1e('0x40')]||_0x42d9a4[_0x9b1e('0x24')],'authorization':_0x42d9a4[_0x9b1e('0x23')]};var _0x5918c4={'method':_0x9b1e('0x39'),'uri':_0x9b1e('0x41'),'body':_0x1a343b,'json':!![]};rp(_0x5918c4)[_0x9b1e('0x20')](function(_0xc90f92){var _0x124f37={'messageId':_0xc90f92['requestid']};if(!_0x42d9a4[_0x9b1e('0x3d')]){_0x124f37[_0x9b1e('0x3e')]=!![];}return _0x5e26ce[_0x9b1e('0x18')](_0x124f37);})[_0x9b1e('0x1b')](function(_0x5d902d){logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x3f'),util['inspect'](_0x5d902d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x3f'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x42d9a4['username']&&_0x42d9a4[_0x9b1e('0x31')]){var _0x1a343b={'messages':[{'source':'xCALLY\x20Motion','to':_0x936323[_0x9b1e('0x24')],'body':_0x936323[_0x9b1e('0xf')],'from':_0x42d9a4['senderString']||_0x42d9a4['phone']}]};var _0x1cc530=util[_0x9b1e('0x42')](_0x9b1e('0x43'),_0x42d9a4[_0x9b1e('0x35')],_0x42d9a4[_0x9b1e('0x31')]);var _0x5918c4={'method':_0x9b1e('0x39'),'uri':_0x9b1e('0x44'),'body':_0x1a343b,'headers':{'Authorization':util['format'](_0x9b1e('0x45'),new Buffer(_0x1cc530)[_0x9b1e('0x46')](_0x9b1e('0x47')))},'json':!![]};rp(_0x5918c4)[_0x9b1e('0x20')](function(_0x48e20a){if(_0x48e20a[_0x9b1e('0x48')]>=0xc8&&_0x48e20a[_0x9b1e('0x48')]<=0xce){if(_0x48e20a[_0x9b1e('0x49')]&&_0x48e20a[_0x9b1e('0x49')][_0x9b1e('0x4a')]>0x0){var _0x5a8006=_[_0x9b1e('0x4b')](_0x48e20a[_0x9b1e('0x49')][_0x9b1e('0x26')]);var _0x53e26c={'messageId':_0x5a8006[_0x9b1e('0x4c')]};if(!_0x42d9a4[_0x9b1e('0x3d')]){_0x53e26c[_0x9b1e('0x3e')]=!![];}return _0x5e26ce['update'](_0x53e26c);}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x4d'),util[_0x9b1e('0x2d')](_0x48e20a,{'showHidden':![],'depth':null}));}}else{logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b1e('0x2c'),_0x9b1e('0x4d'),util[_0x9b1e('0x2d')](_0x48e20a,{'showHidden':![],'depth':null}));}})[_0x9b1e('0x1b')](function(_0x591d92){logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x4d'),util[_0x9b1e('0x2d')](_0x591d92,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9b1e('0x4e'):if(_0x42d9a4[_0x9b1e('0x4f')]&&_0x42d9a4['authToken']){var _0x1a343b={'dst':_0x936323[_0x9b1e('0x24')],'text':_0x936323['body'],'src':_0x42d9a4['senderString']||_0x42d9a4[_0x9b1e('0x24')],'url':_0x42d9a4['remote']+_0x9b1e('0x28')+_0x936323['id']+'/status?token='+_0x42d9a4[_0x9b1e('0x29')]};var _0x1cc530=util[_0x9b1e('0x42')](_0x9b1e('0x43'),_0x42d9a4['authId'],_0x42d9a4[_0x9b1e('0x23')]);var _0x5918c4={'method':_0x9b1e('0x39'),'uri':util[_0x9b1e('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x42d9a4[_0x9b1e('0x4f')]),'body':_0x1a343b,'headers':{'Authorization':util[_0x9b1e('0x42')](_0x9b1e('0x45'),new Buffer(_0x1cc530)[_0x9b1e('0x46')](_0x9b1e('0x47')))},'json':!![]};rp(_0x5918c4)['then'](function(_0x46f980){var _0x2ad1ad={'messageId':_0x46f980[_0x9b1e('0x50')][0x0]};return _0x5e26ce['update'](_0x2ad1ad);})['catch'](function(_0x19f9c9){logger['error'](_0x9b1e('0x2b'),'afterCreate',_0x9b1e('0x4e'),util[_0x9b1e('0x2d')](_0x19f9c9,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x4e'),_0x9b1e('0x51'));}break;case _0x9b1e('0x52'):if(_0x42d9a4[_0x9b1e('0x35')]&&_0x42d9a4['password']){if(_0x42d9a4[_0x9b1e('0x53')]){var _0x228714={'method':_0x9b1e('0x39'),'uri':_0x42d9a4[_0x9b1e('0x53')]+_0x9b1e('0x54'),'body':{'username':_0x42d9a4[_0x9b1e('0x35')],'password':_0x42d9a4[_0x9b1e('0x31')]},'json':!![]};return rp(_0x228714)[_0x9b1e('0x20')](function(_0x202380){var _0x30e33f={'method':_0x9b1e('0x39'),'uri':_0x42d9a4[_0x9b1e('0x53')]+_0x9b1e('0x55'),'body':{'messages':[{'from':_0x42d9a4[_0x9b1e('0x24')],'destinations':[{'to':_0x936323[_0x9b1e('0x24')]}],'text':_0x936323['body'],'notifyUrl':_0x42d9a4[_0x9b1e('0x27')]+_0x9b1e('0x28')+_0x936323['id']+_0x9b1e('0x56')+_0x42d9a4[_0x9b1e('0x29')],'notifyContentType':_0x9b1e('0x57'),'callbackData':_0x42d9a4['phone']+';'+_0x936323[_0x9b1e('0xf')]}]},'headers':{'Authorization':_0x9b1e('0x58')+_0x202380[_0x9b1e('0x29')]},'json':!![]};return rp(_0x30e33f)[_0x9b1e('0x20')](function(_0x4b6772){if(_0x4b6772['messages']){var _0x480ef1={'messageId':_0x4b6772[_0x9b1e('0x26')][0x0][_0x9b1e('0xd')]};if(!_0x42d9a4[_0x9b1e('0x3d')]){_0x480ef1[_0x9b1e('0x3e')]=!![];}return _0x5e26ce[_0x9b1e('0x18')](_0x480ef1);}else{return logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),'afterCreate',_0x9b1e('0x52'),util['inspect'](_0x4b6772,{'showHidden':![],'depth':null}));}});})[_0x9b1e('0x1b')](function(_0xfbd4fb){return logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b1e('0x2c'),_0x9b1e('0x52'),util[_0x9b1e('0x2d')](_0xfbd4fb,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b1e('0x2c'),_0x9b1e('0x52'),_0x9b1e('0x59'));}}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x52'),_0x9b1e('0x5a'));}break;case _0x9b1e('0x5b'):var _0x142caa=require(_0x9b1e('0x5c'));if(_0x42d9a4[_0x9b1e('0x5d')]){var _0x3186af={};_0x3186af[_0x9b1e('0x5e')]=_0x42d9a4[_0x9b1e('0x35')];_0x3186af[_0x9b1e('0x24')]=_0x936323[_0x9b1e('0x24')];_0x3186af['sender']=_0x42d9a4[_0x9b1e('0x24')];_0x3186af[_0x9b1e('0x5f')]=_0x936323[_0x9b1e('0xf')];_0x3186af[_0x9b1e('0x60')]=+new Date();var _0xa4932f='';var _0x1ec397='';var _0x2586cf=Object[_0x9b1e('0x61')](_0x3186af);_0x2586cf[_0x9b1e('0x62')]();for(var _0x47aea0=0x0;_0x47aea0<_0x2586cf[_0x9b1e('0x63')];_0x47aea0++){if(_0xa4932f!=''){_0xa4932f+='&';}_0xa4932f+=_0x2586cf[_0x47aea0]+'='+encodeURIComponent(_0x3186af[_0x2586cf[_0x47aea0]]);_0x1ec397+=_0x3186af[_0x2586cf[_0x47aea0]];}_0x1ec397+=_0x42d9a4[_0x9b1e('0x5d')];_0x1ec397=_0x142caa[_0x9b1e('0x64')](_0x9b1e('0x65'))[_0x9b1e('0x18')](_0x1ec397)[_0x9b1e('0x66')](_0x9b1e('0x67'));if(_0xa4932f!==''){_0xa4932f+='&';}_0xa4932f+=_0x9b1e('0x68')+_0x1ec397;var _0x9887e5={'method':_0x9b1e('0x37'),'uri':_0x42d9a4['baseUrl']+_0x9b1e('0x69')+_0xa4932f,'json':!![]};return rp(_0x9887e5)[_0x9b1e('0x20')](function(_0x37ae1a){var _0x1d6499=Object[_0x9b1e('0x61')](_0x37ae1a);if(_0x37ae1a[_0x1d6499[0x0]][_0x9b1e('0x1c')]&&parseInt(_0x37ae1a[_0x1d6499[0x0]]['error'])===0x0){var _0x1eabc1={'messageId':_0x37ae1a[_0x1d6499[0x0]][_0x9b1e('0x6a')]};if(!_0x42d9a4[_0x9b1e('0x3d')]){_0x1eabc1[_0x9b1e('0x3e')]=!![];}return _0x5e26ce[_0x9b1e('0x18')](_0x1eabc1);}else{return logger['error'](_0x9b1e('0x2b'),'afterCreate',_0x9b1e('0x5b'),util[_0x9b1e('0x2d')](_0x37ae1a[_0x9b1e('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5bff8e){return logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x5b'),util[_0x9b1e('0x2d')](_0x5bff8e,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x5b'),_0x9b1e('0x6b'));}break;case _0x9b1e('0x6c'):if(_0x42d9a4['apiKey']){var _0xa37b8c={'method':_0x9b1e('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x42d9a4[_0x9b1e('0x5d')]},'body':{'content':_0x936323[_0x9b1e('0xf')],'to':[_0x936323['phone']],'from':_0x42d9a4['phone'],'binary':![],'clientMessageId':_0x9b1e('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0xa37b8c)['then'](function(_0x27244e){if(!_0x27244e[_0x9b1e('0x1c')]){var _0x2f3af3={'messageId':_0x27244e[_0x9b1e('0x26')][0x0][_0x9b1e('0x6e')]};if(!_0x42d9a4[_0x9b1e('0x3d')]){_0x2f3af3[_0x9b1e('0x3e')]=!![];}return _0x5e26ce[_0x9b1e('0x18')](_0x2f3af3);}else{return logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b1e('0x2c'),_0x9b1e('0x6c'),util[_0x9b1e('0x2d')](_0x27244e['error'],{'showHidden':![],'depth':null}));}})[_0x9b1e('0x1b')](function(_0x234b73){return logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9b1e('0x6c'),util[_0x9b1e('0x2d')](_0x234b73,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x6c'),_0x9b1e('0x6b'));}break;case _0x9b1e('0x6f'):if(_0x42d9a4[_0x9b1e('0x35')]&&_0x42d9a4[_0x9b1e('0x31')]){var _0x1cc530=util[_0x9b1e('0x42')](_0x9b1e('0x43'),_0x42d9a4[_0x9b1e('0x35')],_0x42d9a4[_0x9b1e('0x31')]);var _0x5918c4={'method':_0x9b1e('0x39'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x42d9a4['accountId']+'/messages','body':{'to':[_0x936323['phone']],'text':_0x936323[_0x9b1e('0xf')],'from':_0x42d9a4[_0x9b1e('0x24')],'applicationId':_0x42d9a4[_0x9b1e('0x70')]},'headers':{'Authorization':util[_0x9b1e('0x42')](_0x9b1e('0x45'),new Buffer(_0x1cc530)[_0x9b1e('0x46')](_0x9b1e('0x47')))},'json':!![]};rp(_0x5918c4)['then'](function(_0x3416d0){if(_0x3416d0['id']){var _0x289bcb={'messageId':_0x3416d0['id']};return _0x5e26ce[_0x9b1e('0x18')](_0x289bcb);}else{logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9b1e('0x6f'),util[_0x9b1e('0x2d')](_0x3416d0,{'showHidden':![],'depth':null}));}})[_0x9b1e('0x1b')](function(_0xea4da4){logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x6f'),util['inspect'](_0xea4da4,{'showHidden':![],'depth':null}));});}else{logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),_0x9b1e('0x6f'),_0x9b1e('0x5a'));}break;case _0x9b1e('0x71'):if(_0x42d9a4[_0x9b1e('0x5d')]){var _0x3f8de2={};var _0x9887e5={'method':'POST','uri':_0x9b1e('0x72'),'headers':{'Authorization':_0x9b1e('0x73')+_0x42d9a4['apiKey'],'Content-Type':_0x9b1e('0x57')},'body':{'from':_0x42d9a4['phone'],'to':_0x936323[_0x9b1e('0x24')],'text':_0x936323[_0x9b1e('0xf')]},'json':!![]};return rp(_0x9887e5)[_0x9b1e('0x20')](function(_0x475c19){if(_0x475c19[_0x9b1e('0x74')]==0xca){_0x3f8de2[_0x9b1e('0x75')]=_0x475c19;var _0x413c74={'method':_0x9b1e('0x39'),'uri':_0x9b1e('0x76'),'headers':{'Authorization':_0x9b1e('0x73')+_0x42d9a4[_0x9b1e('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x3f8de2['message'][_0x9b1e('0x77')]},'json':!![]};return rp(_0x413c74)['then'](function(_0xa53783){_0x3f8de2[_0x9b1e('0x78')]=_0xa53783;var _0xb6cf1c={'messageId':_0x3f8de2['message'][_0x9b1e('0x77')],'read':!![]};return _0x5e26ce[_0x9b1e('0x18')](_0xb6cf1c);});}else{return logger[_0x9b1e('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b1e('0x2c'),_0x9b1e('0x71'),util[_0x9b1e('0x2d')](_0x475c19,{'showHidden':![],'depth':null}));}})[_0x9b1e('0x1b')](function(_0x49439d){return logger[_0x9b1e('0x1c')](_0x9b1e('0x2b'),_0x9b1e('0x2c'),'intelepeer',util[_0x9b1e('0x2d')](_0x49439d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x9b1e('0x2b'),_0x9b1e('0x2c'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x9b1e('0x79')](function(){_0x790505();});}else{_0x790505();}}},'charset':_0x9b1e('0x7a'),'collate':_0x9b1e('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 882af27..fa328a2 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 _0xdf15=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x37dab4,_0x5322ef){var _0x42eea8=function(_0x378d7b){while(--_0x378d7b){_0x37dab4['push'](_0x37dab4['shift']());}};_0x42eea8(++_0x5322ef);}(_0xdf15,0xee));var _0x5df1=function(_0x3fa41c,_0x5b8094){_0x3fa41c=_0x3fa41c-0x0;var _0x1721fb=_0xdf15[_0x3fa41c];return _0x1721fb;};'use strict';var _=require(_0x5df1('0x0'));var util=require(_0x5df1('0x1'));var moment=require(_0x5df1('0x2'));var BPromise=require(_0x5df1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5df1('0x4'));var db=require(_0x5df1('0x5'))['db'];var utils=require(_0x5df1('0x6'));var logger=require('../../config/logger')(_0x5df1('0x7'));var config=require(_0x5df1('0x8'));var jayson=require(_0x5df1('0x9'));var client=jayson[_0x5df1('0xa')][_0x5df1('0xb')]({'port':0x232a});config['redis']=_[_0x5df1('0xc')](config['redis'],{'host':_0x5df1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5df1('0xe')]));require(_0x5df1('0xf'))[_0x5df1('0x10')](socket);function respondWithRpcPromise(_0x53df0e,_0x437414,_0xf02a0d){return new BPromise(function(_0x1c35de,_0x229a37){return client[_0x5df1('0x11')](_0x53df0e,_0xf02a0d)[_0x5df1('0x12')](function(_0x22257a){logger['info'](_0x5df1('0x13'),_0x437414,_0x5df1('0x14'));logger[_0x5df1('0x15')](_0x5df1('0x16'),_0x437414,_0x5df1('0x14'),JSON['stringify'](_0x22257a));if(_0x22257a['error']){if(_0x22257a['error'][_0x5df1('0x17')]===0x1f4){logger[_0x5df1('0x18')]('SmsMessage,\x20%s,\x20%s',_0x437414,_0x22257a[_0x5df1('0x18')]['message']);return _0x229a37(_0x22257a[_0x5df1('0x18')][_0x5df1('0x19')]);}logger[_0x5df1('0x18')](_0x5df1('0x13'),_0x437414,_0x22257a[_0x5df1('0x18')][_0x5df1('0x19')]);return _0x1c35de(_0x22257a[_0x5df1('0x18')]['message']);}else{logger[_0x5df1('0x1a')](_0x5df1('0x13'),_0x437414,_0x5df1('0x14'));_0x1c35de(_0x22257a[_0x5df1('0x1b')][_0x5df1('0x19')]);}})[_0x5df1('0x1c')](function(_0x3a9bd4){logger[_0x5df1('0x18')](_0x5df1('0x13'),_0x437414,_0x3a9bd4);_0x229a37(_0x3a9bd4);});});}exports[_0x5df1('0x1d')]=function(_0x139df5){var _0x32dd08=this;return new Promise(function(_0x473d29,_0x24f184){return db[_0x5df1('0x1e')]['create'](_0x139df5[_0x5df1('0x1f')],{'raw':_0x139df5[_0x5df1('0x20')]?_0x139df5[_0x5df1('0x20')][_0x5df1('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x395613){logger[_0x5df1('0x1a')](_0x5df1('0x1d'),_0x139df5);logger[_0x5df1('0x15')](_0x5df1('0x1d'),_0x139df5,JSON[_0x5df1('0x22')](_0x395613));_0x473d29(_0x395613);})[_0x5df1('0x1c')](function(_0x37d590){logger['error']('CreateSmsMessage',_0x37d590[_0x5df1('0x19')],_0x139df5);_0x24f184(_0x32dd08[_0x5df1('0x18')](0x1f4,_0x37d590[_0x5df1('0x19')]));});});}; \ No newline at end of file +var _0xb4f7=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb4f7,0xc8));var _0x7b4f=function(_0x3b85c7,_0x1c341c){_0x3b85c7=_0x3b85c7-0x0;var _0x137c8a=_0xb4f7[_0x3b85c7];return _0x137c8a;};'use strict';var _=require(_0x7b4f('0x0'));var util=require(_0x7b4f('0x1'));var moment=require(_0x7b4f('0x2'));var BPromise=require(_0x7b4f('0x3'));var rs=require(_0x7b4f('0x4'));var fs=require('fs');var Redis=require(_0x7b4f('0x5'));var db=require(_0x7b4f('0x6'))['db'];var utils=require(_0x7b4f('0x7'));var logger=require(_0x7b4f('0x8'))(_0x7b4f('0x9'));var config=require(_0x7b4f('0xa'));var jayson=require(_0x7b4f('0xb'));var client=jayson[_0x7b4f('0xc')][_0x7b4f('0xd')]({'port':0x232a});config[_0x7b4f('0xe')]=_[_0x7b4f('0xf')](config[_0x7b4f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b4f('0x10'))(new Redis(config[_0x7b4f('0xe')]));require(_0x7b4f('0x11'))[_0x7b4f('0x12')](socket);function respondWithRpcPromise(_0x5462ff,_0x3e27a3,_0x4a202b){return new BPromise(function(_0x239e2c,_0xc39404){return client['request'](_0x5462ff,_0x4a202b)[_0x7b4f('0x13')](function(_0x40f834){logger[_0x7b4f('0x14')](_0x7b4f('0x15'),_0x3e27a3,'request\x20sent');logger[_0x7b4f('0x16')](_0x7b4f('0x17'),_0x3e27a3,'request\x20sent',JSON[_0x7b4f('0x18')](_0x40f834));if(_0x40f834[_0x7b4f('0x19')]){if(_0x40f834[_0x7b4f('0x19')][_0x7b4f('0x1a')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3e27a3,_0x40f834[_0x7b4f('0x19')][_0x7b4f('0x1b')]);return _0xc39404(_0x40f834[_0x7b4f('0x19')][_0x7b4f('0x1b')]);}logger[_0x7b4f('0x19')]('SmsMessage,\x20%s,\x20%s',_0x3e27a3,_0x40f834['error'][_0x7b4f('0x1b')]);return _0x239e2c(_0x40f834[_0x7b4f('0x19')]['message']);}else{logger[_0x7b4f('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3e27a3,_0x7b4f('0x1c'));_0x239e2c(_0x40f834['result'][_0x7b4f('0x1b')]);}})[_0x7b4f('0x1d')](function(_0x137122){logger[_0x7b4f('0x19')](_0x7b4f('0x15'),_0x3e27a3,_0x137122);_0xc39404(_0x137122);});});}exports[_0x7b4f('0x1e')]=function(_0x4287c0){var _0x1c90e7=this;return new Promise(function(_0x216ed4,_0x242c49){return db[_0x7b4f('0x1f')][_0x7b4f('0x20')](_0x4287c0[_0x7b4f('0x21')],{'raw':_0x4287c0[_0x7b4f('0x22')]?_0x4287c0['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53488c){logger[_0x7b4f('0x14')]('CreateSmsMessage',_0x4287c0);logger[_0x7b4f('0x16')](_0x7b4f('0x1e'),_0x4287c0,JSON[_0x7b4f('0x18')](_0x53488c));_0x216ed4(_0x53488c);})[_0x7b4f('0x1d')](function(_0x299fff){logger['error'](_0x7b4f('0x1e'),_0x299fff[_0x7b4f('0x1b')],_0x4287c0);_0x242c49(_0x1c90e7[_0x7b4f('0x19')](0x1f4,_0x299fff[_0x7b4f('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d4a896f..c64688a 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 _0xeb92=['removeListener','register','length','smsMessage:','save','update','emit'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xeb92,0x146));var _0x2eb9=function(_0xf8d6d8,_0x2c9732){_0xf8d6d8=_0xf8d6d8-0x0;var _0x4a5dfa=_0xeb92[_0xf8d6d8];return _0x4a5dfa;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x2eb9('0x0'),'remove',_0x2eb9('0x1')];function createListener(_0x2f5251,_0x4ad710){return function(_0x3a3660){_0x4ad710[_0x2eb9('0x2')](_0x2f5251,_0x3a3660);};}function removeListener(_0xc52153,_0x1657be){return function(){SmsMessageEvents[_0x2eb9('0x3')](_0xc52153,_0x1657be);};}exports[_0x2eb9('0x4')]=function(_0x3a6f9f){for(var _0x35bae4=0x0,_0x2c87c4=events[_0x2eb9('0x5')];_0x35bae4<_0x2c87c4;_0x35bae4++){var _0x1871ca=events[_0x35bae4];var _0x2bcdad=createListener(_0x2eb9('0x6')+_0x1871ca,_0x3a6f9f);SmsMessageEvents['on'](_0x1871ca,_0x2bcdad);}}; \ No newline at end of file +var _0x39d5=['emit','register','smsMessage:','./smsMessage.events','save','update'];(function(_0x24a7bb,_0x4174cb){var _0xebb640=function(_0x23c93e){while(--_0x23c93e){_0x24a7bb['push'](_0x24a7bb['shift']());}};_0xebb640(++_0x4174cb);}(_0x39d5,0x12f));var _0x539d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x39d5[_0x3054be];return _0x3df150;};'use strict';var SmsMessageEvents=require(_0x539d('0x0'));var events=[_0x539d('0x1'),'remove',_0x539d('0x2')];function createListener(_0x24d4a4,_0x2be2de){return function(_0x339775){_0x2be2de[_0x539d('0x3')](_0x24d4a4,_0x339775);};}function removeListener(_0x214f56,_0x194ea3){return function(){SmsMessageEvents['removeListener'](_0x214f56,_0x194ea3);};}exports[_0x539d('0x4')]=function(_0x5bddc2){for(var _0x499489=0x0,_0x3150c8=events['length'];_0x499489<_0x3150c8;_0x499489++){var _0x4306f6=events[_0x499489];var _0x3b9ae6=createListener(_0x539d('0x5')+_0x4306f6,_0x5bddc2);SmsMessageEvents['on'](_0x4306f6,_0x3b9ae6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ab4388f..7cda2ef 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 _0xdefd=['index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addAgents','put','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xdefd,0x6d));var _0xddef=function(_0x1b3b80,_0x1de656){_0x1b3b80=_0x1b3b80-0x0;var _0xee4c46=_0xdefd[_0x1b3b80];return _0xee4c46;};'use strict';var multer=require(_0xddef('0x0'));var util=require(_0xddef('0x1'));var path=require(_0xddef('0x2'));var timeout=require('connect-timeout');var express=require(_0xddef('0x3'));var router=express[_0xddef('0x4')]();var fs_extra=require(_0xddef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xddef('0x6'));var config=require(_0xddef('0x7'));var controller=require(_0xddef('0x8'));router[_0xddef('0x9')]('/',auth[_0xddef('0xa')](),controller[_0xddef('0xb')]);router[_0xddef('0x9')](_0xddef('0xc'),auth[_0xddef('0xa')](),controller[_0xddef('0xd')]);router[_0xddef('0x9')](_0xddef('0xe'),auth[_0xddef('0xa')](),controller[_0xddef('0xf')]);router['get'](_0xddef('0x10'),auth[_0xddef('0xa')](),controller[_0xddef('0x11')]);router[_0xddef('0x9')](_0xddef('0x12'),auth[_0xddef('0xa')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xddef('0x13')]);router[_0xddef('0x14')]('/',auth[_0xddef('0xa')](),controller[_0xddef('0x15')]);router['post'](_0xddef('0x12'),auth[_0xddef('0xa')](),controller['addTeams']);router['post']('/:id/users',auth[_0xddef('0xa')](),controller[_0xddef('0x16')]);router[_0xddef('0x17')](_0xddef('0xe'),auth[_0xddef('0xa')](),controller['update']);router['delete']('/:id',auth[_0xddef('0xa')](),controller[_0xddef('0x18')]);router[_0xddef('0x19')](_0xddef('0x12'),auth[_0xddef('0xa')](),controller[_0xddef('0x1a')]);router[_0xddef('0x19')](_0xddef('0x1b'),auth[_0xddef('0xa')](),controller[_0xddef('0x1c')]);module[_0xddef('0x1d')]=router; \ No newline at end of file +var _0x6e44=['post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x77305c,_0x30e10a){var _0x167388=function(_0x132609){while(--_0x132609){_0x77305c['push'](_0x77305c['shift']());}};_0x167388(++_0x30e10a);}(_0x6e44,0x1bd));var _0x46e4=function(_0x515232,_0x3de920){_0x515232=_0x515232-0x0;var _0x45685c=_0x6e44[_0x515232];return _0x45685c;};'use strict';var multer=require(_0x46e4('0x0'));var util=require(_0x46e4('0x1'));var path=require('path');var timeout=require(_0x46e4('0x2'));var express=require(_0x46e4('0x3'));var router=express[_0x46e4('0x4')]();var fs_extra=require(_0x46e4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46e4('0x6'));var config=require(_0x46e4('0x7'));var controller=require(_0x46e4('0x8'));router[_0x46e4('0x9')]('/',auth[_0x46e4('0xa')](),controller[_0x46e4('0xb')]);router[_0x46e4('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x46e4('0xc')]);router[_0x46e4('0x9')](_0x46e4('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x46e4('0xa')](),controller[_0x46e4('0xe')]);router['get'](_0x46e4('0xf'),auth[_0x46e4('0xa')](),controller[_0x46e4('0x10')]);router['get'](_0x46e4('0x11'),auth['isAuthenticated'](),controller[_0x46e4('0x12')]);router[_0x46e4('0x13')]('/',auth['isAuthenticated'](),controller[_0x46e4('0x14')]);router[_0x46e4('0x13')]('/:id/teams',auth[_0x46e4('0xa')](),controller[_0x46e4('0x15')]);router[_0x46e4('0x13')](_0x46e4('0x11'),auth[_0x46e4('0xa')](),controller[_0x46e4('0x16')]);router[_0x46e4('0x17')](_0x46e4('0xd'),auth[_0x46e4('0xa')](),controller[_0x46e4('0x18')]);router[_0x46e4('0x19')](_0x46e4('0xd'),auth['isAuthenticated'](),controller[_0x46e4('0x1a')]);router[_0x46e4('0x19')](_0x46e4('0xf'),auth[_0x46e4('0xa')](),controller[_0x46e4('0x1b')]);router[_0x46e4('0x19')](_0x46e4('0x11'),auth[_0x46e4('0xa')](),controller[_0x46e4('0x1c')]);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 21ef7b6..8f66ad6 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 _0x4639=['ENUM','rrmemory','roundrobin','exports','STRING','INTEGER'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x4639,0xbd));var _0x9463=function(_0x55daed,_0x892a6d){_0x55daed=_0x55daed-0x0;var _0x5d5451=_0x4639[_0x55daed];return _0x5d5451;};'use strict';var Sequelize=require('sequelize');module[_0x9463('0x0')]={'name':{'type':Sequelize[_0x9463('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9463('0x1')]},'timeout':{'type':Sequelize[_0x9463('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9463('0x3')](_0x9463('0x4'),'beepall',_0x9463('0x5'))}}; \ No newline at end of file +var _0x172e=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x172e,0x9f));var _0xe172=function(_0x4d16df,_0x264e0c){_0x4d16df=_0x4d16df-0x0;var _0x2e942a=_0x172e[_0x4d16df];return _0x2e942a;};'use strict';var Sequelize=require('sequelize');module[_0xe172('0x0')]={'name':{'type':Sequelize[_0xe172('0x1')],'unique':_0xe172('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe172('0x1')]},'timeout':{'type':Sequelize[_0xe172('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe172('0x4'),_0xe172('0x5'),_0xe172('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e45dce8..4353a5c 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 _0x8b5c=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','end','sendStatus','error','stack','name','status','send','map','SmsQueue','fieldName','key','model','query','attributes','intersection','fields','length','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','describe','getMembers','UserSmsQueue','hasOwnProperty','nolimit','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','ids','Team','Agents','online','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x8b5c,0x10d));var _0xc8b5=function(_0x581bb9,_0xf9d8d9){_0x581bb9=_0x581bb9-0x0;var _0x3275c4=_0x8b5c[_0x581bb9];return _0x3275c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8b5('0x1'));var rp=require(_0xc8b5('0x2'));var moment=require('moment');var BPromise=require(_0xc8b5('0x3'));var Mustache=require(_0xc8b5('0x4'));var util=require('util');var path=require(_0xc8b5('0x5'));var sox=require('sox');var csv=require(_0xc8b5('0x6'));var ejs=require(_0xc8b5('0x7'));var fs=require('fs');var fs_extra=require(_0xc8b5('0x8'));var _=require(_0xc8b5('0x9'));var squel=require(_0xc8b5('0xa'));var crypto=require(_0xc8b5('0xb'));var jsforce=require(_0xc8b5('0xc'));var deskjs=require(_0xc8b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc8b5('0xe'));var Papa=require(_0xc8b5('0xf'));var Redis=require(_0xc8b5('0x10'));var authService=require(_0xc8b5('0x11'));var qs=require(_0xc8b5('0x12'));var as=require(_0xc8b5('0x13'));var hardwareService=require(_0xc8b5('0x14'));var logger=require(_0xc8b5('0x15'))(_0xc8b5('0x16'));var utils=require(_0xc8b5('0x17'));var config=require(_0xc8b5('0x18'));var licenseUtil=require(_0xc8b5('0x19'));var db=require(_0xc8b5('0x1a'))['db'];config[_0xc8b5('0x1b')]=_[_0xc8b5('0x1c')](config[_0xc8b5('0x1b')],{'host':_0xc8b5('0x1d'),'port':0x18eb});var socket=require(_0xc8b5('0x1e'))(new Redis(config[_0xc8b5('0x1b')]));require(_0xc8b5('0x1f'))[_0xc8b5('0x20')](socket);function respondWithStatusCode(_0x26bab7,_0x9ab749){_0x9ab749=_0x9ab749||0xcc;return function(_0x25231b){if(_0x25231b){return _0x26bab7['sendStatus'](_0x9ab749);}return _0x26bab7['status'](_0x9ab749)['end']();};}function respondWithResult(_0x557f1a,_0x1b461c){_0x1b461c=_0x1b461c||0xc8;return function(_0x4b128b){if(_0x4b128b){return _0x557f1a['status'](_0x1b461c)[_0xc8b5('0x21')](_0x4b128b);}};}function respondWithFilteredResult(_0x546e4d,_0x219b5e){return function(_0x5b2064){if(_0x5b2064){var _0x42bcd9=typeof _0x219b5e[_0xc8b5('0x22')]===_0xc8b5('0x23')&&typeof _0x219b5e[_0xc8b5('0x24')]===_0xc8b5('0x23');var _0x222fc6=_0x5b2064[_0xc8b5('0x25')];var _0x3f918f=_0x42bcd9?0x0:_0x219b5e[_0xc8b5('0x22')];var _0x52c209=_0x42bcd9?_0x5b2064[_0xc8b5('0x25')]:_0x219b5e[_0xc8b5('0x22')]+_0x219b5e[_0xc8b5('0x24')];var _0x46c586;if(_0x52c209>=_0x222fc6){_0x52c209=_0x222fc6;_0x46c586=0xc8;}else{_0x46c586=0xce;}_0x546e4d['status'](_0x46c586);return _0x546e4d['set'](_0xc8b5('0x26'),_0x3f918f+'-'+_0x52c209+'/'+_0x222fc6)[_0xc8b5('0x21')](_0x5b2064);}return null;};}function patchUpdates(_0x33bec7){return function(_0x264487){try{jsonpatch[_0xc8b5('0x27')](_0x264487,_0x33bec7,!![]);}catch(_0x15d9d4){return BPromise[_0xc8b5('0x28')](_0x15d9d4);}return _0x264487[_0xc8b5('0x29')]();};}function saveUpdates(_0xbd2a41,_0x30ac0f){return function(_0x4f2aef){if(_0x4f2aef){return _0x4f2aef[_0xc8b5('0x2a')](_0xbd2a41)[_0xc8b5('0x2b')](function(_0x51b64f){return _0x51b64f;});}return null;};}function removeEntity(_0x1610f0,_0x4aad35){return function(_0x2a8b15){if(_0x2a8b15){return _0x2a8b15[_0xc8b5('0x2c')]()[_0xc8b5('0x2b')](function(){var _0x56ea40=_0x2a8b15['get']({'plain':!![]});var _0x1008c5=_0xc8b5('0x2d');return db[_0xc8b5('0x2e')]['destroy']({'where':{'type':_0x1008c5,'resourceId':_0x56ea40['id']}})[_0xc8b5('0x2b')](function(){return _0x2a8b15;});})[_0xc8b5('0x2b')](function(){_0x1610f0['status'](0xcc)[_0xc8b5('0x2f')]();});}};}function handleEntityNotFound(_0x958c68,_0x57f64a){return function(_0x2d837f){if(!_0x2d837f){_0x958c68[_0xc8b5('0x30')](0x194);}return _0x2d837f;};}function handleError(_0x3861dc,_0x5a88d0){_0x5a88d0=_0x5a88d0||0x1f4;return function(_0x5e89d6){logger[_0xc8b5('0x31')](_0x5e89d6[_0xc8b5('0x32')]);if(_0x5e89d6[_0xc8b5('0x33')]){delete _0x5e89d6[_0xc8b5('0x33')];}_0x3861dc[_0xc8b5('0x34')](_0x5a88d0)[_0xc8b5('0x35')](_0x5e89d6);};}exports['index']=function(_0x13a1a4,_0x350471){var _0x191491={},_0x48f191={},_0x1dda4d={'count':0x0,'rows':[]};var _0x163232=_[_0xc8b5('0x36')](db[_0xc8b5('0x37')]['rawAttributes'],function(_0x3cc095){return{'name':_0x3cc095[_0xc8b5('0x38')],'type':_0x3cc095['type'][_0xc8b5('0x39')]};});_0x48f191['model']=_[_0xc8b5('0x36')](_0x163232,_0xc8b5('0x33'));_0x48f191['query']=_['keys'](_0x13a1a4['query']);_0x48f191['filters']=_['intersection'](_0x48f191[_0xc8b5('0x3a')],_0x48f191[_0xc8b5('0x3b')]);_0x191491[_0xc8b5('0x3c')]=_[_0xc8b5('0x3d')](_0x48f191[_0xc8b5('0x3a')],qs[_0xc8b5('0x3e')](_0x13a1a4[_0xc8b5('0x3b')]['fields']));_0x191491[_0xc8b5('0x3c')]=_0x191491[_0xc8b5('0x3c')][_0xc8b5('0x3f')]?_0x191491[_0xc8b5('0x3c')]:_0x48f191[_0xc8b5('0x3a')];if(!_0x13a1a4[_0xc8b5('0x3b')]['hasOwnProperty']('nolimit')){_0x191491[_0xc8b5('0x24')]=qs[_0xc8b5('0x24')](_0x13a1a4[_0xc8b5('0x3b')][_0xc8b5('0x24')]);_0x191491[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x13a1a4['query'][_0xc8b5('0x22')]);}_0x191491['order']=qs[_0xc8b5('0x40')](_0x13a1a4[_0xc8b5('0x3b')]['sort']);_0x191491[_0xc8b5('0x41')]=qs[_0xc8b5('0x42')](_[_0xc8b5('0x43')](_0x13a1a4[_0xc8b5('0x3b')],_0x48f191[_0xc8b5('0x42')]),_0x163232);if(_0x13a1a4[_0xc8b5('0x3b')]['filter']){_0x191491[_0xc8b5('0x41')]=_['merge'](_0x191491['where'],{'$or':_[_0xc8b5('0x36')](_0x163232,function(_0x48a813){if(_0x48a813[_0xc8b5('0x44')]!==_0xc8b5('0x45')){var _0x386545={};_0x386545[_0x48a813[_0xc8b5('0x33')]]={'$like':'%'+_0x13a1a4[_0xc8b5('0x3b')][_0xc8b5('0x46')]+'%'};return _0x386545;}})});}_0x191491=_[_0xc8b5('0x47')]({},_0x191491,_0x13a1a4['options']);var _0x45b2d1={'where':_0x191491[_0xc8b5('0x41')]};return db['SmsQueue'][_0xc8b5('0x25')](_0x45b2d1)[_0xc8b5('0x2b')](function(_0x45e6b3){_0x1dda4d[_0xc8b5('0x25')]=_0x45e6b3;if(_0x13a1a4['query'][_0xc8b5('0x48')]){_0x191491[_0xc8b5('0x49')]=[{'all':!![]}];}return db[_0xc8b5('0x37')][_0xc8b5('0x4a')](_0x191491);})['then'](function(_0x4b3e6a){_0x1dda4d[_0xc8b5('0x4b')]=_0x4b3e6a;return _0x1dda4d;})[_0xc8b5('0x2b')](respondWithFilteredResult(_0x350471,_0x191491))[_0xc8b5('0x4c')](handleError(_0x350471,null));};exports[_0xc8b5('0x4d')]=function(_0xd18c83,_0x411834){var _0x1f086b={'raw':!![],'where':{'id':_0xd18c83[_0xc8b5('0x4e')]['id']}},_0xcffbae={};_0xcffbae[_0xc8b5('0x3a')]=_[_0xc8b5('0x4f')](db[_0xc8b5('0x37')][_0xc8b5('0x50')]);_0xcffbae[_0xc8b5('0x3b')]=_[_0xc8b5('0x4f')](_0xd18c83['query']);_0xcffbae[_0xc8b5('0x42')]=_[_0xc8b5('0x3d')](_0xcffbae[_0xc8b5('0x3a')],_0xcffbae[_0xc8b5('0x3b')]);_0x1f086b[_0xc8b5('0x3c')]=_[_0xc8b5('0x3d')](_0xcffbae[_0xc8b5('0x3a')],qs['fields'](_0xd18c83['query'][_0xc8b5('0x3e')]));_0x1f086b['attributes']=_0x1f086b[_0xc8b5('0x3c')][_0xc8b5('0x3f')]?_0x1f086b[_0xc8b5('0x3c')]:_0xcffbae['model'];if(_0xd18c83['query']['includeAll']){_0x1f086b['include']=[{'all':!![]}];}_0x1f086b=_[_0xc8b5('0x47')]({},_0x1f086b,_0xd18c83[_0xc8b5('0x51')]);return db[_0xc8b5('0x37')][_0xc8b5('0x52')](_0x1f086b)[_0xc8b5('0x2b')](handleEntityNotFound(_0x411834,null))[_0xc8b5('0x2b')](respondWithResult(_0x411834,null))[_0xc8b5('0x4c')](handleError(_0x411834,null));};exports[_0xc8b5('0x53')]=function(_0x130398,_0x35c6e3){return db[_0xc8b5('0x37')][_0xc8b5('0x53')](_0x130398['body'],{})[_0xc8b5('0x2b')](function(_0x22ae60){var _0x284b44=_0x130398[_0xc8b5('0x54')][_0xc8b5('0x55')]({'plain':!![]});if(!_0x284b44)throw new Error(_0xc8b5('0x56'));if(_0x284b44[_0xc8b5('0x57')]===_0xc8b5('0x54')){var _0x404bff=_0x22ae60[_0xc8b5('0x55')]({'plain':!![]});var _0x174f51=_0xc8b5('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x174f51,'userProfileId':_0x284b44[_0xc8b5('0x58')]},'raw':!![]})['then'](function(_0x346e63){if(_0x346e63&&_0x346e63[_0xc8b5('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x404bff[_0xc8b5('0x33')],'resourceId':_0x404bff['id'],'type':_0x346e63[_0xc8b5('0x33')],'sectionId':_0x346e63['id']},{})['then'](function(){return _0x22ae60;});}else{return _0x22ae60;}})[_0xc8b5('0x4c')](function(_0x29aa3b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29aa3b);throw _0x29aa3b;});}return _0x22ae60;})[_0xc8b5('0x2b')](respondWithResult(_0x35c6e3,0xc9))['catch'](handleError(_0x35c6e3,null));};exports['update']=function(_0x49f40b,_0x6a0d29){if(_0x49f40b[_0xc8b5('0x5a')]['id']){delete _0x49f40b[_0xc8b5('0x5a')]['id'];}return db['SmsQueue'][_0xc8b5('0x52')]({'where':{'id':_0x49f40b['params']['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x6a0d29,null))[_0xc8b5('0x2b')](saveUpdates(_0x49f40b[_0xc8b5('0x5a')],null))[_0xc8b5('0x2b')](respondWithResult(_0x6a0d29,null))[_0xc8b5('0x4c')](handleError(_0x6a0d29,null));};exports['destroy']=function(_0x45a0b7,_0x130c18){return db['SmsQueue'][_0xc8b5('0x52')]({'where':{'id':_0x45a0b7[_0xc8b5('0x4e')]['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x130c18,null))[_0xc8b5('0x2b')](removeEntity(_0x130c18,null))[_0xc8b5('0x4c')](handleError(_0x130c18,null));};exports[_0xc8b5('0x5b')]=function(_0x166145,_0x2a0ae0){return db[_0xc8b5('0x37')]['describe']()[_0xc8b5('0x2b')](respondWithResult(_0x2a0ae0,null))[_0xc8b5('0x4c')](handleError(_0x2a0ae0,null));};exports[_0xc8b5('0x5c')]=function(_0x8c100,_0x8f0ad3,_0x4eff51){var _0x4a3548={'raw':!![],'where':{}},_0x4cc47d={},_0x3f0937;return db['SmsQueue']['findOne']({'where':{'id':_0x8c100[_0xc8b5('0x4e')]['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x8f0ad3,null))[_0xc8b5('0x2b')](function(_0x520677){if(_0x520677){_0x3f0937=_0x520677[_0xc8b5('0x55')]({'plain':!![]});_0x4cc47d[_0xc8b5('0x3a')]=_['keys'](db[_0xc8b5('0x5d')][_0xc8b5('0x50')]);_0x4cc47d['query']=_['keys'](_0x8c100['query']);_0x4cc47d[_0xc8b5('0x42')]=_[_0xc8b5('0x3d')](_0x4cc47d[_0xc8b5('0x3a')],_0x4cc47d['query']);_0x4a3548[_0xc8b5('0x3c')]=_[_0xc8b5('0x3d')](_0x4cc47d[_0xc8b5('0x3a')],qs[_0xc8b5('0x3e')](_0x8c100[_0xc8b5('0x3b')][_0xc8b5('0x3e')]));_0x4a3548[_0xc8b5('0x3c')]=_0x4a3548[_0xc8b5('0x3c')][_0xc8b5('0x3f')]?_0x4a3548[_0xc8b5('0x3c')]:_0x4cc47d[_0xc8b5('0x3a')];if(!_0x8c100[_0xc8b5('0x3b')][_0xc8b5('0x5e')](_0xc8b5('0x5f'))){_0x4a3548[_0xc8b5('0x24')]=qs['limit'](_0x8c100[_0xc8b5('0x3b')][_0xc8b5('0x24')]);_0x4a3548['offset']=qs[_0xc8b5('0x22')](_0x8c100['query']['offset']);}_0x4a3548[_0xc8b5('0x60')]=qs['sort'](_0x8c100[_0xc8b5('0x3b')][_0xc8b5('0x40')]);_0x4a3548[_0xc8b5('0x41')]=qs['filters'](_[_0xc8b5('0x43')](_0x8c100[_0xc8b5('0x3b')],_0x4cc47d[_0xc8b5('0x42')]));_0x4a3548['where'][_0xc8b5('0x61')]=_0x520677['id'];if(_0x8c100[_0xc8b5('0x3b')]['filter']){_0x4a3548[_0xc8b5('0x41')]=_[_0xc8b5('0x47')](_0x4a3548[_0xc8b5('0x41')],{'$or':_[_0xc8b5('0x36')](_0x4a3548[_0xc8b5('0x3c')],function(_0x456f4a){var _0x2f4453={};_0x2f4453[_0x456f4a]={'$like':'%'+_0x8c100[_0xc8b5('0x3b')][_0xc8b5('0x46')]+'%'};return _0x2f4453;})});}_0x4a3548=_[_0xc8b5('0x47')]({},_0x4a3548,_0x8c100['options']);return db[_0xc8b5('0x5d')][_0xc8b5('0x4a')](_0x4a3548);}})[_0xc8b5('0x2b')](function(_0x3d7e47){if(_0x3d7e47){return db[_0xc8b5('0x62')][_0xc8b5('0x63')]({'where':{'id':_[_0xc8b5('0x36')](_0x3d7e47,_0xc8b5('0x64')),'role':_0xc8b5('0x65')},'attributes':['id',_0xc8b5('0x33'),_0xc8b5('0x66'),_0xc8b5('0x67'),_0xc8b5('0x68')]});}})[_0xc8b5('0x2b')](function(_0x1a6215){if(_0x1a6215){return{'count':_0x1a6215[_0xc8b5('0x25')],'rows':_[_0xc8b5('0x36')](_0x1a6215[_0xc8b5('0x4b')],function(_0x52016e){return{'membername':_0x52016e[_0xc8b5('0x33')],'UserId':_0x52016e['id'],'queue_name':_0x3f0937[_0xc8b5('0x33')],'SmsQueueId':_0x3f0937['id'],'interface':util[_0xc8b5('0x69')](_0xc8b5('0x6a'),_0xc8b5('0x6b'),_0x52016e[_0xc8b5('0x33')]),'penalty':0x0,'paused':_0x52016e[_0xc8b5('0x66')],'createdAt':_0x52016e['createdAt'],'updatedAt':_0x52016e[_0xc8b5('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x8f0ad3,_0x4a3548))[_0xc8b5('0x4c')](handleError(_0x8f0ad3,null));};exports[_0xc8b5('0x6c')]=function(_0x53c1b4,_0x171134,_0x4c413f){var _0x9070eb={};var _0x339821={};var _0x663583;var _0x4f7290;return db[_0xc8b5('0x37')][_0xc8b5('0x6d')]({'where':{'id':_0x53c1b4[_0xc8b5('0x4e')]['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x171134,null))[_0xc8b5('0x2b')](function(_0x14e7fc){if(_0x14e7fc){_0x663583=_0x14e7fc;_0x339821[_0xc8b5('0x3a')]=_[_0xc8b5('0x4f')](db['Team'][_0xc8b5('0x50')]);_0x339821[_0xc8b5('0x3b')]=_['keys'](_0x53c1b4['query']);_0x339821[_0xc8b5('0x42')]=_['intersection'](_0x339821[_0xc8b5('0x3a')],_0x339821['query']);_0x9070eb[_0xc8b5('0x3c')]=_[_0xc8b5('0x3d')](_0x339821['model'],qs[_0xc8b5('0x3e')](_0x53c1b4['query'][_0xc8b5('0x3e')]));_0x9070eb['attributes']=_0x9070eb[_0xc8b5('0x3c')]['length']?_0x9070eb[_0xc8b5('0x3c')]:_0x339821[_0xc8b5('0x3a')];_0x9070eb[_0xc8b5('0x60')]=qs[_0xc8b5('0x40')](_0x53c1b4['query'][_0xc8b5('0x40')]);_0x9070eb[_0xc8b5('0x41')]=qs[_0xc8b5('0x42')](_[_0xc8b5('0x43')](_0x53c1b4[_0xc8b5('0x3b')],_0x339821[_0xc8b5('0x42')]));if(_0x53c1b4[_0xc8b5('0x3b')][_0xc8b5('0x46')]){_0x9070eb[_0xc8b5('0x41')]=_[_0xc8b5('0x47')](_0x9070eb['where'],{'$or':_['map'](_0x9070eb['attributes'],function(_0x17c3ed){var _0x57784a={};_0x57784a[_0x17c3ed]={'$like':'%'+_0x53c1b4[_0xc8b5('0x3b')][_0xc8b5('0x46')]+'%'};return _0x57784a;})});}_0x9070eb=_[_0xc8b5('0x47')]({},_0x9070eb,_0x53c1b4[_0xc8b5('0x51')]);return _0x663583[_0xc8b5('0x6c')](_0x9070eb);}})[_0xc8b5('0x2b')](function(_0x3e004f){if(_0x3e004f){_0x4f7290=_0x3e004f[_0xc8b5('0x3f')];if(!_0x53c1b4[_0xc8b5('0x3b')][_0xc8b5('0x5e')](_0xc8b5('0x5f'))){_0x9070eb[_0xc8b5('0x24')]=qs[_0xc8b5('0x24')](_0x53c1b4['query'][_0xc8b5('0x24')]);_0x9070eb[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x53c1b4[_0xc8b5('0x3b')][_0xc8b5('0x22')]);}return _0x663583[_0xc8b5('0x6c')](_0x9070eb);}})['then'](function(_0x39e779){if(_0x39e779){return _0x39e779?{'count':_0x4f7290,'rows':_0x39e779}:null;}})[_0xc8b5('0x2b')](respondWithResult(_0x171134,null))[_0xc8b5('0x4c')](handleError(_0x171134,null));};exports['addTeams']=function(_0x24af36,_0x1b284a,_0x50deb9){var _0x5bfe80=_0x24af36['body'][_0xc8b5('0x6e')];return db[_0xc8b5('0x6f')][_0xc8b5('0x4a')]({'where':{'id':_0x5bfe80},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc8b5('0x70'),'attributes':['id',_0xc8b5('0x33'),_0xc8b5('0x71'),'voicePause','interface'],'raw':!![]}]})[_0xc8b5('0x2b')](function(_0x23fb06){if(_0x23fb06){var _0x1a6550=_[_0xc8b5('0x72')](_0x23fb06,function(_0x1215ae){var _0x30ec08=_0x1215ae['get']({'plain':!![]});return _0x30ec08[_0xc8b5('0x70')];});return db['SmsQueue'][_0xc8b5('0x52')]({'where':{'id':_0x24af36['params']['id']}})[_0xc8b5('0x2b')](function(_0x589e01){return db['sequelize'][_0xc8b5('0x73')](function(_0x29f934){return _0x589e01[_0xc8b5('0x74')](_0x5bfe80,{'transaction':_0x29f934})[_0xc8b5('0x2b')](function(){return BPromise[_0xc8b5('0x75')](_0x1a6550,function(_0x33c320){return db[_0xc8b5('0x5d')][_0xc8b5('0x76')]({'where':{'UserId':_0x33c320['id'],'SmsQueueId':_0x24af36[_0xc8b5('0x4e')]['id']},'transaction':_0x29f934});});})[_0xc8b5('0x2b')](function(){_0x1a6550[_0xc8b5('0x77')](function(_0x389eb6){socket[_0xc8b5('0x78')](_0xc8b5('0x79'),{'UserId':_0x389eb6['id'],'SmsQueueId':_0x589e01['id']});});});});});}})[_0xc8b5('0x2b')](respondWithStatusCode(_0x1b284a,null))[_0xc8b5('0x4c')](handleError(_0x1b284a,null));};exports[_0xc8b5('0x7a')]=function(_0x8c4350,_0x485235,_0x10db9f){return db[_0xc8b5('0x6f')][_0xc8b5('0x4a')]({'where':{'id':_0x8c4350[_0xc8b5('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc8b5('0x70'),'attributes':['id'],'raw':!![]}]})[_0xc8b5('0x2b')](handleEntityNotFound(_0x485235,null))['then'](function(_0x111a2e){var _0xbe6def=_[_0xc8b5('0x36')](_0x111a2e,'id');var _0x107140=[];var _0x5db209=[];var _0x2e3805=squel['select']();_0x2e3805['field']('tq.TeamId')['from'](_0xc8b5('0x7b'),'tq')['join'](_0xc8b5('0x7c'),'ut',_0xc8b5('0x7d'))[_0xc8b5('0x41')](_0xc8b5('0x7e'),_0x8c4350[_0xc8b5('0x4e')]['id']);for(var _0x1f9ee2=0x0;_0x1f9ee2<_0x111a2e[_0xc8b5('0x3f')];_0x1f9ee2+=0x1){let _0x367d65=_0x111a2e[_0x1f9ee2];for(var _0x3d2ce6=0x0;_0x3d2ce6<_0x367d65[_0xc8b5('0x70')][_0xc8b5('0x3f')];_0x3d2ce6+=0x1){let _0x43494a=_0x367d65[_0xc8b5('0x70')][_0x3d2ce6];var _0x2bb983=_0x2e3805[_0xc8b5('0x7f')]();_0x2bb983[_0xc8b5('0x41')](_0xc8b5('0x80'),_0x43494a['id']);_0x5db209['push'](db['sequelize']['query'](_0x2bb983[_0xc8b5('0x81')](),{'type':db[_0xc8b5('0x82')]['QueryTypes'][_0xc8b5('0x83')]})[_0xc8b5('0x2b')](function(_0x4d7876){if(_0x4d7876[_0xc8b5('0x3f')]===0x1){return _0x43494a['id'];}else{var _0x3f92f6=_[_0xc8b5('0x84')](_[_0xc8b5('0x36')](_0x4d7876,_0xc8b5('0x85')),function(_0x56bb91){return _[_0xc8b5('0x86')](_0xbe6def,_0x56bb91);});if(_0x3f92f6){return _0x43494a['id'];}}}));}}return BPromise['all'](_0x5db209)[_0xc8b5('0x2b')](function(_0x5943d2){_0x107140=_(_0x107140)[_0xc8b5('0x87')](_0x5943d2)[_0xc8b5('0x88')]()[_0xc8b5('0x89')]();return db[_0xc8b5('0x37')][_0xc8b5('0x52')]({'where':{'id':_0x8c4350['params']['id']}})[_0xc8b5('0x2b')](function(_0x3caa41){return db['sequelize'][_0xc8b5('0x73')](function(_0x525d31){return _0x3caa41[_0xc8b5('0x7a')](_0x8c4350[_0xc8b5('0x3b')][_0xc8b5('0x6e')],{'transaction':_0x525d31})[_0xc8b5('0x2b')](function(){if(!_[_0xc8b5('0x8a')](_0x107140)){return _0x3caa41[_0xc8b5('0x8b')](_0x107140,{'transaction':_0x525d31});}})[_0xc8b5('0x2b')](function(){_0x107140[_0xc8b5('0x77')](function(_0x92f34a){socket[_0xc8b5('0x78')](_0xc8b5('0x8c'),{'UserId':_0x92f34a,'SmsQueueId':_0x3caa41['id']});});});});});});})[_0xc8b5('0x2b')](respondWithStatusCode(_0x485235,null))['catch'](handleError(_0x485235,null));};exports['addAgents']=function(_0x3333e7,_0x2d421b,_0x55f03b){return db[_0xc8b5('0x37')][_0xc8b5('0x52')]({'where':{'id':_0x3333e7['params']['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x2d421b,null))['then'](function(_0x2bbdd9){if(_0x2bbdd9){return _0x2bbdd9[_0xc8b5('0x8d')](_0x3333e7[_0xc8b5('0x5a')]['ids'],_[_0xc8b5('0x8e')](_0x3333e7['body'],[_0xc8b5('0x6e'),'id'])||{})['spread'](function(_0x2b6997){for(var _0x361df3=0x0;_0x361df3<_0x3333e7[_0xc8b5('0x5a')]['ids']['length'];_0x361df3+=0x1){socket['emit'](_0xc8b5('0x79'),{'UserId':Number(_0x3333e7[_0xc8b5('0x5a')]['ids'][_0x361df3]),'SmsQueueId':Number(_0x3333e7[_0xc8b5('0x4e')]['id'])});}return _0x2b6997;});}})['then'](respondWithResult(_0x2d421b,null))[_0xc8b5('0x4c')](handleError(_0x2d421b,null));};exports[_0xc8b5('0x8b')]=function(_0x447d6d,_0x2e58c7,_0x2de95a){return db[_0xc8b5('0x37')][_0xc8b5('0x52')]({'where':{'id':_0x447d6d[_0xc8b5('0x4e')]['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x2e58c7,null))['then'](function(_0x487e6d){if(_0x487e6d){return _0x487e6d[_0xc8b5('0x8b')](_0x447d6d[_0xc8b5('0x3b')]['ids'])['then'](function(){if(_[_0xc8b5('0x8f')](_0x447d6d[_0xc8b5('0x3b')][_0xc8b5('0x6e')])){for(var _0x11bca6=0x0;_0x11bca6<_0x447d6d[_0xc8b5('0x3b')][_0xc8b5('0x6e')]['length'];_0x11bca6+=0x1){socket[_0xc8b5('0x78')]('userSmsQueue:remove',{'UserId':Number(_0x447d6d['query'][_0xc8b5('0x6e')][_0x11bca6]),'SmsQueueId':Number(_0x447d6d[_0xc8b5('0x4e')]['id'])});}}else{socket[_0xc8b5('0x78')]('userSmsQueue:remove',{'UserId':Number(_0x447d6d[_0xc8b5('0x3b')][_0xc8b5('0x6e')]),'SmsQueueId':Number(_0x447d6d['params']['id'])});}});}})[_0xc8b5('0x2b')](respondWithStatusCode(_0x2e58c7,null))[_0xc8b5('0x4c')](handleError(_0x2e58c7,null));};exports[_0xc8b5('0x90')]=function(_0x56ce11,_0x15f08b,_0x1bd825){var _0xc5f767={};var _0x24c22f={};var _0x4f8e63;var _0x17aaca;return db['SmsQueue'][_0xc8b5('0x6d')]({'where':{'id':_0x56ce11['params']['id']}})[_0xc8b5('0x2b')](handleEntityNotFound(_0x15f08b,null))[_0xc8b5('0x2b')](function(_0xa4bb43){if(_0xa4bb43){_0x4f8e63=_0xa4bb43;_0x24c22f['model']=_[_0xc8b5('0x4f')](db['User'][_0xc8b5('0x50')]);_0x24c22f[_0xc8b5('0x3b')]=_['keys'](_0x56ce11['query']);_0x24c22f['filters']=_[_0xc8b5('0x3d')](_0x24c22f[_0xc8b5('0x3a')],_0x24c22f[_0xc8b5('0x3b')]);_0xc5f767[_0xc8b5('0x3c')]=_[_0xc8b5('0x3d')](_0x24c22f['model'],qs[_0xc8b5('0x3e')](_0x56ce11[_0xc8b5('0x3b')][_0xc8b5('0x3e')]));_0xc5f767[_0xc8b5('0x3c')]=_0xc5f767[_0xc8b5('0x3c')]['length']?_0xc5f767[_0xc8b5('0x3c')]:_0x24c22f[_0xc8b5('0x3a')];_0xc5f767[_0xc8b5('0x60')]=qs[_0xc8b5('0x40')](_0x56ce11[_0xc8b5('0x3b')]['sort']);_0xc5f767[_0xc8b5('0x41')]=qs[_0xc8b5('0x42')](_['pick'](_0x56ce11[_0xc8b5('0x3b')],_0x24c22f[_0xc8b5('0x42')]));if(_0x56ce11[_0xc8b5('0x3b')][_0xc8b5('0x46')]){_0xc5f767['where']=_['merge'](_0xc5f767[_0xc8b5('0x41')],{'$or':_[_0xc8b5('0x36')](_0xc5f767[_0xc8b5('0x3c')],function(_0x18d95f){var _0x333acc={};_0x333acc[_0x18d95f]={'$like':'%'+_0x56ce11[_0xc8b5('0x3b')][_0xc8b5('0x46')]+'%'};return _0x333acc;})});}_0xc5f767=_[_0xc8b5('0x47')]({},_0xc5f767,_0x56ce11[_0xc8b5('0x51')]);return _0x4f8e63[_0xc8b5('0x90')](_0xc5f767);}})[_0xc8b5('0x2b')](function(_0x9ec10b){if(_0x9ec10b){_0x17aaca=_0x9ec10b[_0xc8b5('0x3f')];if(!_0x56ce11[_0xc8b5('0x3b')][_0xc8b5('0x5e')]('nolimit')){_0xc5f767[_0xc8b5('0x24')]=qs[_0xc8b5('0x24')](_0x56ce11[_0xc8b5('0x3b')][_0xc8b5('0x24')]);_0xc5f767[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x56ce11[_0xc8b5('0x3b')][_0xc8b5('0x22')]);}return _0x4f8e63[_0xc8b5('0x90')](_0xc5f767);}})[_0xc8b5('0x2b')](function(_0x13239a){if(_0x13239a){return _0x13239a?{'count':_0x17aaca,'rows':_0x13239a}:null;}})[_0xc8b5('0x2b')](respondWithResult(_0x15f08b,null))['catch'](handleError(_0x15f08b,null));}; \ No newline at end of file +var _0x1aa9=['path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','SmsQueues','UserProfileResource','error','stack','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','findAll','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','nolimit','SmsQueueId','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','join','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x1b50a8,_0x328cd1){var _0x534cd3=function(_0x45e24a){while(--_0x45e24a){_0x1b50a8['push'](_0x1b50a8['shift']());}};_0x534cd3(++_0x328cd1);}(_0x1aa9,0x1a3));var _0x91aa=function(_0x650795,_0x419aac){_0x650795=_0x650795-0x0;var _0x35117c=_0x1aa9[_0x650795];return _0x35117c;};'use strict';var emlformat=require(_0x91aa('0x0'));var rimraf=require(_0x91aa('0x1'));var zipdir=require(_0x91aa('0x2'));var jsonpatch=require(_0x91aa('0x3'));var rp=require(_0x91aa('0x4'));var moment=require('moment');var BPromise=require(_0x91aa('0x5'));var Mustache=require('mustache');var util=require(_0x91aa('0x6'));var path=require(_0x91aa('0x7'));var sox=require('sox');var csv=require(_0x91aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91aa('0x9'));var _=require(_0x91aa('0xa'));var squel=require('squel');var crypto=require(_0x91aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x91aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0x91aa('0xd'));var Papa=require(_0x91aa('0xe'));var Redis=require(_0x91aa('0xf'));var authService=require(_0x91aa('0x10'));var qs=require(_0x91aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x91aa('0x12'));var utils=require(_0x91aa('0x13'));var config=require(_0x91aa('0x14'));var licenseUtil=require(_0x91aa('0x15'));var db=require(_0x91aa('0x16'))['db'];config[_0x91aa('0x17')]=_[_0x91aa('0x18')](config[_0x91aa('0x17')],{'host':_0x91aa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91aa('0x17')]));require(_0x91aa('0x1a'))['register'](socket);function respondWithStatusCode(_0x28bdb3,_0x283cae){_0x283cae=_0x283cae||0xcc;return function(_0x279dd0){if(_0x279dd0){return _0x28bdb3[_0x91aa('0x1b')](_0x283cae);}return _0x28bdb3[_0x91aa('0x1c')](_0x283cae)[_0x91aa('0x1d')]();};}function respondWithResult(_0x47e98d,_0x4240f5){_0x4240f5=_0x4240f5||0xc8;return function(_0x1ad3df){if(_0x1ad3df){return _0x47e98d[_0x91aa('0x1c')](_0x4240f5)['json'](_0x1ad3df);}};}function respondWithFilteredResult(_0xff8aec,_0x1f3f35){return function(_0x44456f){if(_0x44456f){var _0x16fc7b=typeof _0x1f3f35[_0x91aa('0x1e')]===_0x91aa('0x1f')&&typeof _0x1f3f35[_0x91aa('0x20')]==='undefined';var _0x998aca=_0x44456f[_0x91aa('0x21')];var _0x2d79b7=_0x16fc7b?0x0:_0x1f3f35[_0x91aa('0x1e')];var _0x3c4796=_0x16fc7b?_0x44456f[_0x91aa('0x21')]:_0x1f3f35['offset']+_0x1f3f35[_0x91aa('0x20')];var _0x256442;if(_0x3c4796>=_0x998aca){_0x3c4796=_0x998aca;_0x256442=0xc8;}else{_0x256442=0xce;}_0xff8aec['status'](_0x256442);return _0xff8aec[_0x91aa('0x22')](_0x91aa('0x23'),_0x2d79b7+'-'+_0x3c4796+'/'+_0x998aca)[_0x91aa('0x24')](_0x44456f);}return null;};}function patchUpdates(_0x84aa73){return function(_0x167ef1){try{jsonpatch['apply'](_0x167ef1,_0x84aa73,!![]);}catch(_0xd5423f){return BPromise[_0x91aa('0x25')](_0xd5423f);}return _0x167ef1[_0x91aa('0x26')]();};}function saveUpdates(_0x492d99,_0x199a45){return function(_0x19cd9f){if(_0x19cd9f){return _0x19cd9f[_0x91aa('0x27')](_0x492d99)['then'](function(_0x594827){return _0x594827;});}return null;};}function removeEntity(_0x262e51,_0x4ab0c0){return function(_0x243901){if(_0x243901){return _0x243901[_0x91aa('0x28')]()[_0x91aa('0x29')](function(){var _0x33080f=_0x243901[_0x91aa('0x2a')]({'plain':!![]});var _0x328a09=_0x91aa('0x2b');return db[_0x91aa('0x2c')]['destroy']({'where':{'type':_0x328a09,'resourceId':_0x33080f['id']}})[_0x91aa('0x29')](function(){return _0x243901;});})['then'](function(){_0x262e51[_0x91aa('0x1c')](0xcc)[_0x91aa('0x1d')]();});}};}function handleEntityNotFound(_0x11f765,_0x531fd2){return function(_0x3febc3){if(!_0x3febc3){_0x11f765['sendStatus'](0x194);}return _0x3febc3;};}function handleError(_0x4d25c3,_0x286e6d){_0x286e6d=_0x286e6d||0x1f4;return function(_0x3117b5){logger[_0x91aa('0x2d')](_0x3117b5[_0x91aa('0x2e')]);if(_0x3117b5['name']){delete _0x3117b5['name'];}_0x4d25c3['status'](_0x286e6d)[_0x91aa('0x2f')](_0x3117b5);};}exports[_0x91aa('0x30')]=function(_0x318b57,_0x1690a3){var _0x2a22c8={},_0x579bee={},_0x414483={'count':0x0,'rows':[]};var _0x585492=_[_0x91aa('0x31')](db[_0x91aa('0x32')][_0x91aa('0x33')],function(_0x54b57e){return{'name':_0x54b57e[_0x91aa('0x34')],'type':_0x54b57e[_0x91aa('0x35')][_0x91aa('0x36')]};});_0x579bee[_0x91aa('0x37')]=_['map'](_0x585492,'name');_0x579bee[_0x91aa('0x38')]=_[_0x91aa('0x39')](_0x318b57[_0x91aa('0x38')]);_0x579bee[_0x91aa('0x3a')]=_['intersection'](_0x579bee[_0x91aa('0x37')],_0x579bee[_0x91aa('0x38')]);_0x2a22c8['attributes']=_[_0x91aa('0x3b')](_0x579bee[_0x91aa('0x37')],qs[_0x91aa('0x3c')](_0x318b57[_0x91aa('0x38')][_0x91aa('0x3c')]));_0x2a22c8[_0x91aa('0x3d')]=_0x2a22c8[_0x91aa('0x3d')][_0x91aa('0x3e')]?_0x2a22c8['attributes']:_0x579bee[_0x91aa('0x37')];if(!_0x318b57[_0x91aa('0x38')][_0x91aa('0x3f')]('nolimit')){_0x2a22c8[_0x91aa('0x20')]=qs[_0x91aa('0x20')](_0x318b57[_0x91aa('0x38')][_0x91aa('0x20')]);_0x2a22c8[_0x91aa('0x1e')]=qs['offset'](_0x318b57[_0x91aa('0x38')][_0x91aa('0x1e')]);}_0x2a22c8[_0x91aa('0x40')]=qs[_0x91aa('0x41')](_0x318b57[_0x91aa('0x38')][_0x91aa('0x41')]);_0x2a22c8[_0x91aa('0x42')]=qs[_0x91aa('0x3a')](_[_0x91aa('0x43')](_0x318b57[_0x91aa('0x38')],_0x579bee['filters']),_0x585492);if(_0x318b57[_0x91aa('0x38')][_0x91aa('0x44')]){_0x2a22c8[_0x91aa('0x42')]=_['merge'](_0x2a22c8[_0x91aa('0x42')],{'$or':_['map'](_0x585492,function(_0x1f9f49){if(_0x1f9f49[_0x91aa('0x35')]!==_0x91aa('0x45')){var _0x59a027={};_0x59a027[_0x1f9f49[_0x91aa('0x46')]]={'$like':'%'+_0x318b57[_0x91aa('0x38')]['filter']+'%'};return _0x59a027;}})});}_0x2a22c8=_[_0x91aa('0x47')]({},_0x2a22c8,_0x318b57[_0x91aa('0x48')]);var _0x7cf833={'where':_0x2a22c8[_0x91aa('0x42')]};return db['SmsQueue']['count'](_0x7cf833)['then'](function(_0x285498){_0x414483[_0x91aa('0x21')]=_0x285498;if(_0x318b57[_0x91aa('0x38')][_0x91aa('0x49')]){_0x2a22c8[_0x91aa('0x4a')]=[{'all':!![]}];}return db[_0x91aa('0x32')][_0x91aa('0x4b')](_0x2a22c8);})[_0x91aa('0x29')](function(_0x3f9386){_0x414483['rows']=_0x3f9386;return _0x414483;})[_0x91aa('0x29')](respondWithFilteredResult(_0x1690a3,_0x2a22c8))['catch'](handleError(_0x1690a3,null));};exports[_0x91aa('0x4c')]=function(_0x4a11e3,_0x5717a6){var _0x2a98a7={'raw':!![],'where':{'id':_0x4a11e3[_0x91aa('0x4d')]['id']}},_0x557481={};_0x557481[_0x91aa('0x37')]=_[_0x91aa('0x39')](db[_0x91aa('0x32')]['rawAttributes']);_0x557481[_0x91aa('0x38')]=_['keys'](_0x4a11e3[_0x91aa('0x38')]);_0x557481[_0x91aa('0x3a')]=_[_0x91aa('0x3b')](_0x557481[_0x91aa('0x37')],_0x557481[_0x91aa('0x38')]);_0x2a98a7[_0x91aa('0x3d')]=_[_0x91aa('0x3b')](_0x557481['model'],qs[_0x91aa('0x3c')](_0x4a11e3[_0x91aa('0x38')][_0x91aa('0x3c')]));_0x2a98a7[_0x91aa('0x3d')]=_0x2a98a7[_0x91aa('0x3d')][_0x91aa('0x3e')]?_0x2a98a7[_0x91aa('0x3d')]:_0x557481[_0x91aa('0x37')];if(_0x4a11e3['query']['includeAll']){_0x2a98a7[_0x91aa('0x4a')]=[{'all':!![]}];}_0x2a98a7=_[_0x91aa('0x47')]({},_0x2a98a7,_0x4a11e3['options']);return db[_0x91aa('0x32')][_0x91aa('0x4e')](_0x2a98a7)[_0x91aa('0x29')](handleEntityNotFound(_0x5717a6,null))[_0x91aa('0x29')](respondWithResult(_0x5717a6,null))['catch'](handleError(_0x5717a6,null));};exports[_0x91aa('0x4f')]=function(_0x4873a1,_0x38d33c){return db[_0x91aa('0x32')][_0x91aa('0x4f')](_0x4873a1[_0x91aa('0x50')],{})[_0x91aa('0x29')](function(_0x1bdfa1){var _0x2bf3b3=_0x4873a1['user'][_0x91aa('0x2a')]({'plain':!![]});if(!_0x2bf3b3)throw new Error(_0x91aa('0x51'));if(_0x2bf3b3[_0x91aa('0x52')]==='user'){var _0xfb81c=_0x1bdfa1[_0x91aa('0x2a')]({'plain':!![]});var _0x1d2c1b=_0x91aa('0x2b');return db[_0x91aa('0x53')]['find']({'where':{'name':_0x1d2c1b,'userProfileId':_0x2bf3b3[_0x91aa('0x54')]},'raw':!![]})[_0x91aa('0x29')](function(_0x10bd1e){if(_0x10bd1e&&_0x10bd1e[_0x91aa('0x55')]===0x0){return db[_0x91aa('0x2c')][_0x91aa('0x4f')]({'name':_0xfb81c[_0x91aa('0x46')],'resourceId':_0xfb81c['id'],'type':_0x10bd1e['name'],'sectionId':_0x10bd1e['id']},{})[_0x91aa('0x29')](function(){return _0x1bdfa1;});}else{return _0x1bdfa1;}})[_0x91aa('0x56')](function(_0x25ce4e){logger[_0x91aa('0x2d')](_0x91aa('0x57'),_0x25ce4e);throw _0x25ce4e;});}return _0x1bdfa1;})[_0x91aa('0x29')](respondWithResult(_0x38d33c,0xc9))[_0x91aa('0x56')](handleError(_0x38d33c,null));};exports[_0x91aa('0x27')]=function(_0xa87f9f,_0x271151){if(_0xa87f9f[_0x91aa('0x50')]['id']){delete _0xa87f9f['body']['id'];}return db['SmsQueue'][_0x91aa('0x4e')]({'where':{'id':_0xa87f9f[_0x91aa('0x4d')]['id']}})[_0x91aa('0x29')](handleEntityNotFound(_0x271151,null))[_0x91aa('0x29')](saveUpdates(_0xa87f9f[_0x91aa('0x50')],null))[_0x91aa('0x29')](respondWithResult(_0x271151,null))[_0x91aa('0x56')](handleError(_0x271151,null));};exports['destroy']=function(_0x12a48b,_0x12b772){return db[_0x91aa('0x32')][_0x91aa('0x4e')]({'where':{'id':_0x12a48b['params']['id']}})['then'](handleEntityNotFound(_0x12b772,null))['then'](removeEntity(_0x12b772,null))['catch'](handleError(_0x12b772,null));};exports['describe']=function(_0x2e53d2,_0x39f116){return db[_0x91aa('0x32')][_0x91aa('0x58')]()[_0x91aa('0x29')](respondWithResult(_0x39f116,null))[_0x91aa('0x56')](handleError(_0x39f116,null));};exports[_0x91aa('0x59')]=function(_0x3b98d2,_0x59bca0,_0x3ad15e){var _0x5d25cb={'raw':!![],'where':{}},_0x3a9f5e={},_0x3481ef;return db[_0x91aa('0x32')]['findOne']({'where':{'id':_0x3b98d2[_0x91aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x59bca0,null))[_0x91aa('0x29')](function(_0x8daf89){if(_0x8daf89){_0x3481ef=_0x8daf89[_0x91aa('0x2a')]({'plain':!![]});_0x3a9f5e[_0x91aa('0x37')]=_[_0x91aa('0x39')](db[_0x91aa('0x5a')][_0x91aa('0x33')]);_0x3a9f5e[_0x91aa('0x38')]=_[_0x91aa('0x39')](_0x3b98d2[_0x91aa('0x38')]);_0x3a9f5e[_0x91aa('0x3a')]=_[_0x91aa('0x3b')](_0x3a9f5e['model'],_0x3a9f5e[_0x91aa('0x38')]);_0x5d25cb[_0x91aa('0x3d')]=_['intersection'](_0x3a9f5e[_0x91aa('0x37')],qs[_0x91aa('0x3c')](_0x3b98d2[_0x91aa('0x38')][_0x91aa('0x3c')]));_0x5d25cb[_0x91aa('0x3d')]=_0x5d25cb[_0x91aa('0x3d')][_0x91aa('0x3e')]?_0x5d25cb['attributes']:_0x3a9f5e[_0x91aa('0x37')];if(!_0x3b98d2[_0x91aa('0x38')][_0x91aa('0x3f')](_0x91aa('0x5b'))){_0x5d25cb['limit']=qs[_0x91aa('0x20')](_0x3b98d2['query'][_0x91aa('0x20')]);_0x5d25cb['offset']=qs[_0x91aa('0x1e')](_0x3b98d2[_0x91aa('0x38')]['offset']);}_0x5d25cb[_0x91aa('0x40')]=qs[_0x91aa('0x41')](_0x3b98d2[_0x91aa('0x38')][_0x91aa('0x41')]);_0x5d25cb[_0x91aa('0x42')]=qs[_0x91aa('0x3a')](_[_0x91aa('0x43')](_0x3b98d2[_0x91aa('0x38')],_0x3a9f5e[_0x91aa('0x3a')]));_0x5d25cb['where'][_0x91aa('0x5c')]=_0x8daf89['id'];if(_0x3b98d2[_0x91aa('0x38')][_0x91aa('0x44')]){_0x5d25cb['where']=_[_0x91aa('0x47')](_0x5d25cb[_0x91aa('0x42')],{'$or':_[_0x91aa('0x31')](_0x5d25cb[_0x91aa('0x3d')],function(_0x2924ce){var _0x27a197={};_0x27a197[_0x2924ce]={'$like':'%'+_0x3b98d2[_0x91aa('0x38')][_0x91aa('0x44')]+'%'};return _0x27a197;})});}_0x5d25cb=_[_0x91aa('0x47')]({},_0x5d25cb,_0x3b98d2[_0x91aa('0x48')]);return db[_0x91aa('0x5a')]['findAll'](_0x5d25cb);}})[_0x91aa('0x29')](function(_0x4ced9d){if(_0x4ced9d){return db[_0x91aa('0x5d')][_0x91aa('0x5e')]({'where':{'id':_[_0x91aa('0x31')](_0x4ced9d,'UserId'),'role':_0x91aa('0x5f')},'attributes':['id','name',_0x91aa('0x60'),_0x91aa('0x61'),_0x91aa('0x62')]});}})[_0x91aa('0x29')](function(_0xc84a5){if(_0xc84a5){return{'count':_0xc84a5['count'],'rows':_[_0x91aa('0x31')](_0xc84a5['rows'],function(_0x2288e5){return{'membername':_0x2288e5[_0x91aa('0x46')],'UserId':_0x2288e5['id'],'queue_name':_0x3481ef[_0x91aa('0x46')],'SmsQueueId':_0x3481ef['id'],'interface':util['format'](_0x91aa('0x63'),_0x91aa('0x64'),_0x2288e5['name']),'penalty':0x0,'paused':_0x2288e5[_0x91aa('0x60')],'createdAt':_0x2288e5['createdAt'],'updatedAt':_0x2288e5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x91aa('0x29')](respondWithFilteredResult(_0x59bca0,_0x5d25cb))[_0x91aa('0x56')](handleError(_0x59bca0,null));};exports['getTeams']=function(_0xe8064a,_0xe7fab2,_0x3cf006){var _0x4a8610={};var _0x677051={};var _0x30b46f;var _0x151fdd;return db[_0x91aa('0x32')][_0x91aa('0x65')]({'where':{'id':_0xe8064a[_0x91aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe7fab2,null))['then'](function(_0x559a9f){if(_0x559a9f){_0x30b46f=_0x559a9f;_0x677051[_0x91aa('0x37')]=_['keys'](db['Team']['rawAttributes']);_0x677051['query']=_[_0x91aa('0x39')](_0xe8064a[_0x91aa('0x38')]);_0x677051['filters']=_[_0x91aa('0x3b')](_0x677051[_0x91aa('0x37')],_0x677051[_0x91aa('0x38')]);_0x4a8610[_0x91aa('0x3d')]=_['intersection'](_0x677051[_0x91aa('0x37')],qs['fields'](_0xe8064a[_0x91aa('0x38')][_0x91aa('0x3c')]));_0x4a8610[_0x91aa('0x3d')]=_0x4a8610[_0x91aa('0x3d')][_0x91aa('0x3e')]?_0x4a8610[_0x91aa('0x3d')]:_0x677051['model'];_0x4a8610['order']=qs['sort'](_0xe8064a[_0x91aa('0x38')][_0x91aa('0x41')]);_0x4a8610[_0x91aa('0x42')]=qs[_0x91aa('0x3a')](_[_0x91aa('0x43')](_0xe8064a[_0x91aa('0x38')],_0x677051[_0x91aa('0x3a')]));if(_0xe8064a['query'][_0x91aa('0x44')]){_0x4a8610[_0x91aa('0x42')]=_[_0x91aa('0x47')](_0x4a8610[_0x91aa('0x42')],{'$or':_['map'](_0x4a8610['attributes'],function(_0x533cc7){var _0x5adb63={};_0x5adb63[_0x533cc7]={'$like':'%'+_0xe8064a[_0x91aa('0x38')][_0x91aa('0x44')]+'%'};return _0x5adb63;})});}_0x4a8610=_['merge']({},_0x4a8610,_0xe8064a[_0x91aa('0x48')]);return _0x30b46f[_0x91aa('0x66')](_0x4a8610);}})[_0x91aa('0x29')](function(_0x3ae18b){if(_0x3ae18b){_0x151fdd=_0x3ae18b[_0x91aa('0x3e')];if(!_0xe8064a['query'][_0x91aa('0x3f')](_0x91aa('0x5b'))){_0x4a8610[_0x91aa('0x20')]=qs[_0x91aa('0x20')](_0xe8064a['query'][_0x91aa('0x20')]);_0x4a8610[_0x91aa('0x1e')]=qs[_0x91aa('0x1e')](_0xe8064a[_0x91aa('0x38')][_0x91aa('0x1e')]);}return _0x30b46f[_0x91aa('0x66')](_0x4a8610);}})[_0x91aa('0x29')](function(_0x4b357d){if(_0x4b357d){return _0x4b357d?{'count':_0x151fdd,'rows':_0x4b357d}:null;}})['then'](respondWithResult(_0xe7fab2,null))[_0x91aa('0x56')](handleError(_0xe7fab2,null));};exports[_0x91aa('0x67')]=function(_0x1134f6,_0x7ee5d4,_0x4d5fa6){var _0x12f40f=_0x1134f6[_0x91aa('0x50')][_0x91aa('0x68')];return db[_0x91aa('0x69')]['findAll']({'where':{'id':_0x12f40f},'attributes':['id'],'include':[{'model':db[_0x91aa('0x5d')],'as':'Agents','attributes':['id',_0x91aa('0x46'),_0x91aa('0x6a'),_0x91aa('0x6b'),_0x91aa('0x6c')],'raw':!![]}]})[_0x91aa('0x29')](function(_0x476df5){if(_0x476df5){var _0x5eb648=_[_0x91aa('0x6d')](_0x476df5,function(_0x1ecfbd){var _0x5c3c45=_0x1ecfbd['get']({'plain':!![]});return _0x5c3c45[_0x91aa('0x6e')];});return db[_0x91aa('0x32')]['find']({'where':{'id':_0x1134f6['params']['id']}})[_0x91aa('0x29')](function(_0x794519){return db['sequelize'][_0x91aa('0x6f')](function(_0x3158eb){return _0x794519['addTeams'](_0x12f40f,{'transaction':_0x3158eb})[_0x91aa('0x29')](function(){return BPromise[_0x91aa('0x70')](_0x5eb648,function(_0x1356c8){return db[_0x91aa('0x5a')][_0x91aa('0x71')]({'where':{'UserId':_0x1356c8['id'],'SmsQueueId':_0x1134f6['params']['id']},'transaction':_0x3158eb});});})['then'](function(){_0x5eb648[_0x91aa('0x72')](function(_0x33beb3){socket[_0x91aa('0x73')](_0x91aa('0x74'),{'UserId':_0x33beb3['id'],'SmsQueueId':_0x794519['id']});});});});});}})[_0x91aa('0x29')](respondWithStatusCode(_0x7ee5d4,null))[_0x91aa('0x56')](handleError(_0x7ee5d4,null));};exports[_0x91aa('0x75')]=function(_0x331cda,_0x116f59,_0x545c9c){return db[_0x91aa('0x69')][_0x91aa('0x4b')]({'where':{'id':_0x331cda[_0x91aa('0x38')][_0x91aa('0x68')]},'attributes':['id'],'include':[{'model':db[_0x91aa('0x5d')],'as':_0x91aa('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x91aa('0x29')](handleEntityNotFound(_0x116f59,null))[_0x91aa('0x29')](function(_0x1c18f7){var _0x39ed09=_['map'](_0x1c18f7,'id');var _0x25b657=[];var _0x349a1a=[];var _0x4e67cd=squel[_0x91aa('0x76')]();_0x4e67cd['field'](_0x91aa('0x77'))[_0x91aa('0x78')]('team_has_sms_queues','tq')[_0x91aa('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91aa('0x42')]('SmsQueueId\x20=\x20?',_0x331cda[_0x91aa('0x4d')]['id']);for(var _0x151a3b=0x0;_0x151a3b<_0x1c18f7[_0x91aa('0x3e')];_0x151a3b+=0x1){let _0x1d0735=_0x1c18f7[_0x151a3b];for(var _0x4f665e=0x0;_0x4f665e<_0x1d0735[_0x91aa('0x6e')][_0x91aa('0x3e')];_0x4f665e+=0x1){let _0x20f487=_0x1d0735[_0x91aa('0x6e')][_0x4f665e];var _0x17a277=_0x4e67cd['clone']();_0x17a277[_0x91aa('0x42')](_0x91aa('0x7a'),_0x20f487['id']);_0x349a1a[_0x91aa('0x7b')](db['sequelize'][_0x91aa('0x38')](_0x17a277[_0x91aa('0x7c')](),{'type':db[_0x91aa('0x7d')][_0x91aa('0x7e')][_0x91aa('0x7f')]})[_0x91aa('0x29')](function(_0x1f8b75){if(_0x1f8b75[_0x91aa('0x3e')]===0x1){return _0x20f487['id'];}else{var _0x3b39b1=_[_0x91aa('0x80')](_['map'](_0x1f8b75,_0x91aa('0x81')),function(_0xacb42c){return _[_0x91aa('0x82')](_0x39ed09,_0xacb42c);});if(_0x3b39b1){return _0x20f487['id'];}}}));}}return BPromise[_0x91aa('0x83')](_0x349a1a)[_0x91aa('0x29')](function(_0x534000){_0x25b657=_(_0x25b657)[_0x91aa('0x84')](_0x534000)[_0x91aa('0x85')]()[_0x91aa('0x86')]();return db[_0x91aa('0x32')][_0x91aa('0x4e')]({'where':{'id':_0x331cda[_0x91aa('0x4d')]['id']}})['then'](function(_0x4b912b){return db[_0x91aa('0x7d')][_0x91aa('0x6f')](function(_0x258893){return _0x4b912b[_0x91aa('0x75')](_0x331cda[_0x91aa('0x38')][_0x91aa('0x68')],{'transaction':_0x258893})['then'](function(){if(!_['isEmpty'](_0x25b657)){return _0x4b912b[_0x91aa('0x87')](_0x25b657,{'transaction':_0x258893});}})[_0x91aa('0x29')](function(){_0x25b657[_0x91aa('0x72')](function(_0x1e6d74){socket[_0x91aa('0x73')](_0x91aa('0x88'),{'UserId':_0x1e6d74,'SmsQueueId':_0x4b912b['id']});});});});});});})[_0x91aa('0x29')](respondWithStatusCode(_0x116f59,null))['catch'](handleError(_0x116f59,null));};exports[_0x91aa('0x89')]=function(_0x3439b8,_0x2d7e42,_0x59a664){return db[_0x91aa('0x32')][_0x91aa('0x4e')]({'where':{'id':_0x3439b8[_0x91aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d7e42,null))[_0x91aa('0x29')](function(_0x834d12){if(_0x834d12){return _0x834d12[_0x91aa('0x89')](_0x3439b8[_0x91aa('0x50')]['ids'],_[_0x91aa('0x8a')](_0x3439b8[_0x91aa('0x50')],[_0x91aa('0x68'),'id'])||{})[_0x91aa('0x8b')](function(_0x3012a2){for(var _0x48ecff=0x0;_0x48ecff<_0x3439b8[_0x91aa('0x50')][_0x91aa('0x68')][_0x91aa('0x3e')];_0x48ecff+=0x1){socket['emit'](_0x91aa('0x74'),{'UserId':Number(_0x3439b8['body'][_0x91aa('0x68')][_0x48ecff]),'SmsQueueId':Number(_0x3439b8['params']['id'])});}return _0x3012a2;});}})['then'](respondWithResult(_0x2d7e42,null))[_0x91aa('0x56')](handleError(_0x2d7e42,null));};exports[_0x91aa('0x87')]=function(_0x48ba4d,_0x5d55b4,_0x3faf49){return db[_0x91aa('0x32')]['find']({'where':{'id':_0x48ba4d[_0x91aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d55b4,null))[_0x91aa('0x29')](function(_0x8a8528){if(_0x8a8528){return _0x8a8528[_0x91aa('0x87')](_0x48ba4d[_0x91aa('0x38')][_0x91aa('0x68')])[_0x91aa('0x29')](function(){if(_[_0x91aa('0x8c')](_0x48ba4d[_0x91aa('0x38')]['ids'])){for(var _0x3c295f=0x0;_0x3c295f<_0x48ba4d[_0x91aa('0x38')]['ids'][_0x91aa('0x3e')];_0x3c295f+=0x1){socket[_0x91aa('0x73')](_0x91aa('0x88'),{'UserId':Number(_0x48ba4d[_0x91aa('0x38')][_0x91aa('0x68')][_0x3c295f]),'SmsQueueId':Number(_0x48ba4d['params']['id'])});}}else{socket['emit'](_0x91aa('0x88'),{'UserId':Number(_0x48ba4d[_0x91aa('0x38')][_0x91aa('0x68')]),'SmsQueueId':Number(_0x48ba4d[_0x91aa('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d55b4,null))['catch'](handleError(_0x5d55b4,null));};exports[_0x91aa('0x8d')]=function(_0x10b971,_0x231fca,_0x1cc1e4){var _0x3eec89={};var _0x528ecb={};var _0x1a05f2;var _0x538d6f;return db[_0x91aa('0x32')]['findOne']({'where':{'id':_0x10b971[_0x91aa('0x4d')]['id']}})[_0x91aa('0x29')](handleEntityNotFound(_0x231fca,null))[_0x91aa('0x29')](function(_0x103740){if(_0x103740){_0x1a05f2=_0x103740;_0x528ecb[_0x91aa('0x37')]=_[_0x91aa('0x39')](db[_0x91aa('0x5d')][_0x91aa('0x33')]);_0x528ecb[_0x91aa('0x38')]=_[_0x91aa('0x39')](_0x10b971[_0x91aa('0x38')]);_0x528ecb[_0x91aa('0x3a')]=_[_0x91aa('0x3b')](_0x528ecb[_0x91aa('0x37')],_0x528ecb[_0x91aa('0x38')]);_0x3eec89[_0x91aa('0x3d')]=_[_0x91aa('0x3b')](_0x528ecb['model'],qs[_0x91aa('0x3c')](_0x10b971[_0x91aa('0x38')][_0x91aa('0x3c')]));_0x3eec89[_0x91aa('0x3d')]=_0x3eec89[_0x91aa('0x3d')][_0x91aa('0x3e')]?_0x3eec89[_0x91aa('0x3d')]:_0x528ecb[_0x91aa('0x37')];_0x3eec89['order']=qs['sort'](_0x10b971['query'][_0x91aa('0x41')]);_0x3eec89[_0x91aa('0x42')]=qs[_0x91aa('0x3a')](_[_0x91aa('0x43')](_0x10b971[_0x91aa('0x38')],_0x528ecb[_0x91aa('0x3a')]));if(_0x10b971['query'][_0x91aa('0x44')]){_0x3eec89['where']=_['merge'](_0x3eec89['where'],{'$or':_[_0x91aa('0x31')](_0x3eec89[_0x91aa('0x3d')],function(_0x44ab8a){var _0x1e23e1={};_0x1e23e1[_0x44ab8a]={'$like':'%'+_0x10b971[_0x91aa('0x38')][_0x91aa('0x44')]+'%'};return _0x1e23e1;})});}_0x3eec89=_[_0x91aa('0x47')]({},_0x3eec89,_0x10b971['options']);return _0x1a05f2[_0x91aa('0x8d')](_0x3eec89);}})[_0x91aa('0x29')](function(_0x2dd408){if(_0x2dd408){_0x538d6f=_0x2dd408[_0x91aa('0x3e')];if(!_0x10b971['query'][_0x91aa('0x3f')](_0x91aa('0x5b'))){_0x3eec89['limit']=qs[_0x91aa('0x20')](_0x10b971[_0x91aa('0x38')]['limit']);_0x3eec89[_0x91aa('0x1e')]=qs[_0x91aa('0x1e')](_0x10b971[_0x91aa('0x38')]['offset']);}return _0x1a05f2['getAgents'](_0x3eec89);}})[_0x91aa('0x29')](function(_0x109c81){if(_0x109c81){return _0x109c81?{'count':_0x538d6f,'rows':_0x109c81}:null;}})[_0x91aa('0x29')](respondWithResult(_0x231fca,null))[_0x91aa('0x56')](handleError(_0x231fca,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8565669..0904b83 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 _0x4d04=['hook','events','SmsQueue','setMaxListeners','save','emit'];(function(_0x156ab2,_0x70a54e){var _0xc8631e=function(_0x1d91f4){while(--_0x1d91f4){_0x156ab2['push'](_0x156ab2['shift']());}};_0xc8631e(++_0x70a54e);}(_0x4d04,0x8b));var _0x44d0=function(_0x3166fc,_0x2199af){_0x3166fc=_0x3166fc-0x0;var _0x32315f=_0x4d04[_0x3166fc];return _0x32315f;};'use strict';var EventEmitter=require(_0x44d0('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x44d0('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x44d0('0x2')](0x0);var events={'afterCreate':_0x44d0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x57e9ff){return function(_0x295fc0,_0x11cdc4,_0x52f2cc){SmsQueueEvents[_0x44d0('0x4')](_0x57e9ff+':'+_0x295fc0['id'],_0x295fc0);SmsQueueEvents[_0x44d0('0x4')](_0x57e9ff,_0x295fc0);_0x52f2cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x44d0('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xaed6=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0xaed6,0xa4));var _0x6aed=function(_0x4496df,_0x1ae2f4){_0x4496df=_0x4496df-0x0;var _0x5123c2=_0xaed6[_0x4496df];return _0x5123c2;};'use strict';var EventEmitter=require(_0x6aed('0x0'));var SmsQueue=require(_0x6aed('0x1'))['db'][_0x6aed('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6aed('0x3')](0x0);var events={'afterCreate':_0x6aed('0x4'),'afterUpdate':_0x6aed('0x5'),'afterDestroy':_0x6aed('0x6')};function emitEvent(_0x43ed89){return function(_0x5465a5,_0x20d2e4,_0x32454d){SmsQueueEvents[_0x6aed('0x7')](_0x43ed89+':'+_0x5465a5['id'],_0x5465a5);SmsQueueEvents['emit'](_0x43ed89,_0x5465a5);_0x32454d(null);};}for(var e in events){if(events[_0x6aed('0x8')](e)){var event=events[e];SmsQueue[_0x6aed('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 07663a3..aca5602 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 _0x7e49=['sms_queues','lodash','util','api','moment','bluebird','../../config/environment','./smsQueue.attributes','define'];(function(_0x41c823,_0x2a9556){var _0x3509f6=function(_0x8f4d3c){while(--_0x8f4d3c){_0x41c823['push'](_0x41c823['shift']());}};_0x3509f6(++_0x2a9556);}(_0x7e49,0xd9));var _0x97e4=function(_0x1934e2,_0x3e4dee){_0x1934e2=_0x1934e2-0x0;var _0x1bc0fc=_0x7e49[_0x1934e2];return _0x1bc0fc;};'use strict';var _=require(_0x97e4('0x0'));var util=require(_0x97e4('0x1'));var logger=require('../../config/logger')(_0x97e4('0x2'));var moment=require(_0x97e4('0x3'));var BPromise=require(_0x97e4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x97e4('0x5'));var attributes=require(_0x97e4('0x6'));module['exports']=function(_0x2e0101,_0x35796b){return _0x2e0101[_0x97e4('0x7')]('SmsQueue',attributes,{'tableName':_0x97e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c75=['sms_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue'];(function(_0x187c53,_0xbac841){var _0x2dd5f1=function(_0x23ffe3){while(--_0x23ffe3){_0x187c53['push'](_0x187c53['shift']());}};_0x2dd5f1(++_0xbac841);}(_0x4c75,0x181));var _0x54c7=function(_0x50667a,_0x86eb28){_0x50667a=_0x50667a-0x0;var _0x4987e5=_0x4c75[_0x50667a];return _0x4987e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54c7('0x0'))(_0x54c7('0x1'));var moment=require(_0x54c7('0x2'));var BPromise=require(_0x54c7('0x3'));var rp=require(_0x54c7('0x4'));var fs=require('fs');var path=require(_0x54c7('0x5'));var rimraf=require(_0x54c7('0x6'));var config=require(_0x54c7('0x7'));var attributes=require(_0x54c7('0x8'));module[_0x54c7('0x9')]=function(_0x38df98,_0x3abf16){return _0x38df98['define'](_0x54c7('0xa'),attributes,{'tableName':_0x54c7('0xb'),'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 5e1229d..abf338a 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 _0x43b6=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','catch','find','then','ShowSmsQueue','lodash','randomstring','ioredis'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x43b6,0x115));var _0x643b=function(_0x6f8972,_0x343da7){_0x6f8972=_0x6f8972-0x0;var _0x5677d9=_0x43b6[_0x6f8972];return _0x5677d9;};'use strict';var _=require(_0x643b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x643b('0x1'));var fs=require('fs');var Redis=require(_0x643b('0x2'));var db=require(_0x643b('0x3'))['db'];var utils=require(_0x643b('0x4'));var logger=require('../../config/logger')(_0x643b('0x5'));var config=require('../../config/environment');var jayson=require(_0x643b('0x6'));var client=jayson[_0x643b('0x7')]['http']({'port':0x232a});config[_0x643b('0x8')]=_[_0x643b('0x9')](config[_0x643b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x643b('0xa'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x643b('0xb')](socket);function respondWithRpcPromise(_0x10ca28,_0x484af5,_0x48b6a4){return new BPromise(function(_0x1a934f,_0x46eff9){return client[_0x643b('0xc')](_0x10ca28,_0x48b6a4)['then'](function(_0x34a7e7){logger[_0x643b('0xd')](_0x643b('0xe'),_0x484af5,_0x643b('0xf'));logger[_0x643b('0x10')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x484af5,'request\x20sent',JSON[_0x643b('0x11')](_0x34a7e7));if(_0x34a7e7[_0x643b('0x12')]){if(_0x34a7e7[_0x643b('0x12')][_0x643b('0x13')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x484af5,_0x34a7e7[_0x643b('0x12')][_0x643b('0x14')]);return _0x46eff9(_0x34a7e7[_0x643b('0x12')][_0x643b('0x14')]);}logger[_0x643b('0x12')](_0x643b('0xe'),_0x484af5,_0x34a7e7[_0x643b('0x12')][_0x643b('0x14')]);return _0x1a934f(_0x34a7e7[_0x643b('0x12')][_0x643b('0x14')]);}else{logger['info'](_0x643b('0xe'),_0x484af5,'request\x20sent');_0x1a934f(_0x34a7e7['result'][_0x643b('0x14')]);}})['catch'](function(_0x3d82c0){logger['error'](_0x643b('0xe'),_0x484af5,_0x3d82c0);_0x46eff9(_0x3d82c0);});});}exports[_0x643b('0x15')]=function(_0x406645){var _0x4ae245=this;return new Promise(function(_0x5d8ae8,_0x2cb259){return db[_0x643b('0x16')]['findAll']({'raw':_0x406645[_0x643b('0x17')]?_0x406645['options'][_0x643b('0x18')]===undefined?!![]:![]:!![],'where':_0x406645['options']?_0x406645['options'][_0x643b('0x19')]||null:null,'attributes':_0x406645['options']?_0x406645['options'][_0x643b('0x1a')]||null:null,'limit':_0x406645[_0x643b('0x17')]?_0x406645[_0x643b('0x17')][_0x643b('0x1b')]||null:null,'include':_0x406645[_0x643b('0x17')]?_0x406645[_0x643b('0x17')][_0x643b('0x1c')]?_[_0x643b('0x1d')](_0x406645[_0x643b('0x17')]['include'],function(_0x1ae5f2){return{'model':db[_0x1ae5f2[_0x643b('0x1e')]],'as':_0x1ae5f2['as'],'attributes':_0x1ae5f2[_0x643b('0x1a')],'include':_0x1ae5f2[_0x643b('0x1c')]?_[_0x643b('0x1d')](_0x1ae5f2[_0x643b('0x1c')],function(_0x350b6e){return{'model':db[_0x350b6e[_0x643b('0x1e')]],'as':_0x350b6e['as'],'attributes':_0x350b6e[_0x643b('0x1a')],'include':_0x350b6e[_0x643b('0x1c')]?_[_0x643b('0x1d')](_0x350b6e[_0x643b('0x1c')],function(_0x22d8e3){return{'model':db[_0x22d8e3[_0x643b('0x1e')]],'as':_0x22d8e3['as'],'attributes':_0x22d8e3[_0x643b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c060a){logger['info'](_0x643b('0x15'),_0x406645);logger['debug'](_0x643b('0x15'),_0x406645,JSON[_0x643b('0x11')](_0x2c060a));_0x5d8ae8(_0x2c060a);})[_0x643b('0x1f')](function(_0x2d50f7){logger[_0x643b('0x12')]('GetSmsQueue',_0x2d50f7[_0x643b('0x14')],_0x406645);_0x2cb259(_0x4ae245[_0x643b('0x12')](0x1f4,_0x2d50f7[_0x643b('0x14')]));});});};exports['ShowSmsQueue']=function(_0x28de18){var _0x33bd95=this;return new Promise(function(_0x5ac4da,_0x5291fe){return db['SmsQueue'][_0x643b('0x20')]({'raw':_0x28de18[_0x643b('0x17')]?_0x28de18[_0x643b('0x17')][_0x643b('0x18')]===undefined?!![]:![]:!![],'where':_0x28de18[_0x643b('0x17')]?_0x28de18['options'][_0x643b('0x19')]||null:null,'attributes':_0x28de18[_0x643b('0x17')]?_0x28de18[_0x643b('0x17')][_0x643b('0x1a')]||null:null,'include':_0x28de18['options']?_0x28de18[_0x643b('0x17')][_0x643b('0x1c')]?_[_0x643b('0x1d')](_0x28de18[_0x643b('0x17')][_0x643b('0x1c')],function(_0x310b39){return{'model':db[_0x310b39['model']],'as':_0x310b39['as'],'attributes':_0x310b39['attributes'],'include':_0x310b39['include']?_[_0x643b('0x1d')](_0x310b39[_0x643b('0x1c')],function(_0x31b5ef){return{'model':db[_0x31b5ef[_0x643b('0x1e')]],'as':_0x31b5ef['as'],'attributes':_0x31b5ef[_0x643b('0x1a')],'include':_0x31b5ef[_0x643b('0x1c')]?_['map'](_0x31b5ef['include'],function(_0x3e6447){return{'model':db[_0x3e6447[_0x643b('0x1e')]],'as':_0x3e6447['as'],'attributes':_0x3e6447[_0x643b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x643b('0x21')](function(_0x1766b5){logger[_0x643b('0xd')](_0x643b('0x22'),_0x28de18);logger['debug']('ShowSmsQueue',_0x28de18,JSON[_0x643b('0x11')](_0x1766b5));_0x5ac4da(_0x1766b5);})[_0x643b('0x1f')](function(_0x427a08){logger[_0x643b('0x12')](_0x643b('0x22'),_0x427a08['message'],_0x28de18);_0x5291fe(_0x33bd95['error'](0x1f4,_0x427a08['message']));});});}; \ No newline at end of file +var _0x9c68=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','where','limit','include','model','attributes','map','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x9c68,0x76));var _0x89c6=function(_0x16659e,_0x65638d){_0x16659e=_0x16659e-0x0;var _0x331ebb=_0x9c68[_0x16659e];return _0x331ebb;};'use strict';var _=require(_0x89c6('0x0'));var util=require(_0x89c6('0x1'));var moment=require(_0x89c6('0x2'));var BPromise=require(_0x89c6('0x3'));var rs=require(_0x89c6('0x4'));var fs=require('fs');var Redis=require(_0x89c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x89c6('0x6'));var logger=require(_0x89c6('0x7'))('rpc');var config=require(_0x89c6('0x8'));var jayson=require(_0x89c6('0x9'));var client=jayson[_0x89c6('0xa')]['http']({'port':0x232a});config['redis']=_[_0x89c6('0xb')](config[_0x89c6('0xc')],{'host':_0x89c6('0xd'),'port':0x18eb});var socket=require(_0x89c6('0xe'))(new Redis(config[_0x89c6('0xc')]));require(_0x89c6('0xf'))[_0x89c6('0x10')](socket);function respondWithRpcPromise(_0x258e18,_0x5d7bff,_0x105ee2){return new BPromise(function(_0x49d51c,_0x2bdbe6){return client['request'](_0x258e18,_0x105ee2)[_0x89c6('0x11')](function(_0x265892){logger[_0x89c6('0x12')](_0x89c6('0x13'),_0x5d7bff,_0x89c6('0x14'));logger[_0x89c6('0x15')](_0x89c6('0x16'),_0x5d7bff,_0x89c6('0x14'),JSON[_0x89c6('0x17')](_0x265892));if(_0x265892[_0x89c6('0x18')]){if(_0x265892[_0x89c6('0x18')][_0x89c6('0x19')]===0x1f4){logger['error'](_0x89c6('0x13'),_0x5d7bff,_0x265892[_0x89c6('0x18')][_0x89c6('0x1a')]);return _0x2bdbe6(_0x265892[_0x89c6('0x18')][_0x89c6('0x1a')]);}logger[_0x89c6('0x18')](_0x89c6('0x13'),_0x5d7bff,_0x265892['error'][_0x89c6('0x1a')]);return _0x49d51c(_0x265892[_0x89c6('0x18')][_0x89c6('0x1a')]);}else{logger[_0x89c6('0x12')](_0x89c6('0x13'),_0x5d7bff,_0x89c6('0x14'));_0x49d51c(_0x265892[_0x89c6('0x1b')]['message']);}})[_0x89c6('0x1c')](function(_0x2c5f74){logger[_0x89c6('0x18')](_0x89c6('0x13'),_0x5d7bff,_0x2c5f74);_0x2bdbe6(_0x2c5f74);});});}exports[_0x89c6('0x1d')]=function(_0x639eb2){var _0xf0d6f2=this;return new Promise(function(_0x39f927,_0x4ffeb9){return db[_0x89c6('0x1e')]['findAll']({'raw':_0x639eb2[_0x89c6('0x1f')]?_0x639eb2[_0x89c6('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x639eb2['options']?_0x639eb2[_0x89c6('0x1f')][_0x89c6('0x20')]||null:null,'attributes':_0x639eb2[_0x89c6('0x1f')]?_0x639eb2['options']['attributes']||null:null,'limit':_0x639eb2['options']?_0x639eb2[_0x89c6('0x1f')][_0x89c6('0x21')]||null:null,'include':_0x639eb2['options']?_0x639eb2['options'][_0x89c6('0x22')]?_['map'](_0x639eb2[_0x89c6('0x1f')]['include'],function(_0x41190c){return{'model':db[_0x41190c[_0x89c6('0x23')]],'as':_0x41190c['as'],'attributes':_0x41190c[_0x89c6('0x24')],'include':_0x41190c[_0x89c6('0x22')]?_[_0x89c6('0x25')](_0x41190c['include'],function(_0x39567c){return{'model':db[_0x39567c[_0x89c6('0x23')]],'as':_0x39567c['as'],'attributes':_0x39567c[_0x89c6('0x24')],'include':_0x39567c['include']?_['map'](_0x39567c[_0x89c6('0x22')],function(_0x399062){return{'model':db[_0x399062[_0x89c6('0x23')]],'as':_0x399062['as'],'attributes':_0x399062[_0x89c6('0x24')]};}):[]};}):[]};}):[]:[]})[_0x89c6('0x11')](function(_0x23d07a){logger[_0x89c6('0x12')](_0x89c6('0x1d'),_0x639eb2);logger[_0x89c6('0x15')](_0x89c6('0x1d'),_0x639eb2,JSON[_0x89c6('0x17')](_0x23d07a));_0x39f927(_0x23d07a);})[_0x89c6('0x1c')](function(_0x4db6b5){logger[_0x89c6('0x18')]('GetSmsQueue',_0x4db6b5[_0x89c6('0x1a')],_0x639eb2);_0x4ffeb9(_0xf0d6f2['error'](0x1f4,_0x4db6b5[_0x89c6('0x1a')]));});});};exports[_0x89c6('0x26')]=function(_0x3e4622){var _0x28095e=this;return new Promise(function(_0x5e9b94,_0x51b7ec){return db[_0x89c6('0x1e')][_0x89c6('0x27')]({'raw':_0x3e4622[_0x89c6('0x1f')]?_0x3e4622[_0x89c6('0x1f')][_0x89c6('0x28')]===undefined?!![]:![]:!![],'where':_0x3e4622[_0x89c6('0x1f')]?_0x3e4622['options'][_0x89c6('0x20')]||null:null,'attributes':_0x3e4622[_0x89c6('0x1f')]?_0x3e4622['options']['attributes']||null:null,'include':_0x3e4622[_0x89c6('0x1f')]?_0x3e4622[_0x89c6('0x1f')][_0x89c6('0x22')]?_[_0x89c6('0x25')](_0x3e4622[_0x89c6('0x1f')][_0x89c6('0x22')],function(_0x1876e2){return{'model':db[_0x1876e2[_0x89c6('0x23')]],'as':_0x1876e2['as'],'attributes':_0x1876e2[_0x89c6('0x24')],'include':_0x1876e2['include']?_['map'](_0x1876e2[_0x89c6('0x22')],function(_0x30f8bc){return{'model':db[_0x30f8bc[_0x89c6('0x23')]],'as':_0x30f8bc['as'],'attributes':_0x30f8bc['attributes'],'include':_0x30f8bc[_0x89c6('0x22')]?_[_0x89c6('0x25')](_0x30f8bc[_0x89c6('0x22')],function(_0x26e906){return{'model':db[_0x26e906[_0x89c6('0x23')]],'as':_0x26e906['as'],'attributes':_0x26e906['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x220bf6){logger['info']('ShowSmsQueue',_0x3e4622);logger[_0x89c6('0x15')]('ShowSmsQueue',_0x3e4622,JSON['stringify'](_0x220bf6));_0x5e9b94(_0x220bf6);})[_0x89c6('0x1c')](function(_0x554813){logger[_0x89c6('0x18')]('ShowSmsQueue',_0x554813[_0x89c6('0x1a')],_0x3e4622);_0x51b7ec(_0x28095e['error'](0x1f4,_0x554813['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9d42969..cb21558 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 _0x2ddd=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x17dc77,_0x3b2f5c){var _0x28551a=function(_0x2315c8){while(--_0x2315c8){_0x17dc77['push'](_0x17dc77['shift']());}};_0x28551a(++_0x3b2f5c);}(_0x2ddd,0x6b));var _0xd2dd=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x2ddd[_0x21353c];return _0xa99120;};'use strict';var SmsQueueEvents=require(_0xd2dd('0x0'));var events=[_0xd2dd('0x1'),_0xd2dd('0x2'),_0xd2dd('0x3')];function createListener(_0x468680,_0x812328){return function(_0x466c20){_0x812328[_0xd2dd('0x4')](_0x468680,_0x466c20);};}function removeListener(_0x438240,_0x4bac33){return function(){SmsQueueEvents[_0xd2dd('0x5')](_0x438240,_0x4bac33);};}exports[_0xd2dd('0x6')]=function(_0x3bf0e3){for(var _0x4c8880=0x0,_0x5862c7=events[_0xd2dd('0x7')];_0x4c8880<_0x5862c7;_0x4c8880++){var _0x4175b1=events[_0x4c8880];var _0x163e4c=createListener(_0xd2dd('0x8')+_0x4175b1,_0x3bf0e3);SmsQueueEvents['on'](_0x4175b1,_0x163e4c);}}; \ No newline at end of file +var _0xefad=['emit','removeListener','length','./smsQueue.events','save','remove'];(function(_0x164467,_0x5df59a){var _0x56529f=function(_0x4ced8f){while(--_0x4ced8f){_0x164467['push'](_0x164467['shift']());}};_0x56529f(++_0x5df59a);}(_0xefad,0x129));var _0xdefa=function(_0x1b9edd,_0x66b166){_0x1b9edd=_0x1b9edd-0x0;var _0x4907c4=_0xefad[_0x1b9edd];return _0x4907c4;};'use strict';var SmsQueueEvents=require(_0xdefa('0x0'));var events=[_0xdefa('0x1'),_0xdefa('0x2'),'update'];function createListener(_0x51ddf2,_0x5d2455){return function(_0x159ff2){_0x5d2455[_0xdefa('0x3')](_0x51ddf2,_0x159ff2);};}function removeListener(_0x279ab1,_0x110b3f){return function(){SmsQueueEvents[_0xdefa('0x4')](_0x279ab1,_0x110b3f);};}exports['register']=function(_0x5e7241){for(var _0x186f25=0x0,_0x3b477f=events[_0xdefa('0x5')];_0x186f25<_0x3b477f;_0x186f25++){var _0x4b4bc0=events[_0x186f25];var _0x723857=createListener('smsQueue:'+_0x4b4bc0,_0x5e7241);SmsQueueEvents['on'](_0x4b4bc0,_0x723857);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e126a43..567dbad 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 _0x1488=['../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1c1109,_0x1956b0){var _0x3092cb=function(_0x594ac9){while(--_0x594ac9){_0x1c1109['push'](_0x1c1109['shift']());}};_0x3092cb(++_0x1956b0);}(_0x1488,0x88));var _0x8148=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x1488[_0x421e36];return _0x20b3e3;};'use strict';var multer=require(_0x8148('0x0'));var util=require('util');var path=require(_0x8148('0x1'));var timeout=require(_0x8148('0x2'));var express=require(_0x8148('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8148('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8148('0x5'));var controller=require(_0x8148('0x6'));router[_0x8148('0x7')]('/',auth[_0x8148('0x8')](),controller[_0x8148('0x9')]);router[_0x8148('0x7')](_0x8148('0xa'),auth[_0x8148('0x8')](),controller['describe']);router[_0x8148('0x7')](_0x8148('0xb'),auth[_0x8148('0x8')](),controller[_0x8148('0xc')]);router[_0x8148('0xd')]('/',auth[_0x8148('0x8')](),controller[_0x8148('0xe')]);router[_0x8148('0xf')](_0x8148('0xb'),auth[_0x8148('0x8')](),controller[_0x8148('0x10')]);router[_0x8148('0x11')]('/:id',auth[_0x8148('0x8')](),controller[_0x8148('0x12')]);module[_0x8148('0x13')]=router; \ No newline at end of file +var _0x1c3a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x3ef4ce,_0x5b4e3e){var _0x414d9d=function(_0x28e388){while(--_0x28e388){_0x3ef4ce['push'](_0x3ef4ce['shift']());}};_0x414d9d(++_0x5b4e3e);}(_0x1c3a,0x9d));var _0xa1c3=function(_0xd73be6,_0x15e94d){_0xd73be6=_0xd73be6-0x0;var _0x155ad0=_0x1c3a[_0xd73be6];return _0x155ad0;};'use strict';var multer=require(_0xa1c3('0x0'));var util=require(_0xa1c3('0x1'));var path=require(_0xa1c3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1c3('0x3'));var router=express[_0xa1c3('0x4')]();var fs_extra=require(_0xa1c3('0x5'));var auth=require(_0xa1c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c3('0x7'));var controller=require('./smsQueueReport.controller');router[_0xa1c3('0x8')]('/',auth['isAuthenticated'](),controller[_0xa1c3('0x9')]);router[_0xa1c3('0x8')](_0xa1c3('0xa'),auth[_0xa1c3('0xb')](),controller[_0xa1c3('0xc')]);router[_0xa1c3('0x8')](_0xa1c3('0xd'),auth['isAuthenticated'](),controller[_0xa1c3('0xe')]);router[_0xa1c3('0xf')]('/',auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x10')]);router[_0xa1c3('0x11')](_0xa1c3('0xd'),auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x12')]);router['delete']('/:id',auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5fde95a..fe9dae7 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 _0xd540=['STRING','sequelize','exports'];(function(_0x18a562,_0x580890){var _0x1191b8=function(_0x40185c){while(--_0x40185c){_0x18a562['push'](_0x18a562['shift']());}};_0x1191b8(++_0x580890);}(_0xd540,0x124));var _0x0d54=function(_0x2fde5b,_0x989dec){_0x2fde5b=_0x2fde5b-0x0;var _0x1009a6=_0xd540[_0x2fde5b];return _0x1009a6;};'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 _0xabe7=['DATE','moment','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabe7,0xce));var _0x7abe=function(_0x2ac57d,_0x5dc83c){_0x2ac57d=_0x2ac57d-0x0;var _0x1795bc=_0xabe7[_0x2ac57d];return _0x1795bc;};'use strict';var moment=require(_0x7abe('0x0'));var Sequelize=require(_0x7abe('0x1'));module[_0x7abe('0x2')]={'uniqueid':{'type':Sequelize[_0x7abe('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7abe('0x3')]},'joinAt':{'type':Sequelize[_0x7abe('0x4')]},'leaveAt':{'type':Sequelize[_0x7abe('0x4')]},'acceptAt':{'type':Sequelize[_0x7abe('0x4')]},'exitAt':{'type':Sequelize[_0x7abe('0x4')]},'reason':{'type':Sequelize[_0x7abe('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a70f400..fa22a7a 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 _0x9765=['undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','length','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x9765,0x7b));var _0x5976=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x9765[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x5976('0x0'));var rimraf=require(_0x5976('0x1'));var zipdir=require(_0x5976('0x2'));var jsonpatch=require(_0x5976('0x3'));var rp=require(_0x5976('0x4'));var moment=require('moment');var BPromise=require(_0x5976('0x5'));var Mustache=require(_0x5976('0x6'));var util=require(_0x5976('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5976('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5976('0x9'));var squel=require(_0x5976('0xa'));var crypto=require(_0x5976('0xb'));var jsforce=require(_0x5976('0xc'));var deskjs=require(_0x5976('0xd'));var toCsv=require(_0x5976('0xe'));var querystring=require(_0x5976('0xf'));var Papa=require(_0x5976('0x10'));var Redis=require(_0x5976('0x11'));var authService=require(_0x5976('0x12'));var qs=require(_0x5976('0x13'));var as=require(_0x5976('0x14'));var hardwareService=require(_0x5976('0x15'));var logger=require(_0x5976('0x16'))(_0x5976('0x17'));var utils=require(_0x5976('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5976('0x19'));var db=require(_0x5976('0x1a'))['db'];function respondWithStatusCode(_0x1d7219,_0x44dc3b){_0x44dc3b=_0x44dc3b||0xcc;return function(_0x450cf8){if(_0x450cf8){return _0x1d7219[_0x5976('0x1b')](_0x44dc3b);}return _0x1d7219[_0x5976('0x1c')](_0x44dc3b)[_0x5976('0x1d')]();};}function respondWithResult(_0x26e4a2,_0x31cc01){_0x31cc01=_0x31cc01||0xc8;return function(_0x12913f){if(_0x12913f){return _0x26e4a2[_0x5976('0x1c')](_0x31cc01)[_0x5976('0x1e')](_0x12913f);}};}function respondWithFilteredResult(_0x25cfbe,_0x3d02b5){return function(_0x404961){if(_0x404961){var _0x256c36=typeof _0x3d02b5['offset']==='undefined'&&typeof _0x3d02b5['limit']===_0x5976('0x1f');var _0xf55877=_0x404961[_0x5976('0x20')];var _0xcf37bd=_0x256c36?0x0:_0x3d02b5[_0x5976('0x21')];var _0x4735cf=_0x256c36?_0x404961[_0x5976('0x20')]:_0x3d02b5['offset']+_0x3d02b5['limit'];var _0x4ef40a;if(_0x4735cf>=_0xf55877){_0x4735cf=_0xf55877;_0x4ef40a=0xc8;}else{_0x4ef40a=0xce;}_0x25cfbe[_0x5976('0x1c')](_0x4ef40a);return _0x25cfbe[_0x5976('0x22')]('Content-Range',_0xcf37bd+'-'+_0x4735cf+'/'+_0xf55877)['json'](_0x404961);}return null;};}function patchUpdates(_0x437d7c){return function(_0x2082a7){try{jsonpatch[_0x5976('0x23')](_0x2082a7,_0x437d7c,!![]);}catch(_0x367aaf){return BPromise[_0x5976('0x24')](_0x367aaf);}return _0x2082a7[_0x5976('0x25')]();};}function saveUpdates(_0x2d0224,_0x5d7955){return function(_0x4567ac){if(_0x4567ac){return _0x4567ac[_0x5976('0x26')](_0x2d0224)[_0x5976('0x27')](function(_0x3f1b6d){return _0x3f1b6d;});}return null;};}function removeEntity(_0x4cc471,_0x46a3bf){return function(_0x2b572f){if(_0x2b572f){return _0x2b572f[_0x5976('0x28')]()[_0x5976('0x27')](function(){_0x4cc471['status'](0xcc)[_0x5976('0x1d')]();});}};}function handleEntityNotFound(_0x34d59e,_0x29f106){return function(_0x50aac7){if(!_0x50aac7){_0x34d59e[_0x5976('0x1b')](0x194);}return _0x50aac7;};}function handleError(_0x16c87f,_0x4c6093){_0x4c6093=_0x4c6093||0x1f4;return function(_0x5e4cf6){logger[_0x5976('0x29')](_0x5e4cf6[_0x5976('0x2a')]);if(_0x5e4cf6[_0x5976('0x2b')]){delete _0x5e4cf6['name'];}_0x16c87f[_0x5976('0x1c')](_0x4c6093)[_0x5976('0x2c')](_0x5e4cf6);};}exports[_0x5976('0x2d')]=function(_0x193bf0,_0x2b3682){var _0x24525d={},_0x26a674={},_0x597333={'count':0x0,'rows':[]};var _0x4c2171=_[_0x5976('0x2e')](db[_0x5976('0x2f')][_0x5976('0x30')],function(_0x5614c4){return{'name':_0x5614c4[_0x5976('0x31')],'type':_0x5614c4[_0x5976('0x32')]['key']};});_0x26a674[_0x5976('0x33')]=_[_0x5976('0x2e')](_0x4c2171,_0x5976('0x2b'));_0x26a674[_0x5976('0x34')]=_[_0x5976('0x35')](_0x193bf0[_0x5976('0x34')]);_0x26a674[_0x5976('0x36')]=_[_0x5976('0x37')](_0x26a674['model'],_0x26a674[_0x5976('0x34')]);_0x24525d['attributes']=_['intersection'](_0x26a674[_0x5976('0x33')],qs[_0x5976('0x38')](_0x193bf0[_0x5976('0x34')][_0x5976('0x38')]));_0x24525d[_0x5976('0x39')]=_0x24525d[_0x5976('0x39')]['length']?_0x24525d[_0x5976('0x39')]:_0x26a674['model'];if(!_0x193bf0[_0x5976('0x34')][_0x5976('0x3a')]('nolimit')){_0x24525d[_0x5976('0x3b')]=qs[_0x5976('0x3b')](_0x193bf0[_0x5976('0x34')][_0x5976('0x3b')]);_0x24525d[_0x5976('0x21')]=qs[_0x5976('0x21')](_0x193bf0['query']['offset']);}_0x24525d[_0x5976('0x3c')]=qs[_0x5976('0x3d')](_0x193bf0[_0x5976('0x34')][_0x5976('0x3d')]);_0x24525d[_0x5976('0x3e')]=qs[_0x5976('0x36')](_[_0x5976('0x3f')](_0x193bf0['query'],_0x26a674[_0x5976('0x36')]),_0x4c2171);if(_0x193bf0[_0x5976('0x34')]['filter']){_0x24525d['where']=_[_0x5976('0x40')](_0x24525d[_0x5976('0x3e')],{'$or':_[_0x5976('0x2e')](_0x4c2171,function(_0xee625b){if(_0xee625b[_0x5976('0x32')]!==_0x5976('0x41')){var _0x3003c4={};_0x3003c4[_0xee625b[_0x5976('0x2b')]]={'$like':'%'+_0x193bf0[_0x5976('0x34')][_0x5976('0x42')]+'%'};return _0x3003c4;}})});}_0x24525d=_[_0x5976('0x40')]({},_0x24525d,_0x193bf0['options']);var _0x403837={'where':_0x24525d[_0x5976('0x3e')]};return db[_0x5976('0x2f')][_0x5976('0x20')](_0x403837)[_0x5976('0x27')](function(_0x4736a0){_0x597333['count']=_0x4736a0;if(_0x193bf0[_0x5976('0x34')][_0x5976('0x43')]){_0x24525d[_0x5976('0x44')]=[{'all':!![]}];}return db[_0x5976('0x2f')]['findAll'](_0x24525d);})['then'](function(_0x4c077f){_0x597333[_0x5976('0x45')]=_0x4c077f;return _0x597333;})[_0x5976('0x27')](respondWithFilteredResult(_0x2b3682,_0x24525d))[_0x5976('0x46')](handleError(_0x2b3682,null));};exports[_0x5976('0x47')]=function(_0x563985,_0x5af106){var _0x39d96d={'raw':!![],'where':{'id':_0x563985['params']['id']}},_0x315f27={};_0x315f27[_0x5976('0x33')]=_[_0x5976('0x35')](db[_0x5976('0x2f')][_0x5976('0x30')]);_0x315f27[_0x5976('0x34')]=_[_0x5976('0x35')](_0x563985[_0x5976('0x34')]);_0x315f27[_0x5976('0x36')]=_['intersection'](_0x315f27[_0x5976('0x33')],_0x315f27[_0x5976('0x34')]);_0x39d96d['attributes']=_[_0x5976('0x37')](_0x315f27['model'],qs[_0x5976('0x38')](_0x563985['query'][_0x5976('0x38')]));_0x39d96d[_0x5976('0x39')]=_0x39d96d[_0x5976('0x39')][_0x5976('0x48')]?_0x39d96d['attributes']:_0x315f27[_0x5976('0x33')];if(_0x563985[_0x5976('0x34')]['includeAll']){_0x39d96d[_0x5976('0x44')]=[{'all':!![]}];}_0x39d96d=_[_0x5976('0x40')]({},_0x39d96d,_0x563985[_0x5976('0x49')]);return db[_0x5976('0x2f')]['find'](_0x39d96d)[_0x5976('0x27')](handleEntityNotFound(_0x5af106,null))['then'](respondWithResult(_0x5af106,null))[_0x5976('0x46')](handleError(_0x5af106,null));};exports[_0x5976('0x4a')]=function(_0x362f37,_0x2b87a4){return db['SmsQueueReport'][_0x5976('0x4a')](_0x362f37[_0x5976('0x4b')],{})[_0x5976('0x27')](respondWithResult(_0x2b87a4,0xc9))[_0x5976('0x46')](handleError(_0x2b87a4,null));};exports[_0x5976('0x26')]=function(_0x471ebe,_0x3ffbaa){if(_0x471ebe['body']['id']){delete _0x471ebe['body']['id'];}return db[_0x5976('0x2f')][_0x5976('0x4c')]({'where':{'id':_0x471ebe['params']['id']}})[_0x5976('0x27')](handleEntityNotFound(_0x3ffbaa,null))['then'](saveUpdates(_0x471ebe['body'],null))[_0x5976('0x27')](respondWithResult(_0x3ffbaa,null))[_0x5976('0x46')](handleError(_0x3ffbaa,null));};exports[_0x5976('0x28')]=function(_0x25fdb8,_0x42422a){return db['SmsQueueReport']['find']({'where':{'id':_0x25fdb8['params']['id']}})[_0x5976('0x27')](handleEntityNotFound(_0x42422a,null))['then'](removeEntity(_0x42422a,null))[_0x5976('0x46')](handleError(_0x42422a,null));};exports['describe']=function(_0x4d8aa4,_0x5e9c24){return db[_0x5976('0x2f')]['describe']()[_0x5976('0x27')](respondWithResult(_0x5e9c24,null))['catch'](handleError(_0x5e9c24,null));}; \ No newline at end of file +var _0xb2e3=['status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','send','index','map','SmsQueueReport','fieldName','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2dead5,_0x387a10){var _0x237d06=function(_0x292724){while(--_0x292724){_0x2dead5['push'](_0x2dead5['shift']());}};_0x237d06(++_0x387a10);}(_0xb2e3,0x82));var _0x3b2e=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb2e3[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x3b2e('0x0'));var rimraf=require(_0x3b2e('0x1'));var zipdir=require(_0x3b2e('0x2'));var jsonpatch=require(_0x3b2e('0x3'));var rp=require(_0x3b2e('0x4'));var moment=require('moment');var BPromise=require(_0x3b2e('0x5'));var Mustache=require(_0x3b2e('0x6'));var util=require('util');var path=require(_0x3b2e('0x7'));var sox=require(_0x3b2e('0x8'));var csv=require(_0x3b2e('0x9'));var ejs=require(_0x3b2e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b2e('0xb'));var squel=require(_0x3b2e('0xc'));var crypto=require(_0x3b2e('0xd'));var jsforce=require(_0x3b2e('0xe'));var deskjs=require(_0x3b2e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3b2e('0x10'));var Papa=require(_0x3b2e('0x11'));var Redis=require(_0x3b2e('0x12'));var authService=require(_0x3b2e('0x13'));var qs=require(_0x3b2e('0x14'));var as=require(_0x3b2e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b2e('0x16'))('api');var utils=require(_0x3b2e('0x17'));var config=require(_0x3b2e('0x18'));var licenseUtil=require(_0x3b2e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d225,_0x44a107){_0x44a107=_0x44a107||0xcc;return function(_0x203485){if(_0x203485){return _0x25d225['sendStatus'](_0x44a107);}return _0x25d225[_0x3b2e('0x1a')](_0x44a107)[_0x3b2e('0x1b')]();};}function respondWithResult(_0x2151b1,_0x3465a6){_0x3465a6=_0x3465a6||0xc8;return function(_0x3c7f51){if(_0x3c7f51){return _0x2151b1['status'](_0x3465a6)[_0x3b2e('0x1c')](_0x3c7f51);}};}function respondWithFilteredResult(_0x2e8c4f,_0x4b9dfe){return function(_0x248ad1){if(_0x248ad1){var _0x14d421=typeof _0x4b9dfe[_0x3b2e('0x1d')]==='undefined'&&typeof _0x4b9dfe[_0x3b2e('0x1e')]===_0x3b2e('0x1f');var _0x5b3dff=_0x248ad1[_0x3b2e('0x20')];var _0x495486=_0x14d421?0x0:_0x4b9dfe[_0x3b2e('0x1d')];var _0x51be03=_0x14d421?_0x248ad1[_0x3b2e('0x20')]:_0x4b9dfe[_0x3b2e('0x1d')]+_0x4b9dfe[_0x3b2e('0x1e')];var _0x367306;if(_0x51be03>=_0x5b3dff){_0x51be03=_0x5b3dff;_0x367306=0xc8;}else{_0x367306=0xce;}_0x2e8c4f[_0x3b2e('0x1a')](_0x367306);return _0x2e8c4f[_0x3b2e('0x21')](_0x3b2e('0x22'),_0x495486+'-'+_0x51be03+'/'+_0x5b3dff)[_0x3b2e('0x1c')](_0x248ad1);}return null;};}function patchUpdates(_0x400151){return function(_0x44d70c){try{jsonpatch['apply'](_0x44d70c,_0x400151,!![]);}catch(_0x37739f){return BPromise[_0x3b2e('0x23')](_0x37739f);}return _0x44d70c[_0x3b2e('0x24')]();};}function saveUpdates(_0x75ba17,_0x51608f){return function(_0x557391){if(_0x557391){return _0x557391[_0x3b2e('0x25')](_0x75ba17)['then'](function(_0x15df55){return _0x15df55;});}return null;};}function removeEntity(_0x1090cb,_0x4a1763){return function(_0x559cdb){if(_0x559cdb){return _0x559cdb[_0x3b2e('0x26')]()[_0x3b2e('0x27')](function(){_0x1090cb[_0x3b2e('0x1a')](0xcc)[_0x3b2e('0x1b')]();});}};}function handleEntityNotFound(_0x5698ef,_0x9c44e1){return function(_0xdee526){if(!_0xdee526){_0x5698ef['sendStatus'](0x194);}return _0xdee526;};}function handleError(_0x3d33a1,_0x2beb3e){_0x2beb3e=_0x2beb3e||0x1f4;return function(_0x3b4f3e){logger[_0x3b2e('0x28')](_0x3b4f3e[_0x3b2e('0x29')]);if(_0x3b4f3e['name']){delete _0x3b4f3e['name'];}_0x3d33a1[_0x3b2e('0x1a')](_0x2beb3e)[_0x3b2e('0x2a')](_0x3b4f3e);};}exports[_0x3b2e('0x2b')]=function(_0x5a4534,_0x6b5fd9){var _0x33ec56={},_0x3a05c9={},_0x400fbe={'count':0x0,'rows':[]};var _0xd6d26=_[_0x3b2e('0x2c')](db[_0x3b2e('0x2d')]['rawAttributes'],function(_0x410016){return{'name':_0x410016[_0x3b2e('0x2e')],'type':_0x410016['type'][_0x3b2e('0x2f')]};});_0x3a05c9['model']=_[_0x3b2e('0x2c')](_0xd6d26,_0x3b2e('0x30'));_0x3a05c9[_0x3b2e('0x31')]=_[_0x3b2e('0x32')](_0x5a4534['query']);_0x3a05c9[_0x3b2e('0x33')]=_[_0x3b2e('0x34')](_0x3a05c9[_0x3b2e('0x35')],_0x3a05c9[_0x3b2e('0x31')]);_0x33ec56[_0x3b2e('0x36')]=_[_0x3b2e('0x34')](_0x3a05c9[_0x3b2e('0x35')],qs[_0x3b2e('0x37')](_0x5a4534['query']['fields']));_0x33ec56[_0x3b2e('0x36')]=_0x33ec56['attributes']['length']?_0x33ec56[_0x3b2e('0x36')]:_0x3a05c9['model'];if(!_0x5a4534[_0x3b2e('0x31')][_0x3b2e('0x38')](_0x3b2e('0x39'))){_0x33ec56[_0x3b2e('0x1e')]=qs['limit'](_0x5a4534[_0x3b2e('0x31')][_0x3b2e('0x1e')]);_0x33ec56[_0x3b2e('0x1d')]=qs[_0x3b2e('0x1d')](_0x5a4534[_0x3b2e('0x31')]['offset']);}_0x33ec56[_0x3b2e('0x3a')]=qs[_0x3b2e('0x3b')](_0x5a4534[_0x3b2e('0x31')][_0x3b2e('0x3b')]);_0x33ec56[_0x3b2e('0x3c')]=qs['filters'](_[_0x3b2e('0x3d')](_0x5a4534['query'],_0x3a05c9['filters']),_0xd6d26);if(_0x5a4534[_0x3b2e('0x31')][_0x3b2e('0x3e')]){_0x33ec56[_0x3b2e('0x3c')]=_[_0x3b2e('0x3f')](_0x33ec56[_0x3b2e('0x3c')],{'$or':_[_0x3b2e('0x2c')](_0xd6d26,function(_0x89a1f5){if(_0x89a1f5[_0x3b2e('0x40')]!=='VIRTUAL'){var _0x120aee={};_0x120aee[_0x89a1f5[_0x3b2e('0x30')]]={'$like':'%'+_0x5a4534[_0x3b2e('0x31')]['filter']+'%'};return _0x120aee;}})});}_0x33ec56=_[_0x3b2e('0x3f')]({},_0x33ec56,_0x5a4534[_0x3b2e('0x41')]);var _0x227c86={'where':_0x33ec56[_0x3b2e('0x3c')]};return db[_0x3b2e('0x2d')][_0x3b2e('0x20')](_0x227c86)['then'](function(_0x46877e){_0x400fbe[_0x3b2e('0x20')]=_0x46877e;if(_0x5a4534[_0x3b2e('0x31')][_0x3b2e('0x42')]){_0x33ec56[_0x3b2e('0x43')]=[{'all':!![]}];}return db[_0x3b2e('0x2d')][_0x3b2e('0x44')](_0x33ec56);})[_0x3b2e('0x27')](function(_0xdd820d){_0x400fbe[_0x3b2e('0x45')]=_0xdd820d;return _0x400fbe;})['then'](respondWithFilteredResult(_0x6b5fd9,_0x33ec56))[_0x3b2e('0x46')](handleError(_0x6b5fd9,null));};exports[_0x3b2e('0x47')]=function(_0x53f0e1,_0x3e736c){var _0x1e575c={'raw':!![],'where':{'id':_0x53f0e1['params']['id']}},_0x3cf1b2={};_0x3cf1b2['model']=_[_0x3b2e('0x32')](db[_0x3b2e('0x2d')][_0x3b2e('0x48')]);_0x3cf1b2[_0x3b2e('0x31')]=_[_0x3b2e('0x32')](_0x53f0e1['query']);_0x3cf1b2[_0x3b2e('0x33')]=_[_0x3b2e('0x34')](_0x3cf1b2[_0x3b2e('0x35')],_0x3cf1b2[_0x3b2e('0x31')]);_0x1e575c[_0x3b2e('0x36')]=_[_0x3b2e('0x34')](_0x3cf1b2[_0x3b2e('0x35')],qs[_0x3b2e('0x37')](_0x53f0e1[_0x3b2e('0x31')][_0x3b2e('0x37')]));_0x1e575c['attributes']=_0x1e575c[_0x3b2e('0x36')]['length']?_0x1e575c[_0x3b2e('0x36')]:_0x3cf1b2[_0x3b2e('0x35')];if(_0x53f0e1[_0x3b2e('0x31')]['includeAll']){_0x1e575c[_0x3b2e('0x43')]=[{'all':!![]}];}_0x1e575c=_[_0x3b2e('0x3f')]({},_0x1e575c,_0x53f0e1[_0x3b2e('0x41')]);return db[_0x3b2e('0x2d')]['find'](_0x1e575c)[_0x3b2e('0x27')](handleEntityNotFound(_0x3e736c,null))['then'](respondWithResult(_0x3e736c,null))['catch'](handleError(_0x3e736c,null));};exports[_0x3b2e('0x49')]=function(_0x4bd134,_0x5b63a1){return db[_0x3b2e('0x2d')][_0x3b2e('0x49')](_0x4bd134['body'],{})[_0x3b2e('0x27')](respondWithResult(_0x5b63a1,0xc9))[_0x3b2e('0x46')](handleError(_0x5b63a1,null));};exports['update']=function(_0x3f01fd,_0x251986){if(_0x3f01fd[_0x3b2e('0x4a')]['id']){delete _0x3f01fd[_0x3b2e('0x4a')]['id'];}return db[_0x3b2e('0x2d')][_0x3b2e('0x4b')]({'where':{'id':_0x3f01fd[_0x3b2e('0x4c')]['id']}})[_0x3b2e('0x27')](handleEntityNotFound(_0x251986,null))[_0x3b2e('0x27')](saveUpdates(_0x3f01fd[_0x3b2e('0x4a')],null))[_0x3b2e('0x27')](respondWithResult(_0x251986,null))['catch'](handleError(_0x251986,null));};exports[_0x3b2e('0x26')]=function(_0x2ea06b,_0xff3b78){return db[_0x3b2e('0x2d')]['find']({'where':{'id':_0x2ea06b['params']['id']}})[_0x3b2e('0x27')](handleEntityNotFound(_0xff3b78,null))['then'](removeEntity(_0xff3b78,null))[_0x3b2e('0x46')](handleError(_0xff3b78,null));};exports[_0x3b2e('0x4d')]=function(_0x1d0e4c,_0x4aa05e){return db[_0x3b2e('0x2d')][_0x3b2e('0x4d')]()['then'](respondWithResult(_0x4aa05e,null))[_0x3b2e('0x46')](handleError(_0x4aa05e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 693bc65..7df25df 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x34533,_0x531aeb){var _0x5810ff=function(_0x478ff1){while(--_0x478ff1){_0x34533['push'](_0x34533['shift']());}};_0x5810ff(++_0x531aeb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0xcb91[_0x2a276d];return _0x2914cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x31f94a,_0x476425){var _0x39641b=function(_0x449158){while(--_0x449158){_0x31f94a['push'](_0x31f94a['shift']());}};_0x39641b(++_0x476425);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 1e11835..9d75c0f 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 _0x0ff0=['body','options','raw','UpdateSmsQueueReport','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x363f76,_0x2aff39){var _0x43d5e6=function(_0x192845){while(--_0x192845){_0x363f76['push'](_0x363f76['shift']());}};_0x43d5e6(++_0x2aff39);}(_0x0ff0,0x17e));var _0x00ff=function(_0x25e7a9,_0xc637db){_0x25e7a9=_0x25e7a9-0x0;var _0x18fa69=_0x0ff0[_0x25e7a9];return _0x18fa69;};'use strict';var _=require('lodash');var util=require(_0x00ff('0x0'));var moment=require('moment');var BPromise=require(_0x00ff('0x1'));var rs=require(_0x00ff('0x2'));var fs=require('fs');var Redis=require(_0x00ff('0x3'));var db=require(_0x00ff('0x4'))['db'];var utils=require(_0x00ff('0x5'));var logger=require(_0x00ff('0x6'))(_0x00ff('0x7'));var config=require(_0x00ff('0x8'));var jayson=require(_0x00ff('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26b541,_0xbcb003,_0x27a1b2){return new BPromise(function(_0x243545,_0xc8fb7f){return client['request'](_0x26b541,_0x27a1b2)[_0x00ff('0xa')](function(_0x40670d){logger[_0x00ff('0xb')](_0x00ff('0xc'),_0xbcb003,_0x00ff('0xd'));logger[_0x00ff('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xbcb003,'request\x20sent',JSON[_0x00ff('0xf')](_0x40670d));if(_0x40670d[_0x00ff('0x10')]){if(_0x40670d[_0x00ff('0x10')][_0x00ff('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0xbcb003,_0x40670d[_0x00ff('0x10')][_0x00ff('0x12')]);return _0xc8fb7f(_0x40670d['error'][_0x00ff('0x12')]);}logger[_0x00ff('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0xbcb003,_0x40670d[_0x00ff('0x10')][_0x00ff('0x12')]);return _0x243545(_0x40670d[_0x00ff('0x10')][_0x00ff('0x12')]);}else{logger[_0x00ff('0xb')](_0x00ff('0xc'),_0xbcb003,_0x00ff('0xd'));_0x243545(_0x40670d[_0x00ff('0x13')][_0x00ff('0x12')]);}})[_0x00ff('0x14')](function(_0x5b02f8){logger['error'](_0x00ff('0xc'),_0xbcb003,_0x5b02f8);_0xc8fb7f(_0x5b02f8);});});}exports[_0x00ff('0x15')]=function(_0x3174f7){var _0x3fe5b9=this;return new Promise(function(_0x45f98c,_0x5eba0f){return db[_0x00ff('0x16')][_0x00ff('0x17')](_0x3174f7[_0x00ff('0x18')],{'raw':_0x3174f7[_0x00ff('0x19')]?_0x3174f7['options'][_0x00ff('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x105266){logger[_0x00ff('0xb')](_0x00ff('0x15'),_0x3174f7);logger['debug'](_0x00ff('0x15'),_0x3174f7,JSON[_0x00ff('0xf')](_0x105266));_0x45f98c(_0x105266);})[_0x00ff('0x14')](function(_0x5c4986){logger[_0x00ff('0x10')](_0x00ff('0x15'),_0x5c4986[_0x00ff('0x12')],_0x3174f7);_0x5eba0f(_0x3fe5b9['error'](0x1f4,_0x5c4986[_0x00ff('0x12')]));});});};exports[_0x00ff('0x1b')]=function(_0x172560){var _0x1e4bf5=this;return new Promise(function(_0x361e33,_0x62e6b0){return db[_0x00ff('0x16')]['update'](_0x172560['body'],{'raw':_0x172560[_0x00ff('0x19')]?_0x172560['options'][_0x00ff('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172560[_0x00ff('0x19')]?_0x172560[_0x00ff('0x19')]['where']||null:null,'attributes':_0x172560[_0x00ff('0x19')]?_0x172560['options'][_0x00ff('0x1c')]||null:null,'limit':_0x172560[_0x00ff('0x19')]?_0x172560['options']['limit']||null:null})[_0x00ff('0xa')](function(_0x30d90b){logger['info'](_0x00ff('0x1b'),_0x172560);logger[_0x00ff('0xe')]('UpdateSmsQueueReport',_0x172560,JSON[_0x00ff('0xf')](_0x30d90b));_0x361e33(_0x30d90b);})[_0x00ff('0x14')](function(_0x2a0fc3){logger['error']('UpdateSmsQueueReport',_0x2a0fc3[_0x00ff('0x12')],_0x172560);_0x62e6b0(_0x1e4bf5[_0x00ff('0x10')](0x1f4,_0x2a0fc3[_0x00ff('0x12')]));});});}; \ No newline at end of file +var _0x063d=['message','info','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','SmsQueueReport,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x063d,0x1ed));var _0xd063=function(_0x237a3b,_0x1cb8ca){_0x237a3b=_0x237a3b-0x0;var _0x519e6d=_0x063d[_0x237a3b];return _0x519e6d;};'use strict';var _=require(_0xd063('0x0'));var util=require(_0xd063('0x1'));var moment=require(_0xd063('0x2'));var BPromise=require(_0xd063('0x3'));var rs=require(_0xd063('0x4'));var fs=require('fs');var Redis=require(_0xd063('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd063('0x6'));var logger=require(_0xd063('0x7'))(_0xd063('0x8'));var config=require(_0xd063('0x9'));var jayson=require(_0xd063('0xa'));var client=jayson['client'][_0xd063('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341a6c,_0x8967f7,_0x5c0d1f){return new BPromise(function(_0x22397c,_0xfa06c5){return client[_0xd063('0xc')](_0x341a6c,_0x5c0d1f)[_0xd063('0xd')](function(_0x32681f){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x8967f7,_0xd063('0xe'));logger[_0xd063('0xf')](_0xd063('0x10'),_0x8967f7,_0xd063('0xe'),JSON['stringify'](_0x32681f));if(_0x32681f['error']){if(_0x32681f[_0xd063('0x11')]['code']===0x1f4){logger['error'](_0xd063('0x12'),_0x8967f7,_0x32681f[_0xd063('0x11')][_0xd063('0x13')]);return _0xfa06c5(_0x32681f[_0xd063('0x11')]['message']);}logger[_0xd063('0x11')](_0xd063('0x12'),_0x8967f7,_0x32681f[_0xd063('0x11')][_0xd063('0x13')]);return _0x22397c(_0x32681f[_0xd063('0x11')]['message']);}else{logger[_0xd063('0x14')](_0xd063('0x12'),_0x8967f7,_0xd063('0xe'));_0x22397c(_0x32681f['result'][_0xd063('0x13')]);}})[_0xd063('0x15')](function(_0x50ab75){logger[_0xd063('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x8967f7,_0x50ab75);_0xfa06c5(_0x50ab75);});});}exports['CreateSmsQueueReport']=function(_0x37aad3){var _0x229519=this;return new Promise(function(_0x1f45d1,_0x31ca2d){return db[_0xd063('0x16')][_0xd063('0x17')](_0x37aad3[_0xd063('0x18')],{'raw':_0x37aad3['options']?_0x37aad3[_0xd063('0x19')][_0xd063('0x1a')]===undefined?!![]:![]:!![]})[_0xd063('0xd')](function(_0x231d7c){logger[_0xd063('0x14')]('CreateSmsQueueReport',_0x37aad3);logger[_0xd063('0xf')](_0xd063('0x1b'),_0x37aad3,JSON[_0xd063('0x1c')](_0x231d7c));_0x1f45d1(_0x231d7c);})[_0xd063('0x15')](function(_0x1c7a04){logger[_0xd063('0x11')]('CreateSmsQueueReport',_0x1c7a04[_0xd063('0x13')],_0x37aad3);_0x31ca2d(_0x229519[_0xd063('0x11')](0x1f4,_0x1c7a04['message']));});});};exports[_0xd063('0x1d')]=function(_0x4a67d2){var _0x3075cf=this;return new Promise(function(_0xdf8443,_0x1cdbba){return db[_0xd063('0x16')][_0xd063('0x1e')](_0x4a67d2['body'],{'raw':_0x4a67d2[_0xd063('0x19')]?_0x4a67d2[_0xd063('0x19')][_0xd063('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a67d2[_0xd063('0x19')]?_0x4a67d2[_0xd063('0x19')]['where']||null:null,'attributes':_0x4a67d2[_0xd063('0x19')]?_0x4a67d2[_0xd063('0x19')][_0xd063('0x1f')]||null:null,'limit':_0x4a67d2['options']?_0x4a67d2[_0xd063('0x19')]['limit']||null:null})[_0xd063('0xd')](function(_0x2f7cc2){logger['info'](_0xd063('0x1d'),_0x4a67d2);logger['debug'](_0xd063('0x1d'),_0x4a67d2,JSON[_0xd063('0x1c')](_0x2f7cc2));_0xdf8443(_0x2f7cc2);})[_0xd063('0x15')](function(_0x28bbd0){logger['error'](_0xd063('0x1d'),_0x28bbd0[_0xd063('0x13')],_0x4a67d2);_0x1cdbba(_0x3075cf[_0xd063('0x11')](0x1f4,_0x28bbd0[_0xd063('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 25a0aef..adebbdf 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 _0xfd7b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x551e97,_0x304c76){var _0x4fb87c=function(_0x4a3bb2){while(--_0x4a3bb2){_0x551e97['push'](_0x551e97['shift']());}};_0x4fb87c(++_0x304c76);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xfd7b[_0x1e3671];return _0x48d5f5;};'use strict';var multer=require('multer');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var controller=require(_0xbfd7('0x9'));router[_0xbfd7('0xa')]('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0xe')]);router['get'](_0xbfd7('0xf'),auth[_0xbfd7('0xb')](),controller[_0xbfd7('0x10')]);router[_0xbfd7('0x11')]('/',auth['isAuthenticated'](),controller[_0xbfd7('0x12')]);router[_0xbfd7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbfd7('0x14')]);router[_0xbfd7('0x15')](_0xbfd7('0xf'),auth[_0xbfd7('0xb')](),controller[_0xbfd7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x446c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','post','create','put','update','delete'];(function(_0x193e1d,_0x1ffa55){var _0x1f1076=function(_0x3d76d5){while(--_0x3d76d5){_0x193e1d['push'](_0x193e1d['shift']());}};_0x1f1076(++_0x1ffa55);}(_0x446c,0x156));var _0xc446=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x446c[_0x152136];return _0x20df44;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var fs_extra=require(_0xc446('0x5'));var auth=require(_0xc446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc446('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc446('0x8')](),controller[_0xc446('0x9')]);router['get']('/describe',auth[_0xc446('0x8')](),controller[_0xc446('0xa')]);router[_0xc446('0xb')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller['show']);router[_0xc446('0xd')]('/',auth[_0xc446('0x8')](),controller[_0xc446('0xe')]);router[_0xc446('0xf')]('/:id',auth[_0xc446('0x8')](),controller[_0xc446('0x10')]);router[_0xc446('0x11')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller[_0xc446('0x12')]);module[_0xc446('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 942ed44..3efd120 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4f7108,_0xffcdd4){var _0x1a5526=function(_0x4a0c1d){while(--_0x4a0c1d){_0x4f7108['push'](_0x4f7108['shift']());}};_0x1a5526(++_0xffcdd4);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f6ac7,_0x4e7259){_0x1f6ac7=_0x1f6ac7-0x0;var _0x477b48=_0xedd9[_0x1f6ac7];return _0x477b48;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4aba09,_0x442b7b){_0x4aba09=_0x4aba09-0x0;var _0x52647e=_0x9bde[_0x4aba09];return _0x52647e;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 6040098..3574c87 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 _0x28ce=['query','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','SmsTransferReport','key','keys'];(function(_0x5f3082,_0x574f5f){var _0x23f8f2=function(_0x1e3082){while(--_0x1e3082){_0x5f3082['push'](_0x5f3082['shift']());}};_0x23f8f2(++_0x574f5f);}(_0x28ce,0xf2));var _0xe28c=function(_0x44e630,_0x4bada6){_0x44e630=_0x44e630-0x0;var _0x3a28a7=_0x28ce[_0x44e630];return _0x3a28a7;};'use strict';var emlformat=require(_0xe28c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe28c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe28c('0x2'));var moment=require('moment');var BPromise=require(_0xe28c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe28c('0x4'));var sox=require(_0xe28c('0x5'));var csv=require(_0xe28c('0x6'));var ejs=require(_0xe28c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe28c('0x8'));var squel=require(_0xe28c('0x9'));var crypto=require(_0xe28c('0xa'));var jsforce=require(_0xe28c('0xb'));var deskjs=require(_0xe28c('0xc'));var toCsv=require(_0xe28c('0x6'));var querystring=require(_0xe28c('0xd'));var Papa=require('papaparse');var Redis=require(_0xe28c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe28c('0xf'));var as=require(_0xe28c('0x10'));var hardwareService=require(_0xe28c('0x11'));var logger=require(_0xe28c('0x12'))(_0xe28c('0x13'));var utils=require(_0xe28c('0x14'));var config=require(_0xe28c('0x15'));var licenseUtil=require(_0xe28c('0x16'));var db=require(_0xe28c('0x17'))['db'];function respondWithStatusCode(_0x465960,_0x5c7a9b){_0x5c7a9b=_0x5c7a9b||0xcc;return function(_0x326d76){if(_0x326d76){return _0x465960[_0xe28c('0x18')](_0x5c7a9b);}return _0x465960[_0xe28c('0x19')](_0x5c7a9b)[_0xe28c('0x1a')]();};}function respondWithResult(_0x2c627f,_0x190617){_0x190617=_0x190617||0xc8;return function(_0x38f490){if(_0x38f490){return _0x2c627f[_0xe28c('0x19')](_0x190617)[_0xe28c('0x1b')](_0x38f490);}};}function respondWithFilteredResult(_0xad5124,_0x2fc669){return function(_0x3ec326){if(_0x3ec326){var _0x2d2d1c=typeof _0x2fc669[_0xe28c('0x1c')]==='undefined'&&typeof _0x2fc669[_0xe28c('0x1d')]===_0xe28c('0x1e');var _0x51a9e5=_0x3ec326[_0xe28c('0x1f')];var _0xa39892=_0x2d2d1c?0x0:_0x2fc669[_0xe28c('0x1c')];var _0x5662fb=_0x2d2d1c?_0x3ec326['count']:_0x2fc669[_0xe28c('0x1c')]+_0x2fc669[_0xe28c('0x1d')];var _0x407172;if(_0x5662fb>=_0x51a9e5){_0x5662fb=_0x51a9e5;_0x407172=0xc8;}else{_0x407172=0xce;}_0xad5124[_0xe28c('0x19')](_0x407172);return _0xad5124[_0xe28c('0x20')](_0xe28c('0x21'),_0xa39892+'-'+_0x5662fb+'/'+_0x51a9e5)[_0xe28c('0x1b')](_0x3ec326);}return null;};}function patchUpdates(_0x3656df){return function(_0x2f0539){try{jsonpatch['apply'](_0x2f0539,_0x3656df,!![]);}catch(_0xfe2f71){return BPromise[_0xe28c('0x22')](_0xfe2f71);}return _0x2f0539[_0xe28c('0x23')]();};}function saveUpdates(_0x5784a9,_0x9194e7){return function(_0x4cd8da){if(_0x4cd8da){return _0x4cd8da[_0xe28c('0x24')](_0x5784a9)['then'](function(_0x56eac3){return _0x56eac3;});}return null;};}function removeEntity(_0x507ec1,_0x36bcea){return function(_0x3c97ff){if(_0x3c97ff){return _0x3c97ff[_0xe28c('0x25')]()[_0xe28c('0x26')](function(){_0x507ec1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19765f,_0x3bbdd1){return function(_0x156ee9){if(!_0x156ee9){_0x19765f[_0xe28c('0x18')](0x194);}return _0x156ee9;};}function handleError(_0x49db06,_0x279e6a){_0x279e6a=_0x279e6a||0x1f4;return function(_0x12061a){logger['error'](_0x12061a[_0xe28c('0x27')]);if(_0x12061a[_0xe28c('0x28')]){delete _0x12061a['name'];}_0x49db06['status'](_0x279e6a)[_0xe28c('0x29')](_0x12061a);};}exports['index']=function(_0xd6c957,_0x3288eb){var _0x1ae7aa={},_0x33834c={},_0x2652bd={'count':0x0,'rows':[]};var _0x299b84=_[_0xe28c('0x2a')](db[_0xe28c('0x2b')]['rawAttributes'],function(_0xa3b22b){return{'name':_0xa3b22b['fieldName'],'type':_0xa3b22b['type'][_0xe28c('0x2c')]};});_0x33834c['model']=_[_0xe28c('0x2a')](_0x299b84,_0xe28c('0x28'));_0x33834c['query']=_[_0xe28c('0x2d')](_0xd6c957[_0xe28c('0x2e')]);_0x33834c[_0xe28c('0x2f')]=_[_0xe28c('0x30')](_0x33834c['model'],_0x33834c[_0xe28c('0x2e')]);_0x1ae7aa['attributes']=_[_0xe28c('0x30')](_0x33834c[_0xe28c('0x31')],qs[_0xe28c('0x32')](_0xd6c957['query']['fields']));_0x1ae7aa['attributes']=_0x1ae7aa[_0xe28c('0x33')][_0xe28c('0x34')]?_0x1ae7aa[_0xe28c('0x33')]:_0x33834c[_0xe28c('0x31')];if(!_0xd6c957[_0xe28c('0x2e')]['hasOwnProperty']('nolimit')){_0x1ae7aa[_0xe28c('0x1d')]=qs['limit'](_0xd6c957[_0xe28c('0x2e')][_0xe28c('0x1d')]);_0x1ae7aa[_0xe28c('0x1c')]=qs['offset'](_0xd6c957[_0xe28c('0x2e')][_0xe28c('0x1c')]);}_0x1ae7aa[_0xe28c('0x35')]=qs[_0xe28c('0x36')](_0xd6c957[_0xe28c('0x2e')]['sort']);_0x1ae7aa['where']=qs[_0xe28c('0x2f')](_[_0xe28c('0x37')](_0xd6c957[_0xe28c('0x2e')],_0x33834c['filters']),_0x299b84);if(_0xd6c957[_0xe28c('0x2e')][_0xe28c('0x38')]){_0x1ae7aa[_0xe28c('0x39')]=_[_0xe28c('0x3a')](_0x1ae7aa[_0xe28c('0x39')],{'$or':_[_0xe28c('0x2a')](_0x299b84,function(_0x1f18fa){if(_0x1f18fa[_0xe28c('0x3b')]!=='VIRTUAL'){var _0xcd08f6={};_0xcd08f6[_0x1f18fa['name']]={'$like':'%'+_0xd6c957[_0xe28c('0x2e')]['filter']+'%'};return _0xcd08f6;}})});}_0x1ae7aa=_[_0xe28c('0x3a')]({},_0x1ae7aa,_0xd6c957[_0xe28c('0x3c')]);var _0x2b4368={'where':_0x1ae7aa[_0xe28c('0x39')]};return db['SmsTransferReport'][_0xe28c('0x1f')](_0x2b4368)[_0xe28c('0x26')](function(_0x472166){_0x2652bd['count']=_0x472166;if(_0xd6c957[_0xe28c('0x2e')][_0xe28c('0x3d')]){_0x1ae7aa['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xe28c('0x3e')](_0x1ae7aa);})['then'](function(_0x284e7c){_0x2652bd['rows']=_0x284e7c;return _0x2652bd;})[_0xe28c('0x26')](respondWithFilteredResult(_0x3288eb,_0x1ae7aa))[_0xe28c('0x3f')](handleError(_0x3288eb,null));};exports[_0xe28c('0x40')]=function(_0x20ae54,_0x36c27b){var _0x95bcdb={'raw':!![],'where':{'id':_0x20ae54['params']['id']}},_0x5a894f={};_0x5a894f[_0xe28c('0x31')]=_[_0xe28c('0x2d')](db[_0xe28c('0x2b')][_0xe28c('0x41')]);_0x5a894f[_0xe28c('0x2e')]=_[_0xe28c('0x2d')](_0x20ae54[_0xe28c('0x2e')]);_0x5a894f[_0xe28c('0x2f')]=_[_0xe28c('0x30')](_0x5a894f[_0xe28c('0x31')],_0x5a894f[_0xe28c('0x2e')]);_0x95bcdb[_0xe28c('0x33')]=_[_0xe28c('0x30')](_0x5a894f[_0xe28c('0x31')],qs[_0xe28c('0x32')](_0x20ae54[_0xe28c('0x2e')]['fields']));_0x95bcdb[_0xe28c('0x33')]=_0x95bcdb[_0xe28c('0x33')]['length']?_0x95bcdb[_0xe28c('0x33')]:_0x5a894f[_0xe28c('0x31')];if(_0x20ae54[_0xe28c('0x2e')][_0xe28c('0x3d')]){_0x95bcdb[_0xe28c('0x42')]=[{'all':!![]}];}_0x95bcdb=_[_0xe28c('0x3a')]({},_0x95bcdb,_0x20ae54[_0xe28c('0x3c')]);return db[_0xe28c('0x2b')][_0xe28c('0x43')](_0x95bcdb)['then'](handleEntityNotFound(_0x36c27b,null))[_0xe28c('0x26')](respondWithResult(_0x36c27b,null))[_0xe28c('0x3f')](handleError(_0x36c27b,null));};exports['create']=function(_0x2ea479,_0xce352){return db[_0xe28c('0x2b')][_0xe28c('0x44')](_0x2ea479[_0xe28c('0x45')],{})['then'](respondWithResult(_0xce352,0xc9))[_0xe28c('0x3f')](handleError(_0xce352,null));};exports[_0xe28c('0x24')]=function(_0x389102,_0x4e6c08){if(_0x389102[_0xe28c('0x45')]['id']){delete _0x389102[_0xe28c('0x45')]['id'];}return db[_0xe28c('0x2b')]['find']({'where':{'id':_0x389102[_0xe28c('0x46')]['id']}})[_0xe28c('0x26')](handleEntityNotFound(_0x4e6c08,null))['then'](saveUpdates(_0x389102[_0xe28c('0x45')],null))['then'](respondWithResult(_0x4e6c08,null))['catch'](handleError(_0x4e6c08,null));};exports['destroy']=function(_0x50800a,_0x581bf4){return db[_0xe28c('0x2b')]['find']({'where':{'id':_0x50800a[_0xe28c('0x46')]['id']}})[_0xe28c('0x26')](handleEntityNotFound(_0x581bf4,null))[_0xe28c('0x26')](removeEntity(_0x581bf4,null))['catch'](handleError(_0x581bf4,null));};exports[_0xe28c('0x47')]=function(_0x26004c,_0xae051){return db['SmsTransferReport'][_0xe28c('0x47')]()[_0xe28c('0x26')](respondWithResult(_0xae051,null))[_0xe28c('0x3f')](handleError(_0xae051,null));}; \ No newline at end of file +var _0x03c0=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','filter','merge','include','findAll','rows','show','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','map','SmsTransferReport'];(function(_0x549f19,_0x56453f){var _0x3c9f1a=function(_0x53b074){while(--_0x53b074){_0x549f19['push'](_0x549f19['shift']());}};_0x3c9f1a(++_0x56453f);}(_0x03c0,0xef));var _0x003c=function(_0x5e7cf2,_0x1d3e7c){_0x5e7cf2=_0x5e7cf2-0x0;var _0x412b1a=_0x03c0[_0x5e7cf2];return _0x412b1a;};'use strict';var emlformat=require(_0x003c('0x0'));var rimraf=require(_0x003c('0x1'));var zipdir=require(_0x003c('0x2'));var jsonpatch=require(_0x003c('0x3'));var rp=require(_0x003c('0x4'));var moment=require('moment');var BPromise=require(_0x003c('0x5'));var Mustache=require('mustache');var util=require(_0x003c('0x6'));var path=require(_0x003c('0x7'));var sox=require(_0x003c('0x8'));var csv=require(_0x003c('0x9'));var ejs=require(_0x003c('0xa'));var fs=require('fs');var fs_extra=require(_0x003c('0xb'));var _=require('lodash');var squel=require(_0x003c('0xc'));var crypto=require('crypto');var jsforce=require(_0x003c('0xd'));var deskjs=require(_0x003c('0xe'));var toCsv=require(_0x003c('0x9'));var querystring=require(_0x003c('0xf'));var Papa=require(_0x003c('0x10'));var Redis=require('ioredis');var authService=require(_0x003c('0x11'));var qs=require(_0x003c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x003c('0x13'));var logger=require(_0x003c('0x14'))(_0x003c('0x15'));var utils=require(_0x003c('0x16'));var config=require(_0x003c('0x17'));var licenseUtil=require(_0x003c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b4276,_0x466b5e){_0x466b5e=_0x466b5e||0xcc;return function(_0x1a5eb5){if(_0x1a5eb5){return _0x3b4276['sendStatus'](_0x466b5e);}return _0x3b4276[_0x003c('0x19')](_0x466b5e)['end']();};}function respondWithResult(_0x18ba4c,_0x169b3){_0x169b3=_0x169b3||0xc8;return function(_0x4033e5){if(_0x4033e5){return _0x18ba4c['status'](_0x169b3)[_0x003c('0x1a')](_0x4033e5);}};}function respondWithFilteredResult(_0x4e4edf,_0x2620ae){return function(_0x367ee7){if(_0x367ee7){var _0x2d8535=typeof _0x2620ae[_0x003c('0x1b')]===_0x003c('0x1c')&&typeof _0x2620ae[_0x003c('0x1d')]===_0x003c('0x1c');var _0x51ed60=_0x367ee7[_0x003c('0x1e')];var _0x3aa465=_0x2d8535?0x0:_0x2620ae[_0x003c('0x1b')];var _0x4b998d=_0x2d8535?_0x367ee7[_0x003c('0x1e')]:_0x2620ae[_0x003c('0x1b')]+_0x2620ae[_0x003c('0x1d')];var _0xdf8243;if(_0x4b998d>=_0x51ed60){_0x4b998d=_0x51ed60;_0xdf8243=0xc8;}else{_0xdf8243=0xce;}_0x4e4edf[_0x003c('0x19')](_0xdf8243);return _0x4e4edf['set'](_0x003c('0x1f'),_0x3aa465+'-'+_0x4b998d+'/'+_0x51ed60)[_0x003c('0x1a')](_0x367ee7);}return null;};}function patchUpdates(_0x176007){return function(_0x346b96){try{jsonpatch['apply'](_0x346b96,_0x176007,!![]);}catch(_0x213fb7){return BPromise[_0x003c('0x20')](_0x213fb7);}return _0x346b96[_0x003c('0x21')]();};}function saveUpdates(_0x4f5985,_0x54db9c){return function(_0x27e346){if(_0x27e346){return _0x27e346[_0x003c('0x22')](_0x4f5985)['then'](function(_0x534225){return _0x534225;});}return null;};}function removeEntity(_0x469bf0,_0x2df90a){return function(_0x4caddf){if(_0x4caddf){return _0x4caddf[_0x003c('0x23')]()[_0x003c('0x24')](function(){_0x469bf0[_0x003c('0x19')](0xcc)[_0x003c('0x25')]();});}};}function handleEntityNotFound(_0x4034bf,_0x56312e){return function(_0x4e830d){if(!_0x4e830d){_0x4034bf[_0x003c('0x26')](0x194);}return _0x4e830d;};}function handleError(_0x2ebd4e,_0x4bec19){_0x4bec19=_0x4bec19||0x1f4;return function(_0x43d7bb){logger['error'](_0x43d7bb[_0x003c('0x27')]);if(_0x43d7bb[_0x003c('0x28')]){delete _0x43d7bb[_0x003c('0x28')];}_0x2ebd4e[_0x003c('0x19')](_0x4bec19)[_0x003c('0x29')](_0x43d7bb);};}exports[_0x003c('0x2a')]=function(_0x2cfa4f,_0x3c7361){var _0xc73c7c={},_0x4c37d6={},_0x4e39c0={'count':0x0,'rows':[]};var _0x3f7ae1=_[_0x003c('0x2b')](db[_0x003c('0x2c')][_0x003c('0x2d')],function(_0x1d6777){return{'name':_0x1d6777[_0x003c('0x2e')],'type':_0x1d6777[_0x003c('0x2f')][_0x003c('0x30')]};});_0x4c37d6[_0x003c('0x31')]=_[_0x003c('0x2b')](_0x3f7ae1,_0x003c('0x28'));_0x4c37d6[_0x003c('0x32')]=_[_0x003c('0x33')](_0x2cfa4f[_0x003c('0x32')]);_0x4c37d6['filters']=_[_0x003c('0x34')](_0x4c37d6[_0x003c('0x31')],_0x4c37d6[_0x003c('0x32')]);_0xc73c7c[_0x003c('0x35')]=_[_0x003c('0x34')](_0x4c37d6[_0x003c('0x31')],qs[_0x003c('0x36')](_0x2cfa4f['query'][_0x003c('0x36')]));_0xc73c7c['attributes']=_0xc73c7c['attributes']['length']?_0xc73c7c['attributes']:_0x4c37d6['model'];if(!_0x2cfa4f[_0x003c('0x32')]['hasOwnProperty']('nolimit')){_0xc73c7c[_0x003c('0x1d')]=qs['limit'](_0x2cfa4f[_0x003c('0x32')]['limit']);_0xc73c7c[_0x003c('0x1b')]=qs[_0x003c('0x1b')](_0x2cfa4f['query'][_0x003c('0x1b')]);}_0xc73c7c[_0x003c('0x37')]=qs['sort'](_0x2cfa4f[_0x003c('0x32')][_0x003c('0x38')]);_0xc73c7c[_0x003c('0x39')]=qs[_0x003c('0x3a')](_['pick'](_0x2cfa4f[_0x003c('0x32')],_0x4c37d6[_0x003c('0x3a')]),_0x3f7ae1);if(_0x2cfa4f[_0x003c('0x32')][_0x003c('0x3b')]){_0xc73c7c[_0x003c('0x39')]=_['merge'](_0xc73c7c[_0x003c('0x39')],{'$or':_[_0x003c('0x2b')](_0x3f7ae1,function(_0x2f77f5){if(_0x2f77f5[_0x003c('0x2f')]!=='VIRTUAL'){var _0x524536={};_0x524536[_0x2f77f5[_0x003c('0x28')]]={'$like':'%'+_0x2cfa4f['query'][_0x003c('0x3b')]+'%'};return _0x524536;}})});}_0xc73c7c=_[_0x003c('0x3c')]({},_0xc73c7c,_0x2cfa4f['options']);var _0x5b1489={'where':_0xc73c7c['where']};return db[_0x003c('0x2c')][_0x003c('0x1e')](_0x5b1489)[_0x003c('0x24')](function(_0x47eb5b){_0x4e39c0['count']=_0x47eb5b;if(_0x2cfa4f[_0x003c('0x32')]['includeAll']){_0xc73c7c[_0x003c('0x3d')]=[{'all':!![]}];}return db[_0x003c('0x2c')][_0x003c('0x3e')](_0xc73c7c);})['then'](function(_0x4cda35){_0x4e39c0[_0x003c('0x3f')]=_0x4cda35;return _0x4e39c0;})[_0x003c('0x24')](respondWithFilteredResult(_0x3c7361,_0xc73c7c))['catch'](handleError(_0x3c7361,null));};exports[_0x003c('0x40')]=function(_0x52fc66,_0x37c8ea){var _0xbb6c83={'raw':!![],'where':{'id':_0x52fc66['params']['id']}},_0x47b70d={};_0x47b70d['model']=_['keys'](db[_0x003c('0x2c')][_0x003c('0x2d')]);_0x47b70d['query']=_[_0x003c('0x33')](_0x52fc66[_0x003c('0x32')]);_0x47b70d[_0x003c('0x3a')]=_['intersection'](_0x47b70d[_0x003c('0x31')],_0x47b70d[_0x003c('0x32')]);_0xbb6c83[_0x003c('0x35')]=_[_0x003c('0x34')](_0x47b70d[_0x003c('0x31')],qs[_0x003c('0x36')](_0x52fc66['query'][_0x003c('0x36')]));_0xbb6c83['attributes']=_0xbb6c83[_0x003c('0x35')]['length']?_0xbb6c83[_0x003c('0x35')]:_0x47b70d[_0x003c('0x31')];if(_0x52fc66['query']['includeAll']){_0xbb6c83[_0x003c('0x3d')]=[{'all':!![]}];}_0xbb6c83=_[_0x003c('0x3c')]({},_0xbb6c83,_0x52fc66[_0x003c('0x41')]);return db[_0x003c('0x2c')][_0x003c('0x42')](_0xbb6c83)['then'](handleEntityNotFound(_0x37c8ea,null))[_0x003c('0x24')](respondWithResult(_0x37c8ea,null))[_0x003c('0x43')](handleError(_0x37c8ea,null));};exports[_0x003c('0x44')]=function(_0x67e1c4,_0xf7fd75){return db[_0x003c('0x2c')]['create'](_0x67e1c4[_0x003c('0x45')],{})['then'](respondWithResult(_0xf7fd75,0xc9))[_0x003c('0x43')](handleError(_0xf7fd75,null));};exports['update']=function(_0x51e955,_0x4ea9e3){if(_0x51e955[_0x003c('0x45')]['id']){delete _0x51e955[_0x003c('0x45')]['id'];}return db[_0x003c('0x2c')][_0x003c('0x42')]({'where':{'id':_0x51e955['params']['id']}})[_0x003c('0x24')](handleEntityNotFound(_0x4ea9e3,null))['then'](saveUpdates(_0x51e955[_0x003c('0x45')],null))['then'](respondWithResult(_0x4ea9e3,null))[_0x003c('0x43')](handleError(_0x4ea9e3,null));};exports[_0x003c('0x23')]=function(_0x192c25,_0x5dc057){return db[_0x003c('0x2c')]['find']({'where':{'id':_0x192c25['params']['id']}})['then'](handleEntityNotFound(_0x5dc057,null))[_0x003c('0x24')](removeEntity(_0x5dc057,null))[_0x003c('0x43')](handleError(_0x5dc057,null));};exports['describe']=function(_0x5b1fb3,_0x417098){return db[_0x003c('0x2c')][_0x003c('0x46')]()[_0x003c('0x24')](respondWithResult(_0x417098,null))['catch'](handleError(_0x417098,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6018e0a..40454a1 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 _0x72ea=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3592c3,_0x2528c3){var _0x3aec7d=function(_0x2e5fd6){while(--_0x2e5fd6){_0x3592c3['push'](_0x3592c3['shift']());}};_0x3aec7d(++_0x2528c3);}(_0x72ea,0x1e8));var _0xa72e=function(_0x24c2cc,_0x25dba3){_0x24c2cc=_0x24c2cc-0x0;var _0x2accb4=_0x72ea[_0x24c2cc];return _0x2accb4;};'use strict';var _=require(_0xa72e('0x0'));var util=require(_0xa72e('0x1'));var logger=require(_0xa72e('0x2'))('api');var moment=require(_0xa72e('0x3'));var BPromise=require(_0xa72e('0x4'));var rp=require(_0xa72e('0x5'));var fs=require('fs');var path=require(_0xa72e('0x6'));var rimraf=require(_0xa72e('0x7'));var config=require(_0xa72e('0x8'));var attributes=require(_0xa72e('0x9'));module[_0xa72e('0xa')]=function(_0x9b66ae,_0x55882c){return _0x9b66ae[_0xa72e('0xb')](_0xa72e('0xc'),attributes,{'tableName':_0xa72e('0xd'),'paranoid':![],'indexes':[{'name':_0xa72e('0xe'),'fields':[_0xa72e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x946e=['SmsTransferReport','uniqueid','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x219935,_0x5b7d02){var _0x130409=function(_0x56409e){while(--_0x56409e){_0x219935['push'](_0x219935['shift']());}};_0x130409(++_0x5b7d02);}(_0x946e,0x1d0));var _0xe946=function(_0x3c20c9,_0x49d60c){_0x3c20c9=_0x3c20c9-0x0;var _0x173dc3=_0x946e[_0x3c20c9];return _0x173dc3;};'use strict';var _=require(_0xe946('0x0'));var util=require('util');var logger=require(_0xe946('0x1'))('api');var moment=require(_0xe946('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe946('0x3'));var rimraf=require(_0xe946('0x4'));var config=require(_0xe946('0x5'));var attributes=require(_0xe946('0x6'));module[_0xe946('0x7')]=function(_0x49224a,_0x123d0c){return _0x49224a[_0xe946('0x8')](_0xe946('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe946('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 313b67f..8957dbf 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 _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x131211,_0x5a2248){var _0x114853=function(_0x579ebb){while(--_0x579ebb){_0x131211['push'](_0x131211['shift']());}};_0x114853(++_0x5a2248);}(_0x6737,0xe2));var _0x7673=function(_0x524715,_0x187f5e){_0x524715=_0x524715-0x0;var _0x3a5236=_0x6737[_0x524715];return _0x3a5236;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file +var _0xe107=['then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x3b59e3,_0x251a95){var _0x29752a=function(_0x47f892){while(--_0x47f892){_0x3b59e3['push'](_0x3b59e3['shift']());}};_0x29752a(++_0x251a95);}(_0xe107,0xb3));var _0x7e10=function(_0x211fc2,_0x8115f2){_0x211fc2=_0x211fc2-0x0;var _0x371d7f=_0xe107[_0x211fc2];return _0x371d7f;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var moment=require(_0x7e10('0x1'));var BPromise=require(_0x7e10('0x2'));var rs=require(_0x7e10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e10('0x5'));var config=require(_0x7e10('0x6'));var jayson=require(_0x7e10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd3de,_0x7378b3,_0x156c56){return new BPromise(function(_0x3413f7,_0x493958){return client['request'](_0x1dd3de,_0x156c56)[_0x7e10('0x8')](function(_0x490a7a){logger['info'](_0x7e10('0x9'),_0x7378b3,_0x7e10('0xa'));logger[_0x7e10('0xb')](_0x7e10('0xc'),_0x7378b3,_0x7e10('0xa'),JSON['stringify'](_0x490a7a));if(_0x490a7a[_0x7e10('0xd')]){if(_0x490a7a['error'][_0x7e10('0xe')]===0x1f4){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a['error'][_0x7e10('0xf')]);return _0x493958(_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);}logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);return _0x3413f7(_0x490a7a[_0x7e10('0xd')]['message']);}else{logger[_0x7e10('0x10')](_0x7e10('0x9'),_0x7378b3,'request\x20sent');_0x3413f7(_0x490a7a['result'][_0x7e10('0xf')]);}})['catch'](function(_0xe1abd2){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0xe1abd2);_0x493958(_0xe1abd2);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 713ee6c..94a6ff1 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 _0x4433=['/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','post','file','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./sound.controller','index','get'];(function(_0x9c5119,_0x3516ad){var _0x5a8e29=function(_0x2b83ad){while(--_0x2b83ad){_0x9c5119['push'](_0x9c5119['shift']());}};_0x5a8e29(++_0x3516ad);}(_0x4433,0x1ea));var _0x3443=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4433[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3443('0x0'));var util=require('util');var path=require(_0x3443('0x1'));var timeout=require(_0x3443('0x2'));var express=require(_0x3443('0x3'));var router=express[_0x3443('0x4')]();var fs_extra=require(_0x3443('0x5'));var auth=require(_0x3443('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3443('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3443('0x8')]);router[_0x3443('0x9')](_0x3443('0xa'),auth[_0x3443('0xb')](),controller[_0x3443('0xc')]);router[_0x3443('0x9')](_0x3443('0xd'),auth['isAuthenticated'](),controller[_0x3443('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15d25f,_0x2a6092,_0x2651c1){_0x2651c1(null,path[_0x3443('0xf')](config[_0x3443('0x10')],_0x3443('0x11')));},'filename':function(_0x3d7848,_0x1d3b87,_0x48d9e5){_0x1d3b87[_0x3443('0x12')]=_0x1d3b87[_0x3443('0x12')][_0x3443('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x48d9e5(null,util['format'](_0x3443('0x14'),path['basename'](_0x1d3b87[_0x3443('0x12')],path[_0x3443('0x15')](_0x1d3b87['originalname'])),Date['now'](),path[_0x3443('0x15')](_0x1d3b87[_0x3443('0x12')])));}})});router[_0x3443('0x16')]('/',upload['single'](_0x3443('0x17')),controller['create']);router['put'](_0x3443('0xa'),auth[_0x3443('0xb')](),controller['update']);router['delete']('/:id',auth[_0x3443('0xb')](),controller['delete']);module[_0x3443('0x18')]=router; \ No newline at end of file +var _0xbaca=['download','root','server/files/sounds/original/','originalname','%s-%s%s','basename','extname','now','post','single','put','/:id','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbaca,0x77));var _0xabac=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xbaca[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require(_0xabac('0x0'));var util=require(_0xabac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabac('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xabac('0x3'));var interaction=require(_0xabac('0x4'));var config=require(_0xabac('0x5'));var controller=require(_0xabac('0x6'));router[_0xabac('0x7')]('/',auth[_0xabac('0x8')](),controller['index']);router['get']('/:id',auth[_0xabac('0x8')](),controller[_0xabac('0x9')]);router[_0xabac('0x7')](_0xabac('0xa'),auth[_0xabac('0x8')](),controller[_0xabac('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ad283,_0x32fe5b,_0x32fafb){_0x32fafb(null,path['join'](config[_0xabac('0xc')],_0xabac('0xd')));},'filename':function(_0x5c5f26,_0x2c8c12,_0x530a08){_0x2c8c12['originalname']=_0x2c8c12[_0xabac('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x530a08(null,util['format'](_0xabac('0xf'),path[_0xabac('0x10')](_0x2c8c12['originalname'],path[_0xabac('0x11')](_0x2c8c12['originalname'])),Date[_0xabac('0x12')](),path[_0xabac('0x11')](_0x2c8c12[_0xabac('0xe')])));}})});router[_0xabac('0x13')]('/',upload[_0xabac('0x14')]('file'),controller['create']);router[_0xabac('0x15')](_0xabac('0x16'),auth[_0xabac('0x8')](),controller[_0xabac('0x17')]);router[_0xabac('0x18')]('/:id',auth[_0xabac('0x8')](),controller[_0xabac('0x18')]);module[_0xabac('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5cfc50c..42a3003 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 _0x2a07=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x427696,_0x1e2673){var _0x19c611=function(_0x5cf1f4){while(--_0x5cf1f4){_0x427696['push'](_0x427696['shift']());}};_0x19c611(++_0x1e2673);}(_0x2a07,0x78));var _0x72a0=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x2a07[_0x2431d6];return _0x4d0f9b;};'use strict';var Sequelize=require(_0x72a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x72a0('0x1')],'unique':_0x72a0('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x72a0('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x72a0('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x72a0('0x3')]},'original_sampleCount':{'type':Sequelize[_0x72a0('0x4')]},'original_channelCount':{'type':Sequelize[_0x72a0('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x72a0('0x5')]},'converted_format':{'type':Sequelize[_0x72a0('0x1')]},'converted_duration':{'type':Sequelize[_0x72a0('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x72a0('0x4')]},'converted_channelCount':{'type':Sequelize[_0x72a0('0x5')]},'converted_bitRate':{'type':Sequelize[_0x72a0('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x72a0('0x5')]}}; \ No newline at end of file +var _0x87fe=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x22836a,_0x55b420){var _0x119db9=function(_0x40008b){while(--_0x40008b){_0x22836a['push'](_0x22836a['shift']());}};_0x119db9(++_0x55b420);}(_0x87fe,0x1b6));var _0xe87f=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0x87fe[_0x562cd7];return _0x30f50d;};'use strict';var Sequelize=require(_0xe87f('0x0'));module[_0xe87f('0x1')]={'name':{'type':Sequelize[_0xe87f('0x2')],'unique':_0xe87f('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe87f('0x2')]},'display_name':{'type':Sequelize[_0xe87f('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xe87f('0x2')]},'original_duration':{'type':Sequelize[_0xe87f('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xe87f('0x5')]},'original_sampleRate':{'type':Sequelize[_0xe87f('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xe87f('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xe87f('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8052037..f672c08 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 _0x1f13=['Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','sendStatus','stack','name','send','map','Sound','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x1f13,0xad));var _0x31f1=function(_0x19c901,_0x2155d9){_0x19c901=_0x19c901-0x0;var _0x504f35=_0x1f13[_0x19c901];return _0x504f35;};'use strict';var emlformat=require(_0x31f1('0x0'));var rimraf=require(_0x31f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31f1('0x2'));var rp=require(_0x31f1('0x3'));var moment=require(_0x31f1('0x4'));var BPromise=require(_0x31f1('0x5'));var Mustache=require(_0x31f1('0x6'));var util=require(_0x31f1('0x7'));var path=require(_0x31f1('0x8'));var sox=require(_0x31f1('0x9'));var csv=require(_0x31f1('0xa'));var ejs=require(_0x31f1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31f1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x31f1('0xd'));var toCsv=require(_0x31f1('0xa'));var querystring=require(_0x31f1('0xe'));var Papa=require(_0x31f1('0xf'));var Redis=require(_0x31f1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x31f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31f1('0x12'))(_0x31f1('0x13'));var utils=require(_0x31f1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x31f1('0x15'));var db=require(_0x31f1('0x16'))['db'];function respondWithStatusCode(_0x2ce565,_0x988548){_0x988548=_0x988548||0xcc;return function(_0x19b28d){if(_0x19b28d){return _0x2ce565['sendStatus'](_0x988548);}return _0x2ce565['status'](_0x988548)[_0x31f1('0x17')]();};}function respondWithResult(_0x34e325,_0x547dba){_0x547dba=_0x547dba||0xc8;return function(_0x176b30){if(_0x176b30){return _0x34e325[_0x31f1('0x18')](_0x547dba)['json'](_0x176b30);}};}function respondWithFilteredResult(_0x5bdfa7,_0x54857c){return function(_0x3ec5bf){if(_0x3ec5bf){var _0x45af47=typeof _0x54857c[_0x31f1('0x19')]==='undefined'&&typeof _0x54857c[_0x31f1('0x1a')]===_0x31f1('0x1b');var _0xc9041c=_0x3ec5bf[_0x31f1('0x1c')];var _0xec7f5a=_0x45af47?0x0:_0x54857c[_0x31f1('0x19')];var _0xd731d0=_0x45af47?_0x3ec5bf['count']:_0x54857c[_0x31f1('0x19')]+_0x54857c['limit'];var _0x535737;if(_0xd731d0>=_0xc9041c){_0xd731d0=_0xc9041c;_0x535737=0xc8;}else{_0x535737=0xce;}_0x5bdfa7['status'](_0x535737);return _0x5bdfa7[_0x31f1('0x1d')]('Content-Range',_0xec7f5a+'-'+_0xd731d0+'/'+_0xc9041c)['json'](_0x3ec5bf);}return null;};}function patchUpdates(_0x5d169e){return function(_0x2e9f98){try{jsonpatch[_0x31f1('0x1e')](_0x2e9f98,_0x5d169e,!![]);}catch(_0x2a4d99){return BPromise[_0x31f1('0x1f')](_0x2a4d99);}return _0x2e9f98[_0x31f1('0x20')]();};}function saveUpdates(_0x55853d,_0x19f292){return function(_0xed9c6f){if(_0xed9c6f){return _0xed9c6f['update'](_0x55853d)[_0x31f1('0x21')](function(_0x3e9d8f){return _0x3e9d8f;});}return null;};}function removeEntity(_0x162326,_0x5634d2){return function(_0x58b144){if(_0x58b144){return _0x58b144[_0x31f1('0x22')]()[_0x31f1('0x21')](function(){var _0xf05d5b=_0x58b144[_0x31f1('0x23')]({'plain':!![]});var _0x316027=_0x31f1('0x24');return db[_0x31f1('0x25')]['destroy']({'where':{'type':_0x316027,'resourceId':_0xf05d5b['id']}})['then'](function(){return _0x58b144;});})[_0x31f1('0x21')](function(){_0x162326['status'](0xcc)[_0x31f1('0x17')]();});}};}function handleEntityNotFound(_0x1af922,_0x2a3156){return function(_0x2d7c21){if(!_0x2d7c21){_0x1af922[_0x31f1('0x26')](0x194);}return _0x2d7c21;};}function handleError(_0x5ef1db,_0x1c6b54){_0x1c6b54=_0x1c6b54||0x1f4;return function(_0x107fef){logger['error'](_0x107fef[_0x31f1('0x27')]);if(_0x107fef[_0x31f1('0x28')]){delete _0x107fef[_0x31f1('0x28')];}_0x5ef1db['status'](_0x1c6b54)[_0x31f1('0x29')](_0x107fef);};}exports['index']=function(_0x62ac15,_0x12d236){var _0xba5087={},_0x195ad5={},_0x51bd42={'count':0x0,'rows':[]};var _0x2ca27f=_[_0x31f1('0x2a')](db[_0x31f1('0x2b')][_0x31f1('0x2c')],function(_0x130a8f){return{'name':_0x130a8f['fieldName'],'type':_0x130a8f[_0x31f1('0x2d')]['key']};});_0x195ad5[_0x31f1('0x2e')]=_[_0x31f1('0x2a')](_0x2ca27f,_0x31f1('0x28'));_0x195ad5[_0x31f1('0x2f')]=_['keys'](_0x62ac15[_0x31f1('0x2f')]);_0x195ad5[_0x31f1('0x30')]=_[_0x31f1('0x31')](_0x195ad5[_0x31f1('0x2e')],_0x195ad5[_0x31f1('0x2f')]);_0xba5087[_0x31f1('0x32')]=_[_0x31f1('0x31')](_0x195ad5['model'],qs[_0x31f1('0x33')](_0x62ac15[_0x31f1('0x2f')][_0x31f1('0x33')]));_0xba5087['attributes']=_0xba5087[_0x31f1('0x32')][_0x31f1('0x34')]?_0xba5087[_0x31f1('0x32')]:_0x195ad5[_0x31f1('0x2e')];if(!_0x62ac15['query']['hasOwnProperty'](_0x31f1('0x35'))){_0xba5087[_0x31f1('0x1a')]=qs[_0x31f1('0x1a')](_0x62ac15[_0x31f1('0x2f')]['limit']);_0xba5087[_0x31f1('0x19')]=qs['offset'](_0x62ac15[_0x31f1('0x2f')][_0x31f1('0x19')]);}_0xba5087[_0x31f1('0x36')]=qs[_0x31f1('0x37')](_0x62ac15[_0x31f1('0x2f')][_0x31f1('0x37')]);_0xba5087['where']=qs[_0x31f1('0x30')](_[_0x31f1('0x38')](_0x62ac15[_0x31f1('0x2f')],_0x195ad5['filters']),_0x2ca27f);if(_0x62ac15[_0x31f1('0x2f')]['filter']){_0xba5087[_0x31f1('0x39')]=_[_0x31f1('0x3a')](_0xba5087[_0x31f1('0x39')],{'$or':_['map'](_0x2ca27f,function(_0x1a79aa){if(_0x1a79aa[_0x31f1('0x2d')]!==_0x31f1('0x3b')){var _0x43ca17={};_0x43ca17[_0x1a79aa[_0x31f1('0x28')]]={'$like':'%'+_0x62ac15[_0x31f1('0x2f')][_0x31f1('0x3c')]+'%'};return _0x43ca17;}})});}_0xba5087=_[_0x31f1('0x3a')]({},_0xba5087,_0x62ac15[_0x31f1('0x3d')]);var _0x50e0be={'where':_0xba5087['where']};return db['Sound'][_0x31f1('0x1c')](_0x50e0be)[_0x31f1('0x21')](function(_0x342dda){_0x51bd42[_0x31f1('0x1c')]=_0x342dda;if(_0x62ac15[_0x31f1('0x2f')][_0x31f1('0x3e')]){_0xba5087[_0x31f1('0x3f')]=[{'all':!![]}];}return db[_0x31f1('0x2b')][_0x31f1('0x40')](_0xba5087);})[_0x31f1('0x21')](function(_0x41b5ed){_0x51bd42[_0x31f1('0x41')]=_0x41b5ed;return _0x51bd42;})[_0x31f1('0x21')](respondWithFilteredResult(_0x12d236,_0xba5087))[_0x31f1('0x42')](handleError(_0x12d236,null));};exports[_0x31f1('0x43')]=function(_0x387beb,_0x540bf0){var _0xc0a621={'raw':!![],'where':{'id':_0x387beb[_0x31f1('0x44')]['id']}},_0x2ae158={};_0x2ae158[_0x31f1('0x2e')]=_[_0x31f1('0x45')](db[_0x31f1('0x2b')][_0x31f1('0x2c')]);_0x2ae158['query']=_[_0x31f1('0x45')](_0x387beb[_0x31f1('0x2f')]);_0x2ae158[_0x31f1('0x30')]=_[_0x31f1('0x31')](_0x2ae158['model'],_0x2ae158[_0x31f1('0x2f')]);_0xc0a621[_0x31f1('0x32')]=_[_0x31f1('0x31')](_0x2ae158[_0x31f1('0x2e')],qs['fields'](_0x387beb[_0x31f1('0x2f')]['fields']));_0xc0a621[_0x31f1('0x32')]=_0xc0a621[_0x31f1('0x32')]['length']?_0xc0a621[_0x31f1('0x32')]:_0x2ae158[_0x31f1('0x2e')];if(_0x387beb[_0x31f1('0x2f')][_0x31f1('0x3e')]){_0xc0a621['include']=[{'all':!![]}];}_0xc0a621=_[_0x31f1('0x3a')]({},_0xc0a621,_0x387beb['options']);return db['Sound'][_0x31f1('0x46')](_0xc0a621)['then'](handleEntityNotFound(_0x540bf0,null))[_0x31f1('0x21')](respondWithResult(_0x540bf0,null))[_0x31f1('0x42')](handleError(_0x540bf0,null));};exports[_0x31f1('0x47')]=function(_0x228b8b,_0x2c8437,_0x19c092){return db[_0x31f1('0x2b')][_0x31f1('0x46')]({'where':{'id':_0x228b8b[_0x31f1('0x44')]['id']},'attributes':[_0x31f1('0x28'),_0x31f1('0x48'),_0x31f1('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x2c8437,null))[_0x31f1('0x21')](function(_0x4533e3){if(_0x4533e3){if(!fs[_0x31f1('0x4a')](path['join'](config[_0x31f1('0x4b')],_0x31f1('0x4c'),_0x4533e3[_0x31f1('0x48')]+'.'+_0x4533e3[_0x31f1('0x49')]))){throw new db[(_0x31f1('0x4d'))][(_0x31f1('0x4e'))](_0x31f1('0x4f'));}return _0x2c8437[_0x31f1('0x47')](path[_0x31f1('0x50')](config['root'],_0x31f1('0x4c'),util[_0x31f1('0x51')](_0x31f1('0x52'),_0x4533e3['save_name'],_0x4533e3[_0x31f1('0x49')])),util[_0x31f1('0x51')](_0x31f1('0x52'),_0x4533e3[_0x31f1('0x28')],_0x4533e3[_0x31f1('0x49')]));}return null;})['catch'](handleError(_0x2c8437,null));};exports[_0x31f1('0x53')]=function(_0x57311c,_0x1f0f03,_0x5ee69b){var _0x33b937={'name':path['basename'](_0x57311c[_0x31f1('0x54')][_0x31f1('0x55')],path['extname'](_0x57311c[_0x31f1('0x54')][_0x31f1('0x55')])),'save_name':path['basename'](_0x57311c[_0x31f1('0x54')][_0x31f1('0x56')],path[_0x31f1('0x57')](_0x57311c[_0x31f1('0x54')][_0x31f1('0x56')])),'original_format':path['extname'](_0x57311c[_0x31f1('0x54')][_0x31f1('0x55')])[_0x31f1('0x58')](0x1),'converted_format':'wav'};var _0x4c2d1b=path[_0x31f1('0x50')](config[_0x31f1('0x4b')],_0x31f1('0x59'),_0x57311c[_0x31f1('0x54')]['filename']);var _0x4ed271=path['join'](config[_0x31f1('0x4b')],_0x31f1('0x4c'),util[_0x31f1('0x51')](_0x31f1('0x52'),path['basename'](_0x57311c[_0x31f1('0x54')]['filename'],path[_0x31f1('0x57')](_0x57311c['file'][_0x31f1('0x56')])),_0x33b937[_0x31f1('0x49')]));logger[_0x31f1('0x5a')](_0x31f1('0x5b'),_0x4c2d1b);logger[_0x31f1('0x5a')](_0x31f1('0x5c'),_0x4ed271);try{fs[_0x31f1('0x5d')](_0x4c2d1b,parseInt(_0x31f1('0x5e'),0x8));var _0x521b96=sox[_0x31f1('0x5f')](_0x4c2d1b,_0x4ed271,{'sampleRate':0x1f40,'format':_0x31f1('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x521b96['on'](_0x31f1('0x61'),function(_0x26f7a0){fs[_0x31f1('0x62')](_0x4c2d1b);_0x1f0f03[_0x31f1('0x18')](0x1f4)[_0x31f1('0x29')](_0x26f7a0);});_0x521b96['on'](_0x31f1('0x63'),function(_0x2c76e2){_0x33b937[_0x31f1('0x64')]=isNaN(_0x2c76e2[_0x31f1('0x65')])?null:_0x2c76e2[_0x31f1('0x65')]*0x3e8;_0x33b937[_0x31f1('0x66')]=isNaN(_0x2c76e2['sampleCount'])?null:_0x2c76e2[_0x31f1('0x67')];_0x33b937[_0x31f1('0x68')]=isNaN(_0x2c76e2[_0x31f1('0x69')])?null:_0x2c76e2[_0x31f1('0x69')];_0x33b937[_0x31f1('0x6a')]=isNaN(_0x2c76e2[_0x31f1('0x6b')])?null:_0x2c76e2[_0x31f1('0x6b')];_0x33b937[_0x31f1('0x6c')]=isNaN(_0x2c76e2[_0x31f1('0x6d')])?null:_0x2c76e2['sampleRate'];});_0x521b96['on'](_0x31f1('0x6e'),function(_0x266760){_0x33b937[_0x31f1('0x6f')]=isNaN(_0x266760[_0x31f1('0x65')])?null:_0x266760['duration']*0x3e8;_0x33b937['converted_sampleCount']=isNaN(_0x266760[_0x31f1('0x67')])?null:_0x266760[_0x31f1('0x67')];_0x33b937[_0x31f1('0x70')]=isNaN(_0x266760[_0x31f1('0x69')])?null:_0x266760[_0x31f1('0x69')];_0x33b937['converted_bitRate']=isNaN(_0x266760['bitRate'])?null:_0x266760[_0x31f1('0x6b')];_0x33b937[_0x31f1('0x71')]=isNaN(_0x266760['sampleRate'])?null:_0x266760[_0x31f1('0x6d')];});_0x521b96['on']('end',function(){fs[_0x31f1('0x5d')](_0x4ed271,parseInt(_0x31f1('0x5e'),0x8));return db[_0x31f1('0x2b')][_0x31f1('0x53')](_0x33b937)[_0x31f1('0x21')](function(_0x446b8){var _0x178f5d={'role':_0x57311c[_0x31f1('0x72')][_0x31f1('0x73')],'userProfileId':_0x57311c[_0x31f1('0x72')][_0x31f1('0x74')]};if(!_0x178f5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x178f5d['role']===_0x31f1('0x75')){var _0x52916b=_0x446b8[_0x31f1('0x23')]({'plain':!![]});return db[_0x31f1('0x76')]['find']({'where':{'name':_0x31f1('0x24'),'userProfileId':_0x178f5d[_0x31f1('0x74')]},'raw':!![]})[_0x31f1('0x21')](function(_0x467ae4){if(_0x467ae4&&_0x467ae4[_0x31f1('0x77')]===0x0){return db['UserProfileResource'][_0x31f1('0x53')]({'name':_0x52916b[_0x31f1('0x28')],'resourceId':_0x52916b['id'],'type':_0x467ae4[_0x31f1('0x28')],'sectionId':_0x467ae4['id']},{})['then'](function(){return _0x446b8;});}else{return _0x446b8;}})[_0x31f1('0x42')](function(_0x4924ce){logger[_0x31f1('0x61')](_0x31f1('0x78'),_0x4924ce);throw _0x4924ce;});}return _0x446b8;})[_0x31f1('0x21')](respondWithResult(_0x1f0f03,null))[_0x31f1('0x42')](handleError(_0x1f0f03,null));});_0x521b96[_0x31f1('0x79')]();}catch(_0xaa94fc){_0x1f0f03['status'](0x1f4)[_0x31f1('0x29')](_0xaa94fc);}};exports['update']=function(_0x955e7b,_0x51dfc6,_0x1f555f){return db[_0x31f1('0x2b')][_0x31f1('0x46')]({'where':{'id':_0x955e7b[_0x31f1('0x44')]['id']}})[_0x31f1('0x21')](handleEntityNotFound(_0x51dfc6,null))[_0x31f1('0x21')](saveUpdates(_[_0x31f1('0x38')](_0x955e7b[_0x31f1('0x72')],['name',_0x31f1('0x7a')]),null))[_0x31f1('0x21')](respondWithResult(_0x51dfc6,null))[_0x31f1('0x42')](handleError(_0x51dfc6,null));};exports[_0x31f1('0x7b')]=function(_0x186671,_0x281f8b,_0x580fe0){return db['Sound']['find']({'where':{'id':_0x186671[_0x31f1('0x44')]['id']}})['then'](function(_0x55ec4e){if(_0x55ec4e){return _0x55ec4e[_0x31f1('0x22')]();}})[_0x31f1('0x21')](function(_0x181bc0){var _0x3c3c51=path[_0x31f1('0x50')](config[_0x31f1('0x4b')],_0x31f1('0x59'),util[_0x31f1('0x51')]('%s.%s',_0x181bc0[_0x31f1('0x48')],_0x181bc0[_0x31f1('0x7c')]));var _0x34aafb=path['join'](config['root'],_0x31f1('0x4c'),util[_0x31f1('0x51')](_0x31f1('0x52'),_0x181bc0[_0x31f1('0x48')],_0x181bc0['converted_format']));fs[_0x31f1('0x62')](_0x3c3c51);fs['unlinkSync'](_0x34aafb);return _0x181bc0;})[_0x31f1('0x21')](function(_0x2e089b){if(_0x2e089b){return _0x281f8b['status'](0xcc)[_0x31f1('0x17')]();}})[_0x31f1('0x21')](handleEntityNotFound(_0x281f8b,null))[_0x31f1('0x42')](handleError(_0x281f8b,null));}; \ No newline at end of file +var _0xdad6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','download','converted_format','root','save_name','Sequelize','ValidationError','Sound\x20not\x20found','join','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','filename','extname','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','delete','destroy','server/files/sounds/original'];(function(_0x4d0221,_0x46376e){var _0x251f52=function(_0x183634){while(--_0x183634){_0x4d0221['push'](_0x4d0221['shift']());}};_0x251f52(++_0x46376e);}(_0xdad6,0x189));var _0x6dad=function(_0x6c266c,_0x33bcc5){_0x6c266c=_0x6c266c-0x0;var _0x4fca1b=_0xdad6[_0x6c266c];return _0x4fca1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dad('0x0'));var zipdir=require(_0x6dad('0x1'));var jsonpatch=require(_0x6dad('0x2'));var rp=require(_0x6dad('0x3'));var moment=require(_0x6dad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6dad('0x5'));var util=require(_0x6dad('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6dad('0x7'));var ejs=require(_0x6dad('0x8'));var fs=require('fs');var fs_extra=require(_0x6dad('0x9'));var _=require(_0x6dad('0xa'));var squel=require(_0x6dad('0xb'));var crypto=require(_0x6dad('0xc'));var jsforce=require(_0x6dad('0xd'));var deskjs=require(_0x6dad('0xe'));var toCsv=require(_0x6dad('0x7'));var querystring=require(_0x6dad('0xf'));var Papa=require(_0x6dad('0x10'));var Redis=require(_0x6dad('0x11'));var authService=require(_0x6dad('0x12'));var qs=require(_0x6dad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dad('0x14'));var logger=require(_0x6dad('0x15'))(_0x6dad('0x16'));var utils=require(_0x6dad('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6dad('0x18'));var db=require(_0x6dad('0x19'))['db'];function respondWithStatusCode(_0x4e1278,_0x290bc2){_0x290bc2=_0x290bc2||0xcc;return function(_0x562550){if(_0x562550){return _0x4e1278['sendStatus'](_0x290bc2);}return _0x4e1278[_0x6dad('0x1a')](_0x290bc2)['end']();};}function respondWithResult(_0x12d9bd,_0x32d76d){_0x32d76d=_0x32d76d||0xc8;return function(_0x3c10dc){if(_0x3c10dc){return _0x12d9bd['status'](_0x32d76d)[_0x6dad('0x1b')](_0x3c10dc);}};}function respondWithFilteredResult(_0x1791d5,_0x241bd9){return function(_0x440125){if(_0x440125){var _0xa6f208=typeof _0x241bd9[_0x6dad('0x1c')]===_0x6dad('0x1d')&&typeof _0x241bd9['limit']===_0x6dad('0x1d');var _0x27e32c=_0x440125[_0x6dad('0x1e')];var _0x2a55ef=_0xa6f208?0x0:_0x241bd9['offset'];var _0x3280f0=_0xa6f208?_0x440125['count']:_0x241bd9[_0x6dad('0x1c')]+_0x241bd9['limit'];var _0x2ef225;if(_0x3280f0>=_0x27e32c){_0x3280f0=_0x27e32c;_0x2ef225=0xc8;}else{_0x2ef225=0xce;}_0x1791d5['status'](_0x2ef225);return _0x1791d5[_0x6dad('0x1f')](_0x6dad('0x20'),_0x2a55ef+'-'+_0x3280f0+'/'+_0x27e32c)['json'](_0x440125);}return null;};}function patchUpdates(_0x1caf86){return function(_0x5a8f34){try{jsonpatch[_0x6dad('0x21')](_0x5a8f34,_0x1caf86,!![]);}catch(_0x370676){return BPromise[_0x6dad('0x22')](_0x370676);}return _0x5a8f34[_0x6dad('0x23')]();};}function saveUpdates(_0x3c682f,_0x14bee9){return function(_0x4c9f74){if(_0x4c9f74){return _0x4c9f74[_0x6dad('0x24')](_0x3c682f)[_0x6dad('0x25')](function(_0xd8d647){return _0xd8d647;});}return null;};}function removeEntity(_0x5c5470,_0x4a1dc8){return function(_0xe0a84d){if(_0xe0a84d){return _0xe0a84d['destroy']()['then'](function(){var _0x562f63=_0xe0a84d['get']({'plain':!![]});var _0x15b97b=_0x6dad('0x26');return db[_0x6dad('0x27')]['destroy']({'where':{'type':_0x15b97b,'resourceId':_0x562f63['id']}})[_0x6dad('0x25')](function(){return _0xe0a84d;});})[_0x6dad('0x25')](function(){_0x5c5470[_0x6dad('0x1a')](0xcc)[_0x6dad('0x28')]();});}};}function handleEntityNotFound(_0x188655,_0x39c8be){return function(_0x53a275){if(!_0x53a275){_0x188655[_0x6dad('0x29')](0x194);}return _0x53a275;};}function handleError(_0xf32baf,_0x1941ce){_0x1941ce=_0x1941ce||0x1f4;return function(_0x28e2a6){logger[_0x6dad('0x2a')](_0x28e2a6[_0x6dad('0x2b')]);if(_0x28e2a6[_0x6dad('0x2c')]){delete _0x28e2a6[_0x6dad('0x2c')];}_0xf32baf[_0x6dad('0x1a')](_0x1941ce)[_0x6dad('0x2d')](_0x28e2a6);};}exports[_0x6dad('0x2e')]=function(_0x4802fe,_0x5069f6){var _0x53ce37={},_0xe60f8f={},_0x554491={'count':0x0,'rows':[]};var _0x55cb24=_[_0x6dad('0x2f')](db[_0x6dad('0x30')][_0x6dad('0x31')],function(_0x3d9b55){return{'name':_0x3d9b55[_0x6dad('0x32')],'type':_0x3d9b55[_0x6dad('0x33')][_0x6dad('0x34')]};});_0xe60f8f[_0x6dad('0x35')]=_[_0x6dad('0x2f')](_0x55cb24,_0x6dad('0x2c'));_0xe60f8f[_0x6dad('0x36')]=_[_0x6dad('0x37')](_0x4802fe[_0x6dad('0x36')]);_0xe60f8f[_0x6dad('0x38')]=_[_0x6dad('0x39')](_0xe60f8f[_0x6dad('0x35')],_0xe60f8f[_0x6dad('0x36')]);_0x53ce37[_0x6dad('0x3a')]=_[_0x6dad('0x39')](_0xe60f8f[_0x6dad('0x35')],qs[_0x6dad('0x3b')](_0x4802fe[_0x6dad('0x36')][_0x6dad('0x3b')]));_0x53ce37['attributes']=_0x53ce37[_0x6dad('0x3a')][_0x6dad('0x3c')]?_0x53ce37[_0x6dad('0x3a')]:_0xe60f8f[_0x6dad('0x35')];if(!_0x4802fe[_0x6dad('0x36')][_0x6dad('0x3d')]('nolimit')){_0x53ce37[_0x6dad('0x3e')]=qs[_0x6dad('0x3e')](_0x4802fe['query'][_0x6dad('0x3e')]);_0x53ce37['offset']=qs['offset'](_0x4802fe[_0x6dad('0x36')][_0x6dad('0x1c')]);}_0x53ce37[_0x6dad('0x3f')]=qs[_0x6dad('0x40')](_0x4802fe['query'][_0x6dad('0x40')]);_0x53ce37[_0x6dad('0x41')]=qs[_0x6dad('0x38')](_['pick'](_0x4802fe[_0x6dad('0x36')],_0xe60f8f[_0x6dad('0x38')]),_0x55cb24);if(_0x4802fe[_0x6dad('0x36')][_0x6dad('0x42')]){_0x53ce37[_0x6dad('0x41')]=_['merge'](_0x53ce37[_0x6dad('0x41')],{'$or':_[_0x6dad('0x2f')](_0x55cb24,function(_0x514306){if(_0x514306[_0x6dad('0x33')]!==_0x6dad('0x43')){var _0x3643b3={};_0x3643b3[_0x514306[_0x6dad('0x2c')]]={'$like':'%'+_0x4802fe['query'][_0x6dad('0x42')]+'%'};return _0x3643b3;}})});}_0x53ce37=_['merge']({},_0x53ce37,_0x4802fe[_0x6dad('0x44')]);var _0x52b070={'where':_0x53ce37[_0x6dad('0x41')]};return db[_0x6dad('0x30')][_0x6dad('0x1e')](_0x52b070)['then'](function(_0x3bd6ad){_0x554491[_0x6dad('0x1e')]=_0x3bd6ad;if(_0x4802fe[_0x6dad('0x36')]['includeAll']){_0x53ce37[_0x6dad('0x45')]=[{'all':!![]}];}return db['Sound'][_0x6dad('0x46')](_0x53ce37);})['then'](function(_0x4523be){_0x554491[_0x6dad('0x47')]=_0x4523be;return _0x554491;})['then'](respondWithFilteredResult(_0x5069f6,_0x53ce37))[_0x6dad('0x48')](handleError(_0x5069f6,null));};exports[_0x6dad('0x49')]=function(_0x5a0878,_0x41c0d7){var _0xc6f852={'raw':!![],'where':{'id':_0x5a0878[_0x6dad('0x4a')]['id']}},_0x2f59f1={};_0x2f59f1['model']=_[_0x6dad('0x37')](db['Sound']['rawAttributes']);_0x2f59f1['query']=_[_0x6dad('0x37')](_0x5a0878[_0x6dad('0x36')]);_0x2f59f1['filters']=_['intersection'](_0x2f59f1[_0x6dad('0x35')],_0x2f59f1[_0x6dad('0x36')]);_0xc6f852[_0x6dad('0x3a')]=_['intersection'](_0x2f59f1[_0x6dad('0x35')],qs[_0x6dad('0x3b')](_0x5a0878[_0x6dad('0x36')][_0x6dad('0x3b')]));_0xc6f852[_0x6dad('0x3a')]=_0xc6f852[_0x6dad('0x3a')]['length']?_0xc6f852['attributes']:_0x2f59f1[_0x6dad('0x35')];if(_0x5a0878[_0x6dad('0x36')][_0x6dad('0x4b')]){_0xc6f852[_0x6dad('0x45')]=[{'all':!![]}];}_0xc6f852=_[_0x6dad('0x4c')]({},_0xc6f852,_0x5a0878[_0x6dad('0x44')]);return db['Sound'][_0x6dad('0x4d')](_0xc6f852)[_0x6dad('0x25')](handleEntityNotFound(_0x41c0d7,null))[_0x6dad('0x25')](respondWithResult(_0x41c0d7,null))[_0x6dad('0x48')](handleError(_0x41c0d7,null));};exports[_0x6dad('0x4e')]=function(_0x322818,_0xe45ac3,_0x1ffc46){return db['Sound'][_0x6dad('0x4d')]({'where':{'id':_0x322818['params']['id']},'attributes':[_0x6dad('0x2c'),'save_name',_0x6dad('0x4f')],'raw':!![]})[_0x6dad('0x25')](handleEntityNotFound(_0xe45ac3,null))[_0x6dad('0x25')](function(_0x795666){if(_0x795666){if(!fs['existsSync'](path['join'](config[_0x6dad('0x50')],'server/files/sounds/converted',_0x795666[_0x6dad('0x51')]+'.'+_0x795666[_0x6dad('0x4f')]))){throw new db[(_0x6dad('0x52'))][(_0x6dad('0x53'))](_0x6dad('0x54'));}return _0xe45ac3[_0x6dad('0x4e')](path[_0x6dad('0x55')](config[_0x6dad('0x50')],_0x6dad('0x56'),util[_0x6dad('0x57')](_0x6dad('0x58'),_0x795666[_0x6dad('0x51')],_0x795666['converted_format'])),util[_0x6dad('0x57')](_0x6dad('0x58'),_0x795666['name'],_0x795666['converted_format']));}return null;})[_0x6dad('0x48')](handleError(_0xe45ac3,null));};exports[_0x6dad('0x59')]=function(_0x37b45f,_0x539574,_0x37b844){var _0x33a90f={'name':path[_0x6dad('0x5a')](_0x37b45f['file']['originalname'],path['extname'](_0x37b45f[_0x6dad('0x5b')][_0x6dad('0x5c')])),'save_name':path[_0x6dad('0x5a')](_0x37b45f[_0x6dad('0x5b')][_0x6dad('0x5d')],path[_0x6dad('0x5e')](_0x37b45f[_0x6dad('0x5b')][_0x6dad('0x5d')])),'original_format':path[_0x6dad('0x5e')](_0x37b45f[_0x6dad('0x5b')]['originalname'])[_0x6dad('0x5f')](0x1),'converted_format':'wav'};var _0x5d4bac=path[_0x6dad('0x55')](config[_0x6dad('0x50')],'server/files/sounds/original',_0x37b45f[_0x6dad('0x5b')][_0x6dad('0x5d')]);var _0x5b6c74=path[_0x6dad('0x55')](config['root'],_0x6dad('0x56'),util['format'](_0x6dad('0x58'),path['basename'](_0x37b45f[_0x6dad('0x5b')][_0x6dad('0x5d')],path['extname'](_0x37b45f[_0x6dad('0x5b')][_0x6dad('0x5d')])),_0x33a90f[_0x6dad('0x4f')]));logger[_0x6dad('0x60')](_0x6dad('0x61'),_0x5d4bac);logger[_0x6dad('0x60')](_0x6dad('0x62'),_0x5b6c74);try{fs['chmodSync'](_0x5d4bac,parseInt(_0x6dad('0x63'),0x8));var _0x3c4d60=sox['transcode'](_0x5d4bac,_0x5b6c74,{'sampleRate':0x1f40,'format':_0x6dad('0x64'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c4d60['on'](_0x6dad('0x2a'),function(_0x27d1a1){fs[_0x6dad('0x65')](_0x5d4bac);_0x539574[_0x6dad('0x1a')](0x1f4)[_0x6dad('0x2d')](_0x27d1a1);});_0x3c4d60['on'](_0x6dad('0x66'),function(_0x5e2c56){_0x33a90f[_0x6dad('0x67')]=isNaN(_0x5e2c56[_0x6dad('0x68')])?null:_0x5e2c56['duration']*0x3e8;_0x33a90f[_0x6dad('0x69')]=isNaN(_0x5e2c56[_0x6dad('0x6a')])?null:_0x5e2c56[_0x6dad('0x6a')];_0x33a90f[_0x6dad('0x6b')]=isNaN(_0x5e2c56[_0x6dad('0x6c')])?null:_0x5e2c56['channelCount'];_0x33a90f['original_bitRate']=isNaN(_0x5e2c56[_0x6dad('0x6d')])?null:_0x5e2c56[_0x6dad('0x6d')];_0x33a90f[_0x6dad('0x6e')]=isNaN(_0x5e2c56['sampleRate'])?null:_0x5e2c56[_0x6dad('0x6f')];});_0x3c4d60['on']('dest',function(_0x57b29d){_0x33a90f[_0x6dad('0x70')]=isNaN(_0x57b29d['duration'])?null:_0x57b29d[_0x6dad('0x68')]*0x3e8;_0x33a90f[_0x6dad('0x71')]=isNaN(_0x57b29d[_0x6dad('0x6a')])?null:_0x57b29d['sampleCount'];_0x33a90f[_0x6dad('0x72')]=isNaN(_0x57b29d[_0x6dad('0x6c')])?null:_0x57b29d[_0x6dad('0x6c')];_0x33a90f[_0x6dad('0x73')]=isNaN(_0x57b29d['bitRate'])?null:_0x57b29d['bitRate'];_0x33a90f[_0x6dad('0x74')]=isNaN(_0x57b29d[_0x6dad('0x6f')])?null:_0x57b29d['sampleRate'];});_0x3c4d60['on'](_0x6dad('0x28'),function(){fs[_0x6dad('0x75')](_0x5b6c74,parseInt(_0x6dad('0x63'),0x8));return db['Sound'][_0x6dad('0x59')](_0x33a90f)[_0x6dad('0x25')](function(_0x3c9e25){var _0x20a694={'role':_0x37b45f[_0x6dad('0x76')]['role'],'userProfileId':_0x37b45f[_0x6dad('0x76')][_0x6dad('0x77')]};if(!_0x20a694)throw new Error(_0x6dad('0x78'));if(_0x20a694[_0x6dad('0x79')]===_0x6dad('0x7a')){var _0x5e171e=_0x3c9e25['get']({'plain':!![]});return db[_0x6dad('0x7b')][_0x6dad('0x4d')]({'where':{'name':_0x6dad('0x26'),'userProfileId':_0x20a694[_0x6dad('0x77')]},'raw':!![]})[_0x6dad('0x25')](function(_0x544a76){if(_0x544a76&&_0x544a76[_0x6dad('0x7c')]===0x0){return db['UserProfileResource'][_0x6dad('0x59')]({'name':_0x5e171e[_0x6dad('0x2c')],'resourceId':_0x5e171e['id'],'type':_0x544a76[_0x6dad('0x2c')],'sectionId':_0x544a76['id']},{})[_0x6dad('0x25')](function(){return _0x3c9e25;});}else{return _0x3c9e25;}})[_0x6dad('0x48')](function(_0x200247){logger[_0x6dad('0x2a')](_0x6dad('0x7d'),_0x200247);throw _0x200247;});}return _0x3c9e25;})[_0x6dad('0x25')](respondWithResult(_0x539574,null))[_0x6dad('0x48')](handleError(_0x539574,null));});_0x3c4d60[_0x6dad('0x7e')]();}catch(_0x10a28c){_0x539574[_0x6dad('0x1a')](0x1f4)[_0x6dad('0x2d')](_0x10a28c);}};exports[_0x6dad('0x24')]=function(_0x332ee9,_0x2576cd,_0x4b5636){return db[_0x6dad('0x30')][_0x6dad('0x4d')]({'where':{'id':_0x332ee9[_0x6dad('0x4a')]['id']}})[_0x6dad('0x25')](handleEntityNotFound(_0x2576cd,null))['then'](saveUpdates(_[_0x6dad('0x7f')](_0x332ee9[_0x6dad('0x76')],[_0x6dad('0x2c'),'description']),null))['then'](respondWithResult(_0x2576cd,null))[_0x6dad('0x48')](handleError(_0x2576cd,null));};exports[_0x6dad('0x80')]=function(_0x1917e6,_0x47ec06,_0x1438ba){return db[_0x6dad('0x30')]['find']({'where':{'id':_0x1917e6[_0x6dad('0x4a')]['id']}})[_0x6dad('0x25')](function(_0x448e65){if(_0x448e65){return _0x448e65[_0x6dad('0x81')]();}})[_0x6dad('0x25')](function(_0x2534c3){var _0x8b224a=path[_0x6dad('0x55')](config[_0x6dad('0x50')],_0x6dad('0x82'),util[_0x6dad('0x57')](_0x6dad('0x58'),_0x2534c3['save_name'],_0x2534c3['original_format']));var _0x2cc8c8=path[_0x6dad('0x55')](config[_0x6dad('0x50')],_0x6dad('0x56'),util['format'](_0x6dad('0x58'),_0x2534c3[_0x6dad('0x51')],_0x2534c3['converted_format']));fs[_0x6dad('0x65')](_0x8b224a);fs['unlinkSync'](_0x2cc8c8);return _0x2534c3;})[_0x6dad('0x25')](function(_0x596677){if(_0x596677){return _0x47ec06[_0x6dad('0x1a')](0xcc)['end']();}})[_0x6dad('0x25')](handleEntityNotFound(_0x47ec06,null))['catch'](handleError(_0x47ec06,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a6f7e8d..10195b9 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 _0x5d0b=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x10e9a2,_0x4f485a){var _0x49f70d=function(_0x3309c6){while(--_0x3309c6){_0x10e9a2['push'](_0x10e9a2['shift']());}};_0x49f70d(++_0x4f485a);}(_0x5d0b,0xae));var _0xb5d0=function(_0xb70791,_0x1d91d6){_0xb70791=_0xb70791-0x0;var _0x48f939=_0x5d0b[_0xb70791];return _0x48f939;};'use strict';var _=require(_0xb5d0('0x0'));var util=require(_0xb5d0('0x1'));var logger=require(_0xb5d0('0x2'))(_0xb5d0('0x3'));var moment=require(_0xb5d0('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5d0('0x5'));var fs=require('fs');var path=require(_0xb5d0('0x6'));var rimraf=require(_0xb5d0('0x7'));var config=require(_0xb5d0('0x8'));var attributes=require(_0xb5d0('0x9'));module[_0xb5d0('0xa')]=function(_0x4908e9,_0x309f24){return _0x4908e9[_0xb5d0('0xb')](_0xb5d0('0xc'),attributes,{'tableName':_0xb5d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x737c=['Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x737c,0x13a));var _0xc737=function(_0x194fc4,_0x973613){_0x194fc4=_0x194fc4-0x0;var _0x2773ee=_0x737c[_0x194fc4];return _0x2773ee;};'use strict';var _=require(_0xc737('0x0'));var util=require(_0xc737('0x1'));var logger=require(_0xc737('0x2'))(_0xc737('0x3'));var moment=require(_0xc737('0x4'));var BPromise=require(_0xc737('0x5'));var rp=require(_0xc737('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc737('0x7'));var config=require(_0xc737('0x8'));var attributes=require('./sound.attributes');module[_0xc737('0x9')]=function(_0x3a7768,_0x203e6a){return _0x3a7768[_0xc737('0xa')](_0xc737('0xb'),attributes,{'tableName':_0xc737('0xc'),'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 ee0e2ec..b18d211 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 _0x8220=['debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','find','options','raw','where','include','map','attributes','model'];(function(_0x2f26d1,_0x361a29){var _0x5e92c7=function(_0x441e4a){while(--_0x441e4a){_0x2f26d1['push'](_0x2f26d1['shift']());}};_0x5e92c7(++_0x361a29);}(_0x8220,0xa1));var _0x0822=function(_0xd8a448,_0x25c7a2){_0xd8a448=_0xd8a448-0x0;var _0x4771df=_0x8220[_0xd8a448];return _0x4771df;};'use strict';var _=require(_0x0822('0x0'));var util=require(_0x0822('0x1'));var moment=require(_0x0822('0x2'));var BPromise=require('bluebird');var rs=require(_0x0822('0x3'));var fs=require('fs');var Redis=require(_0x0822('0x4'));var db=require(_0x0822('0x5'))['db'];var utils=require(_0x0822('0x6'));var logger=require(_0x0822('0x7'))(_0x0822('0x8'));var config=require(_0x0822('0x9'));var jayson=require(_0x0822('0xa'));var client=jayson['client'][_0x0822('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43e876,_0x348e31,_0x4c5df8){return new BPromise(function(_0x3e4fd1,_0x3760f0){return client[_0x0822('0xc')](_0x43e876,_0x4c5df8)[_0x0822('0xd')](function(_0x223bff){logger[_0x0822('0xe')](_0x0822('0xf'),_0x348e31,_0x0822('0x10'));logger['debug'](_0x0822('0x11'),_0x348e31,_0x0822('0x10'),JSON['stringify'](_0x223bff));if(_0x223bff[_0x0822('0x12')]){if(_0x223bff[_0x0822('0x12')][_0x0822('0x13')]===0x1f4){logger['error'](_0x0822('0xf'),_0x348e31,_0x223bff[_0x0822('0x12')][_0x0822('0x14')]);return _0x3760f0(_0x223bff[_0x0822('0x12')]['message']);}logger['error'](_0x0822('0xf'),_0x348e31,_0x223bff[_0x0822('0x12')][_0x0822('0x14')]);return _0x3e4fd1(_0x223bff['error'][_0x0822('0x14')]);}else{logger['info'](_0x0822('0xf'),_0x348e31,_0x0822('0x10'));_0x3e4fd1(_0x223bff['result'][_0x0822('0x14')]);}})[_0x0822('0x15')](function(_0x22d6bf){logger[_0x0822('0x12')](_0x0822('0xf'),_0x348e31,_0x22d6bf);_0x3760f0(_0x22d6bf);});});}exports[_0x0822('0x16')]=function(_0x451f33){var _0x186a0c=this;return new Promise(function(_0x359f83,_0x5c5f21){return db['Sound'][_0x0822('0x17')]({'raw':_0x451f33[_0x0822('0x18')]?_0x451f33[_0x0822('0x18')][_0x0822('0x19')]===undefined?!![]:![]:!![],'where':_0x451f33[_0x0822('0x18')]?_0x451f33[_0x0822('0x18')][_0x0822('0x1a')]||null:null,'attributes':_0x451f33['options']?_0x451f33[_0x0822('0x18')]['attributes']||null:null,'include':_0x451f33[_0x0822('0x18')]?_0x451f33[_0x0822('0x18')][_0x0822('0x1b')]?_[_0x0822('0x1c')](_0x451f33[_0x0822('0x18')][_0x0822('0x1b')],function(_0x21ea5a){return{'model':db[_0x21ea5a['model']],'as':_0x21ea5a['as'],'attributes':_0x21ea5a[_0x0822('0x1d')],'include':_0x21ea5a[_0x0822('0x1b')]?_[_0x0822('0x1c')](_0x21ea5a[_0x0822('0x1b')],function(_0x5daaba){return{'model':db[_0x5daaba[_0x0822('0x1e')]],'as':_0x5daaba['as'],'attributes':_0x5daaba[_0x0822('0x1d')],'include':_0x5daaba[_0x0822('0x1b')]?_[_0x0822('0x1c')](_0x5daaba[_0x0822('0x1b')],function(_0x167258){return{'model':db[_0x167258[_0x0822('0x1e')]],'as':_0x167258['as'],'attributes':_0x167258[_0x0822('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0822('0xd')](function(_0x4b75b3){logger['info']('ShowSound',_0x451f33);logger[_0x0822('0x1f')]('ShowSound',_0x451f33,JSON['stringify'](_0x4b75b3));_0x359f83(_0x4b75b3);})[_0x0822('0x15')](function(_0x28079c){logger[_0x0822('0x12')](_0x0822('0x16'),_0x28079c['message'],_0x451f33);_0x5c5f21(_0x186a0c['error'](0x1f4,_0x28079c[_0x0822('0x14')]));});});}; \ No newline at end of file +var _0xafc2=['map','include','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSound','Sound','find','options','raw','where','attributes'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xafc2,0x197));var _0x2afc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xafc2[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x2afc('0x0'));var moment=require(_0x2afc('0x1'));var BPromise=require(_0x2afc('0x2'));var rs=require(_0x2afc('0x3'));var fs=require('fs');var Redis=require(_0x2afc('0x4'));var db=require(_0x2afc('0x5'))['db'];var utils=require(_0x2afc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2afc('0x7'));var jayson=require(_0x2afc('0x8'));var client=jayson['client'][_0x2afc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a484b,_0x3be6a0,_0x5965c6){return new BPromise(function(_0x22cf95,_0x252f4a){return client['request'](_0x2a484b,_0x5965c6)[_0x2afc('0xa')](function(_0x7d8137){logger[_0x2afc('0xb')](_0x2afc('0xc'),_0x3be6a0,_0x2afc('0xd'));logger[_0x2afc('0xe')](_0x2afc('0xf'),_0x3be6a0,'request\x20sent',JSON[_0x2afc('0x10')](_0x7d8137));if(_0x7d8137['error']){if(_0x7d8137[_0x2afc('0x11')]['code']===0x1f4){logger[_0x2afc('0x11')](_0x2afc('0xc'),_0x3be6a0,_0x7d8137[_0x2afc('0x11')]['message']);return _0x252f4a(_0x7d8137[_0x2afc('0x11')][_0x2afc('0x12')]);}logger[_0x2afc('0x11')](_0x2afc('0xc'),_0x3be6a0,_0x7d8137[_0x2afc('0x11')][_0x2afc('0x12')]);return _0x22cf95(_0x7d8137[_0x2afc('0x11')][_0x2afc('0x12')]);}else{logger[_0x2afc('0xb')](_0x2afc('0xc'),_0x3be6a0,_0x2afc('0xd'));_0x22cf95(_0x7d8137[_0x2afc('0x13')][_0x2afc('0x12')]);}})['catch'](function(_0x5af67d){logger['error'](_0x2afc('0xc'),_0x3be6a0,_0x5af67d);_0x252f4a(_0x5af67d);});});}exports[_0x2afc('0x14')]=function(_0xc38c98){var _0x3dadbd=this;return new Promise(function(_0x5890aa,_0x444fad){return db[_0x2afc('0x15')][_0x2afc('0x16')]({'raw':_0xc38c98['options']?_0xc38c98[_0x2afc('0x17')][_0x2afc('0x18')]===undefined?!![]:![]:!![],'where':_0xc38c98['options']?_0xc38c98['options'][_0x2afc('0x19')]||null:null,'attributes':_0xc38c98[_0x2afc('0x17')]?_0xc38c98[_0x2afc('0x17')][_0x2afc('0x1a')]||null:null,'include':_0xc38c98[_0x2afc('0x17')]?_0xc38c98[_0x2afc('0x17')]['include']?_[_0x2afc('0x1b')](_0xc38c98[_0x2afc('0x17')][_0x2afc('0x1c')],function(_0x39319f){return{'model':db[_0x39319f[_0x2afc('0x1d')]],'as':_0x39319f['as'],'attributes':_0x39319f['attributes'],'include':_0x39319f[_0x2afc('0x1c')]?_[_0x2afc('0x1b')](_0x39319f[_0x2afc('0x1c')],function(_0x278d53){return{'model':db[_0x278d53[_0x2afc('0x1d')]],'as':_0x278d53['as'],'attributes':_0x278d53[_0x2afc('0x1a')],'include':_0x278d53[_0x2afc('0x1c')]?_[_0x2afc('0x1b')](_0x278d53[_0x2afc('0x1c')],function(_0x40923f){return{'model':db[_0x40923f[_0x2afc('0x1d')]],'as':_0x40923f['as'],'attributes':_0x40923f[_0x2afc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2afc('0xa')](function(_0x375cd1){logger[_0x2afc('0xb')](_0x2afc('0x14'),_0xc38c98);logger[_0x2afc('0xe')](_0x2afc('0x14'),_0xc38c98,JSON[_0x2afc('0x10')](_0x375cd1));_0x5890aa(_0x375cd1);})[_0x2afc('0x1e')](function(_0x1b3ffd){logger[_0x2afc('0x11')]('ShowSound',_0x1b3ffd[_0x2afc('0x12')],_0xc38c98);_0x444fad(_0x3dadbd[_0x2afc('0x11')](0x1f4,_0x1b3ffd[_0x2afc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5c57058..eb7d60d 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x38cd34,_0x172dc4){var _0x2c2cfe=function(_0x1c6bec){while(--_0x1c6bec){_0x38cd34['push'](_0x38cd34['shift']());}};_0x2c2cfe(++_0x172dc4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ee0ef,_0x34f2b1){var _0x144aab=function(_0x39f698){while(--_0x39f698){_0x5ee0ef['push'](_0x5ee0ef['shift']());}};_0x144aab(++_0x34f2b1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0x0b0e[_0x100e0c];return _0x4db1aa;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 3e924e9..097ddc2 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 _0x3086=['TEXT','sequelize','exports','STRING','medium','out'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0x3086,0x1c3));var _0x6308=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x3086[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x6308('0x0'));module[_0x6308('0x1')]={'uniqueid':{'type':Sequelize[_0x6308('0x2')]},'body':{'type':Sequelize['TEXT'](_0x6308('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6308('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6308('0x5')]}}; \ No newline at end of file +var _0xe92d=['out','sequelize','STRING','TEXT','medium','ENUM'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xe92d,0x1db));var _0xde92=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe92d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xde92('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xde92('0x1')]},'body':{'type':Sequelize[_0xde92('0x2')](_0xde92('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xde92('0x4')]('in',_0xde92('0x5')),'defaultValue':'out','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 ee44286..cf92563 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 _0x5480=['stack','name','send','index','map','SquareMessage','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','find','create','body','catch','update','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x5480,0x18a));var _0x0548=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x5480[_0x38854e];return _0x3f8415;};'use strict';var emlformat=require(_0x0548('0x0'));var rimraf=require(_0x0548('0x1'));var zipdir=require(_0x0548('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0548('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0548('0x4'));var util=require(_0x0548('0x5'));var path=require('path');var sox=require(_0x0548('0x6'));var csv=require(_0x0548('0x7'));var ejs=require(_0x0548('0x8'));var fs=require('fs');var fs_extra=require(_0x0548('0x9'));var _=require(_0x0548('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0548('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0548('0x7'));var querystring=require(_0x0548('0xc'));var Papa=require(_0x0548('0xd'));var Redis=require('ioredis');var authService=require(_0x0548('0xe'));var qs=require(_0x0548('0xf'));var as=require(_0x0548('0x10'));var hardwareService=require(_0x0548('0x11'));var logger=require(_0x0548('0x12'))(_0x0548('0x13'));var utils=require('../../config/utils');var config=require(_0x0548('0x14'));var licenseUtil=require(_0x0548('0x15'));var db=require(_0x0548('0x16'))['db'];function respondWithStatusCode(_0x3dd569,_0x228832){_0x228832=_0x228832||0xcc;return function(_0x5774fd){if(_0x5774fd){return _0x3dd569['sendStatus'](_0x228832);}return _0x3dd569[_0x0548('0x17')](_0x228832)[_0x0548('0x18')]();};}function respondWithResult(_0x108a78,_0x1a9c67){_0x1a9c67=_0x1a9c67||0xc8;return function(_0x112f16){if(_0x112f16){return _0x108a78[_0x0548('0x17')](_0x1a9c67)[_0x0548('0x19')](_0x112f16);}};}function respondWithFilteredResult(_0x477188,_0x2713a3){return function(_0x499681){if(_0x499681){var _0x55aef1=typeof _0x2713a3[_0x0548('0x1a')]==='undefined'&&typeof _0x2713a3[_0x0548('0x1b')]==='undefined';var _0x55760d=_0x499681['count'];var _0x18d908=_0x55aef1?0x0:_0x2713a3['offset'];var _0x549d8c=_0x55aef1?_0x499681[_0x0548('0x1c')]:_0x2713a3[_0x0548('0x1a')]+_0x2713a3[_0x0548('0x1b')];var _0x5da8e4;if(_0x549d8c>=_0x55760d){_0x549d8c=_0x55760d;_0x5da8e4=0xc8;}else{_0x5da8e4=0xce;}_0x477188[_0x0548('0x17')](_0x5da8e4);return _0x477188[_0x0548('0x1d')](_0x0548('0x1e'),_0x18d908+'-'+_0x549d8c+'/'+_0x55760d)[_0x0548('0x19')](_0x499681);}return null;};}function patchUpdates(_0x274836){return function(_0x5a5f07){try{jsonpatch[_0x0548('0x1f')](_0x5a5f07,_0x274836,!![]);}catch(_0x435731){return BPromise[_0x0548('0x20')](_0x435731);}return _0x5a5f07[_0x0548('0x21')]();};}function saveUpdates(_0x45cacb,_0x45b7ba){return function(_0x2718fc){if(_0x2718fc){return _0x2718fc['update'](_0x45cacb)[_0x0548('0x22')](function(_0x512963){return _0x512963;});}return null;};}function removeEntity(_0x5b4394,_0x7f593b){return function(_0x27a403){if(_0x27a403){return _0x27a403[_0x0548('0x23')]()[_0x0548('0x22')](function(){_0x5b4394[_0x0548('0x17')](0xcc)[_0x0548('0x18')]();});}};}function handleEntityNotFound(_0x2ffe7f,_0x565d34){return function(_0x14ccff){if(!_0x14ccff){_0x2ffe7f[_0x0548('0x24')](0x194);}return _0x14ccff;};}function handleError(_0x193687,_0x13021e){_0x13021e=_0x13021e||0x1f4;return function(_0x55ed9b){logger[_0x0548('0x25')](_0x55ed9b[_0x0548('0x26')]);if(_0x55ed9b[_0x0548('0x27')]){delete _0x55ed9b[_0x0548('0x27')];}_0x193687[_0x0548('0x17')](_0x13021e)[_0x0548('0x28')](_0x55ed9b);};}exports[_0x0548('0x29')]=function(_0x301f3b,_0x3e3cc7){var _0x2bfb94={},_0x3ec72a={},_0x5d1c7e={'count':0x0,'rows':[]};var _0x5f024a=_[_0x0548('0x2a')](db[_0x0548('0x2b')]['rawAttributes'],function(_0x35e659){return{'name':_0x35e659[_0x0548('0x2c')],'type':_0x35e659[_0x0548('0x2d')]['key']};});_0x3ec72a[_0x0548('0x2e')]=_[_0x0548('0x2a')](_0x5f024a,_0x0548('0x27'));_0x3ec72a['query']=_[_0x0548('0x2f')](_0x301f3b[_0x0548('0x30')]);_0x3ec72a[_0x0548('0x31')]=_[_0x0548('0x32')](_0x3ec72a[_0x0548('0x2e')],_0x3ec72a[_0x0548('0x30')]);_0x2bfb94[_0x0548('0x33')]=_[_0x0548('0x32')](_0x3ec72a[_0x0548('0x2e')],qs[_0x0548('0x34')](_0x301f3b[_0x0548('0x30')][_0x0548('0x34')]));_0x2bfb94['attributes']=_0x2bfb94[_0x0548('0x33')][_0x0548('0x35')]?_0x2bfb94[_0x0548('0x33')]:_0x3ec72a[_0x0548('0x2e')];if(!_0x301f3b['query'][_0x0548('0x36')](_0x0548('0x37'))){_0x2bfb94['limit']=qs[_0x0548('0x1b')](_0x301f3b[_0x0548('0x30')][_0x0548('0x1b')]);_0x2bfb94['offset']=qs['offset'](_0x301f3b['query'][_0x0548('0x1a')]);}_0x2bfb94[_0x0548('0x38')]=qs['sort'](_0x301f3b[_0x0548('0x30')]['sort']);_0x2bfb94[_0x0548('0x39')]=qs['filters'](_[_0x0548('0x3a')](_0x301f3b[_0x0548('0x30')],_0x3ec72a[_0x0548('0x31')]),_0x5f024a);if(_0x301f3b[_0x0548('0x30')][_0x0548('0x3b')]){_0x2bfb94[_0x0548('0x39')]=_[_0x0548('0x3c')](_0x2bfb94[_0x0548('0x39')],{'$or':_[_0x0548('0x2a')](_0x5f024a,function(_0x338c3d){if(_0x338c3d['type']!==_0x0548('0x3d')){var _0x18ffc3={};_0x18ffc3[_0x338c3d[_0x0548('0x27')]]={'$like':'%'+_0x301f3b['query'][_0x0548('0x3b')]+'%'};return _0x18ffc3;}})});}_0x2bfb94=_[_0x0548('0x3c')]({},_0x2bfb94,_0x301f3b['options']);var _0x191b4b={'where':_0x2bfb94[_0x0548('0x39')]};return db[_0x0548('0x2b')][_0x0548('0x1c')](_0x191b4b)['then'](function(_0x246789){_0x5d1c7e['count']=_0x246789;if(_0x301f3b[_0x0548('0x30')]['includeAll']){_0x2bfb94[_0x0548('0x3e')]=[{'all':!![]}];}return db[_0x0548('0x2b')][_0x0548('0x3f')](_0x2bfb94);})[_0x0548('0x22')](function(_0x217bdc){_0x5d1c7e[_0x0548('0x40')]=_0x217bdc;return _0x5d1c7e;})[_0x0548('0x22')](respondWithFilteredResult(_0x3e3cc7,_0x2bfb94))['catch'](handleError(_0x3e3cc7,null));};exports[_0x0548('0x41')]=function(_0x137749,_0x3f5fb3){var _0x2db0ce={'raw':!![],'where':{'id':_0x137749[_0x0548('0x42')]['id']}},_0x238288={};_0x238288['model']=_[_0x0548('0x2f')](db[_0x0548('0x2b')]['rawAttributes']);_0x238288[_0x0548('0x30')]=_[_0x0548('0x2f')](_0x137749[_0x0548('0x30')]);_0x238288[_0x0548('0x31')]=_[_0x0548('0x32')](_0x238288[_0x0548('0x2e')],_0x238288['query']);_0x2db0ce[_0x0548('0x33')]=_[_0x0548('0x32')](_0x238288[_0x0548('0x2e')],qs[_0x0548('0x34')](_0x137749[_0x0548('0x30')][_0x0548('0x34')]));_0x2db0ce[_0x0548('0x33')]=_0x2db0ce[_0x0548('0x33')]['length']?_0x2db0ce[_0x0548('0x33')]:_0x238288[_0x0548('0x2e')];if(_0x137749[_0x0548('0x30')]['includeAll']){_0x2db0ce[_0x0548('0x3e')]=[{'all':!![]}];}_0x2db0ce=_[_0x0548('0x3c')]({},_0x2db0ce,_0x137749['options']);return db[_0x0548('0x2b')][_0x0548('0x43')](_0x2db0ce)[_0x0548('0x22')](handleEntityNotFound(_0x3f5fb3,null))[_0x0548('0x22')](respondWithResult(_0x3f5fb3,null))['catch'](handleError(_0x3f5fb3,null));};exports[_0x0548('0x44')]=function(_0x162dc8,_0x42f6a1){return db[_0x0548('0x2b')]['create'](_0x162dc8[_0x0548('0x45')],{})[_0x0548('0x22')](respondWithResult(_0x42f6a1,0xc9))[_0x0548('0x46')](handleError(_0x42f6a1,null));};exports[_0x0548('0x47')]=function(_0x33259f,_0x438ca5){if(_0x33259f[_0x0548('0x45')]['id']){delete _0x33259f[_0x0548('0x45')]['id'];}return db[_0x0548('0x2b')][_0x0548('0x43')]({'where':{'id':_0x33259f[_0x0548('0x42')]['id']}})['then'](handleEntityNotFound(_0x438ca5,null))['then'](saveUpdates(_0x33259f[_0x0548('0x45')],null))['then'](respondWithResult(_0x438ca5,null))[_0x0548('0x46')](handleError(_0x438ca5,null));};exports[_0x0548('0x23')]=function(_0x270cbf,_0x12d087){return db[_0x0548('0x2b')][_0x0548('0x43')]({'where':{'id':_0x270cbf[_0x0548('0x42')]['id']}})[_0x0548('0x22')](handleEntityNotFound(_0x12d087,null))[_0x0548('0x22')](removeEntity(_0x12d087,null))[_0x0548('0x46')](handleError(_0x12d087,null));}; \ No newline at end of file +var _0xd2e0=['path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x19a21c,_0x4e03f8){var _0x3e9b9f=function(_0x40efad){while(--_0x40efad){_0x19a21c['push'](_0x19a21c['shift']());}};_0x3e9b9f(++_0x4e03f8);}(_0xd2e0,0x174));var _0x0d2e=function(_0x22b0cf,_0x4d038b){_0x22b0cf=_0x22b0cf-0x0;var _0x8b75fc=_0xd2e0[_0x22b0cf];return _0x8b75fc;};'use strict';var emlformat=require(_0x0d2e('0x0'));var rimraf=require(_0x0d2e('0x1'));var zipdir=require(_0x0d2e('0x2'));var jsonpatch=require(_0x0d2e('0x3'));var rp=require('request-promise');var moment=require(_0x0d2e('0x4'));var BPromise=require(_0x0d2e('0x5'));var Mustache=require(_0x0d2e('0x6'));var util=require(_0x0d2e('0x7'));var path=require(_0x0d2e('0x8'));var sox=require(_0x0d2e('0x9'));var csv=require(_0x0d2e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d2e('0xb'));var _=require(_0x0d2e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d2e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0d2e('0xa'));var querystring=require(_0x0d2e('0xe'));var Papa=require(_0x0d2e('0xf'));var Redis=require(_0x0d2e('0x10'));var authService=require(_0x0d2e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d2e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d2e('0x13'))(_0x0d2e('0x14'));var utils=require(_0x0d2e('0x15'));var config=require(_0x0d2e('0x16'));var licenseUtil=require(_0x0d2e('0x17'));var db=require(_0x0d2e('0x18'))['db'];function respondWithStatusCode(_0x416264,_0x179d6f){_0x179d6f=_0x179d6f||0xcc;return function(_0x4535d9){if(_0x4535d9){return _0x416264['sendStatus'](_0x179d6f);}return _0x416264['status'](_0x179d6f)[_0x0d2e('0x19')]();};}function respondWithResult(_0x168fde,_0x5bc375){_0x5bc375=_0x5bc375||0xc8;return function(_0x49a210){if(_0x49a210){return _0x168fde['status'](_0x5bc375)[_0x0d2e('0x1a')](_0x49a210);}};}function respondWithFilteredResult(_0x15f230,_0x16a83a){return function(_0x27d384){if(_0x27d384){var _0x5578e4=typeof _0x16a83a[_0x0d2e('0x1b')]===_0x0d2e('0x1c')&&typeof _0x16a83a['limit']===_0x0d2e('0x1c');var _0x324cfe=_0x27d384[_0x0d2e('0x1d')];var _0x3aa44d=_0x5578e4?0x0:_0x16a83a[_0x0d2e('0x1b')];var _0x15c04a=_0x5578e4?_0x27d384[_0x0d2e('0x1d')]:_0x16a83a[_0x0d2e('0x1b')]+_0x16a83a[_0x0d2e('0x1e')];var _0x190630;if(_0x15c04a>=_0x324cfe){_0x15c04a=_0x324cfe;_0x190630=0xc8;}else{_0x190630=0xce;}_0x15f230[_0x0d2e('0x1f')](_0x190630);return _0x15f230['set'](_0x0d2e('0x20'),_0x3aa44d+'-'+_0x15c04a+'/'+_0x324cfe)[_0x0d2e('0x1a')](_0x27d384);}return null;};}function patchUpdates(_0x4961a3){return function(_0x200d77){try{jsonpatch[_0x0d2e('0x21')](_0x200d77,_0x4961a3,!![]);}catch(_0x15c21d){return BPromise[_0x0d2e('0x22')](_0x15c21d);}return _0x200d77[_0x0d2e('0x23')]();};}function saveUpdates(_0x1f40df,_0x2c1b44){return function(_0x3e9e9d){if(_0x3e9e9d){return _0x3e9e9d[_0x0d2e('0x24')](_0x1f40df)['then'](function(_0x442c61){return _0x442c61;});}return null;};}function removeEntity(_0x21cdce,_0x4147b6){return function(_0x392ba2){if(_0x392ba2){return _0x392ba2[_0x0d2e('0x25')]()['then'](function(){_0x21cdce[_0x0d2e('0x1f')](0xcc)[_0x0d2e('0x19')]();});}};}function handleEntityNotFound(_0x48bced,_0x4d0a89){return function(_0x341673){if(!_0x341673){_0x48bced['sendStatus'](0x194);}return _0x341673;};}function handleError(_0x16426c,_0x545e4f){_0x545e4f=_0x545e4f||0x1f4;return function(_0xadb8be){logger['error'](_0xadb8be[_0x0d2e('0x26')]);if(_0xadb8be[_0x0d2e('0x27')]){delete _0xadb8be[_0x0d2e('0x27')];}_0x16426c[_0x0d2e('0x1f')](_0x545e4f)[_0x0d2e('0x28')](_0xadb8be);};}exports['index']=function(_0x48d827,_0x4479f7){var _0x3611ce={},_0x447a3c={},_0x4d9071={'count':0x0,'rows':[]};var _0x683c60=_[_0x0d2e('0x29')](db[_0x0d2e('0x2a')][_0x0d2e('0x2b')],function(_0x2efbcb){return{'name':_0x2efbcb[_0x0d2e('0x2c')],'type':_0x2efbcb[_0x0d2e('0x2d')][_0x0d2e('0x2e')]};});_0x447a3c[_0x0d2e('0x2f')]=_[_0x0d2e('0x29')](_0x683c60,_0x0d2e('0x27'));_0x447a3c[_0x0d2e('0x30')]=_[_0x0d2e('0x31')](_0x48d827['query']);_0x447a3c['filters']=_[_0x0d2e('0x32')](_0x447a3c[_0x0d2e('0x2f')],_0x447a3c[_0x0d2e('0x30')]);_0x3611ce['attributes']=_[_0x0d2e('0x32')](_0x447a3c['model'],qs[_0x0d2e('0x33')](_0x48d827[_0x0d2e('0x30')][_0x0d2e('0x33')]));_0x3611ce['attributes']=_0x3611ce[_0x0d2e('0x34')][_0x0d2e('0x35')]?_0x3611ce[_0x0d2e('0x34')]:_0x447a3c[_0x0d2e('0x2f')];if(!_0x48d827[_0x0d2e('0x30')][_0x0d2e('0x36')](_0x0d2e('0x37'))){_0x3611ce[_0x0d2e('0x1e')]=qs[_0x0d2e('0x1e')](_0x48d827[_0x0d2e('0x30')][_0x0d2e('0x1e')]);_0x3611ce['offset']=qs[_0x0d2e('0x1b')](_0x48d827[_0x0d2e('0x30')]['offset']);}_0x3611ce[_0x0d2e('0x38')]=qs[_0x0d2e('0x39')](_0x48d827['query'][_0x0d2e('0x39')]);_0x3611ce[_0x0d2e('0x3a')]=qs[_0x0d2e('0x3b')](_[_0x0d2e('0x3c')](_0x48d827[_0x0d2e('0x30')],_0x447a3c['filters']),_0x683c60);if(_0x48d827[_0x0d2e('0x30')][_0x0d2e('0x3d')]){_0x3611ce[_0x0d2e('0x3a')]=_['merge'](_0x3611ce[_0x0d2e('0x3a')],{'$or':_['map'](_0x683c60,function(_0x5af910){if(_0x5af910['type']!==_0x0d2e('0x3e')){var _0x21b79b={};_0x21b79b[_0x5af910[_0x0d2e('0x27')]]={'$like':'%'+_0x48d827[_0x0d2e('0x30')][_0x0d2e('0x3d')]+'%'};return _0x21b79b;}})});}_0x3611ce=_[_0x0d2e('0x3f')]({},_0x3611ce,_0x48d827[_0x0d2e('0x40')]);var _0x265b8d={'where':_0x3611ce[_0x0d2e('0x3a')]};return db[_0x0d2e('0x2a')][_0x0d2e('0x1d')](_0x265b8d)[_0x0d2e('0x41')](function(_0x21eb38){_0x4d9071['count']=_0x21eb38;if(_0x48d827[_0x0d2e('0x30')][_0x0d2e('0x42')]){_0x3611ce[_0x0d2e('0x43')]=[{'all':!![]}];}return db[_0x0d2e('0x2a')][_0x0d2e('0x44')](_0x3611ce);})[_0x0d2e('0x41')](function(_0x2ed5ac){_0x4d9071[_0x0d2e('0x45')]=_0x2ed5ac;return _0x4d9071;})['then'](respondWithFilteredResult(_0x4479f7,_0x3611ce))[_0x0d2e('0x46')](handleError(_0x4479f7,null));};exports[_0x0d2e('0x47')]=function(_0x4a5f78,_0x23f0ac){var _0x1e359f={'raw':!![],'where':{'id':_0x4a5f78['params']['id']}},_0x5ddab4={};_0x5ddab4[_0x0d2e('0x2f')]=_[_0x0d2e('0x31')](db[_0x0d2e('0x2a')]['rawAttributes']);_0x5ddab4[_0x0d2e('0x30')]=_[_0x0d2e('0x31')](_0x4a5f78[_0x0d2e('0x30')]);_0x5ddab4[_0x0d2e('0x3b')]=_[_0x0d2e('0x32')](_0x5ddab4[_0x0d2e('0x2f')],_0x5ddab4['query']);_0x1e359f[_0x0d2e('0x34')]=_[_0x0d2e('0x32')](_0x5ddab4['model'],qs[_0x0d2e('0x33')](_0x4a5f78[_0x0d2e('0x30')]['fields']));_0x1e359f['attributes']=_0x1e359f[_0x0d2e('0x34')][_0x0d2e('0x35')]?_0x1e359f[_0x0d2e('0x34')]:_0x5ddab4['model'];if(_0x4a5f78[_0x0d2e('0x30')][_0x0d2e('0x42')]){_0x1e359f[_0x0d2e('0x43')]=[{'all':!![]}];}_0x1e359f=_[_0x0d2e('0x3f')]({},_0x1e359f,_0x4a5f78[_0x0d2e('0x40')]);return db['SquareMessage']['find'](_0x1e359f)[_0x0d2e('0x41')](handleEntityNotFound(_0x23f0ac,null))[_0x0d2e('0x41')](respondWithResult(_0x23f0ac,null))[_0x0d2e('0x46')](handleError(_0x23f0ac,null));};exports[_0x0d2e('0x48')]=function(_0x563615,_0x27e1bc){return db[_0x0d2e('0x2a')][_0x0d2e('0x48')](_0x563615['body'],{})[_0x0d2e('0x41')](respondWithResult(_0x27e1bc,0xc9))[_0x0d2e('0x46')](handleError(_0x27e1bc,null));};exports[_0x0d2e('0x24')]=function(_0x32b94c,_0x136d5b){if(_0x32b94c[_0x0d2e('0x49')]['id']){delete _0x32b94c[_0x0d2e('0x49')]['id'];}return db['SquareMessage'][_0x0d2e('0x4a')]({'where':{'id':_0x32b94c[_0x0d2e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x136d5b,null))[_0x0d2e('0x41')](saveUpdates(_0x32b94c[_0x0d2e('0x49')],null))[_0x0d2e('0x41')](respondWithResult(_0x136d5b,null))[_0x0d2e('0x46')](handleError(_0x136d5b,null));};exports[_0x0d2e('0x25')]=function(_0x530f85,_0x3cdacf){return db[_0x0d2e('0x2a')]['find']({'where':{'id':_0x530f85[_0x0d2e('0x4b')]['id']}})[_0x0d2e('0x41')](handleEntityNotFound(_0x3cdacf,null))[_0x0d2e('0x41')](removeEntity(_0x3cdacf,null))['catch'](handleError(_0x3cdacf,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 153191a..ce11d22 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 _0x5f95=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage'];(function(_0x454f02,_0x32ce79){var _0x3369f7=function(_0x4c455c){while(--_0x4c455c){_0x454f02['push'](_0x454f02['shift']());}};_0x3369f7(++_0x32ce79);}(_0x5f95,0x140));var _0x55f9=function(_0xad2004,_0x5e0638){_0xad2004=_0xad2004-0x0;var _0xbf120c=_0x5f95[_0xad2004];return _0xbf120c;};'use strict';var _=require(_0x55f9('0x0'));var util=require(_0x55f9('0x1'));var logger=require(_0x55f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x55f9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x55f9('0x4'));var rimraf=require(_0x55f9('0x5'));var config=require(_0x55f9('0x6'));var attributes=require(_0x55f9('0x7'));module['exports']=function(_0x45405e,_0x103e09){return _0x45405e[_0x55f9('0x8')](_0x55f9('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6afb=['SquareMessage','square_messages','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x1818fb,_0x2c7ba4){var _0x44d91e=function(_0x32ca56){while(--_0x32ca56){_0x1818fb['push'](_0x1818fb['shift']());}};_0x44d91e(++_0x2c7ba4);}(_0x6afb,0x122));var _0xb6af=function(_0x1a45e3,_0x385589){_0x1a45e3=_0x1a45e3-0x0;var _0x3615f8=_0x6afb[_0x1a45e3];return _0x3615f8;};'use strict';var _=require(_0xb6af('0x0'));var util=require(_0xb6af('0x1'));var logger=require('../../config/logger')(_0xb6af('0x2'));var moment=require(_0xb6af('0x3'));var BPromise=require(_0xb6af('0x4'));var rp=require(_0xb6af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6af('0x6'));var config=require(_0xb6af('0x7'));var attributes=require(_0xb6af('0x8'));module[_0xb6af('0x9')]=function(_0x556314,_0x1cf941){return _0x556314['define'](_0xb6af('0xa'),attributes,{'tableName':_0xb6af('0xb'),'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 d70c940..7d5650c 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 _0xfb50=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SquareMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','SquareMessage','create','body','options','CreateSquareMessage','lodash','util'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0xfb50,0x1c9));var _0x0fb5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xfb50[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x0fb5('0x0'));var util=require(_0x0fb5('0x1'));var moment=require(_0x0fb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fb5('0x3'));var fs=require('fs');var Redis=require(_0x0fb5('0x4'));var db=require(_0x0fb5('0x5'))['db'];var utils=require(_0x0fb5('0x6'));var logger=require(_0x0fb5('0x7'))('rpc');var config=require(_0x0fb5('0x8'));var jayson=require(_0x0fb5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e41d6,_0x474bd7,_0x5cfb65){return new BPromise(function(_0x37f799,_0x104380){return client[_0x0fb5('0xa')](_0x2e41d6,_0x5cfb65)[_0x0fb5('0xb')](function(_0x16a1d4){logger['info'](_0x0fb5('0xc'),_0x474bd7,'request\x20sent');logger[_0x0fb5('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x474bd7,_0x0fb5('0xe'),JSON[_0x0fb5('0xf')](_0x16a1d4));if(_0x16a1d4[_0x0fb5('0x10')]){if(_0x16a1d4[_0x0fb5('0x10')][_0x0fb5('0x11')]===0x1f4){logger[_0x0fb5('0x10')]('SquareMessage,\x20%s,\x20%s',_0x474bd7,_0x16a1d4[_0x0fb5('0x10')][_0x0fb5('0x12')]);return _0x104380(_0x16a1d4[_0x0fb5('0x10')]['message']);}logger[_0x0fb5('0x10')](_0x0fb5('0xc'),_0x474bd7,_0x16a1d4[_0x0fb5('0x10')][_0x0fb5('0x12')]);return _0x37f799(_0x16a1d4[_0x0fb5('0x10')][_0x0fb5('0x12')]);}else{logger[_0x0fb5('0x13')]('SquareMessage,\x20%s,\x20%s',_0x474bd7,_0x0fb5('0xe'));_0x37f799(_0x16a1d4[_0x0fb5('0x14')][_0x0fb5('0x12')]);}})[_0x0fb5('0x15')](function(_0x34dd0e){logger[_0x0fb5('0x10')](_0x0fb5('0xc'),_0x474bd7,_0x34dd0e);_0x104380(_0x34dd0e);});});}exports['CreateSquareMessage']=function(_0x116efd){var _0x125342=this;return new Promise(function(_0xadb7c4,_0x5bb882){return db[_0x0fb5('0x16')][_0x0fb5('0x17')](_0x116efd[_0x0fb5('0x18')],{'raw':_0x116efd[_0x0fb5('0x19')]?_0x116efd[_0x0fb5('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0fb5('0xb')](function(_0x104097){logger[_0x0fb5('0x13')](_0x0fb5('0x1a'),_0x116efd);logger[_0x0fb5('0xd')](_0x0fb5('0x1a'),_0x116efd,JSON['stringify'](_0x104097));_0xadb7c4(_0x104097);})[_0x0fb5('0x15')](function(_0x341a41){logger[_0x0fb5('0x10')](_0x0fb5('0x1a'),_0x341a41['message'],_0x116efd);_0x5bb882(_0x125342[_0x0fb5('0x10')](0x1f4,_0x341a41[_0x0fb5('0x12')]));});});}; \ No newline at end of file +var _0x66e3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','create','options','raw','catch','lodash'];(function(_0x23b67f,_0x3fb420){var _0x36a261=function(_0x1b9d8a){while(--_0x1b9d8a){_0x23b67f['push'](_0x23b67f['shift']());}};_0x36a261(++_0x3fb420);}(_0x66e3,0x137));var _0x366e=function(_0x21cafa,_0x3b4288){_0x21cafa=_0x21cafa-0x0;var _0x2f943e=_0x66e3[_0x21cafa];return _0x2f943e;};'use strict';var _=require(_0x366e('0x0'));var util=require(_0x366e('0x1'));var moment=require(_0x366e('0x2'));var BPromise=require(_0x366e('0x3'));var rs=require(_0x366e('0x4'));var fs=require('fs');var Redis=require(_0x366e('0x5'));var db=require(_0x366e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x366e('0x7'));var config=require(_0x366e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x366e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25f408,_0x8940a7,_0x35fbe7){return new BPromise(function(_0x390c14,_0x4da091){return client['request'](_0x25f408,_0x35fbe7)[_0x366e('0xa')](function(_0xc83040){logger[_0x366e('0xb')]('SquareMessage,\x20%s,\x20%s',_0x8940a7,_0x366e('0xc'));logger[_0x366e('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x8940a7,'request\x20sent',JSON[_0x366e('0xe')](_0xc83040));if(_0xc83040[_0x366e('0xf')]){if(_0xc83040[_0x366e('0xf')]['code']===0x1f4){logger[_0x366e('0xf')](_0x366e('0x10'),_0x8940a7,_0xc83040[_0x366e('0xf')]['message']);return _0x4da091(_0xc83040[_0x366e('0xf')][_0x366e('0x11')]);}logger[_0x366e('0xf')]('SquareMessage,\x20%s,\x20%s',_0x8940a7,_0xc83040[_0x366e('0xf')][_0x366e('0x11')]);return _0x390c14(_0xc83040['error'][_0x366e('0x11')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x8940a7,_0x366e('0xc'));_0x390c14(_0xc83040[_0x366e('0x12')]['message']);}})['catch'](function(_0x103fb0){logger[_0x366e('0xf')](_0x366e('0x10'),_0x8940a7,_0x103fb0);_0x4da091(_0x103fb0);});});}exports[_0x366e('0x13')]=function(_0x54c5e5){var _0xc7c056=this;return new Promise(function(_0x28c377,_0x4930d9){return db['SquareMessage'][_0x366e('0x14')](_0x54c5e5['body'],{'raw':_0x54c5e5[_0x366e('0x15')]?_0x54c5e5[_0x366e('0x15')][_0x366e('0x16')]===undefined?!![]:![]:!![]})[_0x366e('0xa')](function(_0x47f98a){logger[_0x366e('0xb')](_0x366e('0x13'),_0x54c5e5);logger[_0x366e('0xd')](_0x366e('0x13'),_0x54c5e5,JSON[_0x366e('0xe')](_0x47f98a));_0x28c377(_0x47f98a);})[_0x366e('0x17')](function(_0x44bf53){logger[_0x366e('0xf')](_0x366e('0x13'),_0x44bf53[_0x366e('0x11')],_0x54c5e5);_0x4930d9(_0xc7c056['error'](0x1f4,_0x44bf53[_0x366e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index cb3454b..8947aa5 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 _0x20f5=['./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x20f5,0xdd));var _0x520f=function(_0x3398db,_0x501efa){_0x3398db=_0x3398db-0x0;var _0x218edf=_0x20f5[_0x3398db];return _0x218edf;};'use strict';var multer=require(_0x520f('0x0'));var util=require(_0x520f('0x1'));var path=require(_0x520f('0x2'));var timeout=require(_0x520f('0x3'));var express=require(_0x520f('0x4'));var router=express[_0x520f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x520f('0x6'));var interaction=require(_0x520f('0x7'));var config=require(_0x520f('0x8'));var controller=require(_0x520f('0x9'));router[_0x520f('0xa')]('/',auth[_0x520f('0xb')](),controller[_0x520f('0xc')]);router[_0x520f('0xa')](_0x520f('0xd'),auth[_0x520f('0xb')](),controller['show']);router['get'](_0x520f('0xe'),auth['isAuthenticated'](),timeout(_0x520f('0xf')),controller[_0x520f('0x10')]);router[_0x520f('0x11')]('/',auth['isAuthenticated'](),controller[_0x520f('0x12')]);router[_0x520f('0x13')](_0x520f('0xd'),auth[_0x520f('0xb')](),controller[_0x520f('0x14')]);router['delete']('/:id',auth[_0x520f('0xb')](),controller[_0x520f('0x15')]);module[_0x520f('0x16')]=router; \ No newline at end of file +var _0xa567=['get','index','isAuthenticated','show','15s','test','post','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./squareOdbc.controller'];(function(_0x14a52c,_0x34b93c){var _0x8533a1=function(_0x58365d){while(--_0x58365d){_0x14a52c['push'](_0x14a52c['shift']());}};_0x8533a1(++_0x34b93c);}(_0xa567,0xd0));var _0x7a56=function(_0x4890c4,_0x2c4e97){_0x4890c4=_0x4890c4-0x0;var _0x23d343=_0xa567[_0x4890c4];return _0x23d343;};'use strict';var multer=require(_0x7a56('0x0'));var util=require(_0x7a56('0x1'));var path=require('path');var timeout=require(_0x7a56('0x2'));var express=require(_0x7a56('0x3'));var router=express[_0x7a56('0x4')]();var fs_extra=require(_0x7a56('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7a56('0x6'));var controller=require(_0x7a56('0x7'));router[_0x7a56('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a56('0x9')]);router['get']('/:id',auth[_0x7a56('0xa')](),controller[_0x7a56('0xb')]);router['get']('/:id/test',auth[_0x7a56('0xa')](),timeout(_0x7a56('0xc')),controller[_0x7a56('0xd')]);router[_0x7a56('0xe')]('/',auth[_0x7a56('0xa')](),controller['create']);router['put']('/:id',auth[_0x7a56('0xa')](),controller['update']);router[_0x7a56('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7a56('0x10')]);module[_0x7a56('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0264625..e142386 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 _0xf675=['STRING','name','sequelize','exports'];(function(_0x294726,_0x5db9e9){var _0x39e2e3=function(_0x50041d){while(--_0x50041d){_0x294726['push'](_0x294726['shift']());}};_0x39e2e3(++_0x5db9e9);}(_0xf675,0x116));var _0x5f67=function(_0xf9e76,_0x2e6b9a){_0xf9e76=_0xf9e76-0x0;var _0x119a9b=_0xf675[_0xf9e76];return _0x119a9b;};'use strict';var Sequelize=require(_0x5f67('0x0'));module[_0x5f67('0x1')]={'name':{'type':Sequelize[_0x5f67('0x2')],'unique':_0x5f67('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5f67('0x2')]},'description':{'type':Sequelize[_0x5f67('0x2')]}}; \ No newline at end of file +var _0xb272=['sequelize','exports','STRING','name'];(function(_0x3c3da2,_0x282e38){var _0x3fa0e2=function(_0x1c87d7){while(--_0x1c87d7){_0x3c3da2['push'](_0x3c3da2['shift']());}};_0x3fa0e2(++_0x282e38);}(_0xb272,0x12c));var _0x2b27=function(_0x4649c4,_0x4c8c1a){_0x4649c4=_0x4649c4-0x0;var _0x4166e2=_0xb272[_0x4649c4];return _0x4166e2;};'use strict';var Sequelize=require(_0x2b27('0x0'));module[_0x2b27('0x1')]={'name':{'type':Sequelize[_0x2b27('0x2')],'unique':_0x2b27('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2b27('0x2')]},'description':{'type':Sequelize[_0x2b27('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 588d61d..b1864f7 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 _0x2eba=['limit','count','status','set','Content-Range','reject','save','update','then','destroy','ODBC','UserProfileResource','end','sendStatus','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','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','json','offset','undefined'];(function(_0x44c905,_0x51ea3f){var _0x5d9975=function(_0x6ac62c){while(--_0x6ac62c){_0x44c905['push'](_0x44c905['shift']());}};_0x5d9975(++_0x51ea3f);}(_0x2eba,0xf2));var _0xa2eb=function(_0x5030fa,_0x3f86d3){_0x5030fa=_0x5030fa-0x0;var _0x463471=_0x2eba[_0x5030fa];return _0x463471;};'use strict';var emlformat=require(_0xa2eb('0x0'));var rimraf=require(_0xa2eb('0x1'));var zipdir=require(_0xa2eb('0x2'));var jsonpatch=require(_0xa2eb('0x3'));var rp=require(_0xa2eb('0x4'));var moment=require(_0xa2eb('0x5'));var BPromise=require(_0xa2eb('0x6'));var Mustache=require(_0xa2eb('0x7'));var util=require(_0xa2eb('0x8'));var path=require(_0xa2eb('0x9'));var sox=require(_0xa2eb('0xa'));var csv=require(_0xa2eb('0xb'));var ejs=require(_0xa2eb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2eb('0xd'));var squel=require(_0xa2eb('0xe'));var crypto=require('crypto');var jsforce=require(_0xa2eb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa2eb('0xb'));var querystring=require(_0xa2eb('0x10'));var Papa=require('papaparse');var Redis=require(_0xa2eb('0x11'));var authService=require(_0xa2eb('0x12'));var qs=require(_0xa2eb('0x13'));var as=require(_0xa2eb('0x14'));var hardwareService=require(_0xa2eb('0x15'));var logger=require(_0xa2eb('0x16'))(_0xa2eb('0x17'));var utils=require(_0xa2eb('0x18'));var config=require(_0xa2eb('0x19'));var licenseUtil=require(_0xa2eb('0x1a'));var db=require(_0xa2eb('0x1b'))['db'];function respondWithStatusCode(_0x21ea1a,_0x520e07){_0x520e07=_0x520e07||0xcc;return function(_0x5ed1cc){if(_0x5ed1cc){return _0x21ea1a['sendStatus'](_0x520e07);}return _0x21ea1a['status'](_0x520e07)['end']();};}function respondWithResult(_0x2ab9d4,_0x1cafad){_0x1cafad=_0x1cafad||0xc8;return function(_0x578e53){if(_0x578e53){return _0x2ab9d4['status'](_0x1cafad)[_0xa2eb('0x1c')](_0x578e53);}};}function respondWithFilteredResult(_0x14b6cc,_0x3d6dbc){return function(_0x586ba0){if(_0x586ba0){var _0x510dea=typeof _0x3d6dbc[_0xa2eb('0x1d')]===_0xa2eb('0x1e')&&typeof _0x3d6dbc[_0xa2eb('0x1f')]===_0xa2eb('0x1e');var _0x48b356=_0x586ba0[_0xa2eb('0x20')];var _0x4115db=_0x510dea?0x0:_0x3d6dbc['offset'];var _0x5f032b=_0x510dea?_0x586ba0['count']:_0x3d6dbc[_0xa2eb('0x1d')]+_0x3d6dbc[_0xa2eb('0x1f')];var _0x246285;if(_0x5f032b>=_0x48b356){_0x5f032b=_0x48b356;_0x246285=0xc8;}else{_0x246285=0xce;}_0x14b6cc[_0xa2eb('0x21')](_0x246285);return _0x14b6cc[_0xa2eb('0x22')](_0xa2eb('0x23'),_0x4115db+'-'+_0x5f032b+'/'+_0x48b356)['json'](_0x586ba0);}return null;};}function patchUpdates(_0x23c9b7){return function(_0x53e747){try{jsonpatch['apply'](_0x53e747,_0x23c9b7,!![]);}catch(_0x23911c){return BPromise[_0xa2eb('0x24')](_0x23911c);}return _0x53e747[_0xa2eb('0x25')]();};}function saveUpdates(_0x202ef6,_0x5931fa){return function(_0x31f54f){if(_0x31f54f){return _0x31f54f[_0xa2eb('0x26')](_0x202ef6)[_0xa2eb('0x27')](function(_0x5036ee){return _0x5036ee;});}return null;};}function removeEntity(_0xdf16a6,_0x48a569){return function(_0x4a2589){if(_0x4a2589){return _0x4a2589[_0xa2eb('0x28')]()[_0xa2eb('0x27')](function(){var _0x3078e8=_0x4a2589['get']({'plain':!![]});var _0x180967=_0xa2eb('0x29');return db[_0xa2eb('0x2a')][_0xa2eb('0x28')]({'where':{'type':_0x180967,'resourceId':_0x3078e8['id']}})['then'](function(){return _0x4a2589;});})[_0xa2eb('0x27')](function(){_0xdf16a6[_0xa2eb('0x21')](0xcc)[_0xa2eb('0x2b')]();});}};}function handleEntityNotFound(_0x3a5b76,_0x47d857){return function(_0xbf18f5){if(!_0xbf18f5){_0x3a5b76[_0xa2eb('0x2c')](0x194);}return _0xbf18f5;};}function handleError(_0x69b23,_0xe036dd){_0xe036dd=_0xe036dd||0x1f4;return function(_0xcf05a3){logger['error'](_0xcf05a3[_0xa2eb('0x2d')]);if(_0xcf05a3['name']){delete _0xcf05a3[_0xa2eb('0x2e')];}_0x69b23[_0xa2eb('0x21')](_0xe036dd)[_0xa2eb('0x2f')](_0xcf05a3);};}exports['index']=function(_0x5ebfd4,_0x156ffa){var _0x51754f={},_0x1a5507={},_0x1803d6={'count':0x0,'rows':[]};var _0x10ae9e=_['map'](db[_0xa2eb('0x30')][_0xa2eb('0x31')],function(_0x16d219){return{'name':_0x16d219[_0xa2eb('0x32')],'type':_0x16d219[_0xa2eb('0x33')][_0xa2eb('0x34')]};});_0x1a5507[_0xa2eb('0x35')]=_[_0xa2eb('0x36')](_0x10ae9e,'name');_0x1a5507[_0xa2eb('0x37')]=_[_0xa2eb('0x38')](_0x5ebfd4[_0xa2eb('0x37')]);_0x1a5507[_0xa2eb('0x39')]=_[_0xa2eb('0x3a')](_0x1a5507[_0xa2eb('0x35')],_0x1a5507['query']);_0x51754f['attributes']=_[_0xa2eb('0x3a')](_0x1a5507[_0xa2eb('0x35')],qs[_0xa2eb('0x3b')](_0x5ebfd4['query'][_0xa2eb('0x3b')]));_0x51754f[_0xa2eb('0x3c')]=_0x51754f[_0xa2eb('0x3c')][_0xa2eb('0x3d')]?_0x51754f[_0xa2eb('0x3c')]:_0x1a5507[_0xa2eb('0x35')];if(!_0x5ebfd4['query'][_0xa2eb('0x3e')](_0xa2eb('0x3f'))){_0x51754f[_0xa2eb('0x1f')]=qs[_0xa2eb('0x1f')](_0x5ebfd4['query']['limit']);_0x51754f[_0xa2eb('0x1d')]=qs['offset'](_0x5ebfd4['query'][_0xa2eb('0x1d')]);}_0x51754f['order']=qs[_0xa2eb('0x40')](_0x5ebfd4['query']['sort']);_0x51754f[_0xa2eb('0x41')]=qs[_0xa2eb('0x39')](_[_0xa2eb('0x42')](_0x5ebfd4[_0xa2eb('0x37')],_0x1a5507['filters']),_0x10ae9e);if(_0x5ebfd4[_0xa2eb('0x37')][_0xa2eb('0x43')]){_0x51754f[_0xa2eb('0x41')]=_[_0xa2eb('0x44')](_0x51754f['where'],{'$or':_[_0xa2eb('0x36')](_0x10ae9e,function(_0x43a0ee){if(_0x43a0ee['type']!=='VIRTUAL'){var _0x3fdaba={};_0x3fdaba[_0x43a0ee[_0xa2eb('0x2e')]]={'$like':'%'+_0x5ebfd4[_0xa2eb('0x37')][_0xa2eb('0x43')]+'%'};return _0x3fdaba;}})});}_0x51754f=_[_0xa2eb('0x44')]({},_0x51754f,_0x5ebfd4[_0xa2eb('0x45')]);var _0xff8aa8={'where':_0x51754f[_0xa2eb('0x41')]};return db['SquareOdbc'][_0xa2eb('0x20')](_0xff8aa8)['then'](function(_0x16ea7c){_0x1803d6['count']=_0x16ea7c;if(_0x5ebfd4[_0xa2eb('0x37')]['includeAll']){_0x51754f[_0xa2eb('0x46')]=[{'all':!![]}];}return db[_0xa2eb('0x30')]['findAll'](_0x51754f);})['then'](function(_0x1943d7){_0x1803d6[_0xa2eb('0x47')]=_0x1943d7;return _0x1803d6;})[_0xa2eb('0x27')](respondWithFilteredResult(_0x156ffa,_0x51754f))[_0xa2eb('0x48')](handleError(_0x156ffa,null));};exports[_0xa2eb('0x49')]=function(_0xced3f2,_0x510c1b){var _0x3271df={'raw':!![],'where':{'id':_0xced3f2[_0xa2eb('0x4a')]['id']}},_0x9738f0={};_0x9738f0[_0xa2eb('0x35')]=_['keys'](db['SquareOdbc'][_0xa2eb('0x31')]);_0x9738f0['query']=_[_0xa2eb('0x38')](_0xced3f2[_0xa2eb('0x37')]);_0x9738f0[_0xa2eb('0x39')]=_[_0xa2eb('0x3a')](_0x9738f0['model'],_0x9738f0[_0xa2eb('0x37')]);_0x3271df[_0xa2eb('0x3c')]=_['intersection'](_0x9738f0[_0xa2eb('0x35')],qs[_0xa2eb('0x3b')](_0xced3f2['query'][_0xa2eb('0x3b')]));_0x3271df[_0xa2eb('0x3c')]=_0x3271df['attributes'][_0xa2eb('0x3d')]?_0x3271df[_0xa2eb('0x3c')]:_0x9738f0[_0xa2eb('0x35')];if(_0xced3f2['query'][_0xa2eb('0x4b')]){_0x3271df['include']=[{'all':!![]}];}_0x3271df=_[_0xa2eb('0x44')]({},_0x3271df,_0xced3f2[_0xa2eb('0x45')]);return db[_0xa2eb('0x30')][_0xa2eb('0x4c')](_0x3271df)['then'](handleEntityNotFound(_0x510c1b,null))['then'](respondWithResult(_0x510c1b,null))[_0xa2eb('0x48')](handleError(_0x510c1b,null));};exports[_0xa2eb('0x4d')]=function(_0x3ec6d2,_0x24bdbb){return db['SquareOdbc'][_0xa2eb('0x4d')](_0x3ec6d2[_0xa2eb('0x4e')],{})[_0xa2eb('0x27')](function(_0x1e7c57){var _0x522ba4=_0x3ec6d2[_0xa2eb('0x4f')][_0xa2eb('0x50')]({'plain':!![]});if(!_0x522ba4)throw new Error(_0xa2eb('0x51'));if(_0x522ba4['role']===_0xa2eb('0x4f')){var _0x4c93cd=_0x1e7c57[_0xa2eb('0x50')]({'plain':!![]});var _0x313db6=_0xa2eb('0x29');return db[_0xa2eb('0x52')][_0xa2eb('0x4c')]({'where':{'name':_0x313db6,'userProfileId':_0x522ba4['userProfileId']},'raw':!![]})[_0xa2eb('0x27')](function(_0x2c6c04){if(_0x2c6c04&&_0x2c6c04[_0xa2eb('0x53')]===0x0){return db[_0xa2eb('0x2a')]['create']({'name':_0x4c93cd[_0xa2eb('0x2e')],'resourceId':_0x4c93cd['id'],'type':_0x2c6c04[_0xa2eb('0x2e')],'sectionId':_0x2c6c04['id']},{})[_0xa2eb('0x27')](function(){return _0x1e7c57;});}else{return _0x1e7c57;}})['catch'](function(_0x587ba1){logger[_0xa2eb('0x54')](_0xa2eb('0x55'),_0x587ba1);throw _0x587ba1;});}return _0x1e7c57;})[_0xa2eb('0x27')](respondWithResult(_0x24bdbb,0xc9))[_0xa2eb('0x48')](handleError(_0x24bdbb,null));};exports[_0xa2eb('0x26')]=function(_0x2e0d36,_0xc2ea75){if(_0x2e0d36[_0xa2eb('0x4e')]['id']){delete _0x2e0d36[_0xa2eb('0x4e')]['id'];}return db[_0xa2eb('0x30')][_0xa2eb('0x4c')]({'where':{'id':_0x2e0d36[_0xa2eb('0x4a')]['id']}})[_0xa2eb('0x27')](handleEntityNotFound(_0xc2ea75,null))[_0xa2eb('0x27')](saveUpdates(_0x2e0d36[_0xa2eb('0x4e')],null))[_0xa2eb('0x27')](respondWithResult(_0xc2ea75,null))[_0xa2eb('0x48')](handleError(_0xc2ea75,null));};exports['destroy']=function(_0x19fe41,_0x279a58){return db[_0xa2eb('0x30')]['find']({'where':{'id':_0x19fe41[_0xa2eb('0x4a')]['id']}})[_0xa2eb('0x27')](handleEntityNotFound(_0x279a58,null))[_0xa2eb('0x27')](removeEntity(_0x279a58,null))[_0xa2eb('0x48')](handleError(_0x279a58,null));};exports[_0xa2eb('0x56')]=function(_0x3dbe8d,_0x45d732,_0x21eba0){var _0x9b78b0;return db[_0xa2eb('0x30')][_0xa2eb('0x4c')]({'where':{'id':_0x3dbe8d[_0xa2eb('0x4a')]['id']},'attributes':['id',_0xa2eb('0x57')]})[_0xa2eb('0x27')](handleEntityNotFound(_0x45d732,null))[_0xa2eb('0x27')](function(_0x10ee4b){if(_0x10ee4b){var _0x1c57cd=require(_0xa2eb('0x58'))();_0x1c57cd[_0xa2eb('0x59')](_0x10ee4b[_0xa2eb('0x57')]);_0x1c57cd[_0xa2eb('0x5a')]();return _0x10ee4b;}})['then'](respondWithResult(_0x45d732,null))[_0xa2eb('0x48')](handleError(_0x45d732,null));}; \ No newline at end of file +var _0x040e=['ejs','fs-extra','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','ODBC','UserProfileResource','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','catch','show','params','includeAll','create','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','test','openSync','dsn','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv'];(function(_0x4c8133,_0x584bb0){var _0x51177f=function(_0x3b1cb3){while(--_0x3b1cb3){_0x4c8133['push'](_0x4c8133['shift']());}};_0x51177f(++_0x584bb0);}(_0x040e,0x1c6));var _0xe040=function(_0x240ae4,_0x176d7c){_0x240ae4=_0x240ae4-0x0;var _0x979f45=_0x040e[_0x240ae4];return _0x979f45;};'use strict';var emlformat=require(_0xe040('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe040('0x1'));var jsonpatch=require(_0xe040('0x2'));var rp=require('request-promise');var moment=require(_0xe040('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe040('0x4'));var path=require(_0xe040('0x5'));var sox=require(_0xe040('0x6'));var csv=require(_0xe040('0x7'));var ejs=require(_0xe040('0x8'));var fs=require('fs');var fs_extra=require(_0xe040('0x9'));var _=require('lodash');var squel=require(_0xe040('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe040('0x7'));var querystring=require('querystring');var Papa=require(_0xe040('0xb'));var Redis=require(_0xe040('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe040('0xd'));var as=require(_0xe040('0xe'));var hardwareService=require(_0xe040('0xf'));var logger=require(_0xe040('0x10'))(_0xe040('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe040('0x12'));var db=require(_0xe040('0x13'))['db'];function respondWithStatusCode(_0x185e4c,_0x43439e){_0x43439e=_0x43439e||0xcc;return function(_0x526e30){if(_0x526e30){return _0x185e4c['sendStatus'](_0x43439e);}return _0x185e4c[_0xe040('0x14')](_0x43439e)[_0xe040('0x15')]();};}function respondWithResult(_0x132326,_0x36f263){_0x36f263=_0x36f263||0xc8;return function(_0x200645){if(_0x200645){return _0x132326[_0xe040('0x14')](_0x36f263)[_0xe040('0x16')](_0x200645);}};}function respondWithFilteredResult(_0xb4cf77,_0x151607){return function(_0xe82ed5){if(_0xe82ed5){var _0xb2bf13=typeof _0x151607[_0xe040('0x17')]===_0xe040('0x18')&&typeof _0x151607[_0xe040('0x19')]===_0xe040('0x18');var _0x300a5a=_0xe82ed5[_0xe040('0x1a')];var _0x34de25=_0xb2bf13?0x0:_0x151607['offset'];var _0x27a37f=_0xb2bf13?_0xe82ed5[_0xe040('0x1a')]:_0x151607[_0xe040('0x17')]+_0x151607['limit'];var _0x4f3eb1;if(_0x27a37f>=_0x300a5a){_0x27a37f=_0x300a5a;_0x4f3eb1=0xc8;}else{_0x4f3eb1=0xce;}_0xb4cf77[_0xe040('0x14')](_0x4f3eb1);return _0xb4cf77[_0xe040('0x1b')]('Content-Range',_0x34de25+'-'+_0x27a37f+'/'+_0x300a5a)[_0xe040('0x16')](_0xe82ed5);}return null;};}function patchUpdates(_0x4e2390){return function(_0xebe58f){try{jsonpatch['apply'](_0xebe58f,_0x4e2390,!![]);}catch(_0x144e7b){return BPromise[_0xe040('0x1c')](_0x144e7b);}return _0xebe58f['save']();};}function saveUpdates(_0x1b3875,_0x2c94a3){return function(_0x1719da){if(_0x1719da){return _0x1719da[_0xe040('0x1d')](_0x1b3875)[_0xe040('0x1e')](function(_0xed37e5){return _0xed37e5;});}return null;};}function removeEntity(_0x3316dd,_0xb77b26){return function(_0x1cc533){if(_0x1cc533){return _0x1cc533[_0xe040('0x1f')]()[_0xe040('0x1e')](function(){var _0x51e584=_0x1cc533[_0xe040('0x20')]({'plain':!![]});var _0x12ae9b=_0xe040('0x21');return db[_0xe040('0x22')][_0xe040('0x1f')]({'where':{'type':_0x12ae9b,'resourceId':_0x51e584['id']}})['then'](function(){return _0x1cc533;});})[_0xe040('0x1e')](function(){_0x3316dd[_0xe040('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c396,_0x4127ad){return function(_0x3e4252){if(!_0x3e4252){_0x45c396['sendStatus'](0x194);}return _0x3e4252;};}function handleError(_0x469854,_0x1691bd){_0x1691bd=_0x1691bd||0x1f4;return function(_0x54808d){logger['error'](_0x54808d[_0xe040('0x23')]);if(_0x54808d[_0xe040('0x24')]){delete _0x54808d[_0xe040('0x24')];}_0x469854[_0xe040('0x14')](_0x1691bd)['send'](_0x54808d);};}exports[_0xe040('0x25')]=function(_0x41b29f,_0x11beb3){var _0x27e15b={},_0x2cd25f={},_0x2abac3={'count':0x0,'rows':[]};var _0x2771e1=_[_0xe040('0x26')](db[_0xe040('0x27')][_0xe040('0x28')],function(_0x17d3e3){return{'name':_0x17d3e3[_0xe040('0x29')],'type':_0x17d3e3[_0xe040('0x2a')][_0xe040('0x2b')]};});_0x2cd25f[_0xe040('0x2c')]=_['map'](_0x2771e1,_0xe040('0x24'));_0x2cd25f[_0xe040('0x2d')]=_[_0xe040('0x2e')](_0x41b29f['query']);_0x2cd25f[_0xe040('0x2f')]=_['intersection'](_0x2cd25f['model'],_0x2cd25f[_0xe040('0x2d')]);_0x27e15b[_0xe040('0x30')]=_[_0xe040('0x31')](_0x2cd25f[_0xe040('0x2c')],qs[_0xe040('0x32')](_0x41b29f[_0xe040('0x2d')][_0xe040('0x32')]));_0x27e15b[_0xe040('0x30')]=_0x27e15b[_0xe040('0x30')][_0xe040('0x33')]?_0x27e15b[_0xe040('0x30')]:_0x2cd25f['model'];if(!_0x41b29f[_0xe040('0x2d')][_0xe040('0x34')](_0xe040('0x35'))){_0x27e15b[_0xe040('0x19')]=qs[_0xe040('0x19')](_0x41b29f[_0xe040('0x2d')]['limit']);_0x27e15b[_0xe040('0x17')]=qs['offset'](_0x41b29f[_0xe040('0x2d')][_0xe040('0x17')]);}_0x27e15b[_0xe040('0x36')]=qs['sort'](_0x41b29f[_0xe040('0x2d')][_0xe040('0x37')]);_0x27e15b[_0xe040('0x38')]=qs[_0xe040('0x2f')](_[_0xe040('0x39')](_0x41b29f[_0xe040('0x2d')],_0x2cd25f[_0xe040('0x2f')]),_0x2771e1);if(_0x41b29f[_0xe040('0x2d')]['filter']){_0x27e15b['where']=_[_0xe040('0x3a')](_0x27e15b[_0xe040('0x38')],{'$or':_['map'](_0x2771e1,function(_0x155ac6){if(_0x155ac6[_0xe040('0x2a')]!=='VIRTUAL'){var _0x58fa24={};_0x58fa24[_0x155ac6['name']]={'$like':'%'+_0x41b29f[_0xe040('0x2d')][_0xe040('0x3b')]+'%'};return _0x58fa24;}})});}_0x27e15b=_[_0xe040('0x3a')]({},_0x27e15b,_0x41b29f[_0xe040('0x3c')]);var _0x14cee1={'where':_0x27e15b[_0xe040('0x38')]};return db[_0xe040('0x27')][_0xe040('0x1a')](_0x14cee1)[_0xe040('0x1e')](function(_0x333152){_0x2abac3[_0xe040('0x1a')]=_0x333152;if(_0x41b29f[_0xe040('0x2d')]['includeAll']){_0x27e15b[_0xe040('0x3d')]=[{'all':!![]}];}return db[_0xe040('0x27')]['findAll'](_0x27e15b);})[_0xe040('0x1e')](function(_0x193ccf){_0x2abac3['rows']=_0x193ccf;return _0x2abac3;})['then'](respondWithFilteredResult(_0x11beb3,_0x27e15b))[_0xe040('0x3e')](handleError(_0x11beb3,null));};exports[_0xe040('0x3f')]=function(_0x1a6e7c,_0x5cd404){var _0x59986e={'raw':!![],'where':{'id':_0x1a6e7c[_0xe040('0x40')]['id']}},_0x303981={};_0x303981[_0xe040('0x2c')]=_[_0xe040('0x2e')](db['SquareOdbc'][_0xe040('0x28')]);_0x303981[_0xe040('0x2d')]=_[_0xe040('0x2e')](_0x1a6e7c[_0xe040('0x2d')]);_0x303981['filters']=_[_0xe040('0x31')](_0x303981[_0xe040('0x2c')],_0x303981[_0xe040('0x2d')]);_0x59986e[_0xe040('0x30')]=_[_0xe040('0x31')](_0x303981[_0xe040('0x2c')],qs[_0xe040('0x32')](_0x1a6e7c[_0xe040('0x2d')][_0xe040('0x32')]));_0x59986e[_0xe040('0x30')]=_0x59986e[_0xe040('0x30')]['length']?_0x59986e[_0xe040('0x30')]:_0x303981[_0xe040('0x2c')];if(_0x1a6e7c[_0xe040('0x2d')][_0xe040('0x41')]){_0x59986e[_0xe040('0x3d')]=[{'all':!![]}];}_0x59986e=_['merge']({},_0x59986e,_0x1a6e7c[_0xe040('0x3c')]);return db['SquareOdbc']['find'](_0x59986e)['then'](handleEntityNotFound(_0x5cd404,null))[_0xe040('0x1e')](respondWithResult(_0x5cd404,null))[_0xe040('0x3e')](handleError(_0x5cd404,null));};exports[_0xe040('0x42')]=function(_0x483468,_0x12a256){return db[_0xe040('0x27')][_0xe040('0x42')](_0x483468[_0xe040('0x43')],{})['then'](function(_0x461348){var _0x3971e8=_0x483468[_0xe040('0x44')][_0xe040('0x20')]({'plain':!![]});if(!_0x3971e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3971e8[_0xe040('0x45')]===_0xe040('0x44')){var _0x235c1b=_0x461348[_0xe040('0x20')]({'plain':!![]});var _0x557cf1=_0xe040('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x557cf1,'userProfileId':_0x3971e8[_0xe040('0x46')]},'raw':!![]})[_0xe040('0x1e')](function(_0x2c8260){if(_0x2c8260&&_0x2c8260['autoAssociation']===0x0){return db['UserProfileResource'][_0xe040('0x42')]({'name':_0x235c1b['name'],'resourceId':_0x235c1b['id'],'type':_0x2c8260['name'],'sectionId':_0x2c8260['id']},{})[_0xe040('0x1e')](function(){return _0x461348;});}else{return _0x461348;}})['catch'](function(_0x586c40){logger[_0xe040('0x47')](_0xe040('0x48'),_0x586c40);throw _0x586c40;});}return _0x461348;})[_0xe040('0x1e')](respondWithResult(_0x12a256,0xc9))[_0xe040('0x3e')](handleError(_0x12a256,null));};exports[_0xe040('0x1d')]=function(_0x5841bc,_0x1181c5){if(_0x5841bc[_0xe040('0x43')]['id']){delete _0x5841bc[_0xe040('0x43')]['id'];}return db[_0xe040('0x27')][_0xe040('0x49')]({'where':{'id':_0x5841bc['params']['id']}})[_0xe040('0x1e')](handleEntityNotFound(_0x1181c5,null))[_0xe040('0x1e')](saveUpdates(_0x5841bc['body'],null))[_0xe040('0x1e')](respondWithResult(_0x1181c5,null))['catch'](handleError(_0x1181c5,null));};exports['destroy']=function(_0x5a22a5,_0x1dd732){return db[_0xe040('0x27')][_0xe040('0x49')]({'where':{'id':_0x5a22a5[_0xe040('0x40')]['id']}})[_0xe040('0x1e')](handleEntityNotFound(_0x1dd732,null))[_0xe040('0x1e')](removeEntity(_0x1dd732,null))[_0xe040('0x3e')](handleError(_0x1dd732,null));};exports[_0xe040('0x4a')]=function(_0x34791e,_0x1fe13c,_0x32f463){var _0x4ce21a;return db['SquareOdbc'][_0xe040('0x49')]({'where':{'id':_0x34791e[_0xe040('0x40')]['id']},'attributes':['id','dsn']})[_0xe040('0x1e')](handleEntityNotFound(_0x1fe13c,null))[_0xe040('0x1e')](function(_0x232a53){if(_0x232a53){var _0x30f1aa=require('odbc')();_0x30f1aa[_0xe040('0x4b')](_0x232a53[_0xe040('0x4c')]);_0x30f1aa['closeSync']();return _0x232a53;}})['then'](respondWithResult(_0x1fe13c,null))[_0xe040('0x3e')](handleError(_0x1fe13c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 65e205f..40b6492 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 _0xfd68=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0xfd68,0xfd));var _0x8fd6=function(_0xf703dc,_0x3795f0){_0xf703dc=_0xf703dc-0x0;var _0x30beb2=_0xfd68[_0xf703dc];return _0x30beb2;};'use strict';var _=require(_0x8fd6('0x0'));var util=require(_0x8fd6('0x1'));var logger=require(_0x8fd6('0x2'))('api');var moment=require(_0x8fd6('0x3'));var BPromise=require(_0x8fd6('0x4'));var rp=require(_0x8fd6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8fd6('0x6'));var config=require(_0x8fd6('0x7'));var attributes=require(_0x8fd6('0x8'));module['exports']=function(_0x3577f2,_0x506c79){return _0x3577f2['define'](_0x8fd6('0x9'),attributes,{'tableName':_0x8fd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b84=['util','../../config/logger','api','moment','request-promise','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x5ef24c,_0x4cd8af){var _0x5ebf62=function(_0x3ab433){while(--_0x3ab433){_0x5ef24c['push'](_0x5ef24c['shift']());}};_0x5ebf62(++_0x4cd8af);}(_0x5b84,0xfb));var _0x45b8=function(_0x23a2af,_0x544724){_0x23a2af=_0x23a2af-0x0;var _0x89c92b=_0x5b84[_0x23a2af];return _0x89c92b;};'use strict';var _=require(_0x45b8('0x0'));var util=require(_0x45b8('0x1'));var logger=require(_0x45b8('0x2'))(_0x45b8('0x3'));var moment=require(_0x45b8('0x4'));var BPromise=require('bluebird');var rp=require(_0x45b8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x45b8('0x7'));module[_0x45b8('0x8')]=function(_0x4fca72,_0xb9adbb){return _0x4fca72[_0x45b8('0x9')](_0x45b8('0xa'),attributes,{'tableName':_0x45b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 8e125df..4d783b5 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 _0x3fec=['ShowSquareOdbc','find','options','include','model','attributes','map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch'];(function(_0x2bb96b,_0x4352f6){var _0x669d2d=function(_0x38131c){while(--_0x38131c){_0x2bb96b['push'](_0x2bb96b['shift']());}};_0x669d2d(++_0x4352f6);}(_0x3fec,0x167));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc3fe('0x0'));var moment=require(_0xc3fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xc3fe('0x2'));var fs=require('fs');var Redis=require(_0xc3fe('0x3'));var db=require(_0xc3fe('0x4'))['db'];var utils=require(_0xc3fe('0x5'));var logger=require(_0xc3fe('0x6'))(_0xc3fe('0x7'));var config=require(_0xc3fe('0x8'));var jayson=require(_0xc3fe('0x9'));var client=jayson[_0xc3fe('0xa')][_0xc3fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59cd71,_0x152d3c,_0x510986){return new BPromise(function(_0x1ba9c0,_0x2d617e){return client[_0xc3fe('0xc')](_0x59cd71,_0x510986)[_0xc3fe('0xd')](function(_0xdb5c60){logger[_0xc3fe('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x152d3c,'request\x20sent');logger[_0xc3fe('0xf')](_0xc3fe('0x10'),_0x152d3c,_0xc3fe('0x11'),JSON[_0xc3fe('0x12')](_0xdb5c60));if(_0xdb5c60[_0xc3fe('0x13')]){if(_0xdb5c60[_0xc3fe('0x13')][_0xc3fe('0x14')]===0x1f4){logger[_0xc3fe('0x13')](_0xc3fe('0x15'),_0x152d3c,_0xdb5c60['error'][_0xc3fe('0x16')]);return _0x2d617e(_0xdb5c60[_0xc3fe('0x13')][_0xc3fe('0x16')]);}logger[_0xc3fe('0x13')](_0xc3fe('0x15'),_0x152d3c,_0xdb5c60[_0xc3fe('0x13')][_0xc3fe('0x16')]);return _0x1ba9c0(_0xdb5c60['error'][_0xc3fe('0x16')]);}else{logger[_0xc3fe('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x152d3c,'request\x20sent');_0x1ba9c0(_0xdb5c60[_0xc3fe('0x17')][_0xc3fe('0x16')]);}})[_0xc3fe('0x18')](function(_0x2ae770){logger[_0xc3fe('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x152d3c,_0x2ae770);_0x2d617e(_0x2ae770);});});}exports[_0xc3fe('0x19')]=function(_0x13e133){var _0x487b55=this;return new Promise(function(_0x64a811,_0x484b8e){return db['SquareOdbc'][_0xc3fe('0x1a')]({'raw':_0x13e133[_0xc3fe('0x1b')]?_0x13e133['options']['raw']===undefined?!![]:![]:!![],'where':_0x13e133['options']?_0x13e133[_0xc3fe('0x1b')]['where']||null:null,'attributes':_0x13e133[_0xc3fe('0x1b')]?_0x13e133[_0xc3fe('0x1b')]['attributes']||null:null,'include':_0x13e133[_0xc3fe('0x1b')]?_0x13e133[_0xc3fe('0x1b')][_0xc3fe('0x1c')]?_['map'](_0x13e133[_0xc3fe('0x1b')]['include'],function(_0x13ec12){return{'model':db[_0x13ec12[_0xc3fe('0x1d')]],'as':_0x13ec12['as'],'attributes':_0x13ec12[_0xc3fe('0x1e')],'include':_0x13ec12[_0xc3fe('0x1c')]?_[_0xc3fe('0x1f')](_0x13ec12[_0xc3fe('0x1c')],function(_0x41206f){return{'model':db[_0x41206f['model']],'as':_0x41206f['as'],'attributes':_0x41206f[_0xc3fe('0x1e')],'include':_0x41206f[_0xc3fe('0x1c')]?_['map'](_0x41206f[_0xc3fe('0x1c')],function(_0x39d809){return{'model':db[_0x39d809[_0xc3fe('0x1d')]],'as':_0x39d809['as'],'attributes':_0x39d809[_0xc3fe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc3fe('0xd')](function(_0x43c8b4){logger[_0xc3fe('0xe')](_0xc3fe('0x19'),_0x13e133);logger[_0xc3fe('0xf')](_0xc3fe('0x19'),_0x13e133,JSON[_0xc3fe('0x12')](_0x43c8b4));_0x64a811(_0x43c8b4);})[_0xc3fe('0x18')](function(_0x30fea0){logger[_0xc3fe('0x13')](_0xc3fe('0x19'),_0x30fea0[_0xc3fe('0x16')],_0x13e133);_0x484b8e(_0x487b55[_0xc3fe('0x13')](0x1f4,_0x30fea0[_0xc3fe('0x16')]));});});}; \ No newline at end of file +var _0xb08c=['SquareOdbc','find','options','raw','where','attributes','include','model','map','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSquareOdbc'];(function(_0x54eeef,_0x37b502){var _0x323505=function(_0xc61a41){while(--_0xc61a41){_0x54eeef['push'](_0x54eeef['shift']());}};_0x323505(++_0x37b502);}(_0xb08c,0x17e));var _0xcb08=function(_0x3cf9d4,_0x4605c0){_0x3cf9d4=_0x3cf9d4-0x0;var _0x2a7cdf=_0xb08c[_0x3cf9d4];return _0x2a7cdf;};'use strict';var _=require('lodash');var util=require(_0xcb08('0x0'));var moment=require(_0xcb08('0x1'));var BPromise=require(_0xcb08('0x2'));var rs=require(_0xcb08('0x3'));var fs=require('fs');var Redis=require(_0xcb08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb08('0x5'));var logger=require('../../config/logger')(_0xcb08('0x6'));var config=require('../../config/environment');var jayson=require(_0xcb08('0x7'));var client=jayson['client'][_0xcb08('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x506b12,_0x5ae72c,_0x28b178){return new BPromise(function(_0x244d44,_0x46eab9){return client[_0xcb08('0x9')](_0x506b12,_0x28b178)[_0xcb08('0xa')](function(_0x1c7305){logger[_0xcb08('0xb')](_0xcb08('0xc'),_0x5ae72c,_0xcb08('0xd'));logger[_0xcb08('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x5ae72c,_0xcb08('0xd'),JSON[_0xcb08('0xf')](_0x1c7305));if(_0x1c7305[_0xcb08('0x10')]){if(_0x1c7305[_0xcb08('0x10')][_0xcb08('0x11')]===0x1f4){logger[_0xcb08('0x10')](_0xcb08('0xc'),_0x5ae72c,_0x1c7305[_0xcb08('0x10')][_0xcb08('0x12')]);return _0x46eab9(_0x1c7305[_0xcb08('0x10')]['message']);}logger[_0xcb08('0x10')](_0xcb08('0xc'),_0x5ae72c,_0x1c7305['error'][_0xcb08('0x12')]);return _0x244d44(_0x1c7305[_0xcb08('0x10')][_0xcb08('0x12')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x5ae72c,_0xcb08('0xd'));_0x244d44(_0x1c7305[_0xcb08('0x13')][_0xcb08('0x12')]);}})['catch'](function(_0x810dcb){logger[_0xcb08('0x10')](_0xcb08('0xc'),_0x5ae72c,_0x810dcb);_0x46eab9(_0x810dcb);});});}exports[_0xcb08('0x14')]=function(_0x30f8af){var _0x43908a=this;return new Promise(function(_0xf146a9,_0x2ab0d3){return db[_0xcb08('0x15')][_0xcb08('0x16')]({'raw':_0x30f8af['options']?_0x30f8af[_0xcb08('0x17')][_0xcb08('0x18')]===undefined?!![]:![]:!![],'where':_0x30f8af[_0xcb08('0x17')]?_0x30f8af[_0xcb08('0x17')][_0xcb08('0x19')]||null:null,'attributes':_0x30f8af[_0xcb08('0x17')]?_0x30f8af[_0xcb08('0x17')][_0xcb08('0x1a')]||null:null,'include':_0x30f8af[_0xcb08('0x17')]?_0x30f8af['options'][_0xcb08('0x1b')]?_['map'](_0x30f8af[_0xcb08('0x17')][_0xcb08('0x1b')],function(_0x2ad336){return{'model':db[_0x2ad336[_0xcb08('0x1c')]],'as':_0x2ad336['as'],'attributes':_0x2ad336[_0xcb08('0x1a')],'include':_0x2ad336[_0xcb08('0x1b')]?_['map'](_0x2ad336[_0xcb08('0x1b')],function(_0x34e7c9){return{'model':db[_0x34e7c9[_0xcb08('0x1c')]],'as':_0x34e7c9['as'],'attributes':_0x34e7c9[_0xcb08('0x1a')],'include':_0x34e7c9[_0xcb08('0x1b')]?_[_0xcb08('0x1d')](_0x34e7c9[_0xcb08('0x1b')],function(_0x340856){return{'model':db[_0x340856[_0xcb08('0x1c')]],'as':_0x340856['as'],'attributes':_0x340856[_0xcb08('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcb08('0xa')](function(_0x1f04db){logger[_0xcb08('0xb')](_0xcb08('0x14'),_0x30f8af);logger[_0xcb08('0xe')](_0xcb08('0x14'),_0x30f8af,JSON[_0xcb08('0xf')](_0x1f04db));_0xf146a9(_0x1f04db);})[_0xcb08('0x1e')](function(_0x5e6578){logger[_0xcb08('0x10')](_0xcb08('0x14'),_0x5e6578[_0xcb08('0x12')],_0x30f8af);_0x2ab0d3(_0x43908a['error'](0x1f4,_0x5e6578['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f1782fd..7531126 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 _0x19e1=['getUsers','create','post','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','show','/:id/users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19e1,0x163));var _0x119e=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x19e1[_0x4d79bc];return _0x4b4760;};'use strict';var multer=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var path=require(_0x119e('0x2'));var timeout=require(_0x119e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x119e('0x4'));var auth=require(_0x119e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119e('0x6'));var controller=require(_0x119e('0x7'));router['get']('/',auth[_0x119e('0x8')](),controller['index']);router[_0x119e('0x9')](_0x119e('0xa'),auth[_0x119e('0x8')](),controller[_0x119e('0xb')]);router['get'](_0x119e('0xc'),auth[_0x119e('0x8')](),controller[_0x119e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x119e('0xe')]);router[_0x119e('0xf')](_0x119e('0xc'),auth[_0x119e('0x8')](),controller[_0x119e('0x10')]);router[_0x119e('0x11')](_0x119e('0xa'),auth['isAuthenticated'](),controller[_0x119e('0x12')]);router[_0x119e('0x13')](_0x119e('0xa'),auth[_0x119e('0x8')](),controller[_0x119e('0x14')]);router[_0x119e('0x13')]('/:id/users',auth[_0x119e('0x8')](),controller[_0x119e('0x15')]);module[_0x119e('0x16')]=router; \ No newline at end of file +var _0x4ad3=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy'];(function(_0x4f6fbf,_0x28b5dd){var _0x118c51=function(_0x303ff2){while(--_0x303ff2){_0x4f6fbf['push'](_0x4f6fbf['shift']());}};_0x118c51(++_0x28b5dd);}(_0x4ad3,0x1b1));var _0x34ad=function(_0xd98ca3,_0x38fbd9){_0xd98ca3=_0xd98ca3-0x0;var _0x35960d=_0x4ad3[_0xd98ca3];return _0x35960d;};'use strict';var multer=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var path=require(_0x34ad('0x2'));var timeout=require(_0x34ad('0x3'));var express=require(_0x34ad('0x4'));var router=express[_0x34ad('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x34ad('0x6'));var interaction=require(_0x34ad('0x7'));var config=require(_0x34ad('0x8'));var controller=require(_0x34ad('0x9'));router[_0x34ad('0xa')]('/',auth[_0x34ad('0xb')](),controller[_0x34ad('0xc')]);router[_0x34ad('0xa')](_0x34ad('0xd'),auth[_0x34ad('0xb')](),controller['show']);router['get'](_0x34ad('0xe'),auth[_0x34ad('0xb')](),controller[_0x34ad('0xf')]);router[_0x34ad('0x10')]('/',auth['isAuthenticated'](),controller[_0x34ad('0x11')]);router[_0x34ad('0x10')](_0x34ad('0xe'),auth[_0x34ad('0xb')](),controller[_0x34ad('0x12')]);router[_0x34ad('0x13')](_0x34ad('0xd'),auth[_0x34ad('0xb')](),controller[_0x34ad('0x14')]);router[_0x34ad('0x15')](_0x34ad('0xd'),auth[_0x34ad('0xb')](),controller[_0x34ad('0x16')]);router[_0x34ad('0x15')](_0x34ad('0xe'),auth[_0x34ad('0xb')](),controller['removeUsers']);module[_0x34ad('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 77f0a71..50ecd10 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 _0x2fd5=['DATE','sequelize','exports','STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8','production'];(function(_0x56f530,_0x38a38a){var _0x577d6d=function(_0x19ec64){while(--_0x19ec64){_0x56f530['push'](_0x56f530['shift']());}};_0x577d6d(++_0x38a38a);}(_0x2fd5,0x182));var _0x52fd=function(_0x2e4ad1,_0x3a19fd){_0x2e4ad1=_0x2e4ad1-0x0;var _0x3ffd0e=_0x2fd5[_0x2e4ad1];return _0x3ffd0e;};'use strict';var Sequelize=require(_0x52fd('0x0'));module[_0x52fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x52fd('0x2')]},'notes':{'type':Sequelize[_0x52fd('0x3')]},'preproduction':{'type':Sequelize[_0x52fd('0x4')]('long'),'get':function(){if(this[_0x52fd('0x5')](_0x52fd('0x6'))){return this['getDataValue'](_0x52fd('0x6'))[_0x52fd('0x7')](_0x52fd('0x8'));}}},'production':{'type':Sequelize[_0x52fd('0x4')]('long'),'get':function(){if(this[_0x52fd('0x5')](_0x52fd('0x9'))){return this['getDataValue'](_0x52fd('0x9'))[_0x52fd('0x7')](_0x52fd('0x8'));}}},'savedAt':{'type':Sequelize[_0x52fd('0xa')]},'publishedAt':{'type':Sequelize[_0x52fd('0xa')]}}; \ No newline at end of file +var _0x031d=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x031d,0x1b7));var _0xd031=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x031d[_0x2605dc];return _0x4568c9;};'use strict';var Sequelize=require(_0xd031('0x0'));module[_0xd031('0x1')]={'name':{'type':Sequelize[_0xd031('0x2')],'unique':_0xd031('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd031('0x2')]},'notes':{'type':Sequelize[_0xd031('0x4')]},'preproduction':{'type':Sequelize[_0xd031('0x5')](_0xd031('0x6')),'get':function(){if(this[_0xd031('0x7')](_0xd031('0x8'))){return this[_0xd031('0x7')](_0xd031('0x8'))[_0xd031('0x9')](_0xd031('0xa'));}}},'production':{'type':Sequelize[_0xd031('0x5')](_0xd031('0x6')),'get':function(){if(this[_0xd031('0x7')](_0xd031('0xb'))){return this[_0xd031('0x7')](_0xd031('0xb'))[_0xd031('0x9')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xd031('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index cc3882c..c01aa2c 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 _0x1fbf=['mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','SquareProject','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','body','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x7eac77,_0x83fc1b){var _0x31c17c=function(_0x5384b7){while(--_0x5384b7){_0x7eac77['push'](_0x7eac77['shift']());}};_0x31c17c(++_0x83fc1b);}(_0x1fbf,0x17a));var _0xf1fb=function(_0x385895,_0xf937a){_0x385895=_0x385895-0x0;var _0xc01ec5=_0x1fbf[_0x385895];return _0xc01ec5;};'use strict';var emlformat=require(_0xf1fb('0x0'));var rimraf=require(_0xf1fb('0x1'));var zipdir=require(_0xf1fb('0x2'));var jsonpatch=require(_0xf1fb('0x3'));var rp=require(_0xf1fb('0x4'));var moment=require(_0xf1fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf1fb('0x6'));var util=require(_0xf1fb('0x7'));var path=require(_0xf1fb('0x8'));var sox=require(_0xf1fb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1fb('0xa'));var squel=require(_0xf1fb('0xb'));var crypto=require(_0xf1fb('0xc'));var jsforce=require(_0xf1fb('0xd'));var deskjs=require(_0xf1fb('0xe'));var toCsv=require(_0xf1fb('0xf'));var querystring=require(_0xf1fb('0x10'));var Papa=require(_0xf1fb('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1fb('0x12'));var as=require(_0xf1fb('0x13'));var hardwareService=require(_0xf1fb('0x14'));var logger=require(_0xf1fb('0x15'))(_0xf1fb('0x16'));var utils=require(_0xf1fb('0x17'));var config=require(_0xf1fb('0x18'));var licenseUtil=require(_0xf1fb('0x19'));var db=require(_0xf1fb('0x1a'))['db'];config[_0xf1fb('0x1b')]=_[_0xf1fb('0x1c')](config[_0xf1fb('0x1b')],{'host':_0xf1fb('0x1d'),'port':0x18eb});var socket=require(_0xf1fb('0x1e'))(new Redis(config[_0xf1fb('0x1b')]));require('./squareProject.socket')[_0xf1fb('0x1f')](socket);function respondWithStatusCode(_0x31d5ac,_0xe6a40c){_0xe6a40c=_0xe6a40c||0xcc;return function(_0xbb8cc9){if(_0xbb8cc9){return _0x31d5ac[_0xf1fb('0x20')](_0xe6a40c);}return _0x31d5ac[_0xf1fb('0x21')](_0xe6a40c)['end']();};}function respondWithResult(_0x335bb8,_0x17851f){_0x17851f=_0x17851f||0xc8;return function(_0x31411a){if(_0x31411a){return _0x335bb8[_0xf1fb('0x21')](_0x17851f)['json'](_0x31411a);}};}function respondWithFilteredResult(_0x223d1f,_0xb5e5d1){return function(_0x570108){if(_0x570108){var _0x582746=typeof _0xb5e5d1[_0xf1fb('0x22')]===_0xf1fb('0x23')&&typeof _0xb5e5d1[_0xf1fb('0x24')]===_0xf1fb('0x23');var _0x220d5e=_0x570108[_0xf1fb('0x25')];var _0x5e1471=_0x582746?0x0:_0xb5e5d1['offset'];var _0x4861d7=_0x582746?_0x570108[_0xf1fb('0x25')]:_0xb5e5d1[_0xf1fb('0x22')]+_0xb5e5d1[_0xf1fb('0x24')];var _0x452a2f;if(_0x4861d7>=_0x220d5e){_0x4861d7=_0x220d5e;_0x452a2f=0xc8;}else{_0x452a2f=0xce;}_0x223d1f['status'](_0x452a2f);return _0x223d1f[_0xf1fb('0x26')]('Content-Range',_0x5e1471+'-'+_0x4861d7+'/'+_0x220d5e)[_0xf1fb('0x27')](_0x570108);}return null;};}function patchUpdates(_0x4daac6){return function(_0x453b71){try{jsonpatch['apply'](_0x453b71,_0x4daac6,!![]);}catch(_0x52edaa){return BPromise['reject'](_0x52edaa);}return _0x453b71['save']();};}function saveUpdates(_0x5ad158,_0x52fa63){return function(_0x339446){if(_0x339446){return _0x339446[_0xf1fb('0x28')](_0x5ad158)[_0xf1fb('0x29')](function(_0x57edb5){return _0x57edb5;});}return null;};}function removeEntity(_0x45fb0b,_0x5e6521){return function(_0x67dd81){if(_0x67dd81){return _0x67dd81[_0xf1fb('0x2a')]()['then'](function(){var _0x10b15d=_0x67dd81[_0xf1fb('0x2b')]({'plain':!![]});var _0x32799f=_0xf1fb('0x2c');return db[_0xf1fb('0x2d')][_0xf1fb('0x2a')]({'where':{'type':_0x32799f,'resourceId':_0x10b15d['id']}})['then'](function(){return _0x67dd81;});})['then'](function(){_0x45fb0b[_0xf1fb('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423d91,_0x3ecfb2){return function(_0x31fc23){if(!_0x31fc23){_0x423d91[_0xf1fb('0x20')](0x194);}return _0x31fc23;};}function handleError(_0x262513,_0xa01cc1){_0xa01cc1=_0xa01cc1||0x1f4;return function(_0x6fc305){logger[_0xf1fb('0x2e')](_0x6fc305[_0xf1fb('0x2f')]);if(_0x6fc305[_0xf1fb('0x30')]){delete _0x6fc305[_0xf1fb('0x30')];}_0x262513[_0xf1fb('0x21')](_0xa01cc1)[_0xf1fb('0x31')](_0x6fc305);};}exports[_0xf1fb('0x32')]=function(_0x414b50,_0x3f43ca){var _0x29cb23={},_0x407828={},_0x44c8cf={'count':0x0,'rows':[]};var _0x40d56=_[_0xf1fb('0x33')](db['SquareProject'][_0xf1fb('0x34')],function(_0xc357da){return{'name':_0xc357da['fieldName'],'type':_0xc357da[_0xf1fb('0x35')][_0xf1fb('0x36')]};});_0x407828['model']=_[_0xf1fb('0x33')](_0x40d56,'name');_0x407828[_0xf1fb('0x37')]=_['keys'](_0x414b50[_0xf1fb('0x37')]);_0x407828[_0xf1fb('0x38')]=_[_0xf1fb('0x39')](_0x407828['model'],_0x407828[_0xf1fb('0x37')]);_0x29cb23['attributes']=_['intersection'](_0x407828[_0xf1fb('0x3a')],qs[_0xf1fb('0x3b')](_0x414b50[_0xf1fb('0x37')][_0xf1fb('0x3b')]));_0x29cb23['attributes']=_0x29cb23[_0xf1fb('0x3c')]['length']?_0x29cb23[_0xf1fb('0x3c')]:_0x407828[_0xf1fb('0x3a')];if(!_0x414b50[_0xf1fb('0x37')][_0xf1fb('0x3d')](_0xf1fb('0x3e'))){_0x29cb23[_0xf1fb('0x24')]=qs[_0xf1fb('0x24')](_0x414b50['query'][_0xf1fb('0x24')]);_0x29cb23[_0xf1fb('0x22')]=qs['offset'](_0x414b50['query'][_0xf1fb('0x22')]);}_0x29cb23[_0xf1fb('0x3f')]=qs['sort'](_0x414b50[_0xf1fb('0x37')][_0xf1fb('0x40')]);_0x29cb23[_0xf1fb('0x41')]=qs[_0xf1fb('0x38')](_[_0xf1fb('0x42')](_0x414b50[_0xf1fb('0x37')],_0x407828['filters']),_0x40d56);if(_0x414b50[_0xf1fb('0x37')][_0xf1fb('0x43')]){_0x29cb23['where']=_[_0xf1fb('0x44')](_0x29cb23[_0xf1fb('0x41')],{'$or':_[_0xf1fb('0x33')](_0x40d56,function(_0x1d48ed){if(_0x1d48ed[_0xf1fb('0x35')]!=='VIRTUAL'){var _0x5fa0f8={};_0x5fa0f8[_0x1d48ed[_0xf1fb('0x30')]]={'$like':'%'+_0x414b50['query'][_0xf1fb('0x43')]+'%'};return _0x5fa0f8;}})});}_0x29cb23=_['merge']({},_0x29cb23,_0x414b50[_0xf1fb('0x45')]);var _0x30b266={'where':_0x29cb23[_0xf1fb('0x41')]};return db['SquareProject'][_0xf1fb('0x25')](_0x30b266)[_0xf1fb('0x29')](function(_0x412b83){_0x44c8cf[_0xf1fb('0x25')]=_0x412b83;if(_0x414b50[_0xf1fb('0x37')][_0xf1fb('0x46')]){_0x29cb23[_0xf1fb('0x47')]=[{'all':!![]}];}return db['SquareProject'][_0xf1fb('0x48')](_0x29cb23);})[_0xf1fb('0x29')](function(_0x224bf7){_0x44c8cf[_0xf1fb('0x49')]=_0x224bf7;return _0x44c8cf;})[_0xf1fb('0x29')](respondWithFilteredResult(_0x3f43ca,_0x29cb23))[_0xf1fb('0x4a')](handleError(_0x3f43ca,null));};exports[_0xf1fb('0x4b')]=function(_0x23a2fb,_0x328ffb){var _0x3ea056={'raw':![],'where':{'id':_0x23a2fb['params']['id']}},_0x1dd13a={};_0x1dd13a[_0xf1fb('0x3a')]=_[_0xf1fb('0x4c')](db['SquareProject'][_0xf1fb('0x34')]);_0x1dd13a['query']=_['keys'](_0x23a2fb['query']);_0x1dd13a[_0xf1fb('0x38')]=_['intersection'](_0x1dd13a['model'],_0x1dd13a[_0xf1fb('0x37')]);_0x3ea056[_0xf1fb('0x3c')]=_[_0xf1fb('0x39')](_0x1dd13a[_0xf1fb('0x3a')],qs[_0xf1fb('0x3b')](_0x23a2fb['query'][_0xf1fb('0x3b')]));_0x3ea056[_0xf1fb('0x3c')]=_0x3ea056[_0xf1fb('0x3c')][_0xf1fb('0x4d')]?_0x3ea056[_0xf1fb('0x3c')]:_0x1dd13a[_0xf1fb('0x3a')];if(_0x23a2fb[_0xf1fb('0x37')][_0xf1fb('0x46')]){_0x3ea056[_0xf1fb('0x47')]=[{'all':!![]}];}_0x3ea056=_[_0xf1fb('0x44')]({},_0x3ea056,_0x23a2fb[_0xf1fb('0x45')]);return db[_0xf1fb('0x4e')][_0xf1fb('0x4f')](_0x3ea056)['then'](handleEntityNotFound(_0x328ffb,null))[_0xf1fb('0x29')](respondWithResult(_0x328ffb,null))['catch'](handleError(_0x328ffb,null));};exports[_0xf1fb('0x50')]=function(_0x4b9532,_0x51821b){return db[_0xf1fb('0x4e')]['create'](_0x4b9532['body'],{})['then'](function(_0x2bf0c6){var _0x1c8be7=_0x4b9532[_0xf1fb('0x51')]['get']({'plain':!![]});if(!_0x1c8be7)throw new Error(_0xf1fb('0x52'));if(_0x1c8be7[_0xf1fb('0x53')]===_0xf1fb('0x51')){var _0x1af72b=_0x2bf0c6['get']({'plain':!![]});var _0x359037=_0xf1fb('0x2c');return db[_0xf1fb('0x54')][_0xf1fb('0x4f')]({'where':{'name':_0x359037,'userProfileId':_0x1c8be7['userProfileId']},'raw':!![]})[_0xf1fb('0x29')](function(_0x3e7927){if(_0x3e7927&&_0x3e7927[_0xf1fb('0x55')]===0x0){return db[_0xf1fb('0x2d')][_0xf1fb('0x50')]({'name':_0x1af72b[_0xf1fb('0x30')],'resourceId':_0x1af72b['id'],'type':_0x3e7927[_0xf1fb('0x30')],'sectionId':_0x3e7927['id']},{})[_0xf1fb('0x29')](function(){return _0x2bf0c6;});}else{return _0x2bf0c6;}})[_0xf1fb('0x4a')](function(_0x1cea29){logger[_0xf1fb('0x2e')](_0xf1fb('0x56'),_0x1cea29);throw _0x1cea29;});}return _0x2bf0c6;})[_0xf1fb('0x29')](respondWithResult(_0x51821b,0xc9))[_0xf1fb('0x4a')](handleError(_0x51821b,null));};exports[_0xf1fb('0x28')]=function(_0x440915,_0x4df52d){if(_0x440915['body']['id']){delete _0x440915['body']['id'];}return db[_0xf1fb('0x4e')][_0xf1fb('0x4f')]({'where':{'id':_0x440915[_0xf1fb('0x57')]['id']}})[_0xf1fb('0x29')](handleEntityNotFound(_0x4df52d,null))[_0xf1fb('0x29')](saveUpdates(_0x440915['body'],null))[_0xf1fb('0x29')](respondWithResult(_0x4df52d,null))['catch'](handleError(_0x4df52d,null));};exports[_0xf1fb('0x2a')]=function(_0x2973aa,_0x27e305){return db[_0xf1fb('0x4e')][_0xf1fb('0x4f')]({'where':{'id':_0x2973aa[_0xf1fb('0x57')]['id']}})[_0xf1fb('0x29')](handleEntityNotFound(_0x27e305,null))['then'](removeEntity(_0x27e305,null))[_0xf1fb('0x4a')](handleError(_0x27e305,null));};exports[_0xf1fb('0x58')]=function(_0x17e815,_0x99cbb5,_0x45815c){return db['SquareProject'][_0xf1fb('0x4f')]({'where':{'id':_0x17e815['params']['id']}})['then'](handleEntityNotFound(_0x99cbb5,null))[_0xf1fb('0x29')](function(_0x347b28){if(_0x347b28){return _0x347b28[_0xf1fb('0x58')](_0x17e815[_0xf1fb('0x59')][_0xf1fb('0x5a')],_['omit'](_0x17e815['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x99cbb5,null))['catch'](handleError(_0x99cbb5,null));};exports['removeUsers']=function(_0x2f4168,_0x3a24fe,_0x4f7cbb){return db[_0xf1fb('0x4e')][_0xf1fb('0x4f')]({'where':{'id':_0x2f4168['params']['id']}})[_0xf1fb('0x29')](handleEntityNotFound(_0x3a24fe,null))['then'](function(_0x3bc328){if(_0x3bc328){return _0x3bc328[_0xf1fb('0x5b')](_0x2f4168[_0xf1fb('0x37')]['ids'])[_0xf1fb('0x29')](function(){if(_[_0xf1fb('0x5c')](_0x2f4168[_0xf1fb('0x37')][_0xf1fb('0x5a')])){for(var _0x980e4b=0x0;_0x980e4b<_0x2f4168['query'][_0xf1fb('0x5a')][_0xf1fb('0x4d')];_0x980e4b+=0x1){socket[_0xf1fb('0x5d')](_0xf1fb('0x5e'),{'UserId':Number(_0x2f4168[_0xf1fb('0x37')][_0xf1fb('0x5a')][_0x980e4b]),'SquareProjectId':Number(_0x2f4168[_0xf1fb('0x57')]['id'])});}}else{socket[_0xf1fb('0x5d')](_0xf1fb('0x5e'),{'UserId':Number(_0x2f4168['query'][_0xf1fb('0x5a')]),'SquareProjectId':Number(_0x2f4168['params']['id'])});}});}})[_0xf1fb('0x29')](respondWithStatusCode(_0x3a24fe,null))[_0xf1fb('0x4a')](handleError(_0x3a24fe,null));};exports[_0xf1fb('0x5f')]=function(_0xa01f71,_0x2e1217,_0x3fee2b){var _0x30d135={};var _0x20ab84={};var _0x18c2ff;var _0x489965;return db['SquareProject']['findOne']({'where':{'id':_0xa01f71[_0xf1fb('0x57')]['id']}})[_0xf1fb('0x29')](handleEntityNotFound(_0x2e1217,null))[_0xf1fb('0x29')](function(_0x4d6030){if(_0x4d6030){_0x18c2ff=_0x4d6030;_0x20ab84[_0xf1fb('0x3a')]=_[_0xf1fb('0x4c')](db['User'][_0xf1fb('0x34')]);_0x20ab84[_0xf1fb('0x37')]=_['keys'](_0xa01f71[_0xf1fb('0x37')]);_0x20ab84['filters']=_[_0xf1fb('0x39')](_0x20ab84[_0xf1fb('0x3a')],_0x20ab84[_0xf1fb('0x37')]);_0x30d135['attributes']=_[_0xf1fb('0x39')](_0x20ab84['model'],qs[_0xf1fb('0x3b')](_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x3b')]));_0x30d135[_0xf1fb('0x3c')]=_0x30d135[_0xf1fb('0x3c')][_0xf1fb('0x4d')]?_0x30d135['attributes']:_0x20ab84[_0xf1fb('0x3a')];_0x30d135[_0xf1fb('0x3f')]=qs[_0xf1fb('0x40')](_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x40')]);_0x30d135[_0xf1fb('0x41')]=qs['filters'](_['pick'](_0xa01f71[_0xf1fb('0x37')],_0x20ab84['filters']));if(_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x43')]){_0x30d135[_0xf1fb('0x41')]=_[_0xf1fb('0x44')](_0x30d135[_0xf1fb('0x41')],{'$or':_[_0xf1fb('0x33')](_0x30d135[_0xf1fb('0x3c')],function(_0x57fe17){var _0x145624={};_0x145624[_0x57fe17]={'$like':'%'+_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x43')]+'%'};return _0x145624;})});}_0x30d135=_[_0xf1fb('0x44')]({},_0x30d135,_0xa01f71[_0xf1fb('0x45')]);return _0x18c2ff[_0xf1fb('0x5f')](_0x30d135);}})[_0xf1fb('0x29')](function(_0x3f55cf){if(_0x3f55cf){_0x489965=_0x3f55cf[_0xf1fb('0x4d')];if(!_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x3d')](_0xf1fb('0x3e'))){_0x30d135[_0xf1fb('0x24')]=qs[_0xf1fb('0x24')](_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x24')]);_0x30d135[_0xf1fb('0x22')]=qs['offset'](_0xa01f71[_0xf1fb('0x37')][_0xf1fb('0x22')]);}return _0x18c2ff[_0xf1fb('0x5f')](_0x30d135);}})['then'](function(_0x1f5c92){if(_0x1f5c92){return _0x1f5c92?{'count':_0x489965,'rows':_0x1f5c92}:null;}})[_0xf1fb('0x29')](respondWithResult(_0x2e1217,null))['catch'](handleError(_0x2e1217,null));}; \ No newline at end of file +var _0x512e=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','pick','rimraf','fast-json-patch','request-promise','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','map','SquareProject','rawAttributes','fieldName','type','key'];(function(_0x465ef6,_0x8adf2a){var _0x5cf599=function(_0x19d39b){while(--_0x19d39b){_0x465ef6['push'](_0x465ef6['shift']());}};_0x5cf599(++_0x8adf2a);}(_0x512e,0x1a9));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe512('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe512('0x1'));var rp=require(_0xe512('0x2'));var moment=require('moment');var BPromise=require(_0xe512('0x3'));var Mustache=require(_0xe512('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe512('0x5'));var ejs=require(_0xe512('0x6'));var fs=require('fs');var fs_extra=require(_0xe512('0x7'));var _=require('lodash');var squel=require(_0xe512('0x8'));var crypto=require('crypto');var jsforce=require(_0xe512('0x9'));var deskjs=require(_0xe512('0xa'));var toCsv=require(_0xe512('0x5'));var querystring=require(_0xe512('0xb'));var Papa=require(_0xe512('0xc'));var Redis=require(_0xe512('0xd'));var authService=require(_0xe512('0xe'));var qs=require(_0xe512('0xf'));var as=require(_0xe512('0x10'));var hardwareService=require(_0xe512('0x11'));var logger=require(_0xe512('0x12'))(_0xe512('0x13'));var utils=require(_0xe512('0x14'));var config=require(_0xe512('0x15'));var licenseUtil=require(_0xe512('0x16'));var db=require(_0xe512('0x17'))['db'];config['redis']=_[_0xe512('0x18')](config[_0xe512('0x19')],{'host':_0xe512('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe512('0x19')]));require(_0xe512('0x1b'))[_0xe512('0x1c')](socket);function respondWithStatusCode(_0x6d47a0,_0x233cc9){_0x233cc9=_0x233cc9||0xcc;return function(_0xa2adf8){if(_0xa2adf8){return _0x6d47a0[_0xe512('0x1d')](_0x233cc9);}return _0x6d47a0[_0xe512('0x1e')](_0x233cc9)[_0xe512('0x1f')]();};}function respondWithResult(_0x1c3c5f,_0x117a4f){_0x117a4f=_0x117a4f||0xc8;return function(_0x3ba219){if(_0x3ba219){return _0x1c3c5f[_0xe512('0x1e')](_0x117a4f)[_0xe512('0x20')](_0x3ba219);}};}function respondWithFilteredResult(_0x58c658,_0x1691b2){return function(_0x23ab40){if(_0x23ab40){var _0x5226fb=typeof _0x1691b2['offset']===_0xe512('0x21')&&typeof _0x1691b2[_0xe512('0x22')]===_0xe512('0x21');var _0x4e1b5a=_0x23ab40[_0xe512('0x23')];var _0x4c29f1=_0x5226fb?0x0:_0x1691b2[_0xe512('0x24')];var _0x1bff43=_0x5226fb?_0x23ab40[_0xe512('0x23')]:_0x1691b2[_0xe512('0x24')]+_0x1691b2['limit'];var _0x525aa9;if(_0x1bff43>=_0x4e1b5a){_0x1bff43=_0x4e1b5a;_0x525aa9=0xc8;}else{_0x525aa9=0xce;}_0x58c658[_0xe512('0x1e')](_0x525aa9);return _0x58c658[_0xe512('0x25')]('Content-Range',_0x4c29f1+'-'+_0x1bff43+'/'+_0x4e1b5a)['json'](_0x23ab40);}return null;};}function patchUpdates(_0x1ab078){return function(_0xfa321d){try{jsonpatch[_0xe512('0x26')](_0xfa321d,_0x1ab078,!![]);}catch(_0x432f34){return BPromise[_0xe512('0x27')](_0x432f34);}return _0xfa321d['save']();};}function saveUpdates(_0x917491,_0x52f6ba){return function(_0x3b7f63){if(_0x3b7f63){return _0x3b7f63[_0xe512('0x28')](_0x917491)[_0xe512('0x29')](function(_0x27b127){return _0x27b127;});}return null;};}function removeEntity(_0x3e875a,_0x35e9db){return function(_0x266ffb){if(_0x266ffb){return _0x266ffb[_0xe512('0x2a')]()['then'](function(){var _0x961d5e=_0x266ffb[_0xe512('0x2b')]({'plain':!![]});var _0x3ce696=_0xe512('0x2c');return db[_0xe512('0x2d')][_0xe512('0x2a')]({'where':{'type':_0x3ce696,'resourceId':_0x961d5e['id']}})[_0xe512('0x29')](function(){return _0x266ffb;});})['then'](function(){_0x3e875a['status'](0xcc)[_0xe512('0x1f')]();});}};}function handleEntityNotFound(_0x328780,_0x31cf41){return function(_0xc120c5){if(!_0xc120c5){_0x328780['sendStatus'](0x194);}return _0xc120c5;};}function handleError(_0x3dfec2,_0x5531c7){_0x5531c7=_0x5531c7||0x1f4;return function(_0x4bd220){logger[_0xe512('0x2e')](_0x4bd220[_0xe512('0x2f')]);if(_0x4bd220['name']){delete _0x4bd220[_0xe512('0x30')];}_0x3dfec2['status'](_0x5531c7)['send'](_0x4bd220);};}exports['index']=function(_0x101e2f,_0x5455ea){var _0x2be544={},_0x5eb60a={},_0xba616d={'count':0x0,'rows':[]};var _0x221755=_[_0xe512('0x31')](db[_0xe512('0x32')][_0xe512('0x33')],function(_0x115abb){return{'name':_0x115abb[_0xe512('0x34')],'type':_0x115abb[_0xe512('0x35')][_0xe512('0x36')]};});_0x5eb60a[_0xe512('0x37')]=_[_0xe512('0x31')](_0x221755,_0xe512('0x30'));_0x5eb60a[_0xe512('0x38')]=_[_0xe512('0x39')](_0x101e2f[_0xe512('0x38')]);_0x5eb60a[_0xe512('0x3a')]=_[_0xe512('0x3b')](_0x5eb60a[_0xe512('0x37')],_0x5eb60a['query']);_0x2be544[_0xe512('0x3c')]=_[_0xe512('0x3b')](_0x5eb60a[_0xe512('0x37')],qs['fields'](_0x101e2f[_0xe512('0x38')][_0xe512('0x3d')]));_0x2be544[_0xe512('0x3c')]=_0x2be544[_0xe512('0x3c')][_0xe512('0x3e')]?_0x2be544[_0xe512('0x3c')]:_0x5eb60a[_0xe512('0x37')];if(!_0x101e2f[_0xe512('0x38')][_0xe512('0x3f')](_0xe512('0x40'))){_0x2be544[_0xe512('0x22')]=qs[_0xe512('0x22')](_0x101e2f['query'][_0xe512('0x22')]);_0x2be544[_0xe512('0x24')]=qs[_0xe512('0x24')](_0x101e2f['query'][_0xe512('0x24')]);}_0x2be544[_0xe512('0x41')]=qs['sort'](_0x101e2f['query'][_0xe512('0x42')]);_0x2be544['where']=qs['filters'](_['pick'](_0x101e2f[_0xe512('0x38')],_0x5eb60a[_0xe512('0x3a')]),_0x221755);if(_0x101e2f[_0xe512('0x38')][_0xe512('0x43')]){_0x2be544[_0xe512('0x44')]=_[_0xe512('0x45')](_0x2be544[_0xe512('0x44')],{'$or':_[_0xe512('0x31')](_0x221755,function(_0x468c82){if(_0x468c82[_0xe512('0x35')]!==_0xe512('0x46')){var _0x3a46bb={};_0x3a46bb[_0x468c82[_0xe512('0x30')]]={'$like':'%'+_0x101e2f['query']['filter']+'%'};return _0x3a46bb;}})});}_0x2be544=_['merge']({},_0x2be544,_0x101e2f[_0xe512('0x47')]);var _0x98cf0f={'where':_0x2be544[_0xe512('0x44')]};return db[_0xe512('0x32')]['count'](_0x98cf0f)[_0xe512('0x29')](function(_0x2801b2){_0xba616d[_0xe512('0x23')]=_0x2801b2;if(_0x101e2f['query'][_0xe512('0x48')]){_0x2be544['include']=[{'all':!![]}];}return db[_0xe512('0x32')][_0xe512('0x49')](_0x2be544);})[_0xe512('0x29')](function(_0x27fbf8){_0xba616d[_0xe512('0x4a')]=_0x27fbf8;return _0xba616d;})['then'](respondWithFilteredResult(_0x5455ea,_0x2be544))[_0xe512('0x4b')](handleError(_0x5455ea,null));};exports[_0xe512('0x4c')]=function(_0x522086,_0x1e9d3b){var _0x55efc0={'raw':![],'where':{'id':_0x522086['params']['id']}},_0x3f4343={};_0x3f4343[_0xe512('0x37')]=_[_0xe512('0x39')](db['SquareProject']['rawAttributes']);_0x3f4343[_0xe512('0x38')]=_[_0xe512('0x39')](_0x522086[_0xe512('0x38')]);_0x3f4343[_0xe512('0x3a')]=_['intersection'](_0x3f4343[_0xe512('0x37')],_0x3f4343[_0xe512('0x38')]);_0x55efc0[_0xe512('0x3c')]=_[_0xe512('0x3b')](_0x3f4343[_0xe512('0x37')],qs[_0xe512('0x3d')](_0x522086[_0xe512('0x38')]['fields']));_0x55efc0[_0xe512('0x3c')]=_0x55efc0[_0xe512('0x3c')]['length']?_0x55efc0[_0xe512('0x3c')]:_0x3f4343['model'];if(_0x522086[_0xe512('0x38')]['includeAll']){_0x55efc0['include']=[{'all':!![]}];}_0x55efc0=_['merge']({},_0x55efc0,_0x522086[_0xe512('0x47')]);return db[_0xe512('0x32')][_0xe512('0x4d')](_0x55efc0)[_0xe512('0x29')](handleEntityNotFound(_0x1e9d3b,null))[_0xe512('0x29')](respondWithResult(_0x1e9d3b,null))[_0xe512('0x4b')](handleError(_0x1e9d3b,null));};exports[_0xe512('0x4e')]=function(_0x356e13,_0x283057){return db['SquareProject'][_0xe512('0x4e')](_0x356e13[_0xe512('0x4f')],{})[_0xe512('0x29')](function(_0x489241){var _0xbe68ca=_0x356e13['user'][_0xe512('0x2b')]({'plain':!![]});if(!_0xbe68ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbe68ca['role']===_0xe512('0x50')){var _0x5b22a8=_0x489241[_0xe512('0x2b')]({'plain':!![]});var _0x3ab9a2=_0xe512('0x2c');return db[_0xe512('0x51')][_0xe512('0x4d')]({'where':{'name':_0x3ab9a2,'userProfileId':_0xbe68ca[_0xe512('0x52')]},'raw':!![]})[_0xe512('0x29')](function(_0x2280f1){if(_0x2280f1&&_0x2280f1[_0xe512('0x53')]===0x0){return db[_0xe512('0x2d')][_0xe512('0x4e')]({'name':_0x5b22a8['name'],'resourceId':_0x5b22a8['id'],'type':_0x2280f1['name'],'sectionId':_0x2280f1['id']},{})['then'](function(){return _0x489241;});}else{return _0x489241;}})[_0xe512('0x4b')](function(_0xbd3c7c){logger[_0xe512('0x2e')](_0xe512('0x54'),_0xbd3c7c);throw _0xbd3c7c;});}return _0x489241;})[_0xe512('0x29')](respondWithResult(_0x283057,0xc9))[_0xe512('0x4b')](handleError(_0x283057,null));};exports[_0xe512('0x28')]=function(_0x34e309,_0x3562db){if(_0x34e309[_0xe512('0x4f')]['id']){delete _0x34e309[_0xe512('0x4f')]['id'];}return db[_0xe512('0x32')][_0xe512('0x4d')]({'where':{'id':_0x34e309[_0xe512('0x55')]['id']}})[_0xe512('0x29')](handleEntityNotFound(_0x3562db,null))['then'](saveUpdates(_0x34e309[_0xe512('0x4f')],null))[_0xe512('0x29')](respondWithResult(_0x3562db,null))[_0xe512('0x4b')](handleError(_0x3562db,null));};exports['destroy']=function(_0x501dac,_0x333af8){return db[_0xe512('0x32')][_0xe512('0x4d')]({'where':{'id':_0x501dac[_0xe512('0x55')]['id']}})[_0xe512('0x29')](handleEntityNotFound(_0x333af8,null))[_0xe512('0x29')](removeEntity(_0x333af8,null))['catch'](handleError(_0x333af8,null));};exports[_0xe512('0x56')]=function(_0x30ecff,_0x2674cf,_0x51358d){return db['SquareProject'][_0xe512('0x4d')]({'where':{'id':_0x30ecff[_0xe512('0x55')]['id']}})[_0xe512('0x29')](handleEntityNotFound(_0x2674cf,null))[_0xe512('0x29')](function(_0x28ac7c){if(_0x28ac7c){return _0x28ac7c['addUsers'](_0x30ecff[_0xe512('0x4f')][_0xe512('0x57')],_['omit'](_0x30ecff[_0xe512('0x4f')],['ids','id'])||{});}})[_0xe512('0x29')](respondWithResult(_0x2674cf,null))[_0xe512('0x4b')](handleError(_0x2674cf,null));};exports[_0xe512('0x58')]=function(_0x196b54,_0x4bde5b,_0x24cad9){return db[_0xe512('0x32')][_0xe512('0x4d')]({'where':{'id':_0x196b54['params']['id']}})['then'](handleEntityNotFound(_0x4bde5b,null))[_0xe512('0x29')](function(_0x5768b8){if(_0x5768b8){return _0x5768b8[_0xe512('0x58')](_0x196b54[_0xe512('0x38')]['ids'])[_0xe512('0x29')](function(){if(_[_0xe512('0x59')](_0x196b54['query'][_0xe512('0x57')])){for(var _0x31b20a=0x0;_0x31b20a<_0x196b54[_0xe512('0x38')][_0xe512('0x57')][_0xe512('0x3e')];_0x31b20a+=0x1){socket[_0xe512('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x196b54[_0xe512('0x38')][_0xe512('0x57')][_0x31b20a]),'SquareProjectId':Number(_0x196b54[_0xe512('0x55')]['id'])});}}else{socket['emit'](_0xe512('0x5b'),{'UserId':Number(_0x196b54[_0xe512('0x38')]['ids']),'SquareProjectId':Number(_0x196b54[_0xe512('0x55')]['id'])});}});}})[_0xe512('0x29')](respondWithStatusCode(_0x4bde5b,null))[_0xe512('0x4b')](handleError(_0x4bde5b,null));};exports[_0xe512('0x5c')]=function(_0x33b292,_0x5ae99b,_0x15a302){var _0x2ef721={};var _0x4eb497={};var _0x13217c;var _0xac08ae;return db['SquareProject'][_0xe512('0x5d')]({'where':{'id':_0x33b292['params']['id']}})['then'](handleEntityNotFound(_0x5ae99b,null))['then'](function(_0x574992){if(_0x574992){_0x13217c=_0x574992;_0x4eb497[_0xe512('0x37')]=_[_0xe512('0x39')](db[_0xe512('0x5e')][_0xe512('0x33')]);_0x4eb497[_0xe512('0x38')]=_['keys'](_0x33b292['query']);_0x4eb497['filters']=_[_0xe512('0x3b')](_0x4eb497[_0xe512('0x37')],_0x4eb497[_0xe512('0x38')]);_0x2ef721[_0xe512('0x3c')]=_[_0xe512('0x3b')](_0x4eb497[_0xe512('0x37')],qs[_0xe512('0x3d')](_0x33b292['query'][_0xe512('0x3d')]));_0x2ef721['attributes']=_0x2ef721[_0xe512('0x3c')]['length']?_0x2ef721[_0xe512('0x3c')]:_0x4eb497[_0xe512('0x37')];_0x2ef721[_0xe512('0x41')]=qs[_0xe512('0x42')](_0x33b292['query']['sort']);_0x2ef721['where']=qs[_0xe512('0x3a')](_[_0xe512('0x5f')](_0x33b292[_0xe512('0x38')],_0x4eb497[_0xe512('0x3a')]));if(_0x33b292['query']['filter']){_0x2ef721[_0xe512('0x44')]=_[_0xe512('0x45')](_0x2ef721['where'],{'$or':_['map'](_0x2ef721[_0xe512('0x3c')],function(_0x1c4513){var _0x2e4f73={};_0x2e4f73[_0x1c4513]={'$like':'%'+_0x33b292[_0xe512('0x38')][_0xe512('0x43')]+'%'};return _0x2e4f73;})});}_0x2ef721=_[_0xe512('0x45')]({},_0x2ef721,_0x33b292[_0xe512('0x47')]);return _0x13217c[_0xe512('0x5c')](_0x2ef721);}})[_0xe512('0x29')](function(_0x2eb481){if(_0x2eb481){_0xac08ae=_0x2eb481['length'];if(!_0x33b292[_0xe512('0x38')][_0xe512('0x3f')](_0xe512('0x40'))){_0x2ef721[_0xe512('0x22')]=qs['limit'](_0x33b292[_0xe512('0x38')]['limit']);_0x2ef721['offset']=qs[_0xe512('0x24')](_0x33b292['query'][_0xe512('0x24')]);}return _0x13217c[_0xe512('0x5c')](_0x2ef721);}})[_0xe512('0x29')](function(_0x1ec948){if(_0x1ec948){return _0x1ec948?{'count':_0xac08ae,'rows':_0x1ec948}:null;}})['then'](respondWithResult(_0x5ae99b,null))[_0xe512('0x4b')](handleError(_0x5ae99b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9db6778..e209f70 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 _0x2db3=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x302633,_0x657910){var _0x3b87c9=function(_0x923917){while(--_0x923917){_0x302633['push'](_0x302633['shift']());}};_0x3b87c9(++_0x657910);}(_0x2db3,0x111));var _0x32db=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x2db3[_0x574617];return _0x29de90;};'use strict';var EventEmitter=require(_0x32db('0x0'));var SquareProject=require(_0x32db('0x1'))['db'][_0x32db('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x32db('0x3')](0x0);var events={'afterCreate':_0x32db('0x4'),'afterUpdate':_0x32db('0x5'),'afterDestroy':_0x32db('0x6')};function emitEvent(_0x371d62){return function(_0x4caadf,_0x3bb053,_0x3cc8bb){SquareProjectEvents['emit'](_0x371d62+':'+_0x4caadf['id'],_0x4caadf);SquareProjectEvents[_0x32db('0x7')](_0x371d62,_0x4caadf);_0x3cc8bb(null);};}for(var e in events){if(events[_0x32db('0x8')](e)){var event=events[e];SquareProject[_0x32db('0x9')](e,emitEvent(event));}}module[_0x32db('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x45ca=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x45ca,0x191));var _0xa45c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x45ca[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xa45c('0x0'));var SquareProject=require(_0xa45c('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa45c('0x2')](0x0);var events={'afterCreate':_0xa45c('0x3'),'afterUpdate':_0xa45c('0x4'),'afterDestroy':_0xa45c('0x5')};function emitEvent(_0x481c79){return function(_0x19b323,_0x570ab3,_0x57baf2){SquareProjectEvents[_0xa45c('0x6')](_0x481c79+':'+_0x19b323['id'],_0x19b323);SquareProjectEvents[_0xa45c('0x6')](_0x481c79,_0x19b323);_0x57baf2(null);};}for(var e in events){if(events[_0xa45c('0x7')](e)){var event=events[e];SquareProject[_0xa45c('0x8')](e,emitEvent(event));}}module[_0xa45c('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 dc23dd3..4ed646c 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 _0xf2cd=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util'];(function(_0x4e65d6,_0x44a8cf){var _0x1c7317=function(_0x16bb2d){while(--_0x16bb2d){_0x4e65d6['push'](_0x4e65d6['shift']());}};_0x1c7317(++_0x44a8cf);}(_0xf2cd,0xd7));var _0xdf2c=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xf2cd[_0x4843f9];return _0x193c6a;};'use strict';var _=require('lodash');var util=require(_0xdf2c('0x0'));var logger=require(_0xdf2c('0x1'))('api');var moment=require(_0xdf2c('0x2'));var BPromise=require('bluebird');var rp=require(_0xdf2c('0x3'));var fs=require('fs');var path=require(_0xdf2c('0x4'));var rimraf=require(_0xdf2c('0x5'));var config=require(_0xdf2c('0x6'));var attributes=require(_0xdf2c('0x7'));module[_0xdf2c('0x8')]=function(_0x3705b9,_0x576268){return _0x3705b9[_0xdf2c('0x9')](_0xdf2c('0xa'),attributes,{'tableName':_0xdf2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6c9782,_0x200de8,_0x522965){if(_0x6c9782[_0xdf2c('0xc')]('preproduction')){_0x6c9782[_0xdf2c('0xd')]=moment()[_0xdf2c('0xe')](_0xdf2c('0xf'));}if(_0x6c9782['changed'](_0xdf2c('0x10'))){_0x6c9782[_0xdf2c('0x11')]=moment()[_0xdf2c('0xe')](_0xdf2c('0xf'));}_0x522965(null,_0x6c9782);}}});}; \ No newline at end of file +var _0xcd56=['SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','define'];(function(_0x4e5182,_0x1805a1){var _0x1c10ec=function(_0x20b3fa){while(--_0x20b3fa){_0x4e5182['push'](_0x4e5182['shift']());}};_0x1c10ec(++_0x1805a1);}(_0xcd56,0x8e));var _0x6cd5=function(_0x2716ea,_0x1690c4){_0x2716ea=_0x2716ea-0x0;var _0x579539=_0xcd56[_0x2716ea];return _0x579539;};'use strict';var _=require('lodash');var util=require(_0x6cd5('0x0'));var logger=require(_0x6cd5('0x1'))(_0x6cd5('0x2'));var moment=require(_0x6cd5('0x3'));var BPromise=require(_0x6cd5('0x4'));var rp=require(_0x6cd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cd5('0x6'));var config=require('../../config/environment');var attributes=require(_0x6cd5('0x7'));module[_0x6cd5('0x8')]=function(_0x12b02b,_0x346287){return _0x12b02b[_0x6cd5('0x9')](_0x6cd5('0xa'),attributes,{'tableName':_0x6cd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x184d5f,_0x19e85d,_0x201858){if(_0x184d5f['changed'](_0x6cd5('0xc'))){_0x184d5f[_0x6cd5('0xd')]=moment()[_0x6cd5('0xe')](_0x6cd5('0xf'));}if(_0x184d5f[_0x6cd5('0x10')](_0x6cd5('0x11'))){_0x184d5f[_0x6cd5('0x12')]=moment()[_0x6cd5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x201858(null,_0x184d5f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a13cf9b..26b68dd 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 _0x88ac=['http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','find','options','raw','include','map','model','attributes','info','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x34faa6,_0x576371){var _0x2aea1c=function(_0x2ce5b6){while(--_0x2ce5b6){_0x34faa6['push'](_0x34faa6['shift']());}};_0x2aea1c(++_0x576371);}(_0x88ac,0x1bd));var _0xc88a=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0x88ac[_0x5880d8];return _0x88264a;};'use strict';var _=require('lodash');var util=require(_0xc88a('0x0'));var moment=require(_0xc88a('0x1'));var BPromise=require(_0xc88a('0x2'));var rs=require(_0xc88a('0x3'));var fs=require('fs');var Redis=require(_0xc88a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc88a('0x5'));var logger=require(_0xc88a('0x6'))(_0xc88a('0x7'));var config=require(_0xc88a('0x8'));var jayson=require(_0xc88a('0x9'));var client=jayson[_0xc88a('0xa')][_0xc88a('0xb')]({'port':0x232a});config[_0xc88a('0xc')]=_[_0xc88a('0xd')](config['redis'],{'host':_0xc88a('0xe'),'port':0x18eb});var socket=require(_0xc88a('0xf'))(new Redis(config[_0xc88a('0xc')]));require(_0xc88a('0x10'))['register'](socket);function respondWithRpcPromise(_0x7728a2,_0x3a987d,_0x24d88a){return new BPromise(function(_0x563785,_0x45073e){return client[_0xc88a('0x11')](_0x7728a2,_0x24d88a)[_0xc88a('0x12')](function(_0x35d399){logger['info'](_0xc88a('0x13'),_0x3a987d,_0xc88a('0x14'));logger['debug'](_0xc88a('0x15'),_0x3a987d,'request\x20sent',JSON[_0xc88a('0x16')](_0x35d399));if(_0x35d399[_0xc88a('0x17')]){if(_0x35d399[_0xc88a('0x17')][_0xc88a('0x18')]===0x1f4){logger[_0xc88a('0x17')](_0xc88a('0x13'),_0x3a987d,_0x35d399['error'][_0xc88a('0x19')]);return _0x45073e(_0x35d399[_0xc88a('0x17')][_0xc88a('0x19')]);}logger[_0xc88a('0x17')](_0xc88a('0x13'),_0x3a987d,_0x35d399[_0xc88a('0x17')][_0xc88a('0x19')]);return _0x563785(_0x35d399[_0xc88a('0x17')][_0xc88a('0x19')]);}else{logger['info'](_0xc88a('0x13'),_0x3a987d,_0xc88a('0x14'));_0x563785(_0x35d399[_0xc88a('0x1a')][_0xc88a('0x19')]);}})[_0xc88a('0x1b')](function(_0x3429d6){logger[_0xc88a('0x17')](_0xc88a('0x13'),_0x3a987d,_0x3429d6);_0x45073e(_0x3429d6);});});}exports[_0xc88a('0x1c')]=function(_0x51b811){var _0x31d84c=this;return new Promise(function(_0x5c2a12,_0x51fe73){return db['SquareProject'][_0xc88a('0x1d')]({'raw':_0x51b811[_0xc88a('0x1e')]?_0x51b811[_0xc88a('0x1e')][_0xc88a('0x1f')]===undefined?!![]:![]:!![],'where':_0x51b811['options']?_0x51b811[_0xc88a('0x1e')]['where']||null:null,'attributes':_0x51b811[_0xc88a('0x1e')]?_0x51b811['options']['attributes']||null:null,'include':_0x51b811['options']?_0x51b811[_0xc88a('0x1e')][_0xc88a('0x20')]?_[_0xc88a('0x21')](_0x51b811['options'][_0xc88a('0x20')],function(_0x45bdc2){return{'model':db[_0x45bdc2[_0xc88a('0x22')]],'as':_0x45bdc2['as'],'attributes':_0x45bdc2['attributes'],'include':_0x45bdc2[_0xc88a('0x20')]?_[_0xc88a('0x21')](_0x45bdc2[_0xc88a('0x20')],function(_0x4c1b87){return{'model':db[_0x4c1b87[_0xc88a('0x22')]],'as':_0x4c1b87['as'],'attributes':_0x4c1b87[_0xc88a('0x23')],'include':_0x4c1b87[_0xc88a('0x20')]?_[_0xc88a('0x21')](_0x4c1b87['include'],function(_0x4caa62){return{'model':db[_0x4caa62[_0xc88a('0x22')]],'as':_0x4caa62['as'],'attributes':_0x4caa62['attributes']};}):[]};}):[]};}):[]:[]})[_0xc88a('0x12')](function(_0x2fab2e){logger[_0xc88a('0x24')]('ShowSquareProject',_0x51b811);logger[_0xc88a('0x25')](_0xc88a('0x1c'),_0x51b811,JSON[_0xc88a('0x16')](_0x2fab2e));_0x5c2a12(_0x2fab2e);})['catch'](function(_0x8c996f){logger[_0xc88a('0x17')](_0xc88a('0x1c'),_0x8c996f['message'],_0x51b811);_0x51fe73(_0x31d84c[_0xc88a('0x17')](0x1f4,_0x8c996f['message']));});});}; \ No newline at end of file +var _0x4cef=['include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','SquareProject,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSquareProject','SquareProject','options','raw'];(function(_0x4e214d,_0x4f4fd9){var _0x16e932=function(_0x3e270c){while(--_0x3e270c){_0x4e214d['push'](_0x4e214d['shift']());}};_0x16e932(++_0x4f4fd9);}(_0x4cef,0x13f));var _0xf4ce=function(_0x296d93,_0x27ee37){_0x296d93=_0x296d93-0x0;var _0xba3f66=_0x4cef[_0x296d93];return _0xba3f66;};'use strict';var _=require(_0xf4ce('0x0'));var util=require(_0xf4ce('0x1'));var moment=require(_0xf4ce('0x2'));var BPromise=require(_0xf4ce('0x3'));var rs=require(_0xf4ce('0x4'));var fs=require('fs');var Redis=require(_0xf4ce('0x5'));var db=require(_0xf4ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4ce('0x7'));var config=require(_0xf4ce('0x8'));var jayson=require(_0xf4ce('0x9'));var client=jayson['client'][_0xf4ce('0xa')]({'port':0x232a});config['redis']=_[_0xf4ce('0xb')](config['redis'],{'host':_0xf4ce('0xc'),'port':0x18eb});var socket=require(_0xf4ce('0xd'))(new Redis(config['redis']));require(_0xf4ce('0xe'))[_0xf4ce('0xf')](socket);function respondWithRpcPromise(_0x4b8752,_0x422c3d,_0x5b5d04){return new BPromise(function(_0x35b19a,_0x54b52a){return client[_0xf4ce('0x10')](_0x4b8752,_0x5b5d04)[_0xf4ce('0x11')](function(_0x546406){logger[_0xf4ce('0x12')]('SquareProject,\x20%s,\x20%s',_0x422c3d,'request\x20sent');logger['debug'](_0xf4ce('0x13'),_0x422c3d,'request\x20sent',JSON[_0xf4ce('0x14')](_0x546406));if(_0x546406['error']){if(_0x546406[_0xf4ce('0x15')]['code']===0x1f4){logger['error'](_0xf4ce('0x16'),_0x422c3d,_0x546406[_0xf4ce('0x15')][_0xf4ce('0x17')]);return _0x54b52a(_0x546406[_0xf4ce('0x15')][_0xf4ce('0x17')]);}logger[_0xf4ce('0x15')](_0xf4ce('0x16'),_0x422c3d,_0x546406[_0xf4ce('0x15')][_0xf4ce('0x17')]);return _0x35b19a(_0x546406['error']['message']);}else{logger[_0xf4ce('0x12')](_0xf4ce('0x16'),_0x422c3d,_0xf4ce('0x18'));_0x35b19a(_0x546406[_0xf4ce('0x19')][_0xf4ce('0x17')]);}})[_0xf4ce('0x1a')](function(_0x330cd3){logger['error'](_0xf4ce('0x16'),_0x422c3d,_0x330cd3);_0x54b52a(_0x330cd3);});});}exports[_0xf4ce('0x1b')]=function(_0x343509){var _0x325bb2=this;return new Promise(function(_0x4c7a5c,_0x515d13){return db[_0xf4ce('0x1c')]['find']({'raw':_0x343509['options']?_0x343509[_0xf4ce('0x1d')][_0xf4ce('0x1e')]===undefined?!![]:![]:!![],'where':_0x343509[_0xf4ce('0x1d')]?_0x343509[_0xf4ce('0x1d')]['where']||null:null,'attributes':_0x343509[_0xf4ce('0x1d')]?_0x343509[_0xf4ce('0x1d')]['attributes']||null:null,'include':_0x343509[_0xf4ce('0x1d')]?_0x343509[_0xf4ce('0x1d')][_0xf4ce('0x1f')]?_[_0xf4ce('0x20')](_0x343509['options'][_0xf4ce('0x1f')],function(_0x440e96){return{'model':db[_0x440e96[_0xf4ce('0x21')]],'as':_0x440e96['as'],'attributes':_0x440e96[_0xf4ce('0x22')],'include':_0x440e96[_0xf4ce('0x1f')]?_[_0xf4ce('0x20')](_0x440e96['include'],function(_0x55cb00){return{'model':db[_0x55cb00['model']],'as':_0x55cb00['as'],'attributes':_0x55cb00[_0xf4ce('0x22')],'include':_0x55cb00[_0xf4ce('0x1f')]?_[_0xf4ce('0x20')](_0x55cb00['include'],function(_0xca0293){return{'model':db[_0xca0293['model']],'as':_0xca0293['as'],'attributes':_0xca0293['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x10f709){logger[_0xf4ce('0x12')](_0xf4ce('0x1b'),_0x343509);logger['debug'](_0xf4ce('0x1b'),_0x343509,JSON[_0xf4ce('0x14')](_0x10f709));_0x4c7a5c(_0x10f709);})[_0xf4ce('0x1a')](function(_0x4f6074){logger[_0xf4ce('0x15')](_0xf4ce('0x1b'),_0x4f6074[_0xf4ce('0x17')],_0x343509);_0x515d13(_0x325bb2[_0xf4ce('0x15')](0x1f4,_0x4f6074[_0xf4ce('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c768157..62544ee 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 _0x9ed2=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x2eb3c2,_0x34e791){var _0x91073e=function(_0x1967c8){while(--_0x1967c8){_0x2eb3c2['push'](_0x2eb3c2['shift']());}};_0x91073e(++_0x34e791);}(_0x9ed2,0x129));var _0x29ed=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x9ed2[_0x13cab0];return _0x38804f;};'use strict';var SquareProjectEvents=require(_0x29ed('0x0'));var events=[_0x29ed('0x1'),_0x29ed('0x2'),_0x29ed('0x3')];function createListener(_0x862ddb,_0x1a36c6){return function(_0x127fac){_0x1a36c6[_0x29ed('0x4')](_0x862ddb,_0x127fac);};}function removeListener(_0x158eeb,_0x35f18f){return function(){SquareProjectEvents[_0x29ed('0x5')](_0x158eeb,_0x35f18f);};}exports[_0x29ed('0x6')]=function(_0x2f7e07){for(var _0x475257=0x0,_0x4c3f4e=events[_0x29ed('0x7')];_0x475257<_0x4c3f4e;_0x475257++){var _0xc03ceb=events[_0x475257];var _0x1b67c1=createListener(_0x29ed('0x8')+_0xc03ceb,_0x2f7e07);SquareProjectEvents['on'](_0xc03ceb,_0x1b67c1);}}; \ No newline at end of file +var _0x8e00=['remove','update','register','length','./squareProject.events','save'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x8e00,0x166));var _0x08e0=function(_0x447347,_0x50dd43){_0x447347=_0x447347-0x0;var _0x540723=_0x8e00[_0x447347];return _0x540723;};'use strict';var SquareProjectEvents=require(_0x08e0('0x0'));var events=[_0x08e0('0x1'),_0x08e0('0x2'),_0x08e0('0x3')];function createListener(_0x2426c8,_0x4a5346){return function(_0x46af74){_0x4a5346['emit'](_0x2426c8,_0x46af74);};}function removeListener(_0x4c2b30,_0x1fb59d){return function(){SquareProjectEvents['removeListener'](_0x4c2b30,_0x1fb59d);};}exports[_0x08e0('0x4')]=function(_0x3015d3){for(var _0x1ff7a0=0x0,_0x56ca7f=events[_0x08e0('0x5')];_0x1ff7a0<_0x56ca7f;_0x1ff7a0++){var _0x2d2d0f=events[_0x1ff7a0];var _0x554b63=createListener('squareProject:'+_0x2d2d0f,_0x3015d3);SquareProjectEvents['on'](_0x2d2d0f,_0x554b63);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1875566..25f9c74 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x47a9a6,_0x4ef0dc){var _0x1d7519=function(_0x5674cc){while(--_0x5674cc){_0x47a9a6['push'](_0x47a9a6['shift']());}};_0x1d7519(++_0x4ef0dc);}(_0x814b,0x1a2));var _0xb814=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x814b[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x4eff88,_0xf0c265){var _0xe0f248=function(_0x1ddd99){while(--_0x1ddd99){_0x4eff88['push'](_0x4eff88['shift']());}};_0xe0f248(++_0xf0c265);}(_0x1261,0x144));var _0x1126=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x1261[_0x10df1e];return _0x3e24fb;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 709bea9..cadac64 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 _0x5075=['savePath','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x23b57c,_0xdc7f98){var _0x4c3b1d=function(_0x283147){while(--_0x283147){_0x23b57c['push'](_0x23b57c['shift']());}};_0x4c3b1d(++_0xdc7f98);}(_0x5075,0x73));var _0x5507=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x5075[_0x48961c];return _0x1d895d;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'callerid':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'extension':{'type':Sequelize[_0x5507('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'dnid':{'type':Sequelize[_0x5507('0x2')]},'projectName':{'type':Sequelize[_0x5507('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x5507('0x2')]},'format':{'type':Sequelize[_0x5507('0x3')],'get':function(){var _0x4c2d6d='';var _0x42c232=this[_0x5507('0x4')](_0x5507('0x5'));if(_0x42c232){_0x4c2d6d=_0x42c232['substring'](_0x42c232['lastIndexOf']('.'));}return _0x4c2d6d;}}}; \ No newline at end of file +var _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x37dc44,_0x1123e4){var _0x27ec76=function(_0x3dd823){while(--_0x3dd823){_0x37dc44['push'](_0x37dc44['shift']());}};_0x27ec76(++_0x1123e4);}(_0xee14,0x13a));var _0x4ee1=function(_0x40c382,_0x5856a0){_0x40c382=_0x40c382-0x0;var _0x2ead27=_0xee14[_0x40c382];return _0x2ead27;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'callerid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'extension':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'dnid':{'type':Sequelize[_0x4ee1('0x0')]},'projectName':{'type':Sequelize[_0x4ee1('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ee1('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4ee1('0x1')],'get':function(){var _0x3a45a3='';var _0x187656=this[_0x4ee1('0x2')](_0x4ee1('0x3'));if(_0x187656){_0x3a45a3=_0x187656[_0x4ee1('0x4')](_0x187656['lastIndexOf']('.'));}return _0x3a45a3;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 65f6195..85ac230 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 _0xd596=['index','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','SquareRecording','findAll','rows','catch','show','params','rawAttributes','fields','options','find','create','body','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','filename','download','extname','unlink','message','SquareRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','info','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','then','error','stack','name','send'];(function(_0x5e67c4,_0x4c7403){var _0x5986d3=function(_0x57d8b2){while(--_0x57d8b2){_0x5e67c4['push'](_0x5e67c4['shift']());}};_0x5986d3(++_0x4c7403);}(_0xd596,0x1ac));var _0x6d59=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xd596[_0x3a9635];return _0x10d08c;};'use strict';var emlformat=require(_0x6d59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6d59('0x2'));var path=require('path');var sox=require(_0x6d59('0x3'));var csv=require(_0x6d59('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d59('0x5'));var _=require(_0x6d59('0x6'));var squel=require(_0x6d59('0x7'));var crypto=require(_0x6d59('0x8'));var jsforce=require(_0x6d59('0x9'));var deskjs=require(_0x6d59('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6d59('0xb'));var Papa=require(_0x6d59('0xc'));var Redis=require(_0x6d59('0xd'));var authService=require(_0x6d59('0xe'));var qs=require(_0x6d59('0xf'));var as=require(_0x6d59('0x10'));var hardwareService=require(_0x6d59('0x11'));var logger=require(_0x6d59('0x12'))('api');var utils=require(_0x6d59('0x13'));var config=require(_0x6d59('0x14'));var licenseUtil=require(_0x6d59('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5166c9,_0x219573){_0x219573=_0x219573||0xcc;return function(_0x39dcea){if(_0x39dcea){return _0x5166c9['sendStatus'](_0x219573);}return _0x5166c9[_0x6d59('0x16')](_0x219573)[_0x6d59('0x17')]();};}function respondWithResult(_0x5465b3,_0x4b40a1){_0x4b40a1=_0x4b40a1||0xc8;return function(_0x4a34a3){if(_0x4a34a3){return _0x5465b3[_0x6d59('0x16')](_0x4b40a1)['json'](_0x4a34a3);}};}function respondWithFilteredResult(_0x4ebc94,_0x3a4e89){return function(_0x478fbf){if(_0x478fbf){var _0x38b856=typeof _0x3a4e89[_0x6d59('0x18')]===_0x6d59('0x19')&&typeof _0x3a4e89[_0x6d59('0x1a')]==='undefined';var _0x1e118a=_0x478fbf[_0x6d59('0x1b')];var _0x3f34a9=_0x38b856?0x0:_0x3a4e89['offset'];var _0x1107c9=_0x38b856?_0x478fbf[_0x6d59('0x1b')]:_0x3a4e89[_0x6d59('0x18')]+_0x3a4e89[_0x6d59('0x1a')];var _0x27a219;if(_0x1107c9>=_0x1e118a){_0x1107c9=_0x1e118a;_0x27a219=0xc8;}else{_0x27a219=0xce;}_0x4ebc94[_0x6d59('0x16')](_0x27a219);return _0x4ebc94[_0x6d59('0x1c')]('Content-Range',_0x3f34a9+'-'+_0x1107c9+'/'+_0x1e118a)[_0x6d59('0x1d')](_0x478fbf);}return null;};}function patchUpdates(_0x17ae55){return function(_0x2271e8){try{jsonpatch[_0x6d59('0x1e')](_0x2271e8,_0x17ae55,!![]);}catch(_0x174cac){return BPromise[_0x6d59('0x1f')](_0x174cac);}return _0x2271e8['save']();};}function saveUpdates(_0x394473,_0x3cc443){return function(_0x51efe2){if(_0x51efe2){return _0x51efe2['update'](_0x394473)[_0x6d59('0x20')](function(_0x1ccda6){return _0x1ccda6;});}return null;};}function removeEntity(_0x27abaf,_0x166805){return function(_0xb95555){if(_0xb95555){return _0xb95555['destroy']()[_0x6d59('0x20')](function(){_0x27abaf[_0x6d59('0x16')](0xcc)[_0x6d59('0x17')]();});}};}function handleEntityNotFound(_0x5d41ce,_0x45b0be){return function(_0x590568){if(!_0x590568){_0x5d41ce['sendStatus'](0x194);}return _0x590568;};}function handleError(_0x13f6a4,_0x1ea4f8){_0x1ea4f8=_0x1ea4f8||0x1f4;return function(_0x2405bb){logger[_0x6d59('0x21')](_0x2405bb[_0x6d59('0x22')]);if(_0x2405bb['name']){delete _0x2405bb[_0x6d59('0x23')];}_0x13f6a4[_0x6d59('0x16')](_0x1ea4f8)[_0x6d59('0x24')](_0x2405bb);};}exports[_0x6d59('0x25')]=function(_0x2ed774,_0x18b5ba){var _0x3ded56={},_0x1670a7={},_0xaa212f={'count':0x0,'rows':[]};var _0x2fceb2=_['map'](db['SquareRecording']['rawAttributes'],function(_0x1f79a9){return{'name':_0x1f79a9[_0x6d59('0x26')],'type':_0x1f79a9[_0x6d59('0x27')][_0x6d59('0x28')]};});_0x1670a7[_0x6d59('0x29')]=_[_0x6d59('0x2a')](_0x2fceb2,_0x6d59('0x23'));_0x1670a7['query']=_[_0x6d59('0x2b')](_0x2ed774[_0x6d59('0x2c')]);_0x1670a7[_0x6d59('0x2d')]=_['intersection'](_0x1670a7['model'],_0x1670a7[_0x6d59('0x2c')]);_0x3ded56[_0x6d59('0x2e')]=_[_0x6d59('0x2f')](_0x1670a7[_0x6d59('0x29')],qs['fields'](_0x2ed774[_0x6d59('0x2c')]['fields']));_0x3ded56[_0x6d59('0x2e')]=_0x3ded56[_0x6d59('0x2e')][_0x6d59('0x30')]?_0x3ded56['attributes']:_0x1670a7[_0x6d59('0x29')];if(!_0x2ed774[_0x6d59('0x2c')][_0x6d59('0x31')](_0x6d59('0x32'))){_0x3ded56['limit']=qs['limit'](_0x2ed774[_0x6d59('0x2c')][_0x6d59('0x1a')]);_0x3ded56[_0x6d59('0x18')]=qs[_0x6d59('0x18')](_0x2ed774[_0x6d59('0x2c')][_0x6d59('0x18')]);}_0x3ded56[_0x6d59('0x33')]=qs[_0x6d59('0x34')](_0x2ed774[_0x6d59('0x2c')]['sort']);_0x3ded56['where']=qs[_0x6d59('0x2d')](_['pick'](_0x2ed774[_0x6d59('0x2c')],_0x1670a7['filters']),_0x2fceb2);if(_0x2ed774['query'][_0x6d59('0x35')]){_0x3ded56[_0x6d59('0x36')]=_['merge'](_0x3ded56[_0x6d59('0x36')],{'$or':_[_0x6d59('0x2a')](_0x2fceb2,function(_0x13760e){if(_0x13760e[_0x6d59('0x27')]!==_0x6d59('0x37')){var _0x36328e={};_0x36328e[_0x13760e[_0x6d59('0x23')]]={'$like':'%'+_0x2ed774[_0x6d59('0x2c')][_0x6d59('0x35')]+'%'};return _0x36328e;}})});}_0x3ded56=_[_0x6d59('0x38')]({},_0x3ded56,_0x2ed774['options']);var _0x351565={'where':_0x3ded56[_0x6d59('0x36')]};return db['SquareRecording'][_0x6d59('0x1b')](_0x351565)[_0x6d59('0x20')](function(_0xfd6bcf){_0xaa212f[_0x6d59('0x1b')]=_0xfd6bcf;if(_0x2ed774['query'][_0x6d59('0x39')]){_0x3ded56[_0x6d59('0x3a')]=[{'all':!![]}];}return db[_0x6d59('0x3b')][_0x6d59('0x3c')](_0x3ded56);})[_0x6d59('0x20')](function(_0x2c516d){_0xaa212f[_0x6d59('0x3d')]=_0x2c516d;return _0xaa212f;})[_0x6d59('0x20')](respondWithFilteredResult(_0x18b5ba,_0x3ded56))[_0x6d59('0x3e')](handleError(_0x18b5ba,null));};exports[_0x6d59('0x3f')]=function(_0x28eb16,_0x48eedc){var _0x2dcc08={'raw':!![],'where':{'id':_0x28eb16[_0x6d59('0x40')]['id']}},_0x4ba0ba={};_0x4ba0ba['model']=_['keys'](db[_0x6d59('0x3b')][_0x6d59('0x41')]);_0x4ba0ba[_0x6d59('0x2c')]=_[_0x6d59('0x2b')](_0x28eb16['query']);_0x4ba0ba[_0x6d59('0x2d')]=_['intersection'](_0x4ba0ba[_0x6d59('0x29')],_0x4ba0ba[_0x6d59('0x2c')]);_0x2dcc08[_0x6d59('0x2e')]=_['intersection'](_0x4ba0ba[_0x6d59('0x29')],qs['fields'](_0x28eb16[_0x6d59('0x2c')][_0x6d59('0x42')]));_0x2dcc08[_0x6d59('0x2e')]=_0x2dcc08[_0x6d59('0x2e')][_0x6d59('0x30')]?_0x2dcc08[_0x6d59('0x2e')]:_0x4ba0ba['model'];if(_0x28eb16[_0x6d59('0x2c')]['includeAll']){_0x2dcc08[_0x6d59('0x3a')]=[{'all':!![]}];}_0x2dcc08=_[_0x6d59('0x38')]({},_0x2dcc08,_0x28eb16[_0x6d59('0x43')]);return db['SquareRecording'][_0x6d59('0x44')](_0x2dcc08)[_0x6d59('0x20')](handleEntityNotFound(_0x48eedc,null))[_0x6d59('0x20')](respondWithResult(_0x48eedc,null))[_0x6d59('0x3e')](handleError(_0x48eedc,null));};exports['create']=function(_0x54d9db,_0x4ec1d7){return db[_0x6d59('0x3b')][_0x6d59('0x45')](_0x54d9db[_0x6d59('0x46')],{})[_0x6d59('0x20')](respondWithResult(_0x4ec1d7,0xc9))[_0x6d59('0x3e')](handleError(_0x4ec1d7,null));};exports['update']=function(_0x31d989,_0x507b6c){if(_0x31d989[_0x6d59('0x46')]['id']){delete _0x31d989[_0x6d59('0x46')]['id'];}return db[_0x6d59('0x3b')][_0x6d59('0x44')]({'where':{'id':_0x31d989[_0x6d59('0x40')]['id']}})[_0x6d59('0x20')](handleEntityNotFound(_0x507b6c,null))[_0x6d59('0x20')](saveUpdates(_0x31d989[_0x6d59('0x46')],null))['then'](respondWithResult(_0x507b6c,null))[_0x6d59('0x3e')](handleError(_0x507b6c,null));};exports['download']=function(_0x409255,_0x47afd1,_0x1245e7){var _0x552ab2=require(_0x6d59('0x47'));var _0x49a49b=![];var _0x145403={};if(_0x409255[_0x6d59('0x2c')]['type']&&_0x409255['query']['type']===_0x6d59('0x48')){_0x145403[_0x6d59('0x48')]=_0x409255[_0x6d59('0x40')]['id'];}else{_0x145403['id']=_0x409255[_0x6d59('0x40')]['id'];}return db[_0x6d59('0x3b')][_0x6d59('0x44')]({'where':_0x145403,'attributes':['id',_0x6d59('0x49'),'filename'],'raw':!![]})[_0x6d59('0x20')](handleEntityNotFound(_0x47afd1,null))[_0x6d59('0x20')](function(_0xb1b2c8){if(_0xb1b2c8){var _0x2b25ac=_0xb1b2c8[_0x6d59('0x49')];var _0x3893f1=util[_0x6d59('0x4a')](_0x6d59('0x4b'),_0x2b25ac);if(fs['existsSync'](_0x3893f1)){_0x49a49b=!![];return _0x552ab2[_0x6d59('0x4c')](_0x3893f1,_0x2b25ac,config[_0x6d59('0x4d')]['recording'])[_0x6d59('0x20')](function(){return _0xb1b2c8;});}return _0xb1b2c8;}})[_0x6d59('0x20')](function(_0x5d2997){if(_0x5d2997){var _0x2a7a85=_0x5d2997[_0x6d59('0x49')];if(!fs['existsSync'](_0x2a7a85)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x5d2997[_0x6d59('0x4e')]){return _0x47afd1[_0x6d59('0x4f')](_0x2a7a85,_0x5d2997['filename']+path[_0x6d59('0x50')](_0x2a7a85),function(){if(_0x49a49b){fs['unlink'](_0x2a7a85);}});}else{return _0x47afd1[_0x6d59('0x4f')](_0x2a7a85,function(_0x33369b){if(_0x49a49b){fs[_0x6d59('0x51')](_0x2a7a85);}});}}})[_0x6d59('0x3e')](function(_0x50d38e){if(_0x50d38e[_0x6d59('0x52')]===_0x6d59('0x53')){_0x47afd1['status'](0x194)[_0x6d59('0x24')]('Not\x20found');}else{return handleError(_0x47afd1,null);}});};exports[_0x6d59('0x54')]=function(_0xe4731d,_0x350cde){return db['SquareRecording'][_0x6d59('0x44')]({'where':{'id':_0xe4731d[_0x6d59('0x40')]['id']}})[_0x6d59('0x20')](function(_0x251d98){if(_[_0x6d59('0x55')](_0x251d98)){throw new ReferenceError(_0x6d59('0x56'));}return _0x251d98;})[_0x6d59('0x20')](function(_0x4aeb4e){var _0x162f3c=_0x4aeb4e['savePath'];logger[_0x6d59('0x57')]('cancellazione\x20fisica\x20documento\x20%s',_0x162f3c);if(!_[_0x6d59('0x55')](_0x4aeb4e[_0x6d59('0x49')])&&fs[_0x6d59('0x58')](_0x162f3c)){logger[_0x6d59('0x57')](_0x6d59('0x59')+_0x162f3c+_0x6d59('0x5a'));fs[_0x6d59('0x5b')](_0x162f3c);}_0x162f3c=_0x162f3c+_0x6d59('0x5c');if(!_[_0x6d59('0x55')](_0x4aeb4e['savePath'])&&fs[_0x6d59('0x58')](_0x162f3c)){logger[_0x6d59('0x57')](_0x6d59('0x59')+_0x162f3c+_0x6d59('0x5a'));fs[_0x6d59('0x5b')](_0x162f3c);}return _0x4aeb4e;})[_0x6d59('0x20')](function(_0x136416){if(!_0x136416)throw new InternalError();return _0x136416[_0x6d59('0x54')]();})[_0x6d59('0x20')](function(){_0x350cde[_0x6d59('0x16')](0xcc)[_0x6d59('0x17')]();})['catch'](handleError(_0x350cde,null));}; \ No newline at end of file +var _0xdf90=['merge','map','type','VIRTUAL','options','includeAll','include','show','params','length','catch','create','body','update','find','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','end','error','stack','name','send','SquareRecording','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdf90,0x83));var _0x0df9=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xdf90[_0x24618a];return _0x2e3d64;};'use strict';var emlformat=require(_0x0df9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0df9('0x1'));var jsonpatch=require(_0x0df9('0x2'));var rp=require(_0x0df9('0x3'));var moment=require('moment');var BPromise=require(_0x0df9('0x4'));var Mustache=require(_0x0df9('0x5'));var util=require(_0x0df9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0df9('0x7'));var fs=require('fs');var fs_extra=require(_0x0df9('0x8'));var _=require(_0x0df9('0x9'));var squel=require(_0x0df9('0xa'));var crypto=require('crypto');var jsforce=require(_0x0df9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0df9('0xc'));var querystring=require(_0x0df9('0xd'));var Papa=require(_0x0df9('0xe'));var Redis=require(_0x0df9('0xf'));var authService=require(_0x0df9('0x10'));var qs=require(_0x0df9('0x11'));var as=require(_0x0df9('0x12'));var hardwareService=require(_0x0df9('0x13'));var logger=require(_0x0df9('0x14'))(_0x0df9('0x15'));var utils=require(_0x0df9('0x16'));var config=require(_0x0df9('0x17'));var licenseUtil=require(_0x0df9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409f17,_0x5403b4){_0x5403b4=_0x5403b4||0xcc;return function(_0x24d294){if(_0x24d294){return _0x409f17[_0x0df9('0x19')](_0x5403b4);}return _0x409f17[_0x0df9('0x1a')](_0x5403b4)['end']();};}function respondWithResult(_0x2bfe2e,_0x3511f5){_0x3511f5=_0x3511f5||0xc8;return function(_0xd2ea8){if(_0xd2ea8){return _0x2bfe2e[_0x0df9('0x1a')](_0x3511f5)[_0x0df9('0x1b')](_0xd2ea8);}};}function respondWithFilteredResult(_0x2ab300,_0x5d0baa){return function(_0x577d7f){if(_0x577d7f){var _0x50f6ab=typeof _0x5d0baa[_0x0df9('0x1c')]===_0x0df9('0x1d')&&typeof _0x5d0baa[_0x0df9('0x1e')]==='undefined';var _0x1dad05=_0x577d7f[_0x0df9('0x1f')];var _0x1a0402=_0x50f6ab?0x0:_0x5d0baa[_0x0df9('0x1c')];var _0x3abd1c=_0x50f6ab?_0x577d7f[_0x0df9('0x1f')]:_0x5d0baa[_0x0df9('0x1c')]+_0x5d0baa[_0x0df9('0x1e')];var _0x5924af;if(_0x3abd1c>=_0x1dad05){_0x3abd1c=_0x1dad05;_0x5924af=0xc8;}else{_0x5924af=0xce;}_0x2ab300[_0x0df9('0x1a')](_0x5924af);return _0x2ab300[_0x0df9('0x20')]('Content-Range',_0x1a0402+'-'+_0x3abd1c+'/'+_0x1dad05)[_0x0df9('0x1b')](_0x577d7f);}return null;};}function patchUpdates(_0x3b5b09){return function(_0x1798f1){try{jsonpatch[_0x0df9('0x21')](_0x1798f1,_0x3b5b09,!![]);}catch(_0x1c0686){return BPromise[_0x0df9('0x22')](_0x1c0686);}return _0x1798f1['save']();};}function saveUpdates(_0x2c9a13,_0xb02167){return function(_0xf6bbc0){if(_0xf6bbc0){return _0xf6bbc0['update'](_0x2c9a13)[_0x0df9('0x23')](function(_0x24d3c8){return _0x24d3c8;});}return null;};}function removeEntity(_0x5a609a,_0x150f79){return function(_0x44fe1d){if(_0x44fe1d){return _0x44fe1d['destroy']()[_0x0df9('0x23')](function(){_0x5a609a['status'](0xcc)[_0x0df9('0x24')]();});}};}function handleEntityNotFound(_0x1db456,_0x32af7a){return function(_0x406d1d){if(!_0x406d1d){_0x1db456[_0x0df9('0x19')](0x194);}return _0x406d1d;};}function handleError(_0x4a5ef3,_0xe6da2e){_0xe6da2e=_0xe6da2e||0x1f4;return function(_0x256d5f){logger[_0x0df9('0x25')](_0x256d5f[_0x0df9('0x26')]);if(_0x256d5f[_0x0df9('0x27')]){delete _0x256d5f[_0x0df9('0x27')];}_0x4a5ef3[_0x0df9('0x1a')](_0xe6da2e)[_0x0df9('0x28')](_0x256d5f);};}exports['index']=function(_0x43b454,_0x4aacb8){var _0x58c942={},_0x2dd317={},_0x2c2f71={'count':0x0,'rows':[]};var _0x8e8650=_['map'](db[_0x0df9('0x29')][_0x0df9('0x2a')],function(_0x25a6df){return{'name':_0x25a6df[_0x0df9('0x2b')],'type':_0x25a6df['type']['key']};});_0x2dd317[_0x0df9('0x2c')]=_['map'](_0x8e8650,'name');_0x2dd317[_0x0df9('0x2d')]=_[_0x0df9('0x2e')](_0x43b454['query']);_0x2dd317['filters']=_['intersection'](_0x2dd317['model'],_0x2dd317[_0x0df9('0x2d')]);_0x58c942[_0x0df9('0x2f')]=_[_0x0df9('0x30')](_0x2dd317['model'],qs[_0x0df9('0x31')](_0x43b454[_0x0df9('0x2d')][_0x0df9('0x31')]));_0x58c942[_0x0df9('0x2f')]=_0x58c942[_0x0df9('0x2f')]['length']?_0x58c942['attributes']:_0x2dd317[_0x0df9('0x2c')];if(!_0x43b454['query']['hasOwnProperty'](_0x0df9('0x32'))){_0x58c942[_0x0df9('0x1e')]=qs[_0x0df9('0x1e')](_0x43b454[_0x0df9('0x2d')]['limit']);_0x58c942['offset']=qs['offset'](_0x43b454[_0x0df9('0x2d')][_0x0df9('0x1c')]);}_0x58c942[_0x0df9('0x33')]=qs[_0x0df9('0x34')](_0x43b454[_0x0df9('0x2d')]['sort']);_0x58c942['where']=qs[_0x0df9('0x35')](_[_0x0df9('0x36')](_0x43b454['query'],_0x2dd317[_0x0df9('0x35')]),_0x8e8650);if(_0x43b454[_0x0df9('0x2d')][_0x0df9('0x37')]){_0x58c942[_0x0df9('0x38')]=_[_0x0df9('0x39')](_0x58c942[_0x0df9('0x38')],{'$or':_[_0x0df9('0x3a')](_0x8e8650,function(_0x24ccfb){if(_0x24ccfb[_0x0df9('0x3b')]!==_0x0df9('0x3c')){var _0x262a9e={};_0x262a9e[_0x24ccfb[_0x0df9('0x27')]]={'$like':'%'+_0x43b454[_0x0df9('0x2d')][_0x0df9('0x37')]+'%'};return _0x262a9e;}})});}_0x58c942=_[_0x0df9('0x39')]({},_0x58c942,_0x43b454[_0x0df9('0x3d')]);var _0x355d92={'where':_0x58c942[_0x0df9('0x38')]};return db[_0x0df9('0x29')]['count'](_0x355d92)['then'](function(_0x581d60){_0x2c2f71['count']=_0x581d60;if(_0x43b454[_0x0df9('0x2d')][_0x0df9('0x3e')]){_0x58c942[_0x0df9('0x3f')]=[{'all':!![]}];}return db[_0x0df9('0x29')]['findAll'](_0x58c942);})[_0x0df9('0x23')](function(_0x54a56b){_0x2c2f71['rows']=_0x54a56b;return _0x2c2f71;})[_0x0df9('0x23')](respondWithFilteredResult(_0x4aacb8,_0x58c942))['catch'](handleError(_0x4aacb8,null));};exports[_0x0df9('0x40')]=function(_0x4c427b,_0x86b29c){var _0x4ec81d={'raw':!![],'where':{'id':_0x4c427b[_0x0df9('0x41')]['id']}},_0x1dd0ee={};_0x1dd0ee[_0x0df9('0x2c')]=_[_0x0df9('0x2e')](db['SquareRecording'][_0x0df9('0x2a')]);_0x1dd0ee[_0x0df9('0x2d')]=_['keys'](_0x4c427b[_0x0df9('0x2d')]);_0x1dd0ee[_0x0df9('0x35')]=_[_0x0df9('0x30')](_0x1dd0ee[_0x0df9('0x2c')],_0x1dd0ee[_0x0df9('0x2d')]);_0x4ec81d[_0x0df9('0x2f')]=_[_0x0df9('0x30')](_0x1dd0ee[_0x0df9('0x2c')],qs[_0x0df9('0x31')](_0x4c427b[_0x0df9('0x2d')]['fields']));_0x4ec81d['attributes']=_0x4ec81d[_0x0df9('0x2f')][_0x0df9('0x42')]?_0x4ec81d[_0x0df9('0x2f')]:_0x1dd0ee[_0x0df9('0x2c')];if(_0x4c427b[_0x0df9('0x2d')][_0x0df9('0x3e')]){_0x4ec81d[_0x0df9('0x3f')]=[{'all':!![]}];}_0x4ec81d=_[_0x0df9('0x39')]({},_0x4ec81d,_0x4c427b['options']);return db['SquareRecording']['find'](_0x4ec81d)[_0x0df9('0x23')](handleEntityNotFound(_0x86b29c,null))[_0x0df9('0x23')](respondWithResult(_0x86b29c,null))[_0x0df9('0x43')](handleError(_0x86b29c,null));};exports[_0x0df9('0x44')]=function(_0x179401,_0x52e8f5){return db['SquareRecording'][_0x0df9('0x44')](_0x179401[_0x0df9('0x45')],{})[_0x0df9('0x23')](respondWithResult(_0x52e8f5,0xc9))[_0x0df9('0x43')](handleError(_0x52e8f5,null));};exports[_0x0df9('0x46')]=function(_0x4cc45d,_0x521cba){if(_0x4cc45d['body']['id']){delete _0x4cc45d['body']['id'];}return db[_0x0df9('0x29')][_0x0df9('0x47')]({'where':{'id':_0x4cc45d[_0x0df9('0x41')]['id']}})[_0x0df9('0x23')](handleEntityNotFound(_0x521cba,null))[_0x0df9('0x23')](saveUpdates(_0x4cc45d[_0x0df9('0x45')],null))[_0x0df9('0x23')](respondWithResult(_0x521cba,null))[_0x0df9('0x43')](handleError(_0x521cba,null));};exports['download']=function(_0x53ac52,_0x590472,_0x4a7d4b){var _0x5d8f17=require(_0x0df9('0x48'));var _0x159ebd=![];var _0x541ad9={};if(_0x53ac52['query'][_0x0df9('0x3b')]&&_0x53ac52[_0x0df9('0x2d')][_0x0df9('0x3b')]===_0x0df9('0x49')){_0x541ad9[_0x0df9('0x49')]=_0x53ac52[_0x0df9('0x41')]['id'];}else{_0x541ad9['id']=_0x53ac52[_0x0df9('0x41')]['id'];}return db['SquareRecording'][_0x0df9('0x47')]({'where':_0x541ad9,'attributes':['id',_0x0df9('0x4a'),'filename'],'raw':!![]})[_0x0df9('0x23')](handleEntityNotFound(_0x590472,null))['then'](function(_0x195fdb){if(_0x195fdb){var _0x3b109b=_0x195fdb[_0x0df9('0x4a')];var _0x238c9b=util[_0x0df9('0x4b')](_0x0df9('0x4c'),_0x3b109b);if(fs[_0x0df9('0x4d')](_0x238c9b)){_0x159ebd=!![];return _0x5d8f17[_0x0df9('0x4e')](_0x238c9b,_0x3b109b,config['secrets']['recording'])[_0x0df9('0x23')](function(){return _0x195fdb;});}return _0x195fdb;}})[_0x0df9('0x23')](function(_0x83300b){if(_0x83300b){var _0x2e1bbe=_0x83300b[_0x0df9('0x4a')];if(!fs[_0x0df9('0x4d')](_0x2e1bbe)){throw new db['Sequelize'][(_0x0df9('0x4f'))](_0x0df9('0x50'));}if(_0x83300b[_0x0df9('0x51')]){return _0x590472[_0x0df9('0x52')](_0x2e1bbe,_0x83300b[_0x0df9('0x51')]+path[_0x0df9('0x53')](_0x2e1bbe),function(){if(_0x159ebd){fs['unlink'](_0x2e1bbe);}});}else{return _0x590472[_0x0df9('0x52')](_0x2e1bbe,function(_0x1ac8bb){if(_0x159ebd){fs[_0x0df9('0x54')](_0x2e1bbe);}});}}})[_0x0df9('0x43')](function(_0x38381e){if(_0x38381e[_0x0df9('0x55')]===_0x0df9('0x50')){_0x590472['status'](0x194)[_0x0df9('0x28')]('Not\x20found');}else{return handleError(_0x590472,null);}});};exports['destroy']=function(_0x36d053,_0xc87d07){return db['SquareRecording'][_0x0df9('0x47')]({'where':{'id':_0x36d053['params']['id']}})['then'](function(_0x1eba30){if(_[_0x0df9('0x56')](_0x1eba30)){throw new ReferenceError(_0x0df9('0x57'));}return _0x1eba30;})['then'](function(_0x3df96b){var _0x223867=_0x3df96b[_0x0df9('0x4a')];logger[_0x0df9('0x58')](_0x0df9('0x59'),_0x223867);if(!_[_0x0df9('0x56')](_0x3df96b[_0x0df9('0x4a')])&&fs[_0x0df9('0x4d')](_0x223867)){logger[_0x0df9('0x58')]('File:\x20\x22'+_0x223867+_0x0df9('0x5a'));fs[_0x0df9('0x5b')](_0x223867);}_0x223867=_0x223867+'.cypher';if(!_['isNil'](_0x3df96b[_0x0df9('0x4a')])&&fs[_0x0df9('0x4d')](_0x223867)){logger[_0x0df9('0x58')](_0x0df9('0x5c')+_0x223867+_0x0df9('0x5a'));fs[_0x0df9('0x5b')](_0x223867);}return _0x3df96b;})['then'](function(_0x24ee4d){if(!_0x24ee4d)throw new InternalError();return _0x24ee4d[_0x0df9('0x5d')]();})[_0x0df9('0x23')](function(){_0xc87d07[_0x0df9('0x1a')](0xcc)[_0x0df9('0x24')]();})[_0x0df9('0x43')](handleError(_0xc87d07,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6b325cb..cd33999 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 _0x1c01=['./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x3f9606,_0x5b0a04){var _0x4487d6=function(_0xc2dbd5){while(--_0xc2dbd5){_0x3f9606['push'](_0x3f9606['shift']());}};_0x4487d6(++_0x5b0a04);}(_0x1c01,0x190));var _0x11c0=function(_0x42841e,_0x3bf835){_0x42841e=_0x42841e-0x0;var _0x4be906=_0x1c01[_0x42841e];return _0x4be906;};'use strict';var _=require(_0x11c0('0x0'));var util=require(_0x11c0('0x1'));var logger=require(_0x11c0('0x2'))(_0x11c0('0x3'));var moment=require('moment');var BPromise=require(_0x11c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11c0('0x5'));var config=require(_0x11c0('0x6'));var attributes=require(_0x11c0('0x7'));module[_0x11c0('0x8')]=function(_0x38c591,_0x5190a4){return _0x38c591[_0x11c0('0x9')]('SquareRecording',attributes,{'tableName':_0x11c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d95=['util','api','moment','bluebird','request-promise','path','../../config/environment','lodash'];(function(_0xd3f161,_0x39bdfe){var _0x41ceeb=function(_0xc9076f){while(--_0xc9076f){_0xd3f161['push'](_0xd3f161['shift']());}};_0x41ceeb(++_0x39bdfe);}(_0x5d95,0x77));var _0x55d9=function(_0x170714,_0x2d7370){_0x170714=_0x170714-0x0;var _0xf5a3c0=_0x5d95[_0x170714];return _0xf5a3c0;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require('../../config/logger')(_0x55d9('0x2'));var moment=require(_0x55d9('0x3'));var BPromise=require(_0x55d9('0x4'));var rp=require(_0x55d9('0x5'));var fs=require('fs');var path=require(_0x55d9('0x6'));var rimraf=require('rimraf');var config=require(_0x55d9('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x25957e,_0x4244b4){return _0x25957e['define']('SquareRecording',attributes,{'tableName':'square_recordings','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 c71ebf9..95cb7fa 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 _0xea42=['ioredis','../../config/utils','../../config/logger','rpc','client','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','util','moment','bluebird','randomstring'];(function(_0x67b075,_0x43557d){var _0x39d030=function(_0x4f25e1){while(--_0x4f25e1){_0x67b075['push'](_0x67b075['shift']());}};_0x39d030(++_0x43557d);}(_0xea42,0x8c));var _0x2ea4=function(_0x371ef9,_0x14697d){_0x371ef9=_0x371ef9-0x0;var _0x2289d2=_0xea42[_0x371ef9];return _0x2289d2;};'use strict';var _=require('lodash');var util=require(_0x2ea4('0x0'));var moment=require(_0x2ea4('0x1'));var BPromise=require(_0x2ea4('0x2'));var rs=require(_0x2ea4('0x3'));var fs=require('fs');var Redis=require(_0x2ea4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ea4('0x5'));var logger=require(_0x2ea4('0x6'))(_0x2ea4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2ea4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41b864,_0x36a992,_0x2daf8f){return new BPromise(function(_0x5b5501,_0x1a9135){return client['request'](_0x41b864,_0x2daf8f)['then'](function(_0x270e49){logger[_0x2ea4('0x9')](_0x2ea4('0xa'),_0x36a992,'request\x20sent');logger[_0x2ea4('0xb')](_0x2ea4('0xc'),_0x36a992,_0x2ea4('0xd'),JSON[_0x2ea4('0xe')](_0x270e49));if(_0x270e49['error']){if(_0x270e49['error']['code']===0x1f4){logger[_0x2ea4('0xf')](_0x2ea4('0xa'),_0x36a992,_0x270e49[_0x2ea4('0xf')]['message']);return _0x1a9135(_0x270e49['error']['message']);}logger[_0x2ea4('0xf')](_0x2ea4('0xa'),_0x36a992,_0x270e49[_0x2ea4('0xf')][_0x2ea4('0x10')]);return _0x5b5501(_0x270e49[_0x2ea4('0xf')][_0x2ea4('0x10')]);}else{logger[_0x2ea4('0x9')](_0x2ea4('0xa'),_0x36a992,'request\x20sent');_0x5b5501(_0x270e49[_0x2ea4('0x11')]['message']);}})[_0x2ea4('0x12')](function(_0x448eb8){logger[_0x2ea4('0xf')]('SquareRecording,\x20%s,\x20%s',_0x36a992,_0x448eb8);_0x1a9135(_0x448eb8);});});}exports[_0x2ea4('0x13')]=function(_0xcd0839){var _0x555c9f=this;return new Promise(function(_0x109b39,_0x2730d3){return db[_0x2ea4('0x14')]['create'](_0xcd0839[_0x2ea4('0x15')],{'raw':_0xcd0839[_0x2ea4('0x16')]?_0xcd0839[_0x2ea4('0x16')][_0x2ea4('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x10d463){logger[_0x2ea4('0x9')]('CreateSquareRecording',_0xcd0839);logger[_0x2ea4('0xb')](_0x2ea4('0x13'),_0xcd0839,JSON[_0x2ea4('0xe')](_0x10d463));_0x109b39(_0x10d463);})[_0x2ea4('0x12')](function(_0x5d0bf1){logger[_0x2ea4('0xf')](_0x2ea4('0x13'),_0x5d0bf1[_0x2ea4('0x10')],_0xcd0839);_0x2730d3(_0x555c9f[_0x2ea4('0xf')](0x1f4,_0x5d0bf1[_0x2ea4('0x10')]));});});}; \ No newline at end of file +var _0x2199=['http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2199,0x13b));var _0x9219=function(_0xddbe80,_0x214d6b){_0xddbe80=_0xddbe80-0x0;var _0x9dc743=_0x2199[_0xddbe80];return _0x9dc743;};'use strict';var _=require('lodash');var util=require(_0x9219('0x0'));var moment=require(_0x9219('0x1'));var BPromise=require(_0x9219('0x2'));var rs=require(_0x9219('0x3'));var fs=require('fs');var Redis=require(_0x9219('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9219('0x5'));var logger=require(_0x9219('0x6'))(_0x9219('0x7'));var config=require('../../config/environment');var jayson=require(_0x9219('0x8'));var client=jayson['client'][_0x9219('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87e351,_0x4b3763,_0x2dbf72){return new BPromise(function(_0x20da62,_0x4ceddb){return client[_0x9219('0xa')](_0x87e351,_0x2dbf72)[_0x9219('0xb')](function(_0x2ecf3f){logger[_0x9219('0xc')](_0x9219('0xd'),_0x4b3763,_0x9219('0xe'));logger['debug'](_0x9219('0xf'),_0x4b3763,'request\x20sent',JSON[_0x9219('0x10')](_0x2ecf3f));if(_0x2ecf3f[_0x9219('0x11')]){if(_0x2ecf3f['error'][_0x9219('0x12')]===0x1f4){logger[_0x9219('0x11')](_0x9219('0xd'),_0x4b3763,_0x2ecf3f['error'][_0x9219('0x13')]);return _0x4ceddb(_0x2ecf3f['error'][_0x9219('0x13')]);}logger[_0x9219('0x11')]('SquareRecording,\x20%s,\x20%s',_0x4b3763,_0x2ecf3f[_0x9219('0x11')]['message']);return _0x20da62(_0x2ecf3f['error']['message']);}else{logger['info'](_0x9219('0xd'),_0x4b3763,'request\x20sent');_0x20da62(_0x2ecf3f['result'][_0x9219('0x13')]);}})[_0x9219('0x14')](function(_0x5a506b){logger[_0x9219('0x11')](_0x9219('0xd'),_0x4b3763,_0x5a506b);_0x4ceddb(_0x5a506b);});});}exports[_0x9219('0x15')]=function(_0x4283bf){var _0x105a80=this;return new Promise(function(_0x30cca3,_0x4e8e07){return db[_0x9219('0x16')][_0x9219('0x17')](_0x4283bf[_0x9219('0x18')],{'raw':_0x4283bf['options']?_0x4283bf['options'][_0x9219('0x19')]===undefined?!![]:![]:!![]})[_0x9219('0xb')](function(_0x5ba506){logger[_0x9219('0xc')](_0x9219('0x15'),_0x4283bf);logger[_0x9219('0x1a')]('CreateSquareRecording',_0x4283bf,JSON[_0x9219('0x10')](_0x5ba506));_0x30cca3(_0x5ba506);})[_0x9219('0x14')](function(_0x129263){logger['error'](_0x9219('0x15'),_0x129263[_0x9219('0x13')],_0x4283bf);_0x4e8e07(_0x105a80[_0x9219('0x11')](0x1f4,_0x129263[_0x9219('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b473e79..98092de 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4e13a6,_0x4b2b58){var _0x19c8c3=function(_0x2f3b61){while(--_0x2f3b61){_0x4e13a6['push'](_0x4e13a6['shift']());}};_0x19c8c3(++_0x4b2b58);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x179e6a,_0x23c5f8){var _0x515f39=function(_0x4ef0fa){while(--_0x4ef0fa){_0x179e6a['push'](_0x179e6a['shift']());}};_0x515f39(++_0x23c5f8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 fadb41e..ca186d2 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 _0xc856=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x23aa59,_0x4b19b4){var _0xdee112=function(_0x512fa1){while(--_0x512fa1){_0x23aa59['push'](_0x23aa59['shift']());}};_0xdee112(++_0x4b19b4);}(_0xc856,0x1b2));var _0x6c85=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xc856[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x6c85('0x0'));module[_0x6c85('0x1')]={'network':{'type':Sequelize[_0x6c85('0x2')]},'network_script':{'type':Sequelize[_0x6c85('0x2')]},'request':{'type':Sequelize[_0x6c85('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6c85('0x2')]},'type':{'type':Sequelize[_0x6c85('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x6c85('0x2')]},'callerid':{'type':Sequelize[_0x6c85('0x2')]},'calleridname':{'type':Sequelize[_0x6c85('0x2')]},'callingpres':{'type':Sequelize[_0x6c85('0x2')]},'callingani2':{'type':Sequelize[_0x6c85('0x2')]},'callington':{'type':Sequelize[_0x6c85('0x2')]},'callingtns':{'type':Sequelize[_0x6c85('0x2')]},'dnid':{'type':Sequelize[_0x6c85('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6c85('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6c85('0x2')]},'accountcode':{'type':Sequelize[_0x6c85('0x2')]},'threadid':{'type':Sequelize[_0x6c85('0x2')]},'project_name':{'type':Sequelize[_0x6c85('0x2')]},'joinAt':{'type':Sequelize[_0x6c85('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6c85('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2b93=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x213ce6,_0x4e6851){var _0x5e84b6=function(_0x57ffea){while(--_0x57ffea){_0x213ce6['push'](_0x213ce6['shift']());}};_0x5e84b6(++_0x4e6851);}(_0x2b93,0xfc));var _0x32b9=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x2b93[_0x38854e];return _0x3f8415;};'use strict';var Sequelize=require(_0x32b9('0x0'));module[_0x32b9('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x32b9('0x2')]},'request':{'type':Sequelize[_0x32b9('0x2')]},'channel':{'type':Sequelize[_0x32b9('0x2')]},'language':{'type':Sequelize[_0x32b9('0x2')]},'type':{'type':Sequelize[_0x32b9('0x2')]},'uniqueid':{'type':Sequelize[_0x32b9('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x32b9('0x2')]},'calleridname':{'type':Sequelize[_0x32b9('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x32b9('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x32b9('0x2')]},'dnid':{'type':Sequelize[_0x32b9('0x2')]},'rdnis':{'type':Sequelize[_0x32b9('0x2')]},'context':{'type':Sequelize[_0x32b9('0x2')]},'extension':{'type':Sequelize[_0x32b9('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x32b9('0x2')]},'accountcode':{'type':Sequelize[_0x32b9('0x2')]},'threadid':{'type':Sequelize[_0x32b9('0x2')]},'project_name':{'type':Sequelize[_0x32b9('0x2')]},'joinAt':{'type':Sequelize[_0x32b9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x32b9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a96f37c..5d6c9fa 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 _0xe08c=['where','merge','count','include','findAll','rows','catch','show','SquareReport','options','create','body','find','params','describe','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xe08c,0xa3));var _0xce08=function(_0x8f472b,_0x39ef2c){_0x8f472b=_0x8f472b-0x0;var _0x3c79e4=_0xe08c[_0x8f472b];return _0x3c79e4;};'use strict';var emlformat=require(_0xce08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce08('0x2'));var BPromise=require(_0xce08('0x3'));var Mustache=require(_0xce08('0x4'));var util=require(_0xce08('0x5'));var path=require('path');var sox=require(_0xce08('0x6'));var csv=require(_0xce08('0x7'));var ejs=require(_0xce08('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce08('0x9'));var squel=require(_0xce08('0xa'));var crypto=require('crypto');var jsforce=require(_0xce08('0xb'));var deskjs=require(_0xce08('0xc'));var toCsv=require(_0xce08('0x7'));var querystring=require(_0xce08('0xd'));var Papa=require(_0xce08('0xe'));var Redis=require('ioredis');var authService=require(_0xce08('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xce08('0x10'));var hardwareService=require(_0xce08('0x11'));var logger=require(_0xce08('0x12'))(_0xce08('0x13'));var utils=require(_0xce08('0x14'));var config=require(_0xce08('0x15'));var licenseUtil=require(_0xce08('0x16'));var db=require(_0xce08('0x17'))['db'];function respondWithStatusCode(_0x2f5ad8,_0xd28f7a){_0xd28f7a=_0xd28f7a||0xcc;return function(_0x40d6de){if(_0x40d6de){return _0x2f5ad8['sendStatus'](_0xd28f7a);}return _0x2f5ad8[_0xce08('0x18')](_0xd28f7a)[_0xce08('0x19')]();};}function respondWithResult(_0x56bc60,_0x5eac8c){_0x5eac8c=_0x5eac8c||0xc8;return function(_0x2cb14b){if(_0x2cb14b){return _0x56bc60[_0xce08('0x18')](_0x5eac8c)[_0xce08('0x1a')](_0x2cb14b);}};}function respondWithFilteredResult(_0x1c3084,_0x236aa7){return function(_0x54043f){if(_0x54043f){var _0x31db46=typeof _0x236aa7[_0xce08('0x1b')]==='undefined'&&typeof _0x236aa7['limit']===_0xce08('0x1c');var _0x2eb09b=_0x54043f['count'];var _0xb10cba=_0x31db46?0x0:_0x236aa7[_0xce08('0x1b')];var _0x6298e8=_0x31db46?_0x54043f['count']:_0x236aa7[_0xce08('0x1b')]+_0x236aa7[_0xce08('0x1d')];var _0x545c9f;if(_0x6298e8>=_0x2eb09b){_0x6298e8=_0x2eb09b;_0x545c9f=0xc8;}else{_0x545c9f=0xce;}_0x1c3084['status'](_0x545c9f);return _0x1c3084['set'](_0xce08('0x1e'),_0xb10cba+'-'+_0x6298e8+'/'+_0x2eb09b)[_0xce08('0x1a')](_0x54043f);}return null;};}function patchUpdates(_0x157aac){return function(_0x147e52){try{jsonpatch[_0xce08('0x1f')](_0x147e52,_0x157aac,!![]);}catch(_0x29b73f){return BPromise[_0xce08('0x20')](_0x29b73f);}return _0x147e52[_0xce08('0x21')]();};}function saveUpdates(_0x1b3a8e,_0x34d5c4){return function(_0x47beb4){if(_0x47beb4){return _0x47beb4[_0xce08('0x22')](_0x1b3a8e)[_0xce08('0x23')](function(_0xb5a5bf){return _0xb5a5bf;});}return null;};}function removeEntity(_0x11370e,_0x5178cc){return function(_0x2ecae9){if(_0x2ecae9){return _0x2ecae9[_0xce08('0x24')]()[_0xce08('0x23')](function(){_0x11370e[_0xce08('0x18')](0xcc)[_0xce08('0x19')]();});}};}function handleEntityNotFound(_0x1244f7,_0x15147e){return function(_0xe5499c){if(!_0xe5499c){_0x1244f7[_0xce08('0x25')](0x194);}return _0xe5499c;};}function handleError(_0x2ec3dd,_0x14f8f8){_0x14f8f8=_0x14f8f8||0x1f4;return function(_0x30ca98){logger[_0xce08('0x26')](_0x30ca98[_0xce08('0x27')]);if(_0x30ca98['name']){delete _0x30ca98[_0xce08('0x28')];}_0x2ec3dd[_0xce08('0x18')](_0x14f8f8)['send'](_0x30ca98);};}exports['index']=function(_0x584f23,_0x4e6046){var _0x26cf73={},_0x141a52={},_0x147a4b={'count':0x0,'rows':[]};var _0x593ec9=_[_0xce08('0x29')](db['SquareReport'][_0xce08('0x2a')],function(_0x1ffdf5){return{'name':_0x1ffdf5[_0xce08('0x2b')],'type':_0x1ffdf5[_0xce08('0x2c')]['key']};});_0x141a52['model']=_['map'](_0x593ec9,_0xce08('0x28'));_0x141a52[_0xce08('0x2d')]=_[_0xce08('0x2e')](_0x584f23[_0xce08('0x2d')]);_0x141a52['filters']=_[_0xce08('0x2f')](_0x141a52[_0xce08('0x30')],_0x141a52[_0xce08('0x2d')]);_0x26cf73[_0xce08('0x31')]=_[_0xce08('0x2f')](_0x141a52[_0xce08('0x30')],qs[_0xce08('0x32')](_0x584f23[_0xce08('0x2d')]['fields']));_0x26cf73[_0xce08('0x31')]=_0x26cf73[_0xce08('0x31')][_0xce08('0x33')]?_0x26cf73[_0xce08('0x31')]:_0x141a52[_0xce08('0x30')];if(!_0x584f23[_0xce08('0x2d')][_0xce08('0x34')](_0xce08('0x35'))){_0x26cf73[_0xce08('0x1d')]=qs['limit'](_0x584f23[_0xce08('0x2d')][_0xce08('0x1d')]);_0x26cf73[_0xce08('0x1b')]=qs[_0xce08('0x1b')](_0x584f23['query']['offset']);}_0x26cf73[_0xce08('0x36')]=qs['sort'](_0x584f23[_0xce08('0x2d')][_0xce08('0x37')]);_0x26cf73['where']=qs['filters'](_[_0xce08('0x38')](_0x584f23[_0xce08('0x2d')],_0x141a52[_0xce08('0x39')]),_0x593ec9);if(_0x584f23[_0xce08('0x2d')][_0xce08('0x3a')]){_0x26cf73[_0xce08('0x3b')]=_[_0xce08('0x3c')](_0x26cf73[_0xce08('0x3b')],{'$or':_['map'](_0x593ec9,function(_0x50362b){if(_0x50362b[_0xce08('0x2c')]!=='VIRTUAL'){var _0x26de1e={};_0x26de1e[_0x50362b[_0xce08('0x28')]]={'$like':'%'+_0x584f23[_0xce08('0x2d')]['filter']+'%'};return _0x26de1e;}})});}_0x26cf73=_[_0xce08('0x3c')]({},_0x26cf73,_0x584f23['options']);var _0x17eb8d={'where':_0x26cf73[_0xce08('0x3b')]};return db['SquareReport'][_0xce08('0x3d')](_0x17eb8d)[_0xce08('0x23')](function(_0x597fb4){_0x147a4b[_0xce08('0x3d')]=_0x597fb4;if(_0x584f23[_0xce08('0x2d')]['includeAll']){_0x26cf73[_0xce08('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0xce08('0x3f')](_0x26cf73);})[_0xce08('0x23')](function(_0x2284f5){_0x147a4b[_0xce08('0x40')]=_0x2284f5;return _0x147a4b;})[_0xce08('0x23')](respondWithFilteredResult(_0x4e6046,_0x26cf73))[_0xce08('0x41')](handleError(_0x4e6046,null));};exports[_0xce08('0x42')]=function(_0x43ef5d,_0x395dd7){var _0xf09d7e={'raw':!![],'where':{'id':_0x43ef5d['params']['id']}},_0x5bc3e7={};_0x5bc3e7[_0xce08('0x30')]=_[_0xce08('0x2e')](db[_0xce08('0x43')][_0xce08('0x2a')]);_0x5bc3e7[_0xce08('0x2d')]=_[_0xce08('0x2e')](_0x43ef5d[_0xce08('0x2d')]);_0x5bc3e7[_0xce08('0x39')]=_['intersection'](_0x5bc3e7[_0xce08('0x30')],_0x5bc3e7['query']);_0xf09d7e[_0xce08('0x31')]=_['intersection'](_0x5bc3e7[_0xce08('0x30')],qs[_0xce08('0x32')](_0x43ef5d['query'][_0xce08('0x32')]));_0xf09d7e[_0xce08('0x31')]=_0xf09d7e['attributes']['length']?_0xf09d7e[_0xce08('0x31')]:_0x5bc3e7['model'];if(_0x43ef5d['query']['includeAll']){_0xf09d7e['include']=[{'all':!![]}];}_0xf09d7e=_['merge']({},_0xf09d7e,_0x43ef5d[_0xce08('0x44')]);return db['SquareReport']['find'](_0xf09d7e)[_0xce08('0x23')](handleEntityNotFound(_0x395dd7,null))[_0xce08('0x23')](respondWithResult(_0x395dd7,null))[_0xce08('0x41')](handleError(_0x395dd7,null));};exports[_0xce08('0x45')]=function(_0x56d996,_0x4cf6bf){return db['SquareReport'][_0xce08('0x45')](_0x56d996[_0xce08('0x46')],{})['then'](respondWithResult(_0x4cf6bf,0xc9))[_0xce08('0x41')](handleError(_0x4cf6bf,null));};exports[_0xce08('0x22')]=function(_0x42c558,_0x39c125){if(_0x42c558[_0xce08('0x46')]['id']){delete _0x42c558[_0xce08('0x46')]['id'];}return db[_0xce08('0x43')][_0xce08('0x47')]({'where':{'id':_0x42c558[_0xce08('0x48')]['id']}})[_0xce08('0x23')](handleEntityNotFound(_0x39c125,null))[_0xce08('0x23')](saveUpdates(_0x42c558[_0xce08('0x46')],null))[_0xce08('0x23')](respondWithResult(_0x39c125,null))[_0xce08('0x41')](handleError(_0x39c125,null));};exports[_0xce08('0x24')]=function(_0x1a3d5d,_0x14a5c4){return db[_0xce08('0x43')][_0xce08('0x47')]({'where':{'id':_0x1a3d5d['params']['id']}})[_0xce08('0x23')](handleEntityNotFound(_0x14a5c4,null))['then'](removeEntity(_0x14a5c4,null))[_0xce08('0x41')](handleError(_0x14a5c4,null));};exports['describe']=function(_0x5e41f1,_0x190f65){return db['SquareReport'][_0xce08('0x49')]()[_0xce08('0x23')](respondWithResult(_0x190f65,null))['catch'](handleError(_0x190f65,null));}; \ No newline at end of file +var _0xda48=['catch','create','body','describe','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareReport','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','params','keys','rawAttributes','includeAll','find'];(function(_0x17356a,_0x2a88a5){var _0xb5d0ac=function(_0x194194){while(--_0x194194){_0x17356a['push'](_0x17356a['shift']());}};_0xb5d0ac(++_0x2a88a5);}(_0xda48,0x94));var _0x8da4=function(_0xc2120b,_0x439d09){_0xc2120b=_0xc2120b-0x0;var _0x10e35d=_0xda48[_0xc2120b];return _0x10e35d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8da4('0x0'));var jsonpatch=require(_0x8da4('0x1'));var rp=require('request-promise');var moment=require(_0x8da4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8da4('0x3'));var util=require(_0x8da4('0x4'));var path=require(_0x8da4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8da4('0x6'));var fs=require('fs');var fs_extra=require(_0x8da4('0x7'));var _=require(_0x8da4('0x8'));var squel=require(_0x8da4('0x9'));var crypto=require('crypto');var jsforce=require(_0x8da4('0xa'));var deskjs=require(_0x8da4('0xb'));var toCsv=require(_0x8da4('0xc'));var querystring=require(_0x8da4('0xd'));var Papa=require(_0x8da4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8da4('0xf'));var as=require(_0x8da4('0x10'));var hardwareService=require(_0x8da4('0x11'));var logger=require('../../config/logger')(_0x8da4('0x12'));var utils=require(_0x8da4('0x13'));var config=require(_0x8da4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8da4('0x15'))['db'];function respondWithStatusCode(_0xb32628,_0x9fdf3b){_0x9fdf3b=_0x9fdf3b||0xcc;return function(_0x5ca2f0){if(_0x5ca2f0){return _0xb32628[_0x8da4('0x16')](_0x9fdf3b);}return _0xb32628[_0x8da4('0x17')](_0x9fdf3b)[_0x8da4('0x18')]();};}function respondWithResult(_0x1ccc7f,_0x4ee334){_0x4ee334=_0x4ee334||0xc8;return function(_0x218e93){if(_0x218e93){return _0x1ccc7f[_0x8da4('0x17')](_0x4ee334)[_0x8da4('0x19')](_0x218e93);}};}function respondWithFilteredResult(_0x40952a,_0x969392){return function(_0x57e88a){if(_0x57e88a){var _0x308477=typeof _0x969392['offset']===_0x8da4('0x1a')&&typeof _0x969392[_0x8da4('0x1b')]===_0x8da4('0x1a');var _0x46cec2=_0x57e88a['count'];var _0x2b46da=_0x308477?0x0:_0x969392[_0x8da4('0x1c')];var _0x4fd0dd=_0x308477?_0x57e88a[_0x8da4('0x1d')]:_0x969392['offset']+_0x969392[_0x8da4('0x1b')];var _0x36fdd5;if(_0x4fd0dd>=_0x46cec2){_0x4fd0dd=_0x46cec2;_0x36fdd5=0xc8;}else{_0x36fdd5=0xce;}_0x40952a['status'](_0x36fdd5);return _0x40952a['set'](_0x8da4('0x1e'),_0x2b46da+'-'+_0x4fd0dd+'/'+_0x46cec2)[_0x8da4('0x19')](_0x57e88a);}return null;};}function patchUpdates(_0x4064bd){return function(_0x3574fa){try{jsonpatch[_0x8da4('0x1f')](_0x3574fa,_0x4064bd,!![]);}catch(_0x3fbf65){return BPromise[_0x8da4('0x20')](_0x3fbf65);}return _0x3574fa[_0x8da4('0x21')]();};}function saveUpdates(_0x54007d,_0x1cf33b){return function(_0x58c4ac){if(_0x58c4ac){return _0x58c4ac[_0x8da4('0x22')](_0x54007d)[_0x8da4('0x23')](function(_0xc994d0){return _0xc994d0;});}return null;};}function removeEntity(_0x32228d,_0x2993ad){return function(_0x4139f3){if(_0x4139f3){return _0x4139f3[_0x8da4('0x24')]()[_0x8da4('0x23')](function(){_0x32228d[_0x8da4('0x17')](0xcc)[_0x8da4('0x18')]();});}};}function handleEntityNotFound(_0x374079,_0x2f85fe){return function(_0xeb11bc){if(!_0xeb11bc){_0x374079['sendStatus'](0x194);}return _0xeb11bc;};}function handleError(_0x4bcc1e,_0x1646e1){_0x1646e1=_0x1646e1||0x1f4;return function(_0x442989){logger['error'](_0x442989[_0x8da4('0x25')]);if(_0x442989[_0x8da4('0x26')]){delete _0x442989[_0x8da4('0x26')];}_0x4bcc1e['status'](_0x1646e1)[_0x8da4('0x27')](_0x442989);};}exports[_0x8da4('0x28')]=function(_0x259323,_0x199dbc){var _0x4f1719={},_0x5cd89c={},_0x3d23ab={'count':0x0,'rows':[]};var _0x30c9b0=_[_0x8da4('0x29')](db[_0x8da4('0x2a')]['rawAttributes'],function(_0x274a57){return{'name':_0x274a57[_0x8da4('0x2b')],'type':_0x274a57[_0x8da4('0x2c')][_0x8da4('0x2d')]};});_0x5cd89c['model']=_[_0x8da4('0x29')](_0x30c9b0,_0x8da4('0x26'));_0x5cd89c[_0x8da4('0x2e')]=_['keys'](_0x259323[_0x8da4('0x2e')]);_0x5cd89c['filters']=_[_0x8da4('0x2f')](_0x5cd89c[_0x8da4('0x30')],_0x5cd89c[_0x8da4('0x2e')]);_0x4f1719[_0x8da4('0x31')]=_[_0x8da4('0x2f')](_0x5cd89c[_0x8da4('0x30')],qs[_0x8da4('0x32')](_0x259323[_0x8da4('0x2e')][_0x8da4('0x32')]));_0x4f1719['attributes']=_0x4f1719[_0x8da4('0x31')][_0x8da4('0x33')]?_0x4f1719[_0x8da4('0x31')]:_0x5cd89c[_0x8da4('0x30')];if(!_0x259323[_0x8da4('0x2e')]['hasOwnProperty'](_0x8da4('0x34'))){_0x4f1719[_0x8da4('0x1b')]=qs[_0x8da4('0x1b')](_0x259323[_0x8da4('0x2e')][_0x8da4('0x1b')]);_0x4f1719['offset']=qs[_0x8da4('0x1c')](_0x259323['query'][_0x8da4('0x1c')]);}_0x4f1719[_0x8da4('0x35')]=qs[_0x8da4('0x36')](_0x259323[_0x8da4('0x2e')][_0x8da4('0x36')]);_0x4f1719[_0x8da4('0x37')]=qs[_0x8da4('0x38')](_[_0x8da4('0x39')](_0x259323[_0x8da4('0x2e')],_0x5cd89c['filters']),_0x30c9b0);if(_0x259323['query'][_0x8da4('0x3a')]){_0x4f1719['where']=_[_0x8da4('0x3b')](_0x4f1719['where'],{'$or':_[_0x8da4('0x29')](_0x30c9b0,function(_0x3106c9){if(_0x3106c9[_0x8da4('0x2c')]!==_0x8da4('0x3c')){var _0x4537fb={};_0x4537fb[_0x3106c9[_0x8da4('0x26')]]={'$like':'%'+_0x259323[_0x8da4('0x2e')][_0x8da4('0x3a')]+'%'};return _0x4537fb;}})});}_0x4f1719=_[_0x8da4('0x3b')]({},_0x4f1719,_0x259323['options']);var _0x492818={'where':_0x4f1719[_0x8da4('0x37')]};return db[_0x8da4('0x2a')]['count'](_0x492818)['then'](function(_0x1472fb){_0x3d23ab[_0x8da4('0x1d')]=_0x1472fb;if(_0x259323[_0x8da4('0x2e')]['includeAll']){_0x4f1719[_0x8da4('0x3d')]=[{'all':!![]}];}return db['SquareReport'][_0x8da4('0x3e')](_0x4f1719);})[_0x8da4('0x23')](function(_0x1b43ef){_0x3d23ab['rows']=_0x1b43ef;return _0x3d23ab;})['then'](respondWithFilteredResult(_0x199dbc,_0x4f1719))['catch'](handleError(_0x199dbc,null));};exports['show']=function(_0x2b4e05,_0x169106){var _0x3b1f87={'raw':!![],'where':{'id':_0x2b4e05[_0x8da4('0x3f')]['id']}},_0x54e591={};_0x54e591[_0x8da4('0x30')]=_[_0x8da4('0x40')](db[_0x8da4('0x2a')][_0x8da4('0x41')]);_0x54e591[_0x8da4('0x2e')]=_[_0x8da4('0x40')](_0x2b4e05[_0x8da4('0x2e')]);_0x54e591[_0x8da4('0x38')]=_[_0x8da4('0x2f')](_0x54e591['model'],_0x54e591['query']);_0x3b1f87[_0x8da4('0x31')]=_[_0x8da4('0x2f')](_0x54e591[_0x8da4('0x30')],qs[_0x8da4('0x32')](_0x2b4e05[_0x8da4('0x2e')]['fields']));_0x3b1f87[_0x8da4('0x31')]=_0x3b1f87[_0x8da4('0x31')][_0x8da4('0x33')]?_0x3b1f87['attributes']:_0x54e591[_0x8da4('0x30')];if(_0x2b4e05[_0x8da4('0x2e')][_0x8da4('0x42')]){_0x3b1f87[_0x8da4('0x3d')]=[{'all':!![]}];}_0x3b1f87=_[_0x8da4('0x3b')]({},_0x3b1f87,_0x2b4e05['options']);return db[_0x8da4('0x2a')][_0x8da4('0x43')](_0x3b1f87)[_0x8da4('0x23')](handleEntityNotFound(_0x169106,null))[_0x8da4('0x23')](respondWithResult(_0x169106,null))[_0x8da4('0x44')](handleError(_0x169106,null));};exports[_0x8da4('0x45')]=function(_0x9889d1,_0x3149bf){return db['SquareReport']['create'](_0x9889d1['body'],{})[_0x8da4('0x23')](respondWithResult(_0x3149bf,0xc9))[_0x8da4('0x44')](handleError(_0x3149bf,null));};exports[_0x8da4('0x22')]=function(_0x308dd0,_0x21f0e4){if(_0x308dd0[_0x8da4('0x46')]['id']){delete _0x308dd0[_0x8da4('0x46')]['id'];}return db[_0x8da4('0x2a')][_0x8da4('0x43')]({'where':{'id':_0x308dd0['params']['id']}})['then'](handleEntityNotFound(_0x21f0e4,null))['then'](saveUpdates(_0x308dd0[_0x8da4('0x46')],null))[_0x8da4('0x23')](respondWithResult(_0x21f0e4,null))[_0x8da4('0x44')](handleError(_0x21f0e4,null));};exports[_0x8da4('0x24')]=function(_0xab1db0,_0x457c94){return db[_0x8da4('0x2a')][_0x8da4('0x43')]({'where':{'id':_0xab1db0[_0x8da4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x457c94,null))[_0x8da4('0x23')](removeEntity(_0x457c94,null))['catch'](handleError(_0x457c94,null));};exports[_0x8da4('0x47')]=function(_0xe4da87,_0x493af2){return db[_0x8da4('0x2a')]['describe']()[_0x8da4('0x23')](respondWithResult(_0x493af2,null))['catch'](handleError(_0x493af2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d02be8d..b3c558f 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 _0x1cf6=['../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','moment','path','rimraf'];(function(_0x20122c,_0x2d0760){var _0xbaad10=function(_0x26c627){while(--_0x26c627){_0x20122c['push'](_0x20122c['shift']());}};_0xbaad10(++_0x2d0760);}(_0x1cf6,0xf3));var _0x61cf=function(_0x49ebd5,_0x397420){_0x49ebd5=_0x49ebd5-0x0;var _0x391e85=_0x1cf6[_0x49ebd5];return _0x391e85;};'use strict';var _=require(_0x61cf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x61cf('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x61cf('0x2'));var rimraf=require(_0x61cf('0x3'));var config=require(_0x61cf('0x4'));var attributes=require(_0x61cf('0x5'));module[_0x61cf('0x6')]=function(_0x59e6b5,_0x2fb6da){return _0x59e6b5[_0x61cf('0x7')](_0x61cf('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x61cf('0x9'),'fields':[_0x61cf('0xa'),_0x61cf('0xb')]},{'name':_0x61cf('0xc'),'fields':[_0x61cf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa00e=['report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','moment','bluebird','request-promise','path','rimraf','define','SquareReport'];(function(_0x1effb9,_0x37dccf){var _0x450c15=function(_0x2de889){while(--_0x2de889){_0x1effb9['push'](_0x1effb9['shift']());}};_0x450c15(++_0x37dccf);}(_0xa00e,0x17f));var _0xea00=function(_0x27243f,_0x4685db){_0x27243f=_0x27243f-0x0;var _0x5c9b05=_0xa00e[_0x27243f];return _0x5c9b05;};'use strict';var _=require(_0xea00('0x0'));var util=require(_0xea00('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xea00('0x2'));var BPromise=require(_0xea00('0x3'));var rp=require(_0xea00('0x4'));var fs=require('fs');var path=require(_0xea00('0x5'));var rimraf=require(_0xea00('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x5b47d4,_0x41a524){return _0x5b47d4[_0xea00('0x7')](_0xea00('0x8'),attributes,{'tableName':_0xea00('0x9'),'paranoid':![],'indexes':[{'name':_0xea00('0xa'),'fields':[_0xea00('0xb'),_0xea00('0xc')]},{'name':_0xea00('0xd'),'fields':[_0xea00('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 07a48c3..40dae0e 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 _0xeef6=['error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x605a27,_0x4d289a){var _0x4b2218=function(_0x47632e){while(--_0x47632e){_0x605a27['push'](_0x605a27['shift']());}};_0x4b2218(++_0x4d289a);}(_0xeef6,0x7f));var _0x6eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef6[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x6eef('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6eef('0x1'));var fs=require('fs');var Redis=require(_0x6eef('0x2'));var db=require(_0x6eef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6eef('0x4'))(_0x6eef('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6eef('0x6')][_0x6eef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x442019,_0x12ae3a,_0xb9ab65){return new BPromise(function(_0x99777,_0x22e291){return client['request'](_0x442019,_0xb9ab65)[_0x6eef('0x8')](function(_0x251909){logger[_0x6eef('0x9')]('SquareReport,\x20%s,\x20%s',_0x12ae3a,_0x6eef('0xa'));logger['debug'](_0x6eef('0xb'),_0x12ae3a,_0x6eef('0xa'),JSON[_0x6eef('0xc')](_0x251909));if(_0x251909[_0x6eef('0xd')]){if(_0x251909[_0x6eef('0xd')][_0x6eef('0xe')]===0x1f4){logger['error'](_0x6eef('0xf'),_0x12ae3a,_0x251909[_0x6eef('0xd')][_0x6eef('0x10')]);return _0x22e291(_0x251909['error'][_0x6eef('0x10')]);}logger[_0x6eef('0xd')]('SquareReport,\x20%s,\x20%s',_0x12ae3a,_0x251909[_0x6eef('0xd')][_0x6eef('0x10')]);return _0x99777(_0x251909[_0x6eef('0xd')]['message']);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x12ae3a,_0x6eef('0xa'));_0x99777(_0x251909[_0x6eef('0x11')][_0x6eef('0x10')]);}})[_0x6eef('0x12')](function(_0x3425e3){logger[_0x6eef('0xd')]('SquareReport,\x20%s,\x20%s',_0x12ae3a,_0x3425e3);_0x22e291(_0x3425e3);});});}exports[_0x6eef('0x13')]=function(_0x43c59b){var _0x4c1f47=this;return new Promise(function(_0x3b29a3,_0x6acce7){return db[_0x6eef('0x14')]['create'](_0x43c59b[_0x6eef('0x15')],{'raw':_0x43c59b['options']?_0x43c59b[_0x6eef('0x16')][_0x6eef('0x17')]===undefined?!![]:![]:!![]})[_0x6eef('0x8')](function(_0x5e3712){logger[_0x6eef('0x9')](_0x6eef('0x13'),_0x43c59b);logger[_0x6eef('0x18')](_0x6eef('0x13'),_0x43c59b,JSON[_0x6eef('0xc')](_0x5e3712));_0x3b29a3(_0x5e3712);})['catch'](function(_0x476547){logger[_0x6eef('0xd')](_0x6eef('0x13'),_0x476547[_0x6eef('0x10')],_0x43c59b);_0x6acce7(_0x4c1f47[_0x6eef('0xd')](0x1f4,_0x476547['message']));});});};exports[_0x6eef('0x19')]=function(_0x268d29){var _0x2ba629=this;return new Promise(function(_0x1f2596,_0x48ab44){return db['SquareReport']['update'](_0x268d29[_0x6eef('0x15')],{'raw':_0x268d29['options']?_0x268d29[_0x6eef('0x16')][_0x6eef('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268d29[_0x6eef('0x16')]?_0x268d29[_0x6eef('0x16')]['where']||null:null,'attributes':_0x268d29[_0x6eef('0x16')]?_0x268d29[_0x6eef('0x16')][_0x6eef('0x1a')]||null:null,'limit':_0x268d29[_0x6eef('0x16')]?_0x268d29[_0x6eef('0x16')][_0x6eef('0x1b')]||null:null})[_0x6eef('0x8')](function(_0x198a5d){logger[_0x6eef('0x9')](_0x6eef('0x19'),_0x268d29);logger[_0x6eef('0x18')](_0x6eef('0x19'),_0x268d29,JSON[_0x6eef('0xc')](_0x198a5d));_0x1f2596(_0x198a5d);})[_0x6eef('0x12')](function(_0x45f81d){logger[_0x6eef('0xd')](_0x6eef('0x19'),_0x45f81d[_0x6eef('0x10')],_0x268d29);_0x48ab44(_0x2ba629[_0x6eef('0xd')](0x1f4,_0x45f81d[_0x6eef('0x10')]));});});}; \ No newline at end of file +var _0x0d44=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareReport','create','options','info','CreateSquareReport','UpdateSquareReport','update','body','where','attributes','limit','stringify','moment','bluebird','randomstring'];(function(_0x2587cb,_0x3fdfec){var _0x1f2523=function(_0x14c840){while(--_0x14c840){_0x2587cb['push'](_0x2587cb['shift']());}};_0x1f2523(++_0x3fdfec);}(_0x0d44,0x168));var _0x40d4=function(_0x89a678,_0x25ab72){_0x89a678=_0x89a678-0x0;var _0x35fdca=_0x0d44[_0x89a678];return _0x35fdca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x40d4('0x0'));var BPromise=require(_0x40d4('0x1'));var rs=require(_0x40d4('0x2'));var fs=require('fs');var Redis=require(_0x40d4('0x3'));var db=require(_0x40d4('0x4'))['db'];var utils=require(_0x40d4('0x5'));var logger=require(_0x40d4('0x6'))(_0x40d4('0x7'));var config=require(_0x40d4('0x8'));var jayson=require(_0x40d4('0x9'));var client=jayson[_0x40d4('0xa')][_0x40d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x265cbc,_0x2cfce7,_0x4f7366){return new BPromise(function(_0x128ef0,_0x40778b){return client['request'](_0x265cbc,_0x4f7366)[_0x40d4('0xc')](function(_0x2bbcfa){logger['info'](_0x40d4('0xd'),_0x2cfce7,_0x40d4('0xe'));logger[_0x40d4('0xf')](_0x40d4('0x10'),_0x2cfce7,_0x40d4('0xe'),JSON['stringify'](_0x2bbcfa));if(_0x2bbcfa[_0x40d4('0x11')]){if(_0x2bbcfa[_0x40d4('0x11')]['code']===0x1f4){logger['error'](_0x40d4('0xd'),_0x2cfce7,_0x2bbcfa[_0x40d4('0x11')][_0x40d4('0x12')]);return _0x40778b(_0x2bbcfa[_0x40d4('0x11')][_0x40d4('0x12')]);}logger['error'](_0x40d4('0xd'),_0x2cfce7,_0x2bbcfa['error'][_0x40d4('0x12')]);return _0x128ef0(_0x2bbcfa[_0x40d4('0x11')][_0x40d4('0x12')]);}else{logger['info'](_0x40d4('0xd'),_0x2cfce7,_0x40d4('0xe'));_0x128ef0(_0x2bbcfa[_0x40d4('0x13')][_0x40d4('0x12')]);}})[_0x40d4('0x14')](function(_0x1ad35f){logger[_0x40d4('0x11')](_0x40d4('0xd'),_0x2cfce7,_0x1ad35f);_0x40778b(_0x1ad35f);});});}exports['CreateSquareReport']=function(_0x33da73){var _0x564dee=this;return new Promise(function(_0x470679,_0x45fb6c){return db[_0x40d4('0x15')][_0x40d4('0x16')](_0x33da73['body'],{'raw':_0x33da73[_0x40d4('0x17')]?_0x33da73[_0x40d4('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x40d4('0xc')](function(_0x382933){logger[_0x40d4('0x18')](_0x40d4('0x19'),_0x33da73);logger[_0x40d4('0xf')](_0x40d4('0x19'),_0x33da73,JSON['stringify'](_0x382933));_0x470679(_0x382933);})[_0x40d4('0x14')](function(_0x584635){logger[_0x40d4('0x11')]('CreateSquareReport',_0x584635[_0x40d4('0x12')],_0x33da73);_0x45fb6c(_0x564dee[_0x40d4('0x11')](0x1f4,_0x584635[_0x40d4('0x12')]));});});};exports[_0x40d4('0x1a')]=function(_0x1d4c35){var _0x26638a=this;return new Promise(function(_0x4ee2f5,_0x246ab4){return db[_0x40d4('0x15')][_0x40d4('0x1b')](_0x1d4c35[_0x40d4('0x1c')],{'raw':_0x1d4c35[_0x40d4('0x17')]?_0x1d4c35[_0x40d4('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d4c35[_0x40d4('0x17')]?_0x1d4c35[_0x40d4('0x17')][_0x40d4('0x1d')]||null:null,'attributes':_0x1d4c35[_0x40d4('0x17')]?_0x1d4c35[_0x40d4('0x17')][_0x40d4('0x1e')]||null:null,'limit':_0x1d4c35['options']?_0x1d4c35[_0x40d4('0x17')][_0x40d4('0x1f')]||null:null})['then'](function(_0x3de664){logger['info'](_0x40d4('0x1a'),_0x1d4c35);logger[_0x40d4('0xf')]('UpdateSquareReport',_0x1d4c35,JSON[_0x40d4('0x20')](_0x3de664));_0x4ee2f5(_0x3de664);})[_0x40d4('0x14')](function(_0x585f42){logger[_0x40d4('0x11')](_0x40d4('0x1a'),_0x585f42[_0x40d4('0x12')],_0x1d4c35);_0x246ab4(_0x26638a[_0x40d4('0x11')](0x1f4,_0x585f42[_0x40d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e40ae02..2dccbf6 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 _0xabc3=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','delete','destroy','exports','multer'];(function(_0x4fd2ca,_0x488418){var _0x9e01c5=function(_0x2bcb2f){while(--_0x2bcb2f){_0x4fd2ca['push'](_0x4fd2ca['shift']());}};_0x9e01c5(++_0x488418);}(_0xabc3,0x1a1));var _0x3abc=function(_0x52add8,_0xddad4d){_0x52add8=_0x52add8-0x0;var _0x30420d=_0xabc3[_0x52add8];return _0x30420d;};'use strict';var multer=require(_0x3abc('0x0'));var util=require(_0x3abc('0x1'));var path=require(_0x3abc('0x2'));var timeout=require(_0x3abc('0x3'));var express=require('express');var router=express[_0x3abc('0x4')]();var fs_extra=require(_0x3abc('0x5'));var auth=require(_0x3abc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3abc('0x7'));router['get']('/',auth[_0x3abc('0x8')](),controller[_0x3abc('0x9')]);router[_0x3abc('0xa')](_0x3abc('0xb'),auth[_0x3abc('0x8')](),controller[_0x3abc('0xc')]);router[_0x3abc('0xa')](_0x3abc('0xd'),auth[_0x3abc('0x8')](),controller['show']);router[_0x3abc('0xe')]('/',auth[_0x3abc('0x8')](),controller[_0x3abc('0xf')]);router['put'](_0x3abc('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3abc('0x10')](_0x3abc('0xd'),auth[_0x3abc('0x8')](),controller[_0x3abc('0x11')]);module[_0x3abc('0x12')]=router; \ No newline at end of file +var _0xac7a=['multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x28efae,_0x27d20a){var _0x27d0b2=function(_0x221e95){while(--_0x221e95){_0x28efae['push'](_0x28efae['shift']());}};_0x27d0b2(++_0x27d20a);}(_0xac7a,0xe7));var _0xaac7=function(_0x3895f4,_0x49e89f){_0x3895f4=_0x3895f4-0x0;var _0x517156=_0xac7a[_0x3895f4];return _0x517156;};'use strict';var multer=require(_0xaac7('0x0'));var util=require(_0xaac7('0x1'));var path=require(_0xaac7('0x2'));var timeout=require('connect-timeout');var express=require(_0xaac7('0x3'));var router=express['Router']();var fs_extra=require(_0xaac7('0x4'));var auth=require(_0xaac7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaac7('0x6'));var controller=require(_0xaac7('0x7'));router[_0xaac7('0x8')]('/',auth[_0xaac7('0x9')](),controller[_0xaac7('0xa')]);router[_0xaac7('0x8')](_0xaac7('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xaac7('0x9')](),controller[_0xaac7('0xc')]);router[_0xaac7('0xd')]('/',auth[_0xaac7('0x9')](),controller[_0xaac7('0xe')]);router[_0xaac7('0xf')](_0xaac7('0x10'),auth[_0xaac7('0x9')](),controller[_0xaac7('0x11')]);router[_0xaac7('0x12')](_0xaac7('0x10'),auth['isAuthenticated'](),controller[_0xaac7('0x13')]);module[_0xaac7('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 904fb99..1cdeb8a 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 _0x4b42=['sequelize','exports','STRING','TEXT'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x4b42,0x128));var _0x24b4=function(_0x3a21dd,_0x5c66e7){_0x3a21dd=_0x3a21dd-0x0;var _0x44eed4=_0x4b42[_0x3a21dd];return _0x44eed4;};'use strict';var Sequelize=require(_0x24b4('0x0'));module[_0x24b4('0x1')]={'uniqueid':{'type':Sequelize[_0x24b4('0x2')]},'node':{'type':Sequelize[_0x24b4('0x2')]},'application':{'type':Sequelize[_0x24b4('0x2')]},'data':{'type':Sequelize[_0x24b4('0x3')]},'project_name':{'type':Sequelize[_0x24b4('0x2')]},'callerid':{'type':Sequelize[_0x24b4('0x2')]}}; \ No newline at end of file +var _0xb7aa=['exports','STRING','TEXT','sequelize'];(function(_0x224721,_0x45b988){var _0x145358=function(_0x42305e){while(--_0x42305e){_0x224721['push'](_0x224721['shift']());}};_0x145358(++_0x45b988);}(_0xb7aa,0x13b));var _0xab7a=function(_0x113be5,_0x26841e){_0x113be5=_0x113be5-0x0;var _0x281569=_0xb7aa[_0x113be5];return _0x281569;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'uniqueid':{'type':Sequelize[_0xab7a('0x2')]},'node':{'type':Sequelize[_0xab7a('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xab7a('0x3')]},'project_name':{'type':Sequelize[_0xab7a('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 469bf00..e26a0ec 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 _0x3c97=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x414190,_0x212905){var _0x175b03=function(_0x2bd11f){while(--_0x2bd11f){_0x414190['push'](_0x414190['shift']());}};_0x175b03(++_0x212905);}(_0x3c97,0x114));var _0x73c9=function(_0x217d7d,_0x53c53b){_0x217d7d=_0x217d7d-0x0;var _0xd8f61=_0x3c97[_0x217d7d];return _0xd8f61;};'use strict';var emlformat=require(_0x73c9('0x0'));var rimraf=require(_0x73c9('0x1'));var zipdir=require(_0x73c9('0x2'));var jsonpatch=require(_0x73c9('0x3'));var rp=require('request-promise');var moment=require(_0x73c9('0x4'));var BPromise=require(_0x73c9('0x5'));var Mustache=require('mustache');var util=require(_0x73c9('0x6'));var path=require(_0x73c9('0x7'));var sox=require(_0x73c9('0x8'));var csv=require(_0x73c9('0x9'));var ejs=require(_0x73c9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x73c9('0xb'));var squel=require(_0x73c9('0xc'));var crypto=require(_0x73c9('0xd'));var jsforce=require(_0x73c9('0xe'));var deskjs=require(_0x73c9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x73c9('0x10'));var Papa=require(_0x73c9('0x11'));var Redis=require(_0x73c9('0x12'));var authService=require(_0x73c9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x73c9('0x14'));var hardwareService=require(_0x73c9('0x15'));var logger=require(_0x73c9('0x16'))('api');var utils=require(_0x73c9('0x17'));var config=require(_0x73c9('0x18'));var licenseUtil=require(_0x73c9('0x19'));var db=require(_0x73c9('0x1a'))['db'];function respondWithStatusCode(_0x60d89d,_0x1548e3){_0x1548e3=_0x1548e3||0xcc;return function(_0x2bcbce){if(_0x2bcbce){return _0x60d89d[_0x73c9('0x1b')](_0x1548e3);}return _0x60d89d[_0x73c9('0x1c')](_0x1548e3)[_0x73c9('0x1d')]();};}function respondWithResult(_0x5c5a9d,_0xaf7ec8){_0xaf7ec8=_0xaf7ec8||0xc8;return function(_0x457719){if(_0x457719){return _0x5c5a9d['status'](_0xaf7ec8)[_0x73c9('0x1e')](_0x457719);}};}function respondWithFilteredResult(_0xee2039,_0x253476){return function(_0xf1d81f){if(_0xf1d81f){var _0x44e3ce=typeof _0x253476[_0x73c9('0x1f')]==='undefined'&&typeof _0x253476[_0x73c9('0x20')]===_0x73c9('0x21');var _0x264ada=_0xf1d81f[_0x73c9('0x22')];var _0x27f6cf=_0x44e3ce?0x0:_0x253476[_0x73c9('0x1f')];var _0x519bcb=_0x44e3ce?_0xf1d81f[_0x73c9('0x22')]:_0x253476[_0x73c9('0x1f')]+_0x253476[_0x73c9('0x20')];var _0x3b7ad0;if(_0x519bcb>=_0x264ada){_0x519bcb=_0x264ada;_0x3b7ad0=0xc8;}else{_0x3b7ad0=0xce;}_0xee2039[_0x73c9('0x1c')](_0x3b7ad0);return _0xee2039[_0x73c9('0x23')](_0x73c9('0x24'),_0x27f6cf+'-'+_0x519bcb+'/'+_0x264ada)[_0x73c9('0x1e')](_0xf1d81f);}return null;};}function patchUpdates(_0x5ef0f5){return function(_0x2cb112){try{jsonpatch[_0x73c9('0x25')](_0x2cb112,_0x5ef0f5,!![]);}catch(_0x1d9ab4){return BPromise['reject'](_0x1d9ab4);}return _0x2cb112['save']();};}function saveUpdates(_0x4321f4,_0x3483fe){return function(_0x22d201){if(_0x22d201){return _0x22d201[_0x73c9('0x26')](_0x4321f4)[_0x73c9('0x27')](function(_0x2146f5){return _0x2146f5;});}return null;};}function removeEntity(_0x1b00ba,_0xa5f3ad){return function(_0x14aedb){if(_0x14aedb){return _0x14aedb[_0x73c9('0x28')]()[_0x73c9('0x27')](function(){_0x1b00ba[_0x73c9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0578,_0x5bfb6d){return function(_0x25079d){if(!_0x25079d){_0x3b0578[_0x73c9('0x1b')](0x194);}return _0x25079d;};}function handleError(_0x202a4e,_0x529df8){_0x529df8=_0x529df8||0x1f4;return function(_0x22962b){logger['error'](_0x22962b[_0x73c9('0x29')]);if(_0x22962b[_0x73c9('0x2a')]){delete _0x22962b[_0x73c9('0x2a')];}_0x202a4e[_0x73c9('0x1c')](_0x529df8)[_0x73c9('0x2b')](_0x22962b);};}exports[_0x73c9('0x2c')]=function(_0x33b84c,_0xf4c520){var _0x14fd75={},_0x116fbd={},_0x10e79e={'count':0x0,'rows':[]};var _0x523f85=_[_0x73c9('0x2d')](db[_0x73c9('0x2e')][_0x73c9('0x2f')],function(_0x45a29){return{'name':_0x45a29[_0x73c9('0x30')],'type':_0x45a29[_0x73c9('0x31')]['key']};});_0x116fbd[_0x73c9('0x32')]=_['map'](_0x523f85,_0x73c9('0x2a'));_0x116fbd[_0x73c9('0x33')]=_[_0x73c9('0x34')](_0x33b84c[_0x73c9('0x33')]);_0x116fbd[_0x73c9('0x35')]=_['intersection'](_0x116fbd[_0x73c9('0x32')],_0x116fbd['query']);_0x14fd75['attributes']=_[_0x73c9('0x36')](_0x116fbd[_0x73c9('0x32')],qs[_0x73c9('0x37')](_0x33b84c[_0x73c9('0x33')][_0x73c9('0x37')]));_0x14fd75[_0x73c9('0x38')]=_0x14fd75[_0x73c9('0x38')]['length']?_0x14fd75[_0x73c9('0x38')]:_0x116fbd[_0x73c9('0x32')];if(!_0x33b84c[_0x73c9('0x33')][_0x73c9('0x39')]('nolimit')){_0x14fd75[_0x73c9('0x20')]=qs[_0x73c9('0x20')](_0x33b84c[_0x73c9('0x33')][_0x73c9('0x20')]);_0x14fd75[_0x73c9('0x1f')]=qs[_0x73c9('0x1f')](_0x33b84c[_0x73c9('0x33')][_0x73c9('0x1f')]);}_0x14fd75['order']=qs[_0x73c9('0x3a')](_0x33b84c[_0x73c9('0x33')][_0x73c9('0x3a')]);_0x14fd75[_0x73c9('0x3b')]=qs[_0x73c9('0x35')](_['pick'](_0x33b84c[_0x73c9('0x33')],_0x116fbd[_0x73c9('0x35')]),_0x523f85);if(_0x33b84c['query'][_0x73c9('0x3c')]){_0x14fd75[_0x73c9('0x3b')]=_[_0x73c9('0x3d')](_0x14fd75['where'],{'$or':_[_0x73c9('0x2d')](_0x523f85,function(_0x51f74f){if(_0x51f74f[_0x73c9('0x31')]!==_0x73c9('0x3e')){var _0x17e955={};_0x17e955[_0x51f74f[_0x73c9('0x2a')]]={'$like':'%'+_0x33b84c[_0x73c9('0x33')][_0x73c9('0x3c')]+'%'};return _0x17e955;}})});}_0x14fd75=_[_0x73c9('0x3d')]({},_0x14fd75,_0x33b84c[_0x73c9('0x3f')]);var _0x4bddfa={'where':_0x14fd75[_0x73c9('0x3b')]};return db[_0x73c9('0x2e')][_0x73c9('0x22')](_0x4bddfa)['then'](function(_0x348747){_0x10e79e[_0x73c9('0x22')]=_0x348747;if(_0x33b84c[_0x73c9('0x33')][_0x73c9('0x40')]){_0x14fd75['include']=[{'all':!![]}];}return db[_0x73c9('0x2e')]['findAll'](_0x14fd75);})[_0x73c9('0x27')](function(_0x4ca69b){_0x10e79e[_0x73c9('0x41')]=_0x4ca69b;return _0x10e79e;})[_0x73c9('0x27')](respondWithFilteredResult(_0xf4c520,_0x14fd75))['catch'](handleError(_0xf4c520,null));};exports[_0x73c9('0x42')]=function(_0x1d1f95,_0x2d551c){var _0x588fe1={'raw':!![],'where':{'id':_0x1d1f95[_0x73c9('0x43')]['id']}},_0x1d57a1={};_0x1d57a1['model']=_[_0x73c9('0x34')](db[_0x73c9('0x2e')][_0x73c9('0x2f')]);_0x1d57a1[_0x73c9('0x33')]=_[_0x73c9('0x34')](_0x1d1f95[_0x73c9('0x33')]);_0x1d57a1[_0x73c9('0x35')]=_[_0x73c9('0x36')](_0x1d57a1[_0x73c9('0x32')],_0x1d57a1[_0x73c9('0x33')]);_0x588fe1[_0x73c9('0x38')]=_[_0x73c9('0x36')](_0x1d57a1[_0x73c9('0x32')],qs[_0x73c9('0x37')](_0x1d1f95['query']['fields']));_0x588fe1[_0x73c9('0x38')]=_0x588fe1[_0x73c9('0x38')]['length']?_0x588fe1[_0x73c9('0x38')]:_0x1d57a1['model'];if(_0x1d1f95['query'][_0x73c9('0x40')]){_0x588fe1[_0x73c9('0x44')]=[{'all':!![]}];}_0x588fe1=_['merge']({},_0x588fe1,_0x1d1f95['options']);return db[_0x73c9('0x2e')]['find'](_0x588fe1)[_0x73c9('0x27')](handleEntityNotFound(_0x2d551c,null))[_0x73c9('0x27')](respondWithResult(_0x2d551c,null))[_0x73c9('0x45')](handleError(_0x2d551c,null));};exports[_0x73c9('0x46')]=function(_0x6504a5,_0x1bfa62){return db[_0x73c9('0x2e')]['create'](_0x6504a5[_0x73c9('0x47')],{})[_0x73c9('0x27')](respondWithResult(_0x1bfa62,0xc9))['catch'](handleError(_0x1bfa62,null));};exports['update']=function(_0x208904,_0x255d61){if(_0x208904[_0x73c9('0x47')]['id']){delete _0x208904['body']['id'];}return db[_0x73c9('0x2e')]['find']({'where':{'id':_0x208904[_0x73c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x255d61,null))[_0x73c9('0x27')](saveUpdates(_0x208904[_0x73c9('0x47')],null))['then'](respondWithResult(_0x255d61,null))[_0x73c9('0x45')](handleError(_0x255d61,null));};exports['destroy']=function(_0x12bca2,_0xf8cdf2){return db[_0x73c9('0x2e')][_0x73c9('0x48')]({'where':{'id':_0x12bca2[_0x73c9('0x43')]['id']}})[_0x73c9('0x27')](handleEntityNotFound(_0xf8cdf2,null))[_0x73c9('0x27')](removeEntity(_0xf8cdf2,null))[_0x73c9('0x45')](handleError(_0xf8cdf2,null));};exports['describe']=function(_0x3f6f85,_0x5e61fb){return db['SquareDetailsReport'][_0x73c9('0x49')]()[_0x73c9('0x27')](respondWithResult(_0x5e61fb,null))[_0x73c9('0x45')](handleError(_0x5e61fb,null));}; \ No newline at end of file +var _0x97e1=['findAll','rows','catch','show','params','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','options','includeAll','include'];(function(_0x574b7f,_0x5a758e){var _0x3da1af=function(_0x4b382e){while(--_0x4b382e){_0x574b7f['push'](_0x574b7f['shift']());}};_0x3da1af(++_0x5a758e);}(_0x97e1,0x176));var _0x197e=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x97e1[_0x1aeda2];return _0x32dc6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x197e('0x0'));var rp=require(_0x197e('0x1'));var moment=require(_0x197e('0x2'));var BPromise=require(_0x197e('0x3'));var Mustache=require(_0x197e('0x4'));var util=require(_0x197e('0x5'));var path=require(_0x197e('0x6'));var sox=require(_0x197e('0x7'));var csv=require(_0x197e('0x8'));var ejs=require(_0x197e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x197e('0xa'));var squel=require('squel');var crypto=require(_0x197e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x197e('0xc'));var toCsv=require(_0x197e('0x8'));var querystring=require('querystring');var Papa=require(_0x197e('0xd'));var Redis=require(_0x197e('0xe'));var authService=require(_0x197e('0xf'));var qs=require(_0x197e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197e('0x11'));var logger=require(_0x197e('0x12'))(_0x197e('0x13'));var utils=require(_0x197e('0x14'));var config=require(_0x197e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197e('0x16'))['db'];function respondWithStatusCode(_0x1f7a66,_0x2ccc37){_0x2ccc37=_0x2ccc37||0xcc;return function(_0x30b65e){if(_0x30b65e){return _0x1f7a66[_0x197e('0x17')](_0x2ccc37);}return _0x1f7a66['status'](_0x2ccc37)[_0x197e('0x18')]();};}function respondWithResult(_0xfa22de,_0x412c93){_0x412c93=_0x412c93||0xc8;return function(_0x5581e2){if(_0x5581e2){return _0xfa22de[_0x197e('0x19')](_0x412c93)[_0x197e('0x1a')](_0x5581e2);}};}function respondWithFilteredResult(_0x4b1eec,_0x484378){return function(_0x575fc1){if(_0x575fc1){var _0x3a9167=typeof _0x484378[_0x197e('0x1b')]===_0x197e('0x1c')&&typeof _0x484378[_0x197e('0x1d')]===_0x197e('0x1c');var _0x44b25a=_0x575fc1[_0x197e('0x1e')];var _0xee3c00=_0x3a9167?0x0:_0x484378[_0x197e('0x1b')];var _0x507b64=_0x3a9167?_0x575fc1[_0x197e('0x1e')]:_0x484378[_0x197e('0x1b')]+_0x484378[_0x197e('0x1d')];var _0x4ef0ac;if(_0x507b64>=_0x44b25a){_0x507b64=_0x44b25a;_0x4ef0ac=0xc8;}else{_0x4ef0ac=0xce;}_0x4b1eec['status'](_0x4ef0ac);return _0x4b1eec[_0x197e('0x1f')](_0x197e('0x20'),_0xee3c00+'-'+_0x507b64+'/'+_0x44b25a)[_0x197e('0x1a')](_0x575fc1);}return null;};}function patchUpdates(_0x21d4da){return function(_0x5bf09b){try{jsonpatch['apply'](_0x5bf09b,_0x21d4da,!![]);}catch(_0x2826f4){return BPromise[_0x197e('0x21')](_0x2826f4);}return _0x5bf09b[_0x197e('0x22')]();};}function saveUpdates(_0x1373ce,_0x4a69c7){return function(_0x161ec8){if(_0x161ec8){return _0x161ec8[_0x197e('0x23')](_0x1373ce)['then'](function(_0x2017e7){return _0x2017e7;});}return null;};}function removeEntity(_0x39597d,_0x14f439){return function(_0x57fca2){if(_0x57fca2){return _0x57fca2[_0x197e('0x24')]()[_0x197e('0x25')](function(){_0x39597d[_0x197e('0x19')](0xcc)[_0x197e('0x18')]();});}};}function handleEntityNotFound(_0x31f27e,_0x5b1166){return function(_0x5b8a5d){if(!_0x5b8a5d){_0x31f27e[_0x197e('0x17')](0x194);}return _0x5b8a5d;};}function handleError(_0x42198f,_0x1b5472){_0x1b5472=_0x1b5472||0x1f4;return function(_0x525822){logger[_0x197e('0x26')](_0x525822[_0x197e('0x27')]);if(_0x525822['name']){delete _0x525822[_0x197e('0x28')];}_0x42198f[_0x197e('0x19')](_0x1b5472)['send'](_0x525822);};}exports[_0x197e('0x29')]=function(_0x434aea,_0x3ab54e){var _0x50faf0={},_0x2df9b2={},_0x20d728={'count':0x0,'rows':[]};var _0x544339=_[_0x197e('0x2a')](db[_0x197e('0x2b')][_0x197e('0x2c')],function(_0x53634c){return{'name':_0x53634c[_0x197e('0x2d')],'type':_0x53634c['type'][_0x197e('0x2e')]};});_0x2df9b2[_0x197e('0x2f')]=_['map'](_0x544339,'name');_0x2df9b2['query']=_[_0x197e('0x30')](_0x434aea['query']);_0x2df9b2[_0x197e('0x31')]=_[_0x197e('0x32')](_0x2df9b2[_0x197e('0x2f')],_0x2df9b2[_0x197e('0x33')]);_0x50faf0[_0x197e('0x34')]=_[_0x197e('0x32')](_0x2df9b2[_0x197e('0x2f')],qs[_0x197e('0x35')](_0x434aea[_0x197e('0x33')][_0x197e('0x35')]));_0x50faf0[_0x197e('0x34')]=_0x50faf0[_0x197e('0x34')][_0x197e('0x36')]?_0x50faf0['attributes']:_0x2df9b2[_0x197e('0x2f')];if(!_0x434aea[_0x197e('0x33')][_0x197e('0x37')]('nolimit')){_0x50faf0[_0x197e('0x1d')]=qs[_0x197e('0x1d')](_0x434aea[_0x197e('0x33')][_0x197e('0x1d')]);_0x50faf0[_0x197e('0x1b')]=qs['offset'](_0x434aea[_0x197e('0x33')][_0x197e('0x1b')]);}_0x50faf0[_0x197e('0x38')]=qs[_0x197e('0x39')](_0x434aea[_0x197e('0x33')]['sort']);_0x50faf0[_0x197e('0x3a')]=qs[_0x197e('0x31')](_['pick'](_0x434aea[_0x197e('0x33')],_0x2df9b2['filters']),_0x544339);if(_0x434aea[_0x197e('0x33')]['filter']){_0x50faf0[_0x197e('0x3a')]=_[_0x197e('0x3b')](_0x50faf0[_0x197e('0x3a')],{'$or':_['map'](_0x544339,function(_0x42543e){if(_0x42543e[_0x197e('0x3c')]!=='VIRTUAL'){var _0x5d39af={};_0x5d39af[_0x42543e[_0x197e('0x28')]]={'$like':'%'+_0x434aea[_0x197e('0x33')]['filter']+'%'};return _0x5d39af;}})});}_0x50faf0=_[_0x197e('0x3b')]({},_0x50faf0,_0x434aea[_0x197e('0x3d')]);var _0xb2ef88={'where':_0x50faf0[_0x197e('0x3a')]};return db['SquareDetailsReport'][_0x197e('0x1e')](_0xb2ef88)['then'](function(_0x726a05){_0x20d728[_0x197e('0x1e')]=_0x726a05;if(_0x434aea[_0x197e('0x33')][_0x197e('0x3e')]){_0x50faf0[_0x197e('0x3f')]=[{'all':!![]}];}return db[_0x197e('0x2b')][_0x197e('0x40')](_0x50faf0);})[_0x197e('0x25')](function(_0x4bc525){_0x20d728[_0x197e('0x41')]=_0x4bc525;return _0x20d728;})[_0x197e('0x25')](respondWithFilteredResult(_0x3ab54e,_0x50faf0))[_0x197e('0x42')](handleError(_0x3ab54e,null));};exports[_0x197e('0x43')]=function(_0x2b42cc,_0x161e2e){var _0x4e57b1={'raw':!![],'where':{'id':_0x2b42cc[_0x197e('0x44')]['id']}},_0x419499={};_0x419499[_0x197e('0x2f')]=_[_0x197e('0x30')](db[_0x197e('0x2b')][_0x197e('0x2c')]);_0x419499['query']=_[_0x197e('0x30')](_0x2b42cc[_0x197e('0x33')]);_0x419499['filters']=_[_0x197e('0x32')](_0x419499['model'],_0x419499['query']);_0x4e57b1[_0x197e('0x34')]=_[_0x197e('0x32')](_0x419499[_0x197e('0x2f')],qs[_0x197e('0x35')](_0x2b42cc['query']['fields']));_0x4e57b1[_0x197e('0x34')]=_0x4e57b1['attributes'][_0x197e('0x36')]?_0x4e57b1[_0x197e('0x34')]:_0x419499[_0x197e('0x2f')];if(_0x2b42cc[_0x197e('0x33')][_0x197e('0x3e')]){_0x4e57b1[_0x197e('0x3f')]=[{'all':!![]}];}_0x4e57b1=_[_0x197e('0x3b')]({},_0x4e57b1,_0x2b42cc[_0x197e('0x3d')]);return db[_0x197e('0x2b')][_0x197e('0x45')](_0x4e57b1)[_0x197e('0x25')](handleEntityNotFound(_0x161e2e,null))[_0x197e('0x25')](respondWithResult(_0x161e2e,null))['catch'](handleError(_0x161e2e,null));};exports[_0x197e('0x46')]=function(_0x2d73fe,_0x16a33c){return db[_0x197e('0x2b')]['create'](_0x2d73fe[_0x197e('0x47')],{})['then'](respondWithResult(_0x16a33c,0xc9))[_0x197e('0x42')](handleError(_0x16a33c,null));};exports[_0x197e('0x23')]=function(_0x29ad84,_0x59dc82){if(_0x29ad84[_0x197e('0x47')]['id']){delete _0x29ad84[_0x197e('0x47')]['id'];}return db[_0x197e('0x2b')][_0x197e('0x45')]({'where':{'id':_0x29ad84[_0x197e('0x44')]['id']}})[_0x197e('0x25')](handleEntityNotFound(_0x59dc82,null))['then'](saveUpdates(_0x29ad84[_0x197e('0x47')],null))[_0x197e('0x25')](respondWithResult(_0x59dc82,null))[_0x197e('0x42')](handleError(_0x59dc82,null));};exports[_0x197e('0x24')]=function(_0x3d5395,_0x50d9c5){return db[_0x197e('0x2b')][_0x197e('0x45')]({'where':{'id':_0x3d5395[_0x197e('0x44')]['id']}})[_0x197e('0x25')](handleEntityNotFound(_0x50d9c5,null))['then'](removeEntity(_0x50d9c5,null))[_0x197e('0x42')](handleError(_0x50d9c5,null));};exports[_0x197e('0x48')]=function(_0x40fe62,_0x11f240){return db[_0x197e('0x2b')][_0x197e('0x48')]()[_0x197e('0x25')](respondWithResult(_0x11f240,null))[_0x197e('0x42')](handleError(_0x11f240,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e777380..4b55072 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 _0x78df=['SquareDetailsReport','report_square_details','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x78df,0x7a));var _0xf78d=function(_0x3c7982,_0x167662){_0x3c7982=_0x3c7982-0x0;var _0x28a051=_0x78df[_0x3c7982];return _0x28a051;};'use strict';var _=require('lodash');var util=require(_0xf78d('0x0'));var logger=require(_0xf78d('0x1'))('api');var moment=require(_0xf78d('0x2'));var BPromise=require(_0xf78d('0x3'));var rp=require(_0xf78d('0x4'));var fs=require('fs');var path=require(_0xf78d('0x5'));var rimraf=require(_0xf78d('0x6'));var config=require(_0xf78d('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xf78d('0x8')]=function(_0x144ac7,_0x3551cc){return _0x144ac7[_0xf78d('0x9')](_0xf78d('0xa'),attributes,{'tableName':_0xf78d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6754=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x509614,_0x2d42b4){var _0x42b2f6=function(_0x8c7e05){while(--_0x8c7e05){_0x509614['push'](_0x509614['shift']());}};_0x42b2f6(++_0x2d42b4);}(_0x6754,0x18a));var _0x4675=function(_0x575c75,_0x120aa9){_0x575c75=_0x575c75-0x0;var _0x436370=_0x6754[_0x575c75];return _0x436370;};'use strict';var _=require(_0x4675('0x0'));var util=require(_0x4675('0x1'));var logger=require(_0x4675('0x2'))(_0x4675('0x3'));var moment=require(_0x4675('0x4'));var BPromise=require(_0x4675('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4675('0x6'));var rimraf=require('rimraf');var config=require(_0x4675('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x3d95a1,_0x304989){return _0x3d95a1[_0x4675('0x8')](_0x4675('0x9'),attributes,{'tableName':_0x4675('0xa'),'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 82cf174..7542d07 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 _0x4fad=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fad,0xcb));var _0xd4fa=function(_0x2f817c,_0x233457){_0x2f817c=_0x2f817c-0x0;var _0x4a1785=_0x4fad[_0x2f817c];return _0x4a1785;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b426,_0x2b9f6a,_0x19a910){return new BPromise(function(_0x155c09,_0x3fff99){return client[_0xd4fa('0xc')](_0x52b426,_0x19a910)['then'](function(_0x26a894){logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,'request\x20sent');logger[_0xd4fa('0xf')](_0xd4fa('0x10'),_0x2b9f6a,_0xd4fa('0x11'),JSON[_0xd4fa('0x12')](_0x26a894));if(_0x26a894['error']){if(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x14')]===0x1f4){logger[_0xd4fa('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x2b9f6a,_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);return _0x3fff99(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}logger[_0xd4fa('0x13')](_0xd4fa('0xe'),_0x2b9f6a,_0x26a894['error'][_0xd4fa('0x15')]);return _0x155c09(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}else{logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,_0xd4fa('0x11'));_0x155c09(_0x26a894[_0xd4fa('0x16')]['message']);}})[_0xd4fa('0x17')](function(_0x3a3b8c){logger[_0xd4fa('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x2b9f6a,_0x3a3b8c);_0x3fff99(_0x3a3b8c);});});}exports['CreateSquareDetailsReport']=function(_0x1faa0b){var _0x5601d6=this;return new Promise(function(_0x5df190,_0x1f9be1){return db[_0xd4fa('0x18')][_0xd4fa('0x19')](_0x1faa0b[_0xd4fa('0x1a')],{'raw':_0x1faa0b['options']?_0x1faa0b[_0xd4fa('0x1b')][_0xd4fa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xbf7dcf){logger['info']('CreateSquareDetailsReport',_0x1faa0b);logger[_0xd4fa('0xf')](_0xd4fa('0x1d'),_0x1faa0b,JSON[_0xd4fa('0x12')](_0xbf7dcf));_0x5df190(_0xbf7dcf);})[_0xd4fa('0x17')](function(_0x586af0){logger[_0xd4fa('0x13')](_0xd4fa('0x1d'),_0x586af0[_0xd4fa('0x15')],_0x1faa0b);_0x1f9be1(_0x5601d6[_0xd4fa('0x13')](0x1f4,_0x586af0[_0xd4fa('0x15')]));});});}; \ No newline at end of file +var _0x6215=['rpc','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x431e77,_0x13ed74,_0x2b7275){return new BPromise(function(_0x253c0b,_0x19427d){return client['request'](_0x431e77,_0x2b7275)[_0x5621('0x9')](function(_0x39b1c0){logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');logger[_0x5621('0xc')](_0x5621('0xd'),_0x13ed74,_0x5621('0xe'),JSON['stringify'](_0x39b1c0));if(_0x39b1c0[_0x5621('0xf')]){if(_0x39b1c0[_0x5621('0xf')][_0x5621('0x10')]===0x1f4){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x19427d(_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);}logger[_0x5621('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x253c0b(_0x39b1c0[_0x5621('0xf')]['message']);}else{logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');_0x253c0b(_0x39b1c0[_0x5621('0x12')][_0x5621('0x11')]);}})[_0x5621('0x13')](function(_0x180926){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x180926);_0x19427d(_0x180926);});});}exports[_0x5621('0x14')]=function(_0x374f44){var _0x41941b=this;return new Promise(function(_0x2baba3,_0x4b55b0){return db[_0x5621('0x15')][_0x5621('0x16')](_0x374f44['body'],{'raw':_0x374f44[_0x5621('0x17')]?_0x374f44['options'][_0x5621('0x18')]===undefined?!![]:![]:!![]})[_0x5621('0x9')](function(_0x179830){logger[_0x5621('0xa')](_0x5621('0x14'),_0x374f44);logger['debug'](_0x5621('0x14'),_0x374f44,JSON[_0x5621('0x19')](_0x179830));_0x2baba3(_0x179830);})[_0x5621('0x13')](function(_0x3eaa1a){logger['error'](_0x5621('0x14'),_0x3eaa1a[_0x5621('0x11')],_0x374f44);_0x4b55b0(_0x41941b[_0x5621('0xf')](0x1f4,_0x3eaa1a[_0x5621('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8a025cb..dc4d324 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 _0x827e=['../../components/auth/service','./system.controller','get','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router'];(function(_0xf09da0,_0x3b72a3){var _0x98aa35=function(_0x28f127){while(--_0x28f127){_0xf09da0['push'](_0xf09da0['shift']());}};_0x98aa35(++_0x3b72a3);}(_0x827e,0x11e));var _0xe827=function(_0x52364d,_0x24c74f){_0x52364d=_0x52364d-0x0;var _0x11a079=_0x827e[_0x52364d];return _0x11a079;};'use strict';var express=require(_0xe827('0x0'));var router=express[_0xe827('0x1')]();var auth=require(_0xe827('0x2'));var controller=require(_0xe827('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe827('0x4')](_0xe827('0x5'),auth[_0xe827('0x6')](),controller[_0xe827('0x7')]);module[_0xe827('0x8')]=router; \ No newline at end of file +var _0x5f2b=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5f2b,0xb1));var _0xb5f2=function(_0x12ea78,_0xdfff14){_0x12ea78=_0x12ea78-0x0;var _0x5b6500=_0x5f2b[_0x12ea78];return _0x5b6500;};'use strict';var express=require(_0xb5f2('0x0'));var router=express[_0xb5f2('0x1')]();var auth=require(_0xb5f2('0x2'));var controller=require(_0xb5f2('0x3'));router[_0xb5f2('0x4')]('/',auth['isAuthenticated'](),controller[_0xb5f2('0x5')]);router['get'](_0xb5f2('0x6'),auth[_0xb5f2('0x7')](),controller[_0xb5f2('0x8')]);module[_0xb5f2('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8425402..0d78b91 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 _0xd320=['send','index','catch','json','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xd320,0xbf));var _0x0d32=function(_0x152b25,_0x5da2a5){_0x152b25=_0x152b25-0x0;var _0x41b54a=_0xd320[_0x152b25];return _0x41b54a;};'use strict';var info=require(_0x0d32('0x0'));var exec=require(_0x0d32('0x1'))[_0x0d32('0x2')];var logger=require(_0x0d32('0x3'))(_0x0d32('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x0d32('0x5'));function handleError(_0xabfd7e,_0x4ad863,_0x16400b){_0x4ad863=_0x4ad863||0x1f4;return function(_0x67c1c3){logger['error'](_0x0d32('0x6'),_0x16400b,_0x4ad863,util['inspect'](_0x67c1c3,{'showHidden':![],'depth':null}));delete _0x67c1c3[_0x0d32('0x7')];_0xabfd7e[_0x0d32('0x8')](_0x4ad863)[_0x0d32('0x9')](_0x67c1c3);};}exports[_0x0d32('0xa')]=function(_0x2d91f8,_0x1f04b2){return info['getAllData']()['then'](function(_0x52961c){return _0x1f04b2['status'](0xc8)['json'](_0x52961c);})[_0x0d32('0xb')](function(_0x12f69c){return _0x1f04b2[_0x0d32('0x8')](0x1f4)[_0x0d32('0xc')](_0x12f69c);});};exports['killProcess']=function(_0x82aad6,_0x18817b){var _0x105c8c=[_0x0d32('0xd')];return new BPromise(function(_0x2a6bf9,_0x1b876e){return exec(util['format'](_0x0d32('0xe'),_0x82aad6[_0x0d32('0xf')][_0x0d32('0x10')]),function(_0x408df2,_0x3bb3e2,_0x5a3280){if(_0x408df2){return _0x1b876e(_0x408df2);}return _0x2a6bf9(_0x3bb3e2);});})['then'](function(_0xa81d34){var _0x4f03ab=![];var _0x10b663=_0xa81d34[_0x0d32('0x11')](/\n/);for(var _0x52aefe=0x0,_0x41da4a=_0x105c8c[_0x0d32('0x12')];_0x52aefe<_0x41da4a,_0x4f03ab===![];_0x52aefe+=0x1){if(_0xa81d34['indexOf'](_0x105c8c[_0x52aefe])>=0x0){_0x4f03ab=!![];}}if(!_0x4f03ab){throw new Error(util[_0x0d32('0x13')](_0x0d32('0x14'),_0x82aad6[_0x0d32('0xf')][_0x0d32('0x10')]));}process[_0x0d32('0x15')](_0x82aad6[_0x0d32('0xf')][_0x0d32('0x10')],_0x0d32('0x16'));return _0x18817b[_0x0d32('0x8')](0xc8)['json']({'message':util[_0x0d32('0x13')](_0x0d32('0x17'),_0x82aad6[_0x0d32('0xf')]['pid'])});})[_0x0d32('0xb')](handleError(_0x18817b,null,_0x0d32('0x18')));}; \ No newline at end of file +var _0xa2ab=['send','getAllData','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x364cf8,_0x146b9b){var _0x6a59ee=function(_0x3d81eb){while(--_0x3d81eb){_0x364cf8['push'](_0x364cf8['shift']());}};_0x6a59ee(++_0x146b9b);}(_0xa2ab,0x74));var _0xba2a=function(_0x1faa61,_0x1bd7e2){_0x1faa61=_0x1faa61-0x0;var _0x3f0e58=_0xa2ab[_0x1faa61];return _0x3f0e58;};'use strict';var info=require('systeminformation');var exec=require(_0xba2a('0x0'))['exec'];var logger=require(_0xba2a('0x1'))('api');var util=require(_0xba2a('0x2'));var BPromise=require('bluebird');var _=require(_0xba2a('0x3'));function handleError(_0x3f6b09,_0xa659c8,_0xe9bfcb){_0xa659c8=_0xa659c8||0x1f4;return function(_0x4d1366){logger[_0xba2a('0x4')](_0xba2a('0x5'),_0xe9bfcb,_0xa659c8,util[_0xba2a('0x6')](_0x4d1366,{'showHidden':![],'depth':null}));delete _0x4d1366[_0xba2a('0x7')];_0x3f6b09[_0xba2a('0x8')](_0xa659c8)[_0xba2a('0x9')](_0x4d1366);};}exports['index']=function(_0x276039,_0x4c0607){return info[_0xba2a('0xa')]()[_0xba2a('0xb')](function(_0x42928b){return _0x4c0607[_0xba2a('0x8')](0xc8)[_0xba2a('0xc')](_0x42928b);})[_0xba2a('0xd')](function(_0x360d7b){return _0x4c0607['status'](0x1f4)['json'](_0x360d7b);});};exports[_0xba2a('0xe')]=function(_0x4e9cb2,_0x4fa111){var _0x4f13f1=['components/import/cm'];return new BPromise(function(_0x1473cc,_0x5ed5db){return exec(util[_0xba2a('0xf')](_0xba2a('0x10'),_0x4e9cb2[_0xba2a('0x11')][_0xba2a('0x12')]),function(_0x116152,_0x1a176b,_0x5e815c){if(_0x116152){return _0x5ed5db(_0x116152);}return _0x1473cc(_0x1a176b);});})[_0xba2a('0xb')](function(_0x34603d){var _0x194a44=![];var _0x4d2c1b=_0x34603d[_0xba2a('0x13')](/\n/);for(var _0x4a84ca=0x0,_0x2e62d0=_0x4f13f1[_0xba2a('0x14')];_0x4a84ca<_0x2e62d0,_0x194a44===![];_0x4a84ca+=0x1){if(_0x34603d['indexOf'](_0x4f13f1[_0x4a84ca])>=0x0){_0x194a44=!![];}}if(!_0x194a44){throw new Error(util[_0xba2a('0xf')](_0xba2a('0x15'),_0x4e9cb2[_0xba2a('0x11')]['pid']));}process[_0xba2a('0x16')](_0x4e9cb2[_0xba2a('0x11')][_0xba2a('0x12')],_0xba2a('0x17'));return _0x4fa111['status'](0xc8)[_0xba2a('0xc')]({'message':util[_0xba2a('0xf')](_0xba2a('0x18'),_0x4e9cb2['params'][_0xba2a('0x12')])});})[_0xba2a('0xd')](handleError(_0x4fa111,null,_0xba2a('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2f5ccea..ab83b04 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 _0x89b3=['/:id','create','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0xde47db,_0x68fdde){var _0x83bcb9=function(_0x1af2a6){while(--_0x1af2a6){_0xde47db['push'](_0xde47db['shift']());}};_0x83bcb9(++_0x68fdde);}(_0x89b3,0x12a));var _0x389b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89b3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x389b('0x0'));var util=require(_0x389b('0x1'));var path=require(_0x389b('0x2'));var timeout=require(_0x389b('0x3'));var express=require('express');var router=express[_0x389b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x389b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x389b('0x6'));var controller=require('./tag.controller');router['get']('/',auth[_0x389b('0x7')](),controller[_0x389b('0x8')]);router[_0x389b('0x9')](_0x389b('0xa'),auth[_0x389b('0x7')](),controller['show']);router['post']('/',auth[_0x389b('0x7')](),controller[_0x389b('0xb')]);router['put'](_0x389b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x389b('0xc')](_0x389b('0xa'),auth[_0x389b('0x7')](),controller['destroy']);module[_0x389b('0xd')]=router; \ No newline at end of file +var _0xbb51=['Router','../../components/auth/service','../../config/environment','get','index','show','post','isAuthenticated','create','put','/:id','delete','destroy','multer','util','path','express'];(function(_0x51b1a5,_0x46aa79){var _0x201db4=function(_0x3665a1){while(--_0x3665a1){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x201db4(++_0x46aa79);}(_0xbb51,0x13f));var _0x1bb5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbb51[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x1bb5('0x0'));var util=require(_0x1bb5('0x1'));var path=require(_0x1bb5('0x2'));var timeout=require('connect-timeout');var express=require(_0x1bb5('0x3'));var router=express[_0x1bb5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bb5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1bb5('0x6'));var controller=require('./tag.controller');router[_0x1bb5('0x7')]('/',auth['isAuthenticated'](),controller[_0x1bb5('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1bb5('0x9')]);router[_0x1bb5('0xa')]('/',auth[_0x1bb5('0xb')](),controller[_0x1bb5('0xc')]);router[_0x1bb5('0xd')](_0x1bb5('0xe'),auth[_0x1bb5('0xb')](),controller['update']);router[_0x1bb5('0xf')](_0x1bb5('0xe'),auth[_0x1bb5('0xb')](),controller[_0x1bb5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c464bdd..de87534 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 _0xb574=['name','STRING','sequelize','exports'];(function(_0x5b8155,_0x51c636){var _0x1d6f07=function(_0x206950){while(--_0x206950){_0x5b8155['push'](_0x5b8155['shift']());}};_0x1d6f07(++_0x51c636);}(_0xb574,0x106));var _0x4b57=function(_0x192d9b,_0x308280){_0x192d9b=_0x192d9b-0x0;var _0xfb3347=_0xb574[_0x192d9b];return _0xfb3347;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4b57('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4b57('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4b57('0x3')]}}; \ No newline at end of file +var _0x4ca7=['exports','STRING','#0091EA','sequelize'];(function(_0x586e9b,_0x2e1eb3){var _0x34758a=function(_0x381a09){while(--_0x381a09){_0x586e9b['push'](_0x586e9b['shift']());}};_0x34758a(++_0x2e1eb3);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x470ec5,_0x2e4369){_0x470ec5=_0x470ec5-0x0;var _0x17fc1e=_0x4ca7[_0x470ec5];return _0x17fc1e;};'use strict';var Sequelize=require(_0x74ca('0x0'));module[_0x74ca('0x1')]={'name':{'type':Sequelize[_0x74ca('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x74ca('0x2')],'defaultValue':_0x74ca('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7024149..c56e8bf 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 _0x5c12=['reject','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','type','options','includeAll','include','Tag','rows','show','fields','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','undefined','count','set','Content-Range','apply'];(function(_0x2d099b,_0x435a6f){var _0x415093=function(_0x45c940){while(--_0x45c940){_0x2d099b['push'](_0x2d099b['shift']());}};_0x415093(++_0x435a6f);}(_0x5c12,0x188));var _0x25c1=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x5c12[_0x4991d6];return _0x50faf7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){var _0x2f78dd=_0x324ea9[_0x25c1('0x25')]({'plain':!![]});var _0x399d72='Tags';return db[_0x25c1('0x26')][_0x25c1('0x24')]({'where':{'type':_0x399d72,'resourceId':_0x2f78dd['id']}})[_0x25c1('0x23')](function(){return _0x324ea9;});})[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x27')]();});}};}function handleEntityNotFound(_0x5ad776,_0x17c924){return function(_0x428ce8){if(!_0x428ce8){_0x5ad776[_0x25c1('0x28')](0x194);}return _0x428ce8;};}function handleError(_0x38c1d5,_0x11c0ae){_0x11c0ae=_0x11c0ae||0x1f4;return function(_0x193a68){logger['error'](_0x193a68[_0x25c1('0x29')]);if(_0x193a68['name']){delete _0x193a68[_0x25c1('0x2a')];}_0x38c1d5[_0x25c1('0x19')](_0x11c0ae)[_0x25c1('0x2b')](_0x193a68);};}exports[_0x25c1('0x2c')]=function(_0x2e80b5,_0x21069c){var _0x1fd4e3={},_0x23f2f6={},_0x402f32={'count':0x0,'rows':[]};var _0x4d9882=_[_0x25c1('0x2d')](db['Tag']['rawAttributes'],function(_0x3db0ee){return{'name':_0x3db0ee[_0x25c1('0x2e')],'type':_0x3db0ee['type'][_0x25c1('0x2f')]};});_0x23f2f6['model']=_[_0x25c1('0x2d')](_0x4d9882,'name');_0x23f2f6[_0x25c1('0x30')]=_[_0x25c1('0x31')](_0x2e80b5[_0x25c1('0x30')]);_0x23f2f6[_0x25c1('0x32')]=_[_0x25c1('0x33')](_0x23f2f6[_0x25c1('0x34')],_0x23f2f6[_0x25c1('0x30')]);_0x1fd4e3[_0x25c1('0x35')]=_['intersection'](_0x23f2f6[_0x25c1('0x34')],qs['fields'](_0x2e80b5[_0x25c1('0x30')]['fields']));_0x1fd4e3[_0x25c1('0x35')]=_0x1fd4e3[_0x25c1('0x35')][_0x25c1('0x36')]?_0x1fd4e3[_0x25c1('0x35')]:_0x23f2f6[_0x25c1('0x34')];if(!_0x2e80b5[_0x25c1('0x30')][_0x25c1('0x37')](_0x25c1('0x38'))){_0x1fd4e3[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x2e80b5[_0x25c1('0x30')][_0x25c1('0x1b')]);_0x1fd4e3[_0x25c1('0x39')]=qs[_0x25c1('0x39')](_0x2e80b5[_0x25c1('0x30')][_0x25c1('0x39')]);}_0x1fd4e3[_0x25c1('0x3a')]=qs[_0x25c1('0x3b')](_0x2e80b5[_0x25c1('0x30')][_0x25c1('0x3b')]);_0x1fd4e3['where']=qs[_0x25c1('0x32')](_[_0x25c1('0x3c')](_0x2e80b5['query'],_0x23f2f6[_0x25c1('0x32')]),_0x4d9882);if(_0x2e80b5['query'][_0x25c1('0x3d')]){_0x1fd4e3['where']=_[_0x25c1('0x3e')](_0x1fd4e3[_0x25c1('0x3f')],{'$or':_[_0x25c1('0x2d')](_0x4d9882,function(_0x3d6135){if(_0x3d6135[_0x25c1('0x40')]!=='VIRTUAL'){var _0x1fe6d7={};_0x1fe6d7[_0x3d6135['name']]={'$like':'%'+_0x2e80b5[_0x25c1('0x30')][_0x25c1('0x3d')]+'%'};return _0x1fe6d7;}})});}_0x1fd4e3=_[_0x25c1('0x3e')]({},_0x1fd4e3,_0x2e80b5[_0x25c1('0x41')]);var _0x57c65a={'where':_0x1fd4e3['where']};return db['Tag'][_0x25c1('0x1d')](_0x57c65a)[_0x25c1('0x23')](function(_0x530967){_0x402f32[_0x25c1('0x1d')]=_0x530967;if(_0x2e80b5['query'][_0x25c1('0x42')]){_0x1fd4e3[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x44')]['findAll'](_0x1fd4e3);})['then'](function(_0x53f87b){_0x402f32[_0x25c1('0x45')]=_0x53f87b;return _0x402f32;})[_0x25c1('0x23')](respondWithFilteredResult(_0x21069c,_0x1fd4e3))['catch'](handleError(_0x21069c,null));};exports[_0x25c1('0x46')]=function(_0x4c90f6,_0x46cbb9){var _0x5d8562={'raw':!![],'where':{'id':_0x4c90f6['params']['id']}},_0x5e43dc={};_0x5e43dc['model']=_[_0x25c1('0x31')](db[_0x25c1('0x44')]['rawAttributes']);_0x5e43dc[_0x25c1('0x30')]=_[_0x25c1('0x31')](_0x4c90f6[_0x25c1('0x30')]);_0x5e43dc[_0x25c1('0x32')]=_[_0x25c1('0x33')](_0x5e43dc[_0x25c1('0x34')],_0x5e43dc[_0x25c1('0x30')]);_0x5d8562['attributes']=_['intersection'](_0x5e43dc[_0x25c1('0x34')],qs[_0x25c1('0x47')](_0x4c90f6[_0x25c1('0x30')]['fields']));_0x5d8562[_0x25c1('0x35')]=_0x5d8562[_0x25c1('0x35')][_0x25c1('0x36')]?_0x5d8562[_0x25c1('0x35')]:_0x5e43dc['model'];if(_0x4c90f6[_0x25c1('0x30')][_0x25c1('0x42')]){_0x5d8562[_0x25c1('0x43')]=[{'all':!![]}];}_0x5d8562=_[_0x25c1('0x3e')]({},_0x5d8562,_0x4c90f6['options']);return db['Tag'][_0x25c1('0x48')](_0x5d8562)[_0x25c1('0x23')](handleEntityNotFound(_0x46cbb9,null))[_0x25c1('0x23')](respondWithResult(_0x46cbb9,null))[_0x25c1('0x49')](handleError(_0x46cbb9,null));};exports['create']=function(_0x6eff9e,_0x32943c){return db['Tag'][_0x25c1('0x4a')](_0x6eff9e[_0x25c1('0x4b')],{})[_0x25c1('0x23')](function(_0x31c504){var _0x502018=_0x6eff9e['user'][_0x25c1('0x25')]({'plain':!![]});if(!_0x502018)throw new Error(_0x25c1('0x4c'));if(_0x502018[_0x25c1('0x4d')]==='user'){var _0x19028a=_0x31c504[_0x25c1('0x25')]({'plain':!![]});var _0x483721=_0x25c1('0x4e');return db[_0x25c1('0x4f')][_0x25c1('0x48')]({'where':{'name':_0x483721,'userProfileId':_0x502018[_0x25c1('0x50')]},'raw':!![]})[_0x25c1('0x23')](function(_0x355ecc){if(_0x355ecc&&_0x355ecc[_0x25c1('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x19028a['name'],'resourceId':_0x19028a['id'],'type':_0x355ecc[_0x25c1('0x2a')],'sectionId':_0x355ecc['id']},{})['then'](function(){return _0x31c504;});}else{return _0x31c504;}})[_0x25c1('0x49')](function(_0x2c67a8){logger[_0x25c1('0x52')](_0x25c1('0x53'),_0x2c67a8);throw _0x2c67a8;});}return _0x31c504;})[_0x25c1('0x23')](respondWithResult(_0x32943c,0xc9))[_0x25c1('0x49')](handleError(_0x32943c,null));};exports['update']=function(_0x4a876b,_0x68e295){if(_0x4a876b[_0x25c1('0x4b')]['id']){delete _0x4a876b[_0x25c1('0x4b')]['id'];}return db[_0x25c1('0x44')][_0x25c1('0x48')]({'where':{'id':_0x4a876b['params']['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x68e295,null))[_0x25c1('0x23')](saveUpdates(_0x4a876b[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x68e295,null))[_0x25c1('0x49')](handleError(_0x68e295,null));};exports['destroy']=function(_0xc1ac24,_0x3df219){return db['Tag'][_0x25c1('0x48')]({'where':{'id':_0xc1ac24[_0x25c1('0x54')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x3df219,null))[_0x25c1('0x23')](removeEntity(_0x3df219,null))[_0x25c1('0x49')](handleError(_0x3df219,null));}; \ No newline at end of file +var _0x34e8=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','Tag','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Tags','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x34e8,0x12c));var _0x834e=function(_0x23f4f0,_0x341ab6){_0x23f4f0=_0x23f4f0-0x0;var _0x57b680=_0x34e8[_0x23f4f0];return _0x57b680;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){var _0x338636=_0x58f4fd['get']({'plain':!![]});var _0x24fcf7=_0x834e('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x24fcf7,'resourceId':_0x338636['id']}})[_0x834e('0x2a')](function(){return _0x58f4fd;});})['then'](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3db026,_0x2cc2eb){return function(_0x3cd928){if(!_0x3cd928){_0x3db026[_0x834e('0x1c')](0x194);}return _0x3cd928;};}function handleError(_0x491919,_0x510780){_0x510780=_0x510780||0x1f4;return function(_0x4dc64a){logger['error'](_0x4dc64a[_0x834e('0x2d')]);if(_0x4dc64a[_0x834e('0x2e')]){delete _0x4dc64a[_0x834e('0x2e')];}_0x491919['status'](_0x510780)[_0x834e('0x2f')](_0x4dc64a);};}exports[_0x834e('0x30')]=function(_0x1f3671,_0x1e026a){var _0x4551f5={},_0x390119={},_0x3d149d={'count':0x0,'rows':[]};var _0xfaf716=_[_0x834e('0x31')](db['Tag'][_0x834e('0x32')],function(_0x5cad11){return{'name':_0x5cad11[_0x834e('0x33')],'type':_0x5cad11[_0x834e('0x34')][_0x834e('0x35')]};});_0x390119[_0x834e('0x36')]=_[_0x834e('0x31')](_0xfaf716,_0x834e('0x2e'));_0x390119[_0x834e('0x37')]=_[_0x834e('0x38')](_0x1f3671[_0x834e('0x37')]);_0x390119[_0x834e('0x39')]=_['intersection'](_0x390119[_0x834e('0x36')],_0x390119[_0x834e('0x37')]);_0x4551f5[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x390119['model'],qs[_0x834e('0x3c')](_0x1f3671[_0x834e('0x37')]['fields']));_0x4551f5['attributes']=_0x4551f5['attributes'][_0x834e('0x3d')]?_0x4551f5[_0x834e('0x3a')]:_0x390119[_0x834e('0x36')];if(!_0x1f3671[_0x834e('0x37')][_0x834e('0x3e')](_0x834e('0x3f'))){_0x4551f5['limit']=qs[_0x834e('0x20')](_0x1f3671['query'][_0x834e('0x20')]);_0x4551f5[_0x834e('0x22')]=qs['offset'](_0x1f3671[_0x834e('0x37')][_0x834e('0x22')]);}_0x4551f5['order']=qs['sort'](_0x1f3671[_0x834e('0x37')][_0x834e('0x40')]);_0x4551f5[_0x834e('0x41')]=qs[_0x834e('0x39')](_[_0x834e('0x42')](_0x1f3671['query'],_0x390119[_0x834e('0x39')]),_0xfaf716);if(_0x1f3671['query']['filter']){_0x4551f5[_0x834e('0x41')]=_['merge'](_0x4551f5[_0x834e('0x41')],{'$or':_[_0x834e('0x31')](_0xfaf716,function(_0x16aea6){if(_0x16aea6[_0x834e('0x34')]!==_0x834e('0x43')){var _0x574ea8={};_0x574ea8[_0x16aea6[_0x834e('0x2e')]]={'$like':'%'+_0x1f3671[_0x834e('0x37')][_0x834e('0x44')]+'%'};return _0x574ea8;}})});}_0x4551f5=_['merge']({},_0x4551f5,_0x1f3671[_0x834e('0x45')]);var _0x16ac45={'where':_0x4551f5['where']};return db[_0x834e('0x46')]['count'](_0x16ac45)[_0x834e('0x2a')](function(_0x585335){_0x3d149d['count']=_0x585335;if(_0x1f3671['query'][_0x834e('0x47')]){_0x4551f5[_0x834e('0x48')]=[{'all':!![]}];}return db[_0x834e('0x46')][_0x834e('0x49')](_0x4551f5);})[_0x834e('0x2a')](function(_0x23feea){_0x3d149d[_0x834e('0x4a')]=_0x23feea;return _0x3d149d;})['then'](respondWithFilteredResult(_0x1e026a,_0x4551f5))[_0x834e('0x4b')](handleError(_0x1e026a,null));};exports['show']=function(_0x321efa,_0x540685){var _0x1df5b0={'raw':!![],'where':{'id':_0x321efa[_0x834e('0x4c')]['id']}},_0x5a5807={};_0x5a5807[_0x834e('0x36')]=_['keys'](db[_0x834e('0x46')][_0x834e('0x32')]);_0x5a5807[_0x834e('0x37')]=_[_0x834e('0x38')](_0x321efa[_0x834e('0x37')]);_0x5a5807[_0x834e('0x39')]=_[_0x834e('0x3b')](_0x5a5807[_0x834e('0x36')],_0x5a5807[_0x834e('0x37')]);_0x1df5b0[_0x834e('0x3a')]=_['intersection'](_0x5a5807[_0x834e('0x36')],qs[_0x834e('0x3c')](_0x321efa['query'][_0x834e('0x3c')]));_0x1df5b0[_0x834e('0x3a')]=_0x1df5b0[_0x834e('0x3a')][_0x834e('0x3d')]?_0x1df5b0[_0x834e('0x3a')]:_0x5a5807[_0x834e('0x36')];if(_0x321efa['query']['includeAll']){_0x1df5b0[_0x834e('0x48')]=[{'all':!![]}];}_0x1df5b0=_[_0x834e('0x4d')]({},_0x1df5b0,_0x321efa[_0x834e('0x45')]);return db[_0x834e('0x46')][_0x834e('0x4e')](_0x1df5b0)[_0x834e('0x2a')](handleEntityNotFound(_0x540685,null))[_0x834e('0x2a')](respondWithResult(_0x540685,null))[_0x834e('0x4b')](handleError(_0x540685,null));};exports[_0x834e('0x4f')]=function(_0x390c45,_0xf02f0d){return db[_0x834e('0x46')][_0x834e('0x4f')](_0x390c45[_0x834e('0x50')],{})[_0x834e('0x2a')](function(_0x1a3855){var _0x3df078=_0x390c45[_0x834e('0x51')][_0x834e('0x52')]({'plain':!![]});if(!_0x3df078)throw new Error(_0x834e('0x53'));if(_0x3df078['role']===_0x834e('0x51')){var _0x1f08b9=_0x1a3855['get']({'plain':!![]});var _0x3c00a3=_0x834e('0x2c');return db['UserProfileSection'][_0x834e('0x4e')]({'where':{'name':_0x3c00a3,'userProfileId':_0x3df078[_0x834e('0x54')]},'raw':!![]})[_0x834e('0x2a')](function(_0x35636e){if(_0x35636e&&_0x35636e[_0x834e('0x55')]===0x0){return db[_0x834e('0x56')][_0x834e('0x4f')]({'name':_0x1f08b9['name'],'resourceId':_0x1f08b9['id'],'type':_0x35636e[_0x834e('0x2e')],'sectionId':_0x35636e['id']},{})[_0x834e('0x2a')](function(){return _0x1a3855;});}else{return _0x1a3855;}})[_0x834e('0x4b')](function(_0x363675){logger[_0x834e('0x57')](_0x834e('0x58'),_0x363675);throw _0x363675;});}return _0x1a3855;})[_0x834e('0x2a')](respondWithResult(_0xf02f0d,0xc9))[_0x834e('0x4b')](handleError(_0xf02f0d,null));};exports['update']=function(_0x11778e,_0x4dc104){if(_0x11778e[_0x834e('0x50')]['id']){delete _0x11778e['body']['id'];}return db[_0x834e('0x46')]['find']({'where':{'id':_0x11778e['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4dc104,null))[_0x834e('0x2a')](saveUpdates(_0x11778e['body'],null))['then'](respondWithResult(_0x4dc104,null))[_0x834e('0x4b')](handleError(_0x4dc104,null));};exports[_0x834e('0x2b')]=function(_0x138ed2,_0x387365){return db[_0x834e('0x46')][_0x834e('0x4e')]({'where':{'id':_0x138ed2[_0x834e('0x4c')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x387365,null))['then'](removeEntity(_0x387365,null))[_0x834e('0x4b')](handleError(_0x387365,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b62ec7e..facecc5 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 _0xb171=['api','bluebird','../../config/environment','exports','define','Tag','tools_tags','lodash','util'];(function(_0x411bcf,_0x5bb887){var _0x1b4aca=function(_0x2c2253){while(--_0x2c2253){_0x411bcf['push'](_0x411bcf['shift']());}};_0x1b4aca(++_0x5bb887);}(_0xb171,0x103));var _0x1b17=function(_0x325826,_0x2e5740){_0x325826=_0x325826-0x0;var _0x20b72f=_0xb171[_0x325826];return _0x20b72f;};'use strict';var _=require(_0x1b17('0x0'));var util=require(_0x1b17('0x1'));var logger=require('../../config/logger')(_0x1b17('0x2'));var moment=require('moment');var BPromise=require(_0x1b17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b17('0x4'));var attributes=require('./tag.attributes');module[_0x1b17('0x5')]=function(_0x39bdaa,_0x5072b4){return _0x39bdaa[_0x1b17('0x6')](_0x1b17('0x7'),attributes,{'tableName':_0x1b17('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a12=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags'];(function(_0x128f18,_0xd7ba38){var _0x28d6fb=function(_0x155986){while(--_0x155986){_0x128f18['push'](_0x128f18['shift']());}};_0x28d6fb(++_0xd7ba38);}(_0x3a12,0x1ce));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var logger=require(_0x23a1('0x2'))('api');var moment=require(_0x23a1('0x3'));var BPromise=require(_0x23a1('0x4'));var rp=require(_0x23a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23a1('0x6'));var config=require(_0x23a1('0x7'));var attributes=require(_0x23a1('0x8'));module['exports']=function(_0x29775a,_0x3f41d6){return _0x29775a['define'](_0x23a1('0x9'),attributes,{'tableName':_0x23a1('0xa'),'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 d5845ed..8ddad3f 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 _0x303a=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x303a,0x1a0));var _0xa303=function(_0x722360,_0x217e4f){_0x722360=_0x722360-0x0;var _0x39590f=_0x303a[_0x722360];return _0x39590f;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('Tag,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('Tag,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('Tag,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file +var _0x4944=['code','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x7bea18,_0x8d243a){var _0x18dd83=function(_0x35f32c){while(--_0x35f32c){_0x7bea18['push'](_0x7bea18['shift']());}};_0x18dd83(++_0x8d243a);}(_0x4944,0x6d));var _0x4494=function(_0x34eed1,_0x494693){_0x34eed1=_0x34eed1-0x0;var _0x30c966=_0x4944[_0x34eed1];return _0x30c966;};'use strict';var _=require(_0x4494('0x0'));var util=require('util');var moment=require(_0x4494('0x1'));var BPromise=require(_0x4494('0x2'));var rs=require(_0x4494('0x3'));var fs=require('fs');var Redis=require(_0x4494('0x4'));var db=require(_0x4494('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4494('0x6'))('rpc');var config=require(_0x4494('0x7'));var jayson=require(_0x4494('0x8'));var client=jayson[_0x4494('0x9')][_0x4494('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a4911,_0x1a94d6,_0x55bb81){return new BPromise(function(_0x12ef8e,_0x21098c){return client['request'](_0x2a4911,_0x55bb81)[_0x4494('0xb')](function(_0xec1762){logger[_0x4494('0xc')](_0x4494('0xd'),_0x1a94d6,'request\x20sent');logger['debug'](_0x4494('0xe'),_0x1a94d6,_0x4494('0xf'),JSON[_0x4494('0x10')](_0xec1762));if(_0xec1762['error']){if(_0xec1762['error'][_0x4494('0x11')]===0x1f4){logger[_0x4494('0x12')](_0x4494('0xd'),_0x1a94d6,_0xec1762[_0x4494('0x12')][_0x4494('0x13')]);return _0x21098c(_0xec1762[_0x4494('0x12')]['message']);}logger[_0x4494('0x12')](_0x4494('0xd'),_0x1a94d6,_0xec1762[_0x4494('0x12')][_0x4494('0x13')]);return _0x12ef8e(_0xec1762[_0x4494('0x12')][_0x4494('0x13')]);}else{logger[_0x4494('0xc')]('Tag,\x20%s,\x20%s',_0x1a94d6,_0x4494('0xf'));_0x12ef8e(_0xec1762['result']['message']);}})[_0x4494('0x14')](function(_0x267d0b){logger['error']('Tag,\x20%s,\x20%s',_0x1a94d6,_0x267d0b);_0x21098c(_0x267d0b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 2846552..770b57b 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 aec4a7c..7d89b40 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(_0x2bb3aa,_0x2e5bf9){var _0xa79db9=function(_0x2fb650){while(--_0x2fb650){_0x2bb3aa['push'](_0x2bb3aa['shift']());}};_0xa79db9(++_0x2e5bf9);}(_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 _0x0713=['STRING','name'];(function(_0x2b3273,_0x175b98){var _0x26a964=function(_0x45e346){while(--_0x45e346){_0x2b3273['push'](_0x2b3273['shift']());}};_0x26a964(++_0x175b98);}(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2b3c513..cca3bca 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 _0x2e0f=['role','get','Teams','UserProfileSection','userProfileId','body','transaction','sequelize','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','destroy','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','Unknown\x20channel','capitalize','channel','Queue','pick','toLowerCase','Queues','addQueues','isValidChannel','ValidationError','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','defaults','User','findOrCreate','emit','QueueId','online','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','TeamVoiceQueue','all','addAgents','removeAgents','Openchannel','Queue:remove','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','name','status','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Team','includeAll','findAll','catch','show','params','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x2e0f,0xe9));var _0xf2e0=function(_0x9bda38,_0x263439){_0x9bda38=_0x9bda38-0x0;var _0x3e87e9=_0x2e0f[_0x9bda38];return _0x3e87e9;};'use strict';var emlformat=require(_0xf2e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2e0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2e0('0x2'));var moment=require(_0xf2e0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf2e0('0x4'));var util=require(_0xf2e0('0x5'));var path=require(_0xf2e0('0x6'));var sox=require(_0xf2e0('0x7'));var csv=require(_0xf2e0('0x8'));var ejs=require(_0xf2e0('0x9'));var fs=require('fs');var fs_extra=require(_0xf2e0('0xa'));var _=require(_0xf2e0('0xb'));var squel=require(_0xf2e0('0xc'));var crypto=require(_0xf2e0('0xd'));var jsforce=require(_0xf2e0('0xe'));var deskjs=require(_0xf2e0('0xf'));var toCsv=require(_0xf2e0('0x8'));var querystring=require(_0xf2e0('0x10'));var Papa=require(_0xf2e0('0x11'));var Redis=require(_0xf2e0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf2e0('0x13'));var hardwareService=require(_0xf2e0('0x14'));var logger=require(_0xf2e0('0x15'))('api');var utils=require(_0xf2e0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf2e0('0x17'));var db=require('../../mysqldb')['db'];config[_0xf2e0('0x18')]=_['defaults'](config[_0xf2e0('0x18')],{'host':_0xf2e0('0x19'),'port':0x18eb});var socket=require(_0xf2e0('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0xf2e0('0x1b')](socket);function respondWithStatusCode(_0x329050,_0x3ca1ba){_0x3ca1ba=_0x3ca1ba||0xcc;return function(_0x2fa0f0){if(_0x2fa0f0){return _0x329050[_0xf2e0('0x1c')](_0x3ca1ba);}return _0x329050['status'](_0x3ca1ba)[_0xf2e0('0x1d')]();};}function respondWithResult(_0x385c96,_0x129e1d){_0x129e1d=_0x129e1d||0xc8;return function(_0x4a2e02){if(_0x4a2e02){return _0x385c96['status'](_0x129e1d)[_0xf2e0('0x1e')](_0x4a2e02);}};}function respondWithFilteredResult(_0x4b8ed2,_0x340d57){return function(_0x5662e5){if(_0x5662e5){var _0x53051e=typeof _0x340d57['offset']===_0xf2e0('0x1f')&&typeof _0x340d57[_0xf2e0('0x20')]===_0xf2e0('0x1f');var _0x443dd0=_0x5662e5[_0xf2e0('0x21')];var _0x1398f5=_0x53051e?0x0:_0x340d57[_0xf2e0('0x22')];var _0x21ff6a=_0x53051e?_0x5662e5[_0xf2e0('0x21')]:_0x340d57[_0xf2e0('0x22')]+_0x340d57['limit'];var _0x36b270;if(_0x21ff6a>=_0x443dd0){_0x21ff6a=_0x443dd0;_0x36b270=0xc8;}else{_0x36b270=0xce;}_0x4b8ed2['status'](_0x36b270);return _0x4b8ed2[_0xf2e0('0x23')](_0xf2e0('0x24'),_0x1398f5+'-'+_0x21ff6a+'/'+_0x443dd0)[_0xf2e0('0x1e')](_0x5662e5);}return null;};}function patchUpdates(_0x4b0083){return function(_0x45f2de){try{jsonpatch[_0xf2e0('0x25')](_0x45f2de,_0x4b0083,!![]);}catch(_0x28271e){return BPromise[_0xf2e0('0x26')](_0x28271e);}return _0x45f2de[_0xf2e0('0x27')]();};}function saveUpdates(_0x4bb42e,_0x48d997){return function(_0x4ac467){if(_0x4ac467){return _0x4ac467[_0xf2e0('0x28')](_0x4bb42e)[_0xf2e0('0x29')](function(_0x26cd48){return _0x26cd48;});}return null;};}function handleEntityNotFound(_0x50402c,_0x4bad22){return function(_0x3e5af8){if(!_0x3e5af8){_0x50402c[_0xf2e0('0x1c')](0x194);}return _0x3e5af8;};}function handleError(_0xde4404,_0x57cc61){_0x57cc61=_0x57cc61||0x1f4;return function(_0x508890){logger['error'](_0x508890['stack']);if(_0x508890[_0xf2e0('0x2a')]){delete _0x508890[_0xf2e0('0x2a')];}_0xde4404[_0xf2e0('0x2b')](_0x57cc61)[_0xf2e0('0x2c')](_0x508890);};}exports[_0xf2e0('0x2d')]=function(_0x26bc6f,_0x3c98d4){var _0x1a020d={},_0x3f1ab4={},_0x531ab3={'count':0x0,'rows':[]};var _0x5229dc=_[_0xf2e0('0x2e')](db['Team'][_0xf2e0('0x2f')],function(_0xd0c7d4){return{'name':_0xd0c7d4[_0xf2e0('0x30')],'type':_0xd0c7d4[_0xf2e0('0x31')][_0xf2e0('0x32')]};});_0x3f1ab4[_0xf2e0('0x33')]=_[_0xf2e0('0x2e')](_0x5229dc,_0xf2e0('0x2a'));_0x3f1ab4[_0xf2e0('0x34')]=_[_0xf2e0('0x35')](_0x26bc6f[_0xf2e0('0x34')]);_0x3f1ab4['filters']=_['intersection'](_0x3f1ab4[_0xf2e0('0x33')],_0x3f1ab4[_0xf2e0('0x34')]);_0x1a020d[_0xf2e0('0x36')]=_[_0xf2e0('0x37')](_0x3f1ab4['model'],qs['fields'](_0x26bc6f[_0xf2e0('0x34')]['fields']));_0x1a020d[_0xf2e0('0x36')]=_0x1a020d[_0xf2e0('0x36')][_0xf2e0('0x38')]?_0x1a020d['attributes']:_0x3f1ab4[_0xf2e0('0x33')];if(!_0x26bc6f[_0xf2e0('0x34')][_0xf2e0('0x39')](_0xf2e0('0x3a'))){_0x1a020d[_0xf2e0('0x20')]=qs['limit'](_0x26bc6f['query'][_0xf2e0('0x20')]);_0x1a020d[_0xf2e0('0x22')]=qs['offset'](_0x26bc6f[_0xf2e0('0x34')][_0xf2e0('0x22')]);}_0x1a020d[_0xf2e0('0x3b')]=qs[_0xf2e0('0x3c')](_0x26bc6f['query'][_0xf2e0('0x3c')]);_0x1a020d[_0xf2e0('0x3d')]=qs[_0xf2e0('0x3e')](_['pick'](_0x26bc6f[_0xf2e0('0x34')],_0x3f1ab4[_0xf2e0('0x3e')]),_0x5229dc);if(_0x26bc6f['query'][_0xf2e0('0x3f')]){_0x1a020d[_0xf2e0('0x3d')]=_[_0xf2e0('0x40')](_0x1a020d[_0xf2e0('0x3d')],{'$or':_[_0xf2e0('0x2e')](_0x5229dc,function(_0x7621d6){if(_0x7621d6[_0xf2e0('0x31')]!==_0xf2e0('0x41')){var _0x452827={};_0x452827[_0x7621d6[_0xf2e0('0x2a')]]={'$like':'%'+_0x26bc6f[_0xf2e0('0x34')][_0xf2e0('0x3f')]+'%'};return _0x452827;}})});}_0x1a020d=_['merge']({},_0x1a020d,_0x26bc6f[_0xf2e0('0x42')]);var _0x53a264={'where':_0x1a020d['where']};return db[_0xf2e0('0x43')]['count'](_0x53a264)[_0xf2e0('0x29')](function(_0x2ce72c){_0x531ab3['count']=_0x2ce72c;if(_0x26bc6f[_0xf2e0('0x34')][_0xf2e0('0x44')]){_0x1a020d['include']=[{'all':!![]}];}return db[_0xf2e0('0x43')][_0xf2e0('0x45')](_0x1a020d);})[_0xf2e0('0x29')](function(_0x59bb38){_0x531ab3['rows']=_0x59bb38;return _0x531ab3;})[_0xf2e0('0x29')](respondWithFilteredResult(_0x3c98d4,_0x1a020d))[_0xf2e0('0x46')](handleError(_0x3c98d4,null));};exports[_0xf2e0('0x47')]=function(_0x5db46a,_0x5fcfd3){var _0x2753f2={'raw':![],'where':{'id':_0x5db46a[_0xf2e0('0x48')]['id']}},_0x31189={};_0x31189['model']=_[_0xf2e0('0x35')](db[_0xf2e0('0x43')][_0xf2e0('0x2f')]);_0x31189[_0xf2e0('0x34')]=_['keys'](_0x5db46a['query']);_0x31189['filters']=_[_0xf2e0('0x37')](_0x31189[_0xf2e0('0x33')],_0x31189['query']);_0x2753f2[_0xf2e0('0x36')]=_[_0xf2e0('0x37')](_0x31189[_0xf2e0('0x33')],qs['fields'](_0x5db46a[_0xf2e0('0x34')][_0xf2e0('0x49')]));_0x2753f2['attributes']=_0x2753f2[_0xf2e0('0x36')][_0xf2e0('0x38')]?_0x2753f2[_0xf2e0('0x36')]:_0x31189['model'];if(_0x5db46a[_0xf2e0('0x34')][_0xf2e0('0x44')]){_0x2753f2[_0xf2e0('0x4a')]=[{'all':!![]}];}_0x2753f2=_[_0xf2e0('0x40')]({},_0x2753f2,_0x5db46a['options']);return db['Team'][_0xf2e0('0x4b')](_0x2753f2)[_0xf2e0('0x29')](handleEntityNotFound(_0x5fcfd3,null))[_0xf2e0('0x29')](respondWithResult(_0x5fcfd3,null))[_0xf2e0('0x46')](handleError(_0x5fcfd3,null));};exports['create']=function(_0x317cd1,_0x75cc78){return db[_0xf2e0('0x43')][_0xf2e0('0x4c')](_0x317cd1['body'],{})[_0xf2e0('0x29')](function(_0x6476a2){var _0x8485bd=_0x317cd1[_0xf2e0('0x4d')]['get']({'plain':!![]});if(!_0x8485bd)throw new Error(_0xf2e0('0x4e'));if(_0x8485bd[_0xf2e0('0x4f')]===_0xf2e0('0x4d')){var _0x5304f3=_0x6476a2[_0xf2e0('0x50')]({'plain':!![]});var _0x2a3730=_0xf2e0('0x51');return db[_0xf2e0('0x52')][_0xf2e0('0x4b')]({'where':{'name':_0x2a3730,'userProfileId':_0x8485bd[_0xf2e0('0x53')]},'raw':!![]})[_0xf2e0('0x29')](function(_0x78a2b4){if(_0x78a2b4&&_0x78a2b4['autoAssociation']===0x0){return db['UserProfileResource'][_0xf2e0('0x4c')]({'name':_0x5304f3['name'],'resourceId':_0x5304f3['id'],'type':_0x78a2b4[_0xf2e0('0x2a')],'sectionId':_0x78a2b4['id']},{})[_0xf2e0('0x29')](function(){return _0x6476a2;});}else{return _0x6476a2;}})[_0xf2e0('0x46')](function(_0x571239){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x571239);throw _0x571239;});}return _0x6476a2;})[_0xf2e0('0x29')](respondWithResult(_0x75cc78,0xc9))['catch'](handleError(_0x75cc78,null));};exports[_0xf2e0('0x28')]=function(_0x4957d8,_0x2381e2){if(_0x4957d8[_0xf2e0('0x54')]['id']){delete _0x4957d8[_0xf2e0('0x54')]['id'];}return db[_0xf2e0('0x43')][_0xf2e0('0x4b')]({'where':{'id':_0x4957d8[_0xf2e0('0x48')]['id']}})[_0xf2e0('0x29')](handleEntityNotFound(_0x2381e2,null))[_0xf2e0('0x29')](saveUpdates(_0x4957d8[_0xf2e0('0x54')],null))[_0xf2e0('0x29')](respondWithResult(_0x2381e2,null))[_0xf2e0('0x46')](handleError(_0x2381e2,null));};exports['destroy']=function(_0x2dfb91,_0x3739f5){var _0xc3ca22=_0x2dfb91['params']['id'];var _0x1ba247=[];return db['sequelize'][_0xf2e0('0x55')](function(_0x3410f3){var _0x4a7f4d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0xc3ca22;return db[_0xf2e0('0x56')][_0xf2e0('0x34')](_0x4a7f4d,{'type':db[_0xf2e0('0x57')][_0xf2e0('0x58')]['SELECT'],'raw':!![],'transaction':_0x3410f3})['then'](function(_0x37aafd){_0x1ba247=_[_0xf2e0('0x2e')](_0x37aafd,function(_0x57db76){return Number(_0x57db76[_0xf2e0('0x59')]);});})[_0xf2e0('0x29')](function(){var _0x2b5e6d=_0xf2e0('0x5a')+_0xc3ca22;return db[_0xf2e0('0x56')][_0xf2e0('0x34')](_0x2b5e6d,{'type':db[_0xf2e0('0x57')][_0xf2e0('0x58')][_0xf2e0('0x5b')],'raw':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x3e6cbe){var _0x38ca2f=_[_0xf2e0('0x2e')](_0x3e6cbe,function(_0x1d52dd){return Number(_0x1d52dd['VoiceQueueId']);});return db[_0xf2e0('0x5c')]['destroy']({'where':{'UserId':{'$in':_0x1ba247},'VoiceQueueId':{'$in':_0x38ca2f}},'transaction':_0x3410f3});})['then'](function(){var _0x51bb82=_0xf2e0('0x5d')+_0xc3ca22;return db[_0xf2e0('0x56')]['query'](_0x51bb82,{'type':db[_0xf2e0('0x57')][_0xf2e0('0x58')][_0xf2e0('0x5b')],'raw':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x40e912){var _0x24191f=_[_0xf2e0('0x2e')](_0x40e912,function(_0x2fb0a1){return Number(_0x2fb0a1['MailQueueId']);});return db[_0xf2e0('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x1ba247},'MailQueueId':{'$in':_0x24191f}},'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(){var _0x21c2ea=_0xf2e0('0x5f')+_0xc3ca22;return db[_0xf2e0('0x56')][_0xf2e0('0x34')](_0x21c2ea,{'type':db[_0xf2e0('0x57')][_0xf2e0('0x58')]['SELECT'],'raw':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x1109ea){var _0x41f202=_[_0xf2e0('0x2e')](_0x1109ea,function(_0x116976){return Number(_0x116976[_0xf2e0('0x60')]);});return db['UserSmsQueue'][_0xf2e0('0x61')]({'where':{'UserId':{'$in':_0x1ba247},'SmsQueueId':{'$in':_0x41f202}},'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(){var _0x498114='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc3ca22;return db['sequelize'][_0xf2e0('0x34')](_0x498114,{'type':db[_0xf2e0('0x57')][_0xf2e0('0x58')][_0xf2e0('0x5b')],'raw':!![],'transaction':_0x3410f3});})['then'](function(_0x24d3ca){var _0x51661e=_[_0xf2e0('0x2e')](_0x24d3ca,function(_0x43fa45){return Number(_0x43fa45[_0xf2e0('0x62')]);});return db[_0xf2e0('0x63')][_0xf2e0('0x61')]({'where':{'UserId':{'$in':_0x1ba247},'ChatQueueId':{'$in':_0x51661e}},'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(){var _0x59f1b1=_0xf2e0('0x64')+_0xc3ca22;return db[_0xf2e0('0x56')]['query'](_0x59f1b1,{'type':db[_0xf2e0('0x57')][_0xf2e0('0x58')][_0xf2e0('0x5b')],'raw':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x4db8b3){var _0x1a1b87=_['map'](_0x4db8b3,function(_0x38efea){return Number(_0x38efea[_0xf2e0('0x65')]);});return db[_0xf2e0('0x66')][_0xf2e0('0x61')]({'where':{'UserId':{'$in':_0x1ba247},'FaxQueueId':{'$in':_0x1a1b87}},'transaction':_0x3410f3});})['then'](function(){var _0x353403=_0xf2e0('0x67')+_0xc3ca22;return db[_0xf2e0('0x56')][_0xf2e0('0x34')](_0x353403,{'type':db['Sequelize'][_0xf2e0('0x58')][_0xf2e0('0x5b')],'raw':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x1d6af4){var _0x12de74=_['map'](_0x1d6af4,function(_0x2ccd3d){return Number(_0x2ccd3d[_0xf2e0('0x68')]);});return db[_0xf2e0('0x69')][_0xf2e0('0x61')]({'where':{'UserId':{'$in':_0x1ba247},'OpenchannelQueueId':{'$in':_0x12de74}},'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(){var _0x5ee36b='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc3ca22;return db['sequelize'][_0xf2e0('0x34')](_0x5ee36b,{'type':db[_0xf2e0('0x57')]['QueryTypes'][_0xf2e0('0x5b')],'raw':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x513bda){var _0x3871b9=_[_0xf2e0('0x2e')](_0x513bda,function(_0x472878){return Number(_0x472878[_0xf2e0('0x6a')]);});return db[_0xf2e0('0x6b')][_0xf2e0('0x61')]({'where':{'UserId':{'$in':_0x1ba247},'WhatsappQueueId':{'$in':_0x3871b9}},'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(){return db[_0xf2e0('0x6c')][_0xf2e0('0x4b')]({'where':{'TeamId':_0xc3ca22}});})[_0xf2e0('0x29')](function(_0x437ba7){if(_0x437ba7===null){return;}return db[_0xf2e0('0x6d')][_0xf2e0('0x61')]({'where':{'UserId':{'$in':_0x1ba247},'VoicePrefixId':_0x437ba7[_0xf2e0('0x6e')]},'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(){return db[_0xf2e0('0x43')]['destroy']({'where':{'id':_0xc3ca22},'cascade':!![],'transaction':_0x3410f3});})[_0xf2e0('0x29')](function(_0x310365){if(_0x310365===0x0){_0x3739f5['sendStatus'](0x194);}else{return db[_0xf2e0('0x6f')][_0xf2e0('0x61')]({'where':{'type':_0xf2e0('0x51'),'resourceId':_0xc3ca22},'cascade':!![],'transaction':_0x3410f3})[_0xf2e0('0x29')](function(){_0x3739f5[_0xf2e0('0x2b')](0xcc)[_0xf2e0('0x1d')]();});}})['catch'](function(_0x532281){_0x3739f5[_0xf2e0('0x2b')](0x1f4)[_0xf2e0('0x2c')](_0x532281);});});};exports[_0xf2e0('0x70')]=function(_0x69799e,_0x342e87,_0x2e1ae7){return db[_0xf2e0('0x43')][_0xf2e0('0x71')]({'where':{'id':_0x69799e[_0xf2e0('0x48')]['id']}})[_0xf2e0('0x29')](handleEntityNotFound(_0x342e87,null))[_0xf2e0('0x29')](function(_0x1382cc){if(!_0x69799e['query']['channel']||!utils['isValidChannel'](_0x69799e[_0xf2e0('0x34')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xf2e0('0x72'));}var _0x1a37ed={};var _0x39baac={};_0x39baac['model']=_[_0xf2e0('0x35')](db[_[_0xf2e0('0x73')](_0x69799e[_0xf2e0('0x34')][_0xf2e0('0x74')]['toLowerCase']())+_0xf2e0('0x75')][_0xf2e0('0x2f')]);_0x39baac[_0xf2e0('0x34')]=_[_0xf2e0('0x35')](_0x69799e[_0xf2e0('0x34')]);_0x39baac[_0xf2e0('0x3e')]=_[_0xf2e0('0x37')](_0x39baac[_0xf2e0('0x33')],_0x39baac[_0xf2e0('0x34')]);_0x1a37ed[_0xf2e0('0x36')]=_[_0xf2e0('0x37')](_0x39baac['model'],qs['fields'](_0x69799e[_0xf2e0('0x34')][_0xf2e0('0x49')]));_0x1a37ed['attributes']=_0x1a37ed['attributes'][_0xf2e0('0x38')]?_0x1a37ed[_0xf2e0('0x36')]:_0x39baac['model'];_0x1a37ed[_0xf2e0('0x20')]=qs[_0xf2e0('0x20')](_0x69799e['query']['limit']);_0x1a37ed[_0xf2e0('0x22')]=qs[_0xf2e0('0x22')](_0x69799e[_0xf2e0('0x34')]['offset']);_0x1a37ed['order']=qs[_0xf2e0('0x3c')](_0x69799e[_0xf2e0('0x34')][_0xf2e0('0x3c')]);_0x1a37ed[_0xf2e0('0x3d')]=qs[_0xf2e0('0x3e')](_[_0xf2e0('0x76')](_0x69799e[_0xf2e0('0x34')],_0x39baac[_0xf2e0('0x3e')]));_0x1a37ed=_[_0xf2e0('0x40')]({},_0x1a37ed,_0x69799e['options']);return _0x1382cc[_0xf2e0('0x50')+_[_0xf2e0('0x73')](_0x69799e[_0xf2e0('0x34')][_0xf2e0('0x74')][_0xf2e0('0x77')]())+_0xf2e0('0x78')](_0x1a37ed);})['then'](respondWithResult(_0x342e87,null))['catch'](handleError(_0x342e87,null));};exports[_0xf2e0('0x79')]=function(_0x4bb4e8,_0x256bc5,_0x2e3ce3){return db['Team'][_0xf2e0('0x71')]({'where':{'id':_0x4bb4e8[_0xf2e0('0x48')]['id']}})[_0xf2e0('0x29')](function(_0x48411b){if(_0x48411b){if(!_0x4bb4e8[_0xf2e0('0x54')][_0xf2e0('0x74')]||!utils[_0xf2e0('0x7a')](_0x4bb4e8[_0xf2e0('0x54')][_0xf2e0('0x74')])){throw new db[(_0xf2e0('0x57'))][(_0xf2e0('0x7b'))]('Unknown\x20channel');}return _0x48411b[_0xf2e0('0x7c')+_[_0xf2e0('0x73')](_0x4bb4e8[_0xf2e0('0x54')]['channel'][_0xf2e0('0x77')]())+_0xf2e0('0x78')](_0x4bb4e8['body'][_0xf2e0('0x7d')]);}return null;})[_0xf2e0('0x29')](handleEntityNotFound(_0x256bc5,null))[_0xf2e0('0x29')](respondWithStatusCode(_0x256bc5,null))['catch'](handleError(_0x256bc5,null));};exports[_0xf2e0('0x7e')]=function(_0x57ae2c,_0x407894,_0x4e00e8){return db['Team'][_0xf2e0('0x71')]({'where':{'id':_0x57ae2c[_0xf2e0('0x48')]['id']}})[_0xf2e0('0x29')](function(_0x57dabc){if(_0x57dabc){if(!_0x57ae2c['query'][_0xf2e0('0x74')]||!utils[_0xf2e0('0x7a')](_0x57ae2c[_0xf2e0('0x34')][_0xf2e0('0x74')])){throw new db[(_0xf2e0('0x57'))]['ValidationError'](_0xf2e0('0x72'));}return _0x57dabc[_0xf2e0('0x7f')+_[_0xf2e0('0x73')](_0x57ae2c[_0xf2e0('0x34')]['channel'][_0xf2e0('0x77')]())+'Queues'](_0x57ae2c[_0xf2e0('0x34')][_0xf2e0('0x7d')]);}return null;})['then'](handleEntityNotFound(_0x407894,null))['then'](respondWithStatusCode(_0x407894,null))['catch'](handleError(_0x407894,null));};exports['addAgents']=function(_0x5ec741,_0x9cd363){var _0x57be94=_[_0xf2e0('0x80')](_0x5ec741[_0xf2e0('0x54')][_0xf2e0('0x7d')])?_0x5ec741[_0xf2e0('0x54')][_0xf2e0('0x7d')]:[_0x5ec741[_0xf2e0('0x54')]['ids']];var _0x38b94e=_0x5ec741[_0xf2e0('0x48')]['id'];return db[_0xf2e0('0x43')][_0xf2e0('0x4b')]({'where':{'id':_0x38b94e}})[_0xf2e0('0x29')](handleEntityNotFound(_0x9cd363,null))[_0xf2e0('0x29')](function(_0x22b112){if(_0x22b112){var _0xcb236=[_0xf2e0('0x81'),_0xf2e0('0x82'),_0xf2e0('0x83'),_0xf2e0('0x84'),_0xf2e0('0x85'),'Openchannel',_0xf2e0('0x86')];return db['sequelize'][_0xf2e0('0x55')](function(_0x31796d){var _0x389e30=_[_0xf2e0('0x2e')](_0xcb236,function(_0x3c4449){var _0xd47628={'attributes':['id',_0xf2e0('0x2a')]};if(_0x3c4449===_0xf2e0('0x81')){_0xd47628[_0xf2e0('0x87')]={'attributes':[_0xf2e0('0x88')]};}return _0x22b112['get'+_0x3c4449+'Queues'](_0xd47628)[_0xf2e0('0x29')](function(_0x71b340){var _0x1a178a=_[_0xf2e0('0x2e')](_0x71b340,function(_0x3eb079){var _0x5630de=_['map'](_0x57be94,function(_0x38c082){var _0x4558d6={'where':{'UserId':_0x38c082,[_0x3c4449+'QueueId']:_0x3eb079['id']},'transaction':_0x31796d};if(_0x3c4449==='Voice'){_0x4558d6[_0xf2e0('0x89')]={'penalty':_0x3eb079['TeamVoiceQueue']['penalty']};}return db[_0xf2e0('0x8a')+_0x3c4449+'Queue'][_0xf2e0('0x8b')](_0x4558d6)[_0xf2e0('0x29')](function(){socket[_0xf2e0('0x8c')](_0xf2e0('0x4d')+_0x3c4449+'Queue:save',{'UserId':_0x38c082,[_0x3c4449+_0xf2e0('0x8d')]:_0x3eb079['id']});if(_0x3c4449!==_0xf2e0('0x81')){return;}return db[_0xf2e0('0x8a')][_0xf2e0('0x45')]({'where':{'id':_0x57be94,'online':0x1},'attributes':['id','name',_0xf2e0('0x8e'),'voicePause','interface'],'raw':!![]})[_0xf2e0('0x29')](function(_0xf7cfee){var _0x34d4af=_[_0xf2e0('0x2e')](_0xf7cfee,function(_0x5ad43e){return db[_0xf2e0('0x8f')][_0xf2e0('0x90')]({'membername':_0x5ad43e[_0xf2e0('0x2a')],'UserId':_0x5ad43e['id'],'queue_name':_0x3eb079[_0xf2e0('0x2a')],'VoiceQueueId':_0x3eb079['id'],'interface':_[_0xf2e0('0x91')](_0x5ad43e['interface'])?util[_0xf2e0('0x92')](_0xf2e0('0x93'),_0x5ad43e['name']):_0x5ad43e[_0xf2e0('0x94')],'paused':_0x5ad43e['voicePause']||![],'penalty':_0x3eb079[_0xf2e0('0x95')][_0xf2e0('0x88')]},{'transaction':_0x31796d});});return Promise[_0xf2e0('0x96')](_0x34d4af);});});});return Promise[_0xf2e0('0x96')](_0x5630de);});return Promise[_0xf2e0('0x96')](_0x1a178a);})[_0xf2e0('0x29')](function(){return db[_0xf2e0('0x6c')][_0xf2e0('0x71')]({'where':{'teamId':_0x38b94e}})[_0xf2e0('0x29')](function(_0x336761){if(_0x336761){var _0x2d3c1c=_[_0xf2e0('0x2e')](_0x57be94,function(_0x1f77dd){db[_0xf2e0('0x6d')][_0xf2e0('0x90')]({'UserId':_0x1f77dd,'VoicePrefixId':_0x336761[_0xf2e0('0x6e')]});});return Promise['all'](_0x2d3c1c);}});});});return Promise['all'](_0x389e30)['then'](function(){return _0x22b112[_0xf2e0('0x97')](_0x57be94,{'transaction':_0x31796d})['spread'](function(_0x57bb5f){return _0x57bb5f;});});});}})[_0xf2e0('0x29')](respondWithResult(_0x9cd363,null))[_0xf2e0('0x46')](handleError(_0x9cd363,null));};exports[_0xf2e0('0x98')]=function(_0x5341a9,_0x396333){var _0x1ff1ff=_[_0xf2e0('0x80')](_0x5341a9[_0xf2e0('0x34')][_0xf2e0('0x7d')])?_0x5341a9['query'][_0xf2e0('0x7d')]:[_0x5341a9['query'][_0xf2e0('0x7d')]];var _0x533572=_0x5341a9[_0xf2e0('0x48')]['id'];return db[_0xf2e0('0x43')][_0xf2e0('0x4b')]({'where':{'id':_0x533572}})['then'](handleEntityNotFound(_0x396333,null))[_0xf2e0('0x29')](function(_0x3c0d83){if(_0x3c0d83){var _0x51a6fc=[_0xf2e0('0x81'),_0xf2e0('0x82'),'Mail','Sms','Fax',_0xf2e0('0x99'),'Whatsapp'];return db['sequelize'][_0xf2e0('0x55')](function(_0x592cb7){var _0x415b1d=_[_0xf2e0('0x2e')](_0x51a6fc,function(_0x24203d){var _0x4b67be={'attributes':['id',_0xf2e0('0x2a')]};return _0x3c0d83['get'+_0x24203d+_0xf2e0('0x78')](_0x4b67be)[_0xf2e0('0x29')](function(_0xecbc8b){var _0x3ecefd=_['map'](_0xecbc8b,function(_0x35b16f){return _0x35b16f['removeAgents'](_0x1ff1ff,{'transaction':_0x592cb7})['then'](function(){var _0x32dfe4=_['map'](_0x1ff1ff,function(_0x1ff506){socket['emit'](_0xf2e0('0x4d')+_0x24203d+_0xf2e0('0x9a'),{'UserId':Number(_0x1ff506),[_0x24203d+_0xf2e0('0x8d')]:_0x35b16f['id']});if(_0x24203d!==_0xf2e0('0x81')){return;}return db[_0xf2e0('0x8f')][_0xf2e0('0x61')]({'where':{'VoiceQueueId':_0x35b16f['id'],'UserId':_0x1ff506},'transaction':_0x592cb7});});return Promise['all'](_0x32dfe4);});});return Promise[_0xf2e0('0x96')](_0x3ecefd);});});return Promise[_0xf2e0('0x96')](_0x415b1d)[_0xf2e0('0x29')](function(){return _0x3c0d83[_0xf2e0('0x98')](_0x1ff1ff,{'transaction':_0x592cb7});})['then'](function(){return db['TeamVoicePrefix'][_0xf2e0('0x71')]({'where':{'teamId':_0x533572}})['then'](function(_0x928d86){if(_0x928d86){var _0x146516=_['map'](_0x1ff1ff,function(_0x1f8a42){db[_0xf2e0('0x6d')][_0xf2e0('0x61')]({'where':{'UserId':_0x1f8a42,'VoicePrefixId':_0x928d86[_0xf2e0('0x6e')]}});});return Promise[_0xf2e0('0x96')](_0x146516);}});});});}})[_0xf2e0('0x29')](respondWithStatusCode(_0x396333,null))[_0xf2e0('0x46')](handleError(_0x396333,null));};exports[_0xf2e0('0x9b')]=function(_0x2ef5bf,_0x39296e,_0x27ff8b){var _0x407fe2={};var _0x4df851={};var _0x44b553;var _0x584ee4;return db[_0xf2e0('0x43')][_0xf2e0('0x71')]({'where':{'id':_0x2ef5bf[_0xf2e0('0x48')]['id']}})[_0xf2e0('0x29')](handleEntityNotFound(_0x39296e,null))[_0xf2e0('0x29')](function(_0x51336b){if(_0x51336b){_0x44b553=_0x51336b;_0x4df851['model']=_['keys'](db['User']['rawAttributes']);_0x4df851[_0xf2e0('0x34')]=_[_0xf2e0('0x35')](_0x2ef5bf[_0xf2e0('0x34')]);_0x4df851[_0xf2e0('0x3e')]=_[_0xf2e0('0x37')](_0x4df851[_0xf2e0('0x33')],_0x4df851[_0xf2e0('0x34')]);_0x407fe2['attributes']=_['intersection'](_0x4df851[_0xf2e0('0x33')],qs[_0xf2e0('0x49')](_0x2ef5bf[_0xf2e0('0x34')][_0xf2e0('0x49')]));_0x407fe2[_0xf2e0('0x36')]=_0x407fe2[_0xf2e0('0x36')][_0xf2e0('0x38')]?_0x407fe2[_0xf2e0('0x36')]:_0x4df851[_0xf2e0('0x33')];_0x407fe2[_0xf2e0('0x3b')]=qs['sort'](_0x2ef5bf[_0xf2e0('0x34')][_0xf2e0('0x3c')]);_0x407fe2[_0xf2e0('0x3d')]=qs['filters'](_[_0xf2e0('0x76')](_0x2ef5bf[_0xf2e0('0x34')],_0x4df851[_0xf2e0('0x3e')]));if(_0x2ef5bf['query'][_0xf2e0('0x3f')]){_0x407fe2['where']=_[_0xf2e0('0x40')](_0x407fe2[_0xf2e0('0x3d')],{'$or':_['map'](_0x407fe2[_0xf2e0('0x36')],function(_0x7b26fd){var _0x145bef={};_0x145bef[_0x7b26fd]={'$like':'%'+_0x2ef5bf[_0xf2e0('0x34')]['filter']+'%'};return _0x145bef;})});}_0x407fe2=_[_0xf2e0('0x40')]({},_0x407fe2,_0x2ef5bf[_0xf2e0('0x42')]);return _0x44b553[_0xf2e0('0x9b')](_0x407fe2);}})[_0xf2e0('0x29')](function(_0x395b72){if(_0x395b72){_0x584ee4=_0x395b72['length'];if(!_0x2ef5bf[_0xf2e0('0x34')][_0xf2e0('0x39')]('nolimit')){_0x407fe2[_0xf2e0('0x20')]=qs['limit'](_0x2ef5bf[_0xf2e0('0x34')]['limit']);_0x407fe2[_0xf2e0('0x22')]=qs[_0xf2e0('0x22')](_0x2ef5bf[_0xf2e0('0x34')]['offset']);}return _0x44b553['getAgents'](_0x407fe2);}})['then'](function(_0x16e8b8){if(_0x16e8b8){return _0x16e8b8?{'count':_0x584ee4,'rows':_0x16e8b8}:null;}})[_0xf2e0('0x29')](respondWithResult(_0x39296e,null))['catch'](handleError(_0x39296e,null));}; \ No newline at end of file +var _0xa4b7=['limit','set','apply','update','then','stack','name','send','index','map','Team','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','params','isValidChannel','ValidationError','capitalize','channel','toLowerCase','length','order','sort','findOne','add','Queues','ids','Unknown\x20channel','remove','addAgents','isArray','Chat','Sms','Fax','Openchannel','Whatsapp','transaction','Voice','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','Queue:save','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','removeAgents','Mail','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','count'];(function(_0x42afb8,_0x3a71cd){var _0x439f98=function(_0x86906){while(--_0x86906){_0x42afb8['push'](_0x42afb8['shift']());}};_0x439f98(++_0x3a71cd);}(_0xa4b7,0x77));var _0x7a4b=function(_0x119ee6,_0x2f0686){_0x119ee6=_0x119ee6-0x0;var _0x3f42b2=_0xa4b7[_0x119ee6];return _0x3f42b2;};'use strict';var emlformat=require(_0x7a4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a4b('0x1'));var jsonpatch=require(_0x7a4b('0x2'));var rp=require(_0x7a4b('0x3'));var moment=require('moment');var BPromise=require(_0x7a4b('0x4'));var Mustache=require(_0x7a4b('0x5'));var util=require('util');var path=require(_0x7a4b('0x6'));var sox=require(_0x7a4b('0x7'));var csv=require('to-csv');var ejs=require(_0x7a4b('0x8'));var fs=require('fs');var fs_extra=require(_0x7a4b('0x9'));var _=require('lodash');var squel=require(_0x7a4b('0xa'));var crypto=require(_0x7a4b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7a4b('0xc'));var toCsv=require(_0x7a4b('0xd'));var querystring=require('querystring');var Papa=require(_0x7a4b('0xe'));var Redis=require(_0x7a4b('0xf'));var authService=require(_0x7a4b('0x10'));var qs=require(_0x7a4b('0x11'));var as=require(_0x7a4b('0x12'));var hardwareService=require(_0x7a4b('0x13'));var logger=require(_0x7a4b('0x14'))(_0x7a4b('0x15'));var utils=require(_0x7a4b('0x16'));var config=require(_0x7a4b('0x17'));var licenseUtil=require(_0x7a4b('0x18'));var db=require(_0x7a4b('0x19'))['db'];config['redis']=_[_0x7a4b('0x1a')](config[_0x7a4b('0x1b')],{'host':_0x7a4b('0x1c'),'port':0x18eb});var socket=require(_0x7a4b('0x1d'))(new Redis(config[_0x7a4b('0x1b')]));require(_0x7a4b('0x1e'))[_0x7a4b('0x1f')](socket);function respondWithStatusCode(_0x28ec14,_0x2f2c2b){_0x2f2c2b=_0x2f2c2b||0xcc;return function(_0x58072d){if(_0x58072d){return _0x28ec14[_0x7a4b('0x20')](_0x2f2c2b);}return _0x28ec14['status'](_0x2f2c2b)['end']();};}function respondWithResult(_0x53ac6f,_0x30a5ac){_0x30a5ac=_0x30a5ac||0xc8;return function(_0x401dab){if(_0x401dab){return _0x53ac6f[_0x7a4b('0x21')](_0x30a5ac)[_0x7a4b('0x22')](_0x401dab);}};}function respondWithFilteredResult(_0x3601e5,_0x4ad69d){return function(_0x2b2573){if(_0x2b2573){var _0x16c6c2=typeof _0x4ad69d[_0x7a4b('0x23')]===_0x7a4b('0x24')&&typeof _0x4ad69d['limit']==='undefined';var _0x279dbe=_0x2b2573[_0x7a4b('0x25')];var _0x34cfe4=_0x16c6c2?0x0:_0x4ad69d[_0x7a4b('0x23')];var _0x4f0909=_0x16c6c2?_0x2b2573['count']:_0x4ad69d[_0x7a4b('0x23')]+_0x4ad69d[_0x7a4b('0x26')];var _0x60579;if(_0x4f0909>=_0x279dbe){_0x4f0909=_0x279dbe;_0x60579=0xc8;}else{_0x60579=0xce;}_0x3601e5[_0x7a4b('0x21')](_0x60579);return _0x3601e5[_0x7a4b('0x27')]('Content-Range',_0x34cfe4+'-'+_0x4f0909+'/'+_0x279dbe)[_0x7a4b('0x22')](_0x2b2573);}return null;};}function patchUpdates(_0x2fb309){return function(_0x5d79f9){try{jsonpatch[_0x7a4b('0x28')](_0x5d79f9,_0x2fb309,!![]);}catch(_0x5a355f){return BPromise['reject'](_0x5a355f);}return _0x5d79f9['save']();};}function saveUpdates(_0x2ae4c7,_0x4385ec){return function(_0x3e9ec0){if(_0x3e9ec0){return _0x3e9ec0[_0x7a4b('0x29')](_0x2ae4c7)[_0x7a4b('0x2a')](function(_0x5aeebf){return _0x5aeebf;});}return null;};}function handleEntityNotFound(_0x4a3b04,_0x16d78a){return function(_0xeeb4b5){if(!_0xeeb4b5){_0x4a3b04[_0x7a4b('0x20')](0x194);}return _0xeeb4b5;};}function handleError(_0x28c118,_0x4822ee){_0x4822ee=_0x4822ee||0x1f4;return function(_0x26ac4c){logger['error'](_0x26ac4c[_0x7a4b('0x2b')]);if(_0x26ac4c[_0x7a4b('0x2c')]){delete _0x26ac4c['name'];}_0x28c118[_0x7a4b('0x21')](_0x4822ee)[_0x7a4b('0x2d')](_0x26ac4c);};}exports[_0x7a4b('0x2e')]=function(_0x3b00a9,_0x1c9002){var _0x374e6f={},_0x21677b={},_0x322c8a={'count':0x0,'rows':[]};var _0x5abffd=_[_0x7a4b('0x2f')](db[_0x7a4b('0x30')][_0x7a4b('0x31')],function(_0x275d28){return{'name':_0x275d28[_0x7a4b('0x32')],'type':_0x275d28['type']['key']};});_0x21677b[_0x7a4b('0x33')]=_[_0x7a4b('0x2f')](_0x5abffd,_0x7a4b('0x2c'));_0x21677b[_0x7a4b('0x34')]=_[_0x7a4b('0x35')](_0x3b00a9[_0x7a4b('0x34')]);_0x21677b[_0x7a4b('0x36')]=_[_0x7a4b('0x37')](_0x21677b[_0x7a4b('0x33')],_0x21677b['query']);_0x374e6f[_0x7a4b('0x38')]=_[_0x7a4b('0x37')](_0x21677b['model'],qs['fields'](_0x3b00a9[_0x7a4b('0x34')][_0x7a4b('0x39')]));_0x374e6f[_0x7a4b('0x38')]=_0x374e6f[_0x7a4b('0x38')]['length']?_0x374e6f[_0x7a4b('0x38')]:_0x21677b[_0x7a4b('0x33')];if(!_0x3b00a9[_0x7a4b('0x34')][_0x7a4b('0x3a')](_0x7a4b('0x3b'))){_0x374e6f['limit']=qs[_0x7a4b('0x26')](_0x3b00a9['query'][_0x7a4b('0x26')]);_0x374e6f[_0x7a4b('0x23')]=qs[_0x7a4b('0x23')](_0x3b00a9[_0x7a4b('0x34')][_0x7a4b('0x23')]);}_0x374e6f['order']=qs['sort'](_0x3b00a9[_0x7a4b('0x34')]['sort']);_0x374e6f['where']=qs[_0x7a4b('0x36')](_[_0x7a4b('0x3c')](_0x3b00a9[_0x7a4b('0x34')],_0x21677b[_0x7a4b('0x36')]),_0x5abffd);if(_0x3b00a9[_0x7a4b('0x34')][_0x7a4b('0x3d')]){_0x374e6f[_0x7a4b('0x3e')]=_['merge'](_0x374e6f[_0x7a4b('0x3e')],{'$or':_[_0x7a4b('0x2f')](_0x5abffd,function(_0x442fba){if(_0x442fba[_0x7a4b('0x3f')]!==_0x7a4b('0x40')){var _0x51f85a={};_0x51f85a[_0x442fba[_0x7a4b('0x2c')]]={'$like':'%'+_0x3b00a9['query'][_0x7a4b('0x3d')]+'%'};return _0x51f85a;}})});}_0x374e6f=_[_0x7a4b('0x41')]({},_0x374e6f,_0x3b00a9[_0x7a4b('0x42')]);var _0x3c30ad={'where':_0x374e6f[_0x7a4b('0x3e')]};return db['Team'][_0x7a4b('0x25')](_0x3c30ad)[_0x7a4b('0x2a')](function(_0x390ad9){_0x322c8a[_0x7a4b('0x25')]=_0x390ad9;if(_0x3b00a9['query'][_0x7a4b('0x43')]){_0x374e6f[_0x7a4b('0x44')]=[{'all':!![]}];}return db[_0x7a4b('0x30')][_0x7a4b('0x45')](_0x374e6f);})[_0x7a4b('0x2a')](function(_0x1338fb){_0x322c8a[_0x7a4b('0x46')]=_0x1338fb;return _0x322c8a;})['then'](respondWithFilteredResult(_0x1c9002,_0x374e6f))[_0x7a4b('0x47')](handleError(_0x1c9002,null));};exports[_0x7a4b('0x48')]=function(_0x4806de,_0x15076f){var _0x435de6={'raw':![],'where':{'id':_0x4806de['params']['id']}},_0x41df46={};_0x41df46[_0x7a4b('0x33')]=_['keys'](db['Team'][_0x7a4b('0x31')]);_0x41df46[_0x7a4b('0x34')]=_[_0x7a4b('0x35')](_0x4806de[_0x7a4b('0x34')]);_0x41df46[_0x7a4b('0x36')]=_[_0x7a4b('0x37')](_0x41df46[_0x7a4b('0x33')],_0x41df46[_0x7a4b('0x34')]);_0x435de6[_0x7a4b('0x38')]=_[_0x7a4b('0x37')](_0x41df46[_0x7a4b('0x33')],qs['fields'](_0x4806de[_0x7a4b('0x34')][_0x7a4b('0x39')]));_0x435de6[_0x7a4b('0x38')]=_0x435de6[_0x7a4b('0x38')]['length']?_0x435de6['attributes']:_0x41df46[_0x7a4b('0x33')];if(_0x4806de[_0x7a4b('0x34')][_0x7a4b('0x43')]){_0x435de6['include']=[{'all':!![]}];}_0x435de6=_[_0x7a4b('0x41')]({},_0x435de6,_0x4806de['options']);return db[_0x7a4b('0x30')][_0x7a4b('0x49')](_0x435de6)[_0x7a4b('0x2a')](handleEntityNotFound(_0x15076f,null))['then'](respondWithResult(_0x15076f,null))[_0x7a4b('0x47')](handleError(_0x15076f,null));};exports[_0x7a4b('0x4a')]=function(_0x4ea4a2,_0x43fe4f){return db[_0x7a4b('0x30')][_0x7a4b('0x4a')](_0x4ea4a2['body'],{})[_0x7a4b('0x2a')](function(_0x1b296b){var _0x5e4537=_0x4ea4a2[_0x7a4b('0x4b')][_0x7a4b('0x4c')]({'plain':!![]});if(!_0x5e4537)throw new Error(_0x7a4b('0x4d'));if(_0x5e4537[_0x7a4b('0x4e')]===_0x7a4b('0x4b')){var _0x1c957a=_0x1b296b[_0x7a4b('0x4c')]({'plain':!![]});var _0x3cc753=_0x7a4b('0x4f');return db[_0x7a4b('0x50')][_0x7a4b('0x49')]({'where':{'name':_0x3cc753,'userProfileId':_0x5e4537['userProfileId']},'raw':!![]})[_0x7a4b('0x2a')](function(_0x3ecde4){if(_0x3ecde4&&_0x3ecde4[_0x7a4b('0x51')]===0x0){return db[_0x7a4b('0x52')][_0x7a4b('0x4a')]({'name':_0x1c957a[_0x7a4b('0x2c')],'resourceId':_0x1c957a['id'],'type':_0x3ecde4['name'],'sectionId':_0x3ecde4['id']},{})['then'](function(){return _0x1b296b;});}else{return _0x1b296b;}})[_0x7a4b('0x47')](function(_0x544631){logger[_0x7a4b('0x53')](_0x7a4b('0x54'),_0x544631);throw _0x544631;});}return _0x1b296b;})[_0x7a4b('0x2a')](respondWithResult(_0x43fe4f,0xc9))['catch'](handleError(_0x43fe4f,null));};exports['update']=function(_0x4eca4b,_0x1006bd){if(_0x4eca4b[_0x7a4b('0x55')]['id']){delete _0x4eca4b[_0x7a4b('0x55')]['id'];}return db['Team'][_0x7a4b('0x49')]({'where':{'id':_0x4eca4b['params']['id']}})['then'](handleEntityNotFound(_0x1006bd,null))['then'](saveUpdates(_0x4eca4b[_0x7a4b('0x55')],null))[_0x7a4b('0x2a')](respondWithResult(_0x1006bd,null))['catch'](handleError(_0x1006bd,null));};exports[_0x7a4b('0x56')]=function(_0xa60cf6,_0x21a21a){var _0x13cbe0=_0xa60cf6['params']['id'];var _0x2379f3=[];return db[_0x7a4b('0x57')]['transaction'](function(_0x38ca42){var _0x1da4c7=_0x7a4b('0x58')+_0x13cbe0;return db[_0x7a4b('0x57')][_0x7a4b('0x34')](_0x1da4c7,{'type':db[_0x7a4b('0x59')][_0x7a4b('0x5a')][_0x7a4b('0x5b')],'raw':!![],'transaction':_0x38ca42})[_0x7a4b('0x2a')](function(_0x42f336){_0x2379f3=_[_0x7a4b('0x2f')](_0x42f336,function(_0x1538d8){return Number(_0x1538d8['UserId']);});})[_0x7a4b('0x2a')](function(){var _0xe5fd4f=_0x7a4b('0x5c')+_0x13cbe0;return db['sequelize'][_0x7a4b('0x34')](_0xe5fd4f,{'type':db[_0x7a4b('0x59')][_0x7a4b('0x5a')]['SELECT'],'raw':!![],'transaction':_0x38ca42});})['then'](function(_0x3d610f){var _0x4a5c02=_['map'](_0x3d610f,function(_0x51e42e){return Number(_0x51e42e['VoiceQueueId']);});return db[_0x7a4b('0x5d')][_0x7a4b('0x56')]({'where':{'UserId':{'$in':_0x2379f3},'VoiceQueueId':{'$in':_0x4a5c02}},'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(){var _0x329634=_0x7a4b('0x5e')+_0x13cbe0;return db[_0x7a4b('0x57')]['query'](_0x329634,{'type':db['Sequelize'][_0x7a4b('0x5a')][_0x7a4b('0x5b')],'raw':!![],'transaction':_0x38ca42});})['then'](function(_0x234cb5){var _0x409c90=_[_0x7a4b('0x2f')](_0x234cb5,function(_0x456750){return Number(_0x456750['MailQueueId']);});return db[_0x7a4b('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x2379f3},'MailQueueId':{'$in':_0x409c90}},'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(){var _0x5eb621=_0x7a4b('0x60')+_0x13cbe0;return db[_0x7a4b('0x57')][_0x7a4b('0x34')](_0x5eb621,{'type':db[_0x7a4b('0x59')][_0x7a4b('0x5a')][_0x7a4b('0x5b')],'raw':!![],'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(_0x562be7){var _0x9165ff=_[_0x7a4b('0x2f')](_0x562be7,function(_0x192c58){return Number(_0x192c58[_0x7a4b('0x61')]);});return db[_0x7a4b('0x62')][_0x7a4b('0x56')]({'where':{'UserId':{'$in':_0x2379f3},'SmsQueueId':{'$in':_0x9165ff}},'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(){var _0x39ce13=_0x7a4b('0x63')+_0x13cbe0;return db[_0x7a4b('0x57')]['query'](_0x39ce13,{'type':db['Sequelize'][_0x7a4b('0x5a')][_0x7a4b('0x5b')],'raw':!![],'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(_0x21dd54){var _0x108deb=_['map'](_0x21dd54,function(_0x2178b3){return Number(_0x2178b3[_0x7a4b('0x64')]);});return db['UserChatQueue'][_0x7a4b('0x56')]({'where':{'UserId':{'$in':_0x2379f3},'ChatQueueId':{'$in':_0x108deb}},'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(){var _0x47ce6b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x13cbe0;return db[_0x7a4b('0x57')][_0x7a4b('0x34')](_0x47ce6b,{'type':db[_0x7a4b('0x59')][_0x7a4b('0x5a')][_0x7a4b('0x5b')],'raw':!![],'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(_0x78f7e9){var _0x5259b8=_[_0x7a4b('0x2f')](_0x78f7e9,function(_0x55fde9){return Number(_0x55fde9[_0x7a4b('0x65')]);});return db[_0x7a4b('0x66')][_0x7a4b('0x56')]({'where':{'UserId':{'$in':_0x2379f3},'FaxQueueId':{'$in':_0x5259b8}},'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(){var _0x47901d=_0x7a4b('0x67')+_0x13cbe0;return db['sequelize'][_0x7a4b('0x34')](_0x47901d,{'type':db[_0x7a4b('0x59')][_0x7a4b('0x5a')]['SELECT'],'raw':!![],'transaction':_0x38ca42});})['then'](function(_0x207832){var _0x2da6ef=_['map'](_0x207832,function(_0x3c5e68){return Number(_0x3c5e68[_0x7a4b('0x68')]);});return db[_0x7a4b('0x69')][_0x7a4b('0x56')]({'where':{'UserId':{'$in':_0x2379f3},'OpenchannelQueueId':{'$in':_0x2da6ef}},'transaction':_0x38ca42});})['then'](function(){var _0x7091d0=_0x7a4b('0x6a')+_0x13cbe0;return db['sequelize']['query'](_0x7091d0,{'type':db[_0x7a4b('0x59')][_0x7a4b('0x5a')][_0x7a4b('0x5b')],'raw':!![],'transaction':_0x38ca42});})['then'](function(_0x1149f6){var _0x54639b=_[_0x7a4b('0x2f')](_0x1149f6,function(_0x4d7ae7){return Number(_0x4d7ae7[_0x7a4b('0x6b')]);});return db[_0x7a4b('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x2379f3},'WhatsappQueueId':{'$in':_0x54639b}},'transaction':_0x38ca42});})['then'](function(){return db[_0x7a4b('0x6d')][_0x7a4b('0x49')]({'where':{'TeamId':_0x13cbe0}});})[_0x7a4b('0x2a')](function(_0x19a741){if(_0x19a741===null){return;}return db[_0x7a4b('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x2379f3},'VoicePrefixId':_0x19a741[_0x7a4b('0x6f')]},'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(){return db['Team'][_0x7a4b('0x56')]({'where':{'id':_0x13cbe0},'cascade':!![],'transaction':_0x38ca42});})[_0x7a4b('0x2a')](function(_0x1a9160){if(_0x1a9160===0x0){_0x21a21a[_0x7a4b('0x20')](0x194);}else{return db[_0x7a4b('0x52')][_0x7a4b('0x56')]({'where':{'type':'Teams','resourceId':_0x13cbe0},'cascade':!![],'transaction':_0x38ca42})['then'](function(){_0x21a21a[_0x7a4b('0x21')](0xcc)[_0x7a4b('0x70')]();});}})['catch'](function(_0x228f4a){_0x21a21a[_0x7a4b('0x21')](0x1f4)['send'](_0x228f4a);});});};exports[_0x7a4b('0x71')]=function(_0x1805c7,_0x4554ba,_0x4950c9){return db['Team']['findOne']({'where':{'id':_0x1805c7[_0x7a4b('0x72')]['id']}})['then'](handleEntityNotFound(_0x4554ba,null))[_0x7a4b('0x2a')](function(_0x51b2b8){if(!_0x1805c7[_0x7a4b('0x34')]['channel']||!utils[_0x7a4b('0x73')](_0x1805c7[_0x7a4b('0x34')]['channel'])){throw new db[(_0x7a4b('0x59'))][(_0x7a4b('0x74'))]('Unknown\x20channel');}var _0x564b9b={};var _0x4c44ff={};_0x4c44ff[_0x7a4b('0x33')]=_[_0x7a4b('0x35')](db[_[_0x7a4b('0x75')](_0x1805c7['query'][_0x7a4b('0x76')][_0x7a4b('0x77')]())+'Queue'][_0x7a4b('0x31')]);_0x4c44ff[_0x7a4b('0x34')]=_[_0x7a4b('0x35')](_0x1805c7['query']);_0x4c44ff[_0x7a4b('0x36')]=_[_0x7a4b('0x37')](_0x4c44ff[_0x7a4b('0x33')],_0x4c44ff['query']);_0x564b9b['attributes']=_['intersection'](_0x4c44ff[_0x7a4b('0x33')],qs[_0x7a4b('0x39')](_0x1805c7[_0x7a4b('0x34')][_0x7a4b('0x39')]));_0x564b9b['attributes']=_0x564b9b['attributes'][_0x7a4b('0x78')]?_0x564b9b['attributes']:_0x4c44ff[_0x7a4b('0x33')];_0x564b9b['limit']=qs[_0x7a4b('0x26')](_0x1805c7[_0x7a4b('0x34')]['limit']);_0x564b9b['offset']=qs[_0x7a4b('0x23')](_0x1805c7['query'][_0x7a4b('0x23')]);_0x564b9b[_0x7a4b('0x79')]=qs[_0x7a4b('0x7a')](_0x1805c7[_0x7a4b('0x34')]['sort']);_0x564b9b[_0x7a4b('0x3e')]=qs[_0x7a4b('0x36')](_[_0x7a4b('0x3c')](_0x1805c7['query'],_0x4c44ff[_0x7a4b('0x36')]));_0x564b9b=_[_0x7a4b('0x41')]({},_0x564b9b,_0x1805c7[_0x7a4b('0x42')]);return _0x51b2b8[_0x7a4b('0x4c')+_['capitalize'](_0x1805c7['query']['channel']['toLowerCase']())+'Queues'](_0x564b9b);})['then'](respondWithResult(_0x4554ba,null))[_0x7a4b('0x47')](handleError(_0x4554ba,null));};exports['addQueues']=function(_0x366e0f,_0x166e75,_0x2526b1){return db['Team'][_0x7a4b('0x7b')]({'where':{'id':_0x366e0f[_0x7a4b('0x72')]['id']}})[_0x7a4b('0x2a')](function(_0x2000ea){if(_0x2000ea){if(!_0x366e0f[_0x7a4b('0x55')]['channel']||!utils[_0x7a4b('0x73')](_0x366e0f[_0x7a4b('0x55')][_0x7a4b('0x76')])){throw new db[(_0x7a4b('0x59'))][(_0x7a4b('0x74'))]('Unknown\x20channel');}return _0x2000ea[_0x7a4b('0x7c')+_[_0x7a4b('0x75')](_0x366e0f[_0x7a4b('0x55')][_0x7a4b('0x76')][_0x7a4b('0x77')]())+_0x7a4b('0x7d')](_0x366e0f[_0x7a4b('0x55')][_0x7a4b('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x166e75,null))[_0x7a4b('0x2a')](respondWithStatusCode(_0x166e75,null))['catch'](handleError(_0x166e75,null));};exports['removeQueues']=function(_0x10e702,_0x128b05,_0x56e657){return db[_0x7a4b('0x30')][_0x7a4b('0x7b')]({'where':{'id':_0x10e702['params']['id']}})[_0x7a4b('0x2a')](function(_0x565f49){if(_0x565f49){if(!_0x10e702['query'][_0x7a4b('0x76')]||!utils[_0x7a4b('0x73')](_0x10e702[_0x7a4b('0x34')][_0x7a4b('0x76')])){throw new db[(_0x7a4b('0x59'))][(_0x7a4b('0x74'))](_0x7a4b('0x7f'));}return _0x565f49[_0x7a4b('0x80')+_[_0x7a4b('0x75')](_0x10e702[_0x7a4b('0x34')][_0x7a4b('0x76')][_0x7a4b('0x77')]())+'Queues'](_0x10e702['query'][_0x7a4b('0x7e')]);}return null;})[_0x7a4b('0x2a')](handleEntityNotFound(_0x128b05,null))[_0x7a4b('0x2a')](respondWithStatusCode(_0x128b05,null))[_0x7a4b('0x47')](handleError(_0x128b05,null));};exports[_0x7a4b('0x81')]=function(_0x53944e,_0x459377){var _0x2355f9=_[_0x7a4b('0x82')](_0x53944e['body']['ids'])?_0x53944e[_0x7a4b('0x55')]['ids']:[_0x53944e[_0x7a4b('0x55')][_0x7a4b('0x7e')]];var _0x504905=_0x53944e[_0x7a4b('0x72')]['id'];return db[_0x7a4b('0x30')]['find']({'where':{'id':_0x504905}})[_0x7a4b('0x2a')](handleEntityNotFound(_0x459377,null))[_0x7a4b('0x2a')](function(_0x548f32){if(_0x548f32){var _0x25045d=['Voice',_0x7a4b('0x83'),'Mail',_0x7a4b('0x84'),_0x7a4b('0x85'),_0x7a4b('0x86'),_0x7a4b('0x87')];return db[_0x7a4b('0x57')][_0x7a4b('0x88')](function(_0x3f4307){var _0x12ad0c=_['map'](_0x25045d,function(_0x383e5e){var _0xaf126d={'attributes':['id',_0x7a4b('0x2c')]};if(_0x383e5e===_0x7a4b('0x89')){_0xaf126d['through']={'attributes':[_0x7a4b('0x8a')]};}return _0x548f32[_0x7a4b('0x4c')+_0x383e5e+'Queues'](_0xaf126d)['then'](function(_0x485e45){var _0x4dcecb=_[_0x7a4b('0x2f')](_0x485e45,function(_0x4ac38e){var _0x49f06b=_[_0x7a4b('0x2f')](_0x2355f9,function(_0x81236f){var _0x29114e={'where':{'UserId':_0x81236f,[_0x383e5e+_0x7a4b('0x8b')]:_0x4ac38e['id']},'transaction':_0x3f4307};if(_0x383e5e===_0x7a4b('0x89')){_0x29114e[_0x7a4b('0x1a')]={'penalty':_0x4ac38e[_0x7a4b('0x8c')]['penalty']};}return db[_0x7a4b('0x8d')+_0x383e5e+_0x7a4b('0x8e')][_0x7a4b('0x8f')](_0x29114e)[_0x7a4b('0x2a')](function(){socket['emit'](_0x7a4b('0x4b')+_0x383e5e+_0x7a4b('0x90'),{'UserId':_0x81236f,[_0x383e5e+_0x7a4b('0x8b')]:_0x4ac38e['id']});if(_0x383e5e!==_0x7a4b('0x89')){return;}return db[_0x7a4b('0x8d')][_0x7a4b('0x45')]({'where':{'id':_0x2355f9,'online':0x1},'attributes':['id',_0x7a4b('0x2c'),'online',_0x7a4b('0x91'),_0x7a4b('0x92')],'raw':!![]})[_0x7a4b('0x2a')](function(_0x329654){var _0x7efc92=_[_0x7a4b('0x2f')](_0x329654,function(_0x4b1c26){return db[_0x7a4b('0x93')]['upsert']({'membername':_0x4b1c26[_0x7a4b('0x2c')],'UserId':_0x4b1c26['id'],'queue_name':_0x4ac38e[_0x7a4b('0x2c')],'VoiceQueueId':_0x4ac38e['id'],'interface':_[_0x7a4b('0x94')](_0x4b1c26[_0x7a4b('0x92')])?util[_0x7a4b('0x95')](_0x7a4b('0x96'),_0x4b1c26[_0x7a4b('0x2c')]):_0x4b1c26['interface'],'paused':_0x4b1c26['voicePause']||![],'penalty':_0x4ac38e[_0x7a4b('0x8c')]['penalty']},{'transaction':_0x3f4307});});return Promise[_0x7a4b('0x97')](_0x7efc92);});});});return Promise['all'](_0x49f06b);});return Promise[_0x7a4b('0x97')](_0x4dcecb);})[_0x7a4b('0x2a')](function(){return db[_0x7a4b('0x6d')][_0x7a4b('0x7b')]({'where':{'teamId':_0x504905}})[_0x7a4b('0x2a')](function(_0x2023f9){if(_0x2023f9){var _0x20ada4=_[_0x7a4b('0x2f')](_0x2355f9,function(_0x57847d){db[_0x7a4b('0x6e')]['upsert']({'UserId':_0x57847d,'VoicePrefixId':_0x2023f9[_0x7a4b('0x6f')]});});return Promise[_0x7a4b('0x97')](_0x20ada4);}});});});return Promise[_0x7a4b('0x97')](_0x12ad0c)[_0x7a4b('0x2a')](function(){return _0x548f32[_0x7a4b('0x81')](_0x2355f9,{'transaction':_0x3f4307})['spread'](function(_0x5c23a7){return _0x5c23a7;});});});}})[_0x7a4b('0x2a')](respondWithResult(_0x459377,null))[_0x7a4b('0x47')](handleError(_0x459377,null));};exports[_0x7a4b('0x98')]=function(_0x447e91,_0x44b20c){var _0xc019f6=_[_0x7a4b('0x82')](_0x447e91['query'][_0x7a4b('0x7e')])?_0x447e91[_0x7a4b('0x34')][_0x7a4b('0x7e')]:[_0x447e91[_0x7a4b('0x34')][_0x7a4b('0x7e')]];var _0x1b4f07=_0x447e91['params']['id'];return db['Team'][_0x7a4b('0x49')]({'where':{'id':_0x1b4f07}})['then'](handleEntityNotFound(_0x44b20c,null))[_0x7a4b('0x2a')](function(_0x35d3f9){if(_0x35d3f9){var _0x41d061=[_0x7a4b('0x89'),'Chat',_0x7a4b('0x99'),_0x7a4b('0x84'),_0x7a4b('0x85'),'Openchannel',_0x7a4b('0x87')];return db['sequelize'][_0x7a4b('0x88')](function(_0x23e76f){var _0x57120c=_[_0x7a4b('0x2f')](_0x41d061,function(_0x200831){var _0x7699a3={'attributes':['id',_0x7a4b('0x2c')]};return _0x35d3f9[_0x7a4b('0x4c')+_0x200831+_0x7a4b('0x7d')](_0x7699a3)['then'](function(_0x3bf703){var _0x1ab8a7=_[_0x7a4b('0x2f')](_0x3bf703,function(_0xc7324b){return _0xc7324b[_0x7a4b('0x98')](_0xc019f6,{'transaction':_0x23e76f})[_0x7a4b('0x2a')](function(){var _0x51a786=_[_0x7a4b('0x2f')](_0xc019f6,function(_0x42af14){socket[_0x7a4b('0x9a')](_0x7a4b('0x4b')+_0x200831+_0x7a4b('0x9b'),{'UserId':Number(_0x42af14),[_0x200831+_0x7a4b('0x8b')]:_0xc7324b['id']});if(_0x200831!==_0x7a4b('0x89')){return;}return db[_0x7a4b('0x93')][_0x7a4b('0x56')]({'where':{'VoiceQueueId':_0xc7324b['id'],'UserId':_0x42af14},'transaction':_0x23e76f});});return Promise[_0x7a4b('0x97')](_0x51a786);});});return Promise[_0x7a4b('0x97')](_0x1ab8a7);});});return Promise[_0x7a4b('0x97')](_0x57120c)[_0x7a4b('0x2a')](function(){return _0x35d3f9[_0x7a4b('0x98')](_0xc019f6,{'transaction':_0x23e76f});})[_0x7a4b('0x2a')](function(){return db['TeamVoicePrefix'][_0x7a4b('0x7b')]({'where':{'teamId':_0x1b4f07}})['then'](function(_0x53e66d){if(_0x53e66d){var _0x444826=_[_0x7a4b('0x2f')](_0xc019f6,function(_0x35e32c){db[_0x7a4b('0x6e')][_0x7a4b('0x56')]({'where':{'UserId':_0x35e32c,'VoicePrefixId':_0x53e66d[_0x7a4b('0x6f')]}});});return Promise[_0x7a4b('0x97')](_0x444826);}});});});}})[_0x7a4b('0x2a')](respondWithStatusCode(_0x44b20c,null))[_0x7a4b('0x47')](handleError(_0x44b20c,null));};exports[_0x7a4b('0x9c')]=function(_0x7237e8,_0x368248,_0x39ea1c){var _0x31a8a9={};var _0x1e6a25={};var _0x123890;var _0x4f25aa;return db[_0x7a4b('0x30')][_0x7a4b('0x7b')]({'where':{'id':_0x7237e8[_0x7a4b('0x72')]['id']}})[_0x7a4b('0x2a')](handleEntityNotFound(_0x368248,null))['then'](function(_0x2acf65){if(_0x2acf65){_0x123890=_0x2acf65;_0x1e6a25['model']=_[_0x7a4b('0x35')](db[_0x7a4b('0x8d')]['rawAttributes']);_0x1e6a25[_0x7a4b('0x34')]=_['keys'](_0x7237e8[_0x7a4b('0x34')]);_0x1e6a25[_0x7a4b('0x36')]=_['intersection'](_0x1e6a25[_0x7a4b('0x33')],_0x1e6a25[_0x7a4b('0x34')]);_0x31a8a9[_0x7a4b('0x38')]=_[_0x7a4b('0x37')](_0x1e6a25['model'],qs['fields'](_0x7237e8[_0x7a4b('0x34')]['fields']));_0x31a8a9['attributes']=_0x31a8a9[_0x7a4b('0x38')][_0x7a4b('0x78')]?_0x31a8a9[_0x7a4b('0x38')]:_0x1e6a25[_0x7a4b('0x33')];_0x31a8a9[_0x7a4b('0x79')]=qs[_0x7a4b('0x7a')](_0x7237e8[_0x7a4b('0x34')][_0x7a4b('0x7a')]);_0x31a8a9[_0x7a4b('0x3e')]=qs[_0x7a4b('0x36')](_[_0x7a4b('0x3c')](_0x7237e8[_0x7a4b('0x34')],_0x1e6a25[_0x7a4b('0x36')]));if(_0x7237e8['query'][_0x7a4b('0x3d')]){_0x31a8a9['where']=_[_0x7a4b('0x41')](_0x31a8a9[_0x7a4b('0x3e')],{'$or':_['map'](_0x31a8a9[_0x7a4b('0x38')],function(_0x1ee402){var _0xe02628={};_0xe02628[_0x1ee402]={'$like':'%'+_0x7237e8[_0x7a4b('0x34')]['filter']+'%'};return _0xe02628;})});}_0x31a8a9=_[_0x7a4b('0x41')]({},_0x31a8a9,_0x7237e8[_0x7a4b('0x42')]);return _0x123890[_0x7a4b('0x9c')](_0x31a8a9);}})[_0x7a4b('0x2a')](function(_0x3d796c){if(_0x3d796c){_0x4f25aa=_0x3d796c['length'];if(!_0x7237e8[_0x7a4b('0x34')]['hasOwnProperty'](_0x7a4b('0x3b'))){_0x31a8a9['limit']=qs[_0x7a4b('0x26')](_0x7237e8[_0x7a4b('0x34')]['limit']);_0x31a8a9['offset']=qs['offset'](_0x7237e8[_0x7a4b('0x34')][_0x7a4b('0x23')]);}return _0x123890['getAgents'](_0x31a8a9);}})[_0x7a4b('0x2a')](function(_0x87ce3c){if(_0x87ce3c){return _0x87ce3c?{'count':_0x4f25aa,'rows':_0x87ce3c}:null;}})[_0x7a4b('0x2a')](respondWithResult(_0x368248,null))[_0x7a4b('0x47')](handleError(_0x368248,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b2168ac..5b88404 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 _0x1b1a=['setMaxListeners','update','hook','exports','events','../../mysqldb'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x1b1a,0xa0));var _0xa1b1=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x1b1a[_0x12a2a6];return _0x1754ae;};'use strict';var EventEmitter=require(_0xa1b1('0x0'));var Team=require(_0xa1b1('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xa1b1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1362fe){return function(_0x33190e,_0x474169,_0x442882){TeamEvents['emit'](_0x1362fe+':'+_0x33190e['id'],_0x33190e);TeamEvents['emit'](_0x1362fe,_0x33190e);_0x442882(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xa1b1('0x4')](e,emitEvent(event));}}module[_0xa1b1('0x5')]=TeamEvents; \ No newline at end of file +var _0xf825=['update','remove','emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf825,0x9d));var _0x5f82=function(_0x4b2974,_0x4b377e){_0x4b2974=_0x4b2974-0x0;var _0x3326f6=_0xf825[_0x4b2974];return _0x3326f6;};'use strict';var EventEmitter=require(_0x5f82('0x0'));var Team=require(_0x5f82('0x1'))['db'][_0x5f82('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5f82('0x3')](0x0);var events={'afterCreate':_0x5f82('0x4'),'afterUpdate':_0x5f82('0x5'),'afterDestroy':_0x5f82('0x6')};function emitEvent(_0x4d488e){return function(_0x33e2a1,_0x479838,_0x2dc542){TeamEvents[_0x5f82('0x7')](_0x4d488e+':'+_0x33e2a1['id'],_0x33e2a1);TeamEvents[_0x5f82('0x7')](_0x4d488e,_0x33e2a1);_0x2dc542(null);};}for(var e in events){if(events[_0x5f82('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 9f5e108..8b3fee1 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 _0x7191=['../../config/environment','./team.attributes','exports','define','Team','teams','util','api','moment','bluebird','path','rimraf'];(function(_0x16b69a,_0x5b33f4){var _0x398084=function(_0x57c37e){while(--_0x57c37e){_0x16b69a['push'](_0x16b69a['shift']());}};_0x398084(++_0x5b33f4);}(_0x7191,0x1ce));var _0x1719=function(_0xefb84a,_0x217c3e){_0xefb84a=_0xefb84a-0x0;var _0x1ecff9=_0x7191[_0xefb84a];return _0x1ecff9;};'use strict';var _=require('lodash');var util=require(_0x1719('0x0'));var logger=require('../../config/logger')(_0x1719('0x1'));var moment=require(_0x1719('0x2'));var BPromise=require(_0x1719('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1719('0x4'));var rimraf=require(_0x1719('0x5'));var config=require(_0x1719('0x6'));var attributes=require(_0x1719('0x7'));module[_0x1719('0x8')]=function(_0x4fc8e3,_0x461c5f){return _0x4fc8e3[_0x1719('0x9')](_0x1719('0xa'),attributes,{'tableName':_0x1719('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d31=['path','rimraf','./team.attributes','Team','teams','lodash','api','bluebird','request-promise'];(function(_0x499ea4,_0x254251){var _0x154ea3=function(_0x5b651f){while(--_0x5b651f){_0x499ea4['push'](_0x499ea4['shift']());}};_0x154ea3(++_0x254251);}(_0x6d31,0x83));var _0x16d3=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6d31[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x16d3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x16d3('0x1'));var moment=require('moment');var BPromise=require(_0x16d3('0x2'));var rp=require(_0x16d3('0x3'));var fs=require('fs');var path=require(_0x16d3('0x4'));var rimraf=require(_0x16d3('0x5'));var config=require('../../config/environment');var attributes=require(_0x16d3('0x6'));module['exports']=function(_0x38aef0,_0x55d134){return _0x38aef0['define'](_0x16d3('0x7'),attributes,{'tableName':_0x16d3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b93d88d..4552286 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 _0x342d=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./team.socket','request','then','info','request\x20sent','debug'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x342d,0x197));var _0xd342=function(_0x4e8af0,_0x5b6bd2){_0x4e8af0=_0x4e8af0-0x0;var _0x41e6c7=_0x342d[_0x4e8af0];return _0x41e6c7;};'use strict';var _=require(_0xd342('0x0'));var util=require(_0xd342('0x1'));var moment=require('moment');var BPromise=require(_0xd342('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd342('0x3'))['db'];var utils=require(_0xd342('0x4'));var logger=require(_0xd342('0x5'))(_0xd342('0x6'));var config=require(_0xd342('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd342('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xd342('0x9')],{'host':_0xd342('0xa'),'port':0x18eb});var socket=require(_0xd342('0xb'))(new Redis(config['redis']));require(_0xd342('0xc'))['register'](socket);function respondWithRpcPromise(_0x47e339,_0x5cdd6d,_0x33cc4a){return new BPromise(function(_0x24c572,_0x2162b0){return client[_0xd342('0xd')](_0x47e339,_0x33cc4a)[_0xd342('0xe')](function(_0x4cd7ba){logger[_0xd342('0xf')]('Team,\x20%s,\x20%s',_0x5cdd6d,_0xd342('0x10'));logger[_0xd342('0x11')](_0xd342('0x12'),_0x5cdd6d,_0xd342('0x10'),JSON[_0xd342('0x13')](_0x4cd7ba));if(_0x4cd7ba[_0xd342('0x14')]){if(_0x4cd7ba[_0xd342('0x14')][_0xd342('0x15')]===0x1f4){logger[_0xd342('0x14')](_0xd342('0x16'),_0x5cdd6d,_0x4cd7ba[_0xd342('0x14')][_0xd342('0x17')]);return _0x2162b0(_0x4cd7ba[_0xd342('0x14')][_0xd342('0x17')]);}logger[_0xd342('0x14')]('Team,\x20%s,\x20%s',_0x5cdd6d,_0x4cd7ba[_0xd342('0x14')][_0xd342('0x17')]);return _0x24c572(_0x4cd7ba[_0xd342('0x14')][_0xd342('0x17')]);}else{logger[_0xd342('0xf')](_0xd342('0x16'),_0x5cdd6d,_0xd342('0x10'));_0x24c572(_0x4cd7ba[_0xd342('0x18')][_0xd342('0x17')]);}})['catch'](function(_0x3d26ab){logger[_0xd342('0x14')](_0xd342('0x16'),_0x5cdd6d,_0x3d26ab);_0x2162b0(_0x3d26ab);});});} \ No newline at end of file +var _0x97f9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x97f9,0x10d));var _0x997f=function(_0x203faa,_0x87a9f5){_0x203faa=_0x203faa-0x0;var _0x5cefad=_0x97f9[_0x203faa];return _0x5cefad;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var moment=require(_0x997f('0x2'));var BPromise=require(_0x997f('0x3'));var rs=require(_0x997f('0x4'));var fs=require('fs');var Redis=require(_0x997f('0x5'));var db=require(_0x997f('0x6'))['db'];var utils=require(_0x997f('0x7'));var logger=require(_0x997f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x997f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x997f('0xa')],{'host':_0x997f('0xb'),'port':0x18eb});var socket=require(_0x997f('0xc'))(new Redis(config[_0x997f('0xa')]));require(_0x997f('0xd'))[_0x997f('0xe')](socket);function respondWithRpcPromise(_0x5ee419,_0x4231e8,_0x3499b0){return new BPromise(function(_0x271278,_0x169633){return client[_0x997f('0xf')](_0x5ee419,_0x3499b0)[_0x997f('0x10')](function(_0x1ba7f1){logger[_0x997f('0x11')](_0x997f('0x12'),_0x4231e8,_0x997f('0x13'));logger['debug'](_0x997f('0x14'),_0x4231e8,'request\x20sent',JSON[_0x997f('0x15')](_0x1ba7f1));if(_0x1ba7f1[_0x997f('0x16')]){if(_0x1ba7f1['error'][_0x997f('0x17')]===0x1f4){logger[_0x997f('0x16')](_0x997f('0x12'),_0x4231e8,_0x1ba7f1[_0x997f('0x16')][_0x997f('0x18')]);return _0x169633(_0x1ba7f1['error'][_0x997f('0x18')]);}logger[_0x997f('0x16')]('Team,\x20%s,\x20%s',_0x4231e8,_0x1ba7f1[_0x997f('0x16')]['message']);return _0x271278(_0x1ba7f1['error'][_0x997f('0x18')]);}else{logger[_0x997f('0x11')](_0x997f('0x12'),_0x4231e8,_0x997f('0x13'));_0x271278(_0x1ba7f1[_0x997f('0x19')][_0x997f('0x18')]);}})[_0x997f('0x1a')](function(_0x579f7a){logger['error'](_0x997f('0x12'),_0x4231e8,_0x579f7a);_0x169633(_0x579f7a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f0428e7..3b32006 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 _0x9ba6=['removeListener','register','length','./team.events','remove','emit'];(function(_0x2f710d,_0x390dca){var _0x3f30eb=function(_0xc2ab33){while(--_0xc2ab33){_0x2f710d['push'](_0x2f710d['shift']());}};_0x3f30eb(++_0x390dca);}(_0x9ba6,0x13b));var _0x69ba=function(_0x5b2a4f,_0x4877ca){_0x5b2a4f=_0x5b2a4f-0x0;var _0x222e3d=_0x9ba6[_0x5b2a4f];return _0x222e3d;};'use strict';var TeamEvents=require(_0x69ba('0x0'));var events=['save',_0x69ba('0x1'),'update'];function createListener(_0x303457,_0x4e0753){return function(_0x2fecca){_0x4e0753[_0x69ba('0x2')](_0x303457,_0x2fecca);};}function removeListener(_0x484d94,_0x4a0d0d){return function(){TeamEvents[_0x69ba('0x3')](_0x484d94,_0x4a0d0d);};}exports[_0x69ba('0x4')]=function(_0x17605f){for(var _0x405fe5=0x0,_0x205050=events[_0x69ba('0x5')];_0x405fe5<_0x205050;_0x405fe5++){var _0x25bb08=events[_0x405fe5];var _0xed91=createListener('team:'+_0x25bb08,_0x17605f);TeamEvents['on'](_0x25bb08,_0xed91);}}; \ No newline at end of file +var _0xdd6b=['update','emit','register','team:','./team.events','save','remove'];(function(_0x5256ed,_0x8d8227){var _0x342e59=function(_0x40d01b){while(--_0x40d01b){_0x5256ed['push'](_0x5256ed['shift']());}};_0x342e59(++_0x8d8227);}(_0xdd6b,0x19a));var _0xbdd6=function(_0x4fa2ec,_0x35a03f){_0x4fa2ec=_0x4fa2ec-0x0;var _0x1eede3=_0xdd6b[_0x4fa2ec];return _0x1eede3;};'use strict';var TeamEvents=require(_0xbdd6('0x0'));var events=[_0xbdd6('0x1'),_0xbdd6('0x2'),_0xbdd6('0x3')];function createListener(_0xe26748,_0x53e981){return function(_0x393606){_0x53e981[_0xbdd6('0x4')](_0xe26748,_0x393606);};}function removeListener(_0x1543de,_0x44542c){return function(){TeamEvents['removeListener'](_0x1543de,_0x44542c);};}exports[_0xbdd6('0x5')]=function(_0x5510ed){for(var _0x28a5d9=0x0,_0x441c1a=events['length'];_0x28a5d9<_0x441c1a;_0x28a5d9++){var _0x578c67=events[_0x28a5d9];var _0x708e55=createListener(_0xbdd6('0x6')+_0x578c67,_0x5510ed);TeamEvents['on'](_0x578c67,_0x708e55);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 8101ad4..d04ecdc 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 _0x9789=['INTEGER','sequelize','exports'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x9789,0xc7));var _0x9978=function(_0x965817,_0x4fe0d4){_0x965817=_0x965817-0x0;var _0x1fdbe6=_0x9789[_0x965817];return _0x1fdbe6;};'use strict';var Sequelize=require(_0x9978('0x0'));module[_0x9978('0x1')]={'TeamId':{'type':Sequelize[_0x9978('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc015=['sequelize','exports','INTEGER'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc015,0x81));var _0x5c01=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0xc015[_0x3fd3a3];return _0xa3e4d5;};'use strict';var Sequelize=require(_0x5c01('0x0'));module[_0x5c01('0x1')]={'TeamId':{'type':Sequelize[_0x5c01('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5c01('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f72cec4..1900e2a 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 _0x180d=['moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api'];(function(_0x3f619d,_0x4762c5){var _0x1eb364=function(_0x407268){while(--_0x407268){_0x3f619d['push'](_0x3f619d['shift']());}};_0x1eb364(++_0x4762c5);}(_0x180d,0xf9));var _0xd180=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x180d[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var logger=require(_0xd180('0x1'))(_0xd180('0x2'));var moment=require(_0xd180('0x3'));var BPromise=require(_0xd180('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd180('0x5'));var rimraf=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var attributes=require(_0xd180('0x8'));module[_0xd180('0x9')]=function(_0x44cf0b,_0x570b44){return _0x44cf0b['define'](_0xd180('0xa'),attributes,{'tableName':_0xd180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdca3=['../../config/environment','./teamVoicePrefix.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0xdca3,0x64));var _0x3dca=function(_0x29ebba,_0x102c5e){_0x29ebba=_0x29ebba-0x0;var _0x4773ef=_0xdca3[_0x29ebba];return _0x4773ef;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var logger=require(_0x3dca('0x1'))(_0x3dca('0x2'));var moment=require(_0x3dca('0x3'));var BPromise=require(_0x3dca('0x4'));var rp=require(_0x3dca('0x5'));var fs=require('fs');var path=require(_0x3dca('0x6'));var rimraf=require(_0x3dca('0x7'));var config=require(_0x3dca('0x8'));var attributes=require(_0x3dca('0x9'));module[_0x3dca('0xa')]=function(_0x3e2811,_0x5cfa9a){return _0x3e2811[_0x3dca('0xb')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 13d96b5..dda0230 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x10ac02,_0x1a5f35){var _0x149b0d=function(_0x22290e){while(--_0x22290e){_0x10ac02['push'](_0x10ac02['shift']());}};_0x149b0d(++_0x1a5f35);}(_0xedd9,0xfc));var _0x9edd=function(_0x2db221,_0x5d798f){_0x2db221=_0x2db221-0x0;var _0x2de1ff=_0xedd9[_0x2db221];return _0x2de1ff;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xcd05e7,_0x1ef5c3){var _0x4220b1=function(_0x18c22f){while(--_0x18c22f){_0xcd05e7['push'](_0xcd05e7['shift']());}};_0x4220b1(++_0x1ef5c3);}(_0xe706,0xa3));var _0x6e70=function(_0xdbfe11,_0x5cfa1e){_0xdbfe11=_0xdbfe11-0x0;var _0x28438d=_0xe706[_0xdbfe11];return _0x28438d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 57d6e4d..b3e3b95 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 _0xab8f=['exports','INTEGER','sequelize'];(function(_0x15cb09,_0x28aede){var _0x4ba2f5=function(_0x437dbd){while(--_0x437dbd){_0x15cb09['push'](_0x15cb09['shift']());}};_0x4ba2f5(++_0x28aede);}(_0xab8f,0x7d));var _0xfab8=function(_0x4da82d,_0x20b3a9){_0x4da82d=_0x4da82d-0x0;var _0xea6619=_0xab8f[_0x4da82d];return _0xea6619;};'use strict';var Sequelize=require(_0xfab8('0x0'));module[_0xfab8('0x1')]={'penalty':{'type':Sequelize[_0xfab8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x325c=['exports','INTEGER','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x325c,0x1b5));var _0xc325=function(_0x35feb0,_0x2253d4){_0x35feb0=_0x35feb0-0x0;var _0x4da52a=_0x325c[_0x35feb0];return _0x4da52a;};'use strict';var Sequelize=require(_0xc325('0x0'));module[_0xc325('0x1')]={'penalty':{'type':Sequelize[_0xc325('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 60a36b2..5915624 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 _0x885e=['api','moment','bluebird','request-promise','path','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','lodash','util'];(function(_0x1298dc,_0x50fd8a){var _0x5983b1=function(_0x392138){while(--_0x392138){_0x1298dc['push'](_0x1298dc['shift']());}};_0x5983b1(++_0x50fd8a);}(_0x885e,0xe4));var _0xe885=function(_0x571628,_0x36ddc1){_0x571628=_0x571628-0x0;var _0x10a232=_0x885e[_0x571628];return _0x10a232;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var logger=require('../../config/logger')(_0xe885('0x2'));var moment=require(_0xe885('0x3'));var BPromise=require(_0xe885('0x4'));var rp=require(_0xe885('0x5'));var fs=require('fs');var path=require(_0xe885('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe885('0x7'));module[_0xe885('0x8')]=function(_0x33286a,_0x1a5fd6){return _0x33286a['define'](_0xe885('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb28a=['moment','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','util','../../config/logger'];(function(_0x42968e,_0x3bea04){var _0xe76974=function(_0x2115a1){while(--_0x2115a1){_0x42968e['push'](_0x42968e['shift']());}};_0xe76974(++_0x3bea04);}(_0xb28a,0x166));var _0xab28=function(_0x596334,_0x3c6a08){_0x596334=_0x596334-0x0;var _0xa8ec7b=_0xb28a[_0x596334];return _0xa8ec7b;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var logger=require(_0xab28('0x1'))('api');var moment=require(_0xab28('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab28('0x3'));var config=require(_0xab28('0x4'));var attributes=require(_0xab28('0x5'));module[_0xab28('0x6')]=function(_0x133169,_0x128a13){return _0x133169[_0xab28('0x7')](_0xab28('0x8'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 082999a..da40b18 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 _0x710e=['../../config/environment','jayson/promise','client','http','request','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3bb81e,_0x52b928){var _0x4ed494=function(_0x207002){while(--_0x207002){_0x3bb81e['push'](_0x3bb81e['shift']());}};_0x4ed494(++_0x52b928);}(_0x710e,0x1b9));var _0xe710=function(_0x259214,_0x2e2db5){_0x259214=_0x259214-0x0;var _0x15aa79=_0x710e[_0x259214];return _0x15aa79;};'use strict';var _=require(_0xe710('0x0'));var util=require(_0xe710('0x1'));var moment=require(_0xe710('0x2'));var BPromise=require(_0xe710('0x3'));var rs=require(_0xe710('0x4'));var fs=require('fs');var Redis=require(_0xe710('0x5'));var db=require(_0xe710('0x6'))['db'];var utils=require(_0xe710('0x7'));var logger=require('../../config/logger')(_0xe710('0x8'));var config=require(_0xe710('0x9'));var jayson=require(_0xe710('0xa'));var client=jayson[_0xe710('0xb')][_0xe710('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x349f36,_0x50dffa,_0x1c5e35){return new BPromise(function(_0x4c3e88,_0x3e5ee6){return client[_0xe710('0xd')](_0x349f36,_0x1c5e35)['then'](function(_0x536edd){logger[_0xe710('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x50dffa,'request\x20sent');logger[_0xe710('0xf')](_0xe710('0x10'),_0x50dffa,_0xe710('0x11'),JSON[_0xe710('0x12')](_0x536edd));if(_0x536edd[_0xe710('0x13')]){if(_0x536edd[_0xe710('0x13')][_0xe710('0x14')]===0x1f4){logger[_0xe710('0x13')](_0xe710('0x15'),_0x50dffa,_0x536edd[_0xe710('0x13')]['message']);return _0x3e5ee6(_0x536edd[_0xe710('0x13')]['message']);}logger['error'](_0xe710('0x15'),_0x50dffa,_0x536edd[_0xe710('0x13')][_0xe710('0x16')]);return _0x4c3e88(_0x536edd[_0xe710('0x13')]['message']);}else{logger['info'](_0xe710('0x15'),_0x50dffa,_0xe710('0x11'));_0x4c3e88(_0x536edd[_0xe710('0x17')]['message']);}})[_0xe710('0x18')](function(_0x54cfa8){logger['error'](_0xe710('0x15'),_0x50dffa,_0x54cfa8);_0x3e5ee6(_0x54cfa8);});});} \ No newline at end of file +var _0xcf84=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xcf84,0x175));var _0x4cf8=function(_0x2cf733,_0x194b88){_0x2cf733=_0x2cf733-0x0;var _0x57d504=_0xcf84[_0x2cf733];return _0x57d504;};'use strict';var _=require(_0x4cf8('0x0'));var util=require(_0x4cf8('0x1'));var moment=require(_0x4cf8('0x2'));var BPromise=require(_0x4cf8('0x3'));var rs=require(_0x4cf8('0x4'));var fs=require('fs');var Redis=require(_0x4cf8('0x5'));var db=require(_0x4cf8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4cf8('0x7'))('rpc');var config=require(_0x4cf8('0x8'));var jayson=require(_0x4cf8('0x9'));var client=jayson[_0x4cf8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c25ae,_0x2002cc,_0x4755cd){return new BPromise(function(_0x4ea833,_0x2ca70f){return client[_0x4cf8('0xb')](_0x5c25ae,_0x4755cd)[_0x4cf8('0xc')](function(_0x1f490d){logger[_0x4cf8('0xd')](_0x4cf8('0xe'),_0x2002cc,_0x4cf8('0xf'));logger[_0x4cf8('0x10')](_0x4cf8('0x11'),_0x2002cc,'request\x20sent',JSON[_0x4cf8('0x12')](_0x1f490d));if(_0x1f490d[_0x4cf8('0x13')]){if(_0x1f490d[_0x4cf8('0x13')][_0x4cf8('0x14')]===0x1f4){logger[_0x4cf8('0x13')](_0x4cf8('0xe'),_0x2002cc,_0x1f490d[_0x4cf8('0x13')][_0x4cf8('0x15')]);return _0x2ca70f(_0x1f490d[_0x4cf8('0x13')][_0x4cf8('0x15')]);}logger[_0x4cf8('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2002cc,_0x1f490d[_0x4cf8('0x13')][_0x4cf8('0x15')]);return _0x4ea833(_0x1f490d['error']['message']);}else{logger[_0x4cf8('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2002cc,_0x4cf8('0xf'));_0x4ea833(_0x1f490d[_0x4cf8('0x16')]['message']);}})['catch'](function(_0x5c556b){logger[_0x4cf8('0x13')](_0x4cf8('0xe'),_0x2002cc,_0x5c556b);_0x2ca70f(_0x5c556b);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 67fb85e..853ccf2 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 _0x0f97=['get','/:id','isAuthenticated','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index'];(function(_0x2d9095,_0x418890){var _0x2baa8e=function(_0x398e7c){while(--_0x398e7c){_0x2d9095['push'](_0x2d9095['shift']());}};_0x2baa8e(++_0x418890);}(_0x0f97,0x196));var _0x70f9=function(_0x3c43f6,_0x429058){_0x3c43f6=_0x3c43f6-0x0;var _0x5677a4=_0x0f97[_0x3c43f6];return _0x5677a4;};'use strict';var multer=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var path=require(_0x70f9('0x2'));var timeout=require(_0x70f9('0x3'));var express=require(_0x70f9('0x4'));var router=express[_0x70f9('0x5')]();var fs_extra=require(_0x70f9('0x6'));var auth=require(_0x70f9('0x7'));var interaction=require(_0x70f9('0x8'));var config=require(_0x70f9('0x9'));var controller=require(_0x70f9('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x70f9('0xb')]);router[_0x70f9('0xc')](_0x70f9('0xd'),auth[_0x70f9('0xe')](),controller['show']);router['post']('/',auth[_0x70f9('0xe')](),controller[_0x70f9('0xf')]);router[_0x70f9('0x10')](_0x70f9('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x70f9('0xe')](),controller[_0x70f9('0x11')]);module[_0x70f9('0x12')]=router; \ No newline at end of file +var _0x5fdc=['index','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0xf919f,_0x42830d){var _0x74d5b7=function(_0x5f5024){while(--_0x5f5024){_0xf919f['push'](_0xf919f['shift']());}};_0x74d5b7(++_0x42830d);}(_0x5fdc,0x127));var _0xc5fd=function(_0x2130f1,_0x1098c0){_0x2130f1=_0x2130f1-0x0;var _0x1d2f01=_0x5fdc[_0x2130f1];return _0x1d2f01;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5fd('0xe')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router[_0xc5fd('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc5fd('0x11')]);router[_0xc5fd('0x12')](_0xc5fd('0x13'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x14')]);module[_0xc5fd('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 2977a98..75166db 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 _0x250b=['TEXT','sequelize','exports','STRING'];(function(_0x329031,_0x51584b){var _0x52f346=function(_0x2d2bf4){while(--_0x2d2bf4){_0x329031['push'](_0x329031['shift']());}};_0x52f346(++_0x51584b);}(_0x250b,0xc1));var _0xb250=function(_0x454ef2,_0x2e15bb){_0x454ef2=_0x454ef2-0x0;var _0x4d8d4e=_0x250b[_0x454ef2];return _0x4d8d4e;};'use strict';var Sequelize=require(_0xb250('0x0'));module[_0xb250('0x1')]={'name':{'type':Sequelize[_0xb250('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb250('0x3')]}}; \ No newline at end of file +var _0xa61a=['STRING','sequelize','exports'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xa61a,0x169));var _0xaa61=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0xa61a[_0x299784];return _0x5ab008;};'use strict';var Sequelize=require(_0xaa61('0x0'));module[_0xaa61('0x1')]={'name':{'type':Sequelize[_0xaa61('0x2')]},'description':{'type':Sequelize[_0xaa61('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ff1c7b0..29125d7 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 _0xeb7f=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','Template','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x49e66,_0x43f4b9){var _0x545549=function(_0x18b28f){while(--_0x18b28f){_0x49e66['push'](_0x49e66['shift']());}};_0x545549(++_0x43f4b9);}(_0xeb7f,0x1df));var _0xfeb7=function(_0xef89d,_0x287047){_0xef89d=_0xef89d-0x0;var _0x23d599=_0xeb7f[_0xef89d];return _0x23d599;};'use strict';var emlformat=require(_0xfeb7('0x0'));var rimraf=require(_0xfeb7('0x1'));var zipdir=require(_0xfeb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfeb7('0x3'));var BPromise=require(_0xfeb7('0x4'));var Mustache=require(_0xfeb7('0x5'));var util=require('util');var path=require(_0xfeb7('0x6'));var sox=require('sox');var csv=require(_0xfeb7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfeb7('0x8'));var squel=require(_0xfeb7('0x9'));var crypto=require(_0xfeb7('0xa'));var jsforce=require(_0xfeb7('0xb'));var deskjs=require(_0xfeb7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfeb7('0xd'));var Papa=require(_0xfeb7('0xe'));var Redis=require(_0xfeb7('0xf'));var authService=require(_0xfeb7('0x10'));var qs=require(_0xfeb7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfeb7('0x12'));var logger=require(_0xfeb7('0x13'))(_0xfeb7('0x14'));var utils=require(_0xfeb7('0x15'));var config=require(_0xfeb7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfeb7('0x17'))['db'];function respondWithStatusCode(_0x382549,_0x3d7477){_0x3d7477=_0x3d7477||0xcc;return function(_0x2e9ffb){if(_0x2e9ffb){return _0x382549[_0xfeb7('0x18')](_0x3d7477);}return _0x382549[_0xfeb7('0x19')](_0x3d7477)['end']();};}function respondWithResult(_0x53a037,_0x328b53){_0x328b53=_0x328b53||0xc8;return function(_0x201718){if(_0x201718){return _0x53a037[_0xfeb7('0x19')](_0x328b53)[_0xfeb7('0x1a')](_0x201718);}};}function respondWithFilteredResult(_0x2017a0,_0x1c7861){return function(_0x310a3f){if(_0x310a3f){var _0x478c5c=typeof _0x1c7861[_0xfeb7('0x1b')]===_0xfeb7('0x1c')&&typeof _0x1c7861['limit']===_0xfeb7('0x1c');var _0x1899ff=_0x310a3f[_0xfeb7('0x1d')];var _0x2bb16b=_0x478c5c?0x0:_0x1c7861[_0xfeb7('0x1b')];var _0x1477ad=_0x478c5c?_0x310a3f[_0xfeb7('0x1d')]:_0x1c7861[_0xfeb7('0x1b')]+_0x1c7861[_0xfeb7('0x1e')];var _0x4cf6cc;if(_0x1477ad>=_0x1899ff){_0x1477ad=_0x1899ff;_0x4cf6cc=0xc8;}else{_0x4cf6cc=0xce;}_0x2017a0[_0xfeb7('0x19')](_0x4cf6cc);return _0x2017a0['set'](_0xfeb7('0x1f'),_0x2bb16b+'-'+_0x1477ad+'/'+_0x1899ff)[_0xfeb7('0x1a')](_0x310a3f);}return null;};}function patchUpdates(_0x4b6a40){return function(_0x58c5c7){try{jsonpatch[_0xfeb7('0x20')](_0x58c5c7,_0x4b6a40,!![]);}catch(_0x338e5d){return BPromise[_0xfeb7('0x21')](_0x338e5d);}return _0x58c5c7[_0xfeb7('0x22')]();};}function saveUpdates(_0x358424,_0x2824a1){return function(_0x257c7c){if(_0x257c7c){return _0x257c7c[_0xfeb7('0x23')](_0x358424)[_0xfeb7('0x24')](function(_0x343001){return _0x343001;});}return null;};}function removeEntity(_0x219c0a,_0x2f0c6e){return function(_0x2fc098){if(_0x2fc098){return _0x2fc098[_0xfeb7('0x25')]()[_0xfeb7('0x24')](function(){var _0x55c598=_0x2fc098[_0xfeb7('0x26')]({'plain':!![]});var _0x54162b=_0xfeb7('0x27');return db[_0xfeb7('0x28')][_0xfeb7('0x25')]({'where':{'type':_0x54162b,'resourceId':_0x55c598['id']}})[_0xfeb7('0x24')](function(){return _0x2fc098;});})[_0xfeb7('0x24')](function(){_0x219c0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a568,_0x34bb6e){return function(_0xae89c){if(!_0xae89c){_0x40a568[_0xfeb7('0x18')](0x194);}return _0xae89c;};}function handleError(_0x588db4,_0x263e6c){_0x263e6c=_0x263e6c||0x1f4;return function(_0x27a0ea){logger[_0xfeb7('0x29')](_0x27a0ea[_0xfeb7('0x2a')]);if(_0x27a0ea['name']){delete _0x27a0ea[_0xfeb7('0x2b')];}_0x588db4[_0xfeb7('0x19')](_0x263e6c)['send'](_0x27a0ea);};}exports[_0xfeb7('0x2c')]=function(_0x24a372,_0x141c1a){var _0xcf67ce={},_0x65a855={},_0x8b75cf={'count':0x0,'rows':[]};var _0x520d6d=_[_0xfeb7('0x2d')](db[_0xfeb7('0x2e')][_0xfeb7('0x2f')],function(_0x198792){return{'name':_0x198792[_0xfeb7('0x30')],'type':_0x198792['type'][_0xfeb7('0x31')]};});_0x65a855['model']=_[_0xfeb7('0x2d')](_0x520d6d,_0xfeb7('0x2b'));_0x65a855[_0xfeb7('0x32')]=_[_0xfeb7('0x33')](_0x24a372[_0xfeb7('0x32')]);_0x65a855['filters']=_[_0xfeb7('0x34')](_0x65a855[_0xfeb7('0x35')],_0x65a855['query']);_0xcf67ce[_0xfeb7('0x36')]=_['intersection'](_0x65a855[_0xfeb7('0x35')],qs[_0xfeb7('0x37')](_0x24a372[_0xfeb7('0x32')][_0xfeb7('0x37')]));_0xcf67ce[_0xfeb7('0x36')]=_0xcf67ce[_0xfeb7('0x36')][_0xfeb7('0x38')]?_0xcf67ce[_0xfeb7('0x36')]:_0x65a855[_0xfeb7('0x35')];if(!_0x24a372[_0xfeb7('0x32')][_0xfeb7('0x39')](_0xfeb7('0x3a'))){_0xcf67ce[_0xfeb7('0x1e')]=qs['limit'](_0x24a372[_0xfeb7('0x32')][_0xfeb7('0x1e')]);_0xcf67ce[_0xfeb7('0x1b')]=qs[_0xfeb7('0x1b')](_0x24a372['query'][_0xfeb7('0x1b')]);}_0xcf67ce['order']=qs[_0xfeb7('0x3b')](_0x24a372['query'][_0xfeb7('0x3b')]);_0xcf67ce[_0xfeb7('0x3c')]=qs['filters'](_[_0xfeb7('0x3d')](_0x24a372['query'],_0x65a855[_0xfeb7('0x3e')]),_0x520d6d);if(_0x24a372[_0xfeb7('0x32')][_0xfeb7('0x3f')]){_0xcf67ce[_0xfeb7('0x3c')]=_[_0xfeb7('0x40')](_0xcf67ce[_0xfeb7('0x3c')],{'$or':_[_0xfeb7('0x2d')](_0x520d6d,function(_0x7bfcf0){if(_0x7bfcf0['type']!==_0xfeb7('0x41')){var _0x3c06b0={};_0x3c06b0[_0x7bfcf0[_0xfeb7('0x2b')]]={'$like':'%'+_0x24a372[_0xfeb7('0x32')]['filter']+'%'};return _0x3c06b0;}})});}_0xcf67ce=_[_0xfeb7('0x40')]({},_0xcf67ce,_0x24a372[_0xfeb7('0x42')]);var _0x3f2ae0={'where':_0xcf67ce[_0xfeb7('0x3c')]};return db[_0xfeb7('0x2e')][_0xfeb7('0x1d')](_0x3f2ae0)['then'](function(_0x42efbf){_0x8b75cf[_0xfeb7('0x1d')]=_0x42efbf;if(_0x24a372[_0xfeb7('0x32')][_0xfeb7('0x43')]){_0xcf67ce[_0xfeb7('0x44')]=[{'all':!![]}];}return db[_0xfeb7('0x2e')][_0xfeb7('0x45')](_0xcf67ce);})[_0xfeb7('0x24')](function(_0x20262b){_0x8b75cf[_0xfeb7('0x46')]=_0x20262b;return _0x8b75cf;})[_0xfeb7('0x24')](respondWithFilteredResult(_0x141c1a,_0xcf67ce))[_0xfeb7('0x47')](handleError(_0x141c1a,null));};exports[_0xfeb7('0x48')]=function(_0x341866,_0x202c77){var _0x5580ee={'raw':!![],'where':{'id':_0x341866[_0xfeb7('0x49')]['id']}},_0x3020dc={};_0x3020dc[_0xfeb7('0x35')]=_[_0xfeb7('0x33')](db[_0xfeb7('0x2e')][_0xfeb7('0x2f')]);_0x3020dc[_0xfeb7('0x32')]=_[_0xfeb7('0x33')](_0x341866[_0xfeb7('0x32')]);_0x3020dc[_0xfeb7('0x3e')]=_[_0xfeb7('0x34')](_0x3020dc[_0xfeb7('0x35')],_0x3020dc[_0xfeb7('0x32')]);_0x5580ee['attributes']=_[_0xfeb7('0x34')](_0x3020dc['model'],qs[_0xfeb7('0x37')](_0x341866['query'][_0xfeb7('0x37')]));_0x5580ee[_0xfeb7('0x36')]=_0x5580ee[_0xfeb7('0x36')][_0xfeb7('0x38')]?_0x5580ee[_0xfeb7('0x36')]:_0x3020dc[_0xfeb7('0x35')];if(_0x341866[_0xfeb7('0x32')]['includeAll']){_0x5580ee[_0xfeb7('0x44')]=[{'all':!![]}];}_0x5580ee=_[_0xfeb7('0x40')]({},_0x5580ee,_0x341866[_0xfeb7('0x42')]);return db[_0xfeb7('0x2e')][_0xfeb7('0x4a')](_0x5580ee)['then'](handleEntityNotFound(_0x202c77,null))[_0xfeb7('0x24')](respondWithResult(_0x202c77,null))[_0xfeb7('0x47')](handleError(_0x202c77,null));};exports[_0xfeb7('0x4b')]=function(_0x3c4a97,_0x55f3ab){return db['Template']['create'](_0x3c4a97[_0xfeb7('0x4c')],{})[_0xfeb7('0x24')](function(_0x56e70b){var _0x867e5d=_0x3c4a97[_0xfeb7('0x4d')][_0xfeb7('0x26')]({'plain':!![]});if(!_0x867e5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x867e5d[_0xfeb7('0x4e')]===_0xfeb7('0x4d')){var _0x1d11e4=_0x56e70b[_0xfeb7('0x26')]({'plain':!![]});var _0xacd741=_0xfeb7('0x27');return db[_0xfeb7('0x4f')][_0xfeb7('0x4a')]({'where':{'name':_0xacd741,'userProfileId':_0x867e5d[_0xfeb7('0x50')]},'raw':!![]})[_0xfeb7('0x24')](function(_0x324616){if(_0x324616&&_0x324616[_0xfeb7('0x51')]===0x0){return db[_0xfeb7('0x28')][_0xfeb7('0x4b')]({'name':_0x1d11e4[_0xfeb7('0x2b')],'resourceId':_0x1d11e4['id'],'type':_0x324616[_0xfeb7('0x2b')],'sectionId':_0x324616['id']},{})[_0xfeb7('0x24')](function(){return _0x56e70b;});}else{return _0x56e70b;}})['catch'](function(_0x54775a){logger[_0xfeb7('0x29')](_0xfeb7('0x52'),_0x54775a);throw _0x54775a;});}return _0x56e70b;})[_0xfeb7('0x24')](respondWithResult(_0x55f3ab,0xc9))[_0xfeb7('0x47')](handleError(_0x55f3ab,null));};exports[_0xfeb7('0x23')]=function(_0x5f9251,_0x55c044){if(_0x5f9251[_0xfeb7('0x4c')]['id']){delete _0x5f9251['body']['id'];}return db[_0xfeb7('0x2e')]['find']({'where':{'id':_0x5f9251[_0xfeb7('0x49')]['id']}})[_0xfeb7('0x24')](handleEntityNotFound(_0x55c044,null))['then'](saveUpdates(_0x5f9251['body'],null))[_0xfeb7('0x24')](respondWithResult(_0x55c044,null))[_0xfeb7('0x47')](handleError(_0x55c044,null));};exports['destroy']=function(_0x4dd7ce,_0x11d739){return db[_0xfeb7('0x2e')][_0xfeb7('0x4a')]({'where':{'id':_0x4dd7ce[_0xfeb7('0x49')]['id']}})[_0xfeb7('0x24')](handleEntityNotFound(_0x11d739,null))['then'](removeEntity(_0x11d739,null))[_0xfeb7('0x47')](handleError(_0x11d739,null));}; \ No newline at end of file +var _0x0bf4=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','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','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','error','name','send','index','map','Template','rawAttributes','fieldName','type','model','keys'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x0bf4,0x76));var _0x40bf=function(_0x317497,_0x2d6cf7){_0x317497=_0x317497-0x0;var _0x3445b0=_0x0bf4[_0x317497];return _0x3445b0;};'use strict';var emlformat=require(_0x40bf('0x0'));var rimraf=require(_0x40bf('0x1'));var zipdir=require(_0x40bf('0x2'));var jsonpatch=require(_0x40bf('0x3'));var rp=require(_0x40bf('0x4'));var moment=require(_0x40bf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x40bf('0x6'));var sox=require(_0x40bf('0x7'));var csv=require(_0x40bf('0x8'));var ejs=require(_0x40bf('0x9'));var fs=require('fs');var fs_extra=require(_0x40bf('0xa'));var _=require(_0x40bf('0xb'));var squel=require(_0x40bf('0xc'));var crypto=require(_0x40bf('0xd'));var jsforce=require(_0x40bf('0xe'));var deskjs=require(_0x40bf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x40bf('0x10'));var Papa=require(_0x40bf('0x11'));var Redis=require(_0x40bf('0x12'));var authService=require(_0x40bf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x40bf('0x14'));var hardwareService=require(_0x40bf('0x15'));var logger=require(_0x40bf('0x16'))(_0x40bf('0x17'));var utils=require('../../config/utils');var config=require(_0x40bf('0x18'));var licenseUtil=require(_0x40bf('0x19'));var db=require(_0x40bf('0x1a'))['db'];function respondWithStatusCode(_0x4de5aa,_0x298e49){_0x298e49=_0x298e49||0xcc;return function(_0x3e3813){if(_0x3e3813){return _0x4de5aa[_0x40bf('0x1b')](_0x298e49);}return _0x4de5aa[_0x40bf('0x1c')](_0x298e49)[_0x40bf('0x1d')]();};}function respondWithResult(_0x47d40f,_0x45971f){_0x45971f=_0x45971f||0xc8;return function(_0xa07a81){if(_0xa07a81){return _0x47d40f[_0x40bf('0x1c')](_0x45971f)[_0x40bf('0x1e')](_0xa07a81);}};}function respondWithFilteredResult(_0x425df4,_0x2665a1){return function(_0xf7e35e){if(_0xf7e35e){var _0x1d2c79=typeof _0x2665a1[_0x40bf('0x1f')]==='undefined'&&typeof _0x2665a1[_0x40bf('0x20')]===_0x40bf('0x21');var _0xb2ef4=_0xf7e35e['count'];var _0x29b0b3=_0x1d2c79?0x0:_0x2665a1[_0x40bf('0x1f')];var _0x362edf=_0x1d2c79?_0xf7e35e[_0x40bf('0x22')]:_0x2665a1[_0x40bf('0x1f')]+_0x2665a1[_0x40bf('0x20')];var _0xe54cfb;if(_0x362edf>=_0xb2ef4){_0x362edf=_0xb2ef4;_0xe54cfb=0xc8;}else{_0xe54cfb=0xce;}_0x425df4[_0x40bf('0x1c')](_0xe54cfb);return _0x425df4[_0x40bf('0x23')](_0x40bf('0x24'),_0x29b0b3+'-'+_0x362edf+'/'+_0xb2ef4)['json'](_0xf7e35e);}return null;};}function patchUpdates(_0x3712dd){return function(_0x23c005){try{jsonpatch[_0x40bf('0x25')](_0x23c005,_0x3712dd,!![]);}catch(_0x19ebda){return BPromise[_0x40bf('0x26')](_0x19ebda);}return _0x23c005[_0x40bf('0x27')]();};}function saveUpdates(_0x3c8682,_0x10fae2){return function(_0x2b64b7){if(_0x2b64b7){return _0x2b64b7[_0x40bf('0x28')](_0x3c8682)[_0x40bf('0x29')](function(_0x34f33b){return _0x34f33b;});}return null;};}function removeEntity(_0x2bce10,_0x570845){return function(_0x6b8e4c){if(_0x6b8e4c){return _0x6b8e4c[_0x40bf('0x2a')]()[_0x40bf('0x29')](function(){var _0x4d33f4=_0x6b8e4c['get']({'plain':!![]});var _0x1fa64f=_0x40bf('0x2b');return db[_0x40bf('0x2c')][_0x40bf('0x2a')]({'where':{'type':_0x1fa64f,'resourceId':_0x4d33f4['id']}})[_0x40bf('0x29')](function(){return _0x6b8e4c;});})[_0x40bf('0x29')](function(){_0x2bce10[_0x40bf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x123bcb,_0x502a04){return function(_0x38d9c0){if(!_0x38d9c0){_0x123bcb[_0x40bf('0x1b')](0x194);}return _0x38d9c0;};}function handleError(_0x4ce2c7,_0xd94980){_0xd94980=_0xd94980||0x1f4;return function(_0x5cbbb4){logger[_0x40bf('0x2d')](_0x5cbbb4['stack']);if(_0x5cbbb4[_0x40bf('0x2e')]){delete _0x5cbbb4[_0x40bf('0x2e')];}_0x4ce2c7[_0x40bf('0x1c')](_0xd94980)[_0x40bf('0x2f')](_0x5cbbb4);};}exports[_0x40bf('0x30')]=function(_0x264a7d,_0x4bd90a){var _0x3b428d={},_0x25145f={},_0xf28bd6={'count':0x0,'rows':[]};var _0x166e47=_[_0x40bf('0x31')](db[_0x40bf('0x32')][_0x40bf('0x33')],function(_0x3cc17d){return{'name':_0x3cc17d[_0x40bf('0x34')],'type':_0x3cc17d[_0x40bf('0x35')]['key']};});_0x25145f[_0x40bf('0x36')]=_['map'](_0x166e47,_0x40bf('0x2e'));_0x25145f['query']=_[_0x40bf('0x37')](_0x264a7d[_0x40bf('0x38')]);_0x25145f[_0x40bf('0x39')]=_['intersection'](_0x25145f[_0x40bf('0x36')],_0x25145f[_0x40bf('0x38')]);_0x3b428d[_0x40bf('0x3a')]=_[_0x40bf('0x3b')](_0x25145f[_0x40bf('0x36')],qs[_0x40bf('0x3c')](_0x264a7d[_0x40bf('0x38')][_0x40bf('0x3c')]));_0x3b428d['attributes']=_0x3b428d[_0x40bf('0x3a')][_0x40bf('0x3d')]?_0x3b428d[_0x40bf('0x3a')]:_0x25145f[_0x40bf('0x36')];if(!_0x264a7d[_0x40bf('0x38')][_0x40bf('0x3e')](_0x40bf('0x3f'))){_0x3b428d[_0x40bf('0x20')]=qs[_0x40bf('0x20')](_0x264a7d[_0x40bf('0x38')][_0x40bf('0x20')]);_0x3b428d[_0x40bf('0x1f')]=qs[_0x40bf('0x1f')](_0x264a7d['query'][_0x40bf('0x1f')]);}_0x3b428d[_0x40bf('0x40')]=qs[_0x40bf('0x41')](_0x264a7d[_0x40bf('0x38')][_0x40bf('0x41')]);_0x3b428d[_0x40bf('0x42')]=qs[_0x40bf('0x39')](_['pick'](_0x264a7d[_0x40bf('0x38')],_0x25145f[_0x40bf('0x39')]),_0x166e47);if(_0x264a7d[_0x40bf('0x38')]['filter']){_0x3b428d['where']=_[_0x40bf('0x43')](_0x3b428d[_0x40bf('0x42')],{'$or':_[_0x40bf('0x31')](_0x166e47,function(_0x213ca6){if(_0x213ca6[_0x40bf('0x35')]!==_0x40bf('0x44')){var _0xac472a={};_0xac472a[_0x213ca6[_0x40bf('0x2e')]]={'$like':'%'+_0x264a7d[_0x40bf('0x38')][_0x40bf('0x45')]+'%'};return _0xac472a;}})});}_0x3b428d=_[_0x40bf('0x43')]({},_0x3b428d,_0x264a7d[_0x40bf('0x46')]);var _0x309c7b={'where':_0x3b428d[_0x40bf('0x42')]};return db[_0x40bf('0x32')][_0x40bf('0x22')](_0x309c7b)[_0x40bf('0x29')](function(_0x4d5378){_0xf28bd6['count']=_0x4d5378;if(_0x264a7d[_0x40bf('0x38')]['includeAll']){_0x3b428d[_0x40bf('0x47')]=[{'all':!![]}];}return db[_0x40bf('0x32')][_0x40bf('0x48')](_0x3b428d);})[_0x40bf('0x29')](function(_0x2204ab){_0xf28bd6['rows']=_0x2204ab;return _0xf28bd6;})[_0x40bf('0x29')](respondWithFilteredResult(_0x4bd90a,_0x3b428d))[_0x40bf('0x49')](handleError(_0x4bd90a,null));};exports[_0x40bf('0x4a')]=function(_0x38b2ff,_0x16286d){var _0x881968={'raw':!![],'where':{'id':_0x38b2ff['params']['id']}},_0x5179cd={};_0x5179cd[_0x40bf('0x36')]=_['keys'](db[_0x40bf('0x32')][_0x40bf('0x33')]);_0x5179cd[_0x40bf('0x38')]=_['keys'](_0x38b2ff[_0x40bf('0x38')]);_0x5179cd[_0x40bf('0x39')]=_['intersection'](_0x5179cd[_0x40bf('0x36')],_0x5179cd['query']);_0x881968[_0x40bf('0x3a')]=_['intersection'](_0x5179cd[_0x40bf('0x36')],qs[_0x40bf('0x3c')](_0x38b2ff['query']['fields']));_0x881968[_0x40bf('0x3a')]=_0x881968['attributes'][_0x40bf('0x3d')]?_0x881968['attributes']:_0x5179cd['model'];if(_0x38b2ff[_0x40bf('0x38')][_0x40bf('0x4b')]){_0x881968['include']=[{'all':!![]}];}_0x881968=_['merge']({},_0x881968,_0x38b2ff['options']);return db['Template'][_0x40bf('0x4c')](_0x881968)[_0x40bf('0x29')](handleEntityNotFound(_0x16286d,null))['then'](respondWithResult(_0x16286d,null))[_0x40bf('0x49')](handleError(_0x16286d,null));};exports[_0x40bf('0x4d')]=function(_0x1457e3,_0x5c64f3){return db['Template'][_0x40bf('0x4d')](_0x1457e3[_0x40bf('0x4e')],{})[_0x40bf('0x29')](function(_0x35c2bb){var _0x1ec04c=_0x1457e3[_0x40bf('0x4f')]['get']({'plain':!![]});if(!_0x1ec04c)throw new Error(_0x40bf('0x50'));if(_0x1ec04c[_0x40bf('0x51')]==='user'){var _0x329f71=_0x35c2bb[_0x40bf('0x52')]({'plain':!![]});var _0x228bf7=_0x40bf('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x228bf7,'userProfileId':_0x1ec04c[_0x40bf('0x53')]},'raw':!![]})[_0x40bf('0x29')](function(_0x34e778){if(_0x34e778&&_0x34e778[_0x40bf('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x329f71[_0x40bf('0x2e')],'resourceId':_0x329f71['id'],'type':_0x34e778['name'],'sectionId':_0x34e778['id']},{})[_0x40bf('0x29')](function(){return _0x35c2bb;});}else{return _0x35c2bb;}})[_0x40bf('0x49')](function(_0x23d5c4){logger[_0x40bf('0x2d')](_0x40bf('0x55'),_0x23d5c4);throw _0x23d5c4;});}return _0x35c2bb;})['then'](respondWithResult(_0x5c64f3,0xc9))['catch'](handleError(_0x5c64f3,null));};exports['update']=function(_0x146495,_0x3795db){if(_0x146495['body']['id']){delete _0x146495[_0x40bf('0x4e')]['id'];}return db[_0x40bf('0x32')]['find']({'where':{'id':_0x146495[_0x40bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x3795db,null))[_0x40bf('0x29')](saveUpdates(_0x146495[_0x40bf('0x4e')],null))[_0x40bf('0x29')](respondWithResult(_0x3795db,null))[_0x40bf('0x49')](handleError(_0x3795db,null));};exports[_0x40bf('0x2a')]=function(_0xc02f31,_0x182949){return db[_0x40bf('0x32')][_0x40bf('0x4c')]({'where':{'id':_0xc02f31[_0x40bf('0x56')]['id']}})[_0x40bf('0x29')](handleEntityNotFound(_0x182949,null))['then'](removeEntity(_0x182949,null))[_0x40bf('0x49')](handleError(_0x182949,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 803ec2a..a32bf6d 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 _0xc261=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','Template','tools_templates'];(function(_0x280d91,_0x4a2219){var _0xad4b7=function(_0x1f3ed4){while(--_0x1f3ed4){_0x280d91['push'](_0x280d91['shift']());}};_0xad4b7(++_0x4a2219);}(_0xc261,0x8f));var _0x1c26=function(_0x1dc3f3,_0xc99ac5){_0x1dc3f3=_0x1dc3f3-0x0;var _0x4c469e=_0xc261[_0x1dc3f3];return _0x4c469e;};'use strict';var _=require(_0x1c26('0x0'));var util=require('util');var logger=require(_0x1c26('0x1'))(_0x1c26('0x2'));var moment=require(_0x1c26('0x3'));var BPromise=require(_0x1c26('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c26('0x5'));var rimraf=require(_0x1c26('0x6'));var config=require(_0x1c26('0x7'));var attributes=require('./template.attributes');module[_0x1c26('0x8')]=function(_0x469040,_0x4d25bc){return _0x469040['define'](_0x1c26('0x9'),attributes,{'tableName':_0x1c26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b6c=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x1aa615,_0x2c8b08){var _0x22831e=function(_0x39061b){while(--_0x39061b){_0x1aa615['push'](_0x1aa615['shift']());}};_0x22831e(++_0x2c8b08);}(_0x0b6c,0x138));var _0xc0b6=function(_0x164aa6,_0x3e0846){_0x164aa6=_0x164aa6-0x0;var _0x8281cd=_0x0b6c[_0x164aa6];return _0x8281cd;};'use strict';var _=require(_0xc0b6('0x0'));var util=require(_0xc0b6('0x1'));var logger=require(_0xc0b6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc0b6('0x3'));var fs=require('fs');var path=require(_0xc0b6('0x4'));var rimraf=require(_0xc0b6('0x5'));var config=require(_0xc0b6('0x6'));var attributes=require(_0xc0b6('0x7'));module[_0xc0b6('0x8')]=function(_0x20a0ed,_0x12de8c){return _0x20a0ed[_0xc0b6('0x9')](_0xc0b6('0xa'),attributes,{'tableName':_0xc0b6('0xb'),'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 6a6e2a1..f751816 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 _0x1a86=['error','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','lodash','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s'];(function(_0x38debe,_0x1850e1){var _0x4bb2d2=function(_0x415364){while(--_0x415364){_0x38debe['push'](_0x38debe['shift']());}};_0x4bb2d2(++_0x1850e1);}(_0x1a86,0x1a3));var _0x61a8=function(_0x61ed9a,_0x7f4bf5){_0x61ed9a=_0x61ed9a-0x0;var _0x41e87d=_0x1a86[_0x61ed9a];return _0x41e87d;};'use strict';var _=require(_0x61a8('0x0'));var util=require('util');var moment=require(_0x61a8('0x1'));var BPromise=require(_0x61a8('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(_0x61a8('0x3'))(_0x61a8('0x4'));var config=require(_0x61a8('0x5'));var jayson=require(_0x61a8('0x6'));var client=jayson[_0x61a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bf11a,_0x385fe5,_0x2becf0){return new BPromise(function(_0x49d900,_0x5b45f9){return client[_0x61a8('0x8')](_0x2bf11a,_0x2becf0)[_0x61a8('0x9')](function(_0x4dbf8b){logger[_0x61a8('0xa')](_0x61a8('0xb'),_0x385fe5,_0x61a8('0xc'));logger[_0x61a8('0xd')](_0x61a8('0xe'),_0x385fe5,_0x61a8('0xc'),JSON['stringify'](_0x4dbf8b));if(_0x4dbf8b['error']){if(_0x4dbf8b['error']['code']===0x1f4){logger[_0x61a8('0xf')](_0x61a8('0xb'),_0x385fe5,_0x4dbf8b[_0x61a8('0xf')][_0x61a8('0x10')]);return _0x5b45f9(_0x4dbf8b[_0x61a8('0xf')]['message']);}logger['error'](_0x61a8('0xb'),_0x385fe5,_0x4dbf8b[_0x61a8('0xf')][_0x61a8('0x10')]);return _0x49d900(_0x4dbf8b[_0x61a8('0xf')][_0x61a8('0x10')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x385fe5,'request\x20sent');_0x49d900(_0x4dbf8b[_0x61a8('0x11')][_0x61a8('0x10')]);}})['catch'](function(_0x191364){logger[_0x61a8('0xf')](_0x61a8('0xb'),_0x385fe5,_0x191364);_0x5b45f9(_0x191364);});});}exports[_0x61a8('0x12')]=function(_0x5b08ad){var _0x2a0745=this;return new Promise(function(_0x51714f,_0xca54d){return db[_0x61a8('0x13')][_0x61a8('0x14')]({'raw':_0x5b08ad['options']?_0x5b08ad[_0x61a8('0x15')][_0x61a8('0x16')]===undefined?!![]:![]:!![],'where':_0x5b08ad['options']?_0x5b08ad['options'][_0x61a8('0x17')]||null:null,'attributes':_0x5b08ad['options']?_0x5b08ad[_0x61a8('0x15')][_0x61a8('0x18')]||null:null,'limit':_0x5b08ad[_0x61a8('0x15')]?_0x5b08ad[_0x61a8('0x15')][_0x61a8('0x19')]||null:null,'include':_0x5b08ad['options']?_0x5b08ad[_0x61a8('0x15')]['include']?_[_0x61a8('0x1a')](_0x5b08ad[_0x61a8('0x15')][_0x61a8('0x1b')],function(_0x19be0e){return{'model':db[_0x19be0e[_0x61a8('0x1c')]],'as':_0x19be0e['as'],'attributes':_0x19be0e[_0x61a8('0x18')],'include':_0x19be0e[_0x61a8('0x1b')]?_['map'](_0x19be0e[_0x61a8('0x1b')],function(_0x537d48){return{'model':db[_0x537d48['model']],'as':_0x537d48['as'],'attributes':_0x537d48[_0x61a8('0x18')],'include':_0x537d48[_0x61a8('0x1b')]?_['map'](_0x537d48[_0x61a8('0x1b')],function(_0x3f8654){return{'model':db[_0x3f8654[_0x61a8('0x1c')]],'as':_0x3f8654['as'],'attributes':_0x3f8654[_0x61a8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x61a8('0x9')](function(_0x19ee09){logger[_0x61a8('0xa')]('GetTemplate',_0x5b08ad);logger[_0x61a8('0xd')](_0x61a8('0x12'),_0x5b08ad,JSON[_0x61a8('0x1d')](_0x19ee09));_0x51714f(_0x19ee09);})[_0x61a8('0x1e')](function(_0x53e34b){logger[_0x61a8('0xf')](_0x61a8('0x12'),_0x53e34b[_0x61a8('0x10')],_0x5b08ad);_0xca54d(_0x2a0745['error'](0x1f4,_0x53e34b[_0x61a8('0x10')]));});});}; \ No newline at end of file +var _0xb22d=['request','then','info','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','request\x20sent','GetTemplate','Template','findAll','options','where','limit','include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb22d,0x75));var _0xdb22=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xb22d[_0x29e3b6];return _0x55d4b0;};'use strict';var _=require(_0xdb22('0x0'));var util=require('util');var moment=require(_0xdb22('0x1'));var BPromise=require(_0xdb22('0x2'));var rs=require(_0xdb22('0x3'));var fs=require('fs');var Redis=require(_0xdb22('0x4'));var db=require(_0xdb22('0x5'))['db'];var utils=require(_0xdb22('0x6'));var logger=require(_0xdb22('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdb22('0x8'));var client=jayson[_0xdb22('0x9')][_0xdb22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x88b49a,_0x2c4adf,_0x1b32ba){return new BPromise(function(_0xa404bd,_0x4a4f5f){return client[_0xdb22('0xb')](_0x88b49a,_0x1b32ba)[_0xdb22('0xc')](function(_0x32c41f){logger[_0xdb22('0xd')]('Template,\x20%s,\x20%s',_0x2c4adf,'request\x20sent');logger[_0xdb22('0xe')](_0xdb22('0xf'),_0x2c4adf,'request\x20sent',JSON[_0xdb22('0x10')](_0x32c41f));if(_0x32c41f[_0xdb22('0x11')]){if(_0x32c41f[_0xdb22('0x11')][_0xdb22('0x12')]===0x1f4){logger['error'](_0xdb22('0x13'),_0x2c4adf,_0x32c41f['error']['message']);return _0x4a4f5f(_0x32c41f[_0xdb22('0x11')]['message']);}logger['error'](_0xdb22('0x13'),_0x2c4adf,_0x32c41f[_0xdb22('0x11')][_0xdb22('0x14')]);return _0xa404bd(_0x32c41f[_0xdb22('0x11')]['message']);}else{logger[_0xdb22('0xd')](_0xdb22('0x13'),_0x2c4adf,_0xdb22('0x15'));_0xa404bd(_0x32c41f['result'][_0xdb22('0x14')]);}})['catch'](function(_0x44ab77){logger[_0xdb22('0x11')]('Template,\x20%s,\x20%s',_0x2c4adf,_0x44ab77);_0x4a4f5f(_0x44ab77);});});}exports[_0xdb22('0x16')]=function(_0x29d6f9){var _0x2cda4b=this;return new Promise(function(_0x35fcf8,_0x267403){return db[_0xdb22('0x17')][_0xdb22('0x18')]({'raw':_0x29d6f9[_0xdb22('0x19')]?_0x29d6f9[_0xdb22('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x29d6f9['options']?_0x29d6f9[_0xdb22('0x19')][_0xdb22('0x1a')]||null:null,'attributes':_0x29d6f9[_0xdb22('0x19')]?_0x29d6f9[_0xdb22('0x19')]['attributes']||null:null,'limit':_0x29d6f9['options']?_0x29d6f9[_0xdb22('0x19')][_0xdb22('0x1b')]||null:null,'include':_0x29d6f9[_0xdb22('0x19')]?_0x29d6f9[_0xdb22('0x19')][_0xdb22('0x1c')]?_['map'](_0x29d6f9[_0xdb22('0x19')][_0xdb22('0x1c')],function(_0x2e4c35){return{'model':db[_0x2e4c35[_0xdb22('0x1d')]],'as':_0x2e4c35['as'],'attributes':_0x2e4c35[_0xdb22('0x1e')],'include':_0x2e4c35[_0xdb22('0x1c')]?_['map'](_0x2e4c35[_0xdb22('0x1c')],function(_0x48e66e){return{'model':db[_0x48e66e[_0xdb22('0x1d')]],'as':_0x48e66e['as'],'attributes':_0x48e66e[_0xdb22('0x1e')],'include':_0x48e66e[_0xdb22('0x1c')]?_[_0xdb22('0x1f')](_0x48e66e[_0xdb22('0x1c')],function(_0x59ddae){return{'model':db[_0x59ddae['model']],'as':_0x59ddae['as'],'attributes':_0x59ddae[_0xdb22('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdb22('0xc')](function(_0x218e4c){logger[_0xdb22('0xd')](_0xdb22('0x16'),_0x29d6f9);logger['debug']('GetTemplate',_0x29d6f9,JSON['stringify'](_0x218e4c));_0x35fcf8(_0x218e4c);})['catch'](function(_0x184474){logger['error'](_0xdb22('0x16'),_0x184474[_0xdb22('0x14')],_0x29d6f9);_0x267403(_0x2cda4b[_0xdb22('0x11')](0x1f4,_0x184474[_0xdb22('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b5ad84a..fec285e 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 _0x49a1=['isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x5cffa1,_0x2b0559){var _0x1a85b0=function(_0x26b141){while(--_0x26b141){_0x5cffa1['push'](_0x5cffa1['shift']());}};_0x1a85b0(++_0x2b0559);}(_0x49a1,0x190));var _0x149a=function(_0x5152e9,_0x80dbbd){_0x5152e9=_0x5152e9-0x0;var _0x12e4b6=_0x49a1[_0x5152e9];return _0x12e4b6;};'use strict';var multer=require(_0x149a('0x0'));var util=require(_0x149a('0x1'));var path=require(_0x149a('0x2'));var timeout=require(_0x149a('0x3'));var express=require(_0x149a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x149a('0x5'));var config=require(_0x149a('0x6'));var controller=require('./trigger.controller');router[_0x149a('0x7')]('/',auth[_0x149a('0x8')](),controller['index']);router[_0x149a('0x7')]('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0x9')]);router['get'](_0x149a('0xa'),auth[_0x149a('0x8')](),controller[_0x149a('0xb')]);router[_0x149a('0x7')](_0x149a('0xc'),auth[_0x149a('0x8')](),controller['getAnyConditions']);router['get'](_0x149a('0xd'),auth[_0x149a('0x8')](),controller[_0x149a('0xe')]);router[_0x149a('0xf')]('/',auth[_0x149a('0x8')](),controller[_0x149a('0x10')]);router[_0x149a('0xf')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x149a('0x11')]);router['post'](_0x149a('0xc'),auth[_0x149a('0x8')](),controller[_0x149a('0x12')]);router[_0x149a('0xf')](_0x149a('0xd'),auth[_0x149a('0x8')](),controller[_0x149a('0x13')]);router[_0x149a('0x14')](_0x149a('0x15'),auth[_0x149a('0x8')](),controller['update']);router[_0x149a('0x16')](_0x149a('0x15'),auth[_0x149a('0x8')](),controller[_0x149a('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe8cd=['post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions'];(function(_0x366c0e,_0x2fef78){var _0x4c2d99=function(_0x3d6ccb){while(--_0x3d6ccb){_0x366c0e['push'](_0x366c0e['shift']());}};_0x4c2d99(++_0x2fef78);}(_0xe8cd,0x106));var _0xde8c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe8cd[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xde8c('0x0'));var path=require(_0xde8c('0x1'));var timeout=require(_0xde8c('0x2'));var express=require(_0xde8c('0x3'));var router=express[_0xde8c('0x4')]();var fs_extra=require(_0xde8c('0x5'));var auth=require(_0xde8c('0x6'));var interaction=require(_0xde8c('0x7'));var config=require(_0xde8c('0x8'));var controller=require(_0xde8c('0x9'));router[_0xde8c('0xa')]('/',auth[_0xde8c('0xb')](),controller[_0xde8c('0xc')]);router['get']('/:id',auth[_0xde8c('0xb')](),controller[_0xde8c('0xd')]);router['get'](_0xde8c('0xe'),auth[_0xde8c('0xb')](),controller[_0xde8c('0xf')]);router[_0xde8c('0xa')](_0xde8c('0x10'),auth[_0xde8c('0xb')](),controller[_0xde8c('0x11')]);router['get']('/:id/actions',auth[_0xde8c('0xb')](),controller['getActions']);router[_0xde8c('0x12')]('/',auth['isAuthenticated'](),controller[_0xde8c('0x13')]);router[_0xde8c('0x12')]('/:id/all_conditions',auth[_0xde8c('0xb')](),controller[_0xde8c('0x14')]);router[_0xde8c('0x12')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xde8c('0x15')]);router[_0xde8c('0x12')](_0xde8c('0x16'),auth[_0xde8c('0xb')](),controller[_0xde8c('0x17')]);router[_0xde8c('0x18')]('/:id',auth[_0xde8c('0xb')](),controller['update']);router[_0xde8c('0x19')](_0xde8c('0x1a'),auth[_0xde8c('0xb')](),controller[_0xde8c('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d8e64b9..d5e3063 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 _0xbd19=['sequelize','exports','STRING','BOOLEAN'];(function(_0x368c1a,_0x4e99c3){var _0xc545ae=function(_0x1cb6df){while(--_0x1cb6df){_0x368c1a['push'](_0x368c1a['shift']());}};_0xc545ae(++_0x4e99c3);}(_0xbd19,0x9c));var _0x9bd1=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xbd19[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x9bd1('0x0'));module[_0x9bd1('0x1')]={'name':{'type':Sequelize[_0x9bd1('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9bd1('0x2')]},'status':{'type':Sequelize[_0x9bd1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd0e2=['exports','STRING','sequelize'];(function(_0x489f45,_0x548766){var _0x2dcf07=function(_0x3f87c7){while(--_0x3f87c7){_0x489f45['push'](_0x489f45['shift']());}};_0x2dcf07(++_0x548766);}(_0xd0e2,0xd4));var _0x2d0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd0e2[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2d0e('0x0'));module[_0x2d0e('0x1')]={'name':{'type':Sequelize[_0x2d0e('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d0e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3f0b419..d596891 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 _0x8932=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','Trigger','rows','catch','show','params','length','find','create','get','role','user','Triggers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','Condition','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0x8932,0xa6));var _0x2893=function(_0x1d2910,_0xc95e64){_0x1d2910=_0x1d2910-0x0;var _0x5cf8cd=_0x8932[_0x1d2910];return _0x5cf8cd;};'use strict';var emlformat=require(_0x2893('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2893('0x1'));var jsonpatch=require(_0x2893('0x2'));var rp=require(_0x2893('0x3'));var moment=require(_0x2893('0x4'));var BPromise=require(_0x2893('0x5'));var Mustache=require(_0x2893('0x6'));var util=require(_0x2893('0x7'));var path=require(_0x2893('0x8'));var sox=require('sox');var csv=require(_0x2893('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2893('0xa'));var _=require(_0x2893('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2893('0xc'));var deskjs=require(_0x2893('0xd'));var toCsv=require(_0x2893('0x9'));var querystring=require(_0x2893('0xe'));var Papa=require(_0x2893('0xf'));var Redis=require(_0x2893('0x10'));var authService=require(_0x2893('0x11'));var qs=require(_0x2893('0x12'));var as=require(_0x2893('0x13'));var hardwareService=require(_0x2893('0x14'));var logger=require(_0x2893('0x15'))(_0x2893('0x16'));var utils=require(_0x2893('0x17'));var config=require(_0x2893('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2893('0x19'))['db'];function respondWithStatusCode(_0x5b3381,_0x4c50bd){_0x4c50bd=_0x4c50bd||0xcc;return function(_0x5c94d5){if(_0x5c94d5){return _0x5b3381[_0x2893('0x1a')](_0x4c50bd);}return _0x5b3381[_0x2893('0x1b')](_0x4c50bd)[_0x2893('0x1c')]();};}function respondWithResult(_0x3b3194,_0xdf6d41){_0xdf6d41=_0xdf6d41||0xc8;return function(_0x4bc816){if(_0x4bc816){return _0x3b3194[_0x2893('0x1b')](_0xdf6d41)['json'](_0x4bc816);}};}function respondWithFilteredResult(_0x272ce2,_0x479895){return function(_0x2d9d57){if(_0x2d9d57){var _0x96474=typeof _0x479895[_0x2893('0x1d')]===_0x2893('0x1e')&&typeof _0x479895[_0x2893('0x1f')]===_0x2893('0x1e');var _0x2f9152=_0x2d9d57[_0x2893('0x20')];var _0x5d411a=_0x96474?0x0:_0x479895[_0x2893('0x1d')];var _0x141762=_0x96474?_0x2d9d57[_0x2893('0x20')]:_0x479895[_0x2893('0x1d')]+_0x479895[_0x2893('0x1f')];var _0x14b067;if(_0x141762>=_0x2f9152){_0x141762=_0x2f9152;_0x14b067=0xc8;}else{_0x14b067=0xce;}_0x272ce2[_0x2893('0x1b')](_0x14b067);return _0x272ce2[_0x2893('0x21')](_0x2893('0x22'),_0x5d411a+'-'+_0x141762+'/'+_0x2f9152)[_0x2893('0x23')](_0x2d9d57);}return null;};}function patchUpdates(_0x7fad98){return function(_0x19dcb4){try{jsonpatch[_0x2893('0x24')](_0x19dcb4,_0x7fad98,!![]);}catch(_0x1de04e){return BPromise[_0x2893('0x25')](_0x1de04e);}return _0x19dcb4[_0x2893('0x26')]();};}function saveUpdates(_0xa0ea1a,_0x17cbb8){return function(_0x381898){if(_0x381898){return _0x381898['update'](_0xa0ea1a)[_0x2893('0x27')](function(_0x44a50a){return _0x44a50a;});}return null;};}function removeEntity(_0x30d727,_0x48758c){return function(_0x69f2da){if(_0x69f2da){return _0x69f2da['destroy']()[_0x2893('0x27')](function(){var _0x3da30e=_0x69f2da['get']({'plain':!![]});var _0x1559fa='Triggers';return db[_0x2893('0x28')][_0x2893('0x29')]({'where':{'type':_0x1559fa,'resourceId':_0x3da30e['id']}})[_0x2893('0x27')](function(){return _0x69f2da;});})[_0x2893('0x27')](function(){_0x30d727[_0x2893('0x1b')](0xcc)[_0x2893('0x1c')]();});}};}function handleEntityNotFound(_0x4e11cf,_0x2c1fa2){return function(_0x30d3ac){if(!_0x30d3ac){_0x4e11cf['sendStatus'](0x194);}return _0x30d3ac;};}function handleError(_0x3cf32f,_0x26ac8e){_0x26ac8e=_0x26ac8e||0x1f4;return function(_0x46fcc3){logger[_0x2893('0x2a')](_0x46fcc3['stack']);if(_0x46fcc3[_0x2893('0x2b')]){delete _0x46fcc3['name'];}_0x3cf32f[_0x2893('0x1b')](_0x26ac8e)['send'](_0x46fcc3);};}exports[_0x2893('0x2c')]=function(_0x5dc253,_0x507c95){var _0x2ee6c1={},_0x5e3b41={},_0x36b6ae={'count':0x0,'rows':[]};var _0x4cde48=_[_0x2893('0x2d')](db['Trigger'][_0x2893('0x2e')],function(_0x234038){return{'name':_0x234038[_0x2893('0x2f')],'type':_0x234038[_0x2893('0x30')][_0x2893('0x31')]};});_0x5e3b41[_0x2893('0x32')]=_[_0x2893('0x2d')](_0x4cde48,_0x2893('0x2b'));_0x5e3b41[_0x2893('0x33')]=_[_0x2893('0x34')](_0x5dc253[_0x2893('0x33')]);_0x5e3b41['filters']=_['intersection'](_0x5e3b41['model'],_0x5e3b41[_0x2893('0x33')]);_0x2ee6c1[_0x2893('0x35')]=_[_0x2893('0x36')](_0x5e3b41[_0x2893('0x32')],qs[_0x2893('0x37')](_0x5dc253[_0x2893('0x33')][_0x2893('0x37')]));_0x2ee6c1[_0x2893('0x35')]=_0x2ee6c1[_0x2893('0x35')]['length']?_0x2ee6c1[_0x2893('0x35')]:_0x5e3b41['model'];if(!_0x5dc253['query'][_0x2893('0x38')](_0x2893('0x39'))){_0x2ee6c1[_0x2893('0x1f')]=qs[_0x2893('0x1f')](_0x5dc253[_0x2893('0x33')][_0x2893('0x1f')]);_0x2ee6c1[_0x2893('0x1d')]=qs['offset'](_0x5dc253[_0x2893('0x33')][_0x2893('0x1d')]);}_0x2ee6c1[_0x2893('0x3a')]=qs[_0x2893('0x3b')](_0x5dc253[_0x2893('0x33')][_0x2893('0x3b')]);_0x2ee6c1[_0x2893('0x3c')]=qs[_0x2893('0x3d')](_[_0x2893('0x3e')](_0x5dc253[_0x2893('0x33')],_0x5e3b41[_0x2893('0x3d')]),_0x4cde48);if(_0x5dc253['query'][_0x2893('0x3f')]){_0x2ee6c1[_0x2893('0x3c')]=_[_0x2893('0x40')](_0x2ee6c1[_0x2893('0x3c')],{'$or':_[_0x2893('0x2d')](_0x4cde48,function(_0x1c9a72){if(_0x1c9a72['type']!=='VIRTUAL'){var _0x3de8d5={};_0x3de8d5[_0x1c9a72['name']]={'$like':'%'+_0x5dc253[_0x2893('0x33')][_0x2893('0x3f')]+'%'};return _0x3de8d5;}})});}_0x2ee6c1=_[_0x2893('0x40')]({},_0x2ee6c1,_0x5dc253[_0x2893('0x41')]);var _0x1a16f7={'where':_0x2ee6c1['where']};return db['Trigger'][_0x2893('0x20')](_0x1a16f7)[_0x2893('0x27')](function(_0x1b93d4){_0x36b6ae[_0x2893('0x20')]=_0x1b93d4;if(_0x5dc253[_0x2893('0x33')]['includeAll']){_0x2ee6c1[_0x2893('0x42')]=[{'all':!![]}];}return db[_0x2893('0x43')]['findAll'](_0x2ee6c1);})[_0x2893('0x27')](function(_0xc1e226){_0x36b6ae[_0x2893('0x44')]=_0xc1e226;return _0x36b6ae;})[_0x2893('0x27')](respondWithFilteredResult(_0x507c95,_0x2ee6c1))[_0x2893('0x45')](handleError(_0x507c95,null));};exports[_0x2893('0x46')]=function(_0x528fdc,_0x3e7044){var _0x16d2de={'raw':![],'where':{'id':_0x528fdc[_0x2893('0x47')]['id']}},_0x129c40={};_0x129c40[_0x2893('0x32')]=_[_0x2893('0x34')](db['Trigger'][_0x2893('0x2e')]);_0x129c40['query']=_[_0x2893('0x34')](_0x528fdc[_0x2893('0x33')]);_0x129c40[_0x2893('0x3d')]=_['intersection'](_0x129c40[_0x2893('0x32')],_0x129c40['query']);_0x16d2de[_0x2893('0x35')]=_[_0x2893('0x36')](_0x129c40[_0x2893('0x32')],qs[_0x2893('0x37')](_0x528fdc[_0x2893('0x33')][_0x2893('0x37')]));_0x16d2de[_0x2893('0x35')]=_0x16d2de[_0x2893('0x35')][_0x2893('0x48')]?_0x16d2de[_0x2893('0x35')]:_0x129c40[_0x2893('0x32')];if(_0x528fdc[_0x2893('0x33')]['includeAll']){_0x16d2de[_0x2893('0x42')]=[{'all':!![]}];}_0x16d2de=_[_0x2893('0x40')]({},_0x16d2de,_0x528fdc[_0x2893('0x41')]);return db[_0x2893('0x43')][_0x2893('0x49')](_0x16d2de)[_0x2893('0x27')](handleEntityNotFound(_0x3e7044,null))[_0x2893('0x27')](respondWithResult(_0x3e7044,null))[_0x2893('0x45')](handleError(_0x3e7044,null));};exports[_0x2893('0x4a')]=function(_0xd7e349,_0x57fa9b){return db['Trigger'][_0x2893('0x4a')](_0xd7e349['body'],{})['then'](function(_0x3d1429){var _0x1de76f=_0xd7e349['user'][_0x2893('0x4b')]({'plain':!![]});if(!_0x1de76f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1de76f[_0x2893('0x4c')]===_0x2893('0x4d')){var _0x339c54=_0x3d1429['get']({'plain':!![]});var _0x4e4322=_0x2893('0x4e');return db['UserProfileSection'][_0x2893('0x49')]({'where':{'name':_0x4e4322,'userProfileId':_0x1de76f[_0x2893('0x4f')]},'raw':!![]})[_0x2893('0x27')](function(_0x201e9c){if(_0x201e9c&&_0x201e9c['autoAssociation']===0x0){return db[_0x2893('0x28')][_0x2893('0x4a')]({'name':_0x339c54['name'],'resourceId':_0x339c54['id'],'type':_0x201e9c['name'],'sectionId':_0x201e9c['id']},{})[_0x2893('0x27')](function(){return _0x3d1429;});}else{return _0x3d1429;}})[_0x2893('0x45')](function(_0x50290f){logger[_0x2893('0x2a')](_0x2893('0x50'),_0x50290f);throw _0x50290f;});}return _0x3d1429;})[_0x2893('0x27')](respondWithResult(_0x57fa9b,0xc9))[_0x2893('0x45')](handleError(_0x57fa9b,null));};exports['update']=function(_0x4e5745,_0x508a50){if(_0x4e5745[_0x2893('0x51')]['id']){delete _0x4e5745[_0x2893('0x51')]['id'];}return db[_0x2893('0x43')][_0x2893('0x49')]({'where':{'id':_0x4e5745[_0x2893('0x47')]['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x508a50,null))[_0x2893('0x27')](saveUpdates(_0x4e5745[_0x2893('0x51')],null))[_0x2893('0x27')](respondWithResult(_0x508a50,null))[_0x2893('0x45')](handleError(_0x508a50,null));};exports[_0x2893('0x29')]=function(_0x4d1d12,_0x329644){return db['Trigger']['find']({'where':{'id':_0x4d1d12['params']['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x329644,null))['then'](removeEntity(_0x329644,null))[_0x2893('0x45')](handleError(_0x329644,null));};exports[_0x2893('0x52')]=function(_0x185a2e,_0x1e07aa,_0x32063d){if(_0x185a2e[_0x2893('0x51')]['id']){delete _0x185a2e[_0x2893('0x51')]['id'];}return db[_0x2893('0x43')][_0x2893('0x49')]({'where':{'id':_0x185a2e['params']['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x1e07aa,null))[_0x2893('0x27')](function(_0x35851b){if(_0x35851b){_0x185a2e[_0x2893('0x51')][_0x2893('0x53')]=_0x35851b['id'];return db['Condition'][_0x2893('0x4a')](_0x185a2e[_0x2893('0x51')]);}})[_0x2893('0x27')](respondWithResult(_0x1e07aa,null))[_0x2893('0x45')](handleError(_0x1e07aa,null));};exports[_0x2893('0x54')]=function(_0x24a2f2,_0x3dd832,_0x15358d){if(_0x24a2f2[_0x2893('0x51')]['id']){delete _0x24a2f2[_0x2893('0x51')]['id'];}return db[_0x2893('0x43')][_0x2893('0x49')]({'where':{'id':_0x24a2f2[_0x2893('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dd832,null))[_0x2893('0x27')](function(_0x9dc017){if(_0x9dc017){_0x24a2f2[_0x2893('0x51')][_0x2893('0x55')]=_0x9dc017['id'];return db['Condition'][_0x2893('0x4a')](_0x24a2f2['body']);}})['then'](respondWithResult(_0x3dd832,null))['catch'](handleError(_0x3dd832,null));};exports[_0x2893('0x56')]=function(_0x2d6134,_0x4d4633,_0x4c018f){var _0x2a2ee9={};var _0x5ed823={};var _0xf77a68;var _0x52afe8;return db[_0x2893('0x43')]['findOne']({'where':{'id':_0x2d6134[_0x2893('0x47')]['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x4d4633,null))['then'](function(_0x14ba60){if(_0x14ba60){_0xf77a68=_0x14ba60;_0x5ed823[_0x2893('0x32')]=_[_0x2893('0x34')](db[_0x2893('0x57')]['rawAttributes']);_0x5ed823[_0x2893('0x33')]=_['keys'](_0x2d6134[_0x2893('0x33')]);_0x5ed823[_0x2893('0x3d')]=_[_0x2893('0x36')](_0x5ed823['model'],_0x5ed823[_0x2893('0x33')]);_0x2a2ee9['attributes']=_[_0x2893('0x36')](_0x5ed823[_0x2893('0x32')],qs[_0x2893('0x37')](_0x2d6134['query'][_0x2893('0x37')]));_0x2a2ee9[_0x2893('0x35')]=_0x2a2ee9['attributes']['length']?_0x2a2ee9[_0x2893('0x35')]:_0x5ed823[_0x2893('0x32')];_0x2a2ee9[_0x2893('0x3a')]=qs[_0x2893('0x3b')](_0x2d6134[_0x2893('0x33')][_0x2893('0x3b')]);_0x2a2ee9[_0x2893('0x3c')]=qs[_0x2893('0x3d')](_[_0x2893('0x3e')](_0x2d6134[_0x2893('0x33')],_0x5ed823['filters']));if(_0x2d6134['query'][_0x2893('0x3f')]){_0x2a2ee9['where']=_[_0x2893('0x40')](_0x2a2ee9[_0x2893('0x3c')],{'$or':_['map'](_0x2a2ee9[_0x2893('0x35')],function(_0x21515a){var _0x2912e0={};_0x2912e0[_0x21515a]={'$like':'%'+_0x2d6134[_0x2893('0x33')][_0x2893('0x3f')]+'%'};return _0x2912e0;})});}_0x2a2ee9=_[_0x2893('0x40')]({},_0x2a2ee9,_0x2d6134['options']);return _0xf77a68[_0x2893('0x56')](_0x2a2ee9);}})[_0x2893('0x27')](function(_0x303784){if(_0x303784){_0x52afe8=_0x303784[_0x2893('0x48')];if(!_0x2d6134[_0x2893('0x33')][_0x2893('0x38')](_0x2893('0x39'))){_0x2a2ee9[_0x2893('0x1f')]=qs[_0x2893('0x1f')](_0x2d6134['query'][_0x2893('0x1f')]);_0x2a2ee9[_0x2893('0x1d')]=qs[_0x2893('0x1d')](_0x2d6134['query'][_0x2893('0x1d')]);}return _0xf77a68[_0x2893('0x56')](_0x2a2ee9);}})[_0x2893('0x27')](function(_0x1ebdfa){if(_0x1ebdfa){return _0x1ebdfa?{'count':_0x52afe8,'rows':_0x1ebdfa}:null;}})[_0x2893('0x27')](respondWithResult(_0x4d4633,null))['catch'](handleError(_0x4d4633,null));};exports[_0x2893('0x58')]=function(_0x12d969,_0x56a914,_0x855b1d){var _0x304fdf={};var _0x38dd6b={};var _0x2c56d3;var _0x162be6;return db['Trigger']['findOne']({'where':{'id':_0x12d969[_0x2893('0x47')]['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x56a914,null))[_0x2893('0x27')](function(_0x5a0861){if(_0x5a0861){_0x2c56d3=_0x5a0861;_0x38dd6b[_0x2893('0x32')]=_[_0x2893('0x34')](db[_0x2893('0x57')]['rawAttributes']);_0x38dd6b[_0x2893('0x33')]=_[_0x2893('0x34')](_0x12d969['query']);_0x38dd6b[_0x2893('0x3d')]=_[_0x2893('0x36')](_0x38dd6b[_0x2893('0x32')],_0x38dd6b[_0x2893('0x33')]);_0x304fdf[_0x2893('0x35')]=_[_0x2893('0x36')](_0x38dd6b[_0x2893('0x32')],qs[_0x2893('0x37')](_0x12d969[_0x2893('0x33')][_0x2893('0x37')]));_0x304fdf[_0x2893('0x35')]=_0x304fdf['attributes'][_0x2893('0x48')]?_0x304fdf[_0x2893('0x35')]:_0x38dd6b[_0x2893('0x32')];_0x304fdf[_0x2893('0x3a')]=qs[_0x2893('0x3b')](_0x12d969['query'][_0x2893('0x3b')]);_0x304fdf['where']=qs['filters'](_[_0x2893('0x3e')](_0x12d969[_0x2893('0x33')],_0x38dd6b[_0x2893('0x3d')]));if(_0x12d969['query'][_0x2893('0x3f')]){_0x304fdf[_0x2893('0x3c')]=_[_0x2893('0x40')](_0x304fdf[_0x2893('0x3c')],{'$or':_[_0x2893('0x2d')](_0x304fdf[_0x2893('0x35')],function(_0x208e7b){var _0x54cb25={};_0x54cb25[_0x208e7b]={'$like':'%'+_0x12d969['query'][_0x2893('0x3f')]+'%'};return _0x54cb25;})});}_0x304fdf=_['merge']({},_0x304fdf,_0x12d969[_0x2893('0x41')]);return _0x2c56d3[_0x2893('0x58')](_0x304fdf);}})[_0x2893('0x27')](function(_0x4bc5bf){if(_0x4bc5bf){_0x162be6=_0x4bc5bf[_0x2893('0x48')];if(!_0x12d969[_0x2893('0x33')][_0x2893('0x38')](_0x2893('0x39'))){_0x304fdf[_0x2893('0x1f')]=qs['limit'](_0x12d969['query'][_0x2893('0x1f')]);_0x304fdf['offset']=qs['offset'](_0x12d969[_0x2893('0x33')][_0x2893('0x1d')]);}return _0x2c56d3['getAnyConditions'](_0x304fdf);}})[_0x2893('0x27')](function(_0x186953){if(_0x186953){return _0x186953?{'count':_0x162be6,'rows':_0x186953}:null;}})[_0x2893('0x27')](respondWithResult(_0x56a914,null))[_0x2893('0x45')](handleError(_0x56a914,null));};exports[_0x2893('0x59')]=function(_0xad0df7,_0x5a2c5b,_0x4fec02){if(_0xad0df7[_0x2893('0x51')]['id']){delete _0xad0df7[_0x2893('0x51')]['id'];}return db['Trigger'][_0x2893('0x49')]({'where':{'id':_0xad0df7[_0x2893('0x47')]['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x5a2c5b,null))[_0x2893('0x27')](function(_0x35a4fa){if(_0x35a4fa){_0xad0df7[_0x2893('0x51')][_0x2893('0x5a')]=_0x35a4fa['id'];return db[_0x2893('0x5b')][_0x2893('0x4a')](_0xad0df7[_0x2893('0x51')]);}})['then'](respondWithResult(_0x5a2c5b,null))[_0x2893('0x45')](handleError(_0x5a2c5b,null));};exports[_0x2893('0x5c')]=function(_0x42bc9e,_0x4f1aad,_0x5d753b){var _0x1f7172={};var _0x357d52={};var _0x56d9c0;var _0x2c715a;return db[_0x2893('0x43')]['findOne']({'where':{'id':_0x42bc9e['params']['id']}})[_0x2893('0x27')](handleEntityNotFound(_0x4f1aad,null))[_0x2893('0x27')](function(_0x1099ac){if(_0x1099ac){_0x56d9c0=_0x1099ac;_0x357d52[_0x2893('0x32')]=_[_0x2893('0x34')](db[_0x2893('0x5b')][_0x2893('0x2e')]);_0x357d52[_0x2893('0x33')]=_[_0x2893('0x34')](_0x42bc9e['query']);_0x357d52[_0x2893('0x3d')]=_[_0x2893('0x36')](_0x357d52[_0x2893('0x32')],_0x357d52[_0x2893('0x33')]);_0x1f7172['attributes']=_[_0x2893('0x36')](_0x357d52[_0x2893('0x32')],qs[_0x2893('0x37')](_0x42bc9e[_0x2893('0x33')][_0x2893('0x37')]));_0x1f7172[_0x2893('0x35')]=_0x1f7172[_0x2893('0x35')][_0x2893('0x48')]?_0x1f7172[_0x2893('0x35')]:_0x357d52[_0x2893('0x32')];_0x1f7172[_0x2893('0x3a')]=qs[_0x2893('0x3b')](_0x42bc9e['query'][_0x2893('0x3b')]);_0x1f7172[_0x2893('0x3c')]=qs['filters'](_[_0x2893('0x3e')](_0x42bc9e['query'],_0x357d52[_0x2893('0x3d')]));if(_0x42bc9e[_0x2893('0x33')]['filter']){_0x1f7172[_0x2893('0x3c')]=_[_0x2893('0x40')](_0x1f7172[_0x2893('0x3c')],{'$or':_[_0x2893('0x2d')](_0x1f7172[_0x2893('0x35')],function(_0x2a5e46){var _0x3c2319={};_0x3c2319[_0x2a5e46]={'$like':'%'+_0x42bc9e['query'][_0x2893('0x3f')]+'%'};return _0x3c2319;})});}_0x1f7172=_['merge']({},_0x1f7172,_0x42bc9e[_0x2893('0x41')]);return _0x56d9c0[_0x2893('0x5c')](_0x1f7172);}})[_0x2893('0x27')](function(_0x5a3ded){if(_0x5a3ded){_0x2c715a=_0x5a3ded[_0x2893('0x48')];if(!_0x42bc9e[_0x2893('0x33')][_0x2893('0x38')]('nolimit')){_0x1f7172['limit']=qs['limit'](_0x42bc9e['query'][_0x2893('0x1f')]);_0x1f7172[_0x2893('0x1d')]=qs[_0x2893('0x1d')](_0x42bc9e[_0x2893('0x33')][_0x2893('0x1d')]);}return _0x56d9c0[_0x2893('0x5c')](_0x1f7172);}})['then'](function(_0x4b1234){if(_0x4b1234){return _0x4b1234?{'count':_0x2c715a,'rows':_0x4b1234}:null;}})[_0x2893('0x27')](respondWithResult(_0x4f1aad,null))[_0x2893('0x45')](handleError(_0x4f1aad,null));}; \ No newline at end of file +var _0x7b2a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Condition','TriggerAnyId','findOne','sort','pick','getAllConditions','hasOwnProperty','getAnyConditions','nolimit','addAction','TriggerId','Action','getActions','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','get'];(function(_0x22e4a5,_0x4b1dc1){var _0x2b3e4a=function(_0x4738d3){while(--_0x4738d3){_0x22e4a5['push'](_0x22e4a5['shift']());}};_0x2b3e4a(++_0x4b1dc1);}(_0x7b2a,0x6f));var _0xa7b2=function(_0x3014b7,_0x274579){_0x3014b7=_0x3014b7-0x0;var _0x26543d=_0x7b2a[_0x3014b7];return _0x26543d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7b2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa7b2('0x1'));var moment=require(_0xa7b2('0x2'));var BPromise=require(_0xa7b2('0x3'));var Mustache=require(_0xa7b2('0x4'));var util=require(_0xa7b2('0x5'));var path=require(_0xa7b2('0x6'));var sox=require(_0xa7b2('0x7'));var csv=require('to-csv');var ejs=require(_0xa7b2('0x8'));var fs=require('fs');var fs_extra=require(_0xa7b2('0x9'));var _=require(_0xa7b2('0xa'));var squel=require(_0xa7b2('0xb'));var crypto=require('crypto');var jsforce=require(_0xa7b2('0xc'));var deskjs=require(_0xa7b2('0xd'));var toCsv=require(_0xa7b2('0xe'));var querystring=require('querystring');var Papa=require(_0xa7b2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa7b2('0x10'));var hardwareService=require(_0xa7b2('0x11'));var logger=require(_0xa7b2('0x12'))(_0xa7b2('0x13'));var utils=require(_0xa7b2('0x14'));var config=require(_0xa7b2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7b2('0x16'))['db'];function respondWithStatusCode(_0xde800e,_0x2d54fb){_0x2d54fb=_0x2d54fb||0xcc;return function(_0xeaf585){if(_0xeaf585){return _0xde800e[_0xa7b2('0x17')](_0x2d54fb);}return _0xde800e['status'](_0x2d54fb)[_0xa7b2('0x18')]();};}function respondWithResult(_0x4a6dab,_0x4a47cf){_0x4a47cf=_0x4a47cf||0xc8;return function(_0x3b8d08){if(_0x3b8d08){return _0x4a6dab['status'](_0x4a47cf)[_0xa7b2('0x19')](_0x3b8d08);}};}function respondWithFilteredResult(_0x377ee5,_0x2fdf6b){return function(_0xf8bf86){if(_0xf8bf86){var _0x3020a9=typeof _0x2fdf6b[_0xa7b2('0x1a')]==='undefined'&&typeof _0x2fdf6b[_0xa7b2('0x1b')]===_0xa7b2('0x1c');var _0x20742c=_0xf8bf86[_0xa7b2('0x1d')];var _0x360071=_0x3020a9?0x0:_0x2fdf6b[_0xa7b2('0x1a')];var _0x4fa562=_0x3020a9?_0xf8bf86[_0xa7b2('0x1d')]:_0x2fdf6b[_0xa7b2('0x1a')]+_0x2fdf6b[_0xa7b2('0x1b')];var _0x5c2e0c;if(_0x4fa562>=_0x20742c){_0x4fa562=_0x20742c;_0x5c2e0c=0xc8;}else{_0x5c2e0c=0xce;}_0x377ee5[_0xa7b2('0x1e')](_0x5c2e0c);return _0x377ee5[_0xa7b2('0x1f')](_0xa7b2('0x20'),_0x360071+'-'+_0x4fa562+'/'+_0x20742c)[_0xa7b2('0x19')](_0xf8bf86);}return null;};}function patchUpdates(_0x14f7d1){return function(_0x4ad2b2){try{jsonpatch[_0xa7b2('0x21')](_0x4ad2b2,_0x14f7d1,!![]);}catch(_0x2f6829){return BPromise['reject'](_0x2f6829);}return _0x4ad2b2[_0xa7b2('0x22')]();};}function saveUpdates(_0x237bea,_0x394f6c){return function(_0x47cf7c){if(_0x47cf7c){return _0x47cf7c[_0xa7b2('0x23')](_0x237bea)[_0xa7b2('0x24')](function(_0x2fd91b){return _0x2fd91b;});}return null;};}function removeEntity(_0x548860,_0x171c74){return function(_0x38ca3c){if(_0x38ca3c){return _0x38ca3c[_0xa7b2('0x25')]()[_0xa7b2('0x24')](function(){var _0x1038c3=_0x38ca3c['get']({'plain':!![]});var _0x14bdc3=_0xa7b2('0x26');return db[_0xa7b2('0x27')][_0xa7b2('0x25')]({'where':{'type':_0x14bdc3,'resourceId':_0x1038c3['id']}})['then'](function(){return _0x38ca3c;});})[_0xa7b2('0x24')](function(){_0x548860[_0xa7b2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2c5cb,_0x17da9b){return function(_0x5d002d){if(!_0x5d002d){_0xe2c5cb[_0xa7b2('0x17')](0x194);}return _0x5d002d;};}function handleError(_0x15a7c7,_0x417028){_0x417028=_0x417028||0x1f4;return function(_0x5cb3d5){logger[_0xa7b2('0x28')](_0x5cb3d5[_0xa7b2('0x29')]);if(_0x5cb3d5[_0xa7b2('0x2a')]){delete _0x5cb3d5[_0xa7b2('0x2a')];}_0x15a7c7[_0xa7b2('0x1e')](_0x417028)[_0xa7b2('0x2b')](_0x5cb3d5);};}exports[_0xa7b2('0x2c')]=function(_0x1f1fa1,_0x2f20f5){var _0x5635b6={},_0x128d3d={},_0x522f8d={'count':0x0,'rows':[]};var _0x5058d4=_[_0xa7b2('0x2d')](db[_0xa7b2('0x2e')][_0xa7b2('0x2f')],function(_0x4a3bd1){return{'name':_0x4a3bd1[_0xa7b2('0x30')],'type':_0x4a3bd1[_0xa7b2('0x31')][_0xa7b2('0x32')]};});_0x128d3d[_0xa7b2('0x33')]=_[_0xa7b2('0x2d')](_0x5058d4,_0xa7b2('0x2a'));_0x128d3d[_0xa7b2('0x34')]=_[_0xa7b2('0x35')](_0x1f1fa1[_0xa7b2('0x34')]);_0x128d3d[_0xa7b2('0x36')]=_[_0xa7b2('0x37')](_0x128d3d[_0xa7b2('0x33')],_0x128d3d[_0xa7b2('0x34')]);_0x5635b6[_0xa7b2('0x38')]=_[_0xa7b2('0x37')](_0x128d3d[_0xa7b2('0x33')],qs[_0xa7b2('0x39')](_0x1f1fa1[_0xa7b2('0x34')]['fields']));_0x5635b6[_0xa7b2('0x38')]=_0x5635b6[_0xa7b2('0x38')][_0xa7b2('0x3a')]?_0x5635b6[_0xa7b2('0x38')]:_0x128d3d['model'];if(!_0x1f1fa1[_0xa7b2('0x34')]['hasOwnProperty']('nolimit')){_0x5635b6[_0xa7b2('0x1b')]=qs[_0xa7b2('0x1b')](_0x1f1fa1[_0xa7b2('0x34')][_0xa7b2('0x1b')]);_0x5635b6['offset']=qs[_0xa7b2('0x1a')](_0x1f1fa1[_0xa7b2('0x34')][_0xa7b2('0x1a')]);}_0x5635b6[_0xa7b2('0x3b')]=qs['sort'](_0x1f1fa1['query']['sort']);_0x5635b6['where']=qs['filters'](_['pick'](_0x1f1fa1[_0xa7b2('0x34')],_0x128d3d['filters']),_0x5058d4);if(_0x1f1fa1[_0xa7b2('0x34')][_0xa7b2('0x3c')]){_0x5635b6[_0xa7b2('0x3d')]=_[_0xa7b2('0x3e')](_0x5635b6[_0xa7b2('0x3d')],{'$or':_[_0xa7b2('0x2d')](_0x5058d4,function(_0x243f13){if(_0x243f13[_0xa7b2('0x31')]!==_0xa7b2('0x3f')){var _0x1f0c0c={};_0x1f0c0c[_0x243f13[_0xa7b2('0x2a')]]={'$like':'%'+_0x1f1fa1['query']['filter']+'%'};return _0x1f0c0c;}})});}_0x5635b6=_[_0xa7b2('0x3e')]({},_0x5635b6,_0x1f1fa1[_0xa7b2('0x40')]);var _0xe9085={'where':_0x5635b6[_0xa7b2('0x3d')]};return db[_0xa7b2('0x2e')][_0xa7b2('0x1d')](_0xe9085)[_0xa7b2('0x24')](function(_0x16a85e){_0x522f8d['count']=_0x16a85e;if(_0x1f1fa1['query'][_0xa7b2('0x41')]){_0x5635b6[_0xa7b2('0x42')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x5635b6);})['then'](function(_0x46f9ff){_0x522f8d[_0xa7b2('0x43')]=_0x46f9ff;return _0x522f8d;})[_0xa7b2('0x24')](respondWithFilteredResult(_0x2f20f5,_0x5635b6))[_0xa7b2('0x44')](handleError(_0x2f20f5,null));};exports[_0xa7b2('0x45')]=function(_0x114fce,_0x3454a1){var _0x2bc323={'raw':![],'where':{'id':_0x114fce[_0xa7b2('0x46')]['id']}},_0x50f8e2={};_0x50f8e2[_0xa7b2('0x33')]=_[_0xa7b2('0x35')](db[_0xa7b2('0x2e')][_0xa7b2('0x2f')]);_0x50f8e2[_0xa7b2('0x34')]=_[_0xa7b2('0x35')](_0x114fce[_0xa7b2('0x34')]);_0x50f8e2[_0xa7b2('0x36')]=_[_0xa7b2('0x37')](_0x50f8e2[_0xa7b2('0x33')],_0x50f8e2[_0xa7b2('0x34')]);_0x2bc323['attributes']=_[_0xa7b2('0x37')](_0x50f8e2['model'],qs['fields'](_0x114fce[_0xa7b2('0x34')][_0xa7b2('0x39')]));_0x2bc323[_0xa7b2('0x38')]=_0x2bc323[_0xa7b2('0x38')][_0xa7b2('0x3a')]?_0x2bc323['attributes']:_0x50f8e2[_0xa7b2('0x33')];if(_0x114fce[_0xa7b2('0x34')][_0xa7b2('0x41')]){_0x2bc323[_0xa7b2('0x42')]=[{'all':!![]}];}_0x2bc323=_[_0xa7b2('0x3e')]({},_0x2bc323,_0x114fce['options']);return db[_0xa7b2('0x2e')][_0xa7b2('0x47')](_0x2bc323)[_0xa7b2('0x24')](handleEntityNotFound(_0x3454a1,null))[_0xa7b2('0x24')](respondWithResult(_0x3454a1,null))['catch'](handleError(_0x3454a1,null));};exports[_0xa7b2('0x48')]=function(_0x349f33,_0x463cb0){return db[_0xa7b2('0x2e')][_0xa7b2('0x48')](_0x349f33['body'],{})[_0xa7b2('0x24')](function(_0x48d3dd){var _0x5205ac=_0x349f33[_0xa7b2('0x49')][_0xa7b2('0x4a')]({'plain':!![]});if(!_0x5205ac)throw new Error(_0xa7b2('0x4b'));if(_0x5205ac[_0xa7b2('0x4c')]==='user'){var _0x461ca9=_0x48d3dd[_0xa7b2('0x4a')]({'plain':!![]});var _0x4e2676=_0xa7b2('0x26');return db['UserProfileSection'][_0xa7b2('0x47')]({'where':{'name':_0x4e2676,'userProfileId':_0x5205ac[_0xa7b2('0x4d')]},'raw':!![]})[_0xa7b2('0x24')](function(_0x5e0a31){if(_0x5e0a31&&_0x5e0a31['autoAssociation']===0x0){return db[_0xa7b2('0x27')][_0xa7b2('0x48')]({'name':_0x461ca9[_0xa7b2('0x2a')],'resourceId':_0x461ca9['id'],'type':_0x5e0a31[_0xa7b2('0x2a')],'sectionId':_0x5e0a31['id']},{})[_0xa7b2('0x24')](function(){return _0x48d3dd;});}else{return _0x48d3dd;}})[_0xa7b2('0x44')](function(_0x1ee584){logger['error'](_0xa7b2('0x4e'),_0x1ee584);throw _0x1ee584;});}return _0x48d3dd;})[_0xa7b2('0x24')](respondWithResult(_0x463cb0,0xc9))[_0xa7b2('0x44')](handleError(_0x463cb0,null));};exports[_0xa7b2('0x23')]=function(_0x1e1ef4,_0x265094){if(_0x1e1ef4['body']['id']){delete _0x1e1ef4[_0xa7b2('0x4f')]['id'];}return db['Trigger'][_0xa7b2('0x47')]({'where':{'id':_0x1e1ef4['params']['id']}})['then'](handleEntityNotFound(_0x265094,null))[_0xa7b2('0x24')](saveUpdates(_0x1e1ef4[_0xa7b2('0x4f')],null))['then'](respondWithResult(_0x265094,null))[_0xa7b2('0x44')](handleError(_0x265094,null));};exports[_0xa7b2('0x25')]=function(_0x23cd04,_0x1c926d){return db[_0xa7b2('0x2e')][_0xa7b2('0x47')]({'where':{'id':_0x23cd04['params']['id']}})[_0xa7b2('0x24')](handleEntityNotFound(_0x1c926d,null))['then'](removeEntity(_0x1c926d,null))[_0xa7b2('0x44')](handleError(_0x1c926d,null));};exports['addAllCondition']=function(_0x416f44,_0x3a1e66,_0x500256){if(_0x416f44[_0xa7b2('0x4f')]['id']){delete _0x416f44[_0xa7b2('0x4f')]['id'];}return db[_0xa7b2('0x2e')]['find']({'where':{'id':_0x416f44['params']['id']}})['then'](handleEntityNotFound(_0x3a1e66,null))[_0xa7b2('0x24')](function(_0x437f42){if(_0x437f42){_0x416f44[_0xa7b2('0x4f')]['TriggerAllId']=_0x437f42['id'];return db[_0xa7b2('0x50')]['create'](_0x416f44[_0xa7b2('0x4f')]);}})['then'](respondWithResult(_0x3a1e66,null))['catch'](handleError(_0x3a1e66,null));};exports['addAnyCondition']=function(_0x91afdb,_0x5c8f64,_0x2c34fa){if(_0x91afdb[_0xa7b2('0x4f')]['id']){delete _0x91afdb[_0xa7b2('0x4f')]['id'];}return db[_0xa7b2('0x2e')]['find']({'where':{'id':_0x91afdb[_0xa7b2('0x46')]['id']}})[_0xa7b2('0x24')](handleEntityNotFound(_0x5c8f64,null))[_0xa7b2('0x24')](function(_0x3a7998){if(_0x3a7998){_0x91afdb[_0xa7b2('0x4f')][_0xa7b2('0x51')]=_0x3a7998['id'];return db[_0xa7b2('0x50')]['create'](_0x91afdb[_0xa7b2('0x4f')]);}})[_0xa7b2('0x24')](respondWithResult(_0x5c8f64,null))['catch'](handleError(_0x5c8f64,null));};exports['getAllConditions']=function(_0x13767c,_0x2e8251,_0x2b5aed){var _0x754368={};var _0x3f550e={};var _0x4119ad;var _0xe6cd04;return db[_0xa7b2('0x2e')][_0xa7b2('0x52')]({'where':{'id':_0x13767c[_0xa7b2('0x46')]['id']}})[_0xa7b2('0x24')](handleEntityNotFound(_0x2e8251,null))[_0xa7b2('0x24')](function(_0x52a857){if(_0x52a857){_0x4119ad=_0x52a857;_0x3f550e[_0xa7b2('0x33')]=_[_0xa7b2('0x35')](db[_0xa7b2('0x50')][_0xa7b2('0x2f')]);_0x3f550e['query']=_['keys'](_0x13767c[_0xa7b2('0x34')]);_0x3f550e[_0xa7b2('0x36')]=_['intersection'](_0x3f550e[_0xa7b2('0x33')],_0x3f550e[_0xa7b2('0x34')]);_0x754368[_0xa7b2('0x38')]=_['intersection'](_0x3f550e[_0xa7b2('0x33')],qs[_0xa7b2('0x39')](_0x13767c[_0xa7b2('0x34')][_0xa7b2('0x39')]));_0x754368[_0xa7b2('0x38')]=_0x754368[_0xa7b2('0x38')][_0xa7b2('0x3a')]?_0x754368['attributes']:_0x3f550e[_0xa7b2('0x33')];_0x754368['order']=qs[_0xa7b2('0x53')](_0x13767c[_0xa7b2('0x34')]['sort']);_0x754368[_0xa7b2('0x3d')]=qs[_0xa7b2('0x36')](_[_0xa7b2('0x54')](_0x13767c[_0xa7b2('0x34')],_0x3f550e['filters']));if(_0x13767c[_0xa7b2('0x34')][_0xa7b2('0x3c')]){_0x754368['where']=_[_0xa7b2('0x3e')](_0x754368['where'],{'$or':_[_0xa7b2('0x2d')](_0x754368['attributes'],function(_0x3460c9){var _0x4c01ed={};_0x4c01ed[_0x3460c9]={'$like':'%'+_0x13767c[_0xa7b2('0x34')][_0xa7b2('0x3c')]+'%'};return _0x4c01ed;})});}_0x754368=_[_0xa7b2('0x3e')]({},_0x754368,_0x13767c['options']);return _0x4119ad[_0xa7b2('0x55')](_0x754368);}})['then'](function(_0x193ada){if(_0x193ada){_0xe6cd04=_0x193ada['length'];if(!_0x13767c[_0xa7b2('0x34')][_0xa7b2('0x56')]('nolimit')){_0x754368[_0xa7b2('0x1b')]=qs[_0xa7b2('0x1b')](_0x13767c[_0xa7b2('0x34')][_0xa7b2('0x1b')]);_0x754368[_0xa7b2('0x1a')]=qs[_0xa7b2('0x1a')](_0x13767c[_0xa7b2('0x34')][_0xa7b2('0x1a')]);}return _0x4119ad[_0xa7b2('0x55')](_0x754368);}})[_0xa7b2('0x24')](function(_0x4fb213){if(_0x4fb213){return _0x4fb213?{'count':_0xe6cd04,'rows':_0x4fb213}:null;}})[_0xa7b2('0x24')](respondWithResult(_0x2e8251,null))[_0xa7b2('0x44')](handleError(_0x2e8251,null));};exports['getAnyConditions']=function(_0x269af9,_0x305de0,_0x1e4f36){var _0x52861f={};var _0x58afc1={};var _0xc3aef5;var _0x14966b;return db['Trigger'][_0xa7b2('0x52')]({'where':{'id':_0x269af9[_0xa7b2('0x46')]['id']}})['then'](handleEntityNotFound(_0x305de0,null))[_0xa7b2('0x24')](function(_0xfd090){if(_0xfd090){_0xc3aef5=_0xfd090;_0x58afc1[_0xa7b2('0x33')]=_[_0xa7b2('0x35')](db['Condition'][_0xa7b2('0x2f')]);_0x58afc1['query']=_[_0xa7b2('0x35')](_0x269af9[_0xa7b2('0x34')]);_0x58afc1[_0xa7b2('0x36')]=_[_0xa7b2('0x37')](_0x58afc1[_0xa7b2('0x33')],_0x58afc1[_0xa7b2('0x34')]);_0x52861f[_0xa7b2('0x38')]=_['intersection'](_0x58afc1['model'],qs[_0xa7b2('0x39')](_0x269af9[_0xa7b2('0x34')]['fields']));_0x52861f[_0xa7b2('0x38')]=_0x52861f[_0xa7b2('0x38')][_0xa7b2('0x3a')]?_0x52861f[_0xa7b2('0x38')]:_0x58afc1[_0xa7b2('0x33')];_0x52861f[_0xa7b2('0x3b')]=qs[_0xa7b2('0x53')](_0x269af9['query'][_0xa7b2('0x53')]);_0x52861f['where']=qs[_0xa7b2('0x36')](_['pick'](_0x269af9[_0xa7b2('0x34')],_0x58afc1[_0xa7b2('0x36')]));if(_0x269af9[_0xa7b2('0x34')]['filter']){_0x52861f[_0xa7b2('0x3d')]=_['merge'](_0x52861f[_0xa7b2('0x3d')],{'$or':_['map'](_0x52861f[_0xa7b2('0x38')],function(_0x308178){var _0x7fa3c7={};_0x7fa3c7[_0x308178]={'$like':'%'+_0x269af9['query'][_0xa7b2('0x3c')]+'%'};return _0x7fa3c7;})});}_0x52861f=_[_0xa7b2('0x3e')]({},_0x52861f,_0x269af9['options']);return _0xc3aef5[_0xa7b2('0x57')](_0x52861f);}})[_0xa7b2('0x24')](function(_0x249ec4){if(_0x249ec4){_0x14966b=_0x249ec4[_0xa7b2('0x3a')];if(!_0x269af9[_0xa7b2('0x34')]['hasOwnProperty'](_0xa7b2('0x58'))){_0x52861f['limit']=qs['limit'](_0x269af9[_0xa7b2('0x34')][_0xa7b2('0x1b')]);_0x52861f['offset']=qs[_0xa7b2('0x1a')](_0x269af9[_0xa7b2('0x34')][_0xa7b2('0x1a')]);}return _0xc3aef5[_0xa7b2('0x57')](_0x52861f);}})[_0xa7b2('0x24')](function(_0x565e3e){if(_0x565e3e){return _0x565e3e?{'count':_0x14966b,'rows':_0x565e3e}:null;}})[_0xa7b2('0x24')](respondWithResult(_0x305de0,null))[_0xa7b2('0x44')](handleError(_0x305de0,null));};exports[_0xa7b2('0x59')]=function(_0x11abf2,_0x27f1ff,_0x389b68){if(_0x11abf2[_0xa7b2('0x4f')]['id']){delete _0x11abf2[_0xa7b2('0x4f')]['id'];}return db[_0xa7b2('0x2e')][_0xa7b2('0x47')]({'where':{'id':_0x11abf2[_0xa7b2('0x46')]['id']}})['then'](handleEntityNotFound(_0x27f1ff,null))[_0xa7b2('0x24')](function(_0x183201){if(_0x183201){_0x11abf2[_0xa7b2('0x4f')][_0xa7b2('0x5a')]=_0x183201['id'];return db[_0xa7b2('0x5b')][_0xa7b2('0x48')](_0x11abf2['body']);}})['then'](respondWithResult(_0x27f1ff,null))[_0xa7b2('0x44')](handleError(_0x27f1ff,null));};exports[_0xa7b2('0x5c')]=function(_0x2866dd,_0x4e45ac,_0x3bac8e){var _0x176da9={};var _0xad7b2b={};var _0x4b0e62;var _0x580ec6;return db[_0xa7b2('0x2e')][_0xa7b2('0x52')]({'where':{'id':_0x2866dd[_0xa7b2('0x46')]['id']}})[_0xa7b2('0x24')](handleEntityNotFound(_0x4e45ac,null))[_0xa7b2('0x24')](function(_0x35cc97){if(_0x35cc97){_0x4b0e62=_0x35cc97;_0xad7b2b['model']=_['keys'](db[_0xa7b2('0x5b')][_0xa7b2('0x2f')]);_0xad7b2b[_0xa7b2('0x34')]=_[_0xa7b2('0x35')](_0x2866dd[_0xa7b2('0x34')]);_0xad7b2b['filters']=_['intersection'](_0xad7b2b[_0xa7b2('0x33')],_0xad7b2b[_0xa7b2('0x34')]);_0x176da9[_0xa7b2('0x38')]=_[_0xa7b2('0x37')](_0xad7b2b[_0xa7b2('0x33')],qs['fields'](_0x2866dd['query'][_0xa7b2('0x39')]));_0x176da9['attributes']=_0x176da9[_0xa7b2('0x38')]['length']?_0x176da9[_0xa7b2('0x38')]:_0xad7b2b[_0xa7b2('0x33')];_0x176da9[_0xa7b2('0x3b')]=qs[_0xa7b2('0x53')](_0x2866dd[_0xa7b2('0x34')]['sort']);_0x176da9[_0xa7b2('0x3d')]=qs['filters'](_[_0xa7b2('0x54')](_0x2866dd[_0xa7b2('0x34')],_0xad7b2b[_0xa7b2('0x36')]));if(_0x2866dd[_0xa7b2('0x34')][_0xa7b2('0x3c')]){_0x176da9[_0xa7b2('0x3d')]=_['merge'](_0x176da9[_0xa7b2('0x3d')],{'$or':_[_0xa7b2('0x2d')](_0x176da9[_0xa7b2('0x38')],function(_0x6fd57a){var _0x41e6ab={};_0x41e6ab[_0x6fd57a]={'$like':'%'+_0x2866dd[_0xa7b2('0x34')][_0xa7b2('0x3c')]+'%'};return _0x41e6ab;})});}_0x176da9=_[_0xa7b2('0x3e')]({},_0x176da9,_0x2866dd[_0xa7b2('0x40')]);return _0x4b0e62[_0xa7b2('0x5c')](_0x176da9);}})[_0xa7b2('0x24')](function(_0x47eaf0){if(_0x47eaf0){_0x580ec6=_0x47eaf0[_0xa7b2('0x3a')];if(!_0x2866dd[_0xa7b2('0x34')][_0xa7b2('0x56')](_0xa7b2('0x58'))){_0x176da9[_0xa7b2('0x1b')]=qs[_0xa7b2('0x1b')](_0x2866dd[_0xa7b2('0x34')][_0xa7b2('0x1b')]);_0x176da9[_0xa7b2('0x1a')]=qs['offset'](_0x2866dd[_0xa7b2('0x34')]['offset']);}return _0x4b0e62[_0xa7b2('0x5c')](_0x176da9);}})[_0xa7b2('0x24')](function(_0x115399){if(_0x115399){return _0x115399?{'count':_0x580ec6,'rows':_0x115399}:null;}})[_0xa7b2('0x24')](respondWithResult(_0x4e45ac,null))[_0xa7b2('0x44')](handleError(_0x4e45ac,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7d4f503..32f0d92 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 _0x7266=['rimraf','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','path'];(function(_0x31e4ac,_0x549ad0){var _0x17eda6=function(_0x1ec12a){while(--_0x1ec12a){_0x31e4ac['push'](_0x31e4ac['shift']());}};_0x17eda6(++_0x549ad0);}(_0x7266,0xec));var _0x6726=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7266[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var logger=require(_0x6726('0x2'))(_0x6726('0x3'));var moment=require(_0x6726('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6726('0x5'));var rimraf=require(_0x6726('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x6726('0x7')]=function(_0x41c7c8,_0x1c2cfd){return _0x41c7c8[_0x6726('0x8')](_0x6726('0x9'),attributes,{'tableName':_0x6726('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6208=['path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','api','bluebird'];(function(_0x46b3ca,_0x3d005d){var _0x2c5999=function(_0x28cf56){while(--_0x28cf56){_0x46b3ca['push'](_0x46b3ca['shift']());}};_0x2c5999(++_0x3d005d);}(_0x6208,0x17d));var _0x8620=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0x6208[_0x50e0b4];return _0x2fa8b0;};'use strict';var _=require(_0x8620('0x0'));var util=require('util');var logger=require(_0x8620('0x1'))(_0x8620('0x2'));var moment=require('moment');var BPromise=require(_0x8620('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8620('0x4'));var rimraf=require(_0x8620('0x5'));var config=require(_0x8620('0x6'));var attributes=require(_0x8620('0x7'));module[_0x8620('0x8')]=function(_0x373f95,_0x135c32){return _0x373f95['define'](_0x8620('0x9'),attributes,{'tableName':_0x8620('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 98aeeb0..4165f66 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 _0x26f8=['where','limit','include','map','model','attributes','stringify','catch','ShowTrigger','find','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetTrigger','Trigger','findAll','options'];(function(_0x263004,_0x5e99ca){var _0x59d5dc=function(_0x1f08a0){while(--_0x1f08a0){_0x263004['push'](_0x263004['shift']());}};_0x59d5dc(++_0x5e99ca);}(_0x26f8,0x14a));var _0x826f=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x26f8[_0x311f44];return _0x46f1e6;};'use strict';var _=require('lodash');var util=require(_0x826f('0x0'));var moment=require(_0x826f('0x1'));var BPromise=require('bluebird');var rs=require(_0x826f('0x2'));var fs=require('fs');var Redis=require(_0x826f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x826f('0x4'));var logger=require(_0x826f('0x5'))(_0x826f('0x6'));var config=require(_0x826f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x826f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x121afd,_0x435808,_0x5edb54){return new BPromise(function(_0x3556e4,_0x14a6d3){return client[_0x826f('0x9')](_0x121afd,_0x5edb54)[_0x826f('0xa')](function(_0x45d73d){logger[_0x826f('0xb')](_0x826f('0xc'),_0x435808,_0x826f('0xd'));logger[_0x826f('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x435808,_0x826f('0xd'),JSON['stringify'](_0x45d73d));if(_0x45d73d[_0x826f('0xf')]){if(_0x45d73d['error']['code']===0x1f4){logger[_0x826f('0xf')](_0x826f('0xc'),_0x435808,_0x45d73d[_0x826f('0xf')][_0x826f('0x10')]);return _0x14a6d3(_0x45d73d[_0x826f('0xf')]['message']);}logger[_0x826f('0xf')](_0x826f('0xc'),_0x435808,_0x45d73d['error'][_0x826f('0x10')]);return _0x3556e4(_0x45d73d[_0x826f('0xf')][_0x826f('0x10')]);}else{logger[_0x826f('0xb')]('Trigger,\x20%s,\x20%s',_0x435808,_0x826f('0xd'));_0x3556e4(_0x45d73d[_0x826f('0x11')][_0x826f('0x10')]);}})['catch'](function(_0x11f2f0){logger[_0x826f('0xf')](_0x826f('0xc'),_0x435808,_0x11f2f0);_0x14a6d3(_0x11f2f0);});});}exports[_0x826f('0x12')]=function(_0x7a46bc){var _0x5ea4fe=this;return new Promise(function(_0x5e1c4c,_0x4cd2a7){return db[_0x826f('0x13')][_0x826f('0x14')]({'raw':_0x7a46bc['options']?_0x7a46bc[_0x826f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x7a46bc['options']?_0x7a46bc[_0x826f('0x15')][_0x826f('0x16')]||null:null,'attributes':_0x7a46bc[_0x826f('0x15')]?_0x7a46bc[_0x826f('0x15')]['attributes']||null:null,'limit':_0x7a46bc['options']?_0x7a46bc[_0x826f('0x15')][_0x826f('0x17')]||null:null,'include':_0x7a46bc[_0x826f('0x15')]?_0x7a46bc[_0x826f('0x15')][_0x826f('0x18')]?_[_0x826f('0x19')](_0x7a46bc[_0x826f('0x15')][_0x826f('0x18')],function(_0x3e6495){return{'model':db[_0x3e6495[_0x826f('0x1a')]],'as':_0x3e6495['as'],'attributes':_0x3e6495[_0x826f('0x1b')],'include':_0x3e6495[_0x826f('0x18')]?_[_0x826f('0x19')](_0x3e6495[_0x826f('0x18')],function(_0x5b69f3){return{'model':db[_0x5b69f3[_0x826f('0x1a')]],'as':_0x5b69f3['as'],'attributes':_0x5b69f3[_0x826f('0x1b')],'include':_0x5b69f3['include']?_[_0x826f('0x19')](_0x5b69f3[_0x826f('0x18')],function(_0x457a8b){return{'model':db[_0x457a8b[_0x826f('0x1a')]],'as':_0x457a8b['as'],'attributes':_0x457a8b[_0x826f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x452470){logger[_0x826f('0xb')](_0x826f('0x12'),_0x7a46bc);logger[_0x826f('0xe')](_0x826f('0x12'),_0x7a46bc,JSON[_0x826f('0x1c')](_0x452470));_0x5e1c4c(_0x452470);})[_0x826f('0x1d')](function(_0x2eeac0){logger[_0x826f('0xf')](_0x826f('0x12'),_0x2eeac0[_0x826f('0x10')],_0x7a46bc);_0x4cd2a7(_0x5ea4fe[_0x826f('0xf')](0x1f4,_0x2eeac0[_0x826f('0x10')]));});});};exports[_0x826f('0x1e')]=function(_0x3952a7){var _0xc32a2f=this;return new Promise(function(_0x432138,_0x5c78a7){return db['Trigger'][_0x826f('0x1f')]({'raw':_0x3952a7[_0x826f('0x15')]?_0x3952a7[_0x826f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3952a7['options']?_0x3952a7[_0x826f('0x15')][_0x826f('0x16')]||null:null,'attributes':_0x3952a7[_0x826f('0x15')]?_0x3952a7[_0x826f('0x15')][_0x826f('0x1b')]||null:null,'include':_0x3952a7[_0x826f('0x15')]?_0x3952a7[_0x826f('0x15')][_0x826f('0x18')]?_[_0x826f('0x19')](_0x3952a7['options']['include'],function(_0x2d18f6){return{'model':db[_0x2d18f6[_0x826f('0x1a')]],'as':_0x2d18f6['as'],'attributes':_0x2d18f6[_0x826f('0x1b')],'include':_0x2d18f6[_0x826f('0x18')]?_[_0x826f('0x19')](_0x2d18f6[_0x826f('0x18')],function(_0x3d3e20){return{'model':db[_0x3d3e20['model']],'as':_0x3d3e20['as'],'attributes':_0x3d3e20[_0x826f('0x1b')],'include':_0x3d3e20['include']?_['map'](_0x3d3e20['include'],function(_0x40a06e){return{'model':db[_0x40a06e[_0x826f('0x1a')]],'as':_0x40a06e['as'],'attributes':_0x40a06e[_0x826f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11edfe){logger[_0x826f('0xb')](_0x826f('0x1e'),_0x3952a7);logger[_0x826f('0xe')]('ShowTrigger',_0x3952a7,JSON[_0x826f('0x1c')](_0x11edfe));_0x432138(_0x11edfe);})['catch'](function(_0x2cbfcf){logger[_0x826f('0xf')](_0x826f('0x1e'),_0x2cbfcf[_0x826f('0x10')],_0x3952a7);_0x5c78a7(_0xc32a2f['error'](0x1f4,_0x2cbfcf[_0x826f('0x10')]));});});}; \ No newline at end of file +var _0xf053=['raw','where','attributes','limit','include','map','model','then','catch','Trigger','find','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTrigger','options'];(function(_0x15e21c,_0x301d50){var _0x39d840=function(_0x523aa3){while(--_0x523aa3){_0x15e21c['push'](_0x15e21c['shift']());}};_0x39d840(++_0x301d50);}(_0xf053,0x101));var _0x3f05=function(_0x11b97e,_0x5b18f6){_0x11b97e=_0x11b97e-0x0;var _0x458b87=_0xf053[_0x11b97e];return _0x458b87;};'use strict';var _=require('lodash');var util=require(_0x3f05('0x0'));var moment=require(_0x3f05('0x1'));var BPromise=require(_0x3f05('0x2'));var rs=require(_0x3f05('0x3'));var fs=require('fs');var Redis=require(_0x3f05('0x4'));var db=require(_0x3f05('0x5'))['db'];var utils=require(_0x3f05('0x6'));var logger=require(_0x3f05('0x7'))(_0x3f05('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f05('0x9'));var client=jayson[_0x3f05('0xa')][_0x3f05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa826be,_0x35d298,_0x15f28a){return new BPromise(function(_0x22b5e8,_0x4d928d){return client['request'](_0xa826be,_0x15f28a)['then'](function(_0x3ce56f){logger[_0x3f05('0xc')](_0x3f05('0xd'),_0x35d298,'request\x20sent');logger[_0x3f05('0xe')](_0x3f05('0xf'),_0x35d298,_0x3f05('0x10'),JSON[_0x3f05('0x11')](_0x3ce56f));if(_0x3ce56f['error']){if(_0x3ce56f[_0x3f05('0x12')][_0x3f05('0x13')]===0x1f4){logger['error'](_0x3f05('0xd'),_0x35d298,_0x3ce56f[_0x3f05('0x12')][_0x3f05('0x14')]);return _0x4d928d(_0x3ce56f[_0x3f05('0x12')]['message']);}logger[_0x3f05('0x12')]('Trigger,\x20%s,\x20%s',_0x35d298,_0x3ce56f['error'][_0x3f05('0x14')]);return _0x22b5e8(_0x3ce56f[_0x3f05('0x12')][_0x3f05('0x14')]);}else{logger[_0x3f05('0xc')]('Trigger,\x20%s,\x20%s',_0x35d298,_0x3f05('0x10'));_0x22b5e8(_0x3ce56f['result'][_0x3f05('0x14')]);}})['catch'](function(_0x41b0e5){logger[_0x3f05('0x12')]('Trigger,\x20%s,\x20%s',_0x35d298,_0x41b0e5);_0x4d928d(_0x41b0e5);});});}exports[_0x3f05('0x15')]=function(_0x9dc0bb){var _0x42f13e=this;return new Promise(function(_0x5dd944,_0x4235cf){return db['Trigger']['findAll']({'raw':_0x9dc0bb[_0x3f05('0x16')]?_0x9dc0bb[_0x3f05('0x16')][_0x3f05('0x17')]===undefined?!![]:![]:!![],'where':_0x9dc0bb[_0x3f05('0x16')]?_0x9dc0bb[_0x3f05('0x16')][_0x3f05('0x18')]||null:null,'attributes':_0x9dc0bb[_0x3f05('0x16')]?_0x9dc0bb[_0x3f05('0x16')][_0x3f05('0x19')]||null:null,'limit':_0x9dc0bb[_0x3f05('0x16')]?_0x9dc0bb[_0x3f05('0x16')][_0x3f05('0x1a')]||null:null,'include':_0x9dc0bb['options']?_0x9dc0bb[_0x3f05('0x16')][_0x3f05('0x1b')]?_[_0x3f05('0x1c')](_0x9dc0bb[_0x3f05('0x16')]['include'],function(_0x198ac2){return{'model':db[_0x198ac2['model']],'as':_0x198ac2['as'],'attributes':_0x198ac2[_0x3f05('0x19')],'include':_0x198ac2['include']?_[_0x3f05('0x1c')](_0x198ac2[_0x3f05('0x1b')],function(_0x3f7973){return{'model':db[_0x3f7973[_0x3f05('0x1d')]],'as':_0x3f7973['as'],'attributes':_0x3f7973[_0x3f05('0x19')],'include':_0x3f7973['include']?_[_0x3f05('0x1c')](_0x3f7973[_0x3f05('0x1b')],function(_0x2f6593){return{'model':db[_0x2f6593['model']],'as':_0x2f6593['as'],'attributes':_0x2f6593[_0x3f05('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3f05('0x1e')](function(_0x462871){logger[_0x3f05('0xc')](_0x3f05('0x15'),_0x9dc0bb);logger[_0x3f05('0xe')]('GetTrigger',_0x9dc0bb,JSON[_0x3f05('0x11')](_0x462871));_0x5dd944(_0x462871);})[_0x3f05('0x1f')](function(_0x559056){logger['error'](_0x3f05('0x15'),_0x559056[_0x3f05('0x14')],_0x9dc0bb);_0x4235cf(_0x42f13e[_0x3f05('0x12')](0x1f4,_0x559056[_0x3f05('0x14')]));});});};exports['ShowTrigger']=function(_0x44d004){var _0x4a290d=this;return new Promise(function(_0x22e1bb,_0x587b55){return db[_0x3f05('0x20')][_0x3f05('0x21')]({'raw':_0x44d004[_0x3f05('0x16')]?_0x44d004[_0x3f05('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x44d004[_0x3f05('0x16')]?_0x44d004[_0x3f05('0x16')]['where']||null:null,'attributes':_0x44d004['options']?_0x44d004[_0x3f05('0x16')][_0x3f05('0x19')]||null:null,'include':_0x44d004[_0x3f05('0x16')]?_0x44d004[_0x3f05('0x16')][_0x3f05('0x1b')]?_['map'](_0x44d004[_0x3f05('0x16')]['include'],function(_0x5306ac){return{'model':db[_0x5306ac[_0x3f05('0x1d')]],'as':_0x5306ac['as'],'attributes':_0x5306ac[_0x3f05('0x19')],'include':_0x5306ac[_0x3f05('0x1b')]?_[_0x3f05('0x1c')](_0x5306ac[_0x3f05('0x1b')],function(_0x4996e8){return{'model':db[_0x4996e8['model']],'as':_0x4996e8['as'],'attributes':_0x4996e8['attributes'],'include':_0x4996e8[_0x3f05('0x1b')]?_[_0x3f05('0x1c')](_0x4996e8[_0x3f05('0x1b')],function(_0x35fa2d){return{'model':db[_0x35fa2d[_0x3f05('0x1d')]],'as':_0x35fa2d['as'],'attributes':_0x35fa2d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f05('0x1e')](function(_0x5dcea3){logger[_0x3f05('0xc')](_0x3f05('0x22'),_0x44d004);logger[_0x3f05('0xe')]('ShowTrigger',_0x44d004,JSON['stringify'](_0x5dcea3));_0x22e1bb(_0x5dcea3);})[_0x3f05('0x1f')](function(_0x21bf3e){logger[_0x3f05('0x12')](_0x3f05('0x22'),_0x21bf3e[_0x3f05('0x14')],_0x44d004);_0x587b55(_0x4a290d[_0x3f05('0x12')](0x1f4,_0x21bf3e[_0x3f05('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e2e4476..34d7d4c 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 _0x9a5e=['put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','index','get','/:id','isAuthenticated','show','post','/:id/clone','clone','create'];(function(_0x23a16e,_0x452f3d){var _0x3bff75=function(_0x5c079d){while(--_0x5c079d){_0x23a16e['push'](_0x23a16e['shift']());}};_0x3bff75(++_0x452f3d);}(_0x9a5e,0xab));var _0xe9a5=function(_0x12c4cf,_0x51b614){_0x12c4cf=_0x12c4cf-0x0;var _0x34db23=_0x9a5e[_0x12c4cf];return _0x34db23;};'use strict';var multer=require(_0xe9a5('0x0'));var util=require(_0xe9a5('0x1'));var path=require(_0xe9a5('0x2'));var timeout=require(_0xe9a5('0x3'));var express=require(_0xe9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xe9a5('0x5'));var auth=require(_0xe9a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe9a5('0x7'));var controller=require(_0xe9a5('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe9a5('0x9')]);router[_0xe9a5('0xa')](_0xe9a5('0xb'),auth[_0xe9a5('0xc')](),controller[_0xe9a5('0xd')]);router[_0xe9a5('0xe')](_0xe9a5('0xf'),auth[_0xe9a5('0xc')](),controller[_0xe9a5('0x10')]);router[_0xe9a5('0xe')]('/',auth['isAuthenticated'](),controller[_0xe9a5('0x11')]);router[_0xe9a5('0x12')](_0xe9a5('0xb'),auth[_0xe9a5('0xc')](),controller[_0xe9a5('0x13')]);router[_0xe9a5('0x14')]('/:id',auth[_0xe9a5('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x54aa=['clone','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/clone'];(function(_0x5a781f,_0x19a976){var _0x33ebba=function(_0xd3b732){while(--_0xd3b732){_0x5a781f['push'](_0x5a781f['shift']());}};_0x33ebba(++_0x19a976);}(_0x54aa,0x182));var _0xa54a=function(_0x309fb2,_0x3b062d){_0x309fb2=_0x309fb2-0x0;var _0x14f3c6=_0x54aa[_0x309fb2];return _0x14f3c6;};'use strict';var multer=require('multer');var util=require(_0xa54a('0x0'));var path=require(_0xa54a('0x1'));var timeout=require(_0xa54a('0x2'));var express=require('express');var router=express[_0xa54a('0x3')]();var fs_extra=require(_0xa54a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa54a('0x5'));var config=require(_0xa54a('0x6'));var controller=require('./trunk.controller');router[_0xa54a('0x7')]('/',auth['isAuthenticated'](),controller[_0xa54a('0x8')]);router[_0xa54a('0x7')](_0xa54a('0x9'),auth[_0xa54a('0xa')](),controller[_0xa54a('0xb')]);router['post'](_0xa54a('0xc'),auth[_0xa54a('0xa')](),controller[_0xa54a('0xd')]);router[_0xa54a('0xe')]('/',auth['isAuthenticated'](),controller[_0xa54a('0xf')]);router[_0xa54a('0x10')]('/:id',auth[_0xa54a('0xa')](),controller[_0xa54a('0x11')]);router[_0xa54a('0x12')](_0xa54a('0x9'),auth['isAuthenticated'](),controller[_0xa54a('0x13')]);module[_0xa54a('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 5c241b0..a87660a 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 _0x3f46=['ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','update','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','setDataValue','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','actpass','dynamic','nonat','update,nonat','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3f46,0x1de));var _0x63f4=function(_0x165453,_0x5c5102){_0x165453=_0x165453-0x0;var _0x2775c4=_0x3f46[_0x165453];return _0x2775c4;};'use strict';var Sequelize=require('sequelize');module[_0x63f4('0x0')]={'name':{'type':Sequelize[_0x63f4('0x1')],'allowNull':![],'unique':_0x63f4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x4'),_0x63f4('0x5'),_0x63f4('0x6')),'allowNull':![],'defaultValue':_0x63f4('0x4')},'context':{'type':Sequelize[_0x63f4('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x7'),_0x63f4('0x8'),_0x63f4('0x9'),_0x63f4('0xa'),_0x63f4('0xb'),'PROHIB_PASSED_SCREEN',_0x63f4('0xc'),_0x63f4('0xd'))},'deny':{'type':Sequelize[_0x63f4('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x63f4('0x1')]},'md5secret':{'type':Sequelize[_0x63f4('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':_0x63f4('0xe'),'set':function(_0x518473){this['setDataValue']('transport',_0x518473?_0x518473[_0x63f4('0xf')](','):null);},'get':function(){return this[_0x63f4('0x10')](_0x63f4('0x11'))?this[_0x63f4('0x10')](_0x63f4('0x11'))['split'](','):null;},'comment':_0x63f4('0x12')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x63f4('0x13'),_0x63f4('0x14'),_0x63f4('0x15'),_0x63f4('0x16')),'defaultValue':_0x63f4('0x17')},'directmedia':{'type':Sequelize[_0x63f4('0x3')]('yes','no','nonat',_0x63f4('0x18'),_0x63f4('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x63f4('0x1')]},'nat':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':_0x63f4('0x1b'),'set':function(_0x3dc89a){this['setDataValue'](_0x63f4('0x1c'),_0x3dc89a?_0x3dc89a[_0x63f4('0xf')](','):null);},'get':function(){return this[_0x63f4('0x10')](_0x63f4('0x1c'))?this['getDataValue']('nat')[_0x63f4('0x1d')](','):null;},'comment':_0x63f4('0x1e')},'callgroup':{'type':Sequelize[_0x63f4('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x63f4('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x63f4('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x63f4('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x56119d){this[_0x63f4('0x1f')](_0x63f4('0x20'),_0x56119d?_0x56119d[_0x63f4('0xf')](';'):_0x63f4('0x21'));},'get':function(){return this[_0x63f4('0x10')](_0x63f4('0x20'))?this[_0x63f4('0x10')](_0x63f4('0x20'))[_0x63f4('0x1d')](';'):null;},'comment':_0x63f4('0x22')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':_0x63f4('0x23'),'set':function(_0x17ba9d){this[_0x63f4('0x1f')](_0x63f4('0x24'),_0x17ba9d?_0x17ba9d['join'](','):null);},'get':function(){return this[_0x63f4('0x10')](_0x63f4('0x24'))?this['getDataValue'](_0x63f4('0x24'))[_0x63f4('0x1d')](','):null;},'comment':_0x63f4('0x25')},'trustrpid':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no',_0x63f4('0x26'))},'promiscredir':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x63f4('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':_0x63f4('0x28')},'amaflags':{'type':Sequelize[_0x63f4('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no'),'defaultValue':_0x63f4('0x1a')},'busylevel':{'type':Sequelize[_0x63f4('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x63f4('0x1')]},'template':{'type':Sequelize[_0x63f4('0x1')]},'videosupport':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no',_0x63f4('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x63f4('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x63f4('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x63f4('0x2a'),_0x63f4('0x2b'),_0x63f4('0x2c'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x63f4('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x2d'),_0x63f4('0x2e')),'defaultValue':_0x63f4('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0x63f4('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x63f4('0x27')](0x5)},'qualify':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no'),'defaultValue':_0x63f4('0x1a')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x63f4('0x1')]},'rtptimeout':{'type':Sequelize[_0x63f4('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x63f4('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x63f4('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x63f4('0x3')]('yes','no',_0x63f4('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x63f4('0x1')]},'callbackextension':{'type':Sequelize[_0x63f4('0x1')]},'timert1':{'type':Sequelize[_0x63f4('0x27')](0xb)},'timerb':{'type':Sequelize[_0x63f4('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x63f4('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x63f4('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x63f4('0x1')]},'use_q850_reason':{'type':Sequelize[_0x63f4('0x1')]},'maxforwards':{'type':Sequelize[_0x63f4('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x63f4('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no',_0x63f4('0x30'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x63f4('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x63f4('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x63f4('0x1')]},'dtlscafile':{'type':Sequelize[_0x63f4('0x1')]},'dtlscapath':{'type':Sequelize[_0x63f4('0x1')]},'dtlssetup':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x31'),'passive',_0x63f4('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x63f4('0x1')]},'usereqphone':{'type':Sequelize[_0x63f4('0x3')](_0x63f4('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x63f4('0x1')]},'recordofffeature':{'type':Sequelize[_0x63f4('0x1')]},'call_limit':{'type':Sequelize[_0x63f4('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x63f4('0x1')]},'mohinterpret':{'type':Sequelize[_0x63f4('0x1')]},'mohsuggest':{'type':Sequelize[_0x63f4('0x1')]},'parkinglot':{'type':Sequelize[_0x63f4('0x1')]},'description':{'type':Sequelize[_0x63f4('0x1')]},'host':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':_0x63f4('0x33')},'canreinvite':{'type':Sequelize[_0x63f4('0x3')]('yes','no',_0x63f4('0x34'),_0x63f4('0x18'),_0x63f4('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x63f4('0x1')]},'otherFields':{'type':Sequelize[_0x63f4('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x63f4('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4453=['outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','getDataValue','transport','split','rfc2833','info','shortinfo','inband','auto','yes','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4453,0x15e));var _0x3445=function(_0x489bca,_0x28c593){_0x489bca=_0x489bca-0x0;var _0x41960f=_0x4453[_0x489bca];return _0x41960f;};'use strict';var Sequelize=require(_0x3445('0x0'));module[_0x3445('0x1')]={'name':{'type':Sequelize[_0x3445('0x2')],'allowNull':![],'unique':_0x3445('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x5'),_0x3445('0x6'),_0x3445('0x7')),'allowNull':![],'defaultValue':_0x3445('0x5')},'context':{'type':Sequelize[_0x3445('0x2')],'allowNull':![],'defaultValue':_0x3445('0x8')},'callingpres':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x9'),_0x3445('0xa'),_0x3445('0xb'),_0x3445('0xc'),_0x3445('0xd'),'PROHIB_PASSED_SCREEN',_0x3445('0xe'),_0x3445('0xf'))},'deny':{'type':Sequelize[_0x3445('0x2')]},'permit':{'type':Sequelize[_0x3445('0x2')]},'secret':{'type':Sequelize[_0x3445('0x2')]},'md5secret':{'type':Sequelize[_0x3445('0x2')]},'remotesecret':{'type':Sequelize[_0x3445('0x2')]},'transport':{'type':Sequelize[_0x3445('0x2')],'defaultValue':'udp','set':function(_0x2d4205){this[_0x3445('0x10')]('transport',_0x2d4205?_0x2d4205[_0x3445('0x11')](','):null);},'get':function(){return this[_0x3445('0x12')](_0x3445('0x13'))?this['getDataValue'](_0x3445('0x13'))[_0x3445('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x15'),_0x3445('0x16'),_0x3445('0x17'),_0x3445('0x18'),_0x3445('0x19')),'defaultValue':_0x3445('0x15')},'directmedia':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no','nonat',_0x3445('0x1b'),_0x3445('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3445('0x2')]},'directmediadeny':{'type':Sequelize[_0x3445('0x2')]},'nat':{'type':Sequelize[_0x3445('0x2')],'defaultValue':_0x3445('0x1d'),'set':function(_0x4e4d9b){this[_0x3445('0x10')](_0x3445('0x1e'),_0x4e4d9b?_0x4e4d9b[_0x3445('0x11')](','):null);},'get':function(){return this[_0x3445('0x12')]('nat')?this[_0x3445('0x12')](_0x3445('0x1e'))[_0x3445('0x14')](','):null;},'comment':_0x3445('0x1f')},'callgroup':{'type':Sequelize[_0x3445('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3445('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3445('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3445('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3445('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3445('0x2')],'allowNull':![],'defaultValue':_0x3445('0x20'),'set':function(_0x4c59e9){this[_0x3445('0x10')]('allow',_0x4c59e9?_0x4c59e9['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3445('0x12')]('allow')?this[_0x3445('0x12')]('allow')[_0x3445('0x14')](';'):null;},'comment':_0x3445('0x21')},'autoframing':{'type':Sequelize[_0x3445('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x3445('0x22'),'set':function(_0x5cf579){this[_0x3445('0x10')]('insecure',_0x5cf579?_0x5cf579[_0x3445('0x11')](','):null);},'get':function(){return this[_0x3445('0x12')](_0x3445('0x23'))?this[_0x3445('0x12')](_0x3445('0x23'))[_0x3445('0x14')](','):null;},'comment':_0x3445('0x24')},'trustrpid':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x3445('0x1a'),'no',_0x3445('0x25'))},'promiscredir':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x3445('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3445('0x2')]},'callerid':{'type':Sequelize[_0x3445('0x2')],'defaultValue':_0x3445('0x26')},'amaflags':{'type':Sequelize[_0x3445('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x3445('0x1a'),'no'),'defaultValue':_0x3445('0x1a')},'busylevel':{'type':Sequelize[_0x3445('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x3445('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3445('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x3445('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x3445('0x29'),_0x3445('0x2a'),_0x3445('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x3445('0x2c'),_0x3445('0x2d')),'defaultValue':_0x3445('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x3445('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x3445('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3445('0x27')](0x5)},'qualify':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no'),'defaultValue':_0x3445('0x1a')},'keepalive':{'type':Sequelize[_0x3445('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x3445('0x2')]},'defaultuser':{'type':Sequelize[_0x3445('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3445('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3445('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no',_0x3445('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3445('0x2')]},'callbackextension':{'type':Sequelize[_0x3445('0x2')]},'timert1':{'type':Sequelize[_0x3445('0x27')](0xb)},'timerb':{'type':Sequelize[_0x3445('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3445('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3445('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3445('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3445('0x2')]},'maxforwards':{'type':Sequelize[_0x3445('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x3445('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x3445('0x4')](_0x3445('0x1a'),'no',_0x3445('0x2f'),_0x3445('0x30'))},'dtlsrekey':{'type':Sequelize[_0x3445('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3445('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3445('0x2')]},'dtlscafile':{'type':Sequelize[_0x3445('0x2')]},'dtlscapath':{'type':Sequelize[_0x3445('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3445('0x31'),_0x3445('0x32'),_0x3445('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3445('0x2')]},'usereqphone':{'type':Sequelize[_0x3445('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3445('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x3445('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x3445('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x3445('0x2')]},'mohinterpret':{'type':Sequelize[_0x3445('0x2')]},'mohsuggest':{'type':Sequelize[_0x3445('0x2')]},'parkinglot':{'type':Sequelize[_0x3445('0x2')]},'description':{'type':Sequelize[_0x3445('0x2')]},'host':{'type':Sequelize[_0x3445('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x3445('0x34'),_0x3445('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3445('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3445('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3445('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 702b156..60806fb 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','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','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x47d40b,_0x5ecedf){var _0x522cbd=function(_0x3f85a2){while(--_0x3f85a2){_0x47d40b['push'](_0x47d40b['shift']());}};_0x522cbd(++_0x5ecedf);}(_0x55ca,0x126));var _0xa55c=function(_0x39628c,_0x2eb8c4){_0x39628c=_0x39628c-0x0;var _0x2b0532=_0x55ca[_0x39628c];return _0x2b0532;};'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'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x9bde,0xe1));var _0xe9bd=function(_0x363f26,_0x41b475){_0x363f26=_0x363f26-0x0;var _0x1dcc2e=_0x9bde[_0x363f26];return _0x1dcc2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 659d962..7f0ecf3 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 _0x38a7=['../../config/environment','./trunk.attributes','Trunk','tools_trunks','util','api','bluebird','path','rimraf'];(function(_0x28c132,_0x1f5027){var _0x12109d=function(_0x51723c){while(--_0x51723c){_0x28c132['push'](_0x28c132['shift']());}};_0x12109d(++_0x1f5027);}(_0x38a7,0xf7));var _0x738a=function(_0x419ebe,_0xad321a){_0x419ebe=_0x419ebe-0x0;var _0x49013f=_0x38a7[_0x419ebe];return _0x49013f;};'use strict';var _=require('lodash');var util=require(_0x738a('0x0'));var logger=require('../../config/logger')(_0x738a('0x1'));var moment=require('moment');var BPromise=require(_0x738a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x738a('0x3'));var rimraf=require(_0x738a('0x4'));var config=require(_0x738a('0x5'));var attributes=require(_0x738a('0x6'));module['exports']=function(_0x25a21a,_0x1a4775){return _0x25a21a['define'](_0x738a('0x7'),attributes,{'tableName':_0x738a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a30=['exports','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x2f888d,_0x597d3c){var _0x40f285=function(_0x225c27){while(--_0x225c27){_0x2f888d['push'](_0x2f888d['shift']());}};_0x40f285(++_0x597d3c);}(_0x3a30,0x120));var _0x03a3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3a30[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x03a3('0x0'));var util=require(_0x03a3('0x1'));var logger=require(_0x03a3('0x2'))(_0x03a3('0x3'));var moment=require(_0x03a3('0x4'));var BPromise=require(_0x03a3('0x5'));var rp=require(_0x03a3('0x6'));var fs=require('fs');var path=require(_0x03a3('0x7'));var rimraf=require(_0x03a3('0x8'));var config=require(_0x03a3('0x9'));var attributes=require(_0x03a3('0xa'));module[_0x03a3('0xb')]=function(_0x39b1e2,_0x562b7f){return _0x39b1e2['define'](_0x03a3('0xc'),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 8830013..0905e5d 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 _0xf49e=['model','catch','ShowTrunk','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','Trunk','findAll','raw','options','where','include','map','attributes'];(function(_0x16e0f5,_0x4ec0f3){var _0x4839d5=function(_0x296b8f){while(--_0x296b8f){_0x16e0f5['push'](_0x16e0f5['shift']());}};_0x4839d5(++_0x4ec0f3);}(_0xf49e,0xd0));var _0xef49=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xf49e[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xef49('0x0'));var util=require('util');var moment=require(_0xef49('0x1'));var BPromise=require(_0xef49('0x2'));var rs=require(_0xef49('0x3'));var fs=require('fs');var Redis=require(_0xef49('0x4'));var db=require(_0xef49('0x5'))['db'];var utils=require(_0xef49('0x6'));var logger=require('../../config/logger')(_0xef49('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef49('0x8')][_0xef49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193c57,_0x24d386,_0x4e7382){return new BPromise(function(_0xad5f38,_0x2ad7a6){return client['request'](_0x193c57,_0x4e7382)[_0xef49('0xa')](function(_0xdae248){logger[_0xef49('0xb')](_0xef49('0xc'),_0x24d386,_0xef49('0xd'));logger[_0xef49('0xe')](_0xef49('0xf'),_0x24d386,'request\x20sent',JSON[_0xef49('0x10')](_0xdae248));if(_0xdae248[_0xef49('0x11')]){if(_0xdae248['error'][_0xef49('0x12')]===0x1f4){logger[_0xef49('0x11')](_0xef49('0xc'),_0x24d386,_0xdae248[_0xef49('0x11')][_0xef49('0x13')]);return _0x2ad7a6(_0xdae248[_0xef49('0x11')][_0xef49('0x13')]);}logger[_0xef49('0x11')](_0xef49('0xc'),_0x24d386,_0xdae248[_0xef49('0x11')][_0xef49('0x13')]);return _0xad5f38(_0xdae248[_0xef49('0x11')]['message']);}else{logger[_0xef49('0xb')]('Trunk,\x20%s,\x20%s',_0x24d386,_0xef49('0xd'));_0xad5f38(_0xdae248[_0xef49('0x14')][_0xef49('0x13')]);}})['catch'](function(_0x1fbdd0){logger[_0xef49('0x11')](_0xef49('0xc'),_0x24d386,_0x1fbdd0);_0x2ad7a6(_0x1fbdd0);});});}exports[_0xef49('0x15')]=function(_0xd0d3c6){var _0x1221a2=this;return new Promise(function(_0x3f7724,_0x44e901){return db[_0xef49('0x16')][_0xef49('0x17')]({'raw':_0xd0d3c6['options']?_0xd0d3c6['options'][_0xef49('0x18')]===undefined?!![]:![]:!![],'where':_0xd0d3c6[_0xef49('0x19')]?_0xd0d3c6[_0xef49('0x19')][_0xef49('0x1a')]||null:null,'attributes':_0xd0d3c6[_0xef49('0x19')]?_0xd0d3c6['options']['attributes']||null:null,'limit':_0xd0d3c6[_0xef49('0x19')]?_0xd0d3c6[_0xef49('0x19')]['limit']||null:null,'include':_0xd0d3c6[_0xef49('0x19')]?_0xd0d3c6[_0xef49('0x19')][_0xef49('0x1b')]?_[_0xef49('0x1c')](_0xd0d3c6['options'][_0xef49('0x1b')],function(_0x3376e4){return{'model':db[_0x3376e4['model']],'as':_0x3376e4['as'],'attributes':_0x3376e4[_0xef49('0x1d')],'include':_0x3376e4[_0xef49('0x1b')]?_[_0xef49('0x1c')](_0x3376e4[_0xef49('0x1b')],function(_0x2b8e78){return{'model':db[_0x2b8e78[_0xef49('0x1e')]],'as':_0x2b8e78['as'],'attributes':_0x2b8e78[_0xef49('0x1d')],'include':_0x2b8e78[_0xef49('0x1b')]?_[_0xef49('0x1c')](_0x2b8e78['include'],function(_0x11c8e5){return{'model':db[_0x11c8e5[_0xef49('0x1e')]],'as':_0x11c8e5['as'],'attributes':_0x11c8e5[_0xef49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xef49('0xa')](function(_0x155aff){logger[_0xef49('0xb')]('GetTrunk',_0xd0d3c6);logger[_0xef49('0xe')](_0xef49('0x15'),_0xd0d3c6,JSON[_0xef49('0x10')](_0x155aff));_0x3f7724(_0x155aff);})[_0xef49('0x1f')](function(_0x2872de){logger[_0xef49('0x11')]('GetTrunk',_0x2872de['message'],_0xd0d3c6);_0x44e901(_0x1221a2[_0xef49('0x11')](0x1f4,_0x2872de[_0xef49('0x13')]));});});};exports[_0xef49('0x20')]=function(_0x3ddac4){var _0x174e5e=this;return new Promise(function(_0x25b040,_0x14c5ae){return db['Trunk'][_0xef49('0x21')]({'raw':_0x3ddac4[_0xef49('0x19')]?_0x3ddac4[_0xef49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3ddac4['options']?_0x3ddac4['options'][_0xef49('0x1a')]||null:null,'attributes':_0x3ddac4[_0xef49('0x19')]?_0x3ddac4['options'][_0xef49('0x1d')]||null:null,'include':_0x3ddac4[_0xef49('0x19')]?_0x3ddac4[_0xef49('0x19')][_0xef49('0x1b')]?_['map'](_0x3ddac4['options'][_0xef49('0x1b')],function(_0x3f9e7b){return{'model':db[_0x3f9e7b[_0xef49('0x1e')]],'as':_0x3f9e7b['as'],'attributes':_0x3f9e7b[_0xef49('0x1d')],'include':_0x3f9e7b[_0xef49('0x1b')]?_[_0xef49('0x1c')](_0x3f9e7b[_0xef49('0x1b')],function(_0x1cae66){return{'model':db[_0x1cae66[_0xef49('0x1e')]],'as':_0x1cae66['as'],'attributes':_0x1cae66[_0xef49('0x1d')],'include':_0x1cae66[_0xef49('0x1b')]?_[_0xef49('0x1c')](_0x1cae66[_0xef49('0x1b')],function(_0x262bb9){return{'model':db[_0x262bb9[_0xef49('0x1e')]],'as':_0x262bb9['as'],'attributes':_0x262bb9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e59d1){logger['info']('ShowTrunk',_0x3ddac4);logger[_0xef49('0xe')](_0xef49('0x20'),_0x3ddac4,JSON[_0xef49('0x10')](_0x4e59d1));_0x25b040(_0x4e59d1);})['catch'](function(_0xf54914){logger[_0xef49('0x11')]('ShowTrunk',_0xf54914[_0xef49('0x13')],_0x3ddac4);_0x14c5ae(_0x174e5e[_0xef49('0x11')](0x1f4,_0xf54914['message']));});});}; \ No newline at end of file +var _0x8fa5=['then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','info','result','GetTrunk','findAll','options','where','attributes','limit','include','map','model','stringify','catch','Trunk','find','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x35b053,_0x5acba0){var _0x5d50ff=function(_0x39e522){while(--_0x39e522){_0x35b053['push'](_0x35b053['shift']());}};_0x5d50ff(++_0x5acba0);}(_0x8fa5,0x1a4));var _0x58fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fa5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x58fa('0x0'));var util=require(_0x58fa('0x1'));var moment=require(_0x58fa('0x2'));var BPromise=require(_0x58fa('0x3'));var rs=require(_0x58fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x58fa('0x5'))(_0x58fa('0x6'));var config=require(_0x58fa('0x7'));var jayson=require(_0x58fa('0x8'));var client=jayson[_0x58fa('0x9')][_0x58fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fb411,_0x41b71f,_0x4b20cf){return new BPromise(function(_0x4d7d10,_0x3f9993){return client[_0x58fa('0xb')](_0x3fb411,_0x4b20cf)[_0x58fa('0xc')](function(_0xaa5074){logger['info']('Trunk,\x20%s,\x20%s',_0x41b71f,_0x58fa('0xd'));logger[_0x58fa('0xe')](_0x58fa('0xf'),_0x41b71f,_0x58fa('0xd'),JSON['stringify'](_0xaa5074));if(_0xaa5074[_0x58fa('0x10')]){if(_0xaa5074[_0x58fa('0x10')][_0x58fa('0x11')]===0x1f4){logger[_0x58fa('0x10')](_0x58fa('0x12'),_0x41b71f,_0xaa5074[_0x58fa('0x10')]['message']);return _0x3f9993(_0xaa5074[_0x58fa('0x10')][_0x58fa('0x13')]);}logger[_0x58fa('0x10')](_0x58fa('0x12'),_0x41b71f,_0xaa5074['error'][_0x58fa('0x13')]);return _0x4d7d10(_0xaa5074[_0x58fa('0x10')][_0x58fa('0x13')]);}else{logger[_0x58fa('0x14')]('Trunk,\x20%s,\x20%s',_0x41b71f,_0x58fa('0xd'));_0x4d7d10(_0xaa5074[_0x58fa('0x15')]['message']);}})['catch'](function(_0xaff33b){logger[_0x58fa('0x10')](_0x58fa('0x12'),_0x41b71f,_0xaff33b);_0x3f9993(_0xaff33b);});});}exports[_0x58fa('0x16')]=function(_0x258ae1){var _0x309011=this;return new Promise(function(_0x40010,_0x15e940){return db['Trunk'][_0x58fa('0x17')]({'raw':_0x258ae1['options']?_0x258ae1[_0x58fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x258ae1[_0x58fa('0x18')]?_0x258ae1[_0x58fa('0x18')][_0x58fa('0x19')]||null:null,'attributes':_0x258ae1[_0x58fa('0x18')]?_0x258ae1[_0x58fa('0x18')][_0x58fa('0x1a')]||null:null,'limit':_0x258ae1[_0x58fa('0x18')]?_0x258ae1[_0x58fa('0x18')][_0x58fa('0x1b')]||null:null,'include':_0x258ae1[_0x58fa('0x18')]?_0x258ae1[_0x58fa('0x18')][_0x58fa('0x1c')]?_['map'](_0x258ae1['options'][_0x58fa('0x1c')],function(_0x3eedbe){return{'model':db[_0x3eedbe['model']],'as':_0x3eedbe['as'],'attributes':_0x3eedbe[_0x58fa('0x1a')],'include':_0x3eedbe[_0x58fa('0x1c')]?_[_0x58fa('0x1d')](_0x3eedbe['include'],function(_0x53c2ab){return{'model':db[_0x53c2ab[_0x58fa('0x1e')]],'as':_0x53c2ab['as'],'attributes':_0x53c2ab[_0x58fa('0x1a')],'include':_0x53c2ab[_0x58fa('0x1c')]?_[_0x58fa('0x1d')](_0x53c2ab[_0x58fa('0x1c')],function(_0x1b1375){return{'model':db[_0x1b1375['model']],'as':_0x1b1375['as'],'attributes':_0x1b1375[_0x58fa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28313a){logger['info'](_0x58fa('0x16'),_0x258ae1);logger[_0x58fa('0xe')](_0x58fa('0x16'),_0x258ae1,JSON[_0x58fa('0x1f')](_0x28313a));_0x40010(_0x28313a);})[_0x58fa('0x20')](function(_0x3e2b03){logger[_0x58fa('0x10')](_0x58fa('0x16'),_0x3e2b03[_0x58fa('0x13')],_0x258ae1);_0x15e940(_0x309011[_0x58fa('0x10')](0x1f4,_0x3e2b03[_0x58fa('0x13')]));});});};exports['ShowTrunk']=function(_0x13c203){var _0x34dbd9=this;return new Promise(function(_0x18af8f,_0x2f9ff9){return db[_0x58fa('0x21')][_0x58fa('0x22')]({'raw':_0x13c203['options']?_0x13c203[_0x58fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x13c203[_0x58fa('0x18')]?_0x13c203[_0x58fa('0x18')][_0x58fa('0x19')]||null:null,'attributes':_0x13c203[_0x58fa('0x18')]?_0x13c203[_0x58fa('0x18')]['attributes']||null:null,'include':_0x13c203[_0x58fa('0x18')]?_0x13c203[_0x58fa('0x18')][_0x58fa('0x1c')]?_[_0x58fa('0x1d')](_0x13c203[_0x58fa('0x18')]['include'],function(_0xe01771){return{'model':db[_0xe01771[_0x58fa('0x1e')]],'as':_0xe01771['as'],'attributes':_0xe01771['attributes'],'include':_0xe01771[_0x58fa('0x1c')]?_['map'](_0xe01771['include'],function(_0x19e3a7){return{'model':db[_0x19e3a7[_0x58fa('0x1e')]],'as':_0x19e3a7['as'],'attributes':_0x19e3a7[_0x58fa('0x1a')],'include':_0x19e3a7['include']?_['map'](_0x19e3a7[_0x58fa('0x1c')],function(_0x12ff5d){return{'model':db[_0x12ff5d[_0x58fa('0x1e')]],'as':_0x12ff5d['as'],'attributes':_0x12ff5d[_0x58fa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x58fa('0xc')](function(_0x4361fa){logger[_0x58fa('0x14')](_0x58fa('0x23'),_0x13c203);logger[_0x58fa('0xe')](_0x58fa('0x23'),_0x13c203,JSON['stringify'](_0x4361fa));_0x18af8f(_0x4361fa);})[_0x58fa('0x20')](function(_0x187b40){logger[_0x58fa('0x10')](_0x58fa('0x23'),_0x187b40[_0x58fa('0x13')],_0x13c203);_0x2f9ff9(_0x34dbd9['error'](0x1f4,_0x187b40['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e0326a6..2341b11 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 _0x0569=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','../../components/auth/service'];(function(_0x1f4c05,_0x99f8d2){var _0x3c74b5=function(_0x32bac1){while(--_0x32bac1){_0x1f4c05['push'](_0x1f4c05['shift']());}};_0x3c74b5(++_0x99f8d2);}(_0x0569,0x106));var _0x9056=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0x0569[_0x2891d1];return _0x486948;};'use strict';var express=require(_0x9056('0x0'));var router=express['Router']();var auth=require(_0x9056('0x1'));var controller=require(_0x9056('0x2'));router[_0x9056('0x3')](_0x9056('0x4'),auth[_0x9056('0x5')](),controller[_0x9056('0x6')]);module[_0x9056('0x7')]=router; \ No newline at end of file +var _0xa1d9=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','express'];(function(_0x73000c,_0x2d9e7d){var _0x5eee28=function(_0x326306){while(--_0x326306){_0x73000c['push'](_0x73000c['shift']());}};_0x5eee28(++_0x2d9e7d);}(_0xa1d9,0x177));var _0x9a1d=function(_0x11eec6,_0x52ee91){_0x11eec6=_0x11eec6-0x0;var _0x175a3a=_0xa1d9[_0x11eec6];return _0x175a3a;};'use strict';var express=require(_0x9a1d('0x0'));var router=express[_0x9a1d('0x1')]();var auth=require(_0x9a1d('0x2'));var controller=require(_0x9a1d('0x3'));router[_0x9a1d('0x4')](_0x9a1d('0x5'),auth[_0x9a1d('0x6')](),controller[_0x9a1d('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5f36cb2..f1d173f 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 _0xc82a=['error','warning','info','debug','ENUM','TEXT','DATE','UserId','sequelize'];(function(_0x4ae5c8,_0x27a9a6){var _0x37e613=function(_0x377c94){while(--_0x377c94){_0x4ae5c8['push'](_0x4ae5c8['shift']());}};_0x37e613(++_0x27a9a6);}(_0xc82a,0xc5));var _0xac82=function(_0x8051d7,_0x263ba9){_0x8051d7=_0x8051d7-0x0;var _0x3fb835=_0xc82a[_0x8051d7];return _0x3fb835;};'use strict';var Sequelize=require(_0xac82('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xac82('0x1'),_0xac82('0x2'),_0xac82('0x3'),_0xac82('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xac82('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xac82('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xac82('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xac82('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xac82('0x8')}}; \ No newline at end of file +var _0xeeb2=['info','exports','BOOLEAN','DATE','UserId','sequelize','error','warning'];(function(_0x3ee4d1,_0x35cbfd){var _0x24b28a=function(_0x5a60d4){while(--_0x5a60d4){_0x3ee4d1['push'](_0x3ee4d1['shift']());}};_0x24b28a(++_0x35cbfd);}(_0xeeb2,0x85));var _0x2eeb=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0xeeb2[_0x4f32de];return _0x149821;};'use strict';var Sequelize=require(_0x2eeb('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x2eeb('0x1'),_0x2eeb('0x2'),_0x2eeb('0x3'),'debug'];module[_0x2eeb('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2eeb('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2eeb('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2eeb('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x2eeb('0x7')}}; \ 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 dcc9bb8..43eb295 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 _0xa276=['UserSetting','find','body','catch','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','update','then','sendStatus','error','stack','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xa276,0x9a));var _0x6a27=function(_0x3c30de,_0x4a32ae){_0x3c30de=_0x3c30de-0x0;var _0x586d18=_0xa276[_0x3c30de];return _0x586d18;};'use strict';var _=require('lodash');var Redis=require(_0x6a27('0x0'));var logger=require(_0x6a27('0x1'))('api');var config=require(_0x6a27('0x2'));var db=require(_0x6a27('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x6a27('0x4')]));require(_0x6a27('0x5'))[_0x6a27('0x6')](socket);config['redis']=_[_0x6a27('0x7')](config[_0x6a27('0x4')],{'host':_0x6a27('0x8'),'port':0x18eb});function respondWithResult(_0x57b4bd,_0x38d674){_0x38d674=_0x38d674||0xc8;return function(_0x55cd2c){if(_0x55cd2c){return _0x57b4bd['status'](_0x38d674)['json'](_0x55cd2c);}};}function saveUpdates(_0x5bfa6d){return function(_0x35e206){if(_0x35e206){return _0x35e206[_0x6a27('0x9')](_0x5bfa6d)[_0x6a27('0xa')](function(_0x48bda4){return _0x48bda4;});}return null;};}function handleEntityNotFound(_0x555609){return function(_0x1a1a32){if(!_0x1a1a32){_0x555609[_0x6a27('0xb')](0x194);}return _0x1a1a32;};}function handleError(_0x15f5bf,_0x19fa46){_0x19fa46=_0x19fa46||0x1f4;return function(_0xe29c5f){logger[_0x6a27('0xc')](_0xe29c5f[_0x6a27('0xd')]);if(_0xe29c5f[_0x6a27('0xe')]){delete _0xe29c5f[_0x6a27('0xe')];}_0x15f5bf['status'](_0x19fa46)[_0x6a27('0xf')](_0xe29c5f);};}exports['update']=function(_0x4f5ce4,_0x2c7339){if(_0x4f5ce4[_0x6a27('0x10')][_0x6a27('0x11')]!=='admin')throw new Error(_0x6a27('0x12'));if(isNaN(Number(_0x4f5ce4[_0x6a27('0x13')]['id'])))throw new Error(_0x6a27('0x14'));return db[_0x6a27('0x15')][_0x6a27('0x16')]({'where':{'id':_0x4f5ce4['params']['id']}})['then'](handleEntityNotFound(_0x2c7339,null))[_0x6a27('0xa')](saveUpdates(_0x4f5ce4[_0x6a27('0x17')],null))[_0x6a27('0xa')](respondWithResult(_0x2c7339,null))[_0x6a27('0x18')](handleError(_0x2c7339,null));}; \ No newline at end of file +var _0x9b9b=['ioredis','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','then','sendStatus','error','stack','name','send','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x454251,_0x147347){var _0x26f1eb=function(_0x57bc54){while(--_0x57bc54){_0x454251['push'](_0x454251['shift']());}};_0x26f1eb(++_0x147347);}(_0x9b9b,0x114));var _0xb9b9=function(_0x1fec86,_0x422ed7){_0x1fec86=_0x1fec86-0x0;var _0x55e897=_0x9b9b[_0x1fec86];return _0x55e897;};'use strict';var _=require('lodash');var Redis=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var config=require(_0xb9b9('0x1'));var db=require(_0xb9b9('0x2'))['db'];var socket=require(_0xb9b9('0x3'))(new Redis(config[_0xb9b9('0x4')]));require(_0xb9b9('0x5'))[_0xb9b9('0x6')](socket);config[_0xb9b9('0x4')]=_[_0xb9b9('0x7')](config[_0xb9b9('0x4')],{'host':_0xb9b9('0x8'),'port':0x18eb});function respondWithResult(_0x85eec,_0x3ef9c1){_0x3ef9c1=_0x3ef9c1||0xc8;return function(_0x5be5bc){if(_0x5be5bc){return _0x85eec[_0xb9b9('0x9')](_0x3ef9c1)[_0xb9b9('0xa')](_0x5be5bc);}};}function saveUpdates(_0x319bb8){return function(_0x485810){if(_0x485810){return _0x485810['update'](_0x319bb8)[_0xb9b9('0xb')](function(_0x139301){return _0x139301;});}return null;};}function handleEntityNotFound(_0x127d29){return function(_0x47fe6d){if(!_0x47fe6d){_0x127d29[_0xb9b9('0xc')](0x194);}return _0x47fe6d;};}function handleError(_0x3b6bb9,_0x1122bb){_0x1122bb=_0x1122bb||0x1f4;return function(_0x4d8856){logger[_0xb9b9('0xd')](_0x4d8856[_0xb9b9('0xe')]);if(_0x4d8856[_0xb9b9('0xf')]){delete _0x4d8856[_0xb9b9('0xf')];}_0x3b6bb9[_0xb9b9('0x9')](_0x1122bb)[_0xb9b9('0x10')](_0x4d8856);};}exports['update']=function(_0x539449,_0x37c0e9){if(_0x539449['user'][_0xb9b9('0x11')]!=='admin')throw new Error(_0xb9b9('0x12'));if(isNaN(Number(_0x539449[_0xb9b9('0x13')]['id'])))throw new Error(_0xb9b9('0x14'));return db[_0xb9b9('0x15')][_0xb9b9('0x16')]({'where':{'id':_0x539449[_0xb9b9('0x13')]['id']}})[_0xb9b9('0xb')](handleEntityNotFound(_0x37c0e9,null))[_0xb9b9('0xb')](saveUpdates(_0x539449['body'],null))[_0xb9b9('0xb')](respondWithResult(_0x37c0e9,null))['catch'](handleError(_0x37c0e9,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 7a78dae..bda00d2 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 _0x5e9e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x5f2b64,_0x5a8972){var _0x4b2766=function(_0x85e0c8){while(--_0x85e0c8){_0x5f2b64['push'](_0x5f2b64['shift']());}};_0x4b2766(++_0x5a8972);}(_0x5e9e,0x168));var _0xe5e9=function(_0x551f6e,_0x4b6328){_0x551f6e=_0x551f6e-0x0;var _0x422780=_0x5e9e[_0x551f6e];return _0x422780;};'use strict';var EventEmitter=require(_0xe5e9('0x0'));var UserSetting=require(_0xe5e9('0x1'))['db'][_0xe5e9('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe5e9('0x3')](0x0);var events={'afterCreate':_0xe5e9('0x4'),'afterUpdate':_0xe5e9('0x5'),'afterDestroy':_0xe5e9('0x6')};function emitEvent(_0x6f352a){return function(_0x19b075,_0xec2fb0,_0x2d785e){UserSettingEvents['emit'](_0x6f352a+':'+_0x19b075['id'],_0x19b075);UserSettingEvents[_0xe5e9('0x7')](_0x6f352a,_0x19b075);_0x2d785e(null);};}for(var e in events){if(events[_0xe5e9('0x8')](e)){var event=events[e];UserSetting[_0xe5e9('0x9')](e,emitEvent(event));}}module[_0xe5e9('0xa')]=UserSettingEvents; \ No newline at end of file +var _0x1d53=['UserSetting','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46c70c,_0x1b8925){var _0x452ecb=function(_0x5c1129){while(--_0x5c1129){_0x46c70c['push'](_0x46c70c['shift']());}};_0x452ecb(++_0x1b8925);}(_0x1d53,0x1b6));var _0x31d5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1d53[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0x31d5('0x0'));var UserSetting=require(_0x31d5('0x1'))['db'][_0x31d5('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31d5('0x3'),'afterUpdate':_0x31d5('0x4'),'afterDestroy':_0x31d5('0x5')};function emitEvent(_0xae6772){return function(_0x330996,_0x3ef064,_0x4f7dd7){UserSettingEvents[_0x31d5('0x6')](_0xae6772+':'+_0x330996['id'],_0x330996);UserSettingEvents['emit'](_0xae6772,_0x330996);_0x4f7dd7(null);};}for(var e in events){if(events[_0x31d5('0x7')](e)){var event=events[e];UserSetting[_0x31d5('0x8')](e,emitEvent(event));}}module[_0x31d5('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 8df87b2..2b0c2dc 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 _0x71f4=['clientSideLoggingEnabledSince','define','UserSetting','user_settings'];(function(_0x79e983,_0x4e5b48){var _0x1a7049=function(_0xb25a34){while(--_0xb25a34){_0x79e983['push'](_0x79e983['shift']());}};_0x1a7049(++_0x4e5b48);}(_0x71f4,0xf9));var _0x471f=function(_0x5d6b9f,_0x382e90){_0x5d6b9f=_0x5d6b9f-0x0;var _0x13dea6=_0x71f4[_0x5d6b9f];return _0x13dea6;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x30e070){return _0x30e070[_0x471f('0x0')](_0x471f('0x1'),attributes,{'tableName':_0x471f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa4e901){if(!_0xa4e901['clientSideLoggingEnabled'])_0xa4e901[_0x471f('0x3')]=null;else if(_0xa4e901['clientSideLoggingEnabledSince']===null)_0xa4e901[_0x471f('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x3495=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3495,0x1de));var _0x5349=function(_0x22fa3e,_0x2467ff){_0x22fa3e=_0x22fa3e-0x0;var _0x155387=_0x3495[_0x22fa3e];return _0x155387;};'use strict';var attributes=require(_0x5349('0x0'));module[_0x5349('0x1')]=function(_0x975665){return _0x975665[_0x5349('0x2')](_0x5349('0x3'),attributes,{'tableName':_0x5349('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e91c4){if(!_0x2e91c4[_0x5349('0x5')])_0x2e91c4[_0x5349('0x6')]=null;else if(_0x2e91c4['clientSideLoggingEnabledSince']===null)_0x2e91c4[_0x5349('0x6')]=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 82e44d7..6387218 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 _0x692c=['user-setting:update','user-setting:update:user-','UserId','register','user-setting:','remove','update'];(function(_0x4cb01c,_0x352f09){var _0x301e9d=function(_0x1db742){while(--_0x1db742){_0x4cb01c['push'](_0x4cb01c['shift']());}};_0x301e9d(++_0x352f09);}(_0x692c,0x186));var _0xc692=function(_0x23fbb0,_0x14a77d){_0x23fbb0=_0x23fbb0-0x0;var _0x1f1096=_0x692c[_0x23fbb0];return _0x1f1096;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xc692('0x0'),_0xc692('0x1')];function createListener(_0x113bf5,_0x51b956){return function(_0x401b76){_0x51b956['emit'](_0x113bf5,_0x401b76);if(_0x113bf5===_0xc692('0x2')){_0x51b956['emit'](_0xc692('0x3')+_0x401b76[_0xc692('0x4')],_0x401b76);}};}exports[_0xc692('0x5')]=function(_0x943776){for(var _0x310ebf=0x0,_0x23cdac=events['length'];_0x310ebf<_0x23cdac;_0x310ebf++){var _0x28dbee=events[_0x310ebf];var _0x589490=createListener(_0xc692('0x6')+_0x28dbee,_0x943776);UserSettingEvents['on'](_0x28dbee,_0x589490);}}; \ No newline at end of file +var _0xfcd2=['update','emit','user-setting:update','UserId','register','user-setting:','./user-setting.events','save','remove'];(function(_0x2157ac,_0x1cb6bf){var _0x48d77a=function(_0x5deef1){while(--_0x5deef1){_0x2157ac['push'](_0x2157ac['shift']());}};_0x48d77a(++_0x1cb6bf);}(_0xfcd2,0x1c8));var _0x2fcd=function(_0x57deca,_0x25d587){_0x57deca=_0x57deca-0x0;var _0x23a464=_0xfcd2[_0x57deca];return _0x23a464;};'use strict';var UserSettingEvents=require(_0x2fcd('0x0'));var events=[_0x2fcd('0x1'),_0x2fcd('0x2'),_0x2fcd('0x3')];function createListener(_0x4f8667,_0x53fa51){return function(_0x2cd054){_0x53fa51[_0x2fcd('0x4')](_0x4f8667,_0x2cd054);if(_0x4f8667===_0x2fcd('0x5')){_0x53fa51[_0x2fcd('0x4')]('user-setting:update:user-'+_0x2cd054[_0x2fcd('0x6')],_0x2cd054);}};}exports[_0x2fcd('0x7')]=function(_0x2a384c){for(var _0x23f7f4=0x0,_0x408ba8=events['length'];_0x23f7f4<_0x408ba8;_0x23f7f4++){var _0x5899e1=events[_0x23f7f4];var _0x12c0c3=createListener(_0x2fcd('0x8')+_0x5899e1,_0x2a384c);UserSettingEvents['on'](_0x5899e1,_0x12c0c3);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3469727..6ada4ee 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 _0x73b0=['changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','bulkCreate','diskStorage','join','root','server/files/images/','format','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','update','put','/:id/password'];(function(_0x40cd27,_0x3f5e57){var _0x562821=function(_0x227c59){while(--_0x227c59){_0x40cd27['push'](_0x40cd27['shift']());}};_0x562821(++_0x3f5e57);}(_0x73b0,0x162));var _0x073b=function(_0x583fb3,_0x13dc40){_0x583fb3=_0x583fb3-0x0;var _0x15cf56=_0x73b0[_0x583fb3];return _0x15cf56;};'use strict';var multer=require('multer');var util=require(_0x073b('0x0'));var path=require(_0x073b('0x1'));var timeout=require(_0x073b('0x2'));var express=require(_0x073b('0x3'));var router=express['Router']();var fs_extra=require(_0x073b('0x4'));var auth=require(_0x073b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0x073b('0x6')]('/',auth[_0x073b('0x7')](),controller[_0x073b('0x8')]);router[_0x073b('0x6')](_0x073b('0x9'),auth[_0x073b('0x7')](),controller[_0x073b('0xa')]);router[_0x073b('0x6')](_0x073b('0xb'),auth[_0x073b('0x7')](),controller[_0x073b('0xc')]);router['get'](_0x073b('0xd'),auth[_0x073b('0x7')](),controller[_0x073b('0xe')]);router['get'](_0x073b('0xf'),auth[_0x073b('0x7')](),controller[_0x073b('0x10')]);router[_0x073b('0x6')](_0x073b('0x11'),controller[_0x073b('0x12')]);router[_0x073b('0x6')](_0x073b('0x13'),auth[_0x073b('0x7')](),controller[_0x073b('0x14')]);router[_0x073b('0x6')](_0x073b('0x15'),auth['isAuthenticated'](),controller[_0x073b('0x16')]);router['get'](_0x073b('0x17'),auth[_0x073b('0x7')](),controller['getQueues']);router['get'](_0x073b('0x18'),auth['isAuthenticated'](),controller[_0x073b('0x19')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0x073b('0x1a')]);router[_0x073b('0x6')](_0x073b('0x1b'),auth[_0x073b('0x7')](),controller[_0x073b('0x1c')]);router[_0x073b('0x6')](_0x073b('0x1d'),auth['isAuthenticated'](),controller[_0x073b('0x1e')]);router[_0x073b('0x6')]('/:id/chat/interactions',auth[_0x073b('0x7')](),controller[_0x073b('0x1f')]);router['get'](_0x073b('0x20'),auth[_0x073b('0x7')](),controller[_0x073b('0x21')]);router['get'](_0x073b('0x22'),auth['isAuthenticated'](),controller[_0x073b('0x23')]);router[_0x073b('0x6')](_0x073b('0x24'),auth['isAuthenticated'](),controller[_0x073b('0x25')]);router[_0x073b('0x6')](_0x073b('0x26'),auth['isAuthenticated'](),controller[_0x073b('0x27')]);router[_0x073b('0x6')]('/:id/whatsapp/interactions',auth[_0x073b('0x7')](),controller['getWhatsappInteractions']);router['get'](_0x073b('0x28'),auth[_0x073b('0x7')](),controller['getTeams']);router[_0x073b('0x6')](_0x073b('0x29'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x073b('0x2a'),auth[_0x073b('0x7')](),controller[_0x073b('0x2b')]);router[_0x073b('0x6')]('/:id/prefixes',auth[_0x073b('0x7')](),controller[_0x073b('0x2c')]);router[_0x073b('0x6')](_0x073b('0x2d'),auth[_0x073b('0x7')](),controller[_0x073b('0x2e')]);router[_0x073b('0x6')](_0x073b('0x2f'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x073b('0x6')](_0x073b('0x30'),auth[_0x073b('0x7')](),controller[_0x073b('0x31')]);router[_0x073b('0x6')](_0x073b('0x32'),auth['isAuthenticated'](),controller[_0x073b('0x33')]);router[_0x073b('0x6')](_0x073b('0x34'),auth[_0x073b('0x7')](),controller[_0x073b('0x35')]);router[_0x073b('0x6')](_0x073b('0x36'),auth[_0x073b('0x7')](),controller[_0x073b('0x37')]);router[_0x073b('0x6')](_0x073b('0x38'),auth[_0x073b('0x7')](),controller[_0x073b('0x39')]);router[_0x073b('0x6')]('/:id/scheduled_calls',auth[_0x073b('0x7')](),controller[_0x073b('0x3a')]);router[_0x073b('0x6')](_0x073b('0x3b'),auth[_0x073b('0x7')](),controller[_0x073b('0x3c')]);router[_0x073b('0x3d')](_0x073b('0x15'),auth[_0x073b('0x7')](),controller[_0x073b('0x3e')]);router[_0x073b('0x3d')]('/',auth[_0x073b('0x7')](),controller['create']);router[_0x073b('0x3d')]('/create_many',auth['isAuthenticated'](),controller[_0x073b('0x3f')]);router['post'](_0x073b('0x17'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x073b('0x40')]({'destination':function(_0xed0c26,_0xcd541,_0xcbb44c){_0xcbb44c(null,path[_0x073b('0x41')](config[_0x073b('0x42')],_0x073b('0x43')));},'filename':function(_0x5b939e,_0xf4f2ff,_0x4cd8ab){_0x4cd8ab(null,util[_0x073b('0x44')]('%s-%s',Date['now'](),_0xf4f2ff[_0x073b('0x45')]));}})});router['post']('/:id/avatar',upload[_0x073b('0x46')]('file'),controller[_0x073b('0x47')]);router[_0x073b('0x3d')](_0x073b('0x48'),auth[_0x073b('0x7')](),controller[_0x073b('0x49')]);router['post']('/:id/logout',auth[_0x073b('0x7')](),controller[_0x073b('0x4a')]);router['post'](_0x073b('0x4b'),auth[_0x073b('0x7')](),controller[_0x073b('0x4c')]);router[_0x073b('0x3d')]('/:id/unpause',auth[_0x073b('0x7')](),controller['unpause']);router[_0x073b('0x3d')](_0x073b('0x28'),auth['isAuthenticated'](),controller[_0x073b('0x4d')]);router[_0x073b('0x3d')](_0x073b('0x4e'),auth[_0x073b('0x7')](),controller[_0x073b('0x4f')]);router[_0x073b('0x3d')](_0x073b('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x073b('0x51'),auth[_0x073b('0x7')](),controller[_0x073b('0x52')]);router[_0x073b('0x3d')](_0x073b('0x53'),auth['isAuthenticated'](),controller['addSmsInteractions']);router['post'](_0x073b('0x54'),auth[_0x073b('0x7')](),controller[_0x073b('0x55')]);router[_0x073b('0x3d')](_0x073b('0x56'),auth['isAuthenticated'](),controller[_0x073b('0x57')]);router[_0x073b('0x3d')](_0x073b('0x2d'),auth[_0x073b('0x7')](),controller[_0x073b('0x58')]);router['post']('/:id/mail_accounts',auth[_0x073b('0x7')](),controller[_0x073b('0x59')]);router[_0x073b('0x3d')]('/:id/openchannel_accounts',auth[_0x073b('0x7')](),controller[_0x073b('0x5a')]);router[_0x073b('0x3d')](_0x073b('0x32'),auth[_0x073b('0x7')](),controller['addSmsAccounts']);router[_0x073b('0x3d')](_0x073b('0x34'),auth['isAuthenticated'](),controller[_0x073b('0x5b')]);router[_0x073b('0x3d')](_0x073b('0x36'),auth[_0x073b('0x7')](),controller[_0x073b('0x5c')]);router[_0x073b('0x3d')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x073b('0x5d')]);router[_0x073b('0x3d')](_0x073b('0x3b'),auth[_0x073b('0x7')](),controller[_0x073b('0x5e')]);router['put'](_0x073b('0xf'),auth['isAuthenticated'](),controller[_0x073b('0x5f')]);router[_0x073b('0x60')](_0x073b('0x61'),auth[_0x073b('0x7')](),controller[_0x073b('0x62')]);router[_0x073b('0x63')](_0x073b('0x17'),auth[_0x073b('0x7')](),controller[_0x073b('0x64')]);router[_0x073b('0x63')](_0x073b('0x28'),auth[_0x073b('0x7')](),controller[_0x073b('0x65')]);router[_0x073b('0x63')]('/:id',auth[_0x073b('0x7')](),controller[_0x073b('0x66')]);router[_0x073b('0x63')](_0x073b('0x4e'),auth[_0x073b('0x7')](),controller['removeChatInteractions']);router[_0x073b('0x63')](_0x073b('0x50'),auth[_0x073b('0x7')](),controller[_0x073b('0x67')]);router[_0x073b('0x63')]('/:id/fax_interactions',auth[_0x073b('0x7')](),controller['removeFaxInteractions']);router['delete'](_0x073b('0x53'),auth['isAuthenticated'](),controller[_0x073b('0x68')]);router[_0x073b('0x63')](_0x073b('0x54'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0x073b('0x56'),auth[_0x073b('0x7')](),controller[_0x073b('0x69')]);router['delete']('/:id/fax_accounts',auth[_0x073b('0x7')](),controller[_0x073b('0x6a')]);router[_0x073b('0x63')](_0x073b('0x2f'),auth[_0x073b('0x7')](),controller[_0x073b('0x6b')]);router[_0x073b('0x63')](_0x073b('0x30'),auth[_0x073b('0x7')](),controller['removeOpenchannelAccounts']);router[_0x073b('0x63')](_0x073b('0x32'),auth[_0x073b('0x7')](),controller[_0x073b('0x6c')]);router[_0x073b('0x63')](_0x073b('0x34'),auth[_0x073b('0x7')](),controller[_0x073b('0x6d')]);router[_0x073b('0x63')](_0x073b('0x36'),auth[_0x073b('0x7')](),controller['removeWhatsappAccounts']);router[_0x073b('0x63')](_0x073b('0x38'),auth[_0x073b('0x7')](),controller[_0x073b('0x6e')]);router['delete']('/:id/api_key',auth[_0x073b('0x7')](),controller[_0x073b('0x6f')]);module[_0x073b('0x70')]=router; \ No newline at end of file +var _0x0e54=['/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','/create_many','diskStorage','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams'];(function(_0x3f3b34,_0x10f77d){var _0x1ad5cd=function(_0x1e752e){while(--_0x1e752e){_0x3f3b34['push'](_0x3f3b34['shift']());}};_0x1ad5cd(++_0x10f77d);}(_0x0e54,0x17f));var _0x40e5=function(_0x4d12c6,_0x1b5acc){_0x4d12c6=_0x4d12c6-0x0;var _0x2a8ee6=_0x0e54[_0x4d12c6];return _0x2a8ee6;};'use strict';var multer=require(_0x40e5('0x0'));var util=require(_0x40e5('0x1'));var path=require(_0x40e5('0x2'));var timeout=require(_0x40e5('0x3'));var express=require(_0x40e5('0x4'));var router=express[_0x40e5('0x5')]();var fs_extra=require(_0x40e5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x40e5('0x7'));var config=require(_0x40e5('0x8'));var controller=require(_0x40e5('0x9'));router[_0x40e5('0xa')]('/',auth[_0x40e5('0xb')](),controller[_0x40e5('0xc')]);router['get'](_0x40e5('0xd'),auth['isAuthenticated'](),controller[_0x40e5('0xe')]);router[_0x40e5('0xa')](_0x40e5('0xf'),auth['isAuthenticated'](),controller[_0x40e5('0x10')]);router[_0x40e5('0xa')](_0x40e5('0x11'),auth['isAuthenticated'](),controller['getPresence']);router[_0x40e5('0xa')](_0x40e5('0x12'),auth['isAuthenticated'](),controller[_0x40e5('0x13')]);router['get'](_0x40e5('0x14'),controller[_0x40e5('0x15')]);router[_0x40e5('0xa')](_0x40e5('0x16'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x17')]);router[_0x40e5('0xa')](_0x40e5('0x18'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x19')]);router[_0x40e5('0xa')](_0x40e5('0x1a'),auth['isAuthenticated'](),controller['getQueues']);router[_0x40e5('0xa')](_0x40e5('0x1b'),auth['isAuthenticated'](),controller[_0x40e5('0x1c')]);router['get']('/:id/groups',auth[_0x40e5('0xb')](),controller['getGroups']);router[_0x40e5('0xa')](_0x40e5('0x1d'),auth['isAuthenticated'](),controller[_0x40e5('0x1e')]);router[_0x40e5('0xa')](_0x40e5('0x1f'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x20')]);router[_0x40e5('0xa')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x40e5('0x21')]);router[_0x40e5('0xa')](_0x40e5('0x22'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x23')]);router[_0x40e5('0xa')](_0x40e5('0x24'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x25')]);router[_0x40e5('0xa')]('/:id/sms/interactions',auth[_0x40e5('0xb')](),controller[_0x40e5('0x26')]);router[_0x40e5('0xa')](_0x40e5('0x27'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x28')]);router[_0x40e5('0xa')](_0x40e5('0x29'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x2a')]);router[_0x40e5('0xa')](_0x40e5('0x2b'),auth['isAuthenticated'](),controller[_0x40e5('0x2c')]);router['get'](_0x40e5('0x2d'),auth['isAuthenticated'](),controller[_0x40e5('0x2e')]);router['get'](_0x40e5('0x2f'),auth['isAuthenticated'](),controller['getAgents']);router[_0x40e5('0xa')]('/:id/prefixes',auth[_0x40e5('0xb')](),controller[_0x40e5('0x30')]);router[_0x40e5('0xa')](_0x40e5('0x31'),auth['isAuthenticated'](),controller[_0x40e5('0x32')]);router[_0x40e5('0xa')](_0x40e5('0x33'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x34')]);router[_0x40e5('0xa')](_0x40e5('0x35'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x36')]);router[_0x40e5('0xa')]('/:id/sms_accounts',auth[_0x40e5('0xb')](),controller['getSmsAccounts']);router['get'](_0x40e5('0x37'),auth[_0x40e5('0xb')](),controller['getChatWebsites']);router[_0x40e5('0xa')](_0x40e5('0x38'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x39')]);router['get'](_0x40e5('0x3a'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x40e5('0xa')](_0x40e5('0x3b'),auth[_0x40e5('0xb')](),controller['getScheduledCalls']);router['get'](_0x40e5('0x3c'),auth['isAuthenticated'](),controller[_0x40e5('0x3d')]);router['post'](_0x40e5('0x18'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x3e')]);router[_0x40e5('0x3f')]('/',auth['isAuthenticated'](),controller['create']);router[_0x40e5('0x3f')](_0x40e5('0x40'),auth[_0x40e5('0xb')](),controller['bulkCreate']);router['post'](_0x40e5('0x1a'),auth[_0x40e5('0xb')](),controller['addQueues']);var upload=multer({'storage':multer[_0x40e5('0x41')]({'destination':function(_0x113540,_0x355e62,_0x24dd8a){_0x24dd8a(null,path['join'](config['root'],_0x40e5('0x42')));},'filename':function(_0x4d83d0,_0x4727a1,_0x5d634a){_0x5d634a(null,util[_0x40e5('0x43')](_0x40e5('0x44'),Date[_0x40e5('0x45')](),_0x4727a1[_0x40e5('0x46')]));}})});router[_0x40e5('0x3f')]('/:id/avatar',upload[_0x40e5('0x47')](_0x40e5('0x48')),controller[_0x40e5('0x49')]);router[_0x40e5('0x3f')](_0x40e5('0x4a'),auth[_0x40e5('0xb')](),controller['login']);router[_0x40e5('0x3f')](_0x40e5('0x4b'),auth['isAuthenticated'](),controller[_0x40e5('0x4c')]);router['post'](_0x40e5('0x4d'),auth['isAuthenticated'](),controller[_0x40e5('0x4e')]);router[_0x40e5('0x3f')](_0x40e5('0x4f'),auth[_0x40e5('0xb')](),controller['unpause']);router[_0x40e5('0x3f')](_0x40e5('0x2b'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x50')]);router[_0x40e5('0x3f')](_0x40e5('0x51'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x52')]);router[_0x40e5('0x3f')](_0x40e5('0x53'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x54')]);router['post'](_0x40e5('0x55'),auth[_0x40e5('0xb')](),controller['addFaxInteractions']);router[_0x40e5('0x3f')](_0x40e5('0x56'),auth['isAuthenticated'](),controller[_0x40e5('0x57')]);router[_0x40e5('0x3f')](_0x40e5('0x58'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x59')]);router[_0x40e5('0x3f')](_0x40e5('0x5a'),auth['isAuthenticated'](),controller[_0x40e5('0x5b')]);router[_0x40e5('0x3f')](_0x40e5('0x31'),auth['isAuthenticated'](),controller[_0x40e5('0x5c')]);router[_0x40e5('0x3f')](_0x40e5('0x33'),auth[_0x40e5('0xb')](),controller['addMailAccounts']);router['post'](_0x40e5('0x35'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x5d')]);router[_0x40e5('0x3f')](_0x40e5('0x5e'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x5f')]);router[_0x40e5('0x3f')]('/:id/chat_websites',auth[_0x40e5('0xb')](),controller[_0x40e5('0x60')]);router[_0x40e5('0x3f')](_0x40e5('0x38'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x61')]);router['post']('/:id/square_projects',auth[_0x40e5('0xb')](),controller[_0x40e5('0x62')]);router[_0x40e5('0x3f')](_0x40e5('0x3c'),auth[_0x40e5('0xb')](),controller['createApiKey']);router[_0x40e5('0x63')]('/:id',auth[_0x40e5('0xb')](),controller[_0x40e5('0x64')]);router[_0x40e5('0x63')](_0x40e5('0x65'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x66')]);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0x40e5('0x67')]);router[_0x40e5('0x68')](_0x40e5('0x2b'),auth['isAuthenticated'](),controller[_0x40e5('0x69')]);router[_0x40e5('0x68')](_0x40e5('0x12'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x6a')]);router['delete'](_0x40e5('0x51'),auth[_0x40e5('0xb')](),controller['removeChatInteractions']);router[_0x40e5('0x68')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x40e5('0x6b')]);router['delete'](_0x40e5('0x55'),auth[_0x40e5('0xb')](),controller['removeFaxInteractions']);router[_0x40e5('0x68')](_0x40e5('0x56'),auth['isAuthenticated'](),controller[_0x40e5('0x6c')]);router[_0x40e5('0x68')](_0x40e5('0x58'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0x40e5('0x5a'),auth['isAuthenticated'](),controller[_0x40e5('0x6d')]);router[_0x40e5('0x68')]('/:id/fax_accounts',auth[_0x40e5('0xb')](),controller[_0x40e5('0x6e')]);router[_0x40e5('0x68')](_0x40e5('0x33'),auth['isAuthenticated'](),controller[_0x40e5('0x6f')]);router[_0x40e5('0x68')]('/:id/openchannel_accounts',auth[_0x40e5('0xb')](),controller['removeOpenchannelAccounts']);router[_0x40e5('0x68')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x40e5('0x70')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x40e5('0x71')]);router[_0x40e5('0x68')](_0x40e5('0x38'),auth[_0x40e5('0xb')](),controller[_0x40e5('0x72')]);router[_0x40e5('0x68')]('/:id/square_projects',auth[_0x40e5('0xb')](),controller[_0x40e5('0x73')]);router[_0x40e5('0x68')](_0x40e5('0x3c'),auth[_0x40e5('0xb')](),controller['removeApiKey']);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 12e7b20..4aa20d6 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 _0xf261=['dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','dynamic','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','passive','actpass','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0xf261,0x69));var _0x1f26=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf261[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x1f26('0x0'));var moment=require(_0x1f26('0x1'));var util=require(_0x1f26('0x2'));var _=require(_0x1f26('0x3'));module[_0x1f26('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1f26('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2c2795){this[_0x1f26('0x6')](_0x1f26('0x5'),_0x2c2795);this['setDataValue']('defaultuser',_0x2c2795);},'comment':_0x1f26('0x7')},'fullname':{'type':Sequelize[_0x1f26('0x8')],'allowNull':![],'set':function(_0xb5d2ad){this[_0x1f26('0x6')](_0x1f26('0x9'),_0xb5d2ad);this[_0x1f26('0x6')](_0x1f26('0xa'),util[_0x1f26('0xb')](_0x1f26('0xc'),_0xb5d2ad,this[_0x1f26('0xd')](_0x1f26('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1f26('0x8')],'allowNull':![],'unique':_0x1f26('0xf'),'validate':{'isEmail':!![]},'set':function(_0x398410){if(_0x398410){this[_0x1f26('0x6')](_0x1f26('0xf'),_0x398410[_0x1f26('0x10')]());}}},'role':{'type':Sequelize[_0x1f26('0x11')]('admin',_0x1f26('0x12'),'agent',_0x1f26('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x1f26('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1f26('0x8')],'defaultValue':_0x1f26('0x14')},'internal':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':![],'unique':_0x1f26('0xe'),'set':function(_0x379343){this[_0x1f26('0x6')]('internal',_0x379343);this[_0x1f26('0x6')](_0x1f26('0x16'),_0x379343);this[_0x1f26('0x6')](_0x1f26('0xa'),util[_0x1f26('0xb')]('\x22%s\x22\x20<%s>',this[_0x1f26('0xd')](_0x1f26('0x9')),_0x379343));}},'salt':{'type':Sequelize[_0x1f26('0x8')]},'phone':{'type':Sequelize[_0x1f26('0x8')]},'mobile':{'type':Sequelize[_0x1f26('0x8')]},'address':{'type':Sequelize[_0x1f26('0x8')]},'zipcode':{'type':Sequelize[_0x1f26('0x8')]},'userpic':{'type':Sequelize[_0x1f26('0x8')]},'city':{'type':Sequelize[_0x1f26('0x8')]},'country':{'type':Sequelize[_0x1f26('0x8')]},'online':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1f26('0x8')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x1f26('0x18')]},'chatCapacity':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1f26('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1f26('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![],'defaultValue':_0x1f26('0x19')},'ipaddr':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0x1f26('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1f26('0x11')]('friend',_0x1f26('0x12'),_0x1f26('0x1a')),'allowNull':!![],'defaultValue':_0x1f26('0x1b')},'context':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![],'defaultValue':_0x1f26('0x1c')},'callingpres':{'type':Sequelize[_0x1f26('0x11')]('ALLOWED_NOT_SCREENED',_0x1f26('0x1d'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x1f26('0x1e'),_0x1f26('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![],'defaultValue':_0x1f26('0x20'),'set':function(_0x1c2751){this[_0x1f26('0x6')](_0x1f26('0x21'),_0x1c2751?_0x1c2751[_0x1f26('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x1f26('0x21'))?this[_0x1f26('0xd')]('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1f26('0x11')]('rfc2833','info',_0x1f26('0x23'),_0x1f26('0x24'),_0x1f26('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no',_0x1f26('0x27'),_0x1f26('0x28'),_0x1f26('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1f26('0x2a'),'set':function(_0x177488){this[_0x1f26('0x6')](_0x1f26('0x2b'),_0x177488?_0x177488['join'](','):null);},'get':function(){return this[_0x1f26('0xd')](_0x1f26('0x2b'))?this[_0x1f26('0xd')](_0x1f26('0x2b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1f26('0x8')]},'namedcallgroup':{'type':Sequelize[_0x1f26('0x8')]},'pickupgroup':{'type':Sequelize[_0x1f26('0x8')]},'namedpickupgroup':{'type':Sequelize[_0x1f26('0x8')]},'language':{'type':Sequelize[_0x1f26('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x1f26('0x8')],'allowNull':![],'defaultValue':_0x1f26('0x2c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f26('0x2d'),'set':function(_0x2e73ba){this[_0x1f26('0x6')](_0x1f26('0x2e'),_0x2e73ba?_0x2e73ba[_0x1f26('0x22')](';'):_0x1f26('0x2d'));},'get':function(){return this['getDataValue'](_0x1f26('0x2e'))?this[_0x1f26('0xd')](_0x1f26('0x2e'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1f26('0x11')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![],'set':function(_0x17c537){this[_0x1f26('0x6')](_0x1f26('0x2f'),_0x17c537?_0x17c537[_0x1f26('0x22')](','):null);},'get':function(){return this[_0x1f26('0xd')]('insecure')?this['getDataValue'](_0x1f26('0x2f'))[_0x1f26('0x30')](','):null;},'comment':_0x1f26('0x31')},'trustrpid':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no',_0x1f26('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![],'defaultValue':_0x1f26('0x33')},'amaflags':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':_0x1f26('0x26')},'busylevel':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1f26('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1f26('0x34'),_0x1f26('0x35'),_0x1f26('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x37'),_0x1f26('0x38')),'allowNull':!![],'defaultValue':_0x1f26('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':_0x1f26('0x26')},'keepalive':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1f26('0x11')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no',_0x1f26('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1f26('0x11')]('active',_0x1f26('0x3a'),_0x1f26('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1f26('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1f26('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1f26('0x11')](_0x1f26('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1f26('0x26'),'no',_0x1f26('0x27'),_0x1f26('0x28'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1f26('0x8')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x1f26('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0,'set':function(_0x54d3d4){this['setDataValue'](_0x1f26('0x3c'),_0x54d3d4);var _0x42a07c=this['get']({'plain':!![]});switch(_0x54d3d4){case 0x0:case 0x1:var _0x51b254=_0x42a07c['transport']?_[_0x1f26('0x3d')](_0x42a07c['transport'])?_0x42a07c[_0x1f26('0x21')][_0x1f26('0x22')]():_0x42a07c[_0x1f26('0x21')]:_0x1f26('0x20');if(_0x51b254===_0x1f26('0x3e')){_0x51b254=_0x1f26('0x20');}this[_0x1f26('0x6')](_0x1f26('0x21'),_0x51b254);this['setDataValue'](_0x1f26('0x3f'),'no');this[_0x1f26('0x6')](_0x1f26('0x40'),null);this[_0x1f26('0x6')](_0x1f26('0x41'),null);this[_0x1f26('0x6')](_0x1f26('0x42'),null);this[_0x1f26('0x6')](_0x1f26('0x43'),null);this['setDataValue']('dtlsverify',null);this[_0x1f26('0x6')](_0x1f26('0x44'),null);this[_0x1f26('0x6')](_0x1f26('0x45'),null);this[_0x1f26('0x6')](_0x1f26('0x46'),null);this[_0x1f26('0x6')](_0x1f26('0x47'),'no');break;case 0x2:this[_0x1f26('0x6')](_0x1f26('0x21'),_0x1f26('0x3e'));this['setDataValue']('encryption','yes');this[_0x1f26('0x6')]('avpf',_0x1f26('0x26'));this[_0x1f26('0x6')](_0x1f26('0x41'),_0x1f26('0x26'));this[_0x1f26('0x6')](_0x1f26('0x42'),_0x1f26('0x26'));this['setDataValue'](_0x1f26('0x43'),_0x1f26('0x26'));this[_0x1f26('0x6')](_0x1f26('0x48'),'no');this[_0x1f26('0x6')](_0x1f26('0x44'),'actpass');this[_0x1f26('0x6')](_0x1f26('0x45'),_0x42a07c[_0x1f26('0x45')]||_0x1f26('0x49'));this[_0x1f26('0x6')](_0x1f26('0x46'),_0x42a07c['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x1f26('0x6')](_0x1f26('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x1f26('0x4a')],'set':function(_0x123d06){this[_0x1f26('0x6')]('permissions',_0x123d06?_0x123d06[_0x1f26('0x22')](','):[]);},'get':function(){return this['getDataValue'](_0x1f26('0x4b'))?_[_0x1f26('0x4c')](this['getDataValue']('permissions')['split'](','),function(_0x1cb17e){return parseInt(_0x1cb17e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1f26('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1f26('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1f26('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1f26('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1f26('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1f26('0x11')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1f26('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1f26('0x4d')],'get':function(){return this[_0x1f26('0xd')](_0x1f26('0x4e'))?this[_0x1f26('0xd')](_0x1f26('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1f26('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1f26('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![],'set':function(_0x549f5d){if(typeof _0x549f5d==='string'){var _0x240ce0=_0x549f5d==='1'?!![]:_0x549f5d==='0'?![]:_0x549f5d===_0x1f26('0x4f')?!![]:_0x549f5d===_0x1f26('0x50')?![]:![];this[_0x1f26('0x6')](_0x1f26('0x51'),_0x240ce0);}else{this[_0x1f26('0x6')](_0x1f26('0x51'),_0x549f5d);}}},'blocked':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![],'set':function(_0x6e3026){this[_0x1f26('0x6')](_0x1f26('0x52'),_0x6e3026);if(_0x6e3026===!![]){this[_0x1f26('0x6')](_0x1f26('0x53'),moment());this[_0x1f26('0x6')](_0x1f26('0x54'),0x0);}else{this[_0x1f26('0x6')](_0x1f26('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x1f26('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1f26('0x15')](0x5)[_0x1f26('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1f26('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x12f7=['update,nonat','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','split','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass'];(function(_0x181f81,_0x594c9c){var _0x25b0c6=function(_0x58c90d){while(--_0x58c90d){_0x181f81['push'](_0x181f81['shift']());}};_0x25b0c6(++_0x594c9c);}(_0x12f7,0x192));var _0x712f=function(_0x3367bb,_0x134ad0){_0x3367bb=_0x3367bb-0x0;var _0x3ad6fc=_0x12f7[_0x3367bb];return _0x3ad6fc;};'use strict';var Sequelize=require(_0x712f('0x0'));var moment=require(_0x712f('0x1'));var util=require('util');var _=require(_0x712f('0x2'));module[_0x712f('0x3')]={'name':{'type':Sequelize[_0x712f('0x4')],'allowNull':![],'unique':_0x712f('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x12f48d){this[_0x712f('0x6')](_0x712f('0x5'),_0x12f48d);this[_0x712f('0x6')](_0x712f('0x7'),_0x12f48d);},'comment':_0x712f('0x8')},'fullname':{'type':Sequelize[_0x712f('0x4')],'allowNull':![],'set':function(_0x16213a){this[_0x712f('0x6')](_0x712f('0x9'),_0x16213a);this[_0x712f('0x6')](_0x712f('0xa'),util[_0x712f('0xb')](_0x712f('0xc'),_0x16213a,this['getDataValue'](_0x712f('0xd'))));}},'alias':{'type':Sequelize[_0x712f('0x4')]},'email':{'type':Sequelize[_0x712f('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x144646){if(_0x144646){this[_0x712f('0x6')](_0x712f('0xe'),_0x144646[_0x712f('0xf')]());}}},'role':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x11'),'user',_0x712f('0x12'),_0x712f('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x712f('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x712f('0x14')},'internal':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':![],'unique':_0x712f('0xd'),'set':function(_0x1d265d){this[_0x712f('0x6')](_0x712f('0xd'),_0x1d265d);this[_0x712f('0x6')](_0x712f('0x16'),_0x1d265d);this[_0x712f('0x6')](_0x712f('0xa'),util['format'](_0x712f('0xc'),this[_0x712f('0x17')](_0x712f('0x9')),_0x1d265d));}},'salt':{'type':Sequelize[_0x712f('0x4')]},'phone':{'type':Sequelize[_0x712f('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x712f('0x4')]},'zipcode':{'type':Sequelize[_0x712f('0x4')]},'userpic':{'type':Sequelize[_0x712f('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x712f('0x4')]},'online':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x712f('0x19')]},'voicePause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x712f('0x4')],'defaultValue':_0x712f('0x1a')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x712f('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x712f('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![],'defaultValue':_0x712f('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x712f('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x1c'),_0x712f('0x1d'),_0x712f('0x1e')),'allowNull':!![],'defaultValue':_0x712f('0x1c')},'context':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![],'defaultValue':_0x712f('0x1f')},'callingpres':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x20'),'ALLOWED_PASSED_SCREEN',_0x712f('0x21'),_0x712f('0x22'),_0x712f('0x23'),_0x712f('0x24'),'PROHIB_FAILED_SCREEN',_0x712f('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x14519f){this[_0x712f('0x6')](_0x712f('0x26'),_0x14519f?_0x14519f[_0x712f('0x27')](','):null);},'get':function(){return this[_0x712f('0x17')](_0x712f('0x26'))?this[_0x712f('0x17')](_0x712f('0x26'))['split'](','):null;},'comment':_0x712f('0x28')},'dtmfmode':{'type':Sequelize[_0x712f('0x10')]('rfc2833',_0x712f('0x29'),_0x712f('0x2a'),_0x712f('0x2b'),_0x712f('0x2c')),'allowNull':!![],'defaultValue':_0x712f('0x2d')},'directmedia':{'type':Sequelize['ENUM'](_0x712f('0x2e'),'no',_0x712f('0x2f'),_0x712f('0x30'),_0x712f('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![],'defaultValue':_0x712f('0x32'),'set':function(_0x65fe46){this['setDataValue'](_0x712f('0x33'),_0x65fe46?_0x65fe46[_0x712f('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x712f('0x33'))?this['getDataValue'](_0x712f('0x33'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x712f('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x712f('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x712f('0x4')]},'disallow':{'type':Sequelize[_0x712f('0x4')],'allowNull':![],'defaultValue':_0x712f('0x34')},'allow':{'type':Sequelize[_0x712f('0x4')],'allowNull':![],'defaultValue':_0x712f('0x35'),'set':function(_0x4e252e){this[_0x712f('0x6')](_0x712f('0x36'),_0x4e252e?_0x4e252e[_0x712f('0x27')](';'):_0x712f('0x35'));},'get':function(){return this[_0x712f('0x17')](_0x712f('0x36'))?this['getDataValue'](_0x712f('0x36'))['split'](';'):null;},'comment':_0x712f('0x37')},'autoframing':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![],'set':function(_0x19d072){this[_0x712f('0x6')](_0x712f('0x38'),_0x19d072?_0x19d072['join'](','):null);},'get':function(){return this[_0x712f('0x17')](_0x712f('0x38'))?this['getDataValue'](_0x712f('0x38'))['split'](','):null;},'comment':_0x712f('0x39')},'trustrpid':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x712f('0x10')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x712f('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![],'defaultValue':_0x712f('0x3a')},'amaflags':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x712f('0x2e')},'busylevel':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x712f('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x3b'),'refuse',_0x712f('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x712f('0x3d'),_0x712f('0x3e')),'allowNull':!![],'defaultValue':_0x712f('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x712f('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0x712f('0x2e')},'keepalive':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x712f('0x10')]('yes','no',_0x712f('0x3f'),_0x712f('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x712f('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x712f('0x41'),_0x712f('0x42'),_0x712f('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x712f('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x712f('0x10')](_0x712f('0x2e'),'no','nonat',_0x712f('0x30'),_0x712f('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x712f('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x712f('0x19')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0,'set':function(_0x4c5caf){this['setDataValue']('showWebBar',_0x4c5caf);var _0x411a4d=this[_0x712f('0x45')]({'plain':!![]});switch(_0x4c5caf){case 0x0:case 0x1:var _0x3b6716=_0x411a4d[_0x712f('0x26')]?_[_0x712f('0x46')](_0x411a4d[_0x712f('0x26')])?_0x411a4d[_0x712f('0x26')]['join']():_0x411a4d[_0x712f('0x26')]:_0x712f('0x47');if(_0x3b6716===_0x712f('0x48')){_0x3b6716=_0x712f('0x47');}this[_0x712f('0x6')](_0x712f('0x26'),_0x3b6716);this[_0x712f('0x6')](_0x712f('0x49'),'no');this[_0x712f('0x6')](_0x712f('0x4a'),null);this[_0x712f('0x6')](_0x712f('0x4b'),null);this[_0x712f('0x6')](_0x712f('0x4c'),null);this['setDataValue'](_0x712f('0x4d'),null);this[_0x712f('0x6')](_0x712f('0x4e'),null);this[_0x712f('0x6')]('dtlssetup',null);this['setDataValue'](_0x712f('0x4f'),null);this[_0x712f('0x6')](_0x712f('0x50'),null);this[_0x712f('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x712f('0x6')]('transport','wss');this[_0x712f('0x6')](_0x712f('0x49'),_0x712f('0x2e'));this[_0x712f('0x6')](_0x712f('0x4a'),_0x712f('0x2e'));this[_0x712f('0x6')](_0x712f('0x4b'),_0x712f('0x2e'));this[_0x712f('0x6')](_0x712f('0x4c'),_0x712f('0x2e'));this[_0x712f('0x6')](_0x712f('0x4d'),_0x712f('0x2e'));this[_0x712f('0x6')](_0x712f('0x4e'),'no');this[_0x712f('0x6')](_0x712f('0x51'),'actpass');this[_0x712f('0x6')](_0x712f('0x4f'),_0x411a4d[_0x712f('0x4f')]||_0x712f('0x52'));this[_0x712f('0x6')]('dtlsprivatekey',_0x411a4d[_0x712f('0x50')]||_0x712f('0x53'));this['setDataValue']('rtcp_mux',_0x712f('0x2e'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x70bd7a){this[_0x712f('0x6')](_0x712f('0x54'),_0x70bd7a?_0x70bd7a['join'](','):[]);},'get':function(){return this[_0x712f('0x17')](_0x712f('0x54'))?_[_0x712f('0x55')](this[_0x712f('0x17')]('permissions')[_0x712f('0x56')](','),function(_0x17af24){return parseInt(_0x17af24,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x712f('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x712f('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x712f('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x712f('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x712f('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x712f('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x712f('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x712f('0x57')],'get':function(){return this[_0x712f('0x17')](_0x712f('0x58'))?this[_0x712f('0x17')](_0x712f('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x712f('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![],'set':function(_0x5a17a2){if(typeof _0x5a17a2===_0x712f('0x59')){var _0x5a6989=_0x5a17a2==='1'?!![]:_0x5a17a2==='0'?![]:_0x5a17a2===_0x712f('0x5a')?!![]:_0x5a17a2===_0x712f('0x5b')?![]:![];this[_0x712f('0x6')]('screenrecording',_0x5a6989);}else{this[_0x712f('0x6')](_0x712f('0x5c'),_0x5a17a2);}}},'blocked':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![],'set':function(_0x4cfa32){this[_0x712f('0x6')]('blocked',_0x4cfa32);if(_0x4cfa32===!![]){this[_0x712f('0x6')](_0x712f('0x5d'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x712f('0x6')](_0x712f('0x5d'),null);}}},'blockedAt':{'type':Sequelize[_0x712f('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x712f('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x712f('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x712f('0x18')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 746f3de..9848428 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 _0xf74c=['authenticate','Sequelize','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt','upsert','Unknown\x20channel','remove','isArray','emit','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','getOpenTabs','ChatOpenTabs','FAX','createdAt','MailOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','CmContact','order','sort','pick','options','getContacts','CmList','List','Tags','color','tag','getQueues','Queue','hasOwnProperty','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','MemberReport','resolve','QueuePause','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','isValidChannel','manual','Pause','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','sequelize','transaction','getDataValue','Voice','UserVoicePrefix','removeTeams','getMailQueues','Mail','Whatsapp','Openchannel','removeAgent','VoicePrefixId','getLists','values','addChatInteractions','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','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','teams','queues','inbound','flatten','lower','col','toString','desc','asc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','select','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','moment','util','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','redis','./user.socket','register','defaults','localhost','client','http','request','info','request\x20sent','debug','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','count','offset','limit','set','json','update','then','destroy','get','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','type','key','salt','getOptions','where','query','userSetting','true','include','UserSetting','attributes','push','rows','length','chat','dataValues','fax','openchannel','whatsapp','model','differenceBy','keys','password','filters','intersection','fields','includeAll','merge','sms','mail','all','body','params','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','SELECT','from','voicemail','mailbox','fullname','permissions','101','110','104','105','106','107','108','109','111','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','userProfileId','VoiceMail','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','each','findAll','isEmpty','autoAssociation','changePassword','oldPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword'];(function(_0x320a39,_0x54306d){var _0xf1aeca=function(_0x2cb4e0){while(--_0x2cb4e0){_0x320a39['push'](_0x320a39['shift']());}};_0xf1aeca(++_0x54306d);}(_0xf74c,0x107));var _0xcf74=function(_0x40998b,_0x38b1c5){_0x40998b=_0x40998b-0x0;var _0xb33ab8=_0xf74c[_0x40998b];return _0xb33ab8;};'use strict';var moment=require(_0xcf74('0x0'));var BPromise=require('bluebird');var util=require(_0xcf74('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xcf74('0x2'));var squel=require(_0xcf74('0x3'));var jayson=require(_0xcf74('0x4'));var Redis=require(_0xcf74('0x5'));var authService=require(_0xcf74('0x6'));var qs=require(_0xcf74('0x7'));var logger=require('../../config/logger')(_0xcf74('0x8'));var utils=require('../../config/utils');var config=require(_0xcf74('0x9'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xcf74('0xa')]));require(_0xcf74('0xb'))[_0xcf74('0xc')](socket);config['redis']=_[_0xcf74('0xd')](config[_0xcf74('0xa')],{'host':_0xcf74('0xe'),'port':0x18eb});var client=jayson[_0xcf74('0xf')][_0xcf74('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4ef9e5,_0x26687d,_0x5cad8a,_0x5c0651){return new BPromise(function(_0x11a382,_0x24413f){var _0x3e5944=_0x5c0651||client;return _0x3e5944[_0xcf74('0x11')](_0x4ef9e5,_0x5cad8a)['then'](function(_0x3e4e5c){logger[_0xcf74('0x12')]('User,\x20%s,\x20%s',_0x26687d,_0xcf74('0x13'));logger[_0xcf74('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x26687d,_0xcf74('0x13'),JSON[_0xcf74('0x15')](_0x3e4e5c));if(_0x3e4e5c[_0xcf74('0x16')]){if(_0x3e4e5c[_0xcf74('0x16')][_0xcf74('0x17')]===0x1f4){logger[_0xcf74('0x16')](_0xcf74('0x18'),_0x26687d,_0x3e4e5c[_0xcf74('0x16')]['message']);return _0x24413f(_0x3e4e5c['error'][_0xcf74('0x19')]);}logger['error'](_0xcf74('0x18'),_0x26687d,_0x3e4e5c['error']['message']);return _0x11a382(_0x3e4e5c[_0xcf74('0x16')][_0xcf74('0x19')]);}else{logger[_0xcf74('0x12')](_0xcf74('0x18'),_0x26687d,_0xcf74('0x13'));_0x11a382(_0x3e4e5c[_0xcf74('0x1a')][_0xcf74('0x19')]);}})[_0xcf74('0x1b')](function(_0x3e9c6d){logger[_0xcf74('0x16')](_0xcf74('0x18'),_0x26687d,_0x3e9c6d);_0x24413f(_0x3e9c6d);});});}function respondWithStatusCode(_0x7a456a,_0xe4bac2){_0xe4bac2=_0xe4bac2||0xcc;return function(_0x58e683){if(_0x58e683){return _0x7a456a[_0xcf74('0x1c')](_0xe4bac2);}return _0x7a456a[_0xcf74('0x1d')](_0xe4bac2)[_0xcf74('0x1e')]();};}function respondWithResult(_0x1f37c6,_0x34d77e){_0x34d77e=_0x34d77e||0xc8;return function(_0xb7d16c){if(_0xb7d16c){return _0x1f37c6['status'](_0x34d77e)['json'](_0xb7d16c);}};}function respondWithFilteredResult(_0x1bc1d2,_0x333ccd){return function(_0x2b063a){if(_0x2b063a){var _0x37ca74=typeof _0x333ccd['offset']===_0xcf74('0x1f')&&typeof _0x333ccd['limit']==='undefined';var _0x21ef79=_0x2b063a[_0xcf74('0x20')];var _0x598fe6=_0x37ca74?0x0:_0x333ccd[_0xcf74('0x21')];var _0x1a33ae=_0x37ca74?_0x2b063a[_0xcf74('0x20')]:_0x333ccd[_0xcf74('0x21')]+_0x333ccd[_0xcf74('0x22')];var _0x3de0f9;if(_0x1a33ae>=_0x21ef79){_0x1a33ae=_0x21ef79;_0x3de0f9=0xc8;}else{_0x3de0f9=0xce;}_0x1bc1d2[_0xcf74('0x1d')](_0x3de0f9);return _0x1bc1d2[_0xcf74('0x23')]('Content-Range',_0x598fe6+'-'+_0x1a33ae+'/'+_0x21ef79)[_0xcf74('0x24')](_0x2b063a);}return null;};}function saveUpdates(_0x21694a){return function(_0xf75e56){if(_0xf75e56){return _0xf75e56[_0xcf74('0x25')](_0x21694a)[_0xcf74('0x26')](function(_0x5379e2){return _0x5379e2;});}return null;};}function removeEntity(_0xdfb097){return function(_0x2e8840){if(_0x2e8840){return _0x2e8840[_0xcf74('0x27')]()['then'](function(){var _0x59a338=_0x2e8840[_0xcf74('0x28')]({'plain':!![]});if(_0x59a338[_0xcf74('0x29')]===_0xcf74('0x2a'))return;var _0x246946=[{'name':_0xcf74('0x2b'),'value':_0xcf74('0x2c'),'ignore':!![]},{'name':_0xcf74('0x2d'),'value':_0xcf74('0x2e'),'ignore':![]},{'name':_0xcf74('0x2f'),'value':_0xcf74('0x30'),'ignore':![]}];var _0x5cae0e=_(_0x246946)[_0xcf74('0x31')](_0xcf74('0x32'))[_0xcf74('0x33')](_0xcf74('0x34'))[_0xcf74('0x34')]();if(_[_0xcf74('0x35')](_0x5cae0e,_0x59a338[_0xcf74('0x29')])){return;}var _0x3ba08e=_[_0xcf74('0x36')](_0x246946,[_0xcf74('0x34'),_0x59a338[_0xcf74('0x29')]])[_0xcf74('0x37')];return db[_0xcf74('0x38')][_0xcf74('0x27')]({'where':{'type':_0x3ba08e,'resourceId':_0x59a338['id']}})[_0xcf74('0x26')](function(){return _0x2e8840;});})[_0xcf74('0x26')](function(){_0xdfb097[_0xcf74('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e787){return function(_0xaf27a8){if(!_0xaf27a8){_0x48e787[_0xcf74('0x1c')](0x194);}return _0xaf27a8;};}function handleError(_0x4da3c1,_0x597e06){_0x597e06=_0x597e06||0x1f4;return function(_0x4d8b6d){logger[_0xcf74('0x16')](_0x4d8b6d[_0xcf74('0x39')]);if(_0x4d8b6d[_0xcf74('0x37')]){delete _0x4d8b6d[_0xcf74('0x37')];}_0x4da3c1[_0xcf74('0x1d')](_0x597e06)[_0xcf74('0x3a')](_0x4d8b6d);};}exports[_0xcf74('0x3b')]=function(_0x3cf917,_0x3cfd99){var _0x19065c={},_0x1cce2e={'count':0x0,'rows':[]};var _0x5ca9a5=_(db[_0xcf74('0x3c')][_0xcf74('0x3d')])[_0xcf74('0x33')](function(_0x3c65d6){return{'name':_0x3c65d6[_0xcf74('0x3e')],'type':_0x3c65d6[_0xcf74('0x3f')][_0xcf74('0x40')]};})[_0xcf74('0x31')](function(_0x2654b7){return!_['includes'](['password',_0xcf74('0x41')],_0x2654b7[_0xcf74('0x37')]);})[_0xcf74('0x34')]();_0x19065c=qs[_0xcf74('0x42')](_0x5ca9a5,_0x3cf917);var _0x25134a={'where':_0x19065c[_0xcf74('0x43')]};return db[_0xcf74('0x3c')][_0xcf74('0x20')](_0x25134a)[_0xcf74('0x26')](function(_0x5d7c31){_0x1cce2e[_0xcf74('0x20')]=_0x5d7c31;if(_0x3cf917[_0xcf74('0x44')]['includeAll']){_0x19065c['include']=[{'all':!![]}];}if(_0x3cf917['query'][_0xcf74('0x45')]===_0xcf74('0x46')){_0x19065c[_0xcf74('0x47')]=[{'model':db[_0xcf74('0x48')],'as':_0xcf74('0x45')}];}if(!_[_0xcf74('0x35')](_0x19065c[_0xcf74('0x49')],'id')){_0x19065c[_0xcf74('0x49')][_0xcf74('0x4a')]('id');}return db['User']['findAll'](_0x19065c);})[_0xcf74('0x26')](function(_0x29b641){_0x1cce2e[_0xcf74('0x4b')]=_0x29b641;if(_0x3cf917[_0xcf74('0x44')]['openTabs']==='true'){var _0x461c45=[];for(var _0x254acf=0x0;_0x254acf<_0x1cce2e[_0xcf74('0x4b')][_0xcf74('0x4c')];_0x254acf++){_0x461c45[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x4d'),_0x1cce2e[_0xcf74('0x4b')][_0x254acf][_0xcf74('0x4e')]));_0x461c45['push'](get_open_tabs('sms',_0x1cce2e[_0xcf74('0x4b')][_0x254acf]['dataValues']));_0x461c45[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x4f'),_0x1cce2e[_0xcf74('0x4b')][_0x254acf][_0xcf74('0x4e')]));_0x461c45[_0xcf74('0x4a')](get_open_tabs('mail',_0x1cce2e[_0xcf74('0x4b')][_0x254acf][_0xcf74('0x4e')]));_0x461c45[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x50'),_0x1cce2e['rows'][_0x254acf][_0xcf74('0x4e')]));_0x461c45[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x51'),_0x1cce2e['rows'][_0x254acf][_0xcf74('0x4e')]));}return BPromise['all'](_0x461c45)[_0xcf74('0x26')](function(){return _0x1cce2e;});}else{return _0x1cce2e;}})[_0xcf74('0x26')](respondWithFilteredResult(_0x3cfd99,_0x19065c))[_0xcf74('0x1b')](handleError(_0x3cfd99,null));};exports['show']=function(_0x1808e9,_0x46f0ef){var _0x53f7f0={'raw':![],'where':{'id':_0x1808e9['params']['id']}},_0x3f0b8b={};_0x3f0b8b[_0xcf74('0x52')]=_[_0xcf74('0x53')](_[_0xcf74('0x54')](db[_0xcf74('0x3c')]['rawAttributes']),[_0xcf74('0x55'),_0xcf74('0x41')]);_0x3f0b8b[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x1808e9[_0xcf74('0x44')]);_0x3f0b8b[_0xcf74('0x56')]=_[_0xcf74('0x57')](_0x3f0b8b[_0xcf74('0x52')],_0x3f0b8b[_0xcf74('0x44')]);_0x53f7f0[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x3f0b8b[_0xcf74('0x52')],qs['fields'](_0x1808e9[_0xcf74('0x44')][_0xcf74('0x58')]));_0x53f7f0['attributes']=_0x53f7f0[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x53f7f0[_0xcf74('0x49')]:_0x3f0b8b['model'];if(_0x1808e9[_0xcf74('0x44')][_0xcf74('0x59')]){_0x53f7f0['include']=[{'all':!![]}];}if(_0x1808e9['query']['userSetting']==='true'){_0x53f7f0[_0xcf74('0x47')]=[{'model':db[_0xcf74('0x48')],'as':_0xcf74('0x45')}];}_0x53f7f0=_[_0xcf74('0x5a')]({},_0x53f7f0,_0x1808e9['options']);if(!_[_0xcf74('0x35')](_0x53f7f0[_0xcf74('0x49')],'id')){_0x53f7f0[_0xcf74('0x49')][_0xcf74('0x4a')]('id');}return db[_0xcf74('0x3c')][_0xcf74('0x36')](_0x53f7f0)['then'](handleEntityNotFound(_0x46f0ef,null))['then'](function(_0x574b00){var _0x292cd5=[];values=_0x574b00;if(_0x1808e9[_0xcf74('0x44')]['openTabs']===_0xcf74('0x46')){_0x292cd5['push'](get_open_tabs(_0xcf74('0x4d'),_0x574b00['dataValues']));_0x292cd5[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x5b'),_0x574b00[_0xcf74('0x4e')]));_0x292cd5[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x50'),_0x574b00[_0xcf74('0x4e')]));_0x292cd5[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x51'),_0x574b00[_0xcf74('0x4e')]));_0x292cd5[_0xcf74('0x4a')](get_open_tabs('fax',_0x574b00[_0xcf74('0x4e')]));_0x292cd5[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x5c'),_0x574b00[_0xcf74('0x4e')]));return BPromise[_0xcf74('0x5d')](_0x292cd5);}else{return values;}})[_0xcf74('0x26')](function(){return values;})[_0xcf74('0x26')](respondWithResult(_0x46f0ef,null))[_0xcf74('0x1b')](handleError(_0x46f0ef,null));};exports[_0xcf74('0x25')]=function(_0xb6f37,_0x49b5cc){if(_0xb6f37[_0xcf74('0x5e')]['id']){delete _0xb6f37[_0xcf74('0x5e')]['id'];}delete _0xb6f37[_0xcf74('0x5e')]['role'];return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0xb6f37[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x49b5cc,null))[_0xcf74('0x26')](saveUpdates(_0xb6f37[_0xcf74('0x5e')],null))[_0xcf74('0x26')](respondWithResult(_0x49b5cc,null))[_0xcf74('0x1b')](handleError(_0x49b5cc,null));};exports[_0xcf74('0x60')]=function(_0x14509b,_0x48a324){return db[_0xcf74('0x3c')]['describe']()[_0xcf74('0x26')](respondWithResult(_0x48a324,null))[_0xcf74('0x1b')](handleError(_0x48a324,null));};exports[_0xcf74('0x61')]=function(_0x3d3e28,_0x36db02){return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0x3d3e28['params']['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x36db02,null))[_0xcf74('0x26')](function(_0x385e5f){if(_0x385e5f){return _0x385e5f[_0xcf74('0x61')](_0x3d3e28[_0xcf74('0x5e')][_0xcf74('0x62')],_[_0xcf74('0x63')](_0x3d3e28['body'],[_0xcf74('0x62'),'id'])||{});}})[_0xcf74('0x26')](respondWithResult(_0x36db02,null))[_0xcf74('0x1b')](handleError(_0x36db02,null));};function validateUser(_0x249e95){return new BPromise(function(_0x2b0d00,_0x2b0817){if(_0x249e95[_0xcf74('0x64')])return _0x2b0d00(_0x249e95);return db['Setting'][_0xcf74('0x65')](0x1)['then'](function(_0x3c47b9){if(_0x3c47b9[_0xcf74('0x66')])authService[_0xcf74('0x67')](_0x249e95[_0xcf74('0x55')]);db['User'][_0xcf74('0x68')](_0xcf74('0x64'))['then'](function(_0x3c5d18){if(_[_0xcf74('0x69')](_0x3c5d18)){_0x249e95[_0xcf74('0x64')]=_0x3c47b9['min_internal']||0x1;return;}if(_[_0xcf74('0x69')](_0x3c47b9[_0xcf74('0x6a')])||_0x3c47b9[_0xcf74('0x6a')]===_0x3c5d18){_0x249e95[_0xcf74('0x64')]=_0x3c5d18+0x1;return;}if(_0x3c47b9[_0xcf74('0x6a')]>_0x3c5d18){_0x249e95[_0xcf74('0x64')]=_0x3c47b9[_0xcf74('0x6a')];return;}return db['sequelize'][_0xcf74('0x44')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0xcf74('0x6b')]})[_0xcf74('0x26')](function(_0x27e360){if(_0x27e360&&_0x27e360[_0xcf74('0x4c')]){for(var _0x44f3e4=0x0,_0x31103e=_0x27e360[_0xcf74('0x4c')];_0x44f3e4<_0x31103e&&_[_0xcf74('0x69')](_0x249e95[_0xcf74('0x64')]);_0x44f3e4++){if(_0x3c47b9['min_internal']<=_0x27e360[_0x44f3e4]['from']){_0x249e95[_0xcf74('0x64')]=_0x27e360[_0x44f3e4][_0xcf74('0x6c')];}else if(_0x3c47b9[_0xcf74('0x6a')]>_0x27e360[_0x44f3e4][_0xcf74('0x6c')]&&_0x3c47b9[_0xcf74('0x6a')]<=_0x27e360[_0x44f3e4]['to']){_0x249e95[_0xcf74('0x64')]=_0x3c47b9[_0xcf74('0x6a')];}}}if(_[_0xcf74('0x69')](_0x249e95['internal'])){_0x249e95[_0xcf74('0x64')]=_0x3c5d18+0x1;}return _0x2b0d00(_0x249e95);});});})['catch'](function(_0x210713){_0x2b0817(_0x210713);});});}function updateUser(_0x6fd0df){return new BPromise(function(_0x41fa94,_0x5c5fa1){try{if(_0x6fd0df[_0xcf74('0x6d')]){_0x6fd0df[_0xcf74('0x6e')]=_0x6fd0df['internal'];_0x6fd0df['VoiceMail']={'mailbox':_0x6fd0df['internal'],'password':_0x6fd0df[_0xcf74('0x55')],'fullname':_0x6fd0df[_0xcf74('0x6f')],'email':_0x6fd0df['email']};}if(_0x6fd0df['role']==='agent'){if(!_0x6fd0df['permissions'])_0x6fd0df[_0xcf74('0x70')]=[_0xcf74('0x71'),'102','103','113',_0xcf74('0x72'),_0xcf74('0x73'),_0xcf74('0x74'),_0xcf74('0x75'),_0xcf74('0x76'),_0xcf74('0x77'),_0xcf74('0x78'),'100',_0xcf74('0x79'),'114',_0xcf74('0x7a')];}_0x41fa94(_0x6fd0df);}catch(_0x2c39e7){_0x5c5fa1(_0x2c39e7);}});}exports[_0xcf74('0x7b')]=function(_0x39e951,_0x307657){if(_0x39e951[_0xcf74('0x2c')][_0xcf74('0x29')]===_0xcf74('0x2e'))throw new Error(_0xcf74('0x7c'));if(_0x39e951[_0xcf74('0x5e')]['role']==='user'&&_0x39e951[_0xcf74('0x2c')][_0xcf74('0x29')]!==_0xcf74('0x2a')){throw new Error(_0xcf74('0x7d'));}if(_0x39e951[_0xcf74('0x5e')][_0xcf74('0x29')]==='admin'&&_0x39e951[_0xcf74('0x2c')]['role']!==_0xcf74('0x2a')){throw new Error(_0xcf74('0x7e'));}return licenseUtil[_0xcf74('0x7f')]([_0x39e951[_0xcf74('0x5e')]])[_0xcf74('0x26')](function(){return validateUser(_0x39e951[_0xcf74('0x5e')]);})[_0xcf74('0x26')](function(_0x35f30c){return updateUser(_0x35f30c)['then'](function(_0xdea601){if(_0xdea601['role']===_0xcf74('0x2a')){_0xdea601[_0xcf74('0x80')]=_0x39e951['user'][_0xcf74('0x80')];delete _0xdea601[_0xcf74('0x81')];}return _0xdea601;});})[_0xcf74('0x26')](function(_0x302a53){return db[_0xcf74('0x3c')]['create'](_0x302a53,{'include':[{'model':db['VoiceMail'],'as':_0xcf74('0x82')}]});})[_0xcf74('0x26')](function(_0x4411c6){if(_0x39e951[_0xcf74('0x5e')][_0xcf74('0x29')]==='user')return _0x4411c6;if(_0x39e951[_0xcf74('0x2c')][_0xcf74('0x29')]!==_0xcf74('0x2c'))return _0x4411c6;return db['UserProfileSection'][_0xcf74('0x36')]({'where':{'name':_0x4411c6[_0xcf74('0x29')]===_0xcf74('0x2e')?_0xcf74('0x2d'):_0xcf74('0x2f'),'userProfileId':_0x39e951[_0xcf74('0x2c')]['userProfileId']},'raw':!![]})[_0xcf74('0x26')](function(_0x2c6aa7){if(!_0x2c6aa7||_0x2c6aa7['autoAssociation']!=0x0)return _0x4411c6;return db['UserProfileResource'][_0xcf74('0x7b')]({'name':_0x4411c6[_0xcf74('0x37')],'resourceId':_0x4411c6['id'],'type':_0x2c6aa7[_0xcf74('0x37')],'sectionId':_0x2c6aa7['id']},{})[_0xcf74('0x26')](function(){return _0x4411c6;});})['catch'](function(_0x177288){logger[_0xcf74('0x16')](_0xcf74('0x83'),_0x177288);throw _0x177288;});})[_0xcf74('0x26')](respondWithResult(_0x307657,0xc9))[_0xcf74('0x1b')](handleError(_0x307657,null));};exports[_0xcf74('0x84')]=function(_0x3a072d,_0x4884ce){var _0x4a570c=_0x3a072d[_0xcf74('0x5e')];var _0x7eb7fb=[];if(_0x3a072d[_0xcf74('0x2c')][_0xcf74('0x29')]===_0xcf74('0x2e'))throw new Error(_0xcf74('0x7c'));if(_[_0xcf74('0x85')](_0x4a570c,[_0xcf74('0x29'),_0xcf74('0x2c')])&&_0x3a072d[_0xcf74('0x2c')]['role']!==_0xcf74('0x2a')){throw new Error(_0xcf74('0x7d'));}if(_[_0xcf74('0x85')](_0x4a570c,['role','admin'])&&_0x3a072d[_0xcf74('0x2c')][_0xcf74('0x29')]!=='admin'){throw new Error(_0xcf74('0x86'));}return licenseUtil[_0xcf74('0x7f')](_0x4a570c)[_0xcf74('0x26')](function(){return validateUser(_0x4a570c[0x0]);})[_0xcf74('0x26')](function(){for(var _0x4f2b32=0x1;_0x4f2b32<_0x4a570c[_0xcf74('0x4c')];_0x4f2b32++){var _0x487db7=_0x4a570c[_0x4f2b32-0x1][_0xcf74('0x64')];if(!_0x4a570c[_0x4f2b32]['internal'])_0x4a570c[_0x4f2b32]['internal']=_0x487db7+0x1;_0x7eb7fb[_0xcf74('0x4a')](validateUser(_0x4a570c[_0x4f2b32]));}return BPromise[_0xcf74('0x5d')](_0x7eb7fb);})[_0xcf74('0x26')](function(){_0x7eb7fb=[];for(var _0xb21c5b=0x0;_0xb21c5b<_0x4a570c[_0xcf74('0x4c')];_0xb21c5b++){_0x7eb7fb['push'](updateUser(_0x4a570c[_0xb21c5b]));}return BPromise[_0xcf74('0x5d')](_0x7eb7fb);})[_0xcf74('0x26')](function(){return BPromise[_0xcf74('0x87')](_0x4a570c,function(_0x4a547a){return db['User'][_0xcf74('0x7b')](_0x4a547a,{'include':[{'model':db[_0xcf74('0x82')],'as':_0xcf74('0x82')}]})[_0xcf74('0x26')](function(_0x30b054){_0x4a547a['id']=_0x30b054['id'];return _0x4a547a;});});})[_0xcf74('0x26')](function(_0x3fcba0){if(_0x3a072d[_0xcf74('0x5e')][_0xcf74('0x29')]==='user')return _0x3fcba0;if(_0x3a072d['user'][_0xcf74('0x29')]!==_0xcf74('0x2c'))return _0x3fcba0;var _0x506cec=_[_0xcf74('0x85')](_0x3fcba0,function(_0x2df371){return _0x2df371[_0xcf74('0x29')]===_0xcf74('0x2e')||_0x2df371[_0xcf74('0x29')]==='telephone';});if(!_0x506cec)return _0x3fcba0;return db['UserProfileSection'][_0xcf74('0x88')]({'where':{'name':{'$or':['Agents',_0xcf74('0x2f')]},'userProfileId':_0x3a072d[_0xcf74('0x2c')][_0xcf74('0x81')]},'raw':!![]})['then'](function(_0x3b9700){if(_[_0xcf74('0x89')](_0x3b9700)||!_['some'](_0x3b9700,[_0xcf74('0x8a'),0x0]))return _0x3fcba0;_0x7eb7fb=[];var _0x101045=_(_0x3b9700)[_0xcf74('0x33')](function(_0x983d69){if(_0x983d69[_0xcf74('0x8a')]===0x1)return;return _0x983d69['name']===_0xcf74('0x2d')?'agent':_0xcf74('0x30');})['compact']()[_0xcf74('0x34')]();for(var _0x593607=0x0;_0x593607<_0x3fcba0[_0xcf74('0x4c')];_0x593607++){if(!_[_0xcf74('0x35')](_0x101045,_0x3fcba0[_0x593607]['role']))return;var _0x598f9e=_0x3fcba0[_0x593607][_0xcf74('0x29')]===_0xcf74('0x2e')?_0xcf74('0x2d'):_0xcf74('0x2f');_0x7eb7fb[_0xcf74('0x4a')](db['UserProfileResource'][_0xcf74('0x7b')]({'name':_0x3fcba0[_0x593607][_0xcf74('0x37')],'resourceId':_0x3fcba0[_0x593607]['id'],'type':_0x598f9e,'sectionId':_[_0xcf74('0x36')](_0x3b9700,[_0xcf74('0x37'),_0x598f9e])['id']},{}));}return BPromise[_0xcf74('0x5d')](_0x7eb7fb);});})['then'](respondWithResult(_0x4884ce,0xc9))['catch'](handleError(_0x4884ce,null));};exports[_0xcf74('0x8b')]=function(_0x5f0b08,_0x27f94d){if(_0x5f0b08[_0xcf74('0x5e')]['id']){delete _0x5f0b08[_0xcf74('0x5e')]['id'];}return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0x5f0b08[_0xcf74('0x5f')]['id']}})['then'](function(_0x250afe){if(!_0x250afe)return null;if(_0x250afe['id']===_0x5f0b08[_0xcf74('0x2c')]['id']){if(!_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x8c')]||!_0x5f0b08[_0xcf74('0x5e')]['newPassword']){throw new db['Sequelize'][(_0xcf74('0x8d'))](_0xcf74('0x8e'));}if(!_0x250afe[_0xcf74('0x8f')](_0x5f0b08['body'][_0xcf74('0x8c')])){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))](_0xcf74('0x91'));}if(_0x5f0b08['body'][_0xcf74('0x8c')]===_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x92')]){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))](_0xcf74('0x93'));}}else if(_0x5f0b08['user'][_0xcf74('0x29')]==='admin'){if(!_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x92')]){throw new db[(_0xcf74('0x90'))]['ValidationError'](_0xcf74('0x94'));}}else if(_0x5f0b08['user'][_0xcf74('0x29')]===_0xcf74('0x2c')){if(!_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x92')]){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))](_0xcf74('0x94'));}if(_0x250afe[_0xcf74('0x29')]!==_0xcf74('0x2e')){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))](_0xcf74('0x7c'));}}else{throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))]('Unauthorized');}return _0x250afe;})[_0xcf74('0x26')](handleEntityNotFound(_0x27f94d,null))['then'](function(_0x18e305){return db['Setting'][_0xcf74('0x95')]({'attributes':['id',_0xcf74('0x66'),_0xcf74('0x96'),_0xcf74('0x97')]})['then'](function(_0x431bd4){if(_0x431bd4[_0xcf74('0x66')])authService[_0xcf74('0x67')](_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x92')]);if(!_0x431bd4[_0xcf74('0x96')]||!_0x18e305[_0xcf74('0x98')])return _0x18e305;authService['validatePasswordHistory'](_0x5f0b08['body'][_0xcf74('0x92')],_0x18e305['previousPasswords'],_0x431bd4[_0xcf74('0x97')]);return _0x18e305;})[_0xcf74('0x26')](saveUpdates({'password':_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x92')],'passwordResetAt':_0x5f0b08[_0xcf74('0x2c')]['id']==_0x5f0b08['params']['id']?moment():null,'previousPasswords':authService[_0xcf74('0x99')](_0x5f0b08[_0xcf74('0x5e')][_0xcf74('0x92')],_0x18e305[_0xcf74('0x98')])},null));})[_0xcf74('0x26')](respondWithResult(_0x27f94d,null))['catch'](handleError(_0x27f94d,null));};exports[_0xcf74('0x9a')]=function(_0x433635,_0x8ee1e4){var _0x13a25a=_0x433635['body'][_0xcf74('0x9b')];return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0x433635[_0xcf74('0x5f')]['id']},'attributes':['id',_0xcf74('0x37'),_0xcf74('0x29'),_0xcf74('0x9c'),_0xcf74('0x9d'),_0xcf74('0x9e'),'interface']})['then'](handleEntityNotFound(_0x8ee1e4,null))['then'](function(_0x367649){if(_0x367649){if(!utils['isValidChannel'](_0x13a25a)){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))]('Unknown\x20channel');}return _0x367649[_0xcf74('0x9f')+_[_0xcf74('0xa0')](_0x13a25a['toLowerCase']())+_0xcf74('0xa1')](_0x433635['body'][_0xcf74('0x62')],{'penalty':_0x433635[_0xcf74('0x5e')][_0xcf74('0xa2')]||0x0})[_0xcf74('0xa3')](function(_0xdf0cf){for(var _0x3008e2=0x0;_0x3008e2<_0x433635[_0xcf74('0x5e')][_0xcf74('0x62')][_0xcf74('0x4c')];_0x3008e2+=0x1){var _0x4cdeb4={'UserId':Number(_0x433635['params']['id'])};_0x4cdeb4[_[_0xcf74('0xa0')](_0x13a25a[_0xcf74('0xa4')]())+_0xcf74('0xa5')]=Number(_0x433635[_0xcf74('0x5e')][_0xcf74('0x62')][_0x3008e2]);socket['emit'](_0xcf74('0x2c')+_[_0xcf74('0xa0')](_0x13a25a[_0xcf74('0xa4')]())+_0xcf74('0xa6'),_0x4cdeb4);}return _0xdf0cf;})['then'](function(){if(_0x13a25a===_0xcf74('0xa7')){return db[_0xcf74('0xa8')]['findAll']({'where':{'id':_0x433635[_0xcf74('0x5e')][_0xcf74('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xcf74('0x26')](function(_0x35d42e){var _0x3600d2=_0x367649[_0xcf74('0x28')]({'plain':!![]});var _0x2af382=[];if(_0x13a25a==='voice'&&_0x3600d2[_0xcf74('0x29')]===_0xcf74('0x2e')&&_0x3600d2['online']){for(var _0xa8d5b5=0x0;_0xa8d5b5<_0x35d42e['length'];_0xa8d5b5+=0x1){_0x2af382['push']({'membername':_0x3600d2[_0xcf74('0x37')],'UserId':_0x3600d2['id'],'queue_name':_0x35d42e[_0xa8d5b5][_0xcf74('0x37')],'VoiceQueueId':_0x35d42e[_0xa8d5b5]['id'],'interface':_[_0xcf74('0x69')](_0x3600d2[_0xcf74('0xa9')])?util[_0xcf74('0xaa')](_0xcf74('0xab'),_0x3600d2['name']):_0x3600d2[_0xcf74('0xa9')],'paused':_0x3600d2[_0xcf74('0x9e')]||![],'penalty':_0x433635[_0xcf74('0x5e')][_0xcf74('0xa2')]||0x0});}return BPromise[_0xcf74('0x87')](_0x2af382,function(_0x48b78d){return db[_0xcf74('0xac')][_0xcf74('0xad')](_0x48b78d);});}return _0x367649;});}})[_0xcf74('0x26')](respondWithStatusCode(_0x8ee1e4,null))[_0xcf74('0x1b')](handleError(_0x8ee1e4,null));};exports['removeQueues']=function(_0x282cfe,_0x43e263){var _0xf4e273,_0x2a9641;return db['User']['find']({'where':{'id':_0x282cfe[_0xcf74('0x5f')]['id']},'attributes':['id','name',_0xcf74('0x29')]})['then'](handleEntityNotFound(_0x43e263,null))[_0xcf74('0x26')](function(_0x49d01f){if(_0x49d01f){_0xf4e273=_0x49d01f;if(!_0x282cfe[_0xcf74('0x44')][_0xcf74('0x9b')]||!utils['isValidChannel'](_0x282cfe['query']['channel'])){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))](_0xcf74('0xae'));}return _0x49d01f[_0xcf74('0xaf')+_[_0xcf74('0xa0')](_0x282cfe[_0xcf74('0x44')]['channel']['toLowerCase']())+_0xcf74('0xa1')](_0x282cfe[_0xcf74('0x44')][_0xcf74('0x62')]);}})['then'](function(_0x6c1dde){if(_[_0xcf74('0xb0')](_0x282cfe[_0xcf74('0x44')]['ids'])){for(var _0x5cbdae=0x0;_0x5cbdae<_0x282cfe[_0xcf74('0x44')][_0xcf74('0x62')][_0xcf74('0x4c')];_0x5cbdae+=0x1){_0x2a9641={'UserId':Number(_0x282cfe['params']['id'])};_0x2a9641[_['capitalize'](_0x282cfe[_0xcf74('0x44')][_0xcf74('0x9b')][_0xcf74('0xa4')]())+_0xcf74('0xa5')]=Number(_0x282cfe[_0xcf74('0x44')][_0xcf74('0x62')][_0x5cbdae]);socket[_0xcf74('0xb1')]('user'+_[_0xcf74('0xa0')](_0x282cfe['query'][_0xcf74('0x9b')][_0xcf74('0xa4')]())+_0xcf74('0xb2'),_0x2a9641);}}else{_0x2a9641={'UserId':Number(_0x282cfe[_0xcf74('0x5f')]['id'])};_0x2a9641[_[_0xcf74('0xa0')](_0x282cfe[_0xcf74('0x44')][_0xcf74('0x9b')]['toLowerCase']())+_0xcf74('0xa5')]=Number(_0x282cfe['query'][_0xcf74('0x62')]);socket[_0xcf74('0xb1')](_0xcf74('0x2c')+_[_0xcf74('0xa0')](_0x282cfe[_0xcf74('0x44')][_0xcf74('0x9b')][_0xcf74('0xa4')]())+_0xcf74('0xb2'),_0x2a9641);}return _0x6c1dde;})['then'](function(){if(_0x282cfe[_0xcf74('0x44')][_0xcf74('0x9b')]===_0xcf74('0xa7')){return db[_0xcf74('0xac')]['destroy']({'where':{'UserId':_0x282cfe[_0xcf74('0x5f')]['id'],'VoiceQueueId':_0x282cfe[_0xcf74('0x44')]['ids']},'individualHooks':!![]})[_0xcf74('0x26')](function(){return _0xf4e273;});}return _0xf4e273;})[_0xcf74('0x26')](respondWithStatusCode(_0x43e263,null))[_0xcf74('0x1b')](handleError(_0x43e263,null));};exports[_0xcf74('0xb3')]=function(_0x3cda35,_0x5988d2){_0x3cda35['body'][_0xcf74('0xb4')]=_0x3cda35[_0xcf74('0xb5')][_0xcf74('0xb6')];return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0x3cda35[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5988d2,null))[_0xcf74('0x26')](saveUpdates(_0x3cda35[_0xcf74('0x5e')],null))[_0xcf74('0x26')](respondWithResult(_0x5988d2,null))['catch'](handleError(_0x5988d2,null));};exports[_0xcf74('0xb7')]=function(_0xfa09b6,_0x50c427){var _0x166482=path['join'](config[_0xcf74('0xb8')],_0xcf74('0xb9'));return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0xfa09b6[_0xcf74('0x5f')]['id']},'attributes':['id',_0xcf74('0xb4')],'raw':!![]})[_0xcf74('0x26')](handleEntityNotFound(_0x50c427,null))[_0xcf74('0x26')](function(_0x3a9072){if(_0x3a9072){if(_['isNil'](_0x3a9072['userpic'])){return _0x50c427['download'](_0x166482);}else{if(!fs[_0xcf74('0xba')](path['join'](config[_0xcf74('0xb8')],_0xcf74('0xbb'),_0x3a9072[_0xcf74('0xb4')]))){return _0x50c427[_0xcf74('0xbc')](_0x166482);}return _0x50c427['download'](path['join'](config[_0xcf74('0xb8')],_0xcf74('0xbb'),_0x3a9072[_0xcf74('0xb4')]));}}})[_0xcf74('0x1b')](handleError(_0x50c427,null));};exports[_0xcf74('0xbd')]=function(_0x5c733d,_0x38fb42){return db['User']['find']({'where':{'id':_0x5c733d['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x38fb42,null))[_0xcf74('0x26')](function(_0x55d5de){var _0x4ec95a=[];values=_0x55d5de[_0xcf74('0x4e')];_0x4ec95a[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x4d'),_0x55d5de[_0xcf74('0x4e')]));_0x4ec95a[_0xcf74('0x4a')](get_open_tabs('sms',_0x55d5de[_0xcf74('0x4e')]));_0x4ec95a['push'](get_open_tabs(_0xcf74('0x50'),_0x55d5de['dataValues']));_0x4ec95a[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x51'),_0x55d5de[_0xcf74('0x4e')]));_0x4ec95a[_0xcf74('0x4a')](get_open_tabs(_0xcf74('0x4f'),_0x55d5de[_0xcf74('0x4e')]));_0x4ec95a['push'](get_open_tabs(_0xcf74('0x5c'),_0x55d5de[_0xcf74('0x4e')]));return BPromise[_0xcf74('0x5d')](_0x4ec95a);})['then'](function(_0x52bb66){if(_0x52bb66){var _0x51fee5=_[_0xcf74('0x33')](values[_0xcf74('0xbe')],function(_0x2b09f5){return{'channel':'CHAT','id':_0x2b09f5['id'],'createdAt':_0x2b09f5['createdAt']};});var _0x5491de=_[_0xcf74('0x33')](values['FaxOpenTabs'],function(_0x14f77a){return{'channel':_0xcf74('0xbf'),'id':_0x14f77a['id'],'createdAt':_0x14f77a[_0xcf74('0xc0')]};});var _0x1fba5b=_[_0xcf74('0x33')](values['OpenchannelOpenTabs'],function(_0x4244c1){return{'channel':'OPENCHANNEL','id':_0x4244c1['id'],'createdAt':_0x4244c1[_0xcf74('0xc0')]};});var _0x2227e4=_[_0xcf74('0x33')](values[_0xcf74('0xc1')],function(_0x1b53a5){return{'channel':'MAIL','id':_0x1b53a5['id'],'createdAt':_0x1b53a5[_0xcf74('0xc0')]};});var _0x535109=_[_0xcf74('0x33')](values['SmsOpenTabs'],function(_0xc8a64){return{'channel':_0xcf74('0xc2'),'id':_0xc8a64['id'],'createdAt':_0xc8a64['createdAt']};});var _0x233c20=_[_0xcf74('0x33')](values[_0xcf74('0xc3')],function(_0x14a796){return{'channel':_0xcf74('0xc4'),'id':_0x14a796['id'],'createdAt':_0x14a796[_0xcf74('0xc0')]};});var _0x5a535c=_[_0xcf74('0xc5')](_0x51fee5,_0x5491de,_0x1fba5b,_0x2227e4,_0x535109,_0x233c20);var _0xacbe9a={'count':_0x5a535c[_0xcf74('0x4c')],'rows':_0x5a535c};return _0xacbe9a;}else return null;})[_0xcf74('0x26')](respondWithResult(_0x38fb42,null))[_0xcf74('0x1b')](handleError(_0x38fb42,null));};exports['getContacts']=function(_0x39c690,_0x2a98da){var _0xdd6d85={};var _0x2d1021={};var _0x3b45ab;var _0x1ee1cb;return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x39c690[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a98da,null))[_0xcf74('0x26')](function(_0x28f56b){if(_0x28f56b){_0x3b45ab=_0x28f56b;_0x2d1021[_0xcf74('0x52')]=_[_0xcf74('0x54')](db[_0xcf74('0xc6')][_0xcf74('0x3d')]);_0x2d1021[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x39c690['query']);_0x2d1021['filters']=_['intersection'](_0x2d1021['model'],_0x2d1021[_0xcf74('0x44')]);_0xdd6d85['attributes']=_[_0xcf74('0x57')](_0x2d1021[_0xcf74('0x52')],qs['fields'](_0x39c690[_0xcf74('0x44')][_0xcf74('0x58')]));_0xdd6d85[_0xcf74('0x49')]=_0xdd6d85['attributes'][_0xcf74('0x4c')]?_0xdd6d85[_0xcf74('0x49')]:_0x2d1021[_0xcf74('0x52')];_0xdd6d85[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0x39c690[_0xcf74('0x44')]['sort']);_0xdd6d85['where']=qs[_0xcf74('0x56')](_[_0xcf74('0xc9')](_0x39c690['query'],_0x2d1021[_0xcf74('0x56')]));if(_0x39c690[_0xcf74('0x44')]['filter']){_0xdd6d85[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0xdd6d85[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0xdd6d85[_0xcf74('0x49')],function(_0xeaffd3){var _0x2d429d={};_0x2d429d[_0xeaffd3]={'$like':'%'+_0x39c690[_0xcf74('0x44')]['filter']+'%'};return _0x2d429d;})});}_0xdd6d85=_[_0xcf74('0x5a')]({},_0xdd6d85,_0x39c690[_0xcf74('0xca')]);return _0x3b45ab[_0xcf74('0xcb')](_0xdd6d85);}})['then'](function(_0x209ca6){if(_0x209ca6){_0x1ee1cb=_0x209ca6['length'];if(_0x39c690[_0xcf74('0x44')]['hasOwnProperty'](_0xcf74('0x59'))){_0xdd6d85[_0xcf74('0x47')]=[{'model':db[_0xcf74('0xcc')],'as':_0xcf74('0xcd'),'required':![]},{'model':db['Tag'],'as':_0xcf74('0xce'),'attributes':['id',_0xcf74('0x37'),_0xcf74('0xcf')],'where':_0x39c690['query'][_0xcf74('0xd0')]?{'id':_0x39c690[_0xcf74('0x44')][_0xcf74('0xd0')]}:undefined,'required':_0x39c690[_0xcf74('0x44')]['tag']?!![]:![]}];}if(!_0x39c690[_0xcf74('0x44')]['hasOwnProperty']('nolimit')){_0xdd6d85[_0xcf74('0x22')]=qs['limit'](_0x39c690[_0xcf74('0x44')][_0xcf74('0x22')]);_0xdd6d85[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0x39c690[_0xcf74('0x44')][_0xcf74('0x21')]);}return _0x3b45ab[_0xcf74('0xcb')](_0xdd6d85);}})[_0xcf74('0x26')](function(_0x5b1dff){if(_0x5b1dff){return _0x5b1dff?{'count':_0x1ee1cb,'rows':_0x5b1dff}:null;}})[_0xcf74('0x26')](respondWithResult(_0x2a98da,null))[_0xcf74('0x1b')](handleError(_0x2a98da,null));};exports[_0xcf74('0xd1')]=function(_0xe62b17,_0x558eaa){var _0x3f973f;var _0x50842a={};var _0x59a523;return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0xe62b17[_0xcf74('0x5f')]['id']},'attributes':['id',_0xcf74('0x37'),'role']})[_0xcf74('0x26')](handleEntityNotFound(_0x558eaa,null))['then'](function(_0x6353c5){if(!utils['isValidChannel'](_0xe62b17['query']['channel'])){throw new db[(_0xcf74('0x90'))][(_0xcf74('0x8d'))](_0xcf74('0xae'));}_0x3f973f=_0x6353c5;var _0x42614d={};_0x42614d['model']=_[_0xcf74('0x54')](db[_[_0xcf74('0xa0')](_0xe62b17[_0xcf74('0x44')]['channel'])+_0xcf74('0xd2')][_0xcf74('0x3d')]);_0x42614d[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0xe62b17[_0xcf74('0x44')]);_0x42614d[_0xcf74('0x56')]=_[_0xcf74('0x57')](_0x42614d[_0xcf74('0x52')],_0x42614d[_0xcf74('0x44')]);_0x50842a[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x42614d[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0xe62b17[_0xcf74('0x44')][_0xcf74('0x58')]));_0x50842a[_0xcf74('0x49')]=_0x50842a[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x50842a[_0xcf74('0x49')]:_0x42614d[_0xcf74('0x52')];_0x50842a[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0xe62b17[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x50842a[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_[_0xcf74('0xc9')](_0xe62b17[_0xcf74('0x44')],_0x42614d[_0xcf74('0x56')]));if(_0xe62b17['query'][_0xcf74('0x31')]){_0x50842a[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x50842a[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x50842a[_0xcf74('0x49')],function(_0x41defe){var _0x2b5e0e={};_0x2b5e0e[_0x41defe]={'$like':'%'+_0xe62b17[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x2b5e0e;})});}_0x50842a=_['merge']({},_0x50842a,_0xe62b17[_0xcf74('0xca')]);switch(_0x3f973f[_0xcf74('0x29')]){case _0xcf74('0x2a'):return db[_['capitalize'](_0xe62b17[_0xcf74('0x44')][_0xcf74('0x9b')])+'Queue']['findAll'](_0x50842a);case _0xcf74('0x2c'):case'agent':return _0x3f973f[_0xcf74('0x28')+_['capitalize'](_0xe62b17['query'][_0xcf74('0x9b')])+_0xcf74('0xa1')](_0x50842a);default:throw new db['Sequelize'][(_0xcf74('0x8d'))]('Unknown\x20role');}})[_0xcf74('0x26')](function(_0x453c91){_0x59a523=_0x453c91[_0xcf74('0x4c')];if(!_0xe62b17[_0xcf74('0x44')][_0xcf74('0xd3')]('nolimit')){_0x50842a['limit']=qs[_0xcf74('0x22')](_0xe62b17[_0xcf74('0x44')]['limit']);_0x50842a[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0xe62b17[_0xcf74('0x44')]['offset']);}switch(_0x3f973f[_0xcf74('0x29')]){case'admin':return db[_[_0xcf74('0xa0')](_0xe62b17['query']['channel'])+_0xcf74('0xd2')][_0xcf74('0x88')](_0x50842a);case _0xcf74('0x2c'):case _0xcf74('0x2e'):return _0x3f973f[_0xcf74('0x28')+_[_0xcf74('0xa0')](_0xe62b17[_0xcf74('0x44')][_0xcf74('0x9b')])+'Queues'](_0x50842a);}})[_0xcf74('0x26')](function(_0x4b0d60){return{'count':_0x59a523,'rows':_0x4b0d60};})[_0xcf74('0x26')](respondWithResult(_0x558eaa,null))['catch'](handleError(_0x558eaa,null));};exports[_0xcf74('0xd4')]=function(_0x1673a2,_0x127b1f){var _0x4c5ba9={};var _0x1a4abe={};var _0x2d2c3a;var _0x700cf7;return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x1673a2[_0xcf74('0x5f')]['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x127b1f,null))[_0xcf74('0x26')](function(_0x573298){if(_0x573298){_0x2d2c3a=_0x573298;_0x1a4abe[_0xcf74('0x52')]=_['keys'](db[_0xcf74('0xac')]['rawAttributes']);_0x1a4abe[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x1673a2[_0xcf74('0x44')]);_0x1a4abe['filters']=_['intersection'](_0x1a4abe[_0xcf74('0x52')],_0x1a4abe[_0xcf74('0x44')]);_0x4c5ba9[_0xcf74('0x49')]=_['intersection'](_0x1a4abe[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0x1673a2[_0xcf74('0x44')][_0xcf74('0x58')]));_0x4c5ba9[_0xcf74('0x49')]=_0x4c5ba9[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x4c5ba9[_0xcf74('0x49')]:_0x1a4abe[_0xcf74('0x52')];_0x4c5ba9['order']=qs[_0xcf74('0xc8')](_0x1673a2['query'][_0xcf74('0xc8')]);_0x4c5ba9[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_['pick'](_0x1673a2[_0xcf74('0x44')],_0x1a4abe['filters']));if(_0x1673a2[_0xcf74('0x44')]['filter']){_0x4c5ba9[_0xcf74('0x43')]=_['merge'](_0x4c5ba9[_0xcf74('0x43')],{'$or':_['map'](_0x4c5ba9[_0xcf74('0x49')],function(_0x397a0e){var _0x53b3df={};_0x53b3df[_0x397a0e]={'$like':'%'+_0x1673a2['query'][_0xcf74('0x31')]+'%'};return _0x53b3df;})});}_0x4c5ba9=_[_0xcf74('0x5a')]({},_0x4c5ba9,_0x1673a2[_0xcf74('0xca')]);return _0x2d2c3a[_0xcf74('0xd4')](_0x4c5ba9);}})[_0xcf74('0x26')](function(_0x300efa){if(_0x300efa){_0x700cf7=_0x300efa['length'];if(!_0x1673a2[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x4c5ba9['limit']=qs[_0xcf74('0x22')](_0x1673a2[_0xcf74('0x44')][_0xcf74('0x22')]);_0x4c5ba9[_0xcf74('0x21')]=qs['offset'](_0x1673a2[_0xcf74('0x44')][_0xcf74('0x21')]);}return _0x2d2c3a[_0xcf74('0xd4')](_0x4c5ba9);}})[_0xcf74('0x26')](function(_0xe21e52){if(_0xe21e52){return _0xe21e52?{'count':_0x700cf7,'rows':_0xe21e52}:null;}})[_0xcf74('0x26')](respondWithResult(_0x127b1f,null))[_0xcf74('0x1b')](handleError(_0x127b1f,null));};exports[_0xcf74('0xd6')]=function(_0x452549,_0x1d8a54){var _0x1d3c88={};var _0x25c701={};var _0x1919d5;var _0x10a8ad;return db[_0xcf74('0x3c')]['findOne']({'where':{'id':_0x452549[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1d8a54,null))[_0xcf74('0x26')](function(_0x11c2dc){if(_0x11c2dc){_0x1919d5=_0x11c2dc;_0x25c701[_0xcf74('0x52')]=_[_0xcf74('0x54')](db[_0xcf74('0xd7')][_0xcf74('0x3d')]);_0x25c701[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x452549[_0xcf74('0x44')]);_0x25c701[_0xcf74('0x56')]=_['intersection'](_0x25c701['model'],_0x25c701[_0xcf74('0x44')]);_0x1d3c88[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x25c701[_0xcf74('0x52')],qs['fields'](_0x452549['query']['fields']));_0x1d3c88['attributes']=_0x1d3c88['attributes'][_0xcf74('0x4c')]?_0x1d3c88[_0xcf74('0x49')]:_0x25c701[_0xcf74('0x52')];_0x1d3c88['order']=qs[_0xcf74('0xc8')](_0x452549[_0xcf74('0x44')]['sort']);_0x1d3c88[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_[_0xcf74('0xc9')](_0x452549[_0xcf74('0x44')],_0x25c701[_0xcf74('0x56')]));if(_0x452549[_0xcf74('0x44')][_0xcf74('0x31')]){_0x1d3c88[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x1d3c88['where'],{'$or':_[_0xcf74('0x33')](_0x1d3c88[_0xcf74('0x49')],function(_0x355fa7){var _0x1d3c4c={};_0x1d3c4c[_0x355fa7]={'$like':'%'+_0x452549[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x1d3c4c;})});}_0x1d3c88=_[_0xcf74('0x5a')]({},_0x1d3c88,_0x452549['options']);return _0x1919d5['getGroups'](_0x1d3c88);}})[_0xcf74('0x26')](function(_0x1a6b26){if(_0x1a6b26){_0x10a8ad=_0x1a6b26['length'];if(!_0x452549[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x1d3c88[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x452549[_0xcf74('0x44')][_0xcf74('0x22')]);_0x1d3c88['offset']=qs['offset'](_0x452549[_0xcf74('0x44')][_0xcf74('0x21')]);}return _0x1919d5['getGroups'](_0x1d3c88);}})['then'](function(_0x1af20d){if(_0x1af20d){return _0x1af20d?{'count':_0x10a8ad,'rows':_0x1af20d}:null;}})[_0xcf74('0x26')](respondWithResult(_0x1d8a54,null))[_0xcf74('0x1b')](handleError(_0x1d8a54,null));};exports[_0xcf74('0xd8')]=function(_0x338293,_0x437fd4){var _0x29879c={'raw':!![],'where':{}};var _0x3f115e={};var _0x57ea7d={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x338293[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x437fd4,null))['then'](function(_0x351231){if(_0x351231){_0x3f115e['model']=_[_0xcf74('0x54')](db['VoiceRecording'][_0xcf74('0x3d')]);_0x3f115e[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x338293[_0xcf74('0x44')]);_0x3f115e[_0xcf74('0x56')]=_['intersection'](_0x3f115e[_0xcf74('0x52')],_0x3f115e[_0xcf74('0x44')]);_0x29879c[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x3f115e[_0xcf74('0x52')],qs['fields'](_0x338293[_0xcf74('0x44')][_0xcf74('0x58')]));_0x29879c[_0xcf74('0x49')]=_0x29879c[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x29879c[_0xcf74('0x49')]:_0x3f115e[_0xcf74('0x52')];if(!_0x338293[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x29879c[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x338293['query'][_0xcf74('0x22')]);_0x29879c['offset']=qs[_0xcf74('0x21')](_0x338293[_0xcf74('0x44')]['offset']);}_0x29879c[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0x338293[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x29879c[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_['pick'](_0x338293[_0xcf74('0x44')],_0x3f115e[_0xcf74('0x56')]));_0x29879c[_0xcf74('0x43')][_0xcf74('0xd9')]=_0x351231['id'];if(_0x338293[_0xcf74('0x44')][_0xcf74('0x31')]){_0x29879c['where']=_['merge'](_0x29879c[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x29879c[_0xcf74('0x49')],function(_0x173465){var _0x5e782c={};_0x5e782c[_0x173465]={'$like':'%'+_0x338293[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x5e782c;})});}_0x29879c=_[_0xcf74('0x5a')]({},_0x29879c,_0x338293['options']);return db[_0xcf74('0xda')][_0xcf74('0x20')]({'where':_0x29879c[_0xcf74('0x43')]})['then'](function(_0x21038f){_0x57ea7d[_0xcf74('0x20')]=_0x21038f;if(_0x338293['query']['includeAll']){_0x29879c[_0xcf74('0x47')]=[{'all':!![]}];}return db[_0xcf74('0xda')][_0xcf74('0x88')](_0x29879c);})['then'](function(_0x12e395){_0x57ea7d[_0xcf74('0x4b')]=_0x12e395;return _0x57ea7d;});}})[_0xcf74('0x26')](respondWithFilteredResult(_0x437fd4,_0x29879c))[_0xcf74('0x1b')](handleError(_0x437fd4,null));};exports[_0xcf74('0xdb')]=function(_0x331fc0,_0x8a3089){var _0x4fb51f={'raw':!![],'where':{}};var _0x26f526={};var _0x293fa3={'count':0x0,'rows':[]};return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x331fc0[_0xcf74('0x5f')]['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x8a3089,null))['then'](function(_0x211ee7){if(_0x211ee7){_0x26f526['model']=_[_0xcf74('0x54')](db[_0xcf74('0xdc')][_0xcf74('0x3d')]);_0x26f526['query']=_[_0xcf74('0x54')](_0x331fc0[_0xcf74('0x44')]);_0x26f526[_0xcf74('0x56')]=_['intersection'](_0x26f526[_0xcf74('0x52')],_0x26f526[_0xcf74('0x44')]);_0x4fb51f[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x26f526[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0x331fc0[_0xcf74('0x44')][_0xcf74('0x58')]));_0x4fb51f['attributes']=_0x4fb51f[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x4fb51f[_0xcf74('0x49')]:_0x26f526['model'];if(!_0x331fc0[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x4fb51f[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x331fc0[_0xcf74('0x44')][_0xcf74('0x22')]);_0x4fb51f[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0x331fc0[_0xcf74('0x44')]['offset']);}_0x4fb51f[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0x331fc0[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x4fb51f[_0xcf74('0x43')]=qs['filters'](_[_0xcf74('0xc9')](_0x331fc0['query'],_0x26f526[_0xcf74('0x56')]));_0x4fb51f[_0xcf74('0x43')]['UserId']=_0x211ee7['id'];if(_0x331fc0[_0xcf74('0x44')][_0xcf74('0x31')]){_0x4fb51f[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x4fb51f[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x4fb51f[_0xcf74('0x49')],function(_0x22d0b0){var _0x5bae44={};_0x5bae44[_0x22d0b0]={'$like':'%'+_0x331fc0[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x5bae44;})});}_0x4fb51f=_['merge']({},_0x4fb51f,_0x331fc0[_0xcf74('0xca')]);return db[_0xcf74('0xdc')][_0xcf74('0x20')]({'where':_0x4fb51f[_0xcf74('0x43')]})[_0xcf74('0x26')](function(_0x384cf9){_0x293fa3['count']=_0x384cf9;if(_0x331fc0['query'][_0xcf74('0x59')]){_0x4fb51f[_0xcf74('0x47')]=[{'all':!![]}];}return db[_0xcf74('0xdc')][_0xcf74('0x88')](_0x4fb51f);})[_0xcf74('0x26')](function(_0x280ade){_0x293fa3[_0xcf74('0x4b')]=_0x280ade;return _0x293fa3;});}})['then'](respondWithFilteredResult(_0x8a3089,_0x4fb51f))[_0xcf74('0x1b')](handleError(_0x8a3089,null));};exports['getChatInteractions']=function(_0x2e0dde,_0x468de5){var _0x81cc48={};var _0x55ed60={};var _0x621fc5;var _0x4baa41;return db[_0xcf74('0x3c')]['findOne']({'where':{'id':_0x2e0dde[_0xcf74('0x5f')]['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x468de5,null))['then'](function(_0x425f06){if(_0x425f06){_0x621fc5=_0x425f06;_0x55ed60['model']=_[_0xcf74('0x54')](db['ChatInteraction']['rawAttributes']);_0x55ed60['query']=_[_0xcf74('0x54')](_0x2e0dde[_0xcf74('0x44')]);_0x55ed60['filters']=_[_0xcf74('0x57')](_0x55ed60[_0xcf74('0x52')],_0x55ed60[_0xcf74('0x44')]);_0x81cc48['attributes']=_[_0xcf74('0x57')](_0x55ed60[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0x2e0dde[_0xcf74('0x44')][_0xcf74('0x58')]));_0x81cc48[_0xcf74('0x49')]=_0x81cc48[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x81cc48[_0xcf74('0x49')]:_0x55ed60[_0xcf74('0x52')];_0x81cc48[_0xcf74('0xc7')]=qs['sort'](_0x2e0dde[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x81cc48[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_[_0xcf74('0xc9')](_0x2e0dde[_0xcf74('0x44')],_0x55ed60[_0xcf74('0x56')]));if(_0x2e0dde['query'][_0xcf74('0x31')]){_0x81cc48[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x81cc48[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x81cc48['attributes'],function(_0x50b99a){var _0x233ccd={};_0x233ccd[_0x50b99a]={'$like':'%'+_0x2e0dde[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x233ccd;})});}_0x81cc48=_[_0xcf74('0x5a')]({},_0x81cc48,_0x2e0dde[_0xcf74('0xca')]);return _0x621fc5[_0xcf74('0xdd')](_0x81cc48);}})['then'](function(_0x2dc247){if(_0x2dc247){_0x4baa41=_0x2dc247[_0xcf74('0x4c')];if(!_0x2e0dde[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x81cc48['limit']=qs['limit'](_0x2e0dde['query']['limit']);_0x81cc48[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0x2e0dde[_0xcf74('0x44')][_0xcf74('0x21')]);}return _0x621fc5[_0xcf74('0xdd')](_0x81cc48);}})[_0xcf74('0x26')](function(_0xabfb8f){if(_0xabfb8f){return _0xabfb8f?{'count':_0x4baa41,'rows':_0xabfb8f}:null;}})[_0xcf74('0x26')](respondWithResult(_0x468de5,null))[_0xcf74('0x1b')](handleError(_0x468de5,null));};exports[_0xcf74('0xde')]=function(_0x2e75d0,_0xc169d4){var _0x13e846={};var _0x1158fe={};var _0x49d395;var _0x78f077;return db[_0xcf74('0x3c')]['findOne']({'where':{'id':_0x2e75d0['params']['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0xc169d4,null))[_0xcf74('0x26')](function(_0x17aa65){if(_0x17aa65){_0x49d395=_0x17aa65;_0x1158fe['model']=_[_0xcf74('0x54')](db[_0xcf74('0xdf')][_0xcf74('0x3d')]);_0x1158fe[_0xcf74('0x44')]=_['keys'](_0x2e75d0[_0xcf74('0x44')]);_0x1158fe[_0xcf74('0x56')]=_['intersection'](_0x1158fe[_0xcf74('0x52')],_0x1158fe['query']);_0x13e846[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x1158fe[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0x2e75d0['query'][_0xcf74('0x58')]));_0x13e846['attributes']=_0x13e846[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x13e846['attributes']:_0x1158fe[_0xcf74('0x52')];_0x13e846[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0x2e75d0[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x13e846[_0xcf74('0x43')]=qs['filters'](_[_0xcf74('0xc9')](_0x2e75d0[_0xcf74('0x44')],_0x1158fe['filters']));if(_0x2e75d0[_0xcf74('0x44')][_0xcf74('0x31')]){_0x13e846[_0xcf74('0x43')]=_['merge'](_0x13e846['where'],{'$or':_[_0xcf74('0x33')](_0x13e846[_0xcf74('0x49')],function(_0x509034){var _0x1ecd7e={};_0x1ecd7e[_0x509034]={'$like':'%'+_0x2e75d0[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x1ecd7e;})});}_0x13e846=_['merge']({},_0x13e846,_0x2e75d0[_0xcf74('0xca')]);return _0x49d395[_0xcf74('0xde')](_0x13e846);}})[_0xcf74('0x26')](function(_0x562088){if(_0x562088){_0x78f077=_0x562088[_0xcf74('0x4c')];if(!_0x2e75d0['query'][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x13e846[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x2e75d0['query'][_0xcf74('0x22')]);_0x13e846[_0xcf74('0x21')]=qs['offset'](_0x2e75d0[_0xcf74('0x44')]['offset']);}return _0x49d395[_0xcf74('0xde')](_0x13e846);}})[_0xcf74('0x26')](function(_0x40eb4e){if(_0x40eb4e){return _0x40eb4e?{'count':_0x78f077,'rows':_0x40eb4e}:null;}})['then'](respondWithResult(_0xc169d4,null))['catch'](handleError(_0xc169d4,null));};exports['getMailInteractions']=function(_0x4fafa8,_0x15f389){var _0x2d5a5d={'raw':!![],'where':{}};var _0xfef863={};var _0x2ed2f0={'count':0x0,'rows':[]};return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x4fafa8[_0xcf74('0x5f')]['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x15f389,null))['then'](function(_0x49346d){if(_0x49346d){_0xfef863[_0xcf74('0x52')]=_[_0xcf74('0x54')](db[_0xcf74('0xe0')][_0xcf74('0x3d')]);_0xfef863[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x4fafa8['query']);_0xfef863[_0xcf74('0x56')]=_[_0xcf74('0x57')](_0xfef863['model'],_0xfef863[_0xcf74('0x44')]);_0x2d5a5d[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0xfef863[_0xcf74('0x52')],qs['fields'](_0x4fafa8[_0xcf74('0x44')][_0xcf74('0x58')]));_0x2d5a5d[_0xcf74('0x49')]=_0x2d5a5d[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x2d5a5d[_0xcf74('0x49')]:_0xfef863[_0xcf74('0x52')];if(!_0x4fafa8[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x2d5a5d[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x4fafa8[_0xcf74('0x44')][_0xcf74('0x22')]);_0x2d5a5d[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0x4fafa8[_0xcf74('0x44')][_0xcf74('0x21')]);}_0x2d5a5d[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0x4fafa8[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x2d5a5d[_0xcf74('0x43')]=qs['filters'](_[_0xcf74('0xc9')](_0x4fafa8[_0xcf74('0x44')],_0xfef863[_0xcf74('0x56')]));_0x2d5a5d['where'][_0xcf74('0xd9')]=_0x49346d['id'];if(_0x4fafa8[_0xcf74('0x44')][_0xcf74('0x31')]){_0x2d5a5d[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x2d5a5d[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x2d5a5d[_0xcf74('0x49')],function(_0x50ff38){var _0x2f2ea6={};_0x2f2ea6[_0x50ff38]={'$like':'%'+_0x4fafa8[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x2f2ea6;})});}_0x2d5a5d=_['merge']({},_0x2d5a5d,_0x4fafa8['options']);return db['MailInteraction']['count']({'where':_0x2d5a5d['where']})['then'](function(_0x40b06a){_0x2ed2f0[_0xcf74('0x20')]=_0x40b06a;if(_0x4fafa8['query'][_0xcf74('0x59')]){_0x2d5a5d[_0xcf74('0x47')]=[{'all':!![]}];}return db[_0xcf74('0xe0')][_0xcf74('0x88')](_0x2d5a5d);})[_0xcf74('0x26')](function(_0xea69d3){_0x2ed2f0[_0xcf74('0x4b')]=_0xea69d3;return _0x2ed2f0;});}})[_0xcf74('0x26')](respondWithFilteredResult(_0x15f389,_0x2d5a5d))[_0xcf74('0x1b')](handleError(_0x15f389,null));};exports[_0xcf74('0xe1')]=function(_0x205402,_0x56656b){var _0x16889c={};var _0x1d1183={};var _0x210d55;var _0x2d2754;return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x205402[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x56656b,null))[_0xcf74('0x26')](function(_0x5cbb37){if(_0x5cbb37){_0x210d55=_0x5cbb37;_0x1d1183[_0xcf74('0x52')]=_['keys'](db[_0xcf74('0xe2')][_0xcf74('0x3d')]);_0x1d1183[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x205402[_0xcf74('0x44')]);_0x1d1183[_0xcf74('0x56')]=_['intersection'](_0x1d1183[_0xcf74('0x52')],_0x1d1183[_0xcf74('0x44')]);_0x16889c[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x1d1183[_0xcf74('0x52')],qs['fields'](_0x205402[_0xcf74('0x44')][_0xcf74('0x58')]));_0x16889c[_0xcf74('0x49')]=_0x16889c[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x16889c['attributes']:_0x1d1183[_0xcf74('0x52')];_0x16889c[_0xcf74('0xc7')]=qs['sort'](_0x205402[_0xcf74('0x44')]['sort']);_0x16889c[_0xcf74('0x43')]=qs['filters'](_[_0xcf74('0xc9')](_0x205402['query'],_0x1d1183[_0xcf74('0x56')]));if(_0x205402[_0xcf74('0x44')][_0xcf74('0x31')]){_0x16889c[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x16889c[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x16889c[_0xcf74('0x49')],function(_0x214d5c){var _0x1afbed={};_0x1afbed[_0x214d5c]={'$like':'%'+_0x205402[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x1afbed;})});}_0x16889c=_[_0xcf74('0x5a')]({},_0x16889c,_0x205402[_0xcf74('0xca')]);return _0x210d55['getSmsInteractions'](_0x16889c);}})['then'](function(_0x2fa21d){if(_0x2fa21d){_0x2d2754=_0x2fa21d[_0xcf74('0x4c')];if(!_0x205402[_0xcf74('0x44')]['hasOwnProperty']('nolimit')){_0x16889c[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x205402[_0xcf74('0x44')][_0xcf74('0x22')]);_0x16889c[_0xcf74('0x21')]=qs['offset'](_0x205402[_0xcf74('0x44')]['offset']);}return _0x210d55['getSmsInteractions'](_0x16889c);}})[_0xcf74('0x26')](function(_0x16a0ee){if(_0x16a0ee){return _0x16a0ee?{'count':_0x2d2754,'rows':_0x16a0ee}:null;}})[_0xcf74('0x26')](respondWithResult(_0x56656b,null))[_0xcf74('0x1b')](handleError(_0x56656b,null));};exports[_0xcf74('0xe3')]=function(_0x2d6633,_0x170960){var _0x5c6dc3={};var _0x321b27={};var _0x164838;var _0x203c84;return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x2d6633[_0xcf74('0x5f')]['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x170960,null))['then'](function(_0x16991b){if(_0x16991b){_0x164838=_0x16991b;_0x321b27[_0xcf74('0x52')]=_[_0xcf74('0x54')](db[_0xcf74('0xe4')][_0xcf74('0x3d')]);_0x321b27['query']=_['keys'](_0x2d6633[_0xcf74('0x44')]);_0x321b27[_0xcf74('0x56')]=_[_0xcf74('0x57')](_0x321b27[_0xcf74('0x52')],_0x321b27[_0xcf74('0x44')]);_0x5c6dc3['attributes']=_['intersection'](_0x321b27['model'],qs[_0xcf74('0x58')](_0x2d6633[_0xcf74('0x44')][_0xcf74('0x58')]));_0x5c6dc3[_0xcf74('0x49')]=_0x5c6dc3['attributes'][_0xcf74('0x4c')]?_0x5c6dc3[_0xcf74('0x49')]:_0x321b27[_0xcf74('0x52')];_0x5c6dc3['order']=qs[_0xcf74('0xc8')](_0x2d6633[_0xcf74('0x44')]['sort']);_0x5c6dc3[_0xcf74('0x43')]=qs['filters'](_[_0xcf74('0xc9')](_0x2d6633[_0xcf74('0x44')],_0x321b27[_0xcf74('0x56')]));if(_0x2d6633[_0xcf74('0x44')][_0xcf74('0x31')]){_0x5c6dc3[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x5c6dc3[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x5c6dc3[_0xcf74('0x49')],function(_0x3535ea){var _0x39183b={};_0x39183b[_0x3535ea]={'$like':'%'+_0x2d6633[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x39183b;})});}_0x5c6dc3=_[_0xcf74('0x5a')]({},_0x5c6dc3,_0x2d6633[_0xcf74('0xca')]);return _0x164838[_0xcf74('0xe3')](_0x5c6dc3);}})[_0xcf74('0x26')](function(_0x44b265){if(_0x44b265){_0x203c84=_0x44b265['length'];if(!_0x2d6633[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x5c6dc3[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x2d6633[_0xcf74('0x44')]['limit']);_0x5c6dc3[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0x2d6633[_0xcf74('0x44')][_0xcf74('0x21')]);}return _0x164838[_0xcf74('0xe3')](_0x5c6dc3);}})[_0xcf74('0x26')](function(_0x35ec69){if(_0x35ec69){return _0x35ec69?{'count':_0x203c84,'rows':_0x35ec69}:null;}})[_0xcf74('0x26')](respondWithResult(_0x170960,null))[_0xcf74('0x1b')](handleError(_0x170960,null));};exports[_0xcf74('0xe5')]=function(_0x332ec6,_0x2932ca){var _0x2fff6c={};var _0x4183e1={};var _0x489273;var _0x13394e;return db[_0xcf74('0x3c')]['findOne']({'where':{'id':_0x332ec6['params']['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x2932ca,null))['then'](function(_0x311633){if(_0x311633){_0x489273=_0x311633;_0x4183e1[_0xcf74('0x52')]=_[_0xcf74('0x54')](db[_0xcf74('0xe6')][_0xcf74('0x3d')]);_0x4183e1[_0xcf74('0x44')]=_[_0xcf74('0x54')](_0x332ec6[_0xcf74('0x44')]);_0x4183e1[_0xcf74('0x56')]=_[_0xcf74('0x57')](_0x4183e1[_0xcf74('0x52')],_0x4183e1[_0xcf74('0x44')]);_0x2fff6c[_0xcf74('0x49')]=_['intersection'](_0x4183e1[_0xcf74('0x52')],qs['fields'](_0x332ec6[_0xcf74('0x44')][_0xcf74('0x58')]));_0x2fff6c[_0xcf74('0x49')]=_0x2fff6c[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x2fff6c[_0xcf74('0x49')]:_0x4183e1[_0xcf74('0x52')];_0x2fff6c['order']=qs[_0xcf74('0xc8')](_0x332ec6[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x2fff6c[_0xcf74('0x43')]=qs['filters'](_['pick'](_0x332ec6[_0xcf74('0x44')],_0x4183e1[_0xcf74('0x56')]));if(_0x332ec6[_0xcf74('0x44')]['filter']){_0x2fff6c[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x2fff6c[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x2fff6c[_0xcf74('0x49')],function(_0x4d4d88){var _0x37d66c={};_0x37d66c[_0x4d4d88]={'$like':'%'+_0x332ec6[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x37d66c;})});}_0x2fff6c=_[_0xcf74('0x5a')]({},_0x2fff6c,_0x332ec6[_0xcf74('0xca')]);return _0x489273[_0xcf74('0xe5')](_0x2fff6c);}})[_0xcf74('0x26')](function(_0x55853f){if(_0x55853f){_0x13394e=_0x55853f[_0xcf74('0x4c')];if(!_0x332ec6[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x2fff6c[_0xcf74('0x22')]=qs['limit'](_0x332ec6['query'][_0xcf74('0x22')]);_0x2fff6c['offset']=qs[_0xcf74('0x21')](_0x332ec6['query'][_0xcf74('0x21')]);}return _0x489273[_0xcf74('0xe5')](_0x2fff6c);}})[_0xcf74('0x26')](function(_0x256a25){if(_0x256a25){return _0x256a25?{'count':_0x13394e,'rows':_0x256a25}:null;}})[_0xcf74('0x26')](respondWithResult(_0x2932ca,null))[_0xcf74('0x1b')](handleError(_0x2932ca,null));};exports[_0xcf74('0xe7')]=function(_0x5e663a,_0x2f1b90,_0x186959){var _0xbf5fc;var _0x296a60;var _0x4577c1;var _0x3f2c16=!_[_0xcf74('0x69')](_0x5e663a[_0xcf74('0x5f')]['id'])?_0x5e663a[_0xcf74('0x5f')]['id']:!_[_0xcf74('0x69')](_0x5e663a[_0xcf74('0x2c')]['id'])?_0x5e663a[_0xcf74('0x2c')]['id']:null;return db[_0xcf74('0x3c')]['find']({'where':{'id':_0x3f2c16,'role':{'$or':[_0xcf74('0x2a'),_0xcf74('0x2c'),_0xcf74('0x2e')]}},'attributes':['id',_0xcf74('0x37'),_0xcf74('0xe8'),'mobile',_0xcf74('0x29'),_0xcf74('0x64'),_0xcf74('0x9d')]})[_0xcf74('0x26')](function(_0x1d4258){if(_0x1d4258){if(_0x1d4258[_0xcf74('0x29')]===_0xcf74('0x2e')){_0xbf5fc=_0x1d4258;if(_0x5e663a[_0xcf74('0x5e')][_0xcf74('0xa9')]){_0x4577c1=util[_0xcf74('0xaa')](_0xcf74('0xe9'),_0xbf5fc[_0x5e663a[_0xcf74('0x5e')][_0xcf74('0xa9')]]);}else if(_0x5e663a[_0xcf74('0x5e')][_0xcf74('0xea')]){_0x4577c1=util[_0xcf74('0xaa')]('SIP/%s',_0x5e663a[_0xcf74('0x5e')][_0xcf74('0xea')]);}else{_0x4577c1=util['format'](_0xcf74('0xab'),_0xbf5fc[_0xcf74('0x37')]);}socket['to'](util[_0xcf74('0xaa')]('user:%s',_0xbf5fc[_0xcf74('0x37')]))[_0xcf74('0xb1')](_0xcf74('0xeb'),{'user':{'id':_0xbf5fc['id'],'name':_0xbf5fc[_0xcf74('0x37')]},'ip':_0x5e663a[_0xcf74('0xec')][_0xcf74('0xed')]||_0x5e663a[_0xcf74('0xee')][_0xcf74('0xef')]||_0x5e663a[_0xcf74('0xf0')][_0xcf74('0xef')]||_0x5e663a[_0xcf74('0xee')][_0xcf74('0xf0')][_0xcf74('0xef')]});return db[_0xcf74('0xac')][_0xcf74('0x27')]({'where':{'membername':_0xbf5fc['name']},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0xcf74('0xf1'));}})[_0xcf74('0x26')](function(){if(_0xbf5fc){return _0xbf5fc[_0xcf74('0xf2')]({'raw':!![]});}})[_0xcf74('0x26')](function(_0x266d87){if(_0xbf5fc){var _0x20a5cb=[];if(_0x266d87){_0x296a60=_0x266d87;if(_0x296a60[_0xcf74('0x4c')]){for(var _0x39a780=0x0;_0x39a780<_0x296a60[_0xcf74('0x4c')];_0x39a780++){_0x20a5cb[_0xcf74('0x4a')]({'membername':_0xbf5fc[_0xcf74('0x37')],'UserId':_0xbf5fc['id'],'queue_name':_0x296a60[_0x39a780][_0xcf74('0x37')],'VoiceQueueId':_0x296a60[_0x39a780]['id'],'interface':_0x4577c1,'paused':_0xbf5fc[_0xcf74('0x9d')]||![],'penalty':_0x296a60[_0x39a780][_0xcf74('0xf3')]||0x0});}return BPromise[_0xcf74('0x87')](_0x20a5cb,function(_0x24dffd){return db['UserVoiceQueueRt'][_0xcf74('0xad')](_0x24dffd);});}}}})[_0xcf74('0x26')](function(){if(_0xbf5fc){return db['MemberReport'][_0xcf74('0x88')]({'where':{'membername':_0xbf5fc[_0xcf74('0x37')],'exitAt':null}});}})[_0xcf74('0x26')](function(_0x15e98c){if(_0xbf5fc){var _0x1d19cf=[];_0x15e98c[_0xcf74('0xf4')](function(_0x3a2a05){_0x1d19cf[_0xcf74('0x4a')](_0x3a2a05[_0xcf74('0x25')]({'exitAt':moment()['format'](_0xcf74('0xf5'))}));});return BPromise['all'](_0x1d19cf);}})[_0xcf74('0x26')](function(){if(_0xbf5fc){var _0x2f2a31=[];var _0x2425bb=[];var _0x5a79a8=utils[_0xcf74('0xf6')]();var _0x276d09={'membername':_0xbf5fc['name'],'interface':_0x4577c1,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xbf5fc['role'],'internal':_0xbf5fc[_0xcf74('0x64')]};_0x5a79a8[_0xcf74('0xf4')](function(_0x2d6a3c){_0x2f2a31[_0xcf74('0x4a')](_['merge']({'channel':_0x2d6a3c,'type':_0xcf74('0xf7'),'data1':_0x5e663a[_0xcf74('0x5e')][_0xcf74('0xf8')],'data2':_0x4577c1},_0x276d09));if(_0xbf5fc['loginInPause']){_0x2425bb[_0xcf74('0x4a')](_[_0xcf74('0x5a')]({'channel':_0x2d6a3c,'type':'PAUSE','data1':_0xcf74('0xf9')},_0x276d09));}});return db[_0xcf74('0xfa')]['bulkCreate'](_0x2f2a31['concat'](_0x2425bb),{'individualHooks':!![]});}})['then'](function(){if(_0xbf5fc){return _0xbf5fc[_0xcf74('0x25')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xbf5fc[_0xcf74('0x9d')]||![],'mailPause':_0xbf5fc[_0xcf74('0x9d')]||![],'chatPause':_0xbf5fc[_0xcf74('0x9d')]||![],'faxPause':_0xbf5fc['loginInPause']||![],'smsPause':_0xbf5fc[_0xcf74('0x9d')]||![],'openchannelPause':_0xbf5fc[_0xcf74('0x9d')]||![],'whatsappPause':_0xbf5fc['loginInPause']||![],'pauseType':_0xbf5fc[_0xcf74('0x9d')]?'LOGININPAUSE':null,'interface':_0x4577c1,'lastPauseAt':moment()['format'](_0xcf74('0xf5'))});}})['then'](function(_0x1b47fc){if(_0x5e663a['isMiddleware']){return _0x186959();}else{return BPromise[_0xcf74('0xfb')](_0x1b47fc)[_0xcf74('0x26')](respondWithResult(_0x2f1b90,null));}})[_0xcf74('0x1b')](handleError(_0x2f1b90,null));};exports['logout']=function(_0x50cb53,_0x4b8567){var _0x5ad9ac;return db['User'][_0xcf74('0x36')]({'where':{'id':_0x50cb53[_0xcf74('0x5f')]['id'],'role':'agent'},'attributes':['id',_0xcf74('0x37'),_0xcf74('0x29')]})[_0xcf74('0x26')](handleEntityNotFound(_0x4b8567,null))['then'](function(_0x51bd0d){if(_0x51bd0d){_0x5ad9ac=_0x51bd0d;return db['UserVoiceQueueRt'][_0xcf74('0x27')]({'where':{'membername':_0x5ad9ac[_0xcf74('0x37')]},'individualHooks':!![]});}})[_0xcf74('0x26')](function(){return db[_0xcf74('0xfa')][_0xcf74('0x88')]({'where':{'membername':_0x5ad9ac[_0xcf74('0x37')],'exitAt':null}});})[_0xcf74('0x26')](function(_0x5510bc){var _0x46c032=[];_0x5510bc['forEach'](function(_0x11ddad){_0x46c032[_0xcf74('0x4a')](_0x11ddad['update']({'exitAt':moment()[_0xcf74('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xcf74('0x5d')](_0x46c032);})[_0xcf74('0x26')](function(){return _0x5ad9ac[_0xcf74('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xcf74('0x26')](respondWithResult(_0x4b8567,null))[_0xcf74('0x1b')](handleError(_0x4b8567,null));};exports['pause']=function(_0x452afb,_0xec5635){var _0x2e4554;return db[_0xcf74('0xac')][_0xcf74('0x25')]({'paused':0x1},{'where':{'UserId':_0x452afb[_0xcf74('0x5f')]['id']},'individualHooks':!![]})[_0xcf74('0x26')](function(){return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0x452afb['params']['id'],'role':_0xcf74('0x2e')},'attributes':['id',_0xcf74('0x37'),_0xcf74('0x29'),_0xcf74('0x64'),_0xcf74('0xa9')]});})[_0xcf74('0x26')](handleEntityNotFound(_0xec5635,null))[_0xcf74('0x26')](function(_0x4f35fb){if(_0x4f35fb){_0x2e4554=_0x4f35fb;return respondWithRpcPromise(_0xcf74('0xfc'),_0xcf74('0xfd'),{'id':_0x2e4554['id'],'name':_0x2e4554[_0xcf74('0x37')],'pause':!![]});}})[_0xcf74('0x26')](function(){if(_0x2e4554){return db[_0xcf74('0xfa')]['findAll']({'where':{'membername':_0x2e4554[_0xcf74('0x37')],'type':_0xcf74('0xfe'),'exitAt':null}});}})[_0xcf74('0x26')](function(_0x27b484){if(_0x27b484[_0xcf74('0x4c')]){var _0x41d78c=moment()[_0xcf74('0xaa')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5aa91a=0x0,_0x386129=_0x27b484[_0xcf74('0x4c')];_0x5aa91a<_0x386129;_0x5aa91a++){_0x27b484[_0x5aa91a][_0xcf74('0xff')]({'exitAt':_0x41d78c});}}})[_0xcf74('0x26')](function(){var _0x4e2a61=[];var _0x467432=utils[_0xcf74('0xf6')]();_0x467432[_0xcf74('0xf4')](function(_0xd60389){_0x4e2a61[_0xcf74('0x4a')]({'channel':_0xd60389,'membername':_0x2e4554[_0xcf74('0x37')],'interface':_[_0xcf74('0x69')](_0x2e4554[_0xcf74('0xa9')])?util['format'](_0xcf74('0xab'),_0x2e4554[_0xcf74('0x37')]):_0x2e4554[_0xcf74('0xa9')],'type':_0xcf74('0xfe'),'enterAt':moment()[_0xcf74('0xaa')](_0xcf74('0xf5')),'data1':_0x452afb[_0xcf74('0x5e')][_0xcf74('0x3f')]||'DEFAULT\x20PAUSE','role':_0x2e4554[_0xcf74('0x29')],'internal':_0x2e4554[_0xcf74('0x64')]});});return db[_0xcf74('0xfa')][_0xcf74('0x84')](_0x4e2a61,{'individualHooks':!![]});})[_0xcf74('0x26')](function(){return _0x2e4554['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x452afb['body'][_0xcf74('0x3f')]||_0xcf74('0x100'),'lastPauseAt':moment()[_0xcf74('0xaa')](_0xcf74('0xf5'))});})['then'](respondWithResult(_0xec5635,null))['catch'](handleError(_0xec5635,null));};exports[_0xcf74('0x101')]=function(_0x445e2b,_0x4d79af){var _0x376d13;return db['User'][_0xcf74('0x36')]({'where':{'id':_0x445e2b[_0xcf74('0x5f')]['id']},'attributes':['id',_0xcf74('0x37'),'role',_0xcf74('0x9e'),_0xcf74('0x102'),'chatPause',_0xcf74('0x103'),_0xcf74('0x104'),_0xcf74('0x105'),_0xcf74('0x106'),_0xcf74('0x107'),_0xcf74('0x108')]})[_0xcf74('0x26')](handleEntityNotFound(_0x4d79af,null))[_0xcf74('0x26')](function(_0x356b5b){if(_0x356b5b){_0x376d13=_0x356b5b;if(_0x445e2b[_0xcf74('0x5e')]['channel']&&!utils[_0xcf74('0x109')](_0x445e2b[_0xcf74('0x5e')][_0xcf74('0x9b')])){throw new db[(_0xcf74('0x90'))]['ValidationError']('Unknown\x20channel');}switch(_0x445e2b[_0xcf74('0x5e')][_0xcf74('0x9b')]){case'voice':return respondWithRpcPromise(_0xcf74('0xfc'),'unpause',{'id':_0x376d13['id'],'name':_0x376d13['name'],'pause':![]})[_0xcf74('0x26')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x376d13['id']},'individualHooks':!![]});})['then'](function(){return db[_0xcf74('0xfa')][_0xcf74('0x36')]({'where':{'channel':_0x445e2b[_0xcf74('0x5e')][_0xcf74('0x9b')],'membername':_0x376d13['name'],'type':_0xcf74('0xfe'),'exitAt':null}});})['then'](function(_0x1a08b2){if(_0x1a08b2){return _0x1a08b2[_0xcf74('0x25')]({'exitAt':moment()[_0xcf74('0xaa')](_0xcf74('0xf5')),'data2':_0xcf74('0x10a')},{'individualHooks':!![]});}return null;})[_0xcf74('0x26')](function(){return _0x376d13[_0xcf74('0x25')]({'voicePause':![]});});case'mail':case _0xcf74('0x4d'):case _0xcf74('0x4f'):case _0xcf74('0x5b'):case _0xcf74('0x51'):case _0xcf74('0x50'):return db[_0xcf74('0xfa')][_0xcf74('0x36')]({'where':{'channel':_0x445e2b[_0xcf74('0x5e')]['channel'],'membername':_0x376d13['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x1fef4d){if(_0x1fef4d){return _0x1fef4d['update']({'exitAt':moment()[_0xcf74('0xaa')](_0xcf74('0xf5')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xcf74('0x26')](function(){var _0x263b7d={};_[_0xcf74('0x23')](_0x263b7d,util['format']('%s%s',_0x445e2b[_0xcf74('0x5e')][_0xcf74('0x9b')],_0xcf74('0x10b')),![]);return _0x376d13[_0xcf74('0x25')](_0x263b7d);});default:return respondWithRpcPromise(_0xcf74('0xfc'),_0xcf74('0x101'),{'id':_0x376d13['id'],'name':_0x376d13['name'],'pause':![]})[_0xcf74('0x26')](function(){return db['UserVoiceQueueRt'][_0xcf74('0x25')]({'paused':0x0},{'where':{'UserId':_0x376d13['id']}});})['then'](function(){return db[_0xcf74('0xfa')][_0xcf74('0x88')]({'where':{'membername':_0x376d13[_0xcf74('0x37')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x273d6f){var _0x4cd1ef=[];_0x273d6f['forEach'](function(_0x429aca){_0x4cd1ef[_0xcf74('0x4a')](_0x429aca[_0xcf74('0x25')]({'exitAt':moment()[_0xcf74('0xaa')](_0xcf74('0xf5')),'data2':_0xcf74('0x10a')}));});return BPromise[_0xcf74('0x5d')](_0x4cd1ef);})[_0xcf74('0x26')](function(){return _0x376d13['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xcf74('0x26')](respondWithResult(_0x4d79af,null))['catch'](handleError(_0x4d79af,null));};exports[_0xcf74('0x10c')]=function(_0x3752ee,_0x455e73){var _0x51362a={};var _0x380d73={};var _0x21cd72;var _0x4ccbf2;return db[_0xcf74('0x3c')]['findOne']({'where':{'id':_0x3752ee['params']['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x455e73,null))['then'](function(_0x5c8b91){if(_0x5c8b91){_0x21cd72=_0x5c8b91;_0x380d73['model']=_[_0xcf74('0x54')](db[_0xcf74('0x10d')][_0xcf74('0x3d')]);_0x380d73['query']=_[_0xcf74('0x54')](_0x3752ee['query']);_0x380d73['filters']=_['intersection'](_0x380d73['model'],_0x380d73['query']);_0x51362a[_0xcf74('0x49')]=_['intersection'](_0x380d73[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0x3752ee[_0xcf74('0x44')][_0xcf74('0x58')]));_0x51362a[_0xcf74('0x49')]=_0x51362a[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x51362a[_0xcf74('0x49')]:_0x380d73[_0xcf74('0x52')];_0x51362a['order']=qs['sort'](_0x3752ee[_0xcf74('0x44')]['sort']);_0x51362a[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_[_0xcf74('0xc9')](_0x3752ee['query'],_0x380d73[_0xcf74('0x56')]));if(_0x3752ee[_0xcf74('0x44')][_0xcf74('0x31')]){_0x51362a[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x51362a[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x51362a[_0xcf74('0x49')],function(_0x89d814){var _0xa5a1a1={};_0xa5a1a1[_0x89d814]={'$like':'%'+_0x3752ee[_0xcf74('0x44')]['filter']+'%'};return _0xa5a1a1;})});}_0x51362a=_[_0xcf74('0x5a')]({},_0x51362a,_0x3752ee[_0xcf74('0xca')]);return _0x21cd72[_0xcf74('0x10c')](_0x51362a);}})[_0xcf74('0x26')](function(_0x4f1d1a){if(_0x4f1d1a){_0x4ccbf2=_0x4f1d1a[_0xcf74('0x4c')];if(!_0x3752ee[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x51362a[_0xcf74('0x22')]=qs[_0xcf74('0x22')](_0x3752ee[_0xcf74('0x44')][_0xcf74('0x22')]);_0x51362a[_0xcf74('0x21')]=qs[_0xcf74('0x21')](_0x3752ee[_0xcf74('0x44')][_0xcf74('0x21')]);}return _0x21cd72[_0xcf74('0x10c')](_0x51362a);}})[_0xcf74('0x26')](function(_0x56ce9a){if(_0x56ce9a){return _0x56ce9a?{'count':_0x4ccbf2,'rows':_0x56ce9a}:null;}})[_0xcf74('0x26')](respondWithResult(_0x455e73,null))[_0xcf74('0x1b')](handleError(_0x455e73,null));};exports[_0xcf74('0x10e')]=function(_0x1120b7,_0x42234d){return db[_0xcf74('0x3c')][_0xcf74('0x36')]({'where':{'id':_0x1120b7[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x42234d,null))[_0xcf74('0x26')](function(_0x4be37d){if(_0x4be37d){var _0x25cd42=_0x4be37d['get']({'plain':!![]});return _0x4be37d[_0xcf74('0x10e')](_0x1120b7[_0xcf74('0x5e')][_0xcf74('0x62')],_[_0xcf74('0x63')](_0x1120b7['body'],[_0xcf74('0x62'),'id'])||{})[_0xcf74('0x26')](function(){for(var _0xde9a54=0x0;_0xde9a54<_0x1120b7[_0xcf74('0x5e')]['ids']['length'];_0xde9a54++){var _0x9f1869=[];var _0x1ce724={};db[_0xcf74('0x10d')][_0xcf74('0x95')]({'where':{'id':_0x1120b7[_0xcf74('0x5e')][_0xcf74('0x62')][_0xde9a54]}})['then'](function(_0x384233){_0x1ce724=_0x384233[_0xcf74('0x4e')];_0x9f1869[_0xcf74('0x4a')](_0x384233[_0xcf74('0xf2')]()[_0xcf74('0x26')](function(_0x1b405c){for(var _0x453155=0x0;_0x453155<_0x1b405c[_0xcf74('0x4c')];_0x453155++){_0x1b405c[_0x453155][_0xcf74('0x10f')](_0xcf74('0x9b'),'Voice');}return _0x1b405c;}));_0x9f1869[_0xcf74('0x4a')](_0x384233[_0xcf74('0x110')]()[_0xcf74('0x26')](function(_0xa2d9ad){for(var _0x3b9176=0x0;_0x3b9176<_0xa2d9ad[_0xcf74('0x4c')];_0x3b9176++){_0xa2d9ad[_0x3b9176]['setDataValue'](_0xcf74('0x9b'),_0xcf74('0x111'));}return _0xa2d9ad;}));_0x9f1869[_0xcf74('0x4a')](_0x384233['getMailQueues']()['then'](function(_0x43dc13){for(var _0x23ebba=0x0;_0x23ebba<_0x43dc13[_0xcf74('0x4c')];_0x23ebba++){_0x43dc13[_0x23ebba][_0xcf74('0x10f')]('channel','Mail');}return _0x43dc13;}));_0x9f1869['push'](_0x384233[_0xcf74('0x112')]()[_0xcf74('0x26')](function(_0x10dc9e){for(var _0x4f46d0=0x0;_0x4f46d0<_0x10dc9e[_0xcf74('0x4c')];_0x4f46d0++){_0x10dc9e[_0x4f46d0][_0xcf74('0x10f')](_0xcf74('0x9b'),_0xcf74('0x113'));}return _0x10dc9e;}));_0x9f1869['push'](_0x384233[_0xcf74('0x114')]()['then'](function(_0x4d0500){for(var _0x3c44e5=0x0;_0x3c44e5<_0x4d0500[_0xcf74('0x4c')];_0x3c44e5++){_0x4d0500[_0x3c44e5][_0xcf74('0x10f')]('channel','Whatsapp');}return _0x4d0500;}));_0x9f1869['push'](_0x384233[_0xcf74('0x115')]()[_0xcf74('0x26')](function(_0x2510c5){for(var _0x232046=0x0;_0x232046<_0x2510c5['length'];_0x232046++){_0x2510c5[_0x232046][_0xcf74('0x10f')](_0xcf74('0x9b'),_0xcf74('0x116'));}return _0x2510c5;}));_0x9f1869[_0xcf74('0x4a')](_0x384233[_0xcf74('0x117')]()['then'](function(_0x5e1d4b){for(var _0x402cea=0x0;_0x402cea<_0x5e1d4b[_0xcf74('0x4c')];_0x402cea++){_0x5e1d4b[_0x402cea][_0xcf74('0x10f')](_0xcf74('0x9b'),'Openchannel');}return _0x5e1d4b;}));return BPromise[_0xcf74('0x5d')](_0x9f1869);})[_0xcf74('0x26')](function(_0x50ed13){var _0x2c55cb=_['flatten'](_0x50ed13);_0x9f1869=[];return db[_0xcf74('0x118')][_0xcf74('0x119')](function(_0x4376a8){for(var _0x152e63=0x0;_0x152e63<_0x2c55cb[_0xcf74('0x4c')];_0x152e63++){_0x9f1869['push'](_0x2c55cb[_0x152e63]['addAgent'](_0x25cd42['id']),{'transaction':_0x4376a8});}return BPromise['all'](_0x9f1869)[_0xcf74('0x26')](function(){if(_0x25cd42['online']){return BPromise['each'](_[_0xcf74('0x31')](_0x2c55cb,function(_0x5ed61d){return _0x5ed61d[_0xcf74('0x11a')]('channel')===_0xcf74('0x11b');}),function(_0x261a60){return db[_0xcf74('0xac')][_0xcf74('0xad')]({'membername':_0x25cd42[_0xcf74('0x37')],'UserId':_0x25cd42['id'],'queue_name':_0x261a60[_0xcf74('0x37')],'VoiceQueueId':_0x261a60['id'],'interface':_['isNil'](_0x25cd42[_0xcf74('0xa9')])?util['format'](_0xcf74('0xab'),_0x25cd42[_0xcf74('0x37')]):_0x25cd42[_0xcf74('0xa9')],'paused':_0x25cd42[_0xcf74('0x9e')]||![],'penalty':_0x25cd42[_0xcf74('0xa2')]},{'transaction':_0x4376a8});});}else{return;}})['then'](function(){for(var _0x2ed4b5=0x0;_0x2ed4b5<_0x2c55cb[_0xcf74('0x4c')];_0x2ed4b5++){var _0x4092c4=_0x2c55cb[_0x2ed4b5][_0xcf74('0x11a')](_0xcf74('0x9b'));var _0x53b586=_0x4092c4+_0xcf74('0xa5');socket[_0xcf74('0xb1')]('user'+_0x4092c4+_0xcf74('0xa6'),{'UserId':_0x25cd42['id'],['queueField']:_0x2c55cb[_0x2ed4b5]['id']});}});});})[_0xcf74('0x26')](function(){db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1ce724['id']}})[_0xcf74('0x26')](function(_0x3089c5){if(_0x3089c5){db[_0xcf74('0x11c')][_0xcf74('0x7b')]({'UserId':_0x1120b7['params']['id'],'VoicePrefixId':_0x3089c5['VoicePrefixId']});}});});}});}})[_0xcf74('0x26')](respondWithStatusCode(_0x42234d,null))['catch'](handleError(_0x42234d,null));};exports[_0xcf74('0x11d')]=function(_0x1ccc01,_0x4b4032){return db[_0xcf74('0x3c')]['findOne']({'where':{'id':_0x1ccc01[_0xcf74('0x5f')]['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0x4b4032,null))[_0xcf74('0x26')](function(_0x83b85e){if(_0x83b85e){var _0x365154=_0x83b85e[_0xcf74('0x28')]({'plain':!![]});var _0x7b3270=_0x1ccc01[_0xcf74('0x44')][_0xcf74('0x62')];return _0x83b85e[_0xcf74('0x11d')](_0x7b3270)['then'](function(){for(var _0x48b2b8=0x0;_0x48b2b8<_0x7b3270[_0xcf74('0x4c')];_0x48b2b8++){var _0x30e651=[];var _0x326cbe={};db[_0xcf74('0x10d')][_0xcf74('0x95')]({'where':{'id':_0x7b3270[_0x48b2b8]}})[_0xcf74('0x26')](function(_0x431d07){_0x326cbe=_0x431d07[_0xcf74('0x4e')];_0x30e651[_0xcf74('0x4a')](_0x431d07['getVoiceQueues']()[_0xcf74('0x26')](function(_0x4a1587){for(var _0x44b964=0x0;_0x44b964<_0x4a1587[_0xcf74('0x4c')];_0x44b964++){_0x4a1587[_0x44b964]['setDataValue'](_0xcf74('0x9b'),_0xcf74('0x11b'));}return _0x4a1587;}));_0x30e651[_0xcf74('0x4a')](_0x431d07['getChatQueues']()[_0xcf74('0x26')](function(_0x3b904b){for(var _0x2f977b=0x0;_0x2f977b<_0x3b904b['length'];_0x2f977b++){_0x3b904b[_0x2f977b][_0xcf74('0x10f')](_0xcf74('0x9b'),_0xcf74('0x111'));}return _0x3b904b;}));_0x30e651[_0xcf74('0x4a')](_0x431d07[_0xcf74('0x11e')]()[_0xcf74('0x26')](function(_0x226c2d){for(var _0x37d4ee=0x0;_0x37d4ee<_0x226c2d['length'];_0x37d4ee++){_0x226c2d[_0x37d4ee]['setDataValue'](_0xcf74('0x9b'),_0xcf74('0x11f'));}return _0x226c2d;}));_0x30e651['push'](_0x431d07['getSmsQueues']()['then'](function(_0x52d3c2){for(var _0x4af649=0x0;_0x4af649<_0x52d3c2[_0xcf74('0x4c')];_0x4af649++){_0x52d3c2[_0x4af649]['setDataValue'](_0xcf74('0x9b'),_0xcf74('0x113'));}return _0x52d3c2;}));_0x30e651[_0xcf74('0x4a')](_0x431d07['getWhatsappQueues']()[_0xcf74('0x26')](function(_0x54abd9){for(var _0x7445c7=0x0;_0x7445c7<_0x54abd9[_0xcf74('0x4c')];_0x7445c7++){_0x54abd9[_0x7445c7][_0xcf74('0x10f')](_0xcf74('0x9b'),_0xcf74('0x120'));}return _0x54abd9;}));_0x30e651[_0xcf74('0x4a')](_0x431d07['getFaxQueues']()[_0xcf74('0x26')](function(_0x2c845c){for(var _0x483a76=0x0;_0x483a76<_0x2c845c[_0xcf74('0x4c')];_0x483a76++){_0x2c845c[_0x483a76][_0xcf74('0x10f')](_0xcf74('0x9b'),_0xcf74('0x116'));}return _0x2c845c;}));_0x30e651[_0xcf74('0x4a')](_0x431d07[_0xcf74('0x117')]()[_0xcf74('0x26')](function(_0x2e38b5){for(var _0x28f3c2=0x0;_0x28f3c2<_0x2e38b5[_0xcf74('0x4c')];_0x28f3c2++){_0x2e38b5[_0x28f3c2][_0xcf74('0x10f')]('channel',_0xcf74('0x121'));}return _0x2e38b5;}));return BPromise[_0xcf74('0x5d')](_0x30e651);})[_0xcf74('0x26')](function(_0x2f8f23){var _0x3d3f76=_['flatten'](_0x2f8f23);_0x30e651=[];return db[_0xcf74('0x118')]['transaction'](function(_0x3cc0ae){for(var _0x50248b=0x0;_0x50248b<_0x3d3f76[_0xcf74('0x4c')];_0x50248b++){_0x30e651[_0xcf74('0x4a')](_0x3d3f76[_0x50248b][_0xcf74('0x122')](_0x365154['id']),{'transaction':_0x3cc0ae});}return BPromise['all'](_0x30e651)[_0xcf74('0x26')](function(){if(_0x365154[_0xcf74('0x9c')]){return BPromise[_0xcf74('0x87')](_[_0xcf74('0x31')](_0x3d3f76,function(_0x52da34){return _0x52da34['getDataValue']('channel')===_0xcf74('0x11b');}),function(_0x9113e6){return db[_0xcf74('0xac')][_0xcf74('0x27')]({'where':{'VoiceQueueId':_0x9113e6['id'],'UserId':_0x365154['id']},'transaction':_0x3cc0ae});});}else{return;}})['then'](function(){db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x326cbe['id']}})[_0xcf74('0x26')](function(_0x418f7f){if(_0x418f7f){return db[_0xcf74('0x11c')][_0xcf74('0x27')]({'where':{'UserId':_0x365154['id'],'VoicePrefixId':_0x418f7f[_0xcf74('0x4e')][_0xcf74('0x123')]}});}});})[_0xcf74('0x26')](function(){for(var _0x523864=0x0;_0x523864<_0x3d3f76[_0xcf74('0x4c')];_0x523864++){var _0x106bb8=_0x3d3f76[_0x523864]['getDataValue'](_0xcf74('0x9b'));var _0x27bd29=_0x106bb8+_0xcf74('0xa5');socket[_0xcf74('0xb1')](_0xcf74('0x2c')+_0x106bb8+'Queue:remove',{'UserId':_0x365154['id'],['queueField']:_0x3d3f76[_0x523864]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x4b4032,null))['catch'](handleError(_0x4b4032,null));};exports[_0xcf74('0x124')]=function(_0xa4b3a0,_0x49321e){var _0x3ff6a6={};var _0x26ef4e={};var _0x4e5d0a;var _0x4fe169;return db['User'][_0xcf74('0x95')]({'where':{'id':_0xa4b3a0[_0xcf74('0x5f')]['id']}})['then'](handleEntityNotFound(_0x49321e,null))['then'](function(_0x3cf18f){if(_0x3cf18f){_0x4e5d0a=_0x3cf18f;_0x26ef4e['model']=_[_0xcf74('0x54')](db['CmList'][_0xcf74('0x3d')]);_0x26ef4e['query']=_[_0xcf74('0x54')](_0xa4b3a0[_0xcf74('0x44')]);_0x26ef4e[_0xcf74('0x56')]=_[_0xcf74('0x57')](_0x26ef4e[_0xcf74('0x52')],_0x26ef4e[_0xcf74('0x44')]);_0x3ff6a6[_0xcf74('0x49')]=_[_0xcf74('0x57')](_0x26ef4e['model'],qs[_0xcf74('0x58')](_0xa4b3a0[_0xcf74('0x44')]['fields']));_0x3ff6a6[_0xcf74('0x49')]=_0x3ff6a6['attributes'][_0xcf74('0x4c')]?_0x3ff6a6[_0xcf74('0x49')]:_0x26ef4e['model'];_0x3ff6a6[_0xcf74('0xc7')]=qs['sort'](_0xa4b3a0[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x3ff6a6[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_[_0xcf74('0xc9')](_0xa4b3a0['query'],_0x26ef4e[_0xcf74('0x56')]));if(_0xa4b3a0['query'][_0xcf74('0x31')]){_0x3ff6a6[_0xcf74('0x43')]=_['merge'](_0x3ff6a6[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x3ff6a6[_0xcf74('0x49')],function(_0x8301fe){var _0x1d5fb6={};_0x1d5fb6[_0x8301fe]={'$like':'%'+_0xa4b3a0[_0xcf74('0x44')][_0xcf74('0x31')]+'%'};return _0x1d5fb6;})});}_0x3ff6a6=_[_0xcf74('0x5a')]({},_0x3ff6a6,_0xa4b3a0['options']);return _0x4e5d0a['getLists'](_0x3ff6a6);}})[_0xcf74('0x26')](function(_0x5e0da9){if(_0x5e0da9){_0x4fe169=_0x5e0da9['length'];if(!_0xa4b3a0[_0xcf74('0x44')][_0xcf74('0xd3')](_0xcf74('0xd5'))){_0x3ff6a6[_0xcf74('0x22')]=qs['limit'](_0xa4b3a0[_0xcf74('0x44')][_0xcf74('0x22')]);_0x3ff6a6[_0xcf74('0x21')]=qs['offset'](_0xa4b3a0[_0xcf74('0x44')]['offset']);}return _0x4e5d0a[_0xcf74('0x124')](_0x3ff6a6);}})[_0xcf74('0x26')](function(_0x46b24b){if(_0x46b24b){return _0x46b24b?{'count':_0x4fe169,'rows':_0x46b24b}:null;}})['then'](respondWithResult(_0x49321e,null))['catch'](handleError(_0x49321e,null));};exports['getAgents']=function(_0x4d3ac1,_0xff3c5f){var _0x46cfd8={};var _0x5224c5={};var _0x41f9a4;return db[_0xcf74('0x3c')][_0xcf74('0x95')]({'where':{'id':_0x4d3ac1['params']['id']}})[_0xcf74('0x26')](handleEntityNotFound(_0xff3c5f,null))[_0xcf74('0x26')](function(_0x51fbe7){if(_0x51fbe7){_0x41f9a4=_0x51fbe7;_0x5224c5[_0xcf74('0x52')]=_[_0xcf74('0x54')](db[_0xcf74('0x3c')][_0xcf74('0x3d')]);_0x5224c5['query']=_[_0xcf74('0x54')](_0x4d3ac1['query']);_0x5224c5[_0xcf74('0x56')]=_['intersection'](_0x5224c5[_0xcf74('0x52')],_0x5224c5[_0xcf74('0x44')]);_0x46cfd8['attributes']=_[_0xcf74('0x57')](_0x5224c5[_0xcf74('0x52')],qs[_0xcf74('0x58')](_0x4d3ac1[_0xcf74('0x44')]['fields']));_0x46cfd8[_0xcf74('0x49')]=_0x46cfd8[_0xcf74('0x49')][_0xcf74('0x4c')]?_0x46cfd8[_0xcf74('0x49')]:_0x5224c5[_0xcf74('0x52')];_0x46cfd8[_0xcf74('0xc7')]=qs[_0xcf74('0xc8')](_0x4d3ac1[_0xcf74('0x44')][_0xcf74('0xc8')]);_0x46cfd8[_0xcf74('0x43')]=qs[_0xcf74('0x56')](_['pick'](_0x4d3ac1[_0xcf74('0x44')],_0x5224c5['filters']));if(_0x4d3ac1['query'][_0xcf74('0x31')]){_0x46cfd8[_0xcf74('0x43')]=_[_0xcf74('0x5a')](_0x46cfd8[_0xcf74('0x43')],{'$or':_[_0xcf74('0x33')](_0x46cfd8['attributes'],function(_0x353b20){var _0x4aa24={};_0x4aa24[_0x353b20]={'$like':'%'+_0x4d3ac1['query'][_0xcf74('0x31')]+'%'};return _0x4aa24;})});}_0x46cfd8['model']=db['User'];_0x46cfd8['as']=_0xcf74('0x2d');_0x46cfd8=_[_0xcf74('0x5a')]({},_0x46cfd8,_0x4d3ac1[_0xcf74('0xca')]);return _0x41f9a4['getVoiceQueues']({'include':[_0x46cfd8]});}})[_0xcf74('0x26')](function(_0x12ed3f){if(_0x12ed3f){var _0x399368={},_0x14a58e=[];for(var _0x572c65=0x0;_0x572c65<_0x12ed3f[_0xcf74('0x4c')];_0x572c65+=0x1){for(var _0x541015=0x0,_0x237f71;_0x541015<_0x12ed3f[_0x572c65]['Agents']['length'];_0x541015+=0x1){_0x237f71=_0x12ed3f[_0x572c65]['Agents'][_0x541015][_0xcf74('0x28')]({'plain':!![]});_0x399368[_0x237f71['id']]=_0x237f71;}}_0x399368=_[_0xcf74('0x125')](_0x399368);for(var _0x3fb8d9=qs['offset'](_0x4d3ac1[_0xcf74('0x44')][_0xcf74('0x21')]);_0x3fb8d9<_0x399368[_0xcf74('0x4c')]&&_0x14a58e['length']=_0x30ef79){_0x1f27b8=_0x30ef79;_0x21f9ce=0xc8;}else{_0x21f9ce=0xce;}_0x538b70['status'](_0x21f9ce);return _0x538b70[_0xb940('0x24')](_0xb940('0x25'),_0x3ef892+'-'+_0x1f27b8+'/'+_0x30ef79)[_0xb940('0x20')](_0x39dcdc);}return null;};}function saveUpdates(_0x348141){return function(_0x76fc25){if(_0x76fc25){return _0x76fc25[_0xb940('0x26')](_0x348141)[_0xb940('0x12')](function(_0x1381e0){return _0x1381e0;});}return null;};}function removeEntity(_0x4a98f7){return function(_0x430d82){if(_0x430d82){return _0x430d82['destroy']()[_0xb940('0x12')](function(){var _0x5333be=_0x430d82['get']({'plain':!![]});if(_0x5333be[_0xb940('0x27')]==='admin')return;var _0x2e4f22=[{'name':_0xb940('0x28'),'value':_0xb940('0x29'),'ignore':!![]},{'name':'Agents','value':_0xb940('0x2a'),'ignore':![]},{'name':_0xb940('0x2b'),'value':_0xb940('0x2c'),'ignore':![]}];var _0x44bb05=_(_0x2e4f22)[_0xb940('0x2d')](_0xb940('0x2e'))['map'](_0xb940('0x2f'))[_0xb940('0x2f')]();if(_[_0xb940('0x30')](_0x44bb05,_0x5333be[_0xb940('0x27')])){return;}var _0x1c3c09=_[_0xb940('0x31')](_0x2e4f22,[_0xb940('0x2f'),_0x5333be[_0xb940('0x27')]])[_0xb940('0x32')];return db[_0xb940('0x33')][_0xb940('0x34')]({'where':{'type':_0x1c3c09,'resourceId':_0x5333be['id']}})[_0xb940('0x12')](function(){return _0x430d82;});})[_0xb940('0x12')](function(){_0x4a98f7[_0xb940('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43abd5){return function(_0xd3fd0e){if(!_0xd3fd0e){_0x43abd5[_0xb940('0x1e')](0x194);}return _0xd3fd0e;};}function handleError(_0x52807d,_0x27e38e){_0x27e38e=_0x27e38e||0x1f4;return function(_0x50c47b){logger['error'](_0x50c47b[_0xb940('0x35')]);if(_0x50c47b['name']){delete _0x50c47b[_0xb940('0x32')];}_0x52807d[_0xb940('0x1f')](_0x27e38e)[_0xb940('0x36')](_0x50c47b);};}exports['index']=function(_0x4b4c44,_0x3f7bd0){var _0x136a86={},_0x43f03f={'count':0x0,'rows':[]};var _0x4605c3=_(db[_0xb940('0x37')][_0xb940('0x38')])[_0xb940('0x39')](function(_0x52b7fd){return{'name':_0x52b7fd['fieldName'],'type':_0x52b7fd['type'][_0xb940('0x3a')]};})[_0xb940('0x2d')](function(_0x543b7b){return!_[_0xb940('0x30')](['password','salt'],_0x543b7b[_0xb940('0x32')]);})[_0xb940('0x2f')]();_0x136a86=qs['getOptions'](_0x4605c3,_0x4b4c44);var _0xa716c8={'where':_0x136a86['where']};return db['User'][_0xb940('0x23')](_0xa716c8)[_0xb940('0x12')](function(_0x55a349){_0x43f03f[_0xb940('0x23')]=_0x55a349;if(_0x4b4c44[_0xb940('0x3b')][_0xb940('0x3c')]){_0x136a86[_0xb940('0x3d')]=[{'all':!![]}];}if(_0x4b4c44['query'][_0xb940('0x3e')]==='true'){_0x136a86[_0xb940('0x3d')]=[{'model':db[_0xb940('0x3f')],'as':'userSetting'}];}if(!_[_0xb940('0x30')](_0x136a86[_0xb940('0x40')],'id')){_0x136a86[_0xb940('0x40')][_0xb940('0x41')]('id');}return db[_0xb940('0x37')][_0xb940('0x42')](_0x136a86);})['then'](function(_0x10007f){_0x43f03f[_0xb940('0x43')]=_0x10007f;if(_0x4b4c44[_0xb940('0x3b')][_0xb940('0x44')]===_0xb940('0x45')){var _0x26e2f9=[];for(var _0x5a8cad=0x0;_0x5a8cad<_0x43f03f[_0xb940('0x43')][_0xb940('0x46')];_0x5a8cad++){_0x26e2f9[_0xb940('0x41')](get_open_tabs(_0xb940('0x47'),_0x43f03f[_0xb940('0x43')][_0x5a8cad][_0xb940('0x48')]));_0x26e2f9[_0xb940('0x41')](get_open_tabs('sms',_0x43f03f[_0xb940('0x43')][_0x5a8cad]['dataValues']));_0x26e2f9[_0xb940('0x41')](get_open_tabs(_0xb940('0x49'),_0x43f03f['rows'][_0x5a8cad][_0xb940('0x48')]));_0x26e2f9[_0xb940('0x41')](get_open_tabs(_0xb940('0x4a'),_0x43f03f[_0xb940('0x43')][_0x5a8cad][_0xb940('0x48')]));_0x26e2f9['push'](get_open_tabs(_0xb940('0x4b'),_0x43f03f[_0xb940('0x43')][_0x5a8cad]['dataValues']));_0x26e2f9[_0xb940('0x41')](get_open_tabs('whatsapp',_0x43f03f[_0xb940('0x43')][_0x5a8cad][_0xb940('0x48')]));}return BPromise[_0xb940('0x4c')](_0x26e2f9)['then'](function(){return _0x43f03f;});}else{return _0x43f03f;}})[_0xb940('0x12')](respondWithFilteredResult(_0x3f7bd0,_0x136a86))['catch'](handleError(_0x3f7bd0,null));};exports[_0xb940('0x4d')]=function(_0x301f9d,_0x5ade94){var _0x10f51e={'raw':![],'where':{'id':_0x301f9d[_0xb940('0x4e')]['id']}},_0x260c20={};_0x260c20[_0xb940('0x4f')]=_[_0xb940('0x50')](_[_0xb940('0x51')](db[_0xb940('0x37')][_0xb940('0x38')]),[_0xb940('0x52'),_0xb940('0x53')]);_0x260c20[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x301f9d['query']);_0x260c20[_0xb940('0x54')]=_[_0xb940('0x55')](_0x260c20[_0xb940('0x4f')],_0x260c20[_0xb940('0x3b')]);_0x10f51e['attributes']=_[_0xb940('0x55')](_0x260c20['model'],qs[_0xb940('0x56')](_0x301f9d[_0xb940('0x3b')][_0xb940('0x56')]));_0x10f51e[_0xb940('0x40')]=_0x10f51e[_0xb940('0x40')][_0xb940('0x46')]?_0x10f51e[_0xb940('0x40')]:_0x260c20['model'];if(_0x301f9d[_0xb940('0x3b')][_0xb940('0x3c')]){_0x10f51e[_0xb940('0x3d')]=[{'all':!![]}];}if(_0x301f9d[_0xb940('0x3b')][_0xb940('0x3e')]===_0xb940('0x45')){_0x10f51e['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x10f51e=_[_0xb940('0x57')]({},_0x10f51e,_0x301f9d['options']);if(!_['includes'](_0x10f51e[_0xb940('0x40')],'id')){_0x10f51e[_0xb940('0x40')][_0xb940('0x41')]('id');}return db[_0xb940('0x37')]['find'](_0x10f51e)[_0xb940('0x12')](handleEntityNotFound(_0x5ade94,null))['then'](function(_0x159f06){var _0x53b4eb=[];values=_0x159f06;if(_0x301f9d[_0xb940('0x3b')][_0xb940('0x44')]===_0xb940('0x45')){_0x53b4eb['push'](get_open_tabs(_0xb940('0x47'),_0x159f06[_0xb940('0x48')]));_0x53b4eb[_0xb940('0x41')](get_open_tabs(_0xb940('0x58'),_0x159f06['dataValues']));_0x53b4eb[_0xb940('0x41')](get_open_tabs('openchannel',_0x159f06[_0xb940('0x48')]));_0x53b4eb['push'](get_open_tabs(_0xb940('0x59'),_0x159f06[_0xb940('0x48')]));_0x53b4eb['push'](get_open_tabs(_0xb940('0x49'),_0x159f06[_0xb940('0x48')]));_0x53b4eb[_0xb940('0x41')](get_open_tabs(_0xb940('0x4a'),_0x159f06[_0xb940('0x48')]));return BPromise[_0xb940('0x4c')](_0x53b4eb);}else{return values;}})[_0xb940('0x12')](function(){return values;})[_0xb940('0x12')](respondWithResult(_0x5ade94,null))['catch'](handleError(_0x5ade94,null));};exports['update']=function(_0x36d076,_0x1280be){if(_0x36d076['body']['id']){delete _0x36d076[_0xb940('0x5a')]['id'];}delete _0x36d076['body'][_0xb940('0x27')];return db[_0xb940('0x37')]['find']({'where':{'id':_0x36d076[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x1280be,null))[_0xb940('0x12')](saveUpdates(_0x36d076[_0xb940('0x5a')],null))['then'](respondWithResult(_0x1280be,null))[_0xb940('0x1d')](handleError(_0x1280be,null));};exports[_0xb940('0x5b')]=function(_0x385d9d,_0x30e745){return db[_0xb940('0x37')][_0xb940('0x5b')]()[_0xb940('0x12')](respondWithResult(_0x30e745,null))['catch'](handleError(_0x30e745,null));};exports[_0xb940('0x5c')]=function(_0x39070d,_0x34a782){return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0x39070d[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x34a782,null))['then'](function(_0x51d7b2){if(_0x51d7b2){return _0x51d7b2[_0xb940('0x5c')](_0x39070d[_0xb940('0x5a')]['ids'],_[_0xb940('0x5d')](_0x39070d[_0xb940('0x5a')],[_0xb940('0x5e'),'id'])||{});}})[_0xb940('0x12')](respondWithResult(_0x34a782,null))['catch'](handleError(_0x34a782,null));};function validateUser(_0x343a6a){return new BPromise(function(_0x41706f,_0x498780){if(_0x343a6a[_0xb940('0x5f')])return _0x41706f(_0x343a6a);return db[_0xb940('0x60')][_0xb940('0x61')](0x1)[_0xb940('0x12')](function(_0x3cc98e){if(_0x3cc98e[_0xb940('0x62')])authService[_0xb940('0x63')](_0x343a6a['password']);db[_0xb940('0x37')]['max'](_0xb940('0x5f'))[_0xb940('0x12')](function(_0x394b09){if(_[_0xb940('0x64')](_0x394b09)){_0x343a6a[_0xb940('0x5f')]=_0x3cc98e[_0xb940('0x65')]||0x1;return;}if(_['isNil'](_0x3cc98e['min_internal'])||_0x3cc98e[_0xb940('0x65')]===_0x394b09){_0x343a6a[_0xb940('0x5f')]=_0x394b09+0x1;return;}if(_0x3cc98e[_0xb940('0x65')]>_0x394b09){_0x343a6a[_0xb940('0x5f')]=_0x3cc98e[_0xb940('0x65')];return;}return db['sequelize'][_0xb940('0x3b')](_0xb940('0x66'),{'type':db['sequelize'][_0xb940('0x67')][_0xb940('0x68')]})[_0xb940('0x12')](function(_0x7ba3e4){if(_0x7ba3e4&&_0x7ba3e4[_0xb940('0x46')]){for(var _0x3640d6=0x0,_0x3361b1=_0x7ba3e4['length'];_0x3640d6<_0x3361b1&&_[_0xb940('0x64')](_0x343a6a[_0xb940('0x5f')]);_0x3640d6++){if(_0x3cc98e[_0xb940('0x65')]<=_0x7ba3e4[_0x3640d6]['from']){_0x343a6a[_0xb940('0x5f')]=_0x7ba3e4[_0x3640d6][_0xb940('0x69')];}else if(_0x3cc98e[_0xb940('0x65')]>_0x7ba3e4[_0x3640d6][_0xb940('0x69')]&&_0x3cc98e['min_internal']<=_0x7ba3e4[_0x3640d6]['to']){_0x343a6a[_0xb940('0x5f')]=_0x3cc98e[_0xb940('0x65')];}}}if(_['isNil'](_0x343a6a[_0xb940('0x5f')])){_0x343a6a[_0xb940('0x5f')]=_0x394b09+0x1;}return _0x41706f(_0x343a6a);});});})['catch'](function(_0x37483a){_0x498780(_0x37483a);});});}function updateUser(_0x18ab5f){return new BPromise(function(_0xbb4eef,_0x280796){try{if(_0x18ab5f[_0xb940('0x6a')]){_0x18ab5f[_0xb940('0x6b')]=_0x18ab5f[_0xb940('0x5f')];_0x18ab5f[_0xb940('0x6c')]={'mailbox':_0x18ab5f[_0xb940('0x5f')],'password':_0x18ab5f[_0xb940('0x52')],'fullname':_0x18ab5f['fullname'],'email':_0x18ab5f['email']};}if(_0x18ab5f['role']===_0xb940('0x2a')){if(!_0x18ab5f[_0xb940('0x6d')])_0x18ab5f['permissions']=[_0xb940('0x6e'),_0xb940('0x6f'),_0xb940('0x70'),_0xb940('0x71'),_0xb940('0x72'),_0xb940('0x73'),_0xb940('0x74'),_0xb940('0x75'),'107',_0xb940('0x76'),_0xb940('0x77'),_0xb940('0x78'),_0xb940('0x79'),_0xb940('0x7a'),_0xb940('0x7b')];}_0xbb4eef(_0x18ab5f);}catch(_0x5ba100){_0x280796(_0x5ba100);}});}exports[_0xb940('0x7c')]=function(_0x13312d,_0x1fddbd){if(_0x13312d[_0xb940('0x29')]['role']===_0xb940('0x2a'))throw new Error(_0xb940('0x7d'));if(_0x13312d[_0xb940('0x5a')]['role']===_0xb940('0x29')&&_0x13312d[_0xb940('0x29')][_0xb940('0x27')]!==_0xb940('0x7e')){throw new Error(_0xb940('0x7f'));}if(_0x13312d[_0xb940('0x5a')][_0xb940('0x27')]===_0xb940('0x7e')&&_0x13312d[_0xb940('0x29')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x13312d[_0xb940('0x5a')]])[_0xb940('0x12')](function(){return validateUser(_0x13312d[_0xb940('0x5a')]);})['then'](function(_0x52dfc0){return updateUser(_0x52dfc0)[_0xb940('0x12')](function(_0x6e81fd){if(_0x6e81fd[_0xb940('0x27')]===_0xb940('0x7e')){_0x6e81fd[_0xb940('0x80')]=_0x13312d[_0xb940('0x29')][_0xb940('0x80')];delete _0x6e81fd[_0xb940('0x81')];}return _0x6e81fd;});})[_0xb940('0x12')](function(_0x372a03){return db[_0xb940('0x37')][_0xb940('0x7c')](_0x372a03,{'include':[{'model':db[_0xb940('0x6c')],'as':_0xb940('0x6c')}]});})[_0xb940('0x12')](function(_0x3cd8f8){if(_0x13312d['body'][_0xb940('0x27')]===_0xb940('0x29'))return _0x3cd8f8;if(_0x13312d[_0xb940('0x29')]['role']!==_0xb940('0x29'))return _0x3cd8f8;return db[_0xb940('0x82')]['find']({'where':{'name':_0x3cd8f8[_0xb940('0x27')]===_0xb940('0x2a')?'Agents':_0xb940('0x2b'),'userProfileId':_0x13312d[_0xb940('0x29')][_0xb940('0x81')]},'raw':!![]})[_0xb940('0x12')](function(_0x1d724c){if(!_0x1d724c||_0x1d724c['autoAssociation']!=0x0)return _0x3cd8f8;return db['UserProfileResource']['create']({'name':_0x3cd8f8[_0xb940('0x32')],'resourceId':_0x3cd8f8['id'],'type':_0x1d724c[_0xb940('0x32')],'sectionId':_0x1d724c['id']},{})['then'](function(){return _0x3cd8f8;});})[_0xb940('0x1d')](function(_0x480e29){logger[_0xb940('0x18')](_0xb940('0x83'),_0x480e29);throw _0x480e29;});})[_0xb940('0x12')](respondWithResult(_0x1fddbd,0xc9))['catch'](handleError(_0x1fddbd,null));};exports[_0xb940('0x84')]=function(_0x1ede26,_0x102b8e){var _0x48bd43=_0x1ede26[_0xb940('0x5a')];var _0x1c45b8=[];if(_0x1ede26[_0xb940('0x29')][_0xb940('0x27')]===_0xb940('0x2a'))throw new Error(_0xb940('0x7d'));if(_['some'](_0x48bd43,[_0xb940('0x27'),_0xb940('0x29')])&&_0x1ede26['user'][_0xb940('0x27')]!==_0xb940('0x7e')){throw new Error(_0xb940('0x7f'));}if(_['some'](_0x48bd43,[_0xb940('0x27'),'admin'])&&_0x1ede26[_0xb940('0x29')][_0xb940('0x27')]!=='admin'){throw new Error(_0xb940('0x85'));}return licenseUtil[_0xb940('0x86')](_0x48bd43)[_0xb940('0x12')](function(){return validateUser(_0x48bd43[0x0]);})[_0xb940('0x12')](function(){for(var _0x5c2993=0x1;_0x5c2993<_0x48bd43[_0xb940('0x46')];_0x5c2993++){var _0x79507e=_0x48bd43[_0x5c2993-0x1][_0xb940('0x5f')];if(!_0x48bd43[_0x5c2993][_0xb940('0x5f')])_0x48bd43[_0x5c2993]['internal']=_0x79507e+0x1;_0x1c45b8[_0xb940('0x41')](validateUser(_0x48bd43[_0x5c2993]));}return BPromise[_0xb940('0x4c')](_0x1c45b8);})[_0xb940('0x12')](function(){_0x1c45b8=[];for(var _0x113565=0x0;_0x113565<_0x48bd43[_0xb940('0x46')];_0x113565++){_0x1c45b8['push'](updateUser(_0x48bd43[_0x113565]));}return BPromise[_0xb940('0x4c')](_0x1c45b8);})[_0xb940('0x12')](function(){return BPromise[_0xb940('0x87')](_0x48bd43,function(_0x1135fb){return db[_0xb940('0x37')][_0xb940('0x7c')](_0x1135fb,{'include':[{'model':db[_0xb940('0x6c')],'as':'VoiceMail'}]})[_0xb940('0x12')](function(_0x324f4d){_0x1135fb['id']=_0x324f4d['id'];return _0x1135fb;});});})[_0xb940('0x12')](function(_0x29f039){if(_0x1ede26[_0xb940('0x5a')][_0xb940('0x27')]===_0xb940('0x29'))return _0x29f039;if(_0x1ede26[_0xb940('0x29')][_0xb940('0x27')]!==_0xb940('0x29'))return _0x29f039;var _0x150e5e=_['some'](_0x29f039,function(_0x3101a5){return _0x3101a5[_0xb940('0x27')]==='agent'||_0x3101a5[_0xb940('0x27')]===_0xb940('0x2c');});if(!_0x150e5e)return _0x29f039;return db[_0xb940('0x82')][_0xb940('0x42')]({'where':{'name':{'$or':[_0xb940('0x88'),'Telephones']},'userProfileId':_0x1ede26['user'][_0xb940('0x81')]},'raw':!![]})['then'](function(_0x198169){if(_[_0xb940('0x89')](_0x198169)||!_['some'](_0x198169,[_0xb940('0x8a'),0x0]))return _0x29f039;_0x1c45b8=[];var _0x282790=_(_0x198169)['map'](function(_0x15d7dd){if(_0x15d7dd[_0xb940('0x8a')]===0x1)return;return _0x15d7dd[_0xb940('0x32')]===_0xb940('0x88')?_0xb940('0x2a'):_0xb940('0x2c');})[_0xb940('0x8b')]()[_0xb940('0x2f')]();for(var _0x507a0c=0x0;_0x507a0c<_0x29f039['length'];_0x507a0c++){if(!_['includes'](_0x282790,_0x29f039[_0x507a0c][_0xb940('0x27')]))return;var _0xe92139=_0x29f039[_0x507a0c]['role']==='agent'?'Agents':_0xb940('0x2b');_0x1c45b8['push'](db['UserProfileResource']['create']({'name':_0x29f039[_0x507a0c][_0xb940('0x32')],'resourceId':_0x29f039[_0x507a0c]['id'],'type':_0xe92139,'sectionId':_[_0xb940('0x31')](_0x198169,['name',_0xe92139])['id']},{}));}return BPromise[_0xb940('0x4c')](_0x1c45b8);});})[_0xb940('0x12')](respondWithResult(_0x102b8e,0xc9))[_0xb940('0x1d')](handleError(_0x102b8e,null));};exports[_0xb940('0x8c')]=function(_0xac976d,_0x4b6bda){if(_0xac976d[_0xb940('0x5a')]['id']){delete _0xac976d['body']['id'];}return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0xac976d[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](function(_0x2f788d){if(!_0x2f788d)return null;if(_0x2f788d['id']===_0xac976d['user']['id']){if(!_0xac976d['body'][_0xb940('0x8d')]||!_0xac976d['body']['newPassword']){throw new db['Sequelize'][(_0xb940('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2f788d[_0xb940('0x8f')](_0xac976d[_0xb940('0x5a')][_0xb940('0x8d')])){throw new db[(_0xb940('0x90'))]['ValidationError'](_0xb940('0x91'));}if(_0xac976d[_0xb940('0x5a')]['oldPassword']===_0xac976d[_0xb940('0x5a')]['newPassword']){throw new db[(_0xb940('0x90'))][(_0xb940('0x8e'))](_0xb940('0x92'));}}else if(_0xac976d[_0xb940('0x29')][_0xb940('0x27')]===_0xb940('0x7e')){if(!_0xac976d[_0xb940('0x5a')][_0xb940('0x93')]){throw new db[(_0xb940('0x90'))]['ValidationError'](_0xb940('0x94'));}}else if(_0xac976d['user'][_0xb940('0x27')]===_0xb940('0x29')){if(!_0xac976d['body'][_0xb940('0x93')]){throw new db[(_0xb940('0x90'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x2f788d[_0xb940('0x27')]!=='agent'){throw new db[(_0xb940('0x90'))][(_0xb940('0x8e'))](_0xb940('0x7d'));}}else{throw new db[(_0xb940('0x90'))]['ValidationError'](_0xb940('0x7d'));}return _0x2f788d;})[_0xb940('0x12')](handleEntityNotFound(_0x4b6bda,null))[_0xb940('0x12')](function(_0xb4372d){return db[_0xb940('0x60')][_0xb940('0x95')]({'attributes':['id','securePassword',_0xb940('0x96'),_0xb940('0x97')]})['then'](function(_0x32d4e6){if(_0x32d4e6[_0xb940('0x62')])authService[_0xb940('0x63')](_0xac976d[_0xb940('0x5a')][_0xb940('0x93')]);if(!_0x32d4e6[_0xb940('0x96')]||!_0xb4372d[_0xb940('0x98')])return _0xb4372d;authService[_0xb940('0x99')](_0xac976d[_0xb940('0x5a')][_0xb940('0x93')],_0xb4372d[_0xb940('0x98')],_0x32d4e6[_0xb940('0x97')]);return _0xb4372d;})[_0xb940('0x12')](saveUpdates({'password':_0xac976d[_0xb940('0x5a')][_0xb940('0x93')],'passwordResetAt':_0xac976d[_0xb940('0x29')]['id']==_0xac976d[_0xb940('0x4e')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xac976d['body']['newPassword'],_0xb4372d[_0xb940('0x98')])},null));})['then'](respondWithResult(_0x4b6bda,null))[_0xb940('0x1d')](handleError(_0x4b6bda,null));};exports['addQueues']=function(_0x5857c8,_0x1daa9f){var _0x1f42e6=_0x5857c8[_0xb940('0x5a')][_0xb940('0x9a')];return db['User'][_0xb940('0x31')]({'where':{'id':_0x5857c8['params']['id']},'attributes':['id',_0xb940('0x32'),_0xb940('0x27'),_0xb940('0x9b'),_0xb940('0x9c'),_0xb940('0x9d'),_0xb940('0x9e')]})[_0xb940('0x12')](handleEntityNotFound(_0x1daa9f,null))[_0xb940('0x12')](function(_0x45ca78){if(_0x45ca78){if(!utils[_0xb940('0x9f')](_0x1f42e6)){throw new db[(_0xb940('0x90'))]['ValidationError'](_0xb940('0xa0'));}return _0x45ca78['add'+_[_0xb940('0xa1')](_0x1f42e6[_0xb940('0xa2')]())+_0xb940('0xa3')](_0x5857c8[_0xb940('0x5a')]['ids'],{'penalty':_0x5857c8['body'][_0xb940('0xa4')]||0x0})[_0xb940('0xa5')](function(_0x55f622){for(var _0x3f7f6c=0x0;_0x3f7f6c<_0x5857c8[_0xb940('0x5a')][_0xb940('0x5e')][_0xb940('0x46')];_0x3f7f6c+=0x1){var _0x317286={'UserId':Number(_0x5857c8[_0xb940('0x4e')]['id'])};_0x317286[_['capitalize'](_0x1f42e6[_0xb940('0xa2')]())+_0xb940('0xa6')]=Number(_0x5857c8[_0xb940('0x5a')][_0xb940('0x5e')][_0x3f7f6c]);socket[_0xb940('0xa7')](_0xb940('0x29')+_[_0xb940('0xa1')](_0x1f42e6[_0xb940('0xa2')]())+_0xb940('0xa8'),_0x317286);}return _0x55f622;})[_0xb940('0x12')](function(){if(_0x1f42e6===_0xb940('0xa9')){return db[_0xb940('0xaa')]['findAll']({'where':{'id':_0x5857c8[_0xb940('0x5a')][_0xb940('0x5e')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xb940('0x12')](function(_0x4022bd){var _0x5e1dfd=_0x45ca78['get']({'plain':!![]});var _0x20ed67=[];if(_0x1f42e6===_0xb940('0xa9')&&_0x5e1dfd['role']===_0xb940('0x2a')&&_0x5e1dfd['online']){for(var _0x30243f=0x0;_0x30243f<_0x4022bd[_0xb940('0x46')];_0x30243f+=0x1){_0x20ed67[_0xb940('0x41')]({'membername':_0x5e1dfd[_0xb940('0x32')],'UserId':_0x5e1dfd['id'],'queue_name':_0x4022bd[_0x30243f][_0xb940('0x32')],'VoiceQueueId':_0x4022bd[_0x30243f]['id'],'interface':_[_0xb940('0x64')](_0x5e1dfd[_0xb940('0x9e')])?util[_0xb940('0xab')]('SIP/%s',_0x5e1dfd[_0xb940('0x32')]):_0x5e1dfd[_0xb940('0x9e')],'paused':_0x5e1dfd[_0xb940('0x9d')]||![],'penalty':_0x5857c8[_0xb940('0x5a')][_0xb940('0xa4')]||0x0});}return BPromise[_0xb940('0x87')](_0x20ed67,function(_0x4fec50){return db[_0xb940('0xac')][_0xb940('0xad')](_0x4fec50);});}return _0x45ca78;});}})[_0xb940('0x12')](respondWithStatusCode(_0x1daa9f,null))['catch'](handleError(_0x1daa9f,null));};exports[_0xb940('0xae')]=function(_0x2fdeb2,_0x104e82){var _0x1a5385,_0x152f35;return db['User'][_0xb940('0x31')]({'where':{'id':_0x2fdeb2['params']['id']},'attributes':['id',_0xb940('0x32'),_0xb940('0x27')]})[_0xb940('0x12')](handleEntityNotFound(_0x104e82,null))[_0xb940('0x12')](function(_0x563111){if(_0x563111){_0x1a5385=_0x563111;if(!_0x2fdeb2['query'][_0xb940('0x9a')]||!utils[_0xb940('0x9f')](_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x9a')])){throw new db[(_0xb940('0x90'))][(_0xb940('0x8e'))](_0xb940('0xa0'));}return _0x563111[_0xb940('0xaf')+_['capitalize'](_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x9a')][_0xb940('0xa2')]())+'Queues'](_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x5e')]);}})[_0xb940('0x12')](function(_0x143855){if(_[_0xb940('0xb0')](_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x5e')])){for(var _0x2ed0b1=0x0;_0x2ed0b1<_0x2fdeb2['query']['ids'][_0xb940('0x46')];_0x2ed0b1+=0x1){_0x152f35={'UserId':Number(_0x2fdeb2[_0xb940('0x4e')]['id'])};_0x152f35[_['capitalize'](_0x2fdeb2['query'][_0xb940('0x9a')][_0xb940('0xa2')]())+_0xb940('0xa6')]=Number(_0x2fdeb2[_0xb940('0x3b')]['ids'][_0x2ed0b1]);socket[_0xb940('0xa7')](_0xb940('0x29')+_[_0xb940('0xa1')](_0x2fdeb2[_0xb940('0x3b')]['channel']['toLowerCase']())+_0xb940('0xb1'),_0x152f35);}}else{_0x152f35={'UserId':Number(_0x2fdeb2[_0xb940('0x4e')]['id'])};_0x152f35[_[_0xb940('0xa1')](_0x2fdeb2['query']['channel'][_0xb940('0xa2')]())+_0xb940('0xa6')]=Number(_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x5e')]);socket[_0xb940('0xa7')]('user'+_[_0xb940('0xa1')](_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x9a')][_0xb940('0xa2')]())+_0xb940('0xb1'),_0x152f35);}return _0x143855;})['then'](function(){if(_0x2fdeb2[_0xb940('0x3b')][_0xb940('0x9a')]===_0xb940('0xa9')){return db['UserVoiceQueueRt'][_0xb940('0x34')]({'where':{'UserId':_0x2fdeb2['params']['id'],'VoiceQueueId':_0x2fdeb2[_0xb940('0x3b')]['ids']},'individualHooks':!![]})[_0xb940('0x12')](function(){return _0x1a5385;});}return _0x1a5385;})[_0xb940('0x12')](respondWithStatusCode(_0x104e82,null))[_0xb940('0x1d')](handleError(_0x104e82,null));};exports['addAvatar']=function(_0x24abde,_0x122359){_0x24abde[_0xb940('0x5a')][_0xb940('0xb2')]=_0x24abde[_0xb940('0xb3')][_0xb940('0xb4')];return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0x24abde[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x122359,null))[_0xb940('0x12')](saveUpdates(_0x24abde[_0xb940('0x5a')],null))[_0xb940('0x12')](respondWithResult(_0x122359,null))[_0xb940('0x1d')](handleError(_0x122359,null));};exports[_0xb940('0xb5')]=function(_0x310be2,_0x27f8f9){var _0x42b53e=path['join'](config[_0xb940('0xb6')],_0xb940('0xb7'));return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0x310be2['params']['id']},'attributes':['id',_0xb940('0xb2')],'raw':!![]})[_0xb940('0x12')](handleEntityNotFound(_0x27f8f9,null))[_0xb940('0x12')](function(_0x2e1c5c){if(_0x2e1c5c){if(_[_0xb940('0x64')](_0x2e1c5c[_0xb940('0xb2')])){return _0x27f8f9[_0xb940('0xb8')](_0x42b53e);}else{if(!fs[_0xb940('0xb9')](path[_0xb940('0xba')](config[_0xb940('0xb6')],_0xb940('0xbb'),_0x2e1c5c[_0xb940('0xb2')]))){return _0x27f8f9[_0xb940('0xb8')](_0x42b53e);}return _0x27f8f9[_0xb940('0xb8')](path[_0xb940('0xba')](config[_0xb940('0xb6')],_0xb940('0xbb'),_0x2e1c5c[_0xb940('0xb2')]));}}})[_0xb940('0x1d')](handleError(_0x27f8f9,null));};exports['getOpenTabs']=function(_0x399a02,_0x54e383){return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0x399a02[_0xb940('0x4e')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x54e383,null))[_0xb940('0x12')](function(_0x43c3ee){var _0x3418c5=[];values=_0x43c3ee[_0xb940('0x48')];_0x3418c5[_0xb940('0x41')](get_open_tabs(_0xb940('0x47'),_0x43c3ee[_0xb940('0x48')]));_0x3418c5[_0xb940('0x41')](get_open_tabs(_0xb940('0x58'),_0x43c3ee[_0xb940('0x48')]));_0x3418c5[_0xb940('0x41')](get_open_tabs(_0xb940('0x4b'),_0x43c3ee['dataValues']));_0x3418c5['push'](get_open_tabs(_0xb940('0x59'),_0x43c3ee[_0xb940('0x48')]));_0x3418c5[_0xb940('0x41')](get_open_tabs(_0xb940('0x49'),_0x43c3ee[_0xb940('0x48')]));_0x3418c5[_0xb940('0x41')](get_open_tabs('mail',_0x43c3ee[_0xb940('0x48')]));return BPromise[_0xb940('0x4c')](_0x3418c5);})[_0xb940('0x12')](function(_0x5a6138){if(_0x5a6138){var _0x149b0f=_[_0xb940('0x39')](values[_0xb940('0xbc')],function(_0xf93cab){return{'channel':_0xb940('0xbd'),'id':_0xf93cab['id'],'createdAt':_0xf93cab[_0xb940('0xbe')]};});var _0x2d55f6=_[_0xb940('0x39')](values['FaxOpenTabs'],function(_0x421742){return{'channel':_0xb940('0xbf'),'id':_0x421742['id'],'createdAt':_0x421742[_0xb940('0xbe')]};});var _0x3dcf35=_['map'](values[_0xb940('0xc0')],function(_0x13eebf){return{'channel':'OPENCHANNEL','id':_0x13eebf['id'],'createdAt':_0x13eebf[_0xb940('0xbe')]};});var _0x3fb53a=_['map'](values[_0xb940('0xc1')],function(_0x444333){return{'channel':_0xb940('0xc2'),'id':_0x444333['id'],'createdAt':_0x444333['createdAt']};});var _0x4c4288=_[_0xb940('0x39')](values[_0xb940('0xc3')],function(_0x403dfa){return{'channel':'SMS','id':_0x403dfa['id'],'createdAt':_0x403dfa['createdAt']};});var _0x3c7e42=_[_0xb940('0x39')](values[_0xb940('0xc4')],function(_0x7c69a9){return{'channel':'WHATSAPP','id':_0x7c69a9['id'],'createdAt':_0x7c69a9[_0xb940('0xbe')]};});var _0x3e60dd=_[_0xb940('0xc5')](_0x149b0f,_0x2d55f6,_0x3dcf35,_0x3fb53a,_0x4c4288,_0x3c7e42);var _0x5b79da={'count':_0x3e60dd[_0xb940('0x46')],'rows':_0x3e60dd};return _0x5b79da;}else return null;})[_0xb940('0x12')](respondWithResult(_0x54e383,null))[_0xb940('0x1d')](handleError(_0x54e383,null));};exports[_0xb940('0xc6')]=function(_0x306ca0,_0x30b8aa){var _0x2d9993={};var _0x3d9733={};var _0x180d5b;var _0x20f601;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x306ca0[_0xb940('0x4e')]['id']}})['then'](handleEntityNotFound(_0x30b8aa,null))[_0xb940('0x12')](function(_0x220ea1){if(_0x220ea1){_0x180d5b=_0x220ea1;_0x3d9733[_0xb940('0x4f')]=_[_0xb940('0x51')](db[_0xb940('0xc7')]['rawAttributes']);_0x3d9733[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x306ca0[_0xb940('0x3b')]);_0x3d9733[_0xb940('0x54')]=_[_0xb940('0x55')](_0x3d9733['model'],_0x3d9733[_0xb940('0x3b')]);_0x2d9993['attributes']=_['intersection'](_0x3d9733['model'],qs[_0xb940('0x56')](_0x306ca0[_0xb940('0x3b')][_0xb940('0x56')]));_0x2d9993[_0xb940('0x40')]=_0x2d9993[_0xb940('0x40')][_0xb940('0x46')]?_0x2d9993['attributes']:_0x3d9733[_0xb940('0x4f')];_0x2d9993['order']=qs['sort'](_0x306ca0[_0xb940('0x3b')][_0xb940('0xc8')]);_0x2d9993[_0xb940('0xc9')]=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x306ca0[_0xb940('0x3b')],_0x3d9733['filters']));if(_0x306ca0['query'][_0xb940('0x2d')]){_0x2d9993['where']=_[_0xb940('0x57')](_0x2d9993[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x2d9993[_0xb940('0x40')],function(_0x4d48ee){var _0x3a705e={};_0x3a705e[_0x4d48ee]={'$like':'%'+_0x306ca0['query'][_0xb940('0x2d')]+'%'};return _0x3a705e;})});}_0x2d9993=_[_0xb940('0x57')]({},_0x2d9993,_0x306ca0[_0xb940('0xcb')]);return _0x180d5b[_0xb940('0xc6')](_0x2d9993);}})[_0xb940('0x12')](function(_0x5b243d){if(_0x5b243d){_0x20f601=_0x5b243d['length'];if(_0x306ca0[_0xb940('0x3b')]['hasOwnProperty'](_0xb940('0x3c'))){_0x2d9993[_0xb940('0x3d')]=[{'model':db['CmList'],'as':_0xb940('0xcc'),'required':![]},{'model':db[_0xb940('0xcd')],'as':'Tags','attributes':['id','name','color'],'where':_0x306ca0['query'][_0xb940('0xce')]?{'id':_0x306ca0[_0xb940('0x3b')][_0xb940('0xce')]}:undefined,'required':_0x306ca0[_0xb940('0x3b')]['tag']?!![]:![]}];}if(!_0x306ca0[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x2d9993[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0x306ca0['query'][_0xb940('0xd1')]);_0x2d9993[_0xb940('0x21')]=qs['offset'](_0x306ca0[_0xb940('0x3b')][_0xb940('0x21')]);}return _0x180d5b['getContacts'](_0x2d9993);}})[_0xb940('0x12')](function(_0x31c939){if(_0x31c939){return _0x31c939?{'count':_0x20f601,'rows':_0x31c939}:null;}})[_0xb940('0x12')](respondWithResult(_0x30b8aa,null))[_0xb940('0x1d')](handleError(_0x30b8aa,null));};exports[_0xb940('0xd2')]=function(_0x315242,_0x204352){var _0x244b17;var _0x1fd229={};var _0x12830f;return db[_0xb940('0x37')]['findOne']({'where':{'id':_0x315242[_0xb940('0x4e')]['id']},'attributes':['id',_0xb940('0x32'),_0xb940('0x27')]})[_0xb940('0x12')](handleEntityNotFound(_0x204352,null))['then'](function(_0x599e0c){if(!utils['isValidChannel'](_0x315242[_0xb940('0x3b')][_0xb940('0x9a')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}_0x244b17=_0x599e0c;var _0x208658={};_0x208658[_0xb940('0x4f')]=_[_0xb940('0x51')](db[_['capitalize'](_0x315242[_0xb940('0x3b')]['channel'])+_0xb940('0xd3')][_0xb940('0x38')]);_0x208658[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x315242[_0xb940('0x3b')]);_0x208658[_0xb940('0x54')]=_[_0xb940('0x55')](_0x208658['model'],_0x208658[_0xb940('0x3b')]);_0x1fd229['attributes']=_[_0xb940('0x55')](_0x208658['model'],qs['fields'](_0x315242['query'][_0xb940('0x56')]));_0x1fd229[_0xb940('0x40')]=_0x1fd229[_0xb940('0x40')][_0xb940('0x46')]?_0x1fd229[_0xb940('0x40')]:_0x208658[_0xb940('0x4f')];_0x1fd229['order']=qs['sort'](_0x315242[_0xb940('0x3b')][_0xb940('0xc8')]);_0x1fd229[_0xb940('0xc9')]=qs['filters'](_[_0xb940('0xca')](_0x315242[_0xb940('0x3b')],_0x208658['filters']));if(_0x315242[_0xb940('0x3b')]['filter']){_0x1fd229['where']=_['merge'](_0x1fd229[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x1fd229[_0xb940('0x40')],function(_0x28a18d){var _0x215fe0={};_0x215fe0[_0x28a18d]={'$like':'%'+_0x315242['query']['filter']+'%'};return _0x215fe0;})});}_0x1fd229=_[_0xb940('0x57')]({},_0x1fd229,_0x315242[_0xb940('0xcb')]);switch(_0x244b17[_0xb940('0x27')]){case _0xb940('0x7e'):return db[_[_0xb940('0xa1')](_0x315242[_0xb940('0x3b')][_0xb940('0x9a')])+_0xb940('0xd3')][_0xb940('0x42')](_0x1fd229);case _0xb940('0x29'):case _0xb940('0x2a'):return _0x244b17[_0xb940('0xd4')+_['capitalize'](_0x315242[_0xb940('0x3b')][_0xb940('0x9a')])+_0xb940('0xa3')](_0x1fd229);default:throw new db[(_0xb940('0x90'))]['ValidationError'](_0xb940('0xd5'));}})['then'](function(_0x8cf747){_0x12830f=_0x8cf747[_0xb940('0x46')];if(!_0x315242[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x1fd229[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0x315242[_0xb940('0x3b')]['limit']);_0x1fd229[_0xb940('0x21')]=qs['offset'](_0x315242[_0xb940('0x3b')][_0xb940('0x21')]);}switch(_0x244b17[_0xb940('0x27')]){case _0xb940('0x7e'):return db[_[_0xb940('0xa1')](_0x315242[_0xb940('0x3b')][_0xb940('0x9a')])+_0xb940('0xd3')][_0xb940('0x42')](_0x1fd229);case _0xb940('0x29'):case _0xb940('0x2a'):return _0x244b17[_0xb940('0xd4')+_['capitalize'](_0x315242[_0xb940('0x3b')]['channel'])+_0xb940('0xa3')](_0x1fd229);}})[_0xb940('0x12')](function(_0x44e377){return{'count':_0x12830f,'rows':_0x44e377};})[_0xb940('0x12')](respondWithResult(_0x204352,null))[_0xb940('0x1d')](handleError(_0x204352,null));};exports[_0xb940('0xd6')]=function(_0x54ab39,_0x52ae02){var _0xf0039b={};var _0x48f3e6={};var _0xf3c49e;var _0x5f3cd7;return db['User'][_0xb940('0x95')]({'where':{'id':_0x54ab39['params']['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x52ae02,null))['then'](function(_0x5114a4){if(_0x5114a4){_0xf3c49e=_0x5114a4;_0x48f3e6[_0xb940('0x4f')]=_['keys'](db[_0xb940('0xac')][_0xb940('0x38')]);_0x48f3e6[_0xb940('0x3b')]=_['keys'](_0x54ab39[_0xb940('0x3b')]);_0x48f3e6[_0xb940('0x54')]=_[_0xb940('0x55')](_0x48f3e6[_0xb940('0x4f')],_0x48f3e6[_0xb940('0x3b')]);_0xf0039b['attributes']=_[_0xb940('0x55')](_0x48f3e6[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x54ab39[_0xb940('0x3b')][_0xb940('0x56')]));_0xf0039b[_0xb940('0x40')]=_0xf0039b[_0xb940('0x40')]['length']?_0xf0039b['attributes']:_0x48f3e6[_0xb940('0x4f')];_0xf0039b[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x54ab39['query']['sort']);_0xf0039b['where']=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x54ab39[_0xb940('0x3b')],_0x48f3e6[_0xb940('0x54')]));if(_0x54ab39['query'][_0xb940('0x2d')]){_0xf0039b['where']=_[_0xb940('0x57')](_0xf0039b[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0xf0039b[_0xb940('0x40')],function(_0x41af7f){var _0x2de8e0={};_0x2de8e0[_0x41af7f]={'$like':'%'+_0x54ab39['query'][_0xb940('0x2d')]+'%'};return _0x2de8e0;})});}_0xf0039b=_[_0xb940('0x57')]({},_0xf0039b,_0x54ab39[_0xb940('0xcb')]);return _0xf3c49e['getVoiceQueuesRt'](_0xf0039b);}})[_0xb940('0x12')](function(_0x4209b7){if(_0x4209b7){_0x5f3cd7=_0x4209b7[_0xb940('0x46')];if(!_0x54ab39['query']['hasOwnProperty'](_0xb940('0xd0'))){_0xf0039b['limit']=qs['limit'](_0x54ab39[_0xb940('0x3b')][_0xb940('0xd1')]);_0xf0039b[_0xb940('0x21')]=qs['offset'](_0x54ab39[_0xb940('0x3b')][_0xb940('0x21')]);}return _0xf3c49e[_0xb940('0xd6')](_0xf0039b);}})[_0xb940('0x12')](function(_0x1ec48b){if(_0x1ec48b){return _0x1ec48b?{'count':_0x5f3cd7,'rows':_0x1ec48b}:null;}})[_0xb940('0x12')](respondWithResult(_0x52ae02,null))[_0xb940('0x1d')](handleError(_0x52ae02,null));};exports[_0xb940('0xd8')]=function(_0xd54d67,_0x595878){var _0x1e0c82={};var _0x4b9c2f={};var _0x2bb30c;var _0x53447b;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0xd54d67[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x595878,null))[_0xb940('0x12')](function(_0x442e19){if(_0x442e19){_0x2bb30c=_0x442e19;_0x4b9c2f[_0xb940('0x4f')]=_[_0xb940('0x51')](db['ChatGroup']['rawAttributes']);_0x4b9c2f[_0xb940('0x3b')]=_['keys'](_0xd54d67[_0xb940('0x3b')]);_0x4b9c2f[_0xb940('0x54')]=_[_0xb940('0x55')](_0x4b9c2f[_0xb940('0x4f')],_0x4b9c2f[_0xb940('0x3b')]);_0x1e0c82[_0xb940('0x40')]=_[_0xb940('0x55')](_0x4b9c2f[_0xb940('0x4f')],qs['fields'](_0xd54d67[_0xb940('0x3b')][_0xb940('0x56')]));_0x1e0c82[_0xb940('0x40')]=_0x1e0c82[_0xb940('0x40')][_0xb940('0x46')]?_0x1e0c82['attributes']:_0x4b9c2f[_0xb940('0x4f')];_0x1e0c82[_0xb940('0xd7')]=qs['sort'](_0xd54d67[_0xb940('0x3b')][_0xb940('0xc8')]);_0x1e0c82[_0xb940('0xc9')]=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0xd54d67[_0xb940('0x3b')],_0x4b9c2f[_0xb940('0x54')]));if(_0xd54d67['query']['filter']){_0x1e0c82[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x1e0c82[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x1e0c82[_0xb940('0x40')],function(_0x52b923){var _0x13ebcc={};_0x13ebcc[_0x52b923]={'$like':'%'+_0xd54d67[_0xb940('0x3b')][_0xb940('0x2d')]+'%'};return _0x13ebcc;})});}_0x1e0c82=_[_0xb940('0x57')]({},_0x1e0c82,_0xd54d67[_0xb940('0xcb')]);return _0x2bb30c[_0xb940('0xd8')](_0x1e0c82);}})[_0xb940('0x12')](function(_0x1d41ca){if(_0x1d41ca){_0x53447b=_0x1d41ca[_0xb940('0x46')];if(!_0xd54d67[_0xb940('0x3b')]['hasOwnProperty']('nolimit')){_0x1e0c82['limit']=qs[_0xb940('0xd1')](_0xd54d67[_0xb940('0x3b')][_0xb940('0xd1')]);_0x1e0c82[_0xb940('0x21')]=qs[_0xb940('0x21')](_0xd54d67[_0xb940('0x3b')][_0xb940('0x21')]);}return _0x2bb30c[_0xb940('0xd8')](_0x1e0c82);}})[_0xb940('0x12')](function(_0x14365d){if(_0x14365d){return _0x14365d?{'count':_0x53447b,'rows':_0x14365d}:null;}})[_0xb940('0x12')](respondWithResult(_0x595878,null))[_0xb940('0x1d')](handleError(_0x595878,null));};exports[_0xb940('0xd9')]=function(_0x3eeace,_0x219d4d){var _0x223950={'raw':!![],'where':{}};var _0x3d350f={};var _0x1cf0a7={'count':0x0,'rows':[]};return db['User'][_0xb940('0x95')]({'where':{'id':_0x3eeace[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x219d4d,null))[_0xb940('0x12')](function(_0x161231){if(_0x161231){_0x3d350f[_0xb940('0x4f')]=_['keys'](db[_0xb940('0xda')][_0xb940('0x38')]);_0x3d350f['query']=_['keys'](_0x3eeace[_0xb940('0x3b')]);_0x3d350f[_0xb940('0x54')]=_['intersection'](_0x3d350f[_0xb940('0x4f')],_0x3d350f[_0xb940('0x3b')]);_0x223950[_0xb940('0x40')]=_['intersection'](_0x3d350f['model'],qs[_0xb940('0x56')](_0x3eeace['query'][_0xb940('0x56')]));_0x223950[_0xb940('0x40')]=_0x223950[_0xb940('0x40')][_0xb940('0x46')]?_0x223950[_0xb940('0x40')]:_0x3d350f[_0xb940('0x4f')];if(!_0x3eeace[_0xb940('0x3b')]['hasOwnProperty']('nolimit')){_0x223950[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0x3eeace['query'][_0xb940('0xd1')]);_0x223950[_0xb940('0x21')]=qs[_0xb940('0x21')](_0x3eeace['query'][_0xb940('0x21')]);}_0x223950[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x3eeace[_0xb940('0x3b')][_0xb940('0xc8')]);_0x223950[_0xb940('0xc9')]=qs[_0xb940('0x54')](_['pick'](_0x3eeace[_0xb940('0x3b')],_0x3d350f[_0xb940('0x54')]));_0x223950[_0xb940('0xc9')][_0xb940('0xdb')]=_0x161231['id'];if(_0x3eeace[_0xb940('0x3b')]['filter']){_0x223950[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x223950[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x223950[_0xb940('0x40')],function(_0x94c77d){var _0x218b73={};_0x218b73[_0x94c77d]={'$like':'%'+_0x3eeace[_0xb940('0x3b')][_0xb940('0x2d')]+'%'};return _0x218b73;})});}_0x223950=_['merge']({},_0x223950,_0x3eeace[_0xb940('0xcb')]);return db[_0xb940('0xda')][_0xb940('0x23')]({'where':_0x223950[_0xb940('0xc9')]})[_0xb940('0x12')](function(_0x10f331){_0x1cf0a7[_0xb940('0x23')]=_0x10f331;if(_0x3eeace[_0xb940('0x3b')][_0xb940('0x3c')]){_0x223950[_0xb940('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb940('0x42')](_0x223950);})[_0xb940('0x12')](function(_0x521480){_0x1cf0a7['rows']=_0x521480;return _0x1cf0a7;});}})[_0xb940('0x12')](respondWithFilteredResult(_0x219d4d,_0x223950))[_0xb940('0x1d')](handleError(_0x219d4d,null));};exports[_0xb940('0xdc')]=function(_0x45e37a,_0x1d2657){var _0x4e4838={'raw':!![],'where':{}};var _0x4e514d={};var _0x29d9bd={'count':0x0,'rows':[]};return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x45e37a[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x1d2657,null))[_0xb940('0x12')](function(_0x2aa332){if(_0x2aa332){_0x4e514d[_0xb940('0x4f')]=_[_0xb940('0x51')](db[_0xb940('0xdd')][_0xb940('0x38')]);_0x4e514d[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x45e37a['query']);_0x4e514d[_0xb940('0x54')]=_[_0xb940('0x55')](_0x4e514d[_0xb940('0x4f')],_0x4e514d[_0xb940('0x3b')]);_0x4e4838['attributes']=_[_0xb940('0x55')](_0x4e514d[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x45e37a[_0xb940('0x3b')]['fields']));_0x4e4838['attributes']=_0x4e4838[_0xb940('0x40')][_0xb940('0x46')]?_0x4e4838[_0xb940('0x40')]:_0x4e514d['model'];if(!_0x45e37a['query'][_0xb940('0xcf')](_0xb940('0xd0'))){_0x4e4838[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0x45e37a[_0xb940('0x3b')]['limit']);_0x4e4838[_0xb940('0x21')]=qs[_0xb940('0x21')](_0x45e37a[_0xb940('0x3b')][_0xb940('0x21')]);}_0x4e4838[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x45e37a[_0xb940('0x3b')][_0xb940('0xc8')]);_0x4e4838[_0xb940('0xc9')]=qs['filters'](_[_0xb940('0xca')](_0x45e37a[_0xb940('0x3b')],_0x4e514d[_0xb940('0x54')]));_0x4e4838[_0xb940('0xc9')][_0xb940('0xdb')]=_0x2aa332['id'];if(_0x45e37a[_0xb940('0x3b')][_0xb940('0x2d')]){_0x4e4838[_0xb940('0xc9')]=_['merge'](_0x4e4838[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x4e4838[_0xb940('0x40')],function(_0x204cda){var _0x3c67d4={};_0x3c67d4[_0x204cda]={'$like':'%'+_0x45e37a[_0xb940('0x3b')]['filter']+'%'};return _0x3c67d4;})});}_0x4e4838=_['merge']({},_0x4e4838,_0x45e37a[_0xb940('0xcb')]);return db[_0xb940('0xdd')][_0xb940('0x23')]({'where':_0x4e4838[_0xb940('0xc9')]})['then'](function(_0x464dbb){_0x29d9bd[_0xb940('0x23')]=_0x464dbb;if(_0x45e37a[_0xb940('0x3b')][_0xb940('0x3c')]){_0x4e4838['include']=[{'all':!![]}];}return db[_0xb940('0xdd')][_0xb940('0x42')](_0x4e4838);})[_0xb940('0x12')](function(_0x3cd74e){_0x29d9bd[_0xb940('0x43')]=_0x3cd74e;return _0x29d9bd;});}})[_0xb940('0x12')](respondWithFilteredResult(_0x1d2657,_0x4e4838))['catch'](handleError(_0x1d2657,null));};exports[_0xb940('0xde')]=function(_0x533981,_0x595545){var _0x40bc9a={};var _0x472a04={};var _0x2233dd;var _0x37229e;return db['User'][_0xb940('0x95')]({'where':{'id':_0x533981[_0xb940('0x4e')]['id']}})['then'](handleEntityNotFound(_0x595545,null))[_0xb940('0x12')](function(_0x4daa45){if(_0x4daa45){_0x2233dd=_0x4daa45;_0x472a04[_0xb940('0x4f')]=_[_0xb940('0x51')](db[_0xb940('0xdf')][_0xb940('0x38')]);_0x472a04[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x533981[_0xb940('0x3b')]);_0x472a04['filters']=_[_0xb940('0x55')](_0x472a04['model'],_0x472a04[_0xb940('0x3b')]);_0x40bc9a[_0xb940('0x40')]=_[_0xb940('0x55')](_0x472a04[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x533981[_0xb940('0x3b')]['fields']));_0x40bc9a['attributes']=_0x40bc9a[_0xb940('0x40')][_0xb940('0x46')]?_0x40bc9a[_0xb940('0x40')]:_0x472a04['model'];_0x40bc9a[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x533981[_0xb940('0x3b')][_0xb940('0xc8')]);_0x40bc9a[_0xb940('0xc9')]=qs[_0xb940('0x54')](_['pick'](_0x533981['query'],_0x472a04[_0xb940('0x54')]));if(_0x533981[_0xb940('0x3b')][_0xb940('0x2d')]){_0x40bc9a[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x40bc9a['where'],{'$or':_[_0xb940('0x39')](_0x40bc9a[_0xb940('0x40')],function(_0x532f1e){var _0x2fbec9={};_0x2fbec9[_0x532f1e]={'$like':'%'+_0x533981['query'][_0xb940('0x2d')]+'%'};return _0x2fbec9;})});}_0x40bc9a=_[_0xb940('0x57')]({},_0x40bc9a,_0x533981[_0xb940('0xcb')]);return _0x2233dd[_0xb940('0xde')](_0x40bc9a);}})[_0xb940('0x12')](function(_0x368915){if(_0x368915){_0x37229e=_0x368915[_0xb940('0x46')];if(!_0x533981['query'][_0xb940('0xcf')]('nolimit')){_0x40bc9a['limit']=qs[_0xb940('0xd1')](_0x533981[_0xb940('0x3b')]['limit']);_0x40bc9a[_0xb940('0x21')]=qs[_0xb940('0x21')](_0x533981[_0xb940('0x3b')][_0xb940('0x21')]);}return _0x2233dd[_0xb940('0xde')](_0x40bc9a);}})[_0xb940('0x12')](function(_0x378534){if(_0x378534){return _0x378534?{'count':_0x37229e,'rows':_0x378534}:null;}})[_0xb940('0x12')](respondWithResult(_0x595545,null))[_0xb940('0x1d')](handleError(_0x595545,null));};exports[_0xb940('0xe0')]=function(_0x1229ed,_0xc8bcdf){var _0x1d0a44={};var _0x2e7f81={};var _0x290646;var _0x297cc5;return db['User'][_0xb940('0x95')]({'where':{'id':_0x1229ed[_0xb940('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc8bcdf,null))[_0xb940('0x12')](function(_0x58ff64){if(_0x58ff64){_0x290646=_0x58ff64;_0x2e7f81[_0xb940('0x4f')]=_[_0xb940('0x51')](db[_0xb940('0xe1')][_0xb940('0x38')]);_0x2e7f81['query']=_['keys'](_0x1229ed[_0xb940('0x3b')]);_0x2e7f81[_0xb940('0x54')]=_[_0xb940('0x55')](_0x2e7f81[_0xb940('0x4f')],_0x2e7f81[_0xb940('0x3b')]);_0x1d0a44[_0xb940('0x40')]=_[_0xb940('0x55')](_0x2e7f81[_0xb940('0x4f')],qs['fields'](_0x1229ed[_0xb940('0x3b')]['fields']));_0x1d0a44[_0xb940('0x40')]=_0x1d0a44[_0xb940('0x40')][_0xb940('0x46')]?_0x1d0a44['attributes']:_0x2e7f81['model'];_0x1d0a44[_0xb940('0xd7')]=qs['sort'](_0x1229ed[_0xb940('0x3b')][_0xb940('0xc8')]);_0x1d0a44[_0xb940('0xc9')]=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x1229ed[_0xb940('0x3b')],_0x2e7f81[_0xb940('0x54')]));if(_0x1229ed[_0xb940('0x3b')][_0xb940('0x2d')]){_0x1d0a44[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x1d0a44[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x1d0a44[_0xb940('0x40')],function(_0x58cdc9){var _0x324cf2={};_0x324cf2[_0x58cdc9]={'$like':'%'+_0x1229ed[_0xb940('0x3b')][_0xb940('0x2d')]+'%'};return _0x324cf2;})});}_0x1d0a44=_['merge']({},_0x1d0a44,_0x1229ed['options']);return _0x290646[_0xb940('0xe0')](_0x1d0a44);}})[_0xb940('0x12')](function(_0x5eb30f){if(_0x5eb30f){_0x297cc5=_0x5eb30f[_0xb940('0x46')];if(!_0x1229ed['query'][_0xb940('0xcf')](_0xb940('0xd0'))){_0x1d0a44[_0xb940('0xd1')]=qs['limit'](_0x1229ed['query']['limit']);_0x1d0a44['offset']=qs[_0xb940('0x21')](_0x1229ed['query'][_0xb940('0x21')]);}return _0x290646[_0xb940('0xe0')](_0x1d0a44);}})[_0xb940('0x12')](function(_0x90bf10){if(_0x90bf10){return _0x90bf10?{'count':_0x297cc5,'rows':_0x90bf10}:null;}})[_0xb940('0x12')](respondWithResult(_0xc8bcdf,null))['catch'](handleError(_0xc8bcdf,null));};exports[_0xb940('0xe2')]=function(_0x5d8000,_0x3fa59a){var _0x1823da={'raw':!![],'where':{}};var _0x3c05e2={};var _0x4e14b2={'count':0x0,'rows':[]};return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x5d8000[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x3fa59a,null))[_0xb940('0x12')](function(_0x32ac15){if(_0x32ac15){_0x3c05e2['model']=_['keys'](db[_0xb940('0xe3')][_0xb940('0x38')]);_0x3c05e2[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x5d8000[_0xb940('0x3b')]);_0x3c05e2[_0xb940('0x54')]=_[_0xb940('0x55')](_0x3c05e2['model'],_0x3c05e2[_0xb940('0x3b')]);_0x1823da[_0xb940('0x40')]=_['intersection'](_0x3c05e2[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x5d8000[_0xb940('0x3b')]['fields']));_0x1823da[_0xb940('0x40')]=_0x1823da[_0xb940('0x40')][_0xb940('0x46')]?_0x1823da[_0xb940('0x40')]:_0x3c05e2['model'];if(!_0x5d8000[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x1823da['limit']=qs[_0xb940('0xd1')](_0x5d8000[_0xb940('0x3b')][_0xb940('0xd1')]);_0x1823da['offset']=qs[_0xb940('0x21')](_0x5d8000[_0xb940('0x3b')]['offset']);}_0x1823da[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x5d8000['query'][_0xb940('0xc8')]);_0x1823da['where']=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x5d8000[_0xb940('0x3b')],_0x3c05e2[_0xb940('0x54')]));_0x1823da[_0xb940('0xc9')][_0xb940('0xdb')]=_0x32ac15['id'];if(_0x5d8000[_0xb940('0x3b')]['filter']){_0x1823da[_0xb940('0xc9')]=_['merge'](_0x1823da[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x1823da[_0xb940('0x40')],function(_0x266a46){var _0x2e84c2={};_0x2e84c2[_0x266a46]={'$like':'%'+_0x5d8000['query']['filter']+'%'};return _0x2e84c2;})});}_0x1823da=_[_0xb940('0x57')]({},_0x1823da,_0x5d8000['options']);return db[_0xb940('0xe3')][_0xb940('0x23')]({'where':_0x1823da[_0xb940('0xc9')]})['then'](function(_0x3a72f7){_0x4e14b2[_0xb940('0x23')]=_0x3a72f7;if(_0x5d8000[_0xb940('0x3b')][_0xb940('0x3c')]){_0x1823da['include']=[{'all':!![]}];}return db['MailInteraction'][_0xb940('0x42')](_0x1823da);})['then'](function(_0x3f3b35){_0x4e14b2[_0xb940('0x43')]=_0x3f3b35;return _0x4e14b2;});}})[_0xb940('0x12')](respondWithFilteredResult(_0x3fa59a,_0x1823da))[_0xb940('0x1d')](handleError(_0x3fa59a,null));};exports[_0xb940('0xe4')]=function(_0x3ac275,_0x23ce5f){var _0x56fe85={};var _0x360d27={};var _0x5e8646;var _0x4b8fa2;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x3ac275[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x23ce5f,null))['then'](function(_0x457372){if(_0x457372){_0x5e8646=_0x457372;_0x360d27['model']=_['keys'](db[_0xb940('0xe5')][_0xb940('0x38')]);_0x360d27[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x3ac275[_0xb940('0x3b')]);_0x360d27[_0xb940('0x54')]=_['intersection'](_0x360d27[_0xb940('0x4f')],_0x360d27[_0xb940('0x3b')]);_0x56fe85['attributes']=_[_0xb940('0x55')](_0x360d27['model'],qs[_0xb940('0x56')](_0x3ac275['query'][_0xb940('0x56')]));_0x56fe85[_0xb940('0x40')]=_0x56fe85['attributes'][_0xb940('0x46')]?_0x56fe85[_0xb940('0x40')]:_0x360d27['model'];_0x56fe85['order']=qs[_0xb940('0xc8')](_0x3ac275['query'][_0xb940('0xc8')]);_0x56fe85[_0xb940('0xc9')]=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x3ac275[_0xb940('0x3b')],_0x360d27[_0xb940('0x54')]));if(_0x3ac275[_0xb940('0x3b')][_0xb940('0x2d')]){_0x56fe85[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x56fe85[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x56fe85[_0xb940('0x40')],function(_0x4a74e2){var _0x3b54be={};_0x3b54be[_0x4a74e2]={'$like':'%'+_0x3ac275[_0xb940('0x3b')][_0xb940('0x2d')]+'%'};return _0x3b54be;})});}_0x56fe85=_['merge']({},_0x56fe85,_0x3ac275['options']);return _0x5e8646[_0xb940('0xe4')](_0x56fe85);}})[_0xb940('0x12')](function(_0x500cb5){if(_0x500cb5){_0x4b8fa2=_0x500cb5['length'];if(!_0x3ac275['query'][_0xb940('0xcf')](_0xb940('0xd0'))){_0x56fe85[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0x3ac275['query']['limit']);_0x56fe85['offset']=qs[_0xb940('0x21')](_0x3ac275[_0xb940('0x3b')][_0xb940('0x21')]);}return _0x5e8646['getSmsInteractions'](_0x56fe85);}})['then'](function(_0x44ade4){if(_0x44ade4){return _0x44ade4?{'count':_0x4b8fa2,'rows':_0x44ade4}:null;}})[_0xb940('0x12')](respondWithResult(_0x23ce5f,null))[_0xb940('0x1d')](handleError(_0x23ce5f,null));};exports[_0xb940('0xe6')]=function(_0x151e00,_0xdb8a1d){var _0x1b8496={};var _0x3998ac={};var _0x45a82e;var _0x300a86;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x151e00['params']['id']}})[_0xb940('0x12')](handleEntityNotFound(_0xdb8a1d,null))['then'](function(_0xa0d9f5){if(_0xa0d9f5){_0x45a82e=_0xa0d9f5;_0x3998ac[_0xb940('0x4f')]=_[_0xb940('0x51')](db[_0xb940('0xe7')][_0xb940('0x38')]);_0x3998ac[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x151e00[_0xb940('0x3b')]);_0x3998ac['filters']=_[_0xb940('0x55')](_0x3998ac[_0xb940('0x4f')],_0x3998ac[_0xb940('0x3b')]);_0x1b8496[_0xb940('0x40')]=_[_0xb940('0x55')](_0x3998ac['model'],qs['fields'](_0x151e00[_0xb940('0x3b')][_0xb940('0x56')]));_0x1b8496['attributes']=_0x1b8496['attributes'][_0xb940('0x46')]?_0x1b8496[_0xb940('0x40')]:_0x3998ac[_0xb940('0x4f')];_0x1b8496[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x151e00[_0xb940('0x3b')]['sort']);_0x1b8496[_0xb940('0xc9')]=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x151e00[_0xb940('0x3b')],_0x3998ac[_0xb940('0x54')]));if(_0x151e00[_0xb940('0x3b')][_0xb940('0x2d')]){_0x1b8496[_0xb940('0xc9')]=_['merge'](_0x1b8496[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x1b8496[_0xb940('0x40')],function(_0x5154db){var _0x38802c={};_0x38802c[_0x5154db]={'$like':'%'+_0x151e00[_0xb940('0x3b')][_0xb940('0x2d')]+'%'};return _0x38802c;})});}_0x1b8496=_[_0xb940('0x57')]({},_0x1b8496,_0x151e00['options']);return _0x45a82e['getFaxInteractions'](_0x1b8496);}})[_0xb940('0x12')](function(_0x1f7810){if(_0x1f7810){_0x300a86=_0x1f7810[_0xb940('0x46')];if(!_0x151e00[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x1b8496[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0x151e00[_0xb940('0x3b')]['limit']);_0x1b8496[_0xb940('0x21')]=qs['offset'](_0x151e00[_0xb940('0x3b')][_0xb940('0x21')]);}return _0x45a82e[_0xb940('0xe6')](_0x1b8496);}})[_0xb940('0x12')](function(_0xb8ab37){if(_0xb8ab37){return _0xb8ab37?{'count':_0x300a86,'rows':_0xb8ab37}:null;}})[_0xb940('0x12')](respondWithResult(_0xdb8a1d,null))[_0xb940('0x1d')](handleError(_0xdb8a1d,null));};exports[_0xb940('0xe8')]=function(_0xa15086,_0x40f8fc){var _0x23fafb={};var _0xbcddb7={};var _0x4fe15c;var _0x31ad3d;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0xa15086['params']['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x40f8fc,null))['then'](function(_0x2b458d){if(_0x2b458d){_0x4fe15c=_0x2b458d;_0xbcddb7[_0xb940('0x4f')]=_[_0xb940('0x51')](db['WhatsappInteraction'][_0xb940('0x38')]);_0xbcddb7['query']=_['keys'](_0xa15086[_0xb940('0x3b')]);_0xbcddb7[_0xb940('0x54')]=_['intersection'](_0xbcddb7[_0xb940('0x4f')],_0xbcddb7[_0xb940('0x3b')]);_0x23fafb[_0xb940('0x40')]=_[_0xb940('0x55')](_0xbcddb7['model'],qs[_0xb940('0x56')](_0xa15086[_0xb940('0x3b')][_0xb940('0x56')]));_0x23fafb[_0xb940('0x40')]=_0x23fafb[_0xb940('0x40')][_0xb940('0x46')]?_0x23fafb[_0xb940('0x40')]:_0xbcddb7['model'];_0x23fafb[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0xa15086[_0xb940('0x3b')]['sort']);_0x23fafb[_0xb940('0xc9')]=qs['filters'](_[_0xb940('0xca')](_0xa15086[_0xb940('0x3b')],_0xbcddb7[_0xb940('0x54')]));if(_0xa15086[_0xb940('0x3b')][_0xb940('0x2d')]){_0x23fafb[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x23fafb[_0xb940('0xc9')],{'$or':_['map'](_0x23fafb['attributes'],function(_0x4a6556){var _0x1e6bf2={};_0x1e6bf2[_0x4a6556]={'$like':'%'+_0xa15086['query'][_0xb940('0x2d')]+'%'};return _0x1e6bf2;})});}_0x23fafb=_['merge']({},_0x23fafb,_0xa15086['options']);return _0x4fe15c[_0xb940('0xe8')](_0x23fafb);}})[_0xb940('0x12')](function(_0x1bd094){if(_0x1bd094){_0x31ad3d=_0x1bd094[_0xb940('0x46')];if(!_0xa15086[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x23fafb[_0xb940('0xd1')]=qs[_0xb940('0xd1')](_0xa15086[_0xb940('0x3b')]['limit']);_0x23fafb['offset']=qs['offset'](_0xa15086[_0xb940('0x3b')]['offset']);}return _0x4fe15c[_0xb940('0xe8')](_0x23fafb);}})[_0xb940('0x12')](function(_0x5a992d){if(_0x5a992d){return _0x5a992d?{'count':_0x31ad3d,'rows':_0x5a992d}:null;}})[_0xb940('0x12')](respondWithResult(_0x40f8fc,null))[_0xb940('0x1d')](handleError(_0x40f8fc,null));};exports[_0xb940('0xe9')]=function(_0x202737,_0xdcdbe9,_0x4903d7){var _0x441478;var _0x4b9415;var _0x192af0;var _0x1c00b1=!_[_0xb940('0x64')](_0x202737['params']['id'])?_0x202737['params']['id']:!_[_0xb940('0x64')](_0x202737['user']['id'])?_0x202737[_0xb940('0x29')]['id']:null;return db['User'][_0xb940('0x31')]({'where':{'id':_0x1c00b1,'role':{'$or':[_0xb940('0x7e'),_0xb940('0x29'),_0xb940('0x2a')]}},'attributes':['id',_0xb940('0x32'),_0xb940('0xea'),'mobile',_0xb940('0x27'),'internal','loginInPause']})['then'](function(_0x52d2de){if(_0x52d2de){if(_0x52d2de['role']==='agent'){_0x441478=_0x52d2de;if(_0x202737[_0xb940('0x5a')]['interface']){_0x192af0=util[_0xb940('0xab')]('LOCAL/%s@from-sip/n',_0x441478[_0x202737[_0xb940('0x5a')]['interface']]);}else if(_0x202737[_0xb940('0x5a')][_0xb940('0xeb')]){_0x192af0=util['format'](_0xb940('0xec'),_0x202737[_0xb940('0x5a')][_0xb940('0xeb')]);}else{_0x192af0=util[_0xb940('0xab')](_0xb940('0xec'),_0x441478[_0xb940('0x32')]);}socket['to'](util[_0xb940('0xab')](_0xb940('0xed'),_0x441478['name']))[_0xb940('0xa7')](_0xb940('0xee'),{'user':{'id':_0x441478['id'],'name':_0x441478[_0xb940('0x32')]},'ip':_0x202737[_0xb940('0xef')][_0xb940('0xf0')]||_0x202737[_0xb940('0xf1')][_0xb940('0xf2')]||_0x202737[_0xb940('0xf3')]['remoteAddress']||_0x202737[_0xb940('0xf1')][_0xb940('0xf3')][_0xb940('0xf2')]});return db[_0xb940('0xac')]['destroy']({'where':{'membername':_0x441478[_0xb940('0x32')]},'individualHooks':!![]});}}else{throw new db[(_0xb940('0x90'))]['ValidationError'](_0xb940('0xf4'));}})[_0xb940('0x12')](function(){if(_0x441478){return _0x441478['getVoiceQueues']({'raw':!![]});}})[_0xb940('0x12')](function(_0x13391e){if(_0x441478){var _0x3ba548=[];if(_0x13391e){_0x4b9415=_0x13391e;if(_0x4b9415[_0xb940('0x46')]){for(var _0x30cc7b=0x0;_0x30cc7b<_0x4b9415[_0xb940('0x46')];_0x30cc7b++){_0x3ba548['push']({'membername':_0x441478[_0xb940('0x32')],'UserId':_0x441478['id'],'queue_name':_0x4b9415[_0x30cc7b]['name'],'VoiceQueueId':_0x4b9415[_0x30cc7b]['id'],'interface':_0x192af0,'paused':_0x441478[_0xb940('0x9c')]||![],'penalty':_0x4b9415[_0x30cc7b][_0xb940('0xf5')]||0x0});}return BPromise[_0xb940('0x87')](_0x3ba548,function(_0x3a2e48){return db['UserVoiceQueueRt'][_0xb940('0xad')](_0x3a2e48);});}}}})[_0xb940('0x12')](function(){if(_0x441478){return db[_0xb940('0xf6')][_0xb940('0x42')]({'where':{'membername':_0x441478['name'],'exitAt':null}});}})[_0xb940('0x12')](function(_0x5c6f3e){if(_0x441478){var _0x3f038e=[];_0x5c6f3e[_0xb940('0xf7')](function(_0x425858){_0x3f038e[_0xb940('0x41')](_0x425858[_0xb940('0x26')]({'exitAt':moment()[_0xb940('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb940('0x4c')](_0x3f038e);}})[_0xb940('0x12')](function(){if(_0x441478){var _0x3385db=[];var _0x2f3094=[];var _0x54ec61=utils[_0xb940('0xf8')]();var _0x46650d={'membername':_0x441478['name'],'interface':_0x192af0,'enterAt':moment()[_0xb940('0xab')](_0xb940('0xf9')),'role':_0x441478[_0xb940('0x27')],'internal':_0x441478[_0xb940('0x5f')]};_0x54ec61[_0xb940('0xf7')](function(_0x2d4bf6){_0x3385db['push'](_[_0xb940('0x57')]({'channel':_0x2d4bf6,'type':_0xb940('0xfa'),'data1':_0x202737[_0xb940('0x5a')][_0xb940('0xfb')],'data2':_0x192af0},_0x46650d));if(_0x441478[_0xb940('0x9c')]){_0x2f3094[_0xb940('0x41')](_['merge']({'channel':_0x2d4bf6,'type':_0xb940('0xfc'),'data1':_0xb940('0xfd')},_0x46650d));}});return db[_0xb940('0xf6')][_0xb940('0x84')](_0x3385db[_0xb940('0xc5')](_0x2f3094),{'individualHooks':!![]});}})[_0xb940('0x12')](function(){if(_0x441478){return _0x441478[_0xb940('0x26')]({'online':!![],'lastLoginAt':moment()[_0xb940('0xab')](_0xb940('0xf9')),'voicePause':_0x441478[_0xb940('0x9c')]||![],'mailPause':_0x441478[_0xb940('0x9c')]||![],'chatPause':_0x441478[_0xb940('0x9c')]||![],'faxPause':_0x441478['loginInPause']||![],'smsPause':_0x441478[_0xb940('0x9c')]||![],'openchannelPause':_0x441478['loginInPause']||![],'whatsappPause':_0x441478['loginInPause']||![],'pauseType':_0x441478['loginInPause']?_0xb940('0xfd'):null,'interface':_0x192af0,'lastPauseAt':moment()[_0xb940('0xab')](_0xb940('0xf9'))});}})[_0xb940('0x12')](function(_0x48d8fb){if(_0x202737[_0xb940('0xfe')]){return _0x4903d7();}else{return BPromise['resolve'](_0x48d8fb)[_0xb940('0x12')](respondWithResult(_0xdcdbe9,null));}})[_0xb940('0x1d')](handleError(_0xdcdbe9,null));};exports[_0xb940('0xff')]=function(_0x558eb8,_0x2a6a26){var _0x24c815;return db[_0xb940('0x37')]['find']({'where':{'id':_0x558eb8['params']['id'],'role':_0xb940('0x2a')},'attributes':['id',_0xb940('0x32'),'role']})['then'](handleEntityNotFound(_0x2a6a26,null))['then'](function(_0x3cb8bc){if(_0x3cb8bc){_0x24c815=_0x3cb8bc;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x24c815[_0xb940('0x32')]},'individualHooks':!![]});}})[_0xb940('0x12')](function(){return db[_0xb940('0xf6')][_0xb940('0x42')]({'where':{'membername':_0x24c815[_0xb940('0x32')],'exitAt':null}});})[_0xb940('0x12')](function(_0x2c62b3){var _0x10b786=[];_0x2c62b3['forEach'](function(_0x2981d0){_0x10b786[_0xb940('0x41')](_0x2981d0[_0xb940('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb940('0x4c')](_0x10b786);})[_0xb940('0x12')](function(){return _0x24c815[_0xb940('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2a6a26,null))[_0xb940('0x1d')](handleError(_0x2a6a26,null));};exports['pause']=function(_0x574487,_0x1ac7a3){var _0x499ea8;return db[_0xb940('0xac')][_0xb940('0x26')]({'paused':0x1},{'where':{'UserId':_0x574487[_0xb940('0x4e')]['id']},'individualHooks':!![]})[_0xb940('0x12')](function(){return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0x574487[_0xb940('0x4e')]['id'],'role':_0xb940('0x2a')},'attributes':['id',_0xb940('0x32'),_0xb940('0x27'),_0xb940('0x5f'),_0xb940('0x9e')]});})['then'](handleEntityNotFound(_0x1ac7a3,null))[_0xb940('0x12')](function(_0x2fcad3){if(_0x2fcad3){_0x499ea8=_0x2fcad3;return respondWithRpcPromise(_0xb940('0x100'),'pause',{'id':_0x499ea8['id'],'name':_0x499ea8[_0xb940('0x32')],'pause':!![]});}})[_0xb940('0x12')](function(){if(_0x499ea8){return db[_0xb940('0xf6')]['findAll']({'where':{'membername':_0x499ea8[_0xb940('0x32')],'type':_0xb940('0xfc'),'exitAt':null}});}})[_0xb940('0x12')](function(_0x52f97c){if(_0x52f97c[_0xb940('0x46')]){var _0x3a095c=moment()[_0xb940('0xab')](_0xb940('0xf9'));for(var _0x45d4c0=0x0,_0x61a3eb=_0x52f97c[_0xb940('0x46')];_0x45d4c0<_0x61a3eb;_0x45d4c0++){_0x52f97c[_0x45d4c0][_0xb940('0x101')]({'exitAt':_0x3a095c});}}})['then'](function(){var _0x1c5abd=[];var _0x563380=utils[_0xb940('0xf8')]();_0x563380[_0xb940('0xf7')](function(_0x469b9b){_0x1c5abd['push']({'channel':_0x469b9b,'membername':_0x499ea8[_0xb940('0x32')],'interface':_[_0xb940('0x64')](_0x499ea8[_0xb940('0x9e')])?util[_0xb940('0xab')]('SIP/%s',_0x499ea8['name']):_0x499ea8['interface'],'type':'PAUSE','enterAt':moment()[_0xb940('0xab')](_0xb940('0xf9')),'data1':_0x574487[_0xb940('0x5a')]['type']||_0xb940('0x102'),'role':_0x499ea8[_0xb940('0x27')],'internal':_0x499ea8['internal']});});return db['MemberReport'][_0xb940('0x84')](_0x1c5abd,{'individualHooks':!![]});})[_0xb940('0x12')](function(){return _0x499ea8[_0xb940('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x574487['body'][_0xb940('0x103')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb940('0xab')](_0xb940('0xf9'))});})[_0xb940('0x12')](respondWithResult(_0x1ac7a3,null))[_0xb940('0x1d')](handleError(_0x1ac7a3,null));};exports[_0xb940('0x104')]=function(_0x5b90cc,_0x5cc85a){var _0x7ddea2;return db[_0xb940('0x37')][_0xb940('0x31')]({'where':{'id':_0x5b90cc['params']['id']},'attributes':['id',_0xb940('0x32'),_0xb940('0x27'),'voicePause',_0xb940('0x105'),'chatPause',_0xb940('0x106'),_0xb940('0x107'),'smsPause',_0xb940('0x108'),_0xb940('0x109'),_0xb940('0x10a')]})[_0xb940('0x12')](handleEntityNotFound(_0x5cc85a,null))[_0xb940('0x12')](function(_0x473cf5){if(_0x473cf5){_0x7ddea2=_0x473cf5;if(_0x5b90cc['body'][_0xb940('0x9a')]&&!utils[_0xb940('0x9f')](_0x5b90cc['body'][_0xb940('0x9a')])){throw new db[(_0xb940('0x90'))][(_0xb940('0x8e'))](_0xb940('0xa0'));}switch(_0x5b90cc[_0xb940('0x5a')][_0xb940('0x9a')]){case _0xb940('0xa9'):return respondWithRpcPromise(_0xb940('0x100'),_0xb940('0x104'),{'id':_0x7ddea2['id'],'name':_0x7ddea2['name'],'pause':![]})[_0xb940('0x12')](function(){return db[_0xb940('0xac')]['update']({'paused':0x0},{'where':{'UserId':_0x7ddea2['id']},'individualHooks':!![]});})[_0xb940('0x12')](function(){return db[_0xb940('0xf6')][_0xb940('0x31')]({'where':{'channel':_0x5b90cc['body'][_0xb940('0x9a')],'membername':_0x7ddea2[_0xb940('0x32')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x5a74b0){if(_0x5a74b0){return _0x5a74b0[_0xb940('0x26')]({'exitAt':moment()[_0xb940('0xab')](_0xb940('0xf9')),'data2':_0xb940('0x10b')},{'individualHooks':!![]});}return null;})[_0xb940('0x12')](function(){return _0x7ddea2['update']({'voicePause':![]});});case _0xb940('0x4a'):case'chat':case _0xb940('0x49'):case _0xb940('0x58'):case _0xb940('0x59'):case _0xb940('0x4b'):return db[_0xb940('0xf6')]['find']({'where':{'channel':_0x5b90cc[_0xb940('0x5a')][_0xb940('0x9a')],'membername':_0x7ddea2['name'],'type':_0xb940('0xfc'),'exitAt':null}})[_0xb940('0x12')](function(_0x16fdc0){if(_0x16fdc0){return _0x16fdc0[_0xb940('0x26')]({'exitAt':moment()[_0xb940('0xab')](_0xb940('0xf9')),'data2':_0xb940('0x10b')},{'individualHooks':!![]});}return null;})[_0xb940('0x12')](function(){var _0x5e494b={};_[_0xb940('0x24')](_0x5e494b,util[_0xb940('0xab')](_0xb940('0x10c'),_0x5b90cc[_0xb940('0x5a')]['channel'],_0xb940('0x10d')),![]);return _0x7ddea2[_0xb940('0x26')](_0x5e494b);});default:return respondWithRpcPromise(_0xb940('0x100'),'unpause',{'id':_0x7ddea2['id'],'name':_0x7ddea2[_0xb940('0x32')],'pause':![]})[_0xb940('0x12')](function(){return db['UserVoiceQueueRt'][_0xb940('0x26')]({'paused':0x0},{'where':{'UserId':_0x7ddea2['id']}});})['then'](function(){return db[_0xb940('0xf6')]['findAll']({'where':{'membername':_0x7ddea2[_0xb940('0x32')],'type':_0xb940('0xfc'),'exitAt':null}});})[_0xb940('0x12')](function(_0x5453e7){var _0x57d2e4=[];_0x5453e7['forEach'](function(_0x49023b){_0x57d2e4[_0xb940('0x41')](_0x49023b['update']({'exitAt':moment()['format'](_0xb940('0xf9')),'data2':'manual'}));});return BPromise['all'](_0x57d2e4);})[_0xb940('0x12')](function(){return _0x7ddea2[_0xb940('0x26')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xb940('0x12')](respondWithResult(_0x5cc85a,null))[_0xb940('0x1d')](handleError(_0x5cc85a,null));};exports['getTeams']=function(_0x103eea,_0x33e04f){var _0x273056={};var _0x3d79fb={};var _0x4defed;var _0x546c5f;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x103eea[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x33e04f,null))[_0xb940('0x12')](function(_0x10a471){if(_0x10a471){_0x4defed=_0x10a471;_0x3d79fb['model']=_['keys'](db['Team'][_0xb940('0x38')]);_0x3d79fb[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x103eea[_0xb940('0x3b')]);_0x3d79fb[_0xb940('0x54')]=_[_0xb940('0x55')](_0x3d79fb[_0xb940('0x4f')],_0x3d79fb[_0xb940('0x3b')]);_0x273056['attributes']=_[_0xb940('0x55')](_0x3d79fb[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x103eea['query'][_0xb940('0x56')]));_0x273056[_0xb940('0x40')]=_0x273056[_0xb940('0x40')][_0xb940('0x46')]?_0x273056[_0xb940('0x40')]:_0x3d79fb[_0xb940('0x4f')];_0x273056[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x103eea[_0xb940('0x3b')][_0xb940('0xc8')]);_0x273056[_0xb940('0xc9')]=qs[_0xb940('0x54')](_['pick'](_0x103eea[_0xb940('0x3b')],_0x3d79fb['filters']));if(_0x103eea[_0xb940('0x3b')]['filter']){_0x273056[_0xb940('0xc9')]=_['merge'](_0x273056[_0xb940('0xc9')],{'$or':_[_0xb940('0x39')](_0x273056[_0xb940('0x40')],function(_0x1f2868){var _0x279c1e={};_0x279c1e[_0x1f2868]={'$like':'%'+_0x103eea[_0xb940('0x3b')]['filter']+'%'};return _0x279c1e;})});}_0x273056=_['merge']({},_0x273056,_0x103eea[_0xb940('0xcb')]);return _0x4defed[_0xb940('0x10e')](_0x273056);}})['then'](function(_0x8cc614){if(_0x8cc614){_0x546c5f=_0x8cc614[_0xb940('0x46')];if(!_0x103eea[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x273056['limit']=qs[_0xb940('0xd1')](_0x103eea[_0xb940('0x3b')]['limit']);_0x273056[_0xb940('0x21')]=qs[_0xb940('0x21')](_0x103eea['query'][_0xb940('0x21')]);}return _0x4defed['getTeams'](_0x273056);}})[_0xb940('0x12')](function(_0x43ff95){if(_0x43ff95){return _0x43ff95?{'count':_0x546c5f,'rows':_0x43ff95}:null;}})[_0xb940('0x12')](respondWithResult(_0x33e04f,null))[_0xb940('0x1d')](handleError(_0x33e04f,null));};exports[_0xb940('0x10f')]=function(_0x378ecb,_0x5bbe55){return db['User'][_0xb940('0x31')]({'where':{'id':_0x378ecb[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x5bbe55,null))['then'](function(_0xebe304){if(_0xebe304){var _0x336455=_0xebe304[_0xb940('0xd4')]({'plain':!![]});return _0xebe304['addTeams'](_0x378ecb['body']['ids'],_['omit'](_0x378ecb['body'],[_0xb940('0x5e'),'id'])||{})['then'](function(){for(var _0xff8e2d=0x0;_0xff8e2d<_0x378ecb[_0xb940('0x5a')][_0xb940('0x5e')]['length'];_0xff8e2d++){var _0x294b5d=[];var _0x1ae588={};db[_0xb940('0x110')][_0xb940('0x95')]({'where':{'id':_0x378ecb['body']['ids'][_0xff8e2d]}})[_0xb940('0x12')](function(_0x1689c1){_0x1ae588=_0x1689c1[_0xb940('0x48')];_0x294b5d[_0xb940('0x41')](_0x1689c1[_0xb940('0x111')]()[_0xb940('0x12')](function(_0x149e59){for(var _0x251e7a=0x0;_0x251e7a<_0x149e59[_0xb940('0x46')];_0x251e7a++){_0x149e59[_0x251e7a][_0xb940('0x112')](_0xb940('0x9a'),'Voice');}return _0x149e59;}));_0x294b5d[_0xb940('0x41')](_0x1689c1[_0xb940('0x113')]()['then'](function(_0x2f3f80){for(var _0x20d854=0x0;_0x20d854<_0x2f3f80[_0xb940('0x46')];_0x20d854++){_0x2f3f80[_0x20d854]['setDataValue'](_0xb940('0x9a'),_0xb940('0x114'));}return _0x2f3f80;}));_0x294b5d[_0xb940('0x41')](_0x1689c1['getMailQueues']()[_0xb940('0x12')](function(_0x25279b){for(var _0x3ed2ad=0x0;_0x3ed2ad<_0x25279b[_0xb940('0x46')];_0x3ed2ad++){_0x25279b[_0x3ed2ad][_0xb940('0x112')]('channel','Mail');}return _0x25279b;}));_0x294b5d[_0xb940('0x41')](_0x1689c1[_0xb940('0x115')]()['then'](function(_0x44e4ee){for(var _0x2b7be4=0x0;_0x2b7be4<_0x44e4ee[_0xb940('0x46')];_0x2b7be4++){_0x44e4ee[_0x2b7be4][_0xb940('0x112')](_0xb940('0x9a'),_0xb940('0x116'));}return _0x44e4ee;}));_0x294b5d['push'](_0x1689c1[_0xb940('0x117')]()[_0xb940('0x12')](function(_0x3f8e56){for(var _0x46b3cc=0x0;_0x46b3cc<_0x3f8e56[_0xb940('0x46')];_0x46b3cc++){_0x3f8e56[_0x46b3cc]['setDataValue']('channel',_0xb940('0x118'));}return _0x3f8e56;}));_0x294b5d[_0xb940('0x41')](_0x1689c1[_0xb940('0x119')]()['then'](function(_0x1552ed){for(var _0x4c52ee=0x0;_0x4c52ee<_0x1552ed[_0xb940('0x46')];_0x4c52ee++){_0x1552ed[_0x4c52ee][_0xb940('0x112')](_0xb940('0x9a'),_0xb940('0x11a'));}return _0x1552ed;}));_0x294b5d[_0xb940('0x41')](_0x1689c1[_0xb940('0x11b')]()[_0xb940('0x12')](function(_0xa0c794){for(var _0x3c1394=0x0;_0x3c1394<_0xa0c794[_0xb940('0x46')];_0x3c1394++){_0xa0c794[_0x3c1394][_0xb940('0x112')](_0xb940('0x9a'),_0xb940('0x11c'));}return _0xa0c794;}));return BPromise[_0xb940('0x4c')](_0x294b5d);})['then'](function(_0xae9401){var _0x570ded=_['flatten'](_0xae9401);_0x294b5d=[];return db['sequelize']['transaction'](function(_0x32e168){for(var _0xf063e1=0x0;_0xf063e1<_0x570ded[_0xb940('0x46')];_0xf063e1++){_0x294b5d[_0xb940('0x41')](_0x570ded[_0xf063e1][_0xb940('0x11d')](_0x336455['id']),{'transaction':_0x32e168});}return BPromise['all'](_0x294b5d)['then'](function(){if(_0x336455[_0xb940('0x9b')]){return BPromise['each'](_['filter'](_0x570ded,function(_0x348050){return _0x348050['getDataValue'](_0xb940('0x9a'))===_0xb940('0x11e');}),function(_0xf9e4d){return db['UserVoiceQueueRt'][_0xb940('0xad')]({'membername':_0x336455['name'],'UserId':_0x336455['id'],'queue_name':_0xf9e4d[_0xb940('0x32')],'VoiceQueueId':_0xf9e4d['id'],'interface':_['isNil'](_0x336455[_0xb940('0x9e')])?util[_0xb940('0xab')](_0xb940('0xec'),_0x336455[_0xb940('0x32')]):_0x336455[_0xb940('0x9e')],'paused':_0x336455['voicePause']||![],'penalty':_0x336455['penalty']},{'transaction':_0x32e168});});}else{return;}})[_0xb940('0x12')](function(){for(var _0x24ff2b=0x0;_0x24ff2b<_0x570ded[_0xb940('0x46')];_0x24ff2b++){var _0x12da51=_0x570ded[_0x24ff2b][_0xb940('0x11f')]('channel');var _0x2e1399=_0x12da51+'QueueId';socket['emit'](_0xb940('0x29')+_0x12da51+'Queue:save',{'UserId':_0x336455['id'],['queueField']:_0x570ded[_0x24ff2b]['id']});}});});})['then'](function(){db['TeamVoicePrefix'][_0xb940('0x95')]({'where':{'teamId':_0x1ae588['id']}})[_0xb940('0x12')](function(_0x3bcc55){if(_0x3bcc55){db[_0xb940('0x120')][_0xb940('0x7c')]({'UserId':_0x378ecb[_0xb940('0x4e')]['id'],'VoicePrefixId':_0x3bcc55['VoicePrefixId']});}});});}});}})[_0xb940('0x12')](respondWithStatusCode(_0x5bbe55,null))[_0xb940('0x1d')](handleError(_0x5bbe55,null));};exports[_0xb940('0x121')]=function(_0x12258d,_0x2a2cdc){return db['User'][_0xb940('0x95')]({'where':{'id':_0x12258d[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x2a2cdc,null))[_0xb940('0x12')](function(_0x9c4ea6){if(_0x9c4ea6){var _0x1e4446=_0x9c4ea6[_0xb940('0xd4')]({'plain':!![]});var _0x316fca=_0x12258d[_0xb940('0x3b')]['ids'];return _0x9c4ea6[_0xb940('0x121')](_0x316fca)['then'](function(){for(var _0x215275=0x0;_0x215275<_0x316fca[_0xb940('0x46')];_0x215275++){var _0x12c506=[];var _0x9d6c65={};db[_0xb940('0x110')][_0xb940('0x95')]({'where':{'id':_0x316fca[_0x215275]}})['then'](function(_0xd40112){_0x9d6c65=_0xd40112[_0xb940('0x48')];_0x12c506[_0xb940('0x41')](_0xd40112[_0xb940('0x111')]()[_0xb940('0x12')](function(_0x41e509){for(var _0x29526e=0x0;_0x29526e<_0x41e509[_0xb940('0x46')];_0x29526e++){_0x41e509[_0x29526e]['setDataValue'](_0xb940('0x9a'),_0xb940('0x11e'));}return _0x41e509;}));_0x12c506[_0xb940('0x41')](_0xd40112[_0xb940('0x113')]()[_0xb940('0x12')](function(_0x3db100){for(var _0x1b311f=0x0;_0x1b311f<_0x3db100['length'];_0x1b311f++){_0x3db100[_0x1b311f]['setDataValue']('channel','Chat');}return _0x3db100;}));_0x12c506[_0xb940('0x41')](_0xd40112[_0xb940('0x122')]()[_0xb940('0x12')](function(_0x2b6828){for(var _0x52d5a4=0x0;_0x52d5a4<_0x2b6828[_0xb940('0x46')];_0x52d5a4++){_0x2b6828[_0x52d5a4][_0xb940('0x112')](_0xb940('0x9a'),_0xb940('0x123'));}return _0x2b6828;}));_0x12c506[_0xb940('0x41')](_0xd40112['getSmsQueues']()['then'](function(_0x10a639){for(var _0x2a0ac8=0x0;_0x2a0ac8<_0x10a639[_0xb940('0x46')];_0x2a0ac8++){_0x10a639[_0x2a0ac8]['setDataValue']('channel',_0xb940('0x116'));}return _0x10a639;}));_0x12c506[_0xb940('0x41')](_0xd40112[_0xb940('0x117')]()[_0xb940('0x12')](function(_0x576f41){for(var _0x185b90=0x0;_0x185b90<_0x576f41[_0xb940('0x46')];_0x185b90++){_0x576f41[_0x185b90][_0xb940('0x112')](_0xb940('0x9a'),_0xb940('0x118'));}return _0x576f41;}));_0x12c506[_0xb940('0x41')](_0xd40112[_0xb940('0x119')]()[_0xb940('0x12')](function(_0x2274a8){for(var _0x471a70=0x0;_0x471a70<_0x2274a8[_0xb940('0x46')];_0x471a70++){_0x2274a8[_0x471a70]['setDataValue'](_0xb940('0x9a'),_0xb940('0x11a'));}return _0x2274a8;}));_0x12c506['push'](_0xd40112[_0xb940('0x11b')]()[_0xb940('0x12')](function(_0xd42ff3){for(var _0x5cbc0b=0x0;_0x5cbc0b<_0xd42ff3[_0xb940('0x46')];_0x5cbc0b++){_0xd42ff3[_0x5cbc0b][_0xb940('0x112')](_0xb940('0x9a'),_0xb940('0x11c'));}return _0xd42ff3;}));return BPromise[_0xb940('0x4c')](_0x12c506);})['then'](function(_0x4ee7a5){var _0x7ff3c1=_[_0xb940('0x124')](_0x4ee7a5);_0x12c506=[];return db[_0xb940('0x125')][_0xb940('0x126')](function(_0x454e7b){for(var _0x26b655=0x0;_0x26b655<_0x7ff3c1['length'];_0x26b655++){_0x12c506['push'](_0x7ff3c1[_0x26b655][_0xb940('0x127')](_0x1e4446['id']),{'transaction':_0x454e7b});}return BPromise['all'](_0x12c506)['then'](function(){if(_0x1e4446[_0xb940('0x9b')]){return BPromise[_0xb940('0x87')](_[_0xb940('0x2d')](_0x7ff3c1,function(_0x1d7240){return _0x1d7240[_0xb940('0x11f')](_0xb940('0x9a'))===_0xb940('0x11e');}),function(_0x5351fa){return db[_0xb940('0xac')]['destroy']({'where':{'VoiceQueueId':_0x5351fa['id'],'UserId':_0x1e4446['id']},'transaction':_0x454e7b});});}else{return;}})[_0xb940('0x12')](function(){db[_0xb940('0x128')][_0xb940('0x95')]({'where':{'teamId':_0x9d6c65['id']}})[_0xb940('0x12')](function(_0x1c365d){if(_0x1c365d){return db[_0xb940('0x120')][_0xb940('0x34')]({'where':{'UserId':_0x1e4446['id'],'VoicePrefixId':_0x1c365d[_0xb940('0x48')]['VoicePrefixId']}});}});})[_0xb940('0x12')](function(){for(var _0x773cbd=0x0;_0x773cbd<_0x7ff3c1[_0xb940('0x46')];_0x773cbd++){var _0x13bb97=_0x7ff3c1[_0x773cbd][_0xb940('0x11f')](_0xb940('0x9a'));var _0x2f699d=_0x13bb97+_0xb940('0xa6');socket[_0xb940('0xa7')](_0xb940('0x29')+_0x13bb97+_0xb940('0xb1'),{'UserId':_0x1e4446['id'],['queueField']:_0x7ff3c1[_0x773cbd]['id']});}});});});}});}})[_0xb940('0x12')](respondWithStatusCode(_0x2a2cdc,null))['catch'](handleError(_0x2a2cdc,null));};exports['getLists']=function(_0x57a5c4,_0x4db7c5){var _0x3b3030={};var _0x298462={};var _0x3413f7;var _0x43f662;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x57a5c4[_0xb940('0x4e')]['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x4db7c5,null))[_0xb940('0x12')](function(_0x4701d1){if(_0x4701d1){_0x3413f7=_0x4701d1;_0x298462[_0xb940('0x4f')]=_[_0xb940('0x51')](db['CmList'][_0xb940('0x38')]);_0x298462[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x57a5c4[_0xb940('0x3b')]);_0x298462['filters']=_['intersection'](_0x298462['model'],_0x298462['query']);_0x3b3030['attributes']=_[_0xb940('0x55')](_0x298462[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x57a5c4[_0xb940('0x3b')][_0xb940('0x56')]));_0x3b3030[_0xb940('0x40')]=_0x3b3030[_0xb940('0x40')][_0xb940('0x46')]?_0x3b3030[_0xb940('0x40')]:_0x298462[_0xb940('0x4f')];_0x3b3030[_0xb940('0xd7')]=qs[_0xb940('0xc8')](_0x57a5c4[_0xb940('0x3b')][_0xb940('0xc8')]);_0x3b3030['where']=qs[_0xb940('0x54')](_[_0xb940('0xca')](_0x57a5c4[_0xb940('0x3b')],_0x298462[_0xb940('0x54')]));if(_0x57a5c4['query'][_0xb940('0x2d')]){_0x3b3030['where']=_[_0xb940('0x57')](_0x3b3030[_0xb940('0xc9')],{'$or':_['map'](_0x3b3030[_0xb940('0x40')],function(_0x34ddbe){var _0x445007={};_0x445007[_0x34ddbe]={'$like':'%'+_0x57a5c4['query'][_0xb940('0x2d')]+'%'};return _0x445007;})});}_0x3b3030=_[_0xb940('0x57')]({},_0x3b3030,_0x57a5c4[_0xb940('0xcb')]);return _0x3413f7[_0xb940('0x129')](_0x3b3030);}})['then'](function(_0x3402b3){if(_0x3402b3){_0x43f662=_0x3402b3[_0xb940('0x46')];if(!_0x57a5c4[_0xb940('0x3b')][_0xb940('0xcf')](_0xb940('0xd0'))){_0x3b3030['limit']=qs[_0xb940('0xd1')](_0x57a5c4[_0xb940('0x3b')][_0xb940('0xd1')]);_0x3b3030['offset']=qs[_0xb940('0x21')](_0x57a5c4[_0xb940('0x3b')][_0xb940('0x21')]);}return _0x3413f7[_0xb940('0x129')](_0x3b3030);}})['then'](function(_0x4b105d){if(_0x4b105d){return _0x4b105d?{'count':_0x43f662,'rows':_0x4b105d}:null;}})['then'](respondWithResult(_0x4db7c5,null))[_0xb940('0x1d')](handleError(_0x4db7c5,null));};exports[_0xb940('0x12a')]=function(_0x4a488a,_0x4c867c){var _0x30aeac={};var _0x66d86c={};var _0x1ea263;return db[_0xb940('0x37')][_0xb940('0x95')]({'where':{'id':_0x4a488a['params']['id']}})[_0xb940('0x12')](handleEntityNotFound(_0x4c867c,null))[_0xb940('0x12')](function(_0x8566d9){if(_0x8566d9){_0x1ea263=_0x8566d9;_0x66d86c['model']=_[_0xb940('0x51')](db[_0xb940('0x37')][_0xb940('0x38')]);_0x66d86c[_0xb940('0x3b')]=_[_0xb940('0x51')](_0x4a488a[_0xb940('0x3b')]);_0x66d86c['filters']=_['intersection'](_0x66d86c[_0xb940('0x4f')],_0x66d86c['query']);_0x30aeac[_0xb940('0x40')]=_[_0xb940('0x55')](_0x66d86c[_0xb940('0x4f')],qs[_0xb940('0x56')](_0x4a488a[_0xb940('0x3b')][_0xb940('0x56')]));_0x30aeac[_0xb940('0x40')]=_0x30aeac[_0xb940('0x40')][_0xb940('0x46')]?_0x30aeac[_0xb940('0x40')]:_0x66d86c[_0xb940('0x4f')];_0x30aeac['order']=qs['sort'](_0x4a488a[_0xb940('0x3b')][_0xb940('0xc8')]);_0x30aeac[_0xb940('0xc9')]=qs['filters'](_[_0xb940('0xca')](_0x4a488a['query'],_0x66d86c[_0xb940('0x54')]));if(_0x4a488a[_0xb940('0x3b')][_0xb940('0x2d')]){_0x30aeac[_0xb940('0xc9')]=_[_0xb940('0x57')](_0x30aeac[_0xb940('0xc9')],{'$or':_['map'](_0x30aeac[_0xb940('0x40')],function(_0x403021){var _0x3e5b50={};_0x3e5b50[_0x403021]={'$like':'%'+_0x4a488a['query'][_0xb940('0x2d')]+'%'};return _0x3e5b50;})});}_0x30aeac[_0xb940('0x4f')]=db[_0xb940('0x37')];_0x30aeac['as']=_0xb940('0x88');_0x30aeac=_[_0xb940('0x57')]({},_0x30aeac,_0x4a488a[_0xb940('0xcb')]);return _0x1ea263['getVoiceQueues']({'include':[_0x30aeac]});}})[_0xb940('0x12')](function(_0x4fbcac){if(_0x4fbcac){var _0x5dcfe7={},_0x2b4f7d=[];for(var _0x4077c8=0x0;_0x4077c8<_0x4fbcac[_0xb940('0x46')];_0x4077c8+=0x1){for(var _0x4ada3a=0x0,_0xec7a11;_0x4ada3a<_0x4fbcac[_0x4077c8][_0xb940('0x88')][_0xb940('0x46')];_0x4ada3a+=0x1){_0xec7a11=_0x4fbcac[_0x4077c8]['Agents'][_0x4ada3a]['get']({'plain':!![]});_0x5dcfe7[_0xec7a11['id']]=_0xec7a11;}}_0x5dcfe7=_[_0xb940('0x12b')](_0x5dcfe7);for(var _0x450c03=qs[_0xb940('0x21')](_0x4a488a[_0xb940('0x3b')][_0xb940('0x21')]);_0x450c03<_0x5dcfe7[_0xb940('0x46')]&&_0x2b4f7d[_0xb940('0x46')]=_0x3c90cc[_0x6115('0x51')]){throw new Error(_0x6115('0x52'));}})[_0x6115('0x12')](function(){if(_0x829fea){return db[_0x6115('0x2d')][_0x6115('0x53')]({'where':{'membername':_0x829fea['name']},'individualHooks':!![]});}})['then'](function(){if(_0x829fea){return _0x829fea[_0x6115('0x54')]({'raw':!![]});}})[_0x6115('0x12')](function(_0x4daac2){if(_0x829fea){if(_0x4daac2){var _0x17cf8c=[];_0x35caec=_0x4daac2;if(_0x35caec[_0x6115('0x32')]){for(var _0x538a99=0x0;_0x538a99<_0x35caec[_0x6115('0x32')];_0x538a99++){_0x17cf8c[_0x6115('0x37')](db['UserVoiceQueueRt'][_0x6115('0x55')]({'membername':_0x829fea[_0x6115('0x29')],'UserId':_0x829fea['id'],'queue_name':_0x35caec[_0x538a99][_0x6115('0x29')],'VoiceQueueId':_0x35caec[_0x538a99]['id'],'interface':_0x418ed1,'paused':_0x829fea['loginInPause']||![],'penalty':_0x35caec[_0x538a99][_0x6115('0x56')]||0x0}));}return BPromise['all'](_0x17cf8c);}}}})[_0x6115('0x12')](function(){if(_0x829fea){return db[_0x6115('0x2f')]['findAll']({'where':{'membername':_0x829fea[_0x6115('0x29')],'exitAt':null}});}})['then'](function(_0x4c2c8f){if(_0x829fea){if(_0x4c2c8f&&_0x4c2c8f[_0x6115('0x32')]){var _0x131666=[];_0x4c2c8f['forEach'](function(_0x325f65){_0x131666['push'](_0x325f65[_0x6115('0x2e')]({'exitAt':moment()[_0x6115('0x33')](_0x6115('0x34'))}));});return BPromise[_0x6115('0x49')](_0x131666);}}})[_0x6115('0x12')](function(_0x57f864){if(_0x829fea){var _0xebe703=[];var _0x3de28b=[];var _0x27863b=utils['getChannels']();var _0x4137e0={'membername':_0x829fea['name'],'interface':_0x418ed1,'enterAt':moment()[_0x6115('0x33')](_0x6115('0x34')),'role':_0x829fea[_0x6115('0x2a')],'internal':_0x829fea['internal']};_0x27863b[_0x6115('0x36')](function(_0x478a1b){_0xebe703[_0x6115('0x37')](_[_0x6115('0x57')]({'channel':_0x478a1b,'type':_0x6115('0x58'),'data1':'callysquare','data2':_0x418ed1},_0x4137e0));if(_0x829fea[_0x6115('0x4d')]){_0x3de28b[_0x6115('0x37')](_[_0x6115('0x57')]({'channel':_0x478a1b,'type':_0x6115('0x31'),'data1':_0x6115('0x59')},_0x4137e0));}});return db[_0x6115('0x2f')][_0x6115('0x3b')](_0xebe703[_0x6115('0x5a')](_0x3de28b),{'individualHooks':!![]});}})[_0x6115('0x12')](function(){if(_0x829fea){return _0x829fea['update']({'online':!![],'lastLoginAt':moment()[_0x6115('0x33')](_0x6115('0x34')),'voicePause':_0x829fea[_0x6115('0x4d')]||![],'mailPause':_0x829fea[_0x6115('0x4d')]||![],'chatPause':_0x829fea[_0x6115('0x4d')]||![],'faxPause':_0x829fea[_0x6115('0x4d')]||![],'smsPause':_0x829fea[_0x6115('0x4d')]||![],'openchannelPause':_0x829fea[_0x6115('0x4d')]||![],'pauseType':_0x829fea[_0x6115('0x4d')]?_0x6115('0x59'):null,'lastPauseAt':moment()[_0x6115('0x33')](_0x6115('0x34')),'interface':_0x418ed1});}})[_0x6115('0x12')](function(_0x485381){_0x335ba2(_0x485381);})['catch'](function(_0x157284){_0x2262d4(_0x58aeac['error'](0x1f4,_0x157284[_0x6115('0x1a')]));});});}; \ No newline at end of file +var _0xcfe9=['then','ShowUser','find','interface','UserVoiceQueueRt','update','findAll','name','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','role','internal','uniqueid','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','voice','MemberReport','mail','fax','sms','whatsapp','system','set','%s%s','Pause','all','LogoutUser','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetUser','User','options','raw','where','attributes','limit','include','map','model'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xcfe9,0x91));var _0x9cfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfe9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9cfe('0x0'));var util=require(_0x9cfe('0x1'));var moment=require('moment');var BPromise=require(_0x9cfe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cfe('0x3'));var db=require(_0x9cfe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9cfe('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9cfe('0x6')],{'host':_0x9cfe('0x7'),'port':0x18eb});var socket=require(_0x9cfe('0x8'))(new Redis(config[_0x9cfe('0x6')]));require(_0x9cfe('0x9'))[_0x9cfe('0xa')](socket);function respondWithRpcPromise(_0x361738,_0x28bf5f,_0x3e87f1){return new BPromise(function(_0x5474a0,_0x161725){return client['request'](_0x361738,_0x3e87f1)['then'](function(_0x46c887){logger[_0x9cfe('0xb')](_0x9cfe('0xc'),_0x28bf5f,'request\x20sent');logger[_0x9cfe('0xd')](_0x9cfe('0xe'),_0x28bf5f,'request\x20sent',JSON[_0x9cfe('0xf')](_0x46c887));if(_0x46c887['error']){if(_0x46c887['error']['code']===0x1f4){logger[_0x9cfe('0x10')](_0x9cfe('0xc'),_0x28bf5f,_0x46c887['error'][_0x9cfe('0x11')]);return _0x161725(_0x46c887[_0x9cfe('0x10')][_0x9cfe('0x11')]);}logger[_0x9cfe('0x10')]('User,\x20%s,\x20%s',_0x28bf5f,_0x46c887['error']['message']);return _0x5474a0(_0x46c887['error']['message']);}else{logger[_0x9cfe('0xb')](_0x9cfe('0xc'),_0x28bf5f,_0x9cfe('0x12'));_0x5474a0(_0x46c887[_0x9cfe('0x13')][_0x9cfe('0x11')]);}})[_0x9cfe('0x14')](function(_0x435066){logger[_0x9cfe('0x10')](_0x9cfe('0xc'),_0x28bf5f,_0x435066);_0x161725(_0x435066);});});}exports[_0x9cfe('0x15')]=function(_0x2536c5){var _0xef576a=this;return new Promise(function(_0x1217db,_0x142348){return db[_0x9cfe('0x16')]['findAll']({'raw':_0x2536c5[_0x9cfe('0x17')]?_0x2536c5['options'][_0x9cfe('0x18')]===undefined?!![]:![]:!![],'where':_0x2536c5[_0x9cfe('0x17')]?_0x2536c5[_0x9cfe('0x17')][_0x9cfe('0x19')]||null:null,'attributes':_0x2536c5[_0x9cfe('0x17')]?_0x2536c5[_0x9cfe('0x17')][_0x9cfe('0x1a')]||null:null,'limit':_0x2536c5[_0x9cfe('0x17')]?_0x2536c5[_0x9cfe('0x17')][_0x9cfe('0x1b')]||null:null,'include':_0x2536c5['options']?_0x2536c5[_0x9cfe('0x17')][_0x9cfe('0x1c')]?_[_0x9cfe('0x1d')](_0x2536c5[_0x9cfe('0x17')][_0x9cfe('0x1c')],function(_0x3d3017){return{'model':db[_0x3d3017[_0x9cfe('0x1e')]],'as':_0x3d3017['as'],'attributes':_0x3d3017['attributes'],'include':_0x3d3017[_0x9cfe('0x1c')]?_[_0x9cfe('0x1d')](_0x3d3017[_0x9cfe('0x1c')],function(_0x30ba11){return{'model':db[_0x30ba11[_0x9cfe('0x1e')]],'as':_0x30ba11['as'],'attributes':_0x30ba11[_0x9cfe('0x1a')],'include':_0x30ba11[_0x9cfe('0x1c')]?_[_0x9cfe('0x1d')](_0x30ba11[_0x9cfe('0x1c')],function(_0x47ba31){return{'model':db[_0x47ba31[_0x9cfe('0x1e')]],'as':_0x47ba31['as'],'attributes':_0x47ba31['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cfe('0x1f')](function(_0x22d681){logger[_0x9cfe('0xb')](_0x9cfe('0x15'),_0x2536c5);logger[_0x9cfe('0xd')](_0x9cfe('0x15'),_0x2536c5,JSON[_0x9cfe('0xf')](_0x22d681));_0x1217db(_0x22d681);})[_0x9cfe('0x14')](function(_0x1727c3){logger[_0x9cfe('0x10')]('GetUser',_0x1727c3[_0x9cfe('0x11')],_0x2536c5);_0x142348(_0xef576a['error'](0x1f4,_0x1727c3[_0x9cfe('0x11')]));});});};exports[_0x9cfe('0x20')]=function(_0x5b4eff){var _0x44ce5b=this;return new Promise(function(_0x1d7c86,_0x47578d){return db[_0x9cfe('0x16')][_0x9cfe('0x21')]({'raw':_0x5b4eff[_0x9cfe('0x17')]?_0x5b4eff[_0x9cfe('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5b4eff[_0x9cfe('0x17')]?_0x5b4eff[_0x9cfe('0x17')]['where']||null:null,'attributes':_0x5b4eff[_0x9cfe('0x17')]?_0x5b4eff['options'][_0x9cfe('0x1a')]||null:null,'include':_0x5b4eff['options']?_0x5b4eff['options'][_0x9cfe('0x1c')]?_[_0x9cfe('0x1d')](_0x5b4eff[_0x9cfe('0x17')][_0x9cfe('0x1c')],function(_0x55fc49){return{'model':db[_0x55fc49[_0x9cfe('0x1e')]],'as':_0x55fc49['as'],'attributes':_0x55fc49[_0x9cfe('0x1a')],'include':_0x55fc49[_0x9cfe('0x1c')]?_[_0x9cfe('0x1d')](_0x55fc49[_0x9cfe('0x1c')],function(_0x3b9b3b){return{'model':db[_0x3b9b3b['model']],'as':_0x3b9b3b['as'],'attributes':_0x3b9b3b[_0x9cfe('0x1a')],'include':_0x3b9b3b['include']?_[_0x9cfe('0x1d')](_0x3b9b3b[_0x9cfe('0x1c')],function(_0x36a63b){return{'model':db[_0x36a63b['model']],'as':_0x36a63b['as'],'attributes':_0x36a63b[_0x9cfe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9cfe('0x1f')](function(_0x203e94){logger[_0x9cfe('0xb')](_0x9cfe('0x20'),_0x5b4eff);logger[_0x9cfe('0xd')](_0x9cfe('0x20'),_0x5b4eff,JSON['stringify'](_0x203e94));_0x1d7c86(_0x203e94);})[_0x9cfe('0x14')](function(_0x3090f7){logger['error'](_0x9cfe('0x20'),_0x3090f7[_0x9cfe('0x11')],_0x5b4eff);_0x47578d(_0x44ce5b[_0x9cfe('0x10')](0x1f4,_0x3090f7['message']));});});};exports['PauseUser']=function(_0x4fe8cd){var _0x113ef6=this;return new Promise(function(_0x535de5,_0x55aabb){var _0x1f12e7;return db['User'][_0x9cfe('0x21')]({'where':_0x4fe8cd['options']['where']||{},'attributes':['id','name','role','internal',_0x9cfe('0x22')]})[_0x9cfe('0x1f')](function(_0x254337){if(_0x254337){_0x1f12e7=_0x254337;return db[_0x9cfe('0x23')][_0x9cfe('0x24')]({'paused':0x1},{'where':{'UserId':_0x1f12e7['id']},'individualHooks':!![]});}})['then'](function(){if(_0x1f12e7){return db['MemberReport'][_0x9cfe('0x25')]({'where':{'membername':_0x1f12e7[_0x9cfe('0x26')],'type':_0x9cfe('0x27'),'exitAt':null}});}})[_0x9cfe('0x1f')](function(_0x95e70a){if(_0x1f12e7){if(_0x95e70a&&_0x95e70a['length']){var _0x4d92e5=moment()[_0x9cfe('0x28')](_0x9cfe('0x29'));for(var _0x27f097=0x0,_0x1f6628=_0x95e70a[_0x9cfe('0x2a')];_0x27f097<_0x1f6628;_0x27f097++){_0x95e70a[_0x27f097][_0x9cfe('0x2b')]({'exitAt':_0x4d92e5});}}}})[_0x9cfe('0x1f')](function(){if(_0x1f12e7){var _0x12691e=[];var _0x439a63=utils[_0x9cfe('0x2c')]();_0x439a63[_0x9cfe('0x2d')](function(_0x5ebd77){_0x12691e[_0x9cfe('0x2e')]({'channel':_0x5ebd77,'membername':_0x1f12e7['name'],'interface':_[_0x9cfe('0x2f')](_0x1f12e7['interface'])?util[_0x9cfe('0x28')](_0x9cfe('0x30'),_0x1f12e7['name']):_0x1f12e7[_0x9cfe('0x22')],'type':_0x9cfe('0x27'),'enterAt':moment()[_0x9cfe('0x28')](_0x9cfe('0x29')),'data1':_0x4fe8cd[_0x9cfe('0x31')][_0x9cfe('0x32')]||_0x9cfe('0x33'),'role':_0x1f12e7[_0x9cfe('0x34')],'internal':_0x1f12e7[_0x9cfe('0x35')],'uniqueid':_0x4fe8cd['body'][_0x9cfe('0x36')]||null});});return db['MemberReport'][_0x9cfe('0x37')](_0x12691e,{'individualHooks':!![]});}})[_0x9cfe('0x1f')](function(){if(_0x1f12e7){return _0x1f12e7[_0x9cfe('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4fe8cd[_0x9cfe('0x31')][_0x9cfe('0x32')]||_0x9cfe('0x33'),'lastPauseAt':moment()['format'](_0x9cfe('0x29'))});}})[_0x9cfe('0x1f')](function(_0xb0a995){_0x535de5(_0xb0a995);})[_0x9cfe('0x14')](function(_0x258aa7){_0x55aabb(_0x113ef6['error'](0x1f4,_0x258aa7[_0x9cfe('0x11')]));});});};exports[_0x9cfe('0x38')]=function(_0x55f775){var _0x3ab6f0=this;return new Promise(function(_0xdf6b2d,_0x1844ab){var _0x76b8bb;return db['User'][_0x9cfe('0x39')]({'where':_0x55f775[_0x9cfe('0x17')][_0x9cfe('0x19')]||{},'attributes':['id','name']})[_0x9cfe('0x1f')](function(_0xda2cba){if(_0xda2cba){_0x76b8bb=_0xda2cba;if(_0x55f775[_0x9cfe('0x31')][_0x9cfe('0x3a')]&&!utils[_0x9cfe('0x3b')](_0x55f775[_0x9cfe('0x31')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x55f775[_0x9cfe('0x31')]['channel']){case _0x9cfe('0x3c'):return db['UserVoiceQueueRt'][_0x9cfe('0x24')]({'paused':0x0},{'where':{'UserId':_0x76b8bb['id']}})[_0x9cfe('0x1f')](function(){return db[_0x9cfe('0x3d')][_0x9cfe('0x21')]({'where':{'channel':_0x55f775[_0x9cfe('0x31')][_0x9cfe('0x3a')],'membername':_0x76b8bb[_0x9cfe('0x26')],'type':'PAUSE','exitAt':null}});})[_0x9cfe('0x1f')](function(_0x21457f){if(_0x21457f){return _0x21457f[_0x9cfe('0x24')]({'exitAt':moment()[_0x9cfe('0x28')](_0x9cfe('0x29')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x9cfe('0x1f')](function(){return _0x76b8bb[_0x9cfe('0x24')]({'voicePause':![]});});case _0x9cfe('0x3e'):case'chat':case _0x9cfe('0x3f'):case _0x9cfe('0x40'):case'openchannel':case _0x9cfe('0x41'):return db[_0x9cfe('0x3d')][_0x9cfe('0x21')]({'where':{'channel':_0x55f775['body']['channel'],'membername':_0x76b8bb[_0x9cfe('0x26')],'type':_0x9cfe('0x27'),'exitAt':null}})[_0x9cfe('0x1f')](function(_0x123505){return _0x123505[_0x9cfe('0x24')]({'exitAt':moment()['format'](_0x9cfe('0x29')),'data2':_0x9cfe('0x42')},{'individualHooks':!![]});})[_0x9cfe('0x1f')](function(){var _0x51e019={};_[_0x9cfe('0x43')](_0x51e019,util[_0x9cfe('0x28')](_0x9cfe('0x44'),_0x55f775['body'][_0x9cfe('0x3a')],_0x9cfe('0x45')),![]);return _0x76b8bb[_0x9cfe('0x24')](_0x51e019);});default:return db[_0x9cfe('0x23')][_0x9cfe('0x24')]({'paused':0x0},{'where':{'UserId':_0x76b8bb['id']}})[_0x9cfe('0x1f')](function(){return db['MemberReport'][_0x9cfe('0x25')]({'where':{'membername':_0x76b8bb[_0x9cfe('0x26')],'type':_0x9cfe('0x27'),'exitAt':null}});})[_0x9cfe('0x1f')](function(_0x567dc6){var _0x46e235=[];_0x567dc6[_0x9cfe('0x2d')](function(_0xf9b7d2){_0x46e235[_0x9cfe('0x2e')](_0xf9b7d2[_0x9cfe('0x24')]({'exitAt':moment()[_0x9cfe('0x28')](_0x9cfe('0x29')),'data2':_0x9cfe('0x42')}));});return BPromise[_0x9cfe('0x46')](_0x46e235);})['then'](function(){return _0x76b8bb[_0x9cfe('0x24')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x325bf7){_0xdf6b2d(_0x325bf7);})[_0x9cfe('0x14')](function(_0x140732){_0x1844ab(_0x3ab6f0[_0x9cfe('0x10')](0x1f4,_0x140732[_0x9cfe('0x11')]));});});};exports[_0x9cfe('0x47')]=function(_0x448109){var _0x1a8b39=this;return new Promise(function(_0x5348dc,_0x3286b8){var _0x306537;return db[_0x9cfe('0x16')]['findOne']({'where':_0x448109[_0x9cfe('0x17')][_0x9cfe('0x19')]||{},'attributes':['id',_0x9cfe('0x26')]})[_0x9cfe('0x1f')](function(_0x35adeb){if(_0x35adeb){_0x306537=_0x35adeb;return db[_0x9cfe('0x23')]['destroy']({'where':{'membername':_0x306537[_0x9cfe('0x26')]},'individualHooks':!![]});}})[_0x9cfe('0x1f')](function(){if(_0x306537){return db['MemberReport'][_0x9cfe('0x25')]({'where':{'membername':_0x306537[_0x9cfe('0x26')],'exitAt':null}});}})[_0x9cfe('0x1f')](function(_0x21dbfb){if(_0x306537){if(_0x21dbfb&&_0x21dbfb['length']){var _0x5e274b=[];_0x21dbfb[_0x9cfe('0x2d')](function(_0xd74d7a){_0x5e274b[_0x9cfe('0x2e')](_0xd74d7a[_0x9cfe('0x24')]({'exitAt':moment()[_0x9cfe('0x28')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9cfe('0x46')](_0x5e274b);}}})[_0x9cfe('0x1f')](function(){if(_0x306537){return _0x306537['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x339c3d){_0x5348dc(_0x339c3d);})[_0x9cfe('0x14')](function(_0x67d028){_0x3286b8(_0x1a8b39[_0x9cfe('0x10')](0x1f4,_0x67d028[_0x9cfe('0x11')]));});});};exports[_0x9cfe('0x48')]=function(_0x3efd62){var _0x2c1cfd=this;return new Promise(function(_0xf3d2c3,_0x1546e8){var _0xeb770f;var _0x5b760c;var _0x34d1c7;var _0x3a36ba;return db['User'][_0x9cfe('0x39')]({'where':_0x3efd62['options'][_0x9cfe('0x19')]||{},'attributes':['id','name',_0x9cfe('0x34'),_0x9cfe('0x49'),'phone',_0x9cfe('0x35'),'loginInPause',_0x9cfe('0x22')]})[_0x9cfe('0x1f')](function(_0x321ff1){if(_0x321ff1){_0xeb770f=_0x321ff1;_0x3a36ba=_0x3efd62['body'][_0x9cfe('0x22')]?_0x3efd62[_0x9cfe('0x31')]['interface']:util['format']('SIP/%s',_0xeb770f['name']);return db[_0x9cfe('0x16')][_0x9cfe('0x4a')]({'where':{'role':_0x9cfe('0x4b'),'online':!![],'id':{'$ne':_0xeb770f['id']}}});}})[_0x9cfe('0x1f')](function(_0x44f310){if(_0x44f310){_0x34d1c7=_0x44f310;return require(_0x9cfe('0x4c'))[_0x9cfe('0x4d')]();}})[_0x9cfe('0x1f')](function(_0x215d7f){if(_0x215d7f&&_0x215d7f['agents']&&_0x34d1c7>=_0x215d7f[_0x9cfe('0x4e')]){throw new Error(_0x9cfe('0x4f'));}})[_0x9cfe('0x1f')](function(){if(_0xeb770f){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xeb770f[_0x9cfe('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0xeb770f){return _0xeb770f[_0x9cfe('0x50')]({'raw':!![]});}})['then'](function(_0x5365d3){if(_0xeb770f){if(_0x5365d3){var _0x1a227b=[];_0x5b760c=_0x5365d3;if(_0x5b760c[_0x9cfe('0x2a')]){for(var _0x2a68bb=0x0;_0x2a68bb<_0x5b760c[_0x9cfe('0x2a')];_0x2a68bb++){_0x1a227b[_0x9cfe('0x2e')](db[_0x9cfe('0x23')][_0x9cfe('0x51')]({'membername':_0xeb770f[_0x9cfe('0x26')],'UserId':_0xeb770f['id'],'queue_name':_0x5b760c[_0x2a68bb][_0x9cfe('0x26')],'VoiceQueueId':_0x5b760c[_0x2a68bb]['id'],'interface':_0x3a36ba,'paused':_0xeb770f[_0x9cfe('0x52')]||![],'penalty':_0x5b760c[_0x2a68bb][_0x9cfe('0x53')]||0x0}));}return BPromise['all'](_0x1a227b);}}}})['then'](function(){if(_0xeb770f){return db['MemberReport']['findAll']({'where':{'membername':_0xeb770f['name'],'exitAt':null}});}})['then'](function(_0x2255b8){if(_0xeb770f){if(_0x2255b8&&_0x2255b8[_0x9cfe('0x2a')]){var _0x56ef37=[];_0x2255b8[_0x9cfe('0x2d')](function(_0x7f33dd){_0x56ef37['push'](_0x7f33dd[_0x9cfe('0x24')]({'exitAt':moment()['format'](_0x9cfe('0x29'))}));});return BPromise[_0x9cfe('0x46')](_0x56ef37);}}})[_0x9cfe('0x1f')](function(_0x1e7cec){if(_0xeb770f){var _0x23fea9=[];var _0xce82fa=[];var _0x25e225=utils[_0x9cfe('0x2c')]();var _0x27739c={'membername':_0xeb770f[_0x9cfe('0x26')],'interface':_0x3a36ba,'enterAt':moment()['format'](_0x9cfe('0x29')),'role':_0xeb770f[_0x9cfe('0x34')],'internal':_0xeb770f[_0x9cfe('0x35')]};_0x25e225[_0x9cfe('0x2d')](function(_0x1d81ed){_0x23fea9[_0x9cfe('0x2e')](_[_0x9cfe('0x54')]({'channel':_0x1d81ed,'type':_0x9cfe('0x55'),'data1':'callysquare','data2':_0x3a36ba},_0x27739c));if(_0xeb770f[_0x9cfe('0x52')]){_0xce82fa[_0x9cfe('0x2e')](_['merge']({'channel':_0x1d81ed,'type':'PAUSE','data1':_0x9cfe('0x56')},_0x27739c));}});return db['MemberReport']['bulkCreate'](_0x23fea9[_0x9cfe('0x57')](_0xce82fa),{'individualHooks':!![]});}})['then'](function(){if(_0xeb770f){return _0xeb770f[_0x9cfe('0x24')]({'online':!![],'lastLoginAt':moment()[_0x9cfe('0x28')](_0x9cfe('0x29')),'voicePause':_0xeb770f['loginInPause']||![],'mailPause':_0xeb770f[_0x9cfe('0x52')]||![],'chatPause':_0xeb770f[_0x9cfe('0x52')]||![],'faxPause':_0xeb770f['loginInPause']||![],'smsPause':_0xeb770f[_0x9cfe('0x52')]||![],'openchannelPause':_0xeb770f['loginInPause']||![],'pauseType':_0xeb770f[_0x9cfe('0x52')]?_0x9cfe('0x56'):null,'lastPauseAt':moment()[_0x9cfe('0x28')](_0x9cfe('0x29')),'interface':_0x3a36ba});}})[_0x9cfe('0x1f')](function(_0x9361f2){_0xf3d2c3(_0x9361f2);})[_0x9cfe('0x14')](function(_0x37284b){_0x1546e8(_0x2c1cfd[_0x9cfe('0x10')](0x1f4,_0x37284b[_0x9cfe('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1093b99..18b5e99 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 _0xa64c=['length','./user.events','save','remove','update','removeListener'];(function(_0x1bf880,_0x50b11f){var _0x37f257=function(_0x403593){while(--_0x403593){_0x1bf880['push'](_0x1bf880['shift']());}};_0x37f257(++_0x50b11f);}(_0xa64c,0x13f));var _0xca64=function(_0x1f9cc1,_0x50bfc4){_0x1f9cc1=_0x1f9cc1-0x0;var _0x1579bd=_0xa64c[_0x1f9cc1];return _0x1579bd;};'use strict';var UserEvents=require(_0xca64('0x0'));var events=[_0xca64('0x1'),_0xca64('0x2'),_0xca64('0x3')];function createListener(_0x946b55,_0x5ddc98){return function(_0x512aed){_0x5ddc98['emit'](_0x946b55,_0x512aed);};}function removeListener(_0x383339,_0x8c88ad){return function(){UserEvents[_0xca64('0x4')](_0x383339,_0x8c88ad);};}exports['register']=function(_0x4b597e){for(var _0x1823fa=0x0,_0x38d0c8=events[_0xca64('0x5')];_0x1823fa<_0x38d0c8;_0x1823fa++){var _0x5a0d6b=events[_0x1823fa];var _0x598416=createListener('user:'+_0x5a0d6b,_0x4b597e);UserEvents['on'](_0x5a0d6b,_0x598416);}}; \ No newline at end of file +var _0xef5c=['remove','emit','removeListener','register','length','user:','save'];(function(_0x3bbd1c,_0x50421c){var _0x209950=function(_0x52a715){while(--_0x52a715){_0x3bbd1c['push'](_0x3bbd1c['shift']());}};_0x209950(++_0x50421c);}(_0xef5c,0xbc));var _0xcef5=function(_0xbf6866,_0x5bf6e3){_0xbf6866=_0xbf6866-0x0;var _0x1f68f6=_0xef5c[_0xbf6866];return _0x1f68f6;};'use strict';var UserEvents=require('./user.events');var events=[_0xcef5('0x0'),_0xcef5('0x1'),'update'];function createListener(_0xe65381,_0x2576b1){return function(_0x20a6f8){_0x2576b1[_0xcef5('0x2')](_0xe65381,_0x20a6f8);};}function removeListener(_0x4a4d24,_0x29f2fb){return function(){UserEvents[_0xcef5('0x3')](_0x4a4d24,_0x29f2fb);};}exports[_0xcef5('0x4')]=function(_0x3561f8){for(var _0x126081=0x0,_0x471e46=events[_0xcef5('0x5')];_0x126081<_0x471e46;_0x126081++){var _0x256119=events[_0x126081];var _0x5ffdfe=createListener(_0xcef5('0x6')+_0x256119,_0x3561f8);UserEvents['on'](_0x256119,_0x5ffdfe);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c010c90..9672dbc 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5de85c,_0x67c18e){var _0x515b90=function(_0x1a5cf4){while(--_0x1a5cf4){_0x5de85c['push'](_0x5de85c['shift']());}};_0x515b90(++_0x67c18e);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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(_0x4218d0,_0x18aa4c){var _0x2c142c=function(_0x27a612){while(--_0x27a612){_0x4218d0['push'](_0x4218d0['shift']());}};_0x2c142c(++_0x18aa4c);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d4f2798..08645df 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 _0x8d59=['exports','INTEGER','sequelize'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8d59,0xb9));var _0x98d5=function(_0x5f58d3,_0x3c1837){_0x5f58d3=_0x5f58d3-0x0;var _0x36af18=_0x8d59[_0x5f58d3];return _0x36af18;};'use strict';var Sequelize=require(_0x98d5('0x0'));module[_0x98d5('0x1')]={'penalty':{'type':Sequelize[_0x98d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6379=['sequelize','exports','INTEGER'];(function(_0xc0c252,_0x2004d8){var _0x2750f0=function(_0x945c){while(--_0x945c){_0xc0c252['push'](_0xc0c252['shift']());}};_0x2750f0(++_0x2004d8);}(_0x6379,0x84));var _0x9637=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x6379[_0x4b91c4];return _0x25cb80;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'penalty':{'type':Sequelize[_0x9637('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 8012796..9d19d3d 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 _0x4f6b=['request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0x4f6b,0x1a8));var _0xb4f6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4f6b[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0xb4f6('0x0'));var logger=require(_0xb4f6('0x1'))(_0xb4f6('0x2'));var moment=require(_0xb4f6('0x3'));var BPromise=require(_0xb4f6('0x4'));var rp=require(_0xb4f6('0x5'));var fs=require('fs');var path=require(_0xb4f6('0x6'));var rimraf=require(_0xb4f6('0x7'));var config=require(_0xb4f6('0x8'));var attributes=require('./userChatQueue.attributes');module[_0xb4f6('0x9')]=function(_0x417bec,_0x2f9658){return _0x417bec[_0xb4f6('0xa')](_0xb4f6('0xb'),attributes,{'tableName':_0xb4f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x338a=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x338a,0xfc));var _0xa338=function(_0x1038e2,_0x306b2e){_0x1038e2=_0x1038e2-0x0;var _0x36ea97=_0x338a[_0x1038e2];return _0x36ea97;};'use strict';var _=require(_0xa338('0x0'));var util=require(_0xa338('0x1'));var logger=require(_0xa338('0x2'))('api');var moment=require(_0xa338('0x3'));var BPromise=require(_0xa338('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa338('0x5'));var rimraf=require(_0xa338('0x6'));var config=require(_0xa338('0x7'));var attributes=require(_0xa338('0x8'));module[_0xa338('0x9')]=function(_0x270faf,_0x345323){return _0x270faf[_0xa338('0xa')](_0xa338('0xb'),attributes,{'tableName':'user_has_chat_queues','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 36ceead..5b42fa4 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 _0x4159=['request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x8666fa,_0x56fc4b){var _0x253a9a=function(_0x5e3604){while(--_0x5e3604){_0x8666fa['push'](_0x8666fa['shift']());}};_0x253a9a(++_0x56fc4b);}(_0x4159,0x1c2));var _0x9415=function(_0x197176,_0x384510){_0x197176=_0x197176-0x0;var _0x4ec777=_0x4159[_0x197176];return _0x4ec777;};'use strict';var _=require(_0x9415('0x0'));var util=require(_0x9415('0x1'));var moment=require('moment');var BPromise=require(_0x9415('0x2'));var rs=require(_0x9415('0x3'));var fs=require('fs');var Redis=require(_0x9415('0x4'));var db=require(_0x9415('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9415('0x6'))(_0x9415('0x7'));var config=require('../../config/environment');var jayson=require(_0x9415('0x8'));var client=jayson['client'][_0x9415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x312313,_0xb3e569,_0x17121c){return new BPromise(function(_0x4c01df,_0x3a10ac){return client[_0x9415('0xa')](_0x312313,_0x17121c)[_0x9415('0xb')](function(_0x14764d){logger[_0x9415('0xc')](_0x9415('0xd'),_0xb3e569,_0x9415('0xe'));logger['debug'](_0x9415('0xf'),_0xb3e569,'request\x20sent',JSON[_0x9415('0x10')](_0x14764d));if(_0x14764d[_0x9415('0x11')]){if(_0x14764d['error']['code']===0x1f4){logger[_0x9415('0x11')](_0x9415('0xd'),_0xb3e569,_0x14764d['error'][_0x9415('0x12')]);return _0x3a10ac(_0x14764d[_0x9415('0x11')][_0x9415('0x12')]);}logger[_0x9415('0x11')](_0x9415('0xd'),_0xb3e569,_0x14764d['error'][_0x9415('0x12')]);return _0x4c01df(_0x14764d[_0x9415('0x11')][_0x9415('0x12')]);}else{logger[_0x9415('0xc')](_0x9415('0xd'),_0xb3e569,_0x9415('0xe'));_0x4c01df(_0x14764d[_0x9415('0x13')][_0x9415('0x12')]);}})['catch'](function(_0x5f5c3b){logger['error'](_0x9415('0xd'),_0xb3e569,_0x5f5c3b);_0x3a10ac(_0x5f5c3b);});});} \ No newline at end of file +var _0x6d62=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b6573,_0x4a150f){var _0x1219b5=function(_0x4f39b3){while(--_0x4f39b3){_0x1b6573['push'](_0x1b6573['shift']());}};_0x1219b5(++_0x4a150f);}(_0x6d62,0x187));var _0x26d6=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0x6d62[_0x45cb89];return _0x5948c1;};'use strict';var _=require(_0x26d6('0x0'));var util=require(_0x26d6('0x1'));var moment=require('moment');var BPromise=require(_0x26d6('0x2'));var rs=require(_0x26d6('0x3'));var fs=require('fs');var Redis=require(_0x26d6('0x4'));var db=require(_0x26d6('0x5'))['db'];var utils=require(_0x26d6('0x6'));var logger=require(_0x26d6('0x7'))(_0x26d6('0x8'));var config=require(_0x26d6('0x9'));var jayson=require(_0x26d6('0xa'));var client=jayson[_0x26d6('0xb')][_0x26d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x198acc,_0x51c11f,_0x3a437f){return new BPromise(function(_0x46d48e,_0x41bb0c){return client['request'](_0x198acc,_0x3a437f)[_0x26d6('0xd')](function(_0xea4582){logger['info'](_0x26d6('0xe'),_0x51c11f,_0x26d6('0xf'));logger[_0x26d6('0x10')](_0x26d6('0x11'),_0x51c11f,'request\x20sent',JSON['stringify'](_0xea4582));if(_0xea4582[_0x26d6('0x12')]){if(_0xea4582[_0x26d6('0x12')][_0x26d6('0x13')]===0x1f4){logger[_0x26d6('0x12')](_0x26d6('0xe'),_0x51c11f,_0xea4582[_0x26d6('0x12')]['message']);return _0x41bb0c(_0xea4582[_0x26d6('0x12')]['message']);}logger[_0x26d6('0x12')](_0x26d6('0xe'),_0x51c11f,_0xea4582[_0x26d6('0x12')][_0x26d6('0x14')]);return _0x46d48e(_0xea4582['error'][_0x26d6('0x14')]);}else{logger[_0x26d6('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x51c11f,_0x26d6('0xf'));_0x46d48e(_0xea4582[_0x26d6('0x16')]['message']);}})[_0x26d6('0x17')](function(_0x2de69c){logger[_0x26d6('0x12')](_0x26d6('0xe'),_0x51c11f,_0x2de69c);_0x41bb0c(_0x2de69c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 10b64fe..bdc7d80 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x27531a,_0x2d6749){var _0x57afc4=function(_0x42be9b){while(--_0x42be9b){_0x27531a['push'](_0x27531a['shift']());}};_0x57afc4(++_0x2d6749);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2c959b8..1059c29 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 _0x4099=['INTEGER','STRING','sequelize'];(function(_0x3cf890,_0x4f845a){var _0x3e7fd9=function(_0x5ee857){while(--_0x5ee857){_0x3cf890['push'](_0x3cf890['shift']());}};_0x3e7fd9(++_0x4f845a);}(_0x4099,0xe3));var _0x9409=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x4099[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require(_0x9409('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9409('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9409('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9409('0x2')]}}; \ No newline at end of file +var _0x4517=['exports','INTEGER','STRING'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0x4517,0x81));var _0x7451=function(_0x26b918,_0x5c92fa){_0x26b918=_0x26b918-0x0;var _0x47f8d8=_0x4517[_0x26b918];return _0x47f8d8;};'use strict';var Sequelize=require('sequelize');module[_0x7451('0x0')]={'penalty':{'type':Sequelize[_0x7451('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7451('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7451('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ef2a1eb..e2fdf91 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 _0x81b8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x4228c0,_0x433cfa){var _0x5f291e=function(_0xeac8c1){while(--_0xeac8c1){_0x4228c0['push'](_0x4228c0['shift']());}};_0x5f291e(++_0x433cfa);}(_0x81b8,0x135));var _0x881b=function(_0x5c86b3,_0x486325){_0x5c86b3=_0x5c86b3-0x0;var _0x2ddb8a=_0x81b8[_0x5c86b3];return _0x2ddb8a;};'use strict';var _=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var logger=require(_0x881b('0x2'))('api');var moment=require(_0x881b('0x3'));var BPromise=require(_0x881b('0x4'));var rp=require(_0x881b('0x5'));var fs=require('fs');var path=require(_0x881b('0x6'));var rimraf=require(_0x881b('0x7'));var config=require(_0x881b('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x881b('0x9')]=function(_0x243b99,_0x1e74f9){return _0x243b99[_0x881b('0xa')](_0x881b('0xb'),attributes,{'tableName':_0x881b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x217b=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x47b13a,_0x5924f6){var _0x4199ab=function(_0x4d3502){while(--_0x4d3502){_0x47b13a['push'](_0x47b13a['shift']());}};_0x4199ab(++_0x5924f6);}(_0x217b,0x10c));var _0xb217=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x217b[_0x54defc];return _0x1955d3;};'use strict';var _=require(_0xb217('0x0'));var util=require(_0xb217('0x1'));var logger=require(_0xb217('0x2'))(_0xb217('0x3'));var moment=require(_0xb217('0x4'));var BPromise=require(_0xb217('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb217('0x6'));var rimraf=require(_0xb217('0x7'));var config=require('../../config/environment');var attributes=require(_0xb217('0x8'));module[_0xb217('0x9')]=function(_0x32bf6f,_0x1114c2){return _0x32bf6f['define'](_0xb217('0xa'),attributes,{'tableName':_0xb217('0xb'),'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 b5c2f10..b24a2d5 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 _0x9a6c=['UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x9a6c,0x18f));var _0xc9a6=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x9a6c[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xc9a6('0x0'));var util=require(_0xc9a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc9a6('0x2'));var fs=require('fs');var Redis=require(_0xc9a6('0x3'));var db=require(_0xc9a6('0x4'))['db'];var utils=require(_0xc9a6('0x5'));var logger=require(_0xc9a6('0x6'))(_0xc9a6('0x7'));var config=require(_0xc9a6('0x8'));var jayson=require(_0xc9a6('0x9'));var client=jayson[_0xc9a6('0xa')][_0xc9a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eedd5,_0x1d4812,_0x315cae){return new BPromise(function(_0x41dfce,_0x22dbde){return client['request'](_0x5eedd5,_0x315cae)[_0xc9a6('0xc')](function(_0x2c0611){logger[_0xc9a6('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1d4812,_0xc9a6('0xe'));logger[_0xc9a6('0xf')](_0xc9a6('0x10'),_0x1d4812,_0xc9a6('0xe'),JSON['stringify'](_0x2c0611));if(_0x2c0611[_0xc9a6('0x11')]){if(_0x2c0611[_0xc9a6('0x11')][_0xc9a6('0x12')]===0x1f4){logger[_0xc9a6('0x11')](_0xc9a6('0x13'),_0x1d4812,_0x2c0611['error'][_0xc9a6('0x14')]);return _0x22dbde(_0x2c0611['error'][_0xc9a6('0x14')]);}logger['error'](_0xc9a6('0x13'),_0x1d4812,_0x2c0611['error'][_0xc9a6('0x14')]);return _0x41dfce(_0x2c0611[_0xc9a6('0x11')]['message']);}else{logger['info'](_0xc9a6('0x13'),_0x1d4812,_0xc9a6('0xe'));_0x41dfce(_0x2c0611[_0xc9a6('0x15')][_0xc9a6('0x14')]);}})['catch'](function(_0x185c55){logger[_0xc9a6('0x11')](_0xc9a6('0x13'),_0x1d4812,_0x185c55);_0x22dbde(_0x185c55);});});} \ No newline at end of file +var _0x3159=['result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x3718b4,_0x278960){var _0x38531a=function(_0x28da80){while(--_0x28da80){_0x3718b4['push'](_0x3718b4['shift']());}};_0x38531a(++_0x278960);}(_0x3159,0x13d));var _0x9315=function(_0x25c9d6,_0x589d97){_0x25c9d6=_0x25c9d6-0x0;var _0x464a11=_0x3159[_0x25c9d6];return _0x464a11;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9315('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9315('0x1'));var db=require(_0x9315('0x2'))['db'];var utils=require(_0x9315('0x3'));var logger=require(_0x9315('0x4'))(_0x9315('0x5'));var config=require(_0x9315('0x6'));var jayson=require(_0x9315('0x7'));var client=jayson[_0x9315('0x8')][_0x9315('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a4a5,_0x36c49c,_0x5ae538){return new BPromise(function(_0x25b5fe,_0xeca61d){return client['request'](_0x46a4a5,_0x5ae538)[_0x9315('0xa')](function(_0xf10591){logger[_0x9315('0xb')](_0x9315('0xc'),_0x36c49c,'request\x20sent');logger[_0x9315('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x36c49c,_0x9315('0xe'),JSON[_0x9315('0xf')](_0xf10591));if(_0xf10591[_0x9315('0x10')]){if(_0xf10591[_0x9315('0x10')][_0x9315('0x11')]===0x1f4){logger['error'](_0x9315('0xc'),_0x36c49c,_0xf10591['error'][_0x9315('0x12')]);return _0xeca61d(_0xf10591[_0x9315('0x10')][_0x9315('0x12')]);}logger[_0x9315('0x10')](_0x9315('0xc'),_0x36c49c,_0xf10591[_0x9315('0x10')][_0x9315('0x12')]);return _0x25b5fe(_0xf10591['error']['message']);}else{logger[_0x9315('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x36c49c,_0x9315('0xe'));_0x25b5fe(_0xf10591[_0x9315('0x13')][_0x9315('0x12')]);}})[_0x9315('0x14')](function(_0x2b2ac7){logger['error'](_0x9315('0xc'),_0x36c49c,_0x2b2ac7);_0xeca61d(_0x2b2ac7);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 368e458..7fd0bb4 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31e57b,_0x37d4bb){var _0x59bd07=function(_0x4c7dee){while(--_0x4c7dee){_0x31e57b['push'](_0x31e57b['shift']());}};_0x59bd07(++_0x37d4bb);}(_0xe706,0xa3));var _0x6e70=function(_0x2375e1,_0x3d125a){_0x2375e1=_0x2375e1-0x0;var _0x2ccc7d=_0xe706[_0x2375e1];return _0x2ccc7d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x13ceef,_0x425a6e){var _0x1721b4=function(_0x15c027){while(--_0x15c027){_0x13ceef['push'](_0x13ceef['shift']());}};_0x1721b4(++_0x425a6e);}(_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 d7f2f5c..500b0f2 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 _0xe685=['exports','INTEGER'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xe685,0xe0));var _0x5e68=function(_0x57be2d,_0x18cd8a){_0x57be2d=_0x57be2d-0x0;var _0xa2ca67=_0xe685[_0x57be2d];return _0xa2ca67;};'use strict';var Sequelize=require('sequelize');module[_0x5e68('0x0')]={'penalty':{'type':Sequelize[_0x5e68('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc387=['sequelize','exports','INTEGER'];(function(_0x14248d,_0x69504){var _0xd13db1=function(_0xa131ac){while(--_0xa131ac){_0x14248d['push'](_0x14248d['shift']());}};_0xd13db1(++_0x69504);}(_0xc387,0x168));var _0x7c38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc387[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7c38('0x0'));module[_0x7c38('0x1')]={'penalty':{'type':Sequelize[_0x7c38('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index e70bfe7..b163f13 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 _0xc8ba=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','lodash','util','../../config/logger'];(function(_0x2ea725,_0x429ede){var _0x33fb61=function(_0x13ad58){while(--_0x13ad58){_0x2ea725['push'](_0x2ea725['shift']());}};_0x33fb61(++_0x429ede);}(_0xc8ba,0x15c));var _0xac8b=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xc8ba[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0xac8b('0x0'));var util=require(_0xac8b('0x1'));var logger=require(_0xac8b('0x2'))(_0xac8b('0x3'));var moment=require(_0xac8b('0x4'));var BPromise=require(_0xac8b('0x5'));var rp=require(_0xac8b('0x6'));var fs=require('fs');var path=require(_0xac8b('0x7'));var rimraf=require(_0xac8b('0x8'));var config=require(_0xac8b('0x9'));var attributes=require(_0xac8b('0xa'));module['exports']=function(_0x57a6d6,_0x484792){return _0x57a6d6[_0xac8b('0xb')](_0xac8b('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb2=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6cb2,0xe9));var _0x26cb=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x6cb2[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require(_0x26cb('0x0'));var logger=require(_0x26cb('0x1'))(_0x26cb('0x2'));var moment=require(_0x26cb('0x3'));var BPromise=require(_0x26cb('0x4'));var rp=require(_0x26cb('0x5'));var fs=require('fs');var path=require(_0x26cb('0x6'));var rimraf=require(_0x26cb('0x7'));var config=require(_0x26cb('0x8'));var attributes=require(_0x26cb('0x9'));module[_0x26cb('0xa')]=function(_0x318cd6,_0x22cc96){return _0x318cd6[_0x26cb('0xb')](_0x26cb('0xc'),attributes,{'tableName':_0x26cb('0xd'),'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 fe9f4a6..ac296f2 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x1341e7,_0x25445c){var _0x174c05=function(_0x3fca2a){while(--_0x3fca2a){_0x1341e7['push'](_0x1341e7['shift']());}};_0x174c05(++_0x25445c);}(_0x3e74,0x175));var _0x43e7=function(_0x5b55a9,_0xfdd838){_0x5b55a9=_0x5b55a9-0x0;var _0x4cf3f5=_0x3e74[_0x5b55a9];return _0x4cf3f5;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x50c554,_0x27d4fe){var _0x1f424c=function(_0xe575c8){while(--_0xe575c8){_0x50c554['push'](_0x50c554['shift']());}};_0x1f424c(++_0x27d4fe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x5fc3[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4ec9d32..06fb00e 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 _0x8a0a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','multer'];(function(_0x55c083,_0xb69b1f){var _0x193459=function(_0x29d9fd){while(--_0x29d9fd){_0x55c083['push'](_0x55c083['shift']());}};_0x193459(++_0xb69b1f);}(_0x8a0a,0xf1));var _0xa8a0=function(_0x377e8b,_0x345ced){_0x377e8b=_0x377e8b-0x0;var _0x224531=_0x8a0a[_0x377e8b];return _0x224531;};'use strict';var multer=require(_0xa8a0('0x0'));var util=require('util');var path=require(_0xa8a0('0x1'));var timeout=require(_0xa8a0('0x2'));var express=require(_0xa8a0('0x3'));var router=express[_0xa8a0('0x4')]();var fs_extra=require(_0xa8a0('0x5'));var auth=require(_0xa8a0('0x6'));var interaction=require(_0xa8a0('0x7'));var config=require(_0xa8a0('0x8'));var controller=require(_0xa8a0('0x9'));router[_0xa8a0('0xa')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xd79f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','express'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xd79f,0xe6));var _0xfd79=function(_0x1f1bbb,_0x56322b){_0x1f1bbb=_0x1f1bbb-0x0;var _0x39b37c=_0xd79f[_0x1f1bbb];return _0x39b37c;};'use strict';var multer=require(_0xfd79('0x0'));var util=require(_0xfd79('0x1'));var path=require(_0xfd79('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd79('0x3'));var router=express[_0xfd79('0x4')]();var fs_extra=require(_0xfd79('0x5'));var auth=require(_0xfd79('0x6'));var interaction=require(_0xfd79('0x7'));var config=require('../../config/environment');var controller=require(_0xfd79('0x8'));router[_0xfd79('0x9')]('/',auth[_0xfd79('0xa')](),controller[_0xfd79('0xb')]);module[_0xfd79('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f2a8577..56e6d87 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 _0xd33c=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x292e19,_0x1d6477){var _0x20505c=function(_0x8ad2b5){while(--_0x8ad2b5){_0x292e19['push'](_0x292e19['shift']());}};_0x20505c(++_0x1d6477);}(_0xd33c,0x1de));var _0xcd33=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xd33c[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xcd33('0x0'));module['exports']={'body':{'type':Sequelize[_0xcd33('0x1')]},'senderName':{'type':Sequelize[_0xcd33('0x2')]},'recipientsId':{'type':Sequelize[_0xcd33('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xcd33('0x3')]}}; \ No newline at end of file +var _0x3dc2=['TEXT','BOOLEAN','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3dc2,0x8e));var _0x23dc=function(_0x14242f,_0x44eaa6){_0x14242f=_0x14242f-0x0;var _0x1a673=_0x3dc2[_0x14242f];return _0x1a673;};'use strict';var Sequelize=require('sequelize');module[_0x23dc('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x23dc('0x1')]},'recipientsId':{'type':Sequelize[_0x23dc('0x2')]},'recipientsDescription':{'type':Sequelize[_0x23dc('0x1')]},'beep':{'type':Sequelize[_0x23dc('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ea57716..2fb639d 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 _0xd3f5=['../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','limit','count','Content-Range','apply','reject','then','sendStatus','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','render','startCase','union','ids','replace','queue','Queue','all','flatten','getAgents','map','eml-format','rimraf','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd3f5,0x1d1));var _0x5d3f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd3f5[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x5d3f('0x0'));var rimraf=require(_0x5d3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5d3f('0x2'));var Mustache=require(_0x5d3f('0x3'));var util=require(_0x5d3f('0x4'));var path=require(_0x5d3f('0x5'));var sox=require('sox');var csv=require(_0x5d3f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d3f('0x7'));var _=require(_0x5d3f('0x8'));var squel=require(_0x5d3f('0x9'));var crypto=require(_0x5d3f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5d3f('0xb'));var toCsv=require(_0x5d3f('0x6'));var querystring=require(_0x5d3f('0xc'));var Papa=require(_0x5d3f('0xd'));var Redis=require(_0x5d3f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5d3f('0xf'));var as=require(_0x5d3f('0x10'));var hardwareService=require(_0x5d3f('0x11'));var logger=require(_0x5d3f('0x12'))(_0x5d3f('0x13'));var utils=require(_0x5d3f('0x14'));var config=require(_0x5d3f('0x15'));var licenseUtil=require(_0x5d3f('0x16'));var db=require('../../mysqldb')['db'];config[_0x5d3f('0x17')]=_[_0x5d3f('0x18')](config[_0x5d3f('0x17')],{'host':_0x5d3f('0x19'),'port':0x18eb});var socket=require(_0x5d3f('0x1a'))(new Redis(config['redis']));require(_0x5d3f('0x1b'))[_0x5d3f('0x1c')](socket);function respondWithStatusCode(_0x1e6cc9,_0x130ee7){_0x130ee7=_0x130ee7||0xcc;return function(_0x19c182){if(_0x19c182){return _0x1e6cc9['sendStatus'](_0x130ee7);}return _0x1e6cc9[_0x5d3f('0x1d')](_0x130ee7)[_0x5d3f('0x1e')]();};}function respondWithResult(_0x391a1e,_0x11621f){_0x11621f=_0x11621f||0xc8;return function(_0x10c58c){if(_0x10c58c){return _0x391a1e['status'](_0x11621f)[_0x5d3f('0x1f')](_0x10c58c);}};}function respondWithFilteredResult(_0x33fcc0,_0x5aac36){return function(_0x274e3f){if(_0x274e3f){var _0x2c4591=typeof _0x5aac36[_0x5d3f('0x20')]==='undefined'&&typeof _0x5aac36[_0x5d3f('0x21')]==='undefined';var _0x978cc5=_0x274e3f[_0x5d3f('0x22')];var _0x5b8d74=_0x2c4591?0x0:_0x5aac36[_0x5d3f('0x20')];var _0x20f9f0=_0x2c4591?_0x274e3f[_0x5d3f('0x22')]:_0x5aac36[_0x5d3f('0x20')]+_0x5aac36[_0x5d3f('0x21')];var _0x161b0a;if(_0x20f9f0>=_0x978cc5){_0x20f9f0=_0x978cc5;_0x161b0a=0xc8;}else{_0x161b0a=0xce;}_0x33fcc0[_0x5d3f('0x1d')](_0x161b0a);return _0x33fcc0['set'](_0x5d3f('0x23'),_0x5b8d74+'-'+_0x20f9f0+'/'+_0x978cc5)[_0x5d3f('0x1f')](_0x274e3f);}return null;};}function patchUpdates(_0x2ec34d){return function(_0x273f9d){try{jsonpatch[_0x5d3f('0x24')](_0x273f9d,_0x2ec34d,!![]);}catch(_0x24f693){return BPromise[_0x5d3f('0x25')](_0x24f693);}return _0x273f9d['save']();};}function saveUpdates(_0x204548,_0x26244f){return function(_0x713c4b){if(_0x713c4b){return _0x713c4b['update'](_0x204548)[_0x5d3f('0x26')](function(_0x14bad0){return _0x14bad0;});}return null;};}function removeEntity(_0x1e3cf5,_0x4b4359){return function(_0x31e05a){if(_0x31e05a){return _0x31e05a['destroy']()[_0x5d3f('0x26')](function(){_0x1e3cf5['status'](0xcc)[_0x5d3f('0x1e')]();});}};}function handleEntityNotFound(_0x567f29,_0x5ac8c4){return function(_0xb804b3){if(!_0xb804b3){_0x567f29[_0x5d3f('0x27')](0x194);}return _0xb804b3;};}function handleError(_0x203fee,_0x428bf2){_0x428bf2=_0x428bf2||0x1f4;return function(_0x5775eb){logger[_0x5d3f('0x28')](_0x5775eb['stack']);if(_0x5775eb['name']){delete _0x5775eb[_0x5d3f('0x29')];}_0x203fee[_0x5d3f('0x1d')](_0x428bf2)[_0x5d3f('0x2a')](_0x5775eb);};}exports[_0x5d3f('0x2b')]=function(_0x4973c8,_0x40e46d,_0x210c83){if(!_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x2d')](_0x5d3f('0x2e'))&&!_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x2d')](_0x5d3f('0x2f'))){throw new db[(_0x5d3f('0x30'))][(_0x5d3f('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x2d')](_0x5d3f('0x2f'))&&!_0x4973c8['body'][_0x5d3f('0x2d')](_0x5d3f('0x32'))){throw new db[(_0x5d3f('0x30'))][(_0x5d3f('0x31'))](_0x5d3f('0x33'));}if(!_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x2d')](_0x5d3f('0x34'))){throw new db['Sequelize'][(_0x5d3f('0x31'))](_0x5d3f('0x35'));}else{try{var _0x488a13=JSON[_0x5d3f('0x36')](_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x34')]);}catch(_0x5c938e){logger[_0x5d3f('0x28')](_0x5c938e);throw new db[(_0x5d3f('0x30'))][(_0x5d3f('0x31'))](_0x5d3f('0x37'));}var _0x5aa700=['chatqueue','faxqueue',_0x5d3f('0x38'),_0x5d3f('0x39'),_0x5d3f('0x3a'),_0x5d3f('0x3b'),_0x5d3f('0x3c'),_0x5d3f('0x3d'),'user'];if(_[_0x5d3f('0x3e')](_0x488a13,function(_0x463809){return!_[_0x5d3f('0x3f')](_0x5aa700,_0x463809[_0x5d3f('0x40')][_0x5d3f('0x41')]());})){throw new db[(_0x5d3f('0x30'))][(_0x5d3f('0x31'))](_0x5d3f('0x42'));}}}var _0x36f8a1={};_0x36f8a1[_0x5d3f('0x43')]=_0x4973c8['body'][_0x5d3f('0x2d')]('senderName')?_0x4973c8['body'][_0x5d3f('0x43')]:_0x4973c8[_0x5d3f('0x44')][_0x5d3f('0x45')];_0x36f8a1['recipientsDescription']=_['isEmpty'](_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x46')])?null:_0x4973c8['body'][_0x5d3f('0x46')];_0x36f8a1['beep']=_0x4973c8[_0x5d3f('0x2c')][_0x5d3f('0x47')]||![];_0x36f8a1[_0x5d3f('0x48')]=_0x4973c8[_0x5d3f('0x44')]['id'];return getContent(_0x4973c8[_0x5d3f('0x2c')])[_0x5d3f('0x26')](function(_0x12c6be){_0x36f8a1['body']=_0x12c6be;return getRecipients(_0x488a13);})[_0x5d3f('0x26')](function(_0x55e507){_0x36f8a1[_0x5d3f('0x49')]=_[_0x5d3f('0x4a')](_0x55e507)['join'](',');return db[_0x5d3f('0x4b')][_0x5d3f('0x4c')](function(_0x55f3f0){return db[_0x5d3f('0x4d')][_0x5d3f('0x4e')](_0x36f8a1,{'raw':!![],'transaction':_0x55f3f0})[_0x5d3f('0x26')](function(_0x3eec42){var _0x88c90c={'sender':_0x36f8a1['senderName'],'description':_0x36f8a1[_0x5d3f('0x46')],'content':_0x36f8a1[_0x5d3f('0x2c')],'beep':_0x36f8a1[_0x5d3f('0x47')]};_0x55e507[_0x5d3f('0x4f')](function(_0x42fd55){_0x88c90c[_0x5d3f('0x50')]=_0x42fd55;socket[_0x5d3f('0x51')](_0x5d3f('0x52'),_0x88c90c);});return _0x3eec42;});});})[_0x5d3f('0x26')](respondWithResult(_0x40e46d,0xc9))[_0x5d3f('0x53')](handleError(_0x40e46d,null));};function getContent(_0x1f7203){return new BPromise(function(_0x49abeb,_0x113482){if(_0x1f7203[_0x5d3f('0x2e')]){_0x49abeb(_0x1f7203[_0x5d3f('0x2e')]);return;}return db[_0x5d3f('0x54')]['findOne']({'attributes':[_0x5d3f('0x55')],'where':{'id':_0x1f7203[_0x5d3f('0x2f')]},'raw':!![]})[_0x5d3f('0x26')](function(_0x49e0d3){if(!_0x49e0d3)throw new db[(_0x5d3f('0x30'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2154bb=Mustache[_0x5d3f('0x56')](_0x49e0d3['html'],_0x1f7203[_0x5d3f('0x32')]);_0x49abeb(_0x2154bb);})[_0x5d3f('0x53')](function(_0xc4ee03){_0x113482(_0xc4ee03);});});}function getRecipients(_0x49f75b){return new BPromise(function(_0x144ffb,_0x402659){var _0x22f0b6=[];var _0x241fe5=[];_0x49f75b[_0x5d3f('0x4f')](function(_0x5617ff){var _0x591024=_[_0x5d3f('0x57')](_0x5617ff[_0x5d3f('0x40')][_0x5d3f('0x41')]());if(_0x591024==='User'){_0x22f0b6=_[_0x5d3f('0x58')](_0x22f0b6,_0x5617ff[_0x5d3f('0x59')]);}else{if(_[_0x5d3f('0x3f')](_0x591024,'queue'))_0x591024=_0x591024[_0x5d3f('0x5a')](_0x5d3f('0x5b'),_0x5d3f('0x5c'));_0x5617ff['ids'][_0x5d3f('0x4f')](function(_0x33e0a5){_0x241fe5['push'](getAgents(_0x591024,_0x33e0a5));});}});return BPromise[_0x5d3f('0x5d')](_0x241fe5)[_0x5d3f('0x26')](function(_0x2df324){_0x22f0b6=_[_0x5d3f('0x58')](_0x22f0b6,_[_0x5d3f('0x5e')](_0x2df324));_0x144ffb(_0x22f0b6);})[_0x5d3f('0x53')](function(_0x2691ef){_0x402659(_0x2691ef);});});}function getAgents(_0x42347a,_0x39c064){return new BPromise(function(_0x3f986b,_0x291a58){return db[_0x42347a]['findOne']({'where':{'id':_0x39c064}})[_0x5d3f('0x26')](function(_0x30e017){return _0x30e017[_0x5d3f('0x5f')]({'attributes':['id'],'raw':!![]})[_0x5d3f('0x26')](function(_0x3f8a5f){var _0x4684cb=_[_0x5d3f('0x60')](_0x3f8a5f,'id');_0x3f986b(_0x4684cb);});})[_0x5d3f('0x53')](function(_0x592062){_0x291a58(_0x592062);});});} \ No newline at end of file +var _0x17e0=['Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','startCase','queue','push','union','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','error','stack','name','send','body','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse'];(function(_0x5d5a55,_0x48b339){var _0xa0a1f7=function(_0x22c878){while(--_0x22c878){_0x5d5a55['push'](_0x5d5a55['shift']());}};_0xa0a1f7(++_0x48b339);}(_0x17e0,0x150));var _0x017e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x17e0[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x017e('0x0'));var rimraf=require(_0x017e('0x1'));var zipdir=require(_0x017e('0x2'));var jsonpatch=require(_0x017e('0x3'));var rp=require(_0x017e('0x4'));var moment=require(_0x017e('0x5'));var BPromise=require(_0x017e('0x6'));var Mustache=require(_0x017e('0x7'));var util=require(_0x017e('0x8'));var path=require(_0x017e('0x9'));var sox=require('sox');var csv=require(_0x017e('0xa'));var ejs=require(_0x017e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x017e('0xc'));var crypto=require(_0x017e('0xd'));var jsforce=require(_0x017e('0xe'));var deskjs=require(_0x017e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x017e('0x10'));var Redis=require(_0x017e('0x11'));var authService=require(_0x017e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x017e('0x13'));var hardwareService=require(_0x017e('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x017e('0x15'));var licenseUtil=require(_0x017e('0x16'));var db=require(_0x017e('0x17'))['db'];config[_0x017e('0x18')]=_['defaults'](config['redis'],{'host':_0x017e('0x19'),'port':0x18eb});var socket=require(_0x017e('0x1a'))(new Redis(config[_0x017e('0x18')]));require('./userNotification.socket')[_0x017e('0x1b')](socket);function respondWithStatusCode(_0x4de10c,_0x264016){_0x264016=_0x264016||0xcc;return function(_0xac45c0){if(_0xac45c0){return _0x4de10c[_0x017e('0x1c')](_0x264016);}return _0x4de10c[_0x017e('0x1d')](_0x264016)[_0x017e('0x1e')]();};}function respondWithResult(_0x2b838d,_0x5c83ed){_0x5c83ed=_0x5c83ed||0xc8;return function(_0x3dc200){if(_0x3dc200){return _0x2b838d[_0x017e('0x1d')](_0x5c83ed)[_0x017e('0x1f')](_0x3dc200);}};}function respondWithFilteredResult(_0x27b3f4,_0x2b8c95){return function(_0x27c380){if(_0x27c380){var _0x3edabc=typeof _0x2b8c95[_0x017e('0x20')]===_0x017e('0x21')&&typeof _0x2b8c95[_0x017e('0x22')]===_0x017e('0x21');var _0x445dca=_0x27c380[_0x017e('0x23')];var _0x30a46e=_0x3edabc?0x0:_0x2b8c95[_0x017e('0x20')];var _0x4ffe66=_0x3edabc?_0x27c380[_0x017e('0x23')]:_0x2b8c95[_0x017e('0x20')]+_0x2b8c95['limit'];var _0x29ffbf;if(_0x4ffe66>=_0x445dca){_0x4ffe66=_0x445dca;_0x29ffbf=0xc8;}else{_0x29ffbf=0xce;}_0x27b3f4[_0x017e('0x1d')](_0x29ffbf);return _0x27b3f4[_0x017e('0x24')]('Content-Range',_0x30a46e+'-'+_0x4ffe66+'/'+_0x445dca)[_0x017e('0x1f')](_0x27c380);}return null;};}function patchUpdates(_0x162dd7){return function(_0x53b8e9){try{jsonpatch['apply'](_0x53b8e9,_0x162dd7,!![]);}catch(_0x2d9141){return BPromise[_0x017e('0x25')](_0x2d9141);}return _0x53b8e9[_0x017e('0x26')]();};}function saveUpdates(_0x2fbd6d,_0x1f268f){return function(_0x5aae13){if(_0x5aae13){return _0x5aae13['update'](_0x2fbd6d)['then'](function(_0x1b918e){return _0x1b918e;});}return null;};}function removeEntity(_0x2b591d,_0x1ff3d8){return function(_0x55143c){if(_0x55143c){return _0x55143c[_0x017e('0x27')]()['then'](function(){_0x2b591d[_0x017e('0x1d')](0xcc)[_0x017e('0x1e')]();});}};}function handleEntityNotFound(_0x3d7f31,_0x1255e7){return function(_0x5d0bf4){if(!_0x5d0bf4){_0x3d7f31[_0x017e('0x1c')](0x194);}return _0x5d0bf4;};}function handleError(_0x125854,_0x2a0196){_0x2a0196=_0x2a0196||0x1f4;return function(_0x389dea){logger[_0x017e('0x28')](_0x389dea[_0x017e('0x29')]);if(_0x389dea[_0x017e('0x2a')]){delete _0x389dea[_0x017e('0x2a')];}_0x125854[_0x017e('0x1d')](_0x2a0196)[_0x017e('0x2b')](_0x389dea);};}exports['sendUserNotification']=function(_0x1c4281,_0x3fed46,_0x69998){if(!_0x1c4281[_0x017e('0x2c')]['hasOwnProperty'](_0x017e('0x2d'))&&!_0x1c4281['body']['hasOwnProperty'](_0x017e('0x2e'))){throw new db['Sequelize']['ValidationError'](_0x017e('0x2f'));}else{if(_0x1c4281['body']['hasOwnProperty']('TemplateId')&&!_0x1c4281[_0x017e('0x2c')][_0x017e('0x30')](_0x017e('0x31'))){throw new db[(_0x017e('0x32'))]['ValidationError'](_0x017e('0x33'));}if(!_0x1c4281[_0x017e('0x2c')][_0x017e('0x30')](_0x017e('0x34'))){throw new db[(_0x017e('0x32'))][(_0x017e('0x35'))](_0x017e('0x36'));}else{try{var _0x2eb2ad=JSON[_0x017e('0x37')](_0x1c4281['body']['recipients']);}catch(_0x3d923c){logger['error'](_0x3d923c);throw new db[(_0x017e('0x32'))][(_0x017e('0x35'))](_0x017e('0x38'));}var _0x4ea32d=[_0x017e('0x39'),_0x017e('0x3a'),_0x017e('0x3b'),_0x017e('0x3c'),_0x017e('0x3d'),_0x017e('0x3e'),_0x017e('0x3f'),_0x017e('0x40'),_0x017e('0x41')];if(_[_0x017e('0x42')](_0x2eb2ad,function(_0x46b37c){return!_[_0x017e('0x43')](_0x4ea32d,_0x46b37c[_0x017e('0x44')][_0x017e('0x45')]());})){throw new db[(_0x017e('0x32'))][(_0x017e('0x35'))](_0x017e('0x46'));}}}var _0x295c58={};_0x295c58['senderName']=_0x1c4281['body']['hasOwnProperty']('senderName')?_0x1c4281['body'][_0x017e('0x47')]:_0x1c4281['user'][_0x017e('0x48')];_0x295c58['recipientsDescription']=_['isEmpty'](_0x1c4281[_0x017e('0x2c')][_0x017e('0x49')])?null:_0x1c4281[_0x017e('0x2c')]['recipientsDescription'];_0x295c58[_0x017e('0x4a')]=_0x1c4281[_0x017e('0x2c')][_0x017e('0x4a')]||![];_0x295c58[_0x017e('0x4b')]=_0x1c4281['user']['id'];return getContent(_0x1c4281[_0x017e('0x2c')])[_0x017e('0x4c')](function(_0x4d189f){_0x295c58[_0x017e('0x2c')]=_0x4d189f;return getRecipients(_0x2eb2ad);})['then'](function(_0x2edeb3){_0x295c58[_0x017e('0x4d')]=_[_0x017e('0x4e')](_0x2edeb3)[_0x017e('0x4f')](',');return db[_0x017e('0x50')][_0x017e('0x51')](function(_0x10bae0){return db[_0x017e('0x52')][_0x017e('0x53')](_0x295c58,{'raw':!![],'transaction':_0x10bae0})[_0x017e('0x4c')](function(_0x133cff){var _0xa6a0b0={'sender':_0x295c58[_0x017e('0x47')],'description':_0x295c58[_0x017e('0x49')],'content':_0x295c58[_0x017e('0x2c')],'beep':_0x295c58['beep']};_0x2edeb3[_0x017e('0x54')](function(_0x195efd){_0xa6a0b0[_0x017e('0x55')]=_0x195efd;socket[_0x017e('0x56')]('userNotification:send',_0xa6a0b0);});return _0x133cff;});});})[_0x017e('0x4c')](respondWithResult(_0x3fed46,0xc9))['catch'](handleError(_0x3fed46,null));};function getContent(_0x1114e5){return new BPromise(function(_0x345587,_0x22db0b){if(_0x1114e5[_0x017e('0x2d')]){_0x345587(_0x1114e5[_0x017e('0x2d')]);return;}return db[_0x017e('0x57')][_0x017e('0x58')]({'attributes':['html'],'where':{'id':_0x1114e5[_0x017e('0x2e')]},'raw':!![]})[_0x017e('0x4c')](function(_0x4d8455){if(!_0x4d8455)throw new db['Sequelize'][(_0x017e('0x35'))](_0x017e('0x59'));var _0x1f93c1=Mustache[_0x017e('0x5a')](_0x4d8455[_0x017e('0x5b')],_0x1114e5[_0x017e('0x31')]);_0x345587(_0x1f93c1);})[_0x017e('0x5c')](function(_0x3f0d1c){_0x22db0b(_0x3f0d1c);});});}function getRecipients(_0x54336b){return new BPromise(function(_0x2cd2e2,_0x34ea29){var _0x17a374=[];var _0x561337=[];_0x54336b[_0x017e('0x54')](function(_0x1611b2){var _0x123e2d=_[_0x017e('0x5d')](_0x1611b2[_0x017e('0x44')][_0x017e('0x45')]());if(_0x123e2d==='User'){_0x17a374=_['union'](_0x17a374,_0x1611b2['ids']);}else{if(_[_0x017e('0x43')](_0x123e2d,_0x017e('0x5e')))_0x123e2d=_0x123e2d['replace']('queue','Queue');_0x1611b2['ids']['forEach'](function(_0xe1164e){_0x561337[_0x017e('0x5f')](getAgents(_0x123e2d,_0xe1164e));});}});return BPromise['all'](_0x561337)[_0x017e('0x4c')](function(_0x4e2019){_0x17a374=_[_0x017e('0x60')](_0x17a374,_['flatten'](_0x4e2019));_0x2cd2e2(_0x17a374);})[_0x017e('0x5c')](function(_0x119e49){_0x34ea29(_0x119e49);});});}function getAgents(_0x4ff86,_0x509aec){return new BPromise(function(_0x4144af,_0x20ad9b){return db[_0x4ff86]['findOne']({'where':{'id':_0x509aec}})[_0x017e('0x4c')](function(_0x3f01a5){return _0x3f01a5[_0x017e('0x61')]({'attributes':['id'],'raw':!![]})[_0x017e('0x4c')](function(_0x27ab18){var _0x4adeae=_['map'](_0x27ab18,'id');_0x4144af(_0x4adeae);});})[_0x017e('0x5c')](function(_0x4f6ee2){_0x20ad9b(_0x4f6ee2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8a54463..7e3bb0a 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 _0x6909=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x22cb64,_0x14d789){var _0xe75e09=function(_0x5c1170){while(--_0x5c1170){_0x22cb64['push'](_0x22cb64['shift']());}};_0xe75e09(++_0x14d789);}(_0x6909,0xa6));var _0x9690=function(_0x2d2c9f,_0x29e56e){_0x2d2c9f=_0x2d2c9f-0x0;var _0x2608b3=_0x6909[_0x2d2c9f];return _0x2608b3;};'use strict';var EventEmitter=require(_0x9690('0x0'));var UserNotification=require(_0x9690('0x1'))['db'][_0x9690('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9690('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9690('0x4'),'afterDestroy':_0x9690('0x5')};function emitEvent(_0x5c64b2){return function(_0x2c67b6,_0x335b10,_0x5b1727){UserNotificationEvents[_0x9690('0x6')](_0x5c64b2+':'+_0x2c67b6['id'],_0x2c67b6);UserNotificationEvents[_0x9690('0x6')](_0x5c64b2,_0x2c67b6);_0x5b1727(null);};}for(var e in events){if(events[_0x9690('0x7')](e)){var event=events[e];UserNotification[_0x9690('0x8')](e,emitEvent(event));}}module[_0x9690('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x72fb=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x72fb,0x10b));var _0xb72f=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0x72fb[_0x409fb8];return _0x278270;};'use strict';var EventEmitter=require(_0xb72f('0x0'));var UserNotification=require(_0xb72f('0x1'))['db'][_0xb72f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb72f('0x3')](0x0);var events={'afterCreate':_0xb72f('0x4'),'afterUpdate':_0xb72f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3684ce){return function(_0xcb4ab3,_0x333553,_0x23965b){UserNotificationEvents[_0xb72f('0x6')](_0x3684ce+':'+_0xcb4ab3['id'],_0xcb4ab3);UserNotificationEvents['emit'](_0x3684ce,_0xcb4ab3);_0x23965b(null);};}for(var e in events){if(events[_0xb72f('0x7')](e)){var event=events[e];UserNotification[_0xb72f('0x8')](e,emitEvent(event));}}module[_0xb72f('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d733b64..f869c3b 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 _0x2e26=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./userNotification.attributes','exports','userNotifications','utf8mb4'];(function(_0x54d10d,_0x1c6ee5){var _0x3f31ef=function(_0xe3658d){while(--_0xe3658d){_0x54d10d['push'](_0x54d10d['shift']());}};_0x3f31ef(++_0x1c6ee5);}(_0x2e26,0xc1));var _0x62e2=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x2e26[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0x62e2('0x0'));var util=require('util');var logger=require(_0x62e2('0x1'))(_0x62e2('0x2'));var moment=require(_0x62e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x62e2('0x4'));var fs=require('fs');var path=require(_0x62e2('0x5'));var rimraf=require(_0x62e2('0x6'));var config=require('../../config/environment');var attributes=require(_0x62e2('0x7'));module[_0x62e2('0x8')]=function(_0x506b03,_0x291001){return _0x506b03['define']('UserNotification',attributes,{'tableName':_0x62e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x62e2('0xa'),'collate':_0x62e2('0xb')});}; \ No newline at end of file +var _0xe4a3=['api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x5d8efd,_0x585cdb){var _0x325f60=function(_0x444867){while(--_0x444867){_0x5d8efd['push'](_0x5d8efd['shift']());}};_0x325f60(++_0x585cdb);}(_0xe4a3,0x107));var _0x3e4a=function(_0x106fed,_0x3d8337){_0x106fed=_0x106fed-0x0;var _0x39e37d=_0xe4a3[_0x106fed];return _0x39e37d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e4a('0x0'))(_0x3e4a('0x1'));var moment=require(_0x3e4a('0x2'));var BPromise=require(_0x3e4a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e4a('0x4'));var rimraf=require(_0x3e4a('0x5'));var config=require(_0x3e4a('0x6'));var attributes=require(_0x3e4a('0x7'));module[_0x3e4a('0x8')]=function(_0x3827ae,_0x1a74fc){return _0x3827ae['define'](_0x3e4a('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e4a('0xa'),'collate':_0x3e4a('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 825a637..7c6da47 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 _0x07da=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','util','moment'];(function(_0x1c7ce9,_0x2b4bc2){var _0x435519=function(_0x9f924b){while(--_0x9f924b){_0x1c7ce9['push'](_0x1c7ce9['shift']());}};_0x435519(++_0x2b4bc2);}(_0x07da,0x85));var _0xa07d=function(_0x1784ce,_0x3c26a6){_0x1784ce=_0x1784ce-0x0;var _0x2ca84e=_0x07da[_0x1784ce];return _0x2ca84e;};'use strict';var _=require('lodash');var util=require(_0xa07d('0x0'));var moment=require(_0xa07d('0x1'));var BPromise=require(_0xa07d('0x2'));var rs=require(_0xa07d('0x3'));var fs=require('fs');var Redis=require(_0xa07d('0x4'));var db=require(_0xa07d('0x5'))['db'];var utils=require(_0xa07d('0x6'));var logger=require(_0xa07d('0x7'))('rpc');var config=require(_0xa07d('0x8'));var jayson=require(_0xa07d('0x9'));var client=jayson[_0xa07d('0xa')][_0xa07d('0xb')]({'port':0x232a});config[_0xa07d('0xc')]=_[_0xa07d('0xd')](config[_0xa07d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa07d('0xe'))(new Redis(config[_0xa07d('0xc')]));require(_0xa07d('0xf'))[_0xa07d('0x10')](socket);function respondWithRpcPromise(_0x38a30d,_0x12967e,_0x348887){return new BPromise(function(_0x5e2138,_0x476ab1){return client['request'](_0x38a30d,_0x348887)['then'](function(_0x406c46){logger['info']('UserNotification,\x20%s,\x20%s',_0x12967e,_0xa07d('0x11'));logger[_0xa07d('0x12')](_0xa07d('0x13'),_0x12967e,_0xa07d('0x11'),JSON['stringify'](_0x406c46));if(_0x406c46[_0xa07d('0x14')]){if(_0x406c46[_0xa07d('0x14')][_0xa07d('0x15')]===0x1f4){logger[_0xa07d('0x14')](_0xa07d('0x16'),_0x12967e,_0x406c46[_0xa07d('0x14')][_0xa07d('0x17')]);return _0x476ab1(_0x406c46['error'][_0xa07d('0x17')]);}logger[_0xa07d('0x14')](_0xa07d('0x16'),_0x12967e,_0x406c46[_0xa07d('0x14')][_0xa07d('0x17')]);return _0x5e2138(_0x406c46['error'][_0xa07d('0x17')]);}else{logger[_0xa07d('0x18')](_0xa07d('0x16'),_0x12967e,_0xa07d('0x11'));_0x5e2138(_0x406c46[_0xa07d('0x19')]['message']);}})[_0xa07d('0x1a')](function(_0x29d2b7){logger[_0xa07d('0x14')](_0xa07d('0x16'),_0x12967e,_0x29d2b7);_0x476ab1(_0x29d2b7);});});} \ No newline at end of file +var _0x0934=['UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','./userNotification.socket','register','then','info','debug'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x0934,0x168));var _0x4093=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x0934[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x4093('0x0'));var util=require(_0x4093('0x1'));var moment=require(_0x4093('0x2'));var BPromise=require(_0x4093('0x3'));var rs=require(_0x4093('0x4'));var fs=require('fs');var Redis=require(_0x4093('0x5'));var db=require(_0x4093('0x6'))['db'];var utils=require(_0x4093('0x7'));var logger=require(_0x4093('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4093('0x9')]['http']({'port':0x232a});config[_0x4093('0xa')]=_[_0x4093('0xb')](config[_0x4093('0xa')],{'host':_0x4093('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4093('0xa')]));require(_0x4093('0xd'))[_0x4093('0xe')](socket);function respondWithRpcPromise(_0x59bbfb,_0x3ae94e,_0x270d3e){return new BPromise(function(_0x45eb96,_0xb2107d){return client['request'](_0x59bbfb,_0x270d3e)[_0x4093('0xf')](function(_0x3fd6ed){logger[_0x4093('0x10')]('UserNotification,\x20%s,\x20%s',_0x3ae94e,'request\x20sent');logger[_0x4093('0x11')](_0x4093('0x12'),_0x3ae94e,_0x4093('0x13'),JSON[_0x4093('0x14')](_0x3fd6ed));if(_0x3fd6ed[_0x4093('0x15')]){if(_0x3fd6ed[_0x4093('0x15')][_0x4093('0x16')]===0x1f4){logger[_0x4093('0x15')](_0x4093('0x17'),_0x3ae94e,_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);return _0xb2107d(_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);}logger[_0x4093('0x15')](_0x4093('0x17'),_0x3ae94e,_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);return _0x45eb96(_0x3fd6ed[_0x4093('0x15')][_0x4093('0x18')]);}else{logger['info'](_0x4093('0x17'),_0x3ae94e,_0x4093('0x13'));_0x45eb96(_0x3fd6ed[_0x4093('0x19')][_0x4093('0x18')]);}})[_0x4093('0x1a')](function(_0x3016ee){logger[_0x4093('0x15')](_0x4093('0x17'),_0x3ae94e,_0x3016ee);_0xb2107d(_0x3016ee);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a89091b..52fa978 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 _0x6331=['length','userNotification:','./userNotification.events','save','emit','removeListener','register'];(function(_0x5e81ce,_0x4713b6){var _0x4534f6=function(_0x515255){while(--_0x515255){_0x5e81ce['push'](_0x5e81ce['shift']());}};_0x4534f6(++_0x4713b6);}(_0x6331,0x121));var _0x1633=function(_0x3c2740,_0x5214f1){_0x3c2740=_0x3c2740-0x0;var _0x146454=_0x6331[_0x3c2740];return _0x146454;};'use strict';var UserNotificationEvents=require(_0x1633('0x0'));var events=[_0x1633('0x1'),'remove','update'];function createListener(_0x2d6c58,_0x54a21d){return function(_0xa7ab01){_0x54a21d[_0x1633('0x2')](_0x2d6c58,_0xa7ab01);};}function removeListener(_0x3a1ec9,_0x371659){return function(){UserNotificationEvents[_0x1633('0x3')](_0x3a1ec9,_0x371659);};}exports[_0x1633('0x4')]=function(_0x1dbda5){for(var _0x496be9=0x0,_0x36a404=events[_0x1633('0x5')];_0x496be9<_0x36a404;_0x496be9++){var _0x1791e5=events[_0x496be9];var _0x378ba4=createListener(_0x1633('0x6')+_0x1791e5,_0x1dbda5);UserNotificationEvents['on'](_0x1791e5,_0x378ba4);}}; \ No newline at end of file +var _0xd28a=['userNotification:','remove','update','emit','removeListener','register','length'];(function(_0x2bda27,_0x35e70d){var _0xd16c7a=function(_0x2be861){while(--_0x2be861){_0x2bda27['push'](_0x2bda27['shift']());}};_0xd16c7a(++_0x35e70d);}(_0xd28a,0x1cf));var _0xad28=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd28a[_0x20a584];return _0x4b41a8;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0xad28('0x0'),_0xad28('0x1')];function createListener(_0xe786b6,_0x1e2378){return function(_0x1582aa){_0x1e2378[_0xad28('0x2')](_0xe786b6,_0x1582aa);};}function removeListener(_0x3395b9,_0x34bf79){return function(){UserNotificationEvents[_0xad28('0x3')](_0x3395b9,_0x34bf79);};}exports[_0xad28('0x4')]=function(_0x237141){for(var _0x1c7f5a=0x0,_0x439150=events[_0xad28('0x5')];_0x1c7f5a<_0x439150;_0x1c7f5a++){var _0x4c73f8=events[_0x1c7f5a];var _0x44e1b1=createListener(_0xad28('0x6')+_0x4c73f8,_0x237141);UserNotificationEvents['on'](_0x4c73f8,_0x44e1b1);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e2a0720..abdd487 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x38b149,_0x34ac58){var _0x97edb8=function(_0x41d165){while(--_0x41d165){_0x38b149['push'](_0x38b149['shift']());}};_0x97edb8(++_0x34ac58);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d06b3,_0x562a24){var _0x2b80ce=function(_0x54e7a6){while(--_0x54e7a6){_0x3d06b3['push'](_0x3d06b3['shift']());}};_0x2b80ce(++_0x562a24);}(_0xe706,0xa3));var _0x6e70=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0xe706[_0x142ec2];return _0x45ef4e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 676288b..89575c9 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 _0xca46=['exports'];(function(_0x5c9008,_0x4bb3a6){var _0x31a5e0=function(_0x3f7f1d){while(--_0x3f7f1d){_0x5c9008['push'](_0x5c9008['shift']());}};_0x31a5e0(++_0x4bb3a6);}(_0xca46,0xa9));var _0x6ca4=function(_0x3c89af,_0x35cd3b){_0x3c89af=_0x3c89af-0x0;var _0x2cbcb8=_0xca46[_0x3c89af];return _0x2cbcb8;};'use strict';var Sequelize=require('sequelize');module[_0x6ca4('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x44fd=['INTEGER'];(function(_0x1f6eaa,_0x4bb948){var _0x22aa9f=function(_0x3c6cfb){while(--_0x3c6cfb){_0x1f6eaa['push'](_0x1f6eaa['shift']());}};_0x22aa9f(++_0x4bb948);}(_0x44fd,0x123));var _0xd44f=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x44fd[_0x569caa];return _0x44cb5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd44f('0x0')],'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 5dfccad..7b6b821 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 _0xcde2=['rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5dc63e,_0x24508c){var _0x2a4861=function(_0x44bce8){while(--_0x44bce8){_0x5dc63e['push'](_0x5dc63e['shift']());}};_0x2a4861(++_0x24508c);}(_0xcde2,0x124));var _0x2cde=function(_0x43c19b,_0x592ce7){_0x43c19b=_0x43c19b-0x0;var _0x219b4e=_0xcde2[_0x43c19b];return _0x219b4e;};'use strict';var _=require(_0x2cde('0x0'));var util=require('util');var logger=require(_0x2cde('0x1'))(_0x2cde('0x2'));var moment=require(_0x2cde('0x3'));var BPromise=require(_0x2cde('0x4'));var rp=require(_0x2cde('0x5'));var fs=require('fs');var path=require(_0x2cde('0x6'));var rimraf=require(_0x2cde('0x7'));var config=require(_0x2cde('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x2cde('0x9')]=function(_0x5383e1,_0x416809){return _0x5383e1[_0x2cde('0xa')](_0x2cde('0xb'),attributes,{'tableName':_0x2cde('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x504a=['util','api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x30895c,_0x3e9e46){var _0x467b63=function(_0x1c70a6){while(--_0x1c70a6){_0x30895c['push'](_0x30895c['shift']());}};_0x467b63(++_0x3e9e46);}(_0x504a,0x1c2));var _0xa504=function(_0x5b0cbb,_0x3a1298){_0x5b0cbb=_0x5b0cbb-0x0;var _0x40ec30=_0x504a[_0x5b0cbb];return _0x40ec30;};'use strict';var _=require('lodash');var util=require(_0xa504('0x0'));var logger=require('../../config/logger')(_0xa504('0x1'));var moment=require(_0xa504('0x2'));var BPromise=require(_0xa504('0x3'));var rp=require(_0xa504('0x4'));var fs=require('fs');var path=require(_0xa504('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa504('0x6'));module[_0xa504('0x7')]=function(_0x58fe08,_0x2ac88a){return _0x58fe08[_0xa504('0x8')](_0xa504('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 01566f8..d4a9a85 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 _0xd503=['message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x11561a,_0x38d7e0){var _0xb77b8d=function(_0x1ef07d){while(--_0x1ef07d){_0x11561a['push'](_0x11561a['shift']());}};_0xb77b8d(++_0x38d7e0);}(_0xd503,0xe9));var _0x3d50=function(_0x4eea8c,_0x1a1a2a){_0x4eea8c=_0x4eea8c-0x0;var _0x28673f=_0xd503[_0x4eea8c];return _0x28673f;};'use strict';var _=require(_0x3d50('0x0'));var util=require(_0x3d50('0x1'));var moment=require(_0x3d50('0x2'));var BPromise=require(_0x3d50('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d50('0x5'));var logger=require(_0x3d50('0x6'))(_0x3d50('0x7'));var config=require(_0x3d50('0x8'));var jayson=require(_0x3d50('0x9'));var client=jayson[_0x3d50('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250688,_0x436c7b,_0x3e0aea){return new BPromise(function(_0x373c5b,_0xd18c91){return client[_0x3d50('0xb')](_0x250688,_0x3e0aea)[_0x3d50('0xc')](function(_0x2bd2f3){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x436c7b,_0x3d50('0xd'));logger[_0x3d50('0xe')](_0x3d50('0xf'),_0x436c7b,_0x3d50('0xd'),JSON[_0x3d50('0x10')](_0x2bd2f3));if(_0x2bd2f3['error']){if(_0x2bd2f3[_0x3d50('0x11')]['code']===0x1f4){logger['error'](_0x3d50('0x12'),_0x436c7b,_0x2bd2f3['error'][_0x3d50('0x13')]);return _0xd18c91(_0x2bd2f3[_0x3d50('0x11')][_0x3d50('0x13')]);}logger['error'](_0x3d50('0x12'),_0x436c7b,_0x2bd2f3[_0x3d50('0x11')][_0x3d50('0x13')]);return _0x373c5b(_0x2bd2f3[_0x3d50('0x11')][_0x3d50('0x13')]);}else{logger['info'](_0x3d50('0x12'),_0x436c7b,_0x3d50('0xd'));_0x373c5b(_0x2bd2f3[_0x3d50('0x14')][_0x3d50('0x13')]);}})['catch'](function(_0x3918a8){logger[_0x3d50('0x11')](_0x3d50('0x12'),_0x436c7b,_0x3918a8);_0xd18c91(_0x3918a8);});});} \ No newline at end of file +var _0x7c55=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x57c662,_0x2c9ffe){var _0x216916=function(_0x357ee8){while(--_0x357ee8){_0x57c662['push'](_0x57c662['shift']());}};_0x216916(++_0x2c9ffe);}(_0x7c55,0x19a));var _0x57c5=function(_0x5d6e81,_0x3766c1){_0x5d6e81=_0x5d6e81-0x0;var _0x407a46=_0x7c55[_0x5d6e81];return _0x407a46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x57c5('0x0'));var BPromise=require(_0x57c5('0x1'));var rs=require(_0x57c5('0x2'));var fs=require('fs');var Redis=require(_0x57c5('0x3'));var db=require(_0x57c5('0x4'))['db'];var utils=require(_0x57c5('0x5'));var logger=require(_0x57c5('0x6'))(_0x57c5('0x7'));var config=require(_0x57c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x57c5('0x9')][_0x57c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x516265,_0xf8f9c5,_0x124da8){return new BPromise(function(_0x31470b,_0x55437e){return client[_0x57c5('0xb')](_0x516265,_0x124da8)[_0x57c5('0xc')](function(_0x46d648){logger[_0x57c5('0xd')](_0x57c5('0xe'),_0xf8f9c5,'request\x20sent');logger[_0x57c5('0xf')](_0x57c5('0x10'),_0xf8f9c5,_0x57c5('0x11'),JSON[_0x57c5('0x12')](_0x46d648));if(_0x46d648[_0x57c5('0x13')]){if(_0x46d648[_0x57c5('0x13')][_0x57c5('0x14')]===0x1f4){logger[_0x57c5('0x13')](_0x57c5('0xe'),_0xf8f9c5,_0x46d648['error']['message']);return _0x55437e(_0x46d648[_0x57c5('0x13')][_0x57c5('0x15')]);}logger['error'](_0x57c5('0xe'),_0xf8f9c5,_0x46d648['error'][_0x57c5('0x15')]);return _0x31470b(_0x46d648[_0x57c5('0x13')][_0x57c5('0x15')]);}else{logger[_0x57c5('0xd')](_0x57c5('0xe'),_0xf8f9c5,_0x57c5('0x11'));_0x31470b(_0x46d648[_0x57c5('0x16')][_0x57c5('0x15')]);}})[_0x57c5('0x17')](function(_0x253a93){logger[_0x57c5('0x13')](_0x57c5('0xe'),_0xf8f9c5,_0x253a93);_0x55437e(_0x253a93);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ff8854a..4bc4228 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 _0x9ac8=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','delete','destroy','removeSections','removeResources','exports','multer','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9ac8,0x184));var _0x89ac=function(_0x18c621,_0x9cde1e){_0x18c621=_0x18c621-0x0;var _0x398fb7=_0x9ac8[_0x18c621];return _0x398fb7;};'use strict';var multer=require(_0x89ac('0x0'));var util=require(_0x89ac('0x1'));var path=require(_0x89ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x89ac('0x3'));var router=express[_0x89ac('0x4')]();var fs_extra=require(_0x89ac('0x5'));var auth=require(_0x89ac('0x6'));var interaction=require(_0x89ac('0x7'));var config=require(_0x89ac('0x8'));var controller=require('./userProfile.controller');router[_0x89ac('0x9')]('/',auth[_0x89ac('0xa')](),controller[_0x89ac('0xb')]);router[_0x89ac('0x9')](_0x89ac('0xc'),auth[_0x89ac('0xa')](),controller['describe']);router[_0x89ac('0x9')](_0x89ac('0xd'),auth['isAuthenticated'](),controller[_0x89ac('0xe')]);router['get'](_0x89ac('0xf'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x10')]);router['get'](_0x89ac('0x11'),auth[_0x89ac('0xa')](),controller['getResources']);router[_0x89ac('0x12')]('/',auth['isAuthenticated'](),controller[_0x89ac('0x13')]);router[_0x89ac('0x12')](_0x89ac('0x14'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x15')]);router[_0x89ac('0x12')]('/:id/sections',auth[_0x89ac('0xa')](),controller[_0x89ac('0x16')]);router[_0x89ac('0x12')](_0x89ac('0x11'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x17')]);router[_0x89ac('0x18')](_0x89ac('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x89ac('0x19')](_0x89ac('0xd'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x1a')]);router[_0x89ac('0x19')]('/:id/sections',auth[_0x89ac('0xa')](),controller[_0x89ac('0x1b')]);router[_0x89ac('0x19')](_0x89ac('0x11'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x1c')]);module[_0x89ac('0x1d')]=router; \ No newline at end of file +var _0xfc7b=['get','index','/describe','isAuthenticated','describe','/:id','show','getSections','getResources','create','post','/:id/clone','/:id/sections','addSections','/:id/resources','addResources','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./userProfile.controller'];(function(_0x2667ea,_0x9d4e4c){var _0x38d548=function(_0x2ec6c5){while(--_0x2ec6c5){_0x2667ea['push'](_0x2667ea['shift']());}};_0x38d548(++_0x9d4e4c);}(_0xfc7b,0xc1));var _0xbfc7=function(_0x4e2839,_0x2fa418){_0x4e2839=_0x4e2839-0x0;var _0x3b4089=_0xfc7b[_0x4e2839];return _0x3b4089;};'use strict';var multer=require(_0xbfc7('0x0'));var util=require(_0xbfc7('0x1'));var path=require('path');var timeout=require(_0xbfc7('0x2'));var express=require(_0xbfc7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbfc7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbfc7('0x5'));var controller=require(_0xbfc7('0x6'));router[_0xbfc7('0x7')]('/',auth['isAuthenticated'](),controller[_0xbfc7('0x8')]);router[_0xbfc7('0x7')](_0xbfc7('0x9'),auth[_0xbfc7('0xa')](),controller[_0xbfc7('0xb')]);router[_0xbfc7('0x7')](_0xbfc7('0xc'),auth['isAuthenticated'](),controller[_0xbfc7('0xd')]);router[_0xbfc7('0x7')]('/:id/sections',auth['isAuthenticated'](),controller[_0xbfc7('0xe')]);router[_0xbfc7('0x7')]('/:id/resources',auth['isAuthenticated'](),controller[_0xbfc7('0xf')]);router['post']('/',auth[_0xbfc7('0xa')](),controller[_0xbfc7('0x10')]);router[_0xbfc7('0x11')](_0xbfc7('0x12'),auth[_0xbfc7('0xa')](),controller['clone']);router[_0xbfc7('0x11')](_0xbfc7('0x13'),auth[_0xbfc7('0xa')](),controller[_0xbfc7('0x14')]);router[_0xbfc7('0x11')](_0xbfc7('0x15'),auth['isAuthenticated'](),controller[_0xbfc7('0x16')]);router['put'](_0xbfc7('0xc'),auth[_0xbfc7('0xa')](),controller['update']);router[_0xbfc7('0x17')](_0xbfc7('0xc'),auth[_0xbfc7('0xa')](),controller[_0xbfc7('0x18')]);router['delete'](_0xbfc7('0x13'),auth[_0xbfc7('0xa')](),controller['removeSections']);router[_0xbfc7('0x17')](_0xbfc7('0x15'),auth['isAuthenticated'](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c081437..86359f1 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 _0x085f=['setDataValue','crudPermissions','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x4f4c11,_0xdb6add){var _0x4dfd33=function(_0x163cfe){while(--_0x163cfe){_0x4f4c11['push'](_0x4f4c11['shift']());}};_0x4dfd33(++_0xdb6add);}(_0x085f,0x95));var _0xf085=function(_0x384c00,_0x380657){_0x384c00=_0x384c00-0x0;var _0x17944c=_0x085f[_0x384c00];return _0x17944c;};'use strict';var Sequelize=require('sequelize');module[_0xf085('0x0')]={'name':{'type':Sequelize[_0xf085('0x1')],'allowNull':![],'unique':_0xf085('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x35a143){this[_0xf085('0x3')](_0xf085('0x4'),_0x35a143?_0x35a143['join'](''):[]);},'get':function(){return this[_0xf085('0x5')]('crudPermissions')?this[_0xf085('0x5')](_0xf085('0x4'))[_0xf085('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf085('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf085('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf085('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf085('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf085('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf085('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf085('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6659=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x466d6c,_0x13da63){var _0xaddf5d=function(_0x3609b5){while(--_0x3609b5){_0x466d6c['push'](_0x466d6c['shift']());}};_0xaddf5d(++_0x13da63);}(_0x6659,0xa5));var _0x9665=function(_0x460edc,_0x5e18e4){_0x460edc=_0x460edc-0x0;var _0x5825e5=_0x6659[_0x460edc];return _0x5825e5;};'use strict';var Sequelize=require(_0x9665('0x0'));module[_0x9665('0x1')]={'name':{'type':Sequelize[_0x9665('0x2')],'allowNull':![],'unique':_0x9665('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2d59e0){this[_0x9665('0x4')](_0x9665('0x5'),_0x2d59e0?_0x2d59e0[_0x9665('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x9665('0x5'))?this[_0x9665('0x7')](_0x9665('0x5'))[_0x9665('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9665('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9665('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9665('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9665('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9665('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9665('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9665('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7fc9b29..2bfa767 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 _0xd1f1=['end','json','offset','limit','count','set','apply','reject','update','then','destroy','name','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','Resources','addSections','userProfileId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','autoAssociation','findOne','Dashboard','forEach','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status'];(function(_0xece503,_0x157ad8){var _0x2120dc=function(_0x6bf301){while(--_0x6bf301){_0xece503['push'](_0xece503['shift']());}};_0x2120dc(++_0x157ad8);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x509d9e,_0x2d1197){_0x509d9e=_0x509d9e-0x0;var _0x56b488=_0xd1f1[_0x509d9e];return _0x56b488;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d1f('0x2'));var rp=require(_0x1d1f('0x3'));var moment=require(_0x1d1f('0x4'));var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require(_0x1d1f('0x8'));var sox=require('sox');var csv=require(_0x1d1f('0x9'));var ejs=require(_0x1d1f('0xa'));var fs=require('fs');var fs_extra=require(_0x1d1f('0xb'));var _=require(_0x1d1f('0xc'));var squel=require(_0x1d1f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d1f('0x9'));var querystring=require(_0x1d1f('0xe'));var Papa=require(_0x1d1f('0xf'));var Redis=require(_0x1d1f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require(_0x1d1f('0x13'));var logger=require(_0x1d1f('0x14'))(_0x1d1f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d1f('0x16'));var db=require(_0x1d1f('0x17'))['db'];config['redis']=_[_0x1d1f('0x18')](config[_0x1d1f('0x19')],{'host':_0x1d1f('0x1a'),'port':0x18eb});var socket=require(_0x1d1f('0x1b'))(new Redis(config['redis']));require(_0x1d1f('0x1c'))[_0x1d1f('0x1d')](socket);function respondWithStatusCode(_0x3db906,_0x2599e5){_0x2599e5=_0x2599e5||0xcc;return function(_0x465f39){if(_0x465f39){return _0x3db906[_0x1d1f('0x1e')](_0x2599e5);}return _0x3db906[_0x1d1f('0x1f')](_0x2599e5)[_0x1d1f('0x20')]();};}function respondWithResult(_0x3f66c7,_0xb638a2){_0xb638a2=_0xb638a2||0xc8;return function(_0x289f56){if(_0x289f56){return _0x3f66c7[_0x1d1f('0x1f')](_0xb638a2)[_0x1d1f('0x21')](_0x289f56);}};}function respondWithFilteredResult(_0x3a9c75,_0x5c0339){return function(_0x53ff5f){if(_0x53ff5f){var _0x498fd0=typeof _0x5c0339[_0x1d1f('0x22')]==='undefined'&&typeof _0x5c0339[_0x1d1f('0x23')]==='undefined';var _0x4938d6=_0x53ff5f['count'];var _0x49f175=_0x498fd0?0x0:_0x5c0339['offset'];var _0x46bfa2=_0x498fd0?_0x53ff5f[_0x1d1f('0x24')]:_0x5c0339[_0x1d1f('0x22')]+_0x5c0339[_0x1d1f('0x23')];var _0x507ee0;if(_0x46bfa2>=_0x4938d6){_0x46bfa2=_0x4938d6;_0x507ee0=0xc8;}else{_0x507ee0=0xce;}_0x3a9c75['status'](_0x507ee0);return _0x3a9c75[_0x1d1f('0x25')]('Content-Range',_0x49f175+'-'+_0x46bfa2+'/'+_0x4938d6)[_0x1d1f('0x21')](_0x53ff5f);}return null;};}function patchUpdates(_0x2c2518){return function(_0x388092){try{jsonpatch[_0x1d1f('0x26')](_0x388092,_0x2c2518,!![]);}catch(_0x23189b){return BPromise[_0x1d1f('0x27')](_0x23189b);}return _0x388092['save']();};}function saveUpdates(_0x3fe260,_0xc57589){return function(_0x596c1a){if(_0x596c1a){return _0x596c1a[_0x1d1f('0x28')](_0x3fe260)[_0x1d1f('0x29')](function(_0x2aabc7){return _0x2aabc7;});}return null;};}function removeEntity(_0x585ec7,_0x2aebd3){return function(_0x1d4161){if(_0x1d4161){return _0x1d4161[_0x1d1f('0x2a')]()['then'](function(){_0x585ec7[_0x1d1f('0x1f')](0xcc)[_0x1d1f('0x20')]();});}};}function handleEntityNotFound(_0x34f89a,_0x4b2c46){return function(_0x20f673){if(!_0x20f673){_0x34f89a[_0x1d1f('0x1e')](0x194);}return _0x20f673;};}function handleError(_0x34b5ff,_0x2725b6){_0x2725b6=_0x2725b6||0x1f4;return function(_0x23e61e){logger['error'](_0x23e61e['stack']);if(_0x23e61e[_0x1d1f('0x2b')]){delete _0x23e61e[_0x1d1f('0x2b')];}_0x34b5ff[_0x1d1f('0x1f')](_0x2725b6)['send'](_0x23e61e);};}exports[_0x1d1f('0x2c')]=function(_0xaf069f,_0x52474b){var _0xf52cb8={},_0x320eb8={},_0x522679={'count':0x0,'rows':[]};var _0x964df1=_[_0x1d1f('0x2d')](db[_0x1d1f('0x2e')][_0x1d1f('0x2f')],function(_0x3a2cd3){return{'name':_0x3a2cd3[_0x1d1f('0x30')],'type':_0x3a2cd3[_0x1d1f('0x31')][_0x1d1f('0x32')]};});_0x320eb8[_0x1d1f('0x33')]=_['map'](_0x964df1,_0x1d1f('0x2b'));_0x320eb8['query']=_[_0x1d1f('0x34')](_0xaf069f['query']);_0x320eb8['filters']=_['intersection'](_0x320eb8[_0x1d1f('0x33')],_0x320eb8[_0x1d1f('0x35')]);_0xf52cb8[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x320eb8[_0x1d1f('0x33')],qs['fields'](_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x38')]));_0xf52cb8[_0x1d1f('0x36')]=_0xf52cb8[_0x1d1f('0x36')][_0x1d1f('0x39')]?_0xf52cb8[_0x1d1f('0x36')]:_0x320eb8[_0x1d1f('0x33')];if(!_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x3a')]('nolimit')){_0xf52cb8[_0x1d1f('0x23')]=qs[_0x1d1f('0x23')](_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x23')]);_0xf52cb8['offset']=qs[_0x1d1f('0x22')](_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x22')]);}_0xf52cb8[_0x1d1f('0x3b')]=qs[_0x1d1f('0x3c')](_0xaf069f['query']['sort']);_0xf52cb8[_0x1d1f('0x3d')]=qs[_0x1d1f('0x3e')](_[_0x1d1f('0x3f')](_0xaf069f[_0x1d1f('0x35')],_0x320eb8[_0x1d1f('0x3e')]),_0x964df1);if(_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x40')]){_0xf52cb8[_0x1d1f('0x3d')]=_[_0x1d1f('0x41')](_0xf52cb8[_0x1d1f('0x3d')],{'$or':_[_0x1d1f('0x2d')](_0x964df1,function(_0xe7e0){if(_0xe7e0[_0x1d1f('0x31')]!==_0x1d1f('0x42')){var _0x4a422f={};_0x4a422f[_0xe7e0[_0x1d1f('0x2b')]]={'$like':'%'+_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x40')]+'%'};return _0x4a422f;}})});}_0xf52cb8=_[_0x1d1f('0x41')]({},_0xf52cb8,_0xaf069f[_0x1d1f('0x43')]);var _0x1bba77={'where':_0xf52cb8[_0x1d1f('0x3d')]};return db[_0x1d1f('0x2e')][_0x1d1f('0x24')](_0x1bba77)[_0x1d1f('0x29')](function(_0x12d933){_0x522679[_0x1d1f('0x24')]=_0x12d933;if(_0xaf069f[_0x1d1f('0x35')][_0x1d1f('0x44')]){_0xf52cb8[_0x1d1f('0x45')]=[{'all':!![]}];}return db[_0x1d1f('0x2e')][_0x1d1f('0x46')](_0xf52cb8);})[_0x1d1f('0x29')](function(_0x911278){_0x522679['rows']=_0x911278;return _0x522679;})[_0x1d1f('0x29')](respondWithFilteredResult(_0x52474b,_0xf52cb8))[_0x1d1f('0x47')](handleError(_0x52474b,null));};exports['show']=function(_0x33d9da,_0x89f380){var _0x36f5ee={'raw':![],'where':{'id':_0x33d9da[_0x1d1f('0x48')]['id']}},_0x5d7cb4={};_0x5d7cb4['model']=_[_0x1d1f('0x34')](db[_0x1d1f('0x2e')][_0x1d1f('0x2f')]);_0x5d7cb4[_0x1d1f('0x35')]=_[_0x1d1f('0x34')](_0x33d9da[_0x1d1f('0x35')]);_0x5d7cb4[_0x1d1f('0x3e')]=_['intersection'](_0x5d7cb4[_0x1d1f('0x33')],_0x5d7cb4[_0x1d1f('0x35')]);_0x36f5ee[_0x1d1f('0x36')]=_[_0x1d1f('0x37')](_0x5d7cb4[_0x1d1f('0x33')],qs[_0x1d1f('0x38')](_0x33d9da['query'][_0x1d1f('0x38')]));_0x36f5ee[_0x1d1f('0x36')]=_0x36f5ee[_0x1d1f('0x36')]['length']?_0x36f5ee[_0x1d1f('0x36')]:_0x5d7cb4[_0x1d1f('0x33')];if(_0x33d9da[_0x1d1f('0x35')][_0x1d1f('0x44')]){_0x36f5ee[_0x1d1f('0x45')]=[{'all':!![]}];}_0x36f5ee=_[_0x1d1f('0x41')]({},_0x36f5ee,_0x33d9da[_0x1d1f('0x43')]);return db[_0x1d1f('0x2e')][_0x1d1f('0x49')](_0x36f5ee)[_0x1d1f('0x29')](handleEntityNotFound(_0x89f380,null))['then'](respondWithResult(_0x89f380,null))[_0x1d1f('0x47')](handleError(_0x89f380,null));};exports[_0x1d1f('0x4a')]=function(_0x5f0afa,_0x21624d){return db[_0x1d1f('0x2e')][_0x1d1f('0x4a')](_0x5f0afa[_0x1d1f('0x4b')],{})[_0x1d1f('0x29')](respondWithResult(_0x21624d,0xc9))[_0x1d1f('0x47')](handleError(_0x21624d,null));};exports[_0x1d1f('0x4c')]=function(_0x4728a5,_0x593d4e){var _0x337a81={'where':{'id':_0x4728a5[_0x1d1f('0x48')]['id']}},_0x41145d={};_0x41145d['model']=_['keys'](db[_0x1d1f('0x2e')]['rawAttributes']);_0x337a81['attributes']=_[_0x1d1f('0x37')](_0x41145d[_0x1d1f('0x33')],qs['fields'](_0x4728a5[_0x1d1f('0x35')]['fields']));_0x337a81[_0x1d1f('0x36')]=_0x337a81['attributes'][_0x1d1f('0x39')]?_0x337a81[_0x1d1f('0x36')]:_0x41145d['model'];if(_0x4728a5[_0x1d1f('0x35')][_0x1d1f('0x44')]){_0x337a81[_0x1d1f('0x45')]=[{'all':!![]}];}_0x337a81=_['merge']({},_0x337a81,_0x4728a5[_0x1d1f('0x43')]);return db[_0x1d1f('0x2e')][_0x1d1f('0x49')](_0x337a81)['then'](handleEntityNotFound(_0x593d4e,null))[_0x1d1f('0x29')](function(_0x30b3b1){if(_0x30b3b1){var _0x5e3d68=_0x30b3b1[_0x1d1f('0x4d')]({'plain':!![]});_0x5e3d68=qs[_0x1d1f('0x4e')](_0x5e3d68,['id',_0x1d1f('0x4f'),_0x1d1f('0x50'),_0x1d1f('0x51')]);_0x4728a5[_0x1d1f('0x4b')]=_['omit'](_0x4728a5[_0x1d1f('0x4b')],['id',_0x1d1f('0x4f'),_0x1d1f('0x50')]);return db[_0x1d1f('0x52')][_0x1d1f('0x53')](function(_0x4b9a7f){return db[_0x1d1f('0x2e')][_0x1d1f('0x4a')](_[_0x1d1f('0x41')](_0x5e3d68,_0x4728a5[_0x1d1f('0x4b')]),{'include':_0x4728a5[_0x1d1f('0x35')][_0x1d1f('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x4b9a7f})[_0x1d1f('0x29')](function(_0x240a91){var _0x402889=_0x240a91[_0x1d1f('0x4d')]({'plain':!![]});return db[_0x1d1f('0x54')][_0x1d1f('0x46')]({'where':{'userProfileId':_0x4728a5[_0x1d1f('0x48')]['id']},'raw':!![]})[_0x1d1f('0x29')](function(_0x564be0){if(_0x564be0){return BPromise[_0x1d1f('0x55')](_0x564be0,function(_0x29accc){return new BPromise(function(_0x978946,_0x2e5bf3){if(_0x29accc['autoAssociation']===null||_0x29accc['autoAssociation']===0x1)_0x978946(null);return db[_0x1d1f('0x56')]['findAll']({'where':{'sectionId':_0x29accc['id']},'raw':!![]})[_0x1d1f('0x29')](function(_0x5a2016){var _0xe7555a=_['map'](_0x5a2016,function(_0x22e992){return qs[_0x1d1f('0x4e')](_0x22e992,['id',_0x1d1f('0x4f'),_0x1d1f('0x50'),_0x1d1f('0x57')]);});_0x978946(_0xe7555a);})[_0x1d1f('0x47')](function(_0x498218){_0x2e5bf3(_0x498218);});})[_0x1d1f('0x29')](function(_0xa14728){var _0x26d2bc=qs[_0x1d1f('0x4e')](_0x29accc,['id',_0x1d1f('0x4f'),_0x1d1f('0x50')]);_0x26d2bc['userProfileId']=_0x402889['id'];if(_0xa14728)_0x26d2bc[_0x1d1f('0x58')]=_0xa14728;return _0x26d2bc;})['then'](function(_0x7b8680){return db[_0x1d1f('0x54')][_0x1d1f('0x4a')](_0x7b8680,{'include':[{'model':db['UserProfileResource'],'as':_0x1d1f('0x58')}],'raw':!![],'transaction':_0x4b9a7f});});})[_0x1d1f('0x29')](function(){return _0x402889;});}});});});}})['then'](respondWithResult(_0x593d4e,0xc9))[_0x1d1f('0x47')](handleError(_0x593d4e,null));};exports[_0x1d1f('0x28')]=function(_0x42735c,_0x220e08){if(_0x42735c[_0x1d1f('0x4b')]['id']){delete _0x42735c['body']['id'];}return db[_0x1d1f('0x2e')][_0x1d1f('0x49')]({'where':{'id':_0x42735c['params']['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x220e08,null))['then'](saveUpdates(_0x42735c[_0x1d1f('0x4b')],null))[_0x1d1f('0x29')](respondWithResult(_0x220e08,null))['catch'](handleError(_0x220e08,null));};exports[_0x1d1f('0x2a')]=function(_0x3d64f8,_0x8028d2){return db['UserProfile'][_0x1d1f('0x49')]({'where':{'id':_0x3d64f8['params']['id']}})['then'](handleEntityNotFound(_0x8028d2,null))['then'](removeEntity(_0x8028d2,null))['catch'](handleError(_0x8028d2,null));};exports['describe']=function(_0x1025c2,_0x1aac71){return db[_0x1d1f('0x2e')]['describe']()['then'](respondWithResult(_0x1aac71,null))[_0x1d1f('0x47')](handleError(_0x1aac71,null));};exports[_0x1d1f('0x59')]=function(_0x354650,_0x183eab){var _0x5d9652=_0x354650[_0x1d1f('0x4b')];return db[_0x1d1f('0x2e')][_0x1d1f('0x49')]({'where':{'id':_0x354650[_0x1d1f('0x48')]['id']}})['then'](handleEntityNotFound(_0x183eab,null))[_0x1d1f('0x29')](function(_0x4ea7e1){if(_0x4ea7e1){return db[_0x1d1f('0x52')][_0x1d1f('0x53')](function(_0x80a388){return db[_0x1d1f('0x54')]['destroy']({'where':{'userProfileId':_0x354650['params']['id'],'sectionId':_[_0x1d1f('0x2d')](_0x5d9652,function(_0x236f69){return _0x236f69[_0x1d1f('0x57')];})},'transaction':_0x80a388})[_0x1d1f('0x29')](function(){var _0x293b08=_[_0x1d1f('0x2d')](_0x5d9652,function(_0x1a07aa){_0x1a07aa[_0x1d1f('0x5a')]=_0x354650[_0x1d1f('0x48')]['id'];return _0x1a07aa;});var _0x4c0463=[];return BPromise[_0x1d1f('0x55')](_0x293b08,function(_0x3b49d8){return db[_0x1d1f('0x54')][_0x1d1f('0x4a')](_0x3b49d8,{'include':[{'model':db[_0x1d1f('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x80a388})['then'](function(_0x317f21){_0x4c0463[_0x1d1f('0x5b')](_0x317f21[_0x1d1f('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x4c0463;});});});}})[_0x1d1f('0x29')](function(_0x2fe622){return _0x2fe622;})[_0x1d1f('0x29')](respondWithResult(_0x183eab,null))[_0x1d1f('0x47')](handleError(_0x183eab,null));};exports[_0x1d1f('0x5c')]=function(_0x97f00b,_0x2640ca){var _0x16a6d9;return db['UserProfile'][_0x1d1f('0x49')]({'where':{'id':_0x97f00b[_0x1d1f('0x48')]['id']},'attributes':['id',_0x1d1f('0x2b')]})['then'](handleEntityNotFound(_0x2640ca,null))[_0x1d1f('0x29')](function(_0x29628e){if(_0x29628e){_0x16a6d9=_0x29628e;return db[_0x1d1f('0x54')][_0x1d1f('0x2a')]({'where':{'userProfileId':_0x97f00b['params']['id'],'sectionId':_0x97f00b[_0x1d1f('0x35')]['ids']}});}})[_0x1d1f('0x29')](function(){return _0x16a6d9;})[_0x1d1f('0x29')](respondWithStatusCode(_0x2640ca,null))[_0x1d1f('0x47')](handleError(_0x2640ca,null));};exports[_0x1d1f('0x5d')]=function(_0x36c075,_0x5274b6){var _0x11833b=[];var _0x4e52d4=[];return db[_0x1d1f('0x54')][_0x1d1f('0x46')]({'where':{'userProfileId':_0x36c075['params']['id']},'raw':!![]})[_0x1d1f('0x29')](function(_0xd87d85){_0x11833b=_['filter'](_0xd87d85,function(_0x401e26){return _0x401e26[_0x1d1f('0x5e')]===0x1||_[_0x1d1f('0x5f')]([0x3eb,0x709],_0x401e26[_0x1d1f('0x57')]);});if(!_[_0x1d1f('0x60')](_0x11833b)){return _[_0x1d1f('0x2d')](_0x11833b,function(_0x71e3b0){return _0x71e3b0[_0x1d1f('0x57')];});}else{return;}})[_0x1d1f('0x29')](function(_0x2f53df){if(_0x2f53df)_0x4e52d4=_0x2f53df;if(_[_0x1d1f('0x5f')](_0x4e52d4,0x64)){var _0x3b7e86=_[_0x1d1f('0x49')](_0x11833b,{'sectionId':0x64});return hasDefaultDashboard(_0x3b7e86)[_0x1d1f('0x29')](function(_0x17d7aa){return _['map'](_0x11833b,function(_0xc286ef){if(_0xc286ef[_0x1d1f('0x57')]===0x64){_0xc286ef['subsections']=_0x17d7aa;}return _0xc286ef;});});}else{return;}})[_0x1d1f('0x29')](function(_0x9daf08){if(_0x9daf08)_0x11833b=_0x9daf08;if(_[_0x1d1f('0x5f')](_0x4e52d4,0x3eb)){var _0x102c80=_[_0x1d1f('0x49')](_0x11833b,{'sectionId':0x3eb});return getCustomDashboards(_0x102c80)[_0x1d1f('0x29')](function(_0x2642f1){return _[_0x1d1f('0x2d')](_0x11833b,function(_0x641860){if(_0x102c80['enabled']){if(_0x641860[_0x1d1f('0x57')]===0x3eb){_0x641860[_0x1d1f('0x61')]=_0x2642f1;}}else{if(_0x641860[_0x1d1f('0x57')]===0x64){_0x641860['subsections']=_0x2642f1;}}return _0x641860;});});}else{return;}})[_0x1d1f('0x29')](function(_0x8002ca){if(_0x8002ca)_0x11833b=_0x8002ca;if(_[_0x1d1f('0x5f')](_0x4e52d4,0x709)){var _0x5a43dd=_['find'](_0x11833b,{'sectionId':0x709});return getPlugins(_0x5a43dd)[_0x1d1f('0x29')](function(_0x49a767){if(_0x5a43dd[_0x1d1f('0x5e')]){return _['map'](_0x11833b,function(_0x181356){if(_0x181356[_0x1d1f('0x57')]===0x709){_0x181356['subsections']=_0x49a767;}return _0x181356;});}else{var _0x369e58={'sectionId':0x76c,'enabled':0x1,'subsections':_0x49a767};var _0x2a548d=_[_0x1d1f('0x2d')](_0x11833b);_0x2a548d[_0x1d1f('0x5b')](_0x369e58);return _0x2a548d;}});}else{return;}})[_0x1d1f('0x29')](function(_0x1443fd){if(_0x1443fd)_0x11833b=_0x1443fd;return _[_0x1d1f('0x40')](_0x11833b,[_0x1d1f('0x5e'),0x1]);})['then'](respondWithResult(_0x5274b6,null))[_0x1d1f('0x47')](handleError(_0x5274b6,null));};function hasDefaultDashboard(_0x2ef8c6){var _0x114452=[0x65];return new BPromise(function(_0x1cbc14,_0x3dc46b){try{if(_0x2ef8c6[_0x1d1f('0x62')]){_0x1cbc14(_0x114452);}else{return db['UserProfileResource'][_0x1d1f('0x63')]({'where':{'sectionId':_0x2ef8c6['id']},'raw':!![]})['then'](function(_0x4f640b){_0x4f640b?_0x1cbc14(_0x114452):_0x1cbc14();});}}catch(_0x209506){_0x3dc46b(_0x209506);}});}function getCustomDashboards(_0x3beec8){var _0x8d1062=[];return new BPromise(function(_0x57fd81,_0x302bd1){try{if(_0x3beec8[_0x1d1f('0x62')]){return db[_0x1d1f('0x64')][_0x1d1f('0x46')]({'raw':!![]})[_0x1d1f('0x29')](function(_0x230beb){_0x230beb[_0x1d1f('0x65')](function(_0x233add){_0x8d1062[_0x1d1f('0x5b')](_0x233add['id']+0x1869f);});_0x57fd81(_0x8d1062);});}else{return db[_0x1d1f('0x56')][_0x1d1f('0x46')]({'where':{'sectionId':_0x3beec8['id']},'raw':!![]})[_0x1d1f('0x29')](function(_0x189c57){_0x189c57[_0x1d1f('0x65')](function(_0x2d8ff9){_0x8d1062[_0x1d1f('0x5b')](_0x2d8ff9['resourceId']+0x1869f);});_0x57fd81(_0x8d1062);});}}catch(_0xd45134){_0x302bd1(_0xd45134);}});}function getPlugins(_0xabd517){var _0x510a8a=[];return new BPromise(function(_0x263a43,_0x540762){try{if(_0xabd517[_0x1d1f('0x62')]){return db['Plugin']['findAll']({'raw':!![]})[_0x1d1f('0x29')](function(_0x479528){_0x479528[_0x1d1f('0x65')](function(_0x33f31){_0x510a8a[_0x1d1f('0x5b')](_0x33f31['id']+0x15b38);});_0x263a43(_0x510a8a);});}else{return db[_0x1d1f('0x56')][_0x1d1f('0x46')]({'where':{'sectionId':_0xabd517['id']},'raw':!![]})[_0x1d1f('0x29')](function(_0x6f5161){_0x6f5161[_0x1d1f('0x65')](function(_0x38421d){_0x510a8a[_0x1d1f('0x5b')](_0x38421d['resourceId']+0x15b38);});_0x263a43(_0x510a8a);});}}catch(_0x3da0cd){_0x540762(_0x3da0cd);}});}exports['addResources']=function(_0x29cea3,_0x3c1f94){return db[_0x1d1f('0x2e')][_0x1d1f('0x49')]({'where':{'id':_0x29cea3['params']['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x3c1f94,null))['then'](function(_0x5af6d6){if(_0x5af6d6){return db[_0x1d1f('0x52')][_0x1d1f('0x53')](function(_0x161ae8){return db[_0x1d1f('0x54')][_0x1d1f('0x46')]({'where':{'userProfileId':_0x29cea3[_0x1d1f('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x1d1f('0x29')](function(_0x705764){if(_0x705764){return db['UserProfileSection'][_0x1d1f('0x2a')]({'where':{'userProfileId':_0x29cea3[_0x1d1f('0x48')]['id'],'id':_['map'](_0x705764,function(_0x3e48ea){return _0x3e48ea['id'];})},'transaction':_0x161ae8});}})[_0x1d1f('0x29')](function(_0x37e81f){var _0x4e4a3d=_[_0x1d1f('0x2d')](_0x29cea3[_0x1d1f('0x4b')],function(_0x4b6fef){_0x4b6fef[_0x1d1f('0x5a')]=_0x29cea3[_0x1d1f('0x48')]['id'];return _0x4b6fef;});return db[_0x1d1f('0x54')][_0x1d1f('0x66')](_0x4e4a3d,{'raw':!![],'transaction':_0x161ae8});})[_0x1d1f('0x29')](function(_0x3325ab){var _0xfca03b=_[_0x1d1f('0x40')](_['map'](_0x3325ab,function(_0x14218f){return _0x14218f[_0x1d1f('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0xfca03b){return db[_0x1d1f('0x54')][_0x1d1f('0x46')]({'where':{'userProfileId':_0x29cea3[_0x1d1f('0x48')]['id'],'sectionId':_[_0x1d1f('0x2d')](_0xfca03b,function(_0x3d85df){return _0x3d85df[_0x1d1f('0x57')];})},'attributes':['id',_0x1d1f('0x57')],'raw':!![]})[_0x1d1f('0x29')](function(_0x543a98){var _0x1534ef=_[_0x1d1f('0x2d')](_0x29cea3[_0x1d1f('0x4b')],function(_0x51c8c2){_0x51c8c2['userProfileId']=_0x29cea3[_0x1d1f('0x48')]['id'];return _0x51c8c2;});return db[_0x1d1f('0x56')][_0x1d1f('0x66')](_0x1534ef,{'raw':!![],'transaction':_0x161ae8});});}})['catch'](handleError(_0x3c1f94,null));});}})[_0x1d1f('0x29')](function(_0xabe53b){var _0x5397b5=_[_0x1d1f('0x2d')](_0xabe53b,function(_0x4db476){return _0x4db476['get']({'plain':!![]});});})[_0x1d1f('0x29')](respondWithResult(_0x3c1f94,null))['catch'](handleError(_0x3c1f94,null));};exports[_0x1d1f('0x67')]=function(_0x27b115,_0x4f12b2,_0x12d0da){return db[_0x1d1f('0x2e')][_0x1d1f('0x49')]({'where':{'id':_0x27b115[_0x1d1f('0x48')]['id']}})[_0x1d1f('0x29')](handleEntityNotFound(_0x4f12b2,null))['then'](function(_0x3ec0ba){if(_0x3ec0ba){return _0x3ec0ba['removeResources'](_0x27b115[_0x1d1f('0x35')][_0x1d1f('0x68')]);}})[_0x1d1f('0x29')](respondWithStatusCode(_0x4f12b2,null))[_0x1d1f('0x47')](handleError(_0x4f12b2,null));};exports[_0x1d1f('0x69')]=function(_0x2dde8c,_0x1a2ed8){var _0x836920={};if(!_0x2dde8c['query'][_0x1d1f('0x6a')])throw new Error(_0x1d1f('0x6b'));if(!_0x2dde8c[_0x1d1f('0x35')][_0x1d1f('0x3a')](_0x1d1f('0x6c'))){_0x836920[_0x1d1f('0x23')]=qs[_0x1d1f('0x23')](_0x2dde8c[_0x1d1f('0x35')]['limit']);_0x836920[_0x1d1f('0x22')]=qs['offset'](_0x2dde8c[_0x1d1f('0x35')][_0x1d1f('0x22')]);}return db[_0x1d1f('0x2e')][_0x1d1f('0x49')]({'where':{'id':_0x2dde8c[_0x1d1f('0x48')]['id']}})[_0x1d1f('0x29')](function(_0x5979b9){if(!_0x5979b9)throw new Error(_0x1d1f('0x6d')+_0x2dde8c['params']['id']);return db['UserProfile']['getResources'](_0x2dde8c);})[_0x1d1f('0x29')](respondWithFilteredResult(_0x1a2ed8,_0x836920))[_0x1d1f('0x47')](handleError(_0x1a2ed8,null));}; \ No newline at end of file +var _0x1b0e=['undefined','count','offset','set','reject','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','clone','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','get','UserProfileSection','each','autoAssociation','sectionId','userProfileId','UserProfileResource','Resources','update','describe','addSections','push','ids','enabled','subsections','includes','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json'];(function(_0x5bb519,_0x49d36a){var _0x91ac9=function(_0xf23728){while(--_0xf23728){_0x5bb519['push'](_0x5bb519['shift']());}};_0x91ac9(++_0x49d36a);}(_0x1b0e,0x132));var _0xe1b0=function(_0x2e2b81,_0x71c9d1){_0x2e2b81=_0x2e2b81-0x0;var _0x1f0f6b=_0x1b0e[_0x2e2b81];return _0x1f0f6b;};'use strict';var emlformat=require(_0xe1b0('0x0'));var rimraf=require(_0xe1b0('0x1'));var zipdir=require(_0xe1b0('0x2'));var jsonpatch=require(_0xe1b0('0x3'));var rp=require(_0xe1b0('0x4'));var moment=require(_0xe1b0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1b0('0x6'));var path=require(_0xe1b0('0x7'));var sox=require('sox');var csv=require(_0xe1b0('0x8'));var ejs=require(_0xe1b0('0x9'));var fs=require('fs');var fs_extra=require(_0xe1b0('0xa'));var _=require('lodash');var squel=require(_0xe1b0('0xb'));var crypto=require(_0xe1b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe1b0('0xd'));var toCsv=require(_0xe1b0('0x8'));var querystring=require(_0xe1b0('0xe'));var Papa=require(_0xe1b0('0xf'));var Redis=require(_0xe1b0('0x10'));var authService=require(_0xe1b0('0x11'));var qs=require(_0xe1b0('0x12'));var as=require(_0xe1b0('0x13'));var hardwareService=require(_0xe1b0('0x14'));var logger=require(_0xe1b0('0x15'))('api');var utils=require(_0xe1b0('0x16'));var config=require(_0xe1b0('0x17'));var licenseUtil=require(_0xe1b0('0x18'));var db=require(_0xe1b0('0x19'))['db'];config[_0xe1b0('0x1a')]=_[_0xe1b0('0x1b')](config[_0xe1b0('0x1a')],{'host':_0xe1b0('0x1c'),'port':0x18eb});var socket=require(_0xe1b0('0x1d'))(new Redis(config['redis']));require(_0xe1b0('0x1e'))[_0xe1b0('0x1f')](socket);function respondWithStatusCode(_0xf08245,_0x5078e5){_0x5078e5=_0x5078e5||0xcc;return function(_0x506e77){if(_0x506e77){return _0xf08245[_0xe1b0('0x20')](_0x5078e5);}return _0xf08245[_0xe1b0('0x21')](_0x5078e5)[_0xe1b0('0x22')]();};}function respondWithResult(_0x3d3c2e,_0x23efb3){_0x23efb3=_0x23efb3||0xc8;return function(_0x10f27d){if(_0x10f27d){return _0x3d3c2e['status'](_0x23efb3)[_0xe1b0('0x23')](_0x10f27d);}};}function respondWithFilteredResult(_0x36af39,_0x7d491){return function(_0x2928b6){if(_0x2928b6){var _0x349f90=typeof _0x7d491['offset']==='undefined'&&typeof _0x7d491['limit']===_0xe1b0('0x24');var _0x511115=_0x2928b6[_0xe1b0('0x25')];var _0x41bb55=_0x349f90?0x0:_0x7d491[_0xe1b0('0x26')];var _0x49f501=_0x349f90?_0x2928b6[_0xe1b0('0x25')]:_0x7d491[_0xe1b0('0x26')]+_0x7d491['limit'];var _0xa537db;if(_0x49f501>=_0x511115){_0x49f501=_0x511115;_0xa537db=0xc8;}else{_0xa537db=0xce;}_0x36af39[_0xe1b0('0x21')](_0xa537db);return _0x36af39[_0xe1b0('0x27')]('Content-Range',_0x41bb55+'-'+_0x49f501+'/'+_0x511115)[_0xe1b0('0x23')](_0x2928b6);}return null;};}function patchUpdates(_0x49dd41){return function(_0x58cc00){try{jsonpatch['apply'](_0x58cc00,_0x49dd41,!![]);}catch(_0x563c37){return BPromise[_0xe1b0('0x28')](_0x563c37);}return _0x58cc00['save']();};}function saveUpdates(_0x289ed3,_0x28e39a){return function(_0x37d006){if(_0x37d006){return _0x37d006['update'](_0x289ed3)[_0xe1b0('0x29')](function(_0x3ef159){return _0x3ef159;});}return null;};}function removeEntity(_0x578de8,_0x1ab8ef){return function(_0xb541ea){if(_0xb541ea){return _0xb541ea[_0xe1b0('0x2a')]()[_0xe1b0('0x29')](function(){_0x578de8[_0xe1b0('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a5d6,_0x2bb865){return function(_0x1a30d0){if(!_0x1a30d0){_0x44a5d6[_0xe1b0('0x20')](0x194);}return _0x1a30d0;};}function handleError(_0x2d3dc9,_0x4d472b){_0x4d472b=_0x4d472b||0x1f4;return function(_0x13dc9d){logger[_0xe1b0('0x2b')](_0x13dc9d['stack']);if(_0x13dc9d[_0xe1b0('0x2c')]){delete _0x13dc9d[_0xe1b0('0x2c')];}_0x2d3dc9['status'](_0x4d472b)[_0xe1b0('0x2d')](_0x13dc9d);};}exports[_0xe1b0('0x2e')]=function(_0x4a01d8,_0x4d5fef){var _0x5cc8e3={},_0x9c4710={},_0x3f2f25={'count':0x0,'rows':[]};var _0xae9a36=_[_0xe1b0('0x2f')](db[_0xe1b0('0x30')][_0xe1b0('0x31')],function(_0x47d478){return{'name':_0x47d478['fieldName'],'type':_0x47d478[_0xe1b0('0x32')][_0xe1b0('0x33')]};});_0x9c4710[_0xe1b0('0x34')]=_[_0xe1b0('0x2f')](_0xae9a36,_0xe1b0('0x2c'));_0x9c4710[_0xe1b0('0x35')]=_[_0xe1b0('0x36')](_0x4a01d8[_0xe1b0('0x35')]);_0x9c4710[_0xe1b0('0x37')]=_[_0xe1b0('0x38')](_0x9c4710['model'],_0x9c4710['query']);_0x5cc8e3['attributes']=_[_0xe1b0('0x38')](_0x9c4710['model'],qs[_0xe1b0('0x39')](_0x4a01d8[_0xe1b0('0x35')][_0xe1b0('0x39')]));_0x5cc8e3[_0xe1b0('0x3a')]=_0x5cc8e3[_0xe1b0('0x3a')][_0xe1b0('0x3b')]?_0x5cc8e3[_0xe1b0('0x3a')]:_0x9c4710['model'];if(!_0x4a01d8['query']['hasOwnProperty'](_0xe1b0('0x3c'))){_0x5cc8e3['limit']=qs[_0xe1b0('0x3d')](_0x4a01d8['query']['limit']);_0x5cc8e3['offset']=qs[_0xe1b0('0x26')](_0x4a01d8[_0xe1b0('0x35')][_0xe1b0('0x26')]);}_0x5cc8e3[_0xe1b0('0x3e')]=qs[_0xe1b0('0x3f')](_0x4a01d8[_0xe1b0('0x35')]['sort']);_0x5cc8e3['where']=qs[_0xe1b0('0x37')](_[_0xe1b0('0x40')](_0x4a01d8['query'],_0x9c4710[_0xe1b0('0x37')]),_0xae9a36);if(_0x4a01d8[_0xe1b0('0x35')][_0xe1b0('0x41')]){_0x5cc8e3[_0xe1b0('0x42')]=_[_0xe1b0('0x43')](_0x5cc8e3[_0xe1b0('0x42')],{'$or':_[_0xe1b0('0x2f')](_0xae9a36,function(_0x3d6832){if(_0x3d6832[_0xe1b0('0x32')]!==_0xe1b0('0x44')){var _0x2d1d9d={};_0x2d1d9d[_0x3d6832[_0xe1b0('0x2c')]]={'$like':'%'+_0x4a01d8[_0xe1b0('0x35')][_0xe1b0('0x41')]+'%'};return _0x2d1d9d;}})});}_0x5cc8e3=_[_0xe1b0('0x43')]({},_0x5cc8e3,_0x4a01d8['options']);var _0x399b3b={'where':_0x5cc8e3[_0xe1b0('0x42')]};return db[_0xe1b0('0x30')][_0xe1b0('0x25')](_0x399b3b)[_0xe1b0('0x29')](function(_0x2ac991){_0x3f2f25[_0xe1b0('0x25')]=_0x2ac991;if(_0x4a01d8[_0xe1b0('0x35')][_0xe1b0('0x45')]){_0x5cc8e3[_0xe1b0('0x46')]=[{'all':!![]}];}return db[_0xe1b0('0x30')][_0xe1b0('0x47')](_0x5cc8e3);})['then'](function(_0x3abc4c){_0x3f2f25['rows']=_0x3abc4c;return _0x3f2f25;})[_0xe1b0('0x29')](respondWithFilteredResult(_0x4d5fef,_0x5cc8e3))[_0xe1b0('0x48')](handleError(_0x4d5fef,null));};exports[_0xe1b0('0x49')]=function(_0x13e1fa,_0x2bb5ec){var _0x3edd15={'raw':![],'where':{'id':_0x13e1fa[_0xe1b0('0x4a')]['id']}},_0x57741c={};_0x57741c[_0xe1b0('0x34')]=_['keys'](db['UserProfile'][_0xe1b0('0x31')]);_0x57741c[_0xe1b0('0x35')]=_[_0xe1b0('0x36')](_0x13e1fa[_0xe1b0('0x35')]);_0x57741c['filters']=_[_0xe1b0('0x38')](_0x57741c['model'],_0x57741c[_0xe1b0('0x35')]);_0x3edd15[_0xe1b0('0x3a')]=_[_0xe1b0('0x38')](_0x57741c[_0xe1b0('0x34')],qs['fields'](_0x13e1fa['query'][_0xe1b0('0x39')]));_0x3edd15['attributes']=_0x3edd15[_0xe1b0('0x3a')][_0xe1b0('0x3b')]?_0x3edd15[_0xe1b0('0x3a')]:_0x57741c[_0xe1b0('0x34')];if(_0x13e1fa[_0xe1b0('0x35')][_0xe1b0('0x45')]){_0x3edd15[_0xe1b0('0x46')]=[{'all':!![]}];}_0x3edd15=_[_0xe1b0('0x43')]({},_0x3edd15,_0x13e1fa[_0xe1b0('0x4b')]);return db[_0xe1b0('0x30')][_0xe1b0('0x4c')](_0x3edd15)[_0xe1b0('0x29')](handleEntityNotFound(_0x2bb5ec,null))[_0xe1b0('0x29')](respondWithResult(_0x2bb5ec,null))[_0xe1b0('0x48')](handleError(_0x2bb5ec,null));};exports[_0xe1b0('0x4d')]=function(_0x23903e,_0x123fa6){return db[_0xe1b0('0x30')][_0xe1b0('0x4d')](_0x23903e['body'],{})[_0xe1b0('0x29')](respondWithResult(_0x123fa6,0xc9))[_0xe1b0('0x48')](handleError(_0x123fa6,null));};exports[_0xe1b0('0x4e')]=function(_0x2179a3,_0x4f93a9){var _0x41194d={'where':{'id':_0x2179a3['params']['id']}},_0x28473={};_0x28473['model']=_[_0xe1b0('0x36')](db['UserProfile']['rawAttributes']);_0x41194d[_0xe1b0('0x3a')]=_[_0xe1b0('0x38')](_0x28473[_0xe1b0('0x34')],qs['fields'](_0x2179a3['query'][_0xe1b0('0x39')]));_0x41194d['attributes']=_0x41194d[_0xe1b0('0x3a')][_0xe1b0('0x3b')]?_0x41194d[_0xe1b0('0x3a')]:_0x28473[_0xe1b0('0x34')];if(_0x2179a3[_0xe1b0('0x35')]['includeAll']){_0x41194d[_0xe1b0('0x46')]=[{'all':!![]}];}_0x41194d=_['merge']({},_0x41194d,_0x2179a3[_0xe1b0('0x4b')]);return db[_0xe1b0('0x30')]['find'](_0x41194d)[_0xe1b0('0x29')](handleEntityNotFound(_0x4f93a9,null))[_0xe1b0('0x29')](function(_0x493ea5){if(_0x493ea5){var _0x5cd7e4=_0x493ea5['get']({'plain':!![]});_0x5cd7e4=qs[_0xe1b0('0x4f')](_0x5cd7e4,['id',_0xe1b0('0x50'),_0xe1b0('0x51'),_0xe1b0('0x52')]);_0x2179a3[_0xe1b0('0x53')]=_[_0xe1b0('0x4f')](_0x2179a3['body'],['id',_0xe1b0('0x50'),'updatedAt']);return db[_0xe1b0('0x54')][_0xe1b0('0x55')](function(_0x252c8b){return db[_0xe1b0('0x30')]['create'](_[_0xe1b0('0x43')](_0x5cd7e4,_0x2179a3['body']),{'include':_0x2179a3[_0xe1b0('0x35')][_0xe1b0('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x252c8b})['then'](function(_0xe7e1f2){var _0x1dab5e=_0xe7e1f2[_0xe1b0('0x56')]({'plain':!![]});return db[_0xe1b0('0x57')][_0xe1b0('0x47')]({'where':{'userProfileId':_0x2179a3['params']['id']},'raw':!![]})[_0xe1b0('0x29')](function(_0x30e351){if(_0x30e351){return BPromise[_0xe1b0('0x58')](_0x30e351,function(_0x31dc3e){return new BPromise(function(_0x1dbbcc,_0x10fd8a){if(_0x31dc3e[_0xe1b0('0x59')]===null||_0x31dc3e[_0xe1b0('0x59')]===0x1)_0x1dbbcc(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x31dc3e['id']},'raw':!![]})[_0xe1b0('0x29')](function(_0x32403b){var _0x132f47=_[_0xe1b0('0x2f')](_0x32403b,function(_0x39adc9){return qs[_0xe1b0('0x4f')](_0x39adc9,['id','createdAt',_0xe1b0('0x51'),_0xe1b0('0x5a')]);});_0x1dbbcc(_0x132f47);})[_0xe1b0('0x48')](function(_0x10e25f){_0x10fd8a(_0x10e25f);});})[_0xe1b0('0x29')](function(_0x3ade51){var _0x5dfa02=qs[_0xe1b0('0x4f')](_0x31dc3e,['id',_0xe1b0('0x50'),_0xe1b0('0x51')]);_0x5dfa02[_0xe1b0('0x5b')]=_0x1dab5e['id'];if(_0x3ade51)_0x5dfa02['Resources']=_0x3ade51;return _0x5dfa02;})[_0xe1b0('0x29')](function(_0x1a7e35){return db['UserProfileSection'][_0xe1b0('0x4d')](_0x1a7e35,{'include':[{'model':db[_0xe1b0('0x5c')],'as':_0xe1b0('0x5d')}],'raw':!![],'transaction':_0x252c8b});});})[_0xe1b0('0x29')](function(){return _0x1dab5e;});}});});});}})[_0xe1b0('0x29')](respondWithResult(_0x4f93a9,0xc9))[_0xe1b0('0x48')](handleError(_0x4f93a9,null));};exports[_0xe1b0('0x5e')]=function(_0x19cae2,_0x5bb5af){if(_0x19cae2[_0xe1b0('0x53')]['id']){delete _0x19cae2[_0xe1b0('0x53')]['id'];}return db[_0xe1b0('0x30')][_0xe1b0('0x4c')]({'where':{'id':_0x19cae2[_0xe1b0('0x4a')]['id']}})[_0xe1b0('0x29')](handleEntityNotFound(_0x5bb5af,null))['then'](saveUpdates(_0x19cae2['body'],null))[_0xe1b0('0x29')](respondWithResult(_0x5bb5af,null))[_0xe1b0('0x48')](handleError(_0x5bb5af,null));};exports[_0xe1b0('0x2a')]=function(_0x14fddf,_0x1baa58){return db[_0xe1b0('0x30')][_0xe1b0('0x4c')]({'where':{'id':_0x14fddf['params']['id']}})[_0xe1b0('0x29')](handleEntityNotFound(_0x1baa58,null))[_0xe1b0('0x29')](removeEntity(_0x1baa58,null))[_0xe1b0('0x48')](handleError(_0x1baa58,null));};exports[_0xe1b0('0x5f')]=function(_0x7768c4,_0xe73956){return db[_0xe1b0('0x30')][_0xe1b0('0x5f')]()[_0xe1b0('0x29')](respondWithResult(_0xe73956,null))['catch'](handleError(_0xe73956,null));};exports[_0xe1b0('0x60')]=function(_0x2d0419,_0x1df811){var _0xbfebce=_0x2d0419[_0xe1b0('0x53')];return db[_0xe1b0('0x30')][_0xe1b0('0x4c')]({'where':{'id':_0x2d0419[_0xe1b0('0x4a')]['id']}})[_0xe1b0('0x29')](handleEntityNotFound(_0x1df811,null))[_0xe1b0('0x29')](function(_0x21d222){if(_0x21d222){return db['sequelize'][_0xe1b0('0x55')](function(_0x3a71e8){return db['UserProfileSection'][_0xe1b0('0x2a')]({'where':{'userProfileId':_0x2d0419[_0xe1b0('0x4a')]['id'],'sectionId':_[_0xe1b0('0x2f')](_0xbfebce,function(_0x845ecf){return _0x845ecf[_0xe1b0('0x5a')];})},'transaction':_0x3a71e8})[_0xe1b0('0x29')](function(){var _0x584868=_['map'](_0xbfebce,function(_0x39c619){_0x39c619[_0xe1b0('0x5b')]=_0x2d0419[_0xe1b0('0x4a')]['id'];return _0x39c619;});var _0x5b33e4=[];return BPromise['each'](_0x584868,function(_0xedb90b){return db[_0xe1b0('0x57')][_0xe1b0('0x4d')](_0xedb90b,{'include':[{'model':db[_0xe1b0('0x5c')],'as':_0xe1b0('0x5d')}],'raw':!![],'transaction':_0x3a71e8})[_0xe1b0('0x29')](function(_0x1336a6){_0x5b33e4[_0xe1b0('0x61')](_0x1336a6[_0xe1b0('0x56')]({'plain':!![]}));});})[_0xe1b0('0x29')](function(){return _0x5b33e4;});});});}})[_0xe1b0('0x29')](function(_0x1cb68e){return _0x1cb68e;})[_0xe1b0('0x29')](respondWithResult(_0x1df811,null))[_0xe1b0('0x48')](handleError(_0x1df811,null));};exports['removeSections']=function(_0x2c9ac1,_0x2c3ed1){var _0x2712de;return db[_0xe1b0('0x30')][_0xe1b0('0x4c')]({'where':{'id':_0x2c9ac1[_0xe1b0('0x4a')]['id']},'attributes':['id',_0xe1b0('0x2c')]})[_0xe1b0('0x29')](handleEntityNotFound(_0x2c3ed1,null))[_0xe1b0('0x29')](function(_0x48e7e2){if(_0x48e7e2){_0x2712de=_0x48e7e2;return db['UserProfileSection'][_0xe1b0('0x2a')]({'where':{'userProfileId':_0x2c9ac1['params']['id'],'sectionId':_0x2c9ac1[_0xe1b0('0x35')][_0xe1b0('0x62')]}});}})[_0xe1b0('0x29')](function(){return _0x2712de;})[_0xe1b0('0x29')](respondWithStatusCode(_0x2c3ed1,null))['catch'](handleError(_0x2c3ed1,null));};exports['getSections']=function(_0x4b1fbb,_0x4462a8){var _0x54c8c5=[];var _0x512ffc=[];return db[_0xe1b0('0x57')][_0xe1b0('0x47')]({'where':{'userProfileId':_0x4b1fbb[_0xe1b0('0x4a')]['id']},'raw':!![]})['then'](function(_0x4612a4){_0x54c8c5=_['filter'](_0x4612a4,function(_0x16f754){return _0x16f754[_0xe1b0('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x16f754[_0xe1b0('0x5a')]);});if(!_['isEmpty'](_0x54c8c5)){return _[_0xe1b0('0x2f')](_0x54c8c5,function(_0x50125e){return _0x50125e[_0xe1b0('0x5a')];});}else{return;}})[_0xe1b0('0x29')](function(_0x5da717){if(_0x5da717)_0x512ffc=_0x5da717;if(_['includes'](_0x512ffc,0x64)){var _0x59e5c0=_[_0xe1b0('0x4c')](_0x54c8c5,{'sectionId':0x64});return hasDefaultDashboard(_0x59e5c0)[_0xe1b0('0x29')](function(_0x5e0db2){return _[_0xe1b0('0x2f')](_0x54c8c5,function(_0x23a19c){if(_0x23a19c[_0xe1b0('0x5a')]===0x64){_0x23a19c[_0xe1b0('0x64')]=_0x5e0db2;}return _0x23a19c;});});}else{return;}})[_0xe1b0('0x29')](function(_0x4eaf70){if(_0x4eaf70)_0x54c8c5=_0x4eaf70;if(_[_0xe1b0('0x65')](_0x512ffc,0x3eb)){var _0x44155a=_['find'](_0x54c8c5,{'sectionId':0x3eb});return getCustomDashboards(_0x44155a)[_0xe1b0('0x29')](function(_0x4e6982){return _[_0xe1b0('0x2f')](_0x54c8c5,function(_0x5358cb){if(_0x44155a['enabled']){if(_0x5358cb['sectionId']===0x3eb){_0x5358cb[_0xe1b0('0x64')]=_0x4e6982;}}else{if(_0x5358cb[_0xe1b0('0x5a')]===0x64){_0x5358cb[_0xe1b0('0x64')]=_0x4e6982;}}return _0x5358cb;});});}else{return;}})['then'](function(_0x23a5d8){if(_0x23a5d8)_0x54c8c5=_0x23a5d8;if(_['includes'](_0x512ffc,0x709)){var _0x880d95=_[_0xe1b0('0x4c')](_0x54c8c5,{'sectionId':0x709});return getPlugins(_0x880d95)[_0xe1b0('0x29')](function(_0x1dd8f5){if(_0x880d95[_0xe1b0('0x63')]){return _['map'](_0x54c8c5,function(_0x4197b6){if(_0x4197b6[_0xe1b0('0x5a')]===0x709){_0x4197b6[_0xe1b0('0x64')]=_0x1dd8f5;}return _0x4197b6;});}else{var _0x2d0791={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1dd8f5};var _0x3378d3=_['map'](_0x54c8c5);_0x3378d3[_0xe1b0('0x61')](_0x2d0791);return _0x3378d3;}});}else{return;}})[_0xe1b0('0x29')](function(_0xa1f961){if(_0xa1f961)_0x54c8c5=_0xa1f961;return _[_0xe1b0('0x41')](_0x54c8c5,[_0xe1b0('0x63'),0x1]);})[_0xe1b0('0x29')](respondWithResult(_0x4462a8,null))['catch'](handleError(_0x4462a8,null));};function hasDefaultDashboard(_0x3977f3){var _0x3815c0=[0x65];return new BPromise(function(_0x15a44f,_0x1f279b){try{if(_0x3977f3[_0xe1b0('0x59')]){_0x15a44f(_0x3815c0);}else{return db[_0xe1b0('0x5c')][_0xe1b0('0x66')]({'where':{'sectionId':_0x3977f3['id']},'raw':!![]})['then'](function(_0x495bfa){_0x495bfa?_0x15a44f(_0x3815c0):_0x15a44f();});}}catch(_0x49bb58){_0x1f279b(_0x49bb58);}});}function getCustomDashboards(_0x34bc7b){var _0x398e7e=[];return new BPromise(function(_0x4aa177,_0x559e4f){try{if(_0x34bc7b[_0xe1b0('0x59')]){return db[_0xe1b0('0x67')][_0xe1b0('0x47')]({'raw':!![]})[_0xe1b0('0x29')](function(_0x509ad3){_0x509ad3[_0xe1b0('0x68')](function(_0x5db548){_0x398e7e[_0xe1b0('0x61')](_0x5db548['id']+0x1869f);});_0x4aa177(_0x398e7e);});}else{return db[_0xe1b0('0x5c')][_0xe1b0('0x47')]({'where':{'sectionId':_0x34bc7b['id']},'raw':!![]})[_0xe1b0('0x29')](function(_0x1e38b9){_0x1e38b9[_0xe1b0('0x68')](function(_0x1293ab){_0x398e7e[_0xe1b0('0x61')](_0x1293ab['resourceId']+0x1869f);});_0x4aa177(_0x398e7e);});}}catch(_0x264c53){_0x559e4f(_0x264c53);}});}function getPlugins(_0x5080f4){var _0x361cba=[];return new BPromise(function(_0x5b692b,_0x523563){try{if(_0x5080f4[_0xe1b0('0x59')]){return db[_0xe1b0('0x69')][_0xe1b0('0x47')]({'raw':!![]})[_0xe1b0('0x29')](function(_0x15bc33){_0x15bc33['forEach'](function(_0x178369){_0x361cba['push'](_0x178369['id']+0x15b38);});_0x5b692b(_0x361cba);});}else{return db[_0xe1b0('0x5c')]['findAll']({'where':{'sectionId':_0x5080f4['id']},'raw':!![]})[_0xe1b0('0x29')](function(_0x34992b){_0x34992b[_0xe1b0('0x68')](function(_0x3c1c98){_0x361cba[_0xe1b0('0x61')](_0x3c1c98[_0xe1b0('0x6a')]+0x15b38);});_0x5b692b(_0x361cba);});}}catch(_0x3886de){_0x523563(_0x3886de);}});}exports['addResources']=function(_0x13b682,_0x3cd179){return db['UserProfile'][_0xe1b0('0x4c')]({'where':{'id':_0x13b682['params']['id']}})['then'](handleEntityNotFound(_0x3cd179,null))['then'](function(_0x46d4b1){if(_0x46d4b1){return db[_0xe1b0('0x54')][_0xe1b0('0x55')](function(_0x4c9d48){return db['UserProfileSection'][_0xe1b0('0x47')]({'where':{'userProfileId':_0x13b682[_0xe1b0('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xe1b0('0x29')](function(_0x1bb556){if(_0x1bb556){return db['UserProfileSection'][_0xe1b0('0x2a')]({'where':{'userProfileId':_0x13b682[_0xe1b0('0x4a')]['id'],'id':_[_0xe1b0('0x2f')](_0x1bb556,function(_0x503faa){return _0x503faa['id'];})},'transaction':_0x4c9d48});}})[_0xe1b0('0x29')](function(_0x35fab0){var _0x444330=_[_0xe1b0('0x2f')](_0x13b682[_0xe1b0('0x53')],function(_0xb3031b){_0xb3031b[_0xe1b0('0x5b')]=_0x13b682[_0xe1b0('0x4a')]['id'];return _0xb3031b;});return db[_0xe1b0('0x57')][_0xe1b0('0x6b')](_0x444330,{'raw':!![],'transaction':_0x4c9d48});})['then'](function(_0x4a51ef){var _0x50cad1=_[_0xe1b0('0x41')](_[_0xe1b0('0x2f')](_0x4a51ef,function(_0x26404e){return _0x26404e['get']({'plain':!![]});}),{'includeAll':![]});if(_0x50cad1){return db[_0xe1b0('0x57')]['findAll']({'where':{'userProfileId':_0x13b682['params']['id'],'sectionId':_[_0xe1b0('0x2f')](_0x50cad1,function(_0x5543a0){return _0x5543a0[_0xe1b0('0x5a')];})},'attributes':['id',_0xe1b0('0x5a')],'raw':!![]})[_0xe1b0('0x29')](function(_0x503043){var _0xac15ac=_[_0xe1b0('0x2f')](_0x13b682[_0xe1b0('0x53')],function(_0x58f496){_0x58f496['userProfileId']=_0x13b682[_0xe1b0('0x4a')]['id'];return _0x58f496;});return db[_0xe1b0('0x5c')][_0xe1b0('0x6b')](_0xac15ac,{'raw':!![],'transaction':_0x4c9d48});});}})[_0xe1b0('0x48')](handleError(_0x3cd179,null));});}})[_0xe1b0('0x29')](function(_0x4efbf8){var _0x2d3188=_[_0xe1b0('0x2f')](_0x4efbf8,function(_0x1539bc){return _0x1539bc['get']({'plain':!![]});});})[_0xe1b0('0x29')](respondWithResult(_0x3cd179,null))[_0xe1b0('0x48')](handleError(_0x3cd179,null));};exports[_0xe1b0('0x6c')]=function(_0x3ad0f6,_0x4faff6,_0xb986c4){return db[_0xe1b0('0x30')][_0xe1b0('0x4c')]({'where':{'id':_0x3ad0f6['params']['id']}})[_0xe1b0('0x29')](handleEntityNotFound(_0x4faff6,null))[_0xe1b0('0x29')](function(_0x200490){if(_0x200490){return _0x200490[_0xe1b0('0x6c')](_0x3ad0f6[_0xe1b0('0x35')][_0xe1b0('0x62')]);}})[_0xe1b0('0x29')](respondWithStatusCode(_0x4faff6,null))[_0xe1b0('0x48')](handleError(_0x4faff6,null));};exports[_0xe1b0('0x6d')]=function(_0x401bae,_0x3aff33){var _0x54895c={};if(!_0x401bae[_0xe1b0('0x35')][_0xe1b0('0x6e')])throw new Error(_0xe1b0('0x6f'));if(!_0x401bae[_0xe1b0('0x35')][_0xe1b0('0x70')]('nolimit')){_0x54895c[_0xe1b0('0x3d')]=qs[_0xe1b0('0x3d')](_0x401bae[_0xe1b0('0x35')][_0xe1b0('0x3d')]);_0x54895c[_0xe1b0('0x26')]=qs[_0xe1b0('0x26')](_0x401bae[_0xe1b0('0x35')]['offset']);}return db[_0xe1b0('0x30')][_0xe1b0('0x4c')]({'where':{'id':_0x401bae[_0xe1b0('0x4a')]['id']}})[_0xe1b0('0x29')](function(_0x587e21){if(!_0x587e21)throw new Error(_0xe1b0('0x71')+_0x401bae[_0xe1b0('0x4a')]['id']);return db[_0xe1b0('0x30')][_0xe1b0('0x6d')](_0x401bae);})[_0xe1b0('0x29')](respondWithFilteredResult(_0x3aff33,_0x54895c))[_0xe1b0('0x48')](handleError(_0x3aff33,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 398f7aa..af0e9fa 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 _0x6455=['exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5c584b,_0x5b6542){var _0x1c6180=function(_0x128765){while(--_0x128765){_0x5c584b['push'](_0x5c584b['shift']());}};_0x1c6180(++_0x5b6542);}(_0x6455,0x97));var _0x5645=function(_0x121fa0,_0x344d2c){_0x121fa0=_0x121fa0-0x0;var _0x3739a2=_0x6455[_0x121fa0];return _0x3739a2;};'use strict';var EventEmitter=require(_0x5645('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x5645('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5645('0x2')](0x0);var events={'afterCreate':_0x5645('0x3'),'afterUpdate':_0x5645('0x4'),'afterDestroy':_0x5645('0x5')};function emitEvent(_0x35c21e){return function(_0x5388ff,_0x233875,_0x29cefe){UserProfileEvents[_0x5645('0x6')](_0x35c21e+':'+_0x5388ff['id'],_0x5388ff);UserProfileEvents[_0x5645('0x6')](_0x35c21e,_0x5388ff);_0x29cefe(null);};}for(var e in events){if(events[_0x5645('0x7')](e)){var event=events[e];UserProfile[_0x5645('0x8')](e,emitEvent(event));}}module[_0x5645('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x90ec=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x962f55,_0x47e9a0){var _0x56bf9a=function(_0x5e727d){while(--_0x5e727d){_0x962f55['push'](_0x962f55['shift']());}};_0x56bf9a(++_0x47e9a0);}(_0x90ec,0x1d4));var _0xc90e=function(_0x29b4cc,_0x5b9996){_0x29b4cc=_0x29b4cc-0x0;var _0x595f88=_0x90ec[_0x29b4cc];return _0x595f88;};'use strict';var EventEmitter=require(_0xc90e('0x0'));var UserProfile=require(_0xc90e('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc90e('0x2')](0x0);var events={'afterCreate':_0xc90e('0x3'),'afterUpdate':_0xc90e('0x4'),'afterDestroy':_0xc90e('0x5')};function emitEvent(_0x35f706){return function(_0x57acfe,_0x1c13c4,_0x207b98){UserProfileEvents[_0xc90e('0x6')](_0x35f706+':'+_0x57acfe['id'],_0x57acfe);UserProfileEvents['emit'](_0x35f706,_0x57acfe);_0x207b98(null);};}for(var e in events){if(events[_0xc90e('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xc90e('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 175299d..d4f6229 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 _0x3f51=['CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','contexts','VoiceContext','voicemails','VoiceRecording','parentSections','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','Team','voicequeues','users','agents','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Dashboard','intervals','Interval','pauses','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','find','params','all','ignore','union','length','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','reportId','CustomReports','count','Tags','color','tag','ThroughTags','rows','sms','dataValues','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','then','map','catch','model','findAll','associatedResources','name','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','CmContact','Lists','ListId','lists','CmList','companies'];(function(_0x177261,_0x110c73){var _0x886e9c=function(_0x59b91e){while(--_0x59b91e){_0x177261['push'](_0x177261['shift']());}};_0x886e9c(++_0x110c73);}(_0x3f51,0x9a));var _0x13f5=function(_0x30627c,_0x2a6378){_0x30627c=_0x30627c-0x0;var _0x44dcf9=_0x3f51[_0x30627c];return _0x44dcf9;};'use strict';var _=require(_0x13f5('0x0'));var attributes=require(_0x13f5('0x1'));var qs=require(_0x13f5('0x2'));var squel=require(_0x13f5('0x3'));module[_0x13f5('0x4')]=function(_0x4b3ade){var _0x28203d=_0x4b3ade[_0x13f5('0x5')];function _0x3cb852(_0x3881e7,_0x289286){return new Promise(function(_0x4a23ae,_0x22e41b){if(!_0x289286)return _0x4a23ae(null);var _0xc2abbf=_0x289286[_0x13f5('0x6')]?{[_0x289286[_0x13f5('0x6')][_0x13f5('0x7')]]:_0x289286[_0x13f5('0x6')]['value']}:undefined;return _0x28203d[_0x3881e7]['findAll']({'where':_0xc2abbf,'raw':!![]})[_0x13f5('0x8')](function(_0x3821aa){_0x289286['associatedResources']=_[_0x13f5('0x9')](_0x3821aa,'id');_0x4a23ae(_0x289286);})[_0x13f5('0xa')](function(_0x4f0b45){_0x22e41b(_0x4f0b45);});});}function _0x3eaa55(_0x28ac6f,_0x23be11){return new Promise(function(_0x33527d,_0xabb42f){var _0x2de309=_0x28ac6f['filter']?{[_0x28ac6f['filter'][_0x13f5('0x7')]]:_0x28ac6f[_0x13f5('0x6')]['value']}:undefined;return _0x28203d[_0x28ac6f[_0x13f5('0xb')]][_0x13f5('0xc')]({'where':_0x2de309,'raw':!![]})[_0x13f5('0x8')](function(_0x3eec0d){_0x23be11[_0x13f5('0xd')]=_[_0x13f5('0x9')](_0x3eec0d,function(_0x412e88){return _0x412e88[_0x13f5('0xe')];});_0x33527d(_0x23be11);})[_0x13f5('0xa')](function(_0x57c526){_0xabb42f(_0x57c526);});});}function _0x18f918(_0x5f32bc,_0x2f4984,_0x4e6037){if(!_0x2f4984)return Promise['resolve'](null);return new Promise(function(_0x1e4a65,_0x124923){return _0x28203d[_0x13f5('0xf')][_0x13f5('0xc')]({'where':{'sectionId':_0x2f4984['id']},'raw':!![]})['then'](function(_0x5d952d){if(_0x5f32bc[_0x13f5('0x7')]&&_0x5f32bc[_0x13f5('0x7')]!=='id'){_0x2f4984['associatedResources']=_['map'](_0x5d952d,function(_0x533be4){return _0x533be4[_0x5f32bc[_0x13f5('0x7')]];});}else{if(_0x4e6037===_0x13f5('0x10')){_0x2f4984[_0x13f5('0xd')]=_[_0x13f5('0x9')](_0x5d952d,function(_0x453ca1){return{'id':_0x453ca1['resourceId'],'type':_0x453ca1[_0x13f5('0x11')]};});}else{_0x2f4984['associatedResources']=_[_0x13f5('0x9')](_0x5d952d,function(_0x1b5403){return _0x1b5403[_0x13f5('0x12')];});}}_0x1e4a65(_0x2f4984);})['catch'](function(_0x38135f){_0x124923(_0x38135f);});});}function _0x240032(_0xf6d1ec,_0x1b32ab){var _0x5c60f1={'parentSections':[]};switch(_0xf6d1ec[_0x13f5('0x13')]()){case _0x13f5('0x14'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x16');break;case _0x13f5('0x17'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x18');break;case'squarerecordings':_0x5c60f1['childModel']=_0x13f5('0x19');_0x5c60f1['parentSections']=[{'name':_0x13f5('0x1a'),'field':'name','foreignKey':_0x13f5('0x1b')}];break;case _0x13f5('0x1c'):_0x5c60f1['childModel']='JscriptyProject';break;case'contacts':_0x5c60f1['childModel']=_0x13f5('0x1d');_0x5c60f1['parentSections']=[{'name':_0x13f5('0x1e'),'field':'id','foreignKey':_0x13f5('0x1f')}];break;case _0x13f5('0x20'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x21');break;case _0x13f5('0x22'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x23');break;case _0x13f5('0x24'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x25');break;case _0x13f5('0x26'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x27');break;case _0x13f5('0x28'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x29');break;case _0x13f5('0x2a'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x2b');break;case _0x13f5('0x2c'):_0x5c60f1[_0x13f5('0x15')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case'outboundroutes':_0x5c60f1['childModel']='VoiceExtension';break;case _0x13f5('0x2d'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x2e');break;case _0x13f5('0x2f'):_0x5c60f1[_0x13f5('0x15')]='VoiceMail';break;case'voicerecordings':_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x30');_0x5c60f1[_0x13f5('0x31')]=[{'name':_0x13f5('0x32'),'field':_0x13f5('0xe'),'foreignKey':_0x13f5('0x33'),'model':_0x13f5('0x34'),'filter':{'field':_0x13f5('0x35'),'value':[_0x13f5('0x36')]}},{'name':_0x13f5('0x37'),'field':'name','foreignKey':_0x13f5('0x33'),'model':_0x13f5('0x34'),'filter':{'field':_0x13f5('0x35'),'value':[_0x13f5('0x38')]}},{'name':_0x13f5('0x39'),'field':_0x13f5('0xe'),'foreignKey':'queue','model':_0x13f5('0x3a'),'filter':{'field':_0x13f5('0x11'),'value':[_0x13f5('0x3b')]}},{'name':_0x13f5('0x3c'),'field':_0x13f5('0xe'),'foreignKey':_0x13f5('0x3d'),'model':_0x13f5('0x3a'),'filter':{'field':_0x13f5('0x11'),'value':[_0x13f5('0x3e')]}}];break;case _0x13f5('0x3f'):_0x5c60f1['childModel']=_0x13f5('0x40');break;case'chanspies':_0x5c60f1['childModel']=_0x13f5('0x41');break;case _0x13f5('0x42'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x43');break;case _0x13f5('0x44'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x45');break;case _0x13f5('0x46'):_0x5c60f1['childModel']=_0x13f5('0x47');break;case _0x13f5('0x48'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x49');break;case _0x13f5('0x4a'):_0x5c60f1[_0x13f5('0x15')]='MailSubstatus';break;case _0x13f5('0x4b'):_0x5c60f1[_0x13f5('0x15')]='OpenchannelQueue';break;case _0x13f5('0x4c'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x4d');break;case _0x13f5('0x4e'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x4f');break;case _0x13f5('0x50'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x51');break;case _0x13f5('0x52'):_0x5c60f1[_0x13f5('0x15')]='WhatsappQueue';break;case'whatsappaccounts':_0x5c60f1['childModel']=_0x13f5('0x53');break;case'teams':_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x54');break;case _0x13f5('0x55'):case'queuecampaigns':_0x5c60f1['childModel']=_0x13f5('0x3a');if(_0x1b32ab){_0x5c60f1[_0x13f5('0x31')]=[{'name':_0x13f5('0x39')},{'name':_0x13f5('0x3c')}];}break;case _0x13f5('0x56'):case _0x13f5('0x57'):case'telephones':_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x34');if(_0x1b32ab){_0x5c60f1['parentSections']=[{'name':_0x13f5('0x58'),'filter':{'field':'role','value':[_0x13f5('0x59'),_0x13f5('0x5a')]},'ignore':!![]},{'name':_0x13f5('0x32')},{'name':'Telephones'}];}break;case _0x13f5('0x5b'):_0x5c60f1[_0x13f5('0x15')]='ZendeskAccount';break;case _0x13f5('0x5c'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x5d');break;case'freshdeskaccounts':_0x5c60f1['childModel']=_0x13f5('0x5e');break;case _0x13f5('0x5f'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x60');break;case'deskaccounts':_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x61');break;case _0x13f5('0x62'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x63');break;case'vtigeraccounts':_0x5c60f1['childModel']='User';break;case _0x13f5('0x64'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x65');break;case _0x13f5('0x66'):_0x5c60f1[_0x13f5('0x15')]='Disposition';break;case'customdashboards':_0x5c60f1['childModel']=_0x13f5('0x67');break;case _0x13f5('0x68'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x69');break;case _0x13f5('0x6a'):_0x5c60f1[_0x13f5('0x15')]='Pause';break;case'scheduler':_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x6b');break;case _0x13f5('0x6c'):_0x5c60f1['childModel']='Sound';break;case _0x13f5('0x6d'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x6e');break;case _0x13f5('0x6f'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x70');break;case _0x13f5('0x71'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x72');break;case _0x13f5('0x73'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x74');break;case _0x13f5('0x75'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x76');break;case _0x13f5('0x77'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x78');break;case _0x13f5('0x79'):_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x10');_0x5c60f1['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x5c60f1[_0x13f5('0x15')]=_0x13f5('0x7a');break;}return _0x5c60f1;}function _0x2da419(_0x44bf9c,_0x55a5e0){var _0xfd8fae=_0x44bf9c['charAt'](0x0)[_0x13f5('0x7b')]()+_0x44bf9c[_0x13f5('0x7c')](0x1);var _0x5bf87a={'type':_0x28203d[_0x13f5('0x7d')][_0x13f5('0x7e')][_0x13f5('0x7f')],'raw':!![]};return new Promise(function(_0x2d3b56,_0x246ca5){var _0x21ed49=squel[_0x13f5('0x80')]()[_0x13f5('0x7')](_0x13f5('0x81')+_0xfd8fae+_0x13f5('0x82'),'id')[_0x13f5('0x7')](_0x13f5('0x83'))[_0x13f5('0x84')](_0x13f5('0x85')+_0x44bf9c+_0x13f5('0x86'),'ui')['where'](_0x13f5('0x87'),_0x55a5e0['id']);return _0x28203d[_0x13f5('0x88')][_0x13f5('0x89')](_0x21ed49['toString'](),_0x5bf87a)[_0x13f5('0x8')](function(_0x2a74a4){_0x55a5e0[_0xfd8fae+_0x13f5('0x8a')]=_0x2a74a4;_0x2d3b56(_0x2a74a4);})[_0x13f5('0xa')](function(_0x2ed07d){_0x246ca5(_0x2ed07d);});});}return _0x4b3ade[_0x13f5('0x8b')](_0x13f5('0x8c'),attributes,{'tableName':_0x13f5('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4d2b27){var _0x429d33={'raw':_0x4d2b27['query'][_0x13f5('0x8e')],'where':{}};var _0x49effa={};var _0x2cfcc8={'count':0x0,'rows':[]};var _0x484812=_0x4d2b27['query']['section'];var _0x8e124=_0x4d2b27['query'][_0x13f5('0x8f')]||![];var _0x366251=_0x240032(_0x484812,_0x8e124);if(!_0x366251[_0x13f5('0x15')])throw new Error(_0x13f5('0x90')+_0x484812+'\x27');var _0x50e5cd=[{'name':_0x484812}];if(!_[_0x13f5('0x91')](_0x366251[_0x13f5('0x31')]))_0x50e5cd=_0x366251[_0x13f5('0x31')];var _0x519d40=[];for(var _0x4112f9=0x0;_0x4112f9<_0x50e5cd['length'];_0x4112f9++){_0x519d40[_0x13f5('0x92')](_0x28203d['UserProfileSection'][_0x13f5('0x93')]({'where':{'userProfileId':_0x4d2b27[_0x13f5('0x94')]['id'],'name':_0x50e5cd[_0x4112f9][_0x13f5('0xe')]},'raw':!![]}));}return Promise[_0x13f5('0x95')](_0x519d40)[_0x13f5('0x8')](function(_0x3099c0){var _0x2e8166=_['filter'](_0x3099c0,function(_0x5ac167){return _0x5ac167?_0x5ac167:undefined;});var _0x67b3d6=_[_0x13f5('0x6')](_0x50e5cd,[_0x13f5('0x96'),!![]]);var _0xd28abe=_[_0x13f5('0x91')](_0x2e8166)&&_[_0x13f5('0x91')](_0x67b3d6)?null:_[_0x13f5('0x97')](_0x67b3d6,_0x2e8166);if(!_0xd28abe)return null;var _0x77e8f2=[];for(var _0x519f80=0x0;_0x519f80<_0xd28abe[_0x13f5('0x98')];_0x519f80++){var _0x160178=_[_0x13f5('0x93')](_0x50e5cd,function(_0x2a9d4a){return _0xd28abe[_0x519f80]?_0x2a9d4a[_0x13f5('0xe')]===_0xd28abe[_0x519f80][_0x13f5('0xe')]:null;});if(_0x160178){if(_0xd28abe[_0x519f80][_0x13f5('0x96')]){_0x77e8f2['push'](_0x3cb852(_0x366251[_0x13f5('0x15')],_0xd28abe[_0x519f80]));}else{if(!_0xd28abe[_0x519f80]['autoAssociation']){_0x77e8f2[_0x13f5('0x92')](_0x18f918(_0x160178,_0xd28abe[_0x519f80],_0x366251['childModel']));}else{if(_0x160178['model']){_0x77e8f2[_0x13f5('0x92')](_0x3eaa55(_0x160178,_0xd28abe[_0x519f80]));}}}}}return Promise[_0x13f5('0x95')](_0x77e8f2);})[_0x13f5('0x8')](function(_0x434c04){var _0x41f502=_0x434c04;var _0x4eed6d=null;if(_0x41f502){_0x4eed6d=_0x41f502[_0x13f5('0x98')]===0x1?_0x41f502[0x0]:null;}if(!_0x4eed6d&&!_0x41f502)return _0x2cfcc8;var _0x31d602=_0x28203d[_0x366251['childModel']][_0x13f5('0x99')];_0x49effa['model']=_[_0x13f5('0x9a')](_0x31d602);_0x49effa[_0x13f5('0x89')]=_[_0x13f5('0x9a')](_0x4d2b27['query']);_0x49effa[_0x13f5('0x9b')]=_[_0x13f5('0x9c')](_0x49effa['model'],_0x49effa[_0x13f5('0x89')]);_0x429d33[_0x13f5('0x9d')]=_['intersection'](_0x49effa[_0x13f5('0xb')],qs[_0x13f5('0x9e')](_0x4d2b27[_0x13f5('0x89')][_0x13f5('0x9e')]));_0x429d33[_0x13f5('0x9d')]=_0x429d33['attributes'][_0x13f5('0x98')]?_0x429d33[_0x13f5('0x9d')]:_0x49effa['model'];if(!_0x4d2b27[_0x13f5('0x89')][_0x13f5('0x9f')]('nolimit')){_0x429d33[_0x13f5('0xa0')]=qs[_0x13f5('0xa0')](_0x4d2b27['query']['limit']);_0x429d33[_0x13f5('0xa1')]=qs[_0x13f5('0xa1')](_0x4d2b27['query'][_0x13f5('0xa1')]);}_0x429d33['order']=qs[_0x13f5('0xa2')](_0x4d2b27['query'][_0x13f5('0xa2')]);_0x429d33[_0x13f5('0xa3')]=qs[_0x13f5('0x9b')](_[_0x13f5('0xa4')](_0x4d2b27[_0x13f5('0x89')],_0x49effa['filters']));if(_0x4d2b27['query'][_0x13f5('0x6')]){_0x429d33[_0x13f5('0xa3')]=_[_0x13f5('0xa5')](_0x429d33[_0x13f5('0xa3')],{'$or':_[_0x13f5('0x9')](_0x31d602,function(_0x580aa0){if(_0x580aa0[_0x13f5('0x11')][_0x13f5('0xa6')]!==_0x13f5('0xa7')){var _0x4f6f49={};_0x4f6f49[_0x580aa0[_0x13f5('0x7')]]={'$like':'%'+_0x4d2b27[_0x13f5('0x89')][_0x13f5('0x6')]+'%'};return _0x4f6f49;}})});}var _0x19d1a0=[];var _0x4efab2=null;var _0x295339={};if(_0x4eed6d){_0x4efab2=_[_0x13f5('0x93')](_0x50e5cd,[_0x13f5('0xe'),_0x4eed6d[_0x13f5('0xe')]]);if(_0x4efab2[_0x13f5('0x7')]){_0x295339={};if(_0x366251['childModel']===_0x13f5('0x10')){_0x295339[_0x4efab2[_0x13f5('0xa8')]]=_[_0x13f5('0x9')](_0x4eed6d['associatedResources'],'id');}else{_0x295339[_0x4efab2['foreignKey']]=_0x4eed6d[_0x13f5('0xd')];}_0x19d1a0[_0x13f5('0x92')](_0x295339);}else{_0x429d33[_0x13f5('0xa3')]['id']=_0x4eed6d[_0x13f5('0xd')];}}else{for(var _0x525f9e=0x0;_0x525f9e<_0x41f502[_0x13f5('0x98')];_0x525f9e++){_0x4efab2=_[_0x13f5('0x93')](_0x50e5cd,['name',_0x41f502[_0x525f9e][_0x13f5('0xe')]]);if(_0x4efab2[_0x13f5('0x7')]){_0x295339={};_0x295339[_0x4efab2['foreignKey']]=_0x41f502[_0x525f9e][_0x13f5('0xd')];_0x19d1a0[_0x13f5('0x92')](_0x295339);}else{if(!_0x429d33['where']['id'])_0x429d33[_0x13f5('0xa3')]['id']=[];_0x41f502[_0x525f9e]['associatedResources'][_0x13f5('0xa9')](function(_0x442d6c){_0x429d33[_0x13f5('0xa3')]['id'][_0x13f5('0x92')](_0x442d6c);});}}}if(!_[_0x13f5('0x91')](_0x19d1a0)){_0x429d33[_0x13f5('0xa3')]=_[_0x13f5('0xa5')](_0x429d33[_0x13f5('0xa3')],{'$and':{'$or':_0x19d1a0}});}_0x429d33=_['merge']({},_0x429d33,_0x4d2b27[_0x13f5('0xaa')]);if(_0x4eed6d&&!_0x4eed6d[_0x13f5('0xab')]&&_0x366251[_0x13f5('0x15')]==='AnalyticExtractedReport'){if(_0x4d2b27[_0x13f5('0x89')][_0x13f5('0xac')]){_0x429d33[_0x13f5('0xad')]=[{'all':!![]}];}return _0x28203d[_0x366251[_0x13f5('0x15')]][_0x13f5('0xc')](_0x429d33)[_0x13f5('0x8')](function(_0x27352f){var _0x18c67f=[];_0x27352f[_0x13f5('0xa9')](function(_0x39c180){var _0x394a96;switch(_0x39c180[_0x13f5('0xae')]){case _0x13f5('0xaf'):_0x394a96=_[_0x13f5('0x93')](_0x4eed6d[_0x13f5('0xd')],function(_0x3db876){return _0x3db876['id']===_0x39c180['reportId']&&_0x3db876[_0x13f5('0x11')]===_0x13f5('0xb0');});break;case'custom':_0x394a96=_[_0x13f5('0x93')](_0x4eed6d[_0x13f5('0xd')],function(_0x49ac9c){return _0x49ac9c['id']===_0x39c180[_0x13f5('0xb1')]&&_0x49ac9c[_0x13f5('0x11')]===_0x13f5('0xb2');});break;}if(_0x394a96)_0x18c67f[_0x13f5('0x92')](_0x39c180);});_0x2cfcc8[_0x13f5('0xb3')]=_0x18c67f[_0x13f5('0x98')];_0x2cfcc8['rows']=_0x18c67f;return _0x2cfcc8;});}else{return _0x28203d[_0x366251[_0x13f5('0x15')]]['count']({'where':_0x429d33['where']})[_0x13f5('0x8')](function(_0xbed605){_0x2cfcc8['count']=_0xbed605;if(_0x4d2b27[_0x13f5('0x89')]['includeAll']){if(_0x366251[_0x13f5('0x15')]==='CmContact'){_0x429d33['include']=[{'model':_0x28203d[_0x13f5('0x6e')],'as':_0x13f5('0xb4'),'attributes':['id',_0x13f5('0xe'),_0x13f5('0xb5')],'required':_0x4d2b27[_0x13f5('0x89')][_0x13f5('0xb6')]?!![]:![]},{'model':_0x28203d[_0x13f5('0x6e')],'as':_0x13f5('0xb7'),'attributes':['id',_0x13f5('0xe'),_0x13f5('0xb5')],'through':_0x4d2b27['query'][_0x13f5('0xb6')]?{'attributes':[],'where':{'TagId':_0x4d2b27[_0x13f5('0x89')][_0x13f5('0xb6')]||undefined}}:{},'required':_0x4d2b27['query'][_0x13f5('0xb6')]?!![]:![]}];}else{_0x429d33[_0x13f5('0xad')]=[{'all':!![]}];}}return _0x28203d[_0x366251[_0x13f5('0x15')]][_0x13f5('0xc')](_0x429d33);})[_0x13f5('0x8')](function(_0x32b620){_0x2cfcc8[_0x13f5('0xb8')]=_0x32b620;if(_0x484812==='Agents'&&_0x4d2b27[_0x13f5('0x89')]['openTabs']==='true'){var _0x111166=[];for(var _0x4603f3=0x0;_0x4603f3<_0x2cfcc8[_0x13f5('0xb8')]['length'];_0x4603f3++){_0x111166[_0x13f5('0x92')](_0x2da419('chat',_0x2cfcc8[_0x13f5('0xb8')][_0x4603f3]['dataValues']));_0x111166[_0x13f5('0x92')](_0x2da419(_0x13f5('0xb9'),_0x2cfcc8[_0x13f5('0xb8')][_0x4603f3][_0x13f5('0xba')]));_0x111166['push'](_0x2da419('fax',_0x2cfcc8[_0x13f5('0xb8')][_0x4603f3]['dataValues']));_0x111166[_0x13f5('0x92')](_0x2da419(_0x13f5('0xbb'),_0x2cfcc8[_0x13f5('0xb8')][_0x4603f3][_0x13f5('0xba')]));_0x111166[_0x13f5('0x92')](_0x2da419(_0x13f5('0xbc'),_0x2cfcc8['rows'][_0x4603f3][_0x13f5('0xba')]));_0x111166[_0x13f5('0x92')](_0x2da419('whatsapp',_0x2cfcc8[_0x13f5('0xb8')][_0x4603f3][_0x13f5('0xba')]));}return Promise[_0x13f5('0x95')](_0x111166)[_0x13f5('0x8')](function(){return _0x2cfcc8;});}return _0x2cfcc8;});}});}}});}; \ No newline at end of file +var _0x248e=['DefaultReports','count','rows','includeAll','Tag','Tags','tag','color','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','JscriptyProject','contacts','CmContact','ListId','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Template','triggers','Trigger','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','define','UserProfile','raw','section','query','Invalid\x20section\x20\x27','length','push','find','params','ignore','isEmpty','union','autoAssociation','model','all','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','include','default'];(function(_0x385bdf,_0x31187d){var _0x39a75c=function(_0xacc96d){while(--_0xacc96d){_0x385bdf['push'](_0x385bdf['shift']());}};_0x39a75c(++_0x31187d);}(_0x248e,0x18b));var _0xe248=function(_0x4ff8a6,_0x1abfa2){_0x4ff8a6=_0x4ff8a6-0x0;var _0x233507=_0x248e[_0x4ff8a6];return _0x233507;};'use strict';var _=require('lodash');var attributes=require(_0xe248('0x0'));var qs=require(_0xe248('0x1'));var squel=require('squel');module[_0xe248('0x2')]=function(_0x16c2aa){var _0xb05290=_0x16c2aa[_0xe248('0x3')];function _0x5009e0(_0x14dd81,_0x3a2693){return new Promise(function(_0x59c0a0,_0x5254dc){if(!_0x3a2693)return _0x59c0a0(null);var _0x200977=_0x3a2693[_0xe248('0x4')]?{[_0x3a2693['filter'][_0xe248('0x5')]]:_0x3a2693[_0xe248('0x4')][_0xe248('0x6')]}:undefined;return _0xb05290[_0x14dd81][_0xe248('0x7')]({'where':_0x200977,'raw':!![]})[_0xe248('0x8')](function(_0x499d3a){_0x3a2693[_0xe248('0x9')]=_[_0xe248('0xa')](_0x499d3a,'id');_0x59c0a0(_0x3a2693);})[_0xe248('0xb')](function(_0x7a9f2){_0x5254dc(_0x7a9f2);});});}function _0x2582bb(_0x3a2bfa,_0x1ba78e){return new Promise(function(_0x23a74e,_0x47ce64){var _0x609b86=_0x3a2bfa['filter']?{[_0x3a2bfa[_0xe248('0x4')][_0xe248('0x5')]]:_0x3a2bfa['filter']['value']}:undefined;return _0xb05290[_0x3a2bfa['model']][_0xe248('0x7')]({'where':_0x609b86,'raw':!![]})[_0xe248('0x8')](function(_0x12c3ba){_0x1ba78e['associatedResources']=_[_0xe248('0xa')](_0x12c3ba,function(_0x18fb2a){return _0x18fb2a[_0xe248('0xc')];});_0x23a74e(_0x1ba78e);})[_0xe248('0xb')](function(_0x4b0470){_0x47ce64(_0x4b0470);});});}function _0x4b7b45(_0x54f434,_0x5b8486,_0x3a3ccf){if(!_0x5b8486)return Promise[_0xe248('0xd')](null);return new Promise(function(_0x3583b0,_0x3702d6){return _0xb05290[_0xe248('0xe')][_0xe248('0x7')]({'where':{'sectionId':_0x5b8486['id']},'raw':!![]})[_0xe248('0x8')](function(_0x4bd5d9){if(_0x54f434[_0xe248('0x5')]&&_0x54f434[_0xe248('0x5')]!=='id'){_0x5b8486[_0xe248('0x9')]=_[_0xe248('0xa')](_0x4bd5d9,function(_0x1beb24){return _0x1beb24[_0x54f434[_0xe248('0x5')]];});}else{if(_0x3a3ccf===_0xe248('0xf')){_0x5b8486['associatedResources']=_[_0xe248('0xa')](_0x4bd5d9,function(_0x2b11c8){return{'id':_0x2b11c8[_0xe248('0x10')],'type':_0x2b11c8[_0xe248('0x11')]};});}else{_0x5b8486[_0xe248('0x9')]=_[_0xe248('0xa')](_0x4bd5d9,function(_0x5cf562){return _0x5cf562[_0xe248('0x10')];});}}_0x3583b0(_0x5b8486);})[_0xe248('0xb')](function(_0x228053){_0x3702d6(_0x228053);});});}function _0x2e72a5(_0x921659,_0x19963c){var _0xc908f4={'parentSections':[]};switch(_0x921659['toLowerCase']()){case'squareprojects':_0xc908f4[_0xe248('0x12')]=_0xe248('0x13');break;case _0xe248('0x14'):_0xc908f4['childModel']=_0xe248('0x15');break;case _0xe248('0x16'):_0xc908f4['childModel']=_0xe248('0x17');_0xc908f4[_0xe248('0x18')]=[{'name':'SquareProjects','field':_0xe248('0xc'),'foreignKey':_0xe248('0x19')}];break;case'projects':_0xc908f4['childModel']=_0xe248('0x1a');break;case _0xe248('0x1b'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x1c');_0xc908f4[_0xe248('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0xe248('0x1d')}];break;case'lists':_0xc908f4[_0xe248('0x12')]=_0xe248('0x1e');break;case _0xe248('0x1f'):_0xc908f4[_0xe248('0x12')]='CmCompany';break;case'globalcustomfields':_0xc908f4['childModel']=_0xe248('0x20');break;case _0xe248('0x21'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x22');break;case _0xe248('0x23'):_0xc908f4['childModel']='ChatWebsite';break;case _0xe248('0x24'):_0xc908f4['childModel']=_0xe248('0x25');break;case'faxaccounts':_0xc908f4[_0xe248('0x12')]=_0xe248('0x26');break;case'inboundroutes':case _0xe248('0x27'):case _0xe248('0x28'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x29');break;case _0xe248('0x2a'):_0xc908f4['childModel']='VoiceContext';break;case _0xe248('0x2b'):_0xc908f4['childModel']=_0xe248('0x2c');break;case'voicerecordings':_0xc908f4[_0xe248('0x12')]=_0xe248('0x2d');_0xc908f4[_0xe248('0x18')]=[{'name':_0xe248('0x2e'),'field':_0xe248('0xc'),'foreignKey':_0xe248('0x2f'),'model':_0xe248('0x30'),'filter':{'field':'role','value':[_0xe248('0x31')]}},{'name':_0xe248('0x32'),'field':_0xe248('0xc'),'foreignKey':_0xe248('0x2f'),'model':'User','filter':{'field':_0xe248('0x33'),'value':[_0xe248('0x34')]}},{'name':_0xe248('0x35'),'field':_0xe248('0xc'),'foreignKey':'queue','model':_0xe248('0x36'),'filter':{'field':_0xe248('0x11'),'value':[_0xe248('0x37')]}},{'name':_0xe248('0x38'),'field':_0xe248('0xc'),'foreignKey':'queue','model':_0xe248('0x36'),'filter':{'field':_0xe248('0x11'),'value':[_0xe248('0x39')]}}];break;case _0xe248('0x3a'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x3b');break;case'chanspies':_0xc908f4[_0xe248('0x12')]=_0xe248('0x3c');break;case _0xe248('0x3d'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x3e');break;case'ivrcampaigns':_0xc908f4[_0xe248('0x12')]=_0xe248('0x3f');break;case _0xe248('0x40'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x41');break;case'mailaccounts':_0xc908f4[_0xe248('0x12')]=_0xe248('0x42');break;case'mailsubstatuses':_0xc908f4[_0xe248('0x12')]=_0xe248('0x43');break;case _0xe248('0x44'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x45');break;case _0xe248('0x46'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x47');break;case _0xe248('0x48'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x49');break;case _0xe248('0x4a'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x4b');break;case _0xe248('0x4c'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x4d');break;case _0xe248('0x4e'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x4f');break;case _0xe248('0x50'):_0xc908f4['childModel']=_0xe248('0x51');break;case _0xe248('0x52'):case _0xe248('0x53'):_0xc908f4[_0xe248('0x12')]='VoiceQueue';if(_0x19963c){_0xc908f4[_0xe248('0x18')]=[{'name':_0xe248('0x35')},{'name':_0xe248('0x38')}];}break;case _0xe248('0x54'):case'agents':case _0xe248('0x55'):_0xc908f4[_0xe248('0x12')]='User';if(_0x19963c){_0xc908f4[_0xe248('0x18')]=[{'name':_0xe248('0x56'),'filter':{'field':_0xe248('0x33'),'value':[_0xe248('0x57'),'user']},'ignore':!![]},{'name':_0xe248('0x2e')},{'name':'Telephones'}];}break;case _0xe248('0x58'):_0xc908f4[_0xe248('0x12')]='ZendeskAccount';break;case'salesforceaccounts':_0xc908f4[_0xe248('0x12')]=_0xe248('0x59');break;case _0xe248('0x5a'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x5b');break;case'sugarcrmaccounts':_0xc908f4[_0xe248('0x12')]=_0xe248('0x5c');break;case _0xe248('0x5d'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x5e');break;case _0xe248('0x5f'):_0xc908f4[_0xe248('0x12')]='ZohoAccount';break;case _0xe248('0x60'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x30');break;case _0xe248('0x61'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x62');break;case _0xe248('0x63'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x64');break;case _0xe248('0x65'):_0xc908f4['childModel']='Dashboard';break;case _0xe248('0x66'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x67');break;case _0xe248('0x68'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x69');break;case _0xe248('0x6a'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x6b');break;case'sounds':_0xc908f4[_0xe248('0x12')]=_0xe248('0x6c');break;case _0xe248('0x6d'):_0xc908f4['childModel']='Tag';break;case'templates':_0xc908f4[_0xe248('0x12')]=_0xe248('0x6e');break;case _0xe248('0x6f'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x70');break;case'trunks':_0xc908f4['childModel']='Trunk';break;case'variables':_0xc908f4[_0xe248('0x12')]='Variable';break;case _0xe248('0x71'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x72');break;case _0xe248('0x73'):_0xc908f4[_0xe248('0x12')]=_0xe248('0xf');_0xc908f4[_0xe248('0x18')]=[{'name':_0xe248('0x74'),'field':'id','foreignKey':_0xe248('0x75')}];break;case _0xe248('0x76'):_0xc908f4[_0xe248('0x12')]=_0xe248('0x77');break;}return _0xc908f4;}function _0x307f47(_0x361141,_0x1210e9){var _0x268dd1=_0x361141[_0xe248('0x78')](0x0)[_0xe248('0x79')]()+_0x361141['slice'](0x1);var _0x4cdfa1={'type':_0xb05290[_0xe248('0x7a')][_0xe248('0x7b')][_0xe248('0x7c')],'raw':!![]};return new Promise(function(_0xcd8cef,_0x11218f){var _0x468ecf=squel[_0xe248('0x7d')]()[_0xe248('0x5')](_0xe248('0x7e')+_0x268dd1+_0xe248('0x7f'),'id')['field'](_0xe248('0x80'))[_0xe248('0x81')](_0xe248('0x82')+_0x361141+_0xe248('0x83'),'ui')[_0xe248('0x84')](_0xe248('0x85'),_0x1210e9['id']);return _0xb05290[_0xe248('0x86')]['query'](_0x468ecf['toString'](),_0x4cdfa1)[_0xe248('0x8')](function(_0x5d5893){_0x1210e9[_0x268dd1+_0xe248('0x87')]=_0x5d5893;_0xcd8cef(_0x5d5893);})[_0xe248('0xb')](function(_0x5a1330){_0x11218f(_0x5a1330);});});}return _0x16c2aa[_0xe248('0x88')](_0xe248('0x89'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x58fc55){var _0x782758={'raw':_0x58fc55['query'][_0xe248('0x8a')],'where':{}};var _0x3a85e1={};var _0x3525b4={'count':0x0,'rows':[]};var _0x43115d=_0x58fc55['query'][_0xe248('0x8b')];var _0x52c532=_0x58fc55[_0xe248('0x8c')]['mergeResources']||![];var _0x59f17f=_0x2e72a5(_0x43115d,_0x52c532);if(!_0x59f17f[_0xe248('0x12')])throw new Error(_0xe248('0x8d')+_0x43115d+'\x27');var _0x1619de=[{'name':_0x43115d}];if(!_['isEmpty'](_0x59f17f[_0xe248('0x18')]))_0x1619de=_0x59f17f['parentSections'];var _0x3fa6ce=[];for(var _0x115509=0x0;_0x115509<_0x1619de[_0xe248('0x8e')];_0x115509++){_0x3fa6ce[_0xe248('0x8f')](_0xb05290['UserProfileSection'][_0xe248('0x90')]({'where':{'userProfileId':_0x58fc55[_0xe248('0x91')]['id'],'name':_0x1619de[_0x115509][_0xe248('0xc')]},'raw':!![]}));}return Promise['all'](_0x3fa6ce)['then'](function(_0x55e4c1){var _0x27b076=_[_0xe248('0x4')](_0x55e4c1,function(_0x203b74){return _0x203b74?_0x203b74:undefined;});var _0x361aa3=_[_0xe248('0x4')](_0x1619de,[_0xe248('0x92'),!![]]);var _0x1cfdc6=_['isEmpty'](_0x27b076)&&_[_0xe248('0x93')](_0x361aa3)?null:_[_0xe248('0x94')](_0x361aa3,_0x27b076);if(!_0x1cfdc6)return null;var _0x589927=[];for(var _0x52859a=0x0;_0x52859a<_0x1cfdc6[_0xe248('0x8e')];_0x52859a++){var _0x308509=_[_0xe248('0x90')](_0x1619de,function(_0x5517de){return _0x1cfdc6[_0x52859a]?_0x5517de[_0xe248('0xc')]===_0x1cfdc6[_0x52859a][_0xe248('0xc')]:null;});if(_0x308509){if(_0x1cfdc6[_0x52859a][_0xe248('0x92')]){_0x589927['push'](_0x5009e0(_0x59f17f[_0xe248('0x12')],_0x1cfdc6[_0x52859a]));}else{if(!_0x1cfdc6[_0x52859a][_0xe248('0x95')]){_0x589927[_0xe248('0x8f')](_0x4b7b45(_0x308509,_0x1cfdc6[_0x52859a],_0x59f17f[_0xe248('0x12')]));}else{if(_0x308509[_0xe248('0x96')]){_0x589927['push'](_0x2582bb(_0x308509,_0x1cfdc6[_0x52859a]));}}}}}return Promise[_0xe248('0x97')](_0x589927);})['then'](function(_0x34a69f){var _0x401847=_0x34a69f;var _0x59e7b8=null;if(_0x401847){_0x59e7b8=_0x401847[_0xe248('0x8e')]===0x1?_0x401847[0x0]:null;}if(!_0x59e7b8&&!_0x401847)return _0x3525b4;var _0x50289d=_0xb05290[_0x59f17f[_0xe248('0x12')]][_0xe248('0x98')];_0x3a85e1['model']=_['keys'](_0x50289d);_0x3a85e1[_0xe248('0x8c')]=_[_0xe248('0x99')](_0x58fc55[_0xe248('0x8c')]);_0x3a85e1[_0xe248('0x9a')]=_[_0xe248('0x9b')](_0x3a85e1[_0xe248('0x96')],_0x3a85e1[_0xe248('0x8c')]);_0x782758['attributes']=_[_0xe248('0x9b')](_0x3a85e1['model'],qs[_0xe248('0x9c')](_0x58fc55[_0xe248('0x8c')][_0xe248('0x9c')]));_0x782758[_0xe248('0x9d')]=_0x782758[_0xe248('0x9d')][_0xe248('0x8e')]?_0x782758[_0xe248('0x9d')]:_0x3a85e1[_0xe248('0x96')];if(!_0x58fc55['query'][_0xe248('0x9e')](_0xe248('0x9f'))){_0x782758['limit']=qs[_0xe248('0xa0')](_0x58fc55['query'][_0xe248('0xa0')]);_0x782758[_0xe248('0xa1')]=qs[_0xe248('0xa1')](_0x58fc55[_0xe248('0x8c')][_0xe248('0xa1')]);}_0x782758[_0xe248('0xa2')]=qs['sort'](_0x58fc55['query'][_0xe248('0xa3')]);_0x782758[_0xe248('0x84')]=qs[_0xe248('0x9a')](_[_0xe248('0xa4')](_0x58fc55[_0xe248('0x8c')],_0x3a85e1['filters']));if(_0x58fc55[_0xe248('0x8c')][_0xe248('0x4')]){_0x782758[_0xe248('0x84')]=_[_0xe248('0xa5')](_0x782758[_0xe248('0x84')],{'$or':_['map'](_0x50289d,function(_0x47cdfc){if(_0x47cdfc[_0xe248('0x11')][_0xe248('0xa6')]!=='VIRTUAL'){var _0x5f55c0={};_0x5f55c0[_0x47cdfc[_0xe248('0x5')]]={'$like':'%'+_0x58fc55[_0xe248('0x8c')][_0xe248('0x4')]+'%'};return _0x5f55c0;}})});}var _0x3100f6=[];var _0x4c19a3=null;var _0x43d0a0={};if(_0x59e7b8){_0x4c19a3=_[_0xe248('0x90')](_0x1619de,[_0xe248('0xc'),_0x59e7b8[_0xe248('0xc')]]);if(_0x4c19a3[_0xe248('0x5')]){_0x43d0a0={};if(_0x59f17f['childModel']===_0xe248('0xf')){_0x43d0a0[_0x4c19a3['foreignKey']]=_[_0xe248('0xa')](_0x59e7b8[_0xe248('0x9')],'id');}else{_0x43d0a0[_0x4c19a3[_0xe248('0xa7')]]=_0x59e7b8['associatedResources'];}_0x3100f6[_0xe248('0x8f')](_0x43d0a0);}else{_0x782758[_0xe248('0x84')]['id']=_0x59e7b8[_0xe248('0x9')];}}else{for(var _0x2b83f8=0x0;_0x2b83f8<_0x401847['length'];_0x2b83f8++){_0x4c19a3=_[_0xe248('0x90')](_0x1619de,[_0xe248('0xc'),_0x401847[_0x2b83f8][_0xe248('0xc')]]);if(_0x4c19a3[_0xe248('0x5')]){_0x43d0a0={};_0x43d0a0[_0x4c19a3[_0xe248('0xa7')]]=_0x401847[_0x2b83f8][_0xe248('0x9')];_0x3100f6['push'](_0x43d0a0);}else{if(!_0x782758[_0xe248('0x84')]['id'])_0x782758[_0xe248('0x84')]['id']=[];_0x401847[_0x2b83f8][_0xe248('0x9')][_0xe248('0xa8')](function(_0x419f7e){_0x782758[_0xe248('0x84')]['id'][_0xe248('0x8f')](_0x419f7e);});}}}if(!_[_0xe248('0x93')](_0x3100f6)){_0x782758[_0xe248('0x84')]=_[_0xe248('0xa5')](_0x782758['where'],{'$and':{'$or':_0x3100f6}});}_0x782758=_[_0xe248('0xa5')]({},_0x782758,_0x58fc55[_0xe248('0xa9')]);if(_0x59e7b8&&!_0x59e7b8['autoAssociation']&&_0x59f17f[_0xe248('0x12')]==='AnalyticExtractedReport'){if(_0x58fc55[_0xe248('0x8c')]['includeAll']){_0x782758[_0xe248('0xaa')]=[{'all':!![]}];}return _0xb05290[_0x59f17f['childModel']][_0xe248('0x7')](_0x782758)[_0xe248('0x8')](function(_0x1ee0de){var _0x26f160=[];_0x1ee0de[_0xe248('0xa8')](function(_0x46e47c){var _0x1d411c;switch(_0x46e47c['reportType']){case _0xe248('0xab'):_0x1d411c=_[_0xe248('0x90')](_0x59e7b8[_0xe248('0x9')],function(_0x45c3d2){return _0x45c3d2['id']===_0x46e47c['reportId']&&_0x45c3d2[_0xe248('0x11')]===_0xe248('0xac');});break;case'custom':_0x1d411c=_['find'](_0x59e7b8[_0xe248('0x9')],function(_0xbef2f2){return _0xbef2f2['id']===_0x46e47c[_0xe248('0x75')]&&_0xbef2f2[_0xe248('0x11')]==='CustomReports';});break;}if(_0x1d411c)_0x26f160[_0xe248('0x8f')](_0x46e47c);});_0x3525b4[_0xe248('0xad')]=_0x26f160[_0xe248('0x8e')];_0x3525b4[_0xe248('0xae')]=_0x26f160;return _0x3525b4;});}else{return _0xb05290[_0x59f17f[_0xe248('0x12')]][_0xe248('0xad')]({'where':_0x782758[_0xe248('0x84')]})['then'](function(_0x5c40c6){_0x3525b4[_0xe248('0xad')]=_0x5c40c6;if(_0x58fc55[_0xe248('0x8c')][_0xe248('0xaf')]){if(_0x59f17f[_0xe248('0x12')]===_0xe248('0x1c')){_0x782758[_0xe248('0xaa')]=[{'model':_0xb05290[_0xe248('0xb0')],'as':_0xe248('0xb1'),'attributes':['id',_0xe248('0xc'),'color'],'required':_0x58fc55[_0xe248('0x8c')][_0xe248('0xb2')]?!![]:![]},{'model':_0xb05290[_0xe248('0xb0')],'as':'ThroughTags','attributes':['id',_0xe248('0xc'),_0xe248('0xb3')],'through':_0x58fc55[_0xe248('0x8c')][_0xe248('0xb2')]?{'attributes':[],'where':{'TagId':_0x58fc55['query']['tag']||undefined}}:{},'required':_0x58fc55[_0xe248('0x8c')]['tag']?!![]:![]}];}else{_0x782758[_0xe248('0xaa')]=[{'all':!![]}];}}return _0xb05290[_0x59f17f[_0xe248('0x12')]][_0xe248('0x7')](_0x782758);})['then'](function(_0x15b1ff){_0x3525b4[_0xe248('0xae')]=_0x15b1ff;if(_0x43115d==='Agents'&&_0x58fc55['query'][_0xe248('0xb4')]===_0xe248('0xb5')){var _0x473bbd=[];for(var _0x3baa41=0x0;_0x3baa41<_0x3525b4[_0xe248('0xae')]['length'];_0x3baa41++){_0x473bbd[_0xe248('0x8f')](_0x307f47(_0xe248('0xb6'),_0x3525b4['rows'][_0x3baa41][_0xe248('0xb7')]));_0x473bbd[_0xe248('0x8f')](_0x307f47(_0xe248('0xb8'),_0x3525b4[_0xe248('0xae')][_0x3baa41][_0xe248('0xb7')]));_0x473bbd['push'](_0x307f47(_0xe248('0xb9'),_0x3525b4[_0xe248('0xae')][_0x3baa41][_0xe248('0xb7')]));_0x473bbd[_0xe248('0x8f')](_0x307f47(_0xe248('0xba'),_0x3525b4['rows'][_0x3baa41][_0xe248('0xb7')]));_0x473bbd[_0xe248('0x8f')](_0x307f47(_0xe248('0xbb'),_0x3525b4[_0xe248('0xae')][_0x3baa41][_0xe248('0xb7')]));_0x473bbd[_0xe248('0x8f')](_0x307f47(_0xe248('0xbc'),_0x3525b4['rows'][_0x3baa41][_0xe248('0xb7')]));}return Promise['all'](_0x473bbd)[_0xe248('0x8')](function(){return _0x3525b4;});}return _0x3525b4;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ccad7d8..67a8b0e 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 _0xe635=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x1f81f5,_0x42aa67){var _0x4c9e93=function(_0x473119){while(--_0x473119){_0x1f81f5['push'](_0x1f81f5['shift']());}};_0x4c9e93(++_0x42aa67);}(_0xe635,0x1be));var _0x5e63=function(_0x5f1204,_0x92b018){_0x5f1204=_0x5f1204-0x0;var _0x44cf32=_0xe635[_0x5f1204];return _0x44cf32;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var rs=require(_0x5e63('0x4'));var fs=require('fs');var Redis=require(_0x5e63('0x5'));var db=require(_0x5e63('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e63('0x7'));var config=require(_0x5e63('0x8'));var jayson=require(_0x5e63('0x9'));var client=jayson[_0x5e63('0xa')][_0x5e63('0xb')]({'port':0x232a});config[_0x5e63('0xc')]=_[_0x5e63('0xd')](config[_0x5e63('0xc')],{'host':_0x5e63('0xe'),'port':0x18eb});var socket=require(_0x5e63('0xf'))(new Redis(config['redis']));require(_0x5e63('0x10'))[_0x5e63('0x11')](socket);function respondWithRpcPromise(_0x307b83,_0x1b8208,_0x5d025f){return new BPromise(function(_0xd64e99,_0x2e9340){return client['request'](_0x307b83,_0x5d025f)[_0x5e63('0x12')](function(_0x2ac738){logger['info'](_0x5e63('0x13'),_0x1b8208,'request\x20sent');logger[_0x5e63('0x14')](_0x5e63('0x15'),_0x1b8208,_0x5e63('0x16'),JSON[_0x5e63('0x17')](_0x2ac738));if(_0x2ac738['error']){if(_0x2ac738['error']['code']===0x1f4){logger[_0x5e63('0x18')](_0x5e63('0x13'),_0x1b8208,_0x2ac738['error'][_0x5e63('0x19')]);return _0x2e9340(_0x2ac738[_0x5e63('0x18')][_0x5e63('0x19')]);}logger['error'](_0x5e63('0x13'),_0x1b8208,_0x2ac738[_0x5e63('0x18')][_0x5e63('0x19')]);return _0xd64e99(_0x2ac738[_0x5e63('0x18')][_0x5e63('0x19')]);}else{logger['info'](_0x5e63('0x13'),_0x1b8208,_0x5e63('0x16'));_0xd64e99(_0x2ac738[_0x5e63('0x1a')][_0x5e63('0x19')]);}})[_0x5e63('0x1b')](function(_0x4a6013){logger[_0x5e63('0x18')]('UserProfile,\x20%s,\x20%s',_0x1b8208,_0x4a6013);_0x2e9340(_0x4a6013);});});} \ No newline at end of file +var _0x1d63=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d4567,_0x607422){var _0x4403ed=function(_0x506c29){while(--_0x506c29){_0x3d4567['push'](_0x3d4567['shift']());}};_0x4403ed(++_0x607422);}(_0x1d63,0xa4));var _0x31d6=function(_0x56b52b,_0x47abbe){_0x56b52b=_0x56b52b-0x0;var _0x2f5097=_0x1d63[_0x56b52b];return _0x2f5097;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var moment=require(_0x31d6('0x2'));var BPromise=require(_0x31d6('0x3'));var rs=require(_0x31d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d6('0x5'))['db'];var utils=require(_0x31d6('0x6'));var logger=require(_0x31d6('0x7'))(_0x31d6('0x8'));var config=require(_0x31d6('0x9'));var jayson=require(_0x31d6('0xa'));var client=jayson[_0x31d6('0xb')]['http']({'port':0x232a});config[_0x31d6('0xc')]=_[_0x31d6('0xd')](config['redis'],{'host':_0x31d6('0xe'),'port':0x18eb});var socket=require(_0x31d6('0xf'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x2962d5,_0x341424,_0x309039){return new BPromise(function(_0x5f00b8,_0x12d5cc){return client[_0x31d6('0x10')](_0x2962d5,_0x309039)[_0x31d6('0x11')](function(_0x2e79f9){logger[_0x31d6('0x12')]('UserProfile,\x20%s,\x20%s',_0x341424,_0x31d6('0x13'));logger[_0x31d6('0x14')](_0x31d6('0x15'),_0x341424,_0x31d6('0x13'),JSON[_0x31d6('0x16')](_0x2e79f9));if(_0x2e79f9[_0x31d6('0x17')]){if(_0x2e79f9['error'][_0x31d6('0x18')]===0x1f4){logger[_0x31d6('0x17')](_0x31d6('0x19'),_0x341424,_0x2e79f9[_0x31d6('0x17')]['message']);return _0x12d5cc(_0x2e79f9[_0x31d6('0x17')]['message']);}logger[_0x31d6('0x17')](_0x31d6('0x19'),_0x341424,_0x2e79f9[_0x31d6('0x17')][_0x31d6('0x1a')]);return _0x5f00b8(_0x2e79f9[_0x31d6('0x17')][_0x31d6('0x1a')]);}else{logger['info'](_0x31d6('0x19'),_0x341424,_0x31d6('0x13'));_0x5f00b8(_0x2e79f9[_0x31d6('0x1b')][_0x31d6('0x1a')]);}})[_0x31d6('0x1c')](function(_0x19a279){logger['error'](_0x31d6('0x19'),_0x341424,_0x19a279);_0x12d5cc(_0x19a279);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9cb355e..7996f3d 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 _0x2e35=['length','./userProfile.events','save','remove','update','emit','register'];(function(_0x327ca1,_0x324e52){var _0x347ce5=function(_0x2f0260){while(--_0x2f0260){_0x327ca1['push'](_0x327ca1['shift']());}};_0x347ce5(++_0x324e52);}(_0x2e35,0x1dd));var _0x52e3=function(_0xb00ef,_0x590edd){_0xb00ef=_0xb00ef-0x0;var _0x3cc5a4=_0x2e35[_0xb00ef];return _0x3cc5a4;};'use strict';var UserProfileEvents=require(_0x52e3('0x0'));var events=[_0x52e3('0x1'),_0x52e3('0x2'),_0x52e3('0x3')];function createListener(_0x3d95ca,_0x115f9f){return function(_0x4eb6a9){_0x115f9f[_0x52e3('0x4')](_0x3d95ca,_0x4eb6a9);};}function removeListener(_0x40f637,_0x257296){return function(){UserProfileEvents['removeListener'](_0x40f637,_0x257296);};}exports[_0x52e3('0x5')]=function(_0x30831e){for(var _0x3840a9=0x0,_0x89ada9=events[_0x52e3('0x6')];_0x3840a9<_0x89ada9;_0x3840a9++){var _0x444065=events[_0x3840a9];var _0x1cec58=createListener('userProfile:'+_0x444065,_0x30831e);UserProfileEvents['on'](_0x444065,_0x1cec58);}}; \ No newline at end of file +var _0x217c=['update','removeListener','length','userProfile:','save','remove'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x217c,0x17e));var _0xc217=function(_0x43ccb6,_0x4f75fe){_0x43ccb6=_0x43ccb6-0x0;var _0x4de792=_0x217c[_0x43ccb6];return _0x4de792;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xc217('0x0'),_0xc217('0x1'),_0xc217('0x2')];function createListener(_0x43ffad,_0x7f1f6){return function(_0x2c0e16){_0x7f1f6['emit'](_0x43ffad,_0x2c0e16);};}function removeListener(_0x4e199c,_0x1d088d){return function(){UserProfileEvents[_0xc217('0x3')](_0x4e199c,_0x1d088d);};}exports['register']=function(_0x1e5c10){for(var _0x6741e6=0x0,_0x22c7bf=events[_0xc217('0x4')];_0x6741e6<_0x22c7bf;_0x6741e6++){var _0x7db454=events[_0x6741e6];var _0x4f4b54=createListener(_0xc217('0x5')+_0x7db454,_0x1e5c10);UserProfileEvents['on'](_0x7db454,_0x4f4b54);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0f3e94a..32216f3 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 _0xb0c5=['express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4e20a6,_0x4b17bf){var _0xfb718d=function(_0x292e4d){while(--_0x292e4d){_0x4e20a6['push'](_0x4e20a6['shift']());}};_0xfb718d(++_0x4b17bf);}(_0xb0c5,0x1a1));var _0x5b0c=function(_0x50eab1,_0x5b440a){_0x50eab1=_0x50eab1-0x0;var _0x191643=_0xb0c5[_0x50eab1];return _0x191643;};'use strict';var multer=require(_0x5b0c('0x0'));var util=require(_0x5b0c('0x1'));var path=require('path');var timeout=require(_0x5b0c('0x2'));var express=require(_0x5b0c('0x3'));var router=express[_0x5b0c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5b0c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b0c('0x6'));var controller=require(_0x5b0c('0x7'));router['get']('/',auth[_0x5b0c('0x8')](),controller[_0x5b0c('0x9')]);router[_0x5b0c('0xa')]('/describe',auth[_0x5b0c('0x8')](),controller[_0x5b0c('0xb')]);router[_0x5b0c('0xa')](_0x5b0c('0xc'),auth['isAuthenticated'](),controller[_0x5b0c('0xd')]);router[_0x5b0c('0xe')]('/',auth['isAuthenticated'](),controller[_0x5b0c('0xf')]);router[_0x5b0c('0x10')](_0x5b0c('0xc'),auth[_0x5b0c('0x8')](),controller[_0x5b0c('0x11')]);router[_0x5b0c('0x12')](_0x5b0c('0xc'),auth[_0x5b0c('0x8')](),controller[_0x5b0c('0x13')]);module[_0x5b0c('0x14')]=router; \ No newline at end of file +var _0x9541=['../../components/interaction/service','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5aa26f,_0x5e32fc){var _0x7e1a26=function(_0x5d9328){while(--_0x5d9328){_0x5aa26f['push'](_0x5aa26f['shift']());}};_0x7e1a26(++_0x5e32fc);}(_0x9541,0xea));var _0x1954=function(_0x5dfb08,_0x5ab50a){_0x5dfb08=_0x5dfb08-0x0;var _0xc42f9e=_0x9541[_0x5dfb08];return _0xc42f9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1954('0x0'));var timeout=require(_0x1954('0x1'));var express=require(_0x1954('0x2'));var router=express[_0x1954('0x3')]();var fs_extra=require(_0x1954('0x4'));var auth=require(_0x1954('0x5'));var interaction=require(_0x1954('0x6'));var config=require('../../config/environment');var controller=require(_0x1954('0x7'));router['get']('/',auth[_0x1954('0x8')](),controller[_0x1954('0x9')]);router[_0x1954('0xa')](_0x1954('0xb'),auth[_0x1954('0x8')](),controller[_0x1954('0xc')]);router[_0x1954('0xa')]('/:id',auth[_0x1954('0x8')](),controller[_0x1954('0xd')]);router[_0x1954('0xe')]('/',auth[_0x1954('0x8')](),controller['create']);router[_0x1954('0xf')]('/:id',auth[_0x1954('0x8')](),controller[_0x1954('0x10')]);router[_0x1954('0x11')]('/:id',auth[_0x1954('0x8')](),controller[_0x1954('0x12')]);module[_0x1954('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 477c883..f0673ff 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 _0xaddd=['INTEGER','sequelize','exports','STRING'];(function(_0x3b680f,_0x3dadbd){var _0x3c77ab=function(_0x1dfd06){while(--_0x1dfd06){_0x3b680f['push'](_0x3b680f['shift']());}};_0x3c77ab(++_0x3dadbd);}(_0xaddd,0x1ad));var _0xdadd=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xaddd[_0x58965a];return _0x254efc;};'use strict';var Sequelize=require(_0xdadd('0x0'));module[_0xdadd('0x1')]={'name':{'type':Sequelize[_0xdadd('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xdadd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdadd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2a75=['INTEGER','STRING','sequelize','exports'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x2a75,0xc2));var _0x52a7=function(_0x50e044,_0x2dc64f){_0x50e044=_0x50e044-0x0;var _0x47822e=_0x2a75[_0x50e044];return _0x47822e;};'use strict';var Sequelize=require(_0x52a7('0x0'));module[_0x52a7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x52a7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x52a7('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index b10f34c..259d101 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 _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x149b25,_0x2bb415){var _0x40b742=function(_0x103584){while(--_0x103584){_0x149b25['push'](_0x149b25['shift']());}};_0x40b742(++_0x2bb415);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['UserProfileResource'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file +var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x3befca,_0x42ff2c){var _0x513141=function(_0x510ded){while(--_0x510ded){_0x3befca['push'](_0x3befca['shift']());}};_0x513141(++_0x42ff2c);}(_0x90b1,0x1bb));var _0x190b=function(_0x3aebbf,_0x4bac97){_0x3aebbf=_0x3aebbf-0x0;var _0x1ce3f6=_0x90b1[_0x3aebbf];return _0x1ce3f6;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['UserProfileResource'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ce0f456..d324074 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 _0x91d3=['UserProfileResource','user_profile_has_resources','resourceId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x20791f,_0x18bf5f){var _0x40889b=function(_0x306650){while(--_0x306650){_0x20791f['push'](_0x20791f['shift']());}};_0x40889b(++_0x18bf5f);}(_0x91d3,0x85));var _0x391d=function(_0x130e47,_0x148dd6){_0x130e47=_0x130e47-0x0;var _0x5cd996=_0x91d3[_0x130e47];return _0x5cd996;};'use strict';var _=require(_0x391d('0x0'));var util=require('util');var logger=require(_0x391d('0x1'))(_0x391d('0x2'));var moment=require('moment');var BPromise=require(_0x391d('0x3'));var rp=require(_0x391d('0x4'));var fs=require('fs');var path=require(_0x391d('0x5'));var rimraf=require(_0x391d('0x6'));var config=require(_0x391d('0x7'));var attributes=require(_0x391d('0x8'));module[_0x391d('0x9')]=function(_0x1c1503,_0x58c176){return _0x1c1503['define'](_0x391d('0xa'),attributes,{'tableName':_0x391d('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x391d('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x98af=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x4e658c,_0x3139a5){var _0x3a2973=function(_0x479a80){while(--_0x479a80){_0x4e658c['push'](_0x4e658c['shift']());}};_0x3a2973(++_0x3139a5);}(_0x98af,0x1ce));var _0xf98a=function(_0x2539e6,_0x595d36){_0x2539e6=_0x2539e6-0x0;var _0xe83570=_0x98af[_0x2539e6];return _0xe83570;};'use strict';var _=require(_0xf98a('0x0'));var util=require(_0xf98a('0x1'));var logger=require(_0xf98a('0x2'))('api');var moment=require(_0xf98a('0x3'));var BPromise=require(_0xf98a('0x4'));var rp=require(_0xf98a('0x5'));var fs=require('fs');var path=require(_0xf98a('0x6'));var rimraf=require(_0xf98a('0x7'));var config=require(_0xf98a('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xf98a('0x9')]=function(_0x28df2e,_0x5e625e){return _0x28df2e[_0xf98a('0xa')]('UserProfileResource',attributes,{'tableName':_0xf98a('0xb'),'paranoid':![],'indexes':[{'name':_0xf98a('0xc'),'fields':[_0xf98a('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c88149e..f84bb3a 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 _0xffaa=['../../mysqldb','../../config/utils','rpc','../../config/environment','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4d6d87,_0x312568){var _0xa36fd=function(_0x234e84){while(--_0x234e84){_0x4d6d87['push'](_0x4d6d87['shift']());}};_0xa36fd(++_0x312568);}(_0xffaa,0x1e0));var _0xaffa=function(_0x3957dc,_0x525687){_0x3957dc=_0x3957dc-0x0;var _0x107bc4=_0xffaa[_0x3957dc];return _0x107bc4;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var moment=require(_0xaffa('0x2'));var BPromise=require(_0xaffa('0x3'));var rs=require(_0xaffa('0x4'));var fs=require('fs');var Redis=require(_0xaffa('0x5'));var db=require(_0xaffa('0x6'))['db'];var utils=require(_0xaffa('0x7'));var logger=require('../../config/logger')(_0xaffa('0x8'));var config=require(_0xaffa('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21298c,_0x2c0d61,_0x5a6ea6){return new BPromise(function(_0x2e37b6,_0xb9dfb3){return client['request'](_0x21298c,_0x5a6ea6)['then'](function(_0x38189e){logger[_0xaffa('0xa')](_0xaffa('0xb'),_0x2c0d61,_0xaffa('0xc'));logger[_0xaffa('0xd')](_0xaffa('0xe'),_0x2c0d61,_0xaffa('0xc'),JSON['stringify'](_0x38189e));if(_0x38189e[_0xaffa('0xf')]){if(_0x38189e[_0xaffa('0xf')]['code']===0x1f4){logger[_0xaffa('0xf')](_0xaffa('0xb'),_0x2c0d61,_0x38189e[_0xaffa('0xf')][_0xaffa('0x10')]);return _0xb9dfb3(_0x38189e['error'][_0xaffa('0x10')]);}logger[_0xaffa('0xf')](_0xaffa('0xb'),_0x2c0d61,_0x38189e[_0xaffa('0xf')][_0xaffa('0x10')]);return _0x2e37b6(_0x38189e['error'][_0xaffa('0x10')]);}else{logger[_0xaffa('0xa')](_0xaffa('0xb'),_0x2c0d61,'request\x20sent');_0x2e37b6(_0x38189e[_0xaffa('0x11')][_0xaffa('0x10')]);}})['catch'](function(_0x302a64){logger[_0xaffa('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x2c0d61,_0x302a64);_0xb9dfb3(_0x302a64);});});} \ No newline at end of file +var _0x2b99=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd7f314,_0x176c1a){var _0x41c0ca=function(_0x37298f){while(--_0x37298f){_0xd7f314['push'](_0xd7f314['shift']());}};_0x41c0ca(++_0x176c1a);}(_0x2b99,0x1a5));var _0x92b9=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x2b99[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var moment=require(_0x92b9('0x2'));var BPromise=require(_0x92b9('0x3'));var rs=require(_0x92b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b9('0x5'))['db'];var utils=require(_0x92b9('0x6'));var logger=require(_0x92b9('0x7'))('rpc');var config=require(_0x92b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92b9('0x9')][_0x92b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435056,_0x47248d,_0x489fc1){return new BPromise(function(_0x5f440c,_0x4ede85){return client['request'](_0x435056,_0x489fc1)['then'](function(_0x45263d){logger[_0x92b9('0xb')](_0x92b9('0xc'),_0x47248d,_0x92b9('0xd'));logger[_0x92b9('0xe')](_0x92b9('0xf'),_0x47248d,_0x92b9('0xd'),JSON[_0x92b9('0x10')](_0x45263d));if(_0x45263d[_0x92b9('0x11')]){if(_0x45263d[_0x92b9('0x11')][_0x92b9('0x12')]===0x1f4){logger[_0x92b9('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x47248d,_0x45263d['error']['message']);return _0x4ede85(_0x45263d['error'][_0x92b9('0x13')]);}logger[_0x92b9('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x47248d,_0x45263d[_0x92b9('0x11')][_0x92b9('0x13')]);return _0x5f440c(_0x45263d['error'][_0x92b9('0x13')]);}else{logger[_0x92b9('0xb')](_0x92b9('0xc'),_0x47248d,_0x92b9('0xd'));_0x5f440c(_0x45263d['result'][_0x92b9('0x13')]);}})[_0x92b9('0x14')](function(_0x3b3ad0){logger[_0x92b9('0x11')](_0x92b9('0xc'),_0x47248d,_0x3b3ad0);_0x4ede85(_0x3b3ad0);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index f5b8f21..5ccadcf 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 _0xfd77=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','show','post','create','/:id','update','delete','destroy','multer','util'];(function(_0x48003a,_0x3506bd){var _0x2844d2=function(_0x97404f){while(--_0x97404f){_0x48003a['push'](_0x48003a['shift']());}};_0x2844d2(++_0x3506bd);}(_0xfd77,0xc6));var _0x7fd7=function(_0x388285,_0x3a0701){_0x388285=_0x388285-0x0;var _0x4493be=_0xfd77[_0x388285];return _0x4493be;};'use strict';var multer=require(_0x7fd7('0x0'));var util=require(_0x7fd7('0x1'));var path=require(_0x7fd7('0x2'));var timeout=require(_0x7fd7('0x3'));var express=require(_0x7fd7('0x4'));var router=express['Router']();var fs_extra=require(_0x7fd7('0x5'));var auth=require(_0x7fd7('0x6'));var interaction=require(_0x7fd7('0x7'));var config=require('../../config/environment');var controller=require(_0x7fd7('0x8'));router[_0x7fd7('0x9')]('/',auth['isAuthenticated'](),controller[_0x7fd7('0xa')]);router[_0x7fd7('0x9')](_0x7fd7('0xb'),auth[_0x7fd7('0xc')](),controller['describe']);router['get']('/:id',auth[_0x7fd7('0xc')](),controller[_0x7fd7('0xd')]);router[_0x7fd7('0xe')]('/',auth[_0x7fd7('0xc')](),controller[_0x7fd7('0xf')]);router['put'](_0x7fd7('0x10'),auth['isAuthenticated'](),controller[_0x7fd7('0x11')]);router[_0x7fd7('0x12')](_0x7fd7('0x10'),auth[_0x7fd7('0xc')](),controller[_0x7fd7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x51b0=['index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated'];(function(_0x23d1f4,_0x4bd44a){var _0x393217=function(_0xbd5240){while(--_0xbd5240){_0x23d1f4['push'](_0x23d1f4['shift']());}};_0x393217(++_0x4bd44a);}(_0x51b0,0x197));var _0x051b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x51b0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x051b('0x0'));var util=require('util');var path=require(_0x051b('0x1'));var timeout=require('connect-timeout');var express=require(_0x051b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x051b('0x3'));var config=require('../../config/environment');var controller=require(_0x051b('0x4'));router[_0x051b('0x5')]('/',auth[_0x051b('0x6')](),controller[_0x051b('0x7')]);router['get']('/describe',auth[_0x051b('0x6')](),controller[_0x051b('0x8')]);router[_0x051b('0x5')](_0x051b('0x9'),auth['isAuthenticated'](),controller[_0x051b('0xa')]);router[_0x051b('0xb')]('/',auth[_0x051b('0x6')](),controller[_0x051b('0xc')]);router[_0x051b('0xd')](_0x051b('0x9'),auth[_0x051b('0x6')](),controller[_0x051b('0xe')]);router[_0x051b('0xf')](_0x051b('0x9'),auth[_0x051b('0x6')](),controller[_0x051b('0x10')]);module[_0x051b('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e33f553..36ae994 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 _0x955f=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x1cc275,_0x1d8059){var _0x35abe1=function(_0x568eef){while(--_0x568eef){_0x1cc275['push'](_0x1cc275['shift']());}};_0x35abe1(++_0x1d8059);}(_0x955f,0x1eb));var _0xf955=function(_0x610c38,_0x3413bf){_0x610c38=_0x610c38-0x0;var _0x231121=_0x955f[_0x610c38];return _0x231121;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf955('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf955('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5d0c95){this[_0xf955('0x5')]('crudPermissions',_0x5d0c95?_0x5d0c95[_0xf955('0x6')](''):[]);},'get':function(){return this[_0xf955('0x7')](_0xf955('0x8'))?this['getDataValue'](_0xf955('0x8'))[_0xf955('0x9')](''):[];}}}; \ No newline at end of file +var _0xac4a=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x239239,_0x1a3c17){var _0x1295ba=function(_0x30cd3f){while(--_0x30cd3f){_0x239239['push'](_0x239239['shift']());}};_0x1295ba(++_0x1a3c17);}(_0xac4a,0x13f));var _0xaac4=function(_0x1afb16,_0x154028){_0x1afb16=_0x1afb16-0x0;var _0xab6c55=_0xac4a[_0x1afb16];return _0xab6c55;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaac4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2af0f6){this[_0xaac4('0x5')](_0xaac4('0x6'),_0x2af0f6?_0x2af0f6['join'](''):[]);},'get':function(){return this[_0xaac4('0x7')]('crudPermissions')?this[_0xaac4('0x7')]('crudPermissions')[_0xaac4('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index bdb4067..977638b 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 _0x7d88=['count','set','json','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','UserProfileSection','include','findAll','rows','catch','show','params','includeAll','find','create','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','offset','undefined','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d88,0x10a));var _0x87d8=function(_0x19a6dc,_0x82eae7){_0x19a6dc=_0x19a6dc-0x0;var _0xec140c=_0x7d88[_0x19a6dc];return _0xec140c;};'use strict';var emlformat=require(_0x87d8('0x0'));var rimraf=require(_0x87d8('0x1'));var zipdir=require(_0x87d8('0x2'));var jsonpatch=require(_0x87d8('0x3'));var rp=require(_0x87d8('0x4'));var moment=require('moment');var BPromise=require(_0x87d8('0x5'));var Mustache=require(_0x87d8('0x6'));var util=require(_0x87d8('0x7'));var path=require(_0x87d8('0x8'));var sox=require(_0x87d8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d8('0xa'));var squel=require(_0x87d8('0xb'));var crypto=require('crypto');var jsforce=require(_0x87d8('0xc'));var deskjs=require(_0x87d8('0xd'));var toCsv=require(_0x87d8('0xe'));var querystring=require(_0x87d8('0xf'));var Papa=require(_0x87d8('0x10'));var Redis=require(_0x87d8('0x11'));var authService=require(_0x87d8('0x12'));var qs=require(_0x87d8('0x13'));var as=require(_0x87d8('0x14'));var hardwareService=require(_0x87d8('0x15'));var logger=require('../../config/logger')(_0x87d8('0x16'));var utils=require(_0x87d8('0x17'));var config=require(_0x87d8('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35db68,_0x41883a){_0x41883a=_0x41883a||0xcc;return function(_0x3b9725){if(_0x3b9725){return _0x35db68['sendStatus'](_0x41883a);}return _0x35db68[_0x87d8('0x19')](_0x41883a)[_0x87d8('0x1a')]();};}function respondWithResult(_0x35cea3,_0x24aa76){_0x24aa76=_0x24aa76||0xc8;return function(_0x200436){if(_0x200436){return _0x35cea3[_0x87d8('0x19')](_0x24aa76)['json'](_0x200436);}};}function respondWithFilteredResult(_0x46ca49,_0x3b59ca){return function(_0x1c36b9){if(_0x1c36b9){var _0x40c25f=typeof _0x3b59ca[_0x87d8('0x1b')]===_0x87d8('0x1c')&&typeof _0x3b59ca[_0x87d8('0x1d')]===_0x87d8('0x1c');var _0x20ea4d=_0x1c36b9[_0x87d8('0x1e')];var _0x38de4a=_0x40c25f?0x0:_0x3b59ca[_0x87d8('0x1b')];var _0x200f49=_0x40c25f?_0x1c36b9[_0x87d8('0x1e')]:_0x3b59ca['offset']+_0x3b59ca[_0x87d8('0x1d')];var _0x45e58c;if(_0x200f49>=_0x20ea4d){_0x200f49=_0x20ea4d;_0x45e58c=0xc8;}else{_0x45e58c=0xce;}_0x46ca49['status'](_0x45e58c);return _0x46ca49[_0x87d8('0x1f')]('Content-Range',_0x38de4a+'-'+_0x200f49+'/'+_0x20ea4d)[_0x87d8('0x20')](_0x1c36b9);}return null;};}function patchUpdates(_0x38290b){return function(_0x459fb2){try{jsonpatch['apply'](_0x459fb2,_0x38290b,!![]);}catch(_0x457c1a){return BPromise['reject'](_0x457c1a);}return _0x459fb2['save']();};}function saveUpdates(_0x44b2,_0x12aed7){return function(_0x25fb41){if(_0x25fb41){return _0x25fb41['update'](_0x44b2)[_0x87d8('0x21')](function(_0x268e5e){return _0x268e5e;});}return null;};}function removeEntity(_0x201543,_0x2a20ac){return function(_0x5393d0){if(_0x5393d0){return _0x5393d0[_0x87d8('0x22')]()[_0x87d8('0x21')](function(){_0x201543[_0x87d8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ce877,_0xf6861d){return function(_0x12dfc8){if(!_0x12dfc8){_0x4ce877[_0x87d8('0x23')](0x194);}return _0x12dfc8;};}function handleError(_0x57fe31,_0x43fcb2){_0x43fcb2=_0x43fcb2||0x1f4;return function(_0x36fbd5){logger[_0x87d8('0x24')](_0x36fbd5[_0x87d8('0x25')]);if(_0x36fbd5[_0x87d8('0x26')]){delete _0x36fbd5[_0x87d8('0x26')];}_0x57fe31[_0x87d8('0x19')](_0x43fcb2)[_0x87d8('0x27')](_0x36fbd5);};}exports[_0x87d8('0x28')]=function(_0x29c765,_0x316e16){var _0x7f4223={},_0x3d3add={},_0x11d8a2={'count':0x0,'rows':[]};var _0x10d7f8=_[_0x87d8('0x29')](db['UserProfileSection'][_0x87d8('0x2a')],function(_0x4f7e02){return{'name':_0x4f7e02[_0x87d8('0x2b')],'type':_0x4f7e02[_0x87d8('0x2c')]['key']};});_0x3d3add[_0x87d8('0x2d')]=_[_0x87d8('0x29')](_0x10d7f8,_0x87d8('0x26'));_0x3d3add[_0x87d8('0x2e')]=_[_0x87d8('0x2f')](_0x29c765[_0x87d8('0x2e')]);_0x3d3add['filters']=_[_0x87d8('0x30')](_0x3d3add[_0x87d8('0x2d')],_0x3d3add[_0x87d8('0x2e')]);_0x7f4223[_0x87d8('0x31')]=_[_0x87d8('0x30')](_0x3d3add[_0x87d8('0x2d')],qs[_0x87d8('0x32')](_0x29c765['query'][_0x87d8('0x32')]));_0x7f4223['attributes']=_0x7f4223[_0x87d8('0x31')][_0x87d8('0x33')]?_0x7f4223['attributes']:_0x3d3add['model'];if(!_0x29c765[_0x87d8('0x2e')][_0x87d8('0x34')](_0x87d8('0x35'))){_0x7f4223['limit']=qs[_0x87d8('0x1d')](_0x29c765[_0x87d8('0x2e')][_0x87d8('0x1d')]);_0x7f4223[_0x87d8('0x1b')]=qs[_0x87d8('0x1b')](_0x29c765['query']['offset']);}_0x7f4223[_0x87d8('0x36')]=qs[_0x87d8('0x37')](_0x29c765[_0x87d8('0x2e')][_0x87d8('0x37')]);_0x7f4223[_0x87d8('0x38')]=qs[_0x87d8('0x39')](_['pick'](_0x29c765[_0x87d8('0x2e')],_0x3d3add[_0x87d8('0x39')]),_0x10d7f8);if(_0x29c765[_0x87d8('0x2e')]['filter']){_0x7f4223['where']=_[_0x87d8('0x3a')](_0x7f4223[_0x87d8('0x38')],{'$or':_[_0x87d8('0x29')](_0x10d7f8,function(_0x41fd09){if(_0x41fd09[_0x87d8('0x2c')]!==_0x87d8('0x3b')){var _0x525263={};_0x525263[_0x41fd09[_0x87d8('0x26')]]={'$like':'%'+_0x29c765[_0x87d8('0x2e')][_0x87d8('0x3c')]+'%'};return _0x525263;}})});}_0x7f4223=_[_0x87d8('0x3a')]({},_0x7f4223,_0x29c765[_0x87d8('0x3d')]);var _0x2a0833={'where':_0x7f4223[_0x87d8('0x38')]};return db[_0x87d8('0x3e')][_0x87d8('0x1e')](_0x2a0833)[_0x87d8('0x21')](function(_0x347fcb){_0x11d8a2[_0x87d8('0x1e')]=_0x347fcb;if(_0x29c765[_0x87d8('0x2e')]['includeAll']){_0x7f4223[_0x87d8('0x3f')]=[{'all':!![]}];}return db[_0x87d8('0x3e')][_0x87d8('0x40')](_0x7f4223);})[_0x87d8('0x21')](function(_0x233933){_0x11d8a2[_0x87d8('0x41')]=_0x233933;return _0x11d8a2;})['then'](respondWithFilteredResult(_0x316e16,_0x7f4223))[_0x87d8('0x42')](handleError(_0x316e16,null));};exports[_0x87d8('0x43')]=function(_0x515f6e,_0x5d1128){var _0x802ad={'raw':![],'where':{'id':_0x515f6e[_0x87d8('0x44')]['id']}},_0x4439b3={};_0x4439b3[_0x87d8('0x2d')]=_[_0x87d8('0x2f')](db[_0x87d8('0x3e')][_0x87d8('0x2a')]);_0x4439b3[_0x87d8('0x2e')]=_[_0x87d8('0x2f')](_0x515f6e[_0x87d8('0x2e')]);_0x4439b3[_0x87d8('0x39')]=_[_0x87d8('0x30')](_0x4439b3[_0x87d8('0x2d')],_0x4439b3[_0x87d8('0x2e')]);_0x802ad[_0x87d8('0x31')]=_[_0x87d8('0x30')](_0x4439b3[_0x87d8('0x2d')],qs[_0x87d8('0x32')](_0x515f6e['query'][_0x87d8('0x32')]));_0x802ad[_0x87d8('0x31')]=_0x802ad['attributes'][_0x87d8('0x33')]?_0x802ad[_0x87d8('0x31')]:_0x4439b3[_0x87d8('0x2d')];if(_0x515f6e['query'][_0x87d8('0x45')]){_0x802ad[_0x87d8('0x3f')]=[{'all':!![]}];}_0x802ad=_[_0x87d8('0x3a')]({},_0x802ad,_0x515f6e[_0x87d8('0x3d')]);return db[_0x87d8('0x3e')][_0x87d8('0x46')](_0x802ad)['then'](handleEntityNotFound(_0x5d1128,null))[_0x87d8('0x21')](respondWithResult(_0x5d1128,null))[_0x87d8('0x42')](handleError(_0x5d1128,null));};exports[_0x87d8('0x47')]=function(_0x410d8c,_0xace54a){return db['UserProfileSection'][_0x87d8('0x47')](_0x410d8c['body'],{})[_0x87d8('0x21')](respondWithResult(_0xace54a,0xc9))['catch'](handleError(_0xace54a,null));};exports[_0x87d8('0x48')]=function(_0x318d8f,_0x21dbd2){if(_0x318d8f['body']['id']){delete _0x318d8f['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x318d8f['params']['id']}})[_0x87d8('0x21')](handleEntityNotFound(_0x21dbd2,null))[_0x87d8('0x21')](saveUpdates(_0x318d8f['body'],null))['then'](respondWithResult(_0x21dbd2,null))[_0x87d8('0x42')](handleError(_0x21dbd2,null));};exports[_0x87d8('0x22')]=function(_0x1f7b94,_0x5648c5){return db[_0x87d8('0x3e')][_0x87d8('0x46')]({'where':{'id':_0x1f7b94[_0x87d8('0x44')]['id']}})[_0x87d8('0x21')](handleEntityNotFound(_0x5648c5,null))['then'](removeEntity(_0x5648c5,null))[_0x87d8('0x42')](handleError(_0x5648c5,null));};exports['describe']=function(_0x474a7e,_0x101ffe){return db['UserProfileSection'][_0x87d8('0x49')]()[_0x87d8('0x21')](respondWithResult(_0x101ffe,null))[_0x87d8('0x42')](handleError(_0x101ffe,null));}; \ No newline at end of file +var _0x9ad4=['error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x3f0476,_0x450e5e){var _0x298fd3=function(_0xb4d48d){while(--_0xb4d48d){_0x3f0476['push'](_0x3f0476['shift']());}};_0x298fd3(++_0x450e5e);}(_0x9ad4,0x199));var _0x49ad=function(_0x27ad3e,_0x15f1a8){_0x27ad3e=_0x27ad3e-0x0;var _0x1777bd=_0x9ad4[_0x27ad3e];return _0x1777bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49ad('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49ad('0x1'));var moment=require(_0x49ad('0x2'));var BPromise=require(_0x49ad('0x3'));var Mustache=require('mustache');var util=require(_0x49ad('0x4'));var path=require(_0x49ad('0x5'));var sox=require(_0x49ad('0x6'));var csv=require(_0x49ad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49ad('0x8'));var _=require('lodash');var squel=require(_0x49ad('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x49ad('0xa'));var toCsv=require(_0x49ad('0x7'));var querystring=require('querystring');var Papa=require(_0x49ad('0xb'));var Redis=require(_0x49ad('0xc'));var authService=require(_0x49ad('0xd'));var qs=require(_0x49ad('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49ad('0xf'));var logger=require(_0x49ad('0x10'))(_0x49ad('0x11'));var utils=require('../../config/utils');var config=require(_0x49ad('0x12'));var licenseUtil=require(_0x49ad('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d50a9,_0x58f36d){_0x58f36d=_0x58f36d||0xcc;return function(_0x56d2a5){if(_0x56d2a5){return _0x1d50a9[_0x49ad('0x14')](_0x58f36d);}return _0x1d50a9[_0x49ad('0x15')](_0x58f36d)[_0x49ad('0x16')]();};}function respondWithResult(_0x48dd2a,_0xa50451){_0xa50451=_0xa50451||0xc8;return function(_0x51692e){if(_0x51692e){return _0x48dd2a[_0x49ad('0x15')](_0xa50451)[_0x49ad('0x17')](_0x51692e);}};}function respondWithFilteredResult(_0x4ab8f3,_0x2f7015){return function(_0x42cc16){if(_0x42cc16){var _0x122873=typeof _0x2f7015[_0x49ad('0x18')]==='undefined'&&typeof _0x2f7015[_0x49ad('0x19')]===_0x49ad('0x1a');var _0x3d9023=_0x42cc16[_0x49ad('0x1b')];var _0x296939=_0x122873?0x0:_0x2f7015['offset'];var _0x2d272a=_0x122873?_0x42cc16['count']:_0x2f7015[_0x49ad('0x18')]+_0x2f7015[_0x49ad('0x19')];var _0x38d422;if(_0x2d272a>=_0x3d9023){_0x2d272a=_0x3d9023;_0x38d422=0xc8;}else{_0x38d422=0xce;}_0x4ab8f3[_0x49ad('0x15')](_0x38d422);return _0x4ab8f3[_0x49ad('0x1c')](_0x49ad('0x1d'),_0x296939+'-'+_0x2d272a+'/'+_0x3d9023)[_0x49ad('0x17')](_0x42cc16);}return null;};}function patchUpdates(_0x39763f){return function(_0x2c3ea5){try{jsonpatch['apply'](_0x2c3ea5,_0x39763f,!![]);}catch(_0x1abc17){return BPromise[_0x49ad('0x1e')](_0x1abc17);}return _0x2c3ea5[_0x49ad('0x1f')]();};}function saveUpdates(_0x46caea,_0xf2b4d2){return function(_0x58b190){if(_0x58b190){return _0x58b190[_0x49ad('0x20')](_0x46caea)[_0x49ad('0x21')](function(_0xe4e81a){return _0xe4e81a;});}return null;};}function removeEntity(_0xb29248,_0x271ce8){return function(_0x5a797b){if(_0x5a797b){return _0x5a797b[_0x49ad('0x22')]()[_0x49ad('0x21')](function(){_0xb29248[_0x49ad('0x15')](0xcc)[_0x49ad('0x16')]();});}};}function handleEntityNotFound(_0x4be036,_0x4ad3ff){return function(_0x327280){if(!_0x327280){_0x4be036[_0x49ad('0x14')](0x194);}return _0x327280;};}function handleError(_0x219562,_0x1b5446){_0x1b5446=_0x1b5446||0x1f4;return function(_0x2f44d2){logger[_0x49ad('0x23')](_0x2f44d2[_0x49ad('0x24')]);if(_0x2f44d2[_0x49ad('0x25')]){delete _0x2f44d2[_0x49ad('0x25')];}_0x219562[_0x49ad('0x15')](_0x1b5446)[_0x49ad('0x26')](_0x2f44d2);};}exports['index']=function(_0x2dc847,_0x5262bc){var _0x1b3593={},_0x2077d0={},_0x219604={'count':0x0,'rows':[]};var _0x431cfc=_['map'](db['UserProfileSection'][_0x49ad('0x27')],function(_0x2cfe41){return{'name':_0x2cfe41[_0x49ad('0x28')],'type':_0x2cfe41[_0x49ad('0x29')][_0x49ad('0x2a')]};});_0x2077d0['model']=_[_0x49ad('0x2b')](_0x431cfc,_0x49ad('0x25'));_0x2077d0[_0x49ad('0x2c')]=_[_0x49ad('0x2d')](_0x2dc847[_0x49ad('0x2c')]);_0x2077d0[_0x49ad('0x2e')]=_[_0x49ad('0x2f')](_0x2077d0['model'],_0x2077d0[_0x49ad('0x2c')]);_0x1b3593[_0x49ad('0x30')]=_[_0x49ad('0x2f')](_0x2077d0[_0x49ad('0x31')],qs[_0x49ad('0x32')](_0x2dc847['query'][_0x49ad('0x32')]));_0x1b3593[_0x49ad('0x30')]=_0x1b3593['attributes'][_0x49ad('0x33')]?_0x1b3593['attributes']:_0x2077d0['model'];if(!_0x2dc847[_0x49ad('0x2c')][_0x49ad('0x34')](_0x49ad('0x35'))){_0x1b3593[_0x49ad('0x19')]=qs[_0x49ad('0x19')](_0x2dc847['query']['limit']);_0x1b3593[_0x49ad('0x18')]=qs[_0x49ad('0x18')](_0x2dc847['query'][_0x49ad('0x18')]);}_0x1b3593[_0x49ad('0x36')]=qs[_0x49ad('0x37')](_0x2dc847[_0x49ad('0x2c')]['sort']);_0x1b3593[_0x49ad('0x38')]=qs[_0x49ad('0x2e')](_[_0x49ad('0x39')](_0x2dc847[_0x49ad('0x2c')],_0x2077d0[_0x49ad('0x2e')]),_0x431cfc);if(_0x2dc847['query'][_0x49ad('0x3a')]){_0x1b3593[_0x49ad('0x38')]=_[_0x49ad('0x3b')](_0x1b3593[_0x49ad('0x38')],{'$or':_[_0x49ad('0x2b')](_0x431cfc,function(_0x4e61b3){if(_0x4e61b3[_0x49ad('0x29')]!==_0x49ad('0x3c')){var _0x51fda3={};_0x51fda3[_0x4e61b3[_0x49ad('0x25')]]={'$like':'%'+_0x2dc847['query'][_0x49ad('0x3a')]+'%'};return _0x51fda3;}})});}_0x1b3593=_[_0x49ad('0x3b')]({},_0x1b3593,_0x2dc847[_0x49ad('0x3d')]);var _0x359719={'where':_0x1b3593[_0x49ad('0x38')]};return db[_0x49ad('0x3e')]['count'](_0x359719)[_0x49ad('0x21')](function(_0x13f198){_0x219604[_0x49ad('0x1b')]=_0x13f198;if(_0x2dc847[_0x49ad('0x2c')][_0x49ad('0x3f')]){_0x1b3593[_0x49ad('0x40')]=[{'all':!![]}];}return db[_0x49ad('0x3e')][_0x49ad('0x41')](_0x1b3593);})[_0x49ad('0x21')](function(_0x1666eb){_0x219604[_0x49ad('0x42')]=_0x1666eb;return _0x219604;})['then'](respondWithFilteredResult(_0x5262bc,_0x1b3593))[_0x49ad('0x43')](handleError(_0x5262bc,null));};exports[_0x49ad('0x44')]=function(_0x3cfd0b,_0x2e82bc){var _0x19782e={'raw':![],'where':{'id':_0x3cfd0b['params']['id']}},_0x5cbcb1={};_0x5cbcb1[_0x49ad('0x31')]=_['keys'](db[_0x49ad('0x3e')][_0x49ad('0x27')]);_0x5cbcb1['query']=_[_0x49ad('0x2d')](_0x3cfd0b[_0x49ad('0x2c')]);_0x5cbcb1['filters']=_[_0x49ad('0x2f')](_0x5cbcb1['model'],_0x5cbcb1[_0x49ad('0x2c')]);_0x19782e['attributes']=_[_0x49ad('0x2f')](_0x5cbcb1['model'],qs[_0x49ad('0x32')](_0x3cfd0b[_0x49ad('0x2c')][_0x49ad('0x32')]));_0x19782e['attributes']=_0x19782e[_0x49ad('0x30')][_0x49ad('0x33')]?_0x19782e[_0x49ad('0x30')]:_0x5cbcb1[_0x49ad('0x31')];if(_0x3cfd0b['query']['includeAll']){_0x19782e[_0x49ad('0x40')]=[{'all':!![]}];}_0x19782e=_[_0x49ad('0x3b')]({},_0x19782e,_0x3cfd0b[_0x49ad('0x3d')]);return db[_0x49ad('0x3e')][_0x49ad('0x45')](_0x19782e)[_0x49ad('0x21')](handleEntityNotFound(_0x2e82bc,null))['then'](respondWithResult(_0x2e82bc,null))['catch'](handleError(_0x2e82bc,null));};exports[_0x49ad('0x46')]=function(_0x580063,_0x2da400){return db[_0x49ad('0x3e')][_0x49ad('0x46')](_0x580063[_0x49ad('0x47')],{})[_0x49ad('0x21')](respondWithResult(_0x2da400,0xc9))[_0x49ad('0x43')](handleError(_0x2da400,null));};exports[_0x49ad('0x20')]=function(_0x5c7020,_0x24a6d6){if(_0x5c7020[_0x49ad('0x47')]['id']){delete _0x5c7020[_0x49ad('0x47')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5c7020[_0x49ad('0x48')]['id']}})[_0x49ad('0x21')](handleEntityNotFound(_0x24a6d6,null))['then'](saveUpdates(_0x5c7020[_0x49ad('0x47')],null))['then'](respondWithResult(_0x24a6d6,null))[_0x49ad('0x43')](handleError(_0x24a6d6,null));};exports[_0x49ad('0x22')]=function(_0x58ad00,_0x38915e){return db[_0x49ad('0x3e')]['find']({'where':{'id':_0x58ad00[_0x49ad('0x48')]['id']}})['then'](handleEntityNotFound(_0x38915e,null))[_0x49ad('0x21')](removeEntity(_0x38915e,null))['catch'](handleError(_0x38915e,null));};exports[_0x49ad('0x49')]=function(_0x1f6852,_0x2005f7){return db['UserProfileSection']['describe']()[_0x49ad('0x21')](respondWithResult(_0x2005f7,null))[_0x49ad('0x43')](handleError(_0x2005f7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index db91864..2804857 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 _0x1d93=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId'];(function(_0xa4e8c3,_0x2a31ba){var _0x8ed965=function(_0x5402cd){while(--_0x5402cd){_0xa4e8c3['push'](_0xa4e8c3['shift']());}};_0x8ed965(++_0x2a31ba);}(_0x1d93,0xa0));var _0x31d9=function(_0x1b10c7,_0x3c1380){_0x1b10c7=_0x1b10c7-0x0;var _0x5cd305=_0x1d93[_0x1b10c7];return _0x5cd305;};'use strict';var _=require(_0x31d9('0x0'));var util=require(_0x31d9('0x1'));var logger=require(_0x31d9('0x2'))(_0x31d9('0x3'));var moment=require('moment');var BPromise=require(_0x31d9('0x4'));var rp=require(_0x31d9('0x5'));var fs=require('fs');var path=require(_0x31d9('0x6'));var rimraf=require(_0x31d9('0x7'));var config=require(_0x31d9('0x8'));var attributes=require(_0x31d9('0x9'));module[_0x31d9('0xa')]=function(_0x2933cb,_0x43835a){return _0x2933cb[_0x31d9('0xb')](_0x31d9('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x31d9('0xd'),'fields':[_0x31d9('0xe'),_0x31d9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc396=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','../../config/logger','api','request-promise'];(function(_0x3637c2,_0x3a2837){var _0xc43ad=function(_0x1572ea){while(--_0x1572ea){_0x3637c2['push'](_0x3637c2['shift']());}};_0xc43ad(++_0x3a2837);}(_0xc396,0x127));var _0x6c39=function(_0x1f20f5,_0x37ab6a){_0x1f20f5=_0x1f20f5-0x0;var _0x533e5a=_0xc396[_0x1f20f5];return _0x533e5a;};'use strict';var _=require(_0x6c39('0x0'));var util=require('util');var logger=require(_0x6c39('0x1'))(_0x6c39('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c39('0x3'));var fs=require('fs');var path=require(_0x6c39('0x4'));var rimraf=require(_0x6c39('0x5'));var config=require(_0x6c39('0x6'));var attributes=require(_0x6c39('0x7'));module[_0x6c39('0x8')]=function(_0x180ed0,_0x3c30cb){return _0x180ed0[_0x6c39('0x9')](_0x6c39('0xa'),attributes,{'tableName':_0x6c39('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6c39('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 500abba..e6ff390 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 _0x468f=['../../config/environment','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x571dec,_0x1dcae4){var _0x2e67bf=function(_0x1ae945){while(--_0x1ae945){_0x571dec['push'](_0x571dec['shift']());}};_0x2e67bf(++_0x1dcae4);}(_0x468f,0x97));var _0xf468=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x468f[_0x3167b1];return _0x362152;};'use strict';var _=require(_0xf468('0x0'));var util=require(_0xf468('0x1'));var moment=require(_0xf468('0x2'));var BPromise=require(_0xf468('0x3'));var rs=require(_0xf468('0x4'));var fs=require('fs');var Redis=require(_0xf468('0x5'));var db=require(_0xf468('0x6'))['db'];var utils=require(_0xf468('0x7'));var logger=require(_0xf468('0x8'))(_0xf468('0x9'));var config=require(_0xf468('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf468('0xb')][_0xf468('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x587224,_0x255728,_0x4ca88f){return new BPromise(function(_0x1f190c,_0x27c6b6){return client['request'](_0x587224,_0x4ca88f)[_0xf468('0xd')](function(_0x2468f3){logger[_0xf468('0xe')](_0xf468('0xf'),_0x255728,_0xf468('0x10'));logger[_0xf468('0x11')](_0xf468('0x12'),_0x255728,'request\x20sent',JSON['stringify'](_0x2468f3));if(_0x2468f3[_0xf468('0x13')]){if(_0x2468f3[_0xf468('0x13')][_0xf468('0x14')]===0x1f4){logger[_0xf468('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x255728,_0x2468f3[_0xf468('0x13')][_0xf468('0x15')]);return _0x27c6b6(_0x2468f3[_0xf468('0x13')][_0xf468('0x15')]);}logger[_0xf468('0x13')](_0xf468('0xf'),_0x255728,_0x2468f3[_0xf468('0x13')]['message']);return _0x1f190c(_0x2468f3[_0xf468('0x13')][_0xf468('0x15')]);}else{logger[_0xf468('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x255728,_0xf468('0x10'));_0x1f190c(_0x2468f3['result']['message']);}})[_0xf468('0x16')](function(_0x32b4c7){logger['error'](_0xf468('0xf'),_0x255728,_0x32b4c7);_0x27c6b6(_0x32b4c7);});});} \ No newline at end of file +var _0xcba0=['util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','catch','lodash'];(function(_0x1ede24,_0x2c365b){var _0x11a555=function(_0x46bb8b){while(--_0x46bb8b){_0x1ede24['push'](_0x1ede24['shift']());}};_0x11a555(++_0x2c365b);}(_0xcba0,0xe3));var _0x0cba=function(_0x1b4d97,_0x37d112){_0x1b4d97=_0x1b4d97-0x0;var _0x1dd095=_0xcba0[_0x1b4d97];return _0x1dd095;};'use strict';var _=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var moment=require(_0x0cba('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cba('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cba('0x4'))(_0x0cba('0x5'));var config=require('../../config/environment');var jayson=require(_0x0cba('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57711c,_0x2a0c69,_0x800f1c){return new BPromise(function(_0x512108,_0x111d4f){return client[_0x0cba('0x7')](_0x57711c,_0x800f1c)[_0x0cba('0x8')](function(_0x48bf47){logger[_0x0cba('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x2a0c69,_0x0cba('0xa'));logger[_0x0cba('0xb')](_0x0cba('0xc'),_0x2a0c69,_0x0cba('0xa'),JSON[_0x0cba('0xd')](_0x48bf47));if(_0x48bf47[_0x0cba('0xe')]){if(_0x48bf47['error'][_0x0cba('0xf')]===0x1f4){logger[_0x0cba('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2a0c69,_0x48bf47[_0x0cba('0xe')][_0x0cba('0x10')]);return _0x111d4f(_0x48bf47[_0x0cba('0xe')][_0x0cba('0x10')]);}logger[_0x0cba('0xe')](_0x0cba('0x11'),_0x2a0c69,_0x48bf47[_0x0cba('0xe')][_0x0cba('0x10')]);return _0x512108(_0x48bf47['error']['message']);}else{logger['info'](_0x0cba('0x11'),_0x2a0c69,_0x0cba('0xa'));_0x512108(_0x48bf47['result'][_0x0cba('0x10')]);}})[_0x0cba('0x12')](function(_0x5b1736){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2a0c69,_0x5b1736);_0x111d4f(_0x5b1736);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 87c4ea9..69f1875 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4eb3c7,_0x1526b9){var _0x5d9e42=function(_0x2453e6){while(--_0x2453e6){_0x4eb3c7['push'](_0x4eb3c7['shift']());}};_0x5d9e42(++_0x1526b9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xcb91[_0x3dfeb9];return _0x412314;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x384e1b,_0x1df92b){var _0xe66e2e=function(_0x222683){while(--_0x222683){_0x384e1b['push'](_0x384e1b['shift']());}};_0xe66e2e(++_0x1df92b);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 1dffdd9..6148973 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 _0x6615=['exports','sequelize'];(function(_0x570b92,_0x44c964){var _0x2228f7=function(_0x2754d9){while(--_0x2754d9){_0x570b92['push'](_0x570b92['shift']());}};_0x2228f7(++_0x44c964);}(_0x6615,0x8f));var _0x5661=function(_0x2388be,_0x43ebae){_0x2388be=_0x2388be-0x0;var _0x13ac52=_0x6615[_0x2388be];return _0x13ac52;};'use strict';var Sequelize=require(_0x5661('0x0'));module[_0x5661('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc4d=['exports'];(function(_0x11b50b,_0xbc4c31){var _0x3154cd=function(_0x1528e3){while(--_0x1528e3){_0x11b50b['push'](_0x11b50b['shift']());}};_0x3154cd(++_0xbc4c31);}(_0xdc4d,0x129));var _0xddc4=function(_0x42e96e,_0x3ac808){_0x42e96e=_0x42e96e-0x0;var _0xdcfba4=_0xdc4d[_0x42e96e];return _0xdcfba4;};'use strict';var Sequelize=require('sequelize');module[_0xddc4('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 5a0d2a4..50c3e82 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 _0xf072=['path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2a95bb,_0x57042c){var _0xbbc03e=function(_0x678e64){while(--_0x678e64){_0x2a95bb['push'](_0x2a95bb['shift']());}};_0xbbc03e(++_0x57042c);}(_0xf072,0x1cf));var _0x2f07=function(_0x4963d5,_0x45b892){_0x4963d5=_0x4963d5-0x0;var _0x1d1006=_0xf072[_0x4963d5];return _0x1d1006;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userSmsQueue.attributes','define'];(function(_0x4c88a7,_0x5c1843){var _0x468f0b=function(_0x168b94){while(--_0x168b94){_0x4c88a7['push'](_0x4c88a7['shift']());}};_0x468f0b(++_0x5c1843);}(_0x82c4,0x1ca));var _0x482c=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x82c4[_0x55cdc5];return _0x29acd5;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'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 19b51b9..e33a179 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 _0xed99=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4e9a90,_0x2b6da7){var _0x1a5cdb=function(_0x52c3ce){while(--_0x52c3ce){_0x4e9a90['push'](_0x4e9a90['shift']());}};_0x1a5cdb(++_0x2b6da7);}(_0xed99,0x163));var _0x9ed9=function(_0x5c9bb8,_0x182a5e){_0x5c9bb8=_0x5c9bb8-0x0;var _0x513beb=_0xed99[_0x5c9bb8];return _0x513beb;};'use strict';var _=require(_0x9ed9('0x0'));var util=require(_0x9ed9('0x1'));var moment=require(_0x9ed9('0x2'));var BPromise=require(_0x9ed9('0x3'));var rs=require(_0x9ed9('0x4'));var fs=require('fs');var Redis=require(_0x9ed9('0x5'));var db=require(_0x9ed9('0x6'))['db'];var utils=require(_0x9ed9('0x7'));var logger=require(_0x9ed9('0x8'))(_0x9ed9('0x9'));var config=require(_0x9ed9('0xa'));var jayson=require(_0x9ed9('0xb'));var client=jayson[_0x9ed9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x298ccd,_0xb21b7b,_0x11a2de){return new BPromise(function(_0x33d443,_0x5b2788){return client['request'](_0x298ccd,_0x11a2de)['then'](function(_0x3973c3){logger[_0x9ed9('0xd')](_0x9ed9('0xe'),_0xb21b7b,_0x9ed9('0xf'));logger[_0x9ed9('0x10')](_0x9ed9('0x11'),_0xb21b7b,'request\x20sent',JSON[_0x9ed9('0x12')](_0x3973c3));if(_0x3973c3[_0x9ed9('0x13')]){if(_0x3973c3[_0x9ed9('0x13')][_0x9ed9('0x14')]===0x1f4){logger['error'](_0x9ed9('0xe'),_0xb21b7b,_0x3973c3[_0x9ed9('0x13')][_0x9ed9('0x15')]);return _0x5b2788(_0x3973c3[_0x9ed9('0x13')][_0x9ed9('0x15')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0xb21b7b,_0x3973c3[_0x9ed9('0x13')][_0x9ed9('0x15')]);return _0x33d443(_0x3973c3[_0x9ed9('0x13')][_0x9ed9('0x15')]);}else{logger[_0x9ed9('0xd')](_0x9ed9('0xe'),_0xb21b7b,_0x9ed9('0xf'));_0x33d443(_0x3973c3[_0x9ed9('0x16')]['message']);}})[_0x9ed9('0x17')](function(_0x57e8a3){logger['error'](_0x9ed9('0xe'),_0xb21b7b,_0x57e8a3);_0x5b2788(_0x57e8a3);});});} \ No newline at end of file +var _0x2345=['info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x590816,_0x57da8b){var _0x5cd527=function(_0x1095a8){while(--_0x1095a8){_0x590816['push'](_0x590816['shift']());}};_0x5cd527(++_0x57da8b);}(_0x2345,0x168));var _0x5234=function(_0x47e32d,_0x128387){_0x47e32d=_0x47e32d-0x0;var _0x450ae5=_0x2345[_0x47e32d];return _0x450ae5;};'use strict';var _=require(_0x5234('0x0'));var util=require(_0x5234('0x1'));var moment=require(_0x5234('0x2'));var BPromise=require(_0x5234('0x3'));var rs=require(_0x5234('0x4'));var fs=require('fs');var Redis=require(_0x5234('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5234('0x6'));var logger=require(_0x5234('0x7'))(_0x5234('0x8'));var config=require(_0x5234('0x9'));var jayson=require(_0x5234('0xa'));var client=jayson[_0x5234('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b720d,_0x4812be,_0x58f1ec){return new BPromise(function(_0x547323,_0x3fc53f){return client[_0x5234('0xc')](_0x5b720d,_0x58f1ec)[_0x5234('0xd')](function(_0x46c595){logger[_0x5234('0xe')](_0x5234('0xf'),_0x4812be,'request\x20sent');logger[_0x5234('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4812be,_0x5234('0x11'),JSON['stringify'](_0x46c595));if(_0x46c595[_0x5234('0x12')]){if(_0x46c595[_0x5234('0x12')][_0x5234('0x13')]===0x1f4){logger[_0x5234('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x4812be,_0x46c595[_0x5234('0x12')][_0x5234('0x14')]);return _0x3fc53f(_0x46c595['error'][_0x5234('0x14')]);}logger['error'](_0x5234('0xf'),_0x4812be,_0x46c595[_0x5234('0x12')]['message']);return _0x547323(_0x46c595[_0x5234('0x12')]['message']);}else{logger[_0x5234('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4812be,_0x5234('0x11'));_0x547323(_0x46c595['result'][_0x5234('0x14')]);}})[_0x5234('0x15')](function(_0x508be0){logger[_0x5234('0x12')](_0x5234('0xf'),_0x4812be,_0x508be0);_0x3fc53f(_0x508be0);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c315724..7760648 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 _0xffb0=['INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xffb0,0x85));var _0x0ffb=function(_0x572452,_0x41d0ce){_0x572452=_0x572452-0x0;var _0x2d09c3=_0xffb0[_0x572452];return _0x2d09c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x0ffb('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x0ffb('0x0')]}}; \ No newline at end of file +var _0x495b=['INTEGER','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x495b,0xc1));var _0xb495=function(_0x3d42bc,_0x4c58dd){_0x3d42bc=_0x3d42bc-0x0;var _0x5d3aae=_0x495b[_0x3d42bc];return _0x5d3aae;};'use strict';var Sequelize=require('sequelize');module[_0xb495('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb495('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index a5f91fa..ad04dcd 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(_0x201bc3,_0x3fc57f){var _0xb71f16=function(_0x583915){while(--_0x583915){_0x201bc3['push'](_0x201bc3['shift']());}};_0xb71f16(++_0x3fc57f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x176d16,_0x5212fe){var _0x432ec3=function(_0xe03eae){while(--_0xe03eae){_0x176d16['push'](_0x176d16['shift']());}};_0x432ec3(++_0x5212fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 302bf53..afa78a7 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x361f97,_0x4077ab){var _0x64e44c=function(_0x4dd809){while(--_0x4dd809){_0x361f97['push'](_0x361f97['shift']());}};_0x64e44c(++_0x4077ab);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x341fa4,_0x16a016){var _0x19becd=function(_0x37df65){while(--_0x37df65){_0x341fa4['push'](_0x341fa4['shift']());}};_0x19becd(++_0x16a016);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0xcb91[_0x3c4e4c];return _0x144a87;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7d76bbf..11c40a6 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 _0x30e9=['sequelize','exports'];(function(_0x36b124,_0x43eaec){var _0x18a336=function(_0x4c23a8){while(--_0x4c23a8){_0x36b124['push'](_0x36b124['shift']());}};_0x18a336(++_0x43eaec);}(_0x30e9,0x158));var _0x930e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x30e9[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x930e('0x0'));module[_0x930e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c19=['exports','INTEGER','sequelize'];(function(_0x19b6d1,_0x6abacf){var _0x429f71=function(_0xae352f){while(--_0xae352f){_0x19b6d1['push'](_0x19b6d1['shift']());}};_0x429f71(++_0x6abacf);}(_0x6c19,0x12e));var _0x96c1=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x6c19[_0x365e54];return _0x13317a;};'use strict';var Sequelize=require(_0x96c1('0x0'));module[_0x96c1('0x1')]={'penalty':{'type':Sequelize[_0x96c1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 37fc783..1d3fe2a 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 _0x972b=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','moment','bluebird'];(function(_0x97e4aa,_0x1e18c5){var _0x229790=function(_0x37eac0){while(--_0x37eac0){_0x97e4aa['push'](_0x97e4aa['shift']());}};_0x229790(++_0x1e18c5);}(_0x972b,0xcd));var _0xb972=function(_0x42c97d,_0x227ce2){_0x42c97d=_0x42c97d-0x0;var _0xfb5796=_0x972b[_0x42c97d];return _0xfb5796;};'use strict';var _=require('lodash');var util=require(_0xb972('0x0'));var logger=require(_0xb972('0x1'))('api');var moment=require(_0xb972('0x2'));var BPromise=require(_0xb972('0x3'));var rp=require(_0xb972('0x4'));var fs=require('fs');var path=require(_0xb972('0x5'));var rimraf=require('rimraf');var config=require(_0xb972('0x6'));var attributes=require(_0xb972('0x7'));module[_0xb972('0x8')]=function(_0x29e018,_0x22d14b){return _0x29e018['define'](_0xb972('0x9'),attributes,{'tableName':_0xb972('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2393=['rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','bluebird','request-promise'];(function(_0x4ba34e,_0x19b855){var _0x2e625d=function(_0x1f646c){while(--_0x1f646c){_0x4ba34e['push'](_0x4ba34e['shift']());}};_0x2e625d(++_0x19b855);}(_0x2393,0x8c));var _0x3239=function(_0xcbbd03,_0x67588f){_0xcbbd03=_0xcbbd03-0x0;var _0x1ae6f0=_0x2393[_0xcbbd03];return _0x1ae6f0;};'use strict';var _=require(_0x3239('0x0'));var util=require('util');var logger=require(_0x3239('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3239('0x2'));var rp=require(_0x3239('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3239('0x4'));var config=require(_0x3239('0x5'));var attributes=require(_0x3239('0x6'));module['exports']=function(_0x5d60ed,_0x258a18){return _0x5d60ed['define'](_0x3239('0x7'),attributes,{'tableName':_0x3239('0x8'),'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 9125534..4237b28 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 _0xd685=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x54fa2,_0x3bc36c){var _0x1d8ce8=function(_0x26f8dc){while(--_0x26f8dc){_0x54fa2['push'](_0x54fa2['shift']());}};_0x1d8ce8(++_0x3bc36c);}(_0xd685,0x15b));var _0x5d68=function(_0x500652,_0x5dbac0){_0x500652=_0x500652-0x0;var _0x363e87=_0xd685[_0x500652];return _0x363e87;};'use strict';var _=require(_0x5d68('0x0'));var util=require(_0x5d68('0x1'));var moment=require(_0x5d68('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d68('0x3'));var fs=require('fs');var Redis=require(_0x5d68('0x4'));var db=require(_0x5d68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d68('0x6'))(_0x5d68('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d68('0x8'));var client=jayson[_0x5d68('0x9')][_0x5d68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa9c55,_0x343a47,_0x3db957){return new BPromise(function(_0x2fc806,_0x2a1848){return client[_0x5d68('0xb')](_0xfa9c55,_0x3db957)[_0x5d68('0xc')](function(_0x255229){logger['info'](_0x5d68('0xd'),_0x343a47,_0x5d68('0xe'));logger[_0x5d68('0xf')](_0x5d68('0x10'),_0x343a47,_0x5d68('0xe'),JSON['stringify'](_0x255229));if(_0x255229[_0x5d68('0x11')]){if(_0x255229[_0x5d68('0x11')][_0x5d68('0x12')]===0x1f4){logger['error'](_0x5d68('0xd'),_0x343a47,_0x255229[_0x5d68('0x11')][_0x5d68('0x13')]);return _0x2a1848(_0x255229[_0x5d68('0x11')]['message']);}logger[_0x5d68('0x11')](_0x5d68('0xd'),_0x343a47,_0x255229['error']['message']);return _0x2fc806(_0x255229[_0x5d68('0x11')][_0x5d68('0x13')]);}else{logger['info'](_0x5d68('0xd'),_0x343a47,_0x5d68('0xe'));_0x2fc806(_0x255229[_0x5d68('0x14')]['message']);}})[_0x5d68('0x15')](function(_0x14828a){logger[_0x5d68('0x11')](_0x5d68('0xd'),_0x343a47,_0x14828a);_0x2a1848(_0x14828a);});});} \ No newline at end of file +var _0xb1c5=['code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x41b313,_0x6862cd){var _0x5c332e=function(_0x34722f){while(--_0x34722f){_0x41b313['push'](_0x41b313['shift']());}};_0x5c332e(++_0x6862cd);}(_0xb1c5,0x68));var _0x5b1c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb1c5[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x5b1c('0x0'));var moment=require(_0x5b1c('0x1'));var BPromise=require(_0x5b1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b1c('0x4'));var logger=require(_0x5b1c('0x5'))(_0x5b1c('0x6'));var config=require(_0x5b1c('0x7'));var jayson=require(_0x5b1c('0x8'));var client=jayson[_0x5b1c('0x9')][_0x5b1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ea392,_0x4cb405,_0x581e06){return new BPromise(function(_0x3e4057,_0xfa8c14){return client['request'](_0x3ea392,_0x581e06)['then'](function(_0x205682){logger[_0x5b1c('0xb')](_0x5b1c('0xc'),_0x4cb405,'request\x20sent');logger['debug'](_0x5b1c('0xd'),_0x4cb405,_0x5b1c('0xe'),JSON['stringify'](_0x205682));if(_0x205682[_0x5b1c('0xf')]){if(_0x205682[_0x5b1c('0xf')][_0x5b1c('0x10')]===0x1f4){logger[_0x5b1c('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4cb405,_0x205682[_0x5b1c('0xf')]['message']);return _0xfa8c14(_0x205682[_0x5b1c('0xf')][_0x5b1c('0x11')]);}logger[_0x5b1c('0xf')](_0x5b1c('0xc'),_0x4cb405,_0x205682['error'][_0x5b1c('0x11')]);return _0x3e4057(_0x205682[_0x5b1c('0xf')]['message']);}else{logger[_0x5b1c('0xb')](_0x5b1c('0xc'),_0x4cb405,_0x5b1c('0xe'));_0x3e4057(_0x205682[_0x5b1c('0x12')][_0x5b1c('0x11')]);}})[_0x5b1c('0x13')](function(_0x4b2ea3){logger[_0x5b1c('0xf')](_0x5b1c('0xc'),_0x4cb405,_0x4b2ea3);_0xfa8c14(_0x4b2ea3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 61d6a5b..b59b654 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x285cf1,_0x47e330){var _0x2fea93=function(_0x4129d6){while(--_0x4129d6){_0x285cf1['push'](_0x285cf1['shift']());}};_0x2fea93(++_0x47e330);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x90abfb,_0x47a59c){var _0x567006=function(_0x1ad65c){while(--_0x1ad65c){_0x90abfb['push'](_0x90abfb['shift']());}};_0x567006(++_0x47a59c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1b1eba,_0x71b70){_0x1b1eba=_0x1b1eba-0x0;var _0x2a59b7=_0xedd9[_0x1b1eba];return _0x2a59b7;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 85f867f..1529042 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 _0x1473=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x57baed,_0x8d29b1){var _0x50cbb4=function(_0x5d9193){while(--_0x5d9193){_0x57baed['push'](_0x57baed['shift']());}};_0x50cbb4(++_0x8d29b1);}(_0x1473,0x1ef));var _0x3147=function(_0x454eb9,_0x112a34){_0x454eb9=_0x454eb9-0x0;var _0x24878e=_0x1473[_0x454eb9];return _0x24878e;};'use strict';var Sequelize=require(_0x3147('0x0'));module[_0x3147('0x1')]={'uniqueid':{'type':Sequelize[_0x3147('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3147('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x3147('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3147('0x4')],'allowNull':![],'unique':_0x3147('0x5'),'comment':_0x3147('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3147('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x3147('0x4')],'allowNull':![],'unique':_0x3147('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3147('0x3')},'paused':{'type':Sequelize[_0x3147('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xacc1=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x4ea4ca,_0x443598){var _0x112fce=function(_0x21897f){while(--_0x21897f){_0x4ea4ca['push'](_0x4ea4ca['shift']());}};_0x112fce(++_0x443598);}(_0xacc1,0x1de));var _0x1acc=function(_0x3f6da3,_0x3d2c49){_0x3f6da3=_0x3f6da3-0x0;var _0x290926=_0xacc1[_0x3f6da3];return _0x290926;};'use strict';var Sequelize=require(_0x1acc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1acc('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1acc('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1acc('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1acc('0x3')],'allowNull':![],'unique':_0x1acc('0x4'),'comment':_0x1acc('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1acc('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x1acc('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x1acc('0x1')](0xb),'defaultValue':0x0,'comment':_0x1acc('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 8cc7982..bd0f7d1 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 _0x3a84=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x3a84,0xb4));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x43a8('0x0'));var UserVoiceQueueRt=require(_0x43a8('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x43a8('0x2'),'afterDestroy':_0x43a8('0x3')};function emitEvent(_0x3b240f){return function(_0xa998c5,_0x47f0fd,_0x5ced71){UserVoiceQueueRtEvents[_0x43a8('0x4')](_0x3b240f+':'+_0xa998c5['id'],_0xa998c5);UserVoiceQueueRtEvents[_0x43a8('0x4')](_0x3b240f,_0xa998c5);_0x5ced71(null);};}for(var e in events){if(events[_0x43a8('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x43a8('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x27c7=['save','remove','emit','hook','UserVoiceQueueRt','setMaxListeners'];(function(_0x4c01b,_0x43a88b){var _0x2fa10a=function(_0x17b5c7){while(--_0x17b5c7){_0x4c01b['push'](_0x4c01b['shift']());}};_0x2fa10a(++_0x43a88b);}(_0x27c7,0x190));var _0x727c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x27c7[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x727c('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x727c('0x1')](0x0);var events={'afterCreate':_0x727c('0x2'),'afterUpdate':'update','afterDestroy':_0x727c('0x3')};function emitEvent(_0x7a6d37){return function(_0xdd84ea,_0x5e6886,_0x241540){UserVoiceQueueRtEvents[_0x727c('0x4')](_0x7a6d37+':'+_0xdd84ea['id'],_0xdd84ea);UserVoiceQueueRtEvents['emit'](_0x7a6d37,_0xdd84ea);_0x241540(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x727c('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0199942..74f58eb 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 _0x8e49=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x1130ac,_0x4246c1){var _0x4124af=function(_0x28bb66){while(--_0x28bb66){_0x1130ac['push'](_0x1130ac['shift']());}};_0x4124af(++_0x4246c1);}(_0x8e49,0x144));var _0x98e4=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x8e49[_0xfb0281];return _0x408dd3;};'use strict';var _=require(_0x98e4('0x0'));var util=require(_0x98e4('0x1'));var logger=require(_0x98e4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x98e4('0x3'));var rimraf=require(_0x98e4('0x4'));var config=require(_0x98e4('0x5'));var attributes=require(_0x98e4('0x6'));module['exports']=function(_0x9171df,_0xdcd7ac){return _0x9171df[_0x98e4('0x7')](_0x98e4('0x8'),attributes,{'tableName':_0x98e4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ec9=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x20bedd,_0x39694b){var _0x3041f3=function(_0x1f53ee){while(--_0x1f53ee){_0x20bedd['push'](_0x20bedd['shift']());}};_0x3041f3(++_0x39694b);}(_0x9ec9,0x110));var _0x99ec=function(_0x4191ee,_0x3532a1){_0x4191ee=_0x4191ee-0x0;var _0x219d6f=_0x9ec9[_0x4191ee];return _0x219d6f;};'use strict';var _=require(_0x99ec('0x0'));var util=require(_0x99ec('0x1'));var logger=require(_0x99ec('0x2'))(_0x99ec('0x3'));var moment=require(_0x99ec('0x4'));var BPromise=require(_0x99ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99ec('0x6'));var rimraf=require('rimraf');var config=require(_0x99ec('0x7'));var attributes=require(_0x99ec('0x8'));module[_0x99ec('0x9')]=function(_0x17f426,_0x5173c){return _0x17f426[_0x99ec('0xa')](_0x99ec('0xb'),attributes,{'tableName':_0x99ec('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 385cdd1..e3cd057 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 _0xa832=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','UserVoiceQueueRt','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53176a,_0x571e7b){var _0x469828=function(_0x3d0371){while(--_0x3d0371){_0x53176a['push'](_0x53176a['shift']());}};_0x469828(++_0x571e7b);}(_0xa832,0x132));var _0x2a83=function(_0x2c4a58,_0x2d57b5){_0x2c4a58=_0x2c4a58-0x0;var _0x1605f1=_0xa832[_0x2c4a58];return _0x1605f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2a83('0x0'));var BPromise=require(_0x2a83('0x1'));var rs=require(_0x2a83('0x2'));var fs=require('fs');var Redis=require(_0x2a83('0x3'));var db=require(_0x2a83('0x4'))['db'];var utils=require(_0x2a83('0x5'));var logger=require(_0x2a83('0x6'))(_0x2a83('0x7'));var config=require(_0x2a83('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a83('0x9')][_0x2a83('0xa')]({'port':0x232a});config[_0x2a83('0xb')]=_[_0x2a83('0xc')](config[_0x2a83('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a83('0xd'))(new Redis(config[_0x2a83('0xb')]));require(_0x2a83('0xe'))[_0x2a83('0xf')](socket);function respondWithRpcPromise(_0x245659,_0x5c6174,_0x57cf7c){return new BPromise(function(_0x41fa2e,_0x2dfd27){return client[_0x2a83('0x10')](_0x245659,_0x57cf7c)['then'](function(_0x26b492){logger[_0x2a83('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5c6174,'request\x20sent');logger[_0x2a83('0x12')](_0x2a83('0x13'),_0x5c6174,_0x2a83('0x14'),JSON[_0x2a83('0x15')](_0x26b492));if(_0x26b492['error']){if(_0x26b492[_0x2a83('0x16')][_0x2a83('0x17')]===0x1f4){logger[_0x2a83('0x16')](_0x2a83('0x18'),_0x5c6174,_0x26b492[_0x2a83('0x16')][_0x2a83('0x19')]);return _0x2dfd27(_0x26b492[_0x2a83('0x16')][_0x2a83('0x19')]);}logger[_0x2a83('0x16')](_0x2a83('0x18'),_0x5c6174,_0x26b492[_0x2a83('0x16')][_0x2a83('0x19')]);return _0x41fa2e(_0x26b492['error'][_0x2a83('0x19')]);}else{logger[_0x2a83('0x11')](_0x2a83('0x18'),_0x5c6174,_0x2a83('0x14'));_0x41fa2e(_0x26b492[_0x2a83('0x1a')]['message']);}})['catch'](function(_0x251075){logger['error'](_0x2a83('0x18'),_0x5c6174,_0x251075);_0x2dfd27(_0x251075);});});}exports['GetVoiceQueueRtPauses']=function(_0x55b641){var _0x574862=this;return new Promise(function(_0x56ef6f,_0x1050e2){return db[_0x2a83('0x1b')]['findAll']({'raw':_0x55b641[_0x2a83('0x1c')]?_0x55b641[_0x2a83('0x1c')][_0x2a83('0x1d')]===undefined?!![]:![]:!![],'where':_0x55b641['options']?_0x55b641[_0x2a83('0x1c')][_0x2a83('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2a83('0x1f'),db[_0x2a83('0x20')]['fn']('IF',db[_0x2a83('0x20')][_0x2a83('0x21')](_0x2a83('0x22')))),_0x2a83('0x23')]]})[_0x2a83('0x24')](function(_0x2ff105){logger['info'](_0x2a83('0x25'),_0x55b641);logger[_0x2a83('0x12')]('GetVoiceQueueRtPauses',_0x55b641,JSON[_0x2a83('0x15')](_0x2ff105));_0x56ef6f(_0x2ff105);})[_0x2a83('0x26')](function(_0x2f042f){logger[_0x2a83('0x16')]('GetVoiceQueueRtPauses',_0x2f042f[_0x2a83('0x19')],_0x55b641);_0x1050e2(_0x574862['error'](0x1f4,_0x2f042f[_0x2a83('0x19')]));});});}; \ No newline at end of file +var _0xc52a=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug'];(function(_0x5783c4,_0x2c053c){var _0x7a9746=function(_0x1d6fbd){while(--_0x1d6fbd){_0x5783c4['push'](_0x5783c4['shift']());}};_0x7a9746(++_0x2c053c);}(_0xc52a,0x16f));var _0xac52=function(_0x1cbaa2,_0x16f4d8){_0x1cbaa2=_0x1cbaa2-0x0;var _0x114440=_0xc52a[_0x1cbaa2];return _0x114440;};'use strict';var _=require(_0xac52('0x0'));var util=require(_0xac52('0x1'));var moment=require(_0xac52('0x2'));var BPromise=require(_0xac52('0x3'));var rs=require(_0xac52('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac52('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xac52('0x6'));var jayson=require(_0xac52('0x7'));var client=jayson[_0xac52('0x8')][_0xac52('0x9')]({'port':0x232a});config[_0xac52('0xa')]=_[_0xac52('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xac52('0xc'))(new Redis(config[_0xac52('0xa')]));require(_0xac52('0xd'))['register'](socket);function respondWithRpcPromise(_0x3cf19e,_0x4bbc3a,_0x58b9d3){return new BPromise(function(_0x235f5e,_0x5a1a2d){return client[_0xac52('0xe')](_0x3cf19e,_0x58b9d3)['then'](function(_0x51c712){logger[_0xac52('0xf')](_0xac52('0x10'),_0x4bbc3a,'request\x20sent');logger[_0xac52('0x11')](_0xac52('0x12'),_0x4bbc3a,'request\x20sent',JSON[_0xac52('0x13')](_0x51c712));if(_0x51c712[_0xac52('0x14')]){if(_0x51c712[_0xac52('0x14')]['code']===0x1f4){logger[_0xac52('0x14')](_0xac52('0x10'),_0x4bbc3a,_0x51c712['error'][_0xac52('0x15')]);return _0x5a1a2d(_0x51c712[_0xac52('0x14')][_0xac52('0x15')]);}logger[_0xac52('0x14')](_0xac52('0x10'),_0x4bbc3a,_0x51c712[_0xac52('0x14')][_0xac52('0x15')]);return _0x235f5e(_0x51c712['error'][_0xac52('0x15')]);}else{logger[_0xac52('0xf')](_0xac52('0x10'),_0x4bbc3a,_0xac52('0x16'));_0x235f5e(_0x51c712[_0xac52('0x17')][_0xac52('0x15')]);}})[_0xac52('0x18')](function(_0x2465f2){logger['error'](_0xac52('0x10'),_0x4bbc3a,_0x2465f2);_0x5a1a2d(_0x2465f2);});});}exports[_0xac52('0x19')]=function(_0x484193){var _0x10da96=this;return new Promise(function(_0x436ea1,_0x10b45f){return db[_0xac52('0x1a')][_0xac52('0x1b')]({'raw':_0x484193[_0xac52('0x1c')]?_0x484193['options']['raw']===undefined?!![]:![]:!![],'where':_0x484193[_0xac52('0x1c')]?_0x484193[_0xac52('0x1c')][_0xac52('0x1d')]||null:null,'attributes':[[db[_0xac52('0x1e')]['fn'](_0xac52('0x1f'),db[_0xac52('0x1e')]['fn']('IF',db[_0xac52('0x1e')][_0xac52('0x20')](_0xac52('0x21')))),'outboundQueuePauses']]})[_0xac52('0x22')](function(_0x28c3e1){logger[_0xac52('0xf')]('GetVoiceQueueRtPauses',_0x484193);logger[_0xac52('0x11')]('GetVoiceQueueRtPauses',_0x484193,JSON['stringify'](_0x28c3e1));_0x436ea1(_0x28c3e1);})[_0xac52('0x18')](function(_0x82954c){logger[_0xac52('0x14')](_0xac52('0x19'),_0x82954c[_0xac52('0x15')],_0x484193);_0x10b45f(_0x10da96[_0xac52('0x14')](0x1f4,_0x82954c[_0xac52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9b16c3d..0e53126 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 _0x5419=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5419,0x175));var _0x9541=function(_0x30e350,_0x359dd4){_0x30e350=_0x30e350-0x0;var _0x948992=_0x5419[_0x30e350];return _0x948992;};'use strict';var UserVoiceQueueRtEvents=require(_0x9541('0x0'));var events=[_0x9541('0x1'),_0x9541('0x2'),_0x9541('0x3')];function createListener(_0x44e02b,_0x5b451e){return function(_0x15418a){_0x5b451e[_0x9541('0x4')](_0x44e02b,_0x15418a);};}function removeListener(_0x307a35,_0xacdcfa){return function(){UserVoiceQueueRtEvents['removeListener'](_0x307a35,_0xacdcfa);};}exports[_0x9541('0x5')]=function(_0x1f9139){for(var _0xbdabaf=0x0,_0x3c8491=events[_0x9541('0x6')];_0xbdabaf<_0x3c8491;_0xbdabaf++){var _0x22f42f=events[_0xbdabaf];var _0x306dcb=createListener(_0x9541('0x7')+_0x22f42f,_0x1f9139);UserVoiceQueueRtEvents['on'](_0x22f42f,_0x306dcb);}}; \ No newline at end of file +var _0xc99e=['remove','update','emit','removeListener','register','./userVoiceQueueRt.events','save'];(function(_0x29ab19,_0x117273){var _0x20ba91=function(_0x44361e){while(--_0x44361e){_0x29ab19['push'](_0x29ab19['shift']());}};_0x20ba91(++_0x117273);}(_0xc99e,0x6e));var _0xec99=function(_0x284cbc,_0xe2f37e){_0x284cbc=_0x284cbc-0x0;var _0x5b9bc2=_0xc99e[_0x284cbc];return _0x5b9bc2;};'use strict';var UserVoiceQueueRtEvents=require(_0xec99('0x0'));var events=[_0xec99('0x1'),_0xec99('0x2'),_0xec99('0x3')];function createListener(_0x22b65c,_0x41e155){return function(_0x4e3a66){_0x41e155[_0xec99('0x4')](_0x22b65c,_0x4e3a66);};}function removeListener(_0x4055ec,_0x111230){return function(){UserVoiceQueueRtEvents[_0xec99('0x5')](_0x4055ec,_0x111230);};}exports[_0xec99('0x6')]=function(_0x39821d){for(var _0x451dd4=0x0,_0x470d70=events['length'];_0x451dd4<_0x470d70;_0x451dd4++){var _0x797806=events[_0x451dd4];var _0x425a61=createListener('userVoiceQueueRt:'+_0x797806,_0x39821d);UserVoiceQueueRtEvents['on'](_0x797806,_0x425a61);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a8c8f94..b968314 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(_0x5dfecb,_0x36833c){var _0x24919a=function(_0x3f97a3){while(--_0x3f97a3){_0x5dfecb['push'](_0x5dfecb['shift']());}};_0x24919a(++_0x36833c);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ee034,_0xb6b9e4){var _0x3ba18b=function(_0x40b614){while(--_0x40b614){_0x2ee034['push'](_0x2ee034['shift']());}};_0x3ba18b(++_0xb6b9e4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xcb91[_0x422be2];return _0x1b820e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0555702..0413915 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 _0x70e8=['INTEGER','sequelize','exports'];(function(_0x16bf05,_0x4f70da){var _0xbcf546=function(_0x70b01d){while(--_0x70b01d){_0x16bf05['push'](_0x16bf05['shift']());}};_0xbcf546(++_0x4f70da);}(_0x70e8,0x18d));var _0x870e=function(_0x24259d,_0x3b3ab6){_0x24259d=_0x24259d-0x0;var _0x1a55a3=_0x70e8[_0x24259d];return _0x1a55a3;};'use strict';var Sequelize=require(_0x870e('0x0'));module[_0x870e('0x1')]={'penalty':{'type':Sequelize[_0x870e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ff8=['sequelize','exports'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x2ff8,0x1b0));var _0x82ff=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x2ff8[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x82ff('0x0'));module[_0x82ff('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 52e4fc1..c39066c 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 _0xf9d3=['api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','../../config/logger'];(function(_0x15b5b7,_0xb40767){var _0x2e67e7=function(_0x7e76a2){while(--_0x7e76a2){_0x15b5b7['push'](_0x15b5b7['shift']());}};_0x2e67e7(++_0xb40767);}(_0xf9d3,0xc4));var _0x3f9d=function(_0x2bc841,_0x32494c){_0x2bc841=_0x2bc841-0x0;var _0xab9d04=_0xf9d3[_0x2bc841];return _0xab9d04;};'use strict';var _=require(_0x3f9d('0x0'));var util=require('util');var logger=require(_0x3f9d('0x1'))(_0x3f9d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f9d('0x3'));var fs=require('fs');var path=require(_0x3f9d('0x4'));var rimraf=require(_0x3f9d('0x5'));var config=require(_0x3f9d('0x6'));var attributes=require(_0x3f9d('0x7'));module[_0x3f9d('0x8')]=function(_0x20aa49,_0x176bab){return _0x20aa49[_0x3f9d('0x9')](_0x3f9d('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ba=['user_has_whatsapp_queues','../../config/logger','api','moment','bluebird','path','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x302375,_0x27a237){var _0x18b9e3=function(_0x484c64){while(--_0x484c64){_0x302375['push'](_0x302375['shift']());}};_0x18b9e3(++_0x27a237);}(_0xe1ba,0xe7));var _0xae1b=function(_0x2b3e7e,_0x37c887){_0x2b3e7e=_0x2b3e7e-0x0;var _0x1e24b2=_0xe1ba[_0x2b3e7e];return _0x1e24b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae1b('0x0'))(_0xae1b('0x1'));var moment=require(_0xae1b('0x2'));var BPromise=require(_0xae1b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae1b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae1b('0x5'));module[_0xae1b('0x6')]=function(_0x46e2d5,_0x210edd){return _0x46e2d5[_0xae1b('0x7')](_0xae1b('0x8'),attributes,{'tableName':_0xae1b('0x9'),'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 e9f0fbd..044d0c0 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 _0x01d1=['bluebird','ioredis','rpc','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01d1,0xf4));var _0x101d=function(_0x5a4d65,_0x21f65d){_0x5a4d65=_0x5a4d65-0x0;var _0x457ed4=_0x01d1[_0x5a4d65];return _0x457ed4;};'use strict';var _=require(_0x101d('0x0'));var util=require(_0x101d('0x1'));var moment=require(_0x101d('0x2'));var BPromise=require(_0x101d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x101d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x101d('0x5'));var config=require('../../config/environment');var jayson=require(_0x101d('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54a8ef,_0x34d460,_0x22208d){return new BPromise(function(_0x4a21d0,_0x4f8573){return client[_0x101d('0x7')](_0x54a8ef,_0x22208d)[_0x101d('0x8')](function(_0x1522fc){logger[_0x101d('0x9')](_0x101d('0xa'),_0x34d460,_0x101d('0xb'));logger[_0x101d('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x34d460,_0x101d('0xb'),JSON[_0x101d('0xd')](_0x1522fc));if(_0x1522fc['error']){if(_0x1522fc[_0x101d('0xe')][_0x101d('0xf')]===0x1f4){logger['error'](_0x101d('0xa'),_0x34d460,_0x1522fc['error'][_0x101d('0x10')]);return _0x4f8573(_0x1522fc[_0x101d('0xe')]['message']);}logger[_0x101d('0xe')](_0x101d('0xa'),_0x34d460,_0x1522fc[_0x101d('0xe')]['message']);return _0x4a21d0(_0x1522fc[_0x101d('0xe')][_0x101d('0x10')]);}else{logger[_0x101d('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x34d460,_0x101d('0xb'));_0x4a21d0(_0x1522fc[_0x101d('0x11')][_0x101d('0x10')]);}})[_0x101d('0x12')](function(_0x1758fd){logger[_0x101d('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x34d460,_0x1758fd);_0x4f8573(_0x1758fd);});});} \ No newline at end of file +var _0x50f7=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message'];(function(_0x432af8,_0x477b3d){var _0x228f4f=function(_0x2110c0){while(--_0x2110c0){_0x432af8['push'](_0x432af8['shift']());}};_0x228f4f(++_0x477b3d);}(_0x50f7,0x8c));var _0x750f=function(_0x21dd0d,_0x209eec){_0x21dd0d=_0x21dd0d-0x0;var _0xfde2ae=_0x50f7[_0x21dd0d];return _0xfde2ae;};'use strict';var _=require('lodash');var util=require(_0x750f('0x0'));var moment=require(_0x750f('0x1'));var BPromise=require(_0x750f('0x2'));var rs=require(_0x750f('0x3'));var fs=require('fs');var Redis=require(_0x750f('0x4'));var db=require(_0x750f('0x5'))['db'];var utils=require(_0x750f('0x6'));var logger=require(_0x750f('0x7'))('rpc');var config=require(_0x750f('0x8'));var jayson=require(_0x750f('0x9'));var client=jayson[_0x750f('0xa')][_0x750f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac98e,_0x299052,_0x22aa18){return new BPromise(function(_0x3821ec,_0x2299ff){return client[_0x750f('0xc')](_0x3ac98e,_0x22aa18)['then'](function(_0x13f896){logger[_0x750f('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x299052,_0x750f('0xe'));logger[_0x750f('0xf')](_0x750f('0x10'),_0x299052,'request\x20sent',JSON['stringify'](_0x13f896));if(_0x13f896[_0x750f('0x11')]){if(_0x13f896['error'][_0x750f('0x12')]===0x1f4){logger[_0x750f('0x11')](_0x750f('0x13'),_0x299052,_0x13f896['error'][_0x750f('0x14')]);return _0x2299ff(_0x13f896[_0x750f('0x11')][_0x750f('0x14')]);}logger[_0x750f('0x11')](_0x750f('0x13'),_0x299052,_0x13f896['error']['message']);return _0x3821ec(_0x13f896[_0x750f('0x11')]['message']);}else{logger['info'](_0x750f('0x13'),_0x299052,_0x750f('0xe'));_0x3821ec(_0x13f896[_0x750f('0x15')][_0x750f('0x14')]);}})[_0x750f('0x16')](function(_0x1b2b36){logger[_0x750f('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x299052,_0x1b2b36);_0x2299ff(_0x1b2b36);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 077b92f..1506f6c 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 _0x7b83=['destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','update','delete','/:id'];(function(_0x4782e9,_0x5ee6c9){var _0x1231d3=function(_0xca51e3){while(--_0xca51e3){_0x4782e9['push'](_0x4782e9['shift']());}};_0x1231d3(++_0x5ee6c9);}(_0x7b83,0xa1));var _0x37b8=function(_0x819e7d,_0x1dd39f){_0x819e7d=_0x819e7d-0x0;var _0x269791=_0x7b83[_0x819e7d];return _0x269791;};'use strict';var multer=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var path=require(_0x37b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x37b8('0x3')]();var fs_extra=require(_0x37b8('0x4'));var auth=require(_0x37b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37b8('0x6'));var controller=require(_0x37b8('0x7'));router[_0x37b8('0x8')]('/',auth[_0x37b8('0x9')](),controller[_0x37b8('0xa')]);router[_0x37b8('0x8')]('/:id',auth[_0x37b8('0x9')](),controller[_0x37b8('0xb')]);router['post']('/',auth[_0x37b8('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x37b8('0xc')]);router[_0x37b8('0xd')](_0x37b8('0xe'),auth[_0x37b8('0x9')](),controller[_0x37b8('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0a12=['index','create','put','/:id','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x0a12,0xb8));var _0x20a1=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x0a12[_0x710815];return _0x5b3b89;};'use strict';var multer=require('multer');var util=require(_0x20a1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20a1('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x20a1('0x2'));var interaction=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var controller=require(_0x20a1('0x5'));router[_0x20a1('0x6')]('/',auth[_0x20a1('0x7')](),controller[_0x20a1('0x8')]);router['get']('/:id',auth[_0x20a1('0x7')](),controller['show']);router['post']('/',auth[_0x20a1('0x7')](),controller[_0x20a1('0x9')]);router[_0x20a1('0xa')](_0x20a1('0xb'),auth[_0x20a1('0x7')](),controller[_0x20a1('0xc')]);router[_0x20a1('0xd')]('/:id',auth[_0x20a1('0x7')](),controller[_0x20a1('0xe')]);module[_0x20a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a6ce3af..8901420 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 _0xf2fa=['exports','STRING','name','sequelize'];(function(_0x354d04,_0x2b4aa3){var _0x51eb0b=function(_0x92623){while(--_0x92623){_0x354d04['push'](_0x354d04['shift']());}};_0x51eb0b(++_0x2b4aa3);}(_0xf2fa,0x12f));var _0xaf2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2fa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaf2f('0x0'));module[_0xaf2f('0x1')]={'name':{'type':Sequelize[_0xaf2f('0x2')],'unique':_0xaf2f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcddd=['name','sequelize','exports','STRING'];(function(_0x2d8c87,_0x4f44fc){var _0x3e2463=function(_0x5e7a49){while(--_0x5e7a49){_0x2d8c87['push'](_0x2d8c87['shift']());}};_0x3e2463(++_0x4f44fc);}(_0xcddd,0x1a1));var _0xdcdd=function(_0xac4c26,_0x2186a2){_0xac4c26=_0xac4c26-0x0;var _0x346314=_0xcddd[_0xac4c26];return _0x346314;};'use strict';var Sequelize=require(_0xdcdd('0x0'));module[_0xdcdd('0x1')]={'name':{'type':Sequelize[_0xdcdd('0x2')],'unique':_0xdcdd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdcdd('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b3e871c..089ceca 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 _0xad1b=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','find'];(function(_0xae3cf1,_0x5bf320){var _0x2588ee=function(_0x23715c){while(--_0x23715c){_0xae3cf1['push'](_0xae3cf1['shift']());}};_0x2588ee(++_0x5bf320);}(_0xad1b,0x100));var _0xbad1=function(_0xa4dfd3,_0x16cca2){_0xa4dfd3=_0xa4dfd3-0x0;var _0x49efb7=_0xad1b[_0xa4dfd3];return _0x49efb7;};'use strict';var emlformat=require(_0xbad1('0x0'));var rimraf=require(_0xbad1('0x1'));var zipdir=require(_0xbad1('0x2'));var jsonpatch=require(_0xbad1('0x3'));var rp=require('request-promise');var moment=require(_0xbad1('0x4'));var BPromise=require(_0xbad1('0x5'));var Mustache=require(_0xbad1('0x6'));var util=require('util');var path=require(_0xbad1('0x7'));var sox=require(_0xbad1('0x8'));var csv=require(_0xbad1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbad1('0xa'));var squel=require('squel');var crypto=require(_0xbad1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbad1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbad1('0xd'));var Papa=require(_0xbad1('0xe'));var Redis=require(_0xbad1('0xf'));var authService=require(_0xbad1('0x10'));var qs=require(_0xbad1('0x11'));var as=require(_0xbad1('0x12'));var hardwareService=require(_0xbad1('0x13'));var logger=require('../../config/logger')(_0xbad1('0x14'));var utils=require(_0xbad1('0x15'));var config=require(_0xbad1('0x16'));var licenseUtil=require(_0xbad1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293c5b,_0xcaacfc){_0xcaacfc=_0xcaacfc||0xcc;return function(_0x1e7f3f){if(_0x1e7f3f){return _0x293c5b['sendStatus'](_0xcaacfc);}return _0x293c5b[_0xbad1('0x18')](_0xcaacfc)[_0xbad1('0x19')]();};}function respondWithResult(_0x5f2b10,_0x3b2475){_0x3b2475=_0x3b2475||0xc8;return function(_0x1cc528){if(_0x1cc528){return _0x5f2b10['status'](_0x3b2475)[_0xbad1('0x1a')](_0x1cc528);}};}function respondWithFilteredResult(_0x58612e,_0x90125c){return function(_0x175e62){if(_0x175e62){var _0x2feb30=typeof _0x90125c[_0xbad1('0x1b')]===_0xbad1('0x1c')&&typeof _0x90125c[_0xbad1('0x1d')]==='undefined';var _0x5acffd=_0x175e62[_0xbad1('0x1e')];var _0x53ed7b=_0x2feb30?0x0:_0x90125c[_0xbad1('0x1b')];var _0x21789a=_0x2feb30?_0x175e62[_0xbad1('0x1e')]:_0x90125c[_0xbad1('0x1b')]+_0x90125c[_0xbad1('0x1d')];var _0x26a777;if(_0x21789a>=_0x5acffd){_0x21789a=_0x5acffd;_0x26a777=0xc8;}else{_0x26a777=0xce;}_0x58612e['status'](_0x26a777);return _0x58612e[_0xbad1('0x1f')](_0xbad1('0x20'),_0x53ed7b+'-'+_0x21789a+'/'+_0x5acffd)['json'](_0x175e62);}return null;};}function patchUpdates(_0x40430f){return function(_0x4b23a9){try{jsonpatch['apply'](_0x4b23a9,_0x40430f,!![]);}catch(_0x173982){return BPromise[_0xbad1('0x21')](_0x173982);}return _0x4b23a9[_0xbad1('0x22')]();};}function saveUpdates(_0x22735f,_0x22a850){return function(_0x418287){if(_0x418287){return _0x418287[_0xbad1('0x23')](_0x22735f)[_0xbad1('0x24')](function(_0x113d70){return _0x113d70;});}return null;};}function removeEntity(_0x21fed2,_0x423622){return function(_0x2faff2){if(_0x2faff2){return _0x2faff2[_0xbad1('0x25')]()['then'](function(){var _0x2fa46e=_0x2faff2[_0xbad1('0x26')]({'plain':!![]});var _0x529b67=_0xbad1('0x27');return db[_0xbad1('0x28')][_0xbad1('0x25')]({'where':{'type':_0x529b67,'resourceId':_0x2fa46e['id']}})['then'](function(){return _0x2faff2;});})[_0xbad1('0x24')](function(){_0x21fed2[_0xbad1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a4e3,_0x4b3299){return function(_0x108013){if(!_0x108013){_0x59a4e3[_0xbad1('0x29')](0x194);}return _0x108013;};}function handleError(_0x492b17,_0x21076b){_0x21076b=_0x21076b||0x1f4;return function(_0x1194be){logger[_0xbad1('0x2a')](_0x1194be[_0xbad1('0x2b')]);if(_0x1194be['name']){delete _0x1194be[_0xbad1('0x2c')];}_0x492b17['status'](_0x21076b)[_0xbad1('0x2d')](_0x1194be);};}exports[_0xbad1('0x2e')]=function(_0x4f6bfb,_0x1d50b7){var _0x436eb2={},_0x5d97dd={},_0x157cf3={'count':0x0,'rows':[]};var _0x13c9e1=_[_0xbad1('0x2f')](db[_0xbad1('0x30')][_0xbad1('0x31')],function(_0x5c0c77){return{'name':_0x5c0c77[_0xbad1('0x32')],'type':_0x5c0c77[_0xbad1('0x33')][_0xbad1('0x34')]};});_0x5d97dd['model']=_[_0xbad1('0x2f')](_0x13c9e1,_0xbad1('0x2c'));_0x5d97dd[_0xbad1('0x35')]=_[_0xbad1('0x36')](_0x4f6bfb[_0xbad1('0x35')]);_0x5d97dd['filters']=_['intersection'](_0x5d97dd[_0xbad1('0x37')],_0x5d97dd['query']);_0x436eb2['attributes']=_[_0xbad1('0x38')](_0x5d97dd[_0xbad1('0x37')],qs[_0xbad1('0x39')](_0x4f6bfb['query'][_0xbad1('0x39')]));_0x436eb2[_0xbad1('0x3a')]=_0x436eb2['attributes'][_0xbad1('0x3b')]?_0x436eb2['attributes']:_0x5d97dd[_0xbad1('0x37')];if(!_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x3c')]('nolimit')){_0x436eb2[_0xbad1('0x1d')]=qs[_0xbad1('0x1d')](_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x1d')]);_0x436eb2[_0xbad1('0x1b')]=qs[_0xbad1('0x1b')](_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x1b')]);}_0x436eb2[_0xbad1('0x3d')]=qs[_0xbad1('0x3e')](_0x4f6bfb['query'][_0xbad1('0x3e')]);_0x436eb2[_0xbad1('0x3f')]=qs[_0xbad1('0x40')](_[_0xbad1('0x41')](_0x4f6bfb[_0xbad1('0x35')],_0x5d97dd['filters']),_0x13c9e1);if(_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x42')]){_0x436eb2[_0xbad1('0x3f')]=_[_0xbad1('0x43')](_0x436eb2[_0xbad1('0x3f')],{'$or':_['map'](_0x13c9e1,function(_0x2a073f){if(_0x2a073f[_0xbad1('0x33')]!==_0xbad1('0x44')){var _0x240143={};_0x240143[_0x2a073f[_0xbad1('0x2c')]]={'$like':'%'+_0x4f6bfb[_0xbad1('0x35')][_0xbad1('0x42')]+'%'};return _0x240143;}})});}_0x436eb2=_[_0xbad1('0x43')]({},_0x436eb2,_0x4f6bfb[_0xbad1('0x45')]);var _0x17fb75={'where':_0x436eb2[_0xbad1('0x3f')]};return db[_0xbad1('0x30')][_0xbad1('0x1e')](_0x17fb75)[_0xbad1('0x24')](function(_0x2ae129){_0x157cf3[_0xbad1('0x1e')]=_0x2ae129;if(_0x4f6bfb[_0xbad1('0x35')]['includeAll']){_0x436eb2['include']=[{'all':!![]}];}return db[_0xbad1('0x30')][_0xbad1('0x46')](_0x436eb2);})['then'](function(_0x4b4c69){_0x157cf3[_0xbad1('0x47')]=_0x4b4c69;return _0x157cf3;})[_0xbad1('0x24')](respondWithFilteredResult(_0x1d50b7,_0x436eb2))[_0xbad1('0x48')](handleError(_0x1d50b7,null));};exports[_0xbad1('0x49')]=function(_0x24fda6,_0x3e52d3){var _0xa29eba={'raw':!![],'where':{'id':_0x24fda6[_0xbad1('0x4a')]['id']}},_0x2dac66={};_0x2dac66[_0xbad1('0x37')]=_[_0xbad1('0x36')](db['Variable'][_0xbad1('0x31')]);_0x2dac66[_0xbad1('0x35')]=_[_0xbad1('0x36')](_0x24fda6[_0xbad1('0x35')]);_0x2dac66[_0xbad1('0x40')]=_[_0xbad1('0x38')](_0x2dac66['model'],_0x2dac66[_0xbad1('0x35')]);_0xa29eba[_0xbad1('0x3a')]=_['intersection'](_0x2dac66[_0xbad1('0x37')],qs[_0xbad1('0x39')](_0x24fda6[_0xbad1('0x35')][_0xbad1('0x39')]));_0xa29eba[_0xbad1('0x3a')]=_0xa29eba[_0xbad1('0x3a')][_0xbad1('0x3b')]?_0xa29eba['attributes']:_0x2dac66[_0xbad1('0x37')];if(_0x24fda6[_0xbad1('0x35')]['includeAll']){_0xa29eba['include']=[{'all':!![]}];}_0xa29eba=_[_0xbad1('0x43')]({},_0xa29eba,_0x24fda6['options']);return db['Variable'][_0xbad1('0x4b')](_0xa29eba)[_0xbad1('0x24')](handleEntityNotFound(_0x3e52d3,null))['then'](respondWithResult(_0x3e52d3,null))[_0xbad1('0x48')](handleError(_0x3e52d3,null));};exports[_0xbad1('0x4c')]=function(_0x320c55,_0x4e1210){return db[_0xbad1('0x30')][_0xbad1('0x4c')](_0x320c55[_0xbad1('0x4d')],{})['then'](function(_0x2d5590){var _0x51bf23=_0x320c55[_0xbad1('0x4e')][_0xbad1('0x26')]({'plain':!![]});if(!_0x51bf23)throw new Error(_0xbad1('0x4f'));if(_0x51bf23[_0xbad1('0x50')]==='user'){var _0x2dccdb=_0x2d5590[_0xbad1('0x26')]({'plain':!![]});var _0x49cfe3=_0xbad1('0x27');return db['UserProfileSection'][_0xbad1('0x4b')]({'where':{'name':_0x49cfe3,'userProfileId':_0x51bf23[_0xbad1('0x51')]},'raw':!![]})[_0xbad1('0x24')](function(_0x21132a){if(_0x21132a&&_0x21132a[_0xbad1('0x52')]===0x0){return db['UserProfileResource'][_0xbad1('0x4c')]({'name':_0x2dccdb['name'],'resourceId':_0x2dccdb['id'],'type':_0x21132a[_0xbad1('0x2c')],'sectionId':_0x21132a['id']},{})[_0xbad1('0x24')](function(){return _0x2d5590;});}else{return _0x2d5590;}})[_0xbad1('0x48')](function(_0x46ef45){logger[_0xbad1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46ef45);throw _0x46ef45;});}return _0x2d5590;})[_0xbad1('0x24')](respondWithResult(_0x4e1210,0xc9))[_0xbad1('0x48')](handleError(_0x4e1210,null));};exports[_0xbad1('0x23')]=function(_0x5bda0f,_0x366c7a){if(_0x5bda0f[_0xbad1('0x4d')]['id']){delete _0x5bda0f[_0xbad1('0x4d')]['id'];}return db['Variable'][_0xbad1('0x4b')]({'where':{'id':_0x5bda0f[_0xbad1('0x4a')]['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x366c7a,null))[_0xbad1('0x24')](saveUpdates(_0x5bda0f['body'],null))[_0xbad1('0x24')](respondWithResult(_0x366c7a,null))[_0xbad1('0x48')](handleError(_0x366c7a,null));};exports[_0xbad1('0x25')]=function(_0x9c875f,_0x5d8152){return db[_0xbad1('0x30')][_0xbad1('0x4b')]({'where':{'id':_0x9c875f[_0xbad1('0x4a')]['id']}})[_0xbad1('0x24')](handleEntityNotFound(_0x5d8152,null))[_0xbad1('0x24')](removeEntity(_0x5d8152,null))['catch'](handleError(_0x5d8152,null));}; \ No newline at end of file +var _0x1469=['merge','options','includeAll','include','rows','catch','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x58dd80,_0x28da73){var _0x11590e=function(_0x2affb8){while(--_0x2affb8){_0x58dd80['push'](_0x58dd80['shift']());}};_0x11590e(++_0x28da73);}(_0x1469,0x104));var _0x9146=function(_0x2c1dde,_0x3f5223){_0x2c1dde=_0x2c1dde-0x0;var _0x5279ba=_0x1469[_0x2c1dde];return _0x5279ba;};'use strict';var emlformat=require(_0x9146('0x0'));var rimraf=require(_0x9146('0x1'));var zipdir=require(_0x9146('0x2'));var jsonpatch=require(_0x9146('0x3'));var rp=require(_0x9146('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9146('0x5'));var util=require(_0x9146('0x6'));var path=require(_0x9146('0x7'));var sox=require(_0x9146('0x8'));var csv=require(_0x9146('0x9'));var ejs=require(_0x9146('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9146('0xb'));var squel=require(_0x9146('0xc'));var crypto=require(_0x9146('0xd'));var jsforce=require(_0x9146('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9146('0xf'));var Papa=require(_0x9146('0x10'));var Redis=require(_0x9146('0x11'));var authService=require(_0x9146('0x12'));var qs=require(_0x9146('0x13'));var as=require(_0x9146('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9146('0x15'))('api');var utils=require(_0x9146('0x16'));var config=require(_0x9146('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9146('0x18'))['db'];function respondWithStatusCode(_0x938b78,_0x22ae28){_0x22ae28=_0x22ae28||0xcc;return function(_0x5a6b74){if(_0x5a6b74){return _0x938b78[_0x9146('0x19')](_0x22ae28);}return _0x938b78['status'](_0x22ae28)[_0x9146('0x1a')]();};}function respondWithResult(_0x2c3c0f,_0x2a007e){_0x2a007e=_0x2a007e||0xc8;return function(_0x2c7b9d){if(_0x2c7b9d){return _0x2c3c0f[_0x9146('0x1b')](_0x2a007e)[_0x9146('0x1c')](_0x2c7b9d);}};}function respondWithFilteredResult(_0x23c364,_0x4952ba){return function(_0xe58949){if(_0xe58949){var _0x414d7e=typeof _0x4952ba[_0x9146('0x1d')]===_0x9146('0x1e')&&typeof _0x4952ba[_0x9146('0x1f')]===_0x9146('0x1e');var _0x596c55=_0xe58949['count'];var _0x5e2cf6=_0x414d7e?0x0:_0x4952ba['offset'];var _0x1cedfa=_0x414d7e?_0xe58949[_0x9146('0x20')]:_0x4952ba[_0x9146('0x1d')]+_0x4952ba[_0x9146('0x1f')];var _0x43312d;if(_0x1cedfa>=_0x596c55){_0x1cedfa=_0x596c55;_0x43312d=0xc8;}else{_0x43312d=0xce;}_0x23c364[_0x9146('0x1b')](_0x43312d);return _0x23c364['set'](_0x9146('0x21'),_0x5e2cf6+'-'+_0x1cedfa+'/'+_0x596c55)['json'](_0xe58949);}return null;};}function patchUpdates(_0x3145b3){return function(_0x1effd0){try{jsonpatch[_0x9146('0x22')](_0x1effd0,_0x3145b3,!![]);}catch(_0xacd279){return BPromise[_0x9146('0x23')](_0xacd279);}return _0x1effd0[_0x9146('0x24')]();};}function saveUpdates(_0x4e61a7,_0x430bb8){return function(_0x21b52c){if(_0x21b52c){return _0x21b52c[_0x9146('0x25')](_0x4e61a7)[_0x9146('0x26')](function(_0x49c05e){return _0x49c05e;});}return null;};}function removeEntity(_0x1a0b05,_0x5226f7){return function(_0x3dbf6a){if(_0x3dbf6a){return _0x3dbf6a[_0x9146('0x27')]()[_0x9146('0x26')](function(){var _0x8579c3=_0x3dbf6a[_0x9146('0x28')]({'plain':!![]});var _0x5082d4='Variables';return db['UserProfileResource'][_0x9146('0x27')]({'where':{'type':_0x5082d4,'resourceId':_0x8579c3['id']}})[_0x9146('0x26')](function(){return _0x3dbf6a;});})['then'](function(){_0x1a0b05['status'](0xcc)[_0x9146('0x1a')]();});}};}function handleEntityNotFound(_0x5b9a91,_0x238956){return function(_0x35a2f1){if(!_0x35a2f1){_0x5b9a91[_0x9146('0x19')](0x194);}return _0x35a2f1;};}function handleError(_0x5ac402,_0x440c4b){_0x440c4b=_0x440c4b||0x1f4;return function(_0x54dc77){logger[_0x9146('0x29')](_0x54dc77[_0x9146('0x2a')]);if(_0x54dc77['name']){delete _0x54dc77[_0x9146('0x2b')];}_0x5ac402[_0x9146('0x1b')](_0x440c4b)[_0x9146('0x2c')](_0x54dc77);};}exports[_0x9146('0x2d')]=function(_0x48f879,_0x376027){var _0x53b0f8={},_0x3de855={},_0x282481={'count':0x0,'rows':[]};var _0x21f7c6=_[_0x9146('0x2e')](db[_0x9146('0x2f')][_0x9146('0x30')],function(_0x3ae350){return{'name':_0x3ae350['fieldName'],'type':_0x3ae350[_0x9146('0x31')][_0x9146('0x32')]};});_0x3de855[_0x9146('0x33')]=_['map'](_0x21f7c6,'name');_0x3de855[_0x9146('0x34')]=_['keys'](_0x48f879[_0x9146('0x34')]);_0x3de855[_0x9146('0x35')]=_[_0x9146('0x36')](_0x3de855[_0x9146('0x33')],_0x3de855[_0x9146('0x34')]);_0x53b0f8[_0x9146('0x37')]=_[_0x9146('0x36')](_0x3de855[_0x9146('0x33')],qs[_0x9146('0x38')](_0x48f879[_0x9146('0x34')][_0x9146('0x38')]));_0x53b0f8[_0x9146('0x37')]=_0x53b0f8['attributes'][_0x9146('0x39')]?_0x53b0f8[_0x9146('0x37')]:_0x3de855['model'];if(!_0x48f879[_0x9146('0x34')][_0x9146('0x3a')](_0x9146('0x3b'))){_0x53b0f8[_0x9146('0x1f')]=qs['limit'](_0x48f879[_0x9146('0x34')][_0x9146('0x1f')]);_0x53b0f8[_0x9146('0x1d')]=qs[_0x9146('0x1d')](_0x48f879[_0x9146('0x34')][_0x9146('0x1d')]);}_0x53b0f8['order']=qs[_0x9146('0x3c')](_0x48f879[_0x9146('0x34')][_0x9146('0x3c')]);_0x53b0f8[_0x9146('0x3d')]=qs[_0x9146('0x35')](_[_0x9146('0x3e')](_0x48f879[_0x9146('0x34')],_0x3de855[_0x9146('0x35')]),_0x21f7c6);if(_0x48f879[_0x9146('0x34')][_0x9146('0x3f')]){_0x53b0f8[_0x9146('0x3d')]=_['merge'](_0x53b0f8[_0x9146('0x3d')],{'$or':_[_0x9146('0x2e')](_0x21f7c6,function(_0x4d181f){if(_0x4d181f['type']!=='VIRTUAL'){var _0x4a6bd8={};_0x4a6bd8[_0x4d181f[_0x9146('0x2b')]]={'$like':'%'+_0x48f879[_0x9146('0x34')][_0x9146('0x3f')]+'%'};return _0x4a6bd8;}})});}_0x53b0f8=_[_0x9146('0x40')]({},_0x53b0f8,_0x48f879[_0x9146('0x41')]);var _0x2ae9ae={'where':_0x53b0f8['where']};return db['Variable']['count'](_0x2ae9ae)[_0x9146('0x26')](function(_0x2322ab){_0x282481[_0x9146('0x20')]=_0x2322ab;if(_0x48f879[_0x9146('0x34')][_0x9146('0x42')]){_0x53b0f8[_0x9146('0x43')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x53b0f8);})[_0x9146('0x26')](function(_0x4185a7){_0x282481[_0x9146('0x44')]=_0x4185a7;return _0x282481;})['then'](respondWithFilteredResult(_0x376027,_0x53b0f8))[_0x9146('0x45')](handleError(_0x376027,null));};exports['show']=function(_0x33ab3b,_0x3bde5b){var _0x5682c7={'raw':!![],'where':{'id':_0x33ab3b['params']['id']}},_0x50f0a3={};_0x50f0a3[_0x9146('0x33')]=_[_0x9146('0x46')](db[_0x9146('0x2f')][_0x9146('0x30')]);_0x50f0a3[_0x9146('0x34')]=_[_0x9146('0x46')](_0x33ab3b[_0x9146('0x34')]);_0x50f0a3[_0x9146('0x35')]=_[_0x9146('0x36')](_0x50f0a3['model'],_0x50f0a3['query']);_0x5682c7[_0x9146('0x37')]=_[_0x9146('0x36')](_0x50f0a3[_0x9146('0x33')],qs[_0x9146('0x38')](_0x33ab3b[_0x9146('0x34')][_0x9146('0x38')]));_0x5682c7[_0x9146('0x37')]=_0x5682c7[_0x9146('0x37')][_0x9146('0x39')]?_0x5682c7[_0x9146('0x37')]:_0x50f0a3[_0x9146('0x33')];if(_0x33ab3b[_0x9146('0x34')]['includeAll']){_0x5682c7['include']=[{'all':!![]}];}_0x5682c7=_['merge']({},_0x5682c7,_0x33ab3b['options']);return db['Variable']['find'](_0x5682c7)[_0x9146('0x26')](handleEntityNotFound(_0x3bde5b,null))[_0x9146('0x26')](respondWithResult(_0x3bde5b,null))['catch'](handleError(_0x3bde5b,null));};exports[_0x9146('0x47')]=function(_0x4cd863,_0x259e1c){return db['Variable']['create'](_0x4cd863[_0x9146('0x48')],{})[_0x9146('0x26')](function(_0x44fe22){var _0x2a3655=_0x4cd863[_0x9146('0x49')][_0x9146('0x28')]({'plain':!![]});if(!_0x2a3655)throw new Error(_0x9146('0x4a'));if(_0x2a3655[_0x9146('0x4b')]===_0x9146('0x49')){var _0x2d9fc9=_0x44fe22['get']({'plain':!![]});var _0x48f670=_0x9146('0x4c');return db['UserProfileSection'][_0x9146('0x4d')]({'where':{'name':_0x48f670,'userProfileId':_0x2a3655['userProfileId']},'raw':!![]})[_0x9146('0x26')](function(_0x9bd68a){if(_0x9bd68a&&_0x9bd68a[_0x9146('0x4e')]===0x0){return db['UserProfileResource'][_0x9146('0x47')]({'name':_0x2d9fc9[_0x9146('0x2b')],'resourceId':_0x2d9fc9['id'],'type':_0x9bd68a[_0x9146('0x2b')],'sectionId':_0x9bd68a['id']},{})[_0x9146('0x26')](function(){return _0x44fe22;});}else{return _0x44fe22;}})[_0x9146('0x45')](function(_0x29fd61){logger[_0x9146('0x29')](_0x9146('0x4f'),_0x29fd61);throw _0x29fd61;});}return _0x44fe22;})[_0x9146('0x26')](respondWithResult(_0x259e1c,0xc9))['catch'](handleError(_0x259e1c,null));};exports[_0x9146('0x25')]=function(_0x4ce87f,_0x44ff94){if(_0x4ce87f[_0x9146('0x48')]['id']){delete _0x4ce87f['body']['id'];}return db[_0x9146('0x2f')]['find']({'where':{'id':_0x4ce87f['params']['id']}})['then'](handleEntityNotFound(_0x44ff94,null))[_0x9146('0x26')](saveUpdates(_0x4ce87f[_0x9146('0x48')],null))[_0x9146('0x26')](respondWithResult(_0x44ff94,null))['catch'](handleError(_0x44ff94,null));};exports['destroy']=function(_0x43c2de,_0x4f8479){return db[_0x9146('0x2f')][_0x9146('0x4d')]({'where':{'id':_0x43c2de[_0x9146('0x50')]['id']}})[_0x9146('0x26')](handleEntityNotFound(_0x4f8479,null))['then'](removeEntity(_0x4f8479,null))[_0x9146('0x45')](handleError(_0x4f8479,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c8257de..b940971 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 _0x679f=['exports','define','Variable','util','../../config/logger','api','moment','request-promise','path','rimraf','./variable.attributes'];(function(_0x1d7726,_0xf72e96){var _0x1bf17b=function(_0x23ef44){while(--_0x23ef44){_0x1d7726['push'](_0x1d7726['shift']());}};_0x1bf17b(++_0xf72e96);}(_0x679f,0x1d1));var _0xf679=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x679f[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xf679('0x0'));var logger=require(_0xf679('0x1'))(_0xf679('0x2'));var moment=require(_0xf679('0x3'));var BPromise=require('bluebird');var rp=require(_0xf679('0x4'));var fs=require('fs');var path=require(_0xf679('0x5'));var rimraf=require(_0xf679('0x6'));var config=require('../../config/environment');var attributes=require(_0xf679('0x7'));module[_0xf679('0x8')]=function(_0x4ffd52,_0x8a99a5){return _0x4ffd52[_0xf679('0x9')](_0xf679('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8719=['tools_variables','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Variable'];(function(_0x3de823,_0x931f84){var _0x3f58f4=function(_0x6b8da9){while(--_0x6b8da9){_0x3de823['push'](_0x3de823['shift']());}};_0x3f58f4(++_0x931f84);}(_0x8719,0xd9));var _0x9871=function(_0x38a1e8,_0xfeb7f8){_0x38a1e8=_0x38a1e8-0x0;var _0x476c47=_0x8719[_0x38a1e8];return _0x476c47;};'use strict';var _=require(_0x9871('0x0'));var util=require(_0x9871('0x1'));var logger=require('../../config/logger')(_0x9871('0x2'));var moment=require(_0x9871('0x3'));var BPromise=require('bluebird');var rp=require(_0x9871('0x4'));var fs=require('fs');var path=require(_0x9871('0x5'));var rimraf=require(_0x9871('0x6'));var config=require(_0x9871('0x7'));var attributes=require('./variable.attributes');module[_0x9871('0x8')]=function(_0x5ceb32,_0x3dccee){return _0x5ceb32[_0x9871('0x9')](_0x9871('0xa'),attributes,{'tableName':_0x9871('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 16c9386..249b7f2 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x18cfe2,_0x1ab4bd){var _0x195aad=function(_0x229530){while(--_0x229530){_0x18cfe2['push'](_0x18cfe2['shift']());}};_0x195aad(++_0x1ab4bd);}(_0xabce,0x103));var _0xeabc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xabce[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x71a70,_0x4e1cdd){var _0x3a2b22=function(_0x17d53f){while(--_0x17d53f){_0x71a70['push'](_0x71a70['shift']());}};_0x3a2b22(++_0x4e1cdd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x5fc3[_0x389832];return _0x59429e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b7723f3..eca4f7c 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 _0x32a0=['/reset','reset','/pull','/restart','restart','migrations','exports','Router','../../components/auth/service','get','index','isAuthenticated','canUpdate','fetch'];(function(_0x586fa8,_0x21ae01){var _0x3b2a0f=function(_0xcee18){while(--_0xcee18){_0x586fa8['push'](_0x586fa8['shift']());}};_0x3b2a0f(++_0x21ae01);}(_0x32a0,0x157));var _0x032a=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x32a0[_0x5786f9];return _0x22c3cf;};'use strict';var express=require('express');var router=express[_0x032a('0x0')]();var auth=require(_0x032a('0x1'));var controller=require('./version.controller');router[_0x032a('0x2')]('/',controller[_0x032a('0x3')]);router[_0x032a('0x2')]('/fetch',auth[_0x032a('0x4')](),auth[_0x032a('0x5')](),controller[_0x032a('0x6')]);router['get'](_0x032a('0x7'),auth[_0x032a('0x4')](),auth[_0x032a('0x5')](),controller[_0x032a('0x8')]);router[_0x032a('0x2')](_0x032a('0x9'),auth[_0x032a('0x4')](),auth['canUpdate'](),controller['pull']);router['get'](_0x032a('0xa'),auth[_0x032a('0x4')](),controller[_0x032a('0xb')]);router[_0x032a('0x2')]('/migrations',controller[_0x032a('0xc')]);module[_0x032a('0xd')]=router; \ No newline at end of file +var _0x95e2=['pull','/restart','/migrations','migrations','exports','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x95e2,0xc5));var _0x295e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x95e2[_0x321bb2];return _0x9c12ed;};'use strict';var express=require('express');var router=express[_0x295e('0x0')]();var auth=require(_0x295e('0x1'));var controller=require('./version.controller');router[_0x295e('0x2')]('/',controller[_0x295e('0x3')]);router['get'](_0x295e('0x4'),auth[_0x295e('0x5')](),auth[_0x295e('0x6')](),controller[_0x295e('0x7')]);router['get'](_0x295e('0x8'),auth[_0x295e('0x5')](),auth[_0x295e('0x6')](),controller[_0x295e('0x9')]);router[_0x295e('0x2')](_0x295e('0xa'),auth[_0x295e('0x5')](),auth[_0x295e('0x6')](),controller[_0x295e('0xb')]);router['get'](_0x295e('0xc'),auth[_0x295e('0x5')](),controller['restart']);router[_0x295e('0x2')](_0x295e('0xd'),controller[_0x295e('0xe')]);module[_0x295e('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1eb06ad..3c1bfb3 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 _0x5c72=['../../config/pm2','../../config/logger','update','version','query','fetch','tags','latest','status','json','origin','info','git\x20fetch','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','replace','.js','exports','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','compare-versions','exec','../../mysqldb','../../config/environment'];(function(_0x2afaa0,_0x534de3){var _0x35868c=function(_0x51e153){while(--_0x51e153){_0x2afaa0['push'](_0x2afaa0['shift']());}};_0x35868c(++_0x534de3);}(_0x5c72,0x103));var _0x25c7=function(_0x42f98c,_0x551350){_0x42f98c=_0x42f98c-0x0;var _0x25c373=_0x5c72[_0x42f98c];return _0x25c373;};'use strict';var Umzug=require('umzug');var path=require(_0x25c7('0x0'));var fs=require('fs');var _=require(_0x25c7('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x25c7('0x2'));var exec=require('child_process')[_0x25c7('0x3')];var db=require(_0x25c7('0x4'))['db'];var config=require(_0x25c7('0x5'));var pm2=require(_0x25c7('0x6'));var logger=require(_0x25c7('0x7'))(_0x25c7('0x8'));var git=require('simple-git')(config['root']);exports['index']=function(_0x6b5456,_0x9f9b){var _0x227e5d={'current':module['exports'][_0x25c7('0x9')],'phonebar':0x2};if(_0x6b5456[_0x25c7('0xa')]&&_0x6b5456[_0x25c7('0xa')]['latest']){return git[_0x25c7('0xb')]()[_0x25c7('0xc')](function(_0x5aa51e,_0x4b4003){_0x227e5d[_0x25c7('0xd')]=(_0x5aa51e?module['exports'][_0x25c7('0x9')]:_0x4b4003[_0x25c7('0xd')])||'2.0.0';return _0x9f9b[_0x25c7('0xe')](0xc8)[_0x25c7('0xf')](_0x227e5d);});}else{return _0x9f9b[_0x25c7('0xe')](0xc8)['json'](_0x227e5d);}};exports['fetch']=function(_0x3a6f28,_0x657d55){return git[_0x25c7('0xb')]([_0x25c7('0x10'),'master'],function(_0x4225ff){if(_0x4225ff){logger['error'](_0x4225ff);return _0x657d55[_0x25c7('0xe')](0x1f4)[_0x25c7('0xf')](_0x4225ff);}logger[_0x25c7('0x11')](_0x25c7('0x12'));return _0x657d55[_0x25c7('0xe')](0xc8)[_0x25c7('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x25c7('0x13')]=function(_0x3dd6b5,_0x79324c){return git['reset']([_0x25c7('0x14'),_0x25c7('0x15')],function(_0x14b7cc){if(_0x14b7cc){logger[_0x25c7('0x16')](_0x14b7cc);return _0x79324c[_0x25c7('0xe')](0x1f4)['json'](_0x14b7cc);}logger[_0x25c7('0x11')](_0x25c7('0x17'));return _0x79324c[_0x25c7('0xe')](0xc8)['json']({'output':_0x25c7('0x18')});});};exports[_0x25c7('0x19')]=function(_0x7a6b38,_0x2537c6){exec(_0x25c7('0x1a'),function(_0x5e3532,_0x380da8,_0x17aa36){logger[_0x25c7('0x11')](_0x380da8);logger[_0x25c7('0x11')](_0x17aa36);if(_0x5e3532){logger[_0x25c7('0x16')](_0x5e3532);return _0x2537c6['status'](0x1f4)[_0x25c7('0xf')](_0x5e3532);}return _0x2537c6[_0x25c7('0xe')](0xc8)[_0x25c7('0xf')]({'output':_0x380da8});});};exports['restart']=function(_0x1a05dd,_0x500adf){return pm2['restart'](_0x25c7('0x1b'))['then'](function(_0x440ce5){logger[_0x25c7('0x11')](_0x25c7('0x1c'),_0x440ce5);return _0x500adf[_0x25c7('0xe')](0xc8)['json']({'output':_0x25c7('0x1d')});})['catch'](function(_0x29c30f){logger[_0x25c7('0x16')](_0x29c30f);return _0x500adf[_0x25c7('0xe')](0x1f4)[_0x25c7('0xf')](_0x29c30f);});};exports[_0x25c7('0x1e')]=function(_0xdea3b7,_0x4e0b5a){var _0x571b0e=fs[_0x25c7('0x1f')](path['join'](config['root'],_0x25c7('0x20'),_0x25c7('0x1e')));var _0x1c3604=[];for(var _0x3f923d=0x0;_0x3f923d<_0x571b0e[_0x25c7('0x21')];_0x3f923d++){var _0x488a78=_0x571b0e[_0x3f923d][_0x25c7('0x22')](_0x25c7('0x23'),'');if(compareVersions(module[_0x25c7('0x24')]['version'],_0x488a78)===-0x1){_0x1c3604[_0x25c7('0x25')](_0x488a78);}}if(_0x1c3604['length']){var _0x1448b4=_0x1c3604[_0x25c7('0x26')](compareVersions);var _0x22c4fe=new Umzug({'storage':_0x25c7('0x27'),'storageOptions':{'model':db[_0x25c7('0x28')],'modelName':_0x25c7('0x28'),'columnName':_0x25c7('0x9')},'migrations':{'params':[db[_0x25c7('0x27')][_0x25c7('0x29')](),db[_0x25c7('0x27')][_0x25c7('0x2a')],function(){throw new Error(_0x25c7('0x2b'));}],'path':path[_0x25c7('0x2c')](config[_0x25c7('0x2d')],'server','migrations'),'pattern':/\.js$/}});_0x22c4fe['up']({'migrations':_['map'](_0x1448b4,function(_0x4544ed){return _0x4544ed+'.js';})})[_0x25c7('0x2e')](function(){return _0x4e0b5a['status'](0xc8)['json']({'output':_0x25c7('0x2f')+module['exports'][_0x25c7('0x9')]+_0x25c7('0x30')+_[_0x25c7('0x31')](_0x1448b4),'migrations':_[_0x25c7('0x2c')](_0x1448b4)});})[_0x25c7('0x32')](function(_0x951ff7){if(_0x951ff7 instanceof db[_0x25c7('0x27')][_0x25c7('0x33')]){return _0x4e0b5a[_0x25c7('0xe')](0xc8)['json']({'output':_0x25c7('0x34')});}else{return _0x4e0b5a['status'](0x1f4)[_0x25c7('0xf')](_0x951ff7);}});}else{return _0x4e0b5a['status'](0xc8)[_0x25c7('0xf')]({'output':_0x25c7('0x34')});}}; \ No newline at end of file +var _0x328d=['motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart'];(function(_0x3ea96a,_0x5c7ccb){var _0x47e118=function(_0x55cfd3){while(--_0x55cfd3){_0x3ea96a['push'](_0x3ea96a['shift']());}};_0x47e118(++_0x5c7ccb);}(_0x328d,0xf8));var _0xd328=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x328d[_0x39096d];return _0x13da4f;};'use strict';var Umzug=require(_0xd328('0x0'));var path=require(_0xd328('0x1'));var fs=require('fs');var _=require(_0xd328('0x2'));var pkginfo=require(_0xd328('0x3'))(module,_0xd328('0x4'));var compareVersions=require(_0xd328('0x5'));var exec=require('child_process')[_0xd328('0x6')];var db=require(_0xd328('0x7'))['db'];var config=require(_0xd328('0x8'));var pm2=require(_0xd328('0x9'));var logger=require(_0xd328('0xa'))(_0xd328('0xb'));var git=require(_0xd328('0xc'))(config[_0xd328('0xd')]);exports[_0xd328('0xe')]=function(_0x5810ed,_0x242c93){var _0x590c94={'current':module[_0xd328('0xf')]['version'],'phonebar':0x2};if(_0x5810ed['query']&&_0x5810ed[_0xd328('0x10')][_0xd328('0x11')]){return git['fetch']()[_0xd328('0x12')](function(_0x43a68d,_0x11b824){_0x590c94['latest']=(_0x43a68d?module['exports'][_0xd328('0x4')]:_0x11b824['latest'])||_0xd328('0x13');return _0x242c93[_0xd328('0x14')](0xc8)[_0xd328('0x15')](_0x590c94);});}else{return _0x242c93[_0xd328('0x14')](0xc8)['json'](_0x590c94);}};exports[_0xd328('0x16')]=function(_0xf72ae7,_0x14551f){return git[_0xd328('0x16')](['origin','master'],function(_0x1a94ec){if(_0x1a94ec){logger[_0xd328('0x17')](_0x1a94ec);return _0x14551f['status'](0x1f4)[_0xd328('0x15')](_0x1a94ec);}logger[_0xd328('0x18')](_0xd328('0x19'));return _0x14551f[_0xd328('0x14')](0xc8)[_0xd328('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd328('0x1a')]=function(_0x2112f8,_0x5bea92){return git[_0xd328('0x1a')]([_0xd328('0x1b'),'FETCH_HEAD'],function(_0x2d60fc){if(_0x2d60fc){logger[_0xd328('0x17')](_0x2d60fc);return _0x5bea92['status'](0x1f4)['json'](_0x2d60fc);}logger[_0xd328('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x5bea92[_0xd328('0x14')](0xc8)[_0xd328('0x15')]({'output':_0xd328('0x1c')});});};exports[_0xd328('0x1d')]=function(_0x21c51b,_0x143c25){exec(_0xd328('0x1e'),function(_0x160992,_0x23172a,_0xad94e0){logger[_0xd328('0x18')](_0x23172a);logger['info'](_0xad94e0);if(_0x160992){logger[_0xd328('0x17')](_0x160992);return _0x143c25['status'](0x1f4)[_0xd328('0x15')](_0x160992);}return _0x143c25[_0xd328('0x14')](0xc8)['json']({'output':_0x23172a});});};exports[_0xd328('0x1f')]=function(_0x566728,_0xc6a4a1){return pm2[_0xd328('0x1f')](_0xd328('0x20'))[_0xd328('0x21')](function(_0x4b2ba8){logger[_0xd328('0x18')](_0xd328('0x22'),_0x4b2ba8);return _0xc6a4a1[_0xd328('0x14')](0xc8)[_0xd328('0x15')]({'output':_0xd328('0x23')});})[_0xd328('0x24')](function(_0x1c2f00){logger[_0xd328('0x17')](_0x1c2f00);return _0xc6a4a1[_0xd328('0x14')](0x1f4)[_0xd328('0x15')](_0x1c2f00);});};exports[_0xd328('0x25')]=function(_0x15b8b6,_0xfc677){var _0x4e4cec=fs[_0xd328('0x26')](path[_0xd328('0x27')](config[_0xd328('0xd')],_0xd328('0x28'),'migrations'));var _0x30f2a9=[];for(var _0xcac0f9=0x0;_0xcac0f9<_0x4e4cec['length'];_0xcac0f9++){var _0x57d10b=_0x4e4cec[_0xcac0f9]['replace'](_0xd328('0x29'),'');if(compareVersions(module[_0xd328('0xf')][_0xd328('0x4')],_0x57d10b)===-0x1){_0x30f2a9[_0xd328('0x2a')](_0x57d10b);}}if(_0x30f2a9[_0xd328('0x2b')]){var _0x34c93b=_0x30f2a9[_0xd328('0x2c')](compareVersions);var _0x215728=new Umzug({'storage':_0xd328('0x2d'),'storageOptions':{'model':db[_0xd328('0x2e')],'modelName':_0xd328('0x2e'),'columnName':_0xd328('0x4')},'migrations':{'params':[db['sequelize'][_0xd328('0x2f')](),db['sequelize'][_0xd328('0x30')],function(){throw new Error(_0xd328('0x31'));}],'path':path[_0xd328('0x27')](config[_0xd328('0xd')],'server',_0xd328('0x25')),'pattern':/\.js$/}});_0x215728['up']({'migrations':_[_0xd328('0x32')](_0x34c93b,function(_0x411bf9){return _0x411bf9+_0xd328('0x29');})})[_0xd328('0x21')](function(){return _0xfc677['status'](0xc8)[_0xd328('0x15')]({'output':_0xd328('0x33')+module[_0xd328('0xf')][_0xd328('0x4')]+_0xd328('0x34')+_[_0xd328('0x35')](_0x34c93b),'migrations':_[_0xd328('0x27')](_0x34c93b)});})[_0xd328('0x24')](function(_0x300802){if(_0x300802 instanceof db[_0xd328('0x2d')][_0xd328('0x36')]){return _0xfc677['status'](0xc8)['json']({'output':_0xd328('0x37')});}else{return _0xfc677[_0xd328('0x14')](0x1f4)[_0xd328('0x15')](_0x300802);}});}else{return _0xfc677['status'](0xc8)['json']({'output':_0xd328('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d50590f..4c4614b 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 _0xf1f2=['delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','show','post','isAuthenticated','create','put','/:id','update'];(function(_0x1da20b,_0x315507){var _0x1a002a=function(_0x2af118){while(--_0x2af118){_0x1da20b['push'](_0x1da20b['shift']());}};_0x1a002a(++_0x315507);}(_0xf1f2,0x145));var _0x2f1f=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xf1f2[_0x5280f4];return _0xba93e7;};'use strict';var multer=require('multer');var util=require(_0x2f1f('0x0'));var path=require(_0x2f1f('0x1'));var timeout=require(_0x2f1f('0x2'));var express=require('express');var router=express[_0x2f1f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2f1f('0x4'));var interaction=require(_0x2f1f('0x5'));var config=require(_0x2f1f('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x2f1f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f1f('0x7')](_0x2f1f('0x8'),auth['isAuthenticated'](),controller[_0x2f1f('0x9')]);router[_0x2f1f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2f1f('0xa')]);router[_0x2f1f('0xb')]('/',auth[_0x2f1f('0xc')](),controller[_0x2f1f('0xd')]);router[_0x2f1f('0xe')](_0x2f1f('0xf'),auth[_0x2f1f('0xc')](),controller[_0x2f1f('0x10')]);router[_0x2f1f('0x11')](_0x2f1f('0xf'),auth[_0x2f1f('0xc')](),controller['destroy']);module[_0x2f1f('0x12')]=router; \ No newline at end of file +var _0x09ea=['/describe','describe','/:id','post','create','put','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x210895,_0xb322f9){var _0x1f5e14=function(_0x1ad588){while(--_0x1ad588){_0x210895['push'](_0x210895['shift']());}};_0x1f5e14(++_0xb322f9);}(_0x09ea,0x139));var _0xa09e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09ea[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa09e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa09e('0x1'));var express=require(_0xa09e('0x2'));var router=express[_0xa09e('0x3')]();var fs_extra=require(_0xa09e('0x4'));var auth=require(_0xa09e('0x5'));var interaction=require(_0xa09e('0x6'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xa09e('0x7')]('/',auth[_0xa09e('0x8')](),controller[_0xa09e('0x9')]);router[_0xa09e('0x7')](_0xa09e('0xa'),auth[_0xa09e('0x8')](),controller[_0xa09e('0xb')]);router[_0xa09e('0x7')](_0xa09e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa09e('0xd')]('/',auth[_0xa09e('0x8')](),controller[_0xa09e('0xe')]);router[_0xa09e('0xf')]('/:id',auth[_0xa09e('0x8')](),controller['update']);router['delete'](_0xa09e('0xc'),auth[_0xa09e('0x8')](),controller[_0xa09e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 572b2a9..7a6bc48 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 _0xc893=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0xe7832,_0x38fea3){var _0x5741ac=function(_0x1af5bf){while(--_0x1af5bf){_0xe7832['push'](_0xe7832['shift']());}};_0x5741ac(++_0x38fea3);}(_0xc893,0x194));var _0x3c89=function(_0x537439,_0x21f8a8){_0x537439=_0x537439-0x0;var _0x4d965f=_0xc893[_0x537439];return _0x4d965f;};'use strict';var Sequelize=require('sequelize');module[_0x3c89('0x0')]={'type':{'type':Sequelize[_0x3c89('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3c89('0x1')]},'queue':{'type':Sequelize[_0x3c89('0x1')]},'interface':{'type':Sequelize[_0x3c89('0x1')]},'membername':{'type':Sequelize[_0x3c89('0x1')]},'agentcalledAt':{'type':Sequelize[_0x3c89('0x2')]},'agentconnectAt':{'type':Sequelize[_0x3c89('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x3c89('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x3c89('0x2')]},'holdtime':{'type':Sequelize[_0x3c89('0x3')]},'agentcomplete':{'type':Sequelize[_0x3c89('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3c89('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3c89('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3c89('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3c89('0x1')]},'channelstate':{'type':Sequelize[_0x3c89('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3c89('0x1')]},'connectedlinename':{'type':Sequelize[_0x3c89('0x1')]},'language':{'type':Sequelize[_0x3c89('0x1')]},'accountcode':{'type':Sequelize[_0x3c89('0x1')]},'context':{'type':Sequelize[_0x3c89('0x1')]},'exten':{'type':Sequelize[_0x3c89('0x1')]},'priority':{'type':Sequelize[_0x3c89('0x1')]},'destchannel':{'type':Sequelize[_0x3c89('0x1')]},'destchannelstate':{'type':Sequelize[_0x3c89('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3c89('0x1')]},'destcalleridnum':{'type':Sequelize[_0x3c89('0x1')]},'destcalleridname':{'type':Sequelize[_0x3c89('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x3c89('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3c89('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x3c89('0x1')]},'destcontext':{'type':Sequelize[_0x3c89('0x1')]},'destexten':{'type':Sequelize[_0x3c89('0x1')]},'destpriority':{'type':Sequelize[_0x3c89('0x1')]},'destuniqueid':{'type':Sequelize[_0x3c89('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3c89('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x3c89('0x1')]},'transfer':{'type':Sequelize[_0x3c89('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3c89('0x1')],'comment':_0x3c89('0x5')},'transferexten':{'type':Sequelize[_0x3c89('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4e2e=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x26e23b,_0x1d43ca){_0x26e23b=_0x26e23b-0x0;var _0x596d9d=_0x4e2e[_0x26e23b];return _0x596d9d;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'type':{'type':Sequelize[_0xe4e2('0x1')]},'uniqueid':{'type':Sequelize[_0xe4e2('0x1')]},'calleridnum':{'type':Sequelize[_0xe4e2('0x1')]},'calleridname':{'type':Sequelize[_0xe4e2('0x1')]},'queue':{'type':Sequelize[_0xe4e2('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe4e2('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe4e2('0x2')]},'agentconnectAt':{'type':Sequelize[_0xe4e2('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xe4e2('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xe4e2('0x2')]},'holdtime':{'type':Sequelize[_0xe4e2('0x3')]},'agentcomplete':{'type':Sequelize[_0xe4e2('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe4e2('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe4e2('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe4e2('0x3')]},'agentacw':{'type':Sequelize[_0xe4e2('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe4e2('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xe4e2('0x1')]},'channel':{'type':Sequelize[_0xe4e2('0x1')]},'channelstate':{'type':Sequelize[_0xe4e2('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe4e2('0x1')]},'connectedlinename':{'type':Sequelize[_0xe4e2('0x1')]},'language':{'type':Sequelize[_0xe4e2('0x1')]},'accountcode':{'type':Sequelize[_0xe4e2('0x1')]},'context':{'type':Sequelize[_0xe4e2('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe4e2('0x1')]},'destchannel':{'type':Sequelize[_0xe4e2('0x1')]},'destchannelstate':{'type':Sequelize[_0xe4e2('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe4e2('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe4e2('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe4e2('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe4e2('0x1')]},'destlanguage':{'type':Sequelize[_0xe4e2('0x1')]},'destaccountcode':{'type':Sequelize[_0xe4e2('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe4e2('0x1')]},'destuniqueid':{'type':Sequelize[_0xe4e2('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe4e2('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xe4e2('0x1')]},'transfer':{'type':Sequelize[_0xe4e2('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe4e2('0x5')},'transferexten':{'type':Sequelize[_0xe4e2('0x1')]},'transferuniqueid':{'type':Sequelize[_0xe4e2('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 3a857a1..08ee96f 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(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 c852573..86268d1 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 _0x68f5=['bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment'];(function(_0x3e0732,_0xf14392){var _0x6075f8=function(_0x252038){while(--_0x252038){_0x3e0732['push'](_0x3e0732['shift']());}};_0x6075f8(++_0xf14392);}(_0x68f5,0x11a));var _0x568f=function(_0x22f234,_0x4e7aa4){_0x22f234=_0x22f234-0x0;var _0x3d345f=_0x68f5[_0x22f234];return _0x3d345f;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))('api');var moment=require(_0x568f('0x3'));var BPromise=require(_0x568f('0x4'));var rp=require(_0x568f('0x5'));var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x31444b,_0x3181fd){return _0x31444b['define']('VoiceAgentReport',attributes,{'tableName':_0x568f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x568f('0xb'),_0x568f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c94=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x3a9bfd,_0x3e9fa0){var _0xf2dc64=function(_0x10d173){while(--_0x10d173){_0x3a9bfd['push'](_0x3a9bfd['shift']());}};_0xf2dc64(++_0x3e9fa0);}(_0x3c94,0xcd));var _0x43c9=function(_0x14ec9d,_0x45d283){_0x14ec9d=_0x14ec9d-0x0;var _0x3636df=_0x3c94[_0x14ec9d];return _0x3636df;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var logger=require(_0x43c9('0x2'))(_0x43c9('0x3'));var moment=require(_0x43c9('0x4'));var BPromise=require(_0x43c9('0x5'));var rp=require(_0x43c9('0x6'));var fs=require('fs');var path=require(_0x43c9('0x7'));var rimraf=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var attributes=require(_0x43c9('0xa'));module[_0x43c9('0xb')]=function(_0x4fdfc2,_0x39c220){return _0x4fdfc2[_0x43c9('0xc')](_0x43c9('0xd'),attributes,{'tableName':_0x43c9('0xe'),'paranoid':![],'indexes':[{'fields':[_0x43c9('0xf'),_0x43c9('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ba205a2..8612712 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 _0x898e=['info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','update','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x2a80fe,_0x114492){var _0x177d9d=function(_0x1c43e0){while(--_0x1c43e0){_0x2a80fe['push'](_0x2a80fe['shift']());}};_0x177d9d(++_0x114492);}(_0x898e,0x169));var _0xe898=function(_0x72b378,_0x4db3a1){_0x72b378=_0x72b378-0x0;var _0x5a58cc=_0x898e[_0x72b378];return _0x5a58cc;};'use strict';var _=require(_0xe898('0x0'));var util=require('util');var moment=require(_0xe898('0x1'));var BPromise=require(_0xe898('0x2'));var rs=require(_0xe898('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe898('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe898('0x5'))(_0xe898('0x6'));var config=require(_0xe898('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe898('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b896a,_0x2f7923,_0x2873c1){return new BPromise(function(_0x421c87,_0xa6c4cc){return client[_0xe898('0x9')](_0x2b896a,_0x2873c1)[_0xe898('0xa')](function(_0x4d5545){logger[_0xe898('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x2f7923,'request\x20sent');logger[_0xe898('0xc')](_0xe898('0xd'),_0x2f7923,'request\x20sent',JSON[_0xe898('0xe')](_0x4d5545));if(_0x4d5545[_0xe898('0xf')]){if(_0x4d5545['error']['code']===0x1f4){logger[_0xe898('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x2f7923,_0x4d5545[_0xe898('0xf')][_0xe898('0x10')]);return _0xa6c4cc(_0x4d5545[_0xe898('0xf')][_0xe898('0x10')]);}logger[_0xe898('0xf')](_0xe898('0x11'),_0x2f7923,_0x4d5545[_0xe898('0xf')][_0xe898('0x10')]);return _0x421c87(_0x4d5545[_0xe898('0xf')][_0xe898('0x10')]);}else{logger[_0xe898('0xb')](_0xe898('0x11'),_0x2f7923,_0xe898('0x12'));_0x421c87(_0x4d5545[_0xe898('0x13')][_0xe898('0x10')]);}})['catch'](function(_0xddda9a){logger['error'](_0xe898('0x11'),_0x2f7923,_0xddda9a);_0xa6c4cc(_0xddda9a);});});}exports[_0xe898('0x14')]=function(_0x1d9dde){var _0x264aaa=this;return new Promise(function(_0x3ab256,_0x5ccb12){return db[_0xe898('0x15')][_0xe898('0x16')](_0x1d9dde[_0xe898('0x17')],{'raw':_0x1d9dde[_0xe898('0x18')]?_0x1d9dde[_0xe898('0x18')][_0xe898('0x19')]===undefined?!![]:![]:!![]})[_0xe898('0xa')](function(_0x2e72fb){logger[_0xe898('0xb')](_0xe898('0x14'),_0x1d9dde);logger['debug'](_0xe898('0x14'),_0x1d9dde,JSON[_0xe898('0xe')](_0x2e72fb));_0x3ab256(_0x2e72fb);})[_0xe898('0x1a')](function(_0x24c294){logger[_0xe898('0xf')](_0xe898('0x14'),_0x24c294[_0xe898('0x10')],_0x1d9dde);_0x5ccb12(_0x264aaa[_0xe898('0xf')](0x1f4,_0x24c294['message']));});});};exports[_0xe898('0x1b')]=function(_0x441390){var _0x17b660=this;return new Promise(function(_0x53a980,_0x1512bf){return db[_0xe898('0x15')][_0xe898('0x1c')](_0x441390[_0xe898('0x17')],{'raw':_0x441390['options']?_0x441390['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441390[_0xe898('0x18')]?_0x441390[_0xe898('0x18')]['where']||null:null,'attributes':_0x441390[_0xe898('0x18')]?_0x441390[_0xe898('0x18')][_0xe898('0x1d')]||null:null,'limit':_0x441390['options']?_0x441390[_0xe898('0x18')][_0xe898('0x1e')]||null:null})[_0xe898('0xa')](function(_0x2867a8){logger[_0xe898('0xb')](_0xe898('0x1b'),_0x441390);logger[_0xe898('0xc')](_0xe898('0x1b'),_0x441390,JSON[_0xe898('0xe')](_0x2867a8));_0x53a980(_0x2867a8);})[_0xe898('0x1a')](function(_0x50931c){logger[_0xe898('0xf')](_0xe898('0x1b'),_0x50931c['message'],_0x441390);_0x1512bf(_0x17b660[_0xe898('0xf')](0x1f4,_0x50931c[_0xe898('0x10')]));});});}; \ No newline at end of file +var _0x7d37=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','debug','error','code','VoiceAgentReport,\x20%s,\x20%s','message','request\x20sent','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','info','stringify','catch','UpdateVoiceAgentReport','update'];(function(_0x279614,_0x4cce43){var _0x2a331c=function(_0x2d37b4){while(--_0x2d37b4){_0x279614['push'](_0x279614['shift']());}};_0x2a331c(++_0x4cce43);}(_0x7d37,0x157));var _0x77d3=function(_0xffbcfd,_0x801544){_0xffbcfd=_0xffbcfd-0x0;var _0x305ddb=_0x7d37[_0xffbcfd];return _0x305ddb;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require(_0x77d3('0x3'));var rs=require(_0x77d3('0x4'));var fs=require('fs');var Redis=require(_0x77d3('0x5'));var db=require(_0x77d3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d3('0x7'))(_0x77d3('0x8'));var config=require('../../config/environment');var jayson=require(_0x77d3('0x9'));var client=jayson['client'][_0x77d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xda073c,_0x480669,_0x4ea577){return new BPromise(function(_0x3642a6,_0x49ef89){return client['request'](_0xda073c,_0x4ea577)[_0x77d3('0xb')](function(_0xfc8ebe){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x480669,'request\x20sent');logger[_0x77d3('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x480669,'request\x20sent',JSON['stringify'](_0xfc8ebe));if(_0xfc8ebe[_0x77d3('0xd')]){if(_0xfc8ebe[_0x77d3('0xd')][_0x77d3('0xe')]===0x1f4){logger[_0x77d3('0xd')](_0x77d3('0xf'),_0x480669,_0xfc8ebe[_0x77d3('0xd')][_0x77d3('0x10')]);return _0x49ef89(_0xfc8ebe['error'][_0x77d3('0x10')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x480669,_0xfc8ebe[_0x77d3('0xd')][_0x77d3('0x10')]);return _0x3642a6(_0xfc8ebe[_0x77d3('0xd')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x480669,_0x77d3('0x11'));_0x3642a6(_0xfc8ebe[_0x77d3('0x12')][_0x77d3('0x10')]);}})['catch'](function(_0x2b0fb0){logger['error'](_0x77d3('0xf'),_0x480669,_0x2b0fb0);_0x49ef89(_0x2b0fb0);});});}exports[_0x77d3('0x13')]=function(_0x7009b3){var _0x1916c0=this;return new Promise(function(_0xeb6ed2,_0x41871c){return db[_0x77d3('0x14')]['create'](_0x7009b3[_0x77d3('0x15')],{'raw':_0x7009b3[_0x77d3('0x16')]?_0x7009b3[_0x77d3('0x16')][_0x77d3('0x17')]===undefined?!![]:![]:!![]})[_0x77d3('0xb')](function(_0xe7de4e){logger[_0x77d3('0x18')](_0x77d3('0x13'),_0x7009b3);logger[_0x77d3('0xc')]('CreateVoiceAgentReport',_0x7009b3,JSON[_0x77d3('0x19')](_0xe7de4e));_0xeb6ed2(_0xe7de4e);})[_0x77d3('0x1a')](function(_0x1fea63){logger[_0x77d3('0xd')](_0x77d3('0x13'),_0x1fea63[_0x77d3('0x10')],_0x7009b3);_0x41871c(_0x1916c0['error'](0x1f4,_0x1fea63[_0x77d3('0x10')]));});});};exports[_0x77d3('0x1b')]=function(_0x37cf6e){var _0x5e2e58=this;return new Promise(function(_0x42086d,_0x5beeb8){return db[_0x77d3('0x14')][_0x77d3('0x1c')](_0x37cf6e[_0x77d3('0x15')],{'raw':_0x37cf6e[_0x77d3('0x16')]?_0x37cf6e[_0x77d3('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37cf6e[_0x77d3('0x16')]?_0x37cf6e['options'][_0x77d3('0x1d')]||null:null,'attributes':_0x37cf6e[_0x77d3('0x16')]?_0x37cf6e[_0x77d3('0x16')]['attributes']||null:null,'limit':_0x37cf6e[_0x77d3('0x16')]?_0x37cf6e[_0x77d3('0x16')][_0x77d3('0x1e')]||null:null})[_0x77d3('0xb')](function(_0x26b0b){logger[_0x77d3('0x18')](_0x77d3('0x1b'),_0x37cf6e);logger[_0x77d3('0xc')](_0x77d3('0x1b'),_0x37cf6e,JSON[_0x77d3('0x19')](_0x26b0b));_0x42086d(_0x26b0b);})[_0x77d3('0x1a')](function(_0x4ce55d){logger['error'](_0x77d3('0x1b'),_0x4ce55d[_0x77d3('0x10')],_0x37cf6e);_0x5beeb8(_0x5e2e58[_0x77d3('0xd')](0x1f4,_0x4ce55d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 242e190..cab867e 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 _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x2f2218,_0x37d823){var _0x2afc75=function(_0x8ae8da){while(--_0x8ae8da){_0x2f2218['push'](_0x2f2218['shift']());}};_0x2afc75(++_0x37d823);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xc72a72,_0xfaaf35){_0xc72a72=_0xc72a72-0x0;var _0x20f9a9=_0xd0bb[_0xc72a72];return _0x20f9a9;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file +var _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x24ca,0x1bc));var _0xa24c=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x24ca[_0xca1f0e];return _0x35e4ef;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c44309c..dd439a9 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 _0xcabf=['DATE','INTEGER','sequelize','exports','internal','dialer','STRING','TEXT'];(function(_0x4e2dc7,_0x40f581){var _0x4e6e0f=function(_0x168e86){while(--_0x168e86){_0x4e2dc7['push'](_0x4e2dc7['shift']());}};_0x4e6e0f(++_0x40f581);}(_0xcabf,0x102));var _0xfcab=function(_0x3021bb,_0x184517){_0x3021bb=_0x3021bb-0x0;var _0x29f11f=_0xcabf[_0x3021bb];return _0x29f11f;};'use strict';var Sequelize=require(_0xfcab('0x0'));module[_0xfcab('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('inbound',_0xfcab('0x2'),'outbound','inbound-fax','outbound-fax',_0xfcab('0x3'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfcab('0x4')]},'source':{'type':Sequelize[_0xfcab('0x4')]},'destination':{'type':Sequelize[_0xfcab('0x4')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfcab('0x4')]},'channel':{'type':Sequelize[_0xfcab('0x4')]},'destinationchannel':{'type':Sequelize[_0xfcab('0x4')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xfcab('0x5')]},'starttime':{'type':Sequelize[_0xfcab('0x6')]},'systemanswertime':{'type':Sequelize[_0xfcab('0x6')]},'answertime':{'type':Sequelize[_0xfcab('0x6')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xfcab('0x7')]},'billableseconds':{'type':Sequelize[_0xfcab('0x7')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfcab('0x4')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xfcab('0x4')]},'userDisposition':{'type':Sequelize[_0xfcab('0x4')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xfcab('0x4')]},'note':{'type':Sequelize[_0xfcab('0x4')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xfcab('0x4')]}}; \ No newline at end of file +var _0x25e7=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x31147e,_0x2ff5b9){var _0x395bf8=function(_0x4bdec4){while(--_0x4bdec4){_0x31147e['push'](_0x31147e['shift']());}};_0x395bf8(++_0x2ff5b9);}(_0x25e7,0x1d6));var _0x725e=function(_0x31a180,_0x3924b9){_0x31a180=_0x31a180-0x0;var _0x4b0502=_0x25e7[_0x31a180];return _0x4b0502;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'uniqueid':{'type':Sequelize[_0x725e('0x2')]},'type':{'type':Sequelize[_0x725e('0x3')](_0x725e('0x4'),_0x725e('0x5'),_0x725e('0x6'),_0x725e('0x7'),_0x725e('0x8'),_0x725e('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x725e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x725e('0x2')]},'channel':{'type':Sequelize[_0x725e('0x2')]},'destinationchannel':{'type':Sequelize[_0x725e('0x2')]},'lastapplication':{'type':Sequelize[_0x725e('0x2')]},'lastdata':{'type':Sequelize[_0x725e('0xa')]},'starttime':{'type':Sequelize[_0x725e('0xb')]},'systemanswertime':{'type':Sequelize[_0x725e('0xb')]},'answertime':{'type':Sequelize[_0x725e('0xb')]},'endtime':{'type':Sequelize[_0x725e('0xb')]},'duration':{'type':Sequelize[_0x725e('0xc')]},'billableseconds':{'type':Sequelize[_0x725e('0xc')]},'mohtime':{'type':Sequelize[_0x725e('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x725e('0x2')]},'userDisposition':{'type':Sequelize[_0x725e('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x725e('0x2')]},'prefix':{'type':Sequelize[_0x725e('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x725e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 282822e..6ec09b2 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 _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(_0x4ed5df,_0x5a46b1){var _0x81a4db=function(_0x444635){while(--_0x444635){_0x4ed5df['push'](_0x4ed5df['shift']());}};_0x81a4db(++_0x5a46b1);}(_0xdb28,0x106));var _0x8db2=function(_0x1d5521,_0x3e43d6){_0x1d5521=_0x1d5521-0x0;var _0x5dc2d4=_0xdb28[_0x1d5521];return _0x5dc2d4;};'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 +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(_0x4ed939,_0x183efc){_0x4ed939=_0x4ed939-0x0;var _0x59c900=_0x2032[_0x4ed939];return _0x59c900;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ee1aa83..3ae900f 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 _0x6642=['uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','exports','VoiceCallReport','report_call'];(function(_0x1e626,_0x2c630d){var _0x4bb3e8=function(_0x8d9122){while(--_0x8d9122){_0x1e626['push'](_0x1e626['shift']());}};_0x4bb3e8(++_0x2c630d);}(_0x6642,0x105));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2664('0x0'));var util=require(_0x2664('0x1'));var logger=require(_0x2664('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2664('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2664('0x4'));var rimraf=require(_0x2664('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x2664('0x6')]=function(_0x2071ef,_0x5297cb){return _0x2071ef['define'](_0x2664('0x7'),attributes,{'tableName':_0x2664('0x8'),'paranoid':![],'indexes':[{'fields':[_0x2664('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a92=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x12ba3d,_0x2569c0){var _0x3e7897=function(_0x3339e6){while(--_0x3339e6){_0x12ba3d['push'](_0x12ba3d['shift']());}};_0x3e7897(++_0x2569c0);}(_0x2a92,0xbf));var _0x22a9=function(_0x48a24a,_0x3cb63c){_0x48a24a=_0x48a24a-0x0;var _0x5e35d8=_0x2a92[_0x48a24a];return _0x5e35d8;};'use strict';var _=require(_0x22a9('0x0'));var util=require(_0x22a9('0x1'));var logger=require(_0x22a9('0x2'))(_0x22a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22a9('0x4'));var fs=require('fs');var path=require(_0x22a9('0x5'));var rimraf=require(_0x22a9('0x6'));var config=require(_0x22a9('0x7'));var attributes=require(_0x22a9('0x8'));module['exports']=function(_0x5d9d1f,_0x3a3f84){return _0x5d9d1f[_0x22a9('0x9')](_0x22a9('0xa'),attributes,{'tableName':_0x22a9('0xb'),'paranoid':![],'indexes':[{'fields':[_0x22a9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 88303cb..46ada0d 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 _0x9982=['GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','raw','limit','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','map','model','then'];(function(_0x299b73,_0x4e1ba0){var _0x419ff4=function(_0x50561a){while(--_0x50561a){_0x299b73['push'](_0x299b73['shift']());}};_0x419ff4(++_0x4e1ba0);}(_0x9982,0xda));var _0x2998=function(_0x3dd822,_0x3b9fed){_0x3dd822=_0x3dd822-0x0;var _0x4f58d0=_0x9982[_0x3dd822];return _0x4f58d0;};'use strict';var _=require(_0x2998('0x0'));var util=require(_0x2998('0x1'));var moment=require(_0x2998('0x2'));var BPromise=require('bluebird');var rs=require(_0x2998('0x3'));var fs=require('fs');var Redis=require(_0x2998('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2998('0x5'));var logger=require('../../config/logger')(_0x2998('0x6'));var config=require(_0x2998('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2998('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10e761,_0x1fb7ee,_0x44b459){return new BPromise(function(_0x5c678e,_0x1149dd){return client['request'](_0x10e761,_0x44b459)['then'](function(_0x8cb8fb){logger[_0x2998('0x9')](_0x2998('0xa'),_0x1fb7ee,_0x2998('0xb'));logger[_0x2998('0xc')](_0x2998('0xd'),_0x1fb7ee,_0x2998('0xb'),JSON[_0x2998('0xe')](_0x8cb8fb));if(_0x8cb8fb[_0x2998('0xf')]){if(_0x8cb8fb[_0x2998('0xf')][_0x2998('0x10')]===0x1f4){logger[_0x2998('0xf')](_0x2998('0xa'),_0x1fb7ee,_0x8cb8fb[_0x2998('0xf')][_0x2998('0x11')]);return _0x1149dd(_0x8cb8fb['error'][_0x2998('0x11')]);}logger[_0x2998('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1fb7ee,_0x8cb8fb['error'][_0x2998('0x11')]);return _0x5c678e(_0x8cb8fb[_0x2998('0xf')][_0x2998('0x11')]);}else{logger['info'](_0x2998('0xa'),_0x1fb7ee,_0x2998('0xb'));_0x5c678e(_0x8cb8fb['result'][_0x2998('0x11')]);}})[_0x2998('0x12')](function(_0x3f148e){logger['error'](_0x2998('0xa'),_0x1fb7ee,_0x3f148e);_0x1149dd(_0x3f148e);});});}exports['GetVoiceCallReport']=function(_0x4c6054){var _0x1c010e=this;return new Promise(function(_0x3abd78,_0x2ee301){return db['VoiceCallReport'][_0x2998('0x13')]({'raw':_0x4c6054[_0x2998('0x14')]?_0x4c6054[_0x2998('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4c6054['options']?_0x4c6054['options'][_0x2998('0x15')]||null:null,'attributes':_0x4c6054[_0x2998('0x14')]?_0x4c6054[_0x2998('0x14')][_0x2998('0x16')]||null:null,'limit':_0x4c6054[_0x2998('0x14')]?_0x4c6054[_0x2998('0x14')]['limit']||null:null,'include':_0x4c6054[_0x2998('0x14')]?_0x4c6054[_0x2998('0x14')][_0x2998('0x17')]?_[_0x2998('0x18')](_0x4c6054[_0x2998('0x14')][_0x2998('0x17')],function(_0x2dda0e){return{'model':db[_0x2dda0e[_0x2998('0x19')]],'as':_0x2dda0e['as'],'attributes':_0x2dda0e[_0x2998('0x16')],'include':_0x2dda0e[_0x2998('0x17')]?_[_0x2998('0x18')](_0x2dda0e[_0x2998('0x17')],function(_0x8a26e){return{'model':db[_0x8a26e['model']],'as':_0x8a26e['as'],'attributes':_0x8a26e[_0x2998('0x16')],'include':_0x8a26e[_0x2998('0x17')]?_[_0x2998('0x18')](_0x8a26e[_0x2998('0x17')],function(_0x28db48){return{'model':db[_0x28db48[_0x2998('0x19')]],'as':_0x28db48['as'],'attributes':_0x28db48[_0x2998('0x16')]};}):[]};}):[]};}):[]:[]})[_0x2998('0x1a')](function(_0x3c92e1){logger[_0x2998('0x9')](_0x2998('0x1b'),_0x4c6054);logger[_0x2998('0xc')](_0x2998('0x1b'),_0x4c6054,JSON['stringify'](_0x3c92e1));_0x3abd78(_0x3c92e1);})[_0x2998('0x12')](function(_0x428c15){logger['error'](_0x2998('0x1b'),_0x428c15['message'],_0x4c6054);_0x2ee301(_0x1c010e['error'](0x1f4,_0x428c15['message']));});});};exports[_0x2998('0x1c')]=function(_0x340c39){var _0x474808=this;return new Promise(function(_0x56c057,_0xac7d45){return db[_0x2998('0x1d')][_0x2998('0x1e')](_0x340c39[_0x2998('0x1f')],{'raw':_0x340c39[_0x2998('0x14')]?_0x340c39[_0x2998('0x14')][_0x2998('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x110e6b){logger[_0x2998('0x9')](_0x2998('0x1c'),_0x340c39);logger[_0x2998('0xc')](_0x2998('0x1c'),_0x340c39,JSON['stringify'](_0x110e6b));_0x56c057(_0x110e6b);})[_0x2998('0x12')](function(_0x3a8eda){logger[_0x2998('0xf')](_0x2998('0x1c'),_0x3a8eda[_0x2998('0x11')],_0x340c39);_0xac7d45(_0x474808[_0x2998('0xf')](0x1f4,_0x3a8eda[_0x2998('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x50b05d){var _0x759fe5=this;return new Promise(function(_0x56d3b4,_0x44fd34){return db[_0x2998('0x1d')]['update'](_0x50b05d[_0x2998('0x1f')],{'raw':_0x50b05d[_0x2998('0x14')]?_0x50b05d['options'][_0x2998('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b05d[_0x2998('0x14')]?_0x50b05d[_0x2998('0x14')][_0x2998('0x15')]||null:null,'attributes':_0x50b05d['options']?_0x50b05d[_0x2998('0x14')][_0x2998('0x16')]||null:null,'limit':_0x50b05d[_0x2998('0x14')]?_0x50b05d[_0x2998('0x14')][_0x2998('0x21')]||null:null})[_0x2998('0x1a')](function(_0x9591cb){logger[_0x2998('0x9')](_0x2998('0x22'),_0x50b05d);logger[_0x2998('0xc')]('UpdateVoiceCallReport',_0x50b05d,JSON['stringify'](_0x9591cb));_0x56d3b4(_0x9591cb);})[_0x2998('0x12')](function(_0x2cdec7){logger[_0x2998('0xf')]('UpdateVoiceCallReport',_0x2cdec7[_0x2998('0x11')],_0x50b05d);_0x44fd34(_0x759fe5[_0x2998('0xf')](0x1f4,_0x2cdec7[_0x2998('0x11')]));});});}; \ No newline at end of file +var _0x1f6f=['CreateVoiceCallReport','VoiceCallReport','create','body','then','stringify','catch','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x49c361,_0x3f9c2a){var _0x26ccd9=function(_0x16e9ac){while(--_0x16e9ac){_0x49c361['push'](_0x49c361['shift']());}};_0x26ccd9(++_0x3f9c2a);}(_0x1f6f,0x1c2));var _0xf1f6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1f6f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf1f6('0x0'));var util=require(_0xf1f6('0x1'));var moment=require(_0xf1f6('0x2'));var BPromise=require(_0xf1f6('0x3'));var rs=require(_0xf1f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf1f6('0x5'));var logger=require('../../config/logger')(_0xf1f6('0x6'));var config=require(_0xf1f6('0x7'));var jayson=require(_0xf1f6('0x8'));var client=jayson[_0xf1f6('0x9')][_0xf1f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7726,_0x235ee8,_0x3d71cc){return new BPromise(function(_0x293cf7,_0x4cbbe2){return client[_0xf1f6('0xb')](_0x2e7726,_0x3d71cc)['then'](function(_0x5d4d7c){logger[_0xf1f6('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x235ee8,_0xf1f6('0xd'));logger[_0xf1f6('0xe')](_0xf1f6('0xf'),_0x235ee8,'request\x20sent',JSON['stringify'](_0x5d4d7c));if(_0x5d4d7c[_0xf1f6('0x10')]){if(_0x5d4d7c[_0xf1f6('0x10')][_0xf1f6('0x11')]===0x1f4){logger[_0xf1f6('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x235ee8,_0x5d4d7c[_0xf1f6('0x10')][_0xf1f6('0x12')]);return _0x4cbbe2(_0x5d4d7c[_0xf1f6('0x10')][_0xf1f6('0x12')]);}logger[_0xf1f6('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x235ee8,_0x5d4d7c['error'][_0xf1f6('0x12')]);return _0x293cf7(_0x5d4d7c[_0xf1f6('0x10')][_0xf1f6('0x12')]);}else{logger['info'](_0xf1f6('0x13'),_0x235ee8,_0xf1f6('0xd'));_0x293cf7(_0x5d4d7c[_0xf1f6('0x14')][_0xf1f6('0x12')]);}})['catch'](function(_0x5ac316){logger['error'](_0xf1f6('0x13'),_0x235ee8,_0x5ac316);_0x4cbbe2(_0x5ac316);});});}exports[_0xf1f6('0x15')]=function(_0x42cac2){var _0x454c2b=this;return new Promise(function(_0x1bce36,_0x111a39){return db['VoiceCallReport'][_0xf1f6('0x16')]({'raw':_0x42cac2[_0xf1f6('0x17')]?_0x42cac2['options'][_0xf1f6('0x18')]===undefined?!![]:![]:!![],'where':_0x42cac2[_0xf1f6('0x17')]?_0x42cac2['options']['where']||null:null,'attributes':_0x42cac2[_0xf1f6('0x17')]?_0x42cac2[_0xf1f6('0x17')][_0xf1f6('0x19')]||null:null,'limit':_0x42cac2[_0xf1f6('0x17')]?_0x42cac2[_0xf1f6('0x17')][_0xf1f6('0x1a')]||null:null,'include':_0x42cac2[_0xf1f6('0x17')]?_0x42cac2[_0xf1f6('0x17')][_0xf1f6('0x1b')]?_[_0xf1f6('0x1c')](_0x42cac2[_0xf1f6('0x17')][_0xf1f6('0x1b')],function(_0x3f7d9d){return{'model':db[_0x3f7d9d['model']],'as':_0x3f7d9d['as'],'attributes':_0x3f7d9d[_0xf1f6('0x19')],'include':_0x3f7d9d['include']?_[_0xf1f6('0x1c')](_0x3f7d9d[_0xf1f6('0x1b')],function(_0x2e427a){return{'model':db[_0x2e427a[_0xf1f6('0x1d')]],'as':_0x2e427a['as'],'attributes':_0x2e427a[_0xf1f6('0x19')],'include':_0x2e427a['include']?_['map'](_0x2e427a[_0xf1f6('0x1b')],function(_0x49826){return{'model':db[_0x49826[_0xf1f6('0x1d')]],'as':_0x49826['as'],'attributes':_0x49826[_0xf1f6('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d0029){logger[_0xf1f6('0xc')]('GetVoiceCallReport',_0x42cac2);logger[_0xf1f6('0xe')]('GetVoiceCallReport',_0x42cac2,JSON['stringify'](_0x5d0029));_0x1bce36(_0x5d0029);})['catch'](function(_0x27b876){logger[_0xf1f6('0x10')]('GetVoiceCallReport',_0x27b876[_0xf1f6('0x12')],_0x42cac2);_0x111a39(_0x454c2b[_0xf1f6('0x10')](0x1f4,_0x27b876[_0xf1f6('0x12')]));});});};exports[_0xf1f6('0x1e')]=function(_0x2e1209){var _0x323ff4=this;return new Promise(function(_0x4cf27b,_0x16a77f){return db[_0xf1f6('0x1f')][_0xf1f6('0x20')](_0x2e1209[_0xf1f6('0x21')],{'raw':_0x2e1209['options']?_0x2e1209[_0xf1f6('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf1f6('0x22')](function(_0x5a7b41){logger[_0xf1f6('0xc')](_0xf1f6('0x1e'),_0x2e1209);logger[_0xf1f6('0xe')](_0xf1f6('0x1e'),_0x2e1209,JSON[_0xf1f6('0x23')](_0x5a7b41));_0x4cf27b(_0x5a7b41);})[_0xf1f6('0x24')](function(_0x1b42f9){logger['error'](_0xf1f6('0x1e'),_0x1b42f9[_0xf1f6('0x12')],_0x2e1209);_0x16a77f(_0x323ff4['error'](0x1f4,_0x1b42f9['message']));});});};exports[_0xf1f6('0x25')]=function(_0x1e7e0f){var _0x99e0a5=this;return new Promise(function(_0x223b37,_0x2295a6){return db[_0xf1f6('0x1f')][_0xf1f6('0x26')](_0x1e7e0f[_0xf1f6('0x21')],{'raw':_0x1e7e0f[_0xf1f6('0x17')]?_0x1e7e0f[_0xf1f6('0x17')][_0xf1f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7e0f[_0xf1f6('0x17')]?_0x1e7e0f['options'][_0xf1f6('0x27')]||null:null,'attributes':_0x1e7e0f['options']?_0x1e7e0f['options'][_0xf1f6('0x19')]||null:null,'limit':_0x1e7e0f[_0xf1f6('0x17')]?_0x1e7e0f[_0xf1f6('0x17')][_0xf1f6('0x1a')]||null:null})[_0xf1f6('0x22')](function(_0x4d9950){logger['info'](_0xf1f6('0x25'),_0x1e7e0f);logger['debug'](_0xf1f6('0x25'),_0x1e7e0f,JSON[_0xf1f6('0x23')](_0x4d9950));_0x223b37(_0x4d9950);})['catch'](function(_0x3fb683){logger['error'](_0xf1f6('0x25'),_0x3fb683[_0xf1f6('0x12')],_0x1e7e0f);_0x2295a6(_0x99e0a5[_0xf1f6('0x10')](0x1f4,_0x3fb683['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 2e83274..1be532a 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 _0xe029=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','util'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xe029,0xe2));var _0x9e02=function(_0x588f2c,_0x10e069){_0x588f2c=_0x588f2c-0x0;var _0x467467=_0xe029[_0x588f2c];return _0x467467;};'use strict';var multer=require(_0x9e02('0x0'));var util=require(_0x9e02('0x1'));var path=require(_0x9e02('0x2'));var timeout=require(_0x9e02('0x3'));var express=require(_0x9e02('0x4'));var router=express[_0x9e02('0x5')]();var fs_extra=require(_0x9e02('0x6'));var auth=require(_0x9e02('0x7'));var interaction=require(_0x9e02('0x8'));var config=require(_0x9e02('0x9'));var controller=require('./voiceChanSpy.controller');router[_0x9e02('0xa')]('/',auth[_0x9e02('0xb')](),controller[_0x9e02('0xc')]);router['get'](_0x9e02('0xd'),auth['isAuthenticated'](),controller[_0x9e02('0xe')]);router[_0x9e02('0xf')]('/',auth[_0x9e02('0xb')](),controller[_0x9e02('0x10')]);router['put'](_0x9e02('0xd'),auth[_0x9e02('0xb')](),controller['update']);router[_0x9e02('0x11')](_0x9e02('0xd'),auth['isAuthenticated'](),controller[_0x9e02('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa5f3=['post','create','put','update','delete','destroy','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa5f3,0xcc));var _0x3a5f=function(_0x4491c0,_0x2bd55f){_0x4491c0=_0x4491c0-0x0;var _0x4c16a=_0xa5f3[_0x4491c0];return _0x4c16a;};'use strict';var multer=require('multer');var util=require(_0x3a5f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3a5f('0x1'));var router=express['Router']();var fs_extra=require(_0x3a5f('0x2'));var auth=require(_0x3a5f('0x3'));var interaction=require(_0x3a5f('0x4'));var config=require(_0x3a5f('0x5'));var controller=require(_0x3a5f('0x6'));router[_0x3a5f('0x7')]('/',auth[_0x3a5f('0x8')](),controller[_0x3a5f('0x9')]);router[_0x3a5f('0x7')](_0x3a5f('0xa'),auth['isAuthenticated'](),controller[_0x3a5f('0xb')]);router[_0x3a5f('0xc')]('/',auth[_0x3a5f('0x8')](),controller[_0x3a5f('0xd')]);router[_0x3a5f('0xe')](_0x3a5f('0xa'),auth[_0x3a5f('0x8')](),controller[_0x3a5f('0xf')]);router[_0x3a5f('0x10')](_0x3a5f('0xa'),auth[_0x3a5f('0x8')](),controller[_0x3a5f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7e855aa..21c97a5 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 _0xce91=['sequelize','exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x1f923d,_0x242123){var _0x5711f6=function(_0x3f6046){while(--_0x3f6046){_0x1f923d['push'](_0x1f923d['shift']());}};_0x5711f6(++_0x242123);}(_0xce91,0xcf));var _0x1ce9=function(_0x1ccfbe,_0x1302c1){_0x1ccfbe=_0x1ccfbe-0x0;var _0x24c36f=_0xce91[_0x1ccfbe];return _0x24c36f;};'use strict';var Sequelize=require(_0x1ce9('0x0'));module[_0x1ce9('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1ce9('0x2')],'unique':_0x1ce9('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1ce9('0x2')],'set':function(_0xc5998){this['setDataValue'](_0x1ce9('0x4'),_0xc5998?_0xc5998[_0x1ce9('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x1ce9('0x4'))?this[_0x1ce9('0x6')](_0x1ce9('0x4'))[_0x1ce9('0x7')](''):[];}},'auth':{'type':Sequelize[_0x1ce9('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x1ce9('0x2')]},'record':{'type':Sequelize[_0x1ce9('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1ce9('0x2')]}}; \ No newline at end of file +var _0x6637=['sequelize','STRING','name','setDataValue','join','getDataValue','options','BOOLEAN'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x6637,0xf0));var _0x7663=function(_0x2c17e6,_0x358d99){_0x2c17e6=_0x2c17e6-0x0;var _0x2f83c0=_0x6637[_0x2c17e6];return _0x2f83c0;};'use strict';var Sequelize=require(_0x7663('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7663('0x1')],'unique':_0x7663('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x404b7b){this[_0x7663('0x3')]('options',_0x404b7b?_0x404b7b[_0x7663('0x4')](''):[]);},'get':function(){return this[_0x7663('0x5')](_0x7663('0x6'))?this[_0x7663('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x7663('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x7663('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7663('0x1')]},'description':{'type':Sequelize[_0x7663('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e57a61a..55d5fff 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 _0xbbfa=['hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','get','ChanSpies','UserProfileResource','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x16b47f,_0x56cdd5){_0x16b47f=_0x16b47f-0x0;var _0x2070d4=_0xbbfa[_0x16b47f];return _0x2070d4;};'use strict';var emlformat=require(_0xabbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabbf('0x2'));var moment=require(_0xabbf('0x3'));var BPromise=require(_0xabbf('0x4'));var Mustache=require(_0xabbf('0x5'));var util=require(_0xabbf('0x6'));var path=require(_0xabbf('0x7'));var sox=require(_0xabbf('0x8'));var csv=require(_0xabbf('0x9'));var ejs=require(_0xabbf('0xa'));var fs=require('fs');var fs_extra=require(_0xabbf('0xb'));var _=require(_0xabbf('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabbf('0xd'));var toCsv=require(_0xabbf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabbf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xabbf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabbf('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xabbf('0x11'));var config=require(_0xabbf('0x12'));var licenseUtil=require(_0xabbf('0x13'));var db=require(_0xabbf('0x14'))['db'];function respondWithStatusCode(_0x265487,_0x1cc1a0){_0x1cc1a0=_0x1cc1a0||0xcc;return function(_0x28fb83){if(_0x28fb83){return _0x265487[_0xabbf('0x15')](_0x1cc1a0);}return _0x265487[_0xabbf('0x16')](_0x1cc1a0)['end']();};}function respondWithResult(_0x3c85e8,_0x5e6866){_0x5e6866=_0x5e6866||0xc8;return function(_0x3c6e6d){if(_0x3c6e6d){return _0x3c85e8['status'](_0x5e6866)[_0xabbf('0x17')](_0x3c6e6d);}};}function respondWithFilteredResult(_0x23a44a,_0x1df763){return function(_0x13b970){if(_0x13b970){var _0x529af0=typeof _0x1df763[_0xabbf('0x18')]===_0xabbf('0x19')&&typeof _0x1df763[_0xabbf('0x1a')]===_0xabbf('0x19');var _0xbfddcf=_0x13b970['count'];var _0x4252e1=_0x529af0?0x0:_0x1df763[_0xabbf('0x18')];var _0x57002d=_0x529af0?_0x13b970[_0xabbf('0x1b')]:_0x1df763[_0xabbf('0x18')]+_0x1df763['limit'];var _0x1269d9;if(_0x57002d>=_0xbfddcf){_0x57002d=_0xbfddcf;_0x1269d9=0xc8;}else{_0x1269d9=0xce;}_0x23a44a[_0xabbf('0x16')](_0x1269d9);return _0x23a44a[_0xabbf('0x1c')]('Content-Range',_0x4252e1+'-'+_0x57002d+'/'+_0xbfddcf)['json'](_0x13b970);}return null;};}function patchUpdates(_0xdf7640){return function(_0x4d4efb){try{jsonpatch[_0xabbf('0x1d')](_0x4d4efb,_0xdf7640,!![]);}catch(_0x918fc8){return BPromise['reject'](_0x918fc8);}return _0x4d4efb['save']();};}function saveUpdates(_0x44248b,_0x45cf44){return function(_0x2eaa02){if(_0x2eaa02){return _0x2eaa02[_0xabbf('0x1e')](_0x44248b)[_0xabbf('0x1f')](function(_0x35313f){return _0x35313f;});}return null;};}function removeEntity(_0x17d684,_0x573d83){return function(_0x281b36){if(_0x281b36){return _0x281b36[_0xabbf('0x20')]()[_0xabbf('0x1f')](function(){var _0x5b9380=_0x281b36[_0xabbf('0x21')]({'plain':!![]});var _0x26ebc6=_0xabbf('0x22');return db[_0xabbf('0x23')][_0xabbf('0x20')]({'where':{'type':_0x26ebc6,'resourceId':_0x5b9380['id']}})['then'](function(){return _0x281b36;});})[_0xabbf('0x1f')](function(){_0x17d684['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e61d,_0x649d52){return function(_0x51d38d){if(!_0x51d38d){_0x20e61d[_0xabbf('0x15')](0x194);}return _0x51d38d;};}function handleError(_0xa39ccd,_0x527838){_0x527838=_0x527838||0x1f4;return function(_0x4f8ed7){logger['error'](_0x4f8ed7['stack']);if(_0x4f8ed7[_0xabbf('0x24')]){delete _0x4f8ed7[_0xabbf('0x24')];}_0xa39ccd[_0xabbf('0x16')](_0x527838)[_0xabbf('0x25')](_0x4f8ed7);};}exports[_0xabbf('0x26')]=function(_0xeae198,_0x1ed1fd){var _0x3d8ffc={},_0x40c3bf={},_0x3d8b20={'count':0x0,'rows':[]};var _0x50fd8d=_[_0xabbf('0x27')](db['VoiceChanSpy'][_0xabbf('0x28')],function(_0x18b390){return{'name':_0x18b390['fieldName'],'type':_0x18b390[_0xabbf('0x29')][_0xabbf('0x2a')]};});_0x40c3bf[_0xabbf('0x2b')]=_[_0xabbf('0x27')](_0x50fd8d,_0xabbf('0x24'));_0x40c3bf[_0xabbf('0x2c')]=_[_0xabbf('0x2d')](_0xeae198['query']);_0x40c3bf['filters']=_[_0xabbf('0x2e')](_0x40c3bf['model'],_0x40c3bf[_0xabbf('0x2c')]);_0x3d8ffc[_0xabbf('0x2f')]=_[_0xabbf('0x2e')](_0x40c3bf[_0xabbf('0x2b')],qs[_0xabbf('0x30')](_0xeae198[_0xabbf('0x2c')][_0xabbf('0x30')]));_0x3d8ffc['attributes']=_0x3d8ffc[_0xabbf('0x2f')][_0xabbf('0x31')]?_0x3d8ffc[_0xabbf('0x2f')]:_0x40c3bf['model'];if(!_0xeae198[_0xabbf('0x2c')][_0xabbf('0x32')](_0xabbf('0x33'))){_0x3d8ffc[_0xabbf('0x1a')]=qs[_0xabbf('0x1a')](_0xeae198[_0xabbf('0x2c')][_0xabbf('0x1a')]);_0x3d8ffc[_0xabbf('0x18')]=qs[_0xabbf('0x18')](_0xeae198['query'][_0xabbf('0x18')]);}_0x3d8ffc[_0xabbf('0x34')]=qs[_0xabbf('0x35')](_0xeae198[_0xabbf('0x2c')][_0xabbf('0x35')]);_0x3d8ffc['where']=qs[_0xabbf('0x36')](_[_0xabbf('0x37')](_0xeae198[_0xabbf('0x2c')],_0x40c3bf[_0xabbf('0x36')]),_0x50fd8d);if(_0xeae198[_0xabbf('0x2c')]['filter']){_0x3d8ffc['where']=_[_0xabbf('0x38')](_0x3d8ffc['where'],{'$or':_[_0xabbf('0x27')](_0x50fd8d,function(_0x3fc1f6){if(_0x3fc1f6['type']!==_0xabbf('0x39')){var _0xb05c7e={};_0xb05c7e[_0x3fc1f6[_0xabbf('0x24')]]={'$like':'%'+_0xeae198['query'][_0xabbf('0x3a')]+'%'};return _0xb05c7e;}})});}_0x3d8ffc=_['merge']({},_0x3d8ffc,_0xeae198[_0xabbf('0x3b')]);var _0x11de8b={'where':_0x3d8ffc['where']};return db[_0xabbf('0x3c')][_0xabbf('0x1b')](_0x11de8b)[_0xabbf('0x1f')](function(_0x22cb8d){_0x3d8b20[_0xabbf('0x1b')]=_0x22cb8d;if(_0xeae198[_0xabbf('0x2c')][_0xabbf('0x3d')]){_0x3d8ffc[_0xabbf('0x3e')]=[{'all':!![]}];}return db[_0xabbf('0x3c')]['findAll'](_0x3d8ffc);})[_0xabbf('0x1f')](function(_0x547672){_0x3d8b20['rows']=_0x547672;return _0x3d8b20;})[_0xabbf('0x1f')](respondWithFilteredResult(_0x1ed1fd,_0x3d8ffc))[_0xabbf('0x3f')](handleError(_0x1ed1fd,null));};exports[_0xabbf('0x40')]=function(_0x109817,_0x291f7e){var _0x3450e8={'raw':![],'where':{'id':_0x109817[_0xabbf('0x41')]['id']}},_0xec2a82={};_0xec2a82[_0xabbf('0x2b')]=_[_0xabbf('0x2d')](db[_0xabbf('0x3c')][_0xabbf('0x28')]);_0xec2a82[_0xabbf('0x2c')]=_['keys'](_0x109817[_0xabbf('0x2c')]);_0xec2a82[_0xabbf('0x36')]=_['intersection'](_0xec2a82[_0xabbf('0x2b')],_0xec2a82[_0xabbf('0x2c')]);_0x3450e8[_0xabbf('0x2f')]=_[_0xabbf('0x2e')](_0xec2a82[_0xabbf('0x2b')],qs[_0xabbf('0x30')](_0x109817[_0xabbf('0x2c')][_0xabbf('0x30')]));_0x3450e8[_0xabbf('0x2f')]=_0x3450e8[_0xabbf('0x2f')][_0xabbf('0x31')]?_0x3450e8[_0xabbf('0x2f')]:_0xec2a82[_0xabbf('0x2b')];if(_0x109817[_0xabbf('0x2c')][_0xabbf('0x3d')]){_0x3450e8[_0xabbf('0x3e')]=[{'all':!![]}];}_0x3450e8=_[_0xabbf('0x38')]({},_0x3450e8,_0x109817[_0xabbf('0x3b')]);return db[_0xabbf('0x3c')][_0xabbf('0x42')](_0x3450e8)['then'](handleEntityNotFound(_0x291f7e,null))[_0xabbf('0x1f')](respondWithResult(_0x291f7e,null))[_0xabbf('0x3f')](handleError(_0x291f7e,null));};exports[_0xabbf('0x43')]=function(_0x370f66,_0x60d9d6){return db['VoiceChanSpy'][_0xabbf('0x43')](_0x370f66[_0xabbf('0x44')],{})['then'](function(_0x2b4cf5){var _0x1c156d=_0x370f66[_0xabbf('0x45')][_0xabbf('0x21')]({'plain':!![]});if(!_0x1c156d)throw new Error(_0xabbf('0x46'));if(_0x1c156d[_0xabbf('0x47')]===_0xabbf('0x45')){var _0x4fa51f=_0x2b4cf5[_0xabbf('0x21')]({'plain':!![]});var _0x41dc9d='ChanSpies';return db[_0xabbf('0x48')][_0xabbf('0x42')]({'where':{'name':_0x41dc9d,'userProfileId':_0x1c156d[_0xabbf('0x49')]},'raw':!![]})[_0xabbf('0x1f')](function(_0x29c051){if(_0x29c051&&_0x29c051[_0xabbf('0x4a')]===0x0){return db[_0xabbf('0x23')][_0xabbf('0x43')]({'name':_0x4fa51f[_0xabbf('0x24')],'resourceId':_0x4fa51f['id'],'type':_0x29c051[_0xabbf('0x24')],'sectionId':_0x29c051['id']},{})['then'](function(){return _0x2b4cf5;});}else{return _0x2b4cf5;}})[_0xabbf('0x3f')](function(_0x4fcc5b){logger[_0xabbf('0x4b')](_0xabbf('0x4c'),_0x4fcc5b);throw _0x4fcc5b;});}return _0x2b4cf5;})[_0xabbf('0x1f')](respondWithResult(_0x60d9d6,0xc9))[_0xabbf('0x3f')](handleError(_0x60d9d6,null));};exports[_0xabbf('0x1e')]=function(_0x216972,_0x18324f){if(_0x216972[_0xabbf('0x44')]['id']){delete _0x216972[_0xabbf('0x44')]['id'];}return db[_0xabbf('0x3c')][_0xabbf('0x42')]({'where':{'id':_0x216972[_0xabbf('0x41')]['id']}})['then'](handleEntityNotFound(_0x18324f,null))['then'](saveUpdates(_0x216972['body'],null))[_0xabbf('0x1f')](respondWithResult(_0x18324f,null))[_0xabbf('0x3f')](handleError(_0x18324f,null));};exports[_0xabbf('0x20')]=function(_0x5cf6ff,_0x278a01){return db[_0xabbf('0x3c')][_0xabbf('0x42')]({'where':{'id':_0x5cf6ff['params']['id']}})['then'](handleEntityNotFound(_0x278a01,null))[_0xabbf('0x1f')](removeEntity(_0x278a01,null))[_0xabbf('0x3f')](handleError(_0x278a01,null));}; \ No newline at end of file +var _0x9649=['set','json','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','params','intersection','find','create','user','role','UserProfileSection','autoAssociation','error','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit'];(function(_0x390537,_0x1f2999){var _0x35bc63=function(_0x1db0b6){while(--_0x1db0b6){_0x390537['push'](_0x390537['shift']());}};_0x35bc63(++_0x1f2999);}(_0x9649,0x118));var _0x9964=function(_0x24f516,_0x38a57e){_0x24f516=_0x24f516-0x0;var _0x4cec71=_0x9649[_0x24f516];return _0x4cec71;};'use strict';var emlformat=require(_0x9964('0x0'));var rimraf=require(_0x9964('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9964('0x2'));var rp=require(_0x9964('0x3'));var moment=require(_0x9964('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x5'));var util=require(_0x9964('0x6'));var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9964('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9964('0xa'));var jsforce=require(_0x9964('0xb'));var deskjs=require(_0x9964('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9964('0xd'));var Papa=require(_0x9964('0xe'));var Redis=require(_0x9964('0xf'));var authService=require(_0x9964('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9964('0x12'))(_0x9964('0x13'));var utils=require('../../config/utils');var config=require(_0x9964('0x14'));var licenseUtil=require(_0x9964('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd6ff,_0x4ef5c5){_0x4ef5c5=_0x4ef5c5||0xcc;return function(_0x1b8afa){if(_0x1b8afa){return _0x2bd6ff[_0x9964('0x16')](_0x4ef5c5);}return _0x2bd6ff[_0x9964('0x17')](_0x4ef5c5)[_0x9964('0x18')]();};}function respondWithResult(_0x22f5ce,_0x360a02){_0x360a02=_0x360a02||0xc8;return function(_0x44ce20){if(_0x44ce20){return _0x22f5ce['status'](_0x360a02)['json'](_0x44ce20);}};}function respondWithFilteredResult(_0x37f137,_0x2be683){return function(_0x561571){if(_0x561571){var _0x416340=typeof _0x2be683[_0x9964('0x19')]===_0x9964('0x1a')&&typeof _0x2be683[_0x9964('0x1b')]===_0x9964('0x1a');var _0x2c12f8=_0x561571['count'];var _0x2a7a61=_0x416340?0x0:_0x2be683[_0x9964('0x19')];var _0x58f157=_0x416340?_0x561571['count']:_0x2be683['offset']+_0x2be683[_0x9964('0x1b')];var _0xc4c0fe;if(_0x58f157>=_0x2c12f8){_0x58f157=_0x2c12f8;_0xc4c0fe=0xc8;}else{_0xc4c0fe=0xce;}_0x37f137[_0x9964('0x17')](_0xc4c0fe);return _0x37f137[_0x9964('0x1c')]('Content-Range',_0x2a7a61+'-'+_0x58f157+'/'+_0x2c12f8)[_0x9964('0x1d')](_0x561571);}return null;};}function patchUpdates(_0x5f2bbd){return function(_0x470a8d){try{jsonpatch[_0x9964('0x1e')](_0x470a8d,_0x5f2bbd,!![]);}catch(_0x209929){return BPromise[_0x9964('0x1f')](_0x209929);}return _0x470a8d[_0x9964('0x20')]();};}function saveUpdates(_0xea9fc2,_0x4053ad){return function(_0x341c56){if(_0x341c56){return _0x341c56['update'](_0xea9fc2)[_0x9964('0x21')](function(_0x3069d7){return _0x3069d7;});}return null;};}function removeEntity(_0x1629f9,_0x30ccf7){return function(_0x5b2689){if(_0x5b2689){return _0x5b2689[_0x9964('0x22')]()[_0x9964('0x21')](function(){var _0x3b3793=_0x5b2689[_0x9964('0x23')]({'plain':!![]});var _0x4be822=_0x9964('0x24');return db[_0x9964('0x25')][_0x9964('0x22')]({'where':{'type':_0x4be822,'resourceId':_0x3b3793['id']}})[_0x9964('0x21')](function(){return _0x5b2689;});})[_0x9964('0x21')](function(){_0x1629f9[_0x9964('0x17')](0xcc)[_0x9964('0x18')]();});}};}function handleEntityNotFound(_0x33be7b,_0x4f9a8b){return function(_0x524564){if(!_0x524564){_0x33be7b[_0x9964('0x16')](0x194);}return _0x524564;};}function handleError(_0x2c1fad,_0x108c0a){_0x108c0a=_0x108c0a||0x1f4;return function(_0x16ec83){logger['error'](_0x16ec83[_0x9964('0x26')]);if(_0x16ec83[_0x9964('0x27')]){delete _0x16ec83[_0x9964('0x27')];}_0x2c1fad[_0x9964('0x17')](_0x108c0a)[_0x9964('0x28')](_0x16ec83);};}exports['index']=function(_0x4c04ce,_0x2f013f){var _0x34ae09={},_0x52dbd4={},_0x48ac65={'count':0x0,'rows':[]};var _0x4ff4c9=_[_0x9964('0x29')](db[_0x9964('0x2a')][_0x9964('0x2b')],function(_0x4cc9a1){return{'name':_0x4cc9a1[_0x9964('0x2c')],'type':_0x4cc9a1[_0x9964('0x2d')][_0x9964('0x2e')]};});_0x52dbd4[_0x9964('0x2f')]=_[_0x9964('0x29')](_0x4ff4c9,_0x9964('0x27'));_0x52dbd4['query']=_[_0x9964('0x30')](_0x4c04ce[_0x9964('0x31')]);_0x52dbd4[_0x9964('0x32')]=_['intersection'](_0x52dbd4[_0x9964('0x2f')],_0x52dbd4[_0x9964('0x31')]);_0x34ae09[_0x9964('0x33')]=_['intersection'](_0x52dbd4[_0x9964('0x2f')],qs[_0x9964('0x34')](_0x4c04ce[_0x9964('0x31')][_0x9964('0x34')]));_0x34ae09[_0x9964('0x33')]=_0x34ae09[_0x9964('0x33')][_0x9964('0x35')]?_0x34ae09[_0x9964('0x33')]:_0x52dbd4[_0x9964('0x2f')];if(!_0x4c04ce[_0x9964('0x31')][_0x9964('0x36')](_0x9964('0x37'))){_0x34ae09[_0x9964('0x1b')]=qs[_0x9964('0x1b')](_0x4c04ce[_0x9964('0x31')][_0x9964('0x1b')]);_0x34ae09[_0x9964('0x19')]=qs[_0x9964('0x19')](_0x4c04ce['query'][_0x9964('0x19')]);}_0x34ae09['order']=qs[_0x9964('0x38')](_0x4c04ce[_0x9964('0x31')]['sort']);_0x34ae09[_0x9964('0x39')]=qs['filters'](_[_0x9964('0x3a')](_0x4c04ce[_0x9964('0x31')],_0x52dbd4[_0x9964('0x32')]),_0x4ff4c9);if(_0x4c04ce[_0x9964('0x31')][_0x9964('0x3b')]){_0x34ae09[_0x9964('0x39')]=_['merge'](_0x34ae09[_0x9964('0x39')],{'$or':_[_0x9964('0x29')](_0x4ff4c9,function(_0xcf49d2){if(_0xcf49d2[_0x9964('0x2d')]!=='VIRTUAL'){var _0x1b3cbe={};_0x1b3cbe[_0xcf49d2['name']]={'$like':'%'+_0x4c04ce[_0x9964('0x31')][_0x9964('0x3b')]+'%'};return _0x1b3cbe;}})});}_0x34ae09=_[_0x9964('0x3c')]({},_0x34ae09,_0x4c04ce[_0x9964('0x3d')]);var _0x3a82d3={'where':_0x34ae09[_0x9964('0x39')]};return db[_0x9964('0x2a')][_0x9964('0x3e')](_0x3a82d3)[_0x9964('0x21')](function(_0x47227d){_0x48ac65[_0x9964('0x3e')]=_0x47227d;if(_0x4c04ce['query'][_0x9964('0x3f')]){_0x34ae09[_0x9964('0x40')]=[{'all':!![]}];}return db[_0x9964('0x2a')][_0x9964('0x41')](_0x34ae09);})['then'](function(_0x138a3a){_0x48ac65['rows']=_0x138a3a;return _0x48ac65;})['then'](respondWithFilteredResult(_0x2f013f,_0x34ae09))[_0x9964('0x42')](handleError(_0x2f013f,null));};exports['show']=function(_0x77191f,_0x5949b4){var _0x12cd80={'raw':![],'where':{'id':_0x77191f[_0x9964('0x43')]['id']}},_0x246fab={};_0x246fab['model']=_['keys'](db['VoiceChanSpy'][_0x9964('0x2b')]);_0x246fab[_0x9964('0x31')]=_['keys'](_0x77191f[_0x9964('0x31')]);_0x246fab[_0x9964('0x32')]=_[_0x9964('0x44')](_0x246fab['model'],_0x246fab[_0x9964('0x31')]);_0x12cd80[_0x9964('0x33')]=_[_0x9964('0x44')](_0x246fab[_0x9964('0x2f')],qs['fields'](_0x77191f[_0x9964('0x31')][_0x9964('0x34')]));_0x12cd80[_0x9964('0x33')]=_0x12cd80[_0x9964('0x33')][_0x9964('0x35')]?_0x12cd80['attributes']:_0x246fab[_0x9964('0x2f')];if(_0x77191f[_0x9964('0x31')]['includeAll']){_0x12cd80[_0x9964('0x40')]=[{'all':!![]}];}_0x12cd80=_[_0x9964('0x3c')]({},_0x12cd80,_0x77191f[_0x9964('0x3d')]);return db['VoiceChanSpy'][_0x9964('0x45')](_0x12cd80)[_0x9964('0x21')](handleEntityNotFound(_0x5949b4,null))[_0x9964('0x21')](respondWithResult(_0x5949b4,null))[_0x9964('0x42')](handleError(_0x5949b4,null));};exports['create']=function(_0x14d611,_0x139a9e){return db[_0x9964('0x2a')][_0x9964('0x46')](_0x14d611['body'],{})[_0x9964('0x21')](function(_0x17aa8f){var _0x276bd=_0x14d611[_0x9964('0x47')][_0x9964('0x23')]({'plain':!![]});if(!_0x276bd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x276bd[_0x9964('0x48')]===_0x9964('0x47')){var _0x2eadb4=_0x17aa8f[_0x9964('0x23')]({'plain':!![]});var _0x9e5962=_0x9964('0x24');return db[_0x9964('0x49')][_0x9964('0x45')]({'where':{'name':_0x9e5962,'userProfileId':_0x276bd['userProfileId']},'raw':!![]})[_0x9964('0x21')](function(_0x307d44){if(_0x307d44&&_0x307d44[_0x9964('0x4a')]===0x0){return db[_0x9964('0x25')][_0x9964('0x46')]({'name':_0x2eadb4[_0x9964('0x27')],'resourceId':_0x2eadb4['id'],'type':_0x307d44[_0x9964('0x27')],'sectionId':_0x307d44['id']},{})[_0x9964('0x21')](function(){return _0x17aa8f;});}else{return _0x17aa8f;}})['catch'](function(_0x25faa5){logger[_0x9964('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25faa5);throw _0x25faa5;});}return _0x17aa8f;})[_0x9964('0x21')](respondWithResult(_0x139a9e,0xc9))[_0x9964('0x42')](handleError(_0x139a9e,null));};exports['update']=function(_0x2b2535,_0x49fcd4){if(_0x2b2535['body']['id']){delete _0x2b2535[_0x9964('0x4c')]['id'];}return db[_0x9964('0x2a')][_0x9964('0x45')]({'where':{'id':_0x2b2535[_0x9964('0x43')]['id']}})[_0x9964('0x21')](handleEntityNotFound(_0x49fcd4,null))[_0x9964('0x21')](saveUpdates(_0x2b2535[_0x9964('0x4c')],null))[_0x9964('0x21')](respondWithResult(_0x49fcd4,null))[_0x9964('0x42')](handleError(_0x49fcd4,null));};exports['destroy']=function(_0x2ca871,_0xe67a50){return db[_0x9964('0x2a')][_0x9964('0x45')]({'where':{'id':_0x2ca871[_0x9964('0x43')]['id']}})[_0x9964('0x21')](handleEntityNotFound(_0xe67a50,null))['then'](removeEntity(_0xe67a50,null))[_0x9964('0x42')](handleError(_0xe67a50,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6417379..08fa989 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 _0x3e9b=['CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','agent','then','catch','exports','models','define','VoiceChanSpy','bulkCreate','destroy','VoiceExtension','lodash','context','from-sip','format','%s%s','system','push','merge','Set'];(function(_0x276592,_0x154e81){var _0x9137cc=function(_0x552792){while(--_0x552792){_0x276592['push'](_0x276592['shift']());}};_0x9137cc(++_0x154e81);}(_0x3e9b,0x83));var _0xb3e9=function(_0x162372,_0x6cc109){_0x162372=_0x162372-0x0;var _0x3f4437=_0x3e9b[_0x162372];return _0x3f4437;};'use strict';var _=require(_0xb3e9('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x41054e,_0x5a08f4,_0x5bd771){var _0x54479a=0x1;var _0xf76205=[];var _0x204695={'context':_0x5a08f4[_0xb3e9('0x1')]||_0xb3e9('0x2'),'exten':util[_0xb3e9('0x3')](_0xb3e9('0x4'),_0x41054e['prefix'],_0x5bd771),'type':_0xb3e9('0x5'),'isApp':![],'ChanSpyId':_0x41054e['id'],'UserId':_0x5a08f4['id']};_0xf76205[_0xb3e9('0x6')](_[_0xb3e9('0x7')]({'app':_0xb3e9('0x8'),'appdata':util[_0xb3e9('0x3')](_0xb3e9('0x9'),_0xb3e9('0xa')),'priority':_0x54479a++},_0x204695));if(_0x41054e[_0xb3e9('0xb')]){_0xf76205[_0xb3e9('0x6')](_[_0xb3e9('0x7')]({'app':_0xb3e9('0xc'),'appdata':util['format'](_0xb3e9('0xd'),_0x41054e[_0xb3e9('0xe')]),'priority':_0x54479a++},_0x204695));}if(_0x41054e['auth']){_0xf76205[_0xb3e9('0x6')](_[_0xb3e9('0x7')]({'app':_0xb3e9('0xf'),'appdata':_0x41054e[_0xb3e9('0x10')],'priority':_0x54479a++},_0x204695));}_0xf76205[_0xb3e9('0x6')](_[_0xb3e9('0x7')]({'app':_0xb3e9('0x11'),'appdata':util[_0xb3e9('0x3')](_0xb3e9('0x12'),_0x5a08f4[_0xb3e9('0x13')],_0x41054e[_0xb3e9('0x14')]?_0x41054e[_0xb3e9('0x14')][_0xb3e9('0x15')](''):''),'priority':_0x54479a++},_0x204695));if(_0x41054e[_0xb3e9('0xb')]){_0xf76205[_0xb3e9('0x6')](_[_0xb3e9('0x7')]({'app':'StopMixMonitor','priority':_0x54479a++},_0x204695));}return _0xf76205;};var getChanSpyApplications=function(_0x5ba0b0,_0x2f2ebc){var _0x29460e=[];for(var _0x335df1=0x0,_0x2ae391=0x1;_0x335df1<_0x2f2ebc[_0xb3e9('0x16')];_0x335df1++,_0x2ae391=0x1){_0x29460e=_0x29460e[_0xb3e9('0x17')](getUserApplications(_0x5ba0b0,_0x2f2ebc[_0x335df1],_0x2f2ebc[_0x335df1][_0xb3e9('0x18')]));if(_0x2f2ebc[_0x335df1][_0xb3e9('0x18')]!=_0x2f2ebc[_0x335df1][_0xb3e9('0x13')]){_0x29460e=_0x29460e['concat'](getUserApplications(_0x5ba0b0,_0x2f2ebc[_0x335df1],_0x2f2ebc[_0x335df1][_0xb3e9('0x13')]));}}return _0x29460e;};var getChanSpyPromise=function(_0x386c52,_0x42ea4e){return new BPromise(function(_0x380304,_0x521c9c){return _0x386c52['User']['findAll']({'attributes':['id',_0xb3e9('0x13'),_0xb3e9('0x18')],'where':{'role':_0xb3e9('0x19'),'chanspy':!![]},'raw':!![]})[_0xb3e9('0x1a')](function(_0x452f58){if(_0x452f58){return _0x380304(getChanSpyApplications(_0x42ea4e,_0x452f58));}return _0x380304([]);})[_0xb3e9('0x1b')](function(_0x27b854){_0x521c9c(_0x27b854);});});};module[_0xb3e9('0x1c')]=function(_0x44b6c0,_0x1a6c86){var _0xe71c9=_0x44b6c0[_0xb3e9('0x1d')];return _0x44b6c0[_0xb3e9('0x1e')](_0xb3e9('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x107796,_0x565d3f,_0x236556){return getChanSpyPromise(_0xe71c9,_0x107796)[_0xb3e9('0x1a')](function(_0x265ce5){if(_0x265ce5&&_0x265ce5[_0xb3e9('0x16')]){return _0xe71c9['VoiceExtension'][_0xb3e9('0x20')](_0x265ce5);}})[_0xb3e9('0x1a')](function(){_0x236556();})[_0xb3e9('0x1b')](function(_0x550fbd){_0x236556(_0x550fbd);});},'afterUpdate':function(_0x170bfa,_0x36ca67,_0x17490c){return _0xe71c9['VoiceExtension'][_0xb3e9('0x21')]({'where':{'ChanSpyId':_0x170bfa['id']}})[_0xb3e9('0x1a')](function(){return getChanSpyPromise(_0xe71c9,_0x170bfa);})['then'](function(_0x30a930){if(_0x30a930&&_0x30a930[_0xb3e9('0x16')]){return _0xe71c9[_0xb3e9('0x22')][_0xb3e9('0x20')](_0x30a930);}})['then'](function(){_0x17490c();})[_0xb3e9('0x1b')](function(_0x1917cc){_0x17490c(_0x1917cc);});},'afterDestroy':function(_0x51f140,_0x194ea9,_0x1009da){return _0xe71c9[_0xb3e9('0x22')][_0xb3e9('0x21')]({'where':{'ChanSpyId':_0x51f140['id']}})[_0xb3e9('0x1a')](function(){_0x1009da();})[_0xb3e9('0x1b')](function(_0x376260){_0x1009da(_0x376260);});}}});}; \ No newline at end of file +var _0xb752=['chanspy','record','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','concat','internal','name','User','findAll','agent','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s'];(function(_0x581195,_0x36c1f5){var _0x5e374d=function(_0x656bba){while(--_0x656bba){_0x581195['push'](_0x581195['shift']());}};_0x5e374d(++_0x36c1f5);}(_0xb752,0x1d2));var _0x2b75=function(_0x800d34,_0x341978){_0x800d34=_0x800d34-0x0;var _0x3450ec=_0xb752[_0x800d34];return _0x3450ec;};'use strict';var _=require(_0x2b75('0x0'));var util=require(_0x2b75('0x1'));var BPromise=require(_0x2b75('0x2'));var attributes=require(_0x2b75('0x3'));var getUserApplications=function(_0x16c07d,_0x597d0b,_0x5bde85){var _0x1832e8=0x1;var _0x3f96fe=[];var _0x48464f={'context':_0x597d0b[_0x2b75('0x4')]||_0x2b75('0x5'),'exten':util['format'](_0x2b75('0x6'),_0x16c07d[_0x2b75('0x7')],_0x5bde85),'type':_0x2b75('0x8'),'isApp':![],'ChanSpyId':_0x16c07d['id'],'UserId':_0x597d0b['id']};_0x3f96fe[_0x2b75('0x9')](_[_0x2b75('0xa')]({'app':_0x2b75('0xb'),'appdata':util[_0x2b75('0xc')](_0x2b75('0xd'),_0x2b75('0xe')),'priority':_0x1832e8++},_0x48464f));if(_0x16c07d[_0x2b75('0xf')]){_0x3f96fe[_0x2b75('0x9')](_[_0x2b75('0xa')]({'app':'MixMonitor','appdata':util[_0x2b75('0xc')]('${UNIQUEID}.%s,a',_0x16c07d[_0x2b75('0x10')]),'priority':_0x1832e8++},_0x48464f));}if(_0x16c07d['auth']){_0x3f96fe[_0x2b75('0x9')](_[_0x2b75('0xa')]({'app':_0x2b75('0x11'),'appdata':_0x16c07d[_0x2b75('0x12')],'priority':_0x1832e8++},_0x48464f));}_0x3f96fe[_0x2b75('0x9')](_[_0x2b75('0xa')]({'app':_0x2b75('0x13'),'appdata':util[_0x2b75('0xc')](_0x2b75('0x14'),_0x597d0b['name'],_0x16c07d[_0x2b75('0x15')]?_0x16c07d[_0x2b75('0x15')]['join'](''):''),'priority':_0x1832e8++},_0x48464f));if(_0x16c07d[_0x2b75('0xf')]){_0x3f96fe[_0x2b75('0x9')](_['merge']({'app':_0x2b75('0x16'),'priority':_0x1832e8++},_0x48464f));}return _0x3f96fe;};var getChanSpyApplications=function(_0x5d1c63,_0x2ccf84){var _0x5ce995=[];for(var _0x54fcec=0x0,_0x506135=0x1;_0x54fcec<_0x2ccf84[_0x2b75('0x17')];_0x54fcec++,_0x506135=0x1){_0x5ce995=_0x5ce995[_0x2b75('0x18')](getUserApplications(_0x5d1c63,_0x2ccf84[_0x54fcec],_0x2ccf84[_0x54fcec][_0x2b75('0x19')]));if(_0x2ccf84[_0x54fcec]['internal']!=_0x2ccf84[_0x54fcec][_0x2b75('0x1a')]){_0x5ce995=_0x5ce995[_0x2b75('0x18')](getUserApplications(_0x5d1c63,_0x2ccf84[_0x54fcec],_0x2ccf84[_0x54fcec][_0x2b75('0x1a')]));}}return _0x5ce995;};var getChanSpyPromise=function(_0x3e61a7,_0x360cf3){return new BPromise(function(_0x2bf0c1,_0x1e941f){return _0x3e61a7[_0x2b75('0x1b')][_0x2b75('0x1c')]({'attributes':['id','name',_0x2b75('0x19')],'where':{'role':_0x2b75('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4994f2){if(_0x4994f2){return _0x2bf0c1(getChanSpyApplications(_0x360cf3,_0x4994f2));}return _0x2bf0c1([]);})['catch'](function(_0x1251ed){_0x1e941f(_0x1251ed);});});};module[_0x2b75('0x1e')]=function(_0xab95d2,_0x596c61){var _0x552b7a=_0xab95d2[_0x2b75('0x1f')];return _0xab95d2[_0x2b75('0x20')](_0x2b75('0x21'),attributes,{'tableName':_0x2b75('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x283f53,_0x5014a4,_0x1a16e8){return getChanSpyPromise(_0x552b7a,_0x283f53)[_0x2b75('0x23')](function(_0x22b50e){if(_0x22b50e&&_0x22b50e[_0x2b75('0x17')]){return _0x552b7a[_0x2b75('0x24')][_0x2b75('0x25')](_0x22b50e);}})['then'](function(){_0x1a16e8();})[_0x2b75('0x26')](function(_0x5c2c03){_0x1a16e8(_0x5c2c03);});},'afterUpdate':function(_0x4a1907,_0x58bea2,_0x375da9){return _0x552b7a[_0x2b75('0x24')][_0x2b75('0x27')]({'where':{'ChanSpyId':_0x4a1907['id']}})[_0x2b75('0x23')](function(){return getChanSpyPromise(_0x552b7a,_0x4a1907);})[_0x2b75('0x23')](function(_0x2b73bc){if(_0x2b73bc&&_0x2b73bc['length']){return _0x552b7a[_0x2b75('0x24')][_0x2b75('0x25')](_0x2b73bc);}})[_0x2b75('0x23')](function(){_0x375da9();})['catch'](function(_0x4b8278){_0x375da9(_0x4b8278);});},'afterDestroy':function(_0x5a9861,_0x5dc800,_0x598592){return _0x552b7a[_0x2b75('0x24')]['destroy']({'where':{'ChanSpyId':_0x5a9861['id']}})['then'](function(){_0x598592();})['catch'](function(_0x5292f3){_0x598592(_0x5292f3);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 23ef94a..ea2faca 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 _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4a0a69,_0x56acd5){var _0x14abbf=function(_0x3e0854){while(--_0x3e0854){_0x4a0a69['push'](_0x4a0a69['shift']());}};_0x14abbf(++_0x56acd5);}(_0x9348,0x10d));var _0x8934=function(_0x528b99,_0x436337){_0x528b99=_0x528b99-0x0;var _0x1c775e=_0x9348[_0x528b99];return _0x1c775e;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file +var _0x049e=['then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x049e,0x16a));var _0xe049=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x049e[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221a5f,_0x1d4fc6,_0x17945b){return new BPromise(function(_0x22abb2,_0x515823){return client[_0xe049('0xb')](_0x221a5f,_0x17945b)[_0xe049('0xc')](function(_0x6d04ed){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0xe049('0xd'));logger[_0xe049('0xe')](_0xe049('0xf'),_0x1d4fc6,'request\x20sent',JSON['stringify'](_0x6d04ed));if(_0x6d04ed['error']){if(_0x6d04ed[_0xe049('0x10')][_0xe049('0x11')]===0x1f4){logger[_0xe049('0x10')](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x515823(_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);}logger['error'](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x22abb2(_0x6d04ed[_0xe049('0x10')]['message']);}else{logger[_0xe049('0x14')](_0xe049('0x12'),_0x1d4fc6,'request\x20sent');_0x22abb2(_0x6d04ed[_0xe049('0x15')][_0xe049('0x13')]);}})['catch'](function(_0x8b9bfe){logger[_0xe049('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0x8b9bfe);_0x515823(_0x8b9bfe);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ff86528..2d76597 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 _0x07ad=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x577f15,_0x33bcb0){var _0x49d66d=function(_0x24f9ab){while(--_0x24f9ab){_0x577f15['push'](_0x577f15['shift']());}};_0x49d66d(++_0x33bcb0);}(_0x07ad,0xd7));var _0xd07a=function(_0x3a8344,_0x289014){_0x3a8344=_0x3a8344-0x0;var _0x1dbdea=_0x07ad[_0x3a8344];return _0x1dbdea;};'use strict';var multer=require(_0xd07a('0x0'));var util=require(_0xd07a('0x1'));var path=require(_0xd07a('0x2'));var timeout=require(_0xd07a('0x3'));var express=require(_0xd07a('0x4'));var router=express[_0xd07a('0x5')]();var fs_extra=require(_0xd07a('0x6'));var auth=require(_0xd07a('0x7'));var interaction=require(_0xd07a('0x8'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xd07a('0x9')]('/',auth[_0xd07a('0xa')](),controller[_0xd07a('0xb')]);router['get'](_0xd07a('0xc'),auth[_0xd07a('0xa')](),controller[_0xd07a('0xd')]);router['post']('/',auth[_0xd07a('0xa')](),controller[_0xd07a('0xe')]);router[_0xd07a('0xf')](_0xd07a('0xc'),auth[_0xd07a('0xa')](),controller[_0xd07a('0x10')]);router[_0xd07a('0x11')](_0xd07a('0xc'),auth[_0xd07a('0xa')](),controller[_0xd07a('0x12')]);module[_0xd07a('0x13')]=router; \ No newline at end of file +var _0x0db2=['isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0db2,0xf0));var _0x20db=function(_0x136d0d,_0xb32efc){_0x136d0d=_0x136d0d-0x0;var _0x5bbaff=_0x0db2[_0x136d0d];return _0x5bbaff;};'use strict';var multer=require(_0x20db('0x0'));var util=require(_0x20db('0x1'));var path=require(_0x20db('0x2'));var timeout=require(_0x20db('0x3'));var express=require(_0x20db('0x4'));var router=express[_0x20db('0x5')]();var fs_extra=require(_0x20db('0x6'));var auth=require(_0x20db('0x7'));var interaction=require(_0x20db('0x8'));var config=require(_0x20db('0x9'));var controller=require(_0x20db('0xa'));router[_0x20db('0xb')]('/',auth[_0x20db('0xc')](),controller[_0x20db('0xd')]);router['get'](_0x20db('0xe'),auth['isAuthenticated'](),controller[_0x20db('0xf')]);router[_0x20db('0x10')]('/',auth[_0x20db('0xc')](),controller['create']);router['put'](_0x20db('0xe'),auth['isAuthenticated'](),controller[_0x20db('0x11')]);router[_0x20db('0x12')]('/:id',auth[_0x20db('0xc')](),controller[_0x20db('0x13')]);module[_0x20db('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 ce99c94..fa16dd3 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 _0x5801=['STRING','name','BOOLEAN','sequelize'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5801,0xc3));var _0x1580=function(_0x3a71b3,_0x5f3e8b){_0x3a71b3=_0x3a71b3-0x0;var _0x10a4f9=_0x5801[_0x3a71b3];return _0x10a4f9;};'use strict';var Sequelize=require(_0x1580('0x0'));module['exports']={'name':{'type':Sequelize[_0x1580('0x1')],'unique':_0x1580('0x2')},'description':{'type':Sequelize[_0x1580('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1580('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1312=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x32b162,_0x4c8186){var _0x432273=function(_0x37dd56){while(--_0x37dd56){_0x32b162['push'](_0x32b162['shift']());}};_0x432273(++_0x4c8186);}(_0x1312,0x12e));var _0x2131=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0x1312[_0x134bfc];return _0x2f4dcc;};'use strict';var Sequelize=require(_0x2131('0x0'));module[_0x2131('0x1')]={'name':{'type':Sequelize[_0x2131('0x2')],'unique':_0x2131('0x3')},'description':{'type':Sequelize[_0x2131('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2131('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 ba763cf..959dfa0 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 _0x673b=['update','Contexts','destroy','name','send','index','VoiceContext','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','create','body','root','server/files/templates/context.ejs','render','writeFileSync','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','readFileSync','join','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x33bd52,_0x9304d2){var _0x3e31e2=function(_0x144494){while(--_0x144494){_0x33bd52['push'](_0x33bd52['shift']());}};_0x3e31e2(++_0x9304d2);}(_0x673b,0x1db));var _0xb673=function(_0x7d653b,_0x3f3341){_0x7d653b=_0x7d653b-0x0;var _0x3a30e7=_0x673b[_0x7d653b];return _0x3a30e7;};'use strict';var emlformat=require(_0xb673('0x0'));var rimraf=require(_0xb673('0x1'));var zipdir=require(_0xb673('0x2'));var jsonpatch=require(_0xb673('0x3'));var rp=require('request-promise');var moment=require(_0xb673('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb673('0x5'));var util=require('util');var path=require(_0xb673('0x6'));var sox=require(_0xb673('0x7'));var csv=require(_0xb673('0x8'));var ejs=require(_0xb673('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb673('0xa'));var squel=require(_0xb673('0xb'));var crypto=require(_0xb673('0xc'));var jsforce=require(_0xb673('0xd'));var deskjs=require(_0xb673('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb673('0xf'));var Redis=require(_0xb673('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb673('0x11'));var as=require(_0xb673('0x12'));var hardwareService=require(_0xb673('0x13'));var logger=require('../../config/logger')(_0xb673('0x14'));var utils=require(_0xb673('0x15'));var config=require(_0xb673('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb673('0x17'))['db'];var jayson=require(_0xb673('0x18'));var client=jayson[_0xb673('0x19')][_0xb673('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x56930c,_0x169722,_0x146547,_0x449b77){return new BPromise(function(_0x246643,_0x47c29e){var _0x43b759=_0x449b77||client;return _0x43b759[_0xb673('0x1b')](_0x56930c,_0x146547)[_0xb673('0x1c')](function(_0x4214f2){logger[_0xb673('0x1d')](_0xb673('0x1e'),_0x169722,_0xb673('0x1f'));logger[_0xb673('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x169722,_0xb673('0x1f'),JSON[_0xb673('0x21')](_0x4214f2));if(_0x4214f2[_0xb673('0x22')]){if(_0x4214f2['error'][_0xb673('0x23')]===0x1f4){logger[_0xb673('0x22')](_0xb673('0x1e'),_0x169722,_0x4214f2['error']['message']);return _0x47c29e(_0x4214f2[_0xb673('0x22')]['message']);}logger[_0xb673('0x22')]('VoiceContext,\x20%s,\x20%s',_0x169722,_0x4214f2[_0xb673('0x22')][_0xb673('0x24')]);return _0x246643(_0x4214f2['error'][_0xb673('0x24')]);}else{logger[_0xb673('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x169722,_0xb673('0x1f'));_0x246643(_0x4214f2['result']['message']);}})[_0xb673('0x25')](function(_0x215be6){logger[_0xb673('0x22')]('VoiceContext,\x20%s,\x20%s',_0x169722,_0x215be6);_0x47c29e(_0x215be6);});});}function respondWithStatusCode(_0x260ca9,_0x57dc79){_0x57dc79=_0x57dc79||0xcc;return function(_0x52f035){if(_0x52f035){return _0x260ca9[_0xb673('0x26')](_0x57dc79);}return _0x260ca9[_0xb673('0x27')](_0x57dc79)[_0xb673('0x28')]();};}function respondWithResult(_0x503a57,_0x39030b){_0x39030b=_0x39030b||0xc8;return function(_0x3597e7){if(_0x3597e7){return _0x503a57[_0xb673('0x27')](_0x39030b)[_0xb673('0x29')](_0x3597e7);}};}function respondWithFilteredResult(_0x56e739,_0xaf20b1){return function(_0x2199fb){if(_0x2199fb){var _0x21d24a=typeof _0xaf20b1['offset']===_0xb673('0x2a')&&typeof _0xaf20b1['limit']==='undefined';var _0x27050a=_0x2199fb[_0xb673('0x2b')];var _0xbc01e7=_0x21d24a?0x0:_0xaf20b1[_0xb673('0x2c')];var _0x4f9126=_0x21d24a?_0x2199fb[_0xb673('0x2b')]:_0xaf20b1[_0xb673('0x2c')]+_0xaf20b1[_0xb673('0x2d')];var _0x2bebfc;if(_0x4f9126>=_0x27050a){_0x4f9126=_0x27050a;_0x2bebfc=0xc8;}else{_0x2bebfc=0xce;}_0x56e739[_0xb673('0x27')](_0x2bebfc);return _0x56e739[_0xb673('0x2e')](_0xb673('0x2f'),_0xbc01e7+'-'+_0x4f9126+'/'+_0x27050a)[_0xb673('0x29')](_0x2199fb);}return null;};}function patchUpdates(_0x38ae25){return function(_0x3b7fe2){try{jsonpatch[_0xb673('0x30')](_0x3b7fe2,_0x38ae25,!![]);}catch(_0x4bddce){return BPromise[_0xb673('0x31')](_0x4bddce);}return _0x3b7fe2['save']();};}function saveUpdates(_0x11e800,_0x73c18d){return function(_0x29e728){if(_0x29e728){return _0x29e728[_0xb673('0x32')](_0x11e800)[_0xb673('0x1c')](function(_0x2fb65b){return _0x2fb65b;});}return null;};}function removeEntity(_0x3fa742,_0x3f5fc5){return function(_0x559ca2){if(_0x559ca2){return _0x559ca2['destroy']()[_0xb673('0x1c')](function(){var _0x5ec190=_0x559ca2['get']({'plain':!![]});var _0x534df9=_0xb673('0x33');return db['UserProfileResource'][_0xb673('0x34')]({'where':{'type':_0x534df9,'resourceId':_0x5ec190['id']}})[_0xb673('0x1c')](function(){return _0x559ca2;});})[_0xb673('0x1c')](function(){_0x3fa742[_0xb673('0x27')](0xcc)[_0xb673('0x28')]();});}};}function handleEntityNotFound(_0x46eb9d,_0x2c9439){return function(_0x3dad64){if(!_0x3dad64){_0x46eb9d[_0xb673('0x26')](0x194);}return _0x3dad64;};}function handleError(_0x5f137f,_0x3e8aec){_0x3e8aec=_0x3e8aec||0x1f4;return function(_0x1de0a4){logger['error'](_0x1de0a4['stack']);if(_0x1de0a4[_0xb673('0x35')]){delete _0x1de0a4[_0xb673('0x35')];}_0x5f137f[_0xb673('0x27')](_0x3e8aec)[_0xb673('0x36')](_0x1de0a4);};}exports[_0xb673('0x37')]=function(_0x5df446,_0x4bc370){var _0x74749={},_0x505ea8={},_0x5d68a4={'count':0x0,'rows':[]};var _0x1b4af0=_['map'](db[_0xb673('0x38')][_0xb673('0x39')],function(_0x3ffbad){return{'name':_0x3ffbad['fieldName'],'type':_0x3ffbad[_0xb673('0x3a')][_0xb673('0x3b')]};});_0x505ea8[_0xb673('0x3c')]=_[_0xb673('0x3d')](_0x1b4af0,'name');_0x505ea8[_0xb673('0x3e')]=_[_0xb673('0x3f')](_0x5df446[_0xb673('0x3e')]);_0x505ea8[_0xb673('0x40')]=_['intersection'](_0x505ea8[_0xb673('0x3c')],_0x505ea8[_0xb673('0x3e')]);_0x74749[_0xb673('0x41')]=_[_0xb673('0x42')](_0x505ea8[_0xb673('0x3c')],qs[_0xb673('0x43')](_0x5df446[_0xb673('0x3e')][_0xb673('0x43')]));_0x74749[_0xb673('0x41')]=_0x74749[_0xb673('0x41')][_0xb673('0x44')]?_0x74749[_0xb673('0x41')]:_0x505ea8[_0xb673('0x3c')];if(!_0x5df446[_0xb673('0x3e')]['hasOwnProperty'](_0xb673('0x45'))){_0x74749[_0xb673('0x2d')]=qs[_0xb673('0x2d')](_0x5df446['query'][_0xb673('0x2d')]);_0x74749[_0xb673('0x2c')]=qs[_0xb673('0x2c')](_0x5df446[_0xb673('0x3e')]['offset']);}_0x74749[_0xb673('0x46')]=qs[_0xb673('0x47')](_0x5df446[_0xb673('0x3e')]['sort']);_0x74749[_0xb673('0x48')]=qs[_0xb673('0x40')](_[_0xb673('0x49')](_0x5df446[_0xb673('0x3e')],_0x505ea8[_0xb673('0x40')]),_0x1b4af0);if(_0x5df446[_0xb673('0x3e')][_0xb673('0x4a')]){_0x74749['where']=_['merge'](_0x74749['where'],{'$or':_['map'](_0x1b4af0,function(_0x2dc541){if(_0x2dc541['type']!==_0xb673('0x4b')){var _0x3c918d={};_0x3c918d[_0x2dc541[_0xb673('0x35')]]={'$like':'%'+_0x5df446[_0xb673('0x3e')][_0xb673('0x4a')]+'%'};return _0x3c918d;}})});}_0x74749=_[_0xb673('0x4c')]({},_0x74749,_0x5df446[_0xb673('0x4d')]);var _0x33180b={'where':_0x74749[_0xb673('0x48')]};return db[_0xb673('0x38')]['count'](_0x33180b)[_0xb673('0x1c')](function(_0x5b07bb){_0x5d68a4[_0xb673('0x2b')]=_0x5b07bb;if(_0x5df446[_0xb673('0x3e')]['includeAll']){_0x74749[_0xb673('0x4e')]=[{'all':!![]}];}return db[_0xb673('0x38')][_0xb673('0x4f')](_0x74749);})[_0xb673('0x1c')](function(_0x664500){_0x5d68a4[_0xb673('0x50')]=_0x664500;return _0x5d68a4;})[_0xb673('0x1c')](respondWithFilteredResult(_0x4bc370,_0x74749))[_0xb673('0x25')](handleError(_0x4bc370,null));};exports[_0xb673('0x51')]=function(_0x5cf289,_0x141bdb){var _0x20c0ff={'raw':![],'where':{'id':_0x5cf289[_0xb673('0x52')]['id']}},_0x5d08b2={};_0x5d08b2[_0xb673('0x3c')]=_[_0xb673('0x3f')](db[_0xb673('0x38')]['rawAttributes']);_0x5d08b2[_0xb673('0x3e')]=_[_0xb673('0x3f')](_0x5cf289[_0xb673('0x3e')]);_0x5d08b2['filters']=_[_0xb673('0x42')](_0x5d08b2[_0xb673('0x3c')],_0x5d08b2[_0xb673('0x3e')]);_0x20c0ff['attributes']=_[_0xb673('0x42')](_0x5d08b2['model'],qs[_0xb673('0x43')](_0x5cf289[_0xb673('0x3e')][_0xb673('0x43')]));_0x20c0ff[_0xb673('0x41')]=_0x20c0ff[_0xb673('0x41')][_0xb673('0x44')]?_0x20c0ff['attributes']:_0x5d08b2[_0xb673('0x3c')];if(_0x5cf289[_0xb673('0x3e')][_0xb673('0x53')]){_0x20c0ff[_0xb673('0x4e')]=[{'all':!![]}];}_0x20c0ff=_[_0xb673('0x4c')]({},_0x20c0ff,_0x5cf289[_0xb673('0x4d')]);return db[_0xb673('0x38')]['find'](_0x20c0ff)[_0xb673('0x1c')](handleEntityNotFound(_0x141bdb,null))[_0xb673('0x1c')](respondWithResult(_0x141bdb,null))[_0xb673('0x25')](handleError(_0x141bdb,null));};exports[_0xb673('0x54')]=function(_0x531ded,_0x2fe99f,_0x39be92){var _0x1a9699;return db[_0xb673('0x38')]['create'](_0x531ded[_0xb673('0x55')],{'raw':!![]})[_0xb673('0x1c')](function(_0x423f0b){_0x1a9699=_0x423f0b;return db[_0xb673('0x38')][_0xb673('0x4f')]({'raw':!![]});})[_0xb673('0x1c')](function(_0x34df87){var _0xdf461b=fs['readFileSync'](path['join'](config[_0xb673('0x56')],_0xb673('0x57')),'utf8');var _0x285b4d=ejs[_0xb673('0x58')](_0xdf461b,{'contexts':_0x34df87||[]});fs[_0xb673('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x285b4d);})[_0xb673('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xb673('0x5a')});})['then'](function(){var _0x588e1d=_0x531ded[_0xb673('0x5b')][_0xb673('0x5c')]({'plain':!![]});if(!_0x588e1d)throw new Error(_0xb673('0x5d'));if(_0x588e1d[_0xb673('0x5e')]===_0xb673('0x5b')){var _0x1f5fc9=_0x1a9699[_0xb673('0x5c')]({'plain':!![]});return db[_0xb673('0x5f')][_0xb673('0x60')]({'where':{'name':'Contexts','userProfileId':_0x588e1d[_0xb673('0x61')]},'raw':!![]})[_0xb673('0x1c')](function(_0x361951){if(_0x361951&&_0x361951[_0xb673('0x62')]===0x0){return db[_0xb673('0x63')]['create']({'name':_0x1f5fc9[_0xb673('0x35')],'resourceId':_0x1f5fc9['id'],'type':_0x361951[_0xb673('0x35')],'sectionId':_0x361951['id']},{})['then'](function(){return _0x1a9699;});}else{return _0x1a9699;}})[_0xb673('0x25')](function(_0x393bd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x393bd4);throw _0x393bd4;});}return _0x1a9699;})[_0xb673('0x1c')](respondWithResult(_0x2fe99f,0xc9))[_0xb673('0x25')](handleError(_0x2fe99f,null));};exports['update']=function(_0x3c145c,_0x29e7a3,_0x5ab467){var _0x2c2567;return db[_0xb673('0x38')][_0xb673('0x60')]({'where':{'id':_0x3c145c[_0xb673('0x52')]['id']}})[_0xb673('0x1c')](handleEntityNotFound(_0x29e7a3,null))[_0xb673('0x1c')](saveUpdates(_0x3c145c[_0xb673('0x55')],null))[_0xb673('0x1c')](function(_0x363494){if(_0x363494){_0x2c2567=_0x363494;return db['VoiceContext'][_0xb673('0x4f')]({'raw':!![]});}})[_0xb673('0x1c')](function(_0x5115c7){var _0x7c5712=fs[_0xb673('0x64')](path[_0xb673('0x65')](config[_0xb673('0x56')],_0xb673('0x57')),_0xb673('0x66'));var _0x5c8260=ejs[_0xb673('0x58')](_0x7c5712,{'contexts':_0x5115c7||[]});fs[_0xb673('0x59')](_0xb673('0x67'),_0x5c8260);})['then'](function(){return respondWithRpcPromise(_0xb673('0x68'),_0xb673('0x32'),{'module':_0xb673('0x5a')});})[_0xb673('0x1c')](function(){return _0x2c2567;})[_0xb673('0x1c')](respondWithResult(_0x29e7a3,null))[_0xb673('0x25')](handleError(_0x29e7a3,null));};exports[_0xb673('0x34')]=function(_0x4bd9ae,_0x4529f3,_0x56f9a8){var _0xa20f57;return db[_0xb673('0x38')]['find']({'where':{'id':_0x4bd9ae['params']['id']}})['then'](handleEntityNotFound(_0x4529f3,null))[_0xb673('0x1c')](removeEntity(_0x4529f3,null))['then'](function(){return db[_0xb673('0x38')][_0xb673('0x4f')]({'raw':!![]});})['then'](function(_0x2b3d99){var _0x50527c=fs[_0xb673('0x64')](path[_0xb673('0x65')](config['root'],'server/files/templates/context.ejs'),_0xb673('0x66'));var _0x4d793c=ejs[_0xb673('0x58')](_0x50527c,{'contexts':_0x2b3d99});fs[_0xb673('0x59')](_0xb673('0x67'),_0x4d793c);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0xb673('0x25')](handleError(_0x4529f3,null));}; \ No newline at end of file +var _0xff7b=['readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','root','Reload','update','utf8','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','get','Contexts','UserProfileResource','destroy','stack','name','index','map','VoiceContext','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','create','body'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xff7b,0xe8));var _0xbff7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xff7b[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xbff7('0x0'));var rimraf=require(_0xbff7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbff7('0x2'));var rp=require(_0xbff7('0x3'));var moment=require('moment');var BPromise=require(_0xbff7('0x4'));var Mustache=require(_0xbff7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbff7('0x6'));var fs=require('fs');var fs_extra=require(_0xbff7('0x7'));var _=require('lodash');var squel=require(_0xbff7('0x8'));var crypto=require(_0xbff7('0x9'));var jsforce=require(_0xbff7('0xa'));var deskjs=require(_0xbff7('0xb'));var toCsv=require(_0xbff7('0xc'));var querystring=require(_0xbff7('0xd'));var Papa=require(_0xbff7('0xe'));var Redis=require(_0xbff7('0xf'));var authService=require(_0xbff7('0x10'));var qs=require(_0xbff7('0x11'));var as=require(_0xbff7('0x12'));var hardwareService=require(_0xbff7('0x13'));var logger=require(_0xbff7('0x14'))('api');var utils=require(_0xbff7('0x15'));var config=require(_0xbff7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbff7('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbff7('0x18')][_0xbff7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1fb68d,_0x376ee5,_0x5d27e9,_0x2df80b){return new BPromise(function(_0x531b96,_0x1d1145){var _0x4d2652=_0x2df80b||client;return _0x4d2652[_0xbff7('0x1a')](_0x1fb68d,_0x5d27e9)[_0xbff7('0x1b')](function(_0x4b8b9b){logger[_0xbff7('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x376ee5,_0xbff7('0x1d'));logger[_0xbff7('0x1e')](_0xbff7('0x1f'),_0x376ee5,_0xbff7('0x1d'),JSON[_0xbff7('0x20')](_0x4b8b9b));if(_0x4b8b9b[_0xbff7('0x21')]){if(_0x4b8b9b[_0xbff7('0x21')][_0xbff7('0x22')]===0x1f4){logger[_0xbff7('0x21')](_0xbff7('0x23'),_0x376ee5,_0x4b8b9b[_0xbff7('0x21')][_0xbff7('0x24')]);return _0x1d1145(_0x4b8b9b[_0xbff7('0x21')][_0xbff7('0x24')]);}logger[_0xbff7('0x21')]('VoiceContext,\x20%s,\x20%s',_0x376ee5,_0x4b8b9b['error'][_0xbff7('0x24')]);return _0x531b96(_0x4b8b9b[_0xbff7('0x21')][_0xbff7('0x24')]);}else{logger[_0xbff7('0x1c')](_0xbff7('0x23'),_0x376ee5,'request\x20sent');_0x531b96(_0x4b8b9b['result'][_0xbff7('0x24')]);}})[_0xbff7('0x25')](function(_0x1726b0){logger[_0xbff7('0x21')](_0xbff7('0x23'),_0x376ee5,_0x1726b0);_0x1d1145(_0x1726b0);});});}function respondWithStatusCode(_0x4966f8,_0x5c58a4){_0x5c58a4=_0x5c58a4||0xcc;return function(_0x339eac){if(_0x339eac){return _0x4966f8[_0xbff7('0x26')](_0x5c58a4);}return _0x4966f8[_0xbff7('0x27')](_0x5c58a4)[_0xbff7('0x28')]();};}function respondWithResult(_0x3b1345,_0x556978){_0x556978=_0x556978||0xc8;return function(_0x3381f7){if(_0x3381f7){return _0x3b1345[_0xbff7('0x27')](_0x556978)[_0xbff7('0x29')](_0x3381f7);}};}function respondWithFilteredResult(_0x4ae781,_0x23966f){return function(_0x59595e){if(_0x59595e){var _0x2157d1=typeof _0x23966f[_0xbff7('0x2a')]===_0xbff7('0x2b')&&typeof _0x23966f['limit']===_0xbff7('0x2b');var _0x4a14dc=_0x59595e[_0xbff7('0x2c')];var _0x10e074=_0x2157d1?0x0:_0x23966f[_0xbff7('0x2a')];var _0x292851=_0x2157d1?_0x59595e[_0xbff7('0x2c')]:_0x23966f['offset']+_0x23966f['limit'];var _0x2874b8;if(_0x292851>=_0x4a14dc){_0x292851=_0x4a14dc;_0x2874b8=0xc8;}else{_0x2874b8=0xce;}_0x4ae781['status'](_0x2874b8);return _0x4ae781[_0xbff7('0x2d')](_0xbff7('0x2e'),_0x10e074+'-'+_0x292851+'/'+_0x4a14dc)['json'](_0x59595e);}return null;};}function patchUpdates(_0x52b845){return function(_0x512e94){try{jsonpatch[_0xbff7('0x2f')](_0x512e94,_0x52b845,!![]);}catch(_0x2b74c5){return BPromise[_0xbff7('0x30')](_0x2b74c5);}return _0x512e94[_0xbff7('0x31')]();};}function saveUpdates(_0x228961,_0xf71b07){return function(_0x386369){if(_0x386369){return _0x386369['update'](_0x228961)[_0xbff7('0x1b')](function(_0x3148e7){return _0x3148e7;});}return null;};}function removeEntity(_0x14d898,_0x4507a1){return function(_0x2418bb){if(_0x2418bb){return _0x2418bb['destroy']()[_0xbff7('0x1b')](function(){var _0x246805=_0x2418bb[_0xbff7('0x32')]({'plain':!![]});var _0x175ef5=_0xbff7('0x33');return db[_0xbff7('0x34')][_0xbff7('0x35')]({'where':{'type':_0x175ef5,'resourceId':_0x246805['id']}})[_0xbff7('0x1b')](function(){return _0x2418bb;});})[_0xbff7('0x1b')](function(){_0x14d898[_0xbff7('0x27')](0xcc)[_0xbff7('0x28')]();});}};}function handleEntityNotFound(_0x4331b9,_0x3396f3){return function(_0x53c466){if(!_0x53c466){_0x4331b9[_0xbff7('0x26')](0x194);}return _0x53c466;};}function handleError(_0x3f3c17,_0x44e0dd){_0x44e0dd=_0x44e0dd||0x1f4;return function(_0x38871a){logger['error'](_0x38871a[_0xbff7('0x36')]);if(_0x38871a[_0xbff7('0x37')]){delete _0x38871a[_0xbff7('0x37')];}_0x3f3c17[_0xbff7('0x27')](_0x44e0dd)['send'](_0x38871a);};}exports[_0xbff7('0x38')]=function(_0x546590,_0x2d84ad){var _0x1ddd8d={},_0x7da14d={},_0x398c6c={'count':0x0,'rows':[]};var _0x5808fa=_[_0xbff7('0x39')](db[_0xbff7('0x3a')]['rawAttributes'],function(_0x303c51){return{'name':_0x303c51[_0xbff7('0x3b')],'type':_0x303c51[_0xbff7('0x3c')][_0xbff7('0x3d')]};});_0x7da14d[_0xbff7('0x3e')]=_['map'](_0x5808fa,_0xbff7('0x37'));_0x7da14d[_0xbff7('0x3f')]=_[_0xbff7('0x40')](_0x546590[_0xbff7('0x3f')]);_0x7da14d[_0xbff7('0x41')]=_[_0xbff7('0x42')](_0x7da14d[_0xbff7('0x3e')],_0x7da14d[_0xbff7('0x3f')]);_0x1ddd8d[_0xbff7('0x43')]=_[_0xbff7('0x42')](_0x7da14d['model'],qs[_0xbff7('0x44')](_0x546590[_0xbff7('0x3f')]['fields']));_0x1ddd8d[_0xbff7('0x43')]=_0x1ddd8d[_0xbff7('0x43')][_0xbff7('0x45')]?_0x1ddd8d[_0xbff7('0x43')]:_0x7da14d['model'];if(!_0x546590[_0xbff7('0x3f')][_0xbff7('0x46')](_0xbff7('0x47'))){_0x1ddd8d[_0xbff7('0x48')]=qs['limit'](_0x546590[_0xbff7('0x3f')][_0xbff7('0x48')]);_0x1ddd8d[_0xbff7('0x2a')]=qs[_0xbff7('0x2a')](_0x546590[_0xbff7('0x3f')][_0xbff7('0x2a')]);}_0x1ddd8d[_0xbff7('0x49')]=qs['sort'](_0x546590['query'][_0xbff7('0x4a')]);_0x1ddd8d[_0xbff7('0x4b')]=qs['filters'](_['pick'](_0x546590[_0xbff7('0x3f')],_0x7da14d[_0xbff7('0x41')]),_0x5808fa);if(_0x546590[_0xbff7('0x3f')][_0xbff7('0x4c')]){_0x1ddd8d[_0xbff7('0x4b')]=_['merge'](_0x1ddd8d[_0xbff7('0x4b')],{'$or':_[_0xbff7('0x39')](_0x5808fa,function(_0x27999f){if(_0x27999f['type']!==_0xbff7('0x4d')){var _0x3a5750={};_0x3a5750[_0x27999f['name']]={'$like':'%'+_0x546590[_0xbff7('0x3f')][_0xbff7('0x4c')]+'%'};return _0x3a5750;}})});}_0x1ddd8d=_[_0xbff7('0x4e')]({},_0x1ddd8d,_0x546590[_0xbff7('0x4f')]);var _0x2eb6ad={'where':_0x1ddd8d[_0xbff7('0x4b')]};return db[_0xbff7('0x3a')]['count'](_0x2eb6ad)['then'](function(_0x4eb54c){_0x398c6c[_0xbff7('0x2c')]=_0x4eb54c;if(_0x546590[_0xbff7('0x3f')][_0xbff7('0x50')]){_0x1ddd8d[_0xbff7('0x51')]=[{'all':!![]}];}return db[_0xbff7('0x3a')][_0xbff7('0x52')](_0x1ddd8d);})[_0xbff7('0x1b')](function(_0x36e228){_0x398c6c[_0xbff7('0x53')]=_0x36e228;return _0x398c6c;})['then'](respondWithFilteredResult(_0x2d84ad,_0x1ddd8d))[_0xbff7('0x25')](handleError(_0x2d84ad,null));};exports[_0xbff7('0x54')]=function(_0x24e3be,_0x53f84c){var _0x3a4967={'raw':![],'where':{'id':_0x24e3be['params']['id']}},_0x22fe00={};_0x22fe00['model']=_[_0xbff7('0x40')](db['VoiceContext'][_0xbff7('0x55')]);_0x22fe00[_0xbff7('0x3f')]=_['keys'](_0x24e3be[_0xbff7('0x3f')]);_0x22fe00['filters']=_['intersection'](_0x22fe00[_0xbff7('0x3e')],_0x22fe00[_0xbff7('0x3f')]);_0x3a4967[_0xbff7('0x43')]=_['intersection'](_0x22fe00[_0xbff7('0x3e')],qs[_0xbff7('0x44')](_0x24e3be[_0xbff7('0x3f')][_0xbff7('0x44')]));_0x3a4967[_0xbff7('0x43')]=_0x3a4967[_0xbff7('0x43')][_0xbff7('0x45')]?_0x3a4967[_0xbff7('0x43')]:_0x22fe00[_0xbff7('0x3e')];if(_0x24e3be[_0xbff7('0x3f')][_0xbff7('0x50')]){_0x3a4967[_0xbff7('0x51')]=[{'all':!![]}];}_0x3a4967=_[_0xbff7('0x4e')]({},_0x3a4967,_0x24e3be[_0xbff7('0x4f')]);return db[_0xbff7('0x3a')][_0xbff7('0x56')](_0x3a4967)[_0xbff7('0x1b')](handleEntityNotFound(_0x53f84c,null))[_0xbff7('0x1b')](respondWithResult(_0x53f84c,null))[_0xbff7('0x25')](handleError(_0x53f84c,null));};exports[_0xbff7('0x57')]=function(_0x318bf9,_0x5c5fef,_0x5a8733){var _0x320054;return db[_0xbff7('0x3a')][_0xbff7('0x57')](_0x318bf9[_0xbff7('0x58')],{'raw':!![]})['then'](function(_0x58ee65){_0x320054=_0x58ee65;return db[_0xbff7('0x3a')][_0xbff7('0x52')]({'raw':!![]});})[_0xbff7('0x1b')](function(_0x4ea16a){var _0xac1be0=fs[_0xbff7('0x59')](path[_0xbff7('0x5a')](config['root'],_0xbff7('0x5b')),'utf8');var _0x157997=ejs[_0xbff7('0x5c')](_0xac1be0,{'contexts':_0x4ea16a||[]});fs[_0xbff7('0x5d')](_0xbff7('0x5e'),_0x157997);})[_0xbff7('0x1b')](function(){return respondWithRpcPromise('Reload',_0xbff7('0x57'),{'module':_0xbff7('0x5f')});})[_0xbff7('0x1b')](function(){var _0x2d515f=_0x318bf9[_0xbff7('0x60')][_0xbff7('0x32')]({'plain':!![]});if(!_0x2d515f)throw new Error(_0xbff7('0x61'));if(_0x2d515f[_0xbff7('0x62')]==='user'){var _0x1a706f=_0x320054['get']({'plain':!![]});return db[_0xbff7('0x63')][_0xbff7('0x56')]({'where':{'name':_0xbff7('0x33'),'userProfileId':_0x2d515f['userProfileId']},'raw':!![]})[_0xbff7('0x1b')](function(_0x2cd0c5){if(_0x2cd0c5&&_0x2cd0c5[_0xbff7('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a706f['name'],'resourceId':_0x1a706f['id'],'type':_0x2cd0c5[_0xbff7('0x37')],'sectionId':_0x2cd0c5['id']},{})[_0xbff7('0x1b')](function(){return _0x320054;});}else{return _0x320054;}})['catch'](function(_0x225016){logger[_0xbff7('0x21')](_0xbff7('0x65'),_0x225016);throw _0x225016;});}return _0x320054;})[_0xbff7('0x1b')](respondWithResult(_0x5c5fef,0xc9))['catch'](handleError(_0x5c5fef,null));};exports['update']=function(_0x12ca1d,_0x530fc6,_0x146c01){var _0x105d12;return db[_0xbff7('0x3a')][_0xbff7('0x56')]({'where':{'id':_0x12ca1d[_0xbff7('0x66')]['id']}})[_0xbff7('0x1b')](handleEntityNotFound(_0x530fc6,null))[_0xbff7('0x1b')](saveUpdates(_0x12ca1d[_0xbff7('0x58')],null))['then'](function(_0x18136c){if(_0x18136c){_0x105d12=_0x18136c;return db[_0xbff7('0x3a')]['findAll']({'raw':!![]});}})[_0xbff7('0x1b')](function(_0x3e2134){var _0x2d9262=fs[_0xbff7('0x59')](path['join'](config[_0xbff7('0x67')],'server/files/templates/context.ejs'),'utf8');var _0x3e196a=ejs[_0xbff7('0x5c')](_0x2d9262,{'contexts':_0x3e2134||[]});fs[_0xbff7('0x5d')](_0xbff7('0x5e'),_0x3e196a);})[_0xbff7('0x1b')](function(){return respondWithRpcPromise(_0xbff7('0x68'),_0xbff7('0x69'),{'module':_0xbff7('0x5f')});})[_0xbff7('0x1b')](function(){return _0x105d12;})[_0xbff7('0x1b')](respondWithResult(_0x530fc6,null))[_0xbff7('0x25')](handleError(_0x530fc6,null));};exports[_0xbff7('0x35')]=function(_0x10bdb1,_0x159644,_0x104a91){var _0x7c95;return db[_0xbff7('0x3a')][_0xbff7('0x56')]({'where':{'id':_0x10bdb1['params']['id']}})[_0xbff7('0x1b')](handleEntityNotFound(_0x159644,null))[_0xbff7('0x1b')](removeEntity(_0x159644,null))['then'](function(){return db[_0xbff7('0x3a')][_0xbff7('0x52')]({'raw':!![]});})[_0xbff7('0x1b')](function(_0x1c6911){var _0x107c88=fs['readFileSync'](path['join'](config[_0xbff7('0x67')],'server/files/templates/context.ejs'),_0xbff7('0x6a'));var _0x396de9=ejs[_0xbff7('0x5c')](_0x107c88,{'contexts':_0x1c6911});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x396de9);return respondWithRpcPromise(_0xbff7('0x68'),_0xbff7('0x35'),{'module':_0xbff7('0x5f')});})['catch'](handleError(_0x159644,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 32ded4f..a246a5f 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 _0x985d=['exports','define','VoiceContext','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x46a560,_0x1e9d00){var _0x232edc=function(_0x426f86){while(--_0x426f86){_0x46a560['push'](_0x46a560['shift']());}};_0x232edc(++_0x1e9d00);}(_0x985d,0x10b));var _0xd985=function(_0x4a20a1,_0x56a8a9){_0x4a20a1=_0x4a20a1-0x0;var _0x6db983=_0x985d[_0x4a20a1];return _0x6db983;};'use strict';var _=require(_0xd985('0x0'));var util=require(_0xd985('0x1'));var logger=require(_0xd985('0x2'))(_0xd985('0x3'));var moment=require(_0xd985('0x4'));var BPromise=require(_0xd985('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd985('0x6'));var config=require(_0xd985('0x7'));var attributes=require(_0xd985('0x8'));module[_0xd985('0x9')]=function(_0xc12a1d,_0x283955){return _0xc12a1d[_0xd985('0xa')](_0xd985('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e7=['bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','lodash','util','../../config/logger','api'];(function(_0x4cda07,_0x249fe6){var _0x1878f8=function(_0x5e37be){while(--_0x5e37be){_0x4cda07['push'](_0x4cda07['shift']());}};_0x1878f8(++_0x249fe6);}(_0xe4e7,0x9c));var _0x7e4e=function(_0x482914,_0x3fe08e){_0x482914=_0x482914-0x0;var _0x151f6a=_0xe4e7[_0x482914];return _0x151f6a;};'use strict';var _=require(_0x7e4e('0x0'));var util=require(_0x7e4e('0x1'));var logger=require(_0x7e4e('0x2'))(_0x7e4e('0x3'));var moment=require('moment');var BPromise=require(_0x7e4e('0x4'));var rp=require(_0x7e4e('0x5'));var fs=require('fs');var path=require(_0x7e4e('0x6'));var rimraf=require(_0x7e4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e4e('0x8'));module['exports']=function(_0xe217d9,_0x386c1a){return _0xe217d9[_0x7e4e('0x9')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 85500dd..c49163f 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 _0x0e6b=['debug','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x460358,_0x45d45e){var _0x2e6a60=function(_0xc3135a){while(--_0xc3135a){_0x460358['push'](_0x460358['shift']());}};_0x2e6a60(++_0x45d45e);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x0e6b[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0xb0e6('0x0'));var util=require('util');var moment=require(_0xb0e6('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0e6('0x2'));var fs=require('fs');var Redis=require(_0xb0e6('0x3'));var db=require(_0xb0e6('0x4'))['db'];var utils=require(_0xb0e6('0x5'));var logger=require(_0xb0e6('0x6'))(_0xb0e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb0e6('0x8'));var client=jayson[_0xb0e6('0x9')][_0xb0e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba34d,_0x58abf0,_0x1844be){return new BPromise(function(_0x5a5d6c,_0x408d85){return client[_0xb0e6('0xb')](_0xba34d,_0x1844be)[_0xb0e6('0xc')](function(_0x1b87f1){logger[_0xb0e6('0xd')](_0xb0e6('0xe'),_0x58abf0,'request\x20sent');logger[_0xb0e6('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x58abf0,_0xb0e6('0x10'),JSON[_0xb0e6('0x11')](_0x1b87f1));if(_0x1b87f1[_0xb0e6('0x12')]){if(_0x1b87f1[_0xb0e6('0x12')][_0xb0e6('0x13')]===0x1f4){logger[_0xb0e6('0x12')]('VoiceContext,\x20%s,\x20%s',_0x58abf0,_0x1b87f1[_0xb0e6('0x12')]['message']);return _0x408d85(_0x1b87f1[_0xb0e6('0x12')][_0xb0e6('0x14')]);}logger['error'](_0xb0e6('0xe'),_0x58abf0,_0x1b87f1[_0xb0e6('0x12')][_0xb0e6('0x14')]);return _0x5a5d6c(_0x1b87f1[_0xb0e6('0x12')][_0xb0e6('0x14')]);}else{logger[_0xb0e6('0xd')](_0xb0e6('0xe'),_0x58abf0,_0xb0e6('0x10'));_0x5a5d6c(_0x1b87f1['result'][_0xb0e6('0x14')]);}})[_0xb0e6('0x15')](function(_0xbe81ad){logger[_0xb0e6('0x12')](_0xb0e6('0xe'),_0x58abf0,_0xbe81ad);_0x408d85(_0xbe81ad);});});} \ No newline at end of file +var _0xbe9d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2fc325,_0x4c718f){var _0x21167a=function(_0x15de72){while(--_0x15de72){_0x2fc325['push'](_0x2fc325['shift']());}};_0x21167a(++_0x4c718f);}(_0xbe9d,0x99));var _0xdbe9=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xbe9d[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var moment=require(_0xdbe9('0x2'));var BPromise=require(_0xdbe9('0x3'));var rs=require(_0xdbe9('0x4'));var fs=require('fs');var Redis=require(_0xdbe9('0x5'));var db=require(_0xdbe9('0x6'))['db'];var utils=require(_0xdbe9('0x7'));var logger=require(_0xdbe9('0x8'))(_0xdbe9('0x9'));var config=require(_0xdbe9('0xa'));var jayson=require(_0xdbe9('0xb'));var client=jayson[_0xdbe9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e9be,_0x3d5165,_0x1139e8){return new BPromise(function(_0x5a9989,_0x58093b){return client[_0xdbe9('0xd')](_0x56e9be,_0x1139e8)[_0xdbe9('0xe')](function(_0x56470c){logger['info'](_0xdbe9('0xf'),_0x3d5165,_0xdbe9('0x10'));logger[_0xdbe9('0x11')](_0xdbe9('0x12'),_0x3d5165,'request\x20sent',JSON[_0xdbe9('0x13')](_0x56470c));if(_0x56470c[_0xdbe9('0x14')]){if(_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x15')]===0x1f4){logger['error'](_0xdbe9('0xf'),_0x3d5165,_0x56470c['error'][_0xdbe9('0x16')]);return _0x58093b(_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x16')]);}logger['error'](_0xdbe9('0xf'),_0x3d5165,_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x16')]);return _0x5a9989(_0x56470c['error'][_0xdbe9('0x16')]);}else{logger['info'](_0xdbe9('0xf'),_0x3d5165,_0xdbe9('0x10'));_0x5a9989(_0x56470c[_0xdbe9('0x17')]['message']);}})[_0xdbe9('0x18')](function(_0xfc065e){logger[_0xdbe9('0x14')]('VoiceContext,\x20%s,\x20%s',_0x3d5165,_0xfc065e);_0x58093b(_0xfc065e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index cfb3c6d..eed732d 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 _0x9726=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','exports'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x9726,0xbe));var _0x6972=function(_0x462433,_0x3312e0){_0x462433=_0x462433-0x0;var _0x305e45=_0x9726[_0x462433];return _0x305e45;};'use strict';var multer=require(_0x6972('0x0'));var util=require('util');var path=require(_0x6972('0x1'));var timeout=require(_0x6972('0x2'));var express=require(_0x6972('0x3'));var router=express[_0x6972('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6972('0x5'));var interaction=require(_0x6972('0x6'));var config=require('../../config/environment');var controller=require(_0x6972('0x7'));router[_0x6972('0x8')]('/',auth[_0x6972('0x9')](),controller[_0x6972('0xa')]);router[_0x6972('0x8')]('/describe',auth[_0x6972('0x9')](),controller[_0x6972('0xb')]);router[_0x6972('0x8')](_0x6972('0xc'),auth[_0x6972('0x9')](),controller[_0x6972('0xd')]);router[_0x6972('0xe')]('/',auth['isAuthenticated'](),controller[_0x6972('0xf')]);router[_0x6972('0x10')](_0x6972('0xc'),auth[_0x6972('0x9')](),controller[_0x6972('0x11')]);router['delete'](_0x6972('0xc'),auth[_0x6972('0x9')](),controller['destroy']);module[_0x6972('0x12')]=router; \ No newline at end of file +var _0x6c20=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0xb2fdb5,_0x21030d){var _0xeccce2=function(_0x4a3085){while(--_0x4a3085){_0xb2fdb5['push'](_0xb2fdb5['shift']());}};_0xeccce2(++_0x21030d);}(_0x6c20,0xaf));var _0x06c2=function(_0x38a359,_0x49d7c7){_0x38a359=_0x38a359-0x0;var _0x50e820=_0x6c20[_0x38a359];return _0x50e820;};'use strict';var multer=require(_0x06c2('0x0'));var util=require(_0x06c2('0x1'));var path=require(_0x06c2('0x2'));var timeout=require(_0x06c2('0x3'));var express=require('express');var router=express[_0x06c2('0x4')]();var fs_extra=require(_0x06c2('0x5'));var auth=require(_0x06c2('0x6'));var interaction=require(_0x06c2('0x7'));var config=require(_0x06c2('0x8'));var controller=require(_0x06c2('0x9'));router[_0x06c2('0xa')]('/',auth[_0x06c2('0xb')](),controller[_0x06c2('0xc')]);router[_0x06c2('0xa')](_0x06c2('0xd'),auth[_0x06c2('0xb')](),controller[_0x06c2('0xe')]);router[_0x06c2('0xa')](_0x06c2('0xf'),auth[_0x06c2('0xb')](),controller['show']);router[_0x06c2('0x10')]('/',auth[_0x06c2('0xb')](),controller[_0x06c2('0x11')]);router[_0x06c2('0x12')](_0x06c2('0xf'),auth[_0x06c2('0xb')](),controller['update']);router[_0x06c2('0x13')](_0x06c2('0xf'),auth['isAuthenticated'](),controller[_0x06c2('0x14')]);module[_0x06c2('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 04b68bc..f936f2e 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x3df3cb,_0x45b628){var _0x329a4b=function(_0x1d6d26){while(--_0x1d6d26){_0x3df3cb['push'](_0x3df3cb['shift']());}};_0x329a4b(++_0x45b628);}(_0x6aa7,0x178));var _0x76aa=function(_0x1bae45,_0x313bc1){_0x1bae45=_0x1bae45-0x0;var _0x1d865a=_0x6aa7[_0x1bae45];return _0x1d865a;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x54ef,0x112));var _0xf54e=function(_0x2bfcb3,_0x2dc452){_0x2bfcb3=_0x2bfcb3-0x0;var _0x2ede81=_0x54ef[_0x2bfcb3];return _0x2ede81;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 0bdf977..878ce2c 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 _0xe83d=['params','intersection','includeAll','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','json','apply','reject','update','then','destroy','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','catch','show'];(function(_0x420c52,_0x2650f6){var _0x6f47d0=function(_0x3d52de){while(--_0x3d52de){_0x420c52['push'](_0x420c52['shift']());}};_0x6f47d0(++_0x2650f6);}(_0xe83d,0x13d));var _0xde83=function(_0x21307f,_0x361e25){_0x21307f=_0x21307f-0x0;var _0x37a96d=_0xe83d[_0x21307f];return _0x37a96d;};'use strict';var emlformat=require(_0xde83('0x0'));var rimraf=require(_0xde83('0x1'));var zipdir=require(_0xde83('0x2'));var jsonpatch=require(_0xde83('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde83('0x4'));var Mustache=require('mustache');var util=require(_0xde83('0x5'));var path=require('path');var sox=require(_0xde83('0x6'));var csv=require(_0xde83('0x7'));var ejs=require(_0xde83('0x8'));var fs=require('fs');var fs_extra=require(_0xde83('0x9'));var _=require('lodash');var squel=require(_0xde83('0xa'));var crypto=require(_0xde83('0xb'));var jsforce=require(_0xde83('0xc'));var deskjs=require(_0xde83('0xd'));var toCsv=require(_0xde83('0x7'));var querystring=require('querystring');var Papa=require(_0xde83('0xe'));var Redis=require(_0xde83('0xf'));var authService=require(_0xde83('0x10'));var qs=require(_0xde83('0x11'));var as=require(_0xde83('0x12'));var hardwareService=require(_0xde83('0x13'));var logger=require(_0xde83('0x14'))('api');var utils=require(_0xde83('0x15'));var config=require(_0xde83('0x16'));var licenseUtil=require(_0xde83('0x17'));var db=require(_0xde83('0x18'))['db'];function respondWithStatusCode(_0x46d2de,_0x1ed160){_0x1ed160=_0x1ed160||0xcc;return function(_0x46d870){if(_0x46d870){return _0x46d2de[_0xde83('0x19')](_0x1ed160);}return _0x46d2de[_0xde83('0x1a')](_0x1ed160)[_0xde83('0x1b')]();};}function respondWithResult(_0x512486,_0x5cb936){_0x5cb936=_0x5cb936||0xc8;return function(_0x289358){if(_0x289358){return _0x512486[_0xde83('0x1a')](_0x5cb936)['json'](_0x289358);}};}function respondWithFilteredResult(_0x3aa0d5,_0x559377){return function(_0x3eda60){if(_0x3eda60){var _0x417687=typeof _0x559377['offset']===_0xde83('0x1c')&&typeof _0x559377[_0xde83('0x1d')]===_0xde83('0x1c');var _0x323dec=_0x3eda60['count'];var _0x4cfff9=_0x417687?0x0:_0x559377[_0xde83('0x1e')];var _0x100630=_0x417687?_0x3eda60[_0xde83('0x1f')]:_0x559377['offset']+_0x559377[_0xde83('0x1d')];var _0x1a3d7c;if(_0x100630>=_0x323dec){_0x100630=_0x323dec;_0x1a3d7c=0xc8;}else{_0x1a3d7c=0xce;}_0x3aa0d5[_0xde83('0x1a')](_0x1a3d7c);return _0x3aa0d5['set']('Content-Range',_0x4cfff9+'-'+_0x100630+'/'+_0x323dec)[_0xde83('0x20')](_0x3eda60);}return null;};}function patchUpdates(_0x477ca3){return function(_0x11adf0){try{jsonpatch[_0xde83('0x21')](_0x11adf0,_0x477ca3,!![]);}catch(_0xc23b39){return BPromise[_0xde83('0x22')](_0xc23b39);}return _0x11adf0['save']();};}function saveUpdates(_0x15fc25,_0x1d98a0){return function(_0x317e5a){if(_0x317e5a){return _0x317e5a[_0xde83('0x23')](_0x15fc25)[_0xde83('0x24')](function(_0x46cced){return _0x46cced;});}return null;};}function removeEntity(_0x5bfd34,_0x333ca8){return function(_0x292115){if(_0x292115){return _0x292115[_0xde83('0x25')]()[_0xde83('0x24')](function(){_0x5bfd34[_0xde83('0x1a')](0xcc)[_0xde83('0x1b')]();});}};}function handleEntityNotFound(_0x30d650,_0x5a2978){return function(_0x21f9ca){if(!_0x21f9ca){_0x30d650[_0xde83('0x19')](0x194);}return _0x21f9ca;};}function handleError(_0x1231a1,_0x2bd8f2){_0x2bd8f2=_0x2bd8f2||0x1f4;return function(_0x1160fb){logger[_0xde83('0x26')](_0x1160fb['stack']);if(_0x1160fb['name']){delete _0x1160fb[_0xde83('0x27')];}_0x1231a1['status'](_0x2bd8f2)[_0xde83('0x28')](_0x1160fb);};}exports[_0xde83('0x29')]=function(_0x5280c8,_0x9505f6){var _0x1fed72={},_0x4768bd={},_0x4db330={'count':0x0,'rows':[]};var _0x1bccce=_['map'](db[_0xde83('0x2a')][_0xde83('0x2b')],function(_0x22b786){return{'name':_0x22b786[_0xde83('0x2c')],'type':_0x22b786[_0xde83('0x2d')][_0xde83('0x2e')]};});_0x4768bd[_0xde83('0x2f')]=_[_0xde83('0x30')](_0x1bccce,_0xde83('0x27'));_0x4768bd[_0xde83('0x31')]=_[_0xde83('0x32')](_0x5280c8[_0xde83('0x31')]);_0x4768bd[_0xde83('0x33')]=_['intersection'](_0x4768bd[_0xde83('0x2f')],_0x4768bd[_0xde83('0x31')]);_0x1fed72[_0xde83('0x34')]=_['intersection'](_0x4768bd[_0xde83('0x2f')],qs[_0xde83('0x35')](_0x5280c8['query'][_0xde83('0x35')]));_0x1fed72['attributes']=_0x1fed72[_0xde83('0x34')][_0xde83('0x36')]?_0x1fed72[_0xde83('0x34')]:_0x4768bd['model'];if(!_0x5280c8[_0xde83('0x31')][_0xde83('0x37')](_0xde83('0x38'))){_0x1fed72['limit']=qs[_0xde83('0x1d')](_0x5280c8[_0xde83('0x31')]['limit']);_0x1fed72[_0xde83('0x1e')]=qs[_0xde83('0x1e')](_0x5280c8[_0xde83('0x31')][_0xde83('0x1e')]);}_0x1fed72[_0xde83('0x39')]=qs[_0xde83('0x3a')](_0x5280c8[_0xde83('0x31')][_0xde83('0x3a')]);_0x1fed72['where']=qs[_0xde83('0x33')](_[_0xde83('0x3b')](_0x5280c8[_0xde83('0x31')],_0x4768bd[_0xde83('0x33')]),_0x1bccce);if(_0x5280c8[_0xde83('0x31')][_0xde83('0x3c')]){_0x1fed72[_0xde83('0x3d')]=_['merge'](_0x1fed72['where'],{'$or':_[_0xde83('0x30')](_0x1bccce,function(_0x21cfd8){if(_0x21cfd8[_0xde83('0x2d')]!==_0xde83('0x3e')){var _0x2198e2={};_0x2198e2[_0x21cfd8[_0xde83('0x27')]]={'$like':'%'+_0x5280c8[_0xde83('0x31')][_0xde83('0x3c')]+'%'};return _0x2198e2;}})});}_0x1fed72=_[_0xde83('0x3f')]({},_0x1fed72,_0x5280c8['options']);var _0x3c5ee6={'where':_0x1fed72[_0xde83('0x3d')]};return db[_0xde83('0x2a')][_0xde83('0x1f')](_0x3c5ee6)[_0xde83('0x24')](function(_0x156cf2){_0x4db330[_0xde83('0x1f')]=_0x156cf2;if(_0x5280c8['query']['includeAll']){_0x1fed72['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xde83('0x40')](_0x1fed72);})[_0xde83('0x24')](function(_0x455732){_0x4db330[_0xde83('0x41')]=_0x455732;return _0x4db330;})[_0xde83('0x24')](respondWithFilteredResult(_0x9505f6,_0x1fed72))[_0xde83('0x42')](handleError(_0x9505f6,null));};exports[_0xde83('0x43')]=function(_0x53b433,_0x3f848c){var _0xc38e3={'raw':!![],'where':{'id':_0x53b433[_0xde83('0x44')]['id']}},_0x42c026={};_0x42c026[_0xde83('0x2f')]=_[_0xde83('0x32')](db[_0xde83('0x2a')][_0xde83('0x2b')]);_0x42c026[_0xde83('0x31')]=_[_0xde83('0x32')](_0x53b433[_0xde83('0x31')]);_0x42c026[_0xde83('0x33')]=_['intersection'](_0x42c026['model'],_0x42c026[_0xde83('0x31')]);_0xc38e3[_0xde83('0x34')]=_[_0xde83('0x45')](_0x42c026[_0xde83('0x2f')],qs['fields'](_0x53b433[_0xde83('0x31')][_0xde83('0x35')]));_0xc38e3[_0xde83('0x34')]=_0xc38e3[_0xde83('0x34')]['length']?_0xc38e3['attributes']:_0x42c026[_0xde83('0x2f')];if(_0x53b433[_0xde83('0x31')][_0xde83('0x46')]){_0xc38e3[_0xde83('0x47')]=[{'all':!![]}];}_0xc38e3=_[_0xde83('0x3f')]({},_0xc38e3,_0x53b433[_0xde83('0x48')]);return db[_0xde83('0x2a')]['find'](_0xc38e3)[_0xde83('0x24')](handleEntityNotFound(_0x3f848c,null))[_0xde83('0x24')](respondWithResult(_0x3f848c,null))[_0xde83('0x42')](handleError(_0x3f848c,null));};exports[_0xde83('0x49')]=function(_0x385eb4,_0x4e3a22){return db[_0xde83('0x2a')]['create'](_0x385eb4['body'],{})[_0xde83('0x24')](respondWithResult(_0x4e3a22,0xc9))['catch'](handleError(_0x4e3a22,null));};exports[_0xde83('0x23')]=function(_0x384a30,_0x3649bf){if(_0x384a30[_0xde83('0x4a')]['id']){delete _0x384a30[_0xde83('0x4a')]['id'];}return db['VoiceDialReport'][_0xde83('0x4b')]({'where':{'id':_0x384a30[_0xde83('0x44')]['id']}})['then'](handleEntityNotFound(_0x3649bf,null))[_0xde83('0x24')](saveUpdates(_0x384a30['body'],null))[_0xde83('0x24')](respondWithResult(_0x3649bf,null))[_0xde83('0x42')](handleError(_0x3649bf,null));};exports[_0xde83('0x25')]=function(_0x20baa8,_0x2b64c7){return db[_0xde83('0x2a')]['find']({'where':{'id':_0x20baa8[_0xde83('0x44')]['id']}})[_0xde83('0x24')](handleEntityNotFound(_0x2b64c7,null))[_0xde83('0x24')](removeEntity(_0x2b64c7,null))[_0xde83('0x42')](handleError(_0x2b64c7,null));};exports[_0xde83('0x4c')]=function(_0x3cf646,_0x555863){return db[_0xde83('0x2a')][_0xde83('0x4c')]()[_0xde83('0x24')](respondWithResult(_0x555863,null))[_0xde83('0x42')](handleError(_0x555863,null));}; \ No newline at end of file +var _0xa904=['set','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset'];(function(_0x5436a1,_0x43ce08){var _0x46c586=function(_0x622b2b){while(--_0x622b2b){_0x5436a1['push'](_0x5436a1['shift']());}};_0x46c586(++_0x43ce08);}(_0xa904,0x1b7));var _0x4a90=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0xa904[_0x28fbe3];return _0x45db6a;};'use strict';var emlformat=require(_0x4a90('0x0'));var rimraf=require(_0x4a90('0x1'));var zipdir=require(_0x4a90('0x2'));var jsonpatch=require(_0x4a90('0x3'));var rp=require(_0x4a90('0x4'));var moment=require(_0x4a90('0x5'));var BPromise=require(_0x4a90('0x6'));var Mustache=require(_0x4a90('0x7'));var util=require(_0x4a90('0x8'));var path=require(_0x4a90('0x9'));var sox=require('sox');var csv=require(_0x4a90('0xa'));var ejs=require(_0x4a90('0xb'));var fs=require('fs');var fs_extra=require(_0x4a90('0xc'));var _=require(_0x4a90('0xd'));var squel=require(_0x4a90('0xe'));var crypto=require(_0x4a90('0xf'));var jsforce=require(_0x4a90('0x10'));var deskjs=require(_0x4a90('0x11'));var toCsv=require(_0x4a90('0xa'));var querystring=require('querystring');var Papa=require(_0x4a90('0x12'));var Redis=require(_0x4a90('0x13'));var authService=require(_0x4a90('0x14'));var qs=require(_0x4a90('0x15'));var as=require(_0x4a90('0x16'));var hardwareService=require(_0x4a90('0x17'));var logger=require(_0x4a90('0x18'))(_0x4a90('0x19'));var utils=require('../../config/utils');var config=require(_0x4a90('0x1a'));var licenseUtil=require(_0x4a90('0x1b'));var db=require(_0x4a90('0x1c'))['db'];function respondWithStatusCode(_0x26aa44,_0x48e830){_0x48e830=_0x48e830||0xcc;return function(_0x5849cf){if(_0x5849cf){return _0x26aa44['sendStatus'](_0x48e830);}return _0x26aa44[_0x4a90('0x1d')](_0x48e830)['end']();};}function respondWithResult(_0x46be8a,_0xa4369f){_0xa4369f=_0xa4369f||0xc8;return function(_0x574266){if(_0x574266){return _0x46be8a[_0x4a90('0x1d')](_0xa4369f)[_0x4a90('0x1e')](_0x574266);}};}function respondWithFilteredResult(_0x44187a,_0x35ea09){return function(_0x4f4024){if(_0x4f4024){var _0xb789c6=typeof _0x35ea09['offset']===_0x4a90('0x1f')&&typeof _0x35ea09[_0x4a90('0x20')]===_0x4a90('0x1f');var _0x434561=_0x4f4024[_0x4a90('0x21')];var _0x440c27=_0xb789c6?0x0:_0x35ea09[_0x4a90('0x22')];var _0x2e5b40=_0xb789c6?_0x4f4024[_0x4a90('0x21')]:_0x35ea09[_0x4a90('0x22')]+_0x35ea09[_0x4a90('0x20')];var _0x4532a8;if(_0x2e5b40>=_0x434561){_0x2e5b40=_0x434561;_0x4532a8=0xc8;}else{_0x4532a8=0xce;}_0x44187a[_0x4a90('0x1d')](_0x4532a8);return _0x44187a[_0x4a90('0x23')]('Content-Range',_0x440c27+'-'+_0x2e5b40+'/'+_0x434561)[_0x4a90('0x1e')](_0x4f4024);}return null;};}function patchUpdates(_0x2584ce){return function(_0x27b979){try{jsonpatch['apply'](_0x27b979,_0x2584ce,!![]);}catch(_0x1bbb56){return BPromise[_0x4a90('0x24')](_0x1bbb56);}return _0x27b979[_0x4a90('0x25')]();};}function saveUpdates(_0x4602f5,_0x4e8c94){return function(_0x549896){if(_0x549896){return _0x549896[_0x4a90('0x26')](_0x4602f5)[_0x4a90('0x27')](function(_0xcb023e){return _0xcb023e;});}return null;};}function removeEntity(_0x40aa54,_0x4bc2c8){return function(_0x1165c8){if(_0x1165c8){return _0x1165c8[_0x4a90('0x28')]()[_0x4a90('0x27')](function(){_0x40aa54[_0x4a90('0x1d')](0xcc)[_0x4a90('0x29')]();});}};}function handleEntityNotFound(_0x9b2dfd,_0x5e9f9f){return function(_0x581fd6){if(!_0x581fd6){_0x9b2dfd[_0x4a90('0x2a')](0x194);}return _0x581fd6;};}function handleError(_0x265c7a,_0x23b7a2){_0x23b7a2=_0x23b7a2||0x1f4;return function(_0x9c1c82){logger[_0x4a90('0x2b')](_0x9c1c82['stack']);if(_0x9c1c82['name']){delete _0x9c1c82[_0x4a90('0x2c')];}_0x265c7a[_0x4a90('0x1d')](_0x23b7a2)[_0x4a90('0x2d')](_0x9c1c82);};}exports[_0x4a90('0x2e')]=function(_0x31ec43,_0x16a053){var _0x16e41a={},_0x5f0277={},_0x6019b6={'count':0x0,'rows':[]};var _0x113ec9=_[_0x4a90('0x2f')](db[_0x4a90('0x30')][_0x4a90('0x31')],function(_0x55ff4e){return{'name':_0x55ff4e['fieldName'],'type':_0x55ff4e[_0x4a90('0x32')][_0x4a90('0x33')]};});_0x5f0277[_0x4a90('0x34')]=_[_0x4a90('0x2f')](_0x113ec9,_0x4a90('0x2c'));_0x5f0277[_0x4a90('0x35')]=_[_0x4a90('0x36')](_0x31ec43[_0x4a90('0x35')]);_0x5f0277['filters']=_['intersection'](_0x5f0277[_0x4a90('0x34')],_0x5f0277['query']);_0x16e41a[_0x4a90('0x37')]=_[_0x4a90('0x38')](_0x5f0277['model'],qs[_0x4a90('0x39')](_0x31ec43[_0x4a90('0x35')][_0x4a90('0x39')]));_0x16e41a[_0x4a90('0x37')]=_0x16e41a[_0x4a90('0x37')][_0x4a90('0x3a')]?_0x16e41a[_0x4a90('0x37')]:_0x5f0277['model'];if(!_0x31ec43[_0x4a90('0x35')]['hasOwnProperty']('nolimit')){_0x16e41a[_0x4a90('0x20')]=qs['limit'](_0x31ec43[_0x4a90('0x35')][_0x4a90('0x20')]);_0x16e41a[_0x4a90('0x22')]=qs[_0x4a90('0x22')](_0x31ec43[_0x4a90('0x35')][_0x4a90('0x22')]);}_0x16e41a[_0x4a90('0x3b')]=qs[_0x4a90('0x3c')](_0x31ec43[_0x4a90('0x35')][_0x4a90('0x3c')]);_0x16e41a[_0x4a90('0x3d')]=qs[_0x4a90('0x3e')](_[_0x4a90('0x3f')](_0x31ec43[_0x4a90('0x35')],_0x5f0277['filters']),_0x113ec9);if(_0x31ec43[_0x4a90('0x35')]['filter']){_0x16e41a['where']=_[_0x4a90('0x40')](_0x16e41a[_0x4a90('0x3d')],{'$or':_[_0x4a90('0x2f')](_0x113ec9,function(_0x20f774){if(_0x20f774[_0x4a90('0x32')]!==_0x4a90('0x41')){var _0x1fbd9d={};_0x1fbd9d[_0x20f774[_0x4a90('0x2c')]]={'$like':'%'+_0x31ec43[_0x4a90('0x35')][_0x4a90('0x42')]+'%'};return _0x1fbd9d;}})});}_0x16e41a=_[_0x4a90('0x40')]({},_0x16e41a,_0x31ec43['options']);var _0x4b4e3d={'where':_0x16e41a[_0x4a90('0x3d')]};return db[_0x4a90('0x30')]['count'](_0x4b4e3d)[_0x4a90('0x27')](function(_0x47d070){_0x6019b6[_0x4a90('0x21')]=_0x47d070;if(_0x31ec43[_0x4a90('0x35')][_0x4a90('0x43')]){_0x16e41a[_0x4a90('0x44')]=[{'all':!![]}];}return db[_0x4a90('0x30')][_0x4a90('0x45')](_0x16e41a);})[_0x4a90('0x27')](function(_0x47ab4e){_0x6019b6[_0x4a90('0x46')]=_0x47ab4e;return _0x6019b6;})['then'](respondWithFilteredResult(_0x16a053,_0x16e41a))[_0x4a90('0x47')](handleError(_0x16a053,null));};exports[_0x4a90('0x48')]=function(_0x1e0648,_0x56361e){var _0x377bca={'raw':!![],'where':{'id':_0x1e0648[_0x4a90('0x49')]['id']}},_0x4c0a46={};_0x4c0a46[_0x4a90('0x34')]=_['keys'](db['VoiceDialReport'][_0x4a90('0x31')]);_0x4c0a46[_0x4a90('0x35')]=_[_0x4a90('0x36')](_0x1e0648[_0x4a90('0x35')]);_0x4c0a46['filters']=_[_0x4a90('0x38')](_0x4c0a46[_0x4a90('0x34')],_0x4c0a46[_0x4a90('0x35')]);_0x377bca[_0x4a90('0x37')]=_[_0x4a90('0x38')](_0x4c0a46['model'],qs[_0x4a90('0x39')](_0x1e0648['query'][_0x4a90('0x39')]));_0x377bca[_0x4a90('0x37')]=_0x377bca[_0x4a90('0x37')]['length']?_0x377bca[_0x4a90('0x37')]:_0x4c0a46[_0x4a90('0x34')];if(_0x1e0648['query']['includeAll']){_0x377bca[_0x4a90('0x44')]=[{'all':!![]}];}_0x377bca=_[_0x4a90('0x40')]({},_0x377bca,_0x1e0648[_0x4a90('0x4a')]);return db['VoiceDialReport']['find'](_0x377bca)[_0x4a90('0x27')](handleEntityNotFound(_0x56361e,null))[_0x4a90('0x27')](respondWithResult(_0x56361e,null))[_0x4a90('0x47')](handleError(_0x56361e,null));};exports[_0x4a90('0x4b')]=function(_0x589b04,_0x377421){return db[_0x4a90('0x30')][_0x4a90('0x4b')](_0x589b04['body'],{})[_0x4a90('0x27')](respondWithResult(_0x377421,0xc9))[_0x4a90('0x47')](handleError(_0x377421,null));};exports[_0x4a90('0x26')]=function(_0x5c3ff0,_0xce55c1){if(_0x5c3ff0[_0x4a90('0x4c')]['id']){delete _0x5c3ff0['body']['id'];}return db[_0x4a90('0x30')][_0x4a90('0x4d')]({'where':{'id':_0x5c3ff0[_0x4a90('0x49')]['id']}})[_0x4a90('0x27')](handleEntityNotFound(_0xce55c1,null))[_0x4a90('0x27')](saveUpdates(_0x5c3ff0[_0x4a90('0x4c')],null))[_0x4a90('0x27')](respondWithResult(_0xce55c1,null))[_0x4a90('0x47')](handleError(_0xce55c1,null));};exports[_0x4a90('0x28')]=function(_0x417528,_0x2d4149){return db[_0x4a90('0x30')][_0x4a90('0x4d')]({'where':{'id':_0x417528[_0x4a90('0x49')]['id']}})[_0x4a90('0x27')](handleEntityNotFound(_0x2d4149,null))[_0x4a90('0x27')](removeEntity(_0x2d4149,null))[_0x4a90('0x47')](handleError(_0x2d4149,null));};exports[_0x4a90('0x4e')]=function(_0x24ab93,_0x310861){return db[_0x4a90('0x30')]['describe']()[_0x4a90('0x27')](respondWithResult(_0x310861,null))[_0x4a90('0x47')](handleError(_0x310861,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fc50b3c..c989876 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 _0x2856=['moment','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','lodash','util','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2856,0xb2));var _0x6285=function(_0x81a85c,_0x4465da){_0x81a85c=_0x81a85c-0x0;var _0x6c33f3=_0x2856[_0x81a85c];return _0x6c33f3;};'use strict';var _=require(_0x6285('0x0'));var util=require(_0x6285('0x1'));var logger=require(_0x6285('0x2'))(_0x6285('0x3'));var moment=require(_0x6285('0x4'));var BPromise=require(_0x6285('0x5'));var rp=require(_0x6285('0x6'));var fs=require('fs');var path=require(_0x6285('0x7'));var rimraf=require('rimraf');var config=require(_0x6285('0x8'));var attributes=require(_0x6285('0x9'));module[_0x6285('0xa')]=function(_0x3527f3,_0x3d213c){return _0x3527f3['define'](_0x6285('0xb'),attributes,{'tableName':_0x6285('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f16=['util','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash'];(function(_0x5081ca,_0x406330){var _0x3e23d3=function(_0x5c58e7){while(--_0x5c58e7){_0x5081ca['push'](_0x5081ca['shift']());}};_0x3e23d3(++_0x406330);}(_0x0f16,0x192));var _0x60f1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f16[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x60f1('0x0'));var util=require(_0x60f1('0x1'));var logger=require('../../config/logger')(_0x60f1('0x2'));var moment=require(_0x60f1('0x3'));var BPromise=require(_0x60f1('0x4'));var rp=require(_0x60f1('0x5'));var fs=require('fs');var path=require(_0x60f1('0x6'));var rimraf=require(_0x60f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x60f1('0x8'));module[_0x60f1('0x9')]=function(_0x433569,_0x1a6566){return _0x433569[_0x60f1('0xa')](_0x60f1('0xb'),attributes,{'tableName':_0x60f1('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 1279656..974a6b0 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 _0x2a93=['limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes'];(function(_0x2f1f08,_0x158f35){var _0x32f365=function(_0x2cc60e){while(--_0x2cc60e){_0x2f1f08['push'](_0x2f1f08['shift']());}};_0x32f365(++_0x158f35);}(_0x2a93,0x1f0));var _0x32a9=function(_0x56e646,_0x11f6ca){_0x56e646=_0x56e646-0x0;var _0x57c543=_0x2a93[_0x56e646];return _0x57c543;};'use strict';var _=require(_0x32a9('0x0'));var util=require(_0x32a9('0x1'));var moment=require(_0x32a9('0x2'));var BPromise=require(_0x32a9('0x3'));var rs=require(_0x32a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32a9('0x6'))(_0x32a9('0x7'));var config=require(_0x32a9('0x8'));var jayson=require(_0x32a9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30b289,_0x9f5595,_0x24587f){return new BPromise(function(_0x15681f,_0x188c74){return client[_0x32a9('0xa')](_0x30b289,_0x24587f)[_0x32a9('0xb')](function(_0x17e83a){logger[_0x32a9('0xc')](_0x32a9('0xd'),_0x9f5595,_0x32a9('0xe'));logger[_0x32a9('0xf')](_0x32a9('0x10'),_0x9f5595,_0x32a9('0xe'),JSON[_0x32a9('0x11')](_0x17e83a));if(_0x17e83a[_0x32a9('0x12')]){if(_0x17e83a['error'][_0x32a9('0x13')]===0x1f4){logger[_0x32a9('0x12')](_0x32a9('0xd'),_0x9f5595,_0x17e83a[_0x32a9('0x12')][_0x32a9('0x14')]);return _0x188c74(_0x17e83a[_0x32a9('0x12')][_0x32a9('0x14')]);}logger[_0x32a9('0x12')](_0x32a9('0xd'),_0x9f5595,_0x17e83a[_0x32a9('0x12')][_0x32a9('0x14')]);return _0x15681f(_0x17e83a[_0x32a9('0x12')][_0x32a9('0x14')]);}else{logger[_0x32a9('0xc')](_0x32a9('0xd'),_0x9f5595,_0x32a9('0xe'));_0x15681f(_0x17e83a[_0x32a9('0x15')][_0x32a9('0x14')]);}})[_0x32a9('0x16')](function(_0x13380a){logger[_0x32a9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x9f5595,_0x13380a);_0x188c74(_0x13380a);});});}exports[_0x32a9('0x17')]=function(_0x19fab2){var _0xd0bc5d=this;return new Promise(function(_0x19bbf5,_0x3f630f){return db['VoiceDialReport']['create'](_0x19fab2[_0x32a9('0x18')],{'raw':_0x19fab2[_0x32a9('0x19')]?_0x19fab2['options'][_0x32a9('0x1a')]===undefined?!![]:![]:!![]})[_0x32a9('0xb')](function(_0x4cb037){logger[_0x32a9('0xc')](_0x32a9('0x17'),_0x19fab2);logger[_0x32a9('0xf')](_0x32a9('0x17'),_0x19fab2,JSON[_0x32a9('0x11')](_0x4cb037));_0x19bbf5(_0x4cb037);})[_0x32a9('0x16')](function(_0x8963fa){logger[_0x32a9('0x12')](_0x32a9('0x17'),_0x8963fa['message'],_0x19fab2);_0x3f630f(_0xd0bc5d['error'](0x1f4,_0x8963fa[_0x32a9('0x14')]));});});};exports[_0x32a9('0x1b')]=function(_0x3723c1){var _0x3be0be=this;return new Promise(function(_0x331280,_0x4419f4){return db[_0x32a9('0x1c')][_0x32a9('0x1d')](_0x3723c1[_0x32a9('0x18')],{'raw':_0x3723c1[_0x32a9('0x19')]?_0x3723c1[_0x32a9('0x19')][_0x32a9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3723c1['options']?_0x3723c1[_0x32a9('0x19')][_0x32a9('0x1e')]||null:null,'attributes':_0x3723c1['options']?_0x3723c1[_0x32a9('0x19')][_0x32a9('0x1f')]||null:null,'limit':_0x3723c1['options']?_0x3723c1['options'][_0x32a9('0x20')]||null:null})[_0x32a9('0xb')](function(_0x8bc67d){logger['info'](_0x32a9('0x1b'),_0x3723c1);logger[_0x32a9('0xf')](_0x32a9('0x1b'),_0x3723c1,JSON[_0x32a9('0x11')](_0x8bc67d));_0x331280(_0x8bc67d);})[_0x32a9('0x16')](function(_0x51eafc){logger['error'](_0x32a9('0x1b'),_0x51eafc[_0x32a9('0x14')],_0x3723c1);_0x4419f4(_0x3be0be[_0x32a9('0x12')](0x1f4,_0x51eafc[_0x32a9('0x14')]));});});}; \ No newline at end of file +var _0x8a28=['http','request','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceDialReport,\x20%s,\x20%s','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','catch','body','attributes','limit','UpdateVoiceDialReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x2d4bed,_0xc025e2){var _0x334bd4=function(_0x100810){while(--_0x100810){_0x2d4bed['push'](_0x2d4bed['shift']());}};_0x334bd4(++_0xc025e2);}(_0x8a28,0x177));var _0x88a2=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x8a28[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x88a2('0x2'));var fs=require('fs');var Redis=require(_0x88a2('0x3'));var db=require(_0x88a2('0x4'))['db'];var utils=require(_0x88a2('0x5'));var logger=require('../../config/logger')(_0x88a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x88a2('0x7'));var client=jayson[_0x88a2('0x8')][_0x88a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bab81,_0x503f05,_0x5c30db){return new BPromise(function(_0x5c88c6,_0x17744e){return client[_0x88a2('0xa')](_0x3bab81,_0x5c30db)[_0x88a2('0xb')](function(_0x279263){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x503f05,_0x88a2('0xc'));logger[_0x88a2('0xd')](_0x88a2('0xe'),_0x503f05,_0x88a2('0xc'),JSON[_0x88a2('0xf')](_0x279263));if(_0x279263['error']){if(_0x279263['error'][_0x88a2('0x10')]===0x1f4){logger[_0x88a2('0x11')](_0x88a2('0x12'),_0x503f05,_0x279263[_0x88a2('0x11')][_0x88a2('0x13')]);return _0x17744e(_0x279263['error'][_0x88a2('0x13')]);}logger[_0x88a2('0x11')](_0x88a2('0x12'),_0x503f05,_0x279263[_0x88a2('0x11')][_0x88a2('0x13')]);return _0x5c88c6(_0x279263[_0x88a2('0x11')][_0x88a2('0x13')]);}else{logger[_0x88a2('0x14')](_0x88a2('0x12'),_0x503f05,_0x88a2('0xc'));_0x5c88c6(_0x279263[_0x88a2('0x15')][_0x88a2('0x13')]);}})['catch'](function(_0x456a09){logger[_0x88a2('0x11')](_0x88a2('0x12'),_0x503f05,_0x456a09);_0x17744e(_0x456a09);});});}exports[_0x88a2('0x16')]=function(_0x55ee07){var _0x4f6f1d=this;return new Promise(function(_0x27b25b,_0x2ca13f){return db[_0x88a2('0x17')][_0x88a2('0x18')](_0x55ee07['body'],{'raw':_0x55ee07[_0x88a2('0x19')]?_0x55ee07[_0x88a2('0x19')][_0x88a2('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4354dc){logger['info']('CreateVoiceDialReport',_0x55ee07);logger[_0x88a2('0xd')](_0x88a2('0x16'),_0x55ee07,JSON['stringify'](_0x4354dc));_0x27b25b(_0x4354dc);})[_0x88a2('0x1b')](function(_0x1f1f9d){logger[_0x88a2('0x11')](_0x88a2('0x16'),_0x1f1f9d[_0x88a2('0x13')],_0x55ee07);_0x2ca13f(_0x4f6f1d[_0x88a2('0x11')](0x1f4,_0x1f1f9d[_0x88a2('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x1a7be7){var _0x113b79=this;return new Promise(function(_0x31fa5c,_0x2d3436){return db[_0x88a2('0x17')]['update'](_0x1a7be7[_0x88a2('0x1c')],{'raw':_0x1a7be7['options']?_0x1a7be7[_0x88a2('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a7be7[_0x88a2('0x19')]?_0x1a7be7[_0x88a2('0x19')]['where']||null:null,'attributes':_0x1a7be7[_0x88a2('0x19')]?_0x1a7be7[_0x88a2('0x19')][_0x88a2('0x1d')]||null:null,'limit':_0x1a7be7[_0x88a2('0x19')]?_0x1a7be7['options'][_0x88a2('0x1e')]||null:null})[_0x88a2('0xb')](function(_0x29e66f){logger[_0x88a2('0x14')](_0x88a2('0x1f'),_0x1a7be7);logger[_0x88a2('0xd')](_0x88a2('0x1f'),_0x1a7be7,JSON[_0x88a2('0xf')](_0x29e66f));_0x31fa5c(_0x29e66f);})[_0x88a2('0x1b')](function(_0x29d825){logger[_0x88a2('0x11')](_0x88a2('0x1f'),_0x29d825['message'],_0x1a7be7);_0x2d3436(_0x113b79[_0x88a2('0x11')](0x1f4,_0x29d825['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 356e136..526860b 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 _0xc9b1=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','addApplications','put','update','destroy','exports','multer'];(function(_0x2f6904,_0x4f8b5b){var _0xc53ecf=function(_0x4a4ded){while(--_0x4a4ded){_0x2f6904['push'](_0x2f6904['shift']());}};_0xc53ecf(++_0x4f8b5b);}(_0xc9b1,0x7d));var _0x1c9b=function(_0x3d984b,_0x46ced9){_0x3d984b=_0x3d984b-0x0;var _0xe6969d=_0xc9b1[_0x3d984b];return _0xe6969d;};'use strict';var multer=require(_0x1c9b('0x0'));var util=require(_0x1c9b('0x1'));var path=require('path');var timeout=require(_0x1c9b('0x2'));var express=require('express');var router=express[_0x1c9b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1c9b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1c9b('0x5'));var controller=require(_0x1c9b('0x6'));router[_0x1c9b('0x7')]('/',auth[_0x1c9b('0x8')](),controller['index']);router[_0x1c9b('0x7')](_0x1c9b('0x9'),auth[_0x1c9b('0x8')](),controller[_0x1c9b('0xa')]);router[_0x1c9b('0xb')]('/',auth[_0x1c9b('0x8')](),controller[_0x1c9b('0xc')]);router[_0x1c9b('0xb')]('/:id/applications',auth[_0x1c9b('0x8')](),controller[_0x1c9b('0xd')]);router[_0x1c9b('0xe')](_0x1c9b('0x9'),auth[_0x1c9b('0x8')](),controller[_0x1c9b('0xf')]);router['delete'](_0x1c9b('0x9'),auth[_0x1c9b('0x8')](),controller[_0x1c9b('0x10')]);module[_0x1c9b('0x11')]=router; \ No newline at end of file +var _0x4608=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','addApplications','put'];(function(_0x4764cd,_0x36f5f0){var _0x141daf=function(_0x39c4a2){while(--_0x39c4a2){_0x4764cd['push'](_0x4764cd['shift']());}};_0x141daf(++_0x36f5f0);}(_0x4608,0x10e));var _0x8460=function(_0x596216,_0x39b0c4){_0x596216=_0x596216-0x0;var _0x4bbf34=_0x4608[_0x596216];return _0x4bbf34;};'use strict';var multer=require(_0x8460('0x0'));var util=require(_0x8460('0x1'));var path=require(_0x8460('0x2'));var timeout=require('connect-timeout');var express=require(_0x8460('0x3'));var router=express[_0x8460('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8460('0x5'));var config=require(_0x8460('0x6'));var controller=require('./voiceExtension.controller');router[_0x8460('0x7')]('/',auth[_0x8460('0x8')](),controller[_0x8460('0x9')]);router[_0x8460('0x7')](_0x8460('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8460('0xb')]('/',auth[_0x8460('0x8')](),controller[_0x8460('0xc')]);router[_0x8460('0xb')]('/:id/applications',auth[_0x8460('0x8')](),controller[_0x8460('0xd')]);router[_0x8460('0xe')](_0x8460('0xa'),auth[_0x8460('0x8')](),controller[_0x8460('0xf')]);router[_0x8460('0x10')]('/:id',auth[_0x8460('0x8')](),controller[_0x8460('0x11')]);module[_0x8460('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d064f2f..f28b445 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 _0xaaa5=['outbound','internal','inbound-fax','outbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM'];(function(_0x30ba3d,_0xab3e0c){var _0x47803d=function(_0x321972){while(--_0x321972){_0x30ba3d['push'](_0x30ba3d['shift']());}};_0x47803d(++_0xab3e0c);}(_0xaaa5,0x16a));var _0x5aaa=function(_0x1ed3fe,_0x36f04d){_0x1ed3fe=_0x1ed3fe-0x0;var _0x5225d7=_0xaaa5[_0x1ed3fe];return _0x5225d7;};'use strict';var Sequelize=require(_0x5aaa('0x0'));module[_0x5aaa('0x1')]={'context':{'type':Sequelize[_0x5aaa('0x2')],'allowNull':![],'unique':_0x5aaa('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5aaa('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5aaa('0x2')],'allowNull':![],'defaultValue':_0x5aaa('0x4')},'appdata':{'type':Sequelize[_0x5aaa('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5aaa('0x5')]('inbound',_0x5aaa('0x6'),_0x5aaa('0x7'),_0x5aaa('0x8'),_0x5aaa('0x9'),_0x5aaa('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x5aaa('0x2')]},'interval':{'type':Sequelize[_0x5aaa('0x2')],'allowNull':![],'defaultValue':_0x5aaa('0xb')},'IntervalId':{'type':Sequelize[_0x5aaa('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5aaa('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x5aaa('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5aaa('0xc')]},'recordingFormat':{'type':Sequelize[_0x5aaa('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x5aaa('0xe')],'get':function(_0x190a86){return this['getDataValue'](_0x5aaa('0xf'));}},'alias':{'type':Sequelize[_0x5aaa('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x015c=['STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','any','*,*,*,*','wav','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize'];(function(_0x2102cb,_0x49ee37){var _0x4e5a7f=function(_0xa47ee0){while(--_0xa47ee0){_0x2102cb['push'](_0x2102cb['shift']());}};_0x4e5a7f(++_0x49ee37);}(_0x015c,0xa4));var _0xc015=function(_0x3c3893,_0x740f8){_0x3c3893=_0x3c3893-0x0;var _0x8c891c=_0x015c[_0x3c3893];return _0x8c891c;};'use strict';var Sequelize=require(_0xc015('0x0'));module['exports']={'context':{'type':Sequelize[_0xc015('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc015('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xc015('0x2')},'tag':{'type':Sequelize[_0xc015('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc015('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc015('0x3')](_0xc015('0x4'),_0xc015('0x5'),_0xc015('0x6'),'inbound-fax',_0xc015('0x7'),'system',_0xc015('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xc015('0x1')]},'interval':{'type':Sequelize[_0xc015('0x1')],'allowNull':![],'defaultValue':_0xc015('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc015('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc015('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xc015('0x1')],'defaultValue':_0xc015('0xa')},'answer':{'type':Sequelize[_0xc015('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc015('0xc')],'get':function(_0x5881ab){return this[_0xc015('0xd')](_0xc015('0xe'));}},'alias':{'type':Sequelize[_0xc015('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 32ad004..c9a4725 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 _0xbc9b=['destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','value','includes','type','find','name','then','stack','send','index','map','VoiceExtension','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','keys','include','params','create','body','concat','exten','role','inbound','UserProfileSection','autoAssociation','UserProfileResource','error','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x173479,_0x237f88){var _0xdc2ed6=function(_0x4e93af){while(--_0x4e93af){_0x173479['push'](_0x173479['shift']());}};_0xdc2ed6(++_0x237f88);}(_0xbc9b,0x1b2));var _0xbbc9=function(_0xaf1fb2,_0x46c137){_0xaf1fb2=_0xaf1fb2-0x0;var _0x4024cc=_0xbc9b[_0xaf1fb2];return _0x4024cc;};'use strict';var _=require('lodash');var Redis=require(_0xbbc9('0x0'));var qs=require(_0xbbc9('0x1'));var logger=require(_0xbbc9('0x2'))(_0xbbc9('0x3'));var config=require(_0xbbc9('0x4'));var db=require(_0xbbc9('0x5'))['db'];config[_0xbbc9('0x6')]=_[_0xbbc9('0x7')](config[_0xbbc9('0x6')],{'host':_0xbbc9('0x8'),'port':0x18eb});var socket=require(_0xbbc9('0x9'))(new Redis(config[_0xbbc9('0x6')]));require(_0xbbc9('0xa'))['register'](socket);function respondWithStatusCode(_0x3f1da4,_0x4a4b1f){_0x4a4b1f=_0x4a4b1f||0xcc;return function(_0x5d5f6c){if(_0x5d5f6c){return _0x3f1da4[_0xbbc9('0xb')](_0x4a4b1f);}return _0x3f1da4[_0xbbc9('0xc')](_0x4a4b1f)[_0xbbc9('0xd')]();};}function respondWithResult(_0x5268b9,_0x34806d){_0x34806d=_0x34806d||0xc8;return function(_0xfb6f50){if(_0xfb6f50){return _0x5268b9[_0xbbc9('0xc')](_0x34806d)[_0xbbc9('0xe')](_0xfb6f50);}};}function respondWithFilteredResult(_0x36f58f,_0x14c621){return function(_0xd5cbb){if(_0xd5cbb){var _0x1edc95=typeof _0x14c621[_0xbbc9('0xf')]==='undefined'&&typeof _0x14c621[_0xbbc9('0x10')]===_0xbbc9('0x11');var _0x4cc09c=_0xd5cbb[_0xbbc9('0x12')];var _0x6c6266=_0x1edc95?0x0:_0x14c621['offset'];var _0x50cd70=_0x1edc95?_0xd5cbb[_0xbbc9('0x12')]:_0x14c621[_0xbbc9('0xf')]+_0x14c621[_0xbbc9('0x10')];var _0xe1c8fe;if(_0x50cd70>=_0x4cc09c){_0x50cd70=_0x4cc09c;_0xe1c8fe=0xc8;}else{_0xe1c8fe=0xce;}_0x36f58f[_0xbbc9('0xc')](_0xe1c8fe);return _0x36f58f[_0xbbc9('0x13')](_0xbbc9('0x14'),_0x6c6266+'-'+_0x50cd70+'/'+_0x4cc09c)['json'](_0xd5cbb);}return null;};}function removeEntity(_0x5bf84e){return function(_0x2bc938){if(_0x2bc938){return _0x2bc938[_0xbbc9('0x15')]()['then'](function(){var _0x590535=_0x2bc938[_0xbbc9('0x16')]({'plain':!![]});var _0x12ee35=[{'name':_0xbbc9('0x17'),'value':'inbound','ignore':![]},{'name':_0xbbc9('0x18'),'value':_0xbbc9('0x19'),'ignore':![]},{'name':_0xbbc9('0x1a'),'value':_0xbbc9('0x1b'),'ignore':![]}];var _0x5c1123=_(_0x12ee35)['filter']('ignore')['map']('value')[_0xbbc9('0x1c')]();if(_[_0xbbc9('0x1d')](_0x5c1123,_0x590535[_0xbbc9('0x1e')])){return;}var _0xbc0870=_[_0xbbc9('0x1f')](_0x12ee35,[_0xbbc9('0x1c'),_0x590535[_0xbbc9('0x1e')]])[_0xbbc9('0x20')];return db['UserProfileResource'][_0xbbc9('0x15')]({'where':{'type':_0xbc0870,'resourceId':_0x590535['id']}})[_0xbbc9('0x21')](function(){return _0x2bc938;});})['then'](function(){_0x5bf84e[_0xbbc9('0xc')](0xcc)[_0xbbc9('0xd')]();});}};}function handleEntityNotFound(_0x60a8c5){return function(_0x3e7636){if(!_0x3e7636){_0x60a8c5[_0xbbc9('0xb')](0x194);}return _0x3e7636;};}function handleError(_0x13854e,_0x539c29){_0x539c29=_0x539c29||0x1f4;return function(_0xaeaab5){logger['error'](_0xaeaab5[_0xbbc9('0x22')]);if(_0xaeaab5[_0xbbc9('0x20')]){delete _0xaeaab5[_0xbbc9('0x20')];}_0x13854e[_0xbbc9('0xc')](_0x539c29)[_0xbbc9('0x23')](_0xaeaab5);};}exports[_0xbbc9('0x24')]=function(_0x59c219,_0x2d23c8){var _0x44abed={},_0x584457={},_0x3e039d={'count':0x0,'rows':[]};var _0x34f0ca=_[_0xbbc9('0x25')](db[_0xbbc9('0x26')][_0xbbc9('0x27')],function(_0x2529af){return{'name':_0x2529af['fieldName'],'type':_0x2529af[_0xbbc9('0x1e')]['key']};});_0x584457[_0xbbc9('0x28')]=_[_0xbbc9('0x25')](_0x34f0ca,_0xbbc9('0x20'));_0x584457[_0xbbc9('0x29')]=_['keys'](_0x59c219[_0xbbc9('0x29')]);_0x584457[_0xbbc9('0x2a')]=_[_0xbbc9('0x2b')](_0x584457[_0xbbc9('0x28')],_0x584457['query']);_0x44abed[_0xbbc9('0x2c')]=_[_0xbbc9('0x2b')](_0x584457[_0xbbc9('0x28')],qs[_0xbbc9('0x2d')](_0x59c219[_0xbbc9('0x29')][_0xbbc9('0x2d')]));_0x44abed[_0xbbc9('0x2c')]=_0x44abed[_0xbbc9('0x2c')][_0xbbc9('0x2e')]?_0x44abed['attributes']:_0x584457['model'];if(!_0x59c219['query']['hasOwnProperty'](_0xbbc9('0x2f'))){_0x44abed[_0xbbc9('0x10')]=qs[_0xbbc9('0x10')](_0x59c219[_0xbbc9('0x29')][_0xbbc9('0x10')]);_0x44abed[_0xbbc9('0xf')]=qs[_0xbbc9('0xf')](_0x59c219[_0xbbc9('0x29')][_0xbbc9('0xf')]);}_0x44abed[_0xbbc9('0x30')]=qs['sort'](_0x59c219[_0xbbc9('0x29')][_0xbbc9('0x31')]);_0x44abed[_0xbbc9('0x32')]=qs['filters'](_[_0xbbc9('0x33')](_0x59c219['query'],_0x584457[_0xbbc9('0x2a')]),_0x34f0ca);if(_0x59c219[_0xbbc9('0x29')][_0xbbc9('0x34')]){_0x44abed[_0xbbc9('0x32')]=_['merge'](_0x44abed[_0xbbc9('0x32')],{'$or':_[_0xbbc9('0x25')](_0x34f0ca,function(_0x37efc1){if(_0x37efc1['type']!==_0xbbc9('0x35')){var _0x4505d8={};_0x4505d8[_0x37efc1['name']]={'$like':'%'+_0x59c219[_0xbbc9('0x29')]['filter']+'%'};return _0x4505d8;}})});}_0x44abed=_[_0xbbc9('0x36')]({},_0x44abed,_0x59c219[_0xbbc9('0x37')]);var _0x31303e={'where':_0x44abed['where']};return db[_0xbbc9('0x26')][_0xbbc9('0x12')](_0x31303e)[_0xbbc9('0x21')](function(_0x49cd08){_0x3e039d[_0xbbc9('0x12')]=_0x49cd08;if(_0x59c219[_0xbbc9('0x29')][_0xbbc9('0x38')]){_0x44abed['include']=[{'all':!![]}];}return db[_0xbbc9('0x26')]['findAll'](_0x44abed);})[_0xbbc9('0x21')](function(_0x3e9d18){_0x3e039d[_0xbbc9('0x39')]=_0x3e9d18;return _0x3e039d;})[_0xbbc9('0x21')](respondWithFilteredResult(_0x2d23c8,_0x44abed))[_0xbbc9('0x3a')](handleError(_0x2d23c8,null));};exports[_0xbbc9('0x3b')]=function(_0xa4e068,_0x2904f6){var _0x1cd575={'raw':![],'where':{'id':_0xa4e068['params']['id']}},_0x3871a1={};_0x3871a1[_0xbbc9('0x28')]=_[_0xbbc9('0x3c')](db[_0xbbc9('0x26')]['rawAttributes']);_0x3871a1[_0xbbc9('0x29')]=_[_0xbbc9('0x3c')](_0xa4e068[_0xbbc9('0x29')]);_0x3871a1[_0xbbc9('0x2a')]=_['intersection'](_0x3871a1[_0xbbc9('0x28')],_0x3871a1[_0xbbc9('0x29')]);_0x1cd575['attributes']=_[_0xbbc9('0x2b')](_0x3871a1['model'],qs[_0xbbc9('0x2d')](_0xa4e068[_0xbbc9('0x29')][_0xbbc9('0x2d')]));_0x1cd575[_0xbbc9('0x2c')]=_0x1cd575[_0xbbc9('0x2c')]['length']?_0x1cd575[_0xbbc9('0x2c')]:_0x3871a1[_0xbbc9('0x28')];if(_0xa4e068[_0xbbc9('0x29')][_0xbbc9('0x38')]){_0x1cd575[_0xbbc9('0x3d')]=[{'all':!![]}];}_0x1cd575=_[_0xbbc9('0x36')]({},_0x1cd575,_0xa4e068[_0xbbc9('0x37')]);return db[_0xbbc9('0x26')][_0xbbc9('0x1f')](_0x1cd575)[_0xbbc9('0x21')](handleEntityNotFound(_0x2904f6,null))[_0xbbc9('0x21')](respondWithResult(_0x2904f6,null))['catch'](handleError(_0x2904f6,null));};exports[_0xbbc9('0x15')]=function(_0x4e1f33,_0x417b6c){return db[_0xbbc9('0x26')][_0xbbc9('0x1f')]({'where':{'id':_0x4e1f33[_0xbbc9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x417b6c,null))['then'](removeEntity(_0x417b6c,null))['catch'](handleError(_0x417b6c,null));};exports[_0xbbc9('0x3f')]=function(_0x4f9e7a,_0x2e1d57){if(_0x4f9e7a[_0xbbc9('0x40')][_0xbbc9('0x1e')]===_0xbbc9('0x19')&&!_['startsWith'](_0x4f9e7a[_0xbbc9('0x40')]['exten'],'_')){_0x4f9e7a[_0xbbc9('0x40')]['exten']='_'[_0xbbc9('0x41')](_0x4f9e7a[_0xbbc9('0x40')][_0xbbc9('0x42')]);}return db[_0xbbc9('0x26')]['create'](_0x4f9e7a[_0xbbc9('0x40')],{'raw':![]})[_0xbbc9('0x21')](function(_0x38d96f){var _0x18330a=_0x4f9e7a['user'][_0xbbc9('0x16')]({'plain':!![]});if(!_0x18330a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18330a[_0xbbc9('0x43')]==='user'){var _0x2a492b=_0x38d96f[_0xbbc9('0x16')]({'plain':!![]});var _0x187f0a=[{'name':_0xbbc9('0x17'),'value':_0xbbc9('0x44')},{'name':_0xbbc9('0x18'),'value':_0xbbc9('0x19')},{'name':'InternalRoutes','value':'internal'}];var _0x286f1e=_[_0xbbc9('0x1f')](_0x187f0a,[_0xbbc9('0x1c'),_0x2a492b[_0xbbc9('0x1e')]])[_0xbbc9('0x20')];return db[_0xbbc9('0x45')][_0xbbc9('0x1f')]({'where':{'name':_0x286f1e,'userProfileId':_0x18330a['userProfileId']},'raw':!![]})[_0xbbc9('0x21')](function(_0x4e1286){if(_0x4e1286&&_0x4e1286[_0xbbc9('0x46')]===0x0){return db[_0xbbc9('0x47')]['create']({'name':_0x2a492b[_0xbbc9('0x20')],'resourceId':_0x2a492b['id'],'type':_0x4e1286[_0xbbc9('0x20')],'sectionId':_0x4e1286['id']},{})[_0xbbc9('0x21')](function(){return _0x38d96f;});}else{return _0x38d96f;}})[_0xbbc9('0x3a')](function(_0x41f8fa){logger[_0xbbc9('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41f8fa);throw _0x41f8fa;});}return _0x38d96f;})[_0xbbc9('0x21')](respondWithResult(_0x2e1d57,0xc9))['catch'](handleError(_0x2e1d57,null));};exports['update']=function(_0x4d4156,_0x5d71e8){if(_0x4d4156[_0xbbc9('0x40')]['id']){delete _0x4d4156['body']['id'];}return db[_0xbbc9('0x26')][_0xbbc9('0x1f')]({'where':{'id':_0x4d4156[_0xbbc9('0x3e')]['id']}})[_0xbbc9('0x21')](handleEntityNotFound(_0x5d71e8,null))['then'](function(_0x248220){if(_0x248220){return db['VoiceExtension'][_0xbbc9('0x49')](_[_0xbbc9('0x33')](_0x4d4156[_0xbbc9('0x40')],['exten',_0xbbc9('0x4a'),_0xbbc9('0x4b'),_0xbbc9('0x4c'),_0xbbc9('0x4d'),_0xbbc9('0x4e'),_0xbbc9('0x4f')]),{'where':{'context':_0x248220[_0xbbc9('0x4a')],'exten':_0x248220['exten']},'individualHooks':!![]})[_0xbbc9('0x21')](function(_0x2a8c31){return _0x2a8c31;});}return null;})[_0xbbc9('0x21')](respondWithStatusCode(_0x5d71e8,null))[_0xbbc9('0x3a')](handleError(_0x5d71e8,null));};exports[_0xbbc9('0x50')]=function(_0x508d66,_0x4e6790){var _0xcc1dcf=_0x508d66[_0xbbc9('0x3e')]['id'];var _0x5255c3=_0x508d66['body'];var _0x26e4fa=0xc8;var _0x77cbcd=null;return db['sequelize'][_0xbbc9('0x51')]({'isolationLevel':db[_0xbbc9('0x52')][_0xbbc9('0x53')][_0xbbc9('0x54')]['READ_COMMITTED']},function(_0x12f8ba){return db['VoiceExtension'][_0xbbc9('0x55')]({'where':{'id':_0xcc1dcf},'transaction':_0x12f8ba})['then'](function(_0xb68268){if(_0xb68268){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0xcc1dcf},'transaction':_0x12f8ba})[_0xbbc9('0x21')](function(){var _0x4e96cd=_[_0xbbc9('0x25')](_0x5255c3,function(_0x31cccb){_0x31cccb['VoiceExtensionId']=_0xcc1dcf;_0x31cccb[_0xbbc9('0x56')]=!![];return _0x31cccb;});return _0xb68268['createRouting'](_0x4e96cd);})[_0xbbc9('0x21')](function(_0x1f929a){return db[_0xbbc9('0x26')][_0xbbc9('0x57')](_0x1f929a,{'transaction':_0x12f8ba});});}else{_0x26e4fa=0x194;_0x77cbcd=[];}});})['then'](function(){if(_0x26e4fa!==0x194){return db[_0xbbc9('0x26')][_0xbbc9('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0xcc1dcf},'order':_0xbbc9('0x59')})[_0xbbc9('0x21')](function(_0x24c9c1){_0x77cbcd=_0x24c9c1;});}})['catch'](function(_0x4187f8){_0x26e4fa=0x1f4;logger[_0xbbc9('0x48')](_0x4187f8[_0xbbc9('0x22')]);if(_0x4187f8[_0xbbc9('0x20')]){delete _0x4187f8[_0xbbc9('0x20')];}_0x77cbcd=_0x4187f8;})[_0xbbc9('0x5a')](function(){if(_0x77cbcd===null){_0x4e6790[_0xbbc9('0xb')](_0x26e4fa);}else{if(_0x26e4fa===0x1f4){_0x4e6790['status'](_0x26e4fa)[_0xbbc9('0x23')](_0x77cbcd);}else{_0x4e6790[_0xbbc9('0xc')](_0x26e4fa)[_0xbbc9('0xe')](_0x77cbcd);}}});}; \ No newline at end of file +var _0xad1d=['error','send','VoiceExtension','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','params','fields','catch','create','body','exten','concat','user','get','role','inbound','UserProfileSection','userProfileId','autoAssociation','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','bulkCreate','finally','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','destroy','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','then'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xad1d,0x180));var _0xdad1=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xad1d[_0x377a6e];return _0x37f751;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xdad1('0x0'));var logger=require(_0xdad1('0x1'))(_0xdad1('0x2'));var config=require(_0xdad1('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xdad1('0x4')](config['redis'],{'host':_0xdad1('0x5'),'port':0x18eb});var socket=require(_0xdad1('0x6'))(new Redis(config['redis']));require(_0xdad1('0x7'))[_0xdad1('0x8')](socket);function respondWithStatusCode(_0xa2573d,_0x474f07){_0x474f07=_0x474f07||0xcc;return function(_0x20aabf){if(_0x20aabf){return _0xa2573d[_0xdad1('0x9')](_0x474f07);}return _0xa2573d['status'](_0x474f07)[_0xdad1('0xa')]();};}function respondWithResult(_0x5ed2c3,_0x48b7b8){_0x48b7b8=_0x48b7b8||0xc8;return function(_0x328593){if(_0x328593){return _0x5ed2c3[_0xdad1('0xb')](_0x48b7b8)[_0xdad1('0xc')](_0x328593);}};}function respondWithFilteredResult(_0x1fabfa,_0x4b9097){return function(_0x3a4e2b){if(_0x3a4e2b){var _0x57281e=typeof _0x4b9097[_0xdad1('0xd')]===_0xdad1('0xe')&&typeof _0x4b9097[_0xdad1('0xf')]===_0xdad1('0xe');var _0x2e6dc2=_0x3a4e2b[_0xdad1('0x10')];var _0x4dfaeb=_0x57281e?0x0:_0x4b9097[_0xdad1('0xd')];var _0x170464=_0x57281e?_0x3a4e2b[_0xdad1('0x10')]:_0x4b9097[_0xdad1('0xd')]+_0x4b9097['limit'];var _0x12b908;if(_0x170464>=_0x2e6dc2){_0x170464=_0x2e6dc2;_0x12b908=0xc8;}else{_0x12b908=0xce;}_0x1fabfa[_0xdad1('0xb')](_0x12b908);return _0x1fabfa['set']('Content-Range',_0x4dfaeb+'-'+_0x170464+'/'+_0x2e6dc2)[_0xdad1('0xc')](_0x3a4e2b);}return null;};}function removeEntity(_0x15e3c1){return function(_0x73f31e){if(_0x73f31e){return _0x73f31e[_0xdad1('0x11')]()['then'](function(){var _0x311299=_0x73f31e['get']({'plain':!![]});var _0xece4a0=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xdad1('0x12'),'value':_0xdad1('0x13'),'ignore':![]},{'name':_0xdad1('0x14'),'value':_0xdad1('0x15'),'ignore':![]}];var _0x4e70d7=_(_0xece4a0)['filter'](_0xdad1('0x16'))[_0xdad1('0x17')]('value')[_0xdad1('0x18')]();if(_[_0xdad1('0x19')](_0x4e70d7,_0x311299[_0xdad1('0x1a')])){return;}var _0x1ca385=_[_0xdad1('0x1b')](_0xece4a0,[_0xdad1('0x18'),_0x311299[_0xdad1('0x1a')]])[_0xdad1('0x1c')];return db[_0xdad1('0x1d')]['destroy']({'where':{'type':_0x1ca385,'resourceId':_0x311299['id']}})[_0xdad1('0x1e')](function(){return _0x73f31e;});})[_0xdad1('0x1e')](function(){_0x15e3c1[_0xdad1('0xb')](0xcc)[_0xdad1('0xa')]();});}};}function handleEntityNotFound(_0x33db7a){return function(_0x1819b1){if(!_0x1819b1){_0x33db7a[_0xdad1('0x9')](0x194);}return _0x1819b1;};}function handleError(_0x8d5ab7,_0x477671){_0x477671=_0x477671||0x1f4;return function(_0x55f7d6){logger[_0xdad1('0x1f')](_0x55f7d6['stack']);if(_0x55f7d6[_0xdad1('0x1c')]){delete _0x55f7d6[_0xdad1('0x1c')];}_0x8d5ab7[_0xdad1('0xb')](_0x477671)[_0xdad1('0x20')](_0x55f7d6);};}exports['index']=function(_0x365d5c,_0x20b68b){var _0x51e703={},_0x5584ef={},_0xaa440e={'count':0x0,'rows':[]};var _0x2d3193=_[_0xdad1('0x17')](db[_0xdad1('0x21')][_0xdad1('0x22')],function(_0x1be0df){return{'name':_0x1be0df[_0xdad1('0x23')],'type':_0x1be0df[_0xdad1('0x1a')]['key']};});_0x5584ef[_0xdad1('0x24')]=_[_0xdad1('0x17')](_0x2d3193,_0xdad1('0x1c'));_0x5584ef['query']=_[_0xdad1('0x25')](_0x365d5c['query']);_0x5584ef[_0xdad1('0x26')]=_[_0xdad1('0x27')](_0x5584ef[_0xdad1('0x24')],_0x5584ef[_0xdad1('0x28')]);_0x51e703[_0xdad1('0x29')]=_[_0xdad1('0x27')](_0x5584ef[_0xdad1('0x24')],qs['fields'](_0x365d5c['query']['fields']));_0x51e703['attributes']=_0x51e703[_0xdad1('0x29')][_0xdad1('0x2a')]?_0x51e703[_0xdad1('0x29')]:_0x5584ef[_0xdad1('0x24')];if(!_0x365d5c[_0xdad1('0x28')][_0xdad1('0x2b')](_0xdad1('0x2c'))){_0x51e703['limit']=qs[_0xdad1('0xf')](_0x365d5c['query'][_0xdad1('0xf')]);_0x51e703[_0xdad1('0xd')]=qs['offset'](_0x365d5c[_0xdad1('0x28')]['offset']);}_0x51e703[_0xdad1('0x2d')]=qs[_0xdad1('0x2e')](_0x365d5c['query']['sort']);_0x51e703['where']=qs[_0xdad1('0x26')](_[_0xdad1('0x2f')](_0x365d5c[_0xdad1('0x28')],_0x5584ef[_0xdad1('0x26')]),_0x2d3193);if(_0x365d5c[_0xdad1('0x28')]['filter']){_0x51e703[_0xdad1('0x30')]=_[_0xdad1('0x31')](_0x51e703['where'],{'$or':_['map'](_0x2d3193,function(_0x108a83){if(_0x108a83[_0xdad1('0x1a')]!==_0xdad1('0x32')){var _0x2f6287={};_0x2f6287[_0x108a83[_0xdad1('0x1c')]]={'$like':'%'+_0x365d5c[_0xdad1('0x28')][_0xdad1('0x33')]+'%'};return _0x2f6287;}})});}_0x51e703=_[_0xdad1('0x31')]({},_0x51e703,_0x365d5c[_0xdad1('0x34')]);var _0x250c49={'where':_0x51e703[_0xdad1('0x30')]};return db[_0xdad1('0x21')]['count'](_0x250c49)[_0xdad1('0x1e')](function(_0x371f91){_0xaa440e[_0xdad1('0x10')]=_0x371f91;if(_0x365d5c[_0xdad1('0x28')][_0xdad1('0x35')]){_0x51e703['include']=[{'all':!![]}];}return db[_0xdad1('0x21')][_0xdad1('0x36')](_0x51e703);})['then'](function(_0x2958f7){_0xaa440e['rows']=_0x2958f7;return _0xaa440e;})['then'](respondWithFilteredResult(_0x20b68b,_0x51e703))['catch'](handleError(_0x20b68b,null));};exports['show']=function(_0x3cfa07,_0x43d2a9){var _0x312cf9={'raw':![],'where':{'id':_0x3cfa07[_0xdad1('0x37')]['id']}},_0x5aaee1={};_0x5aaee1[_0xdad1('0x24')]=_[_0xdad1('0x25')](db['VoiceExtension'][_0xdad1('0x22')]);_0x5aaee1[_0xdad1('0x28')]=_[_0xdad1('0x25')](_0x3cfa07[_0xdad1('0x28')]);_0x5aaee1[_0xdad1('0x26')]=_[_0xdad1('0x27')](_0x5aaee1['model'],_0x5aaee1[_0xdad1('0x28')]);_0x312cf9['attributes']=_[_0xdad1('0x27')](_0x5aaee1['model'],qs[_0xdad1('0x38')](_0x3cfa07[_0xdad1('0x28')]['fields']));_0x312cf9[_0xdad1('0x29')]=_0x312cf9[_0xdad1('0x29')][_0xdad1('0x2a')]?_0x312cf9[_0xdad1('0x29')]:_0x5aaee1[_0xdad1('0x24')];if(_0x3cfa07[_0xdad1('0x28')][_0xdad1('0x35')]){_0x312cf9['include']=[{'all':!![]}];}_0x312cf9=_[_0xdad1('0x31')]({},_0x312cf9,_0x3cfa07[_0xdad1('0x34')]);return db['VoiceExtension'][_0xdad1('0x1b')](_0x312cf9)[_0xdad1('0x1e')](handleEntityNotFound(_0x43d2a9,null))[_0xdad1('0x1e')](respondWithResult(_0x43d2a9,null))[_0xdad1('0x39')](handleError(_0x43d2a9,null));};exports[_0xdad1('0x11')]=function(_0x3020f4,_0x28aa68){return db['VoiceExtension'][_0xdad1('0x1b')]({'where':{'id':_0x3020f4[_0xdad1('0x37')]['id']}})[_0xdad1('0x1e')](handleEntityNotFound(_0x28aa68,null))[_0xdad1('0x1e')](removeEntity(_0x28aa68,null))['catch'](handleError(_0x28aa68,null));};exports[_0xdad1('0x3a')]=function(_0x4b93d3,_0x2238e9){if(_0x4b93d3[_0xdad1('0x3b')][_0xdad1('0x1a')]==='outbound'&&!_['startsWith'](_0x4b93d3[_0xdad1('0x3b')][_0xdad1('0x3c')],'_')){_0x4b93d3['body']['exten']='_'[_0xdad1('0x3d')](_0x4b93d3[_0xdad1('0x3b')][_0xdad1('0x3c')]);}return db['VoiceExtension'][_0xdad1('0x3a')](_0x4b93d3['body'],{'raw':![]})[_0xdad1('0x1e')](function(_0x53e6b9){var _0x3532c6=_0x4b93d3[_0xdad1('0x3e')][_0xdad1('0x3f')]({'plain':!![]});if(!_0x3532c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3532c6[_0xdad1('0x40')]==='user'){var _0x291d73=_0x53e6b9[_0xdad1('0x3f')]({'plain':!![]});var _0x5413c6=[{'name':'InboundRoutes','value':_0xdad1('0x41')},{'name':_0xdad1('0x12'),'value':_0xdad1('0x13')},{'name':_0xdad1('0x14'),'value':_0xdad1('0x15')}];var _0x163883=_[_0xdad1('0x1b')](_0x5413c6,[_0xdad1('0x18'),_0x291d73[_0xdad1('0x1a')]])[_0xdad1('0x1c')];return db[_0xdad1('0x42')][_0xdad1('0x1b')]({'where':{'name':_0x163883,'userProfileId':_0x3532c6[_0xdad1('0x43')]},'raw':!![]})[_0xdad1('0x1e')](function(_0x4140f4){if(_0x4140f4&&_0x4140f4[_0xdad1('0x44')]===0x0){return db[_0xdad1('0x1d')][_0xdad1('0x3a')]({'name':_0x291d73[_0xdad1('0x1c')],'resourceId':_0x291d73['id'],'type':_0x4140f4[_0xdad1('0x1c')],'sectionId':_0x4140f4['id']},{})[_0xdad1('0x1e')](function(){return _0x53e6b9;});}else{return _0x53e6b9;}})[_0xdad1('0x39')](function(_0x299c23){logger[_0xdad1('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x299c23);throw _0x299c23;});}return _0x53e6b9;})[_0xdad1('0x1e')](respondWithResult(_0x2238e9,0xc9))[_0xdad1('0x39')](handleError(_0x2238e9,null));};exports[_0xdad1('0x45')]=function(_0x20bbc4,_0x333415){if(_0x20bbc4['body']['id']){delete _0x20bbc4[_0xdad1('0x3b')]['id'];}return db[_0xdad1('0x21')][_0xdad1('0x1b')]({'where':{'id':_0x20bbc4[_0xdad1('0x37')]['id']}})['then'](handleEntityNotFound(_0x333415,null))['then'](function(_0x459690){if(_0x459690){return db[_0xdad1('0x21')][_0xdad1('0x45')](_['pick'](_0x20bbc4[_0xdad1('0x3b')],['exten',_0xdad1('0x46'),'description',_0xdad1('0x47'),'cutdigits',_0xdad1('0x48'),_0xdad1('0x49')]),{'where':{'context':_0x459690[_0xdad1('0x46')],'exten':_0x459690[_0xdad1('0x3c')]},'individualHooks':!![]})[_0xdad1('0x1e')](function(_0x408895){return _0x408895;});}return null;})[_0xdad1('0x1e')](respondWithStatusCode(_0x333415,null))[_0xdad1('0x39')](handleError(_0x333415,null));};exports[_0xdad1('0x4a')]=function(_0x53bd33,_0x4871de){var _0x5e406a=_0x53bd33[_0xdad1('0x37')]['id'];var _0x4398df=_0x53bd33['body'];var _0x2acc31=0xc8;var _0x10bd43=null;return db[_0xdad1('0x4b')]['transaction']({'isolationLevel':db[_0xdad1('0x4b')][_0xdad1('0x4c')][_0xdad1('0x4d')][_0xdad1('0x4e')]},function(_0x4dee69){return db[_0xdad1('0x21')][_0xdad1('0x4f')]({'where':{'id':_0x5e406a},'transaction':_0x4dee69})[_0xdad1('0x1e')](function(_0x5d0849){if(_0x5d0849){return db[_0xdad1('0x21')]['destroy']({'where':{'VoiceExtensionId':_0x5e406a},'transaction':_0x4dee69})['then'](function(){var _0x5d8f4c=_[_0xdad1('0x17')](_0x4398df,function(_0x231c26){_0x231c26['VoiceExtensionId']=_0x5e406a;_0x231c26['isApp']=!![];return _0x231c26;});return _0x5d0849[_0xdad1('0x50')](_0x5d8f4c);})[_0xdad1('0x1e')](function(_0x330320){return db[_0xdad1('0x21')][_0xdad1('0x51')](_0x330320,{'transaction':_0x4dee69});});}else{_0x2acc31=0x194;_0x10bd43=[];}});})[_0xdad1('0x1e')](function(){if(_0x2acc31!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5e406a},'order':'cast(priority\x20as\x20unsigned)'})[_0xdad1('0x1e')](function(_0x312a79){_0x10bd43=_0x312a79;});}})['catch'](function(_0x58f2a5){_0x2acc31=0x1f4;logger[_0xdad1('0x1f')](_0x58f2a5['stack']);if(_0x58f2a5[_0xdad1('0x1c')]){delete _0x58f2a5[_0xdad1('0x1c')];}_0x10bd43=_0x58f2a5;})[_0xdad1('0x52')](function(){if(_0x10bd43===null){_0x4871de[_0xdad1('0x9')](_0x2acc31);}else{if(_0x2acc31===0x1f4){_0x4871de[_0xdad1('0xb')](_0x2acc31)[_0xdad1('0x20')](_0x10bd43);}else{_0x4871de[_0xdad1('0xb')](_0x2acc31)[_0xdad1('0xc')](_0x10bd43);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b77bbdc..b22706e 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 _0x7ea2=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x4c84c9,_0x4d200e){var _0x3707fd=function(_0x19113a){while(--_0x19113a){_0x4c84c9['push'](_0x4c84c9['shift']());}};_0x3707fd(++_0x4d200e);}(_0x7ea2,0x8c));var _0x27ea=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0x7ea2[_0x20118a];return _0x538b5f;};'use strict';var EventEmitter=require(_0x27ea('0x0'));var VoiceExtension=require(_0x27ea('0x1'))['db'][_0x27ea('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x27ea('0x3')](0x0);var events={'afterCreate':_0x27ea('0x4'),'afterUpdate':_0x27ea('0x5'),'afterDestroy':_0x27ea('0x6')};function emitEvent(_0x320ace){return function(_0xa3f55e,_0x30c627,_0x25ea53){VoiceExtensionEvents[_0x27ea('0x7')](_0x320ace+':'+_0xa3f55e['id'],_0xa3f55e);VoiceExtensionEvents[_0x27ea('0x7')](_0x320ace,_0xa3f55e);_0x25ea53(null);};}for(var e in events){if(events[_0x27ea('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xa03c=['emit','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0xf7069b,_0x538bc7){var _0x36e597=function(_0x24518b){while(--_0x24518b){_0xf7069b['push'](_0xf7069b['shift']());}};_0x36e597(++_0x538bc7);}(_0xa03c,0xb7));var _0xca03=function(_0x207809,_0x4f4718){_0x207809=_0x207809-0x0;var _0x4f31e4=_0xa03c[_0x207809];return _0x4f31e4;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xca03('0x0'))['db'][_0xca03('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xca03('0x2')](0x0);var events={'afterCreate':_0xca03('0x3'),'afterUpdate':_0xca03('0x4'),'afterDestroy':_0xca03('0x5')};function emitEvent(_0x3eca6a){return function(_0x444fa8,_0x39e475,_0x14da24){VoiceExtensionEvents[_0xca03('0x6')](_0x3eca6a+':'+_0x444fa8['id'],_0x444fa8);VoiceExtensionEvents[_0xca03('0x6')](_0x3eca6a,_0x444fa8);_0x14da24(null);};}for(var e in events){if(events[_0xca03('0x7')](e)){var event=events[e];VoiceExtension[_0xca03('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 38aa36e..7b07a82 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 _0xc0e1=['alias','NoOp','No\x20alias\x20set','push','inbound','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','length','name','trunk','phone','prefix','${EXTEN}','SIP','join','param','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','filter','toLowerCase','tag','CDR(tag)=','intervals','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','catch','define','VoiceExtension','voice_extensions','get','last','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten'];(function(_0x1039eb,_0x2f1513){var _0x15a082=function(_0x1a702c){while(--_0x1a702c){_0x1039eb['push'](_0x1039eb['shift']());}};_0x15a082(++_0x2f1513);}(_0xc0e1,0x147));var _0x1c0e=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xc0e1[_0x2e5f9c];return _0x538b44;};'use strict';var _=require(_0x1c0e('0x0'));var attributes=require(_0x1c0e('0x1'));module[_0x1c0e('0x2')]=function(_0x5cbf58){var _0x3b4725=_0x5cbf58[_0x1c0e('0x3')];function _0x286c95(_0x2150a5){var _0x157736=0x2;var _0x42606e=[{'type':_0x2150a5[_0x1c0e('0x4')],'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x6')+_0x2150a5[_0x1c0e('0x4')],'context':_0x2150a5[_0x1c0e('0x7')],'exten':_0x2150a5[_0x1c0e('0x8')],'priority':_0x157736++,'VoiceExtensionId':_0x2150a5['id']},{'type':_0x2150a5[_0x1c0e('0x4')],'app':_0x2150a5[_0x1c0e('0x9')]?'Set':_0x1c0e('0xa'),'appdata':_0x2150a5[_0x1c0e('0x9')]?'CDR(routeAlias)='+_0x2150a5['alias']:_0x1c0e('0xb'),'context':_0x2150a5[_0x1c0e('0x7')],'exten':_0x2150a5[_0x1c0e('0x8')],'priority':_0x157736++,'VoiceExtensionId':_0x2150a5['id']}];if(_0x2150a5['type']==='inbound'){_0x42606e[_0x1c0e('0xc')]({'type':_0x1c0e('0xd'),'app':_0x1c0e('0x5'),'appdata':'CDR(routeid)='+_0x2150a5['id'],'context':_0x2150a5['context'],'exten':_0x2150a5['exten'],'priority':_0x157736++,'VoiceExtensionId':_0x2150a5['id']});}_0x42606e['push']({'type':_0x2150a5[_0x1c0e('0x4')],'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0xe'),'context':_0x2150a5[_0x1c0e('0x7')],'exten':_0x2150a5[_0x1c0e('0x8')],'priority':_0x157736++,'VoiceExtensionId':_0x2150a5['id']},{'type':_0x2150a5[_0x1c0e('0x4')],'app':_0x1c0e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2150a5['context'],'exten':_0x2150a5[_0x1c0e('0x8')],'priority':_0x157736++,'VoiceExtensionId':_0x2150a5['id']},{'type':_0x2150a5['type'],'app':_0x1c0e('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2150a5[_0x1c0e('0x7')],'exten':_0x2150a5[_0x1c0e('0x8')],'priority':_0x157736++,'VoiceExtensionId':_0x2150a5['id']});return _0x42606e;}function _0x449c7d(_0x2b2fa6){var _0x20fb5b=0x2;var _0x3b0f76=[{'type':_0x1c0e('0xf'),'app':'Set','appdata':_0x1c0e('0x10'),'context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x2b2fa6[_0x1c0e('0x9')]?'Set':_0x1c0e('0xa'),'appdata':_0x2b2fa6[_0x1c0e('0x9')]?'CDR(routeAlias)='+_0x2b2fa6[_0x1c0e('0x9')]:_0x1c0e('0xb'),'context':_0x2b2fa6['context'],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x11')+(_0x2b2fa6[_0x1c0e('0x12')]?_0x1c0e('0x13')+_0x2b2fa6[_0x1c0e('0x12')]+'}':'${EXTEN}'),'context':_0x2b2fa6['context'],'exten':_0x2b2fa6['exten'],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x14')+_0x2b2fa6['id'],'context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6['exten'],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x15'),'appdata':_0x1c0e('0x16')+(_0x20fb5b+0x2)+'):Goto('+(_0x20fb5b+0x1)+')','context':_0x2b2fa6['context'],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':_0x2b2fa6['cutdigits']?_0x1c0e('0x17')+_0x2b2fa6[_0x1c0e('0x12')]+'}':_0x1c0e('0x18'),'context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6['exten'],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2b2fa6['context'],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':'outbound','app':_0x1c0e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x19'),'context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':'Set','appdata':'outboundrouteid='+_0x2b2fa6['id'],'context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']}];if(_0x2b2fa6[_0x1c0e('0x1a')]('recordingFormat')&&_0x2b2fa6[_0x1c0e('0x1b')]!==_0x1c0e('0x1c')){_0x3b0f76['push']({'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6['exten'],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']},{'type':_0x1c0e('0xf'),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x1d')+_0x2b2fa6[_0x1c0e('0x1b')]||'wav','context':_0x2b2fa6[_0x1c0e('0x7')],'exten':_0x2b2fa6[_0x1c0e('0x8')],'priority':_0x20fb5b++,'VoiceExtensionId':_0x2b2fa6['id']});}return _0x3b0f76;}function _0x4f65b7(_0x5ed582,_0x4bd77c){var _0x3adbcb=[{'name':'trunk','param':0x0},{'name':_0x1c0e('0x1e'),'param':0x1},{'name':_0x1c0e('0x1f'),'param':0x2},{'name':_0x1c0e('0x20'),'param':0x3}];var _0x5abaa1={};var _0x19840f=_0x4bd77c[_0x1c0e('0x21')](',');var _0x681f32=[];for(var _0x464905=0x0;_0x464905<_0x3adbcb[_0x1c0e('0x22')];_0x464905++){switch(_0x3adbcb[_0x464905][_0x1c0e('0x23')]){case'trunk':_0x5abaa1[_0x1c0e('0x24')]=_0x19840f[_0x3adbcb[_0x464905]['param']][_0x1c0e('0x21')]('/')[0x1];_0x5abaa1[_0x1c0e('0x25')]=_0x19840f[_0x3adbcb[_0x464905]['param']]['split']('/')[0x2];_0x5abaa1[_0x1c0e('0x26')]=_0x5abaa1[_0x1c0e('0x25')]?_0x5abaa1[_0x1c0e('0x25')]['split']('$')[0x0]:undefined;_0x5abaa1['phone']=_0x5ed582['cutdigits']?(_0x5abaa1[_0x1c0e('0x26')]||'')+_0x1c0e('0x13')+_0x5ed582[_0x1c0e('0x12')]+'}':(_0x5abaa1[_0x1c0e('0x26')]||'')+_0x1c0e('0x27');_0x681f32[_0x3adbcb[_0x464905]['param']]=[_0x1c0e('0x28'),_0x5abaa1[_0x1c0e('0x24')],_0x5abaa1[_0x1c0e('0x25')]][_0x1c0e('0x29')]('/');break;case _0x1c0e('0x1f'):_0x5abaa1[_0x1c0e('0x1f')]=_0x19840f[_0x3adbcb[_0x464905][_0x1c0e('0x2a')]];if(_0x5ed582[_0x1c0e('0x1b')]!==_0x1c0e('0x1c')){if(_0x5abaa1[_0x1c0e('0x1f')][_0x1c0e('0x2b')](_0x1c0e('0x2c'))<0x0){_0x5abaa1[_0x1c0e('0x1f')]+=_0x1c0e('0x2c');}}else{_0x5abaa1[_0x1c0e('0x1f')]=_0x5abaa1[_0x1c0e('0x1f')][_0x1c0e('0x2d')](_0x1c0e('0x2c'),'');}_0x681f32[_0x3adbcb[_0x464905][_0x1c0e('0x2a')]]=_0x5abaa1[_0x1c0e('0x1f')];break;default:_0x681f32[_0x3adbcb[_0x464905][_0x1c0e('0x2a')]]=_0x19840f[_0x3adbcb[_0x464905]['param']];}}return _0x681f32[_0x1c0e('0x29')](',');}function _0x6a10fb(_0xac4a5b,_0x413b26,_0x226544){return new Promise(function(_0x55a112,_0x3f0931){var _0x5b5b1d=[];if(_[_0x1c0e('0x2e')](_0x413b26))return _0x55a112(_0x5b5b1d);_0x3b4725[_0x1c0e('0x2f')][_0x1c0e('0x30')]({'attributes':['id',_0x1c0e('0x31'),_0x1c0e('0x32')],'raw':!![]})['then'](function(_0x5f522d){for(var _0x39fda0=0x0,_0x452f47=0x0;_0x39fda0<_0x413b26[_0x1c0e('0x22')];_0x39fda0++,_0x452f47=0x0){var _0x111ca8=_0x413b26[_0x39fda0];var _0x1e012d=[];var _0x4097c2=[];delete _0x111ca8['id'];if(_0x111ca8['interval']!==_0x1c0e('0x33')){_0x111ca8['intervals']=[_0x111ca8[_0x1c0e('0x31')]];}else{_0x111ca8['intervals']=_0x111ca8[_0x1c0e('0x32')]?_['map'](_[_0x1c0e('0x34')](_0x5f522d,{'IntervalId':_0x111ca8[_0x1c0e('0x32')]}),_0x1c0e('0x31')):[];}_0x111ca8[_0x1c0e('0x7')]=_0xac4a5b[_0x1c0e('0x7')];_0x111ca8['exten']=_0xac4a5b[_0x1c0e('0x8')];if(_0x111ca8['type'])_0x111ca8[_0x1c0e('0x4')]=_0x111ca8[_0x1c0e('0x4')][_0x1c0e('0x35')]();if(_0xac4a5b[_0x1c0e('0x4')]===_0x1c0e('0xf')){if(_0x111ca8[_0x1c0e('0x1a')](_0x1c0e('0x36'))&&_0x111ca8[_0x1c0e('0x36')]&&_0x111ca8[_0x1c0e('0x36')]!=='--'){_0x1e012d[_0x1c0e('0xc')]({'type':_0x111ca8['type'][_0x1c0e('0x35')](),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x37')+_0x111ca8[_0x1c0e('0x36')],'context':_0xac4a5b[_0x1c0e('0x7')],'exten':_0xac4a5b[_0x1c0e('0x8')],'priority':_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')]+_0x226544+_0x452f47++,'VoiceExtensionId':_0xac4a5b['id']});}_0x1e012d[_0x1c0e('0xc')]({'type':_0x111ca8[_0x1c0e('0x4')]['toLowerCase'](),'app':_0x1c0e('0x15'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x111ca8['callerID']?_0x1c0e('0x39')+_0x111ca8[_0x1c0e('0x3a')]+')':_0x1c0e('0x3b')),'context':_0xac4a5b[_0x1c0e('0x7')],'exten':_0xac4a5b[_0x1c0e('0x8')],'priority':_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')]+_0x226544+_0x452f47++,'VoiceExtensionId':_0xac4a5b['id']});}else{if(_0x111ca8[_0x1c0e('0x1a')](_0x1c0e('0x3c'))){if([_0x1c0e('0x3d'),'playback'][_0x1c0e('0x3e')](_0x111ca8[_0x1c0e('0x3f')][_0x1c0e('0x35')]())&&_0x111ca8[_0x1c0e('0x40')]!==_0x1c0e('0x41')){if(_0x111ca8[_0x1c0e('0x3c')]){_0x1e012d[_0x1c0e('0xc')]({'type':_0x111ca8[_0x1c0e('0x4')]['toLowerCase'](),'app':_0x1c0e('0x15'),'appdata':_0x1c0e('0x42'),'context':_0xac4a5b['context'],'exten':_0xac4a5b[_0x1c0e('0x8')],'priority':_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')]+_0x226544+_0x452f47++,'VoiceExtensionId':_0xac4a5b['id']});_0x1e012d[_0x1c0e('0xc')]({'type':_0x111ca8[_0x1c0e('0x4')][_0x1c0e('0x35')](),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x43'),'context':_0xac4a5b[_0x1c0e('0x7')],'exten':_0xac4a5b[_0x1c0e('0x8')],'priority':_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')]+_0x226544+_0x452f47++,'VoiceExtensionId':_0xac4a5b['id']});}else{_0x1e012d[_0x1c0e('0xc')]({'type':_0x111ca8[_0x1c0e('0x4')][_0x1c0e('0x35')](),'app':'ExecIf','appdata':_0x1c0e('0x44'),'context':_0xac4a5b[_0x1c0e('0x7')],'exten':_0xac4a5b[_0x1c0e('0x8')],'priority':_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')]+_0x226544+_0x452f47++,'VoiceExtensionId':_0xac4a5b['id']});_0x1e012d[_0x1c0e('0xc')]({'type':_0x111ca8[_0x1c0e('0x4')][_0x1c0e('0x35')](),'app':_0x1c0e('0x5'),'appdata':_0x1c0e('0x45'),'context':_0xac4a5b[_0x1c0e('0x7')],'exten':_0xac4a5b['exten'],'priority':_0x111ca8[_0x1c0e('0x38')]['length']+_0x226544+_0x452f47++,'VoiceExtensionId':_0xac4a5b['id']});}}}}for(var _0x10ad63=0x0;_0x10ad63<_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')];_0x10ad63++){var _0x3916b1=_0x226544+_0x111ca8['intervals'][_0x1c0e('0x22')];var _0x222c5c=_0x10ad63===_0x111ca8[_0x1c0e('0x38')][_0x1c0e('0x22')]-0x1?_0x226544+_0x1e012d['length']+_0x4097c2[_0x1c0e('0x22')]+0x2:_0x226544+_0x10ad63+0x1;_0x1e012d[_0x1c0e('0x46')](_0x10ad63,0x0,{'type':_0xac4a5b['type'],'app':_0x1c0e('0x47'),'appdata':_0x111ca8[_0x1c0e('0x38')][_0x10ad63]+'?'+_0xac4a5b[_0x1c0e('0x7')]+_0x1c0e('0x48')+_0x3916b1+':'+_0xac4a5b['context']+_0x1c0e('0x48')+_0x222c5c,'exten':_0xac4a5b[_0x1c0e('0x8')],'context':_0xac4a5b[_0x1c0e('0x7')],'priority':_0x226544+_0x10ad63,'VoiceExtensionId':_0xac4a5b['id']});}if(_0x111ca8[_0x1c0e('0x40')]===_0x1c0e('0x49'))_0x111ca8[_0x1c0e('0x4a')]=_0x4f65b7(_0xac4a5b,_0x111ca8[_0x1c0e('0x4a')]);_0x111ca8[_0x1c0e('0x4b')]=_0x1e012d['length']?_['last'](_0x1e012d)['priority']+0x1:_0x226544;_0x5b5b1d=_['concat'](_0x5b5b1d,_0x1e012d,[_0x111ca8],_0x4097c2);_0x226544=_['last'](_0x5b5b1d)[_0x1c0e('0x4b')]+0x1;}return _0x55a112(_0x5b5b1d);})[_0x1c0e('0x4c')](function(_0x502214){_0x3f0931(_0x502214);});});}return _0x5cbf58[_0x1c0e('0x4d')](_0x1c0e('0x4e'),attributes,{'tableName':_0x1c0e('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2b1b26){var _0x1cc1d6=this[_0x1c0e('0x50')]({'plain':!![]});var _0x5782f9=_0x1cc1d6[_0x1c0e('0x4')]===_0x1c0e('0xf')?_0x449c7d(_0x1cc1d6):_0x286c95(_0x1cc1d6);return _0x6a10fb(_0x1cc1d6,_0x2b1b26,_[_0x1c0e('0x51')](_0x5782f9)[_0x1c0e('0x4b')]+0x1)['then'](function(_0x55d57e){var _0x4f529b=_[_0x1c0e('0x52')](_0x5782f9,_0x55d57e);_0x4f529b[_0x1c0e('0xc')]({'type':_0x1cc1d6[_0x1c0e('0x4')],'app':_0x1c0e('0x53'),'exten':_0x1cc1d6[_0x1c0e('0x8')],'context':_0x1cc1d6['context'],'priority':_[_0x1c0e('0x51')](_0x4f529b)[_0x1c0e('0x4b')]+0x1,'VoiceExtensionId':_0x1cc1d6['id']});return _0x4f529b;});}}});}; \ No newline at end of file +var _0x79c6=['phone','param','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','concat','define','voice_extensions','get','last','lodash','exports','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name'];(function(_0x4a5747,_0x47ccce){var _0x1177a9=function(_0x2a4fca){while(--_0x2a4fca){_0x4a5747['push'](_0x4a5747['shift']());}};_0x1177a9(++_0x47ccce);}(_0x79c6,0x81));var _0x679c=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x79c6[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x679c('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x679c('0x1')]=function(_0x1de4c6){var _0x5bbe52=_0x1de4c6[_0x679c('0x2')];function _0x5a2932(_0x56d9bf){var _0x596e9c=0x2;var _0x3e24f6=[{'type':_0x56d9bf[_0x679c('0x3')],'app':_0x679c('0x4'),'appdata':_0x679c('0x5')+_0x56d9bf[_0x679c('0x3')],'context':_0x56d9bf[_0x679c('0x6')],'exten':_0x56d9bf['exten'],'priority':_0x596e9c++,'VoiceExtensionId':_0x56d9bf['id']},{'type':_0x56d9bf['type'],'app':_0x56d9bf[_0x679c('0x7')]?_0x679c('0x4'):_0x679c('0x8'),'appdata':_0x56d9bf[_0x679c('0x7')]?_0x679c('0x9')+_0x56d9bf[_0x679c('0x7')]:_0x679c('0xa'),'context':_0x56d9bf['context'],'exten':_0x56d9bf['exten'],'priority':_0x596e9c++,'VoiceExtensionId':_0x56d9bf['id']}];if(_0x56d9bf['type']===_0x679c('0xb')){_0x3e24f6[_0x679c('0xc')]({'type':'inbound','app':'Set','appdata':_0x679c('0xd')+_0x56d9bf['id'],'context':_0x56d9bf[_0x679c('0x6')],'exten':_0x56d9bf[_0x679c('0xe')],'priority':_0x596e9c++,'VoiceExtensionId':_0x56d9bf['id']});}_0x3e24f6['push']({'type':_0x56d9bf[_0x679c('0x3')],'app':_0x679c('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x56d9bf[_0x679c('0x6')],'exten':_0x56d9bf['exten'],'priority':_0x596e9c++,'VoiceExtensionId':_0x56d9bf['id']},{'type':_0x56d9bf['type'],'app':_0x679c('0x4'),'appdata':_0x679c('0xf'),'context':_0x56d9bf[_0x679c('0x6')],'exten':_0x56d9bf[_0x679c('0xe')],'priority':_0x596e9c++,'VoiceExtensionId':_0x56d9bf['id']},{'type':_0x56d9bf[_0x679c('0x3')],'app':_0x679c('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x56d9bf[_0x679c('0x6')],'exten':_0x56d9bf[_0x679c('0xe')],'priority':_0x596e9c++,'VoiceExtensionId':_0x56d9bf['id']});return _0x3e24f6;}function _0x18117f(_0x3980a2){var _0x24b4f0=0x2;var _0x44eefc=[{'type':_0x679c('0x10'),'app':'Set','appdata':_0x679c('0x11'),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':'outbound','app':_0x3980a2[_0x679c('0x7')]?_0x679c('0x4'):_0x679c('0x8'),'appdata':_0x3980a2[_0x679c('0x7')]?_0x679c('0x9')+_0x3980a2['alias']:_0x679c('0xa'),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':_0x679c('0x10'),'app':'Set','appdata':_0x679c('0x12')+(_0x3980a2[_0x679c('0x13')]?_0x679c('0x14')+_0x3980a2[_0x679c('0x13')]+'}':_0x679c('0x15')),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':_0x679c('0x10'),'app':'Set','appdata':_0x679c('0xd')+_0x3980a2['id'],'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':_0x679c('0x10'),'app':_0x679c('0x16'),'appdata':_0x679c('0x17')+(_0x24b4f0+0x2)+_0x679c('0x18')+(_0x24b4f0+0x1)+')','context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':'outbound','app':'Set','appdata':_0x3980a2[_0x679c('0x13')]?_0x679c('0x19')+_0x3980a2[_0x679c('0x13')]+'}':_0x679c('0x1a'),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':_0x679c('0x10'),'app':_0x679c('0x4'),'appdata':_0x679c('0x1b'),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':'outbound','app':'Set','appdata':_0x679c('0xf'),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':'outbound','app':_0x679c('0x4'),'appdata':_0x679c('0x1c'),'context':_0x3980a2['context'],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':_0x679c('0x10'),'app':'Set','appdata':_0x679c('0x1d')+_0x3980a2['id'],'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']}];if(_0x3980a2['hasOwnProperty']('recordingFormat')&&_0x3980a2[_0x679c('0x1e')]!==_0x679c('0x1f')){_0x44eefc[_0x679c('0xc')]({'type':_0x679c('0x10'),'app':'Set','appdata':_0x679c('0x20'),'context':_0x3980a2['context'],'exten':_0x3980a2['exten'],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']},{'type':_0x679c('0x10'),'app':'Set','appdata':_0x679c('0x21')+_0x3980a2[_0x679c('0x1e')]||_0x679c('0x22'),'context':_0x3980a2[_0x679c('0x6')],'exten':_0x3980a2[_0x679c('0xe')],'priority':_0x24b4f0++,'VoiceExtensionId':_0x3980a2['id']});}return _0x44eefc;}function _0x1fccd8(_0x4058e5,_0x2ef042){var _0x1db1a7=[{'name':_0x679c('0x23'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x679c('0x24'),'param':0x2},{'name':_0x679c('0x25'),'param':0x3}];var _0x3170ea={};var _0x1ab032=_0x2ef042[_0x679c('0x26')](',');var _0x167568=[];for(var _0x1e2c63=0x0;_0x1e2c63<_0x1db1a7[_0x679c('0x27')];_0x1e2c63++){switch(_0x1db1a7[_0x1e2c63][_0x679c('0x28')]){case _0x679c('0x23'):_0x3170ea[_0x679c('0x23')]=_0x1ab032[_0x1db1a7[_0x1e2c63]['param']]['split']('/')[0x1];_0x3170ea[_0x679c('0x29')]=_0x1ab032[_0x1db1a7[_0x1e2c63][_0x679c('0x2a')]][_0x679c('0x26')]('/')[0x2];_0x3170ea[_0x679c('0x2b')]=_0x3170ea[_0x679c('0x29')]?_0x3170ea[_0x679c('0x29')][_0x679c('0x26')]('$')[0x0]:undefined;_0x3170ea[_0x679c('0x29')]=_0x4058e5[_0x679c('0x13')]?(_0x3170ea[_0x679c('0x2b')]||'')+_0x679c('0x14')+_0x4058e5[_0x679c('0x13')]+'}':(_0x3170ea['prefix']||'')+_0x679c('0x15');_0x167568[_0x1db1a7[_0x1e2c63][_0x679c('0x2a')]]=[_0x679c('0x2c'),_0x3170ea[_0x679c('0x23')],_0x3170ea[_0x679c('0x29')]][_0x679c('0x2d')]('/');break;case _0x679c('0x24'):_0x3170ea[_0x679c('0x24')]=_0x1ab032[_0x1db1a7[_0x1e2c63][_0x679c('0x2a')]];if(_0x4058e5['recordingFormat']!==_0x679c('0x1f')){if(_0x3170ea[_0x679c('0x24')][_0x679c('0x2e')](_0x679c('0x2f'))<0x0){_0x3170ea[_0x679c('0x24')]+='U(xcally-mixmonitor-context)';}}else{_0x3170ea[_0x679c('0x24')]=_0x3170ea['options'][_0x679c('0x30')](_0x679c('0x2f'),'');}_0x167568[_0x1db1a7[_0x1e2c63]['param']]=_0x3170ea[_0x679c('0x24')];break;default:_0x167568[_0x1db1a7[_0x1e2c63]['param']]=_0x1ab032[_0x1db1a7[_0x1e2c63]['param']];}}return _0x167568[_0x679c('0x2d')](',');}function _0x17afdb(_0x3bd052,_0x2d4dc8,_0xedfc02){return new Promise(function(_0x275d35,_0x2306b0){var _0x4249a0=[];if(_[_0x679c('0x31')](_0x2d4dc8))return _0x275d35(_0x4249a0);_0x5bbe52[_0x679c('0x32')][_0x679c('0x33')]({'attributes':['id',_0x679c('0x34'),_0x679c('0x35')],'raw':!![]})[_0x679c('0x36')](function(_0x481a11){for(var _0x229699=0x0,_0x4beaf4=0x0;_0x229699<_0x2d4dc8['length'];_0x229699++,_0x4beaf4=0x0){var _0x3c34d4=_0x2d4dc8[_0x229699];var _0xc2dfe5=[];var _0x425200=[];delete _0x3c34d4['id'];if(_0x3c34d4[_0x679c('0x34')]!==_0x679c('0x37')){_0x3c34d4[_0x679c('0x38')]=[_0x3c34d4['interval']];}else{_0x3c34d4['intervals']=_0x3c34d4[_0x679c('0x35')]?_[_0x679c('0x39')](_[_0x679c('0x3a')](_0x481a11,{'IntervalId':_0x3c34d4[_0x679c('0x35')]}),_0x679c('0x34')):[];}_0x3c34d4[_0x679c('0x6')]=_0x3bd052[_0x679c('0x6')];_0x3c34d4[_0x679c('0xe')]=_0x3bd052[_0x679c('0xe')];if(_0x3c34d4[_0x679c('0x3')])_0x3c34d4[_0x679c('0x3')]=_0x3c34d4[_0x679c('0x3')]['toLowerCase']();if(_0x3bd052[_0x679c('0x3')]===_0x679c('0x10')){if(_0x3c34d4[_0x679c('0x3b')](_0x679c('0x3c'))&&_0x3c34d4['tag']&&_0x3c34d4[_0x679c('0x3c')]!=='--'){_0xc2dfe5[_0x679c('0xc')]({'type':_0x3c34d4['type'][_0x679c('0x3d')](),'app':_0x679c('0x4'),'appdata':_0x679c('0x3e')+_0x3c34d4['tag'],'context':_0x3bd052[_0x679c('0x6')],'exten':_0x3bd052[_0x679c('0xe')],'priority':_0x3c34d4[_0x679c('0x38')][_0x679c('0x27')]+_0xedfc02+_0x4beaf4++,'VoiceExtensionId':_0x3bd052['id']});}_0xc2dfe5[_0x679c('0xc')]({'type':_0x3c34d4[_0x679c('0x3')][_0x679c('0x3d')](),'app':_0x679c('0x16'),'appdata':_0x679c('0x3f')+(_0x3c34d4[_0x679c('0x40')]?_0x679c('0x41')+_0x3c34d4[_0x679c('0x40')]+')':'NoOp(No\x20number\x20available)'),'context':_0x3bd052[_0x679c('0x6')],'exten':_0x3bd052['exten'],'priority':_0x3c34d4['intervals'][_0x679c('0x27')]+_0xedfc02+_0x4beaf4++,'VoiceExtensionId':_0x3bd052['id']});}else{if(_0x3c34d4[_0x679c('0x3b')]('answer')){if(['queue',_0x679c('0x42')][_0x679c('0x43')](_0x3c34d4[_0x679c('0x44')][_0x679c('0x3d')]())&&_0x3c34d4['appType']!==_0x679c('0x45')){if(_0x3c34d4[_0x679c('0x46')]){_0xc2dfe5[_0x679c('0xc')]({'type':_0x3c34d4[_0x679c('0x3')][_0x679c('0x3d')](),'app':_0x679c('0x16'),'appdata':_0x679c('0x47'),'context':_0x3bd052[_0x679c('0x6')],'exten':_0x3bd052['exten'],'priority':_0x3c34d4[_0x679c('0x38')]['length']+_0xedfc02+_0x4beaf4++,'VoiceExtensionId':_0x3bd052['id']});_0xc2dfe5[_0x679c('0xc')]({'type':_0x3c34d4[_0x679c('0x3')][_0x679c('0x3d')](),'app':_0x679c('0x4'),'appdata':_0x679c('0x48'),'context':_0x3bd052[_0x679c('0x6')],'exten':_0x3bd052[_0x679c('0xe')],'priority':_0x3c34d4['intervals'][_0x679c('0x27')]+_0xedfc02+_0x4beaf4++,'VoiceExtensionId':_0x3bd052['id']});}else{_0xc2dfe5['push']({'type':_0x3c34d4[_0x679c('0x3')][_0x679c('0x3d')](),'app':_0x679c('0x16'),'appdata':_0x679c('0x49'),'context':_0x3bd052[_0x679c('0x6')],'exten':_0x3bd052[_0x679c('0xe')],'priority':_0x3c34d4[_0x679c('0x38')]['length']+_0xedfc02+_0x4beaf4++,'VoiceExtensionId':_0x3bd052['id']});_0xc2dfe5['push']({'type':_0x3c34d4[_0x679c('0x3')][_0x679c('0x3d')](),'app':_0x679c('0x4'),'appdata':_0x679c('0x4a'),'context':_0x3bd052['context'],'exten':_0x3bd052['exten'],'priority':_0x3c34d4[_0x679c('0x38')][_0x679c('0x27')]+_0xedfc02+_0x4beaf4++,'VoiceExtensionId':_0x3bd052['id']});}}}}for(var _0x31220a=0x0;_0x31220a<_0x3c34d4[_0x679c('0x38')][_0x679c('0x27')];_0x31220a++){var _0x202b91=_0xedfc02+_0x3c34d4['intervals'][_0x679c('0x27')];var _0x596ad9=_0x31220a===_0x3c34d4['intervals'][_0x679c('0x27')]-0x1?_0xedfc02+_0xc2dfe5[_0x679c('0x27')]+_0x425200['length']+0x2:_0xedfc02+_0x31220a+0x1;_0xc2dfe5[_0x679c('0x4b')](_0x31220a,0x0,{'type':_0x3bd052[_0x679c('0x3')],'app':_0x679c('0x4c'),'appdata':_0x3c34d4[_0x679c('0x38')][_0x31220a]+'?'+_0x3bd052[_0x679c('0x6')]+_0x679c('0x4d')+_0x202b91+':'+_0x3bd052[_0x679c('0x6')]+_0x679c('0x4d')+_0x596ad9,'exten':_0x3bd052['exten'],'context':_0x3bd052[_0x679c('0x6')],'priority':_0xedfc02+_0x31220a,'VoiceExtensionId':_0x3bd052['id']});}if(_0x3c34d4['appType']==='outboundDial')_0x3c34d4[_0x679c('0x4e')]=_0x1fccd8(_0x3bd052,_0x3c34d4[_0x679c('0x4e')]);_0x3c34d4[_0x679c('0x4f')]=_0xc2dfe5['length']?_['last'](_0xc2dfe5)[_0x679c('0x4f')]+0x1:_0xedfc02;_0x4249a0=_[_0x679c('0x50')](_0x4249a0,_0xc2dfe5,[_0x3c34d4],_0x425200);_0xedfc02=_['last'](_0x4249a0)[_0x679c('0x4f')]+0x1;}return _0x275d35(_0x4249a0);})['catch'](function(_0x3a6a67){_0x2306b0(_0x3a6a67);});});}return _0x1de4c6[_0x679c('0x51')]('VoiceExtension',attributes,{'tableName':_0x679c('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x42f51c){var _0x212c3b=this[_0x679c('0x53')]({'plain':!![]});var _0x3dd52d=_0x212c3b[_0x679c('0x3')]===_0x679c('0x10')?_0x18117f(_0x212c3b):_0x5a2932(_0x212c3b);return _0x17afdb(_0x212c3b,_0x42f51c,_['last'](_0x3dd52d)[_0x679c('0x4f')]+0x1)[_0x679c('0x36')](function(_0x2ecce5){var _0x2b421e=_['concat'](_0x3dd52d,_0x2ecce5);_0x2b421e[_0x679c('0xc')]({'type':_0x212c3b[_0x679c('0x3')],'app':'Hangup','exten':_0x212c3b[_0x679c('0xe')],'context':_0x212c3b[_0x679c('0x6')],'priority':_[_0x679c('0x54')](_0x2b421e)[_0x679c('0x4f')]+0x1,'VoiceExtensionId':_0x212c3b['id']});return _0x2b421e;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 225d370..e0c24bc 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 _0x423b=['./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetVoiceExtension','findAll','options','attributes','include','map','model','stringify','util','bluebird','ioredis','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x869bb6,_0x318c86){var _0x2b5966=function(_0x54a73a){while(--_0x54a73a){_0x869bb6['push'](_0x869bb6['shift']());}};_0x2b5966(++_0x318c86);}(_0x423b,0x12b));var _0xb423=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x423b[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var moment=require('moment');var BPromise=require(_0xb423('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb423('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb423('0x3'));var config=require(_0xb423('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb423('0x5')][_0xb423('0x6')]({'port':0x232a});config[_0xb423('0x7')]=_[_0xb423('0x8')](config['redis'],{'host':_0xb423('0x9'),'port':0x18eb});var socket=require(_0xb423('0xa'))(new Redis(config[_0xb423('0x7')]));require(_0xb423('0xb'))[_0xb423('0xc')](socket);function respondWithRpcPromise(_0x50031c,_0x4c7c0b,_0x25926c){return new BPromise(function(_0x190099,_0x1060e6){return client[_0xb423('0xd')](_0x50031c,_0x25926c)[_0xb423('0xe')](function(_0x5b1010){logger[_0xb423('0xf')](_0xb423('0x10'),_0x4c7c0b,'request\x20sent');logger[_0xb423('0x11')](_0xb423('0x12'),_0x4c7c0b,_0xb423('0x13'),JSON['stringify'](_0x5b1010));if(_0x5b1010[_0xb423('0x14')]){if(_0x5b1010['error'][_0xb423('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x4c7c0b,_0x5b1010['error'][_0xb423('0x16')]);return _0x1060e6(_0x5b1010[_0xb423('0x14')][_0xb423('0x16')]);}logger['error'](_0xb423('0x10'),_0x4c7c0b,_0x5b1010[_0xb423('0x14')][_0xb423('0x16')]);return _0x190099(_0x5b1010[_0xb423('0x14')]['message']);}else{logger[_0xb423('0xf')](_0xb423('0x10'),_0x4c7c0b,'request\x20sent');_0x190099(_0x5b1010['result'][_0xb423('0x16')]);}})['catch'](function(_0xa924c6){logger[_0xb423('0x14')](_0xb423('0x10'),_0x4c7c0b,_0xa924c6);_0x1060e6(_0xa924c6);});});}exports[_0xb423('0x17')]=function(_0x2fb3cf){var _0x477fce=this;return new Promise(function(_0x190b1f,_0x41b213){return db['VoiceExtension'][_0xb423('0x18')]({'raw':_0x2fb3cf[_0xb423('0x19')]?_0x2fb3cf[_0xb423('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2fb3cf[_0xb423('0x19')]?_0x2fb3cf[_0xb423('0x19')]['where']||null:null,'attributes':_0x2fb3cf[_0xb423('0x19')]?_0x2fb3cf[_0xb423('0x19')][_0xb423('0x1a')]||null:null,'limit':_0x2fb3cf['options']?_0x2fb3cf[_0xb423('0x19')]['limit']||null:null,'include':_0x2fb3cf[_0xb423('0x19')]?_0x2fb3cf['options'][_0xb423('0x1b')]?_[_0xb423('0x1c')](_0x2fb3cf['options'][_0xb423('0x1b')],function(_0x1d3e39){return{'model':db[_0x1d3e39[_0xb423('0x1d')]],'as':_0x1d3e39['as'],'attributes':_0x1d3e39['attributes'],'include':_0x1d3e39['include']?_[_0xb423('0x1c')](_0x1d3e39['include'],function(_0xd2e08b){return{'model':db[_0xd2e08b['model']],'as':_0xd2e08b['as'],'attributes':_0xd2e08b[_0xb423('0x1a')],'include':_0xd2e08b[_0xb423('0x1b')]?_[_0xb423('0x1c')](_0xd2e08b[_0xb423('0x1b')],function(_0x18e26a){return{'model':db[_0x18e26a['model']],'as':_0x18e26a['as'],'attributes':_0x18e26a[_0xb423('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51da03){logger['info']('GetVoiceExtension',_0x2fb3cf);logger[_0xb423('0x11')](_0xb423('0x17'),_0x2fb3cf,JSON[_0xb423('0x1e')](_0x51da03));_0x190b1f(_0x51da03);})['catch'](function(_0x5711da){logger[_0xb423('0x14')](_0xb423('0x17'),_0x5711da['message'],_0x2fb3cf);_0x41b213(_0x477fce[_0xb423('0x14')](0x1f4,_0x5711da[_0xb423('0x16')]));});});}; \ No newline at end of file +var _0x9f02=['then','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','findAll','options','where','limit','include','map','model','attributes'];(function(_0xb356f5,_0x42d3ca){var _0x507b3b=function(_0x53dafc){while(--_0x53dafc){_0xb356f5['push'](_0xb356f5['shift']());}};_0x507b3b(++_0x42d3ca);}(_0x9f02,0x68));var _0x29f0=function(_0x200f56,_0xd27126){_0x200f56=_0x200f56-0x0;var _0x3a0dc0=_0x9f02[_0x200f56];return _0x3a0dc0;};'use strict';var _=require(_0x29f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29f0('0x1'));var fs=require('fs');var Redis=require(_0x29f0('0x2'));var db=require(_0x29f0('0x3'))['db'];var utils=require(_0x29f0('0x4'));var logger=require(_0x29f0('0x5'))('rpc');var config=require(_0x29f0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x29f0('0x7')][_0x29f0('0x8')]({'port':0x232a});config[_0x29f0('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x29f0('0xa'))(new Redis(config['redis']));require(_0x29f0('0xb'))[_0x29f0('0xc')](socket);function respondWithRpcPromise(_0x581e4,_0x529ded,_0x48adaf){return new BPromise(function(_0x3e1eeb,_0x5a8eb2){return client['request'](_0x581e4,_0x48adaf)['then'](function(_0x488b7f){logger[_0x29f0('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x529ded,_0x29f0('0xe'));logger['debug'](_0x29f0('0xf'),_0x529ded,_0x29f0('0xe'),JSON[_0x29f0('0x10')](_0x488b7f));if(_0x488b7f[_0x29f0('0x11')]){if(_0x488b7f['error'][_0x29f0('0x12')]===0x1f4){logger[_0x29f0('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x529ded,_0x488b7f[_0x29f0('0x11')]['message']);return _0x5a8eb2(_0x488b7f[_0x29f0('0x11')]['message']);}logger[_0x29f0('0x11')](_0x29f0('0x13'),_0x529ded,_0x488b7f['error']['message']);return _0x3e1eeb(_0x488b7f['error'][_0x29f0('0x14')]);}else{logger[_0x29f0('0xd')](_0x29f0('0x13'),_0x529ded,'request\x20sent');_0x3e1eeb(_0x488b7f[_0x29f0('0x15')][_0x29f0('0x14')]);}})[_0x29f0('0x16')](function(_0x12e197){logger[_0x29f0('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x529ded,_0x12e197);_0x5a8eb2(_0x12e197);});});}exports[_0x29f0('0x17')]=function(_0xf7da2e){var _0x340fc0=this;return new Promise(function(_0x5a4579,_0x2fd36b){return db['VoiceExtension'][_0x29f0('0x18')]({'raw':_0xf7da2e[_0x29f0('0x19')]?_0xf7da2e[_0x29f0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf7da2e[_0x29f0('0x19')]?_0xf7da2e[_0x29f0('0x19')][_0x29f0('0x1a')]||null:null,'attributes':_0xf7da2e[_0x29f0('0x19')]?_0xf7da2e[_0x29f0('0x19')]['attributes']||null:null,'limit':_0xf7da2e[_0x29f0('0x19')]?_0xf7da2e[_0x29f0('0x19')][_0x29f0('0x1b')]||null:null,'include':_0xf7da2e[_0x29f0('0x19')]?_0xf7da2e[_0x29f0('0x19')][_0x29f0('0x1c')]?_[_0x29f0('0x1d')](_0xf7da2e[_0x29f0('0x19')][_0x29f0('0x1c')],function(_0x2012c3){return{'model':db[_0x2012c3[_0x29f0('0x1e')]],'as':_0x2012c3['as'],'attributes':_0x2012c3['attributes'],'include':_0x2012c3[_0x29f0('0x1c')]?_[_0x29f0('0x1d')](_0x2012c3['include'],function(_0x5afe68){return{'model':db[_0x5afe68[_0x29f0('0x1e')]],'as':_0x5afe68['as'],'attributes':_0x5afe68[_0x29f0('0x1f')],'include':_0x5afe68['include']?_[_0x29f0('0x1d')](_0x5afe68[_0x29f0('0x1c')],function(_0x115996){return{'model':db[_0x115996['model']],'as':_0x115996['as'],'attributes':_0x115996['attributes']};}):[]};}):[]};}):[]:[]})[_0x29f0('0x20')](function(_0x3dc23b){logger[_0x29f0('0xd')](_0x29f0('0x17'),_0xf7da2e);logger[_0x29f0('0x21')]('GetVoiceExtension',_0xf7da2e,JSON[_0x29f0('0x10')](_0x3dc23b));_0x5a4579(_0x3dc23b);})[_0x29f0('0x16')](function(_0x1fcdfa){logger[_0x29f0('0x11')](_0x29f0('0x17'),_0x1fcdfa[_0x29f0('0x14')],_0xf7da2e);_0x2fd36b(_0x340fc0[_0x29f0('0x11')](0x1f4,_0x1fcdfa['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2e6d698..3546956 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0x912d1f,_0x279321){var _0x5964f0=function(_0x476793){while(--_0x476793){_0x912d1f['push'](_0x912d1f['shift']());}};_0x5964f0(++_0x279321);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x42160c,_0x30e856){_0x42160c=_0x42160c-0x0;var _0xdba9cb=_0x7fbe[_0x42160c];return _0xdba9cb;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x50fa2d,_0x37ef05){var _0x43d411=function(_0x4e9e2e){while(--_0x4e9e2e){_0x50fa2d['push'](_0x50fa2d['shift']());}};_0x43d411(++_0x37ef05);}(_0x5fab,0x177));var _0xb5fa=function(_0x2bae44,_0x33f37a){_0x2bae44=_0x2bae44-0x0;var _0x1e111b=_0x5fab[_0x2bae44];return _0x1e111b;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f0cbd07..7bd3329 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 _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x1967,0x173));var _0x7196=function(_0xcdc10f,_0x80d305){_0xcdc10f=_0xcdc10f-0x0;var _0x296293=_0x1967[_0xcdc10f];return _0x296293;};'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('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file +var _0xd101=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xe34da8,_0x316b16){var _0x78049a=function(_0x140e16){while(--_0x140e16){_0xe34da8['push'](_0xe34da8['shift']());}};_0x78049a(++_0x316b16);}(_0xd101,0xc1));var _0x1d10=function(_0x534d7a,_0x5cea65){_0x534d7a=_0x534d7a-0x0;var _0x5ce9c9=_0xd101[_0x534d7a];return _0x5ce9c9;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./voiceMail.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller['update']);router[_0x1d10('0x13')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x14')]);module[_0x1d10('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 4b3bf43..964cd91 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 _0xa153=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes'];(function(_0xd828b6,_0x3fcc44){var _0x3628cd=function(_0x31e3e1){while(--_0x31e3e1){_0xd828b6['push'](_0xd828b6['shift']());}};_0x3628cd(++_0x3fcc44);}(_0xa153,0x15b));var _0x3a15=function(_0x1f45bc,_0x28109e){_0x1f45bc=_0x1f45bc-0x0;var _0x284667=_0xa153[_0x1f45bc];return _0x284667;};'use strict';var Sequelize=require('sequelize');module[_0x3a15('0x0')]={'customer_id':{'type':Sequelize[_0x3a15('0x1')]},'context':{'type':Sequelize[_0x3a15('0x1')],'defaultValue':_0x3a15('0x2'),'unique':_0x3a15('0x3')},'mailbox':{'type':Sequelize[_0x3a15('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3a15('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3a15('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1f8567){this['setDataValue'](_0x3a15('0x4'),typeof _0x1f8567===_0x3a15('0x5')&&_0x1f8567[_0x3a15('0x6')]()?_0x1f8567[_0x3a15('0x6')]():null);}},'pager':{'type':Sequelize[_0x3a15('0x1')]},'tz':{'type':Sequelize[_0x3a15('0x1')],'defaultValue':_0x3a15('0x7')},'attach':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':_0x3a15('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':_0x3a15('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3a15('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3a15('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':_0x3a15('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3a15('0x8')](_0x3a15('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3a15('0x8')]('yes','no'),'defaultValue':_0x3a15('0x9'),'allowNull':![]},'stamp':{'type':_0x3a15('0xa')},'emailsubject':{'type':Sequelize[_0x3a15('0x1')]},'emailbody':{'type':Sequelize[_0x3a15('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3a15('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3a15('0xc')],'get':function(){return this[_0x3a15('0xd')](_0x3a15('0xe'))+_0x3a15('0xf')+this['getDataValue'](_0x3a15('0x10'));}}}; \ No newline at end of file +var _0x579f=['fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x304730,_0x483b78){var _0xe27bbf=function(_0xec4003){while(--_0xec4003){_0x304730['push'](_0x304730['shift']());}};_0xe27bbf(++_0x483b78);}(_0x579f,0x124));var _0xf579=function(_0x4aa6d9,_0x1ff721){_0x4aa6d9=_0x4aa6d9-0x0;var _0x43e988=_0x579f[_0x4aa6d9];return _0x43e988;};'use strict';var Sequelize=require('sequelize');module[_0xf579('0x0')]={'customer_id':{'type':Sequelize[_0xf579('0x1')]},'context':{'type':Sequelize[_0xf579('0x1')],'defaultValue':_0xf579('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf579('0x1')],'defaultValue':'','allowNull':![],'unique':_0xf579('0x3')},'password':{'type':Sequelize[_0xf579('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf579('0x1')],'validate':{'isEmail':!![]},'set':function(_0x152c42){this['setDataValue'](_0xf579('0x4'),typeof _0x152c42===_0xf579('0x5')&&_0x152c42[_0xf579('0x6')]()?_0x152c42[_0xf579('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':_0xf579('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xf579('0x1')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf579('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf579('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xf579('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':_0xf579('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf579('0x7')](_0xf579('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf579('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xf579('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xf579('0xa')},'emailsubject':{'type':Sequelize[_0xf579('0x1')]},'emailbody':{'type':Sequelize[_0xf579('0x1')]},'maxsecs':{'type':Sequelize[_0xf579('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf579('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf579('0xc')],'get':function(){return this[_0xf579('0xd')](_0xf579('0xe'))+_0xf579('0xf')+this[_0xf579('0xd')](_0xf579('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aa8f4cb..035f266 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 _0x878f=['reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','name','send','map','VoiceMail','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','hasOwnProperty','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json'];(function(_0x59688d,_0x4b1081){var _0x2a86a0=function(_0x4dbf82){while(--_0x4dbf82){_0x59688d['push'](_0x59688d['shift']());}};_0x2a86a0(++_0x4b1081);}(_0x878f,0x173));var _0xf878=function(_0x5273a0,_0x4e608e){_0x5273a0=_0x5273a0-0x0;var _0x4fc4b6=_0x878f[_0x5273a0];return _0x4fc4b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x339c9c,_0x596fb5){_0x596fb5=_0x596fb5||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x339c9c[_0xf878('0x15')](_0x596fb5);}return _0x339c9c[_0xf878('0x16')](_0x596fb5)['end']();};}function respondWithResult(_0xe2c2de,_0x3902f7){_0x3902f7=_0x3902f7||0xc8;return function(_0x119e9e){if(_0x119e9e){return _0xe2c2de['status'](_0x3902f7)['json'](_0x119e9e);}};}function respondWithFilteredResult(_0x4c0948,_0x35ff2d){return function(_0x31d888){if(_0x31d888){var _0x6dbeca=typeof _0x35ff2d[_0xf878('0x17')]===_0xf878('0x18')&&typeof _0x35ff2d[_0xf878('0x19')]===_0xf878('0x18');var _0x3c5dee=_0x31d888[_0xf878('0x1a')];var _0x3b2e1b=_0x6dbeca?0x0:_0x35ff2d['offset'];var _0x2b2b54=_0x6dbeca?_0x31d888[_0xf878('0x1a')]:_0x35ff2d[_0xf878('0x17')]+_0x35ff2d[_0xf878('0x19')];var _0x3714f6;if(_0x2b2b54>=_0x3c5dee){_0x2b2b54=_0x3c5dee;_0x3714f6=0xc8;}else{_0x3714f6=0xce;}_0x4c0948[_0xf878('0x16')](_0x3714f6);return _0x4c0948[_0xf878('0x1b')]('Content-Range',_0x3b2e1b+'-'+_0x2b2b54+'/'+_0x3c5dee)[_0xf878('0x1c')](_0x31d888);}return null;};}function patchUpdates(_0x140866){return function(_0x250f85){try{jsonpatch['apply'](_0x250f85,_0x140866,!![]);}catch(_0x432e5d){return BPromise[_0xf878('0x1d')](_0x432e5d);}return _0x250f85[_0xf878('0x1e')]();};}function saveUpdates(_0x392822,_0x22d884){return function(_0x442450){if(_0x442450){return _0x442450[_0xf878('0x1f')](_0x392822)[_0xf878('0x20')](function(_0x212436){return _0x212436;});}return null;};}function removeEntity(_0x1a6506,_0x45e61f){return function(_0x566995){if(_0x566995){return _0x566995[_0xf878('0x21')]()['then'](function(){var _0xa3d3d3=_0x566995[_0xf878('0x22')]({'plain':!![]});var _0x35b3b4=_0xf878('0x23');return db[_0xf878('0x24')]['destroy']({'where':{'type':_0x35b3b4,'resourceId':_0xa3d3d3['id']}})['then'](function(){return _0x566995;});})['then'](function(){_0x1a6506[_0xf878('0x16')](0xcc)[_0xf878('0x25')]();});}};}function handleEntityNotFound(_0x38fa87,_0x5af87f){return function(_0xfa3e11){if(!_0xfa3e11){_0x38fa87[_0xf878('0x15')](0x194);}return _0xfa3e11;};}function handleError(_0x3e848d,_0xd50680){_0xd50680=_0xd50680||0x1f4;return function(_0x41dd55){logger['error'](_0x41dd55['stack']);if(_0x41dd55[_0xf878('0x26')]){delete _0x41dd55[_0xf878('0x26')];}_0x3e848d['status'](_0xd50680)[_0xf878('0x27')](_0x41dd55);};}exports['index']=function(_0x969ee3,_0x51afaf){var _0x2c61c1={},_0x49e66a={},_0x2630fb={'count':0x0,'rows':[]};var _0x48b151=_[_0xf878('0x28')](db[_0xf878('0x29')][_0xf878('0x2a')],function(_0x1f5331){return{'name':_0x1f5331[_0xf878('0x2b')],'type':_0x1f5331[_0xf878('0x2c')]['key']};});_0x49e66a[_0xf878('0x2d')]=_[_0xf878('0x28')](_0x48b151,_0xf878('0x26'));_0x49e66a[_0xf878('0x2e')]=_[_0xf878('0x2f')](_0x969ee3['query']);_0x49e66a[_0xf878('0x30')]=_[_0xf878('0x31')](_0x49e66a['model'],_0x49e66a[_0xf878('0x2e')]);_0x2c61c1[_0xf878('0x32')]=_[_0xf878('0x31')](_0x49e66a[_0xf878('0x2d')],qs[_0xf878('0x33')](_0x969ee3['query'][_0xf878('0x33')]));_0x2c61c1[_0xf878('0x32')]=_0x2c61c1[_0xf878('0x32')][_0xf878('0x34')]?_0x2c61c1['attributes']:_0x49e66a[_0xf878('0x2d')];if(!_0x969ee3['query']['hasOwnProperty'](_0xf878('0x35'))){_0x2c61c1[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x969ee3[_0xf878('0x2e')][_0xf878('0x19')]);_0x2c61c1['offset']=qs[_0xf878('0x17')](_0x969ee3['query'][_0xf878('0x17')]);}_0x2c61c1[_0xf878('0x36')]=qs['sort'](_0x969ee3[_0xf878('0x2e')][_0xf878('0x37')]);_0x2c61c1['where']=qs[_0xf878('0x30')](_[_0xf878('0x38')](_0x969ee3['query'],_0x49e66a[_0xf878('0x30')]),_0x48b151);if(_0x969ee3[_0xf878('0x2e')][_0xf878('0x39')]){_0x2c61c1[_0xf878('0x3a')]=_[_0xf878('0x3b')](_0x2c61c1[_0xf878('0x3a')],{'$or':_[_0xf878('0x28')](_0x48b151,function(_0x54af54){if(_0x54af54[_0xf878('0x2c')]!==_0xf878('0x3c')){var _0x47ec1b={};_0x47ec1b[_0x54af54[_0xf878('0x26')]]={'$like':'%'+_0x969ee3['query']['filter']+'%'};return _0x47ec1b;}})});}_0x2c61c1=_[_0xf878('0x3b')]({},_0x2c61c1,_0x969ee3[_0xf878('0x3d')]);var _0x43b03e={'where':_0x2c61c1[_0xf878('0x3a')]};return db[_0xf878('0x29')]['count'](_0x43b03e)[_0xf878('0x20')](function(_0x4c4ae4){_0x2630fb[_0xf878('0x1a')]=_0x4c4ae4;if(_0x969ee3[_0xf878('0x2e')]['includeAll']){_0x2c61c1['include']=[{'all':!![]}];}return db[_0xf878('0x29')][_0xf878('0x3e')](_0x2c61c1);})[_0xf878('0x20')](function(_0x2f6ee5){_0x2630fb[_0xf878('0x3f')]=_0x2f6ee5;return _0x2630fb;})[_0xf878('0x20')](respondWithFilteredResult(_0x51afaf,_0x2c61c1))[_0xf878('0x40')](handleError(_0x51afaf,null));};exports[_0xf878('0x41')]=function(_0x3b1c67,_0x5444eb){var _0x1edaa9={'raw':!![],'where':{'id':_0x3b1c67[_0xf878('0x42')]['id']}},_0x21b4fb={};_0x21b4fb[_0xf878('0x2d')]=_[_0xf878('0x2f')](db[_0xf878('0x29')]['rawAttributes']);_0x21b4fb[_0xf878('0x2e')]=_[_0xf878('0x2f')](_0x3b1c67[_0xf878('0x2e')]);_0x21b4fb[_0xf878('0x30')]=_[_0xf878('0x31')](_0x21b4fb['model'],_0x21b4fb[_0xf878('0x2e')]);_0x1edaa9[_0xf878('0x32')]=_[_0xf878('0x31')](_0x21b4fb[_0xf878('0x2d')],qs['fields'](_0x3b1c67[_0xf878('0x2e')][_0xf878('0x33')]));_0x1edaa9[_0xf878('0x32')]=_0x1edaa9['attributes']['length']?_0x1edaa9[_0xf878('0x32')]:_0x21b4fb['model'];if(_0x3b1c67['query']['includeAll']){_0x1edaa9[_0xf878('0x43')]=[{'all':!![]}];}_0x1edaa9=_['merge']({},_0x1edaa9,_0x3b1c67[_0xf878('0x3d')]);return db[_0xf878('0x29')][_0xf878('0x44')](_0x1edaa9)[_0xf878('0x20')](handleEntityNotFound(_0x5444eb,null))[_0xf878('0x20')](respondWithResult(_0x5444eb,null))[_0xf878('0x40')](handleError(_0x5444eb,null));};exports[_0xf878('0x45')]=function(_0x526c89,_0xb0bf4c){return db[_0xf878('0x29')][_0xf878('0x45')](_0x526c89[_0xf878('0x46')],{})[_0xf878('0x20')](function(_0x47c8be){var _0x4a5b71=_0x526c89[_0xf878('0x47')][_0xf878('0x22')]({'plain':!![]});if(!_0x4a5b71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a5b71[_0xf878('0x48')]==='user'){var _0x1ce6b9=_0x47c8be[_0xf878('0x22')]({'plain':!![]});var _0x379912=_0xf878('0x23');return db['UserProfileSection'][_0xf878('0x44')]({'where':{'name':_0x379912,'userProfileId':_0x4a5b71[_0xf878('0x49')]},'raw':!![]})[_0xf878('0x20')](function(_0x5a88d1){if(_0x5a88d1&&_0x5a88d1[_0xf878('0x4a')]===0x0){return db[_0xf878('0x24')][_0xf878('0x45')]({'name':_0x1ce6b9[_0xf878('0x26')],'resourceId':_0x1ce6b9['id'],'type':_0x5a88d1['name'],'sectionId':_0x5a88d1['id']},{})[_0xf878('0x20')](function(){return _0x47c8be;});}else{return _0x47c8be;}})[_0xf878('0x40')](function(_0x3f9fce){logger['error'](_0xf878('0x4b'),_0x3f9fce);throw _0x3f9fce;});}return _0x47c8be;})[_0xf878('0x20')](respondWithResult(_0xb0bf4c,0xc9))[_0xf878('0x40')](handleError(_0xb0bf4c,null));};exports[_0xf878('0x1f')]=function(_0x5118f4,_0x5a2666){if(_0x5118f4['body']['id']){delete _0x5118f4[_0xf878('0x46')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x5118f4['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x5a2666,null))[_0xf878('0x20')](saveUpdates(_0x5118f4['body'],null))[_0xf878('0x20')](respondWithResult(_0x5a2666,null))[_0xf878('0x40')](handleError(_0x5a2666,null));};exports[_0xf878('0x21')]=function(_0x4ce441,_0x5eab57){return db[_0xf878('0x29')]['find']({'where':{'id':_0x4ce441[_0xf878('0x42')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x5eab57,null))[_0xf878('0x20')](removeEntity(_0x5eab57,null))[_0xf878('0x40')](handleError(_0x5eab57,null));};exports[_0xf878('0x4c')]=function(_0x344aa4,_0x57f635,_0x284132){return db[_0xf878('0x29')]['findOne']({'where':{'id':_0x344aa4[_0xf878('0x42')]['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x57f635,null))[_0xf878('0x20')](function(_0x282985){var _0x263f26;var _0x36b000={},_0x339141={};_0x339141['model']=_[_0xf878('0x2f')](db[_0xf878('0x4d')][_0xf878('0x2a')]);_0x339141['query']=_[_0xf878('0x2f')](_0x344aa4['query']);_0x339141[_0xf878('0x30')]=_[_0xf878('0x31')](_0x339141[_0xf878('0x2d')],_0x339141[_0xf878('0x2e')]);_0x36b000[_0xf878('0x32')]=_[_0xf878('0x31')](_0x339141[_0xf878('0x2d')],qs[_0xf878('0x33')](_0x344aa4[_0xf878('0x2e')][_0xf878('0x33')]));_0x36b000['attributes']=_0x36b000['attributes']['length']?_0x36b000[_0xf878('0x32')]:_0x339141['model'];if(!_0x344aa4[_0xf878('0x2e')][_0xf878('0x4e')]('nolimit')){_0x36b000['limit']=qs[_0xf878('0x19')](_0x344aa4[_0xf878('0x2e')][_0xf878('0x19')]);_0x36b000[_0xf878('0x17')]=qs[_0xf878('0x17')](_0x344aa4[_0xf878('0x2e')][_0xf878('0x17')]);}_0x36b000[_0xf878('0x36')]=qs[_0xf878('0x37')](_0x344aa4[_0xf878('0x2e')][_0xf878('0x37')]);_0x36b000[_0xf878('0x3a')]=qs[_0xf878('0x30')](_[_0xf878('0x38')](_0x344aa4[_0xf878('0x2e')],_0x339141[_0xf878('0x30')]));if(_0x344aa4[_0xf878('0x2e')][_0xf878('0x39')]){_0x36b000['where']=_[_0xf878('0x3b')](_0x36b000['where'],{'$or':_[_0xf878('0x28')](_0x36b000[_0xf878('0x32')],function(_0x2e8a57){var _0x910e78={};_0x910e78[_0x2e8a57]={'$like':'%'+_0x344aa4[_0xf878('0x2e')][_0xf878('0x39')]+'%'};return _0x910e78;})});}_0x36b000[_0xf878('0x3a')]=_[_0xf878('0x3b')](_0x36b000[_0xf878('0x3a')],{'mailboxuser':_0x282985['mailbox']});_0x36b000=_[_0xf878('0x3b')]({},_0x36b000,_0x344aa4[_0xf878('0x3d')]);return db[_0xf878('0x4d')][_0xf878('0x4f')](_0x36b000)['then'](respondWithFilteredResult(_0x57f635,_0x36b000));})[_0xf878('0x40')](handleError(_0x57f635,null));}; \ No newline at end of file +var _0xab40=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','VoiceMail','count','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','rawAttributes','fieldName','model','query','keys','filters'];(function(_0x1b00ed,_0x6fdd5a){var _0x27da4d=function(_0x5b2507){while(--_0x5b2507){_0x1b00ed['push'](_0x1b00ed['shift']());}};_0x27da4d(++_0x6fdd5a);}(_0xab40,0xcd));var _0x0ab4=function(_0x593f69,_0x2f8a47){_0x593f69=_0x593f69-0x0;var _0x2f4525=_0xab40[_0x593f69];return _0x2f4525;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){var _0x3caa9d=_0x13c882[_0x0ab4('0x20')]({'plain':!![]});var _0x4ea9aa='Voicemails';return db[_0x0ab4('0x21')][_0x0ab4('0x22')]({'where':{'type':_0x4ea9aa,'resourceId':_0x3caa9d['id']}})[_0x0ab4('0x1f')](function(){return _0x13c882;});})['then'](function(){_0x14087f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19ecc6,_0x5ba3a2){return function(_0x3bf844){if(!_0x3bf844){_0x19ecc6[_0x0ab4('0x15')](0x194);}return _0x3bf844;};}function handleError(_0x4f1aeb,_0x4bd747){_0x4bd747=_0x4bd747||0x1f4;return function(_0x4d0cc1){logger[_0x0ab4('0x23')](_0x4d0cc1[_0x0ab4('0x24')]);if(_0x4d0cc1[_0x0ab4('0x25')]){delete _0x4d0cc1[_0x0ab4('0x25')];}_0x4f1aeb[_0x0ab4('0x16')](_0x4bd747)['send'](_0x4d0cc1);};}exports['index']=function(_0x580d56,_0x2e7a97){var _0x2b66d5={},_0x155d96={},_0x182bbe={'count':0x0,'rows':[]};var _0x46eda7=_['map'](db['VoiceMail'][_0x0ab4('0x26')],function(_0xe6682){return{'name':_0xe6682[_0x0ab4('0x27')],'type':_0xe6682['type']['key']};});_0x155d96[_0x0ab4('0x28')]=_['map'](_0x46eda7,_0x0ab4('0x25'));_0x155d96[_0x0ab4('0x29')]=_[_0x0ab4('0x2a')](_0x580d56[_0x0ab4('0x29')]);_0x155d96[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x155d96['model'],_0x155d96[_0x0ab4('0x29')]);_0x2b66d5[_0x0ab4('0x2d')]=_[_0x0ab4('0x2c')](_0x155d96[_0x0ab4('0x28')],qs['fields'](_0x580d56['query'][_0x0ab4('0x2e')]));_0x2b66d5[_0x0ab4('0x2d')]=_0x2b66d5[_0x0ab4('0x2d')]['length']?_0x2b66d5['attributes']:_0x155d96['model'];if(!_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x2f')](_0x0ab4('0x30'))){_0x2b66d5['limit']=qs['limit'](_0x580d56['query'][_0x0ab4('0x1b')]);_0x2b66d5[_0x0ab4('0x19')]=qs[_0x0ab4('0x19')](_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x19')]);}_0x2b66d5[_0x0ab4('0x31')]=qs[_0x0ab4('0x32')](_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x32')]);_0x2b66d5[_0x0ab4('0x33')]=qs['filters'](_[_0x0ab4('0x34')](_0x580d56[_0x0ab4('0x29')],_0x155d96[_0x0ab4('0x2b')]),_0x46eda7);if(_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x35')]){_0x2b66d5[_0x0ab4('0x33')]=_[_0x0ab4('0x36')](_0x2b66d5[_0x0ab4('0x33')],{'$or':_[_0x0ab4('0x37')](_0x46eda7,function(_0x3774ca){if(_0x3774ca[_0x0ab4('0x38')]!==_0x0ab4('0x39')){var _0x4a05c4={};_0x4a05c4[_0x3774ca[_0x0ab4('0x25')]]={'$like':'%'+_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x35')]+'%'};return _0x4a05c4;}})});}_0x2b66d5=_[_0x0ab4('0x36')]({},_0x2b66d5,_0x580d56['options']);var _0x42bece={'where':_0x2b66d5['where']};return db[_0x0ab4('0x3a')][_0x0ab4('0x3b')](_0x42bece)[_0x0ab4('0x1f')](function(_0x245021){_0x182bbe[_0x0ab4('0x3b')]=_0x245021;if(_0x580d56[_0x0ab4('0x29')]['includeAll']){_0x2b66d5[_0x0ab4('0x3c')]=[{'all':!![]}];}return db[_0x0ab4('0x3a')][_0x0ab4('0x3d')](_0x2b66d5);})['then'](function(_0x395e0b){_0x182bbe[_0x0ab4('0x3e')]=_0x395e0b;return _0x182bbe;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x2e7a97,_0x2b66d5))[_0x0ab4('0x3f')](handleError(_0x2e7a97,null));};exports[_0x0ab4('0x40')]=function(_0x5aa047,_0x5d70eb){var _0x498845={'raw':!![],'where':{'id':_0x5aa047[_0x0ab4('0x41')]['id']}},_0x2f54dd={};_0x2f54dd['model']=_[_0x0ab4('0x2a')](db['VoiceMail'][_0x0ab4('0x26')]);_0x2f54dd['query']=_[_0x0ab4('0x2a')](_0x5aa047[_0x0ab4('0x29')]);_0x2f54dd[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x2f54dd[_0x0ab4('0x28')],_0x2f54dd[_0x0ab4('0x29')]);_0x498845['attributes']=_[_0x0ab4('0x2c')](_0x2f54dd[_0x0ab4('0x28')],qs[_0x0ab4('0x2e')](_0x5aa047[_0x0ab4('0x29')][_0x0ab4('0x2e')]));_0x498845[_0x0ab4('0x2d')]=_0x498845['attributes'][_0x0ab4('0x42')]?_0x498845['attributes']:_0x2f54dd[_0x0ab4('0x28')];if(_0x5aa047[_0x0ab4('0x29')][_0x0ab4('0x43')]){_0x498845['include']=[{'all':!![]}];}_0x498845=_[_0x0ab4('0x36')]({},_0x498845,_0x5aa047[_0x0ab4('0x44')]);return db[_0x0ab4('0x3a')][_0x0ab4('0x45')](_0x498845)[_0x0ab4('0x1f')](handleEntityNotFound(_0x5d70eb,null))[_0x0ab4('0x1f')](respondWithResult(_0x5d70eb,null))['catch'](handleError(_0x5d70eb,null));};exports[_0x0ab4('0x46')]=function(_0xdcc118,_0x302894){return db[_0x0ab4('0x3a')][_0x0ab4('0x46')](_0xdcc118[_0x0ab4('0x47')],{})[_0x0ab4('0x1f')](function(_0x356bc9){var _0x22402e=_0xdcc118[_0x0ab4('0x48')][_0x0ab4('0x20')]({'plain':!![]});if(!_0x22402e)throw new Error(_0x0ab4('0x49'));if(_0x22402e[_0x0ab4('0x4a')]==='user'){var _0x2c3a0a=_0x356bc9[_0x0ab4('0x20')]({'plain':!![]});var _0x5800cc=_0x0ab4('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x5800cc,'userProfileId':_0x22402e[_0x0ab4('0x4c')]},'raw':!![]})[_0x0ab4('0x1f')](function(_0x156e22){if(_0x156e22&&_0x156e22['autoAssociation']===0x0){return db[_0x0ab4('0x21')][_0x0ab4('0x46')]({'name':_0x2c3a0a[_0x0ab4('0x25')],'resourceId':_0x2c3a0a['id'],'type':_0x156e22[_0x0ab4('0x25')],'sectionId':_0x156e22['id']},{})[_0x0ab4('0x1f')](function(){return _0x356bc9;});}else{return _0x356bc9;}})[_0x0ab4('0x3f')](function(_0x1eea3b){logger['error'](_0x0ab4('0x4d'),_0x1eea3b);throw _0x1eea3b;});}return _0x356bc9;})['then'](respondWithResult(_0x302894,0xc9))[_0x0ab4('0x3f')](handleError(_0x302894,null));};exports['update']=function(_0x2597f2,_0x5550ff){if(_0x2597f2['body']['id']){delete _0x2597f2[_0x0ab4('0x47')]['id'];}return db[_0x0ab4('0x3a')][_0x0ab4('0x45')]({'where':{'id':_0x2597f2[_0x0ab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x5550ff,null))[_0x0ab4('0x1f')](saveUpdates(_0x2597f2[_0x0ab4('0x47')],null))[_0x0ab4('0x1f')](respondWithResult(_0x5550ff,null))[_0x0ab4('0x3f')](handleError(_0x5550ff,null));};exports[_0x0ab4('0x22')]=function(_0x2354fa,_0x134437){return db[_0x0ab4('0x3a')][_0x0ab4('0x45')]({'where':{'id':_0x2354fa[_0x0ab4('0x41')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x134437,null))[_0x0ab4('0x1f')](removeEntity(_0x134437,null))[_0x0ab4('0x3f')](handleError(_0x134437,null));};exports[_0x0ab4('0x4e')]=function(_0x438f38,_0x1e5635,_0x340558){return db[_0x0ab4('0x3a')][_0x0ab4('0x4f')]({'where':{'id':_0x438f38['params']['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x1e5635,null))[_0x0ab4('0x1f')](function(_0x3eba1e){var _0x308f7a;var _0x32e38c={},_0x3bcb90={};_0x3bcb90[_0x0ab4('0x28')]=_[_0x0ab4('0x2a')](db['VoiceMailMessage'][_0x0ab4('0x26')]);_0x3bcb90[_0x0ab4('0x29')]=_['keys'](_0x438f38['query']);_0x3bcb90[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x3bcb90['model'],_0x3bcb90['query']);_0x32e38c[_0x0ab4('0x2d')]=_['intersection'](_0x3bcb90['model'],qs[_0x0ab4('0x2e')](_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x2e')]));_0x32e38c[_0x0ab4('0x2d')]=_0x32e38c[_0x0ab4('0x2d')][_0x0ab4('0x42')]?_0x32e38c[_0x0ab4('0x2d')]:_0x3bcb90['model'];if(!_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x2f')](_0x0ab4('0x30'))){_0x32e38c[_0x0ab4('0x1b')]=qs[_0x0ab4('0x1b')](_0x438f38[_0x0ab4('0x29')]['limit']);_0x32e38c[_0x0ab4('0x19')]=qs[_0x0ab4('0x19')](_0x438f38['query'][_0x0ab4('0x19')]);}_0x32e38c['order']=qs[_0x0ab4('0x32')](_0x438f38['query'][_0x0ab4('0x32')]);_0x32e38c[_0x0ab4('0x33')]=qs[_0x0ab4('0x2b')](_[_0x0ab4('0x34')](_0x438f38['query'],_0x3bcb90['filters']));if(_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x35')]){_0x32e38c['where']=_[_0x0ab4('0x36')](_0x32e38c[_0x0ab4('0x33')],{'$or':_[_0x0ab4('0x37')](_0x32e38c['attributes'],function(_0x295490){var _0xd3fb04={};_0xd3fb04[_0x295490]={'$like':'%'+_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x35')]+'%'};return _0xd3fb04;})});}_0x32e38c[_0x0ab4('0x33')]=_[_0x0ab4('0x36')](_0x32e38c[_0x0ab4('0x33')],{'mailboxuser':_0x3eba1e[_0x0ab4('0x50')]});_0x32e38c=_['merge']({},_0x32e38c,_0x438f38['options']);return db[_0x0ab4('0x51')][_0x0ab4('0x52')](_0x32e38c)[_0x0ab4('0x1f')](respondWithFilteredResult(_0x1e5635,_0x32e38c));})[_0x0ab4('0x3f')](handleError(_0x1e5635,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6baba3f..a0f2945 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 _0xf4b7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash'];(function(_0x11547b,_0x73275a){var _0x107954=function(_0xa19cdb){while(--_0xa19cdb){_0x11547b['push'](_0x11547b['shift']());}};_0x107954(++_0x73275a);}(_0xf4b7,0x1a8));var _0x7f4b=function(_0x1b8bac,_0x44245a){_0x1b8bac=_0x1b8bac-0x0;var _0x1c022b=_0xf4b7[_0x1b8bac];return _0x1c022b;};'use strict';var _=require(_0x7f4b('0x0'));var util=require(_0x7f4b('0x1'));var logger=require(_0x7f4b('0x2'))(_0x7f4b('0x3'));var moment=require(_0x7f4b('0x4'));var BPromise=require(_0x7f4b('0x5'));var rp=require(_0x7f4b('0x6'));var fs=require('fs');var path=require(_0x7f4b('0x7'));var rimraf=require(_0x7f4b('0x8'));var config=require(_0x7f4b('0x9'));var attributes=require(_0x7f4b('0xa'));module[_0x7f4b('0xb')]=function(_0x1524bc,_0x244bd9){return _0x1524bc[_0x7f4b('0xc')](_0x7f4b('0xd'),attributes,{'tableName':_0x7f4b('0xe'),'paranoid':![],'indexes':[{'name':_0x7f4b('0xf'),'fields':['mailbox',_0x7f4b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fac=['request-promise','path','rimraf','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','util','../../config/logger','api','moment','bluebird'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x8fac,0x79));var _0xc8fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8fac[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xc8fa('0x0'));var logger=require(_0xc8fa('0x1'))(_0xc8fa('0x2'));var moment=require(_0xc8fa('0x3'));var BPromise=require(_0xc8fa('0x4'));var rp=require(_0xc8fa('0x5'));var fs=require('fs');var path=require(_0xc8fa('0x6'));var rimraf=require(_0xc8fa('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0xc8fa('0x8')]=function(_0x228d80,_0x5a2c75){return _0x228d80[_0xc8fa('0x9')](_0xc8fa('0xa'),attributes,{'tableName':_0xc8fa('0xb'),'paranoid':![],'indexes':[{'name':_0xc8fa('0xc'),'fields':[_0xc8fa('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index e9bd1d1..513d01c 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 _0x9bf1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x9bf1,0x1b8));var _0x19bf=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9bf1[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x19bf('0x0'));var util=require('util');var moment=require(_0x19bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x19bf('0x2'));var fs=require('fs');var Redis=require(_0x19bf('0x3'));var db=require(_0x19bf('0x4'))['db'];var utils=require(_0x19bf('0x5'));var logger=require('../../config/logger')(_0x19bf('0x6'));var config=require(_0x19bf('0x7'));var jayson=require(_0x19bf('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd8bdee,_0x1b869a,_0x235a6b){return new BPromise(function(_0x2af2d5,_0x5291ef){return client['request'](_0xd8bdee,_0x235a6b)['then'](function(_0x4f2801){logger[_0x19bf('0x9')](_0x19bf('0xa'),_0x1b869a,'request\x20sent');logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1b869a,_0x19bf('0xb'),JSON[_0x19bf('0xc')](_0x4f2801));if(_0x4f2801[_0x19bf('0xd')]){if(_0x4f2801[_0x19bf('0xd')][_0x19bf('0xe')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x1b869a,_0x4f2801[_0x19bf('0xd')][_0x19bf('0xf')]);return _0x5291ef(_0x4f2801[_0x19bf('0xd')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x1b869a,_0x4f2801[_0x19bf('0xd')][_0x19bf('0xf')]);return _0x2af2d5(_0x4f2801['error'][_0x19bf('0xf')]);}else{logger[_0x19bf('0x9')](_0x19bf('0xa'),_0x1b869a,_0x19bf('0xb'));_0x2af2d5(_0x4f2801['result'][_0x19bf('0xf')]);}})[_0x19bf('0x10')](function(_0x3a2933){logger['error'](_0x19bf('0xa'),_0x1b869a,_0x3a2933);_0x5291ef(_0x3a2933);});});} \ No newline at end of file +var _0x675a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch'];(function(_0x1833af,_0x4b9573){var _0x2104ff=function(_0x22bfb5){while(--_0x22bfb5){_0x1833af['push'](_0x1833af['shift']());}};_0x2104ff(++_0x4b9573);}(_0x675a,0x11d));var _0xa675=function(_0x295ec2,_0x5e4dee){_0x295ec2=_0x295ec2-0x0;var _0xe5d183=_0x675a[_0x295ec2];return _0xe5d183;};'use strict';var _=require(_0xa675('0x0'));var util=require(_0xa675('0x1'));var moment=require(_0xa675('0x2'));var BPromise=require('bluebird');var rs=require(_0xa675('0x3'));var fs=require('fs');var Redis=require(_0xa675('0x4'));var db=require(_0xa675('0x5'))['db'];var utils=require(_0xa675('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa675('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa675('0x8')][_0xa675('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37f3f1,_0xb2bf1f,_0x250796){return new BPromise(function(_0x327b3a,_0x11a5f6){return client['request'](_0x37f3f1,_0x250796)['then'](function(_0x3babb0){logger['info']('VoiceMail,\x20%s,\x20%s',_0xb2bf1f,_0xa675('0xa'));logger['debug'](_0xa675('0xb'),_0xb2bf1f,_0xa675('0xa'),JSON['stringify'](_0x3babb0));if(_0x3babb0[_0xa675('0xc')]){if(_0x3babb0['error'][_0xa675('0xd')]===0x1f4){logger[_0xa675('0xc')](_0xa675('0xe'),_0xb2bf1f,_0x3babb0[_0xa675('0xc')][_0xa675('0xf')]);return _0x11a5f6(_0x3babb0[_0xa675('0xc')][_0xa675('0xf')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xb2bf1f,_0x3babb0[_0xa675('0xc')][_0xa675('0xf')]);return _0x327b3a(_0x3babb0[_0xa675('0xc')]['message']);}else{logger[_0xa675('0x10')](_0xa675('0xe'),_0xb2bf1f,_0xa675('0xa'));_0x327b3a(_0x3babb0[_0xa675('0x11')][_0xa675('0xf')]);}})[_0xa675('0x12')](function(_0x30946d){logger[_0xa675('0xc')](_0xa675('0xe'),_0xb2bf1f,_0x30946d);_0x11a5f6(_0x30946d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0151462..0bd9718 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 _0x8731=['/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x6df55d,_0x7abc0d){var _0x2776cd=function(_0x185d7a){while(--_0x185d7a){_0x6df55d['push'](_0x6df55d['shift']());}};_0x2776cd(++_0x7abc0d);}(_0x8731,0x154));var _0x1873=function(_0x47886d,_0x2c27ce){_0x47886d=_0x47886d-0x0;var _0x8a06f4=_0x8731[_0x47886d];return _0x8a06f4;};'use strict';var multer=require('multer');var util=require(_0x1873('0x0'));var path=require(_0x1873('0x1'));var timeout=require(_0x1873('0x2'));var express=require(_0x1873('0x3'));var router=express[_0x1873('0x4')]();var fs_extra=require(_0x1873('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1873('0x6'));var config=require(_0x1873('0x7'));var controller=require(_0x1873('0x8'));router[_0x1873('0x9')]('/',auth[_0x1873('0xa')](),controller[_0x1873('0xb')]);router[_0x1873('0x9')](_0x1873('0xc'),auth[_0x1873('0xa')](),controller[_0x1873('0xd')]);router[_0x1873('0x9')](_0x1873('0xe'),auth[_0x1873('0xa')](),controller[_0x1873('0xf')]);router[_0x1873('0x10')]('/',auth['isAuthenticated'](),controller[_0x1873('0x11')]);router[_0x1873('0x12')](_0x1873('0xc'),auth[_0x1873('0xa')](),controller['update']);router[_0x1873('0x13')]('/:id',auth[_0x1873('0xa')](),controller[_0x1873('0x14')]);module[_0x1873('0x15')]=router; \ No newline at end of file +var _0xddcf=['/:id/download','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xddcf,0x105));var _0xfddc=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xddcf[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xfddc('0x0'));var path=require('path');var timeout=require(_0xfddc('0x1'));var express=require(_0xfddc('0x2'));var router=express[_0xfddc('0x3')]();var fs_extra=require(_0xfddc('0x4'));var auth=require(_0xfddc('0x5'));var interaction=require(_0xfddc('0x6'));var config=require(_0xfddc('0x7'));var controller=require(_0xfddc('0x8'));router['get']('/',auth[_0xfddc('0x9')](),controller[_0xfddc('0xa')]);router[_0xfddc('0xb')]('/:id',auth[_0xfddc('0x9')](),controller['show']);router[_0xfddc('0xb')](_0xfddc('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xfddc('0xd')]('/',auth['isAuthenticated'](),controller[_0xfddc('0xe')]);router[_0xfddc('0xf')](_0xfddc('0x10'),auth['isAuthenticated'](),controller[_0xfddc('0x11')]);router[_0xfddc('0x12')](_0xfddc('0x10'),auth[_0xfddc('0x9')](),controller[_0xfddc('0x13')]);module[_0xfddc('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5d2d81e..088bbbc 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 _0x00ef=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING'];(function(_0x32836f,_0x22c7ba){var _0xfdc9bf=function(_0x13dd64){while(--_0x13dd64){_0x32836f['push'](_0x32836f['shift']());}};_0xfdc9bf(++_0x22c7ba);}(_0x00ef,0x1b4));var _0xf00e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x00ef[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xf00e('0x0'));module[_0xf00e('0x1')]={'name':{'type':Sequelize[_0xf00e('0x2')],'get':function(_0x252b56){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xf00e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xf00e('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf00e('0x4')],'defaultValue':''},'stamp':{'type':_0xf00e('0x6'),'defaultValue':Sequelize[_0xf00e('0x7')](_0xf00e('0x8'))}}; \ No newline at end of file +var _0x0597=['TIMESTAMP','literal','exports','getDataValue','STRING','long'];(function(_0x21d5db,_0x184145){var _0x48556c=function(_0x5a0534){while(--_0x5a0534){_0x21d5db['push'](_0x21d5db['shift']());}};_0x48556c(++_0x184145);}(_0x0597,0x8c));var _0x7059=function(_0x282913,_0x19deb2){_0x282913=_0x282913-0x0;var _0x44db50=_0x0597[_0x282913];return _0x44db50;};'use strict';var Sequelize=require('sequelize');module[_0x7059('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x20e337){return this[_0x7059('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7059('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x7059('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x7059('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x7059('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7059('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7059('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x7059('0x3')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7059('0x4'),'defaultValue':Sequelize[_0x7059('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c9999a2..1ef7616 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 _0xb5ef=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','VoiceMailMessage','fieldName','type','differenceBy','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','msg_id','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb5ef,0x18e));var _0xfb5e=function(_0x3a07c4,_0x13ab5e){_0x3a07c4=_0x3a07c4-0x0;var _0x59a7fd=_0xb5ef[_0x3a07c4];return _0x59a7fd;};'use strict';var emlformat=require(_0xfb5e('0x0'));var rimraf=require(_0xfb5e('0x1'));var zipdir=require(_0xfb5e('0x2'));var jsonpatch=require(_0xfb5e('0x3'));var rp=require('request-promise');var moment=require(_0xfb5e('0x4'));var BPromise=require(_0xfb5e('0x5'));var Mustache=require('mustache');var util=require(_0xfb5e('0x6'));var path=require(_0xfb5e('0x7'));var sox=require(_0xfb5e('0x8'));var csv=require('to-csv');var ejs=require(_0xfb5e('0x9'));var fs=require('fs');var fs_extra=require(_0xfb5e('0xa'));var _=require(_0xfb5e('0xb'));var squel=require(_0xfb5e('0xc'));var crypto=require(_0xfb5e('0xd'));var jsforce=require(_0xfb5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfb5e('0xf'));var querystring=require(_0xfb5e('0x10'));var Papa=require('papaparse');var Redis=require(_0xfb5e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfb5e('0x12'));var as=require(_0xfb5e('0x13'));var hardwareService=require(_0xfb5e('0x14'));var logger=require(_0xfb5e('0x15'))(_0xfb5e('0x16'));var utils=require(_0xfb5e('0x17'));var config=require(_0xfb5e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39f36b,_0x307c52){_0x307c52=_0x307c52||0xcc;return function(_0x3d9ac6){if(_0x3d9ac6){return _0x39f36b['sendStatus'](_0x307c52);}return _0x39f36b[_0xfb5e('0x19')](_0x307c52)[_0xfb5e('0x1a')]();};}function respondWithResult(_0x1c1d98,_0x1a9840){_0x1a9840=_0x1a9840||0xc8;return function(_0xd10351){if(_0xd10351){return _0x1c1d98[_0xfb5e('0x19')](_0x1a9840)[_0xfb5e('0x1b')](_0xd10351);}};}function respondWithFilteredResult(_0x145d98,_0x24acd8){return function(_0x58f6f3){if(_0x58f6f3){var _0x1b898d=typeof _0x24acd8['offset']===_0xfb5e('0x1c')&&typeof _0x24acd8[_0xfb5e('0x1d')]==='undefined';var _0x4db6f9=_0x58f6f3[_0xfb5e('0x1e')];var _0x384926=_0x1b898d?0x0:_0x24acd8[_0xfb5e('0x1f')];var _0x583f48=_0x1b898d?_0x58f6f3[_0xfb5e('0x1e')]:_0x24acd8[_0xfb5e('0x1f')]+_0x24acd8[_0xfb5e('0x1d')];var _0x4a688d;if(_0x583f48>=_0x4db6f9){_0x583f48=_0x4db6f9;_0x4a688d=0xc8;}else{_0x4a688d=0xce;}_0x145d98[_0xfb5e('0x19')](_0x4a688d);return _0x145d98[_0xfb5e('0x20')](_0xfb5e('0x21'),_0x384926+'-'+_0x583f48+'/'+_0x4db6f9)['json'](_0x58f6f3);}return null;};}function patchUpdates(_0x187458){return function(_0x457ab8){try{jsonpatch[_0xfb5e('0x22')](_0x457ab8,_0x187458,!![]);}catch(_0x1b49fd){return BPromise[_0xfb5e('0x23')](_0x1b49fd);}return _0x457ab8[_0xfb5e('0x24')]();};}function saveUpdates(_0x39faf4,_0x3a1084){return function(_0x249b16){if(_0x249b16){return _0x249b16[_0xfb5e('0x25')](_0x39faf4)[_0xfb5e('0x26')](function(_0x364dea){return _0x364dea;});}return null;};}function removeEntity(_0x102d68,_0x1ebc63){return function(_0x300f9f){if(_0x300f9f){return _0x300f9f[_0xfb5e('0x27')]()[_0xfb5e('0x26')](function(){_0x102d68[_0xfb5e('0x19')](0xcc)[_0xfb5e('0x1a')]();});}};}function handleEntityNotFound(_0x44cc62,_0x2abcc2){return function(_0x286fc6){if(!_0x286fc6){_0x44cc62[_0xfb5e('0x28')](0x194);}return _0x286fc6;};}function handleError(_0x1e73f0,_0x2978e8){_0x2978e8=_0x2978e8||0x1f4;return function(_0x15b1b9){logger[_0xfb5e('0x29')](_0x15b1b9[_0xfb5e('0x2a')]);if(_0x15b1b9['name']){delete _0x15b1b9['name'];}_0x1e73f0[_0xfb5e('0x19')](_0x2978e8)[_0xfb5e('0x2b')](_0x15b1b9);};}exports[_0xfb5e('0x2c')]=function(_0x59475a,_0x559aee){var _0x36550d={},_0x581148={},_0x34aeec={'count':0x0,'rows':[]};var _0x4a4ffa=_[_0xfb5e('0x2d')](db[_0xfb5e('0x2e')]['rawAttributes'],function(_0x559420){return{'name':_0x559420[_0xfb5e('0x2f')],'type':_0x559420[_0xfb5e('0x30')]['key']};});_0x581148['model']=_[_0xfb5e('0x31')](_[_0xfb5e('0x2d')](_0x4a4ffa,_0xfb5e('0x32')),[_0xfb5e('0x32')]);_0x581148[_0xfb5e('0x33')]=_[_0xfb5e('0x34')](_0x59475a[_0xfb5e('0x33')]);_0x581148[_0xfb5e('0x35')]=_[_0xfb5e('0x36')](_0x581148[_0xfb5e('0x37')],_0x581148[_0xfb5e('0x33')]);_0x36550d['attributes']=_['intersection'](_0x581148[_0xfb5e('0x37')],qs['fields'](_0x59475a[_0xfb5e('0x33')][_0xfb5e('0x38')]));_0x36550d[_0xfb5e('0x39')]=_0x36550d['attributes'][_0xfb5e('0x3a')]?_0x36550d[_0xfb5e('0x39')]:_0x581148[_0xfb5e('0x37')];if(!_0x59475a[_0xfb5e('0x33')][_0xfb5e('0x3b')]('nolimit')){_0x36550d[_0xfb5e('0x1d')]=qs[_0xfb5e('0x1d')](_0x59475a[_0xfb5e('0x33')]['limit']);_0x36550d['offset']=qs[_0xfb5e('0x1f')](_0x59475a['query'][_0xfb5e('0x1f')]);}_0x36550d[_0xfb5e('0x3c')]=qs[_0xfb5e('0x3d')](_0x59475a['query']['sort']);_0x36550d[_0xfb5e('0x3e')]=qs['filters'](_[_0xfb5e('0x3f')](_0x59475a[_0xfb5e('0x33')],_0x581148[_0xfb5e('0x35')]),_0x4a4ffa);if(_0x59475a[_0xfb5e('0x33')][_0xfb5e('0x40')]){_0x36550d[_0xfb5e('0x3e')]=_['merge'](_0x36550d[_0xfb5e('0x3e')],{'$or':_[_0xfb5e('0x2d')](_0x4a4ffa,function(_0x5e75fe){if(_0x5e75fe['type']!==_0xfb5e('0x41')){var _0x5bad30={};_0x5bad30[_0x5e75fe[_0xfb5e('0x32')]]={'$like':'%'+_0x59475a['query'][_0xfb5e('0x40')]+'%'};return _0x5bad30;}})});}_0x36550d=_[_0xfb5e('0x42')]({},_0x36550d,_0x59475a[_0xfb5e('0x43')]);var _0x2ea4ff={'where':_0x36550d[_0xfb5e('0x3e')]};return db['VoiceMailMessage']['count'](_0x2ea4ff)[_0xfb5e('0x26')](function(_0x10fa5d){_0x34aeec[_0xfb5e('0x1e')]=_0x10fa5d;if(_0x59475a['query']['includeAll']){_0x36550d['include']=[{'all':!![]}];}return db[_0xfb5e('0x2e')][_0xfb5e('0x44')](_0x36550d);})['then'](function(_0x287e7e){_0x34aeec[_0xfb5e('0x45')]=_0x287e7e;return _0x34aeec;})['then'](respondWithFilteredResult(_0x559aee,_0x36550d))['catch'](handleError(_0x559aee,null));};exports[_0xfb5e('0x46')]=function(_0x47bf24,_0x3256f8){var _0x29bc50={'raw':!![],'where':{'id':_0x47bf24[_0xfb5e('0x47')]['id']}},_0x2cd6c4={};_0x2cd6c4[_0xfb5e('0x37')]=_['keys'](db[_0xfb5e('0x2e')][_0xfb5e('0x48')]);_0x2cd6c4[_0xfb5e('0x33')]=_[_0xfb5e('0x34')](_0x47bf24[_0xfb5e('0x33')]);_0x2cd6c4[_0xfb5e('0x35')]=_[_0xfb5e('0x36')](_0x2cd6c4[_0xfb5e('0x37')],_0x2cd6c4[_0xfb5e('0x33')]);_0x29bc50['attributes']=_[_0xfb5e('0x36')](_0x2cd6c4[_0xfb5e('0x37')],qs[_0xfb5e('0x38')](_0x47bf24[_0xfb5e('0x33')]['fields']));_0x29bc50[_0xfb5e('0x39')]=_0x29bc50[_0xfb5e('0x39')]['length']?_0x29bc50['attributes']:_0x2cd6c4[_0xfb5e('0x37')];if(_0x47bf24[_0xfb5e('0x33')]['includeAll']){_0x29bc50[_0xfb5e('0x49')]=[{'all':!![]}];}_0x29bc50=_[_0xfb5e('0x42')]({},_0x29bc50,_0x47bf24[_0xfb5e('0x43')]);return db[_0xfb5e('0x2e')][_0xfb5e('0x4a')](_0x29bc50)[_0xfb5e('0x26')](handleEntityNotFound(_0x3256f8,null))[_0xfb5e('0x26')](respondWithResult(_0x3256f8,null))[_0xfb5e('0x4b')](handleError(_0x3256f8,null));};exports[_0xfb5e('0x4c')]=function(_0x2dbb75,_0x21b94a){return db['VoiceMailMessage'][_0xfb5e('0x4c')](_0x2dbb75['body'],{})[_0xfb5e('0x26')](respondWithResult(_0x21b94a,0xc9))[_0xfb5e('0x4b')](handleError(_0x21b94a,null));};exports[_0xfb5e('0x25')]=function(_0x484146,_0x138ef1){if(_0x484146[_0xfb5e('0x4d')]['id']){delete _0x484146['body']['id'];}return db[_0xfb5e('0x2e')][_0xfb5e('0x4a')]({'where':{'id':_0x484146[_0xfb5e('0x47')]['id']}})[_0xfb5e('0x26')](handleEntityNotFound(_0x138ef1,null))['then'](saveUpdates(_0x484146[_0xfb5e('0x4d')],null))[_0xfb5e('0x26')](respondWithResult(_0x138ef1,null))[_0xfb5e('0x4b')](handleError(_0x138ef1,null));};exports[_0xfb5e('0x27')]=function(_0x3f4f1c,_0x5e0348){return db[_0xfb5e('0x2e')][_0xfb5e('0x4a')]({'where':{'id':_0x3f4f1c[_0xfb5e('0x47')]['id']}})[_0xfb5e('0x26')](handleEntityNotFound(_0x5e0348,null))[_0xfb5e('0x26')](removeEntity(_0x5e0348,null))[_0xfb5e('0x4b')](handleError(_0x5e0348,null));};exports['download']=function(_0x50377d,_0x51886b,_0xfbeb70){return db[_0xfb5e('0x2e')][_0xfb5e('0x4a')]({'where':{'id':_0x50377d['params']['id']},'attributes':['id',_0xfb5e('0x4e'),'msg_id']})['then'](handleEntityNotFound(_0x51886b,null))[_0xfb5e('0x26')](function(_0x5e8c33){if(_0x5e8c33){if(!_0x5e8c33[_0xfb5e('0x4e')]){throw new db[(_0xfb5e('0x4f'))][(_0xfb5e('0x50'))](_0xfb5e('0x51'));}var _0x5bbd5b={'Content-Type':'audio/wav','Content-Disposition':_0xfb5e('0x52')};if(_0x5e8c33[_0xfb5e('0x53')]){_0x5bbd5b['Content-Disposition']=_0xfb5e('0x54')+_0x5e8c33['msg_id']+'.wav\x22';}_0x51886b['set'](_0x5bbd5b);return _0x51886b[_0xfb5e('0x2b')](new Buffer(_0x5e8c33['recording']));}})[_0xfb5e('0x4b')](handleError(_0x51886b,null));}; \ No newline at end of file +var _0x1b59=['order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','include','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x5c634b,_0x39cb67){var _0x1844d7=function(_0x478c88){while(--_0x478c88){_0x5c634b['push'](_0x5c634b['shift']());}};_0x1844d7(++_0x39cb67);}(_0x1b59,0x11f));var _0x91b5=function(_0x5e39d0,_0x15516e){_0x5e39d0=_0x5e39d0-0x0;var _0xfd2079=_0x1b59[_0x5e39d0];return _0xfd2079;};'use strict';var emlformat=require(_0x91b5('0x0'));var rimraf=require(_0x91b5('0x1'));var zipdir=require(_0x91b5('0x2'));var jsonpatch=require(_0x91b5('0x3'));var rp=require('request-promise');var moment=require(_0x91b5('0x4'));var BPromise=require(_0x91b5('0x5'));var Mustache=require('mustache');var util=require(_0x91b5('0x6'));var path=require(_0x91b5('0x7'));var sox=require(_0x91b5('0x8'));var csv=require(_0x91b5('0x9'));var ejs=require(_0x91b5('0xa'));var fs=require('fs');var fs_extra=require(_0x91b5('0xb'));var _=require('lodash');var squel=require(_0x91b5('0xc'));var crypto=require(_0x91b5('0xd'));var jsforce=require(_0x91b5('0xe'));var deskjs=require(_0x91b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x91b5('0x10'));var Papa=require('papaparse');var Redis=require(_0x91b5('0x11'));var authService=require(_0x91b5('0x12'));var qs=require(_0x91b5('0x13'));var as=require(_0x91b5('0x14'));var hardwareService=require(_0x91b5('0x15'));var logger=require(_0x91b5('0x16'))(_0x91b5('0x17'));var utils=require(_0x91b5('0x18'));var config=require(_0x91b5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x91b5('0x1a'))['db'];function respondWithStatusCode(_0xf8f152,_0x17548d){_0x17548d=_0x17548d||0xcc;return function(_0xde57e3){if(_0xde57e3){return _0xf8f152[_0x91b5('0x1b')](_0x17548d);}return _0xf8f152['status'](_0x17548d)[_0x91b5('0x1c')]();};}function respondWithResult(_0x2aa2ae,_0x475459){_0x475459=_0x475459||0xc8;return function(_0x3fcf97){if(_0x3fcf97){return _0x2aa2ae[_0x91b5('0x1d')](_0x475459)[_0x91b5('0x1e')](_0x3fcf97);}};}function respondWithFilteredResult(_0x2e14d0,_0x96cfb5){return function(_0x545c28){if(_0x545c28){var _0x42bddc=typeof _0x96cfb5[_0x91b5('0x1f')]===_0x91b5('0x20')&&typeof _0x96cfb5[_0x91b5('0x21')]==='undefined';var _0x504fa6=_0x545c28[_0x91b5('0x22')];var _0x3411d4=_0x42bddc?0x0:_0x96cfb5[_0x91b5('0x1f')];var _0x5f476f=_0x42bddc?_0x545c28[_0x91b5('0x22')]:_0x96cfb5[_0x91b5('0x1f')]+_0x96cfb5['limit'];var _0x4fed86;if(_0x5f476f>=_0x504fa6){_0x5f476f=_0x504fa6;_0x4fed86=0xc8;}else{_0x4fed86=0xce;}_0x2e14d0[_0x91b5('0x1d')](_0x4fed86);return _0x2e14d0[_0x91b5('0x23')](_0x91b5('0x24'),_0x3411d4+'-'+_0x5f476f+'/'+_0x504fa6)[_0x91b5('0x1e')](_0x545c28);}return null;};}function patchUpdates(_0x1d0c18){return function(_0xea885b){try{jsonpatch[_0x91b5('0x25')](_0xea885b,_0x1d0c18,!![]);}catch(_0x52c2d5){return BPromise[_0x91b5('0x26')](_0x52c2d5);}return _0xea885b[_0x91b5('0x27')]();};}function saveUpdates(_0x206ead,_0xb5aed5){return function(_0x4d0223){if(_0x4d0223){return _0x4d0223[_0x91b5('0x28')](_0x206ead)[_0x91b5('0x29')](function(_0x44ab28){return _0x44ab28;});}return null;};}function removeEntity(_0x136db5,_0x54e850){return function(_0x1a6665){if(_0x1a6665){return _0x1a6665['destroy']()[_0x91b5('0x29')](function(){_0x136db5['status'](0xcc)[_0x91b5('0x1c')]();});}};}function handleEntityNotFound(_0x1b33a2,_0xce48ea){return function(_0x5109ad){if(!_0x5109ad){_0x1b33a2[_0x91b5('0x1b')](0x194);}return _0x5109ad;};}function handleError(_0x48b75b,_0x59310a){_0x59310a=_0x59310a||0x1f4;return function(_0x281c77){logger[_0x91b5('0x2a')](_0x281c77[_0x91b5('0x2b')]);if(_0x281c77['name']){delete _0x281c77[_0x91b5('0x2c')];}_0x48b75b[_0x91b5('0x1d')](_0x59310a)[_0x91b5('0x2d')](_0x281c77);};}exports[_0x91b5('0x2e')]=function(_0x4c54c7,_0x29ccc9){var _0x37c307={},_0x4c2494={},_0x25da6d={'count':0x0,'rows':[]};var _0x2a60cb=_['map'](db[_0x91b5('0x2f')][_0x91b5('0x30')],function(_0x40bea4){return{'name':_0x40bea4[_0x91b5('0x31')],'type':_0x40bea4[_0x91b5('0x32')][_0x91b5('0x33')]};});_0x4c2494[_0x91b5('0x34')]=_[_0x91b5('0x35')](_[_0x91b5('0x36')](_0x2a60cb,_0x91b5('0x2c')),[_0x91b5('0x2c')]);_0x4c2494[_0x91b5('0x37')]=_['keys'](_0x4c54c7[_0x91b5('0x37')]);_0x4c2494['filters']=_[_0x91b5('0x38')](_0x4c2494[_0x91b5('0x34')],_0x4c2494['query']);_0x37c307[_0x91b5('0x39')]=_[_0x91b5('0x38')](_0x4c2494[_0x91b5('0x34')],qs['fields'](_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x3a')]));_0x37c307[_0x91b5('0x39')]=_0x37c307['attributes'][_0x91b5('0x3b')]?_0x37c307['attributes']:_0x4c2494[_0x91b5('0x34')];if(!_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x3c')]('nolimit')){_0x37c307['limit']=qs[_0x91b5('0x21')](_0x4c54c7['query'][_0x91b5('0x21')]);_0x37c307[_0x91b5('0x1f')]=qs['offset'](_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x1f')]);}_0x37c307[_0x91b5('0x3d')]=qs[_0x91b5('0x3e')](_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x3e')]);_0x37c307[_0x91b5('0x3f')]=qs[_0x91b5('0x40')](_['pick'](_0x4c54c7[_0x91b5('0x37')],_0x4c2494['filters']),_0x2a60cb);if(_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x41')]){_0x37c307[_0x91b5('0x3f')]=_['merge'](_0x37c307['where'],{'$or':_['map'](_0x2a60cb,function(_0x1a0411){if(_0x1a0411[_0x91b5('0x32')]!==_0x91b5('0x42')){var _0x645ab7={};_0x645ab7[_0x1a0411[_0x91b5('0x2c')]]={'$like':'%'+_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x41')]+'%'};return _0x645ab7;}})});}_0x37c307=_[_0x91b5('0x43')]({},_0x37c307,_0x4c54c7[_0x91b5('0x44')]);var _0x1aa9e4={'where':_0x37c307[_0x91b5('0x3f')]};return db[_0x91b5('0x2f')][_0x91b5('0x22')](_0x1aa9e4)['then'](function(_0x255c71){_0x25da6d[_0x91b5('0x22')]=_0x255c71;if(_0x4c54c7[_0x91b5('0x37')][_0x91b5('0x45')]){_0x37c307['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x91b5('0x46')](_0x37c307);})[_0x91b5('0x29')](function(_0x303cc3){_0x25da6d['rows']=_0x303cc3;return _0x25da6d;})[_0x91b5('0x29')](respondWithFilteredResult(_0x29ccc9,_0x37c307))[_0x91b5('0x47')](handleError(_0x29ccc9,null));};exports[_0x91b5('0x48')]=function(_0x3d102c,_0x30f285){var _0x562e70={'raw':!![],'where':{'id':_0x3d102c[_0x91b5('0x49')]['id']}},_0x287f9f={};_0x287f9f[_0x91b5('0x34')]=_[_0x91b5('0x4a')](db[_0x91b5('0x2f')][_0x91b5('0x30')]);_0x287f9f[_0x91b5('0x37')]=_['keys'](_0x3d102c['query']);_0x287f9f[_0x91b5('0x40')]=_[_0x91b5('0x38')](_0x287f9f[_0x91b5('0x34')],_0x287f9f[_0x91b5('0x37')]);_0x562e70['attributes']=_[_0x91b5('0x38')](_0x287f9f['model'],qs[_0x91b5('0x3a')](_0x3d102c[_0x91b5('0x37')][_0x91b5('0x3a')]));_0x562e70[_0x91b5('0x39')]=_0x562e70[_0x91b5('0x39')][_0x91b5('0x3b')]?_0x562e70['attributes']:_0x287f9f['model'];if(_0x3d102c[_0x91b5('0x37')]['includeAll']){_0x562e70[_0x91b5('0x4b')]=[{'all':!![]}];}_0x562e70=_[_0x91b5('0x43')]({},_0x562e70,_0x3d102c[_0x91b5('0x44')]);return db[_0x91b5('0x2f')]['find'](_0x562e70)[_0x91b5('0x29')](handleEntityNotFound(_0x30f285,null))[_0x91b5('0x29')](respondWithResult(_0x30f285,null))[_0x91b5('0x47')](handleError(_0x30f285,null));};exports[_0x91b5('0x4c')]=function(_0x2c77d6,_0x3500a8){return db[_0x91b5('0x2f')][_0x91b5('0x4c')](_0x2c77d6[_0x91b5('0x4d')],{})[_0x91b5('0x29')](respondWithResult(_0x3500a8,0xc9))[_0x91b5('0x47')](handleError(_0x3500a8,null));};exports[_0x91b5('0x28')]=function(_0x3fc38b,_0x3063f5){if(_0x3fc38b[_0x91b5('0x4d')]['id']){delete _0x3fc38b[_0x91b5('0x4d')]['id'];}return db['VoiceMailMessage'][_0x91b5('0x4e')]({'where':{'id':_0x3fc38b['params']['id']}})['then'](handleEntityNotFound(_0x3063f5,null))[_0x91b5('0x29')](saveUpdates(_0x3fc38b[_0x91b5('0x4d')],null))[_0x91b5('0x29')](respondWithResult(_0x3063f5,null))[_0x91b5('0x47')](handleError(_0x3063f5,null));};exports['destroy']=function(_0x257d4a,_0x475f21){return db['VoiceMailMessage'][_0x91b5('0x4e')]({'where':{'id':_0x257d4a[_0x91b5('0x49')]['id']}})[_0x91b5('0x29')](handleEntityNotFound(_0x475f21,null))[_0x91b5('0x29')](removeEntity(_0x475f21,null))['catch'](handleError(_0x475f21,null));};exports[_0x91b5('0x4f')]=function(_0x4e076f,_0x8e211f,_0x34e8df){return db[_0x91b5('0x2f')][_0x91b5('0x4e')]({'where':{'id':_0x4e076f['params']['id']},'attributes':['id',_0x91b5('0x50'),_0x91b5('0x51')]})['then'](handleEntityNotFound(_0x8e211f,null))['then'](function(_0x272e72){if(_0x272e72){if(!_0x272e72['recording']){throw new db[(_0x91b5('0x52'))][(_0x91b5('0x53'))](_0x91b5('0x54'));}var _0x48c776={'Content-Type':_0x91b5('0x55'),'Content-Disposition':_0x91b5('0x56')};if(_0x272e72[_0x91b5('0x51')]){_0x48c776['Content-Disposition']='attachment;\x20filename=\x22'+_0x272e72['msg_id']+'.wav\x22';}_0x8e211f['set'](_0x48c776);return _0x8e211f[_0x91b5('0x2d')](new Buffer(_0x272e72[_0x91b5('0x50')]));}})[_0x91b5('0x47')](handleError(_0x8e211f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f1983c3..2ffd29f 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 _0x98b9=['bluebird','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','util','../../config/logger','moment'];(function(_0x2e0646,_0x23ce05){var _0x32926c=function(_0x331bc1){while(--_0x331bc1){_0x2e0646['push'](_0x2e0646['shift']());}};_0x32926c(++_0x23ce05);}(_0x98b9,0x9d));var _0x998b=function(_0x5e1e37,_0xbaf935){_0x5e1e37=_0x5e1e37-0x0;var _0x1cebf5=_0x98b9[_0x5e1e37];return _0x1cebf5;};'use strict';var _=require('lodash');var util=require(_0x998b('0x0'));var logger=require(_0x998b('0x1'))('api');var moment=require(_0x998b('0x2'));var BPromise=require(_0x998b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x998b('0x4'));var attributes=require(_0x998b('0x5'));module[_0x998b('0x6')]=function(_0x401090,_0x4f4349){return _0x401090[_0x998b('0x7')]('VoiceMailMessage',attributes,{'tableName':_0x998b('0x8'),'paranoid':![],'indexes':[{'name':_0x998b('0x9'),'fields':[_0x998b('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6856=['voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMailMessage'];(function(_0x2be5d6,_0x217fd6){var _0x25833a=function(_0xd3b2e2){while(--_0xd3b2e2){_0x2be5d6['push'](_0x2be5d6['shift']());}};_0x25833a(++_0x217fd6);}(_0x6856,0x1af));var _0x6685=function(_0x54679b,_0x22ab33){_0x54679b=_0x54679b-0x0;var _0x72a78e=_0x6856[_0x54679b];return _0x72a78e;};'use strict';var _=require(_0x6685('0x0'));var util=require(_0x6685('0x1'));var logger=require(_0x6685('0x2'))('api');var moment=require(_0x6685('0x3'));var BPromise=require(_0x6685('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6685('0x5'));var rimraf=require(_0x6685('0x6'));var config=require(_0x6685('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x6685('0x8')]=function(_0x3562b3,_0x374082){return _0x3562b3[_0x6685('0x9')](_0x6685('0xa'),attributes,{'tableName':_0x6685('0xb'),'paranoid':![],'indexes':[{'name':_0x6685('0xc'),'fields':[_0x6685('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9319637..3524d27 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 _0xfebc=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0xfebc,0x11a));var _0xcfeb=function(_0x4060b4,_0x82eb25){_0x4060b4=_0x4060b4-0x0;var _0x32aaa1=_0xfebc[_0x4060b4];return _0x32aaa1;};'use strict';var _=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var moment=require(_0xcfeb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfeb('0x3'));var fs=require('fs');var Redis=require(_0xcfeb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcfeb('0x5'))(_0xcfeb('0x6'));var config=require(_0xcfeb('0x7'));var jayson=require(_0xcfeb('0x8'));var client=jayson[_0xcfeb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26d150,_0x22e8cd,_0x3c6f48){return new BPromise(function(_0x2ed404,_0x1d648d){return client[_0xcfeb('0xa')](_0x26d150,_0x3c6f48)[_0xcfeb('0xb')](function(_0x563bbb){logger[_0xcfeb('0xc')](_0xcfeb('0xd'),_0x22e8cd,_0xcfeb('0xe'));logger[_0xcfeb('0xf')](_0xcfeb('0x10'),_0x22e8cd,_0xcfeb('0xe'),JSON[_0xcfeb('0x11')](_0x563bbb));if(_0x563bbb[_0xcfeb('0x12')]){if(_0x563bbb['error']['code']===0x1f4){logger[_0xcfeb('0x12')](_0xcfeb('0xd'),_0x22e8cd,_0x563bbb['error'][_0xcfeb('0x13')]);return _0x1d648d(_0x563bbb['error'][_0xcfeb('0x13')]);}logger[_0xcfeb('0x12')](_0xcfeb('0xd'),_0x22e8cd,_0x563bbb['error'][_0xcfeb('0x13')]);return _0x2ed404(_0x563bbb['error']['message']);}else{logger[_0xcfeb('0xc')](_0xcfeb('0xd'),_0x22e8cd,_0xcfeb('0xe'));_0x2ed404(_0x563bbb[_0xcfeb('0x14')]['message']);}})[_0xcfeb('0x15')](function(_0x41dbe9){logger[_0xcfeb('0x12')](_0xcfeb('0xd'),_0x22e8cd,_0x41dbe9);_0x1d648d(_0x41dbe9);});});} \ No newline at end of file +var _0xa3a7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x144d8f,_0x4fe1d0){var _0x1c0fec=function(_0x13c029){while(--_0x13c029){_0x144d8f['push'](_0x144d8f['shift']());}};_0x1c0fec(++_0x4fe1d0);}(_0xa3a7,0x68));var _0x7a3a=function(_0x2544b4,_0x4f5ab1){_0x2544b4=_0x2544b4-0x0;var _0x5c2716=_0xa3a7[_0x2544b4];return _0x5c2716;};'use strict';var _=require(_0x7a3a('0x0'));var util=require(_0x7a3a('0x1'));var moment=require(_0x7a3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a3a('0x3'));var fs=require('fs');var Redis=require(_0x7a3a('0x4'));var db=require(_0x7a3a('0x5'))['db'];var utils=require(_0x7a3a('0x6'));var logger=require(_0x7a3a('0x7'))(_0x7a3a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a3a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b27c1,_0x3c6d5c,_0x3e374c){return new BPromise(function(_0x3b1dc9,_0x1ec051){return client[_0x7a3a('0xa')](_0x4b27c1,_0x3e374c)['then'](function(_0xb953c4){logger['info'](_0x7a3a('0xb'),_0x3c6d5c,_0x7a3a('0xc'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3c6d5c,_0x7a3a('0xc'),JSON[_0x7a3a('0xd')](_0xb953c4));if(_0xb953c4[_0x7a3a('0xe')]){if(_0xb953c4[_0x7a3a('0xe')]['code']===0x1f4){logger['error'](_0x7a3a('0xb'),_0x3c6d5c,_0xb953c4[_0x7a3a('0xe')]['message']);return _0x1ec051(_0xb953c4[_0x7a3a('0xe')][_0x7a3a('0xf')]);}logger[_0x7a3a('0xe')](_0x7a3a('0xb'),_0x3c6d5c,_0xb953c4[_0x7a3a('0xe')]['message']);return _0x3b1dc9(_0xb953c4[_0x7a3a('0xe')][_0x7a3a('0xf')]);}else{logger['info'](_0x7a3a('0xb'),_0x3c6d5c,'request\x20sent');_0x3b1dc9(_0xb953c4[_0x7a3a('0x10')]['message']);}})[_0x7a3a('0x11')](function(_0x1883ff){logger[_0x7a3a('0xe')](_0x7a3a('0xb'),_0x3c6d5c,_0x1883ff);_0x1ec051(_0x1883ff);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a88e795..1b7b365 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 _0x372b=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x372b,0xce));var _0xb372=function(_0x185ee0,_0x375b6d){_0x185ee0=_0x185ee0-0x0;var _0xfdc67d=_0x372b[_0x185ee0];return _0xfdc67d;};'use strict';var multer=require(_0xb372('0x0'));var util=require(_0xb372('0x1'));var path=require(_0xb372('0x2'));var timeout=require(_0xb372('0x3'));var express=require(_0xb372('0x4'));var router=express['Router']();var fs_extra=require(_0xb372('0x5'));var auth=require(_0xb372('0x6'));var interaction=require(_0xb372('0x7'));var config=require(_0xb372('0x8'));var controller=require(_0xb372('0x9'));router[_0xb372('0xa')]('/',auth[_0xb372('0xb')](),controller['index']);router[_0xb372('0xa')](_0xb372('0xc'),auth[_0xb372('0xb')](),controller['show']);router['get'](_0xb372('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0xb372('0xe')]('/',auth[_0xb372('0xb')](),controller[_0xb372('0xf')]);router[_0xb372('0xe')]('/:id/sounds',auth[_0xb372('0xb')](),controller['addSound']);router['put'](_0xb372('0xc'),auth[_0xb372('0xb')](),controller[_0xb372('0x10')]);router[_0xb372('0x11')](_0xb372('0xc'),auth['isAuthenticated'](),controller[_0xb372('0x12')]);router['delete']('/:id/sounds/:id2',auth[_0xb372('0xb')](),controller['removeSound']);module[_0xb372('0x13')]=router; \ No newline at end of file +var _0xca09=['update','destroy','delete','removeSound','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','getSounds','post','/:id/sounds','addSound','put'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xca09,0x1e5));var _0x9ca0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca09[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9ca0('0x0'));var util=require(_0x9ca0('0x1'));var path=require(_0x9ca0('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ca0('0x3'));var router=express['Router']();var fs_extra=require(_0x9ca0('0x4'));var auth=require(_0x9ca0('0x5'));var interaction=require(_0x9ca0('0x6'));var config=require(_0x9ca0('0x7'));var controller=require(_0x9ca0('0x8'));router['get']('/',auth[_0x9ca0('0x9')](),controller[_0x9ca0('0xa')]);router[_0x9ca0('0xb')](_0x9ca0('0xc'),auth[_0x9ca0('0x9')](),controller[_0x9ca0('0xd')]);router['get']('/:id/sounds',auth[_0x9ca0('0x9')](),controller[_0x9ca0('0xe')]);router[_0x9ca0('0xf')]('/',auth[_0x9ca0('0x9')](),controller['create']);router[_0x9ca0('0xf')](_0x9ca0('0x10'),auth[_0x9ca0('0x9')](),controller[_0x9ca0('0x11')]);router[_0x9ca0('0x12')](_0x9ca0('0xc'),auth[_0x9ca0('0x9')](),controller[_0x9ca0('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9ca0('0x14')]);router[_0x9ca0('0x15')]('/:id/sounds/:id2',auth[_0x9ca0('0x9')](),controller[_0x9ca0('0x16')]);module[_0x9ca0('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 6f0d048..74ac399 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 _0x0b66=['mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x290a22,_0x11ed78){var _0x17ff05=function(_0x1ae727){while(--_0x1ae727){_0x290a22['push'](_0x290a22['shift']());}};_0x17ff05(++_0x11ed78);}(_0x0b66,0x148));var _0x60b6=function(_0x2cec60,_0x5efe37){_0x2cec60=_0x2cec60-0x0;var _0x4273d9=_0x0b66[_0x2cec60];return _0x4273d9;};'use strict';var Sequelize=require(_0x60b6('0x0'));module[_0x60b6('0x1')]={'name':{'type':Sequelize[_0x60b6('0x2')],'allowNull':![],'unique':_0x60b6('0x3')},'mode':{'type':Sequelize[_0x60b6('0x4')](_0x60b6('0x5'),_0x60b6('0x6'),_0x60b6('0x7'),_0x60b6('0x8'),_0x60b6('0x9'),_0x60b6('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x60b6('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x60b6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x60b6('0xb')},'format':{'type':Sequelize[_0x60b6('0x2')],'allowNull':!![]},'stamp':{'type':_0x60b6('0xc')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x67d5=['TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','quietmp3','mp3','STRING','alpha'];(function(_0x3a0b7f,_0x550d3b){var _0x551562=function(_0x2f7817){while(--_0x2f7817){_0x3a0b7f['push'](_0x3a0b7f['shift']());}};_0x551562(++_0x550d3b);}(_0x67d5,0x18e));var _0x567d=function(_0x6b4d88,_0x5823c4){_0x6b4d88=_0x6b4d88-0x0;var _0x5ce838=_0x67d5[_0x6b4d88];return _0x5ce838;};'use strict';var Sequelize=require(_0x567d('0x0'));module[_0x567d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x567d('0x2')},'mode':{'type':Sequelize[_0x567d('0x3')](_0x567d('0x4'),_0x567d('0x5'),'mp3nb','quietmp3nb',_0x567d('0x6'),_0x567d('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x567d('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x567d('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x567d('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x567d('0x8')],'allowNull':!![],'defaultValue':_0x567d('0x9')},'format':{'type':Sequelize[_0x567d('0x8')],'allowNull':!![]},'stamp':{'type':_0x567d('0xa')},'defaultEntry':{'type':Sequelize[_0x567d('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 01c8998..dab8b59 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 _0x66c2=['VIRTUAL','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','keys','find','body','params','create','sequelize','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','id2','getSounds','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','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','get','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','map'];(function(_0x4cc508,_0x4b1b60){var _0x134884=function(_0x14fab6){while(--_0x14fab6){_0x4cc508['push'](_0x4cc508['shift']());}};_0x134884(++_0x4b1b60);}(_0x66c2,0x11b));var _0x266c=function(_0xa73d59,_0x3a5134){_0xa73d59=_0xa73d59-0x0;var _0x3b9e42=_0x66c2[_0xa73d59];return _0x3b9e42;};'use strict';var emlformat=require(_0x266c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x266c('0x1'));var jsonpatch=require(_0x266c('0x2'));var rp=require(_0x266c('0x3'));var moment=require(_0x266c('0x4'));var BPromise=require(_0x266c('0x5'));var Mustache=require(_0x266c('0x6'));var util=require(_0x266c('0x7'));var path=require('path');var sox=require(_0x266c('0x8'));var csv=require(_0x266c('0x9'));var ejs=require(_0x266c('0xa'));var fs=require('fs');var fs_extra=require(_0x266c('0xb'));var _=require('lodash');var squel=require(_0x266c('0xc'));var crypto=require(_0x266c('0xd'));var jsforce=require(_0x266c('0xe'));var deskjs=require(_0x266c('0xf'));var toCsv=require(_0x266c('0x9'));var querystring=require('querystring');var Papa=require(_0x266c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x266c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x266c('0x12'));var logger=require(_0x266c('0x13'))('api');var utils=require(_0x266c('0x14'));var config=require(_0x266c('0x15'));var licenseUtil=require(_0x266c('0x16'));var db=require(_0x266c('0x17'))['db'];function respondWithStatusCode(_0x5c6e65,_0x135ffe){_0x135ffe=_0x135ffe||0xcc;return function(_0x4087b8){if(_0x4087b8){return _0x5c6e65['sendStatus'](_0x135ffe);}return _0x5c6e65[_0x266c('0x18')](_0x135ffe)[_0x266c('0x19')]();};}function respondWithResult(_0x1627d4,_0x44c3e6){_0x44c3e6=_0x44c3e6||0xc8;return function(_0x3ba083){if(_0x3ba083){return _0x1627d4[_0x266c('0x18')](_0x44c3e6)[_0x266c('0x1a')](_0x3ba083);}};}function respondWithFilteredResult(_0x11fb93,_0x3b5a4c){return function(_0x4b2f11){if(_0x4b2f11){var _0x12d1e6=typeof _0x3b5a4c[_0x266c('0x1b')]==='undefined'&&typeof _0x3b5a4c['limit']===_0x266c('0x1c');var _0x3541e9=_0x4b2f11[_0x266c('0x1d')];var _0xfe503e=_0x12d1e6?0x0:_0x3b5a4c[_0x266c('0x1b')];var _0x3bcf98=_0x12d1e6?_0x4b2f11[_0x266c('0x1d')]:_0x3b5a4c['offset']+_0x3b5a4c['limit'];var _0x103919;if(_0x3bcf98>=_0x3541e9){_0x3bcf98=_0x3541e9;_0x103919=0xc8;}else{_0x103919=0xce;}_0x11fb93[_0x266c('0x18')](_0x103919);return _0x11fb93[_0x266c('0x1e')](_0x266c('0x1f'),_0xfe503e+'-'+_0x3bcf98+'/'+_0x3541e9)['json'](_0x4b2f11);}return null;};}function patchUpdates(_0x42b7d0){return function(_0x4ab280){try{jsonpatch['apply'](_0x4ab280,_0x42b7d0,!![]);}catch(_0xb8d070){return BPromise[_0x266c('0x20')](_0xb8d070);}return _0x4ab280[_0x266c('0x21')]();};}function saveUpdates(_0x52f051,_0x20a789){return function(_0x22199d){if(_0x22199d){return _0x22199d[_0x266c('0x22')](_0x52f051)['then'](function(_0x49b143){return _0x49b143;});}return null;};}function removeEntity(_0x3c977b,_0x5167e5){return function(_0x35d4a5){if(_0x35d4a5){return _0x35d4a5['destroy']()[_0x266c('0x23')](function(){var _0x536379=_0x35d4a5[_0x266c('0x24')]({'plain':!![]});var _0x438b77='MusicOnHolds';return db['UserProfileResource'][_0x266c('0x25')]({'where':{'type':_0x438b77,'resourceId':_0x536379['id']}})[_0x266c('0x23')](function(){return _0x35d4a5;});})[_0x266c('0x23')](function(){_0x3c977b[_0x266c('0x18')](0xcc)[_0x266c('0x19')]();});}};}function handleEntityNotFound(_0x361376,_0x26bbaa){return function(_0x4a7645){if(!_0x4a7645){_0x361376[_0x266c('0x26')](0x194);}return _0x4a7645;};}function handleError(_0xe3e109,_0x455207){_0x455207=_0x455207||0x1f4;return function(_0x528497){logger[_0x266c('0x27')](_0x528497['stack']);if(_0x528497[_0x266c('0x28')]){delete _0x528497[_0x266c('0x28')];}_0xe3e109[_0x266c('0x18')](_0x455207)[_0x266c('0x29')](_0x528497);};}exports[_0x266c('0x2a')]=function(_0x5421c0,_0x5ce912){var _0x194a0f={},_0x2c8d0c={},_0x1e7fe3={'count':0x0,'rows':[]};var _0xca76a4=_['map'](db['VoiceMusicOnHold'][_0x266c('0x2b')],function(_0xf577e5){return{'name':_0xf577e5[_0x266c('0x2c')],'type':_0xf577e5[_0x266c('0x2d')][_0x266c('0x2e')]};});_0x2c8d0c[_0x266c('0x2f')]=_['map'](_0xca76a4,_0x266c('0x28'));_0x2c8d0c[_0x266c('0x30')]=_['keys'](_0x5421c0[_0x266c('0x30')]);_0x2c8d0c[_0x266c('0x31')]=_[_0x266c('0x32')](_0x2c8d0c[_0x266c('0x2f')],_0x2c8d0c['query']);_0x194a0f[_0x266c('0x33')]=_[_0x266c('0x32')](_0x2c8d0c['model'],qs[_0x266c('0x34')](_0x5421c0[_0x266c('0x30')][_0x266c('0x34')]));_0x194a0f[_0x266c('0x33')]=_0x194a0f['attributes'][_0x266c('0x35')]?_0x194a0f[_0x266c('0x33')]:_0x2c8d0c[_0x266c('0x2f')];if(!_0x5421c0[_0x266c('0x30')][_0x266c('0x36')](_0x266c('0x37'))){_0x194a0f[_0x266c('0x38')]=qs['limit'](_0x5421c0[_0x266c('0x30')]['limit']);_0x194a0f[_0x266c('0x1b')]=qs['offset'](_0x5421c0[_0x266c('0x30')][_0x266c('0x1b')]);}_0x194a0f[_0x266c('0x39')]=qs['sort'](_0x5421c0[_0x266c('0x30')][_0x266c('0x3a')]);delete _0x5421c0[_0x266c('0x30')][_0x266c('0x3a')];_0x194a0f[_0x266c('0x3b')]=qs['filters'](_[_0x266c('0x3c')](_0x5421c0[_0x266c('0x30')],_0x2c8d0c['filters']),_0xca76a4);if(_0x5421c0['query']['filter']){_0x194a0f['where']=_['merge'](_0x194a0f[_0x266c('0x3b')],{'$or':_[_0x266c('0x3d')](_0xca76a4,function(_0xeb1578){if(_0xeb1578[_0x266c('0x2d')]!==_0x266c('0x3e')){var _0x448495={};_0x448495[_0xeb1578[_0x266c('0x28')]]={'$like':'%'+_0x5421c0[_0x266c('0x30')][_0x266c('0x3f')]+'%'};return _0x448495;}})});}_0x194a0f=_[_0x266c('0x40')]({},_0x194a0f,_0x5421c0[_0x266c('0x41')]);var _0x19a5ed={'where':_0x194a0f[_0x266c('0x3b')]};return db[_0x266c('0x42')][_0x266c('0x1d')](_0x19a5ed)[_0x266c('0x23')](function(_0x18c3b5){_0x1e7fe3['count']=_0x18c3b5;if(_0x5421c0[_0x266c('0x30')][_0x266c('0x43')]){_0x194a0f[_0x266c('0x44')]=[{'all':!![]}];}return db[_0x266c('0x42')][_0x266c('0x45')](_0x194a0f);})['then'](function(_0x2e0ad8){_0x1e7fe3[_0x266c('0x46')]=_0x2e0ad8;return _0x1e7fe3;})[_0x266c('0x23')](respondWithFilteredResult(_0x5ce912,_0x194a0f))[_0x266c('0x47')](handleError(_0x5ce912,null));};exports[_0x266c('0x48')]=function(_0x5bd4e6,_0x23093b){var _0x5466e8={'raw':![],'where':{'id':_0x5bd4e6['params']['id']}},_0x564865={};_0x564865[_0x266c('0x2f')]=_[_0x266c('0x49')](db[_0x266c('0x42')]['rawAttributes']);_0x564865['query']=_[_0x266c('0x49')](_0x5bd4e6[_0x266c('0x30')]);_0x564865[_0x266c('0x31')]=_[_0x266c('0x32')](_0x564865[_0x266c('0x2f')],_0x564865[_0x266c('0x30')]);_0x5466e8['attributes']=_['intersection'](_0x564865['model'],qs['fields'](_0x5bd4e6[_0x266c('0x30')][_0x266c('0x34')]));_0x5466e8[_0x266c('0x33')]=_0x5466e8[_0x266c('0x33')][_0x266c('0x35')]?_0x5466e8[_0x266c('0x33')]:_0x564865[_0x266c('0x2f')];if(_0x5bd4e6[_0x266c('0x30')][_0x266c('0x43')]){_0x5466e8[_0x266c('0x44')]=[{'all':!![]}];}_0x5466e8=_[_0x266c('0x40')]({},_0x5466e8,_0x5bd4e6[_0x266c('0x41')]);return db[_0x266c('0x42')][_0x266c('0x4a')](_0x5466e8)[_0x266c('0x23')](handleEntityNotFound(_0x23093b,null))[_0x266c('0x23')](respondWithResult(_0x23093b,null))[_0x266c('0x47')](handleError(_0x23093b,null));};exports['update']=function(_0xe5a1fd,_0x57d07a){if(_0xe5a1fd['body']['id']){delete _0xe5a1fd[_0x266c('0x4b')]['id'];}return db[_0x266c('0x42')][_0x266c('0x4a')]({'where':{'id':_0xe5a1fd[_0x266c('0x4c')]['id']}})[_0x266c('0x23')](handleEntityNotFound(_0x57d07a,null))['then'](saveUpdates(_0xe5a1fd[_0x266c('0x4b')],null))['then'](respondWithResult(_0x57d07a,null))[_0x266c('0x47')](handleError(_0x57d07a,null));};exports[_0x266c('0x4d')]=function(_0x277289,_0x34ceb4,_0xfbf3eb){return db[_0x266c('0x4e')]['transaction'](function(_0x193cbc){if(_0x277289[_0x266c('0x4b')][_0x266c('0x4f')]===_0x266c('0x50')){_0x277289[_0x266c('0x4b')]['directory']=path[_0x266c('0x51')](config[_0x266c('0x52')],_0x266c('0x53'),_0x277289[_0x266c('0x4b')]['name']);}return db[_0x266c('0x42')][_0x266c('0x4d')](_0x277289['body'],{'transaction':_0x193cbc})['then'](function(_0x4bc05f){if(_0x277289[_0x266c('0x4b')][_0x266c('0x4f')]===_0x266c('0x50')){fs[_0x266c('0x54')](_0x4bc05f[_0x266c('0x55')],parseInt(_0x266c('0x56'),0x8));}var _0x580ec9=_0x277289['user']['get']({'plain':!![]});if(!_0x580ec9)throw new Error(_0x266c('0x57'));if(_0x580ec9[_0x266c('0x58')]===_0x266c('0x59')){var _0x58ed6f=_0x4bc05f[_0x266c('0x24')]({'plain':!![]});return db[_0x266c('0x5a')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x580ec9[_0x266c('0x5b')]},'raw':!![]})[_0x266c('0x23')](function(_0x134476){if(_0x134476&&_0x134476[_0x266c('0x5c')]===0x0){return db['UserProfileResource'][_0x266c('0x4d')]({'name':_0x58ed6f[_0x266c('0x28')],'resourceId':_0x58ed6f['id'],'type':_0x134476[_0x266c('0x28')],'sectionId':_0x134476['id']},{})[_0x266c('0x23')](function(){return _0x4bc05f;});}else{return _0x4bc05f;}})[_0x266c('0x47')](function(_0x34822d){logger[_0x266c('0x27')](_0x266c('0x5d'),_0x34822d);});}return _0x4bc05f;});})[_0x266c('0x23')](respondWithResult(_0x34ceb4,0xc9))[_0x266c('0x47')](handleError(_0x34ceb4,null));};exports[_0x266c('0x25')]=function(_0x550f6e,_0x20ce56,_0x32f822){var _0xbbdcc0;return db['VoiceMusicOnHold'][_0x266c('0x4a')]({'where':{'id':_0x550f6e[_0x266c('0x4c')]['id']}})[_0x266c('0x23')](function(_0x1e593d){if(_0x1e593d){return db['sequelize']['transaction'](function(_0x508987){return _0x1e593d[_0x266c('0x25')]({'transaction':_0x508987,'raw':!![]})[_0x266c('0x23')](function(_0x56b6c0){if(_0x56b6c0[_0x266c('0x55')]){fs[_0x266c('0x5e')](_0x56b6c0['directory'])[_0x266c('0x5f')](function(_0x2b5216){fs[_0x266c('0x60')](path[_0x266c('0x51')](_0x56b6c0['directory'],_0x2b5216));});fs[_0x266c('0x61')](_0x56b6c0[_0x266c('0x55')]);}return _0x56b6c0;});})[_0x266c('0x47')](function(_0x4bd780){throw new db[(_0x266c('0x62'))][(_0x266c('0x63'))](_0x4bd780[_0x266c('0x64')]);});}})['then'](handleEntityNotFound(_0x20ce56,null))['then'](removeEntity(_0x20ce56,null))[_0x266c('0x47')](handleError(_0x20ce56,null));};exports[_0x266c('0x65')]=function(_0x4a4018,_0x4fa267,_0x16ca50){return db[_0x266c('0x4e')][_0x266c('0x66')](function(_0x313c8d){var _0x232ac2;return db[_0x266c('0x42')]['find']({'where':{'id':_0x4a4018[_0x266c('0x4c')]['id']}})[_0x266c('0x23')](function(_0x19ec37){if(_0x19ec37){_0x232ac2=_0x19ec37;return _0x19ec37[_0x266c('0x65')](_0x4a4018['body']['id'],{'transaction':_0x313c8d});}})[_0x266c('0x23')](function(_0x3a54d0){if(_0x3a54d0){return db[_0x266c('0x67')][_0x266c('0x68')]({'where':{'id':_0x4a4018[_0x266c('0x4b')]['id']},'attributes':['id','name',_0x266c('0x69'),_0x266c('0x6a'),_0x266c('0x6b')],'raw':!![]});}})[_0x266c('0x23')](function(_0x284c78){if(_0x284c78){var _0xfc2220=path[_0x266c('0x51')](config[_0x266c('0x52')],_0x266c('0x6c'),util[_0x266c('0x6d')](_0x266c('0x6e'),path['basename'](_0x284c78[_0x266c('0x69')],path[_0x266c('0x6f')](_0x284c78['save_name'])),_0x284c78[_0x266c('0x6a')]));var _0x7a710=path[_0x266c('0x51')](config['root'],_0x266c('0x53'),_0x232ac2[_0x266c('0x28')],util[_0x266c('0x6d')](_0x266c('0x6e'),_0x284c78[_0x266c('0x28')],_0x284c78[_0x266c('0x6a')]));fs[_0x266c('0x70')](_0xfc2220,_0x7a710);return _0x284c78;}})[_0x266c('0x47')](function(_0x5c6f14){throw new db[(_0x266c('0x62'))][(_0x266c('0x63'))](_0x5c6f14[_0x266c('0x64')]);});})[_0x266c('0x23')](handleEntityNotFound(_0x4fa267,null))['then'](respondWithResult(_0x4fa267,0xc9))[_0x266c('0x47')](handleError(_0x4fa267,null));};exports['removeSound']=function(_0x14084a,_0x58b293,_0x4f8360){return db[_0x266c('0x4e')]['transaction'](function(_0x200a0c){var _0x402c0e;return db[_0x266c('0x42')][_0x266c('0x68')]({'where':{'id':_0x14084a['params']['id']}})[_0x266c('0x23')](handleEntityNotFound(_0x58b293,null))[_0x266c('0x23')](function(_0x6b46f){if(_0x6b46f){_0x402c0e=_0x6b46f;return _0x6b46f['removeSound'](_0x14084a[_0x266c('0x4c')][_0x266c('0x71')]);}})[_0x266c('0x23')](function(_0x1b5fbf){if(_0x1b5fbf){return db[_0x266c('0x67')][_0x266c('0x68')]({'where':{'id':_0x14084a['params']['id2']},'attributes':['id',_0x266c('0x28'),_0x266c('0x69'),_0x266c('0x6a'),_0x266c('0x6b')],'raw':!![]});}})[_0x266c('0x23')](function(_0x4105d5){if(_0x4105d5){fs['unlinkSync'](path[_0x266c('0x51')](_0x402c0e[_0x266c('0x55')],util[_0x266c('0x6d')](_0x266c('0x6e'),_0x4105d5[_0x266c('0x28')],_0x4105d5[_0x266c('0x6a')])));return _0x4105d5;}})[_0x266c('0x47')](function(_0x347dc7){throw new db[(_0x266c('0x62'))][(_0x266c('0x63'))](_0x347dc7[_0x266c('0x64')]);});})[_0x266c('0x23')](handleEntityNotFound(_0x58b293,null))[_0x266c('0x23')](respondWithStatusCode(_0x58b293,0xcc))['catch'](handleError(_0x58b293,null));};exports[_0x266c('0x72')]=function(_0x12e0eb,_0xa6eb91,_0x17e7b5){var _0x37bc27={};var _0x217489={};var _0xfff5d1;var _0xf48cdd;return db[_0x266c('0x42')][_0x266c('0x68')]({'where':{'id':_0x12e0eb[_0x266c('0x4c')]['id']}})[_0x266c('0x23')](handleEntityNotFound(_0xa6eb91,null))[_0x266c('0x23')](function(_0x479b01){if(_0x479b01){_0xfff5d1=_0x479b01;_0x217489[_0x266c('0x2f')]=_['keys'](db['Sound']['rawAttributes']);_0x217489['query']=_['keys'](_0x12e0eb[_0x266c('0x30')]);_0x217489[_0x266c('0x31')]=_[_0x266c('0x32')](_0x217489[_0x266c('0x2f')],_0x217489[_0x266c('0x30')]);_0x37bc27[_0x266c('0x33')]=_['intersection'](_0x217489[_0x266c('0x2f')],qs[_0x266c('0x34')](_0x12e0eb[_0x266c('0x30')][_0x266c('0x34')]));_0x37bc27[_0x266c('0x33')]=_0x37bc27[_0x266c('0x33')][_0x266c('0x35')]?_0x37bc27[_0x266c('0x33')]:_0x217489[_0x266c('0x2f')];_0x37bc27[_0x266c('0x39')]=qs['sort'](_0x12e0eb['query'][_0x266c('0x3a')]);_0x37bc27['where']=qs[_0x266c('0x31')](_[_0x266c('0x3c')](_0x12e0eb['query'],_0x217489[_0x266c('0x31')]));if(_0x12e0eb['query'][_0x266c('0x3f')]){_0x37bc27[_0x266c('0x3b')]=_[_0x266c('0x40')](_0x37bc27[_0x266c('0x3b')],{'$or':_['map'](_0x37bc27[_0x266c('0x33')],function(_0x36b117){var _0xb5594b={};_0xb5594b[_0x36b117]={'$like':'%'+_0x12e0eb[_0x266c('0x30')][_0x266c('0x3f')]+'%'};return _0xb5594b;})});}_0x37bc27=_['merge']({},_0x37bc27,_0x12e0eb[_0x266c('0x41')]);return _0xfff5d1[_0x266c('0x72')](_0x37bc27);}})[_0x266c('0x23')](function(_0x208b53){if(_0x208b53){_0xf48cdd=_0x208b53[_0x266c('0x35')];if(!_0x12e0eb[_0x266c('0x30')]['hasOwnProperty']('nolimit')){_0x37bc27[_0x266c('0x38')]=qs[_0x266c('0x38')](_0x12e0eb[_0x266c('0x30')][_0x266c('0x38')]);_0x37bc27[_0x266c('0x1b')]=qs['offset'](_0x12e0eb[_0x266c('0x30')][_0x266c('0x1b')]);}return _0xfff5d1[_0x266c('0x72')](_0x37bc27);}})[_0x266c('0x23')](function(_0x462cbe){if(_0x462cbe){return _0x462cbe?{'count':_0xf48cdd,'rows':_0x462cbe}:null;}})['then'](respondWithResult(_0xa6eb91,null))[_0x266c('0x47')](handleError(_0xa6eb91,null));}; \ No newline at end of file +var _0x4ce2=['count','Content-Range','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','VIRTUAL','filter','includeAll','findAll','rows','include','options','body','find','params','create','sequelize','transaction','directory','join','root','server/files/moh','mode','mkdirSync','user','role','userProfileId','autoAssociation','catch','error','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','Sound','converted_format','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','Sequelize','ValidationError','removeSound','findOne','id2','createdAt','getSounds','pick','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/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit'];(function(_0x18b518,_0x22e1ff){var _0x1356c5=function(_0x511d60){while(--_0x511d60){_0x18b518['push'](_0x18b518['shift']());}};_0x1356c5(++_0x22e1ff);}(_0x4ce2,0x13d));var _0x24ce=function(_0x46342b,_0xa89f38){_0x46342b=_0x46342b-0x0;var _0x1a41d4=_0x4ce2[_0x46342b];return _0x1a41d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24ce('0x0'));var zipdir=require(_0x24ce('0x1'));var jsonpatch=require(_0x24ce('0x2'));var rp=require(_0x24ce('0x3'));var moment=require(_0x24ce('0x4'));var BPromise=require(_0x24ce('0x5'));var Mustache=require(_0x24ce('0x6'));var util=require(_0x24ce('0x7'));var path=require(_0x24ce('0x8'));var sox=require(_0x24ce('0x9'));var csv=require(_0x24ce('0xa'));var ejs=require(_0x24ce('0xb'));var fs=require('fs');var fs_extra=require(_0x24ce('0xc'));var _=require(_0x24ce('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x24ce('0xe'));var deskjs=require(_0x24ce('0xf'));var toCsv=require(_0x24ce('0xa'));var querystring=require(_0x24ce('0x10'));var Papa=require(_0x24ce('0x11'));var Redis=require(_0x24ce('0x12'));var authService=require(_0x24ce('0x13'));var qs=require(_0x24ce('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x24ce('0x15'))(_0x24ce('0x16'));var utils=require(_0x24ce('0x17'));var config=require(_0x24ce('0x18'));var licenseUtil=require(_0x24ce('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54700a,_0x1f0a46){_0x1f0a46=_0x1f0a46||0xcc;return function(_0x4f180a){if(_0x4f180a){return _0x54700a['sendStatus'](_0x1f0a46);}return _0x54700a[_0x24ce('0x1a')](_0x1f0a46)[_0x24ce('0x1b')]();};}function respondWithResult(_0x612c07,_0x4b8c09){_0x4b8c09=_0x4b8c09||0xc8;return function(_0x5cd067){if(_0x5cd067){return _0x612c07['status'](_0x4b8c09)['json'](_0x5cd067);}};}function respondWithFilteredResult(_0x2fc083,_0x523f1c){return function(_0x42733f){if(_0x42733f){var _0x3a06c1=typeof _0x523f1c[_0x24ce('0x1c')]===_0x24ce('0x1d')&&typeof _0x523f1c[_0x24ce('0x1e')]===_0x24ce('0x1d');var _0xc36a20=_0x42733f[_0x24ce('0x1f')];var _0x56e89e=_0x3a06c1?0x0:_0x523f1c[_0x24ce('0x1c')];var _0x36f8f3=_0x3a06c1?_0x42733f[_0x24ce('0x1f')]:_0x523f1c[_0x24ce('0x1c')]+_0x523f1c[_0x24ce('0x1e')];var _0x1181d6;if(_0x36f8f3>=_0xc36a20){_0x36f8f3=_0xc36a20;_0x1181d6=0xc8;}else{_0x1181d6=0xce;}_0x2fc083[_0x24ce('0x1a')](_0x1181d6);return _0x2fc083['set'](_0x24ce('0x20'),_0x56e89e+'-'+_0x36f8f3+'/'+_0xc36a20)[_0x24ce('0x21')](_0x42733f);}return null;};}function patchUpdates(_0xa89e19){return function(_0x2dd467){try{jsonpatch[_0x24ce('0x22')](_0x2dd467,_0xa89e19,!![]);}catch(_0x2017c5){return BPromise[_0x24ce('0x23')](_0x2017c5);}return _0x2dd467[_0x24ce('0x24')]();};}function saveUpdates(_0x3ac846,_0x3a6d37){return function(_0x571441){if(_0x571441){return _0x571441[_0x24ce('0x25')](_0x3ac846)[_0x24ce('0x26')](function(_0x5d6916){return _0x5d6916;});}return null;};}function removeEntity(_0x3aa024,_0x2bceb1){return function(_0x37cf3c){if(_0x37cf3c){return _0x37cf3c[_0x24ce('0x27')]()['then'](function(){var _0x35bdc9=_0x37cf3c[_0x24ce('0x28')]({'plain':!![]});var _0x176900=_0x24ce('0x29');return db[_0x24ce('0x2a')]['destroy']({'where':{'type':_0x176900,'resourceId':_0x35bdc9['id']}})['then'](function(){return _0x37cf3c;});})[_0x24ce('0x26')](function(){_0x3aa024[_0x24ce('0x1a')](0xcc)[_0x24ce('0x1b')]();});}};}function handleEntityNotFound(_0x550c04,_0x1f3436){return function(_0x457f6c){if(!_0x457f6c){_0x550c04[_0x24ce('0x2b')](0x194);}return _0x457f6c;};}function handleError(_0x5ccbf5,_0x1884c3){_0x1884c3=_0x1884c3||0x1f4;return function(_0x4a3a6c){logger['error'](_0x4a3a6c[_0x24ce('0x2c')]);if(_0x4a3a6c[_0x24ce('0x2d')]){delete _0x4a3a6c[_0x24ce('0x2d')];}_0x5ccbf5[_0x24ce('0x1a')](_0x1884c3)[_0x24ce('0x2e')](_0x4a3a6c);};}exports[_0x24ce('0x2f')]=function(_0x221050,_0x507875){var _0x3e5afa={},_0x5e388e={},_0x3852b4={'count':0x0,'rows':[]};var _0xbe3997=_[_0x24ce('0x30')](db[_0x24ce('0x31')][_0x24ce('0x32')],function(_0x15dadf){return{'name':_0x15dadf[_0x24ce('0x33')],'type':_0x15dadf[_0x24ce('0x34')][_0x24ce('0x35')]};});_0x5e388e[_0x24ce('0x36')]=_[_0x24ce('0x30')](_0xbe3997,_0x24ce('0x2d'));_0x5e388e['query']=_[_0x24ce('0x37')](_0x221050[_0x24ce('0x38')]);_0x5e388e['filters']=_[_0x24ce('0x39')](_0x5e388e['model'],_0x5e388e[_0x24ce('0x38')]);_0x3e5afa[_0x24ce('0x3a')]=_[_0x24ce('0x39')](_0x5e388e[_0x24ce('0x36')],qs[_0x24ce('0x3b')](_0x221050[_0x24ce('0x38')][_0x24ce('0x3b')]));_0x3e5afa['attributes']=_0x3e5afa[_0x24ce('0x3a')][_0x24ce('0x3c')]?_0x3e5afa[_0x24ce('0x3a')]:_0x5e388e[_0x24ce('0x36')];if(!_0x221050[_0x24ce('0x38')][_0x24ce('0x3d')](_0x24ce('0x3e'))){_0x3e5afa[_0x24ce('0x1e')]=qs[_0x24ce('0x1e')](_0x221050[_0x24ce('0x38')][_0x24ce('0x1e')]);_0x3e5afa[_0x24ce('0x1c')]=qs['offset'](_0x221050['query'][_0x24ce('0x1c')]);}_0x3e5afa[_0x24ce('0x3f')]=qs[_0x24ce('0x40')](_0x221050['query'][_0x24ce('0x40')]);delete _0x221050[_0x24ce('0x38')][_0x24ce('0x40')];_0x3e5afa['where']=qs[_0x24ce('0x41')](_['pick'](_0x221050['query'],_0x5e388e[_0x24ce('0x41')]),_0xbe3997);if(_0x221050['query']['filter']){_0x3e5afa['where']=_[_0x24ce('0x42')](_0x3e5afa[_0x24ce('0x43')],{'$or':_['map'](_0xbe3997,function(_0x3ec818){if(_0x3ec818[_0x24ce('0x34')]!==_0x24ce('0x44')){var _0x5816e5={};_0x5816e5[_0x3ec818[_0x24ce('0x2d')]]={'$like':'%'+_0x221050[_0x24ce('0x38')][_0x24ce('0x45')]+'%'};return _0x5816e5;}})});}_0x3e5afa=_[_0x24ce('0x42')]({},_0x3e5afa,_0x221050['options']);var _0x50098e={'where':_0x3e5afa['where']};return db[_0x24ce('0x31')][_0x24ce('0x1f')](_0x50098e)['then'](function(_0x175b45){_0x3852b4[_0x24ce('0x1f')]=_0x175b45;if(_0x221050[_0x24ce('0x38')][_0x24ce('0x46')]){_0x3e5afa['include']=[{'all':!![]}];}return db[_0x24ce('0x31')][_0x24ce('0x47')](_0x3e5afa);})[_0x24ce('0x26')](function(_0x12d355){_0x3852b4[_0x24ce('0x48')]=_0x12d355;return _0x3852b4;})[_0x24ce('0x26')](respondWithFilteredResult(_0x507875,_0x3e5afa))['catch'](handleError(_0x507875,null));};exports['show']=function(_0xd06d04,_0x25627c){var _0x2d9b8b={'raw':![],'where':{'id':_0xd06d04['params']['id']}},_0x4b9294={};_0x4b9294[_0x24ce('0x36')]=_['keys'](db['VoiceMusicOnHold'][_0x24ce('0x32')]);_0x4b9294[_0x24ce('0x38')]=_['keys'](_0xd06d04['query']);_0x4b9294[_0x24ce('0x41')]=_[_0x24ce('0x39')](_0x4b9294[_0x24ce('0x36')],_0x4b9294[_0x24ce('0x38')]);_0x2d9b8b['attributes']=_['intersection'](_0x4b9294[_0x24ce('0x36')],qs[_0x24ce('0x3b')](_0xd06d04[_0x24ce('0x38')][_0x24ce('0x3b')]));_0x2d9b8b['attributes']=_0x2d9b8b[_0x24ce('0x3a')][_0x24ce('0x3c')]?_0x2d9b8b[_0x24ce('0x3a')]:_0x4b9294[_0x24ce('0x36')];if(_0xd06d04[_0x24ce('0x38')][_0x24ce('0x46')]){_0x2d9b8b[_0x24ce('0x49')]=[{'all':!![]}];}_0x2d9b8b=_[_0x24ce('0x42')]({},_0x2d9b8b,_0xd06d04[_0x24ce('0x4a')]);return db[_0x24ce('0x31')]['find'](_0x2d9b8b)['then'](handleEntityNotFound(_0x25627c,null))[_0x24ce('0x26')](respondWithResult(_0x25627c,null))['catch'](handleError(_0x25627c,null));};exports[_0x24ce('0x25')]=function(_0x300019,_0x2bd696){if(_0x300019[_0x24ce('0x4b')]['id']){delete _0x300019[_0x24ce('0x4b')]['id'];}return db[_0x24ce('0x31')][_0x24ce('0x4c')]({'where':{'id':_0x300019[_0x24ce('0x4d')]['id']}})[_0x24ce('0x26')](handleEntityNotFound(_0x2bd696,null))[_0x24ce('0x26')](saveUpdates(_0x300019['body'],null))['then'](respondWithResult(_0x2bd696,null))['catch'](handleError(_0x2bd696,null));};exports[_0x24ce('0x4e')]=function(_0x308746,_0x614b6a,_0x50ec04){return db[_0x24ce('0x4f')][_0x24ce('0x50')](function(_0x2c868a){if(_0x308746['body']['mode']==='files'){_0x308746[_0x24ce('0x4b')][_0x24ce('0x51')]=path[_0x24ce('0x52')](config[_0x24ce('0x53')],_0x24ce('0x54'),_0x308746[_0x24ce('0x4b')][_0x24ce('0x2d')]);}return db[_0x24ce('0x31')][_0x24ce('0x4e')](_0x308746[_0x24ce('0x4b')],{'transaction':_0x2c868a})['then'](function(_0x389381){if(_0x308746['body'][_0x24ce('0x55')]==='files'){fs[_0x24ce('0x56')](_0x389381[_0x24ce('0x51')],parseInt('0777',0x8));}var _0x2abd05=_0x308746[_0x24ce('0x57')][_0x24ce('0x28')]({'plain':!![]});if(!_0x2abd05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2abd05[_0x24ce('0x58')]===_0x24ce('0x57')){var _0x4fce12=_0x389381[_0x24ce('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x24ce('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x2abd05[_0x24ce('0x59')]},'raw':!![]})[_0x24ce('0x26')](function(_0x316d98){if(_0x316d98&&_0x316d98[_0x24ce('0x5a')]===0x0){return db[_0x24ce('0x2a')][_0x24ce('0x4e')]({'name':_0x4fce12[_0x24ce('0x2d')],'resourceId':_0x4fce12['id'],'type':_0x316d98['name'],'sectionId':_0x316d98['id']},{})[_0x24ce('0x26')](function(){return _0x389381;});}else{return _0x389381;}})[_0x24ce('0x5b')](function(_0xaf10b4){logger[_0x24ce('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaf10b4);});}return _0x389381;});})['then'](respondWithResult(_0x614b6a,0xc9))['catch'](handleError(_0x614b6a,null));};exports[_0x24ce('0x27')]=function(_0x5f51ad,_0x4e6ff0,_0x336b55){var _0x194d7b;return db[_0x24ce('0x31')][_0x24ce('0x4c')]({'where':{'id':_0x5f51ad[_0x24ce('0x4d')]['id']}})['then'](function(_0x50ef11){if(_0x50ef11){return db[_0x24ce('0x4f')][_0x24ce('0x50')](function(_0x1e7bc4){return _0x50ef11[_0x24ce('0x27')]({'transaction':_0x1e7bc4,'raw':!![]})[_0x24ce('0x26')](function(_0x266a97){if(_0x266a97[_0x24ce('0x51')]){fs[_0x24ce('0x5d')](_0x266a97[_0x24ce('0x51')])[_0x24ce('0x5e')](function(_0x532014){fs[_0x24ce('0x5f')](path['join'](_0x266a97[_0x24ce('0x51')],_0x532014));});fs[_0x24ce('0x60')](_0x266a97['directory']);}return _0x266a97;});})[_0x24ce('0x5b')](function(_0xa8cb92){throw new db['Sequelize']['ValidationError'](_0xa8cb92[_0x24ce('0x61')]);});}})[_0x24ce('0x26')](handleEntityNotFound(_0x4e6ff0,null))[_0x24ce('0x26')](removeEntity(_0x4e6ff0,null))[_0x24ce('0x5b')](handleError(_0x4e6ff0,null));};exports[_0x24ce('0x62')]=function(_0x80d560,_0x47fcc1,_0x5516ec){return db[_0x24ce('0x4f')][_0x24ce('0x50')](function(_0x799324){var _0x5cbfca;return db[_0x24ce('0x31')][_0x24ce('0x4c')]({'where':{'id':_0x80d560[_0x24ce('0x4d')]['id']}})['then'](function(_0x4948c5){if(_0x4948c5){_0x5cbfca=_0x4948c5;return _0x4948c5['addSound'](_0x80d560[_0x24ce('0x4b')]['id'],{'transaction':_0x799324});}})[_0x24ce('0x26')](function(_0x1e5033){if(_0x1e5033){return db[_0x24ce('0x63')]['findOne']({'where':{'id':_0x80d560['body']['id']},'attributes':['id',_0x24ce('0x2d'),'save_name',_0x24ce('0x64'),'createdAt'],'raw':!![]});}})[_0x24ce('0x26')](function(_0x3b7076){if(_0x3b7076){var _0x2f33d9=path[_0x24ce('0x52')](config[_0x24ce('0x53')],_0x24ce('0x65'),util[_0x24ce('0x66')](_0x24ce('0x67'),path[_0x24ce('0x68')](_0x3b7076[_0x24ce('0x69')],path[_0x24ce('0x6a')](_0x3b7076['save_name'])),_0x3b7076[_0x24ce('0x64')]));var _0x6cda1d=path[_0x24ce('0x52')](config[_0x24ce('0x53')],_0x24ce('0x54'),_0x5cbfca[_0x24ce('0x2d')],util[_0x24ce('0x66')](_0x24ce('0x67'),_0x3b7076[_0x24ce('0x2d')],_0x3b7076[_0x24ce('0x64')]));fs[_0x24ce('0x6b')](_0x2f33d9,_0x6cda1d);return _0x3b7076;}})[_0x24ce('0x5b')](function(_0x1d2622){throw new db[(_0x24ce('0x6c'))][(_0x24ce('0x6d'))](_0x1d2622[_0x24ce('0x61')]);});})[_0x24ce('0x26')](handleEntityNotFound(_0x47fcc1,null))[_0x24ce('0x26')](respondWithResult(_0x47fcc1,0xc9))[_0x24ce('0x5b')](handleError(_0x47fcc1,null));};exports[_0x24ce('0x6e')]=function(_0x2a8958,_0x351dd7,_0xd9b7fd){return db[_0x24ce('0x4f')][_0x24ce('0x50')](function(_0x34b69f){var _0x3218da;return db[_0x24ce('0x31')][_0x24ce('0x6f')]({'where':{'id':_0x2a8958['params']['id']}})[_0x24ce('0x26')](handleEntityNotFound(_0x351dd7,null))['then'](function(_0x58036e){if(_0x58036e){_0x3218da=_0x58036e;return _0x58036e[_0x24ce('0x6e')](_0x2a8958[_0x24ce('0x4d')][_0x24ce('0x70')]);}})['then'](function(_0x3d87bd){if(_0x3d87bd){return db['Sound']['findOne']({'where':{'id':_0x2a8958[_0x24ce('0x4d')][_0x24ce('0x70')]},'attributes':['id','name',_0x24ce('0x69'),_0x24ce('0x64'),_0x24ce('0x71')],'raw':!![]});}})['then'](function(_0x41d9aa){if(_0x41d9aa){fs['unlinkSync'](path[_0x24ce('0x52')](_0x3218da[_0x24ce('0x51')],util[_0x24ce('0x66')]('%s.%s',_0x41d9aa[_0x24ce('0x2d')],_0x41d9aa[_0x24ce('0x64')])));return _0x41d9aa;}})['catch'](function(_0x2fced7){throw new db['Sequelize'][(_0x24ce('0x6d'))](_0x2fced7[_0x24ce('0x61')]);});})[_0x24ce('0x26')](handleEntityNotFound(_0x351dd7,null))[_0x24ce('0x26')](respondWithStatusCode(_0x351dd7,0xcc))[_0x24ce('0x5b')](handleError(_0x351dd7,null));};exports[_0x24ce('0x72')]=function(_0x44178c,_0x5cb52f,_0x504225){var _0x4c28d2={};var _0x1d76fa={};var _0x541f00;var _0x3e0350;return db['VoiceMusicOnHold'][_0x24ce('0x6f')]({'where':{'id':_0x44178c[_0x24ce('0x4d')]['id']}})[_0x24ce('0x26')](handleEntityNotFound(_0x5cb52f,null))[_0x24ce('0x26')](function(_0x21624e){if(_0x21624e){_0x541f00=_0x21624e;_0x1d76fa['model']=_[_0x24ce('0x37')](db['Sound'][_0x24ce('0x32')]);_0x1d76fa['query']=_[_0x24ce('0x37')](_0x44178c[_0x24ce('0x38')]);_0x1d76fa[_0x24ce('0x41')]=_[_0x24ce('0x39')](_0x1d76fa[_0x24ce('0x36')],_0x1d76fa['query']);_0x4c28d2[_0x24ce('0x3a')]=_['intersection'](_0x1d76fa[_0x24ce('0x36')],qs['fields'](_0x44178c['query'][_0x24ce('0x3b')]));_0x4c28d2[_0x24ce('0x3a')]=_0x4c28d2[_0x24ce('0x3a')][_0x24ce('0x3c')]?_0x4c28d2[_0x24ce('0x3a')]:_0x1d76fa[_0x24ce('0x36')];_0x4c28d2[_0x24ce('0x3f')]=qs[_0x24ce('0x40')](_0x44178c[_0x24ce('0x38')]['sort']);_0x4c28d2[_0x24ce('0x43')]=qs[_0x24ce('0x41')](_[_0x24ce('0x73')](_0x44178c[_0x24ce('0x38')],_0x1d76fa['filters']));if(_0x44178c['query']['filter']){_0x4c28d2['where']=_['merge'](_0x4c28d2['where'],{'$or':_[_0x24ce('0x30')](_0x4c28d2[_0x24ce('0x3a')],function(_0x434299){var _0x3a9e13={};_0x3a9e13[_0x434299]={'$like':'%'+_0x44178c[_0x24ce('0x38')][_0x24ce('0x45')]+'%'};return _0x3a9e13;})});}_0x4c28d2=_[_0x24ce('0x42')]({},_0x4c28d2,_0x44178c[_0x24ce('0x4a')]);return _0x541f00[_0x24ce('0x72')](_0x4c28d2);}})[_0x24ce('0x26')](function(_0x5eb0fa){if(_0x5eb0fa){_0x3e0350=_0x5eb0fa[_0x24ce('0x3c')];if(!_0x44178c[_0x24ce('0x38')][_0x24ce('0x3d')](_0x24ce('0x3e'))){_0x4c28d2[_0x24ce('0x1e')]=qs[_0x24ce('0x1e')](_0x44178c[_0x24ce('0x38')]['limit']);_0x4c28d2[_0x24ce('0x1c')]=qs[_0x24ce('0x1c')](_0x44178c[_0x24ce('0x38')]['offset']);}return _0x541f00[_0x24ce('0x72')](_0x4c28d2);}})[_0x24ce('0x26')](function(_0x27040a){if(_0x27040a){return _0x27040a?{'count':_0x3e0350,'rows':_0x27040a}:null;}})[_0x24ce('0x26')](respondWithResult(_0x5cb52f,null))['catch'](handleError(_0x5cb52f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 84d6734..4b3c818 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 _0xf2c9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold'];(function(_0x5c9f05,_0x8ea56){var _0x7b016c=function(_0x30261a){while(--_0x30261a){_0x5c9f05['push'](_0x5c9f05['shift']());}};_0x7b016c(++_0x8ea56);}(_0xf2c9,0x12b));var _0x9f2c=function(_0x4690f1,_0x10f22f){_0x4690f1=_0x4690f1-0x0;var _0x5c2b55=_0xf2c9[_0x4690f1];return _0x5c2b55;};'use strict';var _=require(_0x9f2c('0x0'));var util=require(_0x9f2c('0x1'));var logger=require(_0x9f2c('0x2'))(_0x9f2c('0x3'));var moment=require(_0x9f2c('0x4'));var BPromise=require(_0x9f2c('0x5'));var rp=require(_0x9f2c('0x6'));var fs=require('fs');var path=require(_0x9f2c('0x7'));var rimraf=require(_0x9f2c('0x8'));var config=require(_0x9f2c('0x9'));var attributes=require(_0x9f2c('0xa'));module[_0x9f2c('0xb')]=function(_0x35ed53,_0x3e5c2a){return _0x35ed53['define']('VoiceMusicOnHold',attributes,{'tableName':_0x9f2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe73b=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','lodash'];(function(_0x4928f3,_0x59aadf){var _0xbea55c=function(_0x171183){while(--_0x171183){_0x4928f3['push'](_0x4928f3['shift']());}};_0xbea55c(++_0x59aadf);}(_0xe73b,0x12b));var _0xbe73=function(_0xeead8a,_0x3d2400){_0xeead8a=_0xeead8a-0x0;var _0x24742c=_0xe73b[_0xeead8a];return _0x24742c;};'use strict';var _=require(_0xbe73('0x0'));var util=require('util');var logger=require(_0xbe73('0x1'))(_0xbe73('0x2'));var moment=require('moment');var BPromise=require(_0xbe73('0x3'));var rp=require(_0xbe73('0x4'));var fs=require('fs');var path=require(_0xbe73('0x5'));var rimraf=require(_0xbe73('0x6'));var config=require(_0xbe73('0x7'));var attributes=require(_0xbe73('0x8'));module['exports']=function(_0x3b2784,_0x2afad6){return _0x3b2784['define'](_0xbe73('0x9'),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 3ae7a22..4fdc365 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40390c,_0x14f409){var _0x5e4543=function(_0x59730c){while(--_0x59730c){_0x40390c['push'](_0x40390c['shift']());}};_0x5e4543(++_0x14f409);}(_0xe706,0xa3));var _0x6e70=function(_0xe14ee9,_0x4cd8e1){_0xe14ee9=_0xe14ee9-0x0;var _0x1dda60=_0xe706[_0xe14ee9];return _0x1dda60;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +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(_0x1869f6,_0x31a773){var _0x4ede3a=function(_0xa6f1f0){while(--_0xa6f1f0){_0x1869f6['push'](_0x1869f6['shift']());}};_0x4ede3a(++_0x31a773);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 746fcd9..3960370 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 _0x50a6=['../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','index','get','/describe','isAuthenticated','show','/:id/users','post','create','addAgents','/:id/teams','addTeams','put','/:id','delete','destroy','removeTeams','exports','multer','util','express','fs-extra'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x50a6,0xa4));var _0x650a=function(_0x207f67,_0x172ffa){_0x207f67=_0x207f67-0x0;var _0x4d6724=_0x50a6[_0x207f67];return _0x4d6724;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x650a('0x7')]);router[_0x650a('0x8')](_0x650a('0x9'),auth[_0x650a('0xa')](),controller['describe']);router[_0x650a('0x8')]('/:id',auth[_0x650a('0xa')](),controller[_0x650a('0xb')]);router['get'](_0x650a('0xc'),auth[_0x650a('0xa')](),controller['getAgents']);router[_0x650a('0x8')]('/:id/teams',auth[_0x650a('0xa')](),controller['getTeams']);router[_0x650a('0xd')]('/',auth['isAuthenticated'](),controller[_0x650a('0xe')]);router['post'](_0x650a('0xc'),auth[_0x650a('0xa')](),controller[_0x650a('0xf')]);router['post'](_0x650a('0x10'),auth[_0x650a('0xa')](),controller[_0x650a('0x11')]);router[_0x650a('0x12')](_0x650a('0x13'),auth[_0x650a('0xa')](),controller['update']);router[_0x650a('0x14')]('/:id',auth[_0x650a('0xa')](),controller[_0x650a('0x15')]);router[_0x650a('0x14')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0x650a('0x10'),auth[_0x650a('0xa')](),controller[_0x650a('0x16')]);module[_0x650a('0x17')]=router; \ No newline at end of file +var _0xf50b=['getTeams','post','create','addAgents','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','/:id/users','getAgents','/:id/teams'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf50b,0xc8));var _0xbf50=function(_0x2abf3f,_0x2ebc04){_0x2abf3f=_0x2abf3f-0x0;var _0x57d20=_0xf50b[_0x2abf3f];return _0x57d20;};'use strict';var multer=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var path=require('path');var timeout=require(_0xbf50('0x2'));var express=require(_0xbf50('0x3'));var router=express[_0xbf50('0x4')]();var fs_extra=require(_0xbf50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf50('0x6'));var config=require('../../config/environment');var controller=require(_0xbf50('0x7'));router[_0xbf50('0x8')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xa')]);router[_0xbf50('0x8')](_0xbf50('0xb'),auth[_0xbf50('0x9')](),controller['describe']);router[_0xbf50('0x8')](_0xbf50('0xc'),auth[_0xbf50('0x9')](),controller['show']);router['get'](_0xbf50('0xd'),auth[_0xbf50('0x9')](),controller[_0xbf50('0xe')]);router['get'](_0xbf50('0xf'),auth[_0xbf50('0x9')](),controller[_0xbf50('0x10')]);router[_0xbf50('0x11')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0x12')]);router[_0xbf50('0x11')]('/:id/users',auth[_0xbf50('0x9')](),controller[_0xbf50('0x13')]);router[_0xbf50('0x11')](_0xbf50('0xf'),auth[_0xbf50('0x9')](),controller['addTeams']);router['put']('/:id',auth[_0xbf50('0x9')](),controller['update']);router[_0xbf50('0x14')](_0xbf50('0xc'),auth[_0xbf50('0x9')](),controller['destroy']);router[_0xbf50('0x14')]('/:id/users',auth[_0xbf50('0x9')](),controller[_0xbf50('0x15')]);router[_0xbf50('0x14')]('/:id/teams',auth[_0xbf50('0x9')](),controller[_0xbf50('0x16')]);module[_0xbf50('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4f1a73b..fdc1ecf 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 _0x557f=['sequelize','exports','VIRTUAL','system-','getDataValue','name','STRING','INTEGER'];(function(_0x18d77a,_0x2a05cb){var _0x1d6498=function(_0x5166b5){while(--_0x5166b5){_0x18d77a['push'](_0x18d77a['shift']());}};_0x1d6498(++_0x2a05cb);}(_0x557f,0xa0));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf557('0x0'));module[_0xf557('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xf557('0x2')],'get':function(_0x26b725){return _0xf557('0x3')+this[_0xf557('0x4')](_0xf557('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xf557('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0xf557('0x7')]}}; \ No newline at end of file +var _0x4442=['system-','getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4442,0xa4));var _0x2444=function(_0x2f420c,_0x3a9770){_0x2f420c=_0x2f420c-0x0;var _0x2fac00=_0x4442[_0x2f420c];return _0x2fac00;};'use strict';var Sequelize=require(_0x2444('0x0'));module['exports']={'name':{'type':Sequelize[_0x2444('0x1')],'allowNull':![],'unique':_0x2444('0x2')},'prefix':{'type':Sequelize[_0x2444('0x3')],'get':function(_0x464dbf){return _0x2444('0x4')+this[_0x2444('0x5')](_0x2444('0x2'))+'-';}},'description':{'type':Sequelize[_0x2444('0x1')]},'callerIdAll':{'type':Sequelize[_0x2444('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x2444('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6d522f2..6284776 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 _0x84a0=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84a0,0x66));var _0x084a=function(_0x3a69c8,_0xf641ce){_0x3a69c8=_0x3a69c8-0x0;var _0x17896b=_0x84a0[_0x3a69c8];return _0x17896b;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];config[_0x084a('0x18')]=_[_0x084a('0x19')](config[_0x084a('0x18')],{'host':_0x084a('0x1a'),'port':0x18eb});var socket=require(_0x084a('0x1b'))(new Redis(config[_0x084a('0x18')]));require(_0x084a('0x1c'))['register'](socket);function respondWithStatusCode(_0x4277c9,_0x4b9cc5){_0x4b9cc5=_0x4b9cc5||0xcc;return function(_0x225de0){if(_0x225de0){return _0x4277c9[_0x084a('0x1d')](_0x4b9cc5);}return _0x4277c9[_0x084a('0x1e')](_0x4b9cc5)[_0x084a('0x1f')]();};}function respondWithResult(_0xd20527,_0x4cbd16){_0x4cbd16=_0x4cbd16||0xc8;return function(_0x443ebb){if(_0x443ebb){return _0xd20527['status'](_0x4cbd16)[_0x084a('0x20')](_0x443ebb);}};}function respondWithFilteredResult(_0x355b45,_0x4af43e){return function(_0xf2c333){if(_0xf2c333){var _0x32c729=typeof _0x4af43e[_0x084a('0x21')]===_0x084a('0x22')&&typeof _0x4af43e[_0x084a('0x23')]===_0x084a('0x22');var _0x447a19=_0xf2c333[_0x084a('0x24')];var _0x3f60cf=_0x32c729?0x0:_0x4af43e[_0x084a('0x21')];var _0x3c7fd6=_0x32c729?_0xf2c333[_0x084a('0x24')]:_0x4af43e[_0x084a('0x21')]+_0x4af43e[_0x084a('0x23')];var _0xf0dd98;if(_0x3c7fd6>=_0x447a19){_0x3c7fd6=_0x447a19;_0xf0dd98=0xc8;}else{_0xf0dd98=0xce;}_0x355b45['status'](_0xf0dd98);return _0x355b45[_0x084a('0x25')](_0x084a('0x26'),_0x3f60cf+'-'+_0x3c7fd6+'/'+_0x447a19)[_0x084a('0x20')](_0xf2c333);}return null;};}function patchUpdates(_0x2d62bf){return function(_0x1c3f6c){try{jsonpatch['apply'](_0x1c3f6c,_0x2d62bf,!![]);}catch(_0x755c24){return BPromise[_0x084a('0x27')](_0x755c24);}return _0x1c3f6c[_0x084a('0x28')]();};}function saveUpdates(_0x1f2c9f,_0x18b43d){return function(_0x3cdc1e){if(_0x3cdc1e){return _0x3cdc1e['update'](_0x1f2c9f)[_0x084a('0x29')](function(_0x2af138){return _0x2af138;});}return null;};}function removeEntity(_0x54233b,_0x5b1474){return function(_0x8806d5){if(_0x8806d5){return _0x8806d5[_0x084a('0x2a')]()[_0x084a('0x29')](function(){var _0x4c5658=_0x8806d5['get']({'plain':!![]});var _0x4874fe='VoicePrefixes';return db[_0x084a('0x2b')]['destroy']({'where':{'type':_0x4874fe,'resourceId':_0x4c5658['id']}})['then'](function(){return _0x8806d5;});})['then'](function(){_0x54233b[_0x084a('0x1e')](0xcc)[_0x084a('0x1f')]();});}};}function handleEntityNotFound(_0x388062,_0x2c4149){return function(_0x3be7a6){if(!_0x3be7a6){_0x388062[_0x084a('0x1d')](0x194);}return _0x3be7a6;};}function handleError(_0x378de6,_0x16053f){_0x16053f=_0x16053f||0x1f4;return function(_0x5e6ea8){logger[_0x084a('0x2c')](_0x5e6ea8[_0x084a('0x2d')]);if(_0x5e6ea8['name']){delete _0x5e6ea8[_0x084a('0x2e')];}_0x378de6[_0x084a('0x1e')](_0x16053f)[_0x084a('0x2f')](_0x5e6ea8);};}exports[_0x084a('0x30')]=function(_0x448ae9,_0x202602){var _0x3a99fe={},_0x1e971a={},_0x50cb54={'count':0x0,'rows':[]};var _0x2f59a6=_[_0x084a('0x31')](db[_0x084a('0x32')][_0x084a('0x33')],function(_0x49c9db){return{'name':_0x49c9db['fieldName'],'type':_0x49c9db[_0x084a('0x34')][_0x084a('0x35')]};});_0x1e971a[_0x084a('0x36')]=_[_0x084a('0x31')](_0x2f59a6,_0x084a('0x2e'));_0x1e971a['query']=_[_0x084a('0x37')](_0x448ae9[_0x084a('0x38')]);_0x1e971a[_0x084a('0x39')]=_['intersection'](_0x1e971a[_0x084a('0x36')],_0x1e971a[_0x084a('0x38')]);_0x3a99fe[_0x084a('0x3a')]=_['intersection'](_0x1e971a['model'],qs['fields'](_0x448ae9[_0x084a('0x38')][_0x084a('0x3b')]));_0x3a99fe[_0x084a('0x3a')]=_0x3a99fe['attributes'][_0x084a('0x3c')]?_0x3a99fe[_0x084a('0x3a')]:_0x1e971a[_0x084a('0x36')];if(!_0x448ae9[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x3a99fe[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x448ae9[_0x084a('0x38')][_0x084a('0x23')]);_0x3a99fe[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x448ae9[_0x084a('0x38')][_0x084a('0x21')]);}_0x3a99fe[_0x084a('0x3f')]=qs['sort'](_0x448ae9[_0x084a('0x38')][_0x084a('0x40')]);_0x3a99fe[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x448ae9[_0x084a('0x38')],_0x1e971a[_0x084a('0x39')]),_0x2f59a6);if(_0x448ae9[_0x084a('0x38')][_0x084a('0x43')]){_0x3a99fe['where']=_[_0x084a('0x44')](_0x3a99fe[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x2f59a6,function(_0x432eb7){if(_0x432eb7[_0x084a('0x34')]!==_0x084a('0x45')){var _0x515743={};_0x515743[_0x432eb7[_0x084a('0x2e')]]={'$like':'%'+_0x448ae9[_0x084a('0x38')]['filter']+'%'};return _0x515743;}})});}_0x3a99fe=_[_0x084a('0x44')]({},_0x3a99fe,_0x448ae9[_0x084a('0x46')]);var _0x68e0d6={'where':_0x3a99fe['where']};return db[_0x084a('0x32')][_0x084a('0x24')](_0x68e0d6)['then'](function(_0x3e2b92){_0x50cb54[_0x084a('0x24')]=_0x3e2b92;if(_0x448ae9['query']['includeAll']){_0x3a99fe[_0x084a('0x47')]=[{'all':!![]}];}return db[_0x084a('0x32')][_0x084a('0x48')](_0x3a99fe);})[_0x084a('0x29')](function(_0x1e2a2d){_0x50cb54[_0x084a('0x49')]=_0x1e2a2d;return _0x50cb54;})[_0x084a('0x29')](respondWithFilteredResult(_0x202602,_0x3a99fe))[_0x084a('0x4a')](handleError(_0x202602,null));};exports[_0x084a('0x4b')]=function(_0x8b61f5,_0x30f8a4){var _0x593cc8={'raw':![],'where':{'id':_0x8b61f5[_0x084a('0x4c')]['id']}},_0x51dbda={};_0x51dbda[_0x084a('0x36')]=_[_0x084a('0x37')](db['VoicePrefix'][_0x084a('0x33')]);_0x51dbda[_0x084a('0x38')]=_[_0x084a('0x37')](_0x8b61f5[_0x084a('0x38')]);_0x51dbda[_0x084a('0x39')]=_['intersection'](_0x51dbda[_0x084a('0x36')],_0x51dbda['query']);_0x593cc8[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x51dbda[_0x084a('0x36')],qs['fields'](_0x8b61f5['query'][_0x084a('0x3b')]));_0x593cc8[_0x084a('0x3a')]=_0x593cc8['attributes'][_0x084a('0x3c')]?_0x593cc8[_0x084a('0x3a')]:_0x51dbda[_0x084a('0x36')];if(_0x8b61f5[_0x084a('0x38')]['includeAll']){_0x593cc8[_0x084a('0x47')]=[{'all':!![]}];}_0x593cc8=_[_0x084a('0x44')]({},_0x593cc8,_0x8b61f5[_0x084a('0x46')]);return db[_0x084a('0x32')]['find'](_0x593cc8)[_0x084a('0x29')](handleEntityNotFound(_0x30f8a4,null))[_0x084a('0x29')](respondWithResult(_0x30f8a4,null))[_0x084a('0x4a')](handleError(_0x30f8a4,null));};exports[_0x084a('0x2a')]=function(_0x5a718c,_0x502d9a){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x5a718c[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x502d9a,null))[_0x084a('0x29')](removeEntity(_0x502d9a,null))[_0x084a('0x4a')](handleError(_0x502d9a,null));};exports[_0x084a('0x4f')]=function(_0x12c3a8,_0xf6ce0d){return db[_0x084a('0x32')][_0x084a('0x4f')]()[_0x084a('0x29')](respondWithResult(_0xf6ce0d,null))['catch'](handleError(_0xf6ce0d,null));};exports[_0x084a('0x50')]=function(_0x37fce4,_0x29fa4b){var _0x39edc1;return db[_0x084a('0x51')][_0x084a('0x52')](function(_0xa5362){return db['VoicePrefix'][_0x084a('0x50')](_0x37fce4[_0x084a('0x53')],{'transaction':_0xa5362})[_0x084a('0x29')](function(_0x54aa6c){_0x39edc1=_0x54aa6c['get']({'plain':!![]});return db[_0x084a('0x54')]['find']({'where':{'id':_0x39edc1[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x490ad9){return createVoicePrefixExtensions(_0x39edc1,_0x490ad9,_0xa5362);});});})[_0x084a('0x29')](function(){var _0x54e9a5=_0x37fce4['user'][_0x084a('0x56')]({'plain':!![]});if(!_0x54e9a5)throw new Error(_0x084a('0x57'));if(_0x54e9a5[_0x084a('0x58')]===_0x084a('0x59')){var _0x2a8056=_0x39edc1;return db[_0x084a('0x5a')][_0x084a('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x54e9a5[_0x084a('0x5b')]},'raw':!![]})[_0x084a('0x29')](function(_0x3d7f0a){if(_0x3d7f0a&&_0x3d7f0a['autoAssociation']===0x0){return db[_0x084a('0x2b')][_0x084a('0x50')]({'name':_0x2a8056[_0x084a('0x2e')],'resourceId':_0x2a8056['id'],'type':_0x3d7f0a[_0x084a('0x2e')],'sectionId':_0x3d7f0a['id']},{})['then'](function(){return _0x39edc1;});}else{return _0x39edc1;}})[_0x084a('0x4a')](function(_0x58fe64){logger[_0x084a('0x2c')](_0x084a('0x5c'),_0x58fe64);throw _0x58fe64;});}return _0x39edc1;})[_0x084a('0x29')](respondWithResult(_0x29fa4b,null))['catch'](handleError(_0x29fa4b,null));};function Extension(_0x589e38,_0xd37003,_0x2f228c,_0x598075){this[_0x084a('0x5d')]='from-sip';this['exten']=_0x589e38;this[_0x084a('0x5e')]=_0x2f228c;this[_0x084a('0x34')]=_0x084a('0x5f');this[_0x084a('0x60')]=_0x084a('0x61');this[_0x084a('0x62')]=_0xd37003;this[_0x084a('0x63')]=_0x598075;}function createVoicePrefixExtensions(_0x5ab9d6,_0x114aa5,_0x50fe69){return new BPromise(function(_0x445563,_0x12588a){var _0x3668eb=new Extension(formatPrefixName(_0x5ab9d6['prefix']),0x1,_0x084a('0x64'),_0x084a('0x65'));_0x3668eb['VoicePrefixId']=_0x5ab9d6['id'];return db[_0x084a('0x54')]['create'](_0x3668eb,{'transaction':_0x50fe69})['then'](function(_0x1c40f3){var _0x534db3=_0x1c40f3['get']({'plain':!![]});var _0x2368f5=_[_0x084a('0x31')](addVoicePrefixExtensions(_0x5ab9d6,_0x114aa5),function(_0x495304){_0x495304['VoiceExtensionId']=_0x534db3['id'];_0x495304[_0x084a('0x66')]=_0x5ab9d6['id'];return _0x495304;});return db[_0x084a('0x54')][_0x084a('0x67')](_0x2368f5,{'transaction':_0x50fe69})[_0x084a('0x29')](function(_0x45e2d3){if(!_0x45e2d3){return _0x12588a(_0x084a('0x68'));}else{return _0x445563(_0x45e2d3);}})[_0x084a('0x4a')](function(_0x560f60){return _0x12588a(_0x560f60);});});;});};function addVoicePrefixExtensions(_0x51e090,_0x2ba35a){var _0x36ba24=[];var _0x5c77a3=formatPrefixName(_0x51e090[_0x084a('0x69')]);_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x2,_0x084a('0x6b'),_0x084a('0x6c')+_0x51e090['name']));if(_0x51e090[_0x084a('0x6d')]){_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x6b'),'PREFIX-CALLERIDALL='+_0x51e090['callerIdAll']));}else{_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x64'),_0x084a('0x6e')));}_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x4,_0x084a('0x6f'),_0x2ba35a[_0x084a('0x5d')]+','+_0x084a('0x70')+(0x8+_0x51e090['name'][_0x084a('0x3c')])+'}'+','+0x1));return _0x36ba24;}function formatPrefixName(_0x51a066){var _0x4e713c='_';for(var _0x24a553=0x0;_0x24a553<_0x51a066[_0x084a('0x3c')];_0x24a553++){if(_0x51a066[_0x084a('0x71')](_0x24a553)=='-'){_0x4e713c+=_0x51a066['charAt'](_0x24a553);}else{_0x4e713c+='['+_0x51a066[_0x084a('0x71')](_0x24a553)+']';}}_0x4e713c+='.';return _0x4e713c;}exports['update']=function(_0x1eb7be,_0x1054ea,_0x2417b4){var _0x12cef4=_0x1eb7be[_0x084a('0x53')];_0x12cef4[_0x084a('0x69')]='system-'+_0x12cef4['name']+'-';return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x782285){return db[_0x084a('0x32')][_0x084a('0x72')](_0x12cef4,{'where':{'id':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db['VoiceExtension'][_0x084a('0x2a')]({'where':{'VoicePrefixId':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db[_0x084a('0x54')][_0x084a('0x4e')]({'where':{'id':_0x12cef4[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x537578){return createVoicePrefixExtensions(_0x12cef4,_0x537578,_0x782285);});});});})['then'](function(){return db[_0x084a('0x32')][_0x084a('0x73')](_0x12cef4['id']);})[_0x084a('0x29')](respondWithResult(_0x1054ea,null))[_0x084a('0x4a')](handleError(_0x1054ea,null));};exports[_0x084a('0x74')]=function(_0xb287e7,_0x3824db,_0x26cd70){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0xb287e7['params']['id']}})['then'](handleEntityNotFound(_0x3824db,null))['then'](function(_0x2216d4){if(_0x2216d4){return _0x2216d4[_0x084a('0x74')](_0xb287e7['body'][_0x084a('0x75')],_[_0x084a('0x76')](_0xb287e7[_0x084a('0x53')],[_0x084a('0x75'),'id'])||{})['spread'](function(_0x50cb3a){for(var _0x30ea2a=0x0;_0x30ea2a<_0xb287e7[_0x084a('0x53')][_0x084a('0x75')][_0x084a('0x3c')];_0x30ea2a+=0x1){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':Number(_0xb287e7[_0x084a('0x53')]['ids'][_0x30ea2a]),'VoicePrefixId':Number(_0xb287e7[_0x084a('0x4c')]['id'])});}return _0x50cb3a;});}})[_0x084a('0x29')](respondWithResult(_0x3824db,null))[_0x084a('0x4a')](handleError(_0x3824db,null));};exports[_0x084a('0x79')]=function(_0x3dcafb,_0x31b89a,_0x14617e){return db['VoicePrefix'][_0x084a('0x4e')]({'where':{'id':_0x3dcafb[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x31b89a,null))[_0x084a('0x29')](function(_0x417048){if(_0x417048){return _0x417048[_0x084a('0x79')](_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')])[_0x084a('0x29')](function(){if(_[_0x084a('0x7a')](_0x3dcafb[_0x084a('0x38')]['ids'])){for(var _0x2932b6=0x0;_0x2932b6<_0x3dcafb[_0x084a('0x38')]['ids'][_0x084a('0x3c')];_0x2932b6+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')][_0x2932b6]),'VoicePrefixId':Number(_0x3dcafb['params']['id'])});}}else{socket[_0x084a('0x77')](_0x084a('0x7b'),{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')]),'VoicePrefixId':Number(_0x3dcafb[_0x084a('0x4c')]['id'])});}});}})[_0x084a('0x29')](respondWithStatusCode(_0x31b89a,null))[_0x084a('0x4a')](handleError(_0x31b89a,null));};exports[_0x084a('0x7c')]=function(_0x1916b1,_0x8074aa,_0xe03abd){var _0x7c85e3={};var _0x19ea24={};var _0x18cf1e;var _0x3b8dda;return db['VoicePrefix'][_0x084a('0x7d')]({'where':{'id':_0x1916b1[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x8074aa,null))[_0x084a('0x29')](function(_0x1a99b2){if(_0x1a99b2){_0x18cf1e=_0x1a99b2;_0x19ea24[_0x084a('0x36')]=_[_0x084a('0x37')](db[_0x084a('0x7e')]['rawAttributes']);_0x19ea24['query']=_[_0x084a('0x37')](_0x1916b1[_0x084a('0x38')]);_0x19ea24['filters']=_['intersection'](_0x19ea24[_0x084a('0x36')],_0x19ea24['query']);_0x7c85e3[_0x084a('0x3a')]=_['intersection'](_0x19ea24[_0x084a('0x36')],qs[_0x084a('0x3b')](_0x1916b1[_0x084a('0x38')][_0x084a('0x3b')]));_0x7c85e3['attributes']=_0x7c85e3['attributes']['length']?_0x7c85e3[_0x084a('0x3a')]:_0x19ea24[_0x084a('0x36')];_0x7c85e3[_0x084a('0x3f')]=qs['sort'](_0x1916b1[_0x084a('0x38')][_0x084a('0x40')]);_0x7c85e3['where']=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x1916b1['query'],_0x19ea24[_0x084a('0x39')]));if(_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]){_0x7c85e3['where']=_['merge'](_0x7c85e3[_0x084a('0x41')],{'$or':_['map'](_0x7c85e3[_0x084a('0x3a')],function(_0x67d92b){var _0x11894e={};_0x11894e[_0x67d92b]={'$like':'%'+_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]+'%'};return _0x11894e;})});}_0x7c85e3=_[_0x084a('0x44')]({},_0x7c85e3,_0x1916b1['options']);return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})['then'](function(_0x5ce185){if(_0x5ce185){_0x3b8dda=_0x5ce185[_0x084a('0x3c')];if(!_0x1916b1[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x7c85e3[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x1916b1['query']['limit']);_0x7c85e3[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x1916b1[_0x084a('0x38')]['offset']);}return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})[_0x084a('0x29')](function(_0x4eb3da){if(_0x4eb3da){return _0x4eb3da?{'count':_0x3b8dda,'rows':_0x4eb3da}:null;}})['then'](respondWithResult(_0x8074aa,null))[_0x084a('0x4a')](handleError(_0x8074aa,null));};exports['getTeams']=function(_0x5c93b2,_0x135e46,_0x2d9c66){var _0x57d90c={};var _0x42d267={};var _0x2ee08a;var _0x4f40c4;return db[_0x084a('0x32')][_0x084a('0x7d')]({'where':{'id':_0x5c93b2[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x135e46,null))[_0x084a('0x29')](function(_0x29cdb8){if(_0x29cdb8){_0x2ee08a=_0x29cdb8;_0x42d267['model']=_['keys'](db[_0x084a('0x7f')][_0x084a('0x33')]);_0x42d267['query']=_[_0x084a('0x37')](_0x5c93b2['query']);_0x42d267[_0x084a('0x39')]=_[_0x084a('0x4d')](_0x42d267[_0x084a('0x36')],_0x42d267[_0x084a('0x38')]);_0x57d90c[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x42d267['model'],qs['fields'](_0x5c93b2[_0x084a('0x38')][_0x084a('0x3b')]));_0x57d90c[_0x084a('0x3a')]=_0x57d90c[_0x084a('0x3a')][_0x084a('0x3c')]?_0x57d90c['attributes']:_0x42d267[_0x084a('0x36')];_0x57d90c[_0x084a('0x3f')]=qs[_0x084a('0x40')](_0x5c93b2[_0x084a('0x38')]['sort']);_0x57d90c[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x5c93b2[_0x084a('0x38')],_0x42d267[_0x084a('0x39')]));if(_0x5c93b2[_0x084a('0x38')][_0x084a('0x43')]){_0x57d90c[_0x084a('0x41')]=_[_0x084a('0x44')](_0x57d90c[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x57d90c['attributes'],function(_0x5ed84e){var _0x35df86={};_0x35df86[_0x5ed84e]={'$like':'%'+_0x5c93b2['query'][_0x084a('0x43')]+'%'};return _0x35df86;})});}_0x57d90c=_[_0x084a('0x44')]({},_0x57d90c,_0x5c93b2[_0x084a('0x46')]);return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x5412d1){if(_0x5412d1){_0x4f40c4=_0x5412d1[_0x084a('0x3c')];if(!_0x5c93b2[_0x084a('0x38')]['hasOwnProperty'](_0x084a('0x3e'))){_0x57d90c[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x5c93b2['query'][_0x084a('0x23')]);_0x57d90c[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x5c93b2[_0x084a('0x38')][_0x084a('0x21')]);}return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x37d422){if(_0x37d422){return _0x37d422?{'count':_0x4f40c4,'rows':_0x37d422}:null;}})['then'](respondWithResult(_0x135e46,null))[_0x084a('0x4a')](handleError(_0x135e46,null));};exports[_0x084a('0x81')]=function(_0x355c04,_0x8b89d0,_0x5db744){var _0x45a53a=_0x355c04[_0x084a('0x53')][_0x084a('0x75')];var _0xab0f66;return db[_0x084a('0x7f')][_0x084a('0x48')]({'where':{'id':_0x45a53a},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':'Agents','attributes':['id',_0x084a('0x2e'),_0x084a('0x82'),_0x084a('0x83'),_0x084a('0x84')],'raw':!![]}]})[_0x084a('0x29')](function(_0x4087bf){if(_0x4087bf){_0xab0f66=_0x4087bf;var _0x88598d=_[_0x084a('0x85')](_0x4087bf,function(_0x1106ff){var _0x3339d4=_0x1106ff[_0x084a('0x56')]({'plain':!![]});return _0x3339d4[_0x084a('0x86')];});return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x355c04[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x378b74){return db['sequelize'][_0x084a('0x52')](function(_0x383bb8){return _0x378b74[_0x084a('0x81')](_0x45a53a,{'transaction':_0x383bb8})[_0x084a('0x29')](function(){return BPromise['each'](_0xab0f66,function(_0x133f4c){return db[_0x084a('0x87')][_0x084a('0x88')]({'TeamId':_0x133f4c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},{'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){return BPromise[_0x084a('0x89')](_0x88598d,function(_0x5b5c6c){return db['UserVoicePrefix'][_0x084a('0x8a')]({'where':{'UserId':_0x5b5c6c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){_0x88598d[_0x084a('0x8b')](function(_0x3dd10e){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':_0x3dd10e['id'],'VoicePrefixId':_0x378b74['id']});});});});});}})[_0x084a('0x29')](respondWithStatusCode(_0x8b89d0,null))['catch'](handleError(_0x8b89d0,null));};exports[_0x084a('0x8c')]=function(_0x294cca,_0x3be1f3,_0x1c6dec){return db['Team']['findAll']({'where':{'id':_0x294cca[_0x084a('0x38')][_0x084a('0x75')]},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':_0x084a('0x86'),'attributes':['id'],'raw':!![]}]})[_0x084a('0x29')](handleEntityNotFound(_0x3be1f3,null))['then'](function(_0x57ed50){var _0x5288ea=_[_0x084a('0x31')](_0x57ed50,'id');var _0x19aff1=[];var _0x5dab17=[];var _0x3983b1=squel[_0x084a('0x8d')]();_0x3983b1['field'](_0x084a('0x8e'))[_0x084a('0x8f')](_0x084a('0x90'),'tq')['join'](_0x084a('0x91'),'ut',_0x084a('0x92'))[_0x084a('0x41')](_0x084a('0x93'),_0x294cca[_0x084a('0x4c')]['id']);for(var _0x1d6333=0x0;_0x1d6333<_0x57ed50['length'];_0x1d6333+=0x1){let _0x277932=_0x57ed50[_0x1d6333];for(var _0x5f16a1=0x0;_0x5f16a1<_0x277932[_0x084a('0x86')]['length'];_0x5f16a1+=0x1){let _0x4156fa=_0x277932[_0x084a('0x86')][_0x5f16a1];var _0x43f940=_0x3983b1[_0x084a('0x94')]();_0x43f940[_0x084a('0x41')](_0x084a('0x95'),_0x4156fa['id']);_0x5dab17[_0x084a('0x6a')](db[_0x084a('0x51')][_0x084a('0x38')](_0x43f940[_0x084a('0x96')](),{'type':db[_0x084a('0x51')][_0x084a('0x97')]['SELECT']})[_0x084a('0x29')](function(_0x44f94e){if(_0x44f94e[_0x084a('0x3c')]===0x1){return _0x4156fa['id'];}else{var _0x4725a0=_[_0x084a('0x98')](_[_0x084a('0x31')](_0x44f94e,_0x084a('0x99')),function(_0x13b3f0){return _['includes'](_0x5288ea,_0x13b3f0);});if(_0x4725a0){return _0x4156fa['id'];}}}));}}return BPromise['all'](_0x5dab17)['then'](function(_0x1bcb9d){_0x19aff1=_(_0x19aff1)[_0x084a('0x9a')](_0x1bcb9d)[_0x084a('0x9b')]()[_0x084a('0x9c')]();return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x294cca[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x1997ee){return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x1f5843){return _0x1997ee[_0x084a('0x8c')](_0x294cca[_0x084a('0x38')][_0x084a('0x75')],{'transaction':_0x1f5843})[_0x084a('0x29')](function(){if(!_[_0x084a('0x9d')](_0x19aff1)){return _0x1997ee[_0x084a('0x79')](_0x19aff1,{'transaction':_0x1f5843});}})[_0x084a('0x29')](function(){_0x19aff1[_0x084a('0x8b')](function(_0x2ee2a7){socket['emit'](_0x084a('0x7b'),{'UserId':_0x2ee2a7,'VoicePrefixId':_0x1997ee['id']});});});});});});})[_0x084a('0x29')](respondWithStatusCode(_0x3be1f3,null))[_0x084a('0x4a')](handleError(_0x3be1f3,null));}; \ No newline at end of file +var _0x056b=['forEach','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','end','json','offset','limit','undefined','count','set','apply','reject','update','destroy','then','get','VoicePrefixes','UserProfileResource','status','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','NoOp','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x056b,0xb6));var _0xb056=function(_0x2d9f8f,_0x40bc79){_0x2d9f8f=_0x2d9f8f-0x0;var _0x240df4=_0x056b[_0x2d9f8f];return _0x240df4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];config['redis']=_['defaults'](config[_0xb056('0x1b')],{'host':_0xb056('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb056('0x1b')]));require(_0xb056('0x1d'))[_0xb056('0x1e')](socket);function respondWithStatusCode(_0x1197e5,_0x10dd19){_0x10dd19=_0x10dd19||0xcc;return function(_0x3776a1){if(_0x3776a1){return _0x1197e5[_0xb056('0x1f')](_0x10dd19);}return _0x1197e5['status'](_0x10dd19)[_0xb056('0x20')]();};}function respondWithResult(_0x43565e,_0x9e2eed){_0x9e2eed=_0x9e2eed||0xc8;return function(_0x65d7ca){if(_0x65d7ca){return _0x43565e['status'](_0x9e2eed)[_0xb056('0x21')](_0x65d7ca);}};}function respondWithFilteredResult(_0x4e501a,_0x2daffc){return function(_0x311eb9){if(_0x311eb9){var _0x48e140=typeof _0x2daffc[_0xb056('0x22')]==='undefined'&&typeof _0x2daffc[_0xb056('0x23')]===_0xb056('0x24');var _0x5e4bd9=_0x311eb9[_0xb056('0x25')];var _0x48cdaf=_0x48e140?0x0:_0x2daffc[_0xb056('0x22')];var _0x225081=_0x48e140?_0x311eb9[_0xb056('0x25')]:_0x2daffc[_0xb056('0x22')]+_0x2daffc['limit'];var _0x1db585;if(_0x225081>=_0x5e4bd9){_0x225081=_0x5e4bd9;_0x1db585=0xc8;}else{_0x1db585=0xce;}_0x4e501a['status'](_0x1db585);return _0x4e501a[_0xb056('0x26')]('Content-Range',_0x48cdaf+'-'+_0x225081+'/'+_0x5e4bd9)[_0xb056('0x21')](_0x311eb9);}return null;};}function patchUpdates(_0x40ac2d){return function(_0x1de11b){try{jsonpatch[_0xb056('0x27')](_0x1de11b,_0x40ac2d,!![]);}catch(_0x36e539){return BPromise[_0xb056('0x28')](_0x36e539);}return _0x1de11b['save']();};}function saveUpdates(_0x1016da,_0x18a3f2){return function(_0x341544){if(_0x341544){return _0x341544[_0xb056('0x29')](_0x1016da)['then'](function(_0x44a14f){return _0x44a14f;});}return null;};}function removeEntity(_0x10b9b3,_0x5c39db){return function(_0x6d0483){if(_0x6d0483){return _0x6d0483[_0xb056('0x2a')]()[_0xb056('0x2b')](function(){var _0x1d2c66=_0x6d0483[_0xb056('0x2c')]({'plain':!![]});var _0x4024d7=_0xb056('0x2d');return db[_0xb056('0x2e')]['destroy']({'where':{'type':_0x4024d7,'resourceId':_0x1d2c66['id']}})[_0xb056('0x2b')](function(){return _0x6d0483;});})['then'](function(){_0x10b9b3[_0xb056('0x2f')](0xcc)[_0xb056('0x20')]();});}};}function handleEntityNotFound(_0x294874,_0x488185){return function(_0xd53267){if(!_0xd53267){_0x294874[_0xb056('0x1f')](0x194);}return _0xd53267;};}function handleError(_0x4ba5f8,_0x3a9e7d){_0x3a9e7d=_0x3a9e7d||0x1f4;return function(_0x43aa63){logger[_0xb056('0x30')](_0x43aa63[_0xb056('0x31')]);if(_0x43aa63[_0xb056('0x32')]){delete _0x43aa63['name'];}_0x4ba5f8[_0xb056('0x2f')](_0x3a9e7d)[_0xb056('0x33')](_0x43aa63);};}exports[_0xb056('0x34')]=function(_0x248473,_0x103482){var _0x559c34={},_0x16bbd2={},_0x290807={'count':0x0,'rows':[]};var _0x16c1d6=_[_0xb056('0x35')](db[_0xb056('0x36')][_0xb056('0x37')],function(_0x19f277){return{'name':_0x19f277[_0xb056('0x38')],'type':_0x19f277['type'][_0xb056('0x39')]};});_0x16bbd2['model']=_[_0xb056('0x35')](_0x16c1d6,'name');_0x16bbd2['query']=_[_0xb056('0x3a')](_0x248473[_0xb056('0x3b')]);_0x16bbd2[_0xb056('0x3c')]=_[_0xb056('0x3d')](_0x16bbd2[_0xb056('0x3e')],_0x16bbd2[_0xb056('0x3b')]);_0x559c34[_0xb056('0x3f')]=_['intersection'](_0x16bbd2[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x248473['query']['fields']));_0x559c34[_0xb056('0x3f')]=_0x559c34[_0xb056('0x3f')][_0xb056('0x41')]?_0x559c34['attributes']:_0x16bbd2[_0xb056('0x3e')];if(!_0x248473[_0xb056('0x3b')][_0xb056('0x42')](_0xb056('0x43'))){_0x559c34[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x248473[_0xb056('0x3b')][_0xb056('0x23')]);_0x559c34[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x248473[_0xb056('0x3b')][_0xb056('0x22')]);}_0x559c34['order']=qs[_0xb056('0x44')](_0x248473['query'][_0xb056('0x44')]);_0x559c34[_0xb056('0x45')]=qs[_0xb056('0x3c')](_[_0xb056('0x46')](_0x248473[_0xb056('0x3b')],_0x16bbd2[_0xb056('0x3c')]),_0x16c1d6);if(_0x248473[_0xb056('0x3b')][_0xb056('0x47')]){_0x559c34['where']=_[_0xb056('0x48')](_0x559c34[_0xb056('0x45')],{'$or':_[_0xb056('0x35')](_0x16c1d6,function(_0x4c2b1e){if(_0x4c2b1e[_0xb056('0x49')]!=='VIRTUAL'){var _0x39b861={};_0x39b861[_0x4c2b1e[_0xb056('0x32')]]={'$like':'%'+_0x248473[_0xb056('0x3b')][_0xb056('0x47')]+'%'};return _0x39b861;}})});}_0x559c34=_[_0xb056('0x48')]({},_0x559c34,_0x248473[_0xb056('0x4a')]);var _0x57da48={'where':_0x559c34[_0xb056('0x45')]};return db['VoicePrefix'][_0xb056('0x25')](_0x57da48)[_0xb056('0x2b')](function(_0x21d98e){_0x290807[_0xb056('0x25')]=_0x21d98e;if(_0x248473[_0xb056('0x3b')][_0xb056('0x4b')]){_0x559c34[_0xb056('0x4c')]=[{'all':!![]}];}return db[_0xb056('0x36')][_0xb056('0x4d')](_0x559c34);})[_0xb056('0x2b')](function(_0x4fa3c5){_0x290807[_0xb056('0x4e')]=_0x4fa3c5;return _0x290807;})[_0xb056('0x2b')](respondWithFilteredResult(_0x103482,_0x559c34))[_0xb056('0x4f')](handleError(_0x103482,null));};exports['show']=function(_0x2bf4dd,_0x505cad){var _0x49597d={'raw':![],'where':{'id':_0x2bf4dd[_0xb056('0x50')]['id']}},_0x5821e1={};_0x5821e1[_0xb056('0x3e')]=_[_0xb056('0x3a')](db[_0xb056('0x36')]['rawAttributes']);_0x5821e1['query']=_['keys'](_0x2bf4dd['query']);_0x5821e1['filters']=_['intersection'](_0x5821e1[_0xb056('0x3e')],_0x5821e1['query']);_0x49597d[_0xb056('0x3f')]=_[_0xb056('0x3d')](_0x5821e1[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x2bf4dd[_0xb056('0x3b')][_0xb056('0x40')]));_0x49597d[_0xb056('0x3f')]=_0x49597d[_0xb056('0x3f')]['length']?_0x49597d[_0xb056('0x3f')]:_0x5821e1[_0xb056('0x3e')];if(_0x2bf4dd['query'][_0xb056('0x4b')]){_0x49597d[_0xb056('0x4c')]=[{'all':!![]}];}_0x49597d=_[_0xb056('0x48')]({},_0x49597d,_0x2bf4dd[_0xb056('0x4a')]);return db[_0xb056('0x36')][_0xb056('0x51')](_0x49597d)['then'](handleEntityNotFound(_0x505cad,null))[_0xb056('0x2b')](respondWithResult(_0x505cad,null))['catch'](handleError(_0x505cad,null));};exports[_0xb056('0x2a')]=function(_0x3e4a14,_0xde5564){return db[_0xb056('0x36')][_0xb056('0x51')]({'where':{'id':_0x3e4a14[_0xb056('0x50')]['id']}})[_0xb056('0x2b')](handleEntityNotFound(_0xde5564,null))[_0xb056('0x2b')](removeEntity(_0xde5564,null))['catch'](handleError(_0xde5564,null));};exports[_0xb056('0x52')]=function(_0x472a91,_0x5927c7){return db[_0xb056('0x36')][_0xb056('0x52')]()[_0xb056('0x2b')](respondWithResult(_0x5927c7,null))[_0xb056('0x4f')](handleError(_0x5927c7,null));};exports[_0xb056('0x53')]=function(_0x4a9968,_0x122ed7){var _0xc0be0d;return db[_0xb056('0x54')][_0xb056('0x55')](function(_0x1a5170){return db[_0xb056('0x36')]['create'](_0x4a9968[_0xb056('0x56')],{'transaction':_0x1a5170})[_0xb056('0x2b')](function(_0x30ba6e){_0xc0be0d=_0x30ba6e['get']({'plain':!![]});return db[_0xb056('0x57')]['find']({'where':{'id':_0xc0be0d[_0xb056('0x58')]},'raw':!![]})[_0xb056('0x2b')](function(_0x2a064f){return createVoicePrefixExtensions(_0xc0be0d,_0x2a064f,_0x1a5170);});});})[_0xb056('0x2b')](function(){var _0x58c533=_0x4a9968[_0xb056('0x59')][_0xb056('0x2c')]({'plain':!![]});if(!_0x58c533)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58c533[_0xb056('0x5a')]===_0xb056('0x59')){var _0x1d3cdd=_0xc0be0d;return db[_0xb056('0x5b')][_0xb056('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x58c533[_0xb056('0x5c')]},'raw':!![]})[_0xb056('0x2b')](function(_0x10681b){if(_0x10681b&&_0x10681b[_0xb056('0x5d')]===0x0){return db[_0xb056('0x2e')][_0xb056('0x53')]({'name':_0x1d3cdd[_0xb056('0x32')],'resourceId':_0x1d3cdd['id'],'type':_0x10681b[_0xb056('0x32')],'sectionId':_0x10681b['id']},{})[_0xb056('0x2b')](function(){return _0xc0be0d;});}else{return _0xc0be0d;}})[_0xb056('0x4f')](function(_0x1b4a0d){logger[_0xb056('0x30')](_0xb056('0x5e'),_0x1b4a0d);throw _0x1b4a0d;});}return _0xc0be0d;})[_0xb056('0x2b')](respondWithResult(_0x122ed7,null))[_0xb056('0x4f')](handleError(_0x122ed7,null));};function Extension(_0x282c31,_0x28fc90,_0x435fe9,_0x39765e){this[_0xb056('0x5f')]=_0xb056('0x60');this['exten']=_0x282c31;this[_0xb056('0x61')]=_0x435fe9;this[_0xb056('0x49')]=_0xb056('0x62');this[_0xb056('0x63')]=_0xb056('0x64');this[_0xb056('0x65')]=_0x28fc90;this[_0xb056('0x66')]=_0x39765e;}function createVoicePrefixExtensions(_0x55808b,_0x5b03df,_0x30441e){return new BPromise(function(_0x388817,_0x1205cc){var _0x7b81c7=new Extension(formatPrefixName(_0x55808b[_0xb056('0x67')]),0x1,'NoOp',_0xb056('0x68'));_0x7b81c7[_0xb056('0x69')]=_0x55808b['id'];return db[_0xb056('0x57')][_0xb056('0x53')](_0x7b81c7,{'transaction':_0x30441e})['then'](function(_0x405108){var _0x24b037=_0x405108[_0xb056('0x2c')]({'plain':!![]});var _0x5e419e=_[_0xb056('0x35')](addVoicePrefixExtensions(_0x55808b,_0x5b03df),function(_0x2e02d5){_0x2e02d5[_0xb056('0x58')]=_0x24b037['id'];_0x2e02d5['VoicePrefixId']=_0x55808b['id'];return _0x2e02d5;});return db[_0xb056('0x57')][_0xb056('0x6a')](_0x5e419e,{'transaction':_0x30441e})[_0xb056('0x2b')](function(_0x5bf8ce){if(!_0x5bf8ce){return _0x1205cc(_0xb056('0x6b'));}else{return _0x388817(_0x5bf8ce);}})['catch'](function(_0x2d555d){return _0x1205cc(_0x2d555d);});});;});};function addVoicePrefixExtensions(_0x3e18c1,_0x103ff2){var _0x556a93=[];var _0x45d347=formatPrefixName(_0x3e18c1[_0xb056('0x67')]);_0x556a93['push'](new Extension(_0x45d347,0x2,_0xb056('0x6c'),_0xb056('0x6d')+_0x3e18c1[_0xb056('0x32')]));if(_0x3e18c1[_0xb056('0x6e')]){_0x556a93[_0xb056('0x6f')](new Extension(_0x45d347,0x3,'Set','PREFIX-CALLERIDALL='+_0x3e18c1[_0xb056('0x6e')]));}else{_0x556a93['push'](new Extension(_0x45d347,0x3,_0xb056('0x70'),'No\x20callerid\x20available'));}_0x556a93[_0xb056('0x6f')](new Extension(_0x45d347,0x4,_0xb056('0x71'),_0x103ff2[_0xb056('0x5f')]+','+_0xb056('0x72')+(0x8+_0x3e18c1['name']['length'])+'}'+','+0x1));return _0x556a93;}function formatPrefixName(_0xe6caf7){var _0x1e14e1='_';for(var _0x3b3bbf=0x0;_0x3b3bbf<_0xe6caf7[_0xb056('0x41')];_0x3b3bbf++){if(_0xe6caf7['charAt'](_0x3b3bbf)=='-'){_0x1e14e1+=_0xe6caf7[_0xb056('0x73')](_0x3b3bbf);}else{_0x1e14e1+='['+_0xe6caf7['charAt'](_0x3b3bbf)+']';}}_0x1e14e1+='.';return _0x1e14e1;}exports[_0xb056('0x29')]=function(_0x5f0278,_0x2129c5,_0x56bab7){var _0x432501=_0x5f0278[_0xb056('0x56')];_0x432501[_0xb056('0x67')]=_0xb056('0x74')+_0x432501['name']+'-';return db[_0xb056('0x54')]['transaction'](function(_0x227ab0){return db[_0xb056('0x36')][_0xb056('0x29')](_0x432501,{'where':{'id':_0x432501['id']},'transaction':_0x227ab0})[_0xb056('0x2b')](function(){return db[_0xb056('0x57')][_0xb056('0x2a')]({'where':{'VoicePrefixId':_0x432501['id']},'transaction':_0x227ab0})[_0xb056('0x2b')](function(){return db[_0xb056('0x57')][_0xb056('0x51')]({'where':{'id':_0x432501[_0xb056('0x58')]},'raw':!![]})[_0xb056('0x2b')](function(_0x3f6e2f){return createVoicePrefixExtensions(_0x432501,_0x3f6e2f,_0x227ab0);});});});})['then'](function(){return db['VoicePrefix'][_0xb056('0x75')](_0x432501['id']);})['then'](respondWithResult(_0x2129c5,null))[_0xb056('0x4f')](handleError(_0x2129c5,null));};exports['addAgents']=function(_0x208696,_0x5df962,_0x5f4b72){return db['VoicePrefix'][_0xb056('0x51')]({'where':{'id':_0x208696['params']['id']}})['then'](handleEntityNotFound(_0x5df962,null))[_0xb056('0x2b')](function(_0xb6fd9b){if(_0xb6fd9b){return _0xb6fd9b[_0xb056('0x76')](_0x208696['body']['ids'],_['omit'](_0x208696[_0xb056('0x56')],[_0xb056('0x77'),'id'])||{})[_0xb056('0x78')](function(_0x13bd5f){for(var _0x9185c=0x0;_0x9185c<_0x208696[_0xb056('0x56')][_0xb056('0x77')][_0xb056('0x41')];_0x9185c+=0x1){socket[_0xb056('0x79')](_0xb056('0x7a'),{'UserId':Number(_0x208696[_0xb056('0x56')][_0xb056('0x77')][_0x9185c]),'VoicePrefixId':Number(_0x208696[_0xb056('0x50')]['id'])});}return _0x13bd5f;});}})[_0xb056('0x2b')](respondWithResult(_0x5df962,null))['catch'](handleError(_0x5df962,null));};exports['removeAgents']=function(_0x18feb4,_0x5ef886,_0x11ef5f){return db[_0xb056('0x36')][_0xb056('0x51')]({'where':{'id':_0x18feb4[_0xb056('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ef886,null))['then'](function(_0x2e027a){if(_0x2e027a){return _0x2e027a[_0xb056('0x7b')](_0x18feb4[_0xb056('0x3b')]['ids'])['then'](function(){if(_[_0xb056('0x7c')](_0x18feb4[_0xb056('0x3b')]['ids'])){for(var _0x345cf9=0x0;_0x345cf9<_0x18feb4[_0xb056('0x3b')][_0xb056('0x77')][_0xb056('0x41')];_0x345cf9+=0x1){socket[_0xb056('0x79')](_0xb056('0x7d'),{'UserId':Number(_0x18feb4[_0xb056('0x3b')][_0xb056('0x77')][_0x345cf9]),'VoicePrefixId':Number(_0x18feb4[_0xb056('0x50')]['id'])});}}else{socket[_0xb056('0x79')](_0xb056('0x7d'),{'UserId':Number(_0x18feb4['query'][_0xb056('0x77')]),'VoicePrefixId':Number(_0x18feb4[_0xb056('0x50')]['id'])});}});}})[_0xb056('0x2b')](respondWithStatusCode(_0x5ef886,null))['catch'](handleError(_0x5ef886,null));};exports[_0xb056('0x7e')]=function(_0x4dc495,_0x489233,_0x1b0bbb){var _0x3a2f2f={};var _0x2d7c96={};var _0x56578e;var _0x493d0d;return db[_0xb056('0x36')][_0xb056('0x7f')]({'where':{'id':_0x4dc495['params']['id']}})[_0xb056('0x2b')](handleEntityNotFound(_0x489233,null))['then'](function(_0x3b0f93){if(_0x3b0f93){_0x56578e=_0x3b0f93;_0x2d7c96[_0xb056('0x3e')]=_['keys'](db['User'][_0xb056('0x37')]);_0x2d7c96[_0xb056('0x3b')]=_['keys'](_0x4dc495[_0xb056('0x3b')]);_0x2d7c96['filters']=_['intersection'](_0x2d7c96[_0xb056('0x3e')],_0x2d7c96[_0xb056('0x3b')]);_0x3a2f2f[_0xb056('0x3f')]=_[_0xb056('0x3d')](_0x2d7c96[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x4dc495['query'][_0xb056('0x40')]));_0x3a2f2f['attributes']=_0x3a2f2f[_0xb056('0x3f')][_0xb056('0x41')]?_0x3a2f2f['attributes']:_0x2d7c96[_0xb056('0x3e')];_0x3a2f2f[_0xb056('0x80')]=qs['sort'](_0x4dc495[_0xb056('0x3b')]['sort']);_0x3a2f2f[_0xb056('0x45')]=qs['filters'](_[_0xb056('0x46')](_0x4dc495[_0xb056('0x3b')],_0x2d7c96['filters']));if(_0x4dc495[_0xb056('0x3b')]['filter']){_0x3a2f2f[_0xb056('0x45')]=_[_0xb056('0x48')](_0x3a2f2f[_0xb056('0x45')],{'$or':_[_0xb056('0x35')](_0x3a2f2f[_0xb056('0x3f')],function(_0x100a52){var _0x1bac84={};_0x1bac84[_0x100a52]={'$like':'%'+_0x4dc495[_0xb056('0x3b')]['filter']+'%'};return _0x1bac84;})});}_0x3a2f2f=_[_0xb056('0x48')]({},_0x3a2f2f,_0x4dc495['options']);return _0x56578e['getAgents'](_0x3a2f2f);}})['then'](function(_0x2ea984){if(_0x2ea984){_0x493d0d=_0x2ea984[_0xb056('0x41')];if(!_0x4dc495[_0xb056('0x3b')][_0xb056('0x42')]('nolimit')){_0x3a2f2f[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x4dc495[_0xb056('0x3b')][_0xb056('0x23')]);_0x3a2f2f[_0xb056('0x22')]=qs['offset'](_0x4dc495[_0xb056('0x3b')][_0xb056('0x22')]);}return _0x56578e[_0xb056('0x7e')](_0x3a2f2f);}})['then'](function(_0x526035){if(_0x526035){return _0x526035?{'count':_0x493d0d,'rows':_0x526035}:null;}})['then'](respondWithResult(_0x489233,null))['catch'](handleError(_0x489233,null));};exports['getTeams']=function(_0x5021d2,_0x41532c,_0x1f5c6d){var _0xd82e9={};var _0x2b62f1={};var _0x38b119;var _0xcdd8d6;return db['VoicePrefix'][_0xb056('0x7f')]({'where':{'id':_0x5021d2[_0xb056('0x50')]['id']}})[_0xb056('0x2b')](handleEntityNotFound(_0x41532c,null))[_0xb056('0x2b')](function(_0x1ff1e7){if(_0x1ff1e7){_0x38b119=_0x1ff1e7;_0x2b62f1[_0xb056('0x3e')]=_[_0xb056('0x3a')](db[_0xb056('0x81')][_0xb056('0x37')]);_0x2b62f1[_0xb056('0x3b')]=_['keys'](_0x5021d2['query']);_0x2b62f1['filters']=_[_0xb056('0x3d')](_0x2b62f1['model'],_0x2b62f1[_0xb056('0x3b')]);_0xd82e9[_0xb056('0x3f')]=_[_0xb056('0x3d')](_0x2b62f1[_0xb056('0x3e')],qs[_0xb056('0x40')](_0x5021d2[_0xb056('0x3b')][_0xb056('0x40')]));_0xd82e9[_0xb056('0x3f')]=_0xd82e9[_0xb056('0x3f')]['length']?_0xd82e9[_0xb056('0x3f')]:_0x2b62f1[_0xb056('0x3e')];_0xd82e9[_0xb056('0x80')]=qs[_0xb056('0x44')](_0x5021d2['query']['sort']);_0xd82e9[_0xb056('0x45')]=qs[_0xb056('0x3c')](_[_0xb056('0x46')](_0x5021d2[_0xb056('0x3b')],_0x2b62f1[_0xb056('0x3c')]));if(_0x5021d2[_0xb056('0x3b')][_0xb056('0x47')]){_0xd82e9['where']=_[_0xb056('0x48')](_0xd82e9['where'],{'$or':_[_0xb056('0x35')](_0xd82e9[_0xb056('0x3f')],function(_0x5ba4b4){var _0x13ea6a={};_0x13ea6a[_0x5ba4b4]={'$like':'%'+_0x5021d2['query'][_0xb056('0x47')]+'%'};return _0x13ea6a;})});}_0xd82e9=_[_0xb056('0x48')]({},_0xd82e9,_0x5021d2[_0xb056('0x4a')]);return _0x38b119[_0xb056('0x82')](_0xd82e9);}})[_0xb056('0x2b')](function(_0x48dbfb){if(_0x48dbfb){_0xcdd8d6=_0x48dbfb[_0xb056('0x41')];if(!_0x5021d2[_0xb056('0x3b')][_0xb056('0x42')](_0xb056('0x43'))){_0xd82e9[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x5021d2[_0xb056('0x3b')][_0xb056('0x23')]);_0xd82e9[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x5021d2[_0xb056('0x3b')][_0xb056('0x22')]);}return _0x38b119[_0xb056('0x82')](_0xd82e9);}})[_0xb056('0x2b')](function(_0x3837af){if(_0x3837af){return _0x3837af?{'count':_0xcdd8d6,'rows':_0x3837af}:null;}})[_0xb056('0x2b')](respondWithResult(_0x41532c,null))[_0xb056('0x4f')](handleError(_0x41532c,null));};exports[_0xb056('0x83')]=function(_0x1a8d5b,_0x341a86,_0x506e61){var _0x263bbe=_0x1a8d5b[_0xb056('0x56')][_0xb056('0x77')];var _0x3de775;return db[_0xb056('0x81')][_0xb056('0x4d')]({'where':{'id':_0x263bbe},'attributes':['id'],'include':[{'model':db[_0xb056('0x84')],'as':_0xb056('0x85'),'attributes':['id',_0xb056('0x32'),_0xb056('0x86'),_0xb056('0x87'),'interface'],'raw':!![]}]})['then'](function(_0x330dd3){if(_0x330dd3){_0x3de775=_0x330dd3;var _0x5e5b65=_[_0xb056('0x88')](_0x330dd3,function(_0x88e59f){var _0x2b36b0=_0x88e59f['get']({'plain':!![]});return _0x2b36b0[_0xb056('0x85')];});return db[_0xb056('0x36')]['find']({'where':{'id':_0x1a8d5b['params']['id']}})[_0xb056('0x2b')](function(_0x3f80ab){return db[_0xb056('0x54')][_0xb056('0x55')](function(_0x11276e){return _0x3f80ab['addTeams'](_0x263bbe,{'transaction':_0x11276e})['then'](function(){return BPromise[_0xb056('0x89')](_0x3de775,function(_0x587fcc){return db[_0xb056('0x8a')][_0xb056('0x8b')]({'TeamId':_0x587fcc['id'],'VoicePrefixId':_0x1a8d5b[_0xb056('0x50')]['id']},{'transaction':_0x11276e});});})[_0xb056('0x2b')](function(){return BPromise['each'](_0x5e5b65,function(_0x31fc76){return db[_0xb056('0x8c')][_0xb056('0x8d')]({'where':{'UserId':_0x31fc76['id'],'VoicePrefixId':_0x1a8d5b[_0xb056('0x50')]['id']},'transaction':_0x11276e});});})[_0xb056('0x2b')](function(){_0x5e5b65[_0xb056('0x8e')](function(_0x221269){socket['emit'](_0xb056('0x7a'),{'UserId':_0x221269['id'],'VoicePrefixId':_0x3f80ab['id']});});});});});}})[_0xb056('0x2b')](respondWithStatusCode(_0x341a86,null))[_0xb056('0x4f')](handleError(_0x341a86,null));};exports[_0xb056('0x8f')]=function(_0x38c9fd,_0x3d277a,_0x3803bc){return db['Team'][_0xb056('0x4d')]({'where':{'id':_0x38c9fd[_0xb056('0x3b')][_0xb056('0x77')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb056('0x2b')](handleEntityNotFound(_0x3d277a,null))['then'](function(_0x59020b){var _0x158f35=_[_0xb056('0x35')](_0x59020b,'id');var _0x18ee53=[];var _0xc4c8b4=[];var _0x1cca4d=squel[_0xb056('0x90')]();_0x1cca4d[_0xb056('0x91')](_0xb056('0x92'))['from']('team_has_voice_prefixes','tq')[_0xb056('0x93')](_0xb056('0x94'),'ut',_0xb056('0x95'))[_0xb056('0x45')](_0xb056('0x96'),_0x38c9fd[_0xb056('0x50')]['id']);for(var _0x5a7549=0x0;_0x5a7549<_0x59020b['length'];_0x5a7549+=0x1){let _0x4c9894=_0x59020b[_0x5a7549];for(var _0x2b75e4=0x0;_0x2b75e4<_0x4c9894['Agents'][_0xb056('0x41')];_0x2b75e4+=0x1){let _0x505f0d=_0x4c9894[_0xb056('0x85')][_0x2b75e4];var _0x462eb8=_0x1cca4d[_0xb056('0x97')]();_0x462eb8[_0xb056('0x45')](_0xb056('0x98'),_0x505f0d['id']);_0xc4c8b4[_0xb056('0x6f')](db[_0xb056('0x54')]['query'](_0x462eb8[_0xb056('0x99')](),{'type':db[_0xb056('0x54')][_0xb056('0x9a')][_0xb056('0x9b')]})[_0xb056('0x2b')](function(_0x499233){if(_0x499233[_0xb056('0x41')]===0x1){return _0x505f0d['id'];}else{var _0x391783=_[_0xb056('0x9c')](_[_0xb056('0x35')](_0x499233,_0xb056('0x9d')),function(_0x2f08e1){return _[_0xb056('0x9e')](_0x158f35,_0x2f08e1);});if(_0x391783){return _0x505f0d['id'];}}}));}}return BPromise[_0xb056('0x9f')](_0xc4c8b4)[_0xb056('0x2b')](function(_0x42b105){_0x18ee53=_(_0x18ee53)[_0xb056('0xa0')](_0x42b105)['compact']()[_0xb056('0xa1')]();return db[_0xb056('0x36')]['find']({'where':{'id':_0x38c9fd['params']['id']}})['then'](function(_0x512997){return db[_0xb056('0x54')][_0xb056('0x55')](function(_0x2f7ca9){return _0x512997[_0xb056('0x8f')](_0x38c9fd[_0xb056('0x3b')][_0xb056('0x77')],{'transaction':_0x2f7ca9})[_0xb056('0x2b')](function(){if(!_['isEmpty'](_0x18ee53)){return _0x512997[_0xb056('0x7b')](_0x18ee53,{'transaction':_0x2f7ca9});}})['then'](function(){_0x18ee53['forEach'](function(_0x33b1ad){socket[_0xb056('0x79')](_0xb056('0x7d'),{'UserId':_0x33b1ad,'VoicePrefixId':_0x512997['id']});});});});});});})[_0xb056('0x2b')](respondWithStatusCode(_0x3d277a,null))[_0xb056('0x4f')](handleError(_0x3d277a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 84c4bbe..26bf8d6 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 _0x6a61=['exports','events','../../mysqldb','VoicePrefix','save','emit','hasOwnProperty'];(function(_0x5a70a2,_0xf1e7f9){var _0x1c88fd=function(_0x2b36f3){while(--_0x2b36f3){_0x5a70a2['push'](_0x5a70a2['shift']());}};_0x1c88fd(++_0xf1e7f9);}(_0x6a61,0x1cf));var _0x16a6=function(_0xabf4c4,_0x5d9f24){_0xabf4c4=_0xabf4c4-0x0;var _0x7c4f5a=_0x6a61[_0xabf4c4];return _0x7c4f5a;};'use strict';var EventEmitter=require(_0x16a6('0x0'));var VoicePrefix=require(_0x16a6('0x1'))['db'][_0x16a6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16a6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x159bf2){return function(_0xc0ccc4,_0x515a2a,_0x4173aa){VoicePrefixEvents[_0x16a6('0x4')](_0x159bf2+':'+_0xc0ccc4['id'],_0xc0ccc4);VoicePrefixEvents[_0x16a6('0x4')](_0x159bf2,_0xc0ccc4);_0x4173aa(null);};}for(var e in events){if(events[_0x16a6('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x16a6('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xcb2d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0xbf970c,_0x57b457){var _0xa74d9e=function(_0x7a6e9b){while(--_0x7a6e9b){_0xbf970c['push'](_0xbf970c['shift']());}};_0xa74d9e(++_0x57b457);}(_0xcb2d,0xd7));var _0xdcb2=function(_0x4d52c6,_0x398280){_0x4d52c6=_0x4d52c6-0x0;var _0x590ff1=_0xcb2d[_0x4d52c6];return _0x590ff1;};'use strict';var EventEmitter=require(_0xdcb2('0x0'));var VoicePrefix=require(_0xdcb2('0x1'))['db'][_0xdcb2('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdcb2('0x3')](0x0);var events={'afterCreate':_0xdcb2('0x4'),'afterUpdate':_0xdcb2('0x5'),'afterDestroy':_0xdcb2('0x6')};function emitEvent(_0x47f29a){return function(_0x5bfbc6,_0x56120e,_0x39106c){VoicePrefixEvents[_0xdcb2('0x7')](_0x47f29a+':'+_0x5bfbc6['id'],_0x5bfbc6);VoicePrefixEvents[_0xdcb2('0x7')](_0x47f29a,_0x5bfbc6);_0x39106c(null);};}for(var e in events){if(events[_0xdcb2('0x8')](e)){var event=events[e];VoicePrefix[_0xdcb2('0x9')](e,emitEvent(event));}}module[_0xdcb2('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2b1ff92..934d540 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 _0x1679=['api','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0x1679,0x142));var _0x9167=function(_0x2b8c86,_0x49773b){_0x2b8c86=_0x2b8c86-0x0;var _0x4cd662=_0x1679[_0x2b8c86];return _0x4cd662;};'use strict';var _=require(_0x9167('0x0'));var util=require(_0x9167('0x1'));var logger=require(_0x9167('0x2'))(_0x9167('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9167('0x4'));var fs=require('fs');var path=require(_0x9167('0x5'));var rimraf=require(_0x9167('0x6'));var config=require(_0x9167('0x7'));var attributes=require(_0x9167('0x8'));module[_0x9167('0x9')]=function(_0x16ec73,_0x5d1a22){return _0x16ec73[_0x9167('0xa')](_0x9167('0xb'),attributes,{'tableName':_0x9167('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6868=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','voice_prefixes'];(function(_0xf9bb6a,_0x472270){var _0x59996a=function(_0x2e3356){while(--_0x2e3356){_0xf9bb6a['push'](_0xf9bb6a['shift']());}};_0x59996a(++_0x472270);}(_0x6868,0x186));var _0x8686=function(_0x7e1db7,_0x1f6004){_0x7e1db7=_0x7e1db7-0x0;var _0x22e3fe=_0x6868[_0x7e1db7];return _0x22e3fe;};'use strict';var _=require(_0x8686('0x0'));var util=require(_0x8686('0x1'));var logger=require('../../config/logger')(_0x8686('0x2'));var moment=require(_0x8686('0x3'));var BPromise=require(_0x8686('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8686('0x5'));var config=require(_0x8686('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x8686('0x7')]=function(_0xf390f3,_0x79e26e){return _0xf390f3[_0x8686('0x8')]('VoicePrefix',attributes,{'tableName':_0x8686('0x9'),'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 6beea34..59244b6 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 _0xcdd2=['./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0xfd27a0,_0x1f4e14){var _0x1106f0=function(_0x52a0ec){while(--_0x52a0ec){_0xfd27a0['push'](_0xfd27a0['shift']());}};_0x1106f0(++_0x1f4e14);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});config[_0x2cdd('0xb')]=_[_0x2cdd('0xc')](config[_0x2cdd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2cdd('0xd'))['register'](socket);function respondWithRpcPromise(_0x12cdca,_0x3e3cf0,_0x370b33){return new BPromise(function(_0x555ba7,_0x3feff9){return client[_0x2cdd('0xe')](_0x12cdca,_0x370b33)[_0x2cdd('0xf')](function(_0x20ab30){logger[_0x2cdd('0x10')](_0x2cdd('0x11'),_0x3e3cf0,'request\x20sent');logger['debug'](_0x2cdd('0x12'),_0x3e3cf0,_0x2cdd('0x13'),JSON['stringify'](_0x20ab30));if(_0x20ab30[_0x2cdd('0x14')]){if(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x15')]===0x1f4){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30['error'][_0x2cdd('0x16')]);return _0x3feff9(_0x20ab30[_0x2cdd('0x14')]['message']);}logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);return _0x555ba7(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);}else{logger['info'](_0x2cdd('0x11'),_0x3e3cf0,_0x2cdd('0x13'));_0x555ba7(_0x20ab30[_0x2cdd('0x17')][_0x2cdd('0x16')]);}})['catch'](function(_0x23f7a6){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x23f7a6);_0x3feff9(_0x23f7a6);});});} \ No newline at end of file +var _0x6faf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6faf,0xf9));var _0xf6fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6faf[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var moment=require(_0xf6fa('0x1'));var BPromise=require(_0xf6fa('0x2'));var rs=require(_0xf6fa('0x3'));var fs=require('fs');var Redis=require(_0xf6fa('0x4'));var db=require(_0xf6fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6fa('0x6'))('rpc');var config=require(_0xf6fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6fa('0x8')][_0xf6fa('0x9')]({'port':0x232a});config[_0xf6fa('0xa')]=_[_0xf6fa('0xb')](config[_0xf6fa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6fa('0xc'))(new Redis(config[_0xf6fa('0xa')]));require(_0xf6fa('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a1d49,_0x3148bd,_0x535fbc){return new BPromise(function(_0x196e0d,_0x336a07){return client['request'](_0x4a1d49,_0x535fbc)[_0xf6fa('0xe')](function(_0x4a1e5e){logger[_0xf6fa('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x3148bd,'request\x20sent');logger['debug'](_0xf6fa('0x10'),_0x3148bd,_0xf6fa('0x11'),JSON[_0xf6fa('0x12')](_0x4a1e5e));if(_0x4a1e5e[_0xf6fa('0x13')]){if(_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x14')]===0x1f4){logger[_0xf6fa('0x13')](_0xf6fa('0x15'),_0x3148bd,_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x16')]);return _0x336a07(_0x4a1e5e[_0xf6fa('0x13')]['message']);}logger[_0xf6fa('0x13')](_0xf6fa('0x15'),_0x3148bd,_0x4a1e5e['error'][_0xf6fa('0x16')]);return _0x196e0d(_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x16')]);}else{logger['info'](_0xf6fa('0x15'),_0x3148bd,_0xf6fa('0x11'));_0x196e0d(_0x4a1e5e[_0xf6fa('0x17')][_0xf6fa('0x16')]);}})[_0xf6fa('0x18')](function(_0x553daa){logger[_0xf6fa('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x3148bd,_0x553daa);_0x336a07(_0x553daa);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 70cabde..b9792fd 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 _0x2a41=['./voicePrefix.events','remove','update','emit','removeListener','voicePrefix:'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x2a41,0x126));var _0x12a4=function(_0x461d52,_0x43604b){_0x461d52=_0x461d52-0x0;var _0x25d252=_0x2a41[_0x461d52];return _0x25d252;};'use strict';var VoicePrefixEvents=require(_0x12a4('0x0'));var events=['save',_0x12a4('0x1'),_0x12a4('0x2')];function createListener(_0xfc6b0b,_0x321075){return function(_0x1b4dd3){_0x321075[_0x12a4('0x3')](_0xfc6b0b,_0x1b4dd3);};}function removeListener(_0x2a2724,_0x28a00e){return function(){VoicePrefixEvents[_0x12a4('0x4')](_0x2a2724,_0x28a00e);};}exports['register']=function(_0x379b3c){for(var _0x7fc347=0x0,_0x58fffc=events['length'];_0x7fc347<_0x58fffc;_0x7fc347++){var _0x2042cc=events[_0x7fc347];var _0x5ae867=createListener(_0x12a4('0x5')+_0x2042cc,_0x379b3c);VoicePrefixEvents['on'](_0x2042cc,_0x5ae867);}}; \ No newline at end of file +var _0xa74f=['emit','removeListener','length','voicePrefix:','remove'];(function(_0x134ec3,_0x1ae71f){var _0x19c90a=function(_0x1a1f9f){while(--_0x1a1f9f){_0x134ec3['push'](_0x134ec3['shift']());}};_0x19c90a(++_0x1ae71f);}(_0xa74f,0x9a));var _0xfa74=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xa74f[_0x1c5950];return _0x2b720a;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xfa74('0x0'),'update'];function createListener(_0x4b5765,_0x29e4c8){return function(_0x110824){_0x29e4c8[_0xfa74('0x1')](_0x4b5765,_0x110824);};}function removeListener(_0x25a9b7,_0x5b367b){return function(){VoicePrefixEvents[_0xfa74('0x2')](_0x25a9b7,_0x5b367b);};}exports['register']=function(_0x543cfe){for(var _0x43dd2f=0x0,_0x9ddbd2=events[_0xfa74('0x3')];_0x43dd2f<_0x9ddbd2;_0x43dd2f++){var _0x2d9fa9=events[_0x43dd2f];var _0x287921=createListener(_0xfa74('0x4')+_0x2d9fa9,_0x543cfe);VoicePrefixEvents['on'](_0x2d9fa9,_0x287921);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ff79acf..116fdd1 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(_0x489cc9,_0x68371e){var _0x1d5204=function(_0x4f574b){while(--_0x4f574b){_0x489cc9['push'](_0x489cc9['shift']());}};_0x1d5204(++_0x68371e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x2a1f04,_0x5dae41){var _0x55dd6c=function(_0x3c3143){while(--_0x3c3143){_0x2a1f04['push'](_0x2a1f04['shift']());}};_0x55dd6c(++_0x5dae41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 f446bd2..cfe298d 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 _0x5760=['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)','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','booked','roundrobin','progressive','predictive','INTEGER','yes','once','periodic_announce','join','joinempty','leavewhenempty','split','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x5760,0x18c));var _0x0576=function(_0x1b064d,_0x55b3ee){_0x1b064d=_0x1b064d-0x0;var _0x50c8fc=_0x5760[_0x1b064d];return _0x50c8fc;};'use strict';var Sequelize=require(_0x0576('0x0'));module[_0x0576('0x1')]={'name':{'type':Sequelize[_0x0576('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x4'),_0x0576('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x0576('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x0576('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x0576('0x6'),_0x0576('0x7'),_0x0576('0x8'),_0x0576('0x9'),_0x0576('0xa'),_0x0576('0xb'),_0x0576('0xc'),_0x0576('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x12c861){this[_0x0576('0xe')](_0x0576('0xf'),_0x12c861?_0x12c861:_0x0576('0xa'));},'get':function(){var _0xbd5e55=this[_0x0576('0x10')](_0x0576('0x11'));var _0xc63180=this[_0x0576('0x10')]('dialMethod');var _0x48518c=this['getDataValue'](_0x0576('0xf'));if(_0xbd5e55===_0x0576('0x4')){return _0x48518c;}if(_0xc63180===_0x0576('0x12')&&_0x48518c===_0x0576('0xa')||_0xc63180===_0x0576('0x12')&&_0x48518c===_0x0576('0x13')){return _0x48518c;}if(_0xc63180===_0x0576('0x14')||_0xc63180===_0x0576('0x15')||_0xc63180==='power'){return _0x48518c;}return null;}},'servicelevel':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0576('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0576('0x16')](0xb)},'timeout':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0576('0x2')]},'weight':{'type':Sequelize[_0x0576('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0576('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0576('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0576('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0576('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0576('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0576('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0576('0x17')},'announce_holdtime':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no',_0x0576('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0576('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0576('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0576('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x0576('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0576('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0576('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0576('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0576('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x0576('0x2')]},'queue_less_than':{'type':Sequelize[_0x0576('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x925800){this['setDataValue'](_0x0576('0x19'),_0x925800?_0x925800['join'](','):[]);},'get':function(){return this[_0x0576('0x10')](_0x0576('0x19'))?this[_0x0576('0x10')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0576('0x2')],'defaultValue':_0x0576('0x17'),'set':function(_0x325d2a){this['setDataValue']('joinempty',_0x325d2a?_0x325d2a[_0x0576('0x1a')](','):undefined);},'get':function(){return this[_0x0576('0x10')](_0x0576('0x1b'))?this[_0x0576('0x10')](_0x0576('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x109035){this[_0x0576('0xe')]('leavewhenempty',_0x109035?_0x109035[_0x0576('0x1a')](','):undefined);},'get':function(){return this[_0x0576('0x10')](_0x0576('0x1c'))?this[_0x0576('0x10')](_0x0576('0x1c'))[_0x0576('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0576('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x554471){this[_0x0576('0xe')]('acw',_0x554471);if(_0x554471){if(this['getDataValue'](_0x0576('0x1e'))<0x2){this['setDataValue'](_0x0576('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0576('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0576('0x1f')],'defaultValue':0x0,'comment':_0x0576('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x0576('0x14'),'power',_0x0576('0x15'),'booked'),'defaultValue':'progressive','comment':_0x0576('0x21')},'dialLimitChannel':{'type':Sequelize[_0x0576('0x16')](0x4)[_0x0576('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0576('0x23')},'dialLimitQueue':{'type':Sequelize[_0x0576('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0576('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x0576('0x3')](_0x0576('0x25'),_0x0576('0x26')),'defaultValue':_0x0576('0x26'),'comment':_0x0576('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x0576('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0576('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0576('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0576('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('0x29')},'dialQueueOptions':{'type':Sequelize[_0x0576('0x2')],'defaultValue':_0x0576('0x2a'),'comment':_0x0576('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x0576('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('0x2c')},'dialQueueProject':{'type':Sequelize[_0x0576('0x2')],'comment':_0x0576('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0576('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0x3,'comment':_0x0576('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0576('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0576('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x0576('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0576('0x3')]('always',_0x0576('0x34'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0576('0x1f')],'defaultValue':0x0,'comment':_0x0576('0x35')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0576('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x0576('0x16')](0x9)[_0x0576('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0576('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0576('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0576('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0576('0x16')](0x9)[_0x0576('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0576('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x0576('0x16')](0x9)[_0x0576('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0576('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0576('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0576('0x16')](0x9)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0576('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0576('0x16')](0x9)[_0x0576('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0576('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x0576('0x1f')],'defaultValue':0x0,'comment':_0x0576('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x0576('0x3e'),_0x0576('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x0576('0x2')],'comment':_0x0576('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0576('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0576('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0576('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('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[_0x0576('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0576('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0576('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0576('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0576('0x16')](0x5)[_0x0576('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0576('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0576('0x16')],'allowNull':!![],'comment':_0x0576('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x0576('0x1f')],'defaultValue':![],'comment':_0x0576('0x48'),'set':function(_0xb02bbc){if(!_0xb02bbc)this[_0x0576('0xe')]('mandatoryDispositionPauseId',null);this[_0x0576('0xe')](_0x0576('0x49'),_0xb02bbc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0576('0x16')](0x3)[_0x0576('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0576('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0576('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xbd8e=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','outbound','inbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','getDataValue','type','strategy','booked','roundrobin','predictive','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','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'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbd8e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xebd8('0x0'));module[_0xebd8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xebd8('0x2')]('inbound',_0xebd8('0x3')),'allowNull':![],'defaultValue':_0xebd8('0x4')},'musiconhold':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':_0xebd8('0x6')},'announce':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xebd8('0x7'),_0xebd8('0x8'),_0xebd8('0x9'),_0xebd8('0xa'),_0xebd8('0xb'),'linear',_0xebd8('0xc'),_0xebd8('0xd')),'allowNull':![],'defaultValue':_0xebd8('0x7'),'set':function(_0x13afa5){this['setDataValue']('strategy',_0x13afa5?_0x13afa5:'rrmemory');},'get':function(){var _0x3fd649=this[_0xebd8('0xe')](_0xebd8('0xf'));var _0x2408bf=this[_0xebd8('0xe')]('dialMethod');var _0x6e99cd=this['getDataValue'](_0xebd8('0x10'));if(_0x3fd649===_0xebd8('0x4')){return _0x6e99cd;}if(_0x2408bf==='booked'&&_0x6e99cd===_0xebd8('0xb')||_0x2408bf===_0xebd8('0x11')&&_0x6e99cd===_0xebd8('0x12')){return _0x6e99cd;}if(_0x2408bf==='progressive'||_0x2408bf===_0xebd8('0x13')||_0x2408bf==='power'){return _0x6e99cd;}return null;}},'servicelevel':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xebd8('0x5')]},'weight':{'type':Sequelize[_0xebd8('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':_0xebd8('0x15')},'autopause':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no',_0xebd8('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xebd8('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xebd8('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xebd8('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xebd8('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xebd8('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':_0xebd8('0x15')},'announce_holdtime':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no',_0xebd8('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xebd8('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xebd8('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xebd8('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xebd8('0x5')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xebd8('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xebd8('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xebd8('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xebd8('0x18')],'set':function(_0x56de78){this[_0xebd8('0x19')](_0xebd8('0x1a'),_0x56de78?_0x56de78['join'](','):[]);},'get':function(){return this[_0xebd8('0xe')]('periodic_announce')?this[_0xebd8('0xe')](_0xebd8('0x1a'))[_0xebd8('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x136bde){this[_0xebd8('0x19')](_0xebd8('0x1c'),_0x136bde?_0x136bde['join'](','):undefined);},'get':function(){return this[_0xebd8('0xe')](_0xebd8('0x1c'))?this[_0xebd8('0xe')](_0xebd8('0x1c'))[_0xebd8('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':'no','set':function(_0x40a9ae){this[_0xebd8('0x19')](_0xebd8('0x1d'),_0x40a9ae?_0x40a9ae[_0xebd8('0x1e')](','):undefined);},'get':function(){return this[_0xebd8('0xe')](_0xebd8('0x1d'))?this[_0xebd8('0xe')](_0xebd8('0x1d'))[_0xebd8('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xebd8('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xebd8('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xebd8('0x5')]},'description':{'type':Sequelize[_0xebd8('0x5')]},'acw':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':0x0,'set':function(_0x500cef){this[_0xebd8('0x19')]('acw',_0x500cef);if(_0x500cef){if(this[_0xebd8('0xe')](_0xebd8('0x20'))<0x2){this[_0xebd8('0x19')](_0xebd8('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xebd8('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':0x0,'comment':_0xebd8('0x21')},'dialMethod':{'type':Sequelize[_0xebd8('0x2')]('preview',_0xebd8('0x22'),_0xebd8('0x23'),'predictive',_0xebd8('0x11')),'defaultValue':'progressive','comment':_0xebd8('0x24')},'dialLimitChannel':{'type':Sequelize[_0xebd8('0x14')](0x4)[_0xebd8('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xebd8('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xebd8('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xebd8('0x27')},'dialPowerLevel':{'type':Sequelize[_0xebd8('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xebd8('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xebd8('0x2')](_0xebd8('0x2a'),_0xebd8('0x2b')),'defaultValue':_0xebd8('0x2b'),'comment':_0xebd8('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xebd8('0x28')](0x2)[_0xebd8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xebd8('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xebd8('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xebd8('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xebd8('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd8('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':_0xebd8('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd8('0x31')},'dialQueueProject':{'type':Sequelize[_0xebd8('0x5')],'comment':_0xebd8('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xebd8('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd8('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xebd8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd8('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0x3,'comment':_0xebd8('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':_0xebd8('0x36')},'dialPrefix':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xebd8('0x37'),'never',_0xebd8('0x38')),'defaultValue':_0xebd8('0x37')},'dialAMDActive':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':0x0,'comment':_0xebd8('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xebd8('0x14')](0x9)[_0xebd8('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xebd8('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xebd8('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xebd8('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xebd8('0x14')](0x9)[_0xebd8('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xebd8('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xebd8('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xebd8('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xebd8('0x14')](0x9)[_0xebd8('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xebd8('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xebd8('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xebd8('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xebd8('0x14')](0x9)[_0xebd8('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xebd8('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xebd8('0x14')](0x5)[_0xebd8('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xebd8('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xebd8('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xebd8('0x14')](0x5)[_0xebd8('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xebd8('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xebd8('0x43'),_0xebd8('0x44')),'defaultValue':_0xebd8('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xebd8('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xebd8('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xebd8('0x14')](0x5)[_0xebd8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd8('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xebd8('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd8('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd8('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xebd8('0x14')](0x5)[_0xebd8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd8('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xebd8('0x14')](0x5)[_0xebd8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd8('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xebd8('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xebd8('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xebd8('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xebd8('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xebd8('0x14')],'allowNull':!![],'comment':_0xebd8('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':![],'comment':_0xebd8('0x4e'),'set':function(_0x3d5349){if(!_0x3d5349)this[_0xebd8('0x19')](_0xebd8('0x4f'),null);this[_0xebd8('0x19')](_0xebd8('0x50'),_0x3d5349);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xebd8('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xebd8('0x14')](0x3)[_0xebd8('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xebd8('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 02c6b7a..88ca625 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 _0x283e=['ContactId','ListId','select','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','VoiceQueueId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','into','fromQuery','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','update','then','get','VoiceQueues','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','user','role','inbound','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','destroy','getHoppers','CmHopper','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','flatMap','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','ids','removeAgents','spread','voicePause','isEmpty','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','phone','scheduledAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x283e,0xcf));var _0xe283=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x283e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe283('0x0'));var rimraf=require(_0xe283('0x1'));var zipdir=require(_0xe283('0x2'));var jsonpatch=require(_0xe283('0x3'));var rp=require('request-promise');var moment=require(_0xe283('0x4'));var BPromise=require(_0xe283('0x5'));var Mustache=require(_0xe283('0x6'));var util=require(_0xe283('0x7'));var path=require(_0xe283('0x8'));var sox=require(_0xe283('0x9'));var csv=require(_0xe283('0xa'));var ejs=require(_0xe283('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe283('0xc'));var squel=require(_0xe283('0xd'));var crypto=require(_0xe283('0xe'));var jsforce=require(_0xe283('0xf'));var deskjs=require(_0xe283('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe283('0x11'));var Papa=require('papaparse');var Redis=require(_0xe283('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe283('0x13'));var as=require(_0xe283('0x14'));var hardwareService=require(_0xe283('0x15'));var logger=require(_0xe283('0x16'))(_0xe283('0x17'));var utils=require(_0xe283('0x18'));var config=require(_0xe283('0x19'));var licenseUtil=require(_0xe283('0x1a'));var db=require(_0xe283('0x1b'))['db'];config[_0xe283('0x1c')]=_[_0xe283('0x1d')](config[_0xe283('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xe283('0x1e'))(new Redis(config[_0xe283('0x1c')]));require(_0xe283('0x1f'))['register'](socket);function respondWithStatusCode(_0x24fbb4,_0x52a75f){_0x52a75f=_0x52a75f||0xcc;return function(_0x1380c6){if(_0x1380c6){return _0x24fbb4['sendStatus'](_0x52a75f);}return _0x24fbb4['status'](_0x52a75f)[_0xe283('0x20')]();};}function respondWithResult(_0x110281,_0x26dae6){_0x26dae6=_0x26dae6||0xc8;return function(_0x94da57){if(_0x94da57){return _0x110281['status'](_0x26dae6)['json'](_0x94da57);}};}function respondWithFilteredResult(_0x48b601,_0x44a903){return function(_0x2091d0){if(_0x2091d0){var _0x1307f4=typeof _0x44a903[_0xe283('0x21')]===_0xe283('0x22')&&typeof _0x44a903[_0xe283('0x23')]===_0xe283('0x22');var _0xeff2b5=_0x2091d0['count'];var _0x152409=_0x1307f4?0x0:_0x44a903[_0xe283('0x21')];var _0x34e7ae=_0x1307f4?_0x2091d0[_0xe283('0x24')]:_0x44a903[_0xe283('0x21')]+_0x44a903[_0xe283('0x23')];var _0x9bdd67;if(_0x34e7ae>=_0xeff2b5){_0x34e7ae=_0xeff2b5;_0x9bdd67=0xc8;}else{_0x9bdd67=0xce;}_0x48b601[_0xe283('0x25')](_0x9bdd67);return _0x48b601[_0xe283('0x26')](_0xe283('0x27'),_0x152409+'-'+_0x34e7ae+'/'+_0xeff2b5)[_0xe283('0x28')](_0x2091d0);}return null;};}function patchUpdates(_0x1bc7b9){return function(_0x19919b){try{jsonpatch['apply'](_0x19919b,_0x1bc7b9,!![]);}catch(_0x2852ca){return BPromise[_0xe283('0x29')](_0x2852ca);}return _0x19919b['save']();};}function saveUpdates(_0x206eb9,_0xfc70d6){return function(_0x56426c){if(_0x56426c){return _0x56426c[_0xe283('0x2a')](_0x206eb9)[_0xe283('0x2b')](function(_0x4c1f44){return _0x4c1f44;});}return null;};}function removeEntity(_0x21601f,_0x20aa85){return function(_0x21f72d){if(_0x21f72d){return _0x21f72d['destroy']()[_0xe283('0x2b')](function(){var _0x52e0aa=_0x21f72d[_0xe283('0x2c')]({'plain':!![]});var _0x2466df=[{'name':_0xe283('0x2d'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xe283('0x2e'),'ignore':![]}];var _0x40d403=_(_0x2466df)[_0xe283('0x2f')](_0xe283('0x30'))[_0xe283('0x31')](_0xe283('0x32'))[_0xe283('0x32')]();if(_[_0xe283('0x33')](_0x40d403,_0x52e0aa[_0xe283('0x34')])){return;}var _0x20a7fe=_[_0xe283('0x35')](_0x2466df,[_0xe283('0x32'),_0x52e0aa[_0xe283('0x34')]])[_0xe283('0x36')];return db[_0xe283('0x37')]['destroy']({'where':{'type':_0x20a7fe,'resourceId':_0x52e0aa['id']}})[_0xe283('0x2b')](function(){return _0x21f72d;});})['then'](function(){_0x21601f[_0xe283('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21be24,_0x583214){return function(_0x3db7ec){if(!_0x3db7ec){_0x21be24['sendStatus'](0x194);}return _0x3db7ec;};}function handleError(_0x17de79,_0x2d176c){_0x2d176c=_0x2d176c||0x1f4;return function(_0x54b230){logger[_0xe283('0x38')](_0x54b230['stack']);if(_0x54b230[_0xe283('0x36')]){delete _0x54b230[_0xe283('0x36')];}_0x17de79[_0xe283('0x25')](_0x2d176c)[_0xe283('0x39')](_0x54b230);};}exports[_0xe283('0x3a')]=function(_0x49195b,_0x4078f3){var _0x278f3b={},_0x409fc6={},_0x4ece7d={'count':0x0,'rows':[]};var _0x2ece06=_[_0xe283('0x31')](db[_0xe283('0x3b')][_0xe283('0x3c')],function(_0x13526e){return{'name':_0x13526e[_0xe283('0x3d')],'type':_0x13526e[_0xe283('0x34')][_0xe283('0x3e')]};});_0x409fc6[_0xe283('0x3f')]=_[_0xe283('0x31')](_0x2ece06,_0xe283('0x36'));_0x409fc6['query']=_['keys'](_0x49195b['query']);_0x409fc6['filters']=_['intersection'](_0x409fc6[_0xe283('0x3f')],_0x409fc6['query']);_0x278f3b[_0xe283('0x40')]=_[_0xe283('0x41')](_0x409fc6[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x49195b[_0xe283('0x43')][_0xe283('0x42')]));_0x278f3b['attributes']=_0x278f3b[_0xe283('0x40')][_0xe283('0x44')]?_0x278f3b[_0xe283('0x40')]:_0x409fc6[_0xe283('0x3f')];if(!_0x49195b[_0xe283('0x43')][_0xe283('0x45')]('nolimit')){_0x278f3b[_0xe283('0x23')]=qs[_0xe283('0x23')](_0x49195b[_0xe283('0x43')][_0xe283('0x23')]);_0x278f3b[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x49195b[_0xe283('0x43')][_0xe283('0x21')]);}_0x278f3b[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x49195b['query']['sort']);_0x278f3b[_0xe283('0x48')]=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x49195b[_0xe283('0x43')],_0x409fc6[_0xe283('0x49')]),_0x2ece06);if(_0x49195b['query']['filter']){_0x278f3b[_0xe283('0x48')]=_[_0xe283('0x4b')](_0x278f3b[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0x2ece06,function(_0x13245a){if(_0x13245a[_0xe283('0x34')]!==_0xe283('0x4c')){var _0x43ca13={};_0x43ca13[_0x13245a['name']]={'$like':'%'+_0x49195b['query'][_0xe283('0x2f')]+'%'};return _0x43ca13;}})});}_0x278f3b=_['merge']({},_0x278f3b,_0x49195b['options']);var _0x56c041={'where':_0x278f3b[_0xe283('0x48')]};return db[_0xe283('0x3b')]['count'](_0x56c041)[_0xe283('0x2b')](function(_0x58d585){_0x4ece7d['count']=_0x58d585;if(_0x49195b[_0xe283('0x43')][_0xe283('0x4d')]){_0x278f3b[_0xe283('0x4e')]=[{'all':!![]}];}return db[_0xe283('0x3b')][_0xe283('0x4f')](_0x278f3b);})[_0xe283('0x2b')](function(_0x4c7072){_0x4ece7d[_0xe283('0x50')]=_0x4c7072;return _0x4ece7d;})[_0xe283('0x2b')](respondWithFilteredResult(_0x4078f3,_0x278f3b))[_0xe283('0x51')](handleError(_0x4078f3,null));};exports[_0xe283('0x52')]=function(_0x3defb5,_0x2a69ad){var _0x5b6523={'raw':![],'where':{'id':_0x3defb5[_0xe283('0x53')]['id']}},_0x6cffc7={};_0x6cffc7[_0xe283('0x3f')]=_[_0xe283('0x54')](db['VoiceQueue']['rawAttributes']);_0x6cffc7[_0xe283('0x43')]=_[_0xe283('0x54')](_0x3defb5[_0xe283('0x43')]);_0x6cffc7[_0xe283('0x49')]=_['intersection'](_0x6cffc7[_0xe283('0x3f')],_0x6cffc7[_0xe283('0x43')]);_0x5b6523[_0xe283('0x40')]=_[_0xe283('0x41')](_0x6cffc7[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x3defb5[_0xe283('0x43')]['fields']));_0x5b6523[_0xe283('0x40')]=_0x5b6523[_0xe283('0x40')][_0xe283('0x44')]?_0x5b6523[_0xe283('0x40')]:_0x6cffc7[_0xe283('0x3f')];if(_0x3defb5[_0xe283('0x43')][_0xe283('0x4d')]){_0x5b6523[_0xe283('0x4e')]=[{'all':!![]}];}_0x5b6523=_[_0xe283('0x4b')]({},_0x5b6523,_0x3defb5[_0xe283('0x55')]);return db[_0xe283('0x3b')][_0xe283('0x35')](_0x5b6523)[_0xe283('0x2b')](handleEntityNotFound(_0x2a69ad,null))[_0xe283('0x2b')](respondWithResult(_0x2a69ad,null))[_0xe283('0x51')](handleError(_0x2a69ad,null));};exports[_0xe283('0x56')]=function(_0x3d73ce,_0x4bb212){return db[_0xe283('0x3b')][_0xe283('0x56')](_0x3d73ce[_0xe283('0x57')],{})[_0xe283('0x2b')](function(_0x656bab){var _0x43f459=_0x3d73ce[_0xe283('0x58')]['get']({'plain':!![]});if(!_0x43f459)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43f459[_0xe283('0x59')]===_0xe283('0x58')){var _0x358e80=_0x656bab[_0xe283('0x2c')]({'plain':!![]});var _0x1dd0cc=[{'name':_0xe283('0x2d'),'value':_0xe283('0x5a')},{'name':_0xe283('0x5b'),'value':_0xe283('0x2e')}];var _0x3bd008=_[_0xe283('0x35')](_0x1dd0cc,[_0xe283('0x32'),_0x358e80[_0xe283('0x34')]])[_0xe283('0x36')];return db[_0xe283('0x5c')]['find']({'where':{'name':_0x3bd008,'userProfileId':_0x43f459[_0xe283('0x5d')]},'raw':!![]})[_0xe283('0x2b')](function(_0x5f4669){if(_0x5f4669&&_0x5f4669[_0xe283('0x5e')]===0x0){return db[_0xe283('0x37')][_0xe283('0x56')]({'name':_0x358e80[_0xe283('0x36')],'resourceId':_0x358e80['id'],'type':_0x5f4669['name'],'sectionId':_0x5f4669['id']},{})[_0xe283('0x2b')](function(){return _0x656bab;});}else{return _0x656bab;}})[_0xe283('0x51')](function(_0x309be7){logger[_0xe283('0x38')](_0xe283('0x5f'),_0x309be7);throw _0x309be7;});}return _0x656bab;})['then'](respondWithResult(_0x4bb212,0xc9))['catch'](handleError(_0x4bb212,null));};exports[_0xe283('0x60')]=function(_0x22fa32,_0x5e5b37){var _0x3499c0={'where':{'id':_0x22fa32['params']['id']}},_0x1eb147={};_0x1eb147[_0xe283('0x3f')]=_[_0xe283('0x54')](db[_0xe283('0x3b')][_0xe283('0x3c')]);_0x3499c0[_0xe283('0x40')]=_['intersection'](_0x1eb147['model'],qs[_0xe283('0x42')](_0x22fa32[_0xe283('0x43')][_0xe283('0x42')]));_0x3499c0['attributes']=_0x3499c0[_0xe283('0x40')][_0xe283('0x44')]?_0x3499c0[_0xe283('0x40')]:_0x1eb147[_0xe283('0x3f')];if(_0x22fa32[_0xe283('0x43')]['includeAll']){_0x3499c0[_0xe283('0x4e')]=[{'all':!![]}];}_0x3499c0=_[_0xe283('0x4b')]({},_0x3499c0,_0x22fa32[_0xe283('0x55')]);return db[_0xe283('0x3b')]['find'](_0x3499c0)[_0xe283('0x2b')](handleEntityNotFound(_0x5e5b37,null))[_0xe283('0x2b')](function(_0x3202d2){if(_0x3202d2){var _0x237bfa=_0x3202d2['get']({'plain':!![]});_0x237bfa=qs['omit'](_0x237bfa,['id',_0xe283('0x61'),_0xe283('0x62')]);_0x22fa32[_0xe283('0x57')]=_[_0xe283('0x63')](_0x22fa32[_0xe283('0x57')],['id',_0xe283('0x61'),_0xe283('0x62')]);return db[_0xe283('0x3b')]['create'](_[_0xe283('0x4b')](_0x237bfa,_0x22fa32['body']),{'include':_0x22fa32[_0xe283('0x43')][_0xe283('0x4d')]?[{'all':!![]}]:undefined})[_0xe283('0x2b')](function(_0x2a383e){var _0x330a43=_0x22fa32[_0xe283('0x58')]['get']({'plain':!![]});if(!_0x330a43)throw new Error(_0xe283('0x64'));if(_0x330a43[_0xe283('0x59')]===_0xe283('0x58')){var _0x1df666=_0x2a383e[_0xe283('0x2c')]({'plain':!![]});var _0x5baa52=[{'name':_0xe283('0x2d'),'value':_0xe283('0x5a')},{'name':_0xe283('0x5b'),'value':_0xe283('0x2e')}];var _0x215fd0=_[_0xe283('0x35')](_0x5baa52,['value',_0x1df666[_0xe283('0x34')]])[_0xe283('0x36')];return db[_0xe283('0x5c')][_0xe283('0x35')]({'where':{'name':_0x215fd0,'userProfileId':_0x330a43[_0xe283('0x5d')]},'raw':!![]})[_0xe283('0x2b')](function(_0x43fcbb){if(_0x43fcbb&&_0x43fcbb[_0xe283('0x5e')]===0x0){return db[_0xe283('0x37')][_0xe283('0x56')]({'name':_0x1df666['name'],'resourceId':_0x1df666['id'],'type':_0x43fcbb[_0xe283('0x36')],'sectionId':_0x43fcbb['id']},{})[_0xe283('0x2b')](function(){return _0x2a383e;});}else{return _0x2a383e;}})[_0xe283('0x51')](function(_0x98ae77){logger['error'](_0xe283('0x5f'),_0x98ae77);throw _0x98ae77;});}return _0x2a383e;});}})['then'](respondWithResult(_0x5e5b37,0xc9))[_0xe283('0x51')](handleError(_0x5e5b37,null));};exports[_0xe283('0x2a')]=function(_0xbdaf7d,_0x50bc4f){if(_0xbdaf7d[_0xe283('0x57')]['id']){delete _0xbdaf7d['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0xbdaf7d['params']['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x50bc4f,null))[_0xe283('0x2b')](saveUpdates(_0xbdaf7d['body'],null))[_0xe283('0x2b')](respondWithResult(_0x50bc4f,null))['catch'](handleError(_0x50bc4f,null));};exports[_0xe283('0x65')]=function(_0x43d9ad,_0x28eaf8){return db[_0xe283('0x3b')][_0xe283('0x35')]({'where':{'id':_0x43d9ad['params']['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x28eaf8,null))[_0xe283('0x2b')](removeEntity(_0x28eaf8,null))[_0xe283('0x51')](handleError(_0x28eaf8,null));};exports[_0xe283('0x66')]=function(_0x2b13b3,_0x1d0137,_0x509ce4){var _0x58635c={'raw':![],'where':{}};var _0x39959c={};var _0x104833={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2b13b3[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x1d0137,null))[_0xe283('0x2b')](function(_0x258eb5){if(_0x258eb5){_0x39959c[_0xe283('0x3f')]=_[_0xe283('0x54')](db[_0xe283('0x67')][_0xe283('0x3c')]);_0x39959c['query']=_[_0xe283('0x54')](_0x2b13b3['query']);_0x39959c['filters']=_[_0xe283('0x41')](_0x39959c[_0xe283('0x3f')],_0x39959c[_0xe283('0x43')]);_0x58635c['attributes']=_['intersection'](_0x39959c[_0xe283('0x3f')],qs['fields'](_0x2b13b3[_0xe283('0x43')][_0xe283('0x42')]));_0x58635c['attributes']=_0x58635c['attributes'][_0xe283('0x44')]?_0x58635c[_0xe283('0x40')]:_0x39959c[_0xe283('0x3f')];if(!_0x2b13b3['query'][_0xe283('0x45')]('nolimit')){_0x58635c[_0xe283('0x23')]=qs['limit'](_0x2b13b3[_0xe283('0x43')][_0xe283('0x23')]);_0x58635c[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x2b13b3[_0xe283('0x43')][_0xe283('0x21')]);}_0x58635c[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x2b13b3['query']['sort']);_0x58635c[_0xe283('0x48')]=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x2b13b3['query'],_0x39959c['filters']));_0x58635c[_0xe283('0x48')][_0xe283('0x68')]=_0x258eb5['id'];if(_0x2b13b3[_0xe283('0x43')][_0xe283('0x2f')]){_0x58635c['where']=_['merge'](_0x58635c['where'],{'$or':_[_0xe283('0x31')](_0x58635c[_0xe283('0x40')],function(_0x13f662){var _0x34a327={};_0x34a327[_0x13f662]={'$like':'%'+_0x2b13b3['query'][_0xe283('0x2f')]+'%'};return _0x34a327;})});}_0x58635c=_['merge']({},_0x58635c,_0x2b13b3[_0xe283('0x55')]);return db['CmHopper'][_0xe283('0x24')]({'where':_0x58635c[_0xe283('0x48')]})[_0xe283('0x2b')](function(_0x3cd41c){_0x104833[_0xe283('0x24')]=_0x3cd41c;if(_0x2b13b3[_0xe283('0x43')][_0xe283('0x4d')]){_0x58635c[_0xe283('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0xe283('0x4f')](_0x58635c);})[_0xe283('0x2b')](function(_0xaa4c32){_0x104833[_0xe283('0x50')]=_0xaa4c32;return _0x104833;});}})[_0xe283('0x2b')](respondWithFilteredResult(_0x1d0137,_0x58635c))[_0xe283('0x51')](handleError(_0x1d0137,null));};exports[_0xe283('0x69')]=function(_0x2fc21b,_0x494fa9,_0x4d816b){var _0xcb5014={'raw':!![],'where':{}};var _0x5c0550={};var _0x39a2c9={'count':0x0,'rows':[]};return db[_0xe283('0x3b')][_0xe283('0x6a')]({'where':{'id':_0x2fc21b[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x494fa9,null))['then'](function(_0x2b8a92){if(_0x2b8a92){_0x5c0550[_0xe283('0x3f')]=_['keys'](db[_0xe283('0x6b')][_0xe283('0x3c')]);_0x5c0550['query']=_[_0xe283('0x54')](_0x2fc21b[_0xe283('0x43')]);_0x5c0550[_0xe283('0x49')]=_[_0xe283('0x41')](_0x5c0550[_0xe283('0x3f')],_0x5c0550[_0xe283('0x43')]);_0xcb5014['attributes']=_[_0xe283('0x41')](_0x5c0550[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x2fc21b[_0xe283('0x43')][_0xe283('0x42')]));_0xcb5014['attributes']=_0xcb5014[_0xe283('0x40')][_0xe283('0x44')]?_0xcb5014[_0xe283('0x40')]:_0x5c0550[_0xe283('0x3f')];if(!_0x2fc21b[_0xe283('0x43')][_0xe283('0x45')]('nolimit')){_0xcb5014['limit']=qs[_0xe283('0x23')](_0x2fc21b[_0xe283('0x43')][_0xe283('0x23')]);_0xcb5014[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x2fc21b['query'][_0xe283('0x21')]);}_0xcb5014[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x2fc21b['query']['sort']);_0xcb5014[_0xe283('0x48')]=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x2fc21b['query'],_0x5c0550[_0xe283('0x49')]));_0xcb5014[_0xe283('0x48')]['VoiceQueueId']=_0x2b8a92['id'];if(_0x2fc21b[_0xe283('0x43')][_0xe283('0x2f')]){_0xcb5014['where']=_[_0xe283('0x4b')](_0xcb5014[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0xcb5014['attributes'],function(_0x20ded7){var _0x4c6432={};_0x4c6432[_0x20ded7]={'$like':'%'+_0x2fc21b[_0xe283('0x43')][_0xe283('0x2f')]+'%'};return _0x4c6432;})});}_0xcb5014=_[_0xe283('0x4b')]({},_0xcb5014,_0x2fc21b[_0xe283('0x55')]);return db[_0xe283('0x6b')][_0xe283('0x24')]({'where':_0xcb5014[_0xe283('0x48')]})[_0xe283('0x2b')](function(_0x17d461){_0x39a2c9['count']=_0x17d461;if(_0x2fc21b[_0xe283('0x43')]['includeAll']){_0xcb5014[_0xe283('0x4e')]=[{'all':!![]}];}return db[_0xe283('0x6b')]['findAll'](_0xcb5014);})[_0xe283('0x2b')](function(_0x17fd58){_0x39a2c9[_0xe283('0x50')]=_0x17fd58;return _0x39a2c9;});}})[_0xe283('0x2b')](respondWithFilteredResult(_0x494fa9,_0xcb5014))[_0xe283('0x51')](handleError(_0x494fa9,null));};exports[_0xe283('0x6c')]=function(_0x1edb83,_0x29a133,_0x2cf55e){var _0x398a49={'raw':!![],'where':{}};var _0x26c1ed={};var _0x588781={'count':0x0,'rows':[]};return db[_0xe283('0x3b')][_0xe283('0x6a')]({'where':{'id':_0x1edb83[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x29a133,null))[_0xe283('0x2b')](function(_0x177eae){if(_0x177eae){_0x26c1ed[_0xe283('0x3f')]=_[_0xe283('0x54')](db[_0xe283('0x6d')][_0xe283('0x3c')]);_0x26c1ed[_0xe283('0x43')]=_[_0xe283('0x54')](_0x1edb83['query']);_0x26c1ed['filters']=_[_0xe283('0x41')](_0x26c1ed[_0xe283('0x3f')],_0x26c1ed['query']);_0x398a49['attributes']=_[_0xe283('0x41')](_0x26c1ed[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x1edb83[_0xe283('0x43')][_0xe283('0x42')]));_0x398a49[_0xe283('0x40')]=_0x398a49[_0xe283('0x40')]['length']?_0x398a49[_0xe283('0x40')]:_0x26c1ed['model'];if(!_0x1edb83[_0xe283('0x43')][_0xe283('0x45')](_0xe283('0x6e'))){_0x398a49[_0xe283('0x23')]=qs[_0xe283('0x23')](_0x1edb83[_0xe283('0x43')][_0xe283('0x23')]);_0x398a49[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x1edb83[_0xe283('0x43')][_0xe283('0x21')]);}_0x398a49['order']=qs[_0xe283('0x47')](_0x1edb83[_0xe283('0x43')]['sort']);_0x398a49[_0xe283('0x48')]=qs['filters'](_['pick'](_0x1edb83[_0xe283('0x43')],_0x26c1ed[_0xe283('0x49')]));_0x398a49[_0xe283('0x48')][_0xe283('0x68')]=_0x177eae['id'];if(_0x1edb83[_0xe283('0x43')][_0xe283('0x2f')]){_0x398a49[_0xe283('0x48')]=_[_0xe283('0x4b')](_0x398a49[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0x398a49[_0xe283('0x40')],function(_0x291c46){var _0x4d4880={};_0x4d4880[_0x291c46]={'$like':'%'+_0x1edb83[_0xe283('0x43')][_0xe283('0x2f')]+'%'};return _0x4d4880;})});}_0x398a49=_[_0xe283('0x4b')]({},_0x398a49,_0x1edb83['options']);return db[_0xe283('0x6d')][_0xe283('0x24')]({'where':_0x398a49['where']})[_0xe283('0x2b')](function(_0x3a18a6){_0x588781[_0xe283('0x24')]=_0x3a18a6;if(_0x1edb83[_0xe283('0x43')][_0xe283('0x4d')]){_0x398a49[_0xe283('0x4e')]=[{'all':!![]}];}return db[_0xe283('0x6d')][_0xe283('0x4f')](_0x398a49);})['then'](function(_0x2e5f00){_0x588781[_0xe283('0x50')]=_0x2e5f00;return _0x588781;});}})[_0xe283('0x2b')](respondWithFilteredResult(_0x29a133,_0x398a49))[_0xe283('0x51')](handleError(_0x29a133,null));};exports[_0xe283('0x6f')]=function(_0x2902ab,_0x26f2e7,_0x189cba){var _0x1fe7cf={'raw':!![],'where':{}};var _0x4b5a3d={};var _0x412bfd={'count':0x0,'rows':[]};return db[_0xe283('0x3b')][_0xe283('0x6a')]({'where':{'id':_0x2902ab[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x26f2e7,null))['then'](function(_0x887e20){if(_0x887e20){_0x4b5a3d[_0xe283('0x3f')]=_['keys'](db['CmHopperBlack'][_0xe283('0x3c')]);_0x4b5a3d[_0xe283('0x43')]=_[_0xe283('0x54')](_0x2902ab['query']);_0x4b5a3d[_0xe283('0x49')]=_['intersection'](_0x4b5a3d['model'],_0x4b5a3d['query']);_0x1fe7cf[_0xe283('0x40')]=_[_0xe283('0x41')](_0x4b5a3d[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x2902ab[_0xe283('0x43')][_0xe283('0x42')]));_0x1fe7cf[_0xe283('0x40')]=_0x1fe7cf[_0xe283('0x40')]['length']?_0x1fe7cf[_0xe283('0x40')]:_0x4b5a3d[_0xe283('0x3f')];if(!_0x2902ab[_0xe283('0x43')][_0xe283('0x45')]('nolimit')){_0x1fe7cf['limit']=qs['limit'](_0x2902ab['query'][_0xe283('0x23')]);_0x1fe7cf[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x2902ab[_0xe283('0x43')][_0xe283('0x21')]);}_0x1fe7cf[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x2902ab[_0xe283('0x43')]['sort']);_0x1fe7cf['where']=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x2902ab[_0xe283('0x43')],_0x4b5a3d[_0xe283('0x49')]));_0x1fe7cf[_0xe283('0x48')][_0xe283('0x68')]=_0x887e20['id'];if(_0x2902ab[_0xe283('0x43')][_0xe283('0x2f')]){_0x1fe7cf[_0xe283('0x48')]=_[_0xe283('0x4b')](_0x1fe7cf['where'],{'$or':_[_0xe283('0x31')](_0x1fe7cf['attributes'],function(_0x1ed9ed){var _0x50a778={};_0x50a778[_0x1ed9ed]={'$like':'%'+_0x2902ab[_0xe283('0x43')][_0xe283('0x2f')]+'%'};return _0x50a778;})});}_0x1fe7cf=_[_0xe283('0x4b')]({},_0x1fe7cf,_0x2902ab[_0xe283('0x55')]);return db[_0xe283('0x70')][_0xe283('0x24')]({'where':_0x1fe7cf[_0xe283('0x48')]})[_0xe283('0x2b')](function(_0x46cc06){_0x412bfd[_0xe283('0x24')]=_0x46cc06;if(_0x2902ab[_0xe283('0x43')][_0xe283('0x4d')]){_0x1fe7cf[_0xe283('0x4e')]=[{'all':!![]}];}return db[_0xe283('0x70')][_0xe283('0x4f')](_0x1fe7cf);})[_0xe283('0x2b')](function(_0x5c7897){_0x412bfd[_0xe283('0x50')]=_0x5c7897;return _0x412bfd;});}})[_0xe283('0x2b')](respondWithFilteredResult(_0x26f2e7,_0x1fe7cf))[_0xe283('0x51')](handleError(_0x26f2e7,null));};exports[_0xe283('0x71')]=function(_0x2172a7,_0x1837be,_0x1ee2d1){var _0x72c590={};var _0x168744={};var _0x31f231;var _0x53148b;return db[_0xe283('0x3b')]['findOne']({'where':{'id':_0x2172a7[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x1837be,null))[_0xe283('0x2b')](function(_0x386ab3){if(_0x386ab3){_0x31f231=_0x386ab3;_0x168744['model']=_[_0xe283('0x54')](db[_0xe283('0x72')]['rawAttributes']);_0x168744[_0xe283('0x43')]=_[_0xe283('0x54')](_0x2172a7[_0xe283('0x43')]);_0x168744['filters']=_['intersection'](_0x168744['model'],_0x168744[_0xe283('0x43')]);_0x72c590[_0xe283('0x40')]=_[_0xe283('0x41')](_0x168744['model'],qs[_0xe283('0x42')](_0x2172a7[_0xe283('0x43')][_0xe283('0x42')]));_0x72c590[_0xe283('0x40')]=_0x72c590[_0xe283('0x40')][_0xe283('0x44')]?_0x72c590[_0xe283('0x40')]:_0x168744['model'];_0x72c590[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x2172a7[_0xe283('0x43')][_0xe283('0x47')]);_0x72c590[_0xe283('0x48')]=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x2172a7[_0xe283('0x43')],_0x168744['filters']));if(_0x2172a7[_0xe283('0x43')]['filter']){_0x72c590[_0xe283('0x48')]=_[_0xe283('0x4b')](_0x72c590[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0x72c590[_0xe283('0x40')],function(_0x38cd8c){var _0x455d8b={};_0x455d8b[_0x38cd8c]={'$like':'%'+_0x2172a7[_0xe283('0x43')]['filter']+'%'};return _0x455d8b;})});}_0x72c590=_[_0xe283('0x4b')]({},_0x72c590,_0x2172a7['options']);return _0x31f231[_0xe283('0x71')](_0x72c590);}})[_0xe283('0x2b')](function(_0x3d5e94){if(_0x3d5e94){_0x53148b=_0x3d5e94['length'];if(!_0x2172a7[_0xe283('0x43')][_0xe283('0x45')](_0xe283('0x6e'))){_0x72c590['limit']=qs[_0xe283('0x23')](_0x2172a7['query'][_0xe283('0x23')]);_0x72c590[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x2172a7[_0xe283('0x43')][_0xe283('0x21')]);}return _0x31f231[_0xe283('0x71')](_0x72c590);}})['then'](function(_0x57cf2d){if(_0x57cf2d){return _0x57cf2d?{'count':_0x53148b,'rows':_0x57cf2d}:null;}})['then'](respondWithResult(_0x1837be,null))[_0xe283('0x51')](handleError(_0x1837be,null));};exports[_0xe283('0x73')]=function(_0x56bd7d,_0x5e972f,_0x53ecf5){var _0x58d547=_0x56bd7d[_0xe283('0x57')][_0xe283('0x74')];var _0xeab17f=_[_0xe283('0x31')](_0x58d547,'id');return db[_0xe283('0x72')][_0xe283('0x4f')]({'where':{'id':_0xeab17f},'attributes':['id'],'include':[{'model':db[_0xe283('0x75')],'as':_0xe283('0x76'),'attributes':['id','name',_0xe283('0x77'),'voicePause',_0xe283('0x78')],'raw':!![]}]})[_0xe283('0x2b')](function(_0x2d2dcd){if(_0x2d2dcd){var _0x56b0bb=_[_0xe283('0x79')](_0x2d2dcd,function(_0x4cd739){var _0x2e5faa=_0x4cd739[_0xe283('0x2c')]({'plain':!![]});_0x2e5faa[_0xe283('0x76')]['forEach'](function(_0x3ca4c5){_0x3ca4c5[_0xe283('0x7a')]=_[_0xe283('0x35')](_0x58d547,{'id':_0x2e5faa['id']})[_0xe283('0x7a')];});return _0x2e5faa['Agents'];});return db[_0xe283('0x3b')][_0xe283('0x35')]({'where':{'id':_0x56bd7d[_0xe283('0x53')]['id']}})['then'](function(_0x205a1b){return db['sequelize'][_0xe283('0x7b')](function(_0x1db23c){return _0x205a1b[_0xe283('0x73')](_0xeab17f,{'transaction':_0x1db23c})['then'](function(){return BPromise[_0xe283('0x7c')](_0x58d547,function(_0x48ff0d){return db['TeamVoiceQueue'][_0xe283('0x7d')]({'TeamId':_0x48ff0d['id'],'VoiceQueueId':_0x56bd7d['params']['id'],'penalty':_0x48ff0d[_0xe283('0x7a')]},{'transaction':_0x1db23c});});})[_0xe283('0x2b')](function(){return BPromise[_0xe283('0x7c')](_0x56b0bb,function(_0x42f254){return db[_0xe283('0x7e')][_0xe283('0x7f')]({'where':{'UserId':_0x42f254['id'],'VoiceQueueId':_0x56bd7d['params']['id']},'defaults':{'penalty':_0x42f254[_0xe283('0x7a')]},'transaction':_0x1db23c});});})['then'](function(){return BPromise[_0xe283('0x7c')](_['filter'](_0x56b0bb,{'online':!![]}),function(_0x48973b){return db[_0xe283('0x80')][_0xe283('0x7d')]({'membername':_0x48973b[_0xe283('0x36')],'UserId':_0x48973b['id'],'queue_name':_0x205a1b[_0xe283('0x36')],'VoiceQueueId':_0x205a1b['id'],'interface':_[_0xe283('0x81')](_0x48973b[_0xe283('0x78')])?util[_0xe283('0x82')](_0xe283('0x83'),_0x48973b[_0xe283('0x36')]):_0x48973b[_0xe283('0x78')],'paused':_0x48973b['voicePause']||![],'penalty':_0x48973b[_0xe283('0x7a')]},{'transaction':_0x1db23c});});})[_0xe283('0x2b')](function(){_0x56b0bb[_0xe283('0x84')](function(_0x32b33a){socket[_0xe283('0x85')](_0xe283('0x86'),{'UserId':_0x32b33a['id'],'VoiceQueueId':_0x205a1b['id']});});});});});}})['then'](respondWithStatusCode(_0x5e972f,null))[_0xe283('0x51')](handleError(_0x5e972f,null));};exports['removeTeams']=function(_0x4dc3ec,_0x36d758,_0x3c3d3a){return db[_0xe283('0x72')]['findAll']({'where':{'id':_0x4dc3ec[_0xe283('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe283('0x75')],'as':_0xe283('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x36d758,null))[_0xe283('0x2b')](function(_0x53c4e0){var _0x51cc65=_[_0xe283('0x31')](_0x53c4e0,'id');var _0x96a44d=[];var _0x466212=[];var _0x55aada=squel['select']();_0x55aada[_0xe283('0x87')](_0xe283('0x88'))[_0xe283('0x89')](_0xe283('0x8a'),'tq')[_0xe283('0x8b')]('user_has_teams','ut',_0xe283('0x8c'))[_0xe283('0x48')]('VoiceQueueId\x20=\x20?',_0x4dc3ec['params']['id']);for(var _0xe48c46=0x0;_0xe48c46<_0x53c4e0[_0xe283('0x44')];_0xe48c46+=0x1){let _0xc659b8=_0x53c4e0[_0xe48c46];for(var _0x43a7ee=0x0;_0x43a7ee<_0xc659b8[_0xe283('0x76')][_0xe283('0x44')];_0x43a7ee+=0x1){let _0x5664c8=_0xc659b8[_0xe283('0x76')][_0x43a7ee];var _0x5334bb=_0x55aada[_0xe283('0x60')]();_0x5334bb['where']('ut.UserId\x20=\x20?',_0x5664c8['id']);_0x466212[_0xe283('0x8d')](db[_0xe283('0x8e')]['query'](_0x5334bb[_0xe283('0x8f')](),{'type':db[_0xe283('0x8e')][_0xe283('0x90')][_0xe283('0x91')]})['then'](function(_0xfc540b){if(_0xfc540b['length']===0x1){return _0x5664c8['id'];}else{var _0x154d88=_['every'](_[_0xe283('0x31')](_0xfc540b,_0xe283('0x92')),function(_0x1c92c6){return _[_0xe283('0x33')](_0x51cc65,_0x1c92c6);});if(_0x154d88){return _0x5664c8['id'];}}}));}}return BPromise[_0xe283('0x93')](_0x466212)[_0xe283('0x2b')](function(_0xd07b68){_0x96a44d=_(_0x96a44d)['union'](_0xd07b68)['compact']()[_0xe283('0x32')]();return db[_0xe283('0x3b')][_0xe283('0x35')]({'where':{'id':_0x4dc3ec[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](function(_0x22ffaa){return db[_0xe283('0x8e')]['transaction'](function(_0x355d02){return _0x22ffaa['removeTeams'](_0x4dc3ec['query'][_0xe283('0x94')],{'transaction':_0x355d02})[_0xe283('0x2b')](function(){if(!_['isEmpty'](_0x96a44d)){return _0x22ffaa[_0xe283('0x95')](_0x96a44d,{'transaction':_0x355d02})['then'](function(){return db['UserVoiceQueueRt'][_0xe283('0x65')]({'where':{'VoiceQueueId':_0x4dc3ec[_0xe283('0x53')]['id'],'UserId':_0x96a44d},'transaction':_0x355d02});});}})[_0xe283('0x2b')](function(){_0x96a44d[_0xe283('0x84')](function(_0x69e685){socket[_0xe283('0x85')]('userVoiceQueue:remove',{'UserId':_0x69e685,'VoiceQueueId':_0x22ffaa['id']});});});});});});})[_0xe283('0x2b')](respondWithStatusCode(_0x36d758,null))[_0xe283('0x51')](handleError(_0x36d758,null));};exports['addAgents']=function(_0x2c08de,_0x16d27b,_0x53f68c){var _0x393b5c,_0x163f79;return db[_0xe283('0x3b')][_0xe283('0x35')]({'where':{'id':_0x2c08de['params']['id']}})['then'](handleEntityNotFound(_0x16d27b,null))['then'](function(_0x393af7){if(_0x393af7){_0x163f79=_0x393af7;return _0x393af7['addAgents'](_0x2c08de[_0xe283('0x57')][_0xe283('0x94')],_[_0xe283('0x63')](_0x2c08de[_0xe283('0x57')],[_0xe283('0x94'),'id'])||{})[_0xe283('0x96')](function(_0x2b8e98){for(var _0x196cc2=0x0;_0x196cc2<_0x2c08de[_0xe283('0x57')][_0xe283('0x94')]['length'];_0x196cc2+=0x1){socket[_0xe283('0x85')](_0xe283('0x86'),{'UserId':Number(_0x2c08de[_0xe283('0x57')][_0xe283('0x94')][_0x196cc2]),'VoiceQueueId':Number(_0x2c08de[_0xe283('0x53')]['id'])});}return _0x2b8e98;});}})[_0xe283('0x2b')](function(_0x102856){_0x393b5c=_0x102856||[];if(_0x163f79){return db[_0xe283('0x75')][_0xe283('0x4f')]({'where':{'id':_0x2c08de[_0xe283('0x57')][_0xe283('0x94')]},'attributes':['id',_0xe283('0x36'),_0xe283('0x77'),_0xe283('0x97'),_0xe283('0x78')],'raw':!![]});}})[_0xe283('0x2b')](function(_0x1eb84c){if(!_[_0xe283('0x98')](_0x1eb84c)){var _0x1ec509=[];for(var _0xcb5b1d=0x0;_0xcb5b1d<_0x1eb84c[_0xe283('0x44')];_0xcb5b1d++){if(_0x1eb84c[_0xcb5b1d][_0xe283('0x77')]){_0x1ec509[_0xe283('0x8d')](db[_0xe283('0x80')]['upsert']({'membername':_0x1eb84c[_0xcb5b1d][_0xe283('0x36')],'UserId':_0x1eb84c[_0xcb5b1d]['id'],'queue_name':_0x163f79[_0xe283('0x36')],'VoiceQueueId':_0x163f79['id'],'interface':_[_0xe283('0x81')](_0x1eb84c[_0xcb5b1d][_0xe283('0x78')])?util[_0xe283('0x82')](_0xe283('0x83'),_0x1eb84c[_0xcb5b1d][_0xe283('0x36')]):_0x1eb84c[_0xcb5b1d][_0xe283('0x78')],'paused':_0x1eb84c[_0xcb5b1d][_0xe283('0x97')]||![],'penalty':_0x2c08de[_0xe283('0x57')]['penalty']||0x0}));}}return BPromise[_0xe283('0x93')](_0x1ec509);}})[_0xe283('0x2b')](function(){return _0x393b5c;})['then'](respondWithResult(_0x16d27b,null))[_0xe283('0x51')](handleError(_0x16d27b,null));};exports['removeAgents']=function(_0xce11a4,_0x15687f,_0x193b72){return db['VoiceQueue']['find']({'where':{'id':_0xce11a4[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x15687f,null))[_0xe283('0x2b')](function(_0x233f9c){if(_0x233f9c){return _0x233f9c[_0xe283('0x95')](_0xce11a4['query'][_0xe283('0x94')])[_0xe283('0x2b')](function(){if(_[_0xe283('0x99')](_0xce11a4[_0xe283('0x43')][_0xe283('0x94')])){for(var _0xb36f21=0x0;_0xb36f21<_0xce11a4['query'][_0xe283('0x94')][_0xe283('0x44')];_0xb36f21+=0x1){socket[_0xe283('0x85')](_0xe283('0x9a'),{'UserId':Number(_0xce11a4[_0xe283('0x43')]['ids'][_0xb36f21]),'VoiceQueueId':Number(_0xce11a4[_0xe283('0x53')]['id'])});}}else{socket[_0xe283('0x85')]('userVoiceQueue:remove',{'UserId':Number(_0xce11a4[_0xe283('0x43')][_0xe283('0x94')]),'VoiceQueueId':Number(_0xce11a4[_0xe283('0x53')]['id'])});}});}})[_0xe283('0x2b')](function(_0x3e9f03){return db[_0xe283('0x80')][_0xe283('0x65')]({'where':{'VoiceQueueId':_0xce11a4[_0xe283('0x53')]['id'],'UserId':_0xce11a4[_0xe283('0x43')][_0xe283('0x94')]}})[_0xe283('0x2b')](function(){return _0x3e9f03;});})[_0xe283('0x2b')](respondWithStatusCode(_0x15687f,null))[_0xe283('0x51')](handleError(_0x15687f,null));};exports['getAgents']=function(_0x303686,_0x4ceeb9,_0x49b605){var _0xa1fdb4={};var _0x500367={};var _0x4ac3ad;var _0x1c5432;return db[_0xe283('0x3b')][_0xe283('0x6a')]({'where':{'id':_0x303686[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x4ceeb9,null))[_0xe283('0x2b')](function(_0x232222){if(_0x232222){_0x4ac3ad=_0x232222;_0x500367[_0xe283('0x3f')]=_[_0xe283('0x54')](db[_0xe283('0x75')][_0xe283('0x3c')]);_0x500367[_0xe283('0x43')]=_['keys'](_0x303686[_0xe283('0x43')]);_0x500367['filters']=_[_0xe283('0x41')](_0x500367[_0xe283('0x3f')],_0x500367[_0xe283('0x43')]);_0xa1fdb4[_0xe283('0x40')]=_[_0xe283('0x41')](_0x500367['model'],qs[_0xe283('0x42')](_0x303686[_0xe283('0x43')]['fields']));_0xa1fdb4[_0xe283('0x40')]=_0xa1fdb4[_0xe283('0x40')][_0xe283('0x44')]?_0xa1fdb4['attributes']:_0x500367['model'];_0xa1fdb4[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x303686[_0xe283('0x43')]['sort']);_0xa1fdb4[_0xe283('0x48')]=qs['filters'](_['pick'](_0x303686[_0xe283('0x43')],_0x500367['filters']));if(_0x303686[_0xe283('0x43')][_0xe283('0x2f')]){_0xa1fdb4[_0xe283('0x48')]=_[_0xe283('0x4b')](_0xa1fdb4[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0xa1fdb4[_0xe283('0x40')],function(_0x30e2d3){var _0x20d034={};_0x20d034[_0x30e2d3]={'$like':'%'+_0x303686[_0xe283('0x43')]['filter']+'%'};return _0x20d034;})});}_0xa1fdb4=_[_0xe283('0x4b')]({},_0xa1fdb4,_0x303686[_0xe283('0x55')]);return _0x4ac3ad[_0xe283('0x9b')](_0xa1fdb4);}})[_0xe283('0x2b')](function(_0x30978d){if(_0x30978d){_0x1c5432=_0x30978d['length'];if(!_0x303686[_0xe283('0x43')][_0xe283('0x45')]('nolimit')){_0xa1fdb4[_0xe283('0x23')]=qs[_0xe283('0x23')](_0x303686[_0xe283('0x43')][_0xe283('0x23')]);_0xa1fdb4[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x303686[_0xe283('0x43')][_0xe283('0x21')]);}return _0x4ac3ad[_0xe283('0x9b')](_0xa1fdb4);}})[_0xe283('0x2b')](function(_0x312418){if(_0x312418){return _0x312418?{'count':_0x1c5432,'rows':_0x312418}:null;}})[_0xe283('0x2b')](respondWithResult(_0x4ceeb9,null))[_0xe283('0x51')](handleError(_0x4ceeb9,null));};exports[_0xe283('0x9c')]=function(_0x340f55,_0x3827c0,_0x333baa){var _0x4140d7={};var _0x1a730a={};var _0x4c0195;var _0x4a303c;return db[_0xe283('0x3b')][_0xe283('0x6a')]({'where':{'id':_0x340f55[_0xe283('0x53')]['id']}})['then'](handleEntityNotFound(_0x3827c0,null))['then'](function(_0xeeccae){if(_0xeeccae){_0x4c0195=_0xeeccae;_0x1a730a['model']=_[_0xe283('0x54')](db['UserVoiceQueueRt'][_0xe283('0x3c')]);_0x1a730a[_0xe283('0x43')]=_['keys'](_0x340f55[_0xe283('0x43')]);_0x1a730a[_0xe283('0x49')]=_[_0xe283('0x41')](_0x1a730a[_0xe283('0x3f')],_0x1a730a[_0xe283('0x43')]);_0x4140d7[_0xe283('0x40')]=_[_0xe283('0x41')](_0x1a730a[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x340f55[_0xe283('0x43')][_0xe283('0x42')]));_0x4140d7[_0xe283('0x40')]=_0x4140d7[_0xe283('0x40')][_0xe283('0x44')]?_0x4140d7['attributes']:_0x1a730a['model'];_0x4140d7['order']=qs[_0xe283('0x47')](_0x340f55[_0xe283('0x43')][_0xe283('0x47')]);_0x4140d7['where']=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x340f55[_0xe283('0x43')],_0x1a730a[_0xe283('0x49')]));if(_0x340f55['query'][_0xe283('0x2f')]){_0x4140d7['where']=_[_0xe283('0x4b')](_0x4140d7[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0x4140d7['attributes'],function(_0x17c4af){var _0x1d91cf={};_0x1d91cf[_0x17c4af]={'$like':'%'+_0x340f55['query'][_0xe283('0x2f')]+'%'};return _0x1d91cf;})});}_0x4140d7=_[_0xe283('0x4b')]({},_0x4140d7,_0x340f55[_0xe283('0x55')]);return _0x4c0195[_0xe283('0x9c')](_0x4140d7);}})[_0xe283('0x2b')](function(_0x1a606b){if(_0x1a606b){_0x4a303c=_0x1a606b[_0xe283('0x44')];if(!_0x340f55[_0xe283('0x43')][_0xe283('0x45')](_0xe283('0x6e'))){_0x4140d7[_0xe283('0x23')]=qs['limit'](_0x340f55[_0xe283('0x43')][_0xe283('0x23')]);_0x4140d7[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x340f55[_0xe283('0x43')]['offset']);}return _0x4c0195['getMembers'](_0x4140d7);}})['then'](function(_0x24f748){return _0x24f748?{'count':_0x4a303c,'rows':_0x24f748}:null;})[_0xe283('0x2b')](respondWithResult(_0x3827c0,null))[_0xe283('0x51')](handleError(_0x3827c0,null));};exports[_0xe283('0x9d')]=function(_0x3392bb,_0x8f3f6b,_0x580dc3){var _0x1980a2={};var _0x8316ec={};var _0x52e0b6;var _0x9db0ec;return db[_0xe283('0x3b')][_0xe283('0x6a')]({'where':{'id':_0x3392bb['params']['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x8f3f6b,null))[_0xe283('0x2b')](function(_0x5b2df6){if(_0x5b2df6){_0x52e0b6=_0x5b2df6;_0x8316ec[_0xe283('0x3f')]=_[_0xe283('0x54')](db[_0xe283('0x9e')]['rawAttributes']);_0x8316ec['query']=_[_0xe283('0x54')](_0x3392bb[_0xe283('0x43')]);_0x8316ec['filters']=_[_0xe283('0x41')](_0x8316ec['model'],_0x8316ec[_0xe283('0x43')]);_0x1980a2[_0xe283('0x40')]=_[_0xe283('0x41')](_0x8316ec['model'],qs['fields'](_0x3392bb[_0xe283('0x43')][_0xe283('0x42')]));_0x1980a2[_0xe283('0x40')]=_0x1980a2[_0xe283('0x40')][_0xe283('0x44')]?_0x1980a2['attributes']:_0x8316ec[_0xe283('0x3f')];_0x1980a2['order']=qs[_0xe283('0x47')](_0x3392bb[_0xe283('0x43')][_0xe283('0x47')]);_0x1980a2[_0xe283('0x48')]=qs[_0xe283('0x49')](_['pick'](_0x3392bb[_0xe283('0x43')],_0x8316ec[_0xe283('0x49')]));if(_0x3392bb['query'][_0xe283('0x2f')]){_0x1980a2[_0xe283('0x48')]=_[_0xe283('0x4b')](_0x1980a2[_0xe283('0x48')],{'$or':_['map'](_0x1980a2[_0xe283('0x40')],function(_0x78b29c){var _0x574759={};_0x574759[_0x78b29c]={'$like':'%'+_0x3392bb['query']['filter']+'%'};return _0x574759;})});}_0x1980a2=_[_0xe283('0x4b')]({},_0x1980a2,_0x3392bb[_0xe283('0x55')]);return _0x52e0b6[_0xe283('0x9d')](_0x1980a2);}})['then'](function(_0x5f15b9){if(_0x5f15b9){_0x9db0ec=_0x5f15b9[_0xe283('0x44')];if(!_0x3392bb[_0xe283('0x43')][_0xe283('0x45')](_0xe283('0x6e'))){_0x1980a2[_0xe283('0x23')]=qs[_0xe283('0x23')](_0x3392bb['query'][_0xe283('0x23')]);_0x1980a2['offset']=qs['offset'](_0x3392bb[_0xe283('0x43')][_0xe283('0x21')]);}return _0x52e0b6[_0xe283('0x9d')](_0x1980a2);}})[_0xe283('0x2b')](function(_0x281511){if(_0x281511){return _0x281511?{'count':_0x9db0ec,'rows':_0x281511}:null;}})['then'](respondWithResult(_0x8f3f6b,null))['catch'](handleError(_0x8f3f6b,null));};exports[_0xe283('0x9f')]=function(_0x5ec863,_0x2cb51c,_0x831d13){var _0x47b882,_0x3bdf7e;return db[_0xe283('0x3b')][_0xe283('0x35')]({'where':{'id':_0x5ec863[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x2cb51c,null))[_0xe283('0x2b')](function(_0x116b08){if(_0x116b08){_0x3bdf7e=_0x116b08;return _0x116b08[_0xe283('0x9f')](_0x5ec863['body']['ids'],_['omit'](_0x5ec863[_0xe283('0x57')],[_0xe283('0x94'),'id'])||{});}return null;})[_0xe283('0x96')](function(_0x4a9ff3){var _0x413b29;_0x47b882=_0x4a9ff3||[];var _0x35c718=[];if(_0x4a9ff3){for(var _0x2358cf=0x0;_0x2358cf<_0x4a9ff3[_0xe283('0x44')];_0x2358cf+=0x1){var _0x4f9566=_0x4a9ff3[_0x2358cf][_0xe283('0x2c')]({'plain':!![]});_0x3bdf7e[_0xe283('0xa0')]=_0x5ec863[_0xe283('0x57')]['dialCheckDuplicateType']?_0x5ec863[_0xe283('0x57')][_0xe283('0xa0')]:_0x3bdf7e[_0xe283('0xa0')];switch(_0x3bdf7e[_0xe283('0xa0')]){case _0xe283('0xa1'):_0x413b29=squel[_0xe283('0xa2')]()['into']('cm_hopper')['fromQuery']([_0xe283('0xa3'),_0xe283('0xa4'),_0xe283('0xa5'),_0xe283('0xa6'),_0xe283('0x68'),_0xe283('0x61'),'updatedAt'],squel[_0xe283('0xa7')]()[_0xe283('0x87')]('phone',_0xe283('0xa3'))[_0xe283('0x87')](_0xe283('0xa8'),'scheduledAt')['field']('id','ContactId')[_0xe283('0x87')](_0x4f9566[_0xe283('0xa9')][_0xe283('0x8f')](),'ListId')[_0xe283('0x87')](_0x5ec863[_0xe283('0x53')]['id'][_0xe283('0x8f')](),_0xe283('0x68'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0x61'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0x62'))[_0xe283('0x89')](_0xe283('0xaa'))[_0xe283('0x48')](_0xe283('0xab'))['where'](_0xe283('0xac'),_0x4f9566[_0xe283('0xa9')][_0xe283('0x8f')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe283('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe283('0xa7')]()[_0xe283('0x87')](_0xe283('0xad'))['from'](_0xe283('0xae'))[_0xe283('0x48')]('VoiceQueueId\x20=\x20?',_0x5ec863[_0xe283('0x53')]['id']['toString']()))[_0xe283('0x48')](_0xe283('0xaf'),squel[_0xe283('0xa7')]()[_0xe283('0x87')](_0xe283('0xb0'))[_0xe283('0x89')](_0xe283('0xb1'))['where'](_0xe283('0xb2'),_0x5ec863[_0xe283('0x53')]['id'][_0xe283('0x8f')]())))['toString']();break;case'onlyIfOpen':_0x413b29=squel['insert']()['into'](_0xe283('0xb1'))['fromQuery']([_0xe283('0xa3'),_0xe283('0xa4'),_0xe283('0xa5'),'ListId',_0xe283('0x68'),'createdAt',_0xe283('0x62')],squel[_0xe283('0xa7')]()[_0xe283('0x87')](_0xe283('0xa3'),_0xe283('0xa3'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0xa4'))['field']('id',_0xe283('0xa5'))[_0xe283('0x87')](_0x4f9566[_0xe283('0xa9')][_0xe283('0x8f')](),_0xe283('0xa6'))['field'](_0x5ec863[_0xe283('0x53')]['id'][_0xe283('0x8f')](),_0xe283('0x68'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0x61'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0x62'))[_0xe283('0x89')](_0xe283('0xaa'))['where'](_0xe283('0xab'))[_0xe283('0x48')](_0xe283('0xac'),_0x4f9566['CmListId'][_0xe283('0x8f')]())[_0xe283('0x48')](_0xe283('0xb3'))[_0xe283('0x48')](_0xe283('0xaf'),squel['select']()[_0xe283('0x87')](_0xe283('0xb0'))[_0xe283('0x89')](_0xe283('0xb1'))[_0xe283('0x48')](_0xe283('0xb2'),_0x5ec863[_0xe283('0x53')]['id'][_0xe283('0x8f')]())))[_0xe283('0x8f')]();break;default:_0x413b29=squel[_0xe283('0xa2')]()[_0xe283('0xb4')](_0xe283('0xb1'))[_0xe283('0xb5')](['phone',_0xe283('0xa4'),_0xe283('0xa5'),'ListId','VoiceQueueId',_0xe283('0x61'),_0xe283('0x62')],squel[_0xe283('0xa7')]()[_0xe283('0x87')](_0xe283('0xa3'),_0xe283('0xa3'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0xa4'))[_0xe283('0x87')]('id',_0xe283('0xa5'))['field'](_0x4f9566[_0xe283('0xa9')]['toString'](),_0xe283('0xa6'))['field'](_0x5ec863[_0xe283('0x53')]['id'][_0xe283('0x8f')](),_0xe283('0x68'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0x61'))[_0xe283('0x87')]('NOW()',_0xe283('0x62'))[_0xe283('0x89')]('cm_contacts')[_0xe283('0x48')](_0xe283('0xab'))['where'](_0xe283('0xac'),_0x4f9566[_0xe283('0xa9')][_0xe283('0x8f')]())['where'](_0xe283('0xb3')))[_0xe283('0x8f')]();}_0x35c718['push'](db[_0xe283('0x8e')][_0xe283('0x43')](_0x413b29));}return BPromise[_0xe283('0x93')](_0x35c718);}})[_0xe283('0x2b')](function(){return _0x47b882;})[_0xe283('0x2b')](respondWithResult(_0x2cb51c,null))[_0xe283('0x51')](handleError(_0x2cb51c,null));};exports[_0xe283('0xb6')]=function(_0x62e949,_0x54e07e,_0x444909){return db[_0xe283('0x3b')][_0xe283('0x35')]({'where':{'id':_0x62e949[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x54e07e,null))['then'](function(_0x4fc20a){if(_0x4fc20a){return _0x4fc20a[_0xe283('0xb6')](_0x62e949['query'][_0xe283('0x94')]);}})[_0xe283('0x2b')](function(_0x3a3cab){if(_0x3a3cab){return db[_0xe283('0x67')][_0xe283('0x65')]({'where':{'ListId':_0x62e949[_0xe283('0x43')][_0xe283('0x94')],'VoiceQueueId':_0x62e949[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](function(){return _0x3a3cab;});}})[_0xe283('0x2b')](respondWithStatusCode(_0x54e07e,null))[_0xe283('0x51')](handleError(_0x54e07e,null));};exports[_0xe283('0xb7')]=function(_0x3bcbab,_0x3e4a05,_0x50f059){var _0x292735={};var _0x28b3c9={};var _0x123ddf;var _0x1785bb;return db['VoiceQueue'][_0xe283('0x6a')]({'where':{'id':_0x3bcbab[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x3e4a05,null))[_0xe283('0x2b')](function(_0x691f1e){if(_0x691f1e){_0x123ddf=_0x691f1e;_0x28b3c9[_0xe283('0x3f')]=_[_0xe283('0x54')](db[_0xe283('0x9e')]['rawAttributes']);_0x28b3c9['query']=_[_0xe283('0x54')](_0x3bcbab['query']);_0x28b3c9[_0xe283('0x49')]=_[_0xe283('0x41')](_0x28b3c9[_0xe283('0x3f')],_0x28b3c9[_0xe283('0x43')]);_0x292735['attributes']=_[_0xe283('0x41')](_0x28b3c9[_0xe283('0x3f')],qs[_0xe283('0x42')](_0x3bcbab[_0xe283('0x43')][_0xe283('0x42')]));_0x292735['attributes']=_0x292735['attributes']['length']?_0x292735[_0xe283('0x40')]:_0x28b3c9[_0xe283('0x3f')];_0x292735[_0xe283('0x46')]=qs[_0xe283('0x47')](_0x3bcbab[_0xe283('0x43')][_0xe283('0x47')]);_0x292735[_0xe283('0x48')]=qs[_0xe283('0x49')](_[_0xe283('0x4a')](_0x3bcbab[_0xe283('0x43')],_0x28b3c9[_0xe283('0x49')]));if(_0x3bcbab[_0xe283('0x43')]['filter']){_0x292735[_0xe283('0x48')]=_[_0xe283('0x4b')](_0x292735[_0xe283('0x48')],{'$or':_[_0xe283('0x31')](_0x292735[_0xe283('0x40')],function(_0x5739b3){var _0x56bc36={};_0x56bc36[_0x5739b3]={'$like':'%'+_0x3bcbab['query'][_0xe283('0x2f')]+'%'};return _0x56bc36;})});}_0x292735=_[_0xe283('0x4b')]({},_0x292735,_0x3bcbab['options']);return _0x123ddf['getBlackLists'](_0x292735);}})[_0xe283('0x2b')](function(_0x3e6be2){if(_0x3e6be2){_0x1785bb=_0x3e6be2[_0xe283('0x44')];if(!_0x3bcbab[_0xe283('0x43')][_0xe283('0x45')](_0xe283('0x6e'))){_0x292735[_0xe283('0x23')]=qs[_0xe283('0x23')](_0x3bcbab[_0xe283('0x43')][_0xe283('0x23')]);_0x292735[_0xe283('0x21')]=qs[_0xe283('0x21')](_0x3bcbab[_0xe283('0x43')][_0xe283('0x21')]);}return _0x123ddf['getBlackLists'](_0x292735);}})[_0xe283('0x2b')](function(_0x52dcb4){if(_0x52dcb4){return _0x52dcb4?{'count':_0x1785bb,'rows':_0x52dcb4}:null;}})[_0xe283('0x2b')](respondWithResult(_0x3e4a05,null))[_0xe283('0x51')](handleError(_0x3e4a05,null));};exports[_0xe283('0xb8')]=function(_0x573aaa,_0x21e36b,_0x5818df){var _0x8d71aa,_0x19fead;return db[_0xe283('0x3b')]['find']({'where':{'id':_0x573aaa[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](handleEntityNotFound(_0x21e36b,null))[_0xe283('0x2b')](function(_0x3e938d){if(_0x3e938d){_0x19fead=_0x3e938d;return _0x3e938d[_0xe283('0xb8')](_0x573aaa[_0xe283('0x57')][_0xe283('0x94')],_[_0xe283('0x63')](_0x573aaa[_0xe283('0x57')],[_0xe283('0x94'),'id'])||{});}return null;})[_0xe283('0x96')](function(_0x5314a2){var _0x54f7e7;_0x8d71aa=_0x5314a2||[];var _0x1445e5=[];if(_0x5314a2){for(var _0x132d8c=0x0;_0x132d8c<_0x5314a2[_0xe283('0x44')];_0x132d8c+=0x1){var _0x52a778=_0x5314a2[_0x132d8c][_0xe283('0x2c')]({'plain':!![]});_0x54f7e7=squel[_0xe283('0xa2')]()['into']('cm_hopper_black')['fromQuery']([_0xe283('0xa3'),_0xe283('0xa5'),_0xe283('0xa6'),'VoiceQueueId',_0xe283('0x61'),_0xe283('0x62')],squel[_0xe283('0xa7')]()['field'](_0xe283('0xa3'),_0xe283('0xa3'))[_0xe283('0x87')]('id',_0xe283('0xa5'))[_0xe283('0x87')](_0x52a778[_0xe283('0xa9')][_0xe283('0x8f')](),_0xe283('0xa6'))[_0xe283('0x87')](_0x573aaa[_0xe283('0x53')]['id'][_0xe283('0x8f')](),_0xe283('0x68'))['field'](_0xe283('0xa8'),_0xe283('0x61'))[_0xe283('0x87')](_0xe283('0xa8'),_0xe283('0x62'))['from'](_0xe283('0xaa'))[_0xe283('0x48')]('deletedAt\x20IS\x20NULL')[_0xe283('0x48')](_0xe283('0xac'),_0x52a778['CmListId'][_0xe283('0x8f')]())['where'](_0xe283('0xb3')))[_0xe283('0x8f')]();_0x1445e5[_0xe283('0x8d')](db[_0xe283('0x8e')][_0xe283('0x43')](_0x54f7e7));}return BPromise[_0xe283('0x93')](_0x1445e5);}})[_0xe283('0x2b')](function(){return _0x8d71aa;})[_0xe283('0x2b')](respondWithResult(_0x21e36b,null))[_0xe283('0x51')](handleError(_0x21e36b,null));};exports['removeBlackLists']=function(_0x324040,_0x59f4ec,_0x483c19){return db[_0xe283('0x3b')]['find']({'where':{'id':_0x324040[_0xe283('0x53')]['id']}})['then'](handleEntityNotFound(_0x59f4ec,null))['then'](function(_0x22e9f4){if(_0x22e9f4){return _0x22e9f4[_0xe283('0xb9')](_0x324040['query'][_0xe283('0x94')]);}})[_0xe283('0x2b')](function(_0x57763d){if(_0x57763d){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x324040[_0xe283('0x43')][_0xe283('0x94')],'VoiceQueueId':_0x324040[_0xe283('0x53')]['id']}})[_0xe283('0x2b')](function(){return _0x57763d;});}})[_0xe283('0x2b')](respondWithStatusCode(_0x59f4ec,null))[_0xe283('0x51')](handleError(_0x59f4ec,null));}; \ No newline at end of file +var _0x3fdb=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','online','voicePause','interface','flatMap','Agents','forEach','sequelize','transaction','each','TeamVoiceQueue','penalty','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','ids','User','select','field','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','removeTeams','userVoiceQueue:remove','addAgents','spread','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','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','../../mysqldb','redis','defaults','register','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','destroy','sendStatus','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x7d710,_0x412547){var _0x3f5e58=function(_0x11b52c){while(--_0x11b52c){_0x7d710['push'](_0x7d710['shift']());}};_0x3f5e58(++_0x412547);}(_0x3fdb,0x1af));var _0xb3fd=function(_0x38960a,_0x4e49b0){_0x38960a=_0x38960a-0x0;var _0x1003e2=_0x3fdb[_0x38960a];return _0x1003e2;};'use strict';var emlformat=require(_0xb3fd('0x0'));var rimraf=require(_0xb3fd('0x1'));var zipdir=require(_0xb3fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3fd('0x3'));var moment=require('moment');var BPromise=require(_0xb3fd('0x4'));var Mustache=require(_0xb3fd('0x5'));var util=require(_0xb3fd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb3fd('0x7'));var ejs=require(_0xb3fd('0x8'));var fs=require('fs');var fs_extra=require(_0xb3fd('0x9'));var _=require(_0xb3fd('0xa'));var squel=require('squel');var crypto=require(_0xb3fd('0xb'));var jsforce=require(_0xb3fd('0xc'));var deskjs=require(_0xb3fd('0xd'));var toCsv=require(_0xb3fd('0x7'));var querystring=require(_0xb3fd('0xe'));var Papa=require(_0xb3fd('0xf'));var Redis=require(_0xb3fd('0x10'));var authService=require(_0xb3fd('0x11'));var qs=require(_0xb3fd('0x12'));var as=require(_0xb3fd('0x13'));var hardwareService=require(_0xb3fd('0x14'));var logger=require(_0xb3fd('0x15'))(_0xb3fd('0x16'));var utils=require(_0xb3fd('0x17'));var config=require(_0xb3fd('0x18'));var licenseUtil=require(_0xb3fd('0x19'));var db=require(_0xb3fd('0x1a'))['db'];config[_0xb3fd('0x1b')]=_[_0xb3fd('0x1c')](config[_0xb3fd('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3fd('0x1b')]));require('./voiceQueue.socket')[_0xb3fd('0x1d')](socket);function respondWithStatusCode(_0x1f706b,_0x33a33c){_0x33a33c=_0x33a33c||0xcc;return function(_0x44bf55){if(_0x44bf55){return _0x1f706b['sendStatus'](_0x33a33c);}return _0x1f706b['status'](_0x33a33c)[_0xb3fd('0x1e')]();};}function respondWithResult(_0x3403fb,_0x519fd3){_0x519fd3=_0x519fd3||0xc8;return function(_0x5634af){if(_0x5634af){return _0x3403fb['status'](_0x519fd3)['json'](_0x5634af);}};}function respondWithFilteredResult(_0x36b67d,_0x3d92b9){return function(_0x13d283){if(_0x13d283){var _0x9c7ea9=typeof _0x3d92b9[_0xb3fd('0x1f')]==='undefined'&&typeof _0x3d92b9[_0xb3fd('0x20')]===_0xb3fd('0x21');var _0x38911e=_0x13d283[_0xb3fd('0x22')];var _0x14f402=_0x9c7ea9?0x0:_0x3d92b9[_0xb3fd('0x1f')];var _0x3c099a=_0x9c7ea9?_0x13d283['count']:_0x3d92b9[_0xb3fd('0x1f')]+_0x3d92b9[_0xb3fd('0x20')];var _0x123314;if(_0x3c099a>=_0x38911e){_0x3c099a=_0x38911e;_0x123314=0xc8;}else{_0x123314=0xce;}_0x36b67d[_0xb3fd('0x23')](_0x123314);return _0x36b67d[_0xb3fd('0x24')](_0xb3fd('0x25'),_0x14f402+'-'+_0x3c099a+'/'+_0x38911e)['json'](_0x13d283);}return null;};}function patchUpdates(_0x5a8a8d){return function(_0x590eb5){try{jsonpatch[_0xb3fd('0x26')](_0x590eb5,_0x5a8a8d,!![]);}catch(_0x3a8819){return BPromise[_0xb3fd('0x27')](_0x3a8819);}return _0x590eb5['save']();};}function saveUpdates(_0x45c993,_0x3417e9){return function(_0x4af128){if(_0x4af128){return _0x4af128[_0xb3fd('0x28')](_0x45c993)['then'](function(_0x147d0e){return _0x147d0e;});}return null;};}function removeEntity(_0x1866c1,_0x416912){return function(_0x23dec8){if(_0x23dec8){return _0x23dec8['destroy']()[_0xb3fd('0x29')](function(){var _0x171f17=_0x23dec8[_0xb3fd('0x2a')]({'plain':!![]});var _0x4c2b0c=[{'name':_0xb3fd('0x2b'),'value':_0xb3fd('0x2c'),'ignore':![]},{'name':_0xb3fd('0x2d'),'value':_0xb3fd('0x2e'),'ignore':![]}];var _0x4ea6ba=_(_0x4c2b0c)[_0xb3fd('0x2f')](_0xb3fd('0x30'))[_0xb3fd('0x31')]('value')[_0xb3fd('0x32')]();if(_['includes'](_0x4ea6ba,_0x171f17[_0xb3fd('0x33')])){return;}var _0x1df219=_[_0xb3fd('0x34')](_0x4c2b0c,[_0xb3fd('0x32'),_0x171f17[_0xb3fd('0x33')]])[_0xb3fd('0x35')];return db[_0xb3fd('0x36')][_0xb3fd('0x37')]({'where':{'type':_0x1df219,'resourceId':_0x171f17['id']}})[_0xb3fd('0x29')](function(){return _0x23dec8;});})[_0xb3fd('0x29')](function(){_0x1866c1[_0xb3fd('0x23')](0xcc)[_0xb3fd('0x1e')]();});}};}function handleEntityNotFound(_0x2923db,_0x5f3852){return function(_0x2f6e3d){if(!_0x2f6e3d){_0x2923db[_0xb3fd('0x38')](0x194);}return _0x2f6e3d;};}function handleError(_0x4dd2ce,_0x1cb48c){_0x1cb48c=_0x1cb48c||0x1f4;return function(_0x111b25){logger[_0xb3fd('0x39')](_0x111b25['stack']);if(_0x111b25[_0xb3fd('0x35')]){delete _0x111b25[_0xb3fd('0x35')];}_0x4dd2ce[_0xb3fd('0x23')](_0x1cb48c)[_0xb3fd('0x3a')](_0x111b25);};}exports[_0xb3fd('0x3b')]=function(_0x3f578b,_0x1ff8c1){var _0x5338f6={},_0x50cdae={},_0x181790={'count':0x0,'rows':[]};var _0x1cdab9=_[_0xb3fd('0x31')](db[_0xb3fd('0x3c')][_0xb3fd('0x3d')],function(_0x47f449){return{'name':_0x47f449[_0xb3fd('0x3e')],'type':_0x47f449['type'][_0xb3fd('0x3f')]};});_0x50cdae[_0xb3fd('0x40')]=_[_0xb3fd('0x31')](_0x1cdab9,_0xb3fd('0x35'));_0x50cdae[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x3f578b[_0xb3fd('0x41')]);_0x50cdae[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x50cdae[_0xb3fd('0x40')],_0x50cdae[_0xb3fd('0x41')]);_0x5338f6['attributes']=_[_0xb3fd('0x44')](_0x50cdae['model'],qs[_0xb3fd('0x45')](_0x3f578b[_0xb3fd('0x41')]['fields']));_0x5338f6[_0xb3fd('0x46')]=_0x5338f6[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x5338f6[_0xb3fd('0x46')]:_0x50cdae[_0xb3fd('0x40')];if(!_0x3f578b[_0xb3fd('0x41')]['hasOwnProperty']('nolimit')){_0x5338f6[_0xb3fd('0x20')]=qs['limit'](_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x5338f6['offset']=qs[_0xb3fd('0x1f')](_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0x5338f6[_0xb3fd('0x48')]=qs['sort'](_0x3f578b['query']['sort']);_0x5338f6[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x3f578b['query'],_0x50cdae[_0xb3fd('0x43')]),_0x1cdab9);if(_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x5338f6['where']=_[_0xb3fd('0x4b')](_0x5338f6[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x1cdab9,function(_0x13bd29){if(_0x13bd29[_0xb3fd('0x33')]!==_0xb3fd('0x4c')){var _0x5f3b42={};_0x5f3b42[_0x13bd29['name']]={'$like':'%'+_0x3f578b['query'][_0xb3fd('0x2f')]+'%'};return _0x5f3b42;}})});}_0x5338f6=_['merge']({},_0x5338f6,_0x3f578b[_0xb3fd('0x4d')]);var _0x27efe4={'where':_0x5338f6[_0xb3fd('0x49')]};return db[_0xb3fd('0x3c')][_0xb3fd('0x22')](_0x27efe4)[_0xb3fd('0x29')](function(_0x1f2532){_0x181790[_0xb3fd('0x22')]=_0x1f2532;if(_0x3f578b[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0x5338f6[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x3c')][_0xb3fd('0x50')](_0x5338f6);})[_0xb3fd('0x29')](function(_0x39a6ce){_0x181790[_0xb3fd('0x51')]=_0x39a6ce;return _0x181790;})[_0xb3fd('0x29')](respondWithFilteredResult(_0x1ff8c1,_0x5338f6))[_0xb3fd('0x52')](handleError(_0x1ff8c1,null));};exports['show']=function(_0x559d1f,_0x3d96b0){var _0x7e08d6={'raw':![],'where':{'id':_0x559d1f['params']['id']}},_0x40836c={};_0x40836c[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x3c')]['rawAttributes']);_0x40836c[_0xb3fd('0x41')]=_['keys'](_0x559d1f[_0xb3fd('0x41')]);_0x40836c['filters']=_['intersection'](_0x40836c[_0xb3fd('0x40')],_0x40836c[_0xb3fd('0x41')]);_0x7e08d6[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x40836c[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x559d1f['query'][_0xb3fd('0x45')]));_0x7e08d6[_0xb3fd('0x46')]=_0x7e08d6['attributes'][_0xb3fd('0x47')]?_0x7e08d6[_0xb3fd('0x46')]:_0x40836c[_0xb3fd('0x40')];if(_0x559d1f[_0xb3fd('0x41')]['includeAll']){_0x7e08d6['include']=[{'all':!![]}];}_0x7e08d6=_['merge']({},_0x7e08d6,_0x559d1f[_0xb3fd('0x4d')]);return db['VoiceQueue'][_0xb3fd('0x34')](_0x7e08d6)['then'](handleEntityNotFound(_0x3d96b0,null))[_0xb3fd('0x29')](respondWithResult(_0x3d96b0,null))[_0xb3fd('0x52')](handleError(_0x3d96b0,null));};exports[_0xb3fd('0x53')]=function(_0x4a9214,_0x367703){return db['VoiceQueue'][_0xb3fd('0x53')](_0x4a9214[_0xb3fd('0x54')],{})['then'](function(_0x21fbdc){var _0x221922=_0x4a9214['user'][_0xb3fd('0x2a')]({'plain':!![]});if(!_0x221922)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x221922[_0xb3fd('0x55')]===_0xb3fd('0x56')){var _0x5bddcd=_0x21fbdc[_0xb3fd('0x2a')]({'plain':!![]});var _0x13d39f=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xb3fd('0x2d'),'value':'outbound'}];var _0x2296a8=_[_0xb3fd('0x34')](_0x13d39f,[_0xb3fd('0x32'),_0x5bddcd['type']])[_0xb3fd('0x35')];return db[_0xb3fd('0x57')][_0xb3fd('0x34')]({'where':{'name':_0x2296a8,'userProfileId':_0x221922[_0xb3fd('0x58')]},'raw':!![]})[_0xb3fd('0x29')](function(_0x3e1e5e){if(_0x3e1e5e&&_0x3e1e5e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bddcd[_0xb3fd('0x35')],'resourceId':_0x5bddcd['id'],'type':_0x3e1e5e[_0xb3fd('0x35')],'sectionId':_0x3e1e5e['id']},{})[_0xb3fd('0x29')](function(){return _0x21fbdc;});}else{return _0x21fbdc;}})[_0xb3fd('0x52')](function(_0x5c996e){logger[_0xb3fd('0x39')](_0xb3fd('0x59'),_0x5c996e);throw _0x5c996e;});}return _0x21fbdc;})['then'](respondWithResult(_0x367703,0xc9))[_0xb3fd('0x52')](handleError(_0x367703,null));};exports[_0xb3fd('0x5a')]=function(_0x2934e,_0x1a822d){var _0x7cbf03={'where':{'id':_0x2934e[_0xb3fd('0x5b')]['id']}},_0x5eb62f={};_0x5eb62f[_0xb3fd('0x40')]=_['keys'](db['VoiceQueue'][_0xb3fd('0x3d')]);_0x7cbf03[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x5eb62f[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x2934e[_0xb3fd('0x41')]['fields']));_0x7cbf03[_0xb3fd('0x46')]=_0x7cbf03[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x7cbf03['attributes']:_0x5eb62f['model'];if(_0x2934e['query'][_0xb3fd('0x4e')]){_0x7cbf03[_0xb3fd('0x4f')]=[{'all':!![]}];}_0x7cbf03=_[_0xb3fd('0x4b')]({},_0x7cbf03,_0x2934e['options']);return db[_0xb3fd('0x3c')][_0xb3fd('0x34')](_0x7cbf03)['then'](handleEntityNotFound(_0x1a822d,null))[_0xb3fd('0x29')](function(_0x3e53b0){if(_0x3e53b0){var _0x386dc4=_0x3e53b0['get']({'plain':!![]});_0x386dc4=qs[_0xb3fd('0x5c')](_0x386dc4,['id','createdAt',_0xb3fd('0x5d')]);_0x2934e[_0xb3fd('0x54')]=_[_0xb3fd('0x5c')](_0x2934e['body'],['id',_0xb3fd('0x5e'),_0xb3fd('0x5d')]);return db[_0xb3fd('0x3c')]['create'](_[_0xb3fd('0x4b')](_0x386dc4,_0x2934e['body']),{'include':_0x2934e[_0xb3fd('0x41')][_0xb3fd('0x4e')]?[{'all':!![]}]:undefined})[_0xb3fd('0x29')](function(_0x551530){var _0x2fe570=_0x2934e[_0xb3fd('0x56')][_0xb3fd('0x2a')]({'plain':!![]});if(!_0x2fe570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe570[_0xb3fd('0x55')]===_0xb3fd('0x56')){var _0x37f662=_0x551530[_0xb3fd('0x2a')]({'plain':!![]});var _0x587fd9=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xb3fd('0x2e')}];var _0x36eb2b=_[_0xb3fd('0x34')](_0x587fd9,[_0xb3fd('0x32'),_0x37f662[_0xb3fd('0x33')]])[_0xb3fd('0x35')];return db[_0xb3fd('0x57')][_0xb3fd('0x34')]({'where':{'name':_0x36eb2b,'userProfileId':_0x2fe570[_0xb3fd('0x58')]},'raw':!![]})[_0xb3fd('0x29')](function(_0x385d1b){if(_0x385d1b&&_0x385d1b[_0xb3fd('0x5f')]===0x0){return db[_0xb3fd('0x36')]['create']({'name':_0x37f662[_0xb3fd('0x35')],'resourceId':_0x37f662['id'],'type':_0x385d1b['name'],'sectionId':_0x385d1b['id']},{})['then'](function(){return _0x551530;});}else{return _0x551530;}})[_0xb3fd('0x52')](function(_0x210ad7){logger[_0xb3fd('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x210ad7);throw _0x210ad7;});}return _0x551530;});}})[_0xb3fd('0x29')](respondWithResult(_0x1a822d,0xc9))[_0xb3fd('0x52')](handleError(_0x1a822d,null));};exports[_0xb3fd('0x28')]=function(_0x430087,_0x48b0bf){if(_0x430087[_0xb3fd('0x54')]['id']){delete _0x430087[_0xb3fd('0x54')]['id'];}return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x430087[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x48b0bf,null))[_0xb3fd('0x29')](saveUpdates(_0x430087[_0xb3fd('0x54')],null))[_0xb3fd('0x29')](respondWithResult(_0x48b0bf,null))[_0xb3fd('0x52')](handleError(_0x48b0bf,null));};exports[_0xb3fd('0x37')]=function(_0x1d61f0,_0x5abd72){return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x1d61f0[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5abd72,null))[_0xb3fd('0x29')](removeEntity(_0x5abd72,null))['catch'](handleError(_0x5abd72,null));};exports[_0xb3fd('0x60')]=function(_0x5ee0d9,_0x242cc8,_0x2673e2){var _0xb8bbb5={'raw':![],'where':{}};var _0x339d75={};var _0x16f018={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x5ee0d9[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x242cc8,null))['then'](function(_0x5ad749){if(_0x5ad749){_0x339d75['model']=_['keys'](db['CmHopper'][_0xb3fd('0x3d')]);_0x339d75[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x5ee0d9['query']);_0x339d75[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x339d75[_0xb3fd('0x40')],_0x339d75[_0xb3fd('0x41')]);_0xb8bbb5['attributes']=_[_0xb3fd('0x44')](_0x339d75[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x5ee0d9[_0xb3fd('0x41')]['fields']));_0xb8bbb5['attributes']=_0xb8bbb5[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0xb8bbb5[_0xb3fd('0x46')]:_0x339d75[_0xb3fd('0x40')];if(!_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0xb8bbb5[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x5ee0d9['query'][_0xb3fd('0x20')]);_0xb8bbb5[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0xb8bbb5[_0xb3fd('0x48')]=qs['sort'](_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0xb8bbb5[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x5ee0d9[_0xb3fd('0x41')],_0x339d75[_0xb3fd('0x43')]));_0xb8bbb5['where'][_0xb3fd('0x65')]=_0x5ad749['id'];if(_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0xb8bbb5['where']=_[_0xb3fd('0x4b')](_0xb8bbb5[_0xb3fd('0x49')],{'$or':_['map'](_0xb8bbb5[_0xb3fd('0x46')],function(_0x5520d2){var _0xcb0fa2={};_0xcb0fa2[_0x5520d2]={'$like':'%'+_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0xcb0fa2;})});}_0xb8bbb5=_[_0xb3fd('0x4b')]({},_0xb8bbb5,_0x5ee0d9[_0xb3fd('0x4d')]);return db[_0xb3fd('0x66')]['count']({'where':_0xb8bbb5[_0xb3fd('0x49')]})[_0xb3fd('0x29')](function(_0x20ea78){_0x16f018[_0xb3fd('0x22')]=_0x20ea78;if(_0x5ee0d9[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0xb8bbb5[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x66')]['findAll'](_0xb8bbb5);})[_0xb3fd('0x29')](function(_0x5cc606){_0x16f018[_0xb3fd('0x51')]=_0x5cc606;return _0x16f018;});}})['then'](respondWithFilteredResult(_0x242cc8,_0xb8bbb5))[_0xb3fd('0x52')](handleError(_0x242cc8,null));};exports[_0xb3fd('0x67')]=function(_0x645e08,_0x29f4ac,_0x3026a6){var _0x148b8f={'raw':!![],'where':{}};var _0x5aea99={};var _0x2e4fbf={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x645e08['params']['id']}})['then'](handleEntityNotFound(_0x29f4ac,null))[_0xb3fd('0x29')](function(_0x41db8b){if(_0x41db8b){_0x5aea99['model']=_['keys'](db['CmHopperHistory'][_0xb3fd('0x3d')]);_0x5aea99[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x645e08['query']);_0x5aea99[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x5aea99['model'],_0x5aea99['query']);_0x148b8f['attributes']=_[_0xb3fd('0x44')](_0x5aea99[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x148b8f[_0xb3fd('0x46')]=_0x148b8f[_0xb3fd('0x46')]['length']?_0x148b8f[_0xb3fd('0x46')]:_0x5aea99['model'];if(!_0x645e08['query'][_0xb3fd('0x62')]('nolimit')){_0x148b8f[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x645e08[_0xb3fd('0x41')]['limit']);_0x148b8f[_0xb3fd('0x1f')]=qs['offset'](_0x645e08['query'][_0xb3fd('0x1f')]);}_0x148b8f[_0xb3fd('0x48')]=qs['sort'](_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x148b8f['where']=qs[_0xb3fd('0x43')](_['pick'](_0x645e08[_0xb3fd('0x41')],_0x5aea99['filters']));_0x148b8f[_0xb3fd('0x49')][_0xb3fd('0x65')]=_0x41db8b['id'];if(_0x645e08[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x148b8f[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x148b8f[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x148b8f[_0xb3fd('0x46')],function(_0x1ca808){var _0x57d78e={};_0x57d78e[_0x1ca808]={'$like':'%'+_0x645e08[_0xb3fd('0x41')]['filter']+'%'};return _0x57d78e;})});}_0x148b8f=_[_0xb3fd('0x4b')]({},_0x148b8f,_0x645e08[_0xb3fd('0x4d')]);return db[_0xb3fd('0x68')][_0xb3fd('0x22')]({'where':_0x148b8f[_0xb3fd('0x49')]})['then'](function(_0x2f1e80){_0x2e4fbf['count']=_0x2f1e80;if(_0x645e08['query'][_0xb3fd('0x4e')]){_0x148b8f['include']=[{'all':!![]}];}return db[_0xb3fd('0x68')][_0xb3fd('0x50')](_0x148b8f);})[_0xb3fd('0x29')](function(_0x152b7b){_0x2e4fbf[_0xb3fd('0x51')]=_0x152b7b;return _0x2e4fbf;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x29f4ac,_0x148b8f))[_0xb3fd('0x52')](handleError(_0x29f4ac,null));};exports[_0xb3fd('0x69')]=function(_0x3001bb,_0x3a6fa5,_0x51acfe){var _0x70f1db={'raw':!![],'where':{}};var _0x49b9c2={};var _0x352ee4={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x3001bb['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x3a6fa5,null))[_0xb3fd('0x29')](function(_0x28cb50){if(_0x28cb50){_0x49b9c2['model']=_[_0xb3fd('0x42')](db[_0xb3fd('0x6a')][_0xb3fd('0x3d')]);_0x49b9c2['query']=_['keys'](_0x3001bb['query']);_0x49b9c2['filters']=_['intersection'](_0x49b9c2['model'],_0x49b9c2[_0xb3fd('0x41')]);_0x70f1db[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x49b9c2['model'],qs[_0xb3fd('0x45')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x70f1db['attributes']=_0x70f1db['attributes']['length']?_0x70f1db[_0xb3fd('0x46')]:_0x49b9c2[_0xb3fd('0x40')];if(!_0x3001bb['query']['hasOwnProperty'](_0xb3fd('0x63'))){_0x70f1db[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x70f1db['offset']=qs[_0xb3fd('0x1f')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}_0x70f1db[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x3001bb[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x70f1db[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x3001bb[_0xb3fd('0x41')],_0x49b9c2[_0xb3fd('0x43')]));_0x70f1db['where'][_0xb3fd('0x65')]=_0x28cb50['id'];if(_0x3001bb['query']['filter']){_0x70f1db[_0xb3fd('0x49')]=_['merge'](_0x70f1db['where'],{'$or':_[_0xb3fd('0x31')](_0x70f1db[_0xb3fd('0x46')],function(_0x124877){var _0x3929b3={};_0x3929b3[_0x124877]={'$like':'%'+_0x3001bb['query']['filter']+'%'};return _0x3929b3;})});}_0x70f1db=_[_0xb3fd('0x4b')]({},_0x70f1db,_0x3001bb[_0xb3fd('0x4d')]);return db['CmHopperFinal'][_0xb3fd('0x22')]({'where':_0x70f1db[_0xb3fd('0x49')]})[_0xb3fd('0x29')](function(_0x1e810e){_0x352ee4['count']=_0x1e810e;if(_0x3001bb[_0xb3fd('0x41')]['includeAll']){_0x70f1db['include']=[{'all':!![]}];}return db[_0xb3fd('0x6a')][_0xb3fd('0x50')](_0x70f1db);})[_0xb3fd('0x29')](function(_0x2377a5){_0x352ee4[_0xb3fd('0x51')]=_0x2377a5;return _0x352ee4;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x3a6fa5,_0x70f1db))[_0xb3fd('0x52')](handleError(_0x3a6fa5,null));};exports[_0xb3fd('0x6b')]=function(_0x265dbf,_0x359c3d,_0x58d092){var _0x185908={'raw':!![],'where':{}};var _0x2f44e5={};var _0x6eb95c={'count':0x0,'rows':[]};return db[_0xb3fd('0x3c')]['findOne']({'where':{'id':_0x265dbf[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x359c3d,null))['then'](function(_0x18cc20){if(_0x18cc20){_0x2f44e5[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x6c')]['rawAttributes']);_0x2f44e5[_0xb3fd('0x41')]=_['keys'](_0x265dbf[_0xb3fd('0x41')]);_0x2f44e5[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x2f44e5[_0xb3fd('0x40')],_0x2f44e5[_0xb3fd('0x41')]);_0x185908['attributes']=_['intersection'](_0x2f44e5[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x185908[_0xb3fd('0x46')]=_0x185908['attributes'][_0xb3fd('0x47')]?_0x185908['attributes']:_0x2f44e5[_0xb3fd('0x40')];if(!_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x62')]('nolimit')){_0x185908[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x265dbf[_0xb3fd('0x41')]['limit']);_0x185908[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x265dbf['query'][_0xb3fd('0x1f')]);}_0x185908['order']=qs[_0xb3fd('0x64')](_0x265dbf[_0xb3fd('0x41')]['sort']);_0x185908[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_['pick'](_0x265dbf[_0xb3fd('0x41')],_0x2f44e5[_0xb3fd('0x43')]));_0x185908[_0xb3fd('0x49')][_0xb3fd('0x65')]=_0x18cc20['id'];if(_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x185908[_0xb3fd('0x49')]=_['merge'](_0x185908[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x185908[_0xb3fd('0x46')],function(_0x568ece){var _0x606ef8={};_0x606ef8[_0x568ece]={'$like':'%'+_0x265dbf[_0xb3fd('0x41')]['filter']+'%'};return _0x606ef8;})});}_0x185908=_[_0xb3fd('0x4b')]({},_0x185908,_0x265dbf[_0xb3fd('0x4d')]);return db[_0xb3fd('0x6c')][_0xb3fd('0x22')]({'where':_0x185908[_0xb3fd('0x49')]})['then'](function(_0x43f875){_0x6eb95c['count']=_0x43f875;if(_0x265dbf[_0xb3fd('0x41')][_0xb3fd('0x4e')]){_0x185908[_0xb3fd('0x4f')]=[{'all':!![]}];}return db[_0xb3fd('0x6c')][_0xb3fd('0x50')](_0x185908);})[_0xb3fd('0x29')](function(_0x54e420){_0x6eb95c[_0xb3fd('0x51')]=_0x54e420;return _0x6eb95c;});}})[_0xb3fd('0x29')](respondWithFilteredResult(_0x359c3d,_0x185908))[_0xb3fd('0x52')](handleError(_0x359c3d,null));};exports[_0xb3fd('0x6d')]=function(_0x24e9c3,_0x3aad43,_0x2f64f7){var _0x58b552={};var _0x1bd0e5={};var _0x4e756e;var _0x220066;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x24e9c3[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x3aad43,null))['then'](function(_0x217a0d){if(_0x217a0d){_0x4e756e=_0x217a0d;_0x1bd0e5[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db['Team'][_0xb3fd('0x3d')]);_0x1bd0e5[_0xb3fd('0x41')]=_['keys'](_0x24e9c3[_0xb3fd('0x41')]);_0x1bd0e5['filters']=_['intersection'](_0x1bd0e5[_0xb3fd('0x40')],_0x1bd0e5['query']);_0x58b552['attributes']=_[_0xb3fd('0x44')](_0x1bd0e5[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x24e9c3[_0xb3fd('0x41')]['fields']));_0x58b552[_0xb3fd('0x46')]=_0x58b552[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x58b552[_0xb3fd('0x46')]:_0x1bd0e5['model'];_0x58b552[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x58b552[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_['pick'](_0x24e9c3['query'],_0x1bd0e5[_0xb3fd('0x43')]));if(_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x58b552[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x58b552['where'],{'$or':_[_0xb3fd('0x31')](_0x58b552[_0xb3fd('0x46')],function(_0x3cc72f){var _0x304b9e={};_0x304b9e[_0x3cc72f]={'$like':'%'+_0x24e9c3['query'][_0xb3fd('0x2f')]+'%'};return _0x304b9e;})});}_0x58b552=_[_0xb3fd('0x4b')]({},_0x58b552,_0x24e9c3[_0xb3fd('0x4d')]);return _0x4e756e[_0xb3fd('0x6d')](_0x58b552);}})[_0xb3fd('0x29')](function(_0x10e147){if(_0x10e147){_0x220066=_0x10e147[_0xb3fd('0x47')];if(!_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x62')]('nolimit')){_0x58b552[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x24e9c3['query'][_0xb3fd('0x20')]);_0x58b552['offset']=qs[_0xb3fd('0x1f')](_0x24e9c3[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x4e756e[_0xb3fd('0x6d')](_0x58b552);}})[_0xb3fd('0x29')](function(_0x565c8d){if(_0x565c8d){return _0x565c8d?{'count':_0x220066,'rows':_0x565c8d}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x3aad43,null))[_0xb3fd('0x52')](handleError(_0x3aad43,null));};exports['addTeams']=function(_0x41e636,_0xa132aa,_0x1a025c){var _0x33e4bd=_0x41e636['body'][_0xb3fd('0x6e')];var _0xbb1870=_[_0xb3fd('0x31')](_0x33e4bd,'id');return db[_0xb3fd('0x6f')][_0xb3fd('0x50')]({'where':{'id':_0xbb1870},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb3fd('0x35'),_0xb3fd('0x70'),_0xb3fd('0x71'),_0xb3fd('0x72')],'raw':!![]}]})[_0xb3fd('0x29')](function(_0x5bdf08){if(_0x5bdf08){var _0x230beb=_[_0xb3fd('0x73')](_0x5bdf08,function(_0x5d0bf4){var _0x2cf093=_0x5d0bf4[_0xb3fd('0x2a')]({'plain':!![]});_0x2cf093[_0xb3fd('0x74')][_0xb3fd('0x75')](function(_0x897e23){_0x897e23['penalty']=_[_0xb3fd('0x34')](_0x33e4bd,{'id':_0x2cf093['id']})['penalty'];});return _0x2cf093[_0xb3fd('0x74')];});return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x41e636[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](function(_0x5376c8){return db[_0xb3fd('0x76')][_0xb3fd('0x77')](function(_0x463479){return _0x5376c8['addTeams'](_0xbb1870,{'transaction':_0x463479})['then'](function(){return BPromise[_0xb3fd('0x78')](_0x33e4bd,function(_0xb3d03d){return db[_0xb3fd('0x79')]['upsert']({'TeamId':_0xb3d03d['id'],'VoiceQueueId':_0x41e636['params']['id'],'penalty':_0xb3d03d[_0xb3fd('0x7a')]},{'transaction':_0x463479});});})[_0xb3fd('0x29')](function(){return BPromise[_0xb3fd('0x78')](_0x230beb,function(_0x57af6a){return db['UserVoiceQueue'][_0xb3fd('0x7b')]({'where':{'UserId':_0x57af6a['id'],'VoiceQueueId':_0x41e636[_0xb3fd('0x5b')]['id']},'defaults':{'penalty':_0x57af6a[_0xb3fd('0x7a')]},'transaction':_0x463479});});})['then'](function(){return BPromise[_0xb3fd('0x78')](_[_0xb3fd('0x2f')](_0x230beb,{'online':!![]}),function(_0x564838){return db[_0xb3fd('0x7c')]['upsert']({'membername':_0x564838['name'],'UserId':_0x564838['id'],'queue_name':_0x5376c8[_0xb3fd('0x35')],'VoiceQueueId':_0x5376c8['id'],'interface':_[_0xb3fd('0x7d')](_0x564838[_0xb3fd('0x72')])?util[_0xb3fd('0x7e')](_0xb3fd('0x7f'),_0x564838['name']):_0x564838[_0xb3fd('0x72')],'paused':_0x564838[_0xb3fd('0x71')]||![],'penalty':_0x564838['penalty']},{'transaction':_0x463479});});})[_0xb3fd('0x29')](function(){_0x230beb['forEach'](function(_0xa47d43){socket[_0xb3fd('0x80')](_0xb3fd('0x81'),{'UserId':_0xa47d43['id'],'VoiceQueueId':_0x5376c8['id']});});});});});}})['then'](respondWithStatusCode(_0xa132aa,null))[_0xb3fd('0x52')](handleError(_0xa132aa,null));};exports['removeTeams']=function(_0x9788bf,_0x19a4cb,_0x5f51a2){return db[_0xb3fd('0x6f')][_0xb3fd('0x50')]({'where':{'id':_0x9788bf['query'][_0xb3fd('0x82')]},'attributes':['id'],'include':[{'model':db[_0xb3fd('0x83')],'as':_0xb3fd('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb3fd('0x29')](handleEntityNotFound(_0x19a4cb,null))[_0xb3fd('0x29')](function(_0x4b9be3){var _0x5dc78c=_[_0xb3fd('0x31')](_0x4b9be3,'id');var _0x1453cc=[];var _0x2b9400=[];var _0x5ef26b=squel[_0xb3fd('0x84')]();_0x5ef26b[_0xb3fd('0x85')]('tq.TeamId')['from']('team_has_voice_queues','tq')[_0xb3fd('0x86')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb3fd('0x49')](_0xb3fd('0x87'),_0x9788bf['params']['id']);for(var _0x43d669=0x0;_0x43d669<_0x4b9be3['length'];_0x43d669+=0x1){let _0x92bb8=_0x4b9be3[_0x43d669];for(var _0x29e5aa=0x0;_0x29e5aa<_0x92bb8[_0xb3fd('0x74')][_0xb3fd('0x47')];_0x29e5aa+=0x1){let _0x5c49e7=_0x92bb8[_0xb3fd('0x74')][_0x29e5aa];var _0xd3f381=_0x5ef26b['clone']();_0xd3f381[_0xb3fd('0x49')](_0xb3fd('0x88'),_0x5c49e7['id']);_0x2b9400[_0xb3fd('0x89')](db[_0xb3fd('0x76')][_0xb3fd('0x41')](_0xd3f381[_0xb3fd('0x8a')](),{'type':db['sequelize'][_0xb3fd('0x8b')][_0xb3fd('0x8c')]})[_0xb3fd('0x29')](function(_0x2e48d5){if(_0x2e48d5[_0xb3fd('0x47')]===0x1){return _0x5c49e7['id'];}else{var _0xdcebf4=_[_0xb3fd('0x8d')](_[_0xb3fd('0x31')](_0x2e48d5,_0xb3fd('0x8e')),function(_0x4186cd){return _['includes'](_0x5dc78c,_0x4186cd);});if(_0xdcebf4){return _0x5c49e7['id'];}}}));}}return BPromise[_0xb3fd('0x8f')](_0x2b9400)[_0xb3fd('0x29')](function(_0x281b4d){_0x1453cc=_(_0x1453cc)['union'](_0x281b4d)['compact']()[_0xb3fd('0x32')]();return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x9788bf[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](function(_0x485949){return db[_0xb3fd('0x76')][_0xb3fd('0x77')](function(_0x539886){return _0x485949[_0xb3fd('0x90')](_0x9788bf[_0xb3fd('0x41')][_0xb3fd('0x82')],{'transaction':_0x539886})[_0xb3fd('0x29')](function(){if(!_['isEmpty'](_0x1453cc)){return _0x485949['removeAgents'](_0x1453cc,{'transaction':_0x539886})[_0xb3fd('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x9788bf[_0xb3fd('0x5b')]['id'],'UserId':_0x1453cc},'transaction':_0x539886});});}})[_0xb3fd('0x29')](function(){_0x1453cc[_0xb3fd('0x75')](function(_0x362b5e){socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':_0x362b5e,'VoiceQueueId':_0x485949['id']});});});});});});})['then'](respondWithStatusCode(_0x19a4cb,null))['catch'](handleError(_0x19a4cb,null));};exports[_0xb3fd('0x92')]=function(_0x15277a,_0x40d450,_0x28854a){var _0x5c899c,_0x3f8f7a;return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x15277a[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x40d450,null))[_0xb3fd('0x29')](function(_0x1dfb09){if(_0x1dfb09){_0x3f8f7a=_0x1dfb09;return _0x1dfb09[_0xb3fd('0x92')](_0x15277a[_0xb3fd('0x54')][_0xb3fd('0x82')],_[_0xb3fd('0x5c')](_0x15277a[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{})[_0xb3fd('0x93')](function(_0x556a33){for(var _0x5a7235=0x0;_0x5a7235<_0x15277a[_0xb3fd('0x54')][_0xb3fd('0x82')][_0xb3fd('0x47')];_0x5a7235+=0x1){socket['emit'](_0xb3fd('0x81'),{'UserId':Number(_0x15277a[_0xb3fd('0x54')]['ids'][_0x5a7235]),'VoiceQueueId':Number(_0x15277a[_0xb3fd('0x5b')]['id'])});}return _0x556a33;});}})['then'](function(_0x908d92){_0x5c899c=_0x908d92||[];if(_0x3f8f7a){return db[_0xb3fd('0x83')][_0xb3fd('0x50')]({'where':{'id':_0x15277a[_0xb3fd('0x54')]['ids']},'attributes':['id',_0xb3fd('0x35'),_0xb3fd('0x70'),_0xb3fd('0x71'),_0xb3fd('0x72')],'raw':!![]});}})[_0xb3fd('0x29')](function(_0x16a324){if(!_['isEmpty'](_0x16a324)){var _0x45b085=[];for(var _0x4b79dc=0x0;_0x4b79dc<_0x16a324[_0xb3fd('0x47')];_0x4b79dc++){if(_0x16a324[_0x4b79dc]['online']){_0x45b085['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x16a324[_0x4b79dc][_0xb3fd('0x35')],'UserId':_0x16a324[_0x4b79dc]['id'],'queue_name':_0x3f8f7a['name'],'VoiceQueueId':_0x3f8f7a['id'],'interface':_[_0xb3fd('0x7d')](_0x16a324[_0x4b79dc][_0xb3fd('0x72')])?util[_0xb3fd('0x7e')](_0xb3fd('0x7f'),_0x16a324[_0x4b79dc][_0xb3fd('0x35')]):_0x16a324[_0x4b79dc][_0xb3fd('0x72')],'paused':_0x16a324[_0x4b79dc]['voicePause']||![],'penalty':_0x15277a['body']['penalty']||0x0}));}}return BPromise['all'](_0x45b085);}})[_0xb3fd('0x29')](function(){return _0x5c899c;})[_0xb3fd('0x29')](respondWithResult(_0x40d450,null))[_0xb3fd('0x52')](handleError(_0x40d450,null));};exports[_0xb3fd('0x94')]=function(_0x189d02,_0x1d8003,_0x168b10){return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x189d02['params']['id']}})['then'](handleEntityNotFound(_0x1d8003,null))[_0xb3fd('0x29')](function(_0x256597){if(_0x256597){return _0x256597[_0xb3fd('0x94')](_0x189d02[_0xb3fd('0x41')]['ids'])[_0xb3fd('0x29')](function(){if(_['isArray'](_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')])){for(var _0x36755c=0x0;_0x36755c<_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')]['length'];_0x36755c+=0x1){socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':Number(_0x189d02['query'][_0xb3fd('0x82')][_0x36755c]),'VoiceQueueId':Number(_0x189d02['params']['id'])});}}else{socket[_0xb3fd('0x80')](_0xb3fd('0x91'),{'UserId':Number(_0x189d02['query'][_0xb3fd('0x82')]),'VoiceQueueId':Number(_0x189d02[_0xb3fd('0x5b')]['id'])});}});}})[_0xb3fd('0x29')](function(_0x18324b){return db[_0xb3fd('0x7c')][_0xb3fd('0x37')]({'where':{'VoiceQueueId':_0x189d02['params']['id'],'UserId':_0x189d02[_0xb3fd('0x41')][_0xb3fd('0x82')]}})[_0xb3fd('0x29')](function(){return _0x18324b;});})[_0xb3fd('0x29')](respondWithStatusCode(_0x1d8003,null))['catch'](handleError(_0x1d8003,null));};exports['getAgents']=function(_0x10049d,_0x357612,_0x187c47){var _0x392353={};var _0x3ad565={};var _0xd1ada2;var _0x5c499a;return db['VoiceQueue'][_0xb3fd('0x61')]({'where':{'id':_0x10049d['params']['id']}})['then'](handleEntityNotFound(_0x357612,null))[_0xb3fd('0x29')](function(_0x152e5f){if(_0x152e5f){_0xd1ada2=_0x152e5f;_0x3ad565[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x83')][_0xb3fd('0x3d')]);_0x3ad565[_0xb3fd('0x41')]=_[_0xb3fd('0x42')](_0x10049d['query']);_0x3ad565[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x3ad565['model'],_0x3ad565[_0xb3fd('0x41')]);_0x392353['attributes']=_[_0xb3fd('0x44')](_0x3ad565[_0xb3fd('0x40')],qs[_0xb3fd('0x45')](_0x10049d[_0xb3fd('0x41')]['fields']));_0x392353['attributes']=_0x392353['attributes'][_0xb3fd('0x47')]?_0x392353[_0xb3fd('0x46')]:_0x3ad565[_0xb3fd('0x40')];_0x392353[_0xb3fd('0x48')]=qs['sort'](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x392353[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x10049d[_0xb3fd('0x41')],_0x3ad565[_0xb3fd('0x43')]));if(_0x10049d[_0xb3fd('0x41')]['filter']){_0x392353[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x392353[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x392353[_0xb3fd('0x46')],function(_0x59f024){var _0x2cc91b={};_0x2cc91b[_0x59f024]={'$like':'%'+_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x2cc91b;})});}_0x392353=_[_0xb3fd('0x4b')]({},_0x392353,_0x10049d['options']);return _0xd1ada2[_0xb3fd('0x95')](_0x392353);}})[_0xb3fd('0x29')](function(_0x378bf8){if(_0x378bf8){_0x5c499a=_0x378bf8[_0xb3fd('0x47')];if(!_0x10049d[_0xb3fd('0x41')]['hasOwnProperty']('nolimit')){_0x392353[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x392353[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x10049d[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0xd1ada2[_0xb3fd('0x95')](_0x392353);}})['then'](function(_0x3be443){if(_0x3be443){return _0x3be443?{'count':_0x5c499a,'rows':_0x3be443}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x357612,null))['catch'](handleError(_0x357612,null));};exports[_0xb3fd('0x96')]=function(_0x29ad66,_0x270fbe,_0x3dcca2){var _0x43f3e3={};var _0x1c9cd6={};var _0x4d9185;var _0x2a9621;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x29ad66[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x270fbe,null))[_0xb3fd('0x29')](function(_0x52e6a3){if(_0x52e6a3){_0x4d9185=_0x52e6a3;_0x1c9cd6[_0xb3fd('0x40')]=_['keys'](db[_0xb3fd('0x7c')][_0xb3fd('0x3d')]);_0x1c9cd6['query']=_[_0xb3fd('0x42')](_0x29ad66['query']);_0x1c9cd6['filters']=_[_0xb3fd('0x44')](_0x1c9cd6[_0xb3fd('0x40')],_0x1c9cd6[_0xb3fd('0x41')]);_0x43f3e3[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x1c9cd6['model'],qs[_0xb3fd('0x45')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x43f3e3[_0xb3fd('0x46')]=_0x43f3e3[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x43f3e3['attributes']:_0x1c9cd6[_0xb3fd('0x40')];_0x43f3e3[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x29ad66[_0xb3fd('0x41')]['sort']);_0x43f3e3[_0xb3fd('0x49')]=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x29ad66[_0xb3fd('0x41')],_0x1c9cd6['filters']));if(_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x2f')]){_0x43f3e3['where']=_[_0xb3fd('0x4b')](_0x43f3e3[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x43f3e3[_0xb3fd('0x46')],function(_0x16d680){var _0x2fecf9={};_0x2fecf9[_0x16d680]={'$like':'%'+_0x29ad66['query']['filter']+'%'};return _0x2fecf9;})});}_0x43f3e3=_[_0xb3fd('0x4b')]({},_0x43f3e3,_0x29ad66[_0xb3fd('0x4d')]);return _0x4d9185[_0xb3fd('0x96')](_0x43f3e3);}})[_0xb3fd('0x29')](function(_0x54a8ff){if(_0x54a8ff){_0x2a9621=_0x54a8ff[_0xb3fd('0x47')];if(!_0x29ad66['query'][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x43f3e3[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x43f3e3[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x29ad66[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x4d9185[_0xb3fd('0x96')](_0x43f3e3);}})[_0xb3fd('0x29')](function(_0x96ed60){return _0x96ed60?{'count':_0x2a9621,'rows':_0x96ed60}:null;})[_0xb3fd('0x29')](respondWithResult(_0x270fbe,null))[_0xb3fd('0x52')](handleError(_0x270fbe,null));};exports[_0xb3fd('0x97')]=function(_0x189094,_0x15e6c7,_0xb5fd96){var _0x374740={};var _0x26466e={};var _0x1e65fb;var _0x47c8f7;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x189094[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x15e6c7,null))[_0xb3fd('0x29')](function(_0x252460){if(_0x252460){_0x1e65fb=_0x252460;_0x26466e[_0xb3fd('0x40')]=_[_0xb3fd('0x42')](db[_0xb3fd('0x98')][_0xb3fd('0x3d')]);_0x26466e['query']=_[_0xb3fd('0x42')](_0x189094[_0xb3fd('0x41')]);_0x26466e['filters']=_[_0xb3fd('0x44')](_0x26466e[_0xb3fd('0x40')],_0x26466e['query']);_0x374740[_0xb3fd('0x46')]=_[_0xb3fd('0x44')](_0x26466e['model'],qs[_0xb3fd('0x45')](_0x189094[_0xb3fd('0x41')]['fields']));_0x374740[_0xb3fd('0x46')]=_0x374740[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x374740[_0xb3fd('0x46')]:_0x26466e[_0xb3fd('0x40')];_0x374740[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x189094[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x374740['where']=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x189094[_0xb3fd('0x41')],_0x26466e[_0xb3fd('0x43')]));if(_0x189094[_0xb3fd('0x41')]['filter']){_0x374740[_0xb3fd('0x49')]=_['merge'](_0x374740[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x374740['attributes'],function(_0x5230fe){var _0x38c996={};_0x38c996[_0x5230fe]={'$like':'%'+_0x189094[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x38c996;})});}_0x374740=_[_0xb3fd('0x4b')]({},_0x374740,_0x189094[_0xb3fd('0x4d')]);return _0x1e65fb[_0xb3fd('0x97')](_0x374740);}})[_0xb3fd('0x29')](function(_0x4164c6){if(_0x4164c6){_0x47c8f7=_0x4164c6[_0xb3fd('0x47')];if(!_0x189094[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x374740[_0xb3fd('0x20')]=qs[_0xb3fd('0x20')](_0x189094['query'][_0xb3fd('0x20')]);_0x374740[_0xb3fd('0x1f')]=qs[_0xb3fd('0x1f')](_0x189094[_0xb3fd('0x41')][_0xb3fd('0x1f')]);}return _0x1e65fb[_0xb3fd('0x97')](_0x374740);}})['then'](function(_0x5afd00){if(_0x5afd00){return _0x5afd00?{'count':_0x47c8f7,'rows':_0x5afd00}:null;}})[_0xb3fd('0x29')](respondWithResult(_0x15e6c7,null))['catch'](handleError(_0x15e6c7,null));};exports[_0xb3fd('0x99')]=function(_0x45b62a,_0x475183,_0x49a16a){var _0xd8da4,_0x433675;return db['VoiceQueue'][_0xb3fd('0x34')]({'where':{'id':_0x45b62a['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x475183,null))[_0xb3fd('0x29')](function(_0xd23a50){if(_0xd23a50){_0x433675=_0xd23a50;return _0xd23a50[_0xb3fd('0x99')](_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x82')],_[_0xb3fd('0x5c')](_0x45b62a[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{});}return null;})['spread'](function(_0x12d55b){var _0xb343c;_0xd8da4=_0x12d55b||[];var _0x335ed8=[];if(_0x12d55b){for(var _0x9d0ef3=0x0;_0x9d0ef3<_0x12d55b[_0xb3fd('0x47')];_0x9d0ef3+=0x1){var _0x458cfc=_0x12d55b[_0x9d0ef3][_0xb3fd('0x2a')]({'plain':!![]});_0x433675[_0xb3fd('0x9a')]=_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x9a')]?_0x45b62a[_0xb3fd('0x54')][_0xb3fd('0x9a')]:_0x433675[_0xb3fd('0x9a')];switch(_0x433675[_0xb3fd('0x9a')]){case _0xb3fd('0x9b'):_0xb343c=squel[_0xb3fd('0x9c')]()[_0xb3fd('0x9d')](_0xb3fd('0x9e'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),'ListId',_0xb3fd('0x65'),_0xb3fd('0x5e'),_0xb3fd('0x5d')],squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0xa1'))['field']('id',_0xb3fd('0xa2'))['field'](_0x458cfc[_0xb3fd('0xa4')]['toString'](),_0xb3fd('0xa5'))[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))['field'](_0xb3fd('0xa3'),'createdAt')[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))['where'](_0xb3fd('0xa7'))['where'](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')]['toString']())['where'](_0xb3fd('0xa9'))[_0xb3fd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb3fd('0x84')]()['field'](_0xb3fd('0xaa'))[_0xb3fd('0xab')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x45b62a['params']['id'][_0xb3fd('0x8a')]()))[_0xb3fd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xac'))[_0xb3fd('0xab')](_0xb3fd('0x9e'))[_0xb3fd('0x49')](_0xb3fd('0x87'),_0x45b62a['params']['id'][_0xb3fd('0x8a')]())))['toString']();break;case _0xb3fd('0xad'):_0xb343c=squel[_0xb3fd('0x9c')]()[_0xb3fd('0x9d')]('cm_hopper')[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel['select']()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0xa1'))[_0xb3fd('0x85')]('id',_0xb3fd('0xa2'))[_0xb3fd('0x85')](_0x458cfc[_0xb3fd('0xa4')][_0xb3fd('0x8a')](),'ListId')[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5e'))['field']('NOW()',_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))[_0xb3fd('0x49')](_0xb3fd('0xa7'))[_0xb3fd('0x49')](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')][_0xb3fd('0x8a')]())[_0xb3fd('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xb3fd('0x49')](_0xb3fd('0xae'),squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xac'))[_0xb3fd('0xab')](_0xb3fd('0x9e'))[_0xb3fd('0x49')]('VoiceQueueId\x20=\x20?',_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')]())))[_0xb3fd('0x8a')]();break;default:_0xb343c=squel['insert']()[_0xb3fd('0x9d')](_0xb3fd('0x9e'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa1'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel[_0xb3fd('0x84')]()['field'](_0xb3fd('0xa0'),'phone')[_0xb3fd('0x85')](_0xb3fd('0xa3'),'scheduledAt')[_0xb3fd('0x85')]('id','ContactId')[_0xb3fd('0x85')](_0x458cfc[_0xb3fd('0xa4')]['toString'](),'ListId')[_0xb3fd('0x85')](_0x45b62a[_0xb3fd('0x5b')]['id'][_0xb3fd('0x8a')](),_0xb3fd('0x65'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5e'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))[_0xb3fd('0xab')](_0xb3fd('0xa6'))[_0xb3fd('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0xb3fd('0xa8'),_0x458cfc[_0xb3fd('0xa4')]['toString']())[_0xb3fd('0x49')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x335ed8[_0xb3fd('0x89')](db['sequelize'][_0xb3fd('0x41')](_0xb343c));}return BPromise[_0xb3fd('0x8f')](_0x335ed8);}})['then'](function(){return _0xd8da4;})[_0xb3fd('0x29')](respondWithResult(_0x475183,null))[_0xb3fd('0x52')](handleError(_0x475183,null));};exports['removeLists']=function(_0x1177cc,_0x17ad48,_0x6d049e){return db['VoiceQueue']['find']({'where':{'id':_0x1177cc[_0xb3fd('0x5b')]['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x17ad48,null))[_0xb3fd('0x29')](function(_0x23e58e){if(_0x23e58e){return _0x23e58e['removeLists'](_0x1177cc['query'][_0xb3fd('0x82')]);}})[_0xb3fd('0x29')](function(_0x3b696b){if(_0x3b696b){return db[_0xb3fd('0x66')][_0xb3fd('0x37')]({'where':{'ListId':_0x1177cc[_0xb3fd('0x41')]['ids'],'VoiceQueueId':_0x1177cc['params']['id']}})[_0xb3fd('0x29')](function(){return _0x3b696b;});}})[_0xb3fd('0x29')](respondWithStatusCode(_0x17ad48,null))[_0xb3fd('0x52')](handleError(_0x17ad48,null));};exports[_0xb3fd('0xaf')]=function(_0x42dde0,_0xc82fa5,_0x2776ff){var _0x184399={};var _0x44fee2={};var _0x264819;var _0x30af0f;return db[_0xb3fd('0x3c')][_0xb3fd('0x61')]({'where':{'id':_0x42dde0[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc82fa5,null))[_0xb3fd('0x29')](function(_0x1b76ff){if(_0x1b76ff){_0x264819=_0x1b76ff;_0x44fee2[_0xb3fd('0x40')]=_['keys'](db[_0xb3fd('0x98')][_0xb3fd('0x3d')]);_0x44fee2[_0xb3fd('0x41')]=_['keys'](_0x42dde0[_0xb3fd('0x41')]);_0x44fee2[_0xb3fd('0x43')]=_[_0xb3fd('0x44')](_0x44fee2[_0xb3fd('0x40')],_0x44fee2[_0xb3fd('0x41')]);_0x184399['attributes']=_['intersection'](_0x44fee2['model'],qs[_0xb3fd('0x45')](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x45')]));_0x184399[_0xb3fd('0x46')]=_0x184399[_0xb3fd('0x46')][_0xb3fd('0x47')]?_0x184399[_0xb3fd('0x46')]:_0x44fee2['model'];_0x184399[_0xb3fd('0x48')]=qs[_0xb3fd('0x64')](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x64')]);_0x184399['where']=qs[_0xb3fd('0x43')](_[_0xb3fd('0x4a')](_0x42dde0[_0xb3fd('0x41')],_0x44fee2[_0xb3fd('0x43')]));if(_0x42dde0[_0xb3fd('0x41')]['filter']){_0x184399[_0xb3fd('0x49')]=_[_0xb3fd('0x4b')](_0x184399[_0xb3fd('0x49')],{'$or':_[_0xb3fd('0x31')](_0x184399[_0xb3fd('0x46')],function(_0x448210){var _0x95eb46={};_0x95eb46[_0x448210]={'$like':'%'+_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x2f')]+'%'};return _0x95eb46;})});}_0x184399=_[_0xb3fd('0x4b')]({},_0x184399,_0x42dde0[_0xb3fd('0x4d')]);return _0x264819[_0xb3fd('0xaf')](_0x184399);}})[_0xb3fd('0x29')](function(_0x559e77){if(_0x559e77){_0x30af0f=_0x559e77[_0xb3fd('0x47')];if(!_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x62')](_0xb3fd('0x63'))){_0x184399[_0xb3fd('0x20')]=qs['limit'](_0x42dde0[_0xb3fd('0x41')][_0xb3fd('0x20')]);_0x184399[_0xb3fd('0x1f')]=qs['offset'](_0x42dde0['query'][_0xb3fd('0x1f')]);}return _0x264819[_0xb3fd('0xaf')](_0x184399);}})['then'](function(_0x5d0ea5){if(_0x5d0ea5){return _0x5d0ea5?{'count':_0x30af0f,'rows':_0x5d0ea5}:null;}})['then'](respondWithResult(_0xc82fa5,null))[_0xb3fd('0x52')](handleError(_0xc82fa5,null));};exports[_0xb3fd('0xb0')]=function(_0x31b06d,_0x424872,_0x16896c){var _0x424194,_0x5498bc;return db[_0xb3fd('0x3c')][_0xb3fd('0x34')]({'where':{'id':_0x31b06d[_0xb3fd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x424872,null))[_0xb3fd('0x29')](function(_0xe28ee2){if(_0xe28ee2){_0x5498bc=_0xe28ee2;return _0xe28ee2[_0xb3fd('0xb0')](_0x31b06d[_0xb3fd('0x54')]['ids'],_['omit'](_0x31b06d[_0xb3fd('0x54')],[_0xb3fd('0x82'),'id'])||{});}return null;})['spread'](function(_0x51765e){var _0x2cc5e5;_0x424194=_0x51765e||[];var _0x5cf9ea=[];if(_0x51765e){for(var _0x486275=0x0;_0x486275<_0x51765e[_0xb3fd('0x47')];_0x486275+=0x1){var _0x31d2dc=_0x51765e[_0x486275][_0xb3fd('0x2a')]({'plain':!![]});_0x2cc5e5=squel['insert']()[_0xb3fd('0x9d')](_0xb3fd('0xb1'))[_0xb3fd('0x9f')]([_0xb3fd('0xa0'),_0xb3fd('0xa2'),_0xb3fd('0xa5'),_0xb3fd('0x65'),_0xb3fd('0x5e'),'updatedAt'],squel[_0xb3fd('0x84')]()[_0xb3fd('0x85')](_0xb3fd('0xa0'),_0xb3fd('0xa0'))[_0xb3fd('0x85')]('id','ContactId')[_0xb3fd('0x85')](_0x31d2dc[_0xb3fd('0xa4')][_0xb3fd('0x8a')](),_0xb3fd('0xa5'))[_0xb3fd('0x85')](_0x31b06d['params']['id']['toString'](),_0xb3fd('0x65'))['field'](_0xb3fd('0xa3'),_0xb3fd('0x5e'))[_0xb3fd('0x85')](_0xb3fd('0xa3'),_0xb3fd('0x5d'))['from'](_0xb3fd('0xa6'))[_0xb3fd('0x49')](_0xb3fd('0xa7'))[_0xb3fd('0x49')](_0xb3fd('0xa8'),_0x31d2dc[_0xb3fd('0xa4')][_0xb3fd('0x8a')]())['where'](_0xb3fd('0xa9')))[_0xb3fd('0x8a')]();_0x5cf9ea[_0xb3fd('0x89')](db['sequelize'][_0xb3fd('0x41')](_0x2cc5e5));}return BPromise[_0xb3fd('0x8f')](_0x5cf9ea);}})[_0xb3fd('0x29')](function(){return _0x424194;})[_0xb3fd('0x29')](respondWithResult(_0x424872,null))[_0xb3fd('0x52')](handleError(_0x424872,null));};exports[_0xb3fd('0xb2')]=function(_0x24cf2f,_0x2a9343,_0x289c50){return db[_0xb3fd('0x3c')]['find']({'where':{'id':_0x24cf2f['params']['id']}})[_0xb3fd('0x29')](handleEntityNotFound(_0x2a9343,null))[_0xb3fd('0x29')](function(_0x532664){if(_0x532664){return _0x532664[_0xb3fd('0xb2')](_0x24cf2f[_0xb3fd('0x41')][_0xb3fd('0x82')]);}})[_0xb3fd('0x29')](function(_0xe1d190){if(_0xe1d190){return db[_0xb3fd('0x6c')][_0xb3fd('0x37')]({'where':{'ListId':_0x24cf2f['query'][_0xb3fd('0x82')],'VoiceQueueId':_0x24cf2f['params']['id']}})['then'](function(){return _0xe1d190;});}})[_0xb3fd('0x29')](respondWithStatusCode(_0x2a9343,null))[_0xb3fd('0x52')](handleError(_0x2a9343,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5bd8246..f5b827e 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 _0xc50f=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','save','update','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xc50f,0x112));var _0xfc50=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc50f[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0xfc50('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xfc50('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc50('0x2'),'afterUpdate':_0xfc50('0x3'),'afterDestroy':_0xfc50('0x4')};function emitEvent(_0x4cb93a){return function(_0x50ab24,_0x12ed1c,_0x102219){VoiceQueueEvents[_0xfc50('0x5')](_0x4cb93a+':'+_0x50ab24['id'],_0x50ab24);VoiceQueueEvents[_0xfc50('0x5')](_0x4cb93a,_0x50ab24);_0x102219(null);};}for(var e in events){if(events[_0xfc50('0x6')](e)){var event=events[e];VoiceQueue[_0xfc50('0x7')](e,emitEvent(event));}}module[_0xfc50('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x94bc=['save','remove','emit','hasOwnProperty','hook','events','VoiceQueue','setMaxListeners'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x94bc,0x7d));var _0xc94b=function(_0x21dc70,_0x287214){_0x21dc70=_0x21dc70-0x0;var _0x47e638=_0x94bc[_0x21dc70];return _0x47e638;};'use strict';var EventEmitter=require(_0xc94b('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xc94b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc94b('0x2')](0x0);var events={'afterCreate':_0xc94b('0x3'),'afterUpdate':'update','afterDestroy':_0xc94b('0x4')};function emitEvent(_0x1ffbb2){return function(_0x5e9906,_0x331e5d,_0x44c6e5){VoiceQueueEvents[_0xc94b('0x5')](_0x1ffbb2+':'+_0x5e9906['id'],_0x5e9906);VoiceQueueEvents[_0xc94b('0x5')](_0x1ffbb2,_0x5e9906);_0x44c6e5(null);};}for(var e in events){if(events[_0xc94b('0x6')](e)){var event=events[e];VoiceQueue[_0xc94b('0x7')](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 eb49dc8..9dc48d5 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x27d5a5,_0x5de4e5){var _0x2c6fb1=function(_0x4bbf34){while(--_0x4bbf34){_0x27d5a5['push'](_0x27d5a5['shift']());}};_0x2c6fb1(++_0x5de4e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x44135b,_0x282444){var _0x1aa4f5=function(_0x8bc71){while(--_0x8bc71){_0x44135b['push'](_0x44135b['shift']());}};_0x1aa4f5(++_0x282444);}(_0x70e0,0x17b));var _0x070e=function(_0x46b409,_0x38aae7){_0x46b409=_0x46b409-0x0;var _0xec458d=_0x70e0[_0x46b409];return _0xec458d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 822b4b4..0c2cb9d 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 _0x73ba=['then','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','limit','include','map','model','attributes','VoiceQueue','find','where','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register','request'];(function(_0x8de88f,_0x53b4a0){var _0xad1a2f=function(_0x3d3a91){while(--_0x3d3a91){_0x8de88f['push'](_0x8de88f['shift']());}};_0xad1a2f(++_0x53b4a0);}(_0x73ba,0x108));var _0xa73b=function(_0x5f3fb8,_0x11d45a){_0x5f3fb8=_0x5f3fb8-0x0;var _0x18f457=_0x73ba[_0x5f3fb8];return _0x18f457;};'use strict';var _=require(_0xa73b('0x0'));var util=require(_0xa73b('0x1'));var moment=require('moment');var BPromise=require(_0xa73b('0x2'));var rs=require(_0xa73b('0x3'));var fs=require('fs');var Redis=require(_0xa73b('0x4'));var db=require(_0xa73b('0x5'))['db'];var utils=require(_0xa73b('0x6'));var logger=require(_0xa73b('0x7'))(_0xa73b('0x8'));var config=require(_0xa73b('0x9'));var jayson=require(_0xa73b('0xa'));var client=jayson[_0xa73b('0xb')][_0xa73b('0xc')]({'port':0x232a});config[_0xa73b('0xd')]=_['defaults'](config[_0xa73b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa73b('0xd')]));require('./voiceQueue.socket')[_0xa73b('0xe')](socket);function respondWithRpcPromise(_0x2fd525,_0x4d0926,_0x4c6767){return new BPromise(function(_0xf94ff4,_0x1530fa){return client[_0xa73b('0xf')](_0x2fd525,_0x4c6767)[_0xa73b('0x10')](function(_0x31ff9b){logger[_0xa73b('0x11')](_0xa73b('0x12'),_0x4d0926,'request\x20sent');logger[_0xa73b('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4d0926,_0xa73b('0x14'),JSON[_0xa73b('0x15')](_0x31ff9b));if(_0x31ff9b[_0xa73b('0x16')]){if(_0x31ff9b[_0xa73b('0x16')][_0xa73b('0x17')]===0x1f4){logger[_0xa73b('0x16')](_0xa73b('0x12'),_0x4d0926,_0x31ff9b[_0xa73b('0x16')][_0xa73b('0x18')]);return _0x1530fa(_0x31ff9b[_0xa73b('0x16')][_0xa73b('0x18')]);}logger['error'](_0xa73b('0x12'),_0x4d0926,_0x31ff9b[_0xa73b('0x16')]['message']);return _0xf94ff4(_0x31ff9b[_0xa73b('0x16')][_0xa73b('0x18')]);}else{logger[_0xa73b('0x11')](_0xa73b('0x12'),_0x4d0926,'request\x20sent');_0xf94ff4(_0x31ff9b[_0xa73b('0x19')][_0xa73b('0x18')]);}})[_0xa73b('0x1a')](function(_0xaf70e4){logger[_0xa73b('0x16')](_0xa73b('0x12'),_0x4d0926,_0xaf70e4);_0x1530fa(_0xaf70e4);});});}exports[_0xa73b('0x1b')]=function(_0x1a312b){var _0xb785f6=this;return new Promise(function(_0x2efb2b,_0x12a8a3){return db['VoiceQueue'][_0xa73b('0x1c')]({'raw':_0x1a312b[_0xa73b('0x1d')]?_0x1a312b[_0xa73b('0x1d')][_0xa73b('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a312b[_0xa73b('0x1d')]?_0x1a312b[_0xa73b('0x1d')]['where']||null:null,'attributes':_0x1a312b[_0xa73b('0x1d')]?_0x1a312b['options']['attributes']||null:null,'limit':_0x1a312b[_0xa73b('0x1d')]?_0x1a312b[_0xa73b('0x1d')][_0xa73b('0x1f')]||null:null,'include':_0x1a312b[_0xa73b('0x1d')]?_0x1a312b[_0xa73b('0x1d')][_0xa73b('0x20')]?_[_0xa73b('0x21')](_0x1a312b[_0xa73b('0x1d')][_0xa73b('0x20')],function(_0x183097){return{'model':db[_0x183097[_0xa73b('0x22')]],'as':_0x183097['as'],'attributes':_0x183097[_0xa73b('0x23')],'include':_0x183097['include']?_['map'](_0x183097['include'],function(_0x16c11c){return{'model':db[_0x16c11c['model']],'as':_0x16c11c['as'],'attributes':_0x16c11c[_0xa73b('0x23')],'include':_0x16c11c[_0xa73b('0x20')]?_[_0xa73b('0x21')](_0x16c11c[_0xa73b('0x20')],function(_0x12c58d){return{'model':db[_0x12c58d[_0xa73b('0x22')]],'as':_0x12c58d['as'],'attributes':_0x12c58d[_0xa73b('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa73b('0x10')](function(_0x9bb5b9){logger[_0xa73b('0x11')](_0xa73b('0x1b'),_0x1a312b);logger[_0xa73b('0x13')](_0xa73b('0x1b'),_0x1a312b,JSON[_0xa73b('0x15')](_0x9bb5b9));_0x2efb2b(_0x9bb5b9);})[_0xa73b('0x1a')](function(_0x34395e){logger['error'](_0xa73b('0x1b'),_0x34395e[_0xa73b('0x18')],_0x1a312b);_0x12a8a3(_0xb785f6['error'](0x1f4,_0x34395e['message']));});});};exports['ShowVoiceQueue']=function(_0x353fce){var _0x5c8cb8=this;return new Promise(function(_0x38685d,_0x46d8e0){return db[_0xa73b('0x24')][_0xa73b('0x25')]({'raw':_0x353fce['options']?_0x353fce[_0xa73b('0x1d')][_0xa73b('0x1e')]===undefined?!![]:![]:!![],'where':_0x353fce[_0xa73b('0x1d')]?_0x353fce['options'][_0xa73b('0x26')]||null:null,'attributes':_0x353fce[_0xa73b('0x1d')]?_0x353fce[_0xa73b('0x1d')][_0xa73b('0x23')]||null:null,'include':_0x353fce[_0xa73b('0x1d')]?_0x353fce[_0xa73b('0x1d')][_0xa73b('0x20')]?_[_0xa73b('0x21')](_0x353fce[_0xa73b('0x1d')][_0xa73b('0x20')],function(_0x304a71){return{'model':db[_0x304a71[_0xa73b('0x22')]],'as':_0x304a71['as'],'attributes':_0x304a71[_0xa73b('0x23')],'include':_0x304a71[_0xa73b('0x20')]?_['map'](_0x304a71[_0xa73b('0x20')],function(_0x35c3ec){return{'model':db[_0x35c3ec[_0xa73b('0x22')]],'as':_0x35c3ec['as'],'attributes':_0x35c3ec[_0xa73b('0x23')],'include':_0x35c3ec[_0xa73b('0x20')]?_[_0xa73b('0x21')](_0x35c3ec['include'],function(_0x3bf26f){return{'model':db[_0x3bf26f['model']],'as':_0x3bf26f['as'],'attributes':_0x3bf26f[_0xa73b('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa73b('0x10')](function(_0x316018){logger[_0xa73b('0x11')](_0xa73b('0x27'),_0x353fce);logger[_0xa73b('0x13')](_0xa73b('0x27'),_0x353fce,JSON[_0xa73b('0x15')](_0x316018));_0x38685d(_0x316018);})[_0xa73b('0x1a')](function(_0x2fd58c){logger['error'](_0xa73b('0x27'),_0x2fd58c[_0xa73b('0x18')],_0x353fce);_0x46d8e0(_0x5c8cb8[_0xa73b('0x16')](0x1f4,_0x2fd58c[_0xa73b('0x18')]));});});}; \ No newline at end of file +var _0xd31d=['defaults','localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','map','model','then','ShowVoiceQueue','find','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd31d,0x143));var _0xdd31=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0xd31d[_0x513047];return _0x15b779;};'use strict';var _=require('lodash');var util=require(_0xdd31('0x0'));var moment=require(_0xdd31('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd31('0x2'));var fs=require('fs');var Redis=require(_0xdd31('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd31('0x4'));var logger=require(_0xdd31('0x5'))(_0xdd31('0x6'));var config=require(_0xdd31('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd31('0x8')]['http']({'port':0x232a});config[_0xdd31('0x9')]=_[_0xdd31('0xa')](config[_0xdd31('0x9')],{'host':_0xdd31('0xb'),'port':0x18eb});var socket=require(_0xdd31('0xc'))(new Redis(config[_0xdd31('0x9')]));require('./voiceQueue.socket')[_0xdd31('0xd')](socket);function respondWithRpcPromise(_0x5aba99,_0x107af6,_0x1fc40f){return new BPromise(function(_0xe56a54,_0x4e7b9d){return client[_0xdd31('0xe')](_0x5aba99,_0x1fc40f)['then'](function(_0x38f155){logger[_0xdd31('0xf')](_0xdd31('0x10'),_0x107af6,_0xdd31('0x11'));logger[_0xdd31('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x107af6,_0xdd31('0x11'),JSON[_0xdd31('0x13')](_0x38f155));if(_0x38f155[_0xdd31('0x14')]){if(_0x38f155[_0xdd31('0x14')]['code']===0x1f4){logger[_0xdd31('0x14')](_0xdd31('0x10'),_0x107af6,_0x38f155['error'][_0xdd31('0x15')]);return _0x4e7b9d(_0x38f155[_0xdd31('0x14')][_0xdd31('0x15')]);}logger[_0xdd31('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x107af6,_0x38f155['error'][_0xdd31('0x15')]);return _0xe56a54(_0x38f155['error']['message']);}else{logger[_0xdd31('0xf')](_0xdd31('0x10'),_0x107af6,_0xdd31('0x11'));_0xe56a54(_0x38f155[_0xdd31('0x16')][_0xdd31('0x15')]);}})[_0xdd31('0x17')](function(_0x1f53e4){logger[_0xdd31('0x14')](_0xdd31('0x10'),_0x107af6,_0x1f53e4);_0x4e7b9d(_0x1f53e4);});});}exports[_0xdd31('0x18')]=function(_0x86d3af){var _0x133b18=this;return new Promise(function(_0x3c4e0a,_0x1a5133){return db[_0xdd31('0x19')]['findAll']({'raw':_0x86d3af[_0xdd31('0x1a')]?_0x86d3af[_0xdd31('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x86d3af[_0xdd31('0x1a')]?_0x86d3af['options'][_0xdd31('0x1b')]||null:null,'attributes':_0x86d3af['options']?_0x86d3af[_0xdd31('0x1a')][_0xdd31('0x1c')]||null:null,'limit':_0x86d3af[_0xdd31('0x1a')]?_0x86d3af[_0xdd31('0x1a')][_0xdd31('0x1d')]||null:null,'include':_0x86d3af['options']?_0x86d3af['options'][_0xdd31('0x1e')]?_[_0xdd31('0x1f')](_0x86d3af['options'][_0xdd31('0x1e')],function(_0x10749e){return{'model':db[_0x10749e[_0xdd31('0x20')]],'as':_0x10749e['as'],'attributes':_0x10749e[_0xdd31('0x1c')],'include':_0x10749e[_0xdd31('0x1e')]?_['map'](_0x10749e[_0xdd31('0x1e')],function(_0xc5a6d2){return{'model':db[_0xc5a6d2[_0xdd31('0x20')]],'as':_0xc5a6d2['as'],'attributes':_0xc5a6d2[_0xdd31('0x1c')],'include':_0xc5a6d2[_0xdd31('0x1e')]?_[_0xdd31('0x1f')](_0xc5a6d2[_0xdd31('0x1e')],function(_0x5f51e1){return{'model':db[_0x5f51e1[_0xdd31('0x20')]],'as':_0x5f51e1['as'],'attributes':_0x5f51e1[_0xdd31('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdd31('0x21')](function(_0x2fe101){logger['info'](_0xdd31('0x18'),_0x86d3af);logger[_0xdd31('0x12')]('GetVoiceQueue',_0x86d3af,JSON[_0xdd31('0x13')](_0x2fe101));_0x3c4e0a(_0x2fe101);})['catch'](function(_0x1cba41){logger[_0xdd31('0x14')](_0xdd31('0x18'),_0x1cba41['message'],_0x86d3af);_0x1a5133(_0x133b18['error'](0x1f4,_0x1cba41['message']));});});};exports[_0xdd31('0x22')]=function(_0x473c76){var _0x59faba=this;return new Promise(function(_0x4ad2e0,_0x50e148){return db[_0xdd31('0x19')][_0xdd31('0x23')]({'raw':_0x473c76[_0xdd31('0x1a')]?_0x473c76[_0xdd31('0x1a')][_0xdd31('0x24')]===undefined?!![]:![]:!![],'where':_0x473c76['options']?_0x473c76[_0xdd31('0x1a')][_0xdd31('0x1b')]||null:null,'attributes':_0x473c76['options']?_0x473c76[_0xdd31('0x1a')][_0xdd31('0x1c')]||null:null,'include':_0x473c76[_0xdd31('0x1a')]?_0x473c76[_0xdd31('0x1a')]['include']?_[_0xdd31('0x1f')](_0x473c76['options'][_0xdd31('0x1e')],function(_0x284e0c){return{'model':db[_0x284e0c['model']],'as':_0x284e0c['as'],'attributes':_0x284e0c['attributes'],'include':_0x284e0c[_0xdd31('0x1e')]?_['map'](_0x284e0c[_0xdd31('0x1e')],function(_0x2da90e){return{'model':db[_0x2da90e[_0xdd31('0x20')]],'as':_0x2da90e['as'],'attributes':_0x2da90e[_0xdd31('0x1c')],'include':_0x2da90e['include']?_[_0xdd31('0x1f')](_0x2da90e[_0xdd31('0x1e')],function(_0x17d3fa){return{'model':db[_0x17d3fa[_0xdd31('0x20')]],'as':_0x17d3fa['as'],'attributes':_0x17d3fa[_0xdd31('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdd31('0x21')](function(_0x258891){logger[_0xdd31('0xf')](_0xdd31('0x22'),_0x473c76);logger['debug']('ShowVoiceQueue',_0x473c76,JSON[_0xdd31('0x13')](_0x258891));_0x4ad2e0(_0x258891);})[_0xdd31('0x17')](function(_0x57699c){logger[_0xdd31('0x14')](_0xdd31('0x22'),_0x57699c[_0xdd31('0x15')],_0x473c76);_0x50e148(_0x59faba['error'](0x1f4,_0x57699c[_0xdd31('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 65716ce..e75618d 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 _0x1803=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x1cb6d5,_0x4d3dd7){var _0x12b134=function(_0x3ea4c1){while(--_0x3ea4c1){_0x1cb6d5['push'](_0x1cb6d5['shift']());}};_0x12b134(++_0x4d3dd7);}(_0x1803,0x72));var _0x3180=function(_0x3e16b6,_0x2dbc3c){_0x3e16b6=_0x3e16b6-0x0;var _0x1b9624=_0x1803[_0x3e16b6];return _0x1b9624;};'use strict';var VoiceQueueEvents=require(_0x3180('0x0'));var events=[_0x3180('0x1'),_0x3180('0x2'),_0x3180('0x3')];function createListener(_0x340e5c,_0x2ed1b6){return function(_0x49788c){_0x2ed1b6[_0x3180('0x4')](_0x340e5c,_0x49788c);};}function removeListener(_0x43e30e,_0x412adc){return function(){VoiceQueueEvents[_0x3180('0x5')](_0x43e30e,_0x412adc);};}exports[_0x3180('0x6')]=function(_0x33a797){for(var _0x176672=0x0,_0x1fba52=events[_0x3180('0x7')];_0x176672<_0x1fba52;_0x176672++){var _0x1f1b87=events[_0x176672];var _0x6c8780=createListener(_0x3180('0x8')+_0x1f1b87,_0x33a797);VoiceQueueEvents['on'](_0x1f1b87,_0x6c8780);}}; \ No newline at end of file +var _0x70e7=['emit','removeListener','register','length','voiceQueue:','save','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e7,0xc9));var _0x770e=function(_0x5e8909,_0x251263){_0x5e8909=_0x5e8909-0x0;var _0x12528d=_0x70e7[_0x5e8909];return _0x12528d;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x770e('0x0'),'remove',_0x770e('0x1')];function createListener(_0x2b908b,_0x52a846){return function(_0x2e2836){_0x52a846[_0x770e('0x2')](_0x2b908b,_0x2e2836);};}function removeListener(_0x115c50,_0x54fb5e){return function(){VoiceQueueEvents[_0x770e('0x3')](_0x115c50,_0x54fb5e);};}exports[_0x770e('0x4')]=function(_0xf7951e){for(var _0x15d455=0x0,_0x1b2794=events[_0x770e('0x5')];_0x15d455<_0x1b2794;_0x15d455++){var _0x2d24ff=events[_0x15d455];var _0x5b8a81=createListener(_0x770e('0x6')+_0x2d24ff,_0xf7951e);VoiceQueueEvents['on'](_0x2d24ff,_0x5b8a81);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c42e648..bc1a1a3 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 _0x8280=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','/index','isAuthenticated','/:id','show','post','update','delete','exports','multer'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0x8280,0x84));var _0x0828=function(_0x4e59de,_0x3d31bd){_0x4e59de=_0x4e59de-0x0;var _0x14b337=_0x8280[_0x4e59de];return _0x14b337;};'use strict';var multer=require(_0x0828('0x0'));var util=require(_0x0828('0x1'));var path=require('path');var timeout=require(_0x0828('0x2'));var express=require('express');var router=express[_0x0828('0x3')]();var fs_extra=require(_0x0828('0x4'));var auth=require(_0x0828('0x5'));var interaction=require(_0x0828('0x6'));var config=require(_0x0828('0x7'));var controller=require(_0x0828('0x8'));router[_0x0828('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0828('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0828('0x9')](_0x0828('0xb'),auth[_0x0828('0xc')](),controller['getVoiceQueuesReport']);router['get'](_0x0828('0xd'),auth[_0x0828('0xc')](),controller[_0x0828('0xe')]);router[_0x0828('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0828('0xd'),auth['isAuthenticated'](),controller[_0x0828('0x10')]);router[_0x0828('0x11')](_0x0828('0xd'),auth[_0x0828('0xc')](),controller['destroy']);module[_0x0828('0x12')]=router; \ No newline at end of file +var _0xa14b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0xa01329,_0x12f32d){var _0x5991ec=function(_0x56e53c){while(--_0x56e53c){_0xa01329['push'](_0xa01329['shift']());}};_0x5991ec(++_0x12f32d);}(_0xa14b,0x1df));var _0xba14=function(_0x45659f,_0x24045a){_0x45659f=_0x45659f-0x0;var _0xb72da9=_0xa14b[_0x45659f];return _0xb72da9;};'use strict';var multer=require('multer');var util=require(_0xba14('0x0'));var path=require(_0xba14('0x1'));var timeout=require(_0xba14('0x2'));var express=require(_0xba14('0x3'));var router=express['Router']();var fs_extra=require(_0xba14('0x4'));var auth=require(_0xba14('0x5'));var interaction=require(_0xba14('0x6'));var config=require(_0xba14('0x7'));var controller=require(_0xba14('0x8'));router[_0xba14('0x9')]('/',auth[_0xba14('0xa')](),controller['index']);router[_0xba14('0x9')](_0xba14('0xb'),auth['isAuthenticated'](),controller[_0xba14('0xc')]);router[_0xba14('0x9')](_0xba14('0xd'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0xba14('0xe'),auth['isAuthenticated'](),controller[_0xba14('0xf')]);router['post']('/',auth[_0xba14('0xa')](),controller[_0xba14('0x10')]);router[_0xba14('0x11')](_0xba14('0xe'),auth[_0xba14('0xa')](),controller[_0xba14('0x12')]);router[_0xba14('0x13')](_0xba14('0xe'),auth[_0xba14('0xa')](),controller[_0xba14('0x14')]);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 7009a2e..6e4bf27 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 _0xf324=['STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports'];(function(_0x80531e,_0x980d08){var _0x36fcae=function(_0x36807b){while(--_0x36807b){_0x80531e['push'](_0x80531e['shift']());}};_0x36fcae(++_0x980d08);}(_0xf324,0x8d));var _0x4f32=function(_0x25c007,_0x14558e){_0x25c007=_0x25c007-0x0;var _0x5ef9aa=_0xf324[_0x25c007];return _0x5ef9aa;};'use strict';var Sequelize=require(_0x4f32('0x0'));var moment=require(_0x4f32('0x1'));module[_0x4f32('0x2')]={'type':{'type':Sequelize[_0x4f32('0x3')]},'uniqueid':{'type':Sequelize[_0x4f32('0x3')]},'calleridnum':{'type':Sequelize[_0x4f32('0x3')]},'calleridname':{'type':Sequelize[_0x4f32('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x4f32('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4f32('0x4')],'set':function(_0x5334da){var _0x2fb694=moment(_0x5334da);var _0x2ee669=moment(this[_0x4f32('0x5')](_0x4f32('0x6')))[_0x4f32('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b6d9b=_0x2fb694[_0x4f32('0x8')](_0x2ee669,'seconds');this['setDataValue']('queuecallerleaveAt',_0x5334da);this['setDataValue']('holdtime',_0x3b6d9b||null);}},'position':{'type':Sequelize[_0x4f32('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x4f32('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4f32('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4f32('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x4f32('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4f32('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4f32('0x3')],'comment':_0x4f32('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x4f32('0x3')]},'connectedlinenum':{'type':Sequelize[_0x4f32('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4f32('0x3')]},'context':{'type':Sequelize[_0x4f32('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4f32('0x3')]},'holdtime':{'type':Sequelize[_0x4f32('0x9')]},'mohtime':{'type':Sequelize[_0x4f32('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4f32('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4f32('0x3')]},'transfer':{'type':Sequelize[_0x4f32('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f32('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4f32('0x3')]},'transferuniqueid':{'type':Sequelize[_0x4f32('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4f32('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4f32('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4f32('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f78=['getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE'];(function(_0x57e950,_0xbe99){var _0x5cf245=function(_0x18cdae){while(--_0x18cdae){_0x57e950['push'](_0x57e950['shift']());}};_0x5cf245(++_0xbe99);}(_0x6f78,0x18f));var _0x86f7=function(_0x189f6c,_0x1c5765){_0x189f6c=_0x189f6c-0x0;var _0x1d3c54=_0x6f78[_0x189f6c];return _0x1d3c54;};'use strict';var Sequelize=require(_0x86f7('0x0'));var moment=require('moment');module[_0x86f7('0x1')]={'type':{'type':Sequelize[_0x86f7('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x86f7('0x2')]},'calleridname':{'type':Sequelize[_0x86f7('0x2')]},'queue':{'type':Sequelize[_0x86f7('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x86f7('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4a4049){var _0xcfa32e=moment(_0x4a4049);var _0x41caee=moment(this[_0x86f7('0x4')](_0x86f7('0x5')))[_0x86f7('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x40337a=_0xcfa32e['diff'](_0x41caee,_0x86f7('0x7'));this[_0x86f7('0x8')](_0x86f7('0x9'),_0x4a4049);this[_0x86f7('0x8')]('holdtime',_0x40337a||null);}},'position':{'type':Sequelize[_0x86f7('0xa')]},'count':{'type':Sequelize[_0x86f7('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x86f7('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x86f7('0x3')]},'queuecallerexit':{'type':Sequelize[_0x86f7('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x86f7('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x86f7('0xc')},'originalposition':{'type':Sequelize[_0x86f7('0xa')]},'channel':{'type':Sequelize[_0x86f7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x86f7('0x2')]},'connectedlinename':{'type':Sequelize[_0x86f7('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x86f7('0x2')]},'exten':{'type':Sequelize[_0x86f7('0x2')]},'priority':{'type':Sequelize[_0x86f7('0x2')]},'holdtime':{'type':Sequelize[_0x86f7('0xa')]},'mohtime':{'type':Sequelize[_0x86f7('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x86f7('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x86f7('0x2')]},'transfer':{'type':Sequelize[_0x86f7('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x86f7('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x86f7('0x2')]},'transferuniqueid':{'type':Sequelize[_0x86f7('0x2')]},'disposition':{'type':Sequelize[_0x86f7('0x2')]},'secondDisposition':{'type':Sequelize[_0x86f7('0x2')]},'thirdDisposition':{'type':Sequelize[_0x86f7('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x86f7('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 350d3a9..3959bd9 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 _0x8607=['reject','save','update','then','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','show','include','find','catch','create','body','destroy','params','describe','findAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x58bf7f,_0x5b3afc){var _0x538241=function(_0x44495f){while(--_0x44495f){_0x58bf7f['push'](_0x58bf7f['shift']());}};_0x538241(++_0x5b3afc);}(_0x8607,0xd7));var _0x7860=function(_0x54cefb,_0x192225){_0x54cefb=_0x54cefb-0x0;var _0x5e4fbb=_0x8607[_0x54cefb];return _0x5e4fbb;};'use strict';var emlformat=require(_0x7860('0x0'));var rimraf=require(_0x7860('0x1'));var zipdir=require(_0x7860('0x2'));var jsonpatch=require(_0x7860('0x3'));var rp=require(_0x7860('0x4'));var moment=require('moment');var BPromise=require(_0x7860('0x5'));var Mustache=require(_0x7860('0x6'));var util=require('util');var path=require(_0x7860('0x7'));var sox=require(_0x7860('0x8'));var csv=require(_0x7860('0x9'));var ejs=require(_0x7860('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7860('0xb'));var squel=require(_0x7860('0xc'));var crypto=require(_0x7860('0xd'));var jsforce=require(_0x7860('0xe'));var deskjs=require(_0x7860('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7860('0x10'));var authService=require(_0x7860('0x11'));var qs=require(_0x7860('0x12'));var as=require(_0x7860('0x13'));var hardwareService=require(_0x7860('0x14'));var logger=require(_0x7860('0x15'))(_0x7860('0x16'));var utils=require('../../config/utils');var config=require(_0x7860('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7860('0x18'))['db'];config[_0x7860('0x19')]=_[_0x7860('0x1a')](config[_0x7860('0x19')],{'host':_0x7860('0x1b'),'port':0x18eb});var socket=require(_0x7860('0x1c'))(new Redis(config[_0x7860('0x19')]));require('./voiceQueueReport.socket')[_0x7860('0x1d')](socket);function respondWithStatusCode(_0x1149cd,_0x1c320c){_0x1c320c=_0x1c320c||0xcc;return function(_0x4cdff3){if(_0x4cdff3){return _0x1149cd[_0x7860('0x1e')](_0x1c320c);}return _0x1149cd[_0x7860('0x1f')](_0x1c320c)[_0x7860('0x20')]();};}function respondWithResult(_0x180864,_0x5a02e1){_0x5a02e1=_0x5a02e1||0xc8;return function(_0x585d05){if(_0x585d05){return _0x180864[_0x7860('0x1f')](_0x5a02e1)['json'](_0x585d05);}};}function respondWithFilteredResult(_0x12aae1,_0x1ab57b){return function(_0x47cb76){if(_0x47cb76){var _0x310ef0=typeof _0x1ab57b[_0x7860('0x21')]===_0x7860('0x22')&&typeof _0x1ab57b[_0x7860('0x23')]===_0x7860('0x22');var _0x28e624=_0x47cb76[_0x7860('0x24')];var _0x3dc1bb=_0x310ef0?0x0:_0x1ab57b[_0x7860('0x21')];var _0x2f823f=_0x310ef0?_0x47cb76['count']:_0x1ab57b[_0x7860('0x21')]+_0x1ab57b[_0x7860('0x23')];var _0x56b48e;if(_0x2f823f>=_0x28e624){_0x2f823f=_0x28e624;_0x56b48e=0xc8;}else{_0x56b48e=0xce;}_0x12aae1[_0x7860('0x1f')](_0x56b48e);return _0x12aae1['set'](_0x7860('0x25'),_0x3dc1bb+'-'+_0x2f823f+'/'+_0x28e624)[_0x7860('0x26')](_0x47cb76);}return null;};}function patchUpdates(_0xb5aca2){return function(_0x30e9ed){try{jsonpatch[_0x7860('0x27')](_0x30e9ed,_0xb5aca2,!![]);}catch(_0x45fba1){return BPromise[_0x7860('0x28')](_0x45fba1);}return _0x30e9ed[_0x7860('0x29')]();};}function saveUpdates(_0x273621,_0x54308e){return function(_0x144813){if(_0x144813){return _0x144813[_0x7860('0x2a')](_0x273621)[_0x7860('0x2b')](function(_0x4ddd43){return _0x4ddd43;});}return null;};}function removeEntity(_0x402b5b,_0x2aac1d){return function(_0x25453b){if(_0x25453b){return _0x25453b['destroy']()[_0x7860('0x2b')](function(){_0x402b5b[_0x7860('0x1f')](0xcc)[_0x7860('0x20')]();});}};}function handleEntityNotFound(_0x46cff3,_0x361a1c){return function(_0x59e9ae){if(!_0x59e9ae){_0x46cff3[_0x7860('0x1e')](0x194);}return _0x59e9ae;};}function handleError(_0x42fcb3,_0x4e55d4){_0x4e55d4=_0x4e55d4||0x1f4;return function(_0x180f75){logger['error'](_0x180f75[_0x7860('0x2c')]);if(_0x180f75['name']){delete _0x180f75[_0x7860('0x2d')];}_0x42fcb3[_0x7860('0x1f')](_0x4e55d4)[_0x7860('0x2e')](_0x180f75);};}exports[_0x7860('0x2f')]=function(_0x54477d,_0x50bf1e){var _0x5f532b={},_0x33f428={},_0x3d1369={'count':0x0,'rows':[]};var _0x3861fe=_[_0x7860('0x30')](db[_0x7860('0x31')][_0x7860('0x32')],function(_0x2425a4){return{'name':_0x2425a4[_0x7860('0x33')],'type':_0x2425a4[_0x7860('0x34')][_0x7860('0x35')]};});_0x33f428[_0x7860('0x36')]=_['map'](_0x3861fe,_0x7860('0x2d'));_0x33f428[_0x7860('0x37')]=_[_0x7860('0x38')](_0x54477d[_0x7860('0x37')]);_0x33f428[_0x7860('0x39')]=_[_0x7860('0x3a')](_0x33f428[_0x7860('0x36')],_0x33f428[_0x7860('0x37')]);_0x5f532b[_0x7860('0x3b')]=_['intersection'](_0x33f428[_0x7860('0x36')],qs['fields'](_0x54477d[_0x7860('0x37')][_0x7860('0x3c')]));_0x5f532b[_0x7860('0x3b')]=_0x5f532b['attributes'][_0x7860('0x3d')]?_0x5f532b[_0x7860('0x3b')]:_0x33f428[_0x7860('0x36')];if(!_0x54477d['query'][_0x7860('0x3e')](_0x7860('0x3f'))){_0x5f532b[_0x7860('0x23')]=qs[_0x7860('0x23')](_0x54477d[_0x7860('0x37')][_0x7860('0x23')]);_0x5f532b['offset']=qs['offset'](_0x54477d[_0x7860('0x37')]['offset']);}_0x5f532b[_0x7860('0x40')]=qs[_0x7860('0x41')](_0x54477d[_0x7860('0x37')][_0x7860('0x41')]);_0x5f532b['where']=qs[_0x7860('0x39')](_[_0x7860('0x42')](_0x54477d[_0x7860('0x37')],_0x33f428[_0x7860('0x39')]),_0x3861fe);if(_0x54477d[_0x7860('0x37')]['filter']){_0x5f532b[_0x7860('0x43')]=_[_0x7860('0x44')](_0x5f532b[_0x7860('0x43')],{'$or':_[_0x7860('0x30')](_0x3861fe,function(_0x25b491){if(_0x25b491[_0x7860('0x34')]!==_0x7860('0x45')){var _0x3b1a32={};_0x3b1a32[_0x25b491[_0x7860('0x2d')]]={'$like':'%'+_0x54477d[_0x7860('0x37')][_0x7860('0x46')]+'%'};return _0x3b1a32;}})});}_0x5f532b=_[_0x7860('0x44')]({},_0x5f532b,_0x54477d[_0x7860('0x47')]);var _0x2c4f7a={'where':_0x5f532b[_0x7860('0x43')]};return db[_0x7860('0x31')][_0x7860('0x24')](_0x2c4f7a)[_0x7860('0x2b')](function(_0x19eb8e){_0x3d1369[_0x7860('0x24')]=_0x19eb8e;if(_0x54477d[_0x7860('0x37')][_0x7860('0x48')]){_0x5f532b['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5f532b);})[_0x7860('0x2b')](function(_0x1ce16f){_0x3d1369[_0x7860('0x49')]=_0x1ce16f;return _0x3d1369;})[_0x7860('0x2b')](respondWithFilteredResult(_0x50bf1e,_0x5f532b))['catch'](handleError(_0x50bf1e,null));};exports[_0x7860('0x4a')]=function(_0x1b558d,_0x31edee){var _0x2c737a={'raw':![],'where':{'id':_0x1b558d['params']['id']}},_0x2acf53={};_0x2acf53[_0x7860('0x36')]=_[_0x7860('0x38')](db[_0x7860('0x31')][_0x7860('0x32')]);_0x2acf53[_0x7860('0x37')]=_[_0x7860('0x38')](_0x1b558d[_0x7860('0x37')]);_0x2acf53[_0x7860('0x39')]=_[_0x7860('0x3a')](_0x2acf53[_0x7860('0x36')],_0x2acf53[_0x7860('0x37')]);_0x2c737a[_0x7860('0x3b')]=_[_0x7860('0x3a')](_0x2acf53['model'],qs[_0x7860('0x3c')](_0x1b558d['query']['fields']));_0x2c737a[_0x7860('0x3b')]=_0x2c737a[_0x7860('0x3b')][_0x7860('0x3d')]?_0x2c737a['attributes']:_0x2acf53['model'];if(_0x1b558d['query'][_0x7860('0x48')]){_0x2c737a[_0x7860('0x4b')]=[{'all':!![]}];}_0x2c737a=_[_0x7860('0x44')]({},_0x2c737a,_0x1b558d['options']);return db[_0x7860('0x31')][_0x7860('0x4c')](_0x2c737a)[_0x7860('0x2b')](handleEntityNotFound(_0x31edee,null))[_0x7860('0x2b')](respondWithResult(_0x31edee,null))[_0x7860('0x4d')](handleError(_0x31edee,null));};exports['create']=function(_0x2cfa65,_0x5d4d9e){return db[_0x7860('0x31')][_0x7860('0x4e')](_0x2cfa65['body'],{})[_0x7860('0x2b')](respondWithResult(_0x5d4d9e,0xc9))[_0x7860('0x4d')](handleError(_0x5d4d9e,null));};exports[_0x7860('0x2a')]=function(_0x4d3fc6,_0x42d4e2){if(_0x4d3fc6[_0x7860('0x4f')]['id']){delete _0x4d3fc6[_0x7860('0x4f')]['id'];}return db[_0x7860('0x31')][_0x7860('0x4c')]({'where':{'id':_0x4d3fc6['params']['id']}})[_0x7860('0x2b')](handleEntityNotFound(_0x42d4e2,null))[_0x7860('0x2b')](saveUpdates(_0x4d3fc6[_0x7860('0x4f')],null))['then'](respondWithResult(_0x42d4e2,null))[_0x7860('0x4d')](handleError(_0x42d4e2,null));};exports[_0x7860('0x50')]=function(_0x2690a3,_0x5575bf){return db[_0x7860('0x31')][_0x7860('0x4c')]({'where':{'id':_0x2690a3[_0x7860('0x51')]['id']}})[_0x7860('0x2b')](handleEntityNotFound(_0x5575bf,null))['then'](removeEntity(_0x5575bf,null))[_0x7860('0x4d')](handleError(_0x5575bf,null));};exports[_0x7860('0x52')]=function(_0x22ae12,_0x14c224){return db[_0x7860('0x31')][_0x7860('0x52')]()['then'](respondWithResult(_0x14c224,null))[_0x7860('0x4d')](handleError(_0x14c224,null));};exports['getVoiceQueuesReport']=function(_0x446ead,_0x58ad8e){var _0x2012a5={},_0x4c478f={},_0x3adb92={'count':0x0,'rows':[]};_0x4c478f[_0x7860('0x36')]=_[_0x7860('0x38')](db['VoiceQueueReport'][_0x7860('0x32')]);_0x4c478f[_0x7860('0x37')]=_['keys'](_0x446ead[_0x7860('0x37')]);_0x4c478f['filters']=_['intersection'](_0x4c478f[_0x7860('0x36')],_0x4c478f[_0x7860('0x37')]);_0x2012a5['attributes']=_[_0x7860('0x3a')](_0x4c478f['model'],qs[_0x7860('0x3c')](_0x446ead[_0x7860('0x37')][_0x7860('0x3c')]));_0x2012a5[_0x7860('0x3b')]=_0x2012a5[_0x7860('0x3b')][_0x7860('0x3d')]?_0x2012a5[_0x7860('0x3b')]:_0x4c478f[_0x7860('0x36')];if(!_0x446ead[_0x7860('0x37')][_0x7860('0x3e')]('nolimit')){_0x2012a5[_0x7860('0x23')]=qs[_0x7860('0x23')](_0x446ead['query'][_0x7860('0x23')]);_0x2012a5['offset']=qs[_0x7860('0x21')](_0x446ead[_0x7860('0x37')][_0x7860('0x21')]);}_0x2012a5[_0x7860('0x40')]=qs[_0x7860('0x41')](_0x446ead[_0x7860('0x37')][_0x7860('0x41')]);_0x2012a5['where']=qs[_0x7860('0x39')](_['pick'](_0x446ead['query'],_0x4c478f[_0x7860('0x39')]));if(_0x446ead[_0x7860('0x37')][_0x7860('0x46')]){_0x2012a5[_0x7860('0x43')]=_[_0x7860('0x44')](_0x2012a5[_0x7860('0x43')],{'$or':_[_0x7860('0x30')](_0x2012a5[_0x7860('0x3b')],function(_0x59a338){var _0x265d40={};_0x265d40[_0x59a338]={'$like':'%'+_0x446ead['query'][_0x7860('0x46')]+'%'};return _0x265d40;})});}_0x2012a5=_[_0x7860('0x44')]({},_0x2012a5,_0x446ead['options']);var _0x16a306={'where':_0x2012a5['where']};return db[_0x7860('0x31')][_0x7860('0x24')](_0x16a306)[_0x7860('0x2b')](function(_0x148450){_0x3adb92[_0x7860('0x24')]=_0x148450;if(_0x446ead[_0x7860('0x37')]['includeAll']){_0x2012a5[_0x7860('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7860('0x53')](_0x2012a5);})[_0x7860('0x2b')](function(_0x2dbe83){_0x3adb92['rows']=_0x2dbe83;return _0x3adb92;})[_0x7860('0x2b')](respondWithFilteredResult(_0x58ad8e,_0x2012a5,_0x7860('0x54')))[_0x7860('0x4d')](handleError(_0x58ad8e,null,_0x7860('0x54')));}; \ No newline at end of file +var _0xff17=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','then','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update','describe','hasOwnProperty','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xff17,0x144));var _0x7ff1=function(_0xd4c300,_0x56708a){_0xd4c300=_0xd4c300-0x0;var _0x201653=_0xff17[_0xd4c300];return _0x201653;};'use strict';var emlformat=require(_0x7ff1('0x0'));var rimraf=require(_0x7ff1('0x1'));var zipdir=require(_0x7ff1('0x2'));var jsonpatch=require(_0x7ff1('0x3'));var rp=require(_0x7ff1('0x4'));var moment=require(_0x7ff1('0x5'));var BPromise=require(_0x7ff1('0x6'));var Mustache=require(_0x7ff1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7ff1('0x8'));var csv=require(_0x7ff1('0x9'));var ejs=require(_0x7ff1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ff1('0xb'));var squel=require('squel');var crypto=require(_0x7ff1('0xc'));var jsforce=require(_0x7ff1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ff1('0xe'));var Papa=require(_0x7ff1('0xf'));var Redis=require(_0x7ff1('0x10'));var authService=require(_0x7ff1('0x11'));var qs=require(_0x7ff1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ff1('0x13'));var logger=require(_0x7ff1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7ff1('0x15'));var licenseUtil=require(_0x7ff1('0x16'));var db=require(_0x7ff1('0x17'))['db'];config[_0x7ff1('0x18')]=_[_0x7ff1('0x19')](config[_0x7ff1('0x18')],{'host':_0x7ff1('0x1a'),'port':0x18eb});var socket=require(_0x7ff1('0x1b'))(new Redis(config[_0x7ff1('0x18')]));require('./voiceQueueReport.socket')[_0x7ff1('0x1c')](socket);function respondWithStatusCode(_0x3feacd,_0x522bbf){_0x522bbf=_0x522bbf||0xcc;return function(_0x5af4d0){if(_0x5af4d0){return _0x3feacd['sendStatus'](_0x522bbf);}return _0x3feacd['status'](_0x522bbf)[_0x7ff1('0x1d')]();};}function respondWithResult(_0x3ad08b,_0xaa27aa){_0xaa27aa=_0xaa27aa||0xc8;return function(_0xb31e67){if(_0xb31e67){return _0x3ad08b[_0x7ff1('0x1e')](_0xaa27aa)['json'](_0xb31e67);}};}function respondWithFilteredResult(_0xc16998,_0x492a2b){return function(_0x2a658c){if(_0x2a658c){var _0x318639=typeof _0x492a2b['offset']===_0x7ff1('0x1f')&&typeof _0x492a2b['limit']===_0x7ff1('0x1f');var _0x2674f4=_0x2a658c[_0x7ff1('0x20')];var _0x4ca920=_0x318639?0x0:_0x492a2b[_0x7ff1('0x21')];var _0x4c8f22=_0x318639?_0x2a658c['count']:_0x492a2b[_0x7ff1('0x21')]+_0x492a2b[_0x7ff1('0x22')];var _0x17c086;if(_0x4c8f22>=_0x2674f4){_0x4c8f22=_0x2674f4;_0x17c086=0xc8;}else{_0x17c086=0xce;}_0xc16998[_0x7ff1('0x1e')](_0x17c086);return _0xc16998[_0x7ff1('0x23')](_0x7ff1('0x24'),_0x4ca920+'-'+_0x4c8f22+'/'+_0x2674f4)[_0x7ff1('0x25')](_0x2a658c);}return null;};}function patchUpdates(_0x3790ea){return function(_0x152e4c){try{jsonpatch[_0x7ff1('0x26')](_0x152e4c,_0x3790ea,!![]);}catch(_0x28ef23){return BPromise[_0x7ff1('0x27')](_0x28ef23);}return _0x152e4c[_0x7ff1('0x28')]();};}function saveUpdates(_0x111289,_0x58a075){return function(_0x2a7a3d){if(_0x2a7a3d){return _0x2a7a3d['update'](_0x111289)['then'](function(_0x57e5f4){return _0x57e5f4;});}return null;};}function removeEntity(_0x16582c,_0x1745c9){return function(_0x1c96fe){if(_0x1c96fe){return _0x1c96fe[_0x7ff1('0x29')]()['then'](function(){_0x16582c[_0x7ff1('0x1e')](0xcc)[_0x7ff1('0x1d')]();});}};}function handleEntityNotFound(_0x1bc0b4,_0x479a9a){return function(_0x303538){if(!_0x303538){_0x1bc0b4[_0x7ff1('0x2a')](0x194);}return _0x303538;};}function handleError(_0x3c7fff,_0x5300d3){_0x5300d3=_0x5300d3||0x1f4;return function(_0x58772a){logger[_0x7ff1('0x2b')](_0x58772a[_0x7ff1('0x2c')]);if(_0x58772a['name']){delete _0x58772a[_0x7ff1('0x2d')];}_0x3c7fff[_0x7ff1('0x1e')](_0x5300d3)[_0x7ff1('0x2e')](_0x58772a);};}exports[_0x7ff1('0x2f')]=function(_0xee6d8d,_0x4a729a){var _0x14c661={},_0x24790c={},_0xb68efd={'count':0x0,'rows':[]};var _0x1e5cc4=_[_0x7ff1('0x30')](db['VoiceQueueReport'][_0x7ff1('0x31')],function(_0x5ba649){return{'name':_0x5ba649[_0x7ff1('0x32')],'type':_0x5ba649[_0x7ff1('0x33')][_0x7ff1('0x34')]};});_0x24790c[_0x7ff1('0x35')]=_[_0x7ff1('0x30')](_0x1e5cc4,_0x7ff1('0x2d'));_0x24790c[_0x7ff1('0x36')]=_[_0x7ff1('0x37')](_0xee6d8d['query']);_0x24790c[_0x7ff1('0x38')]=_[_0x7ff1('0x39')](_0x24790c[_0x7ff1('0x35')],_0x24790c['query']);_0x14c661['attributes']=_[_0x7ff1('0x39')](_0x24790c[_0x7ff1('0x35')],qs['fields'](_0xee6d8d[_0x7ff1('0x36')][_0x7ff1('0x3a')]));_0x14c661[_0x7ff1('0x3b')]=_0x14c661[_0x7ff1('0x3b')]['length']?_0x14c661[_0x7ff1('0x3b')]:_0x24790c[_0x7ff1('0x35')];if(!_0xee6d8d[_0x7ff1('0x36')]['hasOwnProperty'](_0x7ff1('0x3c'))){_0x14c661[_0x7ff1('0x22')]=qs[_0x7ff1('0x22')](_0xee6d8d[_0x7ff1('0x36')]['limit']);_0x14c661['offset']=qs['offset'](_0xee6d8d[_0x7ff1('0x36')][_0x7ff1('0x21')]);}_0x14c661[_0x7ff1('0x3d')]=qs[_0x7ff1('0x3e')](_0xee6d8d[_0x7ff1('0x36')]['sort']);_0x14c661[_0x7ff1('0x3f')]=qs[_0x7ff1('0x38')](_[_0x7ff1('0x40')](_0xee6d8d[_0x7ff1('0x36')],_0x24790c['filters']),_0x1e5cc4);if(_0xee6d8d[_0x7ff1('0x36')][_0x7ff1('0x41')]){_0x14c661[_0x7ff1('0x3f')]=_[_0x7ff1('0x42')](_0x14c661[_0x7ff1('0x3f')],{'$or':_[_0x7ff1('0x30')](_0x1e5cc4,function(_0x23eba5){if(_0x23eba5[_0x7ff1('0x33')]!==_0x7ff1('0x43')){var _0x4e5c57={};_0x4e5c57[_0x23eba5[_0x7ff1('0x2d')]]={'$like':'%'+_0xee6d8d['query'][_0x7ff1('0x41')]+'%'};return _0x4e5c57;}})});}_0x14c661=_['merge']({},_0x14c661,_0xee6d8d[_0x7ff1('0x44')]);var _0x12aebc={'where':_0x14c661[_0x7ff1('0x3f')]};return db[_0x7ff1('0x45')][_0x7ff1('0x20')](_0x12aebc)[_0x7ff1('0x46')](function(_0x53212d){_0xb68efd[_0x7ff1('0x20')]=_0x53212d;if(_0xee6d8d[_0x7ff1('0x36')][_0x7ff1('0x47')]){_0x14c661[_0x7ff1('0x48')]=[{'all':!![]}];}return db[_0x7ff1('0x45')][_0x7ff1('0x49')](_0x14c661);})[_0x7ff1('0x46')](function(_0x29fabf){_0xb68efd[_0x7ff1('0x4a')]=_0x29fabf;return _0xb68efd;})[_0x7ff1('0x46')](respondWithFilteredResult(_0x4a729a,_0x14c661))['catch'](handleError(_0x4a729a,null));};exports[_0x7ff1('0x4b')]=function(_0x32f4d0,_0x35cfe0){var _0x47548f={'raw':![],'where':{'id':_0x32f4d0[_0x7ff1('0x4c')]['id']}},_0x984b09={};_0x984b09[_0x7ff1('0x35')]=_['keys'](db[_0x7ff1('0x45')][_0x7ff1('0x31')]);_0x984b09[_0x7ff1('0x36')]=_[_0x7ff1('0x37')](_0x32f4d0[_0x7ff1('0x36')]);_0x984b09[_0x7ff1('0x38')]=_[_0x7ff1('0x39')](_0x984b09[_0x7ff1('0x35')],_0x984b09[_0x7ff1('0x36')]);_0x47548f['attributes']=_[_0x7ff1('0x39')](_0x984b09[_0x7ff1('0x35')],qs[_0x7ff1('0x3a')](_0x32f4d0[_0x7ff1('0x36')]['fields']));_0x47548f[_0x7ff1('0x3b')]=_0x47548f[_0x7ff1('0x3b')][_0x7ff1('0x4d')]?_0x47548f[_0x7ff1('0x3b')]:_0x984b09['model'];if(_0x32f4d0[_0x7ff1('0x36')]['includeAll']){_0x47548f[_0x7ff1('0x48')]=[{'all':!![]}];}_0x47548f=_['merge']({},_0x47548f,_0x32f4d0[_0x7ff1('0x44')]);return db[_0x7ff1('0x45')][_0x7ff1('0x4e')](_0x47548f)[_0x7ff1('0x46')](handleEntityNotFound(_0x35cfe0,null))['then'](respondWithResult(_0x35cfe0,null))[_0x7ff1('0x4f')](handleError(_0x35cfe0,null));};exports[_0x7ff1('0x50')]=function(_0xc06537,_0x50636a){return db[_0x7ff1('0x45')]['create'](_0xc06537[_0x7ff1('0x51')],{})[_0x7ff1('0x46')](respondWithResult(_0x50636a,0xc9))[_0x7ff1('0x4f')](handleError(_0x50636a,null));};exports[_0x7ff1('0x52')]=function(_0x8c56e2,_0x504167){if(_0x8c56e2[_0x7ff1('0x51')]['id']){delete _0x8c56e2[_0x7ff1('0x51')]['id'];}return db[_0x7ff1('0x45')][_0x7ff1('0x4e')]({'where':{'id':_0x8c56e2['params']['id']}})['then'](handleEntityNotFound(_0x504167,null))[_0x7ff1('0x46')](saveUpdates(_0x8c56e2[_0x7ff1('0x51')],null))[_0x7ff1('0x46')](respondWithResult(_0x504167,null))[_0x7ff1('0x4f')](handleError(_0x504167,null));};exports[_0x7ff1('0x29')]=function(_0x2d6fb7,_0x3b8291){return db['VoiceQueueReport'][_0x7ff1('0x4e')]({'where':{'id':_0x2d6fb7[_0x7ff1('0x4c')]['id']}})[_0x7ff1('0x46')](handleEntityNotFound(_0x3b8291,null))[_0x7ff1('0x46')](removeEntity(_0x3b8291,null))[_0x7ff1('0x4f')](handleError(_0x3b8291,null));};exports[_0x7ff1('0x53')]=function(_0x4c6ee1,_0x5d30e2){return db[_0x7ff1('0x45')]['describe']()['then'](respondWithResult(_0x5d30e2,null))[_0x7ff1('0x4f')](handleError(_0x5d30e2,null));};exports['getVoiceQueuesReport']=function(_0x135812,_0x25827b){var _0x41e273={},_0x115cb9={},_0x5b2ac8={'count':0x0,'rows':[]};_0x115cb9[_0x7ff1('0x35')]=_[_0x7ff1('0x37')](db[_0x7ff1('0x45')][_0x7ff1('0x31')]);_0x115cb9[_0x7ff1('0x36')]=_[_0x7ff1('0x37')](_0x135812['query']);_0x115cb9['filters']=_[_0x7ff1('0x39')](_0x115cb9[_0x7ff1('0x35')],_0x115cb9['query']);_0x41e273[_0x7ff1('0x3b')]=_['intersection'](_0x115cb9[_0x7ff1('0x35')],qs[_0x7ff1('0x3a')](_0x135812['query'][_0x7ff1('0x3a')]));_0x41e273['attributes']=_0x41e273[_0x7ff1('0x3b')][_0x7ff1('0x4d')]?_0x41e273[_0x7ff1('0x3b')]:_0x115cb9[_0x7ff1('0x35')];if(!_0x135812['query'][_0x7ff1('0x54')](_0x7ff1('0x3c'))){_0x41e273[_0x7ff1('0x22')]=qs[_0x7ff1('0x22')](_0x135812[_0x7ff1('0x36')][_0x7ff1('0x22')]);_0x41e273[_0x7ff1('0x21')]=qs[_0x7ff1('0x21')](_0x135812[_0x7ff1('0x36')]['offset']);}_0x41e273[_0x7ff1('0x3d')]=qs[_0x7ff1('0x3e')](_0x135812[_0x7ff1('0x36')]['sort']);_0x41e273['where']=qs[_0x7ff1('0x38')](_[_0x7ff1('0x40')](_0x135812[_0x7ff1('0x36')],_0x115cb9[_0x7ff1('0x38')]));if(_0x135812[_0x7ff1('0x36')][_0x7ff1('0x41')]){_0x41e273['where']=_[_0x7ff1('0x42')](_0x41e273[_0x7ff1('0x3f')],{'$or':_[_0x7ff1('0x30')](_0x41e273[_0x7ff1('0x3b')],function(_0x494ae1){var _0x8de7f0={};_0x8de7f0[_0x494ae1]={'$like':'%'+_0x135812['query']['filter']+'%'};return _0x8de7f0;})});}_0x41e273=_[_0x7ff1('0x42')]({},_0x41e273,_0x135812[_0x7ff1('0x44')]);var _0x10967e={'where':_0x41e273[_0x7ff1('0x3f')]};return db[_0x7ff1('0x45')]['count'](_0x10967e)[_0x7ff1('0x46')](function(_0x1cf60c){_0x5b2ac8[_0x7ff1('0x20')]=_0x1cf60c;if(_0x135812[_0x7ff1('0x36')][_0x7ff1('0x47')]){_0x41e273[_0x7ff1('0x48')]=[{'all':!![]}];}return db[_0x7ff1('0x45')][_0x7ff1('0x49')](_0x41e273);})[_0x7ff1('0x46')](function(_0x11e369){_0x5b2ac8[_0x7ff1('0x4a')]=_0x11e369;return _0x5b2ac8;})[_0x7ff1('0x46')](respondWithFilteredResult(_0x25827b,_0x41e273,_0x7ff1('0x55')))[_0x7ff1('0x4f')](handleError(_0x25827b,null,_0x7ff1('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6ef49e8..967cccb 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 _0x7590=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x7590,0x1c6));var _0x0759=function(_0x1ebaae,_0x270f11){_0x1ebaae=_0x1ebaae-0x0;var _0x53b153=_0x7590[_0x1ebaae];return _0x53b153;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0759('0x0'))['db'][_0x0759('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0759('0x2')](0x0);var events={'afterCreate':_0x0759('0x3'),'afterUpdate':_0x0759('0x4'),'afterDestroy':_0x0759('0x5')};function emitEvent(_0x801376){return function(_0x565b80,_0x548ded,_0x491b6d){VoiceQueueReportEvents[_0x0759('0x6')](_0x801376+':'+_0x565b80['id'],_0x565b80);VoiceQueueReportEvents['emit'](_0x801376,_0x565b80);_0x491b6d(null);};}for(var e in events){if(events[_0x0759('0x7')](e)){var event=events[e];VoiceQueueReport[_0x0759('0x8')](e,emitEvent(event));}}module[_0x0759('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x40ff=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x1a6b60,_0x1532fa){var _0x35a681=function(_0x1e5c37){while(--_0x1e5c37){_0x1a6b60['push'](_0x1a6b60['shift']());}};_0x35a681(++_0x1532fa);}(_0x40ff,0xe1));var _0xf40f=function(_0x2207fe,_0x52adbb){_0x2207fe=_0x2207fe-0x0;var _0x2bbe48=_0x40ff[_0x2207fe];return _0x2bbe48;};'use strict';var EventEmitter=require(_0xf40f('0x0'));var VoiceQueueReport=require(_0xf40f('0x1'))['db'][_0xf40f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf40f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf40f('0x4'),'afterDestroy':_0xf40f('0x5')};function emitEvent(_0xc55b82){return function(_0x3b51d7,_0x58952f,_0x14766){VoiceQueueReportEvents['emit'](_0xc55b82+':'+_0x3b51d7['id'],_0x3b51d7);VoiceQueueReportEvents[_0xf40f('0x6')](_0xc55b82,_0x3b51d7);_0x14766(null);};}for(var e in events){if(events[_0xf40f('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf40f('0x8')](e,emitEvent(event));}}module[_0xf40f('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 6e8e8e3..62010f2 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 _0xb37f=['bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x184c5f,_0x15da1b){var _0x42439c=function(_0x29a718){while(--_0x29a718){_0x184c5f['push'](_0x184c5f['shift']());}};_0x42439c(++_0x15da1b);}(_0xb37f,0x164));var _0xfb37=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb37f[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xfb37('0x0'));var util=require(_0xfb37('0x1'));var logger=require(_0xfb37('0x2'))(_0xfb37('0x3'));var moment=require('moment');var BPromise=require(_0xfb37('0x4'));var rp=require(_0xfb37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb37('0x6'));var attributes=require(_0xfb37('0x7'));module[_0xfb37('0x8')]=function(_0x1610a8,_0x255d3c){return _0x1610a8[_0xfb37('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xfb37('0xa')]},{'fields':[_0xfb37('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49a9=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','bluebird','request-promise','path'];(function(_0x437848,_0x4856e8){var _0x16e76b=function(_0x3f4162){while(--_0x3f4162){_0x437848['push'](_0x437848['shift']());}};_0x16e76b(++_0x4856e8);}(_0x49a9,0x1eb));var _0x949a=function(_0x23e8ac,_0x347de6){_0x23e8ac=_0x23e8ac-0x0;var _0x130907=_0x49a9[_0x23e8ac];return _0x130907;};'use strict';var _=require(_0x949a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x949a('0x1'));var rp=require(_0x949a('0x2'));var fs=require('fs');var path=require(_0x949a('0x3'));var rimraf=require('rimraf');var config=require(_0x949a('0x4'));var attributes=require(_0x949a('0x5'));module[_0x949a('0x6')]=function(_0x4cd673,_0x2f029f){return _0x4cd673[_0x949a('0x7')](_0x949a('0x8'),attributes,{'tableName':_0x949a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x949a('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index acbd773..1e81637 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 _0x0464=['moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','raw','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','lodash','util'];(function(_0x4b2c32,_0x51a3fb){var _0x80dd36=function(_0xa84a2c){while(--_0xa84a2c){_0x4b2c32['push'](_0x4b2c32['shift']());}};_0x80dd36(++_0x51a3fb);}(_0x0464,0x79));var _0x4046=function(_0x43dbe4,_0x2b555a){_0x43dbe4=_0x43dbe4-0x0;var _0x237761=_0x0464[_0x43dbe4];return _0x237761;};'use strict';var _=require(_0x4046('0x0'));var util=require(_0x4046('0x1'));var moment=require(_0x4046('0x2'));var BPromise=require(_0x4046('0x3'));var rs=require(_0x4046('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4046('0x5'));var logger=require(_0x4046('0x6'))('rpc');var config=require(_0x4046('0x7'));var jayson=require(_0x4046('0x8'));var client=jayson[_0x4046('0x9')][_0x4046('0xa')]({'port':0x232a});config[_0x4046('0xb')]=_[_0x4046('0xc')](config[_0x4046('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4046('0xb')]));require(_0x4046('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e0df0,_0x97987e,_0x154b65){return new BPromise(function(_0x105bd8,_0x35750e){return client[_0x4046('0xe')](_0x4e0df0,_0x154b65)[_0x4046('0xf')](function(_0x1a68f9){logger[_0x4046('0x10')](_0x4046('0x11'),_0x97987e,_0x4046('0x12'));logger[_0x4046('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x97987e,_0x4046('0x12'),JSON[_0x4046('0x14')](_0x1a68f9));if(_0x1a68f9[_0x4046('0x15')]){if(_0x1a68f9[_0x4046('0x15')][_0x4046('0x16')]===0x1f4){logger[_0x4046('0x15')](_0x4046('0x11'),_0x97987e,_0x1a68f9['error'][_0x4046('0x17')]);return _0x35750e(_0x1a68f9['error']['message']);}logger[_0x4046('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x97987e,_0x1a68f9[_0x4046('0x15')][_0x4046('0x17')]);return _0x105bd8(_0x1a68f9['error'][_0x4046('0x17')]);}else{logger[_0x4046('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x97987e,_0x4046('0x12'));_0x105bd8(_0x1a68f9[_0x4046('0x18')]['message']);}})[_0x4046('0x19')](function(_0x50e0da){logger[_0x4046('0x15')](_0x4046('0x11'),_0x97987e,_0x50e0da);_0x35750e(_0x50e0da);});});}exports['GetVoiceQueueReport']=function(_0x2188f5){var _0x32a379=this;return new Promise(function(_0x508de0,_0x526cc3){return db['VoiceQueueReport'][_0x4046('0x1a')]({'raw':_0x2188f5['options']?_0x2188f5['options'][_0x4046('0x1b')]===undefined?!![]:![]:!![],'where':_0x2188f5[_0x4046('0x1c')]?_0x2188f5[_0x4046('0x1c')][_0x4046('0x1d')]||null:null,'attributes':_0x2188f5['options']?_0x2188f5[_0x4046('0x1c')][_0x4046('0x1e')]||null:null,'limit':_0x2188f5[_0x4046('0x1c')]?_0x2188f5[_0x4046('0x1c')][_0x4046('0x1f')]||null:null,'include':_0x2188f5[_0x4046('0x1c')]?_0x2188f5['options'][_0x4046('0x20')]?_[_0x4046('0x21')](_0x2188f5[_0x4046('0x1c')][_0x4046('0x20')],function(_0x111627){return{'model':db[_0x111627[_0x4046('0x22')]],'as':_0x111627['as'],'attributes':_0x111627['attributes'],'include':_0x111627['include']?_[_0x4046('0x21')](_0x111627[_0x4046('0x20')],function(_0x3b57fe){return{'model':db[_0x3b57fe[_0x4046('0x22')]],'as':_0x3b57fe['as'],'attributes':_0x3b57fe[_0x4046('0x1e')],'include':_0x3b57fe[_0x4046('0x20')]?_[_0x4046('0x21')](_0x3b57fe[_0x4046('0x20')],function(_0x399051){return{'model':db[_0x399051[_0x4046('0x22')]],'as':_0x399051['as'],'attributes':_0x399051[_0x4046('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4046('0xf')](function(_0x4ea3df){logger[_0x4046('0x10')](_0x4046('0x23'),_0x2188f5);logger[_0x4046('0x13')](_0x4046('0x23'),_0x2188f5,JSON[_0x4046('0x14')](_0x4ea3df));_0x508de0(_0x4ea3df);})[_0x4046('0x19')](function(_0x1f1b9b){logger[_0x4046('0x15')](_0x4046('0x23'),_0x1f1b9b['message'],_0x2188f5);_0x526cc3(_0x32a379[_0x4046('0x15')](0x1f4,_0x1f1b9b[_0x4046('0x17')]));});});};exports[_0x4046('0x24')]=function(_0x4c20b1){var _0x9b32b4=this;return new Promise(function(_0xc1b999,_0x4bcceb){return db[_0x4046('0x25')][_0x4046('0x26')](_0x4c20b1['body'],{'raw':_0x4c20b1[_0x4046('0x1c')]?_0x4c20b1[_0x4046('0x1c')][_0x4046('0x1b')]===undefined?!![]:![]:!![]})[_0x4046('0xf')](function(_0x2e9dcc){logger[_0x4046('0x10')](_0x4046('0x24'),_0x4c20b1);logger[_0x4046('0x13')](_0x4046('0x24'),_0x4c20b1,JSON[_0x4046('0x14')](_0x2e9dcc));_0xc1b999(_0x2e9dcc);})[_0x4046('0x19')](function(_0x5f3ab3){logger[_0x4046('0x15')](_0x4046('0x24'),_0x5f3ab3[_0x4046('0x17')],_0x4c20b1);_0x4bcceb(_0x9b32b4[_0x4046('0x15')](0x1f4,_0x5f3ab3[_0x4046('0x17')]));});});};exports[_0x4046('0x27')]=function(_0x29969b){var _0x4cb934=this;return new Promise(function(_0x5b7d63,_0x668bff){return db[_0x4046('0x25')][_0x4046('0x28')](_0x29969b['body'],{'raw':_0x29969b[_0x4046('0x1c')]?_0x29969b[_0x4046('0x1c')][_0x4046('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29969b[_0x4046('0x1c')]?_0x29969b[_0x4046('0x1c')][_0x4046('0x1d')]||null:null,'attributes':_0x29969b[_0x4046('0x1c')]?_0x29969b[_0x4046('0x1c')][_0x4046('0x1e')]||null:null,'limit':_0x29969b[_0x4046('0x1c')]?_0x29969b[_0x4046('0x1c')][_0x4046('0x1f')]||null:null})[_0x4046('0xf')](function(_0x1b24c8){logger[_0x4046('0x10')]('UpdateVoiceQueueReport',_0x29969b);logger[_0x4046('0x13')]('UpdateVoiceQueueReport',_0x29969b,JSON[_0x4046('0x14')](_0x1b24c8));_0x5b7d63(_0x1b24c8);})[_0x4046('0x19')](function(_0x295ed3){logger[_0x4046('0x15')]('UpdateVoiceQueueReport',_0x295ed3[_0x4046('0x17')],_0x29969b);_0x668bff(_0x4cb934['error'](0x1f4,_0x295ed3[_0x4046('0x17')]));});});}; \ No newline at end of file +var _0x4358=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','raw','options','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3cf1b1,_0x445a0a){var _0x347602=function(_0x19c0a1){while(--_0x19c0a1){_0x3cf1b1['push'](_0x3cf1b1['shift']());}};_0x347602(++_0x445a0a);}(_0x4358,0x78));var _0x8435=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0x4358[_0x2bd88d];return _0x5516d4;};'use strict';var _=require(_0x8435('0x0'));var util=require(_0x8435('0x1'));var moment=require(_0x8435('0x2'));var BPromise=require(_0x8435('0x3'));var rs=require(_0x8435('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8435('0x5'))['db'];var utils=require(_0x8435('0x6'));var logger=require(_0x8435('0x7'))(_0x8435('0x8'));var config=require(_0x8435('0x9'));var jayson=require(_0x8435('0xa'));var client=jayson[_0x8435('0xb')][_0x8435('0xc')]({'port':0x232a});config['redis']=_[_0x8435('0xd')](config[_0x8435('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x8435('0xf'))(new Redis(config[_0x8435('0xe')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x21712c,_0x312160,_0x56abad){return new BPromise(function(_0x43740c,_0x58475f){return client[_0x8435('0x10')](_0x21712c,_0x56abad)['then'](function(_0x12af14){logger[_0x8435('0x11')](_0x8435('0x12'),_0x312160,'request\x20sent');logger[_0x8435('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x312160,_0x8435('0x14'),JSON[_0x8435('0x15')](_0x12af14));if(_0x12af14[_0x8435('0x16')]){if(_0x12af14[_0x8435('0x16')][_0x8435('0x17')]===0x1f4){logger[_0x8435('0x16')](_0x8435('0x12'),_0x312160,_0x12af14[_0x8435('0x16')]['message']);return _0x58475f(_0x12af14['error'][_0x8435('0x18')]);}logger[_0x8435('0x16')](_0x8435('0x12'),_0x312160,_0x12af14[_0x8435('0x16')][_0x8435('0x18')]);return _0x43740c(_0x12af14['error'][_0x8435('0x18')]);}else{logger[_0x8435('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x312160,_0x8435('0x14'));_0x43740c(_0x12af14[_0x8435('0x19')][_0x8435('0x18')]);}})[_0x8435('0x1a')](function(_0x33ad1c){logger[_0x8435('0x16')](_0x8435('0x12'),_0x312160,_0x33ad1c);_0x58475f(_0x33ad1c);});});}exports[_0x8435('0x1b')]=function(_0x491623){var _0xb6903d=this;return new Promise(function(_0x2ae195,_0xa543ce){return db['VoiceQueueReport']['findAll']({'raw':_0x491623['options']?_0x491623['options'][_0x8435('0x1c')]===undefined?!![]:![]:!![],'where':_0x491623[_0x8435('0x1d')]?_0x491623[_0x8435('0x1d')][_0x8435('0x1e')]||null:null,'attributes':_0x491623['options']?_0x491623[_0x8435('0x1d')][_0x8435('0x1f')]||null:null,'limit':_0x491623[_0x8435('0x1d')]?_0x491623[_0x8435('0x1d')][_0x8435('0x20')]||null:null,'include':_0x491623[_0x8435('0x1d')]?_0x491623[_0x8435('0x1d')][_0x8435('0x21')]?_[_0x8435('0x22')](_0x491623[_0x8435('0x1d')][_0x8435('0x21')],function(_0x1c49f9){return{'model':db[_0x1c49f9[_0x8435('0x23')]],'as':_0x1c49f9['as'],'attributes':_0x1c49f9['attributes'],'include':_0x1c49f9[_0x8435('0x21')]?_['map'](_0x1c49f9[_0x8435('0x21')],function(_0x2d7389){return{'model':db[_0x2d7389['model']],'as':_0x2d7389['as'],'attributes':_0x2d7389[_0x8435('0x1f')],'include':_0x2d7389[_0x8435('0x21')]?_[_0x8435('0x22')](_0x2d7389[_0x8435('0x21')],function(_0x1f489d){return{'model':db[_0x1f489d['model']],'as':_0x1f489d['as'],'attributes':_0x1f489d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8435('0x24')](function(_0x3ce683){logger['info']('GetVoiceQueueReport',_0x491623);logger['debug'](_0x8435('0x1b'),_0x491623,JSON[_0x8435('0x15')](_0x3ce683));_0x2ae195(_0x3ce683);})['catch'](function(_0x13942a){logger[_0x8435('0x16')]('GetVoiceQueueReport',_0x13942a['message'],_0x491623);_0xa543ce(_0xb6903d[_0x8435('0x16')](0x1f4,_0x13942a[_0x8435('0x18')]));});});};exports[_0x8435('0x25')]=function(_0x2dc0d1){var _0x4de745=this;return new Promise(function(_0xe9430e,_0x3d3d88){return db['VoiceQueueReport'][_0x8435('0x26')](_0x2dc0d1[_0x8435('0x27')],{'raw':_0x2dc0d1[_0x8435('0x1d')]?_0x2dc0d1[_0x8435('0x1d')][_0x8435('0x1c')]===undefined?!![]:![]:!![]})[_0x8435('0x24')](function(_0x301683){logger[_0x8435('0x11')]('CreateVoiceQueueReport',_0x2dc0d1);logger[_0x8435('0x13')](_0x8435('0x25'),_0x2dc0d1,JSON[_0x8435('0x15')](_0x301683));_0xe9430e(_0x301683);})['catch'](function(_0x33dc27){logger[_0x8435('0x16')](_0x8435('0x25'),_0x33dc27[_0x8435('0x18')],_0x2dc0d1);_0x3d3d88(_0x4de745[_0x8435('0x16')](0x1f4,_0x33dc27['message']));});});};exports[_0x8435('0x28')]=function(_0x5c0c3b){var _0x46737e=this;return new Promise(function(_0x2a9724,_0x4b8b91){return db['VoiceQueueReport'][_0x8435('0x29')](_0x5c0c3b[_0x8435('0x27')],{'raw':_0x5c0c3b[_0x8435('0x1d')]?_0x5c0c3b['options'][_0x8435('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0c3b[_0x8435('0x1d')]?_0x5c0c3b[_0x8435('0x1d')][_0x8435('0x1e')]||null:null,'attributes':_0x5c0c3b[_0x8435('0x1d')]?_0x5c0c3b['options']['attributes']||null:null,'limit':_0x5c0c3b[_0x8435('0x1d')]?_0x5c0c3b[_0x8435('0x1d')]['limit']||null:null})[_0x8435('0x24')](function(_0x486a2a){logger['info'](_0x8435('0x28'),_0x5c0c3b);logger[_0x8435('0x13')]('UpdateVoiceQueueReport',_0x5c0c3b,JSON[_0x8435('0x15')](_0x486a2a));_0x2a9724(_0x486a2a);})[_0x8435('0x1a')](function(_0x15bdff){logger[_0x8435('0x16')](_0x8435('0x28'),_0x15bdff[_0x8435('0x18')],_0x5c0c3b);_0x4b8b91(_0x46737e[_0x8435('0x16')](0x1f4,_0x15bdff[_0x8435('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fe9ba21..5d2d964 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 _0xc903=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','remove','emit'];(function(_0x3cda78,_0x5672f0){var _0x5e4062=function(_0x217ae2){while(--_0x217ae2){_0x3cda78['push'](_0x3cda78['shift']());}};_0x5e4062(++_0x5672f0);}(_0xc903,0x177));var _0x3c90=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xc903[_0x422be2];return _0x1b820e;};'use strict';var VoiceQueueReportEvents=require(_0x3c90('0x0'));var events=['save',_0x3c90('0x1'),'update'];function createListener(_0x51177e,_0x2554f5){return function(_0x539f79){_0x2554f5[_0x3c90('0x2')](_0x51177e,_0x539f79);};}function removeListener(_0x54545a,_0x1e9e2b){return function(){VoiceQueueReportEvents[_0x3c90('0x3')](_0x54545a,_0x1e9e2b);};}exports['register']=function(_0x3d9d9c){for(var _0x361068=0x0,_0x37f629=events[_0x3c90('0x4')];_0x361068<_0x37f629;_0x361068++){var _0x15c161=events[_0x361068];var _0x256f5f=createListener(_0x3c90('0x5')+_0x15c161,_0x3d9d9c);VoiceQueueReportEvents['on'](_0x15c161,_0x256f5f);}}; \ No newline at end of file +var _0xbf18=['emit','length','remove','update'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xbf18,0xfa));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x8bf1('0x0'),_0x8bf1('0x1')];function createListener(_0x8d0b33,_0x232f1e){return function(_0x2cf5c1){_0x232f1e[_0x8bf1('0x2')](_0x8d0b33,_0x2cf5c1);};}function removeListener(_0x6337f5,_0x4d69f4){return function(){VoiceQueueReportEvents['removeListener'](_0x6337f5,_0x4d69f4);};}exports['register']=function(_0x39a737){for(var _0x420f67=0x0,_0xe16cb7=events[_0x8bf1('0x3')];_0x420f67<_0xe16cb7;_0x420f67++){var _0x47b4b0=events[_0x420f67];var _0x4a006d=createListener('voiceQueueReport:'+_0x47b4b0,_0x39a737);VoiceQueueReportEvents['on'](_0x47b4b0,_0x4a006d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index dede102..ab00256 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 _0x1016=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x2b712e,_0x3474eb){var _0xf6eef7=function(_0x5dabd5){while(--_0x5dabd5){_0x2b712e['push'](_0x2b712e['shift']());}};_0xf6eef7(++_0x3474eb);}(_0x1016,0x124));var _0x6101=function(_0xf42523,_0x4709d9){_0xf42523=_0xf42523-0x0;var _0xf88a13=_0x1016[_0xf42523];return _0xf88a13;};'use strict';var multer=require(_0x6101('0x0'));var util=require(_0x6101('0x1'));var path=require(_0x6101('0x2'));var timeout=require('connect-timeout');var express=require(_0x6101('0x3'));var router=express[_0x6101('0x4')]();var fs_extra=require(_0x6101('0x5'));var auth=require(_0x6101('0x6'));var interaction=require(_0x6101('0x7'));var config=require(_0x6101('0x8'));var controller=require(_0x6101('0x9'));router[_0x6101('0xa')]('/',auth['isAuthenticated'](),controller[_0x6101('0xb')]);router[_0x6101('0xa')]('/:id',auth[_0x6101('0xc')](),controller[_0x6101('0xd')]);router[_0x6101('0xe')]('/',auth[_0x6101('0xc')](),controller[_0x6101('0xf')]);router['put'](_0x6101('0x10'),auth[_0x6101('0xc')](),controller[_0x6101('0x11')]);router[_0x6101('0x12')](_0x6101('0x10'),auth['isAuthenticated'](),controller[_0x6101('0x13')]);module[_0x6101('0x14')]=router; \ No newline at end of file +var _0x43e4=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x43e4,0x15a));var _0x443e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x43e4[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var path=require(_0x443e('0x2'));var timeout=require(_0x443e('0x3'));var express=require(_0x443e('0x4'));var router=express[_0x443e('0x5')]();var fs_extra=require(_0x443e('0x6'));var auth=require(_0x443e('0x7'));var interaction=require(_0x443e('0x8'));var config=require(_0x443e('0x9'));var controller=require(_0x443e('0xa'));router[_0x443e('0xb')]('/',auth[_0x443e('0xc')](),controller['index']);router[_0x443e('0xb')](_0x443e('0xd'),auth[_0x443e('0xc')](),controller['show']);router[_0x443e('0xe')]('/',auth['isAuthenticated'](),controller[_0x443e('0xf')]);router['put']('/:id',auth[_0x443e('0xc')](),controller[_0x443e('0x10')]);router[_0x443e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x443e('0x12')]);module[_0x443e('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 f8fce90..e7ce261 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 _0x2eb4=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0x2eb4,0x17f));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x42eb('0x0'));var moment=require('moment');module[_0x42eb('0x1')]={'time':{'type':Sequelize[_0x42eb('0x2')]},'callid':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x42eb('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x42eb('0x3')](_0x42eb('0x4'))}}; \ No newline at end of file +var _0xaefe=['format','sequelize','moment','exports','STRING','DATE'];(function(_0x29c066,_0x2a8be8){var _0x23b20c=function(_0x24af42){while(--_0x24af42){_0x29c066['push'](_0x29c066['shift']());}};_0x23b20c(++_0x2a8be8);}(_0xaefe,0x91));var _0xeaef=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xaefe[_0x33ebf5];return _0x66957b;};'use strict';var Sequelize=require(_0xeaef('0x0'));var moment=require(_0xeaef('0x1'));module[_0xeaef('0x2')]={'time':{'type':Sequelize[_0xeaef('0x3')]},'callid':{'type':Sequelize[_0xeaef('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xeaef('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xeaef('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xeaef('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xeaef('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xeaef('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xeaef('0x4')],'allowNull':![],'defaultValue':moment()[_0xeaef('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 016873f..335296a 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 _0x190c=['filters','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','intersection','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query'];(function(_0x4546ee,_0x7c6e5f){var _0xd9701b=function(_0xa61787){while(--_0xa61787){_0x4546ee['push'](_0x4546ee['shift']());}};_0xd9701b(++_0x7c6e5f);}(_0x190c,0xb1));var _0xc190=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x190c[_0x45c48f];return _0xaf5037;};'use strict';var emlformat=require(_0xc190('0x0'));var rimraf=require(_0xc190('0x1'));var zipdir=require(_0xc190('0x2'));var jsonpatch=require(_0xc190('0x3'));var rp=require(_0xc190('0x4'));var moment=require(_0xc190('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc190('0x6'));var path=require('path');var sox=require(_0xc190('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc190('0x8'));var _=require(_0xc190('0x9'));var squel=require(_0xc190('0xa'));var crypto=require('crypto');var jsforce=require(_0xc190('0xb'));var deskjs=require(_0xc190('0xc'));var toCsv=require(_0xc190('0xd'));var querystring=require(_0xc190('0xe'));var Papa=require(_0xc190('0xf'));var Redis=require(_0xc190('0x10'));var authService=require(_0xc190('0x11'));var qs=require(_0xc190('0x12'));var as=require(_0xc190('0x13'));var hardwareService=require(_0xc190('0x14'));var logger=require(_0xc190('0x15'))(_0xc190('0x16'));var utils=require('../../config/utils');var config=require(_0xc190('0x17'));var licenseUtil=require(_0xc190('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7b3e10,_0x2c11b5){_0x2c11b5=_0x2c11b5||0xcc;return function(_0x2872c6){if(_0x2872c6){return _0x7b3e10[_0xc190('0x19')](_0x2c11b5);}return _0x7b3e10['status'](_0x2c11b5)[_0xc190('0x1a')]();};}function respondWithResult(_0x33f297,_0x184a32){_0x184a32=_0x184a32||0xc8;return function(_0x24c1f0){if(_0x24c1f0){return _0x33f297[_0xc190('0x1b')](_0x184a32)[_0xc190('0x1c')](_0x24c1f0);}};}function respondWithFilteredResult(_0x428d91,_0x1e84eb){return function(_0x3dcbe9){if(_0x3dcbe9){var _0x3a3580=typeof _0x1e84eb[_0xc190('0x1d')]===_0xc190('0x1e')&&typeof _0x1e84eb[_0xc190('0x1f')]==='undefined';var _0xb6dbdb=_0x3dcbe9['count'];var _0x962af8=_0x3a3580?0x0:_0x1e84eb['offset'];var _0x58f4f0=_0x3a3580?_0x3dcbe9[_0xc190('0x20')]:_0x1e84eb[_0xc190('0x1d')]+_0x1e84eb['limit'];var _0x27fbad;if(_0x58f4f0>=_0xb6dbdb){_0x58f4f0=_0xb6dbdb;_0x27fbad=0xc8;}else{_0x27fbad=0xce;}_0x428d91[_0xc190('0x1b')](_0x27fbad);return _0x428d91[_0xc190('0x21')](_0xc190('0x22'),_0x962af8+'-'+_0x58f4f0+'/'+_0xb6dbdb)[_0xc190('0x1c')](_0x3dcbe9);}return null;};}function patchUpdates(_0x31d6c4){return function(_0x38e12a){try{jsonpatch['apply'](_0x38e12a,_0x31d6c4,!![]);}catch(_0x119c9f){return BPromise['reject'](_0x119c9f);}return _0x38e12a[_0xc190('0x23')]();};}function saveUpdates(_0x2e0a41,_0x38986c){return function(_0x5190e1){if(_0x5190e1){return _0x5190e1[_0xc190('0x24')](_0x2e0a41)['then'](function(_0x363a08){return _0x363a08;});}return null;};}function removeEntity(_0x26743e,_0x448213){return function(_0x3ac0f0){if(_0x3ac0f0){return _0x3ac0f0[_0xc190('0x25')]()[_0xc190('0x26')](function(){_0x26743e['status'](0xcc)[_0xc190('0x1a')]();});}};}function handleEntityNotFound(_0x58577b,_0xde0fb){return function(_0x395bf5){if(!_0x395bf5){_0x58577b[_0xc190('0x19')](0x194);}return _0x395bf5;};}function handleError(_0x4e8374,_0x51d41d){_0x51d41d=_0x51d41d||0x1f4;return function(_0x100889){logger[_0xc190('0x27')](_0x100889[_0xc190('0x28')]);if(_0x100889['name']){delete _0x100889[_0xc190('0x29')];}_0x4e8374[_0xc190('0x1b')](_0x51d41d)[_0xc190('0x2a')](_0x100889);};}exports[_0xc190('0x2b')]=function(_0x407e9b,_0x83ba50){var _0x5f00af={},_0x2231b0={},_0x3e401e={'count':0x0,'rows':[]};var _0x49e2f7=_[_0xc190('0x2c')](db[_0xc190('0x2d')][_0xc190('0x2e')],function(_0x455a16){return{'name':_0x455a16[_0xc190('0x2f')],'type':_0x455a16[_0xc190('0x30')][_0xc190('0x31')]};});_0x2231b0['model']=_[_0xc190('0x2c')](_0x49e2f7,_0xc190('0x29'));_0x2231b0[_0xc190('0x32')]=_['keys'](_0x407e9b[_0xc190('0x32')]);_0x2231b0[_0xc190('0x33')]=_['intersection'](_0x2231b0['model'],_0x2231b0[_0xc190('0x32')]);_0x5f00af[_0xc190('0x34')]=_['intersection'](_0x2231b0['model'],qs[_0xc190('0x35')](_0x407e9b[_0xc190('0x32')][_0xc190('0x35')]));_0x5f00af['attributes']=_0x5f00af[_0xc190('0x34')][_0xc190('0x36')]?_0x5f00af['attributes']:_0x2231b0[_0xc190('0x37')];if(!_0x407e9b[_0xc190('0x32')][_0xc190('0x38')]('nolimit')){_0x5f00af[_0xc190('0x1f')]=qs['limit'](_0x407e9b[_0xc190('0x32')][_0xc190('0x1f')]);_0x5f00af[_0xc190('0x1d')]=qs[_0xc190('0x1d')](_0x407e9b[_0xc190('0x32')][_0xc190('0x1d')]);}_0x5f00af[_0xc190('0x39')]=qs[_0xc190('0x3a')](_0x407e9b[_0xc190('0x32')][_0xc190('0x3a')]);_0x5f00af[_0xc190('0x3b')]=qs[_0xc190('0x33')](_[_0xc190('0x3c')](_0x407e9b[_0xc190('0x32')],_0x2231b0[_0xc190('0x33')]),_0x49e2f7);if(_0x407e9b[_0xc190('0x32')][_0xc190('0x3d')]){_0x5f00af['where']=_[_0xc190('0x3e')](_0x5f00af[_0xc190('0x3b')],{'$or':_['map'](_0x49e2f7,function(_0x3fe3f1){if(_0x3fe3f1[_0xc190('0x30')]!==_0xc190('0x3f')){var _0x1f1344={};_0x1f1344[_0x3fe3f1[_0xc190('0x29')]]={'$like':'%'+_0x407e9b[_0xc190('0x32')][_0xc190('0x3d')]+'%'};return _0x1f1344;}})});}_0x5f00af=_[_0xc190('0x3e')]({},_0x5f00af,_0x407e9b[_0xc190('0x40')]);var _0x1b0f29={'where':_0x5f00af[_0xc190('0x3b')]};return db[_0xc190('0x2d')][_0xc190('0x20')](_0x1b0f29)['then'](function(_0x4ebfae){_0x3e401e[_0xc190('0x20')]=_0x4ebfae;if(_0x407e9b[_0xc190('0x32')][_0xc190('0x41')]){_0x5f00af[_0xc190('0x42')]=[{'all':!![]}];}return db[_0xc190('0x2d')]['findAll'](_0x5f00af);})[_0xc190('0x26')](function(_0x1a469b){_0x3e401e[_0xc190('0x43')]=_0x1a469b;return _0x3e401e;})[_0xc190('0x26')](respondWithFilteredResult(_0x83ba50,_0x5f00af))['catch'](handleError(_0x83ba50,null));};exports[_0xc190('0x44')]=function(_0x577885,_0x451f6f){var _0x19ae8e={'raw':!![],'where':{'id':_0x577885[_0xc190('0x45')]['id']}},_0x320cb2={};_0x320cb2['model']=_[_0xc190('0x46')](db['VoiceQueuesLog'][_0xc190('0x2e')]);_0x320cb2[_0xc190('0x32')]=_[_0xc190('0x46')](_0x577885[_0xc190('0x32')]);_0x320cb2[_0xc190('0x33')]=_[_0xc190('0x47')](_0x320cb2[_0xc190('0x37')],_0x320cb2[_0xc190('0x32')]);_0x19ae8e[_0xc190('0x34')]=_[_0xc190('0x47')](_0x320cb2['model'],qs['fields'](_0x577885[_0xc190('0x32')][_0xc190('0x35')]));_0x19ae8e[_0xc190('0x34')]=_0x19ae8e[_0xc190('0x34')][_0xc190('0x36')]?_0x19ae8e[_0xc190('0x34')]:_0x320cb2[_0xc190('0x37')];if(_0x577885[_0xc190('0x32')][_0xc190('0x41')]){_0x19ae8e[_0xc190('0x42')]=[{'all':!![]}];}_0x19ae8e=_[_0xc190('0x3e')]({},_0x19ae8e,_0x577885[_0xc190('0x40')]);return db[_0xc190('0x2d')][_0xc190('0x48')](_0x19ae8e)[_0xc190('0x26')](handleEntityNotFound(_0x451f6f,null))[_0xc190('0x26')](respondWithResult(_0x451f6f,null))[_0xc190('0x49')](handleError(_0x451f6f,null));};exports[_0xc190('0x4a')]=function(_0x27c1c4,_0x238237){return db[_0xc190('0x2d')][_0xc190('0x4a')](_0x27c1c4[_0xc190('0x4b')],{})[_0xc190('0x26')](respondWithResult(_0x238237,0xc9))['catch'](handleError(_0x238237,null));};exports[_0xc190('0x24')]=function(_0x2b76b6,_0x70d412){if(_0x2b76b6[_0xc190('0x4b')]['id']){delete _0x2b76b6[_0xc190('0x4b')]['id'];}return db[_0xc190('0x2d')]['find']({'where':{'id':_0x2b76b6[_0xc190('0x45')]['id']}})[_0xc190('0x26')](handleEntityNotFound(_0x70d412,null))[_0xc190('0x26')](saveUpdates(_0x2b76b6[_0xc190('0x4b')],null))[_0xc190('0x26')](respondWithResult(_0x70d412,null))[_0xc190('0x49')](handleError(_0x70d412,null));};exports[_0xc190('0x25')]=function(_0x3c4f9f,_0x29afb3){return db[_0xc190('0x2d')][_0xc190('0x48')]({'where':{'id':_0x3c4f9f[_0xc190('0x45')]['id']}})[_0xc190('0x26')](handleEntityNotFound(_0x29afb3,null))[_0xc190('0x26')](removeEntity(_0x29afb3,null))[_0xc190('0x49')](handleError(_0x29afb3,null));}; \ No newline at end of file +var _0xc7b3=['index','VoiceQueuesLog','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','show','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','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','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','save','destroy','then','stack','name','send'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xc7b3,0x14b));var _0x3c7b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc7b3[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x3c7b('0x0'));var rimraf=require(_0x3c7b('0x1'));var zipdir=require(_0x3c7b('0x2'));var jsonpatch=require(_0x3c7b('0x3'));var rp=require(_0x3c7b('0x4'));var moment=require(_0x3c7b('0x5'));var BPromise=require(_0x3c7b('0x6'));var Mustache=require('mustache');var util=require(_0x3c7b('0x7'));var path=require(_0x3c7b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c7b('0x9'));var fs=require('fs');var fs_extra=require(_0x3c7b('0xa'));var _=require(_0x3c7b('0xb'));var squel=require(_0x3c7b('0xc'));var crypto=require(_0x3c7b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3c7b('0xe'));var toCsv=require(_0x3c7b('0xf'));var querystring=require(_0x3c7b('0x10'));var Papa=require(_0x3c7b('0x11'));var Redis=require(_0x3c7b('0x12'));var authService=require(_0x3c7b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3c7b('0x14'));var hardwareService=require(_0x3c7b('0x15'));var logger=require(_0x3c7b('0x16'))(_0x3c7b('0x17'));var utils=require(_0x3c7b('0x18'));var config=require(_0x3c7b('0x19'));var licenseUtil=require(_0x3c7b('0x1a'));var db=require(_0x3c7b('0x1b'))['db'];function respondWithStatusCode(_0x433401,_0x526699){_0x526699=_0x526699||0xcc;return function(_0x935259){if(_0x935259){return _0x433401[_0x3c7b('0x1c')](_0x526699);}return _0x433401[_0x3c7b('0x1d')](_0x526699)[_0x3c7b('0x1e')]();};}function respondWithResult(_0x49a8dc,_0x54872e){_0x54872e=_0x54872e||0xc8;return function(_0x150643){if(_0x150643){return _0x49a8dc['status'](_0x54872e)[_0x3c7b('0x1f')](_0x150643);}};}function respondWithFilteredResult(_0x53a419,_0x337542){return function(_0x44a9d5){if(_0x44a9d5){var _0x3a5db2=typeof _0x337542['offset']===_0x3c7b('0x20')&&typeof _0x337542[_0x3c7b('0x21')]==='undefined';var _0x1d2de8=_0x44a9d5['count'];var _0x4f71c6=_0x3a5db2?0x0:_0x337542[_0x3c7b('0x22')];var _0x2aa916=_0x3a5db2?_0x44a9d5[_0x3c7b('0x23')]:_0x337542[_0x3c7b('0x22')]+_0x337542[_0x3c7b('0x21')];var _0x4f258f;if(_0x2aa916>=_0x1d2de8){_0x2aa916=_0x1d2de8;_0x4f258f=0xc8;}else{_0x4f258f=0xce;}_0x53a419[_0x3c7b('0x1d')](_0x4f258f);return _0x53a419['set']('Content-Range',_0x4f71c6+'-'+_0x2aa916+'/'+_0x1d2de8)['json'](_0x44a9d5);}return null;};}function patchUpdates(_0x4c7c56){return function(_0x40d363){try{jsonpatch[_0x3c7b('0x24')](_0x40d363,_0x4c7c56,!![]);}catch(_0x327983){return BPromise[_0x3c7b('0x25')](_0x327983);}return _0x40d363[_0x3c7b('0x26')]();};}function saveUpdates(_0x4d4032,_0x49a029){return function(_0x139dd1){if(_0x139dd1){return _0x139dd1['update'](_0x4d4032)['then'](function(_0x22a12a){return _0x22a12a;});}return null;};}function removeEntity(_0x223391,_0x5a75bc){return function(_0x29313f){if(_0x29313f){return _0x29313f[_0x3c7b('0x27')]()[_0x3c7b('0x28')](function(){_0x223391[_0x3c7b('0x1d')](0xcc)[_0x3c7b('0x1e')]();});}};}function handleEntityNotFound(_0x2e931d,_0x5814b3){return function(_0x239059){if(!_0x239059){_0x2e931d[_0x3c7b('0x1c')](0x194);}return _0x239059;};}function handleError(_0x3af675,_0x3dad5b){_0x3dad5b=_0x3dad5b||0x1f4;return function(_0x498b30){logger['error'](_0x498b30[_0x3c7b('0x29')]);if(_0x498b30[_0x3c7b('0x2a')]){delete _0x498b30[_0x3c7b('0x2a')];}_0x3af675['status'](_0x3dad5b)[_0x3c7b('0x2b')](_0x498b30);};}exports[_0x3c7b('0x2c')]=function(_0x58a2ec,_0x456000){var _0x50b207={},_0xecff06={},_0x29a3a1={'count':0x0,'rows':[]};var _0x3bae65=_['map'](db[_0x3c7b('0x2d')][_0x3c7b('0x2e')],function(_0x28777d){return{'name':_0x28777d['fieldName'],'type':_0x28777d[_0x3c7b('0x2f')][_0x3c7b('0x30')]};});_0xecff06[_0x3c7b('0x31')]=_[_0x3c7b('0x32')](_0x3bae65,_0x3c7b('0x2a'));_0xecff06[_0x3c7b('0x33')]=_[_0x3c7b('0x34')](_0x58a2ec[_0x3c7b('0x33')]);_0xecff06[_0x3c7b('0x35')]=_[_0x3c7b('0x36')](_0xecff06['model'],_0xecff06[_0x3c7b('0x33')]);_0x50b207[_0x3c7b('0x37')]=_['intersection'](_0xecff06['model'],qs[_0x3c7b('0x38')](_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x38')]));_0x50b207[_0x3c7b('0x37')]=_0x50b207[_0x3c7b('0x37')][_0x3c7b('0x39')]?_0x50b207[_0x3c7b('0x37')]:_0xecff06[_0x3c7b('0x31')];if(!_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x3a')](_0x3c7b('0x3b'))){_0x50b207[_0x3c7b('0x21')]=qs[_0x3c7b('0x21')](_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x21')]);_0x50b207['offset']=qs[_0x3c7b('0x22')](_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x22')]);}_0x50b207['order']=qs[_0x3c7b('0x3c')](_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x3c')]);_0x50b207[_0x3c7b('0x3d')]=qs[_0x3c7b('0x35')](_[_0x3c7b('0x3e')](_0x58a2ec[_0x3c7b('0x33')],_0xecff06[_0x3c7b('0x35')]),_0x3bae65);if(_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x3f')]){_0x50b207[_0x3c7b('0x3d')]=_[_0x3c7b('0x40')](_0x50b207['where'],{'$or':_[_0x3c7b('0x32')](_0x3bae65,function(_0x509fce){if(_0x509fce[_0x3c7b('0x2f')]!=='VIRTUAL'){var _0x121e16={};_0x121e16[_0x509fce[_0x3c7b('0x2a')]]={'$like':'%'+_0x58a2ec['query'][_0x3c7b('0x3f')]+'%'};return _0x121e16;}})});}_0x50b207=_[_0x3c7b('0x40')]({},_0x50b207,_0x58a2ec[_0x3c7b('0x41')]);var _0x399d9b={'where':_0x50b207[_0x3c7b('0x3d')]};return db[_0x3c7b('0x2d')]['count'](_0x399d9b)['then'](function(_0x33d2d3){_0x29a3a1[_0x3c7b('0x23')]=_0x33d2d3;if(_0x58a2ec[_0x3c7b('0x33')][_0x3c7b('0x42')]){_0x50b207['include']=[{'all':!![]}];}return db[_0x3c7b('0x2d')]['findAll'](_0x50b207);})['then'](function(_0x41e099){_0x29a3a1[_0x3c7b('0x43')]=_0x41e099;return _0x29a3a1;})[_0x3c7b('0x28')](respondWithFilteredResult(_0x456000,_0x50b207))['catch'](handleError(_0x456000,null));};exports[_0x3c7b('0x44')]=function(_0x52b078,_0x564f48){var _0x5643e2={'raw':!![],'where':{'id':_0x52b078['params']['id']}},_0xf9a08c={};_0xf9a08c[_0x3c7b('0x31')]=_[_0x3c7b('0x34')](db[_0x3c7b('0x2d')]['rawAttributes']);_0xf9a08c[_0x3c7b('0x33')]=_[_0x3c7b('0x34')](_0x52b078['query']);_0xf9a08c[_0x3c7b('0x35')]=_['intersection'](_0xf9a08c[_0x3c7b('0x31')],_0xf9a08c[_0x3c7b('0x33')]);_0x5643e2['attributes']=_[_0x3c7b('0x36')](_0xf9a08c['model'],qs['fields'](_0x52b078['query'][_0x3c7b('0x38')]));_0x5643e2['attributes']=_0x5643e2[_0x3c7b('0x37')][_0x3c7b('0x39')]?_0x5643e2[_0x3c7b('0x37')]:_0xf9a08c[_0x3c7b('0x31')];if(_0x52b078[_0x3c7b('0x33')][_0x3c7b('0x42')]){_0x5643e2[_0x3c7b('0x45')]=[{'all':!![]}];}_0x5643e2=_['merge']({},_0x5643e2,_0x52b078[_0x3c7b('0x41')]);return db[_0x3c7b('0x2d')][_0x3c7b('0x46')](_0x5643e2)[_0x3c7b('0x28')](handleEntityNotFound(_0x564f48,null))[_0x3c7b('0x28')](respondWithResult(_0x564f48,null))[_0x3c7b('0x47')](handleError(_0x564f48,null));};exports[_0x3c7b('0x48')]=function(_0x56fe05,_0x5b7b8a){return db['VoiceQueuesLog'][_0x3c7b('0x48')](_0x56fe05[_0x3c7b('0x49')],{})[_0x3c7b('0x28')](respondWithResult(_0x5b7b8a,0xc9))[_0x3c7b('0x47')](handleError(_0x5b7b8a,null));};exports['update']=function(_0x1bb84b,_0x1a07a9){if(_0x1bb84b[_0x3c7b('0x49')]['id']){delete _0x1bb84b[_0x3c7b('0x49')]['id'];}return db[_0x3c7b('0x2d')]['find']({'where':{'id':_0x1bb84b[_0x3c7b('0x4a')]['id']}})[_0x3c7b('0x28')](handleEntityNotFound(_0x1a07a9,null))[_0x3c7b('0x28')](saveUpdates(_0x1bb84b[_0x3c7b('0x49')],null))[_0x3c7b('0x28')](respondWithResult(_0x1a07a9,null))['catch'](handleError(_0x1a07a9,null));};exports[_0x3c7b('0x27')]=function(_0x2babc9,_0x15244f){return db[_0x3c7b('0x2d')][_0x3c7b('0x46')]({'where':{'id':_0x2babc9[_0x3c7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15244f,null))[_0x3c7b('0x28')](removeEntity(_0x15244f,null))[_0x3c7b('0x47')](handleError(_0x15244f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c5fe84a..f5e4cd5 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 _0x2908=['dtm','lodash','util','../../config/logger','api','moment','path','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','event'];(function(_0xaca371,_0x11c1b5){var _0x24d98a=function(_0x2b26a9){while(--_0x2b26a9){_0xaca371['push'](_0xaca371['shift']());}};_0x24d98a(++_0x11c1b5);}(_0x2908,0x1ef));var _0x8290=function(_0x30982e,_0x32ae21){_0x30982e=_0x30982e-0x0;var _0x520261=_0x2908[_0x30982e];return _0x520261;};'use strict';var _=require(_0x8290('0x0'));var util=require(_0x8290('0x1'));var logger=require(_0x8290('0x2'))(_0x8290('0x3'));var moment=require(_0x8290('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8290('0x5'));var rimraf=require('rimraf');var config=require(_0x8290('0x6'));var attributes=require(_0x8290('0x7'));module['exports']=function(_0x38afc8,_0x5574d0){return _0x38afc8[_0x8290('0x8')](_0x8290('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x8290('0xa'),'fields':[_0x8290('0xb'),_0x8290('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc5e3=['request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','event_dtm','event','lodash','util','../../config/logger','api','bluebird'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xc5e3,0x10c));var _0x3c5e=function(_0x5bcaba,_0x5e5a43){_0x5bcaba=_0x5bcaba-0x0;var _0x3924bc=_0xc5e3[_0x5bcaba];return _0x3924bc;};'use strict';var _=require(_0x3c5e('0x0'));var util=require(_0x3c5e('0x1'));var logger=require(_0x3c5e('0x2'))(_0x3c5e('0x3'));var moment=require('moment');var BPromise=require(_0x3c5e('0x4'));var rp=require(_0x3c5e('0x5'));var fs=require('fs');var path=require(_0x3c5e('0x6'));var rimraf=require('rimraf');var config=require(_0x3c5e('0x7'));var attributes=require(_0x3c5e('0x8'));module[_0x3c5e('0x9')]=function(_0x33ed4d,_0x1cde99){return _0x33ed4d[_0x3c5e('0xa')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x3c5e('0xb'),'fields':[_0x3c5e('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f41bded..fcc9b1f 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 _0xbb5f=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','info'];(function(_0x2604e9,_0x45b567){var _0x586767=function(_0x5b1a1e){while(--_0x5b1a1e){_0x2604e9['push'](_0x2604e9['shift']());}};_0x586767(++_0x45b567);}(_0xbb5f,0x16a));var _0xfbb5=function(_0x395a4a,_0x345150){_0x395a4a=_0x395a4a-0x0;var _0x305859=_0xbb5f[_0x395a4a];return _0x305859;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbb5('0x0'));var BPromise=require('bluebird');var rs=require(_0xfbb5('0x1'));var fs=require('fs');var Redis=require(_0xfbb5('0x2'));var db=require(_0xfbb5('0x3'))['db'];var utils=require(_0xfbb5('0x4'));var logger=require(_0xfbb5('0x5'))(_0xfbb5('0x6'));var config=require(_0xfbb5('0x7'));var jayson=require(_0xfbb5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5026,_0x284080,_0x42228f){return new BPromise(function(_0x419540,_0x4785d4){return client[_0xfbb5('0x9')](_0x2c5026,_0x42228f)['then'](function(_0x5d9932){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x284080,_0xfbb5('0xa'));logger[_0xfbb5('0xb')](_0xfbb5('0xc'),_0x284080,_0xfbb5('0xa'),JSON[_0xfbb5('0xd')](_0x5d9932));if(_0x5d9932[_0xfbb5('0xe')]){if(_0x5d9932['error']['code']===0x1f4){logger[_0xfbb5('0xe')](_0xfbb5('0xf'),_0x284080,_0x5d9932[_0xfbb5('0xe')][_0xfbb5('0x10')]);return _0x4785d4(_0x5d9932[_0xfbb5('0xe')]['message']);}logger[_0xfbb5('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x284080,_0x5d9932['error']['message']);return _0x419540(_0x5d9932['error']['message']);}else{logger[_0xfbb5('0x11')](_0xfbb5('0xf'),_0x284080,_0xfbb5('0xa'));_0x419540(_0x5d9932[_0xfbb5('0x12')][_0xfbb5('0x10')]);}})[_0xfbb5('0x13')](function(_0x2f8505){logger[_0xfbb5('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x284080,_0x2f8505);_0x4785d4(_0x2f8505);});});} \ No newline at end of file +var _0x3a0f=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a0f,0x75));var _0xf3a0=function(_0x340be6,_0x298980){_0x340be6=_0x340be6-0x0;var _0x598e0d=_0x3a0f[_0x340be6];return _0x598e0d;};'use strict';var _=require(_0xf3a0('0x0'));var util=require(_0xf3a0('0x1'));var moment=require(_0xf3a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3a0('0x3'));var fs=require('fs');var Redis=require(_0xf3a0('0x4'));var db=require(_0xf3a0('0x5'))['db'];var utils=require(_0xf3a0('0x6'));var logger=require(_0xf3a0('0x7'))(_0xf3a0('0x8'));var config=require(_0xf3a0('0x9'));var jayson=require(_0xf3a0('0xa'));var client=jayson[_0xf3a0('0xb')][_0xf3a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x291741,_0x2f33a9,_0x2ef1d9){return new BPromise(function(_0x2959b8,_0x199595){return client[_0xf3a0('0xd')](_0x291741,_0x2ef1d9)[_0xf3a0('0xe')](function(_0x25b246){logger['info'](_0xf3a0('0xf'),_0x2f33a9,_0xf3a0('0x10'));logger[_0xf3a0('0x11')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2f33a9,_0xf3a0('0x10'),JSON['stringify'](_0x25b246));if(_0x25b246[_0xf3a0('0x12')]){if(_0x25b246[_0xf3a0('0x12')]['code']===0x1f4){logger[_0xf3a0('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2f33a9,_0x25b246[_0xf3a0('0x12')][_0xf3a0('0x13')]);return _0x199595(_0x25b246[_0xf3a0('0x12')][_0xf3a0('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2f33a9,_0x25b246[_0xf3a0('0x12')][_0xf3a0('0x13')]);return _0x2959b8(_0x25b246['error'][_0xf3a0('0x13')]);}else{logger[_0xf3a0('0x14')](_0xf3a0('0xf'),_0x2f33a9,_0xf3a0('0x10'));_0x2959b8(_0x25b246[_0xf3a0('0x15')][_0xf3a0('0x13')]);}})[_0xf3a0('0x16')](function(_0x53829d){logger[_0xf3a0('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2f33a9,_0x53829d);_0x199595(_0x53829d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 40e5b00..094bedc 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 _0x65fb=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update'];(function(_0x3a0467,_0xa4bc32){var _0x3c7aa6=function(_0x5adec8){while(--_0x5adec8){_0x3a0467['push'](_0x3a0467['shift']());}};_0x3c7aa6(++_0xa4bc32);}(_0x65fb,0xcd));var _0xb65f=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x65fb[_0x152136];return _0x20df44;};'use strict';var multer=require(_0xb65f('0x0'));var util=require('util');var path=require(_0xb65f('0x1'));var timeout=require(_0xb65f('0x2'));var express=require(_0xb65f('0x3'));var router=express[_0xb65f('0x4')]();var fs_extra=require(_0xb65f('0x5'));var auth=require(_0xb65f('0x6'));var interaction=require(_0xb65f('0x7'));var config=require(_0xb65f('0x8'));var controller=require(_0xb65f('0x9'));router[_0xb65f('0xa')]('/',auth[_0xb65f('0xb')](),controller[_0xb65f('0xc')]);router[_0xb65f('0xa')](_0xb65f('0xd'),auth[_0xb65f('0xb')](),controller[_0xb65f('0xe')]);router['get'](_0xb65f('0xf'),auth[_0xb65f('0xb')](),controller[_0xb65f('0x10')]);router['get'](_0xb65f('0x11'),auth[_0xb65f('0xb')](),controller[_0xb65f('0x12')]);router[_0xb65f('0xa')](_0xb65f('0x13'),controller[_0xb65f('0x14')]);router[_0xb65f('0xa')](_0xb65f('0x15'),auth['isAuthenticated'](),controller[_0xb65f('0x16')]);router[_0xb65f('0x17')]('/',auth[_0xb65f('0xb')](),controller['create']);router[_0xb65f('0x17')](_0xb65f('0x15'),auth[_0xb65f('0xb')](),controller[_0xb65f('0x18')]);router[_0xb65f('0x19')]('/:id',auth[_0xb65f('0xb')](),controller[_0xb65f('0x1a')]);router[_0xb65f('0x1b')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb65f('0x1c')]=router; \ No newline at end of file +var _0x4220=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','path'];(function(_0x3f7b56,_0x4d5f9a){var _0x1a7e3a=function(_0xd6e76e){while(--_0xd6e76e){_0x3f7b56['push'](_0x3f7b56['shift']());}};_0x1a7e3a(++_0x4d5f9a);}(_0x4220,0xe8));var _0x0422=function(_0x40b1aa,_0x2e04f7){_0x40b1aa=_0x40b1aa-0x0;var _0x3aa4b1=_0x4220[_0x40b1aa];return _0x3aa4b1;};'use strict';var multer=require(_0x0422('0x0'));var util=require('util');var path=require(_0x0422('0x1'));var timeout=require(_0x0422('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0422('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0422('0x4'));var config=require(_0x0422('0x5'));var controller=require(_0x0422('0x6'));router[_0x0422('0x7')]('/',auth[_0x0422('0x8')](),controller[_0x0422('0x9')]);router[_0x0422('0x7')](_0x0422('0xa'),auth[_0x0422('0x8')](),controller[_0x0422('0xb')]);router[_0x0422('0x7')](_0x0422('0xc'),auth[_0x0422('0x8')](),controller[_0x0422('0xd')]);router[_0x0422('0x7')](_0x0422('0xe'),auth[_0x0422('0x8')](),controller[_0x0422('0xf')]);router[_0x0422('0x7')](_0x0422('0x10'),controller[_0x0422('0x11')]);router[_0x0422('0x7')](_0x0422('0x12'),auth[_0x0422('0x8')](),controller[_0x0422('0x13')]);router[_0x0422('0x14')]('/',auth[_0x0422('0x8')](),controller['create']);router[_0x0422('0x14')]('/:id/transcribe',auth[_0x0422('0x8')](),controller[_0x0422('0x15')]);router[_0x0422('0x16')]('/:id',auth[_0x0422('0x8')](),controller[_0x0422('0x17')]);router[_0x0422('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0422('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b5810a2..99d6964 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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 7bb329d..10fbcc5 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 _0x4152=['data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','../../components/encryptor','uniqueid','value','%s.cypher','recording','existsSync','Sequelize','ValidationError','filename','download','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','MD5','sequelize','col','push','$and','decryptFile','secrets','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','createBucket','upload','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','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4152,0xac));var _0x2415=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x4152[_0x338f73];return _0x163fdf;};'use strict';var emlformat=require(_0x2415('0x0'));var rimraf=require(_0x2415('0x1'));var zipdir=require(_0x2415('0x2'));var jsonpatch=require(_0x2415('0x3'));var rp=require(_0x2415('0x4'));var moment=require(_0x2415('0x5'));var BPromise=require(_0x2415('0x6'));var Mustache=require(_0x2415('0x7'));var util=require('util');var path=require(_0x2415('0x8'));var sox=require(_0x2415('0x9'));var csv=require(_0x2415('0xa'));var ejs=require(_0x2415('0xb'));var fs=require('fs');var fs_extra=require(_0x2415('0xc'));var _=require(_0x2415('0xd'));var squel=require(_0x2415('0xe'));var crypto=require(_0x2415('0xf'));var jsforce=require(_0x2415('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2415('0xa'));var querystring=require(_0x2415('0x11'));var Papa=require(_0x2415('0x12'));var AWS=require(_0x2415('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0x2415('0x14'));var authService=require(_0x2415('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x2415('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2415('0x17'))(_0x2415('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2415('0x19'));var db=require(_0x2415('0x1a'))['db'];function respondWithStatusCode(_0x2428d7,_0x53f821){_0x53f821=_0x53f821||0xcc;return function(_0x3f5d3a){if(_0x3f5d3a){return _0x2428d7['sendStatus'](_0x53f821);}return _0x2428d7[_0x2415('0x1b')](_0x53f821)[_0x2415('0x1c')]();};}function respondWithResult(_0x33fe9b,_0x19a3fc){_0x19a3fc=_0x19a3fc||0xc8;return function(_0x557187){if(_0x557187){return _0x33fe9b[_0x2415('0x1b')](_0x19a3fc)['json'](_0x557187);}};}function respondWithFilteredResult(_0x577f2d,_0x31d9d3){return function(_0x441bda){if(_0x441bda){var _0x75bb19=typeof _0x31d9d3['offset']===_0x2415('0x1d')&&typeof _0x31d9d3[_0x2415('0x1e')]===_0x2415('0x1d');var _0x48e3c6=_0x441bda['count'];var _0x1786e8=_0x75bb19?0x0:_0x31d9d3[_0x2415('0x1f')];var _0xc483bd=_0x75bb19?_0x441bda['count']:_0x31d9d3[_0x2415('0x1f')]+_0x31d9d3[_0x2415('0x1e')];var _0x354b89;if(_0xc483bd>=_0x48e3c6){_0xc483bd=_0x48e3c6;_0x354b89=0xc8;}else{_0x354b89=0xce;}_0x577f2d[_0x2415('0x1b')](_0x354b89);return _0x577f2d['set'](_0x2415('0x20'),_0x1786e8+'-'+_0xc483bd+'/'+_0x48e3c6)[_0x2415('0x21')](_0x441bda);}return null;};}function patchUpdates(_0x2ccbe0){return function(_0x16db44){try{jsonpatch[_0x2415('0x22')](_0x16db44,_0x2ccbe0,!![]);}catch(_0x3b0e5f){return BPromise[_0x2415('0x23')](_0x3b0e5f);}return _0x16db44[_0x2415('0x24')]();};}function saveUpdates(_0x3c6c43,_0x2e5597){return function(_0x7ac80a){if(_0x7ac80a){return _0x7ac80a[_0x2415('0x25')](_0x3c6c43)['then'](function(_0x283ae8){return _0x283ae8;});}return null;};}function removeEntity(_0x16d43b,_0x4018aa){return function(_0x172f76){if(_0x172f76){return _0x172f76[_0x2415('0x26')]()[_0x2415('0x27')](function(){_0x16d43b[_0x2415('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53abf3,_0xe6c5aa){return function(_0x251a4a){if(!_0x251a4a){_0x53abf3[_0x2415('0x28')](0x194);}return _0x251a4a;};}function handleError(_0x27c857,_0x1896b9){_0x1896b9=_0x1896b9||0x1f4;return function(_0x2a8f47){logger['error'](_0x2a8f47[_0x2415('0x29')]);if(_0x2a8f47[_0x2415('0x2a')]){delete _0x2a8f47[_0x2415('0x2a')];}_0x27c857[_0x2415('0x1b')](_0x1896b9)[_0x2415('0x2b')](_0x2a8f47);};}exports[_0x2415('0x2c')]=function(_0x59a99e,_0x36ebe9){var _0x3cdb52={},_0x1174d5={},_0x5ce4d4={'count':0x0,'rows':[]};var _0x1fde4e=_[_0x2415('0x2d')](db[_0x2415('0x2e')][_0x2415('0x2f')],function(_0x4c5a4c){return{'name':_0x4c5a4c[_0x2415('0x30')],'type':_0x4c5a4c[_0x2415('0x31')][_0x2415('0x32')]};});_0x1174d5[_0x2415('0x33')]=_[_0x2415('0x34')](_[_0x2415('0x2d')](_0x1fde4e,_0x2415('0x2a')),[_0x2415('0x35')]);_0x1174d5[_0x2415('0x36')]=_[_0x2415('0x37')](_0x59a99e['query']);_0x1174d5['filters']=_[_0x2415('0x38')](_0x1174d5[_0x2415('0x33')],_0x1174d5['query']);_0x3cdb52['attributes']=_[_0x2415('0x38')](_0x1174d5['model'],qs[_0x2415('0x39')](_0x59a99e['query'][_0x2415('0x39')]));_0x3cdb52[_0x2415('0x3a')]=_0x3cdb52[_0x2415('0x3a')][_0x2415('0x3b')]?_0x3cdb52['attributes']:_0x1174d5[_0x2415('0x33')];if(!_0x59a99e[_0x2415('0x36')][_0x2415('0x3c')](_0x2415('0x3d'))){_0x3cdb52['limit']=qs[_0x2415('0x1e')](_0x59a99e[_0x2415('0x36')]['limit']);_0x3cdb52[_0x2415('0x1f')]=qs['offset'](_0x59a99e[_0x2415('0x36')][_0x2415('0x1f')]);}_0x3cdb52[_0x2415('0x3e')]=qs[_0x2415('0x3f')](_0x59a99e[_0x2415('0x36')][_0x2415('0x3f')]);_0x3cdb52[_0x2415('0x40')]=qs[_0x2415('0x41')](_[_0x2415('0x42')](_0x59a99e[_0x2415('0x36')],_0x1174d5['filters']),_0x1fde4e);if(_0x59a99e['query'][_0x2415('0x43')]){_0x3cdb52[_0x2415('0x40')]=_[_0x2415('0x44')](_0x3cdb52['where'],{'$or':_['map'](_0x1fde4e,function(_0x19c4fe){if(_0x19c4fe[_0x2415('0x31')]!=='VIRTUAL'){var _0x27cd17={};_0x27cd17[_0x19c4fe[_0x2415('0x2a')]]={'$like':'%'+_0x59a99e[_0x2415('0x36')][_0x2415('0x43')]+'%'};return _0x27cd17;}})});}_0x3cdb52=_['merge']({},_0x3cdb52,_0x59a99e[_0x2415('0x45')]);var _0x49ed8d={'where':_0x3cdb52[_0x2415('0x40')]};return db[_0x2415('0x2e')]['count'](_0x49ed8d)[_0x2415('0x27')](function(_0xcd6b32){_0x5ce4d4[_0x2415('0x46')]=_0xcd6b32;if(_0x59a99e[_0x2415('0x36')][_0x2415('0x47')]){_0x3cdb52['include']=[{'all':!![]}];}return db[_0x2415('0x2e')][_0x2415('0x48')](_0x3cdb52);})['then'](function(_0x236eac){_0x5ce4d4[_0x2415('0x49')]=_0x236eac;return _0x5ce4d4;})[_0x2415('0x27')](respondWithFilteredResult(_0x36ebe9,_0x3cdb52))[_0x2415('0x4a')](handleError(_0x36ebe9,null));};exports[_0x2415('0x4b')]=function(_0x477ad9,_0x4a5f68){var _0x1029d1={'raw':![],'where':{'id':_0x477ad9[_0x2415('0x4c')]['id']}},_0x36ab7a={};_0x36ab7a[_0x2415('0x33')]=_['keys'](db['VoiceRecording'][_0x2415('0x2f')]);_0x36ab7a[_0x2415('0x36')]=_['keys'](_0x477ad9[_0x2415('0x36')]);_0x36ab7a[_0x2415('0x41')]=_['intersection'](_0x36ab7a['model'],_0x36ab7a[_0x2415('0x36')]);_0x1029d1['attributes']=_[_0x2415('0x38')](_0x36ab7a['model'],qs[_0x2415('0x39')](_0x477ad9[_0x2415('0x36')]['fields']));_0x1029d1[_0x2415('0x3a')]=_0x1029d1['attributes'][_0x2415('0x3b')]?_0x1029d1[_0x2415('0x3a')]:_0x36ab7a[_0x2415('0x33')];if(_0x477ad9[_0x2415('0x36')][_0x2415('0x47')]){_0x1029d1[_0x2415('0x4d')]=[{'all':!![]}];}_0x1029d1=_[_0x2415('0x44')]({},_0x1029d1,_0x477ad9[_0x2415('0x45')]);return db[_0x2415('0x2e')][_0x2415('0x4e')](_0x1029d1)[_0x2415('0x27')](handleEntityNotFound(_0x4a5f68,null))['then'](respondWithResult(_0x4a5f68,null))['catch'](handleError(_0x4a5f68,null));};exports['create']=function(_0x1886b0,_0x174757){return db[_0x2415('0x2e')][_0x2415('0x4f')](_0x1886b0[_0x2415('0x50')],{})[_0x2415('0x27')](respondWithResult(_0x174757,0xc9))[_0x2415('0x4a')](handleError(_0x174757,null));};exports[_0x2415('0x25')]=function(_0x591ca1,_0x71fc3a){if(_0x591ca1[_0x2415('0x50')]['id']){delete _0x591ca1[_0x2415('0x50')]['id'];}return db[_0x2415('0x2e')][_0x2415('0x4e')]({'where':{'id':_0x591ca1[_0x2415('0x4c')]['id']}})[_0x2415('0x27')](handleEntityNotFound(_0x71fc3a,null))['then'](saveUpdates(_0x591ca1[_0x2415('0x50')],null))['then'](respondWithResult(_0x71fc3a,null))[_0x2415('0x4a')](handleError(_0x71fc3a,null));};exports['describe']=function(_0x36c3dc,_0x591f0b){return db[_0x2415('0x2e')]['describe']()[_0x2415('0x27')](respondWithResult(_0x591f0b,null))[_0x2415('0x4a')](handleError(_0x591f0b,null));};exports['download']=function(_0x24da1e,_0x5eb15f,_0x2a3f61){var _0x2dfc6d=require(_0x2415('0x51'));var _0x1fafa9=![];var _0x52b35e={};if(_0x24da1e[_0x2415('0x36')][_0x2415('0x31')]&&_0x24da1e[_0x2415('0x36')]['type']===_0x2415('0x52')){_0x52b35e['uniqueid']=_0x24da1e[_0x2415('0x4c')]['id'];}else{_0x52b35e['id']=_0x24da1e['params']['id'];}return db[_0x2415('0x2e')][_0x2415('0x4e')]({'where':_0x52b35e,'attributes':['id','value'],'raw':!![]})[_0x2415('0x27')](handleEntityNotFound(_0x5eb15f,null))['then'](function(_0x1c577d){if(_0x1c577d){var _0x306d7e=_0x1c577d[_0x2415('0x53')];var _0x3c5d1a=util['format'](_0x2415('0x54'),_0x306d7e);if(fs['existsSync'](_0x3c5d1a)){_0x1fafa9=!![];return _0x2dfc6d['decryptFile'](_0x3c5d1a,_0x306d7e,config['secrets'][_0x2415('0x55')])[_0x2415('0x27')](function(){return _0x1c577d;});}return _0x1c577d;}})[_0x2415('0x27')](function(_0x1d50d9){if(_0x1d50d9){var _0xf40f7f=_0x1d50d9['value'];if(!fs[_0x2415('0x56')](_0xf40f7f)){throw new db[(_0x2415('0x57'))][(_0x2415('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x1d50d9[_0x2415('0x59')]){return _0x5eb15f[_0x2415('0x5a')](_0xf40f7f,_0x1d50d9[_0x2415('0x59')]+path['extname'](_0xf40f7f),function(){if(_0x1fafa9){fs[_0x2415('0x5b')](_0xf40f7f);}});}else{return _0x5eb15f['download'](_0xf40f7f,function(_0x32c005){if(_0x1fafa9){fs[_0x2415('0x5b')](_0xf40f7f);}});}}})[_0x2415('0x4a')](function(_0x65e98b){if(_0x65e98b[_0x2415('0x5c')]===_0x2415('0x5d')){_0x5eb15f[_0x2415('0x1b')](0x194)[_0x2415('0x2b')](_0x2415('0x5e'));}else{return handleError(_0x5eb15f,null);}});};exports[_0x2415('0x5f')]=function(_0x4d1be7,_0x2b52c2,_0x4c43ed){var _0x169d5a=require(_0x2415('0x51'));var _0x3f12c9=![];var _0x3002c2={'$and':[db['sequelize'][_0x2415('0x40')](db['sequelize']['fn'](_0x2415('0x60'),db[_0x2415('0x61')][_0x2415('0x62')]('uniqueid')),_0x4d1be7[_0x2415('0x36')]['token'])]};if(_0x4d1be7[_0x2415('0x36')]['type']&&_0x4d1be7['query']['type']===_0x2415('0x52')){_0x3002c2['$and'][_0x2415('0x63')]({'uniqueid':_0x4d1be7[_0x2415('0x4c')]['id']});}else{_0x3002c2[_0x2415('0x64')]['push']({'id':_0x4d1be7[_0x2415('0x4c')]['id']});}return db['VoiceRecording'][_0x2415('0x4e')]({'where':_0x3002c2,'attributes':['id',_0x2415('0x53')],'raw':!![]})[_0x2415('0x27')](handleEntityNotFound(_0x2b52c2,null))[_0x2415('0x27')](function(_0x4eb362){if(_0x4eb362){var _0x55a0f2=util[_0x2415('0x35')]('%s.cypher',_0x4eb362[_0x2415('0x53')]);if(fs[_0x2415('0x56')](_0x55a0f2)){_0x3f12c9=!![];return _0x169d5a[_0x2415('0x65')](_0x55a0f2,_0x4eb362[_0x2415('0x53')],config[_0x2415('0x66')][_0x2415('0x55')])[_0x2415('0x27')](function(){return _0x4eb362;});}return _0x4eb362;}})[_0x2415('0x27')](function(_0x422a07){if(_0x422a07){if(!fs[_0x2415('0x56')](_0x422a07[_0x2415('0x53')])){throw new db[(_0x2415('0x57'))][(_0x2415('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x422a07[_0x2415('0x59')]){return _0x2b52c2[_0x2415('0x5a')](_0x422a07[_0x2415('0x53')],_0x422a07[_0x2415('0x59')]+path['extname'](_0x422a07['value']),function(){if(_0x3f12c9){fs[_0x2415('0x5b')](_0x422a07[_0x2415('0x53')]);}});}else{return _0x2b52c2[_0x2415('0x5a')](_0x422a07[_0x2415('0x53')],function(_0x504bc3){if(_0x3f12c9){fs['unlink'](_0x422a07[_0x2415('0x53')]);}});}}})['catch'](handleError(_0x2b52c2,null));};exports['destroy']=function(_0x40806e,_0x210d24){return db[_0x2415('0x2e')][_0x2415('0x4e')]({'where':{'id':_0x40806e[_0x2415('0x4c')]['id']}})[_0x2415('0x27')](function(_0xead504){if(_[_0x2415('0x67')](_0xead504)){throw new ReferenceError(_0x2415('0x68'));}return _0xead504;})[_0x2415('0x27')](function(_0x112674){var _0x1faf50=_0x112674[_0x2415('0x53')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1faf50);if(!_[_0x2415('0x67')](_0x112674[_0x2415('0x53')])&&fs[_0x2415('0x56')](_0x1faf50)){logger[_0x2415('0x69')](_0x2415('0x6a')+_0x1faf50+_0x2415('0x6b'));fs['unlinkSync'](_0x1faf50);}_0x1faf50=_0x1faf50+_0x2415('0x6c');if(!_[_0x2415('0x67')](_0x112674['value'])&&fs[_0x2415('0x56')](_0x1faf50)){logger[_0x2415('0x69')](_0x2415('0x6a')+_0x1faf50+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1faf50);}return _0x112674;})[_0x2415('0x27')](function(_0x4b0ecb){if(!_0x4b0ecb)throw new InternalError();return _0x4b0ecb[_0x2415('0x26')]();})[_0x2415('0x27')](function(){_0x210d24[_0x2415('0x1b')](0xcc)[_0x2415('0x1c')]();})[_0x2415('0x4a')](handleError(_0x210d24,null));};function getBucketslist(_0x5c60af,_0x4fb4a7,_0x44db5b){return new Promise(function(_0x113be1,_0x38d869){var _0x4a53aa=new AWS['S3']({'accessKeyId':_0x4fb4a7,'secretAccessKey':_0x5c60af,'region':_0x44db5b});_0x4a53aa[_0x2415('0x6d')]({},function(_0x497456,_0x1e20db){if(_0x497456){return _0x38d869(_0x497456);}else{return _0x113be1(_0x1e20db);}});});}function createBucket(_0x335eae,_0x171849,_0x4b5cfa,_0x246c65){return new Promise(function(_0x5f4d89,_0x1bba03){var _0x145602=new AWS['S3']({'accessKeyId':_0x171849,'secretAccessKey':_0x335eae,'region':_0x4b5cfa});_0x145602[_0x2415('0x6e')]({'Bucket':_0x246c65},function(_0x2c965d,_0x4d1405){if(_0x2c965d){return _0x1bba03(_0x2c965d);}else{return _0x5f4d89(_0x4d1405);}});});}function uploadFile(_0x2c7a66,_0x577ddf,_0x302276,_0x555233,_0x50a7c8,_0x326757){return new Promise(function(_0x340e0c,_0x57de19){var _0x4d1d6e=new AWS['S3']({'accessKeyId':_0x577ddf,'secretAccessKey':_0x2c7a66,'region':_0x302276});_0x4d1d6e[_0x2415('0x6f')]({'Bucket':_0x555233,'Key':_0x50a7c8,'Body':_0x326757},function(_0x5a0f50,_0x4202ec){if(_0x5a0f50){return _0x57de19(_0x5a0f50);}else{return _0x340e0c(_0x4202ec);}});});}function startTranscribe(_0xc8f933,_0x2c7b04,_0x47ebc2,_0x491a6d,_0x3b0dd3,_0x5c7b0a){return new Promise(function(_0x18ec97,_0x1d6d42){var _0x3ffe24=new AWS['TranscribeService']({'accessKeyId':_0x2c7b04,'secretAccessKey':_0xc8f933,'region':_0x47ebc2});_0x3ffe24[_0x2415('0x70')]({'TranscriptionJobName':_0x491a6d,'LanguageCode':_0x3b0dd3,'Media':{'MediaFileUri':_0x5c7b0a}},function(_0x47df92,_0x1db7bd){if(_0x47df92){return _0x1d6d42(_0x47df92);}else{return _0x18ec97(_0x1db7bd);}});});}function transcribe(_0x102614,_0x3ba7bd,_0x5a3769,_0x56457f,_0x5c54a9,_0x22b1be,_0x2720f8){return new Promise(function(_0x551175,_0x16f815){var _0x42a934={};logger[_0x2415('0x69')](util[_0x2415('0x35')](_0x2415('0x71'),_0x102614,_0x5c54a9));return uploadFile(_0x3ba7bd,_0x5a3769,_0x56457f,_0x5c54a9,path['basename'](_0x22b1be),fs[_0x2415('0x72')](_0x22b1be))[_0x2415('0x27')](function(_0x2dd29c){logger[_0x2415('0x69')](util[_0x2415('0x35')](_0x2415('0x73'),_0x102614,_0x5c54a9,_0x2dd29c[_0x2415('0x74')]));_0x42a934['bucket']=_0x2dd29c[_0x2415('0x75')];_0x42a934[_0x2415('0x76')]=_0x2dd29c['Location'];logger[_0x2415('0x69')](util[_0x2415('0x35')](_0x2415('0x77'),_0x102614));return startTranscribe(_0x3ba7bd,_0x5a3769,_0x56457f,uuidv4(),_0x2720f8,_0x2dd29c[_0x2415('0x74')]);})['then'](function(_0x5367ce){logger['info'](util[_0x2415('0x35')](_0x2415('0x78'),_0x102614,_0x5367ce['TranscriptionJob'][_0x2415('0x79')]));_0x42a934['transcribeName']=_0x5367ce[_0x2415('0x7a')][_0x2415('0x79')];_0x42a934['transcribeStatus']=_0x5367ce['TranscriptionJob'][_0x2415('0x7b')];return _0x551175(_0x42a934);})[_0x2415('0x4a')](function(_0x28f611){return _0x16f815(_0x28f611);});});}exports['runTranscribe']=function(_0x5b9bae,_0x4c4d40,_0x38a280){var _0x26dd4a;var _0x823a18;var _0x2f0716;var _0x1b18fe=require(_0x2415('0x51'));return db[_0x2415('0x2e')][_0x2415('0x7c')]({'where':{'id':_0x5b9bae[_0x2415('0x4c')]['id']}})[_0x2415('0x27')](function(_0x39927d){if(_0x39927d){var _0x5eb62c=util[_0x2415('0x35')](_0x2415('0x54'),_0x39927d['value']);if(fs[_0x2415('0x56')](_0x5eb62c)){cypher=!![];return _0x1b18fe[_0x2415('0x65')](_0x5eb62c,_0x39927d[_0x2415('0x53')],config[_0x2415('0x66')][_0x2415('0x55')])[_0x2415('0x27')](function(){return _0x39927d;});}return _0x39927d;}})[_0x2415('0x27')](function(_0x3bc786){if(!_0x3bc786){throw new db[(_0x2415('0x57'))][(_0x2415('0x58'))](_0x2415('0x7d'));}_0x823a18=_0x3bc786;return db[_0x2415('0x7e')][_0x2415('0x7c')]({'where':{'id':0x1}});})[_0x2415('0x27')](handleEntityNotFound(_0x4c4d40,null))[_0x2415('0x27')](function(_0x592594){if(_0x592594){_0x26dd4a=_0x592594;if(!_0x26dd4a[_0x2415('0x7f')]||!_0x26dd4a[_0x2415('0x80')]||!_0x26dd4a[_0x2415('0x81')]||!_0x26dd4a['language']||!_0x26dd4a[_0x2415('0x82')]){throw new db[(_0x2415('0x57'))][(_0x2415('0x58'))](_0x2415('0x83'));}if(_0x5b9bae[_0x2415('0x50')][_0x2415('0x84')]&&(!_0x26dd4a['sentiment']||!_0x26dd4a['sentimentAccountId']||!_0x26dd4a[_0x2415('0x85')]||!_0x26dd4a['language']||!_0x26dd4a[_0x2415('0x82')])){throw new db['Sequelize'][(_0x2415('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x2415('0x86')][_0x2415('0x7c')]({'where':{'id':_0x26dd4a['transcribeAccountId']}});}})[_0x2415('0x27')](function(_0xbe446f){if(!_0xbe446f){throw new db['Sequelize'][(_0x2415('0x58'))](_0x2415('0x87'));}if(!_0xbe446f[_0x2415('0x88')]||!_0xbe446f[_0x2415('0x89')]){throw new db[(_0x2415('0x57'))][(_0x2415('0x58'))]('Cloud\x20Provider\x20not\x20configured');}_0x2f0716=_0xbe446f;return getBucketslist(_0x2f0716['data1'],_0x2f0716['data2'],_0x26dd4a['transcribeRegion']);})[_0x2415('0x27')](function(_0x1497c2){if(_0x1497c2&&_0x1497c2[_0x2415('0x8a')]){var _0x216959=_[_0x2415('0x4e')](_0x1497c2[_0x2415('0x8a')],function(_0x516cfe){return _0x516cfe[_0x2415('0x8b')]===_0x26dd4a[_0x2415('0x82')];});if(!_0x216959){logger[_0x2415('0x69')](util[_0x2415('0x35')](_0x2415('0x8c'),_0x5b9bae['params']['id'],_0x26dd4a[_0x2415('0x82')]));return createBucket(_0x2f0716['data1'],_0x2f0716[_0x2415('0x89')],_0x26dd4a[_0x2415('0x81')],_0x26dd4a[_0x2415('0x82')]);}logger[_0x2415('0x69')](util[_0x2415('0x35')](_0x2415('0x8d'),_0x5b9bae[_0x2415('0x4c')]['id'],_0x26dd4a['bucket']));return;}})['then'](function(_0x29352c){if(_0x823a18[_0x2415('0x8e')]===_0x2415('0x8f')){return transcribe(_0x5b9bae[_0x2415('0x4c')]['id'],_0x2f0716[_0x2415('0x88')],_0x2f0716[_0x2415('0x89')],_0x26dd4a['transcribeRegion'],_0x26dd4a['bucket'],_0x823a18[_0x2415('0x53')],_0x26dd4a[_0x2415('0x90')]);}else{logger[_0x2415('0x69')](util['format'](_0x2415('0x91'),_0x5b9bae['params']['id']));return{'transcribeStatus':_0x2415('0x92')};}})[_0x2415('0x27')](function(_0x28daf1){if(_0x28daf1){_0x28daf1[_0x2415('0x93')]=_0x5b9bae['body'][_0x2415('0x84')];return _0x823a18[_0x2415('0x94')](_0x28daf1);}})['then'](respondWithResult(_0x4c4d40,null))[_0x2415('0x4a')](handleError(_0x4c4d40,null));};function writeFile(_0x152e48,_0x1a49e2){return new Promise(function(_0x4e16a1,_0x468019){fs['writeFile'](_0x1a49e2,_0x152e48,function(_0x4c7331,_0x4224a7){if(_0x4c7331){return _0x468019(_0x4c7331);}else{return _0x4e16a1(_0x4224a7);}});});}exports['downloadTranscribe']=function(_0x3f5e0c,_0x1222bd,_0x228193){return db[_0x2415('0x2e')][_0x2415('0x7c')]({'where':{'id':_0x3f5e0c[_0x2415('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1222bd))[_0x2415('0x27')](function(_0x590b0d){if(_0x590b0d&&_0x590b0d[_0x2415('0x95')]){var _0x35532e=_0x590b0d[_0x2415('0x95')];var _0x3e8a30=config[_0x2415('0x96')]+_0x2415('0x97')+_0x590b0d['id']+_0x2415('0x98');if(fs['existsSync'](_0x3e8a30)){return _0x3e8a30;}return writeFile(_0x35532e,_0x3e8a30)['then'](function(){return _0x3e8a30;});}else{throw new db['Sequelize'][(_0x2415('0x58'))](_0x2415('0x99'));}})[_0x2415('0x27')](function(_0xc136b8){return _0x1222bd[_0x2415('0x5a')](_0xc136b8);})[_0x2415('0x4a')](handleError(_0x1222bd));}; \ No newline at end of file +var _0xfa9b=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','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','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','ValidationError','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','TranscribeService','[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','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[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','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfa9b,0x1cf));var _0xbfa9=function(_0x4fc4a2,_0x16dff5){_0x4fc4a2=_0x4fc4a2-0x0;var _0x4c9a55=_0xfa9b[_0x4fc4a2];return _0x4c9a55;};'use strict';var emlformat=require(_0xbfa9('0x0'));var rimraf=require(_0xbfa9('0x1'));var zipdir=require(_0xbfa9('0x2'));var jsonpatch=require(_0xbfa9('0x3'));var rp=require(_0xbfa9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbfa9('0x5'));var util=require('util');var path=require(_0xbfa9('0x6'));var sox=require('sox');var csv=require(_0xbfa9('0x7'));var ejs=require(_0xbfa9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbfa9('0x9'));var squel=require(_0xbfa9('0xa'));var crypto=require(_0xbfa9('0xb'));var jsforce=require(_0xbfa9('0xc'));var deskjs=require(_0xbfa9('0xd'));var toCsv=require(_0xbfa9('0x7'));var querystring=require(_0xbfa9('0xe'));var Papa=require(_0xbfa9('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0xbfa9('0x10'));var Redis=require(_0xbfa9('0x11'));var authService=require(_0xbfa9('0x12'));var qs=require(_0xbfa9('0x13'));var as=require(_0xbfa9('0x14'));var hardwareService=require(_0xbfa9('0x15'));var logger=require(_0xbfa9('0x16'))(_0xbfa9('0x17'));var utils=require(_0xbfa9('0x18'));var config=require(_0xbfa9('0x19'));var licenseUtil=require(_0xbfa9('0x1a'));var db=require(_0xbfa9('0x1b'))['db'];function respondWithStatusCode(_0x1ec7b7,_0x12d4ca){_0x12d4ca=_0x12d4ca||0xcc;return function(_0x21e698){if(_0x21e698){return _0x1ec7b7[_0xbfa9('0x1c')](_0x12d4ca);}return _0x1ec7b7[_0xbfa9('0x1d')](_0x12d4ca)[_0xbfa9('0x1e')]();};}function respondWithResult(_0x55ed56,_0x281459){_0x281459=_0x281459||0xc8;return function(_0x2628a7){if(_0x2628a7){return _0x55ed56['status'](_0x281459)[_0xbfa9('0x1f')](_0x2628a7);}};}function respondWithFilteredResult(_0x5573ed,_0x491fb5){return function(_0xa98bb5){if(_0xa98bb5){var _0x429fed=typeof _0x491fb5['offset']===_0xbfa9('0x20')&&typeof _0x491fb5[_0xbfa9('0x21')]===_0xbfa9('0x20');var _0xab0e7=_0xa98bb5[_0xbfa9('0x22')];var _0x23ef9a=_0x429fed?0x0:_0x491fb5[_0xbfa9('0x23')];var _0x35d7ab=_0x429fed?_0xa98bb5['count']:_0x491fb5['offset']+_0x491fb5[_0xbfa9('0x21')];var _0x228282;if(_0x35d7ab>=_0xab0e7){_0x35d7ab=_0xab0e7;_0x228282=0xc8;}else{_0x228282=0xce;}_0x5573ed[_0xbfa9('0x1d')](_0x228282);return _0x5573ed['set']('Content-Range',_0x23ef9a+'-'+_0x35d7ab+'/'+_0xab0e7)[_0xbfa9('0x1f')](_0xa98bb5);}return null;};}function patchUpdates(_0x4022f7){return function(_0x8f1a7d){try{jsonpatch[_0xbfa9('0x24')](_0x8f1a7d,_0x4022f7,!![]);}catch(_0x5b73b5){return BPromise[_0xbfa9('0x25')](_0x5b73b5);}return _0x8f1a7d[_0xbfa9('0x26')]();};}function saveUpdates(_0x4e8ba4,_0x42185c){return function(_0x54861e){if(_0x54861e){return _0x54861e[_0xbfa9('0x27')](_0x4e8ba4)[_0xbfa9('0x28')](function(_0x30322b){return _0x30322b;});}return null;};}function removeEntity(_0x475f8e,_0x540def){return function(_0x134aec){if(_0x134aec){return _0x134aec['destroy']()[_0xbfa9('0x28')](function(){_0x475f8e['status'](0xcc)[_0xbfa9('0x1e')]();});}};}function handleEntityNotFound(_0x5874fa,_0x28ce70){return function(_0x5a9e62){if(!_0x5a9e62){_0x5874fa[_0xbfa9('0x1c')](0x194);}return _0x5a9e62;};}function handleError(_0x1c0950,_0x41968b){_0x41968b=_0x41968b||0x1f4;return function(_0xad0c00){logger[_0xbfa9('0x29')](_0xad0c00[_0xbfa9('0x2a')]);if(_0xad0c00['name']){delete _0xad0c00[_0xbfa9('0x2b')];}_0x1c0950[_0xbfa9('0x1d')](_0x41968b)[_0xbfa9('0x2c')](_0xad0c00);};}exports[_0xbfa9('0x2d')]=function(_0x34c817,_0xecc4be){var _0x8b8bce={},_0xa7d71={},_0x2e890f={'count':0x0,'rows':[]};var _0x107cda=_[_0xbfa9('0x2e')](db[_0xbfa9('0x2f')][_0xbfa9('0x30')],function(_0x2b1a3b){return{'name':_0x2b1a3b[_0xbfa9('0x31')],'type':_0x2b1a3b[_0xbfa9('0x32')][_0xbfa9('0x33')]};});_0xa7d71[_0xbfa9('0x34')]=_['differenceBy'](_[_0xbfa9('0x2e')](_0x107cda,_0xbfa9('0x2b')),[_0xbfa9('0x35')]);_0xa7d71[_0xbfa9('0x36')]=_[_0xbfa9('0x37')](_0x34c817['query']);_0xa7d71[_0xbfa9('0x38')]=_[_0xbfa9('0x39')](_0xa7d71[_0xbfa9('0x34')],_0xa7d71[_0xbfa9('0x36')]);_0x8b8bce[_0xbfa9('0x3a')]=_[_0xbfa9('0x39')](_0xa7d71[_0xbfa9('0x34')],qs[_0xbfa9('0x3b')](_0x34c817[_0xbfa9('0x36')][_0xbfa9('0x3b')]));_0x8b8bce['attributes']=_0x8b8bce[_0xbfa9('0x3a')][_0xbfa9('0x3c')]?_0x8b8bce[_0xbfa9('0x3a')]:_0xa7d71[_0xbfa9('0x34')];if(!_0x34c817[_0xbfa9('0x36')][_0xbfa9('0x3d')]('nolimit')){_0x8b8bce[_0xbfa9('0x21')]=qs['limit'](_0x34c817['query'][_0xbfa9('0x21')]);_0x8b8bce['offset']=qs[_0xbfa9('0x23')](_0x34c817[_0xbfa9('0x36')][_0xbfa9('0x23')]);}_0x8b8bce['order']=qs[_0xbfa9('0x3e')](_0x34c817[_0xbfa9('0x36')][_0xbfa9('0x3e')]);_0x8b8bce[_0xbfa9('0x3f')]=qs['filters'](_[_0xbfa9('0x40')](_0x34c817[_0xbfa9('0x36')],_0xa7d71[_0xbfa9('0x38')]),_0x107cda);if(_0x34c817[_0xbfa9('0x36')][_0xbfa9('0x41')]){_0x8b8bce[_0xbfa9('0x3f')]=_['merge'](_0x8b8bce['where'],{'$or':_[_0xbfa9('0x2e')](_0x107cda,function(_0x34c369){if(_0x34c369[_0xbfa9('0x32')]!=='VIRTUAL'){var _0x4c6912={};_0x4c6912[_0x34c369[_0xbfa9('0x2b')]]={'$like':'%'+_0x34c817[_0xbfa9('0x36')]['filter']+'%'};return _0x4c6912;}})});}_0x8b8bce=_[_0xbfa9('0x42')]({},_0x8b8bce,_0x34c817[_0xbfa9('0x43')]);var _0x287d7a={'where':_0x8b8bce[_0xbfa9('0x3f')]};return db[_0xbfa9('0x2f')]['count'](_0x287d7a)[_0xbfa9('0x28')](function(_0x2e8341){_0x2e890f[_0xbfa9('0x22')]=_0x2e8341;if(_0x34c817[_0xbfa9('0x36')][_0xbfa9('0x44')]){_0x8b8bce['include']=[{'all':!![]}];}return db[_0xbfa9('0x2f')][_0xbfa9('0x45')](_0x8b8bce);})[_0xbfa9('0x28')](function(_0x3f66b4){_0x2e890f['rows']=_0x3f66b4;return _0x2e890f;})[_0xbfa9('0x28')](respondWithFilteredResult(_0xecc4be,_0x8b8bce))[_0xbfa9('0x46')](handleError(_0xecc4be,null));};exports[_0xbfa9('0x47')]=function(_0xdee9b1,_0x3c4cf2){var _0x3c767e={'raw':![],'where':{'id':_0xdee9b1[_0xbfa9('0x48')]['id']}},_0x273c8a={};_0x273c8a[_0xbfa9('0x34')]=_[_0xbfa9('0x37')](db['VoiceRecording']['rawAttributes']);_0x273c8a[_0xbfa9('0x36')]=_[_0xbfa9('0x37')](_0xdee9b1['query']);_0x273c8a[_0xbfa9('0x38')]=_['intersection'](_0x273c8a[_0xbfa9('0x34')],_0x273c8a['query']);_0x3c767e[_0xbfa9('0x3a')]=_[_0xbfa9('0x39')](_0x273c8a[_0xbfa9('0x34')],qs['fields'](_0xdee9b1['query'][_0xbfa9('0x3b')]));_0x3c767e[_0xbfa9('0x3a')]=_0x3c767e[_0xbfa9('0x3a')]['length']?_0x3c767e[_0xbfa9('0x3a')]:_0x273c8a[_0xbfa9('0x34')];if(_0xdee9b1[_0xbfa9('0x36')][_0xbfa9('0x44')]){_0x3c767e['include']=[{'all':!![]}];}_0x3c767e=_[_0xbfa9('0x42')]({},_0x3c767e,_0xdee9b1[_0xbfa9('0x43')]);return db[_0xbfa9('0x2f')]['find'](_0x3c767e)['then'](handleEntityNotFound(_0x3c4cf2,null))[_0xbfa9('0x28')](respondWithResult(_0x3c4cf2,null))[_0xbfa9('0x46')](handleError(_0x3c4cf2,null));};exports[_0xbfa9('0x49')]=function(_0x32c92c,_0xb0d9ab){return db[_0xbfa9('0x2f')][_0xbfa9('0x49')](_0x32c92c['body'],{})[_0xbfa9('0x28')](respondWithResult(_0xb0d9ab,0xc9))[_0xbfa9('0x46')](handleError(_0xb0d9ab,null));};exports[_0xbfa9('0x27')]=function(_0x44bfb1,_0x5280e0){if(_0x44bfb1[_0xbfa9('0x4a')]['id']){delete _0x44bfb1[_0xbfa9('0x4a')]['id'];}return db[_0xbfa9('0x2f')][_0xbfa9('0x4b')]({'where':{'id':_0x44bfb1[_0xbfa9('0x48')]['id']}})['then'](handleEntityNotFound(_0x5280e0,null))[_0xbfa9('0x28')](saveUpdates(_0x44bfb1['body'],null))[_0xbfa9('0x28')](respondWithResult(_0x5280e0,null))[_0xbfa9('0x46')](handleError(_0x5280e0,null));};exports[_0xbfa9('0x4c')]=function(_0x4dbf54,_0x192662){return db['VoiceRecording'][_0xbfa9('0x4c')]()['then'](respondWithResult(_0x192662,null))[_0xbfa9('0x46')](handleError(_0x192662,null));};exports[_0xbfa9('0x4d')]=function(_0x2b2048,_0x3ce28f,_0x10b8af){var _0x1b3369=require(_0xbfa9('0x4e'));var _0x302bd8=![];var _0x4b8839={};if(_0x2b2048['query'][_0xbfa9('0x32')]&&_0x2b2048[_0xbfa9('0x36')][_0xbfa9('0x32')]===_0xbfa9('0x4f')){_0x4b8839['uniqueid']=_0x2b2048[_0xbfa9('0x48')]['id'];}else{_0x4b8839['id']=_0x2b2048['params']['id'];}return db['VoiceRecording'][_0xbfa9('0x4b')]({'where':_0x4b8839,'attributes':['id',_0xbfa9('0x50')],'raw':!![]})[_0xbfa9('0x28')](handleEntityNotFound(_0x3ce28f,null))[_0xbfa9('0x28')](function(_0x51fd65){if(_0x51fd65){var _0x2848f8=_0x51fd65['value'];var _0x31bc2e=util[_0xbfa9('0x35')](_0xbfa9('0x51'),_0x2848f8);if(fs[_0xbfa9('0x52')](_0x31bc2e)){_0x302bd8=!![];return _0x1b3369[_0xbfa9('0x53')](_0x31bc2e,_0x2848f8,config[_0xbfa9('0x54')][_0xbfa9('0x55')])[_0xbfa9('0x28')](function(){return _0x51fd65;});}return _0x51fd65;}})['then'](function(_0x500953){if(_0x500953){var _0x3cc316=_0x500953[_0xbfa9('0x50')];if(!fs[_0xbfa9('0x52')](_0x3cc316)){throw new db[(_0xbfa9('0x56'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x500953[_0xbfa9('0x57')]){return _0x3ce28f['download'](_0x3cc316,_0x500953[_0xbfa9('0x57')]+path[_0xbfa9('0x58')](_0x3cc316),function(){if(_0x302bd8){fs['unlink'](_0x3cc316);}});}else{return _0x3ce28f[_0xbfa9('0x4d')](_0x3cc316,function(_0x47e9a6){if(_0x302bd8){fs[_0xbfa9('0x59')](_0x3cc316);}});}}})['catch'](function(_0xd0f05){if(_0xd0f05[_0xbfa9('0x5a')]===_0xbfa9('0x5b')){_0x3ce28f[_0xbfa9('0x1d')](0x194)['send'](_0xbfa9('0x5c'));}else{return handleError(_0x3ce28f,null);}});};exports[_0xbfa9('0x5d')]=function(_0x5d1cbe,_0x23a4f2,_0x4afa00){var _0x1d70f4=require(_0xbfa9('0x4e'));var _0x5f3914=![];var _0x145d86={'$and':[db[_0xbfa9('0x5e')]['where'](db[_0xbfa9('0x5e')]['fn'](_0xbfa9('0x5f'),db[_0xbfa9('0x5e')][_0xbfa9('0x60')](_0xbfa9('0x4f'))),_0x5d1cbe[_0xbfa9('0x36')][_0xbfa9('0x61')])]};if(_0x5d1cbe[_0xbfa9('0x36')][_0xbfa9('0x32')]&&_0x5d1cbe[_0xbfa9('0x36')][_0xbfa9('0x32')]==='uniqueid'){_0x145d86[_0xbfa9('0x62')][_0xbfa9('0x63')]({'uniqueid':_0x5d1cbe[_0xbfa9('0x48')]['id']});}else{_0x145d86[_0xbfa9('0x62')]['push']({'id':_0x5d1cbe[_0xbfa9('0x48')]['id']});}return db[_0xbfa9('0x2f')][_0xbfa9('0x4b')]({'where':_0x145d86,'attributes':['id',_0xbfa9('0x50')],'raw':!![]})[_0xbfa9('0x28')](handleEntityNotFound(_0x23a4f2,null))[_0xbfa9('0x28')](function(_0x256ebd){if(_0x256ebd){var _0x57a09b=util[_0xbfa9('0x35')](_0xbfa9('0x51'),_0x256ebd[_0xbfa9('0x50')]);if(fs[_0xbfa9('0x52')](_0x57a09b)){_0x5f3914=!![];return _0x1d70f4[_0xbfa9('0x53')](_0x57a09b,_0x256ebd[_0xbfa9('0x50')],config[_0xbfa9('0x54')]['recording'])[_0xbfa9('0x28')](function(){return _0x256ebd;});}return _0x256ebd;}})[_0xbfa9('0x28')](function(_0x3edf25){if(_0x3edf25){if(!fs[_0xbfa9('0x52')](_0x3edf25[_0xbfa9('0x50')])){throw new db['Sequelize'][(_0xbfa9('0x64'))](_0xbfa9('0x5b'));}if(_0x3edf25[_0xbfa9('0x57')]){return _0x23a4f2[_0xbfa9('0x4d')](_0x3edf25[_0xbfa9('0x50')],_0x3edf25[_0xbfa9('0x57')]+path[_0xbfa9('0x58')](_0x3edf25[_0xbfa9('0x50')]),function(){if(_0x5f3914){fs[_0xbfa9('0x59')](_0x3edf25['value']);}});}else{return _0x23a4f2[_0xbfa9('0x4d')](_0x3edf25[_0xbfa9('0x50')],function(_0x41cb92){if(_0x5f3914){fs[_0xbfa9('0x59')](_0x3edf25[_0xbfa9('0x50')]);}});}}})[_0xbfa9('0x46')](handleError(_0x23a4f2,null));};exports[_0xbfa9('0x65')]=function(_0x4bfb20,_0x3d8cec){return db[_0xbfa9('0x2f')][_0xbfa9('0x4b')]({'where':{'id':_0x4bfb20[_0xbfa9('0x48')]['id']}})[_0xbfa9('0x28')](function(_0x121efe){if(_['isNil'](_0x121efe)){throw new ReferenceError(_0xbfa9('0x66'));}return _0x121efe;})[_0xbfa9('0x28')](function(_0x33e287){var _0x32a530=_0x33e287['value'];logger['info'](_0xbfa9('0x67'),_0x32a530);if(!_[_0xbfa9('0x68')](_0x33e287['value'])&&fs['existsSync'](_0x32a530)){logger['info'](_0xbfa9('0x69')+_0x32a530+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbfa9('0x6a')](_0x32a530);}_0x32a530=_0x32a530+_0xbfa9('0x6b');if(!_[_0xbfa9('0x68')](_0x33e287['value'])&&fs['existsSync'](_0x32a530)){logger[_0xbfa9('0x6c')](_0xbfa9('0x69')+_0x32a530+_0xbfa9('0x6d'));fs['unlinkSync'](_0x32a530);}return _0x33e287;})[_0xbfa9('0x28')](function(_0x123c33){if(!_0x123c33)throw new InternalError();return _0x123c33[_0xbfa9('0x65')]();})[_0xbfa9('0x28')](function(){_0x3d8cec[_0xbfa9('0x1d')](0xcc)[_0xbfa9('0x1e')]();})['catch'](handleError(_0x3d8cec,null));};function getBucketslist(_0x1b4f43,_0x377534,_0x23f521){return new Promise(function(_0x2e9374,_0x2fd388){var _0x2dfa54=new AWS['S3']({'accessKeyId':_0x377534,'secretAccessKey':_0x1b4f43,'region':_0x23f521});_0x2dfa54[_0xbfa9('0x6e')]({},function(_0x54428e,_0x2e11ff){if(_0x54428e){return _0x2fd388(_0x54428e);}else{return _0x2e9374(_0x2e11ff);}});});}function createBucket(_0xb3167d,_0x59b333,_0x4da6c4,_0xcb9d){return new Promise(function(_0x2222f2,_0x4ff38d){var _0x2d2dae=new AWS['S3']({'accessKeyId':_0x59b333,'secretAccessKey':_0xb3167d,'region':_0x4da6c4});_0x2d2dae['createBucket']({'Bucket':_0xcb9d},function(_0x37a502,_0x2e0a7d){if(_0x37a502){return _0x4ff38d(_0x37a502);}else{return _0x2222f2(_0x2e0a7d);}});});}function uploadFile(_0x3b84cc,_0x2eb317,_0x86e124,_0x1135c2,_0x1569e4,_0x43b77a){return new Promise(function(_0x1da84a,_0x1606d1){var _0x37b976=new AWS['S3']({'accessKeyId':_0x2eb317,'secretAccessKey':_0x3b84cc,'region':_0x86e124});_0x37b976['upload']({'Bucket':_0x1135c2,'Key':_0x1569e4,'Body':_0x43b77a},function(_0x1de8a7,_0x5a7d6d){if(_0x1de8a7){return _0x1606d1(_0x1de8a7);}else{return _0x1da84a(_0x5a7d6d);}});});}function startTranscribe(_0x4f6d50,_0x57c4bb,_0x236d38,_0x274933,_0x42e519,_0x1de62a){return new Promise(function(_0x3203fa,_0x26f252){var _0x95457e=new AWS[(_0xbfa9('0x6f'))]({'accessKeyId':_0x57c4bb,'secretAccessKey':_0x4f6d50,'region':_0x236d38});_0x95457e['startTranscriptionJob']({'TranscriptionJobName':_0x274933,'LanguageCode':_0x42e519,'Media':{'MediaFileUri':_0x1de62a}},function(_0xae7717,_0x407dc3){if(_0xae7717){return _0x26f252(_0xae7717);}else{return _0x3203fa(_0x407dc3);}});});}function transcribe(_0x37cce9,_0x189791,_0x1767be,_0x440c6a,_0x5b78a4,_0x513d1e,_0x1a4147){return new Promise(function(_0x98639f,_0x461714){var _0x5d0c7d={};logger['info'](util['format'](_0xbfa9('0x70'),_0x37cce9,_0x5b78a4));return uploadFile(_0x189791,_0x1767be,_0x440c6a,_0x5b78a4,path['basename'](_0x513d1e),fs[_0xbfa9('0x71')](_0x513d1e))[_0xbfa9('0x28')](function(_0x4de757){logger[_0xbfa9('0x6c')](util[_0xbfa9('0x35')](_0xbfa9('0x72'),_0x37cce9,_0x5b78a4,_0x4de757[_0xbfa9('0x73')]));_0x5d0c7d[_0xbfa9('0x74')]=_0x4de757[_0xbfa9('0x75')];_0x5d0c7d[_0xbfa9('0x76')]=_0x4de757[_0xbfa9('0x73')];logger[_0xbfa9('0x6c')](util['format'](_0xbfa9('0x77'),_0x37cce9));return startTranscribe(_0x189791,_0x1767be,_0x440c6a,uuidv4(),_0x1a4147,_0x4de757['Location']);})['then'](function(_0x269529){logger['info'](util['format'](_0xbfa9('0x78'),_0x37cce9,_0x269529['TranscriptionJob']['TranscriptionJobName']));_0x5d0c7d['transcribeName']=_0x269529['TranscriptionJob'][_0xbfa9('0x79')];_0x5d0c7d[_0xbfa9('0x7a')]=_0x269529['TranscriptionJob'][_0xbfa9('0x7b')];return _0x98639f(_0x5d0c7d);})[_0xbfa9('0x46')](function(_0x905660){return _0x461714(_0x905660);});});}exports[_0xbfa9('0x7c')]=function(_0x316197,_0x300e1e,_0x2493a5){var _0x51dfca;var _0x4121c5;var _0x55e9f3;var _0x1c7d54=require(_0xbfa9('0x4e'));return db[_0xbfa9('0x2f')][_0xbfa9('0x7d')]({'where':{'id':_0x316197[_0xbfa9('0x48')]['id']}})[_0xbfa9('0x28')](function(_0x529ce5){if(_0x529ce5){var _0x58e948=util[_0xbfa9('0x35')]('%s.cypher',_0x529ce5['value']);if(fs[_0xbfa9('0x52')](_0x58e948)){cypher=!![];return _0x1c7d54[_0xbfa9('0x53')](_0x58e948,_0x529ce5[_0xbfa9('0x50')],config['secrets']['recording'])[_0xbfa9('0x28')](function(){return _0x529ce5;});}return _0x529ce5;}})[_0xbfa9('0x28')](function(_0x1364ef){if(!_0x1364ef){throw new db[(_0xbfa9('0x56'))][(_0xbfa9('0x64'))](_0xbfa9('0x7e'));}_0x4121c5=_0x1364ef;return db[_0xbfa9('0x7f')][_0xbfa9('0x7d')]({'where':{'id':0x1}});})[_0xbfa9('0x28')](handleEntityNotFound(_0x300e1e,null))['then'](function(_0x3a3156){if(_0x3a3156){_0x51dfca=_0x3a3156;if(!_0x51dfca[_0xbfa9('0x80')]||!_0x51dfca[_0xbfa9('0x81')]||!_0x51dfca[_0xbfa9('0x82')]||!_0x51dfca[_0xbfa9('0x83')]||!_0x51dfca[_0xbfa9('0x74')]){throw new db[(_0xbfa9('0x56'))][(_0xbfa9('0x64'))](_0xbfa9('0x84'));}if(_0x316197[_0xbfa9('0x4a')][_0xbfa9('0x85')]&&(!_0x51dfca['sentiment']||!_0x51dfca[_0xbfa9('0x86')]||!_0x51dfca['sentimentRegion']||!_0x51dfca[_0xbfa9('0x83')]||!_0x51dfca[_0xbfa9('0x74')])){throw new db[(_0xbfa9('0x56'))]['ValidationError'](_0xbfa9('0x87'));}return db[_0xbfa9('0x88')][_0xbfa9('0x7d')]({'where':{'id':_0x51dfca[_0xbfa9('0x81')]}});}})['then'](function(_0x7ec95e){if(!_0x7ec95e){throw new db['Sequelize'][(_0xbfa9('0x64'))](_0xbfa9('0x89'));}if(!_0x7ec95e[_0xbfa9('0x8a')]||!_0x7ec95e['data2']){throw new db[(_0xbfa9('0x56'))][(_0xbfa9('0x64'))](_0xbfa9('0x8b'));}_0x55e9f3=_0x7ec95e;return getBucketslist(_0x55e9f3[_0xbfa9('0x8a')],_0x55e9f3[_0xbfa9('0x8c')],_0x51dfca[_0xbfa9('0x82')]);})[_0xbfa9('0x28')](function(_0x30275c){if(_0x30275c&&_0x30275c[_0xbfa9('0x8d')]){var _0x444e11=_[_0xbfa9('0x4b')](_0x30275c['Buckets'],function(_0x3f2e7c){return _0x3f2e7c[_0xbfa9('0x8e')]===_0x51dfca[_0xbfa9('0x74')];});if(!_0x444e11){logger[_0xbfa9('0x6c')](util[_0xbfa9('0x35')](_0xbfa9('0x8f'),_0x316197[_0xbfa9('0x48')]['id'],_0x51dfca['bucket']));return createBucket(_0x55e9f3[_0xbfa9('0x8a')],_0x55e9f3[_0xbfa9('0x8c')],_0x51dfca['transcribeRegion'],_0x51dfca['bucket']);}logger['info'](util[_0xbfa9('0x35')](_0xbfa9('0x90'),_0x316197[_0xbfa9('0x48')]['id'],_0x51dfca[_0xbfa9('0x74')]));return;}})[_0xbfa9('0x28')](function(_0x42c256){if(_0x4121c5[_0xbfa9('0x7a')]===_0xbfa9('0x91')){return transcribe(_0x316197[_0xbfa9('0x48')]['id'],_0x55e9f3[_0xbfa9('0x8a')],_0x55e9f3[_0xbfa9('0x8c')],_0x51dfca[_0xbfa9('0x82')],_0x51dfca[_0xbfa9('0x74')],_0x4121c5[_0xbfa9('0x50')],_0x51dfca[_0xbfa9('0x83')]);}else{logger[_0xbfa9('0x6c')](util[_0xbfa9('0x35')](_0xbfa9('0x92'),_0x316197[_0xbfa9('0x48')]['id']));return{'transcribeStatus':_0xbfa9('0x93')};}})[_0xbfa9('0x28')](function(_0x1b504d){if(_0x1b504d){_0x1b504d[_0xbfa9('0x94')]=_0x316197['body'][_0xbfa9('0x85')];return _0x4121c5[_0xbfa9('0x95')](_0x1b504d);}})[_0xbfa9('0x28')](respondWithResult(_0x300e1e,null))[_0xbfa9('0x46')](handleError(_0x300e1e,null));};function writeFile(_0xc830d7,_0x4377c7){return new Promise(function(_0x573c79,_0x4b71d4){fs[_0xbfa9('0x96')](_0x4377c7,_0xc830d7,function(_0x1d0505,_0x5c04c6){if(_0x1d0505){return _0x4b71d4(_0x1d0505);}else{return _0x573c79(_0x5c04c6);}});});}exports[_0xbfa9('0x97')]=function(_0x97d29,_0xef6207,_0xfe3898){return db[_0xbfa9('0x2f')][_0xbfa9('0x7d')]({'where':{'id':_0x97d29['params']['id']}})['then'](handleEntityNotFound(_0xef6207))['then'](function(_0x1b7508){if(_0x1b7508&&_0x1b7508[_0xbfa9('0x98')]){var _0xc9325a=_0x1b7508[_0xbfa9('0x98')];var _0x1c9316=config[_0xbfa9('0x99')]+_0xbfa9('0x9a')+_0x1b7508['id']+_0xbfa9('0x9b');if(fs[_0xbfa9('0x52')](_0x1c9316)){return _0x1c9316;}return writeFile(_0xc9325a,_0x1c9316)[_0xbfa9('0x28')](function(){return _0x1c9316;});}else{throw new db[(_0xbfa9('0x56'))][(_0xbfa9('0x64'))](_0xbfa9('0x9c'));}})[_0xbfa9('0x28')](function(_0x509d10){return _0xef6207[_0xbfa9('0x4d')](_0x509d10);})['catch'](handleError(_0xef6207));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2694fb9..cc8e27c 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 _0x8b71=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','voice_recordings','uniqueid'];(function(_0x2059df,_0x367401){var _0xdd848b=function(_0x13055b){while(--_0x13055b){_0x2059df['push'](_0x2059df['shift']());}};_0xdd848b(++_0x367401);}(_0x8b71,0x1c0));var _0x18b7=function(_0x24be1b,_0x33a53e){_0x24be1b=_0x24be1b-0x0;var _0x11f6a9=_0x8b71[_0x24be1b];return _0x11f6a9;};'use strict';var _=require(_0x18b7('0x0'));var util=require(_0x18b7('0x1'));var logger=require(_0x18b7('0x2'))(_0x18b7('0x3'));var moment=require(_0x18b7('0x4'));var BPromise=require(_0x18b7('0x5'));var rp=require(_0x18b7('0x6'));var fs=require('fs');var path=require(_0x18b7('0x7'));var rimraf=require(_0x18b7('0x8'));var config=require(_0x18b7('0x9'));var attributes=require(_0x18b7('0xa'));module[_0x18b7('0xb')]=function(_0x4dd907,_0x5b0e43){return _0x4dd907['define']('VoiceRecording',attributes,{'tableName':_0x18b7('0xc'),'paranoid':![],'indexes':[{'name':_0x18b7('0xd'),'fields':[_0x18b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x281a=['uniqueid','api','bluebird','path','rimraf','../../config/environment','exports','define','voice_recordings'];(function(_0x37949e,_0x45f853){var _0x1f8c63=function(_0x38a51c){while(--_0x38a51c){_0x37949e['push'](_0x37949e['shift']());}};_0x1f8c63(++_0x45f853);}(_0x281a,0x160));var _0xa281=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x281a[_0x29d915];return _0x160f86;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa281('0x0'));var moment=require('moment');var BPromise=require(_0xa281('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa281('0x2'));var rimraf=require(_0xa281('0x3'));var config=require(_0xa281('0x4'));var attributes=require('./voiceRecording.attributes');module[_0xa281('0x5')]=function(_0x5d9822,_0x4118b2){return _0x5d9822[_0xa281('0x6')]('VoiceRecording',attributes,{'tableName':_0xa281('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa281('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 10dd0e8..c44351f 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 _0xffd6=['catch','UpdateVoiceRecording','update','body','options','raw','where','attributes','CreateVoiceRecording','../../components/encryptor','Setting','VoiceRecording','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x569673,_0x37c484){var _0x2e9e4f=function(_0xc1740d){while(--_0xc1740d){_0x569673['push'](_0x569673['shift']());}};_0x2e9e4f(++_0x37c484);}(_0xffd6,0x97));var _0x6ffd=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xffd6[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['VoiceRecording'][_0x6ffd('0x17')](_0x889a4b[_0x6ffd('0x18')],{'raw':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x19')][_0x6ffd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x889a4b['options']?_0x889a4b['options'][_0x6ffd('0x1b')]||null:null,'attributes':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b['options'][_0x6ffd('0x1c')]||null:null,'limit':_0x889a4b[_0x6ffd('0x19')]?_0x889a4b[_0x6ffd('0x19')]['limit']||null:null})[_0x6ffd('0xa')](function(_0x2efeb5){logger['info'](_0x6ffd('0x16'),_0x889a4b);logger[_0x6ffd('0xd')]('UpdateVoiceRecording',_0x889a4b,JSON[_0x6ffd('0xf')](_0x2efeb5));_0x11a609(_0x2efeb5);})[_0x6ffd('0x15')](function(_0xb504e5){logger['error'](_0x6ffd('0x16'),_0xb504e5[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0xb504e5['message']));});});};exports[_0x6ffd('0x1d')]=function(_0x5a55e2){var _0x41ab4a=this;return new Promise(function(_0x43269c,_0x56c6de){var _0x520258=require(_0x6ffd('0x1e'));var _0x2a0391;return db[_0x6ffd('0x1f')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x6ffd('0xa')](function(_0x48feb4){_0x2a0391=_0x48feb4;return db[_0x6ffd('0x20')][_0x6ffd('0x21')](_0x5a55e2['body']);})[_0x6ffd('0xa')](function(_0xc790b2){if(_0x2a0391[_0x6ffd('0x22')]&&fs[_0x6ffd('0x23')](_0xc790b2[_0x6ffd('0x24')])){var _0x31c609=util[_0x6ffd('0x25')](_0x6ffd('0x26'),_0xc790b2[_0x6ffd('0x24')]);return _0x520258[_0x6ffd('0x27')](_0xc790b2[_0x6ffd('0x24')],_0x31c609,config[_0x6ffd('0x28')][_0x6ffd('0x29')])['then'](function(){fs['unlink'](_0xc790b2['value']);logger[_0x6ffd('0x13')](_0x6ffd('0x2a'));return _0xc790b2;});}return _0xc790b2;})[_0x6ffd('0xa')](function(_0x528a3f){logger[_0x6ffd('0x13')](_0x6ffd('0x1d'),_0x5a55e2);logger[_0x6ffd('0xd')](_0x6ffd('0x1d'),_0x5a55e2,JSON[_0x6ffd('0xf')](_0x528a3f));_0x43269c(_0x528a3f);})[_0x6ffd('0x15')](function(_0x26394c){logger[_0x6ffd('0x10')](_0x6ffd('0x1d'),_0x26394c['message'],_0x5a55e2);_0x56c6de(_0x41ab4a[_0x6ffd('0x10')](0x1f4,_0x26394c[_0x6ffd('0x12')]));});});}; \ No newline at end of file +var _0x8ace=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x98417d,_0x2d249c){_0x98417d=_0x98417d-0x0;var _0x51ee3c=_0x8ace[_0x98417d];return _0x51ee3c;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});}exports[_0xe8ac('0x19')]=function(_0x36759c){var _0x4892d0=this;return new Promise(function(_0x59df3d,_0x5f3433){return db[_0xe8ac('0x1a')][_0xe8ac('0x1b')](_0x36759c['body'],{'raw':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1e')]||null:null,'attributes':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')]||null:null,'limit':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')]['limit']||null:null})[_0xe8ac('0x20')](function(_0x3933d2){logger[_0xe8ac('0xf')](_0xe8ac('0x19'),_0x36759c);logger[_0xe8ac('0x12')](_0xe8ac('0x19'),_0x36759c,JSON[_0xe8ac('0x14')](_0x3933d2));_0x59df3d(_0x3933d2);})['catch'](function(_0x1c3ea4){logger[_0xe8ac('0x15')](_0xe8ac('0x19'),_0x1c3ea4[_0xe8ac('0x16')],_0x36759c);_0x5f3433(_0x4892d0[_0xe8ac('0x15')](0x1f4,_0x1c3ea4[_0xe8ac('0x16')]));});});};exports[_0xe8ac('0x21')]=function(_0x3e3fc2){var _0x44b07c=this;return new Promise(function(_0x562e44,_0x5a1b69){var _0x346dcb=require(_0xe8ac('0x22'));var _0x59512c;return db[_0xe8ac('0x23')][_0xe8ac('0x24')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f1e44){_0x59512c=_0x1f1e44;return db[_0xe8ac('0x1a')][_0xe8ac('0x25')](_0x3e3fc2[_0xe8ac('0x26')]);})[_0xe8ac('0x20')](function(_0x41ffe8){if(_0x59512c[_0xe8ac('0x27')]&&fs['existsSync'](_0x41ffe8[_0xe8ac('0x28')])){var _0x5459e5=util[_0xe8ac('0x29')]('%s.cypher',_0x41ffe8['value']);return _0x346dcb['encryptFile'](_0x41ffe8['value'],_0x5459e5,config[_0xe8ac('0x2a')][_0xe8ac('0x2b')])[_0xe8ac('0x20')](function(){fs[_0xe8ac('0x2c')](_0x41ffe8[_0xe8ac('0x28')]);logger[_0xe8ac('0xf')](_0xe8ac('0x2d'));return _0x41ffe8;});}return _0x41ffe8;})['then'](function(_0x1cacb0){logger['info']('CreateVoiceRecording',_0x3e3fc2);logger['debug'](_0xe8ac('0x21'),_0x3e3fc2,JSON[_0xe8ac('0x14')](_0x1cacb0));_0x562e44(_0x1cacb0);})[_0xe8ac('0x18')](function(_0x56feff){logger['error'](_0xe8ac('0x21'),_0x56feff[_0xe8ac('0x16')],_0x3e3fc2);_0x5a1b69(_0x44b07c[_0xe8ac('0x15')](0x1f4,_0x56feff[_0xe8ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ab398b2..739c09d 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 _0xd7a1=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0xd7a1,0x161));var _0x1d7a=function(_0x2cb11a,_0x27f77a){_0x2cb11a=_0x2cb11a-0x0;var _0xe67271=_0xd7a1[_0x2cb11a];return _0xe67271;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d7a('0x0'));var timeout=require(_0x1d7a('0x1'));var express=require(_0x1d7a('0x2'));var router=express['Router']();var fs_extra=require(_0x1d7a('0x3'));var auth=require(_0x1d7a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1d7a('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x1d7a('0x6')]('/',auth[_0x1d7a('0x7')](),controller[_0x1d7a('0x8')]);router[_0x1d7a('0x6')]('/describe',auth[_0x1d7a('0x7')](),controller['describe']);router['get'](_0x1d7a('0x9'),auth[_0x1d7a('0x7')](),controller[_0x1d7a('0xa')]);router['post']('/',auth[_0x1d7a('0x7')](),controller[_0x1d7a('0xb')]);router[_0x1d7a('0xc')](_0x1d7a('0x9'),auth[_0x1d7a('0x7')](),controller[_0x1d7a('0xd')]);router[_0x1d7a('0xe')](_0x1d7a('0x9'),auth['isAuthenticated'](),controller[_0x1d7a('0xf')]);module[_0x1d7a('0x10')]=router; \ No newline at end of file +var _0x3ca7=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x1e62d9,_0x1f6bf8){var _0x38f3f2=function(_0x25504a){while(--_0x25504a){_0x1e62d9['push'](_0x1e62d9['shift']());}};_0x38f3f2(++_0x1f6bf8);}(_0x3ca7,0x196));var _0x73ca=function(_0x1fc36f,_0x464552){_0x1fc36f=_0x1fc36f-0x0;var _0x2856b4=_0x3ca7[_0x1fc36f];return _0x2856b4;};'use strict';var multer=require(_0x73ca('0x0'));var util=require(_0x73ca('0x1'));var path=require(_0x73ca('0x2'));var timeout=require(_0x73ca('0x3'));var express=require(_0x73ca('0x4'));var router=express['Router']();var fs_extra=require(_0x73ca('0x5'));var auth=require(_0x73ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x73ca('0x7'));var controller=require(_0x73ca('0x8'));router[_0x73ca('0x9')]('/',auth[_0x73ca('0xa')](),controller[_0x73ca('0xb')]);router[_0x73ca('0x9')](_0x73ca('0xc'),auth[_0x73ca('0xa')](),controller['describe']);router[_0x73ca('0x9')](_0x73ca('0xd'),auth[_0x73ca('0xa')](),controller['show']);router[_0x73ca('0xe')]('/',auth['isAuthenticated'](),controller[_0x73ca('0xf')]);router[_0x73ca('0x10')](_0x73ca('0xd'),auth[_0x73ca('0xa')](),controller[_0x73ca('0x11')]);router[_0x73ca('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x73ca('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 d48edb9..7f00d6c 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 _0xacc5=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x1698f8,_0x2bddcc){var _0x24d81a=function(_0x43629c){while(--_0x43629c){_0x1698f8['push'](_0x1698f8['shift']());}};_0x24d81a(++_0x2bddcc);}(_0xacc5,0x16e));var _0x5acc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xacc5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5acc('0x0'));var moment=require(_0x5acc('0x1'));module[_0x5acc('0x2')]={'type':{'type':Sequelize[_0x5acc('0x3')](_0x5acc('0x4'),_0x5acc('0x5'))},'result':{'type':Sequelize[_0x5acc('0x6')]},'transfererchannel':{'type':Sequelize[_0x5acc('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x5acc('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x5acc('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x5acc('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x5acc('0x6')]},'transferercontext':{'type':Sequelize[_0x5acc('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x5acc('0x6')]},'transfereechannel':{'type':Sequelize[_0x5acc('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x5acc('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x5acc('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5acc('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5acc('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x5acc('0x6')]},'transfereecontext':{'type':Sequelize[_0x5acc('0x6')]},'transfereeexten':{'type':Sequelize[_0x5acc('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x5acc('0x6')]},'isexternal':{'type':Sequelize[_0x5acc('0x3')](_0x5acc('0x7'),'No')},'context':{'type':Sequelize[_0x5acc('0x6')]},'extension':{'type':Sequelize[_0x5acc('0x6')]}}; \ No newline at end of file +var _0x57d0=['ENUM','blind','attended','STRING','Yes','sequelize','exports'];(function(_0x1b576c,_0x10e1ee){var _0x10db76=function(_0x4a30ee){while(--_0x4a30ee){_0x1b576c['push'](_0x1b576c['shift']());}};_0x10db76(++_0x10e1ee);}(_0x57d0,0xec));var _0x057d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x57d0[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x057d('0x0'));var moment=require('moment');module[_0x057d('0x1')]={'type':{'type':Sequelize[_0x057d('0x2')](_0x057d('0x3'),_0x057d('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x057d('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x057d('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x057d('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x057d('0x5')]},'transferercontext':{'type':Sequelize[_0x057d('0x5')]},'transfererexten':{'type':Sequelize[_0x057d('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x057d('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x057d('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x057d('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x057d('0x5')]},'transfereecontext':{'type':Sequelize[_0x057d('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x057d('0x5')]},'isexternal':{'type':Sequelize[_0x057d('0x2')](_0x057d('0x6'),'No')},'context':{'type':Sequelize[_0x057d('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index bc9b906..f4521e2 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 _0xa20f=['options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter'];(function(_0x487000,_0x203d9c){var _0x5392b1=function(_0x4a99aa){while(--_0x4a99aa){_0x487000['push'](_0x487000['shift']());}};_0x5392b1(++_0x203d9c);}(_0xa20f,0xac));var _0xfa20=function(_0x4498ac,_0x30e301){_0x4498ac=_0x4498ac-0x0;var _0x4bf1b6=_0xa20f[_0x4498ac];return _0x4bf1b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa20('0x0'));var jsonpatch=require(_0xfa20('0x1'));var rp=require(_0xfa20('0x2'));var moment=require(_0xfa20('0x3'));var BPromise=require(_0xfa20('0x4'));var Mustache=require(_0xfa20('0x5'));var util=require(_0xfa20('0x6'));var path=require(_0xfa20('0x7'));var sox=require('sox');var csv=require(_0xfa20('0x8'));var ejs=require(_0xfa20('0x9'));var fs=require('fs');var fs_extra=require(_0xfa20('0xa'));var _=require(_0xfa20('0xb'));var squel=require(_0xfa20('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa20('0xd'));var deskjs=require(_0xfa20('0xe'));var toCsv=require(_0xfa20('0x8'));var querystring=require(_0xfa20('0xf'));var Papa=require(_0xfa20('0x10'));var Redis=require(_0xfa20('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfa20('0x12'));var as=require(_0xfa20('0x13'));var hardwareService=require(_0xfa20('0x14'));var logger=require('../../config/logger')(_0xfa20('0x15'));var utils=require(_0xfa20('0x16'));var config=require(_0xfa20('0x17'));var licenseUtil=require(_0xfa20('0x18'));var db=require(_0xfa20('0x19'))['db'];function respondWithStatusCode(_0x2ccbec,_0x16f874){_0x16f874=_0x16f874||0xcc;return function(_0x5a0614){if(_0x5a0614){return _0x2ccbec[_0xfa20('0x1a')](_0x16f874);}return _0x2ccbec[_0xfa20('0x1b')](_0x16f874)[_0xfa20('0x1c')]();};}function respondWithResult(_0x2ade78,_0x4f0e47){_0x4f0e47=_0x4f0e47||0xc8;return function(_0x112b3e){if(_0x112b3e){return _0x2ade78[_0xfa20('0x1b')](_0x4f0e47)['json'](_0x112b3e);}};}function respondWithFilteredResult(_0x12377b,_0x5293db){return function(_0x45d65a){if(_0x45d65a){var _0x403c80=typeof _0x5293db[_0xfa20('0x1d')]===_0xfa20('0x1e')&&typeof _0x5293db[_0xfa20('0x1f')]===_0xfa20('0x1e');var _0x3acc2d=_0x45d65a[_0xfa20('0x20')];var _0x1b3377=_0x403c80?0x0:_0x5293db[_0xfa20('0x1d')];var _0x30d409=_0x403c80?_0x45d65a[_0xfa20('0x20')]:_0x5293db['offset']+_0x5293db[_0xfa20('0x1f')];var _0x117761;if(_0x30d409>=_0x3acc2d){_0x30d409=_0x3acc2d;_0x117761=0xc8;}else{_0x117761=0xce;}_0x12377b[_0xfa20('0x1b')](_0x117761);return _0x12377b[_0xfa20('0x21')](_0xfa20('0x22'),_0x1b3377+'-'+_0x30d409+'/'+_0x3acc2d)[_0xfa20('0x23')](_0x45d65a);}return null;};}function patchUpdates(_0x4312a4){return function(_0x2b780d){try{jsonpatch[_0xfa20('0x24')](_0x2b780d,_0x4312a4,!![]);}catch(_0x1981d0){return BPromise[_0xfa20('0x25')](_0x1981d0);}return _0x2b780d[_0xfa20('0x26')]();};}function saveUpdates(_0x511e96,_0x159741){return function(_0x2a2dc9){if(_0x2a2dc9){return _0x2a2dc9[_0xfa20('0x27')](_0x511e96)[_0xfa20('0x28')](function(_0x3ed79f){return _0x3ed79f;});}return null;};}function removeEntity(_0x4184e5,_0x1859ae){return function(_0x1e22ca){if(_0x1e22ca){return _0x1e22ca[_0xfa20('0x29')]()[_0xfa20('0x28')](function(){_0x4184e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6e98,_0xf1ce30){return function(_0x5d8744){if(!_0x5d8744){_0x2f6e98[_0xfa20('0x1a')](0x194);}return _0x5d8744;};}function handleError(_0x339773,_0x3975a3){_0x3975a3=_0x3975a3||0x1f4;return function(_0x556eac){logger['error'](_0x556eac[_0xfa20('0x2a')]);if(_0x556eac[_0xfa20('0x2b')]){delete _0x556eac[_0xfa20('0x2b')];}_0x339773[_0xfa20('0x1b')](_0x3975a3)[_0xfa20('0x2c')](_0x556eac);};}exports[_0xfa20('0x2d')]=function(_0x216563,_0x5e857b){var _0xa348cf={},_0x53075a={},_0x98b9a0={'count':0x0,'rows':[]};var _0x34f76c=_[_0xfa20('0x2e')](db[_0xfa20('0x2f')]['rawAttributes'],function(_0x4dcd59){return{'name':_0x4dcd59[_0xfa20('0x30')],'type':_0x4dcd59['type'][_0xfa20('0x31')]};});_0x53075a[_0xfa20('0x32')]=_[_0xfa20('0x2e')](_0x34f76c,_0xfa20('0x2b'));_0x53075a['query']=_[_0xfa20('0x33')](_0x216563[_0xfa20('0x34')]);_0x53075a[_0xfa20('0x35')]=_['intersection'](_0x53075a[_0xfa20('0x32')],_0x53075a[_0xfa20('0x34')]);_0xa348cf['attributes']=_[_0xfa20('0x36')](_0x53075a['model'],qs[_0xfa20('0x37')](_0x216563[_0xfa20('0x34')][_0xfa20('0x37')]));_0xa348cf[_0xfa20('0x38')]=_0xa348cf[_0xfa20('0x38')][_0xfa20('0x39')]?_0xa348cf['attributes']:_0x53075a[_0xfa20('0x32')];if(!_0x216563[_0xfa20('0x34')][_0xfa20('0x3a')](_0xfa20('0x3b'))){_0xa348cf[_0xfa20('0x1f')]=qs[_0xfa20('0x1f')](_0x216563[_0xfa20('0x34')][_0xfa20('0x1f')]);_0xa348cf['offset']=qs[_0xfa20('0x1d')](_0x216563[_0xfa20('0x34')][_0xfa20('0x1d')]);}_0xa348cf[_0xfa20('0x3c')]=qs[_0xfa20('0x3d')](_0x216563['query'][_0xfa20('0x3d')]);_0xa348cf['where']=qs[_0xfa20('0x35')](_[_0xfa20('0x3e')](_0x216563['query'],_0x53075a[_0xfa20('0x35')]),_0x34f76c);if(_0x216563['query']['filter']){_0xa348cf[_0xfa20('0x3f')]=_[_0xfa20('0x40')](_0xa348cf[_0xfa20('0x3f')],{'$or':_['map'](_0x34f76c,function(_0x1b1249){if(_0x1b1249[_0xfa20('0x41')]!==_0xfa20('0x42')){var _0xef294c={};_0xef294c[_0x1b1249[_0xfa20('0x2b')]]={'$like':'%'+_0x216563['query'][_0xfa20('0x43')]+'%'};return _0xef294c;}})});}_0xa348cf=_[_0xfa20('0x40')]({},_0xa348cf,_0x216563[_0xfa20('0x44')]);var _0x1610d5={'where':_0xa348cf['where']};return db[_0xfa20('0x2f')][_0xfa20('0x20')](_0x1610d5)[_0xfa20('0x28')](function(_0x115a77){_0x98b9a0['count']=_0x115a77;if(_0x216563[_0xfa20('0x34')]['includeAll']){_0xa348cf[_0xfa20('0x45')]=[{'all':!![]}];}return db[_0xfa20('0x2f')][_0xfa20('0x46')](_0xa348cf);})[_0xfa20('0x28')](function(_0x333b3a){_0x98b9a0[_0xfa20('0x47')]=_0x333b3a;return _0x98b9a0;})['then'](respondWithFilteredResult(_0x5e857b,_0xa348cf))[_0xfa20('0x48')](handleError(_0x5e857b,null));};exports[_0xfa20('0x49')]=function(_0x56557f,_0x1efb54){var _0x54d861={'raw':!![],'where':{'id':_0x56557f[_0xfa20('0x4a')]['id']}},_0x5afdea={};_0x5afdea[_0xfa20('0x32')]=_[_0xfa20('0x33')](db[_0xfa20('0x2f')]['rawAttributes']);_0x5afdea[_0xfa20('0x34')]=_[_0xfa20('0x33')](_0x56557f[_0xfa20('0x34')]);_0x5afdea[_0xfa20('0x35')]=_['intersection'](_0x5afdea[_0xfa20('0x32')],_0x5afdea['query']);_0x54d861[_0xfa20('0x38')]=_[_0xfa20('0x36')](_0x5afdea[_0xfa20('0x32')],qs[_0xfa20('0x37')](_0x56557f[_0xfa20('0x34')][_0xfa20('0x37')]));_0x54d861[_0xfa20('0x38')]=_0x54d861['attributes']['length']?_0x54d861[_0xfa20('0x38')]:_0x5afdea[_0xfa20('0x32')];if(_0x56557f[_0xfa20('0x34')][_0xfa20('0x4b')]){_0x54d861[_0xfa20('0x45')]=[{'all':!![]}];}_0x54d861=_[_0xfa20('0x40')]({},_0x54d861,_0x56557f[_0xfa20('0x44')]);return db[_0xfa20('0x2f')][_0xfa20('0x4c')](_0x54d861)[_0xfa20('0x28')](handleEntityNotFound(_0x1efb54,null))[_0xfa20('0x28')](respondWithResult(_0x1efb54,null))[_0xfa20('0x48')](handleError(_0x1efb54,null));};exports[_0xfa20('0x4d')]=function(_0x4279ab,_0x1c070d){return db['VoiceTransferReport'][_0xfa20('0x4d')](_0x4279ab[_0xfa20('0x4e')],{})[_0xfa20('0x28')](respondWithResult(_0x1c070d,0xc9))[_0xfa20('0x48')](handleError(_0x1c070d,null));};exports['update']=function(_0x2fdb57,_0x29a9bf){if(_0x2fdb57[_0xfa20('0x4e')]['id']){delete _0x2fdb57[_0xfa20('0x4e')]['id'];}return db[_0xfa20('0x2f')]['find']({'where':{'id':_0x2fdb57[_0xfa20('0x4a')]['id']}})[_0xfa20('0x28')](handleEntityNotFound(_0x29a9bf,null))['then'](saveUpdates(_0x2fdb57['body'],null))[_0xfa20('0x28')](respondWithResult(_0x29a9bf,null))[_0xfa20('0x48')](handleError(_0x29a9bf,null));};exports['destroy']=function(_0x33633a,_0x7399f){return db[_0xfa20('0x2f')][_0xfa20('0x4c')]({'where':{'id':_0x33633a[_0xfa20('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7399f,null))[_0xfa20('0x28')](removeEntity(_0x7399f,null))[_0xfa20('0x48')](handleError(_0x7399f,null));};exports[_0xfa20('0x4f')]=function(_0x46635d,_0x339298){return db['VoiceTransferReport'][_0xfa20('0x4f')]()['then'](respondWithResult(_0x339298,null))[_0xfa20('0x48')](handleError(_0x339298,null));}; \ No newline at end of file +var _0xa20a=['rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll'];(function(_0x3861f9,_0x483566){var _0x39d3d8=function(_0x5daf08){while(--_0x5daf08){_0x3861f9['push'](_0x3861f9['shift']());}};_0x39d3d8(++_0x483566);}(_0xa20a,0x14d));var _0xaa20=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xa20a[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0xaa20('0x0'));var rimraf=require(_0xaa20('0x1'));var zipdir=require(_0xaa20('0x2'));var jsonpatch=require(_0xaa20('0x3'));var rp=require('request-promise');var moment=require(_0xaa20('0x4'));var BPromise=require(_0xaa20('0x5'));var Mustache=require(_0xaa20('0x6'));var util=require(_0xaa20('0x7'));var path=require(_0xaa20('0x8'));var sox=require(_0xaa20('0x9'));var csv=require(_0xaa20('0xa'));var ejs=require(_0xaa20('0xb'));var fs=require('fs');var fs_extra=require(_0xaa20('0xc'));var _=require(_0xaa20('0xd'));var squel=require('squel');var crypto=require(_0xaa20('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaa20('0xf'));var toCsv=require(_0xaa20('0xa'));var querystring=require(_0xaa20('0x10'));var Papa=require(_0xaa20('0x11'));var Redis=require(_0xaa20('0x12'));var authService=require(_0xaa20('0x13'));var qs=require(_0xaa20('0x14'));var as=require(_0xaa20('0x15'));var hardwareService=require(_0xaa20('0x16'));var logger=require(_0xaa20('0x17'))(_0xaa20('0x18'));var utils=require(_0xaa20('0x19'));var config=require(_0xaa20('0x1a'));var licenseUtil=require(_0xaa20('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae093,_0x17a729){_0x17a729=_0x17a729||0xcc;return function(_0x226d2d){if(_0x226d2d){return _0x4ae093[_0xaa20('0x1c')](_0x17a729);}return _0x4ae093[_0xaa20('0x1d')](_0x17a729)[_0xaa20('0x1e')]();};}function respondWithResult(_0x480fa4,_0x5db849){_0x5db849=_0x5db849||0xc8;return function(_0x3a6b5d){if(_0x3a6b5d){return _0x480fa4[_0xaa20('0x1d')](_0x5db849)[_0xaa20('0x1f')](_0x3a6b5d);}};}function respondWithFilteredResult(_0x42b666,_0x35ca36){return function(_0x3dea48){if(_0x3dea48){var _0x231da0=typeof _0x35ca36[_0xaa20('0x20')]===_0xaa20('0x21')&&typeof _0x35ca36['limit']===_0xaa20('0x21');var _0x51f002=_0x3dea48[_0xaa20('0x22')];var _0x846fbe=_0x231da0?0x0:_0x35ca36[_0xaa20('0x20')];var _0x5ac1d6=_0x231da0?_0x3dea48[_0xaa20('0x22')]:_0x35ca36[_0xaa20('0x20')]+_0x35ca36['limit'];var _0x1dd643;if(_0x5ac1d6>=_0x51f002){_0x5ac1d6=_0x51f002;_0x1dd643=0xc8;}else{_0x1dd643=0xce;}_0x42b666[_0xaa20('0x1d')](_0x1dd643);return _0x42b666[_0xaa20('0x23')](_0xaa20('0x24'),_0x846fbe+'-'+_0x5ac1d6+'/'+_0x51f002)[_0xaa20('0x1f')](_0x3dea48);}return null;};}function patchUpdates(_0x296f70){return function(_0x368383){try{jsonpatch[_0xaa20('0x25')](_0x368383,_0x296f70,!![]);}catch(_0x3389fa){return BPromise[_0xaa20('0x26')](_0x3389fa);}return _0x368383[_0xaa20('0x27')]();};}function saveUpdates(_0x312f73,_0x3f803d){return function(_0x8d0067){if(_0x8d0067){return _0x8d0067[_0xaa20('0x28')](_0x312f73)[_0xaa20('0x29')](function(_0x36481c){return _0x36481c;});}return null;};}function removeEntity(_0x5b6918,_0x336df6){return function(_0x4308e6){if(_0x4308e6){return _0x4308e6[_0xaa20('0x2a')]()[_0xaa20('0x29')](function(){_0x5b6918['status'](0xcc)[_0xaa20('0x1e')]();});}};}function handleEntityNotFound(_0x403168,_0x467438){return function(_0x21a71c){if(!_0x21a71c){_0x403168['sendStatus'](0x194);}return _0x21a71c;};}function handleError(_0xf117e6,_0x858f1a){_0x858f1a=_0x858f1a||0x1f4;return function(_0x1b16ca){logger[_0xaa20('0x2b')](_0x1b16ca[_0xaa20('0x2c')]);if(_0x1b16ca[_0xaa20('0x2d')]){delete _0x1b16ca[_0xaa20('0x2d')];}_0xf117e6[_0xaa20('0x1d')](_0x858f1a)[_0xaa20('0x2e')](_0x1b16ca);};}exports[_0xaa20('0x2f')]=function(_0x58bfff,_0xa6463b){var _0x3c48c6={},_0x5316ce={},_0x112fa4={'count':0x0,'rows':[]};var _0x536158=_[_0xaa20('0x30')](db[_0xaa20('0x31')][_0xaa20('0x32')],function(_0x3580ea){return{'name':_0x3580ea[_0xaa20('0x33')],'type':_0x3580ea[_0xaa20('0x34')][_0xaa20('0x35')]};});_0x5316ce[_0xaa20('0x36')]=_[_0xaa20('0x30')](_0x536158,'name');_0x5316ce[_0xaa20('0x37')]=_[_0xaa20('0x38')](_0x58bfff[_0xaa20('0x37')]);_0x5316ce[_0xaa20('0x39')]=_[_0xaa20('0x3a')](_0x5316ce[_0xaa20('0x36')],_0x5316ce[_0xaa20('0x37')]);_0x3c48c6[_0xaa20('0x3b')]=_['intersection'](_0x5316ce[_0xaa20('0x36')],qs['fields'](_0x58bfff['query'][_0xaa20('0x3c')]));_0x3c48c6['attributes']=_0x3c48c6[_0xaa20('0x3b')]['length']?_0x3c48c6[_0xaa20('0x3b')]:_0x5316ce[_0xaa20('0x36')];if(!_0x58bfff[_0xaa20('0x37')][_0xaa20('0x3d')](_0xaa20('0x3e'))){_0x3c48c6['limit']=qs[_0xaa20('0x3f')](_0x58bfff['query'][_0xaa20('0x3f')]);_0x3c48c6[_0xaa20('0x20')]=qs[_0xaa20('0x20')](_0x58bfff[_0xaa20('0x37')][_0xaa20('0x20')]);}_0x3c48c6[_0xaa20('0x40')]=qs[_0xaa20('0x41')](_0x58bfff['query'][_0xaa20('0x41')]);_0x3c48c6[_0xaa20('0x42')]=qs[_0xaa20('0x39')](_[_0xaa20('0x43')](_0x58bfff[_0xaa20('0x37')],_0x5316ce[_0xaa20('0x39')]),_0x536158);if(_0x58bfff[_0xaa20('0x37')]['filter']){_0x3c48c6[_0xaa20('0x42')]=_[_0xaa20('0x44')](_0x3c48c6[_0xaa20('0x42')],{'$or':_['map'](_0x536158,function(_0x3f9d6e){if(_0x3f9d6e[_0xaa20('0x34')]!=='VIRTUAL'){var _0x87eae0={};_0x87eae0[_0x3f9d6e[_0xaa20('0x2d')]]={'$like':'%'+_0x58bfff[_0xaa20('0x37')][_0xaa20('0x45')]+'%'};return _0x87eae0;}})});}_0x3c48c6=_[_0xaa20('0x44')]({},_0x3c48c6,_0x58bfff[_0xaa20('0x46')]);var _0xd9da54={'where':_0x3c48c6[_0xaa20('0x42')]};return db[_0xaa20('0x31')][_0xaa20('0x22')](_0xd9da54)[_0xaa20('0x29')](function(_0x40a3cd){_0x112fa4[_0xaa20('0x22')]=_0x40a3cd;if(_0x58bfff[_0xaa20('0x37')][_0xaa20('0x47')]){_0x3c48c6['include']=[{'all':!![]}];}return db[_0xaa20('0x31')]['findAll'](_0x3c48c6);})[_0xaa20('0x29')](function(_0x2e8cc5){_0x112fa4[_0xaa20('0x48')]=_0x2e8cc5;return _0x112fa4;})[_0xaa20('0x29')](respondWithFilteredResult(_0xa6463b,_0x3c48c6))[_0xaa20('0x49')](handleError(_0xa6463b,null));};exports[_0xaa20('0x4a')]=function(_0x27c570,_0x20e518){var _0x1c69fa={'raw':!![],'where':{'id':_0x27c570[_0xaa20('0x4b')]['id']}},_0x12c8c8={};_0x12c8c8['model']=_[_0xaa20('0x38')](db[_0xaa20('0x31')]['rawAttributes']);_0x12c8c8['query']=_[_0xaa20('0x38')](_0x27c570[_0xaa20('0x37')]);_0x12c8c8[_0xaa20('0x39')]=_[_0xaa20('0x3a')](_0x12c8c8[_0xaa20('0x36')],_0x12c8c8[_0xaa20('0x37')]);_0x1c69fa[_0xaa20('0x3b')]=_['intersection'](_0x12c8c8[_0xaa20('0x36')],qs[_0xaa20('0x3c')](_0x27c570[_0xaa20('0x37')][_0xaa20('0x3c')]));_0x1c69fa[_0xaa20('0x3b')]=_0x1c69fa[_0xaa20('0x3b')]['length']?_0x1c69fa[_0xaa20('0x3b')]:_0x12c8c8[_0xaa20('0x36')];if(_0x27c570[_0xaa20('0x37')][_0xaa20('0x47')]){_0x1c69fa[_0xaa20('0x4c')]=[{'all':!![]}];}_0x1c69fa=_[_0xaa20('0x44')]({},_0x1c69fa,_0x27c570['options']);return db[_0xaa20('0x31')]['find'](_0x1c69fa)[_0xaa20('0x29')](handleEntityNotFound(_0x20e518,null))[_0xaa20('0x29')](respondWithResult(_0x20e518,null))['catch'](handleError(_0x20e518,null));};exports['create']=function(_0xe4861c,_0x46c71e){return db[_0xaa20('0x31')][_0xaa20('0x4d')](_0xe4861c[_0xaa20('0x4e')],{})[_0xaa20('0x29')](respondWithResult(_0x46c71e,0xc9))[_0xaa20('0x49')](handleError(_0x46c71e,null));};exports[_0xaa20('0x28')]=function(_0x148adc,_0x2bb76f){if(_0x148adc['body']['id']){delete _0x148adc[_0xaa20('0x4e')]['id'];}return db[_0xaa20('0x31')][_0xaa20('0x4f')]({'where':{'id':_0x148adc[_0xaa20('0x4b')]['id']}})[_0xaa20('0x29')](handleEntityNotFound(_0x2bb76f,null))['then'](saveUpdates(_0x148adc[_0xaa20('0x4e')],null))[_0xaa20('0x29')](respondWithResult(_0x2bb76f,null))['catch'](handleError(_0x2bb76f,null));};exports[_0xaa20('0x2a')]=function(_0x6dba2e,_0x296980){return db[_0xaa20('0x31')][_0xaa20('0x4f')]({'where':{'id':_0x6dba2e[_0xaa20('0x4b')]['id']}})[_0xaa20('0x29')](handleEntityNotFound(_0x296980,null))[_0xaa20('0x29')](removeEntity(_0x296980,null))[_0xaa20('0x49')](handleError(_0x296980,null));};exports[_0xaa20('0x50')]=function(_0x1a553b,_0x1f853c){return db[_0xaa20('0x31')][_0xaa20('0x50')]()['then'](respondWithResult(_0x1f853c,null))['catch'](handleError(_0x1f853c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index de0515c..00a4a5b 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 _0x5730=['../../config/logger','api','bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','util'];(function(_0x11b831,_0xef73c8){var _0x22c1b0=function(_0x20ac7f){while(--_0x20ac7f){_0x11b831['push'](_0x11b831['shift']());}};_0x22c1b0(++_0xef73c8);}(_0x5730,0x1e9));var _0x0573=function(_0x29b5cd,_0x3a1e6b){_0x29b5cd=_0x29b5cd-0x0;var _0x496034=_0x5730[_0x29b5cd];return _0x496034;};'use strict';var _=require('lodash');var util=require(_0x0573('0x0'));var logger=require(_0x0573('0x1'))(_0x0573('0x2'));var moment=require('moment');var BPromise=require(_0x0573('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0573('0x4'));var rimraf=require('rimraf');var config=require(_0x0573('0x5'));var attributes=require(_0x0573('0x6'));module[_0x0573('0x7')]=function(_0x2ff0b4,_0x1dab45){return _0x2ff0b4[_0x0573('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x0573('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa6=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','api','moment','path','rimraf'];(function(_0x4f0a0b,_0x425192){var _0x2150c0=function(_0x13c68d){while(--_0x13c68d){_0x4f0a0b['push'](_0x4f0a0b['shift']());}};_0x2150c0(++_0x425192);}(_0xfaa6,0xeb));var _0x6faa=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xfaa6[_0x274638];return _0x5755df;};'use strict';var _=require('lodash');var util=require(_0x6faa('0x0'));var logger=require('../../config/logger')(_0x6faa('0x1'));var moment=require(_0x6faa('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6faa('0x3'));var rimraf=require(_0x6faa('0x4'));var config=require('../../config/environment');var attributes=require(_0x6faa('0x5'));module[_0x6faa('0x6')]=function(_0x261d58,_0x316fef){return _0x261d58[_0x6faa('0x7')](_0x6faa('0x8'),attributes,{'tableName':_0x6faa('0x9'),'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 b549534..10ae89f 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 _0x6258=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5bea6d,_0x45f647){var _0x43b106=function(_0x1209f3){while(--_0x1209f3){_0x5bea6d['push'](_0x5bea6d['shift']());}};_0x43b106(++_0x45f647);}(_0x6258,0x9d));var _0x8625=function(_0x257d09,_0x415d96){_0x257d09=_0x257d09-0x0;var _0x4dd4be=_0x6258[_0x257d09];return _0x4dd4be;};'use strict';var _=require(_0x8625('0x0'));var util=require('util');var moment=require(_0x8625('0x1'));var BPromise=require(_0x8625('0x2'));var rs=require(_0x8625('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8625('0x4'))['db'];var utils=require(_0x8625('0x5'));var logger=require(_0x8625('0x6'))('rpc');var config=require(_0x8625('0x7'));var jayson=require(_0x8625('0x8'));var client=jayson['client'][_0x8625('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d5442,_0x55dd19,_0x2f26ca){return new BPromise(function(_0x51f0a5,_0x1be37c){return client[_0x8625('0xa')](_0x7d5442,_0x2f26ca)[_0x8625('0xb')](function(_0x20dbd2){logger[_0x8625('0xc')](_0x8625('0xd'),_0x55dd19,_0x8625('0xe'));logger[_0x8625('0xf')](_0x8625('0x10'),_0x55dd19,'request\x20sent',JSON[_0x8625('0x11')](_0x20dbd2));if(_0x20dbd2[_0x8625('0x12')]){if(_0x20dbd2['error']['code']===0x1f4){logger[_0x8625('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x55dd19,_0x20dbd2[_0x8625('0x12')][_0x8625('0x13')]);return _0x1be37c(_0x20dbd2[_0x8625('0x12')][_0x8625('0x13')]);}logger[_0x8625('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x55dd19,_0x20dbd2['error'][_0x8625('0x13')]);return _0x51f0a5(_0x20dbd2[_0x8625('0x12')][_0x8625('0x13')]);}else{logger[_0x8625('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x55dd19,_0x8625('0xe'));_0x51f0a5(_0x20dbd2[_0x8625('0x14')][_0x8625('0x13')]);}})[_0x8625('0x15')](function(_0x438f07){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x55dd19,_0x438f07);_0x1be37c(_0x438f07);});});}exports[_0x8625('0x16')]=function(_0x427751){var _0x580b66=this;return new Promise(function(_0x4c323b,_0x4b5774){return db[_0x8625('0x17')][_0x8625('0x18')](_0x427751[_0x8625('0x19')],{'raw':_0x427751[_0x8625('0x1a')]?_0x427751['options']['raw']===undefined?!![]:![]:!![]})[_0x8625('0xb')](function(_0x2decd5){logger[_0x8625('0xc')](_0x8625('0x16'),_0x427751);logger[_0x8625('0xf')](_0x8625('0x16'),_0x427751,JSON[_0x8625('0x11')](_0x2decd5));_0x4c323b(_0x2decd5);})[_0x8625('0x15')](function(_0x4fa479){logger[_0x8625('0x12')](_0x8625('0x16'),_0x4fa479[_0x8625('0x13')],_0x427751);_0x4b5774(_0x580b66['error'](0x1f4,_0x4fa479['message']));});});}; \ No newline at end of file +var _0xb114=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x347481,_0xbf1d24){var _0x59ab4e=function(_0x42a068){while(--_0x42a068){_0x347481['push'](_0x347481['shift']());}};_0x59ab4e(++_0xbf1d24);}(_0xb114,0xb6));var _0x4b11=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb114[_0x35da42];return _0x370035;};'use strict';var _=require('lodash');var util=require(_0x4b11('0x0'));var moment=require(_0x4b11('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b11('0x2'));var fs=require('fs');var Redis=require(_0x4b11('0x3'));var db=require(_0x4b11('0x4'))['db'];var utils=require(_0x4b11('0x5'));var logger=require(_0x4b11('0x6'))('rpc');var config=require(_0x4b11('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46b501,_0x11bc7c,_0x2749bc){return new BPromise(function(_0x5da689,_0x3fa2ab){return client[_0x4b11('0x9')](_0x46b501,_0x2749bc)[_0x4b11('0xa')](function(_0x484096){logger[_0x4b11('0xb')](_0x4b11('0xc'),_0x11bc7c,_0x4b11('0xd'));logger[_0x4b11('0xe')](_0x4b11('0xf'),_0x11bc7c,'request\x20sent',JSON[_0x4b11('0x10')](_0x484096));if(_0x484096[_0x4b11('0x11')]){if(_0x484096[_0x4b11('0x11')][_0x4b11('0x12')]===0x1f4){logger[_0x4b11('0x11')](_0x4b11('0xc'),_0x11bc7c,_0x484096[_0x4b11('0x11')][_0x4b11('0x13')]);return _0x3fa2ab(_0x484096[_0x4b11('0x11')][_0x4b11('0x13')]);}logger[_0x4b11('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x11bc7c,_0x484096[_0x4b11('0x11')][_0x4b11('0x13')]);return _0x5da689(_0x484096[_0x4b11('0x11')][_0x4b11('0x13')]);}else{logger[_0x4b11('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x11bc7c,_0x4b11('0xd'));_0x5da689(_0x484096[_0x4b11('0x14')][_0x4b11('0x13')]);}})[_0x4b11('0x15')](function(_0x2ef8f2){logger['error'](_0x4b11('0xc'),_0x11bc7c,_0x2ef8f2);_0x3fa2ab(_0x2ef8f2);});});}exports[_0x4b11('0x16')]=function(_0x15a6d3){var _0x9b0b86=this;return new Promise(function(_0x527910,_0x3a53d3){return db[_0x4b11('0x17')][_0x4b11('0x18')](_0x15a6d3[_0x4b11('0x19')],{'raw':_0x15a6d3[_0x4b11('0x1a')]?_0x15a6d3['options'][_0x4b11('0x1b')]===undefined?!![]:![]:!![]})[_0x4b11('0xa')](function(_0xb81b3d){logger[_0x4b11('0xb')](_0x4b11('0x16'),_0x15a6d3);logger[_0x4b11('0xe')](_0x4b11('0x16'),_0x15a6d3,JSON[_0x4b11('0x10')](_0xb81b3d));_0x527910(_0xb81b3d);})[_0x4b11('0x15')](function(_0x411eba){logger[_0x4b11('0x11')](_0x4b11('0x16'),_0x411eba[_0x4b11('0x13')],_0x15a6d3);_0x3a53d3(_0x9b0b86[_0x4b11('0x11')](0x1f4,_0x411eba[_0x4b11('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7188192..a0dfcc6 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 _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x70e0,0x17b));var _0x070e=function(_0x3da3bb,_0x581152){_0x3da3bb=_0x3da3bb-0x0;var _0x418f83=_0x70e0[_0x3da3bb];return _0x418f83;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4acdd0,_0x4d1f59){_0x4acdd0=_0x4acdd0-0x0;var _0x392ba5=_0xf3cd[_0x4acdd0];return _0x392ba5;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0d4130c..76d6d6b 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 _0x24cd=['number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','agent','VoiceChannels','all','filter','UserId','sessionId','length','originate','info','body','json','callerId','callbackUrl','entityFound:','format','user:%s','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../config/environment','bluebird','jayson/promise','client','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate'];(function(_0x424bd3,_0x8760d8){var _0x1fdade=function(_0x510862){while(--_0x510862){_0x424bd3['push'](_0x424bd3['shift']());}};_0x1fdade(++_0x8760d8);}(_0x24cd,0x83));var _0xd24c=function(_0x35cbee,_0x3a98be){_0x35cbee=_0x35cbee-0x0;var _0x1d1929=_0x24cd[_0x35cbee];return _0x1d1929;};'use strict';var path=require(_0xd24c('0x0'));var fs=require('fs');var _=require(_0xd24c('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xd24c('0x2'));var util=require('util');var BPromise=require(_0xd24c('0x3'));var jayson=require(_0xd24c('0x4'));var amiClient=jayson[_0xd24c('0x5')]['http']({'port':0x232a});var logger=require(_0xd24c('0x6'))(_0xd24c('0x7'));var Redis=require('ioredis');config[_0xd24c('0x8')]=_[_0xd24c('0x9')](config[_0xd24c('0x8')],{'host':_0xd24c('0xa'),'port':0x18eb});var io=require(_0xd24c('0xb'))(new Redis(config[_0xd24c('0x8')]));var Schema=require(_0xd24c('0xc'));var originateValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xd24c('0xe')]},'callerId':{'type':_0xd24c('0xf')},'callbackUrl':{'type':_0xd24c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],_0xd24c('0x10')]},'sessionId':{'type':_0xd24c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],_0xd24c('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],_0xd24c('0x10')]},'sessionId':{'type':'string','required':[!![],_0xd24c('0x11')]},'transferNumber':{'type':_0xd24c('0xf'),'required':[!![],_0xd24c('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],_0xd24c('0x10')]},'sessionId':{'type':_0xd24c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],_0xd24c('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd24c('0xd'),'required':[!![],_0xd24c('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd24c('0x10')]}});function emit(_0x3aa193,_0x1a1111,_0x3221a8){logger['info'](_0x3aa193,_0x1a1111,JSON['stringify'](_0x3221a8));io['to'](_0x3aa193)[_0xd24c('0x13')](_0x1a1111,_0x3221a8);}function handleError(_0x34f882){return function(_0x170d59){console['log'](_0xd24c('0x14'),_0x170d59,_0x170d59 instanceof RangeError);logger[_0xd24c('0x15')](_0x170d59[_0xd24c('0x16')]);if(_0x170d59 instanceof RangeError){if(_0x170d59[_0xd24c('0x17')]){delete _0x170d59['name'];}_0x34f882[_0xd24c('0x18')](0x194)['send'](_0x170d59);}else{if(_0x170d59[_0xd24c('0x17')]){delete _0x170d59[_0xd24c('0x17')];}_0x34f882[_0xd24c('0x18')](0x1f4)[_0xd24c('0x19')](_0x170d59);}};}function checkError(){return function(_0x333416){if(!_0x333416){throw new RangeError(_0xd24c('0x1a'));}return _0x333416;};}function respondWithRpcPromise(_0x2f7439,_0x298d73){return new BPromise(function(_0x17375b,_0x206ce7){var _0x48fffd=amiClient;return _0x48fffd[_0xd24c('0x1b')](_0x2f7439,_0x298d73)[_0xd24c('0x1c')](function(_0x2549d0){if(_0x2549d0['error']){if(_0x2549d0[_0xd24c('0x15')][_0xd24c('0x1d')]===0x1f4){return _0x206ce7(_0x2549d0[_0xd24c('0x15')]['message']);}return _0x17375b(_0x2549d0[_0xd24c('0x15')][_0xd24c('0x1e')]);}else{_0x17375b(_0x2549d0[_0xd24c('0x1f')]);}})[_0xd24c('0x20')](function(_0x574cd4){_0x206ce7(_0x574cd4);});});}function getAgent(_0x5ec0b1){return db[_0xd24c('0x21')]['findOne']({'where':{'id':_0x5ec0b1,'role':_0xd24c('0x22')}})[_0xd24c('0x1c')](checkError());}function getAgentCheckSession(_0x325fcc,_0x4c0d99){return new BPromise(function(_0x4cb1b3,_0x26fd85){var _0x14d44a=respondWithRpcPromise(_0xd24c('0x23'));var _0x160f03=getAgent(_0x325fcc);Promise[_0xd24c('0x24')]([_0x14d44a,_0x160f03])[_0xd24c('0x1c')](function(_0x1be144){var _0x20d37f=_0x1be144[0x0];var _0x1c48d6=_0x1be144[0x1];var _0x3b14c7=_[_0xd24c('0x25')](_0x20d37f['rows'],function(_0x4e128b){return _0x4e128b[_0xd24c('0x26')]==_0x1c48d6['id']&&_0x4e128b[_0xd24c('0x27')]==_0x4c0d99;});if(_0x3b14c7[_0xd24c('0x28')]==0x1){_0x4cb1b3(_0x1c48d6);}else{_0x26fd85(new RangeError('sessionId\x20'+_0x4c0d99+'\x20not\x20found!'));}});});}exports[_0xd24c('0x29')]=function(_0x1678e4,_0x34a64c){logger[_0xd24c('0x2a')]('originate\x20fired:',_0x1678e4[_0xd24c('0x2b')]);var _0x2ae0ce=originateValidation[_0xd24c('0xc')](_0x1678e4[_0xd24c('0x2b')]);if(_0x2ae0ce[_0xd24c('0x28')]>0x0){return _0x34a64c[_0xd24c('0x18')](0x190)[_0xd24c('0x2c')](_0x2ae0ce);}var _0x1935f3=_0x1678e4[_0xd24c('0x2b')]['userId'];var _0x4be898=_0x1678e4['body']['callNumber'];var _0x23d014=_0x1678e4[_0xd24c('0x2b')][_0xd24c('0x2d')];var _0x1113a6=_0x1678e4[_0xd24c('0x2b')][_0xd24c('0x2e')];return getAgent(_0x1935f3)[_0xd24c('0x1c')](function(_0x483e3f){logger[_0xd24c('0x2a')](_0xd24c('0x2f'),_0x483e3f[_0xd24c('0x17')]);emit(util[_0xd24c('0x30')](_0xd24c('0x31'),_0x483e3f[_0xd24c('0x17')]),'webbar:originate',{'callNumber':_0x4be898,'callerId':_0x23d014,'callbackUrl':_0x1113a6});return _0x34a64c[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':'originate\x20executed!'});})[_0xd24c('0x20')](handleError(_0x34a64c));};exports[_0xd24c('0x32')]=function(_0x4bf183,_0x1e5718){logger[_0xd24c('0x2a')]('hangup\x20fired:',_0x4bf183[_0xd24c('0x2b')]);var _0x36d013=hangupValidation[_0xd24c('0xc')](_0x4bf183[_0xd24c('0x2b')]);if(_0x36d013['length']>0x0){return _0x1e5718[_0xd24c('0x18')](0x190)['json'](_0x36d013);}var _0x2a93af=_0x4bf183['body']['userId'];var _0x4b1a7e=_0x4bf183[_0xd24c('0x2b')]['sessionId'];return getAgent(_0x2a93af)['then'](function(_0x66f45){logger[_0xd24c('0x2a')](_0xd24c('0x2f'),_0x66f45[_0xd24c('0x17')]);emit(util['format'](_0xd24c('0x31'),_0x66f45['name']),_0xd24c('0x33'),{'sessionId':_0x4b1a7e});return _0x1e5718[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':_0xd24c('0x34')});})[_0xd24c('0x20')](handleError(_0x1e5718));};exports[_0xd24c('0x35')]=function(_0x17f070,_0xd20086){logger[_0xd24c('0x2a')](_0xd24c('0x36'),_0x17f070['body']);var _0x2607e5=answerValidation[_0xd24c('0xc')](_0x17f070['body']);if(_0x2607e5[_0xd24c('0x28')]>0x0){return _0xd20086[_0xd24c('0x18')](0x190)['json'](_0x2607e5);}var _0x2f2981=_0x17f070['body'][_0xd24c('0x37')];var _0x2d46b8=_0x17f070[_0xd24c('0x2b')][_0xd24c('0x27')];return getAgent(_0x2f2981)[_0xd24c('0x1c')](function(_0x5bd78b){logger[_0xd24c('0x2a')]('entityFound:',_0x5bd78b[_0xd24c('0x17')]);emit(util['format'](_0xd24c('0x31'),_0x5bd78b[_0xd24c('0x17')]),'webbar:answer',{'sessionId':_0x2d46b8});return _0xd20086[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':'answer\x20executed!'});})[_0xd24c('0x20')](handleError(_0xd20086));};exports['hold']=function(_0x548080,_0x5dd31a){logger[_0xd24c('0x2a')](_0xd24c('0x38'),_0x548080['body']);var _0x516734=holdValidation[_0xd24c('0xc')](_0x548080[_0xd24c('0x2b')]);if(_0x516734[_0xd24c('0x28')]>0x0){return _0x5dd31a[_0xd24c('0x18')](0x190)['json'](_0x516734);}var _0x2931b7=_0x548080[_0xd24c('0x2b')]['userId'];var _0x1ee699=_0x548080[_0xd24c('0x2b')][_0xd24c('0x27')];return getAgent(_0x2931b7)['then'](function(_0x3039aa){logger['info'](_0xd24c('0x2f'),_0x3039aa[_0xd24c('0x17')]);emit(util[_0xd24c('0x30')](_0xd24c('0x31'),_0x3039aa['name']),_0xd24c('0x39'),{'sessionId':_0x1ee699});return _0x5dd31a[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':_0xd24c('0x3a')});})[_0xd24c('0x20')](handleError(_0x5dd31a));};exports[_0xd24c('0x3b')]=function(_0x3ce7d0,_0x34321f){logger[_0xd24c('0x2a')](_0xd24c('0x3c'),_0x3ce7d0[_0xd24c('0x2b')]);var _0x5c2b2c=unholdValidation[_0xd24c('0xc')](_0x3ce7d0[_0xd24c('0x2b')]);if(_0x5c2b2c['length']>0x0){return _0x34321f['status'](0x190)['json'](_0x5c2b2c);}var _0x252f2e=_0x3ce7d0[_0xd24c('0x2b')][_0xd24c('0x37')];var _0x4668d2=_0x3ce7d0[_0xd24c('0x2b')][_0xd24c('0x27')];return getAgent(_0x252f2e)[_0xd24c('0x1c')](function(_0xd9b530){logger[_0xd24c('0x2a')](_0xd24c('0x2f'),_0xd9b530[_0xd24c('0x17')]);emit(util['format'](_0xd24c('0x31'),_0xd9b530[_0xd24c('0x17')]),'webbar:unhold',{'sessionId':_0x4668d2});return _0x34321f[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':_0xd24c('0x3d')});})['catch'](handleError(_0x34321f));};exports['calls']=function(_0xdf1f18,_0xd35f63){logger[_0xd24c('0x2a')](_0xd24c('0x3e'),_0xd35f63[_0xd24c('0x2b')]);var _0x3dee09=callsValidation[_0xd24c('0xc')](_0xdf1f18[_0xd24c('0x2b')]);if(_0x3dee09['length']>0x0){return _0xd35f63[_0xd24c('0x18')](0x190)['json'](_0x3dee09);}var _0x4844fc=_0xdf1f18[_0xd24c('0x2b')]['userId'];var _0x4f6b11=respondWithRpcPromise(_0xd24c('0x23'));var _0x1b649e=getAgent(_0x4844fc);return Promise[_0xd24c('0x24')]([_0x4f6b11,_0x1b649e])[_0xd24c('0x1c')](function(_0x4890d6){var _0x66db4a=_0x4890d6[0x0];var _0x1e99e7=_0x4890d6[0x1];var _0x3e6c3b=_[_0xd24c('0x25')](_0x66db4a[_0xd24c('0x3f')],function(_0xcb46e8){return _0xcb46e8[_0xd24c('0x26')]==_0x1e99e7['id'];});return _0xd35f63['status'](0xc8)['json']({'count':_0x3e6c3b['length'],'rows':_0x3e6c3b});})[_0xd24c('0x20')](handleError(_0xd35f63));};exports[_0xd24c('0x40')]=function(_0x42a917,_0x186042){logger[_0xd24c('0x2a')](_0xd24c('0x41'),_0x42a917['body']);var _0x1f2632=conferenceValidation[_0xd24c('0xc')](_0x42a917['body']);if(_0x1f2632[_0xd24c('0x28')]>0x0){return _0x186042[_0xd24c('0x18')](0x190)[_0xd24c('0x2c')](_0x1f2632);}var _0x45030d=_0x42a917[_0xd24c('0x2b')]['userId'];return getAgent(_0x45030d)['then'](function(_0x2a6d13){logger[_0xd24c('0x2a')]('entityFound:',_0x2a6d13[_0xd24c('0x17')]);emit(util[_0xd24c('0x30')]('user:%s',_0x2a6d13[_0xd24c('0x17')]),_0xd24c('0x42'));return _0x186042[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':_0xd24c('0x43')});})[_0xd24c('0x20')](handleError(_0x186042));};exports[_0xd24c('0x44')]=function(_0x4af868,_0x522587){logger['info'](_0xd24c('0x45'),_0x4af868['body']);var _0x5293b4=transferValidation['validate'](_0x4af868[_0xd24c('0x2b')]);if(_0x5293b4[_0xd24c('0x28')]>0x0){return _0x522587[_0xd24c('0x18')](0x190)['json'](_0x5293b4);}var _0x312c4c=_0x4af868[_0xd24c('0x2b')][_0xd24c('0x37')];var _0x2daf65=_0x4af868[_0xd24c('0x2b')][_0xd24c('0x27')];var _0x52567d=_0x4af868[_0xd24c('0x2b')][_0xd24c('0x46')];return getAgent(_0x312c4c)['then'](function(_0x24ede8){logger[_0xd24c('0x2a')](_0xd24c('0x2f'),_0x24ede8[_0xd24c('0x17')]);emit(util[_0xd24c('0x30')](_0xd24c('0x31'),_0x24ede8[_0xd24c('0x17')]),_0xd24c('0x47'),{'sessionId':_0x2daf65,'transferNumber':_0x52567d});return _0x522587[_0xd24c('0x18')](0xc8)[_0xd24c('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0xd24c('0x20')](handleError(_0x522587));}; \ No newline at end of file +var _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x2f4d1b,_0x1f65be){var _0x5da6c2=function(_0x5cd4a2){while(--_0x5cd4a2){_0x2f4d1b['push'](_0x2f4d1b['shift']());}};_0x5da6c2(++_0x1f65be);}(_0x7341,0xe4));var _0x1734=function(_0x4cd294,_0x5f02b6){_0x4cd294=_0x4cd294-0x0;var _0x22278e=_0x7341[_0x4cd294];return _0x22278e;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 995f284..c066389 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 _0x7096=['removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x435d43,_0x20645a){var _0x238f8e=function(_0x1d8059){while(--_0x1d8059){_0x435d43['push'](_0x435d43['shift']());}};_0x238f8e(++_0x20645a);}(_0x7096,0x10c));var _0x6709=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7096[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0x8')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router['get']('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router[_0x6709('0x8')](_0x6709('0x11'),auth[_0x6709('0x9')](),controller[_0x6709('0x12')]);router[_0x6709('0x8')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x14')]);router[_0x6709('0x15')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0x16')]);router['post'](_0x6709('0xe'),auth['isAuthenticated'](),controller[_0x6709('0x17')]);router['post'](_0x6709('0x18'),auth[_0x6709('0x9')](),controller[_0x6709('0x19')]);router[_0x6709('0x15')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x6709('0x15')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x1a')]);router[_0x6709('0x15')](_0x6709('0x1b'),controller['notify']);router[_0x6709('0x15')](_0x6709('0x1c'),auth[_0x6709('0x9')](),controller[_0x6709('0x1d')]);router['put'](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x1f')]);router[_0x6709('0x20')](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x21')]);router[_0x6709('0x20')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0x22')]);router[_0x6709('0x20')]('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x23')]);router[_0x6709('0x20')]('/:id/users',auth[_0x6709('0x9')](),controller[_0x6709('0x24')]);module[_0x6709('0x25')]=router; \ No newline at end of file +var _0x93e9=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0x93e9,0xcc));var _0x993e=function(_0x1ebcdb,_0x2fbebb){_0x1ebcdb=_0x1ebcdb-0x0;var _0x57429b=_0x93e9[_0x1ebcdb];return _0x57429b;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getDispositions']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x993e('0x9')]('/:id/users',auth[_0x993e('0xa')](),controller['getAgents']);router['get'](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x12')]);router[_0x993e('0x13')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);router[_0x993e('0x13')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller[_0x993e('0x15')]);router[_0x993e('0x13')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x16')]);router[_0x993e('0x13')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller['addAgents']);router[_0x993e('0x13')](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x18')]);router[_0x993e('0x13')](_0x993e('0x19'),controller['notify']);router[_0x993e('0x13')](_0x993e('0x1a'),auth[_0x993e('0xa')](),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0x1d')]);router['delete'](_0x993e('0xd'),auth['isAuthenticated'](),controller[_0x993e('0x1e')]);router[_0x993e('0x1f')](_0x993e('0xf'),auth['isAuthenticated'](),controller[_0x993e('0x20')]);router[_0x993e('0x1f')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x21')]);router[_0x993e('0x1f')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller[_0x993e('0x22')]);module[_0x993e('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 202b66e..3135ad9 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 _0x1ff9=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1ff9,0x1e5));var _0x91ff=function(_0x3607f9,_0x14a452){_0x3607f9=_0x3607f9-0x0;var _0x1f2318=_0x1ff9[_0x3607f9];return _0x1f2318;};'use strict';var Sequelize=require(_0x91ff('0x0'));var rs=require(_0x91ff('0x1'));module[_0x91ff('0x2')]={'name':{'type':Sequelize[_0x91ff('0x3')],'unique':_0x91ff('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x91ff('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x91ff('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x91ff('0x3')]},'type':{'type':Sequelize[_0x91ff('0x5')](_0x91ff('0x6'),_0x91ff('0x7'))},'accountSid':{'type':Sequelize[_0x91ff('0x3')]},'baseUrl':{'type':Sequelize[_0x91ff('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x91ff('0x8')],'defaultValue':function(){return _0x91ff('0x9');}},'notificationSound':{'type':Sequelize[_0x91ff('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x91ff('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x91ff('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x91ff('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91ff('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91ff('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x91ff('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x91ff('0xa')],'defaultValue':![],'comment':_0x91ff('0xc'),'set':function(_0x2c7916){if(!_0x2c7916){this['setDataValue'](_0x91ff('0xd'),null);}this[_0x91ff('0xe')](_0x91ff('0xf'),_0x2c7916);}},'description':{'type':Sequelize[_0x91ff('0x3')]}}; \ No newline at end of file +var _0x5d20=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','twilio'];(function(_0x29a578,_0x406599){var _0x1cebfe=function(_0x2cb7da){while(--_0x2cb7da){_0x29a578['push'](_0x29a578['shift']());}};_0x1cebfe(++_0x406599);}(_0x5d20,0x181));var _0x05d2=function(_0x4a5dbc,_0xf67508){_0x4a5dbc=_0x4a5dbc-0x0;var _0x307589=_0x5d20[_0x4a5dbc];return _0x307589;};'use strict';var Sequelize=require(_0x05d2('0x0'));var rs=require('randomstring');module[_0x05d2('0x1')]={'name':{'type':Sequelize[_0x05d2('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x05d2('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x05d2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x05d2('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x05d2('0x2')]},'type':{'type':Sequelize[_0x05d2('0x3')](_0x05d2('0x4'),_0x05d2('0x5'))},'accountSid':{'type':Sequelize[_0x05d2('0x2')]},'baseUrl':{'type':Sequelize[_0x05d2('0x2')]},'authToken':{'type':Sequelize[_0x05d2('0x2')]},'notificationTemplate':{'type':Sequelize[_0x05d2('0x6')],'defaultValue':function(){return _0x05d2('0x7');}},'notificationSound':{'type':Sequelize[_0x05d2('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x05d2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x05d2('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x05d2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x05d2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x05d2('0x9')],'comment':_0x05d2('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x05d2('0x8')],'defaultValue':![],'comment':_0x05d2('0xb'),'set':function(_0x778e4e){if(!_0x778e4e){this[_0x05d2('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue']('mandatoryDisposition',_0x778e4e);}},'description':{'type':Sequelize[_0x05d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d0c6a55..71576ff 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 _0x57fd=['close','unmanaged','messageId','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','merge','options','WhatsappAccount','includeAll','include','findAll','rows','params','mandatoryDispositionPause','rawAttributes','length','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','findOne','hasOwnProperty','order','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','destroy','bulkCreate','findAndCountAll','finally','send','json','getApplications','notify','whatsapp','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','From','replace','Body','MessageSid','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','push'];(function(_0x405d5b,_0x367d49){var _0x26b41c=function(_0x4c539a){while(--_0x4c539a){_0x405d5b['push'](_0x405d5b['shift']());}};_0x26b41c(++_0x367d49);}(_0x57fd,0x189));var _0xd57f=function(_0x2e791a,_0x159643){_0x2e791a=_0x2e791a-0x0;var _0x425644=_0x57fd[_0x2e791a];return _0x425644;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd57f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd57f('0x1'));var rp=require(_0xd57f('0x2'));var moment=require(_0xd57f('0x3'));var BPromise=require(_0xd57f('0x4'));var Mustache=require(_0xd57f('0x5'));var util=require('util');var path=require(_0xd57f('0x6'));var sox=require(_0xd57f('0x7'));var csv=require('to-csv');var ejs=require(_0xd57f('0x8'));var fs=require('fs');var fs_extra=require(_0xd57f('0x9'));var _=require(_0xd57f('0xa'));var squel=require('squel');var crypto=require(_0xd57f('0xb'));var jsforce=require(_0xd57f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd57f('0xd'));var querystring=require('querystring');var Papa=require(_0xd57f('0xe'));var Redis=require(_0xd57f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd57f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd57f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xd57f('0x12'));var db=require(_0xd57f('0x13'))['db'];config[_0xd57f('0x14')]=_[_0xd57f('0x15')](config[_0xd57f('0x14')],{'host':_0xd57f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd57f('0x14')]));require('./whatsappAccount.socket')[_0xd57f('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd57f('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x446253,_0x566bd3,_0x37c7b3,_0x3b6cd1){return new BPromise(function(_0x2054a2,_0x55c366){var _0x569a35=_0x3b6cd1||client;return _0x569a35[_0xd57f('0x19')](_0x446253,_0x37c7b3)[_0xd57f('0x1a')](function(_0x3587d4){logger['info'](_0xd57f('0x1b'),_0x566bd3,_0xd57f('0x1c'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x566bd3,_0xd57f('0x1c'),JSON[_0xd57f('0x1d')](_0x3587d4));if(_0x3587d4[_0xd57f('0x1e')]){if(_0x3587d4[_0xd57f('0x1e')][_0xd57f('0x1f')]===0x1f4){logger[_0xd57f('0x1e')](_0xd57f('0x1b'),_0x566bd3,_0x3587d4['error'][_0xd57f('0x20')]);return _0x55c366(_0x3587d4['error'][_0xd57f('0x20')]);}logger[_0xd57f('0x1e')](_0xd57f('0x1b'),_0x566bd3,_0x3587d4['error'][_0xd57f('0x20')]);return _0x2054a2(_0x3587d4[_0xd57f('0x1e')]['message']);}else{logger[_0xd57f('0x21')](_0xd57f('0x1b'),_0x566bd3,_0xd57f('0x1c'));_0x2054a2(_0x3587d4[_0xd57f('0x22')]['message']);}})[_0xd57f('0x23')](function(_0x1a6fc6){logger[_0xd57f('0x1e')](_0xd57f('0x1b'),_0x566bd3,_0x1a6fc6);_0x55c366(_0x1a6fc6);});});}function respondWithStatusCode(_0x198920,_0x511d20){_0x511d20=_0x511d20||0xcc;return function(_0x362835){if(_0x362835){return _0x198920[_0xd57f('0x24')](_0x511d20);}return _0x198920[_0xd57f('0x25')](_0x511d20)[_0xd57f('0x26')]();};}function respondWithResult(_0x21dd2b,_0x1490c6){_0x1490c6=_0x1490c6||0xc8;return function(_0x2161fc){if(_0x2161fc){return _0x21dd2b[_0xd57f('0x25')](_0x1490c6)['json'](_0x2161fc);}};}function respondWithFilteredResult(_0x310116,_0x2a53b7){return function(_0x542d5a){if(_0x542d5a){var _0x3e5fb5=typeof _0x2a53b7['offset']===_0xd57f('0x27')&&typeof _0x2a53b7[_0xd57f('0x28')]===_0xd57f('0x27');var _0x50449c=_0x542d5a[_0xd57f('0x29')];var _0x54e37a=_0x3e5fb5?0x0:_0x2a53b7['offset'];var _0x1dfb74=_0x3e5fb5?_0x542d5a['count']:_0x2a53b7[_0xd57f('0x2a')]+_0x2a53b7[_0xd57f('0x28')];var _0x6de2fe;if(_0x1dfb74>=_0x50449c){_0x1dfb74=_0x50449c;_0x6de2fe=0xc8;}else{_0x6de2fe=0xce;}_0x310116[_0xd57f('0x25')](_0x6de2fe);return _0x310116[_0xd57f('0x2b')](_0xd57f('0x2c'),_0x54e37a+'-'+_0x1dfb74+'/'+_0x50449c)['json'](_0x542d5a);}return null;};}function patchUpdates(_0x406948){return function(_0x76aec){try{jsonpatch[_0xd57f('0x2d')](_0x76aec,_0x406948,!![]);}catch(_0x4808d7){return BPromise[_0xd57f('0x2e')](_0x4808d7);}return _0x76aec[_0xd57f('0x2f')]();};}function saveUpdates(_0x138ec9,_0x4af99c){return function(_0x3be926){if(_0x3be926){return _0x3be926[_0xd57f('0x30')](_0x138ec9)[_0xd57f('0x1a')](function(_0x4b9529){return _0x4b9529;});}return null;};}function removeEntity(_0x1a3953,_0x9c8056){return function(_0x2cd9d4){if(_0x2cd9d4){return _0x2cd9d4['destroy']()[_0xd57f('0x1a')](function(){var _0x17f4c9=_0x2cd9d4[_0xd57f('0x31')]({'plain':!![]});var _0xe75109=_0xd57f('0x32');return db[_0xd57f('0x33')]['destroy']({'where':{'type':_0xe75109,'resourceId':_0x17f4c9['id']}})['then'](function(){return _0x2cd9d4;});})[_0xd57f('0x1a')](function(){_0x1a3953[_0xd57f('0x25')](0xcc)[_0xd57f('0x26')]();});}};}function handleEntityNotFound(_0x7862ee,_0x349dcb){return function(_0x83259d){if(!_0x83259d){_0x7862ee[_0xd57f('0x24')](0x194);}return _0x83259d;};}function handleError(_0x4b4fe2,_0x571342){_0x571342=_0x571342||0x1f4;return function(_0x3e1ce7){logger[_0xd57f('0x1e')](_0x3e1ce7[_0xd57f('0x34')]);if(_0x3e1ce7['name']){delete _0x3e1ce7[_0xd57f('0x35')];}_0x4b4fe2[_0xd57f('0x25')](_0x571342)['send'](_0x3e1ce7);};}exports[_0xd57f('0x36')]=function(_0x1195ea,_0x58d5b2){var _0x544207={'include':[{'model':db[_0xd57f('0x37')],'as':'mandatoryDispositionPause'}]},_0x2b4a34={},_0x258695={'count':0x0,'rows':[]};var _0x412379=_[_0xd57f('0x38')](db['WhatsappAccount']['rawAttributes'],function(_0x1cee4e){return{'name':_0x1cee4e[_0xd57f('0x39')],'type':_0x1cee4e[_0xd57f('0x3a')]['key']};});_0x2b4a34[_0xd57f('0x3b')]=_['map'](_0x412379,_0xd57f('0x35'));_0x2b4a34[_0xd57f('0x3c')]=_[_0xd57f('0x3d')](_0x1195ea[_0xd57f('0x3c')]);_0x2b4a34[_0xd57f('0x3e')]=_['intersection'](_0x2b4a34['model'],_0x2b4a34[_0xd57f('0x3c')]);_0x544207[_0xd57f('0x3f')]=_[_0xd57f('0x40')](_0x2b4a34[_0xd57f('0x3b')],qs[_0xd57f('0x41')](_0x1195ea[_0xd57f('0x3c')][_0xd57f('0x41')]));_0x544207[_0xd57f('0x3f')]=_0x544207[_0xd57f('0x3f')]['length']?_0x544207[_0xd57f('0x3f')]:_0x2b4a34[_0xd57f('0x3b')];if(!_0x1195ea[_0xd57f('0x3c')]['hasOwnProperty'](_0xd57f('0x42'))){_0x544207['limit']=qs['limit'](_0x1195ea[_0xd57f('0x3c')][_0xd57f('0x28')]);_0x544207[_0xd57f('0x2a')]=qs[_0xd57f('0x2a')](_0x1195ea[_0xd57f('0x3c')][_0xd57f('0x2a')]);}_0x544207['order']=qs[_0xd57f('0x43')](_0x1195ea[_0xd57f('0x3c')]['sort']);_0x544207['where']=qs[_0xd57f('0x3e')](_[_0xd57f('0x44')](_0x1195ea[_0xd57f('0x3c')],_0x2b4a34['filters']),_0x412379);if(_0x1195ea[_0xd57f('0x3c')][_0xd57f('0x45')]){_0x544207[_0xd57f('0x46')]=_[_0xd57f('0x47')](_0x544207[_0xd57f('0x46')],{'$or':_[_0xd57f('0x38')](_0x412379,function(_0x59c3d4){if(_0x59c3d4[_0xd57f('0x3a')]!=='VIRTUAL'){var _0x23af98={};_0x23af98[_0x59c3d4['name']]={'$like':'%'+_0x1195ea[_0xd57f('0x3c')][_0xd57f('0x45')]+'%'};return _0x23af98;}})});}_0x544207=_['merge']({},_0x544207,_0x1195ea[_0xd57f('0x48')]);var _0x551fe0={'where':_0x544207['where']};return db[_0xd57f('0x49')][_0xd57f('0x29')](_0x551fe0)[_0xd57f('0x1a')](function(_0x2d8cd2){_0x258695['count']=_0x2d8cd2;if(_0x1195ea[_0xd57f('0x3c')][_0xd57f('0x4a')]){_0x544207[_0xd57f('0x4b')]=[{'all':!![]}];}return db[_0xd57f('0x49')][_0xd57f('0x4c')](_0x544207);})[_0xd57f('0x1a')](function(_0x41c314){_0x258695[_0xd57f('0x4d')]=_0x41c314;return _0x258695;})[_0xd57f('0x1a')](respondWithFilteredResult(_0x58d5b2,_0x544207))[_0xd57f('0x23')](handleError(_0x58d5b2,null));};exports['show']=function(_0x4214e9,_0xc23f70){var _0x1d4570={'raw':![],'where':{'id':_0x4214e9[_0xd57f('0x4e')]['id']},'include':[{'model':db[_0xd57f('0x37')],'as':_0xd57f('0x4f')}]},_0xf5c16e={};_0xf5c16e[_0xd57f('0x3b')]=_[_0xd57f('0x3d')](db['WhatsappAccount'][_0xd57f('0x50')]);_0xf5c16e[_0xd57f('0x3c')]=_[_0xd57f('0x3d')](_0x4214e9[_0xd57f('0x3c')]);_0xf5c16e[_0xd57f('0x3e')]=_[_0xd57f('0x40')](_0xf5c16e[_0xd57f('0x3b')],_0xf5c16e[_0xd57f('0x3c')]);_0x1d4570[_0xd57f('0x3f')]=_['intersection'](_0xf5c16e['model'],qs['fields'](_0x4214e9[_0xd57f('0x3c')][_0xd57f('0x41')]));_0x1d4570[_0xd57f('0x3f')]=_0x1d4570['attributes'][_0xd57f('0x51')]?_0x1d4570[_0xd57f('0x3f')]:_0xf5c16e['model'];if(_0x4214e9['query'][_0xd57f('0x4a')]){_0x1d4570[_0xd57f('0x4b')]=[{'all':!![]}];}_0x1d4570=_[_0xd57f('0x47')]({},_0x1d4570,_0x4214e9[_0xd57f('0x48')]);return db[_0xd57f('0x49')]['find'](_0x1d4570)[_0xd57f('0x1a')](handleEntityNotFound(_0xc23f70,null))[_0xd57f('0x1a')](respondWithResult(_0xc23f70,null))[_0xd57f('0x23')](handleError(_0xc23f70,null));};exports[_0xd57f('0x52')]=function(_0x24aa1c,_0x3e6786){return db['WhatsappAccount'][_0xd57f('0x52')](_0x24aa1c[_0xd57f('0x53')],{})[_0xd57f('0x1a')](function(_0x22e9dc){var _0xb9787b=_0x24aa1c[_0xd57f('0x54')][_0xd57f('0x31')]({'plain':!![]});if(!_0xb9787b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb9787b['role']===_0xd57f('0x54')){var _0x4309b0=_0x22e9dc[_0xd57f('0x31')]({'plain':!![]});var _0x436040=_0xd57f('0x32');return db[_0xd57f('0x55')]['find']({'where':{'name':_0x436040,'userProfileId':_0xb9787b['userProfileId']},'raw':!![]})[_0xd57f('0x1a')](function(_0xb1c09c){if(_0xb1c09c&&_0xb1c09c[_0xd57f('0x56')]===0x0){return db[_0xd57f('0x33')][_0xd57f('0x52')]({'name':_0x4309b0[_0xd57f('0x35')],'resourceId':_0x4309b0['id'],'type':_0xb1c09c[_0xd57f('0x35')],'sectionId':_0xb1c09c['id']},{})[_0xd57f('0x1a')](function(){return _0x22e9dc;});}else{return _0x22e9dc;}})['catch'](function(_0x423d9f){logger[_0xd57f('0x1e')](_0xd57f('0x57'),_0x423d9f);throw _0x423d9f;});}return _0x22e9dc;})[_0xd57f('0x1a')](respondWithResult(_0x3e6786,0xc9))['catch'](handleError(_0x3e6786,null));};exports['update']=function(_0x53f4da,_0x49440c){if(_0x53f4da[_0xd57f('0x53')]['id']){delete _0x53f4da['body']['id'];}return db[_0xd57f('0x49')]['find']({'where':{'id':_0x53f4da['params']['id']},'include':[{'model':db[_0xd57f('0x37')],'as':'mandatoryDispositionPause'}]})[_0xd57f('0x1a')](handleEntityNotFound(_0x49440c,null))['then'](saveUpdates(_0x53f4da[_0xd57f('0x53')],null))[_0xd57f('0x1a')](respondWithResult(_0x49440c,null))[_0xd57f('0x23')](handleError(_0x49440c,null));};exports['destroy']=function(_0xcbdedd,_0x479b95){return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0xcbdedd['params']['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x479b95,null))[_0xd57f('0x1a')](removeEntity(_0x479b95,null))['catch'](handleError(_0x479b95,null));};exports[_0xd57f('0x59')]=function(_0xc20d01,_0x18a751){return db[_0xd57f('0x49')][_0xd57f('0x59')]()[_0xd57f('0x1a')](respondWithResult(_0x18a751,null))[_0xd57f('0x23')](handleError(_0x18a751,null));};exports[_0xd57f('0x5a')]=function(_0x5737da,_0x1ce032,_0x526ae8){if(_0x5737da[_0xd57f('0x53')]['id']){delete _0x5737da[_0xd57f('0x53')]['id'];}return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0x5737da[_0xd57f('0x4e')]['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x1ce032,null))[_0xd57f('0x1a')](function(_0x35eb5b){if(_0x35eb5b){_0x5737da['body']['WhatsappAccountId']=_0x35eb5b['id'];return db['Disposition'][_0xd57f('0x52')](_0x5737da[_0xd57f('0x53')]);}})[_0xd57f('0x1a')](respondWithResult(_0x1ce032,null))[_0xd57f('0x23')](handleError(_0x1ce032,null));};exports['getDispositions']=function(_0x420da6,_0x2f654e,_0x440a48){var _0x3cb2b0={'raw':![],'where':{}};var _0x173d9d={};var _0x16d8c6={'count':0x0,'rows':[]};return db[_0xd57f('0x49')][_0xd57f('0x5b')]({'where':{'id':_0x420da6['params']['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x2f654e,null))[_0xd57f('0x1a')](function(_0x1a5dbc){if(_0x1a5dbc){_0x173d9d[_0xd57f('0x3b')]=_[_0xd57f('0x3d')](db['Disposition'][_0xd57f('0x50')]);_0x173d9d['query']=_[_0xd57f('0x3d')](_0x420da6['query']);_0x173d9d[_0xd57f('0x3e')]=_[_0xd57f('0x40')](_0x173d9d[_0xd57f('0x3b')],_0x173d9d['query']);_0x3cb2b0[_0xd57f('0x3f')]=_[_0xd57f('0x40')](_0x173d9d[_0xd57f('0x3b')],qs[_0xd57f('0x41')](_0x420da6[_0xd57f('0x3c')][_0xd57f('0x41')]));_0x3cb2b0[_0xd57f('0x3f')]=_0x3cb2b0[_0xd57f('0x3f')][_0xd57f('0x51')]?_0x3cb2b0['attributes']:_0x173d9d[_0xd57f('0x3b')];if(!_0x420da6[_0xd57f('0x3c')][_0xd57f('0x5c')](_0xd57f('0x42'))){_0x3cb2b0[_0xd57f('0x28')]=qs[_0xd57f('0x28')](_0x420da6[_0xd57f('0x3c')][_0xd57f('0x28')]);_0x3cb2b0[_0xd57f('0x2a')]=qs[_0xd57f('0x2a')](_0x420da6[_0xd57f('0x3c')]['offset']);}_0x3cb2b0[_0xd57f('0x5d')]=qs[_0xd57f('0x43')](_0x420da6[_0xd57f('0x3c')][_0xd57f('0x43')]);_0x3cb2b0[_0xd57f('0x46')]=qs['filters'](_['pick'](_0x420da6['query'],_0x173d9d[_0xd57f('0x3e')]));_0x3cb2b0[_0xd57f('0x46')][_0xd57f('0x5e')]=_0x1a5dbc['id'];if(_0x420da6['query']['filter']){_0x3cb2b0[_0xd57f('0x46')]=_[_0xd57f('0x47')](_0x3cb2b0[_0xd57f('0x46')],{'$or':_[_0xd57f('0x38')](_0x3cb2b0[_0xd57f('0x3f')],function(_0x5fc85e){var _0x4b8d87={};_0x4b8d87[_0x5fc85e]={'$like':'%'+_0x420da6[_0xd57f('0x3c')][_0xd57f('0x45')]+'%'};return _0x4b8d87;})});}_0x3cb2b0=_[_0xd57f('0x47')]({},_0x3cb2b0,_0x420da6['options']);return db[_0xd57f('0x5f')][_0xd57f('0x29')]({'where':_0x3cb2b0[_0xd57f('0x46')]})[_0xd57f('0x1a')](function(_0x46b443){_0x16d8c6['count']=_0x46b443;if(_0x420da6[_0xd57f('0x3c')]['includeAll']){_0x3cb2b0[_0xd57f('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3cb2b0);})[_0xd57f('0x1a')](function(_0x406f9a){_0x16d8c6[_0xd57f('0x4d')]=_0x406f9a;return _0x16d8c6;});}})[_0xd57f('0x1a')](respondWithFilteredResult(_0x2f654e,_0x3cb2b0))[_0xd57f('0x23')](handleError(_0x2f654e,null));};exports[_0xd57f('0x60')]=function(_0x3bcba6,_0x32d7c6,_0x36c6c1){return db['WhatsappAccount'][_0xd57f('0x58')]({'where':{'id':_0x3bcba6[_0xd57f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32d7c6,null))['then'](function(_0x1fb277){if(_0x1fb277){return _0x1fb277[_0xd57f('0x60')](_0x3bcba6[_0xd57f('0x3c')][_0xd57f('0x61')]);}})['then'](respondWithStatusCode(_0x32d7c6,null))[_0xd57f('0x23')](handleError(_0x32d7c6,null));};exports[_0xd57f('0x62')]=function(_0x1adf35,_0x4485e0,_0x583a8b){if(_0x1adf35[_0xd57f('0x53')]['id']){delete _0x1adf35[_0xd57f('0x53')]['id'];}return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0x1adf35['params']['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x4485e0,null))[_0xd57f('0x1a')](function(_0x928760){if(_0x928760){_0x1adf35[_0xd57f('0x53')][_0xd57f('0x5e')]=_0x928760['id'];return db[_0xd57f('0x63')][_0xd57f('0x52')](_0x1adf35[_0xd57f('0x53')]);}})[_0xd57f('0x1a')](respondWithResult(_0x4485e0,null))[_0xd57f('0x23')](handleError(_0x4485e0,null));};exports['getAnswers']=function(_0x261e1c,_0x33fa1c,_0x1ef0e4){var _0x4c9f8a={'raw':![],'where':{}};var _0x5b7ab4={};var _0x338046={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xd57f('0x5b')]({'where':{'id':_0x261e1c[_0xd57f('0x4e')]['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x33fa1c,null))[_0xd57f('0x1a')](function(_0x11dbae){if(_0x11dbae){_0x5b7ab4[_0xd57f('0x3b')]=_[_0xd57f('0x3d')](db[_0xd57f('0x63')]['rawAttributes']);_0x5b7ab4[_0xd57f('0x3c')]=_[_0xd57f('0x3d')](_0x261e1c[_0xd57f('0x3c')]);_0x5b7ab4[_0xd57f('0x3e')]=_[_0xd57f('0x40')](_0x5b7ab4[_0xd57f('0x3b')],_0x5b7ab4[_0xd57f('0x3c')]);_0x4c9f8a[_0xd57f('0x3f')]=_[_0xd57f('0x40')](_0x5b7ab4[_0xd57f('0x3b')],qs[_0xd57f('0x41')](_0x261e1c[_0xd57f('0x3c')][_0xd57f('0x41')]));_0x4c9f8a[_0xd57f('0x3f')]=_0x4c9f8a[_0xd57f('0x3f')][_0xd57f('0x51')]?_0x4c9f8a[_0xd57f('0x3f')]:_0x5b7ab4[_0xd57f('0x3b')];if(!_0x261e1c['query'][_0xd57f('0x5c')](_0xd57f('0x42'))){_0x4c9f8a['limit']=qs[_0xd57f('0x28')](_0x261e1c[_0xd57f('0x3c')]['limit']);_0x4c9f8a[_0xd57f('0x2a')]=qs['offset'](_0x261e1c[_0xd57f('0x3c')][_0xd57f('0x2a')]);}_0x4c9f8a[_0xd57f('0x5d')]=qs['sort'](_0x261e1c['query'][_0xd57f('0x43')]);_0x4c9f8a['where']=qs[_0xd57f('0x3e')](_[_0xd57f('0x44')](_0x261e1c[_0xd57f('0x3c')],_0x5b7ab4['filters']));_0x4c9f8a['where'][_0xd57f('0x5e')]=_0x11dbae['id'];if(_0x261e1c[_0xd57f('0x3c')][_0xd57f('0x45')]){_0x4c9f8a[_0xd57f('0x46')]=_[_0xd57f('0x47')](_0x4c9f8a[_0xd57f('0x46')],{'$or':_[_0xd57f('0x38')](_0x4c9f8a[_0xd57f('0x3f')],function(_0x3d413e){var _0x331e75={};_0x331e75[_0x3d413e]={'$like':'%'+_0x261e1c[_0xd57f('0x3c')]['filter']+'%'};return _0x331e75;})});}_0x4c9f8a=_[_0xd57f('0x47')]({},_0x4c9f8a,_0x261e1c[_0xd57f('0x48')]);return db['CannedAnswer'][_0xd57f('0x29')]({'where':_0x4c9f8a[_0xd57f('0x46')]})['then'](function(_0x111eb3){_0x338046[_0xd57f('0x29')]=_0x111eb3;if(_0x261e1c[_0xd57f('0x3c')]['includeAll']){_0x4c9f8a[_0xd57f('0x4b')]=[{'all':!![]}];}return db[_0xd57f('0x63')]['findAll'](_0x4c9f8a);})['then'](function(_0x108468){_0x338046[_0xd57f('0x4d')]=_0x108468;return _0x338046;});}})['then'](respondWithFilteredResult(_0x33fa1c,_0x4c9f8a))[_0xd57f('0x23')](handleError(_0x33fa1c,null));};exports[_0xd57f('0x64')]=function(_0x4784b3,_0x56eb87,_0x8acc10){return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0x4784b3[_0xd57f('0x4e')]['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x56eb87,null))[_0xd57f('0x1a')](function(_0x4bd922){if(_0x4bd922){return _0x4bd922[_0xd57f('0x64')](_0x4784b3[_0xd57f('0x3c')][_0xd57f('0x61')]);}})[_0xd57f('0x1a')](respondWithStatusCode(_0x56eb87,null))[_0xd57f('0x23')](handleError(_0x56eb87,null));};exports['addAgents']=function(_0x496c56,_0xcbaea5,_0x1f4891){return db[_0xd57f('0x49')]['find']({'where':{'id':_0x496c56['params']['id']}})['then'](handleEntityNotFound(_0xcbaea5,null))['then'](function(_0x3b80fd){if(_0x3b80fd){return _0x3b80fd['addAgents'](_0x496c56[_0xd57f('0x53')][_0xd57f('0x61')],_[_0xd57f('0x65')](_0x496c56['body'],[_0xd57f('0x61'),'id'])||{})['spread'](function(_0x3d9d2b){for(var _0x3570ee=0x0;_0x3570ee<_0x496c56[_0xd57f('0x53')]['ids']['length'];_0x3570ee+=0x1){socket[_0xd57f('0x66')](_0xd57f('0x67'),{'UserId':Number(_0x496c56[_0xd57f('0x53')][_0xd57f('0x61')][_0x3570ee]),'WhatsappAccountId':Number(_0x496c56[_0xd57f('0x4e')]['id'])});}return _0x3d9d2b;});}})[_0xd57f('0x1a')](respondWithResult(_0xcbaea5,null))['catch'](handleError(_0xcbaea5,null));};exports['removeAgents']=function(_0x560914,_0x2b11ed,_0x166fc9){return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0x560914[_0xd57f('0x4e')]['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x2b11ed,null))['then'](function(_0x46dbd8){if(_0x46dbd8){return _0x46dbd8[_0xd57f('0x68')](_0x560914[_0xd57f('0x3c')][_0xd57f('0x61')])[_0xd57f('0x1a')](function(){if(_[_0xd57f('0x69')](_0x560914[_0xd57f('0x3c')][_0xd57f('0x61')])){for(var _0x5e527b=0x0;_0x5e527b<_0x560914['query'][_0xd57f('0x61')][_0xd57f('0x51')];_0x5e527b+=0x1){socket[_0xd57f('0x66')](_0xd57f('0x6a'),{'UserId':Number(_0x560914[_0xd57f('0x3c')][_0xd57f('0x61')][_0x5e527b]),'WhatsappAccountId':Number(_0x560914[_0xd57f('0x4e')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x560914[_0xd57f('0x3c')][_0xd57f('0x61')]),'WhatsappAccountId':Number(_0x560914[_0xd57f('0x4e')]['id'])});}});}})[_0xd57f('0x1a')](respondWithStatusCode(_0x2b11ed,null))['catch'](handleError(_0x2b11ed,null));};exports[_0xd57f('0x6b')]=function(_0x572719,_0x40a7d2,_0x2cc573){var _0x14cdf9={};var _0x24724f={};var _0x1203f2;var _0x25563d;return db[_0xd57f('0x49')][_0xd57f('0x5b')]({'where':{'id':_0x572719[_0xd57f('0x4e')]['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x40a7d2,null))[_0xd57f('0x1a')](function(_0x4c1bf6){if(_0x4c1bf6){_0x1203f2=_0x4c1bf6;_0x24724f['model']=_[_0xd57f('0x3d')](db[_0xd57f('0x6c')][_0xd57f('0x50')]);_0x24724f[_0xd57f('0x3c')]=_['keys'](_0x572719[_0xd57f('0x3c')]);_0x24724f[_0xd57f('0x3e')]=_[_0xd57f('0x40')](_0x24724f[_0xd57f('0x3b')],_0x24724f[_0xd57f('0x3c')]);_0x14cdf9[_0xd57f('0x3f')]=_[_0xd57f('0x40')](_0x24724f[_0xd57f('0x3b')],qs[_0xd57f('0x41')](_0x572719['query']['fields']));_0x14cdf9['attributes']=_0x14cdf9[_0xd57f('0x3f')]['length']?_0x14cdf9[_0xd57f('0x3f')]:_0x24724f[_0xd57f('0x3b')];_0x14cdf9['order']=qs[_0xd57f('0x43')](_0x572719[_0xd57f('0x3c')][_0xd57f('0x43')]);_0x14cdf9[_0xd57f('0x46')]=qs['filters'](_[_0xd57f('0x44')](_0x572719[_0xd57f('0x3c')],_0x24724f[_0xd57f('0x3e')]));if(_0x572719[_0xd57f('0x3c')]['filter']){_0x14cdf9['where']=_['merge'](_0x14cdf9[_0xd57f('0x46')],{'$or':_[_0xd57f('0x38')](_0x14cdf9[_0xd57f('0x3f')],function(_0x191725){var _0x12a6dd={};_0x12a6dd[_0x191725]={'$like':'%'+_0x572719[_0xd57f('0x3c')][_0xd57f('0x45')]+'%'};return _0x12a6dd;})});}_0x14cdf9=_[_0xd57f('0x47')]({},_0x14cdf9,_0x572719[_0xd57f('0x48')]);return _0x1203f2['getAgents'](_0x14cdf9);}})['then'](function(_0x68ea82){if(_0x68ea82){_0x25563d=_0x68ea82[_0xd57f('0x51')];if(!_0x572719[_0xd57f('0x3c')][_0xd57f('0x5c')](_0xd57f('0x42'))){_0x14cdf9[_0xd57f('0x28')]=qs[_0xd57f('0x28')](_0x572719[_0xd57f('0x3c')][_0xd57f('0x28')]);_0x14cdf9[_0xd57f('0x2a')]=qs[_0xd57f('0x2a')](_0x572719[_0xd57f('0x3c')]['offset']);}return _0x1203f2[_0xd57f('0x6b')](_0x14cdf9);}})[_0xd57f('0x1a')](function(_0xcb1b0){if(_0xcb1b0){return _0xcb1b0?{'count':_0x25563d,'rows':_0xcb1b0}:null;}})[_0xd57f('0x1a')](respondWithResult(_0x40a7d2,null))[_0xd57f('0x23')](handleError(_0x40a7d2,null));};exports[_0xd57f('0x6d')]=function(_0x1fe46f,_0x1b321c){var _0x8bf6f2=_0x1fe46f[_0xd57f('0x4e')]['id'];var _0x789361=_0x1fe46f['body'];var _0x51ac94=0xc8;var _0x58752a=null;return db[_0xd57f('0x6e')]['transaction']({'isolationLevel':db[_0xd57f('0x6e')]['Transaction'][_0xd57f('0x6f')][_0xd57f('0x70')]},function(_0x350b78){return db[_0xd57f('0x49')][_0xd57f('0x5b')]({'where':{'id':_0x8bf6f2},'transaction':_0x350b78})[_0xd57f('0x1a')](function(_0x43ee54){if(_0x43ee54){return db[_0xd57f('0x71')][_0xd57f('0x72')]({'where':{'WhatsappAccountId':_0x8bf6f2},'transaction':_0x350b78})[_0xd57f('0x1a')](function(){var _0x34c3d7=_[_0xd57f('0x38')](_0x789361,function(_0x595827){_0x595827[_0xd57f('0x5e')]=_0x8bf6f2;return _0x595827;});return db[_0xd57f('0x71')][_0xd57f('0x73')](_0x34c3d7,{'transaction':_0x350b78});});}else{_0x51ac94=0x194;_0x58752a=[];}});})['then'](function(){if(_0x51ac94!==0x194){return db[_0xd57f('0x71')][_0xd57f('0x74')]({'where':{'WhatsappAccountId':_0x8bf6f2},'order':'priority'})[_0xd57f('0x1a')](function(_0x20b972){_0x58752a=_0x20b972;});}})[_0xd57f('0x23')](function(_0x29df7e){_0x51ac94=0x1f4;logger[_0xd57f('0x1e')](_0x29df7e[_0xd57f('0x34')]);if(_0x29df7e[_0xd57f('0x35')]){delete _0x29df7e['name'];}_0x58752a=_0x29df7e;})[_0xd57f('0x75')](function(){if(_0x58752a===null){_0x1b321c['sendStatus'](_0x51ac94);}else{if(_0x51ac94===0x1f4){_0x1b321c['status'](_0x51ac94)[_0xd57f('0x76')](_0x58752a);}else{_0x1b321c[_0xd57f('0x25')](_0x51ac94)[_0xd57f('0x77')](_0x58752a);}}});};exports['getApplications']=function(_0x15ee0b,_0x1470b5,_0x5ded11){var _0x4656f0={};var _0x3632b8={};var _0x26413a;var _0xb8d3ea;return db['WhatsappAccount'][_0xd57f('0x5b')]({'where':{'id':_0x15ee0b[_0xd57f('0x4e')]['id']}})[_0xd57f('0x1a')](handleEntityNotFound(_0x1470b5,null))[_0xd57f('0x1a')](function(_0x38f75c){if(_0x38f75c){_0x26413a=_0x38f75c;_0x3632b8[_0xd57f('0x3b')]=_[_0xd57f('0x3d')](db[_0xd57f('0x71')][_0xd57f('0x50')]);_0x3632b8[_0xd57f('0x3c')]=_[_0xd57f('0x3d')](_0x15ee0b[_0xd57f('0x3c')]);_0x3632b8[_0xd57f('0x3e')]=_[_0xd57f('0x40')](_0x3632b8[_0xd57f('0x3b')],_0x3632b8[_0xd57f('0x3c')]);_0x4656f0['attributes']=_[_0xd57f('0x40')](_0x3632b8[_0xd57f('0x3b')],qs['fields'](_0x15ee0b[_0xd57f('0x3c')][_0xd57f('0x41')]));_0x4656f0[_0xd57f('0x3f')]=_0x4656f0[_0xd57f('0x3f')][_0xd57f('0x51')]?_0x4656f0[_0xd57f('0x3f')]:_0x3632b8['model'];_0x4656f0[_0xd57f('0x5d')]=qs[_0xd57f('0x43')](_0x15ee0b[_0xd57f('0x3c')][_0xd57f('0x43')]);_0x4656f0['where']=qs[_0xd57f('0x3e')](_[_0xd57f('0x44')](_0x15ee0b[_0xd57f('0x3c')],_0x3632b8[_0xd57f('0x3e')]));if(_0x15ee0b[_0xd57f('0x3c')][_0xd57f('0x45')]){_0x4656f0[_0xd57f('0x46')]=_[_0xd57f('0x47')](_0x4656f0[_0xd57f('0x46')],{'$or':_[_0xd57f('0x38')](_0x4656f0['attributes'],function(_0x1fb9c1){var _0x25fe5b={};_0x25fe5b[_0x1fb9c1]={'$like':'%'+_0x15ee0b['query'][_0xd57f('0x45')]+'%'};return _0x25fe5b;})});}_0x4656f0=_[_0xd57f('0x47')]({},_0x4656f0,_0x15ee0b['options']);return _0x26413a[_0xd57f('0x78')](_0x4656f0);}})[_0xd57f('0x1a')](function(_0x59b129){if(_0x59b129){_0xb8d3ea=_0x59b129['length'];if(!_0x15ee0b[_0xd57f('0x3c')][_0xd57f('0x5c')](_0xd57f('0x42'))){_0x4656f0[_0xd57f('0x28')]=qs[_0xd57f('0x28')](_0x15ee0b[_0xd57f('0x3c')][_0xd57f('0x28')]);_0x4656f0['offset']=qs[_0xd57f('0x2a')](_0x15ee0b['query'][_0xd57f('0x2a')]);}return _0x26413a[_0xd57f('0x78')](_0x4656f0);}})[_0xd57f('0x1a')](function(_0xc2675e){if(_0xc2675e){return _0xc2675e?{'count':_0xb8d3ea,'rows':_0xc2675e}:null;}})[_0xd57f('0x1a')](respondWithResult(_0x1470b5,null))[_0xd57f('0x23')](handleError(_0x1470b5,null));};exports[_0xd57f('0x79')]=function(_0x95a16e,_0x3940d5,_0x3f1718){var _0x1afd8f={'channel':_0xd57f('0x7a')};var _0x1a74d0=[];var _0x17d1d6=[];var _0x55a790={};return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0x95a16e['params']['id']},'include':[{'model':db[_0xd57f('0x71')],'as':'Applications'}]})[_0xd57f('0x1a')](handleEntityNotFound(_0x3940d5,null))[_0xd57f('0x1a')](function(_0x28e7f2){_0x1afd8f[_0xd57f('0x7b')]=_0x28e7f2;if(_0x1afd8f[_0xd57f('0x7b')]&&_0x1afd8f[_0xd57f('0x7b')][_0xd57f('0x3a')]===_0xd57f('0x7c')&&_0x95a16e[_0xd57f('0x53')]['statuses']){if(_0x95a16e[_0xd57f('0x53')][_0xd57f('0x7d')][_0xd57f('0x51')]===0x0)return;if(_0x95a16e['body'][_0xd57f('0x7d')][0x0]['state']!==_0xd57f('0x7e'))return;return db[_0xd57f('0x7f')][_0xd57f('0x30')]({'read':!![],'readAt':_0x95a16e[_0xd57f('0x53')]['statuses'][0x0][_0xd57f('0x80')]},{'where':{'messageId':_0x95a16e[_0xd57f('0x53')][_0xd57f('0x7d')][0x0][_0xd57f('0x81')]},'individualHooks':!![]})[_0xd57f('0x1a')](function(_0x28a4e0){return _0x3940d5[_0xd57f('0x25')](0xc8)[_0xd57f('0x77')](_0x28a4e0);});}_0x1afd8f[_0xd57f('0x82')]=_[_0xd57f('0x83')](_0x28e7f2[_0xd57f('0x84')],[_0xd57f('0x85')],[_0xd57f('0x86')]);if(_0x1afd8f[_0xd57f('0x7b')]['Applications']){delete _0x1afd8f['account'][_0xd57f('0x84')];}return db[_0xd57f('0x87')][_0xd57f('0x59')]()[_0xd57f('0x1a')](function(_0x296f59){if(!_0x296f59){throw new db[(_0xd57f('0x88'))][(_0xd57f('0x89'))](_0xd57f('0x8a'));}_0x1a74d0=_[_0xd57f('0x8b')](_['keys'](_0x296f59),['createdAt',_0xd57f('0x8c')]);_0x17d1d6=_[_0xd57f('0x8b')](_[_0xd57f('0x3d')](_0x296f59),[_0xd57f('0x8d'),_0xd57f('0x8c'),'CompanyId',_0xd57f('0x8e')]);_0x1afd8f[_0xd57f('0x53')]={'mapKey':_0xd57f('0x8f')};if(_0x1afd8f[_0xd57f('0x7b')]&&_0x1afd8f[_0xd57f('0x7b')][_0xd57f('0x3a')]===_0xd57f('0x90')){_0x1afd8f[_0xd57f('0x53')]['from']=_0x95a16e[_0xd57f('0x53')][_0xd57f('0x91')][_0xd57f('0x92')]('whatsapp:','');_0x1afd8f['body']['body']=_0x95a16e[_0xd57f('0x53')][_0xd57f('0x93')];_0x1afd8f[_0xd57f('0x53')]['messageId']=_0x95a16e[_0xd57f('0x53')][_0xd57f('0x94')];}if(_0x1afd8f['account']&&_0x1afd8f[_0xd57f('0x7b')][_0xd57f('0x3a')]===_0xd57f('0x7c')){_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x95')]=_0x95a16e[_0xd57f('0x53')]['notifications'][0x0]['from'];_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x53')]=_0x95a16e[_0xd57f('0x53')]['notifications'][0x0][_0xd57f('0x20')]['body'];_0x1afd8f[_0xd57f('0x53')]['messageId']=_0x95a16e[_0xd57f('0x53')][_0xd57f('0x96')][0x0][_0xd57f('0x81')];}if(_0x1afd8f[_0xd57f('0x53')]['id']){delete _0x1afd8f['body']['id'];}if(_[_0xd57f('0x97')](_0x1afd8f[_0xd57f('0x53')]['from'])){throw new db['Sequelize'][(_0xd57f('0x89'))](_0xd57f('0x98'));}if(_[_0xd57f('0x97')](_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x53')])||_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x53')]===''){throw new db['Sequelize'][(_0xd57f('0x89'))](_0xd57f('0x99'));}if(_[_0xd57f('0x97')](_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x9a')])){throw new db[(_0xd57f('0x88'))][(_0xd57f('0x89'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17d1d6);}if(!_[_0xd57f('0x9b')](_0x17d1d6,_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x9a')])){throw new db[(_0xd57f('0x88'))]['ValidationError'](_0xd57f('0x9c')+_0x17d1d6);}_0x55a790[_0x1afd8f['body'][_0xd57f('0x9a')]]=_0x1afd8f['body'][_0xd57f('0x95')];return db[_0xd57f('0x9d')]['find']({'where':{'id':_0x1afd8f[_0xd57f('0x7b')][_0xd57f('0x8e')]},'include':[{'model':db[_0xd57f('0x87')],'as':_0xd57f('0x9e'),'where':_0x55a790,'limit':0x1,'order':[[_0xd57f('0x8c'),_0xd57f('0x9f')]]}]});})[_0xd57f('0x1a')](handleEntityNotFound(_0x3940d5,null))[_0xd57f('0x1a')](function(_0x583545){if(_0x583545){_0x1afd8f[_0xd57f('0xa0')]=_[_0xd57f('0x65')](_0x583545,[_0xd57f('0x9e')]);if(_0x583545[_0xd57f('0x9e')][_0xd57f('0x51')]){return _0x583545['Contacts'][0x0];}var _0x23f3be=_[_0xd57f('0x15')](_0x1afd8f[_0xd57f('0x53')],{'firstName':_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x95')],'ListId':_0x583545['id']});_0x23f3be[_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x9a')]]=_0x1afd8f['body'][_0xd57f('0x95')];return db[_0xd57f('0x87')][_0xd57f('0x52')](_0x23f3be,{'fields':_0x1a74d0,'raw':!![]});}})['then'](handleEntityNotFound(_0x3940d5,null))['then'](function(_0x44bd5f){if(_0x44bd5f){_0x1afd8f[_0xd57f('0xa1')]=_0x44bd5f;var _0x231c76={'ContactId':_0x44bd5f['id'],'phone':_0x1afd8f[_0xd57f('0x53')][_0xd57f('0x95')],'WhatsappAccountId':_0x95a16e[_0xd57f('0x4e')]['id']};var _0x41db4f={'ContactId':_0x44bd5f['id'],'WhatsappAccountId':_0x95a16e['params']['id'],'closed':![]};return db[_0xd57f('0xa2')]['find']({'where':_0x41db4f})[_0xd57f('0x1a')](function(_0x20e8f5){if(_0x20e8f5){return[_0x20e8f5,![]];}return db[_0xd57f('0xa2')][_0xd57f('0x52')](_0x231c76)[_0xd57f('0x1a')](function(_0x217f6e){return[_0x217f6e,!![]];});});}})[_0xd57f('0xa3')](function(_0xcd7334,_0xc23410){_0x1afd8f[_0xd57f('0xa4')]=_0xcd7334['get']({'plain':!![]});_0x1afd8f[_0xd57f('0xa4')][_0xd57f('0xa5')]=![];if(_0xc23410){if(_0x1afd8f[_0xd57f('0x7b')][_0xd57f('0xa6')]){_0x1afd8f['applications'][_0xd57f('0xa7')]({'id':0x0,'priority':_0x1afd8f['applications'][_0xd57f('0x51')]+0x1,'app':_0xd57f('0xa8'),'appdata':_0xd57f('0xa9'),'interval':'*,*,*,*'});}_0x1afd8f[_0xd57f('0xa4')]['created']=!![];}return db[_0xd57f('0x7f')]['create']({'phone':_0x1afd8f[_0xd57f('0x53')]['from'],'messageId':_0x1afd8f['body'][_0xd57f('0xaa')],'body':_0x1afd8f['body']['body'],'WhatsappAccountId':_0x95a16e[_0xd57f('0x4e')]['id'],'WhatsappInteractionId':_0xcd7334['id'],'direction':'in','ContactId':_0xcd7334[_0xd57f('0xab')],'AttachmentId':_0x1afd8f['body'][_0xd57f('0xac')]});})[_0xd57f('0x1a')](function(_0x5bd358){_0x1afd8f[_0xd57f('0x20')]=_0x5bd358;if(_0x1afd8f[_0xd57f('0xa4')][_0xd57f('0xad')]){return db[_0xd57f('0x6c')][_0xd57f('0x58')]({'attributes':['id',_0xd57f('0x35')],'where':{'id':_0x1afd8f['interaction'][_0xd57f('0xad')]}})[_0xd57f('0x1a')](function(_0xe978be){if(_0xe978be){_0x1afd8f[_0xd57f('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd57f('0xae'),'appdata':_0xe978be[_0xd57f('0x35')]+','+(_0x1afd8f[_0xd57f('0x7b')][_0xd57f('0xaf')]||0xa),'interval':_0xd57f('0xb0')});}return respondWithRpcPromise('Start',_0xd57f('0xb1'),_0x1afd8f);});}return respondWithRpcPromise(_0xd57f('0xb2'),_0xd57f('0xb1'),_0x1afd8f);})[_0xd57f('0x1a')](function(_0x2497b6){if(_0x2497b6){var _0x58a1ac=0xc8;var _0x5a37bf='receiveMessage';logger[_0xd57f('0x21')](_0xd57f('0xb3'),_0x5a37bf,_0x58a1ac,_0xd57f('0xb4'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5a37bf,_0x58a1ac,_0xd57f('0xb4'),JSON[_0xd57f('0x1d')](_0x2497b6));if(_0x1afd8f['account'][_0xd57f('0x3a')]===_0xd57f('0x90')){return _0x3940d5[_0xd57f('0x25')](_0x58a1ac)[_0xd57f('0x2b')](_0xd57f('0xb5'),'text/xml')['send']('\x0a');}else{return _0x3940d5[_0xd57f('0x25')](_0x58a1ac)[_0xd57f('0x77')](_0x2497b6);}}});})[_0xd57f('0x23')](handleError(_0x3940d5,null));};exports[_0xd57f('0x76')]=function(_0x322970,_0x10b621,_0xb59d4c){var _0x420b30,_0x2b300b,_0xf5bd93;if(_[_0xd57f('0x97')](_0x322970[_0xd57f('0x53')][_0xd57f('0x53')])||_0x322970[_0xd57f('0x53')]['body']===''){throw new db[(_0xd57f('0x88'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd57f('0x97')](_0x322970[_0xd57f('0x53')]['to'])){throw new db[(_0xd57f('0x88'))][(_0xd57f('0x89'))](_0xd57f('0xb6'));}_0x420b30=_0x322970[_0xd57f('0x53')]['to'];return db[_0xd57f('0x49')][_0xd57f('0x58')]({'where':{'id':_0x322970[_0xd57f('0x4e')]['id']},'include':[{'model':db[_0xd57f('0x9d')],'as':_0xd57f('0xb7'),'include':[{'model':db[_0xd57f('0x87')],'as':_0xd57f('0x9e'),'where':{'mobile':_0x420b30},'limit':0x1,'order':[[_0xd57f('0x8c'),_0xd57f('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x10b621,null))[_0xd57f('0x1a')](function(_0x32976c){if(_0x32976c&&_0x32976c[_0xd57f('0xb7')]){_0x2b300b=_0x32976c['get']({'plain':!![]});if(_0x2b300b[_0xd57f('0xb7')]&&_0x2b300b[_0xd57f('0xb7')][_0xd57f('0x9e')]['length']){return _0x2b300b[_0xd57f('0xb7')][_0xd57f('0x9e')][0x0];}return db[_0xd57f('0x87')][_0xd57f('0x52')](_[_0xd57f('0x15')](_0x322970[_0xd57f('0x53')],{'firstName':_0x420b30,'mobile':_0x420b30,'phone':_0x420b30,'ListId':_0x2b300b[_0xd57f('0x8e')]}));}})[_0xd57f('0x1a')](handleEntityNotFound(_0x10b621,null))[_0xd57f('0x1a')](function(_0x5b073e){if(_0x5b073e){_0xf5bd93=_0x5b073e;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0xf5bd93['id'],'closed':![],'WhatsappAccountId':_0x2b300b['id']}})[_0xd57f('0x1a')](function(_0x2d0d5b){if(_0x2d0d5b){return[_0x2d0d5b,![]];}return db['WhatsappInteraction'][_0xd57f('0x52')]({'UserId':_0x322970[_0xd57f('0x54')]['id'],'ContactId':_0xf5bd93['id'],'WhatsappAccountId':_0x2b300b['id'],'phone':_0x420b30,'firstMsgDirection':_0xd57f('0xb8'),'Messages':[_[_0xd57f('0x47')](_0x322970[_0xd57f('0x53')],{'read':![],'body':_0x322970['body'][_0xd57f('0x53')],'phone':_0x420b30,'WhatsappAccountId':_0x2b300b['id'],'UserId':_0x322970[_0xd57f('0x54')]['id'],'ContactId':_0xf5bd93['id']})]},{'include':[{'model':db[_0xd57f('0x7f')],'as':_0xd57f('0xb9')}]})['then'](function(_0x5b8f20){return[_0x5b8f20,!![]];});});}})['spread'](function(_0x2324ca,_0x2bcaf2){if(_0x2bcaf2){return _0x2324ca;}return db[_0xd57f('0x7f')][_0xd57f('0x52')](_[_0xd57f('0x47')](_0x322970[_0xd57f('0x53')],{'read':![],'body':_0x322970[_0xd57f('0x53')][_0xd57f('0x53')],'phone':_0x420b30,'WhatsappAccountId':_0x2b300b['id'],'WhatsappInteractionId':_0x2324ca['id'],'UserId':_0x322970[_0xd57f('0x54')]['id'],'ContactId':_0xf5bd93['id']}))[_0xd57f('0x1a')](function(_0xc151dd){_0x2324ca['dataValues'][_0xd57f('0xb9')]=[];_0x2324ca['dataValues'][_0xd57f('0xb9')]['push'](_0xc151dd[_0xd57f('0xba')]);return _0x2324ca;});})['then'](respondWithResult(_0x10b621,null))[_0xd57f('0x23')](handleError(_0x10b621,null));}; \ No newline at end of file +var _0x6411=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','get','WhatsappAccounts','destroy','sendStatus','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','rawAttributes','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','notifications','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x50568f,_0x48bc24){var _0x45fbd0=function(_0x17cd6b){while(--_0x17cd6b){_0x50568f['push'](_0x50568f['shift']());}};_0x45fbd0(++_0x48bc24);}(_0x6411,0xbc));var _0x1641=function(_0x7d4497,_0x4934c2){_0x7d4497=_0x7d4497-0x0;var _0x1f01a4=_0x6411[_0x7d4497];return _0x1f01a4;};'use strict';var emlformat=require(_0x1641('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1641('0x1'));var rp=require(_0x1641('0x2'));var moment=require(_0x1641('0x3'));var BPromise=require(_0x1641('0x4'));var Mustache=require(_0x1641('0x5'));var util=require(_0x1641('0x6'));var path=require(_0x1641('0x7'));var sox=require(_0x1641('0x8'));var csv=require(_0x1641('0x9'));var ejs=require(_0x1641('0xa'));var fs=require('fs');var fs_extra=require(_0x1641('0xb'));var _=require('lodash');var squel=require(_0x1641('0xc'));var crypto=require(_0x1641('0xd'));var jsforce=require(_0x1641('0xe'));var deskjs=require(_0x1641('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1641('0x10'));var Papa=require(_0x1641('0x11'));var Redis=require(_0x1641('0x12'));var authService=require(_0x1641('0x13'));var qs=require(_0x1641('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1641('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1641('0x16'));var config=require(_0x1641('0x17'));var licenseUtil=require(_0x1641('0x18'));var db=require(_0x1641('0x19'))['db'];config['redis']=_['defaults'](config[_0x1641('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1641('0x1b'))(new Redis(config[_0x1641('0x1a')]));require(_0x1641('0x1c'))[_0x1641('0x1d')](socket);var jayson=require(_0x1641('0x1e'));var client=jayson[_0x1641('0x1f')][_0x1641('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3dae4f,_0x1567e7,_0xe93612,_0x1b894c){return new BPromise(function(_0x2497f6,_0x16bd1a){var _0x2e6d10=_0x1b894c||client;return _0x2e6d10[_0x1641('0x21')](_0x3dae4f,_0xe93612)[_0x1641('0x22')](function(_0x116809){logger['info'](_0x1641('0x23'),_0x1567e7,_0x1641('0x24'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1567e7,'request\x20sent',JSON['stringify'](_0x116809));if(_0x116809[_0x1641('0x25')]){if(_0x116809[_0x1641('0x25')][_0x1641('0x26')]===0x1f4){logger[_0x1641('0x25')](_0x1641('0x23'),_0x1567e7,_0x116809['error'][_0x1641('0x27')]);return _0x16bd1a(_0x116809[_0x1641('0x25')]['message']);}logger[_0x1641('0x25')](_0x1641('0x23'),_0x1567e7,_0x116809[_0x1641('0x25')]['message']);return _0x2497f6(_0x116809['error']['message']);}else{logger[_0x1641('0x28')](_0x1641('0x23'),_0x1567e7,_0x1641('0x24'));_0x2497f6(_0x116809[_0x1641('0x29')][_0x1641('0x27')]);}})[_0x1641('0x2a')](function(_0x5beabd){logger[_0x1641('0x25')](_0x1641('0x23'),_0x1567e7,_0x5beabd);_0x16bd1a(_0x5beabd);});});}function respondWithStatusCode(_0x400557,_0x328c44){_0x328c44=_0x328c44||0xcc;return function(_0x12c7d7){if(_0x12c7d7){return _0x400557['sendStatus'](_0x328c44);}return _0x400557['status'](_0x328c44)[_0x1641('0x2b')]();};}function respondWithResult(_0x293ce9,_0x5c42ca){_0x5c42ca=_0x5c42ca||0xc8;return function(_0x47fae8){if(_0x47fae8){return _0x293ce9['status'](_0x5c42ca)[_0x1641('0x2c')](_0x47fae8);}};}function respondWithFilteredResult(_0x58d053,_0x7a0135){return function(_0x4e7590){if(_0x4e7590){var _0x47d519=typeof _0x7a0135[_0x1641('0x2d')]===_0x1641('0x2e')&&typeof _0x7a0135[_0x1641('0x2f')]===_0x1641('0x2e');var _0x179ebc=_0x4e7590[_0x1641('0x30')];var _0x28c9e6=_0x47d519?0x0:_0x7a0135[_0x1641('0x2d')];var _0xc1712b=_0x47d519?_0x4e7590[_0x1641('0x30')]:_0x7a0135[_0x1641('0x2d')]+_0x7a0135[_0x1641('0x2f')];var _0x55b6b9;if(_0xc1712b>=_0x179ebc){_0xc1712b=_0x179ebc;_0x55b6b9=0xc8;}else{_0x55b6b9=0xce;}_0x58d053[_0x1641('0x31')](_0x55b6b9);return _0x58d053[_0x1641('0x32')](_0x1641('0x33'),_0x28c9e6+'-'+_0xc1712b+'/'+_0x179ebc)['json'](_0x4e7590);}return null;};}function patchUpdates(_0x3f97d7){return function(_0x1f28d3){try{jsonpatch[_0x1641('0x34')](_0x1f28d3,_0x3f97d7,!![]);}catch(_0x2f61b6){return BPromise[_0x1641('0x35')](_0x2f61b6);}return _0x1f28d3['save']();};}function saveUpdates(_0x4ef6e3,_0x292bad){return function(_0x583ab5){if(_0x583ab5){return _0x583ab5[_0x1641('0x36')](_0x4ef6e3)[_0x1641('0x22')](function(_0x2f2de2){return _0x2f2de2;});}return null;};}function removeEntity(_0x4e2d10,_0x425c46){return function(_0x5cb868){if(_0x5cb868){return _0x5cb868['destroy']()['then'](function(){var _0x4e4977=_0x5cb868[_0x1641('0x37')]({'plain':!![]});var _0x139c10=_0x1641('0x38');return db['UserProfileResource'][_0x1641('0x39')]({'where':{'type':_0x139c10,'resourceId':_0x4e4977['id']}})['then'](function(){return _0x5cb868;});})['then'](function(){_0x4e2d10[_0x1641('0x31')](0xcc)[_0x1641('0x2b')]();});}};}function handleEntityNotFound(_0x413718,_0x5b611f){return function(_0x1a2c70){if(!_0x1a2c70){_0x413718[_0x1641('0x3a')](0x194);}return _0x1a2c70;};}function handleError(_0xea611a,_0x2b724d){_0x2b724d=_0x2b724d||0x1f4;return function(_0x48d017){logger['error'](_0x48d017['stack']);if(_0x48d017[_0x1641('0x3b')]){delete _0x48d017[_0x1641('0x3b')];}_0xea611a[_0x1641('0x31')](_0x2b724d)[_0x1641('0x3c')](_0x48d017);};}exports['index']=function(_0x191162,_0xe1c6b6){var _0x584324={'include':[{'model':db[_0x1641('0x3d')],'as':_0x1641('0x3e')}]},_0x1755e9={},_0x3af836={'count':0x0,'rows':[]};var _0x1ff0a6=_[_0x1641('0x3f')](db[_0x1641('0x40')]['rawAttributes'],function(_0x59a1d1){return{'name':_0x59a1d1['fieldName'],'type':_0x59a1d1[_0x1641('0x41')][_0x1641('0x42')]};});_0x1755e9[_0x1641('0x43')]=_[_0x1641('0x3f')](_0x1ff0a6,'name');_0x1755e9[_0x1641('0x44')]=_[_0x1641('0x45')](_0x191162[_0x1641('0x44')]);_0x1755e9[_0x1641('0x46')]=_[_0x1641('0x47')](_0x1755e9[_0x1641('0x43')],_0x1755e9[_0x1641('0x44')]);_0x584324[_0x1641('0x48')]=_[_0x1641('0x47')](_0x1755e9[_0x1641('0x43')],qs[_0x1641('0x49')](_0x191162[_0x1641('0x44')]['fields']));_0x584324['attributes']=_0x584324[_0x1641('0x48')][_0x1641('0x4a')]?_0x584324[_0x1641('0x48')]:_0x1755e9['model'];if(!_0x191162['query'][_0x1641('0x4b')](_0x1641('0x4c'))){_0x584324[_0x1641('0x2f')]=qs[_0x1641('0x2f')](_0x191162[_0x1641('0x44')]['limit']);_0x584324[_0x1641('0x2d')]=qs[_0x1641('0x2d')](_0x191162['query']['offset']);}_0x584324[_0x1641('0x4d')]=qs[_0x1641('0x4e')](_0x191162[_0x1641('0x44')][_0x1641('0x4e')]);_0x584324['where']=qs[_0x1641('0x46')](_[_0x1641('0x4f')](_0x191162[_0x1641('0x44')],_0x1755e9[_0x1641('0x46')]),_0x1ff0a6);if(_0x191162['query'][_0x1641('0x50')]){_0x584324[_0x1641('0x51')]=_[_0x1641('0x52')](_0x584324['where'],{'$or':_[_0x1641('0x3f')](_0x1ff0a6,function(_0x4d239a){if(_0x4d239a['type']!==_0x1641('0x53')){var _0x40fb30={};_0x40fb30[_0x4d239a[_0x1641('0x3b')]]={'$like':'%'+_0x191162[_0x1641('0x44')]['filter']+'%'};return _0x40fb30;}})});}_0x584324=_[_0x1641('0x52')]({},_0x584324,_0x191162[_0x1641('0x54')]);var _0x29a1d4={'where':_0x584324[_0x1641('0x51')]};return db['WhatsappAccount']['count'](_0x29a1d4)[_0x1641('0x22')](function(_0x5caa93){_0x3af836[_0x1641('0x30')]=_0x5caa93;if(_0x191162['query'][_0x1641('0x55')]){_0x584324[_0x1641('0x56')]=[{'all':!![]}];}return db[_0x1641('0x40')][_0x1641('0x57')](_0x584324);})[_0x1641('0x22')](function(_0x196674){_0x3af836[_0x1641('0x58')]=_0x196674;return _0x3af836;})['then'](respondWithFilteredResult(_0xe1c6b6,_0x584324))[_0x1641('0x2a')](handleError(_0xe1c6b6,null));};exports[_0x1641('0x59')]=function(_0x1ca0c5,_0x3c3870){var _0xd7ff7d={'raw':![],'where':{'id':_0x1ca0c5[_0x1641('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x1641('0x3e')}]},_0x5e7213={};_0x5e7213[_0x1641('0x43')]=_[_0x1641('0x45')](db['WhatsappAccount']['rawAttributes']);_0x5e7213[_0x1641('0x44')]=_[_0x1641('0x45')](_0x1ca0c5[_0x1641('0x44')]);_0x5e7213[_0x1641('0x46')]=_[_0x1641('0x47')](_0x5e7213['model'],_0x5e7213[_0x1641('0x44')]);_0xd7ff7d['attributes']=_['intersection'](_0x5e7213[_0x1641('0x43')],qs[_0x1641('0x49')](_0x1ca0c5['query']['fields']));_0xd7ff7d[_0x1641('0x48')]=_0xd7ff7d['attributes'][_0x1641('0x4a')]?_0xd7ff7d[_0x1641('0x48')]:_0x5e7213[_0x1641('0x43')];if(_0x1ca0c5[_0x1641('0x44')][_0x1641('0x55')]){_0xd7ff7d[_0x1641('0x56')]=[{'all':!![]}];}_0xd7ff7d=_['merge']({},_0xd7ff7d,_0x1ca0c5[_0x1641('0x54')]);return db[_0x1641('0x40')][_0x1641('0x5b')](_0xd7ff7d)[_0x1641('0x22')](handleEntityNotFound(_0x3c3870,null))[_0x1641('0x22')](respondWithResult(_0x3c3870,null))[_0x1641('0x2a')](handleError(_0x3c3870,null));};exports[_0x1641('0x5c')]=function(_0x2361b1,_0x5d04e8){return db[_0x1641('0x40')][_0x1641('0x5c')](_0x2361b1[_0x1641('0x5d')],{})['then'](function(_0x16e252){var _0x2201c8=_0x2361b1[_0x1641('0x5e')]['get']({'plain':!![]});if(!_0x2201c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2201c8[_0x1641('0x5f')]===_0x1641('0x5e')){var _0xd0e7b4=_0x16e252[_0x1641('0x37')]({'plain':!![]});var _0x4ac290=_0x1641('0x38');return db[_0x1641('0x60')][_0x1641('0x5b')]({'where':{'name':_0x4ac290,'userProfileId':_0x2201c8[_0x1641('0x61')]},'raw':!![]})[_0x1641('0x22')](function(_0x7068e8){if(_0x7068e8&&_0x7068e8[_0x1641('0x62')]===0x0){return db[_0x1641('0x63')]['create']({'name':_0xd0e7b4[_0x1641('0x3b')],'resourceId':_0xd0e7b4['id'],'type':_0x7068e8[_0x1641('0x3b')],'sectionId':_0x7068e8['id']},{})[_0x1641('0x22')](function(){return _0x16e252;});}else{return _0x16e252;}})[_0x1641('0x2a')](function(_0x4ee7e7){logger['error'](_0x1641('0x64'),_0x4ee7e7);throw _0x4ee7e7;});}return _0x16e252;})[_0x1641('0x22')](respondWithResult(_0x5d04e8,0xc9))[_0x1641('0x2a')](handleError(_0x5d04e8,null));};exports['update']=function(_0x3fc646,_0x3fe26b){if(_0x3fc646[_0x1641('0x5d')]['id']){delete _0x3fc646[_0x1641('0x5d')]['id'];}return db[_0x1641('0x40')][_0x1641('0x5b')]({'where':{'id':_0x3fc646[_0x1641('0x5a')]['id']},'include':[{'model':db[_0x1641('0x3d')],'as':_0x1641('0x3e')}]})[_0x1641('0x22')](handleEntityNotFound(_0x3fe26b,null))[_0x1641('0x22')](saveUpdates(_0x3fc646[_0x1641('0x5d')],null))[_0x1641('0x22')](respondWithResult(_0x3fe26b,null))['catch'](handleError(_0x3fe26b,null));};exports[_0x1641('0x39')]=function(_0x3426ad,_0x13ec47){return db[_0x1641('0x40')][_0x1641('0x5b')]({'where':{'id':_0x3426ad[_0x1641('0x5a')]['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x13ec47,null))[_0x1641('0x22')](removeEntity(_0x13ec47,null))[_0x1641('0x2a')](handleError(_0x13ec47,null));};exports['describe']=function(_0x147f29,_0x29acee){return db[_0x1641('0x40')][_0x1641('0x65')]()[_0x1641('0x22')](respondWithResult(_0x29acee,null))['catch'](handleError(_0x29acee,null));};exports[_0x1641('0x66')]=function(_0x272bc4,_0x34245d,_0x28f95c){if(_0x272bc4[_0x1641('0x5d')]['id']){delete _0x272bc4['body']['id'];}return db['WhatsappAccount'][_0x1641('0x5b')]({'where':{'id':_0x272bc4['params']['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x34245d,null))['then'](function(_0x2a9958){if(_0x2a9958){_0x272bc4['body'][_0x1641('0x67')]=_0x2a9958['id'];return db[_0x1641('0x68')][_0x1641('0x5c')](_0x272bc4[_0x1641('0x5d')]);}})[_0x1641('0x22')](respondWithResult(_0x34245d,null))[_0x1641('0x2a')](handleError(_0x34245d,null));};exports[_0x1641('0x69')]=function(_0x30fd48,_0x307b9a,_0x4e42a9){var _0x471745={'raw':![],'where':{}};var _0x451736={};var _0x4d74e7={'count':0x0,'rows':[]};return db[_0x1641('0x40')]['findOne']({'where':{'id':_0x30fd48[_0x1641('0x5a')]['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x307b9a,null))[_0x1641('0x22')](function(_0x46a767){if(_0x46a767){_0x451736[_0x1641('0x43')]=_[_0x1641('0x45')](db['Disposition'][_0x1641('0x6a')]);_0x451736[_0x1641('0x44')]=_[_0x1641('0x45')](_0x30fd48[_0x1641('0x44')]);_0x451736[_0x1641('0x46')]=_['intersection'](_0x451736[_0x1641('0x43')],_0x451736['query']);_0x471745[_0x1641('0x48')]=_[_0x1641('0x47')](_0x451736['model'],qs[_0x1641('0x49')](_0x30fd48[_0x1641('0x44')][_0x1641('0x49')]));_0x471745[_0x1641('0x48')]=_0x471745[_0x1641('0x48')][_0x1641('0x4a')]?_0x471745[_0x1641('0x48')]:_0x451736[_0x1641('0x43')];if(!_0x30fd48['query']['hasOwnProperty'](_0x1641('0x4c'))){_0x471745[_0x1641('0x2f')]=qs[_0x1641('0x2f')](_0x30fd48['query'][_0x1641('0x2f')]);_0x471745[_0x1641('0x2d')]=qs[_0x1641('0x2d')](_0x30fd48[_0x1641('0x44')][_0x1641('0x2d')]);}_0x471745[_0x1641('0x4d')]=qs['sort'](_0x30fd48[_0x1641('0x44')]['sort']);_0x471745[_0x1641('0x51')]=qs['filters'](_[_0x1641('0x4f')](_0x30fd48['query'],_0x451736['filters']));_0x471745[_0x1641('0x51')][_0x1641('0x67')]=_0x46a767['id'];if(_0x30fd48[_0x1641('0x44')][_0x1641('0x50')]){_0x471745['where']=_['merge'](_0x471745[_0x1641('0x51')],{'$or':_[_0x1641('0x3f')](_0x471745[_0x1641('0x48')],function(_0x50cf83){var _0x1fa235={};_0x1fa235[_0x50cf83]={'$like':'%'+_0x30fd48[_0x1641('0x44')]['filter']+'%'};return _0x1fa235;})});}_0x471745=_[_0x1641('0x52')]({},_0x471745,_0x30fd48[_0x1641('0x54')]);return db[_0x1641('0x68')][_0x1641('0x30')]({'where':_0x471745[_0x1641('0x51')]})['then'](function(_0x3d0d19){_0x4d74e7['count']=_0x3d0d19;if(_0x30fd48[_0x1641('0x44')][_0x1641('0x55')]){_0x471745[_0x1641('0x56')]=[{'all':!![]}];}return db[_0x1641('0x68')]['findAll'](_0x471745);})[_0x1641('0x22')](function(_0x295655){_0x4d74e7[_0x1641('0x58')]=_0x295655;return _0x4d74e7;});}})['then'](respondWithFilteredResult(_0x307b9a,_0x471745))['catch'](handleError(_0x307b9a,null));};exports[_0x1641('0x6b')]=function(_0x7cfc3a,_0x478a84,_0x565d1c){return db[_0x1641('0x40')]['find']({'where':{'id':_0x7cfc3a[_0x1641('0x5a')]['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x478a84,null))[_0x1641('0x22')](function(_0x389abd){if(_0x389abd){return _0x389abd[_0x1641('0x6b')](_0x7cfc3a['query']['ids']);}})['then'](respondWithStatusCode(_0x478a84,null))[_0x1641('0x2a')](handleError(_0x478a84,null));};exports[_0x1641('0x6c')]=function(_0x46dce8,_0x331ecb,_0x2791ef){if(_0x46dce8[_0x1641('0x5d')]['id']){delete _0x46dce8[_0x1641('0x5d')]['id'];}return db[_0x1641('0x40')]['find']({'where':{'id':_0x46dce8[_0x1641('0x5a')]['id']}})['then'](handleEntityNotFound(_0x331ecb,null))[_0x1641('0x22')](function(_0x37269e){if(_0x37269e){_0x46dce8[_0x1641('0x5d')]['WhatsappAccountId']=_0x37269e['id'];return db[_0x1641('0x6d')][_0x1641('0x5c')](_0x46dce8[_0x1641('0x5d')]);}})[_0x1641('0x22')](respondWithResult(_0x331ecb,null))[_0x1641('0x2a')](handleError(_0x331ecb,null));};exports[_0x1641('0x6e')]=function(_0x5eb226,_0x2cb817,_0x5e044a){var _0x6b44d5={'raw':![],'where':{}};var _0x17a1a5={};var _0xf359fa={'count':0x0,'rows':[]};return db[_0x1641('0x40')]['findOne']({'where':{'id':_0x5eb226[_0x1641('0x5a')]['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x2cb817,null))[_0x1641('0x22')](function(_0x36d198){if(_0x36d198){_0x17a1a5['model']=_[_0x1641('0x45')](db[_0x1641('0x6d')][_0x1641('0x6a')]);_0x17a1a5[_0x1641('0x44')]=_[_0x1641('0x45')](_0x5eb226[_0x1641('0x44')]);_0x17a1a5[_0x1641('0x46')]=_['intersection'](_0x17a1a5[_0x1641('0x43')],_0x17a1a5[_0x1641('0x44')]);_0x6b44d5[_0x1641('0x48')]=_['intersection'](_0x17a1a5[_0x1641('0x43')],qs['fields'](_0x5eb226[_0x1641('0x44')][_0x1641('0x49')]));_0x6b44d5['attributes']=_0x6b44d5['attributes']['length']?_0x6b44d5[_0x1641('0x48')]:_0x17a1a5[_0x1641('0x43')];if(!_0x5eb226[_0x1641('0x44')]['hasOwnProperty'](_0x1641('0x4c'))){_0x6b44d5[_0x1641('0x2f')]=qs[_0x1641('0x2f')](_0x5eb226[_0x1641('0x44')][_0x1641('0x2f')]);_0x6b44d5[_0x1641('0x2d')]=qs[_0x1641('0x2d')](_0x5eb226[_0x1641('0x44')][_0x1641('0x2d')]);}_0x6b44d5[_0x1641('0x4d')]=qs['sort'](_0x5eb226[_0x1641('0x44')][_0x1641('0x4e')]);_0x6b44d5[_0x1641('0x51')]=qs[_0x1641('0x46')](_[_0x1641('0x4f')](_0x5eb226[_0x1641('0x44')],_0x17a1a5[_0x1641('0x46')]));_0x6b44d5[_0x1641('0x51')]['WhatsappAccountId']=_0x36d198['id'];if(_0x5eb226['query']['filter']){_0x6b44d5[_0x1641('0x51')]=_['merge'](_0x6b44d5[_0x1641('0x51')],{'$or':_[_0x1641('0x3f')](_0x6b44d5[_0x1641('0x48')],function(_0x3454f5){var _0x590b2d={};_0x590b2d[_0x3454f5]={'$like':'%'+_0x5eb226['query'][_0x1641('0x50')]+'%'};return _0x590b2d;})});}_0x6b44d5=_[_0x1641('0x52')]({},_0x6b44d5,_0x5eb226[_0x1641('0x54')]);return db[_0x1641('0x6d')]['count']({'where':_0x6b44d5[_0x1641('0x51')]})[_0x1641('0x22')](function(_0x4efcc9){_0xf359fa[_0x1641('0x30')]=_0x4efcc9;if(_0x5eb226[_0x1641('0x44')][_0x1641('0x55')]){_0x6b44d5['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x1641('0x57')](_0x6b44d5);})[_0x1641('0x22')](function(_0x2daf1d){_0xf359fa[_0x1641('0x58')]=_0x2daf1d;return _0xf359fa;});}})['then'](respondWithFilteredResult(_0x2cb817,_0x6b44d5))[_0x1641('0x2a')](handleError(_0x2cb817,null));};exports['removeAnswers']=function(_0x18ba55,_0x203583,_0x4b0222){return db[_0x1641('0x40')][_0x1641('0x5b')]({'where':{'id':_0x18ba55['params']['id']}})['then'](handleEntityNotFound(_0x203583,null))['then'](function(_0x30aabf){if(_0x30aabf){return _0x30aabf[_0x1641('0x6f')](_0x18ba55[_0x1641('0x44')][_0x1641('0x70')]);}})['then'](respondWithStatusCode(_0x203583,null))[_0x1641('0x2a')](handleError(_0x203583,null));};exports['addAgents']=function(_0x12b16c,_0x567439,_0x45289a){return db[_0x1641('0x40')]['find']({'where':{'id':_0x12b16c['params']['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x567439,null))['then'](function(_0x414941){if(_0x414941){return _0x414941[_0x1641('0x71')](_0x12b16c[_0x1641('0x5d')][_0x1641('0x70')],_[_0x1641('0x72')](_0x12b16c['body'],[_0x1641('0x70'),'id'])||{})[_0x1641('0x73')](function(_0x1a7583){for(var _0x16c3bc=0x0;_0x16c3bc<_0x12b16c['body'][_0x1641('0x70')]['length'];_0x16c3bc+=0x1){socket[_0x1641('0x74')](_0x1641('0x75'),{'UserId':Number(_0x12b16c[_0x1641('0x5d')][_0x1641('0x70')][_0x16c3bc]),'WhatsappAccountId':Number(_0x12b16c[_0x1641('0x5a')]['id'])});}return _0x1a7583;});}})[_0x1641('0x22')](respondWithResult(_0x567439,null))['catch'](handleError(_0x567439,null));};exports[_0x1641('0x76')]=function(_0x2cb60b,_0xb906aa,_0x120c57){return db[_0x1641('0x40')]['find']({'where':{'id':_0x2cb60b['params']['id']}})['then'](handleEntityNotFound(_0xb906aa,null))[_0x1641('0x22')](function(_0xb6bcb1){if(_0xb6bcb1){return _0xb6bcb1['removeAgents'](_0x2cb60b['query'][_0x1641('0x70')])['then'](function(){if(_['isArray'](_0x2cb60b[_0x1641('0x44')][_0x1641('0x70')])){for(var _0x52ff6d=0x0;_0x52ff6d<_0x2cb60b[_0x1641('0x44')][_0x1641('0x70')][_0x1641('0x4a')];_0x52ff6d+=0x1){socket['emit'](_0x1641('0x77'),{'UserId':Number(_0x2cb60b[_0x1641('0x44')]['ids'][_0x52ff6d]),'WhatsappAccountId':Number(_0x2cb60b[_0x1641('0x5a')]['id'])});}}else{socket[_0x1641('0x74')](_0x1641('0x77'),{'UserId':Number(_0x2cb60b[_0x1641('0x44')][_0x1641('0x70')]),'WhatsappAccountId':Number(_0x2cb60b[_0x1641('0x5a')]['id'])});}});}})[_0x1641('0x22')](respondWithStatusCode(_0xb906aa,null))[_0x1641('0x2a')](handleError(_0xb906aa,null));};exports[_0x1641('0x78')]=function(_0x42b8f6,_0x13b75b,_0x1e1d9d){var _0xec8117={};var _0x3ca8c8={};var _0xe8c7c7;var _0x494608;return db[_0x1641('0x40')][_0x1641('0x79')]({'where':{'id':_0x42b8f6[_0x1641('0x5a')]['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x13b75b,null))[_0x1641('0x22')](function(_0x94650b){if(_0x94650b){_0xe8c7c7=_0x94650b;_0x3ca8c8[_0x1641('0x43')]=_['keys'](db[_0x1641('0x7a')][_0x1641('0x6a')]);_0x3ca8c8[_0x1641('0x44')]=_['keys'](_0x42b8f6['query']);_0x3ca8c8[_0x1641('0x46')]=_[_0x1641('0x47')](_0x3ca8c8[_0x1641('0x43')],_0x3ca8c8[_0x1641('0x44')]);_0xec8117[_0x1641('0x48')]=_[_0x1641('0x47')](_0x3ca8c8[_0x1641('0x43')],qs[_0x1641('0x49')](_0x42b8f6[_0x1641('0x44')][_0x1641('0x49')]));_0xec8117[_0x1641('0x48')]=_0xec8117[_0x1641('0x48')][_0x1641('0x4a')]?_0xec8117[_0x1641('0x48')]:_0x3ca8c8['model'];_0xec8117[_0x1641('0x4d')]=qs[_0x1641('0x4e')](_0x42b8f6[_0x1641('0x44')]['sort']);_0xec8117[_0x1641('0x51')]=qs[_0x1641('0x46')](_['pick'](_0x42b8f6[_0x1641('0x44')],_0x3ca8c8[_0x1641('0x46')]));if(_0x42b8f6['query'][_0x1641('0x50')]){_0xec8117['where']=_[_0x1641('0x52')](_0xec8117['where'],{'$or':_[_0x1641('0x3f')](_0xec8117[_0x1641('0x48')],function(_0x165290){var _0xc6fd9f={};_0xc6fd9f[_0x165290]={'$like':'%'+_0x42b8f6[_0x1641('0x44')][_0x1641('0x50')]+'%'};return _0xc6fd9f;})});}_0xec8117=_[_0x1641('0x52')]({},_0xec8117,_0x42b8f6[_0x1641('0x54')]);return _0xe8c7c7[_0x1641('0x78')](_0xec8117);}})[_0x1641('0x22')](function(_0x26b540){if(_0x26b540){_0x494608=_0x26b540[_0x1641('0x4a')];if(!_0x42b8f6['query'][_0x1641('0x4b')](_0x1641('0x4c'))){_0xec8117[_0x1641('0x2f')]=qs[_0x1641('0x2f')](_0x42b8f6[_0x1641('0x44')]['limit']);_0xec8117['offset']=qs[_0x1641('0x2d')](_0x42b8f6['query'][_0x1641('0x2d')]);}return _0xe8c7c7[_0x1641('0x78')](_0xec8117);}})['then'](function(_0x3ba8b8){if(_0x3ba8b8){return _0x3ba8b8?{'count':_0x494608,'rows':_0x3ba8b8}:null;}})[_0x1641('0x22')](respondWithResult(_0x13b75b,null))[_0x1641('0x2a')](handleError(_0x13b75b,null));};exports[_0x1641('0x7b')]=function(_0x21982c,_0x1cfb0d){var _0x38df68=_0x21982c[_0x1641('0x5a')]['id'];var _0x26d137=_0x21982c['body'];var _0x1eb142=0xc8;var _0x215144=null;return db[_0x1641('0x7c')]['transaction']({'isolationLevel':db[_0x1641('0x7c')][_0x1641('0x7d')][_0x1641('0x7e')][_0x1641('0x7f')]},function(_0x17d097){return db[_0x1641('0x40')][_0x1641('0x79')]({'where':{'id':_0x38df68},'transaction':_0x17d097})['then'](function(_0x1e5781){if(_0x1e5781){return db[_0x1641('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x38df68},'transaction':_0x17d097})[_0x1641('0x22')](function(){var _0x4f418e=_[_0x1641('0x3f')](_0x26d137,function(_0x3d1c0b){_0x3d1c0b[_0x1641('0x67')]=_0x38df68;return _0x3d1c0b;});return db[_0x1641('0x80')][_0x1641('0x81')](_0x4f418e,{'transaction':_0x17d097});});}else{_0x1eb142=0x194;_0x215144=[];}});})['then'](function(){if(_0x1eb142!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x38df68},'order':_0x1641('0x82')})[_0x1641('0x22')](function(_0x5b24c7){_0x215144=_0x5b24c7;});}})[_0x1641('0x2a')](function(_0x19c1f8){_0x1eb142=0x1f4;logger[_0x1641('0x25')](_0x19c1f8[_0x1641('0x83')]);if(_0x19c1f8[_0x1641('0x3b')]){delete _0x19c1f8[_0x1641('0x3b')];}_0x215144=_0x19c1f8;})[_0x1641('0x84')](function(){if(_0x215144===null){_0x1cfb0d['sendStatus'](_0x1eb142);}else{if(_0x1eb142===0x1f4){_0x1cfb0d[_0x1641('0x31')](_0x1eb142)[_0x1641('0x3c')](_0x215144);}else{_0x1cfb0d[_0x1641('0x31')](_0x1eb142)[_0x1641('0x2c')](_0x215144);}}});};exports[_0x1641('0x85')]=function(_0x3cab23,_0x3db8d8,_0x172380){var _0x180b4d={};var _0x691dee={};var _0x2e5701;var _0xff884d;return db[_0x1641('0x40')][_0x1641('0x79')]({'where':{'id':_0x3cab23[_0x1641('0x5a')]['id']}})[_0x1641('0x22')](handleEntityNotFound(_0x3db8d8,null))[_0x1641('0x22')](function(_0x5d4b63){if(_0x5d4b63){_0x2e5701=_0x5d4b63;_0x691dee['model']=_[_0x1641('0x45')](db[_0x1641('0x80')][_0x1641('0x6a')]);_0x691dee[_0x1641('0x44')]=_[_0x1641('0x45')](_0x3cab23[_0x1641('0x44')]);_0x691dee[_0x1641('0x46')]=_[_0x1641('0x47')](_0x691dee['model'],_0x691dee[_0x1641('0x44')]);_0x180b4d[_0x1641('0x48')]=_[_0x1641('0x47')](_0x691dee[_0x1641('0x43')],qs[_0x1641('0x49')](_0x3cab23[_0x1641('0x44')][_0x1641('0x49')]));_0x180b4d[_0x1641('0x48')]=_0x180b4d[_0x1641('0x48')][_0x1641('0x4a')]?_0x180b4d['attributes']:_0x691dee['model'];_0x180b4d[_0x1641('0x4d')]=qs[_0x1641('0x4e')](_0x3cab23['query'][_0x1641('0x4e')]);_0x180b4d[_0x1641('0x51')]=qs[_0x1641('0x46')](_[_0x1641('0x4f')](_0x3cab23['query'],_0x691dee[_0x1641('0x46')]));if(_0x3cab23[_0x1641('0x44')][_0x1641('0x50')]){_0x180b4d[_0x1641('0x51')]=_['merge'](_0x180b4d['where'],{'$or':_['map'](_0x180b4d[_0x1641('0x48')],function(_0x3e1acd){var _0x53fbc0={};_0x53fbc0[_0x3e1acd]={'$like':'%'+_0x3cab23[_0x1641('0x44')][_0x1641('0x50')]+'%'};return _0x53fbc0;})});}_0x180b4d=_[_0x1641('0x52')]({},_0x180b4d,_0x3cab23['options']);return _0x2e5701[_0x1641('0x85')](_0x180b4d);}})[_0x1641('0x22')](function(_0x217b81){if(_0x217b81){_0xff884d=_0x217b81[_0x1641('0x4a')];if(!_0x3cab23['query'][_0x1641('0x4b')](_0x1641('0x4c'))){_0x180b4d[_0x1641('0x2f')]=qs[_0x1641('0x2f')](_0x3cab23[_0x1641('0x44')][_0x1641('0x2f')]);_0x180b4d[_0x1641('0x2d')]=qs[_0x1641('0x2d')](_0x3cab23[_0x1641('0x44')][_0x1641('0x2d')]);}return _0x2e5701[_0x1641('0x85')](_0x180b4d);}})['then'](function(_0x4f7a8c){if(_0x4f7a8c){return _0x4f7a8c?{'count':_0xff884d,'rows':_0x4f7a8c}:null;}})['then'](respondWithResult(_0x3db8d8,null))['catch'](handleError(_0x3db8d8,null));};exports[_0x1641('0x86')]=function(_0x18fbe3,_0x49f06c,_0xeaae01){var _0x4cb82c={'channel':_0x1641('0x87')};var _0x54be67=[];var _0x10c8d0=[];var _0x243b9a={};return db[_0x1641('0x40')][_0x1641('0x5b')]({'where':{'id':_0x18fbe3[_0x1641('0x5a')]['id']},'include':[{'model':db[_0x1641('0x80')],'as':_0x1641('0x88')}]})['then'](handleEntityNotFound(_0x49f06c,null))['then'](function(_0x590e5a){_0x4cb82c[_0x1641('0x89')]=_0x590e5a;if(_0x4cb82c[_0x1641('0x89')]&&_0x4cb82c[_0x1641('0x89')][_0x1641('0x41')]===_0x1641('0x8a')&&_0x18fbe3[_0x1641('0x5d')][_0x1641('0x8b')]){if(_0x18fbe3['body'][_0x1641('0x8b')]['length']===0x0)return;if(_0x18fbe3[_0x1641('0x5d')][_0x1641('0x8b')][0x0]['state']!==_0x1641('0x8c'))return;return db[_0x1641('0x8d')][_0x1641('0x36')]({'read':!![],'readAt':_0x18fbe3[_0x1641('0x5d')][_0x1641('0x8b')][0x0]['timestamp']},{'where':{'messageId':_0x18fbe3[_0x1641('0x5d')][_0x1641('0x8b')][0x0][_0x1641('0x8e')]},'individualHooks':!![]})[_0x1641('0x22')](function(_0x55c23c){return _0x49f06c[_0x1641('0x31')](0xc8)[_0x1641('0x2c')](_0x55c23c);});}_0x4cb82c[_0x1641('0x8f')]=_['orderBy'](_0x590e5a[_0x1641('0x88')],['priority'],[_0x1641('0x90')]);if(_0x4cb82c[_0x1641('0x89')][_0x1641('0x88')]){delete _0x4cb82c[_0x1641('0x89')][_0x1641('0x88')];}return db[_0x1641('0x91')]['describe']()[_0x1641('0x22')](function(_0x2f9f23){if(!_0x2f9f23){throw new db[(_0x1641('0x92'))][(_0x1641('0x93'))](_0x1641('0x94'));}_0x54be67=_[_0x1641('0x95')](_['keys'](_0x2f9f23),[_0x1641('0x96'),_0x1641('0x97')]);_0x10c8d0=_[_0x1641('0x95')](_[_0x1641('0x45')](_0x2f9f23),['createdAt',_0x1641('0x97'),_0x1641('0x98'),_0x1641('0x99')]);_0x4cb82c[_0x1641('0x5d')]={'mapKey':_0x1641('0x9a')};if(_0x4cb82c[_0x1641('0x89')]&&_0x4cb82c['account'][_0x1641('0x41')]===_0x1641('0x9b')){_0x4cb82c[_0x1641('0x5d')]['from']=_0x18fbe3['body'][_0x1641('0x9c')][_0x1641('0x9d')](_0x1641('0x9e'),'');_0x4cb82c[_0x1641('0x5d')][_0x1641('0x5d')]=_0x18fbe3[_0x1641('0x5d')][_0x1641('0x9f')];_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa0')]=_0x18fbe3[_0x1641('0x5d')]['MessageSid'];}if(_0x4cb82c[_0x1641('0x89')]&&_0x4cb82c[_0x1641('0x89')][_0x1641('0x41')]===_0x1641('0x8a')){_0x4cb82c[_0x1641('0x5d')]['from']=_0x18fbe3[_0x1641('0x5d')][_0x1641('0xa1')][0x0][_0x1641('0xa2')];_0x4cb82c[_0x1641('0x5d')][_0x1641('0x5d')]=_0x18fbe3[_0x1641('0x5d')]['notifications'][0x0][_0x1641('0x27')][_0x1641('0x5d')];_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa0')]=_0x18fbe3['body'][_0x1641('0xa1')][0x0][_0x1641('0x8e')];}if(_0x4cb82c[_0x1641('0x5d')]['id']){delete _0x4cb82c['body']['id'];}if(_['isNil'](_0x4cb82c['body'][_0x1641('0xa2')])){throw new db[(_0x1641('0x92'))][(_0x1641('0x93'))]('from\x20is\x20mandatory');}if(_[_0x1641('0xa3')](_0x4cb82c[_0x1641('0x5d')][_0x1641('0x5d')])||_0x4cb82c['body'][_0x1641('0x5d')]===''){throw new db[(_0x1641('0x92'))][(_0x1641('0x93'))](_0x1641('0xa4'));}if(_['isNil'](_0x4cb82c['body']['mapKey'])){throw new db['Sequelize'][(_0x1641('0x93'))](_0x1641('0xa5')+_0x10c8d0);}if(!_[_0x1641('0xa6')](_0x10c8d0,_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa7')])){throw new db['Sequelize']['ValidationError'](_0x1641('0xa8')+_0x10c8d0);}_0x243b9a[_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa7')]]=_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa2')];return db[_0x1641('0xa9')][_0x1641('0x5b')]({'where':{'id':_0x4cb82c[_0x1641('0x89')]['ListId']},'include':[{'model':db[_0x1641('0x91')],'as':_0x1641('0xaa'),'where':_0x243b9a,'limit':0x1,'order':[[_0x1641('0x97'),_0x1641('0xab')]]}]});})[_0x1641('0x22')](handleEntityNotFound(_0x49f06c,null))[_0x1641('0x22')](function(_0x2152ac){if(_0x2152ac){_0x4cb82c[_0x1641('0xac')]=_[_0x1641('0x72')](_0x2152ac,['Contacts']);if(_0x2152ac['Contacts'][_0x1641('0x4a')]){return _0x2152ac[_0x1641('0xaa')][0x0];}var _0x5107ff=_['defaults'](_0x4cb82c[_0x1641('0x5d')],{'firstName':_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa2')],'ListId':_0x2152ac['id']});_0x5107ff[_0x4cb82c['body'][_0x1641('0xa7')]]=_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa2')];return db[_0x1641('0x91')][_0x1641('0x5c')](_0x5107ff,{'fields':_0x54be67,'raw':!![]});}})[_0x1641('0x22')](handleEntityNotFound(_0x49f06c,null))['then'](function(_0x632664){if(_0x632664){_0x4cb82c[_0x1641('0xad')]=_0x632664;var _0x3f49ab={'ContactId':_0x632664['id'],'phone':_0x4cb82c[_0x1641('0x5d')]['from'],'WhatsappAccountId':_0x18fbe3['params']['id']};var _0xde2036={'ContactId':_0x632664['id'],'WhatsappAccountId':_0x18fbe3['params']['id'],'closed':![]};return db[_0x1641('0xae')]['find']({'where':_0xde2036})[_0x1641('0x22')](function(_0x375d7f){if(_0x375d7f){return[_0x375d7f,![]];}return db[_0x1641('0xae')]['create'](_0x3f49ab)[_0x1641('0x22')](function(_0x5c2edd){return[_0x5c2edd,!![]];});});}})[_0x1641('0x73')](function(_0x2ae8ac,_0x1f117e){_0x4cb82c['interaction']=_0x2ae8ac[_0x1641('0x37')]({'plain':!![]});_0x4cb82c[_0x1641('0xaf')][_0x1641('0xb0')]=![];if(_0x1f117e){if(_0x4cb82c[_0x1641('0x89')][_0x1641('0xb1')]){_0x4cb82c[_0x1641('0x8f')][_0x1641('0xb2')]({'id':0x0,'priority':_0x4cb82c['applications'][_0x1641('0x4a')]+0x1,'app':_0x1641('0xb3'),'appdata':_0x1641('0xb4'),'interval':_0x1641('0xb5')});}_0x4cb82c[_0x1641('0xaf')][_0x1641('0xb0')]=!![];}return db['WhatsappMessage'][_0x1641('0x5c')]({'phone':_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa2')],'messageId':_0x4cb82c[_0x1641('0x5d')][_0x1641('0xa0')],'body':_0x4cb82c[_0x1641('0x5d')][_0x1641('0x5d')],'WhatsappAccountId':_0x18fbe3[_0x1641('0x5a')]['id'],'WhatsappInteractionId':_0x2ae8ac['id'],'direction':'in','ContactId':_0x2ae8ac[_0x1641('0xb6')],'AttachmentId':_0x4cb82c[_0x1641('0x5d')]['AttachmentId']});})[_0x1641('0x22')](function(_0x1f17d4){_0x4cb82c[_0x1641('0x27')]=_0x1f17d4;if(_0x4cb82c[_0x1641('0xaf')][_0x1641('0xb7')]){return db[_0x1641('0x7a')][_0x1641('0x5b')]({'attributes':['id',_0x1641('0x3b')],'where':{'id':_0x4cb82c[_0x1641('0xaf')]['UserId']}})[_0x1641('0x22')](function(_0x2f54fc){if(_0x2f54fc){_0x4cb82c[_0x1641('0x8f')][_0x1641('0xb8')]({'id':0x0,'priority':0x0,'app':_0x1641('0xb9'),'appdata':_0x2f54fc['name']+','+(_0x4cb82c['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1641('0xb5')});}return respondWithRpcPromise(_0x1641('0xba'),_0x1641('0xbb'),_0x4cb82c);});}return respondWithRpcPromise(_0x1641('0xba'),'startRouting',_0x4cb82c);})[_0x1641('0x22')](function(_0x4ee86f){if(_0x4ee86f){var _0x5a6805=0xc8;var _0x1c390e=_0x1641('0xbc');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1c390e,_0x5a6805,_0x1641('0xbd'));logger[_0x1641('0xbe')](_0x1641('0xbf'),_0x1c390e,_0x5a6805,_0x1641('0xbd'),JSON['stringify'](_0x4ee86f));if(_0x4cb82c[_0x1641('0x89')][_0x1641('0x41')]===_0x1641('0x9b')){return _0x49f06c[_0x1641('0x31')](_0x5a6805)['set'](_0x1641('0xc0'),_0x1641('0xc1'))[_0x1641('0x3c')](_0x1641('0xc2'));}else{return _0x49f06c[_0x1641('0x31')](_0x5a6805)['json'](_0x4ee86f);}}});})['catch'](handleError(_0x49f06c,null));};exports[_0x1641('0x3c')]=function(_0x20aa0a,_0x2afe86,_0xeff4d1){var _0x21e653,_0x348e98,_0x54d5f2;if(_['isNil'](_0x20aa0a[_0x1641('0x5d')]['body'])||_0x20aa0a[_0x1641('0x5d')][_0x1641('0x5d')]===''){throw new db['Sequelize'][(_0x1641('0x93'))](_0x1641('0xa4'));}if(_[_0x1641('0xa3')](_0x20aa0a['body']['to'])){throw new db[(_0x1641('0x92'))]['ValidationError'](_0x1641('0xc3'));}_0x21e653=_0x20aa0a['body']['to'];return db[_0x1641('0x40')][_0x1641('0x5b')]({'where':{'id':_0x20aa0a['params']['id']},'include':[{'model':db[_0x1641('0xa9')],'as':_0x1641('0xc4'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x21e653},'limit':0x1,'order':[[_0x1641('0x97'),'DESC']]}]}]})[_0x1641('0x22')](handleEntityNotFound(_0x2afe86,null))[_0x1641('0x22')](function(_0x5e68c8){if(_0x5e68c8&&_0x5e68c8[_0x1641('0xc4')]){_0x348e98=_0x5e68c8[_0x1641('0x37')]({'plain':!![]});if(_0x348e98['List']&&_0x348e98[_0x1641('0xc4')][_0x1641('0xaa')][_0x1641('0x4a')]){return _0x348e98[_0x1641('0xc4')][_0x1641('0xaa')][0x0];}return db[_0x1641('0x91')][_0x1641('0x5c')](_[_0x1641('0xc5')](_0x20aa0a[_0x1641('0x5d')],{'firstName':_0x21e653,'mobile':_0x21e653,'phone':_0x21e653,'ListId':_0x348e98[_0x1641('0x99')]}));}})[_0x1641('0x22')](handleEntityNotFound(_0x2afe86,null))[_0x1641('0x22')](function(_0x166ca3){if(_0x166ca3){_0x54d5f2=_0x166ca3;return db[_0x1641('0xae')][_0x1641('0x5b')]({'where':{'ContactId':_0x54d5f2['id'],'closed':![],'WhatsappAccountId':_0x348e98['id']}})[_0x1641('0x22')](function(_0x48055f){if(_0x48055f){return[_0x48055f,![]];}return db[_0x1641('0xae')][_0x1641('0x5c')]({'UserId':_0x20aa0a['user']['id'],'ContactId':_0x54d5f2['id'],'WhatsappAccountId':_0x348e98['id'],'phone':_0x21e653,'firstMsgDirection':_0x1641('0xc6'),'Messages':[_[_0x1641('0x52')](_0x20aa0a[_0x1641('0x5d')],{'read':![],'body':_0x20aa0a[_0x1641('0x5d')][_0x1641('0x5d')],'phone':_0x21e653,'WhatsappAccountId':_0x348e98['id'],'UserId':_0x20aa0a[_0x1641('0x5e')]['id'],'ContactId':_0x54d5f2['id']})]},{'include':[{'model':db[_0x1641('0x8d')],'as':_0x1641('0xc7')}]})[_0x1641('0x22')](function(_0x373b74){return[_0x373b74,!![]];});});}})[_0x1641('0x73')](function(_0x39404f,_0x3edf6e){if(_0x3edf6e){return _0x39404f;}return db[_0x1641('0x8d')][_0x1641('0x5c')](_['merge'](_0x20aa0a[_0x1641('0x5d')],{'read':![],'body':_0x20aa0a[_0x1641('0x5d')][_0x1641('0x5d')],'phone':_0x21e653,'WhatsappAccountId':_0x348e98['id'],'WhatsappInteractionId':_0x39404f['id'],'UserId':_0x20aa0a['user']['id'],'ContactId':_0x54d5f2['id']}))['then'](function(_0x2260c0){_0x39404f[_0x1641('0xc8')][_0x1641('0xc7')]=[];_0x39404f['dataValues'][_0x1641('0xc7')][_0x1641('0xb2')](_0x2260c0[_0x1641('0xc8')]);return _0x39404f;});})[_0x1641('0x22')](respondWithResult(_0x2afe86,null))[_0x1641('0x2a')](handleError(_0x2afe86,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 97845b4..ad554ea 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 _0x089a=['../../mysqldb','WhatsappAccount','save','hasOwnProperty','exports','events'];(function(_0x4079af,_0x327481){var _0x1d6a7a=function(_0x4130ac){while(--_0x4130ac){_0x4079af['push'](_0x4079af['shift']());}};_0x1d6a7a(++_0x327481);}(_0x089a,0x15b));var _0xa089=function(_0x21dd4c,_0x397d59){_0x21dd4c=_0x21dd4c-0x0;var _0x21c5b9=_0x089a[_0x21dd4c];return _0x21c5b9;};'use strict';var EventEmitter=require(_0xa089('0x0'));var WhatsappAccount=require(_0xa089('0x1'))['db'][_0xa089('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa089('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ed554){return function(_0x4745ee,_0x4c5088,_0x2c99af){WhatsappAccountEvents['emit'](_0x1ed554+':'+_0x4745ee['id'],_0x4745ee);WhatsappAccountEvents['emit'](_0x1ed554,_0x4745ee);_0x2c99af(null);};}for(var e in events){if(events[_0xa089('0x4')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa089('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9a64=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x136aa5,_0x5fc2){var _0x55698e=function(_0x4fc0ab){while(--_0x4fc0ab){_0x136aa5['push'](_0x136aa5['shift']());}};_0x55698e(++_0x5fc2);}(_0x9a64,0x82));var _0x49a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a64[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x49a6('0x0'));var WhatsappAccount=require(_0x49a6('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x49a6('0x2'),'afterUpdate':'update','afterDestroy':_0x49a6('0x3')};function emitEvent(_0x3e3806){return function(_0xe17daa,_0xec4739,_0x4a8dac){WhatsappAccountEvents[_0x49a6('0x4')](_0x3e3806+':'+_0xe17daa['id'],_0xe17daa);WhatsappAccountEvents[_0x49a6('0x4')](_0x3e3806,_0xe17daa);_0x4a8dac(null);};}for(var e in events){if(events[_0x49a6('0x5')](e)){var event=events[e];WhatsappAccount[_0x49a6('0x6')](e,emitEvent(event));}}module[_0x49a6('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 3183477..8488f6e 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 _0x0a91=['whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x3c9817,_0x3a5e94){var _0x57b25b=function(_0x37abfc){while(--_0x37abfc){_0x3c9817['push'](_0x3c9817['shift']());}};_0x57b25b(++_0x3a5e94);}(_0x0a91,0x12d));var _0x10a9=function(_0x302b5e,_0x564a8e){_0x302b5e=_0x302b5e-0x0;var _0x523ab7=_0x0a91[_0x302b5e];return _0x523ab7;};'use strict';var _=require(_0x10a9('0x0'));var util=require('util');var logger=require(_0x10a9('0x1'))(_0x10a9('0x2'));var moment=require(_0x10a9('0x3'));var BPromise=require(_0x10a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10a9('0x5'));var rimraf=require('rimraf');var config=require(_0x10a9('0x6'));var attributes=require(_0x10a9('0x7'));module[_0x10a9('0x8')]=function(_0x12d48d,_0x379fd6){return _0x12d48d[_0x10a9('0x9')](_0x10a9('0xa'),attributes,{'tableName':_0x10a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1ff=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','util','../../config/logger'];(function(_0x3bd2ec,_0x199c06){var _0x216858=function(_0x4404ea){while(--_0x4404ea){_0x3bd2ec['push'](_0x3bd2ec['shift']());}};_0x216858(++_0x199c06);}(_0xd1ff,0x112));var _0xfd1f=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0xd1ff[_0x391c55];return _0xa434e0;};'use strict';var _=require('lodash');var util=require(_0xfd1f('0x0'));var logger=require(_0xfd1f('0x1'))(_0xfd1f('0x2'));var moment=require(_0xfd1f('0x3'));var BPromise=require(_0xfd1f('0x4'));var rp=require(_0xfd1f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd1f('0x6'));var config=require(_0xfd1f('0x7'));var attributes=require(_0xfd1f('0x8'));module[_0xfd1f('0x9')]=function(_0x5da313,_0x113185){return _0x5da313[_0xfd1f('0xa')](_0xfd1f('0xb'),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 d52d7f0..dd4d62f 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 _0xd260=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappAccount','find','options','attributes','include','map','model','ShowWhatsappAccount'];(function(_0x1e44a5,_0x35a714){var _0x54a65e=function(_0x5a89cf){while(--_0x5a89cf){_0x1e44a5['push'](_0x1e44a5['shift']());}};_0x54a65e(++_0x35a714);}(_0xd260,0x1a4));var _0x0d26=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0xd260[_0x5b5eb4];return _0x42af53;};'use strict';var _=require(_0x0d26('0x0'));var util=require(_0x0d26('0x1'));var moment=require(_0x0d26('0x2'));var BPromise=require(_0x0d26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d26('0x4'));var db=require(_0x0d26('0x5'))['db'];var utils=require(_0x0d26('0x6'));var logger=require(_0x0d26('0x7'))(_0x0d26('0x8'));var config=require(_0x0d26('0x9'));var jayson=require(_0x0d26('0xa'));var client=jayson['client'][_0x0d26('0xb')]({'port':0x232a});config[_0x0d26('0xc')]=_[_0x0d26('0xd')](config[_0x0d26('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d26('0xe'))[_0x0d26('0xf')](socket);function respondWithRpcPromise(_0x1a744f,_0x138b5c,_0x1c4a14){return new BPromise(function(_0x119a13,_0x407a31){return client[_0x0d26('0x10')](_0x1a744f,_0x1c4a14)[_0x0d26('0x11')](function(_0x13e46c){logger['info'](_0x0d26('0x12'),_0x138b5c,_0x0d26('0x13'));logger[_0x0d26('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x138b5c,_0x0d26('0x13'),JSON[_0x0d26('0x15')](_0x13e46c));if(_0x13e46c[_0x0d26('0x16')]){if(_0x13e46c[_0x0d26('0x16')][_0x0d26('0x17')]===0x1f4){logger['error'](_0x0d26('0x12'),_0x138b5c,_0x13e46c[_0x0d26('0x16')][_0x0d26('0x18')]);return _0x407a31(_0x13e46c[_0x0d26('0x16')][_0x0d26('0x18')]);}logger[_0x0d26('0x16')](_0x0d26('0x12'),_0x138b5c,_0x13e46c[_0x0d26('0x16')]['message']);return _0x119a13(_0x13e46c['error'][_0x0d26('0x18')]);}else{logger['info'](_0x0d26('0x12'),_0x138b5c,'request\x20sent');_0x119a13(_0x13e46c[_0x0d26('0x19')][_0x0d26('0x18')]);}})[_0x0d26('0x1a')](function(_0x5a18e5){logger[_0x0d26('0x16')](_0x0d26('0x12'),_0x138b5c,_0x5a18e5);_0x407a31(_0x5a18e5);});});}exports['ShowWhatsappAccount']=function(_0x26702b){var _0x2013c5=this;return new Promise(function(_0x17ed5f,_0x15e660){return db[_0x0d26('0x1b')][_0x0d26('0x1c')]({'raw':_0x26702b[_0x0d26('0x1d')]?_0x26702b['options']['raw']===undefined?!![]:![]:!![],'where':_0x26702b[_0x0d26('0x1d')]?_0x26702b['options']['where']||null:null,'attributes':_0x26702b[_0x0d26('0x1d')]?_0x26702b[_0x0d26('0x1d')][_0x0d26('0x1e')]||null:null,'include':_0x26702b[_0x0d26('0x1d')]?_0x26702b[_0x0d26('0x1d')][_0x0d26('0x1f')]?_[_0x0d26('0x20')](_0x26702b[_0x0d26('0x1d')][_0x0d26('0x1f')],function(_0x1d61ae){return{'model':db[_0x1d61ae[_0x0d26('0x21')]],'as':_0x1d61ae['as'],'attributes':_0x1d61ae[_0x0d26('0x1e')],'include':_0x1d61ae[_0x0d26('0x1f')]?_[_0x0d26('0x20')](_0x1d61ae['include'],function(_0xe74647){return{'model':db[_0xe74647['model']],'as':_0xe74647['as'],'attributes':_0xe74647[_0x0d26('0x1e')],'include':_0xe74647[_0x0d26('0x1f')]?_['map'](_0xe74647[_0x0d26('0x1f')],function(_0x43edd5){return{'model':db[_0x43edd5[_0x0d26('0x21')]],'as':_0x43edd5['as'],'attributes':_0x43edd5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fcf7a){logger['info'](_0x0d26('0x22'),_0x26702b);logger[_0x0d26('0x14')]('ShowWhatsappAccount',_0x26702b,JSON[_0x0d26('0x15')](_0x4fcf7a));_0x17ed5f(_0x4fcf7a);})[_0x0d26('0x1a')](function(_0x12467b){logger[_0x0d26('0x16')]('ShowWhatsappAccount',_0x12467b['message'],_0x26702b);_0x15e660(_0x2013c5[_0x0d26('0x16')](0x1f4,_0x12467b[_0x0d26('0x18')]));});});}; \ No newline at end of file +var _0x578f=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x25a92f,_0x352bf0){var _0x1e43fe=function(_0x467615){while(--_0x467615){_0x25a92f['push'](_0x25a92f['shift']());}};_0x1e43fe(++_0x352bf0);}(_0x578f,0x176));var _0xf578=function(_0x1ed007,_0x4bca3f){_0x1ed007=_0x1ed007-0x0;var _0x40c7be=_0x578f[_0x1ed007];return _0x40c7be;};'use strict';var _=require(_0xf578('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf578('0x1'));var rs=require(_0xf578('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf578('0x3'))['db'];var utils=require(_0xf578('0x4'));var logger=require(_0xf578('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf578('0x6'));var client=jayson['client'][_0xf578('0x7')]({'port':0x232a});config[_0xf578('0x8')]=_['defaults'](config['redis'],{'host':_0xf578('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf578('0x8')]));require(_0xf578('0xa'))['register'](socket);function respondWithRpcPromise(_0x3e81d7,_0x370ce3,_0x2b7227){return new BPromise(function(_0x238038,_0x5d2201){return client[_0xf578('0xb')](_0x3e81d7,_0x2b7227)[_0xf578('0xc')](function(_0x5049b4){logger[_0xf578('0xd')](_0xf578('0xe'),_0x370ce3,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x370ce3,_0xf578('0xf'),JSON[_0xf578('0x10')](_0x5049b4));if(_0x5049b4[_0xf578('0x11')]){if(_0x5049b4[_0xf578('0x11')][_0xf578('0x12')]===0x1f4){logger[_0xf578('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x370ce3,_0x5049b4['error'][_0xf578('0x13')]);return _0x5d2201(_0x5049b4[_0xf578('0x11')][_0xf578('0x13')]);}logger[_0xf578('0x11')](_0xf578('0xe'),_0x370ce3,_0x5049b4[_0xf578('0x11')][_0xf578('0x13')]);return _0x238038(_0x5049b4[_0xf578('0x11')][_0xf578('0x13')]);}else{logger[_0xf578('0xd')]('WhatsappAccount,\x20%s,\x20%s',_0x370ce3,_0xf578('0xf'));_0x238038(_0x5049b4[_0xf578('0x14')][_0xf578('0x13')]);}})[_0xf578('0x15')](function(_0x1b3f14){logger[_0xf578('0x11')](_0xf578('0xe'),_0x370ce3,_0x1b3f14);_0x5d2201(_0x1b3f14);});});}exports[_0xf578('0x16')]=function(_0x4114b0){var _0x41d712=this;return new Promise(function(_0x14cc25,_0x101de9){return db[_0xf578('0x17')][_0xf578('0x18')]({'raw':_0x4114b0[_0xf578('0x19')]?_0x4114b0[_0xf578('0x19')][_0xf578('0x1a')]===undefined?!![]:![]:!![],'where':_0x4114b0[_0xf578('0x19')]?_0x4114b0[_0xf578('0x19')][_0xf578('0x1b')]||null:null,'attributes':_0x4114b0['options']?_0x4114b0[_0xf578('0x19')][_0xf578('0x1c')]||null:null,'include':_0x4114b0[_0xf578('0x19')]?_0x4114b0['options'][_0xf578('0x1d')]?_[_0xf578('0x1e')](_0x4114b0[_0xf578('0x19')][_0xf578('0x1d')],function(_0x5648d6){return{'model':db[_0x5648d6[_0xf578('0x1f')]],'as':_0x5648d6['as'],'attributes':_0x5648d6[_0xf578('0x1c')],'include':_0x5648d6[_0xf578('0x1d')]?_['map'](_0x5648d6[_0xf578('0x1d')],function(_0x5d11d2){return{'model':db[_0x5d11d2[_0xf578('0x1f')]],'as':_0x5d11d2['as'],'attributes':_0x5d11d2[_0xf578('0x1c')],'include':_0x5d11d2[_0xf578('0x1d')]?_['map'](_0x5d11d2[_0xf578('0x1d')],function(_0x4cf9a4){return{'model':db[_0x4cf9a4[_0xf578('0x1f')]],'as':_0x4cf9a4['as'],'attributes':_0x4cf9a4[_0xf578('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf578('0xc')](function(_0x253aee){logger[_0xf578('0xd')](_0xf578('0x16'),_0x4114b0);logger[_0xf578('0x20')](_0xf578('0x16'),_0x4114b0,JSON['stringify'](_0x253aee));_0x14cc25(_0x253aee);})[_0xf578('0x15')](function(_0x5235de){logger['error']('ShowWhatsappAccount',_0x5235de[_0xf578('0x13')],_0x4114b0);_0x101de9(_0x41d712[_0xf578('0x11')](0x1f4,_0x5235de['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d4dc870..1e6ebf3 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 _0x3efb=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','register'];(function(_0xee42a8,_0x57a899){var _0x48403b=function(_0x45b9eb){while(--_0x45b9eb){_0xee42a8['push'](_0xee42a8['shift']());}};_0x48403b(++_0x57a899);}(_0x3efb,0x11b));var _0xb3ef=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x3efb[_0x37d3f3];return _0x185c9c;};'use strict';var WhatsappAccountEvents=require(_0xb3ef('0x0'));var events=['save',_0xb3ef('0x1'),_0xb3ef('0x2')];function createListener(_0x45161a,_0x2f3bef){return function(_0x104411){_0x2f3bef[_0xb3ef('0x3')](_0x45161a,_0x104411);};}function removeListener(_0x4ba67a,_0x1f6f84){return function(){WhatsappAccountEvents['removeListener'](_0x4ba67a,_0x1f6f84);};}exports[_0xb3ef('0x4')]=function(_0x3400a5){for(var _0x29c178=0x0,_0x3f95b9=events['length'];_0x29c178<_0x3f95b9;_0x29c178++){var _0x424cc8=events[_0x29c178];var _0x993078=createListener(_0xb3ef('0x5')+_0x424cc8,_0x3400a5);WhatsappAccountEvents['on'](_0x424cc8,_0x993078);}}; \ No newline at end of file +var _0x9912=['removeListener','register','length','whatsappAccount:','save','remove','emit'];(function(_0x35ec5c,_0x4aed71){var _0x321542=function(_0x36e2b2){while(--_0x36e2b2){_0x35ec5c['push'](_0x35ec5c['shift']());}};_0x321542(++_0x4aed71);}(_0x9912,0x193));var _0x2991=function(_0x179879,_0x30d95f){_0x179879=_0x179879-0x0;var _0x2bf692=_0x9912[_0x179879];return _0x2bf692;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x2991('0x0'),_0x2991('0x1'),'update'];function createListener(_0x4207f3,_0x3b4dc1){return function(_0x137874){_0x3b4dc1[_0x2991('0x2')](_0x4207f3,_0x137874);};}function removeListener(_0x186cbc,_0x49e80c){return function(){WhatsappAccountEvents[_0x2991('0x3')](_0x186cbc,_0x49e80c);};}exports[_0x2991('0x4')]=function(_0x19fde3){for(var _0x3fd57c=0x0,_0x37d9da=events[_0x2991('0x5')];_0x3fd57c<_0x37d9da;_0x3fd57c++){var _0x30a123=events[_0x3fd57c];var _0x481508=createListener(_0x2991('0x6')+_0x30a123,_0x19fde3);WhatsappAccountEvents['on'](_0x30a123,_0x481508);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1d1dda7..9754602 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 _0xfe65=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x414f40,_0x3d9eb8){var _0x3dc477=function(_0x541c96){while(--_0x541c96){_0x414f40['push'](_0x414f40['shift']());}};_0x3dc477(++_0x3d9eb8);}(_0xfe65,0x127));var _0x5fe6=function(_0x20b633,_0x277b4f){_0x20b633=_0x20b633-0x0;var _0x13c86d=_0xfe65[_0x20b633];return _0x13c86d;};'use strict';var multer=require(_0x5fe6('0x0'));var util=require('util');var path=require(_0x5fe6('0x1'));var timeout=require(_0x5fe6('0x2'));var express=require(_0x5fe6('0x3'));var router=express[_0x5fe6('0x4')]();var fs_extra=require(_0x5fe6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5fe6('0x6'));var config=require(_0x5fe6('0x7'));var controller=require(_0x5fe6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5fe6('0x9')]);router[_0x5fe6('0xa')](_0x5fe6('0xb'),auth[_0x5fe6('0xc')](),controller[_0x5fe6('0xd')]);router[_0x5fe6('0xe')]('/',auth[_0x5fe6('0xc')](),controller[_0x5fe6('0xf')]);router[_0x5fe6('0x10')](_0x5fe6('0xb'),auth['isAuthenticated'](),controller[_0x5fe6('0x11')]);router['delete'](_0x5fe6('0xb'),auth['isAuthenticated'](),controller[_0x5fe6('0x12')]);module[_0x5fe6('0x13')]=router; \ No newline at end of file +var _0xd4a3=['isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0xb9c057,_0xd4898c){var _0x26eb03=function(_0x5efb0e){while(--_0x5efb0e){_0xb9c057['push'](_0xb9c057['shift']());}};_0x26eb03(++_0xd4898c);}(_0xd4a3,0x172));var _0x3d4a=function(_0x10fb3c,_0x2157d8){_0x10fb3c=_0x10fb3c-0x0;var _0x2d98d6=_0xd4a3[_0x10fb3c];return _0x2d98d6;};'use strict';var multer=require(_0x3d4a('0x0'));var util=require(_0x3d4a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3d4a('0x2'));var router=express[_0x3d4a('0x3')]();var fs_extra=require(_0x3d4a('0x4'));var auth=require(_0x3d4a('0x5'));var interaction=require(_0x3d4a('0x6'));var config=require(_0x3d4a('0x7'));var controller=require(_0x3d4a('0x8'));router[_0x3d4a('0x9')]('/',auth[_0x3d4a('0xa')](),controller[_0x3d4a('0xb')]);router[_0x3d4a('0x9')](_0x3d4a('0xc'),auth[_0x3d4a('0xa')](),controller[_0x3d4a('0xd')]);router[_0x3d4a('0xe')]('/',auth['isAuthenticated'](),controller[_0x3d4a('0xf')]);router[_0x3d4a('0x10')](_0x3d4a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3d4a('0x11')](_0x3d4a('0xc'),auth[_0x3d4a('0xa')](),controller['destroy']);module[_0x3d4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 5ec8f52..37b1333 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 _0x23aa=['noop','TEXT','sequelize','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x23aa,0x192));var _0xa23a=function(_0x6bc360,_0x2334be){_0x6bc360=_0x6bc360-0x0;var _0x2b54e8=_0x23aa[_0x6bc360];return _0x2b54e8;};'use strict';var Sequelize=require(_0xa23a('0x0'));module[_0xa23a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa23a('0x2')],'allowNull':![],'defaultValue':_0xa23a('0x3')},'appdata':{'type':Sequelize[_0xa23a('0x4')]()},'description':{'type':Sequelize[_0xa23a('0x2')]},'interval':{'type':Sequelize[_0xa23a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x785c=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0x785c,0xdf));var _0xc785=function(_0x27aa03,_0x314135){_0x27aa03=_0x27aa03-0x0;var _0x4acc69=_0x785c[_0x27aa03];return _0x4acc69;};'use strict';var Sequelize=require(_0xc785('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc785('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc785('0x2')],'allowNull':![],'defaultValue':_0xc785('0x3')},'appdata':{'type':Sequelize[_0xc785('0x4')]()},'description':{'type':Sequelize[_0xc785('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc785('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a87c7e9..fd00537 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 _0xa498=['fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x542102,_0x614b29){var _0x3c62a4=function(_0x3de2a9){while(--_0x3de2a9){_0x542102['push'](_0x542102['shift']());}};_0x3c62a4(++_0x614b29);}(_0xa498,0x1d6));var _0x8a49=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0xa498[_0x463376];return _0x336ccd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a49('0x0'));var zipdir=require(_0x8a49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8a49('0x2'));var BPromise=require(_0x8a49('0x3'));var Mustache=require(_0x8a49('0x4'));var util=require(_0x8a49('0x5'));var path=require(_0x8a49('0x6'));var sox=require('sox');var csv=require(_0x8a49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a49('0x8'));var _=require(_0x8a49('0x9'));var squel=require(_0x8a49('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a49('0xb'));var deskjs=require(_0x8a49('0xc'));var toCsv=require(_0x8a49('0x7'));var querystring=require(_0x8a49('0xd'));var Papa=require(_0x8a49('0xe'));var Redis=require(_0x8a49('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8a49('0x10'));var as=require(_0x8a49('0x11'));var hardwareService=require(_0x8a49('0x12'));var logger=require(_0x8a49('0x13'))(_0x8a49('0x14'));var utils=require(_0x8a49('0x15'));var config=require(_0x8a49('0x16'));var licenseUtil=require(_0x8a49('0x17'));var db=require(_0x8a49('0x18'))['db'];function respondWithStatusCode(_0x5b8111,_0x352528){_0x352528=_0x352528||0xcc;return function(_0x6ee27b){if(_0x6ee27b){return _0x5b8111[_0x8a49('0x19')](_0x352528);}return _0x5b8111['status'](_0x352528)[_0x8a49('0x1a')]();};}function respondWithResult(_0x57b350,_0x4454de){_0x4454de=_0x4454de||0xc8;return function(_0x2fe212){if(_0x2fe212){return _0x57b350['status'](_0x4454de)[_0x8a49('0x1b')](_0x2fe212);}};}function respondWithFilteredResult(_0x902ee2,_0x329a7b){return function(_0x4760d7){if(_0x4760d7){var _0x5275aa=typeof _0x329a7b['offset']===_0x8a49('0x1c')&&typeof _0x329a7b[_0x8a49('0x1d')]===_0x8a49('0x1c');var _0x2d0261=_0x4760d7['count'];var _0x47604e=_0x5275aa?0x0:_0x329a7b[_0x8a49('0x1e')];var _0x47328a=_0x5275aa?_0x4760d7[_0x8a49('0x1f')]:_0x329a7b[_0x8a49('0x1e')]+_0x329a7b['limit'];var _0x5ac3ca;if(_0x47328a>=_0x2d0261){_0x47328a=_0x2d0261;_0x5ac3ca=0xc8;}else{_0x5ac3ca=0xce;}_0x902ee2[_0x8a49('0x20')](_0x5ac3ca);return _0x902ee2[_0x8a49('0x21')](_0x8a49('0x22'),_0x47604e+'-'+_0x47328a+'/'+_0x2d0261)['json'](_0x4760d7);}return null;};}function patchUpdates(_0x2baa30){return function(_0x2e45fc){try{jsonpatch[_0x8a49('0x23')](_0x2e45fc,_0x2baa30,!![]);}catch(_0x21f407){return BPromise[_0x8a49('0x24')](_0x21f407);}return _0x2e45fc[_0x8a49('0x25')]();};}function saveUpdates(_0x16072f,_0x4bc3bc){return function(_0x304372){if(_0x304372){return _0x304372[_0x8a49('0x26')](_0x16072f)['then'](function(_0x3b6220){return _0x3b6220;});}return null;};}function removeEntity(_0x479bca,_0x41bee7){return function(_0x52811c){if(_0x52811c){return _0x52811c[_0x8a49('0x27')]()[_0x8a49('0x28')](function(){_0x479bca[_0x8a49('0x20')](0xcc)[_0x8a49('0x1a')]();});}};}function handleEntityNotFound(_0xe2ca8b,_0x2b5d8b){return function(_0x1b0a01){if(!_0x1b0a01){_0xe2ca8b['sendStatus'](0x194);}return _0x1b0a01;};}function handleError(_0x2fc60e,_0x4d72a3){_0x4d72a3=_0x4d72a3||0x1f4;return function(_0x29af9f){logger['error'](_0x29af9f[_0x8a49('0x29')]);if(_0x29af9f[_0x8a49('0x2a')]){delete _0x29af9f['name'];}_0x2fc60e['status'](_0x4d72a3)[_0x8a49('0x2b')](_0x29af9f);};}exports[_0x8a49('0x2c')]=function(_0x387b06,_0x30fffd){var _0x484a57={},_0x29de89={},_0xef6542={'count':0x0,'rows':[]};var _0x33d7c6=_[_0x8a49('0x2d')](db[_0x8a49('0x2e')]['rawAttributes'],function(_0x223ed9){return{'name':_0x223ed9[_0x8a49('0x2f')],'type':_0x223ed9[_0x8a49('0x30')][_0x8a49('0x31')]};});_0x29de89[_0x8a49('0x32')]=_[_0x8a49('0x2d')](_0x33d7c6,_0x8a49('0x2a'));_0x29de89['query']=_['keys'](_0x387b06[_0x8a49('0x33')]);_0x29de89[_0x8a49('0x34')]=_[_0x8a49('0x35')](_0x29de89[_0x8a49('0x32')],_0x29de89['query']);_0x484a57[_0x8a49('0x36')]=_[_0x8a49('0x35')](_0x29de89['model'],qs[_0x8a49('0x37')](_0x387b06['query'][_0x8a49('0x37')]));_0x484a57[_0x8a49('0x36')]=_0x484a57[_0x8a49('0x36')][_0x8a49('0x38')]?_0x484a57['attributes']:_0x29de89[_0x8a49('0x32')];if(!_0x387b06[_0x8a49('0x33')][_0x8a49('0x39')]('nolimit')){_0x484a57[_0x8a49('0x1d')]=qs['limit'](_0x387b06['query'][_0x8a49('0x1d')]);_0x484a57[_0x8a49('0x1e')]=qs[_0x8a49('0x1e')](_0x387b06[_0x8a49('0x33')]['offset']);}_0x484a57['order']=qs[_0x8a49('0x3a')](_0x387b06[_0x8a49('0x33')][_0x8a49('0x3a')]);_0x484a57[_0x8a49('0x3b')]=qs['filters'](_[_0x8a49('0x3c')](_0x387b06[_0x8a49('0x33')],_0x29de89[_0x8a49('0x34')]),_0x33d7c6);if(_0x387b06['query']['filter']){_0x484a57[_0x8a49('0x3b')]=_[_0x8a49('0x3d')](_0x484a57[_0x8a49('0x3b')],{'$or':_['map'](_0x33d7c6,function(_0x158d8c){if(_0x158d8c[_0x8a49('0x30')]!==_0x8a49('0x3e')){var _0x7b71bb={};_0x7b71bb[_0x158d8c[_0x8a49('0x2a')]]={'$like':'%'+_0x387b06[_0x8a49('0x33')]['filter']+'%'};return _0x7b71bb;}})});}_0x484a57=_[_0x8a49('0x3d')]({},_0x484a57,_0x387b06[_0x8a49('0x3f')]);var _0x309482={'where':_0x484a57[_0x8a49('0x3b')]};return db[_0x8a49('0x2e')][_0x8a49('0x1f')](_0x309482)['then'](function(_0x2c9838){_0xef6542[_0x8a49('0x1f')]=_0x2c9838;if(_0x387b06[_0x8a49('0x33')][_0x8a49('0x40')]){_0x484a57[_0x8a49('0x41')]=[{'all':!![]}];}return db[_0x8a49('0x2e')][_0x8a49('0x42')](_0x484a57);})[_0x8a49('0x28')](function(_0x41b6c2){_0xef6542[_0x8a49('0x43')]=_0x41b6c2;return _0xef6542;})[_0x8a49('0x28')](respondWithFilteredResult(_0x30fffd,_0x484a57))['catch'](handleError(_0x30fffd,null));};exports[_0x8a49('0x44')]=function(_0x1b4b6d,_0x2938a8){var _0x4aac2b={'raw':!![],'where':{'id':_0x1b4b6d[_0x8a49('0x45')]['id']}},_0x411c9d={};_0x411c9d[_0x8a49('0x32')]=_[_0x8a49('0x46')](db[_0x8a49('0x2e')]['rawAttributes']);_0x411c9d[_0x8a49('0x33')]=_[_0x8a49('0x46')](_0x1b4b6d['query']);_0x411c9d[_0x8a49('0x34')]=_['intersection'](_0x411c9d['model'],_0x411c9d[_0x8a49('0x33')]);_0x4aac2b['attributes']=_[_0x8a49('0x35')](_0x411c9d[_0x8a49('0x32')],qs[_0x8a49('0x37')](_0x1b4b6d[_0x8a49('0x33')]['fields']));_0x4aac2b[_0x8a49('0x36')]=_0x4aac2b[_0x8a49('0x36')][_0x8a49('0x38')]?_0x4aac2b[_0x8a49('0x36')]:_0x411c9d[_0x8a49('0x32')];if(_0x1b4b6d[_0x8a49('0x33')][_0x8a49('0x40')]){_0x4aac2b['include']=[{'all':!![]}];}_0x4aac2b=_['merge']({},_0x4aac2b,_0x1b4b6d[_0x8a49('0x3f')]);return db[_0x8a49('0x2e')][_0x8a49('0x47')](_0x4aac2b)[_0x8a49('0x28')](handleEntityNotFound(_0x2938a8,null))[_0x8a49('0x28')](respondWithResult(_0x2938a8,null))[_0x8a49('0x48')](handleError(_0x2938a8,null));};exports[_0x8a49('0x49')]=function(_0x33ec7a,_0x5a428a){return db[_0x8a49('0x2e')][_0x8a49('0x49')](_0x33ec7a[_0x8a49('0x4a')],{})[_0x8a49('0x28')](respondWithResult(_0x5a428a,0xc9))[_0x8a49('0x48')](handleError(_0x5a428a,null));};exports[_0x8a49('0x26')]=function(_0x3d8fcc,_0xe3e213){if(_0x3d8fcc[_0x8a49('0x4a')]['id']){delete _0x3d8fcc[_0x8a49('0x4a')]['id'];}return db[_0x8a49('0x2e')]['find']({'where':{'id':_0x3d8fcc['params']['id']}})[_0x8a49('0x28')](handleEntityNotFound(_0xe3e213,null))[_0x8a49('0x28')](saveUpdates(_0x3d8fcc[_0x8a49('0x4a')],null))[_0x8a49('0x28')](respondWithResult(_0xe3e213,null))[_0x8a49('0x48')](handleError(_0xe3e213,null));};exports[_0x8a49('0x27')]=function(_0x3e066e,_0x4d9306){return db['WhatsappApplication']['find']({'where':{'id':_0x3e066e[_0x8a49('0x45')]['id']}})[_0x8a49('0x28')](handleEntityNotFound(_0x4d9306,null))[_0x8a49('0x28')](removeEntity(_0x4d9306,null))['catch'](handleError(_0x4d9306,null));}; \ No newline at end of file +var _0xc1d3=['rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll'];(function(_0x43665e,_0x1cdd0d){var _0x3598a4=function(_0x1d96cb){while(--_0x1d96cb){_0x43665e['push'](_0x43665e['shift']());}};_0x3598a4(++_0x1cdd0d);}(_0xc1d3,0x147));var _0x3c1d=function(_0x1a7d59,_0x3dbe18){_0x1a7d59=_0x1a7d59-0x0;var _0x3ea517=_0xc1d3[_0x1a7d59];return _0x3ea517;};'use strict';var emlformat=require(_0x3c1d('0x0'));var rimraf=require(_0x3c1d('0x1'));var zipdir=require(_0x3c1d('0x2'));var jsonpatch=require(_0x3c1d('0x3'));var rp=require(_0x3c1d('0x4'));var moment=require(_0x3c1d('0x5'));var BPromise=require(_0x3c1d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c1d('0x7'));var sox=require(_0x3c1d('0x8'));var csv=require(_0x3c1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c1d('0xa'));var _=require(_0x3c1d('0xb'));var squel=require(_0x3c1d('0xc'));var crypto=require(_0x3c1d('0xd'));var jsforce=require(_0x3c1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3c1d('0x9'));var querystring=require(_0x3c1d('0xf'));var Papa=require(_0x3c1d('0x10'));var Redis=require(_0x3c1d('0x11'));var authService=require(_0x3c1d('0x12'));var qs=require(_0x3c1d('0x13'));var as=require(_0x3c1d('0x14'));var hardwareService=require(_0x3c1d('0x15'));var logger=require('../../config/logger')(_0x3c1d('0x16'));var utils=require(_0x3c1d('0x17'));var config=require(_0x3c1d('0x18'));var licenseUtil=require(_0x3c1d('0x19'));var db=require(_0x3c1d('0x1a'))['db'];function respondWithStatusCode(_0x5a2402,_0xf3cd6d){_0xf3cd6d=_0xf3cd6d||0xcc;return function(_0x209b55){if(_0x209b55){return _0x5a2402['sendStatus'](_0xf3cd6d);}return _0x5a2402[_0x3c1d('0x1b')](_0xf3cd6d)['end']();};}function respondWithResult(_0x4ed530,_0x4b941d){_0x4b941d=_0x4b941d||0xc8;return function(_0x2875a9){if(_0x2875a9){return _0x4ed530[_0x3c1d('0x1b')](_0x4b941d)[_0x3c1d('0x1c')](_0x2875a9);}};}function respondWithFilteredResult(_0x434dbc,_0x2ed7af){return function(_0x2c0b83){if(_0x2c0b83){var _0x4e6157=typeof _0x2ed7af['offset']===_0x3c1d('0x1d')&&typeof _0x2ed7af['limit']===_0x3c1d('0x1d');var _0x295467=_0x2c0b83['count'];var _0x4a7e42=_0x4e6157?0x0:_0x2ed7af['offset'];var _0x33637d=_0x4e6157?_0x2c0b83[_0x3c1d('0x1e')]:_0x2ed7af[_0x3c1d('0x1f')]+_0x2ed7af[_0x3c1d('0x20')];var _0x9dce85;if(_0x33637d>=_0x295467){_0x33637d=_0x295467;_0x9dce85=0xc8;}else{_0x9dce85=0xce;}_0x434dbc['status'](_0x9dce85);return _0x434dbc['set'](_0x3c1d('0x21'),_0x4a7e42+'-'+_0x33637d+'/'+_0x295467)[_0x3c1d('0x1c')](_0x2c0b83);}return null;};}function patchUpdates(_0x3c7455){return function(_0x233dff){try{jsonpatch[_0x3c1d('0x22')](_0x233dff,_0x3c7455,!![]);}catch(_0x5b2720){return BPromise[_0x3c1d('0x23')](_0x5b2720);}return _0x233dff[_0x3c1d('0x24')]();};}function saveUpdates(_0xa5fd81,_0x5211d7){return function(_0x129497){if(_0x129497){return _0x129497[_0x3c1d('0x25')](_0xa5fd81)[_0x3c1d('0x26')](function(_0x210e9c){return _0x210e9c;});}return null;};}function removeEntity(_0x2e1af4,_0x1a853d){return function(_0x41a683){if(_0x41a683){return _0x41a683[_0x3c1d('0x27')]()[_0x3c1d('0x26')](function(){_0x2e1af4['status'](0xcc)[_0x3c1d('0x28')]();});}};}function handleEntityNotFound(_0x2a8854,_0x2078d5){return function(_0x4f7cd8){if(!_0x4f7cd8){_0x2a8854[_0x3c1d('0x29')](0x194);}return _0x4f7cd8;};}function handleError(_0x3bde45,_0x4e1f79){_0x4e1f79=_0x4e1f79||0x1f4;return function(_0x392bb1){logger[_0x3c1d('0x2a')](_0x392bb1[_0x3c1d('0x2b')]);if(_0x392bb1['name']){delete _0x392bb1[_0x3c1d('0x2c')];}_0x3bde45['status'](_0x4e1f79)[_0x3c1d('0x2d')](_0x392bb1);};}exports[_0x3c1d('0x2e')]=function(_0x59db0a,_0x4ff12a){var _0x356f61={},_0x2f7af9={},_0x93a3b1={'count':0x0,'rows':[]};var _0x52ab2b=_[_0x3c1d('0x2f')](db['WhatsappApplication'][_0x3c1d('0x30')],function(_0x438b09){return{'name':_0x438b09[_0x3c1d('0x31')],'type':_0x438b09['type'][_0x3c1d('0x32')]};});_0x2f7af9[_0x3c1d('0x33')]=_[_0x3c1d('0x2f')](_0x52ab2b,_0x3c1d('0x2c'));_0x2f7af9[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x59db0a[_0x3c1d('0x34')]);_0x2f7af9[_0x3c1d('0x36')]=_[_0x3c1d('0x37')](_0x2f7af9['model'],_0x2f7af9['query']);_0x356f61[_0x3c1d('0x38')]=_['intersection'](_0x2f7af9[_0x3c1d('0x33')],qs[_0x3c1d('0x39')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x356f61[_0x3c1d('0x38')]=_0x356f61['attributes'][_0x3c1d('0x3a')]?_0x356f61[_0x3c1d('0x38')]:_0x2f7af9['model'];if(!_0x59db0a['query'][_0x3c1d('0x3b')](_0x3c1d('0x3c'))){_0x356f61[_0x3c1d('0x20')]=qs[_0x3c1d('0x20')](_0x59db0a[_0x3c1d('0x34')]['limit']);_0x356f61[_0x3c1d('0x1f')]=qs[_0x3c1d('0x1f')](_0x59db0a['query']['offset']);}_0x356f61['order']=qs[_0x3c1d('0x3d')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x3d')]);_0x356f61[_0x3c1d('0x3e')]=qs['filters'](_[_0x3c1d('0x3f')](_0x59db0a['query'],_0x2f7af9[_0x3c1d('0x36')]),_0x52ab2b);if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x40')]){_0x356f61[_0x3c1d('0x3e')]=_[_0x3c1d('0x41')](_0x356f61['where'],{'$or':_[_0x3c1d('0x2f')](_0x52ab2b,function(_0x28c575){if(_0x28c575[_0x3c1d('0x42')]!==_0x3c1d('0x43')){var _0x59c8fb={};_0x59c8fb[_0x28c575[_0x3c1d('0x2c')]]={'$like':'%'+_0x59db0a['query']['filter']+'%'};return _0x59c8fb;}})});}_0x356f61=_[_0x3c1d('0x41')]({},_0x356f61,_0x59db0a[_0x3c1d('0x44')]);var _0x58c490={'where':_0x356f61['where']};return db[_0x3c1d('0x45')][_0x3c1d('0x1e')](_0x58c490)['then'](function(_0x4f07d6){_0x93a3b1[_0x3c1d('0x1e')]=_0x4f07d6;if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x46')]){_0x356f61[_0x3c1d('0x47')]=[{'all':!![]}];}return db[_0x3c1d('0x45')][_0x3c1d('0x48')](_0x356f61);})[_0x3c1d('0x26')](function(_0x11bca2){_0x93a3b1[_0x3c1d('0x49')]=_0x11bca2;return _0x93a3b1;})[_0x3c1d('0x26')](respondWithFilteredResult(_0x4ff12a,_0x356f61))[_0x3c1d('0x4a')](handleError(_0x4ff12a,null));};exports[_0x3c1d('0x4b')]=function(_0x4b0f40,_0x21dbef){var _0x5ca02c={'raw':!![],'where':{'id':_0x4b0f40['params']['id']}},_0x415a61={};_0x415a61[_0x3c1d('0x33')]=_['keys'](db[_0x3c1d('0x45')][_0x3c1d('0x30')]);_0x415a61[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x4b0f40['query']);_0x415a61[_0x3c1d('0x36')]=_['intersection'](_0x415a61[_0x3c1d('0x33')],_0x415a61[_0x3c1d('0x34')]);_0x5ca02c[_0x3c1d('0x38')]=_[_0x3c1d('0x37')](_0x415a61['model'],qs[_0x3c1d('0x39')](_0x4b0f40[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x5ca02c[_0x3c1d('0x38')]=_0x5ca02c[_0x3c1d('0x38')]['length']?_0x5ca02c[_0x3c1d('0x38')]:_0x415a61[_0x3c1d('0x33')];if(_0x4b0f40[_0x3c1d('0x34')]['includeAll']){_0x5ca02c['include']=[{'all':!![]}];}_0x5ca02c=_[_0x3c1d('0x41')]({},_0x5ca02c,_0x4b0f40[_0x3c1d('0x44')]);return db[_0x3c1d('0x45')][_0x3c1d('0x4c')](_0x5ca02c)[_0x3c1d('0x26')](handleEntityNotFound(_0x21dbef,null))[_0x3c1d('0x26')](respondWithResult(_0x21dbef,null))['catch'](handleError(_0x21dbef,null));};exports[_0x3c1d('0x4d')]=function(_0x4c533e,_0x34ad3a){return db[_0x3c1d('0x45')][_0x3c1d('0x4d')](_0x4c533e[_0x3c1d('0x4e')],{})[_0x3c1d('0x26')](respondWithResult(_0x34ad3a,0xc9))[_0x3c1d('0x4a')](handleError(_0x34ad3a,null));};exports[_0x3c1d('0x25')]=function(_0x4f0b44,_0x576552){if(_0x4f0b44['body']['id']){delete _0x4f0b44[_0x3c1d('0x4e')]['id'];}return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4f0b44[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x576552,null))[_0x3c1d('0x26')](saveUpdates(_0x4f0b44['body'],null))[_0x3c1d('0x26')](respondWithResult(_0x576552,null))[_0x3c1d('0x4a')](handleError(_0x576552,null));};exports['destroy']=function(_0x4bc4ac,_0x4302f3){return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4bc4ac[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x4302f3,null))[_0x3c1d('0x26')](removeEntity(_0x4302f3,null))[_0x3c1d('0x4a')](handleError(_0x4302f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3d8fb53..9736641 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 _0xb647=['request-promise','path','../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38e529,_0x2ea5d1){var _0x2d1616=function(_0x2d3615){while(--_0x2d3615){_0x38e529['push'](_0x38e529['shift']());}};_0x2d1616(++_0x2ea5d1);}(_0xb647,0xdb));var _0x7b64=function(_0x56fb3e,_0x2d4bcd){_0x56fb3e=_0x56fb3e-0x0;var _0x4e0cd7=_0xb647[_0x56fb3e];return _0x4e0cd7;};'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('./whatsappApplication.attributes');module[_0x7b64('0x9')]=function(_0x38ebf7,_0x31915b){return _0x38ebf7[_0x7b64('0xa')](_0x7b64('0xb'),attributes,{'tableName':_0x7b64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b64('0xd'),'collate':_0x7b64('0xe')});}; \ No newline at end of file +var _0x27c5=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci','../../config/logger'];(function(_0xdd6af3,_0x42c4ca){var _0x5a425c=function(_0x10ce4b){while(--_0x10ce4b){_0xdd6af3['push'](_0xdd6af3['shift']());}};_0x5a425c(++_0x42c4ca);}(_0x27c5,0x173));var _0x527c=function(_0x28a59c,_0x37bd9f){_0x28a59c=_0x28a59c-0x0;var _0x14cbba=_0x27c5[_0x28a59c];return _0x14cbba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x527c('0x0'))(_0x527c('0x1'));var moment=require(_0x527c('0x2'));var BPromise=require('bluebird');var rp=require(_0x527c('0x3'));var fs=require('fs');var path=require(_0x527c('0x4'));var rimraf=require(_0x527c('0x5'));var config=require(_0x527c('0x6'));var attributes=require(_0x527c('0x7'));module[_0x527c('0x8')]=function(_0x37bd95,_0x552d9b){return _0x37bd95[_0x527c('0x9')]('WhatsappApplication',attributes,{'tableName':_0x527c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x527c('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d9259ea..1b07838 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 _0x8d0e=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x3cedfc,_0x2b4726){var _0x3121a3=function(_0x49a3e2){while(--_0x49a3e2){_0x3cedfc['push'](_0x3cedfc['shift']());}};_0x3121a3(++_0x2b4726);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1f97f5,_0x229416){_0x1f97f5=_0x1f97f5-0x0;var _0x474e46=_0x8d0e[_0x1f97f5];return _0x474e46;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x11fcca,_0x30a644){var _0x167a23=function(_0x49ec7f){while(--_0x49ec7f){_0x11fcca['push'](_0x11fcca['shift']());}};_0x167a23(++_0x30a644);}(_0x54ef,0x112));var _0xf54e=function(_0x468c3f,_0x1014bd){_0x468c3f=_0x468c3f-0x0;var _0x4e0e57=_0x54ef[_0x468c3f];return _0x4e0e57;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 896ce8a..802e7c5 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 _0x0e4b=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','express','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x41719e,_0xde2961){var _0x46e136=function(_0x294017){while(--_0x294017){_0x41719e['push'](_0x41719e['shift']());}};_0x46e136(++_0xde2961);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x138b5c,_0x28acb1){_0x138b5c=_0x138b5c-0x0;var _0x441f98=_0x0e4b[_0x138b5c];return _0x441f98;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e4('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(_0xb0e4('0x4'));var controller=require(_0xb0e4('0x5'));router['get']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x7')]);router[_0xb0e4('0x8')](_0xb0e4('0x9'),auth[_0xb0e4('0x6')](),controller['describe']);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xb')]);router[_0xb0e4('0x8')](_0xb0e4('0xc'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xd')]);router[_0xb0e4('0x8')](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xf')]);router[_0xb0e4('0x10')]('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x11')]);router[_0xb0e4('0x10')]('/:id/messages',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x12')]);router['post'](_0xb0e4('0x13'),auth[_0xb0e4('0x6')](),interaction[_0xb0e4('0x14')](_0xb0e4('0x15'),_0xb0e4('0x16')),controller['addTags']);router['put'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),interaction['tracked'](_0xb0e4('0x15'),_0xb0e4('0x17')),controller[_0xb0e4('0x18')]);router[_0xb0e4('0x19')](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller[_0xb0e4('0x1a')]);router[_0xb0e4('0x19')](_0xb0e4('0x13'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x1b')]);module[_0xb0e4('0x1c')]=router; \ No newline at end of file +var _0xcb66=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','create','post','addMessage','tracked','whatsappinteraction:addtags','addTags','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','util','path','connect-timeout','express','Router'];(function(_0x1f20b8,_0x5e1a95){var _0x521bfb=function(_0x2be15b){while(--_0x2be15b){_0x1f20b8['push'](_0x1f20b8['shift']());}};_0x521bfb(++_0x5e1a95);}(_0xcb66,0x19f));var _0x6cb6=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xcb66[_0x32b542];return _0x554d54;};'use strict';var multer=require('multer');var util=require(_0x6cb6('0x0'));var path=require(_0x6cb6('0x1'));var timeout=require(_0x6cb6('0x2'));var express=require(_0x6cb6('0x3'));var router=express[_0x6cb6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb6('0x5'));var interaction=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var controller=require(_0x6cb6('0x8'));router[_0x6cb6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cb6('0x9')](_0x6cb6('0xa'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0x9')](_0x6cb6('0xd'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xe')]);router[_0x6cb6('0x9')](_0x6cb6('0xf'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x10')]);router[_0x6cb6('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x11')]);router[_0x6cb6('0x12')](_0x6cb6('0xf'),auth['isAuthenticated'](),controller[_0x6cb6('0x13')]);router[_0x6cb6('0x12')]('/:id/tags',auth[_0x6cb6('0xb')](),interaction[_0x6cb6('0x14')]('whatsapp',_0x6cb6('0x15')),controller[_0x6cb6('0x16')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6cb6('0x17'),_0x6cb6('0x18')),controller[_0x6cb6('0x19')]);router[_0x6cb6('0x1a')](_0x6cb6('0xd'),auth[_0x6cb6('0xb')](),interaction['tracked'](_0x6cb6('0x17'),_0x6cb6('0x1b')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);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 ad2d967..10971a2 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 _0xdbd0=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0xdbd0,0x88));var _0x0dbd=function(_0x13a1cd,_0x3e2c00){_0x13a1cd=_0x13a1cd-0x0;var _0x2eb72d=_0xdbd0[_0x13a1cd];return _0x2eb72d;};'use strict';var Sequelize=require(_0x0dbd('0x0'));var moment=require(_0x0dbd('0x1'));module[_0x0dbd('0x2')]={'closed':{'type':Sequelize[_0x0dbd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0dbd('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0dbd('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0dbd('0x5')]},'note':{'type':Sequelize[_0x0dbd('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0dbd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0dbd('0x6')]('in',_0x0dbd('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0dbd('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0dbd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6688=['DATE','STRING','out','BOOLEAN','sequelize','moment','exports'];(function(_0x52ba0b,_0x4c8819){var _0x4f24cb=function(_0x2d18dd){while(--_0x2d18dd){_0x52ba0b['push'](_0x52ba0b['shift']());}};_0x4f24cb(++_0x4c8819);}(_0x6688,0x10e));var _0x8668=function(_0x8daaa9,_0xdae801){_0x8daaa9=_0x8daaa9-0x0;var _0x508be8=_0x6688[_0x8daaa9];return _0x508be8;};'use strict';var Sequelize=require(_0x8668('0x0'));var moment=require(_0x8668('0x1'));module[_0x8668('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8668('0x3')]},'disposition':{'type':Sequelize[_0x8668('0x4')]},'secondDisposition':{'type':Sequelize[_0x8668('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8668('0x4')]},'note':{'type':Sequelize[_0x8668('0x4')]},'phone':{'type':Sequelize[_0x8668('0x4')]},'read1stAt':{'type':Sequelize[_0x8668('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8668('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8668('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8668('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8668('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e185151..8012cfb 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 _0x5d4e=['i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','all','rows','show','params','includeAll','create','destroy','describe','addMessage','WhatsappMessage','ids','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','omit','findAll','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','Attachment','existsSync','createReadStream','createWriteStream','basename','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','stack','name','send','Users','TagIds','Tags','split','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','whatsapp_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0xbf615d,_0x22bf6c){var _0x2c6a95=function(_0x3fa817){while(--_0x3fa817){_0xbf615d['push'](_0xbf615d['shift']());}};_0x2c6a95(++_0x22bf6c);}(_0x5d4e,0x138));var _0xe5d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5d4e[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5d4('0x0'));var zipdir=require(_0xe5d4('0x1'));var jsonpatch=require(_0xe5d4('0x2'));var rp=require(_0xe5d4('0x3'));var moment=require(_0xe5d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5d4('0x5'));var util=require(_0xe5d4('0x6'));var path=require(_0xe5d4('0x7'));var sox=require('sox');var csv=require(_0xe5d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe5d4('0x9'));var crypto=require(_0xe5d4('0xa'));var jsforce=require(_0xe5d4('0xb'));var deskjs=require(_0xe5d4('0xc'));var toCsv=require(_0xe5d4('0x8'));var querystring=require(_0xe5d4('0xd'));var Papa=require(_0xe5d4('0xe'));var Redis=require(_0xe5d4('0xf'));var authService=require(_0xe5d4('0x10'));var qs=require(_0xe5d4('0x11'));var as=require(_0xe5d4('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5d4('0x13'))(_0xe5d4('0x14'));var utils=require(_0xe5d4('0x15'));var config=require(_0xe5d4('0x16'));var licenseUtil=require(_0xe5d4('0x17'));var db=require(_0xe5d4('0x18'))['db'];config[_0xe5d4('0x19')]=_[_0xe5d4('0x1a')](config[_0xe5d4('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5d4('0x19')]));require(_0xe5d4('0x1b'))['register'](socket);function respondWithStatusCode(_0x9af39d,_0x3a3017){_0x3a3017=_0x3a3017||0xcc;return function(_0x3dee9f){if(_0x3dee9f){return _0x9af39d[_0xe5d4('0x1c')](_0x3a3017);}return _0x9af39d[_0xe5d4('0x1d')](_0x3a3017)[_0xe5d4('0x1e')]();};}function respondWithResult(_0x3e0139,_0x1c78fa){_0x1c78fa=_0x1c78fa||0xc8;return function(_0x274b83){if(_0x274b83){return _0x3e0139[_0xe5d4('0x1d')](_0x1c78fa)[_0xe5d4('0x1f')](_0x274b83);}};}function respondWithFilteredResult(_0x12ab5b,_0x915fb7){return function(_0x3a926a){if(_0x3a926a){var _0x435782=typeof _0x915fb7[_0xe5d4('0x20')]===_0xe5d4('0x21')&&typeof _0x915fb7[_0xe5d4('0x22')]===_0xe5d4('0x21');var _0x3253fe=_0x3a926a['count'];var _0x222791=_0x435782?0x0:_0x915fb7[_0xe5d4('0x20')];var _0x4c632f=_0x435782?_0x3a926a[_0xe5d4('0x23')]:_0x915fb7[_0xe5d4('0x20')]+_0x915fb7[_0xe5d4('0x22')];var _0x2f13d9;if(_0x4c632f>=_0x3253fe){_0x4c632f=_0x3253fe;_0x2f13d9=0xc8;}else{_0x2f13d9=0xce;}_0x12ab5b[_0xe5d4('0x1d')](_0x2f13d9);return _0x12ab5b[_0xe5d4('0x24')]('Content-Range',_0x222791+'-'+_0x4c632f+'/'+_0x3253fe)['json'](_0x3a926a);}return null;};}function patchUpdates(_0x2712b5){return function(_0x22283f){try{jsonpatch['apply'](_0x22283f,_0x2712b5,!![]);}catch(_0x1ddbbb){return BPromise[_0xe5d4('0x25')](_0x1ddbbb);}return _0x22283f['save']();};}function saveUpdates(_0x4cec21,_0x3c1a60){return function(_0x2d6e4f){if(_0x2d6e4f){return _0x2d6e4f[_0xe5d4('0x26')](_0x4cec21)[_0xe5d4('0x27')](function(_0x3e266e){return _0x3e266e;});}return null;};}function removeEntity(_0xb124df,_0x1c08b7){return function(_0x456ab2){if(_0x456ab2){return _0x456ab2['destroy']()[_0xe5d4('0x27')](function(){_0xb124df[_0xe5d4('0x1d')](0xcc)[_0xe5d4('0x1e')]();});}};}function handleEntityNotFound(_0x5db1fd,_0xf48273){return function(_0xf35c55){if(!_0xf35c55){_0x5db1fd[_0xe5d4('0x1c')](0x194);}return _0xf35c55;};}function handleError(_0x39478a,_0xbb9fdd){_0xbb9fdd=_0xbb9fdd||0x1f4;return function(_0xb0ae3b){logger['error'](_0xb0ae3b[_0xe5d4('0x28')]);if(_0xb0ae3b[_0xe5d4('0x29')]){delete _0xb0ae3b[_0xe5d4('0x29')];}_0x39478a[_0xe5d4('0x1d')](_0xbb9fdd)[_0xe5d4('0x2a')](_0xb0ae3b);};}function getInteractionUsers(_0x3bbe51,_0x569160){return new BPromise(function(_0x45663b,_0xbcf569){try{if(_0x569160[_0x3bbe51['id']]){_0x3bbe51[_0xe5d4('0x2b')]=_['map'](_0x569160[_0x3bbe51['id']],function(_0x346df4){return{'id':_0x346df4['id'],'fullname':_0x346df4['fullname']};});}}catch(_0x482bc2){_0xbcf569(_0x482bc2);}_0x45663b(_0x3bbe51);});}function getInteractionTags(_0x536d60,_0x49d612){return new BPromise(function(_0x15f33d,_0x1b5cd2){try{if(_0x536d60[_0xe5d4('0x2c')]){_0x536d60[_0xe5d4('0x2d')]=[];_0x536d60[_0xe5d4('0x2c')][_0xe5d4('0x2e')](',')['forEach'](function(_0x548cae){_0x536d60['Tags']['push'](_0x49d612[_0x548cae]);});}delete _0x536d60[_0xe5d4('0x2c')];}catch(_0x2f2e68){_0x1b5cd2(_0x2f2e68);}_0x15f33d(_0x536d60);});}function updateWhatsappInteraction(_0x412872,_0x2ba9c7,_0x48914a){return new BPromise(function(_0x1d344c,_0x1bc823){return getInteractionUsers(_0x412872,_0x48914a)[_0xe5d4('0x27')](function(_0x5dbc05){return getInteractionTags(_0x5dbc05,_0x2ba9c7);})[_0xe5d4('0x27')](function(_0x1e179a){return getStateInteraction(_0x1e179a);})[_0xe5d4('0x27')](function(_0x3510a5){_0x1d344c(_0x3510a5);})[_0xe5d4('0x2f')](function(_0x278484){_0x1bc823(_0x278484);});});}function getStateInteraction(_0x107d4c){return new BPromise(function(_0x475388){_0x107d4c[_0xe5d4('0x30')]=0x0;_0x107d4c['talking']=0x0;_0x107d4c[_0xe5d4('0x31')]=0x0;_0x107d4c[_0xe5d4('0x32')]=0x0;_0x107d4c[_0xe5d4('0x33')]=0x0;if(!_0x107d4c[_0xe5d4('0x34')]&&!_0x107d4c['UserId']){_0x107d4c[_0xe5d4('0x30')]+=0x1;}if(!_0x107d4c[_0xe5d4('0x34')]&&_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x36')]+=0x1;if(_0x107d4c[_0xe5d4('0x30')]){_0x107d4c['waiting']-=0x1;}}if(_0x107d4c['closed']&&_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x31')]+=0x1;if(_0x107d4c[_0xe5d4('0x36')]){_0x107d4c[_0xe5d4('0x36')]-=0x1;}}if(_0x107d4c['closed']&&!_0x107d4c[_0xe5d4('0x35')]){_0x107d4c[_0xe5d4('0x32')]+=0x1;if(_0x107d4c[_0xe5d4('0x30')]){_0x107d4c[_0xe5d4('0x30')]-=0x1;}}_0x107d4c[_0xe5d4('0x33')]+=0x1;_0x475388(_0x107d4c);});}exports[_0xe5d4('0x37')]=function(_0x39e17b,_0x1a4123){var _0x2c1445={},_0x333db1={},_0x1f9de9={'count':0x0,'rows':[]};var _0x4f2531=_['map'](db[_0xe5d4('0x38')][_0xe5d4('0x39')],function(_0x4cbd78){return{'name':_0x4cbd78[_0xe5d4('0x3a')],'type':_0x4cbd78[_0xe5d4('0x3b')][_0xe5d4('0x3c')]};});_0x333db1[_0xe5d4('0x3d')]=_[_0xe5d4('0x3e')](_0x4f2531,_0xe5d4('0x29'));_0x333db1[_0xe5d4('0x3f')]=_[_0xe5d4('0x40')](_0x39e17b[_0xe5d4('0x3f')]);_0x333db1[_0xe5d4('0x41')]=_['intersection'](_0x333db1[_0xe5d4('0x3d')],_0x333db1[_0xe5d4('0x3f')]);_0x2c1445[_0xe5d4('0x42')]=_[_0xe5d4('0x43')](_0x333db1[_0xe5d4('0x3d')],qs['fields'](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x2c1445[_0xe5d4('0x42')]=_0x2c1445[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x2c1445['attributes']:_0x333db1['model'];if(!_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x46')](_0xe5d4('0x47'))){_0x2c1445[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x22')]);_0x2c1445[_0xe5d4('0x20')]=qs['offset'](_0x39e17b[_0xe5d4('0x3f')]['offset']);}_0x2c1445['order']=qs[_0xe5d4('0x48')](_0x39e17b[_0xe5d4('0x3f')]['sort']);_0x2c1445[_0xe5d4('0x49')]=qs[_0xe5d4('0x41')](_['pick'](_0x39e17b['query'],_0x333db1['filters']),_0x4f2531);var _0x2df9ac=[];var _0x50e9ec=squel['select']()[_0xe5d4('0x4a')]('id')['field'](_0xe5d4('0x29'))[_0xe5d4('0x4a')](_0xe5d4('0x4b'))[_0xe5d4('0x4c')]('tools_tags');var _0x1fe8fc=squel['select']()[_0xe5d4('0x4a')]('u.id')[_0xe5d4('0x4a')](_0xe5d4('0x4d'))[_0xe5d4('0x4a')](_0xe5d4('0x4e'))['from'](_0xe5d4('0x4f'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x470c56=squel['select']()['from'](_0xe5d4('0x50'),'i')[_0xe5d4('0x51')](_0xe5d4('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe5d4('0x51')](_0xe5d4('0x53'),'o',_0xe5d4('0x54'))['left_join'](_0xe5d4('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xe5d4('0x51')](_0xe5d4('0x56'),'me',_0xe5d4('0x57'))[_0xe5d4('0x51')](_0xe5d4('0x58'),'it',_0xe5d4('0x59'))[_0xe5d4('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x110f49=squel[_0xe5d4('0x5a')]();var _0x50999e=[];var _0x5b5a02=squel['expr']();var _0x5eede3;if(_0x39e17b['query'][_0xe5d4('0x5b')]){_0x5eede3=as[_0xe5d4('0x5c')](_0x39e17b['query'][_0xe5d4('0x5b')]);var _0x53bf73=_0x5eede3[_0xe5d4('0x5d')];for(var _0xbb46e=0x0;_0xbb46e<_0x5eede3[_0xe5d4('0x5e')][_0xe5d4('0x45')];_0xbb46e++){var _0x28d0ad=_0x5eede3[_0xe5d4('0x5e')][_0xbb46e];var _0x52365e='i';var _0x5b0dba=_[_0xe5d4('0x5f')](_0x4f2531,[_0xe5d4('0x29'),_0x28d0ad[_0xe5d4('0x4a')]]);if(!_0x5b0dba){switch(_0x28d0ad['field']){case _0xe5d4('0x60'):if(_0x28d0ad[_0xe5d4('0x61')]==0x1){_0x470c56[_0xe5d4('0x62')]('`'+_0x28d0ad[_0xe5d4('0x4a')]+_0xe5d4('0x63'));}else{_0x470c56[_0xe5d4('0x62')]('`'+_0x28d0ad[_0xe5d4('0x4a')]+_0xe5d4('0x64'));}break;case _0xe5d4('0x65'):if(_0x28d0ad[_0xe5d4('0x66')]===_0xe5d4('0x67')){if(_0x28d0ad['value'][_0xe5d4('0x2e')]('\x20')[_0xe5d4('0x45')]>0x1){_0x110f49[_0x53bf73](_0xe5d4('0x68'),qs[_0xe5d4('0x69')](_0x28d0ad[_0xe5d4('0x61')]),null);}else{var _0x186546='%'+_0x28d0ad[_0xe5d4('0x61')]+'%';_0x110f49[_0x53bf73](_0xe5d4('0x6a'),_0x186546,_0x186546,_0x186546);}}else{_0x5b0dba=_['find'](_0x4f2531,[_0xe5d4('0x29'),'ContactId']);_0x28d0ad[_0xe5d4('0x4a')]=_0xe5d4('0x6b');_0x3d7877=as[_0xe5d4('0x6c')](_0x52365e,_0x5b0dba[_0xe5d4('0x3b')],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877[_0xe5d4('0x6d')],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x6e')],_0x3d7877['value'][_0xe5d4('0x1e')]);}break;case _0xe5d4('0x6f'):var _0x366c58=_0x28d0ad[_0xe5d4('0x61')][_0xe5d4('0x2e')](',')[_0xe5d4('0x3e')](function(_0x5200ae){return Number(_0x5200ae);});_0x366c58[_0xe5d4('0x70')](function(_0x1337e4){_0x5b5a02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1337e4+',%');});_0x50999e=_[_0xe5d4('0x71')](_0x50999e,_0x366c58);break;case _0xe5d4('0x72'):if(_0x28d0ad[_0xe5d4('0x66')]===_0xe5d4('0x67')){_0x110f49[_0x53bf73](_0xe5d4('0x73'),'%'+_0x28d0ad[_0xe5d4('0x61')]+'%',null);}else{_0x5b0dba=_['find'](_0x4f2531,[_0xe5d4('0x29'),_0xe5d4('0x35')]);_0x28d0ad[_0xe5d4('0x4a')]='UserId';_0x3d7877=as['buildExpression'](_0x52365e,_0x5b0dba[_0xe5d4('0x3b')],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877['text'],_0x3d7877[_0xe5d4('0x61')]['start'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);}break;case _0xe5d4('0x74'):_0x3d7877=as[_0xe5d4('0x6c')]('me',null,_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877[_0xe5d4('0x6d')],_0x3d7877[_0xe5d4('0x61')]['start'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);break;}}else{var _0x3d7877=as[_0xe5d4('0x6c')](_0x52365e,_0x5b0dba['type'],_0x28d0ad);_0x110f49[_0x53bf73](_0x3d7877['text'],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x6e')],_0x3d7877[_0xe5d4('0x61')][_0xe5d4('0x1e')]);}}}else{var _0x2e74c3=_(_0x39e17b['query'])[_0xe5d4('0x40')]()[_0xe5d4('0x3e')](function(_0x3f3241){return _[_0xe5d4('0x75')](_0x4f2531,[_0xe5d4('0x29'),_0x3f3241])?_0x3f3241:undefined;})[_0xe5d4('0x76')]()[_0xe5d4('0x61')]();if(!_[_0xe5d4('0x77')](_0x2e74c3)){_0x2e74c3['forEach'](function(_0x20399d){if(_0x20399d==='WhatsappAccountId'){_0x470c56[_0xe5d4('0x49')]('i.WhatsappAccountId\x20IN\x20?',[][_0xe5d4('0x78')](_0x39e17b[_0xe5d4('0x3f')][_0x20399d]));}else if(_0x20399d===_0xe5d4('0x79')){var _0x40f8db=JSON[_0xe5d4('0x7a')](_0x39e17b[_0xe5d4('0x3f')][_0x20399d])[_0xe5d4('0x7b')];var _0x299121=JSON['parse'](_0x39e17b[_0xe5d4('0x3f')][_0x20399d])[_0xe5d4('0x7c')];_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x7d'),_0x40f8db,_0x299121);}else{if(_0x39e17b[_0xe5d4('0x3f')][_0x20399d]===_0xe5d4('0x7e')){_0x470c56[_0xe5d4('0x49')]('i.'+_0x20399d+_0xe5d4('0x7f'));}else{_0x470c56['where']('i.'+_0x20399d+_0xe5d4('0x80'),_0x39e17b['query'][_0x20399d]);}}});}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x81')]){if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x81')]==0x1){_0x470c56[_0xe5d4('0x62')](_0xe5d4('0x82'));}else{_0x470c56['having'](_0xe5d4('0x83'));}}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]){_0x50999e=_[_0xe5d4('0x85')](_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')])?_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]:new Array(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x84')]);_0x50999e[_0xe5d4('0x70')](function(_0x4288f8){_0x5b5a02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4288f8+',%');});}if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x86')]){var _0x1c25a0=_0x39e17b[_0xe5d4('0x3f')]['filter'][_0xe5d4('0x87')]('\x5c','\x5c\x5c')[_0xe5d4('0x87')](/'/g,'\x27\x27');if(qs[_0xe5d4('0x88')](_0x1c25a0)){_0x110f49['or'](_0xe5d4('0x89'),_0x1c25a0+'%')['or']('i.phone\x20LIKE\x20?',_0x1c25a0+'%');}else{_0x110f49['or'](_0xe5d4('0x8a'),qs[_0xe5d4('0x69')](_0x1c25a0))['or'](_0xe5d4('0x8b'),_0x1c25a0+'%');}}}_0x470c56[_0xe5d4('0x49')](_0x110f49);_0x470c56[_0xe5d4('0x8c')](_0xe5d4('0x8d'));var _0xe931d={'type':db[_0xe5d4('0x8e')][_0xe5d4('0x8f')][_0xe5d4('0x90')],'raw':!![]};var _0x46907a=_0x470c56[_0xe5d4('0x91')]();_0x46907a[_0xe5d4('0x4a')](_0xe5d4('0x8d'));_0x46907a[_0xe5d4('0x4a')](_0xe5d4('0x92'),'unreadMessages');if(_0x2c1445[_0xe5d4('0x93')]){_0x2c1445[_0xe5d4('0x93')][_0xe5d4('0x70')](function(_0x230b3d){var _0x486be1=_0x230b3d[0x0]===_0xe5d4('0x94')?_0x230b3d[0x0]:'i.'+_0x230b3d[0x0];_0x470c56[_0xe5d4('0x93')](_0x486be1,_0x230b3d[0x1]===_0xe5d4('0x95')?![]:!![]);});}if(!_[_0xe5d4('0x77')](_0x50999e)){_0x470c56[_0xe5d4('0x62')](_0x5b5a02);_0x46907a['where'](_0xe5d4('0x96'),_0x50999e);}BPromise[_0xe5d4('0x97')]()[_0xe5d4('0x27')](function(){if(!_0x5eede3){if(_0x39e17b['query'][_0xe5d4('0x98')])return;_0x46907a[_0xe5d4('0x49')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x470c56['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x39e17b[_0xe5d4('0x99')]['role']!==_0xe5d4('0x9a'))return;return _0x39e17b[_0xe5d4('0x99')][_0xe5d4('0x9b')]({'attributes':['id'],'raw':!![]})[_0xe5d4('0x27')](function(_0x55c437){if(_[_0xe5d4('0x77')](_0x55c437)){_0x46907a[_0xe5d4('0x49')](_0xe5d4('0x9c'));_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x9c'));}else{_0x46907a['where'](_0xe5d4('0x9d'),_[_0xe5d4('0x3e')](_0x55c437,'id'));_0x470c56[_0xe5d4('0x49')](_0xe5d4('0x9d'),_[_0xe5d4('0x3e')](_0x55c437,'id'));}});})[_0xe5d4('0x27')](function(){if(_0x39e17b['user'][_0xe5d4('0x9e')]==='agent'&&!_0x5eede3&&!_0x39e17b['query'][_0xe5d4('0x98')])return[];return db[_0xe5d4('0x9f')][_0xe5d4('0x3f')](_0x46907a['toString'](),_0xe931d);})[_0xe5d4('0x27')](function(_0x4f37b5){_0x1f9de9[_0xe5d4('0x23')]=_0x4f37b5[_0xe5d4('0x45')];if(_0x1f9de9['count']===0x0)return[];return db['sequelize'][_0xe5d4('0x3f')](_0x50e9ec[_0xe5d4('0xa0')](),_0xe931d)[_0xe5d4('0x27')](function(_0x3cbf64){_0x2df9ac=_[_0xe5d4('0xa1')](_0x3cbf64,'id');_0xe931d=_[_0xe5d4('0xa2')](_0xe931d,{'model':db[_0xe5d4('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39e17b[_0xe5d4('0x3f')][_0xe5d4('0x44')]){_0x2c1445['attributes'][_0xe5d4('0x70')](function(_0x317c57){_0x470c56[_0xe5d4('0x4a')]('i.'+_0x317c57);});}else{_0x470c56[_0xe5d4('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe5d4('0x60'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa3'),_0xe5d4('0xa4'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa5'),_0xe5d4('0xa6'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa7'),_0xe5d4('0x94'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa8'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xa9'),_0xe5d4('0xaa'));_0x470c56['field']('c.lastName',_0xe5d4('0xab'));_0x470c56['field'](_0xe5d4('0xac'),_0xe5d4('0xad'));_0x470c56['field']('c.phone',_0xe5d4('0xae'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xaf'),_0xe5d4('0xb0'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb1'),_0xe5d4('0xb2'));_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb3'),'Owner.fullname');_0x470c56[_0xe5d4('0x4a')](_0xe5d4('0xb4'),_0xe5d4('0xb5'));_0x470c56[_0xe5d4('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x2c1445[_0xe5d4('0x22')])_0x470c56[_0xe5d4('0x22')](_0x2c1445[_0xe5d4('0x22')]);if(_0x2c1445[_0xe5d4('0x20')])_0x470c56[_0xe5d4('0x20')](_0x2c1445[_0xe5d4('0x20')]);return db[_0xe5d4('0x9f')]['query'](_0x470c56[_0xe5d4('0xa0')](),_0xe931d);})[_0xe5d4('0x27')](function(_0x1fc8d9){if(_0x1fc8d9[_0xe5d4('0x45')]>0x0)_0x1fe8fc[_0xe5d4('0x49')](_0xe5d4('0xb6'),_[_0xe5d4('0x3e')](_0x1fc8d9,'id'));return db[_0xe5d4('0x9f')][_0xe5d4('0x3f')](_0x1fe8fc[_0xe5d4('0xa0')](),_0xe931d)[_0xe5d4('0x27')](function(_0x365f2f){var _0x1f742e=_['groupBy'](_0x365f2f,_0xe5d4('0xb7'));var _0x1ba7fb=[];_0x1fc8d9['forEach'](function(_0x3a5cd9){_0x1ba7fb[_0xe5d4('0xb8')](updateWhatsappInteraction(_0x3a5cd9,_0x2df9ac,_0x1f742e));});return BPromise[_0xe5d4('0xb9')](_0x1ba7fb);});});})['then'](function(_0x34b777){_0x1f9de9[_0xe5d4('0xba')]=_0x34b777;return _0x1f9de9;})[_0xe5d4('0x27')](respondWithFilteredResult(_0x1a4123,_0x2c1445))['catch'](handleError(_0x1a4123,null));};exports[_0xe5d4('0xbb')]=function(_0x227693,_0x35f8c1){var _0x4965c9={'raw':![],'where':{'id':_0x227693[_0xe5d4('0xbc')]['id']}},_0x1f9ada={};_0x1f9ada[_0xe5d4('0x3d')]=_['keys'](db[_0xe5d4('0x38')]['rawAttributes']);_0x1f9ada['query']=_[_0xe5d4('0x40')](_0x227693[_0xe5d4('0x3f')]);_0x1f9ada['filters']=_[_0xe5d4('0x43')](_0x1f9ada['model'],_0x1f9ada[_0xe5d4('0x3f')]);_0x4965c9[_0xe5d4('0x42')]=_[_0xe5d4('0x43')](_0x1f9ada[_0xe5d4('0x3d')],qs[_0xe5d4('0x44')](_0x227693[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x4965c9[_0xe5d4('0x42')]=_0x4965c9[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x4965c9[_0xe5d4('0x42')]:_0x1f9ada[_0xe5d4('0x3d')];if(_0x227693[_0xe5d4('0x3f')][_0xe5d4('0xbd')]){_0x4965c9['include']=[{'all':!![]}];}_0x4965c9=_[_0xe5d4('0xa2')]({},_0x4965c9,_0x227693['options']);return db['WhatsappInteraction']['find'](_0x4965c9)['then'](handleEntityNotFound(_0x35f8c1,null))[_0xe5d4('0x27')](respondWithResult(_0x35f8c1,null))[_0xe5d4('0x2f')](handleError(_0x35f8c1,null));};exports[_0xe5d4('0xbe')]=function(_0x391d75,_0x38e9c8){return db['WhatsappInteraction'][_0xe5d4('0xbe')](_0x391d75[_0xe5d4('0x74')],{})[_0xe5d4('0x27')](respondWithResult(_0x38e9c8,0xc9))[_0xe5d4('0x2f')](handleError(_0x38e9c8,null));};exports[_0xe5d4('0x26')]=function(_0x19895a,_0x266037){if(_0x19895a[_0xe5d4('0x74')]['id']){delete _0x19895a[_0xe5d4('0x74')]['id'];}return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x19895a[_0xe5d4('0xbc')]['id']}})['then'](handleEntityNotFound(_0x266037,null))[_0xe5d4('0x27')](saveUpdates(_0x19895a[_0xe5d4('0x74')],null))[_0xe5d4('0x27')](respondWithResult(_0x266037,null))[_0xe5d4('0x2f')](handleError(_0x266037,null));};exports[_0xe5d4('0xbf')]=function(_0x40464c,_0x2dd103){return db['WhatsappInteraction'][_0xe5d4('0x5f')]({'where':{'id':_0x40464c['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x2dd103,null))[_0xe5d4('0x27')](removeEntity(_0x2dd103,null))[_0xe5d4('0x2f')](handleError(_0x2dd103,null));};exports[_0xe5d4('0xc0')]=function(_0x5ace69,_0x2c1349){return db[_0xe5d4('0x38')][_0xe5d4('0xc0')]()[_0xe5d4('0x27')](respondWithResult(_0x2c1349,null))[_0xe5d4('0x2f')](handleError(_0x2c1349,null));};exports[_0xe5d4('0xc1')]=function(_0x4ed3c5,_0x470a15,_0x1e9175){return db[_0xe5d4('0xc2')]['find']({'where':{'id':_0x4ed3c5['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x470a15,null))[_0xe5d4('0x27')](function(_0x2795bf){if(_0x2795bf){return _0x2795bf[_0xe5d4('0xc1')](_0x4ed3c5[_0xe5d4('0x74')][_0xe5d4('0xc3')],_['omit'](_0x4ed3c5[_0xe5d4('0x74')],[_0xe5d4('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x470a15,null))['catch'](handleError(_0x470a15,null));};exports['getMessages']=function(_0x376e7,_0xe8792f,_0x52161c){var _0x2ab5b3={'raw':![],'where':{}};var _0x56afa0={};var _0x148756={'count':0x0,'rows':[]};return db[_0xe5d4('0x38')][_0xe5d4('0xc4')]({'where':{'id':_0x376e7['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0xe8792f,null))['then'](function(_0x165edc){if(_0x165edc){_0x56afa0[_0xe5d4('0x3d')]=_[_0xe5d4('0x40')](db[_0xe5d4('0xc2')][_0xe5d4('0x39')]);_0x56afa0[_0xe5d4('0x3f')]=_[_0xe5d4('0x40')](_0x376e7[_0xe5d4('0x3f')]);_0x56afa0[_0xe5d4('0x41')]=_[_0xe5d4('0x43')](_0x56afa0[_0xe5d4('0x3d')],_0x56afa0[_0xe5d4('0x3f')]);_0x2ab5b3['attributes']=_[_0xe5d4('0x43')](_0x56afa0[_0xe5d4('0x3d')],qs[_0xe5d4('0x44')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x44')]));_0x2ab5b3[_0xe5d4('0x42')]=_0x2ab5b3[_0xe5d4('0x42')][_0xe5d4('0x45')]?_0x2ab5b3['attributes']:_0x56afa0[_0xe5d4('0x3d')];if(!_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x46')](_0xe5d4('0x47'))){_0x2ab5b3[_0xe5d4('0x22')]=qs[_0xe5d4('0x22')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x22')]);_0x2ab5b3['offset']=qs['offset'](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x20')]);}_0x2ab5b3[_0xe5d4('0x93')]=qs[_0xe5d4('0x48')](_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x48')]);_0x2ab5b3[_0xe5d4('0x49')]=qs[_0xe5d4('0x41')](_[_0xe5d4('0xc5')](_0x376e7['query'],_0x56afa0[_0xe5d4('0x41')]));_0x2ab5b3[_0xe5d4('0x49')][_0xe5d4('0xb7')]=_0x165edc['id'];if(_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x86')]){_0x2ab5b3[_0xe5d4('0x49')]=_[_0xe5d4('0xa2')](_0x2ab5b3['where'],{'$or':_[_0xe5d4('0x3e')](_0x2ab5b3[_0xe5d4('0x42')],function(_0x17f160){var _0x179be3={};_0x179be3[_0x17f160]={'$like':'%'+_0x376e7['query'][_0xe5d4('0x86')]+'%'};return _0x179be3;})});}if(_0x376e7[_0xe5d4('0x3f')][_0xe5d4('0x7b')]){var _0x52964f=_0x376e7['query'][_0xe5d4('0x7b')][_0xe5d4('0x2e')](',');var _0xa22f5e={};_0xa22f5e[_0x52964f[0x0]]={'$gte':moment(_0x52964f[0x1])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))};_0x2ab5b3[_0xe5d4('0x49')]=_['merge'](_0x2ab5b3['where'],_0xa22f5e);}_0x2ab5b3=_[_0xe5d4('0xa2')]({},_0x2ab5b3,_0x376e7['options']);return db['WhatsappMessage'][_0xe5d4('0x23')]({'where':_0x2ab5b3['where']})['then'](function(_0x3c484a){_0x148756['count']=_0x3c484a;if(_0x376e7['query'][_0xe5d4('0xbd')]){_0x2ab5b3[_0xe5d4('0xc8')]=[{'all':!![]}];}return db[_0xe5d4('0xc2')]['findAll'](_0x2ab5b3);})[_0xe5d4('0x27')](function(_0x56d325){_0x148756[_0xe5d4('0xba')]=_0x56d325;return _0x148756;});}})[_0xe5d4('0x27')](respondWithFilteredResult(_0xe8792f,_0x2ab5b3))[_0xe5d4('0x2f')](handleError(_0xe8792f,null));};exports[_0xe5d4('0xc9')]=function(_0x1e8b66,_0xa338da,_0xb8bbee){return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x1e8b66[_0xe5d4('0xbc')]['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0xa338da,null))['then'](function(_0x54a593){if(_0x54a593){return _0x54a593['setTags'](_0x1e8b66[_0xe5d4('0x74')][_0xe5d4('0xc3')],_[_0xe5d4('0xca')](_0x1e8b66['body'],[_0xe5d4('0xc3'),'id'])||{})['spread'](function(){return db[_0xe5d4('0x6f')][_0xe5d4('0xcb')]({'attributes':['id','name',_0xe5d4('0x4b')],'where':{'id':_0x1e8b66[_0xe5d4('0x74')]['ids']}});})[_0xe5d4('0x27')](function(_0x5e2ea0){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x1e8b66[_0xe5d4('0xbc')]['id']),'tags':_0x5e2ea0||[]});return{'id':Number(_0x1e8b66[_0xe5d4('0xbc')]['id']),'tags':_0x5e2ea0||[]};});}})[_0xe5d4('0x27')](respondWithResult(_0xa338da,null))[_0xe5d4('0x2f')](handleError(_0xa338da,null));};exports['removeTags']=function(_0xb6ceb7,_0x6f13d1,_0x53ebe5){return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0xb6ceb7['params']['id']}})[_0xe5d4('0x27')](handleEntityNotFound(_0x6f13d1,null))['then'](function(_0x493757){if(_0x493757){return _0x493757['removeTags'](_0xb6ceb7['query'][_0xe5d4('0xc3')]);}})['then'](respondWithStatusCode(_0x6f13d1,null))[_0xe5d4('0x2f')](handleError(_0x6f13d1,null));};exports[_0xe5d4('0xcc')]=function(_0x37bc25,_0x418256){var _0x3c3b09=moment()['unix']()['toString']();var _0x51c93f=path[_0xe5d4('0xcd')](config[_0xe5d4('0xce')],_0xe5d4('0xcf'),_0xe5d4('0xd0'),_0xe5d4('0xd1'));var _0x1b43e2=path[_0xe5d4('0xcd')](config['root'],_0xe5d4('0xcf'),_0xe5d4('0xd0'),_0xe5d4('0xd2'));var _0x31c6d2=path[_0xe5d4('0xcd')](_0x51c93f,_0x3c3b09);var _0x1c4380=util[_0xe5d4('0xc6')](_0xe5d4('0xd3'),_0x37bc25[_0xe5d4('0xbc')]['id'],_0x3c3b09);var _0x383c12=path[_0xe5d4('0xcd')](_0x51c93f,_0x1c4380);var _0x215011=[];_0x215011[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0x72')],'as':_0xe5d4('0x72'),'attributes':['id',_0xe5d4('0xd4')],'raw':!![]});_0x215011['push']({'model':db[_0xe5d4('0xd5')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x37bc25[_0xe5d4('0x3f')][_0xe5d4('0xd2')]){_0x215011['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x57bc1a=[{'model':db['WhatsappMessage'],'as':_0xe5d4('0xd6'),'attributes':['id',_0xe5d4('0x74'),_0xe5d4('0x79'),_0xe5d4('0xd7'),_0xe5d4('0xd8'),_0xe5d4('0x81')],'include':_0x215011}];_0x57bc1a[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0xd9')],'as':_0xe5d4('0xda'),'attributes':['id',_0xe5d4('0x29')]});_0x57bc1a[_0xe5d4('0xb8')]({'model':db[_0xe5d4('0x72')],'as':_0xe5d4('0xdb'),'attributes':['id',_0xe5d4('0xd4')]});return db[_0xe5d4('0x38')][_0xe5d4('0x5f')]({'where':{'id':_0x37bc25[_0xe5d4('0xbc')]['id']},'include':_0x57bc1a})['then'](handleEntityNotFound(_0x418256,null))['then'](function(_0x30c3fb){if(_0x30c3fb){var _0x54a804=_0x30c3fb[_0xe5d4('0xdc')]({'plain':!![]});fs[_0xe5d4('0xdd')](_0x31c6d2);var _0x5285a3={'channel':_0xe5d4('0xde'),'account':_0x54a804[_0xe5d4('0xda')]['name'],'agent':_0x54a804[_0xe5d4('0xdb')]?_0x54a804[_0xe5d4('0xdb')]['fullname']:_0xe5d4('0xdf'),'createdAt':moment(_0x54a804['createdAt'])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))[_0xe5d4('0xa0')](),'closedAt':_0x54a804[_0xe5d4('0x34')]?moment(_0x54a804[_0xe5d4('0xe0')])[_0xe5d4('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x54a804[_0xe5d4('0xe1')],'messages':_(_0x54a804[_0xe5d4('0xd6')])[_0xe5d4('0x86')]({'secret':![]})[_0xe5d4('0x3e')](function(_0x156956){if(_0x156956[_0xe5d4('0xe2')]){var _0x5813f8=path[_0xe5d4('0xcd')](_0x1b43e2,_0x156956[_0xe5d4('0xe2')]['basename']);if(fs[_0xe5d4('0xe3')](_0x5813f8)){fs[_0xe5d4('0xe4')](_0x5813f8)['pipe'](fs[_0xe5d4('0xe5')](path['join'](_0x31c6d2,_0x156956[_0xe5d4('0xe2')][_0xe5d4('0xe6')])));}}return{'date':moment(_0x156956[_0xe5d4('0x79')])[_0xe5d4('0xc6')](_0xe5d4('0xc7'))['toString'](),'sender':_0x156956[_0xe5d4('0xd7')]===_0xe5d4('0xe7')?_0x156956['User']?_0x156956[_0xe5d4('0x72')][_0xe5d4('0xd4')]:_0xe5d4('0xe8'):_0x156956['Contact']['firstName']+(_0x156956[_0xe5d4('0x65')][_0xe5d4('0xe9')]?'\x20'+_0x156956['Contact'][_0xe5d4('0xe9')]:''),'body':_0x156956[_0xe5d4('0xe2')]?_0x156956[_0xe5d4('0xe2')][_0xe5d4('0xe6')]:_0x156956[_0xe5d4('0x74')],'direction':_0x156956[_0xe5d4('0xd7')]===_0xe5d4('0xe7')?'A':'C','secret':_0x156956[_0xe5d4('0xd8')],'read':_0x156956[_0xe5d4('0x81')],'attachment':_0x156956[_0xe5d4('0xe2')]};})[_0xe5d4('0x61')]()};return ejs[_0xe5d4('0xea')](path[_0xe5d4('0xcd')](config['root'],_0xe5d4('0xcf'),_0xe5d4('0xeb'),_0xe5d4('0xec')),{'interaction':_0x5285a3})['then'](function(_0x3ff451){var _0x43581d=path['join'](_0x31c6d2,_0xe5d4('0xed')+_0x54a804['id']+'-'+_0x3c3b09+_0xe5d4('0xee'));var _0xdd31d8={'path':_0x43581d,'channel':_0xe5d4('0xde'),'interactionId':_0x54a804['id']};return pdf['createPdfFromHTML'](_0x3ff451,_0xdd31d8);})['then'](function(){return new BPromise(function(_0x3c3686,_0x3f3f0a){zipdir(_0x31c6d2,{'saveTo':_0x383c12},function(_0x5544bb,_0x2f510c){if(_0x5544bb)return _0x3f3f0a(_0x5544bb);return _0x3c3686(_0x2f510c);});})['then'](function(){return new BPromise(function(_0x234476,_0x3f3cab){rimraf(_0x31c6d2,function(_0x48b244){if(_0x48b244)_0x3f3cab(_0x48b244);return _0x234476();});});})[_0xe5d4('0x27')](function(){return _0x418256['download'](_0x383c12,_0x1c4380,function(_0x534c11){if(_0x534c11){console['log']('err',_0x534c11);}else{fs[_0xe5d4('0xef')](_0x383c12);}});});});}else{return _0x418256[_0xe5d4('0x1c')](0xc8);}})[_0xe5d4('0x2f')](handleError(_0x418256,null));}; \ No newline at end of file +var _0x1fa9=['c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','catch','show','params','includeAll','include','options','create','update','destroy','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','emit','whatsappInteractionTags:save','removeTags','download','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','fullname','get','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','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','localhost','redis','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','buildExpression','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone'];(function(_0x382410,_0x3f67c9){var _0x1a603d=function(_0x242310){while(--_0x242310){_0x382410['push'](_0x382410['shift']());}};_0x1a603d(++_0x3f67c9);}(_0x1fa9,0x136));var _0x91fa=function(_0x1c9e12,_0x39b881){_0x1c9e12=_0x1c9e12-0x0;var _0x1f0dd4=_0x1fa9[_0x1c9e12];return _0x1f0dd4;};'use strict';var emlformat=require(_0x91fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91fa('0x2'));var moment=require(_0x91fa('0x3'));var BPromise=require(_0x91fa('0x4'));var Mustache=require('mustache');var util=require(_0x91fa('0x5'));var path=require(_0x91fa('0x6'));var sox=require(_0x91fa('0x7'));var csv=require(_0x91fa('0x8'));var ejs=require(_0x91fa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91fa('0xa'));var squel=require(_0x91fa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x91fa('0xc'));var toCsv=require(_0x91fa('0x8'));var querystring=require(_0x91fa('0xd'));var Papa=require(_0x91fa('0xe'));var Redis=require(_0x91fa('0xf'));var authService=require(_0x91fa('0x10'));var qs=require(_0x91fa('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x91fa('0x12'));var logger=require(_0x91fa('0x13'))(_0x91fa('0x14'));var utils=require(_0x91fa('0x15'));var config=require(_0x91fa('0x16'));var licenseUtil=require(_0x91fa('0x17'));var db=require(_0x91fa('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x91fa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91fa('0x1a')]));require(_0x91fa('0x1b'))[_0x91fa('0x1c')](socket);function respondWithStatusCode(_0x2797d2,_0x5449a7){_0x5449a7=_0x5449a7||0xcc;return function(_0x308812){if(_0x308812){return _0x2797d2[_0x91fa('0x1d')](_0x5449a7);}return _0x2797d2[_0x91fa('0x1e')](_0x5449a7)[_0x91fa('0x1f')]();};}function respondWithResult(_0xe9e249,_0x1f43fa){_0x1f43fa=_0x1f43fa||0xc8;return function(_0x5172d8){if(_0x5172d8){return _0xe9e249[_0x91fa('0x1e')](_0x1f43fa)[_0x91fa('0x20')](_0x5172d8);}};}function respondWithFilteredResult(_0x2efa2a,_0x3916cc){return function(_0xd39ff8){if(_0xd39ff8){var _0x4dcbcf=typeof _0x3916cc[_0x91fa('0x21')]===_0x91fa('0x22')&&typeof _0x3916cc[_0x91fa('0x23')]===_0x91fa('0x22');var _0xaaf2eb=_0xd39ff8[_0x91fa('0x24')];var _0xb5109c=_0x4dcbcf?0x0:_0x3916cc[_0x91fa('0x21')];var _0xba1e97=_0x4dcbcf?_0xd39ff8[_0x91fa('0x24')]:_0x3916cc[_0x91fa('0x21')]+_0x3916cc['limit'];var _0x46433d;if(_0xba1e97>=_0xaaf2eb){_0xba1e97=_0xaaf2eb;_0x46433d=0xc8;}else{_0x46433d=0xce;}_0x2efa2a[_0x91fa('0x1e')](_0x46433d);return _0x2efa2a['set'](_0x91fa('0x25'),_0xb5109c+'-'+_0xba1e97+'/'+_0xaaf2eb)['json'](_0xd39ff8);}return null;};}function patchUpdates(_0x3c4b36){return function(_0x4c5ce3){try{jsonpatch['apply'](_0x4c5ce3,_0x3c4b36,!![]);}catch(_0x5d89f9){return BPromise[_0x91fa('0x26')](_0x5d89f9);}return _0x4c5ce3[_0x91fa('0x27')]();};}function saveUpdates(_0x3dd307,_0x476070){return function(_0x1fd482){if(_0x1fd482){return _0x1fd482['update'](_0x3dd307)[_0x91fa('0x28')](function(_0xb7a98){return _0xb7a98;});}return null;};}function removeEntity(_0x252c71,_0x1d2019){return function(_0x4b0090){if(_0x4b0090){return _0x4b0090['destroy']()[_0x91fa('0x28')](function(){_0x252c71[_0x91fa('0x1e')](0xcc)[_0x91fa('0x1f')]();});}};}function handleEntityNotFound(_0x44af0b,_0x1224ef){return function(_0x50b4fa){if(!_0x50b4fa){_0x44af0b[_0x91fa('0x1d')](0x194);}return _0x50b4fa;};}function handleError(_0x404bbc,_0x402884){_0x402884=_0x402884||0x1f4;return function(_0x5601c4){logger['error'](_0x5601c4[_0x91fa('0x29')]);if(_0x5601c4[_0x91fa('0x2a')]){delete _0x5601c4[_0x91fa('0x2a')];}_0x404bbc[_0x91fa('0x1e')](_0x402884)[_0x91fa('0x2b')](_0x5601c4);};}function getInteractionUsers(_0x17bba2,_0x27ed0e){return new BPromise(function(_0x33198a,_0x455e8c){try{if(_0x27ed0e[_0x17bba2['id']]){_0x17bba2[_0x91fa('0x2c')]=_[_0x91fa('0x2d')](_0x27ed0e[_0x17bba2['id']],function(_0x5defcb){return{'id':_0x5defcb['id'],'fullname':_0x5defcb['fullname']};});}}catch(_0x291ff2){_0x455e8c(_0x291ff2);}_0x33198a(_0x17bba2);});}function getInteractionTags(_0x242640,_0x2e5b1f){return new BPromise(function(_0x432fd1,_0x2c6726){try{if(_0x242640[_0x91fa('0x2e')]){_0x242640['Tags']=[];_0x242640[_0x91fa('0x2e')][_0x91fa('0x2f')](',')[_0x91fa('0x30')](function(_0x6b9aed){_0x242640[_0x91fa('0x31')][_0x91fa('0x32')](_0x2e5b1f[_0x6b9aed]);});}delete _0x242640[_0x91fa('0x2e')];}catch(_0x3b65fa){_0x2c6726(_0x3b65fa);}_0x432fd1(_0x242640);});}function updateWhatsappInteraction(_0x4a5388,_0x4bef35,_0x23d3c8){return new BPromise(function(_0xe0a4c6,_0x55ea0f){return getInteractionUsers(_0x4a5388,_0x23d3c8)[_0x91fa('0x28')](function(_0x512a31){return getInteractionTags(_0x512a31,_0x4bef35);})['then'](function(_0x2b4b98){return getStateInteraction(_0x2b4b98);})[_0x91fa('0x28')](function(_0x28cbbe){_0xe0a4c6(_0x28cbbe);})['catch'](function(_0x3ca2fb){_0x55ea0f(_0x3ca2fb);});});}function getStateInteraction(_0xd0816b){return new BPromise(function(_0x2b9a37){_0xd0816b[_0x91fa('0x33')]=0x0;_0xd0816b[_0x91fa('0x34')]=0x0;_0xd0816b[_0x91fa('0x35')]=0x0;_0xd0816b[_0x91fa('0x36')]=0x0;_0xd0816b['total']=0x0;if(!_0xd0816b[_0x91fa('0x37')]&&!_0xd0816b[_0x91fa('0x38')]){_0xd0816b['waiting']+=0x1;}if(!_0xd0816b['closed']&&_0xd0816b[_0x91fa('0x38')]){_0xd0816b[_0x91fa('0x34')]+=0x1;if(_0xd0816b['waiting']){_0xd0816b[_0x91fa('0x33')]-=0x1;}}if(_0xd0816b[_0x91fa('0x37')]&&_0xd0816b['UserId']){_0xd0816b[_0x91fa('0x35')]+=0x1;if(_0xd0816b['talking']){_0xd0816b['talking']-=0x1;}}if(_0xd0816b[_0x91fa('0x37')]&&!_0xd0816b[_0x91fa('0x38')]){_0xd0816b['unmanaged']+=0x1;if(_0xd0816b[_0x91fa('0x33')]){_0xd0816b[_0x91fa('0x33')]-=0x1;}}_0xd0816b['total']+=0x1;_0x2b9a37(_0xd0816b);});}exports[_0x91fa('0x39')]=function(_0x501e3c,_0x3c2482){var _0x4a3c54={},_0x396a91={},_0x560070={'count':0x0,'rows':[]};var _0x8987ad=_[_0x91fa('0x2d')](db[_0x91fa('0x3a')][_0x91fa('0x3b')],function(_0x55417b){return{'name':_0x55417b[_0x91fa('0x3c')],'type':_0x55417b[_0x91fa('0x3d')][_0x91fa('0x3e')]};});_0x396a91[_0x91fa('0x3f')]=_[_0x91fa('0x2d')](_0x8987ad,_0x91fa('0x2a'));_0x396a91['query']=_[_0x91fa('0x40')](_0x501e3c['query']);_0x396a91[_0x91fa('0x41')]=_[_0x91fa('0x42')](_0x396a91[_0x91fa('0x3f')],_0x396a91[_0x91fa('0x43')]);_0x4a3c54[_0x91fa('0x44')]=_[_0x91fa('0x42')](_0x396a91[_0x91fa('0x3f')],qs[_0x91fa('0x45')](_0x501e3c['query'][_0x91fa('0x45')]));_0x4a3c54['attributes']=_0x4a3c54[_0x91fa('0x44')][_0x91fa('0x46')]?_0x4a3c54[_0x91fa('0x44')]:_0x396a91[_0x91fa('0x3f')];if(!_0x501e3c[_0x91fa('0x43')][_0x91fa('0x47')](_0x91fa('0x48'))){_0x4a3c54[_0x91fa('0x23')]=qs[_0x91fa('0x23')](_0x501e3c[_0x91fa('0x43')][_0x91fa('0x23')]);_0x4a3c54[_0x91fa('0x21')]=qs[_0x91fa('0x21')](_0x501e3c[_0x91fa('0x43')][_0x91fa('0x21')]);}_0x4a3c54['order']=qs[_0x91fa('0x49')](_0x501e3c[_0x91fa('0x43')][_0x91fa('0x49')]);_0x4a3c54[_0x91fa('0x4a')]=qs[_0x91fa('0x41')](_[_0x91fa('0x4b')](_0x501e3c[_0x91fa('0x43')],_0x396a91[_0x91fa('0x41')]),_0x8987ad);var _0x50aa1b=[];var _0x3c554c=squel[_0x91fa('0x4c')]()[_0x91fa('0x4d')]('id')[_0x91fa('0x4d')]('name')[_0x91fa('0x4d')](_0x91fa('0x4e'))[_0x91fa('0x4f')](_0x91fa('0x50'));var _0x19b3c9=squel['select']()[_0x91fa('0x4d')]('u.id')[_0x91fa('0x4d')](_0x91fa('0x51'))[_0x91fa('0x4d')](_0x91fa('0x52'))[_0x91fa('0x4f')](_0x91fa('0x53'),'ui')[_0x91fa('0x54')](_0x91fa('0x55'),'u',_0x91fa('0x56'));var _0xed80bb=squel[_0x91fa('0x4c')]()['from'](_0x91fa('0x57'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x91fa('0x58'))[_0x91fa('0x54')](_0x91fa('0x59'),'a',_0x91fa('0x5a'))[_0x91fa('0x54')](_0x91fa('0x5b'),'me',_0x91fa('0x5c'))[_0x91fa('0x54')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x91fa('0x50'),'t',_0x91fa('0x5d'));var _0x5966e0=squel[_0x91fa('0x5e')]();var _0x231caf=[];var _0x3510a9=squel['expr']();var _0xd5cefb;if(_0x501e3c['query'][_0x91fa('0x5f')]){_0xd5cefb=as[_0x91fa('0x60')](_0x501e3c[_0x91fa('0x43')][_0x91fa('0x5f')]);var _0x439b4b=_0xd5cefb[_0x91fa('0x61')];for(var _0x5f4e04=0x0;_0x5f4e04<_0xd5cefb['conditions'][_0x91fa('0x46')];_0x5f4e04++){var _0x16183e=_0xd5cefb[_0x91fa('0x62')][_0x5f4e04];var _0x29bf0a='i';var _0x2d80c0=_['find'](_0x8987ad,[_0x91fa('0x2a'),_0x16183e[_0x91fa('0x4d')]]);if(!_0x2d80c0){switch(_0x16183e[_0x91fa('0x4d')]){case _0x91fa('0x63'):if(_0x16183e['value']==0x1){_0xed80bb[_0x91fa('0x64')]('`'+_0x16183e[_0x91fa('0x4d')]+_0x91fa('0x65'));}else{_0xed80bb[_0x91fa('0x64')]('`'+_0x16183e[_0x91fa('0x4d')]+_0x91fa('0x66'));}break;case _0x91fa('0x67'):if(_0x16183e[_0x91fa('0x68')]==='$substring'){if(_0x16183e['value'][_0x91fa('0x2f')]('\x20')['length']>0x1){_0x5966e0[_0x439b4b](_0x91fa('0x69'),qs[_0x91fa('0x6a')](_0x16183e[_0x91fa('0x6b')]),null);}else{var _0x5b3712='%'+_0x16183e[_0x91fa('0x6b')]+'%';_0x5966e0[_0x439b4b](_0x91fa('0x6c'),_0x5b3712,_0x5b3712,_0x5b3712);}}else{_0x2d80c0=_[_0x91fa('0x6d')](_0x8987ad,[_0x91fa('0x2a'),_0x91fa('0x6e')]);_0x16183e['field']=_0x91fa('0x6e');_0x1e1872=as['buildExpression'](_0x29bf0a,_0x2d80c0[_0x91fa('0x3d')],_0x16183e);_0x5966e0[_0x439b4b](_0x1e1872[_0x91fa('0x6f')],_0x1e1872['value']['start'],_0x1e1872['value']['end']);}break;case _0x91fa('0x70'):var _0x4c204c=_0x16183e['value'][_0x91fa('0x2f')](',')[_0x91fa('0x2d')](function(_0x27797e){return Number(_0x27797e);});_0x4c204c[_0x91fa('0x30')](function(_0x4f8bad){_0x3510a9['or'](_0x91fa('0x71'),'%,'+_0x4f8bad+',%');});_0x231caf=_[_0x91fa('0x72')](_0x231caf,_0x4c204c);break;case _0x91fa('0x73'):if(_0x16183e[_0x91fa('0x68')]===_0x91fa('0x74')){_0x5966e0[_0x439b4b](_0x91fa('0x75'),'%'+_0x16183e['value']+'%',null);}else{_0x2d80c0=_[_0x91fa('0x6d')](_0x8987ad,['name',_0x91fa('0x38')]);_0x16183e[_0x91fa('0x4d')]=_0x91fa('0x38');_0x1e1872=as['buildExpression'](_0x29bf0a,_0x2d80c0['type'],_0x16183e);_0x5966e0[_0x439b4b](_0x1e1872[_0x91fa('0x6f')],_0x1e1872[_0x91fa('0x6b')][_0x91fa('0x76')],_0x1e1872[_0x91fa('0x6b')][_0x91fa('0x1f')]);}break;case _0x91fa('0x77'):_0x1e1872=as[_0x91fa('0x78')]('me',null,_0x16183e);_0x5966e0[_0x439b4b](_0x1e1872[_0x91fa('0x6f')],_0x1e1872[_0x91fa('0x6b')]['start'],_0x1e1872[_0x91fa('0x6b')][_0x91fa('0x1f')]);break;}}else{var _0x1e1872=as[_0x91fa('0x78')](_0x29bf0a,_0x2d80c0[_0x91fa('0x3d')],_0x16183e);_0x5966e0[_0x439b4b](_0x1e1872[_0x91fa('0x6f')],_0x1e1872[_0x91fa('0x6b')]['start'],_0x1e1872[_0x91fa('0x6b')]['end']);}}}else{var _0x187bab=_(_0x501e3c[_0x91fa('0x43')])['keys']()[_0x91fa('0x2d')](function(_0x22d45e){return _['some'](_0x8987ad,[_0x91fa('0x2a'),_0x22d45e])?_0x22d45e:undefined;})[_0x91fa('0x79')]()['value']();if(!_[_0x91fa('0x7a')](_0x187bab)){_0x187bab['forEach'](function(_0x106fd1){if(_0x106fd1===_0x91fa('0x7b')){_0xed80bb['where'](_0x91fa('0x7c'),[][_0x91fa('0x7d')](_0x501e3c[_0x91fa('0x43')][_0x106fd1]));}else if(_0x106fd1===_0x91fa('0x7e')){var _0x557b7b=JSON[_0x91fa('0x7f')](_0x501e3c[_0x91fa('0x43')][_0x106fd1])[_0x91fa('0x80')];var _0x53b5ad=JSON[_0x91fa('0x7f')](_0x501e3c[_0x91fa('0x43')][_0x106fd1])[_0x91fa('0x81')];_0xed80bb[_0x91fa('0x4a')](_0x91fa('0x82'),_0x557b7b,_0x53b5ad);}else{if(_0x501e3c[_0x91fa('0x43')][_0x106fd1]===_0x91fa('0x83')){_0xed80bb[_0x91fa('0x4a')]('i.'+_0x106fd1+_0x91fa('0x84'));}else{_0xed80bb[_0x91fa('0x4a')]('i.'+_0x106fd1+'\x20=\x20?',_0x501e3c['query'][_0x106fd1]);}}});}if(_0x501e3c[_0x91fa('0x43')][_0x91fa('0x85')]){if(_0x501e3c[_0x91fa('0x43')][_0x91fa('0x85')]==0x1){_0xed80bb[_0x91fa('0x64')](_0x91fa('0x86'));}else{_0xed80bb[_0x91fa('0x64')](_0x91fa('0x87'));}}if(_0x501e3c[_0x91fa('0x43')][_0x91fa('0x88')]){_0x231caf=_[_0x91fa('0x89')](_0x501e3c[_0x91fa('0x43')][_0x91fa('0x88')])?_0x501e3c[_0x91fa('0x43')][_0x91fa('0x88')]:new Array(_0x501e3c[_0x91fa('0x43')]['tag']);_0x231caf[_0x91fa('0x30')](function(_0x10f683){_0x3510a9['or'](_0x91fa('0x71'),'%,'+_0x10f683+',%');});}if(_0x501e3c['query'][_0x91fa('0x8a')]){var _0xbabac3=_0x501e3c['query'][_0x91fa('0x8a')][_0x91fa('0x8b')]('\x5c','\x5c\x5c')[_0x91fa('0x8b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xbabac3)){_0x5966e0['or'](_0x91fa('0x8c'),_0xbabac3+'%')['or'](_0x91fa('0x8d'),_0xbabac3+'%');}else{_0x5966e0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x91fa('0x6a')](_0xbabac3))['or'](_0x91fa('0x8e'),_0xbabac3+'%');}}}_0xed80bb[_0x91fa('0x4a')](_0x5966e0);_0xed80bb['group']('i.id');var _0x55ad36={'type':db[_0x91fa('0x8f')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4d952f=_0xed80bb['clone']();_0x4d952f[_0x91fa('0x4d')](_0x91fa('0x90'));_0x4d952f[_0x91fa('0x4d')](_0x91fa('0x91'),_0x91fa('0x63'));if(_0x4a3c54[_0x91fa('0x92')]){_0x4a3c54[_0x91fa('0x92')][_0x91fa('0x30')](function(_0x4b3687){var _0x1edc67=_0x4b3687[0x0]===_0x91fa('0x93')?_0x4b3687[0x0]:'i.'+_0x4b3687[0x0];_0xed80bb['order'](_0x1edc67,_0x4b3687[0x1]===_0x91fa('0x94')?![]:!![]);});}if(!_[_0x91fa('0x7a')](_0x231caf)){_0xed80bb[_0x91fa('0x64')](_0x3510a9);_0x4d952f[_0x91fa('0x4a')](_0x91fa('0x95'),_0x231caf);}BPromise['resolve']()[_0x91fa('0x28')](function(){if(!_0xd5cefb){if(_0x501e3c[_0x91fa('0x43')][_0x91fa('0x7b')])return;_0x4d952f[_0x91fa('0x4a')](_0x91fa('0x96'));_0xed80bb[_0x91fa('0x4a')](_0x91fa('0x96'));return;}if(_0x501e3c['user'][_0x91fa('0x97')]!=='agent')return;return _0x501e3c[_0x91fa('0x98')][_0x91fa('0x99')]({'attributes':['id'],'raw':!![]})[_0x91fa('0x28')](function(_0xf2e265){if(_[_0x91fa('0x7a')](_0xf2e265)){_0x4d952f[_0x91fa('0x4a')](_0x91fa('0x9a'));_0xed80bb[_0x91fa('0x4a')](_0x91fa('0x9a'));}else{_0x4d952f[_0x91fa('0x4a')]('i.WhatsappAccountId\x20IN\x20?',_[_0x91fa('0x2d')](_0xf2e265,'id'));_0xed80bb['where'](_0x91fa('0x7c'),_[_0x91fa('0x2d')](_0xf2e265,'id'));}});})[_0x91fa('0x28')](function(){if(_0x501e3c[_0x91fa('0x98')][_0x91fa('0x97')]===_0x91fa('0x9b')&&!_0xd5cefb&&!_0x501e3c[_0x91fa('0x43')][_0x91fa('0x7b')])return[];return db[_0x91fa('0x9c')]['query'](_0x4d952f[_0x91fa('0x9d')](),_0x55ad36);})[_0x91fa('0x28')](function(_0x4d59bd){_0x560070[_0x91fa('0x24')]=_0x4d59bd[_0x91fa('0x46')];if(_0x560070['count']===0x0)return[];return db[_0x91fa('0x9c')][_0x91fa('0x43')](_0x3c554c[_0x91fa('0x9d')](),_0x55ad36)[_0x91fa('0x28')](function(_0x18245d){_0x50aa1b=_[_0x91fa('0x9e')](_0x18245d,'id');_0x55ad36=_[_0x91fa('0x9f')](_0x55ad36,{'model':db[_0x91fa('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x501e3c[_0x91fa('0x43')][_0x91fa('0x45')]){_0x4a3c54[_0x91fa('0x44')][_0x91fa('0x30')](function(_0x47e75f){_0xed80bb[_0x91fa('0x4d')]('i.'+_0x47e75f);});}else{_0xed80bb['field'](_0x91fa('0x91'),'unreadMessages');_0xed80bb['field']('a.key','Account.key');_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xa0'),_0x91fa('0xa1'));_0xed80bb['field'](_0x91fa('0xa2'),_0x91fa('0x93'));_0xed80bb['field'](_0x91fa('0xa3'));_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xa4'),'Contact.firstName');_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xa5'),'Contact.lastName');_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xa6'),_0x91fa('0xa7'));_0xed80bb['field'](_0x91fa('0xa8'),_0x91fa('0xa9'));_0xed80bb['field'](_0x91fa('0xaa'),'Contact.mobile');_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xab'),'Contact.fax');_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xac'),_0x91fa('0xad'));_0xed80bb[_0x91fa('0x4d')]('o.internal',_0x91fa('0xae'));_0xed80bb[_0x91fa('0x4d')](_0x91fa('0xaf'),_0x91fa('0x2e'));}if(_0x4a3c54[_0x91fa('0x23')])_0xed80bb[_0x91fa('0x23')](_0x4a3c54[_0x91fa('0x23')]);if(_0x4a3c54[_0x91fa('0x21')])_0xed80bb['offset'](_0x4a3c54[_0x91fa('0x21')]);return db[_0x91fa('0x9c')]['query'](_0xed80bb['toString'](),_0x55ad36);})[_0x91fa('0x28')](function(_0x1a5a58){if(_0x1a5a58[_0x91fa('0x46')]>0x0)_0x19b3c9['where'](_0x91fa('0xb0'),_[_0x91fa('0x2d')](_0x1a5a58,'id'));return db[_0x91fa('0x9c')][_0x91fa('0x43')](_0x19b3c9[_0x91fa('0x9d')](),_0x55ad36)[_0x91fa('0x28')](function(_0x1dd80a){var _0x11b3d2=_[_0x91fa('0xb1')](_0x1dd80a,'WhatsappInteractionId');var _0x4a90c5=[];_0x1a5a58[_0x91fa('0x30')](function(_0x9413fc){_0x4a90c5[_0x91fa('0x32')](updateWhatsappInteraction(_0x9413fc,_0x50aa1b,_0x11b3d2));});return BPromise[_0x91fa('0xb2')](_0x4a90c5);});});})[_0x91fa('0x28')](function(_0x27d859){_0x560070[_0x91fa('0xb3')]=_0x27d859;return _0x560070;})[_0x91fa('0x28')](respondWithFilteredResult(_0x3c2482,_0x4a3c54))[_0x91fa('0xb4')](handleError(_0x3c2482,null));};exports[_0x91fa('0xb5')]=function(_0x144b99,_0x2995a2){var _0x35c1ef={'raw':![],'where':{'id':_0x144b99[_0x91fa('0xb6')]['id']}},_0x1b545d={};_0x1b545d[_0x91fa('0x3f')]=_[_0x91fa('0x40')](db[_0x91fa('0x3a')]['rawAttributes']);_0x1b545d[_0x91fa('0x43')]=_[_0x91fa('0x40')](_0x144b99['query']);_0x1b545d['filters']=_[_0x91fa('0x42')](_0x1b545d[_0x91fa('0x3f')],_0x1b545d['query']);_0x35c1ef['attributes']=_[_0x91fa('0x42')](_0x1b545d['model'],qs[_0x91fa('0x45')](_0x144b99['query'][_0x91fa('0x45')]));_0x35c1ef['attributes']=_0x35c1ef[_0x91fa('0x44')][_0x91fa('0x46')]?_0x35c1ef['attributes']:_0x1b545d[_0x91fa('0x3f')];if(_0x144b99[_0x91fa('0x43')][_0x91fa('0xb7')]){_0x35c1ef[_0x91fa('0xb8')]=[{'all':!![]}];}_0x35c1ef=_[_0x91fa('0x9f')]({},_0x35c1ef,_0x144b99[_0x91fa('0xb9')]);return db['WhatsappInteraction'][_0x91fa('0x6d')](_0x35c1ef)[_0x91fa('0x28')](handleEntityNotFound(_0x2995a2,null))[_0x91fa('0x28')](respondWithResult(_0x2995a2,null))[_0x91fa('0xb4')](handleError(_0x2995a2,null));};exports['create']=function(_0x18127d,_0x4229be){return db[_0x91fa('0x3a')][_0x91fa('0xba')](_0x18127d[_0x91fa('0x77')],{})['then'](respondWithResult(_0x4229be,0xc9))[_0x91fa('0xb4')](handleError(_0x4229be,null));};exports[_0x91fa('0xbb')]=function(_0x515a1c,_0x35b675){if(_0x515a1c['body']['id']){delete _0x515a1c[_0x91fa('0x77')]['id'];}return db['WhatsappInteraction'][_0x91fa('0x6d')]({'where':{'id':_0x515a1c[_0x91fa('0xb6')]['id']}})[_0x91fa('0x28')](handleEntityNotFound(_0x35b675,null))['then'](saveUpdates(_0x515a1c[_0x91fa('0x77')],null))[_0x91fa('0x28')](respondWithResult(_0x35b675,null))[_0x91fa('0xb4')](handleError(_0x35b675,null));};exports[_0x91fa('0xbc')]=function(_0xedf3d1,_0x186dd1){return db[_0x91fa('0x3a')][_0x91fa('0x6d')]({'where':{'id':_0xedf3d1[_0x91fa('0xb6')]['id']}})[_0x91fa('0x28')](handleEntityNotFound(_0x186dd1,null))['then'](removeEntity(_0x186dd1,null))[_0x91fa('0xb4')](handleError(_0x186dd1,null));};exports['describe']=function(_0x4294d4,_0x5b3a93){return db[_0x91fa('0x3a')][_0x91fa('0xbd')]()[_0x91fa('0x28')](respondWithResult(_0x5b3a93,null))['catch'](handleError(_0x5b3a93,null));};exports[_0x91fa('0xbe')]=function(_0x28ad7b,_0x7d2976,_0x572cab){return db[_0x91fa('0xbf')][_0x91fa('0x6d')]({'where':{'id':_0x28ad7b[_0x91fa('0xb6')]['id']}})[_0x91fa('0x28')](handleEntityNotFound(_0x7d2976,null))[_0x91fa('0x28')](function(_0x4bbf05){if(_0x4bbf05){return _0x4bbf05[_0x91fa('0xbe')](_0x28ad7b[_0x91fa('0x77')][_0x91fa('0xc0')],_['omit'](_0x28ad7b[_0x91fa('0x77')],[_0x91fa('0xc0'),'id'])||{});}})[_0x91fa('0x28')](respondWithResult(_0x7d2976,null))[_0x91fa('0xb4')](handleError(_0x7d2976,null));};exports[_0x91fa('0xc1')]=function(_0x5343b0,_0x489746,_0x399e1a){var _0x1cf8a4={'raw':![],'where':{}};var _0x110e05={};var _0x662170={'count':0x0,'rows':[]};return db[_0x91fa('0x3a')][_0x91fa('0xc2')]({'where':{'id':_0x5343b0[_0x91fa('0xb6')]['id']}})[_0x91fa('0x28')](handleEntityNotFound(_0x489746,null))['then'](function(_0x447832){if(_0x447832){_0x110e05[_0x91fa('0x3f')]=_[_0x91fa('0x40')](db[_0x91fa('0xbf')][_0x91fa('0x3b')]);_0x110e05[_0x91fa('0x43')]=_['keys'](_0x5343b0['query']);_0x110e05[_0x91fa('0x41')]=_['intersection'](_0x110e05[_0x91fa('0x3f')],_0x110e05[_0x91fa('0x43')]);_0x1cf8a4[_0x91fa('0x44')]=_[_0x91fa('0x42')](_0x110e05[_0x91fa('0x3f')],qs[_0x91fa('0x45')](_0x5343b0['query']['fields']));_0x1cf8a4[_0x91fa('0x44')]=_0x1cf8a4[_0x91fa('0x44')][_0x91fa('0x46')]?_0x1cf8a4['attributes']:_0x110e05[_0x91fa('0x3f')];if(!_0x5343b0[_0x91fa('0x43')][_0x91fa('0x47')](_0x91fa('0x48'))){_0x1cf8a4[_0x91fa('0x23')]=qs[_0x91fa('0x23')](_0x5343b0[_0x91fa('0x43')][_0x91fa('0x23')]);_0x1cf8a4['offset']=qs[_0x91fa('0x21')](_0x5343b0[_0x91fa('0x43')][_0x91fa('0x21')]);}_0x1cf8a4[_0x91fa('0x92')]=qs['sort'](_0x5343b0[_0x91fa('0x43')][_0x91fa('0x49')]);_0x1cf8a4['where']=qs[_0x91fa('0x41')](_[_0x91fa('0x4b')](_0x5343b0['query'],_0x110e05[_0x91fa('0x41')]));_0x1cf8a4[_0x91fa('0x4a')][_0x91fa('0xc3')]=_0x447832['id'];if(_0x5343b0[_0x91fa('0x43')][_0x91fa('0x8a')]){_0x1cf8a4[_0x91fa('0x4a')]=_['merge'](_0x1cf8a4[_0x91fa('0x4a')],{'$or':_['map'](_0x1cf8a4[_0x91fa('0x44')],function(_0x1dcbc0){var _0x200ac8={};_0x200ac8[_0x1dcbc0]={'$like':'%'+_0x5343b0[_0x91fa('0x43')][_0x91fa('0x8a')]+'%'};return _0x200ac8;})});}if(_0x5343b0[_0x91fa('0x43')][_0x91fa('0x80')]){var _0x59b170=_0x5343b0[_0x91fa('0x43')][_0x91fa('0x80')][_0x91fa('0x2f')](',');var _0x22f805={};_0x22f805[_0x59b170[0x0]]={'$gte':moment(_0x59b170[0x1])[_0x91fa('0xc4')](_0x91fa('0xc5'))};_0x1cf8a4['where']=_[_0x91fa('0x9f')](_0x1cf8a4['where'],_0x22f805);}_0x1cf8a4=_[_0x91fa('0x9f')]({},_0x1cf8a4,_0x5343b0[_0x91fa('0xb9')]);return db[_0x91fa('0xbf')][_0x91fa('0x24')]({'where':_0x1cf8a4[_0x91fa('0x4a')]})['then'](function(_0x44d154){_0x662170[_0x91fa('0x24')]=_0x44d154;if(_0x5343b0[_0x91fa('0x43')][_0x91fa('0xb7')]){_0x1cf8a4[_0x91fa('0xb8')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x91fa('0xc6')](_0x1cf8a4);})[_0x91fa('0x28')](function(_0x3da12c){_0x662170['rows']=_0x3da12c;return _0x662170;});}})[_0x91fa('0x28')](respondWithFilteredResult(_0x489746,_0x1cf8a4))[_0x91fa('0xb4')](handleError(_0x489746,null));};exports[_0x91fa('0xc7')]=function(_0x1947f3,_0x3c9b4a,_0x34d31e){return db['WhatsappInteraction'][_0x91fa('0x6d')]({'where':{'id':_0x1947f3[_0x91fa('0xb6')]['id']}})[_0x91fa('0x28')](handleEntityNotFound(_0x3c9b4a,null))[_0x91fa('0x28')](function(_0x342283){if(_0x342283){return _0x342283['setTags'](_0x1947f3[_0x91fa('0x77')]['ids'],_[_0x91fa('0xc8')](_0x1947f3[_0x91fa('0x77')],[_0x91fa('0xc0'),'id'])||{})['spread'](function(){return db[_0x91fa('0x70')][_0x91fa('0xc6')]({'attributes':['id',_0x91fa('0x2a'),_0x91fa('0x4e')],'where':{'id':_0x1947f3[_0x91fa('0x77')][_0x91fa('0xc0')]}});})[_0x91fa('0x28')](function(_0x58fbf4){socket[_0x91fa('0xc9')](_0x91fa('0xca'),{'id':Number(_0x1947f3[_0x91fa('0xb6')]['id']),'tags':_0x58fbf4||[]});return{'id':Number(_0x1947f3[_0x91fa('0xb6')]['id']),'tags':_0x58fbf4||[]};});}})['then'](respondWithResult(_0x3c9b4a,null))[_0x91fa('0xb4')](handleError(_0x3c9b4a,null));};exports[_0x91fa('0xcb')]=function(_0x337be3,_0x42ab49,_0xbc4b65){return db['WhatsappInteraction'][_0x91fa('0x6d')]({'where':{'id':_0x337be3['params']['id']}})['then'](handleEntityNotFound(_0x42ab49,null))[_0x91fa('0x28')](function(_0x3f573d){if(_0x3f573d){return _0x3f573d[_0x91fa('0xcb')](_0x337be3[_0x91fa('0x43')][_0x91fa('0xc0')]);}})[_0x91fa('0x28')](respondWithStatusCode(_0x42ab49,null))[_0x91fa('0xb4')](handleError(_0x42ab49,null));};exports[_0x91fa('0xcc')]=function(_0x363b5e,_0x31834c){var _0x3b783f=moment()['unix']()[_0x91fa('0x9d')]();var _0x245596=path['join'](config[_0x91fa('0xcd')],_0x91fa('0xce'),'files',_0x91fa('0xcf'));var _0x532545=path[_0x91fa('0xd0')](config[_0x91fa('0xcd')],_0x91fa('0xce'),_0x91fa('0xd1'),_0x91fa('0xd2'));var _0x26efb1=path['join'](_0x245596,_0x3b783f);var _0x31849c=util[_0x91fa('0xc4')](_0x91fa('0xd3'),_0x363b5e[_0x91fa('0xb6')]['id'],_0x3b783f);var _0x4c9e3d=path[_0x91fa('0xd0')](_0x245596,_0x31849c);var _0x221495=[];_0x221495[_0x91fa('0x32')]({'model':db[_0x91fa('0x73')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x221495[_0x91fa('0x32')]({'model':db[_0x91fa('0xd4')],'as':_0x91fa('0x67'),'attributes':['id',_0x91fa('0xd5'),_0x91fa('0xd6')],'raw':!![]});if(_0x363b5e[_0x91fa('0x43')][_0x91fa('0xd2')]){_0x221495[_0x91fa('0x32')]({'model':db[_0x91fa('0xd7')],'as':_0x91fa('0xd7'),'raw':!![]});}var _0x48caf9=[{'model':db[_0x91fa('0xbf')],'as':_0x91fa('0xd8'),'attributes':['id','body','createdAt','direction',_0x91fa('0xd9'),'read'],'include':_0x221495}];_0x48caf9['push']({'model':db[_0x91fa('0xda')],'as':_0x91fa('0xdb'),'attributes':['id','name']});_0x48caf9[_0x91fa('0x32')]({'model':db[_0x91fa('0x73')],'as':_0x91fa('0xdc'),'attributes':['id',_0x91fa('0xdd')]});return db[_0x91fa('0x3a')][_0x91fa('0x6d')]({'where':{'id':_0x363b5e[_0x91fa('0xb6')]['id']},'include':_0x48caf9})[_0x91fa('0x28')](handleEntityNotFound(_0x31834c,null))['then'](function(_0x5e7b5f){if(_0x5e7b5f){var _0x610b31=_0x5e7b5f[_0x91fa('0xde')]({'plain':!![]});fs['mkdirSync'](_0x26efb1);var _0x52b2a2={'channel':_0x91fa('0xdf'),'account':_0x610b31[_0x91fa('0xdb')][_0x91fa('0x2a')],'agent':_0x610b31[_0x91fa('0xdc')]?_0x610b31[_0x91fa('0xdc')]['fullname']:_0x91fa('0xe0'),'createdAt':moment(_0x610b31[_0x91fa('0x7e')])[_0x91fa('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x91fa('0x9d')](),'closedAt':_0x610b31['closed']?moment(_0x610b31[_0x91fa('0xe1')])[_0x91fa('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x91fa('0x9d')]():'','disposition':_0x610b31[_0x91fa('0xe2')],'messages':_(_0x610b31[_0x91fa('0xd8')])[_0x91fa('0x8a')]({'secret':![]})[_0x91fa('0x2d')](function(_0x52051a){if(_0x52051a[_0x91fa('0xd7')]){var _0x431639=path['join'](_0x532545,_0x52051a[_0x91fa('0xd7')][_0x91fa('0xe3')]);if(fs[_0x91fa('0xe4')](_0x431639)){fs[_0x91fa('0xe5')](_0x431639)[_0x91fa('0xe6')](fs[_0x91fa('0xe7')](path[_0x91fa('0xd0')](_0x26efb1,_0x52051a['Attachment'][_0x91fa('0xe3')])));}}return{'date':moment(_0x52051a[_0x91fa('0x7e')])[_0x91fa('0xc4')](_0x91fa('0xc5'))['toString'](),'sender':_0x52051a['direction']==='out'?_0x52051a[_0x91fa('0x73')]?_0x52051a[_0x91fa('0x73')]['fullname']:'System':_0x52051a['Contact'][_0x91fa('0xd5')]+(_0x52051a[_0x91fa('0x67')][_0x91fa('0xd6')]?'\x20'+_0x52051a[_0x91fa('0x67')][_0x91fa('0xd6')]:''),'body':_0x52051a[_0x91fa('0xd7')]?_0x52051a['Attachment']['basename']:_0x52051a[_0x91fa('0x77')],'direction':_0x52051a[_0x91fa('0xe8')]===_0x91fa('0xe9')?'A':'C','secret':_0x52051a[_0x91fa('0xd9')],'read':_0x52051a[_0x91fa('0x85')],'attachment':_0x52051a[_0x91fa('0xd7')]};})[_0x91fa('0x6b')]()};return ejs[_0x91fa('0xea')](path[_0x91fa('0xd0')](config[_0x91fa('0xcd')],'server','views',_0x91fa('0xeb')),{'interaction':_0x52b2a2})[_0x91fa('0x28')](function(_0x317f74){var _0x1207cb=path[_0x91fa('0xd0')](_0x26efb1,'transcript-'+_0x610b31['id']+'-'+_0x3b783f+_0x91fa('0xec'));var _0x44d686={'path':_0x1207cb,'channel':_0x91fa('0xdf'),'interactionId':_0x610b31['id']};return pdf[_0x91fa('0xed')](_0x317f74,_0x44d686);})[_0x91fa('0x28')](function(){return new BPromise(function(_0x458a5c,_0x3d400f){zipdir(_0x26efb1,{'saveTo':_0x4c9e3d},function(_0x515f54,_0x2e7ef1){if(_0x515f54)return _0x3d400f(_0x515f54);return _0x458a5c(_0x2e7ef1);});})[_0x91fa('0x28')](function(){return new BPromise(function(_0x2a78fc,_0x75e43b){rimraf(_0x26efb1,function(_0x184113){if(_0x184113)_0x75e43b(_0x184113);return _0x2a78fc();});});})[_0x91fa('0x28')](function(){return _0x31834c[_0x91fa('0xcc')](_0x4c9e3d,_0x31849c,function(_0x4af27f){if(_0x4af27f){console[_0x91fa('0xee')](_0x91fa('0xef'),_0x4af27f);}else{fs['unlinkSync'](_0x4c9e3d);}});});});}else{return _0x31834c[_0x91fa('0x1d')](0xc8);}})['catch'](handleError(_0x31834c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 81d2ca4..f9bb9f2 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 _0x1782=['save','remove','getUsers','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x1b7759,_0x2595e0){var _0x25e744=function(_0x570927){while(--_0x570927){_0x1b7759['push'](_0x1b7759['shift']());}};_0x25e744(++_0x2595e0);}(_0x1782,0x13e));var _0x2178=function(_0x2513c0,_0x2cfb0a){_0x2513c0=_0x2513c0-0x0;var _0x5570f7=_0x1782[_0x2513c0];return _0x5570f7;};'use strict';var EventEmitter=require(_0x2178('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x2178('0x1')];var WhatsappMessage=require(_0x2178('0x2'))['db'][_0x2178('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2178('0x4')](0x0);var events={'afterCreate':_0x2178('0x5'),'afterUpdate':'update','afterDestroy':_0x2178('0x6')};function emitEvent(_0x1659a1){return function(_0x5f44d6,_0x59ebf6,_0x3c4dd1){_0x5f44d6[_0x2178('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53b9f9){_0x5f44d6['setDataValue'](_0x2178('0x8'),_0x53b9f9[_0x2178('0x9')](function(_0xdd790e){return{'id':_0xdd790e['id']};}));return WhatsappMessage[_0x2178('0xa')]({'where':{'WhatsappInteractionId':_0x5f44d6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2178('0xb')](function(_0x5ac52e){_0x5f44d6['setDataValue'](_0x2178('0xc'),_0x5ac52e[_0x2178('0xd')]);WhatsappInteractionEvents[_0x2178('0xe')](_0x1659a1+':'+_0x5f44d6['id'],_0x5f44d6);WhatsappInteractionEvents[_0x2178('0xe')](_0x1659a1,_0x5f44d6);_0x3c4dd1(null);})[_0x2178('0xf')](_0x3c4dd1(null));};}for(var e in events){if(events[_0x2178('0x10')](e)){var event=events[e];WhatsappInteraction[_0x2178('0x11')](e,emitEvent(event));}}module[_0x2178('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3d7f=['setMaxListeners','save','update','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events','WhatsappInteraction','WhatsappMessage'];(function(_0x1123bb,_0x54472a){var _0xdeb602=function(_0x529467){while(--_0x529467){_0x1123bb['push'](_0x1123bb['shift']());}};_0xdeb602(++_0x54472a);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x3d7f[_0x5c3c0b];return _0x52ecd2;};'use strict';var EventEmitter=require(_0xf3d7('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf3d7('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xf3d7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf3d7('0x3')](0x0);var events={'afterCreate':_0xf3d7('0x4'),'afterUpdate':_0xf3d7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x574073){return function(_0x433483,_0x20fb37,_0x5b667c){_0x433483['getUsers']({'attributes':['id'],'raw':!![]})[_0xf3d7('0x6')](function(_0x17d875){_0x433483[_0xf3d7('0x7')]('Users',_0x17d875[_0xf3d7('0x8')](function(_0x2d2bcd){return{'id':_0x2d2bcd['id']};}));return WhatsappMessage[_0xf3d7('0x9')]({'where':{'WhatsappInteractionId':_0x433483['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf3d7('0x6')](function(_0x167637){_0x433483[_0xf3d7('0x7')](_0xf3d7('0xa'),_0x167637[_0xf3d7('0xb')]);WhatsappInteractionEvents[_0xf3d7('0xc')](_0x574073+':'+_0x433483['id'],_0x433483);WhatsappInteractionEvents[_0xf3d7('0xc')](_0x574073,_0x433483);_0x5b667c(null);})[_0xf3d7('0xd')](_0x5b667c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf3d7('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0524dda..4e92574 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 _0x1ab3=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','bluebird','request-promise','rimraf','exports','WhatsappInteraction','whatsapp_interactions'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x1ab3,0x8e));var _0x31ab=function(_0x3f1a98,_0x279f07){_0x3f1a98=_0x3f1a98-0x0;var _0x544d31=_0x1ab3[_0x3f1a98];return _0x544d31;};'use strict';var _=require(_0x31ab('0x0'));var util=require(_0x31ab('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x31ab('0x2'));var rp=require(_0x31ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31ab('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x31ab('0x5')]=function(_0x24a700,_0x3a1926){return _0x24a700['define'](_0x31ab('0x6'),attributes,{'tableName':_0x31ab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e433a,_0x2f470f,_0x35914d){if(_0x3e433a['changed']('closed')){_0x3e433a[_0x31ab('0x8')]=moment()['format'](_0x31ab('0x9'));}_0x35914d(null,_0x3e433a);}}});}; \ No newline at end of file +var _0xd3d4=['moment','request-promise','path','rimraf','../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x12d3c4,_0x54f685){var _0x30d6d5=function(_0x5af7d4){while(--_0x5af7d4){_0x12d3c4['push'](_0x12d3c4['shift']());}};_0x30d6d5(++_0x54f685);}(_0xd3d4,0x1bc));var _0x4d3d=function(_0x37b35d,_0x32f217){_0x37b35d=_0x37b35d-0x0;var _0x13e692=_0xd3d4[_0x37b35d];return _0x13e692;};'use strict';var _=require(_0x4d3d('0x0'));var util=require(_0x4d3d('0x1'));var logger=require(_0x4d3d('0x2'))(_0x4d3d('0x3'));var moment=require(_0x4d3d('0x4'));var BPromise=require('bluebird');var rp=require(_0x4d3d('0x5'));var fs=require('fs');var path=require(_0x4d3d('0x6'));var rimraf=require(_0x4d3d('0x7'));var config=require(_0x4d3d('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0x4d3d('0x9')]=function(_0x23e00a,_0x1bea75){return _0x23e00a['define'](_0x4d3d('0xa'),attributes,{'tableName':_0x4d3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x315bfa,_0x5014bf,_0x526ff3){if(_0x315bfa[_0x4d3d('0xc')](_0x4d3d('0xd'))){_0x315bfa['closedAt']=moment()[_0x4d3d('0xe')](_0x4d3d('0xf'));}_0x526ff3(null,_0x315bfa);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 461599d..4c89a79 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 _0x7e2a=['request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','debug','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket'];(function(_0xed2793,_0x2cad50){var _0x19151f=function(_0x14e089){while(--_0x14e089){_0xed2793['push'](_0xed2793['shift']());}};_0x19151f(++_0x2cad50);}(_0x7e2a,0x160));var _0xa7e2=function(_0x4d9787,_0x96d522){_0x4d9787=_0x4d9787-0x0;var _0x3b96ef=_0x7e2a[_0x4d9787];return _0x3b96ef;};'use strict';var _=require('lodash');var util=require(_0xa7e2('0x0'));var moment=require(_0xa7e2('0x1'));var BPromise=require(_0xa7e2('0x2'));var rs=require(_0xa7e2('0x3'));var fs=require('fs');var Redis=require(_0xa7e2('0x4'));var db=require(_0xa7e2('0x5'))['db'];var utils=require(_0xa7e2('0x6'));var logger=require(_0xa7e2('0x7'))(_0xa7e2('0x8'));var config=require('../../config/environment');var jayson=require(_0xa7e2('0x9'));var client=jayson[_0xa7e2('0xa')][_0xa7e2('0xb')]({'port':0x232a});config['redis']=_[_0xa7e2('0xc')](config[_0xa7e2('0xd')],{'host':_0xa7e2('0xe'),'port':0x18eb});var socket=require(_0xa7e2('0xf'))(new Redis(config[_0xa7e2('0xd')]));require(_0xa7e2('0x10'))['register'](socket);function respondWithRpcPromise(_0x3b6631,_0x318c08,_0x4e8433){return new BPromise(function(_0x50472d,_0x137846){return client[_0xa7e2('0x11')](_0x3b6631,_0x4e8433)[_0xa7e2('0x12')](function(_0xfa992b){logger[_0xa7e2('0x13')](_0xa7e2('0x14'),_0x318c08,_0xa7e2('0x15'));logger['debug'](_0xa7e2('0x16'),_0x318c08,_0xa7e2('0x15'),JSON[_0xa7e2('0x17')](_0xfa992b));if(_0xfa992b[_0xa7e2('0x18')]){if(_0xfa992b['error']['code']===0x1f4){logger[_0xa7e2('0x18')](_0xa7e2('0x14'),_0x318c08,_0xfa992b[_0xa7e2('0x18')][_0xa7e2('0x19')]);return _0x137846(_0xfa992b[_0xa7e2('0x18')][_0xa7e2('0x19')]);}logger[_0xa7e2('0x18')](_0xa7e2('0x14'),_0x318c08,_0xfa992b[_0xa7e2('0x18')][_0xa7e2('0x19')]);return _0x50472d(_0xfa992b['error'][_0xa7e2('0x19')]);}else{logger[_0xa7e2('0x13')](_0xa7e2('0x14'),_0x318c08,_0xa7e2('0x15'));_0x50472d(_0xfa992b[_0xa7e2('0x1a')][_0xa7e2('0x19')]);}})[_0xa7e2('0x1b')](function(_0x1131f3){logger['error'](_0xa7e2('0x14'),_0x318c08,_0x1131f3);_0x137846(_0x1131f3);});});}exports[_0xa7e2('0x1c')]=function(_0x449010){var _0x165139=this;return new Promise(function(_0x19e520,_0x32d7df){return db[_0xa7e2('0x1d')][_0xa7e2('0x1e')](_0x449010[_0xa7e2('0x1f')],{'raw':_0x449010[_0xa7e2('0x20')]?_0x449010['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x449010[_0xa7e2('0x20')]?_0x449010[_0xa7e2('0x20')][_0xa7e2('0x21')]||null:null,'attributes':_0x449010['options']?_0x449010[_0xa7e2('0x20')][_0xa7e2('0x22')]||null:null,'limit':_0x449010[_0xa7e2('0x20')]?_0x449010[_0xa7e2('0x20')]['limit']||null:null})[_0xa7e2('0x12')](function(_0xb500cf){logger[_0xa7e2('0x13')]('UpdateWhatsappInteraction',_0x449010);logger[_0xa7e2('0x23')](_0xa7e2('0x1c'),_0x449010,JSON[_0xa7e2('0x17')](_0xb500cf));_0x19e520(_0xb500cf);})[_0xa7e2('0x1b')](function(_0x3e21a2){logger[_0xa7e2('0x18')](_0xa7e2('0x1c'),_0x3e21a2['message'],_0x449010);_0x32d7df(_0x165139[_0xa7e2('0x18')](0x1f4,_0x3e21a2[_0xa7e2('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x48a7f6){return new Promise(function(_0x2b75df,_0x4c00f0){return db[_0xa7e2('0x1d')]['find']({'where':_0x48a7f6[_0xa7e2('0x20')]?_0x48a7f6[_0xa7e2('0x20')]['where']||null:null})['then'](function(_0x92581){if(_0x92581){return _0x92581[_0xa7e2('0x24')](_0x48a7f6[_0xa7e2('0x1f')]['ids'],_[_0xa7e2('0x25')](_0x48a7f6['body'],[_0xa7e2('0x26'),'id'])||{});}})[_0xa7e2('0x27')](function(_0x5bbc62){logger[_0xa7e2('0x13')](_0xa7e2('0x28'),_0x48a7f6);logger['debug'](_0xa7e2('0x28'),_0x48a7f6,JSON[_0xa7e2('0x17')](_0x5bbc62));_0x2b75df(_0x5bbc62);})[_0xa7e2('0x1b')](function(_0x20be71){logger['error'](_0xa7e2('0x28'),_0x20be71['message'],_0x48a7f6);_0x4c00f0(_this[_0xa7e2('0x18')](0x1f4,_0x20be71[_0xa7e2('0x19')]));});});}; \ No newline at end of file +var _0x28b6=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','WhatsappInteraction,\x20%s,\x20%s'];(function(_0xdb47d8,_0x933e5b){var _0x5cdfd9=function(_0x3b69a8){while(--_0x3b69a8){_0xdb47d8['push'](_0xdb47d8['shift']());}};_0x5cdfd9(++_0x933e5b);}(_0x28b6,0x9c));var _0x628b=function(_0x472f04,_0x32571d){_0x472f04=_0x472f04-0x0;var _0x288a12=_0x28b6[_0x472f04];return _0x288a12;};'use strict';var _=require(_0x628b('0x0'));var util=require(_0x628b('0x1'));var moment=require(_0x628b('0x2'));var BPromise=require(_0x628b('0x3'));var rs=require(_0x628b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x628b('0x5'))['db'];var utils=require(_0x628b('0x6'));var logger=require(_0x628b('0x7'))('rpc');var config=require(_0x628b('0x8'));var jayson=require(_0x628b('0x9'));var client=jayson[_0x628b('0xa')][_0x628b('0xb')]({'port':0x232a});config['redis']=_[_0x628b('0xc')](config[_0x628b('0xd')],{'host':_0x628b('0xe'),'port':0x18eb});var socket=require(_0x628b('0xf'))(new Redis(config[_0x628b('0xd')]));require(_0x628b('0x10'))['register'](socket);function respondWithRpcPromise(_0x3141d9,_0x197305,_0x4ba43c){return new BPromise(function(_0x74afed,_0x761d20){return client[_0x628b('0x11')](_0x3141d9,_0x4ba43c)[_0x628b('0x12')](function(_0x1fcf2e){logger['info'](_0x628b('0x13'),_0x197305,'request\x20sent');logger[_0x628b('0x14')](_0x628b('0x15'),_0x197305,_0x628b('0x16'),JSON[_0x628b('0x17')](_0x1fcf2e));if(_0x1fcf2e[_0x628b('0x18')]){if(_0x1fcf2e[_0x628b('0x18')][_0x628b('0x19')]===0x1f4){logger[_0x628b('0x18')](_0x628b('0x13'),_0x197305,_0x1fcf2e[_0x628b('0x18')][_0x628b('0x1a')]);return _0x761d20(_0x1fcf2e[_0x628b('0x18')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x197305,_0x1fcf2e[_0x628b('0x18')][_0x628b('0x1a')]);return _0x74afed(_0x1fcf2e['error'][_0x628b('0x1a')]);}else{logger[_0x628b('0x1b')](_0x628b('0x13'),_0x197305,_0x628b('0x16'));_0x74afed(_0x1fcf2e[_0x628b('0x1c')][_0x628b('0x1a')]);}})[_0x628b('0x1d')](function(_0x459f1e){logger[_0x628b('0x18')](_0x628b('0x13'),_0x197305,_0x459f1e);_0x761d20(_0x459f1e);});});}exports[_0x628b('0x1e')]=function(_0x372b59){var _0x12668f=this;return new Promise(function(_0x56272a,_0x368c34){return db[_0x628b('0x1f')]['update'](_0x372b59[_0x628b('0x20')],{'raw':_0x372b59[_0x628b('0x21')]?_0x372b59[_0x628b('0x21')][_0x628b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x372b59[_0x628b('0x21')]?_0x372b59[_0x628b('0x21')][_0x628b('0x23')]||null:null,'attributes':_0x372b59['options']?_0x372b59[_0x628b('0x21')][_0x628b('0x24')]||null:null,'limit':_0x372b59[_0x628b('0x21')]?_0x372b59[_0x628b('0x21')][_0x628b('0x25')]||null:null})[_0x628b('0x12')](function(_0xbddf90){logger[_0x628b('0x1b')]('UpdateWhatsappInteraction',_0x372b59);logger[_0x628b('0x14')](_0x628b('0x1e'),_0x372b59,JSON[_0x628b('0x17')](_0xbddf90));_0x56272a(_0xbddf90);})['catch'](function(_0x2b89e0){logger[_0x628b('0x18')](_0x628b('0x1e'),_0x2b89e0[_0x628b('0x1a')],_0x372b59);_0x368c34(_0x12668f[_0x628b('0x18')](0x1f4,_0x2b89e0['message']));});});};exports[_0x628b('0x26')]=function(_0x1fc57f){return new Promise(function(_0x25530d,_0x41b0e){return db[_0x628b('0x1f')][_0x628b('0x27')]({'where':_0x1fc57f['options']?_0x1fc57f[_0x628b('0x21')][_0x628b('0x23')]||null:null})[_0x628b('0x12')](function(_0x5cfecf){if(_0x5cfecf){return _0x5cfecf['addTags'](_0x1fc57f[_0x628b('0x20')][_0x628b('0x28')],_[_0x628b('0x29')](_0x1fc57f[_0x628b('0x20')],[_0x628b('0x28'),'id'])||{});}})[_0x628b('0x2a')](function(_0x16286d){logger[_0x628b('0x1b')]('AddTags',_0x1fc57f);logger[_0x628b('0x14')](_0x628b('0x2b'),_0x1fc57f,JSON[_0x628b('0x17')](_0x16286d));_0x25530d(_0x16286d);})[_0x628b('0x1d')](function(_0x1f7963){logger[_0x628b('0x18')](_0x628b('0x2b'),_0x1f7963[_0x628b('0x1a')],_0x1fc57f);_0x41b0e(_this['error'](0x1f4,_0x1f7963[_0x628b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 042471b..d467d06 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 _0x1e99=['remove','update','emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x1e99,0x16b));var _0x91e9=function(_0x5b9dcc,_0x47f5e0){_0x5b9dcc=_0x5b9dcc-0x0;var _0x30dc49=_0x1e99[_0x5b9dcc];return _0x30dc49;};'use strict';var WhatsappInteractionEvents=require(_0x91e9('0x0'));var events=['save',_0x91e9('0x1'),_0x91e9('0x2')];function createListener(_0xbbfc29,_0x38252a){return function(_0x50270c){_0x38252a[_0x91e9('0x3')](_0xbbfc29,_0x50270c);};}function removeListener(_0x1a9bc4,_0x5ef602){return function(){WhatsappInteractionEvents[_0x91e9('0x4')](_0x1a9bc4,_0x5ef602);};}exports['register']=function(_0x35635d){for(var _0x33f200=0x0,_0xf64939=events[_0x91e9('0x5')];_0x33f200<_0xf64939;_0x33f200++){var _0x1957cc=events[_0x33f200];var _0x1a3d40=createListener(_0x91e9('0x6')+_0x1957cc,_0x35635d);WhatsappInteractionEvents['on'](_0x1957cc,_0x1a3d40);}}; \ No newline at end of file +var _0x6543=['./whatsappInteraction.events','remove','update','removeListener','register','length','whatsappInteraction:'];(function(_0x5c5cca,_0x9c505a){var _0x2d5670=function(_0x53d459){while(--_0x53d459){_0x5c5cca['push'](_0x5c5cca['shift']());}};_0x2d5670(++_0x9c505a);}(_0x6543,0x1c0));var _0x3654=function(_0x4160f9,_0x1440fa){_0x4160f9=_0x4160f9-0x0;var _0x3dd7a0=_0x6543[_0x4160f9];return _0x3dd7a0;};'use strict';var WhatsappInteractionEvents=require(_0x3654('0x0'));var events=['save',_0x3654('0x1'),_0x3654('0x2')];function createListener(_0x36d24d,_0x1501cc){return function(_0x452ac2){_0x1501cc['emit'](_0x36d24d,_0x452ac2);};}function removeListener(_0x3b1386,_0x1825cf){return function(){WhatsappInteractionEvents[_0x3654('0x3')](_0x3b1386,_0x1825cf);};}exports[_0x3654('0x4')]=function(_0x4df2b7){for(var _0x358e8a=0x0,_0x2774cd=events[_0x3654('0x5')];_0x358e8a<_0x2774cd;_0x358e8a++){var _0x4e44a0=events[_0x358e8a];var _0x4e80fe=createListener(_0x3654('0x6')+_0x4e44a0,_0x4df2b7);WhatsappInteractionEvents['on'](_0x4e44a0,_0x4e80fe);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8d6352d..87a9144 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 _0x0a75=['isAuthenticated','/:id','show','post','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe'];(function(_0x41af4f,_0x3d1f88){var _0x1922bc=function(_0x5ed28d){while(--_0x5ed28d){_0x41af4f['push'](_0x41af4f['shift']());}};_0x1922bc(++_0x3d1f88);}(_0x0a75,0x16c));var _0x50a7=function(_0x5784fb,_0xea597){_0x5784fb=_0x5784fb-0x0;var _0x9c0938=_0x0a75[_0x5784fb];return _0x9c0938;};'use strict';var multer=require(_0x50a7('0x0'));var util=require(_0x50a7('0x1'));var path=require(_0x50a7('0x2'));var timeout=require(_0x50a7('0x3'));var express=require(_0x50a7('0x4'));var router=express[_0x50a7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x50a7('0x6'));var interaction=require(_0x50a7('0x7'));var config=require(_0x50a7('0x8'));var controller=require(_0x50a7('0x9'));router[_0x50a7('0xa')]('/',auth['isAuthenticated'](),controller[_0x50a7('0xb')]);router['get'](_0x50a7('0xc'),auth[_0x50a7('0xd')](),controller['describe']);router[_0x50a7('0xa')](_0x50a7('0xe'),auth[_0x50a7('0xd')](),controller[_0x50a7('0xf')]);router[_0x50a7('0x10')]('/',auth[_0x50a7('0xd')](),interaction['tracked'](_0x50a7('0x11'),_0x50a7('0x12')),controller[_0x50a7('0x13')]);router[_0x50a7('0x10')]('/:id/status',controller[_0x50a7('0x14')]);router[_0x50a7('0x15')](_0x50a7('0xe'),auth[_0x50a7('0xd')](),controller[_0x50a7('0x16')]);router[_0x50a7('0x15')](_0x50a7('0x17'),auth['isAuthenticated'](),controller[_0x50a7('0x18')]);router[_0x50a7('0x15')](_0x50a7('0x19'),auth['isAuthenticated'](),controller[_0x50a7('0x1a')]);router[_0x50a7('0x1b')](_0x50a7('0xe'),auth[_0x50a7('0xd')](),controller['destroy']);module[_0x50a7('0x1c')]=router; \ No newline at end of file +var _0xc609=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','whatsapp','whatsappmessage:create','status','put','update','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x115415,_0x28ff3c){var _0x2cf637=function(_0x412eb2){while(--_0x412eb2){_0x115415['push'](_0x115415['shift']());}};_0x2cf637(++_0x28ff3c);}(_0xc609,0x133));var _0x9c60=function(_0x2e6268,_0x62ae77){_0x2e6268=_0x2e6268-0x0;var _0x133083=_0xc609[_0x2e6268];return _0x133083;};'use strict';var multer=require('multer');var util=require(_0x9c60('0x0'));var path=require(_0x9c60('0x1'));var timeout=require(_0x9c60('0x2'));var express=require('express');var router=express[_0x9c60('0x3')]();var fs_extra=require(_0x9c60('0x4'));var auth=require(_0x9c60('0x5'));var interaction=require(_0x9c60('0x6'));var config=require(_0x9c60('0x7'));var controller=require(_0x9c60('0x8'));router[_0x9c60('0x9')]('/',auth[_0x9c60('0xa')](),controller[_0x9c60('0xb')]);router[_0x9c60('0x9')](_0x9c60('0xc'),auth[_0x9c60('0xa')](),controller['describe']);router[_0x9c60('0x9')]('/:id',auth[_0x9c60('0xa')](),controller[_0x9c60('0xd')]);router[_0x9c60('0xe')]('/',auth[_0x9c60('0xa')](),interaction[_0x9c60('0xf')](_0x9c60('0x10'),_0x9c60('0x11')),controller['create']);router['post']('/:id/status',controller[_0x9c60('0x12')]);router[_0x9c60('0x13')]('/:id',auth[_0x9c60('0xa')](),controller[_0x9c60('0x14')]);router[_0x9c60('0x13')]('/:id/accept',auth[_0x9c60('0xa')](),controller[_0x9c60('0x15')]);router['put'](_0x9c60('0x16'),auth[_0x9c60('0xa')](),controller['reject']);router[_0x9c60('0x17')]('/:id',auth[_0x9c60('0xa')](),controller[_0x9c60('0x18')]);module[_0x9c60('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 70123fe..8d031f6 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 _0x906c=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x906c,0x17d));var _0xc906=function(_0x3b3c68,_0x3b115f){_0x3b3c68=_0x3b3c68-0x0;var _0x56cedb=_0x906c[_0x3b3c68];return _0x56cedb;};'use strict';var Sequelize=require(_0xc906('0x0'));module[_0xc906('0x1')]={'body':{'type':Sequelize[_0xc906('0x2')](_0xc906('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc906('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc906('0x5')]('in',_0xc906('0x6')),'defaultValue':_0xc906('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc906('0x7')](0xbe)},'phone':{'type':Sequelize[_0xc906('0x7')]},'readAt':{'type':Sequelize[_0xc906('0x8')]},'secret':{'type':Sequelize[_0xc906('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc906('0x7')]},'providerResponse':{'type':Sequelize[_0xc906('0x2')]}}; \ No newline at end of file +var _0x0185=['out','STRING','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4da78e,_0x13cb84){var _0x4463b1=function(_0x41aaf1){while(--_0x41aaf1){_0x4da78e['push'](_0x4da78e['shift']());}};_0x4463b1(++_0x13cb84);}(_0x0185,0x1ac));var _0x5018=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x0185[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5018('0x0')](_0x5018('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5018('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5018('0x3')]('in','out'),'defaultValue':_0x5018('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5018('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5018('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 03a35a2..e2ce2c2 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 _0x85ae=['query','filters','model','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','rawAttributes','intersection','attributes','find','create','body','params','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','email','internal','agent','manual','interface','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','fullname','SIP/%s','channel','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','stack','name','send','index','map','WhatsappMessage','fieldName','key'];(function(_0x15699f,_0x2f8fdc){var _0x57871d=function(_0x471f26){while(--_0x471f26){_0x15699f['push'](_0x15699f['shift']());}};_0x57871d(++_0x2f8fdc);}(_0x85ae,0xe4));var _0xe85a=function(_0x4c9090,_0x481ec4){_0x4c9090=_0x4c9090-0x0;var _0x470c73=_0x85ae[_0x4c9090];return _0x470c73;};'use strict';var emlformat=require(_0xe85a('0x0'));var rimraf=require(_0xe85a('0x1'));var zipdir=require(_0xe85a('0x2'));var jsonpatch=require(_0xe85a('0x3'));var rp=require(_0xe85a('0x4'));var moment=require('moment');var BPromise=require(_0xe85a('0x5'));var Mustache=require(_0xe85a('0x6'));var util=require(_0xe85a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe85a('0x8'));var ejs=require(_0xe85a('0x9'));var fs=require('fs');var fs_extra=require(_0xe85a('0xa'));var _=require(_0xe85a('0xb'));var squel=require(_0xe85a('0xc'));var crypto=require(_0xe85a('0xd'));var jsforce=require(_0xe85a('0xe'));var deskjs=require(_0xe85a('0xf'));var toCsv=require(_0xe85a('0x8'));var querystring=require(_0xe85a('0x10'));var Papa=require('papaparse');var Redis=require(_0xe85a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe85a('0x12'));var logger=require(_0xe85a('0x13'))(_0xe85a('0x14'));var utils=require(_0xe85a('0x15'));var config=require(_0xe85a('0x16'));var licenseUtil=require(_0xe85a('0x17'));var db=require(_0xe85a('0x18'))['db'];config[_0xe85a('0x19')]=_[_0xe85a('0x1a')](config[_0xe85a('0x19')],{'host':_0xe85a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe85a('0x19')]));require(_0xe85a('0x1c'))[_0xe85a('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe85a('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xe85a('0x1e')][_0xe85a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x16c320,_0x12c718,_0x3a088e,_0x549c64){return new BPromise(function(_0xae6be4,_0x29b3a3){var _0x48d1bc=_0x549c64||client;return _0x48d1bc['request'](_0x16c320,_0x3a088e)[_0xe85a('0x20')](function(_0x22aaca){logger[_0xe85a('0x21')](_0xe85a('0x22'),_0x12c718,_0xe85a('0x23'));logger['debug'](_0xe85a('0x24'),_0x12c718,_0xe85a('0x23'),JSON[_0xe85a('0x25')](_0x22aaca));if(_0x22aaca[_0xe85a('0x26')]){if(_0x22aaca['error'][_0xe85a('0x27')]===0x1f4){logger['error'](_0xe85a('0x22'),_0x12c718,_0x22aaca[_0xe85a('0x26')][_0xe85a('0x28')]);return _0x29b3a3(_0x22aaca[_0xe85a('0x26')][_0xe85a('0x28')]);}logger[_0xe85a('0x26')](_0xe85a('0x22'),_0x12c718,_0x22aaca[_0xe85a('0x26')][_0xe85a('0x28')]);return _0xae6be4(_0x22aaca[_0xe85a('0x26')][_0xe85a('0x28')]);}else{logger[_0xe85a('0x21')](_0xe85a('0x22'),_0x12c718,_0xe85a('0x23'));_0xae6be4(_0x22aaca[_0xe85a('0x29')][_0xe85a('0x28')]);}})['catch'](function(_0xf552e8){logger['error'](_0xe85a('0x22'),_0x12c718,_0xf552e8);_0x29b3a3(_0xf552e8);});});}function respondWithStatusCode(_0x8c5b4a,_0x39f50f){_0x39f50f=_0x39f50f||0xcc;return function(_0x5b2e20){if(_0x5b2e20){return _0x8c5b4a[_0xe85a('0x2a')](_0x39f50f);}return _0x8c5b4a[_0xe85a('0x2b')](_0x39f50f)[_0xe85a('0x2c')]();};}function respondWithResult(_0x26226b,_0x37450d){_0x37450d=_0x37450d||0xc8;return function(_0x196ec0){if(_0x196ec0){return _0x26226b['status'](_0x37450d)[_0xe85a('0x2d')](_0x196ec0);}};}function respondWithFilteredResult(_0xddf440,_0x638bed){return function(_0x491505){if(_0x491505){var _0xf62bc5=typeof _0x638bed[_0xe85a('0x2e')]==='undefined'&&typeof _0x638bed[_0xe85a('0x2f')]===_0xe85a('0x30');var _0x30e165=_0x491505[_0xe85a('0x31')];var _0x7005af=_0xf62bc5?0x0:_0x638bed[_0xe85a('0x2e')];var _0x49263b=_0xf62bc5?_0x491505[_0xe85a('0x31')]:_0x638bed['offset']+_0x638bed[_0xe85a('0x2f')];var _0x3f5782;if(_0x49263b>=_0x30e165){_0x49263b=_0x30e165;_0x3f5782=0xc8;}else{_0x3f5782=0xce;}_0xddf440[_0xe85a('0x2b')](_0x3f5782);return _0xddf440['set'](_0xe85a('0x32'),_0x7005af+'-'+_0x49263b+'/'+_0x30e165)[_0xe85a('0x2d')](_0x491505);}return null;};}function patchUpdates(_0x1cad38){return function(_0x536773){try{jsonpatch[_0xe85a('0x33')](_0x536773,_0x1cad38,!![]);}catch(_0x11005d){return BPromise['reject'](_0x11005d);}return _0x536773[_0xe85a('0x34')]();};}function saveUpdates(_0x35da8d,_0x51cfd6){return function(_0xaf4447){if(_0xaf4447){return _0xaf4447[_0xe85a('0x35')](_0x35da8d)[_0xe85a('0x20')](function(_0x32c3cc){return _0x32c3cc;});}return null;};}function removeEntity(_0x315483,_0x285e0b){return function(_0x517f7d){if(_0x517f7d){return _0x517f7d['destroy']()[_0xe85a('0x20')](function(){_0x315483[_0xe85a('0x2b')](0xcc)[_0xe85a('0x2c')]();});}};}function handleEntityNotFound(_0x583d06,_0x135d26){return function(_0x94ae4b){if(!_0x94ae4b){_0x583d06[_0xe85a('0x2a')](0x194);}return _0x94ae4b;};}function handleError(_0x5ac8a3,_0x43a40e){_0x43a40e=_0x43a40e||0x1f4;return function(_0x3dffec){logger[_0xe85a('0x26')](_0x3dffec[_0xe85a('0x36')]);if(_0x3dffec[_0xe85a('0x37')]){delete _0x3dffec[_0xe85a('0x37')];}_0x5ac8a3[_0xe85a('0x2b')](_0x43a40e)[_0xe85a('0x38')](_0x3dffec);};}exports[_0xe85a('0x39')]=function(_0x47e201,_0x22a264){var _0x13082b={},_0x33b845={},_0x2e085d={'count':0x0,'rows':[]};var _0x1ecaa9=_[_0xe85a('0x3a')](db[_0xe85a('0x3b')]['rawAttributes'],function(_0x53a588){return{'name':_0x53a588[_0xe85a('0x3c')],'type':_0x53a588['type'][_0xe85a('0x3d')]};});_0x33b845['model']=_[_0xe85a('0x3a')](_0x1ecaa9,_0xe85a('0x37'));_0x33b845['query']=_['keys'](_0x47e201[_0xe85a('0x3e')]);_0x33b845[_0xe85a('0x3f')]=_['intersection'](_0x33b845[_0xe85a('0x40')],_0x33b845[_0xe85a('0x3e')]);_0x13082b['attributes']=_['intersection'](_0x33b845[_0xe85a('0x40')],qs[_0xe85a('0x41')](_0x47e201['query']['fields']));_0x13082b['attributes']=_0x13082b['attributes'][_0xe85a('0x42')]?_0x13082b['attributes']:_0x33b845[_0xe85a('0x40')];if(!_0x47e201[_0xe85a('0x3e')]['hasOwnProperty'](_0xe85a('0x43'))){_0x13082b['limit']=qs['limit'](_0x47e201[_0xe85a('0x3e')][_0xe85a('0x2f')]);_0x13082b[_0xe85a('0x2e')]=qs[_0xe85a('0x2e')](_0x47e201[_0xe85a('0x3e')][_0xe85a('0x2e')]);}_0x13082b[_0xe85a('0x44')]=qs[_0xe85a('0x45')](_0x47e201['query'][_0xe85a('0x45')]);_0x13082b['where']=qs[_0xe85a('0x3f')](_[_0xe85a('0x46')](_0x47e201[_0xe85a('0x3e')],_0x33b845[_0xe85a('0x3f')]),_0x1ecaa9);if(_0x47e201[_0xe85a('0x3e')][_0xe85a('0x47')]){_0x13082b[_0xe85a('0x48')]=_[_0xe85a('0x49')](_0x13082b[_0xe85a('0x48')],{'$or':_[_0xe85a('0x3a')](_0x1ecaa9,function(_0x32d9d4){if(_0x32d9d4[_0xe85a('0x4a')]!==_0xe85a('0x4b')){var _0x5d0031={};_0x5d0031[_0x32d9d4[_0xe85a('0x37')]]={'$like':'%'+_0x47e201[_0xe85a('0x3e')]['filter']+'%'};return _0x5d0031;}})});}_0x13082b=_[_0xe85a('0x49')]({},_0x13082b,_0x47e201[_0xe85a('0x4c')]);var _0xa875d8={'where':_0x13082b[_0xe85a('0x48')]};return db[_0xe85a('0x3b')]['count'](_0xa875d8)[_0xe85a('0x20')](function(_0x583851){_0x2e085d[_0xe85a('0x31')]=_0x583851;if(_0x47e201[_0xe85a('0x3e')][_0xe85a('0x4d')]){_0x13082b[_0xe85a('0x4e')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x13082b);})[_0xe85a('0x20')](function(_0x6dbc65){_0x2e085d[_0xe85a('0x4f')]=_0x6dbc65;return _0x2e085d;})[_0xe85a('0x20')](respondWithFilteredResult(_0x22a264,_0x13082b))[_0xe85a('0x50')](handleError(_0x22a264,null));};exports[_0xe85a('0x51')]=function(_0x419cf7,_0x6bc1eb){var _0x1a98a4={'raw':!![],'where':{'id':_0x419cf7['params']['id']}},_0x132d6b={};_0x132d6b[_0xe85a('0x40')]=_[_0xe85a('0x52')](db[_0xe85a('0x3b')][_0xe85a('0x53')]);_0x132d6b[_0xe85a('0x3e')]=_[_0xe85a('0x52')](_0x419cf7[_0xe85a('0x3e')]);_0x132d6b[_0xe85a('0x3f')]=_[_0xe85a('0x54')](_0x132d6b[_0xe85a('0x40')],_0x132d6b['query']);_0x1a98a4[_0xe85a('0x55')]=_[_0xe85a('0x54')](_0x132d6b[_0xe85a('0x40')],qs[_0xe85a('0x41')](_0x419cf7[_0xe85a('0x3e')]['fields']));_0x1a98a4[_0xe85a('0x55')]=_0x1a98a4[_0xe85a('0x55')][_0xe85a('0x42')]?_0x1a98a4[_0xe85a('0x55')]:_0x132d6b[_0xe85a('0x40')];if(_0x419cf7[_0xe85a('0x3e')][_0xe85a('0x4d')]){_0x1a98a4[_0xe85a('0x4e')]=[{'all':!![]}];}_0x1a98a4=_['merge']({},_0x1a98a4,_0x419cf7[_0xe85a('0x4c')]);return db['WhatsappMessage'][_0xe85a('0x56')](_0x1a98a4)['then'](handleEntityNotFound(_0x6bc1eb,null))[_0xe85a('0x20')](respondWithResult(_0x6bc1eb,null))[_0xe85a('0x50')](handleError(_0x6bc1eb,null));};exports[_0xe85a('0x57')]=function(_0x163243,_0x2f18b7){return db[_0xe85a('0x3b')][_0xe85a('0x57')](_0x163243[_0xe85a('0x58')],{})[_0xe85a('0x20')](respondWithResult(_0x2f18b7,0xc9))['catch'](handleError(_0x2f18b7,null));};exports[_0xe85a('0x35')]=function(_0x451405,_0x92fec7){if(_0x451405['body']['id']){delete _0x451405[_0xe85a('0x58')]['id'];}return db['WhatsappMessage'][_0xe85a('0x56')]({'where':{'id':_0x451405[_0xe85a('0x59')]['id']}})[_0xe85a('0x20')](handleEntityNotFound(_0x92fec7,null))[_0xe85a('0x20')](saveUpdates(_0x451405[_0xe85a('0x58')],null))[_0xe85a('0x20')](respondWithResult(_0x92fec7,null))[_0xe85a('0x50')](handleError(_0x92fec7,null));};exports[_0xe85a('0x5a')]=function(_0x459992,_0x2e5271){return db['WhatsappMessage']['find']({'where':{'id':_0x459992[_0xe85a('0x59')]['id']}})[_0xe85a('0x20')](handleEntityNotFound(_0x2e5271,null))[_0xe85a('0x20')](removeEntity(_0x2e5271,null))[_0xe85a('0x50')](handleError(_0x2e5271,null));};exports[_0xe85a('0x5b')]=function(_0x1d0509,_0x5d72ae){return db['WhatsappMessage'][_0xe85a('0x5b')]()[_0xe85a('0x20')](respondWithResult(_0x5d72ae,null))[_0xe85a('0x50')](handleError(_0x5d72ae,null));};var interaction_log=require('../../config/logger')(_0xe85a('0x5c'));exports[_0xe85a('0x5d')]=function(_0x38fdd1,_0x401229,_0x4c4a00){var _0x166624={'agent':{},'channel':_0xe85a('0x5e')};if(_0x38fdd1[_0xe85a('0x58')]['id']){delete _0x38fdd1[_0xe85a('0x58')]['id'];}_0x38fdd1[_0xe85a('0x58')][_0xe85a('0x5f')]=!![];_0x38fdd1[_0xe85a('0x58')][_0xe85a('0x60')]=moment()[_0xe85a('0x61')](_0xe85a('0x62'));_0x38fdd1['body'][_0xe85a('0x63')]=_0x38fdd1[_0xe85a('0x58')]['UserId']||_0x38fdd1[_0xe85a('0x64')]['id'];_0x166624['agent']['id']=_0x38fdd1[_0xe85a('0x58')][_0xe85a('0x63')];return db[_0xe85a('0x3b')][_0xe85a('0x56')]({'where':{'id':_0x38fdd1['params']['id'],'UserId':null}})[_0xe85a('0x20')](handleEntityNotFound(_0x401229,null))[_0xe85a('0x20')](saveUpdates(_0x38fdd1[_0xe85a('0x58')],null))[_0xe85a('0x20')](function(_0x5e0a82){if(_0x5e0a82){_0x166624['message']=_0x5e0a82[_0xe85a('0x65')]({'plain':!![]});return db[_0xe85a('0x66')][_0xe85a('0x56')]({'where':{'id':_0x5e0a82['WhatsappInteractionId']}});}return null;})[_0xe85a('0x20')](handleEntityNotFound(_0x401229,null))[_0xe85a('0x20')](function(_0x277a8c){if(_0x277a8c){return _0x277a8c['update']({'UserId':_0x38fdd1[_0xe85a('0x58')][_0xe85a('0x63')],'read1stAt':_[_0xe85a('0x67')](_0x277a8c[_0xe85a('0x68')])?moment()['format'](_0xe85a('0x62')):undefined});}return null;})[_0xe85a('0x20')](function(_0x3dfa67){if(_0x3dfa67){_0x166624[_0xe85a('0x69')]=_0x3dfa67['get']({'plain':!![]});interaction_log[_0xe85a('0x21')](_0xe85a('0x6a'),_0x38fdd1[_0xe85a('0x64')]['id'],_0x38fdd1[_0xe85a('0x64')][_0xe85a('0x37')],_0x38fdd1[_0xe85a('0x64')][_0xe85a('0x6b')],_0x166624[_0xe85a('0x69')]['id'],_0x38fdd1[_0xe85a('0x58')]?JSON[_0xe85a('0x25')](_0x38fdd1['body']):_0xe85a('0x6c'));return respondWithRpcPromise(_0xe85a('0x6d'),_0xe85a('0x6e'),_0x166624);}return null;})['then'](function(_0x318f2c){var _0x35f2bb=_0xe85a('0x6f')+_0x318f2c['message'][_0xe85a('0x70')];return db['sequelize'][_0xe85a('0x3e')](_0x35f2bb,{'type':db[_0xe85a('0x71')]['QueryTypes'][_0xe85a('0x72')],'raw':!![]})[_0xe85a('0x20')](function(_0x1cbf61){return _0x1cbf61;});})['then'](function(_0x3953f2){if(_0x3953f2){_0x166624[_0xe85a('0x28')][_0xe85a('0x73')]=_0x3953f2[0x0];if(!_0x38fdd1[_0xe85a('0x58')][_0xe85a('0x63')])return;return db['User']['find']({'where':{'id':_0x38fdd1[_0xe85a('0x58')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0xe85a('0x74'),_0xe85a('0x75')],'raw':!![]});}return null;})['then'](function(_0x52a524){if(!_0x52a524)return null;_0x166624[_0xe85a('0x28')][_0xe85a('0x76')]=_0x52a524;return _0x166624;})[_0xe85a('0x20')](function(_0x5dca02){if(_0x5dca02){if(_0x38fdd1[_0xe85a('0x58')][_0xe85a('0x77')]){_0x166624[_0xe85a('0x28')][_0xe85a('0x78')]=util[_0xe85a('0x61')]('SIP/%s',_0x38fdd1[_0xe85a('0x64')]['name']);_0x166624[_0xe85a('0x28')]['channel']=_0x166624['channel'];_0x166624[_0xe85a('0x28')][_0xe85a('0x79')]=_0x166624['channel'];_0x166624['message'][_0xe85a('0x7a')]=_0xe85a('0x5d');return respondWithRpcPromise(_0xe85a('0x7b'),_0xe85a('0x7b'),{'event':_0xe85a('0x7c'),'message':_0x166624[_0xe85a('0x28')]},client9002)[_0xe85a('0x20')](function(){return _0x166624;});}return _0x166624;}return null;})[_0xe85a('0x20')](respondWithResult(_0x401229,null))[_0xe85a('0x50')](handleError(_0x401229,null));};var interaction_log=require(_0xe85a('0x13'))(_0xe85a('0x5c'));exports[_0xe85a('0x7d')]=function(_0x4e4c8f,_0x40a558,_0x3ffa32){var _0x1bf96f={'agent':{},'channel':'whatsapp'};if(_0x4e4c8f['body']['id']){delete _0x4e4c8f[_0xe85a('0x58')]['id'];}_0x4e4c8f[_0xe85a('0x58')][_0xe85a('0x63')]=_0x4e4c8f[_0xe85a('0x58')]['UserId']||_0x4e4c8f[_0xe85a('0x64')]['id'];_0x1bf96f[_0xe85a('0x76')]['id']=_0x4e4c8f[_0xe85a('0x58')]['UserId'];return db[_0xe85a('0x3b')][_0xe85a('0x56')]({'where':{'id':_0x4e4c8f[_0xe85a('0x59')]['id'],'UserId':null}})[_0xe85a('0x20')](handleEntityNotFound(_0x40a558,null))[_0xe85a('0x20')](function(_0x53d1c5){if(_0x53d1c5){_0x1bf96f['message']=_0x53d1c5[_0xe85a('0x65')]({'plain':!![]});return db[_0xe85a('0x66')]['find']({'where':{'id':_0x53d1c5['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x40a558,null))[_0xe85a('0x20')](function(_0xa57216){if(_0xa57216){_0x1bf96f[_0xe85a('0x69')]=_0xa57216['get']({'plain':!![]});interaction_log['info'](_0xe85a('0x7e'),_0x4e4c8f[_0xe85a('0x64')]['id'],_0x4e4c8f['user']['name'],_0x4e4c8f[_0xe85a('0x64')][_0xe85a('0x6b')],_0x1bf96f[_0xe85a('0x69')]['id'],_0x4e4c8f[_0xe85a('0x58')]?JSON['stringify'](_0x4e4c8f[_0xe85a('0x58')]):_0xe85a('0x6c'));return respondWithRpcPromise(_0xe85a('0x7f'),_0xe85a('0x80'),_0x1bf96f);}return null;})[_0xe85a('0x20')](function(_0x5ce4c3){var _0x285c95=_0xe85a('0x6f')+_0x5ce4c3[_0xe85a('0x28')][_0xe85a('0x70')];return db['sequelize'][_0xe85a('0x3e')](_0x285c95,{'type':db[_0xe85a('0x71')][_0xe85a('0x81')]['SELECT'],'raw':!![]})[_0xe85a('0x20')](function(_0x1e4687){return _0x1e4687;});})['then'](function(_0x42dd5a){if(_0x42dd5a){_0x1bf96f[_0xe85a('0x28')]['contact']=_0x42dd5a[0x0];if(!_0x4e4c8f[_0xe85a('0x58')][_0xe85a('0x63')])return;return db[_0xe85a('0x82')][_0xe85a('0x56')]({'where':{'id':_0x4e4c8f['body'][_0xe85a('0x63')],'role':_0xe85a('0x76')},'attributes':['id','name',_0xe85a('0x83'),_0xe85a('0x74'),'internal'],'raw':!![]});}return null;})[_0xe85a('0x20')](function(_0x6525cf){if(!_0x6525cf)return null;_0x1bf96f[_0xe85a('0x28')][_0xe85a('0x76')]=_0x6525cf;return _0x1bf96f;})[_0xe85a('0x20')](function(_0x4915b7){if(_0x4915b7){_0x4915b7[_0xe85a('0x28')][_0xe85a('0x78')]=util[_0xe85a('0x61')](_0xe85a('0x84'),_0x4e4c8f[_0xe85a('0x64')][_0xe85a('0x37')]);_0x4915b7[_0xe85a('0x28')][_0xe85a('0x85')]=_0x1bf96f['channel'];_0x4915b7[_0xe85a('0x28')][_0xe85a('0x79')]=_0x1bf96f[_0xe85a('0x85')];_0x4915b7[_0xe85a('0x28')][_0xe85a('0x7a')]=_0xe85a('0x7d');respondWithRpcPromise('EventManager','EventManager',{'event':_0xe85a('0x86'),'message':_0x4915b7[_0xe85a('0x28')]},client9002);return _0x1bf96f;}return null;})[_0xe85a('0x20')](respondWithResult(_0x40a558,null))[_0xe85a('0x50')](handleError(_0x40a558,null));};exports[_0xe85a('0x2b')]=function(_0x14f1a5,_0x25d420,_0x5e7301){if(_0x14f1a5[_0xe85a('0x58')]['id']){delete _0x14f1a5[_0xe85a('0x58')]['id'];}var _0x23e987;return db[_0xe85a('0x3b')][_0xe85a('0x56')]({'where':{'id':_0x14f1a5[_0xe85a('0x59')]['id']}})['then'](handleEntityNotFound(_0x25d420,null))[_0xe85a('0x20')](function(_0x1566c5){if(_0x1566c5){_0x23e987=_0x1566c5;return db[_0xe85a('0x87')]['find']({'where':{'id':_0x1566c5[_0xe85a('0x88')]}});}})['then'](handleEntityNotFound(_0x25d420,null))[_0xe85a('0x20')](function(_0x597ac7){if(_0x597ac7){logger[_0xe85a('0x89')](_0xe85a('0x8a'),_0xe85a('0x2b'),_0xe85a('0x8b'),_0x597ac7[_0xe85a('0x4a')],util['inspect'](_0x14f1a5[_0xe85a('0x58')],{'showHidden':![],'depth':null}));switch(_0x597ac7[_0xe85a('0x4a')]){case'twilio':if(_0x14f1a5[_0xe85a('0x58')][_0xe85a('0x8c')]&&_0x14f1a5[_0xe85a('0x58')][_0xe85a('0x8c')]===_0x23e987[_0xe85a('0x8d')]&&_0x14f1a5['body'][_0xe85a('0x8e')]&&_0x14f1a5[_0xe85a('0x58')]['MessageStatus']===_0xe85a('0x5f')){return _0x23e987[_0xe85a('0x35')]({'read':!![]});}else{logger['error'](_0xe85a('0x8f'),'status',_0xe85a('0x90'),util['inspect'](_0x14f1a5[_0xe85a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x23e987;}})[_0xe85a('0x20')](respondWithResult(_0x25d420,null))[_0xe85a('0x50')](handleError(_0x25d420,null));}; \ No newline at end of file +var _0x680c=['rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','merge','filter','WhatsappMessage','includeAll','rows','show','include','find','create','update','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','info','[WHATSAPPMESSAGE: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','QueryTypes','SELECT','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','sequelize','Sequelize','contact','email','internal','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','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','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','sendStatus','stack','name','index','map'];(function(_0x2acd24,_0xf315ac){var _0x546099=function(_0x479e66){while(--_0x479e66){_0x2acd24['push'](_0x2acd24['shift']());}};_0x546099(++_0xf315ac);}(_0x680c,0x160));var _0xc680=function(_0x4c1917,_0xea7b6c){_0x4c1917=_0x4c1917-0x0;var _0x220fa5=_0x680c[_0x4c1917];return _0x220fa5;};'use strict';var emlformat=require(_0xc680('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc680('0x1'));var jsonpatch=require(_0xc680('0x2'));var rp=require(_0xc680('0x3'));var moment=require(_0xc680('0x4'));var BPromise=require(_0xc680('0x5'));var Mustache=require(_0xc680('0x6'));var util=require('util');var path=require(_0xc680('0x7'));var sox=require('sox');var csv=require(_0xc680('0x8'));var ejs=require(_0xc680('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc680('0xa'));var squel=require(_0xc680('0xb'));var crypto=require(_0xc680('0xc'));var jsforce=require(_0xc680('0xd'));var deskjs=require(_0xc680('0xe'));var toCsv=require(_0xc680('0x8'));var querystring=require(_0xc680('0xf'));var Papa=require(_0xc680('0x10'));var Redis=require(_0xc680('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc680('0x12'));var hardwareService=require(_0xc680('0x13'));var logger=require(_0xc680('0x14'))(_0xc680('0x15'));var utils=require(_0xc680('0x16'));var config=require(_0xc680('0x17'));var licenseUtil=require(_0xc680('0x18'));var db=require(_0xc680('0x19'))['db'];config['redis']=_[_0xc680('0x1a')](config[_0xc680('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc680('0x1c'))(new Redis(config[_0xc680('0x1b')]));require(_0xc680('0x1d'))[_0xc680('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc680('0x1f')][_0xc680('0x20')]({'port':0x232c});var client9002=jayson[_0xc680('0x1f')][_0xc680('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5e6741,_0x3cad4f,_0x57e497,_0x26d2be){return new BPromise(function(_0x2cd697,_0x5ada10){var _0x416252=_0x26d2be||client;return _0x416252[_0xc680('0x21')](_0x5e6741,_0x57e497)[_0xc680('0x22')](function(_0x4b6214){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3cad4f,_0xc680('0x23'));logger[_0xc680('0x24')](_0xc680('0x25'),_0x3cad4f,_0xc680('0x23'),JSON['stringify'](_0x4b6214));if(_0x4b6214[_0xc680('0x26')]){if(_0x4b6214[_0xc680('0x26')][_0xc680('0x27')]===0x1f4){logger['error'](_0xc680('0x28'),_0x3cad4f,_0x4b6214[_0xc680('0x26')]['message']);return _0x5ada10(_0x4b6214[_0xc680('0x26')][_0xc680('0x29')]);}logger[_0xc680('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x3cad4f,_0x4b6214[_0xc680('0x26')]['message']);return _0x2cd697(_0x4b6214[_0xc680('0x26')]['message']);}else{logger['info'](_0xc680('0x28'),_0x3cad4f,_0xc680('0x23'));_0x2cd697(_0x4b6214[_0xc680('0x2a')]['message']);}})[_0xc680('0x2b')](function(_0x252f85){logger[_0xc680('0x26')](_0xc680('0x28'),_0x3cad4f,_0x252f85);_0x5ada10(_0x252f85);});});}function respondWithStatusCode(_0x9cbc90,_0x382e11){_0x382e11=_0x382e11||0xcc;return function(_0x5d33cd){if(_0x5d33cd){return _0x9cbc90['sendStatus'](_0x382e11);}return _0x9cbc90[_0xc680('0x2c')](_0x382e11)['end']();};}function respondWithResult(_0x6dce4b,_0x445b39){_0x445b39=_0x445b39||0xc8;return function(_0x257b1f){if(_0x257b1f){return _0x6dce4b[_0xc680('0x2c')](_0x445b39)[_0xc680('0x2d')](_0x257b1f);}};}function respondWithFilteredResult(_0x1f1196,_0x2fdbc3){return function(_0x486f0f){if(_0x486f0f){var _0xa2f928=typeof _0x2fdbc3[_0xc680('0x2e')]===_0xc680('0x2f')&&typeof _0x2fdbc3['limit']===_0xc680('0x2f');var _0x78a7a9=_0x486f0f[_0xc680('0x30')];var _0x107c81=_0xa2f928?0x0:_0x2fdbc3[_0xc680('0x2e')];var _0x5af9cf=_0xa2f928?_0x486f0f[_0xc680('0x30')]:_0x2fdbc3[_0xc680('0x2e')]+_0x2fdbc3[_0xc680('0x31')];var _0x597b0b;if(_0x5af9cf>=_0x78a7a9){_0x5af9cf=_0x78a7a9;_0x597b0b=0xc8;}else{_0x597b0b=0xce;}_0x1f1196['status'](_0x597b0b);return _0x1f1196[_0xc680('0x32')](_0xc680('0x33'),_0x107c81+'-'+_0x5af9cf+'/'+_0x78a7a9)[_0xc680('0x2d')](_0x486f0f);}return null;};}function patchUpdates(_0x1d84d2){return function(_0x46ae9a){try{jsonpatch['apply'](_0x46ae9a,_0x1d84d2,!![]);}catch(_0x2d0123){return BPromise[_0xc680('0x34')](_0x2d0123);}return _0x46ae9a['save']();};}function saveUpdates(_0x474b95,_0x5ed30c){return function(_0x40819e){if(_0x40819e){return _0x40819e['update'](_0x474b95)[_0xc680('0x22')](function(_0x20f7ff){return _0x20f7ff;});}return null;};}function removeEntity(_0x59727b,_0x46ad65){return function(_0x4457bf){if(_0x4457bf){return _0x4457bf[_0xc680('0x35')]()[_0xc680('0x22')](function(){_0x59727b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x327ee0,_0x1eba94){return function(_0x1a9092){if(!_0x1a9092){_0x327ee0[_0xc680('0x36')](0x194);}return _0x1a9092;};}function handleError(_0x2f4cf1,_0x275247){_0x275247=_0x275247||0x1f4;return function(_0x8aff1b){logger[_0xc680('0x26')](_0x8aff1b[_0xc680('0x37')]);if(_0x8aff1b[_0xc680('0x38')]){delete _0x8aff1b[_0xc680('0x38')];}_0x2f4cf1['status'](_0x275247)['send'](_0x8aff1b);};}exports[_0xc680('0x39')]=function(_0x34b414,_0x4a4efe){var _0x3f45f5={},_0x35fa35={},_0x29aa60={'count':0x0,'rows':[]};var _0x5c8dbd=_[_0xc680('0x3a')](db['WhatsappMessage'][_0xc680('0x3b')],function(_0x4b4d45){return{'name':_0x4b4d45['fieldName'],'type':_0x4b4d45[_0xc680('0x3c')]['key']};});_0x35fa35['model']=_[_0xc680('0x3a')](_0x5c8dbd,_0xc680('0x38'));_0x35fa35[_0xc680('0x3d')]=_[_0xc680('0x3e')](_0x34b414['query']);_0x35fa35[_0xc680('0x3f')]=_[_0xc680('0x40')](_0x35fa35[_0xc680('0x41')],_0x35fa35[_0xc680('0x3d')]);_0x3f45f5['attributes']=_[_0xc680('0x40')](_0x35fa35[_0xc680('0x41')],qs[_0xc680('0x42')](_0x34b414[_0xc680('0x3d')][_0xc680('0x42')]));_0x3f45f5[_0xc680('0x43')]=_0x3f45f5[_0xc680('0x43')][_0xc680('0x44')]?_0x3f45f5[_0xc680('0x43')]:_0x35fa35[_0xc680('0x41')];if(!_0x34b414[_0xc680('0x3d')]['hasOwnProperty']('nolimit')){_0x3f45f5[_0xc680('0x31')]=qs[_0xc680('0x31')](_0x34b414['query']['limit']);_0x3f45f5[_0xc680('0x2e')]=qs[_0xc680('0x2e')](_0x34b414[_0xc680('0x3d')]['offset']);}_0x3f45f5[_0xc680('0x45')]=qs[_0xc680('0x46')](_0x34b414[_0xc680('0x3d')]['sort']);_0x3f45f5[_0xc680('0x47')]=qs[_0xc680('0x3f')](_['pick'](_0x34b414[_0xc680('0x3d')],_0x35fa35[_0xc680('0x3f')]),_0x5c8dbd);if(_0x34b414[_0xc680('0x3d')]['filter']){_0x3f45f5[_0xc680('0x47')]=_[_0xc680('0x48')](_0x3f45f5[_0xc680('0x47')],{'$or':_[_0xc680('0x3a')](_0x5c8dbd,function(_0x23b2c3){if(_0x23b2c3['type']!=='VIRTUAL'){var _0x305288={};_0x305288[_0x23b2c3[_0xc680('0x38')]]={'$like':'%'+_0x34b414[_0xc680('0x3d')][_0xc680('0x49')]+'%'};return _0x305288;}})});}_0x3f45f5=_[_0xc680('0x48')]({},_0x3f45f5,_0x34b414['options']);var _0xd1a34={'where':_0x3f45f5[_0xc680('0x47')]};return db[_0xc680('0x4a')][_0xc680('0x30')](_0xd1a34)[_0xc680('0x22')](function(_0x382cf6){_0x29aa60[_0xc680('0x30')]=_0x382cf6;if(_0x34b414[_0xc680('0x3d')][_0xc680('0x4b')]){_0x3f45f5['include']=[{'all':!![]}];}return db[_0xc680('0x4a')]['findAll'](_0x3f45f5);})[_0xc680('0x22')](function(_0x196772){_0x29aa60[_0xc680('0x4c')]=_0x196772;return _0x29aa60;})['then'](respondWithFilteredResult(_0x4a4efe,_0x3f45f5))[_0xc680('0x2b')](handleError(_0x4a4efe,null));};exports[_0xc680('0x4d')]=function(_0x33405c,_0xbe0072){var _0x2a92ea={'raw':!![],'where':{'id':_0x33405c['params']['id']}},_0x1e32bb={};_0x1e32bb['model']=_[_0xc680('0x3e')](db[_0xc680('0x4a')][_0xc680('0x3b')]);_0x1e32bb[_0xc680('0x3d')]=_[_0xc680('0x3e')](_0x33405c['query']);_0x1e32bb[_0xc680('0x3f')]=_['intersection'](_0x1e32bb[_0xc680('0x41')],_0x1e32bb[_0xc680('0x3d')]);_0x2a92ea[_0xc680('0x43')]=_[_0xc680('0x40')](_0x1e32bb[_0xc680('0x41')],qs[_0xc680('0x42')](_0x33405c['query'][_0xc680('0x42')]));_0x2a92ea[_0xc680('0x43')]=_0x2a92ea[_0xc680('0x43')][_0xc680('0x44')]?_0x2a92ea['attributes']:_0x1e32bb['model'];if(_0x33405c[_0xc680('0x3d')][_0xc680('0x4b')]){_0x2a92ea[_0xc680('0x4e')]=[{'all':!![]}];}_0x2a92ea=_[_0xc680('0x48')]({},_0x2a92ea,_0x33405c['options']);return db[_0xc680('0x4a')][_0xc680('0x4f')](_0x2a92ea)[_0xc680('0x22')](handleEntityNotFound(_0xbe0072,null))[_0xc680('0x22')](respondWithResult(_0xbe0072,null))[_0xc680('0x2b')](handleError(_0xbe0072,null));};exports[_0xc680('0x50')]=function(_0x39f095,_0x19cb91){return db[_0xc680('0x4a')][_0xc680('0x50')](_0x39f095['body'],{})[_0xc680('0x22')](respondWithResult(_0x19cb91,0xc9))[_0xc680('0x2b')](handleError(_0x19cb91,null));};exports[_0xc680('0x51')]=function(_0x307333,_0x2440b0){if(_0x307333[_0xc680('0x52')]['id']){delete _0x307333[_0xc680('0x52')]['id'];}return db[_0xc680('0x4a')][_0xc680('0x4f')]({'where':{'id':_0x307333[_0xc680('0x53')]['id']}})[_0xc680('0x22')](handleEntityNotFound(_0x2440b0,null))[_0xc680('0x22')](saveUpdates(_0x307333[_0xc680('0x52')],null))[_0xc680('0x22')](respondWithResult(_0x2440b0,null))[_0xc680('0x2b')](handleError(_0x2440b0,null));};exports[_0xc680('0x35')]=function(_0x1d3327,_0x2a4c12){return db[_0xc680('0x4a')][_0xc680('0x4f')]({'where':{'id':_0x1d3327['params']['id']}})[_0xc680('0x22')](handleEntityNotFound(_0x2a4c12,null))[_0xc680('0x22')](removeEntity(_0x2a4c12,null))[_0xc680('0x2b')](handleError(_0x2a4c12,null));};exports[_0xc680('0x54')]=function(_0x21a33c,_0x3737cd){return db[_0xc680('0x4a')][_0xc680('0x54')]()[_0xc680('0x22')](respondWithResult(_0x3737cd,null))[_0xc680('0x2b')](handleError(_0x3737cd,null));};var interaction_log=require('../../config/logger')(_0xc680('0x55'));exports[_0xc680('0x56')]=function(_0x216169,_0x173729,_0x40bc9d){var _0x58085c={'agent':{},'channel':_0xc680('0x57')};if(_0x216169[_0xc680('0x52')]['id']){delete _0x216169[_0xc680('0x52')]['id'];}_0x216169[_0xc680('0x52')][_0xc680('0x58')]=!![];_0x216169[_0xc680('0x52')][_0xc680('0x59')]=moment()[_0xc680('0x5a')](_0xc680('0x5b'));_0x216169[_0xc680('0x52')][_0xc680('0x5c')]=_0x216169[_0xc680('0x52')]['UserId']||_0x216169[_0xc680('0x5d')]['id'];_0x58085c[_0xc680('0x5e')]['id']=_0x216169[_0xc680('0x52')][_0xc680('0x5c')];return db[_0xc680('0x4a')]['find']({'where':{'id':_0x216169[_0xc680('0x53')]['id'],'UserId':null}})[_0xc680('0x22')](handleEntityNotFound(_0x173729,null))[_0xc680('0x22')](saveUpdates(_0x216169[_0xc680('0x52')],null))[_0xc680('0x22')](function(_0x1bfdac){if(_0x1bfdac){_0x58085c['message']=_0x1bfdac[_0xc680('0x5f')]({'plain':!![]});return db[_0xc680('0x60')][_0xc680('0x4f')]({'where':{'id':_0x1bfdac[_0xc680('0x61')]}});}return null;})[_0xc680('0x22')](handleEntityNotFound(_0x173729,null))[_0xc680('0x22')](function(_0x388ed5){if(_0x388ed5){return _0x388ed5[_0xc680('0x51')]({'UserId':_0x216169[_0xc680('0x52')][_0xc680('0x5c')],'read1stAt':_[_0xc680('0x62')](_0x388ed5[_0xc680('0x63')])?moment()[_0xc680('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc680('0x22')](function(_0xf9bed4){if(_0xf9bed4){_0x58085c[_0xc680('0x64')]=_0xf9bed4[_0xc680('0x5f')]({'plain':!![]});interaction_log[_0xc680('0x65')](_0xc680('0x66'),_0x216169[_0xc680('0x5d')]['id'],_0x216169[_0xc680('0x5d')][_0xc680('0x38')],_0x216169[_0xc680('0x5d')][_0xc680('0x67')],_0x58085c['interaction']['id'],_0x216169[_0xc680('0x52')]?JSON[_0xc680('0x68')](_0x216169[_0xc680('0x52')]):_0xc680('0x69'));return respondWithRpcPromise('AcceptMessage',_0xc680('0x6a'),_0x58085c);}return null;})[_0xc680('0x22')](function(_0x49a1ad){var _0x1fb4ae=_0xc680('0x6b')+_0x49a1ad[_0xc680('0x29')][_0xc680('0x6c')];return db['sequelize'][_0xc680('0x3d')](_0x1fb4ae,{'type':db['Sequelize'][_0xc680('0x6d')][_0xc680('0x6e')],'raw':!![]})[_0xc680('0x22')](function(_0x20a098){return _0x20a098;});})['then'](function(_0x4d6240){if(_0x4d6240){_0x58085c[_0xc680('0x29')]['contact']=_0x4d6240[0x0];if(!_0x216169[_0xc680('0x52')][_0xc680('0x5c')])return;return db[_0xc680('0x6f')][_0xc680('0x4f')]({'where':{'id':_0x216169[_0xc680('0x52')][_0xc680('0x5c')],'role':_0xc680('0x5e')},'attributes':['id','name',_0xc680('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xc680('0x22')](function(_0x45ccbb){if(!_0x45ccbb)return null;_0x58085c[_0xc680('0x29')][_0xc680('0x5e')]=_0x45ccbb;return _0x58085c;})[_0xc680('0x22')](function(_0x11247a){if(_0x11247a){if(_0x216169[_0xc680('0x52')][_0xc680('0x71')]){_0x58085c['message'][_0xc680('0x72')]=util[_0xc680('0x5a')](_0xc680('0x73'),_0x216169[_0xc680('0x5d')][_0xc680('0x38')]);_0x58085c[_0xc680('0x29')]['channel']=_0x58085c[_0xc680('0x74')];_0x58085c['message'][_0xc680('0x75')]=_0x58085c[_0xc680('0x74')];_0x58085c[_0xc680('0x29')][_0xc680('0x76')]='accept';return respondWithRpcPromise(_0xc680('0x77'),'EventManager',{'event':_0xc680('0x78'),'message':_0x58085c[_0xc680('0x29')]},client9002)[_0xc680('0x22')](function(){return _0x58085c;});}return _0x58085c;}return null;})[_0xc680('0x22')](respondWithResult(_0x173729,null))['catch'](handleError(_0x173729,null));};var interaction_log=require('../../config/logger')(_0xc680('0x55'));exports[_0xc680('0x34')]=function(_0x53623e,_0x59c4ad,_0x50b06f){var _0x383284={'agent':{},'channel':_0xc680('0x57')};if(_0x53623e[_0xc680('0x52')]['id']){delete _0x53623e[_0xc680('0x52')]['id'];}_0x53623e[_0xc680('0x52')][_0xc680('0x5c')]=_0x53623e['body'][_0xc680('0x5c')]||_0x53623e[_0xc680('0x5d')]['id'];_0x383284[_0xc680('0x5e')]['id']=_0x53623e[_0xc680('0x52')]['UserId'];return db['WhatsappMessage'][_0xc680('0x4f')]({'where':{'id':_0x53623e[_0xc680('0x53')]['id'],'UserId':null}})[_0xc680('0x22')](handleEntityNotFound(_0x59c4ad,null))['then'](function(_0x1533c5){if(_0x1533c5){_0x383284[_0xc680('0x29')]=_0x1533c5[_0xc680('0x5f')]({'plain':!![]});return db[_0xc680('0x60')][_0xc680('0x4f')]({'where':{'id':_0x1533c5['WhatsappInteractionId']}});}return null;})[_0xc680('0x22')](handleEntityNotFound(_0x59c4ad,null))[_0xc680('0x22')](function(_0xb4b5ef){if(_0xb4b5ef){_0x383284['interaction']=_0xb4b5ef['get']({'plain':!![]});interaction_log[_0xc680('0x65')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53623e[_0xc680('0x5d')]['id'],_0x53623e[_0xc680('0x5d')][_0xc680('0x38')],_0x53623e['user'][_0xc680('0x67')],_0x383284[_0xc680('0x64')]['id'],_0x53623e[_0xc680('0x52')]?JSON['stringify'](_0x53623e[_0xc680('0x52')]):_0xc680('0x69'));return respondWithRpcPromise(_0xc680('0x79'),_0xc680('0x7a'),_0x383284);}return null;})[_0xc680('0x22')](function(_0x3e1406){var _0x49b0f6=_0xc680('0x6b')+_0x3e1406[_0xc680('0x29')][_0xc680('0x6c')];return db[_0xc680('0x7b')]['query'](_0x49b0f6,{'type':db[_0xc680('0x7c')][_0xc680('0x6d')][_0xc680('0x6e')],'raw':!![]})[_0xc680('0x22')](function(_0x21bd76){return _0x21bd76;});})[_0xc680('0x22')](function(_0x54c52f){if(_0x54c52f){_0x383284['message'][_0xc680('0x7d')]=_0x54c52f[0x0];if(!_0x53623e[_0xc680('0x52')][_0xc680('0x5c')])return;return db[_0xc680('0x6f')][_0xc680('0x4f')]({'where':{'id':_0x53623e[_0xc680('0x52')][_0xc680('0x5c')],'role':'agent'},'attributes':['id',_0xc680('0x38'),_0xc680('0x70'),_0xc680('0x7e'),_0xc680('0x7f')],'raw':!![]});}return null;})['then'](function(_0x1255fd){if(!_0x1255fd)return null;_0x383284[_0xc680('0x29')][_0xc680('0x5e')]=_0x1255fd;return _0x383284;})['then'](function(_0x5bc839){if(_0x5bc839){_0x5bc839[_0xc680('0x29')][_0xc680('0x72')]=util[_0xc680('0x5a')]('SIP/%s',_0x53623e[_0xc680('0x5d')][_0xc680('0x38')]);_0x5bc839[_0xc680('0x29')]['channel']=_0x383284['channel'];_0x5bc839[_0xc680('0x29')][_0xc680('0x75')]=_0x383284['channel'];_0x5bc839[_0xc680('0x29')][_0xc680('0x76')]=_0xc680('0x34');respondWithRpcPromise(_0xc680('0x77'),_0xc680('0x77'),{'event':'rejectmessage','message':_0x5bc839[_0xc680('0x29')]},client9002);return _0x383284;}return null;})[_0xc680('0x22')](respondWithResult(_0x59c4ad,null))[_0xc680('0x2b')](handleError(_0x59c4ad,null));};exports[_0xc680('0x2c')]=function(_0x35745b,_0x4b58a7,_0x98418e){if(_0x35745b['body']['id']){delete _0x35745b['body']['id'];}var _0x24aea1;return db[_0xc680('0x4a')][_0xc680('0x4f')]({'where':{'id':_0x35745b[_0xc680('0x53')]['id']}})[_0xc680('0x22')](handleEntityNotFound(_0x4b58a7,null))[_0xc680('0x22')](function(_0x4f98a6){if(_0x4f98a6){_0x24aea1=_0x4f98a6;return db[_0xc680('0x80')][_0xc680('0x4f')]({'where':{'id':_0x4f98a6[_0xc680('0x81')]}});}})['then'](handleEntityNotFound(_0x4b58a7,null))[_0xc680('0x22')](function(_0x112c0e){if(_0x112c0e){logger[_0xc680('0x24')](_0xc680('0x82'),_0xc680('0x2c'),'received\x20delivery\x20report\x20from',_0x112c0e[_0xc680('0x3c')],util[_0xc680('0x83')](_0x35745b[_0xc680('0x52')],{'showHidden':![],'depth':null}));switch(_0x112c0e[_0xc680('0x3c')]){case _0xc680('0x84'):if(_0x35745b['body'][_0xc680('0x85')]&&_0x35745b['body'][_0xc680('0x85')]===_0x24aea1[_0xc680('0x86')]&&_0x35745b[_0xc680('0x52')][_0xc680('0x87')]&&_0x35745b['body'][_0xc680('0x87')]===_0xc680('0x58')){return _0x24aea1[_0xc680('0x51')]({'read':!![]});}else{logger[_0xc680('0x26')](_0xc680('0x88'),_0xc680('0x2c'),'twilio',util[_0xc680('0x83')](_0x35745b[_0xc680('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x24aea1;}})[_0xc680('0x22')](respondWithResult(_0x4b58a7,null))[_0xc680('0x2b')](handleError(_0x4b58a7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ed70b43..05c20f1 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 _0x98e5=['setMaxListeners','save','remove','emit','hook','exports'];(function(_0x196e03,_0x2f48f1){var _0xa06cb5=function(_0xb40c8e){while(--_0xb40c8e){_0x196e03['push'](_0x196e03['shift']());}};_0xa06cb5(++_0x2f48f1);}(_0x98e5,0x8a));var _0x598e=function(_0x98a39e,_0x4ad8b4){_0x98a39e=_0x98a39e-0x0;var _0x28c926=_0x98e5[_0x98a39e];return _0x28c926;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x598e('0x0')](0x0);var events={'afterCreate':_0x598e('0x1'),'afterUpdate':'update','afterDestroy':_0x598e('0x2')};function emitEvent(_0xc090ec){return function(_0x5cc274,_0x3af01f,_0x5a876c){WhatsappMessageEvents['emit'](_0xc090ec+':'+_0x5cc274['id'],_0x5cc274);WhatsappMessageEvents[_0x598e('0x3')](_0xc090ec,_0x5cc274);_0x5a876c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x598e('0x4')](e,emitEvent(event));}}module[_0x598e('0x5')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8d05=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x4239c8,_0x2c0c6e){var _0x40323b=function(_0x598d03){while(--_0x598d03){_0x4239c8['push'](_0x4239c8['shift']());}};_0x40323b(++_0x2c0c6e);}(_0x8d05,0xe8));var _0x58d0=function(_0x565732,_0x367108){_0x565732=_0x565732-0x0;var _0x582fb4=_0x8d05[_0x565732];return _0x582fb4;};'use strict';var EventEmitter=require(_0x58d0('0x0'));var WhatsappMessage=require(_0x58d0('0x1'))['db'][_0x58d0('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x58d0('0x3')](0x0);var events={'afterCreate':_0x58d0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x276e0a){return function(_0x3de956,_0x1a2d82,_0x55f391){WhatsappMessageEvents['emit'](_0x276e0a+':'+_0x3de956['id'],_0x3de956);WhatsappMessageEvents[_0x58d0('0x5')](_0x276e0a,_0x3de956);_0x55f391(null);};}for(var e in events){if(events[_0x58d0('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x58d0('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a8689bd..4bbc0d6 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 _0x207c=['WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','define','whatsapp_messages','messageId','body','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','error','out'];(function(_0x5925e9,_0x51b161){var _0x72efff=function(_0x428750){while(--_0x428750){_0x5925e9['push'](_0x5925e9['shift']());}};_0x72efff(++_0x51b161);}(_0x207c,0x1e8));var _0xc207=function(_0x3b1705,_0x17bf2e){_0x3b1705=_0x3b1705-0x0;var _0x5157a3=_0x207c[_0x3b1705];return _0x5157a3;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fetch=require(_0xc207('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc207('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0xc88789,_0x314561){return _0xc88789[_0xc207('0x8')]('WhatsappMessage',attributes,{'tableName':_0xc207('0x9'),'paranoid':![],'indexes':[{'name':_0xc207('0xa'),'fields':[_0xc207('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0xc207('0xb')],'type':_0xc207('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x216e14,_0x13ec41,_0x201162){var _0x347549=_0xc88789['models'];var _0x574425=_0x216e14['get']({'plain':!![]});if(_0x574425[_0xc207('0xd')]['toLowerCase']()==='in'||_0x574425[_0xc207('0xd')][_0xc207('0xe')]()==='out'&&!_0x574425[_0xc207('0xf')]&&!_[_0xc207('0x10')](_0x574425[_0xc207('0x11')])){_0x347549[_0xc207('0x12')][_0xc207('0x13')]({'where':{'id':_0x574425['WhatsappInteractionId']}})[_0xc207('0x14')](function(_0x3c77b7){if(_0x3c77b7){_0x3c77b7[_0xc207('0x15')]({'lastMsgAt':_0x574425[_0xc207('0x16')],'lastMsgDirection':_0x574425['direction']['toLowerCase']()});}})['catch'](function(_0x1cebfa){console[_0xc207('0x17')](_0x1cebfa);});}if(_0x574425[_0xc207('0xd')]===_0xc207('0x18')&&!_0x574425['secret']){var _0x1bc70c;_0x347549[_0xc207('0x19')][_0xc207('0x1a')]({'where':{'id':_0x574425['WhatsappAccountId']},'raw':!![]})[_0xc207('0x14')](function(_0x488cc0){_0x1bc70c=_0x488cc0;if(_0x1bc70c&&_0x1bc70c[_0xc207('0x1b')]){switch(_0x1bc70c[_0xc207('0x1b')]){case _0xc207('0x1c'):var _0x461f6a=require(_0xc207('0x1c'));if(_0x1bc70c[_0xc207('0x1d')]&&_0x1bc70c[_0xc207('0x1e')]&&_0x1bc70c[_0xc207('0x1f')]){var _0x212005=new _0x461f6a(_0x1bc70c[_0xc207('0x1d')],_0x1bc70c[_0xc207('0x1e')]);_0x212005[_0xc207('0x20')][_0xc207('0x21')]({'body':_0x574425['body'],'to':_0xc207('0x22')+_0x574425['phone'],'from':_0xc207('0x22')+_0x1bc70c[_0xc207('0x1f')],'statusCallback':_0x1bc70c[_0xc207('0x23')]+_0xc207('0x24')+_0x574425['id']+_0xc207('0x25')+_0x1bc70c[_0xc207('0x26')]})[_0xc207('0x14')](function(_0x1493fb){if(_0x1493fb[_0xc207('0x27')]){return _0x216e14[_0xc207('0x15')]({'messageId':_0x1493fb[_0xc207('0x27')]});}})[_0xc207('0x28')](function(_0x3f738e){logger[_0xc207('0x17')](_0xc207('0x29'),'afterCreate',_0xc207('0x1c'),util['inspect'](_0x3f738e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc207('0x29'),_0xc207('0x2a'),_0xc207('0x1c'),_0xc207('0x2b'));}break;case _0xc207('0x2c'):var _0x478af7=_0x1bc70c[_0xc207('0x1d')];var _0x463ac8=_0x1bc70c[_0xc207('0x1e')];var _0x1bec3f=_0x1bc70c[_0xc207('0x2d')]+_0xc207('0x2e')+_0x478af7+_0xc207('0x2f');var _0x27bc72={'to':[_0x574425[_0xc207('0x1f')]],'message':{'type':_0xc207('0x30'),'text':_0x574425[_0xc207('0xb')]}};var _0xaa1b54={'method':_0xc207('0x31'),'uri':_0x1bec3f,'headers':{'Authorization':'Bearer\x20'+_0x463ac8,'Content-Type':_0xc207('0x32')},'body':_0x27bc72,'json':!![]};rp(_0xaa1b54)[_0xc207('0x14')](function(_0x1c4027){if(_0x1c4027[_0xc207('0x33')][0x0][_0xc207('0x34')]){return _0x216e14[_0xc207('0x15')]({'messageId':_0x1c4027['statuses'][0x0][_0xc207('0x34')]});}})[_0xc207('0x28')](function(_0x3899dd){logger[_0xc207('0x35')]('WhatsappMessage,\x20%s',_0x3899dd);});break;}}})[_0xc207('0x36')](function(){_0x201162();});}else{_0x201162();}}},'charset':_0xc207('0x37'),'collate':_0xc207('0x38')});}; \ No newline at end of file +var _0xea7a=['./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','findOne','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','phone','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment'];(function(_0x2a7ddc,_0x6e091e){var _0xa46186=function(_0x50a464){while(--_0x50a464){_0x2a7ddc['push'](_0x2a7ddc['shift']());}};_0xa46186(++_0x6e091e);}(_0xea7a,0x1b7));var _0xaea7=function(_0x2e0f6e,_0x368285){_0x2e0f6e=_0x2e0f6e-0x0;var _0x589be3=_0xea7a[_0x2e0f6e];return _0x589be3;};'use strict';var _=require('lodash');var util=require(_0xaea7('0x0'));var logger=require('../../config/logger')(_0xaea7('0x1'));var moment=require(_0xaea7('0x2'));var BPromise=require(_0xaea7('0x3'));var rp=require(_0xaea7('0x4'));var fetch=require(_0xaea7('0x5'));var fs=require('fs');var path=require(_0xaea7('0x6'));var rimraf=require(_0xaea7('0x7'));var config=require(_0xaea7('0x8'));var attributes=require(_0xaea7('0x9'));module[_0xaea7('0xa')]=function(_0x1ed322,_0x23af01){return _0x1ed322['define'](_0xaea7('0xb'),attributes,{'tableName':_0xaea7('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xaea7('0xd')],'type':_0xaea7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd61604,_0x2fbf42,_0x3a558a){var _0x4f18b5=_0x1ed322[_0xaea7('0xf')];var _0x9a6e08=_0xd61604['get']({'plain':!![]});if(_0x9a6e08[_0xaea7('0x10')][_0xaea7('0x11')]()==='in'||_0x9a6e08[_0xaea7('0x10')][_0xaea7('0x11')]()===_0xaea7('0x12')&&!_0x9a6e08[_0xaea7('0x13')]&&!_['isNil'](_0x9a6e08[_0xaea7('0x14')])){_0x4f18b5['WhatsappInteraction'][_0xaea7('0x15')]({'where':{'id':_0x9a6e08['WhatsappInteractionId']}})[_0xaea7('0x16')](function(_0x4e9d23){if(_0x4e9d23){_0x4e9d23['update']({'lastMsgAt':_0x9a6e08[_0xaea7('0x17')],'lastMsgDirection':_0x9a6e08[_0xaea7('0x10')][_0xaea7('0x11')]()});}})[_0xaea7('0x18')](function(_0x4e6c1a){console[_0xaea7('0x19')](_0x4e6c1a);});}if(_0x9a6e08['direction']===_0xaea7('0x12')&&!_0x9a6e08[_0xaea7('0x13')]){var _0x9ebb7f;_0x4f18b5[_0xaea7('0x1a')][_0xaea7('0x1b')]({'where':{'id':_0x9a6e08[_0xaea7('0x1c')]},'raw':!![]})['then'](function(_0x208c45){_0x9ebb7f=_0x208c45;if(_0x9ebb7f&&_0x9ebb7f[_0xaea7('0x1d')]){switch(_0x9ebb7f[_0xaea7('0x1d')]){case _0xaea7('0x1e'):var _0x4e1345=require(_0xaea7('0x1e'));if(_0x9ebb7f[_0xaea7('0x1f')]&&_0x9ebb7f[_0xaea7('0x20')]&&_0x9ebb7f['phone']){var _0x31fb34=new _0x4e1345(_0x9ebb7f['accountSid'],_0x9ebb7f[_0xaea7('0x20')]);_0x31fb34['messages'][_0xaea7('0x21')]({'body':_0x9a6e08[_0xaea7('0xd')],'to':'whatsapp:'+_0x9a6e08[_0xaea7('0x22')],'from':_0xaea7('0x23')+_0x9ebb7f['phone'],'statusCallback':_0x9ebb7f[_0xaea7('0x24')]+_0xaea7('0x25')+_0x9a6e08['id']+'/status?token='+_0x9ebb7f[_0xaea7('0x26')]})[_0xaea7('0x16')](function(_0xf3ae62){if(_0xf3ae62[_0xaea7('0x27')]){return _0xd61604['update']({'messageId':_0xf3ae62[_0xaea7('0x27')]});}})[_0xaea7('0x18')](function(_0x171cb2){logger[_0xaea7('0x19')](_0xaea7('0x28'),_0xaea7('0x29'),'twilio',util[_0xaea7('0x2a')](_0x171cb2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaea7('0x28'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xaea7('0x2b'):var _0x4469f2=_0x9ebb7f[_0xaea7('0x1f')];var _0x242251=_0x9ebb7f[_0xaea7('0x20')];var _0x2b6017=_0x9ebb7f[_0xaea7('0x2c')]+_0xaea7('0x2d')+_0x4469f2+_0xaea7('0x2e');var _0x559195={'to':[_0x9a6e08[_0xaea7('0x22')]],'message':{'type':_0xaea7('0x2f'),'text':_0x9a6e08[_0xaea7('0xd')]}};var _0x54ff1c={'method':'POST','uri':_0x2b6017,'headers':{'Authorization':'Bearer\x20'+_0x242251,'Content-Type':_0xaea7('0x30')},'body':_0x559195,'json':!![]};rp(_0x54ff1c)[_0xaea7('0x16')](function(_0x99a180){if(_0x99a180[_0xaea7('0x31')][0x0][_0xaea7('0x32')]){return _0xd61604['update']({'messageId':_0x99a180[_0xaea7('0x31')][0x0][_0xaea7('0x32')]});}})[_0xaea7('0x18')](function(_0x56187b){logger[_0xaea7('0x33')](_0xaea7('0x34'),_0x56187b);});break;}}})[_0xaea7('0x35')](function(){_0x3a558a();});}else{_0x3a558a();}}},'charset':_0xaea7('0x36'),'collate':_0xaea7('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 85bab47..02259a5 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 _0xfc4c=['defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xfc4c,0x151));var _0xcfc4=function(_0xc5fc35,_0x4ccb1d){_0xc5fc35=_0xc5fc35-0x0;var _0xdea0a4=_0xfc4c[_0xc5fc35];return _0xdea0a4;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var moment=require(_0xcfc4('0x2'));var BPromise=require(_0xcfc4('0x3'));var rs=require(_0xcfc4('0x4'));var fs=require('fs');var Redis=require(_0xcfc4('0x5'));var db=require(_0xcfc4('0x6'))['db'];var utils=require(_0xcfc4('0x7'));var logger=require(_0xcfc4('0x8'))('rpc');var config=require(_0xcfc4('0x9'));var jayson=require(_0xcfc4('0xa'));var client=jayson[_0xcfc4('0xb')]['http']({'port':0x232a});config[_0xcfc4('0xc')]=_[_0xcfc4('0xd')](config['redis'],{'host':_0xcfc4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfc4('0xc')]));require(_0xcfc4('0xf'))[_0xcfc4('0x10')](socket);function respondWithRpcPromise(_0x41921e,_0x4b39f1,_0x17384a){return new BPromise(function(_0x5789ce,_0x98c25e){return client[_0xcfc4('0x11')](_0x41921e,_0x17384a)[_0xcfc4('0x12')](function(_0x82e8a4){logger[_0xcfc4('0x13')](_0xcfc4('0x14'),_0x4b39f1,_0xcfc4('0x15'));logger['debug'](_0xcfc4('0x16'),_0x4b39f1,_0xcfc4('0x15'),JSON[_0xcfc4('0x17')](_0x82e8a4));if(_0x82e8a4[_0xcfc4('0x18')]){if(_0x82e8a4[_0xcfc4('0x18')][_0xcfc4('0x19')]===0x1f4){logger[_0xcfc4('0x18')](_0xcfc4('0x14'),_0x4b39f1,_0x82e8a4[_0xcfc4('0x18')][_0xcfc4('0x1a')]);return _0x98c25e(_0x82e8a4[_0xcfc4('0x18')][_0xcfc4('0x1a')]);}logger[_0xcfc4('0x18')](_0xcfc4('0x14'),_0x4b39f1,_0x82e8a4[_0xcfc4('0x18')][_0xcfc4('0x1a')]);return _0x5789ce(_0x82e8a4[_0xcfc4('0x18')][_0xcfc4('0x1a')]);}else{logger[_0xcfc4('0x13')](_0xcfc4('0x14'),_0x4b39f1,'request\x20sent');_0x5789ce(_0x82e8a4[_0xcfc4('0x1b')][_0xcfc4('0x1a')]);}})[_0xcfc4('0x1c')](function(_0x4b906d){logger[_0xcfc4('0x18')](_0xcfc4('0x14'),_0x4b39f1,_0x4b906d);_0x98c25e(_0x4b906d);});});}exports[_0xcfc4('0x1d')]=function(_0x2cd3e0){var _0x3a290d=this;return new Promise(function(_0x29ba60,_0x1afab5){return db[_0xcfc4('0x1e')][_0xcfc4('0x1f')](_0x2cd3e0[_0xcfc4('0x20')],{'raw':_0x2cd3e0[_0xcfc4('0x21')]?_0x2cd3e0['options']['raw']===undefined?!![]:![]:!![]})[_0xcfc4('0x12')](function(_0x446ae0){logger[_0xcfc4('0x13')](_0xcfc4('0x1d'),_0x2cd3e0);logger[_0xcfc4('0x22')](_0xcfc4('0x1d'),_0x2cd3e0,JSON[_0xcfc4('0x17')](_0x446ae0));_0x29ba60(_0x446ae0);})[_0xcfc4('0x1c')](function(_0x104539){logger[_0xcfc4('0x18')]('CreateWhatsappMessage',_0x104539[_0xcfc4('0x1a')],_0x2cd3e0);_0x1afab5(_0x3a290d[_0xcfc4('0x18')](0x1f4,_0x104539[_0xcfc4('0x1a')]));});});}; \ No newline at end of file +var _0x4550=['request\x20sent','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x4550,0x16e));var _0x0455=function(_0x2657f4,_0x2e5594){_0x2657f4=_0x2657f4-0x0;var _0x370086=_0x4550[_0x2657f4];return _0x370086;};'use strict';var _=require(_0x0455('0x0'));var util=require(_0x0455('0x1'));var moment=require('moment');var BPromise=require(_0x0455('0x2'));var rs=require(_0x0455('0x3'));var fs=require('fs');var Redis=require(_0x0455('0x4'));var db=require(_0x0455('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0455('0x6'));var config=require(_0x0455('0x7'));var jayson=require(_0x0455('0x8'));var client=jayson[_0x0455('0x9')][_0x0455('0xa')]({'port':0x232a});config['redis']=_[_0x0455('0xb')](config[_0x0455('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0455('0xd'))(new Redis(config[_0x0455('0xc')]));require(_0x0455('0xe'))[_0x0455('0xf')](socket);function respondWithRpcPromise(_0x1af384,_0x4e1516,_0x1dd679){return new BPromise(function(_0x48079b,_0x53ee5c){return client[_0x0455('0x10')](_0x1af384,_0x1dd679)[_0x0455('0x11')](function(_0x4f2117){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4e1516,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4e1516,_0x0455('0x12'),JSON['stringify'](_0x4f2117));if(_0x4f2117[_0x0455('0x13')]){if(_0x4f2117[_0x0455('0x13')][_0x0455('0x14')]===0x1f4){logger[_0x0455('0x13')](_0x0455('0x15'),_0x4e1516,_0x4f2117[_0x0455('0x13')]['message']);return _0x53ee5c(_0x4f2117['error']['message']);}logger[_0x0455('0x13')](_0x0455('0x15'),_0x4e1516,_0x4f2117['error'][_0x0455('0x16')]);return _0x48079b(_0x4f2117[_0x0455('0x13')][_0x0455('0x16')]);}else{logger[_0x0455('0x17')](_0x0455('0x15'),_0x4e1516,_0x0455('0x12'));_0x48079b(_0x4f2117[_0x0455('0x18')][_0x0455('0x16')]);}})[_0x0455('0x19')](function(_0xb1444d){logger[_0x0455('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4e1516,_0xb1444d);_0x53ee5c(_0xb1444d);});});}exports[_0x0455('0x1a')]=function(_0x2ec7e9){var _0x17dd52=this;return new Promise(function(_0x2d254b,_0x26bdaf){return db[_0x0455('0x1b')][_0x0455('0x1c')](_0x2ec7e9['body'],{'raw':_0x2ec7e9['options']?_0x2ec7e9[_0x0455('0x1d')][_0x0455('0x1e')]===undefined?!![]:![]:!![]})[_0x0455('0x11')](function(_0x26f515){logger[_0x0455('0x17')](_0x0455('0x1a'),_0x2ec7e9);logger['debug'](_0x0455('0x1a'),_0x2ec7e9,JSON[_0x0455('0x1f')](_0x26f515));_0x2d254b(_0x26f515);})[_0x0455('0x19')](function(_0x2face7){logger[_0x0455('0x13')](_0x0455('0x1a'),_0x2face7[_0x0455('0x16')],_0x2ec7e9);_0x26bdaf(_0x17dd52[_0x0455('0x13')](0x1f4,_0x2face7['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5e310a5..82afce6 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 _0x51d7=['register','length','whatsappMessage:','./whatsappMessage.events','save','emit','removeListener'];(function(_0x5614fb,_0x57e908){var _0x1bc73d=function(_0x1c4d0d){while(--_0x1c4d0d){_0x5614fb['push'](_0x5614fb['shift']());}};_0x1bc73d(++_0x57e908);}(_0x51d7,0x7a));var _0x751d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x51d7[_0x1cc8fe];return _0x230054;};'use strict';var WhatsappMessageEvents=require(_0x751d('0x0'));var events=[_0x751d('0x1'),'remove','update'];function createListener(_0x5d0309,_0xde7833){return function(_0x44c93b){_0xde7833[_0x751d('0x2')](_0x5d0309,_0x44c93b);};}function removeListener(_0x1be693,_0x2fbe33){return function(){WhatsappMessageEvents[_0x751d('0x3')](_0x1be693,_0x2fbe33);};}exports[_0x751d('0x4')]=function(_0xb7c829){for(var _0x1f503a=0x0,_0x5cf059=events[_0x751d('0x5')];_0x1f503a<_0x5cf059;_0x1f503a++){var _0x26f02b=events[_0x1f503a];var _0x555a2d=createListener(_0x751d('0x6')+_0x26f02b,_0xb7c829);WhatsappMessageEvents['on'](_0x26f02b,_0x555a2d);}}; \ No newline at end of file +var _0xa96a=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x75267d,_0x5d286c){var _0x21ccec=function(_0x1a3c1f){while(--_0x1a3c1f){_0x75267d['push'](_0x75267d['shift']());}};_0x21ccec(++_0x5d286c);}(_0xa96a,0x1e9));var _0xaa96=function(_0x4f16b0,_0x1122c2){_0x4f16b0=_0x4f16b0-0x0;var _0x1ff130=_0xa96a[_0x4f16b0];return _0x1ff130;};'use strict';var WhatsappMessageEvents=require(_0xaa96('0x0'));var events=[_0xaa96('0x1'),_0xaa96('0x2'),_0xaa96('0x3')];function createListener(_0x411942,_0x10ebce){return function(_0x47ac48){_0x10ebce[_0xaa96('0x4')](_0x411942,_0x47ac48);};}function removeListener(_0x3c7cb8,_0x15d6b5){return function(){WhatsappMessageEvents[_0xaa96('0x5')](_0x3c7cb8,_0x15d6b5);};}exports[_0xaa96('0x6')]=function(_0x2dea3b){for(var _0x25da0f=0x0,_0x382202=events[_0xaa96('0x7')];_0x25da0f<_0x382202;_0x25da0f++){var _0x1af194=events[_0x25da0f];var _0xe37f93=createListener(_0xaa96('0x8')+_0x1af194,_0x2dea3b);WhatsappMessageEvents['on'](_0x1af194,_0xe37f93);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 8a44b78..b51378e 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 _0xb1a2=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x18a441,_0x584b98){var _0x411a12=function(_0xbf97cb){while(--_0xbf97cb){_0x18a441['push'](_0x18a441['shift']());}};_0x411a12(++_0x584b98);}(_0xb1a2,0x106));var _0x2b1a=function(_0x3e9539,_0x5d9632){_0x3e9539=_0x3e9539-0x0;var _0x13e0ba=_0xb1a2[_0x3e9539];return _0x13e0ba;};'use strict';var multer=require('multer');var util=require(_0x2b1a('0x0'));var path=require(_0x2b1a('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b1a('0x2'));var router=express[_0x2b1a('0x3')]();var fs_extra=require(_0x2b1a('0x4'));var auth=require(_0x2b1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b1a('0x6'));var controller=require('./whatsappQueue.controller');router[_0x2b1a('0x7')]('/',auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x9')]);router[_0x2b1a('0x7')](_0x2b1a('0xa'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0xb')]);router[_0x2b1a('0x7')](_0x2b1a('0xc'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0xd')]);router['get'](_0x2b1a('0xe'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0xf')]);router[_0x2b1a('0x7')](_0x2b1a('0x10'),auth[_0x2b1a('0x8')](),controller['getTeams']);router[_0x2b1a('0x7')]('/:id/users',auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x11')]);router[_0x2b1a('0x12')]('/',auth['isAuthenticated'](),controller[_0x2b1a('0x13')]);router[_0x2b1a('0x12')](_0x2b1a('0x10'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x14')]);router[_0x2b1a('0x12')](_0x2b1a('0x15'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x16')]);router['put'](_0x2b1a('0xc'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x17')]);router[_0x2b1a('0x18')](_0x2b1a('0xc'),auth['isAuthenticated'](),controller[_0x2b1a('0x19')]);router[_0x2b1a('0x18')]('/:id/teams',auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x1a')]);router['delete'](_0x2b1a('0x15'),auth['isAuthenticated'](),controller[_0x2b1a('0x1b')]);module[_0x2b1a('0x1c')]=router; \ No newline at end of file +var _0x11cc=['addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x4137ca,_0xbb1990){var _0x112743=function(_0x199c5c){while(--_0x199c5c){_0x4137ca['push'](_0x4137ca['shift']());}};_0x112743(++_0xbb1990);}(_0x11cc,0x1d8));var _0xc11c=function(_0x48eddc,_0x5729b2){_0x48eddc=_0x48eddc-0x0;var _0xc8e91f=_0x11cc[_0x48eddc];return _0xc8e91f;};'use strict';var multer=require(_0xc11c('0x0'));var util=require('util');var path=require(_0xc11c('0x1'));var timeout=require(_0xc11c('0x2'));var express=require(_0xc11c('0x3'));var router=express[_0xc11c('0x4')]();var fs_extra=require(_0xc11c('0x5'));var auth=require(_0xc11c('0x6'));var interaction=require(_0xc11c('0x7'));var config=require(_0xc11c('0x8'));var controller=require(_0xc11c('0x9'));router[_0xc11c('0xa')]('/',auth[_0xc11c('0xb')](),controller[_0xc11c('0xc')]);router[_0xc11c('0xa')]('/describe',auth[_0xc11c('0xb')](),controller['describe']);router[_0xc11c('0xa')](_0xc11c('0xd'),auth[_0xc11c('0xb')](),controller['show']);router[_0xc11c('0xa')](_0xc11c('0xe'),auth[_0xc11c('0xb')](),controller['getMembers']);router[_0xc11c('0xa')](_0xc11c('0xf'),auth[_0xc11c('0xb')](),controller[_0xc11c('0x10')]);router['get'](_0xc11c('0x11'),auth[_0xc11c('0xb')](),controller[_0xc11c('0x12')]);router[_0xc11c('0x13')]('/',auth['isAuthenticated'](),controller[_0xc11c('0x14')]);router[_0xc11c('0x13')](_0xc11c('0xf'),auth[_0xc11c('0xb')](),controller[_0xc11c('0x15')]);router[_0xc11c('0x13')](_0xc11c('0x11'),auth['isAuthenticated'](),controller[_0xc11c('0x16')]);router[_0xc11c('0x17')]('/:id',auth[_0xc11c('0xb')](),controller[_0xc11c('0x18')]);router[_0xc11c('0x19')]('/:id',auth[_0xc11c('0xb')](),controller[_0xc11c('0x1a')]);router[_0xc11c('0x19')](_0xc11c('0xf'),auth[_0xc11c('0xb')](),controller[_0xc11c('0x1b')]);router[_0xc11c('0x19')]('/:id/users',auth[_0xc11c('0xb')](),controller['removeAgents']);module[_0xc11c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 45afb9b..9275f54 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 _0xe205=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xe205,0xa7));var _0x5e20=function(_0x56fb23,_0x1d702a){_0x56fb23=_0x56fb23-0x0;var _0x31ce34=_0xe205[_0x56fb23];return _0x31ce34;};'use strict';var Sequelize=require(_0x5e20('0x0'));module[_0x5e20('0x1')]={'name':{'type':Sequelize[_0x5e20('0x2')],'unique':_0x5e20('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5e20('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e20('0x5')](_0x5e20('0x6'),_0x5e20('0x7'),_0x5e20('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x057a=['rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x057a,0x1a6));var _0xa057=function(_0x4b3d46,_0x1bc8bd){_0x4b3d46=_0x4b3d46-0x0;var _0x45b9bc=_0x057a[_0x4b3d46];return _0x45b9bc;};'use strict';var Sequelize=require(_0xa057('0x0'));module[_0xa057('0x1')]={'name':{'type':Sequelize[_0xa057('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa057('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa057('0x4'),_0xa057('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xa057('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c713c67..54cc60a 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 _0xd7c9=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','then','destroy','get','WhatsappQueues','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','describe','getMembers','findOne','UserWhatsappQueue','nolimit','User','UserId','agent','createdAt','%s/%s','whatsappPause','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x3c0c79,_0x1cb348){var _0x2641c9=function(_0x173d52){while(--_0x173d52){_0x3c0c79['push'](_0x3c0c79['shift']());}};_0x2641c9(++_0x1cb348);}(_0xd7c9,0x1a6));var _0x9d7c=function(_0x4084fe,_0x19aad9){_0x4084fe=_0x4084fe-0x0;var _0x598649=_0xd7c9[_0x4084fe];return _0x598649;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d7c('0x0'));var jsonpatch=require(_0x9d7c('0x1'));var rp=require(_0x9d7c('0x2'));var moment=require('moment');var BPromise=require(_0x9d7c('0x3'));var Mustache=require(_0x9d7c('0x4'));var util=require(_0x9d7c('0x5'));var path=require(_0x9d7c('0x6'));var sox=require(_0x9d7c('0x7'));var csv=require(_0x9d7c('0x8'));var ejs=require(_0x9d7c('0x9'));var fs=require('fs');var fs_extra=require(_0x9d7c('0xa'));var _=require(_0x9d7c('0xb'));var squel=require(_0x9d7c('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d7c('0xd'));var deskjs=require(_0x9d7c('0xe'));var toCsv=require(_0x9d7c('0x8'));var querystring=require(_0x9d7c('0xf'));var Papa=require(_0x9d7c('0x10'));var Redis=require('ioredis');var authService=require(_0x9d7c('0x11'));var qs=require(_0x9d7c('0x12'));var as=require(_0x9d7c('0x13'));var hardwareService=require(_0x9d7c('0x14'));var logger=require(_0x9d7c('0x15'))(_0x9d7c('0x16'));var utils=require('../../config/utils');var config=require(_0x9d7c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d7c('0x18'))['db'];config[_0x9d7c('0x19')]=_[_0x9d7c('0x1a')](config['redis'],{'host':_0x9d7c('0x1b'),'port':0x18eb});var socket=require(_0x9d7c('0x1c'))(new Redis(config[_0x9d7c('0x19')]));require(_0x9d7c('0x1d'))[_0x9d7c('0x1e')](socket);function respondWithStatusCode(_0x55c763,_0x412495){_0x412495=_0x412495||0xcc;return function(_0x81c8bd){if(_0x81c8bd){return _0x55c763[_0x9d7c('0x1f')](_0x412495);}return _0x55c763[_0x9d7c('0x20')](_0x412495)[_0x9d7c('0x21')]();};}function respondWithResult(_0x36fd53,_0x566c20){_0x566c20=_0x566c20||0xc8;return function(_0xc871fa){if(_0xc871fa){return _0x36fd53[_0x9d7c('0x20')](_0x566c20)[_0x9d7c('0x22')](_0xc871fa);}};}function respondWithFilteredResult(_0x21f81c,_0x1f9c13){return function(_0x21ee91){if(_0x21ee91){var _0x1c6991=typeof _0x1f9c13[_0x9d7c('0x23')]===_0x9d7c('0x24')&&typeof _0x1f9c13['limit']===_0x9d7c('0x24');var _0x23bf03=_0x21ee91[_0x9d7c('0x25')];var _0x2fb899=_0x1c6991?0x0:_0x1f9c13['offset'];var _0x72db83=_0x1c6991?_0x21ee91['count']:_0x1f9c13[_0x9d7c('0x23')]+_0x1f9c13[_0x9d7c('0x26')];var _0x167aa8;if(_0x72db83>=_0x23bf03){_0x72db83=_0x23bf03;_0x167aa8=0xc8;}else{_0x167aa8=0xce;}_0x21f81c[_0x9d7c('0x20')](_0x167aa8);return _0x21f81c['set'](_0x9d7c('0x27'),_0x2fb899+'-'+_0x72db83+'/'+_0x23bf03)[_0x9d7c('0x22')](_0x21ee91);}return null;};}function patchUpdates(_0x40de92){return function(_0x39654d){try{jsonpatch[_0x9d7c('0x28')](_0x39654d,_0x40de92,!![]);}catch(_0x348f88){return BPromise['reject'](_0x348f88);}return _0x39654d['save']();};}function saveUpdates(_0x3e7ef8,_0x5ea696){return function(_0x2da3a3){if(_0x2da3a3){return _0x2da3a3['update'](_0x3e7ef8)[_0x9d7c('0x29')](function(_0x489bad){return _0x489bad;});}return null;};}function removeEntity(_0x540ea1,_0x18eea3){return function(_0x412a50){if(_0x412a50){return _0x412a50[_0x9d7c('0x2a')]()[_0x9d7c('0x29')](function(){var _0x9a70cd=_0x412a50[_0x9d7c('0x2b')]({'plain':!![]});var _0x1c104e=_0x9d7c('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c104e,'resourceId':_0x9a70cd['id']}})[_0x9d7c('0x29')](function(){return _0x412a50;});})[_0x9d7c('0x29')](function(){_0x540ea1[_0x9d7c('0x20')](0xcc)[_0x9d7c('0x21')]();});}};}function handleEntityNotFound(_0x39dfd7,_0x4dc6cd){return function(_0x1679f8){if(!_0x1679f8){_0x39dfd7['sendStatus'](0x194);}return _0x1679f8;};}function handleError(_0x3bbbe2,_0x29031a){_0x29031a=_0x29031a||0x1f4;return function(_0xb815cb){logger[_0x9d7c('0x2d')](_0xb815cb['stack']);if(_0xb815cb[_0x9d7c('0x2e')]){delete _0xb815cb['name'];}_0x3bbbe2[_0x9d7c('0x20')](_0x29031a)[_0x9d7c('0x2f')](_0xb815cb);};}exports[_0x9d7c('0x30')]=function(_0x5dbcb9,_0x51924c){var _0x1da3e9={},_0x2d3059={},_0x55f559={'count':0x0,'rows':[]};var _0x5d2283=_[_0x9d7c('0x31')](db[_0x9d7c('0x32')][_0x9d7c('0x33')],function(_0x3b4f24){return{'name':_0x3b4f24[_0x9d7c('0x34')],'type':_0x3b4f24[_0x9d7c('0x35')][_0x9d7c('0x36')]};});_0x2d3059[_0x9d7c('0x37')]=_[_0x9d7c('0x31')](_0x5d2283,_0x9d7c('0x2e'));_0x2d3059[_0x9d7c('0x38')]=_[_0x9d7c('0x39')](_0x5dbcb9['query']);_0x2d3059[_0x9d7c('0x3a')]=_[_0x9d7c('0x3b')](_0x2d3059[_0x9d7c('0x37')],_0x2d3059['query']);_0x1da3e9[_0x9d7c('0x3c')]=_[_0x9d7c('0x3b')](_0x2d3059[_0x9d7c('0x37')],qs[_0x9d7c('0x3d')](_0x5dbcb9[_0x9d7c('0x38')][_0x9d7c('0x3d')]));_0x1da3e9[_0x9d7c('0x3c')]=_0x1da3e9[_0x9d7c('0x3c')][_0x9d7c('0x3e')]?_0x1da3e9['attributes']:_0x2d3059[_0x9d7c('0x37')];if(!_0x5dbcb9['query'][_0x9d7c('0x3f')]('nolimit')){_0x1da3e9['limit']=qs[_0x9d7c('0x26')](_0x5dbcb9[_0x9d7c('0x38')][_0x9d7c('0x26')]);_0x1da3e9[_0x9d7c('0x23')]=qs[_0x9d7c('0x23')](_0x5dbcb9['query']['offset']);}_0x1da3e9[_0x9d7c('0x40')]=qs[_0x9d7c('0x41')](_0x5dbcb9['query'][_0x9d7c('0x41')]);_0x1da3e9[_0x9d7c('0x42')]=qs[_0x9d7c('0x3a')](_[_0x9d7c('0x43')](_0x5dbcb9[_0x9d7c('0x38')],_0x2d3059['filters']),_0x5d2283);if(_0x5dbcb9[_0x9d7c('0x38')][_0x9d7c('0x44')]){_0x1da3e9['where']=_[_0x9d7c('0x45')](_0x1da3e9['where'],{'$or':_[_0x9d7c('0x31')](_0x5d2283,function(_0x3d662d){if(_0x3d662d['type']!==_0x9d7c('0x46')){var _0x2c8d1a={};_0x2c8d1a[_0x3d662d[_0x9d7c('0x2e')]]={'$like':'%'+_0x5dbcb9[_0x9d7c('0x38')]['filter']+'%'};return _0x2c8d1a;}})});}_0x1da3e9=_[_0x9d7c('0x45')]({},_0x1da3e9,_0x5dbcb9[_0x9d7c('0x47')]);var _0xb948e7={'where':_0x1da3e9[_0x9d7c('0x42')]};return db[_0x9d7c('0x32')][_0x9d7c('0x25')](_0xb948e7)[_0x9d7c('0x29')](function(_0x117001){_0x55f559['count']=_0x117001;if(_0x5dbcb9[_0x9d7c('0x38')][_0x9d7c('0x48')]){_0x1da3e9['include']=[{'all':!![]}];}return db[_0x9d7c('0x32')][_0x9d7c('0x49')](_0x1da3e9);})['then'](function(_0x2f5fc4){_0x55f559['rows']=_0x2f5fc4;return _0x55f559;})[_0x9d7c('0x29')](respondWithFilteredResult(_0x51924c,_0x1da3e9))[_0x9d7c('0x4a')](handleError(_0x51924c,null));};exports[_0x9d7c('0x4b')]=function(_0x2e8795,_0x314f02){var _0x3bbc58={'raw':!![],'where':{'id':_0x2e8795[_0x9d7c('0x4c')]['id']}},_0x6f4633={};_0x6f4633[_0x9d7c('0x37')]=_['keys'](db['WhatsappQueue'][_0x9d7c('0x33')]);_0x6f4633[_0x9d7c('0x38')]=_['keys'](_0x2e8795[_0x9d7c('0x38')]);_0x6f4633[_0x9d7c('0x3a')]=_[_0x9d7c('0x3b')](_0x6f4633['model'],_0x6f4633[_0x9d7c('0x38')]);_0x3bbc58['attributes']=_['intersection'](_0x6f4633[_0x9d7c('0x37')],qs[_0x9d7c('0x3d')](_0x2e8795['query'][_0x9d7c('0x3d')]));_0x3bbc58[_0x9d7c('0x3c')]=_0x3bbc58['attributes'][_0x9d7c('0x3e')]?_0x3bbc58[_0x9d7c('0x3c')]:_0x6f4633[_0x9d7c('0x37')];if(_0x2e8795['query'][_0x9d7c('0x48')]){_0x3bbc58[_0x9d7c('0x4d')]=[{'all':!![]}];}_0x3bbc58=_[_0x9d7c('0x45')]({},_0x3bbc58,_0x2e8795[_0x9d7c('0x47')]);return db[_0x9d7c('0x32')][_0x9d7c('0x4e')](_0x3bbc58)[_0x9d7c('0x29')](handleEntityNotFound(_0x314f02,null))['then'](respondWithResult(_0x314f02,null))[_0x9d7c('0x4a')](handleError(_0x314f02,null));};exports[_0x9d7c('0x4f')]=function(_0x1520b0,_0x4aac2a){return db[_0x9d7c('0x32')][_0x9d7c('0x4f')](_0x1520b0['body'],{})[_0x9d7c('0x29')](function(_0x1c1b3d){var _0x3260f4=_0x1520b0['user'][_0x9d7c('0x2b')]({'plain':!![]});if(!_0x3260f4)throw new Error(_0x9d7c('0x50'));if(_0x3260f4[_0x9d7c('0x51')]===_0x9d7c('0x52')){var _0x2dfe09=_0x1c1b3d[_0x9d7c('0x2b')]({'plain':!![]});var _0x20f945=_0x9d7c('0x2c');return db[_0x9d7c('0x53')][_0x9d7c('0x4e')]({'where':{'name':_0x20f945,'userProfileId':_0x3260f4[_0x9d7c('0x54')]},'raw':!![]})[_0x9d7c('0x29')](function(_0x419a37){if(_0x419a37&&_0x419a37[_0x9d7c('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x2dfe09[_0x9d7c('0x2e')],'resourceId':_0x2dfe09['id'],'type':_0x419a37['name'],'sectionId':_0x419a37['id']},{})['then'](function(){return _0x1c1b3d;});}else{return _0x1c1b3d;}})[_0x9d7c('0x4a')](function(_0x1ce759){logger[_0x9d7c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ce759);throw _0x1ce759;});}return _0x1c1b3d;})[_0x9d7c('0x29')](respondWithResult(_0x4aac2a,0xc9))[_0x9d7c('0x4a')](handleError(_0x4aac2a,null));};exports[_0x9d7c('0x56')]=function(_0x9392fb,_0x6ccf7){if(_0x9392fb[_0x9d7c('0x57')]['id']){delete _0x9392fb[_0x9d7c('0x57')]['id'];}return db[_0x9d7c('0x32')][_0x9d7c('0x4e')]({'where':{'id':_0x9392fb['params']['id']}})[_0x9d7c('0x29')](handleEntityNotFound(_0x6ccf7,null))['then'](saveUpdates(_0x9392fb['body'],null))[_0x9d7c('0x29')](respondWithResult(_0x6ccf7,null))[_0x9d7c('0x4a')](handleError(_0x6ccf7,null));};exports[_0x9d7c('0x2a')]=function(_0x3a1676,_0xbd9b93){return db[_0x9d7c('0x32')][_0x9d7c('0x4e')]({'where':{'id':_0x3a1676[_0x9d7c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xbd9b93,null))[_0x9d7c('0x29')](removeEntity(_0xbd9b93,null))['catch'](handleError(_0xbd9b93,null));};exports[_0x9d7c('0x58')]=function(_0x290c70,_0x345fc5){return db[_0x9d7c('0x32')]['describe']()[_0x9d7c('0x29')](respondWithResult(_0x345fc5,null))['catch'](handleError(_0x345fc5,null));};exports[_0x9d7c('0x59')]=function(_0x421a6f,_0xb0d2db,_0x5eb855){var _0x891b2d={'raw':!![],'where':{}},_0x2eb98c={},_0x150e98;return db[_0x9d7c('0x32')][_0x9d7c('0x5a')]({'where':{'id':_0x421a6f[_0x9d7c('0x4c')]['id']}})[_0x9d7c('0x29')](handleEntityNotFound(_0xb0d2db,null))['then'](function(_0xc803f){if(_0xc803f){_0x150e98=_0xc803f[_0x9d7c('0x2b')]({'plain':!![]});_0x2eb98c[_0x9d7c('0x37')]=_['keys'](db[_0x9d7c('0x5b')][_0x9d7c('0x33')]);_0x2eb98c[_0x9d7c('0x38')]=_[_0x9d7c('0x39')](_0x421a6f['query']);_0x2eb98c[_0x9d7c('0x3a')]=_[_0x9d7c('0x3b')](_0x2eb98c[_0x9d7c('0x37')],_0x2eb98c[_0x9d7c('0x38')]);_0x891b2d[_0x9d7c('0x3c')]=_[_0x9d7c('0x3b')](_0x2eb98c[_0x9d7c('0x37')],qs['fields'](_0x421a6f[_0x9d7c('0x38')][_0x9d7c('0x3d')]));_0x891b2d['attributes']=_0x891b2d[_0x9d7c('0x3c')][_0x9d7c('0x3e')]?_0x891b2d[_0x9d7c('0x3c')]:_0x2eb98c[_0x9d7c('0x37')];if(!_0x421a6f[_0x9d7c('0x38')][_0x9d7c('0x3f')](_0x9d7c('0x5c'))){_0x891b2d[_0x9d7c('0x26')]=qs[_0x9d7c('0x26')](_0x421a6f[_0x9d7c('0x38')]['limit']);_0x891b2d[_0x9d7c('0x23')]=qs['offset'](_0x421a6f['query'][_0x9d7c('0x23')]);}_0x891b2d[_0x9d7c('0x40')]=qs[_0x9d7c('0x41')](_0x421a6f[_0x9d7c('0x38')][_0x9d7c('0x41')]);_0x891b2d[_0x9d7c('0x42')]=qs['filters'](_[_0x9d7c('0x43')](_0x421a6f[_0x9d7c('0x38')],_0x2eb98c[_0x9d7c('0x3a')]));_0x891b2d['where']['WhatsappQueueId']=_0xc803f['id'];if(_0x421a6f[_0x9d7c('0x38')][_0x9d7c('0x44')]){_0x891b2d['where']=_[_0x9d7c('0x45')](_0x891b2d[_0x9d7c('0x42')],{'$or':_[_0x9d7c('0x31')](_0x891b2d[_0x9d7c('0x3c')],function(_0x354a28){var _0x3e8544={};_0x3e8544[_0x354a28]={'$like':'%'+_0x421a6f[_0x9d7c('0x38')]['filter']+'%'};return _0x3e8544;})});}_0x891b2d=_['merge']({},_0x891b2d,_0x421a6f['options']);return db[_0x9d7c('0x5b')][_0x9d7c('0x49')](_0x891b2d);}})['then'](function(_0x5402d8){if(_0x5402d8){return db[_0x9d7c('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x5402d8,_0x9d7c('0x5e')),'role':_0x9d7c('0x5f')},'attributes':['id',_0x9d7c('0x2e'),'whatsappPause','updatedAt',_0x9d7c('0x60')]});}})[_0x9d7c('0x29')](function(_0x166334){if(_0x166334){return{'count':_0x166334['count'],'rows':_[_0x9d7c('0x31')](_0x166334['rows'],function(_0x2a9e05){return{'membername':_0x2a9e05[_0x9d7c('0x2e')],'UserId':_0x2a9e05['id'],'queue_name':_0x150e98[_0x9d7c('0x2e')],'WhatsappQueueId':_0x150e98['id'],'interface':util['format'](_0x9d7c('0x61'),'SIP',_0x2a9e05[_0x9d7c('0x2e')]),'penalty':0x0,'paused':_0x2a9e05[_0x9d7c('0x62')],'createdAt':_0x2a9e05[_0x9d7c('0x60')],'updatedAt':_0x2a9e05[_0x9d7c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xb0d2db,_0x891b2d))[_0x9d7c('0x4a')](handleError(_0xb0d2db,null));};exports[_0x9d7c('0x64')]=function(_0x20542f,_0x7f11ca,_0x5b4730){var _0x1ec2af={};var _0x281120={};var _0x3bc63d;var _0x27860c;return db[_0x9d7c('0x32')][_0x9d7c('0x5a')]({'where':{'id':_0x20542f[_0x9d7c('0x4c')]['id']}})[_0x9d7c('0x29')](handleEntityNotFound(_0x7f11ca,null))[_0x9d7c('0x29')](function(_0x3cc0cf){if(_0x3cc0cf){_0x3bc63d=_0x3cc0cf;_0x281120[_0x9d7c('0x37')]=_[_0x9d7c('0x39')](db[_0x9d7c('0x65')][_0x9d7c('0x33')]);_0x281120[_0x9d7c('0x38')]=_['keys'](_0x20542f[_0x9d7c('0x38')]);_0x281120['filters']=_[_0x9d7c('0x3b')](_0x281120['model'],_0x281120[_0x9d7c('0x38')]);_0x1ec2af['attributes']=_[_0x9d7c('0x3b')](_0x281120[_0x9d7c('0x37')],qs[_0x9d7c('0x3d')](_0x20542f[_0x9d7c('0x38')][_0x9d7c('0x3d')]));_0x1ec2af[_0x9d7c('0x3c')]=_0x1ec2af['attributes'][_0x9d7c('0x3e')]?_0x1ec2af[_0x9d7c('0x3c')]:_0x281120[_0x9d7c('0x37')];_0x1ec2af[_0x9d7c('0x40')]=qs[_0x9d7c('0x41')](_0x20542f[_0x9d7c('0x38')][_0x9d7c('0x41')]);_0x1ec2af[_0x9d7c('0x42')]=qs[_0x9d7c('0x3a')](_[_0x9d7c('0x43')](_0x20542f[_0x9d7c('0x38')],_0x281120['filters']));if(_0x20542f[_0x9d7c('0x38')]['filter']){_0x1ec2af[_0x9d7c('0x42')]=_[_0x9d7c('0x45')](_0x1ec2af[_0x9d7c('0x42')],{'$or':_[_0x9d7c('0x31')](_0x1ec2af['attributes'],function(_0x5341f7){var _0x3af533={};_0x3af533[_0x5341f7]={'$like':'%'+_0x20542f['query'][_0x9d7c('0x44')]+'%'};return _0x3af533;})});}_0x1ec2af=_[_0x9d7c('0x45')]({},_0x1ec2af,_0x20542f[_0x9d7c('0x47')]);return _0x3bc63d[_0x9d7c('0x64')](_0x1ec2af);}})['then'](function(_0x213524){if(_0x213524){_0x27860c=_0x213524[_0x9d7c('0x3e')];if(!_0x20542f[_0x9d7c('0x38')][_0x9d7c('0x3f')](_0x9d7c('0x5c'))){_0x1ec2af['limit']=qs['limit'](_0x20542f[_0x9d7c('0x38')]['limit']);_0x1ec2af[_0x9d7c('0x23')]=qs[_0x9d7c('0x23')](_0x20542f[_0x9d7c('0x38')][_0x9d7c('0x23')]);}return _0x3bc63d['getTeams'](_0x1ec2af);}})[_0x9d7c('0x29')](function(_0x2ac3fd){if(_0x2ac3fd){return _0x2ac3fd?{'count':_0x27860c,'rows':_0x2ac3fd}:null;}})[_0x9d7c('0x29')](respondWithResult(_0x7f11ca,null))[_0x9d7c('0x4a')](handleError(_0x7f11ca,null));};exports[_0x9d7c('0x66')]=function(_0x25d902,_0x149640,_0x1e9916){var _0x40c236=_0x25d902[_0x9d7c('0x57')][_0x9d7c('0x67')];return db[_0x9d7c('0x65')]['findAll']({'where':{'id':_0x40c236},'attributes':['id'],'include':[{'model':db[_0x9d7c('0x5d')],'as':'Agents','attributes':['id',_0x9d7c('0x2e'),_0x9d7c('0x68'),_0x9d7c('0x69'),_0x9d7c('0x6a')],'raw':!![]}]})[_0x9d7c('0x29')](function(_0x38687f){if(_0x38687f){var _0x2934bd=_[_0x9d7c('0x6b')](_0x38687f,function(_0x2a9c7d){var _0x3ea232=_0x2a9c7d[_0x9d7c('0x2b')]({'plain':!![]});return _0x3ea232['Agents'];});return db[_0x9d7c('0x32')][_0x9d7c('0x4e')]({'where':{'id':_0x25d902['params']['id']}})[_0x9d7c('0x29')](function(_0x58d1e8){return db[_0x9d7c('0x6c')][_0x9d7c('0x6d')](function(_0x1f465a){return _0x58d1e8[_0x9d7c('0x66')](_0x40c236,{'transaction':_0x1f465a})[_0x9d7c('0x29')](function(){return BPromise[_0x9d7c('0x6e')](_0x2934bd,function(_0x5967e3){return db[_0x9d7c('0x5b')][_0x9d7c('0x6f')]({'where':{'UserId':_0x5967e3['id'],'WhatsappQueueId':_0x25d902[_0x9d7c('0x4c')]['id']},'transaction':_0x1f465a});});})[_0x9d7c('0x29')](function(){_0x2934bd[_0x9d7c('0x70')](function(_0x4d9ec7){socket[_0x9d7c('0x71')]('userWhatsappQueue:save',{'UserId':_0x4d9ec7['id'],'WhatsappQueueId':_0x58d1e8['id']});});});});});}})[_0x9d7c('0x29')](respondWithStatusCode(_0x149640,null))[_0x9d7c('0x4a')](handleError(_0x149640,null));};exports[_0x9d7c('0x72')]=function(_0x3b84f4,_0x3fa5d1,_0x2b5505){return db[_0x9d7c('0x65')][_0x9d7c('0x49')]({'where':{'id':_0x3b84f4['query'][_0x9d7c('0x67')]},'attributes':['id'],'include':[{'model':db[_0x9d7c('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9d7c('0x29')](handleEntityNotFound(_0x3fa5d1,null))[_0x9d7c('0x29')](function(_0x520ee4){var _0x23966f=_[_0x9d7c('0x31')](_0x520ee4,'id');var _0x28426f=[];var _0x2199cc=[];var _0x51a43a=squel[_0x9d7c('0x73')]();_0x51a43a[_0x9d7c('0x74')](_0x9d7c('0x75'))['from'](_0x9d7c('0x76'),'tq')['join'](_0x9d7c('0x77'),'ut',_0x9d7c('0x78'))[_0x9d7c('0x42')](_0x9d7c('0x79'),_0x3b84f4[_0x9d7c('0x4c')]['id']);for(var _0x4c6e3b=0x0;_0x4c6e3b<_0x520ee4[_0x9d7c('0x3e')];_0x4c6e3b+=0x1){let _0x4127c3=_0x520ee4[_0x4c6e3b];for(var _0x323580=0x0;_0x323580<_0x4127c3[_0x9d7c('0x7a')]['length'];_0x323580+=0x1){let _0x3a3248=_0x4127c3[_0x9d7c('0x7a')][_0x323580];var _0x28ab62=_0x51a43a[_0x9d7c('0x7b')]();_0x28ab62[_0x9d7c('0x42')]('ut.UserId\x20=\x20?',_0x3a3248['id']);_0x2199cc[_0x9d7c('0x7c')](db[_0x9d7c('0x6c')][_0x9d7c('0x38')](_0x28ab62[_0x9d7c('0x7d')](),{'type':db['sequelize'][_0x9d7c('0x7e')][_0x9d7c('0x7f')]})[_0x9d7c('0x29')](function(_0x4f3a82){if(_0x4f3a82[_0x9d7c('0x3e')]===0x1){return _0x3a3248['id'];}else{var _0x266860=_[_0x9d7c('0x80')](_[_0x9d7c('0x31')](_0x4f3a82,_0x9d7c('0x81')),function(_0xc3cba3){return _[_0x9d7c('0x82')](_0x23966f,_0xc3cba3);});if(_0x266860){return _0x3a3248['id'];}}}));}}return BPromise[_0x9d7c('0x83')](_0x2199cc)[_0x9d7c('0x29')](function(_0x2c10e4){_0x28426f=_(_0x28426f)[_0x9d7c('0x84')](_0x2c10e4)[_0x9d7c('0x85')]()[_0x9d7c('0x86')]();return db[_0x9d7c('0x32')][_0x9d7c('0x4e')]({'where':{'id':_0x3b84f4['params']['id']}})[_0x9d7c('0x29')](function(_0x23f5dd){return db[_0x9d7c('0x6c')][_0x9d7c('0x6d')](function(_0x423c19){return _0x23f5dd[_0x9d7c('0x72')](_0x3b84f4['query'][_0x9d7c('0x67')],{'transaction':_0x423c19})['then'](function(){if(!_[_0x9d7c('0x87')](_0x28426f)){return _0x23f5dd[_0x9d7c('0x88')](_0x28426f,{'transaction':_0x423c19});}})[_0x9d7c('0x29')](function(){_0x28426f['forEach'](function(_0x34fc90){socket[_0x9d7c('0x71')](_0x9d7c('0x89'),{'UserId':_0x34fc90,'WhatsappQueueId':_0x23f5dd['id']});});});});});});})['then'](respondWithStatusCode(_0x3fa5d1,null))[_0x9d7c('0x4a')](handleError(_0x3fa5d1,null));};exports[_0x9d7c('0x8a')]=function(_0xd646ee,_0x456220,_0x5cd97e){return db[_0x9d7c('0x32')][_0x9d7c('0x4e')]({'where':{'id':_0xd646ee[_0x9d7c('0x4c')]['id']}})[_0x9d7c('0x29')](handleEntityNotFound(_0x456220,null))['then'](function(_0x4bfe40){if(_0x4bfe40){return _0x4bfe40['addAgents'](_0xd646ee['body'][_0x9d7c('0x67')],_[_0x9d7c('0x8b')](_0xd646ee[_0x9d7c('0x57')],[_0x9d7c('0x67'),'id'])||{})['spread'](function(_0x1f4ec2){for(var _0x544d80=0x0;_0x544d80<_0xd646ee[_0x9d7c('0x57')]['ids'][_0x9d7c('0x3e')];_0x544d80+=0x1){socket[_0x9d7c('0x71')](_0x9d7c('0x8c'),{'UserId':Number(_0xd646ee[_0x9d7c('0x57')][_0x9d7c('0x67')][_0x544d80]),'WhatsappQueueId':Number(_0xd646ee[_0x9d7c('0x4c')]['id'])});}return _0x1f4ec2;});}})[_0x9d7c('0x29')](respondWithResult(_0x456220,null))[_0x9d7c('0x4a')](handleError(_0x456220,null));};exports[_0x9d7c('0x88')]=function(_0x260cd4,_0x10e1b3,_0x2ad072){return db[_0x9d7c('0x32')][_0x9d7c('0x4e')]({'where':{'id':_0x260cd4[_0x9d7c('0x4c')]['id']}})[_0x9d7c('0x29')](handleEntityNotFound(_0x10e1b3,null))[_0x9d7c('0x29')](function(_0x2c1f76){if(_0x2c1f76){return _0x2c1f76[_0x9d7c('0x88')](_0x260cd4[_0x9d7c('0x38')]['ids'])[_0x9d7c('0x29')](function(){if(_[_0x9d7c('0x8d')](_0x260cd4[_0x9d7c('0x38')]['ids'])){for(var _0x5ce4f3=0x0;_0x5ce4f3<_0x260cd4['query']['ids']['length'];_0x5ce4f3+=0x1){socket[_0x9d7c('0x71')](_0x9d7c('0x89'),{'UserId':Number(_0x260cd4[_0x9d7c('0x38')][_0x9d7c('0x67')][_0x5ce4f3]),'WhatsappQueueId':Number(_0x260cd4[_0x9d7c('0x4c')]['id'])});}}else{socket[_0x9d7c('0x71')](_0x9d7c('0x89'),{'UserId':Number(_0x260cd4[_0x9d7c('0x38')]['ids']),'WhatsappQueueId':Number(_0x260cd4[_0x9d7c('0x4c')]['id'])});}});}})[_0x9d7c('0x29')](respondWithStatusCode(_0x10e1b3,null))[_0x9d7c('0x4a')](handleError(_0x10e1b3,null));};exports['getAgents']=function(_0x188eec,_0x1bbc5c,_0xb1e781){var _0x391d09={};var _0xa9d53a={};var _0x11fb2f;var _0x335330;return db[_0x9d7c('0x32')]['findOne']({'where':{'id':_0x188eec['params']['id']}})['then'](handleEntityNotFound(_0x1bbc5c,null))[_0x9d7c('0x29')](function(_0x493b8d){if(_0x493b8d){_0x11fb2f=_0x493b8d;_0xa9d53a[_0x9d7c('0x37')]=_[_0x9d7c('0x39')](db[_0x9d7c('0x5d')][_0x9d7c('0x33')]);_0xa9d53a['query']=_[_0x9d7c('0x39')](_0x188eec['query']);_0xa9d53a['filters']=_[_0x9d7c('0x3b')](_0xa9d53a[_0x9d7c('0x37')],_0xa9d53a[_0x9d7c('0x38')]);_0x391d09[_0x9d7c('0x3c')]=_[_0x9d7c('0x3b')](_0xa9d53a['model'],qs[_0x9d7c('0x3d')](_0x188eec[_0x9d7c('0x38')][_0x9d7c('0x3d')]));_0x391d09[_0x9d7c('0x3c')]=_0x391d09[_0x9d7c('0x3c')][_0x9d7c('0x3e')]?_0x391d09['attributes']:_0xa9d53a['model'];_0x391d09[_0x9d7c('0x40')]=qs[_0x9d7c('0x41')](_0x188eec[_0x9d7c('0x38')][_0x9d7c('0x41')]);_0x391d09['where']=qs[_0x9d7c('0x3a')](_['pick'](_0x188eec[_0x9d7c('0x38')],_0xa9d53a['filters']));if(_0x188eec[_0x9d7c('0x38')]['filter']){_0x391d09[_0x9d7c('0x42')]=_[_0x9d7c('0x45')](_0x391d09['where'],{'$or':_[_0x9d7c('0x31')](_0x391d09[_0x9d7c('0x3c')],function(_0x402f3a){var _0x115655={};_0x115655[_0x402f3a]={'$like':'%'+_0x188eec[_0x9d7c('0x38')][_0x9d7c('0x44')]+'%'};return _0x115655;})});}_0x391d09=_['merge']({},_0x391d09,_0x188eec[_0x9d7c('0x47')]);return _0x11fb2f[_0x9d7c('0x8e')](_0x391d09);}})[_0x9d7c('0x29')](function(_0x556459){if(_0x556459){_0x335330=_0x556459[_0x9d7c('0x3e')];if(!_0x188eec[_0x9d7c('0x38')][_0x9d7c('0x3f')](_0x9d7c('0x5c'))){_0x391d09[_0x9d7c('0x26')]=qs[_0x9d7c('0x26')](_0x188eec[_0x9d7c('0x38')][_0x9d7c('0x26')]);_0x391d09['offset']=qs[_0x9d7c('0x23')](_0x188eec[_0x9d7c('0x38')][_0x9d7c('0x23')]);}return _0x11fb2f[_0x9d7c('0x8e')](_0x391d09);}})['then'](function(_0x8cc037){if(_0x8cc037){return _0x8cc037?{'count':_0x335330,'rows':_0x8cc037}:null;}})[_0x9d7c('0x29')](respondWithResult(_0x1bbc5c,null))[_0x9d7c('0x4a')](handleError(_0x1bbc5c,null));}; \ No newline at end of file +var _0x6038=['WhatsappQueue','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','WhatsappQueueId','map','options','UserWhatsappQueue','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','findOne','addTeams','online','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','Team','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','union','compact','value','removeTeams','addAgents','omit','spread','removeAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','undefined','limit','count','offset','set','reject','save','update','get','WhatsappQueues','UserProfileResource','destroy','then','sendStatus','stack','name','send','index'];(function(_0x2b0996,_0x46d8ae){var _0x14532e=function(_0x25ed51){while(--_0x25ed51){_0x2b0996['push'](_0x2b0996['shift']());}};_0x14532e(++_0x46d8ae);}(_0x6038,0x17f));var _0x8603=function(_0x5234fc,_0x8196f){_0x5234fc=_0x5234fc-0x0;var _0x40a58c=_0x6038[_0x5234fc];return _0x40a58c;};'use strict';var emlformat=require(_0x8603('0x0'));var rimraf=require(_0x8603('0x1'));var zipdir=require(_0x8603('0x2'));var jsonpatch=require(_0x8603('0x3'));var rp=require(_0x8603('0x4'));var moment=require(_0x8603('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8603('0x6'));var util=require(_0x8603('0x7'));var path=require('path');var sox=require(_0x8603('0x8'));var csv=require(_0x8603('0x9'));var ejs=require(_0x8603('0xa'));var fs=require('fs');var fs_extra=require(_0x8603('0xb'));var _=require(_0x8603('0xc'));var squel=require(_0x8603('0xd'));var crypto=require('crypto');var jsforce=require(_0x8603('0xe'));var deskjs=require(_0x8603('0xf'));var toCsv=require(_0x8603('0x9'));var querystring=require(_0x8603('0x10'));var Papa=require(_0x8603('0x11'));var Redis=require(_0x8603('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8603('0x13'));var as=require(_0x8603('0x14'));var hardwareService=require(_0x8603('0x15'));var logger=require(_0x8603('0x16'))(_0x8603('0x17'));var utils=require(_0x8603('0x18'));var config=require(_0x8603('0x19'));var licenseUtil=require(_0x8603('0x1a'));var db=require(_0x8603('0x1b'))['db'];config[_0x8603('0x1c')]=_[_0x8603('0x1d')](config[_0x8603('0x1c')],{'host':_0x8603('0x1e'),'port':0x18eb});var socket=require(_0x8603('0x1f'))(new Redis(config[_0x8603('0x1c')]));require(_0x8603('0x20'))[_0x8603('0x21')](socket);function respondWithStatusCode(_0x140ea1,_0x40e0a5){_0x40e0a5=_0x40e0a5||0xcc;return function(_0x360bb8){if(_0x360bb8){return _0x140ea1['sendStatus'](_0x40e0a5);}return _0x140ea1[_0x8603('0x22')](_0x40e0a5)[_0x8603('0x23')]();};}function respondWithResult(_0x184c7e,_0x18b409){_0x18b409=_0x18b409||0xc8;return function(_0x467f21){if(_0x467f21){return _0x184c7e[_0x8603('0x22')](_0x18b409)[_0x8603('0x24')](_0x467f21);}};}function respondWithFilteredResult(_0x37db01,_0x1f9f67){return function(_0x40af70){if(_0x40af70){var _0x4a7e96=typeof _0x1f9f67['offset']===_0x8603('0x25')&&typeof _0x1f9f67[_0x8603('0x26')]===_0x8603('0x25');var _0x55303b=_0x40af70[_0x8603('0x27')];var _0x4b4909=_0x4a7e96?0x0:_0x1f9f67[_0x8603('0x28')];var _0x34eb6c=_0x4a7e96?_0x40af70[_0x8603('0x27')]:_0x1f9f67['offset']+_0x1f9f67[_0x8603('0x26')];var _0x3df5a7;if(_0x34eb6c>=_0x55303b){_0x34eb6c=_0x55303b;_0x3df5a7=0xc8;}else{_0x3df5a7=0xce;}_0x37db01[_0x8603('0x22')](_0x3df5a7);return _0x37db01[_0x8603('0x29')]('Content-Range',_0x4b4909+'-'+_0x34eb6c+'/'+_0x55303b)[_0x8603('0x24')](_0x40af70);}return null;};}function patchUpdates(_0x5b0da4){return function(_0x2da362){try{jsonpatch['apply'](_0x2da362,_0x5b0da4,!![]);}catch(_0xe67521){return BPromise[_0x8603('0x2a')](_0xe67521);}return _0x2da362[_0x8603('0x2b')]();};}function saveUpdates(_0x42475e,_0x22a2f1){return function(_0x2ed238){if(_0x2ed238){return _0x2ed238[_0x8603('0x2c')](_0x42475e)['then'](function(_0x404ff3){return _0x404ff3;});}return null;};}function removeEntity(_0x46dfcc,_0x300e98){return function(_0x547f73){if(_0x547f73){return _0x547f73['destroy']()['then'](function(){var _0x575a4b=_0x547f73[_0x8603('0x2d')]({'plain':!![]});var _0x22171d=_0x8603('0x2e');return db[_0x8603('0x2f')][_0x8603('0x30')]({'where':{'type':_0x22171d,'resourceId':_0x575a4b['id']}})[_0x8603('0x31')](function(){return _0x547f73;});})[_0x8603('0x31')](function(){_0x46dfcc[_0x8603('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x487901,_0x487c2c){return function(_0x10db99){if(!_0x10db99){_0x487901[_0x8603('0x32')](0x194);}return _0x10db99;};}function handleError(_0x2740d7,_0x5ae85f){_0x5ae85f=_0x5ae85f||0x1f4;return function(_0x1581db){logger['error'](_0x1581db[_0x8603('0x33')]);if(_0x1581db[_0x8603('0x34')]){delete _0x1581db[_0x8603('0x34')];}_0x2740d7[_0x8603('0x22')](_0x5ae85f)[_0x8603('0x35')](_0x1581db);};}exports[_0x8603('0x36')]=function(_0x279bc1,_0x278b7f){var _0x4afb12={},_0x4c144d={},_0xc31b95={'count':0x0,'rows':[]};var _0x1b28f4=_['map'](db[_0x8603('0x37')]['rawAttributes'],function(_0x2b326a){return{'name':_0x2b326a['fieldName'],'type':_0x2b326a['type'][_0x8603('0x38')]};});_0x4c144d[_0x8603('0x39')]=_['map'](_0x1b28f4,_0x8603('0x34'));_0x4c144d['query']=_['keys'](_0x279bc1[_0x8603('0x3a')]);_0x4c144d[_0x8603('0x3b')]=_['intersection'](_0x4c144d[_0x8603('0x39')],_0x4c144d[_0x8603('0x3a')]);_0x4afb12[_0x8603('0x3c')]=_[_0x8603('0x3d')](_0x4c144d[_0x8603('0x39')],qs[_0x8603('0x3e')](_0x279bc1[_0x8603('0x3a')][_0x8603('0x3e')]));_0x4afb12[_0x8603('0x3c')]=_0x4afb12[_0x8603('0x3c')]['length']?_0x4afb12[_0x8603('0x3c')]:_0x4c144d[_0x8603('0x39')];if(!_0x279bc1[_0x8603('0x3a')][_0x8603('0x3f')](_0x8603('0x40'))){_0x4afb12[_0x8603('0x26')]=qs[_0x8603('0x26')](_0x279bc1[_0x8603('0x3a')][_0x8603('0x26')]);_0x4afb12[_0x8603('0x28')]=qs['offset'](_0x279bc1[_0x8603('0x3a')][_0x8603('0x28')]);}_0x4afb12[_0x8603('0x41')]=qs[_0x8603('0x42')](_0x279bc1[_0x8603('0x3a')][_0x8603('0x42')]);_0x4afb12[_0x8603('0x43')]=qs['filters'](_[_0x8603('0x44')](_0x279bc1[_0x8603('0x3a')],_0x4c144d[_0x8603('0x3b')]),_0x1b28f4);if(_0x279bc1['query'][_0x8603('0x45')]){_0x4afb12[_0x8603('0x43')]=_['merge'](_0x4afb12[_0x8603('0x43')],{'$or':_['map'](_0x1b28f4,function(_0x1ef2c9){if(_0x1ef2c9[_0x8603('0x46')]!==_0x8603('0x47')){var _0x3530e8={};_0x3530e8[_0x1ef2c9[_0x8603('0x34')]]={'$like':'%'+_0x279bc1[_0x8603('0x3a')][_0x8603('0x45')]+'%'};return _0x3530e8;}})});}_0x4afb12=_[_0x8603('0x48')]({},_0x4afb12,_0x279bc1['options']);var _0x4cc060={'where':_0x4afb12[_0x8603('0x43')]};return db[_0x8603('0x37')][_0x8603('0x27')](_0x4cc060)['then'](function(_0x378f9d){_0xc31b95[_0x8603('0x27')]=_0x378f9d;if(_0x279bc1[_0x8603('0x3a')][_0x8603('0x49')]){_0x4afb12[_0x8603('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x8603('0x4b')](_0x4afb12);})[_0x8603('0x31')](function(_0x27a33b){_0xc31b95['rows']=_0x27a33b;return _0xc31b95;})[_0x8603('0x31')](respondWithFilteredResult(_0x278b7f,_0x4afb12))[_0x8603('0x4c')](handleError(_0x278b7f,null));};exports[_0x8603('0x4d')]=function(_0x47bc9f,_0xf81ec5){var _0x535ae4={'raw':!![],'where':{'id':_0x47bc9f[_0x8603('0x4e')]['id']}},_0x13f01e={};_0x13f01e[_0x8603('0x39')]=_[_0x8603('0x4f')](db['WhatsappQueue'][_0x8603('0x50')]);_0x13f01e[_0x8603('0x3a')]=_[_0x8603('0x4f')](_0x47bc9f[_0x8603('0x3a')]);_0x13f01e[_0x8603('0x3b')]=_[_0x8603('0x3d')](_0x13f01e[_0x8603('0x39')],_0x13f01e['query']);_0x535ae4[_0x8603('0x3c')]=_[_0x8603('0x3d')](_0x13f01e['model'],qs[_0x8603('0x3e')](_0x47bc9f[_0x8603('0x3a')][_0x8603('0x3e')]));_0x535ae4[_0x8603('0x3c')]=_0x535ae4[_0x8603('0x3c')][_0x8603('0x51')]?_0x535ae4[_0x8603('0x3c')]:_0x13f01e['model'];if(_0x47bc9f[_0x8603('0x3a')][_0x8603('0x49')]){_0x535ae4[_0x8603('0x4a')]=[{'all':!![]}];}_0x535ae4=_[_0x8603('0x48')]({},_0x535ae4,_0x47bc9f['options']);return db['WhatsappQueue'][_0x8603('0x52')](_0x535ae4)[_0x8603('0x31')](handleEntityNotFound(_0xf81ec5,null))[_0x8603('0x31')](respondWithResult(_0xf81ec5,null))['catch'](handleError(_0xf81ec5,null));};exports[_0x8603('0x53')]=function(_0xe2601f,_0x2df7a5){return db[_0x8603('0x37')]['create'](_0xe2601f[_0x8603('0x54')],{})[_0x8603('0x31')](function(_0x5b4a7a){var _0x505fbe=_0xe2601f['user'][_0x8603('0x2d')]({'plain':!![]});if(!_0x505fbe)throw new Error(_0x8603('0x55'));if(_0x505fbe['role']===_0x8603('0x56')){var _0xbab68e=_0x5b4a7a[_0x8603('0x2d')]({'plain':!![]});var _0x4a747b=_0x8603('0x2e');return db[_0x8603('0x57')]['find']({'where':{'name':_0x4a747b,'userProfileId':_0x505fbe[_0x8603('0x58')]},'raw':!![]})['then'](function(_0xdf3dc7){if(_0xdf3dc7&&_0xdf3dc7[_0x8603('0x59')]===0x0){return db[_0x8603('0x2f')][_0x8603('0x53')]({'name':_0xbab68e[_0x8603('0x34')],'resourceId':_0xbab68e['id'],'type':_0xdf3dc7['name'],'sectionId':_0xdf3dc7['id']},{})['then'](function(){return _0x5b4a7a;});}else{return _0x5b4a7a;}})['catch'](function(_0x79bd71){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x79bd71);throw _0x79bd71;});}return _0x5b4a7a;})[_0x8603('0x31')](respondWithResult(_0x2df7a5,0xc9))[_0x8603('0x4c')](handleError(_0x2df7a5,null));};exports['update']=function(_0x22c28b,_0x6be627){if(_0x22c28b[_0x8603('0x54')]['id']){delete _0x22c28b[_0x8603('0x54')]['id'];}return db[_0x8603('0x37')][_0x8603('0x52')]({'where':{'id':_0x22c28b['params']['id']}})['then'](handleEntityNotFound(_0x6be627,null))[_0x8603('0x31')](saveUpdates(_0x22c28b[_0x8603('0x54')],null))[_0x8603('0x31')](respondWithResult(_0x6be627,null))['catch'](handleError(_0x6be627,null));};exports['destroy']=function(_0x5ca0e0,_0x352e77){return db['WhatsappQueue'][_0x8603('0x52')]({'where':{'id':_0x5ca0e0[_0x8603('0x4e')]['id']}})[_0x8603('0x31')](handleEntityNotFound(_0x352e77,null))[_0x8603('0x31')](removeEntity(_0x352e77,null))[_0x8603('0x4c')](handleError(_0x352e77,null));};exports[_0x8603('0x5a')]=function(_0x3c9ef3,_0x2a0ba9){return db[_0x8603('0x37')][_0x8603('0x5a')]()['then'](respondWithResult(_0x2a0ba9,null))[_0x8603('0x4c')](handleError(_0x2a0ba9,null));};exports[_0x8603('0x5b')]=function(_0x418e6c,_0x5b4b28,_0x802f38){var _0x27c1cd={'raw':!![],'where':{}},_0xa7310c={},_0x3369b2;return db[_0x8603('0x37')]['findOne']({'where':{'id':_0x418e6c[_0x8603('0x4e')]['id']}})[_0x8603('0x31')](handleEntityNotFound(_0x5b4b28,null))['then'](function(_0x14e3f9){if(_0x14e3f9){_0x3369b2=_0x14e3f9['get']({'plain':!![]});_0xa7310c[_0x8603('0x39')]=_[_0x8603('0x4f')](db['UserWhatsappQueue'][_0x8603('0x50')]);_0xa7310c[_0x8603('0x3a')]=_[_0x8603('0x4f')](_0x418e6c[_0x8603('0x3a')]);_0xa7310c['filters']=_['intersection'](_0xa7310c[_0x8603('0x39')],_0xa7310c['query']);_0x27c1cd[_0x8603('0x3c')]=_[_0x8603('0x3d')](_0xa7310c[_0x8603('0x39')],qs[_0x8603('0x3e')](_0x418e6c[_0x8603('0x3a')][_0x8603('0x3e')]));_0x27c1cd[_0x8603('0x3c')]=_0x27c1cd[_0x8603('0x3c')][_0x8603('0x51')]?_0x27c1cd['attributes']:_0xa7310c[_0x8603('0x39')];if(!_0x418e6c['query'][_0x8603('0x3f')](_0x8603('0x40'))){_0x27c1cd[_0x8603('0x26')]=qs[_0x8603('0x26')](_0x418e6c[_0x8603('0x3a')]['limit']);_0x27c1cd[_0x8603('0x28')]=qs[_0x8603('0x28')](_0x418e6c[_0x8603('0x3a')][_0x8603('0x28')]);}_0x27c1cd['order']=qs[_0x8603('0x42')](_0x418e6c[_0x8603('0x3a')][_0x8603('0x42')]);_0x27c1cd[_0x8603('0x43')]=qs[_0x8603('0x3b')](_['pick'](_0x418e6c[_0x8603('0x3a')],_0xa7310c[_0x8603('0x3b')]));_0x27c1cd[_0x8603('0x43')][_0x8603('0x5c')]=_0x14e3f9['id'];if(_0x418e6c[_0x8603('0x3a')][_0x8603('0x45')]){_0x27c1cd[_0x8603('0x43')]=_[_0x8603('0x48')](_0x27c1cd[_0x8603('0x43')],{'$or':_[_0x8603('0x5d')](_0x27c1cd[_0x8603('0x3c')],function(_0xeacaa7){var _0x4c32c0={};_0x4c32c0[_0xeacaa7]={'$like':'%'+_0x418e6c[_0x8603('0x3a')]['filter']+'%'};return _0x4c32c0;})});}_0x27c1cd=_[_0x8603('0x48')]({},_0x27c1cd,_0x418e6c[_0x8603('0x5e')]);return db[_0x8603('0x5f')][_0x8603('0x4b')](_0x27c1cd);}})['then'](function(_0x120cef){if(_0x120cef){return db[_0x8603('0x60')]['findAndCountAll']({'where':{'id':_[_0x8603('0x5d')](_0x120cef,_0x8603('0x61')),'role':_0x8603('0x62')},'attributes':['id',_0x8603('0x34'),'whatsappPause',_0x8603('0x63'),_0x8603('0x64')]});}})['then'](function(_0x2142ca){if(_0x2142ca){return{'count':_0x2142ca[_0x8603('0x27')],'rows':_[_0x8603('0x5d')](_0x2142ca['rows'],function(_0x4a70b1){return{'membername':_0x4a70b1[_0x8603('0x34')],'UserId':_0x4a70b1['id'],'queue_name':_0x3369b2[_0x8603('0x34')],'WhatsappQueueId':_0x3369b2['id'],'interface':util[_0x8603('0x65')](_0x8603('0x66'),_0x8603('0x67'),_0x4a70b1[_0x8603('0x34')]),'penalty':0x0,'paused':_0x4a70b1[_0x8603('0x68')],'createdAt':_0x4a70b1[_0x8603('0x64')],'updatedAt':_0x4a70b1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5b4b28,_0x27c1cd))[_0x8603('0x4c')](handleError(_0x5b4b28,null));};exports[_0x8603('0x69')]=function(_0x4d08cd,_0x52a4d4,_0x467f13){var _0x3327dd={};var _0x2d1e78={};var _0x17351a;var _0x572a83;return db['WhatsappQueue'][_0x8603('0x6a')]({'where':{'id':_0x4d08cd[_0x8603('0x4e')]['id']}})['then'](handleEntityNotFound(_0x52a4d4,null))[_0x8603('0x31')](function(_0x246745){if(_0x246745){_0x17351a=_0x246745;_0x2d1e78['model']=_[_0x8603('0x4f')](db['Team'][_0x8603('0x50')]);_0x2d1e78['query']=_[_0x8603('0x4f')](_0x4d08cd[_0x8603('0x3a')]);_0x2d1e78['filters']=_[_0x8603('0x3d')](_0x2d1e78['model'],_0x2d1e78['query']);_0x3327dd[_0x8603('0x3c')]=_[_0x8603('0x3d')](_0x2d1e78[_0x8603('0x39')],qs[_0x8603('0x3e')](_0x4d08cd[_0x8603('0x3a')]['fields']));_0x3327dd['attributes']=_0x3327dd[_0x8603('0x3c')][_0x8603('0x51')]?_0x3327dd[_0x8603('0x3c')]:_0x2d1e78[_0x8603('0x39')];_0x3327dd[_0x8603('0x41')]=qs['sort'](_0x4d08cd['query'][_0x8603('0x42')]);_0x3327dd[_0x8603('0x43')]=qs[_0x8603('0x3b')](_[_0x8603('0x44')](_0x4d08cd['query'],_0x2d1e78[_0x8603('0x3b')]));if(_0x4d08cd[_0x8603('0x3a')][_0x8603('0x45')]){_0x3327dd[_0x8603('0x43')]=_['merge'](_0x3327dd[_0x8603('0x43')],{'$or':_[_0x8603('0x5d')](_0x3327dd[_0x8603('0x3c')],function(_0x5b23d6){var _0x1aafee={};_0x1aafee[_0x5b23d6]={'$like':'%'+_0x4d08cd[_0x8603('0x3a')][_0x8603('0x45')]+'%'};return _0x1aafee;})});}_0x3327dd=_[_0x8603('0x48')]({},_0x3327dd,_0x4d08cd['options']);return _0x17351a[_0x8603('0x69')](_0x3327dd);}})[_0x8603('0x31')](function(_0x2a4c05){if(_0x2a4c05){_0x572a83=_0x2a4c05[_0x8603('0x51')];if(!_0x4d08cd[_0x8603('0x3a')][_0x8603('0x3f')](_0x8603('0x40'))){_0x3327dd[_0x8603('0x26')]=qs['limit'](_0x4d08cd[_0x8603('0x3a')]['limit']);_0x3327dd['offset']=qs[_0x8603('0x28')](_0x4d08cd['query'][_0x8603('0x28')]);}return _0x17351a[_0x8603('0x69')](_0x3327dd);}})[_0x8603('0x31')](function(_0x1390ad){if(_0x1390ad){return _0x1390ad?{'count':_0x572a83,'rows':_0x1390ad}:null;}})[_0x8603('0x31')](respondWithResult(_0x52a4d4,null))[_0x8603('0x4c')](handleError(_0x52a4d4,null));};exports[_0x8603('0x6b')]=function(_0x45014f,_0x36a4cc,_0xce8bfc){var _0x5a30f3=_0x45014f[_0x8603('0x54')]['ids'];return db['Team'][_0x8603('0x4b')]({'where':{'id':_0x5a30f3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x8603('0x34'),_0x8603('0x6c'),'voicePause',_0x8603('0x6d')],'raw':!![]}]})[_0x8603('0x31')](function(_0x5eca3f){if(_0x5eca3f){var _0xd51c7d=_[_0x8603('0x6e')](_0x5eca3f,function(_0x36f4eb){var _0x416f16=_0x36f4eb['get']({'plain':!![]});return _0x416f16[_0x8603('0x6f')];});return db['WhatsappQueue'][_0x8603('0x52')]({'where':{'id':_0x45014f[_0x8603('0x4e')]['id']}})[_0x8603('0x31')](function(_0x23d739){return db['sequelize'][_0x8603('0x70')](function(_0x2045da){return _0x23d739['addTeams'](_0x5a30f3,{'transaction':_0x2045da})[_0x8603('0x31')](function(){return BPromise[_0x8603('0x71')](_0xd51c7d,function(_0x182a62){return db[_0x8603('0x5f')][_0x8603('0x72')]({'where':{'UserId':_0x182a62['id'],'WhatsappQueueId':_0x45014f[_0x8603('0x4e')]['id']},'transaction':_0x2045da});});})[_0x8603('0x31')](function(){_0xd51c7d[_0x8603('0x73')](function(_0x58c161){socket[_0x8603('0x74')](_0x8603('0x75'),{'UserId':_0x58c161['id'],'WhatsappQueueId':_0x23d739['id']});});});});});}})[_0x8603('0x31')](respondWithStatusCode(_0x36a4cc,null))[_0x8603('0x4c')](handleError(_0x36a4cc,null));};exports['removeTeams']=function(_0x2d83b4,_0x5536ff,_0x46073d){return db[_0x8603('0x76')][_0x8603('0x4b')]({'where':{'id':_0x2d83b4['query'][_0x8603('0x77')]},'attributes':['id'],'include':[{'model':db[_0x8603('0x60')],'as':_0x8603('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x8603('0x31')](handleEntityNotFound(_0x5536ff,null))[_0x8603('0x31')](function(_0x13d52e){var _0x57f059=_[_0x8603('0x5d')](_0x13d52e,'id');var _0x34b0ee=[];var _0x5333ce=[];var _0x2b5a34=squel[_0x8603('0x78')]();_0x2b5a34[_0x8603('0x79')](_0x8603('0x7a'))[_0x8603('0x7b')](_0x8603('0x7c'),'tq')[_0x8603('0x7d')](_0x8603('0x7e'),'ut',_0x8603('0x7f'))[_0x8603('0x43')](_0x8603('0x80'),_0x2d83b4[_0x8603('0x4e')]['id']);for(var _0x43deea=0x0;_0x43deea<_0x13d52e['length'];_0x43deea+=0x1){let _0x43ae0a=_0x13d52e[_0x43deea];for(var _0x53ddc7=0x0;_0x53ddc7<_0x43ae0a[_0x8603('0x6f')]['length'];_0x53ddc7+=0x1){let _0x11cc4b=_0x43ae0a[_0x8603('0x6f')][_0x53ddc7];var _0x371285=_0x2b5a34[_0x8603('0x81')]();_0x371285['where']('ut.UserId\x20=\x20?',_0x11cc4b['id']);_0x5333ce[_0x8603('0x82')](db[_0x8603('0x83')][_0x8603('0x3a')](_0x371285[_0x8603('0x84')](),{'type':db[_0x8603('0x83')]['QueryTypes']['SELECT']})[_0x8603('0x31')](function(_0x2f71b4){if(_0x2f71b4['length']===0x1){return _0x11cc4b['id'];}else{var _0x2c6283=_[_0x8603('0x85')](_[_0x8603('0x5d')](_0x2f71b4,_0x8603('0x86')),function(_0x5a5aa3){return _['includes'](_0x57f059,_0x5a5aa3);});if(_0x2c6283){return _0x11cc4b['id'];}}}));}}return BPromise['all'](_0x5333ce)[_0x8603('0x31')](function(_0x1cb2c6){_0x34b0ee=_(_0x34b0ee)[_0x8603('0x87')](_0x1cb2c6)[_0x8603('0x88')]()[_0x8603('0x89')]();return db['WhatsappQueue']['find']({'where':{'id':_0x2d83b4[_0x8603('0x4e')]['id']}})[_0x8603('0x31')](function(_0x44c36a){return db[_0x8603('0x83')][_0x8603('0x70')](function(_0x52dfbc){return _0x44c36a[_0x8603('0x8a')](_0x2d83b4[_0x8603('0x3a')][_0x8603('0x77')],{'transaction':_0x52dfbc})[_0x8603('0x31')](function(){if(!_['isEmpty'](_0x34b0ee)){return _0x44c36a['removeAgents'](_0x34b0ee,{'transaction':_0x52dfbc});}})['then'](function(){_0x34b0ee['forEach'](function(_0x4d06ee){socket[_0x8603('0x74')]('userWhatsappQueue:remove',{'UserId':_0x4d06ee,'WhatsappQueueId':_0x44c36a['id']});});});});});});})[_0x8603('0x31')](respondWithStatusCode(_0x5536ff,null))['catch'](handleError(_0x5536ff,null));};exports[_0x8603('0x8b')]=function(_0x304101,_0x1a48ff,_0xfad12c){return db[_0x8603('0x37')][_0x8603('0x52')]({'where':{'id':_0x304101[_0x8603('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a48ff,null))[_0x8603('0x31')](function(_0x30cdd4){if(_0x30cdd4){return _0x30cdd4[_0x8603('0x8b')](_0x304101[_0x8603('0x54')][_0x8603('0x77')],_[_0x8603('0x8c')](_0x304101['body'],['ids','id'])||{})[_0x8603('0x8d')](function(_0xd333d2){for(var _0x6e1f20=0x0;_0x6e1f20<_0x304101['body']['ids'][_0x8603('0x51')];_0x6e1f20+=0x1){socket['emit'](_0x8603('0x75'),{'UserId':Number(_0x304101['body'][_0x8603('0x77')][_0x6e1f20]),'WhatsappQueueId':Number(_0x304101['params']['id'])});}return _0xd333d2;});}})[_0x8603('0x31')](respondWithResult(_0x1a48ff,null))[_0x8603('0x4c')](handleError(_0x1a48ff,null));};exports[_0x8603('0x8e')]=function(_0x39a9b9,_0x6f003b,_0x509508){return db['WhatsappQueue'][_0x8603('0x52')]({'where':{'id':_0x39a9b9[_0x8603('0x4e')]['id']}})[_0x8603('0x31')](handleEntityNotFound(_0x6f003b,null))['then'](function(_0x65af0d){if(_0x65af0d){return _0x65af0d[_0x8603('0x8e')](_0x39a9b9[_0x8603('0x3a')]['ids'])[_0x8603('0x31')](function(){if(_[_0x8603('0x8f')](_0x39a9b9[_0x8603('0x3a')][_0x8603('0x77')])){for(var _0x2bb79f=0x0;_0x2bb79f<_0x39a9b9[_0x8603('0x3a')][_0x8603('0x77')][_0x8603('0x51')];_0x2bb79f+=0x1){socket[_0x8603('0x74')](_0x8603('0x90'),{'UserId':Number(_0x39a9b9['query']['ids'][_0x2bb79f]),'WhatsappQueueId':Number(_0x39a9b9[_0x8603('0x4e')]['id'])});}}else{socket[_0x8603('0x74')](_0x8603('0x90'),{'UserId':Number(_0x39a9b9['query'][_0x8603('0x77')]),'WhatsappQueueId':Number(_0x39a9b9[_0x8603('0x4e')]['id'])});}});}})[_0x8603('0x31')](respondWithStatusCode(_0x6f003b,null))[_0x8603('0x4c')](handleError(_0x6f003b,null));};exports[_0x8603('0x91')]=function(_0x436bb1,_0x55d46e,_0x4d6c08){var _0x1798f9={};var _0x1ca5ae={};var _0x5ae832;var _0x4efbd5;return db[_0x8603('0x37')][_0x8603('0x6a')]({'where':{'id':_0x436bb1[_0x8603('0x4e')]['id']}})[_0x8603('0x31')](handleEntityNotFound(_0x55d46e,null))[_0x8603('0x31')](function(_0x1c8fdf){if(_0x1c8fdf){_0x5ae832=_0x1c8fdf;_0x1ca5ae[_0x8603('0x39')]=_[_0x8603('0x4f')](db['User'][_0x8603('0x50')]);_0x1ca5ae[_0x8603('0x3a')]=_['keys'](_0x436bb1['query']);_0x1ca5ae[_0x8603('0x3b')]=_[_0x8603('0x3d')](_0x1ca5ae[_0x8603('0x39')],_0x1ca5ae['query']);_0x1798f9[_0x8603('0x3c')]=_['intersection'](_0x1ca5ae[_0x8603('0x39')],qs[_0x8603('0x3e')](_0x436bb1['query'][_0x8603('0x3e')]));_0x1798f9[_0x8603('0x3c')]=_0x1798f9['attributes']['length']?_0x1798f9[_0x8603('0x3c')]:_0x1ca5ae[_0x8603('0x39')];_0x1798f9[_0x8603('0x41')]=qs[_0x8603('0x42')](_0x436bb1[_0x8603('0x3a')]['sort']);_0x1798f9[_0x8603('0x43')]=qs[_0x8603('0x3b')](_['pick'](_0x436bb1[_0x8603('0x3a')],_0x1ca5ae[_0x8603('0x3b')]));if(_0x436bb1['query'][_0x8603('0x45')]){_0x1798f9[_0x8603('0x43')]=_['merge'](_0x1798f9[_0x8603('0x43')],{'$or':_[_0x8603('0x5d')](_0x1798f9[_0x8603('0x3c')],function(_0x116329){var _0x4fbfc7={};_0x4fbfc7[_0x116329]={'$like':'%'+_0x436bb1[_0x8603('0x3a')]['filter']+'%'};return _0x4fbfc7;})});}_0x1798f9=_[_0x8603('0x48')]({},_0x1798f9,_0x436bb1[_0x8603('0x5e')]);return _0x5ae832['getAgents'](_0x1798f9);}})['then'](function(_0x3d7f8b){if(_0x3d7f8b){_0x4efbd5=_0x3d7f8b[_0x8603('0x51')];if(!_0x436bb1[_0x8603('0x3a')][_0x8603('0x3f')]('nolimit')){_0x1798f9[_0x8603('0x26')]=qs[_0x8603('0x26')](_0x436bb1[_0x8603('0x3a')][_0x8603('0x26')]);_0x1798f9['offset']=qs[_0x8603('0x28')](_0x436bb1[_0x8603('0x3a')][_0x8603('0x28')]);}return _0x5ae832[_0x8603('0x91')](_0x1798f9);}})[_0x8603('0x31')](function(_0xd50a1c){if(_0xd50a1c){return _0xd50a1c?{'count':_0x4efbd5,'rows':_0xd50a1c}:null;}})[_0x8603('0x31')](respondWithResult(_0x55d46e,null))[_0x8603('0x4c')](handleError(_0x55d46e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 90f9dc5..08ccd3b 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 _0xe22d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x500f7c,_0x47850){var _0x6e8c68=function(_0x2b15f8){while(--_0x2b15f8){_0x500f7c['push'](_0x500f7c['shift']());}};_0x6e8c68(++_0x47850);}(_0xe22d,0xe4));var _0xde22=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe22d[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xde22('0x0'));var WhatsappQueue=require(_0xde22('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xde22('0x2')](0x0);var events={'afterCreate':_0xde22('0x3'),'afterUpdate':_0xde22('0x4'),'afterDestroy':_0xde22('0x5')};function emitEvent(_0x4e504b){return function(_0x9ad433,_0x543ebb,_0x1292dc){WhatsappQueueEvents[_0xde22('0x6')](_0x4e504b+':'+_0x9ad433['id'],_0x9ad433);WhatsappQueueEvents[_0xde22('0x6')](_0x4e504b,_0x9ad433);_0x1292dc(null);};}for(var e in events){if(events[_0xde22('0x7')](e)){var event=events[e];WhatsappQueue[_0xde22('0x8')](e,emitEvent(event));}}module[_0xde22('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xd0b1=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0xd0b1,0x9d));var _0x1d0b=function(_0xc8718c,_0x3a17bb){_0xc8718c=_0xc8718c-0x0;var _0x53b072=_0xd0b1[_0xc8718c];return _0x53b072;};'use strict';var EventEmitter=require(_0x1d0b('0x0'));var WhatsappQueue=require(_0x1d0b('0x1'))['db'][_0x1d0b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1d0b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1d0b('0x4'),'afterDestroy':_0x1d0b('0x5')};function emitEvent(_0x4cd1a8){return function(_0x591f5e,_0x314b30,_0x4e5eb5){WhatsappQueueEvents[_0x1d0b('0x6')](_0x4cd1a8+':'+_0x591f5e['id'],_0x591f5e);WhatsappQueueEvents['emit'](_0x4cd1a8,_0x591f5e);_0x4e5eb5(null);};}for(var e in events){if(events[_0x1d0b('0x7')](e)){var event=events[e];WhatsappQueue[_0x1d0b('0x8')](e,emitEvent(event));}}module[_0x1d0b('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0480666..7ea5f30 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 _0x5a50=['define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5a50,0x17c));var _0x05a5=function(_0x14a1b0,_0x1984db){_0x14a1b0=_0x14a1b0-0x0;var _0x4abdaf=_0x5a50[_0x14a1b0];return _0x4abdaf;};'use strict';var _=require(_0x05a5('0x0'));var util=require('util');var logger=require(_0x05a5('0x1'))(_0x05a5('0x2'));var moment=require(_0x05a5('0x3'));var BPromise=require(_0x05a5('0x4'));var rp=require(_0x05a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05a5('0x6'));var config=require(_0x05a5('0x7'));var attributes=require(_0x05a5('0x8'));module[_0x05a5('0x9')]=function(_0x23dc0a,_0x3d9991){return _0x23dc0a[_0x05a5('0xa')](_0x05a5('0xb'),attributes,{'tableName':_0x05a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb643=['./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','moment','request-promise','path','../../config/environment'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xb643,0x1ac));var _0x3b64=function(_0x3dddb9,_0x3b2f73){_0x3dddb9=_0x3dddb9-0x0;var _0x4df584=_0xb643[_0x3dddb9];return _0x4df584;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3b64('0x0'));var BPromise=require('bluebird');var rp=require(_0x3b64('0x1'));var fs=require('fs');var path=require(_0x3b64('0x2'));var rimraf=require('rimraf');var config=require(_0x3b64('0x3'));var attributes=require(_0x3b64('0x4'));module['exports']=function(_0x2a41b2,_0x14598a){return _0x2a41b2[_0x3b64('0x5')](_0x3b64('0x6'),attributes,{'tableName':_0x3b64('0x7'),'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 a99c7a7..8c98033 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 _0x0973=['error','code','WhatsappQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','find','ShowWhatsappQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x197a7a,_0x4b9054){var _0x386cb6=function(_0xa32b1b){while(--_0xa32b1b){_0x197a7a['push'](_0x197a7a['shift']());}};_0x386cb6(++_0x4b9054);}(_0x0973,0x1aa));var _0x3097=function(_0x4e5ded,_0x3897b){_0x4e5ded=_0x4e5ded-0x0;var _0x1e2999=_0x0973[_0x4e5ded];return _0x1e2999;};'use strict';var _=require(_0x3097('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3097('0x1'));var rs=require(_0x3097('0x2'));var fs=require('fs');var Redis=require(_0x3097('0x3'));var db=require(_0x3097('0x4'))['db'];var utils=require(_0x3097('0x5'));var logger=require(_0x3097('0x6'))(_0x3097('0x7'));var config=require('../../config/environment');var jayson=require(_0x3097('0x8'));var client=jayson['client'][_0x3097('0x9')]({'port':0x232a});config[_0x3097('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3097('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x499b3b,_0x3ae7a1,_0x34b2f2){return new BPromise(function(_0x16c1d3,_0x3696f8){return client[_0x3097('0xc')](_0x499b3b,_0x34b2f2)[_0x3097('0xd')](function(_0x42769b){logger[_0x3097('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0x3ae7a1,'request\x20sent');logger[_0x3097('0xf')](_0x3097('0x10'),_0x3ae7a1,'request\x20sent',JSON[_0x3097('0x11')](_0x42769b));if(_0x42769b[_0x3097('0x12')]){if(_0x42769b[_0x3097('0x12')][_0x3097('0x13')]===0x1f4){logger[_0x3097('0x12')](_0x3097('0x14'),_0x3ae7a1,_0x42769b[_0x3097('0x12')]['message']);return _0x3696f8(_0x42769b[_0x3097('0x12')][_0x3097('0x15')]);}logger[_0x3097('0x12')](_0x3097('0x14'),_0x3ae7a1,_0x42769b[_0x3097('0x12')]['message']);return _0x16c1d3(_0x42769b[_0x3097('0x12')][_0x3097('0x15')]);}else{logger[_0x3097('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0x3ae7a1,_0x3097('0x16'));_0x16c1d3(_0x42769b[_0x3097('0x17')][_0x3097('0x15')]);}})[_0x3097('0x18')](function(_0x2ebcbd){logger[_0x3097('0x12')](_0x3097('0x14'),_0x3ae7a1,_0x2ebcbd);_0x3696f8(_0x2ebcbd);});});}exports[_0x3097('0x19')]=function(_0x482f7a){var _0x4a54ea=this;return new Promise(function(_0xef7881,_0x4b0eb8){return db[_0x3097('0x1a')][_0x3097('0x1b')]({'raw':_0x482f7a['options']?_0x482f7a[_0x3097('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x482f7a[_0x3097('0x1c')]?_0x482f7a[_0x3097('0x1c')][_0x3097('0x1d')]||null:null,'attributes':_0x482f7a[_0x3097('0x1c')]?_0x482f7a[_0x3097('0x1c')][_0x3097('0x1e')]||null:null,'limit':_0x482f7a[_0x3097('0x1c')]?_0x482f7a[_0x3097('0x1c')][_0x3097('0x1f')]||null:null,'include':_0x482f7a[_0x3097('0x1c')]?_0x482f7a[_0x3097('0x1c')][_0x3097('0x20')]?_[_0x3097('0x21')](_0x482f7a[_0x3097('0x1c')]['include'],function(_0x149097){return{'model':db[_0x149097[_0x3097('0x22')]],'as':_0x149097['as'],'attributes':_0x149097[_0x3097('0x1e')],'include':_0x149097['include']?_['map'](_0x149097['include'],function(_0xbf330c){return{'model':db[_0xbf330c[_0x3097('0x22')]],'as':_0xbf330c['as'],'attributes':_0xbf330c[_0x3097('0x1e')],'include':_0xbf330c[_0x3097('0x20')]?_[_0x3097('0x21')](_0xbf330c[_0x3097('0x20')],function(_0x1f484d){return{'model':db[_0x1f484d['model']],'as':_0x1f484d['as'],'attributes':_0x1f484d[_0x3097('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3097('0xd')](function(_0x3e6fb0){logger[_0x3097('0xe')](_0x3097('0x19'),_0x482f7a);logger['debug']('GetWhatsappQueue',_0x482f7a,JSON[_0x3097('0x11')](_0x3e6fb0));_0xef7881(_0x3e6fb0);})[_0x3097('0x18')](function(_0x26f4d5){logger['error'](_0x3097('0x19'),_0x26f4d5['message'],_0x482f7a);_0x4b0eb8(_0x4a54ea['error'](0x1f4,_0x26f4d5[_0x3097('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x4bf34e){var _0x3d0b95=this;return new Promise(function(_0x323480,_0x59607e){return db[_0x3097('0x1a')][_0x3097('0x23')]({'raw':_0x4bf34e['options']?_0x4bf34e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bf34e['options']?_0x4bf34e[_0x3097('0x1c')][_0x3097('0x1d')]||null:null,'attributes':_0x4bf34e[_0x3097('0x1c')]?_0x4bf34e[_0x3097('0x1c')][_0x3097('0x1e')]||null:null,'include':_0x4bf34e[_0x3097('0x1c')]?_0x4bf34e['options'][_0x3097('0x20')]?_['map'](_0x4bf34e['options'][_0x3097('0x20')],function(_0x3edceb){return{'model':db[_0x3edceb[_0x3097('0x22')]],'as':_0x3edceb['as'],'attributes':_0x3edceb[_0x3097('0x1e')],'include':_0x3edceb[_0x3097('0x20')]?_[_0x3097('0x21')](_0x3edceb['include'],function(_0x374884){return{'model':db[_0x374884[_0x3097('0x22')]],'as':_0x374884['as'],'attributes':_0x374884['attributes'],'include':_0x374884[_0x3097('0x20')]?_[_0x3097('0x21')](_0x374884['include'],function(_0x4fead1){return{'model':db[_0x4fead1['model']],'as':_0x4fead1['as'],'attributes':_0x4fead1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3097('0xd')](function(_0x245597){logger[_0x3097('0xe')](_0x3097('0x24'),_0x4bf34e);logger[_0x3097('0xf')](_0x3097('0x24'),_0x4bf34e,JSON['stringify'](_0x245597));_0x323480(_0x245597);})[_0x3097('0x18')](function(_0xc07871){logger[_0x3097('0x12')]('ShowWhatsappQueue',_0xc07871[_0x3097('0x15')],_0x4bf34e);_0x59607e(_0x3d0b95[_0x3097('0x12')](0x1f4,_0xc07871['message']));});});}; \ No newline at end of file +var _0x1178=['request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','WhatsappQueue','find','ShowWhatsappQueue','debug','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x59192f,_0x296497){var _0x350ef0=function(_0x3d6db7){while(--_0x3d6db7){_0x59192f['push'](_0x59192f['shift']());}};_0x350ef0(++_0x296497);}(_0x1178,0x6b));var _0x8117=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1178[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x8117('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8117('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8117('0x2'))['db'];var utils=require(_0x8117('0x3'));var logger=require(_0x8117('0x4'))(_0x8117('0x5'));var config=require(_0x8117('0x6'));var jayson=require(_0x8117('0x7'));var client=jayson[_0x8117('0x8')][_0x8117('0x9')]({'port':0x232a});config['redis']=_[_0x8117('0xa')](config[_0x8117('0xb')],{'host':_0x8117('0xc'),'port':0x18eb});var socket=require(_0x8117('0xd'))(new Redis(config['redis']));require(_0x8117('0xe'))[_0x8117('0xf')](socket);function respondWithRpcPromise(_0x49b8d8,_0x5e10c8,_0x134170){return new BPromise(function(_0x3ad638,_0x108de7){return client[_0x8117('0x10')](_0x49b8d8,_0x134170)[_0x8117('0x11')](function(_0x5464ef){logger[_0x8117('0x12')](_0x8117('0x13'),_0x5e10c8,_0x8117('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5e10c8,_0x8117('0x14'),JSON[_0x8117('0x15')](_0x5464ef));if(_0x5464ef[_0x8117('0x16')]){if(_0x5464ef['error'][_0x8117('0x17')]===0x1f4){logger[_0x8117('0x16')](_0x8117('0x13'),_0x5e10c8,_0x5464ef[_0x8117('0x16')][_0x8117('0x18')]);return _0x108de7(_0x5464ef[_0x8117('0x16')][_0x8117('0x18')]);}logger[_0x8117('0x16')](_0x8117('0x13'),_0x5e10c8,_0x5464ef[_0x8117('0x16')][_0x8117('0x18')]);return _0x3ad638(_0x5464ef['error'][_0x8117('0x18')]);}else{logger[_0x8117('0x12')](_0x8117('0x13'),_0x5e10c8,_0x8117('0x14'));_0x3ad638(_0x5464ef[_0x8117('0x19')][_0x8117('0x18')]);}})[_0x8117('0x1a')](function(_0x438dc5){logger[_0x8117('0x16')](_0x8117('0x13'),_0x5e10c8,_0x438dc5);_0x108de7(_0x438dc5);});});}exports['GetWhatsappQueue']=function(_0x36182f){var _0x294063=this;return new Promise(function(_0x3c64de,_0x144583){return db['WhatsappQueue'][_0x8117('0x1b')]({'raw':_0x36182f[_0x8117('0x1c')]?_0x36182f[_0x8117('0x1c')][_0x8117('0x1d')]===undefined?!![]:![]:!![],'where':_0x36182f['options']?_0x36182f[_0x8117('0x1c')][_0x8117('0x1e')]||null:null,'attributes':_0x36182f[_0x8117('0x1c')]?_0x36182f['options'][_0x8117('0x1f')]||null:null,'limit':_0x36182f[_0x8117('0x1c')]?_0x36182f['options'][_0x8117('0x20')]||null:null,'include':_0x36182f['options']?_0x36182f[_0x8117('0x1c')][_0x8117('0x21')]?_[_0x8117('0x22')](_0x36182f[_0x8117('0x1c')][_0x8117('0x21')],function(_0x500757){return{'model':db[_0x500757[_0x8117('0x23')]],'as':_0x500757['as'],'attributes':_0x500757['attributes'],'include':_0x500757[_0x8117('0x21')]?_['map'](_0x500757[_0x8117('0x21')],function(_0x27f577){return{'model':db[_0x27f577[_0x8117('0x23')]],'as':_0x27f577['as'],'attributes':_0x27f577['attributes'],'include':_0x27f577['include']?_[_0x8117('0x22')](_0x27f577[_0x8117('0x21')],function(_0x4e6214){return{'model':db[_0x4e6214[_0x8117('0x23')]],'as':_0x4e6214['as'],'attributes':_0x4e6214[_0x8117('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34870f){logger[_0x8117('0x12')](_0x8117('0x24'),_0x36182f);logger['debug'](_0x8117('0x24'),_0x36182f,JSON[_0x8117('0x15')](_0x34870f));_0x3c64de(_0x34870f);})[_0x8117('0x1a')](function(_0x5889b3){logger[_0x8117('0x16')](_0x8117('0x24'),_0x5889b3['message'],_0x36182f);_0x144583(_0x294063['error'](0x1f4,_0x5889b3[_0x8117('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x36a8cf){var _0x508f9d=this;return new Promise(function(_0xba9d0,_0x98bddd){return db[_0x8117('0x25')][_0x8117('0x26')]({'raw':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')][_0x8117('0x1d')]===undefined?!![]:![]:!![],'where':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')]['where']||null:null,'attributes':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')][_0x8117('0x1f')]||null:null,'include':_0x36a8cf[_0x8117('0x1c')]?_0x36a8cf[_0x8117('0x1c')]['include']?_[_0x8117('0x22')](_0x36a8cf['options']['include'],function(_0x48337c){return{'model':db[_0x48337c[_0x8117('0x23')]],'as':_0x48337c['as'],'attributes':_0x48337c[_0x8117('0x1f')],'include':_0x48337c['include']?_[_0x8117('0x22')](_0x48337c[_0x8117('0x21')],function(_0x6269d){return{'model':db[_0x6269d[_0x8117('0x23')]],'as':_0x6269d['as'],'attributes':_0x6269d['attributes'],'include':_0x6269d[_0x8117('0x21')]?_['map'](_0x6269d[_0x8117('0x21')],function(_0x339fd9){return{'model':db[_0x339fd9[_0x8117('0x23')]],'as':_0x339fd9['as'],'attributes':_0x339fd9[_0x8117('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3df162){logger[_0x8117('0x12')](_0x8117('0x27'),_0x36a8cf);logger[_0x8117('0x28')](_0x8117('0x27'),_0x36a8cf,JSON[_0x8117('0x15')](_0x3df162));_0xba9d0(_0x3df162);})[_0x8117('0x1a')](function(_0x1de9ad){logger[_0x8117('0x16')]('ShowWhatsappQueue',_0x1de9ad['message'],_0x36a8cf);_0x98bddd(_0x508f9d[_0x8117('0x16')](0x1f4,_0x1de9ad[_0x8117('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6f6a066..8d031e1 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 _0x50a5=['./whatsappQueue.events','save','remove','update','emit','removeListener','register','whatsappQueue:'];(function(_0x5e2b34,_0x58385c){var _0x4859f9=function(_0x177263){while(--_0x177263){_0x5e2b34['push'](_0x5e2b34['shift']());}};_0x4859f9(++_0x58385c);}(_0x50a5,0x130));var _0x550a=function(_0x553346,_0x22f262){_0x553346=_0x553346-0x0;var _0x308258=_0x50a5[_0x553346];return _0x308258;};'use strict';var WhatsappQueueEvents=require(_0x550a('0x0'));var events=[_0x550a('0x1'),_0x550a('0x2'),_0x550a('0x3')];function createListener(_0x5c11cc,_0x5620f5){return function(_0x1ca687){_0x5620f5[_0x550a('0x4')](_0x5c11cc,_0x1ca687);};}function removeListener(_0x1961af,_0x4f887e){return function(){WhatsappQueueEvents[_0x550a('0x5')](_0x1961af,_0x4f887e);};}exports[_0x550a('0x6')]=function(_0x1c48fb){for(var _0x3fd8fe=0x0,_0x32dcc3=events['length'];_0x3fd8fe<_0x32dcc3;_0x3fd8fe++){var _0x318e27=events[_0x3fd8fe];var _0x3c9568=createListener(_0x550a('0x7')+_0x318e27,_0x1c48fb);WhatsappQueueEvents['on'](_0x318e27,_0x3c9568);}}; \ No newline at end of file +var _0xe495=['save','remove','update','emit','removeListener','length','./whatsappQueue.events'];(function(_0x4d1a22,_0x26d848){var _0x341065=function(_0x1e994c){while(--_0x1e994c){_0x4d1a22['push'](_0x4d1a22['shift']());}};_0x341065(++_0x26d848);}(_0xe495,0x1f0));var _0x5e49=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe495[_0x46698a];return _0x356db0;};'use strict';var WhatsappQueueEvents=require(_0x5e49('0x0'));var events=[_0x5e49('0x1'),_0x5e49('0x2'),_0x5e49('0x3')];function createListener(_0x4fd504,_0x4eeedd){return function(_0x467e11){_0x4eeedd[_0x5e49('0x4')](_0x4fd504,_0x467e11);};}function removeListener(_0x29c38a,_0x12eead){return function(){WhatsappQueueEvents[_0x5e49('0x5')](_0x29c38a,_0x12eead);};}exports['register']=function(_0x508eeb){for(var _0x1e652e=0x0,_0x45c207=events[_0x5e49('0x6')];_0x1e652e<_0x45c207;_0x1e652e++){var _0x4fc09e=events[_0x1e652e];var _0x417be9=createListener('whatsappQueue:'+_0x4fc09e,_0x508eeb);WhatsappQueueEvents['on'](_0x4fc09e,_0x417be9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 414d3d0..8efe19d 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 _0x18ba=['../../components/interaction/service','isAuthenticated','get','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x18ba,0x1dc));var _0xa18b=function(_0x151123,_0x11179f){_0x151123=_0x151123-0x0;var _0x12778f=_0x18ba[_0x151123];return _0x12778f;};'use strict';var multer=require(_0xa18b('0x0'));var util=require(_0xa18b('0x1'));var path=require('path');var timeout=require(_0xa18b('0x2'));var express=require('express');var router=express[_0xa18b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa18b('0x4'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0xa18b('0x5')](),controller['index']);router[_0xa18b('0x6')](_0xa18b('0x7'),auth[_0xa18b('0x5')](),controller[_0xa18b('0x8')]);router[_0xa18b('0x6')]('/:id',auth[_0xa18b('0x5')](),controller['show']);router[_0xa18b('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa18b('0xa')](_0xa18b('0xb'),auth[_0xa18b('0x5')](),controller[_0xa18b('0xc')]);router[_0xa18b('0xd')](_0xa18b('0xb'),auth[_0xa18b('0x5')](),controller[_0xa18b('0xe')]);module[_0xa18b('0xf')]=router; \ No newline at end of file +var _0xd2fa=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x4f8bd3,_0x51b717){var _0x15b6b6=function(_0x66b76e){while(--_0x66b76e){_0x4f8bd3['push'](_0x4f8bd3['shift']());}};_0x15b6b6(++_0x51b717);}(_0xd2fa,0xe7));var _0xad2f=function(_0x22e81b,_0xaaab20){_0x22e81b=_0x22e81b-0x0;var _0x256b3f=_0xd2fa[_0x22e81b];return _0x256b3f;};'use strict';var multer=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var path=require(_0xad2f('0x2'));var timeout=require(_0xad2f('0x3'));var express=require('express');var router=express[_0xad2f('0x4')]();var fs_extra=require(_0xad2f('0x5'));var auth=require(_0xad2f('0x6'));var interaction=require(_0xad2f('0x7'));var config=require(_0xad2f('0x8'));var controller=require(_0xad2f('0x9'));router[_0xad2f('0xa')]('/',auth[_0xad2f('0xb')](),controller[_0xad2f('0xc')]);router[_0xad2f('0xa')](_0xad2f('0xd'),auth['isAuthenticated'](),controller[_0xad2f('0xe')]);router[_0xad2f('0xa')](_0xad2f('0xf'),auth[_0xad2f('0xb')](),controller[_0xad2f('0x10')]);router[_0xad2f('0x11')]('/',auth[_0xad2f('0xb')](),controller[_0xad2f('0x12')]);router['put'](_0xad2f('0xf'),auth[_0xad2f('0xb')](),controller[_0xad2f('0x13')]);router[_0xad2f('0x14')](_0xad2f('0xf'),auth[_0xad2f('0xb')](),controller['destroy']);module[_0xad2f('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2091832..751e9bb 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(_0x2e0565,_0x40c61e){var _0x537ceb=function(_0x5b71cf){while(--_0x5b71cf){_0x2e0565['push'](_0x2e0565['shift']());}};_0x537ceb(++_0x40c61e);}(_0x7a54,0x106));var _0x47a5=function(_0x3f6509,_0x23b222){_0x3f6509=_0x3f6509-0x0;var _0xb11349=_0x7a54[_0x3f6509];return _0xb11349;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x38639c,_0x5626f7){var _0x29eed4=function(_0x4b8f8f){while(--_0x4b8f8f){_0x38639c['push'](_0x38639c['shift']());}};_0x29eed4(++_0x5626f7);}(_0x7a54,0x106));var _0x47a5=function(_0x186193,_0x4e6533){_0x186193=_0x186193-0x0;var _0x5870cf=_0x7a54[_0x186193];return _0x5870cf;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a82e5bf..cbac877 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 _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0x72b52e,_0x423dfb){var _0x3c9f07=function(_0x2cd423){while(--_0x2cd423){_0x72b52e['push'](_0x72b52e['shift']());}};_0x3c9f07(++_0x423dfb);}(_0x3266,0x6a));var _0x6326=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x3266[_0xbf8ebe];return _0x1e25e8;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file +var _0xb688=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','show','includeAll','include','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4573a3,_0x4eaf86){var _0xc9e395=function(_0x26c51b){while(--_0x26c51b){_0x4573a3['push'](_0x4573a3['shift']());}};_0xc9e395(++_0x4eaf86);}(_0xb688,0xcf));var _0x8b68=function(_0x32cca2,_0x3ad320){_0x32cca2=_0x32cca2-0x0;var _0x4a8600=_0xb688[_0x32cca2];return _0x4a8600;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){_0x32ddc5['status'](0xcc)[_0x8b68('0x27')]();});}};}function handleEntityNotFound(_0x3cf8d2,_0x240b0b){return function(_0x5590ec){if(!_0x5590ec){_0x3cf8d2['sendStatus'](0x194);}return _0x5590ec;};}function handleError(_0x4fe8f6,_0x92d186){_0x92d186=_0x92d186||0x1f4;return function(_0x448e43){logger[_0x8b68('0x28')](_0x448e43['stack']);if(_0x448e43[_0x8b68('0x29')]){delete _0x448e43['name'];}_0x4fe8f6['status'](_0x92d186)[_0x8b68('0x2a')](_0x448e43);};}exports['index']=function(_0x26cad7,_0x3ac356){var _0x48e2c8={},_0x494ce4={},_0x357635={'count':0x0,'rows':[]};var _0x1cd230=_[_0x8b68('0x2b')](db[_0x8b68('0x2c')][_0x8b68('0x2d')],function(_0x2ad2df){return{'name':_0x2ad2df[_0x8b68('0x2e')],'type':_0x2ad2df['type'][_0x8b68('0x2f')]};});_0x494ce4['model']=_[_0x8b68('0x2b')](_0x1cd230,_0x8b68('0x29'));_0x494ce4['query']=_[_0x8b68('0x30')](_0x26cad7[_0x8b68('0x31')]);_0x494ce4[_0x8b68('0x32')]=_['intersection'](_0x494ce4['model'],_0x494ce4[_0x8b68('0x31')]);_0x48e2c8[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x494ce4[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x36')]));_0x48e2c8[_0x8b68('0x33')]=_0x48e2c8[_0x8b68('0x33')][_0x8b68('0x37')]?_0x48e2c8[_0x8b68('0x33')]:_0x494ce4[_0x8b68('0x35')];if(!_0x26cad7[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x48e2c8[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x1f')]);_0x48e2c8[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x26cad7[_0x8b68('0x31')]['offset']);}_0x48e2c8['order']=qs[_0x8b68('0x3a')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3a')]);_0x48e2c8[_0x8b68('0x3b')]=qs[_0x8b68('0x32')](_[_0x8b68('0x3c')](_0x26cad7[_0x8b68('0x31')],_0x494ce4[_0x8b68('0x32')]),_0x1cd230);if(_0x26cad7['query'][_0x8b68('0x3d')]){_0x48e2c8[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x48e2c8[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x2b')](_0x1cd230,function(_0x3e0032){if(_0x3e0032[_0x8b68('0x3f')]!==_0x8b68('0x40')){var _0x517571={};_0x517571[_0x3e0032[_0x8b68('0x29')]]={'$like':'%'+_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3d')]+'%'};return _0x517571;}})});}_0x48e2c8=_[_0x8b68('0x3e')]({},_0x48e2c8,_0x26cad7[_0x8b68('0x41')]);var _0x3b3394={'where':_0x48e2c8[_0x8b68('0x3b')]};return db['WhatsappQueueReport'][_0x8b68('0x21')](_0x3b3394)[_0x8b68('0x25')](function(_0x48f159){_0x357635[_0x8b68('0x21')]=_0x48f159;if(_0x26cad7[_0x8b68('0x31')]['includeAll']){_0x48e2c8['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x48e2c8);})[_0x8b68('0x25')](function(_0x23d24a){_0x357635['rows']=_0x23d24a;return _0x357635;})[_0x8b68('0x25')](respondWithFilteredResult(_0x3ac356,_0x48e2c8))['catch'](handleError(_0x3ac356,null));};exports[_0x8b68('0x42')]=function(_0x3841d2,_0x5a3193){var _0x2f90d9={'raw':!![],'where':{'id':_0x3841d2['params']['id']}},_0x5ae345={};_0x5ae345['model']=_[_0x8b68('0x30')](db[_0x8b68('0x2c')][_0x8b68('0x2d')]);_0x5ae345[_0x8b68('0x31')]=_['keys'](_0x3841d2[_0x8b68('0x31')]);_0x5ae345['filters']=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],_0x5ae345['query']);_0x2f90d9[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x3841d2['query'][_0x8b68('0x36')]));_0x2f90d9[_0x8b68('0x33')]=_0x2f90d9[_0x8b68('0x33')][_0x8b68('0x37')]?_0x2f90d9[_0x8b68('0x33')]:_0x5ae345[_0x8b68('0x35')];if(_0x3841d2[_0x8b68('0x31')][_0x8b68('0x43')]){_0x2f90d9[_0x8b68('0x44')]=[{'all':!![]}];}_0x2f90d9=_[_0x8b68('0x3e')]({},_0x2f90d9,_0x3841d2[_0x8b68('0x41')]);return db[_0x8b68('0x2c')][_0x8b68('0x45')](_0x2f90d9)[_0x8b68('0x25')](handleEntityNotFound(_0x5a3193,null))[_0x8b68('0x25')](respondWithResult(_0x5a3193,null))[_0x8b68('0x46')](handleError(_0x5a3193,null));};exports['create']=function(_0x3b7b06,_0x20681a){return db['WhatsappQueueReport'][_0x8b68('0x47')](_0x3b7b06['body'],{})['then'](respondWithResult(_0x20681a,0xc9))['catch'](handleError(_0x20681a,null));};exports[_0x8b68('0x24')]=function(_0x35874b,_0x34047c){if(_0x35874b[_0x8b68('0x48')]['id']){delete _0x35874b['body']['id'];}return db['WhatsappQueueReport'][_0x8b68('0x45')]({'where':{'id':_0x35874b[_0x8b68('0x49')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))['then'](saveUpdates(_0x35874b[_0x8b68('0x48')],null))[_0x8b68('0x25')](respondWithResult(_0x34047c,null))['catch'](handleError(_0x34047c,null));};exports[_0x8b68('0x26')]=function(_0xacac82,_0x595942){return db[_0x8b68('0x2c')][_0x8b68('0x45')]({'where':{'id':_0xacac82['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x595942,null))[_0x8b68('0x25')](removeEntity(_0x595942,null))['catch'](handleError(_0x595942,null));};exports['describe']=function(_0x5e3e99,_0x28f82d){return db[_0x8b68('0x2c')][_0x8b68('0x4a')]()[_0x8b68('0x25')](respondWithResult(_0x28f82d,null))['catch'](handleError(_0x28f82d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0e96c8b..68be1c2 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 _0x27fa=['exports','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes'];(function(_0x4513fb,_0x400f2b){var _0x18a8c9=function(_0xce95ac){while(--_0xce95ac){_0x4513fb['push'](_0x4513fb['shift']());}};_0x18a8c9(++_0x400f2b);}(_0x27fa,0x114));var _0xa27f=function(_0x303221,_0x58a6b7){_0x303221=_0x303221-0x0;var _0x5b2f6d=_0x27fa[_0x303221];return _0x5b2f6d;};'use strict';var _=require(_0xa27f('0x0'));var util=require(_0xa27f('0x1'));var logger=require(_0xa27f('0x2'))(_0xa27f('0x3'));var moment=require(_0xa27f('0x4'));var BPromise=require(_0xa27f('0x5'));var rp=require(_0xa27f('0x6'));var fs=require('fs');var path=require(_0xa27f('0x7'));var rimraf=require(_0xa27f('0x8'));var config=require('../../config/environment');var attributes=require(_0xa27f('0x9'));module[_0xa27f('0xa')]=function(_0x24d376,_0x1b00ea){return _0x24d376['define'](_0xa27f('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa27f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb2=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','api','moment','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x5bb2,0xb9));var _0x25bb=function(_0x104ea5,_0x77735a){_0x104ea5=_0x104ea5-0x0;var _0x2061cc=_0x5bb2[_0x104ea5];return _0x2061cc;};'use strict';var _=require(_0x25bb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25bb('0x1'));var moment=require(_0x25bb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x25bb('0x3'));var attributes=require(_0x25bb('0x4'));module[_0x25bb('0x5')]=function(_0x24d569,_0x976b15){return _0x24d569[_0x25bb('0x6')](_0x25bb('0x7'),attributes,{'tableName':_0x25bb('0x8'),'paranoid':![],'indexes':[{'name':_0x25bb('0x9'),'fields':[_0x25bb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c28c20e..c8b9cdd 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 _0x9b37=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw','info','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util'];(function(_0x1149ac,_0x580f0d){var _0x2add38=function(_0x67e818){while(--_0x67e818){_0x1149ac['push'](_0x1149ac['shift']());}};_0x2add38(++_0x580f0d);}(_0x9b37,0x170));var _0x79b3=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x9b37[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require(_0x79b3('0x0'));var util=require(_0x79b3('0x1'));var moment=require(_0x79b3('0x2'));var BPromise=require(_0x79b3('0x3'));var rs=require(_0x79b3('0x4'));var fs=require('fs');var Redis=require(_0x79b3('0x5'));var db=require(_0x79b3('0x6'))['db'];var utils=require(_0x79b3('0x7'));var logger=require(_0x79b3('0x8'))(_0x79b3('0x9'));var config=require(_0x79b3('0xa'));var jayson=require(_0x79b3('0xb'));var client=jayson[_0x79b3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2529,_0x39d118,_0x314c8c){return new BPromise(function(_0x31f583,_0x1e3136){return client[_0x79b3('0xd')](_0x5a2529,_0x314c8c)[_0x79b3('0xe')](function(_0x5d8f7c){logger['info'](_0x79b3('0xf'),_0x39d118,_0x79b3('0x10'));logger[_0x79b3('0x11')](_0x79b3('0x12'),_0x39d118,_0x79b3('0x10'),JSON[_0x79b3('0x13')](_0x5d8f7c));if(_0x5d8f7c[_0x79b3('0x14')]){if(_0x5d8f7c['error'][_0x79b3('0x15')]===0x1f4){logger[_0x79b3('0x14')](_0x79b3('0xf'),_0x39d118,_0x5d8f7c[_0x79b3('0x14')][_0x79b3('0x16')]);return _0x1e3136(_0x5d8f7c[_0x79b3('0x14')][_0x79b3('0x16')]);}logger[_0x79b3('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x39d118,_0x5d8f7c[_0x79b3('0x14')][_0x79b3('0x16')]);return _0x31f583(_0x5d8f7c['error'][_0x79b3('0x16')]);}else{logger['info'](_0x79b3('0xf'),_0x39d118,_0x79b3('0x10'));_0x31f583(_0x5d8f7c[_0x79b3('0x17')][_0x79b3('0x16')]);}})[_0x79b3('0x18')](function(_0x219834){logger[_0x79b3('0x14')](_0x79b3('0xf'),_0x39d118,_0x219834);_0x1e3136(_0x219834);});});}exports['CreateWhatsappQueueReport']=function(_0x5eb981){var _0x146d5b=this;return new Promise(function(_0x41316e,_0x553691){return db[_0x79b3('0x19')][_0x79b3('0x1a')](_0x5eb981[_0x79b3('0x1b')],{'raw':_0x5eb981['options']?_0x5eb981[_0x79b3('0x1c')][_0x79b3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x34f893){logger[_0x79b3('0x1e')](_0x79b3('0x1f'),_0x5eb981);logger[_0x79b3('0x11')](_0x79b3('0x1f'),_0x5eb981,JSON[_0x79b3('0x13')](_0x34f893));_0x41316e(_0x34f893);})['catch'](function(_0x5be18e){logger['error'](_0x79b3('0x1f'),_0x5be18e[_0x79b3('0x16')],_0x5eb981);_0x553691(_0x146d5b[_0x79b3('0x14')](0x1f4,_0x5be18e[_0x79b3('0x16')]));});});};exports[_0x79b3('0x20')]=function(_0x5c4dbf){var _0x467629=this;return new Promise(function(_0x3d6894,_0x1e50ea){return db[_0x79b3('0x19')][_0x79b3('0x21')](_0x5c4dbf[_0x79b3('0x1b')],{'raw':_0x5c4dbf[_0x79b3('0x1c')]?_0x5c4dbf[_0x79b3('0x1c')][_0x79b3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c4dbf['options']?_0x5c4dbf[_0x79b3('0x1c')][_0x79b3('0x22')]||null:null,'attributes':_0x5c4dbf['options']?_0x5c4dbf[_0x79b3('0x1c')][_0x79b3('0x23')]||null:null,'limit':_0x5c4dbf['options']?_0x5c4dbf[_0x79b3('0x1c')][_0x79b3('0x24')]||null:null})['then'](function(_0x4e2589){logger[_0x79b3('0x1e')]('UpdateWhatsappQueueReport',_0x5c4dbf);logger[_0x79b3('0x11')](_0x79b3('0x20'),_0x5c4dbf,JSON[_0x79b3('0x13')](_0x4e2589));_0x3d6894(_0x4e2589);})[_0x79b3('0x18')](function(_0x1a2216){logger['error']('UpdateWhatsappQueueReport',_0x1a2216[_0x79b3('0x16')],_0x5c4dbf);_0x1e50ea(_0x467629['error'](0x1f4,_0x1a2216['message']));});});}; \ No newline at end of file +var _0x685f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','debug','UpdateWhatsappQueueReport','update','where','attributes','limit'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x685f,0x120));var _0xf685=function(_0x59625f,_0x886e05){_0x59625f=_0x59625f-0x0;var _0x57e38e=_0x685f[_0x59625f];return _0x57e38e;};'use strict';var _=require(_0xf685('0x0'));var util=require(_0xf685('0x1'));var moment=require(_0xf685('0x2'));var BPromise=require(_0xf685('0x3'));var rs=require(_0xf685('0x4'));var fs=require('fs');var Redis=require(_0xf685('0x5'));var db=require(_0xf685('0x6'))['db'];var utils=require(_0xf685('0x7'));var logger=require(_0xf685('0x8'))(_0xf685('0x9'));var config=require(_0xf685('0xa'));var jayson=require(_0xf685('0xb'));var client=jayson[_0xf685('0xc')][_0xf685('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x208b5b,_0x162668,_0x3dffd2){return new BPromise(function(_0x593c6b,_0x25cda3){return client[_0xf685('0xe')](_0x208b5b,_0x3dffd2)[_0xf685('0xf')](function(_0x272160){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x162668,_0xf685('0x10'));logger['debug'](_0xf685('0x11'),_0x162668,_0xf685('0x10'),JSON[_0xf685('0x12')](_0x272160));if(_0x272160[_0xf685('0x13')]){if(_0x272160[_0xf685('0x13')][_0xf685('0x14')]===0x1f4){logger[_0xf685('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x162668,_0x272160[_0xf685('0x13')][_0xf685('0x15')]);return _0x25cda3(_0x272160[_0xf685('0x13')][_0xf685('0x15')]);}logger[_0xf685('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x162668,_0x272160[_0xf685('0x13')][_0xf685('0x15')]);return _0x593c6b(_0x272160[_0xf685('0x13')]['message']);}else{logger[_0xf685('0x16')](_0xf685('0x17'),_0x162668,_0xf685('0x10'));_0x593c6b(_0x272160[_0xf685('0x18')][_0xf685('0x15')]);}})[_0xf685('0x19')](function(_0xd29a0f){logger[_0xf685('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x162668,_0xd29a0f);_0x25cda3(_0xd29a0f);});});}exports[_0xf685('0x1a')]=function(_0x3a1f82){var _0x12c94f=this;return new Promise(function(_0x1d26fc,_0x1127ba){return db[_0xf685('0x1b')][_0xf685('0x1c')](_0x3a1f82['body'],{'raw':_0x3a1f82[_0xf685('0x1d')]?_0x3a1f82[_0xf685('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xf685('0xf')](function(_0x1293ed){logger['info']('CreateWhatsappQueueReport',_0x3a1f82);logger[_0xf685('0x1e')]('CreateWhatsappQueueReport',_0x3a1f82,JSON['stringify'](_0x1293ed));_0x1d26fc(_0x1293ed);})[_0xf685('0x19')](function(_0x3da852){logger[_0xf685('0x13')](_0xf685('0x1a'),_0x3da852[_0xf685('0x15')],_0x3a1f82);_0x1127ba(_0x12c94f[_0xf685('0x13')](0x1f4,_0x3da852[_0xf685('0x15')]));});});};exports[_0xf685('0x1f')]=function(_0x172d82){var _0x28f1d1=this;return new Promise(function(_0x95ae4a,_0x374e9e){return db[_0xf685('0x1b')][_0xf685('0x20')](_0x172d82['body'],{'raw':_0x172d82[_0xf685('0x1d')]?_0x172d82[_0xf685('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172d82[_0xf685('0x1d')]?_0x172d82[_0xf685('0x1d')][_0xf685('0x21')]||null:null,'attributes':_0x172d82['options']?_0x172d82[_0xf685('0x1d')][_0xf685('0x22')]||null:null,'limit':_0x172d82[_0xf685('0x1d')]?_0x172d82[_0xf685('0x1d')][_0xf685('0x23')]||null:null})[_0xf685('0xf')](function(_0x5ad969){logger[_0xf685('0x16')](_0xf685('0x1f'),_0x172d82);logger[_0xf685('0x1e')]('UpdateWhatsappQueueReport',_0x172d82,JSON['stringify'](_0x5ad969));_0x95ae4a(_0x5ad969);})[_0xf685('0x19')](function(_0x4e9d6d){logger['error'](_0xf685('0x1f'),_0x4e9d6d[_0xf685('0x15')],_0x172d82);_0x374e9e(_0x28f1d1['error'](0x1f4,_0x4e9d6d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 84dd516..56e8d2b 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 _0xe7ef=['../../config/environment','isAuthenticated','index','get','describe','show','create','put','/:id','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x530182,_0x3a7dab){var _0x495d44=function(_0x255612){while(--_0x255612){_0x530182['push'](_0x530182['shift']());}};_0x495d44(++_0x3a7dab);}(_0xe7ef,0x8b));var _0xfe7e=function(_0x59b050,_0x59fd75){_0x59b050=_0x59b050-0x0;var _0x558ad6=_0xe7ef[_0x59b050];return _0x558ad6;};'use strict';var multer=require('multer');var util=require(_0xfe7e('0x0'));var path=require(_0xfe7e('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe7e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe7e('0x3'));var interaction=require(_0xfe7e('0x4'));var config=require(_0xfe7e('0x5'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xfe7e('0x6')](),controller[_0xfe7e('0x7')]);router[_0xfe7e('0x8')]('/describe',auth[_0xfe7e('0x6')](),controller[_0xfe7e('0x9')]);router[_0xfe7e('0x8')]('/:id',auth[_0xfe7e('0x6')](),controller[_0xfe7e('0xa')]);router['post']('/',auth[_0xfe7e('0x6')](),controller[_0xfe7e('0xb')]);router[_0xfe7e('0xc')](_0xfe7e('0xd'),auth['isAuthenticated'](),controller[_0xfe7e('0xe')]);router[_0xfe7e('0xf')](_0xfe7e('0xd'),auth[_0xfe7e('0x6')](),controller[_0xfe7e('0x10')]);module[_0xfe7e('0x11')]=router; \ No newline at end of file +var _0xad18=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy'];(function(_0x2cec07,_0x495906){var _0x5210a8=function(_0x59816b){while(--_0x59816b){_0x2cec07['push'](_0x2cec07['shift']());}};_0x5210a8(++_0x495906);}(_0xad18,0xdd));var _0x8ad1=function(_0x469f02,_0x880250){_0x469f02=_0x469f02-0x0;var _0x1a2a30=_0xad18[_0x469f02];return _0x1a2a30;};'use strict';var multer=require(_0x8ad1('0x0'));var util=require('util');var path=require(_0x8ad1('0x1'));var timeout=require(_0x8ad1('0x2'));var express=require(_0x8ad1('0x3'));var router=express[_0x8ad1('0x4')]();var fs_extra=require(_0x8ad1('0x5'));var auth=require(_0x8ad1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ad1('0x7'));router[_0x8ad1('0x8')]('/',auth['isAuthenticated'](),controller[_0x8ad1('0x9')]);router[_0x8ad1('0x8')](_0x8ad1('0xa'),auth[_0x8ad1('0xb')](),controller[_0x8ad1('0xc')]);router['get'](_0x8ad1('0xd'),auth[_0x8ad1('0xb')](),controller['show']);router[_0x8ad1('0xe')]('/',auth[_0x8ad1('0xb')](),controller[_0x8ad1('0xf')]);router[_0x8ad1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8ad1('0x11')]);router['delete'](_0x8ad1('0xd'),auth['isAuthenticated'](),controller[_0x8ad1('0x12')]);module[_0x8ad1('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5c50e25..c17ac8b 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 _0xc04a=['agent','queue','sequelize','STRING','account'];(function(_0x40f614,_0x1832f0){var _0x472f14=function(_0x5109f5){while(--_0x5109f5){_0x40f614['push'](_0x40f614['shift']());}};_0x472f14(++_0x1832f0);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xac04('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xac04('0x2'),_0xac04('0x3'),_0xac04('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x86dc=['account','agent','queue','sequelize','ENUM'];(function(_0x4489f4,_0x2cbf01){var _0x3a098b=function(_0x2806f9){while(--_0x2806f9){_0x4489f4['push'](_0x4489f4['shift']());}};_0x3a098b(++_0x2cbf01);}(_0x86dc,0x13e));var _0xc86d=function(_0x47490e,_0x33e492){_0x47490e=_0x47490e-0x0;var _0x33a344=_0x86dc[_0x47490e];return _0x33a344;};'use strict';var Sequelize=require(_0xc86d('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc86d('0x1')](_0xc86d('0x2'),_0xc86d('0x3'),_0xc86d('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9b5e927..371f032 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 _0x936d=['sort','where','merge','filter','options','include','findAll','rows','catch','params','rawAttributes','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x3a888c,_0x412ea4){var _0x164667=function(_0x5c5a7f){while(--_0x5c5a7f){_0x3a888c['push'](_0x3a888c['shift']());}};_0x164667(++_0x412ea4);}(_0x936d,0x183));var _0xd936=function(_0x4a26e1,_0x23a4a2){_0x4a26e1=_0x4a26e1-0x0;var _0x21027b=_0x936d[_0x4a26e1];return _0x21027b;};'use strict';var emlformat=require(_0xd936('0x0'));var rimraf=require(_0xd936('0x1'));var zipdir=require(_0xd936('0x2'));var jsonpatch=require(_0xd936('0x3'));var rp=require('request-promise');var moment=require(_0xd936('0x4'));var BPromise=require(_0xd936('0x5'));var Mustache=require(_0xd936('0x6'));var util=require(_0xd936('0x7'));var path=require(_0xd936('0x8'));var sox=require(_0xd936('0x9'));var csv=require(_0xd936('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd936('0xb'));var _=require(_0xd936('0xc'));var squel=require(_0xd936('0xd'));var crypto=require(_0xd936('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd936('0xf'));var toCsv=require(_0xd936('0xa'));var querystring=require('querystring');var Papa=require(_0xd936('0x10'));var Redis=require(_0xd936('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd936('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd936('0x13'));var logger=require(_0xd936('0x14'))(_0xd936('0x15'));var utils=require(_0xd936('0x16'));var config=require(_0xd936('0x17'));var licenseUtil=require(_0xd936('0x18'));var db=require(_0xd936('0x19'))['db'];function respondWithStatusCode(_0x434d80,_0x309978){_0x309978=_0x309978||0xcc;return function(_0x884e08){if(_0x884e08){return _0x434d80[_0xd936('0x1a')](_0x309978);}return _0x434d80[_0xd936('0x1b')](_0x309978)['end']();};}function respondWithResult(_0x39153f,_0x1feab7){_0x1feab7=_0x1feab7||0xc8;return function(_0xae89f4){if(_0xae89f4){return _0x39153f['status'](_0x1feab7)['json'](_0xae89f4);}};}function respondWithFilteredResult(_0x520168,_0x39627b){return function(_0x38a890){if(_0x38a890){var _0x26d441=typeof _0x39627b[_0xd936('0x1c')]===_0xd936('0x1d')&&typeof _0x39627b[_0xd936('0x1e')]===_0xd936('0x1d');var _0x262eb8=_0x38a890[_0xd936('0x1f')];var _0x1d5805=_0x26d441?0x0:_0x39627b['offset'];var _0x35011a=_0x26d441?_0x38a890[_0xd936('0x1f')]:_0x39627b['offset']+_0x39627b[_0xd936('0x1e')];var _0x48d37b;if(_0x35011a>=_0x262eb8){_0x35011a=_0x262eb8;_0x48d37b=0xc8;}else{_0x48d37b=0xce;}_0x520168[_0xd936('0x1b')](_0x48d37b);return _0x520168['set'](_0xd936('0x20'),_0x1d5805+'-'+_0x35011a+'/'+_0x262eb8)[_0xd936('0x21')](_0x38a890);}return null;};}function patchUpdates(_0x10c05d){return function(_0x2568dd){try{jsonpatch['apply'](_0x2568dd,_0x10c05d,!![]);}catch(_0x160927){return BPromise[_0xd936('0x22')](_0x160927);}return _0x2568dd[_0xd936('0x23')]();};}function saveUpdates(_0x382585,_0x310e5a){return function(_0x4a7f3a){if(_0x4a7f3a){return _0x4a7f3a[_0xd936('0x24')](_0x382585)[_0xd936('0x25')](function(_0x44e631){return _0x44e631;});}return null;};}function removeEntity(_0x29f419,_0x22b726){return function(_0x17f4c9){if(_0x17f4c9){return _0x17f4c9['destroy']()[_0xd936('0x25')](function(){_0x29f419[_0xd936('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d5c3,_0x1783ab){return function(_0xece3b9){if(!_0xece3b9){_0x39d5c3[_0xd936('0x1a')](0x194);}return _0xece3b9;};}function handleError(_0x48bb15,_0x1c2c00){_0x1c2c00=_0x1c2c00||0x1f4;return function(_0x48a6b3){logger['error'](_0x48a6b3[_0xd936('0x26')]);if(_0x48a6b3[_0xd936('0x27')]){delete _0x48a6b3[_0xd936('0x27')];}_0x48bb15[_0xd936('0x1b')](_0x1c2c00)[_0xd936('0x28')](_0x48a6b3);};}exports[_0xd936('0x29')]=function(_0x3c8d92,_0x3d6ed6){var _0xfb1f3c={},_0x4c1a94={},_0x34bc91={'count':0x0,'rows':[]};var _0x18b2ce=_[_0xd936('0x2a')](db[_0xd936('0x2b')]['rawAttributes'],function(_0x41b003){return{'name':_0x41b003[_0xd936('0x2c')],'type':_0x41b003[_0xd936('0x2d')][_0xd936('0x2e')]};});_0x4c1a94[_0xd936('0x2f')]=_['map'](_0x18b2ce,_0xd936('0x27'));_0x4c1a94['query']=_[_0xd936('0x30')](_0x3c8d92[_0xd936('0x31')]);_0x4c1a94[_0xd936('0x32')]=_[_0xd936('0x33')](_0x4c1a94['model'],_0x4c1a94['query']);_0xfb1f3c[_0xd936('0x34')]=_[_0xd936('0x33')](_0x4c1a94[_0xd936('0x2f')],qs[_0xd936('0x35')](_0x3c8d92[_0xd936('0x31')][_0xd936('0x35')]));_0xfb1f3c[_0xd936('0x34')]=_0xfb1f3c[_0xd936('0x34')][_0xd936('0x36')]?_0xfb1f3c[_0xd936('0x34')]:_0x4c1a94[_0xd936('0x2f')];if(!_0x3c8d92['query']['hasOwnProperty'](_0xd936('0x37'))){_0xfb1f3c['limit']=qs[_0xd936('0x1e')](_0x3c8d92['query'][_0xd936('0x1e')]);_0xfb1f3c[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0x3c8d92[_0xd936('0x31')][_0xd936('0x1c')]);}_0xfb1f3c[_0xd936('0x38')]=qs[_0xd936('0x39')](_0x3c8d92[_0xd936('0x31')][_0xd936('0x39')]);_0xfb1f3c['where']=qs[_0xd936('0x32')](_['pick'](_0x3c8d92['query'],_0x4c1a94[_0xd936('0x32')]),_0x18b2ce);if(_0x3c8d92['query']['filter']){_0xfb1f3c[_0xd936('0x3a')]=_[_0xd936('0x3b')](_0xfb1f3c[_0xd936('0x3a')],{'$or':_[_0xd936('0x2a')](_0x18b2ce,function(_0x1fadfb){if(_0x1fadfb[_0xd936('0x2d')]!=='VIRTUAL'){var _0x3e4e09={};_0x3e4e09[_0x1fadfb[_0xd936('0x27')]]={'$like':'%'+_0x3c8d92[_0xd936('0x31')][_0xd936('0x3c')]+'%'};return _0x3e4e09;}})});}_0xfb1f3c=_[_0xd936('0x3b')]({},_0xfb1f3c,_0x3c8d92[_0xd936('0x3d')]);var _0x5ce39f={'where':_0xfb1f3c[_0xd936('0x3a')]};return db[_0xd936('0x2b')][_0xd936('0x1f')](_0x5ce39f)[_0xd936('0x25')](function(_0x5cdbd4){_0x34bc91[_0xd936('0x1f')]=_0x5cdbd4;if(_0x3c8d92[_0xd936('0x31')]['includeAll']){_0xfb1f3c[_0xd936('0x3e')]=[{'all':!![]}];}return db[_0xd936('0x2b')][_0xd936('0x3f')](_0xfb1f3c);})[_0xd936('0x25')](function(_0x33ad69){_0x34bc91[_0xd936('0x40')]=_0x33ad69;return _0x34bc91;})[_0xd936('0x25')](respondWithFilteredResult(_0x3d6ed6,_0xfb1f3c))[_0xd936('0x41')](handleError(_0x3d6ed6,null));};exports['show']=function(_0x4d4844,_0x137644){var _0x5e55de={'raw':!![],'where':{'id':_0x4d4844[_0xd936('0x42')]['id']}},_0x16fd53={};_0x16fd53[_0xd936('0x2f')]=_[_0xd936('0x30')](db[_0xd936('0x2b')][_0xd936('0x43')]);_0x16fd53[_0xd936('0x31')]=_[_0xd936('0x30')](_0x4d4844[_0xd936('0x31')]);_0x16fd53['filters']=_[_0xd936('0x33')](_0x16fd53['model'],_0x16fd53[_0xd936('0x31')]);_0x5e55de[_0xd936('0x34')]=_[_0xd936('0x33')](_0x16fd53[_0xd936('0x2f')],qs[_0xd936('0x35')](_0x4d4844['query'][_0xd936('0x35')]));_0x5e55de['attributes']=_0x5e55de[_0xd936('0x34')]['length']?_0x5e55de['attributes']:_0x16fd53[_0xd936('0x2f')];if(_0x4d4844['query'][_0xd936('0x44')]){_0x5e55de['include']=[{'all':!![]}];}_0x5e55de=_[_0xd936('0x3b')]({},_0x5e55de,_0x4d4844['options']);return db[_0xd936('0x2b')]['find'](_0x5e55de)['then'](handleEntityNotFound(_0x137644,null))[_0xd936('0x25')](respondWithResult(_0x137644,null))[_0xd936('0x41')](handleError(_0x137644,null));};exports[_0xd936('0x45')]=function(_0x130b99,_0x24bbb){return db[_0xd936('0x2b')][_0xd936('0x45')](_0x130b99[_0xd936('0x46')],{})[_0xd936('0x25')](respondWithResult(_0x24bbb,0xc9))['catch'](handleError(_0x24bbb,null));};exports['update']=function(_0x1762f0,_0x1e7ace){if(_0x1762f0[_0xd936('0x46')]['id']){delete _0x1762f0[_0xd936('0x46')]['id'];}return db[_0xd936('0x2b')][_0xd936('0x47')]({'where':{'id':_0x1762f0['params']['id']}})['then'](handleEntityNotFound(_0x1e7ace,null))['then'](saveUpdates(_0x1762f0[_0xd936('0x46')],null))[_0xd936('0x25')](respondWithResult(_0x1e7ace,null))[_0xd936('0x41')](handleError(_0x1e7ace,null));};exports[_0xd936('0x48')]=function(_0x4bdb1c,_0x21c7b9){return db[_0xd936('0x2b')]['find']({'where':{'id':_0x4bdb1c[_0xd936('0x42')]['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x21c7b9,null))['then'](removeEntity(_0x21c7b9,null))[_0xd936('0x41')](handleError(_0x21c7b9,null));};exports[_0xd936('0x49')]=function(_0x38f18e,_0x37a302){return db[_0xd936('0x2b')]['describe']()[_0xd936('0x25')](respondWithResult(_0x37a302,null))[_0xd936('0x41')](handleError(_0x37a302,null));}; \ No newline at end of file +var _0x908d=['util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','findAll','rows','catch','params','rawAttributes','filters','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x908d,0x176));var _0xd908=function(_0x17eb7d,_0x38420c){_0x17eb7d=_0x17eb7d-0x0;var _0x458299=_0x908d[_0x17eb7d];return _0x458299;};'use strict';var emlformat=require(_0xd908('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd908('0x1'));var jsonpatch=require(_0xd908('0x2'));var rp=require('request-promise');var moment=require(_0xd908('0x3'));var BPromise=require(_0xd908('0x4'));var Mustache=require(_0xd908('0x5'));var util=require(_0xd908('0x6'));var path=require(_0xd908('0x7'));var sox=require('sox');var csv=require(_0xd908('0x8'));var ejs=require(_0xd908('0x9'));var fs=require('fs');var fs_extra=require(_0xd908('0xa'));var _=require('lodash');var squel=require(_0xd908('0xb'));var crypto=require('crypto');var jsforce=require(_0xd908('0xc'));var deskjs=require(_0xd908('0xd'));var toCsv=require(_0xd908('0x8'));var querystring=require(_0xd908('0xe'));var Papa=require(_0xd908('0xf'));var Redis=require(_0xd908('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd908('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd908('0x12'));var logger=require(_0xd908('0x13'))(_0xd908('0x14'));var utils=require('../../config/utils');var config=require(_0xd908('0x15'));var licenseUtil=require(_0xd908('0x16'));var db=require(_0xd908('0x17'))['db'];function respondWithStatusCode(_0x21ef04,_0x172b08){_0x172b08=_0x172b08||0xcc;return function(_0x427261){if(_0x427261){return _0x21ef04[_0xd908('0x18')](_0x172b08);}return _0x21ef04[_0xd908('0x19')](_0x172b08)[_0xd908('0x1a')]();};}function respondWithResult(_0x30e943,_0x122ea8){_0x122ea8=_0x122ea8||0xc8;return function(_0x43bc96){if(_0x43bc96){return _0x30e943['status'](_0x122ea8)[_0xd908('0x1b')](_0x43bc96);}};}function respondWithFilteredResult(_0x3a65d9,_0x49bf38){return function(_0x27589d){if(_0x27589d){var _0x34548c=typeof _0x49bf38[_0xd908('0x1c')]===_0xd908('0x1d')&&typeof _0x49bf38[_0xd908('0x1e')]==='undefined';var _0x373efe=_0x27589d[_0xd908('0x1f')];var _0x224155=_0x34548c?0x0:_0x49bf38[_0xd908('0x1c')];var _0x585a7a=_0x34548c?_0x27589d['count']:_0x49bf38[_0xd908('0x1c')]+_0x49bf38[_0xd908('0x1e')];var _0x1f3710;if(_0x585a7a>=_0x373efe){_0x585a7a=_0x373efe;_0x1f3710=0xc8;}else{_0x1f3710=0xce;}_0x3a65d9['status'](_0x1f3710);return _0x3a65d9[_0xd908('0x20')](_0xd908('0x21'),_0x224155+'-'+_0x585a7a+'/'+_0x373efe)[_0xd908('0x1b')](_0x27589d);}return null;};}function patchUpdates(_0x2df56b){return function(_0x5dba01){try{jsonpatch[_0xd908('0x22')](_0x5dba01,_0x2df56b,!![]);}catch(_0x454c76){return BPromise[_0xd908('0x23')](_0x454c76);}return _0x5dba01[_0xd908('0x24')]();};}function saveUpdates(_0x4868a3,_0x36274a){return function(_0x42e9e4){if(_0x42e9e4){return _0x42e9e4[_0xd908('0x25')](_0x4868a3)[_0xd908('0x26')](function(_0x384f7d){return _0x384f7d;});}return null;};}function removeEntity(_0x3ce7a8,_0x175288){return function(_0x59b003){if(_0x59b003){return _0x59b003[_0xd908('0x27')]()['then'](function(){_0x3ce7a8['status'](0xcc)[_0xd908('0x1a')]();});}};}function handleEntityNotFound(_0x5996f5,_0x3caf75){return function(_0x2bdb9a){if(!_0x2bdb9a){_0x5996f5['sendStatus'](0x194);}return _0x2bdb9a;};}function handleError(_0x4e86d6,_0x3c3739){_0x3c3739=_0x3c3739||0x1f4;return function(_0x6c4965){logger[_0xd908('0x28')](_0x6c4965[_0xd908('0x29')]);if(_0x6c4965['name']){delete _0x6c4965['name'];}_0x4e86d6['status'](_0x3c3739)['send'](_0x6c4965);};}exports[_0xd908('0x2a')]=function(_0x171eaa,_0x38f4c2){var _0x2098af={},_0x6b16f8={},_0x5134a2={'count':0x0,'rows':[]};var _0x113765=_[_0xd908('0x2b')](db['WhatsappTransferReport']['rawAttributes'],function(_0x4a5015){return{'name':_0x4a5015[_0xd908('0x2c')],'type':_0x4a5015[_0xd908('0x2d')][_0xd908('0x2e')]};});_0x6b16f8['model']=_['map'](_0x113765,_0xd908('0x2f'));_0x6b16f8[_0xd908('0x30')]=_[_0xd908('0x31')](_0x171eaa[_0xd908('0x30')]);_0x6b16f8['filters']=_[_0xd908('0x32')](_0x6b16f8[_0xd908('0x33')],_0x6b16f8['query']);_0x2098af[_0xd908('0x34')]=_[_0xd908('0x32')](_0x6b16f8[_0xd908('0x33')],qs[_0xd908('0x35')](_0x171eaa['query'][_0xd908('0x35')]));_0x2098af[_0xd908('0x34')]=_0x2098af['attributes'][_0xd908('0x36')]?_0x2098af[_0xd908('0x34')]:_0x6b16f8[_0xd908('0x33')];if(!_0x171eaa[_0xd908('0x30')]['hasOwnProperty'](_0xd908('0x37'))){_0x2098af[_0xd908('0x1e')]=qs[_0xd908('0x1e')](_0x171eaa[_0xd908('0x30')][_0xd908('0x1e')]);_0x2098af['offset']=qs[_0xd908('0x1c')](_0x171eaa[_0xd908('0x30')][_0xd908('0x1c')]);}_0x2098af['order']=qs[_0xd908('0x38')](_0x171eaa[_0xd908('0x30')][_0xd908('0x38')]);_0x2098af[_0xd908('0x39')]=qs['filters'](_[_0xd908('0x3a')](_0x171eaa[_0xd908('0x30')],_0x6b16f8['filters']),_0x113765);if(_0x171eaa[_0xd908('0x30')][_0xd908('0x3b')]){_0x2098af['where']=_[_0xd908('0x3c')](_0x2098af['where'],{'$or':_['map'](_0x113765,function(_0x42b78d){if(_0x42b78d[_0xd908('0x2d')]!==_0xd908('0x3d')){var _0x1667f0={};_0x1667f0[_0x42b78d['name']]={'$like':'%'+_0x171eaa[_0xd908('0x30')][_0xd908('0x3b')]+'%'};return _0x1667f0;}})});}_0x2098af=_[_0xd908('0x3c')]({},_0x2098af,_0x171eaa[_0xd908('0x3e')]);var _0x582c6f={'where':_0x2098af[_0xd908('0x39')]};return db[_0xd908('0x3f')][_0xd908('0x1f')](_0x582c6f)['then'](function(_0x56419d){_0x5134a2[_0xd908('0x1f')]=_0x56419d;if(_0x171eaa['query'][_0xd908('0x40')]){_0x2098af['include']=[{'all':!![]}];}return db[_0xd908('0x3f')][_0xd908('0x41')](_0x2098af);})[_0xd908('0x26')](function(_0x5f3fed){_0x5134a2[_0xd908('0x42')]=_0x5f3fed;return _0x5134a2;})['then'](respondWithFilteredResult(_0x38f4c2,_0x2098af))[_0xd908('0x43')](handleError(_0x38f4c2,null));};exports['show']=function(_0x4ef2f0,_0x567008){var _0x434ab4={'raw':!![],'where':{'id':_0x4ef2f0[_0xd908('0x44')]['id']}},_0x31e141={};_0x31e141[_0xd908('0x33')]=_[_0xd908('0x31')](db[_0xd908('0x3f')][_0xd908('0x45')]);_0x31e141[_0xd908('0x30')]=_[_0xd908('0x31')](_0x4ef2f0['query']);_0x31e141[_0xd908('0x46')]=_[_0xd908('0x32')](_0x31e141['model'],_0x31e141[_0xd908('0x30')]);_0x434ab4['attributes']=_[_0xd908('0x32')](_0x31e141[_0xd908('0x33')],qs[_0xd908('0x35')](_0x4ef2f0[_0xd908('0x30')][_0xd908('0x35')]));_0x434ab4[_0xd908('0x34')]=_0x434ab4[_0xd908('0x34')][_0xd908('0x36')]?_0x434ab4[_0xd908('0x34')]:_0x31e141[_0xd908('0x33')];if(_0x4ef2f0[_0xd908('0x30')]['includeAll']){_0x434ab4[_0xd908('0x47')]=[{'all':!![]}];}_0x434ab4=_[_0xd908('0x3c')]({},_0x434ab4,_0x4ef2f0[_0xd908('0x3e')]);return db[_0xd908('0x3f')][_0xd908('0x48')](_0x434ab4)[_0xd908('0x26')](handleEntityNotFound(_0x567008,null))[_0xd908('0x26')](respondWithResult(_0x567008,null))['catch'](handleError(_0x567008,null));};exports['create']=function(_0x42f213,_0x2b7d0e){return db[_0xd908('0x3f')][_0xd908('0x49')](_0x42f213['body'],{})['then'](respondWithResult(_0x2b7d0e,0xc9))[_0xd908('0x43')](handleError(_0x2b7d0e,null));};exports['update']=function(_0x1298f6,_0x38811a){if(_0x1298f6[_0xd908('0x4a')]['id']){delete _0x1298f6[_0xd908('0x4a')]['id'];}return db[_0xd908('0x3f')][_0xd908('0x48')]({'where':{'id':_0x1298f6['params']['id']}})[_0xd908('0x26')](handleEntityNotFound(_0x38811a,null))['then'](saveUpdates(_0x1298f6[_0xd908('0x4a')],null))[_0xd908('0x26')](respondWithResult(_0x38811a,null))[_0xd908('0x43')](handleError(_0x38811a,null));};exports[_0xd908('0x27')]=function(_0xeae23b,_0x46688d){return db[_0xd908('0x3f')][_0xd908('0x48')]({'where':{'id':_0xeae23b[_0xd908('0x44')]['id']}})[_0xd908('0x26')](handleEntityNotFound(_0x46688d,null))[_0xd908('0x26')](removeEntity(_0x46688d,null))[_0xd908('0x43')](handleError(_0x46688d,null));};exports[_0xd908('0x4b')]=function(_0x211904,_0x585a95){return db[_0xd908('0x3f')]['describe']()[_0xd908('0x26')](respondWithResult(_0x585a95,null))[_0xd908('0x43')](handleError(_0x585a95,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 41d9e9f..056997e 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 _0xd3c0=['./whatsappTransferReport.attributes','WhatsappTransferReport','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x4a9dd2,_0x2e5269){var _0x34e381=function(_0x2a736f){while(--_0x2a736f){_0x4a9dd2['push'](_0x4a9dd2['shift']());}};_0x34e381(++_0x2e5269);}(_0xd3c0,0xca));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0d3c('0x0'));var logger=require(_0x0d3c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0d3c('0x2'));var rp=require(_0x0d3c('0x3'));var fs=require('fs');var path=require(_0x0d3c('0x4'));var rimraf=require('rimraf');var config=require(_0x0d3c('0x5'));var attributes=require(_0x0d3c('0x6'));module['exports']=function(_0x110b39,_0x3cae57){return _0x110b39['define'](_0x0d3c('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbc6=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x546524,_0x4ba097){var _0x34e028=function(_0x5285fe){while(--_0x5285fe){_0x546524['push'](_0x546524['shift']());}};_0x34e028(++_0x4ba097);}(_0xcbc6,0xa8));var _0x6cbc=function(_0x16380c,_0xc55d7f){_0x16380c=_0x16380c-0x0;var _0x40b45d=_0xcbc6[_0x16380c];return _0x40b45d;};'use strict';var _=require(_0x6cbc('0x0'));var util=require(_0x6cbc('0x1'));var logger=require(_0x6cbc('0x2'))(_0x6cbc('0x3'));var moment=require(_0x6cbc('0x4'));var BPromise=require(_0x6cbc('0x5'));var rp=require(_0x6cbc('0x6'));var fs=require('fs');var path=require(_0x6cbc('0x7'));var rimraf=require(_0x6cbc('0x8'));var config=require(_0x6cbc('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0x6cbc('0xa')]=function(_0x5bfc7b,_0x52d506){return _0x5bfc7b[_0x6cbc('0xb')](_0x6cbc('0xc'),attributes,{'tableName':_0x6cbc('0xd'),'paranoid':![],'indexes':[{'name':_0x6cbc('0xe'),'fields':[_0x6cbc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 98090f5..e2fe591 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 _0x428b=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x49c360,_0x122382){var _0x534133=function(_0x8dd389){while(--_0x8dd389){_0x49c360['push'](_0x49c360['shift']());}};_0x534133(++_0x122382);}(_0x428b,0xc5));var _0xb428=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x428b[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0xb428('0x0'));var moment=require(_0xb428('0x1'));var BPromise=require(_0xb428('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb428('0x3'));var db=require(_0xb428('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb428('0x5'));var config=require(_0xb428('0x6'));var jayson=require(_0xb428('0x7'));var client=jayson['client'][_0xb428('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x115262,_0x2e0063,_0x4da69f){return new BPromise(function(_0x419c88,_0x20d828){return client['request'](_0x115262,_0x4da69f)[_0xb428('0x9')](function(_0x5ba019){logger[_0xb428('0xa')](_0xb428('0xb'),_0x2e0063,'request\x20sent');logger[_0xb428('0xc')](_0xb428('0xd'),_0x2e0063,_0xb428('0xe'),JSON[_0xb428('0xf')](_0x5ba019));if(_0x5ba019[_0xb428('0x10')]){if(_0x5ba019[_0xb428('0x10')][_0xb428('0x11')]===0x1f4){logger[_0xb428('0x10')](_0xb428('0xb'),_0x2e0063,_0x5ba019[_0xb428('0x10')][_0xb428('0x12')]);return _0x20d828(_0x5ba019[_0xb428('0x10')][_0xb428('0x12')]);}logger[_0xb428('0x10')](_0xb428('0xb'),_0x2e0063,_0x5ba019[_0xb428('0x10')]['message']);return _0x419c88(_0x5ba019[_0xb428('0x10')][_0xb428('0x12')]);}else{logger['info'](_0xb428('0xb'),_0x2e0063,_0xb428('0xe'));_0x419c88(_0x5ba019['result'][_0xb428('0x12')]);}})[_0xb428('0x13')](function(_0x43fc5d){logger[_0xb428('0x10')](_0xb428('0xb'),_0x2e0063,_0x43fc5d);_0x20d828(_0x43fc5d);});});} \ No newline at end of file +var _0xae0f=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c04d9,_0x59ec65){var _0x5ad09a=function(_0x5e2ce3){while(--_0x5e2ce3){_0x2c04d9['push'](_0x2c04d9['shift']());}};_0x5ad09a(++_0x59ec65);}(_0xae0f,0xbc));var _0xfae0=function(_0xfe340b,_0x273162){_0xfe340b=_0xfe340b-0x0;var _0x31e6c2=_0xae0f[_0xfe340b];return _0x31e6c2;};'use strict';var _=require('lodash');var util=require(_0xfae0('0x0'));var moment=require(_0xfae0('0x1'));var BPromise=require(_0xfae0('0x2'));var rs=require(_0xfae0('0x3'));var fs=require('fs');var Redis=require(_0xfae0('0x4'));var db=require(_0xfae0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfae0('0x6'));var client=jayson[_0xfae0('0x7')][_0xfae0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41e051,_0xaad850,_0x56b7d3){return new BPromise(function(_0x23bea0,_0x4675da){return client['request'](_0x41e051,_0x56b7d3)[_0xfae0('0x9')](function(_0x468106){logger['info'](_0xfae0('0xa'),_0xaad850,_0xfae0('0xb'));logger[_0xfae0('0xc')](_0xfae0('0xd'),_0xaad850,_0xfae0('0xb'),JSON[_0xfae0('0xe')](_0x468106));if(_0x468106['error']){if(_0x468106['error'][_0xfae0('0xf')]===0x1f4){logger[_0xfae0('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0xaad850,_0x468106[_0xfae0('0x10')][_0xfae0('0x11')]);return _0x4675da(_0x468106['error']['message']);}logger[_0xfae0('0x10')](_0xfae0('0xa'),_0xaad850,_0x468106[_0xfae0('0x10')][_0xfae0('0x11')]);return _0x23bea0(_0x468106[_0xfae0('0x10')][_0xfae0('0x11')]);}else{logger['info'](_0xfae0('0xa'),_0xaad850,_0xfae0('0xb'));_0x23bea0(_0x468106[_0xfae0('0x12')][_0xfae0('0x11')]);}})[_0xfae0('0x13')](function(_0x3aa05e){logger['error'](_0xfae0('0xa'),_0xaad850,_0x3aa05e);_0x4675da(_0x3aa05e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 28ba055..9c9463c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd87=['status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','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/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','start','filter','exitCode','number','length','pm2_env','name','Online\x20apps:','map','online','join','info','Offline\x20apps:'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var db=require(_0x7fd8('0x1'))['db'];var seedDb=require(_0x7fd8('0x2'));var checkLicense=require(_0x7fd8('0x3'));var rpc=require(_0x7fd8('0x4'));var config=require(_0x7fd8('0x5'));var logger=require(_0x7fd8('0x6'))(_0x7fd8('0x7'));var pm2=require(_0x7fd8('0x8'));var pm2Config=require(_0x7fd8('0x9'));var schedule=require(_0x7fd8('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x7fd8('0xb'));var transcribe=require(_0x7fd8('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x7fd8('0xd')][_0x7fd8('0xe')]()[_0x7fd8('0xf')](function(){if(config[_0x7fd8('0x10')]){return seedDb[_0x7fd8('0x11')]();}})['then'](function(){return checkLicense[_0x7fd8('0x11')]();})[_0x7fd8('0xf')](function(){return rpc[_0x7fd8('0x12')]();})['then'](function(_0x5486fc){logger['info'](_0x5486fc);return chat[_0x7fd8('0x13')]();})['then'](function(){return whatsapp[_0x7fd8('0x13')]();})[_0x7fd8('0xf')](function(){return schedule[_0x7fd8('0x13')]();})['then'](function(){return transcribe[_0x7fd8('0x13')]();})[_0x7fd8('0xf')](function(){return provider[_0x7fd8('0x13')]();})[_0x7fd8('0xf')](function(_0x20d1c5){logger['info'](_0x20d1c5);return pm2[_0x7fd8('0x13')](pm2Config);})[_0x7fd8('0xf')](function(_0x1d481a){var _0x1131ef=_0x1d481a[_0x7fd8('0x14')](function(_0x38d45a){return typeof _0x38d45a[_0x7fd8('0x15')]===_0x7fd8('0x16')&&_0x38d45a[_0x7fd8('0x15')]>=0x0;});if(_0x1131ef[_0x7fd8('0x17')]>0x0){throw new Error(_0x1131ef[_0x7fd8('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x1131ef,function(_0x5ca7f6){return'\x22'+_0x5ca7f6[_0x7fd8('0x18')][_0x7fd8('0x19')]+'\x22';}));}logger['info'](_0x7fd8('0x1a'),_[_0x7fd8('0x1b')](_[_0x7fd8('0x14')](_0x1d481a,{'status':_0x7fd8('0x1c')}),_0x7fd8('0x19'))[_0x7fd8('0x1d')]());logger[_0x7fd8('0x1e')](_0x7fd8('0x1f'),_['map'](_[_0x7fd8('0x14')](_0x1d481a,function(_0x3b7b49){return _0x3b7b49[_0x7fd8('0x20')]!==_0x7fd8('0x1c');}),_0x7fd8('0x19'))[_0x7fd8('0x1d')]()||'None');console[_0x7fd8('0x21')](_0x7fd8('0x22'));})[_0x7fd8('0x23')](function(_0x1acfb4){console['log'](_0x7fd8('0x24'),_0x1acfb4);logger[_0x7fd8('0x25')](_0x7fd8('0x26'),_0x1acfb4);process[_0x7fd8('0x27')](0x1);});}main(); \ No newline at end of file +var _0x34f8=['lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','seedDB','default','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','join','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit'];(function(_0x27da5c,_0x21ede4){var _0x168107=function(_0xe1f07e){while(--_0xe1f07e){_0x27da5c['push'](_0x27da5c['shift']());}};_0x168107(++_0x21ede4);}(_0x34f8,0x80));var _0x834f=function(_0x22d673,_0x60bede){_0x22d673=_0x22d673-0x0;var _0x6dea81=_0x34f8[_0x22d673];return _0x6dea81;};'use strict';var _=require(_0x834f('0x0'));var db=require(_0x834f('0x1'))['db'];var seedDb=require(_0x834f('0x2'));var checkLicense=require(_0x834f('0x3'));var rpc=require(_0x834f('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x834f('0x5'));var pm2=require(_0x834f('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x834f('0x7'));var chat=require(_0x834f('0x8'));var whatsapp=require(_0x834f('0x9'));var transcribe=require(_0x834f('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0x834f('0xb')]()[_0x834f('0xc')](function(){if(config[_0x834f('0xd')]){return seedDb[_0x834f('0xe')]();}})['then'](function(){return checkLicense[_0x834f('0xe')]();})[_0x834f('0xc')](function(){return rpc['listen']();})[_0x834f('0xc')](function(_0x353699){logger[_0x834f('0xf')](_0x353699);return chat[_0x834f('0x10')]();})[_0x834f('0xc')](function(){return whatsapp[_0x834f('0x10')]();})[_0x834f('0xc')](function(){return schedule[_0x834f('0x10')]();})['then'](function(){return transcribe[_0x834f('0x10')]();})[_0x834f('0xc')](function(){return provider[_0x834f('0x10')]();})[_0x834f('0xc')](function(_0x467a45){logger['info'](_0x467a45);return pm2[_0x834f('0x10')](pm2Config);})[_0x834f('0xc')](function(_0x5bfea4){var _0x34348c=_0x5bfea4[_0x834f('0x11')](function(_0x55bc81){return typeof _0x55bc81[_0x834f('0x12')]==='number'&&_0x55bc81[_0x834f('0x12')]>=0x0;});if(_0x34348c[_0x834f('0x13')]>0x0){throw new Error(_0x34348c[_0x834f('0x13')]+_0x834f('0x14')+_['map'](_0x34348c,function(_0x58154d){return'\x22'+_0x58154d[_0x834f('0x15')][_0x834f('0x16')]+'\x22';}));}logger[_0x834f('0xf')](_0x834f('0x17'),_['map'](_[_0x834f('0x11')](_0x5bfea4,{'status':_0x834f('0x18')}),_0x834f('0x16'))['join']());logger['info'](_0x834f('0x19'),_['map'](_[_0x834f('0x11')](_0x5bfea4,function(_0x148839){return _0x148839['status']!==_0x834f('0x18');}),'name')[_0x834f('0x1a')]()||_0x834f('0x1b'));console[_0x834f('0x1c')](_0x834f('0x1d'));})['catch'](function(_0x170460){console['log'](_0x834f('0x1e'),_0x170460);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x170460);process[_0x834f('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2f99c29..e2189f9 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 _0x4f09=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','unshift','encryptString','join','promisify','secret','payload','options','verify','toString','hex','floor','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format'];(function(_0x3fb91a,_0x303ceb){var _0x4b071a=function(_0x14c7be){while(--_0x14c7be){_0x3fb91a['push'](_0x3fb91a['shift']());}};_0x4b071a(++_0x303ceb);}(_0x4f09,0x18b));var _0x94f0=function(_0x3021c5,_0x1980cc){_0x3021c5=_0x3021c5-0x0;var _0x170536=_0x4f09[_0x3021c5];return _0x170536;};'use strict';var db=require(_0x94f0('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x94f0('0x1'));var licenseUtil=require(_0x94f0('0x2'));var encryptor=require('../encryptor');var _=require(_0x94f0('0x3'));var jwt=require(_0x94f0('0x4'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x94f0('0x5'));var crypto=require(_0x94f0('0x6'));var BPromise=require(_0x94f0('0x7'));var util=require('util');var moment=require(_0x94f0('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0x94f0('0x9')]});var userAttributes=['id',_0x94f0('0xa'),_0x94f0('0xb'),_0x94f0('0xc'),_0x94f0('0xd'),_0x94f0('0xe'),_0x94f0('0xf'),_0x94f0('0x10'),_0x94f0('0x11'),'voicePause',_0x94f0('0x12'),_0x94f0('0x13'),_0x94f0('0x14'),_0x94f0('0x15'),'openchannelPause','pauseType',_0x94f0('0x16'),_0x94f0('0x17'),_0x94f0('0x18'),_0x94f0('0x19'),_0x94f0('0x1a'),_0x94f0('0x1b'),'alias',_0x94f0('0x1c'),_0x94f0('0x1d'),_0x94f0('0x1e'),_0x94f0('0x1f'),_0x94f0('0x20'),_0x94f0('0x21'),_0x94f0('0x22'),_0x94f0('0x23'),_0x94f0('0x24'),'phoneBarRemoteControlPort','hotdesk',_0x94f0('0x25'),_0x94f0('0x26'),_0x94f0('0x27'),'settingsEnabled',_0x94f0('0x28'),'downloadVoiceRecordings',_0x94f0('0x29'),_0x94f0('0x2a'),'ignorePauseForPreviewCalls',_0x94f0('0x2b')];exports[_0x94f0('0x2c')]=function(){return this[_0x94f0('0x2d')](!![])[_0x94f0('0x2e')](function(_0x5390db,_0x1ed598,_0x20a16c){if(_0x5390db['user']){_0x20a16c();}else{return db[_0x94f0('0x2f')][_0x94f0('0x30')]({'where':{'id':_0x5390db[_0x94f0('0x31')]['id']},'attributes':['id',_0x94f0('0x32'),_0x94f0('0x33')],'raw':!![]})[_0x94f0('0x34')](function(_0x20e671){if(_0x20e671&&_0x20e671[_0x94f0('0x32')]){return _0x1ed598['status'](_0x20e671['disposition']===_0x94f0('0x35')?0x195:0x193)[_0x94f0('0x36')]({'message':_0x20e671[_0x94f0('0x33')]==='unmanaged'?_0x94f0('0x37'):_0x94f0('0x38')});}else{_0x20a16c();}})[_0x94f0('0x39')](function(_0x3f8812){_0x20a16c(_0x3f8812);});}});};exports[_0x94f0('0x2d')]=function isAuthenticated(_0x5a314d){return compose()['use'](function(_0x4ff057,_0x1597c7,_0x25b2e7){var _0x2cd681;if(_0x4ff057['headers'][_0x94f0('0x3a')]){if(_[_0x94f0('0x3b')](_0x4ff057[_0x94f0('0x3c')][_0x94f0('0x3a')],_0x94f0('0x3d'))){var _0x5ed002=basicAuth(_0x4ff057);db[_0x94f0('0x3e')][_0x94f0('0x3f')]({'where':{'name':_0x5ed002['name']}})[_0x94f0('0x34')](function(_0x458a8d){if(!_0x458a8d||!_0x458a8d[_0x94f0('0x40')](_0x5ed002[_0x94f0('0x41')])){return _0x1597c7[_0x94f0('0x42')](0x191)[_0x94f0('0x36')]({'message':'Wrong\x20credentials.'});}_0x4ff057[_0x94f0('0x43')]={'id':_0x458a8d['id']};_0x25b2e7();})[_0x94f0('0x39')](function(_0x175690){_0x25b2e7(_0x175690);});}else if(_[_0x94f0('0x3b')](_0x4ff057[_0x94f0('0x3c')][_0x94f0('0x3a')],_0x94f0('0x44'))){validateJwt(_0x4ff057,_0x1597c7,_0x25b2e7);}else{if(_0x5a314d){_0x25b2e7();}else{return _0x1597c7[_0x94f0('0x42')](0x193)[_0x94f0('0x36')]({'message':_0x94f0('0x45')});}}}else if(_0x4ff057[_0x94f0('0x46')][_0x94f0('0x47')]){try{var _0x43a207={'audience':hardwareConf[_0x94f0('0x48')](),'issuer':hardwareConf[_0x94f0('0x48')]()};verifyJwt(_0x4ff057[_0x94f0('0x46')][_0x94f0('0x47')],_0x43a207)[_0x94f0('0x34')](function(_0x5d5c6f){return db[_0x94f0('0x3e')]['find']({'where':{'id':_0x5d5c6f[_0x94f0('0x49')]}})[_0x94f0('0x34')](function(_0x29a3dd){_0x2cd681=_0x29a3dd;return db[_0x94f0('0x4a')][_0x94f0('0x30')]({'where':{'id':0x1},'attributes':[_0x94f0('0x4b'),_0x94f0('0x4c')],'raw':!![]});})[_0x94f0('0x34')](function(_0x3be86d){if(!_0x2cd681||!_[_0x94f0('0x4d')](_0x2cd681[_0x94f0('0x4e')],_0x5d5c6f[_0x94f0('0x4f')])){return _0x1597c7[_0x94f0('0x42')](0x191)[_0x94f0('0x36')]({'message':_0x94f0('0x50')});}if(_0x2cd681[_0x94f0('0x51')]){return _0x1597c7['status'](0x191)[_0x94f0('0x36')]({'message':_0x94f0('0x52')});}if(_0x2cd681[_0x94f0('0x53')]){if(_0x3be86d[_0x94f0('0x4c')]>0x0){if(moment(_0x2cd681[_0x94f0('0x54')])[_0x94f0('0x55')](_0x3be86d[_0x94f0('0x4c')],_0x94f0('0x56'))>moment()){return _0x1597c7[_0x94f0('0x42')](0x191)['json']({'message':_0x94f0('0x52')});}}else{return _0x1597c7[_0x94f0('0x42')](0x191)[_0x94f0('0x36')]({'message':_0x94f0('0x52')});}}_0x4ff057[_0x94f0('0x43')]={'id':_0x2cd681['id']};_0x25b2e7();});})[_0x94f0('0x39')](function(){return _0x1597c7[_0x94f0('0x42')](0x191)[_0x94f0('0x36')]({'message':_0x94f0('0x52')});});}catch(_0x3d967e){_0x25b2e7(_0x3d967e);}}else if(_0x5a314d){_0x25b2e7();}else{return _0x1597c7[_0x94f0('0x42')](0x193)[_0x94f0('0x36')]({'message':_0x94f0('0x45')});}})['use'](function(_0x51df68,_0x372931,_0x21961c){if(_0x51df68['user']){db[_0x94f0('0x3e')][_0x94f0('0x3f')]({'where':{'id':_0x51df68[_0x94f0('0x43')]['id']},'attributes':userAttributes})[_0x94f0('0x34')](function(_0x4c58e5){if(!_0x4c58e5){return _0x372931[_0x94f0('0x42')](0x194)['json']({'message':_0x94f0('0x57')});}_0x51df68[_0x94f0('0x43')]=_0x4c58e5;_0x21961c();})[_0x94f0('0x39')](function(_0x19a853){_0x21961c(_0x19a853);});}else if(_0x5a314d){_0x21961c();}else{return _0x372931[_0x94f0('0x42')](0x194)[_0x94f0('0x36')]({'message':_0x94f0('0x58')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x9fc137,_0x8fc876,_0x531da2){return licenseUtil['getLicense']()[_0x94f0('0x34')](function(_0x3adb2a){if(_0x3adb2a[_0x94f0('0x59')]){_0x531da2();}else{return _0x8fc876['status'](0x193)[_0x94f0('0x36')]({'message':_0x94f0('0x5a')});}})[_0x94f0('0x39')](function(_0x35aa6f){_0x531da2(_0x35aa6f);});});};exports[_0x94f0('0x5b')]=function isWebrtcLicence(){return compose()[_0x94f0('0x2e')](function(_0x5d3b96,_0x8c1875,_0x42d105){return licenseUtil['getLicense']()[_0x94f0('0x34')](function(_0x527cb1){if(_0x527cb1['webrtc']){_0x42d105();}else{return _0x8c1875[_0x94f0('0x42')](0x193)['json']({'message':_0x94f0('0x5a')});}})[_0x94f0('0x39')](function(_0x54af86){_0x42d105(_0x54af86);});});};exports[_0x94f0('0x5c')]=function(_0x36a295,_0x518332,_0x5bacec){_0x36a295['isMiddleware']=!![];return _0x5bacec();};exports['signToken']=function signToken(_0xe82afd){return signJwt(_0xe82afd);};exports[_0x94f0('0x5d')]=function(_0x13ece1,_0x3f8a9f){if(!_0x13ece1['user']){return _0x3f8a9f[_0x94f0('0x42')](0x194)['json']({'message':_0x94f0('0x5e')});}var _0x1106e5={'payload':{'id':_0x13ece1[_0x94f0('0x43')]['id'],'role':_0x13ece1[_0x94f0('0x43')][_0x94f0('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1106e5)[_0x94f0('0x34')](function(_0x51c91c){_0x3f8a9f[_0x94f0('0x5f')](_0x94f0('0x60'),_0x51c91c);_0x3f8a9f['redirect'](_0x94f0('0x61'));})[_0x94f0('0x39')](function(_0x3ab655){return _0x3f8a9f[_0x94f0('0x42')](0x1f4)[_0x94f0('0x62')](_0x3ab655);});};exports[_0x94f0('0x63')]=function(_0x382d66){if(_[_0x94f0('0x64')](_0x382d66[_0x94f0('0x4e')])||_[_0x94f0('0x64')](_0x382d66['apiKeyIat'])){return null;}else{return createJwt(_0x382d66);}};exports[_0x94f0('0x65')]=function(_0x31c01c){_0x31c01c['apiKeyNonce']=generateNonce();_0x31c01c[_0x94f0('0x66')]=generateIssuedAt();return createJwt(_0x31c01c);};exports[_0x94f0('0x67')]=function(_0x5a5cc6,_0x43d11c){var _0x429773=_0x5a5cc6[_0x94f0('0x46')][_0x94f0('0x47')];if(_0x429773){var _0xbb3b83={'nonce':_0x43d11c['apiKeyNonce'],'iat':_0x43d11c[_0x94f0('0x66')],'audience':hardwareConf[_0x94f0('0x48')](),'issuer':hardwareConf[_0x94f0('0x48')]()};return verifyJwt(_0x429773,_0xbb3b83)[_0x94f0('0x34')](function(){return generateApiKey(_0x43d11c);});}else{throw{'message':_0x94f0('0x68')};}};exports[_0x94f0('0x69')]=function(_0x4fcf80){var _0xbc00e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xbc00e1[_0x94f0('0x6a')](_0x4fcf80))throw new db['Sequelize'][(_0x94f0('0x6b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x94f0('0x6c')]=function(_0x22392b,_0x6737f,_0xdbcc50){var _0x24f56c=encryptor[_0x94f0('0x6d')](_0x6737f)[_0x94f0('0x6e')](',');for(var _0x4b6a00=0x0;_0x4b6a00<_0xdbcc50;_0x4b6a00++){if(!_0x24f56c[_0x4b6a00])break;if(_0x22392b['toLowerCase']()===_0x24f56c[_0x4b6a00][_0x94f0('0x6f')]()){var _0x1cfdcb=util[_0x94f0('0x70')](_0x94f0('0x71'),_0xdbcc50);if(_0xdbcc50===0x1){_0x1cfdcb='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x94f0('0x72'))]['ValidationError'](_0x1cfdcb);}}return;};exports['updatePasswordsHistory']=function(_0x7ced7f,_0x38804d){var _0x4b78e7=_0x38804d?encryptor[_0x94f0('0x6d')](_0x38804d)[_0x94f0('0x6e')](','):[];if(_0x4b78e7['length']===0x5){_0x4b78e7['splice'](-0x1,0x1);}_0x4b78e7[_0x94f0('0x73')](_0x7ced7f);return encryptor[_0x94f0('0x74')](_0x4b78e7[_0x94f0('0x75')](','));};function signJwt(_0x13fe44){var _0x4f2e3a=BPromise[_0x94f0('0x76')](jwt['sign'],{'context':jwt});var _0x507d84=_0x13fe44[_0x94f0('0x77')]||config['secrets'][_0x94f0('0x9')];return new BPromise(function(_0x12f423,_0x1baee1){_0x4f2e3a(_0x13fe44[_0x94f0('0x78')],_0x507d84,_0x13fe44[_0x94f0('0x79')])[_0x94f0('0x34')](function(_0x5b76b5){_0x12f423(_0x5b76b5);})[_0x94f0('0x39')](function(_0x56bba0){_0x1baee1(_0x56bba0);});});}function verifyJwt(_0x5eb973,_0x43aa3b,_0x575309){var _0x177628=BPromise[_0x94f0('0x76')](jwt[_0x94f0('0x7a')],{'context':jwt});var _0x6e8c2d=_0x575309||config['secrets'][_0x94f0('0x9')];return new BPromise(function(_0x4ed244,_0x164f83){_0x177628(_0x5eb973,_0x6e8c2d,_0x43aa3b)[_0x94f0('0x34')](function(_0x52f34a){_0x4ed244(_0x52f34a);})['catch'](function(_0x15b1a6){_0x164f83(_0x15b1a6);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x94f0('0x7b')](_0x94f0('0x7c'));}function generateIssuedAt(){return Math[_0x94f0('0x7d')](Date['now']()/0x3e8)[_0x94f0('0x7b')]();}function createJwt(_0xd8de35){var _0x253c61={'payload':{'iat':_0xd8de35[_0x94f0('0x66')],'nonce':_0xd8de35[_0x94f0('0x4e')]},'options':{'algorithm':_0x94f0('0x7e'),'subject':_0xd8de35['id'][_0x94f0('0x7b')](),'issuer':hardwareConf[_0x94f0('0x48')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x253c61)[_0x94f0('0x34')](function(_0x57bd12){return{'iat':_0xd8de35[_0x94f0('0x66')],'nonce':_0xd8de35[_0x94f0('0x4e')],'token':_0x57bd12};});} \ No newline at end of file +var _0x1649=['crypto','bluebird','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','Basic','User','find','authenticate','json','Wrong\x20credentials.','headers','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','user','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','express-jwt','composable-middleware','basic-auth'];(function(_0x1536ed,_0x1b3489){var _0x487467=function(_0x54ddc6){while(--_0x54ddc6){_0x1536ed['push'](_0x1536ed['shift']());}};_0x487467(++_0x1b3489);}(_0x1649,0x79));var _0x9164=function(_0x59cc66,_0x52af40){_0x59cc66=_0x59cc66-0x0;var _0x1cd88b=_0x1649[_0x59cc66];return _0x1cd88b;};'use strict';var db=require(_0x9164('0x0'))['db'];var config=require(_0x9164('0x1'));var hardwareConf=require(_0x9164('0x2'));var licenseUtil=require(_0x9164('0x3'));var encryptor=require('../encryptor');var _=require(_0x9164('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x9164('0x5'));var compose=require(_0x9164('0x6'));var basicAuth=require(_0x9164('0x7'));var crypto=require(_0x9164('0x8'));var BPromise=require(_0x9164('0x9'));var util=require(_0x9164('0xa'));var moment=require(_0x9164('0xb'));var validateJwt=expressJwt({'secret':config[_0x9164('0xc')][_0x9164('0xd')]});var userAttributes=['id','role',_0x9164('0xe'),_0x9164('0xf'),_0x9164('0x10'),_0x9164('0x11'),_0x9164('0x12'),_0x9164('0x13'),_0x9164('0x14'),_0x9164('0x15'),'chatPause',_0x9164('0x16'),_0x9164('0x17'),_0x9164('0x18'),'openchannelPause',_0x9164('0x19'),_0x9164('0x1a'),_0x9164('0x1b'),'lastPauseAt',_0x9164('0x1c'),_0x9164('0x1d'),'passwordResetAt',_0x9164('0x1e'),_0x9164('0x1f'),_0x9164('0x20'),_0x9164('0x21'),_0x9164('0x22'),_0x9164('0x23'),_0x9164('0x24'),'phoneBarExpires',_0x9164('0x25'),'phoneBarRemoteControl',_0x9164('0x26'),_0x9164('0x27'),_0x9164('0x28'),_0x9164('0x29'),_0x9164('0x2a'),_0x9164('0x2b'),_0x9164('0x2c'),_0x9164('0x2d'),_0x9164('0x2e'),_0x9164('0x2f'),'ignorePauseForPreviewCalls',_0x9164('0x30')];exports[_0x9164('0x31')]=function(){return this[_0x9164('0x32')](!![])[_0x9164('0x33')](function(_0x38e6b8,_0x1704ff,_0x3b08f3){if(_0x38e6b8['user']){_0x3b08f3();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x38e6b8['params']['id']},'attributes':['id','closed',_0x9164('0x34')],'raw':!![]})[_0x9164('0x35')](function(_0x1b4b4c){if(_0x1b4b4c&&_0x1b4b4c['closed']){return _0x1704ff[_0x9164('0x36')](_0x1b4b4c['disposition']===_0x9164('0x37')?0x195:0x193)['json']({'message':_0x1b4b4c['disposition']===_0x9164('0x37')?_0x9164('0x38'):_0x9164('0x39')});}else{_0x3b08f3();}})[_0x9164('0x3a')](function(_0x469ea8){_0x3b08f3(_0x469ea8);});}});};exports[_0x9164('0x32')]=function isAuthenticated(_0x135bc0){return compose()[_0x9164('0x33')](function(_0x3d447a,_0x231364,_0x5bcab5){var _0x3f9d0f;if(_0x3d447a['headers'][_0x9164('0x3b')]){if(_[_0x9164('0x3c')](_0x3d447a['headers'][_0x9164('0x3b')],_0x9164('0x3d'))){var _0x29acec=basicAuth(_0x3d447a);db[_0x9164('0x3e')][_0x9164('0x3f')]({'where':{'name':_0x29acec[_0x9164('0xf')]}})[_0x9164('0x35')](function(_0x5bec17){if(!_0x5bec17||!_0x5bec17[_0x9164('0x40')](_0x29acec['pass'])){return _0x231364['status'](0x191)[_0x9164('0x41')]({'message':_0x9164('0x42')});}_0x3d447a['user']={'id':_0x5bec17['id']};_0x5bcab5();})[_0x9164('0x3a')](function(_0x50abe5){_0x5bcab5(_0x50abe5);});}else if(_[_0x9164('0x3c')](_0x3d447a[_0x9164('0x43')][_0x9164('0x3b')],_0x9164('0x44'))){validateJwt(_0x3d447a,_0x231364,_0x5bcab5);}else{if(_0x135bc0){_0x5bcab5();}else{return _0x231364['status'](0x193)['json']({'message':_0x9164('0x45')});}}}else if(_0x3d447a[_0x9164('0x46')][_0x9164('0x47')]){try{var _0x3ee05e={'audience':hardwareConf[_0x9164('0x48')](),'issuer':hardwareConf[_0x9164('0x48')]()};verifyJwt(_0x3d447a[_0x9164('0x46')][_0x9164('0x47')],_0x3ee05e)[_0x9164('0x35')](function(_0x4aad4e){return db[_0x9164('0x3e')][_0x9164('0x3f')]({'where':{'id':_0x4aad4e[_0x9164('0x49')]}})['then'](function(_0x2f66d1){_0x3f9d0f=_0x2f66d1;return db[_0x9164('0x4a')][_0x9164('0x4b')]({'where':{'id':0x1},'attributes':[_0x9164('0x4c'),'blockDuration'],'raw':!![]});})[_0x9164('0x35')](function(_0x36435e){if(!_0x3f9d0f||!_[_0x9164('0x4d')](_0x3f9d0f[_0x9164('0x4e')],_0x4aad4e[_0x9164('0x4f')])){return _0x231364[_0x9164('0x36')](0x191)[_0x9164('0x41')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3f9d0f['disabled']){return _0x231364[_0x9164('0x36')](0x191)[_0x9164('0x41')]({'message':_0x9164('0x50')});}if(_0x3f9d0f[_0x9164('0x51')]){if(_0x36435e[_0x9164('0x52')]>0x0){if(moment(_0x3f9d0f[_0x9164('0x53')])['add'](_0x36435e[_0x9164('0x52')],_0x9164('0x54'))>moment()){return _0x231364['status'](0x191)[_0x9164('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x231364[_0x9164('0x36')](0x191)['json']({'message':_0x9164('0x50')});}}_0x3d447a['user']={'id':_0x3f9d0f['id']};_0x5bcab5();});})[_0x9164('0x3a')](function(){return _0x231364[_0x9164('0x36')](0x191)[_0x9164('0x41')]({'message':_0x9164('0x50')});});}catch(_0x2dcef4){_0x5bcab5(_0x2dcef4);}}else if(_0x135bc0){_0x5bcab5();}else{return _0x231364[_0x9164('0x36')](0x193)[_0x9164('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0x9164('0x33')](function(_0x2740fd,_0x38838e,_0x4a2619){if(_0x2740fd[_0x9164('0x55')]){db[_0x9164('0x3e')][_0x9164('0x3f')]({'where':{'id':_0x2740fd[_0x9164('0x55')]['id']},'attributes':userAttributes})[_0x9164('0x35')](function(_0x1b2549){if(!_0x1b2549){return _0x38838e['status'](0x194)[_0x9164('0x41')]({'message':_0x9164('0x56')});}_0x2740fd[_0x9164('0x55')]=_0x1b2549;_0x4a2619();})[_0x9164('0x3a')](function(_0xbb474b){_0x4a2619(_0xbb474b);});}else if(_0x135bc0){_0x4a2619();}else{return _0x38838e[_0x9164('0x36')](0x194)['json']({'message':_0x9164('0x57')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x9164('0x33')](function(_0xfa6456,_0x1ca475,_0x2a09b7){return licenseUtil[_0x9164('0x58')]()[_0x9164('0x35')](function(_0x3e7334){if(_0x3e7334['update']){_0x2a09b7();}else{return _0x1ca475['status'](0x193)[_0x9164('0x41')]({'message':_0x9164('0x59')});}})[_0x9164('0x3a')](function(_0x133526){_0x2a09b7(_0x133526);});});};exports[_0x9164('0x5a')]=function isWebrtcLicence(){return compose()[_0x9164('0x33')](function(_0x175276,_0x7a30a,_0x3c1425){return licenseUtil[_0x9164('0x58')]()[_0x9164('0x35')](function(_0x2e68c7){if(_0x2e68c7['webrtc']){_0x3c1425();}else{return _0x7a30a[_0x9164('0x36')](0x193)[_0x9164('0x41')]({'message':_0x9164('0x59')});}})[_0x9164('0x3a')](function(_0x38616a){_0x3c1425(_0x38616a);});});};exports['isMiddleware']=function(_0xf8245f,_0x16363,_0x533cea){_0xf8245f[_0x9164('0x5b')]=!![];return _0x533cea();};exports['signToken']=function signToken(_0x11f85b){return signJwt(_0x11f85b);};exports[_0x9164('0x5c')]=function(_0x21547b,_0x250740){if(!_0x21547b[_0x9164('0x55')]){return _0x250740['status'](0x194)[_0x9164('0x41')]({'message':_0x9164('0x5d')});}var _0x227dd4={'payload':{'id':_0x21547b['user']['id'],'role':_0x21547b[_0x9164('0x55')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x227dd4)[_0x9164('0x35')](function(_0x6a4b4e){_0x250740[_0x9164('0x5e')](_0x9164('0x5f'),_0x6a4b4e);_0x250740['redirect'](_0x9164('0x60'));})['catch'](function(_0x3403c0){return _0x250740[_0x9164('0x36')](0x1f4)[_0x9164('0x61')](_0x3403c0);});};exports['retrieveApiKey']=function(_0xad9220){if(_['isNil'](_0xad9220[_0x9164('0x4e')])||_[_0x9164('0x62')](_0xad9220['apiKeyIat'])){return null;}else{return createJwt(_0xad9220);}};exports[_0x9164('0x63')]=function(_0x3994a4){_0x3994a4[_0x9164('0x4e')]=generateNonce();_0x3994a4[_0x9164('0x64')]=generateIssuedAt();return createJwt(_0x3994a4);};exports[_0x9164('0x65')]=function(_0x3f71b0,_0x2f2faa){var _0x102166=_0x3f71b0['query'][_0x9164('0x47')];if(_0x102166){var _0x505278={'nonce':_0x2f2faa['apiKeyNonce'],'iat':_0x2f2faa[_0x9164('0x64')],'audience':hardwareConf[_0x9164('0x48')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x102166,_0x505278)[_0x9164('0x35')](function(){return generateApiKey(_0x2f2faa);});}else{throw{'message':_0x9164('0x66')};}};exports[_0x9164('0x67')]=function(_0x4b0635){var _0xc5f456=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xc5f456[_0x9164('0x68')](_0x4b0635))throw new db[(_0x9164('0x69'))]['ValidationError'](_0x9164('0x6a'));return;};exports[_0x9164('0x6b')]=function(_0x1eafa8,_0x304f0e,_0x429b50){var _0x45fdd4=encryptor['decryptString'](_0x304f0e)[_0x9164('0x6c')](',');for(var _0x2f16d6=0x0;_0x2f16d6<_0x429b50;_0x2f16d6++){if(!_0x45fdd4[_0x2f16d6])break;if(_0x1eafa8[_0x9164('0x6d')]()===_0x45fdd4[_0x2f16d6][_0x9164('0x6d')]()){var _0xa9cbe9=util[_0x9164('0x6e')](_0x9164('0x6f'),_0x429b50);if(_0x429b50===0x1){_0xa9cbe9='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x9164('0x69'))]['ValidationError'](_0xa9cbe9);}}return;};exports[_0x9164('0x70')]=function(_0x482986,_0x21c0b0){var _0x111b2b=_0x21c0b0?encryptor[_0x9164('0x71')](_0x21c0b0)[_0x9164('0x6c')](','):[];if(_0x111b2b[_0x9164('0x72')]===0x5){_0x111b2b[_0x9164('0x73')](-0x1,0x1);}_0x111b2b[_0x9164('0x74')](_0x482986);return encryptor['encryptString'](_0x111b2b[_0x9164('0x75')](','));};function signJwt(_0x34499b){var _0x56630b=BPromise[_0x9164('0x76')](jwt[_0x9164('0x77')],{'context':jwt});var _0xcb2933=_0x34499b[_0x9164('0x78')]||config[_0x9164('0xc')]['session'];return new BPromise(function(_0x52611e,_0x3294f3){_0x56630b(_0x34499b[_0x9164('0x79')],_0xcb2933,_0x34499b[_0x9164('0x7a')])[_0x9164('0x35')](function(_0x42ed32){_0x52611e(_0x42ed32);})[_0x9164('0x3a')](function(_0x457b11){_0x3294f3(_0x457b11);});});}function verifyJwt(_0x25cf69,_0x548653,_0x506bac){var _0x2375a9=BPromise[_0x9164('0x76')](jwt[_0x9164('0x7b')],{'context':jwt});var _0x4657aa=_0x506bac||config[_0x9164('0xc')]['session'];return new BPromise(function(_0x47721e,_0x59516a){_0x2375a9(_0x25cf69,_0x4657aa,_0x548653)[_0x9164('0x35')](function(_0x3a649e){_0x47721e(_0x3a649e);})[_0x9164('0x3a')](function(_0x4e19cf){_0x59516a(_0x4e19cf);});});}function generateNonce(){return crypto[_0x9164('0x7c')](0x10)['toString'](_0x9164('0x7d'));}function generateIssuedAt(){return Math['floor'](Date[_0x9164('0x7e')]()/0x3e8)[_0x9164('0x7f')]();}function createJwt(_0x430643){var _0xc60500={'payload':{'iat':_0x430643[_0x9164('0x64')],'nonce':_0x430643[_0x9164('0x4e')]},'options':{'algorithm':_0x9164('0x80'),'subject':_0x430643['id']['toString'](),'issuer':hardwareConf[_0x9164('0x48')](),'audience':hardwareConf[_0x9164('0x48')]()}};return signJwt(_0xc60500)[_0x9164('0x35')](function(_0x1318f7){return{'iat':_0x430643[_0x9164('0x64')],'nonce':_0x430643[_0x9164('0x4e')],'token':_0x1318f7};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 81b35b9..4b1562c 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 _0x5e37=['decryptFile','createDecipher','close','secret','utf8','base64','crypto','../../config/environment','../../config/logger','app','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','data','update','binary','write','end','final','unlink'];(function(_0x454445,_0x20f284){var _0x519198=function(_0x1620cf){while(--_0x1620cf){_0x454445['push'](_0x454445['shift']());}};_0x519198(++_0x20f284);}(_0x5e37,0x126));var _0x75e3=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x5e37[_0x1168a1];return _0xcc5ad8;};'use strict';var crypto=require(_0x75e3('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x75e3('0x1'));var logger=require(_0x75e3('0x2'))(_0x75e3('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x75e3('0x4')};const fileOptions={'algorithm':_0x75e3('0x5')};if(config[_0x75e3('0x6')]&&config[_0x75e3('0x6')][_0x75e3('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x75e3('0x7')]);if(isSupported){fileOptions[_0x75e3('0x7')]=config['encrypt'][_0x75e3('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x75e3('0x8')](',\x20');logger[_0x75e3('0x9')](config[_0x75e3('0x6')][_0x75e3('0x7')],_0x75e3('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x471c1a){return AES_SUPPORTED_RX[_0x75e3('0xb')](_0x471c1a);}function getSupportedCiphers(){return crypto[_0x75e3('0xc')]()[_0x75e3('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1a3091){return getSupportedCiphers()[_0x75e3('0xe')](_0x1a3091)>-0x1;}function combineOptions(_0x554097){var _0x31e38a={};for(var _0x5b4b1b in fileOptions){if(fileOptions[_0x75e3('0xf')](_0x5b4b1b)){_0x31e38a[_0x5b4b1b]=fileOptions[_0x5b4b1b];}}if(_0x554097){for(var _0x5e2a70 in _0x554097){if(_0x554097[_0x75e3('0xf')](_0x5e2a70)){_0x31e38a[_0x5e2a70]=_0x554097[_0x5e2a70];}}}return _0x31e38a;}exports[_0x75e3('0x10')]=function(_0x1e3707,_0x46dc73,_0x137623,_0x9386a8){return new BPromise(function(_0x4b3a00,_0x59dddc){_0x9386a8=combineOptions(_0x9386a8);var _0x15d1b8=new Buffer(_0x137623);var _0x52d46a=fs['createReadStream'](_0x1e3707);var _0x460493=fs[_0x75e3('0x11')](_0x46dc73);var _0x180cc5=crypto[_0x75e3('0x12')](_0x9386a8[_0x75e3('0x7')],_0x15d1b8);_0x52d46a['on'](_0x75e3('0x13'),function(_0x9c8595){var _0xd4dbf5=new Buffer(_0x180cc5[_0x75e3('0x14')](_0x9c8595),_0x75e3('0x15'));_0x460493[_0x75e3('0x16')](_0xd4dbf5);});_0x52d46a['on'](_0x75e3('0x17'),function(){try{var _0x47d08c=new Buffer(_0x180cc5[_0x75e3('0x18')](_0x75e3('0x15')),_0x75e3('0x15'));_0x460493[_0x75e3('0x16')](_0x47d08c);_0x460493[_0x75e3('0x17')]();_0x460493['on']('close',function(){return _0x4b3a00(_0x46dc73);});}catch(_0x49f8bc){fs[_0x75e3('0x19')](_0x46dc73);return _0x59dddc(_0x49f8bc);}});});};exports[_0x75e3('0x1a')]=function(_0x1809d8,_0x572a86,_0x508f7c,_0x1c53a9){return new BPromise(function(_0x28350d,_0x50372e){_0x1c53a9=combineOptions(_0x1c53a9);var _0x641cf6=new Buffer(_0x508f7c);var _0x1ad07e=fs['createReadStream'](_0x1809d8);var _0xad8ff5=fs['createWriteStream'](_0x572a86);var _0x4f3988=crypto[_0x75e3('0x1b')](_0x1c53a9[_0x75e3('0x7')],_0x641cf6);_0x1ad07e['on']('data',function(_0x21a822){var _0x336b48=new Buffer(_0x4f3988[_0x75e3('0x14')](_0x21a822),_0x75e3('0x15'));_0xad8ff5['write'](_0x336b48);});_0x1ad07e['on']('end',function(){try{var _0x245682=new Buffer(_0x4f3988[_0x75e3('0x18')](_0x75e3('0x15')),'binary');_0xad8ff5[_0x75e3('0x16')](_0x245682);_0xad8ff5[_0x75e3('0x17')]();_0xad8ff5['on'](_0x75e3('0x1c'),function(){return _0x28350d(_0x572a86);});}catch(_0x58b727){fs[_0x75e3('0x19')](_0x572a86);return _0x50372e(_0x58b727);}});});};exports['encryptString']=function(_0x292357,_0x51e779,_0x4408ef){var _0x480929=_0x4408ef||stringOptions[_0x75e3('0x7')];var _0x41528d=_0x51e779||stringOptions[_0x75e3('0x1d')];var _0x40d5ba=crypto[_0x75e3('0x12')](_0x480929,_0x41528d);var _0x10363e=_0x40d5ba[_0x75e3('0x14')](_0x292357,_0x75e3('0x1e'),'base64');_0x10363e+=_0x40d5ba[_0x75e3('0x18')](_0x75e3('0x1f'));return _0x10363e;};exports['decryptString']=function(_0x52b340,_0x5cc9cf,_0x220f6f){var _0x5d0557=_0x220f6f||stringOptions[_0x75e3('0x7')];var _0x3f5a38=_0x5cc9cf||stringOptions['secret'];var _0x135bc0=crypto[_0x75e3('0x1b')](_0x5d0557,_0x3f5a38);var _0x23d824=_0x135bc0[_0x75e3('0x14')](_0x52b340,_0x75e3('0x1f'),_0x75e3('0x1e'));_0x23d824+=_0x135bc0['final'](_0x75e3('0x1e'));return _0x23d824;}; \ No newline at end of file +var _0x8b91=['close','encryptString','secret','update','utf8','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final','decryptFile','createDecipher'];(function(_0x2d224c,_0x56f571){var _0x179412=function(_0xc95fb2){while(--_0xc95fb2){_0x2d224c['push'](_0x2d224c['shift']());}};_0x179412(++_0x56f571);}(_0x8b91,0x1aa));var _0x18b9=function(_0x243dc7,_0x334421){_0x243dc7=_0x243dc7-0x0;var _0x1cb049=_0x8b91[_0x243dc7];return _0x1cb049;};'use strict';var crypto=require(_0x18b9('0x0'));var fs=require('fs');var BPromise=require(_0x18b9('0x1'));var _=require(_0x18b9('0x2'));var config=require(_0x18b9('0x3'));var logger=require(_0x18b9('0x4'))(_0x18b9('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x18b9('0x6')][_0x18b9('0x7')],'algorithm':_0x18b9('0x8')};const fileOptions={'algorithm':_0x18b9('0x9')};if(config[_0x18b9('0xa')]&&config[_0x18b9('0xa')][_0x18b9('0xb')]){var isSupported=isAlgorithmSupported(config[_0x18b9('0xa')]['algorithm']);if(isSupported){fileOptions[_0x18b9('0xb')]=config[_0x18b9('0xa')][_0x18b9('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x18b9('0xc')](',\x20');logger['error'](config['encrypt'][_0x18b9('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x176964){return AES_SUPPORTED_RX[_0x18b9('0xd')](_0x176964);}function getSupportedCiphers(){return crypto[_0x18b9('0xe')]()[_0x18b9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x29ce87){return getSupportedCiphers()[_0x18b9('0x10')](_0x29ce87)>-0x1;}function combineOptions(_0x390294){var _0x4495c1={};for(var _0x1dfb3c in fileOptions){if(fileOptions[_0x18b9('0x11')](_0x1dfb3c)){_0x4495c1[_0x1dfb3c]=fileOptions[_0x1dfb3c];}}if(_0x390294){for(var _0x22baf3 in _0x390294){if(_0x390294['hasOwnProperty'](_0x22baf3)){_0x4495c1[_0x22baf3]=_0x390294[_0x22baf3];}}}return _0x4495c1;}exports[_0x18b9('0x12')]=function(_0x99b3ef,_0x1ca477,_0xa0b56,_0x341c4f){return new BPromise(function(_0x54fd37,_0x41955f){_0x341c4f=combineOptions(_0x341c4f);var _0x188110=new Buffer(_0xa0b56);var _0x13c16e=fs[_0x18b9('0x13')](_0x99b3ef);var _0xdf9d89=fs[_0x18b9('0x14')](_0x1ca477);var _0x52c8e4=crypto[_0x18b9('0x15')](_0x341c4f['algorithm'],_0x188110);_0x13c16e['on'](_0x18b9('0x16'),function(_0x110634){var _0x31fd33=new Buffer(_0x52c8e4['update'](_0x110634),_0x18b9('0x17'));_0xdf9d89[_0x18b9('0x18')](_0x31fd33);});_0x13c16e['on'](_0x18b9('0x19'),function(){try{var _0x4574ed=new Buffer(_0x52c8e4[_0x18b9('0x1a')](_0x18b9('0x17')),_0x18b9('0x17'));_0xdf9d89[_0x18b9('0x18')](_0x4574ed);_0xdf9d89['end']();_0xdf9d89['on']('close',function(){return _0x54fd37(_0x1ca477);});}catch(_0x49032e){fs['unlink'](_0x1ca477);return _0x41955f(_0x49032e);}});});};exports[_0x18b9('0x1b')]=function(_0x124921,_0x5b5714,_0x145724,_0x569f7f){return new BPromise(function(_0xef4bd5,_0xb5a871){_0x569f7f=combineOptions(_0x569f7f);var _0x348f51=new Buffer(_0x145724);var _0x4db1aa=fs[_0x18b9('0x13')](_0x124921);var _0x4d660d=fs[_0x18b9('0x14')](_0x5b5714);var _0x302df4=crypto[_0x18b9('0x1c')](_0x569f7f['algorithm'],_0x348f51);_0x4db1aa['on'](_0x18b9('0x16'),function(_0x15c017){var _0x1cc90f=new Buffer(_0x302df4['update'](_0x15c017),_0x18b9('0x17'));_0x4d660d['write'](_0x1cc90f);});_0x4db1aa['on'](_0x18b9('0x19'),function(){try{var _0x279393=new Buffer(_0x302df4[_0x18b9('0x1a')](_0x18b9('0x17')),_0x18b9('0x17'));_0x4d660d[_0x18b9('0x18')](_0x279393);_0x4d660d['end']();_0x4d660d['on'](_0x18b9('0x1d'),function(){return _0xef4bd5(_0x5b5714);});}catch(_0x3cb37d){fs['unlink'](_0x5b5714);return _0xb5a871(_0x3cb37d);}});});};exports[_0x18b9('0x1e')]=function(_0x1c6bc7,_0x23e3ba,_0xf5db10){var _0x3c5977=_0xf5db10||stringOptions[_0x18b9('0xb')];var _0x31f64c=_0x23e3ba||stringOptions[_0x18b9('0x1f')];var _0x3135e2=crypto[_0x18b9('0x15')](_0x3c5977,_0x31f64c);var _0x30fb66=_0x3135e2[_0x18b9('0x20')](_0x1c6bc7,_0x18b9('0x21'),_0x18b9('0x22'));_0x30fb66+=_0x3135e2[_0x18b9('0x1a')](_0x18b9('0x22'));return _0x30fb66;};exports['decryptString']=function(_0x545c96,_0x2ed192,_0x1637d5){var _0x31356d=_0x1637d5||stringOptions[_0x18b9('0xb')];var _0x40b529=_0x2ed192||stringOptions[_0x18b9('0x1f')];var _0x1db914=crypto['createDecipher'](_0x31356d,_0x40b529);var _0x3613cb=_0x1db914[_0x18b9('0x20')](_0x545c96,'base64','utf8');_0x3613cb+=_0x1db914[_0x18b9('0x1a')]('utf8');return _0x3613cb;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a664140..142d4f1 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 _0x4f3e=['then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','.csv','existsSync','join','mkdirSync','each','%s%d.%s','writeFileSync','zip','CSV','Completed','csv','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv'];(function(_0x1b2947,_0x2cadb3){var _0x4dc3a9=function(_0x26eff1){while(--_0x26eff1){_0x1b2947['push'](_0x1b2947['shift']());}};_0x4dc3a9(++_0x2cadb3);}(_0x4f3e,0xaa));var _0xe4f3=function(_0x5ec4be,_0xf2bd81){_0x5ec4be=_0x5ec4be-0x0;var _0x31be90=_0x4f3e[_0x5ec4be];return _0x31be90;};'use strict';var util=require(_0xe4f3('0x0'));var path=require(_0xe4f3('0x1'));var _=require(_0xe4f3('0x2'));var csv=require(_0xe4f3('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe4f3('0x4'));var rimraf=require('rimraf');var db=require(_0xe4f3('0x5'))['db'];var dbH=require(_0xe4f3('0x5'))['dbH'];var logger=require(_0xe4f3('0x6'))(_0xe4f3('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe4f3('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3871ac,_0xb1a75){var _0x7060cc={'status':_0x3871ac};var _0x16e293={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb1a75){_0x7060cc[_0xe4f3('0x9')]=_0xb1a75;}return db['AnalyticExtractedReport'][_0xe4f3('0xa')](_0x7060cc,_0x16e293);}function main(){var _0x143b8d=0x1388;var _0x526406;logger[_0xe4f3('0xb')](util[_0xe4f3('0xc')](_0xe4f3('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xe4f3('0xe')][_0xe4f3('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe4f3('0x10'),_0xe4f3('0x11')]})[_0xe4f3('0x12')](function(_0x2363ce){if(_0x2363ce){_0x526406=_0x2363ce;_0x143b8d=_0x526406['splitSizeCsv']||0x1388;}})[_0xe4f3('0x12')](function(){return dbH['sequelize'][_0xe4f3('0x13')](util['format'](_0xe4f3('0x14'),QUERY),{'type':dbH['sequelize'][_0xe4f3('0x15')][_0xe4f3('0x16')]});})[_0xe4f3('0x12')](function(_0x4a78c6){if(!_0x4a78c6[0x0][_0xe4f3('0x17')]){return analyticExtractedReport(_0xe4f3('0x18'));}var _0x2c0127=[];var _0x2369fe=0x0;if(_0x526406['split']){if(_0x4a78c6&&_0x4a78c6[_0xe4f3('0x19')]){var _0x539722=_[_0xe4f3('0x1a')](_0x4a78c6[0x0][_0xe4f3('0x17')]/_0x143b8d);var _0x2e6192=Number['isInteger'](_0x4a78c6[0x0][_0xe4f3('0x17')]/_0x143b8d)?_0x4a78c6[0x0][_0xe4f3('0x17')]%_0x143b8d:0x0;_0x539722[_0xe4f3('0x1b')](function(_0x4d217a){if(_0x4d217a>0x0){_0x2369fe+=_0x143b8d;}_0x2c0127[_0xe4f3('0x1c')](dbH['sequelize']['query'](util['format'](_0xe4f3('0x1d'),QUERY,_0x143b8d,_0x2369fe),{'type':dbH[_0xe4f3('0x1e')][_0xe4f3('0x15')][_0xe4f3('0x16')]}));});if(_0x2e6192>0x0){_0x2369fe+=_0x143b8d;_0x2c0127[_0xe4f3('0x1c')](dbH[_0xe4f3('0x1e')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e6192,_0x2369fe),{'type':dbH[_0xe4f3('0x1e')][_0xe4f3('0x15')][_0xe4f3('0x16')]}));}}}else{_0x2c0127[_0xe4f3('0x1c')](dbH['sequelize'][_0xe4f3('0x13')](QUERY,{'type':dbH[_0xe4f3('0x1e')][_0xe4f3('0x15')]['SELECT']}));}var _0x1bce9c=path[_0xe4f3('0x1f')](PATH);var _0x3b2217=path['basename'](PATH,_0xe4f3('0x20'));var _0x49bb13=_0x526406[_0xe4f3('0x10')]&&_0x2c0127['length']>0x1;var _0x327c96=[];if(!fs[_0xe4f3('0x21')](path[_0xe4f3('0x22')](_0x1bce9c,_0x3b2217))&&_0x49bb13){fs[_0xe4f3('0x23')](path[_0xe4f3('0x22')](_0x1bce9c,_0x3b2217));}return BPromise[_0xe4f3('0x24')](_0x2c0127,function(_0x4b3cc8){_0x327c96[_0xe4f3('0x1c')](_0x4b3cc8);})['then'](function(){for(var _0x13901b=0x0;_0x13901b<_0x327c96['length'];_0x13901b+=0x1){var _0x302d3b;var _0x3f32e7=_0x327c96[_0x13901b];if(_0x49bb13){_0x302d3b=path[_0xe4f3('0x22')](_0x1bce9c,_0x3b2217,util[_0xe4f3('0xc')](_0xe4f3('0x25'),_0x3b2217,_0x13901b,'csv'));}else{_0x302d3b=path[_0xe4f3('0x22')](_0x1bce9c,util[_0xe4f3('0xc')]('%s.%s',_0x3b2217,'csv'));}fs[_0xe4f3('0x26')](_0x302d3b,csv(_0x3f32e7));}})['then'](function(){if(_0x49bb13){return new Promise(function(_0x5f03da){zipdir(path['join'](_0x1bce9c,_0x3b2217),{'saveTo':path['join'](_0x1bce9c,util[_0xe4f3('0xc')]('%s.%s',_0x3b2217,_0xe4f3('0x27')))},function(_0x532ab8,_0x207dad){rimraf(path[_0xe4f3('0x22')](_0x1bce9c,_0x3b2217),function(){});_0x5f03da('zip\x20finished');});});}})[_0xe4f3('0x12')](function(){logger[_0xe4f3('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe4f3('0x28')));return analyticExtractedReport(_0xe4f3('0x29'),_0x49bb13?util['format']('%s.%s',_0x3b2217,_0x49bb13?_0xe4f3('0x27'):_0xe4f3('0x2a')):null);});})['catch'](function(_0x30e1b4){logger['info'](util[_0xe4f3('0xc')](_0xe4f3('0x2b'),EXTRACTED_REPORT_ID,_0xe4f3('0x28')),util[_0xe4f3('0x2c')](_0x30e1b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe4f3('0x2d'));})[_0xe4f3('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa34a=['argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','%s.%s','csv','writeFileSync','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','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics'];(function(_0x2672df,_0x49c336){var _0x5cc24d=function(_0x1f1661){while(--_0x1f1661){_0x2672df['push'](_0x2672df['shift']());}};_0x5cc24d(++_0x49c336);}(_0xa34a,0x15c));var _0xaa34=function(_0x2ff132,_0x17339b){_0x2ff132=_0x2ff132-0x0;var _0x2f0e6e=_0xa34a[_0x2ff132];return _0x2f0e6e;};'use strict';var util=require(_0xaa34('0x0'));var path=require('path');var _=require(_0xaa34('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xaa34('0x2'));var zipdir=require(_0xaa34('0x3'));var rimraf=require(_0xaa34('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xaa34('0x5'))[_0xaa34('0x6')];var logger=require(_0xaa34('0x7'))(_0xaa34('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xaa34('0x9')][0x2]);var QUERY=process[_0xaa34('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x585f44,_0x2e4eb9){var _0x287bbb={'status':_0x585f44};var _0xc90382={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e4eb9){_0x287bbb[_0xaa34('0xa')]=_0x2e4eb9;}return db[_0xaa34('0xb')][_0xaa34('0xc')](_0x287bbb,_0xc90382);}function main(){var _0x1484af=0x1388;var _0x46148d;logger[_0xaa34('0xd')](util[_0xaa34('0xe')](_0xaa34('0xf'),EXTRACTED_REPORT_ID,_0xaa34('0x10')));return db[_0xaa34('0x11')][_0xaa34('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaa34('0x13'),'splitSizeCsv']})[_0xaa34('0x14')](function(_0x6003e6){if(_0x6003e6){_0x46148d=_0x6003e6;_0x1484af=_0x46148d[_0xaa34('0x15')]||0x1388;}})[_0xaa34('0x14')](function(){return dbH['sequelize'][_0xaa34('0x16')](util[_0xaa34('0xe')](_0xaa34('0x17'),QUERY),{'type':dbH[_0xaa34('0x18')][_0xaa34('0x19')][_0xaa34('0x1a')]});})[_0xaa34('0x14')](function(_0x4bc52f){if(!_0x4bc52f[0x0][_0xaa34('0x1b')]){return analyticExtractedReport(_0xaa34('0x1c'));}var _0x5ba97d=[];var _0x5c1342=0x0;if(_0x46148d[_0xaa34('0x13')]){if(_0x4bc52f&&_0x4bc52f['length']){var _0xd8626c=_[_0xaa34('0x1d')](_0x4bc52f[0x0]['num']/_0x1484af);var _0x49d273=Number[_0xaa34('0x1e')](_0x4bc52f[0x0][_0xaa34('0x1b')]/_0x1484af)?_0x4bc52f[0x0][_0xaa34('0x1b')]%_0x1484af:0x0;_0xd8626c[_0xaa34('0x1f')](function(_0x415de0){if(_0x415de0>0x0){_0x5c1342+=_0x1484af;}_0x5ba97d[_0xaa34('0x20')](dbH[_0xaa34('0x18')][_0xaa34('0x16')](util['format'](_0xaa34('0x21'),QUERY,_0x1484af,_0x5c1342),{'type':dbH[_0xaa34('0x18')][_0xaa34('0x19')][_0xaa34('0x1a')]}));});if(_0x49d273>0x0){_0x5c1342+=_0x1484af;_0x5ba97d['push'](dbH['sequelize']['query'](util['format'](_0xaa34('0x21'),QUERY,_0x49d273,_0x5c1342),{'type':dbH[_0xaa34('0x18')][_0xaa34('0x19')][_0xaa34('0x1a')]}));}}}else{_0x5ba97d['push'](dbH[_0xaa34('0x18')][_0xaa34('0x16')](QUERY,{'type':dbH[_0xaa34('0x18')][_0xaa34('0x19')][_0xaa34('0x1a')]}));}var _0x22bb42=path[_0xaa34('0x22')](PATH);var _0x579452=path['basename'](PATH,_0xaa34('0x23'));var _0x50a829=_0x46148d[_0xaa34('0x13')]&&_0x5ba97d['length']>0x1;var _0x5549b5=[];if(!fs[_0xaa34('0x24')](path['join'](_0x22bb42,_0x579452))&&_0x50a829){fs[_0xaa34('0x25')](path[_0xaa34('0x26')](_0x22bb42,_0x579452));}return BPromise['each'](_0x5ba97d,function(_0x11b9eb){_0x5549b5['push'](_0x11b9eb);})[_0xaa34('0x14')](function(){for(var _0x41f114=0x0;_0x41f114<_0x5549b5['length'];_0x41f114+=0x1){var _0x94b7fa;var _0x2d4fd7=_0x5549b5[_0x41f114];if(_0x50a829){_0x94b7fa=path[_0xaa34('0x26')](_0x22bb42,_0x579452,util[_0xaa34('0xe')](_0xaa34('0x27'),_0x579452,_0x41f114,'csv'));}else{_0x94b7fa=path['join'](_0x22bb42,util[_0xaa34('0xe')](_0xaa34('0x28'),_0x579452,_0xaa34('0x29')));}fs[_0xaa34('0x2a')](_0x94b7fa,csv(_0x2d4fd7));}})[_0xaa34('0x14')](function(){if(_0x50a829){return new Promise(function(_0x272a82){zipdir(path[_0xaa34('0x26')](_0x22bb42,_0x579452),{'saveTo':path[_0xaa34('0x26')](_0x22bb42,util[_0xaa34('0xe')]('%s.%s',_0x579452,'zip'))},function(_0x344a02,_0xaede33){rimraf(path[_0xaa34('0x26')](_0x22bb42,_0x579452),function(){});_0x272a82(_0xaa34('0x2b'));});});}})['then'](function(){logger[_0xaa34('0xd')](util[_0xaa34('0xe')](_0xaa34('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xaa34('0x2d'),_0x50a829?util[_0xaa34('0xe')]('%s.%s',_0x579452,_0x50a829?'zip':_0xaa34('0x29')):null);});})[_0xaa34('0x2e')](function(_0x6b7009){logger[_0xaa34('0xd')](util[_0xaa34('0xe')](_0xaa34('0x2f'),EXTRACTED_REPORT_ID,_0xaa34('0x10')),util[_0xaa34('0x30')](_0x6b7009,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xaa34('0x31')](function(){process[_0xaa34('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b1e9a68..737868d 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 _0xc772=['query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','end','createPdfFromHTML','lodash','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','landscape','toString','\x20/\x20','footer','Arial','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize'];(function(_0x596944,_0x30c792){var _0x4a32b2=function(_0x9747c8){while(--_0x9747c8){_0x596944['push'](_0x596944['shift']());}};_0x4a32b2(++_0x30c792);}(_0xc772,0x188));var _0x2c77=function(_0x1308cd,_0x216483){_0x1308cd=_0x1308cd-0x0;var _0x25f630=_0xc772[_0x1308cd];return _0x25f630;};'use strict';var _=require(_0x2c77('0x0'));var fs=require('fs');var util=require(_0x2c77('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x2c77('0x2'));var PdfPrinter=require(_0x2c77('0x3'));var zipdir=require(_0x2c77('0x4'));var rimraf=require(_0x2c77('0x5'));var JSDOM=require(_0x2c77('0x6'))['JSDOM'];var window=new JSDOM('')[_0x2c77('0x7')];var BPromise=require(_0x2c77('0x8'));var db=require(_0x2c77('0x9'))['db'];var dbH=require(_0x2c77('0x9'))[_0x2c77('0xa')];var logger=require(_0x2c77('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2c77('0xc')][0x2]);var QUERY=process[_0x2c77('0xc')][0x3];var PATH=process[_0x2c77('0xc')][0x4];var NAME=process[_0x2c77('0xc')][0x5];var FORMAT=_0x2c77('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x373eff,_0x275913){var _0x5aae21={'status':_0x373eff};var _0x4e73a9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x275913){_0x5aae21[_0x2c77('0xe')]=_0x275913;}return db[_0x2c77('0xf')]['update'](_0x5aae21,_0x4e73a9);}function getHeaders(_0x4a12a8){return _[_0x2c77('0x10')](_0x4a12a8,function(_0x28568d){return{'text':_0x28568d,'style':_0x2c77('0x11')};});}function getRows(_0x51d773,_0x2936af){return _['map'](_0x2936af,function(_0x3d0f71){return _(_0x3d0f71)['pick'](_0x51d773)[_0x2c77('0x10')](function(_0x573fda){return _0x573fda?_['toString'](_0x573fda):'';})['value']();});}function createTable(_0x140698,_0x433bca){var _0x10a48f={'widths':_['fill'](Array(_0x140698[_0x2c77('0x12')]),0x91),'heights':function(_0x11b319){return _0x11b319===0x0?_0x2c77('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2aa092=getHeaders(_0x140698);_0x10a48f[_0x2c77('0x14')][_0x2c77('0x15')](_0x2aa092);var _0x204efc=getRows(_0x140698,_0x433bca);_0x10a48f['body']=_0x10a48f[_0x2c77('0x14')][_0x2c77('0x16')](_0x204efc);return _0x10a48f;}function createTables(_0x2f3db4){var _0x4cde08=[];var _0x26eb4a=_[_0x2c77('0x17')](Object[_0x2c77('0x18')](_0x2f3db4[0x0]),0x5);_0x26eb4a[_0x2c77('0x19')](function(_0x170b0d){_0x4cde08[_0x2c77('0x15')](createTable(_0x170b0d,_0x2f3db4));});return _0x4cde08;}function getPDFDocDefinition(_0x26b61b){var _0x407730=util[_0x2c77('0x1a')](_0x2c77('0x1b'),NAME,EXTRACTED_REPORT[_0x2c77('0x1c')],moment(EXTRACTED_REPORT[_0x2c77('0x1d')])[_0x2c77('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x2c77('0x1e')])[_0x2c77('0x1a')](FORMAT));var _0x5779d4=[];for(var _0x5ddba7=0x0;_0x5ddba7<_0x26b61b['length'];_0x5ddba7++){var _0x562f53=[];if(_0x5ddba7===0x0){_0x562f53[_0x2c77('0x15')]({'text':_0x407730,'style':_0x2c77('0x1f')});}var _0x555350={'table':_0x26b61b[_0x5ddba7]};if(_0x5ddba7>0x0){_0x555350[_0x2c77('0x20')]='before';_0x555350['margin']=[0x0,0x46,0x0,0x0];}_0x562f53[_0x2c77('0x15')](_0x555350);_0x5779d4[_0x2c77('0x15')](_0x562f53);}return{'pageSize':'A4','pageOrientation':_0x2c77('0x21'),'content':_0x5779d4,'footer':function(_0x135d5d,_0x18c31c){return{'text':_0x135d5d[_0x2c77('0x22')]()+_0x2c77('0x23')+_0x18c31c,'style':_0x2c77('0x24')};},'defaultStyle':{'font':_0x2c77('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4d0973){var _0xb15b32=0x1388;var _0x179970;if(!_0x4d0973[0x0][_0x2c77('0x26')]){return analyticExtractedReport(_0x2c77('0x27'));}return db[_0x2c77('0x28')][_0x2c77('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2c77('0x2a'),_0x2c77('0x2b')]})[_0x2c77('0x2c')](function(_0x2af745){if(_0x2af745){_0x179970=_0x2af745;_0xb15b32=_0x179970[_0x2c77('0x2b')]||0x3e8;}})[_0x2c77('0x2c')](function(){var _0x494c0e=[];var _0x51961f=0x0;if(_0x179970[_0x2c77('0x2a')]){if(_0x4d0973&&_0x4d0973[_0x2c77('0x12')]){var _0x766e76=_[_0x2c77('0x2d')](_0x4d0973[0x0][_0x2c77('0x26')]/_0xb15b32);var _0x4d2d20=Number[_0x2c77('0x2e')](_0x4d0973[0x0][_0x2c77('0x26')]/_0xb15b32)?_0x4d0973[0x0]['num']%_0xb15b32:0x0;_0x766e76['forEach'](function(_0x1428e2){if(_0x1428e2>0x0){_0x51961f+=_0xb15b32;}_0x494c0e[_0x2c77('0x15')](dbH[_0x2c77('0x2f')][_0x2c77('0x30')](util['format'](_0x2c77('0x31'),QUERY,_0xb15b32,_0x51961f),{'type':dbH[_0x2c77('0x2f')]['QueryTypes']['SELECT']}));});if(_0x4d2d20>0x0){_0x51961f+=_0xb15b32;_0x494c0e['push'](dbH[_0x2c77('0x2f')][_0x2c77('0x30')](util['format'](_0x2c77('0x31'),QUERY,_0x4d2d20,_0x51961f),{'type':dbH['sequelize'][_0x2c77('0x32')][_0x2c77('0x33')]}));}}}else{_0x494c0e[_0x2c77('0x15')](dbH[_0x2c77('0x2f')][_0x2c77('0x30')](QUERY,{'type':dbH[_0x2c77('0x2f')][_0x2c77('0x32')][_0x2c77('0x33')]}));}var _0x249aab=path[_0x2c77('0x34')](PATH);var _0x40e556=path[_0x2c77('0x35')](PATH,_0x2c77('0x36'));var _0x4132c8=_0x179970[_0x2c77('0x2a')]&&_0x494c0e[_0x2c77('0x12')]>0x1;var _0xbfdc1d=[];if(!fs['existsSync'](path[_0x2c77('0x37')](_0x249aab,_0x40e556))&&_0x4132c8){fs[_0x2c77('0x38')](path[_0x2c77('0x37')](_0x249aab,_0x40e556));}return BPromise[_0x2c77('0x39')](_0x494c0e,function(_0x2f13c3){_0xbfdc1d[_0x2c77('0x15')](_0x2f13c3);})[_0x2c77('0x2c')](function(){var _0x88ec16=[];for(var _0x227939=0x0;_0x227939<_0xbfdc1d[_0x2c77('0x12')];_0x227939+=0x1){var _0x40b2e2=_0xbfdc1d[_0x227939];var _0x1d3789=createTables(_['flatten'](_0x40b2e2));var _0x30de4f;var _0x295529=getPDFDocDefinition(_0x1d3789);var _0x582485=getPDFPrinter();var _0x1a90b5=_0x582485[_0x2c77('0x3a')](_0x295529);if(_0x4132c8){_0x30de4f=path['join'](_0x249aab,_0x40e556,util['format'](_0x2c77('0x3b'),_0x40e556,_0x227939,_0x2c77('0x3c')));}else{_0x30de4f=path[_0x2c77('0x37')](_0x249aab,util[_0x2c77('0x1a')]('%s.%s',_0x40e556,_0x2c77('0x3c')));}_0x88ec16[_0x2c77('0x15')](writePDFDocument(_0x1a90b5,_0x30de4f));}return Promise[_0x2c77('0x3d')](_0x88ec16);})['then'](function(){if(_0x4132c8){return new Promise(function(_0x48c3e5){zipdir(path[_0x2c77('0x37')](_0x249aab,_0x40e556),{'saveTo':path[_0x2c77('0x37')](_0x249aab,util[_0x2c77('0x1a')](_0x2c77('0x3e'),_0x40e556,'zip'))},function(){rimraf(path[_0x2c77('0x37')](_0x249aab,_0x40e556),function(){});_0x48c3e5(_0x2c77('0x3f'));});});}})[_0x2c77('0x2c')](function(){if(!_0x4132c8)return;rimraf(path['join'](_0x249aab,_0x40e556),function(){});})[_0x2c77('0x2c')](function(){logger[_0x2c77('0x40')](util[_0x2c77('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2c77('0x41')));return analyticExtractedReport(_0x2c77('0x42'),_0x4132c8?util['format']('%s.%s',_0x40e556,_0x4132c8?'zip':_0x2c77('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2c77('0x40')](util[_0x2c77('0x1a')](_0x2c77('0x43'),EXTRACTED_REPORT_ID,_0x2c77('0x41')));return db[_0x2c77('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2c77('0x2c')](function(_0x4febc1){EXTRACTED_REPORT=_0x4febc1;return dbH['sequelize'][_0x2c77('0x30')](util[_0x2c77('0x1a')](_0x2c77('0x44'),QUERY),{'type':dbH[_0x2c77('0x2f')][_0x2c77('0x32')][_0x2c77('0x33')]});})[_0x2c77('0x2c')](extractReport)[_0x2c77('0x45')](function(_0x284a9f){logger[_0x2c77('0x40')](util['format'](_0x2c77('0x46'),EXTRACTED_REPORT_ID,_0x2c77('0x41')),util[_0x2c77('0x47')](_0x284a9f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2c77('0x48'));})[_0x2c77('0x49')](function(){process[_0x2c77('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4276d5=new PdfPrinter({'Arial':{'normal':__dirname+_0x2c77('0x4b'),'bold':__dirname+_0x2c77('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x2c77('0x4d')}});return _0x4276d5;}function getPDFDocDefinitionFromHTML(_0x1500d6,_0x52502c){var _0x50f67d=util[_0x2c77('0x1a')](_0x2c77('0x4e'),_0x52502c['channel'],_0x52502c[_0x2c77('0x4f')]);var _0x4d1975=moment()[_0x2c77('0x1a')]('YYYY-MM-DD')[_0x2c77('0x22')]();var _0x431b5c=htmlToPdfmake(_0x1500d6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x431b5c],'defaultStyle':{'font':_0x2c77('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2c77('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2c77('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2c77('0x50')}},'header':function(){return[{'text':_0x2c77('0x51'),'style':_0x2c77('0x1f')}];},'footer':function(_0x37bff8,_0x1cfa9a){return[{'text':util[_0x2c77('0x1a')](_0x2c77('0x52'),_0x50f67d,_0x37bff8,_0x1cfa9a,_0x4d1975),'style':_0x2c77('0x24')}];}};}function writePDFDocument(_0x2eba0d,_0x14daff){return new Promise(function(_0xe791c8,_0x3101ec){var _0x3bbbd0=_0x2eba0d[_0x2c77('0x53')](fs[_0x2c77('0x54')](_0x14daff));_0x3bbbd0['on']('finish',function(){_0xe791c8('finish');});_0x3bbbd0['on'](_0x2c77('0x55'),function(_0x3b90a1){_0x3101ec(_0x3b90a1);});_0x2eba0d[_0x2c77('0x56')]();});}exports[_0x2c77('0x57')]=function(_0x56d294,_0xb6bb9){var _0x5f1600=getPDFPrinter();var _0xce8000=getPDFDocDefinitionFromHTML(_0x56d294,_0xb6bb9);var _0x1b0de9=_0x5f1600[_0x2c77('0x3a')](_0xce8000);return writePDFDocument(_0x1b0de9,_0xb6bb9['path'])[_0x2c77('0x45')](function(_0x45b63d){throw _0x45b63d;});}; \ No newline at end of file +var _0x4456=['QueryTypes','SELECT','dirname','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x318ebd,_0x23253a){var _0x56e1e3=function(_0x48f1d9){while(--_0x48f1d9){_0x318ebd['push'](_0x318ebd['shift']());}};_0x56e1e3(++_0x23253a);}(_0x4456,0x1d7));var _0x6445=function(_0x386f62,_0x597de){_0x386f62=_0x386f62-0x0;var _0x2658bb=_0x4456[_0x386f62];return _0x2658bb;};'use strict';var _=require(_0x6445('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x6445('0x1'));var htmlToPdfmake=require(_0x6445('0x2'));var PdfPrinter=require(_0x6445('0x3'));var zipdir=require(_0x6445('0x4'));var rimraf=require(_0x6445('0x5'));var JSDOM=require(_0x6445('0x6'))[_0x6445('0x7')];var window=new JSDOM('')[_0x6445('0x8')];var BPromise=require('bluebird');var db=require(_0x6445('0x9'))['db'];var dbH=require(_0x6445('0x9'))[_0x6445('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6445('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6445('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f278a,_0x3405f5){var _0x4349d3={'status':_0x3f278a};var _0x19bcc2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3405f5){_0x4349d3[_0x6445('0xc')]=_0x3405f5;}return db[_0x6445('0xd')][_0x6445('0xe')](_0x4349d3,_0x19bcc2);}function getHeaders(_0x56d0ac){return _[_0x6445('0xf')](_0x56d0ac,function(_0x58fe45){return{'text':_0x58fe45,'style':_0x6445('0x10')};});}function getRows(_0x59b7e3,_0x56f307){return _[_0x6445('0xf')](_0x56f307,function(_0x47caf2){return _(_0x47caf2)[_0x6445('0x11')](_0x59b7e3)[_0x6445('0xf')](function(_0x312869){return _0x312869?_[_0x6445('0x12')](_0x312869):'';})[_0x6445('0x13')]();});}function createTable(_0x1435cd,_0x1b39a9){var _0x5a9501={'widths':_[_0x6445('0x14')](Array(_0x1435cd[_0x6445('0x15')]),0x91),'heights':function(_0x4779b7){return _0x4779b7===0x0?_0x6445('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x25f80f=getHeaders(_0x1435cd);_0x5a9501['body'][_0x6445('0x17')](_0x25f80f);var _0xe816e4=getRows(_0x1435cd,_0x1b39a9);_0x5a9501[_0x6445('0x18')]=_0x5a9501[_0x6445('0x18')][_0x6445('0x19')](_0xe816e4);return _0x5a9501;}function createTables(_0x1f0d09){var _0x4e92a5=[];var _0x127578=_[_0x6445('0x1a')](Object[_0x6445('0x1b')](_0x1f0d09[0x0]),0x5);_0x127578[_0x6445('0x1c')](function(_0x1209b0){_0x4e92a5[_0x6445('0x17')](createTable(_0x1209b0,_0x1f0d09));});return _0x4e92a5;}function getPDFDocDefinition(_0x220baa){var _0x66a219=util[_0x6445('0x1d')](_0x6445('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x6445('0x1f')])[_0x6445('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x6445('0x20')])[_0x6445('0x1d')](FORMAT));var _0x114f14=[];for(var _0x5091d0=0x0;_0x5091d0<_0x220baa[_0x6445('0x15')];_0x5091d0++){var _0x3557cd=[];if(_0x5091d0===0x0){_0x3557cd[_0x6445('0x17')]({'text':_0x66a219,'style':_0x6445('0x21')});}var _0x53bf59={'table':_0x220baa[_0x5091d0]};if(_0x5091d0>0x0){_0x53bf59[_0x6445('0x22')]=_0x6445('0x23');_0x53bf59[_0x6445('0x24')]=[0x0,0x46,0x0,0x0];}_0x3557cd['push'](_0x53bf59);_0x114f14[_0x6445('0x17')](_0x3557cd);}return{'pageSize':'A4','pageOrientation':_0x6445('0x25'),'content':_0x114f14,'footer':function(_0xe99214,_0x5d7622){return{'text':_0xe99214[_0x6445('0x12')]()+'\x20/\x20'+_0x5d7622,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6445('0x26')},'footer':{'alignment':_0x6445('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x232aba){var _0x10f18a=0x1388;var _0x110422;if(!_0x232aba[0x0][_0x6445('0x28')]){return analyticExtractedReport(_0x6445('0x29'));}return db[_0x6445('0x2a')][_0x6445('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6445('0x2c'),_0x6445('0x2d')]})[_0x6445('0x2e')](function(_0x25c294){if(_0x25c294){_0x110422=_0x25c294;_0x10f18a=_0x110422[_0x6445('0x2d')]||0x3e8;}})[_0x6445('0x2e')](function(){var _0x1c720b=[];var _0x169010=0x0;if(_0x110422[_0x6445('0x2c')]){if(_0x232aba&&_0x232aba['length']){var _0xf352c2=_['range'](_0x232aba[0x0][_0x6445('0x28')]/_0x10f18a);var _0x32f15b=Number[_0x6445('0x2f')](_0x232aba[0x0][_0x6445('0x28')]/_0x10f18a)?_0x232aba[0x0]['num']%_0x10f18a:0x0;_0xf352c2['forEach'](function(_0x5d70e9){if(_0x5d70e9>0x0){_0x169010+=_0x10f18a;}_0x1c720b[_0x6445('0x17')](dbH[_0x6445('0x30')][_0x6445('0x31')](util['format'](_0x6445('0x32'),QUERY,_0x10f18a,_0x169010),{'type':dbH[_0x6445('0x30')][_0x6445('0x33')]['SELECT']}));});if(_0x32f15b>0x0){_0x169010+=_0x10f18a;_0x1c720b[_0x6445('0x17')](dbH[_0x6445('0x30')][_0x6445('0x31')](util[_0x6445('0x1d')](_0x6445('0x32'),QUERY,_0x32f15b,_0x169010),{'type':dbH['sequelize'][_0x6445('0x33')]['SELECT']}));}}}else{_0x1c720b['push'](dbH[_0x6445('0x30')][_0x6445('0x31')](QUERY,{'type':dbH[_0x6445('0x30')]['QueryTypes'][_0x6445('0x34')]}));}var _0x4759f6=path[_0x6445('0x35')](PATH);var _0x41b416=path['basename'](PATH,_0x6445('0x36'));var _0x4adf7a=_0x110422['split']&&_0x1c720b[_0x6445('0x15')]>0x1;var _0x432db8=[];if(!fs['existsSync'](path[_0x6445('0x37')](_0x4759f6,_0x41b416))&&_0x4adf7a){fs[_0x6445('0x38')](path[_0x6445('0x37')](_0x4759f6,_0x41b416));}return BPromise[_0x6445('0x39')](_0x1c720b,function(_0x12151a){_0x432db8['push'](_0x12151a);})[_0x6445('0x2e')](function(){var _0x343f01=[];for(var _0x79814d=0x0;_0x79814d<_0x432db8[_0x6445('0x15')];_0x79814d+=0x1){var _0x5a0f28=_0x432db8[_0x79814d];var _0x3e7bbf=createTables(_[_0x6445('0x3a')](_0x5a0f28));var _0x3bbbd0;var _0x40a2e5=getPDFDocDefinition(_0x3e7bbf);var _0x1ff6b1=getPDFPrinter();var _0x2f00f6=_0x1ff6b1['createPdfKitDocument'](_0x40a2e5);if(_0x4adf7a){_0x3bbbd0=path[_0x6445('0x37')](_0x4759f6,_0x41b416,util[_0x6445('0x1d')](_0x6445('0x3b'),_0x41b416,_0x79814d,_0x6445('0x3c')));}else{_0x3bbbd0=path['join'](_0x4759f6,util[_0x6445('0x1d')](_0x6445('0x3d'),_0x41b416,'pdf'));}_0x343f01['push'](writePDFDocument(_0x2f00f6,_0x3bbbd0));}return Promise[_0x6445('0x3e')](_0x343f01);})[_0x6445('0x2e')](function(){if(_0x4adf7a){return new Promise(function(_0x2d0057){zipdir(path['join'](_0x4759f6,_0x41b416),{'saveTo':path['join'](_0x4759f6,util[_0x6445('0x1d')](_0x6445('0x3d'),_0x41b416,_0x6445('0x3f')))},function(){rimraf(path[_0x6445('0x37')](_0x4759f6,_0x41b416),function(){});_0x2d0057(_0x6445('0x40'));});});}})[_0x6445('0x2e')](function(){if(!_0x4adf7a)return;rimraf(path[_0x6445('0x37')](_0x4759f6,_0x41b416),function(){});})['then'](function(){logger[_0x6445('0x41')](util[_0x6445('0x1d')](_0x6445('0x42'),EXTRACTED_REPORT_ID,_0x6445('0x43')));return analyticExtractedReport(_0x6445('0x44'),_0x4adf7a?util[_0x6445('0x1d')](_0x6445('0x3d'),_0x41b416,_0x4adf7a?_0x6445('0x3f'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6445('0x41')](util[_0x6445('0x1d')](_0x6445('0x45'),EXTRACTED_REPORT_ID,_0x6445('0x43')));return db[_0x6445('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6445('0x2e')](function(_0x19d6f0){EXTRACTED_REPORT=_0x19d6f0;return dbH[_0x6445('0x30')][_0x6445('0x31')](util[_0x6445('0x1d')](_0x6445('0x46'),QUERY),{'type':dbH['sequelize'][_0x6445('0x33')][_0x6445('0x34')]});})[_0x6445('0x2e')](extractReport)['catch'](function(_0x4c1164){logger[_0x6445('0x41')](util['format'](_0x6445('0x47'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x4c1164,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6445('0x48'));})['finally'](function(){process[_0x6445('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3d75b0=new PdfPrinter({'Arial':{'normal':__dirname+_0x6445('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x6445('0x4b')}});return _0x3d75b0;}function getPDFDocDefinitionFromHTML(_0x4e7dc4,_0x246d8a){var _0x2b900b=util[_0x6445('0x1d')](_0x6445('0x4c'),_0x246d8a['channel'],_0x246d8a[_0x6445('0x4d')]);var _0x681db=moment()[_0x6445('0x1d')](_0x6445('0x4e'))[_0x6445('0x12')]();var _0x1dc44b=htmlToPdfmake(_0x4e7dc4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1dc44b],'defaultStyle':{'font':_0x6445('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6445('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6445('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6445('0x50')}},'header':function(){return[{'text':_0x6445('0x51'),'style':_0x6445('0x21')}];},'footer':function(_0xbf7f9f,_0x4d204a){return[{'text':util[_0x6445('0x1d')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2b900b,_0xbf7f9f,_0x4d204a,_0x681db),'style':'footer'}];}};}function writePDFDocument(_0x41e5f6,_0x33a518){return new Promise(function(_0x90e1ed,_0x1d8b00){var _0x3083c2=_0x41e5f6['pipe'](fs['createWriteStream'](_0x33a518));_0x3083c2['on'](_0x6445('0x52'),function(){_0x90e1ed(_0x6445('0x52'));});_0x3083c2['on'](_0x6445('0x53'),function(_0x19f436){_0x1d8b00(_0x19f436);});_0x41e5f6[_0x6445('0x54')]();});}exports[_0x6445('0x55')]=function(_0xbed42b,_0x321973){var _0xeb530=getPDFPrinter();var _0x3ac04a=getPDFDocDefinitionFromHTML(_0xbed42b,_0x321973);var _0x3cdbf7=_0xeb530[_0x6445('0x56')](_0x3ac04a);return writePDFDocument(_0x3cdbf7,_0x321973['path'])['catch'](function(_0x12dd09){throw _0x12dd09;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e6a8729..e057923 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 _0x7145=['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','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x7145,0x98));var _0x5714=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7145[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var path=require(_0x5714('0x0'));var _=require(_0x5714('0x1'));var fs=require('fs');var json2xls=require(_0x5714('0x2'));var BPromise=require(_0x5714('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x5714('0x4'));var db=require(_0x5714('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x5714('0x6'))(_0x5714('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x5714('0x8')][0x2]);var QUERY=process[_0x5714('0x8')][0x3];var PATH=process[_0x5714('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x346ded,_0x449aad){var _0x37b80d={'status':_0x346ded};var _0x4a59f8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x449aad){_0x37b80d['savename']=_0x449aad;}return db[_0x5714('0x9')][_0x5714('0xa')](_0x37b80d,_0x4a59f8);}function main(){var _0x22ee61=0x1388;var _0x3109be;logger[_0x5714('0xb')](util[_0x5714('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5714('0xd')));return db['Setting'][_0x5714('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5714('0xf'),_0x5714('0x10')]})[_0x5714('0x11')](function(_0x45db0d){if(_0x45db0d){_0x3109be=_0x45db0d;_0x22ee61=_0x3109be['splitSizeXlsx']||0x1388;}})[_0x5714('0x11')](function(){return dbH[_0x5714('0x12')][_0x5714('0x13')](util[_0x5714('0xc')](_0x5714('0x14'),QUERY),{'type':dbH[_0x5714('0x12')][_0x5714('0x15')][_0x5714('0x16')]});})[_0x5714('0x11')](function(_0x29b8ff){if(!_0x29b8ff[0x0][_0x5714('0x17')]){return analyticExtractedReport('Empty');}var _0x3676b8=[];var _0x38ffad=0x0;if(_0x3109be[_0x5714('0xf')]){if(_0x29b8ff&&_0x29b8ff[_0x5714('0x18')]){var _0x53c407=_[_0x5714('0x19')](_0x29b8ff[0x0][_0x5714('0x17')]/_0x22ee61);var _0x211033=Number['isInteger'](_0x29b8ff[0x0][_0x5714('0x17')]/_0x22ee61)?_0x29b8ff[0x0][_0x5714('0x17')]%_0x22ee61:0x0;_0x53c407[_0x5714('0x1a')](function(_0x483db7){if(_0x483db7>0x0){_0x38ffad+=_0x22ee61;}_0x3676b8[_0x5714('0x1b')](dbH[_0x5714('0x12')][_0x5714('0x13')](util[_0x5714('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x22ee61,_0x38ffad),{'type':dbH[_0x5714('0x12')][_0x5714('0x15')][_0x5714('0x16')]}));});if(_0x211033>0x0){_0x38ffad+=_0x22ee61;_0x3676b8[_0x5714('0x1b')](dbH[_0x5714('0x12')][_0x5714('0x13')](util['format'](_0x5714('0x1c'),QUERY,_0x211033,_0x38ffad),{'type':dbH[_0x5714('0x12')][_0x5714('0x15')]['SELECT']}));}}}else{_0x3676b8[_0x5714('0x1b')](dbH['sequelize'][_0x5714('0x13')](QUERY,{'type':dbH['sequelize'][_0x5714('0x15')][_0x5714('0x16')]}));}var _0x2fccf4=path[_0x5714('0x1d')](PATH);var _0x731bc6=path[_0x5714('0x1e')](PATH,'.xlsx');var _0x514ba2=_0x3109be[_0x5714('0xf')]&&_0x3676b8[_0x5714('0x18')]>0x1;var _0x5df9a8=[];if(!fs['existsSync'](path[_0x5714('0x1f')](_0x2fccf4,_0x731bc6))&&_0x514ba2){fs['mkdirSync'](path[_0x5714('0x1f')](_0x2fccf4,_0x731bc6));}return BPromise[_0x5714('0x20')](_0x3676b8,function(_0x277796){_0x5df9a8['push'](_0x277796);})[_0x5714('0x11')](function(){for(var _0x3d5262=0x0;_0x3d5262<_0x5df9a8[_0x5714('0x18')];_0x3d5262+=0x1){var _0x50aa41;var _0xbf8ce6=_0x5df9a8[_0x3d5262];if(_0x514ba2){_0x50aa41=path['join'](_0x2fccf4,_0x731bc6,util[_0x5714('0xc')](_0x5714('0x21'),_0x731bc6,_0x3d5262,_0x5714('0x22')));}else{_0x50aa41=path[_0x5714('0x1f')](_0x2fccf4,util[_0x5714('0xc')](_0x5714('0x23'),_0x731bc6,_0x5714('0x22')));}fs[_0x5714('0x24')](_0x50aa41,json2xls(_0xbf8ce6),_0x5714('0x25'));}})[_0x5714('0x11')](function(){if(_0x514ba2){return new Promise(function(_0x5833f0){zipdir(path[_0x5714('0x1f')](_0x2fccf4,_0x731bc6),{'saveTo':path[_0x5714('0x1f')](_0x2fccf4,util['format'](_0x5714('0x23'),_0x731bc6,_0x5714('0x26')))},function(_0x53fae3,_0x14270f){rimraf(path[_0x5714('0x1f')](_0x2fccf4,_0x731bc6),function(){});_0x5833f0(_0x5714('0x27'));});});}})['then'](function(){logger[_0x5714('0xb')](util[_0x5714('0xc')](_0x5714('0x28'),EXTRACTED_REPORT_ID,_0x5714('0xd')));return analyticExtractedReport(_0x5714('0x29'),_0x514ba2?util[_0x5714('0xc')](_0x5714('0x23'),_0x731bc6,_0x514ba2?_0x5714('0x26'):_0x5714('0x22')):null);});})[_0x5714('0x2a')](function(_0x4de7c7){logger['info'](util[_0x5714('0xc')](_0x5714('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x5714('0x2c')](_0x4de7c7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5714('0x2d'));})[_0x5714('0x2e')](function(){process[_0x5714('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x907e=['forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','mkdirSync','each','join','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','query','sequelize','QueryTypes','SELECT','num','Empty','length','isInteger'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0x907e,0xc8));var _0xe907=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x907e[_0x3511d3];return _0x5d6321;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xe907('0x0'));var BPromise=require(_0xe907('0x1'));var zipdir=require('zip-dir');var rimraf=require(_0xe907('0x2'));var db=require(_0xe907('0x3'))['db'];var dbH=require(_0xe907('0x3'))[_0xe907('0x4')];var logger=require(_0xe907('0x5'))(_0xe907('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xe907('0x7')][0x2]);var QUERY=process[_0xe907('0x7')][0x3];var PATH=process[_0xe907('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc5fe8c,_0x8d762f){var _0x451c8c={'status':_0xc5fe8c};var _0x591eea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8d762f){_0x451c8c[_0xe907('0x8')]=_0x8d762f;}return db['AnalyticExtractedReport']['update'](_0x451c8c,_0x591eea);}function main(){var _0x3b3c09=0x1388;var _0x28f4e7;logger[_0xe907('0x9')](util[_0xe907('0xa')](_0xe907('0xb'),EXTRACTED_REPORT_ID,_0xe907('0xc')));return db[_0xe907('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe907('0xe'),'splitSizeXlsx']})[_0xe907('0xf')](function(_0x228971){if(_0x228971){_0x28f4e7=_0x228971;_0x3b3c09=_0x28f4e7[_0xe907('0x10')]||0x1388;}})[_0xe907('0xf')](function(){return dbH['sequelize'][_0xe907('0x11')](util[_0xe907('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe907('0x12')][_0xe907('0x13')][_0xe907('0x14')]});})['then'](function(_0x56216e){if(!_0x56216e[0x0][_0xe907('0x15')]){return analyticExtractedReport(_0xe907('0x16'));}var _0x3c2f7d=[];var _0x3e05dd=0x0;if(_0x28f4e7[_0xe907('0xe')]){if(_0x56216e&&_0x56216e[_0xe907('0x17')]){var _0x2fe9e4=_['range'](_0x56216e[0x0][_0xe907('0x15')]/_0x3b3c09);var _0x334323=Number[_0xe907('0x18')](_0x56216e[0x0][_0xe907('0x15')]/_0x3b3c09)?_0x56216e[0x0][_0xe907('0x15')]%_0x3b3c09:0x0;_0x2fe9e4[_0xe907('0x19')](function(_0x54588e){if(_0x54588e>0x0){_0x3e05dd+=_0x3b3c09;}_0x3c2f7d['push'](dbH['sequelize'][_0xe907('0x11')](util[_0xe907('0xa')](_0xe907('0x1a'),QUERY,_0x3b3c09,_0x3e05dd),{'type':dbH[_0xe907('0x12')][_0xe907('0x13')][_0xe907('0x14')]}));});if(_0x334323>0x0){_0x3e05dd+=_0x3b3c09;_0x3c2f7d['push'](dbH[_0xe907('0x12')]['query'](util[_0xe907('0xa')](_0xe907('0x1a'),QUERY,_0x334323,_0x3e05dd),{'type':dbH[_0xe907('0x12')][_0xe907('0x13')][_0xe907('0x14')]}));}}}else{_0x3c2f7d[_0xe907('0x1b')](dbH[_0xe907('0x12')][_0xe907('0x11')](QUERY,{'type':dbH['sequelize'][_0xe907('0x13')]['SELECT']}));}var _0x1bc91f=path[_0xe907('0x1c')](PATH);var _0x2ad26a=path[_0xe907('0x1d')](PATH,_0xe907('0x1e'));var _0x54cffc=_0x28f4e7[_0xe907('0xe')]&&_0x3c2f7d[_0xe907('0x17')]>0x1;var _0x979d1f=[];if(!fs['existsSync'](path['join'](_0x1bc91f,_0x2ad26a))&&_0x54cffc){fs[_0xe907('0x1f')](path['join'](_0x1bc91f,_0x2ad26a));}return BPromise[_0xe907('0x20')](_0x3c2f7d,function(_0x2d1dfe){_0x979d1f['push'](_0x2d1dfe);})[_0xe907('0xf')](function(){for(var _0x4a22e4=0x0;_0x4a22e4<_0x979d1f[_0xe907('0x17')];_0x4a22e4+=0x1){var _0x52ff89;var _0x2f0d6d=_0x979d1f[_0x4a22e4];if(_0x54cffc){_0x52ff89=path['join'](_0x1bc91f,_0x2ad26a,util[_0xe907('0xa')]('%s%d.%s',_0x2ad26a,_0x4a22e4,'xlsx'));}else{_0x52ff89=path[_0xe907('0x21')](_0x1bc91f,util['format'](_0xe907('0x22'),_0x2ad26a,'xlsx'));}fs[_0xe907('0x23')](_0x52ff89,json2xls(_0x2f0d6d),_0xe907('0x24'));}})[_0xe907('0xf')](function(){if(_0x54cffc){return new Promise(function(_0x4473c1){zipdir(path[_0xe907('0x21')](_0x1bc91f,_0x2ad26a),{'saveTo':path[_0xe907('0x21')](_0x1bc91f,util[_0xe907('0xa')](_0xe907('0x22'),_0x2ad26a,_0xe907('0x25')))},function(_0x447b05,_0x2c0ead){rimraf(path[_0xe907('0x21')](_0x1bc91f,_0x2ad26a),function(){});_0x4473c1('zip\x20finished');});});}})['then'](function(){logger[_0xe907('0x9')](util['format'](_0xe907('0x26'),EXTRACTED_REPORT_ID,_0xe907('0xc')));return analyticExtractedReport(_0xe907('0x27'),_0x54cffc?util['format']('%s.%s',_0x2ad26a,_0x54cffc?_0xe907('0x25'):_0xe907('0x28')):null);});})[_0xe907('0x29')](function(_0x2d4a10){logger[_0xe907('0x9')](util[_0xe907('0xa')](_0xe907('0x2a'),EXTRACTED_REPORT_ID,_0xe907('0xc')),util[_0xe907('0x2b')](_0x2d4a10,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe907('0x2c'));})['finally'](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 f238e38..185e62e 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 _0xf941=['outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','findAll','intervals','models','VoiceExtension','IntervalId','then','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','extensions','CDR(routeid)='];(function(_0x2185d7,_0x2b9aeb){var _0x2f65f1=function(_0x1a7c5f){while(--_0x1a7c5f){_0x2185d7['push'](_0x2185d7['shift']());}};_0x2f65f1(++_0x2b9aeb);}(_0xf941,0x150));var _0x1f94=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf941[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x4f4d5a,_0x397028){var _0x326e05=this;return _0x4f4d5a['models']['Interval'][_0x1f94('0x0')]({'raw':!![]})['then'](function(_0x3a1497){_0x326e05[_0x1f94('0x1')]=_0x3a1497;return _0x4f4d5a[_0x1f94('0x2')][_0x1f94('0x3')][_0x1f94('0x0')]({'where':{'IntervalId':_0x397028[_0x1f94('0x4')]},'raw':!![]});})[_0x1f94('0x5')](function(_0x513e29){return _0x4f4d5a['models'][_0x1f94('0x3')][_0x1f94('0x0')]({'where':{'exten':{'$in':_['uniq'](_[_0x1f94('0x6')](_0x513e29,_0x1f94('0x7')))}},'order':[{'raw':_0x1f94('0x8')}],'raw':!![]});})[_0x1f94('0x5')](function(_0x532dac){var _0x3244b5=_[_0x1f94('0x9')](_0x532dac,{'priority':'1'});var _0x2e4307=_[_0x1f94('0x9')](_0x532dac,{'isApp':0x1});var _0x5e47d3=_['groupBy'](_0x2e4307,_0x1f94('0x7'));var _0x556d6e=[_0x1f94('0xa'),'playback'];var _0x3a478c=[];var _0x56e591=[];for(var _0xa28d6f in _0x5e47d3){if(_0x5e47d3[_0x1f94('0xb')](_0xa28d6f)){_0x326e05[_0x1f94('0xc')]=0x2;_0x326e05['extensions']=[];_0x326e05[_0x1f94('0xd')]=_[_0x1f94('0xe')](_0x3244b5,{'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')]});_0x326e05['extensions'][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':util[_0x1f94('0x12')](_0x1f94('0x13'),_0x5e47d3[_0xa28d6f][0x0]['type']),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});if(_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')]==='inbound'){_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':'Set','appdata':_0x1f94('0x17')+_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')],'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});}else if(_0x5e47d3[_0xa28d6f][0x0]['type']===_0x1f94('0x18')){if(_0x326e05[_0x1f94('0xd')]){_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x19')+(_0x326e05[_0x1f94('0xd')][_0x1f94('0x1a')]?'${EXTEN:'+_0x326e05[_0x1f94('0xd')][_0x1f94('0x1a')]+'}':_0x1f94('0x1b')),'context':_0x5e47d3[_0xa28d6f][0x0]['context'],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});}_0x326e05['extensions']['push']({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':'CDR(routeid)='+_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')],'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});var _0x27ba63=_0x326e05['priority']++;_0x326e05['extensions'][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':'ExecIf','appdata':_0x1f94('0x1c')+(_0x27ba63+0x2)+'):Goto('+(_0x27ba63+0x1)+')','context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x27ba63,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});if(_0x326e05[_0x1f94('0xd')]){_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':_0x326e05[_0x1f94('0xd')][_0x1f94('0x1a')]?_0x1f94('0x1d')+_0x326e05[_0x1f94('0xd')][_0x1f94('0x1a')]+'}':_0x1f94('0x1e'),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});}_0x326e05[_0x1f94('0x16')]['push']({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x1f')+_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')],'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});if(_0x326e05['extension']&&_0x326e05[_0x1f94('0xd')][_0x1f94('0xb')]('recordingFormat')&&_0x326e05['extension'][_0x1f94('0x20')]!==_0x1f94('0x21')){_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0]['type'],'app':'Set','appdata':_0x1f94('0x22'),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05['priority']++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x23')+_0x326e05['extension'][_0x1f94('0x20')]||_0x1f94('0x24'),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});}}_0x326e05['extensions'][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0]['type'],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x25'),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05['priority']++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x26'),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0]['exten'],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x27'),'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'priority':_0x326e05[_0x1f94('0xc')]++,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});for(var _0x34bf03=0x0,_0x6a42c9=0x0;_0x34bf03<_0x5e47d3[_0xa28d6f]['length'];_0x34bf03+=0x1,_0x6a42c9=0x0){var _0x457fc8=_0x5e47d3[_0xa28d6f][_0x34bf03];if(_0x457fc8[_0x1f94('0x10')]){_0x457fc8[_0x1f94('0x10')]=_0x457fc8[_0x1f94('0x10')][_0x1f94('0x28')]();}var _0x5d1c7e=[];var _0x123518=[];delete _0x457fc8['id'];delete _0x457fc8[_0x1f94('0x29')];delete _0x457fc8[_0x1f94('0x2a')];var _0x43c2f4=_0x457fc8[_0x1f94('0x2b')]!==_0x1f94('0x2c')?[_0x457fc8['interval']]:_0x457fc8[_0x1f94('0x4')]?_[_0x1f94('0x6')](_['filter'](_0x326e05['intervals'],{'IntervalId':_0x457fc8[_0x1f94('0x4')]}),_0x1f94('0x2b')):[];if(_0x457fc8[_0x1f94('0xb')](_0x1f94('0x2d'))){if(_0x457fc8['tag']&&_0x457fc8[_0x1f94('0x2d')]!=='--'){_0x5d1c7e['push']({'type':_0x457fc8['type'],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x2e')+_0x457fc8[_0x1f94('0x2d')],'context':_0x457fc8[_0x1f94('0x14')],'exten':_0x457fc8[_0x1f94('0x7')],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05['priority']+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});}}if(_0x457fc8[_0x1f94('0x10')]===_0x1f94('0x18')&&_0x457fc8[_0x1f94('0xb')]('callerID')){if(_0x457fc8[_0x1f94('0x30')]){_0x5d1c7e[_0x1f94('0xf')]({'type':_0x457fc8[_0x1f94('0x10')],'app':_0x1f94('0x31'),'appdata':_0x1f94('0x32')+_0x457fc8[_0x1f94('0x30')]+')','context':_0x457fc8[_0x1f94('0x14')],'exten':_0x457fc8[_0x1f94('0x7')],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05[_0x1f94('0xc')]+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});}else{_0x5d1c7e[_0x1f94('0xf')]({'type':_0x457fc8[_0x1f94('0x10')],'app':_0x1f94('0x31'),'appdata':_0x1f94('0x33'),'context':_0x457fc8[_0x1f94('0x14')],'exten':_0x457fc8['exten'],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05['priority']+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});}}if(_0x457fc8['hasOwnProperty'](_0x1f94('0x34'))){if(_0x556d6e[_0x1f94('0x35')](_0x457fc8[_0x1f94('0x36')][_0x1f94('0x28')]())>=0x0&&_0x457fc8[_0x1f94('0x37')]!=='custom'){if(_0x457fc8[_0x1f94('0x34')]){_0x5d1c7e[_0x1f94('0xf')]({'type':_0x457fc8['type'],'app':_0x1f94('0x31'),'appdata':_0x1f94('0x38'),'context':_0x457fc8['context'],'exten':_0x457fc8[_0x1f94('0x7')],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05['priority']+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});_0x5d1c7e['push']({'type':_0x457fc8[_0x1f94('0x10')],'app':_0x1f94('0x11'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x457fc8[_0x1f94('0x14')],'exten':_0x457fc8['exten'],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05[_0x1f94('0xc')]+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});}else{_0x5d1c7e[_0x1f94('0xf')]({'type':_0x457fc8['type'],'app':_0x1f94('0x31'),'appdata':_0x1f94('0x39'),'context':_0x457fc8['context'],'exten':_0x457fc8['exten'],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05['priority']+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});_0x5d1c7e['push']({'type':_0x457fc8['type'],'app':_0x1f94('0x11'),'appdata':_0x1f94('0x3a'),'context':_0x457fc8[_0x1f94('0x14')],'exten':_0x457fc8[_0x1f94('0x7')],'priority':_0x43c2f4[_0x1f94('0x2f')]+_0x326e05['priority']+_0x6a42c9++,'VoiceExtensionId':_0x457fc8[_0x1f94('0x15')]});}}}for(var _0x42a1ad=0x0;_0x42a1ad<_0x43c2f4[_0x1f94('0x2f')];_0x42a1ad+=0x1){var _0x521832=_0x326e05[_0x1f94('0xc')]+_0x43c2f4[_0x1f94('0x2f')];var _0x334543=_0x42a1ad===_0x43c2f4['length']-0x1?_0x326e05[_0x1f94('0xc')]+_0x5d1c7e[_0x1f94('0x2f')]+_0x123518[_0x1f94('0x2f')]+0x2:_0x326e05['priority']+_0x42a1ad+0x1;_0x5d1c7e[_0x1f94('0x3b')](_0x42a1ad,0x0,{'type':_0x457fc8[_0x1f94('0x10')],'app':_0x1f94('0x3c'),'appdata':_0x43c2f4[_0x42a1ad]+'?'+_0x457fc8[_0x1f94('0x14')]+_0x1f94('0x3d')+_0x521832+':'+_0x457fc8['context']+_0x1f94('0x3d')+_0x334543,'exten':_0x457fc8[_0x1f94('0x7')],'context':_0x457fc8[_0x1f94('0x14')],'priority':_0x326e05['priority']+_0x42a1ad,'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]});}_0x457fc8[_0x1f94('0xc')]=_0x5d1c7e[_0x1f94('0x2f')]?_[_0x1f94('0x3e')](_0x5d1c7e)['priority']+0x1:_0x326e05[_0x1f94('0xc')];_0x326e05[_0x1f94('0xc')]=(_0x123518[_0x1f94('0x2f')]?_['last'](_0x123518)[_0x1f94('0xc')]:_0x457fc8[_0x1f94('0xc')])+0x1;_0x326e05['extensions']=_[_0x1f94('0x3f')](_0x326e05['extensions'],_0x5d1c7e,[_0x457fc8],_0x123518);}_0x326e05[_0x1f94('0x16')][_0x1f94('0xf')]({'type':_0x5e47d3[_0xa28d6f][0x0]['type'],'app':_0x1f94('0x40'),'exten':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x7')],'context':_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x14')],'priority':_0x326e05[_0x1f94('0xc')],'VoiceExtensionId':_0x5e47d3[_0xa28d6f][0x0]['VoiceExtensionId']});_0x3a478c[_0x1f94('0xf')](_0x5e47d3[_0xa28d6f][0x0][_0x1f94('0x15')]);_0x56e591=_[_0x1f94('0x3f')](_0x56e591,_0x326e05[_0x1f94('0x16')]);}}return _0x4f4d5a[_0x1f94('0x41')](function(_0x40fbb9){return _0x4f4d5a[_0x1f94('0x2')][_0x1f94('0x3')][_0x1f94('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x3a478c}},'transaction':_0x40fbb9})[_0x1f94('0x5')](function(_0x5a0b75){return _0x4f4d5a['models'][_0x1f94('0x3')][_0x1f94('0x43')](_[_0x1f94('0x44')](_0x56e591,_0x1f94('0xc')),{'transaction':_0x40fbb9});});});})[_0x1f94('0x45')](function(_0x366227){console[_0x1f94('0x46')](_0x366227);});}exports[_0x1f94('0x47')]=rewrite; \ No newline at end of file +var _0x54b6=['queue','extensions','extension','find','type','CDR(type)=%s','priority','VoiceExtensionId','inbound','Set','context','outbound','push','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','hasOwnProperty','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)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','length','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','then','bulkCreate','catch','error','rewrite','util','Interval','findAll','intervals','VoiceExtension','IntervalId','models','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy'];(function(_0x5cb430,_0xfc6ea7){var _0x7bbff6=function(_0x2bddcb){while(--_0x2bddcb){_0x5cb430['push'](_0x5cb430['shift']());}};_0x7bbff6(++_0xfc6ea7);}(_0x54b6,0x156));var _0x654b=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x54b6[_0x49c057];return _0xd8f0e6;};'use strict';var _=require('lodash');var util=require(_0x654b('0x0'));function rewrite(_0x4aa7f3,_0x2cfe10){var _0x3a6cb3=this;return _0x4aa7f3['models'][_0x654b('0x1')][_0x654b('0x2')]({'raw':!![]})['then'](function(_0x29d709){_0x3a6cb3[_0x654b('0x3')]=_0x29d709;return _0x4aa7f3['models'][_0x654b('0x4')]['findAll']({'where':{'IntervalId':_0x2cfe10[_0x654b('0x5')]},'raw':!![]});})['then'](function(_0x27a178){return _0x4aa7f3[_0x654b('0x6')][_0x654b('0x4')][_0x654b('0x2')]({'where':{'exten':{'$in':_[_0x654b('0x7')](_[_0x654b('0x8')](_0x27a178,_0x654b('0x9')))}},'order':[{'raw':_0x654b('0xa')}],'raw':!![]});})['then'](function(_0x226fb8){var _0x474a24=_[_0x654b('0xb')](_0x226fb8,{'priority':'1'});var _0x2c92b8=_[_0x654b('0xb')](_0x226fb8,{'isApp':0x1});var _0x3d45d3=_[_0x654b('0xc')](_0x2c92b8,'exten');var _0x2881c7=[_0x654b('0xd'),'playback'];var _0x486c6b=[];var _0x3932d1=[];for(var _0x544078 in _0x3d45d3){if(_0x3d45d3['hasOwnProperty'](_0x544078)){_0x3a6cb3['priority']=0x2;_0x3a6cb3[_0x654b('0xe')]=[];_0x3a6cb3[_0x654b('0xf')]=_[_0x654b('0x10')](_0x474a24,{'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')]});_0x3a6cb3['extensions']['push']({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':'Set','appdata':util['format'](_0x654b('0x12'),_0x3d45d3[_0x544078][0x0][_0x654b('0x11')]),'context':_0x3d45d3[_0x544078][0x0]['context'],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});if(_0x3d45d3[_0x544078][0x0][_0x654b('0x11')]===_0x654b('0x15')){_0x3a6cb3[_0x654b('0xe')]['push']({'type':_0x3d45d3[_0x544078][0x0]['type'],'app':_0x654b('0x16'),'appdata':'CDR(routeid)='+_0x3d45d3[_0x544078][0x0][_0x654b('0x14')],'context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0]['exten'],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});}else if(_0x3d45d3[_0x544078][0x0][_0x654b('0x11')]===_0x654b('0x18')){if(_0x3a6cb3['extension']){_0x3a6cb3[_0x654b('0xe')][_0x654b('0x19')]({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':_0x654b('0x16'),'appdata':'CDR(destination)='+(_0x3a6cb3[_0x654b('0xf')][_0x654b('0x1a')]?_0x654b('0x1b')+_0x3a6cb3[_0x654b('0xf')][_0x654b('0x1a')]+'}':'${EXTEN}'),'context':_0x3d45d3[_0x544078][0x0]['context'],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});}_0x3a6cb3[_0x654b('0xe')]['push']({'type':_0x3d45d3[_0x544078][0x0]['type'],'app':_0x654b('0x16'),'appdata':_0x654b('0x1c')+_0x3d45d3[_0x544078][0x0][_0x654b('0x14')],'context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});var _0x4bc7d2=_0x3a6cb3[_0x654b('0x13')]++;_0x3a6cb3[_0x654b('0xe')][_0x654b('0x19')]({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':_0x654b('0x1d'),'appdata':_0x654b('0x1e')+(_0x4bc7d2+0x2)+'):Goto('+(_0x4bc7d2+0x1)+')','context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x4bc7d2,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0]['VoiceExtensionId']});if(_0x3a6cb3[_0x654b('0xf')]){_0x3a6cb3['extensions']['push']({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':_0x654b('0x16'),'appdata':_0x3a6cb3[_0x654b('0xf')]['cutdigits']?_0x654b('0x1f')+_0x3a6cb3['extension'][_0x654b('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0]['exten'],'priority':_0x3a6cb3['priority']++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});}_0x3a6cb3[_0x654b('0xe')][_0x654b('0x19')]({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':'Set','appdata':_0x654b('0x20')+_0x3d45d3[_0x544078][0x0][_0x654b('0x14')],'context':_0x3d45d3[_0x544078][0x0]['context'],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});if(_0x3a6cb3[_0x654b('0xf')]&&_0x3a6cb3[_0x654b('0xf')]['hasOwnProperty'](_0x654b('0x21'))&&_0x3a6cb3[_0x654b('0xf')]['recordingFormat']!==_0x654b('0x22')){_0x3a6cb3[_0x654b('0xe')]['push']({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':_0x654b('0x16'),'appdata':_0x654b('0x23'),'context':_0x3d45d3[_0x544078][0x0]['context'],'exten':_0x3d45d3[_0x544078][0x0]['exten'],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});_0x3a6cb3[_0x654b('0xe')][_0x654b('0x19')]({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':'Set','appdata':_0x654b('0x24')+_0x3a6cb3[_0x654b('0xf')][_0x654b('0x21')]||'wav','context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0]['exten'],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});}}_0x3a6cb3[_0x654b('0xe')]['push']({'type':_0x3d45d3[_0x544078][0x0]['type'],'app':_0x654b('0x16'),'appdata':_0x654b('0x25'),'context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0]['exten'],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0]['VoiceExtensionId']});_0x3a6cb3['extensions'][_0x654b('0x19')]({'type':_0x3d45d3[_0x544078][0x0][_0x654b('0x11')],'app':'Set','appdata':_0x654b('0x26'),'context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x3a6cb3[_0x654b('0x13')]++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0]['VoiceExtensionId']});_0x3a6cb3[_0x654b('0xe')]['push']({'type':_0x3d45d3[_0x544078][0x0]['type'],'app':_0x654b('0x16'),'appdata':_0x654b('0x27'),'context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'priority':_0x3a6cb3['priority']++,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});for(var _0x445764=0x0,_0x54ea26=0x0;_0x445764<_0x3d45d3[_0x544078]['length'];_0x445764+=0x1,_0x54ea26=0x0){var _0x24de77=_0x3d45d3[_0x544078][_0x445764];if(_0x24de77[_0x654b('0x11')]){_0x24de77['type']=_0x24de77[_0x654b('0x11')][_0x654b('0x28')]();}var _0x22ecb2=[];var _0x4251be=[];delete _0x24de77['id'];delete _0x24de77[_0x654b('0x29')];delete _0x24de77[_0x654b('0x2a')];var _0x5f4272=_0x24de77[_0x654b('0x2b')]!==_0x654b('0x2c')?[_0x24de77['interval']]:_0x24de77[_0x654b('0x5')]?_[_0x654b('0x8')](_[_0x654b('0xb')](_0x3a6cb3[_0x654b('0x3')],{'IntervalId':_0x24de77[_0x654b('0x5')]}),'interval'):[];if(_0x24de77[_0x654b('0x2d')](_0x654b('0x2e'))){if(_0x24de77['tag']&&_0x24de77[_0x654b('0x2e')]!=='--'){_0x22ecb2[_0x654b('0x19')]({'type':_0x24de77[_0x654b('0x11')],'app':_0x654b('0x16'),'appdata':_0x654b('0x2f')+_0x24de77[_0x654b('0x2e')],'context':_0x24de77[_0x654b('0x17')],'exten':_0x24de77[_0x654b('0x9')],'priority':_0x5f4272['length']+_0x3a6cb3['priority']+_0x54ea26++,'VoiceExtensionId':_0x24de77['VoiceExtensionId']});}}if(_0x24de77[_0x654b('0x11')]==='outbound'&&_0x24de77[_0x654b('0x2d')](_0x654b('0x30'))){if(_0x24de77[_0x654b('0x30')]){_0x22ecb2[_0x654b('0x19')]({'type':_0x24de77['type'],'app':_0x654b('0x1d'),'appdata':_0x654b('0x31')+_0x24de77[_0x654b('0x30')]+')','context':_0x24de77[_0x654b('0x17')],'exten':_0x24de77[_0x654b('0x9')],'priority':_0x5f4272['length']+_0x3a6cb3[_0x654b('0x13')]+_0x54ea26++,'VoiceExtensionId':_0x24de77[_0x654b('0x14')]});}else{_0x22ecb2['push']({'type':_0x24de77[_0x654b('0x11')],'app':_0x654b('0x1d'),'appdata':_0x654b('0x32'),'context':_0x24de77[_0x654b('0x17')],'exten':_0x24de77[_0x654b('0x9')],'priority':_0x5f4272['length']+_0x3a6cb3[_0x654b('0x13')]+_0x54ea26++,'VoiceExtensionId':_0x24de77[_0x654b('0x14')]});}}if(_0x24de77[_0x654b('0x2d')]('answer')){if(_0x2881c7[_0x654b('0x33')](_0x24de77[_0x654b('0x34')][_0x654b('0x28')]())>=0x0&&_0x24de77[_0x654b('0x35')]!=='custom'){if(_0x24de77[_0x654b('0x36')]){_0x22ecb2[_0x654b('0x19')]({'type':_0x24de77[_0x654b('0x11')],'app':_0x654b('0x1d'),'appdata':_0x654b('0x37'),'context':_0x24de77[_0x654b('0x17')],'exten':_0x24de77[_0x654b('0x9')],'priority':_0x5f4272[_0x654b('0x38')]+_0x3a6cb3['priority']+_0x54ea26++,'VoiceExtensionId':_0x24de77[_0x654b('0x14')]});_0x22ecb2[_0x654b('0x19')]({'type':_0x24de77[_0x654b('0x11')],'app':_0x654b('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x24de77['context'],'exten':_0x24de77[_0x654b('0x9')],'priority':_0x5f4272[_0x654b('0x38')]+_0x3a6cb3['priority']+_0x54ea26++,'VoiceExtensionId':_0x24de77[_0x654b('0x14')]});}else{_0x22ecb2[_0x654b('0x19')]({'type':_0x24de77[_0x654b('0x11')],'app':_0x654b('0x1d'),'appdata':_0x654b('0x39'),'context':_0x24de77[_0x654b('0x17')],'exten':_0x24de77[_0x654b('0x9')],'priority':_0x5f4272[_0x654b('0x38')]+_0x3a6cb3[_0x654b('0x13')]+_0x54ea26++,'VoiceExtensionId':_0x24de77[_0x654b('0x14')]});_0x22ecb2[_0x654b('0x19')]({'type':_0x24de77[_0x654b('0x11')],'app':'Set','appdata':_0x654b('0x3a'),'context':_0x24de77[_0x654b('0x17')],'exten':_0x24de77['exten'],'priority':_0x5f4272[_0x654b('0x38')]+_0x3a6cb3['priority']+_0x54ea26++,'VoiceExtensionId':_0x24de77[_0x654b('0x14')]});}}}for(var _0x4429ad=0x0;_0x4429ad<_0x5f4272[_0x654b('0x38')];_0x4429ad+=0x1){var _0x556198=_0x3a6cb3[_0x654b('0x13')]+_0x5f4272[_0x654b('0x38')];var _0x22846c=_0x4429ad===_0x5f4272[_0x654b('0x38')]-0x1?_0x3a6cb3[_0x654b('0x13')]+_0x22ecb2[_0x654b('0x38')]+_0x4251be['length']+0x2:_0x3a6cb3[_0x654b('0x13')]+_0x4429ad+0x1;_0x22ecb2[_0x654b('0x3b')](_0x4429ad,0x0,{'type':_0x24de77[_0x654b('0x11')],'app':'GotoIfTime','appdata':_0x5f4272[_0x4429ad]+'?'+_0x24de77[_0x654b('0x17')]+_0x654b('0x3c')+_0x556198+':'+_0x24de77[_0x654b('0x17')]+_0x654b('0x3c')+_0x22846c,'exten':_0x24de77[_0x654b('0x9')],'context':_0x24de77[_0x654b('0x17')],'priority':_0x3a6cb3[_0x654b('0x13')]+_0x4429ad,'VoiceExtensionId':_0x3d45d3[_0x544078][0x0]['VoiceExtensionId']});}_0x24de77[_0x654b('0x13')]=_0x22ecb2[_0x654b('0x38')]?_[_0x654b('0x3d')](_0x22ecb2)[_0x654b('0x13')]+0x1:_0x3a6cb3[_0x654b('0x13')];_0x3a6cb3[_0x654b('0x13')]=(_0x4251be['length']?_[_0x654b('0x3d')](_0x4251be)[_0x654b('0x13')]:_0x24de77[_0x654b('0x13')])+0x1;_0x3a6cb3['extensions']=_[_0x654b('0x3e')](_0x3a6cb3['extensions'],_0x22ecb2,[_0x24de77],_0x4251be);}_0x3a6cb3[_0x654b('0xe')]['push']({'type':_0x3d45d3[_0x544078][0x0]['type'],'app':_0x654b('0x3f'),'exten':_0x3d45d3[_0x544078][0x0][_0x654b('0x9')],'context':_0x3d45d3[_0x544078][0x0][_0x654b('0x17')],'priority':_0x3a6cb3[_0x654b('0x13')],'VoiceExtensionId':_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]});_0x486c6b['push'](_0x3d45d3[_0x544078][0x0][_0x654b('0x14')]);_0x3932d1=_['concat'](_0x3932d1,_0x3a6cb3[_0x654b('0xe')]);}}return _0x4aa7f3[_0x654b('0x40')](function(_0xa20e3c){return _0x4aa7f3[_0x654b('0x6')][_0x654b('0x4')][_0x654b('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x486c6b}},'transaction':_0xa20e3c})[_0x654b('0x42')](function(_0x12e23a){return _0x4aa7f3[_0x654b('0x6')][_0x654b('0x4')][_0x654b('0x43')](_['sortBy'](_0x3932d1,_0x654b('0x13')),{'transaction':_0xa20e3c});});});})[_0x654b('0x44')](function(_0x2956dd){console[_0x654b('0x45')](_0x2956dd);});}exports[_0x654b('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 829b48d..0e86f86 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 _0xd686=['select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','push','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','keys','then','pick','stringify','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0xd686,0xa7));var _0x6d68=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xd686[_0x1203f];return _0x365f0a;};'use strict';var BPromise=require(_0x6d68('0x0'));var util=require(_0x6d68('0x1'));var _=require(_0x6d68('0x2'));var fs=require('fs');var squel=require(_0x6d68('0x3'));var Papa=require(_0x6d68('0x4'));var Redis=require(_0x6d68('0x5'));var db=require(_0x6d68('0x6'))['db'];var config=require(_0x6d68('0x7'));var logger=require(_0x6d68('0x8'))(_0x6d68('0x9'));config[_0x6d68('0xa')]=_[_0x6d68('0xb')](config['redis'],{'host':_0x6d68('0xc'),'port':0x18eb});var socket=require(_0x6d68('0xd'))(new Redis(config[_0x6d68('0xa')]));require(_0x6d68('0xe'))[_0x6d68('0xf')](socket);try{if(!process[_0x6d68('0x10')][0x2]||process[_0x6d68('0x10')][0x2]===_0x6d68('0x11')||process[_0x6d68('0x10')][0x2]==='null'){throw new Error(_0x6d68('0x12'));}var FILEPATH=process[_0x6d68('0x10')][0x2];if(!process[_0x6d68('0x10')][0x3]||process['argv'][0x3]===_0x6d68('0x11')||process['argv'][0x3]===_0x6d68('0x13')||!process[_0x6d68('0x10')][0x4]||process[_0x6d68('0x10')][0x4]==='undefined'||process[_0x6d68('0x10')][0x4]==='null'){throw new Error(_0x6d68('0x14'));}var FIELDS=_[_0x6d68('0x15')](process[_0x6d68('0x10')][0x3][_0x6d68('0x16')](','),process[_0x6d68('0x10')][0x4][_0x6d68('0x16')](','));if(!process[_0x6d68('0x10')][0x5]||process[_0x6d68('0x10')][0x5]===_0x6d68('0x11')||process[_0x6d68('0x10')][0x5]==='null'){throw new Error(_0x6d68('0x17'));}var LISTID=process[_0x6d68('0x10')][0x5];var COMPANYID=process[_0x6d68('0x10')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x6d68('0x10')][0x6]!==_0x6d68('0x13')?process[_0x6d68('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6d68('0x10')][0x7]!==_0x6d68('0x11')&&process[_0x6d68('0x10')][0x7]!==_0x6d68('0x13')?process[_0x6d68('0x10')][0x7]:null;if(!process[_0x6d68('0x10')][0x8]||process[_0x6d68('0x10')][0x8]===_0x6d68('0x11')||process[_0x6d68('0x10')][0x8]===_0x6d68('0x13')){throw new Error(_0x6d68('0x18'));}var SOCKET_TIMESTAMP=process[_0x6d68('0x10')][0x8];}catch(_0x2a5633){logger['error'](_0x2a5633);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(_0x3a0c23,_0x3e394e,_0x126e90,_0x2f4cf0){var _0x1f4dd8={'message':_0x3e394e};_0x1f4dd8[_0x3a0c23]=!![];if(_0x126e90){_0x1f4dd8['contact']=_0x126e90;}if(_0x2f4cf0){_0x1f4dd8[_0x6d68('0x19')]=_0x2f4cf0;}return _0x1f4dd8;}function isEmail(_0x243130){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))*$/[_0x6d68('0x1a')](_0x243130);}function checkRow(_0x1b9a5e,_0x6a3c3c,_0x5cec82){return new BPromise(function(_0x353a5a,_0x1e114a){if(_[_0x6d68('0x1b')](_0x1b9a5e)){return _0x1e114a(handleCheckRowError(_0x6d68('0x1c'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x5cec82));}if(_0x1b9a5e[_0x6d68('0x1d')]&&_0x1b9a5e[_0x6d68('0x1d')][_0x6d68('0x1e')]){var _0x5d4dee=_[_0x6d68('0x1f')](_0x1b9a5e['errors'],_0x6d68('0x20'))[_0x6d68('0x21')](';');return _0x1e114a(handleCheckRowError(_0x6d68('0x1c'),_0x5d4dee,null,_0x5cec82));}var _0x81d711={};for(var _0x17b169 in FIELDS){if(FIELDS[_0x6d68('0x22')](_0x17b169)&&FIELDS[_0x17b169]){_0x81d711[_0x17b169]=_0x1b9a5e[_0x6d68('0x23')][0x0][FIELDS[_0x17b169]]||_0x1b9a5e[_0x6d68('0x23')][0x0]['\ufeff'+FIELDS[_0x17b169]];}}if(!_0x81d711[_0x6d68('0x24')]){return _0x1e114a(handleCheckRowError(_0x6d68('0x1c'),_0x6d68('0x25'),null,_0x5cec82));}if(!_0x81d711[_0x6d68('0x26')]){return _0x1e114a(handleCheckRowError(_0x6d68('0x1c'),_0x6d68('0x27'),null,_0x5cec82));}if(_0x81d711[_0x6d68('0x28')]){var _0x2357b3=moment(_0x81d711[_0x6d68('0x28')],_0x6d68('0x29'));if(!_0x2357b3[_0x6d68('0x2a')]()){return _0x1e114a(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5cec82));}}if(_0x81d711[_0x6d68('0x2b')]){if(!isEmail(_0x81d711[_0x6d68('0x2b')])){return _0x1e114a(handleCheckRowError('error',_0x6d68('0x2c'),null,_0x5cec82));}}_0x81d711[_0x6d68('0x2d')]=LISTID;_0x81d711[_0x6d68('0x2e')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6d68('0x1e')]&&_0x6a3c3c){var _0x520331={};for(var _0x45edb4=0x0,_0x53b37c=DUPLICATES[_0x6d68('0x1e')];_0x45edb4<_0x53b37c;_0x45edb4+=0x1){_0x520331[DUPLICATES[_0x45edb4]]=_0x81d711[DUPLICATES[_0x45edb4]];}var _0xa7640e=_[_0x6d68('0x2f')](_0x6a3c3c,_0x520331);if(_0xa7640e){return _0x1e114a(handleCheckRowError('duplicate',_0x6d68('0x30'),_0xa7640e,_0x5cec82));}}return db[_0x6d68('0x31')]['create'](_0x81d711,{'raw':!![],'hooks':![],'fields':_[_0x6d68('0x32')](_0x81d711)})[_0x6d68('0x33')](function(_0x31343a){if(DUPLICATES&&DUPLICATES[_0x6d68('0x1e')]&&_0x6a3c3c){_0x6a3c3c['push'](_[_0x6d68('0x34')](_0x81d711,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x31343a['id'];return _0x353a5a();})['catch'](function(_0x2224ef){return _0x1e114a(handleCheckRowError(_0x6d68('0x1c'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2224ef[_0x6d68('0x20')]||JSON[_0x6d68('0x35')](_0x2224ef)),null,_0x5cec82));});});}function checkHopper(){function _0x3fb6ff(){return function(_0x2e8b28){logger[_0x6d68('0x1c')](_0x6d68('0x36'),_0x6d68('0x37'),util['inspect'](_0x2e8b28,{'showHidden':![],'depth':null}));};}var _0x314f95=function(_0x169277,_0x1472eb){var _0x527dea=squel[_0x6d68('0x38')]()['into'](_0x6d68('0x39'))[_0x6d68('0x3a')]([_0x6d68('0x26'),_0x6d68('0x3b'),_0x6d68('0x3c'),'ListId',_0x1472eb,_0x6d68('0x3d'),_0x6d68('0x3e')],squel[_0x6d68('0x3f')]()[_0x6d68('0x40')](_0x6d68('0x26'),_0x6d68('0x26'))[_0x6d68('0x40')](_0x6d68('0x41'),_0x6d68('0x3b'))['field']('id',_0x6d68('0x3c'))[_0x6d68('0x40')](LISTID[_0x6d68('0x42')](),_0x6d68('0x2d'))[_0x6d68('0x40')](_0x169277['id'][_0x6d68('0x42')](),_0x1472eb)[_0x6d68('0x40')]('NOW()',_0x6d68('0x3d'))['field'](_0x6d68('0x41'),'updatedAt')['from'](_0x6d68('0x43'))[_0x6d68('0x44')](_0x6d68('0x45'))['where'](_0x6d68('0x46'),LISTID[_0x6d68('0x42')]())[_0x6d68('0x44')](_0x6d68('0x47'))[_0x6d68('0x44')](_0x6d68('0x48'),squel[_0x6d68('0x3f')]()['field'](_0x6d68('0x26'))[_0x6d68('0x49')](_0x6d68('0x39'))[_0x6d68('0x44')](_0x1472eb+_0x6d68('0x4a'),_0x169277['id']['toString']())))['toString']();return _0x527dea;};var _0x1aef35=function(_0x220769,_0x2eb759){var _0x698c5b=squel['insert']()[_0x6d68('0x4b')](_0x6d68('0x39'))[_0x6d68('0x3a')]([_0x6d68('0x26'),_0x6d68('0x3b'),_0x6d68('0x3c'),_0x6d68('0x2d'),_0x2eb759,_0x6d68('0x3d'),'updatedAt'],squel[_0x6d68('0x3f')]()[_0x6d68('0x40')](_0x6d68('0x26'),_0x6d68('0x26'))[_0x6d68('0x40')](_0x6d68('0x41'),_0x6d68('0x3b'))['field']('id',_0x6d68('0x3c'))[_0x6d68('0x40')](LISTID['toString'](),_0x6d68('0x2d'))[_0x6d68('0x40')](_0x220769['id'][_0x6d68('0x42')](),_0x2eb759)[_0x6d68('0x40')]('NOW()','createdAt')['field'](_0x6d68('0x41'),'updatedAt')[_0x6d68('0x49')]('cm_contacts')['where'](_0x6d68('0x45'))[_0x6d68('0x44')](_0x6d68('0x46'),LISTID['toString']())[_0x6d68('0x44')](_0x6d68('0x4c'),squel[_0x6d68('0x4d')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x6d68('0x48'),squel[_0x6d68('0x3f')]()[_0x6d68('0x40')]('calleridnum')[_0x6d68('0x49')](_0x6d68('0x4e'))[_0x6d68('0x44')](_0x2eb759+_0x6d68('0x4a'),_0x220769['id'][_0x6d68('0x42')]()))['where'](_0x6d68('0x48'),squel[_0x6d68('0x3f')]()[_0x6d68('0x40')](_0x6d68('0x26'))[_0x6d68('0x49')](_0x6d68('0x39'))['where'](_0x2eb759+'\x20=\x20?',_0x220769['id'][_0x6d68('0x42')]())))[_0x6d68('0x42')]();return _0x698c5b;};function _0x3d5c50(_0x3ec77c,_0x485111){var _0x428a99=squel[_0x6d68('0x38')]()[_0x6d68('0x4b')]('cm_hopper')['fromQuery']([_0x6d68('0x26'),_0x6d68('0x3b'),_0x6d68('0x3c'),_0x6d68('0x2d'),_0x485111,_0x6d68('0x3d'),_0x6d68('0x3e')],squel[_0x6d68('0x3f')]()['field'](_0x6d68('0x26'),_0x6d68('0x26'))[_0x6d68('0x40')](_0x6d68('0x41'),'scheduledAt')[_0x6d68('0x40')]('id',_0x6d68('0x3c'))['field'](LISTID[_0x6d68('0x42')](),'ListId')[_0x6d68('0x40')](_0x3ec77c['id'][_0x6d68('0x42')](),_0x485111)[_0x6d68('0x40')](_0x6d68('0x41'),_0x6d68('0x3d'))[_0x6d68('0x40')](_0x6d68('0x41'),'updatedAt')[_0x6d68('0x49')]('cm_contacts')[_0x6d68('0x44')]('deletedAt\x20IS\x20NULL')[_0x6d68('0x44')]('ListId\x20=\x20?',LISTID[_0x6d68('0x42')]())[_0x6d68('0x44')](_0x6d68('0x4c'),squel[_0x6d68('0x4d')](hopperContacts))[_0x6d68('0x44')](_0x6d68('0x47')))[_0x6d68('0x42')]();return _0x428a99;}function _0x1ac40b(_0x4ccaef,_0x5a95d4){var _0x2e1dd2=squel[_0x6d68('0x38')]()[_0x6d68('0x4b')](_0x6d68('0x4f'))[_0x6d68('0x3a')](['phone',_0x6d68('0x3c'),_0x6d68('0x2d'),_0x5a95d4,'createdAt','updatedAt'],squel[_0x6d68('0x3f')]()[_0x6d68('0x40')](_0x6d68('0x26'),'phone')[_0x6d68('0x40')]('id',_0x6d68('0x3c'))['field'](LISTID[_0x6d68('0x42')](),_0x6d68('0x2d'))['field'](_0x4ccaef['id'][_0x6d68('0x42')](),_0x5a95d4)[_0x6d68('0x40')](_0x6d68('0x41'),'createdAt')['field']('NOW()',_0x6d68('0x3e'))[_0x6d68('0x49')](_0x6d68('0x43'))[_0x6d68('0x44')](_0x6d68('0x45'))['where'](_0x6d68('0x46'),LISTID[_0x6d68('0x42')]())[_0x6d68('0x44')](_0x6d68('0x4c'),squel[_0x6d68('0x4d')](hopperContacts))['where'](_0x6d68('0x47')))[_0x6d68('0x42')]();return _0x2e1dd2;}return db[_0x6d68('0x50')][_0x6d68('0x51')]({'where':{'type':_0x6d68('0x52')},'attributes':['id',_0x6d68('0x53')],'include':[{'model':db[_0x6d68('0x54')],'as':_0x6d68('0x55'),'where':{'id':LISTID}}]})[_0x6d68('0x33')](function(_0x5acaf6){var _0x1d5ab2=[];if(_0x5acaf6){var _0x3a861e;for(var _0x472d8c=0x0,_0x551c1a;_0x472d8c<_0x5acaf6[_0x6d68('0x1e')];_0x472d8c+=0x1){_0x551c1a=_0x5acaf6[_0x472d8c][_0x6d68('0x56')]({'plain':!![]});switch(_0x551c1a[_0x6d68('0x53')]){case'always':_0x1d5ab2[_0x6d68('0x57')](db['sequelize'][_0x6d68('0x58')](_0x1aef35(_0x551c1a,_0x6d68('0x59')))['then'](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));break;case _0x6d68('0x5b'):_0x1d5ab2[_0x6d68('0x57')](db[_0x6d68('0x5c')]['query'](_0x314f95(_0x551c1a,_0x6d68('0x59')))[_0x6d68('0x33')](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));break;default:_0x1d5ab2[_0x6d68('0x57')](db[_0x6d68('0x5c')]['query'](_0x3d5c50(_0x551c1a,_0x6d68('0x59')))[_0x6d68('0x33')](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));}}}return _0x1d5ab2;})['all']()[_0x6d68('0x33')](function(){return db[_0x6d68('0x50')][_0x6d68('0x51')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x6d68('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6d68('0x33')](function(_0x1a75a7){var _0x327de4=[];if(_0x1a75a7){var _0x55ad1b;for(var _0x3e791e=0x0,_0x4aee3b;_0x3e791e<_0x1a75a7[_0x6d68('0x1e')];_0x3e791e+=0x1){_0x4aee3b=_0x1a75a7[_0x3e791e][_0x6d68('0x56')]({'plain':!![]});_0x327de4[_0x6d68('0x57')](db[_0x6d68('0x5c')]['query'](_0x1ac40b(_0x4aee3b,_0x6d68('0x59')))['then'](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));}}return _0x327de4;})[_0x6d68('0x5d')]();})['then'](function(){return db['Campaign'][_0x6d68('0x51')]({'attributes':['id',_0x6d68('0x53')],'include':[{'model':db[_0x6d68('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6d68('0x33')](function(_0x1f6fd9){var _0x142bbd=[];if(_0x1f6fd9){for(var _0xc678d1=0x0,_0x24fe45;_0xc678d1<_0x1f6fd9[_0x6d68('0x1e')];_0xc678d1+=0x1){_0x24fe45=_0x1f6fd9[_0xc678d1][_0x6d68('0x56')]({'plain':!![]});switch(_0x24fe45[_0x6d68('0x53')]){case'always':_0x142bbd[_0x6d68('0x57')](db[_0x6d68('0x5c')][_0x6d68('0x58')](_0x1aef35(_0x24fe45,_0x6d68('0x5e')))['then'](function(){})['catch'](_0x3fb6ff()));break;case'onlyIfOpen':_0x142bbd['push'](db[_0x6d68('0x5c')][_0x6d68('0x58')](_0x314f95(_0x24fe45,'CampaignId'))[_0x6d68('0x33')](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));break;default:_0x142bbd[_0x6d68('0x57')](db[_0x6d68('0x5c')]['query'](_0x3d5c50(_0x24fe45,_0x6d68('0x5e')))['then'](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));}}}return _0x142bbd;})[_0x6d68('0x5d')]();})[_0x6d68('0x33')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x6d68('0x54')],'as':_0x6d68('0x5f'),'where':{'id':LISTID}}]})[_0x6d68('0x33')](function(_0x5de99c){var _0x1afb69=[];if(_0x5de99c){for(var _0x5084b1=0x0,_0x27e990;_0x5084b1<_0x5de99c[_0x6d68('0x1e')];_0x5084b1+=0x1){_0x27e990=_0x5de99c[_0x5084b1][_0x6d68('0x56')]({'plain':!![]});_0x1afb69[_0x6d68('0x57')](db[_0x6d68('0x5c')]['query'](_0x1ac40b(_0x27e990,'CampaignId'))[_0x6d68('0x33')](function(){})[_0x6d68('0x5a')](_0x3fb6ff()));}}return _0x1afb69;})[_0x6d68('0x5d')]();})[_0x6d68('0x5a')](function(_0x233eb0){logger['error'](_0x6d68('0x60'),_0x6d68('0x61'),_0x233eb0[_0x6d68('0x20')]);});}var processPromises=function(_0x45898b){return BPromise['all'](promises)[_0x6d68('0x33')](function(_0x433ca2){})[_0x6d68('0x5a')](function(_0x35438f){logger[_0x6d68('0x1c')](_0x6d68('0x62'),JSON[_0x6d68('0x35')](_0x35438f));})['finally'](function(){socket[_0x6d68('0x63')](_0x6d68('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x45898b){return _0x45898b[_0x6d68('0x65')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x6d68('0x33')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x6d68('0x63')](_0x6d68('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6d68('0x66')](FILEPATH);}catch(_0x31f082){logger[_0x6d68('0x1c')](_0x6d68('0x67'),JSON[_0x6d68('0x35')](_0x31f082));}finally{process[_0x6d68('0x68')](0x0);}});};process['on'](_0x6d68('0x69'),function(){logger[_0x6d68('0x6a')](_0x6d68('0x6b'));endCsv();});function main(){return BPromise[_0x6d68('0x6c')]()[_0x6d68('0x33')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6d68('0x16')](',');return db[_0x6d68('0x31')][_0x6d68('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6d68('0x33')](function(_0x52d932){var _0x563512=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6d68('0x6d')](_0x563512,{'header':!![],'skipEmptyLines':!![],'step':function(_0x531622,_0x22758c){total+=0x1;var _0x13d945=total;promises[_0x6d68('0x57')](checkRow(_0x531622,_0x52d932,_0x13d945)[_0x6d68('0x33')](function(){success+=0x1;})['catch'](function(_0x6b4e24){if(_0x6b4e24[_0x6d68('0x1c')]){errors+=0x1;delete _0x6b4e24['error'];}else if(_0x6b4e24[_0x6d68('0x6e')]){duplicates+=0x1;delete _0x6b4e24['duplicate'];}rows[_0x6d68('0x57')](_0x6b4e24);}));if(total%0xc8===0x0){_0x22758c[_0x6d68('0x6f')]();return processPromises(_0x22758c);}},'complete':function(){return processPromises()[_0x6d68('0x33')](function(){logger[_0x6d68('0x6a')](_0x6d68('0x70'));endCsv();});},'error':function(_0x44e0d4,_0x574512){logger[_0x6d68('0x6a')](_0x6d68('0x71'),JSON['stringify'](_0x44e0d4));endCsv();}});})[_0x6d68('0x5a')](function(_0x4d21d6){logger[_0x6d68('0x1c')](_0x6d68('0x72'),JSON['stringify'](_0x4d21d6));});}main(); \ No newline at end of file +var _0x71c1=['hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','from','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','VoiceQueueId','query','all','Campaign','findAll','Lists','CampaignId','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','finally','contact:csv_','resume','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','resolve','createReadStream','parse','pause','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join'];(function(_0x166216,_0x4c3d22){var _0x19fbf9=function(_0x4fa582){while(--_0x4fa582){_0x166216['push'](_0x166216['shift']());}};_0x19fbf9(++_0x4c3d22);}(_0x71c1,0x133));var _0x171c=function(_0x507cad,_0xe4b334){_0x507cad=_0x507cad-0x0;var _0x1beaa1=_0x71c1[_0x507cad];return _0x1beaa1;};'use strict';var BPromise=require(_0x171c('0x0'));var util=require(_0x171c('0x1'));var _=require(_0x171c('0x2'));var fs=require('fs');var squel=require(_0x171c('0x3'));var Papa=require(_0x171c('0x4'));var Redis=require(_0x171c('0x5'));var db=require(_0x171c('0x6'))['db'];var config=require(_0x171c('0x7'));var logger=require(_0x171c('0x8'))(_0x171c('0x9'));config[_0x171c('0xa')]=_[_0x171c('0xb')](config[_0x171c('0xa')],{'host':_0x171c('0xc'),'port':0x18eb});var socket=require(_0x171c('0xd'))(new Redis(config[_0x171c('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x171c('0xe')](socket);try{if(!process[_0x171c('0xf')][0x2]||process[_0x171c('0xf')][0x2]===_0x171c('0x10')||process[_0x171c('0xf')][0x2]===_0x171c('0x11')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x171c('0xf')][0x2];if(!process[_0x171c('0xf')][0x3]||process[_0x171c('0xf')][0x3]===_0x171c('0x10')||process[_0x171c('0xf')][0x3]===_0x171c('0x11')||!process[_0x171c('0xf')][0x4]||process[_0x171c('0xf')][0x4]==='undefined'||process[_0x171c('0xf')][0x4]===_0x171c('0x11')){throw new Error(_0x171c('0x12'));}var FIELDS=_[_0x171c('0x13')](process[_0x171c('0xf')][0x3]['split'](','),process[_0x171c('0xf')][0x4][_0x171c('0x14')](','));if(!process[_0x171c('0xf')][0x5]||process[_0x171c('0xf')][0x5]===_0x171c('0x10')||process[_0x171c('0xf')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x171c('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x171c('0x10')&&process[_0x171c('0xf')][0x6]!=='null'?process[_0x171c('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x171c('0xf')][0x7]!==_0x171c('0x10')&&process[_0x171c('0xf')][0x7]!==_0x171c('0x11')?process[_0x171c('0xf')][0x7]:null;if(!process[_0x171c('0xf')][0x8]||process[_0x171c('0xf')][0x8]===_0x171c('0x10')||process[_0x171c('0xf')][0x8]===_0x171c('0x11')){throw new Error(_0x171c('0x15'));}var SOCKET_TIMESTAMP=process[_0x171c('0xf')][0x8];}catch(_0x391f0d){logger[_0x171c('0x16')](_0x391f0d);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(_0x586b1d,_0x4ed3f7,_0x5b8b7d,_0x16f42e){var _0x5f10bd={'message':_0x4ed3f7};_0x5f10bd[_0x586b1d]=!![];if(_0x5b8b7d){_0x5f10bd[_0x171c('0x17')]=_0x5b8b7d;}if(_0x16f42e){_0x5f10bd[_0x171c('0x18')]=_0x16f42e;}return _0x5f10bd;}function isEmail(_0x4c1a21){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))*$/[_0x171c('0x19')](_0x4c1a21);}function checkRow(_0x325ab2,_0x4c0970,_0x2b3f9a){return new BPromise(function(_0x398e67,_0x23af69){if(_[_0x171c('0x1a')](_0x325ab2)){return _0x23af69(handleCheckRowError('error',_0x171c('0x1b'),null,_0x2b3f9a));}if(_0x325ab2['errors']&&_0x325ab2[_0x171c('0x1c')][_0x171c('0x1d')]){var _0x3867af=_[_0x171c('0x1e')](_0x325ab2[_0x171c('0x1c')],'message')[_0x171c('0x1f')](';');return _0x23af69(handleCheckRowError(_0x171c('0x16'),_0x3867af,null,_0x2b3f9a));}var _0x2f76a8={};for(var _0x7c9f9d in FIELDS){if(FIELDS[_0x171c('0x20')](_0x7c9f9d)&&FIELDS[_0x7c9f9d]){_0x2f76a8[_0x7c9f9d]=_0x325ab2['data'][0x0][FIELDS[_0x7c9f9d]]||_0x325ab2[_0x171c('0x21')][0x0]['\ufeff'+FIELDS[_0x7c9f9d]];}}if(!_0x2f76a8[_0x171c('0x22')]){return _0x23af69(handleCheckRowError(_0x171c('0x16'),_0x171c('0x23'),null,_0x2b3f9a));}if(!_0x2f76a8[_0x171c('0x24')]){return _0x23af69(handleCheckRowError(_0x171c('0x16'),_0x171c('0x25'),null,_0x2b3f9a));}if(_0x2f76a8[_0x171c('0x26')]){var _0x4d7312=moment(_0x2f76a8['birthDate'],_0x171c('0x27'));if(!_0x4d7312[_0x171c('0x28')]()){return _0x23af69(handleCheckRowError(_0x171c('0x16'),_0x171c('0x29'),null,_0x2b3f9a));}}if(_0x2f76a8[_0x171c('0x2a')]){if(!isEmail(_0x2f76a8[_0x171c('0x2a')])){return _0x23af69(handleCheckRowError(_0x171c('0x16'),_0x171c('0x2b'),null,_0x2b3f9a));}}_0x2f76a8[_0x171c('0x2c')]=LISTID;_0x2f76a8[_0x171c('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4c0970){var _0x35e951={};for(var _0x4e2fa8=0x0,_0x56cc22=DUPLICATES[_0x171c('0x1d')];_0x4e2fa8<_0x56cc22;_0x4e2fa8+=0x1){_0x35e951[DUPLICATES[_0x4e2fa8]]=_0x2f76a8[DUPLICATES[_0x4e2fa8]];}var _0x2e014d=_[_0x171c('0x2e')](_0x4c0970,_0x35e951);if(_0x2e014d){return _0x23af69(handleCheckRowError(_0x171c('0x2f'),_0x171c('0x30'),_0x2e014d,_0x2b3f9a));}}return db[_0x171c('0x31')][_0x171c('0x32')](_0x2f76a8,{'raw':!![],'hooks':![],'fields':_[_0x171c('0x33')](_0x2f76a8)})[_0x171c('0x34')](function(_0x4d59c9){if(DUPLICATES&&DUPLICATES[_0x171c('0x1d')]&&_0x4c0970){_0x4c0970[_0x171c('0x35')](_[_0x171c('0x36')](_0x2f76a8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4d59c9['id'];return _0x398e67();})[_0x171c('0x37')](function(_0x4de98a){return _0x23af69(handleCheckRowError(_0x171c('0x16'),_0x171c('0x38')+(_0x4de98a[_0x171c('0x39')]||JSON[_0x171c('0x3a')](_0x4de98a)),null,_0x2b3f9a));});});}function checkHopper(){function _0x3ea6ba(){return function(_0x3108c9){logger[_0x171c('0x16')]('cmContact','checkHopper',util[_0x171c('0x3b')](_0x3108c9,{'showHidden':![],'depth':null}));};}var _0x274143=function(_0x2265ca,_0x1c7bd8){var _0x1466ef=squel['insert']()[_0x171c('0x3c')](_0x171c('0x3d'))['fromQuery']([_0x171c('0x24'),_0x171c('0x3e'),_0x171c('0x3f'),_0x171c('0x2c'),_0x1c7bd8,_0x171c('0x40'),'updatedAt'],squel[_0x171c('0x41')]()[_0x171c('0x42')]('phone','phone')[_0x171c('0x42')](_0x171c('0x43'),'scheduledAt')[_0x171c('0x42')]('id',_0x171c('0x3f'))[_0x171c('0x42')](LISTID[_0x171c('0x44')](),_0x171c('0x2c'))['field'](_0x2265ca['id'][_0x171c('0x44')](),_0x1c7bd8)[_0x171c('0x42')](_0x171c('0x43'),_0x171c('0x40'))[_0x171c('0x42')](_0x171c('0x43'),_0x171c('0x45'))[_0x171c('0x46')]('cm_contacts')[_0x171c('0x47')](_0x171c('0x48'))['where']('ListId\x20=\x20?',LISTID[_0x171c('0x44')]())[_0x171c('0x47')](_0x171c('0x49'))[_0x171c('0x47')](_0x171c('0x4a'),squel[_0x171c('0x41')]()[_0x171c('0x42')]('phone')['from']('cm_hopper')[_0x171c('0x47')](_0x1c7bd8+_0x171c('0x4b'),_0x2265ca['id'][_0x171c('0x44')]())))[_0x171c('0x44')]();return _0x1466ef;};var _0x29c7fc=function(_0x5ef334,_0x11704f){var _0x303978=squel['insert']()[_0x171c('0x3c')](_0x171c('0x3d'))[_0x171c('0x4c')]([_0x171c('0x24'),'scheduledAt',_0x171c('0x3f'),_0x171c('0x2c'),_0x11704f,_0x171c('0x40'),_0x171c('0x45')],squel['select']()[_0x171c('0x42')](_0x171c('0x24'),_0x171c('0x24'))['field'](_0x171c('0x43'),_0x171c('0x3e'))[_0x171c('0x42')]('id',_0x171c('0x3f'))[_0x171c('0x42')](LISTID['toString'](),_0x171c('0x2c'))[_0x171c('0x42')](_0x5ef334['id']['toString'](),_0x11704f)[_0x171c('0x42')](_0x171c('0x43'),_0x171c('0x40'))['field']('NOW()',_0x171c('0x45'))[_0x171c('0x46')](_0x171c('0x4d'))[_0x171c('0x47')]('deletedAt\x20IS\x20NULL')[_0x171c('0x47')](_0x171c('0x4e'),LISTID[_0x171c('0x44')]())[_0x171c('0x47')](_0x171c('0x4f'),squel['str'](hopperContacts))['where'](_0x171c('0x49'))[_0x171c('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x171c('0x41')]()[_0x171c('0x42')](_0x171c('0x50'))[_0x171c('0x46')](_0x171c('0x51'))['where'](_0x11704f+_0x171c('0x4b'),_0x5ef334['id'][_0x171c('0x44')]()))[_0x171c('0x47')](_0x171c('0x4a'),squel['select']()[_0x171c('0x42')](_0x171c('0x24'))[_0x171c('0x46')]('cm_hopper')[_0x171c('0x47')](_0x11704f+_0x171c('0x4b'),_0x5ef334['id'][_0x171c('0x44')]())))[_0x171c('0x44')]();return _0x303978;};function _0x5c3786(_0x5c9343,_0x12c71d){var _0x3d3a51=squel[_0x171c('0x52')]()[_0x171c('0x3c')]('cm_hopper')[_0x171c('0x4c')]([_0x171c('0x24'),_0x171c('0x3e'),_0x171c('0x3f'),_0x171c('0x2c'),_0x12c71d,_0x171c('0x40'),'updatedAt'],squel['select']()[_0x171c('0x42')](_0x171c('0x24'),_0x171c('0x24'))[_0x171c('0x42')](_0x171c('0x43'),_0x171c('0x3e'))[_0x171c('0x42')]('id','ContactId')[_0x171c('0x42')](LISTID['toString'](),_0x171c('0x2c'))[_0x171c('0x42')](_0x5c9343['id'][_0x171c('0x44')](),_0x12c71d)['field']('NOW()',_0x171c('0x40'))['field'](_0x171c('0x43'),'updatedAt')['from'](_0x171c('0x4d'))['where'](_0x171c('0x48'))[_0x171c('0x47')](_0x171c('0x4e'),LISTID[_0x171c('0x44')]())[_0x171c('0x47')](_0x171c('0x4f'),squel['str'](hopperContacts))[_0x171c('0x47')](_0x171c('0x49')))[_0x171c('0x44')]();return _0x3d3a51;}function _0x273dfd(_0x21e205,_0xf4b089){var _0x4a2f13=squel[_0x171c('0x52')]()[_0x171c('0x3c')](_0x171c('0x53'))[_0x171c('0x4c')]([_0x171c('0x24'),_0x171c('0x3f'),_0x171c('0x2c'),_0xf4b089,_0x171c('0x40'),_0x171c('0x45')],squel[_0x171c('0x41')]()['field'](_0x171c('0x24'),_0x171c('0x24'))[_0x171c('0x42')]('id',_0x171c('0x3f'))[_0x171c('0x42')](LISTID['toString'](),'ListId')[_0x171c('0x42')](_0x21e205['id'][_0x171c('0x44')](),_0xf4b089)[_0x171c('0x42')]('NOW()','createdAt')['field'](_0x171c('0x43'),'updatedAt')[_0x171c('0x46')](_0x171c('0x4d'))['where'](_0x171c('0x48'))[_0x171c('0x47')]('ListId\x20=\x20?',LISTID[_0x171c('0x44')]())[_0x171c('0x47')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x171c('0x47')](_0x171c('0x49')))[_0x171c('0x44')]();return _0x4a2f13;}return db[_0x171c('0x54')]['findAll']({'where':{'type':_0x171c('0x55')},'attributes':['id',_0x171c('0x56')],'include':[{'model':db[_0x171c('0x57')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x3731de){var _0x397cb2=[];if(_0x3731de){var _0x43e846;for(var _0x842224=0x0,_0x4c3d62;_0x842224<_0x3731de[_0x171c('0x1d')];_0x842224+=0x1){_0x4c3d62=_0x3731de[_0x842224][_0x171c('0x58')]({'plain':!![]});switch(_0x4c3d62[_0x171c('0x56')]){case _0x171c('0x59'):_0x397cb2[_0x171c('0x35')](db[_0x171c('0x5a')]['query'](_0x29c7fc(_0x4c3d62,_0x171c('0x5b')))[_0x171c('0x34')](function(){})[_0x171c('0x37')](_0x3ea6ba()));break;case'onlyIfOpen':_0x397cb2[_0x171c('0x35')](db[_0x171c('0x5a')][_0x171c('0x5c')](_0x274143(_0x4c3d62,_0x171c('0x5b')))[_0x171c('0x34')](function(){})[_0x171c('0x37')](_0x3ea6ba()));break;default:_0x397cb2[_0x171c('0x35')](db[_0x171c('0x5a')][_0x171c('0x5c')](_0x5c3786(_0x4c3d62,_0x171c('0x5b')))['then'](function(){})[_0x171c('0x37')](_0x3ea6ba()));}}}return _0x397cb2;})['all']()['then'](function(){return db[_0x171c('0x54')]['findAll']({'where':{'type':_0x171c('0x55')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x171c('0x34')](function(_0x7774ea){var _0x46055e=[];if(_0x7774ea){var _0x593849;for(var _0x13596c=0x0,_0xb5c88f;_0x13596c<_0x7774ea[_0x171c('0x1d')];_0x13596c+=0x1){_0xb5c88f=_0x7774ea[_0x13596c][_0x171c('0x58')]({'plain':!![]});_0x46055e['push'](db[_0x171c('0x5a')][_0x171c('0x5c')](_0x273dfd(_0xb5c88f,_0x171c('0x5b')))['then'](function(){})['catch'](_0x3ea6ba()));}}return _0x46055e;})[_0x171c('0x5d')]();})['then'](function(){return db[_0x171c('0x5e')][_0x171c('0x5f')]({'attributes':['id',_0x171c('0x56')],'include':[{'model':db['CmList'],'as':_0x171c('0x60'),'where':{'id':LISTID}}]})[_0x171c('0x34')](function(_0x36a1bf){var _0x4c48ef=[];if(_0x36a1bf){for(var _0x503c5f=0x0,_0xc2f9ac;_0x503c5f<_0x36a1bf[_0x171c('0x1d')];_0x503c5f+=0x1){_0xc2f9ac=_0x36a1bf[_0x503c5f][_0x171c('0x58')]({'plain':!![]});switch(_0xc2f9ac['dialCheckDuplicateType']){case _0x171c('0x59'):_0x4c48ef[_0x171c('0x35')](db[_0x171c('0x5a')][_0x171c('0x5c')](_0x29c7fc(_0xc2f9ac,_0x171c('0x61')))[_0x171c('0x34')](function(){})[_0x171c('0x37')](_0x3ea6ba()));break;case _0x171c('0x62'):_0x4c48ef[_0x171c('0x35')](db[_0x171c('0x5a')][_0x171c('0x5c')](_0x274143(_0xc2f9ac,_0x171c('0x61')))[_0x171c('0x34')](function(){})[_0x171c('0x37')](_0x3ea6ba()));break;default:_0x4c48ef[_0x171c('0x35')](db['sequelize'][_0x171c('0x5c')](_0x5c3786(_0xc2f9ac,_0x171c('0x61')))[_0x171c('0x34')](function(){})[_0x171c('0x37')](_0x3ea6ba()));}}}return _0x4c48ef;})['all']();})['then'](function(){return db[_0x171c('0x5e')][_0x171c('0x5f')]({'attributes':['id'],'include':[{'model':db[_0x171c('0x57')],'as':_0x171c('0x63'),'where':{'id':LISTID}}]})[_0x171c('0x34')](function(_0x44cd00){var _0xb7c9dc=[];if(_0x44cd00){for(var _0x140eb3=0x0,_0x498461;_0x140eb3<_0x44cd00[_0x171c('0x1d')];_0x140eb3+=0x1){_0x498461=_0x44cd00[_0x140eb3][_0x171c('0x58')]({'plain':!![]});_0xb7c9dc['push'](db[_0x171c('0x5a')][_0x171c('0x5c')](_0x273dfd(_0x498461,_0x171c('0x61')))[_0x171c('0x34')](function(){})['catch'](_0x3ea6ba()));}}return _0xb7c9dc;})[_0x171c('0x5d')]();})[_0x171c('0x37')](function(_0x37c369){logger['error'](_0x171c('0x64'),'generalCheckHopper',_0x37c369[_0x171c('0x39')]);});}var processPromises=function(_0x4f54d4){return BPromise[_0x171c('0x5d')](promises)[_0x171c('0x34')](function(_0x4a0949){})[_0x171c('0x37')](function(_0x2a1197){logger[_0x171c('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x171c('0x3a')](_0x2a1197));})[_0x171c('0x65')](function(){socket['emit'](_0x171c('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f54d4){return _0x4f54d4[_0x171c('0x67')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x171c('0x34')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x171c('0x68')](_0x171c('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1a3e52){logger[_0x171c('0x16')](_0x171c('0x69'),JSON[_0x171c('0x3a')](_0x1a3e52));}finally{process[_0x171c('0x6a')](0x0);}});};process['on'](_0x171c('0x6b'),function(){logger[_0x171c('0x6c')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x171c('0x6d')]()[_0x171c('0x34')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x171c('0x31')][_0x171c('0x5f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x171c('0x34')](function(_0x1e3c20){var _0x2c3cd6=fs[_0x171c('0x6e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x171c('0x6f')](_0x2c3cd6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d2a93,_0x1baa2a){total+=0x1;var _0x58aff7=total;promises[_0x171c('0x35')](checkRow(_0x2d2a93,_0x1e3c20,_0x58aff7)[_0x171c('0x34')](function(){success+=0x1;})[_0x171c('0x37')](function(_0x56491f){if(_0x56491f[_0x171c('0x16')]){errors+=0x1;delete _0x56491f[_0x171c('0x16')];}else if(_0x56491f[_0x171c('0x2f')]){duplicates+=0x1;delete _0x56491f[_0x171c('0x2f')];}rows['push'](_0x56491f);}));if(total%0xc8===0x0){_0x1baa2a[_0x171c('0x70')]();return processPromises(_0x1baa2a);}},'complete':function(){return processPromises()[_0x171c('0x34')](function(){logger[_0x171c('0x6c')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x362588,_0x3fad2b){logger[_0x171c('0x6c')]('CSV\x20parse\x20error',JSON[_0x171c('0x3a')](_0x362588));endCsv();}});})[_0x171c('0x37')](function(_0x39ff5b){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x171c('0x3a')](_0x39ff5b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a40479a..be3cf06 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 _0xaf4a=['dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','rows','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','affectedRows','unlink','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','message','exit','errors','code','spread','push','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','query','error','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','length','all','isNil','utcOffset','set','offset','dialTimezone','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','parse','createReadStream','data','hasOwnProperty','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xaf4a,0x15a));var _0xaaf4=function(_0x362057,_0x448ff9){_0x362057=_0x362057-0x0;var _0x397f79=_0xaf4a[_0x362057];return _0x397f79;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xaaf4('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xaaf4('0x1'));var moment=require(_0xaaf4('0x2'));var squel=require(_0xaaf4('0x3'));var Redis=require(_0xaaf4('0x4'));var db=require(_0xaaf4('0x5'))['db'];var config=require(_0xaaf4('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0xaaf4('0x7'))('import');config['redis']=_[_0xaaf4('0x8')](config['redis'],{'host':_0xaaf4('0x9'),'port':0x18eb});var socket=require(_0xaaf4('0xa'))(new Redis(config[_0xaaf4('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xaaf4('0xc')](_0xaaf4('0xd'));function isEmail(_0x3c7907){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'](_0x3c7907);}function selectNotIn(_0x343202,_0x3b0790,_0x2ad088,_0x33f625,_0x294ed8){return squel[_0xaaf4('0xe')]()[_0xaaf4('0xf')](_0xaaf4('0x10'))[_0xaaf4('0x11')](_0x33f625)[_0xaaf4('0x12')](_0x3b0790,null,_0x3b0790+_0xaaf4('0x13')+_0x33f625+'.'+_0x2ad088)['where'](_0x33f625+'.'+_0x2ad088+'\x20=\x20'+_0x343202+'.'+_0x2ad088)[_0xaaf4('0x14')](_0x3b0790+_0xaaf4('0x15')+_0x294ed8[_0xaaf4('0x12')]()+')');}function insertCmHopper(_0x42ef1d,_0x4ec805,_0xabc137,_0xa2765a,_0x1eb109){var _0x1d283a=[_0xaaf4('0x16'),_0xaaf4('0x17'),_0xaaf4('0x18'),_0xaaf4('0x19'),_0x4ec805+'.'+_0xa2765a,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xaaf4('0x1a'),_0xaaf4('0x1b'),'\x22'+_0x1eb109+'\x22'];return squel[_0xaaf4('0x1c')]()[_0xaaf4('0x1d')](_0xaaf4('0x1e'))[_0xaaf4('0x1f')]([_0xaaf4('0x10'),_0xaaf4('0x20'),_0xaaf4('0x21'),_0xaaf4('0x22'),_0xa2765a,_0xaaf4('0x23'),_0xaaf4('0x24'),_0xaaf4('0x25'),'UserId',_0xaaf4('0x26')],squel[_0xaaf4('0xe')]()[_0xaaf4('0x27')](_0x1d283a)['from'](_0x4ec805)[_0xaaf4('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4ec805+_0xaaf4('0x28'))[_0xaaf4('0x12')](_0xabc137,null,_0xabc137+_0xaaf4('0x13')+_0x4ec805+'.'+_0xa2765a)[_0xaaf4('0x14')](_0x4ec805+'.CmListId\x20=\x20?',_0x42ef1d)['where'](_0xaaf4('0x29'),NOW)[_0xaaf4('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4ec805,_0xabc137,_0xa2765a,'cm_hopper',['\x22always\x22',_0xaaf4('0x2a')]))[_0xaaf4('0x14')](_0xaaf4('0x2b'),selectNotIn(_0x4ec805,_0xabc137,_0xa2765a,_0xaaf4('0x1e'),[_0xaaf4('0x2c')])))[_0xaaf4('0x2d')]();}function insertCmHopperBlack(_0xd78b74,_0x52bc90,_0x1d6288,_0x453848){var _0x530ba1=[_0xaaf4('0x16'),_0xaaf4('0x18'),'cm_contacts.ListId',_0x52bc90+'.'+_0x453848,'cm_contacts.createdAt',_0xaaf4('0x2e')];return squel[_0xaaf4('0x1c')]()['into'](_0xaaf4('0x2f'))[_0xaaf4('0x1f')]([_0xaaf4('0x10'),_0xaaf4('0x21'),_0xaaf4('0x22'),_0x453848,_0xaaf4('0x23'),'updatedAt'],squel[_0xaaf4('0xe')]()[_0xaaf4('0x27')](_0x530ba1)[_0xaaf4('0x11')](_0x52bc90)[_0xaaf4('0x12')](_0xaaf4('0x30'),null,_0xaaf4('0x31')+_0x52bc90+_0xaaf4('0x28'))['join'](_0x1d6288,null,_0x1d6288+'.id\x20=\x20'+_0x52bc90+'.'+_0x453848)['where'](_0x52bc90+_0xaaf4('0x32'),_0xd78b74)[_0xaaf4('0x14')](_0xaaf4('0x29'),NOW)[_0xaaf4('0x14')](_0xaaf4('0x2b'),squel['select']()[_0xaaf4('0xf')](_0xaaf4('0x10'))[_0xaaf4('0x11')](_0xaaf4('0x2f'))[_0xaaf4('0x14')]('ListId\x20=\x20?',_0xd78b74)['where'](_0x453848+_0xaaf4('0x33'),_0x52bc90+'.'+_0x453848)))[_0xaaf4('0x2d')]();}function insertTzCmHopper(_0xbad05f,_0x124b1e,_0x394076,_0x594838,_0x495dc5,_0x59a069){var _0x10ebd1=[_0xaaf4('0x16'),_0xaaf4('0x34')+_0x59a069+_0xaaf4('0x35'),_0xaaf4('0x18'),'cm_contacts.ListId',_0x124b1e+'.'+_0x594838,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xaaf4('0x1a'),_0xaaf4('0x1b'),'\x22'+_0x495dc5+'\x22'];var _0x790d4=squel[_0xaaf4('0x1c')]()[_0xaaf4('0x1d')](_0xaaf4('0x1e'))[_0xaaf4('0x1f')]([_0xaaf4('0x10'),_0xaaf4('0x20'),'ContactId',_0xaaf4('0x22'),_0x594838,_0xaaf4('0x23'),'updatedAt',_0xaaf4('0x25'),'UserId',_0xaaf4('0x26')],squel['select']()[_0xaaf4('0x27')](_0x10ebd1)[_0xaaf4('0x11')](_0x124b1e)['join']('cm_contacts',null,_0xaaf4('0x31')+_0x124b1e+_0xaaf4('0x28'))[_0xaaf4('0x12')](_0x394076,null,_0x394076+_0xaaf4('0x13')+_0x124b1e+'.'+_0x594838)[_0xaaf4('0x12')](_0x59a069,null,_0x59a069+_0xaaf4('0x13')+_0x124b1e+'.'+_0x594838)['where'](_0x124b1e+'.CmListId\x20=\x20?',_0xbad05f)['where'](_0xaaf4('0x29'),NOW)[_0xaaf4('0x14')](_0xaaf4('0x2b'),selectNotIn(_0x124b1e,_0x394076,_0x594838,'cm_hopper',[_0xaaf4('0x2c'),_0xaaf4('0x2a')]))[_0xaaf4('0x14')](_0xaaf4('0x2b'),selectNotIn(_0x124b1e,_0x394076,_0x594838,_0xaaf4('0x1e'),[_0xaaf4('0x2c')])))[_0xaaf4('0x2d')]();return _0x790d4;}function insertTzCmHopperBlack(_0xef4883,_0x5985da,_0x220406,_0x37c1c6){var _0x4e0f5d=[_0xaaf4('0x16'),_0xaaf4('0x18'),'cm_contacts.ListId',_0x5985da+'.'+_0x37c1c6,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xaaf4('0x1c')]()[_0xaaf4('0x1d')](_0xaaf4('0x2f'))['fromQuery']([_0xaaf4('0x10'),_0xaaf4('0x21'),_0xaaf4('0x22'),_0x37c1c6,_0xaaf4('0x23'),_0xaaf4('0x24')],squel[_0xaaf4('0xe')]()[_0xaaf4('0x27')](_0x4e0f5d)[_0xaaf4('0x11')](_0x5985da)[_0xaaf4('0x12')](_0xaaf4('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x5985da+'.CmListId')[_0xaaf4('0x12')](_0x220406,null,_0x220406+_0xaaf4('0x13')+_0x5985da+'.'+_0x37c1c6)[_0xaaf4('0x14')](_0x5985da+_0xaaf4('0x32'),_0xef4883)[_0xaaf4('0x14')](_0xaaf4('0x29'),NOW)[_0xaaf4('0x14')](_0xaaf4('0x2b'),squel['select']()[_0xaaf4('0xf')](_0xaaf4('0x10'))[_0xaaf4('0x11')](_0xaaf4('0x2f'))[_0xaaf4('0x14')](_0xaaf4('0x36'),_0xef4883)[_0xaaf4('0x14')](_0x37c1c6+_0xaaf4('0x33'),_0x5985da+'.'+_0x37c1c6)))[_0xaaf4('0x2d')]();}function insertCmContact(_0x3f176e,_0x24e282,_0x423b77,_0x110b7b){var _0x1c0df0=_[_0xaaf4('0x37')](_[_0xaaf4('0x38')](_0x110b7b),['ListId',_0xaaf4('0x39'),_0xaaf4('0x23'),_0xaaf4('0x24')]);return squel[_0xaaf4('0x1c')]()['into'](_0xaaf4('0x30'))[_0xaaf4('0x1f')](_0x1c0df0,squel['select']()[_0xaaf4('0x27')](_0x1c0df0)[_0xaaf4('0x11')](_0x24e282)['where']('('+_0x423b77['join'](',')+_0xaaf4('0x3a'),squel[_0xaaf4('0xe')]()[_0xaaf4('0x27')](_0x423b77)[_0xaaf4('0x11')](_0xaaf4('0x30'))['where']('ListId\x20=\x20?',_0x3f176e)[_0xaaf4('0x14')](_0xaaf4('0x3b')))[_0xaaf4('0x14')](_0xaaf4('0x3c'),squel[_0xaaf4('0xe')]()[_0xaaf4('0xf')](_0xaaf4('0x3d'),'min_id')[_0xaaf4('0x11')](_0x24e282)[_0xaaf4('0x3e')](_0x423b77[_0xaaf4('0x12')](','))))[_0xaaf4('0x2d')]();}function handleStop(){logger[_0xaaf4('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x48e1d4){logger['error'](_0x48e1d4[_0xaaf4('0x40')]);process[_0xaaf4('0x41')](0x1);}function handleError(_0x4b5b3c,_0x1fdfd6){stats[_0xaaf4('0x42')]['push']({'name':_0x1fdfd6[_0xaaf4('0x43')],'message':_0x1fdfd6[_0xaaf4('0x40')],'row':_0x4b5b3c});}function handleQuery(_0x19a072){logger['info'](_0x19a072);return db['sequelize']['query'](_0x19a072)[_0xaaf4('0x44')](function(_0x4ddf63){results[_0xaaf4('0x45')](_0x4ddf63);})[_0xaaf4('0x46')](function(_0xfd0028){logger['error'](_0xfd0028['message']);});}function updateTzCampaigns(_0x288e58){return new Promise(function(_0x3ace5b,_0x13cd44){var _0x215050=squel['select']()['fields']([_0xaaf4('0x47'),_0xaaf4('0x48')])['from'](_0xaaf4('0x49'))[_0xaaf4('0x12')](_0xaaf4('0x4a'),null,_0xaaf4('0x4b'))['where']('campaigns_has_cm_lists.CmListId='+_0x288e58);db[_0xaaf4('0x4c')][_0xaaf4('0x4d')](_0x215050[_0xaaf4('0x2d')]())[_0xaaf4('0x44')](function(_0x3248e8){var _0x3be947=[];for(var _0x20f861=0x0;_0x20f861<_0x3248e8['length'];_0x20f861++){_0x3be947[_0xaaf4('0x45')](getTimezoneData(_0x3248e8[_0x20f861],tmp_campaigns));}BPromise['all'](_0x3be947)['then'](function(){_0x3ace5b({'val':0x1});});})[_0xaaf4('0x46')](function(_0x34b355){logger[_0xaaf4('0x4e')](_0x34b355[_0xaaf4('0x40')]);_0x3ace5b({'val':0x0});});});}function updateTzVoiceQueues(_0x49859e){return new Promise(function(_0x2b07e1,_0x51ad27){var _0x24f287=squel[_0xaaf4('0xe')]()[_0xaaf4('0x27')]([_0xaaf4('0x4f'),_0xaaf4('0x50')])[_0xaaf4('0x11')](_0xaaf4('0x51'))['join'](_0xaaf4('0x52'),null,_0xaaf4('0x53'))[_0xaaf4('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x49859e);db[_0xaaf4('0x4c')][_0xaaf4('0x4d')](_0x24f287[_0xaaf4('0x2d')]())['spread'](function(_0x47a906){var _0x3732b3=[];for(var _0x1b1574=0x0;_0x1b1574<_0x47a906[_0xaaf4('0x54')];_0x1b1574++){_0x3732b3[_0xaaf4('0x45')](getTimezoneData(_0x47a906[_0x1b1574],tmp_voice_queues));}BPromise[_0xaaf4('0x55')](_0x3732b3)['then'](function(){_0x2b07e1({'val':0x1});});})[_0xaaf4('0x46')](function(_0x1c6451){logger[_0xaaf4('0x4e')](_0x1c6451['message']);_0x2b07e1({'val':0x0});});});}function getTimezoneData(_0x5f35a6,_0x21aa4f){return new Promise(function(_0x4c7f52,_0xe829e0){var _0x1de6c7=shared['timezones'];var _0x3f4e99=_0x1de6c7[_0x5f35a6['dialTimezone']];if(_[_0xaaf4('0x56')](_0x3f4e99)){_0x4c7f52({'ret':0x1});}else{var _0x28772c=_0x3f4e99[_0xaaf4('0x57')];var _0x453b30=squel['insert']()[_0xaaf4('0x1d')](_0x21aa4f)[_0xaaf4('0x58')]('id',_0x5f35a6['id'])[_0xaaf4('0x58')](_0xaaf4('0x59'),_0x28772c)[_0xaaf4('0x58')](_0xaaf4('0x5a'),_0x5f35a6[_0xaaf4('0x5a')])[_0xaaf4('0x2d')]();return db[_0xaaf4('0x4c')][_0xaaf4('0x4d')](_0x453b30)[_0xaaf4('0x44')](function(_0x5cbf53){_0x4c7f52({'ret':0x1});})[_0xaaf4('0x46')](function(_0xb1088d){logger['error'](_0xb1088d['message']);_0xe829e0({'ret':0x1});});}});}function handleTZQuery(_0x43043e){logger[_0xaaf4('0x3f')](_0x43043e);return db['sequelize'][_0xaaf4('0x4d')](_0x43043e)[_0xaaf4('0x44')](function(_0x4e35a2){})[_0xaaf4('0x46')](function(_0x59c5ce){logger[_0xaaf4('0x4e')](_0x59c5ce[_0xaaf4('0x40')]);});}function main(_0x350ed8,_0x10a6a1,_0x4bd72c,_0x14ceed){logger[_0xaaf4('0x3f')](_0xaaf4('0x5b'),_0x350ed8,JSON['stringify'](_0x10a6a1));process[_0xaaf4('0x5c')](_0xaaf4('0x5d'));var _0x2354d1=_0x10a6a1[_0xaaf4('0x5e')];var _0x20d43a=_0x10a6a1[_0xaaf4('0x5f')];var _0x1b22d4=path['join'](config[_0xaaf4('0x60')],_0xaaf4('0x61'),_0x20d43a+_0xaaf4('0x62'));hasTZ=_[_0xaaf4('0x38')](_0x2354d1)[_0xaaf4('0x63')](_0xaaf4('0x5a'));var _0x40c7c9=_['keys'](_0x2354d1)['join']();logger[_0xaaf4('0x3f')](_0xaaf4('0x64'),_0x40c7c9);if(hasTZ)_0x40c7c9+=_0xaaf4('0x65');fs['writeFileSync'](_0x1b22d4,_0x40c7c9+'\x0a');Papa[_0xaaf4('0x66')](fs[_0xaaf4('0x67')](_0x350ed8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1043e6,_0x45de56){try{for(var _0x35d577=0x0,_0x2a54cd=[];_0x35d577<_0x1043e6[_0xaaf4('0x68')][_0xaaf4('0x54')];_0x35d577++){stats['rows']+=0x1;if(_0x1043e6['errors'][_0x35d577]){handleError(_0x1043e6['data'][_0x35d577],_0x1043e6['errors'][_0x35d577]);}else{var _0x2c6ab1=[];for(var _0x31ff66 in _0x2354d1){if(_0x2354d1[_0xaaf4('0x69')](_0x31ff66)){if(_0x1043e6[_0xaaf4('0x68')][_0x35d577][_0x2354d1[_0x31ff66]]){var _0xe47f3c=_['trim'](_0x1043e6[_0xaaf4('0x68')][_0x35d577][_0x2354d1[_0x31ff66]][_0xaaf4('0x6a')](/"/g,'\x27'));switch(_0x31ff66){case'scheduledat':var _0x48ec31=moment(_0xe47f3c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x48ec31['isValid']()){_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0xe47f3c+'\x22');}else{_0x2c6ab1[_0xaaf4('0x45')](_0xaaf4('0x6b'));}break;case _0xaaf4('0x25'):var _0x5ce2a4=parseInt(_0xe47f3c);_0xe47f3c=_[_0xaaf4('0x6c')](_0x5ce2a4)||_0x5ce2a4<0x0||_0x5ce2a4>0x4?_0x14ceed?0x3:0x2:_0x5ce2a4;_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0xe47f3c+'\x22');break;case _0xaaf4('0x6d'):var _0x31b709=parseInt(_0xe47f3c);if(_[_0xaaf4('0x6e')](_0x31b709)&&_[_0xaaf4('0x63')](_0x4bd72c,_0x31b709)){_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0x31b709+'\x22');}else{_0x2c6ab1[_0xaaf4('0x45')](_0xaaf4('0x6f'));}break;case _0xaaf4('0x70'):if(isEmail(_0xe47f3c)){_0x2a54cd['push']('\x22'+_0xe47f3c+'\x22');}else{_0x2c6ab1[_0xaaf4('0x45')](_0xaaf4('0x71'));}break;case'dateOfBirth':var _0x99f5a8=moment(_0xe47f3c,_0xaaf4('0x72'),!![]);if(_0x99f5a8[_0xaaf4('0x73')]()){_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0xe47f3c+'\x22');}else{_0x2c6ab1[_0xaaf4('0x45')](_0xaaf4('0x74'));}break;case'dialTimezone':var _0x3431b7=shared[_0xaaf4('0x75')];var _0xec4130=_0x3431b7[_0xe47f3c];if(!_[_0xaaf4('0x56')](_0xec4130)){var _0x3ae5ee=_0xec4130[_0xaaf4('0x57')];_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0xe47f3c+'\x22');_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0x3ae5ee+'\x22');}break;default:_0x2a54cd[_0xaaf4('0x45')]('\x22'+_0xe47f3c+'\x22');}}else{switch(_0x31ff66){case _0xaaf4('0x76'):case _0xaaf4('0x10'):_0x2c6ab1[_0xaaf4('0x45')](_0x31ff66+_0xaaf4('0x77'));break;default:_0x2a54cd[_0xaaf4('0x45')]('\x22\x22');}}}}if(_0x2c6ab1[_0xaaf4('0x54')]){handleError(_0x1043e6[_0xaaf4('0x68')][_0x35d577],{'code':'SystemRow','message':_0x2c6ab1['join']()});}else{fs['appendFileSync'](_0x1b22d4,_0x2a54cd[_0xaaf4('0x12')]()+'\x0a');}_0x2a54cd=[];}if(!(stats[_0xaaf4('0x78')]%0xc8)){socket[_0xaaf4('0x79')](_0xaaf4('0x7a')+_0x20d43a,stats);stats[_0xaaf4('0x42')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x45de56[_0xaaf4('0x7b')]();}}catch(_0x15884c){handleError(_0x1043e6[_0xaaf4('0x68')][_0x35d577],{'code':_0xaaf4('0x7c'),'message':_0x15884c[_0xaaf4('0x40')]});logger[_0xaaf4('0x4e')](_0xaaf4('0x7d'),_0x15884c[_0xaaf4('0x40')]);}},'complete':function(){try{var _0x385111=[];var _0x5780cf=[];var _0x5703e8=_0xaaf4('0x30');if(_0x10a6a1['duplicates']&&_0x10a6a1[_0xaaf4('0x7e')][_0xaaf4('0x54')]){_0x5703e8=_0xaaf4('0x7f')+_0x20d43a;_0x385111[_0xaaf4('0x45')](_0xaaf4('0x80')+_0x5703e8+_0xaaf4('0x81'));}tmp_campaigns=_0xaaf4('0x82')+_0x20d43a;tmp_voice_queues=_0xaaf4('0x83')+_0x20d43a;_0x5780cf['push'](_0xaaf4('0x80')+tmp_campaigns+_0xaaf4('0x84'));_0x5780cf[_0xaaf4('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xaaf4('0x84'));BPromise[_0xaaf4('0x85')](_0x5780cf,handleTZQuery)[_0xaaf4('0x86')](function(_0x3d9e85){updateTzCampaigns(_0x10a6a1[_0xaaf4('0x22')])[_0xaaf4('0x86')](function(_0x2663fa){updateTzVoiceQueues(_0x10a6a1[_0xaaf4('0x22')])[_0xaaf4('0x86')](function(_0x134962){var _0x1628df=util['format']('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',_0x1b22d4,_0x5703e8,_0x40c7c9,_0x10a6a1[_0xaaf4('0x22')],_0x10a6a1[_0xaaf4('0x39')]||null,NOW,NOW);if(_['isNil'](_0x2354d1[_0xaaf4('0x20')])){_0x1628df+=_0xaaf4('0x87');}_0x385111['push'](_0x1628df);if(_0x10a6a1[_0xaaf4('0x7e')]&&_0x10a6a1['duplicates'][_0xaaf4('0x54')]){_0x385111[_0xaaf4('0x45')](insertCmContact(_0x10a6a1['ListId'],_0x5703e8,_0x10a6a1[_0xaaf4('0x7e')],_0x2354d1));_0x385111[_0xaaf4('0x45')]('DROP\x20TABLE\x20'+_0x5703e8+';');}if(hasTZ){_0x385111[_0xaaf4('0x45')](insertTzCmHopper(_0x10a6a1['ListId'],'voice_queues_has_cm_lists',_0xaaf4('0x51'),_0xaaf4('0x88'),_0x14ceed,tmp_voice_queues));_0x385111[_0xaaf4('0x45')](insertTzCmHopperBlack(_0x10a6a1[_0xaaf4('0x22')],_0xaaf4('0x89'),_0xaaf4('0x51'),_0xaaf4('0x88')));_0x385111['push'](insertTzCmHopper(_0x10a6a1[_0xaaf4('0x22')],'campaigns_has_cm_lists',_0xaaf4('0x49'),_0xaaf4('0x8a'),_0x14ceed,tmp_campaigns));_0x385111['push'](insertTzCmHopperBlack(_0x10a6a1[_0xaaf4('0x22')],'campaigns_has_cm_blacklists',_0xaaf4('0x49'),_0xaaf4('0x8a')));}else{_0x385111[_0xaaf4('0x45')](insertCmHopper(_0x10a6a1['ListId'],_0xaaf4('0x52'),_0xaaf4('0x51'),_0xaaf4('0x88'),_0x14ceed));_0x385111[_0xaaf4('0x45')](insertCmHopperBlack(_0x10a6a1[_0xaaf4('0x22')],_0xaaf4('0x89'),_0xaaf4('0x51'),_0xaaf4('0x88')));_0x385111[_0xaaf4('0x45')](insertCmHopper(_0x10a6a1[_0xaaf4('0x22')],_0xaaf4('0x4a'),'campaigns',_0xaaf4('0x8a'),_0x14ceed));_0x385111[_0xaaf4('0x45')](insertCmHopperBlack(_0x10a6a1[_0xaaf4('0x22')],_0xaaf4('0x8b'),_0xaaf4('0x49'),_0xaaf4('0x8a')));}_0x385111[_0xaaf4('0x45')](_0xaaf4('0x8c')+tmp_campaigns+';');_0x385111[_0xaaf4('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0xaaf4('0x85')](_0x385111,handleQuery)[_0xaaf4('0x86')](function(_0xc73a80){stats['finish']=!![];stats[_0xaaf4('0x8d')]=_0x10a6a1['duplicates']&&_0x10a6a1['duplicates'][_0xaaf4('0x54')]?results[0x2][_0xaaf4('0x8d')]:results[0x0][_0xaaf4('0x8d')];socket['emit'](_0xaaf4('0x7a')+_0x20d43a,stats);fs[_0xaaf4('0x8e')](_0x350ed8);fs[_0xaaf4('0x8e')](_0x1b22d4);process[_0xaaf4('0x41')](0x0);})[_0xaaf4('0x46')](function(_0x13f5e9){logger[_0xaaf4('0x4e')](_0x13f5e9[_0xaaf4('0x40')]);process['exit'](0x1);});});});});}catch(_0x556090){logger['error']('complete',_0x556090[_0xaaf4('0x40')]);process[_0xaaf4('0x41')](0x1);}},'error':function(_0x4b2e84,_0x12d75c,_0x2a6da9,_0x2b32b0){throw new Error(_0x2b32b0);}});}function validate(){if(process[_0xaaf4('0x8f')]&&process[_0xaaf4('0x8f')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0xc7c495=path[_0xaaf4('0x12')](config[_0xaaf4('0x60')],_0xaaf4('0x61'),process[_0xaaf4('0x8f')][0x2]);if(!fs[_0xaaf4('0x90')](_0xc7c495)){throw new Error(_0xaaf4('0x91'));}var _0x2cbf70={};try{_0x2cbf70=JSON[_0xaaf4('0x66')](process[_0xaaf4('0x8f')][0x3]);if(!_0x2cbf70[_0xaaf4('0x5e')]){throw new Error(_0xaaf4('0x92'));}if(!_0x2cbf70[_0xaaf4('0x5e')][_0xaaf4('0x10')]){throw new Error(_0xaaf4('0x93'));}if(!_0x2cbf70[_0xaaf4('0x5e')][_0xaaf4('0x76')]){throw new Error(_0xaaf4('0x94'));}var _0x936972=0x0;if(_0x2cbf70['binding']['UserId']){_0x936972=0x1;}if(!_0x2cbf70[_0xaaf4('0x22')]){throw new Error(_0xaaf4('0x95'));}}catch(_0x55cb5f){throw new Error(_0xaaf4('0x96'));}var _0x3d22b0=[];try{_0x3d22b0=_['map'](JSON[_0xaaf4('0x66')](process['argv'][0x4]),'id');}catch(_0x396aee){logger[_0xaaf4('0x3f')](_0xaaf4('0x97'));}main(_0xc7c495,_0x2cbf70,_0x3d22b0,_0x936972);}validate();process['on'](_0xaaf4('0x98'),handleStop);process['on'](_0xaaf4('0x99'),handleUncaughtException); \ No newline at end of file +var _0x42d0=['cm_hopper_black','from','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.UserId','UserId','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','query','length','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','dialTimezone','isNil','utcOffset','set','offset','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','keys','header',',utcOffset','writeFileSync','parse','data','rows','errors','hasOwnProperty','trim','replace','isNaN','isNumber','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','duplicates','cm_contacts_','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','format','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','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone'];(function(_0x118758,_0x58232a){var _0x429d4b=function(_0x49dc87){while(--_0x49dc87){_0x118758['push'](_0x118758['shift']());}};_0x429d4b(++_0x58232a);}(_0x42d0,0x68));var _0x042d=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x42d0[_0x3cf5a3];return _0x39ba2d;};'use strict';var fs=require('fs');var path=require(_0x042d('0x0'));var _=require(_0x042d('0x1'));var Papa=require(_0x042d('0x2'));var util=require(_0x042d('0x3'));var BPromise=require(_0x042d('0x4'));var moment=require(_0x042d('0x5'));var squel=require(_0x042d('0x6'));var Redis=require(_0x042d('0x7'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x042d('0x8'));var logger=require(_0x042d('0x9'))(_0x042d('0xa'));config['redis']=_[_0x042d('0xb')](config[_0x042d('0xc')],{'host':_0x042d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x042d('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x042d('0xe'));function isEmail(_0x3b0816){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))*$/[_0x042d('0xf')](_0x3b0816);}function selectNotIn(_0x389274,_0x3bb376,_0x51dbd2,_0x412b14,_0x20214e){return squel[_0x042d('0x10')]()[_0x042d('0x11')](_0x042d('0x12'))['from'](_0x412b14)[_0x042d('0x13')](_0x3bb376,null,_0x3bb376+_0x042d('0x14')+_0x412b14+'.'+_0x51dbd2)[_0x042d('0x15')](_0x412b14+'.'+_0x51dbd2+_0x042d('0x16')+_0x389274+'.'+_0x51dbd2)['where'](_0x3bb376+_0x042d('0x17')+_0x20214e[_0x042d('0x13')]()+')');}function insertCmHopper(_0x9927d7,_0x3895a4,_0xe348ae,_0x4a0b26,_0x1758d2){var _0xcebe3f=['cm_contacts.phone',_0x042d('0x18'),'cm_contacts.id',_0x042d('0x19'),_0x3895a4+'.'+_0x4a0b26,_0x042d('0x1a'),_0x042d('0x1b'),_0x042d('0x1c'),'cm_contacts.UserId','\x22'+_0x1758d2+'\x22'];return squel[_0x042d('0x1d')]()[_0x042d('0x1e')](_0x042d('0x1f'))[_0x042d('0x20')](['phone',_0x042d('0x21'),_0x042d('0x22'),_0x042d('0x23'),_0x4a0b26,_0x042d('0x24'),_0x042d('0x25'),_0x042d('0x26'),'UserId',_0x042d('0x27')],squel[_0x042d('0x10')]()[_0x042d('0x28')](_0xcebe3f)['from'](_0x3895a4)[_0x042d('0x13')](_0x042d('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0x3895a4+_0x042d('0x2a'))[_0x042d('0x13')](_0xe348ae,null,_0xe348ae+_0x042d('0x14')+_0x3895a4+'.'+_0x4a0b26)[_0x042d('0x15')](_0x3895a4+_0x042d('0x2b'),_0x9927d7)[_0x042d('0x15')](_0x042d('0x2c'),NOW)[_0x042d('0x15')](_0x042d('0x2d'),selectNotIn(_0x3895a4,_0xe348ae,_0x4a0b26,'cm_hopper',[_0x042d('0x2e'),_0x042d('0x2f')]))[_0x042d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3895a4,_0xe348ae,_0x4a0b26,_0x042d('0x1f'),['\x22always\x22'])))[_0x042d('0x30')]();}function insertCmHopperBlack(_0x3f1324,_0x59ec7f,_0x10484e,_0x196ade){var _0x1543d7=[_0x042d('0x31'),'cm_contacts.id',_0x042d('0x19'),_0x59ec7f+'.'+_0x196ade,_0x042d('0x1a'),_0x042d('0x1b')];return squel[_0x042d('0x1d')]()['into'](_0x042d('0x32'))[_0x042d('0x20')]([_0x042d('0x12'),_0x042d('0x22'),_0x042d('0x23'),_0x196ade,_0x042d('0x24'),'updatedAt'],squel[_0x042d('0x10')]()['fields'](_0x1543d7)[_0x042d('0x33')](_0x59ec7f)[_0x042d('0x13')]('cm_contacts',null,_0x042d('0x34')+_0x59ec7f+_0x042d('0x2a'))[_0x042d('0x13')](_0x10484e,null,_0x10484e+_0x042d('0x14')+_0x59ec7f+'.'+_0x196ade)[_0x042d('0x15')](_0x59ec7f+_0x042d('0x2b'),_0x3f1324)['where'](_0x042d('0x2c'),NOW)[_0x042d('0x15')](_0x042d('0x2d'),squel['select']()[_0x042d('0x11')](_0x042d('0x12'))[_0x042d('0x33')]('cm_hopper_black')[_0x042d('0x15')](_0x042d('0x35'),_0x3f1324)[_0x042d('0x15')](_0x196ade+'\x20=\x20?',_0x59ec7f+'.'+_0x196ade)))[_0x042d('0x30')]();}function insertTzCmHopper(_0x11523e,_0x3bd898,_0x26639c,_0x174e13,_0x3964d3,_0xa8d00a){var _0x15d1df=[_0x042d('0x31'),_0x042d('0x36')+_0xa8d00a+_0x042d('0x37'),_0x042d('0x38'),'cm_contacts.ListId',_0x3bd898+'.'+_0x174e13,_0x042d('0x1a'),_0x042d('0x1b'),_0x042d('0x1c'),_0x042d('0x39'),'\x22'+_0x3964d3+'\x22'];var _0x1b4a5e=squel['insert']()[_0x042d('0x1e')](_0x042d('0x1f'))['fromQuery'](['phone',_0x042d('0x21'),_0x042d('0x22'),'ListId',_0x174e13,_0x042d('0x24'),_0x042d('0x25'),_0x042d('0x26'),_0x042d('0x3a'),_0x042d('0x27')],squel[_0x042d('0x10')]()[_0x042d('0x28')](_0x15d1df)[_0x042d('0x33')](_0x3bd898)[_0x042d('0x13')](_0x042d('0x29'),null,_0x042d('0x34')+_0x3bd898+_0x042d('0x2a'))[_0x042d('0x13')](_0x26639c,null,_0x26639c+_0x042d('0x14')+_0x3bd898+'.'+_0x174e13)[_0x042d('0x13')](_0xa8d00a,null,_0xa8d00a+'.id\x20=\x20'+_0x3bd898+'.'+_0x174e13)[_0x042d('0x15')](_0x3bd898+_0x042d('0x2b'),_0x11523e)[_0x042d('0x15')](_0x042d('0x2c'),NOW)[_0x042d('0x15')](_0x042d('0x2d'),selectNotIn(_0x3bd898,_0x26639c,_0x174e13,_0x042d('0x1f'),[_0x042d('0x2e'),_0x042d('0x2f')]))[_0x042d('0x15')](_0x042d('0x2d'),selectNotIn(_0x3bd898,_0x26639c,_0x174e13,'cm_hopper',['\x22always\x22'])))[_0x042d('0x30')]();return _0x1b4a5e;}function insertTzCmHopperBlack(_0x4437e8,_0x2d6527,_0x5c14b2,_0x2a4e7a){var _0x5c8d9d=[_0x042d('0x31'),_0x042d('0x38'),'cm_contacts.ListId',_0x2d6527+'.'+_0x2a4e7a,'cm_contacts.createdAt',_0x042d('0x1b')];return squel['insert']()[_0x042d('0x1e')](_0x042d('0x32'))[_0x042d('0x20')]([_0x042d('0x12'),_0x042d('0x22'),_0x042d('0x23'),_0x2a4e7a,_0x042d('0x24'),_0x042d('0x25')],squel[_0x042d('0x10')]()[_0x042d('0x28')](_0x5c8d9d)['from'](_0x2d6527)[_0x042d('0x13')]('cm_contacts',null,_0x042d('0x34')+_0x2d6527+_0x042d('0x2a'))[_0x042d('0x13')](_0x5c14b2,null,_0x5c14b2+_0x042d('0x14')+_0x2d6527+'.'+_0x2a4e7a)[_0x042d('0x15')](_0x2d6527+_0x042d('0x2b'),_0x4437e8)[_0x042d('0x15')](_0x042d('0x2c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x042d('0x10')]()[_0x042d('0x11')]('phone')['from']('cm_hopper_black')[_0x042d('0x15')](_0x042d('0x35'),_0x4437e8)[_0x042d('0x15')](_0x2a4e7a+'\x20=\x20?',_0x2d6527+'.'+_0x2a4e7a)))[_0x042d('0x30')]();}function insertCmContact(_0x13f38a,_0x525682,_0x202a1b,_0x3e0b4e){var _0xe7cd1b=_[_0x042d('0x3b')](_['keys'](_0x3e0b4e),['ListId',_0x042d('0x3c'),'createdAt',_0x042d('0x25')]);return squel['insert']()[_0x042d('0x1e')](_0x042d('0x29'))[_0x042d('0x20')](_0xe7cd1b,squel['select']()[_0x042d('0x28')](_0xe7cd1b)[_0x042d('0x33')](_0x525682)[_0x042d('0x15')]('('+_0x202a1b[_0x042d('0x13')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x202a1b)['from'](_0x042d('0x29'))['where'](_0x042d('0x35'),_0x13f38a)[_0x042d('0x15')](_0x042d('0x3d')))[_0x042d('0x15')](_0x042d('0x3e'),squel['select']()[_0x042d('0x11')]('MIN(id)',_0x042d('0x3f'))[_0x042d('0x33')](_0x525682)[_0x042d('0x40')](_0x202a1b[_0x042d('0x13')](','))))[_0x042d('0x30')]();}function handleStop(){logger[_0x042d('0x41')](_0x042d('0x42'));stopped=!![];}function handleUncaughtException(_0x20392c){logger[_0x042d('0x43')](_0x20392c[_0x042d('0x44')]);process[_0x042d('0x45')](0x1);}function handleError(_0x4cf44f,_0x2d6a11){stats['errors'][_0x042d('0x46')]({'name':_0x2d6a11[_0x042d('0x47')],'message':_0x2d6a11[_0x042d('0x44')],'row':_0x4cf44f});}function handleQuery(_0x4bf94a){logger[_0x042d('0x41')](_0x4bf94a);return db[_0x042d('0x48')]['query'](_0x4bf94a)[_0x042d('0x49')](function(_0x17a691){results['push'](_0x17a691);})[_0x042d('0x4a')](function(_0x4d4a22){logger['error'](_0x4d4a22[_0x042d('0x44')]);});}function updateTzCampaigns(_0x35445e){return new Promise(function(_0xd2bcf3,_0x59debb){var _0x418903=squel[_0x042d('0x10')]()[_0x042d('0x28')](['campaigns.id',_0x042d('0x4b')])[_0x042d('0x33')](_0x042d('0x4c'))[_0x042d('0x13')](_0x042d('0x4d'),null,_0x042d('0x4e'))[_0x042d('0x15')]('campaigns_has_cm_lists.CmListId='+_0x35445e);db[_0x042d('0x48')][_0x042d('0x4f')](_0x418903[_0x042d('0x30')]())[_0x042d('0x49')](function(_0x37ac86){var _0x53ca23=[];for(var _0x157df1=0x0;_0x157df1<_0x37ac86[_0x042d('0x50')];_0x157df1++){_0x53ca23[_0x042d('0x46')](getTimezoneData(_0x37ac86[_0x157df1],tmp_campaigns));}BPromise[_0x042d('0x51')](_0x53ca23)[_0x042d('0x52')](function(){_0xd2bcf3({'val':0x1});});})['catch'](function(_0x468228){logger[_0x042d('0x43')](_0x468228[_0x042d('0x44')]);_0xd2bcf3({'val':0x0});});});}function updateTzVoiceQueues(_0x346c0a){return new Promise(function(_0x5076bb,_0x2a8537){var _0x9b9bd3=squel[_0x042d('0x10')]()['fields']([_0x042d('0x53'),_0x042d('0x54')])[_0x042d('0x33')](_0x042d('0x55'))[_0x042d('0x13')](_0x042d('0x56'),null,_0x042d('0x57'))[_0x042d('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x346c0a);db[_0x042d('0x48')][_0x042d('0x4f')](_0x9b9bd3['toString']())[_0x042d('0x49')](function(_0x3b11c2){var _0x4af79e=[];for(var _0x252608=0x0;_0x252608<_0x3b11c2[_0x042d('0x50')];_0x252608++){_0x4af79e[_0x042d('0x46')](getTimezoneData(_0x3b11c2[_0x252608],tmp_voice_queues));}BPromise[_0x042d('0x51')](_0x4af79e)[_0x042d('0x52')](function(){_0x5076bb({'val':0x1});});})[_0x042d('0x4a')](function(_0x5cfc1a){logger[_0x042d('0x43')](_0x5cfc1a[_0x042d('0x44')]);_0x5076bb({'val':0x0});});});}function getTimezoneData(_0x542a1f,_0x30d6e7){return new Promise(function(_0x2a27c1,_0x452b9b){var _0xe31703=shared['timezones'];var _0x57d3c6=_0xe31703[_0x542a1f[_0x042d('0x58')]];if(_[_0x042d('0x59')](_0x57d3c6)){_0x2a27c1({'ret':0x1});}else{var _0x51d7c7=_0x57d3c6[_0x042d('0x5a')];var _0x4e1674=squel[_0x042d('0x1d')]()[_0x042d('0x1e')](_0x30d6e7)[_0x042d('0x5b')]('id',_0x542a1f['id'])[_0x042d('0x5b')](_0x042d('0x5c'),_0x51d7c7)[_0x042d('0x5b')]('dialTimezone',_0x542a1f[_0x042d('0x58')])[_0x042d('0x30')]();return db[_0x042d('0x48')][_0x042d('0x4f')](_0x4e1674)[_0x042d('0x49')](function(_0x237125){_0x2a27c1({'ret':0x1});})['catch'](function(_0x62436c){logger[_0x042d('0x43')](_0x62436c['message']);_0x452b9b({'ret':0x1});});}});}function handleTZQuery(_0x1ae8d8){logger['info'](_0x1ae8d8);return db[_0x042d('0x48')][_0x042d('0x4f')](_0x1ae8d8)[_0x042d('0x49')](function(_0x6699fd){})[_0x042d('0x4a')](function(_0x58a48f){logger[_0x042d('0x43')](_0x58a48f['message']);});}function main(_0x12176f,_0x3a47ed,_0x53507c,_0x82365b){logger[_0x042d('0x41')]('main',_0x12176f,JSON[_0x042d('0x5d')](_0x3a47ed));process[_0x042d('0x5e')](_0x042d('0x5f'));var _0x10ceac=_0x3a47ed[_0x042d('0x60')];var _0x2df637=_0x3a47ed[_0x042d('0x61')];var _0x1c647c=path[_0x042d('0x13')](config[_0x042d('0x62')],_0x042d('0x63'),_0x2df637+_0x042d('0x64'));hasTZ=_['keys'](_0x10ceac)[_0x042d('0x65')](_0x042d('0x58'));var _0x22b6e9=_[_0x042d('0x66')](_0x10ceac)[_0x042d('0x13')]();logger['info'](_0x042d('0x67'),_0x22b6e9);if(hasTZ)_0x22b6e9+=_0x042d('0x68');fs[_0x042d('0x69')](_0x1c647c,_0x22b6e9+'\x0a');Papa[_0x042d('0x6a')](fs['createReadStream'](_0x12176f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2de919,_0x4a0f3a){try{for(var _0x14880f=0x0,_0x30ff33=[];_0x14880f<_0x2de919[_0x042d('0x6b')][_0x042d('0x50')];_0x14880f++){stats[_0x042d('0x6c')]+=0x1;if(_0x2de919[_0x042d('0x6d')][_0x14880f]){handleError(_0x2de919['data'][_0x14880f],_0x2de919[_0x042d('0x6d')][_0x14880f]);}else{var _0x472484=[];for(var _0x4e4132 in _0x10ceac){if(_0x10ceac[_0x042d('0x6e')](_0x4e4132)){if(_0x2de919[_0x042d('0x6b')][_0x14880f][_0x10ceac[_0x4e4132]]){var _0x537b09=_[_0x042d('0x6f')](_0x2de919[_0x042d('0x6b')][_0x14880f][_0x10ceac[_0x4e4132]][_0x042d('0x70')](/"/g,'\x27'));switch(_0x4e4132){case _0x042d('0x21'):var _0x1f8360=moment(_0x537b09,_0x042d('0xe'),!![]);if(_0x1f8360['isValid']()){_0x30ff33[_0x042d('0x46')]('\x22'+_0x537b09+'\x22');}else{_0x472484[_0x042d('0x46')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x27e393=parseInt(_0x537b09);_0x537b09=_[_0x042d('0x71')](_0x27e393)||_0x27e393<0x0||_0x27e393>0x4?_0x82365b?0x3:0x2:_0x27e393;_0x30ff33[_0x042d('0x46')]('\x22'+_0x537b09+'\x22');break;case _0x042d('0x3a'):var _0x35a3f4=parseInt(_0x537b09);if(_[_0x042d('0x72')](_0x35a3f4)&&_[_0x042d('0x65')](_0x53507c,_0x35a3f4)){_0x30ff33[_0x042d('0x46')]('\x22'+_0x35a3f4+'\x22');}else{_0x472484[_0x042d('0x46')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x537b09)){_0x30ff33[_0x042d('0x46')]('\x22'+_0x537b09+'\x22');}else{_0x472484[_0x042d('0x46')]('email\x20wrong\x20format');}break;case _0x042d('0x73'):var _0x51b904=moment(_0x537b09,_0x042d('0x74'),!![]);if(_0x51b904[_0x042d('0x75')]()){_0x30ff33[_0x042d('0x46')]('\x22'+_0x537b09+'\x22');}else{_0x472484[_0x042d('0x46')](_0x042d('0x76'));}break;case _0x042d('0x58'):var _0x24ff27=shared['timezones'];var _0x510b82=_0x24ff27[_0x537b09];if(!_[_0x042d('0x59')](_0x510b82)){var _0x493451=_0x510b82[_0x042d('0x5a')];_0x30ff33['push']('\x22'+_0x537b09+'\x22');_0x30ff33[_0x042d('0x46')]('\x22'+_0x493451+'\x22');}break;default:_0x30ff33['push']('\x22'+_0x537b09+'\x22');}}else{switch(_0x4e4132){case'firstName':case _0x042d('0x12'):_0x472484[_0x042d('0x46')](_0x4e4132+_0x042d('0x77'));break;default:_0x30ff33[_0x042d('0x46')]('\x22\x22');}}}}if(_0x472484[_0x042d('0x50')]){handleError(_0x2de919[_0x042d('0x6b')][_0x14880f],{'code':_0x042d('0x78'),'message':_0x472484[_0x042d('0x13')]()});}else{fs[_0x042d('0x79')](_0x1c647c,_0x30ff33['join']()+'\x0a');}_0x30ff33=[];}if(!(stats[_0x042d('0x6c')]%0xc8)){socket[_0x042d('0x7a')](_0x042d('0x7b')+_0x2df637,stats);stats[_0x042d('0x6d')]=[];}}if(stopped){logger[_0x042d('0x41')](_0x042d('0x7c'));_0x4a0f3a['abort']();}}catch(_0x3a6972){handleError(_0x2de919[_0x042d('0x6b')][_0x14880f],{'code':_0x042d('0x7d'),'message':_0x3a6972['message']});logger[_0x042d('0x43')]('step',_0x3a6972['message']);}},'complete':function(){try{var _0x1e1065=[];var _0x48382f=[];var _0x53e873='cm_contacts';if(_0x3a47ed[_0x042d('0x7e')]&&_0x3a47ed[_0x042d('0x7e')][_0x042d('0x50')]){_0x53e873=_0x042d('0x7f')+_0x2df637;_0x1e1065[_0x042d('0x46')]('CREATE\x20TABLE\x20'+_0x53e873+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x042d('0x80')+_0x2df637;tmp_voice_queues=_0x042d('0x81')+_0x2df637;_0x48382f[_0x042d('0x46')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x042d('0x82'));_0x48382f[_0x042d('0x46')](_0x042d('0x83')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x48382f,handleTZQuery)[_0x042d('0x52')](function(_0x4d4838){updateTzCampaigns(_0x3a47ed['ListId'])['then'](function(_0x1c1131){updateTzVoiceQueues(_0x3a47ed[_0x042d('0x23')])[_0x042d('0x52')](function(_0x206fdd){var _0x236715=util[_0x042d('0x84')](_0x042d('0x85'),_0x1c647c,_0x53e873,_0x22b6e9,_0x3a47ed[_0x042d('0x23')],_0x3a47ed[_0x042d('0x3c')]||null,NOW,NOW);if(_[_0x042d('0x59')](_0x10ceac[_0x042d('0x21')])){_0x236715+=_0x042d('0x86');}_0x1e1065[_0x042d('0x46')](_0x236715);if(_0x3a47ed[_0x042d('0x7e')]&&_0x3a47ed['duplicates']['length']){_0x1e1065[_0x042d('0x46')](insertCmContact(_0x3a47ed[_0x042d('0x23')],_0x53e873,_0x3a47ed[_0x042d('0x7e')],_0x10ceac));_0x1e1065[_0x042d('0x46')](_0x042d('0x87')+_0x53e873+';');}if(hasTZ){_0x1e1065[_0x042d('0x46')](insertTzCmHopper(_0x3a47ed[_0x042d('0x23')],'voice_queues_has_cm_lists',_0x042d('0x55'),_0x042d('0x88'),_0x82365b,tmp_voice_queues));_0x1e1065[_0x042d('0x46')](insertTzCmHopperBlack(_0x3a47ed[_0x042d('0x23')],_0x042d('0x89'),_0x042d('0x55'),'VoiceQueueId'));_0x1e1065[_0x042d('0x46')](insertTzCmHopper(_0x3a47ed[_0x042d('0x23')],_0x042d('0x4d'),'campaigns',_0x042d('0x8a'),_0x82365b,tmp_campaigns));_0x1e1065['push'](insertTzCmHopperBlack(_0x3a47ed[_0x042d('0x23')],_0x042d('0x8b'),'campaigns',_0x042d('0x8a')));}else{_0x1e1065['push'](insertCmHopper(_0x3a47ed[_0x042d('0x23')],_0x042d('0x56'),_0x042d('0x55'),'VoiceQueueId',_0x82365b));_0x1e1065[_0x042d('0x46')](insertCmHopperBlack(_0x3a47ed[_0x042d('0x23')],_0x042d('0x89'),'voice_queues','VoiceQueueId'));_0x1e1065[_0x042d('0x46')](insertCmHopper(_0x3a47ed['ListId'],_0x042d('0x4d'),'campaigns',_0x042d('0x8a'),_0x82365b));_0x1e1065['push'](insertCmHopperBlack(_0x3a47ed[_0x042d('0x23')],_0x042d('0x8b'),'campaigns',_0x042d('0x8a')));}_0x1e1065[_0x042d('0x46')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x1e1065[_0x042d('0x46')](_0x042d('0x87')+tmp_voice_queues+';');BPromise['each'](_0x1e1065,handleQuery)['then'](function(_0x1edec7){stats[_0x042d('0x8c')]=!![];stats[_0x042d('0x8d')]=_0x3a47ed[_0x042d('0x7e')]&&_0x3a47ed[_0x042d('0x7e')][_0x042d('0x50')]?results[0x2]['affectedRows']:results[0x0][_0x042d('0x8d')];socket[_0x042d('0x7a')]('contact:import:'+_0x2df637,stats);fs[_0x042d('0x8e')](_0x12176f);fs['unlink'](_0x1c647c);process[_0x042d('0x45')](0x0);})[_0x042d('0x4a')](function(_0x1a84f0){logger[_0x042d('0x43')](_0x1a84f0[_0x042d('0x44')]);process[_0x042d('0x45')](0x1);});});});});}catch(_0x51a775){logger[_0x042d('0x43')](_0x042d('0x8f'),_0x51a775[_0x042d('0x44')]);process[_0x042d('0x45')](0x1);}},'error':function(_0x2091f3,_0x4e332b,_0x3fb4ac,_0x125a80){throw new Error(_0x125a80);}});}function validate(){if(process[_0x042d('0x90')]&&process[_0x042d('0x90')][_0x042d('0x50')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x40565e=path[_0x042d('0x13')](config['root'],_0x042d('0x63'),process[_0x042d('0x90')][0x2]);if(!fs[_0x042d('0x91')](_0x40565e)){throw new Error(_0x042d('0x92'));}var _0x392f32={};try{_0x392f32=JSON['parse'](process['argv'][0x3]);if(!_0x392f32[_0x042d('0x60')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x392f32[_0x042d('0x60')][_0x042d('0x12')]){throw new Error(_0x042d('0x93'));}if(!_0x392f32[_0x042d('0x60')]['firstName']){throw new Error(_0x042d('0x94'));}var _0x1e2e71=0x0;if(_0x392f32[_0x042d('0x60')]['UserId']){_0x1e2e71=0x1;}if(!_0x392f32[_0x042d('0x23')]){throw new Error(_0x042d('0x95'));}}catch(_0x4a236f){throw new Error(_0x042d('0x96'));}var _0x4fc28c=[];try{_0x4fc28c=_[_0x042d('0x97')](JSON['parse'](process[_0x042d('0x90')][0x4]),'id');}catch(_0x6912a7){logger[_0x042d('0x41')]('No\x20agent\x20available');}main(_0x40565e,_0x392f32,_0x4fc28c,_0x1e2e71);}validate();process['on'](_0x042d('0x98'),handleStop);process['on'](_0x042d('0x99'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 806499b..a8e82a7 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 _0xe0c6=['string','[xCALLY\x20Ticket]','toLowerCase','inbound','queue','push','variable','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','keyValue','Call\x20To','destexten','Queue','UniqueId','uniqueid','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects'];(function(_0x192da1,_0x3623ae){var _0x15749f=function(_0x18cebb){while(--_0x18cebb){_0x192da1['push'](_0x192da1['shift']());}};_0x15749f(++_0x3623ae);}(_0xe0c6,0x15f));var _0x6e0c=function(_0x475a42,_0x5867da){_0x475a42=_0x475a42-0x0;var _0x30f4d6=_0xe0c6[_0x475a42];return _0x30f4d6;};'use strict';exports[_0x6e0c('0x0')]=function(_0x2aecef,_0x5883f8){var _0x43b48e=[{'type':_0x6e0c('0x1'),'content':_0x6e0c('0x2'),'variableName':null}];switch(_0x2aecef[_0x6e0c('0x3')]()){case'voice':switch(_0x5883f8['toLowerCase']()){case _0x6e0c('0x4'):_0x43b48e['push']({'type':'variable','content':'','variableName':_0x6e0c('0x5')});_0x43b48e[_0x6e0c('0x6')]({'type':_0x6e0c('0x7'),'content':'','variableName':'calleridnum'});break;case _0x6e0c('0x8'):_0x43b48e[_0x6e0c('0x6')]({'type':_0x6e0c('0x1'),'content':_0x6e0c('0x9'),'variableName':null});_0x43b48e[_0x6e0c('0x6')]({'type':'variable','content':'','variableName':_0x6e0c('0xa')});break;}}return _0x43b48e;};exports['getDescriptions']=function(_0x3a6e82,_0x25a974){var _0x283b07=[];switch(_0x3a6e82['toLowerCase']()){case'voice':switch(_0x25a974[_0x6e0c('0x3')]()){case _0x6e0c('0x4'):_0x283b07=[{'type':_0x6e0c('0x1'),'content':_0x6e0c('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6e0c('0xc'),'keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0xd')},{'type':'keyValue','content':'','key':_0x6e0c('0xe'),'keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0xf')},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x11'),'keyType':'variable','variableName':_0x6e0c('0x12')},{'type':'keyValue','content':'','key':_0x6e0c('0x13'),'keyType':_0x6e0c('0x7'),'variableName':'queue'},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x14'),'keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0x15')},{'type':_0x6e0c('0x10'),'content':'','key':'Date','keyType':_0x6e0c('0x7'),'variableName':'agentcalledAt'},{'type':_0x6e0c('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6e0c('0x10'),'content':'','key':'Agent\x20Name','keyType':_0x6e0c('0x7'),'variableName':'destcalleridname'},{'type':_0x6e0c('0x10'),'content':'','key':'Agent\x20Number','keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0xa')},{'type':_0x6e0c('0x1'),'content':_0x6e0c('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6e0c('0x17'),'keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0x18')},{'type':'keyValue','content':'','key':_0x6e0c('0x19'),'keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0x1a')},{'type':'keyValue','content':'','key':_0x6e0c('0x1b'),'keyType':_0x6e0c('0x7'),'variableName':'agentcompleteAt'},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x1c'),'keyType':_0x6e0c('0x7'),'variableName':_0x6e0c('0x1d')},{'type':'keyValue','content':'','key':_0x6e0c('0x1e'),'keyType':'variable','variableName':_0x6e0c('0x1f')}];break;case _0x6e0c('0x8'):_0x283b07=[{'type':_0x6e0c('0x1'),'content':_0x6e0c('0xb'),'variableName':null},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x20'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x21'),'keyType':_0x6e0c('0x7'),'keyContent':'','variableName':_0x6e0c('0x22')},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x14'),'keyType':_0x6e0c('0x7'),'keyContent':'','variableName':_0x6e0c('0x15')},{'type':_0x6e0c('0x10'),'content':'','key':'Date','keyType':_0x6e0c('0x7'),'keyContent':'','variableName':_0x6e0c('0x23')},{'type':_0x6e0c('0x1'),'content':_0x6e0c('0x16')},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x24'),'keyType':'variable','keyContent':'','variableName':_0x6e0c('0x25')},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x26'),'keyType':_0x6e0c('0x7'),'keyContent':'','variableName':_0x6e0c('0x27')},{'type':'keyValue','content':'','key':_0x6e0c('0x28'),'keyType':_0x6e0c('0x7'),'keyContent':'','variableName':_0x6e0c('0x29')},{'type':_0x6e0c('0x10'),'content':'','key':_0x6e0c('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x6e0c('0x2b')}];break;}}return _0x283b07;}; \ No newline at end of file +var _0xf547=['outbound','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','duration','billableseconds','getSubjects','toLowerCase','inbound','push','variable','queue','calleridnum','string','Outbound\x20Call','getDescriptions','voice','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','calleridname','Call\x20To','destexten','Queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time'];(function(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0xf547,0x1c4));var _0x7f54=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xf547[_0x138f59];return _0x3d114d;};'use strict';exports[_0x7f54('0x0')]=function(_0x559f6a,_0x98c5d8){var _0x5d5a51=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x559f6a['toLowerCase']()){case'voice':switch(_0x98c5d8[_0x7f54('0x1')]()){case _0x7f54('0x2'):_0x5d5a51[_0x7f54('0x3')]({'type':_0x7f54('0x4'),'content':'','variableName':_0x7f54('0x5')});_0x5d5a51[_0x7f54('0x3')]({'type':'variable','content':'','variableName':_0x7f54('0x6')});break;case'outbound':_0x5d5a51[_0x7f54('0x3')]({'type':_0x7f54('0x7'),'content':_0x7f54('0x8'),'variableName':null});_0x5d5a51[_0x7f54('0x3')]({'type':_0x7f54('0x4'),'content':'','variableName':'destcalleridnum'});break;}}return _0x5d5a51;};exports[_0x7f54('0x9')]=function(_0x2487b6,_0x432270){var _0x2aab67=[];switch(_0x2487b6[_0x7f54('0x1')]()){case _0x7f54('0xa'):switch(_0x432270[_0x7f54('0x1')]()){case'inbound':_0x2aab67=[{'type':_0x7f54('0x7'),'content':_0x7f54('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7f54('0xc'),'keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x6')},{'type':_0x7f54('0xd'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x7f54('0xe')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0xf'),'keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x10')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x11'),'keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x5')},{'type':_0x7f54('0xd'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x7f54('0x12')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x13'),'keyType':_0x7f54('0x4'),'variableName':'agentcalledAt'},{'type':'string','content':_0x7f54('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x15'),'keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x16')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x17'),'keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x18')},{'type':_0x7f54('0x7'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x7f54('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x19')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x1a'),'keyType':_0x7f54('0x4'),'variableName':_0x7f54('0x1b')},{'type':'keyValue','content':'','key':_0x7f54('0x1c'),'keyType':'variable','variableName':_0x7f54('0x1d')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x1e'),'keyType':'variable','variableName':'holdtime'},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x1f'),'keyType':_0x7f54('0x4'),'variableName':'talktime'}];break;case _0x7f54('0x20'):_0x2aab67=[{'type':_0x7f54('0x7'),'content':_0x7f54('0xb'),'variableName':null},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x21'),'keyType':_0x7f54('0x4'),'keyContent':'','variableName':_0x7f54('0x18')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x22'),'keyType':_0x7f54('0x4'),'keyContent':'','variableName':_0x7f54('0x23')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x24'),'keyType':'variable','keyContent':'','variableName':_0x7f54('0x12')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x13'),'keyType':_0x7f54('0x4'),'keyContent':'','variableName':_0x7f54('0x25')},{'type':_0x7f54('0x7'),'content':_0x7f54('0x26')},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x27'),'keyType':_0x7f54('0x4'),'keyContent':'','variableName':'answertime'},{'type':_0x7f54('0xd'),'content':'','key':_0x7f54('0x28'),'keyType':_0x7f54('0x4'),'keyContent':'','variableName':_0x7f54('0x29')},{'type':_0x7f54('0xd'),'content':'','key':'Duration','keyType':_0x7f54('0x4'),'keyContent':'','variableName':_0x7f54('0x2a')},{'type':_0x7f54('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x7f54('0x4'),'keyContent':'','variableName':_0x7f54('0x2b')}];break;}}return _0x2aab67;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index c53974b..102e46e 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 _0x95cc=['fax-interactions','sms-interactions','chat-interactions','InteractionId','upperFirst','unknown','toLowerCase','toUpperCase','role','stringify','null','Interaction','findOne','update','then','info','catch','error','tracked','clone','omit','body','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x16cdc9,_0x3177bf){var _0x26a641=function(_0x50b544){while(--_0x50b544){_0x16cdc9['push'](_0x16cdc9['shift']());}};_0x26a641(++_0x3177bf);}(_0x95cc,0x163));var _0xc95c=function(_0x17d45b,_0x41abad){_0x17d45b=_0x17d45b-0x0;var _0x2755ca=_0x95cc[_0x17d45b];return _0x2755ca;};'use strict';var _=require(_0xc95c('0x0'));var db=require(_0xc95c('0x1'))['db'];var loggers={'openchannel':require(_0xc95c('0x2'))(_0xc95c('0x3')),'mail':require('../../config/logger')(_0xc95c('0x4')),'fax':require(_0xc95c('0x2'))(_0xc95c('0x5')),'sms':require(_0xc95c('0x2'))(_0xc95c('0x6')),'chat':require(_0xc95c('0x2'))(_0xc95c('0x7')),'whatsapp':require(_0xc95c('0x2'))('whatsapp-interactions')};function getInteractionId(_0x343744,_0x18023b,_0x4a0735){if(_0x343744&&_0x343744[_['upperFirst'](_0x4a0735)+_0xc95c('0x8')]){return _0x343744[_[_0xc95c('0x9')](_0x4a0735)+_0xc95c('0x8')];}else if(_0x343744&&_0x343744['id']){return _0x343744['id'];}else if(_0x18023b&&_0x18023b['id']){return _0x18023b['id'];}else{return _0xc95c('0xa');}}function log(_0x2f338c,_0x48ab11,_0x1598f9,_0x5b2134,_0x2f4af5,_0x25228a){loggers[_0x2f4af5[_0xc95c('0xb')]()][_0x2f338c]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25228a[_0xc95c('0xc')](),_0x48ab11?_0x48ab11['id']:null,_0x48ab11?_0x48ab11['name']:null,_0x48ab11?_0x48ab11[_0xc95c('0xd')]:null,getInteractionId(_0x1598f9,_0x5b2134,_0x2f4af5),_0x1598f9?JSON[_0xc95c('0xe')](_0x1598f9):_0xc95c('0xf'));}function updateUser(_0x2d79da,_0x5b2a4e,_0x4c1eb6,_0x472f5d,_0x5edde9){db[_[_0xc95c('0x9')](_0x472f5d)+_0xc95c('0x10')][_0xc95c('0x11')]({'where':{'id':getInteractionId(_0x5b2a4e,_0x4c1eb6,_0x472f5d)}})['then'](function(_0x4223c1){if(_0x4223c1){return _0x4223c1[_0xc95c('0x12')]({'UserId':_0x2d79da?_0x2d79da['id']:null});}})[_0xc95c('0x13')](function(_0x228ecd){if(_0x228ecd){log(_0xc95c('0x14'),_0x2d79da,_0x5b2a4e,_0x4c1eb6,_0x472f5d,_0x5edde9);}})[_0xc95c('0x15')](function(){log(_0xc95c('0x16'),_0x2d79da,_0x5b2a4e,_0x4c1eb6,_0x472f5d,_0x5edde9);});}exports[_0xc95c('0x17')]=function(_0x3e31aa,_0x57e067){return function(_0x31a7e7,_0x1262bc,_0x5d843f){var _0x5d3497=_0x31a7e7['user'];var _0x236d33={};var _0x93ac44=_0x31a7e7['query'];if(_0x236d33){_0x236d33=_[_0xc95c('0x18')](_0x31a7e7['body']);_0x236d33=_[_0xc95c('0x19')](_0x236d33,[_0xc95c('0x1a'),_0xc95c('0x1b'),_0xc95c('0x1c'),'fax',_0xc95c('0x1d')]);}updateUser(_0x5d3497,_0x236d33,_0x93ac44,_0x3e31aa,_0x57e067);_0x5d843f(null);};}; \ No newline at end of file +var _0x588c=['body','omit','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','update','then','catch','error','tracked','user','query','clone'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x588c,0x144));var _0xc588=function(_0x27a737,_0x55754f){_0x27a737=_0x27a737-0x0;var _0x11cbed=_0x588c[_0x27a737];return _0x11cbed;};'use strict';var _=require(_0xc588('0x0'));var db=require(_0xc588('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xc588('0x2'))(_0xc588('0x3')),'fax':require(_0xc588('0x2'))(_0xc588('0x4')),'sms':require('../../config/logger')(_0xc588('0x5')),'chat':require(_0xc588('0x2'))(_0xc588('0x6')),'whatsapp':require(_0xc588('0x2'))('whatsapp-interactions')};function getInteractionId(_0x92124c,_0x1936c5,_0xeb0748){if(_0x92124c&&_0x92124c[_['upperFirst'](_0xeb0748)+_0xc588('0x7')]){return _0x92124c[_[_0xc588('0x8')](_0xeb0748)+_0xc588('0x7')];}else if(_0x92124c&&_0x92124c['id']){return _0x92124c['id'];}else if(_0x1936c5&&_0x1936c5['id']){return _0x1936c5['id'];}else{return _0xc588('0x9');}}function log(_0x3582f9,_0x616c12,_0x10daa3,_0x6c7605,_0x20a1b7,_0xb1c7d7){loggers[_0x20a1b7['toLowerCase']()][_0x3582f9](_0xc588('0xa'),_0xb1c7d7[_0xc588('0xb')](),_0x616c12?_0x616c12['id']:null,_0x616c12?_0x616c12[_0xc588('0xc')]:null,_0x616c12?_0x616c12[_0xc588('0xd')]:null,getInteractionId(_0x10daa3,_0x6c7605,_0x20a1b7),_0x10daa3?JSON[_0xc588('0xe')](_0x10daa3):_0xc588('0xf'));}function updateUser(_0x581166,_0x2c6544,_0x13c9d1,_0x1fc29d,_0x54b1df){db[_['upperFirst'](_0x1fc29d)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x2c6544,_0x13c9d1,_0x1fc29d)}})['then'](function(_0x4a3b3a){if(_0x4a3b3a){return _0x4a3b3a[_0xc588('0x10')]({'UserId':_0x581166?_0x581166['id']:null});}})[_0xc588('0x11')](function(_0x1d07cf){if(_0x1d07cf){log('info',_0x581166,_0x2c6544,_0x13c9d1,_0x1fc29d,_0x54b1df);}})[_0xc588('0x12')](function(){log(_0xc588('0x13'),_0x581166,_0x2c6544,_0x13c9d1,_0x1fc29d,_0x54b1df);});}exports[_0xc588('0x14')]=function(_0x1c49e4,_0x53c9de){return function(_0x57c790,_0x142351,_0x5b6c38){var _0x4070f2=_0x57c790[_0xc588('0x15')];var _0x5524ac={};var _0x294814=_0x57c790[_0xc588('0x16')];if(_0x5524ac){_0x5524ac=_[_0xc588('0x17')](_0x57c790[_0xc588('0x18')]);_0x5524ac=_[_0xc588('0x19')](_0x5524ac,[_0xc588('0x18'),'html',_0xc588('0x1a'),_0xc588('0x1b'),_0xc588('0x1c')]);}updateUser(_0x4070f2,_0x5524ac,_0x294814,_0x1c49e4,_0x53c9de);_0x5b6c38(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 782b70f..f5d4ce8 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 _0x4f9e=['admin','user','isUserLimit','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User'];(function(_0x5b84e5,_0x26076b){var _0xff9066=function(_0x3f17df){while(--_0x3f17df){_0x5b84e5['push'](_0x5b84e5['shift']());}};_0xff9066(++_0x26076b);}(_0x4f9e,0x87));var _0xe4f9=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x4f9e[_0x36b037];return _0x409194;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xe4f9('0x0'));function getValueFromLicense(_0x34a139,_0x231be7){if(_0x34a139&&_0x231be7){if(_0x231be7[_0xe4f9('0x1')]&&_0x231be7[_0xe4f9('0x2')]){var _0x26c347=_0x231be7[_0xe4f9('0x1')];var _0xaf3b73=_0x231be7[_0xe4f9('0x2')];var _0x2fbd08=_0x26c347[_0xe4f9('0x3')]('-')[0x4];var _0x3d4454=_0x26c347['split']('-')[0x0];var _0x37d794=crypto[_0xe4f9('0x4')](_0xe4f9('0x5'),util[_0xe4f9('0x6')](_0xe4f9('0x7'),_0x2fbd08,_0x26c347,_0x3d4454));var _0x33cda0=_0x37d794[_0xe4f9('0x8')](_0xaf3b73,'base64',_0xe4f9('0x9'));_0x33cda0+=_0x37d794['final']('utf8');var _0x2e6db5=JSON[_0xe4f9('0xa')](_0x33cda0);return _0x2e6db5[_0xe4f9('0xb')](_0x34a139)?_0x2e6db5[_0x34a139]:null;}}return null;}function isLimit(_0x57db38,_0x5cf280,_0x5b90c1,_0x4dd8ff){var _0x450ca7=_0x5cf280;return compose()[_0xe4f9('0xc')](function(_0x287bee,_0x11b010,_0x13b162){return db['License'][_0xe4f9('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xe4f9('0xe')](function(_0x335980){var _0x219eca=getValueFromLicense(_0x57db38,_0x335980);return _0x219eca?_0x219eca:_0x450ca7;})['then'](function(_0x2cfda4){_0x450ca7=_0x2cfda4;return _0x5b90c1['count'](_0x4dd8ff);})['then'](function(_0x5d8370){if(_0x5d8370>=_0x450ca7){return _0x11b010[_0xe4f9('0xf')](0x193)[_0xe4f9('0x10')]({'message':util[_0xe4f9('0x6')](_0xe4f9('0x11'),_0x57db38)});}_0x13b162();})['catch'](function(_0x4aa57c){_0x13b162(_0x4aa57c);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xe4f9('0x12')],{'where':{'$or':[{'role':_0xe4f9('0x13')},{'role':_0xe4f9('0x14')}]}});}exports[_0xe4f9('0x15')]=isUserLimit; \ No newline at end of file +var _0x4b46=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','then'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4b46,0xf8));var _0x64b4=function(_0x2d0807,_0x392f02){_0x2d0807=_0x2d0807-0x0;var _0x308e66=_0x4b46[_0x2d0807];return _0x308e66;};'use strict';var crypto=require('crypto');var util=require(_0x64b4('0x0'));var compose=require('composable-middleware');var db=require(_0x64b4('0x1'))['db'];var config=require(_0x64b4('0x2'));function getValueFromLicense(_0x2cadc4,_0x38a7db){if(_0x2cadc4&&_0x38a7db){if(_0x38a7db[_0x64b4('0x3')]&&_0x38a7db[_0x64b4('0x4')]){var _0x1c6e24=_0x38a7db[_0x64b4('0x3')];var _0x340f77=_0x38a7db[_0x64b4('0x4')];var _0x4838fc=_0x1c6e24[_0x64b4('0x5')]('-')[0x4];var _0x43457d=_0x1c6e24[_0x64b4('0x5')]('-')[0x0];var _0x4e7a87=crypto['createDecipher'](_0x64b4('0x6'),util[_0x64b4('0x7')](_0x64b4('0x8'),_0x4838fc,_0x1c6e24,_0x43457d));var _0x5cfdee=_0x4e7a87['update'](_0x340f77,_0x64b4('0x9'),_0x64b4('0xa'));_0x5cfdee+=_0x4e7a87[_0x64b4('0xb')]('utf8');var _0x47b4b3=JSON[_0x64b4('0xc')](_0x5cfdee);return _0x47b4b3[_0x64b4('0xd')](_0x2cadc4)?_0x47b4b3[_0x2cadc4]:null;}}return null;}function isLimit(_0x545c4b,_0x57e029,_0x5c1066,_0xa80366){var _0x3cc7ce=_0x57e029;return compose()[_0x64b4('0xe')](function(_0x10ec03,_0x5c328d,_0x199303){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x22d5fb){var _0x22f079=getValueFromLicense(_0x545c4b,_0x22d5fb);return _0x22f079?_0x22f079:_0x3cc7ce;})[_0x64b4('0xf')](function(_0x9ac58a){_0x3cc7ce=_0x9ac58a;return _0x5c1066['count'](_0xa80366);})['then'](function(_0x4db728){if(_0x4db728>=_0x3cc7ce){return _0x5c328d[_0x64b4('0x10')](0x193)[_0x64b4('0x11')]({'message':util[_0x64b4('0x7')](_0x64b4('0x12'),_0x545c4b)});}_0x199303();})[_0x64b4('0x13')](function(_0x53d21a){_0x199303(_0x53d21a);});});}function isUserLimit(){return isLimit(_0x64b4('0x14'),0x1,db[_0x64b4('0x15')],{'where':{'$or':[{'role':_0x64b4('0x16')},{'role':'user'}]}});}exports[_0x64b4('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f42452f..3be927a 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 _0x32ef=['text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$notIn','start','shift','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','filter','map','conditions','push','buildExpression','$eq','operator','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo'];(function(_0x4ea43f,_0x2c334b){var _0x1293de=function(_0x41b278){while(--_0x41b278){_0x4ea43f['push'](_0x4ea43f['shift']());}};_0x1293de(++_0x2c334b);}(_0x32ef,0x135));var _0xf32e=function(_0x47bfa9,_0x35afd9){_0x47bfa9=_0x47bfa9-0x0;var _0x16de27=_0x32ef[_0x47bfa9];return _0x16de27;};'use strict';var _=require(_0xf32e('0x0'));var moment=require(_0xf32e('0x1'));exports[_0xf32e('0x2')]=function(_0x4bad99){var _0x416cc1={'conditions':[]};_0x416cc1['sqlOperator']=_[_0xf32e('0x3')](_0x4bad99,_0xf32e('0x4'))?'or':_0xf32e('0x5');var _0x2592c2=_0x4bad99[_0xf32e('0x6')](_0xf32e('0x7'),'')[_0xf32e('0x6')](_0xf32e('0x4'),'')[_0xf32e('0x8')]('||');for(var _0x28505b=0x0;_0x28505b<_0x2592c2[_0xf32e('0x9')];_0x28505b++){var _0x22e3b0=_0x2592c2[_0x28505b][_0xf32e('0x8')](':=');var _0x44910d=_0x22e3b0[0x0];var _0x1d833e=_0x22e3b0[_0xf32e('0xa')](0x1);_0x1d833e[_0xf32e('0xb')](function(_0x4e7090){var _0x44308a=_0x4e7090['split']('[')['shift']();var _0x5ddb0f=_0x4e7090['match'](/\[(.*?)\]/g);_0x5ddb0f['forEach'](function(_0x2a84b3){var _0x430252=_0x2a84b3[_0xf32e('0x8')]('[')[_0xf32e('0xc')](function(_0x46a7f0){return _0x46a7f0['indexOf'](']')>-0x1;})[_0xf32e('0xd')](function(_0x1db890){return _0x1db890[_0xf32e('0x8')](']')[0x0];})[0x0];_0x416cc1[_0xf32e('0xe')][_0xf32e('0xf')]({'field':_0x44910d,'operator':_0x44308a,'value':_0x430252});});});}return _0x416cc1;};exports[_0xf32e('0x10')]=function(_0x46546b,_0x2c58ee,_0x555cb4){var _0xdc8a2e={};if(_0x2c58ee==='DATE'){if(_0x555cb4['operator']===_0xf32e('0x11')){_0x555cb4[_0xf32e('0x12')]='$between';_0x555cb4[_0xf32e('0x13')]+=','+_0x555cb4['value'];}else if(_[_0xf32e('0x14')]([_0xf32e('0x15'),_0xf32e('0x16')],_0x555cb4[_0xf32e('0x12')])){_0x555cb4['value']=moment(_0x555cb4['value'])[_0xf32e('0x17')](0x1,'days')[_0xf32e('0x18')](_0xf32e('0x19'));}}if(_0x555cb4[_0xf32e('0x1a')]){_0x2c58ee=_0x555cb4[_0xf32e('0x1a')];_0xdc8a2e[_0xf32e('0x1b')]=_0xf32e('0x1c')+_0x46546b+'.'+_0x555cb4[_0xf32e('0x1d')]+_0xf32e('0x1e')+_0x555cb4[_0xf32e('0x1a')]+')\x20'+parseOperator(_0x555cb4[_0xf32e('0x12')]);}else{_0xdc8a2e[_0xf32e('0x1b')]=_0x46546b+'.'+_0x555cb4[_0xf32e('0x1d')]+'\x20'+parseOperator(_0x555cb4[_0xf32e('0x12')]);}if(_[_0xf32e('0x14')]([_0xf32e('0x1f'),'$notIn'],_0x555cb4['operator']))_0xdc8a2e['text']='('+_0xdc8a2e[_0xf32e('0x1b')]+_0xf32e('0x20')+_0x46546b+'.'+_0x555cb4[_0xf32e('0x1d')]+'\x20IS\x20NULL)';_0xdc8a2e[_0xf32e('0x13')]=parseValue(_0x2c58ee,_0x555cb4[_0xf32e('0x12')],_0x555cb4[_0xf32e('0x13')]);return _0xdc8a2e;};function parseOperator(_0x298593){var _0x54bae9;switch(_0x298593){case _0xf32e('0x21'):_0x54bae9=_0xf32e('0x22');break;case'$notIn':_0x54bae9=_0xf32e('0x23');break;case _0xf32e('0x11'):_0x54bae9='=\x20?';break;case _0xf32e('0x1f'):_0x54bae9=_0xf32e('0x24');break;case _0xf32e('0x25'):case _0xf32e('0x26'):case _0xf32e('0x27'):_0x54bae9='LIKE\x20?';break;case'$lt':_0x54bae9=_0xf32e('0x28');break;case _0xf32e('0x15'):_0x54bae9=_0xf32e('0x29');break;case _0xf32e('0x16'):_0x54bae9=_0xf32e('0x2a');break;case _0xf32e('0x2b'):_0x54bae9=_0xf32e('0x2c');break;case _0xf32e('0x2d'):_0x54bae9=_0xf32e('0x2e');break;}return _0x54bae9;}function parseValue(_0x256685,_0x48f489,_0x41509d){var _0x2bb526={'start':undefined,'end':undefined};switch(_0x48f489){case'$in':case _0xf32e('0x2f'):_0x2bb526[_0xf32e('0x30')]=_0x41509d[_0xf32e('0x8')](',');break;case'$substring':_0x2bb526[_0xf32e('0x30')]='%'+_0x41509d+'%';break;case _0xf32e('0x26'):_0x2bb526['start']=_0x41509d+'%';break;case _0xf32e('0x27'):_0x2bb526['start']='%'+_0x41509d;break;case _0xf32e('0x2d'):var _0x2e24d0=_0x41509d[_0xf32e('0x8')](',');var _0x41509d=_0x2e24d0[_0xf32e('0x31')]();var _0x532588=_0x2e24d0[_0xf32e('0x32')]();if(_0x256685===_0xf32e('0x33')){_0x41509d=moment(_0x41509d)[_0xf32e('0x34')](0x0,!![])['format']();_0x532588=moment(_0x532588)[_0xf32e('0x34')](0x0,!![])[_0xf32e('0x17')](0x17,_0xf32e('0x35'))[_0xf32e('0x17')](0x3b,_0xf32e('0x36'))[_0xf32e('0x17')](0x3b,_0xf32e('0x37'))[_0xf32e('0x18')]();}_0x2bb526={'start':_0x41509d,'end':_0x532588};break;default:_0x2bb526['start']=_0x41509d;break;}return _0x2bb526;} \ No newline at end of file +var _0x6960=['moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','length','split','slice','forEach','shift','match','filter','indexOf','map','conditions','operator','$between','value','includes','$lte','YYYY-MM-DD','text','CAST(','\x20AS\x20','castTo','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$eq','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$gt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$substring','start','DATE','utcOffset','format','add','hours','lodash'];(function(_0x16bb1c,_0x58f468){var _0xace56c=function(_0x216f59){while(--_0x216f59){_0x16bb1c['push'](_0x16bb1c['shift']());}};_0xace56c(++_0x58f468);}(_0x6960,0xcf));var _0x0696=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6960[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0696('0x0'));var moment=require(_0x0696('0x1'));exports[_0x0696('0x2')]=function(_0x1e022e){var _0x3f48a5={'conditions':[]};_0x3f48a5[_0x0696('0x3')]=_[_0x0696('0x4')](_0x1e022e,_0x0696('0x5'))?'or':_0x0696('0x6');var _0x5baf70=_0x1e022e['replace']('[$and]','')[_0x0696('0x7')](_0x0696('0x5'),'')['split']('||');for(var _0x1093d3=0x0;_0x1093d3<_0x5baf70[_0x0696('0x8')];_0x1093d3++){var _0x28eae4=_0x5baf70[_0x1093d3][_0x0696('0x9')](':=');var _0x1b8e4c=_0x28eae4[0x0];var _0x38622d=_0x28eae4[_0x0696('0xa')](0x1);_0x38622d[_0x0696('0xb')](function(_0x2ea9b4){var _0x4c52e0=_0x2ea9b4[_0x0696('0x9')]('[')[_0x0696('0xc')]();var _0x32753d=_0x2ea9b4[_0x0696('0xd')](/\[(.*?)\]/g);_0x32753d[_0x0696('0xb')](function(_0x451fd4){var _0x533835=_0x451fd4[_0x0696('0x9')]('[')[_0x0696('0xe')](function(_0x45d02d){return _0x45d02d[_0x0696('0xf')](']')>-0x1;})[_0x0696('0x10')](function(_0x304091){return _0x304091[_0x0696('0x9')](']')[0x0];})[0x0];_0x3f48a5[_0x0696('0x11')]['push']({'field':_0x1b8e4c,'operator':_0x4c52e0,'value':_0x533835});});});}return _0x3f48a5;};exports['buildExpression']=function(_0x2f38cb,_0x540299,_0x5b5455){var _0x504993={};if(_0x540299==='DATE'){if(_0x5b5455[_0x0696('0x12')]==='$eq'){_0x5b5455[_0x0696('0x12')]=_0x0696('0x13');_0x5b5455[_0x0696('0x14')]+=','+_0x5b5455[_0x0696('0x14')];}else if(_[_0x0696('0x15')](['$gt',_0x0696('0x16')],_0x5b5455['operator'])){_0x5b5455[_0x0696('0x14')]=moment(_0x5b5455[_0x0696('0x14')])['add'](0x1,'days')['format'](_0x0696('0x17'));}}if(_0x5b5455['castTo']){_0x540299=_0x5b5455['castTo'];_0x504993[_0x0696('0x18')]=_0x0696('0x19')+_0x2f38cb+'.'+_0x5b5455['field']+_0x0696('0x1a')+_0x5b5455[_0x0696('0x1b')]+')\x20'+parseOperator(_0x5b5455[_0x0696('0x12')]);}else{_0x504993['text']=_0x2f38cb+'.'+_0x5b5455[_0x0696('0x1c')]+'\x20'+parseOperator(_0x5b5455[_0x0696('0x12')]);}if(_[_0x0696('0x15')]([_0x0696('0x1d'),_0x0696('0x1e')],_0x5b5455[_0x0696('0x12')]))_0x504993[_0x0696('0x18')]='('+_0x504993[_0x0696('0x18')]+_0x0696('0x1f')+_0x2f38cb+'.'+_0x5b5455['field']+_0x0696('0x20');_0x504993['value']=parseValue(_0x540299,_0x5b5455[_0x0696('0x12')],_0x5b5455[_0x0696('0x14')]);return _0x504993;};function parseOperator(_0x28f3f5){var _0x432240;switch(_0x28f3f5){case _0x0696('0x21'):_0x432240=_0x0696('0x22');break;case _0x0696('0x1e'):_0x432240='NOT\x20IN\x20?';break;case _0x0696('0x23'):_0x432240='=\x20?';break;case _0x0696('0x1d'):_0x432240=_0x0696('0x24');break;case'$substring':case _0x0696('0x25'):case _0x0696('0x26'):_0x432240=_0x0696('0x27');break;case'$lt':_0x432240='<\x20?';break;case _0x0696('0x28'):_0x432240=_0x0696('0x29');break;case'$lte':_0x432240='<=\x20?';break;case _0x0696('0x2a'):_0x432240=_0x0696('0x2b');break;case _0x0696('0x13'):_0x432240=_0x0696('0x2c');break;}return _0x432240;}function parseValue(_0x1c57d2,_0x57417e,_0x750b2d){var _0x32003d={'start':undefined,'end':undefined};switch(_0x57417e){case'$in':case _0x0696('0x1e'):_0x32003d['start']=_0x750b2d['split'](',');break;case _0x0696('0x2d'):_0x32003d[_0x0696('0x2e')]='%'+_0x750b2d+'%';break;case _0x0696('0x25'):_0x32003d[_0x0696('0x2e')]=_0x750b2d+'%';break;case'$endsWith':_0x32003d[_0x0696('0x2e')]='%'+_0x750b2d;break;case _0x0696('0x13'):var _0x3b3ead=_0x750b2d['split'](',');var _0x750b2d=_0x3b3ead[_0x0696('0xc')]();var _0x4447fe=_0x3b3ead['pop']();if(_0x1c57d2===_0x0696('0x2f')){_0x750b2d=moment(_0x750b2d)[_0x0696('0x30')](0x0,!![])[_0x0696('0x31')]();_0x4447fe=moment(_0x4447fe)[_0x0696('0x30')](0x0,!![])[_0x0696('0x32')](0x17,_0x0696('0x33'))[_0x0696('0x32')](0x3b,'minutes')[_0x0696('0x32')](0x3b,'seconds')[_0x0696('0x31')]();}_0x32003d={'start':_0x750b2d,'end':_0x4447fe};break;default:_0x32003d[_0x0696('0x2e')]=_0x750b2d;break;}return _0x32003d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ee7e087..d695aa7 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 _0xf494=['DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','name','uniqueid','isArray','sort','map','indexOf','priority','col','unsigned','DESC','cast','length','isObject','isString','unset','omit','isNumeric','^[+]?[0-9]*$','isEmail','replace','match','push','join','getOptions','query','$id','intersection','model','attributes','hasOwnProperty','nolimit','limit','offset','where','pick','filter','object','columns','value','type','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','forOwn'];(function(_0x44a4c4,_0x440b0c){var _0x47adb8=function(_0xd43d22){while(--_0xd43d22){_0x44a4c4['push'](_0x44a4c4['shift']());}};_0x47adb8(++_0x440b0c);}(_0xf494,0x1c6));var _0x4f49=function(_0x1a2d5e,_0x4c16fe){_0x1a2d5e=_0x1a2d5e-0x0;var _0x19a8bd=_0xf494[_0x1a2d5e];return _0x19a8bd;};'use strict';var _=require(_0x4f49('0x0'));var sequelize=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x52d22c){var _0x3aeeb8=['ne'];try{var _0x1d54cc=JSON[_0x4f49('0x3')](_0x52d22c);var _0x25677c=Object[_0x4f49('0x4')](_0x1d54cc)[0x0];return _0x3aeeb8[_0x4f49('0x5')](_0x25677c);}catch(_0x3267c1){return![];}}function getOperatorValue(_0x790e8b){var _0xc5e778=JSON[_0x4f49('0x3')](_0x790e8b);var _0x42b0e8=Object['keys'](_0xc5e778)[0x0];var _0x58e9a0=_0xc5e778[_0x42b0e8];return{['$'+_0x42b0e8]:_0x58e9a0};}exports[_0x4f49('0x6')]=function(_0x327bd5){var _0x31a725=null;if(_0x327bd5){_0x31a725=_0x327bd5[_0x4f49('0x7')](',');}return _0x31a725;};exports[_0x4f49('0x8')]=function(_0x174d0d,_0x151d8c){var _0x410884={};if(!_['isEmpty'](_0x174d0d)){_[_0x4f49('0x9')](_0x174d0d,function(_0x411759,_0x5bcfe5){try{if(_0x151d8c){var _0x15e7a1=_['find'](_0x151d8c,{'name':_0x5bcfe5})||{};if(hasSequelizeOperator(_0x411759)){_0x410884[_0x5bcfe5]=getOperatorValue(_0x411759);}else if(_0x15e7a1['type']===_0x4f49('0xa')&&_[_0x4f49('0xb')](_0x411759)){var _0x4bf89f=JSON[_0x4f49('0x3')](_0x411759);var _0x111a8b={'$gte':moment(moment(_0x4bf89f[_0x4f49('0xc')])[_0x4f49('0xd')](_0x4f49('0xe')))[_0x4f49('0xf')]()[_0x4f49('0xd')](),'$lte':moment(moment(_0x4bf89f['$lte'])[_0x4f49('0xd')](_0x4f49('0xe')))[_0x4f49('0xf')]()['subtract'](0x1,'s')['format']()};_0x410884[_0x5bcfe5]=_0x111a8b;}else if(_0x15e7a1[_0x4f49('0x10')]===_0x4f49('0x11')){_0x410884[_0x5bcfe5]=_0x411759;}else{_0x410884[_0x5bcfe5]=_[_0x4f49('0x12')](_0x411759)?_0x411759:JSON['parse'](_0x411759);}}else{_0x410884[_0x5bcfe5]=_[_0x4f49('0x12')](_0x411759)?_0x411759:JSON[_0x4f49('0x3')](_0x411759);}}catch(_0x4e85df){_0x410884[_0x5bcfe5]=_0x411759['split'](',');}});}return _0x410884;};exports['limit']=function(_0x560592){_0x560592=parseInt(_0x560592,0xa);if(!_0x560592||_0x560592<0x0){_0x560592=LIMIT_VALUE;}return _0x560592;};exports['offset']=function(_0xb2081a){_0xb2081a=parseInt(_0xb2081a,0xa);if(!_0xb2081a||_0xb2081a<0x0){_0xb2081a=0x0;}return _0xb2081a;};exports[_0x4f49('0x13')]=function(_0x1c2d70){var _0x407042,_0x5793ac=null;if(_0x1c2d70){_0x407042=_0x1c2d70[_0x4f49('0x7')](',');_0x5793ac=_[_0x4f49('0x14')](_0x407042,function(_0x197a49){if(_0x197a49[_0x4f49('0x15')]('-')===0x0){return[_0x197a49===_0x4f49('0x16')?sequelize['cast'](sequelize[_0x4f49('0x17')](_0x4f49('0x16')),_0x4f49('0x18')):_0x197a49['substr'](0x1),_0x4f49('0x19')];}else{return[_0x197a49===_0x4f49('0x16')?sequelize[_0x4f49('0x1a')](sequelize[_0x4f49('0x17')](_0x4f49('0x16')),_0x4f49('0x18')):_0x197a49,'ASC'];}});}return _0x5793ac;};exports['omit']=function(_0x3a947b,_0x429de7){if(_['isEmpty'](_0x3a947b)){return _0x3a947b;}if(_[_0x4f49('0x12')](_0x3a947b)){for(var _0x2c1519=0x0;_0x2c1519<_0x3a947b[_0x4f49('0x1b')];_0x2c1519+=0x1){_0x3a947b[_0x2c1519]=this['omit'](_0x3a947b[_0x2c1519],_0x429de7);}return _0x3a947b;}if(!_[_0x4f49('0x1c')](_0x3a947b)){return _0x3a947b;}if(_[_0x4f49('0x1d')](_0x429de7)){_0x429de7=[_0x429de7];}if(!_[_0x4f49('0x12')](_0x429de7)){return _0x3a947b;}for(var _0x148153=0x0;_0x148153<_0x429de7[_0x4f49('0x1b')];_0x148153+=0x1){_[_0x4f49('0x1e')](_0x3a947b,_0x429de7[_0x148153]);}for(var _0x4915af in _0x3a947b){if(_0x3a947b['hasOwnProperty'](_0x4915af)){_0x3a947b[_0x4915af]=this[_0x4f49('0x1f')](_0x3a947b[_0x4915af],_0x429de7);}}return _0x3a947b;};exports[_0x4f49('0x20')]=function(_0x605c91){return _0x605c91['match'](RegExp(_0x4f49('0x21')))?!![]:![];};exports[_0x4f49('0x22')]=function(_0x43d8e3){return _0x43d8e3['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3e207f){var _0x27d004=[];_0x3e207f[_0x4f49('0x7')](/[ ,]+/)['forEach'](function(_0x1eaac6){_0x1eaac6=_0x1eaac6[_0x4f49('0x23')](/([^:]")"+/g,'$1');_0x1eaac6='+'+_0x1eaac6+'*';var _0x173657=/[ `!@#$%^&*()_\-?~]/;if(_0x1eaac6[_0x4f49('0x24')](_0x173657))_0x1eaac6='\x22'+_0x1eaac6+'\x22';_0x27d004[_0x4f49('0x25')](_0x1eaac6);});return _0x27d004[_0x4f49('0x26')]('\x20');};exports[_0x4f49('0x27')]=function(_0x45ae19,_0x1f38d3,_0x310ee2){var _0x2291d4={},_0xf65ac6={};if(_0x1f38d3[_0x4f49('0x28')][_0x4f49('0x29')]){_0x1f38d3[_0x4f49('0x28')]['id']=_0x1f38d3[_0x4f49('0x28')][_0x4f49('0x29')];delete _0x1f38d3[_0x4f49('0x28')][_0x4f49('0x29')];}_0x2291d4['model']=_[_0x4f49('0x14')](_0x45ae19,_0x4f49('0x10'));_0x2291d4[_0x4f49('0x28')]=_[_0x4f49('0x4')](_0x1f38d3[_0x4f49('0x28')]);_0x2291d4[_0x4f49('0x8')]=_[_0x4f49('0x2a')](_0x2291d4[_0x4f49('0x2b')],_0x2291d4[_0x4f49('0x28')]);_0xf65ac6[_0x4f49('0x2c')]=_[_0x4f49('0x2a')](_0x2291d4[_0x4f49('0x2b')],this[_0x4f49('0x6')](_0x1f38d3['query'][_0x4f49('0x6')]));_0xf65ac6[_0x4f49('0x2c')]=_0xf65ac6[_0x4f49('0x2c')][_0x4f49('0x1b')]?_0xf65ac6[_0x4f49('0x2c')]:_0x2291d4[_0x4f49('0x2b')];if(!_0x1f38d3[_0x4f49('0x28')][_0x4f49('0x2d')](_0x4f49('0x2e'))){_0xf65ac6[_0x4f49('0x2f')]=this[_0x4f49('0x2f')](_0x1f38d3[_0x4f49('0x28')][_0x4f49('0x2f')]);_0xf65ac6[_0x4f49('0x30')]=this['offset'](_0x1f38d3[_0x4f49('0x28')][_0x4f49('0x30')]);}_0xf65ac6['order']=this[_0x4f49('0x13')](_0x1f38d3[_0x4f49('0x28')]['sort']);_0xf65ac6[_0x4f49('0x31')]=this[_0x4f49('0x8')](_[_0x4f49('0x32')](_0x1f38d3[_0x4f49('0x28')],_0x2291d4[_0x4f49('0x8')]),_0x45ae19);if(_0x1f38d3[_0x4f49('0x28')][_0x4f49('0x33')]){var _0x5d464e=_0x45ae19;var _0x5e1461=_0x1f38d3['query'][_0x4f49('0x33')];if(typeof _0x5e1461===_0x4f49('0x34')){_0x5d464e=_[_0x4f49('0x33')](_0x45ae19,function(_0x373f90){return _[_0x4f49('0x5')](_0x5e1461[_0x4f49('0x35')],_0x373f90[_0x4f49('0x10')]);});_0x5e1461=_0x5e1461[_0x4f49('0x36')];}_0xf65ac6[_0x4f49('0x31')]=_['merge'](_0xf65ac6['where'],{'$or':_[_0x4f49('0x14')](_0x5d464e,function(_0x432b5d){if(_0x432b5d[_0x4f49('0x37')]!=='VIRTUAL'){if(_0x310ee2){return sequelize[_0x4f49('0x31')](sequelize['fn']('lower',sequelize['col'](_0x432b5d[_0x4f49('0x10')])),{'$like':sequelize['fn'](_0x4f49('0x38'),'%'+_0x1f38d3[_0x4f49('0x28')]['filter']+'%')});}else{var _0x287781={};_0x287781[_0x432b5d[_0x4f49('0x10')]]={'$like':'%'+_0x1f38d3['query'][_0x4f49('0x33')]+'%'};return _0x287781;}}})});}_0xf65ac6=_['merge']({},_0xf65ac6,_0x1f38d3[_0x4f49('0x39')]);return _0xf65ac6;}; \ No newline at end of file +var _0x0faf=['value','where','merge','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','isEmpty','forOwn','type','isPlainObject','$gte','utc','$lte','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','filters','intersection','attributes','fields','length','offset','order','pick','filter','object','columns'];(function(_0x17f96b,_0x76a64c){var _0x5c90d5=function(_0x141e85){while(--_0x141e85){_0x17f96b['push'](_0x17f96b['shift']());}};_0x5c90d5(++_0x76a64c);}(_0x0faf,0x132));var _0xf0fa=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0x0faf[_0x2f4d41];return _0x3b0bb2;};'use strict';var _=require(_0xf0fa('0x0'));var sequelize=require('sequelize');var moment=require(_0xf0fa('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b4763){var _0x2c6207=['ne'];try{var _0x35a260=JSON[_0xf0fa('0x2')](_0x1b4763);var _0xdc9ce3=Object[_0xf0fa('0x3')](_0x35a260)[0x0];return _0x2c6207[_0xf0fa('0x4')](_0xdc9ce3);}catch(_0x283f04){return![];}}function getOperatorValue(_0x5d9b58){var _0x3637a3=JSON[_0xf0fa('0x2')](_0x5d9b58);var _0x25b5c4=Object[_0xf0fa('0x3')](_0x3637a3)[0x0];var _0x2db1d9=_0x3637a3[_0x25b5c4];return{['$'+_0x25b5c4]:_0x2db1d9};}exports['fields']=function(_0x42f7fd){var _0x18db40=null;if(_0x42f7fd){_0x18db40=_0x42f7fd['split'](',');}return _0x18db40;};exports['filters']=function(_0x3bda51,_0x1e8cc0){var _0x25dfec={};if(!_[_0xf0fa('0x5')](_0x3bda51)){_[_0xf0fa('0x6')](_0x3bda51,function(_0x1151ea,_0x379ff6){try{if(_0x1e8cc0){var _0x20fd09=_['find'](_0x1e8cc0,{'name':_0x379ff6})||{};if(hasSequelizeOperator(_0x1151ea)){_0x25dfec[_0x379ff6]=getOperatorValue(_0x1151ea);}else if(_0x20fd09[_0xf0fa('0x7')]==='DATE'&&_[_0xf0fa('0x8')](_0x1151ea)){var _0x521034=JSON[_0xf0fa('0x2')](_0x1151ea);var _0x17326f={'$gte':moment(moment(_0x521034[_0xf0fa('0x9')])['format']('YYYY-MM-DD'))[_0xf0fa('0xa')]()['format'](),'$lte':moment(moment(_0x521034[_0xf0fa('0xb')])[_0xf0fa('0xc')](_0xf0fa('0xd')))[_0xf0fa('0xa')]()[_0xf0fa('0xe')](0x1,'s')[_0xf0fa('0xc')]()};_0x25dfec[_0x379ff6]=_0x17326f;}else if(_0x20fd09[_0xf0fa('0xf')]===_0xf0fa('0x10')){_0x25dfec[_0x379ff6]=_0x1151ea;}else{_0x25dfec[_0x379ff6]=_['isArray'](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}else{_0x25dfec[_0x379ff6]=_[_0xf0fa('0x11')](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}catch(_0x1d3c22){_0x25dfec[_0x379ff6]=_0x1151ea[_0xf0fa('0x12')](',');}});}return _0x25dfec;};exports[_0xf0fa('0x13')]=function(_0x5ba2eb){_0x5ba2eb=parseInt(_0x5ba2eb,0xa);if(!_0x5ba2eb||_0x5ba2eb<0x0){_0x5ba2eb=LIMIT_VALUE;}return _0x5ba2eb;};exports['offset']=function(_0x2f376d){_0x2f376d=parseInt(_0x2f376d,0xa);if(!_0x2f376d||_0x2f376d<0x0){_0x2f376d=0x0;}return _0x2f376d;};exports[_0xf0fa('0x14')]=function(_0x151d09){var _0x2385e2,_0x1a3620=null;if(_0x151d09){_0x2385e2=_0x151d09[_0xf0fa('0x12')](',');_0x1a3620=_[_0xf0fa('0x15')](_0x2385e2,function(_0x3de639){if(_0x3de639[_0xf0fa('0x16')]('-')===0x0){return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize['col'](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639[_0xf0fa('0x1a')](0x1),_0xf0fa('0x1b')];}else{return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize[_0xf0fa('0x1c')](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639,'ASC'];}});}return _0x1a3620;};exports[_0xf0fa('0x1d')]=function(_0x19e392,_0x56134e){if(_[_0xf0fa('0x5')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x11')](_0x19e392)){for(var _0x2efe88=0x0;_0x2efe88<_0x19e392['length'];_0x2efe88+=0x1){_0x19e392[_0x2efe88]=this[_0xf0fa('0x1d')](_0x19e392[_0x2efe88],_0x56134e);}return _0x19e392;}if(!_[_0xf0fa('0x1e')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x1f')](_0x56134e)){_0x56134e=[_0x56134e];}if(!_[_0xf0fa('0x11')](_0x56134e)){return _0x19e392;}for(var _0x4e6eef=0x0;_0x4e6eef<_0x56134e['length'];_0x4e6eef+=0x1){_[_0xf0fa('0x20')](_0x19e392,_0x56134e[_0x4e6eef]);}for(var _0x1c5eaf in _0x19e392){if(_0x19e392[_0xf0fa('0x21')](_0x1c5eaf)){_0x19e392[_0x1c5eaf]=this[_0xf0fa('0x1d')](_0x19e392[_0x1c5eaf],_0x56134e);}}return _0x19e392;};exports['isNumeric']=function(_0x4058d6){return _0x4058d6[_0xf0fa('0x22')](RegExp(_0xf0fa('0x23')))?!![]:![];};exports['isEmail']=function(_0x9ad0e3){return _0x9ad0e3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf0fa('0x24')]=function(_0x1e3875){var _0x28e057=[];_0x1e3875['split'](/[ ,]+/)[_0xf0fa('0x25')](function(_0x33cc64){_0x33cc64=_0x33cc64[_0xf0fa('0x26')](/([^:]")"+/g,'$1');_0x33cc64='+'+_0x33cc64+'*';var _0x212986=/[ `!@#$%^&*()_\-?~]/;if(_0x33cc64[_0xf0fa('0x22')](_0x212986))_0x33cc64='\x22'+_0x33cc64+'\x22';_0x28e057[_0xf0fa('0x27')](_0x33cc64);});return _0x28e057['join']('\x20');};exports['getOptions']=function(_0x36173a,_0x255f9d,_0x485fe2){var _0x38cf8c={},_0x50e0bd={};if(_0x255f9d['query']['$id']){_0x255f9d[_0xf0fa('0x28')]['id']=_0x255f9d['query'][_0xf0fa('0x29')];delete _0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x29')];}_0x38cf8c[_0xf0fa('0x2a')]=_[_0xf0fa('0x15')](_0x36173a,_0xf0fa('0xf'));_0x38cf8c[_0xf0fa('0x28')]=_[_0xf0fa('0x3')](_0x255f9d['query']);_0x38cf8c[_0xf0fa('0x2b')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],_0x38cf8c['query']);_0x50e0bd[_0xf0fa('0x2d')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],this[_0xf0fa('0x2e')](_0x255f9d['query']['fields']));_0x50e0bd[_0xf0fa('0x2d')]=_0x50e0bd[_0xf0fa('0x2d')][_0xf0fa('0x2f')]?_0x50e0bd[_0xf0fa('0x2d')]:_0x38cf8c[_0xf0fa('0x2a')];if(!_0x255f9d['query']['hasOwnProperty']('nolimit')){_0x50e0bd['limit']=this[_0xf0fa('0x13')](_0x255f9d[_0xf0fa('0x28')]['limit']);_0x50e0bd['offset']=this[_0xf0fa('0x30')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x30')]);}_0x50e0bd[_0xf0fa('0x31')]=this[_0xf0fa('0x14')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x14')]);_0x50e0bd['where']=this['filters'](_[_0xf0fa('0x32')](_0x255f9d[_0xf0fa('0x28')],_0x38cf8c[_0xf0fa('0x2b')]),_0x36173a);if(_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]){var _0x1d0129=_0x36173a;var _0x5acfa4=_0x255f9d[_0xf0fa('0x28')]['filter'];if(typeof _0x5acfa4===_0xf0fa('0x34')){_0x1d0129=_[_0xf0fa('0x33')](_0x36173a,function(_0x6e1fd9){return _[_0xf0fa('0x4')](_0x5acfa4[_0xf0fa('0x35')],_0x6e1fd9[_0xf0fa('0xf')]);});_0x5acfa4=_0x5acfa4[_0xf0fa('0x36')];}_0x50e0bd[_0xf0fa('0x37')]=_[_0xf0fa('0x38')](_0x50e0bd['where'],{'$or':_['map'](_0x1d0129,function(_0x52221a){if(_0x52221a[_0xf0fa('0x7')]!==_0xf0fa('0x39')){if(_0x485fe2){return sequelize['where'](sequelize['fn'](_0xf0fa('0x3a'),sequelize[_0xf0fa('0x1c')](_0x52221a[_0xf0fa('0xf')])),{'$like':sequelize['fn'](_0xf0fa('0x3a'),'%'+_0x255f9d['query'][_0xf0fa('0x33')]+'%')});}else{var _0x1f3916={};_0x1f3916[_0x52221a[_0xf0fa('0xf')]]={'$like':'%'+_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]+'%'};return _0x1f3916;}}})});}_0x50e0bd=_[_0xf0fa('0x38')]({},_0x50e0bd,_0x255f9d[_0xf0fa('0x3b')]);return _0x50e0bd;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0f1a9c5..abbce9b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x128443,_0x2fe025){var _0x1a4ce1=function(_0x12d72c){while(--_0x12d72c){_0x128443['push'](_0x128443['shift']());}};_0x1a4ce1(++_0x2fe025);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 +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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 234f06a..e04a53e 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 _0xf49a=['getUuid','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','crypto','child_process','execSync','../environment','networkInterfaces','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf49a,0xf9));var _0xaf49=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0xf49a[_0x494986];return _0x1c805b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xaf49('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xaf49('0x1'))[_0xaf49('0x2')];var config=require(_0xaf49('0x3'));function getInterfaces(){var _0x357697=[];var _0x3c1755=os[_0xaf49('0x4')]();var _0x268c8f=_['orderBy'](_['keys'](_0x3c1755));for(var _0x19d1d8=0x0;_0x19d1d8<_0x268c8f[_0xaf49('0x5')];_0x19d1d8++){var _0x23dcaa=_0x3c1755[_0x268c8f[_0x19d1d8]][_0xaf49('0x6')](function(_0x2fa6df){return _0x2fa6df[_0xaf49('0x7')]===_0xaf49('0x8')&&_0x2fa6df[_0xaf49('0x9')]===![];});_0x357697=_0x357697['concat'](_0x23dcaa);}return _0x357697;}function getFirstInterface(){var _0x410346=_[_0xaf49('0xa')](getInterfaces());return{'macAddress':_0x410346&&_0x410346[_0xaf49('0xb')]?_0x410346[_0xaf49('0xb')]:_0xaf49('0xc'),'ipAddress':_0x410346&&_0x410346[_0xaf49('0xd')]?_0x410346['address']:'127.0.0.1'};}exports[_0xaf49('0xe')]=getFirstInterface;function getCPUhash(){var _0x573e46=_['orderBy'](os[_0xaf49('0xf')]()[_0xaf49('0x10')](function(_0x26a9af){return _0x26a9af[_0xaf49('0x11')];}))['join'](':');return crypto[_0xaf49('0x12')](_0xaf49('0x13'))[_0xaf49('0x14')](_0x573e46)[_0xaf49('0x15')](_0xaf49('0x16'));}exports[_0xaf49('0x17')]=function(){var _0x5180f1=os['platform']();var _0x373f2d=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x373f2d[_0xaf49('0x18')](config[_0xaf49('0x19')])){return config[_0xaf49('0x19')];}else if(_0x5180f1===_0xaf49('0x1a')){return exec(_0xaf49('0x1b'),{'encoding':_0xaf49('0x1c')})[_0xaf49('0x1d')]('\x0d\x0a','');}else{var _0x363e2e=getFirstInterface();var _0x2d686a=getCPUhash();var _0x5259c0=_0x2d686a+'|'+os[_0xaf49('0x1e')]()+'|'+_0x363e2e[_0xaf49('0x1f')]+'|'+_0x363e2e[_0xaf49('0x20')];var _0x1355f3=crypto['createHash'](_0xaf49('0x13'))['update'](_0x5259c0)[_0xaf49('0x15')]('hex');return _0x1355f3[_0xaf49('0x21')](0x0,0x8)+'-'+_0x1355f3[_0xaf49('0x21')](0x8,0xc)+'-'+_0x1355f3['substring'](0xc,0x10)+'-'+_0x1355f3[_0xaf49('0x21')](0x10,0x14)+'-'+_0x1355f3[_0xaf49('0x21')](0x14);}}; \ No newline at end of file +var _0xc9e2=['child_process','execSync','../environment','networkInterfaces','length','filter','family','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','join','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','createHash','substring','crypto','bimedia-machine-uuid'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xc9e2,0x148));var _0x2c9e=function(_0x143d30,_0xa0c6e6){_0x143d30=_0x143d30-0x0;var _0x14deb4=_0xc9e2[_0x143d30];return _0x14deb4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x2c9e('0x0'));var machine=require(_0x2c9e('0x1'));var exec=require(_0x2c9e('0x2'))[_0x2c9e('0x3')];var config=require(_0x2c9e('0x4'));function getInterfaces(){var _0x4090ad=[];var _0x2f8111=os[_0x2c9e('0x5')]();var _0x252e2c=_['orderBy'](_['keys'](_0x2f8111));for(var _0x21367f=0x0;_0x21367f<_0x252e2c[_0x2c9e('0x6')];_0x21367f++){var _0x45af29=_0x2f8111[_0x252e2c[_0x21367f]][_0x2c9e('0x7')](function(_0x2a4a7e){return _0x2a4a7e[_0x2c9e('0x8')]==='IPv4'&&_0x2a4a7e[_0x2c9e('0x9')]===![];});_0x4090ad=_0x4090ad[_0x2c9e('0xa')](_0x45af29);}return _0x4090ad;}function getFirstInterface(){var _0x4e0680=_[_0x2c9e('0xb')](getInterfaces());return{'macAddress':_0x4e0680&&_0x4e0680[_0x2c9e('0xc')]?_0x4e0680[_0x2c9e('0xc')]:'00:00:00:00:00:00','ipAddress':_0x4e0680&&_0x4e0680[_0x2c9e('0xd')]?_0x4e0680['address']:_0x2c9e('0xe')};}exports[_0x2c9e('0xf')]=getFirstInterface;function getCPUhash(){var _0x936c06=_['orderBy'](os[_0x2c9e('0x10')]()[_0x2c9e('0x11')](function(_0x50fc46){return _0x50fc46['model'];}))[_0x2c9e('0x12')](':');return crypto['createHash'](_0x2c9e('0x13'))[_0x2c9e('0x14')](_0x936c06)[_0x2c9e('0x15')](_0x2c9e('0x16'));}exports['getUuid']=function(){var _0x2511b7=os[_0x2c9e('0x17')]();var _0x1d06c7=/[0-9a-f-]{36}/;if(config[_0x2c9e('0x18')]&&_0x1d06c7[_0x2c9e('0x19')](config[_0x2c9e('0x18')])){return config[_0x2c9e('0x18')];}else if(_0x2511b7===_0x2c9e('0x1a')){return exec(_0x2c9e('0x1b'),{'encoding':'utf8'})[_0x2c9e('0x1c')]('\x0d\x0a','');}else{var _0x22e029=getFirstInterface();var _0x12f6f7=getCPUhash();var _0x284303=_0x12f6f7+'|'+os[_0x2c9e('0x1d')]()+'|'+_0x22e029[_0x2c9e('0x1e')]+'|'+_0x22e029['ipAddress'];var _0x5c901e=crypto[_0x2c9e('0x1f')](_0x2c9e('0x13'))['update'](_0x284303)[_0x2c9e('0x15')](_0x2c9e('0x16'));return _0x5c901e[_0x2c9e('0x20')](0x0,0x8)+'-'+_0x5c901e[_0x2c9e('0x20')](0x8,0xc)+'-'+_0x5c901e[_0x2c9e('0x20')](0xc,0x10)+'-'+_0x5c901e['substring'](0x10,0x14)+'-'+_0x5c901e[_0x2c9e('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2fb8aa1..6037770 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 _0x4920=['license','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','then','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','default','util','moment','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware','../logger'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x4920,0xbb));var _0x0492=function(_0x5e1393,_0x4d9ad0){_0x5e1393=_0x5e1393-0x0;var _0x4b1ed7=_0x4920[_0x5e1393];return _0x4b1ed7;};'use strict';var util=require(_0x0492('0x0'));var moment=require(_0x0492('0x1'));var rp=require(_0x0492('0x2'));var BPromise=require(_0x0492('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x0492('0x4'))['db'];var encryptor=require(_0x0492('0x5'));var hardware=require(_0x0492('0x6'));var logger=require(_0x0492('0x7'))(_0x0492('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5e85d4){return new BPromise(function(_0x115e60,_0x26a234){var _0xec0ad4=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x5e85d4,module[_0x0492('0x9')]['version']);if(oldToken){_0xec0ad4=util['format'](_0x0492('0xa'),HOST,_0x5e85d4,module[_0x0492('0x9')][_0x0492('0xb')],oldToken);}var _0xd28c15={'uri':_0xec0ad4,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xd28c15)[_0x0492('0xc')](function(_0x11c5ab){_0x115e60(_0x11c5ab);})['catch'](function(_0x2d985e){_0x26a234(_0x2d985e);});});}function manageLicense(_0x487db1,_0x3196fd){var _0x3b8879=_0x3196fd[_0x0492('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x3b8879[_0x0492('0xe')]!==_0x487db1&&!_0x3b8879[_0x0492('0xf')]){oldToken=_0x3b8879['data1'];}httpRequest(_0x487db1)[_0x0492('0xc')](function(_0xde046c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xde046c[_0x0492('0x10')]){isOldTokenSent=![];if(!_0x3b8879[_0x0492('0x8')]&&_0x3b8879['license']!=_0xde046c['license']||_0x3b8879[_0x0492('0x8')]&&_0x3b8879[_0x0492('0xf')]){logger['info'](_0x0492('0x11'));}if(_0x3b8879[_0x0492('0x8')]&&!_0x3b8879[_0x0492('0xf')]&&_0x3b8879[_0x0492('0x8')]!=_0xde046c[_0x0492('0x8')]){logger[_0x0492('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3b8879[_0x0492('0x8')]&&!_0x3b8879[_0x0492('0xf')]&&_0x3b8879[_0x0492('0x8')]==_0xde046c[_0x0492('0x8')]){return _0x3196fd;}return _0x3196fd[_0x0492('0x13')]({'data1':_0x487db1,'data2':null,'license':_0xde046c['license']});}else{if(_0xde046c[_0x0492('0x8')]||_0x3b8879['license']){if(!_0x3b8879[_0x0492('0xf')]){if(_0x3b8879[_0x0492('0xe')]==_0x487db1){GRAY_PERIOD_REASON=_0x0492('0x14');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x0492('0x15');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3b8879[_0x0492('0xe')],_0x487db1);}logger[_0x0492('0x12')](_0x0492('0x16'),GRAY_PERIOD_REASON[_0x0492('0x17')](),moment()[_0x0492('0x18')]('YYYY-MM-DD\x20HH:mm'));return _0x3196fd['update']({'data2':encryptor[_0x0492('0x19')](moment()[_0x0492('0x18')](_0x0492('0x1a')))});}else{if(moment()['diff'](encryptor[_0x0492('0x1b')](_0x3b8879['data2']),_0x0492('0x1c'))>DAYS){logger[_0x0492('0x12')](_0x0492('0x1d'),moment()['format'](_0x0492('0x1a')));isOldTokenSent=![];return _0x3196fd[_0x0492('0x13')]({'data1':_0x487db1,'data2':null,'license':null});}}}else{if(_0x3b8879[_0x0492('0xe')]!=_0x487db1){logger[_0x0492('0x12')](_0x0492('0x1e'),_0x3b8879[_0x0492('0xe')],_0x487db1);return _0x3196fd[_0x0492('0x13')]({'data1':_0x487db1,'data2':null,'license':null});}}}return _0x3196fd;})[_0x0492('0xc')](function(_0x3f3a77){_0x3196fd=_0x3f3a77;})[_0x0492('0x1f')](function(_0x19e09a){logger[_0x0492('0x20')](_0x19e09a[_0x0492('0x21')]);})[_0x0492('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x0492('0x23')](),_0x3196fd);},TIME);});}function defaultLicense(){var _0x291718=hardware['getUuid']();if(_0x291718){return db['License'][_0x0492('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x291718}})[_0x0492('0x25')](function(_0x3abdcb,_0x5b4883){logger[_0x0492('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x291718);manageLicense(_0x291718,_0x3abdcb);})['catch'](function(_0x3c49da){logger['error'](_0x3c49da[_0x0492('0x21')]);});}}exports[_0x0492('0x26')]=defaultLicense; \ No newline at end of file +var _0x9e4f=['exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s'];(function(_0xdb5036,_0x914c61){var _0x58fb12=function(_0x5deae1){while(--_0x5deae1){_0xdb5036['push'](_0xdb5036['shift']());}};_0x58fb12(++_0x914c61);}(_0x9e4f,0x129));var _0xf9e4=function(_0x7dc310,_0x31b4b4){_0x7dc310=_0x7dc310-0x0;var _0x2fa377=_0x9e4f[_0x7dc310];return _0x2fa377;};'use strict';var util=require(_0xf9e4('0x0'));var moment=require(_0xf9e4('0x1'));var rp=require(_0xf9e4('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xf9e4('0x3'))(module,'version');var db=require(_0xf9e4('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf9e4('0x5'));var logger=require(_0xf9e4('0x6'))(_0xf9e4('0x7'));var HOST=_0xf9e4('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x83541c){return new BPromise(function(_0x1dcb62,_0x32f628){var _0x410935=util[_0xf9e4('0x9')](_0xf9e4('0xa'),HOST,_0x83541c,module[_0xf9e4('0xb')][_0xf9e4('0xc')]);if(oldToken){_0x410935=util[_0xf9e4('0x9')](_0xf9e4('0xd'),HOST,_0x83541c,module[_0xf9e4('0xb')][_0xf9e4('0xc')],oldToken);}var _0x5f1c64={'uri':_0x410935,'method':_0xf9e4('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5f1c64)[_0xf9e4('0xf')](function(_0x5c6305){_0x1dcb62(_0x5c6305);})['catch'](function(_0x5a2219){_0x32f628(_0x5a2219);});});}function manageLicense(_0x1cedc8,_0xcc2789){var _0x5a0b8a=_0xcc2789['get']({'plain':!![]});if(!isOldTokenSent&&_0x5a0b8a[_0xf9e4('0x10')]!==_0x1cedc8&&!_0x5a0b8a[_0xf9e4('0x11')]){oldToken=_0x5a0b8a[_0xf9e4('0x10')];}httpRequest(_0x1cedc8)['then'](function(_0x500170){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x500170[_0xf9e4('0x12')]){isOldTokenSent=![];if(!_0x5a0b8a[_0xf9e4('0x7')]&&_0x5a0b8a[_0xf9e4('0x7')]!=_0x500170[_0xf9e4('0x7')]||_0x5a0b8a[_0xf9e4('0x7')]&&_0x5a0b8a[_0xf9e4('0x11')]){logger[_0xf9e4('0x13')](_0xf9e4('0x14'));}if(_0x5a0b8a[_0xf9e4('0x7')]&&!_0x5a0b8a['data2']&&_0x5a0b8a[_0xf9e4('0x7')]!=_0x500170[_0xf9e4('0x7')]){logger[_0xf9e4('0x13')](_0xf9e4('0x15'));}if(_0x5a0b8a['license']&&!_0x5a0b8a['data2']&&_0x5a0b8a[_0xf9e4('0x7')]==_0x500170['license']){return _0xcc2789;}return _0xcc2789[_0xf9e4('0x16')]({'data1':_0x1cedc8,'data2':null,'license':_0x500170[_0xf9e4('0x7')]});}else{if(_0x500170[_0xf9e4('0x7')]||_0x5a0b8a['license']){if(!_0x5a0b8a[_0xf9e4('0x11')]){if(_0x5a0b8a['data1']==_0x1cedc8){GRAY_PERIOD_REASON=_0xf9e4('0x17');logger[_0xf9e4('0x13')](_0xf9e4('0x18'));}else{GRAY_PERIOD_REASON=_0xf9e4('0x19');logger[_0xf9e4('0x13')](_0xf9e4('0x1a'),_0x5a0b8a['data1'],_0x1cedc8);}logger[_0xf9e4('0x13')](_0xf9e4('0x1b'),GRAY_PERIOD_REASON[_0xf9e4('0x1c')](),moment()['format'](_0xf9e4('0x1d')));return _0xcc2789['update']({'data2':encryptor[_0xf9e4('0x1e')](moment()[_0xf9e4('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xf9e4('0x1f')](_0x5a0b8a['data2']),_0xf9e4('0x20'))>DAYS){logger['info'](_0xf9e4('0x21'),moment()[_0xf9e4('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xcc2789[_0xf9e4('0x16')]({'data1':_0x1cedc8,'data2':null,'license':null});}}}else{if(_0x5a0b8a[_0xf9e4('0x10')]!=_0x1cedc8){logger[_0xf9e4('0x13')](_0xf9e4('0x1a'),_0x5a0b8a[_0xf9e4('0x10')],_0x1cedc8);return _0xcc2789[_0xf9e4('0x16')]({'data1':_0x1cedc8,'data2':null,'license':null});}}}return _0xcc2789;})[_0xf9e4('0xf')](function(_0x2082f4){_0xcc2789=_0x2082f4;})[_0xf9e4('0x22')](function(_0x44b62c){logger[_0xf9e4('0x23')](_0x44b62c[_0xf9e4('0x24')]);})[_0xf9e4('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xf9e4('0x26')](),_0xcc2789);},TIME);});}function defaultLicense(){var _0x364b78=hardware[_0xf9e4('0x26')]();if(_0x364b78){return db[_0xf9e4('0x27')][_0xf9e4('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x364b78}})[_0xf9e4('0x29')](function(_0x510bf7,_0x4be283){logger['info'](_0xf9e4('0x2a'),_0x364b78);manageLicense(_0x364b78,_0x510bf7);})[_0xf9e4('0x22')](function(_0x3798f6){logger[_0xf9e4('0x23')](_0x3798f6['message']);});}}exports[_0xf9e4('0x2b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f4f439c..5904a05 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 _0xd660=['lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','decryptString','format','%s:%s:%s','getUuid','add','days','grayReason','machineUuid','changed','disabled','message','findAll','sequelize','col','role','count','admin','user','users','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util'];(function(_0x5f2779,_0x25934a){var _0x2646f9=function(_0x26aeda){while(--_0x26aeda){_0x5f2779['push'](_0x5f2779['shift']());}};_0x2646f9(++_0x25934a);}(_0xd660,0x125));var _0x0d66=function(_0x56b540,_0x37f450){_0x56b540=_0x56b540-0x0;var _0xf62ffc=_0xd660[_0x56b540];return _0xf62ffc;};'use strict';var util=require(_0x0d66('0x0'));var _=require(_0x0d66('0x1'));var moment=require('moment');var BPromise=require(_0x0d66('0x2'));var hardware=require(_0x0d66('0x3'));var encryptor=require(_0x0d66('0x4'));var db=require(_0x0d66('0x5'))['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':_0x0d66('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x225f4a){return new BPromise(function(_0x1f2547,_0x287679){return db['License'][_0x0d66('0x7')](_[_0x0d66('0x8')](_0x225f4a,{'raw':!![],'where':{'id':0x1}}))[_0x0d66('0x9')](function(_0x151244){return checkLicense(_0x151244,null);})['then'](function(_0x44de26){_0x1f2547(_0x44de26);return;})[_0x0d66('0xa')](function(_0x2b88b1){_0x287679(_0x2b88b1);});});}function checkLicense(_0x273cf5,_0x4ab414){if(!_0x273cf5){demoLicense[_0x0d66('0xb')]=_0x273cf5['data1'];return demoLicense;}try{var _0x4858f3=_0x4ab414||_0x273cf5[_0x0d66('0xc')];if(_[_0x0d66('0xd')](_0x4858f3)){throw new Error(_0x0d66('0xe'));}var _0x1f1df8=_0x273cf5[_0x0d66('0xf')];var _0x2935a6=_0x273cf5['data2'];var _0x11a445=_0x1f1df8[_0x0d66('0x10')]('-')[0x4];var _0x3b5b2a=_0x1f1df8['split']('-')[0x0];var _0xc7dcc8=encryptor[_0x0d66('0x11')](_0x4858f3,util[_0x0d66('0x12')](_0x0d66('0x13'),_0x11a445,_0x1f1df8,_0x3b5b2a));var _0x2aacff=JSON['parse'](_0xc7dcc8);_0x2aacff['demo']=![];_0x2aacff[_0x0d66('0xb')]=_0x1f1df8;_0x2aacff['machineUuid']=hardware[_0x0d66('0x14')]();if(_0x2935a6){var _0x241032=encryptor[_0x0d66('0x11')](_0x2935a6);_0x2aacff['gray']=_0x241032;_0x2aacff['deadline']=moment(_0x241032)[_0x0d66('0x15')](0x7,_0x0d66('0x16'))[_0x0d66('0x12')]();_0x2aacff[_0x0d66('0x17')]=_0x2aacff['uuid']!=_0x2aacff[_0x0d66('0x18')]?_0x0d66('0x19'):_0x0d66('0x1a');}return _0x2aacff;}catch(_0x5176e5){breakingLicense[_0x0d66('0xb')]=_0x273cf5[_0x0d66('0xf')];breakingLicense['message']=_0x5176e5[_0x0d66('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e173,_0x5c4067){getLicense()['then'](function(_0x40961d){return db['User'][_0x0d66('0x1c')]({'attributes':['role',[db[_0x0d66('0x1d')]['fn']('COUNT',db[_0x0d66('0x1d')][_0x0d66('0x1e')](_0x0d66('0x1f'))),_0x0d66('0x20')]],'group':_0x0d66('0x1f'),'where':{'role':{'$or':[_0x0d66('0x21'),_0x0d66('0x22'),'telephone']}},'raw':!![]})['then'](function(_0xd6ec05){var _0x1890f6={'user':_0x40961d[_0x0d66('0x23')]||0x0,'telephone':_0x40961d['telephones']||0x0};_0xd6ec05['forEach'](function(_0x5d98fc){var _0x55afca=_0x5d98fc[_0x0d66('0x1f')]===_0x0d66('0x21')?_0x0d66('0x22'):_0x5d98fc[_0x0d66('0x1f')];_0x1890f6[_0x55afca]-=_0x5d98fc[_0x0d66('0x20')];if(_0x1890f6[_0x55afca]<0x0)_0x1890f6[_0x55afca]=0x0;});_0x1e173(_0x1890f6);return;});})[_0x0d66('0xa')](function(_0x2162af){_0x5c4067(_0x2162af);});});}function checkUserLimits(_0x293098){return new BPromise(function(_0x542821,_0x2a2404){getLimits()[_0x0d66('0x9')](function(_0x26f203){var _0x213c44=_[_0x0d66('0x24')](_[_0x0d66('0x25')](_0x293098,'role'),[_0x0d66('0x21'),_0x0d66('0x22'),_0x0d66('0x26')]);var _0xf29d3a=(_0x213c44['admin']||0x0)+(_0x213c44['user']||0x0);var _0x283c6f=_0x213c44[_0x0d66('0x26')]||0x0;if(_0xf29d3a>_0x26f203[_0x0d66('0x22')])return _0x2a2404(_0x0d66('0x27'));if(_0x283c6f>_0x26f203['telephone'])return _0x2a2404(_0x0d66('0x28'));return _0x542821();})[_0x0d66('0xa')](function(_0x35ceb0){_0x2a2404(_0x35ceb0);});});}module[_0x0d66('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xfcd4=['./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','decryptString','add','days','format','changed','disabled','message','User','role','sequelize','col','count','admin','user','telephone','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment'];(function(_0x34edb2,_0x42cd39){var _0x4a685c=function(_0x39174b){while(--_0x39174b){_0x34edb2['push'](_0x34edb2['shift']());}};_0x4a685c(++_0x42cd39);}(_0xfcd4,0xb1));var _0x4fcd=function(_0x272fa4,_0xf712d1){_0x272fa4=_0x272fa4-0x0;var _0x25ec85=_0xfcd4[_0x272fa4];return _0x25ec85;};'use strict';var util=require(_0x4fcd('0x0'));var _=require(_0x4fcd('0x1'));var moment=require(_0x4fcd('0x2'));var BPromise=require('bluebird');var hardware=require(_0x4fcd('0x3'));var encryptor=require(_0x4fcd('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4fcd('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4fcd('0x6'),'machineUuid':hardware[_0x4fcd('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4fcd('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4fcd('0x8'),'machineUuid':hardware[_0x4fcd('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1cee39){return new BPromise(function(_0x2be4db,_0x4dc401){return db['License'][_0x4fcd('0x9')](_['defaults'](_0x1cee39,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x48680d){return checkLicense(_0x48680d,null);})[_0x4fcd('0xa')](function(_0x20db7d){_0x2be4db(_0x20db7d);return;})['catch'](function(_0x44406d){_0x4dc401(_0x44406d);});});}function checkLicense(_0x2da1fc,_0x356bab){if(!_0x2da1fc){demoLicense[_0x4fcd('0xb')]=_0x2da1fc[_0x4fcd('0xc')];return demoLicense;}try{var _0x50a1a1=_0x356bab||_0x2da1fc[_0x4fcd('0xd')];if(_[_0x4fcd('0xe')](_0x50a1a1)){throw new Error(_0x4fcd('0xf'));}var _0x2859a7=_0x2da1fc[_0x4fcd('0xc')];var _0x4764df=_0x2da1fc[_0x4fcd('0x10')];var _0x535b10=_0x2859a7[_0x4fcd('0x11')]('-')[0x4];var _0x2b1d0b=_0x2859a7[_0x4fcd('0x11')]('-')[0x0];var _0x97a440=encryptor['decryptString'](_0x50a1a1,util['format'](_0x4fcd('0x12'),_0x535b10,_0x2859a7,_0x2b1d0b));var _0x15e4b4=JSON[_0x4fcd('0x13')](_0x97a440);_0x15e4b4[_0x4fcd('0x14')]=![];_0x15e4b4['uuid']=_0x2859a7;_0x15e4b4[_0x4fcd('0x15')]=hardware[_0x4fcd('0x7')]();if(_0x4764df){var _0x5855be=encryptor[_0x4fcd('0x16')](_0x4764df);_0x15e4b4['gray']=_0x5855be;_0x15e4b4['deadline']=moment(_0x5855be)[_0x4fcd('0x17')](0x7,_0x4fcd('0x18'))[_0x4fcd('0x19')]();_0x15e4b4['grayReason']=_0x15e4b4[_0x4fcd('0xb')]!=_0x15e4b4[_0x4fcd('0x15')]?_0x4fcd('0x1a'):_0x4fcd('0x1b');}return _0x15e4b4;}catch(_0x3e671d){breakingLicense[_0x4fcd('0xb')]=_0x2da1fc[_0x4fcd('0xc')];breakingLicense[_0x4fcd('0x1c')]=_0x3e671d[_0x4fcd('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3cbf71,_0x1c0fed){getLicense()['then'](function(_0x4b5d6e){return db[_0x4fcd('0x1d')]['findAll']({'attributes':[_0x4fcd('0x1e'),[db[_0x4fcd('0x1f')]['fn']('COUNT',db['sequelize'][_0x4fcd('0x20')](_0x4fcd('0x1e'))),_0x4fcd('0x21')]],'group':'role','where':{'role':{'$or':[_0x4fcd('0x22'),_0x4fcd('0x23'),_0x4fcd('0x24')]}},'raw':!![]})[_0x4fcd('0xa')](function(_0xaa064){var _0x530b56={'user':_0x4b5d6e['users']||0x0,'telephone':_0x4b5d6e[_0x4fcd('0x25')]||0x0};_0xaa064[_0x4fcd('0x26')](function(_0x5b9b59){var _0x43bc97=_0x5b9b59[_0x4fcd('0x1e')]==='admin'?_0x4fcd('0x23'):_0x5b9b59[_0x4fcd('0x1e')];_0x530b56[_0x43bc97]-=_0x5b9b59['count'];if(_0x530b56[_0x43bc97]<0x0)_0x530b56[_0x43bc97]=0x0;});_0x3cbf71(_0x530b56);return;});})[_0x4fcd('0x27')](function(_0x2dcab2){_0x1c0fed(_0x2dcab2);});});}function checkUserLimits(_0x3998a1){return new BPromise(function(_0x5194dd,_0x3f1eb5){getLimits()[_0x4fcd('0xa')](function(_0x82d198){var _0x277e8c=_[_0x4fcd('0x28')](_[_0x4fcd('0x29')](_0x3998a1,'role'),['admin',_0x4fcd('0x23'),_0x4fcd('0x24')]);var _0x4a759c=(_0x277e8c[_0x4fcd('0x22')]||0x0)+(_0x277e8c[_0x4fcd('0x23')]||0x0);var _0x422c49=_0x277e8c[_0x4fcd('0x24')]||0x0;if(_0x4a759c>_0x82d198[_0x4fcd('0x23')])return _0x3f1eb5(_0x4fcd('0x2a'));if(_0x422c49>_0x82d198[_0x4fcd('0x24')])return _0x3f1eb5(_0x4fcd('0x2b'));return _0x5194dd();})[_0x4fcd('0x27')](function(_0x36a69e){_0x3f1eb5(_0x36a69e);});});}module[_0x4fcd('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 0a80f00..5bff354 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 _0xefda=['exports','app-id','secret'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xefda,0x96));var _0xaefd=function(_0x663049,_0x152370){_0x663049=_0x663049-0x0;var _0x1c47f9=_0xefda[_0x663049];return _0x1c47f9;};'use strict';module[_0xaefd('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xaefd('0x1'),'GOOGLE_SECRET':_0xaefd('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x439cb3,_0x21f34d){var _0x559eeb=function(_0xb92afd){while(--_0xb92afd){_0x439cb3['push'](_0x439cb3['shift']());}};_0x559eeb(++_0x21f34d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4574b0,_0x3bd754){_0x4574b0=_0x4574b0-0x0;var _0x3d720c=_0xb10b[_0x4574b0];return _0x3d720c;};'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 eb207f9..e4bad6d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ea=['fileLogger','exports','../utils/loggers'];(function(_0x30ab2d,_0x585b22){var _0x161178=function(_0x18e62c){while(--_0x18e62c){_0x30ab2d['push'](_0x30ab2d['shift']());}};_0x161178(++_0x585b22);}(_0x82ea,0xda));var _0xa82e=function(_0x4ab7af,_0x50c395){_0x4ab7af=_0x4ab7af-0x0;var _0x3c9759=_0x82ea[_0x4ab7af];return _0x3c9759;};'use strict';var fileLogger=require(_0xa82e('0x0'))[_0xa82e('0x1')];module[_0xa82e('0x2')]=fileLogger; \ No newline at end of file +var _0xd2b9=['fileLogger','../utils/loggers'];(function(_0x31ebec,_0x2d5151){var _0xd39c73=function(_0x20c9f4){while(--_0x20c9f4){_0x31ebec['push'](_0x31ebec['shift']());}};_0xd39c73(++_0x2d5151);}(_0xd2b9,0xff));var _0x9d2b=function(_0x15876c,_0x510dd4){_0x15876c=_0x15876c-0x0;var _0x39d91b=_0xd2b9[_0x15876c];return _0x39d91b;};'use strict';var fileLogger=require(_0x9d2b('0x0'))[_0x9d2b('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index da29b66..4e38861 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 _0xb548=['join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami'];(function(_0x36de4f,_0x350d30){var _0x1a91c2=function(_0x475034){while(--_0x475034){_0x36de4f['push'](_0x36de4f['shift']());}};_0x1a91c2(++_0x350d30);}(_0xb548,0x122));var _0x8b54=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xb548[_0x15ea09];return _0x3e9c78;};'use strict';var path=require(_0x8b54('0x0'));var os=require('os');var config={'apps':[{'name':_0x8b54('0x1'),'script':path['join'](__dirname,_0x8b54('0x2'))},{'name':_0x8b54('0x3'),'script':path[_0x8b54('0x4')](__dirname,_0x8b54('0x5'))},{'name':_0x8b54('0x6'),'script':path[_0x8b54('0x4')](__dirname,_0x8b54('0x7'))},{'name':_0x8b54('0x8'),'script':path['join'](__dirname,_0x8b54('0x9'))},{'name':'routing','script':path[_0x8b54('0x4')](__dirname,_0x8b54('0xa'))},{'name':_0x8b54('0xb'),'script':path[_0x8b54('0x4')](__dirname,_0x8b54('0xc'))}]};module[_0x8b54('0xd')]=config; \ No newline at end of file +var _0x6c57=['email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6c57,0x117));var _0x76c5=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x6c57[_0x139a3c];return _0x2b375b;};'use strict';var path=require(_0x76c5('0x0'));var os=require('os');var config={'apps':[{'name':_0x76c5('0x1'),'script':path[_0x76c5('0x2')](__dirname,_0x76c5('0x3'))},{'name':_0x76c5('0x4'),'script':path['join'](__dirname,_0x76c5('0x5'))},{'name':_0x76c5('0x6'),'script':path[_0x76c5('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x76c5('0x7'),'script':path[_0x76c5('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x76c5('0x8'),'script':path['join'](__dirname,_0x76c5('0x9'))},{'name':_0x76c5('0xa'),'script':path[_0x76c5('0x2')](__dirname,_0x76c5('0xb'))}]};module[_0x76c5('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index d670d8d..394ecf1 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 _0x321d=['then','disconnect','stop','restart','list','describe','delete','saved','bluebird','./config','connect','connected','start'];(function(_0x503588,_0x526c21){var _0x185e99=function(_0x89193a){while(--_0x89193a){_0x503588['push'](_0x503588['shift']());}};_0x185e99(++_0x526c21);}(_0x321d,0xa4));var _0xd321=function(_0x5aa2d7,_0x5260f6){_0x5aa2d7=_0x5aa2d7-0x0;var _0x2f3bb8=_0x321d[_0x5aa2d7];return _0x2f3bb8;};'use strict';var pm2=require('pm2');var BPromise=require(_0xd321('0x0'));var config=require(_0xd321('0x1'));function connect(){return new BPromise(function(_0x4792c5,_0x3ae0b4){return pm2[_0xd321('0x2')](function(_0x19bbb8){if(_0x19bbb8){return _0x3ae0b4(_0x19bbb8);}return _0x4792c5(_0xd321('0x3'));});});};exports[_0xd321('0x4')]=function(_0x16fc1a){return connect()[_0xd321('0x5')](function(){return new BPromise(function(_0x27f738,_0x44f07d){return pm2['start'](_0x16fc1a,function(_0x14d62a,_0x41d2c3){if(_0x14d62a){return _0x44f07d(_0x14d62a);}pm2[_0xd321('0x6')]();return _0x27f738(_0x41d2c3);});});});};exports['stop']=function(_0x2979f8){return connect()[_0xd321('0x5')](function(){return new BPromise(function(_0x1777aa,_0xf76418){return pm2[_0xd321('0x7')](_0x2979f8,function(_0x523cb2,_0x5b8d0b){if(_0x523cb2){return _0xf76418(_0x523cb2);}pm2[_0xd321('0x6')]();return _0x1777aa(_0x5b8d0b);});});});};exports[_0xd321('0x8')]=function(_0x231598){return connect()[_0xd321('0x5')](function(){return new BPromise(function(_0x1abce8,_0x342504){return pm2['restart'](_0x231598,function(_0xfaccc7,_0x18d8a0){if(_0xfaccc7){return _0x342504(_0xfaccc7);}pm2[_0xd321('0x6')]();return _0x1abce8(_0x18d8a0);});});});};exports[_0xd321('0x9')]=function(){return connect()[_0xd321('0x5')](function(){return new BPromise(function(_0xfd7d82,_0x5df44d){return pm2[_0xd321('0x9')](function(_0x2d3d38,_0x1adda3){if(_0x2d3d38){return _0x5df44d(_0x2d3d38);}pm2[_0xd321('0x6')]();return _0xfd7d82(_0x1adda3);});});});};exports[_0xd321('0xa')]=function(_0x41b7dc){return connect()[_0xd321('0x5')](function(){return new BPromise(function(_0x3e7f98,_0x3edb59){return pm2[_0xd321('0xa')](_0x41b7dc,function(_0x1ec945,_0x34c099){if(_0x1ec945){return _0x3edb59(_0x1ec945);}pm2[_0xd321('0x6')]();return _0x3e7f98(_0x34c099);});});});};exports[_0xd321('0xb')]=function(_0x49e83a){return connect()['then'](function(){return new BPromise(function(_0x4e6666,_0x150bff){return pm2['delete'](_0x49e83a,function(_0x5ae961,_0x50b92a){if(_0x5ae961){return _0x150bff(_0x5ae961);}pm2[_0xd321('0x6')]();return _0x4e6666(_0x50b92a);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x176c57,_0x33ef44){return pm2['dump'](function(_0x360025){if(_0x360025){return _0x33ef44(_0x360025);}return _0x176c57(_0xd321('0xc'));});});});}; \ No newline at end of file +var _0x837e=['connect','connected','start','stop','disconnect','restart','then','list','describe','delete','dump','saved','./config'];(function(_0x77e916,_0x3d82c4){var _0x4db828=function(_0x43925b){while(--_0x43925b){_0x77e916['push'](_0x77e916['shift']());}};_0x4db828(++_0x3d82c4);}(_0x837e,0xcf));var _0xe837=function(_0x2a750d,_0x2a98af){_0x2a750d=_0x2a750d-0x0;var _0x12524a=_0x837e[_0x2a750d];return _0x12524a;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0xe837('0x0'));function connect(){return new BPromise(function(_0x55e62c,_0x572542){return pm2[_0xe837('0x1')](function(_0x3bca64){if(_0x3bca64){return _0x572542(_0x3bca64);}return _0x55e62c(_0xe837('0x2'));});});};exports[_0xe837('0x3')]=function(_0x43d370){return connect()['then'](function(){return new BPromise(function(_0xd968d4,_0x4f1e2d){return pm2[_0xe837('0x3')](_0x43d370,function(_0x307f04,_0x1dd57f){if(_0x307f04){return _0x4f1e2d(_0x307f04);}pm2['disconnect']();return _0xd968d4(_0x1dd57f);});});});};exports[_0xe837('0x4')]=function(_0xf058e5){return connect()['then'](function(){return new BPromise(function(_0x3aa06e,_0x48316b){return pm2['stop'](_0xf058e5,function(_0x27ee54,_0x49fd2a){if(_0x27ee54){return _0x48316b(_0x27ee54);}pm2[_0xe837('0x5')]();return _0x3aa06e(_0x49fd2a);});});});};exports[_0xe837('0x6')]=function(_0x5e0f83){return connect()[_0xe837('0x7')](function(){return new BPromise(function(_0x414149,_0x2e937d){return pm2['restart'](_0x5e0f83,function(_0x4b5fc6,_0x300097){if(_0x4b5fc6){return _0x2e937d(_0x4b5fc6);}pm2[_0xe837('0x5')]();return _0x414149(_0x300097);});});});};exports[_0xe837('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x174e7f,_0x4e5daa){return pm2[_0xe837('0x8')](function(_0x25c36d,_0x31fc1b){if(_0x25c36d){return _0x4e5daa(_0x25c36d);}pm2[_0xe837('0x5')]();return _0x174e7f(_0x31fc1b);});});});};exports[_0xe837('0x9')]=function(_0xd20688){return connect()[_0xe837('0x7')](function(){return new BPromise(function(_0x7f089e,_0x4227bd){return pm2[_0xe837('0x9')](_0xd20688,function(_0x55f7c1,_0x25025b){if(_0x55f7c1){return _0x4227bd(_0x55f7c1);}pm2['disconnect']();return _0x7f089e(_0x25025b);});});});};exports[_0xe837('0xa')]=function(_0x127304){return connect()[_0xe837('0x7')](function(){return new BPromise(function(_0x3c8761,_0x54deed){return pm2[_0xe837('0xa')](_0x127304,function(_0x44213a,_0x22918b){if(_0x44213a){return _0x54deed(_0x44213a);}pm2[_0xe837('0x5')]();return _0x3c8761(_0x22918b);});});});};exports[_0xe837('0xb')]=function(){return connect()[_0xe837('0x7')](function(){return new BPromise(function(_0x5b025b,_0x2681fb){return pm2['dump'](function(_0x3f8f5c){if(_0x3f8f5c){return _0x2681fb(_0x3f8f5c);}return _0x5b025b(_0xe837('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7869547..60d88e9 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 _0xf733=['YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','then','ChatInteraction','findAll','subtract','chatTimeout','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format'];(function(_0x5ef20c,_0x4abc22){var _0x4c9129=function(_0x25eff0){while(--_0x25eff0){_0x5ef20c['push'](_0x5ef20c['shift']());}};_0x4c9129(++_0x4abc22);}(_0xf733,0x1d9));var _0x3f73=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xf733[_0x582274];return _0x8f14d3;};'use strict';var _=require(_0x3f73('0x0'));var moment=require(_0x3f73('0x1'));var Redis=require(_0x3f73('0x2'));var util=require(_0x3f73('0x3'));var config=require('../../config/environment');var db=require(_0x3f73('0x4'))['db'];var logger=require(_0x3f73('0x5'))(_0x3f73('0x6'));config[_0x3f73('0x7')]=_['defaults'](config['redis'],{'host':_0x3f73('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f73('0x7')]));function closeInteractions(){var _0x1119aa=0x0;var _0x113cd4=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x3f73('0x9')](function(_0x4551cb){_0x1119aa=_0x4551cb['chatTimeout'];if(_0x1119aa){return db[_0x3f73('0xa')][_0x3f73('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3f73('0xc')](_0x4551cb[_0x3f73('0xd')],_0x3f73('0xe'))}}});}else{return[];}})[_0x3f73('0x9')](function(_0x590a10){if(_0x590a10&&_0x590a10[_0x3f73('0xf')]){_0x113cd4=_[_0x3f73('0x10')](_0x590a10||[],'id');logger['info'](_0x3f73('0x11'),_0x113cd4[_0x3f73('0x12')]());return db['ChatInteraction'][_0x3f73('0x13')]({'closeReason':_0x3f73('0x14'),'disposition':_0x3f73('0x15'),'closed':!![],'closedAt':moment()[_0x3f73('0x16')](_0x3f73('0x17'))},{'where':{'id':_0x113cd4}});}})['then'](function(){if(_0x113cd4&&_0x113cd4[_0x3f73('0xf')]){logger[_0x3f73('0x18')](_0x3f73('0x19'),_0x113cd4[_0x3f73('0x12')]());for(var _0x1ec91d=0x0;_0x1ec91d<_0x113cd4['length'];_0x1ec91d++){io['emit'](_0x3f73('0x1a'),{'id':_0x113cd4[_0x1ec91d],'closed':!![]});}}})[_0x3f73('0x1b')](function(_0x91feb2){logger[_0x3f73('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x91feb2?util[_0x3f73('0x1d')](_0x91feb2,{'showHidden':![],'depth':null}):'');});}exports[_0x3f73('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xafba=['moment','util','../../mysqldb','schedule','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','length','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x163e36,_0x1a0fc9){var _0x500fc1=function(_0x4144d6){while(--_0x4144d6){_0x163e36['push'](_0x163e36['shift']());}};_0x500fc1(++_0x1a0fc9);}(_0xafba,0xb9));var _0xaafb=function(_0x10efce,_0x5004cb){_0x10efce=_0x10efce-0x0;var _0x4c5573=_0xafba[_0x10efce];return _0x4c5573;};'use strict';var _=require(_0xaafb('0x0'));var moment=require(_0xaafb('0x1'));var Redis=require('ioredis');var util=require(_0xaafb('0x2'));var config=require('../../config/environment');var db=require(_0xaafb('0x3'))['db'];var logger=require('../logger')(_0xaafb('0x4'));config['redis']=_[_0xaafb('0x5')](config['redis'],{'host':_0xaafb('0x6'),'port':0x18eb});var io=require(_0xaafb('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x481cc2=0x0;var _0x34ed61=[];return db[_0xaafb('0x8')][_0xaafb('0x9')]({'raw':!![],'attributes':['id',_0xaafb('0xa')],'where':{'id':0x1}})[_0xaafb('0xb')](function(_0x15225c){_0x481cc2=_0x15225c[_0xaafb('0xa')];if(_0x481cc2){return db['ChatInteraction'][_0xaafb('0xc')]({'raw':!![],'attributes':['id',_0xaafb('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xaafb('0xe')](_0x15225c[_0xaafb('0xa')],'minutes')}}});}else{return[];}})[_0xaafb('0xb')](function(_0x3ecd6a){if(_0x3ecd6a&&_0x3ecd6a[_0xaafb('0xf')]){_0x34ed61=_['map'](_0x3ecd6a||[],'id');logger['info'](_0xaafb('0x10'),_0x34ed61[_0xaafb('0x11')]());return db['ChatInteraction'][_0xaafb('0x12')]({'closeReason':_0xaafb('0x13'),'disposition':_0xaafb('0x14'),'closed':!![],'closedAt':moment()['format'](_0xaafb('0x15'))},{'where':{'id':_0x34ed61}});}})['then'](function(){if(_0x34ed61&&_0x34ed61[_0xaafb('0xf')]){logger[_0xaafb('0x16')](_0xaafb('0x17'),_0x34ed61[_0xaafb('0x11')]());for(var _0x5c3ff8=0x0;_0x5c3ff8<_0x34ed61['length'];_0x5c3ff8++){io[_0xaafb('0x18')](_0xaafb('0x19'),{'id':_0x34ed61[_0x5c3ff8],'closed':!![]});}}})[_0xaafb('0x1a')](function(_0x374814){logger[_0xaafb('0x1b')](_0xaafb('0x1c'),_0x374814?util[_0xaafb('0x1d')](_0x374814,{'showHidden':![],'depth':null}):'');});}exports[_0xaafb('0x1e')]=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 05dfff2..8253040 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 _0x3f65=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x321208,_0x26fe9f){var _0x358ffc=function(_0x183aab){while(--_0x183aab){_0x321208['push'](_0x321208['shift']());}};_0x358ffc(++_0x26fe9f);}(_0x3f65,0x9f));var _0x53f6=function(_0x232802,_0x4f521d){_0x232802=_0x232802-0x0;var _0x4f80c7=_0x3f65[_0x232802];return _0x4f80c7;};'use strict';function start(){var _0x1e3528=require(_0x53f6('0x0'));return _0x1e3528['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +'use strict';function start(){var _0x20ec20=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x20ec20['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1b069bb..c4a9929 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 _0x5ae6=['\x22%s\x22\x20<%s>','name','email','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','zip','existsSync','status','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','exists','stop\x20cron','update','update\x20cron','start','util','path','lodash','moment','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','secure','authentication','user'];(function(_0x24d589,_0x477bf2){var _0x17f3d8=function(_0x5c3e55){while(--_0x5c3e55){_0x24d589['push'](_0x24d589['shift']());}};_0x17f3d8(++_0x477bf2);}(_0x5ae6,0x192));var _0x65ae=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x5ae6[_0x4e1a49];return _0x136aae;};'use strict';var fs=require('fs');var util=require(_0x65ae('0x0'));var path=require(_0x65ae('0x1'));var _=require(_0x65ae('0x2'));var moment=require(_0x65ae('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x65ae('0x4'));var BPromise=require(_0x65ae('0x5'));var logger=require(_0x65ae('0x6'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x65ae('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x65ae('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x28325f,_0x100772){return function(){logger[_0x65ae('0x9')](_0x65ae('0xa'),_0x28325f['email']);var _0x295b66=!![];var _0x15736e={'tls':{'rejectUnauthorized':![]}};if(_0x28325f[_0x65ae('0xb')][_0x65ae('0xc')][_0x65ae('0xd')]){_0x15736e[_0x65ae('0xd')]=_0x28325f[_0x65ae('0xb')][_0x65ae('0xc')][_0x65ae('0xd')];}else{_0x15736e[_0x65ae('0xe')]=_0x28325f[_0x65ae('0xb')][_0x65ae('0xc')][_0x65ae('0xe')];_0x15736e['port']=_0x28325f[_0x65ae('0xb')]['Smtp']['port'];_0x15736e['secure']=_0x28325f[_0x65ae('0xb')][_0x65ae('0xc')][_0x65ae('0xf')];}if(_0x28325f[_0x65ae('0xb')][_0x65ae('0xc')][_0x65ae('0x10')]){_0x15736e['auth']={'user':_0x28325f[_0x65ae('0xb')]['Smtp'][_0x65ae('0x11')],'pass':_0x28325f[_0x65ae('0xb')]['Smtp']['pass']};}var _0x4c0854={'account':_0x15736e,'message':{'from':util['format'](_0x65ae('0x12'),_0x28325f[_0x65ae('0xb')][_0x65ae('0x13')],_0x28325f[_0x65ae('0xb')][_0x65ae('0x14')]||_0x28325f[_0x65ae('0xb')][_0x65ae('0xc')]['user']),'to':_0x28325f[_0x65ae('0x14')],'cc':_0x28325f['cc'],'bcc':_0x28325f[_0x65ae('0x15')],'subject':util[_0x65ae('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x100772['name'],_0x28325f[_0x65ae('0x17')],_0x28325f[_0x65ae('0x18')])}};var _0x59c803=path[_0x65ae('0x19')](__dirname,_0x65ae('0x1a'));var _0x1ea8b7=_0x100772['savename'];var _0x10eede=util['format']('%s.%s',path[_0x65ae('0x1b')](_0x100772['savename'],path['extname'](_0x100772[_0x65ae('0x1c')])),_0x65ae('0x1d'));var _0x7a61e7=path['join'](_0x59c803,_0x1ea8b7);var _0x36cc7f=path[_0x65ae('0x19')](_0x59c803,_0x10eede);if(fs[_0x65ae('0x1e')](_0x7a61e7)){_0x100772[_0x65ae('0x1f')]='Sent';_0x4c0854[_0x65ae('0x20')]['attachments']=[{'filename':_0x1ea8b7,'path':_0x7a61e7}];_0x4c0854[_0x65ae('0x20')][_0x65ae('0x21')]=util[_0x65ae('0x16')](_0x65ae('0x22'),JSON[_0x65ae('0x23')](_0x100772,null,0x2));}else if(fs[_0x65ae('0x1e')](_0x36cc7f)){_0x100772[_0x65ae('0x1f')]=_0x65ae('0x24');_0x4c0854[_0x65ae('0x20')][_0x65ae('0x25')]=[{'filename':_0x10eede,'path':_0x36cc7f}];}else{_0x4c0854[_0x65ae('0x20')][_0x65ae('0x21')]=_0x65ae('0x26');if(!_0x28325f[_0x65ae('0x27')]){_0x295b66=![];logger[_0x65ae('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x295b66){return client[_0x65ae('0x28')](_0x65ae('0x29'),_0x4c0854)[_0x65ae('0x2a')](function(_0x42adc5){if(_0x42adc5[_0x65ae('0x2b')]){return logger['error'](_0x65ae('0x2c'),JSON[_0x65ae('0x23')](_0x42adc5));}return logger[_0x65ae('0x9')](_0x65ae('0x2d'));})['catch'](function(_0x1d5bbc){return logger['error'](_0x65ae('0x2c'),JSON[_0x65ae('0x23')](_0x1d5bbc));});}};}function handleError(){return function(_0x44c812){return logger[_0x65ae('0x2b')](JSON[_0x65ae('0x23')](_0x44c812));};}function handleResult(_0x2428ee){return function(_0x2c4495){logger[_0x65ae('0x9')]('data',JSON[_0x65ae('0x23')](_0x2c4495));if(_0x2428ee['MailAccount']&&_0x2428ee[_0x65ae('0xb')][_0x65ae('0xc')]&&!_[_0x65ae('0x2e')](_0x2428ee[_0x65ae('0x14')])){setTimeout(handleSendEmail(_0x2428ee,_0x2c4495),0x3c*0x3e8);}};}function handleJob(_0x471521){return function(){try{if(_[_0x65ae('0x2e')](_0x471521[_0x65ae('0x17')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x65ae('0x2e')](_0x471521[_0x65ae('0x18')])){return logger[_0x65ae('0x9')](_0x65ae('0x2f'));}var _0x4a14b9={'startDate':moment()[_0x65ae('0x30')](_0x471521['subtractNumber'],_0x471521[_0x65ae('0x18')])[_0x65ae('0x16')](_0x65ae('0x31')),'endDate':moment()['format'](_0x65ae('0x31')),'type':'scheduled','output':_0x471521[_0x65ae('0x32')],'name':_0x471521[_0x65ae('0x13')]};if(!_[_0x65ae('0x2e')](_0x471521[_0x65ae('0x33')])){logger[_0x65ae('0x9')](_0x65ae('0x34'),_0x471521[_0x65ae('0x33')]);return analyticDefaultReportController[_0x65ae('0x35')]({'id':_0x471521[_0x65ae('0x33')]},_0x4a14b9)['then'](handleResult(_0x471521))[_0x65ae('0x36')](handleError());}if(!_[_0x65ae('0x2e')](_0x471521[_0x65ae('0x37')])){logger[_0x65ae('0x9')](_0x65ae('0x38'),_0x471521[_0x65ae('0x37')]);return analyticCustomReportController[_0x65ae('0x35')]({'id':_0x471521[_0x65ae('0x37')]},_0x4a14b9)[_0x65ae('0x2a')](handleResult(_0x471521))[_0x65ae('0x36')](handleError());}}catch(_0x3d7935){logger[_0x65ae('0x2b')](JSON[_0x65ae('0x23')](_0x3d7935));}return logger['info'](_0x65ae('0x39'));};}function getJobs(_0x470050){var _0x428987={};if(_0x470050){_0x428987['id']=_0x470050;}return db[_0x65ae('0x3a')][_0x65ae('0x3b')]({'where':_0x428987,'include':[{'model':db[_0x65ae('0xb')],'attributes':['id',_0x65ae('0x13'),_0x65ae('0x14')],'include':[{'model':db[_0x65ae('0x3c')],'as':_0x65ae('0xc')}]}]})['then'](function(_0x28d79d){var _0x123f9f=_[_0x65ae('0x3d')](manager[_0x65ae('0x3e')]);var _0x22a056=_['map'](_0x28d79d,function(_0x95e39b){return _0x95e39b['id'][_0x65ae('0x3f')]();});var _0xad6b95=_[_0x65ae('0x40')](_0x28d79d,function(_0x387f3d){return _0x387f3d['id'][_0x65ae('0x3f')]();});var _0x100d01=_0x470050?_0x22a056:_['difference'](_0x22a056,_0x123f9f);var _0x373aba=_['intersection'](_0x22a056,_0x123f9f);var _0x54aada=_[_0x65ae('0x41')](_0x123f9f,_0x22a056);var _0xbf1fad;var _0xf9ce1;for(_0xbf1fad=0x0;_0xbf1fad<_0x54aada[_0x65ae('0x42')]&&!_0x470050;_0xbf1fad+=0x1){_0xf9ce1=_0x54aada[_0xbf1fad][_0x65ae('0x3f')]();if(manager['exists'](_0xf9ce1)){manager[_0x65ae('0x43')](_0xf9ce1);manager[_0x65ae('0x44')](_0xf9ce1);logger[_0x65ae('0x9')](_0x65ae('0x45'),_0xf9ce1);}}logger['info'](_0x65ae('0x46'),JSON[_0x65ae('0x23')](_0x100d01));for(_0xbf1fad=0x0;_0xbf1fad<_0x100d01[_0x65ae('0x42')];_0xbf1fad+=0x1){_0xf9ce1=_0x100d01[_0xbf1fad][_0x65ae('0x3f')]();logger[_0x65ae('0x9')]('index',_0xf9ce1);if(_0x470050){logger[_0x65ae('0x9')]('my\x20id',_0x470050);logger[_0x65ae('0x9')](JSON[_0x65ae('0x23')](_0xad6b95[_0xf9ce1]));BPromise[_0x65ae('0x47')]()[_0x65ae('0x2a')](handleJob(_0xad6b95[_0xf9ce1]));logger[_0x65ae('0x9')](_0x65ae('0x48'),_0xad6b95[_0xf9ce1]['name'],_0xad6b95[_0xf9ce1]['cron']);}else if(_0xad6b95[_0xf9ce1][_0x65ae('0x49')]&&_0xad6b95[_0xf9ce1][_0x65ae('0x4a')]&&moment()[_0x65ae('0x4b')](_0xad6b95[_0xf9ce1][_0x65ae('0x4c')],_0xad6b95[_0xf9ce1][_0x65ae('0x4d')])){manager[_0x65ae('0x4e')](_0xf9ce1,_0xad6b95[_0xf9ce1][_0x65ae('0x49')],handleJob(_0xad6b95[_0xf9ce1]));manager['start'](_0xf9ce1);logger['info']('add\x20cron',_0xad6b95[_0xf9ce1][_0x65ae('0x13')],_0xad6b95[_0xf9ce1][_0x65ae('0x49')]);}else if(manager[_0x65ae('0x4f')](_0xf9ce1)){manager[_0x65ae('0x43')](_0xf9ce1);manager[_0x65ae('0x44')](_0xf9ce1);logger[_0x65ae('0x9')](_0x65ae('0x50'),_0xad6b95[_0xf9ce1][_0x65ae('0x13')],_0xad6b95[_0xf9ce1][_0x65ae('0x49')]);}}for(_0xbf1fad=0x0,_0xf9ce1;_0xbf1fad<_0x373aba['length']&&!_0x470050;_0xbf1fad+=0x1){_0xf9ce1=_0x373aba[_0xbf1fad][_0x65ae('0x3f')]();if(manager[_0x65ae('0x4f')](_0xf9ce1)){if(_0xad6b95[_0xf9ce1][_0x65ae('0x49')]&&_0xad6b95[_0xf9ce1][_0x65ae('0x4a')]&&moment()[_0x65ae('0x4b')](_0xad6b95[_0xf9ce1]['startAt'],_0xad6b95[_0xf9ce1][_0x65ae('0x4d')])){manager[_0x65ae('0x51')](_0xf9ce1,_0xad6b95[_0xf9ce1][_0x65ae('0x49')],handleJob(_0xad6b95[_0xf9ce1]));logger[_0x65ae('0x9')](_0x65ae('0x52'),_0xad6b95[_0xf9ce1][_0x65ae('0x13')],_0xad6b95[_0xf9ce1][_0x65ae('0x49')]);}else{manager[_0x65ae('0x43')](_0xf9ce1);manager[_0x65ae('0x44')](_0xf9ce1);logger['info']('stop\x20cron',_0xad6b95[_0xf9ce1][_0x65ae('0x13')],_0xad6b95[_0xf9ce1]['cron']);}}}})[_0x65ae('0x36')](function(_0x1e9bd6){logger[_0x65ae('0x2b')](JSON['stringify'](_0x1e9bd6));});}exports['run']=function(_0x4abc7b){return getJobs(_0x4abc7b);};exports[_0x65ae('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb883=['cron','active','isBetween','startAt','endAt','add','start','stop','update','update\x20cron','stop\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','length','exists','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job'];(function(_0x1c5734,_0xe14e5f){var _0x506967=function(_0x80dbd2){while(--_0x80dbd2){_0x1c5734['push'](_0x1c5734['shift']());}};_0x506967(++_0xe14e5f);}(_0xb883,0x174));var _0x3b88=function(_0x5a0845,_0x2e66c5){_0x5a0845=_0x5a0845-0x0;var _0x31d612=_0xb883[_0x5a0845];return _0x31d612;};'use strict';var fs=require('fs');var util=require(_0x3b88('0x0'));var path=require('path');var _=require(_0x3b88('0x1'));var moment=require(_0x3b88('0x2'));var CronJobManager=require(_0x3b88('0x3'));var jayson=require(_0x3b88('0x4'));var BPromise=require(_0x3b88('0x5'));var logger=require(_0x3b88('0x6'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x3b88('0x7'));var analyticDefaultReportController=require(_0x3b88('0x8'));var client=jayson[_0x3b88('0x9')][_0x3b88('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x30d1d3,_0x1fc781){return function(){logger[_0x3b88('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x30d1d3[_0x3b88('0xc')]);var _0x22015c=!![];var _0x1f3522={'tls':{'rejectUnauthorized':![]}};if(_0x30d1d3[_0x3b88('0xd')][_0x3b88('0xe')][_0x3b88('0xf')]){_0x1f3522[_0x3b88('0xf')]=_0x30d1d3['MailAccount'][_0x3b88('0xe')][_0x3b88('0xf')];}else{_0x1f3522[_0x3b88('0x10')]=_0x30d1d3['MailAccount'][_0x3b88('0xe')][_0x3b88('0x10')];_0x1f3522[_0x3b88('0x11')]=_0x30d1d3[_0x3b88('0xd')]['Smtp'][_0x3b88('0x11')];_0x1f3522['secure']=_0x30d1d3[_0x3b88('0xd')]['Smtp'][_0x3b88('0x12')];}if(_0x30d1d3[_0x3b88('0xd')][_0x3b88('0xe')][_0x3b88('0x13')]){_0x1f3522[_0x3b88('0x14')]={'user':_0x30d1d3['MailAccount'][_0x3b88('0xe')]['user'],'pass':_0x30d1d3[_0x3b88('0xd')][_0x3b88('0xe')][_0x3b88('0x15')]};}var _0x2fd7cb={'account':_0x1f3522,'message':{'from':util[_0x3b88('0x16')]('\x22%s\x22\x20<%s>',_0x30d1d3[_0x3b88('0xd')][_0x3b88('0x17')],_0x30d1d3[_0x3b88('0xd')][_0x3b88('0xc')]||_0x30d1d3['MailAccount'][_0x3b88('0xe')][_0x3b88('0x18')]),'to':_0x30d1d3['email'],'cc':_0x30d1d3['cc'],'bcc':_0x30d1d3[_0x3b88('0x19')],'subject':util['format'](_0x3b88('0x1a'),_0x1fc781['name'],_0x30d1d3['subtractNumber'],_0x30d1d3['subtractUnit'])}};var _0x3b32c4=path[_0x3b88('0x1b')](__dirname,_0x3b88('0x1c'));var _0x1e69bc=_0x1fc781[_0x3b88('0x1d')];var _0x31678d=util['format'](_0x3b88('0x1e'),path[_0x3b88('0x1f')](_0x1fc781['savename'],path[_0x3b88('0x20')](_0x1fc781[_0x3b88('0x1d')])),_0x3b88('0x21'));var _0x56b3ff=path[_0x3b88('0x1b')](_0x3b32c4,_0x1e69bc);var _0x2a0f9e=path['join'](_0x3b32c4,_0x31678d);if(fs['existsSync'](_0x56b3ff)){_0x1fc781[_0x3b88('0x22')]=_0x3b88('0x23');_0x2fd7cb[_0x3b88('0x24')]['attachments']=[{'filename':_0x1e69bc,'path':_0x56b3ff}];_0x2fd7cb['message']['text']=util[_0x3b88('0x16')](_0x3b88('0x25'),JSON[_0x3b88('0x26')](_0x1fc781,null,0x2));}else if(fs[_0x3b88('0x27')](_0x2a0f9e)){_0x1fc781['status']=_0x3b88('0x23');_0x2fd7cb[_0x3b88('0x24')][_0x3b88('0x28')]=[{'filename':_0x31678d,'path':_0x2a0f9e}];}else{_0x2fd7cb[_0x3b88('0x24')][_0x3b88('0x29')]=_0x3b88('0x2a');if(!_0x30d1d3[_0x3b88('0x2b')]){_0x22015c=![];logger[_0x3b88('0xb')](_0x3b88('0x2c'));}}if(_0x22015c){return client[_0x3b88('0x2d')](_0x3b88('0x2e'),_0x2fd7cb)[_0x3b88('0x2f')](function(_0x1e8111){if(_0x1e8111[_0x3b88('0x30')]){return logger[_0x3b88('0x30')]('error\x20mail',JSON[_0x3b88('0x26')](_0x1e8111));}return logger[_0x3b88('0xb')](_0x3b88('0x31'));})[_0x3b88('0x32')](function(_0x545819){return logger[_0x3b88('0x30')]('error\x20mail',JSON[_0x3b88('0x26')](_0x545819));});}};}function handleError(){return function(_0x569c92){return logger[_0x3b88('0x30')](JSON['stringify'](_0x569c92));};}function handleResult(_0x3bdaff){return function(_0x6927e4){logger[_0x3b88('0xb')]('data',JSON[_0x3b88('0x26')](_0x6927e4));if(_0x3bdaff[_0x3b88('0xd')]&&_0x3bdaff['MailAccount'][_0x3b88('0xe')]&&!_[_0x3b88('0x33')](_0x3bdaff[_0x3b88('0xc')])){setTimeout(handleSendEmail(_0x3bdaff,_0x6927e4),0x3c*0x3e8);}};}function handleJob(_0x24725c){return function(){try{if(_['isNil'](_0x24725c[_0x3b88('0x34')])){return logger[_0x3b88('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x24725c[_0x3b88('0x35')])){return logger[_0x3b88('0xb')](_0x3b88('0x36'));}var _0x18b720={'startDate':moment()[_0x3b88('0x37')](_0x24725c['subtractNumber'],_0x24725c['subtractUnit'])[_0x3b88('0x16')](_0x3b88('0x38')),'endDate':moment()[_0x3b88('0x16')](_0x3b88('0x38')),'type':_0x3b88('0x39'),'output':_0x24725c[_0x3b88('0x3a')],'name':_0x24725c[_0x3b88('0x17')]};if(!_[_0x3b88('0x33')](_0x24725c[_0x3b88('0x3b')])){logger[_0x3b88('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x24725c[_0x3b88('0x3b')]);return analyticDefaultReportController[_0x3b88('0x3c')]({'id':_0x24725c[_0x3b88('0x3b')]},_0x18b720)[_0x3b88('0x2f')](handleResult(_0x24725c))['catch'](handleError());}if(!_[_0x3b88('0x33')](_0x24725c[_0x3b88('0x3d')])){logger[_0x3b88('0xb')](_0x3b88('0x3e'),_0x24725c[_0x3b88('0x3d')]);return analyticCustomReportController[_0x3b88('0x3c')]({'id':_0x24725c[_0x3b88('0x3d')]},_0x18b720)['then'](handleResult(_0x24725c))[_0x3b88('0x32')](handleError());}}catch(_0x499ce1){logger[_0x3b88('0x30')](JSON[_0x3b88('0x26')](_0x499ce1));}return logger[_0x3b88('0xb')](_0x3b88('0x3f'));};}function getJobs(_0x44d0c6){var _0x3bba3a={};if(_0x44d0c6){_0x3bba3a['id']=_0x44d0c6;}return db[_0x3b88('0x40')][_0x3b88('0x41')]({'where':_0x3bba3a,'include':[{'model':db['MailAccount'],'attributes':['id',_0x3b88('0x17'),_0x3b88('0xc')],'include':[{'model':db[_0x3b88('0x42')],'as':_0x3b88('0xe')}]}]})[_0x3b88('0x2f')](function(_0x343d30){var _0x4e7ac0=_['keys'](manager[_0x3b88('0x43')]);var _0x5eff14=_[_0x3b88('0x44')](_0x343d30,function(_0x3dcd62){return _0x3dcd62['id'][_0x3b88('0x45')]();});var _0x4bd656=_['keyBy'](_0x343d30,function(_0x44f391){return _0x44f391['id']['toString']();});var _0x23c74e=_0x44d0c6?_0x5eff14:_['difference'](_0x5eff14,_0x4e7ac0);var _0x3145cd=_['intersection'](_0x5eff14,_0x4e7ac0);var _0x413e58=_['difference'](_0x4e7ac0,_0x5eff14);var _0x58a3f7;var _0x2c8f08;for(_0x58a3f7=0x0;_0x58a3f7<_0x413e58[_0x3b88('0x46')]&&!_0x44d0c6;_0x58a3f7+=0x1){_0x2c8f08=_0x413e58[_0x58a3f7][_0x3b88('0x45')]();if(manager[_0x3b88('0x47')](_0x2c8f08)){manager['stop'](_0x2c8f08);manager[_0x3b88('0x48')](_0x2c8f08);logger['info'](_0x3b88('0x49'),_0x2c8f08);}}logger[_0x3b88('0xb')]('toRun',JSON[_0x3b88('0x26')](_0x23c74e));for(_0x58a3f7=0x0;_0x58a3f7<_0x23c74e[_0x3b88('0x46')];_0x58a3f7+=0x1){_0x2c8f08=_0x23c74e[_0x58a3f7][_0x3b88('0x45')]();logger['info'](_0x3b88('0x4a'),_0x2c8f08);if(_0x44d0c6){logger[_0x3b88('0xb')](_0x3b88('0x4b'),_0x44d0c6);logger[_0x3b88('0xb')](JSON[_0x3b88('0x26')](_0x4bd656[_0x2c8f08]));BPromise[_0x3b88('0x4c')]()[_0x3b88('0x2f')](handleJob(_0x4bd656[_0x2c8f08]));logger[_0x3b88('0xb')](_0x3b88('0x4d'),_0x4bd656[_0x2c8f08]['name'],_0x4bd656[_0x2c8f08][_0x3b88('0x4e')]);}else if(_0x4bd656[_0x2c8f08][_0x3b88('0x4e')]&&_0x4bd656[_0x2c8f08][_0x3b88('0x4f')]&&moment()[_0x3b88('0x50')](_0x4bd656[_0x2c8f08][_0x3b88('0x51')],_0x4bd656[_0x2c8f08][_0x3b88('0x52')])){manager[_0x3b88('0x53')](_0x2c8f08,_0x4bd656[_0x2c8f08]['cron'],handleJob(_0x4bd656[_0x2c8f08]));manager[_0x3b88('0x54')](_0x2c8f08);logger[_0x3b88('0xb')]('add\x20cron',_0x4bd656[_0x2c8f08]['name'],_0x4bd656[_0x2c8f08][_0x3b88('0x4e')]);}else if(manager[_0x3b88('0x47')](_0x2c8f08)){manager[_0x3b88('0x55')](_0x2c8f08);manager['deleteJob'](_0x2c8f08);logger['info']('stop\x20cron',_0x4bd656[_0x2c8f08]['name'],_0x4bd656[_0x2c8f08][_0x3b88('0x4e')]);}}for(_0x58a3f7=0x0,_0x2c8f08;_0x58a3f7<_0x3145cd[_0x3b88('0x46')]&&!_0x44d0c6;_0x58a3f7+=0x1){_0x2c8f08=_0x3145cd[_0x58a3f7][_0x3b88('0x45')]();if(manager[_0x3b88('0x47')](_0x2c8f08)){if(_0x4bd656[_0x2c8f08][_0x3b88('0x4e')]&&_0x4bd656[_0x2c8f08][_0x3b88('0x4f')]&&moment()[_0x3b88('0x50')](_0x4bd656[_0x2c8f08]['startAt'],_0x4bd656[_0x2c8f08][_0x3b88('0x52')])){manager[_0x3b88('0x56')](_0x2c8f08,_0x4bd656[_0x2c8f08][_0x3b88('0x4e')],handleJob(_0x4bd656[_0x2c8f08]));logger['info'](_0x3b88('0x57'),_0x4bd656[_0x2c8f08][_0x3b88('0x17')],_0x4bd656[_0x2c8f08][_0x3b88('0x4e')]);}else{manager[_0x3b88('0x55')](_0x2c8f08);manager[_0x3b88('0x48')](_0x2c8f08);logger[_0x3b88('0xb')](_0x3b88('0x58'),_0x4bd656[_0x2c8f08][_0x3b88('0x17')],_0x4bd656[_0x2c8f08]['cron']);}}}})[_0x3b88('0x32')](function(_0x2c9633){logger[_0x3b88('0x30')](JSON[_0x3b88('0x26')](_0x2c9633));});}exports[_0x3b88('0x59')]=function(_0x7d7908){return getJobs(_0x7d7908);};exports[_0x3b88('0x54')]=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 c93bde4..3feaee3 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 _0x49aa=['inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','catch','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','findOne','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x4d2d5c,_0x2171d9){var _0x2b2eb5=function(_0x2bd636){while(--_0x2bd636){_0x4d2d5c['push'](_0x4d2d5c['shift']());}};_0x2b2eb5(++_0x2171d9);}(_0x49aa,0x173));var _0xa49a=function(_0x1393b7,_0x53caed){_0x1393b7=_0x1393b7-0x0;var _0x369bcc=_0x49aa[_0x1393b7];return _0x369bcc;};var _=require(_0xa49a('0x0'));var AWS=require(_0xa49a('0x1'));var rp=require(_0xa49a('0x2'));var util=require('util');var BPromise=require(_0xa49a('0x3'));var db=require(_0xa49a('0x4'))['db'];var logger=require(_0xa49a('0x5'))(_0xa49a('0x6'));function getTranscriptionJob(_0x336285,_0x3a7eb2,_0x50e487,_0xa48025){return new Promise(function(_0x3889ad,_0x3a2283){var _0x40ea52=new AWS[(_0xa49a('0x7'))]({'accessKeyId':_0x3a7eb2,'secretAccessKey':_0x336285,'region':_0x50e487});_0x40ea52['getTranscriptionJob']({'TranscriptionJobName':_0xa48025},function(_0x5f2fa4,_0x4aef33){if(_0x5f2fa4){return _0x3a2283(_0x5f2fa4);}else{return _0x3889ad(_0x4aef33);}});});}function sentiment(_0x38b9b0,_0x4d7922,_0x76de4c,_0x2a576d,_0x2d618b){return new Promise(function(_0x4dd843,_0x316e34){var _0x23ce0f=new AWS[(_0xa49a('0x8'))]({'accessKeyId':_0x4d7922,'secretAccessKey':_0x38b9b0,'region':_0x76de4c});_0x23ce0f[_0xa49a('0x9')]({'Text':_0x2a576d,'LanguageCode':_0x2d618b[_0xa49a('0xa')](0x0,0x2)},function(_0x1d7440,_0x19c830){if(_0x1d7440){return _0x316e34(_0x1d7440);}else{return _0x4dd843(_0x19c830);}});});}function checkTranscribeJob(_0x5a76cc,_0x36d1af,_0x355785){var _0x1755ad;return new BPromise(function(_0x406e6c,_0x404604){logger[_0xa49a('0xb')](util[_0xa49a('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5a76cc['id'],_0x5a76cc[_0xa49a('0xd')]));return getTranscriptionJob(_0x355785[_0xa49a('0xe')],_0x355785[_0xa49a('0xf')],_0x36d1af[_0xa49a('0x10')],_0x5a76cc['transcribeName'])[_0xa49a('0x11')](function(_0x70baa6){logger['info'](util[_0xa49a('0xc')](_0xa49a('0x12'),_0x5a76cc['id'],_0x5a76cc['transcribeName'],_0x70baa6[_0xa49a('0x13')][_0xa49a('0x14')]));if(!_0x5a76cc[_0xa49a('0x15')]){switch(_0x70baa6['TranscriptionJob']['TranscriptionJobStatus']){case _0xa49a('0x16'):var _0x9408c4={'transcribeStatus':_0x70baa6[_0xa49a('0x13')][_0xa49a('0x14')],'fileUri':_0x70baa6[_0xa49a('0x13')][_0xa49a('0x17')][_0xa49a('0x18')]};logger[_0xa49a('0xb')](util[_0xa49a('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x5a76cc['id']));return rp({'uri':_0x70baa6[_0xa49a('0x13')][_0xa49a('0x17')][_0xa49a('0x18')],'json':!![]})['then'](function(_0x1b9029){logger['info'](util[_0xa49a('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5a76cc['id']));if(_0x1b9029&&_0x1b9029[_0xa49a('0x19')]&&_0x1b9029[_0xa49a('0x19')][_0xa49a('0x1a')]&&_0x1b9029[_0xa49a('0x19')][_0xa49a('0x1a')][_0xa49a('0x1b')]){_0x9408c4['fileText']='';for(var _0x16a35a=0x0;_0x16a35a<_0x1b9029[_0xa49a('0x19')]['transcripts'][_0xa49a('0x1b')];_0x16a35a++){_0x9408c4[_0xa49a('0x15')]+=_0x1b9029[_0xa49a('0x19')]['transcripts'][_0x16a35a][_0xa49a('0x1c')]+'';}}return _0x5a76cc[_0xa49a('0x1d')](_0x9408c4);})[_0xa49a('0x11')](function(){logger['info'](util[_0xa49a('0xc')](_0xa49a('0x1e'),_0x5a76cc['id']));if(!_0x5a76cc[_0xa49a('0x1f')]){throw new db[(_0xa49a('0x20'))]['ValidationError'](_0xa49a('0x21'));}if(!_0x36d1af[_0xa49a('0x22')]||!_0x36d1af[_0xa49a('0x23')]||!_0x36d1af[_0xa49a('0x24')]||!_0x36d1af[_0xa49a('0x25')]||!_0x36d1af[_0xa49a('0x26')]){throw new db['Sequelize'][(_0xa49a('0x27'))](_0xa49a('0x28'));}if(!_0x9408c4[_0xa49a('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x36d1af[_0xa49a('0x23')]===_0x355785['id']){return _0x355785;}else{return db[_0xa49a('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa49a('0x11')](function(_0x1ebca4){if(!_0x1ebca4){throw new db['Sequelize'][(_0xa49a('0x27'))](_0xa49a('0x2a'));}if(!_0x1ebca4['data1']||!_0x1ebca4[_0xa49a('0xf')]){throw new db[(_0xa49a('0x20'))][(_0xa49a('0x27'))](_0xa49a('0x2b'));}_0x1755ad=_0x1ebca4;logger[_0xa49a('0xb')](util['format'](_0xa49a('0x2c'),_0x5a76cc['id']));return sentiment(_0x1755ad['data1'],_0x1755ad[_0xa49a('0xf')],_0x36d1af[_0xa49a('0x24')],_0x9408c4[_0xa49a('0x15')],_0x36d1af[_0xa49a('0x25')]);})[_0xa49a('0x11')](function(_0x1e7606){logger[_0xa49a('0xb')](util[_0xa49a('0xc')](_0xa49a('0x2d'),_0x5a76cc['id']));return _0x5a76cc[_0xa49a('0x1d')]({'sentiment':_0x1e7606[_0xa49a('0x2e')],'sPositive':_0x1e7606[_0xa49a('0x2f')][_0xa49a('0x30')],'sNegative':_0x1e7606[_0xa49a('0x2f')][_0xa49a('0x31')],'sMixed':_0x1e7606['SentimentScore'][_0xa49a('0x32')],'sNeutral':_0x1e7606[_0xa49a('0x2f')]['Neutral']});})[_0xa49a('0x11')](function(){logger[_0xa49a('0xb')](util[_0xa49a('0xc')](_0xa49a('0x1e'),_0x5a76cc['id']));_0x406e6c();});case _0xa49a('0x33'):return _0x5a76cc[_0xa49a('0x1d')]({'transcribeStatus':_0xa49a('0x33'),'failureReason':_0x70baa6[_0xa49a('0x13')][_0xa49a('0x34')]})[_0xa49a('0x11')](function(){logger['info'](util[_0xa49a('0xc')](_0xa49a('0x1e'),_0x5a76cc['id']));_0x406e6c();});default:logger[_0xa49a('0xb')](util[_0xa49a('0xc')](_0xa49a('0x35'),_0x5a76cc['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x5a76cc[_0xa49a('0x1f')]){throw new db['Sequelize'][(_0xa49a('0x27'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36d1af[_0xa49a('0x22')]||!_0x36d1af['sentimentAccountId']||!_0x36d1af[_0xa49a('0x24')]||!_0x36d1af[_0xa49a('0x25')]||!_0x36d1af['bucket']){throw new db[(_0xa49a('0x20'))][(_0xa49a('0x27'))](_0xa49a('0x28'));}if(!_0x5a76cc[_0xa49a('0x15')]){throw new Error(_0xa49a('0x36'));}if(_0x36d1af['sentimentAccountId']===_0x355785['id']){return _0x355785;}else{return db['CloudProvider'][_0xa49a('0x37')]({'where':{'id':_settings[_0xa49a('0x23')]}});}})[_0xa49a('0x11')](function(_0x277f53){if(!_0x277f53){throw new db[(_0xa49a('0x20'))]['ValidationError'](_0xa49a('0x2a'));}if(!_0x277f53[_0xa49a('0xe')]||!_0x277f53[_0xa49a('0xf')]){throw new db[(_0xa49a('0x20'))]['ValidationError'](_0xa49a('0x2b'));}_0x1755ad=_0x277f53;logger[_0xa49a('0xb')](util['format'](_0xa49a('0x2c'),_0x5a76cc['id']));return sentiment(_0x1755ad[_0xa49a('0xe')],_0x1755ad[_0xa49a('0xf')],_0x36d1af[_0xa49a('0x24')],_0x5a76cc['fileText'],_0x36d1af['language']);})['then'](function(_0x6b628e){logger['info'](util[_0xa49a('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5a76cc['id']));return _0x5a76cc[_0xa49a('0x1d')]({'sentiment':_0x6b628e['Sentiment'],'sPositive':_0x6b628e[_0xa49a('0x2f')][_0xa49a('0x30')],'sNegative':_0x6b628e[_0xa49a('0x2f')]['Negative'],'sMixed':_0x6b628e[_0xa49a('0x2f')]['Mixed'],'sNeutral':_0x6b628e[_0xa49a('0x2f')][_0xa49a('0x38')],'transcribeStatus':_0xa49a('0x16')});})[_0xa49a('0x11')](function(){logger[_0xa49a('0xb')](util['format'](_0xa49a('0x1e'),_0x5a76cc['id']));_0x406e6c();});}})['catch'](function(_0x4ce64f){if(_0x4ce64f){if(!_0x4ce64f[_0xa49a('0x39')]||_0x4ce64f[_0xa49a('0x39')]!==_0xa49a('0x3a')){logger[_0xa49a('0x3b')](util[_0xa49a('0xc')](_0xa49a('0x3c'),_0x5a76cc['id']),util[_0xa49a('0x3d')](_0x4ce64f,{'showHidden':![],'depth':null}));}}_0x406e6c();});});}function checkTranscribe(){var _0x50294d;var _0x2c8642;var _0x3f4ac4;return db[_0xa49a('0x3e')][_0xa49a('0x3f')]({'where':{'transcribeStatus':_0xa49a('0x40')}})[_0xa49a('0x11')](function(_0x185056){if(!_0x185056||!_0x185056['length']){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x50294d=_0x185056;return db[_0xa49a('0x41')][_0xa49a('0x37')]({'where':{'id':0x1}});})[_0xa49a('0x11')](function(_0xf0ae85){if(!_0xf0ae85){throw new db[(_0xa49a('0x20'))][(_0xa49a('0x27'))](_0xa49a('0x42'));}_0x2c8642=_0xf0ae85;if(!_0x2c8642[_0xa49a('0x6')]||!_0x2c8642[_0xa49a('0x43')]||!_0x2c8642[_0xa49a('0x10')]||!_0x2c8642['language']||!_0x2c8642[_0xa49a('0x26')]){throw new db[(_0xa49a('0x20'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xa49a('0x29')][_0xa49a('0x37')]({'where':{'id':_0x2c8642[_0xa49a('0x43')]}});})[_0xa49a('0x11')](function(_0x559c77){if(!_0x559c77){throw new db[(_0xa49a('0x20'))]['ValidationError'](_0xa49a('0x2a'));}if(!_0x559c77[_0xa49a('0xe')]||!_0x559c77['data2']){throw new db[(_0xa49a('0x20'))][(_0xa49a('0x27'))](_0xa49a('0x2b'));}_0x3f4ac4=_0x559c77;var _0x2def8f=[];_0x50294d['forEach'](function(_0x37569b){_0x2def8f[_0xa49a('0x44')](checkTranscribeJob(_0x37569b,_0x2c8642,_0x3f4ac4));});return BPromise[_0xa49a('0x45')](_0x2def8f);})[_0xa49a('0x46')](function(_0x4eb5b5){if(_0x4eb5b5){if(!_0x4eb5b5['name']||_0x4eb5b5['name']!==_0xa49a('0x3a')){logger[_0xa49a('0x3b')](util['inspect'](_0x4eb5b5,{'showHidden':![],'depth':null}));}}});}exports[_0xa49a('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc5cf=['Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','then','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x207cf8,_0x5e8f63){_0x207cf8=_0x207cf8-0x0;var _0x321d6b=_0xc5cf[_0x207cf8];return _0x321d6b;};var _=require(_0xfc5c('0x0'));var AWS=require(_0xfc5c('0x1'));var rp=require(_0xfc5c('0x2'));var util=require(_0xfc5c('0x3'));var BPromise=require(_0xfc5c('0x4'));var db=require(_0xfc5c('0x5'))['db'];var logger=require(_0xfc5c('0x6'))(_0xfc5c('0x7'));function getTranscriptionJob(_0x380b2c,_0x5cc4cc,_0x41386a,_0x382839){return new Promise(function(_0x3a6ecb,_0x23ae81){var _0x2e99e9=new AWS['TranscribeService']({'accessKeyId':_0x5cc4cc,'secretAccessKey':_0x380b2c,'region':_0x41386a});_0x2e99e9['getTranscriptionJob']({'TranscriptionJobName':_0x382839},function(_0x5b53e1,_0x102495){if(_0x5b53e1){return _0x23ae81(_0x5b53e1);}else{return _0x3a6ecb(_0x102495);}});});}function sentiment(_0x38580a,_0x2d23fa,_0x43bbc6,_0x5bf9f0,_0x3872a0){return new Promise(function(_0x2f24f7,_0x2f4e50){var _0x1572ba=new AWS[(_0xfc5c('0x8'))]({'accessKeyId':_0x2d23fa,'secretAccessKey':_0x38580a,'region':_0x43bbc6});_0x1572ba[_0xfc5c('0x9')]({'Text':_0x5bf9f0,'LanguageCode':_0x3872a0[_0xfc5c('0xa')](0x0,0x2)},function(_0x2e8231,_0x33e436){if(_0x2e8231){return _0x2f4e50(_0x2e8231);}else{return _0x2f24f7(_0x33e436);}});});}function checkTranscribeJob(_0x3b0ab6,_0xc11fa1,_0x2cc07c){var _0x139644;return new BPromise(function(_0xe0e356,_0xfb3d3a){logger['info'](util[_0xfc5c('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3b0ab6['id'],_0x3b0ab6[_0xfc5c('0xc')]));return getTranscriptionJob(_0x2cc07c[_0xfc5c('0xd')],_0x2cc07c[_0xfc5c('0xe')],_0xc11fa1['transcribeRegion'],_0x3b0ab6[_0xfc5c('0xc')])['then'](function(_0x5ed8bd){logger['info'](util['format'](_0xfc5c('0xf'),_0x3b0ab6['id'],_0x3b0ab6['transcribeName'],_0x5ed8bd[_0xfc5c('0x10')]['TranscriptionJobStatus']));if(!_0x3b0ab6[_0xfc5c('0x11')]){switch(_0x5ed8bd[_0xfc5c('0x10')][_0xfc5c('0x12')]){case _0xfc5c('0x13'):var _0x1e1144={'transcribeStatus':_0x5ed8bd['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x5ed8bd[_0xfc5c('0x10')]['Transcript'][_0xfc5c('0x14')]};logger['info'](util[_0xfc5c('0xb')](_0xfc5c('0x15'),_0x3b0ab6['id']));return rp({'uri':_0x5ed8bd[_0xfc5c('0x10')][_0xfc5c('0x16')][_0xfc5c('0x14')],'json':!![]})[_0xfc5c('0x17')](function(_0x3d8b7a){logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x19'),_0x3b0ab6['id']));if(_0x3d8b7a&&_0x3d8b7a[_0xfc5c('0x1a')]&&_0x3d8b7a[_0xfc5c('0x1a')][_0xfc5c('0x1b')]&&_0x3d8b7a['results']['transcripts']['length']){_0x1e1144[_0xfc5c('0x11')]='';for(var _0x50b163=0x0;_0x50b163<_0x3d8b7a['results'][_0xfc5c('0x1b')][_0xfc5c('0x1c')];_0x50b163++){_0x1e1144[_0xfc5c('0x11')]+=_0x3d8b7a[_0xfc5c('0x1a')][_0xfc5c('0x1b')][_0x50b163][_0xfc5c('0x1d')]+'';}}return _0x3b0ab6[_0xfc5c('0x1e')](_0x1e1144);})[_0xfc5c('0x17')](function(){logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x1f'),_0x3b0ab6['id']));if(!_0x3b0ab6[_0xfc5c('0x20')]){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))](_0xfc5c('0x23'));}if(!_0xc11fa1[_0xfc5c('0x24')]||!_0xc11fa1[_0xfc5c('0x25')]||!_0xc11fa1[_0xfc5c('0x26')]||!_0xc11fa1['language']||!_0xc11fa1[_0xfc5c('0x27')]){throw new db[(_0xfc5c('0x21'))]['ValidationError'](_0xfc5c('0x28'));}if(!_0x1e1144['fileText']){throw new Error(_0xfc5c('0x29'));}if(_0xc11fa1[_0xfc5c('0x25')]===_0x2cc07c['id']){return _0x2cc07c;}else{return db[_0xfc5c('0x2a')]['findOne']({'where':{'id':_settings[_0xfc5c('0x25')]}});}})[_0xfc5c('0x17')](function(_0x4258d8){if(!_0x4258d8){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4258d8['data1']||!_0x4258d8[_0xfc5c('0xe')]){throw new db['Sequelize'][(_0xfc5c('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x139644=_0x4258d8;logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x2b'),_0x3b0ab6['id']));return sentiment(_0x139644[_0xfc5c('0xd')],_0x139644[_0xfc5c('0xe')],_0xc11fa1[_0xfc5c('0x26')],_0x1e1144[_0xfc5c('0x11')],_0xc11fa1[_0xfc5c('0x2c')]);})[_0xfc5c('0x17')](function(_0x2035ef){logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x2d'),_0x3b0ab6['id']));return _0x3b0ab6[_0xfc5c('0x1e')]({'sentiment':_0x2035ef[_0xfc5c('0x2e')],'sPositive':_0x2035ef['SentimentScore']['Positive'],'sNegative':_0x2035ef[_0xfc5c('0x2f')][_0xfc5c('0x30')],'sMixed':_0x2035ef['SentimentScore'][_0xfc5c('0x31')],'sNeutral':_0x2035ef[_0xfc5c('0x2f')][_0xfc5c('0x32')]});})[_0xfc5c('0x17')](function(){logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x1f'),_0x3b0ab6['id']));_0xe0e356();});case _0xfc5c('0x33'):return _0x3b0ab6['update']({'transcribeStatus':_0xfc5c('0x33'),'failureReason':_0x5ed8bd[_0xfc5c('0x10')][_0xfc5c('0x34')]})[_0xfc5c('0x17')](function(){logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x1f'),_0x3b0ab6['id']));_0xe0e356();});default:logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x35'),_0x3b0ab6['id']));break;}}else{return BPromise[_0xfc5c('0x36')]()[_0xfc5c('0x17')](function(){if(!_0x3b0ab6[_0xfc5c('0x20')]){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))](_0xfc5c('0x23'));}if(!_0xc11fa1[_0xfc5c('0x24')]||!_0xc11fa1['sentimentAccountId']||!_0xc11fa1[_0xfc5c('0x26')]||!_0xc11fa1[_0xfc5c('0x2c')]||!_0xc11fa1[_0xfc5c('0x27')]){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))](_0xfc5c('0x28'));}if(!_0x3b0ab6[_0xfc5c('0x11')]){throw new Error(_0xfc5c('0x29'));}if(_0xc11fa1[_0xfc5c('0x25')]===_0x2cc07c['id']){return _0x2cc07c;}else{return db[_0xfc5c('0x2a')][_0xfc5c('0x37')]({'where':{'id':_settings[_0xfc5c('0x25')]}});}})[_0xfc5c('0x17')](function(_0x3f2e02){if(!_0x3f2e02){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))](_0xfc5c('0x38'));}if(!_0x3f2e02[_0xfc5c('0xd')]||!_0x3f2e02[_0xfc5c('0xe')]){throw new db['Sequelize'][(_0xfc5c('0x22'))](_0xfc5c('0x39'));}_0x139644=_0x3f2e02;logger['info'](util[_0xfc5c('0xb')](_0xfc5c('0x2b'),_0x3b0ab6['id']));return sentiment(_0x139644[_0xfc5c('0xd')],_0x139644[_0xfc5c('0xe')],_0xc11fa1[_0xfc5c('0x26')],_0x3b0ab6[_0xfc5c('0x11')],_0xc11fa1[_0xfc5c('0x2c')]);})[_0xfc5c('0x17')](function(_0xebbd48){logger[_0xfc5c('0x18')](util[_0xfc5c('0xb')](_0xfc5c('0x2d'),_0x3b0ab6['id']));return _0x3b0ab6[_0xfc5c('0x1e')]({'sentiment':_0xebbd48[_0xfc5c('0x2e')],'sPositive':_0xebbd48[_0xfc5c('0x2f')]['Positive'],'sNegative':_0xebbd48[_0xfc5c('0x2f')][_0xfc5c('0x30')],'sMixed':_0xebbd48['SentimentScore'][_0xfc5c('0x31')],'sNeutral':_0xebbd48[_0xfc5c('0x2f')][_0xfc5c('0x32')],'transcribeStatus':_0xfc5c('0x13')});})[_0xfc5c('0x17')](function(){logger[_0xfc5c('0x18')](util['format'](_0xfc5c('0x1f'),_0x3b0ab6['id']));_0xe0e356();});}})['catch'](function(_0x319f39){if(_0x319f39){if(!_0x319f39[_0xfc5c('0x3a')]||_0x319f39[_0xfc5c('0x3a')]!==_0xfc5c('0x3b')){logger[_0xfc5c('0x3c')](util[_0xfc5c('0xb')](_0xfc5c('0x3d'),_0x3b0ab6['id']),util['inspect'](_0x319f39,{'showHidden':![],'depth':null}));}}_0xe0e356();});});}function checkTranscribe(){var _0x2a7c93;var _0x30257f;var _0x8da4c2;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0xfc5c('0x3e')}})[_0xfc5c('0x17')](function(_0x8a514f){if(!_0x8a514f||!_0x8a514f[_0xfc5c('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xfc5c('0x3f'));}_0x2a7c93=_0x8a514f;return db['Setting'][_0xfc5c('0x37')]({'where':{'id':0x1}});})['then'](function(_0x38fdf4){if(!_0x38fdf4){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))](_0xfc5c('0x40'));}_0x30257f=_0x38fdf4;if(!_0x30257f[_0xfc5c('0x7')]||!_0x30257f[_0xfc5c('0x41')]||!_0x30257f[_0xfc5c('0x42')]||!_0x30257f[_0xfc5c('0x2c')]||!_0x30257f['bucket']){throw new db[(_0xfc5c('0x21'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xfc5c('0x2a')][_0xfc5c('0x37')]({'where':{'id':_0x30257f['transcribeAccountId']}});})[_0xfc5c('0x17')](function(_0x5f231b){if(!_0x5f231b){throw new db[(_0xfc5c('0x21'))][(_0xfc5c('0x22'))](_0xfc5c('0x38'));}if(!_0x5f231b['data1']||!_0x5f231b[_0xfc5c('0xe')]){throw new db['Sequelize'][(_0xfc5c('0x22'))](_0xfc5c('0x39'));}_0x8da4c2=_0x5f231b;var _0x51261c=[];_0x2a7c93[_0xfc5c('0x43')](function(_0x26cca5){_0x51261c['push'](checkTranscribeJob(_0x26cca5,_0x30257f,_0x8da4c2));});return BPromise[_0xfc5c('0x44')](_0x51261c);})[_0xfc5c('0x45')](function(_0x20db83){if(_0x20db83){if(!_0x20db83[_0xfc5c('0x3a')]||_0x20db83['name']!==_0xfc5c('0x3b')){logger[_0xfc5c('0x3c')](util['inspect'](_0x20db83,{'showHidden':![],'depth':null}));}}});}exports[_0xfc5c('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index b1550b5..ede87d9 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 _0x081e=['hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','emit','whatsappInteraction:update','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x081e,0x9f));var _0xe081=function(_0x4f5226,_0x518f6c){_0x4f5226=_0x4f5226-0x0;var _0x42fdd5=_0x081e[_0x4f5226];return _0x42fdd5;};'use strict';var _=require(_0xe081('0x0'));var moment=require(_0xe081('0x1'));var Redis=require(_0xe081('0x2'));var util=require(_0xe081('0x3'));var config=require(_0xe081('0x4'));var db=require(_0xe081('0x5'))['db'];var logger=require(_0xe081('0x6'))(_0xe081('0x7'));config[_0xe081('0x8')]=_['defaults'](config[_0xe081('0x8')],{'host':_0xe081('0x9'),'port':0x18eb});var io=require(_0xe081('0xa'))(new Redis(config[_0xe081('0x8')]));function closeInteractions(){var _0x184e24=[];return db[_0xe081('0xb')][_0xe081('0xc')]({'raw':!![],'attributes':['id',_0xe081('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe081('0xe')](0x18,_0xe081('0xf'))}}})[_0xe081('0x10')](function(_0x4d9b28){if(_0x4d9b28&&_0x4d9b28[_0xe081('0x11')]){_0x184e24=_[_0xe081('0x12')](_0x4d9b28||[],'id');logger['info'](_0xe081('0x13'),_0x184e24[_0xe081('0x14')]());return db['WhatsappInteraction'][_0xe081('0x15')]({'closeReason':'system','disposition':_0xe081('0x16'),'closed':!![],'closedAt':moment()[_0xe081('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x184e24}});}})[_0xe081('0x10')](function(){if(_0x184e24&&_0x184e24[_0xe081('0x11')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x184e24[_0xe081('0x14')]());for(var _0x105675=0x0;_0x105675<_0x184e24[_0xe081('0x11')];_0x105675++){io[_0xe081('0x18')](_0xe081('0x19'),{'id':_0x184e24[_0x105675],'closed':!![]});}}})['catch'](function(_0x1d4cb8){logger[_0xe081('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1d4cb8?util[_0xe081('0x1b')](_0x1d4cb8,{'showHidden':![],'depth':null}):'');});}exports[_0xe081('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe59f=['lodash','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start'];(function(_0x36fee2,_0x16d199){var _0x4631fe=function(_0x1c2a8f){while(--_0x1c2a8f){_0x36fee2['push'](_0x36fee2['shift']());}};_0x4631fe(++_0x16d199);}(_0xe59f,0x1a4));var _0xfe59=function(_0x360580,_0x3d7848){_0x360580=_0x360580-0x0;var _0x4b9e58=_0xe59f[_0x360580];return _0x4b9e58;};'use strict';var _=require(_0xfe59('0x0'));var moment=require(_0xfe59('0x1'));var Redis=require(_0xfe59('0x2'));var util=require(_0xfe59('0x3'));var config=require('../../config/environment');var db=require(_0xfe59('0x4'))['db'];var logger=require('../logger')(_0xfe59('0x5'));config[_0xfe59('0x6')]=_[_0xfe59('0x7')](config[_0xfe59('0x6')],{'host':_0xfe59('0x8'),'port':0x18eb});var io=require(_0xfe59('0x9'))(new Redis(config[_0xfe59('0x6')]));function closeInteractions(){var _0x246034=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xfe59('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfe59('0xb')](0x18,_0xfe59('0xc'))}}})['then'](function(_0x332c4e){if(_0x332c4e&&_0x332c4e[_0xfe59('0xd')]){_0x246034=_[_0xfe59('0xe')](_0x332c4e||[],'id');logger[_0xfe59('0xf')](_0xfe59('0x10'),_0x246034['join']());return db[_0xfe59('0x11')]['update']({'closeReason':_0xfe59('0x12'),'disposition':_0xfe59('0x13'),'closed':!![],'closedAt':moment()[_0xfe59('0x14')](_0xfe59('0x15'))},{'where':{'id':_0x246034}});}})['then'](function(){if(_0x246034&&_0x246034[_0xfe59('0xd')]){logger[_0xfe59('0xf')](_0xfe59('0x16'),_0x246034[_0xfe59('0x17')]());for(var _0x4bb508=0x0;_0x4bb508<_0x246034[_0xfe59('0xd')];_0x4bb508++){io[_0xfe59('0x18')]('whatsappInteraction:update',{'id':_0x246034[_0x4bb508],'closed':!![]});}}})[_0xfe59('0x19')](function(_0x1a19f5){logger['error'](_0xfe59('0x1a'),_0x1a19f5?util['inspect'](_0x1a19f5,{'showHidden':![],'depth':null}):'');});}exports[_0xfe59('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6436835..463ebf0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd257=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper2','util','../mysqldb','push','Innocenzo','Biondo'];(function(_0x3baa63,_0x182e5f){var _0x4e79f4=function(_0x3e67d7){while(--_0x3e67d7){_0x3baa63['push'](_0x3baa63['shift']());}};_0x4e79f4(++_0x182e5f);}(_0xd257,0xfa));var _0x7d25=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xd257[_0x1344d6];return _0xf45b24;};'use strict';var util=require(_0x7d25('0x0'));var db=require(_0x7d25('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7d25('0x2')]({'id':i,'firstName':_0x7d25('0x3')+i,'lastName':_0x7d25('0x4')+i,'phone':0xf879fb460+i,'email':_0x7d25('0x5')+i+_0x7d25('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7d25('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7d25('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7d25('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7d25('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7d25('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7d25('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7d25('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7d25('0x7')](),'updatedAt':Date[_0x7d25('0x7')]()});}db[_0x7d25('0x8')][_0x7d25('0x9')]({'where':{}})[_0x7d25('0xa')](function(){return db[_0x7d25('0x8')][_0x7d25('0xb')](contacts);})[_0x7d25('0xa')](function(){console[_0x7d25('0xc')](_0x7d25('0xd'),_0x7d25('0xe'));return db['CmHopper'][_0x7d25('0x9')]({'where':{}});})[_0x7d25('0xa')](function(){return db['CmHopper'][_0x7d25('0xb')](hopper);})[_0x7d25('0xa')](function(){console[_0x7d25('0xc')](_0x7d25('0xd'),'hopper1');return db[_0x7d25('0x8')][_0x7d25('0xb')](contacts2);})[_0x7d25('0xa')](function(){console[_0x7d25('0xc')](_0x7d25('0xd'),'contacts2');return db[_0x7d25('0xf')][_0x7d25('0xb')](hopper2);})[_0x7d25('0xa')](function(){console[_0x7d25('0xc')](_0x7d25('0xd'),_0x7d25('0x10'));})['catch'](function(_0x29d487){console['log'](_0x29d487);}); \ No newline at end of file +var _0xe443=['catch','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2'];(function(_0x46902f,_0x455d47){var _0x566edf=function(_0x14e358){while(--_0x14e358){_0x46902f['push'](_0x46902f['shift']());}};_0x566edf(++_0x455d47);}(_0xe443,0x99));var _0x3e44=function(_0x53bb90,_0x556982){_0x53bb90=_0x53bb90-0x0;var _0x2d1639=_0xe443[_0x53bb90];return _0x2d1639;};'use strict';var util=require(_0x3e44('0x0'));var db=require(_0x3e44('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3e44('0x2')+i,'phone':0xf879fb460+i,'email':_0x3e44('0x3')+i+_0x3e44('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3e44('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3e44('0x6')](),'updatedAt':Date[_0x3e44('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3e44('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3e44('0x2')+i,'phone':0xf879fb460+i,'email':_0x3e44('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3e44('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x3e44('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3e44('0x6')](),'updatedAt':Date['now']()});}db[_0x3e44('0x7')][_0x3e44('0x8')]({'where':{}})[_0x3e44('0x9')](function(){return db[_0x3e44('0x7')][_0x3e44('0xa')](contacts);})[_0x3e44('0x9')](function(){console[_0x3e44('0xb')]('finished\x20populating',_0x3e44('0xc'));return db[_0x3e44('0xd')][_0x3e44('0x8')]({'where':{}});})[_0x3e44('0x9')](function(){return db[_0x3e44('0xd')][_0x3e44('0xa')](hopper);})[_0x3e44('0x9')](function(){console[_0x3e44('0xb')](_0x3e44('0xe'),_0x3e44('0xf'));return db[_0x3e44('0x7')][_0x3e44('0xa')](contacts2);})[_0x3e44('0x9')](function(){console[_0x3e44('0xb')](_0x3e44('0xe'),_0x3e44('0x10'));return db[_0x3e44('0xd')][_0x3e44('0xa')](hopper2);})[_0x3e44('0x9')](function(){console[_0x3e44('0xb')](_0x3e44('0xe'),_0x3e44('0x11'));})[_0x3e44('0x12')](function(_0x1a060f){console[_0x3e44('0xb')](_0x1a060f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index cb671aa..8dff8bf 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf718=['%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent'];(function(_0xe55c7e,_0x29b480){var _0x82f61c=function(_0x4934f3){while(--_0x4934f3){_0xe55c7e['push'](_0xe55c7e['shift']());}};_0x82f61c(++_0x29b480);}(_0xf718,0x1df));var _0x8f71=function(_0x40d4cd,_0x3800ca){_0x40d4cd=_0x40d4cd-0x0;var _0x54aac4=_0xf718[_0x40d4cd];return _0x54aac4;};'use strict';var util=require('util');var db=require(_0x8f71('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8f71('0x1')]({'name':util[_0x8f71('0x2')](_0x8f71('0x3'),_0x8f71('0x4'),i),'fullname':util[_0x8f71('0x2')](_0x8f71('0x3'),_0x8f71('0x4'),i),'email':util[_0x8f71('0x2')](_0x8f71('0x5'),_0x8f71('0x4'),i),'role':_0x8f71('0x4'),'password':_0x8f71('0x6'),'internal':0xfa0+i,'type':_0x8f71('0x7'),'transport':[_0x8f71('0x8'),'ws',_0x8f71('0x9')],'disallow':[_0x8f71('0xa')],'allow':[_0x8f71('0xb')],'defaultuser':util[_0x8f71('0x2')](_0x8f71('0x3'),_0x8f71('0x4'),i),'encryption':_0x8f71('0xc'),'avpf':_0x8f71('0xc'),'force_avp':'yes','icesupport':_0x8f71('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x8f71('0xd'),'dtlsprivatekey':_0x8f71('0xe'),'dtlssetup':_0x8f71('0xf'),'callerid':util['format'](_0x8f71('0x10'),util[_0x8f71('0x2')](_0x8f71('0x3'),_0x8f71('0x4'),i),0xfa0+i)});}db['User'][_0x8f71('0x11')](users)[_0x8f71('0x12')](function(){console[_0x8f71('0x13')](_0x8f71('0x14'));})[_0x8f71('0x15')](function(_0x36f75a){console[_0x8f71('0x13')](_0x36f75a);}); \ No newline at end of file +var _0x1d52=['wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com'];(function(_0x4186ae,_0x5548e5){var _0x31d4b0=function(_0xf394a9){while(--_0xf394a9){_0x4186ae['push'](_0x4186ae['shift']());}};_0x31d4b0(++_0x5548e5);}(_0x1d52,0x15e));var _0x21d5=function(_0x409169,_0x3f6d31){_0x409169=_0x409169-0x0;var _0x164dd3=_0x1d52[_0x409169];return _0x164dd3;};'use strict';var util=require(_0x21d5('0x0'));var db=require(_0x21d5('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x21d5('0x2')]({'name':util[_0x21d5('0x3')]('%s%s',_0x21d5('0x4'),i),'fullname':util[_0x21d5('0x3')](_0x21d5('0x5'),_0x21d5('0x4'),i),'email':util[_0x21d5('0x3')](_0x21d5('0x6'),'agent',i),'role':_0x21d5('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x21d5('0x7')],'disallow':['all'],'allow':[_0x21d5('0x8')],'defaultuser':util[_0x21d5('0x3')](_0x21d5('0x5'),_0x21d5('0x4'),i),'encryption':'yes','avpf':_0x21d5('0x9'),'force_avp':_0x21d5('0x9'),'icesupport':_0x21d5('0x9'),'dtlsenable':_0x21d5('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x21d5('0xa'),'dtlssetup':_0x21d5('0xb'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x21d5('0x5'),'agent',i),0xfa0+i)});}db[_0x21d5('0xc')]['bulkCreate'](users)[_0x21d5('0xd')](function(){console[_0x21d5('0xe')](_0x21d5('0xf'));})[_0x21d5('0x10')](function(_0x51da1b){console[_0x21d5('0xe')](_0x51da1b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8ddfcee..c386bda 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x930b=['SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','OpenchannelQueue','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','User','Campaign','where','then','%s:queue:%s','Agents','format','handshake','query','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions'];(function(_0x2385b6,_0x3182de){var _0x22df53=function(_0x1886f9){while(--_0x1886f9){_0x2385b6['push'](_0x2385b6['shift']());}};_0x22df53(++_0x3182de);}(_0x930b,0x106));var _0xb930=function(_0x35f0e1,_0x152011){_0x35f0e1=_0x35f0e1-0x0;var _0x1a4f0f=_0x930b[_0x35f0e1];return _0x1a4f0f;};'use strict';var _=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));var BPromise=require('bluebird');var db=require(_0xb930('0x2'))['db'];var config=require(_0xb930('0x3'));var queryQueues={'attributes':['id',_0xb930('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xb930('0x4'),_0xb930('0x5')],'raw':!![],'where':{'role':_0xb930('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb930('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb930('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb930('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb930('0x4'),_0xb930('0x8')],'where':{'type':_0xb930('0x9')}};function getAssociatedResources(_0xb5f26f,_0x1614d3,_0x48a7e1){return db['UserProfileSection'][_0xb930('0xa')]({'where':{'name':_0xb5f26f,'userProfileId':_0x1614d3},'raw':!![]})['then'](function(_0x400032){if(_0x400032){if(_0x400032[_0xb930('0xb')]){switch(_0xb5f26f){case _0xb930('0xc'):case _0xb930('0xd'):case _0xb930('0xe'):case _0xb930('0xf'):case _0xb930('0x10'):case _0xb930('0x11'):case'WhatsappQueues':return db[_0x48a7e1]['findAll'](queryQueues);case _0xb930('0x12'):return db[_0x48a7e1]['findAll'](queryTelephones);case _0xb930('0x13'):return db[_0x48a7e1][_0xb930('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x48a7e1][_0xb930('0x14')](queryCampaigns);}}else{return db[_0xb930('0x15')][_0xb930('0x14')]({'attributes':[_0xb930('0x16')],'where':{'sectionId':_0x400032['id']},'raw':!![]})['then'](function(_0x465c2c){if(_0x465c2c){var _0x2631c9={'where':{'id':_[_0xb930('0x17')](_0x465c2c,_0xb930('0x16'))},'raw':!![]};switch(_0x48a7e1){case _0xb930('0x18'):_0x2631c9['where'][_0xb930('0x5')]=_0xb930('0x7');break;case _0xb930('0x19'):_0x2631c9[_0xb930('0x1a')][_0xb930('0x8')]=_0xb930('0x9');break;}return db[_0x48a7e1][_0xb930('0x14')](_0x2631c9);}else{return[];}});}}else{return[];}})[_0xb930('0x1b')](function(_0x343068){return _0x343068;});}function joinOrLeaveQueues(_0x1fcc73,_0x4771ec,_0x56281b,_0x134c7f){_0x1fcc73[_0x4771ec](util['format'](_0xb930('0x1c'),_0x56281b,_0x134c7f[_0xb930('0x4')]));if(_0x134c7f[_0xb930('0x1d')]){for(var _0x1b7a77=0x0;_0x1b7a77<_0x134c7f[_0xb930('0x1d')]['length'];_0x1b7a77+=0x1){_0x1fcc73[_0x4771ec](util[_0xb930('0x1e')]('user:%s',_0x134c7f[_0xb930('0x1d')][_0x1b7a77]['name']));}}}function joinOrLeave(_0x46df92,_0x20f8df,_0x231517){var _0x17b135;if(_0x46df92[_0xb930('0x1f')][_0xb930('0x20')]['id']){db[_0xb930('0x18')]['find']({'attributes':['id',_0xb930('0x4'),_0xb930('0x5'),_0xb930('0x21')],'where':{'id':_0x46df92[_0xb930('0x1f')]['query']['id']},'include':[{'model':db[_0xb930('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb930('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x24')],'as':_0xb930('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x27')],'as':_0xb930('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb930('0x29'),'attributes':['id'],'raw':!![]}]})[_0xb930('0x1b')](function(_0x3d45c2){if(_0x3d45c2){_0x17b135=_0x3d45c2;_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x2a'),_0x3d45c2[_0xb930('0x4')]));var _0x36a00e=[];switch(_0x3d45c2[_0xb930('0x5')]){case _0xb930('0x2b'):_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df]('voice:outbound');if(queryQueues[_0xb930('0x2d')](_0xb930('0x2e'))){delete queryQueues[_0xb930('0x2e')];}_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x30')]['findAll'](queryQueues));_0x36a00e['push'](db[_0xb930('0x31')]['findAll'](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x32')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x33')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x34')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db['OpenchannelQueue'][_0xb930('0x14')](queryQueues));_0x36a00e['push'](db[_0xb930('0x35')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryTelephones));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x36')][_0xb930('0x14')](queryTrunks));_0x36a00e[_0xb930('0x2f')](db['Campaign']['findAll'](queryCampaigns));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryAgents));break;case'user':_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df](_0xb930('0x37'));_0x36a00e['push'](getAssociatedResources(_0xb930('0xc'),_0x3d45c2['userProfileId'],'VoiceQueue'));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0xd'),_0x3d45c2[_0xb930('0x21')],'ChatQueue'));_0x36a00e['push'](getAssociatedResources(_0xb930('0xe'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x32')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0xf'),_0x3d45c2['userProfileId'],_0xb930('0x33')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x10'),_0x3d45c2[_0xb930('0x21')],'MailQueue'));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x11'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x38')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x39'),_0x3d45c2['userProfileId'],_0xb930('0x35')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources('Telephones',_0x3d45c2[_0xb930('0x21')],_0xb930('0x18')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x13'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x36')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x3a'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x19')));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryAgents));break;case'agent':_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df](_0xb930('0x37'));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3b')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3c')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3d')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3e')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3f')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x40')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e['push'](_0x3d45c2[_0xb930('0x41')]({'attributes':['id',_0xb930('0x4')]}));break;}return BPromise['all'](_0x36a00e);}})[_0xb930('0x1b')](function(_0xa83bf7){if(_0xa83bf7&&_0xa83bf7[_0xb930('0x42')]){for(var _0x83ec8f=0x0;_0x83ec8f<_0xa83bf7['length'];_0x83ec8f+=0x1){for(var _0x2c6034=0x0;_0x2c6034<_0xa83bf7[_0x83ec8f][_0xb930('0x42')];_0x2c6034+=0x1){switch(_0x83ec8f){case 0x0:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x43'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x1:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x44'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x2:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x45'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x3:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x46'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x4:joinOrLeaveQueues(_0x46df92,_0x20f8df,'mail',_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x5:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x47'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x6:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x48'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x7:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x49'),_0xa83bf7[_0x83ec8f][_0x2c6034][_0xb930('0x4')]));break;case 0x8:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x4a'),_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;case 0x9:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util['format'](_0xb930('0x4b'),_0xa83bf7[_0x83ec8f][_0x2c6034][_0xb930('0x8')],_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;case 0xa:_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x2a'),_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;}}}}})['then'](function(){if(_0x20f8df==='leave'){var _0x1de39d=_[_0xb930('0x17')](_0x17b135['ChatInteractions'],'id');return _0x17b135[_0xb930('0x4c')](_0x1de39d)[_0xb930('0x1b')](function(){for(var _0x3f60d6=0x0;_0x3f60d6<_0x1de39d[_0xb930('0x42')];_0x3f60d6+=0x1){_0x231517[_0xb930('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1de39d[_0x3f60d6]),'UserId':Number(_0x17b135['id'])});}});}})[_0xb930('0x1b')](function(){if(_0x20f8df==='leave'){var _0x1e813d=_[_0xb930('0x17')](_0x17b135['MailInteractions'],'id');return _0x17b135[_0xb930('0x4e')](_0x1e813d)[_0xb930('0x1b')](function(){for(var _0x2f3f76=0x0;_0x2f3f76<_0x1e813d[_0xb930('0x42')];_0x2f3f76+=0x1){_0x231517[_0xb930('0x4d')](_0xb930('0x4f'),{'MailInteractionId':Number(_0x1e813d[_0x2f3f76]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x54f527=_[_0xb930('0x17')](_0x17b135['FaxInteractions'],'id');return _0x17b135[_0xb930('0x51')](_0x54f527)['then'](function(){for(var _0x552a97=0x0;_0x552a97<_0x54f527[_0xb930('0x42')];_0x552a97+=0x1){_0x231517[_0xb930('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x54f527[_0x552a97]),'UserId':Number(_0x17b135['id'])});}});}})[_0xb930('0x1b')](function(){if(_0x20f8df===_0xb930('0x50')){var _0x59d4ea=_['map'](_0x17b135[_0xb930('0x52')],'id');return _0x17b135[_0xb930('0x53')](_0x59d4ea)[_0xb930('0x1b')](function(){for(var _0x55a929=0x0;_0x55a929<_0x59d4ea[_0xb930('0x42')];_0x55a929+=0x1){_0x231517['emit'](_0xb930('0x54'),{'SmsInteractionId':Number(_0x59d4ea[_0x55a929]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x54fcde=_[_0xb930('0x17')](_0x17b135[_0xb930('0x28')],'id');return _0x17b135[_0xb930('0x55')](_0x54fcde)[_0xb930('0x1b')](function(){for(var _0x2ac4fc=0x0;_0x2ac4fc<_0x54fcde[_0xb930('0x42')];_0x2ac4fc+=0x1){_0x231517[_0xb930('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x54fcde[_0x2ac4fc]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x263b8e=_[_0xb930('0x17')](_0x17b135[_0xb930('0x29')],'id');return _0x17b135[_0xb930('0x56')](_0x263b8e)[_0xb930('0x1b')](function(){for(var _0x77800c=0x0;_0x77800c<_0x263b8e['length'];_0x77800c+=0x1){_0x231517[_0xb930('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x263b8e[_0x77800c]),'UserId':Number(_0x17b135['id'])});}});}})['catch'](function(_0x4c7779){_0x46df92[_0xb930('0x57')](_0x4c7779);});}}function onDisconnect(_0x47b7bf,_0x6dbe76){joinOrLeave(_0x47b7bf,_0xb930('0x50'),_0x6dbe76);}function onConnect(_0x114be2){joinOrLeave(_0x114be2,_0xb930('0x58'));}exports[_0xb930('0x59')]=function(_0x2091fb){_0x2091fb['on'](_0xb930('0x5a'),function(_0x54fc1d){_0x54fc1d[_0xb930('0x5b')](0x0);_0x54fc1d[_0xb930('0x5c')]=_0x54fc1d[_0xb930('0x5d')]['connection']['remoteAddress']+':'+_0x54fc1d[_0xb930('0x5d')][_0xb930('0x5a')][_0xb930('0x5e')];_0x54fc1d[_0xb930('0x5f')]=new Date();_0x54fc1d[_0xb930('0x57')]=function(_0x4c1de6){console[_0xb930('0x57')](_0xb930('0x60')+_0x54fc1d[_0xb930('0x61')][_0xb930('0x4')]+'['+_0x54fc1d[_0xb930('0x5c')]+']',_0x4c1de6);};_0x54fc1d['on'](_0xb930('0x62'),function(){onDisconnect(_0x54fc1d,_0x2091fb);_0x54fc1d[_0xb930('0x57')](_0xb930('0x63'));});onConnect(_0x54fc1d);_0x54fc1d[_0xb930('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x0adf=['voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','FaxQueues','SmsQueues','MailQueue','Telephones','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','FaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','map','where','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions'];(function(_0x24c835,_0x2489d3){var _0x6e962c=function(_0x28fbc4){while(--_0x28fbc4){_0x24c835['push'](_0x24c835['shift']());}};_0x6e962c(++_0x2489d3);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3c8045,_0x5ec4c0){_0x3c8045=_0x3c8045-0x0;var _0x853cf7=_0x0adf[_0x3c8045];return _0x853cf7;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var BPromise=require(_0xf0ad('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xf0ad('0x3'));var queryQueues={'attributes':['id',_0xf0ad('0x4')],'include':[{'as':_0xf0ad('0x5'),'model':db[_0xf0ad('0x6')],'attributes':['id',_0xf0ad('0x4'),_0xf0ad('0x7')],'raw':!![],'where':{'role':_0xf0ad('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf0ad('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xf0ad('0x4')],'where':{'role':_0xf0ad('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf0ad('0x4'),_0xf0ad('0xa')],'where':{'type':_0xf0ad('0xb')}};function getAssociatedResources(_0x3bc706,_0xe65b20,_0x5bdf69){return db[_0xf0ad('0xc')]['findOne']({'where':{'name':_0x3bc706,'userProfileId':_0xe65b20},'raw':!![]})[_0xf0ad('0xd')](function(_0x1f2952){if(_0x1f2952){if(_0x1f2952[_0xf0ad('0xe')]){switch(_0x3bc706){case _0xf0ad('0xf'):case _0xf0ad('0x10'):case'FaxQueues':case'SmsQueues':case _0xf0ad('0x11'):case _0xf0ad('0x12'):case _0xf0ad('0x13'):return db[_0x5bdf69][_0xf0ad('0x14')](queryQueues);case'Telephones':return db[_0x5bdf69][_0xf0ad('0x14')](queryTelephones);case _0xf0ad('0x15'):return db[_0x5bdf69]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x5bdf69]['findAll'](queryCampaigns);}}else{return db[_0xf0ad('0x16')]['findAll']({'attributes':[_0xf0ad('0x17')],'where':{'sectionId':_0x1f2952['id']},'raw':!![]})[_0xf0ad('0xd')](function(_0xfa544c){if(_0xfa544c){var _0xfa829e={'where':{'id':_[_0xf0ad('0x18')](_0xfa544c,'resourceId')},'raw':!![]};switch(_0x5bdf69){case _0xf0ad('0x6'):_0xfa829e[_0xf0ad('0x19')][_0xf0ad('0x7')]=_0xf0ad('0x9');break;case'Campaign':_0xfa829e['where'][_0xf0ad('0xa')]=_0xf0ad('0xb');break;}return db[_0x5bdf69]['findAll'](_0xfa829e);}else{return[];}});}}else{return[];}})[_0xf0ad('0xd')](function(_0x1e88e1){return _0x1e88e1;});}function joinOrLeaveQueues(_0x9a95bf,_0x411e7b,_0x4cc08a,_0x57c570){_0x9a95bf[_0x411e7b](util[_0xf0ad('0x1a')](_0xf0ad('0x1b'),_0x4cc08a,_0x57c570[_0xf0ad('0x4')]));if(_0x57c570[_0xf0ad('0x5')]){for(var _0x2ac8ba=0x0;_0x2ac8ba<_0x57c570[_0xf0ad('0x5')]['length'];_0x2ac8ba+=0x1){_0x9a95bf[_0x411e7b](util[_0xf0ad('0x1a')](_0xf0ad('0x1c'),_0x57c570[_0xf0ad('0x5')][_0x2ac8ba][_0xf0ad('0x4')]));}}}function joinOrLeave(_0x29d647,_0x88b47b,_0xb91769){var _0x276322;if(_0x29d647[_0xf0ad('0x1d')][_0xf0ad('0x1e')]['id']){db[_0xf0ad('0x6')][_0xf0ad('0x1f')]({'attributes':['id',_0xf0ad('0x4'),_0xf0ad('0x7'),_0xf0ad('0x20')],'where':{'id':_0x29d647['handshake'][_0xf0ad('0x1e')]['id']},'include':[{'model':db[_0xf0ad('0x21')],'as':_0xf0ad('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xf0ad('0x23')],'as':_0xf0ad('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xf0ad('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf0ad('0x26')],'as':_0xf0ad('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf0ad('0x28')],'as':_0xf0ad('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xf0ad('0x2a')],'as':_0xf0ad('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xf0ad('0xd')](function(_0x1bee71){if(_0x1bee71){_0x276322=_0x1bee71;_0x29d647[_0x88b47b](util[_0xf0ad('0x1a')](_0xf0ad('0x1c'),_0x1bee71[_0xf0ad('0x4')]));var _0x4c839d=[];switch(_0x1bee71[_0xf0ad('0x7')]){case'admin':_0x29d647[_0x88b47b](_0xf0ad('0x2c'));_0x29d647[_0x88b47b]('voice:outbound');if(queryQueues[_0xf0ad('0x2d')](_0xf0ad('0x2e'))){delete queryQueues[_0xf0ad('0x2e')];}_0x4c839d[_0xf0ad('0x2f')](db[_0xf0ad('0x30')][_0xf0ad('0x14')](queryQueues));_0x4c839d[_0xf0ad('0x2f')](db[_0xf0ad('0x31')]['findAll'](queryQueues));_0x4c839d['push'](db[_0xf0ad('0x32')][_0xf0ad('0x14')](queryQueues));_0x4c839d[_0xf0ad('0x2f')](db[_0xf0ad('0x33')]['findAll'](queryQueues));_0x4c839d[_0xf0ad('0x2f')](db['MailQueue'][_0xf0ad('0x14')](queryQueues));_0x4c839d['push'](db[_0xf0ad('0x34')]['findAll'](queryQueues));_0x4c839d[_0xf0ad('0x2f')](db[_0xf0ad('0x35')][_0xf0ad('0x14')](queryQueues));_0x4c839d[_0xf0ad('0x2f')](db[_0xf0ad('0x6')][_0xf0ad('0x14')](queryTelephones));_0x4c839d[_0xf0ad('0x2f')](db[_0xf0ad('0x36')]['findAll'](queryTrunks));_0x4c839d[_0xf0ad('0x2f')](db['Campaign'][_0xf0ad('0x14')](queryCampaigns));_0x4c839d['push'](db[_0xf0ad('0x6')][_0xf0ad('0x14')](queryAgents));break;case _0xf0ad('0x37'):_0x29d647[_0x88b47b](_0xf0ad('0x2c'));_0x29d647[_0x88b47b](_0xf0ad('0x38'));_0x4c839d['push'](getAssociatedResources(_0xf0ad('0xf'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x30')));_0x4c839d[_0xf0ad('0x2f')](getAssociatedResources(_0xf0ad('0x10'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x31')));_0x4c839d['push'](getAssociatedResources(_0xf0ad('0x39'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x32')));_0x4c839d[_0xf0ad('0x2f')](getAssociatedResources(_0xf0ad('0x3a'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x33')));_0x4c839d[_0xf0ad('0x2f')](getAssociatedResources(_0xf0ad('0x11'),_0x1bee71['userProfileId'],_0xf0ad('0x3b')));_0x4c839d[_0xf0ad('0x2f')](getAssociatedResources(_0xf0ad('0x12'),_0x1bee71['userProfileId'],'OpenchannelQueue'));_0x4c839d['push'](getAssociatedResources(_0xf0ad('0x13'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x35')));_0x4c839d[_0xf0ad('0x2f')](getAssociatedResources(_0xf0ad('0x3c'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x6')));_0x4c839d[_0xf0ad('0x2f')](getAssociatedResources(_0xf0ad('0x15'),_0x1bee71[_0xf0ad('0x20')],_0xf0ad('0x36')));_0x4c839d['push'](getAssociatedResources('IvrCampaigns',_0x1bee71['userProfileId'],_0xf0ad('0x3d')));_0x4c839d[_0xf0ad('0x2f')](db['User'][_0xf0ad('0x14')](queryAgents));break;case _0xf0ad('0x8'):_0x29d647[_0x88b47b]('voice:inbound');_0x29d647[_0x88b47b](_0xf0ad('0x38'));_0x4c839d[_0xf0ad('0x2f')](_0x1bee71[_0xf0ad('0x3e')]({'attributes':['id',_0xf0ad('0x4')]}));_0x4c839d['push'](_0x1bee71[_0xf0ad('0x3f')]({'attributes':['id',_0xf0ad('0x4')]}));_0x4c839d[_0xf0ad('0x2f')](_0x1bee71[_0xf0ad('0x40')]({'attributes':['id',_0xf0ad('0x4')]}));_0x4c839d[_0xf0ad('0x2f')](_0x1bee71[_0xf0ad('0x41')]({'attributes':['id',_0xf0ad('0x4')]}));_0x4c839d[_0xf0ad('0x2f')](_0x1bee71[_0xf0ad('0x42')]({'attributes':['id',_0xf0ad('0x4')]}));_0x4c839d['push'](_0x1bee71[_0xf0ad('0x43')]({'attributes':['id',_0xf0ad('0x4')]}));_0x4c839d[_0xf0ad('0x2f')](_0x1bee71['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xf0ad('0x44')](_0x4c839d);}})[_0xf0ad('0xd')](function(_0x12b76f){if(_0x12b76f&&_0x12b76f[_0xf0ad('0x45')]){for(var _0x17d7d9=0x0;_0x17d7d9<_0x12b76f[_0xf0ad('0x45')];_0x17d7d9+=0x1){for(var _0x8989f=0x0;_0x8989f<_0x12b76f[_0x17d7d9]['length'];_0x8989f+=0x1){switch(_0x17d7d9){case 0x0:joinOrLeaveQueues(_0x29d647,_0x88b47b,_0xf0ad('0x46'),_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x1:joinOrLeaveQueues(_0x29d647,_0x88b47b,'chat',_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x2:joinOrLeaveQueues(_0x29d647,_0x88b47b,_0xf0ad('0x47'),_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x3:joinOrLeaveQueues(_0x29d647,_0x88b47b,_0xf0ad('0x48'),_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x4:joinOrLeaveQueues(_0x29d647,_0x88b47b,_0xf0ad('0x49'),_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x5:joinOrLeaveQueues(_0x29d647,_0x88b47b,_0xf0ad('0x4a'),_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x6:joinOrLeaveQueues(_0x29d647,_0x88b47b,_0xf0ad('0x4b'),_0x12b76f[_0x17d7d9][_0x8989f]);break;case 0x7:if(_0x276322['role']!=='agent')_0x29d647[_0x88b47b](util[_0xf0ad('0x1a')](_0xf0ad('0x4c'),_0x12b76f[_0x17d7d9][_0x8989f][_0xf0ad('0x4')]));break;case 0x8:if(_0x276322[_0xf0ad('0x7')]!==_0xf0ad('0x8'))_0x29d647[_0x88b47b](util[_0xf0ad('0x1a')](_0xf0ad('0x4d'),_0x12b76f[_0x17d7d9][_0x8989f]['name']));break;case 0x9:if(_0x276322[_0xf0ad('0x7')]!==_0xf0ad('0x8'))_0x29d647[_0x88b47b](util[_0xf0ad('0x1a')](_0xf0ad('0x4e'),_0x12b76f[_0x17d7d9][_0x8989f][_0xf0ad('0xa')],_0x12b76f[_0x17d7d9][_0x8989f]['name']));break;case 0xa:_0x29d647[_0x88b47b](util[_0xf0ad('0x1a')](_0xf0ad('0x1c'),_0x12b76f[_0x17d7d9][_0x8989f][_0xf0ad('0x4')]));break;}}}}})[_0xf0ad('0xd')](function(){if(_0x88b47b===_0xf0ad('0x4f')){var _0x38c256=_[_0xf0ad('0x18')](_0x276322['ChatInteractions'],'id');return _0x276322[_0xf0ad('0x50')](_0x38c256)[_0xf0ad('0xd')](function(){for(var _0x3a78b2=0x0;_0x3a78b2<_0x38c256['length'];_0x3a78b2+=0x1){_0xb91769[_0xf0ad('0x51')](_0xf0ad('0x52'),{'ChatInteractionId':Number(_0x38c256[_0x3a78b2]),'UserId':Number(_0x276322['id'])});}});}})[_0xf0ad('0xd')](function(){if(_0x88b47b===_0xf0ad('0x4f')){var _0x386c52=_[_0xf0ad('0x18')](_0x276322[_0xf0ad('0x24')],'id');return _0x276322[_0xf0ad('0x53')](_0x386c52)[_0xf0ad('0xd')](function(){for(var _0x3d78a2=0x0;_0x3d78a2<_0x386c52[_0xf0ad('0x45')];_0x3d78a2+=0x1){_0xb91769['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x386c52[_0x3d78a2]),'UserId':Number(_0x276322['id'])});}});}})[_0xf0ad('0xd')](function(){if(_0x88b47b===_0xf0ad('0x4f')){var _0x5d9711=_[_0xf0ad('0x18')](_0x276322[_0xf0ad('0x54')],'id');return _0x276322['removeFaxInteractions'](_0x5d9711)['then'](function(){for(var _0x326aa7=0x0;_0x326aa7<_0x5d9711['length'];_0x326aa7+=0x1){_0xb91769['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5d9711[_0x326aa7]),'UserId':Number(_0x276322['id'])});}});}})[_0xf0ad('0xd')](function(){if(_0x88b47b==='leave'){var _0x56c8aa=_[_0xf0ad('0x18')](_0x276322[_0xf0ad('0x27')],'id');return _0x276322[_0xf0ad('0x55')](_0x56c8aa)[_0xf0ad('0xd')](function(){for(var _0x3c9464=0x0;_0x3c9464<_0x56c8aa[_0xf0ad('0x45')];_0x3c9464+=0x1){_0xb91769[_0xf0ad('0x51')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x56c8aa[_0x3c9464]),'UserId':Number(_0x276322['id'])});}});}})[_0xf0ad('0xd')](function(){if(_0x88b47b==='leave'){var _0x51a84a=_['map'](_0x276322['OpenchannelInteractions'],'id');return _0x276322[_0xf0ad('0x56')](_0x51a84a)[_0xf0ad('0xd')](function(){for(var _0x26b89f=0x0;_0x26b89f<_0x51a84a[_0xf0ad('0x45')];_0x26b89f+=0x1){_0xb91769[_0xf0ad('0x51')](_0xf0ad('0x57'),{'OpenchannelInteractionId':Number(_0x51a84a[_0x26b89f]),'UserId':Number(_0x276322['id'])});}});}})[_0xf0ad('0xd')](function(){if(_0x88b47b===_0xf0ad('0x4f')){var _0x1e9642=_[_0xf0ad('0x18')](_0x276322[_0xf0ad('0x2b')],'id');return _0x276322['removeWhatsappInteractions'](_0x1e9642)['then'](function(){for(var _0x2baccb=0x0;_0x2baccb<_0x1e9642[_0xf0ad('0x45')];_0x2baccb+=0x1){_0xb91769['emit'](_0xf0ad('0x58'),{'WhatsappInteractionId':Number(_0x1e9642[_0x2baccb]),'UserId':Number(_0x276322['id'])});}});}})[_0xf0ad('0x59')](function(_0x550068){_0x29d647[_0xf0ad('0x5a')](_0x550068);});}}function onDisconnect(_0x1d1b4e,_0x365acc){joinOrLeave(_0x1d1b4e,'leave',_0x365acc);}function onConnect(_0x1fe9df){joinOrLeave(_0x1fe9df,_0xf0ad('0x5b'));}exports[_0xf0ad('0x5c')]=function(_0x3ed619){_0x3ed619['on'](_0xf0ad('0x5d'),function(_0x422186){_0x422186[_0xf0ad('0x5e')](0x0);_0x422186[_0xf0ad('0x5f')]=_0x422186['request'][_0xf0ad('0x5d')]['remoteAddress']+':'+_0x422186[_0xf0ad('0x60')][_0xf0ad('0x5d')][_0xf0ad('0x61')];_0x422186['connectedAt']=new Date();_0x422186[_0xf0ad('0x5a')]=function(_0x5d1bc0){console[_0xf0ad('0x5a')](_0xf0ad('0x62')+_0x422186[_0xf0ad('0x63')][_0xf0ad('0x4')]+'['+_0x422186[_0xf0ad('0x5f')]+']',_0x5d1bc0);};_0x422186['on'](_0xf0ad('0x64'),function(){onDisconnect(_0x422186,_0x3ed619);_0x422186[_0xf0ad('0x5a')]('DISCONNECTED');});onConnect(_0x422186);_0x422186[_0xf0ad('0x5a')](_0xf0ad('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 2e1ecf1..6190b69 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 _0x10aa=['../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','newinteraction','Sms','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','catch','get','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','UserId','interface','name','agent','outgoingmessage','AfterCreateMessage','offlineMessage','QueryTypes','SIP/%s','AfterCreate','changed','closed','substatus','format','AfterUpdate','User','find','fullname','email','length','model','toLowerCase','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10aa,0x1e2));var _0xa10a=function(_0x2c8885,_0x26ef4b){_0x2c8885=_0x2c8885-0x0;var _0x180b83=_0x10aa[_0x2c8885];return _0x180b83;};'use strict';var util=require(_0xa10a('0x0'));var db=require(_0xa10a('0x1'))['db'];var jayson=require(_0xa10a('0x2'));var logger=require('../logger')(_0xa10a('0x3'));var client=jayson['client'][_0xa10a('0x4')]({'port':0x232a});var triggers=[{'channel':_0xa10a('0x5'),'model':_0xa10a('0x6'),'event':_0xa10a('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa10a('0x5'),'model':_0xa10a('0x6'),'event':_0xa10a('0x8'),'condition':_0xa10a('0x9'),'callback':afterUpdate},{'channel':_0xa10a('0x5'),'model':_0xa10a('0xa'),'event':_0xa10a('0x7'),'condition':_0xa10a('0xb'),'callback':afterCreateMessage},{'channel':_0xa10a('0x5'),'model':_0xa10a('0xc'),'event':'afterCreate','condition':_0xa10a('0xb'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xa10a('0xd'),'event':_0xa10a('0x7'),'condition':_0xa10a('0xe'),'callback':afterCreate},{'channel':_0xa10a('0xf'),'model':'SmsInteraction','event':'afterUpdate','condition':_0xa10a('0x9'),'callback':afterUpdate},{'channel':_0xa10a('0xf'),'model':_0xa10a('0x10'),'event':'afterCreate','condition':_0xa10a('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xa10a('0x11'),'event':'afterCreate','condition':_0xa10a('0xe'),'callback':afterCreate},{'channel':_0xa10a('0x12'),'model':_0xa10a('0x11'),'event':_0xa10a('0x8'),'condition':_0xa10a('0x9'),'callback':afterUpdate},{'channel':_0xa10a('0x12'),'model':'WhatsappMessage','event':_0xa10a('0x7'),'condition':_0xa10a('0xb'),'callback':afterCreateMessage},{'channel':_0xa10a('0x13'),'model':'FaxInteraction','event':_0xa10a('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa10a('0x13'),'model':_0xa10a('0x14'),'event':_0xa10a('0x8'),'condition':_0xa10a('0x9'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0xa10a('0x7'),'condition':_0xa10a('0xb'),'callback':afterCreateMessage},{'channel':_0xa10a('0x15'),'model':'MailInteraction','event':_0xa10a('0x7'),'condition':_0xa10a('0xe'),'callback':afterCreate},{'channel':_0xa10a('0x15'),'model':_0xa10a('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa10a('0x15'),'model':_0xa10a('0x17'),'event':_0xa10a('0x7'),'condition':_0xa10a('0xb'),'callback':afterCreateMessage},{'channel':_0xa10a('0x18'),'model':_0xa10a('0x19'),'event':_0xa10a('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa10a('0x18'),'model':'OpenchannelInteraction','event':_0xa10a('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa10a('0x18'),'model':_0xa10a('0x1a'),'event':'afterCreate','condition':_0xa10a('0xb'),'callback':afterCreateMessage}];function request(_0x49457e){return client[_0xa10a('0x1b')](_0xa10a('0x1c'),_0x49457e)['then'](function(_0x465410){logger[_0xa10a('0x1d')](_0xa10a('0x1e'),_0xa10a('0x1c'),_0x465410);if(_0x465410[_0xa10a('0x1f')]){if(_0x465410[_0xa10a('0x1f')]['code']===0x1f4){logger[_0xa10a('0x1f')]('Trigger,\x20%s','EventManager',_0x465410[_0xa10a('0x1f')]);}}})[_0xa10a('0x20')](function(_0x31eb3f){logger['error']('Trigger,\x20%s',_0xa10a('0x1c'),_0x31eb3f);});}function afterCreateMessage(_0x348321){return function(_0x5177c7){_0x5177c7=_0x5177c7[_0xa10a('0x21')]({'plain':!![]});_0x5177c7[_0xa10a('0x22')]=_0x348321;_0x5177c7[_0xa10a('0x23')]=_0x348321;_0x5177c7[_0xa10a('0x24')]=_0x5177c7[_0xa10a('0x25')];Promise[_0xa10a('0x26')]()[_0xa10a('0x27')](function(){if(typeof _0x5177c7[_0xa10a('0x28')]===_0xa10a('0x29'))return null;var _0x7acf59=_0xa10a('0x2a')+_0x5177c7[_0xa10a('0x28')];return db[_0xa10a('0x2b')][_0xa10a('0x2c')](_0x7acf59,{'type':db[_0xa10a('0x2d')]['QueryTypes'][_0xa10a('0x2e')],'raw':!![]});})[_0xa10a('0x27')](function(_0x33028f){if(_0x33028f){_0x5177c7['contact']=_0x33028f[0x0];}if(typeof _0x5177c7['UserId']==='undefined')return;return getAgent(_0x5177c7[_0xa10a('0x2f')]);})[_0xa10a('0x27')](function(_0x205cd1){if(_0x205cd1){_0x5177c7[_0xa10a('0x30')]=util['format']('SIP/%s',_0x205cd1[_0xa10a('0x31')]);_0x5177c7[_0xa10a('0x32')]=_0x205cd1;_0x5177c7['channel']=_0x348321;return request({'event':'incomingmessage','message':_0x5177c7});}else{return request({'event':_0xa10a('0x33'),'message':_0x5177c7});}})[_0xa10a('0x20')](function(_0xd474ce){logger['error'](_0xa10a('0x1e'),_0xa10a('0x34'),_0xd474ce);});};}function afterCreateOfflineMessage(_0x23880d){return function(_0x2dfb56){_0x2dfb56=_0x2dfb56[_0xa10a('0x21')]({'plain':!![]});_0x2dfb56[_0xa10a('0x22')]=_0x23880d;_0x2dfb56[_0xa10a('0x23')]=_0x23880d;_0x2dfb56[_0xa10a('0x24')]=_0xa10a('0x35');return request({'event':_0x2dfb56[_0xa10a('0x24')],'message':_0x2dfb56});};}function afterCreate(_0x4268b3,_0x5aa664){return function(_0x2e3740){_0x2e3740=_0x2e3740[_0xa10a('0x21')]({'plain':!![]});_0x2e3740[_0xa10a('0x22')]=_0x4268b3;_0x2e3740[_0xa10a('0x23')]=_0x4268b3;_0x2e3740['event']='opened';Promise[_0xa10a('0x26')]()[_0xa10a('0x27')](function(){var _0x2f7b91=_0xa10a('0x2a')+_0x2e3740[_0xa10a('0x28')];return db['sequelize'][_0xa10a('0x2c')](_0x2f7b91,{'type':db[_0xa10a('0x2d')][_0xa10a('0x36')][_0xa10a('0x2e')],'raw':!![]});})[_0xa10a('0x27')](function(_0x46f55d){if(_0x46f55d){_0x2e3740['contact']=_0x46f55d[0x0];}if(typeof _0x2e3740[_0xa10a('0x2f')]===_0xa10a('0x29'))return;return getAgent(_0x2e3740['UserId']);})[_0xa10a('0x27')](function(_0x41b5a7){if(_0x41b5a7){_0x2e3740[_0xa10a('0x30')]=util['format'](_0xa10a('0x37'),_0x41b5a7['name']);_0x2e3740[_0xa10a('0x32')]=_0x41b5a7;}return request({'event':_0x5aa664,'message':_0x2e3740});})[_0xa10a('0x20')](function(_0x563d9a){logger[_0xa10a('0x1f')](_0xa10a('0x1e'),_0xa10a('0x38'),_0x563d9a);});};}function afterUpdate(_0x290270){return function(_0x2d3a54){var _0x27634a=_0x2d3a54[_0xa10a('0x39')]('closed')&&_0x2d3a54[_0xa10a('0x3a')];var _0x2f4a56=_0x2d3a54[_0xa10a('0x39')](_0xa10a('0x3b'));if(_0x27634a||_0x2f4a56){var _0x5e3c3d=_0x27634a?'closedinteraction':_0xa10a('0x3b');var _0x304dca=_0x2d3a54['get']({'plain':!![]});_0x304dca[_0xa10a('0x22')]=_0x290270;_0x304dca[_0xa10a('0x23')]=_0x290270;_0x304dca[_0xa10a('0x24')]=_0x27634a?_0xa10a('0x3a'):_0xa10a('0x3b');var _0x540774=_0xa10a('0x2a')+_0x304dca['ContactId'];return db[_0xa10a('0x2b')]['query'](_0x540774,{'type':db['Sequelize'][_0xa10a('0x36')][_0xa10a('0x2e')],'raw':!![]})[_0xa10a('0x27')](function(_0x1e18c1){if(_0x1e18c1){_0x304dca['contact']=_0x1e18c1[0x0];}if(typeof _0x304dca[_0xa10a('0x2f')]==='undefined')return;return getAgent(_0x304dca['UserId']);})[_0xa10a('0x27')](function(_0x3cbfa6){if(_0x3cbfa6){_0x304dca[_0xa10a('0x30')]=util[_0xa10a('0x3c')](_0xa10a('0x37'),_0x3cbfa6['name']);_0x304dca[_0xa10a('0x32')]=_0x3cbfa6;}return request({'event':_0x5e3c3d,'message':_0x304dca});})[_0xa10a('0x20')](function(_0x25f649){logger[_0xa10a('0x1f')](_0xa10a('0x1e'),_0xa10a('0x3d'),_0x25f649);});}};}function getAgent(_0x53f10b){return db[_0xa10a('0x3e')][_0xa10a('0x3f')]({'where':{'id':_0x53f10b},'attributes':['id',_0xa10a('0x31'),_0xa10a('0x40'),_0xa10a('0x41'),'internal'],'raw':!![]})[_0xa10a('0x27')](function(_0x1fa1a8){return _0x1fa1a8;});}exports['default']=function(){for(var _0x2c134d=0x0;_0x2c134d=_0x37b72e[_0x68e2('0x15')]){throw Error(_0x68e2('0x16'));}_0x85cc97(_0x2e8ea8);})[_0x68e2('0x17')](function(_0x37cbb6){_0xdc182b(_0x37cbb6);});});}; \ No newline at end of file +var _0x0a30=['agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','chat','fax','whatsapp','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','then'];(function(_0x42333f,_0x213fbd){var _0x1f2aea=function(_0x5e03fe){while(--_0x5e03fe){_0x42333f['push'](_0x42333f['shift']());}};_0x1f2aea(++_0x213fbd);}(_0x0a30,0xf5));var _0x00a3=function(_0x1f0940,_0x3a4fd7){_0x1f0940=_0x1f0940-0x0;var _0x274040=_0x0a30[_0x1f0940];return _0x274040;};'use strict';var _=require(_0x00a3('0x0'));var BPromise=require(_0x00a3('0x1'));var db=require(_0x00a3('0x2'))['db'];var util=require(_0x00a3('0x3'));var channels=['voice','mail',_0x00a3('0x4'),_0x00a3('0x5'),'sms',_0x00a3('0x6'),'openchannel'];exports[_0x00a3('0x7')]=function(){return channels;};exports[_0x00a3('0x8')]=function(_0x2248c0){_0x2248c0=_0x2248c0[_0x00a3('0x9')]();return _['includes'](channels,_0x2248c0);};exports[_0x00a3('0xa')]=function(_0x12ab7d,_0x4b0021,_0x12d1d2,_0x1d7be7){var _0x141a2d={'loginAttempts':_0x4b0021,'blocked':_0x12d1d2};if(!_[_0x00a3('0xb')](_0x1d7be7)){_0x141a2d[_0x00a3('0xc')]=_0x1d7be7;}return _0x12ab7d[_0x00a3('0xd')](_0x141a2d);};exports[_0x00a3('0xe')]=function(_0x47173e){return new BPromise(function(_0x139877,_0x44c9dc){var _0x344838=0x0;if(_0x47173e[_0x00a3('0xf')]!==_0x00a3('0x10')){_0x139877(_0x47173e);}db['User'][_0x00a3('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x47173e['id']}}})[_0x00a3('0x12')](function(_0x18b0bd){_0x344838=_0x18b0bd;return util[_0x00a3('0xe')]();})[_0x00a3('0x12')](function(_0x5e2e3b){if(_0x5e2e3b&&_0x5e2e3b[_0x00a3('0x13')]&&_0x344838>=_0x5e2e3b[_0x00a3('0x13')]){throw Error(_0x00a3('0x14'));}_0x139877(_0x47173e);})[_0x00a3('0x15')](function(_0x2d8802){_0x44c9dc(_0x2d8802);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 19cae9b..f18b81e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9386=['404','status','render','json','send','exports'];(function(_0x365e23,_0x5c1108){var _0x48dd31=function(_0x3a86b6){while(--_0x3a86b6){_0x365e23['push'](_0x365e23['shift']());}};_0x48dd31(++_0x5c1108);}(_0x9386,0x6b));var _0x6938=function(_0x2009aa,_0x1e62d3){_0x2009aa=_0x2009aa-0x0;var _0x340744=_0x9386[_0x2009aa];return _0x340744;};'use strict';module[_0x6938('0x0')][0x194]=function pageNotFound(_0x449809,_0x495cb3){var _0xcd4fcf=_0x6938('0x1');var _0x2151ed=0x194;var _0x16a829={'status':_0x2151ed};_0x495cb3[_0x6938('0x2')](_0x16a829[_0x6938('0x2')]);_0x495cb3[_0x6938('0x3')](_0xcd4fcf,{},function(_0x60b999,_0x3eb4bc){if(_0x60b999){return _0x495cb3['status'](_0x16a829[_0x6938('0x2')])[_0x6938('0x4')](_0x16a829);}_0x495cb3[_0x6938('0x5')](_0x3eb4bc);});}; \ No newline at end of file +var _0xe896=['404','status','render','exports'];(function(_0xda5790,_0x57f5f2){var _0x3416be=function(_0x379eb1){while(--_0x379eb1){_0xda5790['push'](_0xda5790['shift']());}};_0x3416be(++_0x57f5f2);}(_0xe896,0x15f));var _0x6e89=function(_0x2f7145,_0x3c54f6){_0x2f7145=_0x2f7145-0x0;var _0x451ad1=_0xe896[_0x2f7145];return _0x451ad1;};'use strict';module[_0x6e89('0x0')][0x194]=function pageNotFound(_0x5d372e,_0x2a839e){var _0x4f3bd5=_0x6e89('0x1');var _0x485ffd=0x194;var _0x482d2c={'status':_0x485ffd};_0x2a839e[_0x6e89('0x2')](_0x482d2c[_0x6e89('0x2')]);_0x2a839e[_0x6e89('0x3')](_0x4f3bd5,{},function(_0x5955ca,_0x4a847e){if(_0x5955ca){return _0x2a839e[_0x6e89('0x2')](_0x482d2c['status'])['json'](_0x482d2c);}_0x2a839e['send'](_0x4a847e);});}; \ No newline at end of file diff --git a/server/migrations/2.5.45.js b/server/migrations/2.5.45.js new file mode 100644 index 0000000..22df2f1 --- /dev/null +++ b/server/migrations/2.5.45.js @@ -0,0 +1,165 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); + +var logger = require('../config/logger')('migration'); + +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface, Sequelize) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function(queryInterface, Sequelize) { + // var migration = new Migration(queryInterface); + } +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9ff0d64..edfb9fb 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1779=['ProactiveActions','ChatMessage','Agent','ChatQueue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','team_has_chat_queues','ChatGroupId','CompanyId','JscriptySessions','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','CustomReportId','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','Configurations','SubjectId','Descriptions','FieldId','AccountId','Description','DescriptionId','Field','VariableId','Subject','DeskField','Subjects','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','FreshdeskConfiguration','VtigerField','FreshsalesAccount','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyProject','ProjectId','VoiceQueues','ChatQueues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromUserId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','UserVoicePrefix','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','options','database','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteraction','SmsInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueue','MailQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','CmList','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailServerOut','MailAccountId','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','user_has_mail_accounts','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tag','ThroughTags','Attachments','Interaction','ChatOfflineMessageId','TagId','List','Items','FaxAccountId','Interactions','FaxInteractionId','fax_interaction_has_tags','Tags','Users','team_has_fax_queues','FaxQueueReport','Disposition','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId'];(function(_0x50d04f,_0x56fa8c){var _0x410282=function(_0x2620f4){while(--_0x2620f4){_0x50d04f['push'](_0x50d04f['shift']());}};_0x410282(++_0x56fa8c);}(_0x1779,0x66));var _0x9177=function(_0x285c60,_0x1f4624){_0x285c60=_0x285c60-0x0;var _0x1507a6=_0x1779[_0x285c60];return _0x1507a6;};'use strict';var config=require(_0x9177('0x0'));var Sequelize=require(_0x9177('0x1'));var _=require(_0x9177('0x2'));var jstz=require(_0x9177('0x3'));var timezone=jstz[_0x9177('0x4')]();config['sequelize']=_[_0x9177('0x5')](config[_0x9177('0x1')],{'database':_0x9177('0x6'),'username':_0x9177('0x7'),'password':_0x9177('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9177('0x9'),'dialectOptions':{'charset':_0x9177('0xa')},'logging':![],'timezone':timezone[_0x9177('0xb')](),'define':{'charset':_0x9177('0xc'),'collate':_0x9177('0xd')}}});config[_0x9177('0xe')]=_[_0x9177('0x5')](config['sequelizeHistory'],{'database':_0x9177('0x6'),'username':_0x9177('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9177('0x9'),'dialectOptions':{'charset':_0x9177('0xa')},'logging':![],'timezone':timezone[_0x9177('0xb')](),'define':{'charset':_0x9177('0xc'),'collate':_0x9177('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9177('0x1')]['database'],config['sequelize']['username'],config['sequelize']['password'],config['sequelize'][_0x9177('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9177('0xe')][_0x9177('0x10')],config[_0x9177('0xe')]['username'],config['sequelizeHistory']['password'],config[_0x9177('0xe')][_0x9177('0xf')])};db[_0x9177('0x11')]=db[_0x9177('0x1')]['import']('../api/user/user.model');db[_0x9177('0x12')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x14'));db[_0x9177('0x15')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x9177('0x1')][_0x9177('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x16'));db[_0x9177('0x17')]=db['sequelize'][_0x9177('0x13')](_0x9177('0x18'));db[_0x9177('0x19')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x1a'));db[_0x9177('0x1b')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/screenRecording/screenRecording.model');db[_0x9177('0x1c')]=db[_0x9177('0x1')]['import'](_0x9177('0x1d'));db[_0x9177('0x1e')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x9177('0x1')]['import'](_0x9177('0x1f'));db[_0x9177('0x20')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x21'));db['VoiceAgentReport']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x22'));db[_0x9177('0x23')]=db['sequelize']['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0x9177('0x13')](_0x9177('0x24'));db[_0x9177('0x25')]=db['sequelize'][_0x9177('0x13')]('../api/trunk/trunk.model');db[_0x9177('0x26')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x27'));db[_0x9177('0x28')]=db['sequelize'][_0x9177('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x9177('0x29')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x9177('0x2a')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x9177('0x2b')]=db['sequelize'][_0x9177('0x13')](_0x9177('0x2c'));db[_0x9177('0x2d')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x2e'));db['UserSmsQueue']=db[_0x9177('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0x9177('0x13')](_0x9177('0x2f'));db['UserWhatsappQueue']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x30'));db[_0x9177('0x31')]=db[_0x9177('0x1')]['import'](_0x9177('0x32'));db['MailServerOut']=db['sequelize'][_0x9177('0x13')](_0x9177('0x33'));db[_0x9177('0x34')]=db['sequelize'][_0x9177('0x13')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x9177('0x1')][_0x9177('0x13')]('../api/mailQueue/mailQueue.model');db[_0x9177('0x35')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x9177('0x36')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x37'));db[_0x9177('0x38')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x39'));db[_0x9177('0x3a')]=db['sequelize']['import'](_0x9177('0x3b'));db[_0x9177('0x3c')]=db['sequelize'][_0x9177('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x9177('0x3d')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x3e'));db[_0x9177('0x3f')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x9177('0x40')]=db[_0x9177('0x1')]['import'](_0x9177('0x41'));db[_0x9177('0x42')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x43'));db[_0x9177('0x44')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x45'));db[_0x9177('0x46')]=db['sequelize']['import'](_0x9177('0x47'));db['FaxQueue']=db['sequelize'][_0x9177('0x13')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x48'));db['SmsAccount']=db['sequelize']['import'](_0x9177('0x49'));db[_0x9177('0x4a')]=db[_0x9177('0x1')]['import'](_0x9177('0x4b'));db['SmsInteraction']=db[_0x9177('0x1')]['import'](_0x9177('0x4c'));db[_0x9177('0x4d')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x4e'));db[_0x9177('0x4f')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x50'));db['OpenchannelAccount']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x51'));db[_0x9177('0x52')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x53'));db[_0x9177('0x54')]=db[_0x9177('0x1')]['import'](_0x9177('0x55'));db[_0x9177('0x56')]=db[_0x9177('0x1')]['import'](_0x9177('0x57'));db[_0x9177('0x58')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db['sequelize']['import'](_0x9177('0x59'));db[_0x9177('0x5a')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x5b'));db[_0x9177('0x5c')]=db[_0x9177('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0x9177('0x5d')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x5e'));db['ChatMessage']=db[_0x9177('0x1')][_0x9177('0x13')]('../api/chatMessage/chatMessage.model');db[_0x9177('0x5f')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x60'));db['ChatQueue']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x61'));db[_0x9177('0x62')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/chatGroup/chatGroup.model');db[_0x9177('0x63')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x64'));db[_0x9177('0x65')]=db[_0x9177('0x1')]['import'](_0x9177('0x66'));db[_0x9177('0x67')]=db['sequelize'][_0x9177('0x13')](_0x9177('0x68'));db[_0x9177('0x69')]=db['sequelize'][_0x9177('0x13')]('../api/cmHopper/cmHopper.model');db[_0x9177('0x6a')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x6b'));db[_0x9177('0x6c')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x6d'));db[_0x9177('0x6e')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x9177('0x6f')]=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x9177('0x1')][_0x9177('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x9177('0x70')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x71'));db[_0x9177('0x72')]=db[_0x9177('0x1')]['import'](_0x9177('0x73'));db[_0x9177('0x74')]=db['sequelize']['import'](_0x9177('0x75'));db['Disposition']=db['sequelize']['import']('../api/disposition/disposition.model');db[_0x9177('0x76')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/condition/condition.model');db[_0x9177('0x77')]=db[_0x9177('0x1')]['import'](_0x9177('0x78'));db['Pause']=db[_0x9177('0x1')]['import'](_0x9177('0x79'));db[_0x9177('0x7a')]=db[_0x9177('0x1')]['import']('../api/cdr/cdr.model');db[_0x9177('0x7b')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x7c'));db[_0x9177('0x7d')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x7e'));db[_0x9177('0x7f')]=db[_0x9177('0x1')]['import'](_0x9177('0x80'));db['Tag']=db[_0x9177('0x1')][_0x9177('0x13')]('../api/tag/tag.model');db[_0x9177('0x81')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x82'));db[_0x9177('0x83')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/trigger/trigger.model');db[_0x9177('0x84')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x85'));db[_0x9177('0x86')]=db['sequelize'][_0x9177('0x13')](_0x9177('0x87'));db['IntegrationReport']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x88'));db[_0x9177('0x89')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x8a'));db['AnalyticDefaultReport']=db[_0x9177('0x1')]['import'](_0x9177('0x8b'));db['AnalyticExtractedReport']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x8c'));db[_0x9177('0x8d')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x9177('0x8e')]=db[_0x9177('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x9177('0x8f')]=db[_0x9177('0x1')]['import'](_0x9177('0x90'));db[_0x9177('0x91')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x9177('0x92')]=db['sequelize'][_0x9177('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x9177('0x93')]=db[_0x9177('0x1')]['import'](_0x9177('0x94'));db[_0x9177('0x95')]=db[_0x9177('0x1')]['import'](_0x9177('0x96'));db[_0x9177('0x97')]=db['sequelize'][_0x9177('0x13')](_0x9177('0x98'));db[_0x9177('0x99')]=db[_0x9177('0x1')]['import'](_0x9177('0x9a'));db[_0x9177('0x9b')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x9c'));db[_0x9177('0x9d')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x9e'));db['ZohoAccount']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x9f'));db['ZohoConfiguration']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xa0'));db[_0x9177('0xa1')]=db['sequelize'][_0x9177('0x13')]('../api/intZohoField/intZohoField.model');db[_0x9177('0xa2')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xa3'));db[_0x9177('0xa4')]=db[_0x9177('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x9177('0xa5')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xa6'));db[_0x9177('0xa7')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xa8'));db['FreshdeskConfiguration']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xa9'));db[_0x9177('0xaa')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xab'));db[_0x9177('0xac')]=db[_0x9177('0x1')]['import'](_0x9177('0xad'));db[_0x9177('0xae')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xaf'));db['VtigerField']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xb0'));db[_0x9177('0xb1')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xb2'));db[_0x9177('0xb3')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xb4'));db[_0x9177('0xb5')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xb6'));db[_0x9177('0xb7')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xb8'));db[_0x9177('0xb9')]=db['sequelize']['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x9177('0xba')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xbb'));db['FreshsalesAccount']=db[_0x9177('0x1')][_0x9177('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xbc'));db[_0x9177('0xbd')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xbe'));db[_0x9177('0x86')]=db['sequelize'][_0x9177('0x13')](_0x9177('0x87'));db[_0x9177('0xbf')]=db[_0x9177('0x1')]['import']('../api/network/network.model');db[_0x9177('0xc0')]=db[_0x9177('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x9177('0xc1')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x9177('0xc2')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xc3'));db[_0x9177('0xc4')]=db[_0x9177('0x1')]['import'](_0x9177('0xc5'));db[_0x9177('0xc6')]=db['sequelize']['import'](_0x9177('0xc7'));db[_0x9177('0xc8')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xc9'));db[_0x9177('0xca')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xcb'));db[_0x9177('0xcc')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xcd'));db['JscriptyProject']=db[_0x9177('0x1')]['import'](_0x9177('0xce'));db[_0x9177('0xcf')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xd0'));db[_0x9177('0xd1')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x9177('0xd2')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xd3'));db[_0x9177('0xd4')]=db[_0x9177('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x9177('0xd5')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xd6'));db[_0x9177('0xd7')]=db[_0x9177('0x1')]['import'](_0x9177('0xd8'));db[_0x9177('0xd9')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xda'));db['Campaign']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xdb'));db[_0x9177('0xdc')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/migration/migration.model');db[_0x9177('0xdd')]=db['sequelize'][_0x9177('0x13')]('../api/attachment/attachment.model');db[_0x9177('0xde')]=db[_0x9177('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x9177('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x9177('0xdf')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xe0'));db[_0x9177('0xe1')]=db[_0x9177('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x9177('0xe2')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xe3'));db[_0x9177('0xe4')]=db[_0x9177('0x1')]['import'](_0x9177('0xe5'));db['CmList']=db[_0x9177('0x1')]['import'](_0x9177('0xe6'));db[_0x9177('0xe7')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xe8'));db[_0x9177('0xe9')]=db[_0x9177('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x9177('0xea')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x9177('0xeb')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xec'));db[_0x9177('0xed')]=db['sequelize']['import'](_0x9177('0xee'));db[_0x9177('0xef')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xf0'));db['WhatsappApplication']=db[_0x9177('0x1')]['import'](_0x9177('0xf1'));db[_0x9177('0xf2')]=db[_0x9177('0x1')][_0x9177('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x9177('0xf3')]=db['sequelize']['import'](_0x9177('0xf4'));db['WhatsappQueueReport']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xf5'));db[_0x9177('0xf6')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xf7'));db[_0x9177('0xf8')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xf9'));db[_0x9177('0xfa')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xfb'));db[_0x9177('0xfc')]=db['sequelize'][_0x9177('0x13')](_0x9177('0xfd'));db[_0x9177('0xfe')]=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0xff'));db['UserVoicePrefix']=db[_0x9177('0x1')][_0x9177('0x13')](_0x9177('0x100'));db[_0x9177('0x101')]=db['sequelize']['import'](_0x9177('0x102'));db[_0x9177('0x11')][_0x9177('0x103')](db[_0x9177('0x1c')],{'as':_0x9177('0x1c'),'onDelete':'cascade','foreignKey':_0x9177('0x104')});db[_0x9177('0x11')][_0x9177('0x103')](db[_0x9177('0x101')],{'as':'userSetting','onDelete':'cascade','foreignKey':'UserId'});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x19')],{'as':'Recordings','foreignKey':_0x9177('0x104')});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x9177('0x106'),'foreignKey':'UserId'});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x107')],{'as':_0x9177('0x108'),'onDelete':_0x9177('0x109'),'hooks':!![]});db[_0x9177('0x11')]['hasMany'](db['CmHopperFinal'],{'as':_0x9177('0x10a'),'foreignKey':'UserId'});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x6e')],{'as':_0x9177('0x10b'),'foreignKey':_0x9177('0x104')});db['User'][_0x9177('0x105')](db['ReportAgentPreview'],{'as':_0x9177('0x6f'),'foreignKey':'UserId'});db['User'][_0x9177('0x105')](db['OpenchannelInteraction'],{'as':_0x9177('0x10c'),'foreignKey':_0x9177('0x104')});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x5d')],{'as':'ChatInteractions','foreignKey':_0x9177('0x104')});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x10d')],{'as':_0x9177('0x10e'),'foreignKey':_0x9177('0x104')});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x44')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0x36')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0xf2')],{'as':_0x9177('0x10f'),'foreignKey':_0x9177('0x104')});db[_0x9177('0x11')][_0x9177('0x105')](db[_0x9177('0xed')],{'as':'UserNotifications','foreignKey':_0x9177('0x110')});db[_0x9177('0x11')][_0x9177('0x111')](db[_0x9177('0xe9')],{'as':'UserProfile','foreignKey':_0x9177('0x112')});db['User'][_0x9177('0x113')](db[_0x9177('0x62')],{'as':'Groups','through':_0x9177('0x114')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x67')],{'as':_0x9177('0x115'),'through':_0x9177('0x116')});db['User'][_0x9177('0x113')](db['CmList'],{'as':_0x9177('0x117'),'through':_0x9177('0x118')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':_0x9177('0x119')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x36')],{'as':_0x9177('0x11a'),'through':_0x9177('0x11b')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x5d')],{'as':_0x9177('0x11c'),'through':_0x9177('0x11d')});db['User'][_0x9177('0x113')](db[_0x9177('0x44')],{'as':_0x9177('0x11e'),'through':_0x9177('0x11f')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x10d')],{'as':'SmsInteractions','through':_0x9177('0x120')});db['User'][_0x9177('0x113')](db[_0x9177('0x54')],{'as':_0x9177('0x10c'),'through':_0x9177('0x121')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0xf2')],{'as':_0x9177('0x10f'),'through':_0x9177('0x122')});db['User']['belongsToMany'](db[_0x9177('0x17')],{'as':'VoiceQueues','through':_0x9177('0x29'),'required':![]});db[_0x9177('0x11')][_0x9177('0x113')](db['VoicePrefix'],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db['User'][_0x9177('0x113')](db[_0x9177('0x123')],{'as':_0x9177('0x124'),'through':_0x9177('0x2b'),'required':![]});db[_0x9177('0x11')][_0x9177('0x113')](db['ChatQueue'],{'as':'ChatQueues','through':_0x9177('0x2a'),'required':![],'hooks':!![]});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x125')],{'as':_0x9177('0x126'),'through':_0x9177('0x2d'),'required':![]});db[_0x9177('0x11')][_0x9177('0x113')](db['SmsQueue'],{'as':_0x9177('0x127'),'through':'UserSmsQueue','required':![]});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x58')],{'as':_0x9177('0x128'),'through':_0x9177('0x129'),'required':![]});db[_0x9177('0x11')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x9177('0x12a'),'through':'UserWhatsappQueue','required':![]});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x12b')],{'through':_0x9177('0x118')});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0x12c')],{'as':_0x9177('0x12d'),'through':_0x9177('0x12e')});db[_0x9177('0x11')][_0x9177('0x113')](db['FaxAccount'],{'as':_0x9177('0x12f'),'through':_0x9177('0x130')});db[_0x9177('0x11')][_0x9177('0x113')](db['MailAccount'],{'as':_0x9177('0x131'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0x9177('0x132')],{'as':_0x9177('0x133'),'through':_0x9177('0x134')});db['User'][_0x9177('0x113')](db[_0x9177('0x135')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x9177('0x11')][_0x9177('0x113')](db[_0x9177('0xef')],{'as':_0x9177('0x136'),'through':_0x9177('0x137')});db[_0x9177('0x11')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':_0x9177('0x138')});db[_0x9177('0x12')][_0x9177('0x105')](db['VoiceExtension'],{'as':_0x9177('0x139'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x13a')});db[_0x9177('0x15')][_0x9177('0x105')](db['VoiceExtension'],{'onDelete':_0x9177('0x109')});db[_0x9177('0x107')][_0x9177('0x105')](db['VoiceExtension'],{'as':_0x9177('0x13b'),'onDelete':_0x9177('0x109')});db['VoiceMusicOnHold'][_0x9177('0x113')](db[_0x9177('0x7f')],{'as':_0x9177('0x13c'),'through':_0x9177('0x13d')});db['VoiceQueue'][_0x9177('0x105')](db[_0x9177('0x28')],{'as':_0x9177('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x9177('0x17')]['hasMany'](db[_0x9177('0x69')],{'as':_0x9177('0x13f'),'foreignKey':_0x9177('0x140')});db[_0x9177('0x17')][_0x9177('0x105')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x9177('0x140')});db[_0x9177('0x17')][_0x9177('0x105')](db[_0x9177('0x6e')],{'as':_0x9177('0x141'),'foreignKey':_0x9177('0x140')});db[_0x9177('0x17')]['hasMany'](db['ReportAgentPreview'],{'as':_0x9177('0x6f'),'foreignKey':_0x9177('0x140')});db[_0x9177('0x17')]['hasMany'](db[_0x9177('0x6a')],{'as':_0x9177('0x142'),'foreignKey':_0x9177('0x140')});db[_0x9177('0x17')][_0x9177('0x105')](db[_0x9177('0xc6')],{'as':'JscriptySessions','foreignKey':_0x9177('0x140')});db[_0x9177('0x17')][_0x9177('0x111')](db[_0x9177('0x25')],{'as':_0x9177('0x25'),'foreignKey':_0x9177('0x143')});db['VoiceQueue'][_0x9177('0x111')](db[_0x9177('0x25')],{'as':'TrunkBackup','foreignKey':_0x9177('0x144')});db['VoiceQueue'][_0x9177('0x111')](db[_0x9177('0x77')],{'as':'Interval','foreignKey':_0x9177('0x145')});db[_0x9177('0x17')][_0x9177('0x111')](db[_0x9177('0x146')],{'as':_0x9177('0x147'),'foreignKey':_0x9177('0x148')});db[_0x9177('0x17')][_0x9177('0x113')](db[_0x9177('0x12b')],{'as':_0x9177('0x117'),'through':_0x9177('0x149')});db[_0x9177('0x17')]['belongsToMany'](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x29')});db[_0x9177('0x17')][_0x9177('0x113')](db[_0x9177('0xd7')],{'as':'Teams','through':'TeamVoiceQueue'});db['VoiceQueue'][_0x9177('0x113')](db['CmList'],{'as':_0x9177('0x14b'),'through':'voice_queues_has_cm_blacklists'});db[_0x9177('0x19')][_0x9177('0x111')](db[_0x9177('0x11')],{'as':'User','foreignKey':_0x9177('0x104')});db[_0x9177('0x1b')][_0x9177('0x111')](db[_0x9177('0x11')],{'as':_0x9177('0x11'),'foreignKey':_0x9177('0x104')});db[_0x9177('0x1c')][_0x9177('0x105')](db[_0x9177('0x1e')],{'as':_0x9177('0x14c'),'onDelete':'cascade','foreignKey':_0x9177('0x14d'),'sourceKey':_0x9177('0x14e')});db[_0x9177('0x1e')]['belongsTo'](db[_0x9177('0x1c')],{'foreignKey':_0x9177('0x14d'),'targetKey':_0x9177('0x14e')});db[_0x9177('0x14f')][_0x9177('0x105')](db['VoiceQueueReport'],{'as':_0x9177('0x150'),'foreignKey':_0x9177('0x151'),'constraints':![]});db[_0x9177('0x14f')][_0x9177('0x105')](db[_0x9177('0x152')],{'as':_0x9177('0x153'),'foreignKey':_0x9177('0x151'),'constraints':![]});db[_0x9177('0x14f')][_0x9177('0x111')](db['User'],{'as':_0x9177('0x11'),'foreignKey':_0x9177('0x104')});db[_0x9177('0x14f')][_0x9177('0x111')](db['CmContact'],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x31')][_0x9177('0x111')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerIn']['belongsTo'](db[_0x9177('0xfa')],{'as':_0x9177('0xfa'),'foreignKey':_0x9177('0x156'),'onDelete':_0x9177('0x157')});db[_0x9177('0x158')][_0x9177('0x111')](db[_0x9177('0x34')],{'as':_0x9177('0x34'),'foreignKey':_0x9177('0x159')});db[_0x9177('0x158')][_0x9177('0x111')](db[_0x9177('0xfa')],{'as':_0x9177('0xfa'),'foreignKey':_0x9177('0x156'),'onDelete':_0x9177('0x157')});db[_0x9177('0x34')][_0x9177('0x103')](db[_0x9177('0x31')],{'as':_0x9177('0x15a'),'onDelete':_0x9177('0x109')});db[_0x9177('0x34')]['hasOne'](db['MailServerOut'],{'as':_0x9177('0x15b'),'onDelete':_0x9177('0x109')});db[_0x9177('0x34')][_0x9177('0x105')](db['Disposition'],{'as':_0x9177('0x15c'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount'][_0x9177('0x105')](db[_0x9177('0x74')],{'as':_0x9177('0x15d'),'foreignKey':_0x9177('0x159')});db[_0x9177('0x34')][_0x9177('0x105')](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x9177('0x34')][_0x9177('0x105')](db['MailInteraction'],{'as':'Interactions'});db[_0x9177('0x34')]['hasMany'](db[_0x9177('0x3a')],{'as':_0x9177('0x13b')});db[_0x9177('0x34')][_0x9177('0x111')](db['CmList'],{'as':'List','foreignKey':_0x9177('0x15e')});db['MailAccount']['belongsTo'](db[_0x9177('0x81')],{'as':_0x9177('0x81'),'foreignKey':_0x9177('0x15f')});db[_0x9177('0x34')][_0x9177('0x111')](db[_0x9177('0x146')],{'as':_0x9177('0x147'),'foreignKey':_0x9177('0x148')});db[_0x9177('0x34')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':'Agents','through':_0x9177('0x160')});db[_0x9177('0x123')]['belongsToMany'](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':'UserMailQueue'});db[_0x9177('0x123')][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':'team_has_mail_queues','as':_0x9177('0x161')});db['MailInteraction']['hasMany'](db[_0x9177('0x38')],{'as':_0x9177('0x14c'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x162')});db[_0x9177('0x36')][_0x9177('0x111')](db['MailAccount'],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x159')});db['MailInteraction'][_0x9177('0x111')](db['CmContact'],{'as':'Contact','foreignKey':_0x9177('0x155')});db[_0x9177('0x36')][_0x9177('0x111')](db['User'],{'as':_0x9177('0x164'),'foreignKey':'UserId'});db[_0x9177('0x36')][_0x9177('0x113')](db['Tag'],{'through':_0x9177('0x165'),'as':'Tags'});db[_0x9177('0x36')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x165'),'as':_0x9177('0x167')});db[_0x9177('0x36')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':'Users','through':_0x9177('0x11b'),'foreignKey':_0x9177('0x162')});db[_0x9177('0x38')][_0x9177('0x105')](db['Attachment'],{'as':_0x9177('0x168'),'onDelete':_0x9177('0x109')});db[_0x9177('0x38')][_0x9177('0x111')](db['User'],{'as':_0x9177('0x11')});db[_0x9177('0x38')]['belongsTo'](db['CmContact'],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x154')});db[_0x9177('0x38')][_0x9177('0x111')](db[_0x9177('0x36')],{'as':_0x9177('0x169'),'foreignKey':_0x9177('0x162')});db[_0x9177('0x38')]['belongsTo'](db[_0x9177('0x34')],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x159')});db[_0x9177('0x38')][_0x9177('0x111')](db[_0x9177('0x12c')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db['MailMessage']['belongsTo'](db[_0x9177('0x5f')],{'as':_0x9177('0x5f'),'foreignKey':_0x9177('0x16a')});db[_0x9177('0x3a')][_0x9177('0x111')](db['User'],{'onDelete':_0x9177('0x157')});db['MailApplication'][_0x9177('0x111')](db[_0x9177('0x123')],{'onDelete':'restrict'});db['MailApplication'][_0x9177('0x111')](db[_0x9177('0x34')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x3a')][_0x9177('0x111')](db[_0x9177('0x77')],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x145')});db[_0x9177('0x3a')][_0x9177('0x111')](db['Tag'],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x16b')});db[_0x9177('0x3c')]['belongsTo'](db['MailAccount'],{});db[_0x9177('0x3c')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e')});db[_0x9177('0x3c')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db['MailQueueReport']['belongsTo'](db[_0x9177('0x36')],{});db[_0x9177('0x3c')][_0x9177('0x111')](db['MailMessage'],{});db[_0x9177('0x3c')]['belongsTo'](db[_0x9177('0x11')],{});db[_0x9177('0x3c')][_0x9177('0x111')](db[_0x9177('0x123')],{});db[_0x9177('0x3d')][_0x9177('0x105')](db[_0x9177('0x3f')],{'as':_0x9177('0x16d'),'onDelete':_0x9177('0x109')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9177('0x16e'),'onDelete':_0x9177('0x109')});db[_0x9177('0x40')][_0x9177('0x105')](db[_0x9177('0x74')],{'as':_0x9177('0x15d'),'foreignKey':_0x9177('0x16e')});db['FaxAccount'][_0x9177('0x105')](db['FaxInteraction'],{'as':_0x9177('0x16f')});db[_0x9177('0x40')][_0x9177('0x105')](db[_0x9177('0x42')],{'as':_0x9177('0x13b')});db['FaxAccount'][_0x9177('0x105')](db['VoiceExtension'],{'as':'Exntensions','onDelete':'cascade'});db[_0x9177('0x40')]['hasMany'](db['FaxMessage'],{'as':_0x9177('0x14c')});db['FaxAccount'][_0x9177('0x111')](db[_0x9177('0x25')],{'as':_0x9177('0x25')});db[_0x9177('0x40')][_0x9177('0x111')](db['CmList'],{'as':_0x9177('0x16c'),'foreignKey':'ListId'});db[_0x9177('0x40')][_0x9177('0x111')](db['Pause'],{'as':_0x9177('0x147'),'foreignKey':_0x9177('0x148')});db[_0x9177('0x40')][_0x9177('0x113')](db['User'],{'as':_0x9177('0x14a'),'through':_0x9177('0x130')});db[_0x9177('0x42')]['belongsTo'](db[_0x9177('0x11')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x42')][_0x9177('0x111')](db[_0x9177('0x125')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x42')][_0x9177('0x111')](db[_0x9177('0x40')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x42')]['belongsTo'](db[_0x9177('0x166')],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x16b')});db[_0x9177('0x44')][_0x9177('0x105')](db[_0x9177('0x46')],{'as':_0x9177('0x14c'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x170')});db[_0x9177('0x44')]['belongsTo'](db[_0x9177('0x40')],{'as':_0x9177('0x163'),'foreignKey':'FaxAccountId'});db[_0x9177('0x44')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':'ContactId'});db[_0x9177('0x44')]['belongsTo'](db[_0x9177('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x9177('0x44')]['belongsToMany'](db[_0x9177('0x166')],{'through':_0x9177('0x171'),'as':_0x9177('0x172')});db['FaxInteraction'][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x171'),'as':_0x9177('0x167')});db[_0x9177('0x44')]['belongsToMany'](db[_0x9177('0x11')],{'as':_0x9177('0x173'),'through':_0x9177('0x11f'),'foreignKey':_0x9177('0x170')});db[_0x9177('0x46')][_0x9177('0x111')](db['User'],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x11')});db[_0x9177('0x46')][_0x9177('0x111')](db[_0x9177('0x44')],{'as':_0x9177('0x169'),'foreignKey':'FaxInteractionId'});db[_0x9177('0x46')][_0x9177('0x111')](db['CmContact'],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x154')});db[_0x9177('0x46')][_0x9177('0x111')](db[_0x9177('0xdd')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x9177('0x46')][_0x9177('0x111')](db[_0x9177('0x40')],{'as':'Account','foreignKey':_0x9177('0x16e')});db[_0x9177('0x125')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x2d')});db[_0x9177('0x125')][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':_0x9177('0x174'),'as':_0x9177('0x161')});db[_0x9177('0x175')][_0x9177('0x111')](db[_0x9177('0x40')],{});db[_0x9177('0x175')]['belongsTo'](db[_0x9177('0x12b')],{'as':'List','foreignKey':_0x9177('0x15e')});db[_0x9177('0x175')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':'Contact','foreignKey':_0x9177('0x155')});db[_0x9177('0x175')][_0x9177('0x111')](db[_0x9177('0x44')],{});db[_0x9177('0x175')][_0x9177('0x111')](db['FaxMessage'],{});db[_0x9177('0x175')][_0x9177('0x111')](db[_0x9177('0x11')],{});db[_0x9177('0x175')][_0x9177('0x111')](db[_0x9177('0x125')],{});db[_0x9177('0x135')][_0x9177('0x105')](db[_0x9177('0x176')],{'as':_0x9177('0x15c'),'foreignKey':_0x9177('0x177'),'onDelete':'cascade'});db[_0x9177('0x135')][_0x9177('0x105')](db['CannedAnswer'],{'as':_0x9177('0x15d'),'foreignKey':_0x9177('0x177')});db[_0x9177('0x135')][_0x9177('0x105')](db[_0x9177('0x4d')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x9177('0x105')](db[_0x9177('0x10d')],{'as':_0x9177('0x16f')});db[_0x9177('0x135')][_0x9177('0x105')](db[_0x9177('0x4a')],{'as':_0x9177('0x13b')});db[_0x9177('0x135')][_0x9177('0x111')](db['CmList'],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e')});db['SmsAccount'][_0x9177('0x111')](db['Pause'],{'as':_0x9177('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9177('0x135')]['belongsToMany'](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':'user_has_sms_accounts'});db[_0x9177('0x4a')][_0x9177('0x111')](db[_0x9177('0x11')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x4a')]['belongsTo'](db[_0x9177('0x4f')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x4a')][_0x9177('0x111')](db[_0x9177('0x135')],{'onDelete':'restrict'});db[_0x9177('0x4a')][_0x9177('0x111')](db[_0x9177('0x77')],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x145')});db['SmsApplication'][_0x9177('0x111')](db[_0x9177('0x166')],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x9177('0x105')](db['SmsMessage'],{'as':_0x9177('0x14c'),'onDelete':_0x9177('0x109'),'foreignKey':'SmsInteractionId'});db[_0x9177('0x10d')]['belongsTo'](db['SmsAccount'],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x177')});db['SmsInteraction'][_0x9177('0x111')](db['CmContact'],{'as':'Contact','foreignKey':_0x9177('0x155')});db[_0x9177('0x10d')]['belongsTo'](db[_0x9177('0x11')],{'as':_0x9177('0x164'),'foreignKey':_0x9177('0x104')});db[_0x9177('0x10d')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':'sms_interaction_has_tags','as':_0x9177('0x172')});db['SmsInteraction'][_0x9177('0x113')](db['Tag'],{'through':_0x9177('0x178'),'as':_0x9177('0x167')});db[_0x9177('0x10d')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':'Users','through':_0x9177('0x120'),'foreignKey':_0x9177('0x179')});db[_0x9177('0x4d')]['belongsTo'](db[_0x9177('0x11')],{'as':_0x9177('0x11')});db[_0x9177('0x4d')][_0x9177('0x111')](db[_0x9177('0x67')],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x154')});db['SmsMessage'][_0x9177('0x111')](db[_0x9177('0x10d')],{'onDelete':'cascade','as':_0x9177('0x169'),'foreignKey':'SmsInteractionId'});db[_0x9177('0x4d')][_0x9177('0x111')](db[_0x9177('0x135')],{'as':'Account','foreignKey':_0x9177('0x177')});db[_0x9177('0x4f')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x17a'),'foreignKey':_0x9177('0x17b')});db[_0x9177('0x4f')][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':_0x9177('0x17c'),'as':_0x9177('0x161')});db[_0x9177('0x132')][_0x9177('0x105')](db[_0x9177('0x176')],{'as':'Dispositions','foreignKey':_0x9177('0x17d'),'onDelete':_0x9177('0x109')});db[_0x9177('0x132')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x9177('0x132')][_0x9177('0x105')](db[_0x9177('0x54')],{'as':_0x9177('0x16f'),'foreignKey':_0x9177('0x17d')});db[_0x9177('0x132')][_0x9177('0x105')](db['OpenchannelMessage'],{'as':_0x9177('0x14c'),'foreignKey':_0x9177('0x17d')});db['OpenchannelAccount'][_0x9177('0x105')](db[_0x9177('0x52')],{'as':_0x9177('0x13b'),'foreignKey':_0x9177('0x17d')});db[_0x9177('0x132')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':'List','foreignKey':_0x9177('0x15e')});db[_0x9177('0x132')][_0x9177('0x111')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9177('0x148')});db[_0x9177('0x132')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x134')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0x9177('0x157')});db[_0x9177('0x52')][_0x9177('0x111')](db[_0x9177('0x58')],{'onDelete':'restrict','foreignKey':_0x9177('0x17e')});db[_0x9177('0x52')][_0x9177('0x111')](db['OpenchannelAccount'],{'onDelete':_0x9177('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x9177('0x52')]['belongsTo'](db[_0x9177('0x77')],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x145')});db[_0x9177('0x52')][_0x9177('0x111')](db[_0x9177('0x166')],{'onDelete':'restrict','foreignKey':_0x9177('0x16b')});db[_0x9177('0x54')]['hasMany'](db[_0x9177('0x56')],{'as':_0x9177('0x14c'),'onDelete':'cascade','foreignKey':_0x9177('0x17f')});db[_0x9177('0x54')]['belongsTo'](db[_0x9177('0x132')],{'as':_0x9177('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x9177('0x54')][_0x9177('0x111')](db['CmContact'],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x54')][_0x9177('0x111')](db[_0x9177('0x11')],{'as':_0x9177('0x164'),'foreignKey':'UserId'});db[_0x9177('0x54')]['belongsToMany'](db['Tag'],{'through':_0x9177('0x180'),'as':_0x9177('0x172')});db[_0x9177('0x54')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x180'),'as':_0x9177('0x167')});db[_0x9177('0x54')]['belongsToMany'](db[_0x9177('0x11')],{'as':_0x9177('0x173'),'through':_0x9177('0x121'),'foreignKey':_0x9177('0x17f')});db[_0x9177('0x56')][_0x9177('0x111')](db[_0x9177('0x11')],{'onDelete':'cascade','as':_0x9177('0x11')});db[_0x9177('0x56')][_0x9177('0x111')](db[_0x9177('0x67')],{'onDelete':_0x9177('0x109'),'as':'Contact'});db[_0x9177('0x56')][_0x9177('0x111')](db['OpenchannelInteraction'],{'onDelete':_0x9177('0x109'),'as':'Interaction','foreignKey':_0x9177('0x17f')});db[_0x9177('0x56')][_0x9177('0x111')](db[_0x9177('0xdd')],{'as':_0x9177('0xdd'),'foreignKey':'AttachmentId'});db[_0x9177('0x56')][_0x9177('0x111')](db[_0x9177('0x132')],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x17d')});db[_0x9177('0x58')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':'UserOpenchannelQueue','foreignKey':_0x9177('0x17e')});db['OpenchannelQueue'][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':_0x9177('0x181'),'as':_0x9177('0x161')});db[_0x9177('0x12c')][_0x9177('0x105')](db[_0x9177('0x176')],{'as':_0x9177('0x15c'),'foreignKey':_0x9177('0x182'),'onDelete':_0x9177('0x109')});db[_0x9177('0x12c')][_0x9177('0x105')](db[_0x9177('0x74')],{'as':_0x9177('0x15d'),'foreignKey':_0x9177('0x182')});db[_0x9177('0x12c')]['hasMany'](db[_0x9177('0x63')],{'as':_0x9177('0x183')});db[_0x9177('0x12c')]['hasMany'](db[_0x9177('0x5d')],{'as':_0x9177('0x16f')});db[_0x9177('0x12c')][_0x9177('0x105')](db['ChatApplication'],{'as':_0x9177('0x13b')});db[_0x9177('0x12c')][_0x9177('0x105')](db[_0x9177('0x184')],{'as':'Messages'});db['ChatWebsite'][_0x9177('0x111')](db['CmList'],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e')});db['ChatWebsite']['belongsTo'](db[_0x9177('0x77')],{'as':_0x9177('0x77'),'foreignKey':'IntervalId'});db[_0x9177('0x12c')]['belongsTo'](db[_0x9177('0x34')],{'as':'MailAccount','foreignKey':_0x9177('0x159')});db['ChatWebsite'][_0x9177('0x111')](db[_0x9177('0x146')],{'as':_0x9177('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9177('0x12c')][_0x9177('0x113')](db['User'],{'as':_0x9177('0x14a'),'through':_0x9177('0x12e')});db[_0x9177('0x5a')]['belongsTo'](db[_0x9177('0x132')],{});db[_0x9177('0x5a')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e')});db[_0x9177('0x5a')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x5a')]['belongsTo'](db[_0x9177('0x54')],{});db['OpenchannelQueueReport'][_0x9177('0x111')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x9177('0x111')](db[_0x9177('0x11')],{});db[_0x9177('0x5a')][_0x9177('0x111')](db[_0x9177('0x58')],{});db[_0x9177('0x5c')][_0x9177('0x111')](db[_0x9177('0x11')],{'as':_0x9177('0x185'),'foreignKey':_0x9177('0x104'),'onDelete':_0x9177('0x157')});db[_0x9177('0x5c')]['belongsTo'](db[_0x9177('0x186')],{'as':'Queue','foreignKey':_0x9177('0x187'),'onDelete':_0x9177('0x157')});db[_0x9177('0x5c')][_0x9177('0x111')](db['ChatWebsite'],{'as':_0x9177('0x188'),'foreignKey':'ChatWebsiteId','onDelete':_0x9177('0x157')});db[_0x9177('0x5c')]['belongsTo'](db['Tag'],{'onDelete':_0x9177('0x157'),'foreignKey':'TagId'});db[_0x9177('0x5d')][_0x9177('0x105')](db[_0x9177('0x184')],{'as':_0x9177('0x14c'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x189')});db[_0x9177('0x5d')][_0x9177('0x111')](db['ChatWebsite'],{'as':_0x9177('0x163'),'foreignKey':'ChatWebsiteId'});db[_0x9177('0x5d')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db['ChatInteraction'][_0x9177('0x111')](db[_0x9177('0x11')],{'as':'Owner','foreignKey':_0x9177('0x104')});db[_0x9177('0x5d')][_0x9177('0x113')](db['Tag'],{'through':_0x9177('0x18a'),'as':_0x9177('0x172')});db['ChatInteraction'][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x18a'),'as':'ThroughTags'});db['ChatInteraction'][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x173'),'through':_0x9177('0x11d'),'foreignKey':'ChatInteractionId'});db[_0x9177('0x184')]['belongsTo'](db[_0x9177('0x11')],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x11')});db[_0x9177('0x184')][_0x9177('0x111')](db[_0x9177('0x67')],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x184')][_0x9177('0x111')](db[_0x9177('0x5d')],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x169'),'foreignKey':_0x9177('0x189')});db[_0x9177('0x184')][_0x9177('0x111')](db[_0x9177('0xdd')],{'as':_0x9177('0xdd'),'foreignKey':_0x9177('0x18b')});db[_0x9177('0x184')][_0x9177('0x111')](db[_0x9177('0x12c')],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x182')});db['ChatOfflineMessage'][_0x9177('0x105')](db[_0x9177('0xdd')],{'as':_0x9177('0x168'),'foreignKey':_0x9177('0x16a'),'onDelete':_0x9177('0x109'),'hooks':!![]});db[_0x9177('0x5f')][_0x9177('0x111')](db[_0x9177('0x67')],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x5f')][_0x9177('0x111')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x9177('0x182')});db['ChatQueue'][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x2a'),'hooks':!![]});db[_0x9177('0x186')][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':_0x9177('0x18c'),'as':_0x9177('0x161')});db[_0x9177('0x62')][_0x9177('0x105')](db[_0x9177('0xc1')],{'as':_0x9177('0x14c'),'foreignKey':_0x9177('0x18d'),'onDelete':_0x9177('0x109')});db[_0x9177('0x62')][_0x9177('0x113')](db['User'],{'as':_0x9177('0x13e'),'through':_0x9177('0x114')});db['ChatProactiveAction'][_0x9177('0x111')](db[_0x9177('0x12c')],{'as':_0x9177('0x188'),'foreignKey':_0x9177('0x182')});db[_0x9177('0x65')][_0x9177('0x105')](db[_0x9177('0x67')],{'as':_0x9177('0x115'),'foreignKey':_0x9177('0x18e')});db['CmContact'][_0x9177('0x105')](db['CmHopper'],{'as':_0x9177('0x13f'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x67')][_0x9177('0x105')](db['CmHopperFinal'],{'as':_0x9177('0x10a'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x67')][_0x9177('0x105')](db[_0x9177('0x6e')],{'as':'HopperHistories','foreignKey':_0x9177('0x155')});db[_0x9177('0x67')]['hasMany'](db[_0x9177('0x6f')],{'as':_0x9177('0x6f'),'foreignKey':'ContactId'});db['CmContact'][_0x9177('0x105')](db[_0x9177('0xc6')],{'as':_0x9177('0x18f'),'foreignKey':'ContactId'});db[_0x9177('0x67')][_0x9177('0x105')](db[_0x9177('0x54')],{'as':_0x9177('0x10c'),'foreignKey':'ContactId','onDelete':_0x9177('0x157')});db[_0x9177('0x67')]['hasMany'](db['ChatInteraction'],{'as':_0x9177('0x11c'),'foreignKey':_0x9177('0x155'),'onDelete':_0x9177('0x157')});db[_0x9177('0x67')][_0x9177('0x105')](db[_0x9177('0x10d')],{'as':_0x9177('0x10e'),'foreignKey':_0x9177('0x155'),'onDelete':_0x9177('0x157')});db[_0x9177('0x67')][_0x9177('0x105')](db[_0x9177('0x44')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x9177('0x157')});db[_0x9177('0x67')]['hasMany'](db[_0x9177('0x36')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x9177('0x157')});db[_0x9177('0x67')][_0x9177('0x111')](db[_0x9177('0x65')],{'as':'Company','foreignKey':_0x9177('0x18e')});db[_0x9177('0x67')][_0x9177('0x111')](db['CmList'],{'as':_0x9177('0x16c'),'foreignKey':'ListId','onDelete':_0x9177('0x109')});db[_0x9177('0x67')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x173'),'through':_0x9177('0x116')});db['CmContact'][_0x9177('0x113')](db[_0x9177('0x166')],{'as':_0x9177('0x172'),'through':_0x9177('0x190')});db[_0x9177('0x67')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x190'),'as':'ThroughTags'});db[_0x9177('0x69')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':'Contact','foreignKey':_0x9177('0x155'),'onDelete':_0x9177('0x109')});db[_0x9177('0x69')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e'),'onDelete':_0x9177('0x109')});db['CmHopper']['belongsTo'](db['User'],{'as':_0x9177('0x185'),'foreignKey':_0x9177('0x104')});db['CmHopper'][_0x9177('0x111')](db['VoiceQueue'],{'as':_0x9177('0x191'),'foreignKey':_0x9177('0x140'),'onDelete':'cascade'});db[_0x9177('0x69')][_0x9177('0x111')](db[_0x9177('0x192')],{'as':_0x9177('0x192'),'foreignKey':_0x9177('0x193'),'onDelete':_0x9177('0x109')});db[_0x9177('0x69')][_0x9177('0x111')](db[_0x9177('0x11')],{'as':_0x9177('0x164'),'foreignKey':_0x9177('0x194')});db['CmHopperBlack'][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':'ContactId','onDelete':_0x9177('0x109')});db['CmHopperBlack'][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e'),'onDelete':_0x9177('0x109')});db[_0x9177('0x6a')][_0x9177('0x111')](db[_0x9177('0x17')],{'as':_0x9177('0x191'),'foreignKey':_0x9177('0x140'),'onDelete':_0x9177('0x109')});db[_0x9177('0x6a')][_0x9177('0x111')](db['Campaign'],{'as':_0x9177('0x192'),'foreignKey':_0x9177('0x193'),'onDelete':'cascade'});db[_0x9177('0x72')][_0x9177('0x105')](db[_0x9177('0x76')],{'as':{'plural':'All','singular':_0x9177('0x195')},'foreignKey':_0x9177('0x196'),'onDelete':_0x9177('0x109'),'hooks':!![]});db[_0x9177('0x72')][_0x9177('0x105')](db[_0x9177('0x76')],{'as':{'plural':_0x9177('0x197'),'singular':_0x9177('0x198')},'foreignKey':_0x9177('0x199'),'onDelete':'cascade','hooks':!![]});db[_0x9177('0x72')][_0x9177('0x105')](db['Action'],{'as':_0x9177('0x19a'),'foreignKey':'AutomationId','onDelete':_0x9177('0x109'),'hooks':!![]});db[_0x9177('0x176')][_0x9177('0x105')](db[_0x9177('0x176')],{'as':'Dispositions','foreignKey':_0x9177('0x19b'),'onDelete':_0x9177('0x109')});db[_0x9177('0x77')]['hasMany'](db[_0x9177('0x77')],{'as':_0x9177('0x19c'),'foreignKey':_0x9177('0x145'),'onDelete':_0x9177('0x109'),'hooks':!![],'required':![]});db[_0x9177('0x77')][_0x9177('0x105')](db[_0x9177('0x107')],{'as':_0x9177('0x108'),'foreignKey':_0x9177('0x145'),'onDelete':_0x9177('0x157')});db[_0x9177('0x77')]['hasMany'](db[_0x9177('0x3a')],{'as':_0x9177('0x19d'),'foreignKey':_0x9177('0x145')});db[_0x9177('0x77')][_0x9177('0x105')](db[_0x9177('0x5c')],{'as':_0x9177('0x19e'),'foreignKey':_0x9177('0x145')});db[_0x9177('0x77')][_0x9177('0x105')](db[_0x9177('0x42')],{'as':_0x9177('0x19f'),'foreignKey':'IntervalId'});db[_0x9177('0x77')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x9177('0x145')});db[_0x9177('0x7d')][_0x9177('0x111')](db['MailAccount'],{});db[_0x9177('0x7d')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x9177('0x111')](db['AnalyticCustomReport'],{'foreignKey':_0x9177('0x1a0')});db[_0x9177('0x7f')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x9177('0x157')});db['Tag'][_0x9177('0x113')](db[_0x9177('0x67')],{'through':'cm_contact_has_tags'});db[_0x9177('0x166')][_0x9177('0x113')](db[_0x9177('0x5d')],{'through':_0x9177('0x18a')});db[_0x9177('0x166')][_0x9177('0x113')](db[_0x9177('0x36')],{'through':_0x9177('0x165')});db[_0x9177('0x166')][_0x9177('0x113')](db['SmsInteraction'],{'through':_0x9177('0x178')});db['Tag'][_0x9177('0x113')](db[_0x9177('0x44')],{'through':_0x9177('0x171')});db[_0x9177('0x166')][_0x9177('0x113')](db[_0x9177('0x54')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x9177('0x113')](db[_0x9177('0xf2')],{'through':_0x9177('0x1a1')});db[_0x9177('0x83')][_0x9177('0x105')](db[_0x9177('0x76')],{'as':{'plural':_0x9177('0x1a2'),'singular':_0x9177('0x1a3')},'foreignKey':'TriggerAllId','onDelete':_0x9177('0x109'),'hooks':!![]});db[_0x9177('0x83')]['hasMany'](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x9177('0x1a4'),'onDelete':_0x9177('0x109'),'hooks':!![]});db['Trigger'][_0x9177('0x105')](db[_0x9177('0x70')],{'as':'Actions','foreignKey':_0x9177('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x9177('0x89')][_0x9177('0x105')](db[_0x9177('0x8e')],{'as':_0x9177('0x1a6'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1a0'),'hooks':!![]});db['AnalyticDefaultReport'][_0x9177('0x105')](db[_0x9177('0x8e')],{'as':_0x9177('0x1a6'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1a7')});db[_0x9177('0x8d')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1a8')});db[_0x9177('0x8e')][_0x9177('0x111')](db['AnalyticMetric'],{'foreignKey':_0x9177('0x1a8')});db[_0x9177('0x91')][_0x9177('0x105')](db[_0x9177('0x92')],{'as':_0x9177('0x1a9'),'onDelete':_0x9177('0x109'),'foreignKey':'AccountId'});db[_0x9177('0x92')][_0x9177('0x105')](db[_0x9177('0x93')],{'as':'Subjects','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0x92')][_0x9177('0x105')](db[_0x9177('0x93')],{'as':_0x9177('0x1ab'),'onDelete':_0x9177('0x109'),'foreignKey':'DescriptionId'});db[_0x9177('0x92')][_0x9177('0x105')](db[_0x9177('0x93')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9177('0x1ac')});db[_0x9177('0x92')][_0x9177('0x111')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x9177('0x1ad')});db[_0x9177('0x93')][_0x9177('0x105')](db[_0x9177('0x93')],{'as':'Subject','foreignKey':_0x9177('0x1aa')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x9177('0x1ae'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0x93')][_0x9177('0x105')](db['SalesforceField'],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0x93')][_0x9177('0x111')](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db['SugarcrmAccount']['hasMany'](db[_0x9177('0x97')],{'as':_0x9177('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x9177('0x105')](db[_0x9177('0x99')],{'as':'Subjects','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0x97')][_0x9177('0x105')](db[_0x9177('0x99')],{'as':'Descriptions','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1af')});db['SugarcrmConfiguration']['hasMany'](db[_0x9177('0x99')],{'as':_0x9177('0x1a6'),'onDelete':_0x9177('0x109'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x9177('0x111')](db[_0x9177('0x95')],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x1ad')});db[_0x9177('0x99')][_0x9177('0x105')](db[_0x9177('0x99')],{'as':_0x9177('0x1b2'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0x99')][_0x9177('0x105')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x9177('0x1af')});db[_0x9177('0x99')][_0x9177('0x105')](db[_0x9177('0x99')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0x99')][_0x9177('0x111')](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0x9b')][_0x9177('0x105')](db[_0x9177('0x9d')],{'as':_0x9177('0x1a9'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1ad')});db[_0x9177('0x9d')][_0x9177('0x105')](db[_0x9177('0x1b3')],{'as':_0x9177('0x1b4'),'onDelete':'cascade','foreignKey':_0x9177('0x1aa')});db[_0x9177('0x9d')][_0x9177('0x105')](db[_0x9177('0x1b3')],{'as':_0x9177('0x1ab'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1af')});db['DeskConfiguration'][_0x9177('0x105')](db[_0x9177('0x1b3')],{'as':_0x9177('0x1a6'),'onDelete':'cascade','foreignKey':_0x9177('0x1ac')});db['DeskConfiguration'][_0x9177('0x111')](db[_0x9177('0x9b')],{'as':'Account','foreignKey':'AccountId'});db[_0x9177('0x9d')][_0x9177('0x113')](db['Tag'],{'through':_0x9177('0x1b5')});db[_0x9177('0x1b3')][_0x9177('0x105')](db[_0x9177('0x1b3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9177('0x1b3')][_0x9177('0x105')](db['DeskField'],{'as':_0x9177('0x1ae'),'foreignKey':_0x9177('0x1af')});db['DeskField'][_0x9177('0x105')](db[_0x9177('0x1b3')],{'as':'Field','foreignKey':'FieldId'});db[_0x9177('0x1b3')]['belongsTo'](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':'VariableId'});db[_0x9177('0x1b6')][_0x9177('0x105')](db[_0x9177('0x1b7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9177('0x1ad')});db['ZohoConfiguration'][_0x9177('0x105')](db[_0x9177('0xa1')],{'as':_0x9177('0x1b4'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1aa')});db['ZohoConfiguration'][_0x9177('0x105')](db[_0x9177('0xa1')],{'as':_0x9177('0x1ab'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0x1b7')][_0x9177('0x105')](db[_0x9177('0xa1')],{'as':_0x9177('0x1a6'),'onDelete':_0x9177('0x109'),'foreignKey':'FieldId'});db[_0x9177('0x1b7')]['belongsTo'](db[_0x9177('0x1b6')],{'as':'Account','foreignKey':_0x9177('0x1ad')});db[_0x9177('0xa1')]['hasMany'](db[_0x9177('0xa1')],{'as':_0x9177('0x1b2'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xa1')][_0x9177('0x105')](db['ZohoField'],{'as':_0x9177('0x1ae'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x9177('0x105')](db[_0x9177('0xa1')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xa1')][_0x9177('0x111')](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0xa2')]['hasMany'](db[_0x9177('0xa4')],{'as':_0x9177('0x1a9'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1ad')});db[_0x9177('0xa4')][_0x9177('0x105')](db[_0x9177('0xa5')],{'as':_0x9177('0x1b4'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xa4')][_0x9177('0x105')](db[_0x9177('0xa5')],{'as':_0x9177('0x1ab'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0xa4')][_0x9177('0x105')](db[_0x9177('0xa5')],{'as':_0x9177('0x1a6'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x9177('0x111')](db[_0x9177('0xa2')],{'as':_0x9177('0x163'),'foreignKey':'AccountId'});db[_0x9177('0xa4')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':'int_zendesk_configuration_has_tags'});db[_0x9177('0xa5')][_0x9177('0x105')](db[_0x9177('0xa5')],{'as':'Subject','foreignKey':_0x9177('0x1aa')});db['ZendeskField'][_0x9177('0x105')](db[_0x9177('0xa5')],{'as':_0x9177('0x1ae'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0xa5')]['hasMany'](db['ZendeskField'],{'as':'Field','foreignKey':_0x9177('0x1ac')});db[_0x9177('0xa5')][_0x9177('0x111')](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0xa7')][_0x9177('0x105')](db[_0x9177('0x1b8')],{'as':_0x9177('0x1a9'),'onDelete':_0x9177('0x109'),'foreignKey':'AccountId'});db[_0x9177('0x1b8')]['hasMany'](db[_0x9177('0xaa')],{'as':'Subjects','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0x1b8')][_0x9177('0x105')](db[_0x9177('0xaa')],{'as':_0x9177('0x1ab'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0x1b8')][_0x9177('0x105')](db[_0x9177('0xaa')],{'as':_0x9177('0x1a6'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0x1b8')][_0x9177('0x111')](db[_0x9177('0xa7')],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x1ad')});db['FreshdeskConfiguration'][_0x9177('0x113')](db[_0x9177('0x166')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9177('0xaa')][_0x9177('0x105')](db[_0x9177('0xaa')],{'as':_0x9177('0x1b2'),'foreignKey':'SubjectId'});db[_0x9177('0xaa')][_0x9177('0x105')](db[_0x9177('0xaa')],{'as':_0x9177('0x1ae'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0xaa')][_0x9177('0x105')](db[_0x9177('0xaa')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xaa')]['belongsTo'](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0xac')][_0x9177('0x105')](db[_0x9177('0xae')],{'as':_0x9177('0x1a9'),'onDelete':_0x9177('0x109'),'foreignKey':'AccountId'});db[_0x9177('0xae')][_0x9177('0x105')](db[_0x9177('0x1b9')],{'as':_0x9177('0x1b4'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xae')][_0x9177('0x105')](db[_0x9177('0x1b9')],{'as':'Descriptions','foreignKey':_0x9177('0x1af')});db[_0x9177('0xae')][_0x9177('0x105')](db[_0x9177('0x1b9')],{'as':_0x9177('0x1a6'),'foreignKey':'FieldId'});db[_0x9177('0xae')][_0x9177('0x111')](db[_0x9177('0xac')],{'as':_0x9177('0x163'),'foreignKey':'AccountId'});db[_0x9177('0x1b9')][_0x9177('0x105')](db[_0x9177('0x1b9')],{'as':_0x9177('0x1b2'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0x1b9')]['hasMany'](db[_0x9177('0x1b9')],{'as':_0x9177('0x1ae'),'foreignKey':_0x9177('0x1af')});db['VtigerField']['hasMany'](db[_0x9177('0x1b9')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db['VtigerField'][_0x9177('0x111')](db['Variable'],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0xb1')]['hasMany'](db[_0x9177('0xb3')],{'as':_0x9177('0x1a9'),'onDelete':_0x9177('0x109'),'foreignKey':'AccountId'});db[_0x9177('0xb3')][_0x9177('0x105')](db[_0x9177('0xb5')],{'as':_0x9177('0x1b4'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x9177('0x105')](db[_0x9177('0xb5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x9177('0xb3')][_0x9177('0x105')](db['ServicenowField'],{'as':_0x9177('0x1a6'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xb3')][_0x9177('0x111')](db[_0x9177('0xb1')],{'as':'Account','foreignKey':_0x9177('0x1ad')});db[_0x9177('0xb5')][_0x9177('0x105')](db[_0x9177('0xb5')],{'as':_0x9177('0x1b2'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xb5')][_0x9177('0x105')](db[_0x9177('0xb5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9177('0xb5')][_0x9177('0x105')](db[_0x9177('0xb5')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xb5')]['belongsTo'](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':'VariableId'});db[_0x9177('0xb7')][_0x9177('0x105')](db[_0x9177('0xb9')],{'as':'Configurations','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1ad')});db['Dynamics365Account'][_0x9177('0x111')](db['CloudProvider'],{'as':_0x9177('0xfa'),'foreignKey':_0x9177('0x156')});db[_0x9177('0xb9')]['hasMany'](db['Dynamics365Field'],{'as':_0x9177('0x1b4'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xb9')]['hasMany'](db[_0x9177('0xba')],{'as':'Descriptions','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0xb9')]['hasMany'](db['Dynamics365Field'],{'as':_0x9177('0x1a6'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xb9')][_0x9177('0x111')](db[_0x9177('0xb7')],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x1ad')});db[_0x9177('0xba')][_0x9177('0x105')](db['Dynamics365Field'],{'as':_0x9177('0x1b2'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xba')]['hasMany'](db[_0x9177('0xba')],{'as':_0x9177('0x1ae'),'foreignKey':_0x9177('0x1af')});db[_0x9177('0xba')][_0x9177('0x105')](db[_0x9177('0xba')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xba')][_0x9177('0x111')](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0x1ba')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x9177('0x109'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x9177('0x105')](db[_0x9177('0xbd')],{'as':_0x9177('0x1b4'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0x1bb')][_0x9177('0x105')](db['FreshsalesField'],{'as':_0x9177('0x1ab'),'foreignKey':'DescriptionId'});db[_0x9177('0x1bb')][_0x9177('0x105')](db[_0x9177('0xbd')],{'as':_0x9177('0x1a6'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0x1bb')][_0x9177('0x111')](db['FreshsalesAccount'],{'as':_0x9177('0x163'),'foreignKey':_0x9177('0x1ad')});db[_0x9177('0xbd')]['hasMany'](db[_0x9177('0xbd')],{'as':_0x9177('0x1b2'),'foreignKey':_0x9177('0x1aa')});db[_0x9177('0xbd')][_0x9177('0x105')](db[_0x9177('0xbd')],{'as':'Description','foreignKey':_0x9177('0x1af')});db['FreshsalesField'][_0x9177('0x105')](db[_0x9177('0xbd')],{'as':_0x9177('0x1b0'),'foreignKey':_0x9177('0x1ac')});db[_0x9177('0xbd')][_0x9177('0x111')](db[_0x9177('0x84')],{'as':_0x9177('0x84'),'foreignKey':_0x9177('0x1b1')});db[_0x9177('0xc0')]['belongsTo'](db[_0x9177('0x12c')],{});db[_0x9177('0xc0')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e')});db[_0x9177('0xc0')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':'Contact','foreignKey':_0x9177('0x155')});db['ChatQueueReport'][_0x9177('0x111')](db[_0x9177('0x5d')],{});db[_0x9177('0xc0')][_0x9177('0x111')](db['ChatMessage'],{});db[_0x9177('0xc0')][_0x9177('0x111')](db[_0x9177('0x11')],{});db[_0x9177('0xc0')][_0x9177('0x111')](db[_0x9177('0x186')],{});db['ChatInternalMessage']['belongsTo'](db[_0x9177('0x11')],{'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1bc')});db[_0x9177('0xc1')]['belongsTo'](db['User'],{'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1bd')});db[_0x9177('0xc6')][_0x9177('0x105')](db[_0x9177('0xc4')],{'foreignKey':_0x9177('0x1be'),'onDelete':_0x9177('0x109')});db[_0x9177('0xc6')]['hasMany'](db[_0x9177('0xc2')],{'foreignKey':_0x9177('0x1be'),'onDelete':_0x9177('0x109')});db[_0x9177('0xc8')][_0x9177('0x111')](db[_0x9177('0x135')],{});db[_0x9177('0xc8')][_0x9177('0x111')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x9177('0xc8')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0xc8')][_0x9177('0x111')](db[_0x9177('0x10d')],{});db[_0x9177('0xc8')][_0x9177('0x111')](db[_0x9177('0x4d')],{});db[_0x9177('0xc8')]['belongsTo'](db['User'],{});db[_0x9177('0xc8')][_0x9177('0x111')](db[_0x9177('0x4f')],{});db[_0x9177('0x1bf')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0x9177('0x1bf')][_0x9177('0x105')](db[_0x9177('0xc4')],{'foreignKey':_0x9177('0x1c0')});db[_0x9177('0x1bf')]['hasMany'](db[_0x9177('0xc2')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x173'),'through':'user_has_square_projects'});db[_0x9177('0xd7')]['belongsToMany'](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x119')});db[_0x9177('0xd7')]['belongsToMany'](db[_0x9177('0x17')],{'through':_0x9177('0xfc'),'as':_0x9177('0x1c1')});db[_0x9177('0xd7')][_0x9177('0x113')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x9177('0x124')});db['Team'][_0x9177('0x113')](db[_0x9177('0x186')],{'through':_0x9177('0x18c'),'as':_0x9177('0x1c2')});db[_0x9177('0xd7')]['belongsToMany'](db[_0x9177('0x125')],{'through':_0x9177('0x174'),'as':_0x9177('0x126')});db[_0x9177('0xd7')]['belongsToMany'](db[_0x9177('0x4f')],{'through':_0x9177('0x17c'),'as':_0x9177('0x127')});db[_0x9177('0xd7')][_0x9177('0x113')](db[_0x9177('0x58')],{'through':_0x9177('0x181'),'as':_0x9177('0x128')});db['Team'][_0x9177('0x113')](db[_0x9177('0xf8')],{'through':_0x9177('0x1c3'),'as':_0x9177('0x12a')});db[_0x9177('0xd7')]['belongsToMany'](db[_0x9177('0xe7')],{'through':_0x9177('0xfe'),'as':'VoicePrefixes'});db[_0x9177('0x192')]['hasMany'](db[_0x9177('0x69')],{'as':_0x9177('0x13f'),'foreignKey':'CampaignId'});db[_0x9177('0x192')]['hasMany'](db['CmHopperFinal'],{'as':_0x9177('0x10a'),'foreignKey':_0x9177('0x193')});db[_0x9177('0x192')][_0x9177('0x105')](db[_0x9177('0x6e')],{'as':_0x9177('0x141'),'foreignKey':'CampaignId'});db[_0x9177('0x192')][_0x9177('0x105')](db[_0x9177('0x6a')],{'as':_0x9177('0x142'),'foreignKey':_0x9177('0x193')});db[_0x9177('0x192')][_0x9177('0x111')](db[_0x9177('0x25')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x9177('0x192')][_0x9177('0x111')](db[_0x9177('0x25')],{'as':_0x9177('0x1c4'),'foreignKey':_0x9177('0x144')});db[_0x9177('0x192')][_0x9177('0x111')](db[_0x9177('0x77')],{'as':_0x9177('0x77'),'foreignKey':_0x9177('0x145')});db[_0x9177('0x192')]['belongsTo'](db['SquareProject'],{'as':_0x9177('0xd2'),'foreignKey':_0x9177('0x1c5')});db[_0x9177('0x192')][_0x9177('0x113')](db[_0x9177('0x12b')],{'as':_0x9177('0x117'),'through':_0x9177('0x1c6')});db[_0x9177('0x192')]['belongsToMany'](db[_0x9177('0x12b')],{'as':_0x9177('0x14b'),'through':_0x9177('0x1c7')});db[_0x9177('0xdd')]['belongsTo'](db[_0x9177('0x5f')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x9177('0x1c8')]['belongsTo'](db[_0x9177('0x38')],{});db[_0x9177('0x1c8')][_0x9177('0x111')](db[_0x9177('0x36')],{});db['MailTransferReport'][_0x9177('0x111')](db['MailAccount'],{'foreignKey':_0x9177('0x1c9'),'as':_0x9177('0x1ca')});db[_0x9177('0x1c8')][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':'FromUserId','as':_0x9177('0x1cb')});db['MailTransferReport'][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':_0x9177('0x1cc'),'as':_0x9177('0x1cd')});db[_0x9177('0x1c8')]['belongsTo'](db[_0x9177('0x123')],{'foreignKey':_0x9177('0x1ce'),'as':_0x9177('0x1cf')});db[_0x9177('0x1c8')][_0x9177('0x111')](db[_0x9177('0x34')],{'foreignKey':_0x9177('0x1d0'),'as':_0x9177('0x1d1')});db[_0x9177('0xdf')][_0x9177('0x111')](db[_0x9177('0x184')],{});db[_0x9177('0xdf')]['belongsTo'](db[_0x9177('0x5d')],{});db[_0x9177('0xdf')][_0x9177('0x111')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x9177('0x1ca')});db[_0x9177('0xdf')][_0x9177('0x111')](db['User'],{'foreignKey':_0x9177('0x1d2'),'as':_0x9177('0x1cb')});db[_0x9177('0xdf')][_0x9177('0x111')](db['User'],{'foreignKey':_0x9177('0x1cc'),'as':_0x9177('0x1cd')});db[_0x9177('0xdf')][_0x9177('0x111')](db[_0x9177('0x186')],{'foreignKey':_0x9177('0x1d3'),'as':_0x9177('0x1cf')});db['ChatTransferReport'][_0x9177('0x111')](db[_0x9177('0x12c')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x9177('0xe1')][_0x9177('0x111')](db[_0x9177('0x46')],{});db[_0x9177('0xe1')][_0x9177('0x111')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x9177('0x111')](db[_0x9177('0x40')],{'foreignKey':_0x9177('0x1d4'),'as':_0x9177('0x1ca')});db[_0x9177('0xe1')][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':'FromUserId','as':_0x9177('0x1cb')});db[_0x9177('0xe1')][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':_0x9177('0x1cc'),'as':_0x9177('0x1cd')});db[_0x9177('0xe1')][_0x9177('0x111')](db[_0x9177('0x125')],{'foreignKey':_0x9177('0x1d5'),'as':_0x9177('0x1cf')});db[_0x9177('0xe1')][_0x9177('0x111')](db[_0x9177('0x40')],{'foreignKey':_0x9177('0x1d6'),'as':_0x9177('0x1d1')});db[_0x9177('0xe2')][_0x9177('0x111')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x9177('0x111')](db[_0x9177('0x54')],{});db[_0x9177('0xe2')][_0x9177('0x111')](db[_0x9177('0x132')],{'foreignKey':_0x9177('0x1d7'),'as':_0x9177('0x1ca')});db['OpenchannelTransferReport'][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':'FromUserId','as':_0x9177('0x1cb')});db[_0x9177('0xe2')][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':_0x9177('0x1cc'),'as':'ToAgent'});db[_0x9177('0xe2')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x9177('0x1d8'),'as':_0x9177('0x1cf')});db[_0x9177('0xe2')][_0x9177('0x111')](db[_0x9177('0x132')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x9177('0xe4')][_0x9177('0x111')](db[_0x9177('0x4d')],{});db['SmsTransferReport']['belongsTo'](db['SmsInteraction'],{});db['SmsTransferReport'][_0x9177('0x111')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x9177('0x1ca')});db['SmsTransferReport'][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':_0x9177('0x1d2'),'as':_0x9177('0x1cb')});db[_0x9177('0xe4')][_0x9177('0x111')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0x9177('0x4f')],{'foreignKey':_0x9177('0x1d9'),'as':'ToQueue'});db['SmsTransferReport'][_0x9177('0x111')](db['SmsAccount'],{'foreignKey':_0x9177('0x1da'),'as':_0x9177('0x1d1')});db['CmList'][_0x9177('0x105')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9177('0x15e'),'onDelete':_0x9177('0x109')});db[_0x9177('0x12b')][_0x9177('0x105')](db[_0x9177('0x1db')],{'as':_0x9177('0x1dc'),'foreignKey':_0x9177('0x15e')});db[_0x9177('0x12b')][_0x9177('0x105')](db[_0x9177('0x67')],{'as':_0x9177('0x115'),'onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x15e')});db[_0x9177('0x12b')]['hasMany'](db[_0x9177('0x6c')],{'as':_0x9177('0x10a'),'foreignKey':_0x9177('0x15e')});db[_0x9177('0x12b')][_0x9177('0x105')](db[_0x9177('0x6e')],{'as':_0x9177('0x10b'),'foreignKey':'ListId'});db[_0x9177('0x12b')]['hasMany'](db[_0x9177('0x6f')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x9177('0x12b')][_0x9177('0x113')](db[_0x9177('0x17')],{'as':'Queues','through':_0x9177('0x149')});db[_0x9177('0x12b')][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x118')});db[_0x9177('0xe7')]['hasMany'](db['VoiceExtension'],{'as':_0x9177('0x108'),'onDelete':_0x9177('0x109')});db['VoicePrefix'][_0x9177('0x113')](db[_0x9177('0x11')],{'as':_0x9177('0x14a'),'through':_0x9177('0x1dd')});db['VoicePrefix'][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':'TeamVoicePrefix','as':_0x9177('0x161')});db['UserProfile']['hasMany'](db[_0x9177('0x11')],{'as':_0x9177('0x173'),'foreignKey':_0x9177('0x112')});db[_0x9177('0xe9')][_0x9177('0x105')](db[_0x9177('0xea')],{'as':_0x9177('0x1de'),'foreignKey':_0x9177('0x112'),'onDelete':'cascade'});db['UserProfileSection'][_0x9177('0x105')](db[_0x9177('0xeb')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x9177('0x109')});db['WhatsappAccount']['hasMany'](db[_0x9177('0x176')],{'as':_0x9177('0x15c'),'foreignKey':_0x9177('0x1df'),'onDelete':_0x9177('0x109')});db[_0x9177('0xef')][_0x9177('0x105')](db[_0x9177('0x74')],{'as':'Answers','foreignKey':_0x9177('0x1df')});db[_0x9177('0xef')][_0x9177('0x105')](db[_0x9177('0xf3')],{'as':'Messages','foreignKey':_0x9177('0x1df')});db[_0x9177('0xef')][_0x9177('0x105')](db[_0x9177('0xf2')],{'as':_0x9177('0x16f')});db['WhatsappAccount'][_0x9177('0x105')](db['WhatsappApplication'],{'as':_0x9177('0x13b')});db[_0x9177('0xef')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':'ListId'});db['WhatsappAccount']['belongsTo'](db[_0x9177('0x146')],{'as':_0x9177('0x147'),'foreignKey':_0x9177('0x148')});db[_0x9177('0xef')][_0x9177('0x113')](db['User'],{'as':_0x9177('0x14a'),'through':'user_has_whatsapp_accounts'});db[_0x9177('0x1e0')]['belongsTo'](db[_0x9177('0x11')],{'onDelete':_0x9177('0x157')});db['WhatsappApplication'][_0x9177('0x111')](db[_0x9177('0xf8')],{'onDelete':_0x9177('0x157')});db['WhatsappApplication']['belongsTo'](db[_0x9177('0xef')],{'onDelete':_0x9177('0x157')});db[_0x9177('0x1e0')]['belongsTo'](db['Interval'],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x145')});db[_0x9177('0x1e0')]['belongsTo'](db[_0x9177('0x166')],{'onDelete':_0x9177('0x157'),'foreignKey':_0x9177('0x16b')});db[_0x9177('0xf2')]['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x9177('0x109'),'foreignKey':_0x9177('0x1e1')});db[_0x9177('0xf2')][_0x9177('0x111')](db[_0x9177('0xef')],{'as':'Account','foreignKey':_0x9177('0x1df')});db[_0x9177('0xf2')][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':'ContactId'});db[_0x9177('0xf2')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x9177('0x104')});db[_0x9177('0xf2')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x1a1'),'as':_0x9177('0x172')});db[_0x9177('0xf2')][_0x9177('0x113')](db[_0x9177('0x166')],{'through':_0x9177('0x1a1'),'as':'ThroughTags'});db[_0x9177('0xf2')][_0x9177('0x113')](db['User'],{'as':_0x9177('0x173'),'through':'user_has_whatsapp_interactions','foreignKey':_0x9177('0x1e1')});db[_0x9177('0xf3')][_0x9177('0x111')](db['User'],{'as':_0x9177('0x11')});db['WhatsappMessage'][_0x9177('0x111')](db[_0x9177('0x67')],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x154')});db['WhatsappMessage'][_0x9177('0x111')](db['WhatsappInteraction'],{'onDelete':_0x9177('0x109'),'as':_0x9177('0x169'),'foreignKey':_0x9177('0x1e1')});db[_0x9177('0xf3')][_0x9177('0x111')](db[_0x9177('0xef')],{'as':'Account','foreignKey':_0x9177('0x1df')});db[_0x9177('0x1e2')][_0x9177('0x111')](db[_0x9177('0xef')],{});db[_0x9177('0x1e2')][_0x9177('0x111')](db[_0x9177('0x12b')],{'as':_0x9177('0x16c'),'foreignKey':_0x9177('0x15e')});db['WhatsappQueueReport'][_0x9177('0x111')](db[_0x9177('0x67')],{'as':_0x9177('0x154'),'foreignKey':_0x9177('0x155')});db[_0x9177('0x1e2')][_0x9177('0x111')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x9177('0x111')](db[_0x9177('0xf8')],{});db['WhatsappQueueReport'][_0x9177('0x111')](db[_0x9177('0xf3')],{});db[_0x9177('0x1e2')][_0x9177('0x111')](db[_0x9177('0x11')],{});db[_0x9177('0xf6')][_0x9177('0x111')](db[_0x9177('0xf3')],{});db[_0x9177('0xf6')][_0x9177('0x111')](db[_0x9177('0xf2')],{});db[_0x9177('0xf6')]['belongsTo'](db[_0x9177('0xef')],{'foreignKey':'FromWhatsappAccountId','as':_0x9177('0x1ca')});db[_0x9177('0xf6')][_0x9177('0x111')](db[_0x9177('0xef')],{'foreignKey':_0x9177('0x1e3'),'as':_0x9177('0x1d1')});db[_0x9177('0xf6')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x9177('0x1e4'),'as':_0x9177('0x1cf')});db[_0x9177('0xf6')][_0x9177('0x111')](db[_0x9177('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9177('0xf6')][_0x9177('0x111')](db['User'],{'foreignKey':_0x9177('0x1cc'),'as':_0x9177('0x1cd')});db['WhatsappQueue'][_0x9177('0x113')](db['User'],{'as':'Agents','through':_0x9177('0x1e5'),'foreignKey':_0x9177('0x1e6')});db[_0x9177('0xf8')][_0x9177('0x113')](db[_0x9177('0xd7')],{'through':_0x9177('0x1c3'),'as':_0x9177('0x161')});db[_0x9177('0x101')][_0x9177('0x111')](db[_0x9177('0x11')],{'as':_0x9177('0x1e7'),'foreignKey':_0x9177('0x104'),'onDelete':'cascade','hooks':!![]});db[_0x9177('0xfa')][_0x9177('0x103')](db[_0x9177('0xb7')],{'as':_0x9177('0xb7'),'onDelete':_0x9177('0x157')});db[_0x9177('0xfa')][_0x9177('0x103')](db[_0x9177('0x31')],{'as':'Imap','onDelete':'restrict'});db[_0x9177('0xfa')][_0x9177('0x103')](db[_0x9177('0x158')],{'as':_0x9177('0x15b'),'onDelete':'restrict'});module[_0x9177('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x7356=['SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','userSetting','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','Groups','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','CmHopperFinal','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Answers','List','ListId','Template','team_has_mail_queues','Account','Tags','ThroughTags','Users','MailInteractionId','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','FaxAccountId','Exntensions','FaxApplication','FaxInteractionId','Owner','fax_interaction_has_tags','Attachment','team_has_fax_queues','SmsAccountId','TagId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','Interactions','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatMessage','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CompanyId','HopperHistories','JscriptySessionReport','Company','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Extensions','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','Descriptions','SubjectId','Description','DescriptionId','Field','VariableId','Configurations','FieldId','DeskAccount','int_desk_configuration_has_tags','Subject','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','ChatQueueReport','FromId','JscriptyQuestionReport','SessionId','SmsQueueReport','JscriptyProject','ProjectId','FaxQueues','team_has_sms_queues','SmsQueues','WhatsappQueue','team_has_whatsapp_queues','TrunkBackupId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Contacts','Queues','voice_queues_has_cm_lists','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','xC@LL1234','mysql','utf8mb4','name','utf8','motion2','xcall','127.0.0.1','utf8_general_ci','options','sequelizeHistory','database','username','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxInteraction','../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','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model'];(function(_0x5dbb7a,_0x481d9e){var _0x4fea06=function(_0x3e3f18){while(--_0x3e3f18){_0x5dbb7a['push'](_0x5dbb7a['shift']());}};_0x4fea06(++_0x481d9e);}(_0x7356,0x159));var _0x6735=function(_0x36d7d2,_0x44ac74){_0x36d7d2=_0x36d7d2-0x0;var _0x7a9257=_0x7356[_0x36d7d2];return _0x7a9257;};'use strict';var config=require(_0x6735('0x0'));var Sequelize=require(_0x6735('0x1'));var _=require(_0x6735('0x2'));var jstz=require(_0x6735('0x3'));var timezone=jstz['determine']();config[_0x6735('0x1')]=_[_0x6735('0x4')](config[_0x6735('0x1')],{'database':'motion2','username':'xcall','password':_0x6735('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6735('0x6'),'dialectOptions':{'charset':_0x6735('0x7')},'logging':![],'timezone':timezone[_0x6735('0x8')](),'define':{'charset':_0x6735('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x6735('0x4')](config['sequelizeHistory'],{'database':_0x6735('0xa'),'username':_0x6735('0xb'),'password':_0x6735('0x5'),'options':{'host':_0x6735('0xc'),'port':0xcea,'dialect':_0x6735('0x6'),'dialectOptions':{'charset':_0x6735('0x7')},'logging':![],'timezone':timezone[_0x6735('0x8')](),'define':{'charset':_0x6735('0x9'),'collate':_0x6735('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6735('0x1')]['database'],config[_0x6735('0x1')]['username'],config[_0x6735('0x1')]['password'],config[_0x6735('0x1')][_0x6735('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6735('0xf')][_0x6735('0x10')],config[_0x6735('0xf')][_0x6735('0x11')],config[_0x6735('0xf')][_0x6735('0x12')],config[_0x6735('0xf')][_0x6735('0xe')])};db['User']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x14'));db[_0x6735('0x15')]=db[_0x6735('0x1')]['import'](_0x6735('0x16'));db[_0x6735('0x17')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x18'));db[_0x6735('0x19')]=db[_0x6735('0x1')]['import'](_0x6735('0x1a'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0x6735('0x1b'));db['VoiceQueue']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x6735('0x1c')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x1d'));db['ScreenRecording']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/screenRecording/screenRecording.model');db[_0x6735('0x1e')]=db['sequelize'][_0x6735('0x13')]('../api/voiceMail/voiceMail.model');db[_0x6735('0x1f')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x20'));db['VoiceCallReport']=db['sequelize'][_0x6735('0x13')](_0x6735('0x21'));db[_0x6735('0x22')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x23'));db[_0x6735('0x24')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x25'));db[_0x6735('0x26')]=db[_0x6735('0x1')]['import'](_0x6735('0x27'));db[_0x6735('0x28')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x29'));db['Trunk']=db[_0x6735('0x1')]['import'](_0x6735('0x2a'));db[_0x6735('0x2b')]=db[_0x6735('0x1')]['import'](_0x6735('0x2c'));db['UserVoiceQueueRt']=db['sequelize'][_0x6735('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x6735('0x2d')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x2e'));db[_0x6735('0x2f')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x30'));db[_0x6735('0x31')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x32'));db[_0x6735('0x33')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x6735('0x1')]['import'](_0x6735('0x34'));db['UserOpenchannelQueue']=db[_0x6735('0x1')]['import'](_0x6735('0x35'));db[_0x6735('0x36')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x37'));db['MailServerIn']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x6735('0x38')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x39'));db[_0x6735('0x3a')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/mailQueue/mailQueue.model');db[_0x6735('0x3b')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x3c'));db[_0x6735('0x3d')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x6735('0x3e')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/mailMessage/mailMessage.model');db[_0x6735('0x3f')]=db['sequelize']['import'](_0x6735('0x40'));db[_0x6735('0x41')]=db['sequelize']['import'](_0x6735('0x42'));db[_0x6735('0x43')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/dashboard/dashboard.model');db[_0x6735('0x44')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x45'));db['FaxAccount']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x46'));db['FaxApplication']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/faxApplication/faxApplication.model');db[_0x6735('0x47')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x48'));db[_0x6735('0x49')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x4a'));db[_0x6735('0x4b')]=db[_0x6735('0x1')]['import'](_0x6735('0x4c'));db[_0x6735('0x4d')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x4e'));db[_0x6735('0x4f')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x50'));db[_0x6735('0x51')]=db['sequelize']['import'](_0x6735('0x52'));db[_0x6735('0x53')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x54'));db[_0x6735('0x55')]=db[_0x6735('0x1')]['import'](_0x6735('0x56'));db[_0x6735('0x57')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x58'));db['OpenchannelAccount']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x59'));db['OpenchannelApplication']=db[_0x6735('0x1')]['import'](_0x6735('0x5a'));db[_0x6735('0x5b')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x5c'));db[_0x6735('0x5d')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x5e'));db['OpenchannelQueue']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x5f'));db[_0x6735('0x60')]=db['sequelize']['import'](_0x6735('0x61'));db[_0x6735('0x62')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x63'));db['ChatApplication']=db['sequelize']['import'](_0x6735('0x64'));db[_0x6735('0x65')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db['sequelize'][_0x6735('0x13')](_0x6735('0x66'));db[_0x6735('0x67')]=db[_0x6735('0x1')]['import'](_0x6735('0x68'));db[_0x6735('0x69')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x6a'));db[_0x6735('0x6b')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x6735('0x6c')]=db[_0x6735('0x1')]['import'](_0x6735('0x6d'));db[_0x6735('0x6e')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x6f'));db['CmHopper']=db['sequelize'][_0x6735('0x13')](_0x6735('0x70'));db[_0x6735('0x71')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x72'));db['CmHopperFinal']=db['sequelize']['import'](_0x6735('0x73'));db[_0x6735('0x74')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x75'));db[_0x6735('0x76')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x6735('0x77')]=db[_0x6735('0x1')]['import'](_0x6735('0x78'));db[_0x6735('0x79')]=db[_0x6735('0x1')]['import'](_0x6735('0x7a'));db[_0x6735('0x7b')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/disposition/disposition.model');db[_0x6735('0x7c')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/condition/condition.model');db[_0x6735('0x7d')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x7e'));db['Pause']=db['sequelize']['import'](_0x6735('0x7f'));db['Cdr']=db[_0x6735('0x1')]['import'](_0x6735('0x80'));db['VoiceQueuesLog']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x81'));db[_0x6735('0x82')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x83'));db['Sound']=db[_0x6735('0x1')]['import'](_0x6735('0x84'));db[_0x6735('0x85')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x86'));db['Template']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x87'));db[_0x6735('0x88')]=db[_0x6735('0x1')]['import'](_0x6735('0x89'));db[_0x6735('0x8a')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x8b'));db[_0x6735('0x8c')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x8d'));db[_0x6735('0x8e')]=db[_0x6735('0x1')]['import'](_0x6735('0x8f'));db[_0x6735('0x90')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x91'));db['AnalyticDefaultReport']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x92'));db[_0x6735('0x93')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x94'));db[_0x6735('0x95')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x6735('0x96')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x97'));db[_0x6735('0x98')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x99'));db[_0x6735('0x9a')]=db['sequelize']['import'](_0x6735('0x9b'));db[_0x6735('0x9c')]=db[_0x6735('0x1')]['import'](_0x6735('0x9d'));db[_0x6735('0x9e')]=db['sequelize'][_0x6735('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x6735('0x9f')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xa0'));db[_0x6735('0xa1')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xa2'));db[_0x6735('0xa3')]=db[_0x6735('0x1')]['import'](_0x6735('0xa4'));db['DeskAccount']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x6735('0xa5')]=db[_0x6735('0x1')]['import'](_0x6735('0xa6'));db[_0x6735('0xa7')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xa8'));db[_0x6735('0xa9')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x6735('0xaa')]=db[_0x6735('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x6735('0xab')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x6735('0xac')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xad'));db[_0x6735('0xae')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xaf'));db['FreshdeskAccount']=db['sequelize'][_0x6735('0x13')](_0x6735('0xb0'));db[_0x6735('0xb1')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x6735('0xb2')]=db['sequelize']['import'](_0x6735('0xb3'));db[_0x6735('0xb4')]=db['sequelize']['import'](_0x6735('0xb5'));db[_0x6735('0xb6')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xb7'));db[_0x6735('0xb8')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xb9'));db['ServicenowAccount']=db[_0x6735('0x1')]['import'](_0x6735('0xba'));db[_0x6735('0xbb')]=db[_0x6735('0x1')]['import'](_0x6735('0xbc'));db[_0x6735('0xbd')]=db[_0x6735('0x1')]['import'](_0x6735('0xbe'));db['Dynamics365Account']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xbf'));db[_0x6735('0xc0')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xc1'));db[_0x6735('0xc2')]=db[_0x6735('0x1')]['import'](_0x6735('0xc3'));db[_0x6735('0xc4')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x6735('0xc5')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xc6'));db[_0x6735('0xc7')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xc8'));db[_0x6735('0x8c')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x8d'));db[_0x6735('0xc9')]=db[_0x6735('0x1')]['import'](_0x6735('0xca'));db['ChatQueueReport']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x6735('0xcb')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xcc'));db[_0x6735('0xcd')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xce'));db['JscriptyQuestionReport']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xcf'));db['JscriptySessionReport']=db[_0x6735('0x1')]['import'](_0x6735('0xd0'));db['SmsQueueReport']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0x6735('0xd1')]=db['sequelize'][_0x6735('0x13')](_0x6735('0xd2'));db[_0x6735('0xd3')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xd4'));db['JscriptyProject']=db[_0x6735('0x1')]['import'](_0x6735('0xd5'));db[_0x6735('0xd6')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xd7'));db[_0x6735('0xd8')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xd9'));db['SquareProject']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xda'));db[_0x6735('0xdb')]=db['sequelize'][_0x6735('0x13')]('../api/squareRecording/squareRecording.model');db[_0x6735('0xdc')]=db[_0x6735('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x6735('0xdd')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xde'));db['License']=db[_0x6735('0x1')]['import'](_0x6735('0xdf'));db[_0x6735('0xe0')]=db[_0x6735('0x1')]['import'](_0x6735('0xe1'));db[_0x6735('0xe2')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xe3'));db['Attachment']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xe4'));db['Plugin']=db[_0x6735('0x1')][_0x6735('0x13')]('../api/plugin/plugin.model');db[_0x6735('0xe5')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x6735('0xe6')]=db[_0x6735('0x1')]['import'](_0x6735('0xe7'));db[_0x6735('0xe8')]=db['sequelize'][_0x6735('0x13')](_0x6735('0xe9'));db[_0x6735('0xea')]=db['sequelize']['import'](_0x6735('0xeb'));db[_0x6735('0xec')]=db['sequelize'][_0x6735('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x6735('0xed')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xee'));db[_0x6735('0xef')]=db['sequelize'][_0x6735('0x13')](_0x6735('0xf0'));db[_0x6735('0xf1')]=db[_0x6735('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x6735('0xf2')]=db['sequelize'][_0x6735('0x13')](_0x6735('0xf3'));db['UserProfileResource']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xf4'));db[_0x6735('0xf5')]=db[_0x6735('0x1')][_0x6735('0x13')]('../api/userNotification/userNotification.model');db[_0x6735('0xf6')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xf7'));db[_0x6735('0xf8')]=db[_0x6735('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x6735('0xf9')]=db[_0x6735('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x6735('0xfa')]=db[_0x6735('0x1')]['import'](_0x6735('0xfb'));db[_0x6735('0xfc')]=db['sequelize'][_0x6735('0x13')](_0x6735('0xfd'));db[_0x6735('0xfe')]=db[_0x6735('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0xff'));db[_0x6735('0x100')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x101'));db[_0x6735('0x102')]=db[_0x6735('0x1')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x6735('0x103')]=db['sequelize']['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x6735('0x104')]=db['sequelize'][_0x6735('0x13')](_0x6735('0x105'));db[_0x6735('0x106')]=db[_0x6735('0x1')][_0x6735('0x13')](_0x6735('0x107'));db[_0x6735('0x108')][_0x6735('0x109')](db[_0x6735('0x1e')],{'as':'VoiceMail','onDelete':_0x6735('0x10a'),'foreignKey':'UserId'});db['User'][_0x6735('0x109')](db[_0x6735('0x106')],{'as':_0x6735('0x10b'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x10c')});db['User'][_0x6735('0x10d')](db[_0x6735('0x1c')],{'as':_0x6735('0x10e'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0x10f')],{'as':_0x6735('0x110'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0x19')],{'as':'Extensions','onDelete':_0x6735('0x10a'),'hooks':!![]});db[_0x6735('0x108')][_0x6735('0x10d')](db['CmHopperFinal'],{'as':_0x6735('0x111'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0x74')],{'as':_0x6735('0x112'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0x5b')],{'as':_0x6735('0x113'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')]['hasMany'](db['ChatInteraction'],{'as':_0x6735('0x114'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')]['hasMany'](db['SmsInteraction'],{'as':_0x6735('0x115'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')]['hasMany'](db[_0x6735('0x47')],{'as':_0x6735('0x116'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0x3d')],{'as':_0x6735('0x117'),'foreignKey':'UserId'});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0xf9')],{'as':_0x6735('0x118'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x108')][_0x6735('0x10d')](db[_0x6735('0xf5')],{'as':_0x6735('0x119'),'foreignKey':'SenderId'});db[_0x6735('0x108')][_0x6735('0x11a')](db[_0x6735('0xf1')],{'as':_0x6735('0xf1'),'foreignKey':_0x6735('0x11b')});db[_0x6735('0x108')]['belongsToMany'](db[_0x6735('0x6b')],{'as':_0x6735('0x11c'),'through':'chat_group_has_users'});db[_0x6735('0x108')]['belongsToMany'](db['CmContact'],{'as':'Contacts','through':_0x6735('0x11d')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0xed')],{'as':_0x6735('0x11f'),'through':_0x6735('0x120')});db[_0x6735('0x108')][_0x6735('0x11e')](db['Team'],{'through':_0x6735('0x121')});db['User'][_0x6735('0x11e')](db[_0x6735('0x3d')],{'as':'MailInteractions','through':_0x6735('0x122')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0x65')],{'as':'ChatInteractions','through':_0x6735('0x123')});db[_0x6735('0x108')][_0x6735('0x11e')](db['FaxInteraction'],{'as':_0x6735('0x116'),'through':_0x6735('0x124')});db[_0x6735('0x108')]['belongsToMany'](db[_0x6735('0x53')],{'as':_0x6735('0x115'),'through':_0x6735('0x125')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0x5b')],{'as':'OpenchannelInteractions','through':_0x6735('0x126')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0xf9')],{'as':_0x6735('0x118'),'through':_0x6735('0x127')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0x128')],{'as':_0x6735('0x129'),'through':_0x6735('0x2d'),'required':![]});db['User'][_0x6735('0x11e')](db[_0x6735('0xef')],{'as':_0x6735('0x12a'),'through':_0x6735('0x104'),'required':![]});db[_0x6735('0x108')]['belongsToMany'](db[_0x6735('0x12b')],{'as':_0x6735('0x12c'),'through':_0x6735('0x31'),'required':![]});db[_0x6735('0x108')]['belongsToMany'](db[_0x6735('0x69')],{'as':_0x6735('0x12d'),'through':_0x6735('0x2f'),'required':![],'hooks':!![]});db[_0x6735('0x108')][_0x6735('0x11e')](db['FaxQueue'],{'as':'FaxQueues','through':_0x6735('0x33'),'required':![]});db[_0x6735('0x108')][_0x6735('0x11e')](db['SmsQueue'],{'as':'SmsQueues','through':_0x6735('0x12e'),'required':![]});db[_0x6735('0x108')]['belongsToMany'](db[_0x6735('0x12f')],{'as':_0x6735('0x130'),'through':_0x6735('0x131'),'required':![]});db['User']['belongsToMany'](db['WhatsappQueue'],{'as':_0x6735('0x132'),'through':_0x6735('0x36'),'required':![]});db[_0x6735('0x108')][_0x6735('0x11e')](db['CmList'],{'through':_0x6735('0x120')});db['User']['belongsToMany'](db[_0x6735('0x60')],{'as':_0x6735('0x133'),'through':'user_has_chat_websites'});db['User'][_0x6735('0x11e')](db[_0x6735('0x134')],{'as':_0x6735('0x135'),'through':_0x6735('0x136')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0x3a')],{'as':_0x6735('0x137'),'through':_0x6735('0x138')});db[_0x6735('0x108')][_0x6735('0x11e')](db[_0x6735('0x139')],{'as':'OpenchannelAccounts','through':_0x6735('0x13a')});db[_0x6735('0x108')]['belongsToMany'](db[_0x6735('0x4f')],{'as':_0x6735('0x13b'),'through':'user_has_sms_accounts'});db[_0x6735('0x108')][_0x6735('0x11e')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x6735('0x13c')});db['User']['belongsToMany'](db[_0x6735('0x13d')],{'as':_0x6735('0x13e'),'through':_0x6735('0x13f')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':_0x6735('0x140'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x141')});db['VoiceContext']['hasMany'](db[_0x6735('0x19')],{'onDelete':_0x6735('0x10a')});db['VoiceExtension']['hasMany'](db[_0x6735('0x19')],{'as':_0x6735('0x142'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x143')]['belongsToMany'](db[_0x6735('0x144')],{'as':_0x6735('0x145'),'through':_0x6735('0x146')});db['VoiceQueue']['hasMany'](db[_0x6735('0x10f')],{'as':'Members','foreignKey':_0x6735('0x147')});db['VoiceQueue'][_0x6735('0x10d')](db[_0x6735('0x148')],{'as':_0x6735('0x149'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x6735('0x14a')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x6735('0x10d')](db[_0x6735('0x74')],{'as':'HopperHistories','foreignKey':_0x6735('0x147')});db[_0x6735('0x128')][_0x6735('0x10d')](db[_0x6735('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x6735('0x147')});db[_0x6735('0x128')][_0x6735('0x10d')](db[_0x6735('0x71')],{'as':_0x6735('0x14b'),'foreignKey':_0x6735('0x147')});db[_0x6735('0x128')]['hasMany'](db['JscriptySessionReport'],{'as':_0x6735('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x6735('0x128')][_0x6735('0x11a')](db[_0x6735('0x14d')],{'as':_0x6735('0x14d'),'foreignKey':_0x6735('0x14e')});db[_0x6735('0x128')][_0x6735('0x11a')](db['Trunk'],{'as':_0x6735('0x14f'),'foreignKey':'TrunkBackupId'});db[_0x6735('0x128')][_0x6735('0x11a')](db['Interval'],{'as':_0x6735('0x7d'),'foreignKey':'IntervalId'});db[_0x6735('0x128')]['belongsTo'](db[_0x6735('0x150')],{'as':_0x6735('0x151'),'foreignKey':_0x6735('0x152')});db[_0x6735('0x128')][_0x6735('0x11e')](db['CmList'],{'as':_0x6735('0x11f'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x2d')});db['VoiceQueue'][_0x6735('0x11e')](db[_0x6735('0xdd')],{'as':_0x6735('0x154'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x6735('0x11e')](db[_0x6735('0xed')],{'as':_0x6735('0x155'),'through':_0x6735('0x156')});db['VoiceRecording']['belongsTo'](db[_0x6735('0x108')],{'as':'User','foreignKey':_0x6735('0x10c')});db[_0x6735('0x157')][_0x6735('0x11a')](db['User'],{'as':_0x6735('0x108'),'foreignKey':'UserId'});db[_0x6735('0x1e')][_0x6735('0x10d')](db[_0x6735('0x1f')],{'as':_0x6735('0x158'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x159'),'sourceKey':_0x6735('0x15a')});db[_0x6735('0x1f')]['belongsTo'](db[_0x6735('0x1e')],{'foreignKey':_0x6735('0x159'),'targetKey':_0x6735('0x15a')});db[_0x6735('0x15b')][_0x6735('0x10d')](db[_0x6735('0x26')],{'as':'QueueCalls','foreignKey':_0x6735('0x15c'),'constraints':![]});db[_0x6735('0x15b')][_0x6735('0x10d')](db[_0x6735('0x24')],{'as':_0x6735('0x15d'),'foreignKey':_0x6735('0x15c'),'constraints':![]});db[_0x6735('0x15b')]['belongsTo'](db['User'],{'as':_0x6735('0x108'),'foreignKey':'UserId'});db[_0x6735('0x15b')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0x160')][_0x6735('0x11a')](db[_0x6735('0x3a')],{'as':_0x6735('0x3a'),'foreignKey':_0x6735('0x161')});db[_0x6735('0x160')][_0x6735('0x11a')](db[_0x6735('0x100')],{'as':_0x6735('0x100'),'foreignKey':_0x6735('0x162'),'onDelete':_0x6735('0x163')});db[_0x6735('0x38')][_0x6735('0x11a')](db[_0x6735('0x3a')],{'as':_0x6735('0x3a'),'foreignKey':_0x6735('0x161')});db[_0x6735('0x38')][_0x6735('0x11a')](db['CloudProvider'],{'as':_0x6735('0x100'),'foreignKey':_0x6735('0x162'),'onDelete':_0x6735('0x163')});db[_0x6735('0x3a')][_0x6735('0x109')](db[_0x6735('0x160')],{'as':_0x6735('0x164'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x3a')][_0x6735('0x109')](db['MailServerOut'],{'as':_0x6735('0x165'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x3a')][_0x6735('0x10d')](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':'MailAccountId','onDelete':_0x6735('0x10a')});db[_0x6735('0x3a')][_0x6735('0x10d')](db[_0x6735('0x168')],{'as':_0x6735('0x169'),'foreignKey':_0x6735('0x161')});db[_0x6735('0x3a')][_0x6735('0x10d')](db['MailMessage'],{'as':_0x6735('0x158'),'foreignKey':'MailAccountId'});db[_0x6735('0x3a')]['hasMany'](db[_0x6735('0x3d')],{'as':'Interactions'});db['MailAccount'][_0x6735('0x10d')](db[_0x6735('0x3f')],{'as':'Applications'});db['MailAccount'][_0x6735('0x11a')](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0x3a')][_0x6735('0x11a')](db[_0x6735('0x16c')],{'as':'Template','foreignKey':'TemplateId'});db[_0x6735('0x3a')][_0x6735('0x11a')](db[_0x6735('0x150')],{'as':_0x6735('0x151'),'foreignKey':_0x6735('0x152')});db[_0x6735('0x3a')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x138')});db[_0x6735('0x12b')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x31')});db[_0x6735('0x12b')][_0x6735('0x11e')](db['Team'],{'through':_0x6735('0x16d'),'as':_0x6735('0x154')});db[_0x6735('0x3d')][_0x6735('0x10d')](db[_0x6735('0x3e')],{'as':_0x6735('0x158'),'onDelete':_0x6735('0x10a'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x6735('0x11a')](db[_0x6735('0x3a')],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x161')});db[_0x6735('0x3d')]['belongsTo'](db[_0x6735('0x6e')],{'as':'Contact','foreignKey':_0x6735('0x15f')});db[_0x6735('0x3d')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x6735('0x85')],{'through':'mail_interaction_has_tags','as':_0x6735('0x16f')});db[_0x6735('0x3d')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':'mail_interaction_has_tags','as':_0x6735('0x170')});db[_0x6735('0x3d')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':'user_has_mail_interactions','foreignKey':_0x6735('0x172')});db[_0x6735('0x3e')][_0x6735('0x10d')](db['Attachment'],{'as':'Attachments','onDelete':_0x6735('0x10a')});db[_0x6735('0x3e')][_0x6735('0x11a')](db['User'],{'as':'User'});db[_0x6735('0x3e')][_0x6735('0x11a')](db['CmContact'],{'onDelete':'cascade','as':_0x6735('0x15e')});db[_0x6735('0x3e')]['belongsTo'](db[_0x6735('0x3d')],{'as':_0x6735('0x173'),'foreignKey':_0x6735('0x172')});db[_0x6735('0x3e')][_0x6735('0x11a')](db[_0x6735('0x3a')],{'as':_0x6735('0x16e'),'foreignKey':'MailAccountId'});db[_0x6735('0x3e')]['belongsTo'](db[_0x6735('0x60')],{'as':'ChatWebsite','foreignKey':_0x6735('0x174')});db['MailMessage']['belongsTo'](db[_0x6735('0x67')],{'as':_0x6735('0x67'),'foreignKey':_0x6735('0x175')});db[_0x6735('0x3f')][_0x6735('0x11a')](db['User'],{'onDelete':_0x6735('0x163')});db[_0x6735('0x3f')][_0x6735('0x11a')](db[_0x6735('0x12b')],{'onDelete':_0x6735('0x163')});db[_0x6735('0x3f')][_0x6735('0x11a')](db[_0x6735('0x3a')],{'onDelete':_0x6735('0x163')});db[_0x6735('0x3f')][_0x6735('0x11a')](db[_0x6735('0x7d')],{'onDelete':'restrict','foreignKey':_0x6735('0x176')});db[_0x6735('0x3f')][_0x6735('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db[_0x6735('0x3a')],{});db['MailQueueReport'][_0x6735('0x11a')](db[_0x6735('0xed')],{'as':'List','foreignKey':_0x6735('0x16b')});db['MailQueueReport']['belongsTo'](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x6735('0x11a')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x6735('0x3e')],{});db[_0x6735('0x41')][_0x6735('0x11a')](db[_0x6735('0x108')],{});db[_0x6735('0x41')]['belongsTo'](db[_0x6735('0x12b')],{});db['Dashboard'][_0x6735('0x10d')](db[_0x6735('0x44')],{'as':'Items','onDelete':_0x6735('0x10a')});db[_0x6735('0x134')]['hasMany'](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':_0x6735('0x177'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x134')][_0x6735('0x10d')](db[_0x6735('0x168')],{'as':'Answers','foreignKey':_0x6735('0x177')});db[_0x6735('0x134')][_0x6735('0x10d')](db['FaxInteraction'],{'as':'Interactions'});db[_0x6735('0x134')]['hasMany'](db['FaxApplication'],{'as':_0x6735('0x142')});db[_0x6735('0x134')][_0x6735('0x10d')](db['VoiceExtension'],{'as':_0x6735('0x178'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x134')][_0x6735('0x10d')](db[_0x6735('0x49')],{'as':_0x6735('0x158')});db[_0x6735('0x134')][_0x6735('0x11a')](db[_0x6735('0x14d')],{'as':_0x6735('0x14d')});db[_0x6735('0x134')][_0x6735('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6735('0x16b')});db[_0x6735('0x134')][_0x6735('0x11a')](db[_0x6735('0x150')],{'as':_0x6735('0x151'),'foreignKey':_0x6735('0x152')});db[_0x6735('0x134')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':'user_has_fax_accounts'});db[_0x6735('0x179')][_0x6735('0x11a')](db['User'],{'onDelete':_0x6735('0x163')});db[_0x6735('0x179')][_0x6735('0x11a')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x6735('0x179')][_0x6735('0x11a')](db[_0x6735('0x134')],{'onDelete':_0x6735('0x163')});db['FaxApplication']['belongsTo'](db[_0x6735('0x85')],{'onDelete':_0x6735('0x163'),'foreignKey':'TagId'});db[_0x6735('0x47')][_0x6735('0x10d')](db[_0x6735('0x49')],{'as':_0x6735('0x158'),'onDelete':'cascade','foreignKey':_0x6735('0x17a')});db[_0x6735('0x47')][_0x6735('0x11a')](db[_0x6735('0x134')],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x177')});db[_0x6735('0x47')][_0x6735('0x11a')](db['CmContact'],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0x47')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x17b'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x47')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x17c'),'as':_0x6735('0x16f')});db[_0x6735('0x47')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':'fax_interaction_has_tags','as':_0x6735('0x170')});db[_0x6735('0x47')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':_0x6735('0x124'),'foreignKey':'FaxInteractionId'});db[_0x6735('0x49')][_0x6735('0x11a')](db[_0x6735('0x108')],{'onDelete':'cascade','as':'User'});db[_0x6735('0x49')][_0x6735('0x11a')](db[_0x6735('0x47')],{'as':_0x6735('0x173'),'foreignKey':_0x6735('0x17a')});db[_0x6735('0x49')]['belongsTo'](db['CmContact'],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x15e')});db[_0x6735('0x49')][_0x6735('0x11a')](db[_0x6735('0x17d')],{'as':_0x6735('0x17d'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x6735('0x11a')](db['FaxAccount'],{'as':'Account','foreignKey':_0x6735('0x177')});db[_0x6735('0x4b')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x33')});db['FaxQueue'][_0x6735('0x11e')](db[_0x6735('0xdd')],{'through':_0x6735('0x17e'),'as':_0x6735('0x154')});db[_0x6735('0x4d')]['belongsTo'](db[_0x6735('0x134')],{});db[_0x6735('0x4d')][_0x6735('0x11a')](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0x4d')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':'ContactId'});db[_0x6735('0x4d')][_0x6735('0x11a')](db[_0x6735('0x47')],{});db[_0x6735('0x4d')][_0x6735('0x11a')](db[_0x6735('0x49')],{});db[_0x6735('0x4d')][_0x6735('0x11a')](db[_0x6735('0x108')],{});db[_0x6735('0x4d')][_0x6735('0x11a')](db[_0x6735('0x4b')],{});db[_0x6735('0x4f')]['hasMany'](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':_0x6735('0x17f'),'onDelete':_0x6735('0x10a')});db['SmsAccount'][_0x6735('0x10d')](db[_0x6735('0x168')],{'as':_0x6735('0x169'),'foreignKey':_0x6735('0x17f')});db['SmsAccount']['hasMany'](db[_0x6735('0x55')],{'as':'Messages','foreignKey':_0x6735('0x17f')});db[_0x6735('0x4f')][_0x6735('0x10d')](db[_0x6735('0x53')],{'as':'Interactions'});db[_0x6735('0x4f')]['hasMany'](db['SmsApplication'],{'as':_0x6735('0x142')});db['SmsAccount'][_0x6735('0x11a')](db[_0x6735('0xed')],{'as':'List','foreignKey':'ListId'});db[_0x6735('0x4f')][_0x6735('0x11a')](db[_0x6735('0x150')],{'as':_0x6735('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6735('0x4f')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':'user_has_sms_accounts'});db[_0x6735('0x51')][_0x6735('0x11a')](db[_0x6735('0x108')],{'onDelete':_0x6735('0x163')});db[_0x6735('0x51')][_0x6735('0x11a')](db[_0x6735('0x57')],{'onDelete':'restrict'});db['SmsApplication'][_0x6735('0x11a')](db[_0x6735('0x4f')],{'onDelete':_0x6735('0x163')});db[_0x6735('0x51')][_0x6735('0x11a')](db[_0x6735('0x7d')],{'onDelete':'restrict','foreignKey':_0x6735('0x176')});db[_0x6735('0x51')][_0x6735('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6735('0x180')});db[_0x6735('0x53')][_0x6735('0x10d')](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x6735('0x181')});db['SmsInteraction'][_0x6735('0x11a')](db[_0x6735('0x4f')],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x17f')});db[_0x6735('0x53')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'as':'Contact','foreignKey':_0x6735('0x15f')});db[_0x6735('0x53')]['belongsTo'](db[_0x6735('0x108')],{'as':_0x6735('0x17b'),'foreignKey':_0x6735('0x10c')});db['SmsInteraction'][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x182'),'as':'Tags'});db[_0x6735('0x53')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x182'),'as':_0x6735('0x170')});db[_0x6735('0x53')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':'user_has_sms_interactions','foreignKey':_0x6735('0x181')});db[_0x6735('0x55')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':'User'});db[_0x6735('0x55')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x15e')});db['SmsMessage'][_0x6735('0x11a')](db[_0x6735('0x53')],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x173'),'foreignKey':_0x6735('0x181')});db['SmsMessage'][_0x6735('0x11a')](db[_0x6735('0x4f')],{'as':'Account','foreignKey':_0x6735('0x17f')});db['SmsQueue'][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x12e'),'foreignKey':_0x6735('0x183')});db['SmsQueue'][_0x6735('0x11e')](db[_0x6735('0xdd')],{'through':'team_has_sms_queues','as':_0x6735('0x154')});db['OpenchannelAccount'][_0x6735('0x10d')](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':'OpenchannelAccountId','onDelete':_0x6735('0x10a')});db[_0x6735('0x139')][_0x6735('0x10d')](db['CannedAnswer'],{'as':_0x6735('0x169'),'foreignKey':_0x6735('0x184')});db[_0x6735('0x139')][_0x6735('0x10d')](db[_0x6735('0x5b')],{'as':_0x6735('0x185'),'foreignKey':_0x6735('0x184')});db[_0x6735('0x139')][_0x6735('0x10d')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x6735('0x184')});db[_0x6735('0x139')][_0x6735('0x10d')](db['OpenchannelApplication'],{'as':_0x6735('0x142'),'foreignKey':_0x6735('0x184')});db[_0x6735('0x139')]['belongsTo'](db['CmList'],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b')});db['OpenchannelAccount'][_0x6735('0x11a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6735('0x139')][_0x6735('0x11e')](db['User'],{'as':_0x6735('0x153'),'through':_0x6735('0x13a')});db[_0x6735('0x186')]['belongsTo'](db[_0x6735('0x108')],{'onDelete':_0x6735('0x163')});db[_0x6735('0x186')][_0x6735('0x11a')](db[_0x6735('0x12f')],{'onDelete':_0x6735('0x163'),'foreignKey':_0x6735('0x187')});db[_0x6735('0x186')][_0x6735('0x11a')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x6735('0x184')});db['OpenchannelApplication'][_0x6735('0x11a')](db[_0x6735('0x7d')],{'onDelete':_0x6735('0x163'),'foreignKey':_0x6735('0x176')});db[_0x6735('0x186')][_0x6735('0x11a')](db[_0x6735('0x85')],{'onDelete':'restrict','foreignKey':_0x6735('0x180')});db[_0x6735('0x5b')][_0x6735('0x10d')](db[_0x6735('0x5d')],{'as':_0x6735('0x158'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x188')});db[_0x6735('0x5b')][_0x6735('0x11a')](db[_0x6735('0x139')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x6735('0x5b')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x17b'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x5b')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x189'),'as':_0x6735('0x16f')});db[_0x6735('0x5b')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x189'),'as':_0x6735('0x170')});db[_0x6735('0x5b')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':_0x6735('0x126'),'foreignKey':'OpenchannelInteractionId'});db[_0x6735('0x5d')][_0x6735('0x11a')](db[_0x6735('0x108')],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x108')});db[_0x6735('0x5d')]['belongsTo'](db[_0x6735('0x6e')],{'onDelete':_0x6735('0x10a'),'as':'Contact'});db[_0x6735('0x5d')][_0x6735('0x11a')](db[_0x6735('0x5b')],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x173'),'foreignKey':_0x6735('0x188')});db['OpenchannelMessage'][_0x6735('0x11a')](db[_0x6735('0x17d')],{'as':'Attachment','foreignKey':_0x6735('0x18a')});db[_0x6735('0x5d')][_0x6735('0x11a')](db[_0x6735('0x139')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x6735('0x12f')][_0x6735('0x11e')](db[_0x6735('0xdd')],{'through':_0x6735('0x18b'),'as':'Teams'});db['ChatWebsite']['hasMany'](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':'ChatWebsiteId','onDelete':_0x6735('0x10a')});db[_0x6735('0x60')][_0x6735('0x10d')](db[_0x6735('0x168')],{'as':_0x6735('0x169'),'foreignKey':_0x6735('0x174')});db['ChatWebsite'][_0x6735('0x10d')](db[_0x6735('0x18c')],{'as':'ProactiveActions'});db[_0x6735('0x60')][_0x6735('0x10d')](db[_0x6735('0x65')],{'as':'Interactions'});db[_0x6735('0x60')][_0x6735('0x10d')](db[_0x6735('0x18d')],{'as':'Applications'});db[_0x6735('0x60')][_0x6735('0x10d')](db['ChatMessage'],{'as':_0x6735('0x158')});db[_0x6735('0x60')][_0x6735('0x11a')](db['CmList'],{'as':_0x6735('0x16a'),'foreignKey':'ListId'});db['ChatWebsite'][_0x6735('0x11a')](db[_0x6735('0x7d')],{'as':_0x6735('0x7d'),'foreignKey':_0x6735('0x176')});db[_0x6735('0x60')]['belongsTo'](db[_0x6735('0x3a')],{'as':'MailAccount','foreignKey':_0x6735('0x161')});db['ChatWebsite'][_0x6735('0x11a')](db[_0x6735('0x150')],{'as':_0x6735('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6735('0x60')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x18e')});db['OpenchannelQueueReport']['belongsTo'](db[_0x6735('0x139')],{});db[_0x6735('0x62')][_0x6735('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6735('0x16b')});db['OpenchannelQueueReport'][_0x6735('0x11a')](db['CmContact'],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0x62')][_0x6735('0x11a')](db[_0x6735('0x5b')],{});db['OpenchannelQueueReport'][_0x6735('0x11a')](db[_0x6735('0x5d')],{});db['OpenchannelQueueReport'][_0x6735('0x11a')](db[_0x6735('0x108')],{});db[_0x6735('0x62')][_0x6735('0x11a')](db[_0x6735('0x12f')],{});db[_0x6735('0x18d')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x18f'),'foreignKey':_0x6735('0x10c'),'onDelete':_0x6735('0x163')});db[_0x6735('0x18d')]['belongsTo'](db['ChatQueue'],{'as':_0x6735('0x190'),'foreignKey':_0x6735('0x191'),'onDelete':_0x6735('0x163')});db[_0x6735('0x18d')]['belongsTo'](db[_0x6735('0x60')],{'as':_0x6735('0x192'),'foreignKey':_0x6735('0x174'),'onDelete':_0x6735('0x163')});db[_0x6735('0x18d')][_0x6735('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6735('0x180')});db['ChatInteraction'][_0x6735('0x10d')](db[_0x6735('0x193')],{'as':_0x6735('0x158'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x6735('0x65')][_0x6735('0x11a')](db[_0x6735('0x60')],{'as':'Account','foreignKey':_0x6735('0x174')});db[_0x6735('0x65')]['belongsTo'](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':'ContactId'});db[_0x6735('0x65')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x17b'),'foreignKey':'UserId'});db['ChatInteraction'][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':'chat_interaction_has_tags','as':_0x6735('0x16f')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x6735('0x194'),'as':_0x6735('0x170')});db['ChatInteraction'][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':_0x6735('0x123'),'foreignKey':_0x6735('0x195')});db[_0x6735('0x193')][_0x6735('0x11a')](db[_0x6735('0x108')],{'onDelete':'cascade','as':'User'});db[_0x6735('0x193')]['belongsTo'](db['CmContact'],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db['ChatMessage'][_0x6735('0x11a')](db[_0x6735('0x65')],{'onDelete':'cascade','as':_0x6735('0x173'),'foreignKey':_0x6735('0x195')});db['ChatMessage'][_0x6735('0x11a')](db['Attachment'],{'as':_0x6735('0x17d'),'foreignKey':_0x6735('0x18a')});db[_0x6735('0x193')][_0x6735('0x11a')](db[_0x6735('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x6735('0x67')][_0x6735('0x10d')](db[_0x6735('0x17d')],{'as':_0x6735('0x196'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x6735('0x10a'),'hooks':!![]});db[_0x6735('0x67')][_0x6735('0x11a')](db['CmContact'],{'onDelete':'cascade','as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0x67')][_0x6735('0x11a')](db['ChatWebsite'],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x174')});db[_0x6735('0x69')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':'UserChatQueue','hooks':!![]});db[_0x6735('0x69')][_0x6735('0x11e')](db[_0x6735('0xdd')],{'through':_0x6735('0x197'),'as':_0x6735('0x154')});db[_0x6735('0x6b')][_0x6735('0x10d')](db[_0x6735('0xcb')],{'as':'Messages','foreignKey':_0x6735('0x198'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x6b')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x199'),'through':_0x6735('0x19a')});db[_0x6735('0x18c')][_0x6735('0x11a')](db[_0x6735('0x60')],{'as':_0x6735('0x192'),'foreignKey':_0x6735('0x174')});db[_0x6735('0x6c')][_0x6735('0x10d')](db[_0x6735('0x6e')],{'as':'Contacts','foreignKey':_0x6735('0x19b')});db[_0x6735('0x6e')]['hasMany'](db[_0x6735('0x148')],{'as':'Hoppers','foreignKey':_0x6735('0x15f')});db['CmContact'][_0x6735('0x10d')](db[_0x6735('0x14a')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x6735('0x6e')][_0x6735('0x10d')](db['CmHopperHistory'],{'as':_0x6735('0x19c'),'foreignKey':_0x6735('0x15f')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0x6735('0x76'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0x6e')][_0x6735('0x10d')](db[_0x6735('0x19d')],{'as':'JscriptySessions','foreignKey':_0x6735('0x15f')});db[_0x6735('0x6e')][_0x6735('0x10d')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x6735('0x163')});db[_0x6735('0x6e')][_0x6735('0x10d')](db[_0x6735('0x65')],{'as':'ChatInteractions','foreignKey':_0x6735('0x15f'),'onDelete':_0x6735('0x163')});db[_0x6735('0x6e')][_0x6735('0x10d')](db['SmsInteraction'],{'as':_0x6735('0x115'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x6735('0x10d')](db[_0x6735('0x47')],{'as':_0x6735('0x116'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x6735('0x10d')](db['MailInteraction'],{'as':_0x6735('0x117'),'foreignKey':_0x6735('0x15f'),'onDelete':_0x6735('0x163')});db[_0x6735('0x6e')][_0x6735('0x11a')](db['CmCompany'],{'as':_0x6735('0x19e'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db['CmList'],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b'),'onDelete':'cascade'});db[_0x6735('0x6e')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':_0x6735('0x11d')});db['CmContact'][_0x6735('0x11e')](db[_0x6735('0x85')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x6735('0x6e')]['belongsToMany'](db[_0x6735('0x85')],{'through':_0x6735('0x19f'),'as':_0x6735('0x170')});db[_0x6735('0x148')]['belongsTo'](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f'),'onDelete':'cascade'});db[_0x6735('0x148')][_0x6735('0x11a')](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b'),'onDelete':'cascade'});db[_0x6735('0x148')][_0x6735('0x11a')](db['User'],{'as':_0x6735('0x18f'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0x148')][_0x6735('0x11a')](db['VoiceQueue'],{'as':_0x6735('0x190'),'foreignKey':_0x6735('0x147'),'onDelete':'cascade'});db[_0x6735('0x148')][_0x6735('0x11a')](db[_0x6735('0xe0')],{'as':_0x6735('0xe0'),'foreignKey':_0x6735('0x1a0'),'onDelete':'cascade'});db['CmHopper'][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':'Owner','foreignKey':'OwnerId'});db[_0x6735('0x71')][_0x6735('0x11a')](db['CmContact'],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x71')][_0x6735('0x11a')](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x71')][_0x6735('0x11a')](db[_0x6735('0x128')],{'as':_0x6735('0x190'),'foreignKey':_0x6735('0x147'),'onDelete':'cascade'});db[_0x6735('0x71')][_0x6735('0x11a')](db[_0x6735('0xe0')],{'as':_0x6735('0xe0'),'foreignKey':'CampaignId','onDelete':_0x6735('0x10a')});db[_0x6735('0x7b')][_0x6735('0x10d')](db[_0x6735('0x7c')],{'as':{'plural':_0x6735('0x1a1'),'singular':_0x6735('0x1a2')},'foreignKey':_0x6735('0x1a3'),'onDelete':_0x6735('0x10a'),'hooks':!![]});db[_0x6735('0x7b')][_0x6735('0x10d')](db['Condition'],{'as':{'plural':_0x6735('0x1a4'),'singular':_0x6735('0x1a5')},'foreignKey':_0x6735('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0x6735('0x7b')][_0x6735('0x10d')](db['Action'],{'as':'Actions','foreignKey':_0x6735('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x6735('0x166')]['hasMany'](db['Disposition'],{'as':_0x6735('0x167'),'foreignKey':'ParentId','onDelete':_0x6735('0x10a')});db[_0x6735('0x7d')]['hasMany'](db[_0x6735('0x7d')],{'as':'Intervals','foreignKey':_0x6735('0x176'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x6735('0x7d')][_0x6735('0x10d')](db[_0x6735('0x19')],{'as':_0x6735('0x1a8'),'foreignKey':'IntervalId','onDelete':_0x6735('0x163')});db[_0x6735('0x7d')]['hasMany'](db[_0x6735('0x3f')],{'as':_0x6735('0x1a9'),'foreignKey':_0x6735('0x176')});db[_0x6735('0x7d')][_0x6735('0x10d')](db[_0x6735('0x18d')],{'as':_0x6735('0x1aa'),'foreignKey':_0x6735('0x176')});db[_0x6735('0x7d')][_0x6735('0x10d')](db[_0x6735('0x179')],{'as':_0x6735('0x1ab'),'foreignKey':_0x6735('0x176')});db[_0x6735('0x7d')][_0x6735('0x10d')](db[_0x6735('0x51')],{'as':'SmsApplications','foreignKey':_0x6735('0x176')});db[_0x6735('0x82')][_0x6735('0x11a')](db[_0x6735('0x3a')],{});db['Schedule']['belongsTo'](db[_0x6735('0x1ac')],{'foreignKey':_0x6735('0x1ad')});db[_0x6735('0x82')][_0x6735('0x11a')](db['AnalyticCustomReport'],{'foreignKey':_0x6735('0x1ae')});db['Sound'][_0x6735('0x11e')](db[_0x6735('0x143')],{'as':_0x6735('0x1af'),'through':'moh_has_sounds','onDelete':_0x6735('0x163')});db[_0x6735('0x85')][_0x6735('0x11e')](db[_0x6735('0x6e')],{'through':'cm_contact_has_tags'});db[_0x6735('0x85')][_0x6735('0x11e')](db['ChatInteraction'],{'through':_0x6735('0x194')});db[_0x6735('0x85')][_0x6735('0x11e')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0x6735('0x11e')](db[_0x6735('0x53')],{'through':_0x6735('0x182')});db[_0x6735('0x85')][_0x6735('0x11e')](db[_0x6735('0x47')],{'through':_0x6735('0x17c')});db['Tag'][_0x6735('0x11e')](db[_0x6735('0x5b')],{'through':_0x6735('0x189')});db[_0x6735('0x85')][_0x6735('0x11e')](db[_0x6735('0xf9')],{'through':_0x6735('0x1b0')});db['Trigger']['hasMany'](db[_0x6735('0x7c')],{'as':{'plural':_0x6735('0x1b1'),'singular':_0x6735('0x1b2')},'foreignKey':_0x6735('0x1b3'),'onDelete':_0x6735('0x10a'),'hooks':!![]});db[_0x6735('0x88')][_0x6735('0x10d')](db['Condition'],{'as':{'plural':_0x6735('0x1b4'),'singular':_0x6735('0x1b5')},'foreignKey':_0x6735('0x1b6'),'onDelete':_0x6735('0x10a'),'hooks':!![]});db[_0x6735('0x88')][_0x6735('0x10d')](db[_0x6735('0x79')],{'as':'Actions','foreignKey':_0x6735('0x1b7'),'onDelete':_0x6735('0x10a'),'hooks':!![]});db[_0x6735('0x90')][_0x6735('0x10d')](db[_0x6735('0x96')],{'as':_0x6735('0x1b8'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ae'),'hooks':!![]});db[_0x6735('0x1ac')][_0x6735('0x10d')](db[_0x6735('0x96')],{'as':_0x6735('0x1b8'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ad')});db[_0x6735('0x95')][_0x6735('0x10d')](db['AnalyticFieldReport'],{'as':_0x6735('0x1b8'),'onDelete':_0x6735('0x10a'),'foreignKey':'MetricId'});db[_0x6735('0x96')]['belongsTo'](db[_0x6735('0x95')],{'foreignKey':_0x6735('0x1b9')});db[_0x6735('0x9a')][_0x6735('0x10d')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ba')});db[_0x6735('0x9c')][_0x6735('0x10d')](db[_0x6735('0x9e')],{'as':_0x6735('0x1bb'),'onDelete':_0x6735('0x10a'),'foreignKey':'SubjectId'});db[_0x6735('0x9c')]['hasMany'](db[_0x6735('0x9e')],{'as':_0x6735('0x1bc'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration']['hasMany'](db[_0x6735('0x9e')],{'as':_0x6735('0x1b8'),'onDelete':_0x6735('0x10a'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x6735('0x11a')](db[_0x6735('0x9a')],{'as':'Account','foreignKey':'AccountId'});db[_0x6735('0x9e')][_0x6735('0x10d')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x6735('0x1bd')});db[_0x6735('0x9e')][_0x6735('0x10d')](db[_0x6735('0x9e')],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0x9e')][_0x6735('0x10d')](db[_0x6735('0x9e')],{'as':_0x6735('0x1c0'),'foreignKey':'FieldId'});db[_0x6735('0x9e')][_0x6735('0x11a')](db['Variable'],{'as':_0x6735('0x8a'),'foreignKey':_0x6735('0x1c1')});db[_0x6735('0x9f')][_0x6735('0x10d')](db['SugarcrmConfiguration'],{'as':_0x6735('0x1c2'),'onDelete':'cascade','foreignKey':_0x6735('0x1ba')});db[_0x6735('0xa1')][_0x6735('0x10d')](db[_0x6735('0xa3')],{'as':_0x6735('0x1bb'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xa1')][_0x6735('0x10d')](db['SugarcrmField'],{'as':_0x6735('0x1bc'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xa1')]['hasMany'](db[_0x6735('0xa3')],{'as':'Fields','onDelete':_0x6735('0x10a'),'foreignKey':'FieldId'});db[_0x6735('0xa1')]['belongsTo'](db[_0x6735('0x9f')],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x1ba')});db['SugarcrmField'][_0x6735('0x10d')](db[_0x6735('0xa3')],{'as':'Subject','foreignKey':_0x6735('0x1bd')});db[_0x6735('0xa3')]['hasMany'](db[_0x6735('0xa3')],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xa3')][_0x6735('0x10d')](db[_0x6735('0xa3')],{'as':'Field','foreignKey':_0x6735('0x1c3')});db[_0x6735('0xa3')]['belongsTo'](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':'VariableId'});db[_0x6735('0x1c4')][_0x6735('0x10d')](db[_0x6735('0xa5')],{'as':_0x6735('0x1c2'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ba')});db[_0x6735('0xa5')][_0x6735('0x10d')](db[_0x6735('0xa7')],{'as':_0x6735('0x1bb'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1bd')});db['DeskConfiguration'][_0x6735('0x10d')](db['DeskField'],{'as':'Descriptions','onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1bf')});db['DeskConfiguration'][_0x6735('0x10d')](db[_0x6735('0xa7')],{'as':'Fields','onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xa5')][_0x6735('0x11a')](db[_0x6735('0x1c4')],{'as':_0x6735('0x16e'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x6735('0x11e')](db['Tag'],{'through':_0x6735('0x1c5')});db[_0x6735('0xa7')][_0x6735('0x10d')](db[_0x6735('0xa7')],{'as':_0x6735('0x1c6'),'foreignKey':'SubjectId'});db[_0x6735('0xa7')][_0x6735('0x10d')](db[_0x6735('0xa7')],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xa7')][_0x6735('0x10d')](db[_0x6735('0xa7')],{'as':_0x6735('0x1c0'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xa7')][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':_0x6735('0x1c1')});db[_0x6735('0xa9')]['hasMany'](db[_0x6735('0xaa')],{'as':_0x6735('0x1c2'),'onDelete':'cascade','foreignKey':_0x6735('0x1ba')});db[_0x6735('0xaa')][_0x6735('0x10d')](db[_0x6735('0xab')],{'as':_0x6735('0x1bb'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1bd')});db['ZohoConfiguration'][_0x6735('0x10d')](db[_0x6735('0xab')],{'as':_0x6735('0x1bc'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xaa')][_0x6735('0x10d')](db[_0x6735('0xab')],{'as':_0x6735('0x1b8'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xaa')]['belongsTo'](db[_0x6735('0xa9')],{'as':'Account','foreignKey':'AccountId'});db[_0x6735('0xab')]['hasMany'](db[_0x6735('0xab')],{'as':_0x6735('0x1c6'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xab')][_0x6735('0x10d')](db['ZohoField'],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db['ZohoField']['hasMany'](db[_0x6735('0xab')],{'as':_0x6735('0x1c0'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xab')][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':'Variable','foreignKey':_0x6735('0x1c1')});db['ZendeskAccount'][_0x6735('0x10d')](db[_0x6735('0xac')],{'as':_0x6735('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6735('0xac')][_0x6735('0x10d')](db[_0x6735('0xae')],{'as':_0x6735('0x1bb'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xac')][_0x6735('0x10d')](db[_0x6735('0xae')],{'as':'Descriptions','foreignKey':_0x6735('0x1bf')});db[_0x6735('0xac')][_0x6735('0x10d')](db[_0x6735('0xae')],{'as':_0x6735('0x1b8'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xac')]['belongsTo'](db[_0x6735('0x1c7')],{'as':_0x6735('0x16e'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db[_0x6735('0x85')],{'through':_0x6735('0x1c8')});db['ZendeskField'][_0x6735('0x10d')](db['ZendeskField'],{'as':_0x6735('0x1c6'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xae')]['hasMany'](db['ZendeskField'],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xae')][_0x6735('0x10d')](db[_0x6735('0xae')],{'as':_0x6735('0x1c0'),'foreignKey':_0x6735('0x1c3')});db['ZendeskField'][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':'VariableId'});db[_0x6735('0x1c9')][_0x6735('0x10d')](db[_0x6735('0xb1')],{'as':_0x6735('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6735('0xb1')][_0x6735('0x10d')](db[_0x6735('0xb2')],{'as':_0x6735('0x1bb'),'onDelete':_0x6735('0x10a'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x6735('0x10d')](db[_0x6735('0xb2')],{'as':_0x6735('0x1bc'),'onDelete':_0x6735('0x10a'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x6735('0x10d')](db[_0x6735('0xb2')],{'as':_0x6735('0x1b8'),'onDelete':'cascade','foreignKey':_0x6735('0x1c3')});db[_0x6735('0xb1')][_0x6735('0x11a')](db[_0x6735('0x1c9')],{'as':'Account','foreignKey':_0x6735('0x1ba')});db[_0x6735('0xb1')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x1ca')});db['FreshdeskField'][_0x6735('0x10d')](db['FreshdeskField'],{'as':_0x6735('0x1c6'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xb2')][_0x6735('0x10d')](db[_0x6735('0xb2')],{'as':'Description','foreignKey':_0x6735('0x1bf')});db[_0x6735('0xb2')][_0x6735('0x10d')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0x6735('0xb2')][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':_0x6735('0x1c1')});db[_0x6735('0xb4')][_0x6735('0x10d')](db[_0x6735('0xb6')],{'as':_0x6735('0x1c2'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ba')});db[_0x6735('0xb6')][_0x6735('0x10d')](db[_0x6735('0xb8')],{'as':_0x6735('0x1bb'),'foreignKey':_0x6735('0x1bd')});db['VtigerConfiguration'][_0x6735('0x10d')](db[_0x6735('0xb8')],{'as':_0x6735('0x1bc'),'foreignKey':_0x6735('0x1bf')});db['VtigerConfiguration']['hasMany'](db[_0x6735('0xb8')],{'as':'Fields','foreignKey':_0x6735('0x1c3')});db[_0x6735('0xb6')][_0x6735('0x11a')](db[_0x6735('0xb4')],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x1ba')});db[_0x6735('0xb8')][_0x6735('0x10d')](db[_0x6735('0xb8')],{'as':'Subject','foreignKey':_0x6735('0x1bd')});db[_0x6735('0xb8')][_0x6735('0x10d')](db[_0x6735('0xb8')],{'as':_0x6735('0x1be'),'foreignKey':'DescriptionId'});db[_0x6735('0xb8')][_0x6735('0x10d')](db['VtigerField'],{'as':_0x6735('0x1c0'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xb8')][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':_0x6735('0x1c1')});db[_0x6735('0x1cb')]['hasMany'](db[_0x6735('0xbb')],{'as':_0x6735('0x1c2'),'onDelete':_0x6735('0x10a'),'foreignKey':'AccountId'});db[_0x6735('0xbb')][_0x6735('0x10d')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x6735('0x1bd')});db['ServicenowConfiguration'][_0x6735('0x10d')](db[_0x6735('0xbd')],{'as':_0x6735('0x1bc'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xbb')][_0x6735('0x10d')](db['ServicenowField'],{'as':_0x6735('0x1b8'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xbb')][_0x6735('0x11a')](db[_0x6735('0x1cb')],{'as':_0x6735('0x16e'),'foreignKey':'AccountId'});db[_0x6735('0xbd')][_0x6735('0x10d')](db[_0x6735('0xbd')],{'as':_0x6735('0x1c6'),'foreignKey':'SubjectId'});db[_0x6735('0xbd')][_0x6735('0x10d')](db['ServicenowField'],{'as':_0x6735('0x1be'),'foreignKey':'DescriptionId'});db[_0x6735('0xbd')][_0x6735('0x10d')](db['ServicenowField'],{'as':'Field','foreignKey':'FieldId'});db['ServicenowField'][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6735('0x1cc')][_0x6735('0x10d')](db['Dynamics365Configuration'],{'as':_0x6735('0x1c2'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ba')});db[_0x6735('0x1cc')][_0x6735('0x11a')](db['CloudProvider'],{'as':_0x6735('0x100'),'foreignKey':_0x6735('0x162')});db[_0x6735('0xc0')][_0x6735('0x10d')](db[_0x6735('0xc2')],{'as':'Subjects','onDelete':_0x6735('0x10a'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0x6735('0xc2')],{'as':_0x6735('0x1bc'),'onDelete':_0x6735('0x10a'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x6735('0xc2')],{'as':_0x6735('0x1b8'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1c3')});db['Dynamics365Configuration'][_0x6735('0x11a')](db[_0x6735('0x1cc')],{'as':'Account','foreignKey':_0x6735('0x1ba')});db[_0x6735('0xc2')][_0x6735('0x10d')](db[_0x6735('0xc2')],{'as':_0x6735('0x1c6'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xc2')][_0x6735('0x10d')](db[_0x6735('0xc2')],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xc2')][_0x6735('0x10d')](db['Dynamics365Field'],{'as':_0x6735('0x1c0'),'foreignKey':'FieldId'});db[_0x6735('0xc2')][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':_0x6735('0x1c1')});db[_0x6735('0xc4')][_0x6735('0x10d')](db[_0x6735('0xc5')],{'as':_0x6735('0x1c2'),'onDelete':_0x6735('0x10a'),'foreignKey':'AccountId'});db[_0x6735('0xc5')]['hasMany'](db[_0x6735('0xc7')],{'as':'Subjects','foreignKey':_0x6735('0x1bd')});db[_0x6735('0xc5')][_0x6735('0x10d')](db[_0x6735('0xc7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6735('0xc5')][_0x6735('0x10d')](db[_0x6735('0xc7')],{'as':_0x6735('0x1b8'),'foreignKey':_0x6735('0x1c3')});db[_0x6735('0xc5')][_0x6735('0x11a')](db[_0x6735('0xc4')],{'as':'Account','foreignKey':'AccountId'});db[_0x6735('0xc7')]['hasMany'](db[_0x6735('0xc7')],{'as':_0x6735('0x1c6'),'foreignKey':_0x6735('0x1bd')});db[_0x6735('0xc7')]['hasMany'](db[_0x6735('0xc7')],{'as':_0x6735('0x1be'),'foreignKey':_0x6735('0x1bf')});db[_0x6735('0xc7')][_0x6735('0x10d')](db[_0x6735('0xc7')],{'as':_0x6735('0x1c0'),'foreignKey':'FieldId'});db[_0x6735('0xc7')][_0x6735('0x11a')](db[_0x6735('0x8a')],{'as':_0x6735('0x8a'),'foreignKey':'VariableId'});db[_0x6735('0x1cd')]['belongsTo'](db['ChatWebsite'],{});db[_0x6735('0x1cd')]['belongsTo'](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0x1cd')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0x1cd')][_0x6735('0x11a')](db['ChatInteraction'],{});db[_0x6735('0x1cd')][_0x6735('0x11a')](db['ChatMessage'],{});db[_0x6735('0x1cd')][_0x6735('0x11a')](db['User'],{});db[_0x6735('0x1cd')][_0x6735('0x11a')](db[_0x6735('0x69')],{});db['ChatInternalMessage'][_0x6735('0x11a')](db[_0x6735('0x108')],{'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1ce')});db[_0x6735('0xcb')][_0x6735('0x11a')](db['User'],{'onDelete':_0x6735('0x10a'),'foreignKey':'ToId'});db[_0x6735('0x19d')][_0x6735('0x10d')](db[_0x6735('0x1cf')],{'foreignKey':_0x6735('0x1d0'),'onDelete':_0x6735('0x10a')});db[_0x6735('0x19d')][_0x6735('0x10d')](db[_0x6735('0xcd')],{'foreignKey':_0x6735('0x1d0'),'onDelete':_0x6735('0x10a')});db['SmsQueueReport'][_0x6735('0x11a')](db[_0x6735('0x4f')],{});db[_0x6735('0x1d1')]['belongsTo'](db[_0x6735('0xed')],{'as':'List','foreignKey':_0x6735('0x16b')});db[_0x6735('0x1d1')][_0x6735('0x11a')](db['CmContact'],{'as':_0x6735('0x15e'),'foreignKey':'ContactId'});db[_0x6735('0x1d1')][_0x6735('0x11a')](db[_0x6735('0x53')],{});db[_0x6735('0x1d1')][_0x6735('0x11a')](db[_0x6735('0x55')],{});db[_0x6735('0x1d1')][_0x6735('0x11a')](db[_0x6735('0x108')],{});db['SmsQueueReport']['belongsTo'](db[_0x6735('0x57')],{});db[_0x6735('0x1d2')][_0x6735('0x10d')](db[_0x6735('0x19d')],{'foreignKey':'ProjectId'});db[_0x6735('0x1d2')][_0x6735('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0x6735('0x1d3')});db['JscriptyProject'][_0x6735('0x10d')](db[_0x6735('0xcd')],{'foreignKey':_0x6735('0x1d3')});db[_0x6735('0x13d')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':_0x6735('0x13f')});db[_0x6735('0xdd')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x121')});db['Team'][_0x6735('0x11e')](db[_0x6735('0x128')],{'through':'TeamVoiceQueue','as':_0x6735('0x129')});db[_0x6735('0xdd')][_0x6735('0x11e')](db[_0x6735('0x12b')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0x6735('0x11e')](db[_0x6735('0x69')],{'through':'team_has_chat_queues','as':_0x6735('0x12d')});db[_0x6735('0xdd')][_0x6735('0x11e')](db[_0x6735('0x4b')],{'through':'team_has_fax_queues','as':_0x6735('0x1d4')});db['Team'][_0x6735('0x11e')](db[_0x6735('0x57')],{'through':_0x6735('0x1d5'),'as':_0x6735('0x1d6')});db['Team']['belongsToMany'](db[_0x6735('0x12f')],{'through':'team_has_openchannel_queues','as':_0x6735('0x130')});db[_0x6735('0xdd')][_0x6735('0x11e')](db[_0x6735('0x1d7')],{'through':_0x6735('0x1d8'),'as':_0x6735('0x132')});db['Team'][_0x6735('0x11e')](db[_0x6735('0xef')],{'through':_0x6735('0x103'),'as':'VoicePrefixes'});db[_0x6735('0xe0')][_0x6735('0x10d')](db[_0x6735('0x148')],{'as':_0x6735('0x149'),'foreignKey':_0x6735('0x1a0')});db[_0x6735('0xe0')][_0x6735('0x10d')](db[_0x6735('0x14a')],{'as':_0x6735('0x111'),'foreignKey':_0x6735('0x1a0')});db[_0x6735('0xe0')][_0x6735('0x10d')](db[_0x6735('0x74')],{'as':_0x6735('0x19c'),'foreignKey':_0x6735('0x1a0')});db['Campaign'][_0x6735('0x10d')](db[_0x6735('0x71')],{'as':_0x6735('0x14b'),'foreignKey':_0x6735('0x1a0')});db[_0x6735('0xe0')]['belongsTo'](db['Trunk'],{'as':_0x6735('0x14d'),'foreignKey':_0x6735('0x14e')});db[_0x6735('0xe0')][_0x6735('0x11a')](db[_0x6735('0x14d')],{'as':_0x6735('0x14f'),'foreignKey':_0x6735('0x1d9')});db[_0x6735('0xe0')][_0x6735('0x11a')](db[_0x6735('0x7d')],{'as':_0x6735('0x7d'),'foreignKey':_0x6735('0x176')});db[_0x6735('0xe0')]['belongsTo'](db[_0x6735('0x13d')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x6735('0xe0')]['belongsToMany'](db[_0x6735('0xed')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x6735('0xe0')][_0x6735('0x11e')](db[_0x6735('0xed')],{'as':'BlackLists','through':_0x6735('0x1da')});db['Attachment']['belongsTo'](db['ChatOfflineMessage'],{'as':_0x6735('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0x6735('0xe5')]['belongsTo'](db[_0x6735('0x3e')],{});db[_0x6735('0xe5')][_0x6735('0x11a')](db[_0x6735('0x3d')],{});db[_0x6735('0xe5')][_0x6735('0x11a')](db[_0x6735('0x3a')],{'foreignKey':_0x6735('0x1db'),'as':_0x6735('0x1dc')});db[_0x6735('0xe5')]['belongsTo'](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1dd'),'as':_0x6735('0x1de')});db['MailTransferReport'][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1df'),'as':'ToAgent'});db[_0x6735('0xe5')][_0x6735('0x11a')](db[_0x6735('0x12b')],{'foreignKey':_0x6735('0x1e0'),'as':_0x6735('0x1e1')});db['MailTransferReport']['belongsTo'](db[_0x6735('0x3a')],{'foreignKey':_0x6735('0x1e2'),'as':_0x6735('0x1e3')});db['ChatTransferReport'][_0x6735('0x11a')](db[_0x6735('0x193')],{});db[_0x6735('0xe6')][_0x6735('0x11a')](db[_0x6735('0x65')],{});db[_0x6735('0xe6')][_0x6735('0x11a')](db['ChatWebsite'],{'foreignKey':_0x6735('0x1e4'),'as':'FromAccount'});db['ChatTransferReport'][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':'FromUserId','as':_0x6735('0x1de')});db[_0x6735('0xe6')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1df'),'as':_0x6735('0x1e5')});db[_0x6735('0xe6')][_0x6735('0x11a')](db[_0x6735('0x69')],{'foreignKey':_0x6735('0x1e6'),'as':_0x6735('0x1e1')});db['ChatTransferReport'][_0x6735('0x11a')](db[_0x6735('0x60')],{'foreignKey':_0x6735('0x1e7'),'as':_0x6735('0x1e3')});db[_0x6735('0xe8')]['belongsTo'](db[_0x6735('0x49')],{});db[_0x6735('0xe8')][_0x6735('0x11a')](db[_0x6735('0x47')],{});db[_0x6735('0xe8')]['belongsTo'](db[_0x6735('0x134')],{'foreignKey':_0x6735('0x1e8'),'as':_0x6735('0x1dc')});db['FaxTransferReport'][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1dd'),'as':'FromAgent'});db[_0x6735('0xe8')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1df'),'as':_0x6735('0x1e5')});db[_0x6735('0xe8')][_0x6735('0x11a')](db[_0x6735('0x4b')],{'foreignKey':_0x6735('0x1e9'),'as':'ToQueue'});db[_0x6735('0xe8')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x6735('0x1ea'),'as':_0x6735('0x1e3')});db[_0x6735('0xea')][_0x6735('0x11a')](db[_0x6735('0x5d')],{});db[_0x6735('0xea')][_0x6735('0x11a')](db[_0x6735('0x5b')],{});db[_0x6735('0xea')]['belongsTo'](db[_0x6735('0x139')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x6735('0xea')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1dd'),'as':_0x6735('0x1de')});db[_0x6735('0xea')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1df'),'as':_0x6735('0x1e5')});db[_0x6735('0xea')][_0x6735('0x11a')](db[_0x6735('0x12f')],{'foreignKey':'ToOpenchannelQueueId','as':_0x6735('0x1e1')});db['OpenchannelTransferReport'][_0x6735('0x11a')](db['OpenchannelAccount'],{'foreignKey':_0x6735('0x1eb'),'as':_0x6735('0x1e3')});db['SmsTransferReport'][_0x6735('0x11a')](db[_0x6735('0x55')],{});db[_0x6735('0xec')]['belongsTo'](db[_0x6735('0x53')],{});db[_0x6735('0xec')]['belongsTo'](db[_0x6735('0x4f')],{'foreignKey':_0x6735('0x1ec'),'as':_0x6735('0x1dc')});db[_0x6735('0xec')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':'FromUserId','as':_0x6735('0x1de')});db[_0x6735('0xec')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1df'),'as':_0x6735('0x1e5')});db[_0x6735('0xec')][_0x6735('0x11a')](db[_0x6735('0x57')],{'foreignKey':_0x6735('0x1ed'),'as':_0x6735('0x1e1')});db['SmsTransferReport']['belongsTo'](db[_0x6735('0x4f')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x6735('0xed')][_0x6735('0x10d')](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':_0x6735('0x16b'),'onDelete':'cascade'});db['CmList'][_0x6735('0x10d')](db[_0x6735('0x77')],{'as':_0x6735('0x1ee'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0xed')][_0x6735('0x10d')](db['CmContact'],{'as':_0x6735('0x1ef'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0xed')][_0x6735('0x10d')](db[_0x6735('0x14a')],{'as':_0x6735('0x111'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0xed')][_0x6735('0x10d')](db[_0x6735('0x74')],{'as':_0x6735('0x112'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0xed')]['hasMany'](db[_0x6735('0x76')],{'as':_0x6735('0x76'),'foreignKey':'ListId'});db[_0x6735('0xed')]['belongsToMany'](db['VoiceQueue'],{'as':_0x6735('0x1f0'),'through':_0x6735('0x1f1')});db[_0x6735('0xed')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x120')});db[_0x6735('0xef')]['hasMany'](db[_0x6735('0x19')],{'as':'Extensions','onDelete':_0x6735('0x10a')});db[_0x6735('0xef')][_0x6735('0x11e')](db['User'],{'as':'Agents','through':_0x6735('0x104')});db[_0x6735('0xef')][_0x6735('0x11e')](db[_0x6735('0xdd')],{'through':_0x6735('0x103'),'as':_0x6735('0x154')});db[_0x6735('0xf1')][_0x6735('0x10d')](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'foreignKey':'userProfileId'});db['UserProfile'][_0x6735('0x10d')](db[_0x6735('0xf2')],{'as':'UserProfileSections','foreignKey':_0x6735('0x11b'),'onDelete':'cascade'});db['UserProfileSection'][_0x6735('0x10d')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x6735('0x1f2'),'onDelete':_0x6735('0x10a')});db[_0x6735('0xf6')][_0x6735('0x10d')](db[_0x6735('0x166')],{'as':_0x6735('0x167'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x6735('0xf6')][_0x6735('0x10d')](db[_0x6735('0x168')],{'as':_0x6735('0x169'),'foreignKey':_0x6735('0x1f3')});db[_0x6735('0xf6')]['hasMany'](db[_0x6735('0xfa')],{'as':_0x6735('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x6735('0xf6')][_0x6735('0x10d')](db['WhatsappInteraction'],{'as':_0x6735('0x185')});db[_0x6735('0xf6')][_0x6735('0x10d')](db[_0x6735('0xf8')],{'as':_0x6735('0x142')});db[_0x6735('0xf6')]['belongsTo'](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b')});db['WhatsappAccount'][_0x6735('0x11a')](db['Pause'],{'as':_0x6735('0x151'),'foreignKey':_0x6735('0x152')});db[_0x6735('0xf6')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':_0x6735('0x13c')});db[_0x6735('0xf8')][_0x6735('0x11a')](db['User'],{'onDelete':_0x6735('0x163')});db[_0x6735('0xf8')][_0x6735('0x11a')](db['WhatsappQueue'],{'onDelete':_0x6735('0x163')});db[_0x6735('0xf8')]['belongsTo'](db[_0x6735('0xf6')],{'onDelete':_0x6735('0x163')});db[_0x6735('0xf8')][_0x6735('0x11a')](db[_0x6735('0x7d')],{'onDelete':_0x6735('0x163'),'foreignKey':'IntervalId'});db[_0x6735('0xf8')]['belongsTo'](db['Tag'],{'onDelete':_0x6735('0x163'),'foreignKey':'TagId'});db[_0x6735('0xf9')][_0x6735('0x10d')](db[_0x6735('0xfa')],{'as':_0x6735('0x158'),'onDelete':_0x6735('0x10a'),'foreignKey':_0x6735('0x1f4')});db[_0x6735('0xf9')][_0x6735('0x11a')](db['WhatsappAccount'],{'as':_0x6735('0x16e'),'foreignKey':'WhatsappAccountId'});db[_0x6735('0xf9')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':_0x6735('0x15f')});db[_0x6735('0xf9')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x17b'),'foreignKey':_0x6735('0x10c')});db[_0x6735('0xf9')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x1b0'),'as':_0x6735('0x16f')});db[_0x6735('0xf9')][_0x6735('0x11e')](db[_0x6735('0x85')],{'through':_0x6735('0x1b0'),'as':'ThroughTags'});db[_0x6735('0xf9')]['belongsToMany'](db[_0x6735('0x108')],{'as':_0x6735('0x171'),'through':_0x6735('0x127'),'foreignKey':_0x6735('0x1f4')});db[_0x6735('0xfa')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x108')});db[_0x6735('0xfa')][_0x6735('0x11a')](db[_0x6735('0x6e')],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x15e')});db[_0x6735('0xfa')][_0x6735('0x11a')](db[_0x6735('0xf9')],{'onDelete':_0x6735('0x10a'),'as':_0x6735('0x173'),'foreignKey':_0x6735('0x1f4')});db[_0x6735('0xfa')][_0x6735('0x11a')](db['WhatsappAccount'],{'as':_0x6735('0x16e'),'foreignKey':_0x6735('0x1f3')});db[_0x6735('0xfc')][_0x6735('0x11a')](db[_0x6735('0xf6')],{});db[_0x6735('0xfc')]['belongsTo'](db[_0x6735('0xed')],{'as':_0x6735('0x16a'),'foreignKey':_0x6735('0x16b')});db[_0x6735('0xfc')]['belongsTo'](db[_0x6735('0x6e')],{'as':_0x6735('0x15e'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x6735('0x11a')](db[_0x6735('0xf9')],{});db[_0x6735('0xfc')][_0x6735('0x11a')](db[_0x6735('0x1d7')],{});db[_0x6735('0xfc')][_0x6735('0x11a')](db[_0x6735('0xfa')],{});db['WhatsappQueueReport'][_0x6735('0x11a')](db['User'],{});db[_0x6735('0xfe')][_0x6735('0x11a')](db['WhatsappMessage'],{});db[_0x6735('0xfe')][_0x6735('0x11a')](db[_0x6735('0xf9')],{});db[_0x6735('0xfe')][_0x6735('0x11a')](db[_0x6735('0xf6')],{'foreignKey':_0x6735('0x1f5'),'as':'FromAccount'});db[_0x6735('0xfe')][_0x6735('0x11a')](db[_0x6735('0xf6')],{'foreignKey':_0x6735('0x1f6'),'as':_0x6735('0x1e3')});db[_0x6735('0xfe')][_0x6735('0x11a')](db[_0x6735('0x1d7')],{'foreignKey':_0x6735('0x1f7'),'as':_0x6735('0x1e1')});db[_0x6735('0xfe')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1dd'),'as':_0x6735('0x1de')});db[_0x6735('0xfe')][_0x6735('0x11a')](db[_0x6735('0x108')],{'foreignKey':_0x6735('0x1df'),'as':'ToAgent'});db[_0x6735('0x1d7')][_0x6735('0x11e')](db[_0x6735('0x108')],{'as':_0x6735('0x153'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x6735('0x1d7')][_0x6735('0x11e')](db[_0x6735('0xdd')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x6735('0x106')][_0x6735('0x11a')](db[_0x6735('0x108')],{'as':_0x6735('0x1f8'),'foreignKey':_0x6735('0x10c'),'onDelete':_0x6735('0x10a'),'hooks':!![]});db['CloudProvider'][_0x6735('0x109')](db[_0x6735('0x1cc')],{'as':_0x6735('0x1cc'),'onDelete':_0x6735('0x163')});db[_0x6735('0x100')][_0x6735('0x109')](db[_0x6735('0x160')],{'as':'Imap','onDelete':_0x6735('0x163')});db[_0x6735('0x100')]['hasOne'](db[_0x6735('0x38')],{'as':_0x6735('0x165'),'onDelete':_0x6735('0x163')});module[_0x6735('0x1f9')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index af45093..3a363f6 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['./api/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations'];(function(_0x16bacd,_0x3dffa2){var _0x7bcd09=function(_0x18191b){while(--_0x18191b){_0x16bacd['push'](_0x16bacd['shift']());}};_0x7bcd09(++_0x3dffa2);}(_0x6aa7,0x178));var _0x76aa=function(_0x6df973,_0x5add85){_0x6df973=_0x6df973-0x0;var _0x1c1ba3=_0x6aa7[_0x6df973];return _0x1c1ba3;};'use strict';var path=require(_0x76aa('0x0'));var express=require('express');var errors=require(_0x76aa('0x1'));var config=require(_0x76aa('0x2'));var setupLoggers=require(_0x76aa('0x3'))[_0x76aa('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x76aa('0x5')]=function(_0xef15ef){return setupLoggers(_0xef15ef)[_0x76aa('0x6')](function(){_0xef15ef['use']('/api/users',require(_0x76aa('0x7')));_0xef15ef['use'](_0x76aa('0x8'),require(_0x76aa('0x9')));_0xef15ef[_0x76aa('0xa')]('/api/voice/contexts',require(_0x76aa('0xb')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc'),require('./api/voiceExtension'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd'),require(_0x76aa('0xe')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf'),require(_0x76aa('0x10')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x11'),require(_0x76aa('0x12')));_0xef15ef[_0x76aa('0xa')]('/api/screen/recordings',require(_0x76aa('0x13')));_0xef15ef['use'](_0x76aa('0x14'),require(_0x76aa('0x15')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x16'),require(_0x76aa('0x17')));_0xef15ef['use']('/api/voice/calls/reports',require(_0x76aa('0x18')));_0xef15ef['use'](_0x76aa('0x19'),require(_0x76aa('0x1a')));_0xef15ef['use'](_0x76aa('0x1b'),require('./api/voiceAgentReport'));_0xef15ef[_0x76aa('0xa')]('/api/voice/queues/reports',require(_0x76aa('0x1c')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x1d'),require(_0x76aa('0x1e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x1f'),require('./api/trunk'));_0xef15ef['use'](_0x76aa('0x20'),require(_0x76aa('0x21')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x22'),require(_0x76aa('0x23')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x24'),require(_0x76aa('0x25')));_0xef15ef[_0x76aa('0xa')]('/api/mail/queues',require(_0x76aa('0x26')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x27'),require('./api/mailSubstatus'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x28'),require(_0x76aa('0x29')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x2a'),require(_0x76aa('0x2b')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x2c'),require(_0x76aa('0x2d')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x2e'),require(_0x76aa('0x2f')));_0xef15ef[_0x76aa('0xa')]('/api/dashboards',require(_0x76aa('0x30')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x31'),require(_0x76aa('0x32')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x33'),require(_0x76aa('0x34')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x35'),require(_0x76aa('0x36')));_0xef15ef['use'](_0x76aa('0x37'),require('./api/faxInteraction'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x38'),require(_0x76aa('0x39')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x3a'),require(_0x76aa('0x3b')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x3c'),require(_0x76aa('0x3d')));_0xef15ef[_0x76aa('0xa')]('/api/sms/accounts',require(_0x76aa('0x3e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x3f'),require(_0x76aa('0x40')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x41'),require(_0x76aa('0x42')));_0xef15ef['use'](_0x76aa('0x43'),require(_0x76aa('0x44')));_0xef15ef['use'](_0x76aa('0x45'),require('./api/smsQueue'));_0xef15ef[_0x76aa('0xa')]('/api/openchannel/accounts',require(_0x76aa('0x46')));_0xef15ef['use']('/api/openchannel/applications',require(_0x76aa('0x47')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x48'),require(_0x76aa('0x49')));_0xef15ef['use']('/api/openchannel/messages',require(_0x76aa('0x4a')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x4b'),require(_0x76aa('0x4c')));_0xef15ef[_0x76aa('0xa')]('/api/chat/websites',require(_0x76aa('0x4d')));_0xef15ef['use']('/api/openchannel/reports/queue',require(_0x76aa('0x4e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x4f'),require(_0x76aa('0x50')));_0xef15ef['use'](_0x76aa('0x51'),require(_0x76aa('0x52')));_0xef15ef[_0x76aa('0xa')]('/api/chat/messages',require(_0x76aa('0x53')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x54'),require(_0x76aa('0x55')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x56'),require(_0x76aa('0x57')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x58'),require('./api/chatGroup'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x59'),require(_0x76aa('0x5a')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x5b'),require(_0x76aa('0x5c')));_0xef15ef['use']('/api/cm/contacts',require(_0x76aa('0x5d')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x5e'),require(_0x76aa('0x5f')));_0xef15ef['use'](_0x76aa('0x60'),require(_0x76aa('0x61')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x62'),require(_0x76aa('0x63')));_0xef15ef['use'](_0x76aa('0x64'),require('./api/cmHopperHistory'));_0xef15ef[_0x76aa('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0xef15ef['use'](_0x76aa('0x65'),require('./api/action'));_0xef15ef['use']('/api/automations',require(_0x76aa('0x66')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x67'),require(_0x76aa('0x68')));_0xef15ef[_0x76aa('0xa')]('/api/dispositions',require(_0x76aa('0x69')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x6a'),require(_0x76aa('0x6b')));_0xef15ef[_0x76aa('0xa')]('/api/intervals',require(_0x76aa('0x6c')));_0xef15ef[_0x76aa('0xa')]('/api/pauses',require(_0x76aa('0x6d')));_0xef15ef['use'](_0x76aa('0x6e'),require(_0x76aa('0x6f')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x70'),require(_0x76aa('0x71')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x72'),require(_0x76aa('0x73')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x74'),require('./api/sound'));_0xef15ef[_0x76aa('0xa')]('/api/tags',require(_0x76aa('0x75')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x76'),require(_0x76aa('0x77')));_0xef15ef['use']('/api/triggers',require(_0x76aa('0x78')));_0xef15ef['use'](_0x76aa('0x79'),require(_0x76aa('0x7a')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x7b'),require(_0x76aa('0x7c')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/reports',require('./api/integrationReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x7d'),require(_0x76aa('0x7e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x7f'),require(_0x76aa('0x80')));_0xef15ef['use'](_0x76aa('0x81'),require(_0x76aa('0x82')));_0xef15ef[_0x76aa('0xa')]('/api/analytics/metrics',require(_0x76aa('0x83')));_0xef15ef['use'](_0x76aa('0x84'),require('./api/analyticFieldReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x85'),require(_0x76aa('0x86')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x87'),require(_0x76aa('0x88')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/salesforce/configurations',require(_0x76aa('0x89')));_0xef15ef['use'](_0x76aa('0x8a'),require(_0x76aa('0x8b')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x8c'),require(_0x76aa('0x8d')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x8e'),require('./api/intSugarcrmConfiguration'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x8f'),require(_0x76aa('0x90')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/desk/accounts',require(_0x76aa('0x91')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x92'),require(_0x76aa('0x93')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x94'),require('./api/intDeskField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x95'),require(_0x76aa('0x96')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x97'),require(_0x76aa('0x98')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x99'),require('./api/intZendeskAccount'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9a'),require('./api/intZendeskConfiguration'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9b'),require(_0x76aa('0x9c')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9d'),require(_0x76aa('0x9e')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x9f'),require(_0x76aa('0xa0')));_0xef15ef['use'](_0x76aa('0xa1'),require('./api/intFreshdeskField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xa2'),require(_0x76aa('0xa3')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xa4'),require(_0x76aa('0xa5')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xa6'),require(_0x76aa('0xa7')));_0xef15ef['use'](_0x76aa('0xa8'),require(_0x76aa('0xa9')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xaa'),require(_0x76aa('0xab')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xac'),require(_0x76aa('0xad')));_0xef15ef['use'](_0x76aa('0xae'),require('./api/intDynamics365Account'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xaf'),require(_0x76aa('0xb0')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb1'),require(_0x76aa('0xb2')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/freshsales/accounts',require(_0x76aa('0xb3')));_0xef15ef[_0x76aa('0xa')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb4'),require('./api/intFreshsalesField'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb5'),require(_0x76aa('0xb6')));_0xef15ef['use'](_0x76aa('0xb7'),require('./api/chatQueueReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xb8'),require(_0x76aa('0xb9')));_0xef15ef[_0x76aa('0xa')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xef15ef[_0x76aa('0xa')]('/api/jscripty/questions/reports',require(_0x76aa('0xba')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xbb'),require(_0x76aa('0xbc')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xbd'),require(_0x76aa('0xbe')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xbf'),require('./api/squareReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc0'),require(_0x76aa('0xc1')));_0xef15ef[_0x76aa('0xa')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0xef15ef['use'](_0x76aa('0xc2'),require('./api/setting'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc3'),require(_0x76aa('0xc4')));_0xef15ef[_0x76aa('0xa')]('/api/square/projects',require(_0x76aa('0xc5')));_0xef15ef['use'](_0x76aa('0xc6'),require(_0x76aa('0xc7')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xc8'),require(_0x76aa('0xc9')));_0xef15ef['use'](_0x76aa('0xca'),require(_0x76aa('0xcb')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xcc'),require(_0x76aa('0xcd')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xce'),require(_0x76aa('0xcf')));_0xef15ef['use'](_0x76aa('0xd0'),require(_0x76aa('0xd1')));_0xef15ef['use'](_0x76aa('0xd2'),require(_0x76aa('0xd3')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd4'),require(_0x76aa('0xd5')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd6'),require('./api/mailTransferReport'));_0xef15ef[_0x76aa('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xd7'),require('./api/faxTransferReport'));_0xef15ef['use'](_0x76aa('0xd8'),require(_0x76aa('0xd9')));_0xef15ef[_0x76aa('0xa')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xda'),require(_0x76aa('0xdb')));_0xef15ef['use'](_0x76aa('0xdc'),require('./api/voicePrefix'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xdd'),require(_0x76aa('0xde')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xdf'),require('./api/userProfileSection'));_0xef15ef['use'](_0x76aa('0xe0'),require(_0x76aa('0xe1')));_0xef15ef[_0x76aa('0xa')]('/api/userNotifications',require(_0x76aa('0xe2')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xe3'),require(_0x76aa('0xe4')));_0xef15ef[_0x76aa('0xa')]('/api/whatsapp/applications',require(_0x76aa('0xe5')));_0xef15ef['use'](_0x76aa('0xe6'),require(_0x76aa('0xe7')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xe8'),require(_0x76aa('0xe9')));_0xef15ef[_0x76aa('0xa')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0xef15ef['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xea'),require('./api/whatsappQueue'));_0xef15ef['use']('/api/cloudProviders',require(_0x76aa('0xeb')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xec'),require('./api/realtime'));_0xef15ef['use'](_0x76aa('0xed'),require(_0x76aa('0xee')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xef'),require(_0x76aa('0xf0')));_0xef15ef['use']('/api/auth/google',require(_0x76aa('0xf1')));_0xef15ef['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf2'),require('./api/jira'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf3'),require('./api/rpc'));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf4'),require(_0x76aa('0xf5')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf6'),require(_0x76aa('0xf7')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0xf8'),require(_0x76aa('0xf9')));_0xef15ef['use'](_0x76aa('0xfa'),require(_0x76aa('0xfb')));_0xef15ef['use'](_0x76aa('0xfc'),clientSideLogs);_0xef15ef[_0x76aa('0xa')](_0x76aa('0xfd'),express['static'](path[_0x76aa('0xfe')](config[_0x76aa('0xff')],'/apidoc')));_0xef15ef[_0x76aa('0xa')](_0x76aa('0x100'),express[_0x76aa('0x101')](path['join'](config[_0x76aa('0xff')],_0x76aa('0x100'))));_0xef15ef['use']('/demo',express['static'](path[_0x76aa('0xfe')](config[_0x76aa('0xff')],_0x76aa('0x102'))));_0xef15ef[_0x76aa('0xa')]('/snippet',express['static'](path['join'](config[_0x76aa('0xff')],'snippet',_0x76aa('0x103'))));_0xef15ef[_0x76aa('0xa')]('/plugins',express[_0x76aa('0x101')](path[_0x76aa('0xfe')](config['root'],_0x76aa('0x104'))));_0xef15ef[_0x76aa('0x105')](_0x76aa('0x106'))[_0x76aa('0x107')](errors[0x194]);_0xef15ef[_0x76aa('0x105')]('/*')[_0x76aa('0x107')](function(_0x4aee18,_0x37d4f6){_0x37d4f6['sendFile'](path['resolve'](_0xef15ef['get']('appPath')+'/index.html'));});return _0xef15ef;});}; \ No newline at end of file +var _0xd0bb=['/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/settings','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','static','/www','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1d1b15,_0x5ef518){_0x1d1b15=_0x1d1b15-0x0;var _0x1801d3=_0xd0bb[_0x1d1b15];return _0x1801d3;};'use strict';var path=require(_0xbd0b('0x0'));var express=require(_0xbd0b('0x1'));var errors=require(_0xbd0b('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xbd0b('0x3'))['setupLoggers'];var clientSideLogs=require(_0xbd0b('0x4'));exports[_0xbd0b('0x5')]=function(_0x53e6ce){return setupLoggers(_0x53e6ce)[_0xbd0b('0x6')](function(){_0x53e6ce['use'](_0xbd0b('0x7'),require(_0xbd0b('0x8')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa'),require(_0xbd0b('0xb')));_0x53e6ce['use'](_0xbd0b('0xc'),require(_0xbd0b('0xd')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xe'),require(_0xbd0b('0xf')));_0x53e6ce['use']('/api/voice/mohs',require(_0xbd0b('0x10')));_0x53e6ce[_0xbd0b('0x9')]('/api/voice/queues',require(_0xbd0b('0x11')));_0x53e6ce[_0xbd0b('0x9')]('/api/voice/recordings',require(_0xbd0b('0x12')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x13'),require(_0xbd0b('0x14')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x15'),require(_0xbd0b('0x16')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x17'),require(_0xbd0b('0x18')));_0x53e6ce[_0xbd0b('0x9')]('/api/voice/calls/reports',require(_0xbd0b('0x19')));_0x53e6ce['use']('/api/voice/dials/reports',require(_0xbd0b('0x1a')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x1b'),require(_0xbd0b('0x1c')));_0x53e6ce[_0xbd0b('0x9')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x1d'),require(_0xbd0b('0x1e')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x1f'),require(_0xbd0b('0x20')));_0x53e6ce['use'](_0xbd0b('0x21'),require('./api/voiceTransferReport'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x22'),require(_0xbd0b('0x23')));_0x53e6ce[_0xbd0b('0x9')]('/api/mail/accounts',require(_0xbd0b('0x24')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x25'),require('./api/mailQueue'));_0x53e6ce[_0xbd0b('0x9')]('/api/mail/substatuses',require(_0xbd0b('0x26')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x27'),require(_0xbd0b('0x28')));_0x53e6ce[_0xbd0b('0x9')]('/api/mail/messages',require(_0xbd0b('0x29')));_0x53e6ce['use'](_0xbd0b('0x2a'),require(_0xbd0b('0x2b')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x2c'),require(_0xbd0b('0x2d')));_0x53e6ce[_0xbd0b('0x9')]('/api/dashboards',require(_0xbd0b('0x2e')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x2f'),require(_0xbd0b('0x30')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x31'),require('./api/faxAccount'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x32'),require(_0xbd0b('0x33')));_0x53e6ce['use']('/api/fax/interactions',require(_0xbd0b('0x34')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x35'),require(_0xbd0b('0x36')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x37'),require(_0xbd0b('0x38')));_0x53e6ce['use'](_0xbd0b('0x39'),require(_0xbd0b('0x3a')));_0x53e6ce['use']('/api/sms/accounts',require(_0xbd0b('0x3b')));_0x53e6ce[_0xbd0b('0x9')]('/api/sms/applications',require(_0xbd0b('0x3c')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x3d'),require(_0xbd0b('0x3e')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x3f'),require('./api/smsMessage'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x40'),require(_0xbd0b('0x41')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x42'),require(_0xbd0b('0x43')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x44'),require(_0xbd0b('0x45')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x46'),require(_0xbd0b('0x47')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x48'),require('./api/openchannelMessage'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x49'),require('./api/openchannelQueue'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x4a'),require(_0xbd0b('0x4b')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x4c'),require(_0xbd0b('0x4d')));_0x53e6ce['use'](_0xbd0b('0x4e'),require(_0xbd0b('0x4f')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x50'),require(_0xbd0b('0x51')));_0x53e6ce['use']('/api/chat/messages',require(_0xbd0b('0x52')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x53'),require(_0xbd0b('0x54')));_0x53e6ce['use']('/api/chat/queues',require(_0xbd0b('0x55')));_0x53e6ce['use'](_0xbd0b('0x56'),require(_0xbd0b('0x57')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x58'),require(_0xbd0b('0x59')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x5a'),require(_0xbd0b('0x5b')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x5c'),require(_0xbd0b('0x5d')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x5e'),require(_0xbd0b('0x5f')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x60'),require(_0xbd0b('0x61')));_0x53e6ce[_0xbd0b('0x9')]('/api/cm/hopper_final',require(_0xbd0b('0x62')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x63'),require(_0xbd0b('0x64')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x65'),require(_0xbd0b('0x66')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x67'),require(_0xbd0b('0x68')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x69'),require('./api/automation'));_0x53e6ce[_0xbd0b('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x6a'),require(_0xbd0b('0x6b')));_0x53e6ce['use'](_0xbd0b('0x6c'),require(_0xbd0b('0x6d')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x6e'),require(_0xbd0b('0x6f')));_0x53e6ce['use'](_0xbd0b('0x70'),require(_0xbd0b('0x71')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x72'),require(_0xbd0b('0x73')));_0x53e6ce[_0xbd0b('0x9')]('/api/voiceQueuesLog',require(_0xbd0b('0x74')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x75'),require(_0xbd0b('0x76')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x77'),require(_0xbd0b('0x78')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x79'),require(_0xbd0b('0x7a')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x7b'),require(_0xbd0b('0x7c')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x7d'),require(_0xbd0b('0x7e')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x7f'),require(_0xbd0b('0x80')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x81'),require(_0xbd0b('0x82')));_0x53e6ce[_0xbd0b('0x9')]('/api/integrations/reports',require(_0xbd0b('0x83')));_0x53e6ce[_0xbd0b('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x53e6ce['use'](_0xbd0b('0x84'),require('./api/analyticDefaultReport'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x85'),require(_0xbd0b('0x86')));_0x53e6ce[_0xbd0b('0x9')]('/api/analytics/metrics',require(_0xbd0b('0x87')));_0x53e6ce['use'](_0xbd0b('0x88'),require('./api/analyticFieldReport'));_0x53e6ce['use'](_0xbd0b('0x89'),require(_0xbd0b('0x8a')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x8b'),require(_0xbd0b('0x8c')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x8d'),require(_0xbd0b('0x8e')));_0x53e6ce['use']('/api/integrations/salesforce/fields',require(_0xbd0b('0x8f')));_0x53e6ce[_0xbd0b('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x90'),require(_0xbd0b('0x91')));_0x53e6ce[_0xbd0b('0x9')]('/api/integrations/sugarcrm/fields',require(_0xbd0b('0x92')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x93'),require(_0xbd0b('0x94')));_0x53e6ce['use'](_0xbd0b('0x95'),require(_0xbd0b('0x96')));_0x53e6ce['use'](_0xbd0b('0x97'),require(_0xbd0b('0x98')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x99'),require(_0xbd0b('0x9a')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x9b'),require(_0xbd0b('0x9c')));_0x53e6ce['use'](_0xbd0b('0x9d'),require(_0xbd0b('0x9e')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x9f'),require(_0xbd0b('0xa0')));_0x53e6ce[_0xbd0b('0x9')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa1'),require('./api/intZendeskField'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa2'),require(_0xbd0b('0xa3')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa4'),require('./api/intFreshdeskConfiguration'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa5'),require(_0xbd0b('0xa6')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa7'),require(_0xbd0b('0xa8')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xa9'),require(_0xbd0b('0xaa')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xab'),require(_0xbd0b('0xac')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xad'),require(_0xbd0b('0xae')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xaf'),require('./api/intServicenowConfiguration'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xb0'),require(_0xbd0b('0xb1')));_0x53e6ce[_0xbd0b('0x9')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xb2'),require(_0xbd0b('0xb3')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xb4'),require('./api/intDynamics365Field'));_0x53e6ce[_0xbd0b('0x9')]('/api/integrations/freshsales/accounts',require(_0xbd0b('0xb5')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xb6'),require(_0xbd0b('0xb7')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xb8'),require('./api/intFreshsalesField'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xb9'),require(_0xbd0b('0xba')));_0x53e6ce[_0xbd0b('0x9')]('/api/chat/reports/queue',require(_0xbd0b('0xbb')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xbc'),require(_0xbd0b('0xbd')));_0x53e6ce[_0xbd0b('0x9')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x53e6ce[_0xbd0b('0x9')]('/api/jscripty/questions/reports',require(_0xbd0b('0xbe')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xbf'),require(_0xbd0b('0xc0')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xc1'),require('./api/smsQueueReport'));_0x53e6ce[_0xbd0b('0x9')]('/api/square/reports',require(_0xbd0b('0xc2')));_0x53e6ce['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x53e6ce[_0xbd0b('0x9')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xc3'),require('./api/setting'));_0x53e6ce[_0xbd0b('0x9')]('/api/square/odbc',require('./api/squareOdbc'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xc4'),require(_0xbd0b('0xc5')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xc6'),require(_0xbd0b('0xc7')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xc8'),require('./api/squareMessage'));_0x53e6ce['use'](_0xbd0b('0xc9'),require('./api/team'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xca'),require(_0xbd0b('0xcb')));_0x53e6ce['use'](_0xbd0b('0xcc'),require(_0xbd0b('0xcd')));_0x53e6ce['use'](_0xbd0b('0xce'),require(_0xbd0b('0xcf')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xd0'),require(_0xbd0b('0xd1')));_0x53e6ce['use'](_0xbd0b('0xd2'),require(_0xbd0b('0xd3')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xd4'),require('./api/mailTransferReport'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xd5'),require('./api/chatTransferReport'));_0x53e6ce[_0xbd0b('0x9')]('/api/fax/reports/transfer',require(_0xbd0b('0xd6')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xd7'),require(_0xbd0b('0xd8')));_0x53e6ce[_0xbd0b('0x9')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x53e6ce['use'](_0xbd0b('0xd9'),require(_0xbd0b('0xda')));_0x53e6ce[_0xbd0b('0x9')]('/api/voice/prefixes',require(_0xbd0b('0xdb')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xdc'),require(_0xbd0b('0xdd')));_0x53e6ce[_0xbd0b('0x9')]('/api/userProfile/sections',require(_0xbd0b('0xde')));_0x53e6ce['use'](_0xbd0b('0xdf'),require(_0xbd0b('0xe0')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xe1'),require(_0xbd0b('0xe2')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xe3'),require(_0xbd0b('0xe4')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xe5'),require('./api/whatsappApplication'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xe6'),require(_0xbd0b('0xe7')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xe8'),require(_0xbd0b('0xe9')));_0x53e6ce[_0xbd0b('0x9')]('/api/whatsapp/reports/queue',require(_0xbd0b('0xea')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xeb'),require('./api/whatsappTransferReport'));_0x53e6ce[_0xbd0b('0x9')]('/api/whatsapp/queues',require(_0xbd0b('0xec')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xed'),require(_0xbd0b('0xee')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xef'),require('./api/realtime'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xf0'),require(_0xbd0b('0xf1')));_0x53e6ce[_0xbd0b('0x9')]('/api/auth/local',require(_0xbd0b('0xf2')));_0x53e6ce['use'](_0xbd0b('0xf3'),require(_0xbd0b('0xf4')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xf5'),require(_0xbd0b('0xf6')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xf7'),require(_0xbd0b('0xf8')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xf9'),require(_0xbd0b('0xfa')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xfb'),require('./api/version'));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xfc'),require(_0xbd0b('0xfd')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0xfe'),require(_0xbd0b('0xff')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x100'),require(_0xbd0b('0x101')));_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x102'),clientSideLogs);_0x53e6ce[_0xbd0b('0x9')](_0xbd0b('0x103'),express['static'](path[_0xbd0b('0x104')](config[_0xbd0b('0x105')],_0xbd0b('0x103'))));_0x53e6ce[_0xbd0b('0x9')]('/www',express[_0xbd0b('0x106')](path[_0xbd0b('0x104')](config[_0xbd0b('0x105')],_0xbd0b('0x107'))));_0x53e6ce[_0xbd0b('0x9')]('/demo',express['static'](path[_0xbd0b('0x104')](config[_0xbd0b('0x105')],_0xbd0b('0x108'))));_0x53e6ce['use'](_0xbd0b('0x109'),express[_0xbd0b('0x106')](path[_0xbd0b('0x104')](config['root'],_0xbd0b('0x10a'),'3.0.0')));_0x53e6ce['use'](_0xbd0b('0x10b'),express['static'](path['join'](config[_0xbd0b('0x105')],'/server/files/plugins')));_0x53e6ce[_0xbd0b('0x10c')](_0xbd0b('0x10d'))['get'](errors[0x194]);_0x53e6ce[_0xbd0b('0x10c')]('/*')[_0xbd0b('0x10e')](function(_0x314373,_0xec1979){_0xec1979[_0xbd0b('0x10f')](path['resolve'](_0x53e6ce[_0xbd0b('0x10e')](_0xbd0b('0x110'))+'/index.html'));});return _0x53e6ce;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a0af474..45775ba 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe41f=['../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.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'];(function(_0x54daf5,_0x528643){var _0xf70158=function(_0x4902d6){while(--_0x4902d6){_0x54daf5['push'](_0x54daf5['shift']());}};_0xf70158(++_0x528643);}(_0xe41f,0xc1));var _0xfe41=function(_0x346e5e,_0x3a831f){_0x346e5e=_0x346e5e-0x0;var _0x555c59=_0xe41f[_0x346e5e];return _0x555c59;};'use strict';var jayson=require(_0xfe41('0x0'));var _=require(_0xfe41('0x1'));var config=require(_0xfe41('0x2'));exports[_0xfe41('0x3')]=function(){return new Promise(function(_0x5be048,_0x542b95){var _0x131588={};_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/user/user.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/voiceExtension/voiceExtension.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/voiceQueue/voiceQueue.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x5')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x6')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x7')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x8')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x9')));_0x131588=_['merge'](_0x131588,require('../api/trunk/trunk.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0xa')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/mailServerIn/mailServerIn.rpc'));_0x131588=_['merge'](_0x131588,require(_0xfe41('0xb')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0xc')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0xd')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0xe')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0xf')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x10')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/faxAccount/faxAccount.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/faxApplication/faxApplication.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x11')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x12')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x13')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x14')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x15')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x16')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x17')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x18')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x19')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x1a')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x1b')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x1c')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x1d')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/chatInteraction/chatInteraction.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x1e')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x1f')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x20')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x21')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x22')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x23')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x24')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x25')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x26')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x27')));_0x131588=_['merge'](_0x131588,require('../api/sound/sound.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x28')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x29')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/variable/variable.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x2a')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x2b')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x2c')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x2d')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x2e')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x2f')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x30')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x31')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x32')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x33')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x34')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x35')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x36')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x37')));_0x131588=_[_0xfe41('0x4')](_0x131588,require('../api/squareMessage/squareMessage.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x38')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x39')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x3a')));_0x131588=_['merge'](_0x131588,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x3b')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x3c')));_0x131588=_[_0xfe41('0x4')](_0x131588,require(_0xfe41('0x3d')));_0x131588=_['merge'](_0x131588,require(_0xfe41('0x3e')));var _0x25ae36=jayson['server'](_0x131588)[_0xfe41('0x3f')]();var _0x305a55=config['rpc']['port']||config['port']+0x1;var _0x468395=config[_0xfe41('0x40')]['ip']||_0xfe41('0x41');_0x25ae36['on'](_0xfe41('0x42'),function(_0x26213f){return _0x542b95(_0x26213f);});_0x25ae36[_0xfe41('0x3')](_0x305a55,_0x468395,function(){console['log'](_0xfe41('0x43'),_0x468395,_0x305a55);require(_0xfe41('0x44'))['default']();return _0x5be048(_0xfe41('0x45')+_0x468395+':'+_0x305a55);});});}; \ No newline at end of file +var _0xbc2d=['../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc'];(function(_0x355fd7,_0x3fe3c0){var _0x3cdbb3=function(_0x1cde5c){while(--_0x1cde5c){_0x355fd7['push'](_0x355fd7['shift']());}};_0x3cdbb3(++_0x3fe3c0);}(_0xbc2d,0x6a));var _0xdbc2=function(_0x1859d4,_0xe4e630){_0x1859d4=_0x1859d4-0x0;var _0x5b93bd=_0xbc2d[_0x1859d4];return _0x5b93bd;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0xdbc2('0x0'));exports[_0xdbc2('0x1')]=function(){return new Promise(function(_0x2691af,_0x438010){var _0x3e91db={};_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/user/user.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x3')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/voiceQueue/voiceQueue.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/voiceRecording/voiceRecording.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x4')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x5')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x6')));_0x3e91db=_['merge'](_0x3e91db,require('../api/memberReport/memberReport.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x7')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x8')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x9')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0xa')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0xb')));_0x3e91db=_['merge'](_0x3e91db,require('../api/mailQueue/mailQueue.rpc'));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0xc')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/mailMessage/mailMessage.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0xd')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0xe')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/faxAccount/faxAccount.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0xf')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x10')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x11')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x12')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x13')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x14')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x15')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x16')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/smsQueue/smsQueue.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x17')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x18')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x19')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x1a')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/chatInteraction/chatInteraction.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x1b')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x1c')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/cmContact/cmContact.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x1d')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x1e')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x1f')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x20')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x21')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x22')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x23')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x24')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x25')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x26')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x27')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x28')));_0x3e91db=_['merge'](_0x3e91db,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x29')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x2a')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x2b')));_0x3e91db=_['merge'](_0x3e91db,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x2c')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x2d')));_0x3e91db=_['merge'](_0x3e91db,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x2e')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x2f')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x30')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x31')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x32')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x33')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x34')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/squareRecording/squareRecording.rpc'));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x35')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x36')));_0x3e91db=_['merge'](_0x3e91db,require(_0xdbc2('0x37')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x38')));_0x3e91db=_['merge'](_0x3e91db,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x39')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x3a')));_0x3e91db=_[_0xdbc2('0x2')](_0x3e91db,require(_0xdbc2('0x3b')));var _0x17a96e=jayson['server'](_0x3e91db)[_0xdbc2('0x3c')]();var _0x50e91a=config[_0xdbc2('0x3d')][_0xdbc2('0x3e')]||config[_0xdbc2('0x3e')]+0x1;var _0x21c5c1=config[_0xdbc2('0x3d')]['ip']||_0xdbc2('0x3f');_0x17a96e['on'](_0xdbc2('0x40'),function(_0xcb7af5){return _0x438010(_0xcb7af5);});_0x17a96e[_0xdbc2('0x1')](_0x50e91a,_0x21c5c1,function(){console['log'](_0xdbc2('0x41'),_0x21c5c1,_0x50e91a);require(_0xdbc2('0x42'))[_0xdbc2('0x43')]();return _0x2691af(_0xdbc2('0x44')+_0x21c5c1+':'+_0x50e91a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 709e75d..b228173 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 _0x5f02=['GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','WAIT','label','exports','util','events','./reply','setEncoding','utf8','setTimeout','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sync','answer','sendRequest','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority'];(function(_0x17aa78,_0x1ca1ef){var _0x4e0514=function(_0x37340c){while(--_0x37340c){_0x17aa78['push'](_0x17aa78['shift']());}};_0x4e0514(++_0x1ca1ef);}(_0x5f02,0xa6));var _0x25f0=function(_0x18417e,_0x24c791){_0x18417e=_0x18417e-0x0;var _0x4eeee7=_0x5f02[_0x18417e];return _0x4eeee7;};'use strict';var util=require(_0x25f0('0x0'));var _=require('lodash');var EventEmitter=require(_0x25f0('0x1'))['EventEmitter'];var AGIReply=require(_0x25f0('0x2'));var AGIError=require('./error');function AGIChannel(_0x1943cc){var _0x2fbda8=this,_0x127271=new AGIReply(),_0x2a4994=![],_0x548a05={};EventEmitter['call'](_0x2fbda8);_0x1943cc[_0x25f0('0x3')](_0x25f0('0x4'));_0x1943cc[_0x25f0('0x5')](0x8*0x3c*0x3c*0x3e8);_0x127271['setEncoding']('utf8');_0x127271['on']('headers',function(_0x2c49b0){for(var _0x488cb9 in _0x2c49b0){_0x2fbda8[_0x488cb9]=_0x2c49b0[_0x488cb9];}_0x2fbda8[_0x25f0('0x6')]('ready');});_0x127271['on'](_0x25f0('0x7'),function(_0x4d0f20){if(_0x4d0f20[_0x25f0('0x8')]()==_0x25f0('0x9')){_0x2fbda8['emit'](_0x25f0('0x9'));return;}if(_0x4d0f20[_0x25f0('0xa')](0x0,0xb)==_0x25f0('0xb')){_0x2a4994=!![];}if(_0x2a4994){_0x548a05['rx']+=_0x4d0f20+'\x0a';if(_0x4d0f20[_0x25f0('0xc')](_0x25f0('0xd'))!=-0x1){_0x2a4994=![];}}else{_0x548a05['rx']=_0x4d0f20;}if(_0x2a4994){return;}if(typeof _0x548a05['cb']==_0x25f0('0xe')){var _0x254de4=_0x548a05['rx'][_0x25f0('0xa')](0x0,0x3),_0x3c455f=null,_0x58551d=null;_0x254de4=parseInt(_0x254de4);if(isNaN(_0x254de4)){_0x548a05['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x25f0('0xf')});return;}if(_0x254de4!=0xc8){_0x548a05['cb'](null,{'code':_0x254de4,'result':-0x1,'extra':'KO'});return;}_0x3c455f=_0x548a05['rx'][_0x25f0('0xa')](0x4)[_0x25f0('0x10')](_0x25f0('0x11'),'');if(_0x3c455f['indexOf']('\x20')!=-0x1){_0x3c455f=_0x3c455f[_0x25f0('0x12')](0x0,_0x3c455f[_0x25f0('0x13')]('\x20'));}if(_[_0x25f0('0x14')](_0x3c455f,'-1')){_0x3c455f=parseInt(_0x3c455f);}_0x58551d=_0x548a05['rx'][_0x25f0('0x15')]('\x20');if(_0x58551d['length']==0x3){_0x58551d=_0x58551d[0x2][_0x25f0('0xa')](0x1,_0x58551d[0x2]['length']-0x1);}else if(_0x58551d['length']>0x3){var _0x180cef=/\((.+)\)/;var _0x49b857=_0x548a05['rx'][_0x25f0('0x16')](_0x180cef);if(_0x49b857){_0x58551d=_0x49b857[0x1];}else{_0x58551d=null;}}else{_0x58551d=null;}_0x548a05['cb'](null,{'code':_0x254de4,'result':_0x3c455f,'extra':_0x58551d});}});_0x1943cc['on'](_0x25f0('0x17'),function(_0x63c859){_0x2fbda8[_0x25f0('0x6')]('error',new AGIError(_0x25f0('0x18'),_0x63c859[_0x25f0('0x19')]));});_0x1943cc['on']('close',function(){_0x2fbda8[_0x25f0('0x6')](_0x25f0('0x1a'),new AGIError(_0x25f0('0x1b')));});_0x1943cc['on'](_0x25f0('0x1c'),function(){_0x2fbda8[_0x25f0('0x6')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1943cc[_0x25f0('0x1d')]();});_0x1943cc[_0x25f0('0x1e')](_0x127271);this[_0x25f0('0x1f')]=function(_0x4480d1,_0x350387){var _0x4480d1=_0x4480d1||'',_0x350387=typeof _0x350387==_0x25f0('0xe')?_0x350387:new Function();_0x548a05={'tx':_0x4480d1,'rx':'','cb':_0x350387};_0x1943cc[_0x25f0('0x20')](_0x4480d1+'\x0a');},this[_0x25f0('0x1a')]=function(){_0x1943cc[_0x25f0('0x1d')]();};}util[_0x25f0('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x25f0('0x22')]['sendRequest']=function(_0x14f298){return this[_0x25f0('0x1f')][_0x25f0('0x23')](this,_0x14f298);};AGIChannel[_0x25f0('0x22')][_0x25f0('0x24')]=function(){return this[_0x25f0('0x25')](_0x25f0('0x26'));};AGIChannel['prototype']['getData']=function(_0x453122,_0x170486,_0x3b1795){_0x453122=_0x453122===undefined?_0x25f0('0x27'):_0x453122;_0x170486=_0x170486===undefined?'5':_0x170486;_0x3b1795=_0x3b1795===undefined?'1':_0x3b1795;return this[_0x25f0('0x25')](util[_0x25f0('0x28')](_0x25f0('0x29'),_0x453122,_0x170486*0x3e8,_0x3b1795));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x2a')]=function(_0x1cf712){_0x1cf712=_0x1cf712||_0x25f0('0x2b');return this[_0x25f0('0x25')](util[_0x25f0('0x28')](_0x25f0('0x2c'),_0x1cf712));};AGIChannel['prototype']['exec']=function(_0x522aa8,_0x1a03d9){if(_[_0x25f0('0x2d')](_0x1a03d9)){return this['sendRequest'](util[_0x25f0('0x28')](_0x25f0('0x2e'),_0x522aa8,_0x1a03d9['join'](',')));}return this[_0x25f0('0x25')](util[_0x25f0('0x28')](_0x25f0('0x2e'),_0x522aa8,_0x1a03d9));};AGIChannel['prototype'][_0x25f0('0x2f')]=function(_0x26af78){return this[_0x25f0('0x25')](util['format']('SET\x20CONTEXT\x20%s',_0x26af78));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x30')]=function(_0x2907fc){return this['sendRequest'](util[_0x25f0('0x28')](_0x25f0('0x31'),_0x2907fc));};AGIChannel[_0x25f0('0x22')]['setPriority']=function(_0xa6b2f){return this['sendRequest'](util[_0x25f0('0x28')](_0x25f0('0x32'),_0xa6b2f));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x9')]=function(){return this[_0x25f0('0x25')](_0x25f0('0x33'));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x34')]=function(_0x94e940,_0x1bc33d){var _0x1482d1=_[_0x25f0('0x35')](_0x1bc33d)||_[_0x25f0('0x36')](_0x1bc33d)?_0x1bc33d[_0x25f0('0x37')]():_0x1bc33d;return this[_0x25f0('0x25')](util[_0x25f0('0x28')](_0x25f0('0x38'),_0x94e940,_0x1482d1?_0x1482d1['toString']()[_0x25f0('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x25f0('0x22')]['sayNumber']=function(_0x43c1c8,_0x378378){return this[_0x25f0('0x25')](util['format'](_0x25f0('0x39'),_0x43c1c8,_0x378378));};AGIChannel['prototype'][_0x25f0('0x3a')]=function(_0x23ec5d,_0x117e40){return this[_0x25f0('0x25')](util[_0x25f0('0x28')](_0x25f0('0x3b'),_0x23ec5d,_0x117e40));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x3c')]=function(_0x46b79d,_0x2993dc){return this[_0x25f0('0x25')](util[_0x25f0('0x28')](_0x25f0('0x3d'),_0x46b79d,_0x2993dc));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x3e')]=function(_0x4fb818,_0x376f7d,_0x68b2e){_0x376f7d=_0x376f7d||this[_0x25f0('0x3f')];_0x68b2e=_0x68b2e||0x1;this[_0x25f0('0x2f')](_0x4fb818);this[_0x25f0('0x30')](_0x376f7d);this[_0x25f0('0x40')](_0x68b2e);return this['noop'](util[_0x25f0('0x28')](_0x25f0('0x41'),_0x4fb818,_0x376f7d,_0x68b2e));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x42')]=function(_0x16e4b3){return this['sendRequest'](util['format'](_0x25f0('0x43'),_0x16e4b3));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x44')]=function(_0x35037c,_0x208055,_0xa498a0,_0x53e87a,_0x158536,_0x3b7ef1){_0x208055=_0x208055||_0x25f0('0x45');_0xa498a0=_0xa498a0||'';_0x53e87a=_0x53e87a===undefined?-0x1:_0x53e87a==='-1'?-0x1:_0x53e87a*0x3e8;_0x158536=_0x158536===undefined?'':'s='+_0x158536;_0x3b7ef1=_0x3b7ef1?'BEEP':'';return this[_0x25f0('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x35037c,_0x208055,_0xa498a0,_0x53e87a,_0x3b7ef1,_0x158536));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x46')]=function(_0x30683b,_0x401efe){_0x401efe=_0x401efe||'';return this['sendRequest'](util[_0x25f0('0x28')](_0x25f0('0x47'),_0x30683b,_0x401efe));};AGIChannel[_0x25f0('0x22')][_0x25f0('0x48')]=function(_0x37279c){return this[_0x25f0('0x49')]('AGI',_0x37279c);};AGIChannel[_0x25f0('0x22')]['wait']=function(_0x3d713b){return this[_0x25f0('0x49')](_0x25f0('0x4a'),_0x3d713b);};AGIChannel[_0x25f0('0x22')][_0x25f0('0x17')]=function(_0x58279f,_0x61822f){this['noop'](util[_0x25f0('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x58279f['id'],_0x58279f[_0x25f0('0x4b')],_0x61822f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x25f0('0x4c')]=AGIChannel; \ No newline at end of file +var _0x2563=['destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable','isBoolean','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','line','hangup','emit','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT'];(function(_0x3a1a85,_0x3a2a64){var _0x29deaa=function(_0x19d314){while(--_0x19d314){_0x3a1a85['push'](_0x3a1a85['shift']());}};_0x29deaa(++_0x3a2a64);}(_0x2563,0x75));var _0x3256=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2563[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3256('0x0'));var _=require(_0x3256('0x1'));var EventEmitter=require(_0x3256('0x2'))[_0x3256('0x3')];var AGIReply=require(_0x3256('0x4'));var AGIError=require(_0x3256('0x5'));function AGIChannel(_0x5a56e7){var _0x3be369=this,_0x36d702=new AGIReply(),_0x5631d3=![],_0x348ebf={};EventEmitter[_0x3256('0x6')](_0x3be369);_0x5a56e7['setEncoding'](_0x3256('0x7'));_0x5a56e7[_0x3256('0x8')](0x8*0x3c*0x3c*0x3e8);_0x36d702[_0x3256('0x9')](_0x3256('0x7'));_0x36d702['on'](_0x3256('0xa'),function(_0x492ce6){for(var _0x4a431a in _0x492ce6){_0x3be369[_0x4a431a]=_0x492ce6[_0x4a431a];}_0x3be369['emit']('ready');});_0x36d702['on'](_0x3256('0xb'),function(_0x4d514c){if(_0x4d514c['toLowerCase']()==_0x3256('0xc')){_0x3be369[_0x3256('0xd')](_0x3256('0xc'));return;}if(_0x4d514c[_0x3256('0xe')](0x0,0xb)==_0x3256('0xf')){_0x5631d3=!![];}if(_0x5631d3){_0x348ebf['rx']+=_0x4d514c+'\x0a';if(_0x4d514c['search'](_0x3256('0x10'))!=-0x1){_0x5631d3=![];}}else{_0x348ebf['rx']=_0x4d514c;}if(_0x5631d3){return;}if(typeof _0x348ebf['cb']==_0x3256('0x11')){var _0x1a87e8=_0x348ebf['rx'][_0x3256('0xe')](0x0,0x3),_0x4eb1d4=null,_0xbe53b8=null;_0x1a87e8=parseInt(_0x1a87e8);if(isNaN(_0x1a87e8)){_0x348ebf['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3256('0x12')});return;}if(_0x1a87e8!=0xc8){_0x348ebf['cb'](null,{'code':_0x1a87e8,'result':-0x1,'extra':'KO'});return;}_0x4eb1d4=_0x348ebf['rx']['substring'](0x4)[_0x3256('0x13')](_0x3256('0x14'),'');if(_0x4eb1d4['indexOf']('\x20')!=-0x1){_0x4eb1d4=_0x4eb1d4[_0x3256('0x15')](0x0,_0x4eb1d4[_0x3256('0x16')]('\x20'));}if(_[_0x3256('0x17')](_0x4eb1d4,'-1')){_0x4eb1d4=parseInt(_0x4eb1d4);}_0xbe53b8=_0x348ebf['rx']['split']('\x20');if(_0xbe53b8[_0x3256('0x18')]==0x3){_0xbe53b8=_0xbe53b8[0x2][_0x3256('0xe')](0x1,_0xbe53b8[0x2]['length']-0x1);}else if(_0xbe53b8[_0x3256('0x18')]>0x3){var _0x160fb4=/\((.+)\)/;var _0xf42cb2=_0x348ebf['rx'][_0x3256('0x19')](_0x160fb4);if(_0xf42cb2){_0xbe53b8=_0xf42cb2[0x1];}else{_0xbe53b8=null;}}else{_0xbe53b8=null;}_0x348ebf['cb'](null,{'code':_0x1a87e8,'result':_0x4eb1d4,'extra':_0xbe53b8});}});_0x5a56e7['on']('error',function(_0x1aa361){_0x3be369[_0x3256('0xd')](_0x3256('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x1aa361[_0x3256('0x1b')]));});_0x5a56e7['on']('close',function(){_0x3be369['emit'](_0x3256('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x5a56e7['on']('timeout',function(){_0x3be369[_0x3256('0xd')](_0x3256('0x1d'),new AGIError(_0x3256('0x1e')));_0x5a56e7[_0x3256('0x1f')]();});_0x5a56e7[_0x3256('0x20')](_0x36d702);this[_0x3256('0x21')]=function(_0x317e8a,_0x1fac9f){var _0x317e8a=_0x317e8a||'',_0x1fac9f=typeof _0x1fac9f==_0x3256('0x11')?_0x1fac9f:new Function();_0x348ebf={'tx':_0x317e8a,'rx':'','cb':_0x1fac9f};_0x5a56e7[_0x3256('0x22')](_0x317e8a+'\x0a');},this[_0x3256('0x1c')]=function(){_0x5a56e7['destroy']();};}util[_0x3256('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x3256('0x24')][_0x3256('0x25')]=function(_0x3fd53e){return this[_0x3256('0x21')][_0x3256('0x26')](this,_0x3fd53e);};AGIChannel[_0x3256('0x24')][_0x3256('0x27')]=function(){return this[_0x3256('0x25')]('ANSWER');};AGIChannel['prototype'][_0x3256('0x28')]=function(_0x262453,_0x14f78c,_0x25f742){_0x262453=_0x262453===undefined?_0x3256('0x29'):_0x262453;_0x14f78c=_0x14f78c===undefined?'5':_0x14f78c;_0x25f742=_0x25f742===undefined?'1':_0x25f742;return this[_0x3256('0x25')](util[_0x3256('0x2a')](_0x3256('0x2b'),_0x262453,_0x14f78c*0x3e8,_0x25f742));};AGIChannel[_0x3256('0x24')][_0x3256('0x2c')]=function(_0x2978cd){_0x2978cd=_0x2978cd||'NO\x20MESSAGE';return this['sendRequest'](util[_0x3256('0x2a')](_0x3256('0x2d'),_0x2978cd));};AGIChannel[_0x3256('0x24')][_0x3256('0x2e')]=function(_0xe604ed,_0x219818){if(_[_0x3256('0x2f')](_0x219818)){return this['sendRequest'](util[_0x3256('0x2a')](_0x3256('0x30'),_0xe604ed,_0x219818[_0x3256('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0xe604ed,_0x219818));};AGIChannel[_0x3256('0x24')][_0x3256('0x32')]=function(_0x1ef1a7){return this[_0x3256('0x25')](util[_0x3256('0x2a')](_0x3256('0x33'),_0x1ef1a7));};AGIChannel[_0x3256('0x24')][_0x3256('0x34')]=function(_0xd35dea){return this[_0x3256('0x25')](util[_0x3256('0x2a')]('SET\x20EXTENSION\x20%s',_0xd35dea));};AGIChannel[_0x3256('0x24')][_0x3256('0x35')]=function(_0x25af81){return this['sendRequest'](util[_0x3256('0x2a')]('SET\x20PRIORITY\x20%s',_0x25af81));};AGIChannel[_0x3256('0x24')]['hangup']=function(){return this[_0x3256('0x25')](_0x3256('0x36'));};AGIChannel[_0x3256('0x24')][_0x3256('0x37')]=function(_0x4391c2,_0x5319a4){var _0x15d6fa=_[_0x3256('0x38')](_0x5319a4)||_['isNumber'](_0x5319a4)?_0x5319a4[_0x3256('0x39')]():_0x5319a4;return this['sendRequest'](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4391c2,_0x15d6fa?_0x15d6fa['toString']()[_0x3256('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3256('0x24')]['sayNumber']=function(_0x23dabd,_0x6ff7b5){return this[_0x3256('0x25')](util['format'](_0x3256('0x3a'),_0x23dabd,_0x6ff7b5));};AGIChannel[_0x3256('0x24')][_0x3256('0x3b')]=function(_0x32972b,_0x504226){return this[_0x3256('0x25')](util[_0x3256('0x2a')](_0x3256('0x3c'),_0x32972b,_0x504226));};AGIChannel['prototype']['sayPhonetic']=function(_0x45ee0c,_0x26e74c){return this[_0x3256('0x25')](util['format'](_0x3256('0x3d'),_0x45ee0c,_0x26e74c));};AGIChannel[_0x3256('0x24')]['continueAt']=function(_0x32a930,_0x4cabdf,_0x187a35){_0x4cabdf=_0x4cabdf||this[_0x3256('0x3e')];_0x187a35=_0x187a35||0x1;this[_0x3256('0x32')](_0x32a930);this[_0x3256('0x34')](_0x4cabdf);this[_0x3256('0x35')](_0x187a35);return this['noop'](util[_0x3256('0x2a')](_0x3256('0x3f'),_0x32a930,_0x4cabdf,_0x187a35));};AGIChannel[_0x3256('0x24')][_0x3256('0x40')]=function(_0x5dc9d5){return this['sendRequest'](util[_0x3256('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x5dc9d5));};AGIChannel[_0x3256('0x24')][_0x3256('0x41')]=function(_0x4d9a1d,_0x20a3a5,_0xbbec2a,_0x399bb,_0x4d0dfb,_0x3d0047){_0x20a3a5=_0x20a3a5||'wav';_0xbbec2a=_0xbbec2a||'';_0x399bb=_0x399bb===undefined?-0x1:_0x399bb==='-1'?-0x1:_0x399bb*0x3e8;_0x4d0dfb=_0x4d0dfb===undefined?'':'s='+_0x4d0dfb;_0x3d0047=_0x3d0047?_0x3256('0x42'):'';return this[_0x3256('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x4d9a1d,_0x20a3a5,_0xbbec2a,_0x399bb,_0x3d0047,_0x4d0dfb));};AGIChannel['prototype'][_0x3256('0x43')]=function(_0x166eee,_0x2ae6ca){_0x2ae6ca=_0x2ae6ca||'';return this[_0x3256('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x166eee,_0x2ae6ca));};AGIChannel[_0x3256('0x24')][_0x3256('0x44')]=function(_0xb8f059){return this[_0x3256('0x2e')](_0x3256('0x45'),_0xb8f059);};AGIChannel['prototype'][_0x3256('0x46')]=function(_0x21555f){return this[_0x3256('0x2e')](_0x3256('0x47'),_0x21555f);};AGIChannel[_0x3256('0x24')][_0x3256('0x1a')]=function(_0x161ff8,_0xe0ced0){this[_0x3256('0x2c')](util[_0x3256('0x2a')](_0x3256('0x48'),_0x161ff8['id'],_0x161ff8[_0x3256('0x49')],_0xe0ced0));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 130bbb3..aa43f90 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 _0xbca7=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xbca7,0x198));var _0x7bca=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xbca7[_0x521929];return _0x632436;};'use strict';var util=require(_0x7bca('0x0'));var error={'E_AGI_UNDEFINED':_0x7bca('0x1'),'E_AGI_ARGUMENT_PORT':_0x7bca('0x2'),'E_AGI_SERVER_ERROR':_0x7bca('0x3'),'E_AGI_SERVER_CLOSE':_0x7bca('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x7bca('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x7bca('0x6'),'E_AGI_SOCKET_ERROR':_0x7bca('0x7'),'E_AGI_SOCKET_CLOSE':_0x7bca('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x7bca('0x9'),'E_AGI_COMMAND_EMPTY':_0x7bca('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7bca('0xb'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2379de){var _0x2379de=_0x2379de||null,_0x1c44dd=_0x1c44dd||[],_0x33e790=0x1,_0x39a8d1='';if(!error[_0x2379de]){_0x2379de=_0x7bca('0xc');}_0x1c44dd[_0x7bca('0xd')](error[_0x2379de]);while(arguments[_0x33e790]){_0x1c44dd[_0x7bca('0xd')](arguments[_0x33e790]);_0x33e790++;}_0x39a8d1=util[_0x7bca('0xe')][_0x7bca('0xf')](util,_0x1c44dd);this['message']=_0x39a8d1;this[_0x7bca('0x10')]=_0x2379de;}module[_0x7bca('0x11')]=AGIError; \ No newline at end of file +var _0x2a9f=['apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x1022ed,_0x2ac525){var _0x959b70=function(_0x432441){while(--_0x432441){_0x1022ed['push'](_0x1022ed['shift']());}};_0x959b70(++_0x2ac525);}(_0x2a9f,0x144));var _0xf2a9=function(_0x41968a,_0x2056c1){_0x41968a=_0x41968a-0x0;var _0x12ff4f=_0x2a9f[_0x41968a];return _0x12ff4f;};'use strict';var util=require(_0xf2a9('0x0'));var error={'E_AGI_UNDEFINED':_0xf2a9('0x1'),'E_AGI_ARGUMENT_PORT':_0xf2a9('0x2'),'E_AGI_SERVER_ERROR':_0xf2a9('0x3'),'E_AGI_SERVER_CLOSE':_0xf2a9('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xf2a9('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xf2a9('0x6'),'E_AGI_SOCKET_ERROR':_0xf2a9('0x7'),'E_AGI_SOCKET_CLOSE':_0xf2a9('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xf2a9('0x9'),'E_AGI_COMMAND_EMPTY':_0xf2a9('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf2a9('0xb'),'E_AGI_IVR_ENTRY':_0xf2a9('0xc')};function AGIError(_0xd97883){var _0xd97883=_0xd97883||null,_0x504e2a=_0x504e2a||[],_0x45ffba=0x1,_0x1c69e2='';if(!error[_0xd97883]){_0xd97883=_0xf2a9('0xd');}_0x504e2a[_0xf2a9('0xe')](error[_0xd97883]);while(arguments[_0x45ffba]){_0x504e2a[_0xf2a9('0xe')](arguments[_0x45ffba]);_0x45ffba++;}_0x1c69e2=util[_0xf2a9('0xf')][_0xf2a9('0x10')](util,_0x504e2a);this[_0xf2a9('0x11')]=_0x1c69e2;this[_0xf2a9('0x12')]=_0xd97883;}module[_0xf2a9('0x13')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index e02dcc7..3ef8c37 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 _0xf4e9=['getdigits','getsecretdigits','edges','numberOfEdges','prototype','vertices','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','../../../config/logger','agi','menu'];(function(_0x732d54,_0x5708f4){var _0x55e766=function(_0x1e9b2f){while(--_0x1e9b2f){_0x732d54['push'](_0x732d54['shift']());}};_0x55e766(++_0x5708f4);}(_0xf4e9,0x1a1));var _0x9f4e=function(_0x3a7ce1,_0x43f732){_0x3a7ce1=_0x3a7ce1-0x0;var _0x4eb314=_0xf4e9[_0x3a7ce1];return _0x4eb314;};'use strict';var _=require('lodash');var logger=require(_0x9f4e('0x0'))(_0x9f4e('0x1'));var verticesWithRetry=[_0x9f4e('0x2'),_0x9f4e('0x3'),_0x9f4e('0x4')];var Graph=function(){this['vertices']={};this[_0x9f4e('0x5')]={};this[_0x9f4e('0x6')]=0x0;};Graph[_0x9f4e('0x7')]['addVertex']=function(_0xca662a){this[_0x9f4e('0x8')][_0xca662a['id']]=_0xca662a;this[_0x9f4e('0x5')][_0xca662a['id']]=[];};Graph['prototype'][_0x9f4e('0x9')]=function(_0x2031f5,_0x4d18dc,_0x25fe66){this[_0x9f4e('0x5')][_0x2031f5][_0x9f4e('0xa')]({'target':_0x4d18dc,'condition':_0x25fe66});this[_0x9f4e('0x6')]+=0x1;};Graph[_0x9f4e('0x7')][_0x9f4e('0xb')]=function(){return _[_0x9f4e('0xb')](this['vertices']);};Graph[_0x9f4e('0x7')][_0x9f4e('0xc')]=function(){return this[_0x9f4e('0x6')];};Graph['prototype'][_0x9f4e('0xd')]=function(_0x5bb4da){return this['vertices'][_0x5bb4da];};Graph['prototype'][_0x9f4e('0xe')]=function(_0x2584e6,_0x9bd65e){if(!this['vertices'][_0x2584e6]){return logger['info'](_0x9f4e('0xf'));}var _0x1ba29d=_0x9bd65e(this[_0x9f4e('0x8')][_0x2584e6]);if(!_0x1ba29d){return logger[_0x9f4e('0x10')](_0x9f4e('0x11'));}if(this[_0x9f4e('0x5')][_0x2584e6][_0x9f4e('0x12')]===0x0){return logger['info'](_0x9f4e('0x13'));}for(var _0x4acf1f=0x0,_0x45daa1=[],_0x4b9b5b=![];_0x4acf1f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','agi','defaults','127.0.0.1','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','format','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','getSquareProject','then','catch'];(function(_0x151f23,_0x533521){var _0x3c13a7=function(_0x5e0eb2){while(--_0x5e0eb2){_0x151f23['push'](_0x151f23['shift']());}};_0x3c13a7(++_0x533521);}(_0x2dbf,0xda));var _0xf2db=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x2dbf[_0x13ce0c];return _0x4388fb;};'use strict';var parser=require(_0xf2db('0x0'));var _=require('lodash');var syncho=require(_0xf2db('0x1'));var util=require('util');var moment=require(_0xf2db('0x2'));var config=require(_0xf2db('0x3'));var logger=require(_0xf2db('0x4'))('agi');var utilLicense=require(_0xf2db('0x5'));var rpc=require(_0xf2db('0x6'));var mailRpc=require(_0xf2db('0x7'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf2db('0x8')]=_[_0xf2db('0x9')](config[_0xf2db('0x8')],{'ip':_0xf2db('0xa'),'port':0x11dd});function connectionHandler(_0x517e4b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x517e4b);agiHandler(_0x517e4b);}catch(_0x598bdd){logger[_0xf2db('0xb')](_0x598bdd['stack']);}});});}function listeningHandler(){console[_0xf2db('0xc')](_0xf2db('0xd'),config['agi'][_0xf2db('0xe')]);logger[_0xf2db('0xf')](util['format'](_0xf2db('0x10'),config[_0xf2db('0x8')]['ip'],config[_0xf2db('0x8')][_0xf2db('0xe')]));}function errorHandler(_0x4c8eff){if(_0x4c8eff&&_0x4c8eff['name']&&_0x4c8eff[_0xf2db('0x11')]){logger[_0xf2db('0xb')](util[_0xf2db('0x12')](_0xf2db('0x13'),_0x4c8eff['name'],_0x4c8eff[_0xf2db('0x11')]));}else{logger[_0xf2db('0xb')](util[_0xf2db('0x12')](_0xf2db('0x14'),_0x4c8eff[_0xf2db('0x15')]));}}function closeHandler(){logger[_0xf2db('0xf')](util[_0xf2db('0x12')](_0xf2db('0x16'),this[_0xf2db('0x17')],this[_0xf2db('0x18')],this[_0xf2db('0x19')],this[_0xf2db('0x1a')],this[_0xf2db('0x1b')]));try{createSquareReport(this);}catch(_0x360569){logger[_0xf2db('0xb')](_0x360569[_0xf2db('0x15')]);}}function timeoutHandler(){logger[_0xf2db('0xf')](util[_0xf2db('0x12')](_0xf2db('0x1c'),this[_0xf2db('0x17')],this['calleridname'],this[_0xf2db('0x19')],this[_0xf2db('0x1a')],this[_0xf2db('0x1b')]));}function hangupHandler(){logger[_0xf2db('0xf')](util[_0xf2db('0x12')](_0xf2db('0x1d'),this[_0xf2db('0x17')],this[_0xf2db('0x18')],this[_0xf2db('0x19')],this[_0xf2db('0x1a')],this[_0xf2db('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x3b76be){return parser[_0xf2db('0x1e')](_0x3b76be,{'object':!![]})[_0xf2db('0x1f')]['root'];}function addVertex(_0x508c21,_0x29eba8,_0x5c40a1){_0x29eba8['agicommand']=_0x5c40a1;if(_0x29eba8['hasOwnProperty'](_0xf2db('0x20'))){_0x29eba8[_0xf2db('0x21')]=parseInt(_0x29eba8[_0xf2db('0x20')],0xa);}_0x508c21[_0xf2db('0x22')](_[_0xf2db('0x23')](_0x29eba8,_0xf2db('0x24')));}function initGraph(_0x43e571,_0x5523e7){var _0x40fffc=new Graph();for(var _0x30bc74 in _0x43e571){if(_0x43e571[_0xf2db('0x25')](_0x30bc74)){if(_['isArray'](_0x43e571[_0x30bc74])){for(var _0x114d72=0x0;_0x114d72<_0x43e571[_0x30bc74]['length'];_0x114d72+=0x1){addVertex(_0x40fffc,_0x43e571[_0x30bc74][_0x114d72],_0x30bc74);}}else{addVertex(_0x40fffc,_0x43e571[_0x30bc74],_0x30bc74);}}}for(var _0x50a70e=0x0;_0x50a70e<_0x5523e7[_0xf2db('0x26')];_0x50a70e+=0x1){if(_0x5523e7[_0x50a70e][_0xf2db('0x27')]&&_0x5523e7[_0x50a70e][_0xf2db('0x28')]){_0x40fffc[_0xf2db('0x29')](_0x5523e7[_0x50a70e][_0xf2db('0x27')],_0x5523e7[_0x50a70e][_0xf2db('0x28')],_0x5523e7[_0x50a70e][_0xf2db('0x2a')]);}}return _0x40fffc;}function getSquareProject(_0x59cabd,_0x1a1eec){rpc[_0xf2db('0x2b')](_0x59cabd)[_0xf2db('0x2c')](function(_0x5be88a){_0x1a1eec(null,_0x5be88a);})[_0xf2db('0x2d')](function(_0x113a3b){_0x1a1eec(null,_0x113a3b);});}function createSquareReport(_0x3e55f2,_0x15d862){rpc[_0xf2db('0x2e')](_0x3e55f2)[_0xf2db('0x2c')](function(_0x3ba35f){if(_0x15d862){_0x15d862(null,_0x3ba35f);}})[_0xf2db('0x2d')](function(_0x511685){if(_0x15d862){_0x15d862(null,_0x511685);}});}function setChannelVariables(_0x55e4d9){for(var _0x1b957c in _0x55e4d9){if(_0x55e4d9['hasOwnProperty'](_0x1b957c)){if(_0x1b957c['indexOf']('agi_')===0x0){_0x55e4d9[_0x1b957c['substring'](0x4)]=_0x55e4d9[_0x1b957c];delete _0x55e4d9[_0x1b957c];}}}}function getLogFromObject(_0x219e5c){return util['inspect'](_0x219e5c,{'showHidden':![],'depth':null});}function agiHandler(_0x4c522a){var _0x394eeb,_0x19aa29,_0x3b53f1,_0x288bfb,_0x8478e4;logger[_0xf2db('0x2f')]('variables',JSON[_0xf2db('0x30')](_0x4c522a,null,0x2));logger[_0xf2db('0xf')](util[_0xf2db('0x12')](_0xf2db('0x31'),_0x4c522a[_0xf2db('0x17')],_0x4c522a[_0xf2db('0x18')],_0x4c522a[_0xf2db('0x19')],_0x4c522a[_0xf2db('0x1a')],_0x4c522a[_0xf2db('0x1b')]));_0x4c522a['on'](_0xf2db('0xb'),errorHandler);_0x4c522a['on'](_0xf2db('0x32'),closeHandler);_0x4c522a['on'](_0xf2db('0x33'),timeoutHandler);_0x4c522a[_0xf2db('0x34')]=![];_0x4c522a['on'](_0xf2db('0x35'),hangupHandler);var _0x170185=getSquareProject[_0xf2db('0x36')](null,_0x4c522a[_0xf2db('0x17')]);if(_0x170185){if(_0x170185['production']){_0x394eeb=getRoot(_0x170185['production']);if(_0x394eeb&&_0x394eeb[_0xf2db('0x37')]){logger['debug'](_0xf2db('0x38'),JSON[_0xf2db('0x30')](_0x394eeb,null,0x2));_0x4c522a[_0xf2db('0x39')]=moment()[_0xf2db('0x12')](_0xf2db('0x3a'));_0x19aa29=initGraph(_[_0xf2db('0x23')](_0x394eeb,'mxCell'),_0x394eeb[_0xf2db('0x24')]);_0x3b53f1=new Vertices(_0x4c522a,rpc,mailRpc);logger[_0xf2db('0xf')](util['format'](_0xf2db('0x3b'),_0x4c522a[_0xf2db('0x17')],_0x4c522a['calleridname'],_0x4c522a['callerid'],_0x4c522a[_0xf2db('0x1a')],_0x4c522a['uniqueid']));_0x19aa29[_0xf2db('0x3c')](_0x394eeb[_0xf2db('0x37')]['id'],function(_0x3c39a7){try{_0x3c39a7=_0x3b53f1[_0xf2db('0x3d')](_0x3c39a7);logger[_0xf2db('0x2f')](_0xf2db('0x3e'),JSON['stringify'](_0x3c39a7,null,0x2));if(_0x3c39a7[_0xf2db('0x3f')]===_0xf2db('0x40')){logger[_0xf2db('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4c522a['context']=_0x3c39a7[_0xf2db('0x41')]||_0x4c522a[_0xf2db('0x41')];_0x4c522a[_0xf2db('0x42')]=_0x3c39a7[_0xf2db('0x42')];_0x4c522a[_0xf2db('0x43')]=_0x3c39a7['priority']?_0x3c39a7[_0xf2db('0x43')]-0x1:0x1;return null;}else if(_0x3c39a7&&_0x3b53f1[_0x3c39a7[_0xf2db('0x3f')]]){_0x8478e4=_0x3b53f1[_0x3c39a7['agicommand']](_0x3c39a7);logger['info'](_0xf2db('0x44'),JSON['stringify'](_0x8478e4,null,0x2));if(_0x8478e4&&_0x8478e4[_0xf2db('0x45')]===AGI_CODE_SUCCESS&&_0x8478e4[_0xf2db('0x46')]!==AGI_RESULT_ERROR&&!_0x4c522a[_0xf2db('0x34')]){logger[_0xf2db('0x2f')](_0xf2db('0x44'),getLogFromObject(_0x8478e4));return _[_0xf2db('0x47')](_0x8478e4[_0xf2db('0x46')])?null:_0x8478e4['result'][_0xf2db('0x48')]();}else{logger[_0xf2db('0xb')](_0xf2db('0x44'),getLogFromObject(_0x8478e4));return null;}}else{logger[_0xf2db('0xb')](_0xf2db('0x49'));return null;}}catch(_0x1e0a51){logger[_0xf2db('0xb')](_0x1e0a51['stack']);return null;}});if(_0x394eeb[_0xf2db('0x4a')]){logger[_0xf2db('0xf')](util['format'](_0xf2db('0x4b'),_0x4c522a['arg_1'],_0x4c522a[_0xf2db('0x18')],_0x4c522a[_0xf2db('0x19')],_0x4c522a['dnid'],_0x4c522a[_0xf2db('0x1b')]));_0x19aa29[_0xf2db('0x3c')](_0x394eeb['finally']['id'],function(_0x895c3){try{_0x895c3=_0x3b53f1[_0xf2db('0x3d')](_0x895c3);logger[_0xf2db('0x2f')](_0xf2db('0x3e'),JSON[_0xf2db('0x30')](_0x895c3,null,0x2));if(_0x895c3&&_0x3b53f1[_0x895c3[_0xf2db('0x3f')]]){_0x8478e4=_0x3b53f1[_0x895c3[_0xf2db('0x3f')]](_0x895c3);if(_0x8478e4){logger[_0xf2db('0x2f')](_0xf2db('0x44'),getLogFromObject(_0x8478e4));return _[_0xf2db('0x47')](_0x8478e4[_0xf2db('0x46')])?null:_0x8478e4[_0xf2db('0x46')]['toString']();}else{logger[_0xf2db('0xb')](_0xf2db('0x44'),getLogFromObject(_0x8478e4));return null;}}else{logger[_0xf2db('0xb')](_0xf2db('0x49'));return null;}}catch(_0x310783){logger['error'](_0x310783[_0xf2db('0x15')]);return null;}});}logger[_0xf2db('0xf')](util[_0xf2db('0x12')](_0xf2db('0x4c'),_0x4c522a['arg_1'],_0x4c522a[_0xf2db('0x18')],_0x4c522a[_0xf2db('0x19')],_0x4c522a[_0xf2db('0x1a')],_0x4c522a[_0xf2db('0x1b')]));logger[_0xf2db('0xf')](util[_0xf2db('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4c522a[_0xf2db('0x41')],_0x4c522a[_0xf2db('0x42')],parseInt(_0x4c522a[_0xf2db('0x43')],0xa)+0x1));_0x4c522a[_0xf2db('0x4d')](_0x4c522a[_0xf2db('0x41')],_0x4c522a[_0xf2db('0x42')],parseInt(_0x4c522a[_0xf2db('0x43')],0xa)+0x1);_0x4c522a[_0xf2db('0x32')]();}}else{logger[_0xf2db('0xb')](util[_0xf2db('0x12')]('Project\x20%s\x20not\x20published',_0x4c522a[_0xf2db('0x17')]));_0x4c522a['continueAt'](_0x4c522a['context'],_0x4c522a[_0xf2db('0x42')],parseInt(_0x4c522a['priority'],0xa)+0x1);_0x4c522a['close']();}}else{logger['error'](util[_0xf2db('0x12')](_0xf2db('0x4e'),_0x4c522a[_0xf2db('0x17')]));_0x4c522a[_0xf2db('0x4d')](_0x4c522a['context'],_0x4c522a[_0xf2db('0x42')],parseInt(_0x4c522a['priority'],0xa)+0x1);_0x4c522a[_0xf2db('0x32')]();}}function main(){var _0x1f73c4;return utilLicense[_0xf2db('0x4f')]()[_0xf2db('0x2c')](function(_0x31d939){if(_0x31d939){if(_0x31d939[_0xf2db('0x50')]){if(_0x31d939[_0xf2db('0x51')]&&_0x31d939[_0xf2db('0x51')]>0x0){logger[_0xf2db('0xf')](util[_0xf2db('0x12')](_0xf2db('0x52'),_0x31d939[_0xf2db('0x51')]));_0x1f73c4=_0x31d939['callysquare'];}else{logger[_0xf2db('0xf')](_0xf2db('0x53'));}}else{logger[_0xf2db('0xf')](_0xf2db('0x54'));_0x1f73c4=-0x1;}}})[_0xf2db('0x2d')](function(_0x561674){logger[_0xf2db('0xb')]('[LICENSE]',_0x561674[_0xf2db('0x15')]);})[_0xf2db('0x4a')](function(){var _0x41144c=require(_0xf2db('0x55'))(config['agi'][_0xf2db('0xe')],config[_0xf2db('0x8')]['ip'],_0x1f73c4);_0x41144c['on'](_0xf2db('0xb'),errorHandler);_0x41144c['on'](_0xf2db('0x56'),listeningHandler);_0x41144c['on'](_0xf2db('0x57'),connectionHandler);_0x41144c['on'](_0xf2db('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0x1c15=['toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','addEdge','source','target','getSquareProject','then','catch','createSquareReport','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','syncho','util','moment','../../config/environment','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','error','[%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','dnid','callerid','uniqueid','info','evtHangup'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x1c15,0x94));var _0x51c1=function(_0x1581bc,_0x23b9de){_0x1581bc=_0x1581bc-0x0;var _0x5e7936=_0x1c15[_0x1581bc];return _0x5e7936;};'use strict';var parser=require(_0x51c1('0x0'));var _=require(_0x51c1('0x1'));var syncho=require(_0x51c1('0x2'));var util=require(_0x51c1('0x3'));var moment=require(_0x51c1('0x4'));var config=require(_0x51c1('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0x51c1('0x6'));var mailRpc=require(_0x51c1('0x7'));var Graph=require(_0x51c1('0x8'));var Vertices=require(_0x51c1('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x51c1('0xa')]=_[_0x51c1('0xb')](config[_0x51c1('0xa')],{'ip':_0x51c1('0xc'),'port':0x11dd});function connectionHandler(_0x1adb59){process[_0x51c1('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1adb59);agiHandler(_0x1adb59);}catch(_0x35caaf){logger['error'](_0x35caaf[_0x51c1('0xe')]);}});});}function listeningHandler(){console[_0x51c1('0xf')](_0x51c1('0x10'),config[_0x51c1('0xa')]['port']);logger['info'](util[_0x51c1('0x11')](_0x51c1('0x12'),config[_0x51c1('0xa')]['ip'],config[_0x51c1('0xa')][_0x51c1('0x13')]));}function errorHandler(_0x30a562){if(_0x30a562&&_0x30a562['name']&&_0x30a562[_0x51c1('0x14')]){logger[_0x51c1('0x15')](util['format'](_0x51c1('0x16'),_0x30a562['name'],_0x30a562[_0x51c1('0x14')]));}else{logger[_0x51c1('0x15')](util[_0x51c1('0x11')](_0x51c1('0x17'),_0x30a562[_0x51c1('0xe')]));}}function closeHandler(){logger['info'](util['format'](_0x51c1('0x18'),this[_0x51c1('0x19')],this[_0x51c1('0x1a')],this['callerid'],this[_0x51c1('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x36803b){logger['error'](_0x36803b['stack']);}}function timeoutHandler(){logger['info'](util[_0x51c1('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x51c1('0x1a')],this[_0x51c1('0x1c')],this[_0x51c1('0x1b')],this[_0x51c1('0x1d')]));}function hangupHandler(){logger[_0x51c1('0x1e')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x51c1('0x19')],this[_0x51c1('0x1a')],this['callerid'],this[_0x51c1('0x1b')],this[_0x51c1('0x1d')]));this[_0x51c1('0x1f')]=!![];}function getRoot(_0x3a40ef){return parser[_0x51c1('0x20')](_0x3a40ef,{'object':!![]})[_0x51c1('0x21')][_0x51c1('0x22')];}function addVertex(_0x9b0644,_0x69c7fa,_0x19c41a){_0x69c7fa[_0x51c1('0x23')]=_0x19c41a;if(_0x69c7fa[_0x51c1('0x24')](_0x51c1('0x25'))){_0x69c7fa['maxRetry']=parseInt(_0x69c7fa[_0x51c1('0x25')],0xa);}_0x9b0644[_0x51c1('0x26')](_[_0x51c1('0x27')](_0x69c7fa,_0x51c1('0x28')));}function initGraph(_0x357c53,_0x6b15ac){var _0x33d43a=new Graph();for(var _0x456522 in _0x357c53){if(_0x357c53[_0x51c1('0x24')](_0x456522)){if(_[_0x51c1('0x29')](_0x357c53[_0x456522])){for(var _0x456135=0x0;_0x456135<_0x357c53[_0x456522][_0x51c1('0x2a')];_0x456135+=0x1){addVertex(_0x33d43a,_0x357c53[_0x456522][_0x456135],_0x456522);}}else{addVertex(_0x33d43a,_0x357c53[_0x456522],_0x456522);}}}for(var _0x57f270=0x0;_0x57f270<_0x6b15ac[_0x51c1('0x2a')];_0x57f270+=0x1){if(_0x6b15ac[_0x57f270]['source']&&_0x6b15ac[_0x57f270]['target']){_0x33d43a[_0x51c1('0x2b')](_0x6b15ac[_0x57f270][_0x51c1('0x2c')],_0x6b15ac[_0x57f270][_0x51c1('0x2d')],_0x6b15ac[_0x57f270]['value']);}}return _0x33d43a;}function getSquareProject(_0x49183f,_0x3c1714){rpc[_0x51c1('0x2e')](_0x49183f)[_0x51c1('0x2f')](function(_0x4412ce){_0x3c1714(null,_0x4412ce);})[_0x51c1('0x30')](function(_0x4412d5){_0x3c1714(null,_0x4412d5);});}function createSquareReport(_0xa101b,_0x1a44b7){rpc[_0x51c1('0x31')](_0xa101b)[_0x51c1('0x2f')](function(_0x3383b0){if(_0x1a44b7){_0x1a44b7(null,_0x3383b0);}})['catch'](function(_0x2c07d0){if(_0x1a44b7){_0x1a44b7(null,_0x2c07d0);}});}function setChannelVariables(_0x253f2c){for(var _0x1b8052 in _0x253f2c){if(_0x253f2c[_0x51c1('0x24')](_0x1b8052)){if(_0x1b8052[_0x51c1('0x32')]('agi_')===0x0){_0x253f2c[_0x1b8052[_0x51c1('0x33')](0x4)]=_0x253f2c[_0x1b8052];delete _0x253f2c[_0x1b8052];}}}}function getLogFromObject(_0x54b070){return util['inspect'](_0x54b070,{'showHidden':![],'depth':null});}function agiHandler(_0x566b5c){var _0x196d99,_0x59baf3,_0x5e290b,_0xa44017,_0x297654;logger[_0x51c1('0x34')](_0x51c1('0x35'),JSON[_0x51c1('0x36')](_0x566b5c,null,0x2));logger['info'](util[_0x51c1('0x11')](_0x51c1('0x37'),_0x566b5c['arg_1'],_0x566b5c[_0x51c1('0x1a')],_0x566b5c[_0x51c1('0x1c')],_0x566b5c[_0x51c1('0x1b')],_0x566b5c[_0x51c1('0x1d')]));_0x566b5c['on'](_0x51c1('0x15'),errorHandler);_0x566b5c['on']('close',closeHandler);_0x566b5c['on'](_0x51c1('0x38'),timeoutHandler);_0x566b5c['evtHangup']=![];_0x566b5c['on']('hangup',hangupHandler);var _0x5ddde4=getSquareProject[_0x51c1('0x39')](null,_0x566b5c[_0x51c1('0x19')]);if(_0x5ddde4){if(_0x5ddde4[_0x51c1('0x3a')]){_0x196d99=getRoot(_0x5ddde4['production']);if(_0x196d99&&_0x196d99['start']){logger[_0x51c1('0x34')]('root',JSON[_0x51c1('0x36')](_0x196d99,null,0x2));_0x566b5c[_0x51c1('0x3b')]=moment()['format'](_0x51c1('0x3c'));_0x59baf3=initGraph(_[_0x51c1('0x27')](_0x196d99,'mxCell'),_0x196d99['mxCell']);_0x5e290b=new Vertices(_0x566b5c,rpc,mailRpc);logger[_0x51c1('0x1e')](util['format'](_0x51c1('0x3d'),_0x566b5c[_0x51c1('0x19')],_0x566b5c[_0x51c1('0x1a')],_0x566b5c[_0x51c1('0x1c')],_0x566b5c[_0x51c1('0x1b')],_0x566b5c[_0x51c1('0x1d')]));_0x59baf3[_0x51c1('0x3e')](_0x196d99[_0x51c1('0x3f')]['id'],function(_0x480cf3){try{_0x480cf3=_0x5e290b[_0x51c1('0x40')](_0x480cf3);logger[_0x51c1('0x34')](_0x51c1('0x41'),JSON[_0x51c1('0x36')](_0x480cf3,null,0x2));if(_0x480cf3[_0x51c1('0x23')]===_0x51c1('0x42')){logger[_0x51c1('0x1e')](_0x51c1('0x43'));_0x566b5c[_0x51c1('0x44')]=_0x480cf3[_0x51c1('0x44')]||_0x566b5c[_0x51c1('0x44')];_0x566b5c[_0x51c1('0x45')]=_0x480cf3[_0x51c1('0x45')];_0x566b5c[_0x51c1('0x46')]=_0x480cf3[_0x51c1('0x46')]?_0x480cf3[_0x51c1('0x46')]-0x1:0x1;return null;}else if(_0x480cf3&&_0x5e290b[_0x480cf3[_0x51c1('0x23')]]){_0x297654=_0x5e290b[_0x480cf3[_0x51c1('0x23')]](_0x480cf3);logger[_0x51c1('0x1e')](_0x51c1('0x47'),JSON['stringify'](_0x297654,null,0x2));if(_0x297654&&_0x297654['code']===AGI_CODE_SUCCESS&&_0x297654['result']!==AGI_RESULT_ERROR&&!_0x566b5c['evtHangup']){logger['debug'](_0x51c1('0x47'),getLogFromObject(_0x297654));return _['isUndefined'](_0x297654[_0x51c1('0x48')])?null:_0x297654[_0x51c1('0x48')][_0x51c1('0x49')]();}else{logger[_0x51c1('0x15')](_0x51c1('0x47'),getLogFromObject(_0x297654));return null;}}else{logger[_0x51c1('0x15')](_0x51c1('0x4a'));return null;}}catch(_0x46f26b){logger[_0x51c1('0x15')](_0x46f26b[_0x51c1('0xe')]);return null;}});if(_0x196d99['finally']){logger[_0x51c1('0x1e')](util[_0x51c1('0x11')](_0x51c1('0x4b'),_0x566b5c[_0x51c1('0x19')],_0x566b5c[_0x51c1('0x1a')],_0x566b5c['callerid'],_0x566b5c[_0x51c1('0x1b')],_0x566b5c[_0x51c1('0x1d')]));_0x59baf3[_0x51c1('0x3e')](_0x196d99[_0x51c1('0x4c')]['id'],function(_0x50cef3){try{_0x50cef3=_0x5e290b[_0x51c1('0x40')](_0x50cef3);logger[_0x51c1('0x34')](_0x51c1('0x41'),JSON['stringify'](_0x50cef3,null,0x2));if(_0x50cef3&&_0x5e290b[_0x50cef3[_0x51c1('0x23')]]){_0x297654=_0x5e290b[_0x50cef3[_0x51c1('0x23')]](_0x50cef3);if(_0x297654){logger[_0x51c1('0x34')](_0x51c1('0x47'),getLogFromObject(_0x297654));return _[_0x51c1('0x4d')](_0x297654[_0x51c1('0x48')])?null:_0x297654[_0x51c1('0x48')]['toString']();}else{logger['error'](_0x51c1('0x47'),getLogFromObject(_0x297654));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x2aa2a2){logger[_0x51c1('0x15')](_0x2aa2a2[_0x51c1('0xe')]);return null;}});}logger[_0x51c1('0x1e')](util[_0x51c1('0x11')](_0x51c1('0x4e'),_0x566b5c['arg_1'],_0x566b5c[_0x51c1('0x1a')],_0x566b5c['callerid'],_0x566b5c[_0x51c1('0x1b')],_0x566b5c[_0x51c1('0x1d')]));logger[_0x51c1('0x1e')](util['format'](_0x51c1('0x4f'),_0x566b5c['context'],_0x566b5c[_0x51c1('0x45')],parseInt(_0x566b5c[_0x51c1('0x46')],0xa)+0x1));_0x566b5c[_0x51c1('0x50')](_0x566b5c[_0x51c1('0x44')],_0x566b5c[_0x51c1('0x45')],parseInt(_0x566b5c[_0x51c1('0x46')],0xa)+0x1);_0x566b5c[_0x51c1('0x51')]();}}else{logger[_0x51c1('0x15')](util[_0x51c1('0x11')]('Project\x20%s\x20not\x20published',_0x566b5c[_0x51c1('0x19')]));_0x566b5c[_0x51c1('0x50')](_0x566b5c[_0x51c1('0x44')],_0x566b5c['extension'],parseInt(_0x566b5c[_0x51c1('0x46')],0xa)+0x1);_0x566b5c[_0x51c1('0x51')]();}}else{logger[_0x51c1('0x15')](util[_0x51c1('0x11')](_0x51c1('0x52'),_0x566b5c[_0x51c1('0x19')]));_0x566b5c[_0x51c1('0x50')](_0x566b5c[_0x51c1('0x44')],_0x566b5c['extension'],parseInt(_0x566b5c['priority'],0xa)+0x1);_0x566b5c[_0x51c1('0x51')]();}}function main(){var _0x222433;return utilLicense['getLicense']()['then'](function(_0x2b06d1){if(_0x2b06d1){if(_0x2b06d1['voice']){if(_0x2b06d1['callysquare']&&_0x2b06d1[_0x51c1('0x53')]>0x0){logger[_0x51c1('0x1e')](util[_0x51c1('0x11')](_0x51c1('0x54'),_0x2b06d1['callysquare']));_0x222433=_0x2b06d1[_0x51c1('0x53')];}else{logger[_0x51c1('0x1e')](_0x51c1('0x55'));}}else{logger['info'](_0x51c1('0x56'));_0x222433=-0x1;}}})[_0x51c1('0x30')](function(_0x5c6af1){logger[_0x51c1('0x15')](_0x51c1('0x57'),_0x5c6af1['stack']);})[_0x51c1('0x4c')](function(){var _0xd1b9f9=require(_0x51c1('0x58'))(config[_0x51c1('0xa')][_0x51c1('0x13')],config['agi']['ip'],_0x222433);_0xd1b9f9['on']('error',errorHandler);_0xd1b9f9['on']('listening',listeningHandler);_0xd1b9f9['on'](_0x51c1('0x59'),connectionHandler);_0xd1b9f9['on'](_0x51c1('0x51'),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 15190fb..3575af0 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 _0x96ac=['catch','sendMailMessage','SendMail','jayson/promise','client','http','then','error','message','result'];(function(_0x24cf7f,_0xcda231){var _0x4c6742=function(_0x2469db){while(--_0x2469db){_0x24cf7f['push'](_0x24cf7f['shift']());}};_0x4c6742(++_0xcda231);}(_0x96ac,0x139));var _0xc96a=function(_0x28fdc0,_0x4222f4){_0x28fdc0=_0x28fdc0-0x0;var _0x9b6bb1=_0x96ac[_0x28fdc0];return _0x9b6bb1;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc96a('0x0'));var client=jayson[_0xc96a('0x1')][_0xc96a('0x2')]({'port':0x232b});function request(_0x5195e9,_0x378973){return new BPromise(function(_0xed20ea,_0x40620c){return client['request'](_0x5195e9,_0x378973)[_0xc96a('0x3')](function(_0xf33cb8){if(_0xf33cb8[_0xc96a('0x4')]){return _0x40620c(_0xf33cb8[_0xc96a('0x4')][_0xc96a('0x5')]);}else{return _0xed20ea(_0xf33cb8[_0xc96a('0x6')]);}})[_0xc96a('0x7')](function(_0x53bd55){return _0x40620c(_0x53bd55);});});}exports[_0xc96a('0x8')]=function(_0x2d6d31,_0x4f7c8b){return request(_0xc96a('0x9'),{'account':_0x2d6d31,'message':_0x4f7c8b});}; \ No newline at end of file +var _0x078a=['client','http','error','message','sendMailMessage','SendMail','jayson/promise'];(function(_0x3e90a9,_0x5c8248){var _0x38c610=function(_0x217f55){while(--_0x217f55){_0x3e90a9['push'](_0x3e90a9['shift']());}};_0x38c610(++_0x5c8248);}(_0x078a,0x1db));var _0xa078=function(_0x5a1ce1,_0x2095e9){_0x5a1ce1=_0x5a1ce1-0x0;var _0x178be=_0x078a[_0x5a1ce1];return _0x178be;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa078('0x0'));var client=jayson[_0xa078('0x1')][_0xa078('0x2')]({'port':0x232b});function request(_0x1f1a85,_0x9c9d6f){return new BPromise(function(_0x7bfd84,_0x28b911){return client['request'](_0x1f1a85,_0x9c9d6f)['then'](function(_0x598227){if(_0x598227[_0xa078('0x3')]){return _0x28b911(_0x598227[_0xa078('0x3')][_0xa078('0x4')]);}else{return _0x7bfd84(_0x598227['result']);}})['catch'](function(_0x38b6c1){return _0x28b911(_0x38b6c1);});});}exports[_0xa078('0x5')]=function(_0x5866f5,_0x3ece53){return request(_0xa078('0x6'),{'account':_0x5866f5,'message':_0x3ece53});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 7b06454..c1c91ff 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 _0xdf0a=['util','stream','Transform','call','_inBody','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','split','slice','trim','emit','headers'];(function(_0x46f970,_0x29f7bf){var _0x1a7569=function(_0x38d37d){while(--_0x38d37d){_0x46f970['push'](_0x46f970['shift']());}};_0x1a7569(++_0x29f7bf);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x73334a,_0x3bc18d){_0x73334a=_0x73334a-0x0;var _0x4d1fa7=_0xdf0a[_0x73334a];return _0x4d1fa7;};'use strict';var util=require(_0xadf0('0x0'));var Transform=require(_0xadf0('0x1'))[_0xadf0('0x2')];function AGIReply(_0x1493c5){Transform[_0xadf0('0x3')](this,_0x1493c5);this['_localBuffer']='';this[_0xadf0('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0xadf0('0x5')]=function(_0x1c5842,_0x4b2e77,_0x2bb29c){var _0x41b3f1='\x0a',_0x2944a8=['\x0a\x0a',_0xadf0('0x6')],_0x1a932b=-0x1,_0x40ec92=-0x1,_0x4468b9='',_0x367637=0x0,_0x23da16='',_0x5a5f63='';this[_0xadf0('0x7')]+=_0x1c5842[_0xadf0('0x8')]();_0x23da16=this[_0xadf0('0x7')];if(!this['_inBody']){_0x367637=0x0;while(_0x2944a8[_0x367637]){while((_0x40ec92=_0x23da16[_0xadf0('0x9')](_0x2944a8[_0x367637]))!=-0x1){_0x4468b9=_0x2944a8[_0x367637];_0x5a5f63=_0x23da16[_0xadf0('0xa')](0x0,_0x40ec92);_0x23da16=_0x23da16[_0xadf0('0xa')](_0x40ec92+_0x4468b9[_0xadf0('0xb')]);var _0x4619e9=_0x5a5f63[_0xadf0('0xc')](_0x41b3f1),_0x579993=0x0,_0x137847={},_0x2fcb9f='',_0x216dec='',_0x1fcefa=-0x1;while(_0x4619e9[_0x579993]){_0x1fcefa=_0x4619e9[_0x579993][_0xadf0('0x9')](':');if(_0x1fcefa!=-0x1){_0x2fcb9f=_0x4619e9[_0x579993][_0xadf0('0xd')](0x0,_0x1fcefa)['trim']();_0x216dec=_0x4619e9[_0x579993][_0xadf0('0xd')](_0x1fcefa+0x1)[_0xadf0('0xe')]();if(_0x2fcb9f[_0xadf0('0xb')]>0x0){_0x137847[_0x2fcb9f]=_0x216dec;}}else{}_0x579993++;}this[_0xadf0('0xf')](_0xadf0('0x10'),_0x137847);this[_0xadf0('0x4')]=!![];}_0x367637++;}this[_0xadf0('0x7')]=_0x23da16;}else{while((_0x1a932b=_0x23da16[_0xadf0('0x9')](_0x41b3f1))!=-0x1){_0x5a5f63=_0x23da16[_0xadf0('0xa')](0x0,_0x1a932b);this[_0xadf0('0xf')]('line',_0x5a5f63);_0x23da16=_0x23da16[_0xadf0('0xa')](_0x1a932b+_0x41b3f1[_0xadf0('0xb')]);}this[_0xadf0('0x7')]=_0x23da16;}_0x2bb29c();};module['exports']=AGIReply; \ No newline at end of file +var _0xb9a7=['line','exports','stream','_localBuffer','inherits','prototype','_transform','toString','indexOf','substring','slice','trim','length','emit','headers','_inBody'];(function(_0x3be567,_0x5cf030){var _0x11b9d9=function(_0x103326){while(--_0x103326){_0x3be567['push'](_0x3be567['shift']());}};_0x11b9d9(++_0x5cf030);}(_0xb9a7,0x112));var _0x7b9a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb9a7[_0x209941];return _0x1e8729;};'use strict';var util=require('util');var Transform=require(_0x7b9a('0x0'))['Transform'];function AGIReply(_0x563857){Transform['call'](this,_0x563857);this[_0x7b9a('0x1')]='';this['_inBody']=![];}util[_0x7b9a('0x2')](AGIReply,Transform);AGIReply[_0x7b9a('0x3')][_0x7b9a('0x4')]=function(_0x24cae3,_0x5cd5da,_0xf6dae2){var _0x22764f='\x0a',_0x7019fd=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x37ce81=-0x1,_0x3e51f0=-0x1,_0x4d3f20='',_0x43d8e2=0x0,_0x3e84f1='',_0x56a199='';this['_localBuffer']+=_0x24cae3[_0x7b9a('0x5')]();_0x3e84f1=this[_0x7b9a('0x1')];if(!this['_inBody']){_0x43d8e2=0x0;while(_0x7019fd[_0x43d8e2]){while((_0x3e51f0=_0x3e84f1[_0x7b9a('0x6')](_0x7019fd[_0x43d8e2]))!=-0x1){_0x4d3f20=_0x7019fd[_0x43d8e2];_0x56a199=_0x3e84f1['substring'](0x0,_0x3e51f0);_0x3e84f1=_0x3e84f1[_0x7b9a('0x7')](_0x3e51f0+_0x4d3f20['length']);var _0x3af176=_0x56a199['split'](_0x22764f),_0x1584a2=0x0,_0x291591={},_0x5948ca='',_0x32f616='',_0xec5949=-0x1;while(_0x3af176[_0x1584a2]){_0xec5949=_0x3af176[_0x1584a2][_0x7b9a('0x6')](':');if(_0xec5949!=-0x1){_0x5948ca=_0x3af176[_0x1584a2][_0x7b9a('0x8')](0x0,_0xec5949)['trim']();_0x32f616=_0x3af176[_0x1584a2][_0x7b9a('0x8')](_0xec5949+0x1)[_0x7b9a('0x9')]();if(_0x5948ca[_0x7b9a('0xa')]>0x0){_0x291591[_0x5948ca]=_0x32f616;}}else{}_0x1584a2++;}this[_0x7b9a('0xb')](_0x7b9a('0xc'),_0x291591);this[_0x7b9a('0xd')]=!![];}_0x43d8e2++;}this[_0x7b9a('0x1')]=_0x3e84f1;}else{while((_0x37ce81=_0x3e84f1[_0x7b9a('0x6')](_0x22764f))!=-0x1){_0x56a199=_0x3e84f1[_0x7b9a('0x7')](0x0,_0x37ce81);this['emit'](_0x7b9a('0xe'),_0x56a199);_0x3e84f1=_0x3e84f1['substring'](_0x37ce81+_0x22764f[_0x7b9a('0xa')]);}this[_0x7b9a('0x1')]=_0x3e84f1;}_0xf6dae2();};module[_0x7b9a('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 88ef0d1..82b2ac3 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 _0xad78=['MailServerOut','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','util','jayson/promise','http','request','then','error','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount'];(function(_0x45903d,_0x4fd5bf){var _0x31f18b=function(_0x34f24a){while(--_0x34f24a){_0x45903d['push'](_0x45903d['shift']());}};_0x31f18b(++_0x4fd5bf);}(_0xad78,0x149));var _0x8ad7=function(_0x38549e,_0x33cd09){_0x38549e=_0x38549e-0x0;var _0x577eb7=_0xad78[_0x38549e];return _0x577eb7;};'use strict';var BPromise=require(_0x8ad7('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x8ad7('0x1'));var jayson=require(_0x8ad7('0x2'));var client=jayson['client'][_0x8ad7('0x3')]({'port':0x2329});function request(_0x469153,_0x2daf59){return new BPromise(function(_0x296a52,_0x1baf32){return client[_0x8ad7('0x4')](_0x469153,_0x2daf59)[_0x8ad7('0x5')](function(_0x4301d4){if(_0x4301d4[_0x8ad7('0x6')]){return _0x1baf32(_0x4301d4[_0x8ad7('0x6')]['message']);}else{return _0x296a52(_0x4301d4['result']);}})[_0x8ad7('0x7')](function(_0x45666f){return _0x1baf32(_0x45666f);});});}exports[_0x8ad7('0x8')]=function(_0x152b82){return request(_0x8ad7('0x9'),{'options':{'raw':![],'where':{'name':_0x152b82},'attributes':[_0x8ad7('0xa')]}});};exports[_0x8ad7('0xb')]=function(_0x4929ca){return request(_0x8ad7('0xc'),{'options':{'raw':![],'where':{'id':_0x4929ca},'include':[{'model':_0x8ad7('0xd'),'as':_0x8ad7('0xe')}],'attributes':['id','name',_0x8ad7('0xf')]}});};exports[_0x8ad7('0x10')]=function(_0x2ba2b1){return request(_0x8ad7('0x9'),{'options':{'where':{'id':_0x2ba2b1},'attributes':[_0x8ad7('0x11')]}});};exports[_0x8ad7('0x12')]=function(_0x218072){return request(_0x8ad7('0x13'),{'options':{'where':{'id':_0x218072},'attributes':[_0x8ad7('0x11')]}});};exports[_0x8ad7('0x14')]=function(_0x2040b5){return request('ShowVariable',{'options':{'where':{'id':_0x2040b5},'attributes':['name']}});};exports[_0x8ad7('0x15')]=function(_0x5ccbf7){return request(_0x8ad7('0x16'),{'options':{'where':{'id':_0x5ccbf7},'attributes':[_0x8ad7('0x17')]}});};exports['getUserById']=function(_0x51ead4){return request(_0x8ad7('0x18'),{'options':{'where':{'id':_0x51ead4},'attributes':[_0x8ad7('0x11')]}});};exports[_0x8ad7('0x19')]=function(_0x429dd1){return request(_0x8ad7('0x1a'),{'options':{'where':{'phone':_0x429dd1[_0x8ad7('0x1b')]},'attributes':['id']}});};exports[_0x8ad7('0x1c')]=function(_0x4aaef9){return request('ShowTrunk',{'options':{'where':{'id':_0x4aaef9},'attributes':['name']}});};exports[_0x8ad7('0x1d')]=function(_0x596e6e){return request(_0x8ad7('0x1e'),{'options':{'where':{'id':_0x596e6e},'attributes':[_0x8ad7('0x1f')]}});};exports[_0x8ad7('0x20')]=function(_0x511d6c){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x511d6c},'include':[{'model':'Interval','as':_0x8ad7('0x21')}]}});};exports['getSmsAccountById']=function(_0x50c568){return request(_0x8ad7('0x22'),{'options':{'where':{'id':_0x50c568},'attributes':['id',_0x8ad7('0x11')]}});};exports[_0x8ad7('0x23')]=function(_0x4f75a7){return request(_0x8ad7('0x24'),{'body':_0x4f75a7});};exports[_0x8ad7('0x25')]=function(_0x40845d){return request(_0x8ad7('0x26'),{'body':_0x40845d});};exports[_0x8ad7('0x27')]=function(_0x429b7f){return request('CreateSquareReport',{'body':_[_0x8ad7('0x28')](_0x429b7f,{'project_name':_0x429b7f[_0x8ad7('0x29')],'prev_project_name':_0x429b7f['arg_2']||'','is_subproject':_0x429b7f[_0x8ad7('0x2a')]?!![]:![],'leaveAt':moment()[_0x8ad7('0x2b')](_0x8ad7('0x2c'))})});};exports[_0x8ad7('0x2d')]=function(_0x1b7e0a){return request(_0x8ad7('0x2e'),{'body':_0x1b7e0a});};exports[_0x8ad7('0x2f')]=function(_0x5568d5){return request('CreateSquareMessage',{'body':_0x5568d5});};exports[_0x8ad7('0x30')]=function(_0x5253c0){return request(_0x8ad7('0x31'),{'options':{'raw':![],'where':{'phone':_0x5253c0[_0x8ad7('0x1b')],'ListId':_0x5253c0['ListId']}}})[_0x8ad7('0x5')](function(_0x353578){if(_0x353578){return _0x353578;}return request(_0x8ad7('0x32'),{'body':_0x5253c0});});};exports['getPauseById']=function(_0x317c31){return request('ShowPause',{'options':{'where':{'id':_0x317c31},'attributes':['name']}});};exports['agentLogin']=function(_0x46dc32,_0x115c9d){return request(_0x8ad7('0x33'),{'body':{'interface':_0x115c9d},'options':{'where':_0x46dc32}});};exports[_0x8ad7('0x34')]=function(_0x3fd891,_0x234cda,_0x23b5cf){return request(_0x8ad7('0x35'),{'body':{'type':_0x234cda,'uniqueid':_0x23b5cf},'options':{'where':_0x3fd891}});};exports[_0x8ad7('0x36')]=function(_0x470af1){return request('UnpauseUser',{'body':{},'options':{'where':_0x470af1}});};exports[_0x8ad7('0x37')]=function(_0xac4ac3){return request(_0x8ad7('0x38'),{'body':{},'options':{'where':_0xac4ac3}});}; \ No newline at end of file +var _0xad36=['ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','moment','lodash','util','jayson/promise','client','http','request','then','error','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact'];(function(_0x1ff48c,_0x21dd25){var _0x5b99ff=function(_0x7a8cd3){while(--_0x7a8cd3){_0x1ff48c['push'](_0x1ff48c['shift']());}};_0x5b99ff(++_0x21dd25);}(_0xad36,0x11c));var _0x6ad3=function(_0x2f28d3,_0x2b01e9){_0x2f28d3=_0x2f28d3-0x0;var _0x29a049=_0xad36[_0x2f28d3];return _0x29a049;};'use strict';var BPromise=require('bluebird');var moment=require(_0x6ad3('0x0'));var _=require(_0x6ad3('0x1'));var util=require(_0x6ad3('0x2'));var jayson=require(_0x6ad3('0x3'));var client=jayson[_0x6ad3('0x4')][_0x6ad3('0x5')]({'port':0x2329});function request(_0xef54ab,_0x17a9b2){return new BPromise(function(_0x3d8fee,_0x4bc79b){return client[_0x6ad3('0x6')](_0xef54ab,_0x17a9b2)[_0x6ad3('0x7')](function(_0x3c3041){if(_0x3c3041[_0x6ad3('0x8')]){return _0x4bc79b(_0x3c3041['error']['message']);}else{return _0x3d8fee(_0x3c3041['result']);}})['catch'](function(_0x1a5790){return _0x4bc79b(_0x1a5790);});});}exports[_0x6ad3('0x9')]=function(_0x363032){return request(_0x6ad3('0xa'),{'options':{'raw':![],'where':{'name':_0x363032},'attributes':[_0x6ad3('0xb')]}});};exports[_0x6ad3('0xc')]=function(_0x22dbd1){return request(_0x6ad3('0xd'),{'options':{'raw':![],'where':{'id':_0x22dbd1},'include':[{'model':_0x6ad3('0xe'),'as':'Smtp'}],'attributes':['id',_0x6ad3('0xf'),_0x6ad3('0x10')]}});};exports[_0x6ad3('0x11')]=function(_0xb3961d){return request(_0x6ad3('0xa'),{'options':{'where':{'id':_0xb3961d},'attributes':[_0x6ad3('0xf')]}});};exports[_0x6ad3('0x12')]=function(_0x96fe49){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x96fe49},'attributes':[_0x6ad3('0xf')]}});};exports['getVariableById']=function(_0x14418f){return request(_0x6ad3('0x13'),{'options':{'where':{'id':_0x14418f},'attributes':[_0x6ad3('0xf')]}});};exports[_0x6ad3('0x14')]=function(_0x2e1ba0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2e1ba0},'attributes':[_0x6ad3('0x15')]}});};exports[_0x6ad3('0x16')]=function(_0xf81b3){return request('ShowUser',{'options':{'where':{'id':_0xf81b3},'attributes':['name']}});};exports['getContactByPhone']=function(_0x4ea840){return request(_0x6ad3('0x17'),{'options':{'where':{'phone':_0x4ea840['phone']},'attributes':['id']}});};exports[_0x6ad3('0x18')]=function(_0x52d10c){return request(_0x6ad3('0x19'),{'options':{'where':{'id':_0x52d10c},'attributes':[_0x6ad3('0xf')]}});};exports[_0x6ad3('0x1a')]=function(_0x3f8ce2){return request('ShowSound',{'options':{'where':{'id':_0x3f8ce2},'attributes':['save_name']}});};exports[_0x6ad3('0x1b')]=function(_0x35324a){return request(_0x6ad3('0x1c'),{'options':{'raw':![],'where':{'id':_0x35324a},'include':[{'model':_0x6ad3('0x1d'),'as':_0x6ad3('0x1e')}]}});};exports[_0x6ad3('0x1f')]=function(_0x19ff5e){return request(_0x6ad3('0x20'),{'options':{'where':{'id':_0x19ff5e},'attributes':['id',_0x6ad3('0xf')]}});};exports['createSmsMessage']=function(_0x33e11b){return request(_0x6ad3('0x21'),{'body':_0x33e11b});};exports[_0x6ad3('0x22')]=function(_0x1fcdf9){return request(_0x6ad3('0x23'),{'body':_0x1fcdf9});};exports[_0x6ad3('0x24')]=function(_0x4887ba){return request(_0x6ad3('0x25'),{'body':_[_0x6ad3('0x26')](_0x4887ba,{'project_name':_0x4887ba[_0x6ad3('0x27')],'prev_project_name':_0x4887ba['arg_2']||'','is_subproject':_0x4887ba['arg_2']?!![]:![],'leaveAt':moment()[_0x6ad3('0x28')](_0x6ad3('0x29'))})});};exports['createSquareRecording']=function(_0x5523d1){return request(_0x6ad3('0x2a'),{'body':_0x5523d1});};exports[_0x6ad3('0x2b')]=function(_0x527313){return request(_0x6ad3('0x2c'),{'body':_0x527313});};exports[_0x6ad3('0x2d')]=function(_0x3a8774){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3a8774['phone'],'ListId':_0x3a8774[_0x6ad3('0x2e')]}}})[_0x6ad3('0x7')](function(_0x3f1351){if(_0x3f1351){return _0x3f1351;}return request(_0x6ad3('0x2f'),{'body':_0x3a8774});});};exports['getPauseById']=function(_0x5ca9a4){return request(_0x6ad3('0x30'),{'options':{'where':{'id':_0x5ca9a4},'attributes':[_0x6ad3('0xf')]}});};exports[_0x6ad3('0x31')]=function(_0x18d3e6,_0x1602df){return request(_0x6ad3('0x32'),{'body':{'interface':_0x1602df},'options':{'where':_0x18d3e6}});};exports[_0x6ad3('0x33')]=function(_0x3929b5,_0x4ed23b,_0x3d770d){return request(_0x6ad3('0x34'),{'body':{'type':_0x4ed23b,'uniqueid':_0x3d770d},'options':{'where':_0x3929b5}});};exports['agentUnpause']=function(_0x298476){return request(_0x6ad3('0x35'),{'body':{},'options':{'where':_0x298476}});};exports[_0x6ad3('0x36')]=function(_0x623012){return request('LogoutUser',{'body':{},'options':{'where':_0x623012}});}; \ 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 0fd480a..79ba7a1 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 _0x9e2e=['exports','./polly','./lex'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9e2e,0xd6));var _0xe9e2=function(_0xb5582e,_0x4ad804){_0xb5582e=_0xb5582e-0x0;var _0x7f5350=_0x9e2e[_0xb5582e];return _0x7f5350;};var polly=require(_0xe9e2('0x0'));var lex=require(_0xe9e2('0x1'));module[_0xe9e2('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5496=['exports','./polly','./lex'];(function(_0x2e41ed,_0x26dc33){var _0xf12845=function(_0x322620){while(--_0x322620){_0x2e41ed['push'](_0x2e41ed['shift']());}};_0xf12845(++_0x26dc33);}(_0x5496,0x175));var _0x6549=function(_0x35b4ad,_0x353909){_0x35b4ad=_0x35b4ad-0x0;var _0x1487ec=_0x5496[_0x35b4ad];return _0x1487ec;};var polly=require(_0x6549('0x0'));var lex=require(_0x6549('0x1'));module[_0x6549('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 8d5dbc5..7bfdd30 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','./lib/api'];(function(_0x47c2b7,_0x286479){var _0x1bb482=function(_0x32c0dd){while(--_0x32c0dd){_0x47c2b7['push'](_0x47c2b7['shift']());}};_0x1bb482(++_0x286479);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var lex=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]=function(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1){return lex(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1);}; \ No newline at end of file +var _0x3c81=['./lib/api','exports'];(function(_0x184dad,_0x45766e){var _0x42f269=function(_0x1c2033){while(--_0x1c2033){_0x184dad['push'](_0x184dad['shift']());}};_0x42f269(++_0x45766e);}(_0x3c81,0x102));var _0x13c8=function(_0xf2b996,_0x22feac){_0xf2b996=_0xf2b996-0x0;var _0x1e2ce4=_0x3c81[_0xf2b996];return _0x1e2ce4;};'use strict';var lex=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4){return lex(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4);}; \ 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 802a9b3..8016764 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(_0x3ec02f,_0x525830){var _0x29f53d=function(_0x47f51a){while(--_0x47f51a){_0x3ec02f['push'](_0x3ec02f['shift']());}};_0x29f53d(++_0x525830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x1124e0,_0x16a838){var _0x470227=function(_0x27822f){while(--_0x27822f){_0x1124e0['push'](_0x1124e0['shift']());}};_0x470227(++_0x16a838);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 c9dad7e..f343517 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 _0x1677=['./lib/api','exports'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0x1677,0x120));var _0x7167=function(_0x2a6a22,_0x1fc1de){_0x2a6a22=_0x2a6a22-0x0;var _0x26747b=_0x1677[_0x2a6a22];return _0x26747b;};'use strict';var polly=require(_0x7167('0x0'));module[_0x7167('0x1')]=function(_0x183ea8,_0x34320c,_0x4743f8,_0x8069ca,_0x11bf73,_0x553fac,_0x586626){return polly(_0x183ea8,_0x34320c,_0x4743f8,_0x8069ca,_0x11bf73,_0x553fac,_0x586626);}; \ No newline at end of file +var _0x7b49=['./lib/api','exports'];(function(_0x3d53c1,_0x2c0236){var _0x13111e=function(_0x3b58ed){while(--_0x3b58ed){_0x3d53c1['push'](_0x3d53c1['shift']());}};_0x13111e(++_0x2c0236);}(_0x7b49,0x148));var _0x97b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7b49[_0x321bb2];return _0x9c12ed;};'use strict';var polly=require(_0x97b4('0x0'));module[_0x97b4('0x1')]=function(_0x210667,_0x56eb92,_0x57daf9,_0x14ea66,_0x22255e,_0x39a4ec,_0x5af5d1){return polly(_0x210667,_0x56eb92,_0x57daf9,_0x14ea66,_0x22255e,_0x39a4ec,_0x5af5d1);}; \ 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 48b04a7..ebdd459 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 _0x5ca3=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring'];(function(_0x5de3f3,_0x297ddf){var _0x461e0a=function(_0x2c7dd3){while(--_0x2c7dd3){_0x5de3f3['push'](_0x5de3f3['shift']());}};_0x461e0a(++_0x297ddf);}(_0x5ca3,0x14e));var _0x35ca=function(_0x129ff6,_0x450732){_0x129ff6=_0x129ff6-0x0;var _0x2626ae=_0x5ca3[_0x129ff6];return _0x2626ae;};'use strict';var fs=require('fs');var path=require(_0x35ca('0x0'));var BPromise=require('bluebird');var rs=require(_0x35ca('0x1'));var AWS=require(_0x35ca('0x2'));function pollyResult(_0x81cd5b,_0x2fd2c8,_0x1058e4){return new BPromise(function(_0x27426e,_0x5f5433){_0x81cd5b[_0x35ca('0x3')](_0x2fd2c8,function(_0x1abd39,_0x2bf7d5){if(_0x1abd39){_0x5f5433(_0x1abd39);}else if(_0x2bf7d5){if(_0x2bf7d5[_0x35ca('0x4')]instanceof Buffer){fs[_0x35ca('0x5')](_0x1058e4,_0x2bf7d5[_0x35ca('0x4')],function(_0x1b3898){if(_0x1b3898){_0x5f5433(_0x1b3898);}else{_0x27426e();}});}else{_0x5f5433(new Error(_0x35ca('0x6')));}}else{_0x5f5433(new Error(_0x35ca('0x7')));}});});}module[_0x35ca('0x8')]=function(_0x21ce21,_0x27f4dc,_0x24ae7c,_0x29a652,_0x5bc587,_0x5628d3,_0x563398){var _0x42561d=new AWS[(_0x35ca('0x9'))]({'accessKeyId':_0x21ce21,'secretAccessKey':_0x27f4dc,'region':_0x24ae7c});var _0x5ef274={'Text':_0x5bc587,'TextType':_0x5628d3||_0x35ca('0xa'),'OutputFormat':_0x35ca('0xb'),'VoiceId':_0x29a652};return pollyResult(_0x42561d,_0x5ef274,_0x563398);}; \ No newline at end of file +var _0xf770=['mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x3bb9da,_0x502962){var _0x17eef7=function(_0x94c254){while(--_0x94c254){_0x3bb9da['push'](_0x3bb9da['shift']());}};_0x17eef7(++_0x502962);}(_0xf770,0x9d));var _0x0f77=function(_0x1d54ef,_0x5d4e4c){_0x1d54ef=_0x1d54ef-0x0;var _0x5eb715=_0xf770[_0x1d54ef];return _0x5eb715;};'use strict';var fs=require('fs');var path=require(_0x0f77('0x0'));var BPromise=require(_0x0f77('0x1'));var rs=require('randomstring');var AWS=require(_0x0f77('0x2'));function pollyResult(_0x3d9e25,_0x50e476,_0x340121){return new BPromise(function(_0x34d3c7,_0x989b79){_0x3d9e25[_0x0f77('0x3')](_0x50e476,function(_0x30efd9,_0x272003){if(_0x30efd9){_0x989b79(_0x30efd9);}else if(_0x272003){if(_0x272003[_0x0f77('0x4')]instanceof Buffer){fs[_0x0f77('0x5')](_0x340121,_0x272003[_0x0f77('0x4')],function(_0x4e3a32){if(_0x4e3a32){_0x989b79(_0x4e3a32);}else{_0x34d3c7();}});}else{_0x989b79(new Error(_0x0f77('0x6')));}}else{_0x989b79(new Error(_0x0f77('0x7')));}});});}module[_0x0f77('0x8')]=function(_0x294001,_0x2ece18,_0x482c0c,_0x43fb4b,_0x32654a,_0x3afac0,_0x4b441a){var _0x33f778=new AWS[(_0x0f77('0x9'))]({'accessKeyId':_0x294001,'secretAccessKey':_0x2ece18,'region':_0x482c0c});var _0x596056={'Text':_0x32654a,'TextType':_0x3afac0||_0x0f77('0xa'),'OutputFormat':_0x0f77('0xb'),'VoiceId':_0x43fb4b};return pollyResult(_0x33f778,_0x596056,_0x4b441a);}; \ 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 13bfad8..8a9153c 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 _0x7415=['./lib/api'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0x7415,0xf9));var _0x5741=function(_0x160656,_0x7b364e){_0x160656=_0x160656-0x0;var _0x3778ae=_0x7415[_0x160656];return _0x3778ae;};'use strict';var asr=require(_0x5741('0x0'));module['exports']=function(_0x3aa431,_0x267cc0,_0x2f6701,_0x514c51){return asr(_0x3aa431,_0x267cc0,_0x2f6701);}; \ No newline at end of file +var _0xe373=['./lib/api','exports'];(function(_0x3744b2,_0xacb7bc){var _0x5e59a8=function(_0x58b937){while(--_0x58b937){_0x3744b2['push'](_0x3744b2['shift']());}};_0x5e59a8(++_0xacb7bc);}(_0xe373,0xa4));var _0x3e37=function(_0x14b9f0,_0x5ee44c){_0x14b9f0=_0x14b9f0-0x0;var _0x41db11=_0xe373[_0x14b9f0];return _0x41db11;};'use strict';var asr=require(_0x3e37('0x0'));module[_0x3e37('0x1')]=function(_0x2ec48f,_0x46d401,_0x306442,_0x3681d0){return asr(_0x2ec48f,_0x46d401,_0x306442);}; \ 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 0faf7dc..9be0811 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 _0xa902=['readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x30d093,_0x594f98){var _0x2eff88=function(_0x462c27){while(--_0x462c27){_0x30d093['push'](_0x30d093['shift']());}};_0x2eff88(++_0x594f98);}(_0xa902,0x8d));var _0x2a90=function(_0x52ee81,_0x39fb0e){_0x52ee81=_0x52ee81-0x0;var _0x45c23e=_0xa902[_0x52ee81];return _0x45c23e;};'use strict';var url=require(_0x2a90('0x0'));var BPromise=require(_0x2a90('0x1'));var fs=require('fs');var host=_0x2a90('0x2');module[_0x2a90('0x3')]=function(_0x1b4117,_0x4983a4,_0x2da982){return new BPromise(function(_0x5b4a40,_0x4961c2){var _0x169808;if(typeof _0x1b4117!==_0x2a90('0x4')||_0x1b4117[_0x2a90('0x5')]===0x0){return _0x4961c2(_0x2a90('0x6'));}if(typeof _0x4983a4!==_0x2a90('0x4')||_0x4983a4[_0x2a90('0x5')]===0x0){return _0x4961c2('key\x20should\x20be\x20a\x20string');}if(typeof _0x2da982!==_0x2a90('0x7')&&(typeof _0x2da982!=='string'||_0x2da982['length']===0x0)){return _0x4961c2(_0x2a90('0x8'));}try{_0x169808=fs[_0x2a90('0x9')](_0x1b4117)[_0x2a90('0xa')](_0x2a90('0xb'));}catch(_0x18a60e){return _0x4961c2(_0x18a60e);}return _0x5b4a40({'method':'POST','uri':host+_0x2a90('0xc')+_0x4983a4,'body':{'config':{'encoding':_0x2a90('0xd'),'sampleRateHertz':_0x2a90('0xe'),'languageCode':_0x2da982},'audio':{'content':_0x169808}},'json':!![]});});}; \ No newline at end of file +var _0x4f29=['8000','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x6afe3c,_0x161279){var _0x131eed=function(_0x28f69e){while(--_0x28f69e){_0x6afe3c['push'](_0x6afe3c['shift']());}};_0x131eed(++_0x161279);}(_0x4f29,0xfd));var _0x94f2=function(_0x526829,_0x2b0e4){_0x526829=_0x526829-0x0;var _0x42eb63=_0x4f29[_0x526829];return _0x42eb63;};'use strict';var url=require('url');var BPromise=require(_0x94f2('0x0'));var fs=require('fs');var host=_0x94f2('0x1');module[_0x94f2('0x2')]=function(_0x2a6804,_0xc16ee3,_0x36e06e){return new BPromise(function(_0x338fe2,_0x2a6535){var _0x106798;if(typeof _0x2a6804!==_0x94f2('0x3')||_0x2a6804[_0x94f2('0x4')]===0x0){return _0x2a6535('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xc16ee3!=='string'||_0xc16ee3[_0x94f2('0x4')]===0x0){return _0x2a6535(_0x94f2('0x5'));}if(typeof _0x36e06e!==_0x94f2('0x6')&&(typeof _0x36e06e!==_0x94f2('0x3')||_0x36e06e[_0x94f2('0x4')]===0x0)){return _0x2a6535('lang\x20should\x20be\x20a\x20string');}try{_0x106798=fs['readFileSync'](_0x2a6804)['toString'](_0x94f2('0x7'));}catch(_0x511952){return _0x2a6535(_0x511952);}return _0x338fe2({'method':_0x94f2('0x8'),'uri':host+_0x94f2('0x9')+_0xc16ee3,'body':{'config':{'encoding':_0x94f2('0xa'),'sampleRateHertz':_0x94f2('0xb'),'languageCode':_0x36e06e},'audio':{'content':_0x106798}},'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 ea333ab..7b6658e 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 _0xe2bd=['./asr'];(function(_0x3e6630,_0x2e1bb9){var _0xdcaf07=function(_0x36a82c){while(--_0x36a82c){_0x3e6630['push'](_0x3e6630['shift']());}};_0xdcaf07(++_0x2e1bb9);}(_0xe2bd,0x10e));var _0xde2b=function(_0x4fbf21,_0x176860){_0x4fbf21=_0x4fbf21-0x0;var _0xd977ee=_0xe2bd[_0x4fbf21];return _0xd977ee;};var asr=require(_0xde2b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x63d7=['exports'];(function(_0x5aae7a,_0x5d75aa){var _0x3a21bc=function(_0x14c060){while(--_0x14c060){_0x5aae7a['push'](_0x5aae7a['shift']());}};_0x3a21bc(++_0x5d75aa);}(_0x63d7,0x1e7));var _0x763d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x63d7[_0x2be8c2];return _0x97f531;};var asr=require('./asr');module[_0x763d('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 eae6a84..713633c 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 _0x2857=['length','lang\x20\x22','\x22\x20might\x20not\x20exist','.wav','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','result','source','resolvedQuery','action','fulfillment','speech','metadata','endConversation','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','.mp3','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','wav','finish\x20to\x20convert','start','tmp','generate','writeFileSync','base64','then','googleCloudTTS','ssml','input','voice','audioConfig','text:synthesize','POST','resolve','audioContent','chmodSync','777','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc','null','slice','data'];(function(_0x35125a,_0x1121ef){var _0x3aa732=function(_0x5154ae){while(--_0x5154ae){_0x35125a['push'](_0x35125a['shift']());}};_0x3aa732(++_0x1121ef);}(_0x2857,0xc2));var _0x7285=function(_0x3cf58d,_0x394240){_0x3cf58d=_0x3cf58d-0x0;var _0x284a3f=_0x2857[_0x3cf58d];return _0x284a3f;};'use strict';var apiai=require(_0x7285('0x0'));var BPromise=require(_0x7285('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x7285('0x2'));var https=require(_0x7285('0x3'));var md5=require(_0x7285('0x4'));var path=require(_0x7285('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x7285('0x6'));var sox=require(_0x7285('0x7'));var tts=require(_0x7285('0x8'));var urlParse=require(_0x7285('0x9'))[_0x7285('0xa')];var util=require('util');var aws=require(_0x7285('0xb'));var google=require(_0x7285('0xc'));var sestek=require(_0x7285('0xd'));var tilde=require(_0x7285('0xe'));var logger=require(_0x7285('0xf'))(_0x7285('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x49aad2,_0x54d62b){return new BPromise(function(_0x37192b,_0x1934ce){var _0x46f8cb=urlParse(_0x49aad2);var _0x148f39=_0x46f8cb[_0x7285('0x11')]===_0x7285('0x12')?https:http;var _0x1816be={'host':_0x46f8cb[_0x7285('0x13')],'path':_0x46f8cb['path'],'headers':{'user-agent':_0x7285('0x14')}};_0x148f39[_0x7285('0x15')](_0x1816be,function(_0x325de5){if(_0x325de5[_0x7285('0x16')]!==0xc8){logger[_0x7285('0x17')](_0x7285('0x18')+_0x49aad2+_0x7285('0x19')+_0x325de5[_0x7285('0x16')]+'\x20('+_0x325de5[_0x7285('0x1a')]+')');_0x1934ce(new Error(_0x7285('0x18')+_0x49aad2+_0x7285('0x19')+_0x325de5[_0x7285('0x16')]+'\x20('+_0x325de5[_0x7285('0x1a')]+')'));return;}var _0x2ffa6e=fs[_0x7285('0x1b')](_0x54d62b);_0x2ffa6e['on'](_0x7285('0x1c'),function(){logger[_0x7285('0x1d')](_0x7285('0x1e'));_0x2ffa6e[_0x7285('0x1f')](_0x37192b);});_0x2ffa6e['on'](_0x7285('0x17'),function(_0x94fdf8){fs[_0x7285('0x20')](_0x54d62b);logger[_0x7285('0x17')](_0x7285('0x21'),_0x94fdf8);_0x1934ce(_0x94fdf8);});_0x325de5[_0x7285('0x22')](_0x2ffa6e);})['on'](_0x7285('0x17'),function(_0x444bfe){logger['error'](_0x444bfe);_0x1934ce(_0x444bfe);})[_0x7285('0x23')]();});}function uploadFile(_0x16810d){return new BPromise(function(_0x26a7a9,_0x149f8e){var _0x55d46b=urlParse(_0x16810d);var _0x349fb8=_0x55d46b['protocol']===_0x7285('0x12')?https:http;var _0x204ad5={'host':_0x55d46b[_0x7285('0x13')],'path':_0x55d46b[_0x7285('0x5')],'headers':{'user-agent':_0x7285('0x14')}};_0x349fb8['get'](_0x204ad5,function(_0x511d96){if(_0x511d96['statusCode']!==0xc8){_0x149f8e(new Error('request\x20to\x20'+_0x16810d+_0x7285('0x19')+_0x511d96[_0x7285('0x16')]+'\x20('+_0x511d96[_0x7285('0x1a')]+')'));return;}var _0x1af8af='';_0x511d96['on']('data',function(_0x45c33e){_0x1af8af+=_0x45c33e;});_0x511d96['on']('end',function(){_0x26a7a9(_0x1af8af);});})['on'](_0x7285('0x17'),function(_0x5b8f90){_0x149f8e(_0x5b8f90);})[_0x7285('0x23')]();});}function convertFile(_0x4f304c,_0x4ab213){return new BPromise(function(_0x2d6c85,_0x4da0e8){var _0x34f165=sox[_0x7285('0x24')](_0x4f304c,_0x4ab213,{'sampleRate':0x1f40,'format':_0x7285('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x34f165['on']('error',function(_0x492fbe){logger[_0x7285('0x17')]('error\x20convert',_0x492fbe);_0x4da0e8(_0x492fbe);});_0x34f165['on'](_0x7285('0x23'),function(){logger['info'](_0x7285('0x26'));_0x2d6c85();});_0x34f165[_0x7285('0x27')]();});}function base64Decode(_0xaa928d,_0x220226){var _0x8fa72e=path['resolve'](__dirname,_0x7285('0x28'),rs[_0x7285('0x29')](0x4)+'.wav');fs[_0x7285('0x2a')](_0x8fa72e,_0xaa928d,_0x7285('0x2b'));return convertFile(_0x8fa72e,_0x220226)[_0x7285('0x2c')](function(){try{fs[_0x7285('0x20')](_0x8fa72e);fs['chmodSync'](_0x220226,'777');}catch(_0x28977a){logger['error'](_0x28977a);}return _0x220226['split']('.')[0x0];});}function base64Encode(_0x498640){var _0x86533=fs['readFileSync'](_0x498640);return new Buffer(_0x86533)['toString'](_0x7285('0x2b'));}exports[_0x7285('0x2d')]=function(_0x4b7c93,_0x58214a,_0x5cb7d9,_0x2be5db,_0x32740d,_0x421d83){var _0x2876fd,_0x3df34e;var _0x5c9b4e='https://texttospeech.googleapis.com/v1/';var _0x2c8ec9='?key='+_0x4b7c93;var _0x208e41={};if(_0x58214a===_0x7285('0x2e')){_0x208e41[_0x7285('0x2f')]={'ssml':_0x5cb7d9};}else{_0x208e41[_0x7285('0x2f')]={'text':_0x5cb7d9};};_0x208e41[_0x7285('0x30')]={'languageCode':_0x2be5db,'ssmlGender':_0x32740d};_0x208e41[_0x7285('0x31')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x52bddc={'url':_0x5c9b4e+_0x7285('0x32')+_0x2c8ec9,'method':_0x7285('0x33'),'json':!![],'body':_0x208e41};return rp(_0x52bddc)[_0x7285('0x2c')](function(_0x2e71f3){return new BPromise(function(_0x1bb9f2,_0x232d0e){_0x2876fd=path[_0x7285('0x34')](__dirname,_0x7285('0x28'),rs['generate'](0x4)+'.mp3');var _0x27e221=Buffer['from'](_0x2e71f3[_0x7285('0x35')],'base64');return fs['writeFile'](_0x2876fd,_0x27e221,function(_0x512174){_0x232d0e(_0x512174);},function(_0x330d32){fs[_0x7285('0x36')](_0x2876fd,_0x7285('0x37'));_0x1bb9f2(_0x330d32);});});})[_0x7285('0x2c')](function(_0x50cc00){_0x3df34e=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x2876fd,_0x3df34e);})[_0x7285('0x2c')](function(){try{fs['unlink'](_0x2876fd);fs[_0x7285('0x36')](_0x3df34e,_0x7285('0x37'));}catch(_0x41a49e){logger[_0x7285('0x17')](_0x41a49e);}logger[_0x7285('0x1d')](_0x7285('0x38'),_0x3df34e[_0x7285('0x39')]('.')[0x0]);return _0x3df34e[_0x7285('0x39')]('.')[0x0];});};exports[_0x7285('0x3a')]=function(_0x3d28aa,_0x582bd4){var _0xa35cb7=_0x7285('0x3b');var _0x28f234,_0x551bb4;var _0x2f260d;var _0x2bb86f={'encoding':'utf8','method':_0x7285('0x33'),'timeout':0x2710,'url':_0xa35cb7,'headers':{'Content-Type':_0x7285('0x3c')},'body':'f.req='+encodeURIComponent(JSON[_0x7285('0x3d')]([[[_0x7285('0x3e'),JSON['stringify']([_0x3d28aa,_0x582bd4||'en',![],_0x7285('0x3f')]),null,'generic']]]))};return rp(_0x2bb86f)[_0x7285('0x2c')](function(_0x175100){try{_0x2f260d=eval(_0x175100[_0x7285('0x40')](0x5))[0x0][0x2];}catch(_0xcf6d2d){throw new Error('parse\x20response\x20failed:\x0a'+_0x175100[_0x7285('0x41')]);}if(!_0x2f260d){if(_0x3d28aa[_0x7285('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x7285('0x43')+_0x582bd4+_0x7285('0x44'));}}try{_0x2f260d=eval(_0x2f260d)[0x0];}catch(_0x4645b8){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x7285('0x41')]);}const _0x369996=_0x2f260d;_0x28f234=path[_0x7285('0x34')](__dirname,_0x7285('0x28'),rs[_0x7285('0x29')](0x4)+'.mp3');fs[_0x7285('0x2a')](_0x28f234,_0x2f260d,{'encoding':_0x7285('0x2b')});_0x551bb4=path['resolve'](__dirname,'tmp',rs[_0x7285('0x29')](0x4)+_0x7285('0x45'));return convertFile(_0x28f234,_0x551bb4);})['then'](function(){try{fs['unlink'](_0x28f234);fs[_0x7285('0x36')](_0x551bb4,_0x7285('0x37'));}catch(_0x7febab){logger[_0x7285('0x17')](_0x7febab);}logger['info']('goggleTTS\x20path',_0x551bb4[_0x7285('0x39')]('.')[0x0]);return _0x551bb4[_0x7285('0x39')]('.')[0x0];});};exports['googleASR']=function(_0xad3fb4,_0x341d83,_0x5ed5cc){return google[_0x7285('0x46')](_0xad3fb4,_0x341d83,_0x5ed5cc)[_0x7285('0x2c')](function(_0x50e4cc){logger[_0x7285('0x1d')](_0x50e4cc[_0x7285('0x47')]);return rp(_0x50e4cc);})[_0x7285('0x2c')](function(_0x16c115){var _0x5d39de='';var _0x37dfeb=0x0;try{fs[_0x7285('0x20')](_0xad3fb4);}catch(_0x1a6e27){logger[_0x7285('0x17')](_0x1a6e27);}if(_0x16c115&&_0x16c115[_0x7285('0x48')]){_0x5d39de=_0x16c115[_0x7285('0x48')]['map'](function(_0x24d5e5){return _0x24d5e5&&_0x24d5e5[_0x7285('0x49')][0x0]&&_0x24d5e5[_0x7285('0x49')][0x0][_0x7285('0x4a')]?_0x24d5e5[_0x7285('0x49')][0x0][_0x7285('0x4a')]:'';})[_0x7285('0x4b')]('\x0a');_0x37dfeb=_0x16c115[_0x7285('0x48')][_0x7285('0x4c')](function(_0xc1d134){return _0xc1d134&&_0xc1d134[_0x7285('0x49')][0x0]&&_0xc1d134[_0x7285('0x49')][0x0][_0x7285('0x4d')]?_0xc1d134[_0x7285('0x49')][0x0][_0x7285('0x4d')]:0x0;})[_0x7285('0x4b')]('\x0a');}logger[_0x7285('0x1d')](_0x7285('0x4e'),_0x5d39de);logger[_0x7285('0x1d')](_0x7285('0x4f'),_0x37dfeb);return{'transcript':_0x5d39de,'confidence':_0x37dfeb};})['catch'](function(_0x2e6e80){logger[_0x7285('0x17')]('[%s]\x20%s:%s',_0x2e6e80[_0x7285('0x16')],_0x2e6e80[_0x7285('0x50')],_0x2e6e80[_0x7285('0x51')]);});};exports[_0x7285('0x52')]=function(_0x2f63f3,_0x18d7f4,_0x5e2f97,_0x1d0189){var _0x74069f=apiai(_0x18d7f4,{'language':_0x1d0189||'en'});return _0x74069f['textRequest'](_0x5e2f97,{'sessionId':md5(_0x2f63f3)})[_0x7285('0x2c')](function(_0x4f41ef){logger[_0x7285('0x1d')](JSON[_0x7285('0x3d')](_0x4f41ef));return{'source':_0x4f41ef[_0x7285('0x53')][_0x7285('0x54')],'resolvedQuery':_0x4f41ef[_0x7285('0x53')][_0x7285('0x55')],'action':_0x4f41ef[_0x7285('0x53')][_0x7285('0x56')],'actionIncomplete':_0x4f41ef['result']['actionIncomplete'],'speech':_0x4f41ef['result'][_0x7285('0x57')][_0x7285('0x58')],'score':_0x4f41ef[_0x7285('0x53')]['score'],'statusCode':_0x4f41ef['status']['code'],'endConversation':_0x4f41ef[_0x7285('0x53')][_0x7285('0x59')][_0x7285('0x5a')]||![],'isFallbackIntent':_0x4f41ef[_0x7285('0x53')][_0x7285('0x59')]['isFallbackIntent']};});};exports[_0x7285('0x5b')]=function(_0x15dcdd,_0x1ad794,_0x5bb8ac,_0x1abc52,_0x37c7e2,_0x5196b2){var _0x51f5f9=_0x1abc52['replace'](/\\n/g,'\x0a');var _0x36ad74={'credentials':{'private_key':_0x51f5f9,'client_email':_0x5bb8ac}};var _0xe84918=new dialogflow[(_0x7285('0x5c'))](_0x36ad74);var _0x390ee2=_0xe84918[_0x7285('0x5d')](_0x1ad794,md5(_0x15dcdd));var _0x3d45f5={'session':_0x390ee2,'queryInput':{'text':{'text':_0x37c7e2,'languageCode':_0x5196b2}}};return _0xe84918[_0x7285('0x5e')](_0x3d45f5)[_0x7285('0x2c')](function(_0x358265){if(_0x358265&&_0x358265[_0x7285('0x42')]){logger[_0x7285('0x1d')]('Dialogflow\x20V2\x20response:',JSON[_0x7285('0x3d')](_0x358265));var _0x920208=_0x358265[0x0];if(_0x920208){var _0x2d09ff={'action':_0x920208[_0x7285('0x5f')][_0x7285('0x56')],'allRequiredParamsPresent':_0x920208[_0x7285('0x5f')][_0x7285('0x60')],'endConversation':_0x920208[_0x7285('0x5f')][_0x7285('0x61')]&&_0x920208[_0x7285('0x5f')][_0x7285('0x61')][_0x7285('0x62')]?_0x920208[_0x7285('0x5f')]['diagnosticInfo'][_0x7285('0x62')][_0x7285('0x63')][_0x7285('0x64')]:![],'fulfillmentText':_0x920208['queryResult'][_0x7285('0x65')],'intentName':_0x920208[_0x7285('0x5f')][_0x7285('0x66')][_0x7285('0x50')],'intentDisplayName':_0x920208['queryResult']['intent'][_0x7285('0x67')],'isFallbackIntent':_0x920208[_0x7285('0x5f')]['intent']['isFallback'],'languageCode':_0x920208['queryResult'][_0x7285('0x68')],'queryText':_0x920208[_0x7285('0x5f')][_0x7285('0x69')],'responseId':_0x920208[_0x7285('0x6a')],'score':_0x920208['queryResult'][_0x7285('0x6b')],'speech':_0x920208['queryResult'][_0x7285('0x65')],'providerResponse':JSON[_0x7285('0x3d')](_0x358265)};return _0x2d09ff;}}});};exports[_0x7285('0x6c')]=function(_0x2e602e,_0x1b1c98,_0x2acc81,_0x48c534){return tilde['asr'](_0x2e602e,_0x1b1c98,_0x2acc81,_0x48c534)[_0x7285('0x2c')](function(_0x359dd0){try{fs['unlink'](_0x2e602e);}catch(_0x1ceaf8){logger[_0x7285('0x17')](_0x1ceaf8);}logger[_0x7285('0x1d')](_0x7285('0x6d'),_0x359dd0[_0x7285('0x4a')]);logger[_0x7285('0x1d')](_0x7285('0x6e'),_0x359dd0[_0x7285('0x4d')]);return _0x359dd0;});};exports['awsPolly']=function(_0xbaa921,_0x446440,_0x48515d,_0x381458,_0x853c4c,_0x3e992a){var _0x5e244d=path[_0x7285('0x34')](__dirname,_0x7285('0x28'),rs[_0x7285('0x29')](0x4)+_0x7285('0x6f'));var _0x4e7d95;return aws['polly'](_0xbaa921,_0x446440,_0x48515d,_0x381458,_0x853c4c,_0x3e992a,_0x5e244d)[_0x7285('0x2c')](function(){_0x4e7d95=path[_0x7285('0x34')](__dirname,_0x7285('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x5e244d,_0x4e7d95);})['then'](function(){try{fs[_0x7285('0x20')](_0x5e244d);fs[_0x7285('0x36')](_0x4e7d95,_0x7285('0x37'));}catch(_0x3a6633){logger['error'](_0x3a6633);}return _0x4e7d95[_0x7285('0x39')]('.')[0x0];});};exports[_0x7285('0x70')]=function(_0x6e2f72,_0x108c83,_0x2119e4,_0x58bb59,_0x5186ac,_0x54ddd8){return aws[_0x7285('0x71')](_0x6e2f72,_0x108c83,_0x2119e4,_0x58bb59,_0x5186ac,_0x54ddd8)[_0x7285('0x2c')](function(_0x5cc2ed){logger[_0x7285('0x1d')](JSON[_0x7285('0x3d')](_0x5cc2ed));return _0x5cc2ed;});};exports[_0x7285('0x72')]=function(_0x3c3e72,_0x26b016,_0x5b0efd,_0x515a7e){var _0x1ca771=util[_0x7285('0x73')](_0x7285('0x74'),ISPEECH_API,_0x3c3e72,encodeURIComponent(_0x26b016),_0x5b0efd,_0x515a7e);var _0xa44906=path[_0x7285('0x34')](__dirname,'tmp',rs[_0x7285('0x29')](0x4)+_0x7285('0x6f'));var _0x33f2d0;return downloadFile(_0x1ca771,_0xa44906)['then'](function(){_0x33f2d0=path['resolve'](__dirname,'tmp',rs[_0x7285('0x29')](0x4)+_0x7285('0x45'));return convertFile(_0xa44906,_0x33f2d0);})[_0x7285('0x2c')](function(){try{fs[_0x7285('0x20')](_0xa44906);fs['chmodSync'](_0x33f2d0,'777');}catch(_0x1fa723){logger[_0x7285('0x17')](_0x1fa723);}return _0x33f2d0[_0x7285('0x39')]('.')[0x0];});};exports[_0x7285('0x75')]=function(_0xf31e9a,_0x3beb8c,_0x586514,_0x1b2ac1){var _0x2a44de=util['format'](_0x7285('0x76'),ISPEECH_API,_0x3beb8c,_0x586514,base64Encode(_0xf31e9a),_0x1b2ac1?util[_0x7285('0x73')](_0x7285('0x77'),encodeURIComponent(_0x1b2ac1)):_0x7285('0x78'));return uploadFile(_0x2a44de)[_0x7285('0x2c')](function(_0x110a20){return querystring[_0x7285('0xa')](_0x110a20);});};exports[_0x7285('0x79')]=function(_0x16dab9,_0x581199){return sestek[_0x7285('0x7a')](_0x16dab9,_0x581199)[_0x7285('0x2c')](function(_0x57a8c6){logger[_0x7285('0x1d')](JSON[_0x7285('0x3d')](_0x57a8c6));var _0x1ff0c0={'speech':_0x57a8c6['text'],'action':_0x57a8c6[_0x7285('0x7b')]?_0x57a8c6[_0x7285('0x7b')][_0x7285('0x7c')]:undefined,'actiondata':_0x57a8c6[_0x7285('0x7b')]?_0x57a8c6[_0x7285('0x7b')][_0x7285('0x7d')]:undefined};if(_0x57a8c6[_0x7285('0x7b')]&&_0x57a8c6[_0x7285('0x7b')][_0x7285('0x7e')]){return base64Decode(_0x57a8c6[_0x7285('0x7b')]['AudioFromTts'][_0x7285('0x7f')],path[_0x7285('0x34')](__dirname,_0x7285('0x28'),rs[_0x7285('0x29')](0x4)+_0x7285('0x45')))[_0x7285('0x2c')](function(_0x5b630c){_0x1ff0c0[_0x7285('0x80')]=_0x5b630c;return _0x1ff0c0;});}return _0x1ff0c0;});};exports[_0x7285('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x8b84=['confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dialogflow','http','https','md5','path','querystring','randomstring','google-tts-api','url','parse','./google','./sestek','./tilde','../../../config/logger','agi','https:','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','protocol','get','transcode','wav','start','resolve','tmp','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','audioContent','writeFile','.wav','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join'];(function(_0xb44d72,_0x326632){var _0x2ae021=function(_0x1dbfba){while(--_0x1dbfba){_0xb44d72['push'](_0xb44d72['shift']());}};_0x2ae021(++_0x326632);}(_0x8b84,0x1ce));var _0x48b8=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x8b84[_0x4709c0];return _0x13348b;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x48b8('0x0'));var fs=require('fs');var http=require(_0x48b8('0x1'));var https=require(_0x48b8('0x2'));var md5=require(_0x48b8('0x3'));var path=require(_0x48b8('0x4'));var querystring=require(_0x48b8('0x5'));var rp=require('request-promise');var rs=require(_0x48b8('0x6'));var sox=require('sox');var tts=require(_0x48b8('0x7'));var urlParse=require(_0x48b8('0x8'))[_0x48b8('0x9')];var util=require('util');var aws=require('./aws');var google=require(_0x48b8('0xa'));var sestek=require(_0x48b8('0xb'));var tilde=require(_0x48b8('0xc'));var logger=require(_0x48b8('0xd'))(_0x48b8('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4c0600,_0xbe4151){return new BPromise(function(_0x23c988,_0xec971d){var _0xa0d686=urlParse(_0x4c0600);var _0x1c7908=_0xa0d686['protocol']===_0x48b8('0xf')?https:http;var _0x2d4ae5={'host':_0xa0d686['host'],'path':_0xa0d686[_0x48b8('0x4')],'headers':{'user-agent':_0x48b8('0x10')}};_0x1c7908['get'](_0x2d4ae5,function(_0x443374){if(_0x443374['statusCode']!==0xc8){logger[_0x48b8('0x11')](_0x48b8('0x12')+_0x4c0600+_0x48b8('0x13')+_0x443374['statusCode']+'\x20('+_0x443374[_0x48b8('0x14')]+')');_0xec971d(new Error(_0x48b8('0x12')+_0x4c0600+_0x48b8('0x13')+_0x443374[_0x48b8('0x15')]+'\x20('+_0x443374['statusMessage']+')'));return;}var _0x426743=fs[_0x48b8('0x16')](_0xbe4151);_0x426743['on'](_0x48b8('0x17'),function(){logger[_0x48b8('0x18')](_0x48b8('0x19'));_0x426743[_0x48b8('0x1a')](_0x23c988);});_0x426743['on'](_0x48b8('0x11'),function(_0x5ad3c8){fs[_0x48b8('0x1b')](_0xbe4151);logger[_0x48b8('0x11')](_0x48b8('0x1c'),_0x5ad3c8);_0xec971d(_0x5ad3c8);});_0x443374['pipe'](_0x426743);})['on']('error',function(_0x400ef6){logger[_0x48b8('0x11')](_0x400ef6);_0xec971d(_0x400ef6);})[_0x48b8('0x1d')]();});}function uploadFile(_0x486888){return new BPromise(function(_0x573481,_0x2e343c){var _0x5046f7=urlParse(_0x486888);var _0x40fffa=_0x5046f7[_0x48b8('0x1e')]==='https:'?https:http;var _0x20d902={'host':_0x5046f7['host'],'path':_0x5046f7[_0x48b8('0x4')],'headers':{'user-agent':_0x48b8('0x10')}};_0x40fffa[_0x48b8('0x1f')](_0x20d902,function(_0x4ab9d8){if(_0x4ab9d8[_0x48b8('0x15')]!==0xc8){_0x2e343c(new Error(_0x48b8('0x12')+_0x486888+_0x48b8('0x13')+_0x4ab9d8[_0x48b8('0x15')]+'\x20('+_0x4ab9d8['statusMessage']+')'));return;}var _0x24bc93='';_0x4ab9d8['on']('data',function(_0x4ada79){_0x24bc93+=_0x4ada79;});_0x4ab9d8['on'](_0x48b8('0x1d'),function(){_0x573481(_0x24bc93);});})['on'](_0x48b8('0x11'),function(_0x124509){_0x2e343c(_0x124509);})[_0x48b8('0x1d')]();});}function convertFile(_0x2d013d,_0xdf8cf6){return new BPromise(function(_0x4f99a7,_0x43ec8a){var _0x546aec=sox[_0x48b8('0x20')](_0x2d013d,_0xdf8cf6,{'sampleRate':0x1f40,'format':_0x48b8('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x546aec['on'](_0x48b8('0x11'),function(_0x3261d9){logger[_0x48b8('0x11')]('error\x20convert',_0x3261d9);_0x43ec8a(_0x3261d9);});_0x546aec['on'](_0x48b8('0x1d'),function(){logger['info']('finish\x20to\x20convert');_0x4f99a7();});_0x546aec[_0x48b8('0x22')]();});}function base64Decode(_0x40b90f,_0x63aeac){var _0xa0f3dd=path[_0x48b8('0x23')](__dirname,_0x48b8('0x24'),rs['generate'](0x4)+'.wav');fs[_0x48b8('0x25')](_0xa0f3dd,_0x40b90f,_0x48b8('0x26'));return convertFile(_0xa0f3dd,_0x63aeac)[_0x48b8('0x27')](function(){try{fs[_0x48b8('0x1b')](_0xa0f3dd);fs[_0x48b8('0x28')](_0x63aeac,_0x48b8('0x29'));}catch(_0x3d735c){logger['error'](_0x3d735c);}return _0x63aeac[_0x48b8('0x2a')]('.')[0x0];});}function base64Encode(_0x62d999){var _0x2983e5=fs['readFileSync'](_0x62d999);return new Buffer(_0x2983e5)[_0x48b8('0x2b')](_0x48b8('0x26'));}exports[_0x48b8('0x2c')]=function(_0x4d14b0,_0x1e9bcc,_0x4f6dc9,_0xd3cba7,_0x1ec889,_0x5370b2){var _0x3b8552,_0x2504da;var _0x124b75=_0x48b8('0x2d');var _0x59ed1b=_0x48b8('0x2e')+_0x4d14b0;var _0x1b7387={};if(_0x1e9bcc===_0x48b8('0x2f')){_0x1b7387[_0x48b8('0x30')]={'ssml':_0x4f6dc9};}else{_0x1b7387[_0x48b8('0x30')]={'text':_0x4f6dc9};};_0x1b7387[_0x48b8('0x31')]={'languageCode':_0xd3cba7,'ssmlGender':_0x1ec889};_0x1b7387[_0x48b8('0x32')]={'audioEncoding':_0x48b8('0x33'),'sampleRateHertz':0x1f40};var _0x119701={'url':_0x124b75+'text:synthesize'+_0x59ed1b,'method':_0x48b8('0x34'),'json':!![],'body':_0x1b7387};return rp(_0x119701)[_0x48b8('0x27')](function(_0x228a3f){return new BPromise(function(_0x2e663c,_0x117d59){_0x3b8552=path[_0x48b8('0x23')](__dirname,_0x48b8('0x24'),rs[_0x48b8('0x35')](0x4)+_0x48b8('0x36'));var _0x4f65bd=Buffer['from'](_0x228a3f[_0x48b8('0x37')],_0x48b8('0x26'));return fs[_0x48b8('0x38')](_0x3b8552,_0x4f65bd,function(_0x4e3e5e){_0x117d59(_0x4e3e5e);},function(_0x289a12){fs['chmodSync'](_0x3b8552,_0x48b8('0x29'));_0x2e663c(_0x289a12);});});})[_0x48b8('0x27')](function(_0x4f74f9){_0x2504da=path['resolve'](__dirname,_0x48b8('0x24'),rs[_0x48b8('0x35')](0x4)+_0x48b8('0x39'));return convertFile(_0x3b8552,_0x2504da);})[_0x48b8('0x27')](function(){try{fs['unlink'](_0x3b8552);fs[_0x48b8('0x28')](_0x2504da,_0x48b8('0x29'));}catch(_0x17f35b){logger[_0x48b8('0x11')](_0x17f35b);}logger[_0x48b8('0x18')]('googleCloudTTS\x20path',_0x2504da[_0x48b8('0x2a')]('.')[0x0]);return _0x2504da[_0x48b8('0x2a')]('.')[0x0];});};exports[_0x48b8('0x3a')]=function(_0x3ac683,_0x2d4f93){var _0x310ee1=_0x48b8('0x3b');var _0x12ef23,_0x40ebfe;var _0x5ce6c3;var _0x522960={'encoding':_0x48b8('0x3c'),'method':_0x48b8('0x34'),'timeout':0x2710,'url':_0x310ee1,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x48b8('0x3d')+encodeURIComponent(JSON[_0x48b8('0x3e')]([[['jQ1olc',JSON['stringify']([_0x3ac683,_0x2d4f93||'en',![],_0x48b8('0x3f')]),null,'generic']]]))};return rp(_0x522960)[_0x48b8('0x27')](function(_0x2c6ef1){try{_0x5ce6c3=eval(_0x2c6ef1[_0x48b8('0x40')](0x5))[0x0][0x2];}catch(_0x3d3e73){throw new Error(_0x48b8('0x41')+_0x2c6ef1[_0x48b8('0x42')]);}if(!_0x5ce6c3){if(_0x3ac683[_0x48b8('0x43')]>0xc8){throw new Error(_0x48b8('0x44'));}else{throw new Error(_0x48b8('0x45')+_0x2d4f93+'\x22\x20might\x20not\x20exist');}}try{_0x5ce6c3=eval(_0x5ce6c3)[0x0];}catch(_0x14634d){throw new Error(_0x48b8('0x41')+res[_0x48b8('0x42')]);}const _0x21cd12=_0x5ce6c3;_0x12ef23=path[_0x48b8('0x23')](__dirname,_0x48b8('0x24'),rs[_0x48b8('0x35')](0x4)+_0x48b8('0x36'));fs[_0x48b8('0x25')](_0x12ef23,_0x5ce6c3,{'encoding':_0x48b8('0x26')});_0x40ebfe=path[_0x48b8('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x48b8('0x39'));return convertFile(_0x12ef23,_0x40ebfe);})[_0x48b8('0x27')](function(){try{fs[_0x48b8('0x1b')](_0x12ef23);fs[_0x48b8('0x28')](_0x40ebfe,_0x48b8('0x29'));}catch(_0x4b4982){logger['error'](_0x4b4982);}logger[_0x48b8('0x18')](_0x48b8('0x46'),_0x40ebfe['split']('.')[0x0]);return _0x40ebfe['split']('.')[0x0];});};exports[_0x48b8('0x47')]=function(_0x2447c2,_0x13ba1f,_0x15c169){return google[_0x48b8('0x48')](_0x2447c2,_0x13ba1f,_0x15c169)[_0x48b8('0x27')](function(_0x39e14d){logger[_0x48b8('0x18')](_0x39e14d['uri']);return rp(_0x39e14d);})[_0x48b8('0x27')](function(_0x5bbc21){var _0x4361cb='';var _0x4e0868=0x0;try{fs[_0x48b8('0x1b')](_0x2447c2);}catch(_0x3bcc47){logger[_0x48b8('0x11')](_0x3bcc47);}if(_0x5bbc21&&_0x5bbc21[_0x48b8('0x49')]){_0x4361cb=_0x5bbc21[_0x48b8('0x49')][_0x48b8('0x4a')](function(_0xb582d9){return _0xb582d9&&_0xb582d9[_0x48b8('0x4b')][0x0]&&_0xb582d9[_0x48b8('0x4b')][0x0][_0x48b8('0x4c')]?_0xb582d9[_0x48b8('0x4b')][0x0][_0x48b8('0x4c')]:'';})[_0x48b8('0x4d')]('\x0a');_0x4e0868=_0x5bbc21[_0x48b8('0x49')]['map'](function(_0x41870c){return _0x41870c&&_0x41870c[_0x48b8('0x4b')][0x0]&&_0x41870c[_0x48b8('0x4b')][0x0][_0x48b8('0x4e')]?_0x41870c[_0x48b8('0x4b')][0x0][_0x48b8('0x4e')]:0x0;})['join']('\x0a');}logger[_0x48b8('0x18')](_0x48b8('0x4f'),_0x4361cb);logger['info']('googleASR\x20confidence',_0x4e0868);return{'transcript':_0x4361cb,'confidence':_0x4e0868};})[_0x48b8('0x50')](function(_0x4a82b5){logger[_0x48b8('0x11')](_0x48b8('0x51'),_0x4a82b5[_0x48b8('0x15')],_0x4a82b5['name'],_0x4a82b5[_0x48b8('0x52')]);});};exports[_0x48b8('0x53')]=function(_0x3c846a,_0x2e3e93,_0x1febf8,_0x1c8e31){var _0x28719b=apiai(_0x2e3e93,{'language':_0x1c8e31||'en'});return _0x28719b[_0x48b8('0x54')](_0x1febf8,{'sessionId':md5(_0x3c846a)})[_0x48b8('0x27')](function(_0x370575){logger[_0x48b8('0x18')](JSON[_0x48b8('0x3e')](_0x370575));return{'source':_0x370575[_0x48b8('0x55')][_0x48b8('0x56')],'resolvedQuery':_0x370575[_0x48b8('0x55')][_0x48b8('0x57')],'action':_0x370575[_0x48b8('0x55')][_0x48b8('0x58')],'actionIncomplete':_0x370575[_0x48b8('0x55')][_0x48b8('0x59')],'speech':_0x370575[_0x48b8('0x55')][_0x48b8('0x5a')][_0x48b8('0x5b')],'score':_0x370575[_0x48b8('0x55')][_0x48b8('0x5c')],'statusCode':_0x370575['status'][_0x48b8('0x5d')],'endConversation':_0x370575[_0x48b8('0x55')][_0x48b8('0x5e')][_0x48b8('0x5f')]||![],'isFallbackIntent':_0x370575[_0x48b8('0x55')][_0x48b8('0x5e')][_0x48b8('0x60')]};});};exports[_0x48b8('0x61')]=function(_0x4378ac,_0x5c9811,_0x9674d,_0x14017e,_0x1241d3,_0x16c64b){var _0x52142e=_0x14017e[_0x48b8('0x62')](/\\n/g,'\x0a');var _0x277899={'credentials':{'private_key':_0x52142e,'client_email':_0x9674d}};var _0x38f013=new dialogflow['SessionsClient'](_0x277899);var _0x1da715=_0x38f013[_0x48b8('0x63')](_0x5c9811,md5(_0x4378ac));var _0x3f0a04={'session':_0x1da715,'queryInput':{'text':{'text':_0x1241d3,'languageCode':_0x16c64b}}};return _0x38f013[_0x48b8('0x64')](_0x3f0a04)[_0x48b8('0x27')](function(_0x42211d){if(_0x42211d&&_0x42211d[_0x48b8('0x43')]){logger[_0x48b8('0x18')](_0x48b8('0x65'),JSON['stringify'](_0x42211d));var _0xbf2f9c=_0x42211d[0x0];if(_0xbf2f9c){var _0x3e82ec={'action':_0xbf2f9c[_0x48b8('0x66')]['action'],'allRequiredParamsPresent':_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x67')],'endConversation':_0xbf2f9c['queryResult']['diagnosticInfo']&&_0xbf2f9c[_0x48b8('0x66')]['diagnosticInfo'][_0x48b8('0x68')]?_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x69')][_0x48b8('0x68')][_0x48b8('0x6a')][_0x48b8('0x6b')]:![],'fulfillmentText':_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x6c')],'intentName':_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x6d')]['name'],'intentDisplayName':_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x6d')]['displayName'],'isFallbackIntent':_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x6d')][_0x48b8('0x6e')],'languageCode':_0xbf2f9c[_0x48b8('0x66')][_0x48b8('0x6f')],'queryText':_0xbf2f9c['queryResult'][_0x48b8('0x70')],'responseId':_0xbf2f9c[_0x48b8('0x71')],'score':_0xbf2f9c['queryResult'][_0x48b8('0x72')],'speech':_0xbf2f9c[_0x48b8('0x66')]['fulfillmentText'],'providerResponse':JSON[_0x48b8('0x3e')](_0x42211d)};return _0x3e82ec;}}});};exports[_0x48b8('0x73')]=function(_0x529e49,_0xe02fca,_0x2a3492,_0x5f5abe){return tilde['asr'](_0x529e49,_0xe02fca,_0x2a3492,_0x5f5abe)['then'](function(_0x42938){try{fs[_0x48b8('0x1b')](_0x529e49);}catch(_0x2be92f){logger[_0x48b8('0x11')](_0x2be92f);}logger[_0x48b8('0x18')](_0x48b8('0x74'),_0x42938[_0x48b8('0x4c')]);logger['info'](_0x48b8('0x75'),_0x42938[_0x48b8('0x4e')]);return _0x42938;});};exports[_0x48b8('0x76')]=function(_0x5e3a06,_0x3c011d,_0x180467,_0x1c7b5f,_0xda225b,_0x2d3da5){var _0x1c093e=path['resolve'](__dirname,_0x48b8('0x24'),rs['generate'](0x4)+_0x48b8('0x36'));var _0x3244ee;return aws[_0x48b8('0x77')](_0x5e3a06,_0x3c011d,_0x180467,_0x1c7b5f,_0xda225b,_0x2d3da5,_0x1c093e)[_0x48b8('0x27')](function(){_0x3244ee=path[_0x48b8('0x23')](__dirname,'tmp',rs[_0x48b8('0x35')](0x4)+'.wav');return convertFile(_0x1c093e,_0x3244ee);})[_0x48b8('0x27')](function(){try{fs[_0x48b8('0x1b')](_0x1c093e);fs[_0x48b8('0x28')](_0x3244ee,_0x48b8('0x29'));}catch(_0x2fc5ff){logger[_0x48b8('0x11')](_0x2fc5ff);}return _0x3244ee[_0x48b8('0x2a')]('.')[0x0];});};exports[_0x48b8('0x78')]=function(_0x4ddcb2,_0x3fcf93,_0x4b4c62,_0x42e6d4,_0x4c73b0,_0x29a832){return aws[_0x48b8('0x79')](_0x4ddcb2,_0x3fcf93,_0x4b4c62,_0x42e6d4,_0x4c73b0,_0x29a832)['then'](function(_0x48ec45){logger['info'](JSON[_0x48b8('0x3e')](_0x48ec45));return _0x48ec45;});};exports[_0x48b8('0x7a')]=function(_0x1d2721,_0x32f6e7,_0x35c0a3,_0x3c646a){var _0x56889f=util[_0x48b8('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1d2721,encodeURIComponent(_0x32f6e7),_0x35c0a3,_0x3c646a);var _0x40c8f2=path['resolve'](__dirname,_0x48b8('0x24'),rs[_0x48b8('0x35')](0x4)+_0x48b8('0x36'));var _0x1eab6b;return downloadFile(_0x56889f,_0x40c8f2)['then'](function(){_0x1eab6b=path[_0x48b8('0x23')](__dirname,_0x48b8('0x24'),rs[_0x48b8('0x35')](0x4)+_0x48b8('0x39'));return convertFile(_0x40c8f2,_0x1eab6b);})[_0x48b8('0x27')](function(){try{fs[_0x48b8('0x1b')](_0x40c8f2);fs[_0x48b8('0x28')](_0x1eab6b,_0x48b8('0x29'));}catch(_0x978e2f){logger['error'](_0x978e2f);}return _0x1eab6b['split']('.')[0x0];});};exports[_0x48b8('0x7c')]=function(_0x2e200d,_0x18e56e,_0x2ee17b,_0x3748f1){var _0x98d6eb=util['format'](_0x48b8('0x7d'),ISPEECH_API,_0x18e56e,_0x2ee17b,base64Encode(_0x2e200d),_0x3748f1?util[_0x48b8('0x7b')](_0x48b8('0x7e'),encodeURIComponent(_0x3748f1)):_0x48b8('0x7f'));return uploadFile(_0x98d6eb)['then'](function(_0x368adc){return querystring[_0x48b8('0x9')](_0x368adc);});};exports[_0x48b8('0x80')]=function(_0xb36c5,_0x3c0c45){return sestek['nda'](_0xb36c5,_0x3c0c45)['then'](function(_0x567765){logger[_0x48b8('0x18')](JSON['stringify'](_0x567765));var _0x4a8674={'speech':_0x567765[_0x48b8('0x81')],'action':_0x567765[_0x48b8('0x82')]?_0x567765[_0x48b8('0x82')]['CustomAction']:undefined,'actiondata':_0x567765['channelData']?_0x567765['channelData'][_0x48b8('0x83')]:undefined};if(_0x567765[_0x48b8('0x82')]&&_0x567765[_0x48b8('0x82')]['AudioFromTts']){return base64Decode(_0x567765[_0x48b8('0x82')][_0x48b8('0x84')][_0x48b8('0x85')],path[_0x48b8('0x23')](__dirname,_0x48b8('0x24'),rs[_0x48b8('0x35')](0x4)+_0x48b8('0x39')))[_0x48b8('0x27')](function(_0x4061df){_0x4a8674[_0x48b8('0x86')]=_0x4061df;return _0x4a8674;});}return _0x4a8674;});};exports['dirName']=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 c6d0a14..45eda42 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 _0xeda1=['exports'];(function(_0xcf8124,_0x39c6c6){var _0x5b2870=function(_0x23de36){while(--_0x23de36){_0xcf8124['push'](_0xcf8124['shift']());}};_0x5b2870(++_0x39c6c6);}(_0xeda1,0x1a6));var _0x1eda=function(_0x239b5a,_0x56199a){_0x239b5a=_0x239b5a-0x0;var _0x5a701c=_0xeda1[_0x239b5a];return _0x5a701c;};var nda=require('./nda');module[_0x1eda('0x0')]={'nda':nda}; \ No newline at end of file +var _0xdf7a=['./nda','exports'];(function(_0x11ef3d,_0x233c33){var _0x4b5775=function(_0x20a5ff){while(--_0x20a5ff){_0x11ef3d['push'](_0x11ef3d['shift']());}};_0x4b5775(++_0x233c33);}(_0xdf7a,0x1e8));var _0xadf7=function(_0x136a23,_0x507cda){_0x136a23=_0x136a23-0x0;var _0x48e69b=_0xdf7a[_0x136a23];return _0x48e69b;};var nda=require(_0xadf7('0x0'));module[_0xadf7('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0ff2207..bd333a6 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 _0xffda=['channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','/token','password','then','ndassistant_url','message','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','project','body','ProjectName'];(function(_0x246ea1,_0x4924a7){var _0x3d2531=function(_0x27186a){while(--_0x27186a){_0x246ea1['push'](_0x246ea1['shift']());}};_0x3d2531(++_0x4924a7);}(_0xffda,0x73));var _0xaffd=function(_0x38f855,_0x126116){_0x38f855=_0x38f855-0x0;var _0x35a6b7=_0xffda[_0x38f855];return _0x35a6b7;};'use strict';var rp=require(_0xaffd('0x0'));var url=require(_0xaffd('0x1'));var logger=require(_0xaffd('0x2'))(_0xaffd('0x3'));module['exports']=function(_0x18e6bf,_0x197651){var _0x730fb3={'method':'POST','uri':url[_0xaffd('0x4')](_0x197651['ndauth_url'],_0xaffd('0x5')),'form':{'grant_type':_0xaffd('0x6'),'username':_0x197651['username'],'password':_0x197651['password']},'json':!![]};return rp(_0x730fb3)[_0xaffd('0x7')](function(_0x12865c){var _0x3647e1={'method':'POST','uri':url[_0xaffd('0x4')](_0x197651[_0xaffd('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x197651['ndaactivity_type']||_0xaffd('0x9'),'channelId':_0xaffd('0xa'),'conversation':{'id':_0x18e6bf[_0xaffd('0xb')]},'from':{'id':_0x18e6bf['callerid'],'name':_0x18e6bf[_0xaffd('0xc')]},'recipient':{'id':_0x18e6bf[_0xaffd('0xd')],'name':_0x18e6bf['extension']},'text':_0x197651[_0xaffd('0xe')],'channelData':{}},'headers':{'Authorization':_0xaffd('0xf')+_0x12865c[_0xaffd('0x10')]},'json':!![]};if(_0x197651[_0xaffd('0x11')]){_0x3647e1[_0xaffd('0x12')]['channelData'][_0xaffd('0x13')]=_0x197651['project'];}if(_0x197651['ndagenerate_audio']=='1'){_0x3647e1[_0xaffd('0x12')][_0xaffd('0x14')][_0xaffd('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x197651[_0xaffd('0x16')]){_0x3647e1[_0xaffd('0x12')][_0xaffd('0x14')][_0xaffd('0x17')]=_0x197651[_0xaffd('0x16')];if(_0x197651[_0xaffd('0x18')]){_0x3647e1[_0xaffd('0x12')][_0xaffd('0x14')]['CustomActionData']=_0x197651[_0xaffd('0x18')];}}logger[_0xaffd('0x19')](JSON[_0xaffd('0x1a')](_0x3647e1));return rp(_0x3647e1);});}; \ No newline at end of file +var _0x3c81=['/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','resolve','ndauth_url'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x2bc44a,_0x175e94){_0x2bc44a=_0x2bc44a-0x0;var _0x1873d4=_0x3c81[_0x2bc44a];return _0x1873d4;};'use strict';var rp=require(_0x13c8('0x0'));var url=require(_0x13c8('0x1'));var logger=require('../../../../../config/logger')(_0x13c8('0x2'));module[_0x13c8('0x3')]=function(_0x4954c2,_0x5913e9){var _0x5c3ba4={'method':'POST','uri':url[_0x13c8('0x4')](_0x5913e9[_0x13c8('0x5')],_0x13c8('0x6')),'form':{'grant_type':_0x13c8('0x7'),'username':_0x5913e9[_0x13c8('0x8')],'password':_0x5913e9[_0x13c8('0x7')]},'json':!![]};return rp(_0x5c3ba4)[_0x13c8('0x9')](function(_0x4f7bcc){var _0x17c228={'method':'POST','uri':url[_0x13c8('0x4')](_0x5913e9[_0x13c8('0xa')],_0x13c8('0xb')),'body':{'type':_0x5913e9[_0x13c8('0xc')]||_0x13c8('0xd'),'channelId':_0x13c8('0xe'),'conversation':{'id':_0x4954c2[_0x13c8('0xf')]},'from':{'id':_0x4954c2[_0x13c8('0x10')],'name':_0x4954c2[_0x13c8('0x11')]},'recipient':{'id':_0x4954c2[_0x13c8('0x12')],'name':_0x4954c2[_0x13c8('0x13')]},'text':_0x5913e9[_0x13c8('0x14')],'channelData':{}},'headers':{'Authorization':_0x13c8('0x15')+_0x4f7bcc[_0x13c8('0x16')]},'json':!![]};if(_0x5913e9['project']){_0x17c228[_0x13c8('0x17')][_0x13c8('0x18')][_0x13c8('0x19')]=_0x5913e9[_0x13c8('0x1a')];}if(_0x5913e9['ndagenerate_audio']=='1'){_0x17c228[_0x13c8('0x17')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5913e9[_0x13c8('0x1b')]){_0x17c228['body'][_0x13c8('0x18')][_0x13c8('0x1c')]=_0x5913e9[_0x13c8('0x1b')];if(_0x5913e9[_0x13c8('0x1d')]){_0x17c228['body'][_0x13c8('0x18')][_0x13c8('0x1e')]=_0x5913e9[_0x13c8('0x1d')];}}logger[_0x13c8('0x1f')](JSON[_0x13c8('0x20')](_0x17c228));return rp(_0x17c228);});}; \ 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 8a00e7e..6c61d92 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 _0x4075=['./lib/api'];(function(_0x44456b,_0x5bfba1){var _0x411368=function(_0x53eecd){while(--_0x53eecd){_0x44456b['push'](_0x44456b['shift']());}};_0x411368(++_0x5bfba1);}(_0x4075,0x71));var _0x5407=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x4075[_0x32b542];return _0x554d54;};'use strict';var asr=require(_0x5407('0x0'));module['exports']=function(_0x143853,_0x392990,_0x19621d,_0x3960c1){return asr(_0x143853,_0x392990,_0x19621d,_0x3960c1);}; \ No newline at end of file +var _0xb0e5=['exports'];(function(_0x1376e2,_0xc498c6){var _0x3ccc29=function(_0x34b060){while(--_0x34b060){_0x1376e2['push'](_0x1376e2['shift']());}};_0x3ccc29(++_0xc498c6);}(_0xb0e5,0xc4));var _0x5b0e=function(_0x2443d9,_0x32d420){_0x2443d9=_0x2443d9-0x0;var _0x12f606=_0xb0e5[_0x2443d9];return _0x12f606;};'use strict';var asr=require('./lib/api');module[_0x5b0e('0x0')]=function(_0x16bde8,_0x1b4ea1,_0x369223,_0xe29b36){return asr(_0x16bde8,_0x1b4ea1,_0x369223,_0xe29b36);}; \ 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 47b9a7b..7bc1477 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 _0x20cc=['open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x24f379,_0x4bfb5b){var _0x35e934=function(_0x260a20){while(--_0x260a20){_0x24f379['push'](_0x24f379['shift']());}};_0x35e934(++_0x4bfb5b);}(_0x20cc,0x74));var _0xc20c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x20cc[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0xc20c('0x0'));var _=require(_0xc20c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc20c('0x2'));var crypto=require(_0xc20c('0x3'));var logger=require(_0xc20c('0x4'))('agi');module[_0xc20c('0x5')]=function(_0x43f91d,_0x449bb3,_0x65ad11,_0x1c8f6f){return new BPromise(function(_0xb140d5,_0xef80e5){logger[_0xc20c('0x6')](_0xc20c('0x7'),_0x1c8f6f||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x6fac40=new WebSocket(_0x1c8f6f||_0xc20c('0x8'),{'perMessageDeflate':![]});var _0x529b3f='';var _0x2af5a0='0';var _0x103c7a='1';var _0x403f5e='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x20703f(_0x495f05){var _0x539b1c=crypto['createHash'](_0xc20c('0x9'));_0x539b1c[_0xc20c('0xa')](_0x495f05);return _0x539b1c[_0xc20c('0xb')](_0xc20c('0xc'));}function _0x5c3954(){try{logger['info'](_0xc20c('0xd'));var _0x50bbaf=moment()[_0xc20c('0xe')]();var _0x1b9de8=_0x20703f(_0x50bbaf+_0x449bb3+_0x65ad11);_0x6fac40[_0xc20c('0xf')](JSON[_0xc20c('0x10')]({'appID':_0x449bb3,'timestamp':_0x50bbaf,'appKey':_0x1b9de8}));var _0x46a003=fs['createReadStream'](_0x43f91d);_0x46a003['on']('data',function(_0x521c6a){_0x6fac40[_0xc20c('0xf')](_0x521c6a);});_0x46a003['on'](_0xc20c('0x11'),function(){_0x6fac40['send']('EOS');});}catch(_0x56814e){logger[_0xc20c('0x12')](_0xc20c('0x13'),JSON[_0xc20c('0x10')](_0x56814e));_0x6fac40[_0xc20c('0x14')]();}}function _0x337e63(_0x255c36){try{if(_0x255c36){var _0x4acd3d=JSON[_0xc20c('0x15')](_0x255c36);switch(_0x4acd3d[_0xc20c('0x16')]){case 0x0:if(_0x4acd3d[_0xc20c('0x17')]){if(_0x4acd3d[_0xc20c('0x17')]['final']){logger[_0xc20c('0x6')](_0xc20c('0x18'),JSON[_0xc20c('0x10')](_0x4acd3d[_0xc20c('0x17')][_0xc20c('0x19')]));_0x529b3f=_0x4acd3d[_0xc20c('0x17')][_0xc20c('0x19')][0x0][_0xc20c('0x1a')];_0x2af5a0=_0x4acd3d['result']['hypotheses'][0x0][_0xc20c('0x1b')];_0x103c7a='0';_0x403f5e='Success.';_0x6fac40[_0xc20c('0x14')]();}}break;case 0x1:logger[_0xc20c('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x103c7a='1';_0x403f5e='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xc20c('0x1c'));_0x103c7a='2';_0x403f5e=_0xc20c('0x1c');break;case 0x9:logger[_0xc20c('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x103c7a='9';_0x403f5e=_0xc20c('0x1d');break;case 0xa:logger[_0xc20c('0x6')](_0xc20c('0x1e'));_0x103c7a='10';_0x403f5e='Authentication\x20failed.';break;case 0xb:logger[_0xc20c('0x6')](_0xc20c('0x1f'));_0x103c7a='11';_0x403f5e=_0xc20c('0x1f');}}}catch(_0x61aede){logger[_0xc20c('0x12')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xc20c('0x10')](_0x61aede));_0x6fac40['terminate']();}}function _0x58bd9b(){logger[_0xc20c('0x6')](_0xc20c('0x20'));_0xb140d5({'transcript':_0x529b3f,'confidence':_0x2af5a0,'status':_0x103c7a,'status_message':_0x403f5e});}function _0x23758e(_0x250855){logger[_0xc20c('0x12')](_0xc20c('0x21'));if(!_[_0xc20c('0x22')](_0x250855)){logger['error'](_[_0xc20c('0x23')](_0x250855)?JSON['stringify'](_0x250855):_0x250855);}}_0x6fac40['on'](_0xc20c('0x24'),_0x5c3954);_0x6fac40['on'](_0xc20c('0x25'),_0x337e63);_0x6fac40['on']('close',_0x58bd9b);_0x6fac40['on'](_0xc20c('0x12'),_0x23758e);});}; \ No newline at end of file +var _0x2903=['Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','crypto','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','transcript','likelihood','terminate','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.'];(function(_0xd353d3,_0x2ed291){var _0x10cf0e=function(_0x5285c1){while(--_0x5285c1){_0xd353d3['push'](_0xd353d3['shift']());}};_0x10cf0e(++_0x2ed291);}(_0x2903,0xd7));var _0x3290=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2903[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require('bluebird');var _=require(_0x3290('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3290('0x1'));var logger=require('../../../../../../config/logger')('agi');module[_0x3290('0x2')]=function(_0x4e1898,_0x191af7,_0x5bcfb9,_0x4de832){return new BPromise(function(_0x4d85e3,_0xc6a4dc){logger[_0x3290('0x3')](_0x3290('0x4'),_0x4de832||_0x3290('0x5'));var _0x1fda8f=new WebSocket(_0x4de832||_0x3290('0x5'),{'perMessageDeflate':![]});var _0x25bc1e='';var _0x2e2811='0';var _0x563cb9='1';var _0x1894d4=_0x3290('0x6');function _0x5c1c52(_0x549be0){var _0x45951a=crypto[_0x3290('0x7')](_0x3290('0x8'));_0x45951a[_0x3290('0x9')](_0x549be0);return _0x45951a[_0x3290('0xa')]('hex');}function _0x21e700(){try{logger[_0x3290('0x3')](_0x3290('0xb'));var _0x422070=moment()['unix']();var _0x2ab45=_0x5c1c52(_0x422070+_0x191af7+_0x5bcfb9);_0x1fda8f[_0x3290('0xc')](JSON[_0x3290('0xd')]({'appID':_0x191af7,'timestamp':_0x422070,'appKey':_0x2ab45}));var _0x521729=fs['createReadStream'](_0x4e1898);_0x521729['on'](_0x3290('0xe'),function(_0x212463){_0x1fda8f[_0x3290('0xc')](_0x212463);});_0x521729['on'](_0x3290('0xf'),function(){_0x1fda8f[_0x3290('0xc')]('EOS');});}catch(_0x24ca12){logger[_0x3290('0x10')](_0x3290('0x11'),JSON[_0x3290('0xd')](_0x24ca12));_0x1fda8f['terminate']();}}function _0x7a5677(_0x1b880e){try{if(_0x1b880e){var _0x58c26a=JSON[_0x3290('0x12')](_0x1b880e);switch(_0x58c26a[_0x3290('0x13')]){case 0x0:if(_0x58c26a[_0x3290('0x14')]){if(_0x58c26a[_0x3290('0x14')][_0x3290('0x15')]){logger[_0x3290('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0x3290('0xd')](_0x58c26a[_0x3290('0x14')][_0x3290('0x16')]));_0x25bc1e=_0x58c26a[_0x3290('0x14')][_0x3290('0x16')][0x0][_0x3290('0x17')];_0x2e2811=_0x58c26a['result']['hypotheses'][0x0][_0x3290('0x18')];_0x563cb9='0';_0x1894d4='Success.';_0x1fda8f[_0x3290('0x19')]();}}break;case 0x1:logger[_0x3290('0x3')](_0x3290('0x6'));_0x563cb9='1';_0x1894d4=_0x3290('0x6');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x563cb9='2';_0x1894d4=_0x3290('0x1a');break;case 0x9:logger[_0x3290('0x3')](_0x3290('0x1b'));_0x563cb9='9';_0x1894d4=_0x3290('0x1b');break;case 0xa:logger[_0x3290('0x3')](_0x3290('0x1c'));_0x563cb9='10';_0x1894d4=_0x3290('0x1c');break;case 0xb:logger[_0x3290('0x3')](_0x3290('0x1d'));_0x563cb9='11';_0x1894d4=_0x3290('0x1d');}}}catch(_0x1d0454){logger['error'](_0x3290('0x1e'),JSON[_0x3290('0xd')](_0x1d0454));_0x1fda8f['terminate']();}}function _0x43e854(){logger[_0x3290('0x3')](_0x3290('0x1f'));_0x4d85e3({'transcript':_0x25bc1e,'confidence':_0x2e2811,'status':_0x563cb9,'status_message':_0x1894d4});}function _0x426395(_0x18ba5c){logger[_0x3290('0x10')](_0x3290('0x20'));if(!_[_0x3290('0x21')](_0x18ba5c)){logger['error'](_[_0x3290('0x22')](_0x18ba5c)?JSON['stringify'](_0x18ba5c):_0x18ba5c);}}_0x1fda8f['on']('open',_0x21e700);_0x1fda8f['on']('message',_0x7a5677);_0x1fda8f['on'](_0x3290('0xf'),_0x43e854);_0x1fda8f['on']('error',_0x426395);});}; \ 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 9258b9a..fc4bfda 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 _0x94ba=['./asr'];(function(_0x30963b,_0x4baeec){var _0x38f02d=function(_0x43171f){while(--_0x43171f){_0x30963b['push'](_0x30963b['shift']());}};_0x38f02d(++_0x4baeec);}(_0x94ba,0x1f1));var _0xa94b=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0x94ba[_0x52b844];return _0x14432f;};var asr=require(_0xa94b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xebf4=['exports','./asr'];(function(_0x4176c8,_0xd338d9){var _0x2ffdb5=function(_0x2a0e19){while(--_0x2a0e19){_0x4176c8['push'](_0x4176c8['shift']());}};_0x2ffdb5(++_0xd338d9);}(_0xebf4,0x125));var _0x4ebf=function(_0x1574a6,_0x2dabf5){_0x1574a6=_0x1574a6-0x0;var _0x350524=_0xebf4[_0x1574a6];return _0x350524;};var asr=require(_0x4ebf('0x0'));module[_0x4ebf('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 759a97f..a8a3465 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 _0x2243=['call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','connection','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./error','./channel'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x2243,0xaf));var _0x3224=function(_0x405916,_0x333718){_0x405916=_0x405916-0x0;var _0x2b6435=_0x2243[_0x405916];return _0x2b6435;};'use strict';var util=require('util');var net=require(_0x3224('0x0'));var EventEmitter=require(_0x3224('0x1'))[_0x3224('0x2')];var AGIError=require(_0x3224('0x3'));var AGIChannel=require(_0x3224('0x4'));var AGIServer=function(_0x4f2a88,_0x1b37cb,_0x4e5adc){var _0x3e62cc=this,_0x4f2a88=_0x4f2a88||0x11dd,_0x1b37cb=_0x1b37cb||'127.0.0.1',_0x2c2f10=null,_0x4c84db=0x0;EventEmitter[_0x3224('0x5')](_0x3e62cc);function _0xb23d37(){if(!_0x4f2a88){_0x3e62cc[_0x3224('0x6')](_0x3224('0x7'),new AGIError(_0x3224('0x8')));return![];}_0x2c2f10=net[_0x3224('0x9')]();_0x2c2f10[_0x3224('0xa')](_0x4f2a88,_0x1b37cb);_0x2c2f10['on']('listening',function(){_0x3e62cc[_0x3224('0x6')]('listening');});_0x2c2f10['on'](_0x3224('0xb'),function(_0x4b0263){_0x2c2f10['getConnections'](function(_0x383593,_0x43ccd9){if(_0x383593){_0x3e62cc['emit']('error',new AGIError(_0x3224('0xc'),_0x383593));}else if(_0x4e5adc&&_0x4e5adc<0x0){_0x3e62cc['emit'](_0x3224('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x4b0263[_0x3224('0xd')]();}else if(_0x4e5adc&&_0x4e5adc>0x0&&_0x4e5adc<_0x43ccd9){_0x4c84db+=0x1;_0x3e62cc[_0x3224('0x6')](_0x3224('0x7'),new AGIError(_0x3224('0xe'),_0x4c84db));_0x4b0263[_0x3224('0xd')]();}else{var _0x34a6a2=new AGIChannel(_0x4b0263);_0x34a6a2['on']('ready',function(){_0x3e62cc['emit']('connection',_0x34a6a2);});}});});_0x2c2f10['on'](_0x3224('0x7'),function(_0x301a42){_0x3e62cc[_0x3224('0x6')](_0x3224('0x7'),new AGIError(_0x3224('0xc'),_0x301a42['code']));});_0x2c2f10['on'](_0x3224('0xf'),function(){_0x3e62cc['emit'](_0x3224('0xf'),new AGIError(_0x3224('0x10')));});}process[_0x3224('0x11')](function(){_0xb23d37();});};util[_0x3224('0x12')](AGIServer,EventEmitter);module[_0x3224('0x13')]=function(_0x51863d,_0x5c6182,_0x3868c5){return new AGIServer(_0x51863d,_0x5c6182,_0x3868c5);}; \ No newline at end of file +var _0xa1ee=['error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','emit','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','127.0.0.1','call'];(function(_0x4e8874,_0x27fb0e){var _0x967dce=function(_0x42ecbe){while(--_0x42ecbe){_0x4e8874['push'](_0x4e8874['shift']());}};_0x967dce(++_0x27fb0e);}(_0xa1ee,0x7d));var _0xea1e=function(_0x837dad,_0x1d9098){_0x837dad=_0x837dad-0x0;var _0x1d62d3=_0xa1ee[_0x837dad];return _0x1d62d3;};'use strict';var util=require(_0xea1e('0x0'));var net=require(_0xea1e('0x1'));var EventEmitter=require(_0xea1e('0x2'))[_0xea1e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xea1e('0x4'));var AGIServer=function(_0x233bad,_0x3fed6a,_0x438a9f){var _0x9c6335=this,_0x233bad=_0x233bad||0x11dd,_0x3fed6a=_0x3fed6a||_0xea1e('0x5'),_0x3cfdd7=null,_0x2f6205=0x0;EventEmitter[_0xea1e('0x6')](_0x9c6335);function _0x524bd4(){if(!_0x233bad){_0x9c6335['emit'](_0xea1e('0x7'),new AGIError(_0xea1e('0x8')));return![];}_0x3cfdd7=net[_0xea1e('0x9')]();_0x3cfdd7[_0xea1e('0xa')](_0x233bad,_0x3fed6a);_0x3cfdd7['on'](_0xea1e('0xb'),function(){_0x9c6335['emit'](_0xea1e('0xb'));});_0x3cfdd7['on'](_0xea1e('0xc'),function(_0x30df4e){_0x3cfdd7['getConnections'](function(_0x12fb2d,_0x5f0cda){if(_0x12fb2d){_0x9c6335[_0xea1e('0xd')](_0xea1e('0x7'),new AGIError(_0xea1e('0xe'),_0x12fb2d));}else if(_0x438a9f&&_0x438a9f<0x0){_0x9c6335[_0xea1e('0xd')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x30df4e[_0xea1e('0xf')]();}else if(_0x438a9f&&_0x438a9f>0x0&&_0x438a9f<_0x5f0cda){_0x2f6205+=0x1;_0x9c6335[_0xea1e('0xd')](_0xea1e('0x7'),new AGIError(_0xea1e('0x10'),_0x2f6205));_0x30df4e[_0xea1e('0xf')]();}else{var _0x19dfe7=new AGIChannel(_0x30df4e);_0x19dfe7['on'](_0xea1e('0x11'),function(){_0x9c6335[_0xea1e('0xd')]('connection',_0x19dfe7);});}});});_0x3cfdd7['on'](_0xea1e('0x7'),function(_0x46a6cb){_0x9c6335[_0xea1e('0xd')](_0xea1e('0x7'),new AGIError(_0xea1e('0xe'),_0x46a6cb['code']));});_0x3cfdd7['on'](_0xea1e('0x12'),function(){_0x9c6335[_0xea1e('0xd')](_0xea1e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xea1e('0x13')](function(){_0x524bd4();});};util[_0xea1e('0x14')](AGIServer,EventEmitter);module[_0xea1e('0x15')]=function(_0x52d6da,_0x1a5f16,_0x266dec){return new AGIServer(_0x52d6da,_0x1a5f16,_0x266dec);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 56d3f59..270709d 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 _0x83d3=['agentPause','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','clone','isString','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','mrcprecog','grammar','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','dialogflow','Dialogflow\x20Result\x20%s','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','out','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','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','DIAL','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','stringify','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','generate','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','rpc','mailRpc','prototype','getVariable','catch','getVoiceQueue','then','getSquareProjectById','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getIntervals','getIntervalById','IntervalId','map','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','utcOffset','scheduledat','add','insertContact','getPause','getPauseById','agent'];(function(_0x277d61,_0xab8c96){var _0x34f6e1=function(_0x2d19b7){while(--_0x2d19b7){_0x277d61['push'](_0x277d61['shift']());}};_0x34f6e1(++_0xab8c96);}(_0x83d3,0x17c));var _0x383d=function(_0x3d9e94,_0x48136c){_0x3d9e94=_0x3d9e94-0x0;var _0x45f76e=_0x83d3[_0x3d9e94];return _0x45f76e;};'use strict';var fs=require('fs');var path=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var _=require(_0x383d('0x2'));var sh=require(_0x383d('0x3'));var odbc=require(_0x383d('0x4'))();var rs=require('randomstring');var moment=require(_0x383d('0x5'));var Mustache=require(_0x383d('0x6'));var rp=require(_0x383d('0x7'));var logger=require(_0x383d('0x8'))('agi');var config=require(_0x383d('0x9'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x383d('0xa');var recursiveMapAttributes=[_0x383d('0xb'),_0x383d('0xc')];var verticesWithRetry=['menu',_0x383d('0xd'),'getsecretdigits'];var AGIVertices=function(_0x5228f3,_0x221079,_0x1f5195){this['channel']=_0x5228f3;this[_0x383d('0xe')]=_0x221079;this[_0x383d('0xf')]=_0x1f5195;};AGIVertices[_0x383d('0x10')][_0x383d('0x11')]=function(_0x42a26d,_0x1ebab5){this['rpc']['getVariableById'](_0x42a26d)['then'](function(_0x15e7cf){_0x1ebab5(null,_0x15e7cf?_0x15e7cf['name']:![]);})[_0x383d('0x12')](function(_0x44bc6a){_0x1ebab5(_0x44bc6a);});};AGIVertices[_0x383d('0x10')][_0x383d('0x13')]=function(_0x4c6d4f,_0x556fee){this[_0x383d('0xe')]['getVoiceQueueById'](_0x4c6d4f)[_0x383d('0x14')](function(_0x5afc53){_0x556fee(null,_0x5afc53?_0x5afc53['name']:![]);})[_0x383d('0x12')](function(_0x31abf5){_0x556fee(_0x31abf5);});};AGIVertices['prototype']['getSquareProject']=function(_0x11c1f9,_0x2a3025){this['rpc'][_0x383d('0x15')](_0x11c1f9)[_0x383d('0x14')](function(_0xed4b0b){_0x2a3025(null,_0xed4b0b?_0xed4b0b[_0x383d('0x16')]:![]);})[_0x383d('0x12')](function(_0x38a2d7){_0x2a3025(_0x38a2d7);});};AGIVertices[_0x383d('0x10')]['getSquareOdbc']=function(_0x418c8c,_0x967e75){this[_0x383d('0xe')][_0x383d('0x17')](_0x418c8c)[_0x383d('0x14')](function(_0x45ee85){_0x967e75(null,_0x45ee85?_0x45ee85[_0x383d('0x18')]:![]);})['catch'](function(_0x4bb2d7){_0x967e75(_0x4bb2d7);});};AGIVertices[_0x383d('0x10')][_0x383d('0x19')]=function(_0x4e3d9e,_0x17d883){this[_0x383d('0xe')][_0x383d('0x1a')](_0x4e3d9e)[_0x383d('0x14')](function(_0x3e36a2){_0x17d883(null,_0x3e36a2?_0x3e36a2[_0x383d('0x16')]:![]);})[_0x383d('0x12')](function(_0x3e447e){_0x17d883(_0x3e447e);});};AGIVertices[_0x383d('0x10')][_0x383d('0x1b')]=function(_0x4b2e89,_0x599756){this[_0x383d('0xe')][_0x383d('0x1c')](_0x4b2e89)[_0x383d('0x14')](function(_0x70fdba){_0x599756(null,_0x70fdba?_0x70fdba[_0x383d('0x16')]:![]);})[_0x383d('0x12')](function(_0x40b06b){_0x599756(_0x40b06b);});};AGIVertices['prototype'][_0x383d('0x1d')]=function(_0x2fc7de,_0x49c0cc){var _0x5ec050=this;this[_0x383d('0xe')][_0x383d('0x1e')](_0x2fc7de)[_0x383d('0x14')](function(_0xbe4a1f){_0x49c0cc(null,_0xbe4a1f?_0x5ec050[_0x383d('0x1f')](_0xbe4a1f[_0x383d('0x20')]):![]);})['catch'](function(_0x1756cd){_0x49c0cc(_0x1756cd);});};AGIVertices['prototype']['getMailAccount']=function(_0x44ad95,_0x29b3d5){this[_0x383d('0xe')]['getMailAccountById'](_0x44ad95)[_0x383d('0x14')](function(_0x30520a){_0x29b3d5(null,_0x30520a?_0x30520a:![]);})['catch'](function(_0x1b2353){_0x29b3d5(_0x1b2353);});};AGIVertices[_0x383d('0x10')]['sendMailMessage']=function(_0x26f0a3,_0x4f9e3c,_0x1617ce){this[_0x383d('0xf')]['sendMailMessage'](_0x26f0a3,_0x4f9e3c)[_0x383d('0x14')](function(){_0x1617ce(null);})['catch'](function(_0x38ddfa){_0x1617ce(_0x38ddfa);});};AGIVertices['prototype'][_0x383d('0x21')]=function(_0x47b74b,_0x238385){this['rpc'][_0x383d('0x22')](_0x47b74b)[_0x383d('0x14')](function(_0x2c6672){if(_0x2c6672){if(_0x2c6672[_0x383d('0x23')]){_0x238385(null,[_0x2c6672['interval']]);}else{_0x238385(null,_[_0x383d('0x24')](_0x2c6672['Intervals'],_0x383d('0x25')));}}else{_0x238385(null,![]);}})[_0x383d('0x12')](function(_0xe8dbe4){_0x238385(_0xe8dbe4);});};AGIVertices[_0x383d('0x10')][_0x383d('0x1f')]=function(_0x1f6313){return util['format'](_0x383d('0x26'),FILES_PATH,_0x1f6313);};AGIVertices[_0x383d('0x10')][_0x383d('0x27')]=function(_0x4fd970,_0x4402c9,_0x190b0d){odbc[_0x383d('0x28')](_0x4fd970,function(_0x5aa92e){if(_0x5aa92e){logger[_0x383d('0x29')](_0x383d('0x2a'),_0x5aa92e);_0x190b0d(_0x5aa92e);}else{logger[_0x383d('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x383d('0x2c')](_0x4402c9,function(_0x51aa4c,_0x38f783){if(_0x51aa4c){logger[_0x383d('0x2b')]('Error\x20executing\x20query\x20%s',_0x4402c9);_0x190b0d(_0x51aa4c);}else{logger['info'](_0x383d('0x2d'),_0x4402c9);odbc[_0x383d('0x2e')](function(_0x16ebc3){if(_0x16ebc3){logger[_0x383d('0x29')](_0x383d('0x2f'),_0x16ebc3);}_0x190b0d(null,_0x38f783);});}});}});};AGIVertices[_0x383d('0x10')][_0x383d('0x30')]=function(_0x3d14b3,_0x59b1a9){this[_0x383d('0xe')][_0x383d('0x31')](_0x3d14b3)['then'](function(_0x3d2880){_0x59b1a9(null,_0x3d2880?_0x3d2880:![]);})[_0x383d('0x12')](function(_0x40a2d6){_0x59b1a9(_0x40a2d6);});};AGIVertices[_0x383d('0x10')][_0x383d('0x32')]=function(_0x1488c4,_0x379b41){this[_0x383d('0xe')][_0x383d('0x32')](_0x1488c4)['then'](function(_0x1d6e6c){_0x379b41(null,_0x1d6e6c);})[_0x383d('0x12')](function(_0x1b02ad){_0x379b41(_0x1b02ad);});};AGIVertices['prototype'][_0x383d('0x33')]=function(_0x2291c4,_0x344e66,_0x508cf3){this['rpc'][_0x383d('0x33')]({'uniqueid':this['channel'][_0x383d('0x34')],'node':_0x2291c4[_0x383d('0x35')],'application':_0x2291c4[_0x383d('0x36')],'data':_0x344e66||null,'project_name':this[_0x383d('0x37')][_0x383d('0x38')],'callerid':this[_0x383d('0x37')][_0x383d('0x39')]})[_0x383d('0x14')](function(_0x45880e){if(_0x508cf3){_0x508cf3(null,_0x45880e);}})[_0x383d('0x12')](function(_0x5072a5){if(_0x508cf3){_0x508cf3(_0x5072a5);}});};AGIVertices[_0x383d('0x10')][_0x383d('0x3a')]=function(_0x59cabf,_0x4735c0,_0xa8b119,_0x51109e){this[_0x383d('0xe')]['createSquareRecording']({'uniqueid':this[_0x383d('0x37')]['uniqueid'],'callerid':this['channel'][_0x383d('0x39')],'calleridname':this[_0x383d('0x37')][_0x383d('0x3b')],'context':this[_0x383d('0x37')][_0x383d('0x3c')],'extension':this['channel'][_0x383d('0x3d')],'priority':this[_0x383d('0x37')][_0x383d('0x3e')],'accountcode':this[_0x383d('0x37')]['accountcode'],'dnid':this[_0x383d('0x37')][_0x383d('0x3f')],'projectName':this[_0x383d('0x37')][_0x383d('0x38')],'saveName':_0x4735c0,'filename':_0x59cabf[_0x383d('0x40')]||_0x4735c0,'savePath':_0xa8b119})['then'](function(_0x7f42b0){_0x51109e(null,_0x7f42b0);})[_0x383d('0x12')](function(_0x1ed996){_0x51109e(_0x1ed996);});};AGIVertices[_0x383d('0x10')][_0x383d('0x41')]=function(_0x3acd8e,_0x3aa5c4,_0x3577f5,_0x3511a6,_0x21dd6a){this[_0x383d('0xe')][_0x383d('0x41')]({'uniqueid':this[_0x383d('0x37')][_0x383d('0x34')],'body':_0x3acd8e,'direction':_0x3aa5c4,'providerName':_0x3577f5,'providerResponse':_0x3511a6})[_0x383d('0x14')](function(_0x4210e9){if(_0x21dd6a){_0x21dd6a(null,_0x4210e9);}})[_0x383d('0x12')](function(_0x187897){if(_0x21dd6a){_0x21dd6a(_0x187897);}});};AGIVertices[_0x383d('0x10')][_0x383d('0x42')]=function(_0x5defb2,_0x1ca674){var _0x1dec73=this;var _0x3c97a0=0x0;var _0x16dd4f={'firstName':_[_0x383d('0x43')](_0x5defb2[_0x383d('0x16')])||_[_0x383d('0x44')](_0x5defb2[_0x383d('0x16')])?'callback_'+Math['random']():_0x5defb2['name'],'lastName':_[_0x383d('0x43')](_0x5defb2['lastName'])||_[_0x383d('0x44')](_0x5defb2[_0x383d('0x45')])?null:_0x5defb2[_0x383d('0x45')],'phone':_0x5defb2[_0x383d('0x46')],'ListId':_0x5defb2[_0x383d('0x47')],'scheduledat':_0x5defb2[_0x383d('0x48')],'callbackUniqueid':this[_0x383d('0x37')][_0x383d('0x34')],'tags':_0x383d('0x49'),'description':_0x383d('0x4a')+_0x5defb2['scheduledAt']['toString'](),'priority':_0x5defb2[_0x383d('0x4b')]};if(_['has'](_0x5defb2,_0x383d('0x4c'))){if(!_['isNil'](_0x5defb2[_0x383d('0x4c')])){var _0x5cda0d=_0x5defb2[_0x383d('0x4c')];if(_0x5defb2['dialTimezone']==_0x383d('0x4d')){this[_0x383d('0xe')][_0x383d('0x4e')]({'phone':_0x5defb2[_0x383d('0x46')]})[_0x383d('0x14')](function(_0x27830b){if(!_[_0x383d('0x44')](_0x27830b)){var _0x5db009=_0x27830b[_0x383d('0x4c')];if(!_['isNil'](_0x5db009)){var _0x47405e=shared[_0x383d('0x4f')][_0x5db009];if(!_[_0x383d('0x44')](_0x47405e)){var _0x318c0f=-0x1*_0x47405e[_0x383d('0x50')];_0x16dd4f['scheduledat']=moment(_0x5defb2[_0x383d('0x51')])[_0x383d('0x52')](_0x318c0f,'minutes');_0x1dec73['insertContact'](_0x16dd4f,_0x5defb2,_0x1ca674);}else{_0x1dec73[_0x383d('0x53')](_0x16dd4f,_0x5defb2,_0x1ca674);}}else{_0x1dec73[_0x383d('0x53')](_0x16dd4f,_0x5defb2,_0x1ca674);}}else{_0x1dec73['insertContact'](_0x16dd4f,_0x5defb2,_0x1ca674);}});}else{var _0x3c97a0=shared[_0x383d('0x4f')][_0x5cda0d];if(!_[_0x383d('0x44')](_0x3c97a0)){var _0x37a951=-0x1*_0x3c97a0[_0x383d('0x50')];_0x16dd4f[_0x383d('0x51')]=moment(_0x5defb2[_0x383d('0x51')])['add'](_0x37a951,'minutes');_0x1dec73[_0x383d('0x53')](_0x16dd4f,_0x5defb2,_0x1ca674);}else{_0x1dec73[_0x383d('0x53')](_0x16dd4f,_0x5defb2,_0x1ca674);}}}else{_0x1dec73[_0x383d('0x53')](_0x16dd4f,_0x5defb2,_0x1ca674);}}else{_0x1dec73[_0x383d('0x53')](_0x16dd4f,_0x5defb2,_0x1ca674);}};AGIVertices[_0x383d('0x10')][_0x383d('0x54')]=function(_0x5c4550,_0x1a7198){this[_0x383d('0xe')][_0x383d('0x55')](_0x5c4550)[_0x383d('0x14')](function(_0x37c469){_0x1a7198(null,_0x37c469?_0x37c469[_0x383d('0x16')]:![]);})['catch'](function(_0x298eed){_0x1a7198(_0x298eed);});};AGIVertices[_0x383d('0x10')]['agentPause']=function(_0x251934,_0x415cef,_0x53f81a){var _0xf5cc76={'role':_0x383d('0x56')};_0xf5cc76[_0x251934]=this[_0x383d('0x37')][_0x383d('0x39')];this[_0x383d('0xe')][_0x383d('0x57')](_0xf5cc76,_0x415cef,this[_0x383d('0x37')][_0x383d('0x34')])[_0x383d('0x14')](function(_0x45a4d9){_0x53f81a(null,_[_0x383d('0x44')](_0x45a4d9)?![]:!![]);})[_0x383d('0x12')](function(_0x490af6){logger['error'](_0x490af6);_0x53f81a(null,![]);});};AGIVertices[_0x383d('0x10')][_0x383d('0x58')]=function(_0x11f184,_0x527b3d){var _0x367ba1={'role':'agent'};_0x367ba1[_0x11f184]=this[_0x383d('0x37')][_0x383d('0x39')];this[_0x383d('0xe')][_0x383d('0x58')](_0x367ba1)[_0x383d('0x14')](function(_0x4066bc){_0x527b3d(null,_['isNil'](_0x4066bc)?![]:!![]);})[_0x383d('0x12')](function(_0x428e26){logger['error'](_0x428e26);_0x527b3d(null,![]);});};AGIVertices['prototype'][_0x383d('0x59')]=function(_0x328a8e,_0x189476){var _0x2352b5={'role':'agent'};_0x2352b5[_0x328a8e]=this[_0x383d('0x37')][_0x383d('0x39')];this[_0x383d('0xe')][_0x383d('0x59')](_0x2352b5)[_0x383d('0x14')](function(_0x1c653c){_0x189476(null,_[_0x383d('0x44')](_0x1c653c)?![]:!![]);})['catch'](function(_0x4c30f7){logger[_0x383d('0x29')](_0x4c30f7);_0x189476(null,![]);});};AGIVertices['prototype'][_0x383d('0x5a')]=function(_0x47b2e4,_0x268eb2){var _0x66e384={'role':_0x383d('0x56')};_0x66e384[_0x47b2e4]=this[_0x383d('0x37')]['callerid'];var _0x4c09a0=_0x47b2e4!=_0x383d('0x5b')?util[_0x383d('0x5c')](_0x383d('0x5d'),_0x383d('0x5e'),this[_0x383d('0x37')][_0x383d('0x39')]):undefined;this['rpc'][_0x383d('0x5a')](_0x66e384,_0x4c09a0)['then'](function(_0x1c3922){_0x268eb2(null,_[_0x383d('0x44')](_0x1c3922)?![]:!![]);})[_0x383d('0x12')](function(_0x218034){logger[_0x383d('0x29')](_0x218034);_0x268eb2(null,![]);});};AGIVertices[_0x383d('0x10')][_0x383d('0x5f')]=function(_0x1feaaf,_0x8cf478){sh[_0x383d('0x60')](_[_0x383d('0x61')](_0x1feaaf),function(_0x456100,_0x4f5f47){var _0x418082=_0x4f5f47[_0x383d('0x62')](/(\r\n|\n|\r)/gm,'');_0x8cf478(null,_0x418082);});};AGIVertices[_0x383d('0x10')]['googleCloudTTS']=function(_0x150fee,_0x3d63e4){scripts[_0x383d('0x63')](_0x150fee[_0x383d('0x64')],_0x150fee['google_cloud_tts_text_type']||_0x383d('0x65'),_0x150fee['text'],_0x150fee['languageCode']||_0x383d('0x66'),_0x150fee['ssmlGender']||_0x383d('0x67'),_0x150fee[_0x383d('0x68')]||'MP3')[_0x383d('0x14')](function(_0x4db108){_0x3d63e4(null,_0x4db108);})[_0x383d('0x12')](function(_0x3ae0a5){_0x3d63e4(_0x3ae0a5);});};AGIVertices[_0x383d('0x10')][_0x383d('0x69')]=function(_0x419435,_0x5827d9){scripts['googleTTS'](_0x419435[_0x383d('0x65')],_0x419435[_0x383d('0x6a')]||'en',0x1)['then'](function(_0x478386){_0x5827d9(null,_0x478386);})['catch'](function(_0x494a68){_0x5827d9(_0x494a68);});};AGIVertices[_0x383d('0x10')]['restAPI']=function(_0x3e7a68,_0x3bfb38){var _0x5c7b74={'uri':_0x3e7a68[_0x383d('0x6b')],'method':_0x3e7a68[_0x383d('0x6c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3e7a68[_0x383d('0x6d')])===_0x383d('0x6e')&&parseInt(_0x3e7a68[_0x383d('0x6d')])>=0x1?parseInt(_0x3e7a68[_0x383d('0x6d')])*0x3e8:0x5*0x3e8};if(_[_0x383d('0x6f')]([_0x383d('0x70'),_0x383d('0x71')],_0x5c7b74[_0x383d('0x6c')][_0x383d('0x72')]())){try{_0x5c7b74[_0x383d('0x73')]=_0x3e7a68[_0x383d('0xc')]?JSON['parse'](_0x3e7a68['rawBody']):{};}catch(_0x17b997){logger[_0x383d('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x17b997);}}try{_0x5c7b74['headers']=_0x3e7a68[_0x383d('0xb')]?JSON[_0x383d('0x74')](_0x3e7a68[_0x383d('0xb')]):{};}catch(_0x3baf34){logger['error'](_0x383d('0x75'),_0x3baf34);}if(_0x3e7a68[_0x383d('0x76')]){try{var _0x4da0ad=require(_0x3e7a68[_0x383d('0x76')])[_0x383d('0x77')](this,_0x5c7b74);_0x5c7b74[_0x383d('0x78')]=Mustache[_0x383d('0x79')](_0x3e7a68[_0x383d('0x6b')],_0x4da0ad,{},['$$','$$']);if(_0x5c7b74[_0x383d('0x7a')]){_0x5c7b74['headers']=JSON[_0x383d('0x74')](Mustache[_0x383d('0x79')](JSON['stringify'](_0x5c7b74[_0x383d('0x7a')]),_0x4da0ad,{},['$$','$$']));}if(_0x5c7b74['body']){_0x5c7b74[_0x383d('0x73')]=JSON[_0x383d('0x74')](Mustache[_0x383d('0x79')](JSON['stringify'](_0x5c7b74[_0x383d('0x73')]),_0x4da0ad,{},['$$','$$']));}}catch(_0x1bbaa9){logger['error'](_0x383d('0x7b'),_0x1bbaa9);}}rp(_0x5c7b74)[_0x383d('0x14')](function(_0x4a8a5e){var _0x54b6a6={'statusCode':_0x4a8a5e['statusCode']||0xc8,'statusMessage':_0x4a8a5e[_0x383d('0x7c')]||'OK','headers':_0x4a8a5e[_0x383d('0x7a')]||{},'body':_0x4a8a5e[_0x383d('0x73')]||{}};_0x3bfb38(null,_0x54b6a6);})['catch'](function(_0x3302fd){var _0x579305={'statusCode':_0x3302fd[_0x383d('0x7d')]||0x1f4,'statusMessage':_0x3302fd['message']||_0x383d('0x7e'),'headers':_0x3302fd[_0x383d('0x7f')][_0x383d('0x7a')]||{},'body':_0x3302fd[_0x383d('0x7f')][_0x383d('0x73')]||{}};_0x3bfb38(null,_0x579305);});};AGIVertices[_0x383d('0x10')][_0x383d('0x80')]=function(_0x1bb57f,_0x19815a){scripts[_0x383d('0x80')](this[_0x383d('0x37')][_0x383d('0x34')],_0x1bb57f[_0x383d('0x81')],_0x1bb57f['text'],_0x1bb57f['dialogflow_language']||'en')[_0x383d('0x14')](function(_0x173a7b){_0x19815a(null,_0x173a7b);})['catch'](function(_0x36958){_0x19815a(_0x36958);});};AGIVertices[_0x383d('0x10')][_0x383d('0x82')]=function(_0x25d7be,_0x3a0fbc){scripts[_0x383d('0x82')](this[_0x383d('0x37')]['uniqueid'],_0x25d7be['dialogflowV2_project_id'],_0x25d7be[_0x383d('0x83')],_0x25d7be['private_key'],_0x25d7be[_0x383d('0x65')],_0x25d7be[_0x383d('0x84')]||'en')[_0x383d('0x14')](function(_0x3ba2ba){_0x3a0fbc(null,_0x3ba2ba);})[_0x383d('0x12')](function(_0x8de771){_0x3a0fbc(_0x8de771);});};AGIVertices[_0x383d('0x10')][_0x383d('0x85')]=function(_0x387db2,_0x43257a){scripts[_0x383d('0x85')](this[_0x383d('0x37')],_0x387db2)[_0x383d('0x14')](function(_0x5252e2){_0x43257a(null,_0x5252e2);})[_0x383d('0x12')](function(_0x85e40c){_0x43257a(_0x85e40c);});};AGIVertices['prototype']['ispeechTTS']=function(_0x1034b2,_0x347607){scripts['ispeechTTS'](_0x1034b2[_0x383d('0x81')],_0x1034b2[_0x383d('0x65')],_0x1034b2[_0x383d('0x86')]||_0x383d('0x66'),_0x1034b2[_0x383d('0x87')])[_0x383d('0x14')](function(_0x2bbb13){_0x347607(null,_0x2bbb13);})[_0x383d('0x12')](function(_0x1701cd){_0x347607(_0x1701cd);});};AGIVertices['prototype']['ispeechASR']=function(_0x232c43,_0x45f027,_0x477b43){scripts[_0x383d('0x88')](_0x45f027,_0x232c43[_0x383d('0x81')],_0x232c43[_0x383d('0x89')]||_0x383d('0x66'),this[_0x383d('0x8a')](_0x232c43['model'])?_0x232c43[_0x383d('0x8b')]:undefined)[_0x383d('0x14')](function(_0x5666a5){_0x477b43(null,_0x5666a5);})[_0x383d('0x12')](function(_0x1f43e3){_0x477b43(_0x1f43e3);});};AGIVertices[_0x383d('0x10')][_0x383d('0x8c')]=function(_0x4f3402,_0x41053c){scripts[_0x383d('0x8c')](_0x4f3402[_0x383d('0x8d')],_0x4f3402[_0x383d('0x8e')],_0x4f3402[_0x383d('0x8f')],_0x4f3402['aws_polly_voice']||'Amy',_0x4f3402['text'],_0x4f3402['aws_text_type']||'text')['then'](function(_0x199f90){_0x41053c(null,_0x199f90);})['catch'](function(_0x5a599a){_0x41053c(_0x5a599a);});};AGIVertices['prototype']['awsLex']=function(_0x391e27,_0x50f9d6){scripts[_0x383d('0x90')](this[_0x383d('0x37')][_0x383d('0x34')],_0x391e27[_0x383d('0x8d')],_0x391e27[_0x383d('0x8e')],_0x391e27['aws_lex_region'],_0x391e27[_0x383d('0x65')],_0x391e27[_0x383d('0x91')])[_0x383d('0x14')](function(_0x4a5d33){_0x50f9d6(null,_0x4a5d33);})['catch'](function(_0x42b58a){_0x50f9d6(_0x42b58a);});};AGIVertices[_0x383d('0x10')][_0x383d('0x92')]=function(_0x398d9a,_0x5d80fb,_0x35eb2f){scripts['googleASR'](_0x5d80fb,_0x398d9a[_0x383d('0x81')],_0x398d9a[_0x383d('0x93')]||_0x383d('0x66'))[_0x383d('0x14')](function(_0x39fd76){_0x35eb2f(null,_0x39fd76);})[_0x383d('0x12')](function(_0x1688c9){_0x35eb2f(_0x1688c9);});};AGIVertices[_0x383d('0x10')][_0x383d('0x94')]=function(_0x2142d6,_0x33b3fa,_0x3a380e){scripts[_0x383d('0x94')](_0x33b3fa,_0x2142d6['appid'],_0x2142d6['appsecret'],_0x2142d6[_0x383d('0x78')])[_0x383d('0x14')](function(_0x1d6396){_0x3a380e(null,_0x1d6396);})[_0x383d('0x12')](function(_0x1d9c21){_0x3a380e(_0x1d9c21);});};AGIVertices[_0x383d('0x10')][_0x383d('0x95')]=function(_0x42aff5){var _0x477352=_[_0x383d('0x6f')](verticesWithRetry,_0x42aff5[_0x383d('0x36')])?_0x42aff5:_[_0x383d('0x96')](_0x42aff5);for(var _0x4e5cbb in _0x477352){if(_0x477352['hasOwnProperty'](_0x4e5cbb)){if(_0x477352[_0x4e5cbb]&&_[_0x383d('0x97')](_0x477352[_0x4e5cbb])){if(_[_0x383d('0x6f')](recursiveMapAttributes,_0x4e5cbb)){_0x477352[_0x4e5cbb]=this['replaceObjectAllVariables'](_0x477352[_0x4e5cbb]);}else{_0x477352[_0x4e5cbb]=this[_0x383d('0x98')](_0x477352[_0x4e5cbb]);}}}}return _0x477352;};AGIVertices[_0x383d('0x10')]['recursiveNodeIndex']=function(_0x3ea270){for(var _0x18936 in _0x3ea270){if(_0x3ea270[_0x383d('0x99')](_0x18936)){if(_[_0x383d('0x9a')](_0x3ea270[_0x18936])){this[_0x383d('0x9b')](_0x3ea270[_0x18936]);}else if(_[_0x383d('0x9c')](_0x3ea270[_0x18936])){for(var _0x311d12=0x0;_0x311d12<_0x3ea270[_0x18936][_0x383d('0x9d')];_0x311d12++){this[_0x383d('0x9b')](_0x3ea270[_0x18936][_0x311d12]);}}else if(_[_0x383d('0x97')](_0x3ea270[_0x18936])){_0x3ea270[_0x18936]=this[_0x383d('0x98')](_0x3ea270[_0x18936]);}}}};AGIVertices[_0x383d('0x10')][_0x383d('0x9e')]=function(_0x2dff36,_0x5edd4d){for(var _0x5e0bb4 in _0x2dff36){if(_0x2dff36[_0x383d('0x99')](_0x5e0bb4)){if(_[_0x383d('0x9a')](_0x2dff36[_0x5e0bb4])){if(!_['isEmpty'](_0x2dff36[_0x5e0bb4])){this['saveRestApiResult'](_0x2dff36[_0x5e0bb4],util[_0x383d('0x5c')]('%s.%s',_0x5edd4d,_0x5e0bb4));}}else if(_[_0x383d('0x9c')](_0x2dff36[_0x5e0bb4])){for(var _0x50a2e5=0x0;_0x50a2e5<_0x2dff36[_0x5e0bb4][_0x383d('0x9d')];_0x50a2e5++){this['saveRestApiResult'](_0x2dff36[_0x5e0bb4][_0x50a2e5],util['format'](_0x383d('0x9f'),_0x5edd4d,_0x5e0bb4+'['+_0x50a2e5+']'));}}else{if(!_['isNil'](_0x2dff36[_0x5e0bb4])){this['channel'][_0x383d('0xa0')](util[_0x383d('0x5c')]('%s.%s',_0x5edd4d,_0x5e0bb4),_0x2dff36[_0x5e0bb4]);}}}}};AGIVertices[_0x383d('0x10')][_0x383d('0xa1')]=function(_0x3197a7){try{var _0x2ca79b=JSON[_0x383d('0x74')](_0x3197a7);this[_0x383d('0x9b')](_0x2ca79b);return JSON['stringify'](_0x2ca79b);}catch(_0x223565){return this[_0x383d('0x98')](_0x3197a7);}};AGIVertices[_0x383d('0x10')]['replaceAllVariables']=function(_0xa8b75e){var _0x4f45b7=_0xa8b75e[_0x383d('0xa2')]('{');for(var _0x415081=0x1;_0x415081<_0x4f45b7[_0x383d('0x9d')];_0x415081+=0x1){var _0x2e4c5c=_0x4f45b7[_0x415081][_0x383d('0xa2')]('}');if(_0x2e4c5c[_0x383d('0x9d')]>0x1){_0xa8b75e=_0xa8b75e[_0x383d('0xa3')]('{'+_0x2e4c5c[0x0]+'}',this[_0x383d('0x37')][_0x383d('0x11')](_0x2e4c5c[0x0])[_0x383d('0xa4')]||_0x2e4c5c[0x0]);}}if(_0x4f45b7[_0x383d('0x9d')]===0x1){return _0xa8b75e[_0x383d('0xa5')]();}return this[_0x383d('0x98')](_0xa8b75e);};AGIVertices[_0x383d('0x10')][_0x383d('0xa6')]=function(_0xc67e55,_0x4eab50){var _0xcd58b1=this[_0x383d('0x37')][_0x383d('0x11')](_0xc67e55);if(_0xcd58b1[_0x383d('0xa7')]===-0x1){return _0xcd58b1;}logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4eab50,_0xcd58b1[_0x383d('0xa4')]));return this[_0x383d('0x37')][_0x383d('0xa0')](_0x4eab50,_0xcd58b1[_0x383d('0xa4')]);};AGIVertices['prototype'][_0x383d('0x8a')]=function(_0x2269d0){return _0x2269d0&&_0x2269d0!=='0'&&_0x2269d0!=='-1'&&_0x2269d0!=='';};AGIVertices[_0x383d('0x10')][_0x383d('0xa8')]=function(_0x442621){this[_0x383d('0x33')][_0x383d('0x77')](this,_0x442621,'-');_0x442621[_0x383d('0xa9')]=_0x442621['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x383d('0x10')][_0x383d('0xaa')]=function(_0x32eff3){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0xab'),_0x32eff3[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x32eff3[_0x383d('0x65')])){return this[_0x383d('0x37')][_0x383d('0xac')]('no\x20text\x20configured');}var _0xd7af40='\x22'+_0x32eff3['text']+'\x22';if(this[_0x383d('0x8a')](_0x32eff3[_0x383d('0x7f')])){_0xd7af40+=','+_0x32eff3[_0x383d('0x7f')];}var _0x5e70c7=this['channel']['exec'](_0x383d('0xad'),_0xd7af40);if(_0x5e70c7[_0x383d('0xa7')]===-0x1){return _0x5e70c7;}return this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')]('Executed\x20command\x20MRCPSynth\x20%s',_0xd7af40));};AGIVertices[_0x383d('0x10')][_0x383d('0xae')]=function(_0x121c9){logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x121c9[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x121c9['grammar'])){return this[_0x383d('0x37')]['noop']('no\x20grammar\x20configured');}var _0x5399ff=_0x121c9[_0x383d('0xaf')];if(this[_0x383d('0x8a')](_0x121c9[_0x383d('0x7f')])){_0x5399ff+=','+_0x121c9[_0x383d('0x7f')];}var _0x558c5c=this[_0x383d('0x37')][_0x383d('0x60')]('MRCPRecog',_0x5399ff);if(_0x558c5c[_0x383d('0xa7')]===-0x1){return _0x558c5c;}var _0x3e9a2c=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x3e9a2c[_0x383d('0xa7')]===-0x1){return _0x3e9a2c;}var _0x3bd44d=this['getAndSetVariable'](_0x383d('0xb0'),_0x383d('0xb1'));if(_0x3bd44d[_0x383d('0xa7')]===-0x1){return _0x3bd44d;}var _0x1100a2=this[_0x383d('0xa6')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x1100a2['result']===-0x1){return _0x1100a2;}return this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xb2'),_0x5399ff));};AGIVertices[_0x383d('0x10')][_0x383d('0xb3')]=function(_0x3fd4e5){logger[_0x383d('0x2b')](util['format'](_0x383d('0xb4'),_0x3fd4e5[_0x383d('0x35')]));return this[_0x383d('0x37')][_0x383d('0xb3')]([_0x3fd4e5['command'],_0x3fd4e5[_0x383d('0xb5')]]);};AGIVertices[_0x383d('0x10')]['answer']=function(_0x3a9285){logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3a9285[_0x383d('0x35')]));if(this[_0x383d('0x8a')](_0x3a9285[_0x383d('0x6d')])){logger[_0x383d('0x2b')](util['format'](_0x383d('0xb6'),_0x3a9285[_0x383d('0x6d')]));var _0x1d060b=this[_0x383d('0x37')][_0x383d('0xb7')](_0x3a9285[_0x383d('0x6d')]);if(_0x1d060b['result']===-0x1){return _0x1d060b;}}return this[_0x383d('0x37')][_0x383d('0xb8')]();};AGIVertices[_0x383d('0x10')]['callback']=function(_0x1236ac){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0xb9'),_0x1236ac[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x1236ac[_0x383d('0x47')])){return this['channel'][_0x383d('0x29')](_0x1236ac,'no\x20list\x20selected');}_0x1236ac[_0x383d('0x48')]=moment();if(this[_0x383d('0x8a')](_0x1236ac[_0x383d('0xba')])){_0x1236ac['scheduledAt']=moment()['add'](_0x1236ac[_0x383d('0xba')],_0x383d('0xbb'));}if(!this[_0x383d('0x8a')](_0x1236ac['callback_priority'])){_0x1236ac['callback_priority']=0x2;}this['createCmContact'][_0x383d('0x77')](this,_0x1236ac);return this[_0x383d('0x37')][_0x383d('0xac')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1236ac[_0x383d('0x46')],_0x1236ac['list_id'],_0x1236ac[_0x383d('0x48')]));};AGIVertices['prototype'][_0x383d('0xbc')]=function(_0x4382c5){logger['info'](util[_0x383d('0x5c')](_0x383d('0xbd'),_0x4382c5[_0x383d('0x35')]));var _0x51797c=this[_0x383d('0x37')]['exec'](_0x4382c5[_0x383d('0xbe')],_0x4382c5[_0x383d('0x7f')]);if(_0x51797c['result']===-0x1){return _0x51797c;}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')]('Executed\x20command\x20%s\x20%s',_0x4382c5[_0x383d('0xbe')],_0x4382c5[_0x383d('0x7f')]));};AGIVertices[_0x383d('0x10')]['lumenvoxtts']=function(_0x42e05e){logger['info'](util[_0x383d('0x5c')](_0x383d('0xbf'),_0x42e05e[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x42e05e[_0x383d('0x65')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xc0'));}var _0x4c626e='\x22'+_0x42e05e['text']+'\x22';if(this[_0x383d('0x8a')](_0x42e05e[_0x383d('0x7f')])){_0x4c626e+=','+_0x42e05e[_0x383d('0x7f')];}var _0x44f53d=this[_0x383d('0x37')][_0x383d('0x60')]('MRCPSynth',_0x4c626e);if(_0x44f53d[_0x383d('0xa7')]===-0x1){return _0x44f53d;}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xc1'),_0x4c626e));};AGIVertices['prototype'][_0x383d('0xc2')]=function(_0x13a56){logger['info'](util['format'](_0x383d('0xc3'),_0x13a56[_0x383d('0x35')]));if(!this['isConfigured'](_0x13a56[_0x383d('0x65')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xc0'));}var _0x522b03='\x22'+_0x13a56['text']+'\x22';if(this['isConfigured'](_0x13a56[_0x383d('0x7f')])){_0x522b03+=','+_0x13a56[_0x383d('0x7f')];}var _0x539cbb=this[_0x383d('0x37')]['exec'](_0x383d('0xad'),_0x522b03);if(_0x539cbb['result']===-0x1){return _0x539cbb;}return this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xc1'),_0x522b03));};AGIVertices['prototype']['lumenvoxasr']=function(_0x523a13){logger['info'](util[_0x383d('0x5c')](_0x383d('0xc4'),_0x523a13[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x523a13[_0x383d('0xaf')])){return this[_0x383d('0x37')][_0x383d('0xac')]('no\x20grammar\x20configured');}var _0x138c9b=_0x523a13['grammar'];if(this[_0x383d('0x8a')](_0x523a13[_0x383d('0x7f')])){_0x138c9b+=','+_0x523a13['options'];}var _0x7dbdb1=this[_0x383d('0x37')]['exec']('MRCPRecog',_0x138c9b);if(_0x7dbdb1[_0x383d('0xa7')]===-0x1){return _0x7dbdb1;}var _0x330351=this[_0x383d('0xa6')](_0x383d('0xc5'),_0x383d('0xc6'));if(_0x330351[_0x383d('0xa7')]===-0x1){return _0x330351;}var _0x543a50=this[_0x383d('0xa6')](_0x383d('0xb0'),_0x383d('0xc7'));if(_0x543a50[_0x383d('0xa7')]===-0x1){return _0x543a50;}var _0x4f6253=this['getAndSetVariable'](_0x383d('0xc8'),_0x383d('0xc9'));if(_0x4f6253[_0x383d('0xa7')]===-0x1){return _0x4f6253;}return this['channel']['noop'](util[_0x383d('0x5c')](_0x383d('0xb2'),_0x138c9b));};AGIVertices[_0x383d('0x10')][_0x383d('0xca')]=function(_0x23375e){logger['info'](util[_0x383d('0x5c')](_0x383d('0xcb'),_0x23375e[_0x383d('0x35')]));if(!this['isConfigured'](_0x23375e[_0x383d('0xaf')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xcc'));}var _0xb428ba=_0x23375e[_0x383d('0xaf')];if(this['isConfigured'](_0x23375e['options'])){_0xb428ba+=','+_0x23375e[_0x383d('0x7f')];}var _0x2cb48=this[_0x383d('0x37')][_0x383d('0x60')](_0x383d('0xcd'),_0xb428ba);if(_0x2cb48[_0x383d('0xa7')]===-0x1){return _0x2cb48;}var _0x128797=this[_0x383d('0xa6')](_0x383d('0xc5'),'SESTEK_ASR_CONFIDENCE');if(_0x128797[_0x383d('0xa7')]===-0x1){return _0x128797;}var _0x76bb7b=this[_0x383d('0xa6')](_0x383d('0xb0'),_0x383d('0xce'));if(_0x76bb7b[_0x383d('0xa7')]===-0x1){return _0x76bb7b;}var _0x16d05c=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x16d05c[_0x383d('0xa7')]===-0x1){return _0x16d05c;}return this[_0x383d('0x37')][_0x383d('0xac')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xb428ba));};AGIVertices[_0x383d('0x10')]['database']=function(_0xb39eef){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0xcf'),_0xb39eef[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0xb39eef[_0x383d('0xd0')])){return this[_0x383d('0x37')]['error'](_0xb39eef,_0x383d('0xd1'));}var _0x5926fc=this['getSquareOdbc']['sync'](this,_0xb39eef['odbc_id']);if(!_0x5926fc){return this[_0x383d('0x37')][_0x383d('0x29')](_0xb39eef,_0x383d('0xd2'));}if(!this[_0x383d('0x8a')](_0xb39eef[_0x383d('0x2c')])){return this['channel'][_0x383d('0x29')](_0xb39eef,_0x383d('0xd3'));}var _0x12f1eb=_0xb39eef[_0x383d('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')]('query:\x20%s',_0x12f1eb));var _0x4f5b8d=this[_0x383d('0x27')]['sync'](this,_0x5926fc,_0x12f1eb);this[_0x383d('0x33')][_0x383d('0x77')](this,_0xb39eef,_0x12f1eb);if(!this[_0x383d('0x8a')](_0xb39eef['variable_id'])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xd4'));}var _0x255e90=this[_0x383d('0x11')][_0x383d('0x77')](this,_0xb39eef[_0x383d('0xd5')]);if(!_0x255e90){return this['channel']['error'](_0xb39eef,_0x383d('0xd6'));}var _0x542574=this;_0x4f5b8d[_0x383d('0xd7')](function(_0x165521,_0x2ade81){Object[_0x383d('0xd8')](_0x165521)[_0x383d('0xd7')](function(_0x52fb44){_0x542574[_0x383d('0x37')][_0x383d('0xa0')](util[_0x383d('0x5c')](_0x383d('0xd9'),_0x255e90,_0x2ade81,_0x52fb44),_0x165521[_0x52fb44]);});});this['channel'][_0x383d('0xa0')](util[_0x383d('0x5c')](_0x383d('0xda'),_0x255e90),_0x4f5b8d[_0x383d('0x9d')]);return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xdb'),_0x255e90));};AGIVertices[_0x383d('0x10')]['dial']=function(_0x3c7756){logger[_0x383d('0xdc')](util['format'](_0x383d('0xdd'),_0x3c7756['label']));if(!this[_0x383d('0x8a')](_0x3c7756[_0x383d('0xde')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x3c7756,_0x383d('0xdf'));}var _0x3a822a=this[_0x383d('0x19')][_0x383d('0x77')](this,_0x3c7756[_0x383d('0xde')]);if(!_0x3a822a){return this[_0x383d('0x37')][_0x383d('0x29')](_0x3c7756,_0x383d('0xe0'));}var _0x55e744=this[_0x383d('0x37')][_0x383d('0x60')]('DIAL',[util[_0x383d('0x5c')](_0x383d('0xe1'),_0x3a822a),_0x3c7756['timeout'],_0x3c7756[_0x383d('0xe2')],_0x3c7756[_0x383d('0x6b')]]);if(_0x55e744[_0x383d('0xa7')]===-0x1){return _0x55e744;}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x383d('0x10')]['dialogflow']=function(_0x339eb3){logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x339eb3[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x339eb3[_0x383d('0x81')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xe3'));}if(!this['isConfigured'](_0x339eb3[_0x383d('0x65')])){return this[_0x383d('0x37')]['noop'](_0x383d('0xc0'));}this['channel'][_0x383d('0xe4')]=!![];this[_0x383d('0x33')](_0x339eb3);this[_0x383d('0x41')](_0x339eb3['text'],'in','','');this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xe5'),_0x339eb3[_0x383d('0x65')]));var _0x574a1a=this[_0x383d('0x80')]['sync'](this,_0x339eb3);if(_0x574a1a){for(var _0x59e0f7 in _0x574a1a){if(_0x574a1a[_0x383d('0x99')](_0x59e0f7)){this[_0x383d('0x37')]['setVariable'](util[_0x383d('0x5c')](_0x383d('0xe6'),_0x59e0f7['toUpperCase']()),_0x574a1a[_0x59e0f7]);}}this[_0x383d('0x41')](_0x574a1a[_0x383d('0xe7')],'out',_0x383d('0xe8'),'');return this[_0x383d('0x37')][_0x383d('0xac')](util['format'](_0x383d('0xe9'),_0x574a1a[_0x383d('0xe7')]));}return this['channel'][_0x383d('0x29')](_0x339eb3,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x330a63){logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x330a63[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x330a63['dialogflowV2_project_id'])){return this['channel'][_0x383d('0xac')]('no\x20project_id\x20configured');}if(!this[_0x383d('0x8a')](_0x330a63[_0x383d('0x83')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xea'));}if(!this[_0x383d('0x8a')](_0x330a63[_0x383d('0xeb')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xec'));}if(!this[_0x383d('0x8a')](_0x330a63[_0x383d('0x84')])){return this['channel']['noop'](_0x383d('0xed'));}if(!this[_0x383d('0x8a')](_0x330a63[_0x383d('0x65')])){return this['channel'][_0x383d('0xac')]('no\x20text\x20configured');}this[_0x383d('0x37')][_0x383d('0xe4')]=!![];this[_0x383d('0x33')](_0x330a63);this[_0x383d('0x41')](_0x330a63['text'],'in','','');this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xee'),_0x330a63[_0x383d('0x65')]));var _0x201e4a=this[_0x383d('0x82')]['sync'](this,_0x330a63);if(_0x201e4a){for(var _0x2da020 in _0x201e4a){if(_0x201e4a['hasOwnProperty'](_0x2da020)){if(_0x2da020!=='providerResponse'){this[_0x383d('0x37')][_0x383d('0xa0')](util[_0x383d('0x5c')](_0x383d('0xe6'),_0x2da020['toUpperCase']()),_0x201e4a[_0x2da020]);}}}this[_0x383d('0x41')](_0x201e4a['speech'],_0x383d('0xef'),_0x383d('0xf0'),_0x201e4a[_0x383d('0xf1')]);return this['channel'][_0x383d('0xac')](util['format'](_0x383d('0xf2'),_0x201e4a[_0x383d('0xe7')]));}return this[_0x383d('0x37')][_0x383d('0x29')](_0x330a63,_0x383d('0xf3'));};AGIVertices[_0x383d('0x10')]['sesteknda']=function(_0x574cd3){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0xf4'),_0x574cd3[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x574cd3['ndauth_url'])){return this['channel'][_0x383d('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x574cd3['username'])){return this['channel'][_0x383d('0xac')]('no\x20username\x20configured');}if(!this[_0x383d('0x8a')](_0x574cd3[_0x383d('0xf5')])){return this['channel'][_0x383d('0xac')](_0x383d('0xf6'));}if(!this[_0x383d('0x8a')](_0x574cd3['ndassistant_url'])){return this[_0x383d('0x37')]['noop'](_0x383d('0xc0'));}this['channel']['bot']=!![];this[_0x383d('0x33')](_0x574cd3);this[_0x383d('0x41')](_0x574cd3[_0x383d('0x65')],'in','','');this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xf7'),_0x574cd3['text']));var _0x3cdeea=this[_0x383d('0x85')]['sync'](this,_0x574cd3);if(_0x3cdeea){for(var _0x48a365 in _0x3cdeea){if(_0x3cdeea[_0x383d('0x99')](_0x48a365)){this[_0x383d('0x37')][_0x383d('0xa0')](util[_0x383d('0x5c')](_0x383d('0xf8'),_0x48a365[_0x383d('0x72')]()),_0x3cdeea[_0x48a365]);}}this[_0x383d('0x41')](_0x3cdeea[_0x383d('0xe7')],'out','sesteknda','');if(_0x3cdeea[_0x383d('0xf9')]){this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0xfa'),_0x3cdeea[_0x383d('0xf9')]));var _0x39d977=this[_0x383d('0x37')]['streamFile'](_0x3cdeea[_0x383d('0xf9')]);try{fs[_0x383d('0xfb')](_0x3cdeea[_0x383d('0xf9')]+_0x383d('0xfc'));}catch(_0x5db464){logger[_0x383d('0x29')](_0x5db464);}return _0x39d977;}else{return this[_0x383d('0x37')][_0x383d('0xac')](util['format'](_0x383d('0xfd'),_0x3cdeea['speech']));}}return this[_0x383d('0x37')][_0x383d('0x29')](_0x574cd3,_0x383d('0xfe'));};AGIVertices[_0x383d('0x10')][_0x383d('0xff')]=function(_0x431f35){logger['info'](util['format'](_0x383d('0x100'),_0x431f35[_0x383d('0x35')]));return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xff'));};AGIVertices[_0x383d('0x10')][_0x383d('0x101')]=function(_0x1dbab3){logger[_0x383d('0x2b')](util['format'](_0x383d('0x102'),_0x1dbab3[_0x383d('0x35')]));var _0x34a83b='';if(_0x1dbab3[_0x383d('0x103')]){if(!this[_0x383d('0x8a')](_0x1dbab3['trunk_id'])){return this[_0x383d('0x37')]['error'](_0x1dbab3,_0x383d('0x104'));}else{var _0x113de6=parseInt(_0x1dbab3[_0x383d('0x103')],0xa);if(isNaN(_0x113de6)){_0x34a83b=_0x1dbab3[_0x383d('0x103')];}else{_0x34a83b=this[_0x383d('0x1b')][_0x383d('0x77')](this,_0x1dbab3['trunk_id']);if(!_0x34a83b){return this[_0x383d('0x37')]['error'](_0x1dbab3,_0x383d('0x105'));}}}}else if(_0x1dbab3['trunk_name']){_0x34a83b=_0x1dbab3[_0x383d('0x106')];}else{return this[_0x383d('0x37')][_0x383d('0x29')](_0x1dbab3,_0x383d('0x104'));}var _0x54c253=this[_0x383d('0x37')][_0x383d('0x60')](_0x383d('0x107'),[util['format'](_0x383d('0x108'),_0x34a83b,_0x1dbab3[_0x383d('0x46')]),_0x1dbab3['timeout'],_0x1dbab3[_0x383d('0xe2')],_0x1dbab3[_0x383d('0x6b')]]);if(_0x54c253[_0x383d('0xa7')]===-0x1){return _0x54c253;}return this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')]('Executed\x20command\x20%s',_0x383d('0x107')));};AGIVertices['prototype'][_0x383d('0x109')]=function(_0x582739){logger['info'](util[_0x383d('0x5c')](_0x383d('0x10a'),_0x582739['label']));return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x109'));};AGIVertices[_0x383d('0x10')][_0x383d('0xd')]=function(_0x3d6c20){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x10b'),_0x3d6c20[_0x383d('0x35')]));if(_0x3d6c20[_0x383d('0xa9')]===0x0){return this[_0x383d('0xa8')](_0x3d6c20);}_0x3d6c20[_0x383d('0xa9')]-=0x1;if(!this[_0x383d('0x8a')](_0x3d6c20[_0x383d('0x10c')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x3d6c20,_0x383d('0x10d'));}var _0x69c391=this[_0x383d('0x1d')][_0x383d('0x77')](this,_0x3d6c20['file_id']);if(!_0x69c391){return this[_0x383d('0x37')]['error'](_0x3d6c20,_0x383d('0x10e'));}if(!this[_0x383d('0x8a')](_0x3d6c20['variable_id'])){return this[_0x383d('0x37')][_0x383d('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x45e908=this[_0x383d('0x37')]['getData'](_0x69c391,_0x3d6c20[_0x383d('0x10f')],_0x3d6c20[_0x383d('0x110')]);var _0x3e71a6=_0x45e908['result']?_0x45e908[_0x383d('0xa7')][_0x383d('0xa5')]():'';logger['info'](_0x383d('0x111'),JSON[_0x383d('0x112')](_0x45e908));if(_0x45e908['result']===-0x1){this[_0x383d('0x33')]['sync'](this,_0x3d6c20,_0x3e71a6);return _0x45e908;}else if(_0x45e908[_0x383d('0xa4')]===_0x383d('0x6d')){_0x45e908[_0x383d('0xa7')]=_0x3e71a6[_0x383d('0x9d')]>=parseInt(_0x3d6c20[_0x383d('0x113')])?'x':'i';}else{_0x45e908['result']=_0x3e71a6['length']>=parseInt(_0x3d6c20['mindigit'])&&_0x3e71a6[_0x383d('0x9d')]<=parseInt(_0x3d6c20['maxdigit'])?'x':'i';}var _0x33abe1=this[_0x383d('0x11')][_0x383d('0x77')](this,_0x3d6c20[_0x383d('0xd5')]);if(!_0x33abe1){return this[_0x383d('0x37')][_0x383d('0x29')](_0x3d6c20,_0x383d('0xd6'));}this[_0x383d('0x37')][_0x383d('0xa0')](_0x33abe1,_0x3e71a6);if(this[_0x383d('0x8a')](_0x3d6c20[_0x383d('0x114')])){var _0x4d1a70=parseInt(_0x3d6c20['hiddendigitsnum'],0xa);var _0xdf0d31=rs['generate']({'charset':'*','length':_0x4d1a70});var _0x293e93=_0x3e71a6[_0x383d('0x9d')];if(_0x293e93>0x0){if(_0x293e93>_0x4d1a70){this[_0x383d('0x33')][_0x383d('0x77')](this,_0x3d6c20,_0x3d6c20[_0x383d('0x115')]===_0x383d('0x116')?_0xdf0d31+_0x3e71a6[_0x383d('0x117')](_0x4d1a70):_0x3e71a6[_0x383d('0x117')](0x0,_0x293e93-_0x4d1a70)+_0xdf0d31);}else{this[_0x383d('0x33')][_0x383d('0x77')](this,_0x3d6c20,rs['generate']({'charset':'*','length':_0x293e93}));}}else{this[_0x383d('0x33')][_0x383d('0x77')](this,_0x3d6c20,'');}}else{this['createSquareDetailsReport'][_0x383d('0x77')](this,_0x3d6c20,_0x3e71a6);}return _0x45e908;};AGIVertices['prototype'][_0x383d('0x118')]=function(_0x2748dd){logger['info'](util[_0x383d('0x5c')](_0x383d('0x119'),_0x2748dd[_0x383d('0x35')]));return this[_0x383d('0xd')](_0x2748dd);};AGIVertices[_0x383d('0x10')][_0x383d('0x11a')]=function(_0x2f604b){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x11b'),_0x2f604b['label']));this[_0x383d('0x33')][_0x383d('0x77')](this,_0x2f604b,_0x2f604b[_0x383d('0x11c')]);return this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')](_0x383d('0x11d'),_0x2f604b[_0x383d('0x11c')]));};AGIVertices[_0x383d('0x10')][_0x383d('0x11e')]=function(_0x3cfcc7){logger[_0x383d('0x2b')](util['format'](_0x383d('0x11f'),_0x3cfcc7[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x3cfcc7['aws_access_key_id'])||!this[_0x383d('0x8a')](_0x3cfcc7[_0x383d('0x8e')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x120'));}if(!this['isConfigured'](_0x3cfcc7[_0x383d('0x65')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xc0'));}this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x121'),_0x3cfcc7[_0x383d('0x65')]));var _0x53a062=this['awsPolly'][_0x383d('0x77')](this,_0x3cfcc7);if(_0x53a062){this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')](_0x383d('0x122'),_0x53a062));var _0x179071=this[_0x383d('0x37')][_0x383d('0x123')](_0x53a062);try{fs[_0x383d('0xfb')](_0x53a062+_0x383d('0xfc'));}catch(_0x293b18){logger[_0x383d('0x29')](_0x293b18);}return _0x179071;}return this[_0x383d('0x37')][_0x383d('0x29')](_0x3cfcc7,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x383d('0x124')]=function(_0xf36f22){logger['info'](util[_0x383d('0x5c')](_0x383d('0x125'),_0xf36f22[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0xf36f22['aws_access_key_id'])||!this[_0x383d('0x8a')](_0xf36f22[_0x383d('0x8e')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x120'));}if(!this[_0x383d('0x8a')](_0xf36f22[_0x383d('0x91')])){return this[_0x383d('0x37')][_0x383d('0xac')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0xf36f22['text'])){return this['channel']['noop'](_0x383d('0xc0'));}this[_0x383d('0x37')][_0x383d('0xe4')]=!![];this[_0x383d('0x33')](_0xf36f22);this['createSquareMessage'](_0xf36f22[_0x383d('0x65')],'in','','');this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')]('Trying\x20Amazon\x20Lex:\x20%s',_0xf36f22[_0x383d('0x65')]));var _0x2c34eb=this['awsLex'][_0x383d('0x77')](this,_0xf36f22);if(_0x2c34eb){for(var _0x2fc34e in _0x2c34eb){if(_0x2c34eb[_0x383d('0x99')](_0x2fc34e)&&_[_0x383d('0x97')](_0x2c34eb[_0x2fc34e])){this[_0x383d('0x37')]['setVariable'](util[_0x383d('0x5c')]('AWS_LEX_%s',_0x2fc34e[_0x383d('0x72')]()),_0x2c34eb[_0x2fc34e]);}}if(_[_0x383d('0x44')](_0x2c34eb[_0x383d('0x126')])){return this[_0x383d('0x37')]['noop'](_0x383d('0x127'));}else{this['createSquareMessage'](_0x2c34eb[_0x383d('0x126')],_0x383d('0xef'),_0x383d('0x128'),'');return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x129'),_0x2c34eb[_0x383d('0x126')]));}}return this[_0x383d('0x37')]['error'](_0xf36f22,_0x383d('0x12a'));};AGIVertices[_0x383d('0x10')][_0x383d('0x12b')]=function(_0x23d1e0){logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x23d1e0[_0x383d('0x35')],_0x23d1e0[_0x383d('0x6d')]));if(!this['isConfigured'](_0x23d1e0[_0x383d('0x81')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xe3'));}var _0xece687=_0x383d('0x12c');var _0x5b2f64=util[_0x383d('0x5c')](_0x383d('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x1ba9a1=util[_0x383d('0x5c')](_0x383d('0x9f'),_0x5b2f64,_0xece687);var _0x226974=!![];if(_0x23d1e0[_0x383d('0x12e')]===_0x383d('0x12f')){_0x226974=![];}var _0x14f5a8=this[_0x383d('0x37')]['recordFile'](_0x5b2f64,_0xece687,_0x23d1e0[_0x383d('0x130')],_0x23d1e0[_0x383d('0x6d')],undefined,_0x226974);if(_0x14f5a8['result']!==-0x1){this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x131'),_0x1ba9a1));var _0xf03049=this[_0x383d('0x92')]['sync'](this,_0x23d1e0,_0x1ba9a1);if(_0xf03049){for(var _0x53e382 in _0xf03049){if(_0xf03049['hasOwnProperty'](_0x53e382)){this[_0x383d('0x37')][_0x383d('0xa0')](util[_0x383d('0x5c')](_0x383d('0x132'),_0x53e382[_0x383d('0x72')]()),_0xf03049[_0x53e382]);}}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x133'),JSON[_0x383d('0x112')](_0xf03049)));}}return _0x14f5a8;};AGIVertices[_0x383d('0x10')][_0x383d('0x134')]=function(_0x3c4ee4){logger[_0x383d('0x2b')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3c4ee4[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x3c4ee4[_0x383d('0x135')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x136'));}if(!this[_0x383d('0x8a')](_0x3c4ee4[_0x383d('0x137')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x138'));}var _0x3acd0d=_0x383d('0x12c');var _0x1533c7=util[_0x383d('0x5c')](_0x383d('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x17a059=util[_0x383d('0x5c')]('%s.%s',_0x1533c7,_0x3acd0d);var _0x5be3f1=!![];if(_0x3c4ee4[_0x383d('0x12e')]==='NOBEEP'){_0x5be3f1=![];}var _0x494c40=this['channel']['recordFile'](_0x1533c7,_0x3acd0d,_0x3c4ee4[_0x383d('0x130')],_0x3c4ee4['timeout'],undefined,_0x5be3f1);if(_0x494c40[_0x383d('0xa7')]!==-0x1){this[_0x383d('0x37')][_0x383d('0xac')](util['format'](_0x383d('0x139'),_0x17a059));var _0x154f3a=this[_0x383d('0x94')][_0x383d('0x77')](this,_0x3c4ee4,_0x17a059);if(_0x154f3a){for(var _0x5c9633 in _0x154f3a){if(_0x154f3a[_0x383d('0x99')](_0x5c9633)){this[_0x383d('0x37')]['setVariable'](util[_0x383d('0x5c')](_0x383d('0x13a'),_0x5c9633['toUpperCase']()),_0x154f3a[_0x5c9633]);}}return this[_0x383d('0x37')][_0x383d('0xac')](util['format'](_0x383d('0x13b'),JSON[_0x383d('0x112')](_0x154f3a)));}}return _0x494c40;};AGIVertices[_0x383d('0x10')][_0x383d('0x13c')]=function(_0x52b28b){logger[_0x383d('0x2b')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x52b28b['label']));return this['channel']['continueAt'](_0x52b28b[_0x383d('0x3c')],_0x52b28b[_0x383d('0x3d')],_0x52b28b[_0x383d('0x3e')]);};AGIVertices['prototype']['gotoif']=function(_0x2bec2f){logger['info'](util[_0x383d('0x5c')](_0x383d('0x13d'),_0x2bec2f[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x2bec2f[_0x383d('0x13e')])){return this[_0x383d('0x37')]['error'](_0x2bec2f,_0x383d('0x13f'));}try{var _0x51da82=eval(_0x2bec2f['condition'])?_0x383d('0x140'):'false';this[_0x383d('0x37')]['noop'](util['format'](_0x383d('0x141'),_0x2bec2f[_0x383d('0x13e')],_0x51da82));return{'code':0xc8,'result':_0x51da82};}catch(_0x32b769){return{'code':0xc8,'result':_0x383d('0x142')};}};AGIVertices[_0x383d('0x10')][_0x383d('0x143')]=function(_0x39fa8f){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x144'),_0x39fa8f[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x39fa8f['interval_id'])){return this[_0x383d('0x37')]['error'](_0x39fa8f,_0x383d('0x145'));}var _0xc7d662=this[_0x383d('0x21')]['sync'](this,_0x39fa8f[_0x383d('0x146')]);if(!_0xc7d662){return this['channel'][_0x383d('0x29')](_0x39fa8f,'no\x20intervals\x20found');}for(var _0x5ceda5=0x0;_0x5ceda5<_0xc7d662[_0x383d('0x9d')];_0x5ceda5+=0x1){var _0x4ded97=this[_0x383d('0x37')][_0x383d('0x11')](util[_0x383d('0x5c')](_0x383d('0x147'),_0xc7d662[_0x5ceda5]));if(_0x4ded97[_0x383d('0xa7')]===-0x1){return _0x4ded97;}logger[_0x383d('0x2b')](util['format']('IFTIME\x20%s\x20%s',_0xc7d662[_0x5ceda5],_0x4ded97['extra']));if(_0x4ded97[_0x383d('0xa4')]===_0x383d('0x140')){logger['info'](util[_0x383d('0x5c')](_0x383d('0x148'),_0xc7d662[_0x5ceda5],_0x383d('0x140')));this[_0x383d('0x37')][_0x383d('0xac')](util['format']('IFTIME\x20%s\x20%s',_0xc7d662[_0x5ceda5],_0x383d('0x140')));return{'code':0xc8,'result':_0x383d('0x140')};}else{logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x148'),_0xc7d662[_0x5ceda5],'false'));this['channel'][_0x383d('0xac')](util['format'](_0x383d('0x148'),_0xc7d662[_0x5ceda5],_0x383d('0x142')));}}return{'code':0xc8,'result':_0x383d('0x142')};};AGIVertices[_0x383d('0x10')][_0x383d('0x149')]=function(_0x4435de){logger['info'](util['format'](_0x383d('0x14a'),_0x4435de[_0x383d('0x35')]));return this[_0x383d('0x37')][_0x383d('0x149')]();};AGIVertices[_0x383d('0x10')][_0x383d('0x14b')]=function(_0x1191ef){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x14c'),_0x1191ef[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x1191ef['key'])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0xe3'));}var _0x4b6a97=_0x383d('0x12c');var _0xc2ebce=util[_0x383d('0x5c')](_0x383d('0x12d'),FILES_PATH,rs['generate'](0x4));var _0xa602=util[_0x383d('0x5c')](_0x383d('0x9f'),_0xc2ebce,_0x4b6a97);var _0x2f09b9=!![];if(_0x1191ef['beep']===_0x383d('0x12f')){_0x2f09b9=![];}var _0x44a79d=this[_0x383d('0x37')][_0x383d('0x14d')](_0xc2ebce,_0x4b6a97,_0x1191ef['intKey'],_0x1191ef[_0x383d('0x6d')],undefined,_0x2f09b9);if(_0x44a79d[_0x383d('0xa7')]!==-0x1){this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x14e'),_0xa602));var _0x44ba20=this[_0x383d('0x88')][_0x383d('0x77')](this,_0x1191ef,_0xa602);if(_0x44ba20){for(var _0x15f633 in _0x44ba20){if(_0x44ba20['hasOwnProperty'](_0x15f633)){this['channel'][_0x383d('0xa0')](util[_0x383d('0x5c')](_0x383d('0x14f'),_0x15f633[_0x383d('0x72')]()),_0x44ba20[_0x15f633]);}}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x150'),JSON[_0x383d('0x112')](_0x44ba20)));}}return _0x44a79d;};AGIVertices[_0x383d('0x10')][_0x383d('0x151')]=function(_0x8134af){logger['info'](util['format'](_0x383d('0x152'),_0x8134af[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x8134af['key'])){return this['channel']['noop'](_0x383d('0xe3'));}if(!this[_0x383d('0x8a')](_0x8134af['text'])){return this[_0x383d('0x37')]['noop']('no\x20text\x20configured');}this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x153'),_0x8134af['text']));var _0x507e76=this[_0x383d('0x154')]['sync'](this,_0x8134af);if(_0x507e76){this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x14e'),_0x507e76));var _0x40ff4f=this['channel'][_0x383d('0x123')](_0x507e76,_0x8134af[_0x383d('0x130')]);try{fs[_0x383d('0xfb')](_0x507e76+_0x383d('0xfc'));}catch(_0x510450){logger['error'](_0x510450);}return _0x40ff4f;}return this[_0x383d('0x37')][_0x383d('0x29')](_0x8134af,_0x383d('0x155'));};AGIVertices[_0x383d('0x10')][_0x383d('0x156')]=function(_0xf5d5bf){logger[_0x383d('0x2b')](util['format'](_0x383d('0x157'),_0xf5d5bf[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0xf5d5bf['findBy'])){return this['channel'][_0x383d('0x29')](_0xf5d5bf,'no\x20find\x20by\x20configured');}logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x158'),this['channel'][_0x383d('0x39')],_0xf5d5bf['findBy']));var _0x4163f6=this['agentLogin'][_0x383d('0x77')](this,_0xf5d5bf[_0x383d('0x159')]);if(_0x4163f6){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x15a'),this['channel'][_0x383d('0x39')],_0xf5d5bf['findBy']));this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x15a'),this[_0x383d('0x37')][_0x383d('0x39')],_0xf5d5bf[_0x383d('0x159')]));return{'code':0xc8,'result':_0x383d('0x15b')};}else{logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x15c'),this[_0x383d('0x37')]['callerid'],_0xf5d5bf[_0x383d('0x159')]));this[_0x383d('0x37')][_0x383d('0xac')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x383d('0x37')][_0x383d('0x39')],_0xf5d5bf[_0x383d('0x159')]));return{'code':0xc8,'result':_0x383d('0x15d')};}};AGIVertices[_0x383d('0x10')][_0x383d('0x15e')]=function(_0x505443){logger['info'](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x505443[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x505443['findBy'])){return this['channel'][_0x383d('0x29')](_0x505443,'no\x20find\x20by\x20configured');}logger['info'](util[_0x383d('0x5c')](_0x383d('0x158'),this['channel'][_0x383d('0x39')],_0x505443[_0x383d('0x159')]));var _0xda702=this[_0x383d('0x59')][_0x383d('0x77')](this,_0x505443['findBy']);if(_0xda702){logger['info'](util[_0x383d('0x5c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x383d('0x37')][_0x383d('0x39')],_0x505443[_0x383d('0x159')]));this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x15a'),this[_0x383d('0x37')]['callerid'],_0x505443['findBy']));return{'code':0xc8,'result':_0x383d('0x15b')};}else{logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x15c'),this[_0x383d('0x37')]['callerid'],_0x505443[_0x383d('0x159')]));this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')](_0x383d('0x15c'),this['channel']['callerid'],_0x505443[_0x383d('0x159')]));return{'code':0xc8,'result':_0x383d('0x15d')};}};AGIVertices[_0x383d('0x10')][_0x383d('0x15f')]=function(_0x29ff62){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x160'),_0x29ff62[_0x383d('0x35')]));if(!this['isConfigured'](_0x29ff62[_0x383d('0x161')])){return this['channel'][_0x383d('0x29')](_0x29ff62,_0x383d('0x162'));}this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')](_0x383d('0x163'),_0x29ff62[_0x383d('0x161')]));var _0x1358f7=eval(_0x29ff62['operation']);if(!this['isConfigured'](_0x29ff62['variable_id'])){return this[_0x383d('0x37')][_0x383d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5e6d01=this[_0x383d('0x11')][_0x383d('0x77')](this,_0x29ff62[_0x383d('0xd5')]);if(!_0x5e6d01){return this[_0x383d('0x37')]['error'](_0x29ff62,_0x383d('0xd6'));}if(_[_0x383d('0x9c')](_0x1358f7)){var _0x367c54=this;_0x1358f7[_0x383d('0xd7')](function(_0x50d47d,_0x32717d){_0x367c54['channel'][_0x383d('0xa0')](util['format']('%s[%s]',_0x5e6d01,_0x32717d),_0x50d47d);});return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')]('variable\x20%s[key]\x20set',_0x5e6d01));}else{return this[_0x383d('0x37')][_0x383d('0xa0')](_0x5e6d01,_0x1358f7);}};AGIVertices[_0x383d('0x10')][_0x383d('0x164')]=function(_0x430921){logger[_0x383d('0x2b')](util['format'](_0x383d('0x165'),_0x430921['label']));if(_0x430921['retry']===0x0){return this['maxRetry'](_0x430921);}_0x430921[_0x383d('0xa9')]-=0x1;if(!this[_0x383d('0x8a')](_0x430921[_0x383d('0x10c')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x430921,'no\x20file\x20audio\x20selected');}var _0x2f7d9a=this[_0x383d('0x1d')][_0x383d('0x77')](this,_0x430921[_0x383d('0x10c')]);if(!_0x2f7d9a){return this[_0x383d('0x37')][_0x383d('0x29')](_0x430921,_0x383d('0x10e'));}var _0x1e8cd3=this[_0x383d('0x37')][_0x383d('0x166')](_0x2f7d9a,_0x430921[_0x383d('0x10f')],_0x430921['digit']);var _0x114bdf=_0x1e8cd3[_0x383d('0xa7')];if(_0x1e8cd3[_0x383d('0xa7')]===-0x1){this['createSquareDetailsReport'][_0x383d('0x77')](this,_0x430921,'-1');return _0x1e8cd3;}else if(_0x1e8cd3[_0x383d('0xa4')]===_0x383d('0x6d')){_0x1e8cd3[_0x383d('0xa7')]=_0x1e8cd3[_0x383d('0xa7')]['length']>0x0?_0x1e8cd3[_0x383d('0xa7')]:'t';}else if(_[_0x383d('0x43')](_0x1e8cd3[_0x383d('0xa7')])){_0x1e8cd3[_0x383d('0xa7')]='#';_0x114bdf='#';}if(!this[_0x383d('0x8a')](_0x430921[_0x383d('0xd5')])){this[_0x383d('0x37')][_0x383d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0xb9ef24=this[_0x383d('0x11')][_0x383d('0x77')](this,_0x430921[_0x383d('0xd5')]);if(!_0xb9ef24){return this['channel']['error'](_0x430921,_0x383d('0xd6'));}this['channel'][_0x383d('0xa0')](_0xb9ef24,_0x114bdf);}this['createSquareDetailsReport'][_0x383d('0x77')](this,_0x430921,_0x114bdf);return _0x1e8cd3;};AGIVertices['prototype']['noop']=function(_0xa8118b){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x167'),_0xa8118b[_0x383d('0x35')]));return this[_0x383d('0x37')][_0x383d('0xac')](_0xa8118b[_0x383d('0x168')]||_0xa8118b[_0x383d('0x35')]);};AGIVertices['prototype'][_0x383d('0x169')]=function(_0x53b02b){logger['info'](util['format'](_0x383d('0x16a'),_0x53b02b['label']));if(!this[_0x383d('0x8a')](_0x53b02b[_0x383d('0x159')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x53b02b,_0x383d('0x16b'));}logger['info'](util[_0x383d('0x5c')](_0x383d('0x158'),this[_0x383d('0x37')][_0x383d('0x39')],_0x53b02b[_0x383d('0x159')]));var _0x166d95=this[_0x383d('0x54')][_0x383d('0x77')](this,_0x53b02b[_0x383d('0x16c')]);var _0x29c45c=this['agentPause']['sync'](this,_0x53b02b[_0x383d('0x159')],_0x166d95);if(_0x29c45c){logger[_0x383d('0x2b')](util['format'](_0x383d('0x15a'),this[_0x383d('0x37')][_0x383d('0x39')],_0x53b02b[_0x383d('0x159')]));this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x15a'),this['channel']['callerid'],_0x53b02b['findBy']));return{'code':0xc8,'result':_0x383d('0x15b')};}else{logger[_0x383d('0x2b')](util['format'](_0x383d('0x15c'),this[_0x383d('0x37')][_0x383d('0x39')],_0x53b02b[_0x383d('0x159')]));this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x15a'),this[_0x383d('0x37')][_0x383d('0x39')],_0x53b02b[_0x383d('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x383d('0x10')][_0x383d('0x16d')]=function(_0x566183){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x16e'),_0x566183[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x566183['file_id'])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x566183,_0x383d('0x10d'));}var _0x570e1c=this[_0x383d('0x1d')][_0x383d('0x77')](this,_0x566183[_0x383d('0x10c')]);if(!_0x570e1c){return this[_0x383d('0x37')]['error'](_0x566183,_0x383d('0x10e'));}var _0x20cb79=this[_0x383d('0x37')][_0x383d('0x60')](_0x383d('0x16f'),[_0x570e1c,_0x566183[_0x383d('0xe2')]]);if(_0x20cb79['result']===-0x1){return _0x20cb79;}return this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x170'),_0x383d('0x16f'),_0x570e1c));};AGIVertices[_0x383d('0x10')]['queue']=function(_0xd5930b){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x171'),_0xd5930b[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0xd5930b[_0x383d('0x172')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0xd5930b,'no\x20queue\x20selected');}var _0x46456f='';var _0x173e2d=parseInt(_0xd5930b[_0x383d('0x172')],0xa);if(isNaN(_0x173e2d)){_0x46456f=_0xd5930b[_0x383d('0x172')];}else{_0x46456f=this[_0x383d('0x13')][_0x383d('0x77')](this,_0xd5930b['queue_id']);if(!_0x46456f){return this[_0x383d('0x37')][_0x383d('0x29')](_0xd5930b,'no\x20queue\x20found');}}var _0x2033e7='';if(this[_0x383d('0x8a')](_0xd5930b[_0x383d('0x10c')])){var _0x291759=this['getSound']['sync'](this,_0xd5930b[_0x383d('0x10c')]);if(_0x291759){_0x2033e7=_0x291759;}}this[_0x383d('0x33')][_0x383d('0x77')](this,_0xd5930b,_0x46456f);if(_0xd5930b[_0x383d('0xe2')][_0x383d('0x173')]('x')<0x0){_0xd5930b[_0x383d('0xe2')]+='x';}if(_0xd5930b[_0x383d('0xe2')][_0x383d('0x173')]('X')<0x0){_0xd5930b[_0x383d('0xe2')]+='X';}this[_0x383d('0x37')]['setVariable'](_0x383d('0x174'),_0x46456f?_0x46456f['toLowerCase']():'');var _0x18e130=this[_0x383d('0x37')]['exec'](_0x383d('0x175'),[_0x46456f,_0xd5930b[_0x383d('0xe2')],_0xd5930b[_0x383d('0x6b')],_0x2033e7,_0xd5930b[_0x383d('0x6d')],_0xd5930b[_0x383d('0xb3')],_0xd5930b[_0x383d('0x176')],_0xd5930b[_0x383d('0x177')],'',_0xd5930b[_0x383d('0x178')]]);if(_0x18e130[_0x383d('0xa7')]===-0x1){return _0x18e130;}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x170'),_0x383d('0x175'),_0x46456f));};AGIVertices[_0x383d('0x10')]['record']=function(_0x3197a1){logger['info'](util['format'](_0x383d('0x179'),_0x3197a1[_0x383d('0x35')]));var _0x7dde71=_0x3197a1[_0x383d('0x17a')]||'wav';var _0x410e54=util[_0x383d('0x5c')](_0x383d('0x17b'),this['channel']['uniqueid'],rs[_0x383d('0x17c')](0x5));var _0x14d55c=util[_0x383d('0x5c')](_0x383d('0x17d'),FILES_PATH,_0x410e54,_0x7dde71);var _0x14e366=util[_0x383d('0x5c')](_0x383d('0x12d'),FILES_PATH,_0x410e54);this['createSquareRecording'][_0x383d('0x77')](this,_0x3197a1,_0x410e54,_0x14d55c);this[_0x383d('0x37')][_0x383d('0xa0')](_0x383d('0x17e'),_0x410e54);logger[_0x383d('0x2b')](_0x383d('0x17f'),_0x14e366,_0x7dde71,_0x3197a1['escape_digits'],_0x3197a1[_0x383d('0x6d')]);return this[_0x383d('0x37')][_0x383d('0x14d')](_0x14e366,_0x7dde71,_0x3197a1[_0x383d('0x180')],_0x3197a1[_0x383d('0x6d')],undefined,!![]);};AGIVertices[_0x383d('0x10')]['restapi']=function(_0x32ffbd){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x181'),_0x32ffbd[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x32ffbd['url'])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x182'));}var _0x473e10=this['restAPI'][_0x383d('0x77')](this,_0x32ffbd);logger['info'](util['format'](_0x383d('0x183'),util[_0x383d('0x184')](_0x473e10,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x32ffbd[_0x383d('0xd5')])){return this[_0x383d('0x37')][_0x383d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1ee4b3=this['getVariable'][_0x383d('0x77')](this,_0x32ffbd[_0x383d('0xd5')]);if(!_0x1ee4b3){return this[_0x383d('0x37')]['error'](_0x32ffbd,_0x383d('0xd6'));}this['channel']['setVariable'](util[_0x383d('0x5c')](_0x383d('0x185'),_0x1ee4b3),_0x473e10[_0x383d('0x7d')]?_0x473e10['statusCode']:_0x383d('0x186'));this[_0x383d('0x37')]['setVariable'](util[_0x383d('0x5c')](_0x383d('0x187'),_0x1ee4b3),_0x473e10[_0x383d('0x7c')]?_0x473e10[_0x383d('0x7c')]:'OK');if(_0x473e10[_0x383d('0x73')]){try{this['saveRestApiResult'](_0x473e10[_0x383d('0x73')],_0x1ee4b3);}catch(_0x33686e){logger[_0x383d('0x29')](util['format'](_0x383d('0x188'),_0x1ee4b3));}}return this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')](_0x383d('0xdb'),_0x1ee4b3));};AGIVertices[_0x383d('0x10')][_0x383d('0x189')]=function(_0x54abd2){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x18a'),_0x54abd2[_0x383d('0x35')]));return this[_0x383d('0x37')][_0x383d('0x18b')](_0x54abd2['digits'][_0x383d('0x62')](/\s+/g,''),_0x54abd2['escape_digits']);};AGIVertices['prototype'][_0x383d('0x18c')]=function(_0x8f93cc){logger[_0x383d('0x2b')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x8f93cc['label']));return this[_0x383d('0x37')]['sayNumber'](_0x8f93cc[_0x383d('0x6e')][_0x383d('0x62')](/\s+/g,''),_0x8f93cc[_0x383d('0x180')]);};AGIVertices[_0x383d('0x10')][_0x383d('0x18d')]=function(_0x4e15ed){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x18e'),_0x4e15ed[_0x383d('0x35')]));return this[_0x383d('0x37')]['sayPhonetic'](_0x4e15ed[_0x383d('0x65')],_0x4e15ed[_0x383d('0x180')]);};AGIVertices[_0x383d('0x10')][_0x383d('0x18f')]=function(_0x5d24bf){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x190'),_0x5d24bf[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x5d24bf[_0x383d('0x191')])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x192'));}var _0xa9aa52=this['getMailAccount'][_0x383d('0x77')](this,_0x5d24bf[_0x383d('0x191')]);if(!_0xa9aa52||!_0xa9aa52[_0x383d('0x193')]){return this[_0x383d('0x37')][_0x383d('0x29')](_0x5d24bf,_0x383d('0x194'));}var _0xedfa1e={'from':util[_0x383d('0x5c')](_0x383d('0x195'),_0xa9aa52[_0x383d('0x16')],_0xa9aa52[_0x383d('0x196')]||_0xa9aa52[_0x383d('0x193')][_0x383d('0x197')]),'to':_0x5d24bf['to']||'','cc':_0x5d24bf['cc']||'','bcc':_0x5d24bf[_0x383d('0x198')]||'','subject':_0x5d24bf[_0x383d('0x199')],'html':_0x5d24bf['text'],'text':_0x5d24bf['text']};var _0x52fa13={'tls':{'rejectUnauthorized':![]}};if(_0xa9aa52[_0x383d('0x193')][_0x383d('0x19a')]){_0x52fa13[_0x383d('0x19a')]=_0xa9aa52['Smtp'][_0x383d('0x19a')];}else{_0x52fa13['host']=_0xa9aa52['Smtp']['host'];_0x52fa13[_0x383d('0x19b')]=_0xa9aa52[_0x383d('0x193')][_0x383d('0x19b')];_0x52fa13[_0x383d('0x19c')]=_0xa9aa52['Smtp'][_0x383d('0x19c')];}if(_0xa9aa52[_0x383d('0x193')][_0x383d('0x19d')]){_0x52fa13[_0x383d('0x19e')]={'user':_0xa9aa52[_0x383d('0x193')][_0x383d('0x197')],'pass':_0xa9aa52[_0x383d('0x193')]['pass']};}if(this[_0x383d('0x8a')](_0x5d24bf[_0x383d('0x19f')])){}logger[_0x383d('0xdc')](_0x383d('0x1a0'),JSON[_0x383d('0x112')](_0xedfa1e));this[_0x383d('0x33')]['sync'](this,_0x5d24bf,_0x5d24bf['account_id']);this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1a1'),_0xa9aa52[_0x383d('0x16')]));this[_0x383d('0x1a2')]['sync'](this,_0x52fa13,_0xedfa1e);return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x1a3'));};AGIVertices['prototype'][_0x383d('0x1a4')]=function(_0x5c8cf0){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x1a5'),_0x5c8cf0[_0x383d('0x35')]));return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x1a6'));};AGIVertices[_0x383d('0x10')][_0x383d('0x1a7')]=function(_0x511c61){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x511c61[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x511c61['sms_account_id'])){return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x1a8'));}var _0x47d5a0=this[_0x383d('0x30')][_0x383d('0x77')](this,_0x511c61['sms_account_id']);if(!_0x47d5a0){return this[_0x383d('0x37')][_0x383d('0x29')](_0x511c61,'no\x20sms\x20account\x20found');}var _0x45110e={'body':_0x511c61['sms_text'],'phone':_0x511c61['to']||'','SmsAccountId':_0x47d5a0['id']};logger['debug'](_0x383d('0x1a9'),JSON[_0x383d('0x112')](_0x45110e));this[_0x383d('0x33')][_0x383d('0x77')](this,_0x511c61,_0x511c61[_0x383d('0x1aa')]);this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1ab'),_0x47d5a0[_0x383d('0x16')]));this['createSmsMessage'][_0x383d('0x77')](this,_0x45110e);return this[_0x383d('0x37')]['noop'](_0x383d('0x1ac'));};AGIVertices[_0x383d('0x10')][_0x383d('0x1ad')]=function(_0x52cdb2){logger[_0x383d('0x2b')](util['format'](_0x383d('0x1ae'),_0x52cdb2[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x52cdb2[_0x383d('0xd5')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x52cdb2,_0x383d('0x1af'));}var _0x1fc1d3=this[_0x383d('0x11')]['sync'](this,_0x52cdb2[_0x383d('0xd5')]);if(!_0x1fc1d3){return this[_0x383d('0x37')][_0x383d('0x29')](_0x52cdb2,'no\x20variable\x20found');}return this[_0x383d('0x37')]['setVariable'](_0x1fc1d3,_0x52cdb2[_0x383d('0x1b0')]);};AGIVertices[_0x383d('0x10')][_0x383d('0x1b1')]=function(_0x23cb75){logger['info'](util[_0x383d('0x5c')](_0x383d('0x1b2'),_0x23cb75[_0x383d('0x35')]));this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x1b3'));if(_0x23cb75[_0x383d('0xb8')]===_0x383d('0x1b4')){this['channel'][_0x383d('0xac')]('Answer');return this[_0x383d('0x37')][_0x383d('0xb8')]();}return this[_0x383d('0x37')][_0x383d('0xac')](_0x383d('0x1b5'));};AGIVertices[_0x383d('0x10')][_0x383d('0x1b6')]=function(_0x3fb881){logger['info'](util[_0x383d('0x5c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x3fb881[_0x383d('0x35')]));if(!this['isConfigured'](_0x3fb881[_0x383d('0x1b7')])){return this['channel'][_0x383d('0x29')](_0x3fb881,_0x383d('0x1b8'));}var _0xd7142e=this[_0x383d('0x1b9')][_0x383d('0x77')](this,_0x3fb881[_0x383d('0x1b7')]);if(!this[_0x383d('0x8a')](_0xd7142e)){return this[_0x383d('0x37')][_0x383d('0x29')](_0x3fb881,util[_0x383d('0x5c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3fb881['project_id']));}if(_0xd7142e===this[_0x383d('0x37')][_0x383d('0x38')]){return this[_0x383d('0x37')][_0x383d('0x29')](_0x3fb881,_0x383d('0x1ba'));}this['createSquareDetailsReport']['sync'](this,_0x3fb881,_0xd7142e);var _0x216663=this['channel'][_0x383d('0x60')](_0x383d('0x1bb'),util[_0x383d('0x5c')](_0x383d('0x1bc'),config[_0x383d('0xb3')][_0x383d('0x1bd')]||_0x383d('0x1be'),_0xd7142e,this[_0x383d('0x37')][_0x383d('0x38')]));if(_0x216663[_0x383d('0xa7')]===-0x1){return _0x216663;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x383d('0x1bb'),_0xd7142e));};AGIVertices['prototype'][_0x383d('0x1bf')]=function(_0xb4a393){logger[_0x383d('0x2b')](util['format'](_0x383d('0x1c0'),_0xb4a393['label']));var _0x51767c=this[_0x383d('0x5f')][_0x383d('0x77')](this,_0xb4a393[_0x383d('0x1c1')]);this['createSquareDetailsReport'][_0x383d('0x77')](this,_0xb4a393,_0xb4a393['command']);if(this[_0x383d('0x8a')](_0xb4a393[_0x383d('0xd5')])){var _0x376320=this[_0x383d('0x11')]['sync'](this,_0xb4a393['variable_id']);if(_0x376320){this['channel'][_0x383d('0xa0')](_0x376320,_0x51767c);return this[_0x383d('0x37')]['noop'](util[_0x383d('0x5c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xb4a393[_0x383d('0x1c1')],_0x376320));}}return this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1c2'),_0xb4a393[_0x383d('0x1c1')]));};AGIVertices[_0x383d('0x10')]['google_cloud_tts']=function(_0x45411a){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x1c3'),_0x45411a[_0x383d('0x35')]));_0x45411a[_0x383d('0x65')]=_0x45411a[_0x383d('0x65')][_0x383d('0x62')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x383d('0x8a')](_0x45411a[_0x383d('0x64')])){return this['channel']['noop'](_0x383d('0x1c4'));}if(!this[_0x383d('0x8a')](_0x45411a[_0x383d('0x65')])){return this['channel'][_0x383d('0xac')]('no\x20text\x20configured');}this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1c5'),_0x45411a['text']));var _0x41b8e2=this['googleCloudTTS'][_0x383d('0x77')](this,_0x45411a);if(_0x41b8e2){this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1c6'),_0x41b8e2));var _0x5a7e14=this['channel'][_0x383d('0x123')](_0x41b8e2);try{fs['unlink'](_0x41b8e2+_0x383d('0xfc'));}catch(_0x17a757){logger['error'](_0x17a757);}return _0x5a7e14;}return this[_0x383d('0x37')]['error'](_0x45411a,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x383d('0x10')][_0x383d('0x1c7')]=function(_0x5cb8d0){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x1c8'),_0x5cb8d0[_0x383d('0x35')]));_0x5cb8d0['text']=_0x5cb8d0[_0x383d('0x65')][_0x383d('0x62')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x383d('0x8a')](_0x5cb8d0['text'])){return this['channel'][_0x383d('0xac')](_0x383d('0xc0'));}this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1c9'),_0x5cb8d0[_0x383d('0x65')]));var _0x3b6209=this[_0x383d('0x69')][_0x383d('0x77')](this,_0x5cb8d0);if(_0x3b6209){this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x1ca'),_0x3b6209));var _0x184854=this[_0x383d('0x37')][_0x383d('0x123')](_0x3b6209);try{fs[_0x383d('0xfb')](_0x3b6209+_0x383d('0xfc'));}catch(_0x7e5ccd){logger['error'](_0x7e5ccd);}return _0x184854;}return this[_0x383d('0x37')]['error'](_0x5cb8d0,_0x383d('0x1cb'));};AGIVertices[_0x383d('0x10')]['unpause']=function(_0x185d92){logger[_0x383d('0x2b')](util['format'](_0x383d('0x1cc'),_0x185d92[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x185d92[_0x383d('0x159')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x185d92,_0x383d('0x16b'));}logger[_0x383d('0x2b')](util[_0x383d('0x5c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x185d92[_0x383d('0x159')]));var _0x48f456=this[_0x383d('0x58')][_0x383d('0x77')](this,_0x185d92[_0x383d('0x159')]);if(_0x48f456){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x15a'),this['channel'][_0x383d('0x39')],_0x185d92[_0x383d('0x159')]));this[_0x383d('0x37')][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x15a'),this[_0x383d('0x37')][_0x383d('0x39')],_0x185d92[_0x383d('0x159')]));return{'code':0xc8,'result':_0x383d('0x15b')};}else{logger[_0x383d('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x383d('0x39')],_0x185d92[_0x383d('0x159')]));this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x15c'),this[_0x383d('0x37')][_0x383d('0x39')],_0x185d92[_0x383d('0x159')]));return{'code':0xc8,'result':_0x383d('0x15d')};}};AGIVertices[_0x383d('0x10')][_0x383d('0x1cd')]=function(_0x583942){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x1ce'),_0x583942['label']));var _0x4b5c8c=this[_0x383d('0x37')]['exec'](_0x383d('0x1cf'),[_0x583942[_0x383d('0x1d0')],_0x583942[_0x383d('0x7f')]]);if(_0x4b5c8c['result']===-0x1){return _0x4b5c8c;}return this['channel'][_0x383d('0xac')](util[_0x383d('0x5c')](_0x383d('0x170'),_0x383d('0x1cf'),_0x583942[_0x383d('0x1d0')]));};AGIVertices['prototype']['vswitch']=function(_0x53e25e){logger[_0x383d('0x2b')](util[_0x383d('0x5c')](_0x383d('0x1d1'),_0x53e25e[_0x383d('0x35')]));if(!this[_0x383d('0x8a')](_0x53e25e[_0x383d('0xd5')])){return this[_0x383d('0x37')][_0x383d('0x29')](_0x53e25e,_0x383d('0x1af'));}var _0x210636=this[_0x383d('0x11')][_0x383d('0x77')](this,_0x53e25e[_0x383d('0xd5')]);if(!_0x210636){return this['channel'][_0x383d('0x29')](_0x53e25e,'no\x20variable\x20found');}var _0x1221e0=this['channel']['getVariable'](_0x210636);return{'code':0xc8,'result':_0x1221e0['extra']?_0x1221e0['extra']:'-'};};String[_0x383d('0x10')][_0x383d('0xa3')]=function(_0xcb32e1,_0x37a57c){return this[_0x383d('0xa2')](_0xcb32e1)[_0x383d('0x1d2')](_0x37a57c);};module['exports']=AGIVertices; \ No newline at end of file +var _0x1e19=['getsecretdigits','channel','rpc','prototype','getVariable','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSquareDetailsReport','uniqueid','arg_1','createSquareRecording','callerid','context','extension','priority','dnid','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','utcOffset','scheduledat','add','insertContact','minutes','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','number','timeout','includes','POST','method','body','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','isArray','length','setVariable','%s.%s','replaceObjectAllVariables','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','sync','retry','label','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','getSquareOdbc','odbc_id','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','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','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','getData','digit','isEmpty','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','email','user','service','host','port','secure','authentication','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Executed\x20command\x20%s\x20%s','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','path','util','lodash','shelljs','odbc','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','menu','getdigits'];(function(_0xb10eca,_0x380d73){var _0x337108=function(_0x5c1688){while(--_0x5c1688){_0xb10eca['push'](_0xb10eca['shift']());}};_0x337108(++_0x380d73);}(_0x1e19,0x1c9));var _0x91e1=function(_0x1adab7,_0x238ea5){_0x1adab7=_0x1adab7-0x0;var _0x2a28e2=_0x1e19[_0x1adab7];return _0x2a28e2;};'use strict';var fs=require('fs');var path=require(_0x91e1('0x0'));var util=require(_0x91e1('0x1'));var _=require(_0x91e1('0x2'));var sh=require(_0x91e1('0x3'));var odbc=require(_0x91e1('0x4'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x91e1('0x5'))(_0x91e1('0x6'));var config=require(_0x91e1('0x7'));var shared=require(_0x91e1('0x8'));var scripts=require(_0x91e1('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x91e1('0xa'),'rawBody'];var verticesWithRetry=[_0x91e1('0xb'),_0x91e1('0xc'),_0x91e1('0xd')];var AGIVertices=function(_0x366383,_0x19abb2,_0x4da051){this[_0x91e1('0xe')]=_0x366383;this[_0x91e1('0xf')]=_0x19abb2;this['mailRpc']=_0x4da051;};AGIVertices[_0x91e1('0x10')][_0x91e1('0x11')]=function(_0xea8fc8,_0x228a87){this[_0x91e1('0xf')]['getVariableById'](_0xea8fc8)['then'](function(_0x40b3f6){_0x228a87(null,_0x40b3f6?_0x40b3f6[_0x91e1('0x12')]:![]);})[_0x91e1('0x13')](function(_0xc8b555){_0x228a87(_0xc8b555);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x14')]=function(_0x23da39,_0x3fb2e4){this['rpc'][_0x91e1('0x15')](_0x23da39)[_0x91e1('0x16')](function(_0x278473){_0x3fb2e4(null,_0x278473?_0x278473[_0x91e1('0x12')]:![]);})[_0x91e1('0x13')](function(_0x5bcf29){_0x3fb2e4(_0x5bcf29);});};AGIVertices['prototype'][_0x91e1('0x17')]=function(_0x4fc580,_0x1ffd62){this[_0x91e1('0xf')]['getSquareProjectById'](_0x4fc580)[_0x91e1('0x16')](function(_0x3dde24){_0x1ffd62(null,_0x3dde24?_0x3dde24[_0x91e1('0x12')]:![]);})['catch'](function(_0x4a2b36){_0x1ffd62(_0x4a2b36);});};AGIVertices[_0x91e1('0x10')]['getSquareOdbc']=function(_0xdf9a19,_0xcabf19){this[_0x91e1('0xf')][_0x91e1('0x18')](_0xdf9a19)[_0x91e1('0x16')](function(_0x1ee135){_0xcabf19(null,_0x1ee135?_0x1ee135[_0x91e1('0x19')]:![]);})[_0x91e1('0x13')](function(_0x24aaa1){_0xcabf19(_0x24aaa1);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1a')]=function(_0x4c80e6,_0x218a5a){this[_0x91e1('0xf')][_0x91e1('0x1b')](_0x4c80e6)['then'](function(_0x477d6c){_0x218a5a(null,_0x477d6c?_0x477d6c[_0x91e1('0x12')]:![]);})[_0x91e1('0x13')](function(_0x45a24){_0x218a5a(_0x45a24);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1c')]=function(_0x24a885,_0xe97618){this[_0x91e1('0xf')][_0x91e1('0x1d')](_0x24a885)[_0x91e1('0x16')](function(_0xaacfcd){_0xe97618(null,_0xaacfcd?_0xaacfcd[_0x91e1('0x12')]:![]);})[_0x91e1('0x13')](function(_0x17bebd){_0xe97618(_0x17bebd);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1e')]=function(_0x1eb9ee,_0x2addf8){var _0x178e6b=this;this['rpc'][_0x91e1('0x1f')](_0x1eb9ee)[_0x91e1('0x16')](function(_0x5bae2b){_0x2addf8(null,_0x5bae2b?_0x178e6b[_0x91e1('0x20')](_0x5bae2b['save_name']):![]);})['catch'](function(_0xb08207){_0x2addf8(_0xb08207);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x21')]=function(_0x4913a8,_0x2f9564){this[_0x91e1('0xf')][_0x91e1('0x22')](_0x4913a8)[_0x91e1('0x16')](function(_0x1fe96a){_0x2f9564(null,_0x1fe96a?_0x1fe96a:![]);})[_0x91e1('0x13')](function(_0x5d5440){_0x2f9564(_0x5d5440);});};AGIVertices['prototype'][_0x91e1('0x23')]=function(_0x131a47,_0x2911f0,_0x40fe22){this[_0x91e1('0x24')]['sendMailMessage'](_0x131a47,_0x2911f0)[_0x91e1('0x16')](function(){_0x40fe22(null);})[_0x91e1('0x13')](function(_0x427394){_0x40fe22(_0x427394);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x25')]=function(_0x191b09,_0x7eb2cc){this[_0x91e1('0xf')][_0x91e1('0x26')](_0x191b09)[_0x91e1('0x16')](function(_0x10bd07){if(_0x10bd07){if(_0x10bd07['IntervalId']){_0x7eb2cc(null,[_0x10bd07[_0x91e1('0x27')]]);}else{_0x7eb2cc(null,_[_0x91e1('0x28')](_0x10bd07[_0x91e1('0x29')],_0x91e1('0x27')));}}else{_0x7eb2cc(null,![]);}})[_0x91e1('0x13')](function(_0x4ce09e){_0x7eb2cc(_0x4ce09e);});};AGIVertices['prototype']['getSoundPath']=function(_0x294016){return util[_0x91e1('0x2a')](_0x91e1('0x2b'),FILES_PATH,_0x294016);};AGIVertices['prototype']['getQueryOdbc']=function(_0x2e3335,_0x1b5f7c,_0x4d20db){odbc[_0x91e1('0x2c')](_0x2e3335,function(_0x389def){if(_0x389def){logger[_0x91e1('0x2d')](_0x91e1('0x2e'),_0x389def);_0x4d20db(_0x389def);}else{logger[_0x91e1('0x2f')](_0x91e1('0x30'));odbc['query'](_0x1b5f7c,function(_0x88bb37,_0x53adb9){if(_0x88bb37){logger[_0x91e1('0x2f')](_0x91e1('0x31'),_0x1b5f7c);_0x4d20db(_0x88bb37);}else{logger['info'](_0x91e1('0x32'),_0x1b5f7c);odbc[_0x91e1('0x33')](function(_0x17b391){if(_0x17b391){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x17b391);}_0x4d20db(null,_0x53adb9);});}});}});};AGIVertices[_0x91e1('0x10')]['getSmsAccount']=function(_0x2dc57a,_0x1fd8ac){this[_0x91e1('0xf')][_0x91e1('0x34')](_0x2dc57a)[_0x91e1('0x16')](function(_0x12f139){_0x1fd8ac(null,_0x12f139?_0x12f139:![]);})['catch'](function(_0x29a0eb){_0x1fd8ac(_0x29a0eb);});};AGIVertices[_0x91e1('0x10')]['createSmsMessage']=function(_0x281b54,_0x4773b7){this[_0x91e1('0xf')]['createSmsMessage'](_0x281b54)[_0x91e1('0x16')](function(_0x59a55a){_0x4773b7(null,_0x59a55a);})[_0x91e1('0x13')](function(_0x48ddee){_0x4773b7(_0x48ddee);});};AGIVertices['prototype'][_0x91e1('0x35')]=function(_0x1f873c,_0x14cb28,_0x4711a4){this['rpc'][_0x91e1('0x35')]({'uniqueid':this[_0x91e1('0xe')][_0x91e1('0x36')],'node':_0x1f873c['label'],'application':_0x1f873c['agicommand'],'data':_0x14cb28||null,'project_name':this[_0x91e1('0xe')][_0x91e1('0x37')],'callerid':this[_0x91e1('0xe')]['callerid']})['then'](function(_0xa81797){if(_0x4711a4){_0x4711a4(null,_0xa81797);}})[_0x91e1('0x13')](function(_0x3ff621){if(_0x4711a4){_0x4711a4(_0x3ff621);}});};AGIVertices[_0x91e1('0x10')]['createSquareRecording']=function(_0x4a8b30,_0xd1f3e,_0x267b4e,_0x55eba5){this['rpc'][_0x91e1('0x38')]({'uniqueid':this[_0x91e1('0xe')][_0x91e1('0x36')],'callerid':this[_0x91e1('0xe')][_0x91e1('0x39')],'calleridname':this['channel']['calleridname'],'context':this[_0x91e1('0xe')][_0x91e1('0x3a')],'extension':this[_0x91e1('0xe')][_0x91e1('0x3b')],'priority':this[_0x91e1('0xe')][_0x91e1('0x3c')],'accountcode':this[_0x91e1('0xe')]['accountcode'],'dnid':this[_0x91e1('0xe')][_0x91e1('0x3d')],'projectName':this[_0x91e1('0xe')][_0x91e1('0x37')],'saveName':_0xd1f3e,'filename':_0x4a8b30['file']||_0xd1f3e,'savePath':_0x267b4e})[_0x91e1('0x16')](function(_0x55aec6){_0x55eba5(null,_0x55aec6);})[_0x91e1('0x13')](function(_0x5854a2){_0x55eba5(_0x5854a2);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x3e')]=function(_0x39c80d,_0x120cfa,_0x17bbf4,_0x324e56,_0x25c7e8){this[_0x91e1('0xf')][_0x91e1('0x3e')]({'uniqueid':this[_0x91e1('0xe')][_0x91e1('0x36')],'body':_0x39c80d,'direction':_0x120cfa,'providerName':_0x17bbf4,'providerResponse':_0x324e56})['then'](function(_0xf42ba2){if(_0x25c7e8){_0x25c7e8(null,_0xf42ba2);}})['catch'](function(_0x4ca25a){if(_0x25c7e8){_0x25c7e8(_0x4ca25a);}});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x3f')]=function(_0x463dbd,_0x375597){var _0x5df5ab=this;var _0x53f898=0x0;var _0x281d03={'firstName':_['isEmpty'](_0x463dbd[_0x91e1('0x12')])||_[_0x91e1('0x40')](_0x463dbd[_0x91e1('0x12')])?_0x91e1('0x41')+Math[_0x91e1('0x42')]():_0x463dbd[_0x91e1('0x12')],'lastName':_['isEmpty'](_0x463dbd[_0x91e1('0x43')])||_[_0x91e1('0x40')](_0x463dbd['lastName'])?null:_0x463dbd[_0x91e1('0x43')],'phone':_0x463dbd[_0x91e1('0x44')],'ListId':_0x463dbd[_0x91e1('0x45')],'scheduledat':_0x463dbd[_0x91e1('0x46')],'callbackUniqueid':this[_0x91e1('0xe')]['uniqueid'],'tags':_0x91e1('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x463dbd[_0x91e1('0x46')]['toString'](),'priority':_0x463dbd[_0x91e1('0x48')]};if(_[_0x91e1('0x49')](_0x463dbd,_0x91e1('0x4a'))){if(!_[_0x91e1('0x40')](_0x463dbd['dialTimezone'])){var _0x30922b=_0x463dbd['dialTimezone'];if(_0x463dbd[_0x91e1('0x4a')]==_0x91e1('0x4b')){this[_0x91e1('0xf')][_0x91e1('0x4c')]({'phone':_0x463dbd[_0x91e1('0x44')]})[_0x91e1('0x16')](function(_0xbcaecc){if(!_['isNil'](_0xbcaecc)){var _0xa8cfd9=_0xbcaecc[_0x91e1('0x4a')];if(!_[_0x91e1('0x40')](_0xa8cfd9)){var _0x1af184=shared[_0x91e1('0x4d')][_0xa8cfd9];if(!_[_0x91e1('0x40')](_0x1af184)){var _0x50acbb=-0x1*_0x1af184[_0x91e1('0x4e')];_0x281d03[_0x91e1('0x4f')]=moment(_0x463dbd[_0x91e1('0x4f')])[_0x91e1('0x50')](_0x50acbb,'minutes');_0x5df5ab[_0x91e1('0x51')](_0x281d03,_0x463dbd,_0x375597);}else{_0x5df5ab['insertContact'](_0x281d03,_0x463dbd,_0x375597);}}else{_0x5df5ab[_0x91e1('0x51')](_0x281d03,_0x463dbd,_0x375597);}}else{_0x5df5ab['insertContact'](_0x281d03,_0x463dbd,_0x375597);}});}else{var _0x53f898=shared['timezones'][_0x30922b];if(!_[_0x91e1('0x40')](_0x53f898)){var _0x3707dd=-0x1*_0x53f898[_0x91e1('0x4e')];_0x281d03[_0x91e1('0x4f')]=moment(_0x463dbd[_0x91e1('0x4f')])[_0x91e1('0x50')](_0x3707dd,_0x91e1('0x52'));_0x5df5ab[_0x91e1('0x51')](_0x281d03,_0x463dbd,_0x375597);}else{_0x5df5ab['insertContact'](_0x281d03,_0x463dbd,_0x375597);}}}else{_0x5df5ab['insertContact'](_0x281d03,_0x463dbd,_0x375597);}}else{_0x5df5ab['insertContact'](_0x281d03,_0x463dbd,_0x375597);}};AGIVertices['prototype']['getPause']=function(_0x353554,_0xfc923f){this['rpc'][_0x91e1('0x53')](_0x353554)[_0x91e1('0x16')](function(_0x332930){_0xfc923f(null,_0x332930?_0x332930['name']:![]);})[_0x91e1('0x13')](function(_0x1b0314){_0xfc923f(_0x1b0314);});};AGIVertices[_0x91e1('0x10')]['agentPause']=function(_0x5638da,_0x2700aa,_0x5a7e37){var _0x558018={'role':_0x91e1('0x54')};_0x558018[_0x5638da]=this['channel']['callerid'];this[_0x91e1('0xf')][_0x91e1('0x55')](_0x558018,_0x2700aa,this['channel'][_0x91e1('0x36')])['then'](function(_0x48da10){_0x5a7e37(null,_[_0x91e1('0x40')](_0x48da10)?![]:!![]);})[_0x91e1('0x13')](function(_0x26c412){logger['error'](_0x26c412);_0x5a7e37(null,![]);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x56')]=function(_0x589ce9,_0xe7ba4f){var _0x496c91={'role':_0x91e1('0x54')};_0x496c91[_0x589ce9]=this[_0x91e1('0xe')][_0x91e1('0x39')];this[_0x91e1('0xf')][_0x91e1('0x56')](_0x496c91)[_0x91e1('0x16')](function(_0x220c3e){_0xe7ba4f(null,_[_0x91e1('0x40')](_0x220c3e)?![]:!![]);})[_0x91e1('0x13')](function(_0x234412){logger['error'](_0x234412);_0xe7ba4f(null,![]);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x57')]=function(_0x4533a8,_0x4d3d8b){var _0x323397={'role':_0x91e1('0x54')};_0x323397[_0x4533a8]=this[_0x91e1('0xe')][_0x91e1('0x39')];this[_0x91e1('0xf')]['agentLogout'](_0x323397)[_0x91e1('0x16')](function(_0x598882){_0x4d3d8b(null,_[_0x91e1('0x40')](_0x598882)?![]:!![]);})[_0x91e1('0x13')](function(_0x3e0fc7){logger[_0x91e1('0x2d')](_0x3e0fc7);_0x4d3d8b(null,![]);});};AGIVertices[_0x91e1('0x10')]['agentLogin']=function(_0x33f483,_0x26e951){var _0x4e7af6={'role':_0x91e1('0x54')};_0x4e7af6[_0x33f483]=this['channel']['callerid'];var _0x272d05=_0x33f483!=_0x91e1('0x58')?util[_0x91e1('0x2a')](_0x91e1('0x59'),'LOCAL',this['channel']['callerid']):undefined;this[_0x91e1('0xf')][_0x91e1('0x5a')](_0x4e7af6,_0x272d05)[_0x91e1('0x16')](function(_0x3fcd07){_0x26e951(null,_[_0x91e1('0x40')](_0x3fcd07)?![]:!![]);})[_0x91e1('0x13')](function(_0x33e3c){logger['error'](_0x33e3c);_0x26e951(null,![]);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x5b')]=function(_0x58bede,_0x59adec){sh[_0x91e1('0x5c')](_[_0x91e1('0x5d')](_0x58bede),function(_0x262204,_0x276201){var _0xfe4967=_0x276201[_0x91e1('0x5e')](/(\r\n|\n|\r)/gm,'');_0x59adec(null,_0xfe4967);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x5f')]=function(_0x9d5623,_0x6815bc){scripts[_0x91e1('0x5f')](_0x9d5623[_0x91e1('0x60')],_0x9d5623[_0x91e1('0x61')]||_0x91e1('0x62'),_0x9d5623[_0x91e1('0x62')],_0x9d5623[_0x91e1('0x63')]||_0x91e1('0x64'),_0x9d5623[_0x91e1('0x65')]||_0x91e1('0x66'),_0x9d5623[_0x91e1('0x67')]||'MP3')[_0x91e1('0x16')](function(_0x388837){_0x6815bc(null,_0x388837);})[_0x91e1('0x13')](function(_0x2d37c9){_0x6815bc(_0x2d37c9);});};AGIVertices['prototype']['googleTTS']=function(_0x1552eb,_0x5b29bc){scripts[_0x91e1('0x68')](_0x1552eb[_0x91e1('0x62')],_0x1552eb[_0x91e1('0x69')]||'en',0x1)[_0x91e1('0x16')](function(_0x41a014){_0x5b29bc(null,_0x41a014);})['catch'](function(_0x35a923){_0x5b29bc(_0x35a923);});};AGIVertices['prototype']['restAPI']=function(_0x417031,_0x270b8a){var _0x210117={'uri':_0x417031['url'],'method':_0x417031['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x417031['timeout'])===_0x91e1('0x6a')&&parseInt(_0x417031[_0x91e1('0x6b')])>=0x1?parseInt(_0x417031[_0x91e1('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x91e1('0x6c')]([_0x91e1('0x6d'),'PUT'],_0x210117[_0x91e1('0x6e')]['toUpperCase']())){try{_0x210117[_0x91e1('0x6f')]=_0x417031[_0x91e1('0x70')]?JSON[_0x91e1('0x71')](_0x417031['rawBody']):{};}catch(_0xf84b46){logger[_0x91e1('0x2d')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xf84b46);}}try{_0x210117[_0x91e1('0x72')]=_0x417031[_0x91e1('0xa')]?JSON['parse'](_0x417031[_0x91e1('0xa')]):{};}catch(_0x3bec31){logger[_0x91e1('0x2d')](_0x91e1('0x73'),_0x3bec31);}if(_0x417031['computedVariables']){try{var _0x30810d=require(_0x417031[_0x91e1('0x74')])['sync'](this,_0x210117);_0x210117[_0x91e1('0x75')]=Mustache[_0x91e1('0x76')](_0x417031[_0x91e1('0x77')],_0x30810d,{},['$$','$$']);if(_0x210117[_0x91e1('0x72')]){_0x210117['headers']=JSON['parse'](Mustache[_0x91e1('0x76')](JSON[_0x91e1('0x78')](_0x210117['headers']),_0x30810d,{},['$$','$$']));}if(_0x210117[_0x91e1('0x6f')]){_0x210117['body']=JSON[_0x91e1('0x71')](Mustache[_0x91e1('0x76')](JSON['stringify'](_0x210117['body']),_0x30810d,{},['$$','$$']));}}catch(_0xe1c413){logger[_0x91e1('0x2d')](_0x91e1('0x79'),_0xe1c413);}}rp(_0x210117)[_0x91e1('0x16')](function(_0x4600ef){var _0x28bcee={'statusCode':_0x4600ef['statusCode']||0xc8,'statusMessage':_0x4600ef[_0x91e1('0x7a')]||'OK','headers':_0x4600ef[_0x91e1('0x72')]||{},'body':_0x4600ef[_0x91e1('0x6f')]||{}};_0x270b8a(null,_0x28bcee);})['catch'](function(_0x5e756c){var _0x336f1c={'statusCode':_0x5e756c[_0x91e1('0x7b')]||0x1f4,'statusMessage':_0x5e756c[_0x91e1('0x7c')]||_0x91e1('0x7d'),'headers':_0x5e756c[_0x91e1('0x7e')][_0x91e1('0x72')]||{},'body':_0x5e756c[_0x91e1('0x7e')][_0x91e1('0x6f')]||{}};_0x270b8a(null,_0x336f1c);});};AGIVertices['prototype'][_0x91e1('0x7f')]=function(_0x1d69ab,_0x9b52c2){scripts[_0x91e1('0x7f')](this[_0x91e1('0xe')][_0x91e1('0x36')],_0x1d69ab[_0x91e1('0x80')],_0x1d69ab[_0x91e1('0x62')],_0x1d69ab[_0x91e1('0x81')]||'en')[_0x91e1('0x16')](function(_0x25baa0){_0x9b52c2(null,_0x25baa0);})['catch'](function(_0x14dc59){_0x9b52c2(_0x14dc59);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x82')]=function(_0x3e4505,_0x157fde){scripts[_0x91e1('0x82')](this[_0x91e1('0xe')]['uniqueid'],_0x3e4505[_0x91e1('0x83')],_0x3e4505[_0x91e1('0x84')],_0x3e4505[_0x91e1('0x85')],_0x3e4505['text'],_0x3e4505[_0x91e1('0x86')]||'en')['then'](function(_0x2c8ee5){_0x157fde(null,_0x2c8ee5);})[_0x91e1('0x13')](function(_0x1f7a6a){_0x157fde(_0x1f7a6a);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x87')]=function(_0xfcdd2f,_0x2b404a){scripts[_0x91e1('0x87')](this['channel'],_0xfcdd2f)[_0x91e1('0x16')](function(_0x2df830){_0x2b404a(null,_0x2df830);})['catch'](function(_0x469351){_0x2b404a(_0x469351);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x88')]=function(_0x130e4a,_0x37d0c2){scripts[_0x91e1('0x88')](_0x130e4a[_0x91e1('0x80')],_0x130e4a[_0x91e1('0x62')],_0x130e4a['ispeech_tts_language']||_0x91e1('0x64'),_0x130e4a['speed'])['then'](function(_0xeae0b8){_0x37d0c2(null,_0xeae0b8);})['catch'](function(_0x224ddd){_0x37d0c2(_0x224ddd);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x89')]=function(_0xd50308,_0x38a487,_0x18118e){scripts['ispeechASR'](_0x38a487,_0xd50308[_0x91e1('0x80')],_0xd50308[_0x91e1('0x8a')]||_0x91e1('0x64'),this[_0x91e1('0x8b')](_0xd50308[_0x91e1('0x8c')])?_0xd50308['model']:undefined)[_0x91e1('0x16')](function(_0x46ad3a){_0x18118e(null,_0x46ad3a);})['catch'](function(_0x17e812){_0x18118e(_0x17e812);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x8d')]=function(_0x536d1b,_0x311303){scripts['awsPolly'](_0x536d1b[_0x91e1('0x8e')],_0x536d1b[_0x91e1('0x8f')],_0x536d1b[_0x91e1('0x90')],_0x536d1b[_0x91e1('0x91')]||_0x91e1('0x92'),_0x536d1b[_0x91e1('0x62')],_0x536d1b[_0x91e1('0x93')]||_0x91e1('0x62'))[_0x91e1('0x16')](function(_0x1d3b5f){_0x311303(null,_0x1d3b5f);})[_0x91e1('0x13')](function(_0x7f7736){_0x311303(_0x7f7736);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x94')]=function(_0x4c9ff4,_0x3a6957){scripts[_0x91e1('0x94')](this[_0x91e1('0xe')][_0x91e1('0x36')],_0x4c9ff4[_0x91e1('0x8e')],_0x4c9ff4[_0x91e1('0x8f')],_0x4c9ff4[_0x91e1('0x95')],_0x4c9ff4['text'],_0x4c9ff4[_0x91e1('0x96')])[_0x91e1('0x16')](function(_0x504146){_0x3a6957(null,_0x504146);})[_0x91e1('0x13')](function(_0x2e1b72){_0x3a6957(_0x2e1b72);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x97')]=function(_0xf60d97,_0x2bcec5,_0x3f6818){scripts[_0x91e1('0x97')](_0x2bcec5,_0xf60d97['key'],_0xf60d97[_0x91e1('0x98')]||_0x91e1('0x64'))[_0x91e1('0x16')](function(_0x2119b3){_0x3f6818(null,_0x2119b3);})[_0x91e1('0x13')](function(_0x6e21e9){_0x3f6818(_0x6e21e9);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x99')]=function(_0x2d8e0b,_0x3b3520,_0x241b7a){scripts[_0x91e1('0x99')](_0x3b3520,_0x2d8e0b[_0x91e1('0x9a')],_0x2d8e0b[_0x91e1('0x9b')],_0x2d8e0b['uri'])['then'](function(_0x4422f0){_0x241b7a(null,_0x4422f0);})[_0x91e1('0x13')](function(_0x32140c){_0x241b7a(_0x32140c);});};AGIVertices[_0x91e1('0x10')][_0x91e1('0x9c')]=function(_0x210e5d){var _0x256eab=_[_0x91e1('0x6c')](verticesWithRetry,_0x210e5d[_0x91e1('0x9d')])?_0x210e5d:_[_0x91e1('0x9e')](_0x210e5d);for(var _0x737937 in _0x256eab){if(_0x256eab[_0x91e1('0x9f')](_0x737937)){if(_0x256eab[_0x737937]&&_[_0x91e1('0xa0')](_0x256eab[_0x737937])){if(_[_0x91e1('0x6c')](recursiveMapAttributes,_0x737937)){_0x256eab[_0x737937]=this['replaceObjectAllVariables'](_0x256eab[_0x737937]);}else{_0x256eab[_0x737937]=this[_0x91e1('0xa1')](_0x256eab[_0x737937]);}}}}return _0x256eab;};AGIVertices[_0x91e1('0x10')][_0x91e1('0xa2')]=function(_0x2f38be){for(var _0x283975 in _0x2f38be){if(_0x2f38be[_0x91e1('0x9f')](_0x283975)){if(_[_0x91e1('0xa3')](_0x2f38be[_0x283975])){this[_0x91e1('0xa2')](_0x2f38be[_0x283975]);}else if(_['isArray'](_0x2f38be[_0x283975])){for(var _0x1a7729=0x0;_0x1a7729<_0x2f38be[_0x283975]['length'];_0x1a7729++){this[_0x91e1('0xa2')](_0x2f38be[_0x283975][_0x1a7729]);}}else if(_[_0x91e1('0xa0')](_0x2f38be[_0x283975])){_0x2f38be[_0x283975]=this['replaceAllVariables'](_0x2f38be[_0x283975]);}}}};AGIVertices['prototype'][_0x91e1('0xa4')]=function(_0x4c07e2,_0x13ee21){for(var _0x51c351 in _0x4c07e2){if(_0x4c07e2[_0x91e1('0x9f')](_0x51c351)){if(_[_0x91e1('0xa3')](_0x4c07e2[_0x51c351])){if(!_['isEmpty'](_0x4c07e2[_0x51c351])){this['saveRestApiResult'](_0x4c07e2[_0x51c351],util[_0x91e1('0x2a')]('%s.%s',_0x13ee21,_0x51c351));}}else if(_[_0x91e1('0xa5')](_0x4c07e2[_0x51c351])){for(var _0x7f738a=0x0;_0x7f738a<_0x4c07e2[_0x51c351][_0x91e1('0xa6')];_0x7f738a++){this[_0x91e1('0xa4')](_0x4c07e2[_0x51c351][_0x7f738a],util[_0x91e1('0x2a')]('%s.%s',_0x13ee21,_0x51c351+'['+_0x7f738a+']'));}}else{if(!_[_0x91e1('0x40')](_0x4c07e2[_0x51c351])){this[_0x91e1('0xe')][_0x91e1('0xa7')](util['format'](_0x91e1('0xa8'),_0x13ee21,_0x51c351),_0x4c07e2[_0x51c351]);}}}}};AGIVertices['prototype'][_0x91e1('0xa9')]=function(_0x1bdcda){try{var _0x4d5573=JSON[_0x91e1('0x71')](_0x1bdcda);this[_0x91e1('0xa2')](_0x4d5573);return JSON[_0x91e1('0x78')](_0x4d5573);}catch(_0x5f56d1){return this['replaceAllVariables'](_0x1bdcda);}};AGIVertices[_0x91e1('0x10')][_0x91e1('0xa1')]=function(_0x34585b){var _0x5f1a44=_0x34585b['split']('{');for(var _0x5a2249=0x1;_0x5a2249<_0x5f1a44[_0x91e1('0xa6')];_0x5a2249+=0x1){var _0x2df1ec=_0x5f1a44[_0x5a2249]['split']('}');if(_0x2df1ec[_0x91e1('0xa6')]>0x1){_0x34585b=_0x34585b[_0x91e1('0xaa')]('{'+_0x2df1ec[0x0]+'}',this[_0x91e1('0xe')][_0x91e1('0x11')](_0x2df1ec[0x0])[_0x91e1('0xab')]||_0x2df1ec[0x0]);}}if(_0x5f1a44['length']===0x1){return _0x34585b[_0x91e1('0xac')]();}return this['replaceAllVariables'](_0x34585b);};AGIVertices['prototype'][_0x91e1('0xad')]=function(_0x470a35,_0x4b74ad){var _0x57033f=this['channel'][_0x91e1('0x11')](_0x470a35);if(_0x57033f[_0x91e1('0xae')]===-0x1){return _0x57033f;}logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4b74ad,_0x57033f[_0x91e1('0xab')]));return this[_0x91e1('0xe')][_0x91e1('0xa7')](_0x4b74ad,_0x57033f['extra']);};AGIVertices['prototype'][_0x91e1('0x8b')]=function(_0x28843a){return _0x28843a&&_0x28843a!=='0'&&_0x28843a!=='-1'&&_0x28843a!=='';};AGIVertices[_0x91e1('0x10')][_0x91e1('0xaf')]=function(_0x333677){this['createSquareDetailsReport'][_0x91e1('0xb0')](this,_0x333677,'-');_0x333677[_0x91e1('0xb1')]=_0x333677[_0x91e1('0xaf')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x91e1('0x10')]['mrcpsynth']=function(_0x1fbca7){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1fbca7[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x1fbca7[_0x91e1('0x62')])){return this['channel']['noop'](_0x91e1('0xb3'));}var _0x12b8f3='\x22'+_0x1fbca7[_0x91e1('0x62')]+'\x22';if(this['isConfigured'](_0x1fbca7[_0x91e1('0x7e')])){_0x12b8f3+=','+_0x1fbca7[_0x91e1('0x7e')];}var _0x26e9bf=this[_0x91e1('0xe')]['exec'](_0x91e1('0xb4'),_0x12b8f3);if(_0x26e9bf[_0x91e1('0xae')]===-0x1){return _0x26e9bf;}return this[_0x91e1('0xe')]['noop'](util['format'](_0x91e1('0xb5'),_0x12b8f3));};AGIVertices['prototype'][_0x91e1('0xb6')]=function(_0x136a8f){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xb7'),_0x136a8f[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x136a8f['grammar'])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb9'));}var _0x24110d=_0x136a8f[_0x91e1('0xba')];if(this[_0x91e1('0x8b')](_0x136a8f[_0x91e1('0x7e')])){_0x24110d+=','+_0x136a8f['options'];}var _0x31847=this[_0x91e1('0xe')][_0x91e1('0x5c')]('MRCPRecog',_0x24110d);if(_0x31847[_0x91e1('0xae')]===-0x1){return _0x31847;}var _0x23465d=this[_0x91e1('0xad')](_0x91e1('0xbb'),'MRCP_RECOG_CONFIDENCE');if(_0x23465d[_0x91e1('0xae')]===-0x1){return _0x23465d;}var _0x1c6654=this[_0x91e1('0xad')](_0x91e1('0xbc'),'MRCP_RECOG_TRANSCRIPT');if(_0x1c6654[_0x91e1('0xae')]===-0x1){return _0x1c6654;}var _0x39a206=this['getAndSetVariable'](_0x91e1('0xbd'),_0x91e1('0xbe'));if(_0x39a206[_0x91e1('0xae')]===-0x1){return _0x39a206;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xbf'),_0x24110d));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x6')]=function(_0x1bfa2c){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0xc0'),_0x1bfa2c[_0x91e1('0xb2')]));return this[_0x91e1('0xe')][_0x91e1('0x6')]([_0x1bfa2c['command'],_0x1bfa2c[_0x91e1('0xc1')]]);};AGIVertices[_0x91e1('0x10')][_0x91e1('0xc2')]=function(_0x576129){logger[_0x91e1('0x2f')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x576129[_0x91e1('0xb2')]));if(this['isConfigured'](_0x576129[_0x91e1('0x6b')])){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xc3'),_0x576129['timeout']));var _0x579bbd=this[_0x91e1('0xe')][_0x91e1('0xc4')](_0x576129[_0x91e1('0x6b')]);if(_0x579bbd[_0x91e1('0xae')]===-0x1){return _0x579bbd;}}return this['channel'][_0x91e1('0xc2')]();};AGIVertices[_0x91e1('0x10')][_0x91e1('0x47')]=function(_0x21e579){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xc5'),_0x21e579[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x21e579[_0x91e1('0x45')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x21e579,_0x91e1('0xc6'));}_0x21e579[_0x91e1('0x46')]=moment();if(this['isConfigured'](_0x21e579[_0x91e1('0xc7')])){_0x21e579[_0x91e1('0x46')]=moment()[_0x91e1('0x50')](_0x21e579[_0x91e1('0xc7')],_0x91e1('0x52'));}if(!this[_0x91e1('0x8b')](_0x21e579[_0x91e1('0x48')])){_0x21e579['callback_priority']=0x2;}this[_0x91e1('0x3f')][_0x91e1('0xb0')](this,_0x21e579);return this['channel']['noop'](util[_0x91e1('0x2a')](_0x91e1('0xc8'),_0x21e579[_0x91e1('0x44')],_0x21e579['list_id'],_0x21e579[_0x91e1('0x46')]));};AGIVertices['prototype'][_0x91e1('0xc9')]=function(_0x1766e3){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xca'),_0x1766e3[_0x91e1('0xb2')]));var _0x599b3e=this[_0x91e1('0xe')]['exec'](_0x1766e3[_0x91e1('0xcb')],_0x1766e3[_0x91e1('0x7e')]);if(_0x599b3e[_0x91e1('0xae')]===-0x1){return _0x599b3e;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')]('Executed\x20command\x20%s\x20%s',_0x1766e3[_0x91e1('0xcb')],_0x1766e3['options']));};AGIVertices['prototype'][_0x91e1('0xcc')]=function(_0x54c5f3){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xcd'),_0x54c5f3[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x54c5f3[_0x91e1('0x62')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}var _0x2b51df='\x22'+_0x54c5f3[_0x91e1('0x62')]+'\x22';if(this[_0x91e1('0x8b')](_0x54c5f3[_0x91e1('0x7e')])){_0x2b51df+=','+_0x54c5f3['options'];}var _0x5cb3ae=this['channel'][_0x91e1('0x5c')](_0x91e1('0xb4'),_0x2b51df);if(_0x5cb3ae[_0x91e1('0xae')]===-0x1){return _0x5cb3ae;}return this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xb5'),_0x2b51df));};AGIVertices['prototype'][_0x91e1('0xce')]=function(_0x344ddc){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xcf'),_0x344ddc[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x344ddc['text'])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0xb3'));}var _0x267a88='\x22'+_0x344ddc[_0x91e1('0x62')]+'\x22';if(this['isConfigured'](_0x344ddc[_0x91e1('0x7e')])){_0x267a88+=','+_0x344ddc[_0x91e1('0x7e')];}var _0x4ef32a=this[_0x91e1('0xe')][_0x91e1('0x5c')]('MRCPSynth',_0x267a88);if(_0x4ef32a[_0x91e1('0xae')]===-0x1){return _0x4ef32a;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xb5'),_0x267a88));};AGIVertices[_0x91e1('0x10')][_0x91e1('0xd0')]=function(_0x38d180){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0xd1'),_0x38d180['label']));if(!this[_0x91e1('0x8b')](_0x38d180[_0x91e1('0xba')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb9'));}var _0x3d668a=_0x38d180[_0x91e1('0xba')];if(this[_0x91e1('0x8b')](_0x38d180[_0x91e1('0x7e')])){_0x3d668a+=','+_0x38d180[_0x91e1('0x7e')];}var _0x15e3e0=this[_0x91e1('0xe')][_0x91e1('0x5c')](_0x91e1('0xd2'),_0x3d668a);if(_0x15e3e0[_0x91e1('0xae')]===-0x1){return _0x15e3e0;}var _0x3da589=this[_0x91e1('0xad')](_0x91e1('0xbb'),_0x91e1('0xd3'));if(_0x3da589[_0x91e1('0xae')]===-0x1){return _0x3da589;}var _0xd4a63a=this[_0x91e1('0xad')](_0x91e1('0xbc'),'LUMENVOX_ASR_TRANSCRIPT');if(_0xd4a63a[_0x91e1('0xae')]===-0x1){return _0xd4a63a;}var _0x9be9d9=this[_0x91e1('0xad')]('RECOG_INSTANCE()',_0x91e1('0xd4'));if(_0x9be9d9[_0x91e1('0xae')]===-0x1){return _0x9be9d9;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3d668a));};AGIVertices[_0x91e1('0x10')]['sestekasr']=function(_0x375be3){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xd5'),_0x375be3[_0x91e1('0xb2')]));if(!this['isConfigured'](_0x375be3['grammar'])){return this[_0x91e1('0xe')][_0x91e1('0xb8')]('no\x20grammar\x20configured');}var _0x43bc40=_0x375be3[_0x91e1('0xba')];if(this[_0x91e1('0x8b')](_0x375be3[_0x91e1('0x7e')])){_0x43bc40+=','+_0x375be3[_0x91e1('0x7e')];}var _0x4b9b59=this[_0x91e1('0xe')][_0x91e1('0x5c')](_0x91e1('0xd2'),_0x43bc40);if(_0x4b9b59[_0x91e1('0xae')]===-0x1){return _0x4b9b59;}var _0x180cf2=this[_0x91e1('0xad')]('RECOG_CONFIDENCE()',_0x91e1('0xd6'));if(_0x180cf2['result']===-0x1){return _0x180cf2;}var _0x3562c1=this[_0x91e1('0xad')](_0x91e1('0xbc'),_0x91e1('0xd7'));if(_0x3562c1[_0x91e1('0xae')]===-0x1){return _0x3562c1;}var _0x4be325=this[_0x91e1('0xad')](_0x91e1('0xbd'),_0x91e1('0xd8'));if(_0x4be325[_0x91e1('0xae')]===-0x1){return _0x4be325;}return this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0xbf'),_0x43bc40));};AGIVertices['prototype'][_0x91e1('0xd9')]=function(_0x2bde18){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0xda'),_0x2bde18['label']));if(!this[_0x91e1('0x8b')](_0x2bde18['odbc_id'])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x2bde18,'no\x20database\x20selected');}var _0x1ed463=this[_0x91e1('0xdb')][_0x91e1('0xb0')](this,_0x2bde18[_0x91e1('0xdc')]);if(!_0x1ed463){return this['channel'][_0x91e1('0x2d')](_0x2bde18,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x2bde18[_0x91e1('0xdd')])){return this['channel']['error'](_0x2bde18,_0x91e1('0xde'));}var _0x219dfb=_0x2bde18[_0x91e1('0xdd')][_0x91e1('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0x91e1('0xe')][_0x91e1('0xb8')](util['format'](_0x91e1('0xdf'),_0x219dfb));var _0x262067=this[_0x91e1('0xe0')][_0x91e1('0xb0')](this,_0x1ed463,_0x219dfb);this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0x2bde18,_0x219dfb);if(!this[_0x91e1('0x8b')](_0x2bde18[_0x91e1('0xe1')])){return this['channel'][_0x91e1('0xb8')](_0x91e1('0xe2'));}var _0xc6a884=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0x2bde18[_0x91e1('0xe1')]);if(!_0xc6a884){return this['channel']['error'](_0x2bde18,_0x91e1('0xe3'));}var _0x381d90=this;_0x262067[_0x91e1('0xe4')](function(_0x999535,_0x52d452){Object[_0x91e1('0xe5')](_0x999535)['forEach'](function(_0x2bee81){_0x381d90[_0x91e1('0xe')]['setVariable'](util[_0x91e1('0x2a')](_0x91e1('0xe6'),_0xc6a884,_0x52d452,_0x2bee81),_0x999535[_0x2bee81]);});});this['channel'][_0x91e1('0xa7')](util[_0x91e1('0x2a')](_0x91e1('0xe7'),_0xc6a884),_0x262067[_0x91e1('0xa6')]);return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xe8'),_0xc6a884));};AGIVertices[_0x91e1('0x10')][_0x91e1('0xe9')]=function(_0x514a0f){logger[_0x91e1('0xea')](util[_0x91e1('0x2a')](_0x91e1('0xeb'),_0x514a0f[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x514a0f['sip_id'])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x514a0f,'no\x20user\x20selected');}var _0x56d61b=this[_0x91e1('0x1a')][_0x91e1('0xb0')](this,_0x514a0f['sip_id']);if(!_0x56d61b){return this[_0x91e1('0xe')]['error'](_0x514a0f,'no\x20user\x20found');}var _0x3d2fc2=this[_0x91e1('0xe')][_0x91e1('0x5c')](_0x91e1('0xec'),[util['format']('SIP/%s',_0x56d61b),_0x514a0f['timeout'],_0x514a0f[_0x91e1('0xed')],_0x514a0f[_0x91e1('0x77')]]);if(_0x3d2fc2[_0x91e1('0xae')]===-0x1){return _0x3d2fc2;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s',_0x91e1('0xec')));};AGIVertices[_0x91e1('0x10')][_0x91e1('0xee')]=function(_0xdcb46d){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0xef'),_0xdcb46d[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0xdcb46d[_0x91e1('0x80')])){return this[_0x91e1('0xe')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0xdcb46d[_0x91e1('0x62')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}this[_0x91e1('0xe')][_0x91e1('0xf0')]=!![];this[_0x91e1('0x35')](_0xdcb46d);this[_0x91e1('0x3e')](_0xdcb46d[_0x91e1('0x62')],'in','','');this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xf1'),_0xdcb46d[_0x91e1('0x62')]));var _0x8a0576=this[_0x91e1('0x7f')]['sync'](this,_0xdcb46d);if(_0x8a0576){for(var _0x580db1 in _0x8a0576){if(_0x8a0576[_0x91e1('0x9f')](_0x580db1)){this['channel']['setVariable'](util['format'](_0x91e1('0xf2'),_0x580db1[_0x91e1('0xf3')]()),_0x8a0576[_0x580db1]);}}this[_0x91e1('0x3e')](_0x8a0576[_0x91e1('0xf4')],'out',_0x91e1('0xee'),'');return this['channel'][_0x91e1('0xb8')](util['format'](_0x91e1('0xf5'),_0x8a0576[_0x91e1('0xf4')]));}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0xdcb46d,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x91e1('0xf6')]=function(_0x2168d8){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0xf7'),_0x2168d8['label']));if(!this[_0x91e1('0x8b')](_0x2168d8['dialogflowV2_project_id'])){return this[_0x91e1('0xe')][_0x91e1('0xb8')]('no\x20project_id\x20configured');}if(!this[_0x91e1('0x8b')](_0x2168d8[_0x91e1('0x84')])){return this['channel'][_0x91e1('0xb8')](_0x91e1('0xf8'));}if(!this[_0x91e1('0x8b')](_0x2168d8[_0x91e1('0x85')])){return this['channel'][_0x91e1('0xb8')](_0x91e1('0xf9'));}if(!this['isConfigured'](_0x2168d8[_0x91e1('0x86')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')]('no\x20anguage\x20configured');}if(!this[_0x91e1('0x8b')](_0x2168d8[_0x91e1('0x62')])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0xb3'));}this[_0x91e1('0xe')][_0x91e1('0xf0')]=!![];this[_0x91e1('0x35')](_0x2168d8);this[_0x91e1('0x3e')](_0x2168d8[_0x91e1('0x62')],'in','','');this['channel']['noop'](util['format'](_0x91e1('0xfa'),_0x2168d8[_0x91e1('0x62')]));var _0x177d34=this[_0x91e1('0x82')]['sync'](this,_0x2168d8);if(_0x177d34){for(var _0x4691f6 in _0x177d34){if(_0x177d34[_0x91e1('0x9f')](_0x4691f6)){if(_0x4691f6!==_0x91e1('0xfb')){this[_0x91e1('0xe')][_0x91e1('0xa7')](util[_0x91e1('0x2a')](_0x91e1('0xf2'),_0x4691f6[_0x91e1('0xf3')]()),_0x177d34[_0x4691f6]);}}}this['createSquareMessage'](_0x177d34['speech'],_0x91e1('0xfc'),'dialogflowV2',_0x177d34[_0x91e1('0xfb')]);return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xfd'),_0x177d34[_0x91e1('0xf4')]));}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x2168d8,_0x91e1('0xfe'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0xff')]=function(_0x1ad428){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1ad428['label']));if(!this[_0x91e1('0x8b')](_0x1ad428[_0x91e1('0x100')])){return this['channel'][_0x91e1('0xb8')](_0x91e1('0x101'));}if(!this[_0x91e1('0x8b')](_0x1ad428[_0x91e1('0x102')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x103'));}if(!this[_0x91e1('0x8b')](_0x1ad428[_0x91e1('0x104')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x105'));}if(!this[_0x91e1('0x8b')](_0x1ad428['ndassistant_url'])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}this['channel'][_0x91e1('0xf0')]=!![];this[_0x91e1('0x35')](_0x1ad428);this['createSquareMessage'](_0x1ad428[_0x91e1('0x62')],'in','','');this['channel'][_0x91e1('0xb8')](util['format'](_0x91e1('0x106'),_0x1ad428[_0x91e1('0x62')]));var _0x879ca5=this['sestekNDA'][_0x91e1('0xb0')](this,_0x1ad428);if(_0x879ca5){for(var _0xa5493d in _0x879ca5){if(_0x879ca5['hasOwnProperty'](_0xa5493d)){this['channel'][_0x91e1('0xa7')](util['format']('SESTEK_NDA_%s',_0xa5493d['toUpperCase']()),_0x879ca5[_0xa5493d]);}}this['createSquareMessage'](_0x879ca5['speech'],_0x91e1('0xfc'),'sesteknda','');if(_0x879ca5['audiofile']){this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x107'),_0x879ca5['audiofile']));var _0x5cfc58=this['channel'][_0x91e1('0x108')](_0x879ca5['audiofile']);try{fs[_0x91e1('0x109')](_0x879ca5[_0x91e1('0x10a')]+_0x91e1('0x10b'));}catch(_0x2a7964){logger[_0x91e1('0x2d')](_0x2a7964);}return _0x5cfc58;}else{return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x10c'),_0x879ca5[_0x91e1('0xf4')]));}}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x1ad428,_0x91e1('0x10d'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x10e')]=function(_0x451289){logger['info'](util['format'](_0x91e1('0x10f'),_0x451289[_0x91e1('0xb2')]));return this[_0x91e1('0xe')]['noop'](_0x91e1('0x10e'));};AGIVertices['prototype'][_0x91e1('0x110')]=function(_0x2a1a4e){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2a1a4e[_0x91e1('0xb2')]));var _0x381c5c='';if(_0x2a1a4e[_0x91e1('0x111')]){if(!this[_0x91e1('0x8b')](_0x2a1a4e[_0x91e1('0x111')])){return this['channel'][_0x91e1('0x2d')](_0x2a1a4e,_0x91e1('0x112'));}else{var _0x13d552=parseInt(_0x2a1a4e[_0x91e1('0x111')],0xa);if(isNaN(_0x13d552)){_0x381c5c=_0x2a1a4e['trunk_id'];}else{_0x381c5c=this['getTrunk'][_0x91e1('0xb0')](this,_0x2a1a4e['trunk_id']);if(!_0x381c5c){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x2a1a4e,_0x91e1('0x113'));}}}}else if(_0x2a1a4e[_0x91e1('0x114')]){_0x381c5c=_0x2a1a4e[_0x91e1('0x114')];}else{return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x2a1a4e,_0x91e1('0x112'));}var _0x10562d=this['channel'][_0x91e1('0x5c')](_0x91e1('0xec'),[util[_0x91e1('0x2a')](_0x91e1('0x115'),_0x381c5c,_0x2a1a4e[_0x91e1('0x44')]),_0x2a1a4e[_0x91e1('0x6b')],_0x2a1a4e[_0x91e1('0xed')],_0x2a1a4e['url']]);if(_0x10562d[_0x91e1('0xae')]===-0x1){return _0x10562d;}return this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')]('Executed\x20command\x20%s',_0x91e1('0xec')));};AGIVertices['prototype'][_0x91e1('0x116')]=function(_0x50147b){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x117'),_0x50147b[_0x91e1('0xb2')]));return this['channel'][_0x91e1('0xb8')]('finally');};AGIVertices[_0x91e1('0x10')]['getdigits']=function(_0xd635ff){logger[_0x91e1('0x2f')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xd635ff['label']));if(_0xd635ff['retry']===0x0){return this[_0x91e1('0xaf')](_0xd635ff);}_0xd635ff['retry']-=0x1;if(!this[_0x91e1('0x8b')](_0xd635ff['file_id'])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0xd635ff,_0x91e1('0x118'));}var _0x26931d=this[_0x91e1('0x1e')][_0x91e1('0xb0')](this,_0xd635ff[_0x91e1('0x119')]);if(!_0x26931d){return this['channel']['error'](_0xd635ff,_0x91e1('0x11a'));}if(!this[_0x91e1('0x8b')](_0xd635ff[_0x91e1('0xe1')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x91e1('0xe2'));}var _0x1fc607=this[_0x91e1('0xe')]['getData'](_0x26931d,_0xd635ff[_0x91e1('0x11b')],_0xd635ff[_0x91e1('0x11c')]);var _0x155c38=_0x1fc607[_0x91e1('0xae')]?_0x1fc607[_0x91e1('0xae')][_0x91e1('0xac')]():'';logger[_0x91e1('0x2f')](_0x91e1('0x11d'),JSON['stringify'](_0x1fc607));if(_0x1fc607[_0x91e1('0xae')]===-0x1){this[_0x91e1('0x35')]['sync'](this,_0xd635ff,_0x155c38);return _0x1fc607;}else if(_0x1fc607['extra']==='timeout'){_0x1fc607[_0x91e1('0xae')]=_0x155c38['length']>=parseInt(_0xd635ff['mindigit'])?'x':'i';}else{_0x1fc607[_0x91e1('0xae')]=_0x155c38['length']>=parseInt(_0xd635ff[_0x91e1('0x11e')])&&_0x155c38['length']<=parseInt(_0xd635ff['maxdigit'])?'x':'i';}var _0x13b62d=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0xd635ff[_0x91e1('0xe1')]);if(!_0x13b62d){return this['channel'][_0x91e1('0x2d')](_0xd635ff,'no\x20variable\x20found');}this[_0x91e1('0xe')][_0x91e1('0xa7')](_0x13b62d,_0x155c38);if(this['isConfigured'](_0xd635ff[_0x91e1('0x11f')])){var _0x527b0f=parseInt(_0xd635ff[_0x91e1('0x11f')],0xa);var _0x70fa34=rs[_0x91e1('0x120')]({'charset':'*','length':_0x527b0f});var _0x14ca4e=_0x155c38[_0x91e1('0xa6')];if(_0x14ca4e>0x0){if(_0x14ca4e>_0x527b0f){this[_0x91e1('0x35')]['sync'](this,_0xd635ff,_0xd635ff[_0x91e1('0x121')]==='first'?_0x70fa34+_0x155c38[_0x91e1('0x122')](_0x527b0f):_0x155c38[_0x91e1('0x122')](0x0,_0x14ca4e-_0x527b0f)+_0x70fa34);}else{this['createSquareDetailsReport']['sync'](this,_0xd635ff,rs[_0x91e1('0x120')]({'charset':'*','length':_0x14ca4e}));}}else{this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0xd635ff,'');}}else{this['createSquareDetailsReport'][_0x91e1('0xb0')](this,_0xd635ff,_0x155c38);}return _0x1fc607;};AGIVertices[_0x91e1('0x10')][_0x91e1('0xd')]=function(_0x2de216){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x123'),_0x2de216[_0x91e1('0xb2')]));return this[_0x91e1('0xc')](_0x2de216);};AGIVertices[_0x91e1('0x10')]['goal']=function(_0x26b381){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x124'),_0x26b381[_0x91e1('0xb2')]));this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0x26b381,_0x26b381['goalname']);return this[_0x91e1('0xe')][_0x91e1('0xb8')](util['format']('GOAL\x20%s',_0x26b381[_0x91e1('0x125')]));};AGIVertices['prototype']['awspolly']=function(_0x5ae76d){logger['info'](util[_0x91e1('0x2a')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5ae76d[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x5ae76d[_0x91e1('0x8e')])||!this[_0x91e1('0x8b')](_0x5ae76d['aws_secret_access_key'])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x126'));}if(!this[_0x91e1('0x8b')](_0x5ae76d[_0x91e1('0x62')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x127'),_0x5ae76d['text']));var _0x1eaf37=this[_0x91e1('0x8d')][_0x91e1('0xb0')](this,_0x5ae76d);if(_0x1eaf37){this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x1eaf37));var _0x4e858b=this[_0x91e1('0xe')]['streamFile'](_0x1eaf37);try{fs[_0x91e1('0x109')](_0x1eaf37+_0x91e1('0x10b'));}catch(_0x5ae986){logger['error'](_0x5ae986);}return _0x4e858b;}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x5ae76d,_0x91e1('0x128'));};AGIVertices[_0x91e1('0x10')]['awslex']=function(_0x551f74){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x129'),_0x551f74['label']));if(!this[_0x91e1('0x8b')](_0x551f74[_0x91e1('0x8e')])||!this[_0x91e1('0x8b')](_0x551f74[_0x91e1('0x8f')])){return this['channel'][_0x91e1('0xb8')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x91e1('0x8b')](_0x551f74['aws_bot_name'])){return this['channel'][_0x91e1('0xb8')](_0x91e1('0x12a'));}if(!this[_0x91e1('0x8b')](_0x551f74[_0x91e1('0x62')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}this[_0x91e1('0xe')][_0x91e1('0xf0')]=!![];this[_0x91e1('0x35')](_0x551f74);this[_0x91e1('0x3e')](_0x551f74[_0x91e1('0x62')],'in','','');this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x12b'),_0x551f74[_0x91e1('0x62')]));var _0x120936=this[_0x91e1('0x94')]['sync'](this,_0x551f74);if(_0x120936){for(var _0x516914 in _0x120936){if(_0x120936[_0x91e1('0x9f')](_0x516914)&&_['isString'](_0x120936[_0x516914])){this[_0x91e1('0xe')][_0x91e1('0xa7')](util[_0x91e1('0x2a')](_0x91e1('0x12c'),_0x516914[_0x91e1('0xf3')]()),_0x120936[_0x516914]);}}if(_['isNil'](_0x120936[_0x91e1('0x7c')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x12d'));}else{this[_0x91e1('0x3e')](_0x120936[_0x91e1('0x7c')],_0x91e1('0xfc'),_0x91e1('0x12e'),'');return this[_0x91e1('0xe')][_0x91e1('0xb8')](util['format'](_0x91e1('0x12f'),_0x120936[_0x91e1('0x7c')]));}}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x551f74,_0x91e1('0x130'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x131')]=function(_0x3a3382){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x132'),_0x3a3382[_0x91e1('0xb2')],_0x3a3382[_0x91e1('0x6b')]));if(!this[_0x91e1('0x8b')](_0x3a3382[_0x91e1('0x80')])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0x133'));}var _0x38affa=_0x91e1('0x134');var _0x3f1f9d=util['format'](_0x91e1('0x135'),FILES_PATH,rs[_0x91e1('0x120')](0x4));var _0x2b7432=util[_0x91e1('0x2a')]('%s.%s',_0x3f1f9d,_0x38affa);var _0x38d499=!![];if(_0x3a3382[_0x91e1('0x136')]==='NOBEEP'){_0x38d499=![];}var _0x1c731a=this[_0x91e1('0xe')][_0x91e1('0x137')](_0x3f1f9d,_0x38affa,_0x3a3382[_0x91e1('0x138')],_0x3a3382[_0x91e1('0x6b')],undefined,_0x38d499);if(_0x1c731a[_0x91e1('0xae')]!==-0x1){this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x139'),_0x2b7432));var _0x2f07cf=this[_0x91e1('0x97')][_0x91e1('0xb0')](this,_0x3a3382,_0x2b7432);if(_0x2f07cf){for(var _0x49bb9b in _0x2f07cf){if(_0x2f07cf[_0x91e1('0x9f')](_0x49bb9b)){this[_0x91e1('0xe')][_0x91e1('0xa7')](util[_0x91e1('0x2a')]('GOOGLE_ASR_%s',_0x49bb9b['toUpperCase']()),_0x2f07cf[_0x49bb9b]);}}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x13a'),JSON[_0x91e1('0x78')](_0x2f07cf)));}}return _0x1c731a;};AGIVertices[_0x91e1('0x10')][_0x91e1('0x13b')]=function(_0x100144){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x13c'),_0x100144[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x100144[_0x91e1('0x9a')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')]('no\x20appid\x20configured');}if(!this[_0x91e1('0x8b')](_0x100144[_0x91e1('0x9b')])){return this[_0x91e1('0xe')]['noop']('no\x20appsecret\x20configured');}var _0x3943c3='wav';var _0x2b9438=util[_0x91e1('0x2a')](_0x91e1('0x135'),FILES_PATH,rs[_0x91e1('0x120')](0x4));var _0x1c6c62=util['format'](_0x91e1('0xa8'),_0x2b9438,_0x3943c3);var _0x52ecbc=!![];if(_0x100144[_0x91e1('0x136')]==='NOBEEP'){_0x52ecbc=![];}var _0x425850=this[_0x91e1('0xe')][_0x91e1('0x137')](_0x2b9438,_0x3943c3,_0x100144[_0x91e1('0x138')],_0x100144[_0x91e1('0x6b')],undefined,_0x52ecbc);if(_0x425850[_0x91e1('0xae')]!==-0x1){this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0x13d'),_0x1c6c62));var _0x5a883d=this['tildeASR'][_0x91e1('0xb0')](this,_0x100144,_0x1c6c62);if(_0x5a883d){for(var _0x1a1c75 in _0x5a883d){if(_0x5a883d[_0x91e1('0x9f')](_0x1a1c75)){this['channel'][_0x91e1('0xa7')](util[_0x91e1('0x2a')](_0x91e1('0x13e'),_0x1a1c75[_0x91e1('0xf3')]()),_0x5a883d[_0x1a1c75]);}}return this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x13f'),JSON['stringify'](_0x5a883d)));}}return _0x425850;};AGIVertices[_0x91e1('0x10')]['gotoc']=function(_0x33ed67){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x140'),_0x33ed67[_0x91e1('0xb2')]));return this[_0x91e1('0xe')][_0x91e1('0x141')](_0x33ed67[_0x91e1('0x3a')],_0x33ed67[_0x91e1('0x3b')],_0x33ed67[_0x91e1('0x3c')]);};AGIVertices[_0x91e1('0x10')][_0x91e1('0x142')]=function(_0x587318){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0x143'),_0x587318[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x587318[_0x91e1('0x144')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x587318,_0x91e1('0x145'));}try{var _0x57f52a=eval(_0x587318[_0x91e1('0x144')])?'true':_0x91e1('0x146');this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x147'),_0x587318[_0x91e1('0x144')],_0x57f52a));return{'code':0xc8,'result':_0x57f52a};}catch(_0x44e59f){return{'code':0xc8,'result':_0x91e1('0x146')};}};AGIVertices[_0x91e1('0x10')]['gotoiftime']=function(_0x2b3f1f){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0x148'),_0x2b3f1f[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x2b3f1f[_0x91e1('0x149')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x2b3f1f,_0x91e1('0x14a'));}var _0xfd1104=this[_0x91e1('0x25')]['sync'](this,_0x2b3f1f[_0x91e1('0x149')]);if(!_0xfd1104){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x2b3f1f,_0x91e1('0x14b'));}for(var _0x4d27e5=0x0;_0x4d27e5<_0xfd1104[_0x91e1('0xa6')];_0x4d27e5+=0x1){var _0x43b9b2=this[_0x91e1('0xe')][_0x91e1('0x11')](util[_0x91e1('0x2a')]('IFTIME(%s?true:false)',_0xfd1104[_0x4d27e5]));if(_0x43b9b2['result']===-0x1){return _0x43b9b2;}logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x14c'),_0xfd1104[_0x4d27e5],_0x43b9b2[_0x91e1('0xab')]));if(_0x43b9b2[_0x91e1('0xab')]==='true'){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x14c'),_0xfd1104[_0x4d27e5],_0x91e1('0x14d')));this[_0x91e1('0xe')][_0x91e1('0xb8')](util['format']('IFTIME\x20%s\x20%s',_0xfd1104[_0x4d27e5],_0x91e1('0x14d')));return{'code':0xc8,'result':_0x91e1('0x14d')};}else{logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x14c'),_0xfd1104[_0x4d27e5],_0x91e1('0x146')));this['channel']['noop'](util[_0x91e1('0x2a')]('IFTIME\x20%s\x20%s',_0xfd1104[_0x4d27e5],_0x91e1('0x146')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x91e1('0x10')][_0x91e1('0x14e')]=function(_0x2d95d1){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x14f'),_0x2d95d1[_0x91e1('0xb2')]));return this[_0x91e1('0xe')][_0x91e1('0x14e')]();};AGIVertices['prototype'][_0x91e1('0x150')]=function(_0x503893){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x151'),_0x503893[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x503893['key'])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x133'));}var _0x277ad=_0x91e1('0x134');var _0x5edc14=util[_0x91e1('0x2a')](_0x91e1('0x135'),FILES_PATH,rs[_0x91e1('0x120')](0x4));var _0x4fcc21=util[_0x91e1('0x2a')](_0x91e1('0xa8'),_0x5edc14,_0x277ad);var _0x10e8cd=!![];if(_0x503893[_0x91e1('0x136')]===_0x91e1('0x152')){_0x10e8cd=![];}var _0x28b826=this[_0x91e1('0xe')][_0x91e1('0x137')](_0x5edc14,_0x277ad,_0x503893[_0x91e1('0x138')],_0x503893[_0x91e1('0x6b')],undefined,_0x10e8cd);if(_0x28b826[_0x91e1('0xae')]!==-0x1){this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0x153'),_0x4fcc21));var _0x103130=this['ispeechASR']['sync'](this,_0x503893,_0x4fcc21);if(_0x103130){for(var _0x3e23b2 in _0x103130){if(_0x103130[_0x91e1('0x9f')](_0x3e23b2)){this[_0x91e1('0xe')][_0x91e1('0xa7')](util[_0x91e1('0x2a')](_0x91e1('0x154'),_0x3e23b2['toUpperCase']()),_0x103130[_0x3e23b2]);}}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x155'),JSON[_0x91e1('0x78')](_0x103130)));}}return _0x28b826;};AGIVertices[_0x91e1('0x10')][_0x91e1('0x156')]=function(_0x236af2){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x157'),_0x236af2[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x236af2[_0x91e1('0x80')])){return this['channel'][_0x91e1('0xb8')](_0x91e1('0x133'));}if(!this[_0x91e1('0x8b')](_0x236af2[_0x91e1('0x62')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x158'),_0x236af2['text']));var _0x2b56f0=this[_0x91e1('0x88')][_0x91e1('0xb0')](this,_0x236af2);if(_0x2b56f0){this[_0x91e1('0xe')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x2b56f0));var _0x533de4=this[_0x91e1('0xe')][_0x91e1('0x108')](_0x2b56f0,_0x236af2[_0x91e1('0x138')]);try{fs[_0x91e1('0x109')](_0x2b56f0+'.wav');}catch(_0x3b22c1){logger['error'](_0x3b22c1);}return _0x533de4;}return this[_0x91e1('0xe')]['error'](_0x236af2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x91e1('0x10')]['login']=function(_0x1c9a89){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x159'),_0x1c9a89[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x1c9a89[_0x91e1('0x15a')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x1c9a89,_0x91e1('0x15b'));}logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x15c'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x1c9a89[_0x91e1('0x15a')]));var _0x210b73=this[_0x91e1('0x5a')][_0x91e1('0xb0')](this,_0x1c9a89[_0x91e1('0x15a')]);if(_0x210b73){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x1c9a89['findBy']));this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x1c9a89['findBy']));return{'code':0xc8,'result':_0x91e1('0x15e')};}else{logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x15f'),this[_0x91e1('0xe')]['callerid'],_0x1c9a89[_0x91e1('0x15a')]));this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x15f'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x1c9a89['findBy']));return{'code':0xc8,'result':_0x91e1('0x160')};}};AGIVertices[_0x91e1('0x10')][_0x91e1('0x161')]=function(_0xd384d5){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x162'),_0xd384d5['label']));if(!this['isConfigured'](_0xd384d5[_0x91e1('0x15a')])){return this['channel'][_0x91e1('0x2d')](_0xd384d5,_0x91e1('0x15b'));}logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x15c'),this['channel']['callerid'],_0xd384d5[_0x91e1('0x15a')]));var _0x363100=this[_0x91e1('0x57')][_0x91e1('0xb0')](this,_0xd384d5[_0x91e1('0x15a')]);if(_0x363100){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this['channel'][_0x91e1('0x39')],_0xd384d5[_0x91e1('0x15a')]));this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0xd384d5[_0x91e1('0x15a')]));return{'code':0xc8,'result':_0x91e1('0x15e')};}else{logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x15f'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0xd384d5[_0x91e1('0x15a')]));this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x15f'),this['channel'][_0x91e1('0x39')],_0xd384d5[_0x91e1('0x15a')]));return{'code':0xc8,'result':_0x91e1('0x160')};}};AGIVertices[_0x91e1('0x10')]['math']=function(_0x877448){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0x163'),_0x877448[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x877448[_0x91e1('0x164')])){return this['channel'][_0x91e1('0x2d')](_0x877448,_0x91e1('0x165'));}this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x166'),_0x877448['operation']));var _0x1a5109=eval(_0x877448[_0x91e1('0x164')]);if(!this[_0x91e1('0x8b')](_0x877448[_0x91e1('0xe1')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xe2'));}var _0x2d7129=this['getVariable']['sync'](this,_0x877448[_0x91e1('0xe1')]);if(!_0x2d7129){return this['channel'][_0x91e1('0x2d')](_0x877448,_0x91e1('0xe3'));}if(_[_0x91e1('0xa5')](_0x1a5109)){var _0x53960e=this;_0x1a5109[_0x91e1('0xe4')](function(_0x160ba4,_0x6f5efe){_0x53960e[_0x91e1('0xe')][_0x91e1('0xa7')](util['format'](_0x91e1('0x167'),_0x2d7129,_0x6f5efe),_0x160ba4);});return this[_0x91e1('0xe')][_0x91e1('0xb8')](util['format'](_0x91e1('0x168'),_0x2d7129));}else{return this[_0x91e1('0xe')]['setVariable'](_0x2d7129,_0x1a5109);}};AGIVertices[_0x91e1('0x10')][_0x91e1('0xb')]=function(_0x596ac2){logger['info'](util[_0x91e1('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x596ac2['label']));if(_0x596ac2[_0x91e1('0xb1')]===0x0){return this[_0x91e1('0xaf')](_0x596ac2);}_0x596ac2[_0x91e1('0xb1')]-=0x1;if(!this[_0x91e1('0x8b')](_0x596ac2['file_id'])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x596ac2,_0x91e1('0x118'));}var _0xc75456=this[_0x91e1('0x1e')][_0x91e1('0xb0')](this,_0x596ac2[_0x91e1('0x119')]);if(!_0xc75456){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x596ac2,_0x91e1('0x11a'));}var _0x37e73f=this['channel'][_0x91e1('0x169')](_0xc75456,_0x596ac2[_0x91e1('0x11b')],_0x596ac2[_0x91e1('0x16a')]);var _0x32ea0c=_0x37e73f[_0x91e1('0xae')];if(_0x37e73f['result']===-0x1){this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0x596ac2,'-1');return _0x37e73f;}else if(_0x37e73f[_0x91e1('0xab')]===_0x91e1('0x6b')){_0x37e73f['result']=_0x37e73f[_0x91e1('0xae')][_0x91e1('0xa6')]>0x0?_0x37e73f[_0x91e1('0xae')]:'t';}else if(_[_0x91e1('0x16b')](_0x37e73f[_0x91e1('0xae')])){_0x37e73f[_0x91e1('0xae')]='#';_0x32ea0c='#';}if(!this[_0x91e1('0x8b')](_0x596ac2[_0x91e1('0xe1')])){this[_0x91e1('0xe')][_0x91e1('0xb8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0xc2056a=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0x596ac2[_0x91e1('0xe1')]);if(!_0xc2056a){return this['channel'][_0x91e1('0x2d')](_0x596ac2,_0x91e1('0xe3'));}this[_0x91e1('0xe')][_0x91e1('0xa7')](_0xc2056a,_0x32ea0c);}this[_0x91e1('0x35')]['sync'](this,_0x596ac2,_0x32ea0c);return _0x37e73f;};AGIVertices['prototype'][_0x91e1('0xb8')]=function(_0xa6745b){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xa6745b[_0x91e1('0xb2')]));return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0xa6745b[_0x91e1('0x16c')]||_0xa6745b[_0x91e1('0xb2')]);};AGIVertices[_0x91e1('0x10')][_0x91e1('0x16d')]=function(_0x4ae9a4){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0x16e'),_0x4ae9a4[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x4ae9a4[_0x91e1('0x15a')])){return this[_0x91e1('0xe')]['error'](_0x4ae9a4,'no\x20find\x20by\x20configured');}logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x15c'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x4ae9a4[_0x91e1('0x15a')]));var _0x13d787=this[_0x91e1('0x16f')][_0x91e1('0xb0')](this,_0x4ae9a4[_0x91e1('0x170')]);var _0x15bfd9=this[_0x91e1('0x55')][_0x91e1('0xb0')](this,_0x4ae9a4[_0x91e1('0x15a')],_0x13d787);if(_0x15bfd9){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this['channel'][_0x91e1('0x39')],_0x4ae9a4[_0x91e1('0x15a')]));this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this['channel'][_0x91e1('0x39')],_0x4ae9a4[_0x91e1('0x15a')]));return{'code':0xc8,'result':_0x91e1('0x15e')};}else{logger[_0x91e1('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x91e1('0xe')]['callerid'],_0x4ae9a4['findBy']));this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x91e1('0x39')],_0x4ae9a4[_0x91e1('0x15a')]));return{'code':0xc8,'result':_0x91e1('0x160')};}};AGIVertices[_0x91e1('0x10')]['playback']=function(_0x475c33){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x171'),_0x475c33['label']));if(!this[_0x91e1('0x8b')](_0x475c33[_0x91e1('0x119')])){return this[_0x91e1('0xe')]['error'](_0x475c33,'no\x20file\x20audio\x20selected');}var _0xf4f9e=this[_0x91e1('0x1e')][_0x91e1('0xb0')](this,_0x475c33[_0x91e1('0x119')]);if(!_0xf4f9e){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x475c33,_0x91e1('0x11a'));}var _0x5e8d1d=this[_0x91e1('0xe')]['exec'](_0x91e1('0x172'),[_0xf4f9e,_0x475c33[_0x91e1('0xed')]]);if(_0x5e8d1d[_0x91e1('0xae')]===-0x1){return _0x5e8d1d;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0xf4f9e));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x173')]=function(_0x563025){logger['info'](util[_0x91e1('0x2a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x563025[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x563025[_0x91e1('0x174')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x563025,_0x91e1('0x175'));}var _0x48e6d5='';var _0x496cf2=parseInt(_0x563025['queue_id'],0xa);if(isNaN(_0x496cf2)){_0x48e6d5=_0x563025['queue_id'];}else{_0x48e6d5=this['getVoiceQueue']['sync'](this,_0x563025['queue_id']);if(!_0x48e6d5){return this['channel'][_0x91e1('0x2d')](_0x563025,_0x91e1('0x176'));}}var _0xa4becb='';if(this[_0x91e1('0x8b')](_0x563025[_0x91e1('0x119')])){var _0xa0564c=this[_0x91e1('0x1e')]['sync'](this,_0x563025['file_id']);if(_0xa0564c){_0xa4becb=_0xa0564c;}}this['createSquareDetailsReport'][_0x91e1('0xb0')](this,_0x563025,_0x48e6d5);if(_0x563025[_0x91e1('0xed')][_0x91e1('0x177')]('x')<0x0){_0x563025[_0x91e1('0xed')]+='x';}if(_0x563025[_0x91e1('0xed')][_0x91e1('0x177')]('X')<0x0){_0x563025['opts']+='X';}this[_0x91e1('0xe')][_0x91e1('0xa7')](_0x91e1('0x178'),_0x48e6d5?_0x48e6d5['toLowerCase']():'');var _0xbd4eca=this[_0x91e1('0xe')][_0x91e1('0x5c')](_0x91e1('0x179'),[_0x48e6d5,_0x563025[_0x91e1('0xed')],_0x563025[_0x91e1('0x77')],_0xa4becb,_0x563025['timeout'],_0x563025[_0x91e1('0x6')],_0x563025[_0x91e1('0x17a')],_0x563025[_0x91e1('0x17b')],'',_0x563025[_0x91e1('0x17c')]]);if(_0xbd4eca[_0x91e1('0xae')]===-0x1){return _0xbd4eca;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x48e6d5));};AGIVertices['prototype'][_0x91e1('0x17d')]=function(_0x38c168){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x17e'),_0x38c168['label']));var _0x1cbc39=_0x38c168[_0x91e1('0x17f')]||_0x91e1('0x134');var _0xf84ae3=util[_0x91e1('0x2a')]('%s_%s',this[_0x91e1('0xe')][_0x91e1('0x36')],rs[_0x91e1('0x120')](0x5));var _0x2cf94a=util[_0x91e1('0x2a')](_0x91e1('0x180'),FILES_PATH,_0xf84ae3,_0x1cbc39);var _0x45fb26=util[_0x91e1('0x2a')](_0x91e1('0x135'),FILES_PATH,_0xf84ae3);this[_0x91e1('0x38')][_0x91e1('0xb0')](this,_0x38c168,_0xf84ae3,_0x2cf94a);this[_0x91e1('0xe')]['setVariable'](_0x91e1('0x181'),_0xf84ae3);logger[_0x91e1('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x45fb26,_0x1cbc39,_0x38c168[_0x91e1('0x182')],_0x38c168[_0x91e1('0x6b')]);return this[_0x91e1('0xe')][_0x91e1('0x137')](_0x45fb26,_0x1cbc39,_0x38c168[_0x91e1('0x182')],_0x38c168[_0x91e1('0x6b')],undefined,!![]);};AGIVertices[_0x91e1('0x10')][_0x91e1('0x183')]=function(_0x27c565){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x27c565[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x27c565[_0x91e1('0x77')])){return this['channel']['noop'](_0x91e1('0x184'));}var _0x147365=this[_0x91e1('0x185')][_0x91e1('0xb0')](this,_0x27c565);logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x186'),util[_0x91e1('0x187')](_0x147365,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x27c565[_0x91e1('0xe1')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x188'));}var _0x207c4b=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0x27c565['variable_id']);if(!_0x207c4b){return this[_0x91e1('0xe')]['error'](_0x27c565,_0x91e1('0xe3'));}this[_0x91e1('0xe')]['setVariable'](util[_0x91e1('0x2a')](_0x91e1('0x189'),_0x207c4b),_0x147365[_0x91e1('0x7b')]?_0x147365[_0x91e1('0x7b')]:_0x91e1('0x18a'));this[_0x91e1('0xe')][_0x91e1('0xa7')](util[_0x91e1('0x2a')](_0x91e1('0x18b'),_0x207c4b),_0x147365['statusMessage']?_0x147365[_0x91e1('0x7a')]:'OK');if(_0x147365[_0x91e1('0x6f')]){try{this[_0x91e1('0xa4')](_0x147365['body'],_0x207c4b);}catch(_0x4e0ddd){logger[_0x91e1('0x2d')](util[_0x91e1('0x2a')](_0x91e1('0x18c'),_0x207c4b));}}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0xe8'),_0x207c4b));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x18d')]=function(_0xe7f483){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x18e'),_0xe7f483['label']));return this[_0x91e1('0xe')][_0x91e1('0x18f')](_0xe7f483['digits'][_0x91e1('0x5e')](/\s+/g,''),_0xe7f483[_0x91e1('0x182')]);};AGIVertices[_0x91e1('0x10')][_0x91e1('0x190')]=function(_0x45ffab){logger['info'](util[_0x91e1('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x45ffab[_0x91e1('0xb2')]));return this[_0x91e1('0xe')]['sayNumber'](_0x45ffab['number']['replace'](/\s+/g,''),_0x45ffab['escape_digits']);};AGIVertices[_0x91e1('0x10')][_0x91e1('0x191')]=function(_0x5201f5){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5201f5['label']));return this['channel'][_0x91e1('0x192')](_0x5201f5['text'],_0x5201f5[_0x91e1('0x182')]);};AGIVertices[_0x91e1('0x10')][_0x91e1('0x193')]=function(_0x3b767b){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x194'),_0x3b767b[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x3b767b[_0x91e1('0x195')])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0x196'));}var _0x3271f4=this[_0x91e1('0x21')][_0x91e1('0xb0')](this,_0x3b767b['account_id']);if(!_0x3271f4||!_0x3271f4[_0x91e1('0x197')]){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x3b767b,'no\x20mail\x20account\x20found');}var _0x5601e4={'from':util[_0x91e1('0x2a')]('\x22%s\x22\x20<%s>',_0x3271f4['name'],_0x3271f4[_0x91e1('0x198')]||_0x3271f4['Smtp'][_0x91e1('0x199')]),'to':_0x3b767b['to']||'','cc':_0x3b767b['cc']||'','bcc':_0x3b767b['bcc']||'','subject':_0x3b767b['subject'],'html':_0x3b767b[_0x91e1('0x62')],'text':_0x3b767b[_0x91e1('0x62')]};var _0x4c6ed5={'tls':{'rejectUnauthorized':![]}};if(_0x3271f4[_0x91e1('0x197')][_0x91e1('0x19a')]){_0x4c6ed5[_0x91e1('0x19a')]=_0x3271f4[_0x91e1('0x197')]['service'];}else{_0x4c6ed5['host']=_0x3271f4[_0x91e1('0x197')][_0x91e1('0x19b')];_0x4c6ed5[_0x91e1('0x19c')]=_0x3271f4[_0x91e1('0x197')]['port'];_0x4c6ed5[_0x91e1('0x19d')]=_0x3271f4[_0x91e1('0x197')][_0x91e1('0x19d')];}if(_0x3271f4[_0x91e1('0x197')][_0x91e1('0x19e')]){_0x4c6ed5['auth']={'user':_0x3271f4[_0x91e1('0x197')][_0x91e1('0x199')],'pass':_0x3271f4[_0x91e1('0x197')]['pass']};}if(this[_0x91e1('0x8b')](_0x3b767b[_0x91e1('0x19f')])){}logger[_0x91e1('0xea')](_0x91e1('0x1a0'),JSON[_0x91e1('0x78')](_0x5601e4));this[_0x91e1('0x35')]['sync'](this,_0x3b767b,_0x3b767b[_0x91e1('0x195')]);this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0x1a1'),_0x3271f4[_0x91e1('0x12')]));this[_0x91e1('0x23')][_0x91e1('0xb0')](this,_0x4c6ed5,_0x5601e4);return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x1a2'));};AGIVertices[_0x91e1('0x10')]['sendFax']=function(_0x4887ca){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x1a3'),_0x4887ca[_0x91e1('0xb2')]));return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x1a4'));};AGIVertices['prototype'][_0x91e1('0x1a5')]=function(_0x44e58a){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x1a6'),_0x44e58a[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x44e58a[_0x91e1('0x1a7')])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0x1a8'));}var _0x3d2ab7=this[_0x91e1('0x1a9')][_0x91e1('0xb0')](this,_0x44e58a[_0x91e1('0x1a7')]);if(!_0x3d2ab7){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x44e58a,_0x91e1('0x1aa'));}var _0x41e7c9={'body':_0x44e58a[_0x91e1('0x1ab')],'phone':_0x44e58a['to']||'','SmsAccountId':_0x3d2ab7['id']};logger['debug'](_0x91e1('0x1ac'),JSON[_0x91e1('0x78')](_0x41e7c9));this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0x44e58a,_0x44e58a[_0x91e1('0x1a7')]);this[_0x91e1('0xe')]['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x3d2ab7[_0x91e1('0x12')]));this['createSmsMessage']['sync'](this,_0x41e7c9);return this['channel']['noop'](_0x91e1('0x1ad'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1ae')]=function(_0x304971){logger[_0x91e1('0x2f')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x304971['label']));if(!this['isConfigured'](_0x304971[_0x91e1('0xe1')])){return this['channel'][_0x91e1('0x2d')](_0x304971,_0x91e1('0x1af'));}var _0x3b93b2=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0x304971[_0x91e1('0xe1')]);if(!_0x3b93b2){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x304971,_0x91e1('0xe3'));}return this[_0x91e1('0xe')][_0x91e1('0xa7')](_0x3b93b2,_0x304971[_0x91e1('0x1b0')]);};AGIVertices['prototype'][_0x91e1('0x1b1')]=function(_0x3babf4){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x1b2'),_0x3babf4[_0x91e1('0xb2')]));this['channel'][_0x91e1('0xb8')]('START\x20CALLY\x20SQUARE');if(_0x3babf4[_0x91e1('0xc2')]===_0x91e1('0x1b3')){this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0x1b4'));return this[_0x91e1('0xe')][_0x91e1('0xc2')]();}return this['channel'][_0x91e1('0xb8')](_0x91e1('0x1b5'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1b6')]=function(_0x33dc0){logger[_0x91e1('0x2f')](util['format'](_0x91e1('0x1b7'),_0x33dc0[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x33dc0[_0x91e1('0x1b8')])){return this['channel']['error'](_0x33dc0,'no\x20subproject\x20selected');}var _0x38435a=this['getSquareProject'][_0x91e1('0xb0')](this,_0x33dc0['project_id']);if(!this['isConfigured'](_0x38435a)){return this[_0x91e1('0xe')]['error'](_0x33dc0,util[_0x91e1('0x2a')](_0x91e1('0x1b9'),_0x33dc0[_0x91e1('0x1b8')]));}if(_0x38435a===this[_0x91e1('0xe')]['arg_1']){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x33dc0,_0x91e1('0x1ba'));}this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0x33dc0,_0x38435a);var _0xdb7f53=this['channel'][_0x91e1('0x5c')]('AGI',util[_0x91e1('0x2a')](_0x91e1('0x1bb'),config[_0x91e1('0x6')][_0x91e1('0x19b')]||_0x91e1('0x1bc'),_0x38435a,this[_0x91e1('0xe')][_0x91e1('0x37')]));if(_0xdb7f53[_0x91e1('0xae')]===-0x1){return _0xdb7f53;}return this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x1bd'),'AGI',_0x38435a));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1be')]=function(_0x50b537){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x50b537[_0x91e1('0xb2')]));var _0x3d1231=this[_0x91e1('0x5b')][_0x91e1('0xb0')](this,_0x50b537['command']);this[_0x91e1('0x35')][_0x91e1('0xb0')](this,_0x50b537,_0x50b537[_0x91e1('0x1bf')]);if(this[_0x91e1('0x8b')](_0x50b537[_0x91e1('0xe1')])){var _0x4cb675=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0x50b537[_0x91e1('0xe1')]);if(_0x4cb675){this['channel'][_0x91e1('0xa7')](_0x4cb675,_0x3d1231);return this['channel'][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x1c0'),_0x50b537['command'],_0x4cb675));}}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x1c1'),_0x50b537[_0x91e1('0x1bf')]));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1c2')]=function(_0x371276){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x1c3'),_0x371276['label']));_0x371276[_0x91e1('0x62')]=_0x371276[_0x91e1('0x62')][_0x91e1('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x371276[_0x91e1('0x60')])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0x1c4'));}if(!this[_0x91e1('0x8b')](_0x371276[_0x91e1('0x62')])){return this[_0x91e1('0xe')][_0x91e1('0xb8')](_0x91e1('0xb3'));}this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x1c5'),_0x371276[_0x91e1('0x62')]));var _0x55ea36=this[_0x91e1('0x5f')][_0x91e1('0xb0')](this,_0x371276);if(_0x55ea36){this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x1c6'),_0x55ea36));var _0x106202=this[_0x91e1('0xe')][_0x91e1('0x108')](_0x55ea36);try{fs[_0x91e1('0x109')](_0x55ea36+_0x91e1('0x10b'));}catch(_0x20a4ce){logger[_0x91e1('0x2d')](_0x20a4ce);}return _0x106202;}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x371276,_0x91e1('0x1c7'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1c8')]=function(_0x4682d3){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x1c9'),_0x4682d3[_0x91e1('0xb2')]));_0x4682d3[_0x91e1('0x62')]=_0x4682d3[_0x91e1('0x62')][_0x91e1('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x91e1('0x8b')](_0x4682d3['text'])){return this[_0x91e1('0xe')]['noop'](_0x91e1('0xb3'));}this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x4682d3[_0x91e1('0x62')]));var _0x6e8c54=this['googleTTS'][_0x91e1('0xb0')](this,_0x4682d3);if(_0x6e8c54){this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0x1ca'),_0x6e8c54));var _0x396162=this[_0x91e1('0xe')][_0x91e1('0x108')](_0x6e8c54);try{fs['unlink'](_0x6e8c54+_0x91e1('0x10b'));}catch(_0x350f96){logger[_0x91e1('0x2d')](_0x350f96);}return _0x396162;}return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x4682d3,_0x91e1('0x1cb'));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1cc')]=function(_0x3a39fd){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3a39fd[_0x91e1('0xb2')]));if(!this[_0x91e1('0x8b')](_0x3a39fd['findBy'])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x3a39fd,_0x91e1('0x15b'));}logger['info'](util[_0x91e1('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x91e1('0x39')],_0x3a39fd[_0x91e1('0x15a')]));var _0x5e239c=this[_0x91e1('0x56')]['sync'](this,_0x3a39fd['findBy']);if(_0x5e239c){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x3a39fd[_0x91e1('0x15a')]));this[_0x91e1('0xe')]['noop'](util[_0x91e1('0x2a')](_0x91e1('0x15d'),this['channel']['callerid'],_0x3a39fd[_0x91e1('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x91e1('0x39')],_0x3a39fd[_0x91e1('0x15a')]));this[_0x91e1('0xe')][_0x91e1('0xb8')](util[_0x91e1('0x2a')](_0x91e1('0x15f'),this[_0x91e1('0xe')][_0x91e1('0x39')],_0x3a39fd['findBy']));return{'code':0xc8,'result':_0x91e1('0x160')};}};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1cd')]=function(_0x5cb8a9){logger[_0x91e1('0x2f')](util[_0x91e1('0x2a')](_0x91e1('0x1ce'),_0x5cb8a9['label']));var _0x32971f=this['channel'][_0x91e1('0x5c')](_0x91e1('0x1cf'),[_0x5cb8a9[_0x91e1('0x1d0')],_0x5cb8a9[_0x91e1('0x7e')]]);if(_0x32971f[_0x91e1('0xae')]===-0x1){return _0x32971f;}return this[_0x91e1('0xe')][_0x91e1('0xb8')](util['format'](_0x91e1('0x1bd'),_0x91e1('0x1cf'),_0x5cb8a9[_0x91e1('0x1d0')]));};AGIVertices[_0x91e1('0x10')][_0x91e1('0x1d1')]=function(_0x5c3a1c){logger['info'](util[_0x91e1('0x2a')](_0x91e1('0x1d2'),_0x5c3a1c['label']));if(!this['isConfigured'](_0x5c3a1c[_0x91e1('0xe1')])){return this[_0x91e1('0xe')][_0x91e1('0x2d')](_0x5c3a1c,'no\x20variable\x20selected');}var _0x50c57f=this[_0x91e1('0x11')][_0x91e1('0xb0')](this,_0x5c3a1c[_0x91e1('0xe1')]);if(!_0x50c57f){return this['channel'][_0x91e1('0x2d')](_0x5c3a1c,_0x91e1('0xe3'));}var _0x11c989=this[_0x91e1('0xe')][_0x91e1('0x11')](_0x50c57f);return{'code':0xc8,'result':_0x11c989['extra']?_0x11c989[_0x91e1('0xab')]:'-'};};String[_0x91e1('0x10')][_0x91e1('0xaa')]=function(_0x461187,_0x40a54f){return this[_0x91e1('0x1d3')](_0x461187)[_0x91e1('0x1d4')](_0x40a54f);};module[_0x91e1('0x1d5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 105718c..8fa3794 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 _0x15e0=['secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','acwTimeout','timer','stopAcw','format','updateAcw','lastPauseAt','update','uniqueid','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','prototype','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','isNil','transfereeuniqueid'];(function(_0x43d6b8,_0x15d2a7){var _0x45673c=function(_0x4aa501){while(--_0x4aa501){_0x43d6b8['push'](_0x43d6b8['shift']());}};_0x45673c(++_0x15d2a7);}(_0x15e0,0x14b));var _0x015e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15e0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x015e('0x0'));var _=require(_0x015e('0x1'));var moment=require(_0x015e('0x2'));var ami=require(_0x015e('0x3'));var logger=require('../../../config/logger')(_0x015e('0x4'));var RpcUser=require(_0x015e('0x5'));var RpcVoiceAgentReport=require(_0x015e('0x6'));function Acw(_0x11e9b0){this['voiceQueues']=_0x11e9b0[_0x015e('0x7')];this[_0x015e('0x8')]=_0x11e9b0[_0x015e('0x8')];this[_0x015e('0x9')]=_0x11e9b0[_0x015e('0x9')];this['channels']={};ami['on'](_0x015e('0xa'),this[_0x015e('0xb')][_0x015e('0xc')](this));ami['on'](_0x015e('0xd'),this[_0x015e('0xe')]['bind'](this));ami['on'](_0x015e('0xf'),this[_0x015e('0x10')][_0x015e('0xc')](this));ami['on'](_0x015e('0x11'),this['syncAgentRingNoAnswer'][_0x015e('0xc')](this));ami['on'](_0x015e('0x12'),this[_0x015e('0x13')][_0x015e('0xc')](this));ami['on'](_0x015e('0x14'),this[_0x015e('0x15')]['bind'](this));ami['on'](_0x015e('0x16'),this[_0x015e('0x17')]['bind'](this));}function getDiff(_0x56082c){var _0x5050bf=moment()['milliseconds'](0x0);var _0x342fb2=moment(_0x56082c)[_0x015e('0x18')](0x0);return _0x5050bf[_0x015e('0x19')](_0x342fb2,_0x015e('0x1a'));}Acw['prototype'][_0x015e('0x1b')]=function(_0xf52a9c){try{var _0x3facbe=this;var _0x437776=this[_0x015e('0x1c')][_0xf52a9c]['interface'];var _0x5b374c=this[_0x015e('0x1c')][_0xf52a9c][_0x015e('0x1d')];var _0x1ccc82=this['voiceQueues'][_0x5b374c];var _0x2e106d=![];var _0x204c24=_0x015e('0x1e');if(_0x1ccc82[_0x015e('0x1f')]){if(_0x1ccc82[_0x015e('0x20')]['name']){_0x2e106d=!![];_0x204c24=_0x1ccc82[_0x015e('0x20')][_0x015e('0x21')];}}ami['Action']({'action':_0x015e('0x22'),'interface':_0x437776,'paused':!![],'reason':_0x204c24})[_0x015e('0x23')](function(_0x2f03f9){if(_0x3facbe[_0x015e('0x8')][_0x437776]){return RpcUser[_0x015e('0x24')](_0x3facbe[_0x015e('0x8')][_0x437776]['id'])[_0x015e('0x23')](function(_0x4ce847){if(_0x4ce847&&!_0x4ce847[_0x015e('0x25')]){logger[_0x015e('0x26')](_0x015e('0x27'),_0xf52a9c,_0x437776,_0x5b374c);var _0x495309=_0x3facbe[_0x015e('0x1c')][_0xf52a9c]['attended']&&_0x3facbe['channels'][_0xf52a9c][_0x015e('0x28')]?_0x3facbe[_0x015e('0x1c')][_0xf52a9c][_0x015e('0x28')]:_0xf52a9c;return RpcUser['savePause'](_0x3facbe[_0x015e('0x8')][_0x437776],_0x204c24,_0x495309)[_0x015e('0x23')](function(_0x3064df){if(!_0x2e106d){_0x3facbe[_0x015e('0x9')][_0x437776]={};logger[_0x015e('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xf52a9c,_0x3facbe[_0x015e('0x7')][_0x5b374c][_0x015e('0x29')],_0x437776,_0x5b374c);_0x3facbe['timers'][_0x437776][_0x015e('0x2a')]=setTimeout(_0x3facbe[_0x015e('0x2b')]['bind'](_0x3facbe,_0x437776),_0x3facbe['voiceQueues'][_0x5b374c][_0x015e('0x29')]*0x3e8);_0x3facbe[_0x015e('0x9')][_0x437776]['lastPauseAt']=moment()[_0x015e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3facbe[_0x015e('0x9')][_0x437776]['uniqueid']=_0xf52a9c;_0x3facbe['timers'][_0x437776][_0x015e('0x1d')]=_0x5b374c;_0x3facbe[_0x015e('0x9')][_0x437776][_0x015e('0x2d')]=function(){var _0x11bb9d=getDiff(_0x3facbe[_0x015e('0x9')][_0x437776][_0x015e('0x2e')]);clearTimeout(_0x3facbe[_0x015e('0x9')][_0x437776][_0x015e('0x2a')]);_0x3facbe[_0x015e('0x9')][_0x437776][_0x015e('0x2a')]=![];RpcVoiceAgentReport[_0x015e('0x2f')]({'acwtime':_0x11bb9d},_0x3facbe[_0x015e('0x9')][_0x437776][_0x015e('0x30')],_0x437776)[_0x015e('0x23')](function(_0x4ad4fd){logger[_0x015e('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0xf52a9c,_0x11bb9d,_0x4ad4fd);})[_0x015e('0x31')](function(_0x243696){logger['error'](_0x015e('0x32'),_0xf52a9c,_0x243696);});delete _0x3facbe[_0x015e('0x9')][_0x437776];};}});}else{logger['info'](_0x015e('0x33'),_0xf52a9c,_0x437776,_0x5b374c);}});}})[_0x015e('0x31')](function(_0x2946e7){logger[_0x015e('0x34')](_0x015e('0x35'),_0xf52a9c,_0x3facbe[_0x015e('0x7')][_0x5b374c]['acwTimeout'],_0x437776,_0x5b374c);})[_0x015e('0x36')](function(){delete _0x3facbe[_0x015e('0x1c')][_0xf52a9c];});}catch(_0x2fa8c0){logger[_0x015e('0x34')]('[ACW][START]\x20%s',_0x2fa8c0['message']);}};Acw[_0x015e('0x37')][_0x015e('0x2b')]=function(_0x4662ae){try{var _0x3c2ec9=this;if(_0x3c2ec9[_0x015e('0x9')][_0x4662ae]){_0x3c2ec9[_0x015e('0x9')][_0x4662ae][_0x015e('0x2a')]=![];var _0x2bef5d=_0x3c2ec9[_0x015e('0x9')][_0x4662ae]['uniqueid'];var _0x6ea497=_0x3c2ec9['timers'][_0x4662ae][_0x015e('0x1d')];var _0x42271f=_0x3c2ec9[_0x015e('0x7')][_0x6ea497][_0x015e('0x29')];logger[_0x015e('0x26')]('[%s][TIMER][STOP][AGENT:%s]',_0x2bef5d,_0x4662ae);RpcUser[_0x015e('0x38')](this[_0x015e('0x8')][_0x4662ae]);RpcVoiceAgentReport[_0x015e('0x2f')]({'acwtime':_0x42271f,'agentacw':!![]},_0x2bef5d,_0x4662ae)[_0x015e('0x23')](function(_0x5c2f2f){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2bef5d,_0x42271f,_0x5c2f2f);})[_0x015e('0x31')](function(_0x7b7938){logger[_0x015e('0x34')](_0x015e('0x32'),_0x2bef5d,_0x7b7938);});}else{logger[_0x015e('0x34')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4662ae);if(_0x3c2ec9[_0x015e('0x9')]){logger[_0x015e('0x26')](_0x015e('0x39'),JSON[_0x015e('0x3a')](_0x3c2ec9['timers']));}}}catch(_0x2d7f4f){logger['error'](_0x015e('0x3b'),_0x2d7f4f[_0x015e('0x3c')]);}};Acw[_0x015e('0x37')][_0x015e('0xb')]=function(_0x29d69b){try{if(this[_0x015e('0x7')][_0x29d69b[_0x015e('0x1d')]]&&(this['voiceQueues'][_0x29d69b[_0x015e('0x1d')]][_0x015e('0x4')]||this[_0x015e('0x7')][_0x29d69b[_0x015e('0x1d')]]['mandatoryDisposition'])){if(this[_0x015e('0x8')][_0x29d69b[_0x015e('0x3d')]]){this[_0x015e('0x1c')][_0x29d69b['uniqueid']]={'queue':_0x29d69b['queue'],'interface':_0x29d69b['interface'],'destlinkedid':_0x29d69b[_0x015e('0x28')]};}}}catch(_0x505ab8){logger[_0x015e('0x34')](_0x015e('0x3e'),_0x505ab8[_0x015e('0x3c')]);}};Acw[_0x015e('0x37')][_0x015e('0x17')]=function(_0x1ec28f){try{if(this[_0x015e('0x7')][_0x1ec28f[_0x015e('0x1d')]]&&(this[_0x015e('0x7')][_0x1ec28f[_0x015e('0x1d')]]['acw']||this[_0x015e('0x7')][_0x1ec28f[_0x015e('0x1d')]]['mandatoryDisposition'])){if(this[_0x015e('0x8')][_0x1ec28f[_0x015e('0x3d')]]){this[_0x015e('0x1c')][_0x1ec28f[_0x015e('0x30')]]={'queue':_0x1ec28f[_0x015e('0x1d')],'interface':_0x1ec28f[_0x015e('0x3d')]};}}}catch(_0xd5d4a0){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0xd5d4a0[_0x015e('0x3c')]);}};Acw[_0x015e('0x37')][_0x015e('0xe')]=function(_0x4845fc){try{if(this[_0x015e('0x1c')][_0x4845fc['uniqueid']]&&_[_0x015e('0x3f')](this[_0x015e('0x1c')][_0x4845fc[_0x015e('0x30')]][_0x015e('0x40')])){logger[_0x015e('0x26')]('[%s][HANGUP:UNIQUEID]',_0x4845fc[_0x015e('0x30')]);this[_0x015e('0x1b')](_0x4845fc['uniqueid']);}else if(this['channels'][_0x4845fc[_0x015e('0x41')]]&&_[_0x015e('0x3f')](this['channels'][_0x4845fc['linkedid']][_0x015e('0x40')])){logger['info'](_0x015e('0x42'),_0x4845fc[_0x015e('0x41')]);this['startAcw'](_0x4845fc['linkedid']);}}catch(_0x11c492){logger[_0x015e('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x11c492[_0x015e('0x3c')]);}};Acw[_0x015e('0x37')][_0x015e('0x10')]=function(_0x1244e0){try{if(this[_0x015e('0x1c')][_0x1244e0[_0x015e('0x30')]]&&this[_0x015e('0x1c')][_0x1244e0[_0x015e('0x30')]][_0x015e('0x40')]){logger[_0x015e('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x1244e0['uniqueid']);this[_0x015e('0x1b')](_0x1244e0[_0x015e('0x30')]);}else if(this[_0x015e('0x1c')][_0x1244e0[_0x015e('0x41')]]&&this['channels'][_0x1244e0[_0x015e('0x41')]]['attended']){logger[_0x015e('0x26')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1244e0[_0x015e('0x41')]);this[_0x015e('0x1b')](_0x1244e0['linkedid']);}}catch(_0x2a69a7){logger['error']('[ACW][syncHangup]\x20%s',_0x2a69a7[_0x015e('0x3c')]);}};Acw[_0x015e('0x37')][_0x015e('0x13')]=function(_0x4d24e2){try{if(!_[_0x015e('0x43')](this[_0x015e('0x1c')][_0x4d24e2['transfereeuniqueid']])){this['startAcw'](_0x4d24e2[_0x015e('0x44')]);if(this[_0x015e('0x1c')][_0x4d24e2['secondtransfereruniqueid']]){this[_0x015e('0x1c')][_0x4d24e2[_0x015e('0x45')]][_0x015e('0x40')]=!![];this[_0x015e('0x1c')][_0x4d24e2[_0x015e('0x46')]]=this[_0x015e('0x1c')][_0x4d24e2[_0x015e('0x45')]];delete this[_0x015e('0x1c')][_0x4d24e2[_0x015e('0x45')]];}}else if(!_[_0x015e('0x43')](this['channels'][_0x4d24e2[_0x015e('0x46')]])){this[_0x015e('0x1b')](_0x4d24e2[_0x015e('0x46')]);if(this['channels'][_0x4d24e2['origtransfereruniqueid']]){this[_0x015e('0x1c')][_0x4d24e2['origtransfereruniqueid']]['attended']=!![];this['channels'][_0x4d24e2['transfereeuniqueid']]=this[_0x015e('0x1c')][_0x4d24e2[_0x015e('0x47')]];delete this[_0x015e('0x1c')][_0x4d24e2[_0x015e('0x47')]];}}}catch(_0x1ce357){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x1ce357[_0x015e('0x3c')]);}};Acw[_0x015e('0x37')]['syncBlindTransfer']=function(_0x51a023){try{if(this[_0x015e('0x1c')][_0x51a023[_0x015e('0x48')]]){logger[_0x015e('0x26')](_0x015e('0x49'),JSON[_0x015e('0x3a')](_0x51a023['transfereruniqueid']));this['startAcw'](_0x51a023['transfereruniqueid']);}else if(this[_0x015e('0x1c')][_0x51a023[_0x015e('0x4a')]]){logger[_0x015e('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x015e('0x3a')](_0x51a023['transfererlinkedid']));this[_0x015e('0x1b')](_0x51a023['transfererlinkedid']);}}catch(_0x3d0a24){logger[_0x015e('0x34')](_0x015e('0x4b'),_0x3d0a24['message']);}};Acw[_0x015e('0x37')]['syncAgentRingNoAnswer']=function(_0x47db4d){try{if(this['voiceQueues'][_0x47db4d[_0x015e('0x1d')]]&&this['voiceQueues'][_0x47db4d[_0x015e('0x1d')]][_0x015e('0x4c')]===_0x015e('0x4d')){if(this[_0x015e('0x8')][_0x47db4d[_0x015e('0x3d')]]){logger['info'](_0x015e('0x4e'),_0x47db4d['uniqueid'],_0x47db4d[_0x015e('0x3d')],_0x47db4d[_0x015e('0x1d')]);return RpcUser[_0x015e('0x4f')](this['agents'][_0x47db4d['interface']],'Auto-Pause',_0x47db4d[_0x015e('0x30')]);}}}catch(_0x312f4d){logger[_0x015e('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x312f4d[_0x015e('0x3c')]);}};module['exports']=Acw; \ No newline at end of file +var _0x6fcf=['stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','startAcw','channels','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','acwTimeout','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6fcf,0x1ae));var _0xf6fc=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x6fcf[_0x2f3848];return _0x102668;};'use strict';var util=require(_0xf6fc('0x0'));var _=require('lodash');var moment=require('moment');var ami=require(_0xf6fc('0x1'));var logger=require('../../../config/logger')(_0xf6fc('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xf6fc('0x3'));function Acw(_0x3a7904){this[_0xf6fc('0x4')]=_0x3a7904[_0xf6fc('0x4')];this['agents']=_0x3a7904[_0xf6fc('0x5')];this[_0xf6fc('0x6')]=_0x3a7904['timers'];this['channels']={};ami['on'](_0xf6fc('0x7'),this[_0xf6fc('0x8')]['bind'](this));ami['on'](_0xf6fc('0x9'),this[_0xf6fc('0xa')][_0xf6fc('0xb')](this));ami['on'](_0xf6fc('0xc'),this[_0xf6fc('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0xf6fc('0xe')]['bind'](this));ami['on']('attendedtransfer',this[_0xf6fc('0xf')][_0xf6fc('0xb')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xf6fc('0xb')](this));ami['on'](_0xf6fc('0x10'),this[_0xf6fc('0x11')][_0xf6fc('0xb')](this));}function getDiff(_0x19159c){var _0x1b66de=moment()[_0xf6fc('0x12')](0x0);var _0x49c41e=moment(_0x19159c)[_0xf6fc('0x12')](0x0);return _0x1b66de['diff'](_0x49c41e,'seconds');}Acw['prototype'][_0xf6fc('0x13')]=function(_0x17de52){try{var _0x450b99=this;var _0x557a2f=this[_0xf6fc('0x14')][_0x17de52]['interface'];var _0x39f76c=this[_0xf6fc('0x14')][_0x17de52][_0xf6fc('0x15')];var _0x4a55a3=this[_0xf6fc('0x4')][_0x39f76c];var _0x59b00b=![];var _0x3e9ed9=_0xf6fc('0x16');if(_0x4a55a3['mandatoryDisposition']){if(_0x4a55a3[_0xf6fc('0x17')][_0xf6fc('0x18')]){_0x59b00b=!![];_0x3e9ed9=_0x4a55a3['mandatoryDispositionPause'][_0xf6fc('0x18')];}}ami[_0xf6fc('0x19')]({'action':_0xf6fc('0x1a'),'interface':_0x557a2f,'paused':!![],'reason':_0x3e9ed9})[_0xf6fc('0x1b')](function(_0x335d9e){if(_0x450b99[_0xf6fc('0x5')][_0x557a2f]){return RpcUser[_0xf6fc('0x1c')](_0x450b99['agents'][_0x557a2f]['id'])[_0xf6fc('0x1b')](function(_0x100737){if(_0x100737&&!_0x100737[_0xf6fc('0x1d')]){logger[_0xf6fc('0x1e')](_0xf6fc('0x1f'),_0x17de52,_0x557a2f,_0x39f76c);var _0x517512=_0x450b99[_0xf6fc('0x14')][_0x17de52]['attended']&&_0x450b99[_0xf6fc('0x14')][_0x17de52]['destlinkedid']?_0x450b99[_0xf6fc('0x14')][_0x17de52]['destlinkedid']:_0x17de52;return RpcUser[_0xf6fc('0x20')](_0x450b99[_0xf6fc('0x5')][_0x557a2f],_0x3e9ed9,_0x517512)[_0xf6fc('0x1b')](function(_0x1d90b9){if(!_0x59b00b){_0x450b99['timers'][_0x557a2f]={};logger[_0xf6fc('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x17de52,_0x450b99['voiceQueues'][_0x39f76c]['acwTimeout'],_0x557a2f,_0x39f76c);_0x450b99['timers'][_0x557a2f][_0xf6fc('0x21')]=setTimeout(_0x450b99[_0xf6fc('0x22')][_0xf6fc('0xb')](_0x450b99,_0x557a2f),_0x450b99[_0xf6fc('0x4')][_0x39f76c]['acwTimeout']*0x3e8);_0x450b99['timers'][_0x557a2f][_0xf6fc('0x23')]=moment()[_0xf6fc('0x24')](_0xf6fc('0x25'));_0x450b99[_0xf6fc('0x6')][_0x557a2f][_0xf6fc('0x26')]=_0x17de52;_0x450b99['timers'][_0x557a2f][_0xf6fc('0x15')]=_0x39f76c;_0x450b99[_0xf6fc('0x6')][_0x557a2f]['updateAcw']=function(){var _0xc3a753=getDiff(_0x450b99[_0xf6fc('0x6')][_0x557a2f]['lastPauseAt']);clearTimeout(_0x450b99[_0xf6fc('0x6')][_0x557a2f][_0xf6fc('0x21')]);_0x450b99[_0xf6fc('0x6')][_0x557a2f][_0xf6fc('0x21')]=![];RpcVoiceAgentReport[_0xf6fc('0x27')]({'acwtime':_0xc3a753},_0x450b99['timers'][_0x557a2f]['uniqueid'],_0x557a2f)[_0xf6fc('0x1b')](function(_0xa920db){logger[_0xf6fc('0x1e')](_0xf6fc('0x28'),_0x17de52,_0xc3a753,_0xa920db);})['catch'](function(_0x3547a1){logger[_0xf6fc('0x29')](_0xf6fc('0x2a'),_0x17de52,_0x3547a1);});delete _0x450b99[_0xf6fc('0x6')][_0x557a2f];};}});}else{logger[_0xf6fc('0x1e')](_0xf6fc('0x2b'),_0x17de52,_0x557a2f,_0x39f76c);}});}})['catch'](function(_0xda9693){logger[_0xf6fc('0x29')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x17de52,_0x450b99[_0xf6fc('0x4')][_0x39f76c][_0xf6fc('0x2c')],_0x557a2f,_0x39f76c);})['finally'](function(){delete _0x450b99[_0xf6fc('0x14')][_0x17de52];});}catch(_0x249386){logger['error'](_0xf6fc('0x2d'),_0x249386[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')][_0xf6fc('0x22')]=function(_0x36c346){try{var _0x53c432=this;if(_0x53c432['timers'][_0x36c346]){_0x53c432[_0xf6fc('0x6')][_0x36c346][_0xf6fc('0x21')]=![];var _0x5bea27=_0x53c432[_0xf6fc('0x6')][_0x36c346][_0xf6fc('0x26')];var _0x32886d=_0x53c432[_0xf6fc('0x6')][_0x36c346]['queue'];var _0x2abf1f=_0x53c432[_0xf6fc('0x4')][_0x32886d][_0xf6fc('0x2c')];logger['info'](_0xf6fc('0x30'),_0x5bea27,_0x36c346);RpcUser[_0xf6fc('0x31')](this[_0xf6fc('0x5')][_0x36c346]);RpcVoiceAgentReport[_0xf6fc('0x27')]({'acwtime':_0x2abf1f,'agentacw':!![]},_0x5bea27,_0x36c346)[_0xf6fc('0x1b')](function(_0x280a27){logger[_0xf6fc('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x5bea27,_0x2abf1f,_0x280a27);})[_0xf6fc('0x32')](function(_0x511a82){logger[_0xf6fc('0x29')](_0xf6fc('0x2a'),_0x5bea27,_0x511a82);});}else{logger[_0xf6fc('0x29')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x36c346);if(_0x53c432[_0xf6fc('0x6')]){logger[_0xf6fc('0x1e')](_0xf6fc('0x33'),JSON['stringify'](_0x53c432['timers']));}}}catch(_0x2b9bf5){logger[_0xf6fc('0x29')](_0xf6fc('0x34'),_0x2b9bf5[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')][_0xf6fc('0x8')]=function(_0x19117e){try{if(this[_0xf6fc('0x4')][_0x19117e['queue']]&&(this[_0xf6fc('0x4')][_0x19117e[_0xf6fc('0x15')]][_0xf6fc('0x2')]||this[_0xf6fc('0x4')][_0x19117e[_0xf6fc('0x15')]][_0xf6fc('0x35')])){if(this[_0xf6fc('0x5')][_0x19117e['interface']]){this[_0xf6fc('0x14')][_0x19117e[_0xf6fc('0x26')]]={'queue':_0x19117e['queue'],'interface':_0x19117e[_0xf6fc('0x36')],'destlinkedid':_0x19117e[_0xf6fc('0x37')]};}}}catch(_0x1960a4){logger[_0xf6fc('0x29')](_0xf6fc('0x38'),_0x1960a4[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')][_0xf6fc('0x11')]=function(_0x4e0498){try{if(this[_0xf6fc('0x4')][_0x4e0498[_0xf6fc('0x15')]]&&(this[_0xf6fc('0x4')][_0x4e0498[_0xf6fc('0x15')]][_0xf6fc('0x2')]||this[_0xf6fc('0x4')][_0x4e0498[_0xf6fc('0x15')]][_0xf6fc('0x35')])){if(this['agents'][_0x4e0498[_0xf6fc('0x36')]]){this[_0xf6fc('0x14')][_0x4e0498[_0xf6fc('0x26')]]={'queue':_0x4e0498[_0xf6fc('0x15')],'interface':_0x4e0498['interface']};}}}catch(_0x441c7e){logger[_0xf6fc('0x29')](_0xf6fc('0x39'),_0x441c7e[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')][_0xf6fc('0xa')]=function(_0x4179a7){try{if(this['channels'][_0x4179a7[_0xf6fc('0x26')]]&&_['isUndefined'](this[_0xf6fc('0x14')][_0x4179a7['uniqueid']][_0xf6fc('0x3a')])){logger[_0xf6fc('0x1e')](_0xf6fc('0x3b'),_0x4179a7[_0xf6fc('0x26')]);this[_0xf6fc('0x13')](_0x4179a7[_0xf6fc('0x26')]);}else if(this[_0xf6fc('0x14')][_0x4179a7[_0xf6fc('0x3c')]]&&_[_0xf6fc('0x3d')](this['channels'][_0x4179a7[_0xf6fc('0x3c')]][_0xf6fc('0x3a')])){logger[_0xf6fc('0x1e')](_0xf6fc('0x3e'),_0x4179a7[_0xf6fc('0x3c')]);this[_0xf6fc('0x13')](_0x4179a7[_0xf6fc('0x3c')]);}}catch(_0x3c7ff3){logger['error'](_0xf6fc('0x3f'),_0x3c7ff3[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')][_0xf6fc('0xd')]=function(_0x591a8c){try{if(this[_0xf6fc('0x14')][_0x591a8c[_0xf6fc('0x26')]]&&this[_0xf6fc('0x14')][_0x591a8c[_0xf6fc('0x26')]][_0xf6fc('0x3a')]){logger[_0xf6fc('0x1e')](_0xf6fc('0x40'),_0x591a8c[_0xf6fc('0x26')]);this[_0xf6fc('0x13')](_0x591a8c['uniqueid']);}else if(this[_0xf6fc('0x14')][_0x591a8c['linkedid']]&&this[_0xf6fc('0x14')][_0x591a8c[_0xf6fc('0x3c')]][_0xf6fc('0x3a')]){logger['info'](_0xf6fc('0x41'),_0x591a8c[_0xf6fc('0x3c')]);this['startAcw'](_0x591a8c[_0xf6fc('0x3c')]);}}catch(_0x46672e){logger[_0xf6fc('0x29')]('[ACW][syncHangup]\x20%s',_0x46672e[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')][_0xf6fc('0xf')]=function(_0x1b0483){try{if(!_[_0xf6fc('0x42')](this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x43')]])){this[_0xf6fc('0x13')](_0x1b0483[_0xf6fc('0x43')]);if(this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x44')]]){this['channels'][_0x1b0483[_0xf6fc('0x44')]][_0xf6fc('0x3a')]=!![];this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x45')]]=this[_0xf6fc('0x14')][_0x1b0483['secondtransfereruniqueid']];delete this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x44')]];}}else if(!_[_0xf6fc('0x42')](this[_0xf6fc('0x14')][_0x1b0483['transfertargetuniqueid']])){this[_0xf6fc('0x13')](_0x1b0483[_0xf6fc('0x45')]);if(this[_0xf6fc('0x14')][_0x1b0483['origtransfereruniqueid']]){this['channels'][_0x1b0483[_0xf6fc('0x46')]][_0xf6fc('0x3a')]=!![];this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x43')]]=this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x46')]];delete this[_0xf6fc('0x14')][_0x1b0483[_0xf6fc('0x46')]];}}}catch(_0x42fc97){logger[_0xf6fc('0x29')](_0xf6fc('0x47'),_0x42fc97['message']);}};Acw['prototype'][_0xf6fc('0x48')]=function(_0x49e0ea){try{if(this[_0xf6fc('0x14')][_0x49e0ea[_0xf6fc('0x49')]]){logger[_0xf6fc('0x1e')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf6fc('0x4a')](_0x49e0ea[_0xf6fc('0x49')]));this[_0xf6fc('0x13')](_0x49e0ea[_0xf6fc('0x49')]);}else if(this[_0xf6fc('0x14')][_0x49e0ea[_0xf6fc('0x4b')]]){logger[_0xf6fc('0x1e')](_0xf6fc('0x4c'),JSON[_0xf6fc('0x4a')](_0x49e0ea[_0xf6fc('0x4b')]));this[_0xf6fc('0x13')](_0x49e0ea[_0xf6fc('0x4b')]);}}catch(_0x5316c1){logger['error'](_0xf6fc('0x4d'),_0x5316c1[_0xf6fc('0x2e')]);}};Acw[_0xf6fc('0x2f')]['syncAgentRingNoAnswer']=function(_0x1cac02){try{if(this[_0xf6fc('0x4')][_0x1cac02[_0xf6fc('0x15')]]&&this[_0xf6fc('0x4')][_0x1cac02[_0xf6fc('0x15')]][_0xf6fc('0x4e')]===_0xf6fc('0x4f')){if(this[_0xf6fc('0x5')][_0x1cac02[_0xf6fc('0x36')]]){logger[_0xf6fc('0x1e')](_0xf6fc('0x50'),_0x1cac02[_0xf6fc('0x26')],_0x1cac02[_0xf6fc('0x36')],_0x1cac02[_0xf6fc('0x15')]);return RpcUser[_0xf6fc('0x20')](this[_0xf6fc('0x5')][_0x1cac02[_0xf6fc('0x36')]],_0xf6fc('0x51'),_0x1cac02[_0xf6fc('0x26')]);}}}catch(_0x12eb42){logger['error'](_0xf6fc('0x52'),_0x12eb42[_0xf6fc('0x2e')]);}};module[_0xf6fc('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index a74fce4..6163333 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x5023c1,_0x447fb3){var _0x5cb9de=function(_0x3a3c94){while(--_0x3a3c94){_0x5023c1['push'](_0x5023c1['shift']());}};_0x5cb9de(++_0x447fb3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0x0b0e[_0x16ecad];return _0x313ff7;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2032,0xd9));var _0x2203=function(_0x2f8745,_0x271e2c){_0x2f8745=_0x2f8745-0x0;var _0x537e37=_0x2032[_0x2f8745];return _0x537e37;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b5c69cd..d1e9ec5 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x484383,_0x13b35e){var _0x45c720=function(_0x2baf76){while(--_0x2baf76){_0x484383['push'](_0x484383['shift']());}};_0x45c720(++_0x13b35e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4142b1,_0x1119af){_0x4142b1=_0x4142b1-0x0;var _0x346210=_0xbdb7[_0x4142b1];return _0x346210;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +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(_0x2f48d6,_0x407e11){_0x2f48d6=_0x2f48d6-0x0;var _0x43090e=_0xda3f[_0x2f48d6];return _0x43090e;};'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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index ccef455..b4c4953 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60c5=['Contact','active','type','dialQueueTimeout','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','getQueue','queue','exports','util','lodash','isNil','string','uniqueid','name','phone','firstName'];(function(_0x59f1c7,_0x4b96ad){var _0x5bcc46=function(_0x30ac1b){while(--_0x30ac1b){_0x59f1c7['push'](_0x59f1c7['shift']());}};_0x5bcc46(++_0x4b96ad);}(_0x60c5,0xc0));var _0x560c=function(_0x328e09,_0x5878df){_0x328e09=_0x328e09-0x0;var _0x37906a=_0x60c5[_0x328e09];return _0x37906a;};'use strict';var util=require(_0x560c('0x0'));var _=require(_0x560c('0x1'));var moment=require('moment');function checkNameSurname(_0x158ca0,_0x1b73f2,_0x28f1ea){var _0x3f40a3='';if(!_[_0x560c('0x2')](_0x1b73f2)&&_0x560c('0x3')===typeof _0x1b73f2){_0x3f40a3+=_0x1b73f2;}if(!_['isNil'](_0x28f1ea)&&_0x560c('0x3')===typeof _0x28f1ea){_0x3f40a3+='\x20'+_0x28f1ea;}if(_0x3f40a3!==''){return _0x3f40a3;}return _0x158ca0;}function Action(_0x1160fa,_0x2f394b,_0x1cb928){this['voiceQueue']=_0x1160fa;this[_0x560c('0x4')]=_0x1cb928||undefined;this[_0x560c('0x5')]=checkNameSurname(_0x2f394b['Contact'][_0x560c('0x6')],_0x2f394b['Contact'][_0x560c('0x7')],_0x2f394b[_0x560c('0x8')]['lastName']);this['number']=_0x2f394b[_0x560c('0x8')][_0x560c('0x6')];this['queue']=_0x1160fa['name'];this[_0x560c('0x9')]=_0x2f394b['active']||![];this[_0x560c('0xa')]=_0x1160fa['type'];this['dialQueueTimeout']=_0x1160fa[_0x560c('0xb')]||0x3;this['scheduledat']=_0x2f394b['scheduledat'];this['countbusyretry']=_0x2f394b['countbusyretry'];this[_0x560c('0xc')]=_0x2f394b[_0x560c('0xc')];this[_0x560c('0xd')]=_0x2f394b[_0x560c('0xd')];this[_0x560c('0xe')]=_0x2f394b['countnosuchnumberretry'];this[_0x560c('0xf')]=_0x2f394b[_0x560c('0xf')];this[_0x560c('0x10')]=_0x2f394b[_0x560c('0x10')];this[_0x560c('0x11')]=_0x2f394b[_0x560c('0x11')];this[_0x560c('0x12')]=_0x2f394b[_0x560c('0x12')];this[_0x560c('0x13')]=_0x2f394b[_0x560c('0x13')];this[_0x560c('0x14')]=_0x2f394b[_0x560c('0x14')];this[_0x560c('0x15')]=_0x2f394b[_0x560c('0x15')];this[_0x560c('0x16')]=_0x2f394b[_0x560c('0x16')];this['CampaignId']=_0x2f394b['CampaignId'];this[_0x560c('0x17')]=_0x2f394b['id'];this['ContactFirstName']=_0x2f394b[_0x560c('0x8')][_0x560c('0x7')]||'';this['starttime']=moment()[_0x560c('0x18')](_0x560c('0x19'));this['callback']=_0x2f394b[_0x560c('0x1a')];this[_0x560c('0x1b')]=_0x2f394b[_0x560c('0x1b')];this[_0x560c('0x1c')]=_0x2f394b[_0x560c('0x1c')];this[_0x560c('0x1d')]=_0x2f394b[_0x560c('0x1d')];this[_0x560c('0x1e')]='';this[_0x560c('0x1f')]='';}Action[_0x560c('0x20')]['getCaller']=function(){return util[_0x560c('0x18')](_0x560c('0x21'),this[_0x560c('0x5')],this[_0x560c('0x22')][_0x560c('0x23')]>0x0?this[_0x560c('0x24')]['substring'](this[_0x560c('0x22')][_0x560c('0x23')]):this[_0x560c('0x24')]);};Action[_0x560c('0x20')][_0x560c('0x25')]=function(){return this[_0x560c('0x26')];};module[_0x560c('0x27')]=Action; \ No newline at end of file +var _0xa927=['originatecalleridname','prototype','getCaller','dialCutDigit','getQueue','queue','exports','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','originatecalleridnum'];(function(_0xabf599,_0xfe8245){var _0x29e874=function(_0x2a603d){while(--_0x2a603d){_0xabf599['push'](_0xabf599['shift']());}};_0x29e874(++_0xfe8245);}(_0xa927,0x85));var _0x7a92=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa927[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x7a92('0x0'));var _=require(_0x7a92('0x1'));var moment=require(_0x7a92('0x2'));function checkNameSurname(_0x4a7d75,_0x4cc58d,_0x7acf8b){var _0x4b2b6b='';if(!_['isNil'](_0x4cc58d)&&_0x7a92('0x3')===typeof _0x4cc58d){_0x4b2b6b+=_0x4cc58d;}if(!_['isNil'](_0x7acf8b)&&'string'===typeof _0x7acf8b){_0x4b2b6b+='\x20'+_0x7acf8b;}if(_0x4b2b6b!==''){return _0x4b2b6b;}return _0x4a7d75;}function Action(_0xa65b66,_0x379aa2,_0x2cc0a3){this[_0x7a92('0x4')]=_0xa65b66;this[_0x7a92('0x5')]=_0x2cc0a3||undefined;this[_0x7a92('0x6')]=checkNameSurname(_0x379aa2[_0x7a92('0x7')][_0x7a92('0x8')],_0x379aa2[_0x7a92('0x7')][_0x7a92('0x9')],_0x379aa2[_0x7a92('0x7')][_0x7a92('0xa')]);this[_0x7a92('0xb')]=_0x379aa2[_0x7a92('0x7')][_0x7a92('0x8')];this['queue']=_0xa65b66[_0x7a92('0x6')];this['active']=_0x379aa2[_0x7a92('0xc')]||![];this[_0x7a92('0xd')]=_0xa65b66[_0x7a92('0xd')];this[_0x7a92('0xe')]=_0xa65b66[_0x7a92('0xe')]||0x3;this[_0x7a92('0xf')]=_0x379aa2[_0x7a92('0xf')];this[_0x7a92('0x10')]=_0x379aa2[_0x7a92('0x10')];this['countcongestionretry']=_0x379aa2[_0x7a92('0x11')];this[_0x7a92('0x12')]=_0x379aa2[_0x7a92('0x12')];this[_0x7a92('0x13')]=_0x379aa2[_0x7a92('0x13')];this[_0x7a92('0x14')]=_0x379aa2[_0x7a92('0x14')];this[_0x7a92('0x15')]=_0x379aa2[_0x7a92('0x15')];this[_0x7a92('0x16')]=_0x379aa2[_0x7a92('0x16')];this[_0x7a92('0x17')]=_0x379aa2['countagentrejectretry'];this[_0x7a92('0x18')]=_0x379aa2[_0x7a92('0x18')];this[_0x7a92('0x19')]=_0x379aa2[_0x7a92('0x19')];this[_0x7a92('0x1a')]=_0x379aa2[_0x7a92('0x1a')];this['VoiceQueueId']=_0x379aa2[_0x7a92('0x1b')];this['CampaignId']=_0x379aa2[_0x7a92('0x1c')];this['idHopper']=_0x379aa2['id'];this[_0x7a92('0x1d')]=_0x379aa2[_0x7a92('0x7')][_0x7a92('0x9')]||'';this['starttime']=moment()[_0x7a92('0x1e')](_0x7a92('0x1f'));this[_0x7a92('0x20')]=_0x379aa2['callback'];this['callbackuniqueid']=_0x379aa2[_0x7a92('0x21')];this['callbackat']=_0x379aa2['callbackat'];this['recallme']=_0x379aa2['recallme'];this[_0x7a92('0x22')]='';this[_0x7a92('0x23')]='';}Action[_0x7a92('0x24')][_0x7a92('0x25')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x7a92('0x6')],this[_0x7a92('0x4')][_0x7a92('0x26')]>0x0?this[_0x7a92('0xb')]['substring'](this[_0x7a92('0x4')]['dialCutDigit']):this[_0x7a92('0xb')]);};Action[_0x7a92('0x24')][_0x7a92('0x27')]=function(){return this[_0x7a92('0x28')];};module[_0x7a92('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d84bfb9..c85db09 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb926=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime'];(function(_0x30d15b,_0x2bd5dc){var _0x59233a=function(_0x23b712){while(--_0x23b712){_0x30d15b['push'](_0x30d15b['shift']());}};_0x59233a(++_0x2bd5dc);}(_0xb926,0xce));var _0x6b92=function(_0x400bbf,_0x36b947){_0x400bbf=_0x400bbf-0x0;var _0x4a13b3=_0xb926[_0x400bbf];return _0x4a13b3;};'use strict';var util=require(_0x6b92('0x0'));var _=require(_0x6b92('0x1'));var moment=require(_0x6b92('0x2'));function getSeconds(_0x39dbe3,_0x10c994){var _0x3e4b90=moment(_0x39dbe3)[_0x6b92('0x3')](0x0);var _0x5ac579=moment(_0x10c994)[_0x6b92('0x3')](0x0);return _0x3e4b90[_0x6b92('0x4')](_0x5ac579,_0x6b92('0x5'));}function AgentComplete(_0x152fbf,_0x8afc88){this[_0x6b92('0x6')]=0x4;this[_0x6b92('0x7')]='Answer';this[_0x6b92('0x8')]=_0x152fbf[_0x6b92('0x8')];this[_0x6b92('0x9')]=_0x152fbf[_0x6b92('0x9')];this['campaigntype']=_0x152fbf['type']===_0x6b92('0xa')?'queue':_0x152fbf['type'];this[_0x6b92('0xb')]=_0x152fbf[_0x6b92('0xb')];this[_0x6b92('0xc')]=_0x152fbf[_0x6b92('0xc')];this[_0x6b92('0xd')]=_0x152fbf[_0x6b92('0xd')];this['countglobal']=_0x152fbf['countbusyretry']+_0x152fbf[_0x6b92('0xc')]+_0x152fbf[_0x6b92('0xd')]+_0x152fbf[_0x6b92('0xe')]+_0x152fbf['countdropretry']+_0x152fbf[_0x6b92('0xf')]+_0x152fbf['countmachineretry']+_0x152fbf['countagentrejectretry'];this['countnosuchnumberretry']=_0x152fbf['countnosuchnumberretry'];this[_0x6b92('0x10')]=_0x152fbf['countdropretry'];this[_0x6b92('0xf')]=_0x152fbf[_0x6b92('0xf')];this[_0x6b92('0x11')]=_0x152fbf[_0x6b92('0x11')];this[_0x6b92('0x12')]=_0x152fbf[_0x6b92('0x12')];this[_0x6b92('0x13')]=_0x8afc88[_0x6b92('0x13')];this['calleridname']=_0x152fbf[_0x6b92('0x14')];this[_0x6b92('0x15')]=_0x152fbf[_0x6b92('0x16')];this[_0x6b92('0x17')]=_0x152fbf[_0x6b92('0x17')];this['responsetime']=_0x152fbf['responsetime'];this['answertime']=_0x152fbf[_0x6b92('0x18')];this[_0x6b92('0x19')]=moment()[_0x6b92('0x1a')](_0x6b92('0x1b'));this['ringtime']=getSeconds(_0x152fbf[_0x6b92('0x1c')],_0x152fbf['starttime']);this[_0x6b92('0x1d')]=getSeconds(_0x152fbf[_0x6b92('0x18')],_0x152fbf['responsetime']);this[_0x6b92('0x1e')]=getSeconds(this['endtime'],_0x152fbf[_0x6b92('0x18')]);this[_0x6b92('0x1f')]=_0x8afc88[_0x6b92('0x1f')];this[_0x6b92('0x20')]=_0x8afc88[_0x6b92('0x20')];this[_0x6b92('0x21')]=_0x8afc88[_0x6b92('0x21')];this[_0x6b92('0x22')]=_0x152fbf[_0x6b92('0x22')];this['callbackuniqueid']=_0x152fbf[_0x6b92('0x23')];this['callbackat']=_0x152fbf[_0x6b92('0x24')];this[_0x6b92('0x25')]=_0x152fbf['recallme'];this[_0x6b92('0x26')]=_0x152fbf[_0x6b92('0x26')];this[_0x6b92('0x27')]=_0x152fbf[_0x6b92('0x27')];this['UserId']=_0x152fbf[_0x6b92('0x28')];this['VoiceQueueId']=_0x152fbf[_0x6b92('0x29')];this[_0x6b92('0x2a')]=_0x152fbf[_0x6b92('0x2a')];this[_0x6b92('0x2b')]=_0x152fbf[_0x6b92('0x2b')]||'';this[_0x6b92('0x2c')]=_0x152fbf[_0x6b92('0x2c')]||'';}module[_0x6b92('0x2d')]=AgentComplete; \ No newline at end of file +var _0xddc3=['answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xddc3,0x194));var _0x3ddc=function(_0x227cfe,_0x4a8ce1){_0x227cfe=_0x227cfe-0x0;var _0x3c03f0=_0xddc3[_0x227cfe];return _0x3c03f0;};'use strict';var util=require(_0x3ddc('0x0'));var _=require(_0x3ddc('0x1'));var moment=require(_0x3ddc('0x2'));function getSeconds(_0x1d7665,_0x753d5d){var _0x168976=moment(_0x1d7665)[_0x3ddc('0x3')](0x0);var _0x6b541a=moment(_0x753d5d)[_0x3ddc('0x3')](0x0);return _0x168976[_0x3ddc('0x4')](_0x6b541a,_0x3ddc('0x5'));}function AgentComplete(_0x4606fb,_0x4e331f){this[_0x3ddc('0x6')]=0x4;this[_0x3ddc('0x7')]=_0x3ddc('0x8');this['scheduledat']=_0x4606fb[_0x3ddc('0x9')];this[_0x3ddc('0xa')]=_0x4606fb[_0x3ddc('0xa')];this[_0x3ddc('0xb')]=_0x4606fb[_0x3ddc('0xa')]===_0x3ddc('0xc')?_0x3ddc('0xd'):_0x4606fb['type'];this[_0x3ddc('0xe')]=_0x4606fb['countbusyretry'];this[_0x3ddc('0xf')]=_0x4606fb[_0x3ddc('0xf')];this[_0x3ddc('0x10')]=_0x4606fb[_0x3ddc('0x10')];this[_0x3ddc('0x11')]=_0x4606fb[_0x3ddc('0xe')]+_0x4606fb[_0x3ddc('0xf')]+_0x4606fb['countnoanswerretry']+_0x4606fb[_0x3ddc('0x12')]+_0x4606fb[_0x3ddc('0x13')]+_0x4606fb[_0x3ddc('0x14')]+_0x4606fb[_0x3ddc('0x15')]+_0x4606fb['countagentrejectretry'];this[_0x3ddc('0x12')]=_0x4606fb[_0x3ddc('0x12')];this['countdropretry']=_0x4606fb[_0x3ddc('0x13')];this['countabandonedretry']=_0x4606fb['countabandonedretry'];this[_0x3ddc('0x15')]=_0x4606fb[_0x3ddc('0x15')];this[_0x3ddc('0x16')]=_0x4606fb[_0x3ddc('0x16')];this[_0x3ddc('0x17')]=_0x4e331f[_0x3ddc('0x17')];this['calleridname']=_0x4606fb['name'];this[_0x3ddc('0x18')]=_0x4606fb[_0x3ddc('0x19')];this['starttime']=_0x4606fb[_0x3ddc('0x1a')];this[_0x3ddc('0x1b')]=_0x4606fb[_0x3ddc('0x1b')];this[_0x3ddc('0x1c')]=_0x4606fb[_0x3ddc('0x1c')];this[_0x3ddc('0x1d')]=moment()['format'](_0x3ddc('0x1e'));this[_0x3ddc('0x1f')]=getSeconds(_0x4606fb[_0x3ddc('0x1b')],_0x4606fb[_0x3ddc('0x1a')]);this[_0x3ddc('0x20')]=getSeconds(_0x4606fb[_0x3ddc('0x1c')],_0x4606fb[_0x3ddc('0x1b')]);this[_0x3ddc('0x21')]=getSeconds(this[_0x3ddc('0x1d')],_0x4606fb['answertime']);this[_0x3ddc('0xd')]=_0x4e331f[_0x3ddc('0xd')];this[_0x3ddc('0x22')]=_0x4e331f['membername'];this['reason']=_0x4e331f[_0x3ddc('0x23')];this[_0x3ddc('0x24')]=_0x4606fb['callback'];this['callbackuniqueid']=_0x4606fb[_0x3ddc('0x25')];this[_0x3ddc('0x26')]=_0x4606fb[_0x3ddc('0x26')];this['recallme']=_0x4606fb[_0x3ddc('0x27')];this[_0x3ddc('0x28')]=_0x4606fb[_0x3ddc('0x28')];this[_0x3ddc('0x29')]=_0x4606fb[_0x3ddc('0x29')];this[_0x3ddc('0x2a')]=_0x4606fb[_0x3ddc('0x2a')];this[_0x3ddc('0x2b')]=_0x4606fb[_0x3ddc('0x2b')];this[_0x3ddc('0x2c')]=_0x4606fb[_0x3ddc('0x2c')];this[_0x3ddc('0x2d')]=_0x4606fb[_0x3ddc('0x2d')]||'';this[_0x3ddc('0x2e')]=_0x4606fb['originatecalleridname']||'';}module[_0x3ddc('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index a8bc23c..ecd9cc8 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8098=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds'];(function(_0x24c7d7,_0x876b7b){var _0x20aaa8=function(_0x3f6a8a){while(--_0x3f6a8a){_0x24c7d7['push'](_0x24c7d7['shift']());}};_0x20aaa8(++_0x876b7b);}(_0x8098,0x1ba));var _0x8809=function(_0x5d3ccc,_0xb5132a){_0x5d3ccc=_0x5d3ccc-0x0;var _0x3a4204=_0x8098[_0x5d3ccc];return _0x3a4204;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8809('0x0'));function getSeconds(_0x1ad523,_0x4037be){var _0x22f28d=moment(_0x1ad523)[_0x8809('0x1')](0x0);var _0x4b0838=moment(_0x4037be)[_0x8809('0x1')](0x0);return _0x22f28d[_0x8809('0x2')](_0x4b0838,_0x8809('0x3'));}function Final(_0x1a11bf){this['uniqueid']=_0x1a11bf[_0x8809('0x4')];this[_0x8809('0x5')]=_0x1a11bf['scheduledat'];this[_0x8809('0x6')]=_0x1a11bf[_0x8809('0x6')];this[_0x8809('0x7')]=_0x1a11bf[_0x8809('0x6')]===_0x8809('0x8')?_0x8809('0x9'):_0x1a11bf[_0x8809('0x6')];this[_0x8809('0xa')]=_0x1a11bf[_0x8809('0xa')];this[_0x8809('0xb')]=_0x1a11bf[_0x8809('0xb')];this[_0x8809('0xc')]=_0x1a11bf[_0x8809('0xc')];this[_0x8809('0xd')]=_0x1a11bf[_0x8809('0xa')]+_0x1a11bf[_0x8809('0xb')]+_0x1a11bf['countnoanswerretry']+_0x1a11bf[_0x8809('0xe')]+_0x1a11bf[_0x8809('0xf')]+_0x1a11bf['countabandonedretry']+_0x1a11bf[_0x8809('0x10')]+_0x1a11bf[_0x8809('0x11')];this['countnosuchnumberretry']=_0x1a11bf['countnosuchnumberretry'];this[_0x8809('0xf')]=_0x1a11bf[_0x8809('0xf')];this[_0x8809('0x12')]=_0x1a11bf[_0x8809('0x12')];this[_0x8809('0x10')]=_0x1a11bf[_0x8809('0x10')];this[_0x8809('0x11')]=_0x1a11bf['countagentrejectretry'];this[_0x8809('0x9')]=_0x1a11bf[_0x8809('0x9')];this['calleridname']=_0x1a11bf[_0x8809('0x13')];this[_0x8809('0x14')]=_0x1a11bf['calleridnum'];this[_0x8809('0x15')]=_0x1a11bf[_0x8809('0x15')];this[_0x8809('0x16')]=_0x1a11bf[_0x8809('0x16')];this[_0x8809('0x17')]=_0x1a11bf['responsetime'];this['ringtime']=_0x1a11bf[_0x8809('0x18')]||0x0;this[_0x8809('0x19')]=_0x1a11bf[_0x8809('0x19')]||0x0;this[_0x8809('0x1a')]=_0x1a11bf[_0x8809('0x1a')]||0x0;this[_0x8809('0x1b')]=_0x1a11bf[_0x8809('0x1b')];this[_0x8809('0x1c')]=_0x1a11bf[_0x8809('0x1c')];this[_0x8809('0x1d')]=_0x1a11bf[_0x8809('0x1d')];this[_0x8809('0x1e')]=_0x1a11bf[_0x8809('0x1e')];this['ContactId']=_0x1a11bf['ContactId'];this[_0x8809('0x1f')]=_0x1a11bf[_0x8809('0x1f')];this['UserId']=_0x1a11bf['UserId'];this['VoiceQueueId']=_0x1a11bf[_0x8809('0x20')];this[_0x8809('0x21')]=_0x1a11bf[_0x8809('0x21')];this[_0x8809('0x22')]=_0x1a11bf[_0x8809('0x22')]||'';this[_0x8809('0x23')]=_0x1a11bf[_0x8809('0x23')]||'';}module[_0x8809('0x24')]=Final; \ No newline at end of file +var _0xca9e=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','calleridname','calleridnum','responsetime','endtime','ringtime'];(function(_0x4f77f4,_0x302e98){var _0x2601e8=function(_0x2c107c){while(--_0x2c107c){_0x4f77f4['push'](_0x4f77f4['shift']());}};_0x2601e8(++_0x302e98);}(_0xca9e,0x136));var _0xeca9=function(_0x4553b5,_0x438958){_0x4553b5=_0x4553b5-0x0;var _0x30f611=_0xca9e[_0x4553b5];return _0x30f611;};'use strict';var util=require(_0xeca9('0x0'));var _=require(_0xeca9('0x1'));var moment=require(_0xeca9('0x2'));function getSeconds(_0x1c579d,_0x2df937){var _0x1443e3=moment(_0x1c579d)[_0xeca9('0x3')](0x0);var _0x2c6185=moment(_0x2df937)[_0xeca9('0x3')](0x0);return _0x1443e3[_0xeca9('0x4')](_0x2c6185,_0xeca9('0x5'));}function Final(_0x1c4ce6){this[_0xeca9('0x6')]=_0x1c4ce6[_0xeca9('0x6')];this['scheduledat']=_0x1c4ce6[_0xeca9('0x7')];this[_0xeca9('0x8')]=_0x1c4ce6['type'];this['campaigntype']=_0x1c4ce6[_0xeca9('0x8')]===_0xeca9('0x9')?_0xeca9('0xa'):_0x1c4ce6['type'];this[_0xeca9('0xb')]=_0x1c4ce6[_0xeca9('0xb')];this[_0xeca9('0xc')]=_0x1c4ce6[_0xeca9('0xc')];this[_0xeca9('0xd')]=_0x1c4ce6[_0xeca9('0xd')];this['countglobal']=_0x1c4ce6[_0xeca9('0xb')]+_0x1c4ce6[_0xeca9('0xc')]+_0x1c4ce6['countnoanswerretry']+_0x1c4ce6[_0xeca9('0xe')]+_0x1c4ce6['countdropretry']+_0x1c4ce6[_0xeca9('0xf')]+_0x1c4ce6[_0xeca9('0x10')]+_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xe')]=_0x1c4ce6[_0xeca9('0xe')];this[_0xeca9('0x11')]=_0x1c4ce6['countdropretry'];this[_0xeca9('0xf')]=_0x1c4ce6[_0xeca9('0xf')];this[_0xeca9('0x10')]=_0x1c4ce6[_0xeca9('0x10')];this['countagentrejectretry']=_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xa')]=_0x1c4ce6[_0xeca9('0xa')];this['calleridname']=_0x1c4ce6[_0xeca9('0x12')];this[_0xeca9('0x13')]=_0x1c4ce6['calleridnum'];this['starttime']=_0x1c4ce6['starttime'];this[_0xeca9('0x14')]=_0x1c4ce6[_0xeca9('0x14')];this[_0xeca9('0x15')]=_0x1c4ce6['responsetime'];this[_0xeca9('0x16')]=_0x1c4ce6['ringtime']||0x0;this['holdtime']=_0x1c4ce6[_0xeca9('0x17')]||0x0;this['talktime']=_0x1c4ce6[_0xeca9('0x18')]||0x0;this[_0xeca9('0x19')]=_0x1c4ce6['callback'];this[_0xeca9('0x1a')]=_0x1c4ce6[_0xeca9('0x1a')];this['callbackat']=_0x1c4ce6[_0xeca9('0x1b')];this['recallme']=_0x1c4ce6[_0xeca9('0x1c')];this[_0xeca9('0x1d')]=_0x1c4ce6[_0xeca9('0x1d')];this['ListId']=_0x1c4ce6[_0xeca9('0x1e')];this[_0xeca9('0x1f')]=_0x1c4ce6['UserId'];this[_0xeca9('0x20')]=_0x1c4ce6[_0xeca9('0x20')];this[_0xeca9('0x21')]=_0x1c4ce6[_0xeca9('0x21')];this['originatecalleridnum']=_0x1c4ce6[_0xeca9('0x22')]||'';this['originatecalleridname']=_0x1c4ce6[_0xeca9('0x23')]||'';}module[_0xeca9('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 2644937..13d5172 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb81f=['uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry'];(function(_0x50b93d,_0x5eb414){var _0x627353=function(_0x541987){while(--_0x541987){_0x50b93d['push'](_0x50b93d['shift']());}};_0x627353(++_0x5eb414);}(_0xb81f,0x68));var _0xfb81=function(_0xd80540,_0x23ef2){_0xd80540=_0xd80540-0x0;var _0x2df84d=_0xb81f[_0xd80540];return _0x2df84d;};'use strict';var util=require(_0xfb81('0x0'));var _=require('lodash');var moment=require(_0xfb81('0x1'));function getSeconds(_0x237c51,_0x46b575){var _0x4c148b=moment(_0x237c51)[_0xfb81('0x2')](0x0);var _0x48a388=moment(_0x46b575)['milliseconds'](0x0);return _0x4c148b[_0xfb81('0x3')](_0x48a388,_0xfb81('0x4'));}function Hangup(_0x111f28,_0x145e16){this[_0xfb81('0x5')]=0x4;this[_0xfb81('0x6')]=_0xfb81('0x7');this['scheduledat']=_0x111f28[_0xfb81('0x8')];this[_0xfb81('0x9')]=_0x111f28[_0xfb81('0x9')];this[_0xfb81('0xa')]=_0x111f28['type']===_0xfb81('0xb')?_0xfb81('0xc'):_0x111f28['type'];this[_0xfb81('0xd')]=_0x111f28[_0xfb81('0xd')];this['countcongestionretry']=_0x111f28[_0xfb81('0xe')];this['countnoanswerretry']=_0x111f28[_0xfb81('0xf')];this[_0xfb81('0x10')]=_0x111f28[_0xfb81('0xd')]+_0x111f28[_0xfb81('0xe')]+_0x111f28['countnoanswerretry']+_0x111f28[_0xfb81('0x11')]+_0x111f28['countdropretry']+_0x111f28['countabandonedretry']+_0x111f28[_0xfb81('0x12')]+_0x111f28[_0xfb81('0x13')];this[_0xfb81('0x11')]=_0x111f28[_0xfb81('0x11')];this[_0xfb81('0x14')]=_0x111f28[_0xfb81('0x14')];this[_0xfb81('0x15')]=_0x111f28['countabandonedretry'];this['countmachineretry']=_0x111f28[_0xfb81('0x12')];this['countagentrejectretry']=_0x111f28['countagentrejectretry'];this['uniqueid']=_0x145e16[_0xfb81('0x16')];this[_0xfb81('0x17')]=_0x111f28[_0xfb81('0x18')];this['calleridnum']=_0x111f28[_0xfb81('0x19')];this['starttime']=_0x111f28[_0xfb81('0x1a')];this[_0xfb81('0x1b')]=_0x111f28['responsetime'];this[_0xfb81('0x1c')]=moment()['format'](_0xfb81('0x1d'));this[_0xfb81('0x1e')]=getSeconds(_0x111f28['responsetime'],_0x111f28['starttime']);this[_0xfb81('0x1f')]=0x0;this['talktime']=getSeconds(this[_0xfb81('0x1c')],_0x111f28[_0xfb81('0x1b')]);this[_0xfb81('0xc')]=_0x111f28[_0xfb81('0xc')];this[_0xfb81('0x20')]=_0xfb81('0x21');this['reason']=_0x145e16['cause-txt'];this[_0xfb81('0x22')]=_0x111f28[_0xfb81('0x22')];this[_0xfb81('0x23')]=_0x111f28[_0xfb81('0x23')];this[_0xfb81('0x24')]=_0x111f28[_0xfb81('0x24')];this[_0xfb81('0x25')]=_0x111f28[_0xfb81('0x25')];this['ContactId']=_0x111f28[_0xfb81('0x26')];this[_0xfb81('0x27')]=_0x111f28[_0xfb81('0x27')];this[_0xfb81('0x28')]=_0x111f28[_0xfb81('0x28')];this['VoiceQueueId']=_0x111f28['VoiceQueueId'];this[_0xfb81('0x29')]=_0x111f28[_0xfb81('0x29')];}module['exports']=Hangup; \ No newline at end of file +var _0xea0d=['uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','holdtime','membername','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x13f64e,_0x1d1626){var _0x395f6c=function(_0x516bc0){while(--_0x516bc0){_0x13f64e['push'](_0x13f64e['shift']());}};_0x395f6c(++_0x1d1626);}(_0xea0d,0x115));var _0xdea0=function(_0x2211b2,_0x3c32a7){_0x2211b2=_0x2211b2-0x0;var _0x1ff209=_0xea0d[_0x2211b2];return _0x1ff209;};'use strict';var util=require(_0xdea0('0x0'));var _=require('lodash');var moment=require(_0xdea0('0x1'));function getSeconds(_0x23b0a8,_0x26091b){var _0x25119f=moment(_0x23b0a8)[_0xdea0('0x2')](0x0);var _0x30276a=moment(_0x26091b)[_0xdea0('0x2')](0x0);return _0x25119f[_0xdea0('0x3')](_0x30276a,_0xdea0('0x4'));}function Hangup(_0x20d78b,_0x254014){this['state']=0x4;this[_0xdea0('0x5')]='Answer';this[_0xdea0('0x6')]=_0x20d78b[_0xdea0('0x6')];this[_0xdea0('0x7')]=_0x20d78b[_0xdea0('0x7')];this['campaigntype']=_0x20d78b[_0xdea0('0x7')]===_0xdea0('0x8')?_0xdea0('0x9'):_0x20d78b[_0xdea0('0x7')];this[_0xdea0('0xa')]=_0x20d78b[_0xdea0('0xa')];this['countcongestionretry']=_0x20d78b['countcongestionretry'];this[_0xdea0('0xb')]=_0x20d78b['countnoanswerretry'];this[_0xdea0('0xc')]=_0x20d78b[_0xdea0('0xa')]+_0x20d78b[_0xdea0('0xd')]+_0x20d78b[_0xdea0('0xb')]+_0x20d78b[_0xdea0('0xe')]+_0x20d78b['countdropretry']+_0x20d78b[_0xdea0('0xf')]+_0x20d78b[_0xdea0('0x10')]+_0x20d78b[_0xdea0('0x11')];this[_0xdea0('0xe')]=_0x20d78b[_0xdea0('0xe')];this[_0xdea0('0x12')]=_0x20d78b[_0xdea0('0x12')];this[_0xdea0('0xf')]=_0x20d78b[_0xdea0('0xf')];this[_0xdea0('0x10')]=_0x20d78b[_0xdea0('0x10')];this[_0xdea0('0x11')]=_0x20d78b[_0xdea0('0x11')];this[_0xdea0('0x13')]=_0x254014[_0xdea0('0x13')];this[_0xdea0('0x14')]=_0x20d78b[_0xdea0('0x15')];this[_0xdea0('0x16')]=_0x20d78b['number'];this[_0xdea0('0x17')]=_0x20d78b[_0xdea0('0x17')];this['responsetime']=_0x20d78b[_0xdea0('0x18')];this[_0xdea0('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x20d78b['responsetime'],_0x20d78b[_0xdea0('0x17')]);this[_0xdea0('0x1a')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x20d78b[_0xdea0('0x18')]);this[_0xdea0('0x9')]=_0x20d78b[_0xdea0('0x9')];this[_0xdea0('0x1b')]='IVR';this['reason']=_0x254014[_0xdea0('0x1c')];this[_0xdea0('0x1d')]=_0x20d78b[_0xdea0('0x1d')];this[_0xdea0('0x1e')]=_0x20d78b[_0xdea0('0x1e')];this['callbackat']=_0x20d78b['callbackat'];this[_0xdea0('0x1f')]=_0x20d78b[_0xdea0('0x1f')];this[_0xdea0('0x20')]=_0x20d78b[_0xdea0('0x20')];this['ListId']=_0x20d78b[_0xdea0('0x21')];this[_0xdea0('0x22')]=_0x20d78b[_0xdea0('0x22')];this['VoiceQueueId']=_0x20d78b[_0xdea0('0x23')];this[_0xdea0('0x24')]=_0x20d78b['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ae15cc4..ac3b070 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78f5=['CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId'];(function(_0x4ee508,_0xec5ce8){var _0x37981d=function(_0x3b857c){while(--_0x3b857c){_0x4ee508['push'](_0x4ee508['shift']());}};_0x37981d(++_0xec5ce8);}(_0x78f5,0xbc));var _0x578f=function(_0x5c9d6e,_0x1f4b05){_0x5c9d6e=_0x5c9d6e-0x0;var _0x2c69d2=_0x78f5[_0x5c9d6e];return _0x2c69d2;};'use strict';var util=require(_0x578f('0x0'));var _=require(_0x578f('0x1'));var moment=require(_0x578f('0x2'));function getSeconds(_0x408f44,_0x15ebce){var _0x15b085=moment(_0x408f44)[_0x578f('0x3')](0x0);var _0x5030b2=moment(_0x15ebce)[_0x578f('0x3')](0x0);return _0x15b085[_0x578f('0x4')](_0x5030b2,_0x578f('0x5'));}function History(_0x54f87f){this['uniqueid']=_0x54f87f[_0x578f('0x6')];this['scheduledat']=_0x54f87f[_0x578f('0x7')]||undefined;this[_0x578f('0x8')]=_0x54f87f[_0x578f('0x8')];this[_0x578f('0x9')]=_0x54f87f[_0x578f('0x8')]==='outbound'?_0x578f('0xa'):_0x54f87f[_0x578f('0x8')];this[_0x578f('0xb')]=_0x54f87f[_0x578f('0xb')];this[_0x578f('0xc')]=_0x54f87f[_0x578f('0xc')];this[_0x578f('0xd')]=_0x54f87f[_0x578f('0xd')];this[_0x578f('0xe')]=_0x54f87f[_0x578f('0xb')]+_0x54f87f['countcongestionretry']+_0x54f87f[_0x578f('0xd')]+_0x54f87f[_0x578f('0xf')]+_0x54f87f[_0x578f('0x10')]+_0x54f87f[_0x578f('0x11')]+_0x54f87f['countmachineretry']+_0x54f87f['countagentrejectretry'];this[_0x578f('0xf')]=_0x54f87f['countnosuchnumberretry'];this[_0x578f('0x10')]=_0x54f87f[_0x578f('0x10')];this[_0x578f('0x11')]=_0x54f87f[_0x578f('0x11')];this[_0x578f('0x12')]=_0x54f87f[_0x578f('0x12')];this[_0x578f('0x13')]=_0x54f87f[_0x578f('0x13')];this[_0x578f('0xa')]=_0x54f87f[_0x578f('0xa')];this[_0x578f('0x14')]=_0x54f87f[_0x578f('0x15')];this[_0x578f('0x16')]=_0x54f87f[_0x578f('0x17')];this[_0x578f('0x18')]=_0x54f87f[_0x578f('0x18')];this[_0x578f('0x19')]=_0x54f87f[_0x578f('0x19')];this['endtime']=_0x54f87f[_0x578f('0x19')];this['ringtime']=getSeconds(_0x54f87f['responsetime'],_0x54f87f[_0x578f('0x18')]);this[_0x578f('0x1a')]=0x0;this[_0x578f('0x1b')]=0x0;this['callback']=_0x54f87f[_0x578f('0x1c')];this['callbackuniqueid']=_0x54f87f[_0x578f('0x1d')];this[_0x578f('0x1e')]=_0x54f87f['callbackat'];this['recallme']=_0x54f87f['recallme'];this['ContactId']=_0x54f87f['ContactId'];this[_0x578f('0x1f')]=_0x54f87f[_0x578f('0x1f')];this[_0x578f('0x20')]=_0x54f87f[_0x578f('0x20')];this[_0x578f('0x21')]=_0x54f87f['VoiceQueueId'];this['CampaignId']=_0x54f87f[_0x578f('0x22')];this['originatecalleridnum']=_0x54f87f['originatecalleridnum']||'';this[_0x578f('0x23')]=_0x54f87f[_0x578f('0x23')]||'';}module[_0x578f('0x24')]=History; \ No newline at end of file +var _0x21c9=['uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','util','lodash','moment','milliseconds'];(function(_0x285031,_0x5d540a){var _0x19db6a=function(_0x5a5d98){while(--_0x5a5d98){_0x285031['push'](_0x285031['shift']());}};_0x19db6a(++_0x5d540a);}(_0x21c9,0x8c));var _0x921c=function(_0x893f58,_0x4e1e18){_0x893f58=_0x893f58-0x0;var _0xf04bf7=_0x21c9[_0x893f58];return _0xf04bf7;};'use strict';var util=require(_0x921c('0x0'));var _=require(_0x921c('0x1'));var moment=require(_0x921c('0x2'));function getSeconds(_0x2fc518,_0x1939c4){var _0x5da556=moment(_0x2fc518)[_0x921c('0x3')](0x0);var _0x1f20dc=moment(_0x1939c4)[_0x921c('0x3')](0x0);return _0x5da556['diff'](_0x1f20dc,'seconds');}function History(_0x40473f){this['uniqueid']=_0x40473f[_0x921c('0x4')];this['scheduledat']=_0x40473f['scheduledat']||undefined;this[_0x921c('0x5')]=_0x40473f[_0x921c('0x5')];this[_0x921c('0x6')]=_0x40473f[_0x921c('0x5')]===_0x921c('0x7')?_0x921c('0x8'):_0x40473f[_0x921c('0x5')];this[_0x921c('0x9')]=_0x40473f[_0x921c('0x9')];this[_0x921c('0xa')]=_0x40473f[_0x921c('0xa')];this[_0x921c('0xb')]=_0x40473f[_0x921c('0xb')];this[_0x921c('0xc')]=_0x40473f['countbusyretry']+_0x40473f[_0x921c('0xa')]+_0x40473f[_0x921c('0xb')]+_0x40473f['countnosuchnumberretry']+_0x40473f['countdropretry']+_0x40473f[_0x921c('0xd')]+_0x40473f[_0x921c('0xe')]+_0x40473f[_0x921c('0xf')];this[_0x921c('0x10')]=_0x40473f[_0x921c('0x10')];this[_0x921c('0x11')]=_0x40473f[_0x921c('0x11')];this[_0x921c('0xd')]=_0x40473f[_0x921c('0xd')];this[_0x921c('0xe')]=_0x40473f[_0x921c('0xe')];this[_0x921c('0xf')]=_0x40473f['countagentrejectretry'];this[_0x921c('0x8')]=_0x40473f[_0x921c('0x8')];this[_0x921c('0x12')]=_0x40473f[_0x921c('0x13')];this[_0x921c('0x14')]=_0x40473f[_0x921c('0x15')];this[_0x921c('0x16')]=_0x40473f[_0x921c('0x16')];this[_0x921c('0x17')]=_0x40473f[_0x921c('0x17')];this['endtime']=_0x40473f[_0x921c('0x17')];this[_0x921c('0x18')]=getSeconds(_0x40473f['responsetime'],_0x40473f[_0x921c('0x16')]);this[_0x921c('0x19')]=0x0;this[_0x921c('0x1a')]=0x0;this['callback']=_0x40473f[_0x921c('0x1b')];this[_0x921c('0x1c')]=_0x40473f[_0x921c('0x1c')];this[_0x921c('0x1d')]=_0x40473f[_0x921c('0x1d')];this[_0x921c('0x1e')]=_0x40473f[_0x921c('0x1e')];this[_0x921c('0x1f')]=_0x40473f['ContactId'];this[_0x921c('0x20')]=_0x40473f[_0x921c('0x20')];this[_0x921c('0x21')]=_0x40473f[_0x921c('0x21')];this['VoiceQueueId']=_0x40473f['VoiceQueueId'];this['CampaignId']=_0x40473f[_0x921c('0x22')];this['originatecalleridnum']=_0x40473f['originatecalleridnum']||'';this['originatecalleridname']=_0x40473f['originatecalleridname']||'';}module[_0x921c('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e06d9bb..5b79205 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 _0x07ec=['updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','inspect','emptyContact','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','membername','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countglobal','countbusyretry','countnosuchnumberretry','[syncHangupIvr][createHistory]','[syncHangupIvr]','AGI','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','booked','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','stateGlobal','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','outboundQueuePauses','[CatchErlangB]','check\x20failure','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','tryOriginatePredictive','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','m\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','prototype','clearZombieChannels','uniqueId','[uniqueid]','isNil','Action','status','channel','catch'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x07ec,0x166));var _0xc07e=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x07ec[_0x32b993];return _0x482780;};'use strict';var util=require(_0xc07e('0x0'));var _=require(_0xc07e('0x1'));var BPromise=require(_0xc07e('0x2'));var uuid=require(_0xc07e('0x3'));var moment=require(_0xc07e('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xc07e('0x5'))(_0xc07e('0x6'));var loggerBooked=require(_0xc07e('0x5'))('booked');var loggerPredictive=require(_0xc07e('0x5'))(_0xc07e('0x7'));var loggerPredictiveCalls=require(_0xc07e('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xc07e('0x5'))(_0xc07e('0x8'));var ami=require(_0xc07e('0x9'));config['redis']=_[_0xc07e('0xa')](config['redis'],{'host':_0xc07e('0xb'),'port':0x18eb});var io=require(_0xc07e('0xc'))(new Redis(config[_0xc07e('0xd')]));var cmHopper=require(_0xc07e('0xe'));var cmHopperHistory=require(_0xc07e('0xf'));var cmHopperBlack=require(_0xc07e('0x10'));var voiceQueueRt=require(_0xc07e('0x11'));var RpcSetting=require(_0xc07e('0x12'));var Action=require(_0xc07e('0x13'));var History=require(_0xc07e('0x14'));var Final=require('./final');var AgentComplete=require(_0xc07e('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xc07e('0x16'));var ipAgi=process[_0xc07e('0x17')][_0xc07e('0x18')]||_0xc07e('0x19');var strategy={'rrmemory':_0xc07e('0x1a'),'roundrobin':_0xc07e('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xc07e('0x1c')]=function(_0x2146e1){this['tail']=this['tail']?this[_0xc07e('0x1d')]['finally'](_0x2146e1):_0x2146e1();};function Dialer(_0x4669f0,_0x27ff65){this[_0xc07e('0x1e')]=new Sequence();this[_0xc07e('0x1f')]=_0x27ff65;this[_0xc07e('0x20')]=_0x4669f0[_0xc07e('0x20')];this[_0xc07e('0x21')]=_0x4669f0[_0xc07e('0x21')];this[_0xc07e('0x22')]=_0x4669f0[_0xc07e('0x22')];this[_0xc07e('0x23')]=_0x4669f0[_0xc07e('0x23')];this['maxNumberOriginate']=config[_0xc07e('0x24')]||0x2;this[_0xc07e('0x25')]={};this[_0xc07e('0x26')]={};this[_0xc07e('0x27')]={};this['uniqueId']={};this['optionPredictive']={};this[_0xc07e('0x28')]={};this[_0xc07e('0x29')]={};this['ivrOriginated']={};this[_0xc07e('0x2a')]={};this[_0xc07e('0x2b')]={};ami['on'](_0xc07e('0x2c'),this[_0xc07e('0x2d')][_0xc07e('0x2e')](this));ami['on'](_0xc07e('0x2f'),this[_0xc07e('0x30')][_0xc07e('0x2e')](this));ami['on'](_0xc07e('0x31'),this[_0xc07e('0x32')]['bind'](this));ami['on'](_0xc07e('0x33'),this[_0xc07e('0x34')][_0xc07e('0x2e')](this));ami['on']('custom:queuesummary',this[_0xc07e('0x8')]['bind'](this));ami['on']('hangup',this[_0xc07e('0x35')][_0xc07e('0x2e')](this));ami['on'](_0xc07e('0x36'),this[_0xc07e('0x37')]['bind'](this));ami['on'](_0xc07e('0x38'),this[_0xc07e('0x39')][_0xc07e('0x2e')](this));ami['on'](_0xc07e('0x3a'),this[_0xc07e('0x3b')][_0xc07e('0x2e')](this));ami['on'](_0xc07e('0x3c'),this[_0xc07e('0x3d')][_0xc07e('0x2e')](this));this[_0xc07e('0x3e')]();this[_0xc07e('0x3f')]();RpcSetting[_0xc07e('0x40')]()[_0xc07e('0x41')](function(_0x20d96e){previewRecallmeReminderInterval=_0x20d96e[_0xc07e('0x42')];});}function isNotNull(_0x50662c){return _0x50662c!==null&&!_[_0xc07e('0x43')](_0x50662c);}function checkIsLoggedIn(_0x239bc0,_0x11efa3){return function(){if(_0x11efa3<=0x0){_0x239bc0[_0xc07e('0x44')]=_0xc07e('0x45');throw _0x239bc0[_0xc07e('0x46')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x44788b){return _0x44788b;}function checkIsActive(_0x460850,_0x441c50){return function(){if(!isActive(_0x441c50)){_0x460850[_0xc07e('0x44')]=_0xc07e('0x47');throw _0x460850[_0xc07e('0x46')]+_0xc07e('0x48');}};}function checkInterval(_0x4b4ccf){return function(){if(!isNotNull(_0x4b4ccf[_0xc07e('0x49')])){_0x4b4ccf[_0xc07e('0x44')]='INTERVAL_IS_NULL';throw _0x4b4ccf[_0xc07e('0x46')]+_0xc07e('0x4a');}if(!isNotNull(_0x4b4ccf[_0xc07e('0x49')]['Intervals'])){_0x4b4ccf[_0xc07e('0x44')]=_0xc07e('0x4b');throw _0x4b4ccf['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xc07e('0x4c')](_0x4b4ccf[_0xc07e('0x49')][_0xc07e('0x4d')]))){_0x4b4ccf[_0xc07e('0x44')]=_0xc07e('0x4b');throw _0x4b4ccf['name']+_0xc07e('0x4a');}};}function msgResponse(_0x3e8eab,_0x4029fa,_0x157e80){return{'action':_0x3e8eab,'response':_0x4029fa,'message':_0x157e80,'stack':_0x157e80};}function myreject(_0x20de86){return function(_0x53dd2e){return _0x20de86(msgResponse(_0xc07e('0x4e'),_0xc07e('0x4f'),JSON['stringify'](_0x53dd2e)));};}function getSeconds(_0x4a99b5,_0x6cd360){var _0x28383d=moment(_0x4a99b5)[_0xc07e('0x50')](0x0);var _0x57aff2=moment(_0x6cd360)[_0xc07e('0x50')](0x0);return _0x28383d[_0xc07e('0x51')](_0x57aff2,_0xc07e('0x52'));}function emit(_0x39897d,_0x3a2631,_0x549242){io['to'](_0x39897d)[_0xc07e('0x53')](_0x3a2631,_0x549242);}function emitVoiceQueueSummary(_0xa8e485){if(_0xa8e485[_0xc07e('0x54')]===_0xc07e('0x55')){var _0x53fa6b={'id':_0xa8e485['id'],'name':_0xa8e485[_0xc07e('0x46')],'strategy':_0xa8e485[_0xc07e('0x56')],'answered':_0xa8e485[_0xc07e('0x57')],'available':_0xa8e485[_0xc07e('0x58')],'loggedIn':_0xa8e485[_0xc07e('0x59')],'pTalking':_0xa8e485[_0xc07e('0x5a')],'sumBillable':_0xa8e485[_0xc07e('0x5b')],'sumDuration':_0xa8e485[_0xc07e('0x5c')],'sumHoldTime':_0xa8e485[_0xc07e('0x5d')]||0x0,'talking':_0xa8e485[_0xc07e('0x5e')],'total':_0xa8e485[_0xc07e('0x5f')],'type':_0xa8e485[_0xc07e('0x54')],'unmanaged':_0xa8e485[_0xc07e('0x60')],'abandoned':_0xa8e485[_0xc07e('0x61')],'waiting':_0xa8e485[_0xc07e('0x62')],'loggedInDb':_0xa8e485['loggedInDb'],'dialActive':_0xa8e485[_0xc07e('0x63')],'dialMethod':_0xa8e485[_0xc07e('0x64')],'dialOriginateCallerIdName':_0xa8e485[_0xc07e('0x65')],'dialOriginateCallerIdNumber':_0xa8e485[_0xc07e('0x66')],'dialOriginateTimeout':_0xa8e485['dialOriginateTimeout'],'dialPrefix':_0xa8e485[_0xc07e('0x67')],'outboundAnswerAgiCallsDay':_0xa8e485['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xa8e485[_0xc07e('0x68')],'outboundBlacklistCallsDay':_0xa8e485[_0xc07e('0x69')],'outboundBusyCallsDay':_0xa8e485[_0xc07e('0x6a')],'outboundCongestionCallsDay':_0xa8e485[_0xc07e('0x6b')],'outboundDropCallsDayACS':_0xa8e485[_0xc07e('0x6c')],'outboundDropCallsDayCallersExit':_0xa8e485[_0xc07e('0x6d')],'outboundDropCallsDayTimeout':_0xa8e485[_0xc07e('0x6e')],'outboundNoAnswerCallsDay':_0xa8e485[_0xc07e('0x6f')],'outboundNoSuchCallsDay':_0xa8e485[_0xc07e('0x70')],'outboundOriginateFailureCallsDay':_0xa8e485['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xa8e485[_0xc07e('0x71')],'outboundRejectCallsDay':_0xa8e485[_0xc07e('0x72')],'outboundUnknownCallsDay':_0xa8e485[_0xc07e('0x73')],'predictiveIntervalAnsweredCalls':_0xa8e485[_0xc07e('0x74')],'predictiveIntervalAvgHoldtime':_0xa8e485[_0xc07e('0x75')],'predictiveIntervalAvgTalktime':_0xa8e485[_0xc07e('0x76')],'predictiveIntervalDroppedCallsCallersExit':_0xa8e485[_0xc07e('0x77')],'predictiveIntervalDroppedCallsTimeout':_0xa8e485[_0xc07e('0x78')],'predictiveIntervalErlangCalls':_0xa8e485[_0xc07e('0x79')],'predictiveIntervalErlangCallsDroppedCalls':_0xa8e485[_0xc07e('0x7a')],'predictiveIntervalHitRate':_0xa8e485[_0xc07e('0x7b')],'predictiveIntervalMultiplicativeFactor':_0xa8e485['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xa8e485[_0xc07e('0x7c')],'predictiveIntervalAvailable':_0xa8e485[_0xc07e('0x7d')],'predictiveIntervalTotalCalls':_0xa8e485[_0xc07e('0x7e')],'message':_0xa8e485['message'],'originated':_0xa8e485[_0xc07e('0x7f')],'erlangCalls':_0xa8e485[_0xc07e('0x80')],'erlangCallToSecond':_0xa8e485['erlangCallToSecond'],'erlangAbandonmentRate':_0xa8e485['erlangAbandonmentRate'],'erlangBusyFactor':_0xa8e485['erlangBusyFactor'],'startPredictive':_0xa8e485['startPredictive'],'startProgressive':_0xa8e485[_0xc07e('0x29')]};if(_0xa8e485[_0xc07e('0x81')]){_0x53fa6b['Trunk']={'id':_0xa8e485[_0xc07e('0x81')]['id'],'name':_0xa8e485[_0xc07e('0x81')][_0xc07e('0x46')],'active':_0xa8e485[_0xc07e('0x81')][_0xc07e('0x82')],'callerid':_0xa8e485[_0xc07e('0x81')][_0xc07e('0x83')]};}if(_0xa8e485['Interval']){_0x53fa6b[_0xc07e('0x49')]={'id':_0xa8e485[_0xc07e('0x49')]['id'],'name':_0xa8e485['Interval'][_0xc07e('0x46')]};}var _0x34402b=md5(JSON[_0xc07e('0x84')](_0x53fa6b));if(_0xa8e485['md5']!==_0x34402b){_0xa8e485['md5']=_0x34402b;emit(util[_0xc07e('0x85')](_0xc07e('0x86'),_0x53fa6b[_0xc07e('0x46')]),_0xc07e('0x87'),_0x53fa6b);}}}function emitCampaignSummary(_0x878116){if(_0x878116['type']===_0xc07e('0x88')){emit(util['format']('campaign:ivr:%s',_0x878116[_0xc07e('0x46')]),_0xc07e('0x89'),_0x878116);}}function checkGetDataPredictive(_0x4ed141){if(isNotNull(_0x4ed141)&&!_[_0xc07e('0x4c')](_0x4ed141)){loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x8b'));loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x8c'),_0x4ed141[_0xc07e('0x7e')]);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x8d'),_0x4ed141['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xc07e('0x8e'),_0x4ed141[_0xc07e('0x78')]);loggerPredictive[_0xc07e('0x8a')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ed141[_0xc07e('0x77')]);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x8f'),_0x4ed141[_0xc07e('0x75')]);loggerPredictive['info'](_0xc07e('0x90'),_0x4ed141[_0xc07e('0x76')]);loggerPredictive['info'](_0xc07e('0x91'));if(_0x4ed141[_0xc07e('0x7e')]>0x0){if(!_[_0xc07e('0x43')](_0x4ed141[_0xc07e('0x76')])&&_0x4ed141['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xc07e('0x92'));if(!_[_0xc07e('0x43')](_0x4ed141[_0xc07e('0x75')])&&_0x4ed141[_0xc07e('0x75')]>0x0){return!![];}loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x93'));}else{loggerPredictive[_0xc07e('0x8a')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xc07e('0x8a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x28bb80){return function(_0x1fe129){loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x94'));loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x95'),_0x1fe129[_0xc07e('0x80')]);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x96'),_0x1fe129['erlangCallToSecond']);loggerPredictive[_0xc07e('0x8a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fe129[_0xc07e('0x97')]);loggerPredictive['info'](_0xc07e('0x98'),_0x1fe129[_0xc07e('0x99')]);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x9a'),_0x1fe129['erlangAbandonmentRate']);loggerPredictive[_0xc07e('0x8a')]('---------------------------');_[_0xc07e('0x9b')](_0x28bb80,_0x1fe129);};}function getDiff(_0x395555){var _0x46835d=moment()[_0xc07e('0x50')](0x0);var _0x4041fb=moment(_0x395555)['milliseconds'](0x0);return _0x46835d[_0xc07e('0x51')](_0x4041fb,_0xc07e('0x52'));}function ifInterval(_0x4a8293,_0x13f07f){if(_[_0xc07e('0x43')](_0x13f07f)){return![];}return getDiff(_0x13f07f)<_0x4a8293*0x3c;}function freeVariablesPredictive(_0x390a55){if(isNotNull(_0x390a55)){if(!_[_0xc07e('0x43')](_0x390a55['startProgressive'])){_0x390a55[_0xc07e('0x29')]=undefined;loggerPredictive[_0xc07e('0x8a')](_0x390a55[_0xc07e('0x46')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xc07e('0x43')](_0x390a55[_0xc07e('0x28')])){_0x390a55[_0xc07e('0x28')]=undefined;loggerPredictive[_0xc07e('0x8a')](_0x390a55[_0xc07e('0x46')],_0xc07e('0x9c'));}if(!_[_0xc07e('0x43')](_0x390a55[_0xc07e('0x9d')])){clearInterval(_0x390a55[_0xc07e('0x9d')]);_0x390a55[_0xc07e('0x9d')]=undefined;loggerPredictive[_0xc07e('0x8a')](_0x390a55['name'],_0xc07e('0x9e'));}}}function erlangb(_0x505cdd,_0x256053){if(_0x256053===0x0){return 0x0;}var _0x2cedd2=0x1;for(var _0x561fe0=0x1;_0x561fe0<=_0x256053;_0x561fe0+=0x1){_0x2cedd2=0x1+_0x2cedd2*_0x561fe0/_0x505cdd;}return 0x1/_0x2cedd2;}function isVoiceQueueOutbound(_0xb51911){return _0xb51911===_0xc07e('0x55');}function isNotPreview(_0x448991){return _0x448991!==_0xc07e('0x1f');}function isCampaignIvr(_0x23979c){return _0x23979c===_0xc07e('0x88');}function getCallerId(_0x4d4113,_0x23bc88,_0x3aad4a){if(!_[_0xc07e('0x43')](_0x3aad4a)&&typeof _0x3aad4a==='string'&&!_[_0xc07e('0x4c')](_0x3aad4a)){if(!_[_0xc07e('0x43')](_0x23bc88)&&typeof _0x23bc88===_0xc07e('0x9f')&&!_[_0xc07e('0x4c')](_0x23bc88)){return util[_0xc07e('0x85')]('\x22%s\x22\x20<%s>',_0x23bc88,_0x3aad4a);}return util[_0xc07e('0x85')](_0xc07e('0xa0'),_0x3aad4a,_0x3aad4a);}if(!_[_0xc07e('0x43')](_0x4d4113)&&typeof _0x4d4113===_0xc07e('0x9f')&&!_[_0xc07e('0x4c')](_0x4d4113)){return _0x4d4113;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2cb578,_0x21df3e){return function(_0x499fb6){freeVariablesPredictive(_0x21df3e);emitVoiceQueueSummary(_0x21df3e);emitCampaignSummary(_0x21df3e);loggerSyncQueueSummary[_0xc07e('0xa1')](_0x2cb578,util['inspect'](_0x499fb6,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3d948f,_0xa6fa7e){return function(_0x4fc07e){loggerPredictive[_0xc07e('0xa1')](_0xa6fa7e[_0xc07e('0x46')],_0x3d948f);loggerPredictive['error'](_0x4fc07e[_0xc07e('0xa2')]);freeVariablesPredictive(_0xa6fa7e);};}function loggerCatch(_0x25f72f){return function(_0x195c01){logger[_0xc07e('0xa1')](_0x25f72f,util['inspect'](_0x195c01,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x10bfd9){return _0x10bfd9&&!_[_0xc07e('0x43')](_0x10bfd9)&&_0x10bfd9[_0xc07e('0xa3')]>0x0;}function decremetOriginate(_0x2fce34){if(!_[_0xc07e('0x43')](_0x2fce34)&&_0x2fce34!==null){if(typeof _0x2fce34['originated']!==_0xc07e('0xa4')){if(_0x2fce34[_0xc07e('0x7f')]>0x0){_0x2fce34[_0xc07e('0x7f')]-=0x1;}else{logger[_0xc07e('0xa1')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xc07e('0xa1')](_0xc07e('0xa5'));}}function checkContactLowerLimitOriginate(_0x413545,_0x55cee5,_0x312835){if(_0x55cee5>_0x312835){for(var _0x252f38=0x0;_0x252f38<_0x55cee5-_0x312835;_0x252f38+=0x1){decremetOriginate(_0x413545);}}}function loggerGetContactDialer(_0x1fd404,_0x5cb543,_0x5c28af){return function(_0x2daa7e){checkContactLowerLimitOriginate(_0x5cb543,_0x5c28af,0x0);logger['error'](_0x1fd404,util['inspect'](_0x2daa7e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x44b8e5){return function(_0x117f59){if(isNotNull(_0x117f59)&&isNotNull(_0x117f59[0x0])){if(_0x117f59[0x0]['contactsRescheduled']>0x0){_0x44b8e5['message']=_0xc07e('0xa6');logger[_0xc07e('0x8a')]('[getContactDialer2][ReScheduled]'+_0x44b8e5[_0xc07e('0x46')],_0x117f59[0x0][_0xc07e('0xa7')],_0xc07e('0xa8'));}else{_0x44b8e5[_0xc07e('0x44')]=_0xc07e('0xa9');logger[_0xc07e('0x8a')](_0xc07e('0xaa')+_0x44b8e5[_0xc07e('0x46')]);}}};}function notSendMessagesQueue(_0x2ab3d8){if(_0x2ab3d8[_0xc07e('0xab')]){freeVariablesPredictive(_0x2ab3d8);if(_0x2ab3d8[_0xc07e('0x7f')]===0x0&&_0x2ab3d8[_0xc07e('0x5e')]===0x0&&_0x2ab3d8[_0xc07e('0x62')]===0x0&&(_0x2ab3d8[_0xc07e('0x5a')]||0x0)===0x0){_0x2ab3d8[_0xc07e('0xab')]=![];_0x2ab3d8[_0xc07e('0x58')]=0x0;_0x2ab3d8['message']=_0xc07e('0x47');loggerSyncQueueSummary[_0xc07e('0xa1')](_0xc07e('0xac'),_0x2ab3d8['name'],'is\x20not\x20active');}else{_0x2ab3d8[_0xc07e('0x44')]=_0xc07e('0xad');loggerSyncQueueSummary[_0xc07e('0xa1')](_0xc07e('0xac'),_0x2ab3d8[_0xc07e('0x46')],_0xc07e('0xae'));}emitVoiceQueueSummary(_0x2ab3d8);}}function notSendMessagesCampaign(_0x1f563f){if(_0x1f563f['sendMessageOneNotActive']){if(_0x1f563f['originated']===0x0){_0x1f563f['sendMessageOneNotActive']=![];_0x1f563f[_0xc07e('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xc07e('0xa1')](_0xc07e('0xaf'),_0x1f563f[_0xc07e('0x46')],_0xc07e('0xb0'));}else{_0x1f563f[_0xc07e('0x44')]=_0xc07e('0xad');loggerSyncQueueSummary['error'](_0xc07e('0xaf'),_0x1f563f[_0xc07e('0x46')],_0xc07e('0xae'));}emitCampaignSummary(_0x1f563f);}}function createObjHistory(_0x2bf025,_0x2e3e69,_0x1e4982,_0xba1150,_0x42a30e){_0x2bf025[_0xc07e('0x44')]=_0x1e4982;var _0x5e2f31=new Action(_0x2bf025,_0x2e3e69);var _0x500eca=new History(_0x5e2f31);_0x500eca[_0xc07e('0xb1')]=_0xba1150;_0x500eca[_0xc07e('0xb2')]=_0x42a30e;_0x500eca[_0xc07e('0xb3')]=_0x5e2f31[_0xc07e('0xb4')];return _0x500eca;}Dialer[_0xc07e('0xb5')][_0xc07e('0x3f')]=function(){var _0xf24c1a=this;setInterval(function(){_0xf24c1a[_0xc07e('0xb6')](_0xf24c1a[_0xc07e('0xb7')],_0xc07e('0xb8'));_0xf24c1a[_0xc07e('0xb6')](_0xf24c1a['actions'],'[actions]');},0x32c8);};Dialer[_0xc07e('0xb5')]['clearZombieChannels']=function(_0x4db308,_0x2c401d){var _0x22254d=this;for(var _0x21dbe3 in _0x4db308){if(typeof _0x4db308[_0x21dbe3]!==_0xc07e('0xa4')){this[_0xc07e('0x1e')][_0xc07e('0x1c')](function(){if(!_[_0xc07e('0xb9')](_0x4db308[_0x21dbe3])){return ami[_0xc07e('0xba')]({'action':_0xc07e('0xbb'),'channel':_0x4db308[_0x21dbe3][_0xc07e('0xbc')]})[_0xc07e('0xbd')](function(_0x2f51c5){if(_0x2f51c5[_0xc07e('0x44')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4db308[_0x21dbe3]&&_0x4db308[_0x21dbe3][_0xc07e('0x54')]!==_0xc07e('0x88')){_0x22254d[_0xc07e('0xbe')](_0x22254d['voiceQueues'][_0x4db308[_0x21dbe3][_0xc07e('0xbf')]]);logger[_0xc07e('0xa1')](_0xc07e('0xc0'),_0x2c401d,_0x21dbe3,_0x4db308[_0x21dbe3][_0xc07e('0xbf')]);delete _0x4db308[_0x21dbe3];}if(_0x4db308[_0x21dbe3]&&_0x4db308[_0x21dbe3][_0xc07e('0x54')]==='ivr'){_0x22254d[_0xc07e('0xbe')](_0x22254d[_0xc07e('0x21')][_0x4db308[_0x21dbe3][_0xc07e('0xbf')]]);logger[_0xc07e('0xa1')](_0xc07e('0xc1'),_0x2c401d,_0x21dbe3,_0x4db308[_0x21dbe3][_0xc07e('0xbf')]);delete _0x4db308[_0x21dbe3];}},0x2328);}});}});}}};Dialer[_0xc07e('0xb5')][_0xc07e('0xc2')]=function(_0x148c4b){return BPromise['resolve']()[_0xc07e('0x41')](cmHopper[_0xc07e('0xc2')](_0x148c4b))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xc07e('0xb5')][_0xc07e('0xc3')]=function(_0x201d95){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopperBlack['checkIsBlackList'](_0x201d95))[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xc5')));};Dialer[_0xc07e('0xb5')][_0xc07e('0xc6')]=function(_0x16018d){return BPromise['resolve']()[_0xc07e('0x41')](cmHopperBlack[_0xc07e('0xc6')](_0x16018d))['catch'](loggerCatch(_0xc07e('0xc7')));};Dialer[_0xc07e('0xb5')][_0xc07e('0xc8')]=function(_0xa2f1c5){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopperHistory[_0xc07e('0xc9')](_0xa2f1c5))[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xca')));};Dialer[_0xc07e('0xb5')][_0xc07e('0xcb')]=function(_0x84d1e4){return BPromise['resolve']()['then'](cmHopper[_0xc07e('0xcb')](_0x84d1e4))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xc07e('0xb5')][_0xc07e('0xcc')]=function(_0x56ebd2,_0x1ed04e,_0x1e0c12){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopper[_0xc07e('0xcc')](_0x56ebd2,_0x1ed04e,_0x1e0c12))[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xcd')));};Dialer[_0xc07e('0xb5')][_0xc07e('0xce')]=function(_0x4adcef,_0x2c5adf,_0x2f9a50,_0x1a0a9e,_0x576b1b){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopper[_0xc07e('0xce')](_0x4adcef,_0x2c5adf,_0x2f9a50,_0x1a0a9e))['catch'](function(_0x531614){_0x576b1b[_0xc07e('0xcf')]-=_0x2f9a50;_0x576b1b[_0xc07e('0xcf')]=_0x576b1b['temp']>0x0?_0x576b1b[_0xc07e('0xcf')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x531614);});};Dialer[_0xc07e('0xb5')][_0xc07e('0xd0')]=function(_0x90f435,_0xdf228d,_0x27c7b9,_0x3003fa){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopper[_0xc07e('0xd0')](_0x90f435,_0xdf228d,_0x27c7b9))['catch'](function(_0x2a9547){_0x3003fa[_0xc07e('0xcf')]-=_0xdf228d;_0x3003fa[_0xc07e('0xcf')]=_0x3003fa[_0xc07e('0xcf')]>0x0?_0x3003fa[_0xc07e('0xcf')]:0x0;loggerCatch(_0xc07e('0xd1'))(_0x2a9547);});};Dialer[_0xc07e('0xb5')]['getVoiceQueueRtPauses']=function(_0x2827b2){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](voiceQueueRt[_0xc07e('0xd2')](_0x2827b2))[_0xc07e('0xbd')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype']['moveContactManagedDialer']=function(_0x1cd656){return BPromise[_0xc07e('0xc4')]()['then'](cmHopper[_0xc07e('0xd3')](_0x1cd656))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xc07e('0xb5')]['createHistory']=function(_0x4e5895){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopperHistory[_0xc07e('0xd4')](_0x4e5895))[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xd5')));};Dialer[_0xc07e('0xb5')][_0xc07e('0xbe')]=function(_0x6046c){if(!_[_0xc07e('0x43')](_0x6046c)&&_0x6046c!==null){if(typeof _0x6046c[_0xc07e('0x7f')]!==_0xc07e('0xa4')){if(_0x6046c['originated']>0x0){_0x6046c[_0xc07e('0x7f')]-=0x1;}else{logger[_0xc07e('0xa1')](_0xc07e('0xd6'));}}}else{logger[_0xc07e('0xa1')](_0xc07e('0xd7'));}};Dialer[_0xc07e('0xb5')][_0xc07e('0xd8')]=function(_0x19615a,_0x5cb288){var _0x3bcb9c=this;return function(_0x2c1b1a){_0x3bcb9c[_0xc07e('0xbe')](_0x5cb288);logger[_0xc07e('0xa1')](_0x19615a,util[_0xc07e('0xd9')](_0x2c1b1a,{'showHidden':![],'depth':null}));};};Dialer[_0xc07e('0xb5')][_0xc07e('0xda')]=function(_0x5404ea,_0x263d5c,_0x389a68){var _0x3c9040={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x263d5c);this[_0xc07e('0xdb')](_[_0xc07e('0x9b')](_0x3c9040,_[_0xc07e('0xdc')](_0x389a68,['ContactId',_0xc07e('0xdd'),_0xc07e('0xde'),_0xc07e('0xdf'),_0xc07e('0xe0')])),_0xc07e('0xe1'),_0xc07e('0xe2'));logger[_0xc07e('0xa1')](_0x5404ea);};Dialer['prototype'][_0xc07e('0xe3')]=function(_0x2f61bb){return _0x2f61bb==='Success';};Dialer[_0xc07e('0xb5')][_0xc07e('0xe4')]=function(_0x8c3175){return!_[_0xc07e('0x43')](_0x8c3175)&&_0x8c3175&&!_[_0xc07e('0x43')](_0x8c3175[_0xc07e('0x46')])&&!_['isUndefined'](_0x8c3175[_0xc07e('0x82')])&&_0x8c3175[_0xc07e('0x82')]&&(this[_0xc07e('0x23')][util['format'](_0xc07e('0xe5'),_0x8c3175[_0xc07e('0x46')])][_0xc07e('0xbb')]===_0xc07e('0xe6')||this[_0xc07e('0x23')][util[_0xc07e('0x85')](_0xc07e('0xe5'),_0x8c3175[_0xc07e('0x46')])][_0xc07e('0xbb')]===_0xc07e('0xe7'));};Dialer[_0xc07e('0xb5')]['saveInDb']=function(_0x4c8a47,_0x359587,_0x46ec87){this[_0xc07e('0xd4')](_0x4c8a47)[_0xc07e('0xbd')](loggerCatch(_0x359587));this['moveContactManagedDialer'](_0x4c8a47)[_0xc07e('0xbd')](loggerCatch(_0x46ec87));};Dialer[_0xc07e('0xb5')][_0xc07e('0x39')]=function(_0x29c116){var _0x394135=this[_0xc07e('0xb7')][_0x29c116[_0xc07e('0xe8')]];var _0x4ef57d;if(!_[_0xc07e('0xb9')](_0x29c116)&&!_['isNil'](_0x29c116[_0xc07e('0xe9')])&&!_[_0xc07e('0xb9')](_0x29c116[_0xc07e('0xe9')][_0xc07e('0xea')])&&_0x29c116['exten']==='xcally-motion-dialer'&&_0x394135){if(_0x394135['type']!=='ivr'&&this[_0xc07e('0x20')][_0x394135['queue']]['dialAMDActive']&&_0x29c116[_0xc07e('0xeb')]===_0xc07e('0xec')){delete this[_0xc07e('0xb7')][_0x29c116[_0xc07e('0xe8')]];this[_0xc07e('0xbe')](this[_0xc07e('0x20')][_0x394135[_0xc07e('0xbf')]]);this[_0xc07e('0x20')][_0x394135[_0xc07e('0xbf')]][_0xc07e('0x68')]+=0x1;this['voiceQueues'][_0x394135[_0xc07e('0xbf')]][_0xc07e('0xed')]+=0x1;_0x4ef57d=new Hangup(_0x394135,_0x29c116);_0x4ef57d[_0xc07e('0xb1')]=0x12;_0x4ef57d['statedesc']=_0xc07e('0xee');_0x4ef57d['membername']=_0xc07e('0xef');ami[_0xc07e('0x53')](_0xc07e('0xf0'),ut[_0xc07e('0xf1')](_0x4ef57d,'amd'));this[_0xc07e('0xdb')](_0x4ef57d,_0xc07e('0xf2'),'[syncHangupInAMD]');}if(_0x394135[_0xc07e('0x54')]!==_0xc07e('0x88')&&this['voiceQueues'][_0x394135[_0xc07e('0xbf')]]['dialAMDActive']&&_0x29c116[_0xc07e('0xeb')]==='MACHINE'){var _0x1b59fc=this;return new BPromise(function(_0x1e6dd2,_0x42f9e9){delete _0x1b59fc['uniqueId'][_0x29c116['uniqueid']];_0x1b59fc[_0xc07e('0xbe')](_0x1b59fc['voiceQueues'][_0x394135[_0xc07e('0xbf')]]);_0x1b59fc['voiceQueues'][_0x394135[_0xc07e('0xbf')]][_0xc07e('0x68')]+=0x1;_0x1b59fc[_0xc07e('0x20')][_0x394135[_0xc07e('0xbf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x128f9b=_0x1b59fc[_0xc07e('0x20')][_0x394135['queue']];var _0x1f3355=new Hangup(_0x394135,_0x29c116);_0x1f3355[_0xc07e('0xb1')]=0x13;_0x1f3355['statedesc']='Machine';_0x1f3355[_0xc07e('0xf3')]=_0xc07e('0xef');_0x1f3355[_0xc07e('0xf4')]+=0x1;_0x1f3355['countglobal']+=0x1;_0x1f3355[_0xc07e('0xf5')]=!![];ami[_0xc07e('0x53')]('custom:amd',ut['buildObj'](_0x1f3355,_0xc07e('0xf5')));_0x1b59fc['createHistory'](_0x1f3355)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xf6')));if(_0x1f3355['countbusyretry']+_0x1f3355[_0xc07e('0xf7')]+_0x1f3355[_0xc07e('0xf8')]+_0x1f3355['countnosuchnumberretry']+_0x1f3355[_0xc07e('0xf9')]+_0x1f3355[_0xc07e('0xfa')]+_0x1f3355[_0xc07e('0xf4')]+_0x1f3355[_0xc07e('0xfb')]>=_0x128f9b[_0xc07e('0xfc')]){_0x1b59fc['stateGlobal'](_0x1f3355,_0x1e6dd2,_0x42f9e9,_0xc07e('0xfd'));}else{if(_0x1f3355[_0xc07e('0xf4')]>=_0x128f9b[_0xc07e('0xfe')]){_0x1b59fc[_0xc07e('0xff')](_0x1f3355,_0x1e6dd2,_0x42f9e9,_0xc07e('0x100'));}else{_0x1b59fc['rescheduleContact']({'active':![],'countmachineretry':_0x1f3355[_0xc07e('0xf4')],'scheduledat':moment()[_0xc07e('0x101')](_0x128f9b[_0xc07e('0x102')],_0xc07e('0x103'))[_0xc07e('0x85')](_0xc07e('0x104')),'ContactId':_0x1f3355[_0xc07e('0x105')],'ListId':_0x1f3355[_0xc07e('0xdd')],'VoiceQueueId':_0x1f3355[_0xc07e('0xdf')]||undefined,'CampaignId':_0x1f3355['CampaignId']||undefined})['catch'](loggerCatch(_0xc07e('0x106')));_0x1e6dd2({'reschedule':0x1});}}});}if(_0x394135['type']==='ivr'&&this[_0xc07e('0x21')][_0x394135[_0xc07e('0xbf')]][_0xc07e('0x107')]&&_0x29c116[_0xc07e('0xeb')]===_0xc07e('0xec')){delete this[_0xc07e('0xb7')][_0x29c116[_0xc07e('0xe8')]];this[_0xc07e('0xbe')](this['campaigns'][_0x394135[_0xc07e('0xbf')]]);_0x4ef57d=new Hangup(_0x394135,_0x29c116);_0x4ef57d[_0xc07e('0xb1')]=0x12;_0x4ef57d[_0xc07e('0xb2')]=_0xc07e('0xee');_0x4ef57d[_0xc07e('0xf3')]=_0xc07e('0xef');ami[_0xc07e('0x53')]('custom:amd',ut[_0xc07e('0xf1')](_0x4ef57d,_0xc07e('0xf5')));this['saveInDb'](_0x4ef57d,_0xc07e('0x108'),_0xc07e('0x109'));}if(_0x394135['type']===_0xc07e('0x88')&&this[_0xc07e('0x21')][_0x394135[_0xc07e('0xbf')]][_0xc07e('0x107')]&&_0x29c116[_0xc07e('0xeb')]==='MACHINE'){var _0x1b59fc=this;return new BPromise(function(_0x155eb4,_0x461fd9){delete _0x1b59fc[_0xc07e('0xb7')][_0x29c116[_0xc07e('0xe8')]];_0x1b59fc[_0xc07e('0xbe')](_0x1b59fc['campaigns'][_0x394135[_0xc07e('0xbf')]]);_0x1b59fc[_0xc07e('0x21')][_0x394135[_0xc07e('0xbf')]][_0xc07e('0x68')]+=0x1;_0x1b59fc[_0xc07e('0x21')][_0x394135[_0xc07e('0xbf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1824ed=_0x1b59fc['campaigns'][_0x394135[_0xc07e('0xbf')]];var _0xba8f9e=new Hangup(_0x394135,_0x29c116);_0xba8f9e[_0xc07e('0xb1')]=0x13;_0xba8f9e[_0xc07e('0xb2')]=_0xc07e('0x10a');_0xba8f9e['membername']='AMD';_0xba8f9e['countmachineretry']+=0x1;_0xba8f9e[_0xc07e('0x10b')]+=0x1;_0xba8f9e[_0xc07e('0xf5')]=!![];ami[_0xc07e('0x53')](_0xc07e('0xf0'),ut[_0xc07e('0xf1')](_0xba8f9e,_0xc07e('0xf5')));_0x1b59fc[_0xc07e('0xd4')](_0xba8f9e)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xf6')));if(_0xba8f9e[_0xc07e('0x10c')]+_0xba8f9e[_0xc07e('0xf7')]+_0xba8f9e['countnoanswerretry']+_0xba8f9e[_0xc07e('0x10d')]+_0xba8f9e[_0xc07e('0xf9')]+_0xba8f9e['countabandonedretry']+_0xba8f9e['countmachineretry']+_0xba8f9e[_0xc07e('0xfb')]>=_0x1824ed[_0xc07e('0xfc')]){_0x1b59fc['stateGlobal'](_0xba8f9e,_0x155eb4,_0x461fd9,'reason19\x20machine....');}else{if(_0xba8f9e['countmachineretry']>=_0x1824ed[_0xc07e('0xfe')]){_0x1b59fc[_0xc07e('0xff')](_0xba8f9e,_0x155eb4,_0x461fd9,_0xc07e('0x100'));}else{_0x1b59fc[_0xc07e('0xcb')]({'active':![],'countmachineretry':_0xba8f9e[_0xc07e('0xf4')],'scheduledat':moment()[_0xc07e('0x101')](_0x1824ed[_0xc07e('0x102')],'minutes')['format'](_0xc07e('0x104')),'ContactId':_0xba8f9e['ContactId'],'ListId':_0xba8f9e[_0xc07e('0xdd')],'VoiceQueueId':_0xba8f9e['VoiceQueueId']||undefined,'CampaignId':_0xba8f9e[_0xc07e('0xe0')]||undefined})['catch'](loggerCatch(_0xc07e('0x106')));_0x155eb4({'reschedule':0x1});}}});}}};Dialer[_0xc07e('0xb5')][_0xc07e('0x35')]=function(_0x8a3697){var _0x416204=this[_0xc07e('0xb7')][_0x8a3697[_0xc07e('0xe8')]];var _0x1d32bf=this;var _0x5d1fe3;if(_0x416204&&_0x416204['type']==='ivr'){delete this[_0xc07e('0xb7')][_0x8a3697[_0xc07e('0xe8')]];this[_0xc07e('0xbe')](this[_0xc07e('0x21')][_0x416204[_0xc07e('0xbf')]]);this[_0xc07e('0x21')][_0x416204[_0xc07e('0xbf')]]['ivrAnswerCallsDay']+=0x1;_0x5d1fe3=new Hangup(_0x416204,_0x8a3697);this['createHistory'](_0x5d1fe3)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x10e')));this[_0xc07e('0xd3')](_0x5d1fe3)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x10f')));}if(_0x416204&&_0x416204[_0xc07e('0x54')]!==_0xc07e('0x88')&&isNotNull(this[_0xc07e('0x20')][_0x416204['queue']]['dialQueueProject'])){delete this[_0xc07e('0xb7')][_0x8a3697[_0xc07e('0xe8')]];this[_0xc07e('0xbe')](this[_0xc07e('0x20')][_0x416204[_0xc07e('0xbf')]]);this[_0xc07e('0x20')][_0x416204['queue']][_0xc07e('0x68')]+=0x1;this['voiceQueues'][_0x416204[_0xc07e('0xbf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5d1fe3=new Hangup(_0x416204,_0x8a3697);_0x5d1fe3[_0xc07e('0xb1')]=0x10;_0x5d1fe3['statedesc']='AnswerAGI';_0x5d1fe3[_0xc07e('0xf3')]=_0xc07e('0x110');this['createHistory'](_0x5d1fe3)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x10e')));this[_0xc07e('0xd3')](_0x5d1fe3)['catch'](loggerCatch(_0xc07e('0x10f')));}if(_0x416204&&_0x416204[_0xc07e('0x54')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x416204['queue']]['dialQueueProject'])){delete this[_0xc07e('0xb7')][_0x8a3697[_0xc07e('0xe8')]];this[_0xc07e('0xbe')](this[_0xc07e('0x20')][_0x416204[_0xc07e('0xbf')]]);this[_0xc07e('0x20')][_0x416204[_0xc07e('0xbf')]][_0xc07e('0x73')]+=0x1;_0x5d1fe3=new Hangup(_0x416204,_0x8a3697);_0x5d1fe3['state']=0xc;_0x5d1fe3['statedesc']=_0x8a3697['cause-txt'];_0x5d1fe3[_0xc07e('0xf3')]='Unknow';this[_0xc07e('0xd4')](_0x5d1fe3)['catch'](loggerCatch(_0xc07e('0x10e')));this['moveContactManagedDialer'](_0x5d1fe3)['catch'](loggerCatch(_0xc07e('0x10f')));}};Dialer['prototype'][_0xc07e('0x34')]=function(_0x2d5215){var _0x318e03=this[_0xc07e('0xb7')][_0x2d5215['uniqueid']];var _0x5ddf4f=this;if(this[_0xc07e('0x20')][_0x2d5215[_0xc07e('0xbf')]]){if(_0x318e03&&_0x318e03['type']!==_0xc07e('0x88')){delete this['uniqueId'][_0x2d5215[_0xc07e('0xe8')]];this[_0xc07e('0x20')][_0x2d5215[_0xc07e('0xbf')]][_0xc07e('0x68')]+=0x1;var _0x1d84ee=new AgentComplete(_0x318e03,_0x2d5215);if(_0x2d5215[_0xc07e('0x111')]==='agent'){_0x1d84ee[_0xc07e('0x112')]=this[_0xc07e('0x20')][_0x2d5215[_0xc07e('0xbf')]][_0xc07e('0x113')]&&this[_0xc07e('0x20')][_0x2d5215['queue']][_0xc07e('0x114')]?moment()[_0xc07e('0x85')](_0xc07e('0x104')):undefined;}this[_0xc07e('0xd4')](_0x1d84ee)['catch'](loggerCatch(_0xc07e('0x115')));this[_0xc07e('0xd3')](_0x1d84ee)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x116')));}}};Dialer[_0xc07e('0xb5')]['syncAgentConnect']=function(_0x4e8198){if(this[_0xc07e('0x20')][_0x4e8198[_0xc07e('0xbf')]]){if(this[_0xc07e('0xb7')][_0x4e8198[_0xc07e('0xe8')]]&&this[_0xc07e('0xb7')][_0x4e8198[_0xc07e('0xe8')]][_0xc07e('0x54')]!=='ivr'){this[_0xc07e('0xbe')](this['voiceQueues'][_0x4e8198['queue']]);this['uniqueId'][_0x4e8198[_0xc07e('0xe8')]][_0xc07e('0x117')]=moment()[_0xc07e('0x85')](_0xc07e('0x104'));}}};Dialer['prototype'][_0xc07e('0x118')]=function(_0x1f8161){this[_0xc07e('0xd4')](_0x1f8161)[_0xc07e('0xbd')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xc07e('0xd3')](_0x1f8161)['catch'](loggerCatch(_0xc07e('0x119')));};Dialer['prototype'][_0xc07e('0x30')]=function(_0x847977){var _0x371f81=this[_0xc07e('0xb7')][_0x847977[_0xc07e('0xe8')]];var _0x1f999d=this;if(this['voiceQueues'][_0x847977[_0xc07e('0xbf')]]){if(_0x371f81&&_0x371f81[_0xc07e('0x54')]!==_0xc07e('0x88')){delete this[_0xc07e('0xb7')][_0x847977[_0xc07e('0xe8')]];this[_0xc07e('0xbe')](this[_0xc07e('0x20')][_0x847977[_0xc07e('0xbf')]]);_0x371f81[_0xc07e('0x11a')]=moment()[_0xc07e('0x85')](_0xc07e('0x104'));var _0x1d4f90=new QueueCallerAbandon(_0x371f81,_0x847977);if(getSeconds(_0x371f81[_0xc07e('0x11a')],_0x371f81[_0xc07e('0x11b')])>=_0x371f81[_0xc07e('0x11c')]){this['voiceQueues'][_0x847977[_0xc07e('0xbf')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xc07e('0x20')][_0x847977[_0xc07e('0xbf')]][_0xc07e('0x6e')]+=0x1;this['voiceQueues'][_0x847977[_0xc07e('0xbf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1d4f90['state']=0xa;_0x1d4f90['statedesc']='Drop';_0x1d4f90[_0xc07e('0x11d')]=_0xc07e('0x11e');_0x1d4f90[_0xc07e('0x112')]=this['voiceQueues'][_0x847977['queue']][_0xc07e('0x113')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1d4f90[_0xc07e('0xf9')]+=0x1;_0x1d4f90['countglobal']+=0x1;if(_0x1d4f90['countdropretry']>=this['voiceQueues'][_0x847977[_0xc07e('0xbf')]][_0xc07e('0x11f')]){this['queueCallerAbandonCreateState'](_0x1d4f90);}else{this[_0xc07e('0xcb')]({'active':![],'countdropretry':_0x1d4f90[_0xc07e('0xf9')],'scheduledat':moment()[_0xc07e('0x101')](this[_0xc07e('0x20')][_0x847977[_0xc07e('0xbf')]][_0xc07e('0x120')],_0xc07e('0x103'))[_0xc07e('0x85')](_0xc07e('0x104')),'ContactId':_0x371f81[_0xc07e('0x105')],'ListId':_0x371f81[_0xc07e('0xdd')],'VoiceQueueId':_0x371f81['VoiceQueueId']||undefined,'CampaignId':_0x371f81['CampaignId']||undefined})['catch'](loggerCatch(_0xc07e('0x121')));var _0x15185a=new History(_0x1d4f90);_0x15185a[_0xc07e('0xb1')]=0xa;_0x15185a[_0xc07e('0xb2')]=_0xc07e('0x122');_0x15185a[_0xc07e('0xb4')]=moment()[_0xc07e('0x85')](_0xc07e('0x104'));_0x15185a[_0xc07e('0xb3')]=_0x15185a[_0xc07e('0xb4')];_0x15185a['calleridname']=_0x1d4f90[_0xc07e('0x123')];_0x15185a['calleridnum']=_0x1d4f90[_0xc07e('0x124')];this[_0xc07e('0xd4')](_0x15185a)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x125')));}}else{this['voiceQueues'][_0x847977[_0xc07e('0xbf')]][_0xc07e('0x77')]+=0x1;this[_0xc07e('0x20')][_0x847977['queue']][_0xc07e('0x6d')]+=0x1;_0x1d4f90[_0xc07e('0xb1')]=0xb;_0x1d4f90[_0xc07e('0xb2')]=_0xc07e('0x126');_0x1d4f90[_0xc07e('0x11d')]='CALLEREXIT';_0x1d4f90[_0xc07e('0xfa')]+=0x1;_0x1d4f90[_0xc07e('0x10b')]+=0x1;if(_0x1d4f90['countabandonedretry']>=this[_0xc07e('0x20')][_0x847977[_0xc07e('0xbf')]][_0xc07e('0x127')]){this[_0xc07e('0x118')](_0x1d4f90);}else{this[_0xc07e('0xcb')]({'active':![],'countabandonedretry':_0x1d4f90[_0xc07e('0xfa')],'scheduledat':moment()[_0xc07e('0x101')](this[_0xc07e('0x20')][_0x847977[_0xc07e('0xbf')]][_0xc07e('0x128')],_0xc07e('0x103'))['format'](_0xc07e('0x104')),'ContactId':_0x371f81['ContactId'],'ListId':_0x371f81[_0xc07e('0xdd')],'VoiceQueueId':_0x371f81['VoiceQueueId']||undefined,'CampaignId':_0x371f81[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x129')));var _0x15185a=new History(_0x1d4f90);_0x15185a[_0xc07e('0xb1')]=0xb;_0x15185a[_0xc07e('0xb2')]=_0xc07e('0x126');_0x15185a[_0xc07e('0xb4')]=moment()[_0xc07e('0x85')](_0xc07e('0x104'));_0x15185a[_0xc07e('0xb3')]=_0x15185a['starttime'];_0x15185a[_0xc07e('0x123')]=_0x1d4f90[_0xc07e('0x123')];_0x15185a[_0xc07e('0x124')]=_0x1d4f90[_0xc07e('0x124')];this[_0xc07e('0xd4')](_0x15185a)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x12a')));}}}}};Dialer[_0xc07e('0xb5')]['syncNewExten']=function(_0x44bb00){if(this['actions'][_0x44bb00['uniqueid']]){this[_0xc07e('0x26')][_0x44bb00[_0xc07e('0xe8')]][_0xc07e('0xbc')]=_0x44bb00[_0xc07e('0xbc')];}if(this[_0xc07e('0xb7')][_0x44bb00[_0xc07e('0xe8')]]){this[_0xc07e('0xb7')][_0x44bb00['uniqueid']][_0xc07e('0xbc')]=_0x44bb00[_0xc07e('0xbc')];}};Dialer[_0xc07e('0xb5')]['syncQueueMember']=function(_0x4a9c6d){if(strategy[this[_0xc07e('0x20')][this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]][_0xc07e('0xbf')]][_0xc07e('0x56')]]===_0xc07e('0x1b')){if(this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]]&&_[_0xc07e('0xb9')](this[_0xc07e('0x26')][_0x4a9c6d['actionid']][_0xc07e('0x12c')])&&_0x4a9c6d[_0xc07e('0xbb')]==='1'&&_0x4a9c6d[_0xc07e('0x12d')]==='0'){if(this[_0xc07e('0x22')][_0x4a9c6d['stateinterface']]){if(!this[_0xc07e('0x22')][_0x4a9c6d[_0xc07e('0x12e')]][_0xc07e('0x12c')]){this['agents'][_0x4a9c6d['stateinterface']][_0xc07e('0x12c')]=!![];this[_0xc07e('0x26')][_0x4a9c6d['actionid']][_0xc07e('0x12c')]=!![];this['actions'][_0x4a9c6d['actionid']][_0xc07e('0x12e')]=_0x4a9c6d[_0xc07e('0x12e')];}}}}else if((strategy[this['voiceQueues'][this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]][_0xc07e('0xbf')]][_0xc07e('0x56')]]||_0xc07e('0x1a'))===_0xc07e('0x1a')){if(this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]]){if(this[_0xc07e('0x22')][_0x4a9c6d[_0xc07e('0x12e')]]){this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]]['stateinterface']=_0x4a9c6d[_0xc07e('0x12e')];if(_[_0xc07e('0xb9')](this['queueBooked'][this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]]['queue']])){this[_0xc07e('0x2a')][this[_0xc07e('0x26')][_0x4a9c6d[_0xc07e('0x12b')]][_0xc07e('0xbf')]]=[];}this[_0xc07e('0x2a')][this['actions'][_0x4a9c6d[_0xc07e('0x12b')]][_0xc07e('0xbf')]][_0xc07e('0x12f')](_[_0xc07e('0x9b')](_[_0xc07e('0xdc')](this[_0xc07e('0x26')][_0x4a9c6d['actionid']],[_0xc07e('0x130'),_0xc07e('0x12e')]),{'status':_0x4a9c6d[_0xc07e('0xbb')],'paused':_0x4a9c6d[_0xc07e('0x12d')]}));}}}};function unlockQueueStatus(_0x12a617,_0x18afb6){setTimeout(function(){if(_[_0xc07e('0x43')](_0x12a617[_0xc07e('0x131')])){loggerBooked[_0xc07e('0xa1')](_0xc07e('0x132'),_0x18afb6);}_0x12a617[_0xc07e('0x131')]=!![];loggerBooked[_0xc07e('0x8a')](_0xc07e('0x133'),_0x18afb6,JSON[_0xc07e('0x84')](_[_0xc07e('0xdc')](_0x12a617,[_0xc07e('0x46'),_0xc07e('0x131')])));},0x1f3);}Dialer[_0xc07e('0xb5')][_0xc07e('0x3d')]=function(_0xb36d01){var _0x2d7e7d=this;var _0x19a31a=_0x2d7e7d[_0xc07e('0x20')][_0x2d7e7d[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]];if(strategy[this['voiceQueues'][this['actions'][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]][_0xc07e('0x56')]]===_0xc07e('0x1b')){if(this['actions'][_0xb36d01['actionid']]&&this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0x12e')]){this[_0xc07e('0x1f')][_0xc07e('0x134')](this['actions'][_0xb36d01['actionid']]['idHopper'],this[_0xc07e('0x26')][_0xb36d01['actionid']][_0xc07e('0x12e')])[_0xc07e('0xbd')](function(_0x3e58cd){logger[_0xc07e('0xa1')](_0xc07e('0x135'),util[_0xc07e('0xd9')](_0x3e58cd,{'showHidden':![],'depth':null}));})[_0xc07e('0x136')](function(){_0x2d7e7d[_0xc07e('0xbe')](_0x2d7e7d['voiceQueues'][_0x2d7e7d[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]]['queue']]);_0x2d7e7d[_0xc07e('0x22')][_0x2d7e7d[_0xc07e('0x26')][_0xb36d01['actionid']][_0xc07e('0x12e')]]['locked']=![];delete _0x2d7e7d[_0xc07e('0x26')][_0xb36d01['actionid']];unlockQueueStatus(_0x19a31a);});}else{this[_0xc07e('0xbe')](this[_0xc07e('0x20')][this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]]);this[_0xc07e('0xcb')]({'active':![],'ContactId':this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]]['ContactId'],'ListId':this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xdd')],'VoiceQueueId':this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xc07e('0x137')));delete this[_0xc07e('0x26')][_0xb36d01['actionid']];unlockQueueStatus(_0x19a31a);}}else if((strategy[this[_0xc07e('0x20')][this['actions'][_0xb36d01[_0xc07e('0x12b')]]['queue']][_0xc07e('0x56')]]||_0xc07e('0x1a'))===_0xc07e('0x1a')){var _0x278d8e;if(this['actions'][_0xb36d01['actionid']]&&!_[_0xc07e('0x4c')](this[_0xc07e('0x2a')][this['actions'][_0xb36d01['actionid']][_0xc07e('0xbf')]])){if(this['queueBookedRR'][_0x2d7e7d[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]]['queue']]){this[_0xc07e('0x2b')][_0x2d7e7d[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]]=this[_0xc07e('0x2b')][this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]]?this[_0xc07e('0x2b')][this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]]:this[_0xc07e('0x2a')][this['actions'][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]]?this[_0xc07e('0x2a')][this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]][_0xc07e('0x138')]||0x0:0x0;}this[_0xc07e('0x2a')][this[_0xc07e('0x26')][_0xb36d01[_0xc07e('0x12b')]][_0xc07e('0xbf')]][_0xc07e('0x138')]=this[_0xc07e('0x2b')][this[_0xc07e('0x26')][_0xb36d01['actionid']][_0xc07e('0xbf')]];for(var _0x1fe91a=0x0;_0x1fe91a=0x0;})['catch'](myreject(_0x473285)));}}else{_0x20b7e7[_0xc07e('0x12f')](ami[_0xc07e('0xba')]({'action':'command','command':util[_0xc07e('0x85')](_0xc07e('0x14e'),_0x244a23,!_['isUndefined'](config[_0xc07e('0x14b')][_0x554e7b])?_0x554e7b:'')})[_0xc07e('0x41')](function(_0x5aa3de){return _0x5aa3de['content'][_0xc07e('0x151')](_0xc07e('0x152'))>=0x0;})[_0xc07e('0xbd')](myreject(_0x473285)));}BPromise[_0xc07e('0x153')](_0x20b7e7)[_0xc07e('0x41')](function(_0x442c05){var _0x539d85=_[_0xc07e('0x154')](_0x442c05);if(_0x539d85){return _0x20af5e(_0x539d85);}else{_0xe6202b['message']=_0x50f964?_0xc07e('0x155'):'INTERVAL_IS_OVERTIME';return _0x473285(msgResponse(_0xc07e('0x156'),_0xc07e('0x147'),_0xc07e('0x157')+_0x50f964+'\x20'+_0xaf57f9+'\x20Interval\x20is\x20overtime:\x20'+util[_0xc07e('0xd9')](_0x244a23,{'showHidden':![],'depth':null})+_0xc07e('0x158')+_0x554e7b));}})[_0xc07e('0xbd')](function(_0x228b27){return _0x473285(msgResponse(_0xc07e('0x146'),_0xc07e('0x147'),JSON[_0xc07e('0x84')](_0x228b27)));});});};Dialer[_0xc07e('0xb5')][_0xc07e('0x159')]=function(_0x16b75d){var _0x3cd109=this;return function(){switch(_0x16b75d[_0xc07e('0x64')]){case'progressive':freeVariablesPredictive(_0x16b75d);_0x3cd109[_0xc07e('0x15a')](_0x16b75d,0x1);break;case'power':freeVariablesPredictive(_0x16b75d);_0x3cd109[_0xc07e('0x15a')](_0x16b75d,_0x16b75d[_0xc07e('0x15b')]);break;case _0xc07e('0x7'):_0x3cd109[_0xc07e('0x7')](_0x16b75d);break;case _0xc07e('0x15c'):freeVariablesPredictive(_0x16b75d);_0x3cd109[_0xc07e('0x15a')](_0x16b75d,0x1);break;default:freeVariablesPredictive(_0x16b75d);logger[_0xc07e('0xa1')]('Queue',_0x16b75d[_0xc07e('0x46')],_0xc07e('0x15d'));}};};Dialer[_0xc07e('0xb5')][_0xc07e('0x15e')]=function(_0x5017a6){return BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](cmHopper[_0xc07e('0x15f')](_0x5017a6['id'],previewRecallmeReminderInterval))[_0xc07e('0x41')](function(_0x5b7446){for(var _0x3a4634=0x0;_0x3a4634<_0x5b7446[_0xc07e('0xa3')];_0x3a4634++){var _0xd54ee4=_0x5b7446[_0x3a4634][_0xc07e('0x160')][_0xc07e('0x46')];if(_0xd54ee4)io['to'](util[_0xc07e('0x85')](_0xc07e('0x161'),_0xd54ee4))[_0xc07e('0x53')](_0xc07e('0x162'),{'hopper':_0x5b7446[_0x3a4634]});}})[_0xc07e('0xbd')](function(_0x279fda){});};Dialer[_0xc07e('0xb5')][_0xc07e('0x163')]=function(_0x33975e){var _0x32c020=this;return function(){_0x32c020[_0xc07e('0x164')](_0x33975e);};};Dialer[_0xc07e('0xb5')][_0xc07e('0x8')]=function(_0x4e8ef4){var _0x442480=this;if(isNotPreview(_0x4e8ef4[_0xc07e('0x64')])){if(isVoiceQueueOutbound(_0x4e8ef4[_0xc07e('0x54')])&&isActive(_0x4e8ef4[_0xc07e('0x63')])){_0x4e8ef4[_0xc07e('0xab')]=!![];BPromise[_0xc07e('0xc4')]()[_0xc07e('0x41')](checkIsLoggedIn(_0x4e8ef4,_0x4e8ef4['loggedIn']))[_0xc07e('0x41')](checkIsActive(_0x4e8ef4,_0x4e8ef4[_0xc07e('0x63')]))[_0xc07e('0x41')](checkInterval(_0x4e8ef4))[_0xc07e('0x41')](_0x442480[_0xc07e('0x165')](_0x4e8ef4))['then'](_0x442480['checkIfTime'](_0x4e8ef4[_0xc07e('0x166')],_0x4e8ef4[_0xc07e('0x167')],_0x4e8ef4[_0xc07e('0x46')],_0x4e8ef4))[_0xc07e('0x41')](_0x442480[_0xc07e('0x168')](_0x4e8ef4[_0xc07e('0x49')],_0x4e8ef4[_0xc07e('0x167')],_0x4e8ef4['name'],_0x4e8ef4))[_0xc07e('0x41')](_0x442480[_0xc07e('0x159')](_0x4e8ef4))[_0xc07e('0xbd')](loggerCatchQueueSummary(_0xc07e('0x169'),_0x4e8ef4));}else{notSendMessagesQueue(_0x4e8ef4);}}else{freeVariablesPredictive(_0x4e8ef4);if(_0x4e8ef4[_0xc07e('0x16a')]){_0x442480[_0xc07e('0x15e')](_0x4e8ef4);}}};Dialer[_0xc07e('0xb5')][_0xc07e('0x142')]=function(){var _0x545aa1=this;var _0x5e664b;for(var _0x4bc983 in this[_0xc07e('0x21')]){if(typeof this[_0xc07e('0x21')][_0x4bc983]!==_0xc07e('0xa4')){_0x5e664b=this['campaigns'][_0x4bc983];if(isCampaignIvr(_0x5e664b[_0xc07e('0x54')])&&isActive(_0x5e664b['active'])){_0x5e664b[_0xc07e('0xab')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x5e664b,_0x5e664b[_0xc07e('0x82')]))['then'](checkInterval(_0x5e664b))[_0xc07e('0x41')](_0x545aa1['checkIsTrunkReachable'](_0x5e664b))[_0xc07e('0x41')](_0x545aa1[_0xc07e('0x145')](_0x5e664b[_0xc07e('0x166')],_0x5e664b[_0xc07e('0x167')],_0x5e664b[_0xc07e('0x46')],_0x5e664b))[_0xc07e('0x41')](_0x545aa1['checkIfTimeIntervals'](_0x5e664b[_0xc07e('0x49')],_0x5e664b[_0xc07e('0x167')],_0x5e664b[_0xc07e('0x46')],_0x5e664b))[_0xc07e('0x41')](_0x545aa1[_0xc07e('0x163')](_0x5e664b))[_0xc07e('0xbd')](loggerCatchQueueSummary(_0xc07e('0x16b'),_0x5e664b));}else{notSendMessagesCampaign(_0x5e664b);}}}};function getCallerIdRandom(_0x8e6f02,_0x2a9262){var _0x372c2a;var _0x19a510;var _0x53464e;if(_0x2a9262<=0x0){_0x2a9262=0x1;}_0x372c2a=new RegExp(_0xc07e('0x16c')+_0x2a9262+'}$');_0x19a510=Math[_0xc07e('0x16d')](0xa,_0x2a9262-0x1);_0x53464e=Math['pow'](0xa,_0x2a9262)-0x1;return util[_0xc07e('0x85')]('%s',_[_0xc07e('0x16e')](_0x8e6f02,_0x372c2a,_[_0xc07e('0x16f')](_0x19a510,_0x53464e)));}function extractCalleridName(_0x38ff35){var _0x1aa5ee=_0x38ff35[_0xc07e('0x170')](/"(.*?)"/);return _0x1aa5ee?_0x1aa5ee[0x1]:_0x38ff35;}function extractCalleridNumber(_0x22ce4d){var _0x1e1f1f=_0x22ce4d[_0xc07e('0x170')](/<(.*?)>/);return _0x1e1f1f?_0x1e1f1f[0x1]:_0x22ce4d;}Dialer[_0xc07e('0xb5')][_0xc07e('0x171')]=function(_0x53ae8e,_0x93ddae){var _0x55fddb=this;var _0x49a394=uuid['v4']();this['actions'][_0x49a394]=new Action(_0x53ae8e,_0x93ddae,_0x49a394);return new BPromise(function(_0xcfef7,_0x31b3bc){if(_[_0xc07e('0x43')](_0x53ae8e)&&typeof _0x53ae8e!==_0xc07e('0x172')){return _0x31b3bc(msgResponse(_0xc07e('0x173'),'Failure',_0xc07e('0x174')));}if(_['isUndefined'](_0x93ddae[_0xc07e('0x175')]['phone'])||_0x93ddae[_0xc07e('0x175')][_0xc07e('0x176')]===null){return _0x31b3bc(msgResponse(_0xc07e('0x173'),_0xc07e('0x147'),_0xc07e('0x177')));}var _0x5ba5dc={'XMD-CALLERID':_0x55fddb[_0xc07e('0x26')][_0x49a394][_0xc07e('0x178')](),'XMD-AGI':_0x53ae8e[_0xc07e('0x179')]?util[_0xc07e('0x85')](_0xc07e('0x17a'),ipAgi,_0x53ae8e['dialQueueProject']):_0xc07e('0x17b'),'XMD-AGIAFTER':_0x53ae8e[_0xc07e('0x113')]?util[_0xc07e('0x85')]('\x22agi://%s/square,%s\x22',ipAgi,_0x53ae8e[_0xc07e('0x113')]):_0xc07e('0x17b'),'XMD-QUEUE':_0x53ae8e[_0xc07e('0x54')]===_0xc07e('0x55')?util['format'](_0xc07e('0x17c'),_0x53ae8e[_0xc07e('0x46')],_0x53ae8e[_0xc07e('0x17d')]||'',_0x53ae8e[_0xc07e('0x114')]?'c':'',_0x53ae8e['dialQueueTimeout']||0x3):_0xc07e('0x17b'),'XMD-CONTACTID':_0x93ddae[_0xc07e('0x105')],'XMD-CDRTYPE':_0xc07e('0x6'),'CALLERID(all)':_0x55fddb[_0xc07e('0x26')][_0x49a394][_0xc07e('0x178')](),'XMD-AMD':_0x53ae8e['dialAMDActive']?_0xc07e('0x17e'):'NONE','XMD-DESTINATION':_0xc07e('0x17f')};if(_0x53ae8e['dialAMDActive']){_0x5ba5dc[_0xc07e('0x180')]=_0x53ae8e[_0xc07e('0x181')]||0x9c4;_0x5ba5dc[_0xc07e('0x182')]=_0x53ae8e[_0xc07e('0x183')]||0x5dc;_0x5ba5dc['XMD-AMDAFTERGREETINGSILENCE']=_0x53ae8e['dialAMDAfterGreetingSilence']||0x320;_0x5ba5dc[_0xc07e('0x184')]=_0x53ae8e[_0xc07e('0x185')]||0x1388;_0x5ba5dc[_0xc07e('0x186')]=_0x53ae8e[_0xc07e('0x187')]||0x64;_0x5ba5dc[_0xc07e('0x188')]=_0x53ae8e['dialAMDBetweenWordsSilence']||0x32;_0x5ba5dc[_0xc07e('0x189')]=_0x53ae8e[_0xc07e('0x18a')]||0x3;_0x5ba5dc[_0xc07e('0x18b')]=_0x53ae8e[_0xc07e('0x18c')]||0x100;_0x5ba5dc[_0xc07e('0x18d')]=_0x53ae8e[_0xc07e('0x18e')]||0x1388;}if(_0x53ae8e['type']===_0xc07e('0x55')){_0x5ba5dc[_0xc07e('0x18f')]=_0x93ddae['VoiceQueueId'];}else{_0x5ba5dc['XMD-CAMPAIGNID']=_0x93ddae['CampaignId'];}for(var _0x15d23e in _0x93ddae[_0xc07e('0x175')]){if(typeof _0x93ddae[_0xc07e('0x175')][_0x15d23e]!=='undefined'){if(isNotNull(_0x93ddae[_0xc07e('0x175')][_0x15d23e])&&_0x15d23e!=='id'&&_0x15d23e!==_0xc07e('0x190')&&_0x15d23e!==_0xc07e('0x191')&&_0x15d23e!=='updatedAt'){_0x5ba5dc[util['format'](_0xc07e('0x192'),_0xc07e('0x193'),_[_0xc07e('0x194')](_0x15d23e))]=_0x93ddae[_0xc07e('0x175')][_0x15d23e];}}}var _0x3f7054=_0x55fddb['isTrunkReachable'](_0x53ae8e[_0xc07e('0x81')])?getCallerId(_0x53ae8e[_0xc07e('0x81')][_0xc07e('0x83')],_0x53ae8e[_0xc07e('0x65')],_0x53ae8e[_0xc07e('0x195')]>0x0?getCallerIdRandom(_0x53ae8e[_0xc07e('0x66')],_0x53ae8e['dialRandomLastDigitCallerIdNumber']):_0x53ae8e[_0xc07e('0x66')]):getCallerId(_[_0xc07e('0xb9')](_0x53ae8e[_0xc07e('0x143')])?_0x53ae8e[_0xc07e('0x81')][_0xc07e('0x83')]:_0x53ae8e[_0xc07e('0x143')][_0xc07e('0x83')],_0x53ae8e['dialOriginateCallerIdName'],_0x53ae8e[_0xc07e('0x195')]>0x0?getCallerIdRandom(_0x53ae8e[_0xc07e('0x66')],_0x53ae8e[_0xc07e('0x195')]):_0x53ae8e['dialOriginateCallerIdNumber']);if(_0x3f7054){_0x5ba5dc[_0xc07e('0x196')]=_0x55fddb['actions'][_0x49a394][_0xc07e('0x197')]=extractCalleridName(_0x3f7054);_0x5ba5dc['XMD-ORIGINATECALLERIDNUM']=_0x55fddb[_0xc07e('0x26')][_0x49a394][_0xc07e('0x198')]=extractCalleridNumber(_0x3f7054);}return ami['Action']({'actionid':_0x49a394,'action':_0xc07e('0x173'),'channel':_0x55fddb[_0xc07e('0xe4')](_0x53ae8e[_0xc07e('0x81')])?util[_0xc07e('0x85')](_0xc07e('0x199'),_0x53ae8e[_0xc07e('0x81')]['name'],isNotNull(_0x53ae8e[_0xc07e('0x67')])?_0x53ae8e[_0xc07e('0x67')][_0xc07e('0x19a')]()||'':'',_0x53ae8e[_0xc07e('0x19b')]>0x0?_0x93ddae[_0xc07e('0x175')]['phone'][_0xc07e('0x19c')](_0x53ae8e[_0xc07e('0x19b')]):_0x93ddae[_0xc07e('0x175')][_0xc07e('0x176')]):util[_0xc07e('0x85')]('SIP/%s/%s%s',_[_0xc07e('0xb9')](_0x53ae8e[_0xc07e('0x143')])?_0x53ae8e[_0xc07e('0x81')][_0xc07e('0x46')]:_0x53ae8e['TrunkBackup']['name'],isNotNull(_0x53ae8e[_0xc07e('0x67')])?_0x53ae8e[_0xc07e('0x67')][_0xc07e('0x19a')]()||'':'',_0x53ae8e[_0xc07e('0x19b')]>0x0?_0x93ddae[_0xc07e('0x175')]['phone'][_0xc07e('0x19c')](_0x53ae8e[_0xc07e('0x19b')]):_0x93ddae[_0xc07e('0x175')][_0xc07e('0x176')]),'callerid':_0x3f7054,'Exten':_0xc07e('0x17f'),'Context':'from-sip','Priority':'1','variable':_0x5ba5dc,'timeout':(_0x53ae8e[_0xc07e('0x19d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x49a394})[_0xc07e('0x41')](function(_0x3a3868){return _0xcfef7(_0x3a3868);})['catch'](function(_0x3a7148){_0x53ae8e[_0xc07e('0x19e')]+=0x1;var _0x55d0b7=new History(_0x55fddb['actions'][_0x49a394]);logger[_0xc07e('0xa1')](util['format'](_0xc07e('0x19f'),JSON['stringify'](_0x3a7148)));_0x55d0b7[_0xc07e('0xb1')]=0xe;_0x55d0b7[_0xc07e('0xb2')]='OriginateError';_0x55d0b7[_0xc07e('0xb4')]=moment()[_0xc07e('0x85')]('YYYY-MM-DD\x20HH:mm:ss');_0x55d0b7[_0xc07e('0xb3')]=_0x55d0b7['starttime'];_0x55fddb[_0xc07e('0xd4')](_0x55d0b7)['catch'](loggerCatch(_0xc07e('0x1a0')));_0x55fddb[_0xc07e('0xd3')](_0x55d0b7)[_0xc07e('0xbd')](loggerCatch('[originate][error]'))[_0xc07e('0x136')](function(){delete _0x55fddb[_0xc07e('0x26')][_0x49a394];return _0x31b3bc(msgResponse(_0xc07e('0x173'),'Error',_0xc07e('0x1a1')));});});});};Dialer[_0xc07e('0xb5')]['syncOriginateResponse']=function(_0x14cd9b){var _0x593dc3=this[_0xc07e('0x26')][_0x14cd9b[_0xc07e('0x12b')]];if(_0x593dc3){delete this[_0xc07e('0x26')][_0x14cd9b[_0xc07e('0x12b')]];_0x593dc3[_0xc07e('0x11b')]=moment()[_0xc07e('0x85')](_0xc07e('0x104'));var _0x16e421=_0x593dc3[_0xc07e('0x54')]===_0xc07e('0x88')?this[_0xc07e('0x21')][_0x593dc3[_0xc07e('0xbf')]]:this[_0xc07e('0x20')][_0x593dc3[_0xc07e('0x1a2')]()];if(!this[_0xc07e('0xe3')](_0x14cd9b['response'])){this['updateOriginated'](_0x16e421);return this[_0xc07e('0x1a3')](_0x593dc3,_0x16e421,_0x14cd9b)['catch'](loggerCatch(_0xc07e('0x1a4')));}this[_0xc07e('0xb7')][_0x14cd9b['uniqueid']]=_0x593dc3;}};Dialer[_0xc07e('0xb5')][_0xc07e('0x1a5')]=function(_0x5ec883,_0x5a44e0,_0x2cebd9){var _0x3d3478=new History(_0x5a44e0);if(_0x3d3478[_0xc07e('0x10c')]+_0x3d3478['countcongestionretry']+_0x3d3478[_0xc07e('0xf8')]+_0x3d3478[_0xc07e('0x10d')]+_0x3d3478[_0xc07e('0xf9')]+_0x3d3478[_0xc07e('0xfa')]+_0x3d3478[_0xc07e('0xf4')]+_0x3d3478[_0xc07e('0xfb')]>=_0x2cebd9[_0xc07e('0xfc')]-0x1){return!![];}switch(_0x5ec883){case 0x3:if(_0x3d3478[_0xc07e('0xf8')]>=_0x2cebd9['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3d3478[_0xc07e('0xf8')]+=0x1,'scheduledat':moment()[_0xc07e('0x101')](_0x2cebd9[_0xc07e('0x1a6')],_0xc07e('0x103'))[_0xc07e('0x85')](_0xc07e('0x104')),'ContactId':_0x3d3478['ContactId'],'ListId':_0x3d3478[_0xc07e('0xdd')],'VoiceQueueId':_0x3d3478['VoiceQueueId']||undefined,'CampaignId':_0x3d3478[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3d3478[_0xc07e('0x10c')]>=_0x2cebd9[_0xc07e('0x1a7')]-0x1){return!![];}this[_0xc07e('0xcb')]({'active':![],'countbusyretry':_0x3d3478['countbusyretry']+=0x1,'scheduledat':moment()[_0xc07e('0x101')](_0x2cebd9[_0xc07e('0x1a8')],'minutes')['format'](_0xc07e('0x104')),'ContactId':_0x3d3478['ContactId'],'ListId':_0x3d3478['ListId'],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478['CampaignId']||undefined})[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x1a9')));break;case 0x8:if(_0x3d3478[_0xc07e('0xf7')]>=_0x2cebd9[_0xc07e('0x1aa')]-0x1){return!![];}this[_0xc07e('0xcb')]({'active':![],'countcongestionretry':_0x3d3478[_0xc07e('0xf7')]+=0x1,'scheduledat':moment()[_0xc07e('0x101')](_0x2cebd9[_0xc07e('0x1ab')],_0xc07e('0x103'))[_0xc07e('0x85')](_0xc07e('0x104')),'ContactId':_0x3d3478[_0xc07e('0x105')],'ListId':_0x3d3478[_0xc07e('0xdd')],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x1ac')));break;case 0x0:if(_0x3d3478[_0xc07e('0x10d')]>=_0x2cebd9['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xc07e('0xcb')]({'active':![],'countnosuchnumberretry':_0x3d3478[_0xc07e('0x10d')]+=0x1,'scheduledat':moment()[_0xc07e('0x101')](_0x2cebd9[_0xc07e('0x1ad')],_0xc07e('0x103'))[_0xc07e('0x85')](_0xc07e('0x104')),'ContactId':_0x3d3478[_0xc07e('0x105')],'ListId':_0x3d3478[_0xc07e('0xdd')],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478[_0xc07e('0xe0')]||undefined})['catch'](loggerCatch(_0xc07e('0x1ae')));}break;case 0xa:if(_0x3d3478[_0xc07e('0xf9')]>=_0x2cebd9[_0xc07e('0x11f')]-0x1){return!![];}this[_0xc07e('0xcb')]({'active':![],'countdropretry':_0x3d3478[_0xc07e('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x2cebd9['dialDropRetryFrequency'],_0xc07e('0x103'))['format'](_0xc07e('0x104')),'ContactId':_0x3d3478[_0xc07e('0x105')],'ListId':_0x3d3478['ListId'],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3d3478[_0xc07e('0xfa')]>=_0x2cebd9[_0xc07e('0x127')]-0x1){return!![];}this[_0xc07e('0xcb')]({'active':![],'countabandonedretry':_0x3d3478[_0xc07e('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x2cebd9[_0xc07e('0x128')],_0xc07e('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d3478[_0xc07e('0x105')],'ListId':_0x3d3478[_0xc07e('0xdd')],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x129')));break;case 0x13:if(_0x3d3478[_0xc07e('0xf4')]>=_0x2cebd9[_0xc07e('0xfe')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x3d3478[_0xc07e('0xf4')]+=0x1,'scheduledat':moment()[_0xc07e('0x101')](_0x2cebd9[_0xc07e('0x102')],'minutes')[_0xc07e('0x85')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d3478[_0xc07e('0x105')],'ListId':_0x3d3478[_0xc07e('0xdd')],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3d3478['countagentrejectretry']>=_0x2cebd9[_0xc07e('0x1af')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3d3478['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xc07e('0x101')](_0x2cebd9[_0xc07e('0x1b0')],_0xc07e('0x103'))[_0xc07e('0x85')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d3478[_0xc07e('0x105')],'ListId':_0x3d3478['ListId'],'VoiceQueueId':_0x3d3478[_0xc07e('0xdf')]||undefined,'CampaignId':_0x3d3478[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xc07e('0xb5')][_0xc07e('0x1a3')]=function(_0x4ff794,_0x2f9188,_0x538338){var _0x2e302c=this;var _0x23320c=new History(_0x4ff794);return new BPromise(function(_0x2cbbd5,_0x1465d2){if(_['isUndefined'](_0x2f9188)&&typeof _0x2f9188!=='object'){return _0x1465d2(msgResponse(_0xc07e('0x1b1'),'Failure','entity\x20is\x20undefine'));}if(_[_0xc07e('0x43')](_0x538338)&&typeof _0x538338!==_0xc07e('0x172')){return _0x1465d2(msgResponse('[callProgressDetecting]',_0xc07e('0x147'),_0xc07e('0x1b2')));}switch(_0x538338[_0xc07e('0x111')]){case'0':_0x2f9188[_0xc07e('0x70')]+=0x1;_0x23320c['state']=0x0;_0x23320c[_0xc07e('0xb2')]=_0xc07e('0x1b3');_0x23320c[_0xc07e('0x10d')]+=0x1;_0x23320c[_0xc07e('0x10b')]+=0x1;ami[_0xc07e('0x53')](_0xc07e('0x1b4'),ut[_0xc07e('0xf1')](_0x4ff794,_0xc07e('0x1b5')));_0x2e302c['createHistory'](_0x23320c)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0xf6')));if(_0x2e302c[_0xc07e('0x1a5')](0x0,_0x4ff794,_0x2f9188)){if(_0x23320c[_0xc07e('0x10d')]>=_0x2f9188['dialNoSuchNumberMaxRetry']){_0x2e302c['createStateFinal'](_0x23320c,_0x2cbbd5,_0x1465d2,'reason\x200\x20no\x20such\x20number....');}else{_0x2e302c[_0xc07e('0x1b6')](_0x23320c,_0x2cbbd5,_0x1465d2,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2f9188[_0xc07e('0x6f')]+=0x1;_0x23320c[_0xc07e('0xb1')]=0x3;_0x23320c[_0xc07e('0xb2')]=_0xc07e('0x1b7');_0x23320c[_0xc07e('0xf8')]+=0x1;_0x23320c[_0xc07e('0x10b')]+=0x1;ami[_0xc07e('0x53')](_0xc07e('0x1b8'),ut[_0xc07e('0xf1')](_0x4ff794,_0xc07e('0x1b9')));_0x2e302c[_0xc07e('0xd4')](_0x23320c)[_0xc07e('0xbd')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2e302c[_0xc07e('0x1a5')](0x3,_0x4ff794,_0x2f9188)){if(_0x23320c[_0xc07e('0xf8')]>=_0x2f9188[_0xc07e('0x1ba')]){_0x2e302c[_0xc07e('0xff')](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1bb'));}else{_0x2e302c['stateGlobal'](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1bb'));}}break;case'5':_0x2f9188[_0xc07e('0x6a')]+=0x1;_0x23320c[_0xc07e('0xb1')]=0x5;_0x23320c[_0xc07e('0xb2')]=_0xc07e('0x1bc');_0x23320c[_0xc07e('0x10c')]+=0x1;_0x23320c[_0xc07e('0x10b')]+=0x1;ami[_0xc07e('0x53')](_0xc07e('0x1bd'),ut[_0xc07e('0xf1')](_0x4ff794,_0xc07e('0x1be')));_0x2e302c[_0xc07e('0xd4')](_0x23320c)['catch'](loggerCatch(_0xc07e('0x1bf')));if(_0x2e302c[_0xc07e('0x1a5')](0x5,_0x4ff794,_0x2f9188)){if(_0x23320c[_0xc07e('0x10c')]>=_0x2f9188[_0xc07e('0x1a7')]){_0x2e302c[_0xc07e('0xff')](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1c0'));}else{_0x2e302c[_0xc07e('0x1b6')](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1c0'));}}break;case'8':_0x2f9188['outboundCongestionCallsDay']+=0x1;_0x23320c['state']=0x8;_0x23320c[_0xc07e('0xb2')]=_0xc07e('0x1c1');_0x23320c[_0xc07e('0xf7')]+=0x1;_0x23320c[_0xc07e('0x10b')]+=0x1;ami['emit'](_0xc07e('0x1c2'),ut[_0xc07e('0xf1')](_0x4ff794,_0xc07e('0x1c3')));_0x2e302c[_0xc07e('0xd4')](_0x23320c)[_0xc07e('0xbd')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2e302c['checkRetriveMax'](0x8,_0x4ff794,_0x2f9188)){if(_0x23320c[_0xc07e('0xf7')]>=_0x2f9188[_0xc07e('0x1aa')]){_0x2e302c['createStateFinal'](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1c4'));}else{_0x2e302c[_0xc07e('0x1b6')](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1c4'));}}break;case'11':_0x2f9188[_0xc07e('0x1c5')]+=0x1;_0x23320c[_0xc07e('0xb1')]=0xb;_0x23320c[_0xc07e('0xb2')]=_0xc07e('0x126');_0x23320c[_0xc07e('0xfa')]+=0x1;_0x23320c['countglobal']+=0x1;_0x2e302c[_0xc07e('0xd4')](_0x23320c)['catch'](loggerCatch(_0xc07e('0x12a')));if(_0x2e302c[_0xc07e('0x1a5')](0xb,_0x4ff794,_0x2f9188)){if(_0x23320c['countabandonedretry']>=_0x2f9188[_0xc07e('0x127')]){_0x2e302c[_0xc07e('0xff')](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1c6'));}else{_0x2e302c[_0xc07e('0x1b6')](_0x23320c,_0x2cbbd5,_0x1465d2,'reason\x2011\x20abandoned');}}break;case'20':_0x2f9188[_0xc07e('0x72')]+=0x1;_0x23320c[_0xc07e('0xb1')]=0x14;_0x23320c[_0xc07e('0xb2')]=_0xc07e('0x1c7');_0x23320c[_0xc07e('0xfb')]+=0x1;_0x23320c[_0xc07e('0x10b')]+=0x1;ami[_0xc07e('0x53')](_0xc07e('0x1c8'),ut[_0xc07e('0xf1')](_0x4ff794,_0xc07e('0x1c9')));_0x2e302c[_0xc07e('0xd4')](_0x23320c)[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x1ca')));if(_0x2e302c[_0xc07e('0x1a5')](0x14,_0x4ff794,_0x2f9188)){if(_0x23320c[_0xc07e('0xfb')]>=_0x2f9188[_0xc07e('0x1af')]){_0x2e302c['createStateFinal'](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1cb'));}else{_0x2e302c[_0xc07e('0x1b6')](_0x23320c,_0x2cbbd5,_0x1465d2,_0xc07e('0x1cb'));}}break;default:_0x2f9188[_0xc07e('0x73')]+=0x1;_0x23320c[_0xc07e('0xb1')]=0xc;_0x23320c[_0xc07e('0xb2')]=_0x538338[_0xc07e('0x111')];_0x2e302c[_0xc07e('0xd4')](_0x23320c)[_0xc07e('0xbd')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2e302c[_0xc07e('0x1a5')](_0x538338[_0xc07e('0x111')],_0x4ff794,_0x2f9188)){if(_0x23320c['countbusyretry']+_0x23320c[_0xc07e('0xf7')]+_0x23320c[_0xc07e('0xf8')]+_0x23320c[_0xc07e('0x10d')]+_0x23320c[_0xc07e('0xf9')]+_0x23320c[_0xc07e('0xfa')]+_0x23320c[_0xc07e('0xf4')]+_0x23320c['countagentrejectretry']>=_0x2f9188['dialGlobalMaxRetry']){_0x2e302c[_0xc07e('0x1b6')](_0x23320c,_0x2cbbd5,_0x1465d2,_0x538338[_0xc07e('0x111')]);}else{_0x2e302c[_0xc07e('0xff')](_0x23320c,_0x2cbbd5,_0x1465d2,_0x538338[_0xc07e('0x111')]);}}}});};Dialer[_0xc07e('0xb5')]['stateGlobal']=function(_0x38f093,_0x431b20,_0xb97176,_0x124d32){var _0x405901=new Final(_0x38f093);_0x405901['state']=0xf;_0x405901['statedesc']='Global';this[_0xc07e('0xff')](_0x405901,_0x431b20,_0xb97176,_0x124d32);};Dialer[_0xc07e('0xb5')][_0xc07e('0xff')]=function(_0x54021e,_0x17a944,_0x539dc6,_0x309778){this[_0xc07e('0xd3')](_0x54021e)[_0xc07e('0x41')](function(){return _0x17a944(msgResponse(_0xc07e('0x1b1'),_0xc07e('0x1cc'),_0x309778));})[_0xc07e('0xbd')](function(){return _0x539dc6(msgResponse(_0xc07e('0x1cd'),_0xc07e('0x147'),_0xc07e('0x1ce')));});};Dialer[_0xc07e('0xb5')][_0xc07e('0x7')]=function(_0x2e4067){var _0x342328=_0x2e4067[_0xc07e('0x1cf')]/0x64;var _0x469c96=_0x2e4067[_0xc07e('0x6e')]/(_0x2e4067[_0xc07e('0x6e')]+_0x2e4067[_0xc07e('0x68')]);var _0x1db4e2=Math[_0xc07e('0x1d0')](_0x2e4067[_0xc07e('0x7d')]*(_0x2e4067[_0xc07e('0x1d1')]/0x64));var _0x1cab32=Math[_0xc07e('0x1d0')](_0x2e4067['predictiveIntervalAvailable']*(_0x2e4067[_0xc07e('0x1d2')]/0x64));var _0x2b1117=_0x2e4067['available']+_0x2e4067[_0xc07e('0x5e')];var _0x2036a6=Math[_0xc07e('0x1d3')](_0x2e4067[_0xc07e('0x80')]*_0x2e4067[_0xc07e('0x97')]*_0x2e4067[_0xc07e('0x7b')]*_0x2e4067[_0xc07e('0x1d4')]);if(_[_0xc07e('0x43')](_0x2e4067[_0xc07e('0x29')])){if(!_[_0xc07e('0x43')](_0x2e4067[_0xc07e('0x28')])){_0x2e4067[_0xc07e('0x28')]=undefined;loggerPredictive[_0xc07e('0xa1')](_0xc07e('0x1d5'),_0xc07e('0x1d6'));}if(!_[_0xc07e('0x43')](_0x2e4067[_0xc07e('0x9d')])){loggerPredictive[_0xc07e('0xa1')](_0xc07e('0x1d5'),_0xc07e('0x1d7'));clearInterval(_0x2e4067[_0xc07e('0x9d')]);_0x2e4067['handlePredictive']=undefined;}_0x2e4067[_0xc07e('0x29')]=moment()[_0xc07e('0x85')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xc07e('0x8a')](_0x2e4067[_0xc07e('0x46')],_0xc07e('0x1d8'),_0x2e4067[_0xc07e('0x29')]);this['handlePower'](_0x2e4067,0x1);}else if(ifInterval(_0x2e4067[_0xc07e('0x1d9')],_0x2e4067[_0xc07e('0x29')])){this[_0xc07e('0x15a')](_0x2e4067,0x1);loggerPredictiveCalls[_0xc07e('0x8a')](_0xc07e('0x1da'),_0x2e4067[_0xc07e('0x29')],_0x2e4067[_0xc07e('0x46')]);_0x2e4067[_0xc07e('0x80')]=0x0;_0x2e4067[_0xc07e('0x7a')]=0x0;}else if(_0x342328<_0x469c96&&_0x2e4067[_0xc07e('0x1db')]==='dropRate'){freeVariablesPredictive(_0x2e4067);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xc07e('0x1dc'),_0x469c96,_0xc07e('0x29'),_0x2e4067[_0xc07e('0x46')]);}else if(_0x2036a6<_0x2e4067['predictiveIntervalErlangCallsDroppedCalls']&&_0x2e4067[_0xc07e('0x1db')]===_0xc07e('0x1dd')){freeVariablesPredictive(_0x2e4067);loggerPredictive['info'](_0xc07e('0x1de'),'Max\x20Drop\x20',_0x2036a6,_0xc07e('0x1df'),_0x2e4067[_0xc07e('0x7a')],'startProgressive',_0x2e4067[_0xc07e('0x46')]);}else if(!ifInterval(_0x2e4067[_0xc07e('0x1d9')],_0x2e4067[_0xc07e('0x29')])&&_[_0xc07e('0x43')](_0x2e4067[_0xc07e('0x28')])&&!_[_0xc07e('0x43')](_0x2e4067[_0xc07e('0x29')])){_0x2e4067[_0xc07e('0x28')]=moment()[_0xc07e('0x85')](_0xc07e('0x104'));loggerPredictive[_0xc07e('0x8a')](_0x2e4067[_0xc07e('0x46')],_0xc07e('0x1e0'),_0x2e4067[_0xc07e('0x28')]);this[_0xc07e('0xc8')](_0x2e4067[_0xc07e('0x1d9')])[_0xc07e('0x41')](this[_0xc07e('0x1e1')](_0x2e4067))[_0xc07e('0x41')](mergeDataErlangB(_0x2e4067))['then'](this[_0xc07e('0x1e2')](_0x2e4067))[_0xc07e('0xbd')](loggerCatchPredictive(_0xc07e('0x1e3'),_0x2e4067));}else if(!ifInterval(_0x2e4067[_0xc07e('0x1d9')],_0x2e4067[_0xc07e('0x28')])){_0x2e4067['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2e4067['startPredictive']=moment()[_0xc07e('0x85')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2e4067['name'],_0xc07e('0x1e4'),_0x2e4067[_0xc07e('0x28')]);clearInterval(_0x2e4067[_0xc07e('0x9d')]);_0x2e4067[_0xc07e('0x9d')]=undefined;this['averageHandleTime'](_0x2e4067[_0xc07e('0x1d9')])[_0xc07e('0x41')](this[_0xc07e('0x1e1')](_0x2e4067))[_0xc07e('0x41')](mergeDataErlangB(_0x2e4067))['then'](this[_0xc07e('0x1e2')](_0x2e4067))[_0xc07e('0xbd')](loggerCatchPredictive(_0xc07e('0x1e5'),_0x2e4067));}else if(_0x2e4067[_0xc07e('0x7d')]&&_0x2b1117<_0x2e4067[_0xc07e('0x7d')]-_0x1cab32){freeVariablesPredictive(_0x2e4067);loggerPredictive['info'](_0x2e4067[_0xc07e('0x46')],_0xc07e('0x1e6'),_0x2b1117,_0xc07e('0x1e7'),_0x2e4067['predictiveIntervalAvailable'],'-',_0x1cab32,'=',_0x2e4067['predictiveIntervalAvailable']-_0x1cab32,')');}else if(_0x2e4067[_0xc07e('0x7d')]&&_0x2b1117>_0x2e4067[_0xc07e('0x7d')]+_0x1db4e2){freeVariablesPredictive(_0x2e4067);loggerPredictive['info'](_0x2e4067[_0xc07e('0x46')],_0xc07e('0x1e6'),_0x2b1117,_0xc07e('0x1e8'),_0x2e4067[_0xc07e('0x7d')],'+',_0x1db4e2,'=',_0x2e4067[_0xc07e('0x7d')]+_0x1db4e2,')');}};Dialer['prototype'][_0xc07e('0x1e1')]=function(_0x50216b){var _0x579a12=this;return function(_0x36446c){return new BPromise(function(_0x394359,_0x4e6036){_[_0xc07e('0x9b')](_0x50216b,_0x36446c[0x0]);if(checkGetDataPredictive(_0x36446c[0x0])){var _0x1f90e8=_0x50216b[_0xc07e('0x7d')]=_0x50216b[_0xc07e('0x5e')]+_0x50216b[_0xc07e('0x58')];var _0x3f2655=_0x50216b['dialPredictiveInterval']*0x3c;var _0x402eed=_0x36446c[0x0][_0xc07e('0x76')]+_0x36446c[0x0][_0xc07e('0x75')];var _0x197422=(_0x36446c[0x0]['predictiveIntervalAnsweredCalls']+_0x36446c[0x0][_0xc07e('0x78')]+_0x36446c[0x0][_0xc07e('0x77')])/_0x36446c[0x0]['predictiveIntervalTotalCalls'];_0x50216b[_0xc07e('0x7b')]=_0x197422>0x0?_0x197422:0x1;switch(_0x50216b[_0xc07e('0x1db')]){case'dropRate':var _0x1614e0=_0x50216b[_0xc07e('0x1cf')]/0x64;return _0x579a12[_0xc07e('0x1e9')](_0x1f90e8,_0x3f2655,_0x402eed,_0x197422,_0x1614e0)['then'](function(_0x10eb27){return _0x394359(_0x10eb27);});case _0xc07e('0x1ea'):var _0x34146e=_0x50216b[_0xc07e('0x1cf')]/0x64;return _0x579a12[_0xc07e('0x1eb')](_0x1f90e8,_0x3f2655,_0x402eed,_0x197422,_0x34146e)[_0xc07e('0x41')](function(_0x79f141){return _0x394359(_0x79f141);});default:return _0x4e6036(msgResponse('[getDataPredictive]',_0xc07e('0x147'),_0xc07e('0x1ec')));}}else{return _0x4e6036(msgResponse(_0xc07e('0x1ed'),_0xc07e('0x147'),'check\x20failure'));}});};};Dialer[_0xc07e('0xb5')]['getDataPredictiveOld']=function(_0x38e87d){var _0x3cf74c=this;return function(_0x435617){return new BPromise(function(_0x2fe6ca,_0x13d584){_[_0xc07e('0x9b')](_0x38e87d,_0x435617[0x0]);if(checkGetDataPredictive(_0x435617[0x0])){loggerPredictive['info'](JSON[_0xc07e('0x84')](_0x435617[0x0]));if(_0x38e87d[_0xc07e('0x1db')]===_0xc07e('0x1dd')){return _0x3cf74c[_0xc07e('0xd2')](_0x38e87d['id'])['then'](function(_0x244adb){var _0x379777=_0x38e87d[_0xc07e('0x59')]-_0x244adb[0x0][_0xc07e('0x1ee')];var _0x198d3b=_0x38e87d[_0xc07e('0x1d9')]*0x3c;var _0x541fd9=_0x435617[0x0][_0xc07e('0x76')]+_0x435617[0x0][_0xc07e('0x75')];var _0x2b7209=(_0x435617[0x0]['predictiveIntervalAnsweredCalls']+_0x435617[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x435617[0x0][_0xc07e('0x77')])/_0x435617[0x0][_0xc07e('0x7e')];var _0x4e7225=_0x38e87d[_0xc07e('0x1cf')]/0x64;_0x38e87d[_0xc07e('0x7c')]=_0x244adb[0x0][_0xc07e('0x1ee')]||0x0;_0x38e87d[_0xc07e('0x7b')]=_0x2b7209>0x0?_0x2b7209:0x1;return _0x3cf74c['abandonmentRate'](_0x379777,_0x198d3b,_0x541fd9,_0x2b7209,_0x4e7225);})[_0xc07e('0x41')](function(_0x3e6bfc){return _0x2fe6ca(_0x3e6bfc);})[_0xc07e('0xbd')](function(_0x55cc18){return _0x13d584(msgResponse(_0xc07e('0x1ef'),_0xc07e('0x147'),JSON[_0xc07e('0x84')](_0x55cc18)));});}if(_0x38e87d[_0xc07e('0x1db')]==='agentBusyFactor'){return _0x3cf74c['getVoiceQueueRtPauses'](_0x38e87d['id'])[_0xc07e('0x41')](function(_0x529187){var _0xc7a69c=_0x38e87d[_0xc07e('0x59')]-_0x529187[0x0][_0xc07e('0x1ee')];var _0x4dfffc=_0x38e87d[_0xc07e('0x1d9')]*0x3c;var _0x350577=_0x435617[0x0][_0xc07e('0x76')]+_0x435617[0x0][_0xc07e('0x75')];var _0x2900a6=(_0x435617[0x0][_0xc07e('0x74')]+_0x435617[0x0][_0xc07e('0x78')]+_0x435617[0x0][_0xc07e('0x77')])/_0x435617[0x0][_0xc07e('0x7e')];var _0x5051fb=_0x38e87d[_0xc07e('0x1cf')]/0x64;_0x38e87d[_0xc07e('0x7c')]=_0x529187[0x0][_0xc07e('0x1ee')]||0x0;_0x38e87d[_0xc07e('0x7b')]=_0x2900a6>0x0?_0x2900a6:0x1;return _0x3cf74c[_0xc07e('0x1eb')](_0xc7a69c,_0x4dfffc,_0x350577,_0x2900a6,_0x5051fb);})[_0xc07e('0x41')](function(_0x42313c){return _0x2fe6ca(_0x42313c);})['catch'](function(_0x279e33){return _0x13d584(msgResponse(_0xc07e('0x1ef'),_0xc07e('0x147'),JSON['stringify'](_0x279e33)));});}}else{return _0x13d584(msgResponse(_0xc07e('0x1ed'),_0xc07e('0x147'),_0xc07e('0x1f0')));}});};};Dialer[_0xc07e('0xb5')][_0xc07e('0x1e2')]=function(_0x8be45){var _0x4f4918=this;return function(){var _0x1cae03=0x0;var _0x2627e8=Math[_0xc07e('0x1d3')](_0x8be45[_0xc07e('0x1f1')]*0x3e8);if(_0x2627e8>0x0){_0x2627e8=_0x2627e8<0x64?0x64:_0x2627e8;loggerPredictive[_0xc07e('0x8a')](_0x8be45[_0xc07e('0x46')],_0xc07e('0x1f2'),_0x2627e8,'milliseconds');_0x8be45[_0xc07e('0x9d')]=setInterval(function(){_0x4f4918[_0xc07e('0x9d')](_0x8be45);loggerPredictiveCalls['info'](_0xc07e('0x1f3'),_0x1cae03+=0x1);},_0x2627e8);}else{loggerPredictive[_0xc07e('0x8a')](_0x8be45[_0xc07e('0x46')],_0xc07e('0x1f4'));}};};Dialer[_0xc07e('0xb5')]['checkContactBlack']=function(_0x2d0b64,_0x6812b4){var _0x57f903=this;return function(_0x2ec14f){if(_['isEmpty'](_0x2ec14f)){if(_[_0xc07e('0xb9')](_0x6812b4[_0xc07e('0xde')])||!_0x6812b4['recallme']){if(_0x2d0b64[_0xc07e('0x64')]===_0xc07e('0x15c')){_0x2d0b64['queueStatusComplete']=_[_0xc07e('0x43')](_0x2d0b64['queueStatusComplete'])?!![]:_0x2d0b64['queueStatusComplete'];var _0x3346bf=uuid['v4']();_0x57f903[_0xc07e('0x26')][_0x3346bf]=new Action(_0x2d0b64,_0x6812b4,_0x3346bf);loggerBooked['info'](_0xc07e('0x1f5'),_0x3346bf,_0xc07e('0x1f6'),JSON[_0xc07e('0x84')](_0x2d0b64[_0xc07e('0x131')]),_0xc07e('0x1f7'),_0x2d0b64[_0xc07e('0x46')]);if(_0x2d0b64[_0xc07e('0x131')]){_0x2d0b64[_0xc07e('0x131')]=![];_0x57f903[_0xc07e('0x2a')][_0x57f903['actions'][_0x3346bf][_0xc07e('0xbf')]]=[];ami[_0xc07e('0xba')]({'actionid':_0x3346bf,'action':_0xc07e('0x1f8'),'queue':_0x2d0b64[_0xc07e('0x46')]})[_0xc07e('0xbd')](function(){_0x57f903['updateOriginated'](_0x2d0b64);_0x57f903['rescheduleContact']({'active':![],'ContactId':_0x57f903[_0xc07e('0x26')][_0x3346bf][_0xc07e('0x105')],'ListId':_0x57f903[_0xc07e('0x26')][_0x3346bf]['ListId'],'VoiceQueueId':_0x57f903[_0xc07e('0x26')][_0x3346bf][_0xc07e('0xdf')]||undefined,'CampaignId':_0x57f903['actions'][_0x3346bf][_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x1f9')));delete _0x57f903[_0xc07e('0x26')][_0x3346bf];});}else{loggerBooked[_0xc07e('0x8a')](_0xc07e('0x1fa'),JSON[_0xc07e('0x84')](_0x2d0b64['queueStatusComplete']),'Queue:\x20',_0x2d0b64['name']);_0x57f903[_0xc07e('0xbe')](_0x2d0b64);_0x57f903[_0xc07e('0xcb')]({'active':![],'ContactId':_0x57f903['actions'][_0x3346bf][_0xc07e('0x105')],'ListId':_0x57f903[_0xc07e('0x26')][_0x3346bf][_0xc07e('0xdd')],'VoiceQueueId':_0x57f903[_0xc07e('0x26')][_0x3346bf][_0xc07e('0xdf')]||undefined,'CampaignId':_0x57f903[_0xc07e('0x26')][_0x3346bf][_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x1f9')));delete _0x57f903[_0xc07e('0x26')][_0x3346bf];}}else{return _0x57f903[_0xc07e('0x171')](_0x2d0b64,_0x6812b4);}}else{if(getDiff(_0x6812b4[_0xc07e('0x1fb')])<_0x2d0b64[_0xc07e('0x1fc')]*0x3c){if(_0x6812b4[_0xc07e('0x160')]&&!_0x6812b4['Agent']['voicePause']){_0x57f903[_0xc07e('0x1f')][_0xc07e('0x134')](_0x6812b4['id'])[_0xc07e('0x136')](function(){_0x57f903[_0xc07e('0xbe')](_0x2d0b64);});}else{_0x57f903[_0xc07e('0xcc')]({'active':![]},_0x6812b4['id'],0x1)[_0xc07e('0x136')](function(){_0x57f903[_0xc07e('0xbe')](_0x2d0b64);});}}else{_0x2d0b64['outboundReCallsDay']+=0x1;_0x57f903[_0xc07e('0xbe')](_0x2d0b64);if(_0x2d0b64[_0xc07e('0x1fd')]){_0x57f903[_0xc07e('0xcb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x6812b4[_0xc07e('0x105')],'ListId':_0x6812b4[_0xc07e('0xdd')],'VoiceQueueId':_0x6812b4[_0xc07e('0xdf')]||undefined,'CampaignId':_0x6812b4[_0xc07e('0xe0')]||undefined})[_0xc07e('0xbd')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x57f903['createHistory'](createObjHistory(_0x2d0b64,_0x6812b4,_0xc07e('0x1fe'),0x17,_0xc07e('0x1ff')))[_0xc07e('0xbd')](loggerCatch(_0xc07e('0x200')));}else{_0x57f903[_0xc07e('0xdb')](createObjHistory(_0x2d0b64,_0x6812b4,'RECALLFAILEDTIMEOUT',0x16,_0xc07e('0x201')),_0xc07e('0x202'),_0xc07e('0x203'));}}}}else{_0x2d0b64['outboundBlacklistCallsDay']+=0x1;_0x57f903[_0xc07e('0xdb')](createObjHistory(_0x2d0b64,_0x6812b4,_0xc07e('0x204'),0xd,'Blacklist'),_0xc07e('0x205'),_0xc07e('0x206'));throw _0xc07e('0x207');}};};Dialer['prototype'][_0xc07e('0x164')]=function(_0x2305e6){var _0x56251b=this;var _0x3cff90=_0x2305e6[_0xc07e('0x208')]-_0x2305e6[_0xc07e('0x7f')]-_0x2305e6[_0xc07e('0xcf')];emitCampaignSummary(_0x2305e6);if(_0x3cff90>0x0){if(_0x3cff90>this[_0xc07e('0x24')]){_0x3cff90=this['maxNumberOriginate'];}_0x2305e6['temp']+=_0x3cff90;this[_0xc07e('0xd0')](_0x2305e6['id'],_0x3cff90,_0x2305e6[_0xc07e('0x209')],_0x2305e6)[_0xc07e('0x41')](function(_0x29d3d9){_0x2305e6[_0xc07e('0xcf')]-=_0x3cff90;_0x2305e6['temp']=_0x2305e6[_0xc07e('0xcf')]>0x0?_0x2305e6[_0xc07e('0xcf')]:0x0;if(!checkContactEmpty(_0x29d3d9)){_0x2305e6[_0xc07e('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xc07e('0x8a')](_0xc07e('0x20a')+_0x2305e6[_0xc07e('0x46')]);}else{_0x2305e6['originated']+=_0x29d3d9[_0xc07e('0xa3')];_0x2305e6[_0xc07e('0x44')]='RUNNING';for(var _0x47cce0=0x0;_0x47cce0<_0x29d3d9[_0xc07e('0xa3')];_0x47cce0+=0x1){_0x2305e6[_0xc07e('0x20b')]+=0x1;if(_['isNil'](_0x29d3d9[_0x47cce0])||_[_0xc07e('0xb9')](_0x29d3d9[_0x47cce0]['Contact'])||_[_0xc07e('0xb9')](_0x29d3d9[_0x47cce0][_0xc07e('0x175')][_0xc07e('0x176')])){_0x56251b[_0xc07e('0xda')]('[actionOriginate]\x20',_0x2305e6,_0x29d3d9[_0x47cce0]);}else{_0x56251b[_0xc07e('0xc6')](_['pick'](_0x29d3d9[_0x47cce0],[_0xc07e('0xe0'),_0xc07e('0x20c')]))[_0xc07e('0x41')](_0x56251b[_0xc07e('0x20d')](_0x2305e6,_0x29d3d9[_0x47cce0]))[_0xc07e('0xbd')](_0x56251b[_0xc07e('0xd8')](_0xc07e('0x20e'),_0x2305e6));}}}})[_0xc07e('0xbd')](loggerGetContactDialer('[getContactCampaign2]',_0x2305e6,_0x3cff90));}};Dialer[_0xc07e('0xb5')]['handlePower']=function(_0x3ff0c7,_0x21cb0a){var _0xabe246=this;var _0x59dbce=[];var _0x46af38=_0x21cb0a>=0x1?_0x21cb0a:0x1;if(_0x3ff0c7[_0xc07e('0x64')]==='booked'){_0x46af38=0x1;}var _0x7c86ca=Math[_0xc07e('0x1d3')](_0x3ff0c7[_0xc07e('0x58')]*_0x46af38)-_0x3ff0c7[_0xc07e('0x7f')]-_0x3ff0c7[_0xc07e('0xcf')];emitVoiceQueueSummary(_0x3ff0c7);if(_0x3ff0c7[_0xc07e('0x20f')]>0x0){var _0x13a88d=_0x3ff0c7[_0xc07e('0x20f')]-_0x3ff0c7[_0xc07e('0x7f')]-_0x3ff0c7['talking']-_0x3ff0c7[_0xc07e('0xcf')]-_0x3ff0c7[_0xc07e('0x5a')];if(_0x7c86ca>_0x13a88d){_0x7c86ca=_0x13a88d;}}if(_0x7c86ca>0x0){if(_0x3ff0c7['dialMethod']===_0xc07e('0x15c')){_0x7c86ca=0x1;}if(_0x7c86ca>this[_0xc07e('0x24')]){_0x7c86ca=this[_0xc07e('0x24')];}_0x3ff0c7[_0xc07e('0xcf')]+=_0x7c86ca;for(var _0x3fd35b in this[_0xc07e('0x22')]){if(typeof this[_0xc07e('0x22')][_0x3fd35b]!==_0xc07e('0xa4')){if(this[_0xc07e('0x22')][_0x3fd35b][_0xc07e('0xb1')]===_0xc07e('0x210')&&this[_0xc07e('0x22')][_0x3fd35b][_0xc07e('0xbb')]===_0xc07e('0xe6')){_0x59dbce[_0xc07e('0x12f')](this[_0xc07e('0x22')][_0x3fd35b]['id']);}}}this[_0xc07e('0xce')](_0x3ff0c7['id'],_0x59dbce,_0x7c86ca,_0x3ff0c7[_0xc07e('0x209')],_0x3ff0c7)[_0xc07e('0x41')](function(_0x2b6260){_0x3ff0c7[_0xc07e('0xcf')]-=_0x7c86ca;_0x3ff0c7[_0xc07e('0xcf')]=_0x3ff0c7[_0xc07e('0xcf')]>0x0?_0x3ff0c7[_0xc07e('0xcf')]:0x0;if(!checkContactEmpty(_0x2b6260)){_0xabe246[_0xc07e('0xc2')](_0x3ff0c7)[_0xc07e('0x41')](sendMessageReschedule(_0x3ff0c7))['catch'](loggerCatch(_0xc07e('0x211')));}else{_0x3ff0c7[_0xc07e('0x7f')]+=_0x2b6260[_0xc07e('0xa3')];_0x3ff0c7[_0xc07e('0x44')]=_0x3ff0c7[_0xc07e('0x64')]==='booked'?_0xc07e('0x17e'):_0xc07e('0x212');for(var _0x598961=0x0;_0x598961<_0x2b6260[_0xc07e('0xa3')];_0x598961+=0x1){if(_[_0xc07e('0xb9')](_0x2b6260[_0x598961])||_['isNil'](_0x2b6260[_0x598961][_0xc07e('0x175')])||_[_0xc07e('0xb9')](_0x2b6260[_0x598961][_0xc07e('0x175')]['phone'])){_0xabe246[_0xc07e('0xda')](_0xc07e('0x213'),_0x3ff0c7,_0x2b6260[_0x598961]);}else{_0xabe246['checkIsBlackList'](_[_0xc07e('0xdc')](_0x2b6260[_0x598961],['VoiceQueueId','Contact.phone']))[_0xc07e('0x41')](_0xabe246[_0xc07e('0x20d')](_0x3ff0c7,_0x2b6260[_0x598961]))[_0xc07e('0xbd')](_0xabe246['loggerHandler']('[actionOriginate]\x20',_0x3ff0c7));}}}})[_0xc07e('0xbd')](loggerGetContactDialer('[getContactDialer2]',_0x3ff0c7,_0x7c86ca));}};Dialer[_0xc07e('0xb5')][_0xc07e('0x9d')]=function(_0x4032e0){if(_0x4032e0[_0xc07e('0x20f')]>0x0){var _0x20f269=_0x4032e0[_0xc07e('0x20f')]-_0x4032e0[_0xc07e('0x7f')]-_0x4032e0[_0xc07e('0x5e')];if(_0x20f269>0x0){this[_0xc07e('0x214')](_0x4032e0);}else{loggerPredictiveCalls[_0xc07e('0x8a')]('[handlePredictive][limitChannel]');}}else{this[_0xc07e('0x214')](_0x4032e0);}};Dialer['prototype'][_0xc07e('0x214')]=function(_0x3a90ad){var _0x550f4d=this;var _0x475ff3=[];_0x3a90ad['originated']+=0x1;for(var _0x4ced87 in this[_0xc07e('0x22')]){if(typeof this[_0xc07e('0x22')][_0x4ced87]!==_0xc07e('0xa4')){if(this['agents'][_0x4ced87][_0xc07e('0xb1')]===_0xc07e('0x210')&&this[_0xc07e('0x22')][_0x4ced87]['status']===_0xc07e('0xe6')){_0x475ff3['push'](this[_0xc07e('0x22')][_0x4ced87]['id']);}}}this[_0xc07e('0xce')](_0x3a90ad['id'],_0x475ff3,0x1,_0x3a90ad[_0xc07e('0x209')],_0x3a90ad)[_0xc07e('0x41')](function(_0x658a8b){if(!checkContactEmpty(_0x658a8b)){checkContactLowerLimitOriginate(_0x3a90ad,0x1,0x0);_0x550f4d[_0xc07e('0xc2')](_0x3a90ad)['then'](sendMessageReschedule(_0x3a90ad))[_0xc07e('0xbd')](loggerCatch('[countReScheduled]\x20'));}else{_0x3a90ad[_0xc07e('0x44')]=_0xc07e('0x212');if(_[_0xc07e('0xb9')](_0x658a8b[0x0])||_['isNil'](_0x658a8b[0x0][_0xc07e('0x175')])||_[_0xc07e('0xb9')](_0x658a8b[0x0][_0xc07e('0x175')][_0xc07e('0x176')])){_0x550f4d[_0xc07e('0xda')]('[actionOriginate]\x20',_0x3a90ad,_0x658a8b[0x0]);}else{_0x550f4d[_0xc07e('0xc3')](_[_0xc07e('0xdc')](_0x658a8b[0x0],[_0xc07e('0xdf'),'Contact.phone']))[_0xc07e('0x41')](_0x550f4d['checkContactBlack'](_0x3a90ad,_0x658a8b[0x0]))[_0xc07e('0xbd')](_0x550f4d[_0xc07e('0xd8')]('[actionOriginatePredictive]\x20',_0x3a90ad));}}})[_0xc07e('0xbd')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3a90ad,0x1));emitVoiceQueueSummary(_0x3a90ad);};Dialer[_0xc07e('0xb5')][_0xc07e('0x1e9')]=function(_0x585221,_0x460ad5,_0x55beb0,_0x303335,_0x40b852,_0x3520f5){loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x215'));loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x216'),_0x585221);loggerPredictive[_0xc07e('0x8a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x460ad5);loggerPredictive[_0xc07e('0x8a')]('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',_0x55beb0);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x217'),_0x303335);loggerPredictive['info'](_0xc07e('0x218'),_0x40b852);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x91'));return new BPromise(function(_0x3c18f8,_0x1bc653){if(_0x585221<=0x0||isNaN(_0x585221)){return _0x1bc653(msgResponse('[abandonmentRate]',_0xc07e('0x4f'),'m\x20=\x20'+_0x585221));}if(_0x55beb0<=0x0||isNaN(_0x55beb0)){return _0x1bc653(msgResponse(_0xc07e('0x219'),_0xc07e('0x4f'),_0xc07e('0x21a')+_0x55beb0));}if(_0x303335<=0x0||isNaN(_0x303335)){return _0x1bc653(msgResponse('[abandonmentRate]','Error',_0xc07e('0x21b')+_0x303335));}if(_0x460ad5<=0x0||isNaN(_0x460ad5)){return _0x1bc653(msgResponse(_0xc07e('0x219'),_0xc07e('0x4f'),_0xc07e('0x21c')+_0x460ad5));}if(_0x40b852<=0x0||isNaN(_0x40b852)){return _0x1bc653(msgResponse(_0xc07e('0x219'),_0xc07e('0x4f'),_0xc07e('0x21d')+_0x40b852));}_0x3520f5=_0x3520f5||0x0;var _0x2b2a8b=0x1/_0x55beb0;var _0x4df83c=0x0;var _0x1b95cf=0x0;var _0x25fd9a=0x0;var _0x225543=0x0;for(var _0x440626=0x0;_0x25fd9a<_0x40b852;_0x440626+=0x1){_0x1b95cf=_0x440626/_0x460ad5;_0x4df83c=(_0x303335*_0x1b95cf+_0x3520f5)/_0x2b2a8b;_0x25fd9a=erlangb(_0x4df83c,_0x585221);_0x225543=_0x4df83c/_0x585221*(0x1-erlangb(_0x4df83c,_0x585221));}return _0x3c18f8({'erlangCalls':_0x440626,'erlangCallToSecond':_0x460ad5/_0x440626,'erlangAbandonmentRate':_0x25fd9a,'erlangBusyFactor':_0x225543});});};Dialer['prototype'][_0xc07e('0x1eb')]=function(_0x3453ef,_0x251c5e,_0x18e2df,_0x31da25,_0x210e9a,_0x568181){loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x21e'));loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x216'),_0x3453ef);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x21f'),_0x251c5e);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x220'),_0x18e2df);loggerPredictive[_0xc07e('0x8a')](_0xc07e('0x217'),_0x31da25);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x210e9a);loggerPredictive['info'](_0xc07e('0x91'));return new BPromise(function(_0x1cccfb,_0x2b8997){if(_0x3453ef<=0x0||isNaN(_0x3453ef)){return _0x2b8997(msgResponse(_0xc07e('0x221'),_0xc07e('0x4f'),_0xc07e('0x222')+_0x3453ef));}if(_0x18e2df<=0x0||isNaN(_0x18e2df)){return _0x2b8997(msgResponse('[busyFactor]',_0xc07e('0x4f'),'Ts\x20=\x20'+_0x18e2df));}if(_0x31da25<=0x0||isNaN(_0x31da25)){return _0x2b8997(msgResponse('[busyFactor]','Error',_0xc07e('0x21b')+_0x31da25));}if(_0x251c5e<=0x0||isNaN(_0x251c5e)){return _0x2b8997(msgResponse('[busyFactor]',_0xc07e('0x4f'),_0xc07e('0x21c')+_0x251c5e));}if(_0x210e9a<=0x0||isNaN(_0x210e9a)){return _0x2b8997(msgResponse(_0xc07e('0x221'),_0xc07e('0x4f'),_0xc07e('0x223')+_0x210e9a));}_0x568181=_0x568181||0x0;var _0x252745=0x1/_0x18e2df;var _0x4de0e7=0x0;var _0x462a02=0x0;var _0x543cd4=0x0;var _0x2e9525=0x0;for(var _0x1e2fad=0x0;_0x2e9525<_0x210e9a;_0x1e2fad+=0x1){_0x462a02=_0x1e2fad/_0x251c5e;_0x4de0e7=(_0x31da25*_0x462a02+_0x568181)/_0x252745;_0x543cd4=erlangb(_0x4de0e7,_0x3453ef);_0x2e9525=_0x4de0e7/_0x3453ef*(0x1-erlangb(_0x4de0e7,_0x3453ef));}return _0x1cccfb({'erlangCalls':_0x1e2fad,'erlangCallToSecond':_0x251c5e/_0x1e2fad,'erlangAbandonmentRate':_0x543cd4,'erlangBusyFactor':_0x2e9525});});};module['exports']=Dialer; \ No newline at end of file +var _0xe755=['sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[actions]','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','temp','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','isNil','variable','amdstatus','exten','value','HANGUP','uniqueid','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','ContactId','[rescheduleContact][Machine]','dialAMDActive','amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countdropretry','countagentrejectretry','reason19\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','roundrobin','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','indexOf','true','timezones','content','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:dialPreviewRecallReminder','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIsTrunkReachable','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','dialPredictiveOptimization','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','Interval','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]'];(function(_0x4c86dd,_0x20e861){var _0x3a5860=function(_0x5ecc4d){while(--_0x5ecc4d){_0x4c86dd['push'](_0x4c86dd['shift']());}};_0x3a5860(++_0x20e861);}(_0xe755,0x184));var _0x5e75=function(_0x53a548,_0xc48b69){_0x53a548=_0x53a548-0x0;var _0x5d34f3=_0xe755[_0x53a548];return _0x5d34f3;};'use strict';var util=require('util');var _=require(_0x5e75('0x0'));var BPromise=require(_0x5e75('0x1'));var uuid=require(_0x5e75('0x2'));var moment=require(_0x5e75('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x5e75('0x4'));var ut=require(_0x5e75('0x5'));var config=require(_0x5e75('0x6'));var logger=require(_0x5e75('0x7'))(_0x5e75('0x8'));var loggerBooked=require(_0x5e75('0x7'))(_0x5e75('0x9'));var loggerPredictive=require(_0x5e75('0x7'))(_0x5e75('0xa'));var loggerPredictiveCalls=require(_0x5e75('0x7'))(_0x5e75('0xb'));var loggerSyncQueueSummary=require(_0x5e75('0x7'))(_0x5e75('0xc'));var ami=require('../ami');config[_0x5e75('0xd')]=_['defaults'](config[_0x5e75('0xd')],{'host':_0x5e75('0xe'),'port':0x18eb});var io=require(_0x5e75('0xf'))(new Redis(config[_0x5e75('0xd')]));var cmHopper=require(_0x5e75('0x10'));var cmHopperHistory=require(_0x5e75('0x11'));var cmHopperBlack=require(_0x5e75('0x12'));var voiceQueueRt=require(_0x5e75('0x13'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0x5e75('0x14'));var Final=require('./final');var AgentComplete=require(_0x5e75('0x15'));var QueueCallerAbandon=require(_0x5e75('0x16'));var Hangup=require(_0x5e75('0x17'));var ipAgi=process[_0x5e75('0x18')]['XCALLY_IP_AGI']||_0x5e75('0x19');var strategy={'rrmemory':_0x5e75('0x1a'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5e75('0x1b')][_0x5e75('0x1c')]=function(_0x51edbc){this[_0x5e75('0x1d')]=this['tail']?this[_0x5e75('0x1d')][_0x5e75('0x1e')](_0x51edbc):_0x51edbc();};function Dialer(_0x32210a,_0x79a435){this[_0x5e75('0x1f')]=new Sequence();this['preview']=_0x79a435;this['voiceQueues']=_0x32210a[_0x5e75('0x20')];this['campaigns']=_0x32210a[_0x5e75('0x21')];this[_0x5e75('0x22')]=_0x32210a[_0x5e75('0x22')];this[_0x5e75('0x23')]=_0x32210a[_0x5e75('0x23')];this[_0x5e75('0x24')]=config['maxNumberOriginate']||0x2;this[_0x5e75('0x25')]={};this[_0x5e75('0x26')]={};this['contactsId']={};this[_0x5e75('0x27')]={};this[_0x5e75('0x28')]={};this[_0x5e75('0x29')]={};this[_0x5e75('0x2a')]={};this[_0x5e75('0x2b')]={};this['queueBooked']={};this[_0x5e75('0x2c')]={};ami['on'](_0x5e75('0x2d'),this[_0x5e75('0x2e')][_0x5e75('0x2f')](this));ami['on'](_0x5e75('0x30'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x5e75('0x31'),this[_0x5e75('0x32')]['bind'](this));ami['on'](_0x5e75('0x33'),this[_0x5e75('0x34')][_0x5e75('0x2f')](this));ami['on']('custom:queuesummary',this[_0x5e75('0xc')]['bind'](this));ami['on'](_0x5e75('0x35'),this['syncHangup'][_0x5e75('0x2f')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x5e75('0x36'),this['syncVarSet']['bind'](this));ami['on'](_0x5e75('0x37'),this[_0x5e75('0x38')][_0x5e75('0x2f')](this));ami['on'](_0x5e75('0x39'),this['syncQueueStatusComplete'][_0x5e75('0x2f')](this));this[_0x5e75('0x3a')]();this[_0x5e75('0x3b')]();RpcSetting[_0x5e75('0x3c')]()['then'](function(_0x40c61a){previewRecallmeReminderInterval=_0x40c61a['previewRecallmeReminderInterval'];});}function isNotNull(_0x322ca6){return _0x322ca6!==null&&!_['isUndefined'](_0x322ca6);}function checkIsLoggedIn(_0x2bfd95,_0x5c09a5){return function(){if(_0x5c09a5<=0x0){_0x2bfd95[_0x5e75('0x3d')]=_0x5e75('0x3e');throw _0x2bfd95[_0x5e75('0x3f')]+_0x5e75('0x40');}};}function isActive(_0x1f9299){return _0x1f9299;}function checkIsActive(_0x1834b8,_0x37a298){return function(){if(!isActive(_0x37a298)){_0x1834b8[_0x5e75('0x3d')]=_0x5e75('0x41');throw _0x1834b8[_0x5e75('0x3f')]+_0x5e75('0x42');}};}function checkInterval(_0x9eafcd){return function(){if(!isNotNull(_0x9eafcd['Interval'])){_0x9eafcd[_0x5e75('0x3d')]=_0x5e75('0x43');throw _0x9eafcd[_0x5e75('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x9eafcd['Interval'][_0x5e75('0x44')])){_0x9eafcd['message']=_0x5e75('0x43');throw _0x9eafcd[_0x5e75('0x3f')]+_0x5e75('0x45');}if(!isNotNull(_['isEmpty'](_0x9eafcd[_0x5e75('0x46')]['Intervals']))){_0x9eafcd[_0x5e75('0x3d')]='INTERVAL_IS_NULL';throw _0x9eafcd[_0x5e75('0x3f')]+_0x5e75('0x45');}};}function msgResponse(_0xe91182,_0xc2da19,_0x106972){return{'action':_0xe91182,'response':_0xc2da19,'message':_0x106972,'stack':_0x106972};}function myreject(_0x374133){return function(_0x2cb1aa){return _0x374133(msgResponse(_0x5e75('0x47'),_0x5e75('0x48'),JSON[_0x5e75('0x49')](_0x2cb1aa)));};}function getSeconds(_0x5cb913,_0xfacb15){var _0x364f2c=moment(_0x5cb913)[_0x5e75('0x4a')](0x0);var _0x418b3b=moment(_0xfacb15)[_0x5e75('0x4a')](0x0);return _0x364f2c[_0x5e75('0x4b')](_0x418b3b,_0x5e75('0x4c'));}function emit(_0x3d5798,_0x96d12c,_0x12be57){io['to'](_0x3d5798)['emit'](_0x96d12c,_0x12be57);}function emitVoiceQueueSummary(_0xd57512){if(_0xd57512[_0x5e75('0x4d')]===_0x5e75('0x4e')){var _0x39f4f9={'id':_0xd57512['id'],'name':_0xd57512[_0x5e75('0x3f')],'strategy':_0xd57512[_0x5e75('0x4f')],'answered':_0xd57512[_0x5e75('0x50')],'available':_0xd57512['available'],'loggedIn':_0xd57512[_0x5e75('0x51')],'pTalking':_0xd57512[_0x5e75('0x52')],'sumBillable':_0xd57512[_0x5e75('0x53')],'sumDuration':_0xd57512['sumDuration'],'sumHoldTime':_0xd57512[_0x5e75('0x54')]||0x0,'talking':_0xd57512[_0x5e75('0x55')],'total':_0xd57512['total'],'type':_0xd57512[_0x5e75('0x4d')],'unmanaged':_0xd57512['unmanaged'],'abandoned':_0xd57512[_0x5e75('0x56')],'waiting':_0xd57512[_0x5e75('0x57')],'loggedInDb':_0xd57512['loggedInDb'],'dialActive':_0xd57512[_0x5e75('0x58')],'dialMethod':_0xd57512[_0x5e75('0x59')],'dialOriginateCallerIdName':_0xd57512['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xd57512[_0x5e75('0x5a')],'dialOriginateTimeout':_0xd57512['dialOriginateTimeout'],'dialPrefix':_0xd57512[_0x5e75('0x5b')],'outboundAnswerAgiCallsDay':_0xd57512['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xd57512[_0x5e75('0x5c')],'outboundBlacklistCallsDay':_0xd57512[_0x5e75('0x5d')],'outboundBusyCallsDay':_0xd57512['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xd57512[_0x5e75('0x5e')],'outboundDropCallsDayACS':_0xd57512[_0x5e75('0x5f')],'outboundDropCallsDayCallersExit':_0xd57512[_0x5e75('0x60')],'outboundDropCallsDayTimeout':_0xd57512[_0x5e75('0x61')],'outboundNoAnswerCallsDay':_0xd57512[_0x5e75('0x62')],'outboundNoSuchCallsDay':_0xd57512[_0x5e75('0x63')],'outboundOriginateFailureCallsDay':_0xd57512[_0x5e75('0x64')],'outboundReCallsDay':_0xd57512[_0x5e75('0x65')],'outboundRejectCallsDay':_0xd57512[_0x5e75('0x66')],'outboundUnknownCallsDay':_0xd57512[_0x5e75('0x67')],'predictiveIntervalAnsweredCalls':_0xd57512[_0x5e75('0x68')],'predictiveIntervalAvgHoldtime':_0xd57512['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xd57512['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xd57512[_0x5e75('0x69')],'predictiveIntervalDroppedCallsTimeout':_0xd57512[_0x5e75('0x6a')],'predictiveIntervalErlangCalls':_0xd57512[_0x5e75('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0xd57512[_0x5e75('0x6c')],'predictiveIntervalHitRate':_0xd57512['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xd57512[_0x5e75('0x6d')],'predictiveIntervalPauses':_0xd57512['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xd57512[_0x5e75('0x6e')],'predictiveIntervalTotalCalls':_0xd57512[_0x5e75('0x6f')],'message':_0xd57512['message'],'originated':_0xd57512[_0x5e75('0x70')],'erlangCalls':_0xd57512[_0x5e75('0x71')],'erlangCallToSecond':_0xd57512[_0x5e75('0x72')],'erlangAbandonmentRate':_0xd57512[_0x5e75('0x73')],'erlangBusyFactor':_0xd57512['erlangBusyFactor'],'startPredictive':_0xd57512[_0x5e75('0x29')],'startProgressive':_0xd57512[_0x5e75('0x2a')]};if(_0xd57512['Trunk']){_0x39f4f9[_0x5e75('0x74')]={'id':_0xd57512['Trunk']['id'],'name':_0xd57512[_0x5e75('0x74')][_0x5e75('0x3f')],'active':_0xd57512['Trunk'][_0x5e75('0x75')],'callerid':_0xd57512[_0x5e75('0x74')][_0x5e75('0x76')]};}if(_0xd57512[_0x5e75('0x46')]){_0x39f4f9[_0x5e75('0x46')]={'id':_0xd57512[_0x5e75('0x46')]['id'],'name':_0xd57512[_0x5e75('0x46')][_0x5e75('0x3f')]};}var _0x120cea=md5(JSON[_0x5e75('0x49')](_0x39f4f9));if(_0xd57512[_0x5e75('0x77')]!==_0x120cea){_0xd57512[_0x5e75('0x77')]=_0x120cea;emit(util[_0x5e75('0x78')](_0x5e75('0x79'),_0x39f4f9[_0x5e75('0x3f')]),_0x5e75('0x7a'),_0x39f4f9);}}}function emitCampaignSummary(_0x4c035c){if(_0x4c035c[_0x5e75('0x4d')]===_0x5e75('0x7b')){emit(util[_0x5e75('0x78')](_0x5e75('0x7c'),_0x4c035c[_0x5e75('0x3f')]),_0x5e75('0x7d'),_0x4c035c);}}function checkGetDataPredictive(_0x17e258){if(isNotNull(_0x17e258)&&!_[_0x5e75('0x7e')](_0x17e258)){loggerPredictive['info'](_0x5e75('0x7f'));loggerPredictive['info'](_0x5e75('0x80'),_0x17e258['predictiveIntervalTotalCalls']);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x82'),_0x17e258[_0x5e75('0x68')]);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x83'),_0x17e258['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x5e75('0x81')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17e258[_0x5e75('0x69')]);loggerPredictive['info'](_0x5e75('0x84'),_0x17e258[_0x5e75('0x85')]);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x86'),_0x17e258[_0x5e75('0x87')]);loggerPredictive['info'](_0x5e75('0x88'));if(_0x17e258['predictiveIntervalTotalCalls']>0x0){if(!_[_0x5e75('0x89')](_0x17e258[_0x5e75('0x87')])&&_0x17e258['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x5e75('0x81')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x5e75('0x89')](_0x17e258['predictiveIntervalAvgHoldtime'])&&_0x17e258['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x5e75('0x8a'));}else{loggerPredictive[_0x5e75('0x81')](_0x5e75('0x8b'));}}else{loggerPredictive[_0x5e75('0x81')](_0x5e75('0x8c'));}return![];}function mergeDataErlangB(_0x1b5341){return function(_0x39d5bf){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x5e75('0x81')](_0x5e75('0x8d'),_0x39d5bf[_0x5e75('0x71')]);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x8e'),_0x39d5bf['erlangCallToSecond']);loggerPredictive['info'](_0x5e75('0x8f'),_0x39d5bf['erlangAbandonmentRate']);loggerPredictive[_0x5e75('0x81')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39d5bf[_0x5e75('0x90')]);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x8f'),_0x39d5bf['erlangAbandonmentRate']);loggerPredictive['info'](_0x5e75('0x88'));_[_0x5e75('0x91')](_0x1b5341,_0x39d5bf);};}function getDiff(_0x1c5bec){var _0x44f150=moment()['milliseconds'](0x0);var _0x59c713=moment(_0x1c5bec)[_0x5e75('0x4a')](0x0);return _0x44f150['diff'](_0x59c713,_0x5e75('0x4c'));}function ifInterval(_0x505785,_0x32444f){if(_[_0x5e75('0x89')](_0x32444f)){return![];}return getDiff(_0x32444f)<_0x505785*0x3c;}function freeVariablesPredictive(_0x164324){if(isNotNull(_0x164324)){if(!_[_0x5e75('0x89')](_0x164324[_0x5e75('0x2a')])){_0x164324['startProgressive']=undefined;loggerPredictive['info'](_0x164324['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x5e75('0x89')](_0x164324[_0x5e75('0x29')])){_0x164324[_0x5e75('0x29')]=undefined;loggerPredictive['info'](_0x164324[_0x5e75('0x3f')],_0x5e75('0x92'));}if(!_[_0x5e75('0x89')](_0x164324[_0x5e75('0x93')])){clearInterval(_0x164324['handlePredictive']);_0x164324['handlePredictive']=undefined;loggerPredictive[_0x5e75('0x81')](_0x164324[_0x5e75('0x3f')],_0x5e75('0x94'));}}}function erlangb(_0x332f79,_0x29a7d0){if(_0x29a7d0===0x0){return 0x0;}var _0x21a044=0x1;for(var _0x24e08f=0x1;_0x24e08f<=_0x29a7d0;_0x24e08f+=0x1){_0x21a044=0x1+_0x21a044*_0x24e08f/_0x332f79;}return 0x1/_0x21a044;}function isVoiceQueueOutbound(_0x1bd7ff){return _0x1bd7ff==='outbound';}function isNotPreview(_0x10d86a){return _0x10d86a!==_0x5e75('0x95');}function isCampaignIvr(_0x5413d1){return _0x5413d1===_0x5e75('0x7b');}function getCallerId(_0x565f80,_0x44de56,_0xaabd3f){if(!_[_0x5e75('0x89')](_0xaabd3f)&&typeof _0xaabd3f==='string'&&!_['isEmpty'](_0xaabd3f)){if(!_['isUndefined'](_0x44de56)&&typeof _0x44de56==='string'&&!_[_0x5e75('0x7e')](_0x44de56)){return util[_0x5e75('0x78')]('\x22%s\x22\x20<%s>',_0x44de56,_0xaabd3f);}return util[_0x5e75('0x78')]('\x22%s\x22\x20<%s>',_0xaabd3f,_0xaabd3f);}if(!_['isUndefined'](_0x565f80)&&typeof _0x565f80===_0x5e75('0x96')&&!_[_0x5e75('0x7e')](_0x565f80)){return _0x565f80;}return _0x5e75('0x97');}function loggerCatchQueueSummary(_0xf97fed,_0x27b656){return function(_0x5459d5){freeVariablesPredictive(_0x27b656);emitVoiceQueueSummary(_0x27b656);emitCampaignSummary(_0x27b656);loggerSyncQueueSummary[_0x5e75('0x98')](_0xf97fed,util[_0x5e75('0x99')](_0x5459d5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1cca77,_0xe77543){return function(_0x1d307b){loggerPredictive[_0x5e75('0x98')](_0xe77543[_0x5e75('0x3f')],_0x1cca77);loggerPredictive[_0x5e75('0x98')](_0x1d307b[_0x5e75('0x9a')]);freeVariablesPredictive(_0xe77543);};}function loggerCatch(_0x21a04e){return function(_0x59156d){logger[_0x5e75('0x98')](_0x21a04e,util['inspect'](_0x59156d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x346087){return _0x346087&&!_[_0x5e75('0x89')](_0x346087)&&_0x346087['length']>0x0;}function decremetOriginate(_0x417d96){if(!_['isUndefined'](_0x417d96)&&_0x417d96!==null){if(typeof _0x417d96[_0x5e75('0x70')]!==_0x5e75('0x9b')){if(_0x417d96[_0x5e75('0x70')]>0x0){_0x417d96['originated']-=0x1;}else{logger['error'](_0x5e75('0x9c'));}}}else{logger['error'](_0x5e75('0x9d'));}}function checkContactLowerLimitOriginate(_0x2c6a5d,_0x465830,_0x149bc4){if(_0x465830>_0x149bc4){for(var _0x5a7086=0x0;_0x5a7086<_0x465830-_0x149bc4;_0x5a7086+=0x1){decremetOriginate(_0x2c6a5d);}}}function loggerGetContactDialer(_0x5479de,_0x3a2872,_0x337212){return function(_0x4bb7b2){checkContactLowerLimitOriginate(_0x3a2872,_0x337212,0x0);logger[_0x5e75('0x98')](_0x5479de,util[_0x5e75('0x99')](_0x4bb7b2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x416b8d){return function(_0x2a2b08){if(isNotNull(_0x2a2b08)&&isNotNull(_0x2a2b08[0x0])){if(_0x2a2b08[0x0][_0x5e75('0x9e')]>0x0){_0x416b8d[_0x5e75('0x3d')]='RESCHEDULED_CONTACTS';logger[_0x5e75('0x81')](_0x5e75('0x9f')+_0x416b8d[_0x5e75('0x3f')],_0x2a2b08[0x0][_0x5e75('0x9e')],'contacts');}else{_0x416b8d[_0x5e75('0x3d')]=_0x5e75('0xa0');logger[_0x5e75('0x81')](_0x5e75('0xa1')+_0x416b8d['name']);}}};}function notSendMessagesQueue(_0x49bdc5){if(_0x49bdc5[_0x5e75('0xa2')]){freeVariablesPredictive(_0x49bdc5);if(_0x49bdc5[_0x5e75('0x70')]===0x0&&_0x49bdc5['talking']===0x0&&_0x49bdc5[_0x5e75('0x57')]===0x0&&(_0x49bdc5[_0x5e75('0x52')]||0x0)===0x0){_0x49bdc5[_0x5e75('0xa2')]=![];_0x49bdc5[_0x5e75('0xa3')]=0x0;_0x49bdc5['message']='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x5e75('0xa4'),_0x49bdc5[_0x5e75('0x3f')],_0x5e75('0xa5'));}else{_0x49bdc5['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x5e75('0x98')](_0x5e75('0xa4'),_0x49bdc5[_0x5e75('0x3f')],_0x5e75('0xa6'));}emitVoiceQueueSummary(_0x49bdc5);}}function notSendMessagesCampaign(_0x3e4fec){if(_0x3e4fec[_0x5e75('0xa2')]){if(_0x3e4fec['originated']===0x0){_0x3e4fec[_0x5e75('0xa2')]=![];_0x3e4fec[_0x5e75('0x3d')]=_0x5e75('0x41');loggerSyncQueueSummary[_0x5e75('0x98')](_0x5e75('0xa7'),_0x3e4fec[_0x5e75('0x3f')],_0x5e75('0xa5'));}else{_0x3e4fec[_0x5e75('0x3d')]=_0x5e75('0xa8');loggerSyncQueueSummary[_0x5e75('0x98')](_0x5e75('0xa7'),_0x3e4fec[_0x5e75('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x3e4fec);}}function createObjHistory(_0x27faa4,_0x41bc59,_0x121616,_0x283cbb,_0x4361a5){_0x27faa4[_0x5e75('0x3d')]=_0x121616;var _0x206e2a=new Action(_0x27faa4,_0x41bc59);var _0x241aa6=new History(_0x206e2a);_0x241aa6[_0x5e75('0xa9')]=_0x283cbb;_0x241aa6[_0x5e75('0xaa')]=_0x4361a5;_0x241aa6[_0x5e75('0xab')]=_0x206e2a[_0x5e75('0xac')];return _0x241aa6;}Dialer[_0x5e75('0x1b')][_0x5e75('0x3b')]=function(){var _0x4d74f4=this;setInterval(function(){_0x4d74f4[_0x5e75('0xad')](_0x4d74f4[_0x5e75('0x27')],'[uniqueid]');_0x4d74f4[_0x5e75('0xad')](_0x4d74f4[_0x5e75('0x26')],_0x5e75('0xae'));},0x32c8);};Dialer['prototype'][_0x5e75('0xad')]=function(_0x49457d,_0x132dd2){var _0x389db6=this;for(var _0x115396 in _0x49457d){if(typeof _0x49457d[_0x115396]!=='undefined'){this[_0x5e75('0x1f')][_0x5e75('0x1c')](function(){if(!_['isNil'](_0x49457d[_0x115396])){return ami[_0x5e75('0xaf')]({'action':_0x5e75('0xb0'),'channel':_0x49457d[_0x115396][_0x5e75('0xb1')]})[_0x5e75('0xb2')](function(_0x50e450){if(_0x50e450[_0x5e75('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x49457d[_0x115396]&&_0x49457d[_0x115396][_0x5e75('0x4d')]!==_0x5e75('0x7b')){_0x389db6[_0x5e75('0xb3')](_0x389db6['voiceQueues'][_0x49457d[_0x115396]['queue']]);logger[_0x5e75('0x98')]('[Dialer][checkChannel]',_0x132dd2,_0x115396,_0x49457d[_0x115396][_0x5e75('0xb4')]);delete _0x49457d[_0x115396];}if(_0x49457d[_0x115396]&&_0x49457d[_0x115396]['type']==='ivr'){_0x389db6[_0x5e75('0xb3')](_0x389db6[_0x5e75('0x21')][_0x49457d[_0x115396][_0x5e75('0xb4')]]);logger['error'](_0x5e75('0xb5'),_0x132dd2,_0x115396,_0x49457d[_0x115396][_0x5e75('0xb4')]);delete _0x49457d[_0x115396];}},0x2328);}});}});}}};Dialer[_0x5e75('0x1b')]['countReScheduled']=function(_0x245e74){return BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](cmHopper[_0x5e75('0xb8')](_0x245e74))['catch'](loggerCatch(_0x5e75('0xb9')));};Dialer['prototype'][_0x5e75('0xba')]=function(_0x123ead){return BPromise[_0x5e75('0xb6')]()['then'](cmHopperBlack['checkIsBlackList'](_0x123ead))['catch'](loggerCatch(_0x5e75('0xbb')));};Dialer[_0x5e75('0x1b')][_0x5e75('0xbc')]=function(_0x13dc0a){return BPromise[_0x5e75('0xb6')]()['then'](cmHopperBlack[_0x5e75('0xbc')](_0x13dc0a))['catch'](loggerCatch(_0x5e75('0xbd')));};Dialer['prototype']['averageHandleTime']=function(_0x111f7c){return BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](cmHopperHistory[_0x5e75('0xbe')](_0x111f7c))[_0x5e75('0xb2')](loggerCatch(_0x5e75('0xbf')));};Dialer[_0x5e75('0x1b')][_0x5e75('0xc0')]=function(_0x16a61d){return BPromise['resolve']()[_0x5e75('0xb7')](cmHopper[_0x5e75('0xc0')](_0x16a61d))[_0x5e75('0xb2')](loggerCatch(_0x5e75('0xc1')));};Dialer['prototype'][_0x5e75('0xc2')]=function(_0x5a0072,_0x222dd5,_0x3bc31b){return BPromise[_0x5e75('0xb6')]()['then'](cmHopper[_0x5e75('0xc2')](_0x5a0072,_0x222dd5,_0x3bc31b))['catch'](loggerCatch(_0x5e75('0xc3')));};Dialer[_0x5e75('0x1b')]['getContactDialer']=function(_0x8e9a5e,_0x3e156e,_0x143217,_0x1b282b,_0xcac2ed){return BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](cmHopper['getContactDialer'](_0x8e9a5e,_0x3e156e,_0x143217,_0x1b282b))[_0x5e75('0xb2')](function(_0x222c87){_0xcac2ed[_0x5e75('0xc4')]-=_0x143217;_0xcac2ed[_0x5e75('0xc4')]=_0xcac2ed[_0x5e75('0xc4')]>0x0?_0xcac2ed[_0x5e75('0xc4')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x222c87);});};Dialer[_0x5e75('0x1b')]['getContactDialerIvr']=function(_0x9656cf,_0x525d00,_0x14d697,_0x2f595d){return BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](cmHopper['getContactDialerIvr'](_0x9656cf,_0x525d00,_0x14d697))[_0x5e75('0xb2')](function(_0x40d9d6){_0x2f595d[_0x5e75('0xc4')]-=_0x525d00;_0x2f595d[_0x5e75('0xc4')]=_0x2f595d[_0x5e75('0xc4')]>0x0?_0x2f595d['temp']:0x0;loggerCatch(_0x5e75('0xc5'))(_0x40d9d6);});};Dialer[_0x5e75('0x1b')][_0x5e75('0xc6')]=function(_0x35dc02){return BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](voiceQueueRt[_0x5e75('0xc6')](_0x35dc02))[_0x5e75('0xb2')](loggerCatch(_0x5e75('0xc7')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x73c1ef){return BPromise['resolve']()[_0x5e75('0xb7')](cmHopper[_0x5e75('0xc8')](_0x73c1ef))['catch'](loggerCatch(_0x5e75('0xc9')));};Dialer[_0x5e75('0x1b')][_0x5e75('0xca')]=function(_0x56d579){return BPromise[_0x5e75('0xb6')]()['then'](cmHopperHistory[_0x5e75('0xca')](_0x56d579))['catch'](loggerCatch(_0x5e75('0xcb')));};Dialer[_0x5e75('0x1b')]['updateOriginated']=function(_0x32f0b5){if(!_[_0x5e75('0x89')](_0x32f0b5)&&_0x32f0b5!==null){if(typeof _0x32f0b5['originated']!==_0x5e75('0x9b')){if(_0x32f0b5[_0x5e75('0x70')]>0x0){_0x32f0b5[_0x5e75('0x70')]-=0x1;}else{logger[_0x5e75('0x98')](_0x5e75('0xcc'));}}}else{logger[_0x5e75('0x98')](_0x5e75('0xcd'));}};Dialer[_0x5e75('0x1b')][_0x5e75('0xce')]=function(_0x90fd2c,_0x43e5f9){var _0x33bcba=this;return function(_0x33243b){_0x33bcba[_0x5e75('0xb3')](_0x43e5f9);logger[_0x5e75('0x98')](_0x90fd2c,util['inspect'](_0x33243b,{'showHidden':![],'depth':null}));};};Dialer[_0x5e75('0x1b')][_0x5e75('0xcf')]=function(_0x4b5a03,_0x559d31,_0x171981){var _0xf4657a={'state':0x19,'statedesc':_0x5e75('0xd0')};this[_0x5e75('0xb3')](_0x559d31);this[_0x5e75('0xd1')](_[_0x5e75('0x91')](_0xf4657a,_[_0x5e75('0xd2')](_0x171981,['ContactId',_0x5e75('0xd3'),'UserId',_0x5e75('0xd4'),_0x5e75('0xd5')])),_0x5e75('0xd6'),_0x5e75('0xd7'));logger[_0x5e75('0x98')](_0x4b5a03);};Dialer[_0x5e75('0x1b')][_0x5e75('0xd8')]=function(_0x1ee8c8){return _0x1ee8c8===_0x5e75('0xd9');};Dialer[_0x5e75('0x1b')][_0x5e75('0xda')]=function(_0x53aa0b){return!_['isUndefined'](_0x53aa0b)&&_0x53aa0b&&!_[_0x5e75('0x89')](_0x53aa0b['name'])&&!_[_0x5e75('0x89')](_0x53aa0b[_0x5e75('0x75')])&&_0x53aa0b[_0x5e75('0x75')]&&(this['trunks'][util[_0x5e75('0x78')](_0x5e75('0xdb'),_0x53aa0b[_0x5e75('0x3f')])]['status']===_0x5e75('0xdc')||this['trunks'][util['format'](_0x5e75('0xdb'),_0x53aa0b[_0x5e75('0x3f')])][_0x5e75('0xb0')]===_0x5e75('0xdd'));};Dialer[_0x5e75('0x1b')][_0x5e75('0xd1')]=function(_0x37399b,_0x5b7190,_0x54452b){this[_0x5e75('0xca')](_0x37399b)[_0x5e75('0xb2')](loggerCatch(_0x5b7190));this['moveContactManagedDialer'](_0x37399b)['catch'](loggerCatch(_0x54452b));};Dialer[_0x5e75('0x1b')]['syncVarSet']=function(_0x53233b){var _0x3fae7b=this[_0x5e75('0x27')][_0x53233b['uniqueid']];var _0x5ba9af;if(!_[_0x5e75('0xde')](_0x53233b)&&!_[_0x5e75('0xde')](_0x53233b[_0x5e75('0xdf')])&&!_[_0x5e75('0xde')](_0x53233b[_0x5e75('0xdf')][_0x5e75('0xe0')])&&_0x53233b[_0x5e75('0xe1')]==='xcally-motion-dialer'&&_0x3fae7b){if(_0x3fae7b['type']!==_0x5e75('0x7b')&&this[_0x5e75('0x20')][_0x3fae7b[_0x5e75('0xb4')]]['dialAMDActive']&&_0x53233b[_0x5e75('0xe2')]===_0x5e75('0xe3')){delete this[_0x5e75('0x27')][_0x53233b[_0x5e75('0xe4')]];this[_0x5e75('0xb3')](this[_0x5e75('0x20')][_0x3fae7b[_0x5e75('0xb4')]]);this[_0x5e75('0x20')][_0x3fae7b[_0x5e75('0xb4')]][_0x5e75('0x5c')]+=0x1;this[_0x5e75('0x20')][_0x3fae7b[_0x5e75('0xb4')]][_0x5e75('0xe5')]+=0x1;_0x5ba9af=new Hangup(_0x3fae7b,_0x53233b);_0x5ba9af[_0x5e75('0xa9')]=0x12;_0x5ba9af['statedesc']=_0x5e75('0xe6');_0x5ba9af[_0x5e75('0xe7')]=_0x5e75('0xe8');ami[_0x5e75('0xe9')](_0x5e75('0xea'),ut[_0x5e75('0xeb')](_0x5ba9af,'amd'));this[_0x5e75('0xd1')](_0x5ba9af,_0x5e75('0xec'),_0x5e75('0xed'));}if(_0x3fae7b[_0x5e75('0x4d')]!==_0x5e75('0x7b')&&this[_0x5e75('0x20')][_0x3fae7b[_0x5e75('0xb4')]]['dialAMDActive']&&_0x53233b[_0x5e75('0xe2')]===_0x5e75('0xee')){var _0x70f7c1=this;return new BPromise(function(_0x31a45f,_0xd93264){delete _0x70f7c1[_0x5e75('0x27')][_0x53233b[_0x5e75('0xe4')]];_0x70f7c1['updateOriginated'](_0x70f7c1['voiceQueues'][_0x3fae7b[_0x5e75('0xb4')]]);_0x70f7c1[_0x5e75('0x20')][_0x3fae7b['queue']][_0x5e75('0x5c')]+=0x1;_0x70f7c1[_0x5e75('0x20')][_0x3fae7b['queue']][_0x5e75('0xe5')]+=0x1;var _0x2fa480=_0x70f7c1['voiceQueues'][_0x3fae7b[_0x5e75('0xb4')]];var _0x1ddf3f=new Hangup(_0x3fae7b,_0x53233b);_0x1ddf3f[_0x5e75('0xa9')]=0x13;_0x1ddf3f[_0x5e75('0xaa')]=_0x5e75('0xef');_0x1ddf3f[_0x5e75('0xe7')]='AMD';_0x1ddf3f['countmachineretry']+=0x1;_0x1ddf3f['countglobal']+=0x1;_0x1ddf3f['amd']=!![];ami[_0x5e75('0xe9')](_0x5e75('0xea'),ut[_0x5e75('0xeb')](_0x1ddf3f,'amd'));_0x70f7c1[_0x5e75('0xca')](_0x1ddf3f)['catch'](loggerCatch(_0x5e75('0xf0')));if(_0x1ddf3f['countbusyretry']+_0x1ddf3f['countcongestionretry']+_0x1ddf3f[_0x5e75('0xf1')]+_0x1ddf3f[_0x5e75('0xf2')]+_0x1ddf3f['countdropretry']+_0x1ddf3f[_0x5e75('0xf3')]+_0x1ddf3f[_0x5e75('0xf4')]+_0x1ddf3f['countagentrejectretry']>=_0x2fa480[_0x5e75('0xf5')]){_0x70f7c1[_0x5e75('0xf6')](_0x1ddf3f,_0x31a45f,_0xd93264,'reason19\x20machine....');}else{if(_0x1ddf3f['countmachineretry']>=_0x2fa480[_0x5e75('0xf7')]){_0x70f7c1[_0x5e75('0xf8')](_0x1ddf3f,_0x31a45f,_0xd93264,_0x5e75('0xf9'));}else{_0x70f7c1['rescheduleContact']({'active':![],'countmachineretry':_0x1ddf3f[_0x5e75('0xf4')],'scheduledat':moment()[_0x5e75('0xfa')](_0x2fa480[_0x5e75('0xfb')],_0x5e75('0xfc'))[_0x5e75('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ddf3f[_0x5e75('0xfd')],'ListId':_0x1ddf3f[_0x5e75('0xd3')],'VoiceQueueId':_0x1ddf3f[_0x5e75('0xd4')]||undefined,'CampaignId':_0x1ddf3f[_0x5e75('0xd5')]||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0xfe')));_0x31a45f({'reschedule':0x1});}}});}if(_0x3fae7b[_0x5e75('0x4d')]===_0x5e75('0x7b')&&this[_0x5e75('0x21')][_0x3fae7b[_0x5e75('0xb4')]][_0x5e75('0xff')]&&_0x53233b[_0x5e75('0xe2')]==='HANGUP'){delete this[_0x5e75('0x27')][_0x53233b['uniqueid']];this[_0x5e75('0xb3')](this['campaigns'][_0x3fae7b[_0x5e75('0xb4')]]);_0x5ba9af=new Hangup(_0x3fae7b,_0x53233b);_0x5ba9af[_0x5e75('0xa9')]=0x12;_0x5ba9af[_0x5e75('0xaa')]=_0x5e75('0xe6');_0x5ba9af[_0x5e75('0xe7')]=_0x5e75('0xe8');ami[_0x5e75('0xe9')](_0x5e75('0xea'),ut['buildObj'](_0x5ba9af,_0x5e75('0x100')));this[_0x5e75('0xd1')](_0x5ba9af,_0x5e75('0x101'),_0x5e75('0x102'));}if(_0x3fae7b[_0x5e75('0x4d')]==='ivr'&&this[_0x5e75('0x21')][_0x3fae7b['queue']][_0x5e75('0xff')]&&_0x53233b['value']===_0x5e75('0xee')){var _0x70f7c1=this;return new BPromise(function(_0x2bae61,_0x4999ab){delete _0x70f7c1[_0x5e75('0x27')][_0x53233b[_0x5e75('0xe4')]];_0x70f7c1[_0x5e75('0xb3')](_0x70f7c1[_0x5e75('0x21')][_0x3fae7b[_0x5e75('0xb4')]]);_0x70f7c1[_0x5e75('0x21')][_0x3fae7b['queue']][_0x5e75('0x5c')]+=0x1;_0x70f7c1[_0x5e75('0x21')][_0x3fae7b['queue']][_0x5e75('0xe5')]+=0x1;var _0x2fc608=_0x70f7c1[_0x5e75('0x21')][_0x3fae7b[_0x5e75('0xb4')]];var _0x1ddae3=new Hangup(_0x3fae7b,_0x53233b);_0x1ddae3['state']=0x13;_0x1ddae3['statedesc']='Machine';_0x1ddae3['membername']='AMD';_0x1ddae3[_0x5e75('0xf4')]+=0x1;_0x1ddae3[_0x5e75('0x103')]+=0x1;_0x1ddae3[_0x5e75('0x100')]=!![];ami[_0x5e75('0xe9')](_0x5e75('0xea'),ut[_0x5e75('0xeb')](_0x1ddae3,_0x5e75('0x100')));_0x70f7c1[_0x5e75('0xca')](_0x1ddae3)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0xf0')));if(_0x1ddae3['countbusyretry']+_0x1ddae3['countcongestionretry']+_0x1ddae3[_0x5e75('0xf1')]+_0x1ddae3[_0x5e75('0xf2')]+_0x1ddae3[_0x5e75('0x104')]+_0x1ddae3[_0x5e75('0xf3')]+_0x1ddae3[_0x5e75('0xf4')]+_0x1ddae3[_0x5e75('0x105')]>=_0x2fc608[_0x5e75('0xf5')]){_0x70f7c1[_0x5e75('0xf6')](_0x1ddae3,_0x2bae61,_0x4999ab,_0x5e75('0x106'));}else{if(_0x1ddae3[_0x5e75('0xf4')]>=_0x2fc608[_0x5e75('0xf7')]){_0x70f7c1['createStateFinal'](_0x1ddae3,_0x2bae61,_0x4999ab,_0x5e75('0xf9'));}else{_0x70f7c1['rescheduleContact']({'active':![],'countmachineretry':_0x1ddae3[_0x5e75('0xf4')],'scheduledat':moment()['add'](_0x2fc608[_0x5e75('0xfb')],'minutes')[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x1ddae3[_0x5e75('0xfd')],'ListId':_0x1ddae3['ListId'],'VoiceQueueId':_0x1ddae3[_0x5e75('0xd4')]||undefined,'CampaignId':_0x1ddae3[_0x5e75('0xd5')]||undefined})['catch'](loggerCatch(_0x5e75('0xfe')));_0x2bae61({'reschedule':0x1});}}});}}};Dialer[_0x5e75('0x1b')]['syncHangup']=function(_0x261829){var _0x360ee7=this['uniqueId'][_0x261829[_0x5e75('0xe4')]];var _0x4ccd14=this;var _0x23db57;if(_0x360ee7&&_0x360ee7[_0x5e75('0x4d')]===_0x5e75('0x7b')){delete this[_0x5e75('0x27')][_0x261829[_0x5e75('0xe4')]];this[_0x5e75('0xb3')](this[_0x5e75('0x21')][_0x360ee7[_0x5e75('0xb4')]]);this[_0x5e75('0x21')][_0x360ee7[_0x5e75('0xb4')]][_0x5e75('0x108')]+=0x1;_0x23db57=new Hangup(_0x360ee7,_0x261829);this[_0x5e75('0xca')](_0x23db57)['catch'](loggerCatch(_0x5e75('0x109')));this[_0x5e75('0xc8')](_0x23db57)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x10a')));}if(_0x360ee7&&_0x360ee7[_0x5e75('0x4d')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x360ee7[_0x5e75('0xb4')]][_0x5e75('0x10b')])){delete this['uniqueId'][_0x261829[_0x5e75('0xe4')]];this['updateOriginated'](this['voiceQueues'][_0x360ee7[_0x5e75('0xb4')]]);this[_0x5e75('0x20')][_0x360ee7[_0x5e75('0xb4')]]['outboundAnswerCallsDay']+=0x1;this[_0x5e75('0x20')][_0x360ee7[_0x5e75('0xb4')]][_0x5e75('0xe5')]+=0x1;_0x23db57=new Hangup(_0x360ee7,_0x261829);_0x23db57[_0x5e75('0xa9')]=0x10;_0x23db57['statedesc']=_0x5e75('0x10c');_0x23db57[_0x5e75('0xe7')]=_0x5e75('0x10d');this[_0x5e75('0xca')](_0x23db57)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x109')));this[_0x5e75('0xc8')](_0x23db57)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x10a')));}if(_0x360ee7&&_0x360ee7[_0x5e75('0x4d')]!=='ivr'&&!isNotNull(this[_0x5e75('0x20')][_0x360ee7[_0x5e75('0xb4')]]['dialQueueProject'])){delete this[_0x5e75('0x27')][_0x261829[_0x5e75('0xe4')]];this[_0x5e75('0xb3')](this[_0x5e75('0x20')][_0x360ee7[_0x5e75('0xb4')]]);this[_0x5e75('0x20')][_0x360ee7['queue']]['outboundUnknownCallsDay']+=0x1;_0x23db57=new Hangup(_0x360ee7,_0x261829);_0x23db57[_0x5e75('0xa9')]=0xc;_0x23db57[_0x5e75('0xaa')]=_0x261829[_0x5e75('0x10e')];_0x23db57[_0x5e75('0xe7')]=_0x5e75('0x10f');this[_0x5e75('0xca')](_0x23db57)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x109')));this[_0x5e75('0xc8')](_0x23db57)['catch'](loggerCatch(_0x5e75('0x10a')));}};Dialer[_0x5e75('0x1b')][_0x5e75('0x34')]=function(_0x1bbb3a){var _0x13ebb6=this['uniqueId'][_0x1bbb3a[_0x5e75('0xe4')]];var _0x896df8=this;if(this[_0x5e75('0x20')][_0x1bbb3a[_0x5e75('0xb4')]]){if(_0x13ebb6&&_0x13ebb6['type']!==_0x5e75('0x7b')){delete this['uniqueId'][_0x1bbb3a[_0x5e75('0xe4')]];this[_0x5e75('0x20')][_0x1bbb3a[_0x5e75('0xb4')]][_0x5e75('0x5c')]+=0x1;var _0x3b3b2c=new AgentComplete(_0x13ebb6,_0x1bbb3a);if(_0x1bbb3a[_0x5e75('0x110')]==='agent'){_0x3b3b2c[_0x5e75('0x111')]=this[_0x5e75('0x20')][_0x1bbb3a[_0x5e75('0xb4')]][_0x5e75('0x112')]&&this[_0x5e75('0x20')][_0x1bbb3a[_0x5e75('0xb4')]][_0x5e75('0x113')]?moment()[_0x5e75('0x78')](_0x5e75('0x107')):undefined;}this[_0x5e75('0xca')](_0x3b3b2c)['catch'](loggerCatch(_0x5e75('0x114')));this[_0x5e75('0xc8')](_0x3b3b2c)['catch'](loggerCatch(_0x5e75('0x115')));}}};Dialer[_0x5e75('0x1b')][_0x5e75('0x2e')]=function(_0x3f3879){if(this['voiceQueues'][_0x3f3879[_0x5e75('0xb4')]]){if(this[_0x5e75('0x27')][_0x3f3879['uniqueid']]&&this[_0x5e75('0x27')][_0x3f3879[_0x5e75('0xe4')]][_0x5e75('0x4d')]!=='ivr'){this[_0x5e75('0xb3')](this['voiceQueues'][_0x3f3879[_0x5e75('0xb4')]]);this['uniqueId'][_0x3f3879['uniqueid']]['answertime']=moment()['format'](_0x5e75('0x107'));}}};Dialer[_0x5e75('0x1b')][_0x5e75('0x116')]=function(_0x1cd0fc){this[_0x5e75('0xca')](_0x1cd0fc)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x114')));this['moveContactManagedDialer'](_0x1cd0fc)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x117')));};Dialer['prototype'][_0x5e75('0x118')]=function(_0x4d53d2){var _0x4dd2f5=this['uniqueId'][_0x4d53d2[_0x5e75('0xe4')]];var _0x40ce5a=this;if(this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]]){if(_0x4dd2f5&&_0x4dd2f5['type']!==_0x5e75('0x7b')){delete this[_0x5e75('0x27')][_0x4d53d2[_0x5e75('0xe4')]];this[_0x5e75('0xb3')](this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]]);_0x4dd2f5[_0x5e75('0x119')]=moment()[_0x5e75('0x78')](_0x5e75('0x107'));var _0x1efe68=new QueueCallerAbandon(_0x4dd2f5,_0x4d53d2);if(getSeconds(_0x4dd2f5[_0x5e75('0x119')],_0x4dd2f5[_0x5e75('0x11a')])>=_0x4dd2f5[_0x5e75('0x11b')]){this['voiceQueues'][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x6a')]+=0x1;this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x61')]+=0x1;this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1efe68[_0x5e75('0xa9')]=0xa;_0x1efe68[_0x5e75('0xaa')]=_0x5e75('0x11c');_0x1efe68['dropreason']='TIMEOUT';_0x1efe68[_0x5e75('0x111')]=this['voiceQueues'][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x112')]?moment()[_0x5e75('0x78')](_0x5e75('0x107')):undefined;_0x1efe68[_0x5e75('0x104')]+=0x1;_0x1efe68['countglobal']+=0x1;if(_0x1efe68[_0x5e75('0x104')]>=this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x11d')]){this[_0x5e75('0x116')](_0x1efe68);}else{this[_0x5e75('0xc0')]({'active':![],'countdropretry':_0x1efe68['countdropretry'],'scheduledat':moment()[_0x5e75('0xfa')](this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x11e')],_0x5e75('0xfc'))[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x4dd2f5['ContactId'],'ListId':_0x4dd2f5[_0x5e75('0xd3')],'VoiceQueueId':_0x4dd2f5[_0x5e75('0xd4')]||undefined,'CampaignId':_0x4dd2f5[_0x5e75('0xd5')]||undefined})['catch'](loggerCatch(_0x5e75('0x11f')));var _0x184e23=new History(_0x1efe68);_0x184e23[_0x5e75('0xa9')]=0xa;_0x184e23[_0x5e75('0xaa')]=_0x5e75('0x11c');_0x184e23['starttime']=moment()[_0x5e75('0x78')](_0x5e75('0x107'));_0x184e23[_0x5e75('0xab')]=_0x184e23[_0x5e75('0xac')];_0x184e23[_0x5e75('0x120')]=_0x1efe68[_0x5e75('0x120')];_0x184e23['calleridnum']=_0x1efe68[_0x5e75('0x121')];this[_0x5e75('0xca')](_0x184e23)[_0x5e75('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x5e75('0x20')][_0x4d53d2['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5e75('0x20')][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x60')]+=0x1;_0x1efe68[_0x5e75('0xa9')]=0xb;_0x1efe68[_0x5e75('0xaa')]=_0x5e75('0x122');_0x1efe68[_0x5e75('0x123')]=_0x5e75('0x124');_0x1efe68['countabandonedretry']+=0x1;_0x1efe68['countglobal']+=0x1;if(_0x1efe68[_0x5e75('0xf3')]>=this[_0x5e75('0x20')][_0x4d53d2['queue']][_0x5e75('0x125')]){this[_0x5e75('0x116')](_0x1efe68);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1efe68[_0x5e75('0xf3')],'scheduledat':moment()[_0x5e75('0xfa')](this['voiceQueues'][_0x4d53d2[_0x5e75('0xb4')]][_0x5e75('0x126')],'minutes')[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x4dd2f5[_0x5e75('0xfd')],'ListId':_0x4dd2f5[_0x5e75('0xd3')],'VoiceQueueId':_0x4dd2f5['VoiceQueueId']||undefined,'CampaignId':_0x4dd2f5[_0x5e75('0xd5')]||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x127')));var _0x184e23=new History(_0x1efe68);_0x184e23['state']=0xb;_0x184e23['statedesc']=_0x5e75('0x122');_0x184e23[_0x5e75('0xac')]=moment()[_0x5e75('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x184e23[_0x5e75('0xab')]=_0x184e23['starttime'];_0x184e23['calleridname']=_0x1efe68['calleridname'];_0x184e23['calleridnum']=_0x1efe68[_0x5e75('0x121')];this['createHistory'](_0x184e23)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x128')));}}}}};Dialer[_0x5e75('0x1b')][_0x5e75('0x129')]=function(_0xa8c6a0){if(this[_0x5e75('0x26')][_0xa8c6a0['uniqueid']]){this['actions'][_0xa8c6a0[_0x5e75('0xe4')]][_0x5e75('0xb1')]=_0xa8c6a0['channel'];}if(this[_0x5e75('0x27')][_0xa8c6a0[_0x5e75('0xe4')]]){this[_0x5e75('0x27')][_0xa8c6a0[_0x5e75('0xe4')]]['channel']=_0xa8c6a0[_0x5e75('0xb1')];}};Dialer['prototype']['syncQueueMember']=function(_0x2f53d5){if(strategy[this[_0x5e75('0x20')][this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]][_0x5e75('0xb4')]][_0x5e75('0x4f')]]===_0x5e75('0x12b')){if(this['actions'][_0x2f53d5[_0x5e75('0x12a')]]&&_[_0x5e75('0xde')](this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]][_0x5e75('0x12c')])&&_0x2f53d5[_0x5e75('0xb0')]==='1'&&_0x2f53d5[_0x5e75('0x12d')]==='0'){if(this[_0x5e75('0x22')][_0x2f53d5[_0x5e75('0x12e')]]){if(!this[_0x5e75('0x22')][_0x2f53d5[_0x5e75('0x12e')]][_0x5e75('0x12c')]){this[_0x5e75('0x22')][_0x2f53d5[_0x5e75('0x12e')]][_0x5e75('0x12c')]=!![];this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]]['locked']=!![];this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]][_0x5e75('0x12e')]=_0x2f53d5[_0x5e75('0x12e')];}}}}else if((strategy[this[_0x5e75('0x20')][this[_0x5e75('0x26')][_0x2f53d5['actionid']][_0x5e75('0xb4')]][_0x5e75('0x4f')]]||_0x5e75('0x1a'))===_0x5e75('0x1a')){if(this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]]){if(this['agents'][_0x2f53d5['stateinterface']]){this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]][_0x5e75('0x12e')]=_0x2f53d5['stateinterface'];if(_[_0x5e75('0xde')](this[_0x5e75('0x12f')][this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]][_0x5e75('0xb4')]])){this[_0x5e75('0x12f')][this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]]['queue']]=[];}this['queueBooked'][this[_0x5e75('0x26')][_0x2f53d5[_0x5e75('0x12a')]][_0x5e75('0xb4')]][_0x5e75('0x130')](_[_0x5e75('0x91')](_[_0x5e75('0xd2')](this[_0x5e75('0x26')][_0x2f53d5['actionid']],[_0x5e75('0x131'),_0x5e75('0x12e')]),{'status':_0x2f53d5['status'],'paused':_0x2f53d5[_0x5e75('0x12d')]}));}}}};function unlockQueueStatus(_0x3c307e,_0x493e3d){setTimeout(function(){if(_[_0x5e75('0x89')](_0x3c307e['queueStatusComplete'])){loggerBooked[_0x5e75('0x98')]('[unlockQueueStatus][undefined]',_0x493e3d);}_0x3c307e[_0x5e75('0x132')]=!![];loggerBooked[_0x5e75('0x81')]('[booked][unlockQueueStatus]',_0x493e3d,JSON[_0x5e75('0x49')](_[_0x5e75('0xd2')](_0x3c307e,[_0x5e75('0x3f'),_0x5e75('0x132')])));},0x1f3);}Dialer[_0x5e75('0x1b')][_0x5e75('0x133')]=function(_0x4f8d16){var _0x387c28=this;var _0x486f9a=_0x387c28[_0x5e75('0x20')][_0x387c28[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xb4')]];if(strategy[this[_0x5e75('0x20')][this['actions'][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xb4')]]['strategy']]===_0x5e75('0x12b')){if(this['actions'][_0x4f8d16[_0x5e75('0x12a')]]&&this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0x12e')]){this['preview'][_0x5e75('0x134')](this['actions'][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0x131')],this['actions'][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0x12e')])[_0x5e75('0xb2')](function(_0x16af9d){logger[_0x5e75('0x98')](_0x5e75('0x135'),util['inspect'](_0x16af9d,{'showHidden':![],'depth':null}));})[_0x5e75('0x1e')](function(){_0x387c28[_0x5e75('0xb3')](_0x387c28[_0x5e75('0x20')][_0x387c28[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xb4')]]);_0x387c28[_0x5e75('0x22')][_0x387c28[_0x5e75('0x26')][_0x4f8d16['actionid']][_0x5e75('0x12e')]][_0x5e75('0x12c')]=![];delete _0x387c28[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]];unlockQueueStatus(_0x486f9a);});}else{this[_0x5e75('0xb3')](this[_0x5e75('0x20')][this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xb4')]]);this[_0x5e75('0xc0')]({'active':![],'ContactId':this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]]['ContactId'],'ListId':this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xd3')],'VoiceQueueId':this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x5e75('0x26')][_0x4f8d16['actionid']][_0x5e75('0xd5')]||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x136')));delete this['actions'][_0x4f8d16[_0x5e75('0x12a')]];unlockQueueStatus(_0x486f9a);}}else if((strategy[this[_0x5e75('0x20')][this[_0x5e75('0x26')][_0x4f8d16['actionid']][_0x5e75('0xb4')]][_0x5e75('0x4f')]]||_0x5e75('0x1a'))===_0x5e75('0x1a')){var _0x129c6f;if(this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]]&&!_['isEmpty'](this['queueBooked'][this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]]['queue']])){if(this['queueBookedRR'][_0x387c28['actions'][_0x4f8d16[_0x5e75('0x12a')]]['queue']]){this[_0x5e75('0x2c')][_0x387c28[_0x5e75('0x26')][_0x4f8d16['actionid']][_0x5e75('0xb4')]]=this[_0x5e75('0x2c')][this['actions'][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xb4')]]?this[_0x5e75('0x2c')][this[_0x5e75('0x26')][_0x4f8d16['actionid']]['queue']]:this[_0x5e75('0x12f')][this['actions'][_0x4f8d16['actionid']][_0x5e75('0xb4')]]?this[_0x5e75('0x12f')][this[_0x5e75('0x26')][_0x4f8d16['actionid']][_0x5e75('0xb4')]][_0x5e75('0x137')]||0x0:0x0;}this[_0x5e75('0x12f')][this[_0x5e75('0x26')][_0x4f8d16['actionid']][_0x5e75('0xb4')]][_0x5e75('0x137')]=this[_0x5e75('0x2c')][this[_0x5e75('0x26')][_0x4f8d16[_0x5e75('0x12a')]][_0x5e75('0xb4')]];for(var _0x55a7d1=0x0;_0x55a7d1=0x0;})[_0x5e75('0xb2')](myreject(_0xa90eaf)));}}else{_0x4ac182[_0x5e75('0x130')](ami[_0x5e75('0xaf')]({'action':'command','command':util[_0x5e75('0x78')]('iftime\x20%s,%s',_0x878f8f,!_[_0x5e75('0x89')](config[_0x5e75('0x152')][_0x21b8b2])?_0x21b8b2:'')})[_0x5e75('0xb7')](function(_0x177bf4){return _0x177bf4[_0x5e75('0x153')][_0x5e75('0x150')](_0x5e75('0x151'))>=0x0;})[_0x5e75('0xb2')](myreject(_0xa90eaf)));}BPromise['all'](_0x4ac182)[_0x5e75('0xb7')](function(_0x20c08b){var _0x180f68=_[_0x5e75('0x154')](_0x20c08b);if(_0x180f68){return _0x32ecb6(_0x180f68);}else{_0x8e325e[_0x5e75('0x3d')]=_0x334e1a?_0x5e75('0x155'):'INTERVAL_IS_OVERTIME';return _0xa90eaf(msgResponse(_0x5e75('0x156'),_0x5e75('0x14a'),_0x5e75('0x157')+_0x334e1a+'\x20'+_0x2e5cff+_0x5e75('0x158')+util[_0x5e75('0x99')](_0x878f8f,{'showHidden':![],'depth':null})+_0x5e75('0x159')+_0x21b8b2));}})[_0x5e75('0xb2')](function(_0x2bd437){return _0xa90eaf(msgResponse('ifTime',_0x5e75('0x14a'),JSON['stringify'](_0x2bd437)));});});};Dialer[_0x5e75('0x1b')]['checkDialMethod']=function(_0x3212ce){var _0x375067=this;return function(){switch(_0x3212ce[_0x5e75('0x59')]){case _0x5e75('0x15a'):freeVariablesPredictive(_0x3212ce);_0x375067[_0x5e75('0x15b')](_0x3212ce,0x1);break;case _0x5e75('0x15c'):freeVariablesPredictive(_0x3212ce);_0x375067['handlePower'](_0x3212ce,_0x3212ce['dialPowerLevel']);break;case'predictive':_0x375067['predictive'](_0x3212ce);break;case _0x5e75('0x9'):freeVariablesPredictive(_0x3212ce);_0x375067[_0x5e75('0x15b')](_0x3212ce,0x1);break;default:freeVariablesPredictive(_0x3212ce);logger[_0x5e75('0x98')](_0x5e75('0x15d'),_0x3212ce['name'],_0x5e75('0x15e'));}};};Dialer[_0x5e75('0x1b')][_0x5e75('0x15f')]=function(_0x7cb35e){return BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](cmHopper['handlePreviewRecallNotifications'](_0x7cb35e['id'],previewRecallmeReminderInterval))[_0x5e75('0xb7')](function(_0x29ccfd){for(var _0x2b0e31=0x0;_0x2b0e31<_0x29ccfd['length'];_0x2b0e31++){var _0x5126f8=_0x29ccfd[_0x2b0e31][_0x5e75('0x160')][_0x5e75('0x3f')];if(_0x5126f8)io['to'](util[_0x5e75('0x78')]('user:%s',_0x5126f8))[_0x5e75('0xe9')](_0x5e75('0x161'),{'hopper':_0x29ccfd[_0x2b0e31]});}})[_0x5e75('0xb2')](function(_0x9f652d){});};Dialer[_0x5e75('0x1b')]['launchHandleIvr']=function(_0x23048c){var _0x543847=this;return function(){_0x543847['handleIvr'](_0x23048c);};};Dialer[_0x5e75('0x1b')][_0x5e75('0xc')]=function(_0x4ca3bc){var _0x3de74e=this;if(isNotPreview(_0x4ca3bc['dialMethod'])){if(isVoiceQueueOutbound(_0x4ca3bc[_0x5e75('0x4d')])&&isActive(_0x4ca3bc[_0x5e75('0x58')])){_0x4ca3bc[_0x5e75('0xa2')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x4ca3bc,_0x4ca3bc[_0x5e75('0x51')]))[_0x5e75('0xb7')](checkIsActive(_0x4ca3bc,_0x4ca3bc[_0x5e75('0x58')]))[_0x5e75('0xb7')](checkInterval(_0x4ca3bc))[_0x5e75('0xb7')](_0x3de74e['checkIsTrunkReachable'](_0x4ca3bc))[_0x5e75('0xb7')](_0x3de74e['checkIfTime'](_0x4ca3bc[_0x5e75('0x162')],_0x4ca3bc[_0x5e75('0x163')],_0x4ca3bc[_0x5e75('0x3f')],_0x4ca3bc))[_0x5e75('0xb7')](_0x3de74e[_0x5e75('0x149')](_0x4ca3bc[_0x5e75('0x46')],_0x4ca3bc[_0x5e75('0x163')],_0x4ca3bc[_0x5e75('0x3f')],_0x4ca3bc))['then'](_0x3de74e[_0x5e75('0x164')](_0x4ca3bc))[_0x5e75('0xb2')](loggerCatchQueueSummary(_0x5e75('0x165'),_0x4ca3bc));}else{notSendMessagesQueue(_0x4ca3bc);}}else{freeVariablesPredictive(_0x4ca3bc);if(_0x4ca3bc['dialPreviewRecallmeReminder']){_0x3de74e[_0x5e75('0x15f')](_0x4ca3bc);}}};Dialer[_0x5e75('0x1b')][_0x5e75('0x143')]=function(){var _0x45bc92=this;var _0x10a9a5;for(var _0x439df7 in this[_0x5e75('0x21')]){if(typeof this[_0x5e75('0x21')][_0x439df7]!=='undefined'){_0x10a9a5=this[_0x5e75('0x21')][_0x439df7];if(isCampaignIvr(_0x10a9a5[_0x5e75('0x4d')])&&isActive(_0x10a9a5[_0x5e75('0x75')])){_0x10a9a5['sendMessageOneNotActive']=!![];BPromise[_0x5e75('0xb6')]()[_0x5e75('0xb7')](checkIsActive(_0x10a9a5,_0x10a9a5[_0x5e75('0x75')]))[_0x5e75('0xb7')](checkInterval(_0x10a9a5))[_0x5e75('0xb7')](_0x45bc92[_0x5e75('0x166')](_0x10a9a5))['then'](_0x45bc92[_0x5e75('0x147')](_0x10a9a5[_0x5e75('0x162')],_0x10a9a5[_0x5e75('0x163')],_0x10a9a5['name'],_0x10a9a5))['then'](_0x45bc92['checkIfTimeIntervals'](_0x10a9a5[_0x5e75('0x46')],_0x10a9a5[_0x5e75('0x163')],_0x10a9a5['name'],_0x10a9a5))['then'](_0x45bc92[_0x5e75('0x167')](_0x10a9a5))['catch'](loggerCatchQueueSummary(_0x5e75('0x168'),_0x10a9a5));}else{notSendMessagesCampaign(_0x10a9a5);}}}};function getCallerIdRandom(_0x53f28d,_0x77ff7a){var _0x4fc7e7;var _0x185fe6;var _0x5d6f5a;if(_0x77ff7a<=0x0){_0x77ff7a=0x1;}_0x4fc7e7=new RegExp(_0x5e75('0x169')+_0x77ff7a+'}$');_0x185fe6=Math[_0x5e75('0x16a')](0xa,_0x77ff7a-0x1);_0x5d6f5a=Math[_0x5e75('0x16a')](0xa,_0x77ff7a)-0x1;return util[_0x5e75('0x78')]('%s',_[_0x5e75('0x16b')](_0x53f28d,_0x4fc7e7,_[_0x5e75('0x16c')](_0x185fe6,_0x5d6f5a)));}function extractCalleridName(_0x4cc9f0){var _0x20cf33=_0x4cc9f0[_0x5e75('0x16d')](/"(.*?)"/);return _0x20cf33?_0x20cf33[0x1]:_0x4cc9f0;}function extractCalleridNumber(_0x1c9127){var _0x2f1161=_0x1c9127['match'](/<(.*?)>/);return _0x2f1161?_0x2f1161[0x1]:_0x1c9127;}Dialer['prototype'][_0x5e75('0x16e')]=function(_0x2c9f10,_0x419d9b){var _0x1c6b66=this;var _0x2fd2da=uuid['v4']();this[_0x5e75('0x26')][_0x2fd2da]=new Action(_0x2c9f10,_0x419d9b,_0x2fd2da);return new BPromise(function(_0x6a60bb,_0x20b5ad){if(_[_0x5e75('0x89')](_0x2c9f10)&&typeof _0x2c9f10!=='object'){return _0x20b5ad(msgResponse('originate',_0x5e75('0x14a'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x419d9b[_0x5e75('0x16f')][_0x5e75('0x170')])||_0x419d9b[_0x5e75('0x16f')][_0x5e75('0x170')]===null){return _0x20b5ad(msgResponse(_0x5e75('0x171'),'Failure',_0x5e75('0x172')));}var _0x155830={'XMD-CALLERID':_0x1c6b66['actions'][_0x2fd2da][_0x5e75('0x173')](),'XMD-AGI':_0x2c9f10[_0x5e75('0x10b')]?util['format'](_0x5e75('0x174'),ipAgi,_0x2c9f10['dialQueueProject']):_0x5e75('0x175'),'XMD-AGIAFTER':_0x2c9f10[_0x5e75('0x112')]?util['format'](_0x5e75('0x174'),ipAgi,_0x2c9f10[_0x5e75('0x112')]):'NONE','XMD-QUEUE':_0x2c9f10[_0x5e75('0x4d')]===_0x5e75('0x4e')?util[_0x5e75('0x78')](_0x5e75('0x176'),_0x2c9f10['name'],_0x2c9f10[_0x5e75('0x177')]||'',_0x2c9f10[_0x5e75('0x113')]?'c':'',_0x2c9f10['dialQueueTimeout']||0x3):_0x5e75('0x175'),'XMD-CONTACTID':_0x419d9b['ContactId'],'XMD-CDRTYPE':_0x5e75('0x8'),'CALLERID(all)':_0x1c6b66[_0x5e75('0x26')][_0x2fd2da][_0x5e75('0x173')](),'XMD-AMD':_0x2c9f10[_0x5e75('0xff')]?'ACTIVE':_0x5e75('0x175'),'XMD-DESTINATION':_0x5e75('0x178')};if(_0x2c9f10[_0x5e75('0xff')]){_0x155830['XMD-AMDINITIALSILENCE']=_0x2c9f10[_0x5e75('0x179')]||0x9c4;_0x155830[_0x5e75('0x17a')]=_0x2c9f10[_0x5e75('0x17b')]||0x5dc;_0x155830[_0x5e75('0x17c')]=_0x2c9f10['dialAMDAfterGreetingSilence']||0x320;_0x155830['XMD-AMDTOTALANALYSISTIME']=_0x2c9f10[_0x5e75('0x17d')]||0x1388;_0x155830[_0x5e75('0x17e')]=_0x2c9f10[_0x5e75('0x17f')]||0x64;_0x155830[_0x5e75('0x180')]=_0x2c9f10[_0x5e75('0x181')]||0x32;_0x155830[_0x5e75('0x182')]=_0x2c9f10[_0x5e75('0x183')]||0x3;_0x155830[_0x5e75('0x184')]=_0x2c9f10[_0x5e75('0x185')]||0x100;_0x155830[_0x5e75('0x186')]=_0x2c9f10['dialAMDMaximumWordLength']||0x1388;}if(_0x2c9f10[_0x5e75('0x4d')]===_0x5e75('0x4e')){_0x155830[_0x5e75('0x187')]=_0x419d9b[_0x5e75('0xd4')];}else{_0x155830[_0x5e75('0x188')]=_0x419d9b[_0x5e75('0xd5')];}for(var _0x119892 in _0x419d9b[_0x5e75('0x16f')]){if(typeof _0x419d9b['Contact'][_0x119892]!==_0x5e75('0x9b')){if(isNotNull(_0x419d9b[_0x5e75('0x16f')][_0x119892])&&_0x119892!=='id'&&_0x119892!=='tags'&&_0x119892!==_0x5e75('0x189')&&_0x119892!==_0x5e75('0x18a')){_0x155830[util[_0x5e75('0x78')](_0x5e75('0x18b'),_0x5e75('0x18c'),_[_0x5e75('0x18d')](_0x119892))]=_0x419d9b[_0x5e75('0x16f')][_0x119892];}}}var _0x55d24b=_0x1c6b66[_0x5e75('0xda')](_0x2c9f10[_0x5e75('0x74')])?getCallerId(_0x2c9f10[_0x5e75('0x74')][_0x5e75('0x76')],_0x2c9f10[_0x5e75('0x18e')],_0x2c9f10[_0x5e75('0x18f')]>0x0?getCallerIdRandom(_0x2c9f10['dialOriginateCallerIdNumber'],_0x2c9f10['dialRandomLastDigitCallerIdNumber']):_0x2c9f10[_0x5e75('0x5a')]):getCallerId(_[_0x5e75('0xde')](_0x2c9f10[_0x5e75('0x144')])?_0x2c9f10['Trunk']['callerid']:_0x2c9f10[_0x5e75('0x144')]['callerid'],_0x2c9f10[_0x5e75('0x18e')],_0x2c9f10['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2c9f10['dialOriginateCallerIdNumber'],_0x2c9f10[_0x5e75('0x18f')]):_0x2c9f10['dialOriginateCallerIdNumber']);if(_0x55d24b){_0x155830[_0x5e75('0x190')]=_0x1c6b66[_0x5e75('0x26')][_0x2fd2da][_0x5e75('0x191')]=extractCalleridName(_0x55d24b);_0x155830[_0x5e75('0x192')]=_0x1c6b66[_0x5e75('0x26')][_0x2fd2da][_0x5e75('0x193')]=extractCalleridNumber(_0x55d24b);}return ami['Action']({'actionid':_0x2fd2da,'action':_0x5e75('0x171'),'channel':_0x1c6b66[_0x5e75('0xda')](_0x2c9f10[_0x5e75('0x74')])?util[_0x5e75('0x78')](_0x5e75('0x194'),_0x2c9f10[_0x5e75('0x74')]['name'],isNotNull(_0x2c9f10['dialPrefix'])?_0x2c9f10[_0x5e75('0x5b')][_0x5e75('0x195')]()||'':'',_0x2c9f10[_0x5e75('0x196')]>0x0?_0x419d9b[_0x5e75('0x16f')]['phone'][_0x5e75('0x197')](_0x2c9f10[_0x5e75('0x196')]):_0x419d9b[_0x5e75('0x16f')][_0x5e75('0x170')]):util[_0x5e75('0x78')](_0x5e75('0x194'),_[_0x5e75('0xde')](_0x2c9f10[_0x5e75('0x144')])?_0x2c9f10[_0x5e75('0x74')]['name']:_0x2c9f10['TrunkBackup']['name'],isNotNull(_0x2c9f10[_0x5e75('0x5b')])?_0x2c9f10[_0x5e75('0x5b')][_0x5e75('0x195')]()||'':'',_0x2c9f10[_0x5e75('0x196')]>0x0?_0x419d9b['Contact'][_0x5e75('0x170')][_0x5e75('0x197')](_0x2c9f10[_0x5e75('0x196')]):_0x419d9b[_0x5e75('0x16f')][_0x5e75('0x170')]),'callerid':_0x55d24b,'Exten':_0x5e75('0x178'),'Context':_0x5e75('0x198'),'Priority':'1','variable':_0x155830,'timeout':(_0x2c9f10[_0x5e75('0x199')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2fd2da})['then'](function(_0x3f141a){return _0x6a60bb(_0x3f141a);})[_0x5e75('0xb2')](function(_0x132da7){_0x2c9f10['outboundOriginateFailureCallsDay']+=0x1;var _0x3d1c46=new History(_0x1c6b66[_0x5e75('0x26')][_0x2fd2da]);logger[_0x5e75('0x98')](util['format']('[originateError]:\x20%s',JSON[_0x5e75('0x49')](_0x132da7)));_0x3d1c46[_0x5e75('0xa9')]=0xe;_0x3d1c46['statedesc']='OriginateError';_0x3d1c46[_0x5e75('0xac')]=moment()[_0x5e75('0x78')](_0x5e75('0x107'));_0x3d1c46[_0x5e75('0xab')]=_0x3d1c46[_0x5e75('0xac')];_0x1c6b66[_0x5e75('0xca')](_0x3d1c46)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x19a')));_0x1c6b66[_0x5e75('0xc8')](_0x3d1c46)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x19a')))[_0x5e75('0x1e')](function(){delete _0x1c6b66[_0x5e75('0x26')][_0x2fd2da];return _0x20b5ad(msgResponse('originate','Error',_0x5e75('0x19b')));});});});};Dialer[_0x5e75('0x1b')]['syncOriginateResponse']=function(_0x42de87){var _0x6f1715=this[_0x5e75('0x26')][_0x42de87[_0x5e75('0x12a')]];if(_0x6f1715){delete this[_0x5e75('0x26')][_0x42de87[_0x5e75('0x12a')]];_0x6f1715[_0x5e75('0x11a')]=moment()[_0x5e75('0x78')](_0x5e75('0x107'));var _0x2651d9=_0x6f1715[_0x5e75('0x4d')]===_0x5e75('0x7b')?this['campaigns'][_0x6f1715[_0x5e75('0xb4')]]:this[_0x5e75('0x20')][_0x6f1715['getQueue']()];if(!this['isSuccess'](_0x42de87[_0x5e75('0x19c')])){this[_0x5e75('0xb3')](_0x2651d9);return this[_0x5e75('0x19d')](_0x6f1715,_0x2651d9,_0x42de87)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x19e')));}this[_0x5e75('0x27')][_0x42de87[_0x5e75('0xe4')]]=_0x6f1715;}};Dialer[_0x5e75('0x1b')][_0x5e75('0x19f')]=function(_0x24227e,_0x245515,_0x34ce24){var _0x28fe90=new History(_0x245515);if(_0x28fe90[_0x5e75('0x1a0')]+_0x28fe90[_0x5e75('0x1a1')]+_0x28fe90[_0x5e75('0xf1')]+_0x28fe90[_0x5e75('0xf2')]+_0x28fe90[_0x5e75('0x104')]+_0x28fe90['countabandonedretry']+_0x28fe90['countmachineretry']+_0x28fe90[_0x5e75('0x105')]>=_0x34ce24[_0x5e75('0xf5')]-0x1){return!![];}switch(_0x24227e){case 0x3:if(_0x28fe90[_0x5e75('0xf1')]>=_0x34ce24[_0x5e75('0x1a2')]-0x1){return!![];}this[_0x5e75('0xc0')]({'active':![],'countnoanswerretry':_0x28fe90['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24['dialNoAnswerRetryFrequency'],'minutes')[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x28fe90[_0x5e75('0xfd')],'ListId':_0x28fe90[_0x5e75('0xd3')],'VoiceQueueId':_0x28fe90[_0x5e75('0xd4')]||undefined,'CampaignId':_0x28fe90['CampaignId']||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1a3')));break;case 0x5:if(_0x28fe90['countbusyretry']>=_0x34ce24['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x28fe90[_0x5e75('0x1a0')]+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24[_0x5e75('0x1a4')],_0x5e75('0xfc'))[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x28fe90[_0x5e75('0xfd')],'ListId':_0x28fe90[_0x5e75('0xd3')],'VoiceQueueId':_0x28fe90['VoiceQueueId']||undefined,'CampaignId':_0x28fe90['CampaignId']||undefined})['catch'](loggerCatch(_0x5e75('0x1a5')));break;case 0x8:if(_0x28fe90['countcongestionretry']>=_0x34ce24[_0x5e75('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x28fe90[_0x5e75('0x1a1')]+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24[_0x5e75('0x1a7')],_0x5e75('0xfc'))['format'](_0x5e75('0x107')),'ContactId':_0x28fe90['ContactId'],'ListId':_0x28fe90[_0x5e75('0xd3')],'VoiceQueueId':_0x28fe90['VoiceQueueId']||undefined,'CampaignId':_0x28fe90[_0x5e75('0xd5')]||undefined})['catch'](loggerCatch(_0x5e75('0x1a8')));break;case 0x0:if(_0x28fe90[_0x5e75('0xf2')]>=_0x34ce24[_0x5e75('0x1a9')]-0x1){return!![];}else{this[_0x5e75('0xc0')]({'active':![],'countnosuchnumberretry':_0x28fe90[_0x5e75('0xf2')]+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24[_0x5e75('0x1aa')],'minutes')[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x28fe90['ContactId'],'ListId':_0x28fe90['ListId'],'VoiceQueueId':_0x28fe90[_0x5e75('0xd4')]||undefined,'CampaignId':_0x28fe90[_0x5e75('0xd5')]||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1ab')));}break;case 0xa:if(_0x28fe90[_0x5e75('0x104')]>=_0x34ce24[_0x5e75('0x11d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x28fe90[_0x5e75('0x104')]+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24[_0x5e75('0x11e')],_0x5e75('0xfc'))[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x28fe90[_0x5e75('0xfd')],'ListId':_0x28fe90[_0x5e75('0xd3')],'VoiceQueueId':_0x28fe90['VoiceQueueId']||undefined,'CampaignId':_0x28fe90['CampaignId']||undefined})['catch'](loggerCatch(_0x5e75('0x11f')));break;case 0xb:if(_0x28fe90[_0x5e75('0xf3')]>=_0x34ce24[_0x5e75('0x125')]-0x1){return!![];}this[_0x5e75('0xc0')]({'active':![],'countabandonedretry':_0x28fe90['countabandonedretry']+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24[_0x5e75('0x126')],_0x5e75('0xfc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28fe90[_0x5e75('0xfd')],'ListId':_0x28fe90['ListId'],'VoiceQueueId':_0x28fe90[_0x5e75('0xd4')]||undefined,'CampaignId':_0x28fe90['CampaignId']||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x127')));break;case 0x13:if(_0x28fe90[_0x5e75('0xf4')]>=_0x34ce24['dialMachineMaxRetry']-0x1){return!![];}this[_0x5e75('0xc0')]({'active':![],'countmachineretry':_0x28fe90[_0x5e75('0xf4')]+=0x1,'scheduledat':moment()[_0x5e75('0xfa')](_0x34ce24[_0x5e75('0xfb')],_0x5e75('0xfc'))[_0x5e75('0x78')](_0x5e75('0x107')),'ContactId':_0x28fe90[_0x5e75('0xfd')],'ListId':_0x28fe90[_0x5e75('0xd3')],'VoiceQueueId':_0x28fe90[_0x5e75('0xd4')]||undefined,'CampaignId':_0x28fe90['CampaignId']||undefined})[_0x5e75('0xb2')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x28fe90['countagentrejectretry']>=_0x34ce24[_0x5e75('0x1ac')]-0x1){return!![];}this[_0x5e75('0xc0')]({'active':![],'countagentrejectretry':_0x28fe90[_0x5e75('0x105')]+=0x1,'scheduledat':moment()['add'](_0x34ce24[_0x5e75('0x1ad')],_0x5e75('0xfc'))[_0x5e75('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28fe90[_0x5e75('0xfd')],'ListId':_0x28fe90[_0x5e75('0xd3')],'VoiceQueueId':_0x28fe90[_0x5e75('0xd4')]||undefined,'CampaignId':_0x28fe90['CampaignId']||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1ae')));break;default:return!![];}};Dialer[_0x5e75('0x1b')]['callProgressDetecting']=function(_0x1ba632,_0xa389ec,_0x2aeab0){var _0x3dfb15=this;var _0x59e375=new History(_0x1ba632);return new BPromise(function(_0x2b5e31,_0x59dacd){if(_[_0x5e75('0x89')](_0xa389ec)&&typeof _0xa389ec!==_0x5e75('0x1af')){return _0x59dacd(msgResponse(_0x5e75('0x1b0'),'Failure',_0x5e75('0x1b1')));}if(_['isUndefined'](_0x2aeab0)&&typeof _0x2aeab0!==_0x5e75('0x1af')){return _0x59dacd(msgResponse(_0x5e75('0x1b0'),'Failure','evt\x20is\x20undefine'));}switch(_0x2aeab0[_0x5e75('0x110')]){case'0':_0xa389ec[_0x5e75('0x63')]+=0x1;_0x59e375['state']=0x0;_0x59e375[_0x5e75('0xaa')]=_0x5e75('0x1b2');_0x59e375['countnosuchnumberretry']+=0x1;_0x59e375['countglobal']+=0x1;ami[_0x5e75('0xe9')]('custom:agentnosuchnumber',ut['buildObj'](_0x1ba632,_0x5e75('0x1b3')));_0x3dfb15[_0x5e75('0xca')](_0x59e375)['catch'](loggerCatch(_0x5e75('0xf0')));if(_0x3dfb15['checkRetriveMax'](0x0,_0x1ba632,_0xa389ec)){if(_0x59e375[_0x5e75('0xf2')]>=_0xa389ec[_0x5e75('0x1a9')]){_0x3dfb15[_0x5e75('0xf8')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1b4'));}else{_0x3dfb15[_0x5e75('0xf6')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1b4'));}}break;case'3':_0xa389ec[_0x5e75('0x62')]+=0x1;_0x59e375[_0x5e75('0xa9')]=0x3;_0x59e375[_0x5e75('0xaa')]=_0x5e75('0x1b5');_0x59e375[_0x5e75('0xf1')]+=0x1;_0x59e375[_0x5e75('0x103')]+=0x1;ami[_0x5e75('0xe9')](_0x5e75('0x1b6'),ut[_0x5e75('0xeb')](_0x1ba632,_0x5e75('0x1b7')));_0x3dfb15[_0x5e75('0xca')](_0x59e375)[_0x5e75('0xb2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3dfb15[_0x5e75('0x19f')](0x3,_0x1ba632,_0xa389ec)){if(_0x59e375[_0x5e75('0xf1')]>=_0xa389ec[_0x5e75('0x1a2')]){_0x3dfb15['createStateFinal'](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1b8'));}else{_0x3dfb15[_0x5e75('0xf6')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1b8'));}}break;case'5':_0xa389ec[_0x5e75('0x1b9')]+=0x1;_0x59e375[_0x5e75('0xa9')]=0x5;_0x59e375[_0x5e75('0xaa')]=_0x5e75('0x1ba');_0x59e375[_0x5e75('0x1a0')]+=0x1;_0x59e375[_0x5e75('0x103')]+=0x1;ami[_0x5e75('0xe9')](_0x5e75('0x1bb'),ut[_0x5e75('0xeb')](_0x1ba632,_0x5e75('0x1bc')));_0x3dfb15[_0x5e75('0xca')](_0x59e375)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1bd')));if(_0x3dfb15[_0x5e75('0x19f')](0x5,_0x1ba632,_0xa389ec)){if(_0x59e375['countbusyretry']>=_0xa389ec[_0x5e75('0x1be')]){_0x3dfb15[_0x5e75('0xf8')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1bf'));}else{_0x3dfb15['stateGlobal'](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1bf'));}}break;case'8':_0xa389ec[_0x5e75('0x5e')]+=0x1;_0x59e375[_0x5e75('0xa9')]=0x8;_0x59e375[_0x5e75('0xaa')]=_0x5e75('0x1c0');_0x59e375[_0x5e75('0x1a1')]+=0x1;_0x59e375['countglobal']+=0x1;ami['emit'](_0x5e75('0x1c1'),ut[_0x5e75('0xeb')](_0x1ba632,_0x5e75('0x1c2')));_0x3dfb15[_0x5e75('0xca')](_0x59e375)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1c3')));if(_0x3dfb15[_0x5e75('0x19f')](0x8,_0x1ba632,_0xa389ec)){if(_0x59e375[_0x5e75('0x1a1')]>=_0xa389ec[_0x5e75('0x1a6')]){_0x3dfb15[_0x5e75('0xf8')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1c4'));}else{_0x3dfb15[_0x5e75('0xf6')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1c4'));}}break;case'11':_0xa389ec[_0x5e75('0x1c5')]+=0x1;_0x59e375[_0x5e75('0xa9')]=0xb;_0x59e375[_0x5e75('0xaa')]=_0x5e75('0x122');_0x59e375['countabandonedretry']+=0x1;_0x59e375[_0x5e75('0x103')]+=0x1;_0x3dfb15['createHistory'](_0x59e375)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x128')));if(_0x3dfb15['checkRetriveMax'](0xb,_0x1ba632,_0xa389ec)){if(_0x59e375[_0x5e75('0xf3')]>=_0xa389ec['dialAbandonedMaxRetry']){_0x3dfb15[_0x5e75('0xf8')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1c6'));}else{_0x3dfb15[_0x5e75('0xf6')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1c6'));}}break;case'20':_0xa389ec['outboundRejectCallsDay']+=0x1;_0x59e375[_0x5e75('0xa9')]=0x14;_0x59e375[_0x5e75('0xaa')]='AgentReject';_0x59e375[_0x5e75('0x105')]+=0x1;_0x59e375['countglobal']+=0x1;ami['emit'](_0x5e75('0x1c7'),ut['buildObj'](_0x1ba632,'agentreject'));_0x3dfb15[_0x5e75('0xca')](_0x59e375)['catch'](loggerCatch(_0x5e75('0x1c8')));if(_0x3dfb15[_0x5e75('0x19f')](0x14,_0x1ba632,_0xa389ec)){if(_0x59e375[_0x5e75('0x105')]>=_0xa389ec['dialAgentRejectMaxRetry']){_0x3dfb15[_0x5e75('0xf8')](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1c9'));}else{_0x3dfb15['stateGlobal'](_0x59e375,_0x2b5e31,_0x59dacd,_0x5e75('0x1c9'));}}break;default:_0xa389ec[_0x5e75('0x67')]+=0x1;_0x59e375['state']=0xc;_0x59e375[_0x5e75('0xaa')]=_0x2aeab0[_0x5e75('0x110')];_0x3dfb15[_0x5e75('0xca')](_0x59e375)[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1ca')));if(_0x3dfb15[_0x5e75('0x19f')](_0x2aeab0['reason'],_0x1ba632,_0xa389ec)){if(_0x59e375[_0x5e75('0x1a0')]+_0x59e375[_0x5e75('0x1a1')]+_0x59e375[_0x5e75('0xf1')]+_0x59e375[_0x5e75('0xf2')]+_0x59e375[_0x5e75('0x104')]+_0x59e375[_0x5e75('0xf3')]+_0x59e375['countmachineretry']+_0x59e375[_0x5e75('0x105')]>=_0xa389ec['dialGlobalMaxRetry']){_0x3dfb15['stateGlobal'](_0x59e375,_0x2b5e31,_0x59dacd,_0x2aeab0['reason']);}else{_0x3dfb15[_0x5e75('0xf8')](_0x59e375,_0x2b5e31,_0x59dacd,_0x2aeab0['reason']);}}}});};Dialer[_0x5e75('0x1b')][_0x5e75('0xf6')]=function(_0x52faf3,_0x2c24c7,_0x1a8b0d,_0x1588da){var _0x2f4cd9=new Final(_0x52faf3);_0x2f4cd9[_0x5e75('0xa9')]=0xf;_0x2f4cd9['statedesc']=_0x5e75('0x1cb');this[_0x5e75('0xf8')](_0x2f4cd9,_0x2c24c7,_0x1a8b0d,_0x1588da);};Dialer[_0x5e75('0x1b')][_0x5e75('0xf8')]=function(_0x1ec9c3,_0x47ded3,_0x40a7cd,_0x1b6122){this[_0x5e75('0xc8')](_0x1ec9c3)[_0x5e75('0xb7')](function(){return _0x47ded3(msgResponse(_0x5e75('0x1b0'),_0x5e75('0xd9'),_0x1b6122));})['catch'](function(){return _0x40a7cd(msgResponse(_0x5e75('0x1cc'),_0x5e75('0x14a'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x5e75('0xa')]=function(_0x31370c){var _0x349e20=_0x31370c[_0x5e75('0x1cd')]/0x64;var _0x237d1e=_0x31370c[_0x5e75('0x61')]/(_0x31370c[_0x5e75('0x61')]+_0x31370c['outboundAnswerCallsDay']);var _0x2d5283=Math[_0x5e75('0x1ce')](_0x31370c['predictiveIntervalAvailable']*(_0x31370c[_0x5e75('0x1cf')]/0x64));var _0x8b496e=Math[_0x5e75('0x1ce')](_0x31370c[_0x5e75('0x6e')]*(_0x31370c[_0x5e75('0x1d0')]/0x64));var _0x447762=_0x31370c[_0x5e75('0xa3')]+_0x31370c[_0x5e75('0x55')];var _0x49157e=Math[_0x5e75('0x1d1')](_0x31370c[_0x5e75('0x71')]*_0x31370c['erlangAbandonmentRate']*_0x31370c['predictiveIntervalHitRate']*_0x31370c[_0x5e75('0x6d')]);if(_[_0x5e75('0x89')](_0x31370c[_0x5e75('0x2a')])){if(!_['isUndefined'](_0x31370c[_0x5e75('0x29')])){_0x31370c[_0x5e75('0x29')]=undefined;loggerPredictive['error'](_0x5e75('0x1d2'),_0x5e75('0x1d3'));}if(!_[_0x5e75('0x89')](_0x31370c[_0x5e75('0x93')])){loggerPredictive['error'](_0x5e75('0x1d2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x31370c[_0x5e75('0x93')]);_0x31370c[_0x5e75('0x93')]=undefined;}_0x31370c['startProgressive']=moment()[_0x5e75('0x78')](_0x5e75('0x107'));loggerPredictive[_0x5e75('0x81')](_0x31370c['name'],_0x5e75('0x1d4'),_0x31370c[_0x5e75('0x2a')]);this['handlePower'](_0x31370c,0x1);}else if(ifInterval(_0x31370c[_0x5e75('0x1d5')],_0x31370c['startProgressive'])){this[_0x5e75('0x15b')](_0x31370c,0x1);loggerPredictiveCalls[_0x5e75('0x81')](_0x5e75('0x1d6'),_0x31370c[_0x5e75('0x2a')],_0x31370c['name']);_0x31370c[_0x5e75('0x71')]=0x0;_0x31370c[_0x5e75('0x6c')]=0x0;}else if(_0x349e20<_0x237d1e&&_0x31370c['dialPredictiveOptimization']===_0x5e75('0x1d7')){freeVariablesPredictive(_0x31370c);loggerPredictive['info'](_0x5e75('0x1d8'),_0x5e75('0x1d9'),_0x237d1e,_0x5e75('0x2a'),_0x31370c['name']);}else if(_0x49157e<_0x31370c['predictiveIntervalErlangCallsDroppedCalls']&&_0x31370c['dialPredictiveOptimization']===_0x5e75('0x1d7')){freeVariablesPredictive(_0x31370c);loggerPredictive[_0x5e75('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5e75('0x1da'),_0x49157e,_0x5e75('0x1db'),_0x31370c['predictiveIntervalErlangCallsDroppedCalls'],_0x5e75('0x2a'),_0x31370c[_0x5e75('0x3f')]);}else if(!ifInterval(_0x31370c['dialPredictiveInterval'],_0x31370c[_0x5e75('0x2a')])&&_[_0x5e75('0x89')](_0x31370c[_0x5e75('0x29')])&&!_[_0x5e75('0x89')](_0x31370c['startProgressive'])){_0x31370c['startPredictive']=moment()[_0x5e75('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5e75('0x81')](_0x31370c[_0x5e75('0x3f')],_0x5e75('0x1dc'),_0x31370c[_0x5e75('0x29')]);this['averageHandleTime'](_0x31370c[_0x5e75('0x1d5')])[_0x5e75('0xb7')](this[_0x5e75('0x1dd')](_0x31370c))['then'](mergeDataErlangB(_0x31370c))[_0x5e75('0xb7')](this['startMethodPredictive'](_0x31370c))[_0x5e75('0xb2')](loggerCatchPredictive(_0x5e75('0x1de'),_0x31370c));}else if(!ifInterval(_0x31370c[_0x5e75('0x1d5')],_0x31370c[_0x5e75('0x29')])){_0x31370c[_0x5e75('0x6c')]=0x0;_0x31370c[_0x5e75('0x29')]=moment()[_0x5e75('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5e75('0x81')](_0x31370c[_0x5e75('0x3f')],_0x5e75('0x1df'),_0x31370c[_0x5e75('0x29')]);clearInterval(_0x31370c[_0x5e75('0x93')]);_0x31370c['handlePredictive']=undefined;this['averageHandleTime'](_0x31370c[_0x5e75('0x1d5')])['then'](this[_0x5e75('0x1dd')](_0x31370c))[_0x5e75('0xb7')](mergeDataErlangB(_0x31370c))[_0x5e75('0xb7')](this[_0x5e75('0x1e0')](_0x31370c))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x31370c));}else if(_0x31370c[_0x5e75('0x6e')]&&_0x447762<_0x31370c['predictiveIntervalAvailable']-_0x8b496e){freeVariablesPredictive(_0x31370c);loggerPredictive[_0x5e75('0x81')](_0x31370c[_0x5e75('0x3f')],_0x5e75('0x1e1'),_0x447762,_0x5e75('0x1e2'),_0x31370c['predictiveIntervalAvailable'],'-',_0x8b496e,'=',_0x31370c[_0x5e75('0x6e')]-_0x8b496e,')');}else if(_0x31370c[_0x5e75('0x6e')]&&_0x447762>_0x31370c['predictiveIntervalAvailable']+_0x2d5283){freeVariablesPredictive(_0x31370c);loggerPredictive[_0x5e75('0x81')](_0x31370c[_0x5e75('0x3f')],_0x5e75('0x1e1'),_0x447762,_0x5e75('0x1e3'),_0x31370c[_0x5e75('0x6e')],'+',_0x2d5283,'=',_0x31370c[_0x5e75('0x6e')]+_0x2d5283,')');}};Dialer['prototype'][_0x5e75('0x1dd')]=function(_0x575284){var _0x21ee9a=this;return function(_0x52f640){return new BPromise(function(_0x4777ca,_0x59ab9b){_['merge'](_0x575284,_0x52f640[0x0]);if(checkGetDataPredictive(_0x52f640[0x0])){var _0x192b89=_0x575284['predictiveIntervalAvailable']=_0x575284[_0x5e75('0x55')]+_0x575284[_0x5e75('0xa3')];var _0xc0d649=_0x575284[_0x5e75('0x1d5')]*0x3c;var _0x172112=_0x52f640[0x0][_0x5e75('0x87')]+_0x52f640[0x0][_0x5e75('0x85')];var _0xc02116=(_0x52f640[0x0][_0x5e75('0x68')]+_0x52f640[0x0][_0x5e75('0x6a')]+_0x52f640[0x0][_0x5e75('0x69')])/_0x52f640[0x0][_0x5e75('0x6f')];_0x575284[_0x5e75('0x1e4')]=_0xc02116>0x0?_0xc02116:0x1;switch(_0x575284[_0x5e75('0x1e5')]){case'dropRate':var _0x2fb3d5=_0x575284['dialPredictiveOptimizationPercentage']/0x64;return _0x21ee9a['abandonmentRate'](_0x192b89,_0xc0d649,_0x172112,_0xc02116,_0x2fb3d5)[_0x5e75('0xb7')](function(_0x1296a0){return _0x4777ca(_0x1296a0);});case _0x5e75('0x1e6'):var _0x2e5ab5=_0x575284[_0x5e75('0x1cd')]/0x64;return _0x21ee9a[_0x5e75('0x1e7')](_0x192b89,_0xc0d649,_0x172112,_0xc02116,_0x2e5ab5)[_0x5e75('0xb7')](function(_0x2f26ef){return _0x4777ca(_0x2f26ef);});default:return _0x59ab9b(msgResponse(_0x5e75('0x1e8'),'Failure',_0x5e75('0x1e9')));}}else{return _0x59ab9b(msgResponse(_0x5e75('0x1e8'),_0x5e75('0x14a'),_0x5e75('0x1ea')));}});};};Dialer['prototype'][_0x5e75('0x1eb')]=function(_0x56fad0){var _0x44ce6f=this;return function(_0x5e5448){return new BPromise(function(_0x45b213,_0x437d23){_[_0x5e75('0x91')](_0x56fad0,_0x5e5448[0x0]);if(checkGetDataPredictive(_0x5e5448[0x0])){loggerPredictive['info'](JSON[_0x5e75('0x49')](_0x5e5448[0x0]));if(_0x56fad0[_0x5e75('0x1e5')]===_0x5e75('0x1d7')){return _0x44ce6f['getVoiceQueueRtPauses'](_0x56fad0['id'])[_0x5e75('0xb7')](function(_0x3a10cf){var _0x3d2f6c=_0x56fad0[_0x5e75('0x51')]-_0x3a10cf[0x0][_0x5e75('0x1ec')];var _0x2f49b1=_0x56fad0[_0x5e75('0x1d5')]*0x3c;var _0x260189=_0x5e5448[0x0][_0x5e75('0x87')]+_0x5e5448[0x0][_0x5e75('0x85')];var _0x143d57=(_0x5e5448[0x0][_0x5e75('0x68')]+_0x5e5448[0x0][_0x5e75('0x6a')]+_0x5e5448[0x0][_0x5e75('0x69')])/_0x5e5448[0x0][_0x5e75('0x6f')];var _0x3431c9=_0x56fad0[_0x5e75('0x1cd')]/0x64;_0x56fad0[_0x5e75('0x1ed')]=_0x3a10cf[0x0]['outboundQueuePauses']||0x0;_0x56fad0[_0x5e75('0x1e4')]=_0x143d57>0x0?_0x143d57:0x1;return _0x44ce6f[_0x5e75('0x1ee')](_0x3d2f6c,_0x2f49b1,_0x260189,_0x143d57,_0x3431c9);})['then'](function(_0x289e79){return _0x45b213(_0x289e79);})[_0x5e75('0xb2')](function(_0x1a53ea){return _0x437d23(msgResponse(_0x5e75('0x1ef'),'Failure',JSON[_0x5e75('0x49')](_0x1a53ea)));});}if(_0x56fad0[_0x5e75('0x1e5')]===_0x5e75('0x1e6')){return _0x44ce6f[_0x5e75('0xc6')](_0x56fad0['id'])[_0x5e75('0xb7')](function(_0xee1a5e){var _0x23e1da=_0x56fad0['loggedIn']-_0xee1a5e[0x0][_0x5e75('0x1ec')];var _0x9094cd=_0x56fad0[_0x5e75('0x1d5')]*0x3c;var _0x5a37bb=_0x5e5448[0x0][_0x5e75('0x87')]+_0x5e5448[0x0][_0x5e75('0x85')];var _0x42771b=(_0x5e5448[0x0][_0x5e75('0x68')]+_0x5e5448[0x0][_0x5e75('0x6a')]+_0x5e5448[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5e5448[0x0][_0x5e75('0x6f')];var _0x54f24c=_0x56fad0[_0x5e75('0x1cd')]/0x64;_0x56fad0['predictiveIntervalPauses']=_0xee1a5e[0x0][_0x5e75('0x1ec')]||0x0;_0x56fad0[_0x5e75('0x1e4')]=_0x42771b>0x0?_0x42771b:0x1;return _0x44ce6f['busyFactor'](_0x23e1da,_0x9094cd,_0x5a37bb,_0x42771b,_0x54f24c);})['then'](function(_0x4d8c18){return _0x45b213(_0x4d8c18);})[_0x5e75('0xb2')](function(_0x45ea24){return _0x437d23(msgResponse('[CatchErlangB]',_0x5e75('0x14a'),JSON['stringify'](_0x45ea24)));});}}else{return _0x437d23(msgResponse(_0x5e75('0x1e8'),'Failure',_0x5e75('0x1ea')));}});};};Dialer['prototype'][_0x5e75('0x1e0')]=function(_0x270661){var _0x1269b3=this;return function(){var _0xa3e68a=0x0;var _0x8fa39e=Math[_0x5e75('0x1d1')](_0x270661[_0x5e75('0x72')]*0x3e8);if(_0x8fa39e>0x0){_0x8fa39e=_0x8fa39e<0x64?0x64:_0x8fa39e;loggerPredictive['info'](_0x270661[_0x5e75('0x3f')],'one\x20call\x20every:',_0x8fa39e,_0x5e75('0x4a'));_0x270661[_0x5e75('0x93')]=setInterval(function(){_0x1269b3[_0x5e75('0x93')](_0x270661);loggerPredictiveCalls['info'](_0x5e75('0x1f0'),_0xa3e68a+=0x1);},_0x8fa39e);}else{loggerPredictive[_0x5e75('0x81')](_0x270661[_0x5e75('0x3f')],_0x5e75('0x1f1'));}};};Dialer[_0x5e75('0x1b')][_0x5e75('0x1f2')]=function(_0x1120e8,_0xdf16d5){var _0x24fd00=this;return function(_0x1c36f1){if(_[_0x5e75('0x7e')](_0x1c36f1)){if(_['isNil'](_0xdf16d5[_0x5e75('0x1f3')])||!_0xdf16d5[_0x5e75('0x1f4')]){if(_0x1120e8[_0x5e75('0x59')]===_0x5e75('0x9')){_0x1120e8[_0x5e75('0x132')]=_['isUndefined'](_0x1120e8[_0x5e75('0x132')])?!![]:_0x1120e8['queueStatusComplete'];var _0x44de21=uuid['v4']();_0x24fd00[_0x5e75('0x26')][_0x44de21]=new Action(_0x1120e8,_0xdf16d5,_0x44de21);loggerBooked[_0x5e75('0x81')]('[booked][checkContactBlack]',_0x44de21,'queueStatusComplete:\x20',JSON[_0x5e75('0x49')](_0x1120e8['queueStatusComplete']),_0x5e75('0x1f5'),_0x1120e8[_0x5e75('0x3f')]);if(_0x1120e8[_0x5e75('0x132')]){_0x1120e8[_0x5e75('0x132')]=![];_0x24fd00[_0x5e75('0x12f')][_0x24fd00[_0x5e75('0x26')][_0x44de21]['queue']]=[];ami[_0x5e75('0xaf')]({'actionid':_0x44de21,'action':'queuestatus','queue':_0x1120e8['name']})[_0x5e75('0xb2')](function(){_0x24fd00[_0x5e75('0xb3')](_0x1120e8);_0x24fd00[_0x5e75('0xc0')]({'active':![],'ContactId':_0x24fd00[_0x5e75('0x26')][_0x44de21][_0x5e75('0xfd')],'ListId':_0x24fd00[_0x5e75('0x26')][_0x44de21][_0x5e75('0xd3')],'VoiceQueueId':_0x24fd00['actions'][_0x44de21]['VoiceQueueId']||undefined,'CampaignId':_0x24fd00[_0x5e75('0x26')][_0x44de21][_0x5e75('0xd5')]||undefined})['catch'](loggerCatch(_0x5e75('0x1f6')));delete _0x24fd00['actions'][_0x44de21];});}else{loggerBooked[_0x5e75('0x81')]('[booked][checkContactBlack][else]',JSON[_0x5e75('0x49')](_0x1120e8[_0x5e75('0x132')]),_0x5e75('0x1f5'),_0x1120e8[_0x5e75('0x3f')]);_0x24fd00['updateOriginated'](_0x1120e8);_0x24fd00['rescheduleContact']({'active':![],'ContactId':_0x24fd00[_0x5e75('0x26')][_0x44de21][_0x5e75('0xfd')],'ListId':_0x24fd00[_0x5e75('0x26')][_0x44de21][_0x5e75('0xd3')],'VoiceQueueId':_0x24fd00['actions'][_0x44de21]['VoiceQueueId']||undefined,'CampaignId':_0x24fd00[_0x5e75('0x26')][_0x44de21][_0x5e75('0xd5')]||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1f6')));delete _0x24fd00[_0x5e75('0x26')][_0x44de21];}}else{return _0x24fd00[_0x5e75('0x16e')](_0x1120e8,_0xdf16d5);}}else{if(getDiff(_0xdf16d5[_0x5e75('0x1f7')])<_0x1120e8[_0x5e75('0x1f8')]*0x3c){if(_0xdf16d5[_0x5e75('0x160')]&&!_0xdf16d5['Agent']['voicePause']){_0x24fd00['preview'][_0x5e75('0x134')](_0xdf16d5['id'])[_0x5e75('0x1e')](function(){_0x24fd00[_0x5e75('0xb3')](_0x1120e8);});}else{_0x24fd00[_0x5e75('0xc2')]({'active':![]},_0xdf16d5['id'],0x1)[_0x5e75('0x1e')](function(){_0x24fd00[_0x5e75('0xb3')](_0x1120e8);});}}else{_0x1120e8['outboundReCallsDay']+=0x1;_0x24fd00[_0x5e75('0xb3')](_0x1120e8);if(_0x1120e8[_0x5e75('0x1f9')]){_0x24fd00[_0x5e75('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xdf16d5[_0x5e75('0xfd')],'ListId':_0xdf16d5[_0x5e75('0xd3')],'VoiceQueueId':_0xdf16d5['VoiceQueueId']||undefined,'CampaignId':_0xdf16d5['CampaignId']||undefined})[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1fa')));_0x24fd00[_0x5e75('0xca')](createObjHistory(_0x1120e8,_0xdf16d5,_0x5e75('0x1fb'),0x17,'RecallInQueue'))[_0x5e75('0xb2')](loggerCatch(_0x5e75('0x1fc')));}else{_0x24fd00['saveInDb'](createObjHistory(_0x1120e8,_0xdf16d5,_0x5e75('0x1fd'),0x16,'RecallFailedTimeout'),_0x5e75('0x1fe'),_0x5e75('0x1ff'));}}}}else{_0x1120e8[_0x5e75('0x5d')]+=0x1;_0x24fd00[_0x5e75('0xd1')](createObjHistory(_0x1120e8,_0xdf16d5,_0x5e75('0x200'),0xd,_0x5e75('0x201')),_0x5e75('0x202'),_0x5e75('0x203'));throw _0x5e75('0x204');}};};Dialer[_0x5e75('0x1b')][_0x5e75('0x205')]=function(_0x3b2d37){var _0x315e2b=this;var _0xd77150=_0x3b2d37[_0x5e75('0x206')]-_0x3b2d37['originated']-_0x3b2d37[_0x5e75('0xc4')];emitCampaignSummary(_0x3b2d37);if(_0xd77150>0x0){if(_0xd77150>this['maxNumberOriginate']){_0xd77150=this[_0x5e75('0x24')];}_0x3b2d37[_0x5e75('0xc4')]+=_0xd77150;this[_0x5e75('0x207')](_0x3b2d37['id'],_0xd77150,_0x3b2d37[_0x5e75('0x208')],_0x3b2d37)[_0x5e75('0xb7')](function(_0x592824){_0x3b2d37[_0x5e75('0xc4')]-=_0xd77150;_0x3b2d37[_0x5e75('0xc4')]=_0x3b2d37[_0x5e75('0xc4')]>0x0?_0x3b2d37[_0x5e75('0xc4')]:0x0;if(!checkContactEmpty(_0x592824)){_0x3b2d37[_0x5e75('0x3d')]=_0x5e75('0xa0');logger['info']('[getContactCampaign2][Empty]'+_0x3b2d37[_0x5e75('0x3f')]);}else{_0x3b2d37[_0x5e75('0x70')]+=_0x592824[_0x5e75('0x138')];_0x3b2d37[_0x5e75('0x3d')]=_0x5e75('0x209');for(var _0x3b196f=0x0;_0x3b196f<_0x592824[_0x5e75('0x138')];_0x3b196f+=0x1){_0x3b2d37[_0x5e75('0x20a')]+=0x1;if(_['isNil'](_0x592824[_0x3b196f])||_['isNil'](_0x592824[_0x3b196f][_0x5e75('0x16f')])||_[_0x5e75('0xde')](_0x592824[_0x3b196f][_0x5e75('0x16f')][_0x5e75('0x170')])){_0x315e2b['emptyContact'](_0x5e75('0x20b'),_0x3b2d37,_0x592824[_0x3b196f]);}else{_0x315e2b[_0x5e75('0xbc')](_[_0x5e75('0xd2')](_0x592824[_0x3b196f],[_0x5e75('0xd5'),_0x5e75('0x20c')]))[_0x5e75('0xb7')](_0x315e2b[_0x5e75('0x1f2')](_0x3b2d37,_0x592824[_0x3b196f]))[_0x5e75('0xb2')](_0x315e2b[_0x5e75('0xce')](_0x5e75('0x20d'),_0x3b2d37));}}}})['catch'](loggerGetContactDialer(_0x5e75('0x20e'),_0x3b2d37,_0xd77150));}};Dialer[_0x5e75('0x1b')][_0x5e75('0x15b')]=function(_0x1bea19,_0x9f6362){var _0x4383a8=this;var _0x505b23=[];var _0x8832f4=_0x9f6362>=0x1?_0x9f6362:0x1;if(_0x1bea19['dialMethod']===_0x5e75('0x9')){_0x8832f4=0x1;}var _0x56d6d1=Math[_0x5e75('0x1d1')](_0x1bea19[_0x5e75('0xa3')]*_0x8832f4)-_0x1bea19[_0x5e75('0x70')]-_0x1bea19[_0x5e75('0xc4')];emitVoiceQueueSummary(_0x1bea19);if(_0x1bea19['dialLimitQueue']>0x0){var _0x3cdf4e=_0x1bea19[_0x5e75('0x20f')]-_0x1bea19[_0x5e75('0x70')]-_0x1bea19[_0x5e75('0x55')]-_0x1bea19['temp']-_0x1bea19[_0x5e75('0x52')];if(_0x56d6d1>_0x3cdf4e){_0x56d6d1=_0x3cdf4e;}}if(_0x56d6d1>0x0){if(_0x1bea19[_0x5e75('0x59')]===_0x5e75('0x9')){_0x56d6d1=0x1;}if(_0x56d6d1>this['maxNumberOriginate']){_0x56d6d1=this[_0x5e75('0x24')];}_0x1bea19['temp']+=_0x56d6d1;for(var _0x4b48f9 in this[_0x5e75('0x22')]){if(typeof this[_0x5e75('0x22')][_0x4b48f9]!==_0x5e75('0x9b')){if(this['agents'][_0x4b48f9][_0x5e75('0xa9')]===_0x5e75('0x210')&&this[_0x5e75('0x22')][_0x4b48f9]['status']===_0x5e75('0xdc')){_0x505b23[_0x5e75('0x130')](this['agents'][_0x4b48f9]['id']);}}}this['getContactDialer'](_0x1bea19['id'],_0x505b23,_0x56d6d1,_0x1bea19['dialOrderByScheduledAt'],_0x1bea19)[_0x5e75('0xb7')](function(_0x3f5f47){_0x1bea19[_0x5e75('0xc4')]-=_0x56d6d1;_0x1bea19[_0x5e75('0xc4')]=_0x1bea19[_0x5e75('0xc4')]>0x0?_0x1bea19[_0x5e75('0xc4')]:0x0;if(!checkContactEmpty(_0x3f5f47)){_0x4383a8[_0x5e75('0xb8')](_0x1bea19)['then'](sendMessageReschedule(_0x1bea19))[_0x5e75('0xb2')](loggerCatch(_0x5e75('0xb9')));}else{_0x1bea19['originated']+=_0x3f5f47[_0x5e75('0x138')];_0x1bea19[_0x5e75('0x3d')]=_0x1bea19[_0x5e75('0x59')]===_0x5e75('0x9')?'ACTIVE':_0x5e75('0x209');for(var _0x147fa4=0x0;_0x147fa4<_0x3f5f47[_0x5e75('0x138')];_0x147fa4+=0x1){if(_[_0x5e75('0xde')](_0x3f5f47[_0x147fa4])||_['isNil'](_0x3f5f47[_0x147fa4]['Contact'])||_[_0x5e75('0xde')](_0x3f5f47[_0x147fa4][_0x5e75('0x16f')]['phone'])){_0x4383a8[_0x5e75('0xcf')](_0x5e75('0x20b'),_0x1bea19,_0x3f5f47[_0x147fa4]);}else{_0x4383a8[_0x5e75('0xba')](_[_0x5e75('0xd2')](_0x3f5f47[_0x147fa4],[_0x5e75('0xd4'),_0x5e75('0x20c')]))[_0x5e75('0xb7')](_0x4383a8[_0x5e75('0x1f2')](_0x1bea19,_0x3f5f47[_0x147fa4]))[_0x5e75('0xb2')](_0x4383a8[_0x5e75('0xce')](_0x5e75('0x20b'),_0x1bea19));}}}})[_0x5e75('0xb2')](loggerGetContactDialer(_0x5e75('0x211'),_0x1bea19,_0x56d6d1));}};Dialer[_0x5e75('0x1b')][_0x5e75('0x93')]=function(_0x15f3c9){if(_0x15f3c9[_0x5e75('0x20f')]>0x0){var _0x316897=_0x15f3c9[_0x5e75('0x20f')]-_0x15f3c9['originated']-_0x15f3c9[_0x5e75('0x55')];if(_0x316897>0x0){this[_0x5e75('0x212')](_0x15f3c9);}else{loggerPredictiveCalls['info'](_0x5e75('0x213'));}}else{this[_0x5e75('0x212')](_0x15f3c9);}};Dialer[_0x5e75('0x1b')]['tryOriginatePredictive']=function(_0x553697){var _0x3d1f80=this;var _0xda0c69=[];_0x553697['originated']+=0x1;for(var _0x3186e6 in this[_0x5e75('0x22')]){if(typeof this[_0x5e75('0x22')][_0x3186e6]!==_0x5e75('0x9b')){if(this[_0x5e75('0x22')][_0x3186e6][_0x5e75('0xa9')]===_0x5e75('0x210')&&this[_0x5e75('0x22')][_0x3186e6]['status']==='reachable'){_0xda0c69[_0x5e75('0x130')](this['agents'][_0x3186e6]['id']);}}}this[_0x5e75('0x214')](_0x553697['id'],_0xda0c69,0x1,_0x553697[_0x5e75('0x208')],_0x553697)[_0x5e75('0xb7')](function(_0xceea15){if(!checkContactEmpty(_0xceea15)){checkContactLowerLimitOriginate(_0x553697,0x1,0x0);_0x3d1f80[_0x5e75('0xb8')](_0x553697)['then'](sendMessageReschedule(_0x553697))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x553697[_0x5e75('0x3d')]=_0x5e75('0x209');if(_[_0x5e75('0xde')](_0xceea15[0x0])||_['isNil'](_0xceea15[0x0][_0x5e75('0x16f')])||_[_0x5e75('0xde')](_0xceea15[0x0][_0x5e75('0x16f')]['phone'])){_0x3d1f80[_0x5e75('0xcf')]('[actionOriginate]\x20',_0x553697,_0xceea15[0x0]);}else{_0x3d1f80[_0x5e75('0xba')](_[_0x5e75('0xd2')](_0xceea15[0x0],[_0x5e75('0xd4'),_0x5e75('0x20c')]))['then'](_0x3d1f80[_0x5e75('0x1f2')](_0x553697,_0xceea15[0x0]))[_0x5e75('0xb2')](_0x3d1f80[_0x5e75('0xce')](_0x5e75('0x215'),_0x553697));}}})[_0x5e75('0xb2')](loggerGetContactDialer('[getContactDialerPredictive]',_0x553697,0x1));emitVoiceQueueSummary(_0x553697);};Dialer['prototype']['abandonmentRate']=function(_0x49bafb,_0x863701,_0x3e85fc,_0x5a7e75,_0x3e07db,_0x152cbd){loggerPredictive['info'](_0x5e75('0x216'));loggerPredictive[_0x5e75('0x81')](_0x5e75('0x217'),_0x49bafb);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x218'),_0x863701);loggerPredictive['info']('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',_0x3e85fc);loggerPredictive['info'](_0x5e75('0x219'),_0x5a7e75);loggerPredictive['info'](_0x5e75('0x21a'),_0x3e07db);loggerPredictive['info'](_0x5e75('0x88'));return new BPromise(function(_0x3619c1,_0x227560){if(_0x49bafb<=0x0||isNaN(_0x49bafb)){return _0x227560(msgResponse(_0x5e75('0x21b'),_0x5e75('0x48'),'m\x20=\x20'+_0x49bafb));}if(_0x3e85fc<=0x0||isNaN(_0x3e85fc)){return _0x227560(msgResponse(_0x5e75('0x21b'),_0x5e75('0x48'),'Ts\x20=\x20'+_0x3e85fc));}if(_0x5a7e75<=0x0||isNaN(_0x5a7e75)){return _0x227560(msgResponse('[abandonmentRate]',_0x5e75('0x48'),_0x5e75('0x21c')+_0x5a7e75));}if(_0x863701<=0x0||isNaN(_0x863701)){return _0x227560(msgResponse(_0x5e75('0x21b'),'Error','interval\x20=\x20'+_0x863701));}if(_0x3e07db<=0x0||isNaN(_0x3e07db)){return _0x227560(msgResponse('[abandonmentRate]',_0x5e75('0x48'),_0x5e75('0x21d')+_0x3e07db));}_0x152cbd=_0x152cbd||0x0;var _0x14e240=0x1/_0x3e85fc;var _0x265ee8=0x0;var _0x38125c=0x0;var _0x227c14=0x0;var _0x296474=0x0;for(var _0x4a8e06=0x0;_0x227c14<_0x3e07db;_0x4a8e06+=0x1){_0x38125c=_0x4a8e06/_0x863701;_0x265ee8=(_0x5a7e75*_0x38125c+_0x152cbd)/_0x14e240;_0x227c14=erlangb(_0x265ee8,_0x49bafb);_0x296474=_0x265ee8/_0x49bafb*(0x1-erlangb(_0x265ee8,_0x49bafb));}return _0x3619c1({'erlangCalls':_0x4a8e06,'erlangCallToSecond':_0x863701/_0x4a8e06,'erlangAbandonmentRate':_0x227c14,'erlangBusyFactor':_0x296474});});};Dialer[_0x5e75('0x1b')]['busyFactor']=function(_0x27ed25,_0x34e3f0,_0x3c1be8,_0x5d27ec,_0xc5030c,_0x117d9){loggerPredictive[_0x5e75('0x81')](_0x5e75('0x21e'));loggerPredictive[_0x5e75('0x81')]('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',_0x27ed25);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x218'),_0x34e3f0);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x21f'),_0x3c1be8);loggerPredictive['info'](_0x5e75('0x219'),_0x5d27ec);loggerPredictive[_0x5e75('0x81')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc5030c);loggerPredictive[_0x5e75('0x81')](_0x5e75('0x88'));return new BPromise(function(_0x3a113f,_0x3d496a){if(_0x27ed25<=0x0||isNaN(_0x27ed25)){return _0x3d496a(msgResponse(_0x5e75('0x220'),_0x5e75('0x48'),_0x5e75('0x221')+_0x27ed25));}if(_0x3c1be8<=0x0||isNaN(_0x3c1be8)){return _0x3d496a(msgResponse(_0x5e75('0x220'),_0x5e75('0x48'),_0x5e75('0x222')+_0x3c1be8));}if(_0x5d27ec<=0x0||isNaN(_0x5d27ec)){return _0x3d496a(msgResponse(_0x5e75('0x220'),'Error',_0x5e75('0x21c')+_0x5d27ec));}if(_0x34e3f0<=0x0||isNaN(_0x34e3f0)){return _0x3d496a(msgResponse(_0x5e75('0x220'),_0x5e75('0x48'),_0x5e75('0x223')+_0x34e3f0));}if(_0xc5030c<=0x0||isNaN(_0xc5030c)){return _0x3d496a(msgResponse(_0x5e75('0x220'),'Error',_0x5e75('0x224')+_0xc5030c));}_0x117d9=_0x117d9||0x0;var _0x4f442f=0x1/_0x3c1be8;var _0x367050=0x0;var _0x1ba134=0x0;var _0x4aa0db=0x0;var _0x49cc5a=0x0;for(var _0x14c0f1=0x0;_0x49cc5a<_0xc5030c;_0x14c0f1+=0x1){_0x1ba134=_0x14c0f1/_0x34e3f0;_0x367050=(_0x5d27ec*_0x1ba134+_0x117d9)/_0x4f442f;_0x4aa0db=erlangb(_0x367050,_0x27ed25);_0x49cc5a=_0x367050/_0x27ed25*(0x1-erlangb(_0x367050,_0x27ed25));}return _0x3a113f({'erlangCalls':_0x14c0f1,'erlangCallToSecond':_0x34e3f0/_0x14c0f1,'erlangAbandonmentRate':_0x4aa0db,'erlangBusyFactor':_0x49cc5a});});};module[_0x5e75('0x225')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ef79232..2e0565e 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6189=['endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime'];(function(_0x8c4b4b,_0x2330db){var _0x5656fb=function(_0x338278){while(--_0x338278){_0x8c4b4b['push'](_0x8c4b4b['shift']());}};_0x5656fb(++_0x2330db);}(_0x6189,0x98));var _0x9618=function(_0x4c73f1,_0x24a43e){_0x4c73f1=_0x4c73f1-0x0;var _0x1d4ab7=_0x6189[_0x4c73f1];return _0x1d4ab7;};'use strict';var util=require(_0x9618('0x0'));var _=require(_0x9618('0x1'));var moment=require(_0x9618('0x2'));function getSeconds(_0x10c84a,_0x4e0b4f){var _0xa63df0=moment(_0x10c84a)[_0x9618('0x3')](0x0);var _0xfe5c0c=moment(_0x4e0b4f)['milliseconds'](0x0);return _0xa63df0[_0x9618('0x4')](_0xfe5c0c,_0x9618('0x5'));}function QueueCallerAbandon(_0x34a30f,_0x5d9e56){this['scheduledat']=_0x34a30f['scheduledat'];this['type']=_0x34a30f[_0x9618('0x6')];this[_0x9618('0x7')]=_0x34a30f[_0x9618('0x6')]==='outbound'?'queue':_0x34a30f[_0x9618('0x6')];this[_0x9618('0x8')]=_0x34a30f['countbusyretry'];this[_0x9618('0x9')]=_0x34a30f[_0x9618('0x9')];this[_0x9618('0xa')]=_0x34a30f[_0x9618('0xa')];this[_0x9618('0xb')]=_0x34a30f['countbusyretry']+_0x34a30f[_0x9618('0x9')]+_0x34a30f[_0x9618('0xa')]+_0x34a30f[_0x9618('0xc')]+_0x34a30f[_0x9618('0xd')]+_0x34a30f['countabandonedretry']+_0x34a30f[_0x9618('0xe')]+_0x34a30f[_0x9618('0xf')];this[_0x9618('0xc')]=_0x34a30f['countnosuchnumberretry'];this[_0x9618('0xd')]=_0x34a30f[_0x9618('0xd')];this[_0x9618('0x10')]=_0x34a30f[_0x9618('0x10')];this[_0x9618('0xe')]=_0x34a30f[_0x9618('0xe')];this[_0x9618('0xf')]=_0x34a30f['countagentrejectretry'];this['uniqueid']=_0x5d9e56['uniqueid'];this[_0x9618('0x11')]=_0x34a30f[_0x9618('0x12')];this[_0x9618('0x13')]=_0x34a30f[_0x9618('0x14')];this[_0x9618('0x15')]=_0x34a30f[_0x9618('0x15')];this['responsetime']=_0x34a30f[_0x9618('0x16')];this['droptime']=_0x34a30f[_0x9618('0x17')];this[_0x9618('0x18')]=this['droptime'];this[_0x9618('0x19')]=getSeconds(_0x34a30f[_0x9618('0x16')],_0x34a30f['starttime']);this[_0x9618('0x1a')]=getSeconds(this[_0x9618('0x17')],_0x34a30f['responsetime']);this[_0x9618('0x1b')]=0x0;this['queue']=_0x5d9e56[_0x9618('0x1c')];this[_0x9618('0x1d')]=_0x5d9e56[_0x9618('0x1e')];this[_0x9618('0x1f')]=_0x5d9e56[_0x9618('0x1f')];this[_0x9618('0x20')]=_0x34a30f[_0x9618('0x20')];this[_0x9618('0x21')]=_0x34a30f[_0x9618('0x21')];this['callbackat']=_0x34a30f[_0x9618('0x22')];this[_0x9618('0x23')]=_0x34a30f[_0x9618('0x23')];this[_0x9618('0x24')]=_0x34a30f[_0x9618('0x24')];this[_0x9618('0x25')]=_0x34a30f[_0x9618('0x25')];this[_0x9618('0x26')]=_0x34a30f['UserId'];this[_0x9618('0x27')]=_0x34a30f[_0x9618('0x27')];this[_0x9618('0x28')]=_0x34a30f['CampaignId'];this[_0x9618('0x29')]=_0x34a30f[_0x9618('0x29')]||'';this[_0x9618('0x2a')]=_0x34a30f[_0x9618('0x2a')]||'';}module[_0x9618('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x2800=['endtime','ringtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime'];(function(_0x52d209,_0x143cc6){var _0x2e2aa4=function(_0x5b77ce){while(--_0x5b77ce){_0x52d209['push'](_0x52d209['shift']());}};_0x2e2aa4(++_0x143cc6);}(_0x2800,0xba));var _0x0280=function(_0x3fb682,_0x136633){_0x3fb682=_0x3fb682-0x0;var _0x1c5a77=_0x2800[_0x3fb682];return _0x1c5a77;};'use strict';var util=require('util');var _=require(_0x0280('0x0'));var moment=require(_0x0280('0x1'));function getSeconds(_0x5f3b76,_0x3459a1){var _0x11f383=moment(_0x5f3b76)[_0x0280('0x2')](0x0);var _0x5efc91=moment(_0x3459a1)[_0x0280('0x2')](0x0);return _0x11f383['diff'](_0x5efc91,'seconds');}function QueueCallerAbandon(_0x769405,_0x75a1ec){this[_0x0280('0x3')]=_0x769405[_0x0280('0x3')];this[_0x0280('0x4')]=_0x769405[_0x0280('0x4')];this[_0x0280('0x5')]=_0x769405[_0x0280('0x4')]===_0x0280('0x6')?_0x0280('0x7'):_0x769405[_0x0280('0x4')];this['countbusyretry']=_0x769405[_0x0280('0x8')];this[_0x0280('0x9')]=_0x769405[_0x0280('0x9')];this[_0x0280('0xa')]=_0x769405[_0x0280('0xa')];this[_0x0280('0xb')]=_0x769405[_0x0280('0x8')]+_0x769405[_0x0280('0x9')]+_0x769405[_0x0280('0xa')]+_0x769405[_0x0280('0xc')]+_0x769405['countdropretry']+_0x769405[_0x0280('0xd')]+_0x769405[_0x0280('0xe')]+_0x769405[_0x0280('0xf')];this[_0x0280('0xc')]=_0x769405[_0x0280('0xc')];this[_0x0280('0x10')]=_0x769405[_0x0280('0x10')];this['countabandonedretry']=_0x769405[_0x0280('0xd')];this[_0x0280('0xe')]=_0x769405[_0x0280('0xe')];this[_0x0280('0xf')]=_0x769405['countagentrejectretry'];this[_0x0280('0x11')]=_0x75a1ec[_0x0280('0x11')];this['calleridname']=_0x769405[_0x0280('0x12')];this[_0x0280('0x13')]=_0x769405[_0x0280('0x14')];this[_0x0280('0x15')]=_0x769405['starttime'];this[_0x0280('0x16')]=_0x769405[_0x0280('0x16')];this[_0x0280('0x17')]=_0x769405[_0x0280('0x17')];this[_0x0280('0x18')]=this[_0x0280('0x17')];this[_0x0280('0x19')]=getSeconds(_0x769405[_0x0280('0x16')],_0x769405['starttime']);this['holdtime']=getSeconds(this['droptime'],_0x769405['responsetime']);this[_0x0280('0x1a')]=0x0;this['queue']=_0x75a1ec['queue'];this[_0x0280('0x1b')]=_0x75a1ec[_0x0280('0x1c')];this[_0x0280('0x1d')]=_0x75a1ec['reason'];this['callback']=_0x769405[_0x0280('0x1e')];this[_0x0280('0x1f')]=_0x769405[_0x0280('0x1f')];this[_0x0280('0x20')]=_0x769405[_0x0280('0x20')];this[_0x0280('0x21')]=_0x769405[_0x0280('0x21')];this['ContactId']=_0x769405[_0x0280('0x22')];this['ListId']=_0x769405[_0x0280('0x23')];this[_0x0280('0x24')]=_0x769405['UserId'];this[_0x0280('0x25')]=_0x769405[_0x0280('0x25')];this[_0x0280('0x26')]=_0x769405[_0x0280('0x26')];this['originatecalleridnum']=_0x769405[_0x0280('0x27')]||'';this['originatecalleridname']=_0x769405[_0x0280('0x28')]||'';}module[_0x0280('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 16c3b9c..e5e34a5 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(_0x370454,_0x3ad94d){var _0x20c0c8=function(_0x18161a){while(--_0x18161a){_0x370454['push'](_0x370454['shift']());}};_0x20c0c8(++_0x3ad94d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x2d338c,_0x74a774){var _0x9b034=function(_0x2cf9b9){while(--_0x2cf9b9){_0x2d338c['push'](_0x2d338c['shift']());}};_0x9b034(++_0x74a774);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 e47d8f9..35e1f84 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 _0xd87e=['uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','unmonitored','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','./util/gs','fax','../ami','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','syncNewExten','bind','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels'];(function(_0x5e73a4,_0x3119f1){var _0x1d3cc7=function(_0x1530fc){while(--_0x1530fc){_0x5e73a4['push'](_0x5e73a4['shift']());}};_0x1d3cc7(++_0x3119f1);}(_0xd87e,0x1bf));var _0xed87=function(_0x2bc6b8,_0x24f5b0){_0x2bc6b8=_0x2bc6b8-0x0;var _0x1b5ce6=_0xd87e[_0x2bc6b8];return _0x1b5ce6;};'use strict';var util=require(_0xed87('0x0'));var _=require(_0xed87('0x1'));var BPromise=require('bluebird');var uuid=require(_0xed87('0x2'));var moment=require(_0xed87('0x3'));var path=require(_0xed87('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xed87('0x5'));var logger=require('../../../config/logger')(_0xed87('0x6'));var ami=require(_0xed87('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0xed87('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xed87('0x9'));var attachment=require(_0xed87('0xa'));var faxMessage=require(_0xed87('0xb'));function Fax(_0x2f348a){this['channels']={};this[_0xed87('0xc')]=_0x2f348a[_0xed87('0xc')];this[_0xed87('0xd')]=_0x2f348a[_0xed87('0xd')];this[_0xed87('0xe')]={};ami['on'](_0xed87('0xf'),this[_0xed87('0x10')]['bind'](this));ami['on'](_0xed87('0x11'),this[_0xed87('0x12')]['bind'](this));ami['on'](_0xed87('0x13'),this[_0xed87('0x14')]['bind'](this));ami['on']('newexten',this[_0xed87('0x15')][_0xed87('0x16')](this));ami['on'](_0xed87('0x17'),this[_0xed87('0x18')][_0xed87('0x16')](this));ami['on'](_0xed87('0x19'),this['syncReceiveFax'][_0xed87('0x16')](this));ami['on'](_0xed87('0x1a'),this[_0xed87('0x1b')][_0xed87('0x16')](this));ami['on'](_0xed87('0x1c'),this[_0xed87('0x1d')][_0xed87('0x16')](this));}Fax[_0xed87('0x1e')][_0xed87('0x10')]=function(_0x5164c8){if(_0x5164c8[_0xed87('0x1f')]===_0xed87('0x20')){for(var _0x2c386a in this[_0xed87('0xc')]){if(this['faxAccounts'][_0xed87('0x21')](_0x2c386a)){if(_0x5164c8[_0xed87('0x22')]===this[_0xed87('0xc')][_0x2c386a][_0xed87('0x23')]){this[_0xed87('0x24')][_0x5164c8[_0xed87('0x25')]]={};this[_0xed87('0x24')][_0x5164c8[_0xed87('0x25')]][_0xed87('0x26')]=_0x5164c8['channel'];this['channels'][_0x5164c8['uniqueid']]['id']=this['faxAccounts'][_0x2c386a]['id'];this[_0xed87('0x24')][_0x5164c8['uniqueid']][_0xed87('0x27')]=this[_0xed87('0xc')][_0x2c386a]['name'];logger[_0xed87('0x28')](_0x5164c8['uniqueid'],_0xed87('0x29'));}}}}if(this[_0xed87('0xe')][_0x5164c8[_0xed87('0x25')]]){this[_0xed87('0x24')][_0x5164c8[_0xed87('0x25')]]={};this['channels'][_0x5164c8[_0xed87('0x25')]][_0xed87('0x26')]=_0x5164c8[_0xed87('0x26')];logger[_0xed87('0x28')](_0x5164c8[_0xed87('0x25')],_0xed87('0x29'));}};Fax[_0xed87('0x1e')][_0xed87('0x12')]=function(_0x40b2fa){if(this[_0xed87('0x24')][_0x40b2fa[_0xed87('0x25')]]){for(var _0x341a35 in _0x40b2fa[_0xed87('0x2a')]){if(_0x40b2fa[_0xed87('0x2a')]['hasOwnProperty'](_0x341a35)){this[_0xed87('0x24')][_0x40b2fa[_0xed87('0x25')]][_0x341a35]=_0x40b2fa['value'];}}}};Fax[_0xed87('0x1e')][_0xed87('0x14')]=function(_0x21c93b){if(this['channels'][_0x21c93b['uniqueid']]){this[_0xed87('0x24')][_0x21c93b[_0xed87('0x25')]][_0xed87('0x2b')]=_0x21c93b['channelstate'];this[_0xed87('0x24')][_0x21c93b[_0xed87('0x25')]][_0xed87('0x2c')]=_0x21c93b[_0xed87('0x2c')];}};Fax[_0xed87('0x1e')][_0xed87('0x15')]=function(_0x137891){if(this[_0xed87('0x24')][_0x137891[_0xed87('0x25')]]){for(var _0x4c0bc0 in _0x137891[_0xed87('0x2a')]){if(_0x137891[_0xed87('0x2a')]['hasOwnProperty'](_0x4c0bc0)){this[_0xed87('0x24')][_0x137891['uniqueid']][_0x4c0bc0]=_0x137891[_0xed87('0x2d')];}}}};Fax[_0xed87('0x1e')][_0xed87('0x18')]=function(_0x46b41b){if(this[_0xed87('0x24')][_0x46b41b[_0xed87('0x25')]]){this[_0xed87('0x24')][_0x46b41b[_0xed87('0x25')]][_0xed87('0x2e')]=_0x46b41b[_0xed87('0x2e')];this[_0xed87('0x24')][_0x46b41b['uniqueid']][_0xed87('0x2f')]=_0x46b41b[_0xed87('0x2f')];this['channels'][_0x46b41b[_0xed87('0x25')]]['localstationid']=_0x46b41b[_0xed87('0x23')];this[_0xed87('0x24')][_0x46b41b['uniqueid']][_0xed87('0x30')]=_0x46b41b[_0xed87('0x30')];logger[_0xed87('0x28')](_0x46b41b[_0xed87('0x25')],_0xed87('0x31'));}};Fax['prototype'][_0xed87('0x32')]=function(_0x525a11){var _0x4302e8=this;if(this['channels'][_0x525a11[_0xed87('0x25')]]){var _0xb6fe59=this[_0xed87('0x24')][_0x525a11[_0xed87('0x25')]]['id'];this[_0xed87('0x24')][_0x525a11[_0xed87('0x25')]][_0xed87('0x33')]=_0x525a11[_0xed87('0x33')];this[_0xed87('0x24')][_0x525a11['uniqueid']]['pagestransferred']=_0x525a11[_0xed87('0x34')];this[_0xed87('0x24')][_0x525a11[_0xed87('0x25')]][_0xed87('0x23')]=_0x525a11[_0xed87('0x23')];this[_0xed87('0x24')][_0x525a11['uniqueid']][_0xed87('0x35')]=_0x525a11[_0xed87('0x35')];this[_0xed87('0x24')][_0x525a11['uniqueid']][_0xed87('0x36')]=_0x525a11[_0xed87('0x36')];this[_0xed87('0x24')][_0x525a11[_0xed87('0x25')]][_0xed87('0x30')]=_0x525a11[_0xed87('0x30')];this[_0xed87('0x24')][_0x525a11[_0xed87('0x25')]][_0xed87('0x37')]=_0x525a11[_0xed87('0x37')];if(this['channels'][_0x525a11[_0xed87('0x25')]][_0xed87('0x34')]>0x0){tiff2pdf(_0x525a11[_0xed87('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x51d4b8){logger[_0xed87('0x28')](_0x525a11[_0xed87('0x25')],_0xed87('0x38'),_0x51d4b8[_0xed87('0x39')]);attachment['create']({'name':path[_0xed87('0x3a')](_0x525a11[_0xed87('0x30')])['name'],'basename':path[_0xed87('0x3a')](_0x525a11[_0xed87('0x30')])[_0xed87('0x27')]+_0xed87('0x3b'),'type':_0xed87('0x3c')})[_0xed87('0x3d')](function(_0x43921d){faxAccount[_0xed87('0x3e')](_0xb6fe59,{'from':_0x525a11[_0xed87('0x37')],'mapKey':_0xed87('0x6'),'body':path[_0xed87('0x3a')](_0x525a11['filename'])[_0xed87('0x27')]+_0xed87('0x3b'),'AttachmentId':_0x43921d['id']})[_0xed87('0x3f')](function(_0x11f97d){logger[_0xed87('0x40')](_0x525a11[_0xed87('0x25')],_0xed87('0x41'),JSON[_0xed87('0x42')](_0x11f97d));});})[_0xed87('0x3f')](function(_0x11ac3e){logger[_0xed87('0x40')](_0x525a11[_0xed87('0x25')],_0xed87('0x43'),JSON[_0xed87('0x42')](_0x11ac3e));});});}logger[_0xed87('0x28')](_0x525a11[_0xed87('0x25')],_0xed87('0x43'));}};Fax['prototype'][_0xed87('0x1d')]=function(_0x1a68a7){if(this[_0xed87('0xe')][_0x1a68a7['uniqueid']]){_[_0xed87('0x44')](this[_0xed87('0x24')][_0x1a68a7['uniqueid']],_[_0xed87('0x45')](_0x1a68a7,[_0xed87('0x46'),_0xed87('0x47')]));}};function updateStatus(_0x20652f){if(_0x20652f['AttachmentId']){faxMessage[_0xed87('0x48')](_0x20652f[_0xed87('0x49')],{'failMessage':_0xed87('0x4a')})[_0xed87('0x3d')](function(_0x3ef093){ut[_0xed87('0x4b')](_0xed87('0x4c'),_0x3ef093);})[_0xed87('0x3f')](function(_0x6da596){ut[_0xed87('0x4b')](_0xed87('0x4d'),_0x6da596);});}else{ut[_0xed87('0x4b')](_0xed87('0x4e'));}}Fax['prototype'][_0xed87('0x4f')]=function(_0x4ea4e3,_0x17cad7,_0x329973){var _0x446725=this;var _0x27ad77={};if(_0x17cad7){_0x27ad77={'read':_0x17cad7};}else{_0x27ad77={'failMessage':_0x329973};}if(this[_0xed87('0xe')][_0x4ea4e3][_0xed87('0x49')]){faxMessage[_0xed87('0x48')](this[_0xed87('0xe')][_0x4ea4e3][_0xed87('0x49')],_0x27ad77)[_0xed87('0x3d')](function(_0x55084f){ut[_0xed87('0x4b')](_0xed87('0x50'),_0x55084f);})[_0xed87('0x3f')](function(_0xa4b94e){ut[_0xed87('0x4b')](_0xed87('0x51'),_0xa4b94e);})[_0xed87('0x52')](function(){delete _0x446725[_0xed87('0x24')][_0x4ea4e3];delete _0x446725[_0xed87('0xe')][_0x4ea4e3];});}else{ut[_0xed87('0x4b')](_0xed87('0x53'));delete this['channels'][_0x4ea4e3];delete this['actions'][_0x4ea4e3];}};Fax[_0xed87('0x1e')][_0xed87('0x1b')]=function(_0xcd82d1){var _0x2ef4a9=this;if(this[_0xed87('0x24')][_0xcd82d1['uniqueid']]){if(this[_0xed87('0xe')][_0xcd82d1[_0xed87('0x25')]]){this[_0xed87('0x24')][_0xcd82d1[_0xed87('0x25')]]['id']=this[_0xed87('0xe')][_0xcd82d1[_0xed87('0x25')]]['id'];this[_0xed87('0x24')][_0xcd82d1[_0xed87('0x25')]][_0xed87('0x27')]=this[_0xed87('0xe')][_0xcd82d1[_0xed87('0x25')]][_0xed87('0x27')];}logger[_0xed87('0x28')](_0xcd82d1[_0xed87('0x25')],this['actions'][_0xcd82d1[_0xed87('0x25')]]?_0xed87('0x54'):_0xed87('0x55'),JSON[_0xed87('0x42')](this[_0xed87('0x24')][_0xcd82d1[_0xed87('0x25')]]));if(this[_0xed87('0xe')][_0xcd82d1[_0xed87('0x25')]]){if(this['channels'][_0xcd82d1[_0xed87('0x25')]][_0xed87('0x56')]>0x0&&this[_0xed87('0x24')][_0xcd82d1[_0xed87('0x25')]][_0xed87('0x17')]===_0xed87('0x57')){this['updateStatus'](_0xcd82d1['uniqueid'],!![]);}else{this[_0xed87('0x4f')](_0xcd82d1[_0xed87('0x25')],![],this[_0xed87('0x24')][_0xcd82d1[_0xed87('0x25')]][_0xed87('0x58')]?_0xed87('0x59')+this[_0xed87('0x24')][_0xcd82d1[_0xed87('0x25')]]['faxstatusstring']:_0xed87('0x5a'));}}}};Fax['prototype'][_0xed87('0x5b')]=function(_0x3c82de){var _0x4e5055=this;return new BPromise(function(_0x11b3a8,_0x30f9d0){_0x4e5055['execOriginate'](_0x3c82de,_0x4e5055[_0xed87('0xc')][_0x3c82de[_0xed87('0x5c')]])[_0xed87('0x3d')](function(_0x44aedb){ut[_0xed87('0x4b')]('[Fax][execOriginate][success]',_0x44aedb);_0x11b3a8(ut[_0xed87('0x39')](_0xed87('0x5d')));})[_0xed87('0x3f')](function(_0x34cb67){ut['logger']('[Fax][execOriginate][failure]',_0x34cb67);updateStatus(_0x3c82de);_0x30f9d0(ut[_0xed87('0x39')](_0xed87('0x5e')));});});};Fax['prototype'][_0xed87('0x5f')]=function(_0x40d5f6){var _0x4e8f6=this;return new BPromise(function(_0xa1c262,_0x1621ef){var _0x3eaf59=_0x4e8f6[_0xed87('0x60')](_0x4e8f6[_0xed87('0xc')][_0x40d5f6[_0xed87('0x5c')]][_0xed87('0x61')],_0x40d5f6);if(_0x3eaf59[_0xed87('0x62')]){_0xa1c262(ut[_0xed87('0x39')](_0xed87('0x63')));}else{_0x1621ef(ut[_0xed87('0x39')](_0x3eaf59['message']));}});};function originate(_0xa81cc8,_0x2686cd,_0x566ace){return new BPromise(function(_0x4f7b92,_0x5136c9){if(_0x566ace){var _0x288256=util[_0xed87('0x64')](_0xed87('0x65'),path[_0xed87('0x3a')](_0xa81cc8[_0xed87('0x4')])[_0xed87('0x27')],_0xa81cc8[_0xed87('0x4')]);gs['execute'](_0x288256)[_0xed87('0x3d')](function(){_0xa81cc8[_0xed87('0x4')]=util[_0xed87('0x64')](_0xed87('0x66'),path[_0xed87('0x3a')](_0xa81cc8[_0xed87('0x4')])[_0xed87('0x67')],path[_0xed87('0x3a')](_0xa81cc8[_0xed87('0x4')])[_0xed87('0x27')]);_0x2686cd['XMF-PATH']=_0xa81cc8['path'];ut['logger'](_0xed87('0x68'),'');ami[_0xed87('0x69')](ut[_0xed87('0x6a')](_0xa81cc8,_0x2686cd))[_0xed87('0x3d')](function(_0xb13b0b){_0x4f7b92(_0xb13b0b);})['catch'](function(_0x3f642c){_0x5136c9(_0x3f642c);});})[_0xed87('0x3f')](function(_0x3ed0e4){_0x5136c9(_0x3ed0e4);});}else{ami[_0xed87('0x69')](ut[_0xed87('0x6a')](_0xa81cc8,_0x2686cd))[_0xed87('0x3d')](function(_0x5e4e16){_0x4f7b92(_0x5e4e16);})['catch'](function(_0x2f5b5b){_0x5136c9(_0x2f5b5b);});}});}Fax[_0xed87('0x1e')][_0xed87('0x6b')]=function(_0xd03ea8,_0x720d5d){var _0x41e132=this;return new BPromise(function(_0x1b7fa7,_0x3b1b8d){var _0x23512f=uuid['v4']();var _0x2a4781=ut[_0xed87('0x6c')](_0xd03ea8,_0x720d5d);_0x41e132[_0xed87('0xe')][_0x23512f]=new Action(_0x23512f,_0x720d5d,_0xd03ea8);var _0x52af5c=_0x41e132[_0xed87('0xe')][_0x23512f];if(path[_0xed87('0x3a')](_0xd03ea8[_0xed87('0x4')])[_0xed87('0x6d')]===_0xed87('0x3b')){originate(_0x52af5c,_0x2a4781,!![])[_0xed87('0x3d')](function(_0x4ae84c){_0x1b7fa7(_0x4ae84c);})[_0xed87('0x3f')](function(_0x1b8f9d){_0x3b1b8d(_0x1b8f9d);});}else{originate(_0x52af5c,_0x2a4781,![])[_0xed87('0x3d')](function(_0xacd9d4){_0x1b7fa7(_0xacd9d4);})['catch'](function(_0x54277b){_0x3b1b8d(_0x54277b);});}});};Fax['prototype']['isTrunkReachable']=function(_0x51bc63){return!_[_0xed87('0x6e')](_0x51bc63)&&!_[_0xed87('0x6e')](_0x51bc63[_0xed87('0x27')])&&!_[_0xed87('0x6e')](_0x51bc63[_0xed87('0x6f')])&&_0x51bc63[_0xed87('0x6f')]&&!_[_0xed87('0x6e')](this[_0xed87('0xd')][util[_0xed87('0x64')]('SIP/%s',_0x51bc63['name'])])&&!_[_0xed87('0x6e')](this[_0xed87('0xd')][util[_0xed87('0x64')](_0xed87('0x70'),_0x51bc63[_0xed87('0x27')])]['status'])&&(this['trunks'][util[_0xed87('0x64')](_0xed87('0x70'),_0x51bc63['name'])][_0xed87('0x2f')]==='reachable'||this[_0xed87('0xd')][util['format'](_0xed87('0x70'),_0x51bc63[_0xed87('0x27')])][_0xed87('0x2f')]===_0xed87('0x71'));};Fax[_0xed87('0x1e')]['checkTrunk']=function(_0x27557d,_0x2c06b8){if(!this['isTrunkReachable'](_0x27557d)){ut[_0xed87('0x4b')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xed87('0x6e')](_0x27557d)?'':_0x27557d[_0xed87('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xed87('0x72')};}if(_[_0xed87('0x6e')](_0x2c06b8['fax'])){ut[_0xed87('0x4b')](_0xed87('0x73'),JSON[_0xed87('0x42')](_0x2c06b8));return{'isValid':![],'message':_0xed87('0x74')};}if(_['isNil'](_0x2c06b8[_0xed87('0x4')])){ut[_0xed87('0x4b')](_0xed87('0x75'),JSON[_0xed87('0x42')](_0x2c06b8));return{'isValid':![],'message':_0xed87('0x76')};}return{'isValid':!![],'message':_0xed87('0x77')};};module[_0xed87('0x78')]=Fax; \ No newline at end of file +var _0x6b20=['syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk','isValid','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','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind'];(function(_0x26a706,_0x25cc80){var _0x1bcd7c=function(_0x4af445){while(--_0x4af445){_0x26a706['push'](_0x26a706['shift']());}};_0x1bcd7c(++_0x25cc80);}(_0x6b20,0xd1));var _0x06b2=function(_0xea7ed1,_0xd402da){_0xea7ed1=_0xea7ed1-0x0;var _0x46109e=_0x6b20[_0xea7ed1];return _0x46109e;};'use strict';var util=require(_0x06b2('0x0'));var _=require(_0x06b2('0x1'));var BPromise=require('bluebird');var uuid=require(_0x06b2('0x2'));var moment=require('moment');var path=require(_0x06b2('0x3'));var tiff2pdf=require(_0x06b2('0x4'));var gs=require(_0x06b2('0x5'));var logger=require('../../../config/logger')(_0x06b2('0x6'));var ami=require(_0x06b2('0x7'));var rpcDb=require(_0x06b2('0x8'));var Channel=require(_0x06b2('0x9'));var ut=require(_0x06b2('0xa'));var Action=require(_0x06b2('0xb'));var faxAccount=require(_0x06b2('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x06b2('0xd'));function Fax(_0x1828e4){this[_0x06b2('0xe')]={};this['faxAccounts']=_0x1828e4[_0x06b2('0xf')];this['trunks']=_0x1828e4[_0x06b2('0x10')];this['actions']={};ami['on']('newchannel',this[_0x06b2('0x11')][_0x06b2('0x12')](this));ami['on']('varset',this[_0x06b2('0x13')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x14'),this[_0x06b2('0x15')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x16'),this[_0x06b2('0x17')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x18'),this[_0x06b2('0x19')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x1a'),this[_0x06b2('0x1b')]['bind'](this));ami['on'](_0x06b2('0x1c'),this[_0x06b2('0x1d')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x1e'),this[_0x06b2('0x1f')][_0x06b2('0x12')](this));}Fax['prototype'][_0x06b2('0x11')]=function(_0x3f2a53){if(_0x3f2a53['context']===_0x06b2('0x20')){for(var _0x594b48 in this['faxAccounts']){if(this[_0x06b2('0xf')][_0x06b2('0x21')](_0x594b48)){if(_0x3f2a53[_0x06b2('0x22')]===this[_0x06b2('0xf')][_0x594b48]['localstationid']){this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]]={};this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]][_0x06b2('0x24')]=_0x3f2a53[_0x06b2('0x24')];this[_0x06b2('0xe')][_0x3f2a53['uniqueid']]['id']=this[_0x06b2('0xf')][_0x594b48]['id'];this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]][_0x06b2('0x25')]=this['faxAccounts'][_0x594b48]['name'];logger[_0x06b2('0x26')](_0x3f2a53[_0x06b2('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0x06b2('0x27')][_0x3f2a53['uniqueid']]){this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]]={};this[_0x06b2('0xe')][_0x3f2a53['uniqueid']][_0x06b2('0x24')]=_0x3f2a53[_0x06b2('0x24')];logger[_0x06b2('0x26')](_0x3f2a53[_0x06b2('0x23')],_0x06b2('0x28'));}};Fax['prototype'][_0x06b2('0x13')]=function(_0x34370b){if(this[_0x06b2('0xe')][_0x34370b[_0x06b2('0x23')]]){for(var _0x1976ac in _0x34370b[_0x06b2('0x29')]){if(_0x34370b['variable'][_0x06b2('0x21')](_0x1976ac)){this[_0x06b2('0xe')][_0x34370b[_0x06b2('0x23')]][_0x1976ac]=_0x34370b[_0x06b2('0x2a')];}}}};Fax[_0x06b2('0x2b')][_0x06b2('0x15')]=function(_0x3668bb){if(this['channels'][_0x3668bb[_0x06b2('0x23')]]){this[_0x06b2('0xe')][_0x3668bb[_0x06b2('0x23')]][_0x06b2('0x2c')]=_0x3668bb[_0x06b2('0x2c')];this[_0x06b2('0xe')][_0x3668bb[_0x06b2('0x23')]][_0x06b2('0x2d')]=_0x3668bb['channelstatedesc'];}};Fax[_0x06b2('0x2b')][_0x06b2('0x17')]=function(_0x259e3d){if(this[_0x06b2('0xe')][_0x259e3d[_0x06b2('0x23')]]){for(var _0x422393 in _0x259e3d[_0x06b2('0x29')]){if(_0x259e3d['variable']['hasOwnProperty'](_0x422393)){this[_0x06b2('0xe')][_0x259e3d[_0x06b2('0x23')]][_0x422393]=_0x259e3d[_0x06b2('0x2a')];}}}};Fax['prototype'][_0x06b2('0x19')]=function(_0x25ec1a){if(this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]]){this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]]['operation']=_0x25ec1a[_0x06b2('0x2e')];this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]]['status']=_0x25ec1a[_0x06b2('0x2f')];this[_0x06b2('0xe')][_0x25ec1a['uniqueid']][_0x06b2('0x30')]=_0x25ec1a[_0x06b2('0x30')];this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]][_0x06b2('0x31')]=_0x25ec1a[_0x06b2('0x31')];logger[_0x06b2('0x26')](_0x25ec1a[_0x06b2('0x23')],_0x06b2('0x32'));}};Fax[_0x06b2('0x2b')][_0x06b2('0x1b')]=function(_0x1cc7b6){var _0x5ec05d=this;if(this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']]){var _0x4a4146=this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']]['id'];this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']][_0x06b2('0x33')]=_0x1cc7b6[_0x06b2('0x33')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x34')]=_0x1cc7b6['pagestransferred'];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x30')]=_0x1cc7b6[_0x06b2('0x30')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]]['resolution']=_0x1cc7b6[_0x06b2('0x35')];this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']]['transferrate']=_0x1cc7b6[_0x06b2('0x36')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x31')]=_0x1cc7b6[_0x06b2('0x31')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x37')]=_0x1cc7b6[_0x06b2('0x37')];if(this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x34')]>0x0){tiff2pdf(_0x1cc7b6[_0x06b2('0x31')],_0x06b2('0x38'),function(_0x262c93){logger[_0x06b2('0x26')](_0x1cc7b6[_0x06b2('0x23')],_0x06b2('0x39'),_0x262c93[_0x06b2('0x3a')]);attachment['create']({'name':path[_0x06b2('0x3b')](_0x1cc7b6[_0x06b2('0x31')])[_0x06b2('0x25')],'basename':path[_0x06b2('0x3b')](_0x1cc7b6['filename'])[_0x06b2('0x25')]+_0x06b2('0x3c'),'type':'application/pdf'})[_0x06b2('0x3d')](function(_0x2e3a85){faxAccount['notify'](_0x4a4146,{'from':_0x1cc7b6[_0x06b2('0x37')],'mapKey':_0x06b2('0x6'),'body':path['parse'](_0x1cc7b6['filename'])['name']+_0x06b2('0x3c'),'AttachmentId':_0x2e3a85['id']})[_0x06b2('0x3e')](function(_0x4448bb){logger[_0x06b2('0x3f')](_0x1cc7b6[_0x06b2('0x23')],'\x20notify\x20',JSON['stringify'](_0x4448bb));});})[_0x06b2('0x3e')](function(_0x3d89c2){logger[_0x06b2('0x3f')](_0x1cc7b6[_0x06b2('0x23')],_0x06b2('0x40'),JSON[_0x06b2('0x41')](_0x3d89c2));});});}logger['info'](_0x1cc7b6[_0x06b2('0x23')],_0x06b2('0x40'));}};Fax[_0x06b2('0x2b')][_0x06b2('0x1f')]=function(_0x146c5c){if(this[_0x06b2('0x27')][_0x146c5c['uniqueid']]){_[_0x06b2('0x42')](this[_0x06b2('0xe')][_0x146c5c[_0x06b2('0x23')]],_[_0x06b2('0x43')](_0x146c5c,['response',_0x06b2('0x44')]));}};function updateStatus(_0x17d138){if(_0x17d138[_0x06b2('0x45')]){faxMessage[_0x06b2('0x46')](_0x17d138['AttachmentId'],{'failMessage':_0x06b2('0x47')})[_0x06b2('0x3d')](function(_0x36329e){ut[_0x06b2('0x48')](_0x06b2('0x49'),_0x36329e);})[_0x06b2('0x3e')](function(_0x3ea829){ut[_0x06b2('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x3ea829);});}else{ut[_0x06b2('0x48')](_0x06b2('0x4a'));}}Fax[_0x06b2('0x2b')][_0x06b2('0x4b')]=function(_0x2857d5,_0x2f75a0,_0x4fba4c){var _0x5db1cc=this;var _0x1bf9e7={};if(_0x2f75a0){_0x1bf9e7={'read':_0x2f75a0};}else{_0x1bf9e7={'failMessage':_0x4fba4c};}if(this['actions'][_0x2857d5]['AttachmentId']){faxMessage[_0x06b2('0x46')](this['actions'][_0x2857d5][_0x06b2('0x45')],_0x1bf9e7)[_0x06b2('0x3d')](function(_0x18a927){ut[_0x06b2('0x48')](_0x06b2('0x4c'),_0x18a927);})[_0x06b2('0x3e')](function(_0x4664c2){ut[_0x06b2('0x48')](_0x06b2('0x4d'),_0x4664c2);})[_0x06b2('0x4e')](function(){delete _0x5db1cc['channels'][_0x2857d5];delete _0x5db1cc['actions'][_0x2857d5];});}else{ut[_0x06b2('0x48')](_0x06b2('0x4f'));delete this['channels'][_0x2857d5];delete this[_0x06b2('0x27')][_0x2857d5];}};Fax[_0x06b2('0x2b')][_0x06b2('0x1d')]=function(_0x36f2a8){var _0x5d725f=this;if(this['channels'][_0x36f2a8['uniqueid']]){if(this[_0x06b2('0x27')][_0x36f2a8['uniqueid']]){this['channels'][_0x36f2a8[_0x06b2('0x23')]]['id']=this[_0x06b2('0x27')][_0x36f2a8[_0x06b2('0x23')]]['id'];this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x25')]=this['actions'][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x25')];}logger['info'](_0x36f2a8[_0x06b2('0x23')],this[_0x06b2('0x27')][_0x36f2a8[_0x06b2('0x23')]]?_0x06b2('0x50'):_0x06b2('0x51'),JSON[_0x06b2('0x41')](this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]]));if(this[_0x06b2('0x27')][_0x36f2a8[_0x06b2('0x23')]]){if(this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]]['faxpages']>0x0&&this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]]['faxstatus']===_0x06b2('0x52')){this[_0x06b2('0x4b')](_0x36f2a8[_0x06b2('0x23')],!![]);}else{this[_0x06b2('0x4b')](_0x36f2a8['uniqueid'],![],this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x53')]?'SENDING\x20FAILED:\x20'+this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x53')]:_0x06b2('0x54'));}}}};Fax[_0x06b2('0x2b')][_0x06b2('0x55')]=function(_0x1aae55){var _0x10faea=this;return new BPromise(function(_0x2f0ca0,_0x5aae69){_0x10faea['execOriginate'](_0x1aae55,_0x10faea['faxAccounts'][_0x1aae55['FaxAccountId']])[_0x06b2('0x3d')](function(_0x4a1bf5){ut[_0x06b2('0x48')](_0x06b2('0x56'),_0x4a1bf5);_0x2f0ca0(ut[_0x06b2('0x3a')](_0x06b2('0x57')));})[_0x06b2('0x3e')](function(_0x378547){ut['logger']('[Fax][execOriginate][failure]',_0x378547);updateStatus(_0x1aae55);_0x5aae69(ut[_0x06b2('0x3a')](_0x06b2('0x58')));});});};Fax['prototype'][_0x06b2('0x59')]=function(_0xd826e9){var _0x4ea78f=this;return new BPromise(function(_0x353dd6,_0x1ac2f0){var _0x10f3e6=_0x4ea78f['checkTrunk'](_0x4ea78f[_0x06b2('0xf')][_0xd826e9['FaxAccountId']][_0x06b2('0x5a')],_0xd826e9);if(_0x10f3e6[_0x06b2('0x5b')]){_0x353dd6(ut[_0x06b2('0x3a')]('Trunk\x20Reachable'));}else{_0x1ac2f0(ut[_0x06b2('0x3a')](_0x10f3e6[_0x06b2('0x3a')]));}});};function originate(_0x461c4d,_0x4cc763,_0xc1010){return new BPromise(function(_0x4900d2,_0x15b345){if(_0xc1010){var _0x1ea5ed=util[_0x06b2('0x5c')](_0x06b2('0x5d'),path[_0x06b2('0x3b')](_0x461c4d[_0x06b2('0x3')])['name'],_0x461c4d[_0x06b2('0x3')]);gs[_0x06b2('0x5e')](_0x1ea5ed)[_0x06b2('0x3d')](function(){_0x461c4d[_0x06b2('0x3')]=util['format'](_0x06b2('0x5f'),path[_0x06b2('0x3b')](_0x461c4d[_0x06b2('0x3')])['dir'],path['parse'](_0x461c4d[_0x06b2('0x3')])['name']);_0x4cc763[_0x06b2('0x60')]=_0x461c4d['path'];ut['logger'](_0x06b2('0x61'),'');ami[_0x06b2('0x62')](ut['variablesAction'](_0x461c4d,_0x4cc763))[_0x06b2('0x3d')](function(_0x15f107){_0x4900d2(_0x15f107);})[_0x06b2('0x3e')](function(_0x305c36){_0x15b345(_0x305c36);});})[_0x06b2('0x3e')](function(_0x3542b4){_0x15b345(_0x3542b4);});}else{ami[_0x06b2('0x62')](ut[_0x06b2('0x63')](_0x461c4d,_0x4cc763))[_0x06b2('0x3d')](function(_0x333a76){_0x4900d2(_0x333a76);})[_0x06b2('0x3e')](function(_0x5028d4){_0x15b345(_0x5028d4);});}});}Fax[_0x06b2('0x2b')]['execOriginate']=function(_0x4a606b,_0x3257b9){var _0x32e2c4=this;return new BPromise(function(_0x4ff30d,_0x3c73fc){var _0x326b90=uuid['v4']();var _0x445a67=ut['addVariables'](_0x4a606b,_0x3257b9);_0x32e2c4[_0x06b2('0x27')][_0x326b90]=new Action(_0x326b90,_0x3257b9,_0x4a606b);var _0x3ff04f=_0x32e2c4['actions'][_0x326b90];if(path['parse'](_0x4a606b['path'])['ext']===_0x06b2('0x3c')){originate(_0x3ff04f,_0x445a67,!![])['then'](function(_0x1e4412){_0x4ff30d(_0x1e4412);})[_0x06b2('0x3e')](function(_0x1b1e6c){_0x3c73fc(_0x1b1e6c);});}else{originate(_0x3ff04f,_0x445a67,![])[_0x06b2('0x3d')](function(_0x18b76f){_0x4ff30d(_0x18b76f);})[_0x06b2('0x3e')](function(_0x406101){_0x3c73fc(_0x406101);});}});};Fax[_0x06b2('0x2b')][_0x06b2('0x64')]=function(_0x27c73d){return!_[_0x06b2('0x65')](_0x27c73d)&&!_[_0x06b2('0x65')](_0x27c73d[_0x06b2('0x25')])&&!_['isNil'](_0x27c73d['active'])&&_0x27c73d[_0x06b2('0x66')]&&!_[_0x06b2('0x65')](this[_0x06b2('0x10')][util[_0x06b2('0x5c')](_0x06b2('0x67'),_0x27c73d[_0x06b2('0x25')])])&&!_['isNil'](this['trunks'][util[_0x06b2('0x5c')](_0x06b2('0x67'),_0x27c73d[_0x06b2('0x25')])][_0x06b2('0x2f')])&&(this[_0x06b2('0x10')][util['format'](_0x06b2('0x67'),_0x27c73d['name'])]['status']===_0x06b2('0x68')||this[_0x06b2('0x10')][util['format']('SIP/%s',_0x27c73d[_0x06b2('0x25')])][_0x06b2('0x2f')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x512415,_0x3913cb){if(!this[_0x06b2('0x64')](_0x512415)){ut[_0x06b2('0x48')](_0x06b2('0x69'),_[_0x06b2('0x65')](_0x512415)?'':_0x512415[_0x06b2('0x25')]+_0x06b2('0x6a'));return{'isValid':![],'message':_0x06b2('0x6b')};}if(_[_0x06b2('0x65')](_0x3913cb[_0x06b2('0x6')])){ut[_0x06b2('0x48')](_0x06b2('0x6c'),JSON[_0x06b2('0x41')](_0x3913cb));return{'isValid':![],'message':_0x06b2('0x6d')};}if(_[_0x06b2('0x65')](_0x3913cb[_0x06b2('0x3')])){ut[_0x06b2('0x48')](_0x06b2('0x6e'),JSON[_0x06b2('0x41')](_0x3913cb));return{'isValid':![],'message':_0x06b2('0x6f')};}return{'isValid':!![],'message':_0x06b2('0x70')};};module[_0x06b2('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d5a2c8b..0c8a640 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 _0x78b5=['../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird'];(function(_0xca41dc,_0x22936e){var _0x3e125c=function(_0x1ef024){while(--_0x1ef024){_0xca41dc['push'](_0xca41dc['shift']());}};_0x3e125c(++_0x22936e);}(_0x78b5,0xd6));var _0x578b=function(_0x2de0d3,_0x131046){_0x2de0d3=_0x2de0d3-0x0;var _0x1207a3=_0x78b5[_0x2de0d3];return _0x1207a3;};'use strict';var util=require(_0x578b('0x0'));var BPromise=require(_0x578b('0x1'));var logger=require(_0x578b('0x2'))(_0x578b('0x3'));var _=require('lodash');var faxAccount=require(_0x578b('0x4'));function loggerCatch(_0x1dfb97){return function(_0x205097){logger[_0x578b('0x5')](_0x1dfb97,util[_0x578b('0x6')](_0x205097,{'showHidden':![],'depth':null}));};}exports[_0x578b('0x7')]=function(_0x4d5964,_0x26181f){return BPromise[_0x578b('0x8')]()[_0x578b('0x9')](faxAccount[_0x578b('0x7')](_0x4d5964,_0x26181f))[_0x578b('0xa')](loggerCatch(_0x578b('0xb')));}; \ No newline at end of file +var _0x0049=['inspect','notify','resolve','then','bluebird','../../../config/logger','../rpc/faxAccount','error'];(function(_0x59e8d0,_0x341af2){var _0x4160c5=function(_0x8e8382){while(--_0x8e8382){_0x59e8d0['push'](_0x59e8d0['shift']());}};_0x4160c5(++_0x341af2);}(_0x0049,0x14c));var _0x9004=function(_0x4876f4,_0x1e041b){_0x4876f4=_0x4876f4-0x0;var _0xfbd46b=_0x0049[_0x4876f4];return _0xfbd46b;};'use strict';var util=require('util');var BPromise=require(_0x9004('0x0'));var logger=require(_0x9004('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x9004('0x2'));function loggerCatch(_0x4729da){return function(_0x56343a){logger[_0x9004('0x3')](_0x4729da,util[_0x9004('0x4')](_0x56343a,{'showHidden':![],'depth':null}));};}exports[_0x9004('0x5')]=function(_0xad3b89,_0x4b96c7){return BPromise[_0x9004('0x6')]()[_0x9004('0x7')](faxAccount[_0x9004('0x5')](_0xad3b89,_0x4b96c7))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index a8ff964..2e70a07 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 _0x4da6=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x4da6,0x183));var _0x64da=function(_0x4fb63e,_0xaee2ab){_0x4fb63e=_0x4fb63e-0x0;var _0x46718e=_0x4da6[_0x4fb63e];return _0x46718e;};'use strict';var util=require(_0x64da('0x0'));var logger=require(_0x64da('0x1'))(_0x64da('0x2'));var BPromise=require('bluebird');var exec=require(_0x64da('0x3'))[_0x64da('0x4')];exports[_0x64da('0x5')]=function(_0xfbfabd){return new BPromise(function(_0x5647d0,_0x1e0f5d){exec(_0xfbfabd,function(_0x4fe8b8,_0x38d345,_0x5d7e90){logger[_0x64da('0x6')](_0x64da('0x7'),_0x38d345);if(_0x4fe8b8){logger[_0x64da('0x6')](_0x64da('0x7'),_0x64da('0x8'),util[_0x64da('0x9')](_0x4fe8b8,{'showHidden':![],'depth':null}),_0x38d345,_0x5d7e90);_0x1e0f5d(_0x4fe8b8);}_0x5647d0(_0x38d345);});});}; \ No newline at end of file +var _0x413d=['util','../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs','inspect'];(function(_0x595961,_0xc0daca){var _0x440cc7=function(_0x48972a){while(--_0x48972a){_0x595961['push'](_0x595961['shift']());}};_0x440cc7(++_0xc0daca);}(_0x413d,0x1dd));var _0xd413=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x413d[_0x710815];return _0x5b3b89;};'use strict';var util=require(_0xd413('0x0'));var logger=require(_0xd413('0x1'))(_0xd413('0x2'));var BPromise=require(_0xd413('0x3'));var exec=require(_0xd413('0x4'))[_0xd413('0x5')];exports['execute']=function(_0x175006){return new BPromise(function(_0x521b45,_0x403be9){exec(_0x175006,function(_0x36c226,_0x601a88,_0x4db93a){logger[_0xd413('0x6')](_0xd413('0x7'),_0x601a88);if(_0x36c226){logger[_0xd413('0x6')](_0xd413('0x7'),'\x20Error\x20:',util[_0xd413('0x8')](_0x36c226,{'showHidden':![],'depth':null}),_0x601a88,_0x4db93a);_0x403be9(_0x36c226);}_0x521b45(_0x601a88);});});}; \ 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 a10eaee..390a8dd 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 _0xfb60=['gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem'];(function(_0x62a9d5,_0x237642){var _0x1bf638=function(_0x30dc00){while(--_0x30dc00){_0x62a9d5['push'](_0x62a9d5['shift']());}};_0x1bf638(++_0x237642);}(_0xfb60,0x1ac));var _0x0fb6=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0xfb60[_0x22205c];return _0x3f5efe;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x0fb6('0x0'));var logger=require(_0x0fb6('0x1'))(_0x0fb6('0x2'));exports[_0x0fb6('0x3')]=function(_0x169e6c){return{'message':_0x169e6c};};exports[_0x0fb6('0x4')]=function(_0x4d376c,_0x5cc58d){logger[_0x0fb6('0x5')](_0x4d376c,util[_0x0fb6('0x6')](_0x5cc58d,{'showHidden':![],'depth':null}));};exports[_0x0fb6('0x7')]=function(_0x3fa562,_0x4457dd){var _0x256fd9={'XMF-ECM':_0x4457dd[_0x0fb6('0x8')],'XMF-HEADERINFO':_0x4457dd['headerinfo'],'XMF-MINRATE':_0x4457dd[_0x0fb6('0x9')],'XMF-MAXRATE':_0x4457dd[_0x0fb6('0xa')],'XMF-MODEM':util[_0x0fb6('0xb')](_0x0fb6('0xc'),_0x4457dd[_0x0fb6('0xd')]),'XMF-GATEWAY':_0x4457dd[_0x0fb6('0xe')],'XMF-FAXDETECT':_0x4457dd[_0x0fb6('0xf')],'XMF-T38TIMEOUT':_0x4457dd[_0x0fb6('0x10')],'XMF-LOCALSTATIONID':_0x4457dd[_0x0fb6('0x11')],'XMF-PATH':_0x3fa562[_0x0fb6('0x12')]};return _0x256fd9;};exports['variablesAction']=function(_0x443ffd,_0x10b8a8){return{'actionid':_0x443ffd[_0x0fb6('0x13')],'action':_0x0fb6('0x14'),'channel':_0x443ffd[_0x0fb6('0x15')],'Exten':_0x0fb6('0x16'),'Context':_0x0fb6('0x17'),'Priority':'1','callerid':util[_0x0fb6('0xb')](_0x0fb6('0x18'),_0x443ffd['headerinfo']?_0x443ffd[_0x0fb6('0x19')]:'',_0x443ffd[_0x0fb6('0x11')]),'variable':_0x10b8a8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x443ffd['uniqueid']};}; \ No newline at end of file +var _0xb582=['uniqueid','util','lodash','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','headerinfo','minrate','maxrate','format','t38timeout','variablesAction','xcally-motion-fax','from-sip'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xb582,0x1e7));var _0x2b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb582[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x2b58('0x0'));var _=require(_0x2b58('0x1'));var moment=require(_0x2b58('0x2'));var logger=require(_0x2b58('0x3'))(_0x2b58('0x4'));exports[_0x2b58('0x5')]=function(_0x439c83){return{'message':_0x439c83};};exports[_0x2b58('0x6')]=function(_0x12a37d,_0x16d228){logger['info'](_0x12a37d,util[_0x2b58('0x7')](_0x16d228,{'showHidden':![],'depth':null}));};exports[_0x2b58('0x8')]=function(_0x36bd74,_0x1dc05e){var _0x4893e1={'XMF-ECM':_0x1dc05e['ecm'],'XMF-HEADERINFO':_0x1dc05e[_0x2b58('0x9')],'XMF-MINRATE':_0x1dc05e[_0x2b58('0xa')],'XMF-MAXRATE':_0x1dc05e[_0x2b58('0xb')],'XMF-MODEM':util[_0x2b58('0xc')]('\x22%s\x22',_0x1dc05e['modem']),'XMF-GATEWAY':_0x1dc05e['gateway'],'XMF-FAXDETECT':_0x1dc05e['faxdetect'],'XMF-T38TIMEOUT':_0x1dc05e[_0x2b58('0xd')],'XMF-LOCALSTATIONID':_0x1dc05e['localstationid'],'XMF-PATH':_0x36bd74['path']};return _0x4893e1;};exports[_0x2b58('0xe')]=function(_0x47b73b,_0x2942a3){return{'actionid':_0x47b73b['uniqueid'],'action':'originate','channel':_0x47b73b['channel'],'Exten':_0x2b58('0xf'),'Context':_0x2b58('0x10'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x47b73b[_0x2b58('0x9')]?_0x47b73b[_0x2b58('0x9')]:'',_0x47b73b['localstationid']),'variable':_0x2942a3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x47b73b[_0x2b58('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a5706ea..3a5cc6c 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 _0xa7be=['./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa7be,0xfc));var _0xea7b=function(_0x340e6f,_0x2b6ff6){_0x340e6f=_0x340e6f-0x0;var _0x370ac2=_0xa7be[_0x340e6f];return _0x370ac2;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0xea7b('0x0'));var Realtime=require(_0xea7b('0x1'));var Report=require(_0xea7b('0x2'));var Acw=require(_0xea7b('0x3'));var Trigger=require(_0xea7b('0x4'));var Dialer=require(_0xea7b('0x5'));var Preview=require(_0xea7b('0x6'));var Fax=require(_0xea7b('0x7'));var user=require(_0xea7b('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xea7b('0x9'));var trunk=require(_0xea7b('0xa'));var trigger=require(_0xea7b('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0xea7b('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xea7b('0xd'));var faxAccount=require(_0xea7b('0xe'));var zendesk=require(_0xea7b('0xf'));var salesforce=require(_0xea7b('0x10'));var sugarcrm=require(_0xea7b('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xea7b('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xea7b('0x13'));var servicenow=require(_0xea7b('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xea7b('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xea7b('0x16')](_0xea7b('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xea7b('0x18')]()[_0xea7b('0x19')](user[_0xea7b('0x1a')]())[_0xea7b('0x19')](realtime[_0xea7b('0x1b')]())['then'](user[_0xea7b('0x1c')]())[_0xea7b('0x19')](realtime['initTelephones']())[_0xea7b('0x19')](trunk[_0xea7b('0x1d')]())[_0xea7b('0x19')](realtime['initTrunks']())['then'](voiceQueue[_0xea7b('0x1e')]())[_0xea7b('0x19')](realtime['initVoiceQueues']())['then'](trigger[_0xea7b('0x1f')]())['then'](realtime[_0xea7b('0x20')]())[_0xea7b('0x19')](template[_0xea7b('0x21')]())['then'](realtime[_0xea7b('0x22')]())[_0xea7b('0x19')](zendesk[_0xea7b('0x23')]())[_0xea7b('0x19')](realtime['initZendeskAccounts']())[_0xea7b('0x19')](salesforce[_0xea7b('0x24')]())[_0xea7b('0x19')](realtime[_0xea7b('0x25')]())[_0xea7b('0x19')](sugarcrm[_0xea7b('0x26')]())['then'](realtime[_0xea7b('0x27')]())[_0xea7b('0x19')](freshdesk[_0xea7b('0x28')]())['then'](realtime[_0xea7b('0x29')]())[_0xea7b('0x19')](desk[_0xea7b('0x2a')]())['then'](realtime[_0xea7b('0x2b')]())[_0xea7b('0x19')](zoho['getZohoAccounts']())['then'](realtime[_0xea7b('0x2c')]())[_0xea7b('0x19')](vtiger[_0xea7b('0x2d')]())[_0xea7b('0x19')](realtime[_0xea7b('0x2e')]())['then'](freshsales[_0xea7b('0x2f')]())[_0xea7b('0x19')](realtime['initFreshsalesAccounts']())[_0xea7b('0x19')](servicenow[_0xea7b('0x30')]())[_0xea7b('0x19')](realtime[_0xea7b('0x31')]())[_0xea7b('0x19')](dynamics365[_0xea7b('0x32')]())[_0xea7b('0x19')](realtime[_0xea7b('0x33')]())['then'](campaign[_0xea7b('0x34')]())[_0xea7b('0x19')](realtime['initCampaigns']())[_0xea7b('0x19')](voiceExtension[_0xea7b('0x35')]())[_0xea7b('0x19')](realtime['initVoiceExtensions']())[_0xea7b('0x19')](faxAccount[_0xea7b('0x36')]())['then'](realtime[_0xea7b('0x37')]())[_0xea7b('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xea7b('0x18')]()['then'](voiceQueueReport[_0xea7b('0x38')]())[_0xea7b('0x19')](realtime[_0xea7b('0x39')]())['then'](cmHopperHistory[_0xea7b('0x3a')]())[_0xea7b('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xea7b('0x3b')]())[_0xea7b('0x19')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport['getVoiceCallReports']())[_0xea7b('0x19')](realtime[_0xea7b('0x3c')]())[_0xea7b('0x3d')](function(_0x2c6b7a){logger[_0xea7b('0x3e')](_0xea7b('0x3f'),util[_0xea7b('0x40')](_0x2c6b7a,{'showHidden':![],'depth':null}));});}function main(){return server[_0xea7b('0x41')](realtime,preview,fax)[_0xea7b('0x19')](function(_0x33eee3){return initRealtime();})[_0xea7b('0x19')](function(){return initParams();})[_0xea7b('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0xe07196){logger[_0xea7b('0x3e')](_0xea7b('0x42'),util[_0xea7b('0x40')](_0xe07196,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x9eb5=['initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports'];(function(_0x3feccc,_0x5534c7){var _0x2c13b5=function(_0x59a2cd){while(--_0x59a2cd){_0x3feccc['push'](_0x3feccc['shift']());}};_0x2c13b5(++_0x5534c7);}(_0x9eb5,0x92));var _0x59eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9eb5[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x59eb('0x0'));var moment=require(_0x59eb('0x1'));var server=require(_0x59eb('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x59eb('0x3'));var Trigger=require(_0x59eb('0x4'));var Dialer=require('./dialer');var Preview=require(_0x59eb('0x5'));var Fax=require('./fax');var user=require(_0x59eb('0x6'));var voiceQueue=require(_0x59eb('0x7'));var voiceQueueReport=require(_0x59eb('0x8'));var voiceCallReport=require(_0x59eb('0x9'));var trunk=require(_0x59eb('0xa'));var trigger=require(_0x59eb('0xb'));var template=require(_0x59eb('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x59eb('0xd'));var voiceExtension=require(_0x59eb('0xe'));var faxAccount=require(_0x59eb('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x59eb('0x10'));var freshdesk=require(_0x59eb('0x11'));var desk=require(_0x59eb('0x12'));var zoho=require(_0x59eb('0x13'));var vtiger=require(_0x59eb('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x59eb('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x59eb('0x16'))(_0x59eb('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x59eb('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x59eb('0x18')](_0x59eb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x59eb('0x1a')]()['then'](user[_0x59eb('0x1b')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x1d')]())['then'](user[_0x59eb('0x1e')]())['then'](realtime[_0x59eb('0x1f')]())['then'](trunk[_0x59eb('0x20')]())['then'](realtime[_0x59eb('0x21')]())['then'](voiceQueue[_0x59eb('0x22')]())['then'](realtime['initVoiceQueues']())[_0x59eb('0x1c')](trigger['getTriggers']())[_0x59eb('0x1c')](realtime[_0x59eb('0x23')]())[_0x59eb('0x1c')](template[_0x59eb('0x24')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x25')]())[_0x59eb('0x1c')](zendesk[_0x59eb('0x26')]())[_0x59eb('0x1c')](realtime['initZendeskAccounts']())[_0x59eb('0x1c')](salesforce[_0x59eb('0x27')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x28')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x59eb('0x1c')](realtime['initSugarcrmAccounts']())[_0x59eb('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x59eb('0x29')]())[_0x59eb('0x1c')](desk[_0x59eb('0x2a')]())[_0x59eb('0x1c')](realtime['initDeskAccounts']())[_0x59eb('0x1c')](zoho[_0x59eb('0x2b')]())['then'](realtime[_0x59eb('0x2c')]())[_0x59eb('0x1c')](vtiger[_0x59eb('0x2d')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x2e')]())[_0x59eb('0x1c')](freshsales['getFreshsalesAccounts']())[_0x59eb('0x1c')](realtime[_0x59eb('0x2f')]())[_0x59eb('0x1c')](servicenow[_0x59eb('0x30')]())[_0x59eb('0x1c')](realtime['initServicenowAccounts']())[_0x59eb('0x1c')](dynamics365[_0x59eb('0x31')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x32')]())['then'](campaign[_0x59eb('0x33')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x34')]())[_0x59eb('0x1c')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x59eb('0x35')]())['then'](faxAccount['getFaxAccounts']())[_0x59eb('0x1c')](realtime[_0x59eb('0x36')]())[_0x59eb('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x59eb('0x1a')]()[_0x59eb('0x1c')](voiceQueueReport[_0x59eb('0x37')]())['then'](realtime[_0x59eb('0x38')]())[_0x59eb('0x1c')](cmHopperHistory[_0x59eb('0x39')]())[_0x59eb('0x1c')](realtime[_0x59eb('0x3a')]())[_0x59eb('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x59eb('0x1c')](realtime[_0x59eb('0x3b')]())[_0x59eb('0x1c')](voiceCallReport[_0x59eb('0x3c')]())['then'](realtime[_0x59eb('0x3d')]())['catch'](function(_0x1ee09e){logger[_0x59eb('0x3e')](_0x59eb('0x3f'),util[_0x59eb('0x40')](_0x1ee09e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x59eb('0x41')](realtime,preview,fax)[_0x59eb('0x1c')](function(_0x4994d0){return initRealtime();})['then'](function(){return initParams();})[_0x59eb('0x1c')](function(){report[_0x59eb('0x42')]();setInterval(initRealtime,0x1388);})[_0x59eb('0x43')](function(_0x234400){logger[_0x59eb('0x3e')](_0x59eb('0x44'),util[_0x59eb('0x40')](_0x234400,{'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 83aded9..842d3c8 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x24568b,_0x5bbd94){var _0x1792ac=function(_0x2d2976){while(--_0x2d2976){_0x24568b['push'](_0x24568b['shift']());}};_0x1792ac(++_0x5bbd94);}(_0xe706,0xa3));var _0x6e70=function(_0x20c757,_0xf1f53b){_0x20c757=_0x20c757-0x0;var _0x2720f3=_0xe706[_0x20c757];return _0x2720f3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x3db745,_0x49ad24){var _0x4bcb72=function(_0x447783){while(--_0x447783){_0x3db745['push'](_0x3db745['shift']());}};_0x4bcb72(++_0x49ad24);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 61bdf6a..9d8e8e5 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 _0x3cf1=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3cf1,0x1d8));var _0x13cf=function(_0x2d0162,_0x11ca7c){_0x2d0162=_0x2d0162-0x0;var _0x311bef=_0x3cf1[_0x2d0162];return _0x311bef;};'use strict';function Campaign(_0x331d4e){this['id']=_0x331d4e['id']||0x0;this[_0x13cf('0x0')]=_0x331d4e[_0x13cf('0x0')]||'';this[_0x13cf('0x1')]=_0x331d4e[_0x13cf('0x1')]||_0x13cf('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x13cf('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x13cf('0x4')]='';this[_0x13cf('0x5')]=!![];this[_0x13cf('0x6')]=_0x331d4e[_0x13cf('0x6')];this[_0x13cf('0x7')]=_0x331d4e[_0x13cf('0x7')];this[_0x13cf('0x8')]=_0x331d4e['dialTimezone']||null;this[_0x13cf('0x9')]=_0x331d4e[_0x13cf('0x9')]?_0x331d4e[_0x13cf('0x9')]:null;this[_0x13cf('0xa')]=_0x331d4e[_0x13cf('0xa')];this[_0x13cf('0xb')]=_0x331d4e[_0x13cf('0xb')];this[_0x13cf('0xc')]=_0x331d4e['dialOriginateTimeout']||0x1e;this[_0x13cf('0xd')]=_0x331d4e['dialCongestionMaxRetry'];this[_0x13cf('0xe')]=_0x331d4e['dialCongestionRetryFrequency'];this[_0x13cf('0xf')]=_0x331d4e['dialBusyMaxRetry'];this[_0x13cf('0x10')]=_0x331d4e['dialBusyRetryFrequency'];this[_0x13cf('0x11')]=_0x331d4e['dialNoAnswerMaxRetry'];this[_0x13cf('0x12')]=_0x331d4e[_0x13cf('0x12')];this[_0x13cf('0x13')]=_0x331d4e[_0x13cf('0x13')];this['dialNoSuchNumberMaxRetry']=_0x331d4e[_0x13cf('0x14')]||0x3;this[_0x13cf('0x15')]=_0x331d4e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x13cf('0x16')]=_0x331d4e[_0x13cf('0x16')]||0x3;this['dialDropRetryFrequency']=_0x331d4e[_0x13cf('0x17')]||0x96;this[_0x13cf('0x18')]=_0x331d4e[_0x13cf('0x18')]||0x3;this[_0x13cf('0x19')]=_0x331d4e[_0x13cf('0x19')]||0x96;this[_0x13cf('0x1a')]=_0x331d4e[_0x13cf('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x331d4e[_0x13cf('0x1b')]||0x96;this[_0x13cf('0x1c')]=_0x331d4e[_0x13cf('0x1c')]||0x3;this[_0x13cf('0x1d')]=_0x331d4e[_0x13cf('0x1d')]||0x96;this[_0x13cf('0x1e')]=_0x331d4e[_0x13cf('0x1e')]||'DESC';this[_0x13cf('0x1f')]=_0x331d4e['dialPrefix']||undefined;this[_0x13cf('0x20')]=_0x331d4e[_0x13cf('0x20')]||undefined;this[_0x13cf('0x21')]=_0x331d4e['dialCutDigit']||undefined;this[_0x13cf('0x22')]=_0x331d4e[_0x13cf('0x22')]?_0x331d4e[_0x13cf('0x22')]:undefined;this[_0x13cf('0x23')]=_0x331d4e[_0x13cf('0x23')]?_0x331d4e['Trunk']:undefined;this[_0x13cf('0x24')]=_0x331d4e[_0x13cf('0x24')]?_0x331d4e[_0x13cf('0x24')]:undefined;this[_0x13cf('0x25')]=_0x331d4e[_0x13cf('0x25')]?_0x331d4e[_0x13cf('0x25')]:undefined;this[_0x13cf('0x26')]=_0x331d4e[_0x13cf('0x25')]?_0x331d4e[_0x13cf('0x25')][_0x13cf('0x0')]:undefined;this[_0x13cf('0x27')]=_0x331d4e[_0x13cf('0x27')]||![];this[_0x13cf('0x28')]=_0x331d4e[_0x13cf('0x28')];this[_0x13cf('0x29')]=_0x331d4e['dialAMDGreeting'];this[_0x13cf('0x2a')]=_0x331d4e[_0x13cf('0x2a')];this['dialAMDTotalAnalysisTime']=_0x331d4e[_0x13cf('0x2b')];this[_0x13cf('0x2c')]=_0x331d4e[_0x13cf('0x2c')];this[_0x13cf('0x2d')]=_0x331d4e[_0x13cf('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x331d4e[_0x13cf('0x2e')];this[_0x13cf('0x2f')]=_0x331d4e[_0x13cf('0x2f')];this[_0x13cf('0x30')]=_0x331d4e[_0x13cf('0x30')];}module[_0x13cf('0x31')]=Campaign; \ No newline at end of file +var _0x0af7=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0af7,0x10c));var _0x70af=function(_0x370f88,_0x2bf2e4){_0x370f88=_0x370f88-0x0;var _0xfcafcb=_0x0af7[_0x370f88];return _0xfcafcb;};'use strict';function Campaign(_0x553b89){this['id']=_0x553b89['id']||0x0;this[_0x70af('0x0')]=_0x553b89[_0x70af('0x0')]||'';this[_0x70af('0x1')]=_0x553b89[_0x70af('0x1')]||_0x70af('0x2');this['originated']=0x0;this[_0x70af('0x3')]=0x0;this[_0x70af('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x70af('0x5')]=!![];this[_0x70af('0x6')]=_0x553b89[_0x70af('0x6')];this[_0x70af('0x7')]=_0x553b89[_0x70af('0x7')];this[_0x70af('0x8')]=_0x553b89[_0x70af('0x8')]||null;this['dialGlobalInterval']=_0x553b89['dialGlobalInterval']?_0x553b89['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x553b89[_0x70af('0x9')];this[_0x70af('0xa')]=_0x553b89[_0x70af('0xa')];this[_0x70af('0xb')]=_0x553b89[_0x70af('0xb')]||0x1e;this[_0x70af('0xc')]=_0x553b89['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x553b89['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x553b89['dialBusyMaxRetry'];this[_0x70af('0xd')]=_0x553b89[_0x70af('0xd')];this['dialNoAnswerMaxRetry']=_0x553b89[_0x70af('0xe')];this[_0x70af('0xf')]=_0x553b89[_0x70af('0xf')];this[_0x70af('0x10')]=_0x553b89[_0x70af('0x10')];this[_0x70af('0x11')]=_0x553b89[_0x70af('0x11')]||0x3;this[_0x70af('0x12')]=_0x553b89['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x553b89[_0x70af('0x13')]||0x3;this[_0x70af('0x14')]=_0x553b89[_0x70af('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x553b89[_0x70af('0x15')]||0x3;this[_0x70af('0x16')]=_0x553b89[_0x70af('0x16')]||0x96;this['dialMachineMaxRetry']=_0x553b89[_0x70af('0x17')]||0x3;this[_0x70af('0x18')]=_0x553b89['dialMachineRetryFrequency']||0x96;this[_0x70af('0x19')]=_0x553b89[_0x70af('0x19')]||0x3;this[_0x70af('0x1a')]=_0x553b89[_0x70af('0x1a')]||0x96;this[_0x70af('0x1b')]=_0x553b89['dialOrderByScheduledAt']||_0x70af('0x1c');this[_0x70af('0x1d')]=_0x553b89['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x553b89[_0x70af('0x1e')]||undefined;this[_0x70af('0x1f')]=_0x553b89[_0x70af('0x1f')]||undefined;this[_0x70af('0x20')]=_0x553b89[_0x70af('0x20')]?_0x553b89[_0x70af('0x20')]:undefined;this[_0x70af('0x21')]=_0x553b89[_0x70af('0x21')]?_0x553b89[_0x70af('0x21')]:undefined;this[_0x70af('0x22')]=_0x553b89['Interval']?_0x553b89[_0x70af('0x22')]:undefined;this[_0x70af('0x23')]=_0x553b89[_0x70af('0x23')]?_0x553b89[_0x70af('0x23')]:undefined;this['dialQueueProject']=_0x553b89['SquareProject']?_0x553b89[_0x70af('0x23')][_0x70af('0x0')]:undefined;this[_0x70af('0x24')]=_0x553b89['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x553b89[_0x70af('0x25')];this[_0x70af('0x26')]=_0x553b89[_0x70af('0x26')];this[_0x70af('0x27')]=_0x553b89['dialAMDAfterGreetingSilence'];this[_0x70af('0x28')]=_0x553b89[_0x70af('0x28')];this[_0x70af('0x29')]=_0x553b89[_0x70af('0x29')];this['dialAMDBetweenWordsSilence']=_0x553b89[_0x70af('0x2a')];this[_0x70af('0x2b')]=_0x553b89[_0x70af('0x2b')];this['dialAMDSilenceThreshold']=_0x553b89[_0x70af('0x2c')];this['dialAMDMaximumWordLength']=_0x553b89[_0x70af('0x2d')];}module[_0x70af('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 df1f716..2d765ab 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 _0x147b=['duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinename','accountcode','context','linkedid','answered','answertime','endtime','lastapplication','lastdata'];(function(_0x1790da,_0x546e35){var _0x583d3e=function(_0x4401a1){while(--_0x4401a1){_0x1790da['push'](_0x1790da['shift']());}};_0x583d3e(++_0x546e35);}(_0x147b,0x193));var _0xb147=function(_0x510b08,_0x16cd04){_0x510b08=_0x510b08-0x0;var _0xbf9488=_0x147b[_0x510b08];return _0xbf9488;};'use strict';function Channel(){this[_0xb147('0x0')]=null;this[_0xb147('0x1')]='';this['destinationchannel']='';this[_0xb147('0x2')]=0x0;this[_0xb147('0x3')]='';this['connectedlinenum']=undefined;this[_0xb147('0x4')]=undefined;this[_0xb147('0x5')]=0x0;this[_0xb147('0x6')]='';this['uniqueid']=0x0;this[_0xb147('0x7')]=0x0;this['exten']=0x0;this[_0xb147('0x8')]=![];this[_0xb147('0x9')]=null;this[_0xb147('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xb147('0xb')]='';this[_0xb147('0xc')]='';this[_0xb147('0xd')]=0x0;this[_0xb147('0xe')]=0x0;this[_0xb147('0xf')]=0x0;this[_0xb147('0x10')]=null;this[_0xb147('0x11')]=null;this[_0xb147('0x12')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xb147('0x13')]=null;this[_0xb147('0x14')]=[];this[_0xb147('0x15')]=undefined;this[_0xb147('0x16')]=undefined;this[_0xb147('0x17')]=undefined;this[_0xb147('0x18')]=0x0;}module[_0xb147('0x19')]=Channel; \ No newline at end of file +var _0xe75a=['mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferType'];(function(_0x18b7b1,_0x3723f3){var _0x2e2eab=function(_0x10dc5f){while(--_0x10dc5f){_0x18b7b1['push'](_0x18b7b1['shift']());}};_0x2e2eab(++_0x3723f3);}(_0xe75a,0x115));var _0xae75=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0xe75a[_0x550e29];return _0x3515b6;};'use strict';function Channel(){this['starttime']=null;this[_0xae75('0x0')]='';this[_0xae75('0x1')]='';this[_0xae75('0x2')]=0x0;this[_0xae75('0x3')]='';this['connectedlinenum']=undefined;this[_0xae75('0x4')]=undefined;this[_0xae75('0x5')]=0x0;this[_0xae75('0x6')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xae75('0x7')]=![];this[_0xae75('0x8')]=null;this[_0xae75('0x9')]=null;this[_0xae75('0xa')]=![];this['abandoned']=![];this[_0xae75('0xb')]='';this[_0xae75('0xc')]='';this[_0xae75('0xd')]=0x0;this[_0xae75('0xe')]=0x0;this['holdtime']=0x0;this[_0xae75('0xf')]=null;this[_0xae75('0x10')]=null;this[_0xae75('0x11')]=null;this[_0xae75('0x12')]=![];this[_0xae75('0x13')]=null;this[_0xae75('0x14')]=null;this[_0xae75('0x15')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0xae75('0x16')]=undefined;this[_0xae75('0x17')]=0x0;}module[_0xae75('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 934aacb..2e9df27 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 _0x36d4=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey'];(function(_0x40b7ec,_0x307707){var _0x72b976=function(_0x5bfcc3){while(--_0x5bfcc3){_0x40b7ec['push'](_0x40b7ec['shift']());}};_0x72b976(++_0x307707);}(_0x36d4,0x11a));var _0x436d=function(_0x29a91c,_0x5ac2c5){_0x29a91c=_0x29a91c-0x0;var _0x2ab4ff=_0x36d4[_0x29a91c];return _0x2ab4ff;};'use strict';function DeskAccount(_0x1108bc){this['id']=_0x1108bc['id']||0x0;this['name']=_0x1108bc[_0x436d('0x0')]||'';this[_0x436d('0x1')]=_0x1108bc[_0x436d('0x1')]||'';this[_0x436d('0x2')]=_0x1108bc['remoteUri']||'';this[_0x436d('0x3')]=_0x1108bc[_0x436d('0x3')]||'';this[_0x436d('0x4')]=_0x1108bc[_0x436d('0x4')]||'';this[_0x436d('0x5')]=_0x1108bc[_0x436d('0x5')]||'';this[_0x436d('0x6')]=_0x1108bc[_0x436d('0x6')]||'';this[_0x436d('0x7')]=_0x1108bc['token']||'';this[_0x436d('0x8')]=_0x1108bc[_0x436d('0x8')]||'';this[_0x436d('0x9')]=_0x1108bc['type']||'';this[_0x436d('0xa')]=_0x1108bc[_0x436d('0xa')]||'';this[_0x436d('0xb')]=_0x1108bc[_0x436d('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x1256=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x5c0de5,_0x30df16){var _0x4a612c=function(_0x18e870){while(--_0x18e870){_0x5c0de5['push'](_0x5c0de5['shift']());}};_0x4a612c(++_0x30df16);}(_0x1256,0x1ab));var _0x6125=function(_0x381730,_0x195ecd){_0x381730=_0x381730-0x0;var _0x1d577a=_0x1256[_0x381730];return _0x1d577a;};'use strict';function DeskAccount(_0x24b8ac){this['id']=_0x24b8ac['id']||0x0;this['name']=_0x24b8ac[_0x6125('0x0')]||'';this[_0x6125('0x1')]=_0x24b8ac[_0x6125('0x1')]||'';this[_0x6125('0x2')]=_0x24b8ac['remoteUri']||'';this[_0x6125('0x3')]=_0x24b8ac[_0x6125('0x3')]||'';this['password']=_0x24b8ac[_0x6125('0x4')]||'';this[_0x6125('0x5')]=_0x24b8ac['consumerKey']||'';this['consumerSecret']=_0x24b8ac[_0x6125('0x6')]||'';this[_0x6125('0x7')]=_0x24b8ac[_0x6125('0x7')]||'';this[_0x6125('0x8')]=_0x24b8ac[_0x6125('0x8')]||'';this[_0x6125('0x9')]=_0x24b8ac[_0x6125('0x9')]||'';this['serverUrl']=_0x24b8ac[_0x6125('0xa')]||'';this[_0x6125('0xb')]=_0x24b8ac[_0x6125('0xb')]||{};}module[_0x6125('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 7ece6c7..32bb5bb 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 _0x6d25=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x589ff6,_0x5e27a0){var _0xa4e564=function(_0x32123c){while(--_0x32123c){_0x589ff6['push'](_0x589ff6['shift']());}};_0xa4e564(++_0x5e27a0);}(_0x6d25,0x91));var _0x56d2=function(_0x41ce5f,_0x233698){_0x41ce5f=_0x41ce5f-0x0;var _0x29f927=_0x6d25[_0x41ce5f];return _0x29f927;};'use strict';function Dynamics365Account(_0x273a32){this['id']=_0x273a32['id']||0x0;this[_0x56d2('0x0')]=_0x273a32[_0x56d2('0x0')]||'';this['username']=_0x273a32[_0x56d2('0x1')]||'';this[_0x56d2('0x2')]=_0x273a32[_0x56d2('0x2')]||'';this[_0x56d2('0x3')]=_0x273a32[_0x56d2('0x3')]||'';this[_0x56d2('0x4')]=_0x273a32[_0x56d2('0x4')]||'';this['clientId']=_0x273a32[_0x56d2('0x5')]||'';this['clientSecret']=_0x273a32[_0x56d2('0x6')]||{};this[_0x56d2('0x7')]=_0x273a32[_0x56d2('0x7')]||'';this[_0x56d2('0x8')]=_0x273a32['modernAuthentication']||![];this['Configurations']=_0x273a32[_0x56d2('0x9')]||{};this['CloudProvider']=_0x273a32[_0x56d2('0xa')]||{};}module[_0x56d2('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x3744=['Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x27502c,_0x559827){var _0x8df90d=function(_0x29d7e8){while(--_0x29d7e8){_0x27502c['push'](_0x27502c['shift']());}};_0x8df90d(++_0x559827);}(_0x3744,0x141));var _0x4374=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3744[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4b8002){this['id']=_0x4b8002['id']||0x0;this[_0x4374('0x0')]=_0x4b8002[_0x4374('0x0')]||'';this[_0x4374('0x1')]=_0x4b8002[_0x4374('0x1')]||'';this[_0x4374('0x2')]=_0x4b8002[_0x4374('0x2')]||'';this[_0x4374('0x3')]=_0x4b8002[_0x4374('0x3')]||'';this['tenantId']=_0x4b8002[_0x4374('0x4')]||'';this[_0x4374('0x5')]=_0x4b8002[_0x4374('0x5')]||'';this[_0x4374('0x6')]=_0x4b8002['clientSecret']||{};this['serverUrl']=_0x4b8002[_0x4374('0x7')]||'';this[_0x4374('0x8')]=_0x4b8002[_0x4374('0x8')]||![];this['Configurations']=_0x4b8002[_0x4374('0x9')]||{};this[_0x4374('0xa')]=_0x4b8002[_0x4374('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 828f5b4..a112eed 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 _0xe0de=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x1a426d,_0x121866){var _0x2b1ac2=function(_0x191459){while(--_0x191459){_0x1a426d['push'](_0x1a426d['shift']());}};_0x2b1ac2(++_0x121866);}(_0xe0de,0x10f));var _0xee0d=function(_0x336670,_0x531517){_0x336670=_0x336670-0x0;var _0x7ec8bc=_0xe0de[_0x336670];return _0x7ec8bc;};'use strict';function FaxAccount(_0x34aa2d){this['id']=_0x34aa2d['id']||0x0;this[_0xee0d('0x0')]=_0x34aa2d[_0xee0d('0x0')]||'';this[_0xee0d('0x1')]=_0x34aa2d['description'];this[_0xee0d('0x2')]=_0x34aa2d[_0xee0d('0x2')];this[_0xee0d('0x3')]=_0x34aa2d[_0xee0d('0x3')];this[_0xee0d('0x4')]=_0x34aa2d['localstationid'];this[_0xee0d('0x5')]=_0x34aa2d[_0xee0d('0x5')]||0x960;this[_0xee0d('0x6')]=_0x34aa2d['maxrate']||0x3840;this[_0xee0d('0x7')]=_0x34aa2d[_0xee0d('0x7')]||'v17,v27,v29';this[_0xee0d('0x8')]=_0x34aa2d[_0xee0d('0x8')]||'no';this[_0xee0d('0x9')]=_0x34aa2d[_0xee0d('0x9')]||'no';this[_0xee0d('0xa')]=_0x34aa2d[_0xee0d('0xa')]||0x1388;this[_0xee0d('0xb')]=_0x34aa2d['tech']||_0xee0d('0xc');this['Trunk']=_0x34aa2d[_0xee0d('0xd')]?_0x34aa2d['Trunk']:undefined;this[_0xee0d('0xe')]=_0x34aa2d[_0xee0d('0xe')];this['key']=_0x34aa2d[_0xee0d('0xf')];}module[_0xee0d('0x10')]=FaxAccount; \ No newline at end of file +var _0x7887=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7887,0x1b3));var _0x7788=function(_0x1d725e,_0x7cbcd0){_0x1d725e=_0x1d725e-0x0;var _0x521263=_0x7887[_0x1d725e];return _0x521263;};'use strict';function FaxAccount(_0x255362){this['id']=_0x255362['id']||0x0;this['name']=_0x255362[_0x7788('0x0')]||'';this[_0x7788('0x1')]=_0x255362[_0x7788('0x1')];this[_0x7788('0x2')]=_0x255362[_0x7788('0x2')];this[_0x7788('0x3')]=_0x255362['headerinfo'];this[_0x7788('0x4')]=_0x255362['localstationid'];this[_0x7788('0x5')]=_0x255362[_0x7788('0x5')]||0x960;this['maxrate']=_0x255362[_0x7788('0x6')]||0x3840;this[_0x7788('0x7')]=_0x255362[_0x7788('0x7')]||_0x7788('0x8');this[_0x7788('0x9')]=_0x255362[_0x7788('0x9')]||'no';this[_0x7788('0xa')]=_0x255362[_0x7788('0xa')]||'no';this[_0x7788('0xb')]=_0x255362['t38timeout']||0x1388;this['tech']=_0x255362[_0x7788('0xc')]||_0x7788('0xd');this[_0x7788('0xe')]=_0x255362[_0x7788('0xe')]?_0x255362[_0x7788('0xe')]:undefined;this[_0x7788('0xf')]=_0x255362['ListId'];this[_0x7788('0x10')]=_0x255362[_0x7788('0x10')];}module[_0x7788('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 73d2a06..1c177e6 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 _0x79b9=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x581481,_0x489aad){var _0x216384=function(_0x1d8604){while(--_0x1d8604){_0x581481['push'](_0x581481['shift']());}};_0x216384(++_0x489aad);}(_0x79b9,0x18a));var _0x979b=function(_0x46de08,_0x350a03){_0x46de08=_0x46de08-0x0;var _0x11dcff=_0x79b9[_0x46de08];return _0x11dcff;};'use strict';function FreshdeskAccount(_0x224fe6){this['id']=_0x224fe6['id']||0x0;this['name']=_0x224fe6[_0x979b('0x0')]||'';this[_0x979b('0x1')]=_0x224fe6[_0x979b('0x1')]||'';this[_0x979b('0x2')]=_0x224fe6[_0x979b('0x3')]||'';this['remoteUri']=_0x224fe6[_0x979b('0x4')]||'';this['serverUrl']=_0x224fe6[_0x979b('0x5')]||'';this[_0x979b('0x6')]=_0x224fe6['Configurations']||{};}module[_0x979b('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x22f1=['serverUrl','Configurations','name','username','apiKey','remoteUri'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x22f1,0x182));var _0x122f=function(_0x7290c6,_0x4bbafc){_0x7290c6=_0x7290c6-0x0;var _0x531f73=_0x22f1[_0x7290c6];return _0x531f73;};'use strict';function FreshdeskAccount(_0x3d4c15){this['id']=_0x3d4c15['id']||0x0;this[_0x122f('0x0')]=_0x3d4c15[_0x122f('0x0')]||'';this[_0x122f('0x1')]=_0x3d4c15[_0x122f('0x1')]||'';this[_0x122f('0x2')]=_0x3d4c15['token']||'';this[_0x122f('0x3')]=_0x3d4c15[_0x122f('0x3')]||'';this[_0x122f('0x4')]=_0x3d4c15['serverUrl']||'';this[_0x122f('0x5')]=_0x3d4c15[_0x122f('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5aa2861..8c11674 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 _0xbbbd=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4162af,_0x72a823){var _0x42b1a8=function(_0x5891d1){while(--_0x5891d1){_0x4162af['push'](_0x4162af['shift']());}};_0x42b1a8(++_0x72a823);}(_0xbbbd,0x86));var _0xdbbb=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbbbd[_0x5d2803];return _0xdcad2c;};'use strict';function FreshsalesAccount(_0x145880){this['id']=_0x145880['id']||0x0;this[_0xdbbb('0x0')]=_0x145880[_0xdbbb('0x0')]||'';this[_0xdbbb('0x1')]=_0x145880[_0xdbbb('0x1')]||'';this[_0xdbbb('0x2')]=_0x145880[_0xdbbb('0x3')]||'';this[_0xdbbb('0x4')]=_0x145880[_0xdbbb('0x4')]||'';this[_0xdbbb('0x5')]=_0x145880[_0xdbbb('0x5')]||'';this[_0xdbbb('0x6')]=_0x145880['Configurations']||{};}module[_0xdbbb('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x046b=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x776996,_0x3c21fe){var _0x23ee0a=function(_0x2f3579){while(--_0x2f3579){_0x776996['push'](_0x776996['shift']());}};_0x23ee0a(++_0x3c21fe);}(_0x046b,0x147));var _0xb046=function(_0x1ca4df,_0xd2a69d){_0x1ca4df=_0x1ca4df-0x0;var _0x48737=_0x046b[_0x1ca4df];return _0x48737;};'use strict';function FreshsalesAccount(_0x311488){this['id']=_0x311488['id']||0x0;this[_0xb046('0x0')]=_0x311488[_0xb046('0x0')]||'';this[_0xb046('0x1')]=_0x311488[_0xb046('0x1')]||'';this[_0xb046('0x2')]=_0x311488['token']||'';this[_0xb046('0x3')]=_0x311488[_0xb046('0x3')]||'';this[_0xb046('0x4')]=_0x311488[_0xb046('0x4')]||'';this[_0xb046('0x5')]=_0x311488['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1960663..a1a58eb 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 _0xe262=['variables','exports','type','uniqueid','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','assigned','lastAssignedTo','motionChannel','voice','mohtime'];(function(_0x196917,_0x5ab135){var _0x565118=function(_0x487ac0){while(--_0x487ac0){_0x196917['push'](_0x196917['shift']());}};_0x565118(++_0x5ab135);}(_0xe262,0x1a6));var _0x2e26=function(_0x396662,_0x1ff20a){_0x396662=_0x396662-0x0;var _0xb5d433=_0xe262[_0x396662];return _0xb5d433;};'use strict';function QueueReport(){this[_0x2e26('0x0')]='inbound';this[_0x2e26('0x1')]='';this['calleridnum']='';this[_0x2e26('0x2')]='';this[_0x2e26('0x3')]='';this[_0x2e26('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x2e26('0x5')]=0x1;this[_0x2e26('0x6')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x2e26('0x7')]=null;this['queuecallerexit']=![];this[_0x2e26('0x8')]=null;this[_0x2e26('0x9')]=0x1;this['channel']='';this[_0x2e26('0xa')]='';this['connectedlinename']='';this[_0x2e26('0xb')]='';this[_0x2e26('0xc')]='';this[_0x2e26('0xd')]='';this['priority']='';this['holdtime']=0x0;this[_0x2e26('0xe')]=![];this[_0x2e26('0xf')]='';this[_0x2e26('0x10')]=_0x2e26('0x11');this[_0x2e26('0x12')]=0x0;this[_0x2e26('0x13')]={};}module[_0x2e26('0x14')]=QueueReport; \ No newline at end of file +var _0x9dbc=['connectedlinename','accountcode','exten','holdtime','lastAssignedTo','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0x4cf628,_0x56c30f){var _0x44d7f3=function(_0x194ee9){while(--_0x194ee9){_0x4cf628['push'](_0x4cf628['shift']());}};_0x44d7f3(++_0x56c30f);}(_0x9dbc,0x175));var _0xc9db=function(_0x50d5ae,_0x22a349){_0x50d5ae=_0x50d5ae-0x0;var _0x1e8d74=_0x9dbc[_0x50d5ae];return _0x1e8d74;};'use strict';function QueueReport(){this[_0xc9db('0x0')]=_0xc9db('0x1');this['uniqueid']='';this[_0xc9db('0x2')]='';this[_0xc9db('0x3')]='';this[_0xc9db('0x4')]='';this['queuecallerjoinAt']=null;this[_0xc9db('0x5')]=null;this[_0xc9db('0x6')]=0x1;this[_0xc9db('0x7')]=0x1;this[_0xc9db('0x8')]=![];this[_0xc9db('0x9')]=null;this[_0xc9db('0xa')]=![];this[_0xc9db('0xb')]=null;this[_0xc9db('0xc')]=![];this[_0xc9db('0xd')]=null;this[_0xc9db('0xe')]=0x1;this[_0xc9db('0xf')]='';this[_0xc9db('0x10')]='';this[_0xc9db('0x11')]='';this[_0xc9db('0x12')]='';this['context']='';this[_0xc9db('0x13')]='';this['priority']='';this[_0xc9db('0x14')]=0x0;this['assigned']=![];this[_0xc9db('0x15')]='';this['motionChannel']=_0xc9db('0x16');this[_0xc9db('0x17')]=0x0;this[_0xc9db('0x18')]={};}module[_0xc9db('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 934be1c..cd1f422 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 _0x7a8a=['remoteUri','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x7a8a,0xc4));var _0xa7a8=function(_0x5526b3,_0x251d66){_0x5526b3=_0x5526b3-0x0;var _0x24c0ba=_0x7a8a[_0x5526b3];return _0x24c0ba;};'use strict';function SalesforceAccount(_0x4f2b10){this['id']=_0x4f2b10['id']||0x0;this[_0xa7a8('0x0')]=_0x4f2b10[_0xa7a8('0x0')]||'';this[_0xa7a8('0x1')]=_0x4f2b10['username']||'';this[_0xa7a8('0x2')]=_0x4f2b10[_0xa7a8('0x2')]||'';this['password']=_0x4f2b10['password']||'';this[_0xa7a8('0x3')]=_0x4f2b10[_0xa7a8('0x3')]||'';this[_0xa7a8('0x4')]=_0x4f2b10[_0xa7a8('0x4')]||'';this['securityToken']=_0x4f2b10['securityToken']||'';this[_0xa7a8('0x5')]=_0x4f2b10[_0xa7a8('0x5')]||_0xa7a8('0x6');this[_0xa7a8('0x7')]=_0x4f2b10[_0xa7a8('0x7')]||'';this[_0xa7a8('0x8')]=_0x4f2b10['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x2c49=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x11cd26,_0x383e1e){var _0x43a686=function(_0x541eed){while(--_0x541eed){_0x11cd26['push'](_0x11cd26['shift']());}};_0x43a686(++_0x383e1e);}(_0x2c49,0xc3));var _0x92c4=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x2c49[_0x34f701];return _0x3e2429;};'use strict';function SalesforceAccount(_0x285e48){this['id']=_0x285e48['id']||0x0;this[_0x92c4('0x0')]=_0x285e48[_0x92c4('0x0')]||'';this[_0x92c4('0x1')]=_0x285e48[_0x92c4('0x1')]||'';this['remoteUri']=_0x285e48[_0x92c4('0x2')]||'';this[_0x92c4('0x3')]=_0x285e48['password']||'';this[_0x92c4('0x4')]=_0x285e48['clientId']||'';this[_0x92c4('0x5')]=_0x285e48[_0x92c4('0x5')]||'';this[_0x92c4('0x6')]=_0x285e48[_0x92c4('0x6')]||'';this[_0x92c4('0x7')]=_0x285e48[_0x92c4('0x7')]||_0x92c4('0x8');this[_0x92c4('0x9')]=_0x285e48['serverUrl']||'';this['Configurations']=_0x285e48[_0x92c4('0xa')]||{};}module[_0x92c4('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a6b8f17..3471d39 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 _0xb175=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb175,0x1f1));var _0x5b17=function(_0x35e7ca,_0xaf4bac){_0x35e7ca=_0x35e7ca-0x0;var _0x183e09=_0xb175[_0x35e7ca];return _0x183e09;};'use strict';function ServicenowAccount(_0x35600e){this['id']=_0x35600e['id']||0x0;this['name']=_0x35600e[_0x5b17('0x0')]||'';this[_0x5b17('0x1')]=_0x35600e[_0x5b17('0x1')]||'';this[_0x5b17('0x2')]=_0x35600e[_0x5b17('0x2')]||'';this[_0x5b17('0x3')]=_0x35600e['remoteUri']||'';this[_0x5b17('0x4')]=_0x35600e[_0x5b17('0x4')]||'';this['Configurations']=_0x35600e[_0x5b17('0x5')]||{};}module[_0x5b17('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x59a9=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x59a9,0xeb));var _0x959a=function(_0x5f012d,_0x5b5ad6){_0x5f012d=_0x5f012d-0x0;var _0x322d08=_0x59a9[_0x5f012d];return _0x322d08;};'use strict';function ServicenowAccount(_0x333751){this['id']=_0x333751['id']||0x0;this['name']=_0x333751[_0x959a('0x0')]||'';this[_0x959a('0x1')]=_0x333751[_0x959a('0x1')]||'';this['password']=_0x333751[_0x959a('0x2')]||'';this[_0x959a('0x3')]=_0x333751[_0x959a('0x3')]||'';this[_0x959a('0x4')]=_0x333751['serverUrl']||'';this[_0x959a('0x5')]=_0x333751[_0x959a('0x5')]||{};}module[_0x959a('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index bf56d4d..8c2705a 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 _0x4247=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x18a01c,_0xd1a13a){var _0x2b0cd6=function(_0x563571){while(--_0x563571){_0x18a01c['push'](_0x18a01c['shift']());}};_0x2b0cd6(++_0xd1a13a);}(_0x4247,0x1ba));var _0x7424=function(_0x84b566,_0x177e99){_0x84b566=_0x84b566-0x0;var _0x395622=_0x4247[_0x84b566];return _0x395622;};'use strict';function SugarcrmAccount(_0x2b1695){this['id']=_0x2b1695['id']||0x0;this[_0x7424('0x0')]=_0x2b1695[_0x7424('0x0')]||'';this[_0x7424('0x1')]=_0x2b1695[_0x7424('0x1')]||'';this['password']=_0x2b1695['password']||'';this[_0x7424('0x2')]=_0x2b1695['remoteUri']||'';this[_0x7424('0x3')]=_0x2b1695[_0x7424('0x3')]||'';this[_0x7424('0x4')]=_0x2b1695[_0x7424('0x4')]||{};}module[_0x7424('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x5b04=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2c6edd,_0x5ec31d){var _0x5aa90a=function(_0x12280f){while(--_0x12280f){_0x2c6edd['push'](_0x2c6edd['shift']());}};_0x5aa90a(++_0x5ec31d);}(_0x5b04,0x17a));var _0x45b0=function(_0x24e0f9,_0x4dfe7c){_0x24e0f9=_0x24e0f9-0x0;var _0x5e5bf3=_0x5b04[_0x24e0f9];return _0x5e5bf3;};'use strict';function SugarcrmAccount(_0x13a213){this['id']=_0x13a213['id']||0x0;this[_0x45b0('0x0')]=_0x13a213[_0x45b0('0x0')]||'';this[_0x45b0('0x1')]=_0x13a213[_0x45b0('0x1')]||'';this[_0x45b0('0x2')]=_0x13a213[_0x45b0('0x2')]||'';this['remoteUri']=_0x13a213[_0x45b0('0x3')]||'';this[_0x45b0('0x4')]=_0x13a213[_0x45b0('0x4')]||'';this[_0x45b0('0x5')]=_0x13a213[_0x45b0('0x5')]||{};}module[_0x45b0('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 1c43284..1c5efae 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 _0xe9ee=['stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x5cc550,_0x5cf5e2){var _0x4a7de6=function(_0x3845de){while(--_0x3845de){_0x5cc550['push'](_0x5cc550['shift']());}};_0x4a7de6(++_0x5cf5e2);}(_0xe9ee,0x1e8));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x1ddcd6){this['id']=_0x1ddcd6['id']||0x0;this[_0xee9e('0x0')]=_0x1ddcd6[_0xee9e('0x0')]||'';this[_0xee9e('0x1')]=_0x1ddcd6[_0xee9e('0x1')]||'';this['state']='unknown';this[_0xee9e('0x2')]=0x0;this[_0xee9e('0x3')]=_0xee9e('0x4');this[_0xee9e('0x5')]='';}module[_0xee9e('0x6')]=Telephone; \ No newline at end of file +var _0x1a4d=['address','name','accountcode','state','unknown','stateTime','status'];(function(_0xc315de,_0x5dc877){var _0x11a627=function(_0x4039d6){while(--_0x4039d6){_0xc315de['push'](_0xc315de['shift']());}};_0x11a627(++_0x5dc877);}(_0x1a4d,0x189));var _0xd1a4=function(_0x2cf4ce,_0x5418cd){_0x2cf4ce=_0x2cf4ce-0x0;var _0x2c10dd=_0x1a4d[_0x2cf4ce];return _0x2c10dd;};'use strict';function Telephone(_0x148a5a){this['id']=_0x148a5a['id']||0x0;this[_0xd1a4('0x0')]=_0x148a5a['name']||'';this[_0xd1a4('0x1')]=_0x148a5a[_0xd1a4('0x1')]||'';this[_0xd1a4('0x2')]=_0xd1a4('0x3');this[_0xd1a4('0x4')]=0x0;this[_0xd1a4('0x5')]=_0xd1a4('0x3');this[_0xd1a4('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 9b8348d..d974741 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(_0x1c55fa,_0xcc9e78){var _0xd8af85=function(_0x2c18d0){while(--_0x2c18d0){_0x1c55fa['push'](_0x1c55fa['shift']());}};_0xd8af85(++_0xcc9e78);}(_0xb10b,0x12a));var _0xbb10=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0xb10b[_0x1800cb];return _0x3b5e95;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x4652f9,_0x240bdf){var _0x27e11b=function(_0x258934){while(--_0x258934){_0x4652f9['push'](_0x4652f9['shift']());}};_0x27e11b(++_0x240bdf);}(_0xb10b,0x12a));var _0xbb10=function(_0x332ddf,_0x1ed1b5){_0x332ddf=_0x332ddf-0x0;var _0x4798a9=_0xb10b[_0x332ddf];return _0x4798a9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index aabd23a..56e7a52 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x49fa61,_0x190dce){var _0x276e60=function(_0x276c60){while(--_0x276c60){_0x49fa61['push'](_0x49fa61['shift']());}};_0x276e60(++_0x190dce);}(_0x14a0,0x8e));var _0x014a=function(_0x8c12cb,_0x5403fb){_0x8c12cb=_0x8c12cb-0x0;var _0x356757=_0x14a0[_0x8c12cb];return _0x356757;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1a85,0x178));var _0x51a8=function(_0x2757fc,_0xfbd23){_0x2757fc=_0x2757fc-0x0;var _0x58efc4=_0x1a85[_0x2757fc];return _0x58efc4;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5c6fdc6..3a38f87 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 _0xafed=['stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown'];(function(_0x515099,_0x5c674a){var _0x29dfc3=function(_0x1db0f7){while(--_0x1db0f7){_0x515099['push'](_0x515099['shift']());}};_0x29dfc3(++_0x5c674a);}(_0xafed,0x69));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x4c4d0b){this['id']=_0x4c4d0b['id']||0x0;this[_0xdafe('0x0')]=_0x4c4d0b[_0xdafe('0x0')]||![];this['name']=_0x4c4d0b[_0xdafe('0x1')]||'';this['state']=_0xdafe('0x2');this[_0xdafe('0x3')]=0x0;this[_0xdafe('0x4')]=_0xdafe('0x2');this['registry']=_0x4c4d0b['registry']&&_0x4c4d0b[_0xdafe('0x5')][_0xdafe('0x6')](':')?_0x4c4d0b[_0xdafe('0x5')][_0xdafe('0x7')](':')[0x0]:'';this[_0xdafe('0x8')]='';this[_0xdafe('0x9')]='';this[_0xdafe('0xa')]='';this[_0xdafe('0xb')]='';this[_0xdafe('0xc')]='';this[_0xdafe('0xd')]=_0xdafe('0x2');this[_0xdafe('0xe')]='';this[_0xdafe('0xf')]='';this[_0xdafe('0x10')]=_0x4c4d0b['defaultuser']||'';}module[_0xdafe('0x11')]=Trunk; \ No newline at end of file +var _0x7114=['domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','status','registry','indexOf','split','host','port'];(function(_0x367259,_0x3eea46){var _0x5f0635=function(_0x25f179){while(--_0x25f179){_0x367259['push'](_0x367259['shift']());}};_0x5f0635(++_0x3eea46);}(_0x7114,0x96));var _0x4711=function(_0x12dcf3,_0x5ccc84){_0x12dcf3=_0x12dcf3-0x0;var _0x3ff923=_0x7114[_0x12dcf3];return _0x3ff923;};'use strict';function Trunk(_0x4ffa00){this['id']=_0x4ffa00['id']||0x0;this[_0x4711('0x0')]=_0x4ffa00[_0x4711('0x0')]||![];this[_0x4711('0x1')]=_0x4ffa00['name']||'';this[_0x4711('0x2')]=_0x4711('0x3');this['stateTime']=0x0;this[_0x4711('0x4')]=_0x4711('0x3');this[_0x4711('0x5')]=_0x4ffa00[_0x4711('0x5')]&&_0x4ffa00[_0x4711('0x5')][_0x4711('0x6')](':')?_0x4ffa00['registry'][_0x4711('0x7')](':')[0x0]:'';this[_0x4711('0x8')]='';this[_0x4711('0x9')]='';this['domain']='';this[_0x4711('0xa')]='';this[_0x4711('0xb')]='';this[_0x4711('0xc')]='unknown';this['registrationtime']='';this[_0x4711('0xd')]='';this['defaultuser']=_0x4ffa00[_0x4711('0xe')]||'';}module[_0x4711('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index acff734..612f6d6 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 _0x3064=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x4f354e,_0x2ec656){var _0x4f5af6=function(_0x218a4a){while(--_0x218a4a){_0x4f354e['push'](_0x4f354e['shift']());}};_0x4f5af6(++_0x2ec656);}(_0x3064,0x193));var _0x4306=function(_0x54c34d,_0x41aa7e){_0x54c34d=_0x54c34d-0x0;var _0x289742=_0x3064[_0x54c34d];return _0x289742;};'use strict';function voiceExtension(_0x42e9b0){this['id']=_0x42e9b0['id']||0x0;this[_0x4306('0x0')]=_0x42e9b0[_0x4306('0x0')]||'';this['recordingFormat']=_0x42e9b0[_0x4306('0x1')]||'none';this[_0x4306('0x2')]=_0x42e9b0['mandatoryDisposition']||![];}module[_0x4306('0x3')]=voiceExtension; \ No newline at end of file +var _0x568f=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x568f,0xad));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x360a71){this['id']=_0x360a71['id']||0x0;this['exten']=_0x360a71[_0xf568('0x0')]||'';this[_0xf568('0x1')]=_0x360a71['recordingFormat']||'none';this[_0xf568('0x2')]=_0x360a71['mandatoryDisposition']||![];}module[_0xf568('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5112607..379c4d8 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 _0x86f8=['dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','loggedIn','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangBusyFactor'];(function(_0x2a4e96,_0x61f358){var _0x195d41=function(_0x3d606e){while(--_0x3d606e){_0x2a4e96['push'](_0x2a4e96['shift']());}};_0x195d41(++_0x61f358);}(_0x86f8,0x169));var _0x886f=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x86f8[_0x24f326];return _0x488e2d;};'use strict';var statusDesc=[_0x886f('0x0'),_0x886f('0x1'),_0x886f('0x2'),_0x886f('0x3'),_0x886f('0x4'),_0x886f('0x5'),_0x886f('0x6'),'ringinuse',_0x886f('0x7')];var monitorFormat={'wav':_0x886f('0x8'),'wav49':_0x886f('0x9'),'gsm':_0x886f('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x886f('0xb')};function VoiceQueue(_0x26e9a7){this['id']=_0x26e9a7['id']||0x0;this[_0x886f('0xc')]=_0x26e9a7[_0x886f('0xc')]||'';this[_0x886f('0xd')]=_0x26e9a7[_0x886f('0xd')]||'';this[_0x886f('0xe')]=_0x26e9a7['type']||_0x886f('0xf');this[_0x886f('0x10')]=0x0;this[_0x886f('0x11')]=0x0;this[_0x886f('0x12')]=0x0;this['answered']=0x0;this[_0x886f('0x13')]=0x0;this[_0x886f('0x14')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x886f('0x15')]=0x0;this['available']=0x0;this['acw']=_0x26e9a7['acw']||![];this['acwTimeout']=_0x26e9a7[_0x886f('0x16')]||0xa;this['autopause']=_0x26e9a7[_0x886f('0x17')]||'no';this[_0x886f('0x18')]=!![];this[_0x886f('0x19')]='';this[_0x886f('0x1a')]=0x0;this[_0x886f('0x1b')]=0x0;this['dialTimezone']=_0x26e9a7[_0x886f('0x1c')]||null;this[_0x886f('0x1d')]=_0x26e9a7['dialGlobalInterval']?_0x26e9a7['dialGlobalInterval']:null;this[_0x886f('0x1e')]=_0x26e9a7[_0x886f('0x1e')];this[_0x886f('0x1f')]=_0x26e9a7[_0x886f('0x1f')]||_0x886f('0x20');this[_0x886f('0x21')]=_0x26e9a7[_0x886f('0x21')]||0x0;this[_0x886f('0x22')]=_0x26e9a7[_0x886f('0x22')]||0x0;this['dialPowerLevel']=_0x26e9a7[_0x886f('0x23')]||0x1;this[_0x886f('0x24')]=_0x26e9a7[_0x886f('0x24')]||_0x886f('0x25');this[_0x886f('0x26')]=_0x26e9a7[_0x886f('0x26')]||0.03;this[_0x886f('0x27')]=_0x26e9a7[_0x886f('0x27')]||0x258;this[_0x886f('0x28')]=_0x26e9a7[_0x886f('0x28')]||'anonymous';this[_0x886f('0x29')]=_0x26e9a7[_0x886f('0x29')]||_0x886f('0x2a');this[_0x886f('0x2b')]=_0x26e9a7[_0x886f('0x2b')]||0x1e;this[_0x886f('0x2c')]=_0x26e9a7[_0x886f('0x2c')]||_0x886f('0x2d');this['dialQueueTimeout']=_0x26e9a7[_0x886f('0x2e')]||0x3;this['dialQueueProject']=_0x26e9a7[_0x886f('0x2f')]||undefined;this[_0x886f('0x30')]=_0x26e9a7['dialCongestionMaxRetry']||0x3;this[_0x886f('0x31')]=_0x26e9a7[_0x886f('0x31')]||0x96;this[_0x886f('0x32')]=_0x26e9a7[_0x886f('0x32')]||0x3;this[_0x886f('0x33')]=_0x26e9a7[_0x886f('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0x26e9a7['dialNoAnswerMaxRetry']||0x3;this[_0x886f('0x34')]=_0x26e9a7[_0x886f('0x34')]||0x96;this[_0x886f('0x35')]=_0x26e9a7[_0x886f('0x35')]||0x3;this[_0x886f('0x36')]=_0x26e9a7['dialNoSuchNumberRetryFrequency']||0x96;this[_0x886f('0x37')]=_0x26e9a7['dialDropMaxRetry']||0x3;this[_0x886f('0x38')]=_0x26e9a7[_0x886f('0x38')]||0x96;this[_0x886f('0x39')]=_0x26e9a7[_0x886f('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x26e9a7[_0x886f('0x3a')]||0x96;this[_0x886f('0x3b')]=_0x26e9a7[_0x886f('0x3b')]||0x3;this[_0x886f('0x3c')]=_0x26e9a7[_0x886f('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x26e9a7[_0x886f('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x26e9a7[_0x886f('0x3e')]||0x96;this[_0x886f('0x3f')]=_0x26e9a7[_0x886f('0x3f')]||0x4;this[_0x886f('0x40')]=_0x26e9a7[_0x886f('0x40')]?_0x26e9a7[_0x886f('0x40')]:undefined;this[_0x886f('0x41')]=_0x26e9a7[_0x886f('0x41')]?_0x26e9a7[_0x886f('0x41')]:undefined;this[_0x886f('0x42')]=_0x26e9a7[_0x886f('0x42')]||undefined;this[_0x886f('0x43')]=_0x26e9a7[_0x886f('0x43')]?_0x26e9a7[_0x886f('0x43')]:undefined;this[_0x886f('0x44')]=_0x26e9a7['dialOrderByScheduledAt']||_0x886f('0x45');this[_0x886f('0x46')]=_0x26e9a7[_0x886f('0x46')]||undefined;this['dialCutDigit']=_0x26e9a7['dialCutDigit']||undefined;this[_0x886f('0x47')]=strategy[_0x26e9a7[_0x886f('0x47')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x886f('0x48')]=_0x26e9a7[_0x886f('0x48')]||![];this['dialAMDInitialSilence']=_0x26e9a7['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x26e9a7[_0x886f('0x49')];this['dialAMDAfterGreetingSilence']=_0x26e9a7[_0x886f('0x4a')];this['dialAMDTotalAnalysisTime']=_0x26e9a7[_0x886f('0x4b')];this['dialAMDMinWordLength']=_0x26e9a7[_0x886f('0x4c')];this[_0x886f('0x4d')]=_0x26e9a7[_0x886f('0x4d')];this[_0x886f('0x4e')]=_0x26e9a7[_0x886f('0x4e')];this[_0x886f('0x4f')]=_0x26e9a7[_0x886f('0x4f')];this[_0x886f('0x50')]=_0x26e9a7[_0x886f('0x50')];this[_0x886f('0x51')]=0x0;this['pTalking']=0x0;this[_0x886f('0x52')]=_0x26e9a7['timeout'];this[_0x886f('0x53')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x886f('0x54')]=0x0;this[_0x886f('0x55')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x886f('0x56')]=0x0;this[_0x886f('0x57')]=0x0;this[_0x886f('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x886f('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x886f('0x5a')]=undefined;this['startPredictive']=undefined;this[_0x886f('0x5b')]=undefined;this[_0x886f('0x5c')]=1.05;this[_0x886f('0x5d')]=0x0;this[_0x886f('0x5e')]=0x0;this[_0x886f('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x886f('0x60')]=0x0;this[_0x886f('0x61')]=0x0;this[_0x886f('0x62')]=0x0;this[_0x886f('0x63')]=0x0;this[_0x886f('0x64')]=_0x26e9a7[_0x886f('0x65')]||0x14;this[_0x886f('0x66')]=_0x26e9a7[_0x886f('0x65')]||0xa;this[_0x886f('0x67')]=0x0;this[_0x886f('0x68')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x886f('0x69')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x886f('0x6a')]=0x0;this[_0x886f('0x6b')]=_0x26e9a7[_0x886f('0x6b')]||0x1e;this['dialRecallInQueue']=_0x26e9a7[_0x886f('0x6c')]||![];this[_0x886f('0x6d')]=!!_0x26e9a7[_0x886f('0x6d')]||![];this[_0x886f('0x6e')]=!!_0x26e9a7[_0x886f('0x6e')]||![];this['dialQueueProject2']=_0x26e9a7[_0x886f('0x6f')]||undefined;this[_0x886f('0x70')]=_0x26e9a7[_0x886f('0x70')]||![];this[_0x886f('0x71')]=_0x26e9a7[_0x886f('0x71')]||![];this[_0x886f('0xd')]=monitorFormat[_0x26e9a7[_0x886f('0xd')]]?monitorFormat[_0x26e9a7[_0x886f('0xd')]]:undefined;this[_0x886f('0x72')]=_0x26e9a7['mandatoryDisposition']||![];this[_0x886f('0x73')]=_0x26e9a7[_0x886f('0x73')]?_0x26e9a7[_0x886f('0x73')]:undefined;}module[_0x886f('0x74')]=VoiceQueue; \ No newline at end of file +var _0x2a51=['loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned'];(function(_0x2cc151,_0x22ad07){var _0x4304ec=function(_0xf4f1d7){while(--_0xf4f1d7){_0x2cc151['push'](_0x2cc151['shift']());}};_0x4304ec(++_0x22ad07);}(_0x2a51,0xd5));var _0x12a5=function(_0x25d6cc,_0x28228d){_0x25d6cc=_0x25d6cc-0x0;var _0x2e8731=_0x2a51[_0x25d6cc];return _0x2e8731;};'use strict';var statusDesc=[_0x12a5('0x0'),'not_inuse','inuse',_0x12a5('0x1'),'invalid','unavailable',_0x12a5('0x2'),_0x12a5('0x3'),_0x12a5('0x4')];var monitorFormat={'wav':_0x12a5('0x5'),'wav49':_0x12a5('0x6'),'gsm':_0x12a5('0x7')};var strategy={'rrmemory':_0x12a5('0x8'),'roundrobin':_0x12a5('0x9')};function VoiceQueue(_0x30a431){this['id']=_0x30a431['id']||0x0;this['name']=_0x30a431[_0x12a5('0xa')]||'';this[_0x12a5('0xb')]=_0x30a431[_0x12a5('0xb')]||'';this[_0x12a5('0xc')]=_0x30a431[_0x12a5('0xc')]||_0x12a5('0xd');this[_0x12a5('0xe')]=0x0;this['talking']=0x0;this[_0x12a5('0xf')]=0x0;this[_0x12a5('0x10')]=0x0;this[_0x12a5('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x12a5('0x12')]=0x0;this[_0x12a5('0x13')]=0x0;this[_0x12a5('0x14')]=0x0;this[_0x12a5('0x15')]=0x0;this[_0x12a5('0x16')]=0x0;this[_0x12a5('0x17')]=_0x30a431['acw']||![];this['acwTimeout']=_0x30a431[_0x12a5('0x18')]||0xa;this['autopause']=_0x30a431[_0x12a5('0x19')]||'no';this[_0x12a5('0x1a')]=!![];this['message']='';this['originated']=0x0;this[_0x12a5('0x1b')]=0x0;this['dialTimezone']=_0x30a431['dialTimezone']||null;this[_0x12a5('0x1c')]=_0x30a431[_0x12a5('0x1c')]?_0x30a431[_0x12a5('0x1c')]:null;this['dialActive']=_0x30a431[_0x12a5('0x1d')];this[_0x12a5('0x1e')]=_0x30a431['dialMethod']||_0x12a5('0x1f');this[_0x12a5('0x20')]=_0x30a431[_0x12a5('0x20')]||0x0;this['dialLimitQueue']=_0x30a431[_0x12a5('0x21')]||0x0;this['dialPowerLevel']=_0x30a431[_0x12a5('0x22')]||0x1;this[_0x12a5('0x23')]=_0x30a431[_0x12a5('0x23')]||'dropRate';this[_0x12a5('0x24')]=_0x30a431[_0x12a5('0x24')]||0.03;this[_0x12a5('0x25')]=_0x30a431[_0x12a5('0x25')]||0x258;this[_0x12a5('0x26')]=_0x30a431[_0x12a5('0x26')]||'anonymous';this[_0x12a5('0x27')]=_0x30a431['dialOriginateCallerIdNumber']||_0x12a5('0x28');this[_0x12a5('0x29')]=_0x30a431[_0x12a5('0x29')]||0x1e;this[_0x12a5('0x2a')]=_0x30a431[_0x12a5('0x2a')]||'tTxX';this[_0x12a5('0x2b')]=_0x30a431[_0x12a5('0x2b')]||0x3;this[_0x12a5('0x2c')]=_0x30a431[_0x12a5('0x2c')]||undefined;this[_0x12a5('0x2d')]=_0x30a431[_0x12a5('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x30a431[_0x12a5('0x2e')]||0x96;this[_0x12a5('0x2f')]=_0x30a431[_0x12a5('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x30a431[_0x12a5('0x30')]||0x96;this[_0x12a5('0x31')]=_0x30a431[_0x12a5('0x31')]||0x3;this[_0x12a5('0x32')]=_0x30a431[_0x12a5('0x32')]||0x96;this[_0x12a5('0x33')]=_0x30a431['dialNoSuchNumberMaxRetry']||0x3;this[_0x12a5('0x34')]=_0x30a431[_0x12a5('0x34')]||0x96;this[_0x12a5('0x35')]=_0x30a431[_0x12a5('0x35')]||0x3;this[_0x12a5('0x36')]=_0x30a431[_0x12a5('0x36')]||0x96;this[_0x12a5('0x37')]=_0x30a431[_0x12a5('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x30a431['dialAbandonedRetryFrequency']||0x96;this[_0x12a5('0x38')]=_0x30a431['dialMachineMaxRetry']||0x3;this[_0x12a5('0x39')]=_0x30a431[_0x12a5('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x30a431['dialAgentRejectMaxRetry']||0x3;this[_0x12a5('0x3a')]=_0x30a431[_0x12a5('0x3a')]||0x96;this[_0x12a5('0x3b')]=_0x30a431['dialGlobalMaxRetry']||0x4;this[_0x12a5('0x3c')]=_0x30a431[_0x12a5('0x3c')]?_0x30a431[_0x12a5('0x3c')]:undefined;this[_0x12a5('0x3d')]=_0x30a431['TrunkBackup']?_0x30a431[_0x12a5('0x3d')]:undefined;this[_0x12a5('0x3e')]=_0x30a431[_0x12a5('0x3e')]||undefined;this[_0x12a5('0x3f')]=_0x30a431['Interval']?_0x30a431['Interval']:undefined;this['dialOrderByScheduledAt']=_0x30a431[_0x12a5('0x40')]||'DESC';this[_0x12a5('0x41')]=_0x30a431[_0x12a5('0x41')]||undefined;this[_0x12a5('0x42')]=_0x30a431[_0x12a5('0x42')]||undefined;this[_0x12a5('0x43')]=strategy[_0x30a431['strategy']]||_0x12a5('0x8');this[_0x12a5('0x44')]=!![];this[_0x12a5('0x45')]=_0x30a431[_0x12a5('0x45')]||![];this[_0x12a5('0x46')]=_0x30a431['dialAMDInitialSilence'];this[_0x12a5('0x47')]=_0x30a431[_0x12a5('0x47')];this[_0x12a5('0x48')]=_0x30a431[_0x12a5('0x48')];this[_0x12a5('0x49')]=_0x30a431[_0x12a5('0x49')];this['dialAMDMinWordLength']=_0x30a431[_0x12a5('0x4a')];this[_0x12a5('0x4b')]=_0x30a431[_0x12a5('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x30a431[_0x12a5('0x4c')];this[_0x12a5('0x4d')]=_0x30a431[_0x12a5('0x4d')];this[_0x12a5('0x4e')]=_0x30a431[_0x12a5('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x12a5('0x4f')]=0x0;this['timeout']=_0x30a431[_0x12a5('0x50')];this[_0x12a5('0x51')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x12a5('0x52')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x12a5('0x53')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x12a5('0x54')]=0x0;this[_0x12a5('0x55')]=0x0;this[_0x12a5('0x56')]=0x0;this[_0x12a5('0x57')]=0x0;this[_0x12a5('0x58')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x12a5('0x59')]=0x0;this[_0x12a5('0x5a')]=0x0;this[_0x12a5('0x5b')]=undefined;this[_0x12a5('0x5c')]=undefined;this[_0x12a5('0x5d')]=undefined;this[_0x12a5('0x5e')]=1.05;this[_0x12a5('0x5f')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x12a5('0x60')]=0x0;this[_0x12a5('0x61')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x12a5('0x62')]=0x0;this[_0x12a5('0x63')]=0x0;this[_0x12a5('0x64')]=0x0;this[_0x12a5('0x65')]=_0x30a431['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x30a431['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x12a5('0x66')]=0x0;this[_0x12a5('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x12a5('0x68')]=0x0;this[_0x12a5('0x69')]=0x0;this[_0x12a5('0x6a')]=0x0;this[_0x12a5('0x6b')]=_0x30a431[_0x12a5('0x6b')]||0x1e;this[_0x12a5('0x6c')]=_0x30a431[_0x12a5('0x6c')]||![];this[_0x12a5('0x6d')]=!!_0x30a431[_0x12a5('0x6d')]||![];this[_0x12a5('0x6e')]=!!_0x30a431[_0x12a5('0x6e')]||![];this[_0x12a5('0x6f')]=_0x30a431[_0x12a5('0x6f')]||undefined;this[_0x12a5('0x70')]=_0x30a431['dialAgiAfterHangupClient']||![];this[_0x12a5('0x71')]=_0x30a431[_0x12a5('0x71')]||![];this[_0x12a5('0xb')]=monitorFormat[_0x30a431[_0x12a5('0xb')]]?monitorFormat[_0x30a431[_0x12a5('0xb')]]:undefined;this['mandatoryDisposition']=_0x30a431[_0x12a5('0x72')]||![];this[_0x12a5('0x73')]=_0x30a431[_0x12a5('0x73')]?_0x30a431[_0x12a5('0x73')]:undefined;}module[_0x12a5('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c8757c7..88e1387 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 _0x09fa=['remoteUri','serverUrl','exports','name','username','accessKey'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x09fa,0x14d));var _0xa09f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x09fa[_0xc4001c];return _0x49f7bc;};'use strict';function VtigerAccount(_0x1e723e){this['id']=_0x1e723e['id']||0x0;this[_0xa09f('0x0')]=_0x1e723e['name']||'';this['username']=_0x1e723e[_0xa09f('0x1')]||'';this[_0xa09f('0x2')]=_0x1e723e[_0xa09f('0x2')]||'';this[_0xa09f('0x3')]=_0x1e723e[_0xa09f('0x3')]||'';this['serverUrl']=_0x1e723e[_0xa09f('0x4')]||'';this['Configurations']=_0x1e723e['Configurations']||{};}module[_0xa09f('0x5')]=VtigerAccount; \ No newline at end of file +var _0x0ebf=['exports','name','username','accessKey','serverUrl','Configurations'];(function(_0x4ee2be,_0x188b82){var _0x165535=function(_0x31a199){while(--_0x31a199){_0x4ee2be['push'](_0x4ee2be['shift']());}};_0x165535(++_0x188b82);}(_0x0ebf,0x97));var _0xf0eb=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x0ebf[_0x304b67];return _0x493afb;};'use strict';function VtigerAccount(_0x4190bd){this['id']=_0x4190bd['id']||0x0;this[_0xf0eb('0x0')]=_0x4190bd[_0xf0eb('0x0')]||'';this[_0xf0eb('0x1')]=_0x4190bd[_0xf0eb('0x1')]||'';this[_0xf0eb('0x2')]=_0x4190bd['accessKey']||'';this['remoteUri']=_0x4190bd['remoteUri']||'';this['serverUrl']=_0x4190bd[_0xf0eb('0x3')]||'';this[_0xf0eb('0x4')]=_0x4190bd[_0xf0eb('0x4')]||{};}module[_0xf0eb('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a39e4b6..9fb13ad 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 _0x6fda=['username','password','token','remoteUri','authType','type','integrationTab','Configurations','exports','name'];(function(_0x20702a,_0x54d328){var _0x4e4acb=function(_0x2ec6ad){while(--_0x2ec6ad){_0x20702a['push'](_0x20702a['shift']());}};_0x4e4acb(++_0x54d328);}(_0x6fda,0x1e9));var _0xa6fd=function(_0x586669,_0x2e5a5b){_0x586669=_0x586669-0x0;var _0x3d7296=_0x6fda[_0x586669];return _0x3d7296;};'use strict';function ZendeskAccount(_0x55c993){this['id']=_0x55c993['id']||0x0;this[_0xa6fd('0x0')]=_0x55c993[_0xa6fd('0x0')]||'';this[_0xa6fd('0x1')]=_0x55c993[_0xa6fd('0x1')]||'';this[_0xa6fd('0x2')]=_0x55c993[_0xa6fd('0x2')]||'';this[_0xa6fd('0x3')]=_0x55c993[_0xa6fd('0x3')]||'';this[_0xa6fd('0x4')]=_0x55c993[_0xa6fd('0x4')]||'';this[_0xa6fd('0x5')]=_0x55c993[_0xa6fd('0x5')]||'';this[_0xa6fd('0x6')]=_0x55c993['type']||_0xa6fd('0x7');this['serverUrl']=_0x55c993['serverUrl']||'';this[_0xa6fd('0x8')]=_0x55c993['Configurations']||{};}module[_0xa6fd('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xdeea=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','password','token'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0xdeea,0x153));var _0xadee=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xdeea[_0x422905];return _0x33dc6c;};'use strict';function ZendeskAccount(_0x28eb86){this['id']=_0x28eb86['id']||0x0;this[_0xadee('0x0')]=_0x28eb86['name']||'';this['username']=_0x28eb86['username']||'';this[_0xadee('0x1')]=_0x28eb86[_0xadee('0x1')]||'';this['token']=_0x28eb86[_0xadee('0x2')]||'';this['remoteUri']=_0x28eb86[_0xadee('0x3')]||'';this[_0xadee('0x4')]=_0x28eb86[_0xadee('0x4')]||'';this[_0xadee('0x5')]=_0x28eb86[_0xadee('0x5')]||_0xadee('0x6');this[_0xadee('0x7')]=_0x28eb86[_0xadee('0x7')]||'';this['Configurations']=_0x28eb86[_0xadee('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c595f04..bb2152b 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 _0x406f=['refreshToken','Configurations','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0x406f,0x1c4));var _0xf406=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x406f[_0x27af45];return _0x18df21;};'use strict';function ZohoAccount(_0x2bf57d){this['id']=_0x2bf57d['id']||0x0;this['name']=_0x2bf57d['name']||'';this['description']=_0x2bf57d[_0xf406('0x0')]||'';this[_0xf406('0x1')]=_0x2bf57d[_0xf406('0x1')]||'';this[_0xf406('0x2')]=_0x2bf57d[_0xf406('0x2')]||'';this[_0xf406('0x3')]=_0x2bf57d[_0xf406('0x3')]||'';this[_0xf406('0x4')]=_0x2bf57d[_0xf406('0x4')]||'';this[_0xf406('0x5')]=_0x2bf57d[_0xf406('0x5')]||'';this[_0xf406('0x6')]=_0x2bf57d['code']||'';this[_0xf406('0x7')]=_0x2bf57d[_0xf406('0x7')]||'';this[_0xf406('0x8')]=_0x2bf57d[_0xf406('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x2032=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0x1df));var _0x2203=function(_0x3c8624,_0x3d2bb1){_0x3c8624=_0x3c8624-0x0;var _0x237f5d=_0x2032[_0x3c8624];return _0x237f5d;};'use strict';function ZohoAccount(_0x298ee){this['id']=_0x298ee['id']||0x0;this[_0x2203('0x0')]=_0x298ee[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x298ee[_0x2203('0x1')]||'';this[_0x2203('0x2')]=_0x298ee[_0x2203('0x2')]||'';this[_0x2203('0x3')]=_0x298ee[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x298ee[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x298ee['clientSecret']||'';this[_0x2203('0x6')]=_0x298ee[_0x2203('0x6')]||'';this[_0x2203('0x7')]=_0x298ee[_0x2203('0x7')]||'';this[_0x2203('0x8')]=_0x298ee[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x298ee[_0x2203('0x9')]||{};}module[_0x2203('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 4b48e9c..011caf4 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 _0xa0bc=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','string','isNil','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone'];(function(_0x4437e9,_0x15035b){var _0x1614ef=function(_0x3c981f){while(--_0x3c981f){_0x4437e9['push'](_0x4437e9['shift']());}};_0x1614ef(++_0x15035b);}(_0xa0bc,0x144));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xca0b('0x0'));var _=require('lodash');var moment=require(_0xca0b('0x1'));function checkNameSurname(_0xe022bc,_0x293ef9,_0x214996){var _0x5a7c94='';if(!_['isNil'](_0x293ef9)&&_0xca0b('0x2')===typeof _0x293ef9){_0x5a7c94+=_0x293ef9;}if(!_[_0xca0b('0x3')](_0x214996)&&_0xca0b('0x2')===typeof _0x214996){_0x5a7c94+='\x20'+_0x214996;}if(_0x5a7c94!==''){return _0x5a7c94;}return _0xe022bc;}function Action(_0x2be5c8,_0x5a0a6b,_0x27c15f,_0xde24e7,_0x31a627){this[_0xca0b('0x4')]=_0x27c15f||undefined;this['idContact']=_0x2be5c8['id'];this[_0xca0b('0x5')]=_0x5a0a6b[_0xca0b('0x6')];this[_0xca0b('0x7')]=_0x5a0a6b['type'];this[_0xca0b('0x8')]=_0xca0b('0x5');this[_0xca0b('0x9')]=![];this[_0xca0b('0xa')]=_['isNil'](_0x2be5c8[_0xca0b('0xb')])?undefined:_0x2be5c8[_0xca0b('0xb')][_0xca0b('0x6')];this['channelAgent']=this[_0xca0b('0xa')]?util[_0xca0b('0xc')](_0xca0b('0xd'),this[_0xca0b('0xa')]):_0xde24e7||undefined;this[_0xca0b('0xe')]=checkNameSurname(_0x2be5c8[_0xca0b('0xf')]['phone'],_0x2be5c8['Contact']['firstName'],_0x2be5c8[_0xca0b('0xf')][_0xca0b('0x10')]);this[_0xca0b('0x11')]=_0x2be5c8[_0xca0b('0x11')]||![];this[_0xca0b('0x12')]=_0x2be5c8[_0xca0b('0xf')][_0xca0b('0x13')];this[_0xca0b('0x14')]=_0x2be5c8[_0xca0b('0x14')];this['countbusyretry']=_0x2be5c8[_0xca0b('0x15')]||0x0;this[_0xca0b('0x16')]=_0x2be5c8['countcongestionretry']||0x0;this[_0xca0b('0x17')]=_0x2be5c8[_0xca0b('0x17')]||0x0;this[_0xca0b('0x18')]=(_0x2be5c8[_0xca0b('0x15')]||0x0)+(_0x2be5c8['countcongestionretry']||0x0)+(_0x2be5c8[_0xca0b('0x17')]||0x0)+(_0x2be5c8[_0xca0b('0x19')]||0x0)+(_0x2be5c8[_0xca0b('0x1a')]||0x0)+(_0x2be5c8[_0xca0b('0x1b')]||0x0)+(_0x2be5c8[_0xca0b('0x1c')]||0x0)+(_0x2be5c8[_0xca0b('0x1d')]||0x0);this[_0xca0b('0x19')]=_0x2be5c8[_0xca0b('0x19')]||0x0;this[_0xca0b('0x1a')]=_0x2be5c8[_0xca0b('0x1a')]||0x0;this['countabandonedretry']=_0x2be5c8[_0xca0b('0x1b')]||0x0;this[_0xca0b('0x1c')]=_0x2be5c8[_0xca0b('0x1c')]||0x0;this[_0xca0b('0x1d')]=_0x2be5c8[_0xca0b('0x1d')]||0x0;this['callback']=_0x2be5c8[_0xca0b('0x1e')];this['callbackuniqueid']=_0x2be5c8['callbackuniqueid'];this[_0xca0b('0x1f')]=_0x2be5c8[_0xca0b('0x1f')];this['recallme']=_0x2be5c8[_0xca0b('0x20')];this[_0xca0b('0x21')]=_0x2be5c8['ContactId'];this['ListId']=_0x2be5c8[_0xca0b('0x22')];this[_0xca0b('0x23')]=_[_0xca0b('0x3')](_0x2be5c8['Agent'])?_0x2be5c8['UserId']:_0x2be5c8['Agent']['id'];this['VoiceQueueId']=_0x2be5c8[_0xca0b('0x24')];this['originatecalleridnum']='';this[_0xca0b('0x25')]='';}Action[_0xca0b('0x26')][_0xca0b('0x27')]=function(){return util[_0xca0b('0xc')](_0xca0b('0x28'),this['calleridname'],this[_0xca0b('0x29')]);};module[_0xca0b('0x2a')]=Action; \ No newline at end of file +var _0x8015=['lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','calleridname','number','exports','util'];(function(_0x519909,_0x266bc9){var _0x3b4c8d=function(_0x70dc0b){while(--_0x70dc0b){_0x519909['push'](_0x519909['shift']());}};_0x3b4c8d(++_0x266bc9);}(_0x8015,0xb3));var _0x5801=function(_0x3fe186,_0xe3c53e){_0x3fe186=_0x3fe186-0x0;var _0xe874c3=_0x8015[_0x3fe186];return _0xe874c3;};'use strict';var util=require(_0x5801('0x0'));var _=require(_0x5801('0x1'));var moment=require(_0x5801('0x2'));function checkNameSurname(_0x24bd9b,_0x5794ab,_0x5167db){var _0x2738f2='';if(!_['isNil'](_0x5794ab)&&_0x5801('0x3')===typeof _0x5794ab){_0x2738f2+=_0x5794ab;}if(!_[_0x5801('0x4')](_0x5167db)&&_0x5801('0x3')===typeof _0x5167db){_0x2738f2+='\x20'+_0x5167db;}if(_0x2738f2!==''){return _0x2738f2;}return _0x24bd9b;}function Action(_0x1fa5f8,_0x324465,_0xf4f384,_0x45a00d,_0x33d5f6){this[_0x5801('0x5')]=_0xf4f384||undefined;this[_0x5801('0x6')]=_0x1fa5f8['id'];this[_0x5801('0x7')]=_0x324465[_0x5801('0x8')];this['type']=_0x324465[_0x5801('0x9')];this[_0x5801('0xa')]=_0x5801('0x7');this[_0x5801('0xb')]=![];this[_0x5801('0xc')]=_[_0x5801('0x4')](_0x1fa5f8['Agent'])?undefined:_0x1fa5f8[_0x5801('0xd')][_0x5801('0x8')];this[_0x5801('0xe')]=this['membername']?util[_0x5801('0xf')](_0x5801('0x10'),this[_0x5801('0xc')]):_0x45a00d||undefined;this['calleridname']=checkNameSurname(_0x1fa5f8[_0x5801('0x11')][_0x5801('0x12')],_0x1fa5f8['Contact'][_0x5801('0x13')],_0x1fa5f8[_0x5801('0x11')][_0x5801('0x14')]);this[_0x5801('0x15')]=_0x1fa5f8['active']||![];this[_0x5801('0x16')]=_0x1fa5f8[_0x5801('0x11')][_0x5801('0x12')];this[_0x5801('0x17')]=_0x1fa5f8[_0x5801('0x17')];this['countbusyretry']=_0x1fa5f8[_0x5801('0x18')]||0x0;this[_0x5801('0x19')]=_0x1fa5f8['countcongestionretry']||0x0;this[_0x5801('0x1a')]=_0x1fa5f8['countnoanswerretry']||0x0;this[_0x5801('0x1b')]=(_0x1fa5f8[_0x5801('0x18')]||0x0)+(_0x1fa5f8[_0x5801('0x19')]||0x0)+(_0x1fa5f8[_0x5801('0x1a')]||0x0)+(_0x1fa5f8[_0x5801('0x1c')]||0x0)+(_0x1fa5f8['countdropretry']||0x0)+(_0x1fa5f8[_0x5801('0x1d')]||0x0)+(_0x1fa5f8[_0x5801('0x1e')]||0x0)+(_0x1fa5f8[_0x5801('0x1f')]||0x0);this[_0x5801('0x1c')]=_0x1fa5f8['countnosuchnumberretry']||0x0;this[_0x5801('0x20')]=_0x1fa5f8[_0x5801('0x20')]||0x0;this[_0x5801('0x1d')]=_0x1fa5f8[_0x5801('0x1d')]||0x0;this[_0x5801('0x1e')]=_0x1fa5f8[_0x5801('0x1e')]||0x0;this[_0x5801('0x1f')]=_0x1fa5f8[_0x5801('0x1f')]||0x0;this[_0x5801('0x21')]=_0x1fa5f8[_0x5801('0x21')];this[_0x5801('0x22')]=_0x1fa5f8[_0x5801('0x22')];this[_0x5801('0x23')]=_0x1fa5f8[_0x5801('0x23')];this['recallme']=_0x1fa5f8['recallme'];this[_0x5801('0x24')]=_0x1fa5f8[_0x5801('0x24')];this[_0x5801('0x25')]=_0x1fa5f8['ListId'];this['UserId']=_[_0x5801('0x4')](_0x1fa5f8[_0x5801('0xd')])?_0x1fa5f8['UserId']:_0x1fa5f8[_0x5801('0xd')]['id'];this[_0x5801('0x26')]=_0x1fa5f8[_0x5801('0x26')];this[_0x5801('0x27')]='';this[_0x5801('0x28')]='';}Action[_0x5801('0x29')]['getCaller']=function(){return util[_0x5801('0xf')]('\x22%s\x22\x20<%s>',this[_0x5801('0x2a')],this[_0x5801('0x2b')]);};module[_0x5801('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 33008cb..56b23bd 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 _0x5178=['[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','idContact','custom:agentringnoanswer','rejected','YYYY-MM-DD\x20HH:mm:ss','Answer','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','callProgressDetectingAgent','transfer','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','moment','md5','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','type','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','loopCampaigns','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','queue','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','format','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','\x20Queue','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','Action','[originated][increment]','OriginateError'];(function(_0x9a5d88,_0x4bf833){var _0x425b6a=function(_0x764563){while(--_0x764563){_0x9a5d88['push'](_0x9a5d88['shift']());}};_0x425b6a(++_0x4bf833);}(_0x5178,0x171));var _0x8517=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5178[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require(_0x8517('0x0'));var BPromise=require(_0x8517('0x1'));var uuid=require(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var md5=require(_0x8517('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x8517('0x5'))(_0x8517('0x6'));var loggerAction=require('../../../config/logger')(_0x8517('0x7'));var ami=require('../ami');var rpcDb=require(_0x8517('0x8'));var Action=require(_0x8517('0x9'));var ut=require(_0x8517('0xa'));config[_0x8517('0xb')]=_[_0x8517('0xc')](config['redis'],{'host':_0x8517('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x8517('0xe')][_0x8517('0xf')]=function(_0x4dac4d){this[_0x8517('0x10')]=this[_0x8517('0x10')]?this[_0x8517('0x10')][_0x8517('0x11')](_0x4dac4d):_0x4dac4d();};function Preview(_0x1b4fc2){this[_0x8517('0x12')]=new Sequence();this[_0x8517('0x13')]=_0x1b4fc2[_0x8517('0x14')];this['trunks']=_0x1b4fc2[_0x8517('0x15')];this[_0x8517('0x16')]={};this[_0x8517('0x17')]=_0x1b4fc2[_0x8517('0x17')];this[_0x8517('0x18')]=0x0;ami['on']('originateresponse',this[_0x8517('0x19')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x1b'),this[_0x8517('0x1c')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x1d'),this[_0x8517('0x1e')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x1f'),this[_0x8517('0x20')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x21'),this['syncNewExten'][_0x8517('0x1a')](this));ami['on'](_0x8517('0x22'),this[_0x8517('0x23')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x24'),this[_0x8517('0x25')][_0x8517('0x1a')](this));ami['on']('blindtransfer',this[_0x8517('0x26')]['bind'](this));this['loopCampaigns'](this[_0x8517('0x13')]);}function emit(_0x157bea,_0xf35d95,_0x180d8d){io['to'](_0x157bea)[_0x8517('0x27')](_0xf35d95,_0x180d8d);}function emitCampaignPreview(_0xdfde16){if(_0xdfde16['type']==='outbound'){var _0x2dd1df={'id':_0xdfde16['id'],'name':_0xdfde16[_0x8517('0x28')],'strategy':_0xdfde16[_0x8517('0x29')],'answered':_0xdfde16[_0x8517('0x2a')],'available':_0xdfde16[_0x8517('0x2b')],'loggedIn':_0xdfde16[_0x8517('0x2c')],'pTalking':_0xdfde16['pTalking'],'sumBillable':_0xdfde16[_0x8517('0x2d')],'sumDuration':_0xdfde16[_0x8517('0x2e')],'sumHoldTime':_0xdfde16['sumHoldTime']||0x0,'talking':_0xdfde16[_0x8517('0x2f')],'total':_0xdfde16[_0x8517('0x30')],'type':_0xdfde16[_0x8517('0x31')],'unmanaged':_0xdfde16['unmanaged'],'abandoned':_0xdfde16[_0x8517('0x32')],'waiting':_0xdfde16['waiting'],'loggedInDb':_0xdfde16[_0x8517('0x33')],'dialActive':_0xdfde16[_0x8517('0x34')],'dialMethod':_0xdfde16[_0x8517('0x35')],'dialOriginateCallerIdName':_0xdfde16[_0x8517('0x36')],'dialOriginateCallerIdNumber':_0xdfde16[_0x8517('0x37')],'dialOriginateTimeout':_0xdfde16[_0x8517('0x38')],'dialPrefix':_0xdfde16['dialPrefix'],'outboundAnswerAgiCallsDay':_0xdfde16[_0x8517('0x39')],'outboundAnswerCallsDay':_0xdfde16['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xdfde16[_0x8517('0x3a')],'outboundBusyCallsDay':_0xdfde16[_0x8517('0x3b')],'outboundCongestionCallsDay':_0xdfde16[_0x8517('0x3c')],'outboundDropCallsDayACS':_0xdfde16[_0x8517('0x3d')],'outboundDropCallsDayCallersExit':_0xdfde16[_0x8517('0x3e')],'outboundDropCallsDayTimeout':_0xdfde16[_0x8517('0x3f')],'outboundNoAnswerCallsDay':_0xdfde16['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xdfde16[_0x8517('0x40')],'outboundOriginateFailureCallsDay':_0xdfde16['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xdfde16[_0x8517('0x41')],'outboundRejectCallsDay':_0xdfde16[_0x8517('0x42')],'outboundUnknownCallsDay':_0xdfde16[_0x8517('0x43')],'outboundAbandonedCallsDay':_0xdfde16[_0x8517('0x44')],'predictiveIntervalAnsweredCalls':_0xdfde16[_0x8517('0x45')],'predictiveIntervalAvgHoldtime':_0xdfde16[_0x8517('0x46')],'predictiveIntervalAvgTalktime':_0xdfde16[_0x8517('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0xdfde16[_0x8517('0x48')],'predictiveIntervalDroppedCallsTimeout':_0xdfde16[_0x8517('0x49')],'predictiveIntervalErlangCalls':_0xdfde16['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xdfde16[_0x8517('0x4a')],'predictiveIntervalHitRate':_0xdfde16[_0x8517('0x4b')],'predictiveIntervalMultiplicativeFactor':_0xdfde16[_0x8517('0x4c')],'predictiveIntervalPauses':_0xdfde16['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xdfde16['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xdfde16['predictiveIntervalTotalCalls'],'message':_0xdfde16[_0x8517('0x4d')],'originated':_0xdfde16[_0x8517('0x4e')],'erlangCalls':_0xdfde16[_0x8517('0x4f')],'erlangCallToSecond':_0xdfde16[_0x8517('0x50')],'erlangAbandonmentRate':_0xdfde16[_0x8517('0x51')],'erlangBusyFactor':_0xdfde16[_0x8517('0x52')],'startPredictive':_0xdfde16['startPredictive'],'startProgressive':_0xdfde16[_0x8517('0x53')]};if(_0xdfde16[_0x8517('0x54')]){_0x2dd1df[_0x8517('0x54')]={'id':_0xdfde16['Trunk']['id'],'name':_0xdfde16[_0x8517('0x54')]['name'],'active':_0xdfde16[_0x8517('0x54')][_0x8517('0x55')],'callerid':_0xdfde16['Trunk']['callerid']};}if(_0xdfde16[_0x8517('0x56')]){_0x2dd1df[_0x8517('0x56')]={'id':_0xdfde16[_0x8517('0x56')]['id'],'name':_0xdfde16[_0x8517('0x56')]['name']};}var _0x5b1d34=md5(JSON[_0x8517('0x57')](_0x2dd1df));if(_0xdfde16[_0x8517('0x4')]!==_0x5b1d34){_0xdfde16[_0x8517('0x4')]=_0x5b1d34;emit(util['format'](_0x8517('0x58'),_0x2dd1df[_0x8517('0x28')]),'voice_queue:save',_0x2dd1df);}}}function emitVoiceQueueChannelRemove(_0x209235){logger[_0x8517('0x59')](_0x8517('0x5a'),JSON[_0x8517('0x57')](_0x209235));emit(util['format'](_0x8517('0x58'),_0x209235[_0x8517('0x28')]),_0x8517('0x5b'),_0x209235);io[_0x8517('0x27')](_0x8517('0x5c'),_0x209235);}function notSendMessagesQueue(_0x22592a){if(_0x22592a[_0x8517('0x5d')]){if(_0x22592a[_0x8517('0x4e')]===0x0&&_0x22592a[_0x8517('0x5e')]===0x0){_0x22592a[_0x8517('0x5d')]=![];_0x22592a[_0x8517('0x2b')]=0x0;_0x22592a[_0x8517('0x5f')]=0x0;_0x22592a[_0x8517('0x4d')]='NOT_ACTIVE';ut['logger'](_0x8517('0x60'),_0x22592a[_0x8517('0x28')]+_0x8517('0x61'));}else{_0x22592a[_0x8517('0x4d')]=_0x8517('0x62');ut['logger'](_0x8517('0x60'),_0x22592a[_0x8517('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x22592a);}}Preview[_0x8517('0xe')][_0x8517('0x63')]=function(){var _0x32fba6=this;setInterval(function(){_0x32fba6[_0x8517('0x64')]();},0x7cf);};Preview['prototype'][_0x8517('0x64')]=function(){var _0x24034f=this['campaignsPreview'];this[_0x8517('0x18')]+=0x1;for(var _0x275960 in _0x24034f){if(_0x24034f[_0x8517('0x65')](_0x275960)&&(_0x24034f[_0x275960]['dialMethod']===_0x8517('0x6')||_0x24034f[_0x275960][_0x8517('0x35')]===_0x8517('0x66'))&&_0x24034f[_0x275960][_0x8517('0x31')]===_0x8517('0x67')){if(this[_0x8517('0x18')]>0x7){this[_0x8517('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x24034f[_0x8517('0x65')](_0x275960)&&_0x24034f[_0x275960][_0x8517('0x35')]==='preview'&&_0x24034f[_0x275960][_0x8517('0x31')]===_0x8517('0x67')){if(_0x24034f[_0x275960][_0x8517('0x34')]){this[_0x8517('0x68')](_0x24034f[_0x275960]);if(_0x24034f[_0x275960][_0x8517('0x69')])this[_0x8517('0x6a')](_0x24034f[_0x275960]);}else{notSendMessagesQueue(_0x24034f[_0x275960]);}}}};Preview['prototype'][_0x8517('0x6b')]=function(_0x10c07a){var _0x3a9778=this;this['sequence'][_0x8517('0xf')](function(){if(!_[_0x8517('0x6c')](_0x3a9778['actions'][_0x10c07a])){loggerAction[_0x8517('0x59')](_0x8517('0x6d'),_0x10c07a,'Queue',_0x3a9778['actions'][_0x10c07a]['queue'],_0x8517('0x6e'),JSON[_0x8517('0x57')](_0x3a9778['campaignsPreview'][_0x3a9778[_0x8517('0x16')][_0x10c07a]['queue']]['originated']),_0x8517('0x6f'),JSON[_0x8517('0x57')](_0x3a9778[_0x8517('0x13')][_0x3a9778[_0x8517('0x16')][_0x10c07a]['queue']][_0x8517('0x5e')]),JSON[_0x8517('0x57')](_0x3a9778[_0x8517('0x16')][_0x10c07a]['dialAnswer']),JSON[_0x8517('0x57')](_[_0x8517('0x70')](_0x3a9778[_0x8517('0x16')][_0x10c07a],[_0x8517('0x71'),_0x8517('0x72'),_0x8517('0x73'),_0x8517('0x74')])));return ami['Action']({'action':_0x8517('0x75'),'channel':_0x3a9778['actions'][_0x10c07a]['channel']})[_0x8517('0x76')](function(_0x776ee2){if(_0x776ee2[_0x8517('0x4d')]===_0x8517('0x77')){setTimeout(function(){if(_0x3a9778['actions'][_0x10c07a]){ut[_0x8517('0x78')](_0x3a9778[_0x8517('0x13')][_0x3a9778['actions'][_0x10c07a]['queue']],_0x8517('0x79'));if(_0x3a9778[_0x8517('0x16')][_0x10c07a][_0x8517('0x7a')]===!![]){ut['decrementTalkink'](_0x3a9778[_0x8517('0x13')][_0x3a9778['actions'][_0x10c07a][_0x8517('0x7b')]],_0x8517('0x79'));ut[_0x8517('0x7c')](_0x8517('0x7d')+_0x10c07a,_0x3a9778[_0x8517('0x16')][_0x10c07a][_0x8517('0x7b')]);}ut[_0x8517('0x7c')](_0x8517('0x7e')+_0x10c07a,_0x3a9778[_0x8517('0x16')][_0x10c07a]['queue']);delete _0x3a9778['actions'][_0x10c07a];}},0x2328);}});}});};Preview[_0x8517('0xe')][_0x8517('0x7f')]=function(){var _0x260aa9=this;loggerAction['info'](_0x8517('0x80'),_[_0x8517('0x81')](this[_0x8517('0x16')]));for(var _0x4cc9e2 in this['actions']){if(_0x260aa9[_0x8517('0x16')][_0x8517('0x65')](_0x4cc9e2)){_0x260aa9[_0x8517('0x6b')](_0x4cc9e2);}}};Preview[_0x8517('0xe')][_0x8517('0x6a')]=function(_0x3be6db){var _0x3d8773=this;rpcDb[_0x8517('0x82')](_0x3be6db['id'],ut[_0x8517('0x83')](this[_0x8517('0x17')]))[_0x8517('0x84')](function(_0x3c5462){if(!_[_0x8517('0x6c')](_0x3c5462)){for(var _0x20dc60=0x0;_0x20dc60<_0x3c5462[_0x8517('0x85')];_0x20dc60+=0x1){if(ut[_0x8517('0x86')](_0x3c5462[_0x20dc60]['scheduledat'])<_0x3be6db[_0x8517('0x87')]*0x3c){if(_0x3c5462[_0x20dc60][_0x8517('0x88')]&&!_0x3c5462[_0x20dc60][_0x8517('0x88')][_0x8517('0x89')]){_0x3d8773[_0x8517('0x8a')](_0x3c5462[_0x20dc60]['id'])[_0x8517('0x84')](ut[_0x8517('0x8b')]('[RecallMe]'))[_0x8517('0x76')](ut[_0x8517('0x8b')](_0x8517('0x8c')));}else{rpcDb[_0x8517('0x8d')](_0x3c5462[_0x20dc60]['id']);}}else{var _0x4240d0=new Action(_0x3c5462[_0x20dc60],_0x3be6db);_0x4240d0['starttime']=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3be6db[_0x8517('0x41')]+=0x1;ut[_0x8517('0x8f')](_0x4240d0,0x17,_0x8517('0x90'));if(_0x3be6db[_0x8517('0x91')]){rpcDb[_0x8517('0x92')](ut['createBody'](_0x3c5462[_0x20dc60]));rpcDb[_0x8517('0x93')](_0x4240d0,_0x8517('0x94'));}else{ut[_0x8517('0x8f')](_0x4240d0,0x16,_0x8517('0x95'));rpcDb['createCustomerHistory'](_0x4240d0,'[HistoryRecallClose]');rpcDb[_0x8517('0x96')](_0x4240d0,'[HistoryRecallClose]');}}}}})[_0x8517('0x76')](ut[_0x8517('0x8b')]('[getContactRecallMe]'));};Preview[_0x8517('0xe')][_0x8517('0x68')]=function(_0x4a483d){_0x4a483d[_0x8517('0x5d')]=!![];if(ut[_0x8517('0x97')](_0x4a483d[_0x8517('0x2c')])){_0x4a483d[_0x8517('0x4d')]=_0x8517('0x98');}else if(!ut[_0x8517('0x99')](_0x4a483d[_0x8517('0x34')])){_0x4a483d[_0x8517('0x4d')]='NOT_ACTIVE';}else if(!this[_0x8517('0x9a')](_0x4a483d[_0x8517('0x54')])){if(!this[_0x8517('0x9a')](_0x4a483d[_0x8517('0x9b')])){_0x4a483d['message']=_0x8517('0x9c');}else{_0x4a483d['message']=_0x8517('0x9d');}}else{_0x4a483d[_0x8517('0x4d')]=_0x8517('0x9d');}emitCampaignPreview(_0x4a483d);};Preview[_0x8517('0xe')]['callProgressDetectingCustomer']=function(_0x56d267,_0x23be4d,_0x1f1984){var _0x462c1c=this;var _0x548fa1=this['actions'][_0x23be4d];var _0x11a801=this[_0x8517('0x13')][_0x548fa1[_0x8517('0x7b')]];var _0x197a30;if(_0x11a801){switch(_0x1f1984){case'1':_0x11a801[_0x8517('0x40')]+=0x1;_0x548fa1[_0x8517('0x9e')]+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x0,_0x8517('0xa1'));ami['emit'](_0x8517('0xa2'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xa4')));rpcDb['createCustomerHistory'](_0x548fa1,_0x8517('0xa5'));if(ut['totalGlobal'](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,'Global');rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xa8'));}else{if(_0x548fa1[_0x8517('0x9e')]>=_0x11a801[_0x8517('0xa9')]){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0x8517('0xaa')](_0x548fa1,'countnosuchnumberretry',_0x11a801[_0x8517('0xab')]),_0x548fa1[_0x8517('0xac')],_0x548fa1[_0x8517('0xad')]);}}delete this[_0x8517('0x16')][_0x56d267['linkedid']];break;case _0x8517('0xae'):var _0x670690=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x548fa1[_0x8517('0xaf')]=_0x670690;_0x548fa1[_0x8517('0xb0')]=_0x670690;_0x548fa1[_0x8517('0x7a')]=!![];_0x11a801[_0x8517('0x5e')]+=0x1;logger[_0x8517('0x59')](_0x8517('0xb1'),_0x548fa1[_0x8517('0xb2')],'\x20Queue',_0x11a801[_0x8517('0x28')],'pTalking:\x20',_0x11a801['pTalking']);ami[_0x8517('0x27')](_0x8517('0xb3'),ut[_0x8517('0xa3')](_0x548fa1,'connect',this[_0x8517('0x13')][_0x548fa1[_0x8517('0x7b')]]));if(_0x11a801['acw']){ami[_0x8517('0x27')]('custom:agentConnectPreview',ut['buildAcw'](_0x548fa1));}break;case'16':ami[_0x8517('0x27')](_0x8517('0xb4'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xb5'),this[_0x8517('0x13')][_0x548fa1['queue']]));emitVoiceQueueChannelRemove(ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xb5')));_0x11a801['outboundAnswerCallsDay']+=0x1;_0x11a801['total']+=0x1;_0x11a801[_0x8517('0x2a')]+=0x1;ut[_0x8517('0xb6')](_0x11a801,_0x8517('0xb7'));_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x4,'Answer');rpcDb['createCustomerHistory'](_0x548fa1,_0x8517('0xb8'));rpcDb[_0x8517('0x96')](_0x548fa1,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8517('0xb9')](_0x548fa1);_0x11a801[_0x8517('0x2e')]+=_0x548fa1['talktime'];_0x11a801[_0x8517('0x2d')]+=_0x548fa1[_0x8517('0xba')];logger[_0x8517('0x59')]('[syncHangup][talking][decrement]',_0x548fa1['uniqueid'],_0x8517('0xbb'),_0x11a801[_0x8517('0x28')],_0x8517('0x6f'),_0x11a801[_0x8517('0x5e')]);delete this[_0x8517('0x16')][_0x56d267['linkedid']];break;case _0x8517('0xbc'):_0x11a801[_0x8517('0x3b')]+=0x1;_0x548fa1['countbusyretry']+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x5,_0x8517('0xbd'));ami[_0x8517('0x27')](_0x8517('0xbe'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xbf')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xc0'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xc2'));}else{if(_0x548fa1[_0x8517('0xc3')]>=_0x11a801[_0x8517('0xc4')]){rpcDb[_0x8517('0x96')](_0x548fa1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8517('0xc5')](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xc3'),_0x11a801[_0x8517('0xc6')]),_0x548fa1[_0x8517('0xac')],_0x548fa1[_0x8517('0xad')]);}}break;case _0x8517('0xc7'):_0x11a801['outboundNoAnswerCallsDay']+=0x1;_0x548fa1[_0x8517('0xc8')]+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x3,_0x8517('0xc9'));ami[_0x8517('0x27')]('custom:agentnoanswer',ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xca')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xcb'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xcc'));}else{if(_0x548fa1['countnoanswerretry']>=_0x11a801[_0x8517('0xcd')]){rpcDb['createCustomerFinal'](_0x548fa1,_0x8517('0xcb'));}else{rpcDb[_0x8517('0xc5')](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xc8'),_0x11a801[_0x8517('0xce')]),_0x548fa1[_0x8517('0xac')],_0x548fa1[_0x8517('0xad')]);}}break;case _0x8517('0xcf'):_0x11a801[_0x8517('0x3c')]+=0x1;_0x548fa1['countcongestionretry']+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x8,_0x8517('0xd0'));ami['emit'](_0x8517('0xd1'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xd2')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xd3'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xd4'));}else{if(_0x548fa1[_0x8517('0xd5')]>=_0x11a801['dialCongestionMaxRetry']){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xd3'));}else{rpcDb['rescheduleContact'](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xd5'),_0x11a801['dialBusyRetryFrequency']),_0x548fa1['unlockAgent'],_0x548fa1['activeContact']);}}break;case _0x8517('0xd6'):_0x11a801['outboundRejectCallsDay']+=0x1;_0x548fa1[_0x8517('0xd7')]+=0x1;_0x548fa1['countglobal']=ut[_0x8517('0xa0')](_0x548fa1);ut['logCustomer'](_0x548fa1,0x14,_0x8517('0xd8'));ami['emit'](_0x8517('0xd9'),ut[_0x8517('0xa3')](_0x548fa1,'agentreject'));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xda'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x197a30,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x548fa1[_0x8517('0xd7')]>=_0x11a801[_0x8517('0xdb')]){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xdc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x548fa1,_0x8517('0xd7'),_0x11a801[_0x8517('0xdd')]),_0x548fa1['unlockAgent'],_0x548fa1[_0x8517('0xad')]);}}break;case _0x8517('0xde'):_0x11a801[_0x8517('0x44')]+=0x1;_0x548fa1[_0x8517('0xdf')]+=0x1;_0x548fa1['countglobal']=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0xb,_0x8517('0xe0'));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xe1'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xe1'));}else{if(_0x548fa1[_0x8517('0xe2')]>=_0x11a801['dialAbandonedMaxRety']){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xe1'));}else{rpcDb['rescheduleContact'](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xdf'),_0x11a801[_0x8517('0xe3')]),_0x548fa1['unlockAgent'],_0x548fa1[_0x8517('0xad')]);}}break;case'18':_0x11a801['outboundUnknownCallsDay']+=0x1;_0x548fa1[_0x8517('0xe4')]+=0x1;_0x548fa1['countglobal']=ut['totalGlobal'](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x12,_0x56d267[_0x8517('0xe5')]||_0x56d267[_0x8517('0xe6')]);ami[_0x8517('0x27')](_0x8517('0xe7'),ut['buildObj'](_0x548fa1,_0x8517('0xe8')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xe9'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut['cloneAction'](_0x548fa1,0xf,'Global');rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xe9'));}else{rpcDb[_0x8517('0x96')](_0x548fa1,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x8517('0x16')][_0x56d267[_0x8517('0xea')]];break;case'19':_0x11a801['outboundUnknownCallsDay']+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut['logCustomer'](_0x548fa1,0x13,_0x56d267['cause-txt']||_0x56d267[_0x8517('0xe6')]);ami['emit']('custom:amd',ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xe8')));rpcDb['createCustomerHistory'](_0x548fa1,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut['cloneAction'](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xeb'));}else{rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xeb'));}delete this['actions'][_0x56d267['linkedid']];break;default:if(_0x548fa1[_0x8517('0x7a')]){ut[_0x8517('0xb6')](_0x11a801,_0x8517('0xec'));ut[_0x8517('0x7c')](_0x8517('0xed')+_0x11a801[_0x8517('0x28')],_0x56d267);}_0x11a801[_0x8517('0x43')]+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0xc,_0x56d267[_0x8517('0xe5')]||_0x56d267[_0x8517('0xe6')]);rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xee'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb['createCustomerFinal'](_0x197a30,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xef'));}delete this[_0x8517('0x16')][_0x56d267['linkedid']];}if(!(_0x548fa1[_0x8517('0x7a')]&&_0x1f1984==='16')){ut[_0x8517('0x78')](_0x11a801,'[callProgressDetectingCustomer]');logger[_0x8517('0x59')]('[originated][decrement][callProgressDetectingCustomer]',_0x548fa1['uniqueid'],_0x8517('0xbb'),_0x11a801['name'],'originated:\x20',_0x11a801['originated']);}if(_0x1f1984!==_0x8517('0xae')){delete this[_0x8517('0x16')][_0x56d267[_0x8517('0xea')]];delete this[_0x8517('0x16')][_0x56d267[_0x8517('0xf0')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x547651,_0x25c45d,_0x2e8859){if(_[_0x8517('0xf1')](_0x25c45d)&&_0x8517('0xf2')!==typeof _0x25c45d){return;}if(_['isUndefined'](_0x2e8859)&&_0x8517('0xf2')!==typeof _0x2e8859){return;}switch(_0x2e8859[_0x8517('0xf3')]){case'0':ut[_0x8517('0xf4')](_0x547651,0x0,_0x8517('0xa1'));rpcDb['createAgentHistory'](_0x547651,_0x8517('0xf5'));break;case'3':ut[_0x8517('0xf4')](_0x547651,0x3,_0x8517('0xc9'));rpcDb['createAgentHistory'](_0x547651,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x547651,0x5,_0x8517('0xbd'));rpcDb[_0x8517('0xf6')](_0x547651,_0x8517('0xf7'));break;case'8':ut['logAgent'](_0x547651,0x8,'Congestion');rpcDb['createAgentHistory'](_0x547651,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8517('0xf4')](_0x547651,0x16,_0x8517('0xf8'));rpcDb[_0x8517('0xf6')](_0x547651,_0x8517('0xf9'));break;default:ut[_0x8517('0xf4')](_0x547651,0xc,_0x2e8859[_0x8517('0xf3')]);rpcDb[_0x8517('0xf6')](_0x547651,_0x8517('0xfa'));}ut['updateOriginated'](_0x25c45d,_0x8517('0xfb'));logger[_0x8517('0x59')](_0x8517('0xfc'),_0x547651['uniqueid'],_0x8517('0xbb'),_0x25c45d[_0x8517('0x28')],'originated:\x20',_0x25c45d[_0x8517('0x4e')]);delete this[_0x8517('0x16')][_0x547651[_0x8517('0xb2')]];};Preview[_0x8517('0xe')][_0x8517('0xfd')]=function(_0x3784cc,_0x283f38,_0x2093e8,_0x3059a,_0x37b066){var _0x410651=this;return new BPromise(function(_0x194c1d,_0x41d647){if(_[_0x8517('0x6c')](_0x283f38)||_[_0x8517('0x6c')](_0x283f38['Contact'])||_[_0x8517('0x6c')](_0x283f38['Contact'][_0x8517('0xfe')])||_[_0x8517('0x6c')](_0x283f38[_0x8517('0x73')])){_0x41d647(ut[_0x8517('0x4d')](_0x8517('0xff'),_0x3059a,_0x37b066));return;}var _0xd8e716=uuid['v4']();var _0x4289e2=_0x410651[_0x8517('0x13')][_0x283f38[_0x8517('0x100')]['name']];var _0x5b591e=_0x2093e8?_0x410651['agents'][_0x2093e8]['id']:undefined;_0x410651[_0x8517('0x16')][_0xd8e716]=new Action(_0x283f38,_0x4289e2,_0xd8e716,_0x2093e8,_0x5b591e);var _0x16ebfb=_0x410651[_0x8517('0x16')][_0xd8e716];_0x16ebfb[_0x8517('0xac')]=_0x3059a;_0x16ebfb[_0x8517('0xad')]=_0x37b066;_0x16ebfb[_0x8517('0x101')]=_0x2093e8;if(_['isEmpty'](_0x3784cc)){_0x410651[_0x8517('0x102')](_0x16ebfb,_0x4289e2,_0x283f38,_0x2093e8)['then'](function(_0xbb4eaa){logger['info']('[Preview][execCall][success]',_0x8517('0x103')+_0x16ebfb[_0x8517('0x7b')]+_0x8517('0x104')+_0x16ebfb['idContact'],JSON[_0x8517('0x57')](_0xbb4eaa));ami['emit'](_0x8517('0x105'),ut['buildObj'](_0x16ebfb,_0x8517('0x106'),_0x410651[_0x8517('0x13')][_0x16ebfb['queue']]));_0x194c1d(ut['message']('Calling'));})[_0x8517('0x76')](function(_0x55348c){ut[_0x8517('0x107')](_0x8517('0x108'),_0x55348c);_0x41d647(ut[_0x8517('0x4d')](_0x8517('0x109'),_0x3059a,_0x37b066));});}else{_0x4289e2[_0x8517('0x3a')]+=0x1;ut[_0x8517('0x10a')](_0x16ebfb);rpcDb['createHistory'](_0x16ebfb,_0x8517('0x10b'));delete _0x410651[_0x8517('0x16')][_0xd8e716];_0x41d647(ut[_0x8517('0x4d')]('Contact\x20in\x20black\x20List',_0x3059a,_0x37b066));}});};Preview[_0x8517('0xe')][_0x8517('0x9a')]=function(_0xf83d16){return!_[_0x8517('0x6c')](_0xf83d16)&&!_['isNil'](_0xf83d16[_0x8517('0x28')])&&!_[_0x8517('0x6c')](_0xf83d16[_0x8517('0x55')])&&_0xf83d16[_0x8517('0x55')]&&!_[_0x8517('0x6c')](this['trunks'][util['format'](_0x8517('0x10c'),_0xf83d16['name'])])&&!_[_0x8517('0x6c')](this[_0x8517('0x15')][util[_0x8517('0x8e')](_0x8517('0x10c'),_0xf83d16[_0x8517('0x28')])][_0x8517('0x75')])&&(this[_0x8517('0x15')][util[_0x8517('0x8e')](_0x8517('0x10c'),_0xf83d16[_0x8517('0x28')])]['status']===_0x8517('0x10d')||this[_0x8517('0x15')][util['format'](_0x8517('0x10c'),_0xf83d16[_0x8517('0x28')])]['status']==='unmonitored');};Preview[_0x8517('0xe')][_0x8517('0x8a')]=function(_0x55fe4e,_0x44395a){var _0xa21a56=this;return new BPromise(function(_0x1d5f5e,_0x3a6b52){_0xa21a56[_0x8517('0x10e')](_0x55fe4e,_0x44395a)[_0x8517('0x84')](function(_0x1e71ba){_0x1d5f5e(_['pick'](_0x1e71ba,[_0x8517('0x4d')]));})[_0x8517('0x76')](function(_0x48c790){if(_0x48c790[_0x8517('0x10f')]){rpcDb[_0x8517('0x110')](_0x55fe4e);}if(_0x48c790[_0x8517('0x55')]){rpcDb[_0x8517('0x8d')](_0x55fe4e);}_0x3a6b52(_[_0x8517('0x70')](_0x48c790,[_0x8517('0x4d')]));});});};Preview[_0x8517('0xe')][_0x8517('0x10e')]=function(_0xc35223,_0x29499b){var _0x49ab5a=this;return new BPromise(function(_0x1d347e,_0x4ea202){var _0x5d2ef6,_0x1df5c8;rpcDb[_0x8517('0x111')](_0xc35223)[_0x8517('0x84')](function(_0x4602b2){if(!_[_0x8517('0x6c')](_0x4602b2[0x0])){_0x1df5c8=_0x4602b2[0x0][_0x8517('0x112')]?![]:!![];_0x5d2ef6=_0x4602b2[0x0][_0x8517('0x112')]?!![]:![];_0x5d2ef6=_0x29499b?!![]:_0x5d2ef6;}var _0x59aa36=_0x49ab5a['validateContact'](_0x4602b2);if(_0x59aa36[_0x8517('0x113')]){rpcDb[_0x8517('0x114')](_[_0x8517('0x70')](_0x4602b2[0x0],[_0x8517('0x73'),'Contact.phone']))['then'](function(_0x29844e){_0x49ab5a[_0x8517('0xfd')](_0x29844e,_0x4602b2[0x0],_0x29499b,_0x1df5c8,_0x5d2ef6)[_0x8517('0x84')](function(_0x5ac4c1){_0x1d347e(_0x5ac4c1);})[_0x8517('0x76')](function(_0x1a7d79){_0x4ea202(_0x1a7d79);});})[_0x8517('0x76')](function(_0x612f42){ut[_0x8517('0x107')](_0x8517('0x115'),_0x612f42);_0x4ea202(ut['message']('Call\x20unsuccessful',_0x1df5c8,_0x5d2ef6));});}else{_0x4ea202(ut['message'](_0x59aa36[_0x8517('0x4d')],_0x1df5c8,_0x5d2ef6));}})[_0x8517('0x76')](function(_0xb9db8f){ut[_0x8517('0x107')]('[Preview][getContactPreview]',_0xb9db8f);_0x4ea202(ut[_0x8517('0x4d')](_0x8517('0x116'),![],!![]));});});};Preview[_0x8517('0xe')]['validateContact']=function(_0x217924){if(_[_0x8517('0x6c')](_0x217924)||_[_0x8517('0x117')](_0x217924)||!_[_0x8517('0x6c')](_0x217924[0x0]['Agent'])&&_['isNil'](_0x217924[0x0]['Agent']['name'])){ut[_0x8517('0x107')]('[Preview][validateContact][Empty\x20Contact]',_0x217924);return{'isValid':![],'message':_0x8517('0x118')};}var _0x5af9cb=this['campaignsPreview'][_0x217924[0x0]['Queue']['name']];_0x5af9cb[_0x8517('0x4d')]=_0x8517('0x9d');if(_[_0x8517('0x6c')](_0x5af9cb)){ut[_0x8517('0x107')](_0x8517('0x119'),_0x5af9cb);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x8517('0x9a')](_0x5af9cb[_0x8517('0x54')])){ut[_0x8517('0x107')](_0x8517('0x11a'),_0x8517('0x11b')+_0x5af9cb[_0x8517('0x28')]+_0x8517('0x11c'));if(!this[_0x8517('0x9a')](_0x5af9cb[_0x8517('0x9b')])){ut[_0x8517('0x107')](_0x8517('0x11a'),_0x5af9cb['name']+_0x8517('0x11d'));return{'isValid':![],'message':_0x8517('0x11e')};}}if(!ut[_0x8517('0x99')](_0x5af9cb[_0x8517('0x34')])){ut[_0x8517('0x107')](_0x8517('0x11f'),_0x5af9cb[_0x8517('0x28')]+_0x8517('0x120'));return{'isValid':![],'message':_0x8517('0x11b')+_0x5af9cb[_0x8517('0x28')]+_0x8517('0x120')};}return{'isValid':!![],'message':_0x8517('0x121')};};Preview[_0x8517('0xe')][_0x8517('0x102')]=function(_0x5d74d4,_0x1e3c84,_0x15256c,_0x2ad6f7){var _0x3535e3=this;return new BPromise(function(_0x4f03be,_0x5a1c63){var _0x3fbfe0=_0x5d74d4[_0x8517('0xb2')];var _0x5a1f7d=_0x3535e3[_0x8517('0x9a')](_0x1e3c84[_0x8517('0x54')])?util['format'](_0x8517('0x122'),_0x1e3c84['Trunk']['name'],_[_0x8517('0x6c')](_0x1e3c84[_0x8517('0x123')])?'':_0x1e3c84[_0x8517('0x123')]['trim']()||'',_0x1e3c84[_0x8517('0x124')]>0x0?_0x15256c[_0x8517('0x125')][_0x8517('0xfe')][_0x8517('0x126')](_0x1e3c84[_0x8517('0x124')]):_0x15256c[_0x8517('0x125')][_0x8517('0xfe')]):util[_0x8517('0x8e')](_0x8517('0x122'),_[_0x8517('0x6c')](_0x1e3c84[_0x8517('0x9b')])?_0x1e3c84['Trunk']['name']:_0x1e3c84['TrunkBackup']['name'],_['isNil'](_0x1e3c84['dialPrefix'])?'':_0x1e3c84[_0x8517('0x123')][_0x8517('0x127')]()||'',_0x1e3c84[_0x8517('0x124')]>0x0?_0x15256c[_0x8517('0x125')][_0x8517('0xfe')][_0x8517('0x126')](_0x1e3c84[_0x8517('0x124')]):_0x15256c['Contact'][_0x8517('0xfe')]);var _0x209801=_0x3535e3[_0x8517('0x9a')](_0x1e3c84[_0x8517('0x54')])?ut[_0x8517('0x128')](_0x1e3c84[_0x8517('0x54')][_0x8517('0x129')],_0x1e3c84[_0x8517('0x36')],_0x1e3c84[_0x8517('0x12a')]>0x0?ut[_0x8517('0x12b')](_0x1e3c84['dialOriginateCallerIdNumber'],_0x1e3c84[_0x8517('0x12a')]):_0x1e3c84['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x8517('0x6c')](_0x1e3c84[_0x8517('0x9b')])?_0x1e3c84['Trunk'][_0x8517('0x129')]:_0x1e3c84['TrunkBackup']['callerid'],_0x1e3c84[_0x8517('0x36')],_0x1e3c84[_0x8517('0x12a')]>0x0?ut[_0x8517('0x12b')](_0x1e3c84[_0x8517('0x37')],_0x1e3c84[_0x8517('0x12a')]):_0x1e3c84['dialOriginateCallerIdNumber']);if(_0x209801){_0x5d74d4[_0x8517('0x12c')]=ut[_0x8517('0x12d')](_0x209801);_0x5d74d4[_0x8517('0x12e')]=ut[_0x8517('0x12f')](_0x209801);}var _0x23d64b=ut[_0x8517('0x130')](_0x1e3c84,_0x15256c,_0x5a1f7d,_0x209801,_0x3fbfe0,_0x5d74d4);_[_0x8517('0x131')](_0x5d74d4,ut[_0x8517('0x132')](_0x23d64b));_0x5d74d4[_0x8517('0x133')]=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x8517('0x134')](ut['variablesAction'](_0x5d74d4,_0x1e3c84,_0x23d64b,_0x5d74d4[_0x8517('0xad')],_0x2ad6f7))[_0x8517('0x84')](function(_0x488062){_0x1e3c84[_0x8517('0x4e')]+=0x1;logger[_0x8517('0x59')](_0x8517('0x135'),_0x3fbfe0,_0x8517('0xbb'),_0x1e3c84[_0x8517('0x28')],_0x8517('0x6e'),_0x1e3c84[_0x8517('0x4e')]);_0x4f03be(_0x488062);})[_0x8517('0x76')](function(_0x257a0c){ut[_0x8517('0xf4')](_0x5d74d4,0xe,_0x8517('0x136'));rpcDb[_0x8517('0xf6')](_0x5d74d4,_0x8517('0x137'));_0x5a1c63(_0x257a0c);});});};Preview[_0x8517('0xe')][_0x8517('0x138')]=function(_0x18b6c4){if(this[_0x8517('0x16')][_0x18b6c4[_0x8517('0xea')]]){this[_0x8517('0x16')][_0x18b6c4[_0x8517('0xea')]]['channel']=_0x18b6c4[_0x8517('0x139')];}};Preview[_0x8517('0xe')][_0x8517('0x19')]=function(_0x19ce0b){var _0x2c39ec=this;var _0x4e8b57=this[_0x8517('0x16')][_0x19ce0b[_0x8517('0x13a')]];if(_0x4e8b57){if(_0x4e8b57[_0x8517('0x101')]&&this[_0x8517('0x17')][_0x4e8b57[_0x8517('0x101')]]){ut[_0x8517('0x13b')](_0x4e8b57,this[_0x8517('0x17')][_0x4e8b57[_0x8517('0x101')]][_0x8517('0x28')],this['agents'][_0x4e8b57[_0x8517('0x101')]]['id']);}var _0xc0b55a=_[_0x8517('0x13c')](_0x4e8b57);_0xc0b55a[_0x8517('0xaf')]=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x31d6ad=_0x2c39ec['campaignsPreview'][_0x4e8b57[_0x8517('0x7b')]];if(ut[_0x8517('0x13d')](_0x19ce0b['response'])){if(_0x4e8b57[_0x8517('0xac')]){rpcDb[_0x8517('0x110')](_0x4e8b57[_0x8517('0x13e')]);}if(_0x4e8b57['activeContact']){rpcDb[_0x8517('0x8d')](_0x4e8b57[_0x8517('0x13e')]);}ami[_0x8517('0x27')](_0x8517('0x13f'),ut[_0x8517('0xa3')](_0x4e8b57,_0x8517('0x140'),this['campaignsPreview'][_0x4e8b57[_0x8517('0x7b')]]));this['callProgressDetectingAgent'](_0xc0b55a,_0x31d6ad,_0x19ce0b);}else{_0x4e8b57[_0x8517('0x133')]=moment()[_0x8517('0x8e')](_0x8517('0x141'));ut[_0x8517('0xf4')](_0xc0b55a,0x4,_0x8517('0x142'));rpcDb[_0x8517('0xf6')](_0xc0b55a,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x32cab3){var _0x47bd94=this;var _0x38e4bb=this[_0x8517('0x16')][_0x32cab3[_0x8517('0xea')]];var _0x408937;if(_0x38e4bb){_0x408937=this[_0x8517('0x13')][_0x38e4bb[_0x8517('0x7b')]];logger[_0x8517('0x59')]('[syncHangup][talking]',_0x32cab3['linkedid'],_0x8517('0xbb'),_0x408937['name'],'pTalking:\x20',_0x408937['pTalking']);}if(this[_0x8517('0x16')][_0x32cab3[_0x8517('0xea')]]&&_0x32cab3['linkedid']!==_0x32cab3['uniqueid']){if(_0x32cab3[_0x8517('0x143')]==='16'&&this['actions'][_0x32cab3[_0x8517('0xea')]][_0x8517('0x7a')]){this[_0x8517('0x144')](_0x32cab3,_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')]);}else if(this[_0x8517('0x16')][_0x32cab3[_0x8517('0xea')]][_0x8517('0x7a')]){logger[_0x8517('0x59')](_0x8517('0x145'),_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')],_0x8517('0xbb'),_0x408937['name'],_0x8517('0x6f'),_0x408937[_0x8517('0x5e')]);this['callProgressDetectingCustomer'](_0x32cab3,_0x32cab3['linkedid'],_0x32cab3[_0x8517('0x143')]);}}else if(_0x38e4bb&&_['isNil'](_0x38e4bb[_0x8517('0x146')])&&_0x408937['dialQueueProject']&&_0x32cab3[_0x8517('0xea')]===_0x32cab3[_0x8517('0xb2')]&&_[_0x8517('0x6c')](_0x32cab3[_0x8517('0xf3')])&&_0x32cab3['cause']==='16'&&_0x32cab3['channelstate']==='6'&&_[_0x8517('0xf1')](_0x38e4bb['transfer'])){if(_0x38e4bb['unlockAgent']){rpcDb[_0x8517('0x110')](_0x38e4bb[_0x8517('0x13e')]);}if(_0x38e4bb['activeContact']){rpcDb[_0x8517('0x8d')](_0x38e4bb[_0x8517('0x13e')]);}_0x32cab3['reason']='22';this[_0x8517('0x147')](_0x38e4bb,_0x408937,_0x32cab3);}else if(_0x38e4bb&&_0x38e4bb[_0x8517('0x148')]){if(_0x32cab3['cause']==='16'&&this[_0x8517('0x16')][_0x32cab3['linkedid']][_0x8517('0x7a')]){logger[_0x8517('0x59')]('[syncHangup][talking][transfer]',_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')],_0x8517('0xbb'),_0x408937[_0x8517('0x28')],_0x8517('0x6f'),_0x408937[_0x8517('0x5e')]);this[_0x8517('0x144')](_0x32cab3,_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')]);}else if(this['actions'][_0x32cab3[_0x8517('0xea')]][_0x8517('0x7a')]){logger[_0x8517('0x59')](_0x8517('0x145'),_0x32cab3[_0x8517('0xea')],_0x32cab3['cause'],'\x20Queue',_0x408937['name'],_0x8517('0x6f'),_0x408937[_0x8517('0x5e')]);this[_0x8517('0x144')](_0x32cab3,_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')]);}}};Preview[_0x8517('0xe')][_0x8517('0x20')]=function(_0x4500ce){if(this[_0x8517('0x16')][_0x4500ce['destlinkedid']]&&_0x4500ce[_0x8517('0xf0')]!==_0x4500ce[_0x8517('0x149')]){this[_0x8517('0x144')](_0x4500ce,_0x4500ce[_0x8517('0xf0')],_0x4500ce[_0x8517('0xe6')]);}};Preview['prototype'][_0x8517('0x1e')]=function(_0xb7e380){if(this[_0x8517('0x16')][_0xb7e380['linkedid']]&&_0xb7e380[_0x8517('0xea')]!==_0xb7e380[_0x8517('0xb2')]&&!this[_0x8517('0x16')][_0xb7e380['linkedid']][_0x8517('0x7a')]){if(_0xb7e380[_0x8517('0x143')]==='1'){this[_0x8517('0x144')](_0xb7e380,_0xb7e380['linkedid'],_0xb7e380['cause']);}}};Preview[_0x8517('0xe')][_0x8517('0x14a')]=function(_0x5d5e06,_0x3a67d8,_0x176601){if(this[_0x8517('0x16')][_0x5d5e06]){if(_[_0x8517('0x6c')](this[_0x8517('0x16')][_0x5d5e06]['variables'])){this[_0x8517('0x16')][_0x5d5e06][_0x8517('0x14b')]={};}this[_0x8517('0x16')][_0x5d5e06]['variables'][_0x3a67d8]=_0x176601;}};Preview[_0x8517('0xe')]['syncVarSet']=function(_0x350c39){try{if(!_[_0x8517('0x6c')](_0x350c39)){if(ut[_0x8517('0x14c')](_[_0x8517('0x14d')](_0x350c39['variable'])[0x0])){this[_0x8517('0x14a')](_0x350c39[_0x8517('0xb2')],_[_0x8517('0x14d')](_0x350c39['variable'])[0x0],_0x350c39[_0x8517('0x14e')]);}}}catch(_0x335e4b){logger[_0x8517('0x14f')](_0x8517('0x150'),util[_0x8517('0x151')](_0x335e4b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x8517('0x25')]=function(_0x5d4692){if(_0x5d4692){if(this['actions'][_0x5d4692[_0x8517('0x152')]]){this['actions'][_0x5d4692[_0x8517('0x152')]][_0x8517('0x148')]=!![];}}};Preview[_0x8517('0xe')][_0x8517('0x26')]=function(_0x469726){if(_0x469726){if(this[_0x8517('0x16')][_0x469726[_0x8517('0x153')]]){this['actions'][_0x469726['transfererlinkedid']][_0x8517('0x148')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x7bae=['syncHangup','bind','syncHangupRequest','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','buildObj','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','total','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','logAgent','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','Action','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','clone','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','inspect','transfererlinkedid','bluebird','uuid','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x7bae,0x13b));var _0xe7ba=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x7bae[_0x34021d];return _0x16597b;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe7ba('0x0'));var uuid=require(_0xe7ba('0x1'));var moment=require('moment');var md5=require(_0xe7ba('0x2'));var Redis=require('ioredis');var config=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var loggerAction=require(_0xe7ba('0x4'))(_0xe7ba('0x6'));var ami=require(_0xe7ba('0x7'));var rpcDb=require(_0xe7ba('0x8'));var Action=require(_0xe7ba('0x9'));var ut=require(_0xe7ba('0xa'));config[_0xe7ba('0xb')]=_[_0xe7ba('0xc')](config[_0xe7ba('0xb')],{'host':_0xe7ba('0xd'),'port':0x18eb});var io=require(_0xe7ba('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe7ba('0xf')][_0xe7ba('0x10')]=function(_0x375ebb){this[_0xe7ba('0x11')]=this[_0xe7ba('0x11')]?this[_0xe7ba('0x11')][_0xe7ba('0x12')](_0x375ebb):_0x375ebb();};function Preview(_0x448bcc){this[_0xe7ba('0x13')]=new Sequence();this['campaignsPreview']=_0x448bcc[_0xe7ba('0x14')];this['trunks']=_0x448bcc[_0xe7ba('0x15')];this[_0xe7ba('0x16')]={};this[_0xe7ba('0x17')]=_0x448bcc[_0xe7ba('0x17')];this[_0xe7ba('0x18')]=0x0;ami['on'](_0xe7ba('0x19'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xe7ba('0x1a'),this[_0xe7ba('0x1b')][_0xe7ba('0x1c')](this));ami['on']('hanguprequest',this[_0xe7ba('0x1d')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0xe7ba('0x1c')](this));ami['on']('newexten',this[_0xe7ba('0x1e')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xe7ba('0x1c')](this));ami['on'](_0xe7ba('0x1f'),this[_0xe7ba('0x20')][_0xe7ba('0x1c')](this));ami['on'](_0xe7ba('0x21'),this['syncBlindTransfer'][_0xe7ba('0x1c')](this));this[_0xe7ba('0x22')](this[_0xe7ba('0x23')]);}function emit(_0x136ec6,_0x4aaf35,_0x1076c5){io['to'](_0x136ec6)[_0xe7ba('0x24')](_0x4aaf35,_0x1076c5);}function emitCampaignPreview(_0x5a158f){if(_0x5a158f[_0xe7ba('0x25')]===_0xe7ba('0x26')){var _0x27c882={'id':_0x5a158f['id'],'name':_0x5a158f[_0xe7ba('0x27')],'strategy':_0x5a158f[_0xe7ba('0x28')],'answered':_0x5a158f[_0xe7ba('0x29')],'available':_0x5a158f[_0xe7ba('0x2a')],'loggedIn':_0x5a158f[_0xe7ba('0x2b')],'pTalking':_0x5a158f[_0xe7ba('0x2c')],'sumBillable':_0x5a158f[_0xe7ba('0x2d')],'sumDuration':_0x5a158f['sumDuration'],'sumHoldTime':_0x5a158f['sumHoldTime']||0x0,'talking':_0x5a158f['talking'],'total':_0x5a158f['total'],'type':_0x5a158f[_0xe7ba('0x25')],'unmanaged':_0x5a158f['unmanaged'],'abandoned':_0x5a158f['abandoned'],'waiting':_0x5a158f['waiting'],'loggedInDb':_0x5a158f[_0xe7ba('0x2e')],'dialActive':_0x5a158f[_0xe7ba('0x2f')],'dialMethod':_0x5a158f[_0xe7ba('0x30')],'dialOriginateCallerIdName':_0x5a158f[_0xe7ba('0x31')],'dialOriginateCallerIdNumber':_0x5a158f[_0xe7ba('0x32')],'dialOriginateTimeout':_0x5a158f[_0xe7ba('0x33')],'dialPrefix':_0x5a158f[_0xe7ba('0x34')],'outboundAnswerAgiCallsDay':_0x5a158f[_0xe7ba('0x35')],'outboundAnswerCallsDay':_0x5a158f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5a158f[_0xe7ba('0x36')],'outboundBusyCallsDay':_0x5a158f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5a158f[_0xe7ba('0x37')],'outboundDropCallsDayACS':_0x5a158f[_0xe7ba('0x38')],'outboundDropCallsDayCallersExit':_0x5a158f[_0xe7ba('0x39')],'outboundDropCallsDayTimeout':_0x5a158f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5a158f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5a158f[_0xe7ba('0x3a')],'outboundOriginateFailureCallsDay':_0x5a158f[_0xe7ba('0x3b')],'outboundReCallsDay':_0x5a158f[_0xe7ba('0x3c')],'outboundRejectCallsDay':_0x5a158f[_0xe7ba('0x3d')],'outboundUnknownCallsDay':_0x5a158f[_0xe7ba('0x3e')],'outboundAbandonedCallsDay':_0x5a158f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5a158f[_0xe7ba('0x3f')],'predictiveIntervalAvgHoldtime':_0x5a158f[_0xe7ba('0x40')],'predictiveIntervalAvgTalktime':_0x5a158f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5a158f[_0xe7ba('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x5a158f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5a158f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5a158f[_0xe7ba('0x42')],'predictiveIntervalHitRate':_0x5a158f[_0xe7ba('0x43')],'predictiveIntervalMultiplicativeFactor':_0x5a158f[_0xe7ba('0x44')],'predictiveIntervalPauses':_0x5a158f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5a158f[_0xe7ba('0x45')],'predictiveIntervalTotalCalls':_0x5a158f['predictiveIntervalTotalCalls'],'message':_0x5a158f[_0xe7ba('0x46')],'originated':_0x5a158f[_0xe7ba('0x47')],'erlangCalls':_0x5a158f[_0xe7ba('0x48')],'erlangCallToSecond':_0x5a158f[_0xe7ba('0x49')],'erlangAbandonmentRate':_0x5a158f[_0xe7ba('0x4a')],'erlangBusyFactor':_0x5a158f['erlangBusyFactor'],'startPredictive':_0x5a158f[_0xe7ba('0x4b')],'startProgressive':_0x5a158f[_0xe7ba('0x4c')]};if(_0x5a158f['Trunk']){_0x27c882[_0xe7ba('0x4d')]={'id':_0x5a158f[_0xe7ba('0x4d')]['id'],'name':_0x5a158f[_0xe7ba('0x4d')]['name'],'active':_0x5a158f[_0xe7ba('0x4d')][_0xe7ba('0x4e')],'callerid':_0x5a158f['Trunk'][_0xe7ba('0x4f')]};}if(_0x5a158f[_0xe7ba('0x50')]){_0x27c882[_0xe7ba('0x50')]={'id':_0x5a158f['Interval']['id'],'name':_0x5a158f[_0xe7ba('0x50')][_0xe7ba('0x27')]};}var _0x575f4b=md5(JSON[_0xe7ba('0x51')](_0x27c882));if(_0x5a158f[_0xe7ba('0x2')]!==_0x575f4b){_0x5a158f[_0xe7ba('0x2')]=_0x575f4b;emit(util['format']('voice:queue:%s',_0x27c882[_0xe7ba('0x27')]),_0xe7ba('0x52'),_0x27c882);}}}function emitVoiceQueueChannelRemove(_0x58d2a){logger[_0xe7ba('0x53')](_0xe7ba('0x54'),JSON['stringify'](_0x58d2a));emit(util[_0xe7ba('0x55')](_0xe7ba('0x56'),_0x58d2a[_0xe7ba('0x27')]),_0xe7ba('0x57'),_0x58d2a);io['emit'](_0xe7ba('0x58'),_0x58d2a);}function notSendMessagesQueue(_0x1b7f18){if(_0x1b7f18[_0xe7ba('0x59')]){if(_0x1b7f18[_0xe7ba('0x47')]===0x0&&_0x1b7f18[_0xe7ba('0x2c')]===0x0){_0x1b7f18[_0xe7ba('0x59')]=![];_0x1b7f18[_0xe7ba('0x2a')]=0x0;_0x1b7f18['paused']=0x0;_0x1b7f18[_0xe7ba('0x46')]=_0xe7ba('0x5a');ut[_0xe7ba('0x5b')](_0xe7ba('0x5c'),_0x1b7f18[_0xe7ba('0x27')]+_0xe7ba('0x5d'));}else{_0x1b7f18[_0xe7ba('0x46')]=_0xe7ba('0x5e');ut[_0xe7ba('0x5b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1b7f18[_0xe7ba('0x27')]+_0xe7ba('0x5f'));}emitCampaignPreview(_0x1b7f18);}}Preview['prototype']['loopCampaigns']=function(){var _0x32053d=this;setInterval(function(){_0x32053d[_0xe7ba('0x60')]();},0x7cf);};Preview[_0xe7ba('0xf')]['syncCampaigns']=function(){var _0x249e1d=this[_0xe7ba('0x23')];this[_0xe7ba('0x18')]+=0x1;for(var _0x12770d in _0x249e1d){if(_0x249e1d[_0xe7ba('0x61')](_0x12770d)&&(_0x249e1d[_0x12770d]['dialMethod']===_0xe7ba('0x5')||_0x249e1d[_0x12770d]['dialMethod']===_0xe7ba('0x62'))&&_0x249e1d[_0x12770d][_0xe7ba('0x25')]===_0xe7ba('0x26')){if(this[_0xe7ba('0x18')]>0x7){this[_0xe7ba('0x18')]=0x0;this[_0xe7ba('0x63')]();}}if(_0x249e1d[_0xe7ba('0x61')](_0x12770d)&&_0x249e1d[_0x12770d][_0xe7ba('0x30')]==='preview'&&_0x249e1d[_0x12770d][_0xe7ba('0x25')]===_0xe7ba('0x26')){if(_0x249e1d[_0x12770d][_0xe7ba('0x2f')]){this[_0xe7ba('0x64')](_0x249e1d[_0x12770d]);if(_0x249e1d[_0x12770d][_0xe7ba('0x65')])this[_0xe7ba('0x66')](_0x249e1d[_0x12770d]);}else{notSendMessagesQueue(_0x249e1d[_0x12770d]);}}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x67')]=function(_0x45f49a){var _0x46c456=this;this['sequence'][_0xe7ba('0x10')](function(){if(!_['isNil'](_0x46c456[_0xe7ba('0x16')][_0x45f49a])){loggerAction[_0xe7ba('0x53')](_0xe7ba('0x68'),_0x45f49a,_0xe7ba('0x69'),_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6a')],'originated:\x20',JSON[_0xe7ba('0x51')](_0x46c456[_0xe7ba('0x23')][_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6a')]][_0xe7ba('0x47')]),_0xe7ba('0x6b'),JSON[_0xe7ba('0x51')](_0x46c456[_0xe7ba('0x23')][_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6a')]][_0xe7ba('0x2c')]),JSON['stringify'](_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6c')]),JSON[_0xe7ba('0x51')](_[_0xe7ba('0x6d')](_0x46c456[_0xe7ba('0x16')][_0x45f49a],[_0xe7ba('0x6e'),'UserId',_0xe7ba('0x6f'),_0xe7ba('0x70')])));return ami['Action']({'action':_0xe7ba('0x71'),'channel':_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x72')]})[_0xe7ba('0x73')](function(_0x4cc4e9){if(_0x4cc4e9['message']===_0xe7ba('0x74')){setTimeout(function(){if(_0x46c456[_0xe7ba('0x16')][_0x45f49a]){ut[_0xe7ba('0x75')](_0x46c456['campaignsPreview'][_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6a')]],_0xe7ba('0x76'));if(_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6c')]===!![]){ut[_0xe7ba('0x77')](_0x46c456[_0xe7ba('0x23')][_0x46c456['actions'][_0x45f49a][_0xe7ba('0x6a')]],_0xe7ba('0x76'));ut[_0xe7ba('0x78')]('[Dialer][checkChannel][pTalking][Preview]'+_0x45f49a,_0x46c456[_0xe7ba('0x16')][_0x45f49a][_0xe7ba('0x6a')]);}ut['loggerError'](_0xe7ba('0x79')+_0x45f49a,_0x46c456[_0xe7ba('0x16')][_0x45f49a]['queue']);delete _0x46c456[_0xe7ba('0x16')][_0x45f49a];}},0x2328);}});}});};Preview['prototype'][_0xe7ba('0x63')]=function(){var _0x2a8317=this;loggerAction[_0xe7ba('0x53')]('[action]',_[_0xe7ba('0x7a')](this[_0xe7ba('0x16')]));for(var _0x314549 in this[_0xe7ba('0x16')]){if(_0x2a8317[_0xe7ba('0x16')]['hasOwnProperty'](_0x314549)){_0x2a8317[_0xe7ba('0x67')](_0x314549);}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x66')]=function(_0x19159c){var _0x435dee=this;rpcDb['getContactRecallMe'](_0x19159c['id'],ut[_0xe7ba('0x7b')](this[_0xe7ba('0x17')]))[_0xe7ba('0x7c')](function(_0x41dbf2){if(!_['isNil'](_0x41dbf2)){for(var _0x3e31c1=0x0;_0x3e31c1<_0x41dbf2[_0xe7ba('0x7d')];_0x3e31c1+=0x1){if(ut[_0xe7ba('0x7e')](_0x41dbf2[_0x3e31c1][_0xe7ba('0x7f')])<_0x19159c[_0xe7ba('0x80')]*0x3c){if(_0x41dbf2[_0x3e31c1][_0xe7ba('0x81')]&&!_0x41dbf2[_0x3e31c1]['Agent'][_0xe7ba('0x82')]){_0x435dee[_0xe7ba('0x83')](_0x41dbf2[_0x3e31c1]['id'])[_0xe7ba('0x7c')](ut['logger2'](_0xe7ba('0x84')))[_0xe7ba('0x73')](ut[_0xe7ba('0x85')](_0xe7ba('0x84')));}else{rpcDb[_0xe7ba('0x86')](_0x41dbf2[_0x3e31c1]['id']);}}else{var _0x162d7f=new Action(_0x41dbf2[_0x3e31c1],_0x19159c);_0x162d7f[_0xe7ba('0x87')]=moment()[_0xe7ba('0x55')](_0xe7ba('0x88'));_0x19159c[_0xe7ba('0x3c')]+=0x1;ut[_0xe7ba('0x89')](_0x162d7f,0x17,_0xe7ba('0x8a'));if(_0x19159c['dialRecallInQueue']){rpcDb[_0xe7ba('0x8b')](ut[_0xe7ba('0x8c')](_0x41dbf2[_0x3e31c1]));rpcDb[_0xe7ba('0x8d')](_0x162d7f,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xe7ba('0x89')](_0x162d7f,0x16,'RecallFailedTimeout');rpcDb[_0xe7ba('0x8d')](_0x162d7f,_0xe7ba('0x8e'));rpcDb[_0xe7ba('0x8f')](_0x162d7f,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xe7ba('0x85')](_0xe7ba('0x90')));};Preview[_0xe7ba('0xf')]['setMessage']=function(_0x3ba4fd){_0x3ba4fd[_0xe7ba('0x59')]=!![];if(ut[_0xe7ba('0x91')](_0x3ba4fd[_0xe7ba('0x2b')])){_0x3ba4fd[_0xe7ba('0x46')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xe7ba('0x92')](_0x3ba4fd[_0xe7ba('0x2f')])){_0x3ba4fd[_0xe7ba('0x46')]='NOT_ACTIVE';}else if(!this[_0xe7ba('0x93')](_0x3ba4fd[_0xe7ba('0x4d')])){if(!this[_0xe7ba('0x93')](_0x3ba4fd[_0xe7ba('0x94')])){_0x3ba4fd[_0xe7ba('0x46')]=_0xe7ba('0x95');}else{_0x3ba4fd[_0xe7ba('0x46')]=_0xe7ba('0x96');}}else{_0x3ba4fd[_0xe7ba('0x46')]=_0xe7ba('0x96');}emitCampaignPreview(_0x3ba4fd);};Preview['prototype'][_0xe7ba('0x97')]=function(_0x2ee567,_0x344d29,_0xa6da9e){var _0x4d8773=this;var _0x4c0d12=this[_0xe7ba('0x16')][_0x344d29];var _0x3c2b1c=this[_0xe7ba('0x23')][_0x4c0d12['queue']];var _0x53ebd1;if(_0x3c2b1c){switch(_0xa6da9e){case'1':_0x3c2b1c['outboundNoSuchCallsDay']+=0x1;_0x4c0d12[_0xe7ba('0x98')]+=0x1;_0x4c0d12[_0xe7ba('0x99')]=ut['totalGlobal'](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0x0,'NoSuchNumber');ami[_0xe7ba('0x24')]('custom:agentnosuchnumber',ut[_0xe7ba('0x9a')](_0x4c0d12,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x4c0d12,_0xe7ba('0x9b'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4c0d12['countnosuchnumberretry']>=_0x3c2b1c[_0xe7ba('0xa0')]){rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xa1'));}else{rpcDb[_0xe7ba('0xa2')](ut[_0xe7ba('0xa3')](_0x4c0d12,_0xe7ba('0x98'),_0x3c2b1c[_0xe7ba('0xa4')]),_0x4c0d12[_0xe7ba('0xa5')],_0x4c0d12[_0xe7ba('0xa6')]);}}delete this[_0xe7ba('0x16')][_0x2ee567[_0xe7ba('0xa7')]];break;case _0xe7ba('0xa8'):var _0x2022e2=moment()[_0xe7ba('0x55')](_0xe7ba('0x88'));_0x4c0d12['responsetime']=_0x2022e2;_0x4c0d12[_0xe7ba('0xa9')]=_0x2022e2;_0x4c0d12[_0xe7ba('0x6c')]=!![];_0x3c2b1c[_0xe7ba('0x2c')]+=0x1;logger[_0xe7ba('0x53')](_0xe7ba('0xaa'),_0x4c0d12[_0xe7ba('0xab')],_0xe7ba('0xac'),_0x3c2b1c[_0xe7ba('0x27')],_0xe7ba('0x6b'),_0x3c2b1c[_0xe7ba('0x2c')]);ami[_0xe7ba('0x24')](_0xe7ba('0xad'),ut['buildObj'](_0x4c0d12,_0xe7ba('0xae'),this['campaignsPreview'][_0x4c0d12[_0xe7ba('0x6a')]]));if(_0x3c2b1c[_0xe7ba('0xaf')]){ami[_0xe7ba('0x24')]('custom:agentConnectPreview',ut[_0xe7ba('0xb0')](_0x4c0d12));}break;case'16':ami[_0xe7ba('0x24')](_0xe7ba('0xb1'),ut[_0xe7ba('0x9a')](_0x4c0d12,'complete',this[_0xe7ba('0x23')][_0x4c0d12[_0xe7ba('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0xe7ba('0x9a')](_0x4c0d12,_0xe7ba('0xb2')));_0x3c2b1c['outboundAnswerCallsDay']+=0x1;_0x3c2b1c[_0xe7ba('0xb3')]+=0x1;_0x3c2b1c[_0xe7ba('0x29')]+=0x1;ut[_0xe7ba('0x77')](_0x3c2b1c,_0xe7ba('0xb4'));_0x4c0d12[_0xe7ba('0x99')]=ut['totalGlobal'](_0x4c0d12);ut['logCustomer'](_0x4c0d12,0x4,'Answer');rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xb5'));rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xb6'));rpcDb[_0xe7ba('0xb7')](_0x4c0d12);_0x3c2b1c[_0xe7ba('0xb8')]+=_0x4c0d12['talktime'];_0x3c2b1c[_0xe7ba('0x2d')]+=_0x4c0d12['talktime'];logger[_0xe7ba('0x53')](_0xe7ba('0xb9'),_0x4c0d12[_0xe7ba('0xab')],_0xe7ba('0xac'),_0x3c2b1c[_0xe7ba('0x27')],_0xe7ba('0x6b'),_0x3c2b1c['pTalking']);delete this[_0xe7ba('0x16')][_0x2ee567[_0xe7ba('0xa7')]];break;case _0xe7ba('0xba'):_0x3c2b1c[_0xe7ba('0xbb')]+=0x1;_0x4c0d12[_0xe7ba('0xbc')]+=0x1;_0x4c0d12['countglobal']=ut[_0xe7ba('0x9c')](_0x4c0d12);ut['logCustomer'](_0x4c0d12,0x5,_0xe7ba('0xbd'));ami[_0xe7ba('0x24')](_0xe7ba('0xbe'),ut[_0xe7ba('0x9a')](_0x4c0d12,_0xe7ba('0xbf')));rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xc0'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,_0xe7ba('0xc1'));}else{if(_0x4c0d12[_0xe7ba('0xbc')]>=_0x3c2b1c[_0xe7ba('0xc2')]){rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xc0'));}else{rpcDb[_0xe7ba('0xa2')](ut[_0xe7ba('0xa3')](_0x4c0d12,_0xe7ba('0xbc'),_0x3c2b1c[_0xe7ba('0xc3')]),_0x4c0d12[_0xe7ba('0xa5')],_0x4c0d12[_0xe7ba('0xa6')]);}}break;case _0xe7ba('0xc4'):_0x3c2b1c[_0xe7ba('0xc5')]+=0x1;_0x4c0d12['countnoanswerretry']+=0x1;_0x4c0d12['countglobal']=ut['totalGlobal'](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0x3,_0xe7ba('0xc6'));ami['emit']('custom:agentnoanswer',ut[_0xe7ba('0x9a')](_0x4c0d12,_0xe7ba('0xc7')));rpcDb['createCustomerHistory'](_0x4c0d12,_0xe7ba('0xc8'));if(ut['totalGlobal'](_0x4c0d12)>=_0x3c2b1c['dialGlobalMaxRetry']){_0x53ebd1=ut['cloneAction'](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,_0xe7ba('0xc9'));}else{if(_0x4c0d12[_0xe7ba('0xca')]>=_0x3c2b1c['dialNoAnswerMaxRetry']){rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xc8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4c0d12,_0xe7ba('0xca'),_0x3c2b1c[_0xe7ba('0xcb')]),_0x4c0d12[_0xe7ba('0xa5')],_0x4c0d12[_0xe7ba('0xa6')]);}}break;case _0xe7ba('0xcc'):_0x3c2b1c['outboundCongestionCallsDay']+=0x1;_0x4c0d12[_0xe7ba('0xcd')]+=0x1;_0x4c0d12[_0xe7ba('0x99')]=ut[_0xe7ba('0x9c')](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0x8,_0xe7ba('0xce'));ami[_0xe7ba('0x24')](_0xe7ba('0xcf'),ut[_0xe7ba('0x9a')](_0x4c0d12,_0xe7ba('0xd0')));rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xd1'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,_0xe7ba('0xd2'));}else{if(_0x4c0d12[_0xe7ba('0xcd')]>=_0x3c2b1c[_0xe7ba('0xd3')]){rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xd1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4c0d12,'countcongestionretry',_0x3c2b1c[_0xe7ba('0xc3')]),_0x4c0d12[_0xe7ba('0xa5')],_0x4c0d12[_0xe7ba('0xa6')]);}}break;case _0xe7ba('0xd4'):_0x3c2b1c[_0xe7ba('0x3d')]+=0x1;_0x4c0d12['countagentrejectretry']+=0x1;_0x4c0d12['countglobal']=ut[_0xe7ba('0x9c')](_0x4c0d12);ut['logCustomer'](_0x4c0d12,0x14,_0xe7ba('0xd5'));ami[_0xe7ba('0x24')](_0xe7ba('0xd6'),ut[_0xe7ba('0x9a')](_0x4c0d12,_0xe7ba('0xd7')));rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xd8'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c['dialGlobalMaxRetry']){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0x14,_0xe7ba('0xd5'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4c0d12['countagentrejectretry']>=_0x3c2b1c[_0xe7ba('0xd9')]){rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xda'));}else{rpcDb[_0xe7ba('0xa2')](ut['scheduledAt'](_0x4c0d12,_0xe7ba('0xdb'),_0x3c2b1c[_0xe7ba('0xdc')]),_0x4c0d12[_0xe7ba('0xa5')],_0x4c0d12[_0xe7ba('0xa6')]);}}break;case _0xe7ba('0xdd'):_0x3c2b1c[_0xe7ba('0xde')]+=0x1;_0x4c0d12[_0xe7ba('0xdf')]+=0x1;_0x4c0d12[_0xe7ba('0x99')]=ut[_0xe7ba('0x9c')](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0xb,_0xe7ba('0xe0'));rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xe1'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,'Global');rpcDb['createCustomerFinal'](_0x53ebd1,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4c0d12[_0xe7ba('0xe2')]>=_0x3c2b1c[_0xe7ba('0xe3')]){rpcDb[_0xe7ba('0x8f')](_0x4c0d12,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xe7ba('0xa3')](_0x4c0d12,_0xe7ba('0xdf'),_0x3c2b1c[_0xe7ba('0xe4')]),_0x4c0d12[_0xe7ba('0xa5')],_0x4c0d12[_0xe7ba('0xa6')]);}}break;case'18':_0x3c2b1c[_0xe7ba('0x3e')]+=0x1;_0x4c0d12[_0xe7ba('0xe5')]+=0x1;_0x4c0d12['countglobal']=ut[_0xe7ba('0x9c')](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0x12,_0x2ee567[_0xe7ba('0xe6')]||_0x2ee567[_0xe7ba('0xe7')]);ami['emit'](_0xe7ba('0xe8'),ut['buildObj'](_0x4c0d12,_0xe7ba('0xe9')));rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xea'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,_0xe7ba('0xea'));}else{rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xea'));}delete this[_0xe7ba('0x16')][_0x2ee567[_0xe7ba('0xa7')]];break;case'19':_0x3c2b1c['outboundUnknownCallsDay']+=0x1;_0x4c0d12[_0xe7ba('0x99')]=ut[_0xe7ba('0x9c')](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0x13,_0x2ee567[_0xe7ba('0xe6')]||_0x2ee567['dialstatus']);ami[_0xe7ba('0x24')]('custom:amd',ut['buildObj'](_0x4c0d12,_0xe7ba('0xe9')));rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xeb'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xeb'));}delete this['actions'][_0x2ee567[_0xe7ba('0xa7')]];break;default:if(_0x4c0d12[_0xe7ba('0x6c')]){ut[_0xe7ba('0x77')](_0x3c2b1c,_0xe7ba('0xec'));ut[_0xe7ba('0x78')](_0xe7ba('0xed')+_0x3c2b1c[_0xe7ba('0x27')],_0x2ee567);}_0x3c2b1c[_0xe7ba('0x3e')]+=0x1;_0x4c0d12['countglobal']=ut[_0xe7ba('0x9c')](_0x4c0d12);ut[_0xe7ba('0x89')](_0x4c0d12,0xc,_0x2ee567[_0xe7ba('0xe6')]||_0x2ee567[_0xe7ba('0xe7')]);rpcDb[_0xe7ba('0x8d')](_0x4c0d12,_0xe7ba('0xee'));if(ut[_0xe7ba('0x9c')](_0x4c0d12)>=_0x3c2b1c[_0xe7ba('0x9d')]){_0x53ebd1=ut[_0xe7ba('0x9e')](_0x4c0d12,0xf,_0xe7ba('0x9f'));rpcDb[_0xe7ba('0x8f')](_0x53ebd1,_0xe7ba('0xef'));}else{rpcDb[_0xe7ba('0x8f')](_0x4c0d12,_0xe7ba('0xef'));}delete this[_0xe7ba('0x16')][_0x2ee567[_0xe7ba('0xa7')]];}if(!(_0x4c0d12[_0xe7ba('0x6c')]&&_0xa6da9e==='16')){ut[_0xe7ba('0x75')](_0x3c2b1c,_0xe7ba('0xf0'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x4c0d12[_0xe7ba('0xab')],_0xe7ba('0xac'),_0x3c2b1c[_0xe7ba('0x27')],_0xe7ba('0xf1'),_0x3c2b1c[_0xe7ba('0x47')]);}if(_0xa6da9e!==_0xe7ba('0xa8')){delete this['actions'][_0x2ee567[_0xe7ba('0xa7')]];delete this[_0xe7ba('0x16')][_0x2ee567['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x2e1e57,_0xc70e27,_0xe43ddc){if(_['isUndefined'](_0xc70e27)&&_0xe7ba('0xf2')!==typeof _0xc70e27){return;}if(_[_0xe7ba('0xf3')](_0xe43ddc)&&_0xe7ba('0xf2')!==typeof _0xe43ddc){return;}switch(_0xe43ddc[_0xe7ba('0xf4')]){case'0':ut['logAgent'](_0x2e1e57,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x2e1e57,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x2e1e57,0x3,_0xe7ba('0xc6'));rpcDb[_0xe7ba('0xf5')](_0x2e1e57,_0xe7ba('0xf6'));break;case'5':ut['logAgent'](_0x2e1e57,0x5,'Busy');rpcDb['createAgentHistory'](_0x2e1e57,_0xe7ba('0xf7'));break;case'8':ut[_0xe7ba('0xf8')](_0x2e1e57,0x8,'Congestion');rpcDb['createAgentHistory'](_0x2e1e57,_0xe7ba('0xf9'));break;case'22':ut[_0xe7ba('0xf8')](_0x2e1e57,0x16,_0xe7ba('0xfa'));rpcDb[_0xe7ba('0xf5')](_0x2e1e57,_0xe7ba('0xfb'));break;default:ut[_0xe7ba('0xf8')](_0x2e1e57,0xc,_0xe43ddc[_0xe7ba('0xf4')]);rpcDb[_0xe7ba('0xf5')](_0x2e1e57,'[callProgressDetectingAgent][logCongestion]');}ut[_0xe7ba('0x75')](_0xc70e27,_0xe7ba('0xfc'));logger['info'](_0xe7ba('0xfd'),_0x2e1e57[_0xe7ba('0xab')],_0xe7ba('0xac'),_0xc70e27[_0xe7ba('0x27')],_0xe7ba('0xf1'),_0xc70e27['originated']);delete this['actions'][_0x2e1e57[_0xe7ba('0xab')]];};Preview['prototype'][_0xe7ba('0xfe')]=function(_0x5b8b21,_0x2cda32,_0x24ce3b,_0x5b2b3f,_0x1ae52f){var _0xe6617d=this;return new BPromise(function(_0x4407e0,_0x277b8a){if(_[_0xe7ba('0xff')](_0x2cda32)||_[_0xe7ba('0xff')](_0x2cda32[_0xe7ba('0x100')])||_['isNil'](_0x2cda32[_0xe7ba('0x100')]['phone'])||_[_0xe7ba('0xff')](_0x2cda32[_0xe7ba('0x6f')])){_0x277b8a(ut[_0xe7ba('0x46')](_0xe7ba('0x101'),_0x5b2b3f,_0x1ae52f));return;}var _0x1e8329=uuid['v4']();var _0x29f8f3=_0xe6617d['campaignsPreview'][_0x2cda32[_0xe7ba('0x69')][_0xe7ba('0x27')]];var _0x57e899=_0x24ce3b?_0xe6617d[_0xe7ba('0x17')][_0x24ce3b]['id']:undefined;_0xe6617d[_0xe7ba('0x16')][_0x1e8329]=new Action(_0x2cda32,_0x29f8f3,_0x1e8329,_0x24ce3b,_0x57e899);var _0x4a2b36=_0xe6617d[_0xe7ba('0x16')][_0x1e8329];_0x4a2b36[_0xe7ba('0xa5')]=_0x5b2b3f;_0x4a2b36[_0xe7ba('0xa6')]=_0x1ae52f;_0x4a2b36[_0xe7ba('0x102')]=_0x24ce3b;if(_[_0xe7ba('0x103')](_0x5b8b21)){_0xe6617d[_0xe7ba('0x104')](_0x4a2b36,_0x29f8f3,_0x2cda32,_0x24ce3b)[_0xe7ba('0x7c')](function(_0x4ebfa6){logger[_0xe7ba('0x53')](_0xe7ba('0x105'),_0xe7ba('0x106')+_0x4a2b36[_0xe7ba('0x6a')]+_0xe7ba('0x107')+_0x4a2b36['idContact'],JSON['stringify'](_0x4ebfa6));ami[_0xe7ba('0x24')](_0xe7ba('0x108'),ut['buildObj'](_0x4a2b36,_0xe7ba('0x109'),_0xe6617d[_0xe7ba('0x23')][_0x4a2b36[_0xe7ba('0x6a')]]));_0x4407e0(ut['message']('Calling'));})[_0xe7ba('0x73')](function(_0x277684){ut[_0xe7ba('0x5b')](_0xe7ba('0x10a'),_0x277684);_0x277b8a(ut[_0xe7ba('0x46')](_0xe7ba('0x10b'),_0x5b2b3f,_0x1ae52f));});}else{_0x29f8f3[_0xe7ba('0x36')]+=0x1;ut[_0xe7ba('0x10c')](_0x4a2b36);rpcDb[_0xe7ba('0x10d')](_0x4a2b36,_0xe7ba('0x10e'));delete _0xe6617d[_0xe7ba('0x16')][_0x1e8329];_0x277b8a(ut[_0xe7ba('0x46')](_0xe7ba('0x10f'),_0x5b2b3f,_0x1ae52f));}});};Preview['prototype'][_0xe7ba('0x93')]=function(_0x12de23){return!_[_0xe7ba('0xff')](_0x12de23)&&!_['isNil'](_0x12de23['name'])&&!_[_0xe7ba('0xff')](_0x12de23[_0xe7ba('0x4e')])&&_0x12de23[_0xe7ba('0x4e')]&&!_['isNil'](this[_0xe7ba('0x15')][util[_0xe7ba('0x55')]('SIP/%s',_0x12de23[_0xe7ba('0x27')])])&&!_[_0xe7ba('0xff')](this[_0xe7ba('0x15')][util[_0xe7ba('0x55')](_0xe7ba('0x110'),_0x12de23[_0xe7ba('0x27')])][_0xe7ba('0x71')])&&(this[_0xe7ba('0x15')][util[_0xe7ba('0x55')](_0xe7ba('0x110'),_0x12de23[_0xe7ba('0x27')])][_0xe7ba('0x71')]==='reachable'||this['trunks'][util[_0xe7ba('0x55')]('SIP/%s',_0x12de23['name'])][_0xe7ba('0x71')]===_0xe7ba('0x111'));};Preview[_0xe7ba('0xf')]['run']=function(_0x15b29c,_0x3a78a1){var _0x3b8c03=this;return new BPromise(function(_0x2e9c2e,_0x1f563b){_0x3b8c03[_0xe7ba('0x112')](_0x15b29c,_0x3a78a1)['then'](function(_0x1bdb1e){_0x2e9c2e(_[_0xe7ba('0x6d')](_0x1bdb1e,[_0xe7ba('0x46')]));})[_0xe7ba('0x73')](function(_0x52aa36){if(_0x52aa36[_0xe7ba('0x113')]){rpcDb[_0xe7ba('0x114')](_0x15b29c);}if(_0x52aa36[_0xe7ba('0x4e')]){rpcDb[_0xe7ba('0x86')](_0x15b29c);}_0x1f563b(_[_0xe7ba('0x6d')](_0x52aa36,[_0xe7ba('0x46')]));});});};Preview[_0xe7ba('0xf')][_0xe7ba('0x112')]=function(_0x3e574c,_0x4d094d){var _0x1cb032=this;return new BPromise(function(_0x51f37f,_0x14f746){var _0xcbd1b9,_0x1f8c9e;rpcDb['getContactPreview'](_0x3e574c)[_0xe7ba('0x7c')](function(_0x27ce76){if(!_[_0xe7ba('0xff')](_0x27ce76[0x0])){_0x1f8c9e=_0x27ce76[0x0][_0xe7ba('0x115')]?![]:!![];_0xcbd1b9=_0x27ce76[0x0][_0xe7ba('0x115')]?!![]:![];_0xcbd1b9=_0x4d094d?!![]:_0xcbd1b9;}var _0x1db4a2=_0x1cb032[_0xe7ba('0x116')](_0x27ce76);if(_0x1db4a2['isValid']){rpcDb[_0xe7ba('0x117')](_['pick'](_0x27ce76[0x0],[_0xe7ba('0x6f'),_0xe7ba('0x118')]))[_0xe7ba('0x7c')](function(_0x5e8020){_0x1cb032[_0xe7ba('0xfe')](_0x5e8020,_0x27ce76[0x0],_0x4d094d,_0x1f8c9e,_0xcbd1b9)[_0xe7ba('0x7c')](function(_0x26dc8e){_0x51f37f(_0x26dc8e);})[_0xe7ba('0x73')](function(_0x400502){_0x14f746(_0x400502);});})[_0xe7ba('0x73')](function(_0x5b19c){ut[_0xe7ba('0x5b')]('[Preview][checkIsBlackList]',_0x5b19c);_0x14f746(ut[_0xe7ba('0x46')](_0xe7ba('0x119'),_0x1f8c9e,_0xcbd1b9));});}else{_0x14f746(ut[_0xe7ba('0x46')](_0x1db4a2[_0xe7ba('0x46')],_0x1f8c9e,_0xcbd1b9));}})[_0xe7ba('0x73')](function(_0x209e82){ut['logger'](_0xe7ba('0x11a'),_0x209e82);_0x14f746(ut[_0xe7ba('0x46')](_0xe7ba('0x119'),![],!![]));});});};Preview['prototype'][_0xe7ba('0x116')]=function(_0x1ccb79){if(_[_0xe7ba('0xff')](_0x1ccb79)||_[_0xe7ba('0x103')](_0x1ccb79)||!_[_0xe7ba('0xff')](_0x1ccb79[0x0][_0xe7ba('0x81')])&&_[_0xe7ba('0xff')](_0x1ccb79[0x0]['Agent'][_0xe7ba('0x27')])){ut[_0xe7ba('0x5b')](_0xe7ba('0x11b'),_0x1ccb79);return{'isValid':![],'message':_0xe7ba('0x11c')};}var _0x365a82=this['campaignsPreview'][_0x1ccb79[0x0][_0xe7ba('0x69')][_0xe7ba('0x27')]];_0x365a82[_0xe7ba('0x46')]='ACTIVE';if(_['isNil'](_0x365a82)){ut[_0xe7ba('0x5b')]('[Preview][validateContact][Empty\x20Campaign]',_0x365a82);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xe7ba('0x93')](_0x365a82[_0xe7ba('0x4d')])){ut[_0xe7ba('0x5b')](_0xe7ba('0x11d'),_0xe7ba('0x11e')+_0x365a82[_0xe7ba('0x27')]+_0xe7ba('0x11f'));if(!this[_0xe7ba('0x93')](_0x365a82[_0xe7ba('0x94')])){ut[_0xe7ba('0x5b')](_0xe7ba('0x11d'),_0x365a82[_0xe7ba('0x27')]+_0xe7ba('0x120'));return{'isValid':![],'message':_0xe7ba('0x121')};}}if(!ut[_0xe7ba('0x92')](_0x365a82[_0xe7ba('0x2f')])){ut['logger'](_0xe7ba('0x122'),_0x365a82[_0xe7ba('0x27')]+_0xe7ba('0x123'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x365a82[_0xe7ba('0x27')]+_0xe7ba('0x123')};}return{'isValid':!![],'message':_0xe7ba('0x124')};};Preview[_0xe7ba('0xf')][_0xe7ba('0x104')]=function(_0xa7f651,_0x1bbb94,_0x4bc357,_0x3fc744){var _0xc8d663=this;return new BPromise(function(_0x516116,_0x37a435){var _0x252280=_0xa7f651[_0xe7ba('0xab')];var _0xc32668=_0xc8d663['isTrunkReachable'](_0x1bbb94['Trunk'])?util[_0xe7ba('0x55')](_0xe7ba('0x125'),_0x1bbb94[_0xe7ba('0x4d')]['name'],_[_0xe7ba('0xff')](_0x1bbb94[_0xe7ba('0x34')])?'':_0x1bbb94[_0xe7ba('0x34')]['trim']()||'',_0x1bbb94[_0xe7ba('0x126')]>0x0?_0x4bc357[_0xe7ba('0x100')][_0xe7ba('0x127')][_0xe7ba('0x128')](_0x1bbb94[_0xe7ba('0x126')]):_0x4bc357[_0xe7ba('0x100')]['phone']):util[_0xe7ba('0x55')]('SIP/%s/%s%s',_[_0xe7ba('0xff')](_0x1bbb94['TrunkBackup'])?_0x1bbb94['Trunk'][_0xe7ba('0x27')]:_0x1bbb94[_0xe7ba('0x94')][_0xe7ba('0x27')],_['isNil'](_0x1bbb94['dialPrefix'])?'':_0x1bbb94[_0xe7ba('0x34')][_0xe7ba('0x129')]()||'',_0x1bbb94[_0xe7ba('0x126')]>0x0?_0x4bc357[_0xe7ba('0x100')][_0xe7ba('0x127')]['substring'](_0x1bbb94[_0xe7ba('0x126')]):_0x4bc357['Contact'][_0xe7ba('0x127')]);var _0x28bc82=_0xc8d663[_0xe7ba('0x93')](_0x1bbb94[_0xe7ba('0x4d')])?ut[_0xe7ba('0x12a')](_0x1bbb94[_0xe7ba('0x4d')][_0xe7ba('0x4f')],_0x1bbb94[_0xe7ba('0x31')],_0x1bbb94[_0xe7ba('0x12b')]>0x0?ut[_0xe7ba('0x12c')](_0x1bbb94['dialOriginateCallerIdNumber'],_0x1bbb94[_0xe7ba('0x12b')]):_0x1bbb94['dialOriginateCallerIdNumber']):ut[_0xe7ba('0x12a')](_[_0xe7ba('0xff')](_0x1bbb94[_0xe7ba('0x94')])?_0x1bbb94[_0xe7ba('0x4d')]['callerid']:_0x1bbb94[_0xe7ba('0x94')]['callerid'],_0x1bbb94[_0xe7ba('0x31')],_0x1bbb94[_0xe7ba('0x12b')]>0x0?ut['getCallerIdRandom'](_0x1bbb94[_0xe7ba('0x32')],_0x1bbb94[_0xe7ba('0x12b')]):_0x1bbb94['dialOriginateCallerIdNumber']);if(_0x28bc82){_0xa7f651[_0xe7ba('0x12d')]=ut[_0xe7ba('0x12e')](_0x28bc82);_0xa7f651[_0xe7ba('0x12f')]=ut[_0xe7ba('0x130')](_0x28bc82);}var _0x2b2514=ut['addVariables'](_0x1bbb94,_0x4bc357,_0xc32668,_0x28bc82,_0x252280,_0xa7f651);_[_0xe7ba('0x131')](_0xa7f651,ut['toLowerVariables'](_0x2b2514));_0xa7f651[_0xe7ba('0x87')]=moment()[_0xe7ba('0x55')](_0xe7ba('0x88'));ami[_0xe7ba('0x132')](ut[_0xe7ba('0x133')](_0xa7f651,_0x1bbb94,_0x2b2514,_0xa7f651['activeContact'],_0x3fc744))['then'](function(_0x4bc56b){_0x1bbb94['originated']+=0x1;logger[_0xe7ba('0x53')](_0xe7ba('0x134'),_0x252280,_0xe7ba('0xac'),_0x1bbb94[_0xe7ba('0x27')],'originated:\x20',_0x1bbb94[_0xe7ba('0x47')]);_0x516116(_0x4bc56b);})[_0xe7ba('0x73')](function(_0x2edc34){ut['logAgent'](_0xa7f651,0xe,_0xe7ba('0x135'));rpcDb['createAgentHistory'](_0xa7f651,'[originateFailure][logOriginateFailure]');_0x37a435(_0x2edc34);});});};Preview[_0xe7ba('0xf')][_0xe7ba('0x1e')]=function(_0x161590){if(this[_0xe7ba('0x16')][_0x161590[_0xe7ba('0xa7')]]){this[_0xe7ba('0x16')][_0x161590[_0xe7ba('0xa7')]][_0xe7ba('0x72')]=_0x161590['channel'];}};Preview['prototype'][_0xe7ba('0x136')]=function(_0x408e65){var _0x1af296=this;var _0x4b4349=this[_0xe7ba('0x16')][_0x408e65[_0xe7ba('0x137')]];if(_0x4b4349){if(_0x4b4349['lookAgent']&&this[_0xe7ba('0x17')][_0x4b4349['lookAgent']]){ut[_0xe7ba('0x138')](_0x4b4349,this[_0xe7ba('0x17')][_0x4b4349[_0xe7ba('0x102')]]['name'],this[_0xe7ba('0x17')][_0x4b4349[_0xe7ba('0x102')]]['id']);}var _0x33649f=_[_0xe7ba('0x139')](_0x4b4349);_0x33649f[_0xe7ba('0x13a')]=moment()[_0xe7ba('0x55')](_0xe7ba('0x88'));var _0x26421c=_0x1af296[_0xe7ba('0x23')][_0x4b4349['queue']];if(ut[_0xe7ba('0x13b')](_0x408e65[_0xe7ba('0x13c')])){if(_0x4b4349[_0xe7ba('0xa5')]){rpcDb[_0xe7ba('0x114')](_0x4b4349[_0xe7ba('0x13d')]);}if(_0x4b4349[_0xe7ba('0xa6')]){rpcDb['disableContact'](_0x4b4349[_0xe7ba('0x13d')]);}ami['emit'](_0xe7ba('0x13e'),ut[_0xe7ba('0x9a')](_0x4b4349,_0xe7ba('0x13f'),this[_0xe7ba('0x23')][_0x4b4349['queue']]));this[_0xe7ba('0x140')](_0x33649f,_0x26421c,_0x408e65);}else{_0x4b4349['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x33649f,0x4,_0xe7ba('0x141'));rpcDb['createAgentHistory'](_0x33649f,_0xe7ba('0x142'));}}};Preview['prototype'][_0xe7ba('0x1b')]=function(_0x32c6b1){var _0x84157f=this;var _0xbc8cca=this[_0xe7ba('0x16')][_0x32c6b1[_0xe7ba('0xa7')]];var _0x59e67a;if(_0xbc8cca){_0x59e67a=this[_0xe7ba('0x23')][_0xbc8cca[_0xe7ba('0x6a')]];logger[_0xe7ba('0x53')](_0xe7ba('0x143'),_0x32c6b1[_0xe7ba('0xa7')],_0xe7ba('0xac'),_0x59e67a[_0xe7ba('0x27')],_0xe7ba('0x6b'),_0x59e67a[_0xe7ba('0x2c')]);}if(this[_0xe7ba('0x16')][_0x32c6b1['linkedid']]&&_0x32c6b1[_0xe7ba('0xa7')]!==_0x32c6b1['uniqueid']){if(_0x32c6b1[_0xe7ba('0x144')]==='16'&&this[_0xe7ba('0x16')][_0x32c6b1['linkedid']][_0xe7ba('0x6c')]){this[_0xe7ba('0x97')](_0x32c6b1,_0x32c6b1[_0xe7ba('0xa7')],_0x32c6b1[_0xe7ba('0x144')]);}else if(this[_0xe7ba('0x16')][_0x32c6b1['linkedid']][_0xe7ba('0x6c')]){logger[_0xe7ba('0x53')](_0xe7ba('0x145'),_0x32c6b1[_0xe7ba('0xa7')],_0x32c6b1[_0xe7ba('0x144')],_0xe7ba('0xac'),_0x59e67a[_0xe7ba('0x27')],_0xe7ba('0x6b'),_0x59e67a[_0xe7ba('0x2c')]);this[_0xe7ba('0x97')](_0x32c6b1,_0x32c6b1['linkedid'],_0x32c6b1['cause']);}}else if(_0xbc8cca&&_['isNil'](_0xbc8cca['statedesc'])&&_0x59e67a[_0xe7ba('0x146')]&&_0x32c6b1['linkedid']===_0x32c6b1['uniqueid']&&_[_0xe7ba('0xff')](_0x32c6b1['reason'])&&_0x32c6b1['cause']==='16'&&_0x32c6b1[_0xe7ba('0x147')]==='6'&&_['isUndefined'](_0xbc8cca[_0xe7ba('0x148')])){if(_0xbc8cca['unlockAgent']){rpcDb[_0xe7ba('0x114')](_0xbc8cca['idContact']);}if(_0xbc8cca[_0xe7ba('0xa6')]){rpcDb[_0xe7ba('0x86')](_0xbc8cca[_0xe7ba('0x13d')]);}_0x32c6b1['reason']='22';this[_0xe7ba('0x140')](_0xbc8cca,_0x59e67a,_0x32c6b1);}else if(_0xbc8cca&&_0xbc8cca[_0xe7ba('0x148')]){if(_0x32c6b1[_0xe7ba('0x144')]==='16'&&this['actions'][_0x32c6b1[_0xe7ba('0xa7')]][_0xe7ba('0x6c')]){logger['info'](_0xe7ba('0x149'),_0x32c6b1[_0xe7ba('0xa7')],_0x32c6b1[_0xe7ba('0x144')],'\x20Queue',_0x59e67a['name'],_0xe7ba('0x6b'),_0x59e67a[_0xe7ba('0x2c')]);this[_0xe7ba('0x97')](_0x32c6b1,_0x32c6b1[_0xe7ba('0xa7')],_0x32c6b1[_0xe7ba('0x144')]);}else if(this[_0xe7ba('0x16')][_0x32c6b1[_0xe7ba('0xa7')]][_0xe7ba('0x6c')]){logger[_0xe7ba('0x53')](_0xe7ba('0x145'),_0x32c6b1[_0xe7ba('0xa7')],_0x32c6b1[_0xe7ba('0x144')],'\x20Queue',_0x59e67a[_0xe7ba('0x27')],_0xe7ba('0x6b'),_0x59e67a[_0xe7ba('0x2c')]);this[_0xe7ba('0x97')](_0x32c6b1,_0x32c6b1[_0xe7ba('0xa7')],_0x32c6b1[_0xe7ba('0x144')]);}}};Preview[_0xe7ba('0xf')][_0xe7ba('0x14a')]=function(_0x52433a){if(this[_0xe7ba('0x16')][_0x52433a[_0xe7ba('0x14b')]]&&_0x52433a[_0xe7ba('0x14b')]!==_0x52433a[_0xe7ba('0x14c')]){this[_0xe7ba('0x97')](_0x52433a,_0x52433a[_0xe7ba('0x14b')],_0x52433a[_0xe7ba('0xe7')]);}};Preview[_0xe7ba('0xf')]['syncHangupRequest']=function(_0x35c32e){if(this[_0xe7ba('0x16')][_0x35c32e[_0xe7ba('0xa7')]]&&_0x35c32e[_0xe7ba('0xa7')]!==_0x35c32e['uniqueid']&&!this[_0xe7ba('0x16')][_0x35c32e[_0xe7ba('0xa7')]][_0xe7ba('0x6c')]){if(_0x35c32e[_0xe7ba('0x144')]==='1'){this['callProgressDetectingCustomer'](_0x35c32e,_0x35c32e['linkedid'],_0x35c32e[_0xe7ba('0x144')]);}}};Preview[_0xe7ba('0xf')]['addVariable']=function(_0x9471fb,_0x44d2f1,_0x121d5e){if(this[_0xe7ba('0x16')][_0x9471fb]){if(_[_0xe7ba('0xff')](this[_0xe7ba('0x16')][_0x9471fb]['variables'])){this[_0xe7ba('0x16')][_0x9471fb][_0xe7ba('0x14d')]={};}this[_0xe7ba('0x16')][_0x9471fb]['variables'][_0x44d2f1]=_0x121d5e;}};Preview[_0xe7ba('0xf')]['syncVarSet']=function(_0x39f1ce){try{if(!_[_0xe7ba('0xff')](_0x39f1ce)){if(ut[_0xe7ba('0x14e')](_[_0xe7ba('0x14f')](_0x39f1ce[_0xe7ba('0x150')])[0x0])){this[_0xe7ba('0x151')](_0x39f1ce[_0xe7ba('0xab')],_[_0xe7ba('0x14f')](_0x39f1ce['variable'])[0x0],_0x39f1ce[_0xe7ba('0x152')]);}}}catch(_0x435266){logger[_0xe7ba('0x153')]('[syncVarSet][Preview]',util[_0xe7ba('0x154')](_0x435266,{'showHidden':![],'depth':null}));}};Preview[_0xe7ba('0xf')][_0xe7ba('0x20')]=function(_0x35ff64){if(_0x35ff64){if(this['actions'][_0x35ff64['transfertargetlinkedid']]){this[_0xe7ba('0x16')][_0x35ff64['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xe7ba('0xf')]['syncBlindTransfer']=function(_0x32aef0){if(_0x32aef0){if(this['actions'][_0x32aef0[_0xe7ba('0x155')]]){this['actions'][_0x32aef0[_0xe7ba('0x155')]][_0xe7ba('0x148')]=!![];}}};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 3716ee2..da6a0f1 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 _0xe72a=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','then','createHistory','catch','resolve','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','context','exten','assigned','lastAssignedTo','queuecallerexitreason','create'];(function(_0x4468d9,_0x3f81df){var _0x1dec42=function(_0x9c8a53){while(--_0x9c8a53){_0x4468d9['push'](_0x4468d9['shift']());}};_0x1dec42(++_0x3f81df);}(_0xe72a,0x1e1));var _0xae72=function(_0x45fdc9,_0x1f8ff3){_0x45fdc9=_0x45fdc9-0x0;var _0x35cccc=_0xe72a[_0x45fdc9];return _0x35cccc;};'use strict';var util=require('util');var BPromise=require(_0xae72('0x0'));var logger=require(_0xae72('0x1'))(_0xae72('0x2'));var _=require('lodash');var cmHopper=require(_0xae72('0x3'));var cmHopperFinal=require(_0xae72('0x4'));var cmHopperHistory=require(_0xae72('0x5'));var cmHopperBlack=require(_0xae72('0x6'));var voiceQueueRt=require(_0xae72('0x7'));var agentReportPreview=require(_0xae72('0x8'));var voiceQueueReport=require(_0xae72('0x9'));function loggerCatch(_0x21cb96){return function(_0xed10b5){logger['error'](_0x21cb96,util[_0xae72('0xa')](_0xed10b5,{'showHidden':![],'depth':null}));};}function create(_0x267c2b){return BPromise['resolve']()[_0xae72('0xb')](cmHopperHistory[_0xae72('0xc')](_0x267c2b))[_0xae72('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x564141){return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](agentReportPreview[_0xae72('0xc')](_0x564141))[_0xae72('0xd')](loggerCatch(_0xae72('0xf')));}function moveContact(_0xfed6e0){return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](cmHopper['moveContactManagedDialer'](_0xfed6e0,!![]))[_0xae72('0xd')](loggerCatch(_0xae72('0x10')));}exports[_0xae72('0x11')]=function(_0x2d616f){return BPromise['resolve']()[_0xae72('0xb')](cmHopperBlack[_0xae72('0x11')](_0x2d616f))['catch'](loggerCatch(_0xae72('0x12')));};exports['getContactPreview']=function(_0x34ea01){return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](cmHopper['getContactPreview'](_0x34ea01))[_0xae72('0xd')](loggerCatch(_0xae72('0x13')));};exports[_0xae72('0xc')]=function(_0x5871f3,_0x3ea0fc){create(_0x5871f3)[_0xae72('0xd')](loggerCatch(_0x3ea0fc));moveContact(_0x5871f3)[_0xae72('0xd')](loggerCatch(_0x3ea0fc));};exports[_0xae72('0x14')]=function(_0x4ecc96,_0x5c1ca4){createAgent(_0x4ecc96)[_0xae72('0xd')](loggerCatch(_0x5c1ca4));};exports['createCustomerHistory']=function(_0x1b6a43,_0x1b5023){create(_0x1b6a43)[_0xae72('0xd')](loggerCatch(_0x1b5023));};exports[_0xae72('0x15')]=function(_0x20fc7e,_0x5193fa){moveContact(_0x20fc7e)['catch'](loggerCatch(_0x5193fa));};exports[_0xae72('0x16')]=function(_0x2251f4,_0x3d9f4c,_0xfd36f0){if(_0x3d9f4c){_0x2251f4[_0xae72('0x17')]=null;}if(_0xfd36f0){_0x2251f4[_0xae72('0x18')]=![];}return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](cmHopper[_0xae72('0x16')](_0x2251f4))[_0xae72('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xae72('0x19')]=function(_0x15a384){return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](cmHopper[_0xae72('0x19')](_0x15a384))[_0xae72('0xd')](loggerCatch(_0xae72('0x1a')));};exports[_0xae72('0x1b')]=function(_0x59b45f){return BPromise[_0xae72('0xe')]()['then'](cmHopper[_0xae72('0x1b')]({'UserId':null},_0x59b45f,0x1))['catch'](loggerCatch(_0xae72('0x1c')));};exports[_0xae72('0x1d')]=function(_0x305762){return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](cmHopper['unlockContact']({'active':![]},_0x305762,0x1))['catch'](loggerCatch(_0xae72('0x1e')));};exports[_0xae72('0x1f')]=function(_0x150305){var _0x43c70c={};_0x43c70c[_0xae72('0x20')]=_0x150305['type'];_0x43c70c[_0xae72('0x21')]=_0x150305[_0xae72('0x21')];_0x43c70c[_0xae72('0x22')]=_0x150305[_0xae72('0x22')];_0x43c70c[_0xae72('0x23')]=_0x150305[_0xae72('0x23')];_0x43c70c[_0xae72('0x24')]=_0x150305[_0xae72('0x24')];_0x43c70c[_0xae72('0x25')]=_0x150305[_0xae72('0x26')];_0x43c70c[_0xae72('0x27')]=_0x150305[_0xae72('0x26')];_0x43c70c[_0xae72('0x28')]=0x1;_0x43c70c['queuecallercompleteAt']=_0x150305['endtime'];_0x43c70c[_0xae72('0x29')]=_0x150305[_0xae72('0x2a')];_0x43c70c[_0xae72('0x2b')]='from-sip';_0x43c70c[_0xae72('0x2c')]='xcally-motion-preview';_0x43c70c['holdtime']=0x0;_0x43c70c[_0xae72('0x2d')]=0x1;_0x43c70c[_0xae72('0x2e')]=_0x150305[_0xae72('0x2a')];_0x43c70c[_0xae72('0x2f')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0xae72('0x30')](_0x43c70c))[_0xae72('0xd')](loggerCatch(_0xae72('0x31')));};exports['getContactRecallMe']=function(_0x4fd020,_0x1c257f){return BPromise[_0xae72('0xe')]()[_0xae72('0xb')](cmHopper[_0xae72('0x32')](_0x4fd020,_0x1c257f))[_0xae72('0xd')](loggerCatch(_0xae72('0x33')));};exports[_0xae72('0x34')]=function(_0x5a762a){return BPromise['resolve']()['then'](cmHopper[_0xae72('0x16')](_0x5a762a,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x4763=['createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve'];(function(_0x5dcca6,_0x1672e8){var _0x178cae=function(_0x3f2ef0){while(--_0x3f2ef0){_0x5dcca6['push'](_0x5dcca6['shift']());}};_0x178cae(++_0x1672e8);}(_0x4763,0x1f3));var _0x3476=function(_0xadc0b4,_0x54662a){_0xadc0b4=_0xadc0b4-0x0;var _0x509407=_0x4763[_0xadc0b4];return _0x509407;};'use strict';var util=require(_0x3476('0x0'));var BPromise=require(_0x3476('0x1'));var logger=require(_0x3476('0x2'))(_0x3476('0x3'));var _=require('lodash');var cmHopper=require(_0x3476('0x4'));var cmHopperFinal=require(_0x3476('0x5'));var cmHopperHistory=require(_0x3476('0x6'));var cmHopperBlack=require(_0x3476('0x7'));var voiceQueueRt=require(_0x3476('0x8'));var agentReportPreview=require(_0x3476('0x9'));var voiceQueueReport=require(_0x3476('0xa'));function loggerCatch(_0x2286a9){return function(_0x12743b){logger[_0x3476('0xb')](_0x2286a9,util[_0x3476('0xc')](_0x12743b,{'showHidden':![],'depth':null}));};}function create(_0x5844ca){return BPromise[_0x3476('0xd')]()['then'](cmHopperHistory[_0x3476('0xe')](_0x5844ca))[_0x3476('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x4b3953){return BPromise[_0x3476('0xd')]()['then'](agentReportPreview[_0x3476('0xe')](_0x4b3953))['catch'](loggerCatch(_0x3476('0x10')));}function moveContact(_0x584084){return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](cmHopper[_0x3476('0x12')](_0x584084,!![]))[_0x3476('0xf')](loggerCatch(_0x3476('0x13')));}exports['checkIsBlackList']=function(_0x4bbec7){return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](cmHopperBlack[_0x3476('0x14')](_0x4bbec7))[_0x3476('0xf')](loggerCatch(_0x3476('0x15')));};exports[_0x3476('0x16')]=function(_0x426d5b){return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](cmHopper['getContactPreview'](_0x426d5b))['catch'](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x3b0829,_0x2ce450){create(_0x3b0829)[_0x3476('0xf')](loggerCatch(_0x2ce450));moveContact(_0x3b0829)['catch'](loggerCatch(_0x2ce450));};exports['createAgentHistory']=function(_0x49e28c,_0x4438bb){createAgent(_0x49e28c)['catch'](loggerCatch(_0x4438bb));};exports[_0x3476('0x17')]=function(_0x306d80,_0x1c6003){create(_0x306d80)[_0x3476('0xf')](loggerCatch(_0x1c6003));};exports[_0x3476('0x18')]=function(_0xffaac6,_0x17794c){moveContact(_0xffaac6)[_0x3476('0xf')](loggerCatch(_0x17794c));};exports['rescheduleContact']=function(_0x153436,_0x3a5a0d,_0x13ed5d){if(_0x3a5a0d){_0x153436[_0x3476('0x19')]=null;}if(_0x13ed5d){_0x153436['active']=![];}return BPromise['resolve']()[_0x3476('0x11')](cmHopper[_0x3476('0x1a')](_0x153436))['catch'](loggerCatch(_0x3476('0x1b')));};exports[_0x3476('0x1c')]=function(_0x10d3b1){return BPromise['resolve']()[_0x3476('0x11')](cmHopper['countReScheduled'](_0x10d3b1))[_0x3476('0xf')](loggerCatch('[countReScheduled]\x20'));};exports[_0x3476('0x1d')]=function(_0x5e5491){return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](cmHopper['unlockContact']({'UserId':null},_0x5e5491,0x1))['catch'](loggerCatch(_0x3476('0x1e')));};exports[_0x3476('0x1f')]=function(_0x165246){return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](cmHopper['unlockContact']({'active':![]},_0x165246,0x1))['catch'](loggerCatch(_0x3476('0x20')));};exports[_0x3476('0x21')]=function(_0x1976ec){var _0x3bf7ba={};_0x3bf7ba['type']=_0x1976ec['type'];_0x3bf7ba['uniqueid']=_0x1976ec[_0x3476('0x22')];_0x3bf7ba[_0x3476('0x23')]=_0x1976ec[_0x3476('0x23')];_0x3bf7ba[_0x3476('0x24')]=_0x1976ec[_0x3476('0x24')];_0x3bf7ba[_0x3476('0x25')]=_0x1976ec[_0x3476('0x25')];_0x3bf7ba['queuecallerjoinAt']=_0x1976ec[_0x3476('0x26')];_0x3bf7ba[_0x3476('0x27')]=_0x1976ec[_0x3476('0x26')];_0x3bf7ba[_0x3476('0x28')]=0x1;_0x3bf7ba[_0x3476('0x29')]=_0x1976ec[_0x3476('0x2a')];_0x3bf7ba[_0x3476('0x2b')]=_0x1976ec[_0x3476('0x2c')];_0x3bf7ba['context']=_0x3476('0x2d');_0x3bf7ba[_0x3476('0x2e')]=_0x3476('0x2f');_0x3bf7ba[_0x3476('0x30')]=0x0;_0x3bf7ba[_0x3476('0x31')]=0x1;_0x3bf7ba['lastAssignedTo']=_0x1976ec[_0x3476('0x2c')];_0x3bf7ba[_0x3476('0x32')]=_0x3476('0x33');return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](voiceQueueReport[_0x3476('0x34')](_0x3bf7ba))[_0x3476('0xf')](loggerCatch(_0x3476('0x35')));};exports[_0x3476('0x36')]=function(_0x31da46,_0x2523fc){return BPromise[_0x3476('0xd')]()[_0x3476('0x11')](cmHopper[_0x3476('0x36')](_0x31da46,_0x2523fc))[_0x3476('0xf')](loggerCatch(_0x3476('0x37')));};exports['rescheduleContactInQueue']=function(_0x4033b8){return BPromise[_0x3476('0xd')]()['then'](cmHopper['rescheduleContact'](_0x4033b8,!![],!![]))[_0x3476('0xf')](loggerCatch(_0x3476('0x38')));}; \ 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 aace609..d95f992 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 _0x491c=['channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','push','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','countglobal','callback','callbackuniqueid','recallme','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','UserId','logCustomer','answertime','RECALL','BOOKED','uniqueid','originate'];(function(_0x17e696,_0xad1c39){var _0x1a9e33=function(_0x28d22a){while(--_0x28d22a){_0x17e696['push'](_0x17e696['shift']());}};_0x1a9e33(++_0xad1c39);}(_0x491c,0xcb));var _0xc491=function(_0x2200ec,_0x13b192){_0x2200ec=_0x2200ec-0x0;var _0x2954c2=_0x491c[_0x2200ec];return _0x2954c2;};'use strict';var util=require(_0xc491('0x0'));var _=require(_0xc491('0x1'));var moment=require('moment');var logger=require(_0xc491('0x2'))('preview');var ipAgi=process[_0xc491('0x3')][_0xc491('0x4')]||_0xc491('0x5');function getSeconds(_0x1dc95f,_0x3f6a68){var _0x4274ee=moment(_0x1dc95f)[_0xc491('0x6')](0x0);var _0x23631b=moment(_0x3f6a68)[_0xc491('0x6')](0x0);return _0x4274ee[_0xc491('0x7')](_0x23631b,_0xc491('0x8'));}exports[_0xc491('0x9')]=function(_0x3d638f){return function(_0x5a3fc0){logger[_0xc491('0xa')](_0x3d638f,util[_0xc491('0xb')](_0x5a3fc0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3aa82a,_0x382be4){logger[_0xc491('0xc')](_0x3aa82a,util[_0xc491('0xb')](_0x382be4,{'showHidden':![],'depth':null}));};exports[_0xc491('0xd')]=function(_0x50122e,_0x23061f){logger[_0xc491('0xa')](_0x50122e,util[_0xc491('0xb')](_0x23061f,{'showHidden':![],'depth':null}));};exports[_0xc491('0xe')]=function(_0x422580){return function(_0x5d2ca0){logger[_0xc491('0xc')](_0x422580,util[_0xc491('0xb')](_0x5d2ca0,{'showHidden':![],'depth':null}));};};exports[_0xc491('0xf')]=function(_0x2728e8,_0x4f076b,_0x3a4f14){return{'message':_0x2728e8,'unlock':_0x4f076b,'active':_0x3a4f14};};exports[_0xc491('0x10')]=function(_0x1f6a85,_0x43448b,_0x490e66){if(!_[_0xc491('0x11')](_0x490e66)&&_0xc491('0x12')===typeof _0x490e66&&!_[_0xc491('0x13')](_0x490e66)){if(!_['isUndefined'](_0x43448b)&&_0xc491('0x12')===typeof _0x43448b&&!_[_0xc491('0x13')](_0x43448b)){return util[_0xc491('0x14')](_0xc491('0x15'),_0x43448b,_0x490e66);}return util[_0xc491('0x14')](_0xc491('0x15'),_0x490e66,_0x490e66);}if(!_[_0xc491('0x11')](_0x1f6a85)&&'string'===typeof _0x1f6a85&&!_[_0xc491('0x13')](_0x1f6a85)){return _0x1f6a85;}return _0xc491('0x16');};exports['isActive']=function(_0x320751){if(_[_0xc491('0x17')](_0x320751)){return![];}return _0x320751;};exports[_0xc491('0x18')]=function(_0x2fccd9,_0x3a5200,_0x11fd2,_0x4b9184,_0x56e85a,_0x45483f){var _0x46a411={'XMD-QUEUE':_0x3a5200[_0xc491('0x19')]?_0x3a5200[_0xc491('0x19')]['name']:'','XMD-CALLERID':_0x4b9184,'XMD-CALLERID-PREVIEW':_0x45483f?util[_0xc491('0x14')]('\x22%s\x22\x20<%s>',_0x45483f[_0xc491('0x1a')],_0x45483f[_0xc491('0x1b')]):_0x4b9184,'XMD-DIALID':_0x56e85a,'XMD-CONTACTID':_0x3a5200[_0xc491('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4b9184,'XMD-VOICEQUEUEID':_0x3a5200[_0xc491('0x1d')],'XMD-DIALCHANNEL':_0x11fd2,'XMD-DIALTIMEOUT':_0x2fccd9[_0xc491('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xc491('0x1f'),_0x2fccd9[_0xc491('0x20')]?'g':'',_[_0xc491('0x13')](_0x2fccd9[_0xc491('0x21')])?'':_0xc491('0x22')),'XMD-DIALURL':_0x2fccd9[_0xc491('0x23')]||'','XMD-AGI':_0x2fccd9['dialQueueProject']?util[_0xc491('0x14')](_0xc491('0x24'),ipAgi,_0x2fccd9['dialQueueProject']):_0xc491('0x25'),'XMD-AGIAFTER':_0x2fccd9[_0xc491('0x20')]?util[_0xc491('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2fccd9[_0xc491('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x45483f?_0x45483f[_0xc491('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x45483f?_0x45483f[_0xc491('0x27')]:'','XMD-DESTINATION':_0xc491('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x2fccd9[_0xc491('0x21')])){_0x46a411[util[_0xc491('0x14')]('%s',_0xc491('0x29'))]=_0x2fccd9[_0xc491('0x21')];_0x46a411[util[_0xc491('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x56e85a;}if(_0x3a5200&&_0x3a5200[_0xc491('0x2a')]){for(var _0x5ea4e1 in _0x3a5200['Contact']){if(_0x3a5200['Contact'][_0xc491('0x2b')](_0x5ea4e1)){if(!_[_0xc491('0x17')](_0x3a5200[_0xc491('0x2a')][_0x5ea4e1])&&_0x5ea4e1!=='id'&&_0x5ea4e1!==_0xc491('0x2c')&&_0x5ea4e1!==_0xc491('0x2d')&&_0x5ea4e1!=='updatedAt'){_0x46a411[util['format'](_0xc491('0x2e'),_0xc491('0x2f'),_[_0xc491('0x30')](_0x5ea4e1))]=_0x3a5200[_0xc491('0x2a')][_0x5ea4e1];}}}}return _0x46a411;};exports[_0xc491('0x31')]=function(_0x5ed212){var _0x167d7e={};for(var _0x22d4c2 in _0x5ed212){if(_0x5ed212[_0xc491('0x2b')](_0x22d4c2)){_0x167d7e[util[_0xc491('0x14')]('%s',_['toLower'](_0x22d4c2))]=_0x5ed212[_0x22d4c2];}}return{'variables':_0x167d7e};};exports[_0xc491('0x32')]=function(_0x4c074f,_0x12a4f3){if(!_[_0xc491('0x17')](_0x4c074f)){if(_0x4c074f['hasOwnProperty']('originated')){if(_0x4c074f[_0xc491('0x33')]>0x0){_0x4c074f['originated']-=0x1;}else{logger[_0xc491('0xa')](_0xc491('0x34'),_0x12a4f3);}}}else{logger[_0xc491('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x12a4f3);}};exports[_0xc491('0x35')]=function(_0x3cced6){var _0x21f849=moment()[_0xc491('0x14')](_0xc491('0x36'));_0x3cced6['state']=0xd;_0x3cced6[_0xc491('0x37')]=_0xc491('0x38');_0x3cced6[_0xc491('0x39')]=_0x21f849;_0x3cced6[_0xc491('0x3a')]=_0x21f849;_0x3cced6[_0xc491('0x3b')]=_0x21f849;};exports[_0xc491('0x3c')]=function(_0x3b3e66,_0x5a5475,_0x36d487){var _0x1ddfa2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3b3e66[_0xc491('0x3d')]=_0x5a5475;_0x3b3e66[_0xc491('0x37')]=_0x36d487;_0x3b3e66[_0xc491('0x3a')]=_0x1ddfa2;_0x3b3e66[_0xc491('0x3e')]=getSeconds(_0x3b3e66[_0xc491('0x3a')],_0x3b3e66[_0xc491('0x39')]);};exports[_0xc491('0x3f')]=function(_0x19c41c,_0x1b2a95,_0x5b5ea1){_0x19c41c['membername']=_0x1b2a95;_0x19c41c[_0xc491('0x40')]=_0x5b5ea1;};exports[_0xc491('0x41')]=function(_0x39decc,_0x55259e,_0x508ac9){var _0x1e627a=moment()[_0xc491('0x14')](_0xc491('0x36'));_0x39decc[_0xc491('0x3d')]=_0x55259e;_0x39decc[_0xc491('0x37')]=_0x508ac9;_0x39decc['responsetime']=_0x39decc[_0xc491('0x3a')]?_0x39decc[_0xc491('0x3a')]:_0x1e627a;_0x39decc[_0xc491('0x3b')]=_0x39decc[_0xc491('0x3b')]?_0x39decc[_0xc491('0x3b')]:_0x1e627a;_0x39decc['ringtime']=getSeconds(_0x39decc[_0xc491('0x3a')]||0x0,_0x39decc[_0xc491('0x39')]||0x0);_0x39decc['talktime']=_0x39decc[_0xc491('0x42')]?getSeconds(_0x39decc['endtime'],_0x39decc[_0xc491('0x42')]):0x0;};exports['isFailure']=function(_0x18019d){return _0x18019d==='Failure';};exports['variablesAction']=function(_0x3cc05f,_0x32a0c1,_0x3a6031,_0x180f87,_0x53dd80){var _0x16e379=_0x180f87?_0xc491('0x43'):_0x3cc05f['calleridname'];_0x16e379=_0x53dd80?_0xc491('0x44'):_0x16e379;return{'actionid':_0x3cc05f[_0xc491('0x45')],'action':_0xc491('0x46'),'channel':_0x3cc05f[_0xc491('0x47')],'callerid':util[_0xc491('0x14')](_0xc491('0x15'),_0x16e379,_0x3cc05f[_0xc491('0x1b')]),'Exten':_0xc491('0x28'),'Context':_0xc491('0x48'),'Priority':'1','variable':_0x3a6031,'timeout':(_0x32a0c1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3cc05f['uniqueid']};};exports[_0xc491('0x49')]=function(_0x1c8f40){return _0x1c8f40[_0xc491('0x4a')]+_0x1c8f40[_0xc491('0x4b')]+_0x1c8f40[_0xc491('0x4c')]+_0x1c8f40[_0xc491('0x4d')]+_0x1c8f40[_0xc491('0x4e')];};exports[_0xc491('0x4f')]=function(_0x4b3fe2){var _0x5257a9=_[_0xc491('0x50')](_0x4b3fe2);_0x5257a9[_0xc491('0x3d')]=0xf;_0x5257a9['statedesc']=_0xc491('0x51');return _0x5257a9;};exports[_0xc491('0x52')]=function(_0x6e643a,_0x19b672,_0x227661){var _0x4f432f={};_0x4f432f[_0x19b672]=_0x6e643a[_0x19b672];_0x4f432f[_0xc491('0x53')]=![];_0x4f432f['scheduledat']=moment()[_0xc491('0x54')](_0x227661,_0xc491('0x55'))[_0xc491('0x14')](_0xc491('0x36'));_0x4f432f[_0xc491('0x1c')]=_0x6e643a['ContactId'];_0x4f432f[_0xc491('0x56')]=_0x6e643a[_0xc491('0x56')];_0x4f432f['VoiceQueueId']=_0x6e643a[_0xc491('0x1d')]||undefined;return _0x4f432f;};exports[_0xc491('0x57')]=function(_0x27f827,_0x68d33f){if(!_[_0xc491('0x17')](_0x27f827)){if(_0x27f827[_0xc491('0x58')]>0x0){_0x27f827[_0xc491('0x58')]-=0x1;}else{logger['error'](_0x68d33f,_0xc491('0x59'));}}else{logger[_0xc491('0xa')](_0x68d33f,_0xc491('0x5a'));}};exports[_0xc491('0x5b')]=function(_0x18a762){if(_0x18a762<=0x0){return!![];}return![];};exports['buildObj']=function(_0x162b1c,_0x52aebe,_0x29649b){_0x162b1c[_0xc491('0x5c')]=_0x52aebe;_0x162b1c['name']=_0x162b1c[_0xc491('0x5d')];_0x162b1c[_0xc491('0x5e')]=_0x162b1c['channelAgent'];_0x162b1c['motionChannel']=_0xc491('0x5f');if(_0x29649b){_0x162b1c[_0xc491('0x60')]=_0x29649b[_0xc491('0x60')];}return _0x162b1c;};exports[_0xc491('0x61')]=function(_0x5352d4){var _0x4a25b8={};_0x4a25b8[_0xc491('0x5d')]=_0x5352d4['queue'];_0x4a25b8[_0xc491('0x5e')]=_0x5352d4[_0xc491('0x47')];_0x4a25b8[_0xc491('0x45')]=_0x5352d4[_0xc491('0x45')];return _0x4a25b8;};exports[_0xc491('0x62')]=function(_0xdd07e3){var _0x4d3133=[];for(var _0x2b218b in _0xdd07e3){if(_0xdd07e3['hasOwnProperty'](_0x2b218b)){if(!_[_0xc491('0x17')](_0xdd07e3[_0x2b218b])&&_0xdd07e3[_0x2b218b][_0xc491('0x3d')]==='not_inuse'&&_0xdd07e3[_0x2b218b][_0xc491('0x63')]===_0xc491('0x64')){_0x4d3133[_0xc491('0x65')](_0xdd07e3[_0x2b218b]['id']);}}}return _0x4d3133;};exports['getDiff']=function(_0x1232ed){var _0x79fda2=moment()[_0xc491('0x6')](0x0);var _0x4d272f=moment(_0x1232ed)['milliseconds'](0x0);return _0x79fda2[_0xc491('0x7')](_0x4d272f,'seconds');};exports['createBody']=function(_0x2c08b6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c08b6[_0xc491('0x1c')],'ListId':_0x2c08b6['ListId'],'VoiceQueueId':_0x2c08b6[_0xc491('0x1d')]||undefined,'CampaignId':_0x2c08b6[_0xc491('0x66')]||undefined};};exports[_0xc491('0x67')]=function(_0x2f85b5){if(_0x2f85b5===_0xc491('0x45')||_0x2f85b5===_0xc491('0x68')||_0x2f85b5===_0xc491('0x5d')||_0x2f85b5===_0xc491('0x69')||_0x2f85b5===_0xc491('0x6a')||_0x2f85b5==='dialAnswer'||_0x2f85b5==='membername'||_0x2f85b5===_0xc491('0x47')||_0x2f85b5===_0xc491('0x1a')||_0x2f85b5===_0xc491('0x53')||_0x2f85b5===_0xc491('0x1b')||_0x2f85b5===_0xc491('0x6b')||_0x2f85b5===_0xc491('0x4a')||_0x2f85b5==='countcongestionretry'||_0x2f85b5==='countnoanswerretry'||_0x2f85b5===_0xc491('0x6c')||_0x2f85b5===_0xc491('0x6d')||_0x2f85b5===_0xc491('0x6e')||_0x2f85b5==='callbackat'||_0x2f85b5===_0xc491('0x6f')||_0x2f85b5===_0xc491('0x1c')||_0x2f85b5===_0xc491('0x56')||_0x2f85b5===_0xc491('0x40')||_0x2f85b5===_0xc491('0x1d')||_0x2f85b5==='sipcallid'||_0x2f85b5==='xmd-voicequeueid'||_0x2f85b5==='xmd-queue'||_0x2f85b5==='xmd-phone'||_0x2f85b5===_0xc491('0x70')||_0x2f85b5==='xmd-dialurl'||_0x2f85b5===_0xc491('0x71')||_0x2f85b5===_0xc491('0x72')||_0x2f85b5===_0xc491('0x73')||_0x2f85b5===_0xc491('0x74')||_0x2f85b5===_0xc491('0x75')||_0x2f85b5===_0xc491('0x76')||_0x2f85b5===_0xc491('0x77')||_0x2f85b5==='xmd-agiafter'||_0x2f85b5===_0xc491('0x78')||_0x2f85b5==='rtpaudioqos'||_0x2f85b5===_0xc491('0x79')||_0x2f85b5===_0xc491('0x7a')||_0x2f85b5==='rtpaudioqosjitterbridged'||_0x2f85b5===_0xc491('0x7b')||_0x2f85b5===_0xc491('0x7c')||_0x2f85b5===_0xc491('0x7d')||_0x2f85b5===_0xc491('0x7e')||_0x2f85b5===_0xc491('0x7f')||_0x2f85b5===_0xc491('0x79')||_0x2f85b5===_0xc491('0x7a')||_0x2f85b5===_0xc491('0x80')||_0x2f85b5===_0xc491('0x7b')||_0x2f85b5===_0xc491('0x7c')||_0x2f85b5==='rtpaudioqosrtt'||_0x2f85b5===_0xc491('0x7e')||_0x2f85b5===_0xc491('0x81')||_0x2f85b5==='bridgepvtcallid'||_0x2f85b5===_0xc491('0x3d')||_0x2f85b5===_0xc491('0x37')){return![];}return!![];};exports[_0xc491('0x82')]=function(_0x16f49a,_0x11c13b){var _0x106b43,_0x5c20d8,_0x4a56c8;if(_0x11c13b<=0x0){_0x11c13b=0x1;}_0x106b43=new RegExp('\x5cw{0,'+_0x11c13b+'}$');_0x5c20d8=Math['pow'](0xa,_0x11c13b-0x1);_0x4a56c8=Math[_0xc491('0x83')](0xa,_0x11c13b)-0x1;return util['format']('%s',_[_0xc491('0x84')](_0x16f49a,_0x106b43,_[_0xc491('0x85')](_0x5c20d8,_0x4a56c8)));};exports[_0xc491('0x86')]=function(_0xbdf963){var _0x42a267=_0xbdf963[_0xc491('0x87')](/"(.*?)"/);return _0x42a267?_0x42a267[0x1]:_0xbdf963;};exports[_0xc491('0x88')]=function(_0x35123d){var _0x23ac36=_0x35123d[_0xc491('0x87')](/<(.*?)>/);return _0x23ac36?_0x23ac36[0x1]:_0x35123d;}; \ No newline at end of file +var _0xe7f8=['idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callbackuniqueid','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','replace','random','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isEmpty','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','updatedAt','XMD-','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logAgent','statedesc','logLookAgent','membername','logCustomer','endtime','talktime','answertime','variablesAction','calleridname','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','reachable','push','createBody','filterKey'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xe7f8,0xac));var _0x8e7f=function(_0x441bad,_0x27ce55){_0x441bad=_0x441bad-0x0;var _0x1f94d1=_0xe7f8[_0x441bad];return _0x1f94d1;};'use strict';var util=require(_0x8e7f('0x0'));var _=require(_0x8e7f('0x1'));var moment=require('moment');var logger=require(_0x8e7f('0x2'))(_0x8e7f('0x3'));var ipAgi=process[_0x8e7f('0x4')][_0x8e7f('0x5')]||'127.0.0.1';function getSeconds(_0x1c736e,_0x2cf404){var _0x26afa6=moment(_0x1c736e)[_0x8e7f('0x6')](0x0);var _0x4befa2=moment(_0x2cf404)['milliseconds'](0x0);return _0x26afa6[_0x8e7f('0x7')](_0x4befa2,_0x8e7f('0x8'));}exports[_0x8e7f('0x9')]=function(_0x456e8e){return function(_0x4db72b){logger[_0x8e7f('0xa')](_0x456e8e,util[_0x8e7f('0xb')](_0x4db72b,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1c050c,_0x2dc74f){logger[_0x8e7f('0xc')](_0x1c050c,util['inspect'](_0x2dc74f,{'showHidden':![],'depth':null}));};exports[_0x8e7f('0xd')]=function(_0x4f3547,_0x4d03c2){logger[_0x8e7f('0xa')](_0x4f3547,util['inspect'](_0x4d03c2,{'showHidden':![],'depth':null}));};exports[_0x8e7f('0xe')]=function(_0x5b8ba6){return function(_0x401048){logger['info'](_0x5b8ba6,util['inspect'](_0x401048,{'showHidden':![],'depth':null}));};};exports[_0x8e7f('0xf')]=function(_0x218321,_0x833fc0,_0x2fb31f){return{'message':_0x218321,'unlock':_0x833fc0,'active':_0x2fb31f};};exports[_0x8e7f('0x10')]=function(_0x2ba34e,_0x366607,_0x1c911b){if(!_['isUndefined'](_0x1c911b)&&'string'===typeof _0x1c911b&&!_[_0x8e7f('0x11')](_0x1c911b)){if(!_[_0x8e7f('0x12')](_0x366607)&&_0x8e7f('0x13')===typeof _0x366607&&!_['isEmpty'](_0x366607)){return util['format'](_0x8e7f('0x14'),_0x366607,_0x1c911b);}return util[_0x8e7f('0x15')](_0x8e7f('0x14'),_0x1c911b,_0x1c911b);}if(!_['isUndefined'](_0x2ba34e)&&_0x8e7f('0x13')===typeof _0x2ba34e&&!_[_0x8e7f('0x11')](_0x2ba34e)){return _0x2ba34e;}return _0x8e7f('0x16');};exports[_0x8e7f('0x17')]=function(_0x193594){if(_['isNil'](_0x193594)){return![];}return _0x193594;};exports[_0x8e7f('0x18')]=function(_0x3f8d4c,_0x2695ae,_0x54ca3f,_0x594142,_0x2cc8fe,_0x516d0c){var _0x45ea64={'XMD-QUEUE':_0x2695ae['Queue']?_0x2695ae[_0x8e7f('0x19')][_0x8e7f('0x1a')]:'','XMD-CALLERID':_0x594142,'XMD-CALLERID-PREVIEW':_0x516d0c?util[_0x8e7f('0x15')](_0x8e7f('0x14'),_0x516d0c['calleridname'],_0x516d0c[_0x8e7f('0x1b')]):_0x594142,'XMD-DIALID':_0x2cc8fe,'XMD-CONTACTID':_0x2695ae['ContactId'],'XMD-CDRTYPE':_0x8e7f('0x1c'),'CALLERID(all)':_0x594142,'XMD-VOICEQUEUEID':_0x2695ae[_0x8e7f('0x1d')],'XMD-DIALCHANNEL':_0x54ca3f,'XMD-DIALTIMEOUT':_0x3f8d4c[_0x8e7f('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x8e7f('0x15')]('\x22rtTxX%s%s\x22',_0x3f8d4c[_0x8e7f('0x1f')]?'g':'',_[_0x8e7f('0x11')](_0x3f8d4c[_0x8e7f('0x20')])?'':_0x8e7f('0x21')),'XMD-DIALURL':_0x3f8d4c['dialPreviewUrl']||'','XMD-AGI':_0x3f8d4c[_0x8e7f('0x22')]?util[_0x8e7f('0x15')](_0x8e7f('0x23'),ipAgi,_0x3f8d4c['dialQueueProject']):_0x8e7f('0x24'),'XMD-AGIAFTER':_0x3f8d4c[_0x8e7f('0x1f')]?util[_0x8e7f('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3f8d4c[_0x8e7f('0x1f')]):_0x8e7f('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x516d0c?_0x516d0c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x516d0c?_0x516d0c[_0x8e7f('0x25')]:'','XMD-DESTINATION':_0x8e7f('0x26'),'SIPADDHEADER':_0x8e7f('0x27')};if(!_['isEmpty'](_0x3f8d4c['monitor_format'])){_0x45ea64[util['format']('%s',_0x8e7f('0x28'))]=_0x3f8d4c['monitor_format'];_0x45ea64[util['format']('%s',_0x8e7f('0x29'))]=_0x2cc8fe;}if(_0x2695ae&&_0x2695ae[_0x8e7f('0x2a')]){for(var _0x23be94 in _0x2695ae['Contact']){if(_0x2695ae['Contact'][_0x8e7f('0x2b')](_0x23be94)){if(!_[_0x8e7f('0x2c')](_0x2695ae[_0x8e7f('0x2a')][_0x23be94])&&_0x23be94!=='id'&&_0x23be94!==_0x8e7f('0x2d')&&_0x23be94!=='createdAt'&&_0x23be94!==_0x8e7f('0x2e')){_0x45ea64[util[_0x8e7f('0x15')]('%s%s',_0x8e7f('0x2f'),_['toUpper'](_0x23be94))]=_0x2695ae[_0x8e7f('0x2a')][_0x23be94];}}}}return _0x45ea64;};exports['toLowerVariables']=function(_0x100753){var _0x116f63={};for(var _0x41f941 in _0x100753){if(_0x100753[_0x8e7f('0x2b')](_0x41f941)){_0x116f63[util[_0x8e7f('0x15')]('%s',_['toLower'](_0x41f941))]=_0x100753[_0x41f941];}}return{'variables':_0x116f63};};exports['updateOriginated']=function(_0x212963,_0x4a5816){if(!_[_0x8e7f('0x2c')](_0x212963)){if(_0x212963[_0x8e7f('0x2b')]('originated')){if(_0x212963[_0x8e7f('0x30')]>0x0){_0x212963[_0x8e7f('0x30')]-=0x1;}else{logger['error'](_0x8e7f('0x31'),_0x4a5816);}}}else{logger[_0x8e7f('0xa')](_0x8e7f('0x32'),_0x4a5816);}};exports[_0x8e7f('0x33')]=function(_0x4b23cf){var _0x56d95d=moment()[_0x8e7f('0x15')](_0x8e7f('0x34'));_0x4b23cf[_0x8e7f('0x35')]=0xd;_0x4b23cf['statedesc']=_0x8e7f('0x36');_0x4b23cf[_0x8e7f('0x37')]=_0x56d95d;_0x4b23cf[_0x8e7f('0x38')]=_0x56d95d;_0x4b23cf['endtime']=_0x56d95d;};exports[_0x8e7f('0x39')]=function(_0x5b9d83,_0x297677,_0x5269e9){var _0x4bef44=moment()[_0x8e7f('0x15')](_0x8e7f('0x34'));_0x5b9d83[_0x8e7f('0x35')]=_0x297677;_0x5b9d83[_0x8e7f('0x3a')]=_0x5269e9;_0x5b9d83[_0x8e7f('0x38')]=_0x4bef44;_0x5b9d83['ringtime']=getSeconds(_0x5b9d83[_0x8e7f('0x38')],_0x5b9d83[_0x8e7f('0x37')]);};exports[_0x8e7f('0x3b')]=function(_0x125bc4,_0x3be4ba,_0x320330){_0x125bc4[_0x8e7f('0x3c')]=_0x3be4ba;_0x125bc4['UserId']=_0x320330;};exports[_0x8e7f('0x3d')]=function(_0x29c7b6,_0xae8e91,_0xf0a464){var _0x1d8684=moment()[_0x8e7f('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c7b6['state']=_0xae8e91;_0x29c7b6[_0x8e7f('0x3a')]=_0xf0a464;_0x29c7b6['responsetime']=_0x29c7b6[_0x8e7f('0x38')]?_0x29c7b6['responsetime']:_0x1d8684;_0x29c7b6['endtime']=_0x29c7b6[_0x8e7f('0x3e')]?_0x29c7b6['endtime']:_0x1d8684;_0x29c7b6['ringtime']=getSeconds(_0x29c7b6[_0x8e7f('0x38')]||0x0,_0x29c7b6[_0x8e7f('0x37')]||0x0);_0x29c7b6[_0x8e7f('0x3f')]=_0x29c7b6[_0x8e7f('0x40')]?getSeconds(_0x29c7b6[_0x8e7f('0x3e')],_0x29c7b6[_0x8e7f('0x40')]):0x0;};exports['isFailure']=function(_0x2543ff){return _0x2543ff==='Failure';};exports[_0x8e7f('0x41')]=function(_0x3f7998,_0x35a1f7,_0x4c790b,_0x30dc7d,_0x2436ac){var _0x5521f9=_0x30dc7d?'RECALL':_0x3f7998[_0x8e7f('0x42')];_0x5521f9=_0x2436ac?'BOOKED':_0x5521f9;return{'actionid':_0x3f7998[_0x8e7f('0x43')],'action':_0x8e7f('0x44'),'channel':_0x3f7998[_0x8e7f('0x45')],'callerid':util[_0x8e7f('0x15')](_0x8e7f('0x14'),_0x5521f9,_0x3f7998[_0x8e7f('0x1b')]),'Exten':_0x8e7f('0x26'),'Context':_0x8e7f('0x46'),'Priority':'1','variable':_0x4c790b,'timeout':(_0x35a1f7[_0x8e7f('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f7998['uniqueid']};};exports[_0x8e7f('0x48')]=function(_0x23d356){return _0x23d356[_0x8e7f('0x49')]+_0x23d356[_0x8e7f('0x4a')]+_0x23d356['countnoanswerretry']+_0x23d356[_0x8e7f('0x4b')]+_0x23d356['countnosuchnumberretry'];};exports[_0x8e7f('0x4c')]=function(_0x4f5d54){var _0x5144fb=_[_0x8e7f('0x4d')](_0x4f5d54);_0x5144fb[_0x8e7f('0x35')]=0xf;_0x5144fb[_0x8e7f('0x3a')]=_0x8e7f('0x4e');return _0x5144fb;};exports[_0x8e7f('0x4f')]=function(_0x32bc56,_0x3cb24d,_0x4e649d){var _0x39f8e0={};_0x39f8e0[_0x3cb24d]=_0x32bc56[_0x3cb24d];_0x39f8e0[_0x8e7f('0x50')]=![];_0x39f8e0['scheduledat']=moment()[_0x8e7f('0x51')](_0x4e649d,_0x8e7f('0x52'))[_0x8e7f('0x15')](_0x8e7f('0x34'));_0x39f8e0['ContactId']=_0x32bc56[_0x8e7f('0x53')];_0x39f8e0[_0x8e7f('0x54')]=_0x32bc56['ListId'];_0x39f8e0[_0x8e7f('0x1d')]=_0x32bc56['VoiceQueueId']||undefined;return _0x39f8e0;};exports[_0x8e7f('0x55')]=function(_0x4ff826,_0xa8113c){if(!_['isNil'](_0x4ff826)){if(_0x4ff826['pTalking']>0x0){_0x4ff826[_0x8e7f('0x56')]-=0x1;}else{logger['error'](_0xa8113c,_0x8e7f('0x57'));}}else{logger[_0x8e7f('0xa')](_0xa8113c,_0x8e7f('0x58'));}};exports['IsNotLoggedIn']=function(_0x4d81d2){if(_0x4d81d2<=0x0){return!![];}return![];};exports[_0x8e7f('0x59')]=function(_0x40b800,_0xd361dc,_0x5b9424){_0x40b800[_0x8e7f('0x5a')]=_0xd361dc;_0x40b800[_0x8e7f('0x1a')]=_0x40b800[_0x8e7f('0x5b')];_0x40b800[_0x8e7f('0x5c')]=_0x40b800[_0x8e7f('0x45')];_0x40b800[_0x8e7f('0x5d')]=_0x8e7f('0x5e');if(_0x5b9424){_0x40b800[_0x8e7f('0x5f')]=_0x5b9424[_0x8e7f('0x5f')];}return _0x40b800;};exports[_0x8e7f('0x60')]=function(_0x27f4fb){var _0x523d3d={};_0x523d3d['queue']=_0x27f4fb[_0x8e7f('0x5b')];_0x523d3d[_0x8e7f('0x5c')]=_0x27f4fb[_0x8e7f('0x45')];_0x523d3d[_0x8e7f('0x43')]=_0x27f4fb[_0x8e7f('0x43')];return _0x523d3d;};exports[_0x8e7f('0x61')]=function(_0x5de156){var _0x46d696=[];for(var _0x52f8cb in _0x5de156){if(_0x5de156[_0x8e7f('0x2b')](_0x52f8cb)){if(!_[_0x8e7f('0x2c')](_0x5de156[_0x52f8cb])&&_0x5de156[_0x52f8cb][_0x8e7f('0x35')]==='not_inuse'&&_0x5de156[_0x52f8cb]['status']===_0x8e7f('0x62')){_0x46d696[_0x8e7f('0x63')](_0x5de156[_0x52f8cb]['id']);}}}return _0x46d696;};exports['getDiff']=function(_0x4fd389){var _0x158466=moment()[_0x8e7f('0x6')](0x0);var _0x535ff2=moment(_0x4fd389)[_0x8e7f('0x6')](0x0);return _0x158466[_0x8e7f('0x7')](_0x535ff2,'seconds');};exports[_0x8e7f('0x64')]=function(_0x8427f8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x8427f8[_0x8e7f('0x53')],'ListId':_0x8427f8[_0x8e7f('0x54')],'VoiceQueueId':_0x8427f8['VoiceQueueId']||undefined,'CampaignId':_0x8427f8['CampaignId']||undefined};};exports[_0x8e7f('0x65')]=function(_0x1cfa85){if(_0x1cfa85===_0x8e7f('0x43')||_0x1cfa85===_0x8e7f('0x66')||_0x1cfa85===_0x8e7f('0x5b')||_0x1cfa85===_0x8e7f('0x67')||_0x1cfa85===_0x8e7f('0x68')||_0x1cfa85===_0x8e7f('0x69')||_0x1cfa85==='membername'||_0x1cfa85===_0x8e7f('0x45')||_0x1cfa85===_0x8e7f('0x42')||_0x1cfa85===_0x8e7f('0x50')||_0x1cfa85===_0x8e7f('0x1b')||_0x1cfa85==='scheduledat'||_0x1cfa85===_0x8e7f('0x49')||_0x1cfa85===_0x8e7f('0x4a')||_0x1cfa85===_0x8e7f('0x6a')||_0x1cfa85===_0x8e7f('0x6b')||_0x1cfa85==='callback'||_0x1cfa85===_0x8e7f('0x6c')||_0x1cfa85===_0x8e7f('0x6d')||_0x1cfa85==='recallme'||_0x1cfa85===_0x8e7f('0x53')||_0x1cfa85==='ListId'||_0x1cfa85===_0x8e7f('0x6e')||_0x1cfa85==='VoiceQueueId'||_0x1cfa85===_0x8e7f('0x6f')||_0x1cfa85===_0x8e7f('0x70')||_0x1cfa85===_0x8e7f('0x71')||_0x1cfa85==='xmd-phone'||_0x1cfa85===_0x8e7f('0x72')||_0x1cfa85===_0x8e7f('0x73')||_0x1cfa85===_0x8e7f('0x74')||_0x1cfa85===_0x8e7f('0x75')||_0x1cfa85===_0x8e7f('0x76')||_0x1cfa85===_0x8e7f('0x77')||_0x1cfa85===_0x8e7f('0x78')||_0x1cfa85===_0x8e7f('0x79')||_0x1cfa85==='xmd-callerid'||_0x1cfa85==='xmd-agiafter'||_0x1cfa85===_0x8e7f('0x7a')||_0x1cfa85===_0x8e7f('0x7b')||_0x1cfa85===_0x8e7f('0x7c')||_0x1cfa85==='rtpaudioqosjitter'||_0x1cfa85==='rtpaudioqosjitterbridged'||_0x1cfa85===_0x8e7f('0x7d')||_0x1cfa85===_0x8e7f('0x7e')||_0x1cfa85===_0x8e7f('0x7f')||_0x1cfa85===_0x8e7f('0x80')||_0x1cfa85===_0x8e7f('0x7b')||_0x1cfa85===_0x8e7f('0x7c')||_0x1cfa85===_0x8e7f('0x81')||_0x1cfa85==='rtpaudioqosjitterbridged'||_0x1cfa85===_0x8e7f('0x7d')||_0x1cfa85===_0x8e7f('0x7e')||_0x1cfa85===_0x8e7f('0x7f')||_0x1cfa85===_0x8e7f('0x80')||_0x1cfa85===_0x8e7f('0x82')||_0x1cfa85===_0x8e7f('0x83')||_0x1cfa85==='state'||_0x1cfa85===_0x8e7f('0x3a')){return![];}return!![];};exports[_0x8e7f('0x84')]=function(_0x43cbda,_0x271d80){var _0x554392,_0x78e6f4,_0x358e3a;if(_0x271d80<=0x0){_0x271d80=0x1;}_0x554392=new RegExp('\x5cw{0,'+_0x271d80+'}$');_0x78e6f4=Math['pow'](0xa,_0x271d80-0x1);_0x358e3a=Math['pow'](0xa,_0x271d80)-0x1;return util['format']('%s',_[_0x8e7f('0x85')](_0x43cbda,_0x554392,_[_0x8e7f('0x86')](_0x78e6f4,_0x358e3a)));};exports['extractCalleridName']=function(_0x8a189){var _0x3c5dc4=_0x8a189['match'](/"(.*?)"/);return _0x3c5dc4?_0x3c5dc4[0x1]:_0x8a189;};exports[_0x8e7f('0x87')]=function(_0x10f3fd){var _0x3a6fff=_0x10f3fd[_0x8e7f('0x88')](/<(.*?)>/);return _0x3a6fff?_0x3a6fff[0x1]:_0x10f3fd;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 9461cdf..7d6fbab 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 _0x1cce=['voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1cce,0x80));var _0xe1cc=function(_0xd3bcf8,_0x994fdb){_0xd3bcf8=_0xd3bcf8-0x0;var _0x296170=_0x1cce[_0xd3bcf8];return _0x296170;};'use strict';exports[_0xe1cc('0x0')]={'queue':{'type':_0xe1cc('0x1'),'required':!![]},'interface':{'type':_0xe1cc('0x1'),'required':!![]},'membername':{'type':_0xe1cc('0x1'),'required':!![]},'penalty':{'type':_0xe1cc('0x2'),'required':![]},'paused':{'type':_0xe1cc('0x3'),'required':![]}};exports[_0xe1cc('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xe1cc('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xe1cc('0x3')},'reason':{'type':_0xe1cc('0x1'),'required':![]}};exports[_0xe1cc('0x6')]={'module':{'type':_0xe1cc('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xe1cc('0x1'),'required':!![]}};exports[_0xe1cc('0x7')]={'uniqueid':{'type':_0xe1cc('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xe1cc('0x1')},'mixmonitorid':{'type':_0xe1cc('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xe1cc('0x1'),'required':!![]}};exports[_0xe1cc('0x8')]={'uniqueid':{'type':_0xe1cc('0x1'),'required':!![]},'exten':{'type':_0xe1cc('0x1'),'required':!![]},'context':{'type':_0xe1cc('0x1')}}; \ No newline at end of file +var _0x7bf7=['voicechannel','queueadd','string','number','boolean','queueremove','reload','voicequeuechannel'];(function(_0x317e30,_0x32ad66){var _0x203788=function(_0x264d38){while(--_0x264d38){_0x317e30['push'](_0x317e30['shift']());}};_0x203788(++_0x32ad66);}(_0x7bf7,0x1c9));var _0x77bf=function(_0x5c1607,_0x327eec){_0x5c1607=_0x5c1607-0x0;var _0x4d7395=_0x7bf7[_0x5c1607];return _0x4d7395;};'use strict';exports[_0x77bf('0x0')]={'queue':{'type':_0x77bf('0x1'),'required':!![]},'interface':{'type':_0x77bf('0x1'),'required':!![]},'membername':{'type':_0x77bf('0x1'),'required':!![]},'penalty':{'type':_0x77bf('0x2'),'required':![]},'paused':{'type':_0x77bf('0x3'),'required':![]}};exports[_0x77bf('0x4')]={'queue':{'type':_0x77bf('0x1'),'required':!![]},'interface':{'type':_0x77bf('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x77bf('0x3')},'reason':{'type':'string','required':![]}};exports[_0x77bf('0x5')]={'module':{'type':_0x77bf('0x1'),'required':![]}};exports[_0x77bf('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x77bf('0x7')]={'uniqueid':{'type':_0x77bf('0x1'),'required':!![]},'filename':{'type':_0x77bf('0x1')},'format':{'type':_0x77bf('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x77bf('0x1'),'required':!![]},'context':{'type':_0x77bf('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 32eae01..030f625 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 _0x833a=['disposition','ANSWERED','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','SIP/%s','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','mergeFromDatabase','initAgents','length','isUndefined','prototype','initTelephones','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','initVoiceCallReports'];(function(_0x274f1a,_0x270c64){var _0x5c7884=function(_0x30554f){while(--_0x30554f){_0x274f1a['push'](_0x274f1a['shift']());}};_0x5c7884(++_0x270c64);}(_0x833a,0x77));var _0xa833=function(_0x268d21,_0x3c2b73){_0x268d21=_0x268d21-0x0;var _0x1e2a4e=_0x833a[_0x268d21];return _0x1e2a4e;};'use strict';var BPromise=require(_0xa833('0x0'));var util=require(_0xa833('0x1'));var _=require(_0xa833('0x2'));var moment=require('moment');var Agent=require(_0xa833('0x3'));var Telephone=require(_0xa833('0x4'));var Trunk=require(_0xa833('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xa833('0x6'));var VoiceExtension=require(_0xa833('0x7'));var ZendeskAccount=require(_0xa833('0x8'));var SalesforceAccount=require(_0xa833('0x9'));var FreshdeskAccount=require(_0xa833('0xa'));var SugarcrmAccount=require(_0xa833('0xb'));var ZohoAccount=require(_0xa833('0xc'));var DeskAccount=require(_0xa833('0xd'));var VtigerAccount=require(_0xa833('0xe'));var ServicenowAccount=require(_0xa833('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xa833('0x10'));var Realtime=function(){this[_0xa833('0x11')]={};this[_0xa833('0x12')]={};this[_0xa833('0x13')]={};this[_0xa833('0x14')]={};this[_0xa833('0x15')]={};this[_0xa833('0x16')]={};this[_0xa833('0x17')]={};this[_0xa833('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa833('0x19')]={};this[_0xa833('0x1a')]={};this[_0xa833('0x1b')]={};this['outboundChannels']={};this[_0xa833('0x1c')]={};this[_0xa833('0x1d')]={};this['zendeskAccounts']={};this[_0xa833('0x1e')]={};this[_0xa833('0x1f')]={};this['freshdeskAccounts']={};this[_0xa833('0x20')]={};this[_0xa833('0x21')]={};this[_0xa833('0x22')]={};this[_0xa833('0x23')]={};this[_0xa833('0x24')]={};this['freshsalesAccounts']={};this[_0xa833('0x25')]={};};function freeIsNotKey(_0xbcad98,_0x3ba8f7,_0x3bff5b){var _0x334116=_[_0xa833('0x26')](_0xbcad98,function(_0x20c6bc,_0x2d84a1){return _0x20c6bc[_0x3bff5b];});for(var _0x4f0217 in _0x3ba8f7){if(_0x3ba8f7[_0xa833('0x27')](_0x4f0217)){if(!_0x334116[_0x4f0217]){delete _0x3ba8f7[_0x4f0217];}}}}function freeIsNotKeySip(_0x372c8c,_0xed3898){var _0x1e17dd=_[_0xa833('0x26')](_0x372c8c,function(_0x4bc5d2,_0x504180){return util[_0xa833('0x28')]('SIP/%s',_0x4bc5d2[_0xa833('0x29')]);});for(var _0x3354f7 in _0xed3898){if(_0xed3898['hasOwnProperty'](_0x3354f7)){if(!_0x1e17dd[_0x3354f7]){delete _0xed3898[_0x3354f7];}}}}function freeIsNotKeyAgent(_0x3a49ab,_0xbb9eba){var _0xd178f=_['mapKeys'](_0x3a49ab,function(_0x10d0b7,_0x555505){var _0x46faac=_[_0xa833('0x2a')](_0x10d0b7['interface'])?util[_0xa833('0x28')](_0xa833('0x2b'),_0x10d0b7[_0xa833('0x29')]):_0x10d0b7[_0xa833('0x2c')];return _0x46faac;});for(var _0x56dca4 in _0xbb9eba){if(_0xbb9eba[_0xa833('0x27')](_0x56dca4)){if(!_0xd178f[_0x56dca4]){delete _0xbb9eba[_0x56dca4];}}}}function clearVoiceCallReports(_0x77c19b){_0x77c19b[_0xa833('0x2d')]=0x0;_0x77c19b[_0xa833('0x2e')]=0x0;_0x77c19b[_0xa833('0x2f')]=0x0;_0x77c19b[_0xa833('0x30')]=0x0;_0x77c19b[_0xa833('0x31')]=0x0;}function clearCampaigns(_0x1c06af){if(!_[_0xa833('0x32')](_0x1c06af)){for(var _0x3c53b7 in _0x1c06af){if(_0x1c06af['hasOwnProperty'](_0x3c53b7)){_0x1c06af[_0x3c53b7][_0xa833('0x33')]=0x0;_0x1c06af[_0x3c53b7][_0xa833('0x34')]=0x0;}}}}function clearVoiceQueues(_0x2684b4){if(!_['isEmpty'](_0x2684b4)){for(var _0x1b7792 in _0x2684b4){if(_0x2684b4[_0xa833('0x27')](_0x1b7792)){_0x2684b4[_0x1b7792][_0xa833('0x2d')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x2e')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x35')]=0x0;_0x2684b4[_0x1b7792]['abandoned']=0x0;_0x2684b4[_0x1b7792]['sumHoldTime']=0x0;_0x2684b4[_0x1b7792][_0xa833('0x30')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x31')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x36')]=0x0;_0x2684b4[_0x1b7792]['outboundNoAnswerCallsDay']=0x0;_0x2684b4[_0x1b7792][_0xa833('0x37')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x38')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x39')]=0x0;_0x2684b4[_0x1b7792]['outboundUnknownCallsDay']=0x0;_0x2684b4[_0x1b7792][_0xa833('0x3a')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x3b')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x3c')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x3d')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x3e')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x3f')]=0x0;_0x2684b4[_0x1b7792][_0xa833('0x36')]=0x0;_0x2684b4[_0x1b7792]['outboundAnswerCallsDay']=0x0;_0x2684b4[_0x1b7792]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xa833('0x40')]=function(_0x36afbe,_0x251834){for(var _0x33cb11 in _0x251834){if(_0x36afbe[_0xa833('0x27')](_0x33cb11)){_0x36afbe[_0x33cb11]=_0x251834[_0x33cb11];}}};Realtime['prototype'][_0xa833('0x41')]=function(){var _0x35bfe8=this;return function(_0x5cc6bf){if(_0x5cc6bf){freeIsNotKeyAgent(_0x5cc6bf,_0x35bfe8[_0xa833('0x11')]);for(var _0x2c81a0=0x0,_0x5a1666={},_0x51f421={};_0x2c81a0<_0x5cc6bf[_0xa833('0x42')];_0x2c81a0+=0x1){_0x5a1666=_0x5cc6bf[_0x2c81a0];var _0x16e8a9=_[_0xa833('0x2a')](_0x5a1666[_0xa833('0x2c')])?util[_0xa833('0x28')](_0xa833('0x2b'),_0x5a1666['name']):_0x5a1666[_0xa833('0x2c')];if(_[_0xa833('0x43')](_0x35bfe8['agents'][_0x16e8a9])){_0x35bfe8[_0xa833('0x11')][_0x16e8a9]=new Agent(_0x5a1666);}else{_0x35bfe8['mergeFromDatabase'](_0x35bfe8[_0xa833('0x11')][_0x16e8a9],_0x5a1666);}}}return _0x35bfe8[_0xa833('0x11')];};};Realtime[_0xa833('0x44')][_0xa833('0x45')]=function(){var _0x34e541=this;return function(_0x4129a6){if(_0x4129a6){freeIsNotKeySip(_0x4129a6,_0x34e541[_0xa833('0x12')]);for(var _0x3a6703=0x0,_0xd85c4e={},_0x5b23a0={};_0x3a6703<_0x4129a6[_0xa833('0x42')];_0x3a6703+=0x1){_0xd85c4e=_0x4129a6[_0x3a6703];if(_['isUndefined'](_0x34e541['telephones'][util['format'](_0xa833('0x2b'),_0xd85c4e[_0xa833('0x29')])])){_0x34e541[_0xa833('0x12')][util[_0xa833('0x28')](_0xa833('0x2b'),_0xd85c4e['name'])]=new Telephone(_0xd85c4e);}else{_0x34e541[_0xa833('0x40')](_0x34e541[_0xa833('0x12')][util[_0xa833('0x28')](_0xa833('0x2b'),_0xd85c4e[_0xa833('0x29')])],_0xd85c4e);}}}return _0x34e541[_0xa833('0x12')];};};Realtime[_0xa833('0x44')]['initTrunks']=function(){var _0x204852=this;return function(_0x3d7e3f){if(_0x3d7e3f){freeIsNotKeySip(_0x3d7e3f,_0x204852[_0xa833('0x13')]);for(var _0x26afc1=0x0,_0xcc598={},_0x3b3b73={};_0x26afc1<_0x3d7e3f['length'];_0x26afc1+=0x1){_0xcc598=_0x3d7e3f[_0x26afc1];if(_['isUndefined'](_0x204852['trunks'][util['format']('SIP/%s',_0xcc598[_0xa833('0x29')])])){_0x204852[_0xa833('0x13')][util[_0xa833('0x28')]('SIP/%s',_0xcc598[_0xa833('0x29')])]=new Trunk(_0xcc598);}else{_0x204852[_0xa833('0x40')](_0x204852[_0xa833('0x13')][util[_0xa833('0x28')]('SIP/%s',_0xcc598[_0xa833('0x29')])],_0xcc598);}}}return _0x204852[_0xa833('0x13')];};};Realtime[_0xa833('0x44')][_0xa833('0x46')]=function(){var _0x46123e=this;return function(_0x4f2390){if(_0x4f2390){freeIsNotKey(_0x4f2390,_0x46123e[_0xa833('0x14')],'name');for(var _0x587e21=0x0,_0x53c85a={},_0xf43cd1={};_0x587e21<_0x4f2390[_0xa833('0x42')];_0x587e21+=0x1){_0x53c85a=_0x4f2390[_0x587e21];if(_['isUndefined'](_0x46123e[_0xa833('0x14')][_0x53c85a['name']])){_0x46123e[_0xa833('0x14')][_0x53c85a[_0xa833('0x29')]]=new VoiceQueue(_0x53c85a);}else{_0x46123e['mergeFromDatabase'](_0x46123e[_0xa833('0x14')][_0x53c85a[_0xa833('0x29')]],_0x53c85a);}}}return _0x46123e['voiceQueues'];};};Realtime[_0xa833('0x44')][_0xa833('0x47')]=function(){var _0x484ea=this;return function(_0x3ff247){if(_0x3ff247){freeIsNotKey(_0x3ff247,_0x484ea[_0xa833('0x15')],'id');for(var _0x3cfdf1=0x0,_0x14ee6b={},_0x427d03={};_0x3cfdf1<_0x3ff247[_0xa833('0x42')];_0x3cfdf1+=0x1){_0x14ee6b=_0x3ff247[_0x3cfdf1];if(_['isUndefined'](_0x484ea[_0xa833('0x15')][_0x14ee6b['id']])){_0x484ea[_0xa833('0x15')][_0x14ee6b['id']]=new Trigger(_0x14ee6b);}else{_0x484ea['mergeFromDatabase'](_0x484ea[_0xa833('0x15')][_0x14ee6b['id']],_0x14ee6b);}}}return _0x484ea[_0xa833('0x15')];};};Realtime[_0xa833('0x44')][_0xa833('0x48')]=function(){var _0x1c9a09=this;return function(_0x22e19e){if(_0x22e19e){freeIsNotKey(_0x22e19e,_0x1c9a09[_0xa833('0x17')],'id');for(var _0x43aaec=0x0,_0x1834fc={},_0x4040eb={};_0x43aaec<_0x22e19e[_0xa833('0x42')];_0x43aaec+=0x1){_0x1834fc=_0x22e19e[_0x43aaec];if(_[_0xa833('0x43')](_0x1c9a09[_0xa833('0x17')][_0x1834fc['id']])){_0x1c9a09[_0xa833('0x17')][_0x1834fc['id']]=new Template(_0x1834fc);}else{_0x1c9a09[_0xa833('0x40')](_0x1c9a09[_0xa833('0x17')][_0x1834fc['id']],_0x1834fc);}}}return _0x1c9a09[_0xa833('0x17')];};};Realtime[_0xa833('0x44')][_0xa833('0x49')]=function(){var _0x2881de=this;return function(_0x35d6c9){if(_0x35d6c9){freeIsNotKey(_0x35d6c9,_0x2881de[_0xa833('0x4a')],'id');for(var _0x376d9f=0x0,_0x2d1c2a={},_0x34e706={};_0x376d9f<_0x35d6c9[_0xa833('0x42')];_0x376d9f+=0x1){_0x2d1c2a=_0x35d6c9[_0x376d9f];if(_[_0xa833('0x43')](_0x2881de[_0xa833('0x4a')][_0x2d1c2a['id']])){_0x2881de[_0xa833('0x4a')][_0x2d1c2a['id']]=new ZendeskAccount(_0x2d1c2a);}else{_0x2881de[_0xa833('0x40')](_0x2881de['zendeskAccounts'][_0x2d1c2a['id']],_0x2d1c2a);}}}return _0x2881de[_0xa833('0x4a')];};};Realtime[_0xa833('0x44')][_0xa833('0x4b')]=function(){var _0x9aaccc=this;return function(_0x55e8dd){if(_0x55e8dd){freeIsNotKey(_0x55e8dd,_0x9aaccc['salesforceAccounts'],'id');for(var _0x29b5c1=0x0,_0x1a6f70={},_0x46cd70={};_0x29b5c1<_0x55e8dd['length'];_0x29b5c1+=0x1){_0x1a6f70=_0x55e8dd[_0x29b5c1];if(_[_0xa833('0x43')](_0x9aaccc[_0xa833('0x1e')][_0x1a6f70['id']])){_0x9aaccc[_0xa833('0x1e')][_0x1a6f70['id']]=new SalesforceAccount(_0x1a6f70);}else{_0x9aaccc[_0xa833('0x40')](_0x9aaccc[_0xa833('0x1e')][_0x1a6f70['id']],_0x1a6f70);}}}return _0x9aaccc[_0xa833('0x1e')];};};Realtime['prototype'][_0xa833('0x4c')]=function(){var _0x784b5f=this;return function(_0x1f8823){if(_0x1f8823){freeIsNotKey(_0x1f8823,_0x784b5f[_0xa833('0x4d')],'id');for(var _0x27df38=0x0,_0x2578ff={},_0x4c09e9={};_0x27df38<_0x1f8823[_0xa833('0x42')];_0x27df38+=0x1){_0x2578ff=_0x1f8823[_0x27df38];if(_['isUndefined'](_0x784b5f[_0xa833('0x4d')][_0x2578ff['id']])){_0x784b5f[_0xa833('0x4d')][_0x2578ff['id']]=new FreshdeskAccount(_0x2578ff);}else{_0x784b5f[_0xa833('0x40')](_0x784b5f[_0xa833('0x4d')][_0x2578ff['id']],_0x2578ff);}}}return _0x784b5f[_0xa833('0x4d')];};};Realtime['prototype'][_0xa833('0x4e')]=function(){var _0x539935=this;return function(_0x1c13a7){if(_0x1c13a7){freeIsNotKey(_0x1c13a7,_0x539935[_0xa833('0x20')],'id');for(var _0x2cc759=0x0,_0x3e81c5={},_0x1c2348={};_0x2cc759<_0x1c13a7[_0xa833('0x42')];_0x2cc759+=0x1){_0x3e81c5=_0x1c13a7[_0x2cc759];if(_[_0xa833('0x43')](_0x539935[_0xa833('0x20')][_0x3e81c5['id']])){_0x539935[_0xa833('0x20')][_0x3e81c5['id']]=new ZohoAccount(_0x3e81c5);}else{_0x539935[_0xa833('0x40')](_0x539935['zohoAccounts'][_0x3e81c5['id']],_0x3e81c5);}}}return _0x539935[_0xa833('0x20')];};};Realtime[_0xa833('0x44')]['initDeskAccounts']=function(){var _0x921e87=this;return function(_0x1df4d3){if(_0x1df4d3){freeIsNotKey(_0x1df4d3,_0x921e87[_0xa833('0x21')],'id');for(var _0xffed34=0x0,_0x4dc24a={},_0x3e8eec={};_0xffed34<_0x1df4d3[_0xa833('0x42')];_0xffed34+=0x1){_0x4dc24a=_0x1df4d3[_0xffed34];if(_[_0xa833('0x43')](_0x921e87['deskAccounts'][_0x4dc24a['id']])){_0x921e87[_0xa833('0x21')][_0x4dc24a['id']]=new DeskAccount(_0x4dc24a);}else{_0x921e87[_0xa833('0x40')](_0x921e87[_0xa833('0x21')][_0x4dc24a['id']],_0x4dc24a);}}}return _0x921e87[_0xa833('0x21')];};};Realtime[_0xa833('0x44')][_0xa833('0x4f')]=function(){var _0x13f8ba=this;return function(_0x48e9f6){if(_0x48e9f6){freeIsNotKey(_0x48e9f6,_0x13f8ba[_0xa833('0x1f')],'id');for(var _0x1251d2=0x0,_0x81947e={},_0x28ea23={};_0x1251d2<_0x48e9f6[_0xa833('0x42')];_0x1251d2+=0x1){_0x81947e=_0x48e9f6[_0x1251d2];if(_[_0xa833('0x43')](_0x13f8ba[_0xa833('0x1f')][_0x81947e['id']])){_0x13f8ba['sugarcrmAccounts'][_0x81947e['id']]=new SugarcrmAccount(_0x81947e);}else{_0x13f8ba[_0xa833('0x40')](_0x13f8ba['sugarcrmAccounts'][_0x81947e['id']],_0x81947e);}}}return _0x13f8ba[_0xa833('0x1f')];};};Realtime['prototype'][_0xa833('0x50')]=function(){var _0x19040d=this;return function(_0x3081dd){if(_0x3081dd){freeIsNotKey(_0x3081dd,_0x19040d[_0xa833('0x22')],'id');for(var _0x19846a=0x0,_0x4681d7={},_0x269aad={};_0x19846a<_0x3081dd['length'];_0x19846a+=0x1){_0x4681d7=_0x3081dd[_0x19846a];if(_[_0xa833('0x43')](_0x19040d[_0xa833('0x22')][_0x4681d7['id']])){_0x19040d['vtigerAccounts'][_0x4681d7['id']]=new VtigerAccount(_0x4681d7);}else{_0x19040d[_0xa833('0x40')](_0x19040d['vtigerAccounts'][_0x4681d7['id']],_0x4681d7);}}}return _0x19040d['vtigerAccounts'];};};Realtime[_0xa833('0x44')][_0xa833('0x51')]=function(){var _0x1b64aa=this;return function(_0x103b92){if(_0x103b92){freeIsNotKey(_0x103b92,_0x1b64aa['servicenowAccounts'],'id');for(var _0x3e0fa1=0x0,_0x3e988d={},_0x1b57b8={};_0x3e0fa1<_0x103b92['length'];_0x3e0fa1+=0x1){_0x3e988d=_0x103b92[_0x3e0fa1];if(_[_0xa833('0x43')](_0x1b64aa[_0xa833('0x23')][_0x3e988d['id']])){_0x1b64aa[_0xa833('0x23')][_0x3e988d['id']]=new ServicenowAccount(_0x3e988d);}else{_0x1b64aa[_0xa833('0x40')](_0x1b64aa[_0xa833('0x23')][_0x3e988d['id']],_0x3e988d);}}}return _0x1b64aa[_0xa833('0x23')];};};Realtime[_0xa833('0x44')][_0xa833('0x52')]=function(){var _0x4790b3=this;return function(_0x222d16){if(_0x222d16){freeIsNotKey(_0x222d16,_0x4790b3['dynamics365Accounts'],'id');for(var _0x59e82e=0x0,_0x5c19b7={},_0x5c7c26={};_0x59e82e<_0x222d16[_0xa833('0x42')];_0x59e82e+=0x1){_0x5c19b7=_0x222d16[_0x59e82e];if(_[_0xa833('0x43')](_0x4790b3[_0xa833('0x24')][_0x5c19b7['id']])){_0x4790b3[_0xa833('0x24')][_0x5c19b7['id']]=new Dynamics365Account(_0x5c19b7);}else{_0x4790b3[_0xa833('0x40')](_0x4790b3[_0xa833('0x24')][_0x5c19b7['id']],_0x5c19b7);}}}return _0x4790b3['dynamics365Accounts'];};};Realtime['prototype'][_0xa833('0x53')]=function(){var _0x53c32e=this;return function(_0x281df1){if(_0x281df1){freeIsNotKey(_0x281df1,_0x53c32e[_0xa833('0x54')],'id');for(var _0x3608b4=0x0,_0x5a08a7={},_0x148c83={};_0x3608b4<_0x281df1[_0xa833('0x42')];_0x3608b4+=0x1){_0x5a08a7=_0x281df1[_0x3608b4];if(_[_0xa833('0x43')](_0x53c32e[_0xa833('0x54')][_0x5a08a7['id']])){_0x53c32e[_0xa833('0x54')][_0x5a08a7['id']]=new FreshsalesAccount(_0x5a08a7);}else{_0x53c32e[_0xa833('0x40')](_0x53c32e[_0xa833('0x54')][_0x5a08a7['id']],_0x5a08a7);}}}return _0x53c32e['freshsalesAccounts'];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x140bf6=this;return function(_0x1b9dd2){for(var _0x364ba9=0x0;_0x364ba9<_0x1b9dd2[_0xa833('0x42')];_0x364ba9+=0x1){_[_0xa833('0x55')](_0x140bf6['voiceQueues'][_0x1b9dd2[_0x364ba9][_0xa833('0x29')]],_0x1b9dd2[_0x364ba9]);}return _0x140bf6['voiceQueues'];};};Realtime['prototype'][_0xa833('0x56')]=function(){var _0x511aa6=this;return function(_0x316f6d){clearVoiceQueues(_0x511aa6[_0xa833('0x14')]);if(_0x316f6d){_0x316f6d=_[_0xa833('0x57')](_0x316f6d,_0xa833('0x58'));for(var _0x3728a4 in _0x316f6d){if(_0x316f6d[_0xa833('0x27')](_0x3728a4)){var _0x22ae5b={};for(var _0x3fac79=0x0;_0x3fac79<_0x316f6d[_0x3728a4][_0xa833('0x42')];_0x3fac79+=0x1){var _0xcf372c=_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x59')];if(_0x511aa6[_0xa833('0x14')][_0xcf372c]){if(_0x316f6d[_0x3728a4][_0x3fac79]['queuecallerexit']){_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x35')]+=0x1;}if(_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x5a')]){_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x5b')]+=0x1;}_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x2f')]+=moment(_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x5c')])[_0xa833('0x5d')](moment(_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x5e')]),_0xa833('0x5f'))||0x0;if(_0x3fac79===_0x316f6d[_0x3728a4][_0xa833('0x42')]-0x1){_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x30')]+=moment(_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x60')]||_0x316f6d[_0x3728a4][_0x3fac79]['queuecallerabandonAt']||_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x61')])['diff'](moment(_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x5e')]),_0xa833('0x5f'))||0x0;_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x2d')]+=0x1;if(_0x316f6d[_0x3728a4][_0x3fac79]['queuecallercomplete']){_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x2e')]+=0x1;_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x31')]+=moment(_0x316f6d[_0x3728a4][_0x3fac79][_0xa833('0x60')])[_0xa833('0x5d')](moment(_0x316f6d[_0x3728a4][_0x3fac79]['queuecallerleaveAt']),_0xa833('0x5f'))||0x0;}}else{_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x30')]+=_0x511aa6[_0xa833('0x14')][_0xcf372c][_0xa833('0x2f')]||0x0;}}}}}}return _0x511aa6[_0xa833('0x14')];};};Realtime[_0xa833('0x44')][_0xa833('0x62')]=function(){var _0x4648e0=this;return function(_0x19b4f0){clearVoiceCallReports(_0x4648e0['outbound']);if(_0x19b4f0){for(var _0x513c24=0x0;_0x513c24<_0x19b4f0[_0xa833('0x42')];_0x513c24+=0x1){_0x4648e0[_0xa833('0x18')][_0xa833('0x2d')]+=0x1;_0x4648e0[_0xa833('0x18')]['sumDuration']+=_0x19b4f0[_0x513c24]['duration'];if(_0x19b4f0[_0x513c24][_0xa833('0x63')]===_0xa833('0x64')){_0x4648e0[_0xa833('0x18')][_0xa833('0x2e')]+=0x1;_0x4648e0['outbound']['sumHoldTime']+=_0x19b4f0[_0x513c24][_0xa833('0x65')]-_0x19b4f0[_0x513c24]['billableseconds']||0x0;_0x4648e0[_0xa833('0x18')][_0xa833('0x31')]+=_0x19b4f0[_0x513c24][_0xa833('0x66')];}}}return _0x4648e0[_0xa833('0x18')];};};Realtime['prototype'][_0xa833('0x67')]=function(){var _0x5ddb92=this;return function(_0x372ca2){if(_0x372ca2){freeIsNotKey(_0x372ca2,_0x5ddb92['campaigns'],_0xa833('0x29'));for(var _0x5a80e5=0x0,_0x49524c={};_0x5a80e5<_0x372ca2[_0xa833('0x42')];_0x5a80e5+=0x1){_0x49524c=_0x372ca2[_0x5a80e5];if(_[_0xa833('0x43')](_0x5ddb92[_0xa833('0x16')][_0x49524c[_0xa833('0x29')]])){_0x5ddb92[_0xa833('0x16')][_0x49524c['name']]=new Campaign(_0x49524c);}else{_0x5ddb92[_0xa833('0x40')](_0x5ddb92[_0xa833('0x16')][_0x49524c[_0xa833('0x29')]],_0x49524c);_0x5ddb92[_0xa833('0x16')][_0x49524c[_0xa833('0x29')]]['dialQueueProject']=_0x49524c['SquareProject']?_0x49524c[_0xa833('0x68')]['name']:undefined;}}}return _0x5ddb92[_0xa833('0x16')];};};Realtime[_0xa833('0x44')][_0xa833('0x69')]=function(){var _0xefaa3d=this;return function(_0x26d990){if(_0x26d990){freeIsNotKey(_0x26d990,_0xefaa3d[_0xa833('0x19')],'id');for(var _0x4ee04c=0x0,_0x1471a9={};_0x4ee04c<_0x26d990[_0xa833('0x42')];_0x4ee04c+=0x1){_0x1471a9=_0x26d990[_0x4ee04c];if(_['isUndefined'](_0xefaa3d[_0xa833('0x19')][_0x1471a9['id']])){_0xefaa3d[_0xa833('0x19')][_0x1471a9['id']]=new VoiceExtension(_0x1471a9);}else{_0xefaa3d[_0xa833('0x40')](_0xefaa3d['voiceExtensions'][_0x1471a9['id']],_0x1471a9);}}}return _0xefaa3d[_0xa833('0x19')];};};Realtime[_0xa833('0x44')][_0xa833('0x6a')]=function(){var _0x3c249a=this;return function(_0x2df61d){clearCampaigns(_0x3c249a[_0xa833('0x16')]);for(var _0x4db7a5=0x0;_0x4db7a5<_0x2df61d[_0xa833('0x42')];_0x4db7a5+=0x1){_[_0xa833('0x55')](_0x3c249a[_0xa833('0x16')][_0x2df61d[_0x4db7a5]['name']],_0x2df61d[_0x4db7a5]);}return _0x3c249a[_0xa833('0x16')];};};Realtime['prototype'][_0xa833('0x6b')]=function(){var _0x50009d=this;return function(_0x4c3270){if(_0x4c3270){freeIsNotKey(_0x4c3270,_0x50009d['faxAccounts'],'id');for(var _0x5d30e0=0x0,_0x332638={},_0x1357d5={};_0x5d30e0<_0x4c3270[_0xa833('0x42')];_0x5d30e0+=0x1){_0x332638=_0x4c3270[_0x5d30e0];if(_['isUndefined'](_0x50009d[_0xa833('0x25')][_0x332638['id']])){_0x50009d['faxAccounts'][_0x332638['id']]=new FaxAccount(_0x332638);}else{_0x50009d[_0xa833('0x40')](_0x50009d[_0xa833('0x25')][_0x332638['id']],_0x332638);}}}return _0x50009d[_0xa833('0x25')];};};module[_0xa833('0x6c')]=Realtime; \ No newline at end of file +var _0x61ed=['unmanaged','abandoned','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','format','trunks','isUndefined','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueReports','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','merge','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x14094a,_0x1421e){var _0x4d085e=function(_0x14d3d5){while(--_0x14d3d5){_0x14094a['push'](_0x14094a['shift']());}};_0x4d085e(++_0x1421e);}(_0x61ed,0x174));var _0xd61e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61ed[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xd61e('0x0'));var util=require(_0xd61e('0x1'));var _=require(_0xd61e('0x2'));var moment=require(_0xd61e('0x3'));var Agent=require(_0xd61e('0x4'));var Telephone=require(_0xd61e('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xd61e('0x6'));var Template=require('../model/template');var Campaign=require(_0xd61e('0x7'));var VoiceExtension=require(_0xd61e('0x8'));var ZendeskAccount=require(_0xd61e('0x9'));var SalesforceAccount=require(_0xd61e('0xa'));var FreshdeskAccount=require(_0xd61e('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xd61e('0xc'));var DeskAccount=require(_0xd61e('0xd'));var VtigerAccount=require(_0xd61e('0xe'));var ServicenowAccount=require(_0xd61e('0xf'));var Dynamics365Account=require(_0xd61e('0x10'));var FreshsalesAccount=require(_0xd61e('0x11'));var FaxAccount=require(_0xd61e('0x12'));var Realtime=function(){this[_0xd61e('0x13')]={};this[_0xd61e('0x14')]={};this['trunks']={};this[_0xd61e('0x15')]={};this[_0xd61e('0x16')]={};this[_0xd61e('0x17')]={};this[_0xd61e('0x18')]={};this[_0xd61e('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xd61e('0x1a')]={};this[_0xd61e('0x1b')]={};this[_0xd61e('0x1c')]={};this[_0xd61e('0x1d')]={};this[_0xd61e('0x1e')]={};this['salesforceAccounts']={};this[_0xd61e('0x1f')]={};this[_0xd61e('0x20')]={};this['zohoAccounts']={};this[_0xd61e('0x21')]={};this[_0xd61e('0x22')]={};this[_0xd61e('0x23')]={};this['dynamics365Accounts']={};this[_0xd61e('0x24')]={};this[_0xd61e('0x25')]={};};function freeIsNotKey(_0x53eb3f,_0x325454,_0x437403){var _0x542bdf=_[_0xd61e('0x26')](_0x53eb3f,function(_0x17d604,_0x2a44ed){return _0x17d604[_0x437403];});for(var _0x5477ba in _0x325454){if(_0x325454[_0xd61e('0x27')](_0x5477ba)){if(!_0x542bdf[_0x5477ba]){delete _0x325454[_0x5477ba];}}}}function freeIsNotKeySip(_0x583b77,_0x472c5f){var _0x2e980e=_[_0xd61e('0x26')](_0x583b77,function(_0x55f481,_0x3e9b4f){return util['format'](_0xd61e('0x28'),_0x55f481[_0xd61e('0x29')]);});for(var _0x2302d5 in _0x472c5f){if(_0x472c5f['hasOwnProperty'](_0x2302d5)){if(!_0x2e980e[_0x2302d5]){delete _0x472c5f[_0x2302d5];}}}}function freeIsNotKeyAgent(_0x276533,_0xd6e4d0){var _0x25ae52=_[_0xd61e('0x26')](_0x276533,function(_0x58ade9,_0x529854){var _0x5dc09d=_[_0xd61e('0x2a')](_0x58ade9[_0xd61e('0x2b')])?util['format'](_0xd61e('0x28'),_0x58ade9[_0xd61e('0x29')]):_0x58ade9[_0xd61e('0x2b')];return _0x5dc09d;});for(var _0x3c7ca5 in _0xd6e4d0){if(_0xd6e4d0[_0xd61e('0x27')](_0x3c7ca5)){if(!_0x25ae52[_0x3c7ca5]){delete _0xd6e4d0[_0x3c7ca5];}}}}function clearVoiceCallReports(_0x1f237b){_0x1f237b[_0xd61e('0x2c')]=0x0;_0x1f237b[_0xd61e('0x2d')]=0x0;_0x1f237b[_0xd61e('0x2e')]=0x0;_0x1f237b[_0xd61e('0x2f')]=0x0;_0x1f237b[_0xd61e('0x30')]=0x0;}function clearCampaigns(_0x46d210){if(!_[_0xd61e('0x31')](_0x46d210)){for(var _0x1a4b94 in _0x46d210){if(_0x46d210['hasOwnProperty'](_0x1a4b94)){_0x46d210[_0x1a4b94][_0xd61e('0x32')]=0x0;_0x46d210[_0x1a4b94][_0xd61e('0x33')]=0x0;}}}}function clearVoiceQueues(_0x3f9ced){if(!_[_0xd61e('0x31')](_0x3f9ced)){for(var _0xa4b784 in _0x3f9ced){if(_0x3f9ced[_0xd61e('0x27')](_0xa4b784)){_0x3f9ced[_0xa4b784][_0xd61e('0x2c')]=0x0;_0x3f9ced[_0xa4b784]['answered']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x34')]=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x35')]=0x0;_0x3f9ced[_0xa4b784]['sumHoldTime']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x2f')]=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x30')]=0x0;_0x3f9ced[_0xa4b784]['outboundAnswerAgiCallsDay']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x36')]=0x0;_0x3f9ced[_0xa4b784]['outboundBusyCallsDay']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x37')]=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x38')]=0x0;_0x3f9ced[_0xa4b784]['outboundUnknownCallsDay']=0x0;_0x3f9ced[_0xa4b784]['outboundDropCallsDayTimeout']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x39')]=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x3a')]=0x0;_0x3f9ced[_0xa4b784]['outboundOriginateFailureCallsDay']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x3b')]=0x0;_0x3f9ced[_0xa4b784]['outboundReCallsDay']=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x3c')]=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x3d')]=0x0;_0x3f9ced[_0xa4b784][_0xd61e('0x3e')]=!![];}}}}Realtime[_0xd61e('0x3f')][_0xd61e('0x40')]=function(_0x22afc1,_0x53a706){for(var _0xee08c8 in _0x53a706){if(_0x22afc1[_0xd61e('0x27')](_0xee08c8)){_0x22afc1[_0xee08c8]=_0x53a706[_0xee08c8];}}};Realtime['prototype'][_0xd61e('0x41')]=function(){var _0x2c0dcb=this;return function(_0x5df83c){if(_0x5df83c){freeIsNotKeyAgent(_0x5df83c,_0x2c0dcb[_0xd61e('0x13')]);for(var _0x14c6ba=0x0,_0x1d6fe8={},_0x4ecc88={};_0x14c6ba<_0x5df83c[_0xd61e('0x42')];_0x14c6ba+=0x1){_0x1d6fe8=_0x5df83c[_0x14c6ba];var _0x51819a=_[_0xd61e('0x2a')](_0x1d6fe8['interface'])?util['format'](_0xd61e('0x28'),_0x1d6fe8['name']):_0x1d6fe8[_0xd61e('0x2b')];if(_['isUndefined'](_0x2c0dcb[_0xd61e('0x13')][_0x51819a])){_0x2c0dcb[_0xd61e('0x13')][_0x51819a]=new Agent(_0x1d6fe8);}else{_0x2c0dcb[_0xd61e('0x40')](_0x2c0dcb[_0xd61e('0x13')][_0x51819a],_0x1d6fe8);}}}return _0x2c0dcb[_0xd61e('0x13')];};};Realtime[_0xd61e('0x3f')]['initTelephones']=function(){var _0x44232f=this;return function(_0x35c94a){if(_0x35c94a){freeIsNotKeySip(_0x35c94a,_0x44232f[_0xd61e('0x14')]);for(var _0x572e96=0x0,_0x2dc1a3={},_0x14aa68={};_0x572e96<_0x35c94a[_0xd61e('0x42')];_0x572e96+=0x1){_0x2dc1a3=_0x35c94a[_0x572e96];if(_['isUndefined'](_0x44232f['telephones'][util[_0xd61e('0x43')](_0xd61e('0x28'),_0x2dc1a3[_0xd61e('0x29')])])){_0x44232f['telephones'][util[_0xd61e('0x43')](_0xd61e('0x28'),_0x2dc1a3['name'])]=new Telephone(_0x2dc1a3);}else{_0x44232f['mergeFromDatabase'](_0x44232f['telephones'][util['format'](_0xd61e('0x28'),_0x2dc1a3[_0xd61e('0x29')])],_0x2dc1a3);}}}return _0x44232f[_0xd61e('0x14')];};};Realtime[_0xd61e('0x3f')]['initTrunks']=function(){var _0x1ff1ce=this;return function(_0x299f1c){if(_0x299f1c){freeIsNotKeySip(_0x299f1c,_0x1ff1ce[_0xd61e('0x44')]);for(var _0x35ac5a=0x0,_0x45568b={},_0x520929={};_0x35ac5a<_0x299f1c[_0xd61e('0x42')];_0x35ac5a+=0x1){_0x45568b=_0x299f1c[_0x35ac5a];if(_[_0xd61e('0x45')](_0x1ff1ce[_0xd61e('0x44')][util[_0xd61e('0x43')](_0xd61e('0x28'),_0x45568b[_0xd61e('0x29')])])){_0x1ff1ce[_0xd61e('0x44')][util[_0xd61e('0x43')]('SIP/%s',_0x45568b['name'])]=new Trunk(_0x45568b);}else{_0x1ff1ce[_0xd61e('0x40')](_0x1ff1ce[_0xd61e('0x44')][util[_0xd61e('0x43')]('SIP/%s',_0x45568b['name'])],_0x45568b);}}}return _0x1ff1ce[_0xd61e('0x44')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x442a1a=this;return function(_0x5148f9){if(_0x5148f9){freeIsNotKey(_0x5148f9,_0x442a1a[_0xd61e('0x15')],'name');for(var _0x39aa63=0x0,_0x4f15f2={},_0x214bd4={};_0x39aa63<_0x5148f9[_0xd61e('0x42')];_0x39aa63+=0x1){_0x4f15f2=_0x5148f9[_0x39aa63];if(_[_0xd61e('0x45')](_0x442a1a[_0xd61e('0x15')][_0x4f15f2[_0xd61e('0x29')]])){_0x442a1a[_0xd61e('0x15')][_0x4f15f2['name']]=new VoiceQueue(_0x4f15f2);}else{_0x442a1a[_0xd61e('0x40')](_0x442a1a['voiceQueues'][_0x4f15f2[_0xd61e('0x29')]],_0x4f15f2);}}}return _0x442a1a[_0xd61e('0x15')];};};Realtime[_0xd61e('0x3f')]['initTriggers']=function(){var _0x187093=this;return function(_0x530f80){if(_0x530f80){freeIsNotKey(_0x530f80,_0x187093['triggers'],'id');for(var _0x38e0ea=0x0,_0x2db662={},_0x59e6e1={};_0x38e0ea<_0x530f80['length'];_0x38e0ea+=0x1){_0x2db662=_0x530f80[_0x38e0ea];if(_[_0xd61e('0x45')](_0x187093[_0xd61e('0x16')][_0x2db662['id']])){_0x187093['triggers'][_0x2db662['id']]=new Trigger(_0x2db662);}else{_0x187093['mergeFromDatabase'](_0x187093[_0xd61e('0x16')][_0x2db662['id']],_0x2db662);}}}return _0x187093[_0xd61e('0x16')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x46')]=function(){var _0x5e0fd3=this;return function(_0x58e788){if(_0x58e788){freeIsNotKey(_0x58e788,_0x5e0fd3[_0xd61e('0x18')],'id');for(var _0x4c496b=0x0,_0x52ea8d={},_0x2ac786={};_0x4c496b<_0x58e788['length'];_0x4c496b+=0x1){_0x52ea8d=_0x58e788[_0x4c496b];if(_[_0xd61e('0x45')](_0x5e0fd3[_0xd61e('0x18')][_0x52ea8d['id']])){_0x5e0fd3[_0xd61e('0x18')][_0x52ea8d['id']]=new Template(_0x52ea8d);}else{_0x5e0fd3[_0xd61e('0x40')](_0x5e0fd3[_0xd61e('0x18')][_0x52ea8d['id']],_0x52ea8d);}}}return _0x5e0fd3[_0xd61e('0x18')];};};Realtime['prototype'][_0xd61e('0x47')]=function(){var _0x2657dd=this;return function(_0x4e8fa1){if(_0x4e8fa1){freeIsNotKey(_0x4e8fa1,_0x2657dd[_0xd61e('0x1e')],'id');for(var _0x409792=0x0,_0x5d3472={},_0x22a574={};_0x409792<_0x4e8fa1[_0xd61e('0x42')];_0x409792+=0x1){_0x5d3472=_0x4e8fa1[_0x409792];if(_[_0xd61e('0x45')](_0x2657dd['zendeskAccounts'][_0x5d3472['id']])){_0x2657dd[_0xd61e('0x1e')][_0x5d3472['id']]=new ZendeskAccount(_0x5d3472);}else{_0x2657dd[_0xd61e('0x40')](_0x2657dd[_0xd61e('0x1e')][_0x5d3472['id']],_0x5d3472);}}}return _0x2657dd[_0xd61e('0x1e')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x48')]=function(){var _0x313578=this;return function(_0x10cc3e){if(_0x10cc3e){freeIsNotKey(_0x10cc3e,_0x313578[_0xd61e('0x49')],'id');for(var _0x5d6838=0x0,_0x1e7a81={},_0x45e47f={};_0x5d6838<_0x10cc3e[_0xd61e('0x42')];_0x5d6838+=0x1){_0x1e7a81=_0x10cc3e[_0x5d6838];if(_[_0xd61e('0x45')](_0x313578['salesforceAccounts'][_0x1e7a81['id']])){_0x313578['salesforceAccounts'][_0x1e7a81['id']]=new SalesforceAccount(_0x1e7a81);}else{_0x313578[_0xd61e('0x40')](_0x313578[_0xd61e('0x49')][_0x1e7a81['id']],_0x1e7a81);}}}return _0x313578[_0xd61e('0x49')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x4a')]=function(){var _0x35c376=this;return function(_0x428272){if(_0x428272){freeIsNotKey(_0x428272,_0x35c376[_0xd61e('0x20')],'id');for(var _0x513977=0x0,_0x19e4dc={},_0x58ce19={};_0x513977<_0x428272[_0xd61e('0x42')];_0x513977+=0x1){_0x19e4dc=_0x428272[_0x513977];if(_[_0xd61e('0x45')](_0x35c376[_0xd61e('0x20')][_0x19e4dc['id']])){_0x35c376[_0xd61e('0x20')][_0x19e4dc['id']]=new FreshdeskAccount(_0x19e4dc);}else{_0x35c376[_0xd61e('0x40')](_0x35c376['freshdeskAccounts'][_0x19e4dc['id']],_0x19e4dc);}}}return _0x35c376[_0xd61e('0x20')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x4b')]=function(){var _0x20fdae=this;return function(_0x1212c4){if(_0x1212c4){freeIsNotKey(_0x1212c4,_0x20fdae[_0xd61e('0x4c')],'id');for(var _0x7c546e=0x0,_0x23c73e={},_0x52de1d={};_0x7c546e<_0x1212c4[_0xd61e('0x42')];_0x7c546e+=0x1){_0x23c73e=_0x1212c4[_0x7c546e];if(_[_0xd61e('0x45')](_0x20fdae[_0xd61e('0x4c')][_0x23c73e['id']])){_0x20fdae['zohoAccounts'][_0x23c73e['id']]=new ZohoAccount(_0x23c73e);}else{_0x20fdae['mergeFromDatabase'](_0x20fdae['zohoAccounts'][_0x23c73e['id']],_0x23c73e);}}}return _0x20fdae[_0xd61e('0x4c')];};};Realtime[_0xd61e('0x3f')]['initDeskAccounts']=function(){var _0x584955=this;return function(_0x548842){if(_0x548842){freeIsNotKey(_0x548842,_0x584955[_0xd61e('0x21')],'id');for(var _0x43003a=0x0,_0x6441fb={},_0x5d34ee={};_0x43003a<_0x548842[_0xd61e('0x42')];_0x43003a+=0x1){_0x6441fb=_0x548842[_0x43003a];if(_['isUndefined'](_0x584955[_0xd61e('0x21')][_0x6441fb['id']])){_0x584955[_0xd61e('0x21')][_0x6441fb['id']]=new DeskAccount(_0x6441fb);}else{_0x584955[_0xd61e('0x40')](_0x584955[_0xd61e('0x21')][_0x6441fb['id']],_0x6441fb);}}}return _0x584955[_0xd61e('0x21')];};};Realtime['prototype'][_0xd61e('0x4d')]=function(){var _0x4ce3d2=this;return function(_0xc6d26e){if(_0xc6d26e){freeIsNotKey(_0xc6d26e,_0x4ce3d2[_0xd61e('0x1f')],'id');for(var _0x542c0a=0x0,_0x4359eb={},_0x2909da={};_0x542c0a<_0xc6d26e['length'];_0x542c0a+=0x1){_0x4359eb=_0xc6d26e[_0x542c0a];if(_['isUndefined'](_0x4ce3d2[_0xd61e('0x1f')][_0x4359eb['id']])){_0x4ce3d2[_0xd61e('0x1f')][_0x4359eb['id']]=new SugarcrmAccount(_0x4359eb);}else{_0x4ce3d2[_0xd61e('0x40')](_0x4ce3d2[_0xd61e('0x1f')][_0x4359eb['id']],_0x4359eb);}}}return _0x4ce3d2[_0xd61e('0x1f')];};};Realtime[_0xd61e('0x3f')]['initVtigerAccounts']=function(){var _0x5ef394=this;return function(_0x53a345){if(_0x53a345){freeIsNotKey(_0x53a345,_0x5ef394[_0xd61e('0x22')],'id');for(var _0x5738c2=0x0,_0x15d8cf={},_0x51ef0a={};_0x5738c2<_0x53a345[_0xd61e('0x42')];_0x5738c2+=0x1){_0x15d8cf=_0x53a345[_0x5738c2];if(_['isUndefined'](_0x5ef394[_0xd61e('0x22')][_0x15d8cf['id']])){_0x5ef394['vtigerAccounts'][_0x15d8cf['id']]=new VtigerAccount(_0x15d8cf);}else{_0x5ef394[_0xd61e('0x40')](_0x5ef394[_0xd61e('0x22')][_0x15d8cf['id']],_0x15d8cf);}}}return _0x5ef394[_0xd61e('0x22')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x4e')]=function(){var _0xcdeaed=this;return function(_0x4e17d7){if(_0x4e17d7){freeIsNotKey(_0x4e17d7,_0xcdeaed[_0xd61e('0x23')],'id');for(var _0x3ecd21=0x0,_0x17b94c={},_0x45e88a={};_0x3ecd21<_0x4e17d7['length'];_0x3ecd21+=0x1){_0x17b94c=_0x4e17d7[_0x3ecd21];if(_[_0xd61e('0x45')](_0xcdeaed[_0xd61e('0x23')][_0x17b94c['id']])){_0xcdeaed['servicenowAccounts'][_0x17b94c['id']]=new ServicenowAccount(_0x17b94c);}else{_0xcdeaed[_0xd61e('0x40')](_0xcdeaed[_0xd61e('0x23')][_0x17b94c['id']],_0x17b94c);}}}return _0xcdeaed['servicenowAccounts'];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x4f')]=function(){var _0x4a6138=this;return function(_0x1fddd6){if(_0x1fddd6){freeIsNotKey(_0x1fddd6,_0x4a6138[_0xd61e('0x50')],'id');for(var _0x54b850=0x0,_0x252ea5={},_0x3e7e92={};_0x54b850<_0x1fddd6[_0xd61e('0x42')];_0x54b850+=0x1){_0x252ea5=_0x1fddd6[_0x54b850];if(_['isUndefined'](_0x4a6138[_0xd61e('0x50')][_0x252ea5['id']])){_0x4a6138['dynamics365Accounts'][_0x252ea5['id']]=new Dynamics365Account(_0x252ea5);}else{_0x4a6138['mergeFromDatabase'](_0x4a6138['dynamics365Accounts'][_0x252ea5['id']],_0x252ea5);}}}return _0x4a6138[_0xd61e('0x50')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x51')]=function(){var _0x10beac=this;return function(_0xb47cf6){if(_0xb47cf6){freeIsNotKey(_0xb47cf6,_0x10beac[_0xd61e('0x24')],'id');for(var _0x22e8c8=0x0,_0x4b9381={},_0x4d01ac={};_0x22e8c8<_0xb47cf6[_0xd61e('0x42')];_0x22e8c8+=0x1){_0x4b9381=_0xb47cf6[_0x22e8c8];if(_['isUndefined'](_0x10beac[_0xd61e('0x24')][_0x4b9381['id']])){_0x10beac[_0xd61e('0x24')][_0x4b9381['id']]=new FreshsalesAccount(_0x4b9381);}else{_0x10beac['mergeFromDatabase'](_0x10beac[_0xd61e('0x24')][_0x4b9381['id']],_0x4b9381);}}}return _0x10beac['freshsalesAccounts'];};};Realtime[_0xd61e('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x355cb9=this;return function(_0x2a9519){for(var _0x3e256f=0x0;_0x3e256f<_0x2a9519[_0xd61e('0x42')];_0x3e256f+=0x1){_['merge'](_0x355cb9[_0xd61e('0x15')][_0x2a9519[_0x3e256f][_0xd61e('0x29')]],_0x2a9519[_0x3e256f]);}return _0x355cb9[_0xd61e('0x15')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x52')]=function(){var _0x4ba47c=this;return function(_0x4c0c41){clearVoiceQueues(_0x4ba47c['voiceQueues']);if(_0x4c0c41){_0x4c0c41=_['groupBy'](_0x4c0c41,_0xd61e('0x53'));for(var _0x45f7e5 in _0x4c0c41){if(_0x4c0c41[_0xd61e('0x27')](_0x45f7e5)){var _0x48f0d9={};for(var _0x2dbbe1=0x0;_0x2dbbe1<_0x4c0c41[_0x45f7e5][_0xd61e('0x42')];_0x2dbbe1+=0x1){var _0x4cc0e8=_0x4c0c41[_0x45f7e5][_0x2dbbe1]['queue'];if(_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8]){if(_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x54')]){_0x4ba47c['voiceQueues'][_0x4cc0e8][_0xd61e('0x34')]+=0x1;}if(_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x55')]){_0x4ba47c['voiceQueues'][_0x4cc0e8][_0xd61e('0x35')]+=0x1;}_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8][_0xd61e('0x2e')]+=moment(_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x56')])[_0xd61e('0x57')](moment(_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x58')]),_0xd61e('0x59'))||0x0;if(_0x2dbbe1===_0x4c0c41[_0x45f7e5][_0xd61e('0x42')]-0x1){_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8][_0xd61e('0x2f')]+=moment(_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x5a')]||_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x5b')]||_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x5c')])[_0xd61e('0x57')](moment(_0x4c0c41[_0x45f7e5][_0x2dbbe1]['queuecallerjoinAt']),_0xd61e('0x59'))||0x0;_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8][_0xd61e('0x2c')]+=0x1;if(_0x4c0c41[_0x45f7e5][_0x2dbbe1][_0xd61e('0x5d')]){_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8][_0xd61e('0x2d')]+=0x1;_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8][_0xd61e('0x30')]+=moment(_0x4c0c41[_0x45f7e5][_0x2dbbe1]['queuecallercompleteAt'])[_0xd61e('0x57')](moment(_0x4c0c41[_0x45f7e5][_0x2dbbe1]['queuecallerleaveAt']),_0xd61e('0x59'))||0x0;}}else{_0x4ba47c[_0xd61e('0x15')][_0x4cc0e8]['sumDuration']+=_0x4ba47c['voiceQueues'][_0x4cc0e8][_0xd61e('0x2e')]||0x0;}}}}}}return _0x4ba47c['voiceQueues'];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x5e')]=function(){var _0x3793dd=this;return function(_0x988e68){clearVoiceCallReports(_0x3793dd['outbound']);if(_0x988e68){for(var _0x1d6534=0x0;_0x1d6534<_0x988e68[_0xd61e('0x42')];_0x1d6534+=0x1){_0x3793dd[_0xd61e('0x19')][_0xd61e('0x2c')]+=0x1;_0x3793dd[_0xd61e('0x19')][_0xd61e('0x2f')]+=_0x988e68[_0x1d6534]['duration'];if(_0x988e68[_0x1d6534][_0xd61e('0x5f')]===_0xd61e('0x60')){_0x3793dd[_0xd61e('0x19')][_0xd61e('0x2d')]+=0x1;_0x3793dd['outbound']['sumHoldTime']+=_0x988e68[_0x1d6534][_0xd61e('0x61')]-_0x988e68[_0x1d6534][_0xd61e('0x62')]||0x0;_0x3793dd[_0xd61e('0x19')][_0xd61e('0x30')]+=_0x988e68[_0x1d6534][_0xd61e('0x62')];}}}return _0x3793dd[_0xd61e('0x19')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x63')]=function(){var _0xbfe58b=this;return function(_0x46925f){if(_0x46925f){freeIsNotKey(_0x46925f,_0xbfe58b[_0xd61e('0x17')],_0xd61e('0x29'));for(var _0x14d205=0x0,_0x2710b8={};_0x14d205<_0x46925f[_0xd61e('0x42')];_0x14d205+=0x1){_0x2710b8=_0x46925f[_0x14d205];if(_[_0xd61e('0x45')](_0xbfe58b[_0xd61e('0x17')][_0x2710b8[_0xd61e('0x29')]])){_0xbfe58b['campaigns'][_0x2710b8['name']]=new Campaign(_0x2710b8);}else{_0xbfe58b['mergeFromDatabase'](_0xbfe58b[_0xd61e('0x17')][_0x2710b8['name']],_0x2710b8);_0xbfe58b['campaigns'][_0x2710b8[_0xd61e('0x29')]][_0xd61e('0x64')]=_0x2710b8[_0xd61e('0x65')]?_0x2710b8['SquareProject'][_0xd61e('0x29')]:undefined;}}}return _0xbfe58b[_0xd61e('0x17')];};};Realtime[_0xd61e('0x3f')]['initVoiceExtensions']=function(){var _0x27638e=this;return function(_0x35da1b){if(_0x35da1b){freeIsNotKey(_0x35da1b,_0x27638e[_0xd61e('0x66')],'id');for(var _0x202834=0x0,_0x54727e={};_0x202834<_0x35da1b[_0xd61e('0x42')];_0x202834+=0x1){_0x54727e=_0x35da1b[_0x202834];if(_[_0xd61e('0x45')](_0x27638e[_0xd61e('0x66')][_0x54727e['id']])){_0x27638e['voiceExtensions'][_0x54727e['id']]=new VoiceExtension(_0x54727e);}else{_0x27638e['mergeFromDatabase'](_0x27638e[_0xd61e('0x66')][_0x54727e['id']],_0x54727e);}}}return _0x27638e['voiceExtensions'];};};Realtime[_0xd61e('0x3f')]['initCampaignHopperHistory']=function(){var _0x191326=this;return function(_0x3de90b){clearCampaigns(_0x191326[_0xd61e('0x17')]);for(var _0x3a5cee=0x0;_0x3a5cee<_0x3de90b[_0xd61e('0x42')];_0x3a5cee+=0x1){_[_0xd61e('0x67')](_0x191326['campaigns'][_0x3de90b[_0x3a5cee][_0xd61e('0x29')]],_0x3de90b[_0x3a5cee]);}return _0x191326[_0xd61e('0x17')];};};Realtime[_0xd61e('0x3f')][_0xd61e('0x68')]=function(){var _0x2fbab8=this;return function(_0x1999e7){if(_0x1999e7){freeIsNotKey(_0x1999e7,_0x2fbab8['faxAccounts'],'id');for(var _0x5cd64f=0x0,_0x50e25c={},_0x15a08a={};_0x5cd64f<_0x1999e7[_0xd61e('0x42')];_0x5cd64f+=0x1){_0x50e25c=_0x1999e7[_0x5cd64f];if(_['isUndefined'](_0x2fbab8[_0xd61e('0x25')][_0x50e25c['id']])){_0x2fbab8[_0xd61e('0x25')][_0x50e25c['id']]=new FaxAccount(_0x50e25c);}else{_0x2fbab8[_0xd61e('0x40')](_0x2fbab8['faxAccounts'][_0x50e25c['id']],_0x50e25c);}}}return _0x2fbab8['faxAccounts'];};};module[_0xd61e('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d8ee328..e244afa 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 _0xf3ac=['blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','telephones','interface','format','SIP/%s','connectedlinenum','lastAssignedTo','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','getAgentByInternal','keys','length','channel','calleridnum','internal','destination','exten','type','dialer','lastapplication','lastdata','context','from-voip-provider','from-sip','calleridpreview','destinationchannel','callerid','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','getCallType','split','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','agents','prototype','sync','realtime','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport'];(function(_0x1dcd60,_0x5f4525){var _0x5a7481=function(_0x54c5e4){while(--_0x54c5e4){_0x1dcd60['push'](_0x1dcd60['shift']());}};_0x5a7481(++_0x5f4525);}(_0xf3ac,0xf9));var _0xcf3a=function(_0x1e5c69,_0x3eacdf){_0x1e5c69=_0x1e5c69-0x0;var _0x5e66a3=_0xf3ac[_0x1e5c69];return _0x5e66a3;};'use strict';var _=require(_0xcf3a('0x0'));var moment=require(_0xcf3a('0x1'));var util=require(_0xcf3a('0x2'));var config=require(_0xcf3a('0x3'));var ami=require(_0xcf3a('0x4'));var RpcVoiceAgentReport=require(_0xcf3a('0x5'));var RpcVoiceCallReport=require(_0xcf3a('0x6'));var RpcVoiceDialReport=require(_0xcf3a('0x7'));var RpcMemberReport=require(_0xcf3a('0x8'));var RpcVoiceQueueReport=require(_0xcf3a('0x9'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xcf3a('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xcf3a('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xcf3a('0xc'));var UserReport=require(_0xcf3a('0xd'));function Report(_0x26653c){this['realtime']=_0x26653c;this[_0xcf3a('0xe')]=_0x26653c['agents'];this['telephones']=_0x26653c['telephones'];}Report[_0xcf3a('0xf')][_0xcf3a('0x10')]=function(_0x3d5a9e){var _0x2b2065=new VoiceQueueReport(this[_0xcf3a('0x11')]);var _0x11bf1b=new VoiceAgentReport(this[_0xcf3a('0x11')]);var _0x4a0177=new VoiceDialReport(this[_0xcf3a('0x11')]);var _0x4c763c=new VoiceCallReport(this[_0xcf3a('0x11')]);var _0x5ac3b5=new UserReport(this[_0xcf3a('0x11')]);if(config['xdr']&&config['xdr'][_0xcf3a('0x12')]){ami['on'](_0xcf3a('0x13'),this[_0xcf3a('0x14')][_0xcf3a('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xcf3a('0x16')][_0xcf3a('0x15')](this));ami['on'](_0xcf3a('0x17'),this[_0xcf3a('0x18')][_0xcf3a('0x15')](this));ami['on'](_0xcf3a('0x19'),this[_0xcf3a('0x1a')][_0xcf3a('0x15')](this));ami['on'](_0xcf3a('0x1b'),this[_0xcf3a('0x1c')][_0xcf3a('0x15')](this));ami['on'](_0xcf3a('0x1d'),this[_0xcf3a('0x1e')]['bind'](this));}};Report[_0xcf3a('0xf')][_0xcf3a('0x1f')]=function(_0x2d898c){var _0x27295e;_0x27295e=_[_0xcf3a('0x20')](this[_0xcf3a('0xe')],function(_0x217afc){return _0x217afc[_0xcf3a('0x21')]==_0x2d898c||_0x217afc[_0xcf3a('0x22')]==_0x2d898c;});if(_[_0xcf3a('0x23')](_0x27295e)){var _0x117d0f=_[_0xcf3a('0x20')](this[_0xcf3a('0x24')],function(_0x373644){return _0x373644['accountcode']==_0x2d898c||_0x373644['name']==_0x2d898c;});if(_0x117d0f){_0x27295e=_['find'](this[_0xcf3a('0xe')],function(_0x3e392f){return _0x3e392f[_0xcf3a('0x25')]==util[_0xcf3a('0x26')](_0xcf3a('0x27'),_0x117d0f['name']);});}}return _0x27295e;};Report[_0xcf3a('0xf')][_0xcf3a('0x14')]=function(_0x3df647){for(var _0x55b981=0x0;_0x55b981<_0x3df647['length'];_0x55b981+=0x1){var _0xfa5276=this['findAgent'](_0x3df647[_0x55b981][_0xcf3a('0x28')]);if(_0xfa5276){_0x3df647[_0x55b981]['accountcode']=_0xfa5276[_0xcf3a('0x21')];_0x3df647[_0x55b981]['assigned']=!![];_0x3df647[_0x55b981][_0xcf3a('0x29')]=_0xfa5276[_0xcf3a('0x22')];_0x3df647[_0x55b981]['interface']=_['isNil'](_0xfa5276[_0xcf3a('0x25')])?util[_0xcf3a('0x26')](_0xcf3a('0x27'),_0xfa5276['name']):_0xfa5276[_0xcf3a('0x25')];if(_0x3df647[_0x55b981]['queuecallercomplete']){_0x3df647[_0x55b981][_0xcf3a('0x2a')]=moment()[_0xcf3a('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3df647[_0x55b981][_0xcf3a('0x2b')]){_0x3df647[_0x55b981]['queuecallerexitAt']=moment()[_0xcf3a('0x26')](_0xcf3a('0x2c'));}RpcMemberReport[_0xcf3a('0x14')](_0x3df647[_0x55b981]);}RpcVoiceQueueReport[_0xcf3a('0x2d')](_0x3df647[_0x55b981]);}};function extractCalleridNumber(_0x140efe){var _0x3a01b4=_0x140efe['match'](/<(.*?)>/);return _0x3a01b4?_0x3a01b4[0x1]:_0x140efe;}Report[_0xcf3a('0xf')][_0xcf3a('0x2e')]=function(_0x456348){for(var _0x275320=0x0;_0x275320','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','length','monitorFilename','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','voiceAgentReport','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer'];(function(_0x3e878b,_0x253b2e){var _0x6f0cff=function(_0x4c9761){while(--_0x4c9761){_0x3e878b['push'](_0x3e878b['shift']());}};_0x6f0cff(++_0x253b2e);}(_0x3b41,0xa0));var _0x13b4=function(_0x58cc71,_0x2c45d1){_0x58cc71=_0x58cc71-0x0;var _0x1d67e9=_0x3b41[_0x58cc71];return _0x1d67e9;};'use strict';var _=require(_0x13b4('0x0'));var moment=require('moment');var util=require(_0x13b4('0x1'));var config=require(_0x13b4('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x13b4('0x3'));var RpcVoiceCallReport=require(_0x13b4('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x13b4('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x13b4('0x6'));var RpcVoiceTransferReport=require(_0x13b4('0x7'));var VoiceQueueReport=require(_0x13b4('0x8'));var VoiceCallReport=require(_0x13b4('0x9'));var VoiceAgentReport=require(_0x13b4('0xa'));var VoiceDialReport=require(_0x13b4('0xb'));var UserReport=require('./userReport');function Report(_0x2f2ccc){this[_0x13b4('0xc')]=_0x2f2ccc;this[_0x13b4('0xd')]=_0x2f2ccc[_0x13b4('0xd')];this[_0x13b4('0xe')]=_0x2f2ccc[_0x13b4('0xe')];}Report[_0x13b4('0xf')][_0x13b4('0x10')]=function(_0x1141da){var _0x3920fe=new VoiceQueueReport(this[_0x13b4('0xc')]);var _0x2e7eb3=new VoiceAgentReport(this['realtime']);var _0x3fcaed=new VoiceDialReport(this[_0x13b4('0xc')]);var _0x3024f9=new VoiceCallReport(this[_0x13b4('0xc')]);var _0x555c1c=new UserReport(this[_0x13b4('0xc')]);if(config['xdr']&&config[_0x13b4('0x11')][_0x13b4('0x12')]){ami['on'](_0x13b4('0x13'),this[_0x13b4('0x14')][_0x13b4('0x15')](this));ami['on'](_0x13b4('0x16'),this[_0x13b4('0x17')][_0x13b4('0x15')](this));ami['on'](_0x13b4('0x18'),this['voiceAgentReport'][_0x13b4('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x13b4('0x19')][_0x13b4('0x15')](this));ami['on'](_0x13b4('0x1a'),this[_0x13b4('0x1b')][_0x13b4('0x15')](this));ami['on'](_0x13b4('0x1c'),this[_0x13b4('0x1d')][_0x13b4('0x15')](this));}};Report[_0x13b4('0xf')]['findAgent']=function(_0x36d9a8){var _0x81f181;_0x81f181=_[_0x13b4('0x1e')](this['agents'],function(_0x226364){return _0x226364[_0x13b4('0x1f')]==_0x36d9a8||_0x226364['name']==_0x36d9a8;});if(_[_0x13b4('0x20')](_0x81f181)){var _0x2f494c=_['find'](this[_0x13b4('0xe')],function(_0x29ddc2){return _0x29ddc2['accountcode']==_0x36d9a8||_0x29ddc2[_0x13b4('0x21')]==_0x36d9a8;});if(_0x2f494c){_0x81f181=_[_0x13b4('0x1e')](this[_0x13b4('0xd')],function(_0x1a3399){return _0x1a3399[_0x13b4('0x22')]==util['format'](_0x13b4('0x23'),_0x2f494c['name']);});}}return _0x81f181;};Report[_0x13b4('0xf')][_0x13b4('0x14')]=function(_0xf4e8a7){for(var _0x9ce2ff=0x0;_0x9ce2ff<_0xf4e8a7['length'];_0x9ce2ff+=0x1){var _0x4fb23f=this[_0x13b4('0x24')](_0xf4e8a7[_0x9ce2ff][_0x13b4('0x25')]);if(_0x4fb23f){_0xf4e8a7[_0x9ce2ff][_0x13b4('0x1f')]=_0x4fb23f[_0x13b4('0x1f')];_0xf4e8a7[_0x9ce2ff][_0x13b4('0x26')]=!![];_0xf4e8a7[_0x9ce2ff][_0x13b4('0x27')]=_0x4fb23f[_0x13b4('0x21')];_0xf4e8a7[_0x9ce2ff][_0x13b4('0x22')]=_['isNil'](_0x4fb23f[_0x13b4('0x22')])?util[_0x13b4('0x28')]('SIP/%s',_0x4fb23f['name']):_0x4fb23f[_0x13b4('0x22')];if(_0xf4e8a7[_0x9ce2ff][_0x13b4('0x29')]){_0xf4e8a7[_0x9ce2ff]['queuecallercompleteAt']=moment()['format'](_0x13b4('0x2a'));}if(_0xf4e8a7[_0x9ce2ff][_0x13b4('0x2b')]){_0xf4e8a7[_0x9ce2ff][_0x13b4('0x2c')]=moment()[_0x13b4('0x28')](_0x13b4('0x2a'));}RpcMemberReport[_0x13b4('0x14')](_0xf4e8a7[_0x9ce2ff]);}RpcVoiceQueueReport[_0x13b4('0x2d')](_0xf4e8a7[_0x9ce2ff]);}};function extractCalleridNumber(_0x5cbadd){var _0x25903c=_0x5cbadd[_0x13b4('0x2e')](/<(.*?)>/);return _0x25903c?_0x25903c[0x1]:_0x5cbadd;}Report[_0x13b4('0xf')][_0x13b4('0x2f')]=function(_0x201edb){for(var _0x3fe26c=0x0;_0x3fe26c0x0?_0x1fa23a:0x0;this['voiceQueues'][_0xa8e87c['queue']][_0xfc68('0x2e')]=this[_0xfc68('0x11')][_0xa8e87c[_0xfc68('0x64')]][_0xfc68('0x2e')]>_[_0xfc68('0x69')](_0xa8e87c[_0xfc68('0x6a')])?_[_0xfc68('0x69')](_0xa8e87c[_0xfc68('0x6a')]):this[_0xfc68('0x11')][_0xa8e87c[_0xfc68('0x64')]][_0xfc68('0x2e')];this[_0xfc68('0x4d')](this[_0xfc68('0x11')][_0xa8e87c[_0xfc68('0x64')]],_0xfc68('0x14'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xfc68('0x38')](this[_0xfc68('0x11')][_0xa8e87c[_0xfc68('0x64')]],{'showHidden':![],'depth':null}));ami[_0xfc68('0x3e')](_0xfc68('0x6c'),this[_0xfc68('0x11')][_0xa8e87c[_0xfc68('0x64')]]);}}}catch(_0x5e59dc){logger[_0xfc68('0x37')](_0xfc68('0x6d'),util[_0xfc68('0x38')](_0x5e59dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc68('0x9')][_0xfc68('0x18')]=function(_0x295081){logger['debug'](_0xfc68('0x6e'),util[_0xfc68('0x38')](_0x295081,{'showHidden':![],'depth':null}));this[_0xfc68('0x60')]=!![];};VoiceQueueReport[_0xfc68('0x9')][_0xfc68('0x6f')]=function(_0x369a23){try{if(this[_0xfc68('0x62')](_0x369a23)){logger[_0xfc68('0x40')](_0xfc68('0x70'),_0x369a23[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x369a23,{'showHidden':![],'depth':null}));if(_[_0xfc68('0x5b')](this[_0xfc68('0xd')][_0x369a23[_0xfc68('0x42')]]))this[_0xfc68('0xd')][_0x369a23[_0xfc68('0x42')]]=[];if(_['isUndefined'](this['channels'][_0x369a23['uniqueid']]))this[_0xfc68('0xf')][_0x369a23[_0xfc68('0x42')]]={};var _0x4ad572=new QueueReport();_0x4ad572[_0xfc68('0x44')]=_0x369a23['queue'];_0x4ad572[_0xfc68('0x71')]=this['voiceQueues'][_0x4ad572[_0xfc68('0x44')]]&&this[_0xfc68('0x11')][_0x4ad572['name']][_0xfc68('0x71')]?this[_0xfc68('0x11')][_0x4ad572['name']]['type']||'inbound':_0xfc68('0x4e');_0x4ad572[_0xfc68('0x64')]=_0x369a23[_0xfc68('0x64')];_0x4ad572[_0xfc68('0x72')]=moment()[_0xfc68('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ad572[_0xfc68('0x73')]=_0x369a23[_0xfc68('0x73')];_0x4ad572[_0xfc68('0x74')]=_0x369a23['count'];_0x4ad572[_0xfc68('0x42')]=_0x369a23[_0xfc68('0x42')];_0x4ad572[_0xfc68('0x75')]=this[_0xfc68('0xf')][_0x369a23['uniqueid']]['routealias'];logger['info'](_0xfc68('0x76'),_0x4ad572[_0xfc68('0x44')],_0x4ad572['type']);_[_0xfc68('0x77')](_0x4ad572,_[_0xfc68('0x78')](_0x369a23,_[_0xfc68('0x79')](_0x4ad572)));this[_0xfc68('0xd')][_0x369a23['uniqueid']][_0xfc68('0x7a')](_0x4ad572);this['channels'][_0x369a23[_0xfc68('0x42')]]=_0x4ad572;this[_0xfc68('0x3f')](_0x4ad572,_0xfc68('0x19'));}}catch(_0xd01baf){logger['error'](_0xfc68('0x70'),_0x369a23[_0xfc68('0x42')],util[_0xfc68('0x38')](_0xd01baf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc68('0x9')]['syncQueueCallerAbandon']=function(_0x15c983){try{if(this['isNotNull'](_0x15c983)){logger[_0xfc68('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x15c983['uniqueid'],util[_0xfc68('0x38')](_0x15c983,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x15c983[_0xfc68('0x42')]]){var _0x487986=_[_0xfc68('0x7b')](this[_0xfc68('0xd')][_0x15c983[_0xfc68('0x42')]]);_0x487986[_0xfc68('0x7c')]=![];_0x487986['queuecallercompleteAt']=null;_0x487986[_0xfc68('0x7d')]=_0x15c983[_0xfc68('0x7d')];_0x487986[_0xfc68('0x7e')]=_0x15c983['originalposition'];_0x487986[_0xfc68('0x7f')]=!![];_0x487986[_0xfc68('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x487986['queuecallerexitreason']=_0xfc68('0x81');_0x487986[_0xfc68('0x82')]=null;logger['info'](_0xfc68('0x83'),_0x487986[_0xfc68('0x44')],_0x487986[_0xfc68('0x71')]);this[_0xfc68('0xf')][_0x15c983[_0xfc68('0x42')]]=_0x487986;this[_0xfc68('0x47')](_0x487986,_0xfc68('0x7f'));}}}catch(_0x4fd711){logger[_0xfc68('0x37')](_0xfc68('0x84'),_0x15c983[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x4fd711,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x3c6f8e){try{if(this[_0xfc68('0x62')](_0x3c6f8e)){logger[_0xfc68('0x40')](_0xfc68('0x85'),_0x3c6f8e['uniqueid'],util[_0xfc68('0x38')](_0x3c6f8e,{'showHidden':![],'depth':null}));if(this[_0xfc68('0xd')][_0x3c6f8e['uniqueid']]){var _0x183307=_[_0xfc68('0x7b')](this[_0xfc68('0xd')][_0x3c6f8e[_0xfc68('0x42')]]);_0x183307['queuecallerleaveAt']=moment()[_0xfc68('0x43')](_0xfc68('0x86'));_0x183307[_0xfc68('0x87')]=_0x3c6f8e[_0xfc68('0x87')];_0x183307[_0xfc68('0x88')]=_0x3c6f8e[_0xfc68('0x88')];logger[_0xfc68('0x65')](_0xfc68('0x89'),_0x183307[_0xfc68('0x44')],_0x183307[_0xfc68('0x71')],_0x3c6f8e[_0xfc68('0x87')],_0x3c6f8e[_0xfc68('0x88')]);this[_0xfc68('0xf')][_0x3c6f8e[_0xfc68('0x42')]]=_0x183307;this[_0xfc68('0x3f')](_0x183307,_0xfc68('0x1b'));}}}catch(_0x225bec){logger[_0xfc68('0x37')](_0xfc68('0x85'),_0x3c6f8e[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x225bec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc68('0x9')][_0xfc68('0x8a')]=function(_0x4154aa){try{if(this[_0xfc68('0x62')](_0x4154aa)){logger[_0xfc68('0x40')]('[%s][voiceQueueReport][agentconnect]',_0x4154aa['uniqueid'],util[_0xfc68('0x38')](_0x4154aa,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4154aa[_0xfc68('0x42')]]){var _0x3e99ab=_[_0xfc68('0x7b')](this[_0xfc68('0xd')][_0x4154aa[_0xfc68('0x42')]]);_0x3e99ab['queuecallercomplete']=!![];_0x3e99ab[_0xfc68('0x49')]=_0xfc68('0x8b');logger[_0xfc68('0x65')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3e99ab[_0xfc68('0x44')],_0x3e99ab['type']);}}}catch(_0x3fa2d3){logger[_0xfc68('0x37')](_0xfc68('0x8c'),_0x4154aa[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x3fa2d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfc68('0x1e')]=function(_0x2fd1d2){try{if(this[_0xfc68('0x62')](_0x2fd1d2)){logger[_0xfc68('0x40')](_0xfc68('0x8d'),_0x2fd1d2[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x2fd1d2,{'showHidden':![],'depth':null}));if(this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x42')]]){var _0x28edca=_[_0xfc68('0x7b')](this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x42')]]);_0x28edca[_0xfc68('0x7f')]=![];_0x28edca['queuecallerabandonAt']=null;_0x28edca[_0xfc68('0x8e')]=!![];_0x28edca[_0xfc68('0x82')]=_0x2fd1d2[_0xfc68('0x8f')];_0x28edca[_0xfc68('0x7d')]=_0x2fd1d2[_0xfc68('0x7d')];_0x28edca[_0xfc68('0x7c')]=!![];_0x28edca[_0xfc68('0x90')]=![];_0x28edca['queuecallerexitAt']=null;if(!_0x28edca['transfer']){if(_0x2fd1d2[_0xfc68('0x91')]==_0xfc68('0x92')){_0x28edca[_0xfc68('0x49')]=_0xfc68('0x93');logger[_0xfc68('0x65')](_0xfc68('0x94'),_0x28edca[_0xfc68('0x44')],_0x28edca['type']);}else{if(_[_0xfc68('0x95')](_0x2fd1d2[_0xfc68('0x35')]['toLowerCase'](),_0xfc68('0x96'))){if(this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x97')]]){var _0x4f8a48=_['last'](this[_0xfc68('0xd')][_0x2fd1d2['linkedid']]);_0x4f8a48[_0xfc68('0x7c')]=![];_0x4f8a48[_0xfc68('0x90')]=!![];_0x4f8a48[_0xfc68('0x98')]=moment(_0x28edca[_0xfc68('0x72')])[_0xfc68('0x99')](_0x2fd1d2[_0xfc68('0x7d')],_0xfc68('0x9a'))[_0xfc68('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f8a48[_0xfc68('0x49')]=_0xfc68('0x9b');_0x4f8a48[_0xfc68('0x92')]=!![];_0x4f8a48[_0xfc68('0x9c')]=_0xfc68('0x9d');_0x4f8a48[_0xfc68('0x9e')]=_0x2fd1d2[_0xfc68('0x9f')];_0x4f8a48[_0xfc68('0xa0')]=_0x2fd1d2[_0xfc68('0x42')];logger[_0xfc68('0x65')](_0xfc68('0xa1'),_0x4f8a48[_0xfc68('0x44')],_0x4f8a48[_0xfc68('0x71')]);var _0x56a86b=this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x97')]];this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x97')]]=this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x42')]];this[_0xfc68('0xd')][_0x2fd1d2[_0xfc68('0x42')]]=_0x56a86b;}}else{_0x28edca[_0xfc68('0x49')]=_0xfc68('0xa2')+_0x2fd1d2[_0xfc68('0x91')][_0xfc68('0xa3')]();logger[_0xfc68('0x65')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x28edca[_0xfc68('0x44')],_0x28edca[_0xfc68('0x71')],_0x28edca[_0xfc68('0x49')]);}}}this[_0xfc68('0xf')][_0x2fd1d2[_0xfc68('0x42')]]=_0x28edca;this[_0xfc68('0x47')](_0x28edca,_0xfc68('0x1d'));}}}catch(_0x43c7ca){logger[_0xfc68('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x2fd1d2[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x43c7ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc68('0x9')][_0xfc68('0x21')]=function(_0x4208da){try{if(this[_0xfc68('0x62')](_0x4208da)){logger[_0xfc68('0x40')]('[%s][voiceQueueReport][varset]',_0x4208da[_0xfc68('0x42')],util['inspect'](_0x4208da,{'showHidden':![],'depth':null}));this[_0xfc68('0xa4')](_0x4208da[_0xfc68('0x42')],_[_0xfc68('0x79')](_0x4208da[_0xfc68('0xa5')])[0x0],_0x4208da[_0xfc68('0xa6')]);if(this[_0xfc68('0xd')][_0x4208da[_0xfc68('0x42')]]){var _0x43f7f1=_[_0xfc68('0x7b')](this[_0xfc68('0xd')][_0x4208da['uniqueid']]);if(_0x43f7f1){if(this[_0xfc68('0x62')](_0x4208da[_0xfc68('0xa5')])&&this['isNotNull'](_0x4208da[_0xfc68('0xa5')]['queuestatus'])){switch(_0x4208da[_0xfc68('0xa6')]){case'CONTINUE':_0x43f7f1[_0xfc68('0x90')]=![];_0x43f7f1['queuecallerexitAt']=null;break;case _0xfc68('0xa7'):_0x43f7f1[_0xfc68('0xa8')]=_0xfc68('0xa9');_0x43f7f1[_0xfc68('0x90')]=!![];_0x43f7f1[_0xfc68('0x98')]=moment()[_0xfc68('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x43f7f1[_0xfc68('0xaa')]=moment()[_0xfc68('0x43')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfc68('0x40')](_0xfc68('0xab'),_0x4208da[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x43f7f1,{'showHidden':![],'depth':null}));ami[_0xfc68('0x3e')]('custom:timeout',_0x43f7f1);break;default:_0x43f7f1['queuecallerexit']=!![];_0x43f7f1[_0xfc68('0x98')]=moment()[_0xfc68('0x43')](_0xfc68('0x86'));_0x43f7f1[_0xfc68('0xaa')]=moment()[_0xfc68('0x43')](_0xfc68('0x86'));}_0x43f7f1[_0xfc68('0x7f')]=![];_0x43f7f1[_0xfc68('0x80')]=null;_0x43f7f1[_0xfc68('0x49')]=_0x4208da[_0xfc68('0xa6')];this[_0xfc68('0xf')][_0x4208da[_0xfc68('0x42')]]=_0x43f7f1;this[_0xfc68('0x47')](_0x43f7f1,_0xfc68('0x20'));}else if(this['isNotNull'](_0x4208da['variable'])&&this[_0xfc68('0x62')](_0x4208da['variable'][_0xfc68('0xac')])){if(!_0x43f7f1[_0xfc68('0x7f')]){_0x43f7f1['queuecallerexit']=!![];_0x43f7f1[_0xfc68('0x98')]=moment()[_0xfc68('0x43')](_0xfc68('0x86'));_0x43f7f1['queuecallerexitreason']=_0xfc68('0xad');_0x43f7f1[_0xfc68('0xaa')]=moment()[_0xfc68('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfc68('0xf')][_0x4208da[_0xfc68('0x42')]]=_0x43f7f1;}}logger[_0xfc68('0x65')](_0xfc68('0xae'),_0x4208da[_0xfc68('0x42')],_0x43f7f1[_0xfc68('0x44')],_0x43f7f1[_0xfc68('0x71')],_[_0xfc68('0x79')](_0x4208da[_0xfc68('0xa5')])[0x0],_0x4208da[_0xfc68('0xa6')]);_0x43f7f1[_0xfc68('0x13')]=this[_0xfc68('0x13')][_0x4208da[_0xfc68('0x42')]];}}}}catch(_0x4fbd39){logger[_0xfc68('0x37')](_0xfc68('0xaf'),_0x4208da[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x4fbd39,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc68('0x9')][_0xfc68('0xa4')]=function(_0x592587,_0x42cfe8,_0x45d617){var _0x5e3aac=['rtpaudioqos',_0xfc68('0xb0'),_0xfc68('0xb1'),'rtpaudioqosjitterbridged',_0xfc68('0xb2'),'rtpaudioqoslossbridged',_0xfc68('0xb3'),_0xfc68('0xb4'),'sipcallid','sipuri',_0xfc68('0xb5'),'bridgepvtcallid','membercalls',_0xfc68('0xb6'),'memberinterface','memberlastcall',_0xfc68('0x8f'),_0xfc68('0xb7'),_0xfc68('0xb8')];if(!_[_0xfc68('0x34')](_0x42cfe8)&&!_['includes'](_0x5e3aac,_0x42cfe8)){if(_[_0xfc68('0x5b')](this[_0xfc68('0x13')][_0x592587])){this[_0xfc68('0x13')][_0x592587]={};}this['variables'][_0x592587][_0x42cfe8]=_0x45d617;}};VoiceQueueReport[_0xfc68('0x9')]['syncHangup']=function(_0x22beb5){try{if(this['isNotNull'](_0x22beb5)){logger[_0xfc68('0x40')](_0xfc68('0xb9'),_0x22beb5[_0xfc68('0x42')],util[_0xfc68('0x38')](_0x22beb5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x22beb5['uniqueid']]){for(var _0x59c6b5=0x0,_0x424ab5={};_0x59c6b50x0?_0x3b0199:0x0;this['voiceQueues'][_0x5cb0dc['queue']][_0x3536('0x2f')]=this[_0x3536('0x12')][_0x5cb0dc[_0x3536('0x68')]][_0x3536('0x2f')]>_[_0x3536('0x6b')](_0x5cb0dc['loggedin'])?_[_0x3536('0x6b')](_0x5cb0dc[_0x3536('0x6c')]):this['voiceQueues'][_0x5cb0dc[_0x3536('0x68')]][_0x3536('0x2f')];this['emitVoiceQueueSummary'](this[_0x3536('0x12')][_0x5cb0dc['queue']],_0x3536('0x15'));}logger['debug'](_0x3536('0x6d'),util[_0x3536('0x3e')](this[_0x3536('0x12')][_0x5cb0dc[_0x3536('0x68')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3536('0x6e'),this[_0x3536('0x12')][_0x5cb0dc[_0x3536('0x68')]]);}}}catch(_0x29f892){logger[_0x3536('0x3c')](_0x3536('0x6f'),util['inspect'](_0x29f892,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3536('0xa')]['syncQueueSummaryComplete']=function(_0x2799e8){logger[_0x3536('0x4e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x3536('0x3e')](_0x2799e8,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x3536('0x1b')]=function(_0x3dfd77){try{if(this[_0x3536('0x62')](_0x3dfd77)){logger['debug'](_0x3536('0x70'),_0x3dfd77[_0x3536('0x49')],util[_0x3536('0x3e')](_0x3dfd77,{'showHidden':![],'depth':null}));if(_[_0x3536('0x63')](this[_0x3536('0xf')][_0x3dfd77[_0x3536('0x49')]]))this['queueReports'][_0x3dfd77[_0x3536('0x49')]]=[];if(_[_0x3536('0x63')](this[_0x3536('0x34')][_0x3dfd77[_0x3536('0x49')]]))this[_0x3536('0x34')][_0x3dfd77[_0x3536('0x49')]]={};var _0x564143=new QueueReport();_0x564143[_0x3536('0x51')]=_0x3dfd77['queue'];_0x564143[_0x3536('0x53')]=this[_0x3536('0x12')][_0x564143['name']]&&this['voiceQueues'][_0x564143['name']][_0x3536('0x53')]?this[_0x3536('0x12')][_0x564143[_0x3536('0x51')]][_0x3536('0x53')]||'inbound':_0x3536('0x54');_0x564143[_0x3536('0x68')]=_0x3dfd77[_0x3536('0x68')];_0x564143[_0x3536('0x71')]=moment()[_0x3536('0x4a')](_0x3536('0x72'));_0x564143[_0x3536('0x73')]=_0x3dfd77[_0x3536('0x73')];_0x564143[_0x3536('0x74')]=_0x3dfd77[_0x3536('0x74')];_0x564143[_0x3536('0x49')]=_0x3dfd77['uniqueid'];_0x564143[_0x3536('0x75')]=this[_0x3536('0x34')][_0x3dfd77['uniqueid']][_0x3536('0x75')];logger[_0x3536('0x76')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x564143[_0x3536('0x51')],_0x564143[_0x3536('0x53')]);_['merge'](_0x564143,_[_0x3536('0x77')](_0x3dfd77,_[_0x3536('0x78')](_0x564143)));this['queueReports'][_0x3dfd77[_0x3536('0x49')]]['push'](_0x564143);this[_0x3536('0x34')][_0x3dfd77[_0x3536('0x49')]]=_0x564143;this[_0x3536('0x46')](_0x564143,'queuecallerjoin');}}catch(_0x37795f){logger[_0x3536('0x3c')](_0x3536('0x70'),_0x3dfd77['uniqueid'],util['inspect'](_0x37795f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3536('0x1d')]=function(_0x4f0c7d){try{if(this[_0x3536('0x62')](_0x4f0c7d)){logger[_0x3536('0x4e')](_0x3536('0x79'),_0x4f0c7d[_0x3536('0x49')],util[_0x3536('0x3e')](_0x4f0c7d,{'showHidden':![],'depth':null}));if(this[_0x3536('0xf')][_0x4f0c7d['uniqueid']]){var _0x46ef81=_[_0x3536('0x7a')](this[_0x3536('0xf')][_0x4f0c7d[_0x3536('0x49')]]);_0x46ef81[_0x3536('0x7b')]=![];_0x46ef81[_0x3536('0x7c')]=null;_0x46ef81[_0x3536('0x7d')]=_0x4f0c7d[_0x3536('0x7d')];_0x46ef81[_0x3536('0x7e')]=_0x4f0c7d[_0x3536('0x7e')];_0x46ef81[_0x3536('0x1c')]=!![];_0x46ef81[_0x3536('0x7f')]=moment()[_0x3536('0x4a')](_0x3536('0x72'));_0x46ef81[_0x3536('0x80')]=_0x3536('0x81');_0x46ef81[_0x3536('0x82')]=null;logger[_0x3536('0x76')](_0x3536('0x83'),_0x46ef81[_0x3536('0x51')],_0x46ef81[_0x3536('0x53')]);this[_0x3536('0x34')][_0x4f0c7d[_0x3536('0x49')]]=_0x46ef81;this['emitVoiceQueueChannelRemove'](_0x46ef81,_0x3536('0x1c'));}}}catch(_0x35b9b9){logger[_0x3536('0x3c')](_0x3536('0x79'),_0x4f0c7d[_0x3536('0x49')],util['inspect'](_0x35b9b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3536('0x1f')]=function(_0x5c23fb){try{if(this[_0x3536('0x62')](_0x5c23fb)){logger[_0x3536('0x4e')](_0x3536('0x84'),_0x5c23fb[_0x3536('0x49')],util[_0x3536('0x3e')](_0x5c23fb,{'showHidden':![],'depth':null}));if(this[_0x3536('0xf')][_0x5c23fb[_0x3536('0x49')]]){var _0x136a31=_['last'](this[_0x3536('0xf')][_0x5c23fb[_0x3536('0x49')]]);_0x136a31[_0x3536('0x85')]=moment()[_0x3536('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x136a31[_0x3536('0x86')]=_0x5c23fb[_0x3536('0x86')];_0x136a31[_0x3536('0x87')]=_0x5c23fb['connectedlinename'];logger[_0x3536('0x76')](_0x3536('0x88'),_0x136a31['name'],_0x136a31[_0x3536('0x53')],_0x5c23fb['connectedlinenum'],_0x5c23fb[_0x3536('0x87')]);this[_0x3536('0x34')][_0x5c23fb[_0x3536('0x49')]]=_0x136a31;this[_0x3536('0x46')](_0x136a31,_0x3536('0x1e'));}}}catch(_0x37d076){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x5c23fb[_0x3536('0x49')],util[_0x3536('0x3e')](_0x37d076,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3536('0x89')]=function(_0x4e0142){try{if(this[_0x3536('0x62')](_0x4e0142)){logger[_0x3536('0x4e')]('[%s][voiceQueueReport][agentconnect]',_0x4e0142[_0x3536('0x49')],util['inspect'](_0x4e0142,{'showHidden':![],'depth':null}));if(this[_0x3536('0xf')][_0x4e0142[_0x3536('0x49')]]){var _0x3a9f61=_['last'](this['queueReports'][_0x4e0142[_0x3536('0x49')]]);_0x3a9f61[_0x3536('0x7b')]=!![];_0x3a9f61['queuecallerexitreason']=_0x3536('0x8a');logger[_0x3536('0x76')](_0x3536('0x8b'),_0x3a9f61[_0x3536('0x51')],_0x3a9f61[_0x3536('0x53')]);}}}catch(_0x2a2bb3){logger[_0x3536('0x3c')]('[%s][voiceQueueReport][agentconnect]',_0x4e0142[_0x3536('0x49')],util[_0x3536('0x3e')](_0x2a2bb3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3536('0xa')][_0x3536('0x8c')]=function(_0x13f14b){try{if(this['isNotNull'](_0x13f14b)){logger[_0x3536('0x4e')]('[%s][voiceQueueReport][agentcomplete]',_0x13f14b['uniqueid'],util[_0x3536('0x3e')](_0x13f14b,{'showHidden':![],'depth':null}));if(this[_0x3536('0xf')][_0x13f14b[_0x3536('0x49')]]){var _0x37c31f=_[_0x3536('0x7a')](this[_0x3536('0xf')][_0x13f14b[_0x3536('0x49')]]);_0x37c31f[_0x3536('0x1c')]=![];_0x37c31f['queuecallerabandonAt']=null;_0x37c31f[_0x3536('0x8d')]=!![];_0x37c31f[_0x3536('0x82')]=_0x13f14b['membername'];_0x37c31f[_0x3536('0x7d')]=_0x13f14b[_0x3536('0x7d')];_0x37c31f[_0x3536('0x7b')]=!![];_0x37c31f['queuecallerexit']=![];_0x37c31f[_0x3536('0x8e')]=null;if(!_0x37c31f[_0x3536('0x8f')]){if(_0x13f14b[_0x3536('0x90')]==_0x3536('0x8f')){_0x37c31f[_0x3536('0x80')]='COMPLETED';logger[_0x3536('0x76')](_0x3536('0x91'),_0x37c31f[_0x3536('0x51')],_0x37c31f['type']);}else{if(_[_0x3536('0x92')](_0x13f14b[_0x3536('0x39')][_0x3536('0x93')](),_0x3536('0x94'))){if(this[_0x3536('0xf')][_0x13f14b[_0x3536('0x95')]]){var _0x56d970=_['last'](this[_0x3536('0xf')][_0x13f14b[_0x3536('0x95')]]);_0x56d970[_0x3536('0x7b')]=![];_0x56d970[_0x3536('0x96')]=!![];_0x56d970['queuecallerexitAt']=moment(_0x37c31f[_0x3536('0x71')])[_0x3536('0x97')](_0x13f14b[_0x3536('0x7d')],_0x3536('0x98'))[_0x3536('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x56d970[_0x3536('0x80')]=_0x3536('0x99');_0x56d970[_0x3536('0x8f')]=!![];_0x56d970[_0x3536('0x9a')]=_0x3536('0x9b');_0x56d970['transferexten']=_0x13f14b[_0x3536('0x9c')];_0x56d970['transferuniqueid']=_0x13f14b['uniqueid'];logger[_0x3536('0x76')](_0x3536('0x9d'),_0x56d970[_0x3536('0x51')],_0x56d970[_0x3536('0x53')]);var _0x18c623=this[_0x3536('0xf')][_0x13f14b['linkedid']];this['queueReports'][_0x13f14b[_0x3536('0x95')]]=this['queueReports'][_0x13f14b['uniqueid']];this[_0x3536('0xf')][_0x13f14b['uniqueid']]=_0x18c623;}}else{_0x37c31f['queuecallerexitreason']=_0x3536('0x9e')+_0x13f14b[_0x3536('0x90')]['toUpperCase']();logger[_0x3536('0x76')](_0x3536('0x9f'),_0x37c31f[_0x3536('0x51')],_0x37c31f[_0x3536('0x53')],_0x37c31f[_0x3536('0x80')]);}}}this['channels'][_0x13f14b[_0x3536('0x49')]]=_0x37c31f;this[_0x3536('0x43')](_0x37c31f,_0x3536('0x20'));}}}catch(_0x3e1ae1){logger['error'](_0x3536('0xa0'),_0x13f14b[_0x3536('0x49')],util['inspect'](_0x3e1ae1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3536('0x23')]=function(_0x47892c){try{if(this['isNotNull'](_0x47892c)){logger[_0x3536('0x4e')](_0x3536('0xa1'),_0x47892c[_0x3536('0x49')],util[_0x3536('0x3e')](_0x47892c,{'showHidden':![],'depth':null}));this[_0x3536('0xa2')](_0x47892c[_0x3536('0x49')],_[_0x3536('0x78')](_0x47892c[_0x3536('0xa3')])[0x0],_0x47892c[_0x3536('0xa4')]);if(this['queueReports'][_0x47892c[_0x3536('0x49')]]){var _0x142145=_[_0x3536('0x7a')](this[_0x3536('0xf')][_0x47892c['uniqueid']]);if(_0x142145){if(this[_0x3536('0x62')](_0x47892c[_0x3536('0xa3')])&&this['isNotNull'](_0x47892c['variable'][_0x3536('0xa5')])){switch(_0x47892c[_0x3536('0xa4')]){case _0x3536('0xa6'):_0x142145[_0x3536('0x96')]=![];_0x142145[_0x3536('0x8e')]=null;break;case'TIMEOUT':_0x142145[_0x3536('0xa7')]=_0x3536('0xa8');_0x142145['queuecallerexit']=!![];_0x142145[_0x3536('0x8e')]=moment()['format'](_0x3536('0x72'));_0x142145[_0x3536('0x85')]=moment()['format'](_0x3536('0x72'));logger[_0x3536('0x4e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x47892c['uniqueid'],util[_0x3536('0x3e')](_0x142145,{'showHidden':![],'depth':null}));ami['emit'](_0x3536('0xa9'),_0x142145);break;default:_0x142145[_0x3536('0x96')]=!![];_0x142145[_0x3536('0x8e')]=moment()['format'](_0x3536('0x72'));_0x142145[_0x3536('0x85')]=moment()[_0x3536('0x4a')](_0x3536('0x72'));}_0x142145[_0x3536('0x1c')]=![];_0x142145[_0x3536('0x7f')]=null;_0x142145[_0x3536('0x80')]=_0x47892c[_0x3536('0xa4')];this[_0x3536('0x34')][_0x47892c[_0x3536('0x49')]]=_0x142145;this[_0x3536('0x43')](_0x142145,_0x3536('0x22'));}else if(this[_0x3536('0x62')](_0x47892c[_0x3536('0xa3')])&&this[_0x3536('0x62')](_0x47892c[_0x3536('0xa3')]['queueposition'])){if(!_0x142145[_0x3536('0x1c')]){_0x142145['queuecallerexit']=!![];_0x142145['queuecallerexitAt']=moment()[_0x3536('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x142145[_0x3536('0x80')]=_0x3536('0xaa');_0x142145[_0x3536('0x85')]=moment()[_0x3536('0x4a')](_0x3536('0x72'));this[_0x3536('0x34')][_0x47892c[_0x3536('0x49')]]=_0x142145;}}logger[_0x3536('0x76')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x47892c[_0x3536('0x49')],_0x142145[_0x3536('0x51')],_0x142145[_0x3536('0x53')],_['keys'](_0x47892c[_0x3536('0xa3')])[0x0],_0x47892c[_0x3536('0xa4')]);_0x142145[_0x3536('0x14')]=this[_0x3536('0x14')][_0x47892c[_0x3536('0x49')]];}}}}catch(_0x4096c5){logger['error'](_0x3536('0xa1'),_0x47892c[_0x3536('0x49')],util[_0x3536('0x3e')](_0x4096c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3536('0xa2')]=function(_0x9c1672,_0x3534ea,_0x49da9a){var _0x26286d=[_0x3536('0xab'),_0x3536('0xac'),_0x3536('0xad'),_0x3536('0xae'),_0x3536('0xaf'),_0x3536('0xb0'),_0x3536('0xb1'),_0x3536('0xb2'),_0x3536('0xb3'),_0x3536('0xb4'),_0x3536('0xb5'),_0x3536('0xb6'),'membercalls',_0x3536('0xb7'),_0x3536('0xb8'),'memberlastcall',_0x3536('0xb9'),_0x3536('0xba'),_0x3536('0xbb')];if(!_[_0x3536('0x36')](_0x3534ea)&&!_[_0x3536('0xbc')](_0x26286d,_0x3534ea)){if(_[_0x3536('0x63')](this['variables'][_0x9c1672])){this[_0x3536('0x14')][_0x9c1672]={};}this[_0x3536('0x14')][_0x9c1672][_0x3534ea]=_0x49da9a;}};VoiceQueueReport['prototype'][_0x3536('0xbd')]=function(_0x3da850){try{if(this[_0x3536('0x62')](_0x3da850)){logger['debug'](_0x3536('0xbe'),_0x3da850[_0x3536('0x49')],util[_0x3536('0x3e')](_0x3da850,{'showHidden':![],'depth':null}));if(this[_0x3536('0xf')][_0x3da850['uniqueid']]){for(var _0x272c8f=0x0,_0x2b5ac9={};_0x272c8f=0x0?moment(_0x1ea2dd['endtime'])['diff'](_0x1ea2dd['starttime'],'seconds'):null,'data1':_0x16e7('0x1c'),'data2':_0x1ea2dd[_0x16e7('0x15')],'data3':_0x1ea2dd[_0x16e7('0x12')],'data4':_0x1ea2dd[_0x16e7('0x1d')]||null,'role':'agent','internal':_0x1ea2dd[_0x16e7('0x15')]?_[_0x16e7('0x1e')](_0x1ea2dd[_0x16e7('0x15')]):undefined,'uniqueid':_0x1ea2dd['uniqueid']},'log':_0x16e7('0x7')});}; \ No newline at end of file +var _0x1dcf=['queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','CreateMemberReport','membername','TALKING','endtime','starttime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','interface','format','SIP/%s','diff'];(function(_0x3221f4,_0x33ce54){var _0xd0d345=function(_0x5bff32){while(--_0x5bff32){_0x3221f4['push'](_0x3221f4['shift']());}};_0xd0d345(++_0x33ce54);}(_0x1dcf,0x10a));var _0xf1dc=function(_0x52b8ad,_0x425b4b){_0x52b8ad=_0x52b8ad-0x0;var _0x4deb5a=_0x1dcf[_0x52b8ad];return _0x4deb5a;};'use strict';var moment=require(_0xf1dc('0x0'));var _=require(_0xf1dc('0x1'));var util=require(_0xf1dc('0x2'));var client=require(_0xf1dc('0x3'));exports[_0xf1dc('0x4')]=function(_0x5f0a9d){var _0x15d8be=_0x5f0a9d['queuecallercompleteAt']||_0x5f0a9d[_0xf1dc('0x5')];return client[_0xf1dc('0x6')]('CreateMemberReport',{'body':{'channel':_0xf1dc('0x7'),'membername':_0x5f0a9d[_0xf1dc('0x8')],'interface':_['isNil'](_0x5f0a9d[_0xf1dc('0x9')])?util[_0xf1dc('0xa')](_0xf1dc('0xb'),_0x5f0a9d['lastAssignedTo']):_0x5f0a9d[_0xf1dc('0x9')],'type':'TALKING','enterAt':_0x5f0a9d['queuecallerleaveAt'],'exitAt':_0x15d8be,'duration':moment(_0x15d8be)[_0xf1dc('0xc')](_0x5f0a9d[_0xf1dc('0xd')],_0xf1dc('0xe')),'data1':_0xf1dc('0xf'),'data2':_0x5f0a9d[_0xf1dc('0x10')],'data3':_0x5f0a9d[_0xf1dc('0x11')],'data4':null,'data5':_0x5f0a9d[_0xf1dc('0x12')],'role':_0xf1dc('0x13'),'internal':_0x5f0a9d[_0xf1dc('0x14')]?_[_0xf1dc('0x15')](_0x5f0a9d['accountcode']):undefined,'uniqueid':_0x5f0a9d[_0xf1dc('0x16')]},'log':'CreateMemberReport'});};exports[_0xf1dc('0x17')]=function(_0x58de6c){return client[_0xf1dc('0x6')](_0xf1dc('0x18'),{'body':{'channel':_0xf1dc('0x7'),'membername':_0x58de6c[_0xf1dc('0x19')],'interface':_0x58de6c[_0xf1dc('0x9')],'type':_0xf1dc('0x1a'),'enterAt':_0x58de6c['starttime'],'exitAt':_0x58de6c['endtime'],'duration':moment(_0x58de6c[_0xf1dc('0x1b')])[_0xf1dc('0xc')](_0x58de6c['starttime'],'seconds')>=0x0?moment(_0x58de6c[_0xf1dc('0x1b')])['diff'](_0x58de6c[_0xf1dc('0x1c')],_0xf1dc('0xe')):null,'data1':_0xf1dc('0x1d'),'data2':_0x58de6c[_0xf1dc('0x14')],'data3':_0x58de6c[_0xf1dc('0x11')],'data4':_0x58de6c[_0xf1dc('0x1e')]||null,'role':_0xf1dc('0x13'),'internal':_0x58de6c[_0xf1dc('0x14')]?_[_0xf1dc('0x15')](_0x58de6c[_0xf1dc('0x14')]):undefined,'uniqueid':_0x58de6c[_0xf1dc('0x16')]},'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 2e43e00..730ef53 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 _0xa44d=['../client','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x3c6f81,_0x13862c){var _0x3bcdc0=function(_0x32e153){while(--_0x32e153){_0x3c6f81['push'](_0x3c6f81['shift']());}};_0x3bcdc0(++_0x13862c);}(_0xa44d,0x1ce));var _0xda44=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xa44d[_0x39fd11];return _0x302799;};'use strict';var client=require(_0xda44('0x0'));exports['getSettings']=function(){return client[_0xda44('0x1')](_0xda44('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xda44('0x3'),_0xda44('0x4')]},'log':_0xda44('0x5')});}; \ No newline at end of file +var _0x9ba6=['Request','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x2e3263,_0x572695){var _0x2b4469=function(_0x1ec6c4){while(--_0x1ec6c4){_0x2e3263['push'](_0x2e3263['shift']());}};_0x2b4469(++_0x572695);}(_0x9ba6,0x13b));var _0x69ba=function(_0x530c28,_0x4fc861){_0x530c28=_0x530c28-0x0;var _0x16a2b3=_0x9ba6[_0x530c28];return _0x16a2b3;};'use strict';var client=require(_0x69ba('0x0'));exports['getSettings']=function(){return client[_0x69ba('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x69ba('0x2'),'previewRecallmeReminderInterval']},'log':_0x69ba('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0372331..2e1139e 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 _0xcde4=['name','html','../client','getTemplates'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcde4,0x13a));var _0x4cde=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xcde4[_0xd09668];return _0x68726;};'use strict';var client=require(_0x4cde('0x0'));exports[_0x4cde('0x1')]=function(_0x4e9cc5){return function(_0xe13feb){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x4cde('0x2'),_0x4cde('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x9afa=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x1952b1,_0x5984c4){var _0x52f85b=function(_0x964308){while(--_0x964308){_0x1952b1['push'](_0x1952b1['shift']());}};_0x52f85b(++_0x5984c4);}(_0x9afa,0x1af));var _0xa9af=function(_0x56a88d,_0x351241){_0x56a88d=_0x56a88d-0x0;var _0x57b39e=_0x9afa[_0x56a88d];return _0x57b39e;};'use strict';var client=require(_0xa9af('0x0'));exports[_0xa9af('0x1')]=function(_0x2501e9){return function(_0x1fffc5){return client[_0xa9af('0x2')](_0xa9af('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa9af('0x4'),_0xa9af('0x5')]},'log':_0xa9af('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a51b809..9523ddb 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 _0xa753=['GetTrigger','status','Condition','AllConditions','operator','value','field','Action','Actions','data2','data4','data5','data6','data7','../client','Request'];(function(_0x44411e,_0x53f237){var _0x42ad7a=function(_0x9bc533){while(--_0x9bc533){_0x44411e['push'](_0x44411e['shift']());}};_0x42ad7a(++_0x53f237);}(_0xa753,0x1be));var _0x3a75=function(_0x153d2a,_0x628209){_0x153d2a=_0x153d2a-0x0;var _0x3736ff=_0xa753[_0x153d2a];return _0x3736ff;};'use strict';var client=require(_0x3a75('0x0'));exports['getTriggers']=function(_0x30b393){return function(_0x372eee){return client[_0x3a75('0x1')](_0x3a75('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x3a75('0x3')],'include':[{'model':_0x3a75('0x4'),'as':_0x3a75('0x5'),'attributes':['id','field',_0x3a75('0x6'),_0x3a75('0x7')]},{'model':_0x3a75('0x4'),'as':'AnyConditions','attributes':['id',_0x3a75('0x8'),'operator',_0x3a75('0x7')]},{'model':_0x3a75('0x9'),'as':_0x3a75('0xa'),'attributes':['id','action','data1',_0x3a75('0xb'),'data3',_0x3a75('0xc'),_0x3a75('0xd'),_0x3a75('0xe'),_0x3a75('0xf')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xb7a6=['action','data1','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','Condition','AllConditions','field','operator','value','Action','Actions'];(function(_0x55a922,_0x5aaa9a){var _0x1b719e=function(_0x2015d1){while(--_0x2015d1){_0x55a922['push'](_0x55a922['shift']());}};_0x1b719e(++_0x5aaa9a);}(_0xb7a6,0xcc));var _0x6b7a=function(_0x3437d2,_0x2298b7){_0x3437d2=_0x3437d2-0x0;var _0x143c40=_0xb7a6[_0x3437d2];return _0x143c40;};'use strict';var client=require(_0x6b7a('0x0'));exports[_0x6b7a('0x1')]=function(_0x934e26){return function(_0x44e0bc){return client[_0x6b7a('0x2')](_0x6b7a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x6b7a('0x4'),'status'],'include':[{'model':_0x6b7a('0x5'),'as':_0x6b7a('0x6'),'attributes':['id',_0x6b7a('0x7'),_0x6b7a('0x8'),_0x6b7a('0x9')]},{'model':_0x6b7a('0x5'),'as':'AnyConditions','attributes':['id',_0x6b7a('0x7'),_0x6b7a('0x8'),_0x6b7a('0x9')]},{'model':_0x6b7a('0xa'),'as':_0x6b7a('0xb'),'attributes':['id',_0x6b7a('0xc'),_0x6b7a('0xd'),'data2',_0x6b7a('0xe'),'data4',_0x6b7a('0xf'),_0x6b7a('0x10'),_0x6b7a('0x11')]}]},'log':_0x6b7a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index bec6fb4..80bdfa6 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 _0x0700=['GetTrunk','name','defaultuser','../client','getTrunks','Request'];(function(_0x545d79,_0x3168b2){var _0x1dc91c=function(_0x41fc07){while(--_0x41fc07){_0x545d79['push'](_0x545d79['shift']());}};_0x1dc91c(++_0x3168b2);}(_0x0700,0x81));var _0x0070=function(_0x14d143,_0x3efea0){_0x14d143=_0x14d143-0x0;var _0x20e167=_0x0700[_0x14d143];return _0x20e167;};'use strict';var client=require(_0x0070('0x0'));exports[_0x0070('0x1')]=function(_0x399098){return function(_0x279a38){return client[_0x0070('0x2')](_0x0070('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0070('0x4'),'registry',_0x0070('0x5')]},'log':_0x0070('0x3')});};}; \ No newline at end of file +var _0x5ab4=['Request','name','registry','defaultuser','GetTrunk','../client','getTrunks'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x5ab4,0x9f));var _0x45ab=function(_0x2530d1,_0x462b06){_0x2530d1=_0x2530d1-0x0;var _0x1484ed=_0x5ab4[_0x2530d1];return _0x1484ed;};'use strict';var client=require(_0x45ab('0x0'));exports[_0x45ab('0x1')]=function(_0x17df82){return function(_0x3be6fb){return client[_0x45ab('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x45ab('0x3'),_0x45ab('0x4'),_0x45ab('0x5')]},'log':_0x45ab('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 99edd99..588e7a9 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x34fb36,_0x9de9af){var _0x12dd13=function(_0x2b0603){while(--_0x2b0603){_0x34fb36['push'](_0x34fb36['shift']());}};_0x12dd13(++_0x9de9af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0xcb91[_0xf44d98];return _0x5ebb04;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3b42f6,_0x487861){var _0x5c309e=function(_0x1dd4f7){while(--_0x1dd4f7){_0x3b42f6['push'](_0x3b42f6['shift']());}};_0x5c309e(++_0x487861);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 70ac744..4dd49af 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 _0x33ae=['UpdateVoiceAgentReport','create','CreateVoiceAgentReport','update','Request'];(function(_0x17db44,_0x5431cf){var _0x2ad94d=function(_0x50b26e){while(--_0x50b26e){_0x17db44['push'](_0x17db44['shift']());}};_0x2ad94d(++_0x5431cf);}(_0x33ae,0x14b));var _0xe33a=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x33ae[_0x4fdcc0];return _0xc0ce94;};'use strict';var client=require('../client');exports[_0xe33a('0x0')]=function(_0x2146b3){return client['Request'](_0xe33a('0x1'),{'body':_0x2146b3,'log':_0xe33a('0x1')});};exports[_0xe33a('0x2')]=function(_0x178f16,_0x4b5ce3,_0x3a26ad){return client[_0xe33a('0x3')](_0xe33a('0x4'),{'body':_0x178f16,'options':{'where':{'uniqueid':_0x4b5ce3,'interface':_0x3a26ad,'agentcomplete':!![]}},'log':_0xe33a('0x4')});}; \ No newline at end of file +var _0x9c9c=['../client','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x3f8269,_0x3193da){var _0x12a7d7=function(_0x448c85){while(--_0x448c85){_0x3f8269['push'](_0x3f8269['shift']());}};_0x12a7d7(++_0x3193da);}(_0x9c9c,0x104));var _0xc9c9=function(_0x4d3b1b,_0x1b1049){_0x4d3b1b=_0x4d3b1b-0x0;var _0x521593=_0x9c9c[_0x4d3b1b];return _0x521593;};'use strict';var client=require(_0xc9c9('0x0'));exports['create']=function(_0x41ba50){return client[_0xc9c9('0x1')]('CreateVoiceAgentReport',{'body':_0x41ba50,'log':_0xc9c9('0x2')});};exports['update']=function(_0x678651,_0xc7a2fb,_0x1b6841){return client[_0xc9c9('0x1')](_0xc9c9('0x3'),{'body':_0x678651,'options':{'where':{'uniqueid':_0xc7a2fb,'interface':_0x1b6841,'agentcomplete':!![]}},'log':_0xc9c9('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3275521..b6eb2fa 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 _0xa656=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day'];(function(_0x5e1d4c,_0x4df8c0){var _0x57f0ab=function(_0x5774a4){while(--_0x5774a4){_0x5e1d4c['push'](_0x5e1d4c['shift']());}};_0x57f0ab(++_0x4df8c0);}(_0xa656,0x1e5));var _0x6a65=function(_0x298bda,_0x219b51){_0x298bda=_0x298bda-0x0;var _0x3ebe46=_0xa656[_0x298bda];return _0x3ebe46;};'use strict';var moment=require(_0x6a65('0x0'));var util=require(_0x6a65('0x1'));var _=require('lodash');var client=require(_0x6a65('0x2'));exports[_0x6a65('0x3')]=function(_0xb4e492){return client[_0x6a65('0x4')](_0x6a65('0x5'),{'body':_[_0x6a65('0x6')](_0xb4e492,{'source':_0xb4e492[_0x6a65('0x7')],'destinationcontext':_0xb4e492[_0x6a65('0x8')],'callerid':_0xb4e492[_0x6a65('0x9')],'amaflags':_0x6a65('0xa')}),'log':_0x6a65('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x6a65('0x4')](_0x6a65('0xb'),{'options':{'where':{'type':[_0x6a65('0xc')],'createdAt':{'$between':[moment()[_0x6a65('0xd')](_0x6a65('0xe'))[_0x6a65('0xf')](_0x6a65('0x10')),moment()[_0x6a65('0x11')](_0x6a65('0xe'))[_0x6a65('0xf')](_0x6a65('0x10'))]}},'attributes':['type','disposition','duration',_0x6a65('0x12')]},'log':_0x6a65('0x13')});};}; \ No newline at end of file +var _0x4887=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x4887,0x16b));var _0x7488=function(_0x139030,_0x4f4975){_0x139030=_0x139030-0x0;var _0x431626=_0x4887[_0x139030];return _0x431626;};'use strict';var moment=require(_0x7488('0x0'));var util=require(_0x7488('0x1'));var _=require(_0x7488('0x2'));var client=require('../client');exports[_0x7488('0x3')]=function(_0x3b8eba){return client[_0x7488('0x4')](_0x7488('0x5'),{'body':_[_0x7488('0x6')](_0x3b8eba,{'source':_0x3b8eba[_0x7488('0x7')],'destinationcontext':_0x3b8eba[_0x7488('0x8')],'callerid':_0x3b8eba[_0x7488('0x9')],'amaflags':_0x7488('0xa')}),'log':_0x7488('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x7488('0x4')](_0x7488('0xb'),{'options':{'where':{'type':[_0x7488('0xc')],'createdAt':{'$between':[moment()[_0x7488('0xd')](_0x7488('0xe'))[_0x7488('0xf')](_0x7488('0x10')),moment()[_0x7488('0x11')](_0x7488('0xe'))[_0x7488('0xf')](_0x7488('0x10'))]}},'attributes':[_0x7488('0x12'),_0x7488('0x13'),_0x7488('0x14'),_0x7488('0x15')]},'log':_0x7488('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 9b29643..c149725 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 _0x4940=['Request','CreateVoiceDialReport','create'];(function(_0x36a3d1,_0x4a32cd){var _0x821ef4=function(_0x1dfb29){while(--_0x1dfb29){_0x36a3d1['push'](_0x36a3d1['shift']());}};_0x821ef4(++_0x4a32cd);}(_0x4940,0x113));var _0x0494=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x4940[_0x3511d3];return _0x5d6321;};'use strict';var client=require('../client');exports[_0x0494('0x0')]=function(_0x510184){return client[_0x0494('0x1')](_0x0494('0x2'),{'body':_0x510184,'log':_0x0494('0x2')});}; \ No newline at end of file +var _0x0c64=['Request','../client','create'];(function(_0x5e3f0a,_0x539b4d){var _0x2b5920=function(_0xd4e919){while(--_0xd4e919){_0x5e3f0a['push'](_0x5e3f0a['shift']());}};_0x2b5920(++_0x539b4d);}(_0x0c64,0x145));var _0x40c6=function(_0x447e79,_0x1e512a){_0x447e79=_0x447e79-0x0;var _0x296bd4=_0x0c64[_0x447e79];return _0x296bd4;};'use strict';var client=require(_0x40c6('0x0'));exports[_0x40c6('0x1')]=function(_0x309793){return client[_0x40c6('0x2')]('CreateVoiceDialReport',{'body':_0x309793,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c739d78..8c76eaf 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 _0x63c6=['getVoiceExtensions','exten','recordingFormat','../client'];(function(_0x109713,_0x5c3d27){var _0x56f3ae=function(_0x2b89de){while(--_0x2b89de){_0x109713['push'](_0x109713['shift']());}};_0x56f3ae(++_0x5c3d27);}(_0x63c6,0xbb));var _0x663c=function(_0xc15415,_0x47463c){_0xc15415=_0xc15415-0x0;var _0x426de5=_0x63c6[_0xc15415];return _0x426de5;};'use strict';var client=require(_0x663c('0x0'));exports[_0x663c('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x663c('0x2'),_0x663c('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x663c('0x1')});};}; \ No newline at end of file +var _0x6ae2=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0xd7a493,_0x27af27){var _0x3f127d=function(_0x5b8959){while(--_0x5b8959){_0xd7a493['push'](_0xd7a493['shift']());}};_0x3f127d(++_0x27af27);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x45fcf7,_0x5cfb08){_0x45fcf7=_0x45fcf7-0x0;var _0x1b4a8e=_0x6ae2[_0x45fcf7];return _0x1b4a8e;};'use strict';var client=require(_0x26ae('0x0'));exports[_0x26ae('0x1')]=function(){return function(){return client[_0x26ae('0x2')](_0x26ae('0x3'),{'options':{'raw':!![],'attributes':['id',_0x26ae('0x4'),_0x26ae('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x26ae('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 52eb70e..df5af07 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 _0x04a1=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x4f96e7,_0xe04451){var _0x4f8546=function(_0x42f2f3){while(--_0x42f2f3){_0x4f96e7['push'](_0x4f96e7['shift']());}};_0x4f8546(++_0xe04451);}(_0x04a1,0x145));var _0x104a=function(_0x1900df,_0x335237){_0x1900df=_0x1900df-0x0;var _0xbca80d=_0x04a1[_0x1900df];return _0xbca80d;};'use strict';var client=require('../client');exports[_0x104a('0x0')]=function(){return function(){return client[_0x104a('0x1')](_0x104a('0x2'),{'options':{'raw':![],'attributes':['id',_0x104a('0x3'),'acw',_0x104a('0x4'),'autopause',_0x104a('0x5'),_0x104a('0x6'),'dialActive','dialMethod',_0x104a('0x7'),_0x104a('0x8'),_0x104a('0x9'),_0x104a('0xa'),_0x104a('0xb'),_0x104a('0xc'),_0x104a('0xd'),_0x104a('0xe'),_0x104a('0xf'),_0x104a('0x10'),_0x104a('0x11'),'dialQueueProject','dialCongestionMaxRetry',_0x104a('0x12'),_0x104a('0x13'),_0x104a('0x14'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x104a('0x15'),_0x104a('0x16'),_0x104a('0x17'),'dialPrefix',_0x104a('0x18'),_0x104a('0x19'),_0x104a('0x1a'),'dialAMDGreeting',_0x104a('0x1b'),_0x104a('0x1c'),_0x104a('0x1d'),_0x104a('0x1e'),_0x104a('0x1f'),_0x104a('0x20'),_0x104a('0x21'),_0x104a('0x22'),_0x104a('0x23'),_0x104a('0x24'),_0x104a('0x25'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x104a('0x26'),_0x104a('0x5'),_0x104a('0x27'),_0x104a('0x28'),'dialCutDigit',_0x104a('0x29'),'dialNoSuchNumberRetryFrequency',_0x104a('0x2a'),_0x104a('0x2b'),_0x104a('0x2c'),_0x104a('0x2d'),_0x104a('0x2e'),_0x104a('0x2f'),_0x104a('0x30'),_0x104a('0x31'),_0x104a('0x32'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x104a('0x33'),_0x104a('0x34')],'include':[{'model':_0x104a('0x35'),'as':_0x104a('0x35'),'attributes':['id',_0x104a('0x3'),_0x104a('0x36'),_0x104a('0x37')]},{'model':'Pause','as':_0x104a('0x38'),'attributes':['id','name']},{'model':'Trunk','as':_0x104a('0x39'),'attributes':['id',_0x104a('0x3'),_0x104a('0x36'),_0x104a('0x37')]},{'model':_0x104a('0x3a'),'as':_0x104a('0x3a'),'attributes':['id','name'],'include':[{'model':_0x104a('0x3a'),'as':'Intervals','attributes':['id',_0x104a('0x3'),_0x104a('0x3b')]}]}]},'log':_0x104a('0x0')});};}; \ No newline at end of file +var _0x0b3d=['dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x0b3d,0x1e3));var _0xd0b3=function(_0x4a489f,_0x5402ab){_0x4a489f=_0x4a489f-0x0;var _0x4a4137=_0x0b3d[_0x4a489f];return _0x4a4137;};'use strict';var client=require(_0xd0b3('0x0'));exports[_0xd0b3('0x1')]=function(){return function(){return client[_0xd0b3('0x2')](_0xd0b3('0x3'),{'options':{'raw':![],'attributes':['id',_0xd0b3('0x4'),_0xd0b3('0x5'),_0xd0b3('0x6'),'autopause',_0xd0b3('0x7'),_0xd0b3('0x8'),_0xd0b3('0x9'),_0xd0b3('0xa'),'dialLimitChannel',_0xd0b3('0xb'),_0xd0b3('0xc'),'dialPredictiveOptimization',_0xd0b3('0xd'),_0xd0b3('0xe'),_0xd0b3('0xf'),_0xd0b3('0x10'),_0xd0b3('0x11'),'dialQueueOptions','dialQueueTimeout',_0xd0b3('0x12'),'dialCongestionMaxRetry',_0xd0b3('0x13'),_0xd0b3('0x14'),'dialBusyRetryFrequency',_0xd0b3('0x15'),'dialNoAnswerRetryFrequency',_0xd0b3('0x16'),_0xd0b3('0x17'),_0xd0b3('0x18'),'dialPrefix',_0xd0b3('0x19'),_0xd0b3('0x1a'),_0xd0b3('0x1b'),'dialAMDGreeting',_0xd0b3('0x1c'),_0xd0b3('0x1d'),_0xd0b3('0x1e'),_0xd0b3('0x1f'),_0xd0b3('0x20'),_0xd0b3('0x21'),_0xd0b3('0x22'),_0xd0b3('0x23'),_0xd0b3('0x24'),_0xd0b3('0x25'),'dialOrderByScheduledAt',_0xd0b3('0x26'),'dialAgiAfterHangupClient',_0xd0b3('0x27'),_0xd0b3('0x7'),_0xd0b3('0x28'),_0xd0b3('0x29'),_0xd0b3('0x2a'),_0xd0b3('0x2b'),'dialNoSuchNumberRetryFrequency',_0xd0b3('0x2c'),'dialDropRetryFrequency',_0xd0b3('0x2d'),_0xd0b3('0x2e'),_0xd0b3('0x2f'),'dialMachineRetryFrequency',_0xd0b3('0x30'),_0xd0b3('0x31'),_0xd0b3('0x32'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xd0b3('0x33'),_0xd0b3('0x34')],'include':[{'model':_0xd0b3('0x35'),'as':_0xd0b3('0x35'),'attributes':['id',_0xd0b3('0x4'),_0xd0b3('0x36'),_0xd0b3('0x37')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xd0b3('0x4')]},{'model':_0xd0b3('0x35'),'as':'TrunkBackup','attributes':['id','name',_0xd0b3('0x36'),'active']},{'model':_0xd0b3('0x38'),'as':_0xd0b3('0x38'),'attributes':['id','name'],'include':[{'model':_0xd0b3('0x38'),'as':'Intervals','attributes':['id',_0xd0b3('0x4'),_0xd0b3('0x39')]}]}]},'log':_0xd0b3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5899b06..51704f3 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(_0x9ded2d,_0xfe7f2e){var _0x59cfc6=function(_0x349a15){while(--_0x349a15){_0x9ded2d['push'](_0x9ded2d['shift']());}};_0x59cfc6(++_0xfe7f2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x4fbed0,_0x5d5337){var _0x16efd2=function(_0x1f7f01){while(--_0x1f7f01){_0x4fbed0['push'](_0x4fbed0['shift']());}};_0x16efd2(++_0x5d5337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 824022a..e40f322 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 _0x8bb7=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x299d1e,_0xf412ea){var _0x311ead=function(_0x2da868){while(--_0x2da868){_0x299d1e['push'](_0x299d1e['shift']());}};_0x311ead(++_0xf412ea);}(_0x8bb7,0x1dd));var _0x78bb=function(_0x142402,_0x463369){_0x142402=_0x142402-0x0;var _0x4f7973=_0x8bb7[_0x142402];return _0x4f7973;};'use strict';var client=require(_0x78bb('0x0'));exports[_0x78bb('0x1')]=function(_0x2cb801){return function(){return client[_0x78bb('0x2')](_0x78bb('0x3'),{'options':{'where':{'VoiceQueueId':_0x2cb801,'paused':!![]},'raw':!![]},'log':_0x78bb('0x1')});};}; \ No newline at end of file +var _0x73c2=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3db0bd,_0x4d2b36){var _0x40a05a=function(_0x2cf328){while(--_0x2cf328){_0x3db0bd['push'](_0x3db0bd['shift']());}};_0x40a05a(++_0x4d2b36);}(_0x73c2,0x174));var _0x273c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x73c2[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x273c('0x0'));exports[_0x273c('0x1')]=function(_0x334ee8){return function(){return client[_0x273c('0x2')](_0x273c('0x3'),{'options':{'where':{'VoiceQueueId':_0x334ee8,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index d9b0f50..688c080 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xd0ccd7,_0x36e634){var _0x241f1b=function(_0x29692f){while(--_0x29692f){_0xd0ccd7['push'](_0xd0ccd7['shift']());}};_0x241f1b(++_0x36e634);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x14acee,_0x4117fa){var _0x5aed10=function(_0x45f60c){while(--_0x45f60c){_0x14acee['push'](_0x14acee['shift']());}};_0x5aed10(++_0x4117fa);}(_0x7a54,0x106));var _0x47a5=function(_0x10f867,_0x27de07){_0x10f867=_0x10f867-0x0;var _0x30506b=_0x7a54[_0x10f867];return _0x30506b;};'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 3c62f2f..ce8e359 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 _0x5257=['origtransfererexten','../client','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','blind','Request','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext'];(function(_0x3d4bff,_0x14ffa2){var _0x32b97c=function(_0x25265f){while(--_0x25265f){_0x3d4bff['push'](_0x3d4bff['shift']());}};_0x32b97c(++_0x14ffa2);}(_0x5257,0xfd));var _0x7525=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x5257[_0x2d34d6];return _0x1d3d12;};'use strict';var client=require(_0x7525('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x4c2807){return client['Request'](_0x7525('0x1'),{'body':{'result':_0x4c2807[_0x7525('0x2')],'transfererchannel':_0x4c2807['transfererchannel'],'transferercalleridnum':_0x4c2807['transferercalleridnum'],'transferercalleridname':_0x4c2807[_0x7525('0x3')],'transfererconnectedlinenum':_0x4c2807[_0x7525('0x4')],'transfererconnectedlinename':_0x4c2807[_0x7525('0x5')],'transfereraccountcode':_0x4c2807[_0x7525('0x6')],'transferercontext':_0x4c2807[_0x7525('0x7')],'transfererexten':_0x4c2807[_0x7525('0x8')],'transfererlinkedid':_0x4c2807[_0x7525('0x9')],'transfereechannel':_0x4c2807[_0x7525('0xa')],'transfereecalleridnum':_0x4c2807[_0x7525('0xb')],'transfereecalleridname':_0x4c2807['transfereecalleridname'],'transfereeconnectedlinenum':_0x4c2807[_0x7525('0xc')],'transfereeconnectedlinename':_0x4c2807[_0x7525('0xd')],'transfereeaccountcode':_0x4c2807[_0x7525('0xe')],'transfereecontext':_0x4c2807[_0x7525('0xf')],'transfereeexten':_0x4c2807[_0x7525('0x10')],'transfereelinkedid':_0x4c2807['transfereelinkedid'],'isexternal':_0x4c2807[_0x7525('0x11')],'context':_0x4c2807[_0x7525('0x12')],'extension':_0x4c2807['extension'],'type':_0x7525('0x13')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x2916c3){return client[_0x7525('0x14')](_0x7525('0x1'),{'body':{'result':_0x2916c3[_0x7525('0x2')],'transfererchannel':_0x2916c3['origtransfererchannel'],'transferercalleridnum':_0x2916c3['origtransferercalleridnum'],'transferercalleridname':_0x2916c3['origtransferercalleridname'],'transfererconnectedlinenum':_0x2916c3[_0x7525('0x15')],'transfererconnectedlinename':_0x2916c3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2916c3[_0x7525('0x16')],'transferercontext':_0x2916c3[_0x7525('0x17')],'transfererexten':_0x2916c3[_0x7525('0x18')],'transfererlinkedid':_0x2916c3[_0x7525('0x19')],'transfereechannel':_0x2916c3['transfertargetchannel'],'transfereecalleridnum':_0x2916c3[_0x7525('0x1a')],'transfereecalleridname':_0x2916c3[_0x7525('0x1b')],'transfereeconnectedlinenum':_0x2916c3[_0x7525('0x1c')],'transfereeconnectedlinename':_0x2916c3[_0x7525('0x1d')],'transfereeaccountcode':_0x2916c3[_0x7525('0x1e')],'transfereecontext':_0x2916c3[_0x7525('0x1f')],'transfereeexten':_0x2916c3[_0x7525('0x20')],'transfereelinkedid':_0x2916c3[_0x7525('0x21')],'isexternal':_0x2916c3[_0x7525('0x11')],'context':_0x2916c3[_0x7525('0x22')],'extension':_0x2916c3[_0x7525('0x23')],'type':'attended'},'log':_0x7525('0x1')});}; \ No newline at end of file +var _0xb845=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','CreateVoiceTransferReport','attendedTransfer','Request','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','blindTransfer','result','transfererchannel'];(function(_0x5137a8,_0x12b30d){var _0x4f9b28=function(_0x1b3307){while(--_0x1b3307){_0x5137a8['push'](_0x5137a8['shift']());}};_0x4f9b28(++_0x12b30d);}(_0xb845,0xd5));var _0x5b84=function(_0x1fbb56,_0x22b4f8){_0x1fbb56=_0x1fbb56-0x0;var _0x562df4=_0xb845[_0x1fbb56];return _0x562df4;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x5b84('0x0')]=function(_0x408dff){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x408dff[_0x5b84('0x1')],'transfererchannel':_0x408dff[_0x5b84('0x2')],'transferercalleridnum':_0x408dff[_0x5b84('0x3')],'transferercalleridname':_0x408dff[_0x5b84('0x4')],'transfererconnectedlinenum':_0x408dff[_0x5b84('0x5')],'transfererconnectedlinename':_0x408dff['transfererconnectedlinename'],'transfereraccountcode':_0x408dff[_0x5b84('0x6')],'transferercontext':_0x408dff[_0x5b84('0x7')],'transfererexten':_0x408dff[_0x5b84('0x8')],'transfererlinkedid':_0x408dff[_0x5b84('0x9')],'transfereechannel':_0x408dff[_0x5b84('0xa')],'transfereecalleridnum':_0x408dff[_0x5b84('0xb')],'transfereecalleridname':_0x408dff[_0x5b84('0xc')],'transfereeconnectedlinenum':_0x408dff[_0x5b84('0xd')],'transfereeconnectedlinename':_0x408dff[_0x5b84('0xe')],'transfereeaccountcode':_0x408dff[_0x5b84('0xf')],'transfereecontext':_0x408dff['transfereecontext'],'transfereeexten':_0x408dff['transfereeexten'],'transfereelinkedid':_0x408dff[_0x5b84('0x10')],'isexternal':_0x408dff[_0x5b84('0x11')],'context':_0x408dff[_0x5b84('0x12')],'extension':_0x408dff['extension'],'type':'blind'},'log':_0x5b84('0x13')});};exports[_0x5b84('0x14')]=function(_0x3d2ede){return client[_0x5b84('0x15')](_0x5b84('0x13'),{'body':{'result':_0x3d2ede[_0x5b84('0x1')],'transfererchannel':_0x3d2ede['origtransfererchannel'],'transferercalleridnum':_0x3d2ede['origtransferercalleridnum'],'transferercalleridname':_0x3d2ede[_0x5b84('0x16')],'transfererconnectedlinenum':_0x3d2ede[_0x5b84('0x17')],'transfererconnectedlinename':_0x3d2ede[_0x5b84('0x18')],'transfereraccountcode':_0x3d2ede[_0x5b84('0x19')],'transferercontext':_0x3d2ede[_0x5b84('0x1a')],'transfererexten':_0x3d2ede[_0x5b84('0x1b')],'transfererlinkedid':_0x3d2ede[_0x5b84('0x1c')],'transfereechannel':_0x3d2ede[_0x5b84('0x1d')],'transfereecalleridnum':_0x3d2ede[_0x5b84('0x1e')],'transfereecalleridname':_0x3d2ede[_0x5b84('0x1f')],'transfereeconnectedlinenum':_0x3d2ede['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3d2ede['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3d2ede['transfertargetaccountcode'],'transfereecontext':_0x3d2ede[_0x5b84('0x20')],'transfereeexten':_0x3d2ede[_0x5b84('0x21')],'transfereelinkedid':_0x3d2ede['transfertargetlinkedid'],'isexternal':_0x3d2ede[_0x5b84('0x11')],'context':_0x3d2ede[_0x5b84('0x22')],'extension':_0x3d2ede[_0x5b84('0x23')],'type':'attended'},'log':_0x5b84('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c3085dd..cb617a9 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 _0x2eb2=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','module','Action','message','catch','error','command','action','Command','then','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','omit','values','join','voicechannel','length','map','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','telephones','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','http','listen','127.0.0.1','log'];(function(_0x4cf6a5,_0x4916a1){var _0x4d3f18=function(_0x543564){while(--_0x543564){_0x4cf6a5['push'](_0x4cf6a5['shift']());}};_0x4d3f18(++_0x4916a1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x2eb2[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var jayson=require(_0x22eb('0x1'));var schema=require(_0x22eb('0x2'));var BPromise=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var config=require(_0x22eb('0x5'));var properties=require('../properties');var ami=require(_0x22eb('0x6'));exports['listen']=function(_0x591824,_0x1dfef7,_0x10e116){return new BPromise(function(_0x35dd5b,_0x2a9850){var _0x4539d0={'QueuePause':function(_0x396806){return new Promise(function(_0x33ddef,_0x3375d6){var _0x419601=util[_0x22eb('0x7')](_0x22eb('0x8'),_0x22eb('0x9'),_0x396806['name']);if(_0x591824[_0x22eb('0xa')]&&_0x591824['timers'][_0x419601]&&_0x591824['timers'][_0x419601][_0x22eb('0xb')]){_0x591824['timers'][_0x419601][_0x22eb('0xc')]();}if(_0x591824[_0x22eb('0xd')][_0x419601]){_0x591824['agents'][_0x419601]['updateStatusRealtime']({'statePause':_0x396806[_0x22eb('0xe')]?!![]:![]});}_0x33ddef({'code':0xc8,'message':_0x22eb('0xf')});});},'Reload':function(_0x128d43){var _0x1e2a53=this;return new Promise(function(_0x427439,_0x49e37e){if(ami[_0x22eb('0x10')]()==![]){return _0x49e37e(_0x1e2a53['error'](0x1f4,[config[_0x22eb('0x11')]['ip'],config['asterisk'][_0x22eb('0x12')],_0x22eb('0x13')]['join']('\x20')));}_0x128d43=_['pick'](_0x128d43,_['keys'](properties[_0x22eb('0x14')]));_0x128d43['action']='Reload';return ami[_0x22eb('0x15')](_0x128d43)['then'](function(_0x4d9b09){_0x427439({'code':0xc8,'message':_0x4d9b09[_0x22eb('0x16')]});})[_0x22eb('0x17')](function(_0x385bcb){_0x49e37e(_0x1e2a53[_0x22eb('0x18')](0x1f5,_0x385bcb[_0x22eb('0x16')]));});});},'Command':function(_0x4bc0a2){var _0x4182a8=this;return new Promise(function(_0x12bbd1,_0x10d182){if(ami[_0x22eb('0x10')]()==![]){return _0x10d182(_0x4182a8[_0x22eb('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x22eb('0x11')][_0x22eb('0x12')],_0x22eb('0x13')]['join']('\x20')));}_0x4bc0a2=_['pick'](_0x4bc0a2,_0x22eb('0x19'));_0x4bc0a2[_0x22eb('0x1a')]=_0x22eb('0x1b');return ami[_0x22eb('0x15')](_0x4bc0a2)[_0x22eb('0x1c')](function(_0x3e8c1c){_0x12bbd1({'code':0xc8,'message':_0x3e8c1c[_0x22eb('0x1d')]});})['catch'](function(_0x2e8f7c){_0x10d182(_0x4182a8[_0x22eb('0x18')](0x1f5,_0x2e8f7c[_0x22eb('0x16')]));});});},'VoiceQueues':function(_0x3031b3){return new Promise(function(_0x420d4f,_0x4da252){var _0x12c133=[];for(var _0x6f8ff3 in _0x591824[_0x22eb('0x1e')]){if(_0x591824['voiceQueues'][_0x22eb('0x1f')](_0x6f8ff3)){var _0x259847=_0x591824['voiceQueues'][_0x6f8ff3];var _0x32a4b6={'id':_0x259847['id'],'name':_0x259847[_0x22eb('0x20')],'strategy':_0x259847[_0x22eb('0x21')],'answered':_0x259847[_0x22eb('0x22')],'available':_0x259847[_0x22eb('0x23')],'loggedIn':_0x259847['loggedIn'],'pTalking':_0x259847['pTalking'],'sumBillable':_0x259847[_0x22eb('0x24')],'sumDuration':_0x259847[_0x22eb('0x25')],'sumHoldTime':_0x259847[_0x22eb('0x26')]||0x0,'talking':_0x259847[_0x22eb('0x27')],'total':_0x259847[_0x22eb('0x28')],'type':_0x259847[_0x22eb('0x29')],'unmanaged':_0x259847[_0x22eb('0x2a')],'abandoned':_0x259847[_0x22eb('0x2b')],'waiting':_0x259847[_0x22eb('0x2c')],'loggedInDb':_0x259847[_0x22eb('0x2d')]};if(_0x259847[_0x22eb('0x29')]===_0x22eb('0x2e')){_0x32a4b6['dialActive']=_0x259847[_0x22eb('0x2f')];_0x32a4b6['dialMethod']=_0x259847[_0x22eb('0x30')];_0x32a4b6[_0x22eb('0x31')]=_0x259847[_0x22eb('0x31')];_0x32a4b6[_0x22eb('0x32')]=_0x259847[_0x22eb('0x32')];_0x32a4b6[_0x22eb('0x33')]=_0x259847[_0x22eb('0x33')];_0x32a4b6[_0x22eb('0x34')]=_0x259847[_0x22eb('0x34')];_0x32a4b6[_0x22eb('0x35')]=_0x259847['temp'];_0x32a4b6['outboundAnswerAgiCallsDay']=_0x259847[_0x22eb('0x36')];_0x32a4b6['outboundAnswerCallsDay']=_0x259847['outboundAnswerCallsDay'];_0x32a4b6[_0x22eb('0x37')]=_0x259847[_0x22eb('0x37')];_0x32a4b6[_0x22eb('0x38')]=_0x259847[_0x22eb('0x38')];_0x32a4b6[_0x22eb('0x39')]=_0x259847[_0x22eb('0x39')];_0x32a4b6[_0x22eb('0x3a')]=_0x259847[_0x22eb('0x3a')];_0x32a4b6[_0x22eb('0x3b')]=_0x259847[_0x22eb('0x3b')];_0x32a4b6['outboundDropCallsDayTimeout']=_0x259847[_0x22eb('0x3c')];_0x32a4b6['outboundNoAnswerCallsDay']=_0x259847['outboundNoAnswerCallsDay'];_0x32a4b6[_0x22eb('0x3d')]=_0x259847[_0x22eb('0x3d')];_0x32a4b6['outboundOriginateFailureCallsDay']=_0x259847[_0x22eb('0x3e')];_0x32a4b6[_0x22eb('0x3f')]=_0x259847[_0x22eb('0x3f')];_0x32a4b6[_0x22eb('0x40')]=_0x259847[_0x22eb('0x40')];_0x32a4b6['outboundUnknownCallsDay']=_0x259847[_0x22eb('0x41')];_0x32a4b6[_0x22eb('0x42')]=_0x259847['predictiveIntervalAnsweredCalls'];_0x32a4b6[_0x22eb('0x43')]=_0x259847[_0x22eb('0x43')];_0x32a4b6[_0x22eb('0x44')]=_0x259847[_0x22eb('0x44')];_0x32a4b6[_0x22eb('0x45')]=_0x259847['predictiveIntervalDroppedCallsCallersExit'];_0x32a4b6['predictiveIntervalDroppedCallsTimeout']=_0x259847[_0x22eb('0x46')];_0x32a4b6[_0x22eb('0x47')]=_0x259847['predictiveIntervalErlangCalls'];_0x32a4b6[_0x22eb('0x48')]=_0x259847[_0x22eb('0x48')];_0x32a4b6[_0x22eb('0x49')]=_0x259847['predictiveIntervalHitRate'];_0x32a4b6[_0x22eb('0x4a')]=_0x259847[_0x22eb('0x4a')];_0x32a4b6[_0x22eb('0x4b')]=_0x259847[_0x22eb('0x4b')];_0x32a4b6[_0x22eb('0x4c')]=_0x259847[_0x22eb('0x4c')];_0x32a4b6['predictiveIntervalTotalCalls']=_0x259847[_0x22eb('0x4d')];_0x32a4b6[_0x22eb('0x16')]=_0x259847['message'];_0x32a4b6[_0x22eb('0x4e')]=_0x259847[_0x22eb('0x4e')];_0x32a4b6[_0x22eb('0x4f')]=_0x259847[_0x22eb('0x4f')];_0x32a4b6[_0x22eb('0x50')]=_0x259847[_0x22eb('0x50')];_0x32a4b6[_0x22eb('0x51')]=_0x259847[_0x22eb('0x51')];_0x32a4b6[_0x22eb('0x52')]=_0x259847[_0x22eb('0x52')];_0x32a4b6[_0x22eb('0x53')]=_0x259847[_0x22eb('0x53')];_0x32a4b6[_0x22eb('0x54')]=_0x259847[_0x22eb('0x54')];}if(_0x259847[_0x22eb('0x55')]){_0x32a4b6[_0x22eb('0x55')]={'id':_0x259847[_0x22eb('0x55')]['id'],'name':_0x259847[_0x22eb('0x55')]['name'],'active':_0x259847[_0x22eb('0x55')][_0x22eb('0x56')],'callerid':_0x259847['Trunk'][_0x22eb('0x57')]};}if(_0x259847[_0x22eb('0x58')]){_0x32a4b6['Interval']={'id':_0x259847['Interval']['id'],'name':_0x259847['Interval'][_0x22eb('0x20')]};}_0x12c133[_0x22eb('0x59')](_0x32a4b6);}}_0x420d4f({'count':_0x12c133['length'],'rows':_0x12c133});});},'UpdateVoiceQueue':function(_0x513b2e){return new Promise(function(_0xa7c642,_0x43f771){var _0x326b24=_[_0x22eb('0x5a')](_0x591824[_0x22eb('0x1e')],{'id':parseInt(_0x513b2e['id'])});var _0x3b30a3=_[_0x22eb('0x5b')](_0x513b2e,['id']);if(_0x326b24){for(var _0x147ca0 in _0x3b30a3){if(typeof _0x3b30a3[_0x147ca0]!=='undefined'&&typeof _0x326b24[_0x147ca0]!=='undefined'){_0x326b24[_0x147ca0]=_0x3b30a3[_0x147ca0];}}_0xa7c642(_0x326b24);}else{_0x43f771();}});},'VoiceChannels':function(_0x19248e){return new Promise(function(_0x4f66f3,_0x5e695c){var _0x4bd819=_[_0x22eb('0x5c')](_0x591824['channels']);_0x4f66f3({'count':_0x4bd819['length'],'rows':_0x4bd819});});},'VoiceChannelMixMonitor':function(_0x4e48a8){var _0x517784=this;return new Promise(function(_0x36b174,_0x4b5c03){if(ami[_0x22eb('0x10')]()==![]){return _0x4b5c03(_0x517784[_0x22eb('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x22eb('0x11')]['username'],_0x22eb('0x13')][_0x22eb('0x5d')]('\x20')));}var _0x1df219=schema(properties[_0x22eb('0x5e')])[_0x22eb('0x2')](_0x4e48a8);if(_0x1df219[_0x22eb('0x5f')]>0x0){return _0x4b5c03(_0x517784[_0x22eb('0x18')](0x1f4,_[_0x22eb('0x60')](_0x1df219,_0x22eb('0x16'))['join'](',\x20')));}var _0x4055dc=_[_0x22eb('0x5a')](_0x591824['channels'],{'uniqueid':_0x4e48a8[_0x22eb('0x61')]});if(_0x4055dc&&_0x4055dc[_0x22eb('0x62')]){var _0x4da671=util[_0x22eb('0x7')]('%s.%s',_0x4e48a8[_0x22eb('0x63')]||_0x4e48a8[_0x22eb('0x61')],_0x4e48a8[_0x22eb('0x7')]||_0x22eb('0x64'));return ami[_0x22eb('0x15')]({'action':_0x22eb('0x65'),'channel':_0x4055dc['channel'],'file':_0x4da671,'options':_0x22eb('0x66')})['then'](function(_0x3ff406){var _0x5eecef=_[_0x22eb('0x5a')](_0x4055dc[_0x22eb('0x67')],{'filename':_0x22eb('0x68')+_0x4da671[_0x22eb('0x69')]()});if(_[_0x22eb('0x6a')](_0x5eecef)){_0x4055dc['monitors']['push']({'filename':_0x22eb('0x68')+_0x4da671[_0x22eb('0x69')](),'createdAt':moment()['format'](_0x22eb('0x6b')),'mixmonitorid':_0x3ff406[_0x22eb('0x6c')],'status':_0x22eb('0x6d')});}else{_0x5eecef[_0x22eb('0x6c')]=_0x3ff406[_0x22eb('0x6c')];_0x5eecef[_0x22eb('0x6e')]=_0x22eb('0x6d');}_0x36b174({'code':0xc8,'message':[_0x4e48a8[_0x22eb('0x61')],_0x22eb('0x6f'),_0x3ff406[_0x22eb('0x6c')]][_0x22eb('0x5d')]('\x20'),'mixmonitorid':_0x3ff406['mixmonitorid']});})[_0x22eb('0x17')](function(_0x462f06){_0x4b5c03(_0x517784[_0x22eb('0x18')](0x1f5,[_0x4e48a8[_0x22eb('0x61')],_0x462f06[_0x22eb('0x16')][_0x22eb('0x69')]()][_0x22eb('0x5d')]('\x20')));});}else{return _0x4b5c03(_0x517784[_0x22eb('0x18')](0x1f5,_0x22eb('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x9f8465){var _0x3e9ab5=this;return new Promise(function(_0x108607,_0x38d5aa){if(ami[_0x22eb('0x10')]()==![]){return _0x38d5aa(_0x3e9ab5['error'](0x1f4,[config['asterisk']['ip'],config[_0x22eb('0x11')][_0x22eb('0x12')],_0x22eb('0x13')][_0x22eb('0x5d')]('\x20')));}var _0x196ad2=schema(properties['voicechannel'])[_0x22eb('0x2')](_0x9f8465);if(_0x196ad2[_0x22eb('0x5f')]>0x0){return _0x38d5aa(_0x3e9ab5['error'](0x1f4,_['map'](_0x196ad2,_0x22eb('0x16'))[_0x22eb('0x5d')](',\x20')));}var _0xb5c8ae=_[_0x22eb('0x5a')](_0x591824[_0x22eb('0x71')],{'uniqueid':_0x9f8465[_0x22eb('0x61')]});if(_0xb5c8ae){return BPromise[_0x22eb('0x72')]()[_0x22eb('0x1c')](function(){if(_0xb5c8ae[_0x22eb('0x62')]){return ami[_0x22eb('0x15')]({'action':_0x22eb('0x73'),'channel':_0xb5c8ae[_0x22eb('0x62')],'mixmonitorid':_0x9f8465[_0x22eb('0x6c')]})[_0x22eb('0x17')](function(_0x4aea9d){});}})[_0x22eb('0x1c')](function(){if(_0xb5c8ae[_0x22eb('0x74')]){return ami[_0x22eb('0x15')]({'action':'StopMixMonitor','channel':_0xb5c8ae[_0x22eb('0x74')],'mixmonitorid':_0x9f8465['mixmonitorid']})[_0x22eb('0x17')](function(_0x5347b4){});}})[_0x22eb('0x1c')](function(_0x43f4a1){var _0x4a8f0d=_[_0x22eb('0x5a')](_0xb5c8ae[_0x22eb('0x67')],{'mixmonitorid':_0x9f8465['mixmonitorid']});if(_0x4a8f0d){_0x4a8f0d['status']=_0x22eb('0x75');}})[_0x22eb('0x1c')](function(){var _0x1984f0=util[_0x22eb('0x7')](_0x22eb('0x76'),_0x9f8465[_0x22eb('0x63')]||_0x9f8465['uniqueid'],_0x9f8465[_0x22eb('0x7')]||'wav');var _0x5f4ea3=_[_0x22eb('0x5a')](_0xb5c8ae[_0x22eb('0x67')],{'filename':_0x22eb('0x68')+_0x1984f0[_0x22eb('0x69')]()});if(_0x5f4ea3){_0x5f4ea3[_0x22eb('0x6e')]=_0x22eb('0x75');}})[_0x22eb('0x1c')](function(){_0x108607({'code':0xc8,'message':[_0x9f8465[_0x22eb('0x61')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x22eb('0x17')](function(_0x472bce){_0x38d5aa(_0x3e9ab5['error'](0x1f5,[_0x9f8465[_0x22eb('0x61')],_0x472bce[_0x22eb('0x16')][_0x22eb('0x69')]()][_0x22eb('0x5d')]('\x20')));});}else{return _0x38d5aa(_0x3e9ab5[_0x22eb('0x18')](0x1f5,_0x22eb('0x70')));}});},'VoiceQueuesChannels':function(_0x5ce4ea){return new Promise(function(_0x3dd49b,_0x29d4a7){var _0x37fa5e=_['values'](_0x591824['queueChannels']);_0x3dd49b({'count':_0x37fa5e[_0x22eb('0x5f')],'rows':_0x37fa5e});});},'VoiceQueuesChannel':function(_0x753980){var _0xa4178f=this;return new Promise(function(_0x5ebeb5,_0x2408d9){var _0x4b6cf3=schema(properties[_0x22eb('0x77')])[_0x22eb('0x2')](_0x753980);if(_0x4b6cf3[_0x22eb('0x5f')]>0x0){return _0x2408d9(_0xa4178f[_0x22eb('0x18')](0x1f4,_['map'](_0x4b6cf3,_0x22eb('0x16'))[_0x22eb('0x5d')](',\x20')));}var _0x304492=_[_0x22eb('0x5a')](_0x591824[_0x22eb('0x78')],{'uniqueid':_0x753980[_0x22eb('0x61')]});if(_0x304492){_0x5ebeb5(_0x304492);}else{return _0x2408d9(_0xa4178f[_0x22eb('0x18')](0x1f5,_0x22eb('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x47865e){var _0x1c5b0b=this;return new Promise(function(_0x14006f,_0x5b4e6a){if(ami[_0x22eb('0x10')]()==![]){return _0x5b4e6a(_0x1c5b0b[_0x22eb('0x18')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x22eb('0x13')][_0x22eb('0x5d')]('\x20')));}var _0x50c3ba=schema(properties[_0x22eb('0x79')])[_0x22eb('0x2')](_0x47865e);if(_0x50c3ba[_0x22eb('0x5f')]>0x0){return _0x5b4e6a(_0x1c5b0b[_0x22eb('0x18')](0x1f4,_[_0x22eb('0x60')](_0x50c3ba,'message')['join'](',\x20')));}var _0x297554=_[_0x22eb('0x5a')](_0x591824[_0x22eb('0x78')],{'uniqueid':_0x47865e['uniqueid']});if(_0x297554&&_0x297554['channel']){return ami[_0x22eb('0x15')]({'action':'Hangup','channel':_0x297554['channel']})[_0x22eb('0x1c')](function(_0xe524a1){_0x14006f({'code':0xc8,'message':[_0x47865e['uniqueid'],_0xe524a1['message'][_0x22eb('0x69')]()][_0x22eb('0x5d')]('\x20')});})['catch'](function(_0x17f51b){_0x5b4e6a(_0x1c5b0b[_0x22eb('0x18')](0x1f5,[_0x47865e[_0x22eb('0x61')],_0x17f51b['message'][_0x22eb('0x69')]()][_0x22eb('0x5d')]('\x20')));});}else{return _0x5b4e6a(_0x1c5b0b[_0x22eb('0x18')](0x1f5,_0x22eb('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x3697ad){var _0x49578c=this;return new Promise(function(_0x9147e2,_0x2ecc24){if(ami[_0x22eb('0x10')]()==![]){return _0x2ecc24(_0x49578c['error'](0x1f4,[config['asterisk']['ip'],config[_0x22eb('0x11')][_0x22eb('0x12')],_0x22eb('0x13')]['join']('\x20')));}var _0x215472=schema(properties[_0x22eb('0x7a')])[_0x22eb('0x2')](_0x3697ad);if(_0x215472['length']>0x0){return _0x2ecc24(_0x49578c[_0x22eb('0x18')](0x1f4,_['map'](_0x215472,'message')[_0x22eb('0x5d')](',\x20')));}var _0x1e541f=_[_0x22eb('0x5a')](_0x591824['queueChannels'],{'uniqueid':_0x3697ad[_0x22eb('0x61')]});if(_0x1e541f&&_0x1e541f[_0x22eb('0x62')]){return ami[_0x22eb('0x15')]({'action':_0x22eb('0x7b'),'channel':_0x1e541f[_0x22eb('0x62')],'exten':_0x3697ad['exten'],'context':_0x3697ad[_0x22eb('0x7c')]||_0x1e541f['context'],'priority':0x1})[_0x22eb('0x1c')](function(_0x40161b){_0x9147e2({'code':0xc8,'message':[_0x3697ad[_0x22eb('0x61')],_0x40161b['message'][_0x22eb('0x69')]()][_0x22eb('0x5d')]('\x20')});})[_0x22eb('0x17')](function(_0x2247c5){_0x2ecc24(_0x49578c[_0x22eb('0x18')](0x1f5,[_0x3697ad[_0x22eb('0x61')],_0x2247c5[_0x22eb('0x16')][_0x22eb('0x69')]()][_0x22eb('0x5d')]('\x20')));});}else{return _0x2ecc24(_0x49578c[_0x22eb('0x18')](0x1f5,_0x22eb('0x70')));}});},'Agents':function(_0x50426b){return new Promise(function(_0x30e721,_0x1ac845){var _0x40999d=_[_0x22eb('0x5c')](_0x591824['agents']);_0x30e721({'count':_0x40999d[_0x22eb('0x5f')],'rows':_0x40999d});});},'Telephones':function(_0x1a788b){return new Promise(function(_0x5b576c,_0x2f2dd7){var _0x244a04=_[_0x22eb('0x5c')](_0x591824[_0x22eb('0x7d')]);_0x5b576c({'count':_0x244a04[_0x22eb('0x5f')],'rows':_0x244a04});});},'Trunks':function(_0x3a172e){return new Promise(function(_0x502a2a,_0x553720){var _0xdc6c24=_[_0x22eb('0x5c')](_0x591824['trunks']);_0x502a2a({'count':_0xdc6c24['length'],'rows':_0xdc6c24});});},'OutboundChannels':function(_0x2b5b0a){return new Promise(function(_0x31c40a,_0x3424a6){var _0x938d33=_[_0x22eb('0x5c')](_0x591824['outboundChannels']);_0x31c40a({'count':_0x938d33['length'],'rows':_0x938d33});});},'Outbound':function(_0x41fa99){return new Promise(function(_0x18abf4,_0x5cf5e5){_0x18abf4(_0x591824[_0x22eb('0x2e')]);});},'Campaigns':function(_0x35767e){return new Promise(function(_0x3d6c25,_0x5db386){var _0x448fea=_[_0x22eb('0x5c')](_0x591824[_0x22eb('0x7e')]);_0x3d6c25({'count':_0x448fea[_0x22eb('0x5f')],'rows':_0x448fea});});},'VoiceQueuesPreview':function(_0x6ffcc6){var _0x195f58=this;return new Promise(function(_0x203b47,_0x2063c8){_0x1dfef7['run'](_0x6ffcc6['id'])['then'](function(_0x4e3341){_0x203b47({'code':0xc8,'message':_0x4e3341[_0x22eb('0x16')]});})['catch'](function(_0x5c620d){_0x2063c8(_0x195f58[_0x22eb('0x18')](0x1f4,_0x5c620d[_0x22eb('0x16')]));});});},'EventManager':function(_0x4af331){var _0xff071e=this;return new Promise(function(_0x5099fb,_0x210b08){if(!_0x4af331[_0x22eb('0x7f')]){return _0x210b08(_0xff071e['error'](0x1f4,_0x22eb('0x80')));}ami[_0x22eb('0x81')](_0x22eb('0x82')+_0x4af331['event'],_0x4af331['message']);_0x5099fb({'code':0xc8,'message':_0x4af331});});},'FaxAccounts':function(_0x500d67){return new Promise(function(_0x12566f,_0x12039a){var _0x48fa11=_['values'](_0x591824[_0x22eb('0x83')]);_0x12566f({'count':_0x48fa11['length'],'rows':_0x48fa11});});},'SendFax':function(_0x5328c5){var _0x298299=this;return new Promise(function(_0x2a3f2f,_0x5c7482){_0x10e116['send'](_0x5328c5)[_0x22eb('0x1c')](function(_0x1f9cd5){_0x2a3f2f({'code':0xc8,'message':_0x1f9cd5[_0x22eb('0x16')]});})[_0x22eb('0x17')](function(_0x165c7d){_0x5c7482(_0x298299['error'](0x1f4,_0x165c7d['message']));});});},'CheckAfterSend':function(_0x860db){var _0x31f41f=this;return new Promise(function(_0x376d5c,_0x5614eb){_0x10e116[_0x22eb('0x84')](_0x860db)['then'](function(_0x548b57){_0x376d5c({'code':0xc8,'message':_0x548b57[_0x22eb('0x16')]});})[_0x22eb('0x17')](function(_0x5c506d){_0x5614eb(_0x31f41f[_0x22eb('0x18')](0x1f4,_0x5c506d['message']));});});}};var _0x212977=jayson['server'](_0x4539d0)[_0x22eb('0x85')]();_0x212977['on']('error',function(_0x64cd9e){return _0x2a9850(_0x64cd9e);});_0x212977[_0x22eb('0x86')](0x232a,_0x22eb('0x87'),function(){console[_0x22eb('0x88')](_0x22eb('0x89'),0x232a);return _0x35dd5b('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x8b8e=['format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','catch','message','username','command','Command','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','values','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','../properties','../ami','listen'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x8b8e,0x108));var _0xe8b8=function(_0x2c13e7,_0x2b85ea){_0x2c13e7=_0x2c13e7-0x0;var _0x3cb2c2=_0x8b8e[_0x2c13e7];return _0x3cb2c2;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var jayson=require(_0xe8b8('0x1'));var schema=require('validate');var BPromise=require(_0xe8b8('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xe8b8('0x3'));var ami=require(_0xe8b8('0x4'));exports[_0xe8b8('0x5')]=function(_0x221ccc,_0x42bef9,_0x3f5dd7){return new BPromise(function(_0x1c0548,_0x2b3269){var _0x229e0b={'QueuePause':function(_0x2540e3){return new Promise(function(_0x4ce796,_0x2a4ccd){var _0x5cd238=util[_0xe8b8('0x6')]('%s/%s','SIP',_0x2540e3[_0xe8b8('0x7')]);if(_0x221ccc[_0xe8b8('0x8')]&&_0x221ccc['timers'][_0x5cd238]&&_0x221ccc['timers'][_0x5cd238][_0xe8b8('0x9')]){_0x221ccc[_0xe8b8('0x8')][_0x5cd238][_0xe8b8('0xa')]();}if(_0x221ccc[_0xe8b8('0xb')][_0x5cd238]){_0x221ccc[_0xe8b8('0xb')][_0x5cd238][_0xe8b8('0xc')]({'statePause':_0x2540e3[_0xe8b8('0xd')]?!![]:![]});}_0x4ce796({'code':0xc8,'message':_0xe8b8('0xe')});});},'Reload':function(_0x151e09){var _0x3b3871=this;return new Promise(function(_0x1c5062,_0x384780){if(ami[_0xe8b8('0xf')]()==![]){return _0x384780(_0x3b3871[_0xe8b8('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xe8b8('0x11')]['username'],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}_0x151e09=_[_0xe8b8('0x14')](_0x151e09,_[_0xe8b8('0x15')](properties[_0xe8b8('0x16')]));_0x151e09[_0xe8b8('0x17')]=_0xe8b8('0x18');return ami[_0xe8b8('0x19')](_0x151e09)[_0xe8b8('0x1a')](function(_0x3a1329){_0x1c5062({'code':0xc8,'message':_0x3a1329['message']});})[_0xe8b8('0x1b')](function(_0xaba717){_0x384780(_0x3b3871['error'](0x1f5,_0xaba717[_0xe8b8('0x1c')]));});});},'Command':function(_0xe48622){var _0x2b2b80=this;return new Promise(function(_0x2f54c3,_0xbd89e){if(ami[_0xe8b8('0xf')]()==![]){return _0xbd89e(_0x2b2b80[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}_0xe48622=_[_0xe8b8('0x14')](_0xe48622,_0xe8b8('0x1e'));_0xe48622[_0xe8b8('0x17')]=_0xe8b8('0x1f');return ami[_0xe8b8('0x19')](_0xe48622)['then'](function(_0x57faf7){_0x2f54c3({'code':0xc8,'message':_0x57faf7['content']});})[_0xe8b8('0x1b')](function(_0x51297e){_0xbd89e(_0x2b2b80[_0xe8b8('0x10')](0x1f5,_0x51297e['message']));});});},'VoiceQueues':function(_0x11d48b){return new Promise(function(_0x141cec,_0x5e3fa2){var _0x5ac435=[];for(var _0x19f7b3 in _0x221ccc[_0xe8b8('0x20')]){if(_0x221ccc['voiceQueues'][_0xe8b8('0x21')](_0x19f7b3)){var _0x32141f=_0x221ccc[_0xe8b8('0x20')][_0x19f7b3];var _0x46b2dc={'id':_0x32141f['id'],'name':_0x32141f[_0xe8b8('0x7')],'strategy':_0x32141f['strategy'],'answered':_0x32141f[_0xe8b8('0x22')],'available':_0x32141f['available'],'loggedIn':_0x32141f[_0xe8b8('0x23')],'pTalking':_0x32141f[_0xe8b8('0x24')],'sumBillable':_0x32141f[_0xe8b8('0x25')],'sumDuration':_0x32141f[_0xe8b8('0x26')],'sumHoldTime':_0x32141f['sumHoldTime']||0x0,'talking':_0x32141f['talking'],'total':_0x32141f[_0xe8b8('0x27')],'type':_0x32141f[_0xe8b8('0x28')],'unmanaged':_0x32141f[_0xe8b8('0x29')],'abandoned':_0x32141f[_0xe8b8('0x2a')],'waiting':_0x32141f[_0xe8b8('0x2b')],'loggedInDb':_0x32141f['loggedInDb']};if(_0x32141f[_0xe8b8('0x28')]===_0xe8b8('0x2c')){_0x46b2dc[_0xe8b8('0x2d')]=_0x32141f[_0xe8b8('0x2d')];_0x46b2dc[_0xe8b8('0x2e')]=_0x32141f[_0xe8b8('0x2e')];_0x46b2dc[_0xe8b8('0x2f')]=_0x32141f[_0xe8b8('0x2f')];_0x46b2dc[_0xe8b8('0x30')]=_0x32141f[_0xe8b8('0x30')];_0x46b2dc[_0xe8b8('0x31')]=_0x32141f['dialOriginateTimeout'];_0x46b2dc[_0xe8b8('0x32')]=_0x32141f[_0xe8b8('0x32')];_0x46b2dc[_0xe8b8('0x33')]=_0x32141f['temp'];_0x46b2dc[_0xe8b8('0x34')]=_0x32141f[_0xe8b8('0x34')];_0x46b2dc[_0xe8b8('0x35')]=_0x32141f[_0xe8b8('0x35')];_0x46b2dc[_0xe8b8('0x36')]=_0x32141f[_0xe8b8('0x36')];_0x46b2dc[_0xe8b8('0x37')]=_0x32141f[_0xe8b8('0x37')];_0x46b2dc[_0xe8b8('0x38')]=_0x32141f['outboundCongestionCallsDay'];_0x46b2dc[_0xe8b8('0x39')]=_0x32141f[_0xe8b8('0x39')];_0x46b2dc['outboundDropCallsDayCallersExit']=_0x32141f[_0xe8b8('0x3a')];_0x46b2dc[_0xe8b8('0x3b')]=_0x32141f[_0xe8b8('0x3b')];_0x46b2dc[_0xe8b8('0x3c')]=_0x32141f[_0xe8b8('0x3c')];_0x46b2dc['outboundNoSuchCallsDay']=_0x32141f[_0xe8b8('0x3d')];_0x46b2dc[_0xe8b8('0x3e')]=_0x32141f[_0xe8b8('0x3e')];_0x46b2dc[_0xe8b8('0x3f')]=_0x32141f[_0xe8b8('0x3f')];_0x46b2dc[_0xe8b8('0x40')]=_0x32141f['outboundRejectCallsDay'];_0x46b2dc[_0xe8b8('0x41')]=_0x32141f['outboundUnknownCallsDay'];_0x46b2dc[_0xe8b8('0x42')]=_0x32141f[_0xe8b8('0x42')];_0x46b2dc['predictiveIntervalAvgHoldtime']=_0x32141f['predictiveIntervalAvgHoldtime'];_0x46b2dc[_0xe8b8('0x43')]=_0x32141f[_0xe8b8('0x43')];_0x46b2dc[_0xe8b8('0x44')]=_0x32141f[_0xe8b8('0x44')];_0x46b2dc['predictiveIntervalDroppedCallsTimeout']=_0x32141f[_0xe8b8('0x45')];_0x46b2dc[_0xe8b8('0x46')]=_0x32141f[_0xe8b8('0x46')];_0x46b2dc[_0xe8b8('0x47')]=_0x32141f[_0xe8b8('0x47')];_0x46b2dc[_0xe8b8('0x48')]=_0x32141f[_0xe8b8('0x48')];_0x46b2dc[_0xe8b8('0x49')]=_0x32141f['predictiveIntervalMultiplicativeFactor'];_0x46b2dc['predictiveIntervalPauses']=_0x32141f[_0xe8b8('0x4a')];_0x46b2dc[_0xe8b8('0x4b')]=_0x32141f[_0xe8b8('0x4b')];_0x46b2dc['predictiveIntervalTotalCalls']=_0x32141f[_0xe8b8('0x4c')];_0x46b2dc[_0xe8b8('0x1c')]=_0x32141f[_0xe8b8('0x1c')];_0x46b2dc[_0xe8b8('0x4d')]=_0x32141f[_0xe8b8('0x4d')];_0x46b2dc[_0xe8b8('0x4e')]=_0x32141f[_0xe8b8('0x4e')];_0x46b2dc['erlangCallToSecond']=_0x32141f['erlangCallToSecond'];_0x46b2dc['erlangAbandonmentRate']=_0x32141f[_0xe8b8('0x4f')];_0x46b2dc[_0xe8b8('0x50')]=_0x32141f[_0xe8b8('0x50')];_0x46b2dc[_0xe8b8('0x51')]=_0x32141f['startPredictive'];_0x46b2dc[_0xe8b8('0x52')]=_0x32141f[_0xe8b8('0x52')];}if(_0x32141f[_0xe8b8('0x53')]){_0x46b2dc[_0xe8b8('0x53')]={'id':_0x32141f['Trunk']['id'],'name':_0x32141f['Trunk'][_0xe8b8('0x7')],'active':_0x32141f[_0xe8b8('0x53')][_0xe8b8('0x54')],'callerid':_0x32141f['Trunk'][_0xe8b8('0x55')]};}if(_0x32141f[_0xe8b8('0x56')]){_0x46b2dc[_0xe8b8('0x56')]={'id':_0x32141f[_0xe8b8('0x56')]['id'],'name':_0x32141f['Interval'][_0xe8b8('0x7')]};}_0x5ac435[_0xe8b8('0x57')](_0x46b2dc);}}_0x141cec({'count':_0x5ac435[_0xe8b8('0x58')],'rows':_0x5ac435});});},'UpdateVoiceQueue':function(_0xb2cae7){return new Promise(function(_0x2054cc,_0xb22887){var _0x1a8380=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x20')],{'id':parseInt(_0xb2cae7['id'])});var _0x2e85f1=_[_0xe8b8('0x5a')](_0xb2cae7,['id']);if(_0x1a8380){for(var _0xb51b61 in _0x2e85f1){if(typeof _0x2e85f1[_0xb51b61]!=='undefined'&&typeof _0x1a8380[_0xb51b61]!=='undefined'){_0x1a8380[_0xb51b61]=_0x2e85f1[_0xb51b61];}}_0x2054cc(_0x1a8380);}else{_0xb22887();}});},'VoiceChannels':function(_0x442c58){return new Promise(function(_0x289347,_0x39bab6){var _0x340880=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x5c')]);_0x289347({'count':_0x340880[_0xe8b8('0x58')],'rows':_0x340880});});},'VoiceChannelMixMonitor':function(_0x4fd7d9){var _0x554482=this;return new Promise(function(_0x3a956a,_0x30595a){if(ami['isConnected']()==![]){return _0x30595a(_0x554482[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x1ced4c=schema(properties[_0xe8b8('0x5d')])[_0xe8b8('0x5e')](_0x4fd7d9);if(_0x1ced4c[_0xe8b8('0x58')]>0x0){return _0x30595a(_0x554482[_0xe8b8('0x10')](0x1f4,_[_0xe8b8('0x5f')](_0x1ced4c,'message')[_0xe8b8('0x13')](',\x20')));}var _0x5b4316=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x5c')],{'uniqueid':_0x4fd7d9[_0xe8b8('0x60')]});if(_0x5b4316&&_0x5b4316[_0xe8b8('0x61')]){var _0x517894=util[_0xe8b8('0x6')](_0xe8b8('0x62'),_0x4fd7d9['filename']||_0x4fd7d9[_0xe8b8('0x60')],_0x4fd7d9[_0xe8b8('0x6')]||_0xe8b8('0x63'));return ami[_0xe8b8('0x19')]({'action':_0xe8b8('0x64'),'channel':_0x5b4316[_0xe8b8('0x61')],'file':_0x517894,'options':'ai(mixmonitorid)'})[_0xe8b8('0x1a')](function(_0x4d9971){var _0x53cef6=_[_0xe8b8('0x59')](_0x5b4316[_0xe8b8('0x65')],{'filename':_0xe8b8('0x66')+_0x517894[_0xe8b8('0x67')]()});if(_[_0xe8b8('0x68')](_0x53cef6)){_0x5b4316[_0xe8b8('0x65')][_0xe8b8('0x57')]({'filename':_0xe8b8('0x66')+_0x517894[_0xe8b8('0x67')](),'createdAt':moment()[_0xe8b8('0x6')](_0xe8b8('0x69')),'mixmonitorid':_0x4d9971['mixmonitorid'],'status':_0xe8b8('0x6a')});}else{_0x53cef6[_0xe8b8('0x6b')]=_0x4d9971[_0xe8b8('0x6b')];_0x53cef6[_0xe8b8('0x6c')]='rec';}_0x3a956a({'code':0xc8,'message':[_0x4fd7d9[_0xe8b8('0x60')],'MixMonitor\x20Success',_0x4d9971[_0xe8b8('0x6b')]][_0xe8b8('0x13')]('\x20'),'mixmonitorid':_0x4d9971['mixmonitorid']});})[_0xe8b8('0x1b')](function(_0x4c4752){_0x30595a(_0x554482[_0xe8b8('0x10')](0x1f5,[_0x4fd7d9[_0xe8b8('0x60')],_0x4c4752[_0xe8b8('0x1c')]['toLowerCase']()][_0xe8b8('0x13')]('\x20')));});}else{return _0x30595a(_0x554482[_0xe8b8('0x10')](0x1f5,_0xe8b8('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x2c6603){var _0x2178bb=this;return new Promise(function(_0x293255,_0x4d4828){if(ami[_0xe8b8('0xf')]()==![]){return _0x4d4828(_0x2178bb[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x452285=schema(properties[_0xe8b8('0x5d')])['validate'](_0x2c6603);if(_0x452285['length']>0x0){return _0x4d4828(_0x2178bb['error'](0x1f4,_['map'](_0x452285,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0xc6f8c7=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x5c')],{'uniqueid':_0x2c6603[_0xe8b8('0x60')]});if(_0xc6f8c7){return BPromise[_0xe8b8('0x6e')]()[_0xe8b8('0x1a')](function(){if(_0xc6f8c7[_0xe8b8('0x61')]){return ami[_0xe8b8('0x19')]({'action':_0xe8b8('0x6f'),'channel':_0xc6f8c7[_0xe8b8('0x61')],'mixmonitorid':_0x2c6603[_0xe8b8('0x6b')]})['catch'](function(_0x1af57a){});}})['then'](function(){if(_0xc6f8c7[_0xe8b8('0x70')]){return ami['Action']({'action':_0xe8b8('0x6f'),'channel':_0xc6f8c7[_0xe8b8('0x70')],'mixmonitorid':_0x2c6603[_0xe8b8('0x6b')]})[_0xe8b8('0x1b')](function(_0x3b52ab){});}})['then'](function(_0x15c318){var _0x39c471=_['find'](_0xc6f8c7[_0xe8b8('0x65')],{'mixmonitorid':_0x2c6603[_0xe8b8('0x6b')]});if(_0x39c471){_0x39c471['status']=_0xe8b8('0x71');}})[_0xe8b8('0x1a')](function(){var _0x3864d1=util['format'](_0xe8b8('0x62'),_0x2c6603[_0xe8b8('0x72')]||_0x2c6603[_0xe8b8('0x60')],_0x2c6603[_0xe8b8('0x6')]||_0xe8b8('0x63'));var _0x1466b9=_[_0xe8b8('0x59')](_0xc6f8c7[_0xe8b8('0x65')],{'filename':_0xe8b8('0x66')+_0x3864d1[_0xe8b8('0x67')]()});if(_0x1466b9){_0x1466b9[_0xe8b8('0x6c')]=_0xe8b8('0x71');}})[_0xe8b8('0x1a')](function(){_0x293255({'code':0xc8,'message':[_0x2c6603[_0xe8b8('0x60')],'StopMixMonitor\x20Success'][_0xe8b8('0x13')]('\x20')});})['catch'](function(_0x49d044){_0x4d4828(_0x2178bb['error'](0x1f5,[_0x2c6603[_0xe8b8('0x60')],_0x49d044[_0xe8b8('0x1c')][_0xe8b8('0x67')]()][_0xe8b8('0x13')]('\x20')));});}else{return _0x4d4828(_0x2178bb['error'](0x1f5,_0xe8b8('0x6d')));}});},'VoiceQueuesChannels':function(_0x51c7fd){return new Promise(function(_0x41bdf9,_0x539435){var _0x8ddffe=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x73')]);_0x41bdf9({'count':_0x8ddffe[_0xe8b8('0x58')],'rows':_0x8ddffe});});},'VoiceQueuesChannel':function(_0x4ae5bb){var _0x119c90=this;return new Promise(function(_0xa845b6,_0x4c3bde){var _0x3dcf9a=schema(properties['voicequeuechannel'])['validate'](_0x4ae5bb);if(_0x3dcf9a[_0xe8b8('0x58')]>0x0){return _0x4c3bde(_0x119c90[_0xe8b8('0x10')](0x1f4,_[_0xe8b8('0x5f')](_0x3dcf9a,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0x110195=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x73')],{'uniqueid':_0x4ae5bb[_0xe8b8('0x60')]});if(_0x110195){_0xa845b6(_0x110195);}else{return _0x4c3bde(_0x119c90[_0xe8b8('0x10')](0x1f5,_0xe8b8('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x4f2c0d){var _0x21ec32=this;return new Promise(function(_0x462ed8,_0x54c930){if(ami[_0xe8b8('0xf')]()==![]){return _0x54c930(_0x21ec32['error'](0x1f4,[config[_0xe8b8('0x11')]['ip'],config[_0xe8b8('0x11')][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x33c765=schema(properties['voicequeuechannelhangup'])[_0xe8b8('0x5e')](_0x4f2c0d);if(_0x33c765[_0xe8b8('0x58')]>0x0){return _0x54c930(_0x21ec32['error'](0x1f4,_[_0xe8b8('0x5f')](_0x33c765,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0x3a4161=_['find'](_0x221ccc[_0xe8b8('0x73')],{'uniqueid':_0x4f2c0d[_0xe8b8('0x60')]});if(_0x3a4161&&_0x3a4161[_0xe8b8('0x61')]){return ami[_0xe8b8('0x19')]({'action':'Hangup','channel':_0x3a4161[_0xe8b8('0x61')]})[_0xe8b8('0x1a')](function(_0x1d643f){_0x462ed8({'code':0xc8,'message':[_0x4f2c0d[_0xe8b8('0x60')],_0x1d643f['message']['toLowerCase']()]['join']('\x20')});})[_0xe8b8('0x1b')](function(_0x1be51b){_0x54c930(_0x21ec32[_0xe8b8('0x10')](0x1f5,[_0x4f2c0d[_0xe8b8('0x60')],_0x1be51b[_0xe8b8('0x1c')][_0xe8b8('0x67')]()]['join']('\x20')));});}else{return _0x54c930(_0x21ec32[_0xe8b8('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xd26530){var _0x279e9f=this;return new Promise(function(_0x5ab64e,_0x2d2580){if(ami[_0xe8b8('0xf')]()==![]){return _0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f4,[config[_0xe8b8('0x11')]['ip'],config['asterisk'][_0xe8b8('0x1d')],_0xe8b8('0x12')][_0xe8b8('0x13')]('\x20')));}var _0x536bc3=schema(properties['voicequeuechannelredirect'])['validate'](_0xd26530);if(_0x536bc3[_0xe8b8('0x58')]>0x0){return _0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f4,_[_0xe8b8('0x5f')](_0x536bc3,_0xe8b8('0x1c'))[_0xe8b8('0x13')](',\x20')));}var _0x5e073=_[_0xe8b8('0x59')](_0x221ccc[_0xe8b8('0x73')],{'uniqueid':_0xd26530[_0xe8b8('0x60')]});if(_0x5e073&&_0x5e073[_0xe8b8('0x61')]){return ami[_0xe8b8('0x19')]({'action':'Redirect','channel':_0x5e073[_0xe8b8('0x61')],'exten':_0xd26530[_0xe8b8('0x74')],'context':_0xd26530[_0xe8b8('0x75')]||_0x5e073['context'],'priority':0x1})[_0xe8b8('0x1a')](function(_0x51baf7){_0x5ab64e({'code':0xc8,'message':[_0xd26530[_0xe8b8('0x60')],_0x51baf7[_0xe8b8('0x1c')][_0xe8b8('0x67')]()][_0xe8b8('0x13')]('\x20')});})[_0xe8b8('0x1b')](function(_0x5d4f84){_0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f5,[_0xd26530[_0xe8b8('0x60')],_0x5d4f84['message'][_0xe8b8('0x67')]()][_0xe8b8('0x13')]('\x20')));});}else{return _0x2d2580(_0x279e9f[_0xe8b8('0x10')](0x1f5,_0xe8b8('0x6d')));}});},'Agents':function(_0x5a75b5){return new Promise(function(_0xbea51c,_0x2d8e84){var _0x180c66=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0xb')]);_0xbea51c({'count':_0x180c66[_0xe8b8('0x58')],'rows':_0x180c66});});},'Telephones':function(_0x32c6d2){return new Promise(function(_0x3d71e3,_0xea0155){var _0x40830a=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x76')]);_0x3d71e3({'count':_0x40830a['length'],'rows':_0x40830a});});},'Trunks':function(_0x5f4146){return new Promise(function(_0x473ab2,_0x3232d4){var _0x523452=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x77')]);_0x473ab2({'count':_0x523452[_0xe8b8('0x58')],'rows':_0x523452});});},'OutboundChannels':function(_0x11f95c){return new Promise(function(_0x189f2b,_0x3f1950){var _0x2aa755=_['values'](_0x221ccc[_0xe8b8('0x78')]);_0x189f2b({'count':_0x2aa755[_0xe8b8('0x58')],'rows':_0x2aa755});});},'Outbound':function(_0x3801bb){return new Promise(function(_0x364528,_0x492578){_0x364528(_0x221ccc[_0xe8b8('0x2c')]);});},'Campaigns':function(_0x30a009){return new Promise(function(_0x1fe4b1,_0x3a4c7a){var _0x513e06=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x79')]);_0x1fe4b1({'count':_0x513e06[_0xe8b8('0x58')],'rows':_0x513e06});});},'VoiceQueuesPreview':function(_0x5ba2af){var _0x20de91=this;return new Promise(function(_0x36604c,_0x2ec9b7){_0x42bef9['run'](_0x5ba2af['id'])[_0xe8b8('0x1a')](function(_0x56bf5f){_0x36604c({'code':0xc8,'message':_0x56bf5f[_0xe8b8('0x1c')]});})[_0xe8b8('0x1b')](function(_0x13bd6d){_0x2ec9b7(_0x20de91[_0xe8b8('0x10')](0x1f4,_0x13bd6d[_0xe8b8('0x1c')]));});});},'EventManager':function(_0x5ce501){var _0x560e46=this;return new Promise(function(_0x1dee89,_0x11363d){if(!_0x5ce501[_0xe8b8('0x7a')]){return _0x11363d(_0x560e46[_0xe8b8('0x10')](0x1f4,_0xe8b8('0x7b')));}ami[_0xe8b8('0x7c')](_0xe8b8('0x7d')+_0x5ce501[_0xe8b8('0x7a')],_0x5ce501[_0xe8b8('0x1c')]);_0x1dee89({'code':0xc8,'message':_0x5ce501});});},'FaxAccounts':function(_0x31c65a){return new Promise(function(_0xe3c531,_0xeab356){var _0x958f82=_[_0xe8b8('0x5b')](_0x221ccc[_0xe8b8('0x7e')]);_0xe3c531({'count':_0x958f82[_0xe8b8('0x58')],'rows':_0x958f82});});},'SendFax':function(_0x54fe1f){var _0x1e1a72=this;return new Promise(function(_0x11d7fc,_0x48dd00){_0x3f5dd7[_0xe8b8('0x7f')](_0x54fe1f)[_0xe8b8('0x1a')](function(_0x2c49b7){_0x11d7fc({'code':0xc8,'message':_0x2c49b7['message']});})[_0xe8b8('0x1b')](function(_0x4d52d7){_0x48dd00(_0x1e1a72[_0xe8b8('0x10')](0x1f4,_0x4d52d7[_0xe8b8('0x1c')]));});});},'CheckAfterSend':function(_0x2634f6){var _0x678ee2=this;return new Promise(function(_0x1f2217,_0x51c7d1){_0x3f5dd7[_0xe8b8('0x80')](_0x2634f6)[_0xe8b8('0x1a')](function(_0x2ac568){_0x1f2217({'code':0xc8,'message':_0x2ac568[_0xe8b8('0x1c')]});})[_0xe8b8('0x1b')](function(_0x254700){_0x51c7d1(_0x678ee2[_0xe8b8('0x10')](0x1f4,_0x254700[_0xe8b8('0x1c')]));});});}};var _0x398bc5=jayson[_0xe8b8('0x81')](_0x229e0b)[_0xe8b8('0x82')]();_0x398bc5['on'](_0xe8b8('0x10'),function(_0x5b4bd9){return _0x2b3269(_0x5b4bd9);});_0x398bc5[_0xe8b8('0x5')](0x232a,_0xe8b8('0x83'),function(){console[_0xe8b8('0x84')](_0xe8b8('0x85'),0x232a);return _0x1c0548(_0xe8b8('0x86')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 7a2c8d6..b5ceab6 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 _0x55ca=['phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','scheduledAt','updatedAt','resolve','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','lodash','bluebird','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','exec','data1','data2','data5','xmd-contactid','ListId','data3','split'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x55ca,0x126));var _0xa55c=function(_0x3d8776,_0x5305dc){_0x3d8776=_0x3d8776-0x0;var _0x51d331=_0x55ca[_0x3d8776];return _0x51d331;};'use strict';var _=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xa55c('0x2'))(_0xa55c('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xa55c('0x4')]=_[_0xa55c('0x5')](config[_0xa55c('0x4')],{'host':_0xa55c('0x6'),'port':0x18eb});var io=require(_0xa55c('0x7'))(new Redis(config[_0xa55c('0x4')]));function emit(_0x36b623,_0x4d0624,_0x2121fd,_0x2537f0,_0x57e069){logger[_0xa55c('0x8')](_0xa55c('0x9'),_0x36b623,_0x4d0624['id'],_0x2121fd,_0x2537f0,JSON['stringify'](_0x57e069));io['to'](_0x2121fd)['emit'](_0x2537f0,_0x57e069);}exports[_0xa55c('0xa')]=function(_0x20c76a,_0x381d07,_0x5d8e5a,_0x31646d){var _0xe6d826,_0x508342;var _0x70c2de={};var _0x3998f7=Number(_0x5d8e5a[_0xa55c('0xb')]);var _0x5d47ff=_0x5d8e5a['data2']?Boolean(Number(_0x5d8e5a[_0xa55c('0xc')])):![];var _0x576044;var _0x5a3672=![];if(!_['isNil'](_0x5d8e5a[_0xa55c('0xd')])){if(_0x5d8e5a[_0xa55c('0xd')]=='1')_0x5a3672=!![];}if(!_0x5a3672){if(_0x31646d[_0xa55c('0xe')]){_0x70c2de['id']=_0x31646d[_0xa55c('0xe')];}}if(!_0x70c2de['id']){_0x70c2de[_0xa55c('0xf')]=_0x3998f7;_0x576044=_0x5d8e5a[_0xa55c('0x10')]&&_0x5d8e5a['data3']!=='0'?_0x5d8e5a[_0xa55c('0x10')][_0xa55c('0x11')](','):[_0xa55c('0x12')];_0x70c2de[_0xa55c('0x13')]=_[_0xa55c('0x14')](_0x576044,function(_0x3ae86b){var _0x51590e={};_0x51590e[_0x3ae86b]=_0x31646d[_0xa55c('0x15')]?_0x31646d[_0xa55c('0x16')]:_0x31646d['calleridnum'];return _0x51590e;});}var _0x3d4c9e=['id',_0xa55c('0x17'),_0xa55c('0x18'),_0xa55c('0x12'),_0xa55c('0x19'),_0xa55c('0x1a'),'ListId','createdAt',_0xa55c('0x1b'),_0xa55c('0x1c')];var _0xade4c4=_['union'](_0x3d4c9e,_0x576044);BPromise[_0xa55c('0x1d')]()[_0xa55c('0x1e')](cmContactRpc['getContacts']({'attributes':_0xade4c4,'where':_0x70c2de}))[_0xa55c('0x1e')](function(_0x133096){_0x508342=_0x133096;if(!_[_0xa55c('0x1f')](_0x508342)){if(_0x508342[_0xa55c('0x20')]===0x1){_0xe6d826=_0x508342[0x0];logger[_0xa55c('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x31646d[_0xa55c('0x21')],_0x381d07['id'],_0xe6d826['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x31646d['uniqueid'],_0x381d07['id'],_[_0xa55c('0x14')](_0x508342,'id')['join'](','));}return;}else{logger[_0xa55c('0x8')](_0xa55c('0x22'),_0x31646d[_0xa55c('0x21')],_0x381d07['id']);var _0xf0e574={'ListId':_0x3998f7};var _0x2313a9=_0x5d8e5a[_0xa55c('0x23')]&&_0x5d8e5a[_0xa55c('0x23')]!=='0'?_0x5d8e5a[_0xa55c('0x23')]:_0xa55c('0x12');if(_0x5d47ff){logger[_0xa55c('0x8')](_0xa55c('0x24'),_0x31646d['uniqueid'],_0x381d07['id']);_0xf0e574[_0x2313a9]=_[_0xa55c('0x25')](_0x31646d[_0xa55c('0x15')])?_0x31646d[_0xa55c('0x26')]:_0x31646d[_0xa55c('0x16')];if(_['isNil'](_0x31646d[_0xa55c('0x15')])){_0xf0e574[_0xa55c('0x17')]=_0x31646d[_0xa55c('0x27')]&&_0x31646d[_0xa55c('0x27')]!==_0xa55c('0x28')?_0x31646d[_0xa55c('0x27')]:'Unknown';}else{_0xf0e574[_0xa55c('0x17')]=_0x31646d['destcalleridname']&&_0x31646d[_0xa55c('0x29')]!==_0xa55c('0x28')?_0x31646d[_0xa55c('0x29')]:_0xa55c('0x2a');}return BPromise['resolve']()[_0xa55c('0x1e')](cmContactRpc[_0xa55c('0x2b')](_0xf0e574))[_0xa55c('0x1e')](function(_0x20da31){_0xe6d826=_0x20da31;_0x508342[_0xa55c('0x2c')](_0x20da31);if(_0xe6d826){logger[_0xa55c('0x8')](_0xa55c('0x2d'),_0x31646d[_0xa55c('0x21')],_0x381d07['id'],_0xe6d826['id']);}return;});}else{logger[_0xa55c('0x8')](_0xa55c('0x2e'),_0x31646d[_0xa55c('0x21')],_0x381d07['id']);_0xf0e574[_0x2313a9]=_['isNil'](_0x31646d['routeId'])?_0x31646d[_0xa55c('0x26')]:_0x31646d[_0xa55c('0x16')];if(_['isNil'](_0x31646d[_0xa55c('0x15')])){_0xf0e574[_0xa55c('0x17')]=_0x31646d[_0xa55c('0x27')]&&_0x31646d[_0xa55c('0x27')]!==_0xa55c('0x28')?_0x31646d[_0xa55c('0x27')]:_0xa55c('0x2a');}else{_0xf0e574[_0xa55c('0x17')]=_0x31646d[_0xa55c('0x29')]&&_0x31646d['destcalleridname']!==''?_0x31646d['destcalleridname']:_0xa55c('0x2a');}_0xe6d826=_0xf0e574;_0x508342[_0xa55c('0x2c')](_0xf0e574);return;}}})[_0xa55c('0x1e')](function(){if(_0x20c76a){emit(_0x31646d['uniqueid'],_0x381d07,util[_0xa55c('0x2f')]('user:%s',_0x20c76a[_0xa55c('0x30')]),util['format'](_0xa55c('0x31'),_0x5d8e5a[_0xa55c('0x32')][_0xa55c('0x33')]()),{'evt':_['merge'](_0x31646d,{'autoCreate':_0x5d47ff}),'contact':_0xe6d826===undefined?{}:_0xe6d826,'contacts':_0x508342[_0xa55c('0x20')]===0x0?undefined:_0x508342});}});}; \ No newline at end of file +var _0x008c=['defaults','localhost','socket.io-emitter','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','firstName','scheduledAt','getContacts','then','isEmpty','length','info','uniqueid','join','data4','routeId','calleridnum','destcalleridnum','calleridname','Unknown','','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis'];(function(_0x2cd41f,_0x480e6b){var _0x1c4786=function(_0x441a5e){while(--_0x441a5e){_0x2cd41f['push'](_0x2cd41f['shift']());}};_0x1c4786(++_0x480e6b);}(_0x008c,0x188));var _0xc008=function(_0x53577d,_0x4c7f85){_0x53577d=_0x53577d-0x0;var _0x381c01=_0x008c[_0x53577d];return _0x381c01;};'use strict';var _=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var Redis=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var config=require(_0xc008('0x4'));var logger=require('../../../../config/logger')(_0xc008('0x5'));var cmContactRpc=require(_0xc008('0x6'));config[_0xc008('0x7')]=_[_0xc008('0x8')](config[_0xc008('0x7')],{'host':_0xc008('0x9'),'port':0x18eb});var io=require(_0xc008('0xa'))(new Redis(config[_0xc008('0x7')]));function emit(_0x9c8cb2,_0x4af530,_0x428fa9,_0x5aa09b,_0x30be38){logger['info']('[CM][%s][%s]',_0x9c8cb2,_0x4af530['id'],_0x428fa9,_0x5aa09b,JSON[_0xc008('0xb')](_0x30be38));io['to'](_0x428fa9)[_0xc008('0xc')](_0x5aa09b,_0x30be38);}exports['exec']=function(_0x51ba7d,_0x543eb8,_0x1eacfa,_0xc881aa){var _0x5b2004,_0xae2dab;var _0x332fd4={};var _0x2ea200=Number(_0x1eacfa[_0xc008('0xd')]);var _0x9ffa93=_0x1eacfa[_0xc008('0xe')]?Boolean(Number(_0x1eacfa[_0xc008('0xe')])):![];var _0x593f7a;var _0x560e28=![];if(!_[_0xc008('0xf')](_0x1eacfa['data5'])){if(_0x1eacfa[_0xc008('0x10')]=='1')_0x560e28=!![];}if(!_0x560e28){if(_0xc881aa[_0xc008('0x11')]){_0x332fd4['id']=_0xc881aa[_0xc008('0x11')];}}if(!_0x332fd4['id']){_0x332fd4[_0xc008('0x12')]=_0x2ea200;_0x593f7a=_0x1eacfa[_0xc008('0x13')]&&_0x1eacfa['data3']!=='0'?_0x1eacfa['data3']['split'](','):[_0xc008('0x14')];_0x332fd4[_0xc008('0x15')]=_[_0xc008('0x16')](_0x593f7a,function(_0x3eb12a){var _0x4fe771={};_0x4fe771[_0x3eb12a]=_0xc881aa['routeId']?_0xc881aa['destcalleridnum']:_0xc881aa['calleridnum'];return _0x4fe771;});}var _0x46042b=['id',_0xc008('0x17'),'lastName',_0xc008('0x14'),'mobile','fax','ListId','createdAt',_0xc008('0x18'),'updatedAt'];var _0x5560b1=_['union'](_0x46042b,_0x593f7a);BPromise['resolve']()['then'](cmContactRpc[_0xc008('0x19')]({'attributes':_0x5560b1,'where':_0x332fd4}))[_0xc008('0x1a')](function(_0x251db2){_0xae2dab=_0x251db2;if(!_[_0xc008('0x1b')](_0xae2dab)){if(_0xae2dab[_0xc008('0x1c')]===0x1){_0x5b2004=_0xae2dab[0x0];logger[_0xc008('0x1d')]('[CM][%s][%s]\x20Contact\x20found:%s',_0xc881aa[_0xc008('0x1e')],_0x543eb8['id'],_0x5b2004['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xc881aa[_0xc008('0x1e')],_0x543eb8['id'],_[_0xc008('0x16')](_0xae2dab,'id')[_0xc008('0x1f')](','));}return;}else{logger[_0xc008('0x1d')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xc881aa['uniqueid'],_0x543eb8['id']);var _0x5de1e9={'ListId':_0x2ea200};var _0x3f7b07=_0x1eacfa[_0xc008('0x20')]&&_0x1eacfa[_0xc008('0x20')]!=='0'?_0x1eacfa[_0xc008('0x20')]:'phone';if(_0x9ffa93){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0xc881aa['uniqueid'],_0x543eb8['id']);_0x5de1e9[_0x3f7b07]=_['isNil'](_0xc881aa[_0xc008('0x21')])?_0xc881aa[_0xc008('0x22')]:_0xc881aa[_0xc008('0x23')];if(_['isNil'](_0xc881aa[_0xc008('0x21')])){_0x5de1e9[_0xc008('0x17')]=_0xc881aa[_0xc008('0x24')]&&_0xc881aa[_0xc008('0x24')]!==''?_0xc881aa[_0xc008('0x24')]:_0xc008('0x25');}else{_0x5de1e9['firstName']=_0xc881aa['destcalleridname']&&_0xc881aa['destcalleridname']!==_0xc008('0x26')?_0xc881aa[_0xc008('0x27')]:_0xc008('0x25');}return BPromise[_0xc008('0x28')]()[_0xc008('0x1a')](cmContactRpc[_0xc008('0x29')](_0x5de1e9))[_0xc008('0x1a')](function(_0x22d8e8){_0x5b2004=_0x22d8e8;_0xae2dab[_0xc008('0x2a')](_0x22d8e8);if(_0x5b2004){logger[_0xc008('0x1d')](_0xc008('0x2b'),_0xc881aa[_0xc008('0x1e')],_0x543eb8['id'],_0x5b2004['id']);}return;});}else{logger['info'](_0xc008('0x2c'),_0xc881aa[_0xc008('0x1e')],_0x543eb8['id']);_0x5de1e9[_0x3f7b07]=_['isNil'](_0xc881aa[_0xc008('0x21')])?_0xc881aa[_0xc008('0x22')]:_0xc881aa[_0xc008('0x23')];if(_[_0xc008('0xf')](_0xc881aa[_0xc008('0x21')])){_0x5de1e9[_0xc008('0x17')]=_0xc881aa[_0xc008('0x24')]&&_0xc881aa[_0xc008('0x24')]!==_0xc008('0x26')?_0xc881aa['calleridname']:_0xc008('0x25');}else{_0x5de1e9[_0xc008('0x17')]=_0xc881aa[_0xc008('0x27')]&&_0xc881aa[_0xc008('0x27')]!==_0xc008('0x26')?_0xc881aa[_0xc008('0x27')]:_0xc008('0x25');}_0x5b2004=_0x5de1e9;_0xae2dab['push'](_0x5de1e9);return;}}})[_0xc008('0x1a')](function(){if(_0x51ba7d){emit(_0xc881aa[_0xc008('0x1e')],_0x543eb8,util['format'](_0xc008('0x2d'),_0x51ba7d[_0xc008('0x2e')]),util['format'](_0xc008('0x2f'),_0x1eacfa[_0xc008('0x30')][_0xc008('0x31')]()),{'evt':_['merge'](_0xc881aa,{'autoCreate':_0x9ffa93}),'contact':_0x5b2004===undefined?{}:_0x5b2004,'contacts':_0xae2dab['length']===0x0?undefined:_0xae2dab});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 62da720..c96d20f 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 _0x2384=['length','action','toLowerCase','contactmanager','motionbar','data1','data2','html','render','uri','buildUri','data3','uriLocation','data4','windowWidth','isNil','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','interface','name','trigger:%s:%s','jscripty','trigger:%s','integration','exec','queue','routeId','urlforward','query','search','checkTrigger','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','mailSubstatus','substatus','created','equals','util','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','accounts','dynamics365Accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','checkTriggers','hasOwnProperty','merge','variables','Actions'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2384,0x1aa));var _0x4238=function(_0x3a7547,_0x4fbb60){_0x3a7547=_0x3a7547-0x0;var _0x45fc04=_0x2384[_0x3a7547];return _0x45fc04;};'use strict';var util=require(_0x4238('0x0'));var _=require('lodash');var url=require(_0x4238('0x1'));var Mustache=require(_0x4238('0x2'));var Redis=require(_0x4238('0x3'));var urlforward=require(_0x4238('0x4'));var integration=require(_0x4238('0x5'));var cmContact=require('./cmContact');var script=require(_0x4238('0x6'));var config=require('../../../config/environment');var logger=require(_0x4238('0x7'))(_0x4238('0x8'));var ami=require(_0x4238('0x9'));config[_0x4238('0xa')]=_[_0x4238('0xb')](config[_0x4238('0xa')],{'host':_0x4238('0xc'),'port':0x18eb});var io=require(_0x4238('0xd'))(new Redis(config[_0x4238('0xa')]));var operators={'equals':function(_0x5ccd90,_0x460199){return _0x5ccd90==_0x460199;},'not_equals':function(_0xf06385,_0x4c308c){return _0xf06385!=_0x4c308c;}};var barAndWebActions=[_0x4238('0xe'),'url','winapp'];function Trigger(_0xbb61d0){this[_0x4238('0xf')]=_0xbb61d0[_0x4238('0xf')];this[_0x4238('0x10')]=_0xbb61d0[_0x4238('0x10')];this[_0x4238('0x11')]=_0xbb61d0[_0x4238('0x11')];this[_0x4238('0x12')]=_0xbb61d0[_0x4238('0x12')];this[_0x4238('0x13')]=_0xbb61d0[_0x4238('0x13')];this[_0x4238('0x14')]=_0xbb61d0[_0x4238('0x14')];this[_0x4238('0x15')]=_0xbb61d0[_0x4238('0x15')];this[_0x4238('0x16')]=_0xbb61d0['salesforceAccounts'];this[_0x4238('0x17')]=_0xbb61d0[_0x4238('0x17')];this['zohoAccounts']=_0xbb61d0[_0x4238('0x18')];this[_0x4238('0x19')]=_0xbb61d0[_0x4238('0x19')];this['vtigerAccounts']=_0xbb61d0[_0x4238('0x1a')];this[_0x4238('0x1b')]=_0xbb61d0[_0x4238('0x1b')];this['dynamics365Accounts']=_0xbb61d0['dynamics365Accounts'];this[_0x4238('0x1c')]=_0xbb61d0['freshsalesAccounts'];this[_0x4238('0x1d')]={'zendesk':this[_0x4238('0x14')],'salesforce':this[_0x4238('0x16')],'freshdesk':this[_0x4238('0x15')],'sugarcrm':this[_0x4238('0x17')],'zoho':this[_0x4238('0x18')],'desk':this[_0x4238('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x4238('0x1e')],'freshsales':this[_0x4238('0x1c')],'servicenow':this[_0x4238('0x1b')]};ami['on'](_0x4238('0x1f'),this['syncCustomEvent'][_0x4238('0x20')](this));ami['on'](_0x4238('0x21'),this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on']('custom:agentringnoanswer',this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on'](_0x4238('0x23'),this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on']('custom:agentnosuchnumber',this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on']('custom:agentnoanswer',this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on'](_0x4238('0x24'),this['syncCustomEvent'][_0x4238('0x20')](this));ami['on']('custom:agentcongestion',this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on'](_0x4238('0x25'),this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on'](_0x4238('0x26'),this['syncCustomEvent'][_0x4238('0x20')](this));ami['on'](_0x4238('0x27'),this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on'](_0x4238('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4238('0x29'),this[_0x4238('0x2a')][_0x4238('0x20')](this));ami['on']('custom:dialconnect',this[_0x4238('0x2a')]['bind'](this));ami['on'](_0x4238('0x2b'),this[_0x4238('0x2a')]['bind'](this));ami['on'](_0x4238('0x2c'),this[_0x4238('0x22')]['bind'](this));ami['on'](_0x4238('0x2d'),this['syncCustomEvent'][_0x4238('0x20')](this));ami['on'](_0x4238('0x2e'),this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on']('custom:outgoingmessage',this[_0x4238('0x22')]['bind'](this));ami['on'](_0x4238('0x2f'),this[_0x4238('0x22')]['bind'](this));ami['on'](_0x4238('0x30'),this[_0x4238('0x22')][_0x4238('0x20')](this));ami['on'](_0x4238('0x31'),this[_0x4238('0x22')][_0x4238('0x20')](this));}Trigger[_0x4238('0x32')][_0x4238('0x33')]=function(_0x559ca3,_0x384f63,_0x14c6f4){logger[_0x4238('0x34')](_0x559ca3,_0x384f63,JSON[_0x4238('0x35')](_0x14c6f4));io['to'](_0x559ca3)[_0x4238('0x33')](_0x384f63,_0x14c6f4);};Trigger[_0x4238('0x32')][_0x4238('0x22')]=function(_0x2bdece){var _0x57aff5=_[_0x4238('0x36')](_0x2bdece);if(typeof _0x57aff5[_0x4238('0x37')]===_0x4238('0x38')){_0x57aff5[_0x4238('0x37')]='voice';}this[_0x4238('0x39')](_0x57aff5);};Trigger[_0x4238('0x32')][_0x4238('0x2a')]=function(_0x2a7147){if(this[_0x4238('0x10')][_0x2a7147['interface']]){this[_0x4238('0x22')](_0x2a7147);}};Trigger[_0x4238('0x32')][_0x4238('0x39')]=function(_0x38555a){var _0x5106c2;for(var _0x3bad57 in this[_0x4238('0xf')]){if(this['triggers'][_0x4238('0x3a')](_0x3bad57)){if(this['triggers'][_0x3bad57]['status']){_0x5106c2=this['checkTrigger'](this[_0x4238('0xf')][_0x3bad57],_0x38555a);if(_0x5106c2){_[_0x4238('0x3b')](_0x38555a,_0x38555a[_0x4238('0x3c')]);for(var _0x3af6d9=0x0,_0x2de073,_0x59eba6,_0x36d730;_0x3af6d90x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x326f,0xd1));var _0xf326=function(_0x52b094,_0x38111f){_0x52b094=_0x52b094-0x0;var _0x22b101=_0x326f[_0x52b094];return _0x22b101;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index bfde687..fd4d561 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 _0x7e4d=['contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','POST','incidents','getString','Subjects','Descriptions','/contacts(','userId','Fields','queue','callDirection','phonecalls','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data5','clientId','password','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','username','internalemailaddress','then','toLowerCase','outbound','destcalleridnum','calleridnum'];(function(_0x161885,_0x383938){var _0x45107c=function(_0x34ffe0){while(--_0x34ffe0){_0x161885['push'](_0x161885['shift']());}};_0x45107c(++_0x383938);}(_0x7e4d,0xab));var _0xd7e4=function(_0x205313,_0x1172a7){_0x205313=_0x205313-0x0;var _0xfb032=_0x7e4d[_0x205313];return _0xfb032;};'use strict';var _=require(_0xd7e4('0x0'));var rp=require(_0xd7e4('0x1'));var util=require('util');var intUtil=require(_0xd7e4('0x2'));var md5=require(_0xd7e4('0x3'));var Redis=require(_0xd7e4('0x4'));var logger=require(_0xd7e4('0x5'))(_0xd7e4('0x6'));var config=require('../../../../config/environment');config[_0xd7e4('0x7')]=_[_0xd7e4('0x8')](config[_0xd7e4('0x7')],{'host':_0xd7e4('0x9'),'port':0x18eb});var io=require(_0xd7e4('0xa'))(new Redis(config[_0xd7e4('0x7')]));function getAuthToken(_0x10a26b,_0x1a0d07,_0x178c0d){if(_0x10a26b[_0xd7e4('0xb')]){_0x10a26b[_0xd7e4('0xc')]=_0x10a26b[_0xd7e4('0xd')]['data7'];_0x10a26b[_0xd7e4('0xe')]=_0x10a26b['CloudProvider']['data2'];return Promise['resolve'](_0x10a26b['CloudProvider'][_0xd7e4('0xf')]);}var _0xd47cb1={'method':'POST','uri':_0x1a0d07,'form':{'client_id':_0x10a26b[_0xd7e4('0x10')],'resource':_0x10a26b['remoteUri'],'username':_0x10a26b['username'],'password':_0x10a26b[_0xd7e4('0x11')],'grant_type':_0xd7e4('0x11'),'client_secret':_0x10a26b['clientSecret']},'json':!![]};return rp(_0xd47cb1)['then'](function(_0x4d4949){return _0x4d4949[_0xd7e4('0x12')];})[_0xd7e4('0x13')](function(_0x3eec2d){logger[_0xd7e4('0x14')]('['+[_0x178c0d[_0xd7e4('0x15')]()]+_0xd7e4('0x16'));return _0x3eec2d[_0xd7e4('0x17')];});}function getUser(_0x52d958,_0x3e6819,_0x193449,_0x30558d,_0x20f7c2,_0x2e991c){return new Promise(function(_0x47b475,_0x1fc8e9){return getAuthToken(_0x3e6819,_0x30558d,_0x2e991c)['then'](function(_0x11b69e){var _0x521ea0={'method':_0xd7e4('0x18'),'uri':_0x20f7c2+_0xd7e4('0x19'),'headers':{'Authorization':_0xd7e4('0x1a')+_0x11b69e,'OData-Version':_0xd7e4('0x1b')},'json':!![]};return rp(_0x521ea0);})['then'](function(_0x4c2e80){var _0x223d7b=_0x4c2e80[_0xd7e4('0x1c')];var _0x21c664=![];var _0x18b91a=null;if(!_[_0xd7e4('0x1d')](_0x193449)){if(intUtil[_0xd7e4('0x1e')](_0x193449[_0xd7e4('0x1f')])){_0x52d958[_0xd7e4('0x20')]=_0x193449[_0xd7e4('0x1f')];for(_0x18b91a=0x0;_0x18b91a<_0x223d7b[_0xd7e4('0x21')];_0x18b91a++){if(_0x223d7b[_0x18b91a]['internalemailaddress']===_0x193449[_0xd7e4('0x1f')]&&!_0x223d7b[_0x18b91a][_0xd7e4('0x22')]){_0x21c664=!![];logger['info']('['+[_0x2e991c[_0xd7e4('0x15')]()]+_0xd7e4('0x23')+_0x223d7b[_0x18b91a][_0xd7e4('0x24')]+'!');_0x52d958['userId']=_0x223d7b[_0x18b91a][_0xd7e4('0x24')];}}}}if(!_0x21c664){logger[_0xd7e4('0x25')]('['+[_0x2e991c[_0xd7e4('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x52d958[_0xd7e4('0x20')]=_0x3e6819[_0xd7e4('0x26')];for(_0x18b91a=0x0;_0x18b91a<_0x223d7b[_0xd7e4('0x21')];_0x18b91a++){if(_0x223d7b[_0x18b91a][_0xd7e4('0x27')]===_0x3e6819[_0xd7e4('0x26')]){_0x52d958['userId']=_0x223d7b[_0x18b91a][_0xd7e4('0x24')];}}}_0x47b475(_0x52d958);})[_0xd7e4('0x13')](function(_0x495973){_0x1fc8e9(_0x495973[_0xd7e4('0x17')]);});});}function createEndUser(_0x57a8a4,_0x51a57d,_0x9751fe,_0x4ff7c9,_0x26df04,_0x116681){return new Promise(function(_0x404c67,_0x2a39cc){return getAuthToken(_0x51a57d,_0x9751fe,_0x116681)[_0xd7e4('0x28')](function(_0x20d7ff){var _0x2dffef=_0x116681[_0xd7e4('0x29')]()===_0xd7e4('0x2a')?_0x26df04[_0xd7e4('0x2b')]:_0x26df04[_0xd7e4('0x2c')];var _0x38139a={'method':'POST','uri':_0x4ff7c9+_0xd7e4('0x2d'),'body':{'telephone1':_0x2dffef,'fullname':_0x2dffef,'firstname':_0x2dffef,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd7e4('0x2e')+_0x57a8a4['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x20d7ff,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x38139a);})[_0xd7e4('0x28')](function(_0x51d8e1){var _0x1871b4=_0x51d8e1[_0xd7e4('0x2f')][_0xd7e4('0x30')];var _0x1617d2=_0x1871b4[_0xd7e4('0x31')](_0x1871b4[_0xd7e4('0x32')]('(')+0x1,_0x1871b4['lastIndexOf'](')'));_0x57a8a4[_0xd7e4('0x33')]=_0x1617d2;_0x404c67(_0x57a8a4);})[_0xd7e4('0x13')](function(_0x581645){_0x2a39cc(_0x581645[_0xd7e4('0x17')]);});});}function getEndUser(_0x2b6be0,_0xcd5c89,_0x462b6c,_0x477907,_0x12d64a,_0x4ab802,_0x988565){var _0x3f7625=_0x4ab802[_0xd7e4('0x29')]()===_0xd7e4('0x2a')?_0x12d64a['destcalleridnum']:_0x12d64a[_0xd7e4('0x2c')];return getAuthToken(_0xcd5c89,_0x462b6c,_0x4ab802)[_0xd7e4('0x28')](function(_0x518e51){var _0x3f2b85={'method':_0xd7e4('0x18'),'uri':_0x477907+_0xd7e4('0x34')+_0x3f7625[_0xd7e4('0x35')]('+',_0xd7e4('0x36'))+'\x27','headers':{'Authorization':_0xd7e4('0x1a')+_0x518e51,'If-None-Match':null,'OData-Version':_0xd7e4('0x1b')},'json':!![]};return rp(_0x3f2b85);})[_0xd7e4('0x28')](function(_0x2a6c1e){var _0x2674b3=![];if(!_0x2a6c1e)return _0x2674b3;var _0x386cd7=_0x2a6c1e[_0xd7e4('0x1c')];for(var _0x32a69f=0x0;_0x32a69f<_0x386cd7[_0xd7e4('0x21')];_0x32a69f++){if(_0x386cd7[_0x32a69f][_0xd7e4('0x37')]===_0x3f7625){_0x2674b3=!![];_0x2b6be0['enduserId']=_0x386cd7[_0x32a69f][_0xd7e4('0x38')];}}return _0x2674b3;})[_0xd7e4('0x28')](function(_0x19635d){if(_0x19635d)return _0x2b6be0;if(_0x988565==='nothing'){logger[_0xd7e4('0x25')]('['+[_0x4ab802['toUpperCase']()]+_0xd7e4('0x39'));return _0x2b6be0;}return createEndUser(_0x2b6be0,_0xcd5c89,_0x462b6c,_0x477907,_0x12d64a,_0x4ab802)[_0xd7e4('0x28')](function(_0x5c439a){logger[_0xd7e4('0x25')]('['+[_0x4ab802[_0xd7e4('0x15')]()]+']\x20Enduser\x20created!',_0x5c439a[_0xd7e4('0x33')]);return _0x5c439a;});});}function getCustomFields(_0x50b6af,_0x5b0f89,_0x4bd190){var _0x2c1e81={};if(_0x50b6af['length']>0x0){_[_0xd7e4('0x3a')](_0x50b6af,function(_0x191d64){if(_[_0xd7e4('0x3b')](['string',_0xd7e4('0x3c')],_0x191d64[_0xd7e4('0x3d')])&&_0x191d64[_0xd7e4('0x3e')]&&!_0x191d64[_0xd7e4('0x3f')]){var _0x3c8da0=_0x191d64[_0xd7e4('0x40')][_0xd7e4('0x29')]();var _0x1dbd94=_0x3c8da0[_0xd7e4('0x31')](0x0,_0x3c8da0[_0xd7e4('0x41')]('_'));var _0x57be67=_0x3c8da0[_0xd7e4('0x31')](_0x3c8da0[_0xd7e4('0x41')]('_')+0x1);if(_0x1dbd94===_0x4bd190){_0x2c1e81[_0x57be67]=_0x191d64[_0xd7e4('0x42')];}}});}return _0x2c1e81;}function getTicket(_0x595727,_0x3a0b15,_0x5e8d81,_0x3b1487,_0x493ab1,_0x524c33,_0xc67f63){return new Promise(function(_0xeb08b6,_0x3f4369){var _0x143ea3;return getAuthToken(_0x3a0b15,_0x5e8d81,_0xc67f63)['then'](function(_0x1a0328){if(_0x524c33[_0xd7e4('0x43')]===_0xd7e4('0x44')){_0x143ea3={'method':_0xd7e4('0x45'),'uri':_0x3b1487+_0xd7e4('0x46'),'body':Object['assign']({},{'title':intUtil[_0xd7e4('0x47')](_0x524c33[_0xd7e4('0x48')],_0x493ab1,'\x20'),'description':intUtil[_0xd7e4('0x47')](_0x524c33[_0xd7e4('0x49')],_0x493ab1,'\x0a'),'customerid_contact@odata.bind':_0x595727['enduserId']?_0xd7e4('0x4a')+_0x595727['enduserId']+')':undefined,'ownerid@odata.bind':_0xd7e4('0x2e')+_0x595727[_0xd7e4('0x4b')]+')','caseorigincode':'1'},getCustomFields(_0x524c33[_0xd7e4('0x4c')],_0x493ab1,_0x524c33[_0xd7e4('0x43')])),'headers':{'Authorization':_0xd7e4('0x1a')+_0x1a0328,'OData-Version':_0xd7e4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x524c33[_0xd7e4('0x43')]==='phonecall'){var _0x59fb56=_0x595727[_0xd7e4('0x33')]?[{'partyid_systemuser@odata.bind':_0xd7e4('0x2e')+_0x595727[_0xd7e4('0x4b')]+')','participationtypemask':_0x595727['callDirection']===_0xd7e4('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0xd7e4('0x4a')+_0x595727['enduserId']+')','participationtypemask':_0x595727[_0xd7e4('0x4e')]===_0xd7e4('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd7e4('0x2e')+_0x595727[_0xd7e4('0x4b')]+')','participationtypemask':_0x595727[_0xd7e4('0x4e')]==='queue'?0x2:0x1}];_0x143ea3={'method':'POST','uri':_0x3b1487+_0xd7e4('0x4f'),'body':Object[_0xd7e4('0x50')]({},{'subject':intUtil[_0xd7e4('0x47')](_0x524c33['Subjects'],_0x493ab1,'\x20'),'phonenumber':String(_0x493ab1[_0xd7e4('0x2c')]),'description':intUtil['getString'](_0x524c33[_0xd7e4('0x49')],_0x493ab1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x595727['enduserId']?_0xd7e4('0x4a')+_0x595727['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x595727[_0xd7e4('0x4b')]+')','directioncode':_0x595727['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x59fb56},getCustomFields(_0x524c33[_0xd7e4('0x4c')],_0x493ab1,_0x524c33[_0xd7e4('0x43')])),'headers':{'Authorization':_0xd7e4('0x1a')+_0x1a0328,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x143ea3);})[_0xd7e4('0x28')](function(_0x425d72){var _0x30c753=_0x425d72[_0xd7e4('0x2f')][_0xd7e4('0x30')];var _0x1288b4=_0x30c753[_0xd7e4('0x31')](_0x30c753[_0xd7e4('0x32')]('(')+0x1,_0x30c753[_0xd7e4('0x32')](')'));_0x595727[_0xd7e4('0x51')]=_0x1288b4;_0xeb08b6(_0x595727);})[_0xd7e4('0x13')](function(_0x17f629){_0x3f4369(_0x17f629['message']);});});}function emit(_0xe49bc8,_0x501aae,_0x514734,_0xc495f8){var _0x77eb8b={'uri':util['format'](_0xd7e4('0x52'),_0xe49bc8,_0x514734,_0xc495f8)};io['to'](util[_0xd7e4('0x53')](_0xd7e4('0x54'),_0x501aae))['emit'](_0xd7e4('0x55'),_0x77eb8b);}exports['cs']=function(_0x4e5b1a,_0x471e43,_0x39195f,_0x47c187,_0x14312e,_0x5444e7,_0x11c275,_0x7a04e1){var _0x136d20={};_0x5444e7['remoteUri']=_0x5444e7[_0xd7e4('0xb')]?intUtil[_0xd7e4('0x56')](_0x5444e7[_0xd7e4('0xd')][_0xd7e4('0x57')]):intUtil[_0xd7e4('0x56')](_0x5444e7[_0xd7e4('0xc')]);_0x5444e7[_0xd7e4('0x58')]=intUtil[_0xd7e4('0x56')](_0x5444e7['serverUrl']);_0x136d20['callDirection']=_0x7a04e1===_0xd7e4('0x4d')||_0x7a04e1==='unmanaged'?_0xd7e4('0x4d'):_0xd7e4('0x2a');var _0x36300f=_0x5444e7[_0xd7e4('0xb')]?util['format'](_0xd7e4('0x59'),_0x5444e7[_0xd7e4('0xd')][_0xd7e4('0x57')]):util[_0xd7e4('0x53')](_0xd7e4('0x59'),_0x5444e7['remoteUri']);var _0xdf83e9=util[_0xd7e4('0x53')](_0xd7e4('0x5a'),_0x5444e7['tenantId']);var _0x536f0a=util[_0xd7e4('0x53')](_0xd7e4('0x5b'),_0x5444e7['serverUrl'],_0x471e43[_0xd7e4('0x5c')],md5(_0x471e43[_0xd7e4('0x5c')]));if(_0x14312e&&_0x14312e['monitor_format']){logger[_0xd7e4('0x25')](_0xd7e4('0x5d'),'Recording\x20is\x20enabled!');_0x471e43[_0xd7e4('0x5e')]=_0x536f0a;}else if(_0x11c275&&_0x11c275['recordingFormat']&&_0x11c275[_0xd7e4('0x5f')]!==_0xd7e4('0x60')){logger['info'](_0xd7e4('0x61'),_0xd7e4('0x62'));_0x471e43[_0xd7e4('0x5e')]=_0x536f0a;}else{_0x471e43[_0xd7e4('0x5e')]='';}return getUser(_0x136d20,_0x5444e7,_0x47c187,_0xdf83e9,_0x36300f,_0x7a04e1)[_0xd7e4('0x28')](function(_0x1cfbcf){logger[_0xd7e4('0x25')]('['+_0x7a04e1[_0xd7e4('0x15')]()+_0xd7e4('0x63'),_0x1cfbcf['userId']);logger[_0xd7e4('0x25')]('['+_0x7a04e1[_0xd7e4('0x15')]()+']\x20The\x20User\x20email\x20is:',_0x1cfbcf[_0xd7e4('0x20')]);return getEndUser(_0x1cfbcf,_0x5444e7,_0xdf83e9,_0x36300f,_0x471e43,_0x7a04e1,_0x39195f[_0xd7e4('0x64')]);})[_0xd7e4('0x28')](function(_0x419697){logger[_0xd7e4('0x25')]('['+_0x7a04e1[_0xd7e4('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x419697[_0xd7e4('0x33')]);logger['info']('['+_0x7a04e1[_0xd7e4('0x15')]()+_0xd7e4('0x65'),_0x471e43[_0xd7e4('0x2c')]);return getTicket(_0x419697,_0x5444e7,_0xdf83e9,_0x36300f,_0x471e43,_0x39195f,_0x7a04e1);})[_0xd7e4('0x28')](function(_0x29b7b1){logger[_0xd7e4('0x25')](util[_0xd7e4('0x53')]('['+_0x7a04e1[_0xd7e4('0x15')]()+_0xd7e4('0x66'),_0x39195f[_0xd7e4('0x43')],_0x29b7b1[_0xd7e4('0x51')]));logger['info'](util[_0xd7e4('0x53')]('['+_0x7a04e1[_0xd7e4('0x15')]()+_0xd7e4('0x67'),_0x7a04e1));if(_0x7a04e1!==_0xd7e4('0x68')){logger[_0xd7e4('0x25')]('['+_0x7a04e1[_0xd7e4('0x15')]()+']',_0xd7e4('0x69'));emit(_0x5444e7[_0xd7e4('0xc')],_0x47c187[_0xd7e4('0x6a')],_0x39195f[_0xd7e4('0x43')],_0x29b7b1[_0xd7e4('0x51')]);}})['catch'](function(_0x36d212){logger[_0xd7e4('0x14')]('['+_0x7a04e1['toUpperCase']()+_0xd7e4('0x6b'),_0x36d212[_0xd7e4('0x17')]);});}; \ No newline at end of file +var _0xe2b3=['tenantId','resolve','data5','clientId','username','password','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','userEmail','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','internalemailaddress','outbound','destcalleridnum','calleridnum','POST','/systemusers(','headers','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','Bearer\x20','length','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','Fields','queue','callDirection','/contacts(','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','remoteUri','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','CloudProvider','data7'];(function(_0x210f57,_0x1a3df0){var _0x59e0a9=function(_0x2943c7){while(--_0x2943c7){_0x210f57['push'](_0x210f57['shift']());}};_0x59e0a9(++_0x1a3df0);}(_0xe2b3,0x1ee));var _0x3e2b=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0xe2b3[_0x2ff1f6];return _0xbae96d;};'use strict';var _=require(_0x3e2b('0x0'));var rp=require(_0x3e2b('0x1'));var util=require('util');var intUtil=require(_0x3e2b('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x3e2b('0x3'))('dynamics365');var config=require(_0x3e2b('0x4'));config[_0x3e2b('0x5')]=_[_0x3e2b('0x6')](config[_0x3e2b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3e2b('0x7'))(new Redis(config[_0x3e2b('0x5')]));function getAuthToken(_0x1fb381,_0xbd90b6,_0x5728f5){if(_0x1fb381[_0x3e2b('0x8')]){_0x1fb381['remoteUri']=_0x1fb381[_0x3e2b('0x9')][_0x3e2b('0xa')];_0x1fb381[_0x3e2b('0xb')]=_0x1fb381[_0x3e2b('0x9')]['data2'];return Promise[_0x3e2b('0xc')](_0x1fb381[_0x3e2b('0x9')][_0x3e2b('0xd')]);}var _0x58a585={'method':'POST','uri':_0xbd90b6,'form':{'client_id':_0x1fb381[_0x3e2b('0xe')],'resource':_0x1fb381['remoteUri'],'username':_0x1fb381[_0x3e2b('0xf')],'password':_0x1fb381['password'],'grant_type':_0x3e2b('0x10'),'client_secret':_0x1fb381['clientSecret']},'json':!![]};return rp(_0x58a585)[_0x3e2b('0x11')](function(_0x5bcf06){return _0x5bcf06[_0x3e2b('0x12')];})[_0x3e2b('0x13')](function(_0x3a1262){logger['error']('['+[_0x5728f5[_0x3e2b('0x14')]()]+_0x3e2b('0x15'));return _0x3a1262[_0x3e2b('0x16')];});}function getUser(_0x3180e9,_0xd92fb2,_0x4b8719,_0xb19a2f,_0x3a7f78,_0x41b45c){return new Promise(function(_0x910d92,_0x13c336){return getAuthToken(_0xd92fb2,_0xb19a2f,_0x41b45c)[_0x3e2b('0x11')](function(_0x2adc9f){var _0x2e682b={'method':_0x3e2b('0x17'),'uri':_0x3a7f78+_0x3e2b('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x2adc9f,'OData-Version':_0x3e2b('0x19')},'json':!![]};return rp(_0x2e682b);})['then'](function(_0x32e786){var _0x1857bf=_0x32e786[_0x3e2b('0x1a')];var _0x299a38=![];var _0x43cdfc=null;if(!_[_0x3e2b('0x1b')](_0x4b8719)){if(intUtil['validateEmail'](_0x4b8719['email'])){_0x3180e9[_0x3e2b('0x1c')]=_0x4b8719[_0x3e2b('0x1d')];for(_0x43cdfc=0x0;_0x43cdfc<_0x1857bf['length'];_0x43cdfc++){if(_0x1857bf[_0x43cdfc]['internalemailaddress']===_0x4b8719[_0x3e2b('0x1d')]&&!_0x1857bf[_0x43cdfc][_0x3e2b('0x1e')]){_0x299a38=!![];logger['info']('['+[_0x41b45c['toUpperCase']()]+_0x3e2b('0x1f')+_0x1857bf[_0x43cdfc][_0x3e2b('0x20')]+'!');_0x3180e9[_0x3e2b('0x21')]=_0x1857bf[_0x43cdfc]['systemuserid'];}}}}if(!_0x299a38){logger[_0x3e2b('0x22')]('['+[_0x41b45c[_0x3e2b('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3180e9[_0x3e2b('0x1c')]=_0xd92fb2[_0x3e2b('0xf')];for(_0x43cdfc=0x0;_0x43cdfc<_0x1857bf['length'];_0x43cdfc++){if(_0x1857bf[_0x43cdfc][_0x3e2b('0x23')]===_0xd92fb2[_0x3e2b('0xf')]){_0x3180e9[_0x3e2b('0x21')]=_0x1857bf[_0x43cdfc][_0x3e2b('0x20')];}}}_0x910d92(_0x3180e9);})['catch'](function(_0x4d9dad){_0x13c336(_0x4d9dad[_0x3e2b('0x16')]);});});}function createEndUser(_0x34ae34,_0x186e3c,_0x439029,_0x548835,_0x52bb64,_0x2f49df){return new Promise(function(_0x1cd8fc,_0x5869bc){return getAuthToken(_0x186e3c,_0x439029,_0x2f49df)[_0x3e2b('0x11')](function(_0x31b157){var _0x5bc4f7=_0x2f49df['toLowerCase']()===_0x3e2b('0x24')?_0x52bb64[_0x3e2b('0x25')]:_0x52bb64[_0x3e2b('0x26')];var _0x475032={'method':_0x3e2b('0x27'),'uri':_0x548835+'contacts','body':{'telephone1':_0x5bc4f7,'fullname':_0x5bc4f7,'firstname':_0x5bc4f7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3e2b('0x28')+_0x34ae34['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x31b157,'OData-Version':_0x3e2b('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x475032);})[_0x3e2b('0x11')](function(_0x3a99bd){var _0x1d9009=_0x3a99bd[_0x3e2b('0x29')]['odata-entityid'];var _0x499704=_0x1d9009[_0x3e2b('0x2a')](_0x1d9009[_0x3e2b('0x2b')]('(')+0x1,_0x1d9009[_0x3e2b('0x2b')](')'));_0x34ae34[_0x3e2b('0x2c')]=_0x499704;_0x1cd8fc(_0x34ae34);})[_0x3e2b('0x13')](function(_0x2cadef){_0x5869bc(_0x2cadef['message']);});});}function getEndUser(_0xcf7646,_0x5b599e,_0x7c0859,_0x1897d5,_0x3bdab3,_0x768611,_0x2f778e){var _0x1d3ea3=_0x768611[_0x3e2b('0x2d')]()===_0x3e2b('0x24')?_0x3bdab3[_0x3e2b('0x25')]:_0x3bdab3[_0x3e2b('0x26')];return getAuthToken(_0x5b599e,_0x7c0859,_0x768611)[_0x3e2b('0x11')](function(_0x1b4a43){var _0x1e2abe={'method':_0x3e2b('0x17'),'uri':_0x1897d5+_0x3e2b('0x2e')+_0x1d3ea3[_0x3e2b('0x2f')]('+','%2b')+'\x27','headers':{'Authorization':_0x3e2b('0x30')+_0x1b4a43,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e2abe);})[_0x3e2b('0x11')](function(_0x26bf8a){var _0x421c3c=![];if(!_0x26bf8a)return _0x421c3c;var _0x2c59f8=_0x26bf8a[_0x3e2b('0x1a')];for(var _0x195c3e=0x0;_0x195c3e<_0x2c59f8[_0x3e2b('0x31')];_0x195c3e++){if(_0x2c59f8[_0x195c3e][_0x3e2b('0x32')]===_0x1d3ea3){_0x421c3c=!![];_0xcf7646[_0x3e2b('0x2c')]=_0x2c59f8[_0x195c3e][_0x3e2b('0x33')];}}return _0x421c3c;})[_0x3e2b('0x11')](function(_0x300bb4){if(_0x300bb4)return _0xcf7646;if(_0x2f778e===_0x3e2b('0x34')){logger[_0x3e2b('0x22')]('['+[_0x768611[_0x3e2b('0x14')]()]+_0x3e2b('0x35'));return _0xcf7646;}return createEndUser(_0xcf7646,_0x5b599e,_0x7c0859,_0x1897d5,_0x3bdab3,_0x768611)[_0x3e2b('0x11')](function(_0x121ad1){logger['info']('['+[_0x768611['toUpperCase']()]+']\x20Enduser\x20created!',_0x121ad1['enduserId']);return _0x121ad1;});});}function getCustomFields(_0xcdde2c,_0x3a42cb,_0x16e533){var _0x4f559c={};if(_0xcdde2c[_0x3e2b('0x31')]>0x0){_[_0x3e2b('0x36')](_0xcdde2c,function(_0x540d7b){if(_[_0x3e2b('0x37')]([_0x3e2b('0x38'),_0x3e2b('0x39')],_0x540d7b[_0x3e2b('0x3a')])&&_0x540d7b[_0x3e2b('0x3b')]&&!_0x540d7b['customField']){var _0x4610cf=_0x540d7b[_0x3e2b('0x3c')][_0x3e2b('0x2d')]();var _0x76b219=_0x4610cf[_0x3e2b('0x2a')](0x0,_0x4610cf['indexOf']('_'));var _0x98f7ce=_0x4610cf['substring'](_0x4610cf[_0x3e2b('0x3d')]('_')+0x1);if(_0x76b219===_0x16e533){_0x4f559c[_0x98f7ce]=_0x540d7b[_0x3e2b('0x3e')];}}});}return _0x4f559c;}function getTicket(_0xaf7fa1,_0x51817d,_0x28d646,_0x1f5a8d,_0x27b68e,_0x543d75,_0x4760e3){return new Promise(function(_0x45fd15,_0x28407f){var _0x1aff00;return getAuthToken(_0x51817d,_0x28d646,_0x4760e3)[_0x3e2b('0x11')](function(_0x253944){if(_0x543d75[_0x3e2b('0x3f')]===_0x3e2b('0x40')){_0x1aff00={'method':_0x3e2b('0x27'),'uri':_0x1f5a8d+'incidents','body':Object[_0x3e2b('0x41')]({},{'title':intUtil[_0x3e2b('0x42')](_0x543d75[_0x3e2b('0x43')],_0x27b68e,'\x20'),'description':intUtil[_0x3e2b('0x42')](_0x543d75[_0x3e2b('0x44')],_0x27b68e,'\x0a'),'customerid_contact@odata.bind':_0xaf7fa1['enduserId']?'/contacts('+_0xaf7fa1[_0x3e2b('0x2c')]+')':undefined,'ownerid@odata.bind':_0x3e2b('0x28')+_0xaf7fa1[_0x3e2b('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x543d75[_0x3e2b('0x45')],_0x27b68e,_0x543d75['ticketType'])),'headers':{'Authorization':_0x3e2b('0x30')+_0x253944,'OData-Version':_0x3e2b('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x543d75[_0x3e2b('0x3f')]==='phonecall'){var _0x11f4d0=_0xaf7fa1[_0x3e2b('0x2c')]?[{'partyid_systemuser@odata.bind':_0x3e2b('0x28')+_0xaf7fa1['userId']+')','participationtypemask':_0xaf7fa1['callDirection']===_0x3e2b('0x46')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xaf7fa1[_0x3e2b('0x2c')]+')','participationtypemask':_0xaf7fa1['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3e2b('0x28')+_0xaf7fa1[_0x3e2b('0x21')]+')','participationtypemask':_0xaf7fa1[_0x3e2b('0x47')]===_0x3e2b('0x46')?0x2:0x1}];_0x1aff00={'method':_0x3e2b('0x27'),'uri':_0x1f5a8d+'phonecalls','body':Object[_0x3e2b('0x41')]({},{'subject':intUtil[_0x3e2b('0x42')](_0x543d75['Subjects'],_0x27b68e,'\x20'),'phonenumber':String(_0x27b68e['calleridnum']),'description':intUtil[_0x3e2b('0x42')](_0x543d75['Descriptions'],_0x27b68e,'\x0a'),'regardingobjectid_contact@odata.bind':_0xaf7fa1[_0x3e2b('0x2c')]?_0x3e2b('0x48')+_0xaf7fa1[_0x3e2b('0x2c')]+')':undefined,'ownerid@odata.bind':_0x3e2b('0x28')+_0xaf7fa1[_0x3e2b('0x21')]+')','directioncode':_0xaf7fa1['callDirection']===_0x3e2b('0x46')?![]:!![],'phonecall_activity_parties':_0x11f4d0},getCustomFields(_0x543d75[_0x3e2b('0x45')],_0x27b68e,_0x543d75[_0x3e2b('0x3f')])),'headers':{'Authorization':_0x3e2b('0x30')+_0x253944,'OData-Version':_0x3e2b('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1aff00);})[_0x3e2b('0x11')](function(_0x267040){var _0x33cf00=_0x267040[_0x3e2b('0x29')][_0x3e2b('0x49')];var _0x5ade3e=_0x33cf00['substring'](_0x33cf00[_0x3e2b('0x2b')]('(')+0x1,_0x33cf00['lastIndexOf'](')'));_0xaf7fa1['ticketId']=_0x5ade3e;_0x45fd15(_0xaf7fa1);})['catch'](function(_0x43f063){_0x28407f(_0x43f063[_0x3e2b('0x16')]);});});}function emit(_0x27368c,_0x26454d,_0x16f4dd,_0x5d0cdb){var _0x2d5775={'uri':util[_0x3e2b('0x4a')](_0x3e2b('0x4b'),_0x27368c,_0x16f4dd,_0x5d0cdb)};io['to'](util[_0x3e2b('0x4a')](_0x3e2b('0x4c'),_0x26454d))[_0x3e2b('0x4d')]('trigger:browser:url',_0x2d5775);}exports['cs']=function(_0x3e879b,_0x457581,_0xef9290,_0x4c32db,_0x2713d5,_0x2a6d5e,_0x23952d,_0x5b3aff){var _0xdf7b3f={};_0x2a6d5e['remoteUri']=_0x2a6d5e['modernAuthentication']?intUtil['stripTrailingSlash'](_0x2a6d5e[_0x3e2b('0x9')][_0x3e2b('0xa')]):intUtil[_0x3e2b('0x4e')](_0x2a6d5e[_0x3e2b('0x4f')]);_0x2a6d5e[_0x3e2b('0x50')]=intUtil['stripTrailingSlash'](_0x2a6d5e[_0x3e2b('0x50')]);_0xdf7b3f[_0x3e2b('0x47')]=_0x5b3aff==='queue'||_0x5b3aff===_0x3e2b('0x51')?_0x3e2b('0x46'):'outbound';var _0x723043=_0x2a6d5e['modernAuthentication']?util['format'](_0x3e2b('0x52'),_0x2a6d5e[_0x3e2b('0x9')][_0x3e2b('0xa')]):util[_0x3e2b('0x4a')]('%s/api/data/v9.0/',_0x2a6d5e['remoteUri']);var _0x2bcfb0=util[_0x3e2b('0x4a')](_0x3e2b('0x53'),_0x2a6d5e[_0x3e2b('0xb')]);var _0x46900c=util['format'](_0x3e2b('0x54'),_0x2a6d5e[_0x3e2b('0x50')],_0x457581[_0x3e2b('0x55')],md5(_0x457581[_0x3e2b('0x55')]));if(_0x2713d5&&_0x2713d5[_0x3e2b('0x56')]){logger[_0x3e2b('0x22')]('[QUEUE]',_0x3e2b('0x57'));_0x457581[_0x3e2b('0x58')]=_0x46900c;}else if(_0x23952d&&_0x23952d['recordingFormat']&&_0x23952d['recordingFormat']!==_0x3e2b('0x59')){logger[_0x3e2b('0x22')](_0x3e2b('0x5a'),'Recording\x20is\x20enabled!');_0x457581[_0x3e2b('0x58')]=_0x46900c;}else{_0x457581[_0x3e2b('0x58')]='';}return getUser(_0xdf7b3f,_0x2a6d5e,_0x4c32db,_0x2bcfb0,_0x723043,_0x5b3aff)[_0x3e2b('0x11')](function(_0x25b226){logger[_0x3e2b('0x22')]('['+_0x5b3aff[_0x3e2b('0x14')]()+']\x20The\x20User\x20ID\x20is:',_0x25b226['userId']);logger[_0x3e2b('0x22')]('['+_0x5b3aff[_0x3e2b('0x14')]()+_0x3e2b('0x5b'),_0x25b226[_0x3e2b('0x1c')]);return getEndUser(_0x25b226,_0x2a6d5e,_0x2bcfb0,_0x723043,_0x457581,_0x5b3aff,_0xef9290[_0x3e2b('0x5c')]);})['then'](function(_0x16305d){logger[_0x3e2b('0x22')]('['+_0x5b3aff[_0x3e2b('0x14')]()+_0x3e2b('0x5d'),_0x16305d[_0x3e2b('0x2c')]);logger[_0x3e2b('0x22')]('['+_0x5b3aff['toUpperCase']()+_0x3e2b('0x5e'),_0x457581[_0x3e2b('0x26')]);return getTicket(_0x16305d,_0x2a6d5e,_0x2bcfb0,_0x723043,_0x457581,_0xef9290,_0x5b3aff);})[_0x3e2b('0x11')](function(_0x3255e4){logger[_0x3e2b('0x22')](util['format']('['+_0x5b3aff['toUpperCase']()+_0x3e2b('0x5f'),_0xef9290['ticketType'],_0x3255e4[_0x3e2b('0x60')]));logger[_0x3e2b('0x22')](util[_0x3e2b('0x4a')]('['+_0x5b3aff[_0x3e2b('0x14')]()+_0x3e2b('0x61'),_0x5b3aff));if(_0x5b3aff!==_0x3e2b('0x51')){logger[_0x3e2b('0x22')]('['+_0x5b3aff[_0x3e2b('0x14')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2a6d5e['remoteUri'],_0x4c32db[_0x3e2b('0x62')],_0xef9290['ticketType'],_0x3255e4[_0x3e2b('0x60')]);}})[_0x3e2b('0x13')](function(_0x14b48b){logger[_0x3e2b('0x63')]('['+_0x5b3aff[_0x3e2b('0x14')]()+_0x3e2b('0x64'),_0x14b48b[_0x3e2b('0x16')]);});}; \ 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 5c9a26e..4b5d37b 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 _0x7c82=['find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','type','nameField','content','idField','customField','push','variable','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','localhost','socket.io-emitter','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','Tags','name','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!'];(function(_0x1e5b5c,_0x5a6068){var _0x507787=function(_0x11d917){while(--_0x11d917){_0x1e5b5c['push'](_0x1e5b5c['shift']());}};_0x507787(++_0x5a6068);}(_0x7c82,0x1f4));var _0x27c8=function(_0x1879f7,_0x231de9){_0x1879f7=_0x1879f7-0x0;var _0x510026=_0x7c82[_0x1879f7];return _0x510026;};'use strict';var _=require('lodash');var rp=require(_0x27c8('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x27c8('0x1'));var intUtil=require(_0x27c8('0x2'));var config=require(_0x27c8('0x3'));var logger=require(_0x27c8('0x4'))(_0x27c8('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x27c8('0x6'),'port':0x18eb});var io=require(_0x27c8('0x7'))(new Redis(config[_0x27c8('0x8')]));var headers={'Content-Type':_0x27c8('0x9'),'Accept':'application/json'};function emit(_0x577086,_0x3738d8,_0x5b99d0){io['to'](_0x577086)[_0x27c8('0xa')](_0x3738d8,_0x5b99d0);}function getTicket(_0x4995a7,_0x5c574b,_0x59dcb1,_0x2d227a,_0x3a21a9){logger[_0x27c8('0xb')](_0x27c8('0xc'));var _0x194662=_[_0x27c8('0xd')]({'responder_id':_0x5c574b['id'],'requester_id':_0x59dcb1['id'],'name':util[_0x27c8('0xe')](_0x27c8('0xf'),_0x3a21a9['calleridname']),'phone':_0x3a21a9[_0x27c8('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x27c8('0x11')](_0x2d227a['Subjects'],_0x3a21a9,'\x20'),'description':intUtil[_0x27c8('0x11')](_0x2d227a[_0x27c8('0x12')],_0x3a21a9,'
'),'tags':getTags(_0x2d227a[_0x27c8('0x13')],_0x27c8('0x14'))},getCustomFields(_0x2d227a['Fields'],_0x3a21a9));_0x194662['custom_fields']=_[_0x27c8('0x15')](_[_0x27c8('0x16')](_0x194662[_0x27c8('0x17')],'id'),_0x27c8('0x18'));return request({'uri':util['format'](_0x27c8('0x19'),_0x4995a7[_0x27c8('0x1a')]),'method':_0x27c8('0x1b'),'body':_0x194662})['then'](function(_0x5e8d88){logger[_0x27c8('0xb')](_0x27c8('0x1c'));return _0x5e8d88;});}function getUser(_0x39cfa1,_0x44dd8e){if(intUtil[_0x27c8('0x1d')](_0x44dd8e)){return request({'uri':util['format'](_0x27c8('0x1e'),_0x39cfa1[_0x27c8('0x1a')]),'qs':{'email':_0x44dd8e}})[_0x27c8('0x1f')](function(_0x22be1d){if(_0x22be1d[_0x27c8('0x20')]){logger[_0x27c8('0xb')](_0x27c8('0x21'));return _[_0x27c8('0x22')](_0x22be1d,function(_0x25e0f7){return _0x25e0f7['contact'][_0x27c8('0x23')]===_0x44dd8e;});}else{logger[_0x27c8('0xb')](_0x27c8('0x24'));return request({'uri':util[_0x27c8('0xe')](_0x27c8('0x25'),_0x39cfa1[_0x27c8('0x1a')])})[_0x27c8('0x1f')](function(_0x46af0b){logger['info'](_0x27c8('0x26'));return _0x46af0b;});}});}else{logger[_0x27c8('0xb')](_0x27c8('0x27'));return request({'uri':util[_0x27c8('0xe')]('%s/api/v2/agents/me',_0x39cfa1[_0x27c8('0x1a')])})[_0x27c8('0x1f')](function(_0x31e0ec){logger[_0x27c8('0xb')]('Admin\x20account\x20selected.');return _0x31e0ec;});}}function getEndUser(_0x110ab6,_0x502c82,_0xdf0308){logger[_0x27c8('0xb')]('Searching\x20enduser\x20with\x20phone',_0xdf0308);return request({'uri':util[_0x27c8('0xe')]('%s/api/v2/contacts',_0x110ab6[_0x27c8('0x1a')]),'qs':{'phone':_0xdf0308}})[_0x27c8('0x1f')](function(_0x3e5eab){if(_0x3e5eab[_0x27c8('0x20')]){logger[_0x27c8('0xb')](_0x27c8('0x28'));return _[_0x27c8('0x22')](_0x3e5eab,{'phone':_0xdf0308});}else{logger[_0x27c8('0xb')](_0x27c8('0x29'));return request({'uri':util[_0x27c8('0xe')]('%s/api/v2/contacts',_0x110ab6[_0x27c8('0x1a')]),'method':'POST','body':{'name':_0x502c82,'phone':_0xdf0308}})[_0x27c8('0x1f')](function(_0x3ce25c){logger[_0x27c8('0xb')](_0x27c8('0x2a'));return _0x3ce25c;});}});}function getAuth(_0x2b0b1f){return util[_0x27c8('0xe')](_0x27c8('0x2b'),new Buffer(_0x2b0b1f['apiKey']+':X')[_0x27c8('0x2c')](_0x27c8('0x2d')));}function request(_0x2de544){logger[_0x27c8('0x2e')](_0x27c8('0x2f'),JSON[_0x27c8('0x30')](_0x2de544));return rp(_[_0x27c8('0x31')](_0x2de544,{'method':_0x27c8('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x39a8d1,_0x43f915){var _0x16d3d2=[];if(_0x39a8d1&&_0x39a8d1[_0x27c8('0x20')]>0x0){_0x16d3d2=_['map'](_0x39a8d1,_0x43f915);}return _0x16d3d2;}function getCustomFields(_0x356d7c,_0x419da0){var _0x4ffe22=[];var _0x52f2af={'custom_fields':[]};if(_0x356d7c['length']>0x0){_[_0x27c8('0x33')](_0x356d7c,function(_0x10aded){if(_[_0x27c8('0x34')]([_0x27c8('0x35'),_0x27c8('0x36')],_0x10aded[_0x27c8('0x37')])&&_0x10aded[_0x27c8('0x38')]&&!_0x10aded['customField']){_0x52f2af[_0x10aded['nameField']['toLowerCase']()]=_0x10aded[_0x27c8('0x39')][_0x27c8('0x2c')]();}else if(_[_0x27c8('0x34')]([_0x27c8('0x35'),_0x27c8('0x36')],_0x10aded[_0x27c8('0x37')])&&_0x10aded[_0x27c8('0x3a')]&&_0x10aded[_0x27c8('0x3b')]){_0x52f2af[_0x27c8('0x17')][_0x27c8('0x3c')]({'id':_0x10aded[_0x27c8('0x3a')],'value':_0x10aded['content'][_0x27c8('0x2c')]()});}else if(_0x10aded['type']===_0x27c8('0x3d')&&_0x10aded['variableName']&&_0x10aded[_0x27c8('0x3a')]&&_0x10aded[_0x27c8('0x3b')]){_0x419da0[_0x10aded[_0x27c8('0x3e')]]&&_0x52f2af['custom_fields'][_0x27c8('0x3c')]({'id':_0x10aded['idField'],'value':_0x419da0[_0x10aded[_0x27c8('0x3e')]][_0x27c8('0x2c')]()});}else if(_0x10aded[_0x27c8('0x37')]==='customVariable'&&_0x10aded[_0x27c8('0x3f')]&&_0x10aded[_0x27c8('0x3f')][_0x27c8('0x14')]&&_0x10aded[_0x27c8('0x3a')]&&_0x10aded['customField']){_0x419da0[_0x10aded['Variable'][_0x27c8('0x14')][_0x27c8('0x40')]()]&&_0x52f2af[_0x27c8('0x17')][_0x27c8('0x3c')]({'id':_0x10aded[_0x27c8('0x3a')],'value':_0x419da0[_0x10aded[_0x27c8('0x3f')][_0x27c8('0x14')]['toLowerCase']()]['toString']()});}});}return _0x52f2af;}exports['queue']=function(_0x34a109,_0x3bda83,_0x168b1c,_0x254e6f,_0x50fa15,_0x4e96c1){var _0x4478af,_0xebbf94;_0x4e96c1[_0x27c8('0x1a')]=intUtil[_0x27c8('0x41')](_0x4e96c1[_0x27c8('0x1a')]);_0x4e96c1['serverUrl']=intUtil[_0x27c8('0x41')](_0x4e96c1[_0x27c8('0x42')]);if(_0x50fa15&&_0x50fa15[_0x27c8('0x43')]){logger[_0x27c8('0xb')](_0x27c8('0x44'),_0x27c8('0x45'));_0x3bda83[_0x27c8('0x46')]=util[_0x27c8('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e96c1[_0x27c8('0x42')],_0x3bda83[_0x27c8('0x47')],md5(_0x3bda83['uniqueid']));}else{_0x3bda83[_0x27c8('0x46')]='';}headers[_0x27c8('0x48')]=getAuth(_0x4e96c1);return getUser(_0x4e96c1,_0x254e6f[_0x27c8('0x23')])[_0x27c8('0x1f')](function(_0x45a184){_0x4478af=_0x45a184;logger['info'](_0x27c8('0x49'),_0x4478af['id']);return getEndUser(_0x4e96c1,_0x3bda83['calleridname'],_0x3bda83['calleridnum']);})[_0x27c8('0x1f')](function(_0x29d6d4){_0xebbf94=_0x29d6d4;logger['info']('The\x20Enduser\x20ID\x20is:',_0xebbf94['id']);return getTicket(_0x4e96c1,_0x4478af,_0xebbf94,_0x168b1c,_0x3bda83);})[_0x27c8('0x1f')](function(_0x4bd846){if(_0x4bd846&&_0x4bd846['id']){logger[_0x27c8('0xb')](_0x27c8('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4bd846['id']);logger[_0x27c8('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x27c8('0xe')](_0x27c8('0x4a'),_0x254e6f['name']),_0x27c8('0x4b'),{'uri':util[_0x27c8('0xe')](_0x27c8('0x4c'),_0x4e96c1[_0x27c8('0x1a')],_0x4bd846['id'])});}})[_0x27c8('0x4d')](function(_0x45209f){logger[_0x27c8('0x4e')]('[QUEUE]',JSON[_0x27c8('0x30')](_0x45209f));});};exports['outbound']=function(_0x2207af,_0x17bb12,_0x1a2f9f,_0x2f4aa4,_0x39336e,_0x432486,_0x1f4205){var _0x359654,_0x1388cb;_0x432486[_0x27c8('0x1a')]=intUtil[_0x27c8('0x41')](_0x432486[_0x27c8('0x1a')]);_0x432486[_0x27c8('0x42')]=intUtil[_0x27c8('0x41')](_0x432486[_0x27c8('0x42')]);if(_0x1f4205&&_0x1f4205[_0x27c8('0x4f')]&&_0x1f4205['recordingFormat']!==_0x27c8('0x50')){logger['info']('[OUTBOUND]',_0x27c8('0x45'));_0x17bb12[_0x27c8('0x46')]=util[_0x27c8('0xe')](_0x27c8('0x51'),_0x432486[_0x27c8('0x42')],_0x17bb12[_0x27c8('0x47')],md5(_0x17bb12['uniqueid']));}headers[_0x27c8('0x48')]=getAuth(_0x432486);return getUser(_0x432486,_0x2f4aa4['email'])[_0x27c8('0x1f')](function(_0x23f9ab){_0x359654=_0x23f9ab;logger[_0x27c8('0xb')]('The\x20User\x20ID\x20is:',_0x359654['id']);return getEndUser(_0x432486,_0x17bb12['destcalleridname'],_0x17bb12[_0x27c8('0x52')]);})[_0x27c8('0x1f')](function(_0xc48120){_0x1388cb=_0xc48120;logger['info'](_0x27c8('0x53'),_0x1388cb['id']);return getTicket(_0x432486,_0x359654,_0x1388cb,_0x1a2f9f,_0x17bb12);})[_0x27c8('0x1f')](function(_0x5cbca3){if(_0x5cbca3&&_0x5cbca3['id']){logger['info'](_0x27c8('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5cbca3['id']);logger[_0x27c8('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x27c8('0xe')](_0x27c8('0x4a'),_0x2f4aa4['name']),_0x27c8('0x4b'),{'uri':util[_0x27c8('0xe')](_0x27c8('0x4c'),_0x432486[_0x27c8('0x1a')],_0x5cbca3['id'])});}})[_0x27c8('0x4d')](function(_0x12c392){logger[_0x27c8('0x4e')]('[OUTBOUND]',JSON[_0x27c8('0x30')](_0x12c392));});};exports[_0x27c8('0x54')]=function(_0x10d133,_0x41ba5f,_0x56af1c,_0x5e074c,_0x3789e3,_0x109899){var _0x9f7315,_0x17ef33;_0x109899[_0x27c8('0x1a')]=intUtil[_0x27c8('0x41')](_0x109899[_0x27c8('0x1a')]);_0x109899['serverUrl']=intUtil[_0x27c8('0x41')](_0x109899[_0x27c8('0x42')]);if(_0x3789e3&&_0x3789e3[_0x27c8('0x43')]){logger[_0x27c8('0xb')]('['+_0x41ba5f[_0x27c8('0x55')][_0x27c8('0x56')]()+']',_0x27c8('0x45'));_0x41ba5f[_0x27c8('0x46')]=util[_0x27c8('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x109899[_0x27c8('0x42')],_0x41ba5f['uniqueid'],md5(_0x41ba5f[_0x27c8('0x47')]));}else{_0x41ba5f[_0x27c8('0x46')]='';}headers[_0x27c8('0x48')]=getAuth(_0x109899);return getUser(_0x109899,'')[_0x27c8('0x1f')](function(_0x1df882){_0x9f7315=_0x1df882;logger['info'](_0x27c8('0x49'),_0x9f7315['id']);return getEndUser(_0x109899,_0x41ba5f[_0x27c8('0x57')],_0x41ba5f[_0x27c8('0x10')]);})[_0x27c8('0x1f')](function(_0x4b7f1e){_0x17ef33=_0x4b7f1e;logger[_0x27c8('0xb')](_0x27c8('0x53'),_0x17ef33['id']);return getTicket(_0x109899,_0x9f7315,_0x17ef33,_0x56af1c,_0x41ba5f);})[_0x27c8('0x1f')](function(_0x1f0314){if(_0x1f0314){logger['info'](_0x27c8('0x1c'));logger[_0x27c8('0xb')](_0x27c8('0x58'),_0x1f0314['id']);}})[_0x27c8('0x4d')](function(_0x1e6e96){logger[_0x27c8('0x4e')]('['+_0x41ba5f['lastevent'][_0x27c8('0x56')]()+']',JSON[_0x27c8('0x30')](_0x1e6e96));});}; \ No newline at end of file +var _0xa405=['outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','catch','lastevent','lodash','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','type','nameField','customField','string','picklist','idField','push','content','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','error'];(function(_0x3e8a35,_0x5e441f){var _0x12ac4a=function(_0x46c8ae){while(--_0x46c8ae){_0x3e8a35['push'](_0x3e8a35['shift']());}};_0x12ac4a(++_0x5e441f);}(_0xa405,0xc0));var _0x5a40=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa405[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5a40('0x0'));var rp=require('request-promise');var md5=require(_0x5a40('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x5a40('0x2'));var config=require(_0x5a40('0x3'));var logger=require(_0x5a40('0x4'))(_0x5a40('0x5'));config[_0x5a40('0x6')]=_[_0x5a40('0x7')](config[_0x5a40('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5a40('0x8'))(new Redis(config[_0x5a40('0x6')]));var headers={'Content-Type':_0x5a40('0x9'),'Accept':_0x5a40('0x9')};function emit(_0x5b5578,_0x341915,_0x5c5b1a){io['to'](_0x5b5578)[_0x5a40('0xa')](_0x341915,_0x5c5b1a);}function getTicket(_0x5cab16,_0x1bb22f,_0x367005,_0x116983,_0x26648a){logger[_0x5a40('0xb')](_0x5a40('0xc'));var _0x962a1=_['merge']({'responder_id':_0x1bb22f['id'],'requester_id':_0x367005['id'],'name':util[_0x5a40('0xd')](_0x5a40('0xe'),_0x26648a[_0x5a40('0xf')]),'phone':_0x26648a[_0x5a40('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5a40('0x11')](_0x116983[_0x5a40('0x12')],_0x26648a,'\x20'),'description':intUtil['getString'](_0x116983[_0x5a40('0x13')],_0x26648a,_0x5a40('0x14')),'tags':getTags(_0x116983['Tags'],_0x5a40('0x15'))},getCustomFields(_0x116983[_0x5a40('0x16')],_0x26648a));_0x962a1[_0x5a40('0x17')]=_['mapValues'](_[_0x5a40('0x18')](_0x962a1[_0x5a40('0x17')],'id'),'value');return request({'uri':util[_0x5a40('0xd')](_0x5a40('0x19'),_0x5cab16['remoteUri']),'method':_0x5a40('0x1a'),'body':_0x962a1})[_0x5a40('0x1b')](function(_0x4348de){logger[_0x5a40('0xb')](_0x5a40('0x1c'));return _0x4348de;});}function getUser(_0x509271,_0xc4cc01){if(intUtil[_0x5a40('0x1d')](_0xc4cc01)){return request({'uri':util['format'](_0x5a40('0x1e'),_0x509271['remoteUri']),'qs':{'email':_0xc4cc01}})['then'](function(_0xbae659){if(_0xbae659[_0x5a40('0x1f')]){logger[_0x5a40('0xb')]('Agent\x20found!');return _[_0x5a40('0x20')](_0xbae659,function(_0x2dbe5f){return _0x2dbe5f['contact'][_0x5a40('0x21')]===_0xc4cc01;});}else{logger[_0x5a40('0xb')](_0x5a40('0x22'));return request({'uri':util[_0x5a40('0xd')](_0x5a40('0x23'),_0x509271[_0x5a40('0x24')])})[_0x5a40('0x1b')](function(_0x17cc80){logger[_0x5a40('0xb')](_0x5a40('0x25'));return _0x17cc80;});}});}else{logger[_0x5a40('0xb')](_0x5a40('0x26'));return request({'uri':util[_0x5a40('0xd')](_0x5a40('0x23'),_0x509271[_0x5a40('0x24')])})[_0x5a40('0x1b')](function(_0x1bafbc){logger[_0x5a40('0xb')](_0x5a40('0x25'));return _0x1bafbc;});}}function getEndUser(_0x334eb4,_0x4921ba,_0x4c05c6){logger[_0x5a40('0xb')](_0x5a40('0x27'),_0x4c05c6);return request({'uri':util[_0x5a40('0xd')](_0x5a40('0x28'),_0x334eb4[_0x5a40('0x24')]),'qs':{'phone':_0x4c05c6}})[_0x5a40('0x1b')](function(_0x364ac6){if(_0x364ac6[_0x5a40('0x1f')]){logger[_0x5a40('0xb')](_0x5a40('0x29'));return _[_0x5a40('0x20')](_0x364ac6,{'phone':_0x4c05c6});}else{logger[_0x5a40('0xb')](_0x5a40('0x2a'));return request({'uri':util[_0x5a40('0xd')](_0x5a40('0x28'),_0x334eb4['remoteUri']),'method':_0x5a40('0x1a'),'body':{'name':_0x4921ba,'phone':_0x4c05c6}})[_0x5a40('0x1b')](function(_0x5978a3){logger[_0x5a40('0xb')](_0x5a40('0x2b'));return _0x5978a3;});}});}function getAuth(_0x5cb77e){return util[_0x5a40('0xd')](_0x5a40('0x2c'),new Buffer(_0x5cb77e[_0x5a40('0x2d')]+':X')[_0x5a40('0x2e')](_0x5a40('0x2f')));}function request(_0x54adb2){logger[_0x5a40('0x30')](_0x5a40('0x31'),JSON[_0x5a40('0x32')](_0x54adb2));return rp(_[_0x5a40('0x7')](_0x54adb2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x58eb9f,_0x29c6e8){var _0x1fc533=[];if(_0x58eb9f&&_0x58eb9f[_0x5a40('0x1f')]>0x0){_0x1fc533=_['map'](_0x58eb9f,_0x29c6e8);}return _0x1fc533;}function getCustomFields(_0x9166ed,_0x96d982){var _0x14276c=[];var _0x396303={'custom_fields':[]};if(_0x9166ed[_0x5a40('0x1f')]>0x0){_[_0x5a40('0x33')](_0x9166ed,function(_0x3009b8){if(_[_0x5a40('0x34')](['string','picklist'],_0x3009b8[_0x5a40('0x35')])&&_0x3009b8[_0x5a40('0x36')]&&!_0x3009b8[_0x5a40('0x37')]){_0x396303[_0x3009b8['nameField']['toLowerCase']()]=_0x3009b8['content']['toString']();}else if(_[_0x5a40('0x34')]([_0x5a40('0x38'),_0x5a40('0x39')],_0x3009b8[_0x5a40('0x35')])&&_0x3009b8[_0x5a40('0x3a')]&&_0x3009b8[_0x5a40('0x37')]){_0x396303[_0x5a40('0x17')][_0x5a40('0x3b')]({'id':_0x3009b8[_0x5a40('0x3a')],'value':_0x3009b8[_0x5a40('0x3c')][_0x5a40('0x2e')]()});}else if(_0x3009b8[_0x5a40('0x35')]===_0x5a40('0x3d')&&_0x3009b8[_0x5a40('0x3e')]&&_0x3009b8['idField']&&_0x3009b8[_0x5a40('0x37')]){_0x96d982[_0x3009b8[_0x5a40('0x3e')]]&&_0x396303['custom_fields'][_0x5a40('0x3b')]({'id':_0x3009b8['idField'],'value':_0x96d982[_0x3009b8[_0x5a40('0x3e')]][_0x5a40('0x2e')]()});}else if(_0x3009b8[_0x5a40('0x35')]===_0x5a40('0x3f')&&_0x3009b8[_0x5a40('0x40')]&&_0x3009b8['Variable']['name']&&_0x3009b8[_0x5a40('0x3a')]&&_0x3009b8[_0x5a40('0x37')]){_0x96d982[_0x3009b8[_0x5a40('0x40')]['name'][_0x5a40('0x41')]()]&&_0x396303[_0x5a40('0x17')][_0x5a40('0x3b')]({'id':_0x3009b8[_0x5a40('0x3a')],'value':_0x96d982[_0x3009b8['Variable'][_0x5a40('0x15')][_0x5a40('0x41')]()][_0x5a40('0x2e')]()});}});}return _0x396303;}exports[_0x5a40('0x42')]=function(_0x55e68b,_0x156e85,_0x435f1,_0x21f814,_0x10ef68,_0x29e19e){var _0x30f373,_0x17b1d8;_0x29e19e[_0x5a40('0x24')]=intUtil[_0x5a40('0x43')](_0x29e19e['remoteUri']);_0x29e19e[_0x5a40('0x44')]=intUtil[_0x5a40('0x43')](_0x29e19e[_0x5a40('0x44')]);if(_0x10ef68&&_0x10ef68[_0x5a40('0x45')]){logger[_0x5a40('0xb')](_0x5a40('0x46'),_0x5a40('0x47'));_0x156e85['recordingURL']=util[_0x5a40('0xd')](_0x5a40('0x48'),_0x29e19e['serverUrl'],_0x156e85[_0x5a40('0x49')],md5(_0x156e85[_0x5a40('0x49')]));}else{_0x156e85[_0x5a40('0x4a')]='';}headers[_0x5a40('0x4b')]=getAuth(_0x29e19e);return getUser(_0x29e19e,_0x21f814[_0x5a40('0x21')])[_0x5a40('0x1b')](function(_0x2f1562){_0x30f373=_0x2f1562;logger['info']('The\x20User\x20ID\x20is:',_0x30f373['id']);return getEndUser(_0x29e19e,_0x156e85[_0x5a40('0xf')],_0x156e85[_0x5a40('0x10')]);})[_0x5a40('0x1b')](function(_0x1ee8e0){_0x17b1d8=_0x1ee8e0;logger['info'](_0x5a40('0x4c'),_0x17b1d8['id']);return getTicket(_0x29e19e,_0x30f373,_0x17b1d8,_0x435f1,_0x156e85);})[_0x5a40('0x1b')](function(_0x480a5c){if(_0x480a5c&&_0x480a5c['id']){logger['info'](_0x5a40('0x1c'));logger[_0x5a40('0xb')](_0x5a40('0x4d'),_0x480a5c['id']);logger[_0x5a40('0xb')](_0x5a40('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5a40('0x4e'),_0x21f814[_0x5a40('0x15')]),'trigger:browser:url',{'uri':util['format'](_0x5a40('0x4f'),_0x29e19e['remoteUri'],_0x480a5c['id'])});}})['catch'](function(_0x31372a){logger[_0x5a40('0x50')](_0x5a40('0x46'),JSON[_0x5a40('0x32')](_0x31372a));});};exports[_0x5a40('0x51')]=function(_0x5773bb,_0x4c105b,_0x55b744,_0x111525,_0x253dda,_0x4fbf4d,_0x5f3be7){var _0x2acfd4,_0x2eab66;_0x4fbf4d[_0x5a40('0x24')]=intUtil[_0x5a40('0x43')](_0x4fbf4d[_0x5a40('0x24')]);_0x4fbf4d[_0x5a40('0x44')]=intUtil[_0x5a40('0x43')](_0x4fbf4d[_0x5a40('0x44')]);if(_0x5f3be7&&_0x5f3be7[_0x5a40('0x52')]&&_0x5f3be7[_0x5a40('0x52')]!=='none'){logger[_0x5a40('0xb')](_0x5a40('0x53'),_0x5a40('0x47'));_0x4c105b['recordingURL']=util[_0x5a40('0xd')](_0x5a40('0x48'),_0x4fbf4d[_0x5a40('0x44')],_0x4c105b[_0x5a40('0x49')],md5(_0x4c105b[_0x5a40('0x49')]));}headers[_0x5a40('0x4b')]=getAuth(_0x4fbf4d);return getUser(_0x4fbf4d,_0x111525[_0x5a40('0x21')])['then'](function(_0x17b6b3){_0x2acfd4=_0x17b6b3;logger[_0x5a40('0xb')](_0x5a40('0x54'),_0x2acfd4['id']);return getEndUser(_0x4fbf4d,_0x4c105b['destcalleridname'],_0x4c105b['destcalleridnum']);})[_0x5a40('0x1b')](function(_0x417519){_0x2eab66=_0x417519;logger[_0x5a40('0xb')](_0x5a40('0x4c'),_0x2eab66['id']);return getTicket(_0x4fbf4d,_0x2acfd4,_0x2eab66,_0x55b744,_0x4c105b);})['then'](function(_0x5bdf2d){if(_0x5bdf2d&&_0x5bdf2d['id']){logger[_0x5a40('0xb')](_0x5a40('0x1c'));logger['info'](_0x5a40('0x4d'),_0x5bdf2d['id']);logger[_0x5a40('0xb')](_0x5a40('0x53'),_0x5a40('0x55'));emit(util[_0x5a40('0xd')](_0x5a40('0x4e'),_0x111525['name']),_0x5a40('0x56'),{'uri':util[_0x5a40('0xd')](_0x5a40('0x4f'),_0x4fbf4d[_0x5a40('0x24')],_0x5bdf2d['id'])});}})['catch'](function(_0x2b1f7b){logger[_0x5a40('0x50')](_0x5a40('0x53'),JSON[_0x5a40('0x32')](_0x2b1f7b));});};exports[_0x5a40('0x57')]=function(_0x225b01,_0xf11670,_0x3e0873,_0x34a105,_0x5dd3ca,_0x5a8b8b){var _0x367a12,_0x3816ec;_0x5a8b8b['remoteUri']=intUtil['stripTrailingSlash'](_0x5a8b8b[_0x5a40('0x24')]);_0x5a8b8b[_0x5a40('0x44')]=intUtil[_0x5a40('0x43')](_0x5a8b8b[_0x5a40('0x44')]);if(_0x5dd3ca&&_0x5dd3ca[_0x5a40('0x45')]){logger[_0x5a40('0xb')]('['+_0xf11670['lastevent'][_0x5a40('0x58')]()+']',_0x5a40('0x47'));_0xf11670['recordingURL']=util[_0x5a40('0xd')](_0x5a40('0x48'),_0x5a8b8b['serverUrl'],_0xf11670['uniqueid'],md5(_0xf11670['uniqueid']));}else{_0xf11670[_0x5a40('0x4a')]='';}headers[_0x5a40('0x4b')]=getAuth(_0x5a8b8b);return getUser(_0x5a8b8b,'')[_0x5a40('0x1b')](function(_0x20c0df){_0x367a12=_0x20c0df;logger[_0x5a40('0xb')](_0x5a40('0x54'),_0x367a12['id']);return getEndUser(_0x5a8b8b,_0xf11670[_0x5a40('0xf')],_0xf11670[_0x5a40('0x10')]);})[_0x5a40('0x1b')](function(_0x18e49d){_0x3816ec=_0x18e49d;logger[_0x5a40('0xb')](_0x5a40('0x4c'),_0x3816ec['id']);return getTicket(_0x5a8b8b,_0x367a12,_0x3816ec,_0x3e0873,_0xf11670);})[_0x5a40('0x1b')](function(_0x1a7941){if(_0x1a7941){logger[_0x5a40('0xb')]('Ticket\x20created!');logger[_0x5a40('0xb')](_0x5a40('0x4d'),_0x1a7941['id']);}})[_0x5a40('0x59')](function(_0x5e18b2){logger[_0x5a40('0x50')]('['+_0xf11670[_0x5a40('0x5a')][_0x5a40('0x58')]()+']',JSON[_0x5a40('0x32')](_0x5e18b2));});}; \ 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 267f204..ae45c27 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 _0x5cb9=['Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','error','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','then','endUserId','work_number','Contact\x20found\x20work_number:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','getString','Subjects','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','unmanaged','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5cb9,0x8b));var _0x95cb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5cb9[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x95cb('0x0'));var rp=require(_0x95cb('0x1'));var md5=require(_0x95cb('0x2'));var util=require('util');var moment=require(_0x95cb('0x3'));var Promise=require(_0x95cb('0x4'));var Redis=require(_0x95cb('0x5'));var intUtil=require(_0x95cb('0x6'));var config=require(_0x95cb('0x7'));var logger=require(_0x95cb('0x8'))('freshsales');config[_0x95cb('0x9')]=_[_0x95cb('0xa')](config['redis'],{'host':_0x95cb('0xb'),'port':0x18eb});var io=require(_0x95cb('0xc'))(new Redis(config['redis']));function getAdminId(_0x42c52e,_0x9c0d5c,_0x5cf937,_0x218abc){return new Promise(function(_0x58f909,_0x57b861){var _0x2ad4dd=![];var _0x19de6d={'method':_0x95cb('0xd'),'uri':_0x218abc+_0x95cb('0xe'),'json':!![]};_0x19de6d['headers']=_0x5cf937;logger[_0x95cb('0xf')](_0x95cb('0x10'));return rp(_0x19de6d)['then'](function(_0x402bbb){if(_0x402bbb){var _0x35400b=_0x402bbb[_0x95cb('0x11')];var _0x5cea1b=null;for(_0x5cea1b=0x0;_0x5cea1b<_0x35400b[_0x95cb('0x12')];_0x5cea1b++){if(_0x35400b[_0x5cea1b]['email']===_0x42c52e[_0x95cb('0x13')]){_0x42c52e[_0x95cb('0x14')]=_0x35400b[_0x5cea1b]['id'];_0x2ad4dd=!![];}}if(_0x2ad4dd){logger[_0x95cb('0xf')](_0x95cb('0x15'),_0x42c52e['adminId']);_0x58f909(_0x42c52e);}else{_0x57b861({'statusCode':0x194,'message':_0x95cb('0x16')});}}else{_0x57b861({'statusCode':0x194,'message':_0x95cb('0x16')});}})[_0x95cb('0x17')](function(_0x3d43cc){logger['error']('['+[_0x9c0d5c[_0x95cb('0x18')]()]+']',_0x3d43cc[_0x95cb('0x19')]);_0x57b861(_0x3d43cc);});});}function getUser(_0xc7e800,_0x4ab91c,_0x4d68f3){return function(_0x3a6d57){return new Promise(function(_0x35181a,_0x37ff96){var _0x3f3792={'method':_0x95cb('0xd'),'uri':_0x4d68f3+_0x95cb('0xe'),'json':!![]};_0x3f3792[_0x95cb('0x1a')]=_0x4ab91c;logger[_0x95cb('0xf')](_0x95cb('0x1b'));return rp(_0x3f3792)['then'](function(_0x1a439c){if(_0x1a439c){var _0x3d03e0=_0x1a439c[_0x95cb('0x11')];var _0x29e88e=![];var _0x507ed6=null;if(_0x3a6d57[_0x95cb('0x1c')]!==null){logger[_0x95cb('0xf')](_0x95cb('0x1d'),_0x3a6d57['agentEmail']);_0x3a6d57[_0x95cb('0x1e')]=_0x3a6d57['agentEmail'];for(_0x507ed6=0x0;_0x507ed6<_0x3d03e0[_0x95cb('0x12')];_0x507ed6++){if(_0x3d03e0[_0x507ed6][_0x95cb('0x1f')]===_0x3a6d57['agentEmail']){_0x29e88e=!![];_0x3a6d57[_0x95cb('0x20')]=_0x3d03e0[_0x507ed6]['id'];logger[_0x95cb('0xf')](_0x95cb('0x21'),_0x3a6d57[_0x95cb('0x20')]);}}}if(!_0x29e88e){logger[_0x95cb('0xf')](_0x95cb('0x22'));_0x3a6d57[_0x95cb('0x1e')]=_0x3a6d57[_0x95cb('0x13')];_0x3a6d57[_0x95cb('0x20')]=_0x3a6d57[_0x95cb('0x14')];_0x29e88e=!![];}if(_0x29e88e){_0x35181a(_0x3a6d57);}else{_0x37ff96({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x37ff96({'statusCode':0x194,'message':_0x95cb('0x16')});}})['catch'](function(_0x1cfe9a){logger[_0x95cb('0x23')]('['+[_0xc7e800[_0x95cb('0x18')]()]+']',_0x1cfe9a[_0x95cb('0x19')]);_0x37ff96(_0x1cfe9a);});});};}function searchContact(_0x3ff4fb,_0x226185,_0x5a38f6,_0x22895e){return new Promise(function(_0x53d374,_0x2b2883){var _0x1ecf35={'method':_0x95cb('0xd'),'headers':_0x226185,'uri':_0x3ff4fb+'/api/lookup?q='+_0x22895e+_0x95cb('0x24')+_0x5a38f6+_0x95cb('0x25'),'json':!![]};rp(_0x1ecf35)['then'](function(_0x407122){var _0x3538ce=_['find'](_0x407122[_0x95cb('0x26')][_0x95cb('0x26')],[_0x5a38f6,_0x22895e]);_0x53d374(_0x3538ce);})[_0x95cb('0x17')](function(_0x351ec1){_0x2b2883(_0x351ec1);});});}function getEndUser(_0xc94949,_0x1f55f8,_0x52ab58){return function(_0x17e3c1){return new Promise(function(_0x215f61,_0x142654){logger['info'](util['format'](_0x95cb('0x27'),_0x17e3c1[_0x95cb('0x28')]));searchContact(_0x52ab58,_0x1f55f8,_0x95cb('0x29'),_0x17e3c1[_0x95cb('0x28')])[_0x95cb('0x2a')](function(_0x49b9fd){if(_0x49b9fd){_0x17e3c1[_0x95cb('0x2b')]=_0x49b9fd['id'];logger[_0x95cb('0xf')]('Contact\x20found\x20mobile_number:',_0x17e3c1[_0x95cb('0x2b')]);return _0x215f61(_0x17e3c1);}searchContact(_0x52ab58,_0x1f55f8,_0x95cb('0x2c'),_0x17e3c1[_0x95cb('0x28')])[_0x95cb('0x2a')](function(_0x1742c0){if(_0x1742c0){_0x17e3c1[_0x95cb('0x2b')]=_0x1742c0['id'];logger[_0x95cb('0xf')](_0x95cb('0x2d'),_0x17e3c1['endUserId']);return _0x215f61(_0x17e3c1);}createEndUser(_0x17e3c1,_0xc94949,_0x1f55f8,_0x52ab58)[_0x95cb('0x2a')](function(_0x4faff4){logger['info']('Contact\x20created:',_0x4faff4[_0x95cb('0x2b')]);return _0x215f61(_0x4faff4);});});})['catch'](function(_0x3d1d0e){_0x142654(_0x3d1d0e);});});};}function createEndUser(_0x1d32f2,_0x107583,_0x4bdc20,_0x202c7a){return new Promise(function(_0x439cb8,_0x133c9e){var _0x54a7a9=moment();var _0x5115c8={'method':'POST','uri':_0x202c7a+_0x95cb('0x2e'),'body':{'contact':{'last_name':_0x1d32f2[_0x95cb('0x28')],'work_number':_0x1d32f2[_0x95cb('0x28')],'mobile_number':_0x1d32f2['contactNumber'],'owner_id':_0x1d32f2[_0x95cb('0x20')],'created_at':_0x54a7a9[_0x95cb('0x2f')](_0x95cb('0x30'))}},'json':!![]};_0x5115c8[_0x95cb('0x1a')]=_0x4bdc20;logger[_0x95cb('0xf')](_0x95cb('0x31'));return rp(_0x5115c8)[_0x95cb('0x2a')](function(_0x439da4){_0x1d32f2[_0x95cb('0x2b')]=_0x439da4[_0x95cb('0x32')]['id'];_0x439cb8(_0x1d32f2);})[_0x95cb('0x17')](function(_0xceac2){logger[_0x95cb('0x23')]('['+[_0x107583[_0x95cb('0x18')]()]+']',_0xceac2['message']);_0x133c9e(_0xceac2[_0x95cb('0x19')]);});});}function getTicket(_0x307f68,_0x3a440f,_0x578481,_0x2d58b9,_0x40ef12){return function(_0x1d2afa){logger[_0x95cb('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x329493,_0x2da305){var _0x2c4919=moment();var _0x5725a5={'method':_0x95cb('0x33'),'uri':_0x578481+'/api/tasks','body':{'title':intUtil[_0x95cb('0x34')](_0x2d58b9[_0x95cb('0x35')],_0x40ef12,'\x20'),'description':intUtil[_0x95cb('0x34')](_0x2d58b9['Descriptions'],_0x40ef12,'\x0a'),'owner_id':_0x1d2afa[_0x95cb('0x20')],'creater_id':_0x1d2afa['adminId'],'targetable_id':_0x1d2afa[_0x95cb('0x2b')],'targetable_type':_0x95cb('0x36'),'created_at':_0x2c4919[_0x95cb('0x2f')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2c4919[_0x95cb('0x37')](0x1e,'m')['format'](_0x95cb('0x30'))},'json':!![]};_0x5725a5['headers']=_0x3a440f;return rp(_0x5725a5)[_0x95cb('0x2a')](function(_0x1e8bf0){_0x1d2afa['ticketId']=_0x1e8bf0['task']['id'];logger[_0x95cb('0xf')](_0x95cb('0x38'),_0x1d2afa[_0x95cb('0x39')]);_0x329493(_0x1d2afa);})[_0x95cb('0x17')](function(_0x93f5f3){logger['error']('['+[_0x307f68[_0x95cb('0x18')]()]+']',_0x93f5f3['message']);_0x2da305(_0x93f5f3[_0x95cb('0x19')]);});});};}function emit(_0x155346,_0x23fa80,_0x39d366){var _0x58d0a3={'uri':_0x155346+_0x95cb('0x3a')+_0x39d366};io['to'](util[_0x95cb('0x2f')](_0x95cb('0x3b'),_0x23fa80))[_0x95cb('0x3c')](_0x95cb('0x3d'),_0x58d0a3);}exports['cs']=function(_0x361c7d,_0x2292c1,_0x3f8fa3,_0xe72338,_0x1a2103,_0x4e9a8d,_0x505c83,_0x5ad8b7){var _0x46b984={};var _0x5d3d56={'Authorization':_0x95cb('0x3e')+_0x4e9a8d[_0x95cb('0x3f')]};_0x4e9a8d[_0x95cb('0x40')]=intUtil[_0x95cb('0x41')](_0x4e9a8d[_0x95cb('0x40')]);_0x4e9a8d[_0x95cb('0x42')]=intUtil[_0x95cb('0x41')](_0x4e9a8d[_0x95cb('0x42')]);var _0x17e09f=_0x4e9a8d['remoteUri'];_0x46b984['adminEmail']=_0x4e9a8d[_0x95cb('0x43')];_0x46b984['contactNumber']=_0x5ad8b7['toLowerCase']()===_0x95cb('0x44')?_0x2292c1[_0x95cb('0x45')]:_0x2292c1[_0x95cb('0x46')];_0x46b984['callDirection']=_0x5ad8b7==='queue'||_0x5ad8b7===_0x95cb('0x47')?_0x95cb('0x48'):_0x95cb('0x44');if(_0xe72338){_0x46b984['agentEmail']=_0xe72338[_0x95cb('0x1f')];}var _0x5a2aca=util[_0x95cb('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e9a8d['serverUrl'],_0x2292c1['uniqueid'],md5(_0x2292c1[_0x95cb('0x49')]));if(_0x1a2103&&_0x1a2103['monitor_format']){logger[_0x95cb('0xf')](_0x95cb('0x4a'),_0x95cb('0x4b'));_0x2292c1[_0x95cb('0x4c')]=_0x5a2aca;}else if(_0x505c83&&_0x505c83['recordingFormat']&&_0x505c83[_0x95cb('0x4d')]!==_0x95cb('0x4e')){logger[_0x95cb('0xf')](_0x95cb('0x4f'),'Recording\x20is\x20enabled!');_0x2292c1[_0x95cb('0x4c')]=_0x5a2aca;}else{_0x2292c1[_0x95cb('0x4c')]='';}return getAdminId(_0x46b984,_0x5ad8b7,_0x5d3d56,_0x17e09f)['then'](getUser(_0x5ad8b7,_0x5d3d56,_0x17e09f))[_0x95cb('0x2a')](getEndUser(_0x5ad8b7,_0x5d3d56,_0x17e09f))[_0x95cb('0x2a')](getTicket(_0x5ad8b7,_0x5d3d56,_0x17e09f,_0x3f8fa3,_0x2292c1))['then'](function(_0xa39f0a){logger[_0x95cb('0xf')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0xa39f0a[_0x95cb('0x39')]));if(_0x5ad8b7!=='unmanaged'){logger[_0x95cb('0xf')]('['+[_0x5ad8b7[_0x95cb('0x18')]()]+']',_0x95cb('0x50'));emit(_0x17e09f,_0xe72338[_0x95cb('0x51')],_0xa39f0a[_0x95cb('0x2b')]);}})['catch'](function(_0x3c81f0){logger[_0x95cb('0x23')]('['+[_0x5ad8b7[_0x95cb('0x18')]()]+_0x95cb('0x52'),util[_0x95cb('0x53')](_0x3c81f0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8018=['ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','toUpperCase','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','moment','bluebird'];(function(_0x310633,_0x34c478){var _0x16d9d0=function(_0x573d44){while(--_0x573d44){_0x310633['push'](_0x310633['shift']());}};_0x16d9d0(++_0x34c478);}(_0x8018,0xa5));var _0x8801=function(_0x462958,_0x5e3c79){_0x462958=_0x462958-0x0;var _0x1b35fd=_0x8018[_0x462958];return _0x1b35fd;};'use strict';var _=require(_0x8801('0x0'));var rp=require(_0x8801('0x1'));var md5=require('md5');var util=require(_0x8801('0x2'));var moment=require(_0x8801('0x3'));var Promise=require(_0x8801('0x4'));var Redis=require(_0x8801('0x5'));var intUtil=require(_0x8801('0x6'));var config=require(_0x8801('0x7'));var logger=require(_0x8801('0x8'))(_0x8801('0x9'));config[_0x8801('0xa')]=_['defaults'](config['redis'],{'host':_0x8801('0xb'),'port':0x18eb});var io=require(_0x8801('0xc'))(new Redis(config[_0x8801('0xa')]));function getAdminId(_0x32e808,_0x4d283f,_0x363973,_0x4e6a77){return new Promise(function(_0x49f4af,_0x210602){var _0x18871b=![];var _0x11f1c5={'method':_0x8801('0xd'),'uri':_0x4e6a77+_0x8801('0xe'),'json':!![]};_0x11f1c5[_0x8801('0xf')]=_0x363973;logger[_0x8801('0x10')]('Getting\x20admin\x20information');return rp(_0x11f1c5)[_0x8801('0x11')](function(_0xe16d91){if(_0xe16d91){var _0x5d2f74=_0xe16d91[_0x8801('0x12')];var _0x323e42=null;for(_0x323e42=0x0;_0x323e42<_0x5d2f74[_0x8801('0x13')];_0x323e42++){if(_0x5d2f74[_0x323e42][_0x8801('0x14')]===_0x32e808[_0x8801('0x15')]){_0x32e808['adminId']=_0x5d2f74[_0x323e42]['id'];_0x18871b=!![];}}if(_0x18871b){logger['info'](_0x8801('0x16'),_0x32e808[_0x8801('0x17')]);_0x49f4af(_0x32e808);}else{_0x210602({'statusCode':0x194,'message':_0x8801('0x18')});}}else{_0x210602({'statusCode':0x194,'message':_0x8801('0x18')});}})[_0x8801('0x19')](function(_0x4f7de7){logger[_0x8801('0x1a')]('['+[_0x4d283f['toUpperCase']()]+']',_0x4f7de7['message']);_0x210602(_0x4f7de7);});});}function getUser(_0x12d40c,_0x4fc9c2,_0x1151d1){return function(_0xdc3007){return new Promise(function(_0x2e4047,_0x519e7a){var _0x34e0b2={'method':_0x8801('0xd'),'uri':_0x1151d1+_0x8801('0xe'),'json':!![]};_0x34e0b2[_0x8801('0xf')]=_0x4fc9c2;logger[_0x8801('0x10')](_0x8801('0x1b'));return rp(_0x34e0b2)['then'](function(_0x1c2228){if(_0x1c2228){var _0x1a2661=_0x1c2228[_0x8801('0x12')];var _0x236c93=![];var _0xac66c7=null;if(_0xdc3007[_0x8801('0x1c')]!==null){logger[_0x8801('0x10')](_0x8801('0x1d'),_0xdc3007['agentEmail']);_0xdc3007[_0x8801('0x1e')]=_0xdc3007[_0x8801('0x1c')];for(_0xac66c7=0x0;_0xac66c7<_0x1a2661[_0x8801('0x13')];_0xac66c7++){if(_0x1a2661[_0xac66c7][_0x8801('0x14')]===_0xdc3007[_0x8801('0x1c')]){_0x236c93=!![];_0xdc3007[_0x8801('0x1f')]=_0x1a2661[_0xac66c7]['id'];logger[_0x8801('0x10')]('User\x20found:',_0xdc3007['userId']);}}}if(!_0x236c93){logger[_0x8801('0x10')](_0x8801('0x20'));_0xdc3007[_0x8801('0x1e')]=_0xdc3007[_0x8801('0x15')];_0xdc3007[_0x8801('0x1f')]=_0xdc3007[_0x8801('0x17')];_0x236c93=!![];}if(_0x236c93){_0x2e4047(_0xdc3007);}else{_0x519e7a({'statusCode':0x194,'message':_0x8801('0x18')});}}else{_0x519e7a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x8801('0x19')](function(_0x260f04){logger[_0x8801('0x1a')]('['+[_0x12d40c[_0x8801('0x21')]()]+']',_0x260f04['message']);_0x519e7a(_0x260f04);});});};}function searchContact(_0x469a74,_0xe0caee,_0x2b1027,_0x34cf3f){return new Promise(function(_0x566c33,_0x27810a){var _0x3ad94a={'method':_0x8801('0xd'),'headers':_0xe0caee,'uri':_0x469a74+'/api/lookup?q='+_0x34cf3f+_0x8801('0x22')+_0x2b1027+_0x8801('0x23'),'json':!![]};rp(_0x3ad94a)[_0x8801('0x11')](function(_0xaadcd2){var _0x51f7c1=_[_0x8801('0x24')](_0xaadcd2[_0x8801('0x25')][_0x8801('0x25')],[_0x2b1027,_0x34cf3f]);_0x566c33(_0x51f7c1);})[_0x8801('0x19')](function(_0x2331bc){_0x27810a(_0x2331bc);});});}function getEndUser(_0x4100c5,_0xb491f,_0x8c31c4){return function(_0x3d8624){return new Promise(function(_0x53d082,_0x2cc5be){logger['info'](util[_0x8801('0x26')](_0x8801('0x27'),_0x3d8624[_0x8801('0x28')]));searchContact(_0x8c31c4,_0xb491f,_0x8801('0x29'),_0x3d8624[_0x8801('0x28')])[_0x8801('0x11')](function(_0x1cd464){if(_0x1cd464){_0x3d8624['endUserId']=_0x1cd464['id'];logger[_0x8801('0x10')](_0x8801('0x2a'),_0x3d8624[_0x8801('0x2b')]);return _0x53d082(_0x3d8624);}searchContact(_0x8c31c4,_0xb491f,_0x8801('0x2c'),_0x3d8624[_0x8801('0x28')])[_0x8801('0x11')](function(_0x2245d8){if(_0x2245d8){_0x3d8624['endUserId']=_0x2245d8['id'];logger['info']('Contact\x20found\x20work_number:',_0x3d8624[_0x8801('0x2b')]);return _0x53d082(_0x3d8624);}createEndUser(_0x3d8624,_0x4100c5,_0xb491f,_0x8c31c4)[_0x8801('0x11')](function(_0x369dce){logger[_0x8801('0x10')](_0x8801('0x2d'),_0x369dce[_0x8801('0x2b')]);return _0x53d082(_0x369dce);});});})[_0x8801('0x19')](function(_0x4871a5){_0x2cc5be(_0x4871a5);});});};}function createEndUser(_0x1ea9c8,_0x1b91bb,_0x92985c,_0x5a99f8){return new Promise(function(_0xb0e770,_0x16cd3a){var _0x4b35d1=moment();var _0xd1f80f={'method':'POST','uri':_0x5a99f8+_0x8801('0x2e'),'body':{'contact':{'last_name':_0x1ea9c8[_0x8801('0x28')],'work_number':_0x1ea9c8[_0x8801('0x28')],'mobile_number':_0x1ea9c8[_0x8801('0x28')],'owner_id':_0x1ea9c8[_0x8801('0x1f')],'created_at':_0x4b35d1[_0x8801('0x26')](_0x8801('0x2f'))}},'json':!![]};_0xd1f80f['headers']=_0x92985c;logger[_0x8801('0x10')](_0x8801('0x30'));return rp(_0xd1f80f)[_0x8801('0x11')](function(_0x26b2f7){_0x1ea9c8[_0x8801('0x2b')]=_0x26b2f7[_0x8801('0x31')]['id'];_0xb0e770(_0x1ea9c8);})[_0x8801('0x19')](function(_0x268012){logger[_0x8801('0x1a')]('['+[_0x1b91bb[_0x8801('0x21')]()]+']',_0x268012['message']);_0x16cd3a(_0x268012[_0x8801('0x32')]);});});}function getTicket(_0x84d9ba,_0x590bb7,_0x59bbf2,_0x127217,_0x3ad862){return function(_0x9f6b9e){logger[_0x8801('0x10')](_0x8801('0x33'));return new Promise(function(_0x391347,_0x510235){var _0x229301=moment();var _0xdb494a={'method':_0x8801('0x34'),'uri':_0x59bbf2+_0x8801('0x35'),'body':{'title':intUtil[_0x8801('0x36')](_0x127217['Subjects'],_0x3ad862,'\x20'),'description':intUtil[_0x8801('0x36')](_0x127217[_0x8801('0x37')],_0x3ad862,'\x0a'),'owner_id':_0x9f6b9e[_0x8801('0x1f')],'creater_id':_0x9f6b9e[_0x8801('0x17')],'targetable_id':_0x9f6b9e[_0x8801('0x2b')],'targetable_type':_0x8801('0x38'),'created_at':_0x229301[_0x8801('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x229301[_0x8801('0x39')](0x1e,'m')[_0x8801('0x26')](_0x8801('0x2f'))},'json':!![]};_0xdb494a[_0x8801('0xf')]=_0x590bb7;return rp(_0xdb494a)[_0x8801('0x11')](function(_0x3e9529){_0x9f6b9e[_0x8801('0x3a')]=_0x3e9529[_0x8801('0x3b')]['id'];logger[_0x8801('0x10')](_0x8801('0x3c'),_0x9f6b9e[_0x8801('0x3a')]);_0x391347(_0x9f6b9e);})[_0x8801('0x19')](function(_0x1cb1dd){logger[_0x8801('0x1a')]('['+[_0x84d9ba[_0x8801('0x21')]()]+']',_0x1cb1dd[_0x8801('0x32')]);_0x510235(_0x1cb1dd[_0x8801('0x32')]);});});};}function emit(_0x521685,_0x4509a9,_0x2c40ef){var _0x2ce26e={'uri':_0x521685+_0x8801('0x3d')+_0x2c40ef};io['to'](util[_0x8801('0x26')]('user:%s',_0x4509a9))[_0x8801('0x3e')]('trigger:browser:url',_0x2ce26e);}exports['cs']=function(_0x1287a8,_0x5cf34a,_0x342cf5,_0x569a3b,_0x141f8f,_0xe60b64,_0x20b026,_0x1a62e6){var _0x3bf9e8={};var _0x335aa0={'Authorization':_0x8801('0x3f')+_0xe60b64[_0x8801('0x40')]};_0xe60b64[_0x8801('0x41')]=intUtil[_0x8801('0x42')](_0xe60b64[_0x8801('0x41')]);_0xe60b64[_0x8801('0x43')]=intUtil['stripTrailingSlash'](_0xe60b64[_0x8801('0x43')]);var _0x51512f=_0xe60b64[_0x8801('0x41')];_0x3bf9e8[_0x8801('0x15')]=_0xe60b64[_0x8801('0x44')];_0x3bf9e8[_0x8801('0x28')]=_0x1a62e6['toLowerCase']()===_0x8801('0x45')?_0x5cf34a[_0x8801('0x46')]:_0x5cf34a[_0x8801('0x47')];_0x3bf9e8[_0x8801('0x48')]=_0x1a62e6===_0x8801('0x49')||_0x1a62e6===_0x8801('0x4a')?_0x8801('0x49'):_0x8801('0x45');if(_0x569a3b){_0x3bf9e8[_0x8801('0x1c')]=_0x569a3b[_0x8801('0x14')];}var _0x2a8295=util[_0x8801('0x26')](_0x8801('0x4b'),_0xe60b64[_0x8801('0x43')],_0x5cf34a['uniqueid'],md5(_0x5cf34a[_0x8801('0x4c')]));if(_0x141f8f&&_0x141f8f['monitor_format']){logger[_0x8801('0x10')](_0x8801('0x4d'),_0x8801('0x4e'));_0x5cf34a[_0x8801('0x4f')]=_0x2a8295;}else if(_0x20b026&&_0x20b026[_0x8801('0x50')]&&_0x20b026[_0x8801('0x50')]!==_0x8801('0x51')){logger[_0x8801('0x10')]('[OUTBOUND]',_0x8801('0x4e'));_0x5cf34a[_0x8801('0x4f')]=_0x2a8295;}else{_0x5cf34a[_0x8801('0x4f')]='';}return getAdminId(_0x3bf9e8,_0x1a62e6,_0x335aa0,_0x51512f)[_0x8801('0x11')](getUser(_0x1a62e6,_0x335aa0,_0x51512f))[_0x8801('0x11')](getEndUser(_0x1a62e6,_0x335aa0,_0x51512f))['then'](getTicket(_0x1a62e6,_0x335aa0,_0x51512f,_0x342cf5,_0x5cf34a))[_0x8801('0x11')](function(_0x48a181){logger[_0x8801('0x10')](util['format'](_0x8801('0x52'),_0x48a181['ticketId']));if(_0x1a62e6!==_0x8801('0x4a')){logger[_0x8801('0x10')]('['+[_0x1a62e6[_0x8801('0x21')]()]+']',_0x8801('0x53'));emit(_0x51512f,_0x569a3b['name'],_0x48a181[_0x8801('0x2b')]);}})[_0x8801('0x19')](function(_0xd4741e){logger[_0x8801('0x1a')]('['+[_0x1a62e6[_0x8801('0x21')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x8801('0x54')](_0xd4741e,{'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 2ad2b13..90ff412 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 _0x8555=['zoho','dynamics365','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','freshdesk','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','sugarcrm'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0x8555,0xc1));var _0x5855=function(_0x3ac911,_0x431f3b){_0x3ac911=_0x3ac911-0x0;var _0x4073ac=_0x8555[_0x3ac911];return _0x4073ac;};'use strict';var _=require(_0x5855('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x5855('0x1'));var sugarcrm=require(_0x5855('0x2'));var freshdesk=require(_0x5855('0x3'));var zoho=require(_0x5855('0x4'));var desk=require(_0x5855('0x5'));var vtiger=require(_0x5855('0x6'));var servicenow=require(_0x5855('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x5855('0x8'));var integrations=[_0x5855('0x9'),_0x5855('0xa'),'sugarcrm',_0x5855('0xb'),'zoho',_0x5855('0xc'),_0x5855('0xd'),'dynamics365',_0x5855('0xe'),_0x5855('0xf')];exports[_0x5855('0x10')]=function(_0x1d1fd0,_0x40f01a,_0x1d80af,_0x1f11e6,_0x1b5cf7,_0x1039ea){if(_0x1d80af){if(_[_0x5855('0x11')](integrations,_0x1d1fd0[_0x5855('0x12')][_0x5855('0x13')]())){try{var _0x97cc6f=null;var _0x55c14d='';var _0x21ff05=_0x1d80af[_0x1d1fd0[_0x5855('0x12')][_0x5855('0x13')]()];if(_0x21ff05){var _0x2f4ca4=_0x21ff05[_0x1d1fd0[_0x5855('0x14')]];if(_0x2f4ca4){var _0x54450b=_['find'](_0x2f4ca4[_0x5855('0x15')],{'id':parseInt(_0x1d1fd0[_0x5855('0x16')],0xa)});if(_0x54450b){if(_0x1f11e6){if(_0x1b5cf7&&_0x40f01a[_0x5855('0x17')]){_0x55c14d=_0x5855('0x17');}else if(_0x40f01a[_0x5855('0x18')]){_0x55c14d=_0x5855('0x19');}else{console[_0x5855('0x1a')](_0x5855('0x1b'),_0x40f01a);}}else{_0x55c14d='unmanaged';}switch(_0x1d1fd0[_0x5855('0x12')][_0x5855('0x13')]()){case _0x5855('0x9'):zendesk[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case _0x5855('0xa'):salesforce[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case _0x5855('0x1c'):sugarcrm[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case _0x5855('0xb'):freshdesk[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case _0x5855('0x1d'):zoho[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case'desk':desk[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case _0x5855('0xd'):vtiger[_0x55c14d](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea);break;case _0x5855('0xe'):freshsales['cs'](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea,_0x55c14d);break;case _0x5855('0xf'):servicenow['cs'](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea,_0x55c14d);break;case _0x5855('0x1e'):dynamics365['cs'](_0x1d1fd0,_0x40f01a,_0x54450b,_0x1f11e6,_0x1b5cf7,_0x2f4ca4,_0x1039ea,_0x55c14d);break;default:console[_0x5855('0x1a')]('unknown\x20integration');}}else{_0x97cc6f=require(_0x5855('0x1f'))(_0x1d1fd0[_0x5855('0x12')][_0x5855('0x13')]());_0x97cc6f[_0x5855('0x20')](_0x5855('0x21'),util[_0x5855('0x22')](_0x5855('0x23'),_0x1d1fd0[_0x5855('0x12')]['toLowerCase'](),_0x1d1fd0[_0x5855('0x16')]));}}else{_0x97cc6f=require('../../../../config/logger')(_0x1d1fd0['data1']['toLowerCase']());_0x97cc6f[_0x5855('0x20')]('[EXEC]',util[_0x5855('0x22')](_0x5855('0x24'),_0x1d1fd0['data1']['toLowerCase'](),_0x1d1fd0[_0x5855('0x14')]));}}else{}}catch(_0x530516){console[_0x5855('0x20')](_0x530516);}}}}; \ No newline at end of file +var _0x743f=['Configurations','queue','routeId','outbound','log','unmanaged','toLowerCase','zendesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','./sugarcrm','./zoho','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','data2','find'];(function(_0x34fea5,_0x499475){var _0x1878a8=function(_0x1a11f8){while(--_0x1a11f8){_0x34fea5['push'](_0x34fea5['shift']());}};_0x1878a8(++_0x499475);}(_0x743f,0x9c));var _0xf743=function(_0x19e08e,_0x417e6d){_0x19e08e=_0x19e08e-0x0;var _0x3214ee=_0x743f[_0x19e08e];return _0x3214ee;};'use strict';var _=require(_0xf743('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xf743('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0xf743('0x2'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xf743('0x3'));var dynamics365=require(_0xf743('0x4'));var freshsales=require(_0xf743('0x5'));var integrations=['zendesk',_0xf743('0x6'),_0xf743('0x7'),_0xf743('0x8'),_0xf743('0x9'),_0xf743('0xa'),_0xf743('0xb'),_0xf743('0xc'),'freshsales',_0xf743('0xd')];exports[_0xf743('0xe')]=function(_0x44ec66,_0x3ced9f,_0x523b52,_0x654673,_0x57d9f6,_0x33f934){if(_0x523b52){if(_[_0xf743('0xf')](integrations,_0x44ec66[_0xf743('0x10')]['toLowerCase']())){try{var _0x4c1ced=null;var _0x3219be='';var _0x38c366=_0x523b52[_0x44ec66[_0xf743('0x10')]['toLowerCase']()];if(_0x38c366){var _0x306092=_0x38c366[_0x44ec66[_0xf743('0x11')]];if(_0x306092){var _0x1427ec=_[_0xf743('0x12')](_0x306092[_0xf743('0x13')],{'id':parseInt(_0x44ec66['data3'],0xa)});if(_0x1427ec){if(_0x654673){if(_0x57d9f6&&_0x3ced9f[_0xf743('0x14')]){_0x3219be=_0xf743('0x14');}else if(_0x3ced9f[_0xf743('0x15')]){_0x3219be=_0xf743('0x16');}else{console[_0xf743('0x17')]('EVENT\x20UNKNOWN',_0x3ced9f);}}else{_0x3219be=_0xf743('0x18');}switch(_0x44ec66[_0xf743('0x10')][_0xf743('0x19')]()){case _0xf743('0x1a'):zendesk[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case'salesforce':salesforce[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case _0xf743('0x7'):sugarcrm[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case _0xf743('0x8'):freshdesk[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case _0xf743('0x9'):zoho[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case _0xf743('0xa'):desk[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case _0xf743('0xb'):vtiger[_0x3219be](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934);break;case'freshsales':freshsales['cs'](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934,_0x3219be);break;case _0xf743('0xd'):servicenow['cs'](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934,_0x3219be);break;case _0xf743('0xc'):dynamics365['cs'](_0x44ec66,_0x3ced9f,_0x1427ec,_0x654673,_0x57d9f6,_0x306092,_0x33f934,_0x3219be);break;default:console['log'](_0xf743('0x1b'));}}else{_0x4c1ced=require(_0xf743('0x1c'))(_0x44ec66[_0xf743('0x10')][_0xf743('0x19')]());_0x4c1ced[_0xf743('0x1d')](_0xf743('0x1e'),util[_0xf743('0x1f')](_0xf743('0x20'),_0x44ec66[_0xf743('0x10')]['toLowerCase'](),_0x44ec66[_0xf743('0x21')]));}}else{_0x4c1ced=require('../../../../config/logger')(_0x44ec66[_0xf743('0x10')][_0xf743('0x19')]());_0x4c1ced[_0xf743('0x1d')](_0xf743('0x1e'),util['format'](_0xf743('0x22'),_0x44ec66['data1']['toLowerCase'](),_0x44ec66['data2']));}}else{}}catch(_0x26d6e9){console[_0xf743('0x1d')](_0x26d6e9);}}}}; \ 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 1229a04..375c063 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 _0xe2c2=['Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','create','forEach','includes','string','picklist','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','email','destcalleridname','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','[OUTBOUND]','catch','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects'];(function(_0x51ad5a,_0x22523c){var _0xe0c980=function(_0x1ceafc){while(--_0x1ceafc){_0x51ad5a['push'](_0x51ad5a['shift']());}};_0xe0c980(++_0x22523c);}(_0xe2c2,0x16c));var _0x2e2c=function(_0x246d1a,_0xa34081){_0x246d1a=_0x246d1a-0x0;var _0x3eb0f6=_0xe2c2[_0x246d1a];return _0x3eb0f6;};'use strict';var _=require(_0x2e2c('0x0'));var rp=require('request-promise');var moment=require(_0x2e2c('0x1'));var BPromise=require(_0x2e2c('0x2'));var md5=require('md5');var jsforce=require(_0x2e2c('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x2e2c('0x4'));var config=require(_0x2e2c('0x5'));var logger=require(_0x2e2c('0x6'))(_0x2e2c('0x7'));config[_0x2e2c('0x8')]=_['defaults'](config[_0x2e2c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2e2c('0x9'))(new Redis(config['redis']));function emit(_0x51f8b0,_0x46f59f,_0x377322){io['to'](_0x51f8b0)[_0x2e2c('0xa')](_0x46f59f,_0x377322);}function getTicket(_0x564adb,_0x346fd5,_0x5d3d48,_0x5a9bb6,_0x55964b,_0x4c7035,_0x502757,_0x304c5c){var _0x46aa52=Object[_0x2e2c('0xb')]({},{'OwnerId':_0x346fd5['id'],'Subject':intUtil[_0x2e2c('0xc')](_0x5a9bb6[_0x2e2c('0xd')],_0x55964b,'\x20'),'Description':intUtil[_0x2e2c('0xc')](_0x5a9bb6[_0x2e2c('0xe')],_0x55964b,'\x0a')},getCustomFields(_0x4c7035,_0x55964b));if(_0x5d3d48){if(_0x5a9bb6[_0x2e2c('0xf')]===_0x2e2c('0x10')){_0x46aa52[_0x2e2c('0x11')]=moment[_0x2e2c('0x12')]();_0x46aa52['IsReminderSet']=![];_0x46aa52[_0x2e2c('0x13')]=![];if(_0x5d3d48[_0x2e2c('0x14')]==='contact'||_0x5d3d48[_0x2e2c('0x14')]===_0x2e2c('0x15')){_0x46aa52[_0x2e2c('0x16')]=_0x5d3d48['id'];}else if(_0x5d3d48[_0x2e2c('0x14')]===_0x2e2c('0x17')){_0x46aa52[_0x2e2c('0x18')]=_0x5d3d48['id'];}}else if(_0x5a9bb6[_0x2e2c('0xf')]==='Case'){if(_0x5d3d48['endUserType']===_0x2e2c('0x19')){_0x46aa52[_0x2e2c('0x1a')]=_0x5d3d48['id'];}else if(_0x5d3d48[_0x2e2c('0x14')]===_0x2e2c('0x17')){_0x46aa52[_0x2e2c('0x1b')]=_0x5d3d48['id'];}else if(_0x5d3d48[_0x2e2c('0x14')]===_0x2e2c('0x15')&&_0x5a9bb6['leadId']){_0x46aa52[_0x5a9bb6[_0x2e2c('0x1c')]]=_0x5d3d48['id'];}else{logger[_0x2e2c('0x1d')](_0x2e2c('0x1e'));}}}return _0x502757[_0x2e2c('0x1f')](_0x5a9bb6[_0x2e2c('0xf')])['create'](_0x46aa52);}function getUser(_0x1c3396,_0x22771e,_0x36f075){if(!_[_0x2e2c('0x20')](_0x22771e)&&intUtil[_0x2e2c('0x21')](_0x22771e)){var _0x4030b1={'Email':_0x22771e};var _0x2cd73f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x36f075[_0x2e2c('0x1f')](_0x2e2c('0x22'))[_0x2e2c('0x23')](_0x4030b1,_0x2cd73f)[_0x2e2c('0x24')]()[_0x2e2c('0x25')](function(_0x5f2c75){if(_0x5f2c75[_0x2e2c('0x26')]){var _0x38fa32=_[_0x2e2c('0x23')](_0x5f2c75,function(_0x5bd22b){return _0x5bd22b['Email']===_0x22771e;});if(_0x38fa32){logger[_0x2e2c('0x1d')]('Agent\x20%s\x20found.',_0x22771e);return BPromise['resolve']({'id':_0x38fa32['Id'],'name':_0x38fa32[_0x2e2c('0x27')]});}}else{logger['info'](_0x2e2c('0x28'),_0x22771e);return _0x36f075[_0x2e2c('0x29')]()[_0x2e2c('0x25')](function(_0xc7cf9b){return BPromise[_0x2e2c('0x2a')]({'id':_0xc7cf9b[_0x2e2c('0x2b')],'name':_0xc7cf9b['display_name']});});}});}else{logger[_0x2e2c('0x1d')](_0x2e2c('0x28'),_0x22771e);return _0x36f075['identity']()[_0x2e2c('0x25')](function(_0x2ee11b){return BPromise[_0x2e2c('0x2a')]({'id':_0x2ee11b[_0x2e2c('0x2b')],'name':_0x2ee11b[_0x2e2c('0x2c')]});});}}function getEndUser(_0x42080a,_0x21970f,_0x891dc8,_0x4cd1fc,_0x50f1d2){var _0x4e8e7f={'$or':{'Phone':_0x4cd1fc}};var _0xf3e84e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2e2c('0x2a')]()[_0x2e2c('0x25')](function(){logger[_0x2e2c('0x1d')](_0x2e2c('0x2d'),_0x4cd1fc,_0x21970f[_0x2e2c('0x2e')]);switch(_0x21970f[_0x2e2c('0x2e')]){case _0x2e2c('0x2f'):var _0x3a56dc=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f[_0x2e2c('0x31')]){var _0xbe7009={};_0xbe7009[_0x21970f[_0x2e2c('0x31')]]=_0x4cd1fc;_[_0x2e2c('0x32')](_0x3a56dc['$or'],_0xbe7009);}return _0x50f1d2[_0x2e2c('0x1f')](_0x2e2c('0x33'))['find'](_0x3a56dc,_0xf3e84e)['execute']()['then'](function(_0x305040){if(_0x305040&&_0x305040['length']){return _0x305040;}else{var _0x2df4ba=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f['additionalSearchLead']){var _0x107445={};_0x107445[_0x21970f[_0x2e2c('0x34')]]=_0x4cd1fc;_[_0x2e2c('0x32')](_0x2df4ba['$or'],_0x107445);}return _0x50f1d2[_0x2e2c('0x1f')](_0x2e2c('0x35'))[_0x2e2c('0x23')](_0x2df4ba,_0xf3e84e);}});case _0x2e2c('0x36'):var _0x1552be=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f[_0x2e2c('0x37')]){var _0xbe7009={};_0xbe7009[_0x21970f[_0x2e2c('0x37')]]=_0x4cd1fc;_[_0x2e2c('0x32')](_0x1552be[_0x2e2c('0x38')],_0xbe7009);}return _0x50f1d2[_0x2e2c('0x1f')](_0x2e2c('0x39'))['find'](_0x1552be,_0xf3e84e)[_0x2e2c('0x24')]()[_0x2e2c('0x25')](function(_0x50a148){if(_0x50a148&&_0x50a148['length']){return _0x50a148;}else{var _0x4e04b5=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f[_0x2e2c('0x31')]){var _0x39ab71={};_0x39ab71[_0x21970f[_0x2e2c('0x31')]]=_0x4cd1fc;_['merge'](_0x4e04b5[_0x2e2c('0x38')],_0x39ab71);}return _0x50f1d2[_0x2e2c('0x1f')](_0x2e2c('0x33'))[_0x2e2c('0x23')](_0x4e04b5,_0xf3e84e)[_0x2e2c('0x25')](function(_0x52c310){if(_0x52c310&&_0x52c310[_0x2e2c('0x26')]){return _0x52c310;}else{var _0x99a613=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f[_0x2e2c('0x34')]){var _0xce0bd9={};_0xce0bd9[_0x21970f['additionalSearchLead']]=_0x4cd1fc;_[_0x2e2c('0x32')](_0x99a613[_0x2e2c('0x38')],_0xce0bd9);}return _0x50f1d2['sobject'](_0x2e2c('0x35'))[_0x2e2c('0x23')](_0x99a613,_0xf3e84e);}});}});case _0x2e2c('0x19'):var _0x3a56dc=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f['additionalSearchContact']){var _0xbe7009={};_0xbe7009[_0x21970f[_0x2e2c('0x31')]]=_0x4cd1fc;_['merge'](_0x3a56dc['$or'],_0xbe7009);}return _0x50f1d2[_0x2e2c('0x1f')]('Contact')[_0x2e2c('0x23')](_0x3a56dc,_0xf3e84e)[_0x2e2c('0x24')]();case _0x2e2c('0x15'):var _0x25a5a1=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f[_0x2e2c('0x34')]){var _0xbe7009={};_0xbe7009[_0x21970f['additionalSearchLead']]=_0x4cd1fc;_['merge'](_0x25a5a1[_0x2e2c('0x38')],_0xbe7009);}return _0x50f1d2['sobject'](_0x2e2c('0x35'))[_0x2e2c('0x23')](_0x25a5a1,_0xf3e84e);case _0x2e2c('0x17'):var _0x1552be=_[_0x2e2c('0x30')](_0x4e8e7f);if(_0x21970f[_0x2e2c('0x37')]){var _0xbe7009={};_0xbe7009[_0x21970f[_0x2e2c('0x37')]]=_0x4cd1fc;_[_0x2e2c('0x32')](_0x1552be[_0x2e2c('0x38')],_0xbe7009);}return _0x50f1d2[_0x2e2c('0x1f')](_0x2e2c('0x39'))[_0x2e2c('0x23')](_0x1552be,_0xf3e84e);default:return null;}})[_0x2e2c('0x25')](function(_0x8726e7){if(_0x8726e7&&_0x8726e7[_0x2e2c('0x26')]){var _0x2c900a=_[_0x2e2c('0x3a')](_0x8726e7);if(_0x2c900a){return BPromise[_0x2e2c('0x2a')]({'id':_0x2c900a['Id'],'name':_0x2c900a[_0x2e2c('0x27')],'phone':_0x2c900a[_0x2e2c('0x3b')],'endUserType':_0x2c900a[_0x2e2c('0x3c')][_0x2e2c('0x3d')]['toLowerCase']()});}}})[_0x2e2c('0x25')](function(_0x54aab7){if(_0x54aab7){logger['info'](_0x2e2c('0x3e'),_0x54aab7[_0x2e2c('0x14')],_0x4cd1fc);return BPromise[_0x2e2c('0x2a')](_0x54aab7);}else{logger[_0x2e2c('0x1d')](_0x2e2c('0x3f'),_0x4cd1fc);var _0x3b5a8e={'Phone':_0x4cd1fc};if(_0x21970f[_0x2e2c('0x40')]){if(_0x21970f[_0x2e2c('0x40')]===_0x2e2c('0x19')){logger[_0x2e2c('0x1d')](_0x2e2c('0x41'),_0x4cd1fc,_0x21970f['moduleCreate']);_0x3b5a8e[_0x2e2c('0x42')]=_0x891dc8!==_0x2e2c('0x43')?_0x891dc8:util[_0x2e2c('0x44')]('Caller\x20-\x20%s',_0x4cd1fc);}else if(_0x21970f[_0x2e2c('0x40')]===_0x2e2c('0x15')){logger['info'](_0x2e2c('0x41'),_0x4cd1fc,_0x21970f['moduleCreate']);_0x3b5a8e['LastName']=_0x891dc8!==''?_0x891dc8:util[_0x2e2c('0x44')](_0x2e2c('0x45'),_0x4cd1fc);_0x3b5a8e['Company']=_0x2e2c('0x46');}else if(_0x21970f['moduleCreate']==='account'){logger[_0x2e2c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4cd1fc,_0x21970f[_0x2e2c('0x40')]);_0x3b5a8e[_0x2e2c('0x27')]=_0x891dc8!==_0x2e2c('0x43')?_0x891dc8:util['format'](_0x2e2c('0x45'),_0x4cd1fc);}else{return null;}}return _0x50f1d2['sobject'](_['upperFirst'](_0x21970f['moduleCreate']))[_0x2e2c('0x47')](_0x3b5a8e)[_0x2e2c('0x25')](function(_0x2ee48b){return BPromise[_0x2e2c('0x2a')]({'id':_0x2ee48b['id'],'endUserType':_0x21970f[_0x2e2c('0x40')]});});}});}function getCustomFields(_0x167701,_0x5b976b){var _0xbccd16={};if(_0x167701[_0x2e2c('0x26')]>0x0){_[_0x2e2c('0x48')](_0x167701,function(_0x422646){if(_[_0x2e2c('0x49')]([_0x2e2c('0x4a'),_0x2e2c('0x4b')],_0x422646[_0x2e2c('0x3d')])&&_0x422646[_0x2e2c('0x4c')]){_0xbccd16[_0x422646[_0x2e2c('0x4c')]]=_0x422646[_0x2e2c('0x4d')]['toString']();}else if(_0x422646['type']===_0x2e2c('0x4e')&&_0x422646['variableName']&&_0x422646[_0x2e2c('0x4c')]){_0x5b976b[_0x422646[_0x2e2c('0x4f')]]&&(_0xbccd16[_0x422646[_0x2e2c('0x4c')]]=_0x5b976b[_0x422646[_0x2e2c('0x4f')]]['toString']());}else if(_0x422646[_0x2e2c('0x3d')]===_0x2e2c('0x50')&&_0x422646[_0x2e2c('0x51')]&&_0x422646[_0x2e2c('0x51')][_0x2e2c('0x52')]&&_0x422646[_0x2e2c('0x4c')]){_0x5b976b[_0x422646[_0x2e2c('0x51')][_0x2e2c('0x52')][_0x2e2c('0x53')]()]&&(_0xbccd16[_0x422646[_0x2e2c('0x4c')]]=_0x5b976b[_0x422646['Variable'][_0x2e2c('0x52')][_0x2e2c('0x53')]()]['toString']());}});}return _0xbccd16;}function getConnection(_0x520de9){var _0x13127b=_0x520de9[_0x2e2c('0x54')]['concat'](_0x520de9[_0x2e2c('0x55')]);var _0x2ec868=new jsforce[(_0x2e2c('0x56'))]({'oauth2':{'loginUrl':_0x520de9['remoteUri']||_0x2e2c('0x57'),'clientId':_0x520de9[_0x2e2c('0x58')],'clientSecret':_0x520de9[_0x2e2c('0x59')]}});return _0x2ec868['login'](_0x520de9[_0x2e2c('0x5a')],_0x13127b)['then'](function(){logger[_0x2e2c('0x1d')](_0x2e2c('0x5b'));return _0x2ec868;});}exports['queue']=function(_0x200224,_0x169870,_0x52c950,_0x2a1b4e,_0x3bf48e,_0x7dc323){var _0x3d6967,_0x442f74,_0x217773,_0x53f517;_0x7dc323[_0x2e2c('0x5c')]=intUtil[_0x2e2c('0x5d')](_0x7dc323[_0x2e2c('0x5c')]);_0x7dc323[_0x2e2c('0x5e')]=intUtil[_0x2e2c('0x5d')](_0x7dc323[_0x2e2c('0x5e')]);if(_0x3bf48e&&_0x3bf48e[_0x2e2c('0x5f')]){logger[_0x2e2c('0x1d')]('[QUEUE]',_0x2e2c('0x60'));_0x169870['recordingURL']=util[_0x2e2c('0x44')](_0x2e2c('0x61'),_0x7dc323[_0x2e2c('0x5c')],_0x169870[_0x2e2c('0x62')],md5(_0x169870['uniqueid']));}else{_0x169870[_0x2e2c('0x63')]='';}return getConnection(_0x7dc323)[_0x2e2c('0x25')](function(_0x62f9b){_0x53f517=_0x62f9b;return getUser(_0x7dc323,_0x2a1b4e['email'],_0x53f517);})[_0x2e2c('0x25')](function(_0x206bf9){_0x3d6967=_0x206bf9;return getEndUser(_0x7dc323,_0x52c950,_0x169870[_0x2e2c('0x64')],_0x169870['calleridnum'],_0x53f517);})[_0x2e2c('0x25')](function(_0x1327b5){_0x442f74=_0x1327b5;return getTicket(_0x7dc323,_0x3d6967,_0x442f74,_0x52c950,_0x169870,_0x52c950['Fields'],_0x53f517,_0x2e2c('0x65'));})[_0x2e2c('0x25')](function(_0x5f5992){_0x217773=_0x5f5992;logger[_0x2e2c('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x217773['id']);logger[_0x2e2c('0x1d')](_0x2e2c('0x66'),_0x217773['id'],_0x2a1b4e[_0x2e2c('0x52')],_0x7dc323[_0x2e2c('0x3d')]);switch(_0x7dc323[_0x2e2c('0x3d')]){case _0x2e2c('0x67'):emit(util[_0x2e2c('0x44')](_0x2e2c('0x68'),_0x2a1b4e['name']),_0x2e2c('0x69'),{'recordId':_0x217773['id']});break;case _0x2e2c('0x6a'):emit(util['format'](_0x2e2c('0x68'),_0x2a1b4e[_0x2e2c('0x52')]),'trigger:browser:url',{'uri':util[_0x2e2c('0x44')](_0x2e2c('0x6b'),_0x53f517[_0x2e2c('0x6c')],_0x217773['id'])});break;default:logger[_0x2e2c('0x6d')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x1d5126){logger['error']('[QUEUE]',_0x1d5126);});};exports[_0x2e2c('0x6e')]=function(_0x5e89ff,_0x983e40,_0x1cdb5a,_0x109501,_0x2396eb,_0x6d3f3,_0x5cb08c){var _0x34c8c7,_0x5022d3,_0x11d56a,_0x4f4f95;_0x6d3f3[_0x2e2c('0x5c')]=intUtil[_0x2e2c('0x5d')](_0x6d3f3[_0x2e2c('0x5c')]);_0x6d3f3['remoteUri']=intUtil[_0x2e2c('0x5d')](_0x6d3f3['remoteUri']);if(_0x5cb08c&&_0x5cb08c[_0x2e2c('0x6f')]&&_0x5cb08c[_0x2e2c('0x6f')]!==_0x2e2c('0x70')){logger[_0x2e2c('0x1d')]('[OUTBOUND]',_0x2e2c('0x60'));_0x983e40[_0x2e2c('0x63')]=util[_0x2e2c('0x44')](_0x2e2c('0x61'),_0x6d3f3[_0x2e2c('0x5c')],_0x983e40[_0x2e2c('0x62')],md5(_0x983e40['uniqueid']));}return getConnection(_0x6d3f3)[_0x2e2c('0x25')](function(_0x1601a0){_0x4f4f95=_0x1601a0;return getUser(_0x6d3f3,_0x109501[_0x2e2c('0x71')],_0x4f4f95);})[_0x2e2c('0x25')](function(_0x4757cb){_0x34c8c7=_0x4757cb;return getEndUser(_0x6d3f3,_0x1cdb5a,_0x983e40[_0x2e2c('0x72')],_0x983e40['destcalleridnum'],_0x4f4f95);})[_0x2e2c('0x25')](function(_0x272e23){_0x5022d3=_0x272e23;return getTicket(_0x6d3f3,_0x34c8c7,_0x5022d3,_0x1cdb5a,_0x983e40,_0x1cdb5a[_0x2e2c('0x73')],_0x4f4f95,_0x2e2c('0x6e'));})[_0x2e2c('0x25')](function(_0x26b105){_0x11d56a=_0x26b105;logger[_0x2e2c('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x11d56a['id']);logger[_0x2e2c('0x1d')](_0x2e2c('0x74'),_0x11d56a['id'],_0x109501[_0x2e2c('0x52')],_0x6d3f3[_0x2e2c('0x3d')]);switch(_0x6d3f3[_0x2e2c('0x3d')]){case _0x2e2c('0x67'):emit(util['format']('user:%s',_0x109501[_0x2e2c('0x52')]),_0x2e2c('0x69'),{'recordId':_0x11d56a['id']});break;case _0x2e2c('0x6a'):emit(util[_0x2e2c('0x44')](_0x2e2c('0x68'),_0x109501[_0x2e2c('0x52')]),_0x2e2c('0x75'),{'uri':util[_0x2e2c('0x44')](_0x2e2c('0x6b'),_0x4f4f95[_0x2e2c('0x6c')],_0x11d56a['id'])});break;default:logger[_0x2e2c('0x6d')](_0x2e2c('0x76'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x2e2c('0x77')](function(_0xa97e95){logger[_0x2e2c('0x6d')]('[OUTBOUND]',_0xa97e95);});};exports[_0x2e2c('0x78')]=function(_0x24e80d,_0x17ea64,_0x5b61cf,_0x329785,_0x523c87,_0xf67dbd){var _0x458c3e,_0x376567,_0x1f6399,_0x5f1cfc;_0xf67dbd[_0x2e2c('0x5c')]=intUtil[_0x2e2c('0x5d')](_0xf67dbd[_0x2e2c('0x5c')]);_0xf67dbd['remoteUri']=intUtil[_0x2e2c('0x5d')](_0xf67dbd['remoteUri']);if(_0x523c87&&_0x523c87[_0x2e2c('0x5f')]){logger[_0x2e2c('0x1d')]('['+_0x17ea64[_0x2e2c('0x79')][_0x2e2c('0x7a')]()+']',_0x2e2c('0x60'));_0x17ea64[_0x2e2c('0x63')]=util[_0x2e2c('0x44')](_0x2e2c('0x61'),_0xf67dbd[_0x2e2c('0x5c')],_0x17ea64[_0x2e2c('0x62')],md5(_0x17ea64['uniqueid']));}else{_0x17ea64[_0x2e2c('0x63')]='';}return getConnection(_0xf67dbd)[_0x2e2c('0x25')](function(_0x117421){_0x5f1cfc=_0x117421;if(!_[_0x2e2c('0x20')](_0x329785)){return getUser(_0xf67dbd,_0x329785[_0x2e2c('0x52')],_0x5f1cfc);}else{return getUser(_0xf67dbd,null,_0x5f1cfc);}})['then'](function(_0x5fb0ab){_0x458c3e=_0x5fb0ab;return getEndUser(_0xf67dbd,_0x5b61cf,_0x17ea64['calleridname'],_0x17ea64[_0x2e2c('0x7b')],_0x5f1cfc);})[_0x2e2c('0x25')](function(_0x51981e){_0x376567=_0x51981e;return getTicket(_0xf67dbd,_0x458c3e,_0x376567,_0x5b61cf,_0x17ea64,_0x5b61cf[_0x2e2c('0x73')],_0x5f1cfc);})[_0x2e2c('0x25')](function(_0x32163c){_0x1f6399=_0x32163c;logger[_0x2e2c('0x1d')]('['+_0x17ea64[_0x2e2c('0x79')][_0x2e2c('0x7a')]()+_0x2e2c('0x7c'),_0x1f6399['id']);logger['info']('['+_0x17ea64[_0x2e2c('0x79')][_0x2e2c('0x7a')]()+_0x2e2c('0x7d'),_0xf67dbd[_0x2e2c('0x3d')]);})[_0x2e2c('0x77')](function(_0x3d7235){logger['error']('['+_0x17ea64['lastevent'][_0x2e2c('0x7a')]()+']',_0x3d7235);});}; \ No newline at end of file +var _0xc487=['Company','No\x20Company','Name','upperFirst','forEach','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','','format'];(function(_0x52991d,_0x429d72){var _0x5b9004=function(_0x4bfe0d){while(--_0x4bfe0d){_0x52991d['push'](_0x52991d['shift']());}};_0x5b9004(++_0x429d72);}(_0xc487,0x134));var _0x7c48=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0xc487[_0x416a0a];return _0x574c9f;};'use strict';var _=require(_0x7c48('0x0'));var rp=require(_0x7c48('0x1'));var moment=require(_0x7c48('0x2'));var BPromise=require('bluebird');var md5=require(_0x7c48('0x3'));var jsforce=require(_0x7c48('0x4'));var util=require(_0x7c48('0x5'));var Redis=require(_0x7c48('0x6'));var intUtil=require(_0x7c48('0x7'));var config=require(_0x7c48('0x8'));var logger=require(_0x7c48('0x9'))(_0x7c48('0xa'));config[_0x7c48('0xb')]=_['defaults'](config[_0x7c48('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x7c48('0xc'))(new Redis(config[_0x7c48('0xb')]));function emit(_0x4cadc,_0x218153,_0x526a24){io['to'](_0x4cadc)['emit'](_0x218153,_0x526a24);}function getTicket(_0x4c60f1,_0x18555f,_0x1deea4,_0x2d308e,_0x3ae8ef,_0x2a7c09,_0x46c60f,_0x188b38){var _0x52ede3=Object['assign']({},{'OwnerId':_0x18555f['id'],'Subject':intUtil[_0x7c48('0xd')](_0x2d308e[_0x7c48('0xe')],_0x3ae8ef,'\x20'),'Description':intUtil[_0x7c48('0xd')](_0x2d308e[_0x7c48('0xf')],_0x3ae8ef,'\x0a')},getCustomFields(_0x2a7c09,_0x3ae8ef));if(_0x1deea4){if(_0x2d308e['ticketType']===_0x7c48('0x10')){_0x52ede3[_0x7c48('0x11')]=moment[_0x7c48('0x12')]();_0x52ede3[_0x7c48('0x13')]=![];_0x52ede3[_0x7c48('0x14')]=![];if(_0x1deea4[_0x7c48('0x15')]===_0x7c48('0x16')||_0x1deea4[_0x7c48('0x15')]===_0x7c48('0x17')){_0x52ede3['WhoId']=_0x1deea4['id'];}else if(_0x1deea4[_0x7c48('0x15')]===_0x7c48('0x18')){_0x52ede3[_0x7c48('0x19')]=_0x1deea4['id'];}}else if(_0x2d308e[_0x7c48('0x1a')]===_0x7c48('0x1b')){if(_0x1deea4[_0x7c48('0x15')]===_0x7c48('0x16')){_0x52ede3[_0x7c48('0x1c')]=_0x1deea4['id'];}else if(_0x1deea4[_0x7c48('0x15')]===_0x7c48('0x18')){_0x52ede3[_0x7c48('0x1d')]=_0x1deea4['id'];}else if(_0x1deea4[_0x7c48('0x15')]===_0x7c48('0x17')&&_0x2d308e[_0x7c48('0x1e')]){_0x52ede3[_0x2d308e['leadId']]=_0x1deea4['id'];}else{logger[_0x7c48('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x46c60f['sobject'](_0x2d308e[_0x7c48('0x1a')])[_0x7c48('0x20')](_0x52ede3);}function getUser(_0x50fdb1,_0x5ab7f7,_0x45370f){if(!_[_0x7c48('0x21')](_0x5ab7f7)&&intUtil[_0x7c48('0x22')](_0x5ab7f7)){var _0x4d53db={'Email':_0x5ab7f7};var _0x20bc59={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x45370f[_0x7c48('0x23')](_0x7c48('0x24'))[_0x7c48('0x25')](_0x4d53db,_0x20bc59)[_0x7c48('0x26')]()[_0x7c48('0x27')](function(_0x579637){if(_0x579637[_0x7c48('0x28')]){var _0x17ffa3=_['find'](_0x579637,function(_0x36abcf){return _0x36abcf[_0x7c48('0x29')]===_0x5ab7f7;});if(_0x17ffa3){logger[_0x7c48('0x1f')](_0x7c48('0x2a'),_0x5ab7f7);return BPromise[_0x7c48('0x2b')]({'id':_0x17ffa3['Id'],'name':_0x17ffa3['Name']});}}else{logger['info'](_0x7c48('0x2c'),_0x5ab7f7);return _0x45370f['identity']()['then'](function(_0x4cb84b){return BPromise[_0x7c48('0x2b')]({'id':_0x4cb84b[_0x7c48('0x2d')],'name':_0x4cb84b[_0x7c48('0x2e')]});});}});}else{logger[_0x7c48('0x1f')](_0x7c48('0x2c'),_0x5ab7f7);return _0x45370f[_0x7c48('0x2f')]()[_0x7c48('0x27')](function(_0x4d283a){return BPromise[_0x7c48('0x2b')]({'id':_0x4d283a[_0x7c48('0x2d')],'name':_0x4d283a['display_name']});});}}function getEndUser(_0x504f00,_0x25f0a6,_0x16339d,_0x21f7f6,_0x363f67){var _0x3fd447={'$or':{'Phone':_0x21f7f6}};var _0x5ce565={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x7c48('0x27')](function(){logger[_0x7c48('0x1f')](_0x7c48('0x30'),_0x21f7f6,_0x25f0a6[_0x7c48('0x31')]);switch(_0x25f0a6['moduleSearch']){case'contact_lead':var _0x24644f=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6[_0x7c48('0x33')]){var _0x16aff5={};_0x16aff5[_0x25f0a6[_0x7c48('0x33')]]=_0x21f7f6;_['merge'](_0x24644f[_0x7c48('0x34')],_0x16aff5);}return _0x363f67[_0x7c48('0x23')](_0x7c48('0x35'))[_0x7c48('0x25')](_0x24644f,_0x5ce565)[_0x7c48('0x26')]()[_0x7c48('0x27')](function(_0x5c5392){if(_0x5c5392&&_0x5c5392['length']){return _0x5c5392;}else{var _0x5eaeb4=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6['additionalSearchLead']){var _0xf1e185={};_0xf1e185[_0x25f0a6[_0x7c48('0x36')]]=_0x21f7f6;_[_0x7c48('0x37')](_0x5eaeb4['$or'],_0xf1e185);}return _0x363f67[_0x7c48('0x23')](_0x7c48('0x38'))[_0x7c48('0x25')](_0x5eaeb4,_0x5ce565);}});case _0x7c48('0x39'):var _0x1366b2=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6['additionalSearchAccount']){var _0x16aff5={};_0x16aff5[_0x25f0a6[_0x7c48('0x3a')]]=_0x21f7f6;_[_0x7c48('0x37')](_0x1366b2[_0x7c48('0x34')],_0x16aff5);}return _0x363f67[_0x7c48('0x23')](_0x7c48('0x3b'))[_0x7c48('0x25')](_0x1366b2,_0x5ce565)[_0x7c48('0x26')]()[_0x7c48('0x27')](function(_0x426e2d){if(_0x426e2d&&_0x426e2d[_0x7c48('0x28')]){return _0x426e2d;}else{var _0x42982e=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6[_0x7c48('0x33')]){var _0x794916={};_0x794916[_0x25f0a6[_0x7c48('0x33')]]=_0x21f7f6;_[_0x7c48('0x37')](_0x42982e[_0x7c48('0x34')],_0x794916);}return _0x363f67['sobject'](_0x7c48('0x35'))[_0x7c48('0x25')](_0x42982e,_0x5ce565)[_0x7c48('0x27')](function(_0x2e2e1b){if(_0x2e2e1b&&_0x2e2e1b[_0x7c48('0x28')]){return _0x2e2e1b;}else{var _0x1eb525=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6['additionalSearchLead']){var _0x3eebd9={};_0x3eebd9[_0x25f0a6['additionalSearchLead']]=_0x21f7f6;_[_0x7c48('0x37')](_0x1eb525[_0x7c48('0x34')],_0x3eebd9);}return _0x363f67[_0x7c48('0x23')](_0x7c48('0x38'))[_0x7c48('0x25')](_0x1eb525,_0x5ce565);}});}});case _0x7c48('0x16'):var _0x24644f=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6['additionalSearchContact']){var _0x16aff5={};_0x16aff5[_0x25f0a6[_0x7c48('0x33')]]=_0x21f7f6;_['merge'](_0x24644f[_0x7c48('0x34')],_0x16aff5);}return _0x363f67[_0x7c48('0x23')]('Contact')[_0x7c48('0x25')](_0x24644f,_0x5ce565)[_0x7c48('0x26')]();case _0x7c48('0x17'):var _0x423c68=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6[_0x7c48('0x36')]){var _0x16aff5={};_0x16aff5[_0x25f0a6[_0x7c48('0x36')]]=_0x21f7f6;_['merge'](_0x423c68[_0x7c48('0x34')],_0x16aff5);}return _0x363f67['sobject'](_0x7c48('0x38'))[_0x7c48('0x25')](_0x423c68,_0x5ce565);case _0x7c48('0x18'):var _0x1366b2=_[_0x7c48('0x32')](_0x3fd447);if(_0x25f0a6[_0x7c48('0x3a')]){var _0x16aff5={};_0x16aff5[_0x25f0a6[_0x7c48('0x3a')]]=_0x21f7f6;_['merge'](_0x1366b2[_0x7c48('0x34')],_0x16aff5);}return _0x363f67[_0x7c48('0x23')]('Account')[_0x7c48('0x25')](_0x1366b2,_0x5ce565);default:return null;}})[_0x7c48('0x27')](function(_0x2a67b2){if(_0x2a67b2&&_0x2a67b2[_0x7c48('0x28')]){var _0x564db1=_[_0x7c48('0x3c')](_0x2a67b2);if(_0x564db1){return BPromise[_0x7c48('0x2b')]({'id':_0x564db1['Id'],'name':_0x564db1['Name'],'phone':_0x564db1[_0x7c48('0x3d')],'endUserType':_0x564db1[_0x7c48('0x3e')][_0x7c48('0x3f')][_0x7c48('0x40')]()});}}})[_0x7c48('0x27')](function(_0xc99e6f){if(_0xc99e6f){logger[_0x7c48('0x1f')](_0x7c48('0x41'),_0xc99e6f[_0x7c48('0x15')],_0x21f7f6);return BPromise[_0x7c48('0x2b')](_0xc99e6f);}else{logger[_0x7c48('0x1f')](_0x7c48('0x42'),_0x21f7f6);var _0x52cfda={'Phone':_0x21f7f6};if(_0x25f0a6[_0x7c48('0x43')]){if(_0x25f0a6[_0x7c48('0x43')]===_0x7c48('0x16')){logger[_0x7c48('0x1f')](_0x7c48('0x44'),_0x21f7f6,_0x25f0a6['moduleCreate']);_0x52cfda[_0x7c48('0x45')]=_0x16339d!==''?_0x16339d:util['format'](_0x7c48('0x46'),_0x21f7f6);}else if(_0x25f0a6['moduleCreate']===_0x7c48('0x17')){logger[_0x7c48('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x21f7f6,_0x25f0a6[_0x7c48('0x43')]);_0x52cfda[_0x7c48('0x45')]=_0x16339d!==_0x7c48('0x47')?_0x16339d:util[_0x7c48('0x48')](_0x7c48('0x46'),_0x21f7f6);_0x52cfda[_0x7c48('0x49')]=_0x7c48('0x4a');}else if(_0x25f0a6[_0x7c48('0x43')]===_0x7c48('0x18')){logger[_0x7c48('0x1f')](_0x7c48('0x44'),_0x21f7f6,_0x25f0a6[_0x7c48('0x43')]);_0x52cfda[_0x7c48('0x4b')]=_0x16339d!==_0x7c48('0x47')?_0x16339d:util[_0x7c48('0x48')](_0x7c48('0x46'),_0x21f7f6);}else{return null;}}return _0x363f67[_0x7c48('0x23')](_[_0x7c48('0x4c')](_0x25f0a6[_0x7c48('0x43')]))[_0x7c48('0x20')](_0x52cfda)['then'](function(_0x327a8c){return BPromise[_0x7c48('0x2b')]({'id':_0x327a8c['id'],'endUserType':_0x25f0a6[_0x7c48('0x43')]});});}});}function getCustomFields(_0x2b011e,_0x423b9a){var _0x379975={};if(_0x2b011e[_0x7c48('0x28')]>0x0){_[_0x7c48('0x4d')](_0x2b011e,function(_0x314009){if(_[_0x7c48('0x4e')](['string',_0x7c48('0x4f')],_0x314009['type'])&&_0x314009[_0x7c48('0x50')]){_0x379975[_0x314009['idField']]=_0x314009[_0x7c48('0x51')][_0x7c48('0x52')]();}else if(_0x314009[_0x7c48('0x3f')]===_0x7c48('0x53')&&_0x314009['variableName']&&_0x314009['idField']){_0x423b9a[_0x314009[_0x7c48('0x54')]]&&(_0x379975[_0x314009[_0x7c48('0x50')]]=_0x423b9a[_0x314009[_0x7c48('0x54')]]['toString']());}else if(_0x314009[_0x7c48('0x3f')]===_0x7c48('0x55')&&_0x314009[_0x7c48('0x56')]&&_0x314009[_0x7c48('0x56')][_0x7c48('0x57')]&&_0x314009['idField']){_0x423b9a[_0x314009[_0x7c48('0x56')][_0x7c48('0x57')]['toLowerCase']()]&&(_0x379975[_0x314009[_0x7c48('0x50')]]=_0x423b9a[_0x314009[_0x7c48('0x56')]['name'][_0x7c48('0x40')]()][_0x7c48('0x52')]());}});}return _0x379975;}function getConnection(_0x23fa8d){var _0x4ca13b=_0x23fa8d['password']['concat'](_0x23fa8d[_0x7c48('0x58')]);var _0x181f2f=new jsforce[(_0x7c48('0x59'))]({'oauth2':{'loginUrl':_0x23fa8d[_0x7c48('0x5a')]||_0x7c48('0x5b'),'clientId':_0x23fa8d['clientId'],'clientSecret':_0x23fa8d[_0x7c48('0x5c')]}});return _0x181f2f[_0x7c48('0x5d')](_0x23fa8d['username'],_0x4ca13b)['then'](function(){logger[_0x7c48('0x1f')](_0x7c48('0x5e'));return _0x181f2f;});}exports['queue']=function(_0x9f0fcc,_0x340575,_0x151abb,_0x369ad7,_0x4ed3c7,_0xbf6eaa){var _0x2062a0,_0x3b1d14,_0x30e1f0,_0x2e0915;_0xbf6eaa['serverUrl']=intUtil[_0x7c48('0x5f')](_0xbf6eaa[_0x7c48('0x60')]);_0xbf6eaa[_0x7c48('0x5a')]=intUtil[_0x7c48('0x5f')](_0xbf6eaa['remoteUri']);if(_0x4ed3c7&&_0x4ed3c7['monitor_format']){logger['info'](_0x7c48('0x61'),'Recording\x20is\x20enabled!');_0x340575[_0x7c48('0x62')]=util['format'](_0x7c48('0x63'),_0xbf6eaa[_0x7c48('0x60')],_0x340575[_0x7c48('0x64')],md5(_0x340575[_0x7c48('0x64')]));}else{_0x340575[_0x7c48('0x62')]='';}return getConnection(_0xbf6eaa)[_0x7c48('0x27')](function(_0x50d19c){_0x2e0915=_0x50d19c;return getUser(_0xbf6eaa,_0x369ad7[_0x7c48('0x65')],_0x2e0915);})['then'](function(_0x1c64f0){_0x2062a0=_0x1c64f0;return getEndUser(_0xbf6eaa,_0x151abb,_0x340575[_0x7c48('0x66')],_0x340575[_0x7c48('0x67')],_0x2e0915);})['then'](function(_0x201102){_0x3b1d14=_0x201102;return getTicket(_0xbf6eaa,_0x2062a0,_0x3b1d14,_0x151abb,_0x340575,_0x151abb[_0x7c48('0x68')],_0x2e0915,_0x7c48('0x69'));})[_0x7c48('0x27')](function(_0x385873){_0x30e1f0=_0x385873;logger[_0x7c48('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x30e1f0['id']);logger[_0x7c48('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x30e1f0['id'],_0x369ad7[_0x7c48('0x57')],_0xbf6eaa[_0x7c48('0x3f')]);switch(_0xbf6eaa[_0x7c48('0x3f')]){case'integrationTab':emit(util[_0x7c48('0x48')](_0x7c48('0x6a'),_0x369ad7['name']),_0x7c48('0x6b'),{'recordId':_0x30e1f0['id']});break;case _0x7c48('0x6c'):emit(util[_0x7c48('0x48')](_0x7c48('0x6a'),_0x369ad7[_0x7c48('0x57')]),_0x7c48('0x6d'),{'uri':util[_0x7c48('0x48')](_0x7c48('0x6e'),_0x2e0915['instanceUrl'],_0x30e1f0['id'])});break;default:logger[_0x7c48('0x6f')](_0x7c48('0x70'));}})[_0x7c48('0x71')](function(_0x2bb905){logger['error'](_0x7c48('0x61'),_0x2bb905);});};exports['outbound']=function(_0x361cf5,_0x356f44,_0x313127,_0x15cc6e,_0x2e9ed5,_0x3d6e32,_0x11b167){var _0x160459,_0x1aa49c,_0x52ae2c,_0x1193cf;_0x3d6e32[_0x7c48('0x60')]=intUtil[_0x7c48('0x5f')](_0x3d6e32[_0x7c48('0x60')]);_0x3d6e32[_0x7c48('0x5a')]=intUtil[_0x7c48('0x5f')](_0x3d6e32[_0x7c48('0x5a')]);if(_0x11b167&&_0x11b167[_0x7c48('0x72')]&&_0x11b167[_0x7c48('0x72')]!=='none'){logger[_0x7c48('0x1f')](_0x7c48('0x73'),'Recording\x20is\x20enabled!');_0x356f44[_0x7c48('0x62')]=util[_0x7c48('0x48')](_0x7c48('0x63'),_0x3d6e32[_0x7c48('0x60')],_0x356f44[_0x7c48('0x64')],md5(_0x356f44[_0x7c48('0x64')]));}return getConnection(_0x3d6e32)[_0x7c48('0x27')](function(_0x29141b){_0x1193cf=_0x29141b;return getUser(_0x3d6e32,_0x15cc6e[_0x7c48('0x65')],_0x1193cf);})[_0x7c48('0x27')](function(_0x5eae31){_0x160459=_0x5eae31;return getEndUser(_0x3d6e32,_0x313127,_0x356f44[_0x7c48('0x74')],_0x356f44['destcalleridnum'],_0x1193cf);})['then'](function(_0x303ce8){_0x1aa49c=_0x303ce8;return getTicket(_0x3d6e32,_0x160459,_0x1aa49c,_0x313127,_0x356f44,_0x313127[_0x7c48('0x68')],_0x1193cf,_0x7c48('0x75'));})[_0x7c48('0x27')](function(_0x3afd9f){_0x52ae2c=_0x3afd9f;logger['info'](_0x7c48('0x76'),_0x52ae2c['id']);logger['info'](_0x7c48('0x77'),_0x52ae2c['id'],_0x15cc6e[_0x7c48('0x57')],_0x3d6e32[_0x7c48('0x3f')]);switch(_0x3d6e32[_0x7c48('0x3f')]){case _0x7c48('0x78'):emit(util[_0x7c48('0x48')]('user:%s',_0x15cc6e[_0x7c48('0x57')]),_0x7c48('0x6b'),{'recordId':_0x52ae2c['id']});break;case _0x7c48('0x6c'):emit(util[_0x7c48('0x48')]('user:%s',_0x15cc6e[_0x7c48('0x57')]),_0x7c48('0x6d'),{'uri':util[_0x7c48('0x48')]('%s/%s/e',_0x1193cf['instanceUrl'],_0x52ae2c['id'])});break;default:logger[_0x7c48('0x6f')](_0x7c48('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x7c48('0x71')](function(_0x4ebc01){logger[_0x7c48('0x6f')](_0x7c48('0x73'),_0x4ebc01);});};exports[_0x7c48('0x79')]=function(_0x3f847e,_0x5a093c,_0x1fc168,_0x498373,_0x1a4c96,_0x505f0d){var _0xc92a89,_0x2061aa,_0x2b90ce,_0xf50fd6;_0x505f0d[_0x7c48('0x60')]=intUtil[_0x7c48('0x5f')](_0x505f0d['serverUrl']);_0x505f0d[_0x7c48('0x5a')]=intUtil[_0x7c48('0x5f')](_0x505f0d['remoteUri']);if(_0x1a4c96&&_0x1a4c96[_0x7c48('0x7a')]){logger[_0x7c48('0x1f')]('['+_0x5a093c[_0x7c48('0x7b')][_0x7c48('0x7c')]()+']',_0x7c48('0x7d'));_0x5a093c[_0x7c48('0x62')]=util[_0x7c48('0x48')](_0x7c48('0x63'),_0x505f0d[_0x7c48('0x60')],_0x5a093c['uniqueid'],md5(_0x5a093c['uniqueid']));}else{_0x5a093c[_0x7c48('0x62')]='';}return getConnection(_0x505f0d)[_0x7c48('0x27')](function(_0x30c1ac){_0xf50fd6=_0x30c1ac;if(!_[_0x7c48('0x21')](_0x498373)){return getUser(_0x505f0d,_0x498373[_0x7c48('0x57')],_0xf50fd6);}else{return getUser(_0x505f0d,null,_0xf50fd6);}})[_0x7c48('0x27')](function(_0x311eda){_0xc92a89=_0x311eda;return getEndUser(_0x505f0d,_0x1fc168,_0x5a093c[_0x7c48('0x66')],_0x5a093c[_0x7c48('0x67')],_0xf50fd6);})[_0x7c48('0x27')](function(_0x6498e9){_0x2061aa=_0x6498e9;return getTicket(_0x505f0d,_0xc92a89,_0x2061aa,_0x1fc168,_0x5a093c,_0x1fc168[_0x7c48('0x68')],_0xf50fd6);})[_0x7c48('0x27')](function(_0x3d06b9){_0x2b90ce=_0x3d06b9;logger['info']('['+_0x5a093c[_0x7c48('0x7b')][_0x7c48('0x7c')]()+_0x7c48('0x7e'),_0x2b90ce['id']);logger['info']('['+_0x5a093c['lastevent'][_0x7c48('0x7c')]()+']\x20Integration\x20account\x20type\x20%s.',_0x505f0d[_0x7c48('0x3f')]);})[_0x7c48('0x71')](function(_0x1c8b3a){logger[_0x7c48('0x6f')]('['+_0x5a093c[_0x7c48('0x7b')]['toUpperCase']()+']',_0x1c8b3a);});}; \ 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 4808ec0..9ca68c2 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 _0xc391=['],\x20getUser\x20entity','length','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','endUserNumber','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','toLowerCase','content','toString','includes','customField','idField','variable','variableName','name','outbound','POST','assign','getString','Subjects','Descriptions','Fields','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','incident','Incident','ticketId','ticketNumber','push','all','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','ioredis','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0xc391,0x115));var _0x1c39=function(_0x34ef59,_0x5a20de){_0x34ef59=_0x34ef59-0x0;var _0x510357=_0xc391[_0x34ef59];return _0x510357;};'use strict';var _=require(_0x1c39('0x0'));var Promise=require(_0x1c39('0x1'));var rp=require(_0x1c39('0x2'));var util=require(_0x1c39('0x3'));var md5=require('md5');var Redis=require(_0x1c39('0x4'));var intUtil=require('./util');var config=require(_0x1c39('0x5'));var logger=require('../../../../config/logger')(_0x1c39('0x6'));config[_0x1c39('0x7')]=_['defaults'](config[_0x1c39('0x7')],{'host':_0x1c39('0x8'),'port':0x18eb});var io=require(_0x1c39('0x9'))(new Redis(config[_0x1c39('0x7')]));function getAdminUser(_0x255fca,_0x2b71ff,_0x1e82c7,_0x57222f,_0xba036a,_0x478292){return new Promise(function(_0x4ec785,_0xa48b31){var _0x1df258={'method':_0x1c39('0xa'),'uri':_0x57222f+_0x1c39('0xb')+'&'+_0xba036a+'&'+_0x478292,'auth':_0x2b71ff,'json':!![]};return rp(_0x1df258)[_0x1c39('0xc')](function(_0x1e62fc){if(_0x1e62fc[_0x1c39('0xd')]['length']>0x0){_0x1e82c7['adminId']=_0x1e62fc[_0x1c39('0xd')][0x0][_0x1c39('0xe')];}logger[_0x1c39('0xf')]('['+[_0x255fca[_0x1c39('0x10')]()]+_0x1c39('0x11'),_0x1e82c7);_0x4ec785(_0x1e82c7);})['catch'](function(_0x30fe75){logger[_0x1c39('0x12')]('['+[_0x255fca['toUpperCase']()]+']',_0x30fe75[_0x1c39('0x13')]);_0xa48b31(_0x30fe75['message']);});});}function getUser(_0x578ad6,_0x2de445,_0x6ebb82,_0x30fb3a,_0x30f522){return function(_0x5d130d){logger[_0x1c39('0xf')]('['+[_0x578ad6[_0x1c39('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x5d130d);return new Promise(function(_0x10240b,_0x343471){if(intUtil[_0x1c39('0x14')](_0x5d130d['userEmail'])){var _0x57878d={'method':'GET','uri':_0x6ebb82+'sys_user?sysparm_query=email%3D'+_0x5d130d[_0x1c39('0x15')]+'&'+_0x30fb3a+'&'+_0x30f522,'auth':_0x2de445,'json':!![]};logger[_0x1c39('0xf')]('['+[_0x578ad6['toUpperCase']()]+_0x1c39('0x16'),_0x57878d);return rp(_0x57878d)[_0x1c39('0xc')](function(_0x5ce224){logger[_0x1c39('0xf')]('['+[_0x578ad6[_0x1c39('0x10')]()]+_0x1c39('0x17'),_0x5ce224);if(_0x5ce224[_0x1c39('0xd')][_0x1c39('0x18')]>0x0&&String(_0x5ce224[_0x1c39('0xd')][0x0][_0x1c39('0x19')])===_0x1c39('0x1a')){_0x5d130d[_0x1c39('0x1b')]=_0x5ce224[_0x1c39('0xd')][0x0][_0x1c39('0xe')];}else{_0x5d130d[_0x1c39('0x1b')]=_0x5d130d[_0x1c39('0x1c')];_0x5d130d[_0x1c39('0x15')]=_0x5d130d[_0x1c39('0x1d')];}logger['info']('['+[_0x578ad6[_0x1c39('0x10')]()]+_0x1c39('0x1e'),_0x5d130d);_0x10240b(_0x5d130d);})[_0x1c39('0x1f')](function(_0x430202){logger[_0x1c39('0x12')]('['+[_0x578ad6[_0x1c39('0x10')]()]+']',_0x430202['message']);_0x343471(_0x430202[_0x1c39('0x13')]);});}else{logger[_0x1c39('0xf')]('['+[_0x578ad6['toUpperCase']()]+_0x1c39('0x20'));_0x5d130d[_0x1c39('0x1b')]=_0x5d130d[_0x1c39('0x1c')];_0x5d130d[_0x1c39('0x15')]=_0x5d130d[_0x1c39('0x1d')];_0x10240b(_0x5d130d);}});};}function createEndUser(_0xa731e5,_0x105bb8,_0x301ab4,_0x327d54,_0x349c39){logger[_0x1c39('0xf')]('['+[_0xa731e5[_0x1c39('0x10')]()]+_0x1c39('0x21'),_0x301ab4);return new Promise(function(_0xc3c1f6,_0x265404){var _0x4ab16a={'method':'POST','uri':_0x327d54+'sys_user?'+_0x349c39,'body':{'user_name':_0x301ab4[_0x1c39('0x22')],'roles':'user','first_name':_0x301ab4[_0x1c39('0x22')],'active':'true','date_format':'System','phone':_0x301ab4['endUserNumber']},'auth':_0x105bb8,'json':!![]};return rp(_0x4ab16a)['then'](function(_0x100dc1){logger[_0x1c39('0xf')]('['+[_0xa731e5['toUpperCase']()]+_0x1c39('0x23'),_0x100dc1[_0x1c39('0xd')]);_0x301ab4['endUserId']=_0x100dc1['result']['sys_id'];_0xc3c1f6(_0x301ab4);})[_0x1c39('0x1f')](function(_0x240135){logger[_0x1c39('0x12')]('['+[_0xa731e5[_0x1c39('0x10')]()]+']',_0x240135[_0x1c39('0x13')]);_0x265404(_0x240135[_0x1c39('0x13')]);});});}function getEndUser(_0xd31936,_0x1a1316,_0x29511e,_0xaa86d5,_0x5e93a7){return function(_0x3b539e){logger[_0x1c39('0xf')]('['+[_0xd31936[_0x1c39('0x10')]()]+_0x1c39('0x24'),_0x3b539e);return new Promise(function(_0x17cc27,_0x2769d0){var _0x3a7fbf={'method':_0x1c39('0xa'),'uri':_0x29511e+_0x1c39('0x25')+_0x3b539e['endUserNumber']+'&'+_0xaa86d5+'&'+_0x5e93a7,'auth':_0x1a1316,'json':!![]};return rp(_0x3a7fbf)[_0x1c39('0xc')](function(_0xcd7f2a){if(_0xcd7f2a[_0x1c39('0xd')][_0x1c39('0x18')]>0x0){_0x3b539e[_0x1c39('0x26')]=_0xcd7f2a['result'][0x0]['sys_id'];logger['info']('['+[_0xd31936[_0x1c39('0x10')]()]+_0x1c39('0x27'),_0x3b539e);_0x17cc27(_0x3b539e);}else{return createEndUser(_0xd31936,_0x1a1316,_0x3b539e,_0x29511e,_0xaa86d5)[_0x1c39('0xc')](function(_0x4d1ad8){logger[_0x1c39('0xf')]('['+[_0xd31936['toUpperCase']()]+_0x1c39('0x28'),_0x4d1ad8);_0x17cc27(_0x4d1ad8);});}})[_0x1c39('0x1f')](function(_0x576b0e){logger[_0x1c39('0x12')]('['+[_0xd31936['toUpperCase']()]+']',_0x576b0e['message']);_0x2769d0(_0x576b0e[_0x1c39('0x13')]);});});};}function getCustomFields(_0x5847f2,_0x1956ca){var _0xde888a={};if(_0x5847f2['length']>0x0){_[_0x1c39('0x29')](_0x5847f2,function(_0x42c590){if(_['includes'](['string',_0x1c39('0x2a')],_0x42c590[_0x1c39('0x2b')])&&_0x42c590['nameField']&&!_0x42c590['customField']){_0xde888a[_0x42c590[_0x1c39('0x2c')][_0x1c39('0x2d')]()]=_0x42c590[_0x1c39('0x2e')][_0x1c39('0x2f')]();}else if(_[_0x1c39('0x30')](['string',_0x1c39('0x2a')],_0x42c590['type'])&&_0x42c590['idField']&&_0x42c590[_0x1c39('0x31')]){_0xde888a[_0x42c590[_0x1c39('0x32')][_0x1c39('0x2d')]()]=_0x42c590['content'][_0x1c39('0x2f')]();}else if(_0x42c590[_0x1c39('0x2b')]===_0x1c39('0x33')&&_0x42c590[_0x1c39('0x34')]&&_0x42c590[_0x1c39('0x32')]&&_0x42c590[_0x1c39('0x31')]){_0xde888a[_0x42c590[_0x1c39('0x32')][_0x1c39('0x2d')]()]=_0x1956ca[_0x42c590[_0x1c39('0x34')]][_0x1c39('0x2f')]();}else if(_0x42c590[_0x1c39('0x2b')]==='customVariable'&&_0x42c590['Variable']&&_0x42c590['Variable']['name']&&_0x42c590['idField']&&_0x42c590[_0x1c39('0x31')]){_0xde888a[_0x42c590[_0x1c39('0x32')][_0x1c39('0x2d')]()]=_0x1956ca[_0x42c590['Variable'][_0x1c39('0x35')][_0x1c39('0x2d')]()][_0x1c39('0x2f')]();}});}return _0xde888a;}function getTicket(_0x2aca06,_0x2e9d00,_0x3bcf35,_0x39bd5b,_0x51b573,_0xa1b011){return function(_0x5649d1){logger[_0x1c39('0xf')]('['+[_0x2aca06[_0x1c39('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x5649d1);return new Promise(function(_0x4a7f08,_0x464706){var _0x35daf0=_0x2aca06[_0x1c39('0x2d')]()===_0x1c39('0x36')?_0x5649d1[_0x1c39('0x1b')]:_0x5649d1['endUserId'];var _0x2d096f={'method':_0x1c39('0x37'),'uri':_0x3bcf35+'incident'+'?'+_0xa1b011,'body':Object[_0x1c39('0x38')]({},{'active':_0x1c39('0x1a'),'caller_id':_0x35daf0,'assigned_to':_0x5649d1[_0x1c39('0x1b')],'short_description':intUtil[_0x1c39('0x39')](_0x39bd5b[_0x1c39('0x3a')],_0x51b573,'\x20'),'description':intUtil[_0x1c39('0x39')](_0x39bd5b[_0x1c39('0x3b')],_0x51b573,'\x0a')},getCustomFields(_0x39bd5b[_0x1c39('0x3c')],_0x51b573)),'auth':_0x2e9d00,'json':!![]};return rp(_0x2d096f)[_0x1c39('0xc')](function(_0x316d90){logger[_0x1c39('0xf')]('['+[_0x2aca06['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x316d90['result']);_0x5649d1['ticketId']=_0x316d90[_0x1c39('0xd')][_0x1c39('0xe')];_0x5649d1['ticketNumber']=_0x316d90[_0x1c39('0xd')][_0x1c39('0x3d')];logger[_0x1c39('0xf')]('['+[_0x2aca06[_0x1c39('0x10')]()]+_0x1c39('0x3e'),_0x5649d1);_0x4a7f08(_0x5649d1);})['catch'](function(_0x2ef13a){logger[_0x1c39('0x12')]('['+[_0x2aca06[_0x1c39('0x10')]()]+']',_0x2ef13a[_0x1c39('0x13')]);_0x464706(_0x2ef13a[_0x1c39('0x13')]);});});};}function createRemoteTag(_0x262509,_0x6411f6,_0x2e9fdb,_0x12348f){return new Promise(function(_0x24ca58,_0x2258d3){var _0x594235={'method':_0x1c39('0x37'),'uri':_0x2e9fdb+'label'+'?'+_0x12348f,'body':{'short_description':_0x262509,'global':!![],'active':!![],'name':_0x262509},'auth':_0x6411f6,'json':!![]};return rp(_0x594235)['then'](function(_0x18c41a){var _0x47446a=_0x18c41a[_0x1c39('0xd')]['sys_id'];_0x24ca58(_0x47446a);});});}function getRemoteTag(_0x2a2fbe,_0xbdd5e2,_0x448e34,_0x150bff,_0x727524){return new Promise(function(_0x51ae2b,_0x25cb58){var _0x7f95a3={'method':_0x1c39('0xa'),'uri':_0x448e34+'label'+_0x1c39('0x3f')+_0x2a2fbe+'&'+_0x150bff,'auth':_0xbdd5e2,'json':!![]};return rp(_0x7f95a3)[_0x1c39('0xc')](function(_0x54eac8){if(_0x54eac8[_0x1c39('0xd')][_0x1c39('0x18')]>0x0){var _0x54e77e=_0x54eac8[_0x1c39('0xd')][0x0][_0x1c39('0xe')];_0x51ae2b(_0x54e77e);}else{return createRemoteTag(_0x2a2fbe,_0xbdd5e2,_0x448e34,_0x150bff)['then'](function(_0x4ac886){_0x51ae2b(_0x4ac886);});}});});}function assignTagToIncident(_0x23b4c6,_0x5dd7f3,_0x50caf2,_0x1b2d22,_0x2d1f2e){return new Promise(function(_0x5732df,_0xad5905){var _0x164574={'method':_0x1c39('0x37'),'uri':_0x50caf2+'label_entry'+'?'+_0x2d1f2e,'body':{'label':_0x23b4c6,'table':_0x1c39('0x40'),'id_type':_0x1c39('0x41'),'table_key':_0x1b2d22[_0x1c39('0x42')],'title':'Incident\x20-\x20'+_0x1b2d22[_0x1c39('0x43')],'id_display':_0x1b2d22[_0x1c39('0x43')]},'auth':_0x5dd7f3,'json':!![]};return rp(_0x164574)['then'](function(_0x4f1599){_0x5732df();})[_0x1c39('0x1f')](function(){_0x5732df();});});}function manageTags(_0x2897d6,_0x82e99d,_0x56b092,_0x50dbce,_0x1df0e0,_0x91900f,_0x4eaa6a){return new Promise(function(_0x42f39a,_0x5e8c12){var _0x422dcd=[];_0x82e99d[_0x1c39('0x29')](function(_0x3fc496){_0x422dcd[_0x1c39('0x44')](getRemoteTag(_0x3fc496,_0x56b092,_0x50dbce,_0x91900f,_0x4eaa6a));});return Promise[_0x1c39('0x45')](_0x422dcd)[_0x1c39('0xc')](function(_0x4a4f72){if(_0x4a4f72[_0x1c39('0x18')]){logger[_0x1c39('0xf')]('['+[_0x2897d6[_0x1c39('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4a4f72);var _0x160ca9=[];_0x4a4f72[_0x1c39('0x29')](function(_0x4e5520){_0x160ca9[_0x1c39('0x44')](assignTagToIncident(_0x4e5520,_0x56b092,_0x50dbce,_0x1df0e0,_0x91900f));});return Promise[_0x1c39('0x45')](_0x160ca9)['then'](function(){_0x42f39a();})[_0x1c39('0x1f')](function(){_0x42f39a();});}else{_0x42f39a();}});});}function getTags(_0x5da6a8,_0x6be0fa,_0x4591dd,_0x23868d,_0x3b9a28,_0x1c5efc){return function(_0x4e473b){return new Promise(function(_0x5b593d,_0x31a640){var _0x4c0896=[];var _0x1b8df8=_0x23868d[_0x1c39('0x46')];if(_0x1b8df8&&_0x1b8df8[_0x1c39('0x18')]>0x0){_0x4c0896=_[_0x1c39('0x47')](_0x1b8df8,'name');}if(_0x4c0896[_0x1c39('0x18')]>0x0){return manageTags(_0x5da6a8,_0x4c0896,_0x6be0fa,_0x4591dd,_0x4e473b,_0x3b9a28,_0x1c5efc)[_0x1c39('0xc')](function(){_0x5b593d(_0x4e473b);});}else{_0x5b593d(_0x4e473b);}});};}function emit(_0x2fc7fd,_0x419122,_0x84fc05){var _0x3a021f='%26sysparm_record_target%3Dincident'+_0x1c39('0x48')+_0x1c39('0x49')+_0x1c39('0x4a');var _0x502996={'uri':_0x2fc7fd+_0x1c39('0x4b')+_0x84fc05+_0x3a021f};io['to'](util[_0x1c39('0x4c')]('user:%s',_0x419122))[_0x1c39('0x4d')](_0x1c39('0x4e'),_0x502996);}exports['cs']=function(_0x4ce263,_0xba1472,_0x4258fa,_0x4da7fa,_0x2205ea,_0x19db15,_0x1f225f,_0x51a1a0){var _0x2237de={};var _0x3a3b16={'user':_0x19db15[_0x1c39('0x4f')],'pass':_0x19db15['password']};var _0x4977c3=_0x1c39('0x50');var _0x500365='sysparm_display_value=true';_0x19db15[_0x1c39('0x51')]=intUtil[_0x1c39('0x52')](_0x19db15[_0x1c39('0x51')]);_0x19db15[_0x1c39('0x53')]=intUtil['stripTrailingSlash'](_0x19db15[_0x1c39('0x53')]);var _0xd3f344=util[_0x1c39('0x4c')]('%s/api/now/table/',_0x19db15['remoteUri']);_0x2237de[_0x1c39('0x15')]=!_[_0x1c39('0x54')](_0x4da7fa)?_0x4da7fa[_0x1c39('0x55')]:null;_0x2237de['adminEmail']=_0x19db15[_0x1c39('0x55')];_0x2237de[_0x1c39('0x22')]=_0x51a1a0[_0x1c39('0x2d')]()===_0x1c39('0x36')?_0xba1472[_0x1c39('0x56')]:_0xba1472[_0x1c39('0x57')];_0x2237de[_0x1c39('0x58')]=_0x51a1a0==='queue'||_0x51a1a0==='unmanaged'?_0x1c39('0x59'):_0x1c39('0x36');var _0x35ca1d=util[_0x1c39('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19db15[_0x1c39('0x53')],_0xba1472[_0x1c39('0x5a')],md5(_0xba1472[_0x1c39('0x5a')]));if(_0x2205ea&&_0x2205ea['monitor_format']){logger[_0x1c39('0xf')]('[QUEUE]',_0x1c39('0x5b'));_0xba1472[_0x1c39('0x5c')]=_0x35ca1d;}else if(_0x1f225f&&_0x1f225f[_0x1c39('0x5d')]&&_0x1f225f['recordingFormat']!==_0x1c39('0x5e')){logger[_0x1c39('0xf')]('[OUTBOUND]',_0x1c39('0x5b'));_0xba1472[_0x1c39('0x5c')]=_0x35ca1d;}else{_0xba1472[_0x1c39('0x5c')]='';}return getAdminUser(_0x51a1a0,_0x3a3b16,_0x2237de,_0xd3f344,_0x500365,_0x4977c3)[_0x1c39('0xc')](getUser(_0x51a1a0,_0x3a3b16,_0xd3f344,_0x500365,_0x4977c3))[_0x1c39('0xc')](getEndUser(_0x51a1a0,_0x3a3b16,_0xd3f344,_0x500365,_0x4977c3))[_0x1c39('0xc')](getTicket(_0x51a1a0,_0x3a3b16,_0xd3f344,_0x4258fa,_0xba1472,_0x500365))[_0x1c39('0xc')](function(_0x3846e9){logger[_0x1c39('0xf')](util['format'](_0x1c39('0x5f'),_0x3846e9[_0x1c39('0x42')]));logger['info'](util['format'](_0x1c39('0x60'),_0x51a1a0));if(_0x51a1a0!==_0x1c39('0x61')){logger[_0x1c39('0xf')]('['+[_0x51a1a0['toUpperCase']()]+']',_0x1c39('0x62'));emit(_0x19db15['remoteUri'],_0x4da7fa[_0x1c39('0x35')],_0x3846e9[_0x1c39('0x42')]);}})['catch'](function(_0x24e58e){logger['error']('['+[_0x51a1a0['toUpperCase']()]+_0x1c39('0x63'),util['inspect'](_0x24e58e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x09d6=['password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','userEmail','result','length','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','POST','endUserNumber','user','System','],\x20EndUser\x20schema','catch','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','customField','toLowerCase','content','toString','picklist','type','idField','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username'];(function(_0x17d267,_0x4d86a8){var _0x47bba4=function(_0x23146d){while(--_0x23146d){_0x17d267['push'](_0x17d267['shift']());}};_0x47bba4(++_0x4d86a8);}(_0x09d6,0x155));var _0x609d=function(_0x1cd4a8,_0x1bb962){_0x1cd4a8=_0x1cd4a8-0x0;var _0x8c73a3=_0x09d6[_0x1cd4a8];return _0x8c73a3;};'use strict';var _=require('lodash');var Promise=require(_0x609d('0x0'));var rp=require(_0x609d('0x1'));var util=require(_0x609d('0x2'));var md5=require(_0x609d('0x3'));var Redis=require(_0x609d('0x4'));var intUtil=require(_0x609d('0x5'));var config=require(_0x609d('0x6'));var logger=require('../../../../config/logger')(_0x609d('0x7'));config[_0x609d('0x8')]=_[_0x609d('0x9')](config[_0x609d('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x1276d6,_0x2a270a,_0x28fb09,_0x432461,_0x240a48,_0x24332a){return new Promise(function(_0x162173,_0xb03f0d){var _0xc5016c={'method':_0x609d('0xa'),'uri':_0x432461+_0x609d('0xb')+'&'+_0x240a48+'&'+_0x24332a,'auth':_0x2a270a,'json':!![]};return rp(_0xc5016c)[_0x609d('0xc')](function(_0x240d7c){if(_0x240d7c['result']['length']>0x0){_0x28fb09[_0x609d('0xd')]=_0x240d7c['result'][0x0][_0x609d('0xe')];}logger[_0x609d('0xf')]('['+[_0x1276d6[_0x609d('0x10')]()]+_0x609d('0x11'),_0x28fb09);_0x162173(_0x28fb09);})['catch'](function(_0x19e93d){logger[_0x609d('0x12')]('['+[_0x1276d6['toUpperCase']()]+']',_0x19e93d['message']);_0xb03f0d(_0x19e93d[_0x609d('0x13')]);});});}function getUser(_0x4094a7,_0x4abd89,_0x41bb20,_0xda7478,_0xbf06f7){return function(_0x2b989c){logger[_0x609d('0xf')]('['+[_0x4094a7[_0x609d('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x2b989c);return new Promise(function(_0xcefafe,_0x2caa){if(intUtil['validateEmail'](_0x2b989c[_0x609d('0x14')])){var _0x190036={'method':'GET','uri':_0x41bb20+'sys_user?sysparm_query=email%3D'+_0x2b989c['userEmail']+'&'+_0xda7478+'&'+_0xbf06f7,'auth':_0x4abd89,'json':!![]};logger[_0x609d('0xf')]('['+[_0x4094a7[_0x609d('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x190036);return rp(_0x190036)[_0x609d('0xc')](function(_0x5ac953){logger[_0x609d('0xf')]('['+[_0x4094a7[_0x609d('0x10')]()]+'],\x20getUser\x20entity',_0x5ac953);if(_0x5ac953[_0x609d('0x15')][_0x609d('0x16')]>0x0&&String(_0x5ac953[_0x609d('0x15')][0x0][_0x609d('0x17')])==='true'){_0x2b989c[_0x609d('0x18')]=_0x5ac953[_0x609d('0x15')][0x0]['sys_id'];}else{_0x2b989c[_0x609d('0x18')]=_0x2b989c[_0x609d('0xd')];_0x2b989c[_0x609d('0x14')]=_0x2b989c['adminEmail'];}logger[_0x609d('0xf')]('['+[_0x4094a7['toUpperCase']()]+_0x609d('0x19'),_0x2b989c);_0xcefafe(_0x2b989c);})['catch'](function(_0x20e442){logger[_0x609d('0x12')]('['+[_0x4094a7[_0x609d('0x10')]()]+']',_0x20e442[_0x609d('0x13')]);_0x2caa(_0x20e442['message']);});}else{logger['info']('['+[_0x4094a7[_0x609d('0x10')]()]+_0x609d('0x1a'));_0x2b989c['userId']=_0x2b989c[_0x609d('0xd')];_0x2b989c[_0x609d('0x14')]=_0x2b989c[_0x609d('0x1b')];_0xcefafe(_0x2b989c);}});};}function createEndUser(_0x5570b5,_0x31c47b,_0x5b4ed9,_0x1b1d42,_0xcfd5c2){logger[_0x609d('0xf')]('['+[_0x5570b5[_0x609d('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x5b4ed9);return new Promise(function(_0xca8ae,_0x12b95a){var _0x2de930={'method':_0x609d('0x1c'),'uri':_0x1b1d42+'sys_user?'+_0xcfd5c2,'body':{'user_name':_0x5b4ed9[_0x609d('0x1d')],'roles':_0x609d('0x1e'),'first_name':_0x5b4ed9[_0x609d('0x1d')],'active':'true','date_format':_0x609d('0x1f'),'phone':_0x5b4ed9[_0x609d('0x1d')]},'auth':_0x31c47b,'json':!![]};return rp(_0x2de930)['then'](function(_0x29fdad){logger[_0x609d('0xf')]('['+[_0x5570b5[_0x609d('0x10')]()]+_0x609d('0x20'),_0x29fdad['result']);_0x5b4ed9['endUserId']=_0x29fdad[_0x609d('0x15')]['sys_id'];_0xca8ae(_0x5b4ed9);})[_0x609d('0x21')](function(_0x3a55e9){logger[_0x609d('0x12')]('['+[_0x5570b5[_0x609d('0x10')]()]+']',_0x3a55e9[_0x609d('0x13')]);_0x12b95a(_0x3a55e9[_0x609d('0x13')]);});});}function getEndUser(_0x47ecef,_0x288dc4,_0x33bbac,_0x53a302,_0x33b44a){return function(_0x541e1c){logger[_0x609d('0xf')]('['+[_0x47ecef[_0x609d('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x541e1c);return new Promise(function(_0x2e799e,_0x3e51a2){var _0x22bfe7={'method':_0x609d('0xa'),'uri':_0x33bbac+_0x609d('0x22')+_0x541e1c['endUserNumber']+'&'+_0x53a302+'&'+_0x33b44a,'auth':_0x288dc4,'json':!![]};return rp(_0x22bfe7)[_0x609d('0xc')](function(_0x1cde3f){if(_0x1cde3f[_0x609d('0x15')][_0x609d('0x16')]>0x0){_0x541e1c[_0x609d('0x23')]=_0x1cde3f[_0x609d('0x15')][0x0][_0x609d('0xe')];logger['info']('['+[_0x47ecef[_0x609d('0x10')]()]+_0x609d('0x24'),_0x541e1c);_0x2e799e(_0x541e1c);}else{return createEndUser(_0x47ecef,_0x288dc4,_0x541e1c,_0x33bbac,_0x53a302)['then'](function(_0x363036){logger[_0x609d('0xf')]('['+[_0x47ecef['toUpperCase']()]+_0x609d('0x25'),_0x363036);_0x2e799e(_0x363036);});}})[_0x609d('0x21')](function(_0x1ff7e7){logger[_0x609d('0x12')]('['+[_0x47ecef[_0x609d('0x10')]()]+']',_0x1ff7e7[_0x609d('0x13')]);_0x3e51a2(_0x1ff7e7['message']);});});};}function getCustomFields(_0x5611e5,_0x1a01b5){var _0x49c60a={};if(_0x5611e5[_0x609d('0x16')]>0x0){_[_0x609d('0x26')](_0x5611e5,function(_0x3936e7){if(_[_0x609d('0x27')]([_0x609d('0x28'),'picklist'],_0x3936e7['type'])&&_0x3936e7['nameField']&&!_0x3936e7[_0x609d('0x29')]){_0x49c60a[_0x3936e7['nameField'][_0x609d('0x2a')]()]=_0x3936e7[_0x609d('0x2b')][_0x609d('0x2c')]();}else if(_[_0x609d('0x27')]([_0x609d('0x28'),_0x609d('0x2d')],_0x3936e7[_0x609d('0x2e')])&&_0x3936e7['idField']&&_0x3936e7[_0x609d('0x29')]){_0x49c60a[_0x3936e7[_0x609d('0x2f')][_0x609d('0x2a')]()]=_0x3936e7[_0x609d('0x2b')][_0x609d('0x2c')]();}else if(_0x3936e7['type']===_0x609d('0x30')&&_0x3936e7['variableName']&&_0x3936e7[_0x609d('0x2f')]&&_0x3936e7[_0x609d('0x29')]){_0x49c60a[_0x3936e7[_0x609d('0x2f')][_0x609d('0x2a')]()]=_0x1a01b5[_0x3936e7[_0x609d('0x31')]][_0x609d('0x2c')]();}else if(_0x3936e7[_0x609d('0x2e')]===_0x609d('0x32')&&_0x3936e7['Variable']&&_0x3936e7[_0x609d('0x33')]['name']&&_0x3936e7[_0x609d('0x2f')]&&_0x3936e7[_0x609d('0x29')]){_0x49c60a[_0x3936e7[_0x609d('0x2f')][_0x609d('0x2a')]()]=_0x1a01b5[_0x3936e7[_0x609d('0x33')]['name'][_0x609d('0x2a')]()][_0x609d('0x2c')]();}});}return _0x49c60a;}function getTicket(_0x733510,_0x4ac7f1,_0x57d3cd,_0x44d6f1,_0x2cb172,_0x3a195d){return function(_0x5610f8){logger[_0x609d('0xf')]('['+[_0x733510['toUpperCase']()]+_0x609d('0x34'),_0x5610f8);return new Promise(function(_0x444987,_0x56b2d1){var _0x45c3e8=_0x733510['toLowerCase']()===_0x609d('0x35')?_0x5610f8[_0x609d('0x18')]:_0x5610f8[_0x609d('0x23')];var _0x3d09ae={'method':_0x609d('0x1c'),'uri':_0x57d3cd+_0x609d('0x36')+'?'+_0x3a195d,'body':Object[_0x609d('0x37')]({},{'active':_0x609d('0x38'),'caller_id':_0x45c3e8,'assigned_to':_0x5610f8[_0x609d('0x18')],'short_description':intUtil[_0x609d('0x39')](_0x44d6f1[_0x609d('0x3a')],_0x2cb172,'\x20'),'description':intUtil['getString'](_0x44d6f1[_0x609d('0x3b')],_0x2cb172,'\x0a')},getCustomFields(_0x44d6f1[_0x609d('0x3c')],_0x2cb172)),'auth':_0x4ac7f1,'json':!![]};return rp(_0x3d09ae)[_0x609d('0xc')](function(_0x263d81){logger[_0x609d('0xf')]('['+[_0x733510['toUpperCase']()]+_0x609d('0x3d'),_0x263d81[_0x609d('0x15')]);_0x5610f8['ticketId']=_0x263d81[_0x609d('0x15')][_0x609d('0xe')];_0x5610f8['ticketNumber']=_0x263d81['result']['number'];logger[_0x609d('0xf')]('['+[_0x733510[_0x609d('0x10')]()]+_0x609d('0x3e'),_0x5610f8);_0x444987(_0x5610f8);})[_0x609d('0x21')](function(_0x3d1abb){logger[_0x609d('0x12')]('['+[_0x733510[_0x609d('0x10')]()]+']',_0x3d1abb['message']);_0x56b2d1(_0x3d1abb['message']);});});};}function createRemoteTag(_0x4956ce,_0x5f3219,_0x566998,_0x2a944e){return new Promise(function(_0x1718f2,_0x40a4b8){var _0x234661={'method':_0x609d('0x1c'),'uri':_0x566998+'label'+'?'+_0x2a944e,'body':{'short_description':_0x4956ce,'global':!![],'active':!![],'name':_0x4956ce},'auth':_0x5f3219,'json':!![]};return rp(_0x234661)['then'](function(_0x25aec6){var _0x7357e1=_0x25aec6[_0x609d('0x15')][_0x609d('0xe')];_0x1718f2(_0x7357e1);});});}function getRemoteTag(_0x288601,_0x33d0d7,_0x28b812,_0x5ae539,_0x3e69ae){return new Promise(function(_0x2874e4,_0x3384a8){var _0x4cc4db={'method':_0x609d('0xa'),'uri':_0x28b812+'label'+_0x609d('0x3f')+_0x288601+'&'+_0x5ae539,'auth':_0x33d0d7,'json':!![]};return rp(_0x4cc4db)[_0x609d('0xc')](function(_0x39092e){if(_0x39092e[_0x609d('0x15')][_0x609d('0x16')]>0x0){var _0x4fdc48=_0x39092e[_0x609d('0x15')][0x0][_0x609d('0xe')];_0x2874e4(_0x4fdc48);}else{return createRemoteTag(_0x288601,_0x33d0d7,_0x28b812,_0x5ae539)[_0x609d('0xc')](function(_0x92a32e){_0x2874e4(_0x92a32e);});}});});}function assignTagToIncident(_0x44df60,_0xd6dc65,_0x1d2068,_0x3eaabf,_0x4d2df5){return new Promise(function(_0x3fdaee,_0x42f39f){var _0x2ad063={'method':_0x609d('0x1c'),'uri':_0x1d2068+_0x609d('0x40')+'?'+_0x4d2df5,'body':{'label':_0x44df60,'table':_0x609d('0x36'),'id_type':_0x609d('0x41'),'table_key':_0x3eaabf[_0x609d('0x42')],'title':_0x609d('0x43')+_0x3eaabf[_0x609d('0x44')],'id_display':_0x3eaabf[_0x609d('0x44')]},'auth':_0xd6dc65,'json':!![]};return rp(_0x2ad063)[_0x609d('0xc')](function(_0x46844c){_0x3fdaee();})[_0x609d('0x21')](function(){_0x3fdaee();});});}function manageTags(_0x5ddbce,_0x507d94,_0x2d86ea,_0xb70f4c,_0x1206f2,_0x1c3d8b,_0x61a8f1){return new Promise(function(_0x24eec0,_0xf16877){var _0x423bb1=[];_0x507d94[_0x609d('0x26')](function(_0x4722d2){_0x423bb1['push'](getRemoteTag(_0x4722d2,_0x2d86ea,_0xb70f4c,_0x1c3d8b,_0x61a8f1));});return Promise[_0x609d('0x45')](_0x423bb1)[_0x609d('0xc')](function(_0x416ee5){if(_0x416ee5[_0x609d('0x16')]){logger[_0x609d('0xf')]('['+[_0x5ddbce[_0x609d('0x10')]()]+_0x609d('0x46'),_0x416ee5);var _0x13259c=[];_0x416ee5[_0x609d('0x26')](function(_0x42893f){_0x13259c[_0x609d('0x47')](assignTagToIncident(_0x42893f,_0x2d86ea,_0xb70f4c,_0x1206f2,_0x1c3d8b));});return Promise[_0x609d('0x45')](_0x13259c)['then'](function(){_0x24eec0();})[_0x609d('0x21')](function(){_0x24eec0();});}else{_0x24eec0();}});});}function getTags(_0x4b2ef3,_0x5b8f87,_0x3d37b5,_0x362a0a,_0x2464d0,_0x5804b2){return function(_0x271db2){return new Promise(function(_0x4e9373,_0x54a054){var _0x5d2452=[];var _0x5e3deb=_0x362a0a[_0x609d('0x48')];if(_0x5e3deb&&_0x5e3deb[_0x609d('0x16')]>0x0){_0x5d2452=_['map'](_0x5e3deb,_0x609d('0x49'));}if(_0x5d2452[_0x609d('0x16')]>0x0){return manageTags(_0x4b2ef3,_0x5d2452,_0x5b8f87,_0x3d37b5,_0x271db2,_0x2464d0,_0x5804b2)[_0x609d('0xc')](function(){_0x4e9373(_0x271db2);});}else{_0x4e9373(_0x271db2);}});};}function emit(_0x40cf4a,_0xaaaaf8,_0x35437b){var _0x201a8b=_0x609d('0x4a')+_0x609d('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x609d('0x4c');var _0xd31ada={'uri':_0x40cf4a+_0x609d('0x4d')+_0x35437b+_0x201a8b};io['to'](util[_0x609d('0x4e')](_0x609d('0x4f'),_0xaaaaf8))[_0x609d('0x50')](_0x609d('0x51'),_0xd31ada);}exports['cs']=function(_0x49f0c7,_0x36d407,_0x964294,_0x4b4364,_0x59db00,_0x2b44af,_0x4705c4,_0x5def47){var _0x21244a={};var _0x358906={'user':_0x2b44af[_0x609d('0x52')],'pass':_0x2b44af[_0x609d('0x53')]};var _0x20d6a6=_0x609d('0x54');var _0xf863eb=_0x609d('0x55');_0x2b44af[_0x609d('0x56')]=intUtil[_0x609d('0x57')](_0x2b44af[_0x609d('0x56')]);_0x2b44af[_0x609d('0x58')]=intUtil['stripTrailingSlash'](_0x2b44af[_0x609d('0x58')]);var _0x3b6c70=util[_0x609d('0x4e')](_0x609d('0x59'),_0x2b44af[_0x609d('0x56')]);_0x21244a[_0x609d('0x14')]=!_[_0x609d('0x5a')](_0x4b4364)?_0x4b4364[_0x609d('0x5b')]:null;_0x21244a[_0x609d('0x1b')]=_0x2b44af[_0x609d('0x5b')];_0x21244a[_0x609d('0x1d')]=_0x5def47['toLowerCase']()===_0x609d('0x35')?_0x36d407[_0x609d('0x5c')]:_0x36d407['calleridnum'];_0x21244a['callDirection']=_0x5def47===_0x609d('0x5d')||_0x5def47==='unmanaged'?'queue':_0x609d('0x35');var _0x165a77=util[_0x609d('0x4e')](_0x609d('0x5e'),_0x2b44af['serverUrl'],_0x36d407['uniqueid'],md5(_0x36d407['uniqueid']));if(_0x59db00&&_0x59db00[_0x609d('0x5f')]){logger['info']('[QUEUE]',_0x609d('0x60'));_0x36d407[_0x609d('0x61')]=_0x165a77;}else if(_0x4705c4&&_0x4705c4[_0x609d('0x62')]&&_0x4705c4[_0x609d('0x62')]!==_0x609d('0x63')){logger['info'](_0x609d('0x64'),'Recording\x20is\x20enabled!');_0x36d407[_0x609d('0x61')]=_0x165a77;}else{_0x36d407[_0x609d('0x61')]='';}return getAdminUser(_0x5def47,_0x358906,_0x21244a,_0x3b6c70,_0xf863eb,_0x20d6a6)['then'](getUser(_0x5def47,_0x358906,_0x3b6c70,_0xf863eb,_0x20d6a6))['then'](getEndUser(_0x5def47,_0x358906,_0x3b6c70,_0xf863eb,_0x20d6a6))[_0x609d('0xc')](getTicket(_0x5def47,_0x358906,_0x3b6c70,_0x964294,_0x36d407,_0xf863eb))[_0x609d('0xc')](function(_0xe54327){logger[_0x609d('0xf')](util[_0x609d('0x4e')](_0x609d('0x65'),_0xe54327[_0x609d('0x42')]));logger[_0x609d('0xf')](util['format'](_0x609d('0x66'),_0x5def47));if(_0x5def47!==_0x609d('0x67')){logger['info']('['+[_0x5def47[_0x609d('0x10')]()]+']',_0x609d('0x68'));emit(_0x2b44af[_0x609d('0x56')],_0x4b4364[_0x609d('0x49')],_0xe54327[_0x609d('0x42')]);}})[_0x609d('0x21')](function(_0x456611){logger['error']('['+[_0x5def47[_0x609d('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x609d('0x69')](_0x456611,{'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 70b083e..0a555c9 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 _0x5514=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','merge','map','type','nameField','customField','toLowerCase','string','custom_fields','content','variable','customVariable','Variable','POST','login','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','[QUEUE]','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','error','monitor_format','lastevent','toUpperCase','Ticket\x20created!','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','socket.io-emitter','redis','emit','info','name','created_by','description','getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','direction','length','forEach','variableName','push','idField','JSON','stringify','Basic\x20%s','apiKey','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then'];(function(_0x899a00,_0x4847e3){var _0x599f0b=function(_0xfb2007){while(--_0xfb2007){_0x899a00['push'](_0x899a00['shift']());}};_0x599f0b(++_0x4847e3);}(_0x5514,0x1a4));var _0x4551=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5514[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x4551('0x0'));var rp=require(_0x4551('0x1'));var BPromise=require(_0x4551('0x2'));var md5=require(_0x4551('0x3'));var util=require(_0x4551('0x4'));var Redis=require(_0x4551('0x5'));var intUtil=require(_0x4551('0x6'));var config=require(_0x4551('0x7'));var logger=require(_0x4551('0x8'))(_0x4551('0x9'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4551('0xa'))(new Redis(config[_0x4551('0xb')]));var def={'method':'POST','json':!![]};function emit(_0x284028,_0x39bf25,_0x785477){io['to'](_0x284028)[_0x4551('0xc')](_0x39bf25,_0x785477);}function getTicket(_0xd76dfc,_0x56cfdf,_0x5e90a3,_0x17b547,_0x24301f,_0x29c091,_0x481f40,_0x476441){logger[_0x4551('0xd')]('Creating\x20new\x20ticket...');var _0xf333b8=new Date();var _0x443be1=[{'name':_0x4551('0xe'),'value':intUtil['getString'](_0x17b547['Subjects'],_0x24301f,'\x20')},{'name':'assigned_user_id','value':_0x56cfdf['id']},{'name':_0x4551('0xf'),'value':_0x56cfdf['id']},{'name':_0x4551('0x10'),'value':intUtil[_0x4551('0x11')](_0x17b547[_0x4551('0x12')],_0x24301f,'\x0a')},{'name':_0x4551('0x13'),'value':_0xf333b8['toISOString']()[_0x4551('0x14')](0x0,0x13)[_0x4551('0x15')]('T','\x20')},{'name':_0x4551('0x16'),'value':'0'},{'name':_0x4551('0x17'),'value':'15'},{'name':_0x4551('0x18'),'value':_0x5e90a3['id']},{'name':_0x4551('0x19'),'value':'Contacts'},{'name':'parent_name','value':_0x5e90a3['name']},{'name':_0x4551('0x1a'),'value':_0x476441}];if(_0x29c091[_0x4551('0x1b')]){_[_0x4551('0x1c')](_0x29c091,function(_0x1d6e35){if(_0x24301f[_0x1d6e35[_0x4551('0x1d')]]){_0x443be1[_0x4551('0x1e')]({'name':_0x1d6e35[_0x4551('0x1f')],'value':_0x24301f[_0x1d6e35[_0x4551('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x4551('0x20'),'rest_data':JSON[_0x4551('0x21')]({'session':_0x481f40['id'],'module_name':'Calls','name_value_list':_0x443be1})}});}function getAuth(_0xca40f7){return util['format'](_0x4551('0x22'),new Buffer(_0xca40f7[_0x4551('0x23')]+':X')[_0x4551('0x24')](_0x4551('0x25')));}function getServerInfo(_0x46de18){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x4551('0x20'),'rest_data':JSON['stringify']({'session':_0x46de18['id']})}});}function getUser(_0x1d3050,_0x1685f6,_0x47fcd8){if(!_['isNil'](_0x1685f6)){logger[_0x4551('0xd')](_0x4551('0x26'),_0x1685f6);return request({'form':{'method':_0x4551('0x27'),'input_type':_0x4551('0x20'),'response_type':'JSON','rest_data':JSON[_0x4551('0x21')]({'session':_0x47fcd8['id'],'module_name':_0x4551('0x28'),'query':util[_0x4551('0x29')](_0x4551('0x2a'),_0x1685f6),'order_by':'','offset':'0','select_fields':['id',_0x4551('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1985b1){if(_0x1985b1[_0x4551('0x2b')][_0x4551('0x1b')]){var _0xf39221=_[_0x4551('0x2c')](_0x1985b1[_0x4551('0x2b')],function(_0x9541ff){return _0x9541ff['name_value_list']['user_name']['value']===_0x1685f6;});if(_0xf39221){logger[_0x4551('0xd')](_0x4551('0x2d'));return BPromise[_0x4551('0x2e')]({'id':_0xf39221[_0x4551('0x2f')]['id'][_0x4551('0x30')],'name':_0xf39221['name_value_list']['name']['value']});}}logger[_0x4551('0xd')](_0x4551('0x31'));return BPromise[_0x4551('0x2e')]({'id':_0x47fcd8[_0x4551('0x2f')][_0x4551('0x32')][_0x4551('0x30')],'name':_0x47fcd8['name_value_list']['user_name']['value']});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4551('0x2e')]({'id':_0x47fcd8['name_value_list']['user_id'][_0x4551('0x30')],'name':_0x47fcd8[_0x4551('0x2f')][_0x4551('0x33')][_0x4551('0x30')]});}}function getEndUser(_0x1a74b8,_0x949c03,_0x384304,_0x1fab2b){logger[_0x4551('0xd')]('Searching\x20enduser\x20with\x20phone',_0x384304);return request({'form':{'method':_0x4551('0x27'),'input_type':_0x4551('0x20'),'response_type':_0x4551('0x20'),'rest_data':JSON[_0x4551('0x21')]({'session':_0x1fab2b['id'],'module_name':_0x4551('0x34'),'query':util[_0x4551('0x29')](_0x4551('0x35'),_0x384304),'order_by':'','offset':'0','select_fields':['id',_0x4551('0xe'),_0x4551('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4551('0x37')](function(_0x3551fd){if(_0x3551fd[_0x4551('0x2b')]['length']){var _0x1da85c=_['find'](_0x3551fd[_0x4551('0x2b')],function(_0xe3f4e2){return _0xe3f4e2[_0x4551('0x2f')][_0x4551('0x36')]['value']===_0x384304;});if(_0x1da85c){logger[_0x4551('0xd')](_0x4551('0x38'));return BPromise[_0x4551('0x2e')]({'id':_0x1da85c[_0x4551('0x2f')]['id'][_0x4551('0x30')],'name':_0x1da85c['name_value_list']['name'][_0x4551('0x30')],'phone':_0x1da85c['name_value_list'][_0x4551('0x36')][_0x4551('0x30')]});}}else{logger[_0x4551('0xd')](_0x4551('0x39'));return request({'form':{'method':_0x4551('0x3a'),'input_type':_0x4551('0x20'),'response_type':'JSON','rest_data':JSON[_0x4551('0x21')]({'session':_0x1fab2b['id'],'module_name':_0x4551('0x34'),'name_value_list':[{'name':_0x4551('0x3b'),'value':_0x949c03!==_0x4551('0x3c')?_0x949c03:util[_0x4551('0x29')]('Caller\x20-\x20%s',_0x384304)},{'name':_0x4551('0x36'),'value':_0x384304}]})}})[_0x4551('0x37')](function(_0x6aa41c){logger['info'](_0x4551('0x3d'));return BPromise[_0x4551('0x2e')]({'id':_0x6aa41c['id'],'name':_0x6aa41c[_0x4551('0x2b')][_0x4551('0x3b')]['value'],'phone':_0x6aa41c[_0x4551('0x2b')][_0x4551('0x36')][_0x4551('0x30')]});});}});}function request(_0x372b54){logger[_0x4551('0x3e')]('[HTTP]',JSON[_0x4551('0x21')](_0x372b54));return rp(_[_0x4551('0x3f')](def,_0x372b54));}function getTags(_0x54390a,_0x14fd8a){var _0x2a596e=[];if(_0x54390a&&_0x54390a[_0x4551('0x1b')]>0x0){_0x2a596e=_[_0x4551('0x40')](_0x54390a,_0x14fd8a);}return _0x2a596e;}function getCustomFields(_0xe5cbbf,_0x1ee2af){var _0x59c33d=[];var _0x3142b7={'custom_fields':[]};if(_0xe5cbbf[_0x4551('0x1b')]>0x0){_[_0x4551('0x1c')](_0xe5cbbf,function(_0x17f0c9){if(_0x17f0c9[_0x4551('0x41')]==='string'&&_0x17f0c9[_0x4551('0x42')]&&!_0x17f0c9[_0x4551('0x43')]){_0x3142b7[_0x17f0c9[_0x4551('0x42')][_0x4551('0x44')]()]=_0x17f0c9['content'][_0x4551('0x24')]();}else if(_0x17f0c9['type']===_0x4551('0x45')&&_0x17f0c9[_0x4551('0x1f')]&&_0x17f0c9[_0x4551('0x43')]){_0x3142b7[_0x4551('0x46')][_0x4551('0x1e')]({'id':_0x17f0c9[_0x4551('0x1f')],'value':_0x17f0c9[_0x4551('0x47')][_0x4551('0x24')]()});}else if(_0x17f0c9[_0x4551('0x41')]===_0x4551('0x48')&&_0x17f0c9[_0x4551('0x1d')]&&_0x17f0c9[_0x4551('0x1f')]&&_0x17f0c9[_0x4551('0x43')]){_0x1ee2af[_0x17f0c9[_0x4551('0x1d')]]&&_0x3142b7[_0x4551('0x46')]['push']({'id':_0x17f0c9['idField'],'value':_0x1ee2af[_0x17f0c9['variableName']][_0x4551('0x24')]()});}else if(_0x17f0c9[_0x4551('0x41')]===_0x4551('0x49')&&_0x17f0c9[_0x4551('0x4a')]&&_0x17f0c9['Variable'][_0x4551('0xe')]&&_0x17f0c9[_0x4551('0x1f')]&&_0x17f0c9['customField']){_0x1ee2af[_0x17f0c9[_0x4551('0x4a')][_0x4551('0xe')]['toLowerCase']()]&&_0x3142b7['custom_fields'][_0x4551('0x1e')]({'id':_0x17f0c9[_0x4551('0x1f')],'value':_0x1ee2af[_0x17f0c9[_0x4551('0x4a')][_0x4551('0xe')]['toLowerCase']()][_0x4551('0x24')]()});}});}return _0x3142b7;}function getConnection(_0x52d13e){return request({'method':_0x4551('0x4b'),'form':{'method':_0x4551('0x4c'),'input_type':'JSON','response_type':_0x4551('0x20'),'rest_data':JSON[_0x4551('0x21')]({'user_auth':{'user_name':_0x52d13e['username'],'password':_0x52d13e['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4551('0x37')](function(_0x22a283){var _0x56a740=_0x22a283;if(_0x56a740['id']){def['sessionID']=_0x56a740['id'];return BPromise['resolve'](_0x56a740);}else{throw new Error(util[_0x4551('0x29')](_0x4551('0x4d'),_0x52d13e['id']));}});}function setRelationship(_0x195712,_0x1d2317,_0x1e2f88,_0x267e32){return request({'form':{'method':_0x4551('0x4e'),'input_type':'JSON','response_type':_0x4551('0x20'),'rest_data':JSON[_0x4551('0x21')]({'session':_0x195712['id'],'module_name':_0x4551('0x4f'),'module_id':_0x1e2f88['id'],'link_field_name':_0x267e32,'related_ids':[_0x1d2317['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4551('0x50')]=function(_0x1b8e70,_0x1418a1,_0x467738,_0x294a50,_0x1bcdbd,_0x5e556c){var _0x4789a1,_0x24af41,_0x246aef,_0x572516;_0x5e556c[_0x4551('0x51')]=intUtil['stripTrailingSlash'](_0x5e556c['remoteUri']);_0x5e556c[_0x4551('0x52')]=intUtil[_0x4551('0x53')](_0x5e556c[_0x4551('0x52')]);def[_0x4551('0x54')]=util[_0x4551('0x29')]('%s/service/v4_1/rest.php',_0x5e556c[_0x4551('0x51')]);if(_0x1bcdbd&&_0x1bcdbd['monitor_format']){logger['info'](_0x4551('0x55'),'Recording\x20is\x20enabled!');_0x1418a1[_0x4551('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e556c[_0x4551('0x52')],_0x1418a1['uniqueid'],md5(_0x1418a1['uniqueid']));}else{_0x1418a1['recordingURL']='';}return getConnection(_0x5e556c)['then'](function(_0x40cd0f){_0x572516=_0x40cd0f;return getUser(_0x5e556c,_0x294a50[_0x4551('0xe')],_0x572516);})[_0x4551('0x37')](function(_0x4f98d3){_0x4789a1=_0x4f98d3;logger[_0x4551('0xd')](_0x4551('0x57'),_0x4789a1['id']);return getEndUser(_0x5e556c,_0x1418a1[_0x4551('0x58')],_0x1418a1[_0x4551('0x59')],_0x572516);})[_0x4551('0x37')](function(_0x4e086f){_0x24af41=_0x4e086f;logger[_0x4551('0xd')](_0x4551('0x5a'),_0x24af41['id']);return getTicket(_0x5e556c,_0x4789a1,_0x24af41,_0x467738,_0x1418a1,_0x467738[_0x4551('0x5b')],_0x572516,_0x4551('0x5c'));})[_0x4551('0x37')](function(_0x5caecb){_0x246aef=_0x5caecb;logger['info']('Ticket\x20created!');logger['info'](_0x4551('0x5d'),_0x246aef['id']);return setRelationship(_0x572516,_0x4789a1,_0x246aef,_0x4551('0x5e'));})[_0x4551('0x37')](function(){return setRelationship(_0x572516,_0x24af41,_0x246aef,_0x4551('0x5f'));})['then'](function(){return getServerInfo(_0x572516);})[_0x4551('0x37')](function(_0x3c80e9){var _0x41294b=parseInt(_0x3c80e9[_0x4551('0x60')][_0x4551('0x61')](0x0));var _0x4638cb=util[_0x4551('0x29')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5e556c['remoteUri'],_0x246aef['id']);if(_0x41294b>0x6){_0x4638cb=util[_0x4551('0x29')](_0x4551('0x62'),_0x5e556c[_0x4551('0x51')],_0x246aef['id']);}logger[_0x4551('0xd')](_0x4551('0x55'),_0x4551('0x63'));emit(util[_0x4551('0x29')](_0x4551('0x64'),_0x294a50[_0x4551('0xe')]),_0x4551('0x65'),{'uri':_0x4638cb});})[_0x4551('0x66')](function(_0x291f77){logger['error']('[QUEUE]',JSON['stringify'](_0x291f77));});};exports[_0x4551('0x67')]=function(_0x4cde04,_0x476068,_0x4c3b79,_0x5acf9f,_0x495bf9,_0x3ae9ed,_0xaf27bb){var _0xd15c5b,_0x5b414f,_0xcd4af,_0x390e85;_0x3ae9ed[_0x4551('0x51')]=intUtil['stripTrailingSlash'](_0x3ae9ed[_0x4551('0x51')]);_0x3ae9ed[_0x4551('0x52')]=intUtil['stripTrailingSlash'](_0x3ae9ed[_0x4551('0x52')]);def[_0x4551('0x54')]=util[_0x4551('0x29')](_0x4551('0x68'),_0x3ae9ed[_0x4551('0x51')]);if(_0xaf27bb&&_0xaf27bb['recordingFormat']&&_0xaf27bb[_0x4551('0x69')]!==_0x4551('0x6a')){logger[_0x4551('0xd')]('[OUTBOUND]',_0x4551('0x6b'));_0x476068['recordingURL']=util[_0x4551('0x29')](_0x4551('0x6c'),_0x3ae9ed[_0x4551('0x52')],_0x476068[_0x4551('0x6d')],md5(_0x476068[_0x4551('0x6d')]));}return getConnection(_0x3ae9ed)['then'](function(_0x4e44a9){_0x390e85=_0x4e44a9;return getUser(_0x3ae9ed,_0x5acf9f[_0x4551('0xe')],_0x390e85);})[_0x4551('0x37')](function(_0x3197c8){_0xd15c5b=_0x3197c8;logger[_0x4551('0xd')](_0x4551('0x57'),_0xd15c5b['id']);return getEndUser(_0x3ae9ed,_0x476068[_0x4551('0x6e')],_0x476068['destcalleridnum'],_0x390e85);})[_0x4551('0x37')](function(_0x5a17d0){_0x5b414f=_0x5a17d0;logger[_0x4551('0xd')](_0x4551('0x5a'),_0x5b414f['id']);return getTicket(_0x3ae9ed,_0xd15c5b,_0x5b414f,_0x4c3b79,_0x476068,_0x4c3b79[_0x4551('0x5b')],_0x390e85,_0x4551('0x6f'));})[_0x4551('0x37')](function(_0x1582dc){_0xcd4af=_0x1582dc;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0xcd4af['id']);return setRelationship(_0x390e85,_0xd15c5b,_0xcd4af,_0x4551('0x5e'));})[_0x4551('0x37')](function(){return setRelationship(_0x390e85,_0x5b414f,_0xcd4af,_0x4551('0x5f'));})[_0x4551('0x37')](function(){return getServerInfo(_0x390e85);})[_0x4551('0x37')](function(_0x45a56d){var _0x564ee7=parseInt(_0x45a56d[_0x4551('0x60')][_0x4551('0x61')](0x0));var _0x43e86c=util['format'](_0x4551('0x70'),_0x3ae9ed[_0x4551('0x51')],_0xcd4af['id']);if(_0x564ee7>0x6){_0x43e86c=util[_0x4551('0x29')](_0x4551('0x62'),_0x3ae9ed[_0x4551('0x51')],_0xcd4af['id']);}logger[_0x4551('0xd')](_0x4551('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4551('0x29')]('user:%s',_0x5acf9f[_0x4551('0xe')]),_0x4551('0x65'),{'uri':_0x43e86c});})[_0x4551('0x66')](function(_0x395b15){logger[_0x4551('0x72')]('[OUTBOUND]',JSON[_0x4551('0x21')](_0x395b15));});};exports['unmanaged']=function(_0x4efb6d,_0x1bdefb,_0x2d8a99,_0x5d5f68,_0x5695ba,_0x4cb92e){var _0x5a52bb,_0x3f239d,_0x45ba75,_0x53472d;_0x4cb92e['remoteUri']=intUtil[_0x4551('0x53')](_0x4cb92e[_0x4551('0x51')]);_0x4cb92e[_0x4551('0x52')]=intUtil['stripTrailingSlash'](_0x4cb92e[_0x4551('0x52')]);def[_0x4551('0x54')]=util[_0x4551('0x29')](_0x4551('0x68'),_0x4cb92e[_0x4551('0x51')]);if(_0x5695ba&&_0x5695ba[_0x4551('0x73')]){logger[_0x4551('0xd')]('['+_0x1bdefb[_0x4551('0x74')][_0x4551('0x75')]()+']',_0x4551('0x6b'));_0x1bdefb[_0x4551('0x56')]=util[_0x4551('0x29')](_0x4551('0x6c'),_0x4cb92e['serverUrl'],_0x1bdefb['uniqueid'],md5(_0x1bdefb[_0x4551('0x6d')]));}else{_0x1bdefb[_0x4551('0x56')]='';}return getConnection(_0x4cb92e)[_0x4551('0x37')](function(_0x392833){_0x53472d=_0x392833;if(!_['isNil'](_0x5d5f68)){return getUser(_0x4cb92e,_0x5d5f68['name'],_0x53472d);}else{return getUser(_0x4cb92e,null,_0x53472d);}})[_0x4551('0x37')](function(_0x47b00b){_0x5a52bb=_0x47b00b;logger[_0x4551('0xd')]('The\x20User\x20ID\x20is:',_0x5a52bb['id']);return getEndUser(_0x4cb92e,_0x1bdefb[_0x4551('0x58')],_0x1bdefb[_0x4551('0x59')],_0x53472d);})[_0x4551('0x37')](function(_0x3ce54e){_0x3f239d=_0x3ce54e;logger[_0x4551('0xd')](_0x4551('0x5a'),_0x3f239d['id']);return getTicket(_0x4cb92e,_0x5a52bb,_0x3f239d,_0x2d8a99,_0x1bdefb,_0x2d8a99[_0x4551('0x5b')],_0x53472d,_0x4551('0x5c'));})[_0x4551('0x37')](function(_0x125731){_0x45ba75=_0x125731;logger[_0x4551('0xd')](_0x4551('0x76'));logger[_0x4551('0xd')](_0x4551('0x5d'),_0x45ba75['id']);return setRelationship(_0x53472d,_0x5a52bb,_0x45ba75,_0x4551('0x5e'));})[_0x4551('0x37')](function(){return setRelationship(_0x53472d,_0x3f239d,_0x45ba75,_0x4551('0x5f'));})['then'](function(){return getServerInfo(_0x53472d);})[_0x4551('0x66')](function(_0xcd8abf){logger[_0x4551('0x72')]('['+_0x1bdefb[_0x4551('0x74')][_0x4551('0x75')]()+']',JSON[_0x4551('0x21')](_0xcd8abf));});}; \ No newline at end of file +var _0x4bb5=['xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','monitor_format','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','uri','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','version','user:%s','catch','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','calleridname','lodash','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','custom_fields','customVariable','Variable','POST','login','username','password','PLAIN'];(function(_0x146958,_0x572fc9){var _0x253f9d=function(_0x21390d){while(--_0x21390d){_0x146958['push'](_0x146958['shift']());}};_0x253f9d(++_0x572fc9);}(_0x4bb5,0x126));var _0x54bb=function(_0xe522ca,_0x3553e6){_0xe522ca=_0xe522ca-0x0;var _0x354f98=_0x4bb5[_0xe522ca];return _0x354f98;};'use strict';var _=require(_0x54bb('0x0'));var rp=require('request-promise');var BPromise=require(_0x54bb('0x1'));var md5=require(_0x54bb('0x2'));var util=require(_0x54bb('0x3'));var Redis=require(_0x54bb('0x4'));var intUtil=require(_0x54bb('0x5'));var config=require('../../../../config/environment');var logger=require(_0x54bb('0x6'))(_0x54bb('0x7'));config[_0x54bb('0x8')]=_[_0x54bb('0x9')](config['redis'],{'host':_0x54bb('0xa'),'port':0x18eb});var io=require(_0x54bb('0xb'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x1db5c1,_0x44db9b,_0x14f619){io['to'](_0x1db5c1)[_0x54bb('0xc')](_0x44db9b,_0x14f619);}function getTicket(_0x3458f8,_0x1475fd,_0x4ae4bf,_0x3a6ac6,_0x3212a1,_0x3d21f0,_0x3a765f,_0xf97958){logger[_0x54bb('0xd')](_0x54bb('0xe'));var _0x1621d1=new Date();var _0x1efa11=[{'name':_0x54bb('0xf'),'value':intUtil[_0x54bb('0x10')](_0x3a6ac6[_0x54bb('0x11')],_0x3212a1,'\x20')},{'name':_0x54bb('0x12'),'value':_0x1475fd['id']},{'name':_0x54bb('0x13'),'value':_0x1475fd['id']},{'name':_0x54bb('0x14'),'value':intUtil['getString'](_0x3a6ac6[_0x54bb('0x15')],_0x3212a1,'\x0a')},{'name':_0x54bb('0x16'),'value':_0x1621d1[_0x54bb('0x17')]()['slice'](0x0,0x13)[_0x54bb('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x54bb('0x19'),'value':_0x4ae4bf['id']},{'name':_0x54bb('0x1a'),'value':_0x54bb('0x1b')},{'name':_0x54bb('0x1c'),'value':_0x4ae4bf[_0x54bb('0xf')]},{'name':_0x54bb('0x1d'),'value':_0xf97958}];if(_0x3d21f0[_0x54bb('0x1e')]){_[_0x54bb('0x1f')](_0x3d21f0,function(_0x4bc31c){if(_0x3212a1[_0x4bc31c[_0x54bb('0x20')]]){_0x1efa11[_0x54bb('0x21')]({'name':_0x4bc31c[_0x54bb('0x22')],'value':_0x3212a1[_0x4bc31c['variableName']]});}});}return request({'form':{'method':_0x54bb('0x23'),'input_type':_0x54bb('0x24'),'response_type':_0x54bb('0x24'),'rest_data':JSON[_0x54bb('0x25')]({'session':_0x3a765f['id'],'module_name':_0x54bb('0x26'),'name_value_list':_0x1efa11})}});}function getAuth(_0x1433dc){return util[_0x54bb('0x27')](_0x54bb('0x28'),new Buffer(_0x1433dc[_0x54bb('0x29')]+':X')[_0x54bb('0x2a')](_0x54bb('0x2b')));}function getServerInfo(_0x5144bc){return request({'form':{'method':_0x54bb('0x2c'),'input_type':_0x54bb('0x24'),'response_type':'JSON','rest_data':JSON[_0x54bb('0x25')]({'session':_0x5144bc['id']})}});}function getUser(_0x36d27f,_0x877b3b,_0x7a8bdf){if(!_[_0x54bb('0x2d')](_0x877b3b)){logger[_0x54bb('0xd')](_0x54bb('0x2e'),_0x877b3b);return request({'form':{'method':_0x54bb('0x2f'),'input_type':_0x54bb('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x7a8bdf['id'],'module_name':_0x54bb('0x30'),'query':util['format'](_0x54bb('0x31'),_0x877b3b),'order_by':'','offset':'0','select_fields':['id',_0x54bb('0xf'),_0x54bb('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x54bb('0x33')](function(_0x536726){if(_0x536726[_0x54bb('0x34')]['length']){var _0x30fc18=_[_0x54bb('0x35')](_0x536726[_0x54bb('0x34')],function(_0x2590b4){return _0x2590b4[_0x54bb('0x36')][_0x54bb('0x32')]['value']===_0x877b3b;});if(_0x30fc18){logger[_0x54bb('0xd')](_0x54bb('0x37'));return BPromise[_0x54bb('0x38')]({'id':_0x30fc18[_0x54bb('0x36')]['id'][_0x54bb('0x39')],'name':_0x30fc18[_0x54bb('0x36')][_0x54bb('0xf')][_0x54bb('0x39')]});}}logger[_0x54bb('0xd')](_0x54bb('0x3a'));return BPromise[_0x54bb('0x38')]({'id':_0x7a8bdf['name_value_list'][_0x54bb('0x3b')][_0x54bb('0x39')],'name':_0x7a8bdf[_0x54bb('0x36')]['user_name'][_0x54bb('0x39')]});});}else{logger[_0x54bb('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x54bb('0x38')]({'id':_0x7a8bdf['name_value_list'][_0x54bb('0x3b')]['value'],'name':_0x7a8bdf[_0x54bb('0x36')][_0x54bb('0x32')][_0x54bb('0x39')]});}}function getEndUser(_0x56f327,_0x5c14aa,_0x1c1dbe,_0x38b333){logger[_0x54bb('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1c1dbe);return request({'form':{'method':_0x54bb('0x2f'),'input_type':_0x54bb('0x24'),'response_type':_0x54bb('0x24'),'rest_data':JSON[_0x54bb('0x25')]({'session':_0x38b333['id'],'module_name':'Contacts','query':util[_0x54bb('0x27')](_0x54bb('0x3c'),_0x1c1dbe),'order_by':'','offset':'0','select_fields':['id',_0x54bb('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x585d29){if(_0x585d29[_0x54bb('0x34')][_0x54bb('0x1e')]){var _0x213651=_[_0x54bb('0x35')](_0x585d29['entry_list'],function(_0x165aea){return _0x165aea[_0x54bb('0x36')][_0x54bb('0x3d')]['value']===_0x1c1dbe;});if(_0x213651){logger['info'](_0x54bb('0x3e'));return BPromise[_0x54bb('0x38')]({'id':_0x213651['name_value_list']['id'][_0x54bb('0x39')],'name':_0x213651[_0x54bb('0x36')][_0x54bb('0xf')][_0x54bb('0x39')],'phone':_0x213651['name_value_list']['phone_home'][_0x54bb('0x39')]});}}else{logger[_0x54bb('0xd')](_0x54bb('0x3f'));return request({'form':{'method':_0x54bb('0x23'),'input_type':_0x54bb('0x24'),'response_type':_0x54bb('0x24'),'rest_data':JSON['stringify']({'session':_0x38b333['id'],'module_name':_0x54bb('0x1b'),'name_value_list':[{'name':'first_name','value':_0x5c14aa!==''?_0x5c14aa:util[_0x54bb('0x27')](_0x54bb('0x40'),_0x1c1dbe)},{'name':_0x54bb('0x3d'),'value':_0x1c1dbe}]})}})[_0x54bb('0x33')](function(_0x53f995){logger[_0x54bb('0xd')](_0x54bb('0x41'));return BPromise['resolve']({'id':_0x53f995['id'],'name':_0x53f995[_0x54bb('0x34')][_0x54bb('0x42')][_0x54bb('0x39')],'phone':_0x53f995[_0x54bb('0x34')][_0x54bb('0x3d')][_0x54bb('0x39')]});});}});}function request(_0x431eef){logger[_0x54bb('0x43')](_0x54bb('0x44'),JSON['stringify'](_0x431eef));return rp(_[_0x54bb('0x45')](def,_0x431eef));}function getTags(_0x314990,_0x2da35f){var _0x49578a=[];if(_0x314990&&_0x314990['length']>0x0){_0x49578a=_[_0x54bb('0x46')](_0x314990,_0x2da35f);}return _0x49578a;}function getCustomFields(_0x17c0bd,_0x15dcc2){var _0x1d16fe=[];var _0x4d475a={'custom_fields':[]};if(_0x17c0bd['length']>0x0){_[_0x54bb('0x1f')](_0x17c0bd,function(_0x37d849){if(_0x37d849['type']==='string'&&_0x37d849[_0x54bb('0x47')]&&!_0x37d849[_0x54bb('0x48')]){_0x4d475a[_0x37d849[_0x54bb('0x47')][_0x54bb('0x49')]()]=_0x37d849[_0x54bb('0x4a')][_0x54bb('0x2a')]();}else if(_0x37d849[_0x54bb('0x4b')]==='string'&&_0x37d849[_0x54bb('0x22')]&&_0x37d849[_0x54bb('0x48')]){_0x4d475a['custom_fields']['push']({'id':_0x37d849[_0x54bb('0x22')],'value':_0x37d849[_0x54bb('0x4a')]['toString']()});}else if(_0x37d849[_0x54bb('0x4b')]==='variable'&&_0x37d849['variableName']&&_0x37d849[_0x54bb('0x22')]&&_0x37d849[_0x54bb('0x48')]){_0x15dcc2[_0x37d849[_0x54bb('0x20')]]&&_0x4d475a[_0x54bb('0x4c')][_0x54bb('0x21')]({'id':_0x37d849[_0x54bb('0x22')],'value':_0x15dcc2[_0x37d849[_0x54bb('0x20')]][_0x54bb('0x2a')]()});}else if(_0x37d849['type']===_0x54bb('0x4d')&&_0x37d849[_0x54bb('0x4e')]&&_0x37d849[_0x54bb('0x4e')]['name']&&_0x37d849[_0x54bb('0x22')]&&_0x37d849[_0x54bb('0x48')]){_0x15dcc2[_0x37d849[_0x54bb('0x4e')]['name']['toLowerCase']()]&&_0x4d475a[_0x54bb('0x4c')][_0x54bb('0x21')]({'id':_0x37d849[_0x54bb('0x22')],'value':_0x15dcc2[_0x37d849[_0x54bb('0x4e')][_0x54bb('0xf')][_0x54bb('0x49')]()][_0x54bb('0x2a')]()});}});}return _0x4d475a;}function getConnection(_0x40f417){return request({'method':_0x54bb('0x4f'),'form':{'method':_0x54bb('0x50'),'input_type':_0x54bb('0x24'),'response_type':_0x54bb('0x24'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x40f417[_0x54bb('0x51')],'password':_0x40f417[_0x54bb('0x52')],'encryption':_0x54bb('0x53')},'application':_0x54bb('0x54')})}})['then'](function(_0x29c2dd){var _0x4eb8f3=_0x29c2dd;if(_0x4eb8f3['id']){def['sessionID']=_0x4eb8f3['id'];return BPromise[_0x54bb('0x38')](_0x4eb8f3);}else{throw new Error(util[_0x54bb('0x27')](_0x54bb('0x55'),_0x40f417['id']));}});}function setRelationship(_0x4f6c90,_0x50438d,_0x911f7c,_0x2080d5){return request({'form':{'method':_0x54bb('0x56'),'input_type':_0x54bb('0x24'),'response_type':_0x54bb('0x24'),'rest_data':JSON[_0x54bb('0x25')]({'session':_0x4f6c90['id'],'module_name':_0x54bb('0x26'),'module_id':_0x911f7c['id'],'link_field_name':_0x2080d5,'related_ids':[_0x50438d['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x1a0081,_0xabb9f1,_0x234637,_0x1efd89,_0x4aabe1,_0x356371){var _0x1a4549,_0x6d5c5a,_0x40a2ae,_0x55d00e;_0x356371[_0x54bb('0x57')]=intUtil[_0x54bb('0x58')](_0x356371[_0x54bb('0x57')]);_0x356371[_0x54bb('0x59')]=intUtil[_0x54bb('0x58')](_0x356371[_0x54bb('0x59')]);def['uri']=util[_0x54bb('0x27')]('%s/service/v4_1/rest.php',_0x356371[_0x54bb('0x57')]);if(_0x4aabe1&&_0x4aabe1[_0x54bb('0x5a')]){logger[_0x54bb('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0xabb9f1['recordingURL']=util[_0x54bb('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x356371[_0x54bb('0x59')],_0xabb9f1[_0x54bb('0x5b')],md5(_0xabb9f1[_0x54bb('0x5b')]));}else{_0xabb9f1[_0x54bb('0x5c')]='';}return getConnection(_0x356371)[_0x54bb('0x33')](function(_0x1124f3){_0x55d00e=_0x1124f3;return getUser(_0x356371,_0x1efd89[_0x54bb('0xf')],_0x55d00e);})[_0x54bb('0x33')](function(_0x47eff8){_0x1a4549=_0x47eff8;logger[_0x54bb('0xd')](_0x54bb('0x5d'),_0x1a4549['id']);return getEndUser(_0x356371,_0xabb9f1['calleridname'],_0xabb9f1[_0x54bb('0x5e')],_0x55d00e);})['then'](function(_0x3772ac){_0x6d5c5a=_0x3772ac;logger[_0x54bb('0xd')](_0x54bb('0x5f'),_0x6d5c5a['id']);return getTicket(_0x356371,_0x1a4549,_0x6d5c5a,_0x234637,_0xabb9f1,_0x234637[_0x54bb('0x60')],_0x55d00e,_0x54bb('0x61'));})[_0x54bb('0x33')](function(_0x2a9449){_0x40a2ae=_0x2a9449;logger[_0x54bb('0xd')](_0x54bb('0x62'));logger['info'](_0x54bb('0x63'),_0x40a2ae['id']);return setRelationship(_0x55d00e,_0x1a4549,_0x40a2ae,_0x54bb('0x64'));})[_0x54bb('0x33')](function(){return setRelationship(_0x55d00e,_0x6d5c5a,_0x40a2ae,_0x54bb('0x65'));})['then'](function(){return getServerInfo(_0x55d00e);})[_0x54bb('0x33')](function(_0x2e6ac7){var _0x15ce29=parseInt(_0x2e6ac7['version'][_0x54bb('0x66')](0x0));var _0x17f4b6=util[_0x54bb('0x27')](_0x54bb('0x67'),_0x356371['remoteUri'],_0x40a2ae['id']);if(_0x15ce29>0x6){_0x17f4b6=util[_0x54bb('0x27')](_0x54bb('0x68'),_0x356371[_0x54bb('0x57')],_0x40a2ae['id']);}logger[_0x54bb('0xd')](_0x54bb('0x69'),_0x54bb('0x6a'));emit(util[_0x54bb('0x27')]('user:%s',_0x1efd89[_0x54bb('0xf')]),_0x54bb('0x6b'),{'uri':_0x17f4b6});})['catch'](function(_0x613345){logger[_0x54bb('0x6c')](_0x54bb('0x69'),JSON[_0x54bb('0x25')](_0x613345));});};exports[_0x54bb('0x6d')]=function(_0x154c6f,_0x3c11cf,_0x18bdd3,_0xcee1a9,_0x34f7cb,_0xad89c7,_0x292825){var _0xe970b2,_0x358708,_0x100b83,_0x259bfe;_0xad89c7[_0x54bb('0x57')]=intUtil['stripTrailingSlash'](_0xad89c7[_0x54bb('0x57')]);_0xad89c7[_0x54bb('0x59')]=intUtil[_0x54bb('0x58')](_0xad89c7[_0x54bb('0x59')]);def[_0x54bb('0x6e')]=util[_0x54bb('0x27')]('%s/service/v4_1/rest.php',_0xad89c7[_0x54bb('0x57')]);if(_0x292825&&_0x292825['recordingFormat']&&_0x292825[_0x54bb('0x6f')]!==_0x54bb('0x70')){logger[_0x54bb('0xd')](_0x54bb('0x71'),_0x54bb('0x72'));_0x3c11cf[_0x54bb('0x5c')]=util[_0x54bb('0x27')](_0x54bb('0x73'),_0xad89c7[_0x54bb('0x59')],_0x3c11cf['uniqueid'],md5(_0x3c11cf[_0x54bb('0x5b')]));}return getConnection(_0xad89c7)[_0x54bb('0x33')](function(_0x162951){_0x259bfe=_0x162951;return getUser(_0xad89c7,_0xcee1a9['name'],_0x259bfe);})[_0x54bb('0x33')](function(_0xfa9ad3){_0xe970b2=_0xfa9ad3;logger[_0x54bb('0xd')](_0x54bb('0x5d'),_0xe970b2['id']);return getEndUser(_0xad89c7,_0x3c11cf[_0x54bb('0x74')],_0x3c11cf['destcalleridnum'],_0x259bfe);})[_0x54bb('0x33')](function(_0xd4e50b){_0x358708=_0xd4e50b;logger[_0x54bb('0xd')]('The\x20Enduser\x20ID\x20is:',_0x358708['id']);return getTicket(_0xad89c7,_0xe970b2,_0x358708,_0x18bdd3,_0x3c11cf,_0x18bdd3[_0x54bb('0x60')],_0x259bfe,_0x54bb('0x75'));})[_0x54bb('0x33')](function(_0x297257){_0x100b83=_0x297257;logger[_0x54bb('0xd')](_0x54bb('0x62'));logger[_0x54bb('0xd')](_0x54bb('0x63'),_0x100b83['id']);return setRelationship(_0x259bfe,_0xe970b2,_0x100b83,_0x54bb('0x64'));})[_0x54bb('0x33')](function(){return setRelationship(_0x259bfe,_0x358708,_0x100b83,_0x54bb('0x65'));})[_0x54bb('0x33')](function(){return getServerInfo(_0x259bfe);})['then'](function(_0x16bdc7){var _0x14545f=parseInt(_0x16bdc7[_0x54bb('0x76')][_0x54bb('0x66')](0x0));var _0x2f6862=util[_0x54bb('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xad89c7[_0x54bb('0x57')],_0x100b83['id']);if(_0x14545f>0x6){_0x2f6862=util['format'](_0x54bb('0x68'),_0xad89c7[_0x54bb('0x57')],_0x100b83['id']);}logger[_0x54bb('0xd')]('[OUTBOUND]',_0x54bb('0x6a'));emit(util[_0x54bb('0x27')](_0x54bb('0x77'),_0xcee1a9[_0x54bb('0xf')]),_0x54bb('0x6b'),{'uri':_0x2f6862});})[_0x54bb('0x78')](function(_0x28c9ea){logger[_0x54bb('0x6c')]('[OUTBOUND]',JSON[_0x54bb('0x25')](_0x28c9ea));});};exports[_0x54bb('0x79')]=function(_0xa6531d,_0x35d732,_0xff7f02,_0x530ab3,_0x1b3926,_0x1c9e95){var _0xfa236,_0x5dc42e,_0x387e70,_0x46e0d3;_0x1c9e95[_0x54bb('0x57')]=intUtil[_0x54bb('0x58')](_0x1c9e95[_0x54bb('0x57')]);_0x1c9e95[_0x54bb('0x59')]=intUtil['stripTrailingSlash'](_0x1c9e95[_0x54bb('0x59')]);def['uri']=util[_0x54bb('0x27')](_0x54bb('0x7a'),_0x1c9e95[_0x54bb('0x57')]);if(_0x1b3926&&_0x1b3926['monitor_format']){logger[_0x54bb('0xd')]('['+_0x35d732[_0x54bb('0x7b')][_0x54bb('0x7c')]()+']','Recording\x20is\x20enabled!');_0x35d732['recordingURL']=util[_0x54bb('0x27')](_0x54bb('0x73'),_0x1c9e95['serverUrl'],_0x35d732['uniqueid'],md5(_0x35d732[_0x54bb('0x5b')]));}else{_0x35d732[_0x54bb('0x5c')]='';}return getConnection(_0x1c9e95)['then'](function(_0x21e37d){_0x46e0d3=_0x21e37d;if(!_[_0x54bb('0x2d')](_0x530ab3)){return getUser(_0x1c9e95,_0x530ab3['name'],_0x46e0d3);}else{return getUser(_0x1c9e95,null,_0x46e0d3);}})['then'](function(_0x5be40e){_0xfa236=_0x5be40e;logger[_0x54bb('0xd')]('The\x20User\x20ID\x20is:',_0xfa236['id']);return getEndUser(_0x1c9e95,_0x35d732[_0x54bb('0x7d')],_0x35d732['calleridnum'],_0x46e0d3);})['then'](function(_0x56e25b){_0x5dc42e=_0x56e25b;logger[_0x54bb('0xd')](_0x54bb('0x5f'),_0x5dc42e['id']);return getTicket(_0x1c9e95,_0xfa236,_0x5dc42e,_0xff7f02,_0x35d732,_0xff7f02[_0x54bb('0x60')],_0x46e0d3,_0x54bb('0x61'));})[_0x54bb('0x33')](function(_0x5d7b15){_0x387e70=_0x5d7b15;logger[_0x54bb('0xd')](_0x54bb('0x62'));logger[_0x54bb('0xd')](_0x54bb('0x63'),_0x387e70['id']);return setRelationship(_0x46e0d3,_0xfa236,_0x387e70,_0x54bb('0x64'));})[_0x54bb('0x33')](function(){return setRelationship(_0x46e0d3,_0x5dc42e,_0x387e70,'contacts');})[_0x54bb('0x33')](function(){return getServerInfo(_0x46e0d3);})[_0x54bb('0x78')](function(_0x9549ee){logger[_0x54bb('0x6c')]('['+_0x35d732['lastevent'][_0x54bb('0x7c')]()+']',JSON[_0x54bb('0x25')](_0x9549ee));});}; \ 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 eff3273..c92c612 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 _0x504d=['toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','type','string','content','variable','variableName','push','toString','customVariable','Variable','name'];(function(_0x22f7b0,_0x40f996){var _0x227dc7=function(_0x271357){while(--_0x271357){_0x22f7b0['push'](_0x22f7b0['shift']());}};_0x227dc7(++_0x40f996);}(_0x504d,0x7a));var _0xd504=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x504d[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0xd504('0x0'));exports[_0xd504('0x1')]=function(_0x38fdb1,_0x7b9432,_0x59f1bc){var _0x16a7cb=[];if(_0x38fdb1['length']>0x0){var _0x120c6c=_['sortBy'](_0x38fdb1,['id']);for(var _0x5cfa84=0x0;_0x5cfa84<_0x120c6c[_0xd504('0x2')];_0x5cfa84++){var _0x392c5c=_0x120c6c[_0x5cfa84];if(_0x392c5c[_0xd504('0x3')]===_0xd504('0x4')){_0x16a7cb['push'](_0x392c5c[_0xd504('0x5')]);}else if(_0x392c5c[_0xd504('0x3')]===_0xd504('0x6')&&_0x392c5c[_0xd504('0x7')]){_0x7b9432[_0x392c5c[_0xd504('0x7')]]&&_0x16a7cb[_0xd504('0x8')](_0x7b9432[_0x392c5c['variableName']][_0xd504('0x9')]());}else if(_0x392c5c[_0xd504('0x3')]===_0xd504('0xa')&&_0x392c5c[_0xd504('0xb')]&&_0x392c5c[_0xd504('0xb')][_0xd504('0xc')]){_0x7b9432[_0x392c5c[_0xd504('0xb')]['name'][_0xd504('0xd')]()]&&_0x16a7cb[_0xd504('0x8')](_0x7b9432[_0x392c5c[_0xd504('0xb')]['name'][_0xd504('0xd')]()][_0xd504('0x9')]());}else if(_0x392c5c[_0xd504('0x3')]===_0xd504('0xe')){if(_0x392c5c[_0xd504('0xf')]===_0xd504('0x4')&&_0x392c5c[_0xd504('0x10')]){_0x16a7cb['push'](util[_0xd504('0x11')](_0xd504('0x12'),_0x392c5c[_0xd504('0x10')],_0x392c5c[_0xd504('0x13')]));}else if(_0x392c5c[_0xd504('0xf')]===_0xd504('0x6')&&_0x392c5c['variableName']&&_0x392c5c[_0xd504('0x10')]){_0x7b9432[_0x392c5c['variableName']]&&_0x16a7cb['push'](util[_0xd504('0x11')]('%s:\x20%s',_0x392c5c[_0xd504('0x10')],_0x7b9432[_0x392c5c[_0xd504('0x7')]]));}else if(_0x392c5c[_0xd504('0xf')]===_0xd504('0xa')&&_0x392c5c[_0xd504('0xb')]&&_0x392c5c[_0xd504('0xb')][_0xd504('0xc')]&&_0x392c5c[_0xd504('0x10')]){_0x7b9432[_0x392c5c['Variable'][_0xd504('0xc')]['toLowerCase']()]&&_0x16a7cb['push'](util[_0xd504('0x11')](_0xd504('0x12'),_0x392c5c['key'],_0x7b9432[_0x392c5c[_0xd504('0xb')]['name'][_0xd504('0xd')]()]));}}}}return _0x16a7cb[_0xd504('0x14')](_0x59f1bc);};exports[_0xd504('0x15')]=function(_0x5a9aa8){var _0x5b4906=_0x5a9aa8['slice'](-0x1);if(_0x5b4906==='/'){_0x5a9aa8=_0x5a9aa8[_0xd504('0x16')](0x0,_0x5a9aa8[_0xd504('0x17')](_0x5b4906));}return _0x5a9aa8;};exports[_0xd504('0x18')]=function(_0x449fcc){if(!_[_0xd504('0x19')](_0x449fcc)&&_0x449fcc!==''){var _0x2ba134=/^(([^<>()\[\]\\.,;:\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 _0x2ba134[_0xd504('0x1a')](String(_0x449fcc)[_0xd504('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x97cd=['key','format','%s:\x20%s','keyContent','keyType','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x493d8a,_0x494215){var _0x4994d4=function(_0x1959ca){while(--_0x1959ca){_0x493d8a['push'](_0x493d8a['shift']());}};_0x4994d4(++_0x494215);}(_0x97cd,0x11e));var _0xd97c=function(_0x36debe,_0x3e5752){_0x36debe=_0x36debe-0x0;var _0xe4ff5a=_0x97cd[_0x36debe];return _0xe4ff5a;};'use strict';var _=require('lodash');var util=require(_0xd97c('0x0'));exports['getString']=function(_0xa79f64,_0x31cfb9,_0x4b784a){var _0x557ea6=[];if(_0xa79f64[_0xd97c('0x1')]>0x0){var _0x45f751=_[_0xd97c('0x2')](_0xa79f64,['id']);for(var _0x3519e6=0x0;_0x3519e6<_0x45f751['length'];_0x3519e6++){var _0xbd0188=_0x45f751[_0x3519e6];if(_0xbd0188[_0xd97c('0x3')]===_0xd97c('0x4')){_0x557ea6[_0xd97c('0x5')](_0xbd0188[_0xd97c('0x6')]);}else if(_0xbd0188[_0xd97c('0x3')]===_0xd97c('0x7')&&_0xbd0188['variableName']){_0x31cfb9[_0xbd0188['variableName']]&&_0x557ea6[_0xd97c('0x5')](_0x31cfb9[_0xbd0188[_0xd97c('0x8')]][_0xd97c('0x9')]());}else if(_0xbd0188['type']===_0xd97c('0xa')&&_0xbd0188[_0xd97c('0xb')]&&_0xbd0188[_0xd97c('0xb')]['name']){_0x31cfb9[_0xbd0188[_0xd97c('0xb')][_0xd97c('0xc')][_0xd97c('0xd')]()]&&_0x557ea6['push'](_0x31cfb9[_0xbd0188[_0xd97c('0xb')][_0xd97c('0xc')][_0xd97c('0xd')]()][_0xd97c('0x9')]());}else if(_0xbd0188[_0xd97c('0x3')]==='keyValue'){if(_0xbd0188['keyType']===_0xd97c('0x4')&&_0xbd0188[_0xd97c('0xe')]){_0x557ea6[_0xd97c('0x5')](util[_0xd97c('0xf')](_0xd97c('0x10'),_0xbd0188[_0xd97c('0xe')],_0xbd0188[_0xd97c('0x11')]));}else if(_0xbd0188[_0xd97c('0x12')]==='variable'&&_0xbd0188[_0xd97c('0x8')]&&_0xbd0188[_0xd97c('0xe')]){_0x31cfb9[_0xbd0188[_0xd97c('0x8')]]&&_0x557ea6[_0xd97c('0x5')](util[_0xd97c('0xf')](_0xd97c('0x10'),_0xbd0188[_0xd97c('0xe')],_0x31cfb9[_0xbd0188[_0xd97c('0x8')]]));}else if(_0xbd0188[_0xd97c('0x12')]===_0xd97c('0xa')&&_0xbd0188[_0xd97c('0xb')]&&_0xbd0188[_0xd97c('0xb')][_0xd97c('0xc')]&&_0xbd0188[_0xd97c('0xe')]){_0x31cfb9[_0xbd0188[_0xd97c('0xb')][_0xd97c('0xc')][_0xd97c('0xd')]()]&&_0x557ea6[_0xd97c('0x5')](util['format'](_0xd97c('0x10'),_0xbd0188[_0xd97c('0xe')],_0x31cfb9[_0xbd0188[_0xd97c('0xb')][_0xd97c('0xc')]['toLowerCase']()]));}}}}return _0x557ea6['join'](_0x4b784a);};exports[_0xd97c('0x13')]=function(_0x51ffbc){var _0x3170d2=_0x51ffbc[_0xd97c('0x14')](-0x1);if(_0x3170d2==='/'){_0x51ffbc=_0x51ffbc[_0xd97c('0x15')](0x0,_0x51ffbc[_0xd97c('0x16')](_0x3170d2));}return _0x51ffbc;};exports[_0xd97c('0x17')]=function(_0x5e7c9d){if(!_['isNil'](_0x5e7c9d)&&_0x5e7c9d!==''){var _0x461145=/^(([^<>()\[\]\\.,;:\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 _0x461145[_0xd97c('0x18')](String(_0x5e7c9d)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 10bd12e..f5cdeae 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +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(_0x52f163,_0x32ddae){var _0x59d36c=function(_0x3816d1){while(--_0x3816d1){_0x52f163['push'](_0x52f163['shift']());}};_0x59d36c(++_0x32ddae);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5bbfcb1..857d29a 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 _0x93fc=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','[OUTBOUND]','Authorization','email','destcalleridname','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','username','password','%s/token:%s','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','forEach','includes','string','type','customField','nameField','toLowerCase','idField','custom_fields','push','content','variable','variableName','Variable','name','queue','stripTrailingSlash'];(function(_0x4f2d59,_0xf50d07){var _0x14eadc=function(_0x3f0742){while(--_0x3f0742){_0x4f2d59['push'](_0x4f2d59['shift']());}};_0x14eadc(++_0xf50d07);}(_0x93fc,0xf4));var _0xc93f=function(_0x14edc6,_0x221e84){_0x14edc6=_0x14edc6-0x0;var _0x5edfa3=_0x93fc[_0x14edc6];return _0x5edfa3;};'use strict';var _=require(_0xc93f('0x0'));var rp=require(_0xc93f('0x1'));var md5=require(_0xc93f('0x2'));var util=require(_0xc93f('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc93f('0x4'));var logger=require(_0xc93f('0x5'))('zendesk');config['redis']=_[_0xc93f('0x6')](config[_0xc93f('0x7')],{'host':_0xc93f('0x8'),'port':0x18eb});var io=require(_0xc93f('0x9'))(new Redis(config[_0xc93f('0x7')]));function emit(_0x127af2,_0x4c8dc4,_0x33bf1b){io['to'](_0x127af2)['emit'](_0x4c8dc4,_0x33bf1b);}var headers={'Content-Type':'application/json','Accept':_0xc93f('0xa')};function getTicket(_0x164197,_0x42c319,_0x11c87c,_0x3ded03,_0xb337f0){logger[_0xc93f('0xb')](_0xc93f('0xc'));return request({'uri':util[_0xc93f('0xd')](_0xc93f('0xe'),_0x164197[_0xc93f('0xf')]),'method':_0xc93f('0x10'),'body':{'ticket':_[_0xc93f('0x11')]({'requester_id':_0x11c87c['id'],'submitter_id':_0x42c319?_0x42c319['id']:undefined,'assignee_id':_0x42c319?_0x42c319['id']:undefined,'tags':getTags(_0x3ded03[_0xc93f('0x12')],'name'),'subject':intUtil[_0xc93f('0x13')](_0x3ded03[_0xc93f('0x14')],_0xb337f0,'\x20'),'description':intUtil['getString'](_0x3ded03[_0xc93f('0x15')],_0xb337f0,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3ded03[_0xc93f('0x15')],_0xb337f0,'\x0a')}},getCustomFields(_0x3ded03[_0xc93f('0x16')],_0xb337f0))}})[_0xc93f('0x17')](function(_0x49cb61){logger[_0xc93f('0xb')](_0xc93f('0x18'));return _0x49cb61[_0xc93f('0x19')];});}function getUser(_0x556b1b,_0x1878e0){if(intUtil['validateEmail'](_0x1878e0)){logger['info'](_0xc93f('0x1a'),_0x1878e0);return request({'uri':util['format'](_0xc93f('0x1b'),_0x556b1b[_0xc93f('0xf')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x1878e0)}})[_0xc93f('0x17')](function(_0x14d210){if(_0x14d210['count']){logger[_0xc93f('0xb')](_0xc93f('0x1c'));return _[_0xc93f('0x1d')](_0x14d210['results'],{'email':_0x1878e0,'role':'agent'});}else{logger[_0xc93f('0xb')](_0xc93f('0x1e'));return request({'uri':util[_0xc93f('0xd')](_0xc93f('0x1f'),_0x556b1b[_0xc93f('0xf')])})[_0xc93f('0x17')](function(_0x2749f2){logger['info'](_0xc93f('0x20'));return _0x2749f2[_0xc93f('0x21')];});}});}else{logger[_0xc93f('0xb')](_0xc93f('0x1e'));return request({'uri':util[_0xc93f('0xd')](_0xc93f('0x1f'),_0x556b1b['remoteUri'])})['then'](function(_0x38c9de){logger[_0xc93f('0xb')](_0xc93f('0x20'));return _0x38c9de[_0xc93f('0x21')];});}}function getEndUser(_0x2c3409,_0x48dbc2,_0x50e56a){logger[_0xc93f('0xb')](_0xc93f('0x22'),_0x50e56a);return request({'uri':util[_0xc93f('0xd')](_0xc93f('0x1b'),_0x2c3409['remoteUri']),'qs':{'query':util['format'](_0xc93f('0x23'),_0x50e56a)}})[_0xc93f('0x17')](function(_0x3c08c8){var _0x53ea9b;if(_0x3c08c8[_0xc93f('0x24')][_0xc93f('0x25')]){_0x3c08c8[_0xc93f('0x24')]=_['filter'](_0x3c08c8[_0xc93f('0x24')],{'suspended':![],'role':'end-user'});if(_0x3c08c8[_0xc93f('0x24')][_0xc93f('0x25')]){_0x53ea9b=_[_0xc93f('0x26')](_0x3c08c8['results']);}}if(_0x53ea9b){logger[_0xc93f('0xb')](_0xc93f('0x27'));return _0x53ea9b;}else{logger['info'](_0xc93f('0x28'));return request({'uri':util[_0xc93f('0xd')](_0xc93f('0x29'),_0x2c3409[_0xc93f('0xf')]),'method':_0xc93f('0x10'),'body':{'user':{'role':'end-user','name':util[_0xc93f('0xd')](_0xc93f('0x2a'),_0x48dbc2||_0x50e56a),'phone':_0x50e56a}}})[_0xc93f('0x17')](function(_0x347682){logger[_0xc93f('0xb')]('Enduser\x20created.');return _0x347682[_0xc93f('0x21')];});}});}function getAuth(_0x43f7ba){var _0x1f57b4;if(_0x43f7ba[_0xc93f('0x2b')]==='password'){_0x1f57b4=util['format']('%s:%s',_0x43f7ba[_0xc93f('0x2c')],_0x43f7ba[_0xc93f('0x2d')]);}else if(_0x43f7ba['authType']==='token'){_0x1f57b4=util['format'](_0xc93f('0x2e'),_0x43f7ba[_0xc93f('0x2c')],_0x43f7ba[_0xc93f('0x2f')]);}return util['format'](_0xc93f('0x30'),new Buffer(_0x1f57b4)[_0xc93f('0x31')](_0xc93f('0x32')));}function request(_0x2efe77){logger['debug'](_0xc93f('0x33'),JSON[_0xc93f('0x34')](_0x2efe77));return rp(_[_0xc93f('0x6')](_0x2efe77,{'method':_0xc93f('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x367a96,_0x5a0f70){var _0x53034b=[];if(_0x367a96&&_0x367a96['length']>0x0){_0x53034b=_['map'](_0x367a96,_0x5a0f70);}return _0x53034b;}function getCustomFields(_0x178c05,_0x3ce26e){var _0x3516f7=[];var _0x57fca1={'custom_fields':[]};if(_0x178c05['length']>0x0){_[_0xc93f('0x36')](_0x178c05,function(_0x54bc62){if(_[_0xc93f('0x37')]([_0xc93f('0x38'),'picklist'],_0x54bc62[_0xc93f('0x39')])&&_0x54bc62['nameField']&&!_0x54bc62[_0xc93f('0x3a')]){_0x57fca1[_0x54bc62[_0xc93f('0x3b')][_0xc93f('0x3c')]()]=_0x54bc62['content'][_0xc93f('0x31')]();}else if(_[_0xc93f('0x37')]([_0xc93f('0x38'),'picklist'],_0x54bc62[_0xc93f('0x39')])&&_0x54bc62[_0xc93f('0x3d')]&&_0x54bc62[_0xc93f('0x3a')]){_0x57fca1[_0xc93f('0x3e')][_0xc93f('0x3f')]({'id':_0x54bc62[_0xc93f('0x3d')],'value':_0x54bc62[_0xc93f('0x40')][_0xc93f('0x31')]()});}else if(_0x54bc62['type']===_0xc93f('0x41')&&_0x54bc62[_0xc93f('0x42')]&&_0x54bc62['idField']&&_0x54bc62[_0xc93f('0x3a')]){_0x3ce26e[_0x54bc62[_0xc93f('0x42')]]&&_0x57fca1[_0xc93f('0x3e')][_0xc93f('0x3f')]({'id':_0x54bc62[_0xc93f('0x3d')],'value':_0x3ce26e[_0x54bc62[_0xc93f('0x42')]][_0xc93f('0x31')]()});}else if(_0x54bc62[_0xc93f('0x39')]==='customVariable'&&_0x54bc62[_0xc93f('0x43')]&&_0x54bc62[_0xc93f('0x43')]['name']&&_0x54bc62['idField']&&_0x54bc62[_0xc93f('0x3a')]){_0x3ce26e[_0x54bc62[_0xc93f('0x43')][_0xc93f('0x44')][_0xc93f('0x3c')]()]&&_0x57fca1[_0xc93f('0x3e')][_0xc93f('0x3f')]({'id':_0x54bc62[_0xc93f('0x3d')],'value':_0x3ce26e[_0x54bc62[_0xc93f('0x43')][_0xc93f('0x44')][_0xc93f('0x3c')]()][_0xc93f('0x31')]()});}});}return _0x57fca1;}exports[_0xc93f('0x45')]=function(_0x4ef7e9,_0x1e15b6,_0x14b10c,_0x411c6d,_0x47aeeb,_0x45b382){var _0x2c67f7,_0x353661;_0x45b382[_0xc93f('0xf')]=intUtil[_0xc93f('0x46')](_0x45b382['remoteUri']);_0x45b382[_0xc93f('0x47')]=intUtil['stripTrailingSlash'](_0x45b382[_0xc93f('0x47')]);if(_0x47aeeb&&_0x47aeeb[_0xc93f('0x48')]){logger[_0xc93f('0xb')](_0xc93f('0x49'),_0xc93f('0x4a'));_0x1e15b6[_0xc93f('0x4b')]=util['format'](_0xc93f('0x4c'),_0x45b382['serverUrl'],_0x1e15b6[_0xc93f('0x4d')],md5(_0x1e15b6[_0xc93f('0x4d')]));}else{_0x1e15b6['recordingURL']='';}headers['Authorization']=getAuth(_0x45b382);return getUser(_0x45b382,_0x411c6d['email'])['then'](function(_0x231cdc){_0x2c67f7=_0x231cdc;logger[_0xc93f('0xb')](_0xc93f('0x4e'),_0x2c67f7['id']);return getEndUser(_0x45b382,_0x1e15b6[_0xc93f('0x4f')],_0x1e15b6['calleridnum']);})[_0xc93f('0x17')](function(_0x1434f3){_0x353661=_0x1434f3;logger[_0xc93f('0xb')](_0xc93f('0x50'),_0x353661['id']);return getTicket(_0x45b382,_0x2c67f7,_0x353661,_0x14b10c,_0x1e15b6);})['then'](function(_0x50d6b9){if(_0x50d6b9){logger[_0xc93f('0xb')](_0xc93f('0x51'),_0x50d6b9['id']);switch(_0x45b382[_0xc93f('0x39')]){case _0xc93f('0x52'):logger[_0xc93f('0xb')](_0xc93f('0x49'),_0xc93f('0x53'));return request({'uri':util[_0xc93f('0xd')](_0xc93f('0x54'),_0x45b382['remoteUri'],_0x2c67f7['id'],_0x50d6b9['id']),'method':_0xc93f('0x10')});case _0xc93f('0x55'):logger[_0xc93f('0xb')](_0xc93f('0x49'),_0xc93f('0x56'));emit(util['format']('user:%s',_0x411c6d[_0xc93f('0x44')]),_0xc93f('0x57'),{'uri':util[_0xc93f('0xd')](_0xc93f('0x58'),_0x45b382[_0xc93f('0xf')][_0xc93f('0x59')](_0xc93f('0x5a'),''),_0x50d6b9['id'])});break;default:logger[_0xc93f('0x5b')](_0xc93f('0x49'),_0xc93f('0x5c'));}}})[_0xc93f('0x5d')](function(_0x6a6672){logger[_0xc93f('0x5b')](_0xc93f('0x5e'),util[_0xc93f('0x5f')](_0x6a6672,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5bad2d,_0x57e5d8,_0x5712a2,_0x11d046,_0x4b3562,_0x4500ba,_0x2ee394){var _0xd5245e,_0x102083;_0x4500ba['remoteUri']=intUtil[_0xc93f('0x46')](_0x4500ba[_0xc93f('0xf')]);_0x4500ba['serverUrl']=intUtil[_0xc93f('0x46')](_0x4500ba[_0xc93f('0x47')]);if(_0x2ee394&&_0x2ee394['recordingFormat']&&_0x2ee394['recordingFormat']!=='none'){logger[_0xc93f('0xb')](_0xc93f('0x60'),'Recording\x20is\x20enabled!');_0x57e5d8[_0xc93f('0x4b')]=util[_0xc93f('0xd')](_0xc93f('0x4c'),_0x4500ba['serverUrl'],_0x57e5d8[_0xc93f('0x4d')],md5(_0x57e5d8[_0xc93f('0x4d')]));}headers[_0xc93f('0x61')]=getAuth(_0x4500ba);return getUser(_0x4500ba,_0x11d046[_0xc93f('0x62')])['then'](function(_0x1882fb){_0xd5245e=_0x1882fb;logger[_0xc93f('0xb')](_0xc93f('0x4e'),_0xd5245e['id']);return getEndUser(_0x4500ba,_0x57e5d8[_0xc93f('0x63')],_0x57e5d8['destcalleridnum']);})[_0xc93f('0x17')](function(_0xb3f806){_0x102083=_0xb3f806;logger[_0xc93f('0xb')]('The\x20Enduser\x20ID\x20is:',_0x102083['id']);return getTicket(_0x4500ba,_0xd5245e,_0x102083,_0x5712a2,_0x57e5d8);})['then'](function(_0x38d4dd){if(_0x38d4dd){logger['info'](_0xc93f('0x51'),_0x38d4dd['id']);switch(_0x4500ba[_0xc93f('0x39')]){case'integrationTab':logger[_0xc93f('0xb')]('[OUTBOUND]',_0xc93f('0x53'));return request({'uri':util['format'](_0xc93f('0x54'),_0x4500ba['remoteUri'],_0xd5245e['id'],_0x38d4dd['id']),'method':_0xc93f('0x10')});case _0xc93f('0x55'):logger[_0xc93f('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc93f('0xd')](_0xc93f('0x64'),_0x11d046[_0xc93f('0x44')]),_0xc93f('0x57'),{'uri':util[_0xc93f('0xd')]('%s/agent/tickets/%s',_0x4500ba[_0xc93f('0xf')][_0xc93f('0x59')](_0xc93f('0x5a'),''),_0x38d4dd['id'])});break;default:logger['error']('[OUTBOUND]',_0xc93f('0x5c'));}}})[_0xc93f('0x5d')](function(_0x31ed2a){logger[_0xc93f('0x5b')](_0xc93f('0x65'),util[_0xc93f('0x5f')](_0x31ed2a,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x49fd85,_0x5a3c56,_0x8e4bd,_0x549c37,_0x5c3b2c,_0x430a61){var _0x116946,_0x3af78a;_0x430a61['remoteUri']=intUtil[_0xc93f('0x46')](_0x430a61[_0xc93f('0xf')]);_0x430a61[_0xc93f('0x47')]=intUtil[_0xc93f('0x46')](_0x430a61['serverUrl']);if(_0x5c3b2c&&_0x5c3b2c[_0xc93f('0x48')]){logger[_0xc93f('0xb')]('['+_0x5a3c56[_0xc93f('0x66')]['toUpperCase']()+']',_0xc93f('0x4a'));_0x5a3c56[_0xc93f('0x4b')]=util[_0xc93f('0xd')](_0xc93f('0x4c'),_0x430a61[_0xc93f('0x47')],_0x5a3c56[_0xc93f('0x4d')],md5(_0x5a3c56[_0xc93f('0x4d')]));}else{_0x5a3c56[_0xc93f('0x4b')]='';}headers[_0xc93f('0x61')]=getAuth(_0x430a61);return getUser(_0x430a61)[_0xc93f('0x17')](function(_0xf0b016){_0x116946=_0xf0b016;logger[_0xc93f('0xb')](_0xc93f('0x4e'),_0x116946['id']);return getEndUser(_0x430a61,_0x5a3c56[_0xc93f('0x4f')],_0x5a3c56[_0xc93f('0x67')]);})['then'](function(_0x4e9006){_0x3af78a=_0x4e9006;logger[_0xc93f('0xb')](_0xc93f('0x50'),_0x3af78a['id']);return getTicket(_0x430a61,_0x116946,_0x3af78a,_0x8e4bd,_0x5a3c56);})[_0xc93f('0x17')](function(_0x5e25c1){if(_0x5e25c1){logger[_0xc93f('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5e25c1['id']);}})[_0xc93f('0x5d')](function(_0x4603ee){logger[_0xc93f('0x5b')]('['+_0x5a3c56[_0xc93f('0x66')]['toUpperCase']()+']'+_0xc93f('0x68'),util[_0xc93f('0x5f')](_0x4603ee,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x213d=['count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','%s/token:%s','token','debug','[HTTP]','GET','string','picklist','type','nameField','content','toString','includes','idField','custom_fields','push','variableName','customVariable','Variable','customField','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json'];(function(_0x432022,_0x115765){var _0x5488dd=function(_0x27e9e3){while(--_0x27e9e3){_0x432022['push'](_0x432022['shift']());}};_0x5488dd(++_0x115765);}(_0x213d,0x1a2));var _0xd213=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x213d[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xd213('0x0'));var rp=require(_0xd213('0x1'));var md5=require(_0xd213('0x2'));var util=require('util');var Redis=require(_0xd213('0x3'));var intUtil=require(_0xd213('0x4'));var config=require(_0xd213('0x5'));var logger=require(_0xd213('0x6'))(_0xd213('0x7'));config['redis']=_[_0xd213('0x8')](config[_0xd213('0x9')],{'host':_0xd213('0xa'),'port':0x18eb});var io=require(_0xd213('0xb'))(new Redis(config[_0xd213('0x9')]));function emit(_0x44c1a7,_0x1e8e5c,_0x234519){io['to'](_0x44c1a7)[_0xd213('0xc')](_0x1e8e5c,_0x234519);}var headers={'Content-Type':_0xd213('0xd'),'Accept':'application/json'};function getTicket(_0x1593d3,_0x3edfb6,_0x483e29,_0x249bdb,_0x2c5a7c){logger[_0xd213('0xe')](_0xd213('0xf'));return request({'uri':util['format'](_0xd213('0x10'),_0x1593d3[_0xd213('0x11')]),'method':'POST','body':{'ticket':_[_0xd213('0x12')]({'requester_id':_0x483e29['id'],'submitter_id':_0x3edfb6?_0x3edfb6['id']:undefined,'assignee_id':_0x3edfb6?_0x3edfb6['id']:undefined,'tags':getTags(_0x249bdb['Tags'],_0xd213('0x13')),'subject':intUtil[_0xd213('0x14')](_0x249bdb[_0xd213('0x15')],_0x2c5a7c,'\x20'),'description':intUtil[_0xd213('0x14')](_0x249bdb[_0xd213('0x16')],_0x2c5a7c,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd213('0x14')](_0x249bdb[_0xd213('0x16')],_0x2c5a7c,'\x0a')}},getCustomFields(_0x249bdb[_0xd213('0x17')],_0x2c5a7c))}})[_0xd213('0x18')](function(_0x5554ca){logger[_0xd213('0xe')](_0xd213('0x19'));return _0x5554ca[_0xd213('0x1a')];});}function getUser(_0x475bb6,_0x5b89ac){if(intUtil['validateEmail'](_0x5b89ac)){logger['info'](_0xd213('0x1b'),_0x5b89ac);return request({'uri':util[_0xd213('0x1c')](_0xd213('0x1d'),_0x475bb6[_0xd213('0x11')]),'qs':{'query':util[_0xd213('0x1c')]('type:user\x20role:agent\x20email:%s',_0x5b89ac)}})[_0xd213('0x18')](function(_0x145e61){if(_0x145e61[_0xd213('0x1e')]){logger[_0xd213('0xe')](_0xd213('0x1f'));return _[_0xd213('0x20')](_0x145e61[_0xd213('0x21')],{'email':_0x5b89ac,'role':_0xd213('0x22')});}else{logger[_0xd213('0xe')](_0xd213('0x23'));return request({'uri':util[_0xd213('0x1c')](_0xd213('0x24'),_0x475bb6[_0xd213('0x11')])})[_0xd213('0x18')](function(_0x146ef0){logger['info']('Admin\x20account\x20selected.');return _0x146ef0[_0xd213('0x25')];});}});}else{logger[_0xd213('0xe')](_0xd213('0x23'));return request({'uri':util[_0xd213('0x1c')](_0xd213('0x24'),_0x475bb6[_0xd213('0x11')])})[_0xd213('0x18')](function(_0x420e41){logger[_0xd213('0xe')](_0xd213('0x26'));return _0x420e41[_0xd213('0x25')];});}}function getEndUser(_0x3cbaa7,_0x867d9e,_0x4c97c7){logger[_0xd213('0xe')](_0xd213('0x27'),_0x4c97c7);return request({'uri':util['format'](_0xd213('0x1d'),_0x3cbaa7[_0xd213('0x11')]),'qs':{'query':util[_0xd213('0x1c')](_0xd213('0x28'),_0x4c97c7)}})['then'](function(_0x4d152f){var _0xacb66e;if(_0x4d152f[_0xd213('0x21')][_0xd213('0x29')]){_0x4d152f[_0xd213('0x21')]=_[_0xd213('0x2a')](_0x4d152f[_0xd213('0x21')],{'suspended':![],'role':_0xd213('0x2b')});if(_0x4d152f[_0xd213('0x21')][_0xd213('0x29')]){_0xacb66e=_[_0xd213('0x2c')](_0x4d152f[_0xd213('0x21')]);}}if(_0xacb66e){logger['info'](_0xd213('0x2d'));return _0xacb66e;}else{logger[_0xd213('0xe')](_0xd213('0x2e'));return request({'uri':util['format']('%s/users.json',_0x3cbaa7[_0xd213('0x11')]),'method':_0xd213('0x2f'),'body':{'user':{'role':_0xd213('0x2b'),'name':util[_0xd213('0x1c')](_0xd213('0x30'),_0x867d9e||_0x4c97c7),'phone':_0x4c97c7}}})[_0xd213('0x18')](function(_0x156342){logger[_0xd213('0xe')](_0xd213('0x31'));return _0x156342[_0xd213('0x25')];});}});}function getAuth(_0xa9aad){var _0x15588b;if(_0xa9aad[_0xd213('0x32')]===_0xd213('0x33')){_0x15588b=util[_0xd213('0x1c')]('%s:%s',_0xa9aad[_0xd213('0x34')],_0xa9aad['password']);}else if(_0xa9aad[_0xd213('0x32')]==='token'){_0x15588b=util[_0xd213('0x1c')](_0xd213('0x35'),_0xa9aad[_0xd213('0x34')],_0xa9aad[_0xd213('0x36')]);}return util[_0xd213('0x1c')]('Basic\x20%s',new Buffer(_0x15588b)['toString']('base64'));}function request(_0x4fdcd0){logger[_0xd213('0x37')](_0xd213('0x38'),JSON['stringify'](_0x4fdcd0));return rp(_[_0xd213('0x8')](_0x4fdcd0,{'method':_0xd213('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2bf07a,_0x52552c){var _0x3ad832=[];if(_0x2bf07a&&_0x2bf07a[_0xd213('0x29')]>0x0){_0x3ad832=_['map'](_0x2bf07a,_0x52552c);}return _0x3ad832;}function getCustomFields(_0x3922cf,_0x2e449e){var _0x5df352=[];var _0x1c3f78={'custom_fields':[]};if(_0x3922cf[_0xd213('0x29')]>0x0){_['forEach'](_0x3922cf,function(_0x187aa7){if(_['includes']([_0xd213('0x3a'),_0xd213('0x3b')],_0x187aa7[_0xd213('0x3c')])&&_0x187aa7[_0xd213('0x3d')]&&!_0x187aa7['customField']){_0x1c3f78[_0x187aa7[_0xd213('0x3d')]['toLowerCase']()]=_0x187aa7[_0xd213('0x3e')][_0xd213('0x3f')]();}else if(_[_0xd213('0x40')]([_0xd213('0x3a'),'picklist'],_0x187aa7[_0xd213('0x3c')])&&_0x187aa7[_0xd213('0x41')]&&_0x187aa7['customField']){_0x1c3f78[_0xd213('0x42')][_0xd213('0x43')]({'id':_0x187aa7[_0xd213('0x41')],'value':_0x187aa7[_0xd213('0x3e')][_0xd213('0x3f')]()});}else if(_0x187aa7[_0xd213('0x3c')]==='variable'&&_0x187aa7[_0xd213('0x44')]&&_0x187aa7[_0xd213('0x41')]&&_0x187aa7['customField']){_0x2e449e[_0x187aa7[_0xd213('0x44')]]&&_0x1c3f78['custom_fields'][_0xd213('0x43')]({'id':_0x187aa7[_0xd213('0x41')],'value':_0x2e449e[_0x187aa7['variableName']][_0xd213('0x3f')]()});}else if(_0x187aa7[_0xd213('0x3c')]===_0xd213('0x45')&&_0x187aa7[_0xd213('0x46')]&&_0x187aa7[_0xd213('0x46')][_0xd213('0x13')]&&_0x187aa7[_0xd213('0x41')]&&_0x187aa7[_0xd213('0x47')]){_0x2e449e[_0x187aa7['Variable'][_0xd213('0x13')][_0xd213('0x48')]()]&&_0x1c3f78[_0xd213('0x42')][_0xd213('0x43')]({'id':_0x187aa7[_0xd213('0x41')],'value':_0x2e449e[_0x187aa7[_0xd213('0x46')][_0xd213('0x13')][_0xd213('0x48')]()]['toString']()});}});}return _0x1c3f78;}exports[_0xd213('0x49')]=function(_0x59a8c5,_0x43e249,_0x32d98e,_0x4628d6,_0x4dad52,_0x3b10f0){var _0x14278b,_0x44e629;_0x3b10f0[_0xd213('0x11')]=intUtil[_0xd213('0x4a')](_0x3b10f0[_0xd213('0x11')]);_0x3b10f0[_0xd213('0x4b')]=intUtil[_0xd213('0x4a')](_0x3b10f0[_0xd213('0x4b')]);if(_0x4dad52&&_0x4dad52[_0xd213('0x4c')]){logger[_0xd213('0xe')]('[QUEUE]',_0xd213('0x4d'));_0x43e249[_0xd213('0x4e')]=util[_0xd213('0x1c')](_0xd213('0x4f'),_0x3b10f0[_0xd213('0x4b')],_0x43e249[_0xd213('0x50')],md5(_0x43e249['uniqueid']));}else{_0x43e249[_0xd213('0x4e')]='';}headers['Authorization']=getAuth(_0x3b10f0);return getUser(_0x3b10f0,_0x4628d6[_0xd213('0x51')])[_0xd213('0x18')](function(_0x166903){_0x14278b=_0x166903;logger[_0xd213('0xe')](_0xd213('0x52'),_0x14278b['id']);return getEndUser(_0x3b10f0,_0x43e249[_0xd213('0x53')],_0x43e249[_0xd213('0x54')]);})[_0xd213('0x18')](function(_0x15e7b9){_0x44e629=_0x15e7b9;logger[_0xd213('0xe')](_0xd213('0x55'),_0x44e629['id']);return getTicket(_0x3b10f0,_0x14278b,_0x44e629,_0x32d98e,_0x43e249);})[_0xd213('0x18')](function(_0x417af9){if(_0x417af9){logger[_0xd213('0xe')](_0xd213('0x56'),_0x417af9['id']);switch(_0x3b10f0[_0xd213('0x3c')]){case _0xd213('0x57'):logger['info'](_0xd213('0x58'),_0xd213('0x59'));return request({'uri':util[_0xd213('0x1c')](_0xd213('0x5a'),_0x3b10f0[_0xd213('0x11')],_0x14278b['id'],_0x417af9['id']),'method':_0xd213('0x2f')});case'newTab':logger[_0xd213('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd213('0x5b'),_0x4628d6['name']),_0xd213('0x5c'),{'uri':util[_0xd213('0x1c')]('%s/agent/tickets/%s',_0x3b10f0[_0xd213('0x11')][_0xd213('0x5d')](_0xd213('0x5e'),''),_0x417af9['id'])});break;default:logger[_0xd213('0x5f')]('[QUEUE]',_0xd213('0x60'));}}})[_0xd213('0x61')](function(_0x3baf49){logger[_0xd213('0x5f')](_0xd213('0x62'),util['inspect'](_0x3baf49,{'showHidden':!![],'depth':null}));});};exports[_0xd213('0x63')]=function(_0x46f77d,_0x348fa7,_0x5840e8,_0x5a03ff,_0x112c3f,_0x40c400,_0x315eb6){var _0x42a5a7,_0x3c277a;_0x40c400['remoteUri']=intUtil[_0xd213('0x4a')](_0x40c400[_0xd213('0x11')]);_0x40c400['serverUrl']=intUtil[_0xd213('0x4a')](_0x40c400[_0xd213('0x4b')]);if(_0x315eb6&&_0x315eb6[_0xd213('0x64')]&&_0x315eb6[_0xd213('0x64')]!==_0xd213('0x65')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x348fa7[_0xd213('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x40c400[_0xd213('0x4b')],_0x348fa7[_0xd213('0x50')],md5(_0x348fa7[_0xd213('0x50')]));}headers['Authorization']=getAuth(_0x40c400);return getUser(_0x40c400,_0x5a03ff[_0xd213('0x51')])[_0xd213('0x18')](function(_0x2c3652){_0x42a5a7=_0x2c3652;logger[_0xd213('0xe')](_0xd213('0x52'),_0x42a5a7['id']);return getEndUser(_0x40c400,_0x348fa7['destcalleridname'],_0x348fa7[_0xd213('0x66')]);})[_0xd213('0x18')](function(_0x48209b){_0x3c277a=_0x48209b;logger[_0xd213('0xe')](_0xd213('0x55'),_0x3c277a['id']);return getTicket(_0x40c400,_0x42a5a7,_0x3c277a,_0x5840e8,_0x348fa7);})['then'](function(_0x1273d1){if(_0x1273d1){logger[_0xd213('0xe')](_0xd213('0x56'),_0x1273d1['id']);switch(_0x40c400['type']){case _0xd213('0x57'):logger['info'](_0xd213('0x67'),_0xd213('0x59'));return request({'uri':util[_0xd213('0x1c')](_0xd213('0x5a'),_0x40c400['remoteUri'],_0x42a5a7['id'],_0x1273d1['id']),'method':_0xd213('0x2f')});case _0xd213('0x68'):logger[_0xd213('0xe')]('[OUTBOUND]',_0xd213('0x69'));emit(util['format'](_0xd213('0x5b'),_0x5a03ff[_0xd213('0x13')]),_0xd213('0x5c'),{'uri':util['format'](_0xd213('0x6a'),_0x40c400[_0xd213('0x11')][_0xd213('0x5d')]('/api/v2',''),_0x1273d1['id'])});break;default:logger[_0xd213('0x5f')](_0xd213('0x67'),_0xd213('0x60'));}}})[_0xd213('0x61')](function(_0x3ba70a){logger[_0xd213('0x5f')](_0xd213('0x6b'),util[_0xd213('0x6c')](_0x3ba70a,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x45f600,_0x368e19,_0x3e8207,_0x17919b,_0x10f4e5,_0x11c6f0){var _0xb4f2f2,_0x5dee29;_0x11c6f0[_0xd213('0x11')]=intUtil[_0xd213('0x4a')](_0x11c6f0[_0xd213('0x11')]);_0x11c6f0[_0xd213('0x4b')]=intUtil['stripTrailingSlash'](_0x11c6f0[_0xd213('0x4b')]);if(_0x10f4e5&&_0x10f4e5[_0xd213('0x4c')]){logger[_0xd213('0xe')]('['+_0x368e19[_0xd213('0x6d')][_0xd213('0x6e')]()+']',_0xd213('0x4d'));_0x368e19[_0xd213('0x4e')]=util['format'](_0xd213('0x4f'),_0x11c6f0[_0xd213('0x4b')],_0x368e19[_0xd213('0x50')],md5(_0x368e19[_0xd213('0x50')]));}else{_0x368e19[_0xd213('0x4e')]='';}headers['Authorization']=getAuth(_0x11c6f0);return getUser(_0x11c6f0)[_0xd213('0x18')](function(_0x24cd9d){_0xb4f2f2=_0x24cd9d;logger[_0xd213('0xe')](_0xd213('0x52'),_0xb4f2f2['id']);return getEndUser(_0x11c6f0,_0x368e19[_0xd213('0x53')],_0x368e19[_0xd213('0x54')]);})[_0xd213('0x18')](function(_0x3d053a){_0x5dee29=_0x3d053a;logger[_0xd213('0xe')](_0xd213('0x55'),_0x5dee29['id']);return getTicket(_0x11c6f0,_0xb4f2f2,_0x5dee29,_0x3e8207,_0x368e19);})[_0xd213('0x18')](function(_0x54b1e7){if(_0x54b1e7){logger[_0xd213('0xe')]('The\x20Ticket\x20ID\x20is:',_0x54b1e7['id']);}})['catch'](function(_0x209336){logger[_0xd213('0x5f')]('['+_0x368e19[_0xd213('0x6d')][_0xd213('0x6e')]()+']'+_0xd213('0x6f'),util[_0xd213('0x6c')](_0x209336,{'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 47b613e..7f1c68e 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 _0x89c2=['startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','format','merge','Fields','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','zoho.eu','[OUTBOUND]','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridname','Inbound','lodash','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','emit','[HTTP]','forEach','includes','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','refresh_token','then','add','catch','error','stack','info','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89c2,0x184));var _0x289c=function(_0x3ee84b,_0x42ac90){_0x3ee84b=_0x3ee84b-0x0;var _0x3aea03=_0x89c2[_0x3ee84b];return _0x3aea03;};'use strict';var _=require(_0x289c('0x0'));var rp=require('request-promise');var md5=require(_0x289c('0x1'));var util=require('util');var intUtil=require(_0x289c('0x2'));var moment=require('moment');var Redis=require(_0x289c('0x3'));var BPromise=require(_0x289c('0x4'));var config=require(_0x289c('0x5'));var logger=require(_0x289c('0x6'))(_0x289c('0x7'));config['redis']=_[_0x289c('0x8')](config['redis'],{'host':_0x289c('0x9'),'port':0x18eb});var io=require(_0x289c('0xa'))(new Redis(config[_0x289c('0xb')]));function emit(_0x8aa454,_0x3044b9,_0x4d8391){io['to'](_0x8aa454)[_0x289c('0xc')](_0x3044b9,_0x4d8391);}function request(_0x25248a){logger['debug'](_0x289c('0xd'),JSON['stringify'](_0x25248a));return rp(_0x25248a);}function getCustomFields(_0x3ea431,_0x2eb492){var _0x1028a8={};if(_0x3ea431['length']>0x0){_[_0x289c('0xe')](_0x3ea431,function(_0x10f006){if(_[_0x289c('0xf')]([_0x289c('0x10'),'picklist'],_0x10f006[_0x289c('0x11')])&&_0x10f006[_0x289c('0x12')]){_0x1028a8[_0x10f006[_0x289c('0x12')]]=_0x10f006[_0x289c('0x13')][_0x289c('0x14')]();}else if(_0x10f006[_0x289c('0x11')]===_0x289c('0x15')&&_0x10f006[_0x289c('0x16')]&&_0x10f006[_0x289c('0x12')]&&_0x2eb492[_0x10f006[_0x289c('0x16')]]){_0x1028a8[_0x10f006[_0x289c('0x12')]]=_0x2eb492[_0x10f006['variableName']][_0x289c('0x14')]();}else if(_0x10f006[_0x289c('0x11')]==='customVariable'&&_0x10f006[_0x289c('0x17')]&&_0x10f006[_0x289c('0x17')][_0x289c('0x18')]&&_0x10f006[_0x289c('0x12')]&&_0x2eb492[_0x10f006[_0x289c('0x17')]['name'][_0x289c('0x19')]()]){_0x1028a8[_0x10f006[_0x289c('0x12')]]=_0x2eb492[_0x10f006[_0x289c('0x17')][_0x289c('0x18')]['toLowerCase']()]['toString']();}});}return _0x1028a8;}function getName(_0x57a829){if(_0x57a829['indexOf']('\x20')>0x0){var _0x421fc1=_0x57a829[_0x289c('0x1a')](/ (.+)/);if(_0x421fc1[0x1]){return _0x421fc1;}}return[_0x57a829,_0x57a829];}var accountsTokens={};function getAccessToken(_0x267f46){return new Promise(function(_0x3faae2,_0x4ada37){if(!_[_0x289c('0x1b')](accountsTokens[_0x267f46['id']])&&!_[_0x289c('0x1b')](accountsTokens[_0x267f46['id']][_0x289c('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x267f46['id']][_0x289c('0x1d')])){_0x3faae2(accountsTokens[_0x267f46['id']][_0x289c('0x1c')]);}}var _0x3ef649;switch(_0x267f46[_0x289c('0x1e')]){case'US':_0x3ef649=_0x289c('0x1f');break;case'AU':_0x3ef649=_0x289c('0x20');break;case'EU':_0x3ef649='https://accounts.zoho.eu';break;case'IN':_0x3ef649='https://accounts.zoho.in';break;case'CN':_0x3ef649=_0x289c('0x21');break;default:_0x3ef649=_0x289c('0x22');break;}var _0x8da254={'method':_0x289c('0x23'),'uri':_0x3ef649+_0x289c('0x24'),'qs':{'refresh_token':_0x267f46['refreshToken'],'client_id':_0x267f46[_0x289c('0x25')],'client_secret':_0x267f46['clientSecret'],'grant_type':_0x289c('0x26')},'json':!![]};return rp(_0x8da254)[_0x289c('0x27')](function(_0x4e3642){accountsTokens[_0x267f46['id']]={'access_token':_0x4e3642[_0x289c('0x1c')],'expires_in':moment()[_0x289c('0x28')](_0x4e3642[_0x289c('0x1d')],'seconds')};_0x3faae2(_0x4e3642[_0x289c('0x1c')]);})[_0x289c('0x29')](function(_0x3d8615){logger[_0x289c('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x3d8615[_0x289c('0x2b')]);_0x4ada37(_0x3d8615);});});}function getUser(_0x192d25,_0x78c552,_0x143c15,_0x107b76){logger[_0x289c('0x2c')](_0x289c('0x2d'));return request({'method':_0x289c('0x2e'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x78c552),'qs':{'type':_0x289c('0x2f')},'headers':{'Authorization':_0x289c('0x30')+_0x192d25},'json':!![]})['then'](function(_0x36e383){if(_0x36e383[_0x289c('0x31')]){var _0x21d0e3=-0x1;if(_[_0x289c('0x32')](_0x36e383[_0x289c('0x31')])){if(!_['isNil'](_0x107b76)){_0x21d0e3=_[_0x289c('0x33')](_0x36e383[_0x289c('0x31')],function(_0x3561d4){return _0x3561d4[_0x289c('0x34')]===_0x107b76;});}if(_0x21d0e3>=0x0){logger[_0x289c('0x2c')](_0x289c('0x35'));}else{logger[_0x289c('0x2c')](_0x289c('0x36'));_0x21d0e3=_[_0x289c('0x33')](_0x36e383[_0x289c('0x31')],function(_0x2ab6bc){return _0x2ab6bc['profile'][_0x289c('0x18')]===_0x289c('0x37');});}return _0x36e383['users'][_0x21d0e3];}else{if(_0x36e383[_0x289c('0x38')][_0x289c('0x39')]['name']===_0x289c('0x37')){logger[_0x289c('0x2c')](_0x289c('0x36'));user=_0x36e383[_0x289c('0x38')];return user;}else{logger[_0x289c('0x2a')](_0x289c('0x3a'),JSON[_0x289c('0x3b')](_0x36e383));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x289c('0x3b')](_0x36e383));}}}else{logger[_0x289c('0x2a')](_0x289c('0x3a'),JSON['stringify'](_0x36e383));throw new Error(_0x289c('0x3c')+JSON[_0x289c('0x3b')](_0x36e383));}})[_0x289c('0x29')](function(_0x513e8c){console[_0x289c('0x2a')](_0x513e8c);});}function getZohoUser(_0x1dff50,_0x49ad7f){return new BPromise(function(_0x37d938,_0x18f2d6){request(_0x1dff50)['then'](function(_0x657277){var _0x10afe9=null;if(_0x657277){_0x10afe9=_0x657277[_0x289c('0x3d')][0x0];_0x10afe9[_0x289c('0x3e')]=_0x49ad7f;}_0x37d938(_0x10afe9);})[_0x289c('0x29')](function(_0x34fe56){_0x18f2d6(_0x34fe56);});});}function createEndUser(_0x4be8bf,_0x4e2f14,_0x3c43e0,_0x1b5e8e,_0x2b3f74,_0x3462f2){var _0x3c43e0=getName(_0x3c43e0);return request({'method':_0x289c('0x23'),'uri':_0x289c('0x3f')+_0x4e2f14+_0x289c('0x40')+_[_0x289c('0x41')](_0x3462f2[_0x289c('0x42')])+'s','body':{'data':[{'Last_Name':_0x3c43e0[0x1],'First_Name':_0x3c43e0[0x0],'Phone':_0x1b5e8e,'Owner':{'name':!_['isNil'](_0x2b3f74[_0x289c('0x43')][_0x289c('0x18')])?_0x2b3f74[_0x289c('0x43')][_0x289c('0x18')]:!_[_0x289c('0x1b')](_0x2b3f74[_0x289c('0x44')])?_0x2b3f74[_0x289c('0x44')]+'\x20'+_0x2b3f74[_0x289c('0x45')]:_0x2b3f74['last_name'],'id':_0x2b3f74['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4be8bf},'json':!![]})['then'](function(_0x1cc1f6){if(_0x1cc1f6&&_0x1cc1f6[_0x289c('0x3d')][0x0][_0x289c('0x46')]===_0x289c('0x47')){var _0x3ede68=_0x1cc1f6[_0x289c('0x3d')][0x0][_0x289c('0x48')];_0x3ede68[_0x289c('0x3e')]=_['startCase'](_0x3462f2[_0x289c('0x42')])+'s';return _0x3ede68;}logger[_0x289c('0x2a')](_0x289c('0x3a'),JSON[_0x289c('0x3b')](data));throw new Error(_0x289c('0x49')+JSON['stringify'](data));})[_0x289c('0x29')](function(_0x516414){console[_0x289c('0x4a')](_0x289c('0x4b'),_0x516414);});}function getEndUser(_0x448ba5,_0xb47b3e,_0x212d62,_0x415d6a,_0xb591d4,_0x36f6dc,_0x16d4ad){var _0x1d92b4={'method':_0x289c('0x2e'),'uri':'','headers':{'Authorization':_0x289c('0x30')+_0x448ba5},'json':!![]};switch(_0x16d4ad[_0x289c('0x4c')]){case _0x289c('0x4d'):_0x1d92b4[_0x289c('0x4e')]=_0x289c('0x3f')+_0xb47b3e+_0x289c('0x4f')+_0xb591d4+'))';return getZohoUser(_0x1d92b4,_0x289c('0x50'))[_0x289c('0x27')](function(_0x106e58){if(_0x106e58)return _0x106e58;_0x1d92b4['uri']=_0x289c('0x3f')+_0xb47b3e+_0x289c('0x51')+_0xb591d4+'))';return getZohoUser(_0x1d92b4,_0x289c('0x52'))[_0x289c('0x27')](function(_0x5983cd){if(_0x5983cd)return _0x5983cd;if(_0x16d4ad[_0x289c('0x42')]!='nothing'){return createEndUser(_0x448ba5,_0xb47b3e,_0x415d6a,_0xb591d4,_0x36f6dc,_0x16d4ad);}else{return{};}});});break;case'contact':_0x1d92b4['uri']=_0x289c('0x3f')+_0xb47b3e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xb591d4+'))';return getZohoUser(_0x1d92b4,_0x289c('0x50'))['then'](function(_0x86877a){if(_0x86877a)return _0x86877a;if(_0x16d4ad[_0x289c('0x42')]!='nothing'){return createEndUser(_0x448ba5,_0xb47b3e,_0x415d6a,_0xb591d4,_0x36f6dc,_0x16d4ad);}else{return{};}});break;case'lead':_0x1d92b4[_0x289c('0x4e')]=_0x289c('0x3f')+_0xb47b3e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xb591d4+'))';return getZohoUser(_0x1d92b4,'Leads')[_0x289c('0x27')](function(_0x4a5d1e){if(_0x4a5d1e)return _0x4a5d1e;if(_0x16d4ad[_0x289c('0x42')]!=_0x289c('0x53')){return createEndUser(_0x448ba5,_0xb47b3e,_0x415d6a,_0xb591d4,_0x36f6dc,_0x16d4ad);}else{return{};}});break;}}function getCall(_0x2c2c04,_0x4ae2ee,_0x2a0549,_0x4bd37a,_0x4f56,_0x259bac,_0x5a930f,_0x176bbf){logger[_0x289c('0x2c')](_0x289c('0x54'));var _0x21a349={};_0x21a349[_0x289c('0x55')]={'name':!_[_0x289c('0x1b')](_0x4bd37a['role'][_0x289c('0x18')])&&!_[_0x289c('0x1b')](_0x4bd37a[_0x289c('0x39')][_0x289c('0x18')])&&_0x4bd37a['profile'][_0x289c('0x18')]===_0x289c('0x56')?_0x4bd37a[_0x289c('0x43')][_0x289c('0x18')]:!_[_0x289c('0x1b')](_0x4bd37a[_0x289c('0x44')])?_0x4bd37a[_0x289c('0x44')]+'\x20'+_0x4bd37a[_0x289c('0x45')]:_0x4bd37a[_0x289c('0x45')],'id':_0x4bd37a['id']};_0x21a349[_0x289c('0x57')]=intUtil[_0x289c('0x58')](_0x259bac['Subjects'],_0x5a930f,'\x20');_0x21a349[_0x289c('0x59')]=intUtil['getString'](_0x259bac[_0x289c('0x5a')],_0x5a930f,'\x0a');if(_0x4f56[_0x289c('0x3e')]==='Contacts'){_0x21a349[_0x289c('0x5b')]={'name':!_[_0x289c('0x1b')](_0x4f56['Full_Name'])?_0x4f56[_0x289c('0x5c')]:!_['isNil'](_0x4f56[_0x289c('0x5d')])?_0x4f56[_0x289c('0x5d')]+'\x20'+_0x4f56[_0x289c('0x5e')]:_0x4f56[_0x289c('0x5e')],'id':_0x4f56['id']};}if(_0x4f56[_0x289c('0x3e')]===_0x289c('0x52')){_0x21a349[_0x289c('0x5f')]={'name':!_[_0x289c('0x1b')](_0x4f56[_0x289c('0x5c')])?_0x4f56[_0x289c('0x5c')]:!_[_0x289c('0x1b')](_0x4f56[_0x289c('0x5d')])?_0x4f56[_0x289c('0x5d')]+'\x20'+_0x4f56['Last_Name']:_0x4f56[_0x289c('0x5e')],'id':_0x4f56['id']};_0x21a349['$se_module']=_[_0x289c('0x41')](_0x4f56[_0x289c('0x3e')]);}if(_0x5a930f[_0x289c('0x60')]){_0x21a349[_0x289c('0x61')]=moment[_0x289c('0x62')](parseInt(_0x5a930f[_0x289c('0x60')])*0x3e8)['format'](_0x289c('0x63'));}else if(_0x5a930f[_0x289c('0x64')]&&_0x5a930f[_0x289c('0x65')]){_0x21a349[_0x289c('0x61')]=moment[_0x289c('0x62')](moment(_0x5a930f[_0x289c('0x65')],_0x289c('0x66'))['diff'](moment(_0x5a930f[_0x289c('0x67')],_0x289c('0x66'))))['format'](_0x289c('0x63'));}switch(_0x5a930f[_0x289c('0x68')]){case _0x289c('0x69'):_0x21a349[_0x289c('0x6a')]=_0x289c('0x6b');break;case'complete':case _0x289c('0x6c'):_0x21a349['Call_Result']=_0x289c('0x6d');break;case _0x289c('0x6e'):_0x21a349['Call_Result']=_0x289c('0x6f');break;case _0x289c('0x70'):_0x21a349[_0x289c('0x6a')]=_0x289c('0x71');break;case _0x289c('0x72'):_0x21a349[_0x289c('0x6a')]=_0x289c('0x73');default:}_0x21a349[_0x289c('0x74')]=(_0x176bbf===_0x289c('0x75')?moment(_0x5a930f[_0x289c('0x67')])['format'](_0x289c('0x66')):moment(_0x5a930f[_0x289c('0x76')])[_0x289c('0x77')](_0x289c('0x66')))||moment()[_0x289c('0x77')](_0x289c('0x66'));_0x21a349['Call_Type']=_0x176bbf||'Inbound';_0x21a349=_[_0x289c('0x78')](_0x21a349,getCustomFields(_0x259bac[_0x289c('0x79')],_0x5a930f));return request({'method':_0x289c('0x23'),'uri':_0x289c('0x3f')+_0x4ae2ee+'/crm/v2/Calls','headers':{'Authorization':_0x289c('0x30')+_0x2c2c04},'body':{'data':[_0x21a349]},'json':!![]})[_0x289c('0x27')](function(_0x5621a7){if(_0x5621a7&&_0x5621a7[_0x289c('0x3d')][0x0][_0x289c('0x46')]===_0x289c('0x47')){logger[_0x289c('0x2c')]('Call\x20created!');return{'id':_0x5621a7[_0x289c('0x3d')][0x0][_0x289c('0x48')]['id']};}})[_0x289c('0x29')](function(_0x2fdd1d){logger[_0x289c('0x2c')]('err',_0x2fdd1d[_0x289c('0x2b')]);console[_0x289c('0x4a')](_0x289c('0x7a'),_0x2fdd1d);});}exports[_0x289c('0x7b')]=function(_0x11efb5,_0x7b0624,_0x47f0b6,_0x12015c,_0x16f06f,_0x12b20c){var _0x1f4ed4,_0x444831,_0x485158;_0x12b20c[_0x289c('0x7c')]=intUtil[_0x289c('0x7d')](_0x12b20c['host']);_0x12b20c[_0x289c('0x7e')]=intUtil[_0x289c('0x7d')](_0x12b20c['serverUrl']);if(_0x16f06f&&_0x16f06f[_0x289c('0x7f')]){logger[_0x289c('0x2c')]('[QUEUE]',_0x289c('0x80'));_0x7b0624[_0x289c('0x81')]=_0x12b20c[_0x289c('0x7e')]+_0x289c('0x82')+_0x7b0624['uniqueid']+_0x289c('0x83')+md5(_0x7b0624[_0x289c('0x84')]);}else{_0x7b0624[_0x289c('0x81')]='';}var _0x1bf2e7=_0x12b20c[_0x289c('0x7c')]==='zoho.eu'?'eu':_0x289c('0x85');return getAccessToken(_0x12b20c)[_0x289c('0x27')](function(_0x22d5d2){_0x485158=_0x22d5d2;return getUser(_0x485158,_0x1bf2e7,_0x12b20c,_0x12015c[_0x289c('0x34')]);})[_0x289c('0x27')](function(_0x4bf6bf){_0x1f4ed4=_0x4bf6bf;logger['info'](_0x289c('0x86'),_0x1f4ed4['id']);return getEndUser(_0x485158,_0x1bf2e7,_0x12b20c,_0x7b0624['calleridname'],_0x7b0624[_0x289c('0x87')],_0x1f4ed4,_0x47f0b6);})[_0x289c('0x27')](function(_0x12b0aa){_0x444831=_0x12b0aa;return getCall(_0x485158,_0x1bf2e7,_0x12b20c,_0x1f4ed4,_0x444831,_0x47f0b6,_0x7b0624,'Inbound');})[_0x289c('0x27')](function(_0x5c8d92){if(_0x5c8d92){logger[_0x289c('0x2c')](_0x289c('0x88'),_0x5c8d92['id']);logger[_0x289c('0x2c')](_0x289c('0x89'),_0x289c('0x8a'));emit(util[_0x289c('0x77')]('user:%s',_0x12015c[_0x289c('0x18')]),_0x289c('0x8b'),{'uri':_0x289c('0x8c')+_0x12b20c[_0x289c('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5c8d92['id']});}})[_0x289c('0x29')](function(_0x27b82d){logger[_0x289c('0x2a')](_0x289c('0x89'),JSON[_0x289c('0x3b')](_0x27b82d));});};exports['outbound']=function(_0x51dae0,_0x2f245d,_0x1f504e,_0x283a16,_0x6b99ff,_0x407d66,_0xd4034){var _0x1ad65a,_0x3c20eb,_0x325ea3;_0x407d66[_0x289c('0x7c')]=intUtil[_0x289c('0x7d')](_0x407d66[_0x289c('0x7c')]);_0x407d66[_0x289c('0x7e')]=intUtil[_0x289c('0x7d')](_0x407d66[_0x289c('0x7e')]);if(_0xd4034&&_0xd4034[_0x289c('0x8d')]&&_0xd4034[_0x289c('0x8d')]!==_0x289c('0x8e')){logger[_0x289c('0x2c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2f245d['recordingURL']=_0x407d66[_0x289c('0x7e')]+_0x289c('0x82')+_0x2f245d[_0x289c('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x2f245d[_0x289c('0x84')]);}var _0x3b9dd3=_0x407d66[_0x289c('0x7c')]===_0x289c('0x8f')?'eu':_0x289c('0x85');return getAccessToken(_0x407d66)[_0x289c('0x27')](function(_0x1fab1e){_0x325ea3=_0x1fab1e;return getUser(_0x325ea3,_0x3b9dd3,_0x407d66,_0x283a16[_0x289c('0x34')]);})[_0x289c('0x27')](function(_0x5f3ff3){_0x1ad65a=_0x5f3ff3;logger[_0x289c('0x2c')](_0x289c('0x86'),_0x1ad65a['id']);return getEndUser(_0x325ea3,_0x3b9dd3,_0x407d66,_0x2f245d['destcalleridname'],_0x2f245d['destcalleridnum'],_0x1ad65a,_0x1f504e);})[_0x289c('0x27')](function(_0x52a481){_0x3c20eb=_0x52a481;return getCall(_0x325ea3,_0x3b9dd3,_0x407d66,_0x1ad65a,_0x3c20eb,_0x1f504e,_0x2f245d,'Outbound');})[_0x289c('0x27')](function(_0xaa61ad){if(_0xaa61ad){logger[_0x289c('0x2c')]('The\x20Call\x20ID\x20is:',_0xaa61ad['id']);logger[_0x289c('0x2c')](_0x289c('0x90'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x289c('0x77')](_0x289c('0x91'),_0x283a16[_0x289c('0x18')]),_0x289c('0x8b'),{'uri':_0x289c('0x8c')+_0x407d66[_0x289c('0x7c')]+_0x289c('0x92')+_0xaa61ad['id']});}})[_0x289c('0x29')](function(_0x53f9cd){logger[_0x289c('0x2a')](_0x289c('0x90'),JSON['stringify'](_0x53f9cd));});};exports[_0x289c('0x93')]=function(_0x53e930,_0x163454,_0x325edb,_0x24610e,_0x22e8f6,_0x2ce6aa){var _0x45a3aa,_0x2245dd,_0x23d1c1;_0x2ce6aa['host']=intUtil[_0x289c('0x7d')](_0x2ce6aa[_0x289c('0x7c')]);_0x2ce6aa[_0x289c('0x7e')]=intUtil[_0x289c('0x7d')](_0x2ce6aa[_0x289c('0x7e')]);if(_0x22e8f6&&_0x22e8f6[_0x289c('0x7f')]){logger[_0x289c('0x2c')]('['+_0x163454['lastevent'][_0x289c('0x94')]()+']','Recording\x20is\x20enabled!');_0x163454['recordingURL']=_0x2ce6aa[_0x289c('0x7e')]+'/api/voice/recordings/'+_0x163454['uniqueid']+_0x289c('0x83')+md5(_0x163454[_0x289c('0x84')]);}else{_0x163454[_0x289c('0x81')]='';}var _0xf02815=_0x2ce6aa[_0x289c('0x7c')]===_0x289c('0x8f')?'eu':_0x289c('0x85');return getAccessToken(_0x2ce6aa)[_0x289c('0x27')](function(_0x4b2646){_0x23d1c1=_0x4b2646;return getUser(_0x23d1c1,_0xf02815,_0x2ce6aa);})[_0x289c('0x27')](function(_0xadb363){_0x45a3aa=_0xadb363;logger['info'](_0x289c('0x86'),_0x45a3aa['id']);return getEndUser(_0x23d1c1,_0xf02815,_0x2ce6aa,_0x163454[_0x289c('0x95')],_0x163454[_0x289c('0x87')],_0x45a3aa,_0x325edb);})['then'](function(_0x38a763){_0x2245dd=_0x38a763;return getCall(_0x23d1c1,_0xf02815,_0x2ce6aa,_0x45a3aa,_0x2245dd,_0x325edb,_0x163454,_0x289c('0x96'));})['then'](function(_0x35d609){if(_0x35d609){logger[_0x289c('0x2c')](_0x289c('0x88'),_0x35d609['id']);}})['catch'](function(_0x248786){logger[_0x289c('0x2a')]('['+_0x163454[_0x289c('0x68')][_0x289c('0x94')]()+']',JSON[_0x289c('0x3b')](_0x248786));});}; \ No newline at end of file +var _0x6464=['Called','complete','Answered','rejected','Call_Result','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','Fields','/crm/v2/Calls','Call\x20created!','data','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','zoho','defaults','localhost','socket.io-emitter','redis','debug','[HTTP]','forEach','includes','string','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','clientId','clientSecret','refresh_token','access_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','isArrayLikeObject','findIndex','users','email','info','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','POST','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','lead','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','startCase','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent'];(function(_0x533512,_0x23758e){var _0x5f56f2=function(_0xab23b5){while(--_0xab23b5){_0x533512['push'](_0x533512['shift']());}};_0x5f56f2(++_0x23758e);}(_0x6464,0x16f));var _0x4646=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6464[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4646('0x0'));var rp=require(_0x4646('0x1'));var md5=require(_0x4646('0x2'));var util=require(_0x4646('0x3'));var intUtil=require(_0x4646('0x4'));var moment=require(_0x4646('0x5'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4646('0x6'));config['redis']=_[_0x4646('0x7')](config['redis'],{'host':_0x4646('0x8'),'port':0x18eb});var io=require(_0x4646('0x9'))(new Redis(config[_0x4646('0xa')]));function emit(_0x40a15f,_0x55f542,_0x49c053){io['to'](_0x40a15f)['emit'](_0x55f542,_0x49c053);}function request(_0x5e07e9){logger[_0x4646('0xb')](_0x4646('0xc'),JSON['stringify'](_0x5e07e9));return rp(_0x5e07e9);}function getCustomFields(_0x544566,_0x198c98){var _0x4e8e6f={};if(_0x544566['length']>0x0){_[_0x4646('0xd')](_0x544566,function(_0x149d0a){if(_[_0x4646('0xe')]([_0x4646('0xf'),_0x4646('0x10')],_0x149d0a['type'])&&_0x149d0a[_0x4646('0x11')]){_0x4e8e6f[_0x149d0a[_0x4646('0x11')]]=_0x149d0a['content'][_0x4646('0x12')]();}else if(_0x149d0a[_0x4646('0x13')]===_0x4646('0x14')&&_0x149d0a[_0x4646('0x15')]&&_0x149d0a[_0x4646('0x11')]&&_0x198c98[_0x149d0a[_0x4646('0x15')]]){_0x4e8e6f[_0x149d0a[_0x4646('0x11')]]=_0x198c98[_0x149d0a[_0x4646('0x15')]][_0x4646('0x12')]();}else if(_0x149d0a[_0x4646('0x13')]===_0x4646('0x16')&&_0x149d0a[_0x4646('0x17')]&&_0x149d0a['Variable'][_0x4646('0x18')]&&_0x149d0a[_0x4646('0x11')]&&_0x198c98[_0x149d0a[_0x4646('0x17')][_0x4646('0x18')][_0x4646('0x19')]()]){_0x4e8e6f[_0x149d0a[_0x4646('0x11')]]=_0x198c98[_0x149d0a[_0x4646('0x17')][_0x4646('0x18')][_0x4646('0x19')]()]['toString']();}});}return _0x4e8e6f;}function getName(_0x43da31){if(_0x43da31[_0x4646('0x1a')]('\x20')>0x0){var _0x52b76c=_0x43da31['split'](/ (.+)/);if(_0x52b76c[0x1]){return _0x52b76c;}}return[_0x43da31,_0x43da31];}var accountsTokens={};function getAccessToken(_0x6500d7){return new Promise(function(_0x5e9908,_0x2e300e){if(!_[_0x4646('0x1b')](accountsTokens[_0x6500d7['id']])&&!_[_0x4646('0x1b')](accountsTokens[_0x6500d7['id']]['access_token'])){if(moment()[_0x4646('0x1c')](accountsTokens[_0x6500d7['id']][_0x4646('0x1d')])){_0x5e9908(accountsTokens[_0x6500d7['id']]['access_token']);}}var _0x4ca546;switch(_0x6500d7[_0x4646('0x1e')]){case'US':_0x4ca546=_0x4646('0x1f');break;case'AU':_0x4ca546='https://accounts.zoho.com.au';break;case'EU':_0x4ca546='https://accounts.zoho.eu';break;case'IN':_0x4ca546=_0x4646('0x20');break;case'CN':_0x4ca546='https://accounts.zoho.com.cn';break;default:_0x4ca546=_0x4646('0x21');break;}var _0x405d83={'method':'POST','uri':_0x4ca546+'/oauth/v2/token','qs':{'refresh_token':_0x6500d7['refreshToken'],'client_id':_0x6500d7[_0x4646('0x22')],'client_secret':_0x6500d7[_0x4646('0x23')],'grant_type':_0x4646('0x24')},'json':!![]};return rp(_0x405d83)['then'](function(_0xb5cd44){accountsTokens[_0x6500d7['id']]={'access_token':_0xb5cd44[_0x4646('0x25')],'expires_in':moment()[_0x4646('0x26')](_0xb5cd44[_0x4646('0x1d')],_0x4646('0x27'))};_0x5e9908(_0xb5cd44[_0x4646('0x25')]);})[_0x4646('0x28')](function(_0x49cfbc){logger[_0x4646('0x29')](_0x4646('0x2a'),_0x49cfbc[_0x4646('0x2b')]);_0x2e300e(_0x49cfbc);});});}function getUser(_0x25fe79,_0x4c8395,_0x58aa1e,_0x26b1b8){logger['info'](_0x4646('0x2c'));return request({'method':_0x4646('0x2d'),'uri':util['format'](_0x4646('0x2e'),_0x4c8395),'qs':{'type':_0x4646('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x25fe79},'json':!![]})[_0x4646('0x30')](function(_0x5ce6b){if(_0x5ce6b['users']){var _0x4b33b1=-0x1;if(_[_0x4646('0x31')](_0x5ce6b['users'])){if(!_[_0x4646('0x1b')](_0x26b1b8)){_0x4b33b1=_[_0x4646('0x32')](_0x5ce6b[_0x4646('0x33')],function(_0x164b73){return _0x164b73[_0x4646('0x34')]===_0x26b1b8;});}if(_0x4b33b1>=0x0){logger[_0x4646('0x35')](_0x4646('0x36'));}else{logger[_0x4646('0x35')]('Using\x20the\x20admin\x20account!');_0x4b33b1=_[_0x4646('0x32')](_0x5ce6b[_0x4646('0x33')],function(_0x3506a4){return _0x3506a4[_0x4646('0x37')][_0x4646('0x18')]===_0x4646('0x38');});}return _0x5ce6b['users'][_0x4b33b1];}else{if(_0x5ce6b[_0x4646('0x39')][_0x4646('0x37')][_0x4646('0x18')]===_0x4646('0x38')){logger[_0x4646('0x35')](_0x4646('0x3a'));user=_0x5ce6b[_0x4646('0x39')];return user;}else{logger[_0x4646('0x29')]('The\x20failing\x20result\x20is',JSON[_0x4646('0x3b')](_0x5ce6b));throw new Error(_0x4646('0x3c')+JSON[_0x4646('0x3b')](_0x5ce6b));}}}else{logger[_0x4646('0x29')](_0x4646('0x3d'),JSON[_0x4646('0x3b')](_0x5ce6b));throw new Error(_0x4646('0x3c')+JSON[_0x4646('0x3b')](_0x5ce6b));}})[_0x4646('0x28')](function(_0x13394b){console[_0x4646('0x29')](_0x13394b);});}function getZohoUser(_0x3f9016,_0x232cb5){return new BPromise(function(_0x54e49f,_0x1fe13c){request(_0x3f9016)[_0x4646('0x30')](function(_0x4fba6b){var _0x5f0590=null;if(_0x4fba6b){_0x5f0590=_0x4fba6b['data'][0x0];_0x5f0590['enduserType']=_0x232cb5;}_0x54e49f(_0x5f0590);})[_0x4646('0x28')](function(_0x2e04e9){_0x1fe13c(_0x2e04e9);});});}function createEndUser(_0x3b1733,_0x95dd83,_0x521d95,_0x2edb06,_0x246e88,_0x40f4cb){var _0x521d95=getName(_0x521d95);return request({'method':_0x4646('0x3e'),'uri':'https://www.zohoapis.'+_0x95dd83+'/crm/v2/'+_['startCase'](_0x40f4cb[_0x4646('0x3f')])+'s','body':{'data':[{'Last_Name':_0x521d95[0x1],'First_Name':_0x521d95[0x0],'Phone':_0x2edb06,'Owner':{'name':!_[_0x4646('0x1b')](_0x246e88[_0x4646('0x40')][_0x4646('0x18')])?_0x246e88['role'][_0x4646('0x18')]:!_[_0x4646('0x1b')](_0x246e88[_0x4646('0x41')])?_0x246e88['first_name']+'\x20'+_0x246e88[_0x4646('0x42')]:_0x246e88['last_name'],'id':_0x246e88['id']}}]},'headers':{'Authorization':_0x4646('0x43')+_0x3b1733},'json':!![]})['then'](function(_0x519579){if(_0x519579&&_0x519579['data'][0x0][_0x4646('0x44')]===_0x4646('0x45')){var _0x5cd6dc=_0x519579['data'][0x0][_0x4646('0x46')];_0x5cd6dc[_0x4646('0x47')]=_['startCase'](_0x40f4cb[_0x4646('0x3f')])+'s';return _0x5cd6dc;}logger[_0x4646('0x29')](_0x4646('0x3d'),JSON[_0x4646('0x3b')](data));throw new Error('Error:\x20'+JSON[_0x4646('0x3b')](data));})[_0x4646('0x28')](function(_0x2aa417){console['log'](_0x4646('0x48'),_0x2aa417);});}function getEndUser(_0xb36095,_0x518608,_0x5cd154,_0x566cc9,_0x55b15c,_0x5a864f,_0xe442aa){var _0x1a073e={'method':'GET','uri':'','headers':{'Authorization':_0x4646('0x43')+_0xb36095},'json':!![]};switch(_0xe442aa[_0x4646('0x49')]){case _0x4646('0x4a'):_0x1a073e[_0x4646('0x4b')]='https://www.zohoapis.'+_0x518608+_0x4646('0x4c')+_0x55b15c+'))';return getZohoUser(_0x1a073e,_0x4646('0x4d'))[_0x4646('0x30')](function(_0x4c4c4d){if(_0x4c4c4d)return _0x4c4c4d;_0x1a073e[_0x4646('0x4b')]=_0x4646('0x4e')+_0x518608+_0x4646('0x4f')+_0x55b15c+'))';return getZohoUser(_0x1a073e,'Leads')['then'](function(_0x46c34c){if(_0x46c34c)return _0x46c34c;if(_0xe442aa[_0x4646('0x3f')]!='nothing'){return createEndUser(_0xb36095,_0x518608,_0x566cc9,_0x55b15c,_0x5a864f,_0xe442aa);}else{return{};}});});break;case _0x4646('0x50'):_0x1a073e['uri']=_0x4646('0x4e')+_0x518608+_0x4646('0x4c')+_0x55b15c+'))';return getZohoUser(_0x1a073e,_0x4646('0x4d'))[_0x4646('0x30')](function(_0xd9f259){if(_0xd9f259)return _0xd9f259;if(_0xe442aa[_0x4646('0x3f')]!='nothing'){return createEndUser(_0xb36095,_0x518608,_0x566cc9,_0x55b15c,_0x5a864f,_0xe442aa);}else{return{};}});break;case _0x4646('0x51'):_0x1a073e['uri']=_0x4646('0x4e')+_0x518608+_0x4646('0x4f')+_0x55b15c+'))';return getZohoUser(_0x1a073e,'Leads')[_0x4646('0x30')](function(_0x13fc5e){if(_0x13fc5e)return _0x13fc5e;if(_0xe442aa[_0x4646('0x3f')]!=_0x4646('0x52')){return createEndUser(_0xb36095,_0x518608,_0x566cc9,_0x55b15c,_0x5a864f,_0xe442aa);}else{return{};}});break;}}function getCall(_0x3a60e7,_0x2bf13f,_0x4379ae,_0xce1c8f,_0x694597,_0x3a19b0,_0x4809e4,_0x5b2185){logger['info'](_0x4646('0x53'));var _0x24bc60={};_0x24bc60[_0x4646('0x54')]={'name':!_['isNil'](_0xce1c8f[_0x4646('0x40')][_0x4646('0x18')])&&!_[_0x4646('0x1b')](_0xce1c8f['profile'][_0x4646('0x18')])&&_0xce1c8f[_0x4646('0x37')]['name']===_0x4646('0x55')?_0xce1c8f['role'][_0x4646('0x18')]:!_[_0x4646('0x1b')](_0xce1c8f[_0x4646('0x41')])?_0xce1c8f[_0x4646('0x41')]+'\x20'+_0xce1c8f[_0x4646('0x42')]:_0xce1c8f[_0x4646('0x42')],'id':_0xce1c8f['id']};_0x24bc60[_0x4646('0x56')]=intUtil[_0x4646('0x57')](_0x3a19b0[_0x4646('0x58')],_0x4809e4,'\x20');_0x24bc60[_0x4646('0x59')]=intUtil[_0x4646('0x57')](_0x3a19b0[_0x4646('0x5a')],_0x4809e4,'\x0a');if(_0x694597['enduserType']===_0x4646('0x4d')){_0x24bc60[_0x4646('0x5b')]={'name':!_['isNil'](_0x694597[_0x4646('0x5c')])?_0x694597[_0x4646('0x5c')]:!_[_0x4646('0x1b')](_0x694597['First_Name'])?_0x694597[_0x4646('0x5d')]+'\x20'+_0x694597[_0x4646('0x5e')]:_0x694597[_0x4646('0x5e')],'id':_0x694597['id']};}if(_0x694597[_0x4646('0x47')]===_0x4646('0x5f')){_0x24bc60[_0x4646('0x60')]={'name':!_['isNil'](_0x694597[_0x4646('0x5c')])?_0x694597[_0x4646('0x5c')]:!_['isNil'](_0x694597['First_Name'])?_0x694597[_0x4646('0x5d')]+'\x20'+_0x694597[_0x4646('0x5e')]:_0x694597[_0x4646('0x5e')],'id':_0x694597['id']};_0x24bc60[_0x4646('0x61')]=_[_0x4646('0x62')](_0x694597[_0x4646('0x47')]);}if(_0x4809e4[_0x4646('0x63')]){_0x24bc60[_0x4646('0x64')]=moment['utc'](parseInt(_0x4809e4[_0x4646('0x63')])*0x3e8)['format'](_0x4646('0x65'));}else if(_0x4809e4[_0x4646('0x66')]&&_0x4809e4[_0x4646('0x67')]){_0x24bc60[_0x4646('0x64')]=moment[_0x4646('0x68')](moment(_0x4809e4['endtime'],_0x4646('0x69'))[_0x4646('0x6a')](moment(_0x4809e4[_0x4646('0x6b')],_0x4646('0x69'))))[_0x4646('0x6c')](_0x4646('0x65'));}switch(_0x4809e4[_0x4646('0x6d')]){case'called':_0x24bc60['Call_Result']=_0x4646('0x6e');break;case _0x4646('0x6f'):case'connect':_0x24bc60['Call_Result']=_0x4646('0x70');break;case _0x4646('0x71'):_0x24bc60[_0x4646('0x72')]=_0x4646('0x73');break;case _0x4646('0x74'):_0x24bc60[_0x4646('0x72')]=_0x4646('0x75');break;case _0x4646('0x76'):_0x24bc60['Call_Result']=_0x4646('0x77');default:}_0x24bc60[_0x4646('0x78')]=(_0x5b2185===_0x4646('0x79')?moment(_0x4809e4[_0x4646('0x6b')])[_0x4646('0x6c')](_0x4646('0x69')):moment(_0x4809e4[_0x4646('0x7a')])[_0x4646('0x6c')](_0x4646('0x69')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x24bc60['Call_Type']=_0x5b2185||_0x4646('0x7b');_0x24bc60=_['merge'](_0x24bc60,getCustomFields(_0x3a19b0[_0x4646('0x7c')],_0x4809e4));return request({'method':_0x4646('0x3e'),'uri':_0x4646('0x4e')+_0x2bf13f+_0x4646('0x7d'),'headers':{'Authorization':_0x4646('0x43')+_0x3a60e7},'body':{'data':[_0x24bc60]},'json':!![]})[_0x4646('0x30')](function(_0x2b1ad2){if(_0x2b1ad2&&_0x2b1ad2['data'][0x0][_0x4646('0x44')]===_0x4646('0x45')){logger['info'](_0x4646('0x7e'));return{'id':_0x2b1ad2[_0x4646('0x7f')][0x0][_0x4646('0x46')]['id']};}})[_0x4646('0x28')](function(_0x3126f3){logger[_0x4646('0x35')](_0x4646('0x80'),_0x3126f3['stack']);console[_0x4646('0x81')](_0x4646('0x80'),_0x3126f3);});}exports[_0x4646('0x82')]=function(_0x1637ed,_0x4fcc7a,_0xdc7f3a,_0x44c53e,_0x3add47,_0x52be00){var _0x37c597,_0x2fe0ca,_0x3fb857;_0x52be00[_0x4646('0x83')]=intUtil[_0x4646('0x84')](_0x52be00[_0x4646('0x83')]);_0x52be00[_0x4646('0x85')]=intUtil['stripTrailingSlash'](_0x52be00[_0x4646('0x85')]);if(_0x3add47&&_0x3add47[_0x4646('0x86')]){logger[_0x4646('0x35')](_0x4646('0x87'),_0x4646('0x88'));_0x4fcc7a[_0x4646('0x89')]=_0x52be00[_0x4646('0x85')]+_0x4646('0x8a')+_0x4fcc7a[_0x4646('0x8b')]+_0x4646('0x8c')+md5(_0x4fcc7a[_0x4646('0x8b')]);}else{_0x4fcc7a[_0x4646('0x89')]='';}var _0x1c3b04=_0x52be00[_0x4646('0x83')]===_0x4646('0x8d')?'eu':_0x4646('0x8e');return getAccessToken(_0x52be00)['then'](function(_0x48b250){_0x3fb857=_0x48b250;return getUser(_0x3fb857,_0x1c3b04,_0x52be00,_0x44c53e[_0x4646('0x34')]);})[_0x4646('0x30')](function(_0x157e84){_0x37c597=_0x157e84;logger[_0x4646('0x35')](_0x4646('0x8f'),_0x37c597['id']);return getEndUser(_0x3fb857,_0x1c3b04,_0x52be00,_0x4fcc7a[_0x4646('0x90')],_0x4fcc7a['calleridnum'],_0x37c597,_0xdc7f3a);})[_0x4646('0x30')](function(_0x3e87e7){_0x2fe0ca=_0x3e87e7;return getCall(_0x3fb857,_0x1c3b04,_0x52be00,_0x37c597,_0x2fe0ca,_0xdc7f3a,_0x4fcc7a,_0x4646('0x7b'));})[_0x4646('0x30')](function(_0x8c27b3){if(_0x8c27b3){logger[_0x4646('0x35')](_0x4646('0x91'),_0x8c27b3['id']);logger['info'](_0x4646('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4646('0x6c')](_0x4646('0x92'),_0x44c53e[_0x4646('0x18')]),_0x4646('0x93'),{'uri':_0x4646('0x94')+_0x52be00['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x8c27b3['id']});}})[_0x4646('0x28')](function(_0x203dcf){logger[_0x4646('0x29')](_0x4646('0x87'),JSON[_0x4646('0x3b')](_0x203dcf));});};exports['outbound']=function(_0x5740eb,_0x38c31d,_0x44e734,_0x365638,_0x2ac1b6,_0x549ee7,_0x140da3){var _0x187864,_0x57c27e,_0x49c3af;_0x549ee7[_0x4646('0x83')]=intUtil[_0x4646('0x84')](_0x549ee7[_0x4646('0x83')]);_0x549ee7[_0x4646('0x85')]=intUtil[_0x4646('0x84')](_0x549ee7[_0x4646('0x85')]);if(_0x140da3&&_0x140da3[_0x4646('0x95')]&&_0x140da3[_0x4646('0x95')]!==_0x4646('0x96')){logger[_0x4646('0x35')](_0x4646('0x97'),_0x4646('0x88'));_0x38c31d[_0x4646('0x89')]=_0x549ee7[_0x4646('0x85')]+_0x4646('0x8a')+_0x38c31d[_0x4646('0x8b')]+_0x4646('0x8c')+md5(_0x38c31d[_0x4646('0x8b')]);}var _0x1ea194=_0x549ee7[_0x4646('0x83')]===_0x4646('0x8d')?'eu':_0x4646('0x8e');return getAccessToken(_0x549ee7)[_0x4646('0x30')](function(_0x2663a8){_0x49c3af=_0x2663a8;return getUser(_0x49c3af,_0x1ea194,_0x549ee7,_0x365638[_0x4646('0x34')]);})['then'](function(_0x55d920){_0x187864=_0x55d920;logger[_0x4646('0x35')](_0x4646('0x8f'),_0x187864['id']);return getEndUser(_0x49c3af,_0x1ea194,_0x549ee7,_0x38c31d['destcalleridname'],_0x38c31d[_0x4646('0x98')],_0x187864,_0x44e734);})[_0x4646('0x30')](function(_0x211165){_0x57c27e=_0x211165;return getCall(_0x49c3af,_0x1ea194,_0x549ee7,_0x187864,_0x57c27e,_0x44e734,_0x38c31d,_0x4646('0x99'));})[_0x4646('0x30')](function(_0x5e9bcc){if(_0x5e9bcc){logger['info']('The\x20Call\x20ID\x20is:',_0x5e9bcc['id']);logger[_0x4646('0x35')](_0x4646('0x97'),_0x4646('0x9a'));emit(util[_0x4646('0x6c')](_0x4646('0x92'),_0x365638['name']),_0x4646('0x93'),{'uri':_0x4646('0x94')+_0x549ee7['host']+_0x4646('0x9b')+_0x5e9bcc['id']});}})[_0x4646('0x28')](function(_0x39f004){logger[_0x4646('0x29')](_0x4646('0x97'),JSON[_0x4646('0x3b')](_0x39f004));});};exports[_0x4646('0x9c')]=function(_0x3567f4,_0x27c04a,_0x5eb6b8,_0x39346b,_0x1b4929,_0x5831ee){var _0x85f468,_0xde07df,_0x278efd;_0x5831ee[_0x4646('0x83')]=intUtil[_0x4646('0x84')](_0x5831ee[_0x4646('0x83')]);_0x5831ee[_0x4646('0x85')]=intUtil[_0x4646('0x84')](_0x5831ee[_0x4646('0x85')]);if(_0x1b4929&&_0x1b4929['monitor_format']){logger[_0x4646('0x35')]('['+_0x27c04a['lastevent'][_0x4646('0x9d')]()+']',_0x4646('0x88'));_0x27c04a[_0x4646('0x89')]=_0x5831ee[_0x4646('0x85')]+_0x4646('0x8a')+_0x27c04a[_0x4646('0x8b')]+_0x4646('0x8c')+md5(_0x27c04a[_0x4646('0x8b')]);}else{_0x27c04a[_0x4646('0x89')]='';}var _0x992d8=_0x5831ee[_0x4646('0x83')]===_0x4646('0x8d')?'eu':_0x4646('0x8e');return getAccessToken(_0x5831ee)[_0x4646('0x30')](function(_0x200d2f){_0x278efd=_0x200d2f;return getUser(_0x278efd,_0x992d8,_0x5831ee);})[_0x4646('0x30')](function(_0x3aa35c){_0x85f468=_0x3aa35c;logger[_0x4646('0x35')](_0x4646('0x8f'),_0x85f468['id']);return getEndUser(_0x278efd,_0x992d8,_0x5831ee,_0x27c04a['calleridname'],_0x27c04a[_0x4646('0x9e')],_0x85f468,_0x5eb6b8);})['then'](function(_0x37b161){_0xde07df=_0x37b161;return getCall(_0x278efd,_0x992d8,_0x5831ee,_0x85f468,_0xde07df,_0x5eb6b8,_0x27c04a,_0x4646('0x7b'));})[_0x4646('0x30')](function(_0x10c4a0){if(_0x10c4a0){logger[_0x4646('0x35')]('The\x20Call\x20ID\x20is:',_0x10c4a0['id']);}})[_0x4646('0x28')](function(_0x5928c2){logger[_0x4646('0x29')]('['+_0x27c04a[_0x4646('0x6d')][_0x4646('0x9d')]()+']',JSON[_0x4646('0x3b')](_0x5928c2));});}; \ 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 5814c82..5b90ac3 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 _0x8f07=['../../../../config/logger','trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache'];(function(_0x49b79d,_0x407103){var _0x54f20a=function(_0x469874){while(--_0x469874){_0x49b79d['push'](_0x49b79d['shift']());}};_0x54f20a(++_0x407103);}(_0x8f07,0xb3));var _0x78f0=function(_0xcc62f8,_0x7b02c0){_0xcc62f8=_0xcc62f8-0x0;var _0x4d0107=_0x8f07[_0xcc62f8];return _0x4d0107;};'use strict';var util=require(_0x78f0('0x0'));var sh=require(_0x78f0('0x1'));var Mustache=require(_0x78f0('0x2'));var logger=require(_0x78f0('0x3'))(_0x78f0('0x4'));exports[_0x78f0('0x5')]=function(_0x187943,_0x1ca70e){var _0x5374ec=_0x187943[_0x78f0('0x6')]?_0x187943[_0x78f0('0x6')]:'Script';var _0x35779d=_0x187943[_0x78f0('0x7')]?Mustache[_0x78f0('0x8')](_0x187943[_0x78f0('0x7')],_0x1ca70e):_0x1ca70e;sh[_0x78f0('0x5')](_0x35779d,function(_0x500a95,_0x29a1a4,_0xdb3d7c){if(_0x500a95!==0x0){logger[_0x78f0('0x9')](util[_0x78f0('0xa')](_0x78f0('0xb'),_0x5374ec,_0x35779d,_0x500a95,_0xdb3d7c));}else{logger[_0x78f0('0xc')](util[_0x78f0('0xa')](_0x78f0('0xd'),_0x5374ec,_0x35779d,_0x29a1a4));}});}; \ No newline at end of file +var _0x4e44=['format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','trigger','exec','data2','data3','error'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x4e44,0xb7));var _0x44e4=function(_0x14200c,_0x4f0dce){_0x14200c=_0x14200c-0x0;var _0x42b948=_0x4e44[_0x14200c];return _0x42b948;};'use strict';var util=require('util');var sh=require(_0x44e4('0x0'));var Mustache=require(_0x44e4('0x1'));var logger=require('../../../../config/logger')(_0x44e4('0x2'));exports[_0x44e4('0x3')]=function(_0x57ea11,_0x2e2fa1){var _0x260066=_0x57ea11[_0x44e4('0x4')]?_0x57ea11[_0x44e4('0x4')]:'Script';var _0x5deb8c=_0x57ea11[_0x44e4('0x5')]?Mustache['render'](_0x57ea11[_0x44e4('0x5')],_0x2e2fa1):_0x2e2fa1;sh['exec'](_0x5deb8c,function(_0x4d221c,_0x1ca935,_0x44b793){if(_0x4d221c!==0x0){logger[_0x44e4('0x6')](util[_0x44e4('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x260066,_0x5deb8c,_0x4d221c,_0x44b793));}else{logger[_0x44e4('0x8')](util[_0x44e4('0x7')](_0x44e4('0x9'),_0x260066,_0x5deb8c,_0x1ca935));}});}; \ 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 62d9bb0..f7c9bec 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 _0xe989=['format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','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','request-promise','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','data6','error','GET','DELETE','PUT','parse','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info'];(function(_0x4bb606,_0x2bc96b){var _0x728b99=function(_0x46562f){while(--_0x46562f){_0x4bb606['push'](_0x4bb606['shift']());}};_0x728b99(++_0x2bc96b);}(_0xe989,0x8b));var _0x9e98=function(_0x3a834c,_0x475e51){_0x3a834c=_0x3a834c-0x0;var _0x689233=_0xe989[_0x3a834c];return _0x689233;};'use strict';var rp=require(_0x9e98('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x9e98('0x1'));var logger=require(_0x9e98('0x2'))(_0x9e98('0x3'));exports[_0x9e98('0x4')]=function(_0x2937f1,_0x4e94b0){var _0x30396c,_0x3fcce4;var _0x3c9216={'method':_0x2937f1[_0x9e98('0x5')][_0x9e98('0x6')](),'uri':Mustache[_0x9e98('0x7')](_0x2937f1['data2'],_0x4e94b0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2937f1[_0x9e98('0x8')])===_0x9e98('0x9')&&parseInt(_0x2937f1[_0x9e98('0x8')])>=0x1&&parseInt(_0x2937f1[_0x9e98('0x8')])<=0xa?parseInt(_0x2937f1[_0x9e98('0x8')])*0x3e8:0x5*0x3e8};try{_0x3c9216['headers']=_0x2937f1[_0x9e98('0xa')]?JSON['parse'](Mustache[_0x9e98('0x7')](_0x2937f1[_0x9e98('0xa')],_0x4e94b0)):{};}catch(_0x5dd44a){logger[_0x9e98('0xb')](_0x5dd44a['stack']);}switch(_0x2937f1['data1'][_0x9e98('0x6')]()){case _0x9e98('0xc'):case _0x9e98('0xd'):_0x30396c=null;_0x3c9216['qs']=_0x4e94b0;break;case'POST':case _0x9e98('0xe'):if(_0x2937f1['data7']){try{_0x30396c=JSON[_0x9e98('0xf')](Mustache[_0x9e98('0x7')](_0x2937f1[_0x9e98('0x10')],_0x4e94b0));_0x3c9216[_0x9e98('0x11')]=_0x30396c;}catch(_0x5c1cb4){logger[_0x9e98('0xb')](_0x5c1cb4[_0x9e98('0x12')]);logger['error'](_0x9e98('0x13'));}}else{_0x30396c=_0x4e94b0;_0x3c9216[_0x9e98('0x11')]=_0x30396c;}break;}logger[_0x9e98('0x14')](util[_0x9e98('0x15')](_0x9e98('0x16'),_0x2937f1[_0x9e98('0x5')],_0x2937f1[_0x9e98('0x17')],JSON[_0x9e98('0x18')](_0x3c9216)));rp(_0x3c9216)[_0x9e98('0x19')](function(_0x3a50a7){_0x30396c=!_[_0x9e98('0x1a')](_0x30396c)?',\x20request\x20body:\x20'+_0x30396c:'';_0x3fcce4=typeof _0x3a50a7[_0x9e98('0x11')]===_0x9e98('0x1b')?JSON[_0x9e98('0x18')](_0x3a50a7[_0x9e98('0x11')]):_0x3a50a7[_0x9e98('0x11')];logger[_0x9e98('0x14')](util[_0x9e98('0x15')](_0x9e98('0x1c'),_0x2937f1[_0x9e98('0x5')],_0x2937f1['data2'],_0x3a50a7[_0x9e98('0x1d')],_0x3fcce4));})[_0x9e98('0x1e')](function(_0x4c8107){logger[_0x9e98('0xb')](util[_0x9e98('0x15')](_0x9e98('0x1f'),_0x2937f1['data1'],_0x2937f1[_0x9e98('0x17')],_0x4c8107[_0x9e98('0x1d')],_0x4c8107['name'],_0x4c8107['message']));});}; \ No newline at end of file +var _0x7677=['data2','data5','number','parse','data6','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','render'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x7677,0x18f));var _0x7767=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7677[_0x122ef9];return _0x42fba0;};'use strict';var rp=require(_0x7767('0x0'));var util=require(_0x7767('0x1'));var _=require(_0x7767('0x2'));var Mustache=require('mustache');var logger=require(_0x7767('0x3'))(_0x7767('0x4'));exports[_0x7767('0x5')]=function(_0x19dc31,_0x3bc9f0){var _0x4a4762,_0x1f9bee;var _0x3ad3cc={'method':_0x19dc31[_0x7767('0x6')][_0x7767('0x7')](),'uri':Mustache[_0x7767('0x8')](_0x19dc31[_0x7767('0x9')],_0x3bc9f0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x19dc31[_0x7767('0xa')])===_0x7767('0xb')&&parseInt(_0x19dc31[_0x7767('0xa')])>=0x1&&parseInt(_0x19dc31['data5'])<=0xa?parseInt(_0x19dc31[_0x7767('0xa')])*0x3e8:0x5*0x3e8};try{_0x3ad3cc['headers']=_0x19dc31['data6']?JSON[_0x7767('0xc')](Mustache['render'](_0x19dc31[_0x7767('0xd')],_0x3bc9f0)):{};}catch(_0x588efa){logger[_0x7767('0xe')](_0x588efa[_0x7767('0xf')]);}switch(_0x19dc31[_0x7767('0x6')][_0x7767('0x7')]()){case _0x7767('0x10'):case _0x7767('0x11'):_0x4a4762=null;_0x3ad3cc['qs']=_0x3bc9f0;break;case _0x7767('0x12'):case _0x7767('0x13'):if(_0x19dc31[_0x7767('0x14')]){try{_0x4a4762=JSON[_0x7767('0xc')](Mustache[_0x7767('0x8')](_0x19dc31[_0x7767('0x14')],_0x3bc9f0));_0x3ad3cc[_0x7767('0x15')]=_0x4a4762;}catch(_0x2626bc){logger['error'](_0x2626bc[_0x7767('0xf')]);logger[_0x7767('0xe')](_0x7767('0x16'));}}else{_0x4a4762=_0x3bc9f0;_0x3ad3cc['body']=_0x4a4762;}break;}logger[_0x7767('0x17')](util[_0x7767('0x18')](_0x7767('0x19'),_0x19dc31[_0x7767('0x6')],_0x19dc31[_0x7767('0x9')],JSON[_0x7767('0x1a')](_0x3ad3cc)));rp(_0x3ad3cc)[_0x7767('0x1b')](function(_0x2bd30e){_0x4a4762=!_[_0x7767('0x1c')](_0x4a4762)?_0x7767('0x1d')+_0x4a4762:'';_0x1f9bee=typeof _0x2bd30e[_0x7767('0x15')]===_0x7767('0x1e')?JSON[_0x7767('0x1a')](_0x2bd30e[_0x7767('0x15')]):_0x2bd30e['body'];logger[_0x7767('0x17')](util[_0x7767('0x18')](_0x7767('0x1f'),_0x19dc31['data1'],_0x19dc31[_0x7767('0x9')],_0x2bd30e[_0x7767('0x20')],_0x1f9bee));})['catch'](function(_0x2da8c0){logger[_0x7767('0xe')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x19dc31[_0x7767('0x6')],_0x19dc31['data2'],_0x2da8c0[_0x7767('0x20')],_0x2da8c0['name'],_0x2da8c0[_0x7767('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 885fc70..8146261 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 _0x65f5=['request','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client','http'];(function(_0x5597a4,_0x161921){var _0x26ed19=function(_0x245cf7){while(--_0x245cf7){_0x5597a4['push'](_0x5597a4['shift']());}};_0x26ed19(++_0x161921);}(_0x65f5,0x126));var _0x565f=function(_0x5aac34,_0x280cab){_0x5aac34=_0x5aac34-0x0;var _0xf3540c=_0x65f5[_0x5aac34];return _0xf3540c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x565f('0x0'));var logger=require(_0x565f('0x1'))(_0x565f('0x2'));var client=jayson[_0x565f('0x3')][_0x565f('0x4')]({'port':0x2329});client['Request']=function(_0x119e14,_0x544217){return new BPromise(function(_0x359fef,_0x37da76){return client[_0x565f('0x5')](_0x119e14,_0x544217)['then'](function(_0x102b89){logger[_0x565f('0x6')](_0x565f('0x7'),_0x565f('0x2'),_0x119e14,_0x544217,_0x102b89);if(_0x102b89[_0x565f('0x8')]){logger['error']('rpc',_0x565f('0x2'),_0x119e14,_0x102b89[_0x565f('0x8')]['message'],_0x544217);return _0x37da76(_0x102b89[_0x565f('0x8')][_0x565f('0x9')]);}else{return _0x359fef(_0x102b89[_0x565f('0xa')]);}})[_0x565f('0xb')](function(_0x4213fa){logger[_0x565f('0x8')](_0x565f('0x7'),_0x565f('0x2'),_0x119e14,_0x4213fa,_0x544217);return _0x37da76(_0x4213fa);});});};module[_0x565f('0xc')]=client; \ No newline at end of file +var _0xdb17=['bluebird','../../config/logger','client','Request','request','then','debug','rpc','error','routing','message','exports','jayson/promise'];(function(_0x4af258,_0x1b2f0d){var _0x338cbc=function(_0x152cb7){while(--_0x152cb7){_0x4af258['push'](_0x4af258['shift']());}};_0x338cbc(++_0x1b2f0d);}(_0xdb17,0x137));var _0x7db1=function(_0x173d6b,_0x1948ac){_0x173d6b=_0x173d6b-0x0;var _0x2d6171=_0xdb17[_0x173d6b];return _0x2d6171;};'use strict';var jayson=require(_0x7db1('0x0'));var BPromise=require(_0x7db1('0x1'));var logger=require(_0x7db1('0x2'))('routing');var client=jayson[_0x7db1('0x3')]['http']({'port':0x2329});client[_0x7db1('0x4')]=function(_0x2b0ca8,_0x46fb1e){return new BPromise(function(_0x3ea7c9,_0x192f45){return client[_0x7db1('0x5')](_0x2b0ca8,_0x46fb1e)[_0x7db1('0x6')](function(_0x4e98e0){logger[_0x7db1('0x7')](_0x7db1('0x8'),'routing',_0x2b0ca8,_0x46fb1e,_0x4e98e0);if(_0x4e98e0[_0x7db1('0x9')]){logger['error']('rpc',_0x7db1('0xa'),_0x2b0ca8,_0x4e98e0[_0x7db1('0x9')][_0x7db1('0xb')],_0x46fb1e);return _0x192f45(_0x4e98e0[_0x7db1('0x9')][_0x7db1('0xb')]);}else{return _0x3ea7c9(_0x4e98e0['result']);}})['catch'](function(_0xcce020){logger['error'](_0x7db1('0x8'),_0x7db1('0xa'),_0x2b0ca8,_0xcce020,_0x46fb1e);return _0x192f45(_0xcce020);});});};module[_0x7db1('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1ba4310..a01862f 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 _0xec47=['../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','error','./realtime','./lib/email'];(function(_0x2119c3,_0x1b57c1){var _0x40ab8b=function(_0xe35e92){while(--_0xe35e92){_0x2119c3['push'](_0x2119c3['shift']());}};_0x40ab8b(++_0x1b57c1);}(_0xec47,0xe2));var _0x7ec4=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xec47[_0x29d94e];return _0x106237;};'use strict';var server=require('./server');var Realtime=require(_0x7ec4('0x0'));var EmailChannel=require(_0x7ec4('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x7ec4('0x2'))(_0x7ec4('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7ec4('0x4')]()[_0x7ec4('0x5')](mailAccount['getMailAccounts']())[_0x7ec4('0x5')](realtime[_0x7ec4('0x6')]())[_0x7ec4('0x5')](function(){email['refresh'](realtime[_0x7ec4('0x7')]);return realtime;});}function main(){return server[_0x7ec4('0x8')](realtime,email)[_0x7ec4('0x5')](function(){return initRealtime();})[_0x7ec4('0x5')](function(){return setting[_0x7ec4('0x9')]();})[_0x7ec4('0x5')](function(_0x303bbc){return setInterval(initRealtime,_0x303bbc[_0x7ec4('0xa')]*0x3e8);})['catch'](function(_0x4eebaf){logger[_0x7ec4('0xb')]('Email\x20service\x20initialization',_0x4eebaf);});}main(); \ No newline at end of file +var _0x50b6=['then','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','getMailAccounts'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x50b6,0x1ab));var _0x650b=function(_0x446acb,_0x9dcc0e){_0x446acb=_0x446acb-0x0;var _0x3ce42f=_0x50b6[_0x446acb];return _0x3ce42f;};'use strict';var server=require(_0x650b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x650b('0x1'));var mailAccount=require(_0x650b('0x2'));var setting=require(_0x650b('0x3'));var logger=require('../../config/logger')(_0x650b('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x650b('0x5')]()['then'](mailAccount[_0x650b('0x6')]())[_0x650b('0x7')](realtime['initMailAccounts']())[_0x650b('0x7')](function(){email['refresh'](realtime[_0x650b('0x8')]);return realtime;});}function main(){return server[_0x650b('0x9')](realtime,email)[_0x650b('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x650b('0xa')]();})['then'](function(_0x1e9dc8){return setInterval(initRealtime,_0x1e9dc8[_0x650b('0xb')]*0x3e8);})[_0x650b('0xc')](function(_0x2d345a){logger['error'](_0x650b('0xd'),_0x2d345a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2c98182..470e689 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 _0x6daa=['error','handleImapError','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','emit','name','key','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','Imap','active','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end'];(function(_0x5f460a,_0x3c10bd){var _0x407e40=function(_0x37d450){while(--_0x37d450){_0x5f460a['push'](_0x5f460a['shift']());}};_0x407e40(++_0x3c10bd);}(_0x6daa,0x1a3));var _0xa6da=function(_0x36621d,_0x57f3e2){_0x36621d=_0x36621d-0x0;var _0x3550f3=_0x6daa[_0x36621d];return _0x3550f3;};'use strict';var _=require('lodash');var moment=require(_0xa6da('0x0'));var BPromise=require(_0xa6da('0x1'));var md5=require(_0xa6da('0x2'));var Redis=require(_0xa6da('0x3'));var config=require(_0xa6da('0x4'));var logger=require(_0xa6da('0x5'))(_0xa6da('0x6'));config[_0xa6da('0x7')]=_[_0xa6da('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6da('0x7')]));var EmailImap=require(_0xa6da('0x9'));var EmailSmtp=require(_0xa6da('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x23f516){logger[_0xa6da('0xb')]('start\x20email\x20channel');this[_0xa6da('0xc')]=_0x23f516[_0xa6da('0xc')];this[_0xa6da('0xd')]={};this[_0xa6da('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xa6da('0xf')]=function(_0x595aac){var _0x3e113b=this[_0xa6da('0xc')][_0x595aac];var _0x22810c={'id':_0x3e113b['id'],'name':_0x3e113b[_0xa6da('0x10')],'key':_0x3e113b[_0xa6da('0x11')],'active':_0x3e113b['active'],'Imap':{'status':_0x3e113b['Imap'][_0xa6da('0x12')],'messageStatus':_0x3e113b['Imap'][_0xa6da('0x13')],'total':_0x3e113b['Imap'][_0xa6da('0x14')]}};if(_[_0xa6da('0x15')](md5Accounts[_0x595aac])){md5Accounts[_0x595aac]={};}var _0x195f46=md5(JSON[_0xa6da('0x16')](_0x22810c));if(md5Accounts[_0x595aac][_0xa6da('0x2')]!==_0x195f46){md5Accounts[_0x595aac][_0xa6da('0x2')]=_0x195f46;io[_0xa6da('0xf')](_0xa6da('0x17'),_0x22810c);}};EmailChannel[_0xa6da('0x18')][_0xa6da('0x19')]=function(_0x26214b){for(var _0x5a91e9 in _0x26214b){if(_0x26214b[_0xa6da('0x1a')](_0x5a91e9)){if(_0x26214b[_0x5a91e9][_0xa6da('0x1b')]&&_0x26214b[_0x5a91e9][_0xa6da('0x1c')]){var _0x5af358=_0x26214b[_0x5a91e9]['Imap'];if(!_0x5af358[_0xa6da('0x1d')]&&_0x26214b[_0x5a91e9][_0xa6da('0x1e')]!==_0xa6da('0x1f'))_0x5af358[_0xa6da('0x1d')]=_0x26214b[_0x5a91e9][_0xa6da('0x1e')];if(!this['imapAccounts']['hasOwnProperty'](_0x5af358['id'])){this[_0xa6da('0xd')][_0x5af358['id']]=new EmailImap(_0x5af358,_0x26214b[_0x5a91e9][_0xa6da('0x6')]);this['imapAccounts'][_0x5af358['id']]['on'](_0xa6da('0x20'),this[_0xa6da('0x21')][_0xa6da('0x22')](this,_0x5a91e9));this[_0xa6da('0xd')][_0x5af358['id']]['on'](_0xa6da('0x6'),this[_0xa6da('0x23')][_0xa6da('0x22')](this,_0x5a91e9));this[_0xa6da('0xd')][_0x5af358['id']]['on'](_0xa6da('0x24'),this['handleImapEnd'][_0xa6da('0x22')](this,_0x5a91e9));this[_0xa6da('0xd')][_0x5af358['id']]['on'](_0xa6da('0x25'),this[_0xa6da('0x26')][_0xa6da('0x22')](this,_0x5a91e9));}}else{if(_[_0xa6da('0x15')](this[_0xa6da('0xc')][_0x5a91e9]['Imap'])){this[_0xa6da('0xc')][_0x5a91e9]['Imap']={};}this['mailAccounts'][_0x5a91e9]['Imap'][_0xa6da('0x12')]='disabled';this[_0xa6da('0xc')][_0x5a91e9][_0xa6da('0x1b')][_0xa6da('0x13')]='';this[_0xa6da('0xf')](_0x5a91e9);}}}};EmailChannel['prototype'][_0xa6da('0x21')]=function(_0x3e8d0d,_0x56c26e){if(this[_0xa6da('0xc')][_0x3e8d0d]){this[_0xa6da('0xc')][_0x3e8d0d][_0xa6da('0x1b')]['status']=_0xa6da('0x27');this[_0xa6da('0xc')][_0x3e8d0d][_0xa6da('0x1b')]['messageStatus']=_0x56c26e[_0xa6da('0x10')];if(_0x56c26e[_0xa6da('0x28')]){this[_0xa6da('0xc')][_0x3e8d0d][_0xa6da('0x1b')][_0xa6da('0x14')]=_0x56c26e['messages']['total'];}return this[_0xa6da('0xf')](_0x3e8d0d);}};EmailChannel['prototype'][_0xa6da('0x23')]=function(_0x34a7f6,_0x4ab24f){logger[_0xa6da('0xb')](_0xa6da('0x29'),_0x4ab24f[_0xa6da('0x2a')],_0x4ab24f[_0xa6da('0x2b')],_0x4ab24f[_0xa6da('0x2c')],_0x34a7f6);if(this[_0xa6da('0xc')][_0x34a7f6]){return mailAccount['notify'](_0x34a7f6,_0x4ab24f)[_0xa6da('0x2d')](function(_0x2168a7){if(_0x2168a7){logger['info'](_0xa6da('0x2e'));}})[_0xa6da('0x2f')](function(_0x12ccba){logger[_0xa6da('0x25')](_0xa6da('0x30'),JSON[_0xa6da('0x16')](_0x12ccba));});}};EmailChannel['prototype'][_0xa6da('0x31')]=function(_0xa5625b){if(this[_0xa6da('0xc')][_0xa5625b]&&this[_0xa6da('0xc')][_0xa5625b][_0xa6da('0x1b')]){if(this[_0xa6da('0xd')][this[_0xa6da('0xc')][_0xa5625b][_0xa6da('0x1b')]['id']]){delete this[_0xa6da('0xd')][this[_0xa6da('0xc')][_0xa5625b][_0xa6da('0x1b')]['id']];}this[_0xa6da('0xc')][_0xa5625b][_0xa6da('0x1b')][_0xa6da('0x32')]=moment();this[_0xa6da('0xf')](_0xa5625b);}};EmailChannel['prototype'][_0xa6da('0x26')]=function(_0x57f654,_0x237718){if(this['mailAccounts'][_0x57f654]){this['mailAccounts'][_0x57f654]['Imap'][_0xa6da('0x12')]=_0xa6da('0x25');this[_0xa6da('0xc')][_0x57f654][_0xa6da('0x1b')][_0xa6da('0x13')]=_0x237718;return this[_0xa6da('0xf')](_0x57f654);}};EmailChannel['prototype'][_0xa6da('0x33')]=function(_0x51a78e,_0x2e28e8){return this[_0xa6da('0xe')]['send'](_0x51a78e,_0x2e28e8);};EmailChannel[_0xa6da('0x18')][_0xa6da('0x34')]=function(_0xf77318){var _0x59afbd=this;if(this[_0xa6da('0xc')][_0xf77318['id']]){if(_[_0xa6da('0x15')](this['mailAccounts'][_0xf77318['id']][_0xa6da('0x35')])){this[_0xa6da('0xc')][_0xf77318['id']][_0xa6da('0x35')]={};}this[_0xa6da('0xc')][_0xf77318['id']][_0xa6da('0x35')]['lastSync']=moment();return new BPromise(function(_0x533eb0,_0x1ff6e6){return _0x59afbd['smtp'][_0xa6da('0x36')](_0xf77318)[_0xa6da('0x2d')](function(_0x59661b){_0x59afbd['mailAccounts'][_0xf77318['id']][_0xa6da('0x35')]['status']=_0xa6da('0x37');_0x59afbd[_0xa6da('0xc')][_0xf77318['id']][_0xa6da('0x35')][_0xa6da('0x13')]='';_0x59afbd[_0xa6da('0xf')](_0xf77318['id']);_0x533eb0(_0x59661b);})['catch'](function(_0x58ef53){_0x59afbd[_0xa6da('0xc')][_0xf77318['id']][_0xa6da('0x35')][_0xa6da('0x12')]=_0xa6da('0x25');_0x59afbd['mailAccounts'][_0xf77318['id']][_0xa6da('0x35')][_0xa6da('0x13')]=_0x58ef53;_0x59afbd[_0xa6da('0xf')](_0xf77318['id']);_0x1ff6e6(_0x58ef53);});});}return this[_0xa6da('0xe')][_0xa6da('0x36')](_0xf77318);};module[_0xa6da('0x38')]=EmailChannel; \ No newline at end of file +var _0x153e=['custom','service','email','box','handleImapBox','bind','end','handleImapEnd','error','status','disabled','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','provider'];(function(_0x471315,_0x23f648){var _0x5edda0=function(_0x5f1bc7){while(--_0x5f1bc7){_0x471315['push'](_0x471315['shift']());}};_0x5edda0(++_0x23f648);}(_0x153e,0x10f));var _0xe153=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x153e[_0x3e0b8f];return _0x22f742;};'use strict';var _=require('lodash');var moment=require(_0xe153('0x0'));var BPromise=require(_0xe153('0x1'));var md5=require(_0xe153('0x2'));var Redis=require(_0xe153('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config['redis']=_[_0xe153('0x4')](config[_0xe153('0x5')],{'host':_0xe153('0x6'),'port':0x18eb});var io=require(_0xe153('0x7'))(new Redis(config[_0xe153('0x5')]));var EmailImap=require(_0xe153('0x8'));var EmailSmtp=require(_0xe153('0x9'));var mailAccount=require(_0xe153('0xa'));var md5Accounts={};function EmailChannel(_0xd3f4aa){logger['info'](_0xe153('0xb'));this[_0xe153('0xc')]=_0xd3f4aa[_0xe153('0xc')];this[_0xe153('0xd')]={};this[_0xe153('0xe')]=new EmailSmtp();}EmailChannel[_0xe153('0xf')][_0xe153('0x10')]=function(_0x42e485){var _0x2b1b6e=this['mailAccounts'][_0x42e485];var _0x26d04d={'id':_0x2b1b6e['id'],'name':_0x2b1b6e[_0xe153('0x11')],'key':_0x2b1b6e[_0xe153('0x12')],'active':_0x2b1b6e[_0xe153('0x13')],'Imap':{'status':_0x2b1b6e[_0xe153('0x14')]['status'],'messageStatus':_0x2b1b6e[_0xe153('0x14')][_0xe153('0x15')],'total':_0x2b1b6e[_0xe153('0x14')][_0xe153('0x16')]}};if(_[_0xe153('0x17')](md5Accounts[_0x42e485])){md5Accounts[_0x42e485]={};}var _0x54001c=md5(JSON[_0xe153('0x18')](_0x26d04d));if(md5Accounts[_0x42e485][_0xe153('0x2')]!==_0x54001c){md5Accounts[_0x42e485]['md5']=_0x54001c;io[_0xe153('0x10')](_0xe153('0x19'),_0x26d04d);}};EmailChannel[_0xe153('0xf')][_0xe153('0x1a')]=function(_0x1ffab4){for(var _0x463ef9 in _0x1ffab4){if(_0x1ffab4[_0xe153('0x1b')](_0x463ef9)){if(_0x1ffab4[_0x463ef9]['Imap']&&_0x1ffab4[_0x463ef9][_0xe153('0x13')]){var _0x1b0315=_0x1ffab4[_0x463ef9][_0xe153('0x14')];if(!_0x1b0315['service']&&_0x1ffab4[_0x463ef9][_0xe153('0x1c')]!==_0xe153('0x1d'))_0x1b0315[_0xe153('0x1e')]=_0x1ffab4[_0x463ef9][_0xe153('0x1c')];if(!this['imapAccounts'][_0xe153('0x1b')](_0x1b0315['id'])){this[_0xe153('0xd')][_0x1b0315['id']]=new EmailImap(_0x1b0315,_0x1ffab4[_0x463ef9][_0xe153('0x1f')]);this[_0xe153('0xd')][_0x1b0315['id']]['on'](_0xe153('0x20'),this[_0xe153('0x21')]['bind'](this,_0x463ef9));this['imapAccounts'][_0x1b0315['id']]['on'](_0xe153('0x1f'),this['handleImapEmail'][_0xe153('0x22')](this,_0x463ef9));this[_0xe153('0xd')][_0x1b0315['id']]['on'](_0xe153('0x23'),this[_0xe153('0x24')]['bind'](this,_0x463ef9));this[_0xe153('0xd')][_0x1b0315['id']]['on'](_0xe153('0x25'),this['handleImapError'][_0xe153('0x22')](this,_0x463ef9));}}else{if(_[_0xe153('0x17')](this[_0xe153('0xc')][_0x463ef9][_0xe153('0x14')])){this[_0xe153('0xc')][_0x463ef9][_0xe153('0x14')]={};}this[_0xe153('0xc')][_0x463ef9][_0xe153('0x14')][_0xe153('0x26')]=_0xe153('0x27');this[_0xe153('0xc')][_0x463ef9][_0xe153('0x14')]['messageStatus']='';this[_0xe153('0x10')](_0x463ef9);}}}};EmailChannel['prototype'][_0xe153('0x21')]=function(_0x51b3d9,_0x2c0cb4){if(this[_0xe153('0xc')][_0x51b3d9]){this['mailAccounts'][_0x51b3d9][_0xe153('0x14')][_0xe153('0x26')]=_0xe153('0x28');this[_0xe153('0xc')][_0x51b3d9][_0xe153('0x14')]['messageStatus']=_0x2c0cb4[_0xe153('0x11')];if(_0x2c0cb4[_0xe153('0x29')]){this[_0xe153('0xc')][_0x51b3d9][_0xe153('0x14')][_0xe153('0x16')]=_0x2c0cb4[_0xe153('0x29')][_0xe153('0x16')];}return this['emit'](_0x51b3d9);}};EmailChannel[_0xe153('0xf')][_0xe153('0x2a')]=function(_0x174c8b,_0x46058e){logger[_0xe153('0x2b')](_0xe153('0x2c'),_0x46058e[_0xe153('0x2d')],_0x46058e[_0xe153('0x2e')],_0x46058e[_0xe153('0x2f')],_0x174c8b);if(this[_0xe153('0xc')][_0x174c8b]){return mailAccount['notify'](_0x174c8b,_0x46058e)[_0xe153('0x30')](function(_0x296183){if(_0x296183){logger[_0xe153('0x2b')]('Mail\x20accepted\x20from\x20routing');}})[_0xe153('0x31')](function(_0x4bbb31){logger[_0xe153('0x25')](_0xe153('0x32'),JSON[_0xe153('0x18')](_0x4bbb31));});}};EmailChannel[_0xe153('0xf')]['handleImapEnd']=function(_0x26f1cf){if(this[_0xe153('0xc')][_0x26f1cf]&&this[_0xe153('0xc')][_0x26f1cf]['Imap']){if(this[_0xe153('0xd')][this[_0xe153('0xc')][_0x26f1cf][_0xe153('0x14')]['id']]){delete this[_0xe153('0xd')][this[_0xe153('0xc')][_0x26f1cf][_0xe153('0x14')]['id']];}this[_0xe153('0xc')][_0x26f1cf][_0xe153('0x14')][_0xe153('0x33')]=moment();this[_0xe153('0x10')](_0x26f1cf);}};EmailChannel[_0xe153('0xf')][_0xe153('0x34')]=function(_0x2f34b1,_0x2dfc92){if(this['mailAccounts'][_0x2f34b1]){this[_0xe153('0xc')][_0x2f34b1][_0xe153('0x14')][_0xe153('0x26')]=_0xe153('0x25');this['mailAccounts'][_0x2f34b1]['Imap']['messageStatus']=_0x2dfc92;return this[_0xe153('0x10')](_0x2f34b1);}};EmailChannel[_0xe153('0xf')][_0xe153('0x35')]=function(_0x1564f7,_0x1a9e63){return this[_0xe153('0xe')][_0xe153('0x36')](_0x1564f7,_0x1a9e63);};EmailChannel[_0xe153('0xf')][_0xe153('0x37')]=function(_0x2d49ee){var _0x3efbbc=this;if(this['mailAccounts'][_0x2d49ee['id']]){if(_['isNil'](this['mailAccounts'][_0x2d49ee['id']][_0xe153('0x38')])){this[_0xe153('0xc')][_0x2d49ee['id']]['Smtp']={};}this[_0xe153('0xc')][_0x2d49ee['id']][_0xe153('0x38')][_0xe153('0x33')]=moment();return new BPromise(function(_0x49a68d,_0x3055cb){return _0x3efbbc[_0xe153('0xe')][_0xe153('0x39')](_0x2d49ee)['then'](function(_0x476f03){_0x3efbbc[_0xe153('0xc')][_0x2d49ee['id']][_0xe153('0x38')][_0xe153('0x26')]=_0xe153('0x3a');_0x3efbbc[_0xe153('0xc')][_0x2d49ee['id']][_0xe153('0x38')][_0xe153('0x15')]='';_0x3efbbc[_0xe153('0x10')](_0x2d49ee['id']);_0x49a68d(_0x476f03);})[_0xe153('0x31')](function(_0x5ac8e4){_0x3efbbc['mailAccounts'][_0x2d49ee['id']][_0xe153('0x38')]['status']='error';_0x3efbbc[_0xe153('0xc')][_0x2d49ee['id']][_0xe153('0x38')][_0xe153('0x15')]=_0x5ac8e4;_0x3efbbc['emit'](_0x2d49ee['id']);_0x3055cb(_0x5ac8e4);});});}return this[_0xe153('0xe')][_0xe153('0x39')](_0x2d49ee);};module[_0xe153('0x3b')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 139ad2a..379b6b5 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 _0x1261=['handleMessageEnd','handleSimpleParser','parser','emit','handleFetchEnd','email','stringify','textCode','upperFirst','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','ready','handleReady','bind','once','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','modernAuthentication','xoauth2','generateXOAuth2Token','data5','getHost','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','closeBox','handleMessageAttributes','handleMessageBody'];(function(_0x1dcea6,_0x311cc6){var _0xcbd902=function(_0x3022a8){while(--_0x3022a8){_0x1dcea6['push'](_0x1dcea6['shift']());}};_0xcbd902(++_0x311cc6);}(_0x1261,0x144));var _0x1126=function(_0x459963,_0x5a366a){_0x459963=_0x459963-0x0;var _0xbe84e3=_0x1261[_0x459963];return _0xbe84e3;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var Imap=require(_0x1126('0x1'));var simpleParser=require(_0x1126('0x2'))[_0x1126('0x3')];var Iconv=require(_0x1126('0x4'))[_0x1126('0x5')];var EventEmitter=require(_0x1126('0x6'))[_0x1126('0x7')];var utils=require(_0x1126('0x8'));var logger=require(_0x1126('0x9'))('email');function EmailImap(_0x5c68c8,_0x40ba58){this[_0x1126('0xa')]='INBOX';this[_0x1126('0xb')]=this[_0x1126('0xc')](_0x5c68c8,_0x40ba58);this[_0x1126('0x1')]=new Imap(this[_0x1126('0xb')]);this[_0x1126('0x1')]['once'](_0x1126('0xd'),this[_0x1126('0xe')][_0x1126('0xf')](this));this['imap'][_0x1126('0x10')]('end',this['handleEnd'][_0x1126('0xf')](this));this['imap']['on'](_0x1126('0x11'),this[_0x1126('0x12')][_0x1126('0xf')](this));this[_0x1126('0x1')][_0x1126('0x13')]();}util[_0x1126('0x14')](EmailImap,EventEmitter);EmailImap[_0x1126('0x15')][_0x1126('0xc')]=function(_0x43850b,_0x53a8f0){var _0x5de9a7={'connTimeout':_0x43850b[_0x1126('0x16')]?_0x43850b[_0x1126('0x16')]*0x3e8:0x2710,'authTimeout':_0x43850b[_0x1126('0x17')]?_0x43850b['authTimeout']*0x3e8:0x1388};if(_[_0x1126('0x18')](_0x43850b['service'])){if(_0x43850b[_0x1126('0x19')]){_0x5de9a7[_0x1126('0x1a')]=_0x43850b[_0x1126('0x1a')];_0x5de9a7['password']=_0x43850b[_0x1126('0x1b')];}_0x5de9a7[_0x1126('0x1c')]=_0x43850b['host'];_0x5de9a7['port']=_0x43850b[_0x1126('0x1d')]||0x3e1;if(_0x43850b[_0x1126('0x1e')]){_0x5de9a7['tls']=!![];}else{_0x5de9a7['tls']=![];_0x5de9a7[_0x1126('0x1f')]='required';}}else{if(_0x43850b[_0x1126('0x20')]){_0x5de9a7[_0x1126('0x21')]=utils[_0x1126('0x22')](_0x43850b['CloudProvider'][_0x1126('0x23')],_0x43850b['user']);_0x5de9a7['user']=_0x43850b[_0x1126('0x1a')];}else{_0x5de9a7[_0x1126('0x1a')]=_0x43850b[_0x1126('0x1a')];_0x5de9a7[_0x1126('0x1b')]=_0x43850b['password'];}_0x5de9a7[_0x1126('0x1c')]=utils[_0x1126('0x24')](_0x43850b['service']);_0x5de9a7[_0x1126('0x1d')]=0x3e1;_0x5de9a7['tls']=!![];}_0x5de9a7['email']=_0x53a8f0||_0x43850b['user']||_0x1126('0x25');return _0x5de9a7;};EmailImap[_0x1126('0x15')][_0x1126('0xe')]=function(){this[_0x1126('0x1')][_0x1126('0x26')](this[_0x1126('0xa')],![],this[_0x1126('0x27')][_0x1126('0xf')](this));};EmailImap['prototype'][_0x1126('0x27')]=function(_0x375e59,_0xa293f4){if(_0x375e59){this['handleError'](_0x375e59,!![]);}else{this['emit'](_0x1126('0x28'),_0xa293f4);this[_0x1126('0x29')]();}};EmailImap['prototype'][_0x1126('0x2a')]=function(_0x23d2bc){if(_0x23d2bc){this['handleError'](_0x23d2bc,!![]);}else{this[_0x1126('0x1')]['end']();}};EmailImap[_0x1126('0x15')]['readUnseen']=function(){this[_0x1126('0x1')]['search']([_0x1126('0x2b')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x1126('0x2c')]=function(_0xa8906d,_0x1cef48){if(_0xa8906d){this['handleError'](_0xa8906d,!![]);}else{if(_0x1cef48[_0x1126('0x2d')]){try{var _0x226afb=this['imap'][_0x1126('0x2e')](_0x1cef48,{'bodies':'','markSeen':!![]});_0x226afb['on'](_0x1126('0x2f'),this[_0x1126('0x30')][_0x1126('0xf')](this));_0x226afb['once']('error',this[_0x1126('0x31')][_0x1126('0xf')](this));_0x226afb[_0x1126('0x10')](_0x1126('0x32'),this['handleFetchEnd'][_0x1126('0xf')](this));}catch(_0x6f4312){logger[_0x1126('0x11')](_0x6f4312);}}else{this[_0x1126('0x1')][_0x1126('0x33')](!![],this['handleCloseBox'][_0x1126('0xf')](this));}}};EmailImap[_0x1126('0x15')][_0x1126('0x30')]=function(_0x42e773){_0x42e773['on']('body',this['handleMessageBody'][_0x1126('0xf')](this));_0x42e773[_0x1126('0x10')]('attributes',this[_0x1126('0x34')][_0x1126('0xf')](this));_0x42e773[_0x1126('0x10')]('end',this['handleMessageEnd'][_0x1126('0xf')](this));};EmailImap[_0x1126('0x15')][_0x1126('0x35')]=function(_0x156554){simpleParser(_0x156554,{'Iconv':Iconv},this['handleSimpleParser'][_0x1126('0xf')](this));};EmailImap['prototype'][_0x1126('0x34')]=function(){};EmailImap[_0x1126('0x15')][_0x1126('0x36')]=function(){};EmailImap[_0x1126('0x15')][_0x1126('0x37')]=function(_0x5746f6,_0x1da59f){if(_0x5746f6){logger[_0x1126('0x11')](_0x5746f6);}else{var _0x2939a9=this;utils[_0x1126('0x38')](this[_0x1126('0xb')],_0x1da59f,function(_0x3442b8){_0x2939a9[_0x1126('0x39')]('email',_0x3442b8);});}};EmailImap[_0x1126('0x15')][_0x1126('0x3a')]=function(){this[_0x1126('0x1')][_0x1126('0x33')](!![],this[_0x1126('0x2a')]['bind'](this));};EmailImap['prototype'][_0x1126('0x31')]=function(_0x219bcc){this[_0x1126('0x12')](_0x219bcc);this[_0x1126('0x1')][_0x1126('0x33')](!![],this[_0x1126('0x2a')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x1126('0x39')]('end');};EmailImap[_0x1126('0x15')][_0x1126('0x12')]=function(_0x3584a3,_0x1a3584){logger['error']('handleError',this[_0x1126('0xb')][_0x1126('0x3b')],JSON[_0x1126('0x3c')](_0x3584a3));var _0x5f5d3a='';if(_0x3584a3){if(_0x3584a3[_0x1126('0x3d')]){_0x5f5d3a=_0x3584a3['textCode'];}else{for(var _0x3a5f20 in _0x3584a3){if(_0x3584a3['hasOwnProperty'](_0x3a5f20)){_0x5f5d3a+=_[_0x1126('0x3e')](_0x3a5f20)+':\x20'+_0x3584a3[_0x3a5f20]+'\x0a';}}}}if(_0x1a3584){this[_0x1126('0x1')][_0x1126('0x32')]();}else{this['emit'](_0x1126('0x11'),_0x5f5d3a);this[_0x1126('0x39')](_0x1126('0x32'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x5d17=['handleCloseBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','lodash','util','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','ready','once','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','end','handleFetchEnd'];(function(_0xbc03e6,_0x12a19c){var _0x4424eb=function(_0x3da85c){while(--_0x3da85c){_0xbc03e6['push'](_0xbc03e6['shift']());}};_0x4424eb(++_0x12a19c);}(_0x5d17,0x114));var _0x75d1=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x5d17[_0x265e0e];return _0x518157;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x75d1('0x2')];var Iconv=require(_0x75d1('0x3'))[_0x75d1('0x4')];var EventEmitter=require('events')[_0x75d1('0x5')];var utils=require(_0x75d1('0x6'));var logger=require(_0x75d1('0x7'))(_0x75d1('0x8'));function EmailImap(_0x56ac0a,_0x458681){this[_0x75d1('0x9')]=_0x75d1('0xa');this[_0x75d1('0xb')]=this[_0x75d1('0xc')](_0x56ac0a,_0x458681);this[_0x75d1('0xd')]=new Imap(this[_0x75d1('0xb')]);this['imap']['once'](_0x75d1('0xe'),this['handleReady']['bind'](this));this[_0x75d1('0xd')][_0x75d1('0xf')]('end',this[_0x75d1('0x10')][_0x75d1('0x11')](this));this[_0x75d1('0xd')]['on'](_0x75d1('0x12'),this[_0x75d1('0x13')][_0x75d1('0x11')](this));this['imap'][_0x75d1('0x14')]();}util[_0x75d1('0x15')](EmailImap,EventEmitter);EmailImap[_0x75d1('0x16')][_0x75d1('0xc')]=function(_0x49d723,_0x553697){var _0x55b8a0={'connTimeout':_0x49d723[_0x75d1('0x17')]?_0x49d723[_0x75d1('0x17')]*0x3e8:0x2710,'authTimeout':_0x49d723[_0x75d1('0x18')]?_0x49d723['authTimeout']*0x3e8:0x1388};if(_[_0x75d1('0x19')](_0x49d723[_0x75d1('0x1a')])){if(_0x49d723[_0x75d1('0x1b')]){_0x55b8a0[_0x75d1('0x1c')]=_0x49d723[_0x75d1('0x1c')];_0x55b8a0[_0x75d1('0x1d')]=_0x49d723[_0x75d1('0x1d')];}_0x55b8a0[_0x75d1('0x1e')]=_0x49d723[_0x75d1('0x1e')];_0x55b8a0[_0x75d1('0x1f')]=_0x49d723[_0x75d1('0x1f')]||0x3e1;if(_0x49d723['tls']){_0x55b8a0['tls']=!![];}else{_0x55b8a0[_0x75d1('0x20')]=![];_0x55b8a0[_0x75d1('0x21')]='required';}}else{if(_0x49d723[_0x75d1('0x22')]){_0x55b8a0[_0x75d1('0x23')]=utils[_0x75d1('0x24')](_0x49d723[_0x75d1('0x25')][_0x75d1('0x26')],_0x49d723[_0x75d1('0x1c')]);_0x55b8a0['user']=_0x49d723[_0x75d1('0x1c')];}else{_0x55b8a0[_0x75d1('0x1c')]=_0x49d723['user'];_0x55b8a0[_0x75d1('0x1d')]=_0x49d723[_0x75d1('0x1d')];}_0x55b8a0['host']=utils[_0x75d1('0x27')](_0x49d723['service']);_0x55b8a0[_0x75d1('0x1f')]=0x3e1;_0x55b8a0[_0x75d1('0x20')]=!![];}_0x55b8a0[_0x75d1('0x8')]=_0x553697||_0x49d723['user']||'anonymous@xcally.com';return _0x55b8a0;};EmailImap[_0x75d1('0x16')][_0x75d1('0x28')]=function(){this[_0x75d1('0xd')][_0x75d1('0x29')](this['mailbox'],![],this[_0x75d1('0x2a')][_0x75d1('0x11')](this));};EmailImap[_0x75d1('0x16')]['handleOpenBox']=function(_0x54095d,_0x57efd6){if(_0x54095d){this[_0x75d1('0x13')](_0x54095d,!![]);}else{this[_0x75d1('0x2b')](_0x75d1('0x2c'),_0x57efd6);this[_0x75d1('0x2d')]();}};EmailImap[_0x75d1('0x16')]['handleCloseBox']=function(_0x4d292e){if(_0x4d292e){this[_0x75d1('0x13')](_0x4d292e,!![]);}else{this[_0x75d1('0xd')]['end']();}};EmailImap[_0x75d1('0x16')]['readUnseen']=function(){this[_0x75d1('0xd')][_0x75d1('0x2e')]([_0x75d1('0x2f')],this[_0x75d1('0x30')][_0x75d1('0x11')](this));};EmailImap['prototype'][_0x75d1('0x30')]=function(_0x24f378,_0x466465){if(_0x24f378){this[_0x75d1('0x13')](_0x24f378,!![]);}else{if(_0x466465['length']){try{var _0x75b18a=this['imap'][_0x75d1('0x31')](_0x466465,{'bodies':'','markSeen':!![]});_0x75b18a['on'](_0x75d1('0x32'),this['handleFetchMessage'][_0x75d1('0x11')](this));_0x75b18a[_0x75d1('0xf')](_0x75d1('0x12'),this[_0x75d1('0x33')][_0x75d1('0x11')](this));_0x75b18a['once'](_0x75d1('0x34'),this[_0x75d1('0x35')][_0x75d1('0x11')](this));}catch(_0xa0f4c9){logger['error'](_0xa0f4c9);}}else{this['imap']['closeBox'](!![],this[_0x75d1('0x36')][_0x75d1('0x11')](this));}}};EmailImap[_0x75d1('0x16')][_0x75d1('0x37')]=function(_0x38972c){_0x38972c['on'](_0x75d1('0x38'),this[_0x75d1('0x39')][_0x75d1('0x11')](this));_0x38972c[_0x75d1('0xf')]('attributes',this[_0x75d1('0x3a')][_0x75d1('0x11')](this));_0x38972c[_0x75d1('0xf')](_0x75d1('0x34'),this[_0x75d1('0x3b')]['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0x1058b7){simpleParser(_0x1058b7,{'Iconv':Iconv},this[_0x75d1('0x3c')][_0x75d1('0x11')](this));};EmailImap[_0x75d1('0x16')][_0x75d1('0x3a')]=function(){};EmailImap[_0x75d1('0x16')]['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x3f2569,_0x4cb084){if(_0x3f2569){logger['error'](_0x3f2569);}else{var _0x450aa5=this;utils[_0x75d1('0x3d')](this[_0x75d1('0xb')],_0x4cb084,function(_0x46854c){_0x450aa5['emit'](_0x75d1('0x8'),_0x46854c);});}};EmailImap[_0x75d1('0x16')][_0x75d1('0x35')]=function(){this[_0x75d1('0xd')][_0x75d1('0x3e')](!![],this[_0x75d1('0x36')][_0x75d1('0x11')](this));};EmailImap[_0x75d1('0x16')][_0x75d1('0x33')]=function(_0x31703b){this[_0x75d1('0x13')](_0x31703b);this[_0x75d1('0xd')][_0x75d1('0x3e')](!![],this[_0x75d1('0x36')][_0x75d1('0x11')](this));};EmailImap[_0x75d1('0x16')][_0x75d1('0x10')]=function(){this[_0x75d1('0x2b')](_0x75d1('0x34'));};EmailImap[_0x75d1('0x16')][_0x75d1('0x13')]=function(_0x3a4bd9,_0x4e70ba){logger['error'](_0x75d1('0x13'),this[_0x75d1('0xb')][_0x75d1('0x8')],JSON[_0x75d1('0x3f')](_0x3a4bd9));var _0x4af3bb='';if(_0x3a4bd9){if(_0x3a4bd9[_0x75d1('0x40')]){_0x4af3bb=_0x3a4bd9[_0x75d1('0x40')];}else{for(var _0x2c6ff8 in _0x3a4bd9){if(_0x3a4bd9[_0x75d1('0x41')](_0x2c6ff8)){_0x4af3bb+=_['upperFirst'](_0x2c6ff8)+':\x20'+_0x3a4bd9[_0x2c6ff8]+'\x0a';}}}}if(_0x4e70ba){this[_0x75d1('0xd')][_0x75d1('0x34')]();}else{this[_0x75d1('0x2b')](_0x75d1('0x12'),_0x4af3bb);this['emit'](_0x75d1('0x34'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 02c9877..0798055 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 _0xfd6a=['toString','verify','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','sendMail'];(function(_0x3dbc73,_0x33582a){var _0x1b6078=function(_0x244925){while(--_0x244925){_0x3dbc73['push'](_0x3dbc73['shift']());}};_0x1b6078(++_0x33582a);}(_0xfd6a,0x10c));var _0xafd6=function(_0x13afee,_0x574014){_0x13afee=_0x13afee-0x0;var _0x1e0d2d=_0xfd6a[_0x13afee];return _0x1e0d2d;};'use strict';var nodemailer=require(_0xafd6('0x0'));var inlineBase64=require(_0xafd6('0x1'));function EmailSmtp(){}EmailSmtp[_0xafd6('0x2')]['send']=function(_0x172479,_0x4a5139){return new Promise(function(_0xcc6b60,_0x398561){var _0xf6ff08=nodemailer[_0xafd6('0x3')](_0x172479);_0xf6ff08['use']('compile',inlineBase64());_0xf6ff08[_0xafd6('0x4')](_0x4a5139,function(_0x21cd79,_0x539b7d){if(_0x21cd79){_0x398561(_0x21cd79[_0xafd6('0x5')]());}else{_0xcc6b60(_0x539b7d);}});});};EmailSmtp[_0xafd6('0x2')][_0xafd6('0x6')]=function(_0x3e7acb){return new Promise(function(_0x1e5af9,_0x5af222){var _0xb3dd71=nodemailer[_0xafd6('0x3')](_0x3e7acb);_0xb3dd71[_0xafd6('0x6')](function(_0x2f1427,_0x20f851){if(_0x2f1427){_0x5af222(_0x2f1427[_0xafd6('0x5')]());}else{if(_0x20f851){_0x1e5af9(_0x20f851);}else{_0x5af222('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x91c5=['toString','verify','Not\x20verifired','exports','nodemailer','prototype','send','createTransport','use','compile','sendMail'];(function(_0x3a8697,_0x4e39e8){var _0xa4c873=function(_0x3479aa){while(--_0x3479aa){_0x3a8697['push'](_0x3a8697['shift']());}};_0xa4c873(++_0x4e39e8);}(_0x91c5,0x1f3));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var nodemailer=require(_0x591c('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x591c('0x1')][_0x591c('0x2')]=function(_0x5ef34a,_0x450d24){return new Promise(function(_0x396506,_0x4a4302){var _0x3ff08c=nodemailer[_0x591c('0x3')](_0x5ef34a);_0x3ff08c[_0x591c('0x4')](_0x591c('0x5'),inlineBase64());_0x3ff08c[_0x591c('0x6')](_0x450d24,function(_0x197a94,_0x11b6b4){if(_0x197a94){_0x4a4302(_0x197a94[_0x591c('0x7')]());}else{_0x396506(_0x11b6b4);}});});};EmailSmtp[_0x591c('0x1')][_0x591c('0x8')]=function(_0x550585){return new Promise(function(_0x5b5c1a,_0x504625){var _0x14baa3=nodemailer['createTransport'](_0x550585);_0x14baa3['verify'](function(_0x56ddb1,_0x2907f4){if(_0x56ddb1){_0x504625(_0x56ddb1[_0x591c('0x7')]());}else{if(_0x2907f4){_0x5b5c1a(_0x2907f4);}else{_0x504625(_0x591c('0x9'));}}});});};module[_0x591c('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index fd2253c..f1e7854 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 _0x3a5e=['server/files/attachments/','writeFileSync','content','headerLines','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','messageId','inReplyTo','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','getHost','gmail','yahoo','hotmail','imap-mail.outlook.com','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','util','node-tnef','../../../config/environment','head','address','anonymous','@xcally.com','value','name','substring','indexOf','split','join','Anonymous','length','pop','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','email','originCc','bcc','attachment','filename','attachment-','format','%s-%s','now','root'];(function(_0x50975f,_0x15dfe7){var _0x3dedca=function(_0x5ba277){while(--_0x5ba277){_0x50975f['push'](_0x50975f['shift']());}};_0x3dedca(++_0x15dfe7);}(_0x3a5e,0x105));var _0xe3a5=function(_0x9632c,_0x12d4b7){_0x9632c=_0x9632c-0x0;var _0x2286ab=_0x3a5e[_0x9632c];return _0x2286ab;};'use strict';var _=require('lodash');var moment=require(_0xe3a5('0x0'));var random=require(_0xe3a5('0x1'));var fs=require('fs');var path=require('path');var util=require(_0xe3a5('0x2'));var tnef=require(_0xe3a5('0x3'));var logger=require('../../../config/logger')('email');var config=require(_0xe3a5('0x4'));function getAddress(_0x53e1e4){var _0x249022=_[_0xe3a5('0x5')](_0x53e1e4['value']);return _0x249022&&_0x249022[_0xe3a5('0x6')]?_0x249022[_0xe3a5('0x6')]:_0xe3a5('0x7')+random['generate'](0x6)+_0xe3a5('0x8');}function getFirstName(_0x272fc2){var _0x443bea=_[_0xe3a5('0x5')](_0x272fc2[_0xe3a5('0x9')]);if(_0x443bea&&_0x443bea[_0xe3a5('0xa')]){if(_0x443bea[_0xe3a5('0xa')]==_0x443bea[_0xe3a5('0x6')]){return _0x443bea[_0xe3a5('0xa')][_0xe3a5('0xb')](0x0,_0x443bea[_0xe3a5('0xa')][_0xe3a5('0xc')]('@'));}var _0x21d085=_0x443bea['name'][_0xe3a5('0xd')](/\s+/);return _0x21d085['length']>0x1?_0x21d085['slice'](0x0,-0x1)[_0xe3a5('0xe')]('\x20'):_0x443bea[_0xe3a5('0xa')];}return _0xe3a5('0xf');}function getLastName(_0x450f40){var _0x2bafc7=_[_0xe3a5('0x5')](_0x450f40[_0xe3a5('0x9')]);if(_0x2bafc7&&_0x2bafc7['name']){var _0xf29714=_0x2bafc7[_0xe3a5('0xa')][_0xe3a5('0xd')](/\s+/);return _0xf29714[_0xe3a5('0x10')]>0x1?_0xf29714[_0xe3a5('0x11')]():'';}return'';}function getMails(_0x6582d4,_0x363a57){var _0x4a15da='';for(var _0x24fb34=0x0;_0x24fb34<_0x363a57[_0xe3a5('0x9')][_0xe3a5('0x10')];_0x24fb34+=0x1){if(_0x363a57[_0xe3a5('0x9')][_0x24fb34][_0xe3a5('0x6')]!==_0x6582d4){if(!_[_0xe3a5('0x12')](_0x4a15da)){_0x4a15da+=',';}_0x4a15da+=_0x363a57[_0xe3a5('0x9')][_0x24fb34][_0xe3a5('0xa')]||_0x363a57[_0xe3a5('0x9')][_0x24fb34][_0xe3a5('0x6')]||'';_0x4a15da+='\x20<';_0x4a15da+=_0x363a57['value'][_0x24fb34][_0xe3a5('0x6')]?_0x363a57['value'][_0x24fb34][_0xe3a5('0x6')]:_0xe3a5('0x7')+random[_0xe3a5('0x13')](0x6)+_0xe3a5('0x8');_0x4a15da+='>';}}return _0x4a15da;}function parseEmail(_0xc6b379,_0x2d1a2d,_0x17f4f8){if(_0x2d1a2d[_0xe3a5('0x14')]){var _0x166d3d=/)<[^<]*)*<\/script>/gi;while(_0x166d3d[_0xe3a5('0x15')](_0x2d1a2d[_0xe3a5('0x14')])){_0x2d1a2d[_0xe3a5('0x14')]=_0x2d1a2d[_0xe3a5('0x14')][_0xe3a5('0x16')](_0x166d3d,'');}if(_0x2d1a2d[_0xe3a5('0x14')][_0xe3a5('0x17')](_0xe3a5('0x18'))){var _0x3a94cd=[];_0x2d1a2d[_0xe3a5('0x19')]['forEach'](_0x10ae3a=>{_0x3a94cd[_0xe3a5('0x1a')](_0x10ae3a['filename']);});var _0x4bd64f=/]+>/g;var _0x39f339=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x26c3dd=_0x2d1a2d[_0xe3a5('0x14')][_0xe3a5('0x16')](_0x39f339,'_SRC');var _0x3ae043=_0x26c3dd[_0xe3a5('0x16')](_0x4bd64f,_0xe3a5('0x1b'));for(let _0x24fffa=0x0;_0x24fffa<_0x3a94cd['length'];_0x24fffa++){var _0x114995=_0x3ae043[_0xe3a5('0x16')]('_IMG',_0xe3a5('0x1c')+_0x3a94cd[_0x24fffa]+_0xe3a5('0x1d'));_0x3ae043=_0x114995;}_0x2d1a2d[_0xe3a5('0x14')]=_0x3ae043;}_0x17f4f8[_0xe3a5('0x1e')]=_0x2d1a2d[_0xe3a5('0x14')];}else{_0x17f4f8[_0xe3a5('0x1e')]=_0x2d1a2d[_0xe3a5('0x1f')];}if(_0x17f4f8[_0xe3a5('0x1e')]){_0x17f4f8[_0xe3a5('0x1e')]=_0x17f4f8[_0xe3a5('0x1e')][_0xe3a5('0x16')](/0x0){var _0x30881f=['Auto-Submitted:\x20auto-replied',_0xe3a5('0x2f'),'Precedence:\x20auto_reply'];for(var _0x28bd09=0x0;_0x28bd09<_0x2d1a2d[_0xe3a5('0x2e')]['length'];_0x28bd09++){var _0x556fd7=_[_0xe3a5('0xc')](_0x30881f,_0x2d1a2d[_0xe3a5('0x2e')][_0x28bd09][_0xe3a5('0x30')]);if(_0x556fd7>=0x0){_0x17f4f8[_0xe3a5('0x31')]=!![];}}}return _0x17f4f8;}exports[_0xe3a5('0x32')]=function(_0x43eee3,_0x162d1f,_0x23289e){var _0x5c57a7={'from':getAddress(_0x162d1f['from']),'firstName':getFirstName(_0x162d1f['from']),'lastName':getLastName(_0x162d1f[_0xe3a5('0x33')]),'mapKey':_0xe3a5('0x21'),'message':{'from':getMails(_0x43eee3[_0xe3a5('0x21')],_0x162d1f[_0xe3a5('0x33')]),'to':_0x43eee3['email'],'cc':'','subject':_0x162d1f['subject']||'','messageId':_0x162d1f[_0xe3a5('0x34')],'inReplyTo':_0x162d1f[_0xe3a5('0x35')],'sentAt':moment(_0x162d1f['date'])['format'](_0xe3a5('0x36')),'attach':![],'attachments':[]}};if(!_0x162d1f[_0xe3a5('0x14')]&&!_0x162d1f[_0xe3a5('0x1f')]){var _0x1a305a=_[_0xe3a5('0x37')](_0x162d1f['attachments'],{'contentType':_0xe3a5('0x38')});if(_0x1a305a[_0xe3a5('0x10')]){logger[_0xe3a5('0x39')](util[_0xe3a5('0x27')](_0xe3a5('0x3a'),_0x162d1f['messageId']));tnef[_0xe3a5('0x3b')](_['first'](_0x1a305a)[_0xe3a5('0x2d')],function(_0x4c7661,_0x1714c8){if(_0x1714c8){_0x162d1f[_0xe3a5('0x14')]=_0x1714c8['BodyHTML']||_0xe3a5('0x3c');if(_0x1714c8[_0xe3a5('0x3d')]){for(var _0x111026=0x0;_0x111026<_0x1714c8['Attachments'][_0xe3a5('0x10')];_0x111026++){var _0x5a3605=_0x1714c8[_0xe3a5('0x3d')][_0x111026];_0x5c57a7[_0xe3a5('0x20')][_0xe3a5('0x19')]['push']({'filename':_0x5a3605[_0xe3a5('0x3e')],'content':Buffer['from'](_0x5a3605[_0xe3a5('0x3f')])});}}}_0x23289e(parseEmail(_0x43eee3,_0x162d1f,_0x5c57a7));});}else{_0x162d1f['html']=_0xe3a5('0x3c');_0x23289e(parseEmail(_0x43eee3,_0x162d1f,_0x5c57a7));}}else{_0x23289e(parseEmail(_0x43eee3,_0x162d1f,_0x5c57a7));}};exports[_0xe3a5('0x40')]=function(_0xe5741b){switch(_0xe5741b){case _0xe3a5('0x41'):return'imap.gmail.com';case _0xe3a5('0x42'):return'imap.mail.yahoo.com';case _0xe3a5('0x43'):return _0xe3a5('0x44');case'outlook365':return'outlook.office365.com';}return _0xe3a5('0x45');};exports[_0xe3a5('0x46')]=function(_0x372b74,_0x521810){var _0x4fc829=[_0xe3a5('0x47')+(_0x521810||''),_0xe3a5('0x48')+_0x372b74,'',''];return Buffer[_0xe3a5('0x33')](_0x4fc829['join'](''),_0xe3a5('0x49'))[_0xe3a5('0x4a')](_0xe3a5('0x4b'));}; \ No newline at end of file +var _0xdbdf=['push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','slice','join','Anonymous','pop','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachments','type','%s-%s','now','root','server/files/attachments/'];(function(_0x5cfa15,_0x5ba527){var _0x512840=function(_0x108529){while(--_0x108529){_0x5cfa15['push'](_0x5cfa15['shift']());}};_0x512840(++_0x5ba527);}(_0xdbdf,0x1b8));var _0xfdbd=function(_0x70027,_0x41bdcd){_0x70027=_0x70027-0x0;var _0x4efdcf=_0xdbdf[_0x70027];return _0x4efdcf;};'use strict';var _=require(_0xfdbd('0x0'));var moment=require(_0xfdbd('0x1'));var random=require(_0xfdbd('0x2'));var fs=require('fs');var path=require(_0xfdbd('0x3'));var util=require(_0xfdbd('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xfdbd('0x5'));var config=require(_0xfdbd('0x6'));function getAddress(_0x50e582){var _0x2d6953=_['head'](_0x50e582[_0xfdbd('0x7')]);return _0x2d6953&&_0x2d6953[_0xfdbd('0x8')]?_0x2d6953[_0xfdbd('0x8')]:_0xfdbd('0x9')+random[_0xfdbd('0xa')](0x6)+_0xfdbd('0xb');}function getFirstName(_0x483b83){var _0x46edd1=_[_0xfdbd('0xc')](_0x483b83[_0xfdbd('0x7')]);if(_0x46edd1&&_0x46edd1[_0xfdbd('0xd')]){if(_0x46edd1[_0xfdbd('0xd')]==_0x46edd1[_0xfdbd('0x8')]){return _0x46edd1['name'][_0xfdbd('0xe')](0x0,_0x46edd1[_0xfdbd('0xd')][_0xfdbd('0xf')]('@'));}var _0x4271ee=_0x46edd1[_0xfdbd('0xd')][_0xfdbd('0x10')](/\s+/);return _0x4271ee['length']>0x1?_0x4271ee[_0xfdbd('0x11')](0x0,-0x1)[_0xfdbd('0x12')]('\x20'):_0x46edd1['name'];}return _0xfdbd('0x13');}function getLastName(_0x6f7f57){var _0x4b3d0d=_[_0xfdbd('0xc')](_0x6f7f57[_0xfdbd('0x7')]);if(_0x4b3d0d&&_0x4b3d0d[_0xfdbd('0xd')]){var _0x15e0e9=_0x4b3d0d[_0xfdbd('0xd')][_0xfdbd('0x10')](/\s+/);return _0x15e0e9['length']>0x1?_0x15e0e9[_0xfdbd('0x14')]():'';}return'';}function getMails(_0x4bfcc9,_0xca9ab4){var _0x32ff7c='';for(var _0x1e3a4c=0x0;_0x1e3a4c<_0xca9ab4[_0xfdbd('0x7')]['length'];_0x1e3a4c+=0x1){if(_0xca9ab4['value'][_0x1e3a4c][_0xfdbd('0x8')]!==_0x4bfcc9){if(!_[_0xfdbd('0x15')](_0x32ff7c)){_0x32ff7c+=',';}_0x32ff7c+=_0xca9ab4[_0xfdbd('0x7')][_0x1e3a4c][_0xfdbd('0xd')]||_0xca9ab4[_0xfdbd('0x7')][_0x1e3a4c][_0xfdbd('0x8')]||'';_0x32ff7c+='\x20<';_0x32ff7c+=_0xca9ab4[_0xfdbd('0x7')][_0x1e3a4c][_0xfdbd('0x8')]?_0xca9ab4[_0xfdbd('0x7')][_0x1e3a4c][_0xfdbd('0x8')]:_0xfdbd('0x9')+random[_0xfdbd('0xa')](0x6)+_0xfdbd('0xb');_0x32ff7c+='>';}}return _0x32ff7c;}function parseEmail(_0x3d41ff,_0xb5282d,_0x361856){if(_0xb5282d['html']){var _0x341804=/)<[^<]*)*<\/script>/gi;while(_0x341804[_0xfdbd('0x16')](_0xb5282d[_0xfdbd('0x17')])){_0xb5282d[_0xfdbd('0x17')]=_0xb5282d[_0xfdbd('0x17')][_0xfdbd('0x18')](_0x341804,'');}if(_0xb5282d['html'][_0xfdbd('0x19')](_0xfdbd('0x1a'))){var _0x29ccb5=[];_0xb5282d['attachments'][_0xfdbd('0x1b')](_0x4ac2a1=>{_0x29ccb5['push'](_0x4ac2a1[_0xfdbd('0x1c')]);});var _0x3607aa=/]+>/g;var _0x3ccfb3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x16ed06=_0xb5282d[_0xfdbd('0x17')][_0xfdbd('0x18')](_0x3ccfb3,_0xfdbd('0x1d'));var _0x4dfe24=_0x16ed06[_0xfdbd('0x18')](_0x3607aa,_0xfdbd('0x1e'));for(let _0xff096b=0x0;_0xff096b<_0x29ccb5[_0xfdbd('0x1f')];_0xff096b++){var _0x1bb8fb=_0x4dfe24[_0xfdbd('0x18')](_0xfdbd('0x1e'),_0xfdbd('0x20')+_0x29ccb5[_0xff096b]+_0xfdbd('0x21'));_0x4dfe24=_0x1bb8fb;}_0xb5282d[_0xfdbd('0x17')]=_0x4dfe24;}_0x361856['body']=_0xb5282d[_0xfdbd('0x17')];}else{_0x361856[_0xfdbd('0x22')]=_0xb5282d[_0xfdbd('0x23')];}if(_0x361856[_0xfdbd('0x22')]){_0x361856[_0xfdbd('0x22')]=_0x361856['body'][_0xfdbd('0x18')](/0x0){var _0x5ee10c=[_0xfdbd('0x31'),_0xfdbd('0x32'),_0xfdbd('0x33')];for(var _0x216d6c=0x0;_0x216d6c<_0xb5282d['headerLines']['length'];_0x216d6c++){var _0x2f60ca=_[_0xfdbd('0xf')](_0x5ee10c,_0xb5282d[_0xfdbd('0x30')][_0x216d6c][_0xfdbd('0x34')]);if(_0x2f60ca>=0x0){_0x361856['isAutoreply']=!![];}}}return _0x361856;}exports[_0xfdbd('0x35')]=function(_0x21fe9a,_0x34ed86,_0x5e0a52){var _0x1bbcfe={'from':getAddress(_0x34ed86[_0xfdbd('0x36')]),'firstName':getFirstName(_0x34ed86[_0xfdbd('0x36')]),'lastName':getLastName(_0x34ed86[_0xfdbd('0x36')]),'mapKey':_0xfdbd('0x5'),'message':{'from':getMails(_0x21fe9a[_0xfdbd('0x5')],_0x34ed86[_0xfdbd('0x36')]),'to':_0x21fe9a[_0xfdbd('0x5')],'cc':'','subject':_0x34ed86['subject']||'','messageId':_0x34ed86['messageId'],'inReplyTo':_0x34ed86[_0xfdbd('0x37')],'sentAt':moment(_0x34ed86[_0xfdbd('0x38')])[_0xfdbd('0x39')](_0xfdbd('0x3a')),'attach':![],'attachments':[]}};if(!_0x34ed86['html']&&!_0x34ed86[_0xfdbd('0x23')]){var _0x2f447f=_[_0xfdbd('0x3b')](_0x34ed86[_0xfdbd('0x28')],{'contentType':'application/ms-tnef'});if(_0x2f447f['length']){logger[_0xfdbd('0x3c')](util[_0xfdbd('0x39')](_0xfdbd('0x3d'),_0x34ed86['messageId']));tnef[_0xfdbd('0x3e')](_[_0xfdbd('0x3f')](_0x2f447f)[_0xfdbd('0x40')],function(_0x257de9,_0x34b869){if(_0x34b869){_0x34ed86[_0xfdbd('0x17')]=_0x34b869['BodyHTML']||_0xfdbd('0x41');if(_0x34b869['Attachments']){for(var _0x10d862=0x0;_0x10d862<_0x34b869[_0xfdbd('0x42')][_0xfdbd('0x1f')];_0x10d862++){var _0x1ce839=_0x34b869['Attachments'][_0x10d862];_0x1bbcfe[_0xfdbd('0x24')][_0xfdbd('0x28')]['push']({'filename':_0x1ce839[_0xfdbd('0x43')],'content':Buffer['from'](_0x1ce839[_0xfdbd('0x44')])});}}}_0x5e0a52(parseEmail(_0x21fe9a,_0x34ed86,_0x1bbcfe));});}else{_0x34ed86[_0xfdbd('0x17')]=_0xfdbd('0x41');_0x5e0a52(parseEmail(_0x21fe9a,_0x34ed86,_0x1bbcfe));}}else{_0x5e0a52(parseEmail(_0x21fe9a,_0x34ed86,_0x1bbcfe));}};exports[_0xfdbd('0x45')]=function(_0x21c1c0){switch(_0x21c1c0){case'gmail':return _0xfdbd('0x46');case _0xfdbd('0x47'):return _0xfdbd('0x48');case _0xfdbd('0x49'):return _0xfdbd('0x4a');case _0xfdbd('0x4b'):return'outlook.office365.com';}return'127.0.0.1';};exports[_0xfdbd('0x4c')]=function(_0x237bec,_0x55aa2d){var _0x592d76=[_0xfdbd('0x4d')+(_0x55aa2d||''),'auth=Bearer\x20'+_0x237bec,'',''];return Buffer[_0xfdbd('0x36')](_0x592d76[_0xfdbd('0x12')](''),_0xfdbd('0x4e'))[_0xfdbd('0x4f')](_0xfdbd('0x50'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e0a521c..90e247f 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 _0x2021=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x12e066,_0x56a1d8){var _0x24c0a4=function(_0x5e56f5){while(--_0x5e56f5){_0x12e066['push'](_0x12e066['shift']());}};_0x24c0a4(++_0x56a1d8);}(_0x2021,0x9e));var _0x1202=function(_0x526be4,_0xd3d7d3){_0x526be4=_0x526be4-0x0;var _0x3bfc26=_0x2021[_0x526be4];return _0x3bfc26;};'use strict';var _=require(_0x1202('0x0'));function MailAccount(_0x2776e4){this['id']=_0x2776e4['id']||0x0;this[_0x1202('0x1')]=_0x2776e4['name']||_0x1202('0x2');this['key']=_0x2776e4[_0x1202('0x3')]||_0x1202('0x4');this[_0x1202('0x5')]=_0x2776e4['active']||![];this[_0x1202('0x6')]=_0x2776e4['Imap']||[];this[_0x1202('0x7')]=_0x2776e4[_0x1202('0x7')]||[];}module[_0x1202('0x8')]=MailAccount; \ No newline at end of file +var _0x580b=['Imap','Smtp','name','Service','key','SERV','active'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x580b,0x8e));var _0xb580=function(_0x37c982,_0x283e37){_0x37c982=_0x37c982-0x0;var _0x2b70d3=_0x580b[_0x37c982];return _0x2b70d3;};'use strict';var _=require('lodash');function MailAccount(_0x4024fc){this['id']=_0x4024fc['id']||0x0;this[_0xb580('0x0')]=_0x4024fc[_0xb580('0x0')]||_0xb580('0x1');this[_0xb580('0x2')]=_0x4024fc['key']||_0xb580('0x3');this[_0xb580('0x4')]=_0x4024fc[_0xb580('0x4')]||![];this['Imap']=_0x4024fc[_0xb580('0x5')]||[];this[_0xb580('0x6')]=_0x4024fc[_0xb580('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index df24bb4..ffa7a94 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 _0x2028=['initMailAccounts','mailAccounts','isUndefined','merge','exports','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x2d678f,_0x525387){var _0xfcf3b4=function(_0x32983d){while(--_0x32983d){_0x2d678f['push'](_0x2d678f['shift']());}};_0xfcf3b4(++_0x525387);}(_0x2028,0xb9));var _0x8202=function(_0x1ba0ba,_0x4c517e){_0x1ba0ba=_0x1ba0ba-0x0;var _0x44d2d7=_0x2028[_0x1ba0ba];return _0x44d2d7;};'use strict';var _=require('lodash');var MailAccount=require(_0x8202('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3ddf90,_0x31d46f,_0x4bfabd){var _0x3503db=_[_0x8202('0x1')](_0x3ddf90,function(_0xdbd489,_0x1466d8){return _0xdbd489[_0x4bfabd];});for(var _0x157979 in _0x31d46f){if(_0x31d46f[_0x8202('0x2')](_0x157979)){if(!_0x3503db[_0x157979]){delete _0x31d46f[_0x157979];}}}}Realtime['prototype'][_0x8202('0x3')]=function(_0x27d63,_0x4964ad){for(var _0xbe4df3 in _0x4964ad){if(_0x27d63[_0x8202('0x2')](_0xbe4df3)){_0x27d63[_0xbe4df3]=_0x4964ad[_0xbe4df3];}}};Realtime[_0x8202('0x4')][_0x8202('0x5')]=function(){var _0x25a86e=this;return function(_0x12a98a){if(_0x12a98a){freeIsNotKey(_0x12a98a,_0x25a86e[_0x8202('0x6')],'id');for(var _0x38ab63=0x0,_0x50e685={},_0x21def3={};_0x38ab63<_0x12a98a['length'];_0x38ab63+=0x1){_0x50e685=_0x12a98a[_0x38ab63];if(_[_0x8202('0x7')](_0x25a86e[_0x8202('0x6')][_0x50e685['id']])){_0x25a86e['mailAccounts'][_0x50e685['id']]=new MailAccount(_0x50e685);}else{_[_0x8202('0x8')](_0x25a86e[_0x8202('0x6')][_0x50e685['id']],_0x50e685);}}}return _0x25a86e[_0x8202('0x6')];};};module[_0x8202('0x9')]=Realtime; \ No newline at end of file +var _0x1e80=['isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e80,0x1e2));var _0x01e8=function(_0x21207e,_0x488728){_0x21207e=_0x21207e-0x0;var _0x50a67e=_0x1e80[_0x21207e];return _0x50a67e;};'use strict';var _=require(_0x01e8('0x0'));var MailAccount=require(_0x01e8('0x1'));var Realtime=function(){this[_0x01e8('0x2')]={};};function freeIsNotKey(_0x32599e,_0x18481a,_0x592ed7){var _0x257bfd=_[_0x01e8('0x3')](_0x32599e,function(_0x41f9a4,_0x24175d){return _0x41f9a4[_0x592ed7];});for(var _0x50257a in _0x18481a){if(_0x18481a[_0x01e8('0x4')](_0x50257a)){if(!_0x257bfd[_0x50257a]){delete _0x18481a[_0x50257a];}}}}Realtime[_0x01e8('0x5')]['mergeFromDatabase']=function(_0x5b3c2e,_0x4fcf1c){for(var _0x35089e in _0x4fcf1c){if(_0x5b3c2e[_0x01e8('0x4')](_0x35089e)){_0x5b3c2e[_0x35089e]=_0x4fcf1c[_0x35089e];}}};Realtime[_0x01e8('0x5')][_0x01e8('0x6')]=function(){var _0x16f2c0=this;return function(_0x27e13c){if(_0x27e13c){freeIsNotKey(_0x27e13c,_0x16f2c0[_0x01e8('0x2')],'id');for(var _0x8c4b5f=0x0,_0x18fc7f={},_0x25404f={};_0x8c4b5f<_0x27e13c[_0x01e8('0x7')];_0x8c4b5f+=0x1){_0x18fc7f=_0x27e13c[_0x8c4b5f];if(_[_0x01e8('0x8')](_0x16f2c0[_0x01e8('0x2')][_0x18fc7f['id']])){_0x16f2c0['mailAccounts'][_0x18fc7f['id']]=new MailAccount(_0x18fc7f);}else{_[_0x01e8('0x9')](_0x16f2c0[_0x01e8('0x2')][_0x18fc7f['id']],_0x18fc7f);}}}return _0x16f2c0[_0x01e8('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1ec66a7..097dedd 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 _0x22ed=['Imap','CloudProvider','type','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId'];(function(_0x33de83,_0x5cd14a){var _0x2dc227=function(_0x7a3560){while(--_0x7a3560){_0x33de83['push'](_0x33de83['shift']());}};_0x2dc227(++_0x5cd14a);}(_0x22ed,0x1a9));var _0xd22e=function(_0x3062cd,_0x15687c){_0x3062cd=_0x3062cd-0x0;var _0x596e6e=_0x22ed[_0x3062cd];return _0x596e6e;};'use strict';var client=require(_0xd22e('0x0'));exports[_0xd22e('0x1')]=function(){return function(){return client[_0xd22e('0x2')](_0xd22e('0x3'),{'options':{'attributes':['id',_0xd22e('0x4'),_0xd22e('0x5'),_0xd22e('0x6'),_0xd22e('0x7'),_0xd22e('0x8'),_0xd22e('0x9'),_0xd22e('0xa'),_0xd22e('0xb')],'raw':![],'include':[{'model':'MailServerIn','as':_0xd22e('0xc'),'include':[{'model':_0xd22e('0xd'),'attributes':['id','name',_0xd22e('0x6'),_0xd22e('0xe'),'data5'],'as':_0xd22e('0xd')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xd22e('0xd'),'attributes':['id','name','service','type',_0xd22e('0xf')],'as':_0xd22e('0xd')}]}]},'log':_0xd22e('0x10')});};};exports[_0xd22e('0x11')]=function(_0x4d9430,_0x34a91d){return client[_0xd22e('0x2')](_0xd22e('0x12'),{'account':{'id':_0x4d9430},'body':_0x34a91d,'log':_0xd22e('0x12')});}; \ No newline at end of file +var _0x8a9a=['type','data5','MailServerOut','getMailAccount','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider'];(function(_0x45eacc,_0x3727a4){var _0x3f1252=function(_0x36b7f4){while(--_0x36b7f4){_0x45eacc['push'](_0x45eacc['shift']());}};_0x3f1252(++_0x3727a4);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8a9a[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports[_0xa8a9('0x0')]=function(){return function(){return client[_0xa8a9('0x1')](_0xa8a9('0x2'),{'options':{'attributes':['id',_0xa8a9('0x3'),_0xa8a9('0x4'),_0xa8a9('0x5'),_0xa8a9('0x6'),_0xa8a9('0x7'),_0xa8a9('0x8'),_0xa8a9('0x9'),_0xa8a9('0xa')],'raw':![],'include':[{'model':_0xa8a9('0xb'),'as':'Imap','include':[{'model':_0xa8a9('0xc'),'attributes':['id','name',_0xa8a9('0x5'),_0xa8a9('0xd'),_0xa8a9('0xe')],'as':_0xa8a9('0xc')}]},{'model':_0xa8a9('0xf'),'as':'Smtp','include':[{'model':_0xa8a9('0xc'),'attributes':['id',_0xa8a9('0x3'),'service',_0xa8a9('0xd'),'data5'],'as':_0xa8a9('0xc')}]}]},'log':_0xa8a9('0x10')});};};exports['notify']=function(_0x1bcdbd,_0x218037){return client[_0xa8a9('0x1')](_0xa8a9('0x11'),{'account':{'id':_0x1bcdbd},'body':_0x218037,'log':_0xa8a9('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6790cd2..19a2a92 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 _0x144e=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x15fc71,_0x5f3b1c){var _0x1cd4b5=function(_0x3a32b5){while(--_0x3a32b5){_0x15fc71['push'](_0x15fc71['shift']());}};_0x1cd4b5(++_0x5f3b1c);}(_0x144e,0x170));var _0xe144=function(_0x549192,_0x5a0527){_0x549192=_0x549192-0x0;var _0x4c8920=_0x144e[_0x549192];return _0x4c8920;};'use strict';var client=require(_0xe144('0x0'));exports[_0xe144('0x1')]=function(){return client[_0xe144('0x2')](_0xe144('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe144('0x4')]},'log':_0xe144('0x5')});}; \ No newline at end of file +var _0xa7d9=['GetSettings','Request','loginMailFrequency'];(function(_0x51bf90,_0x5862cc){var _0x19dcf2=function(_0x8e7cc9){while(--_0x8e7cc9){_0x51bf90['push'](_0x51bf90['shift']());}};_0x19dcf2(++_0x5862cc);}(_0xa7d9,0x166));var _0x9a7d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa7d9[_0x397e5f];return _0x5302b8;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x9a7d('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9a7d('0x1')]},'log':_0x9a7d('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2c137aa..b9c4809 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 e3ebe13..08a5491 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 _0x8abf=['lodash','express','sticky-session','../../config/environment','timeout','listen','port','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x211de7,_0x2e6f69){var _0x2b29e0=function(_0xf2306){while(--_0xf2306){_0x211de7['push'](_0x211de7['shift']());}};_0x2b29e0(++_0x2e6f69);}(_0x8abf,0x18c));var _0xf8ab=function(_0x10212,_0x149d24){_0x10212=_0x10212-0x0;var _0x1bc403=_0x8abf[_0x10212];return _0x1bc403;};'use strict';var _=require(_0xf8ab('0x0'));var http=require('http');var express=require(_0xf8ab('0x1'));var sticky=require(_0xf8ab('0x2'));var Redis=require('ioredis');var config=require(_0xf8ab('0x3'));var app=express();var server=http['createServer'](app);server[_0xf8ab('0x4')]=0xdbba0;if(sticky[_0xf8ab('0x5')](server,config[_0xf8ab('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0xf8ab('0x7'),_0xf8ab('0x8')]});config[_0xf8ab('0x9')]=_[_0xf8ab('0xa')](config[_0xf8ab('0x9')],{'host':_0xf8ab('0xb'),'port':0x18eb});socketio['adapter'](require(_0xf8ab('0xc'))({'pubClient':new Redis(config[_0xf8ab('0x9')]),'subClient':new Redis(config['redis'])}));require(_0xf8ab('0xd'))[_0xf8ab('0xe')]();require(_0xf8ab('0xf'))['default'](socketio);require(_0xf8ab('0x10'))[_0xf8ab('0xe')](app);require(_0xf8ab('0x11'))[_0xf8ab('0xe')](app);}else{server[_0xf8ab('0x12')](_0xf8ab('0x13'),function(){console['log'](_0xf8ab('0x14'),config[_0xf8ab('0x6')]);});}exports=module[_0xf8ab('0x15')]=app; \ No newline at end of file +var _0x0fd9=['socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen'];(function(_0x4b1fa4,_0xa6f1f3){var _0x4b8f3b=function(_0x401504){while(--_0x401504){_0x4b1fa4['push'](_0x4b1fa4['shift']());}};_0x4b8f3b(++_0xa6f1f3);}(_0x0fd9,0xf5));var _0x90fd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0fd9[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x90fd('0x0'));var http=require(_0x90fd('0x1'));var express=require(_0x90fd('0x2'));var sticky=require(_0x90fd('0x3'));var Redis=require(_0x90fd('0x4'));var config=require(_0x90fd('0x5'));var app=express();var server=http[_0x90fd('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0x90fd('0x7')](server,config['port'])){var socketio=require(_0x90fd('0x8'))(server,{'transports':[_0x90fd('0x9'),_0x90fd('0xa')]});config[_0x90fd('0xb')]=_[_0x90fd('0xc')](config[_0x90fd('0xb')],{'host':_0x90fd('0xd'),'port':0x18eb});socketio[_0x90fd('0xe')](require(_0x90fd('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x90fd('0x10'))[_0x90fd('0x11')]();require(_0x90fd('0x12'))['default'](socketio);require('../../config/express')[_0x90fd('0x11')](app);require(_0x90fd('0x13'))[_0x90fd('0x11')](app);}else{server['once'](_0x90fd('0x14'),function(){console['log'](_0x90fd('0x15'),config[_0x90fd('0x16')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c1327e1..c860a00 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 _0x1703=['then','rpc','error','message','exports','jayson/promise','bluebird','routing','http','Request'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x1703,0xff));var _0x3170=function(_0xbb6999,_0xcfe53){_0xbb6999=_0xbb6999-0x0;var _0x5b3ad5=_0x1703[_0xbb6999];return _0x5b3ad5;};'use strict';var jayson=require(_0x3170('0x0'));var BPromise=require(_0x3170('0x1'));var logger=require('../../config/logger')(_0x3170('0x2'));var client=jayson['client'][_0x3170('0x3')]({'port':0x2329});client[_0x3170('0x4')]=function(_0x2d88e0,_0x364c19){return new BPromise(function(_0x29253a,_0x5883bc){return client['request'](_0x2d88e0,_0x364c19)[_0x3170('0x5')](function(_0x226384){logger['debug'](_0x3170('0x6'),_0x3170('0x2'),_0x2d88e0,_0x364c19,_0x226384);if(_0x226384[_0x3170('0x7')]){logger['error'](_0x3170('0x6'),_0x3170('0x2'),_0x2d88e0,_0x226384[_0x3170('0x7')]['message'],_0x364c19);return _0x5883bc(_0x226384[_0x3170('0x7')][_0x3170('0x8')]);}else{return _0x29253a(_0x226384['result']);}})['catch'](function(_0x1395ec){logger[_0x3170('0x7')](_0x3170('0x6'),_0x3170('0x2'),_0x2d88e0,_0x1395ec,_0x364c19);return _0x5883bc(_0x1395ec);});});};module[_0x3170('0x9')]=client; \ No newline at end of file +var _0xf680=['Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xf680,0x1ea));var _0x0f68=function(_0x1913d4,_0xde8b51){_0x1913d4=_0x1913d4-0x0;var _0xcbed2=_0xf680[_0x1913d4];return _0xcbed2;};'use strict';var jayson=require(_0x0f68('0x0'));var BPromise=require(_0x0f68('0x1'));var logger=require(_0x0f68('0x2'))(_0x0f68('0x3'));var client=jayson[_0x0f68('0x4')][_0x0f68('0x5')]({'port':0x2329});client[_0x0f68('0x6')]=function(_0x137170,_0xfcdc83){return new BPromise(function(_0x48eadb,_0x1cc266){return client[_0x0f68('0x7')](_0x137170,_0xfcdc83)[_0x0f68('0x8')](function(_0x581031){logger[_0x0f68('0x9')](_0x0f68('0xa'),_0x0f68('0x3'),_0x137170,_0xfcdc83,_0x581031);if(_0x581031[_0x0f68('0xb')]){logger[_0x0f68('0xb')](_0x0f68('0xa'),'routing',_0x137170,_0x581031[_0x0f68('0xb')][_0x0f68('0xc')],_0xfcdc83);return _0x1cc266(_0x581031[_0x0f68('0xb')][_0x0f68('0xc')]);}else{return _0x48eadb(_0x581031[_0x0f68('0xd')]);}})[_0x0f68('0xe')](function(_0x1bf1fd){logger[_0x0f68('0xb')](_0x0f68('0xa'),_0x0f68('0x3'),_0x137170,_0x1bf1fd,_0xfcdc83);return _0x1cc266(_0x1bf1fd);});});};module[_0x0f68('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4eb27dc..62cd069 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 _0xfd3c=['getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./realtime','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xfd3c,0x1d7));var _0xcfd3=function(_0x181d5b,_0x128c5c){_0x181d5b=_0x181d5b-0x0;var _0x10eefb=_0xfd3c[_0x181d5b];return _0x10eefb;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xcfd3('0x0'));var user=require(_0xcfd3('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xcfd3('0x2'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xcfd3('0x3'));var faxQueue=require(_0xcfd3('0x4'));var whatsappQueue=require(_0xcfd3('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xcfd3('0x6')](user[_0xcfd3('0x7')]())[_0xcfd3('0x6')](realtime['initAgents']())[_0xcfd3('0x6')](interval[_0xcfd3('0x8')]())[_0xcfd3('0x6')](realtime[_0xcfd3('0x9')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xcfd3('0x6')](realtime[_0xcfd3('0xa')]())[_0xcfd3('0x6')](chatQueue[_0xcfd3('0xb')]())['then'](realtime[_0xcfd3('0xc')]())[_0xcfd3('0x6')](smsQueue[_0xcfd3('0xd')]())[_0xcfd3('0x6')](realtime['initSmsQueues']())[_0xcfd3('0x6')](mailQueue[_0xcfd3('0xe')]())['then'](realtime[_0xcfd3('0xf')]())[_0xcfd3('0x6')](faxQueue[_0xcfd3('0x10')]())[_0xcfd3('0x6')](realtime[_0xcfd3('0x11')]())[_0xcfd3('0x6')](whatsappQueue[_0xcfd3('0x12')]())[_0xcfd3('0x6')](realtime[_0xcfd3('0x13')]())[_0xcfd3('0x6')](function(){return realtime;});}function main(){return server[_0xcfd3('0x14')](realtime)['then'](function(_0x5e5289){return initRealtime();})[_0xcfd3('0x6')](function(_0x29564f){return setInterval(initRealtime,0x1388);})['catch'](function(_0x264a01){console[_0xcfd3('0x15')](_0x264a01);});}main(); \ No newline at end of file +var _0x549a=['log','./server','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x549a,0x94));var _0xa549=function(_0x206366,_0x48a6ce){_0x206366=_0x206366-0x0;var _0xb2479f=_0x549a[_0x206366];return _0xb2479f;};'use strict';var BPromise=require('bluebird');var server=require(_0xa549('0x0'));var Realtime=require('./realtime');var user=require(_0xa549('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xa549('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xa549('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xa549('0x4'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xa549('0x5')]()[_0xa549('0x6')](user[_0xa549('0x7')]())['then'](realtime[_0xa549('0x8')]())[_0xa549('0x6')](interval[_0xa549('0x9')]())['then'](realtime['initIntervals']())[_0xa549('0x6')](openchannelQueue[_0xa549('0xa')]())['then'](realtime[_0xa549('0xb')]())[_0xa549('0x6')](chatQueue[_0xa549('0xc')]())['then'](realtime[_0xa549('0xd')]())[_0xa549('0x6')](smsQueue['getSmsQueues']())[_0xa549('0x6')](realtime['initSmsQueues']())[_0xa549('0x6')](mailQueue[_0xa549('0xe')]())[_0xa549('0x6')](realtime[_0xa549('0xf')]())[_0xa549('0x6')](faxQueue[_0xa549('0x10')]())['then'](realtime[_0xa549('0x11')]())[_0xa549('0x6')](whatsappQueue[_0xa549('0x12')]())['then'](realtime[_0xa549('0x13')]())[_0xa549('0x6')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xa549('0x6')](function(_0x11a26f){return initRealtime();})[_0xa549('0x6')](function(_0x28dad1){return setInterval(initRealtime,0x1388);})['catch'](function(_0x597bcb){console[_0xa549('0x14')](_0x597bcb);});}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 9b4d9fd..44c36d6 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x1dba64,_0x5c8c79){var _0x1959fe=function(_0x228535){while(--_0x228535){_0x1dba64['push'](_0x1dba64['shift']());}};_0x1959fe(++_0x5c8c79);}(_0x2ef3,0xba));var _0x32ef=function(_0x35ba7b,_0x1f5a3d){_0x35ba7b=_0x35ba7b-0x0;var _0x4dd105=_0x2ef3[_0x35ba7b];return _0x4dd105;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +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(_0x52519f,_0x5e05fc){var _0x39d514=function(_0x4b2f19){while(--_0x4b2f19){_0x52519f['push'](_0x52519f['shift']());}};_0x39d514(++_0x5e05fc);}(_0xe14b,0x93));var _0xbe14=function(_0x13d397,_0x26105a){_0x13d397=_0x13d397-0x0;var _0x5ccf60=_0xe14b[_0x13d397];return _0x5ccf60;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 9dfc3c0..9168877 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 _0xf5d3=['SendMail','client','then','error','result'];(function(_0x55b4c1,_0x3ee98a){var _0x3b7094=function(_0x15f366){while(--_0x15f366){_0x55b4c1['push'](_0x55b4c1['shift']());}};_0x3b7094(++_0x3ee98a);}(_0xf5d3,0xdd));var _0x3f5d=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf5d3[_0x46e363];return _0x3fb059;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x3f5d('0x0')]['http']({'port':0x232b});function request(_0x51fe86,_0x3f8e74){return new BPromise(function(_0x2cd672,_0x26a6b8){return client['request'](_0x51fe86,_0x3f8e74)[_0x3f5d('0x1')](function(_0x165b0d){if(_0x165b0d[_0x3f5d('0x2')]){return _0x26a6b8(_0x165b0d[_0x3f5d('0x2')]['message']);}else{return _0x2cd672(_0x165b0d[_0x3f5d('0x3')]);}})['catch'](function(_0x1ced40){return _0x26a6b8(_0x1ced40);});});}exports['sendMailMessage']=function(_0x46c896,_0x54b07a){return request(_0x3f5d('0x4'),{'account':_0x46c896,'message':_0x54b07a});}; \ No newline at end of file +var _0x5c9b=['then','error','message','result','catch','sendMailMessage','SendMail','bluebird','client','http','request'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x5c9b,0x15c));var _0xb5c9=function(_0x7c8ab7,_0x1369b7){_0x7c8ab7=_0x7c8ab7-0x0;var _0x27a1b1=_0x5c9b[_0x7c8ab7];return _0x27a1b1;};'use strict';var BPromise=require(_0xb5c9('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xb5c9('0x1')][_0xb5c9('0x2')]({'port':0x232b});function request(_0x6209f1,_0x1cff9c){return new BPromise(function(_0x980df7,_0x382088){return client[_0xb5c9('0x3')](_0x6209f1,_0x1cff9c)[_0xb5c9('0x4')](function(_0x357d97){if(_0x357d97[_0xb5c9('0x5')]){return _0x382088(_0x357d97[_0xb5c9('0x5')][_0xb5c9('0x6')]);}else{return _0x980df7(_0x357d97[_0xb5c9('0x7')]);}})[_0xb5c9('0x8')](function(_0x262683){return _0x382088(_0x262683);});});}exports[_0xb5c9('0x9')]=function(_0x3d9138,_0xf9f8b2){return request(_0xb5c9('0xa'),{'account':_0x3d9138,'message':_0xf9f8b2});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0631574..bd44d4a 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 _0x989b=['smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','format','openchannelCurrentCapacity','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity'];(function(_0x4f1c47,_0x14fc99){var _0x5915a6=function(_0xd39720){while(--_0xd39720){_0x4f1c47['push'](_0x4f1c47['shift']());}};_0x5915a6(++_0x14fc99);}(_0x989b,0x187));var _0xb989=function(_0x5c188e,_0xa88053){_0x5c188e=_0x5c188e-0x0;var _0x3bcb7a=_0x989b[_0x5c188e];return _0x3bcb7a;};'use strict';var _=require(_0xb989('0x0'));var moment=require(_0xb989('0x1'));var md5=require(_0xb989('0x2'));var Redis=require(_0xb989('0x3'));var config=require(_0xb989('0x4'));config['redis']=_['defaults'](config[_0xb989('0x5')],{'host':_0xb989('0x6'),'port':0x18eb});var io=require(_0xb989('0x7'))(new Redis(config[_0xb989('0x5')]));function Agent(_0x45ca58){this['id']=_0x45ca58['id']||0x0;this[_0xb989('0x8')]=_0x45ca58[_0xb989('0x8')]||'';this[_0xb989('0x9')]=_0x45ca58[_0xb989('0x9')]||!![];this[_0xb989('0xa')]=_0x45ca58[_0xb989('0xa')]||![];this[_0xb989('0xb')]=_0x45ca58[_0xb989('0xb')]||![];this['mailPause']=_0x45ca58[_0xb989('0xc')]||![];this[_0xb989('0xd')]=_0x45ca58[_0xb989('0xd')]||![];this['smsPause']=_0x45ca58[_0xb989('0xe')]||![];this[_0xb989('0xf')]=_0x45ca58[_0xb989('0xf')]||![];this[_0xb989('0x10')]=_0xb989('0x11');this[_0xb989('0x12')]=0x0;this[_0xb989('0x13')]=_0x45ca58['chatCapacity']||0x0;this[_0xb989('0x14')]=0x0;this[_0xb989('0x15')]=_0xb989('0x11');this[_0xb989('0x16')]=0x0;this[_0xb989('0x17')]=_0x45ca58[_0xb989('0x17')]||0x0;this[_0xb989('0x18')]=0x0;this[_0xb989('0x19')]='unknown';this[_0xb989('0x1a')]=0x0;this[_0xb989('0x1b')]=_0x45ca58[_0xb989('0x1b')]||0x0;this[_0xb989('0x1c')]=0x0;this[_0xb989('0x1d')]='unknown';this[_0xb989('0x1e')]=0x0;this[_0xb989('0x1f')]=_0x45ca58['smsCapacity']||0x0;this[_0xb989('0x20')]=0x0;this[_0xb989('0x21')]=_0xb989('0x11');this[_0xb989('0x22')]=0x0;this['whatsappCapacity']=_0x45ca58[_0xb989('0x23')]||0x0;this[_0xb989('0x24')]=0x0;this[_0xb989('0x25')]=_0xb989('0x11');this[_0xb989('0x26')]=0x0;this['openchannelCapacity']=_0x45ca58[_0xb989('0x27')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xb989('0x28')]=![];this[_0xb989('0x29')]=undefined;this[_0xb989('0x2')]='';this[_0xb989('0x2a')]();}Agent[_0xb989('0x2b')][_0xb989('0x2c')]=function(_0x38e4bc){if(this[_0x38e4bc+'CurrentCapacity']>0x0){if(this[_0x38e4bc+_0xb989('0x2d')]>0x0&&this[_0x38e4bc+'CurrentCapacity']>=this[_0x38e4bc+_0xb989('0x2d')]){return _0xb989('0x2e');}else{return _0xb989('0x2f');}}else{return'idle';}};Agent[_0xb989('0x2b')][_0xb989('0x2a')]=function(){var _0x32410e=[_0xb989('0x30'),_0xb989('0x31'),_0xb989('0x32'),_0xb989('0x33'),'sms',_0xb989('0x34')];for(var _0x50a983=0x0;_0x50a983<_0x32410e[_0xb989('0x35')];_0x50a983+=0x1){var _0x29b582=this['getChannelStatus'](_0x32410e[_0x50a983]);if(this[_0x32410e[_0x50a983]+_0xb989('0x36')]!==_0x29b582){this[_0x32410e[_0x50a983]+_0xb989('0x37')]=_['toNumber'](moment()[_0xb989('0x38')]('x'));}this[_0x32410e[_0x50a983]+_0xb989('0x36')]=_0x29b582;}var _0x7839a6={'id':this['id'],'name':this[_0xb989('0x8')],'online':this[_0xb989('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xb989('0xc')],'smsPause':this[_0xb989('0xe')],'faxPause':this[_0xb989('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xb989('0x10')],'chatStatusTime':this[_0xb989('0x12')],'chatCapacity':this[_0xb989('0x13')],'chatCurrentCapacity':this[_0xb989('0x14')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xb989('0x18')],'faxStatus':this[_0xb989('0x19')],'faxStatusTime':this[_0xb989('0x1a')],'faxCapacity':this[_0xb989('0x1b')],'faxCurrentCapacity':this[_0xb989('0x1c')],'smsStatus':this[_0xb989('0x1d')],'smsStatusTime':this[_0xb989('0x1e')],'smsCapacity':this[_0xb989('0x1f')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xb989('0x21')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xb989('0x25')],'openchannelStatusTime':this[_0xb989('0x26')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xb989('0x39')],'busy':this[_0xb989('0x28')],'busyQueue':this[_0xb989('0x29')]};var _0x56a328=md5(JSON['stringify'](_0x7839a6));if(this[_0xb989('0x2')]!==_0x56a328){this[_0xb989('0x2')]=_0x56a328;io['emit'](_0xb989('0x3a'),_0x7839a6);}};module[_0xb989('0x3b')]=Agent; \ No newline at end of file +var _0x02a4=['fax','whatsapp','length','Status','toNumber','format','smsCurrentCapacity','stringify','user:save','lodash','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','mail','chat','openchannel'];(function(_0x347d87,_0x295341){var _0x8297ff=function(_0x49dc0c){while(--_0x49dc0c){_0x347d87['push'](_0x347d87['shift']());}};_0x8297ff(++_0x295341);}(_0x02a4,0x7d));var _0x402a=function(_0x1aa19d,_0x4063b6){_0x1aa19d=_0x1aa19d-0x0;var _0x6f0666=_0x02a4[_0x1aa19d];return _0x6f0666;};'use strict';var _=require(_0x402a('0x0'));var moment=require(_0x402a('0x1'));var md5=require(_0x402a('0x2'));var Redis=require(_0x402a('0x3'));var config=require(_0x402a('0x4'));config['redis']=_[_0x402a('0x5')](config[_0x402a('0x6')],{'host':_0x402a('0x7'),'port':0x18eb});var io=require(_0x402a('0x8'))(new Redis(config[_0x402a('0x6')]));function Agent(_0x50759f){this['id']=_0x50759f['id']||0x0;this[_0x402a('0x9')]=_0x50759f[_0x402a('0x9')]||'';this[_0x402a('0xa')]=_0x50759f[_0x402a('0xa')]||!![];this[_0x402a('0xb')]=_0x50759f[_0x402a('0xb')]||![];this[_0x402a('0xc')]=_0x50759f['chatPause']||![];this[_0x402a('0xd')]=_0x50759f[_0x402a('0xd')]||![];this[_0x402a('0xe')]=_0x50759f['faxPause']||![];this[_0x402a('0xf')]=_0x50759f[_0x402a('0xf')]||![];this[_0x402a('0x10')]=_0x50759f[_0x402a('0x10')]||![];this[_0x402a('0x11')]=_0x402a('0x12');this[_0x402a('0x13')]=0x0;this[_0x402a('0x14')]=_0x50759f[_0x402a('0x14')]||0x0;this[_0x402a('0x15')]=0x0;this[_0x402a('0x16')]=_0x402a('0x12');this['mailStatusTime']=0x0;this[_0x402a('0x17')]=_0x50759f['mailCapacity']||0x0;this[_0x402a('0x18')]=0x0;this[_0x402a('0x19')]='unknown';this[_0x402a('0x1a')]=0x0;this['faxCapacity']=_0x50759f['faxCapacity']||0x0;this[_0x402a('0x1b')]=0x0;this[_0x402a('0x1c')]='unknown';this[_0x402a('0x1d')]=0x0;this['smsCapacity']=_0x50759f[_0x402a('0x1e')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x402a('0x1f')]=_0x402a('0x12');this[_0x402a('0x20')]=0x0;this[_0x402a('0x21')]=_0x50759f[_0x402a('0x21')]||0x0;this[_0x402a('0x22')]=0x0;this[_0x402a('0x23')]=_0x402a('0x12');this[_0x402a('0x24')]=0x0;this['openchannelCapacity']=_0x50759f[_0x402a('0x25')]||0x0;this[_0x402a('0x26')]=0x0;this[_0x402a('0x27')]=![];this[_0x402a('0x28')]=undefined;this[_0x402a('0x2')]='';this['updateRealtime']();}Agent[_0x402a('0x29')][_0x402a('0x2a')]=function(_0xfb705){if(this[_0xfb705+'CurrentCapacity']>0x0){if(this[_0xfb705+'Capacity']>0x0&&this[_0xfb705+_0x402a('0x2b')]>=this[_0xfb705+_0x402a('0x2c')]){return _0x402a('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x402a('0x29')]['updateRealtime']=function(){var _0x5eac23=[_0x402a('0x2e'),_0x402a('0x2f'),_0x402a('0x30'),_0x402a('0x31'),'sms',_0x402a('0x32')];for(var _0x529896=0x0;_0x529896<_0x5eac23[_0x402a('0x33')];_0x529896+=0x1){var _0x87a1c4=this['getChannelStatus'](_0x5eac23[_0x529896]);if(this[_0x5eac23[_0x529896]+_0x402a('0x34')]!==_0x87a1c4){this[_0x5eac23[_0x529896]+'StatusTime']=_[_0x402a('0x35')](moment()[_0x402a('0x36')]('x'));}this[_0x5eac23[_0x529896]+'Status']=_0x87a1c4;}var _0x1e81aa={'id':this['id'],'name':this[_0x402a('0x9')],'online':this[_0x402a('0xa')],'voicePause':this[_0x402a('0xb')],'chatPause':this[_0x402a('0xc')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x402a('0x11')],'chatStatusTime':this[_0x402a('0x13')],'chatCapacity':this[_0x402a('0x14')],'chatCurrentCapacity':this[_0x402a('0x15')],'mailStatus':this[_0x402a('0x16')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x402a('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x402a('0x19')],'faxStatusTime':this[_0x402a('0x1a')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x402a('0x1b')],'smsStatus':this[_0x402a('0x1c')],'smsStatusTime':this[_0x402a('0x1d')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x402a('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x402a('0x20')],'whatsappCapacity':this[_0x402a('0x21')],'whatsappCurrentCapacity':this[_0x402a('0x22')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x402a('0x24')],'openchannelCapacity':this[_0x402a('0x25')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x402a('0x27')],'busyQueue':this[_0x402a('0x28')]};var _0x59cd68=md5(JSON[_0x402a('0x38')](_0x1e81aa));if(this[_0x402a('0x2')]!==_0x59cd68){this['md5']=_0x59cd68;io['emit'](_0x402a('0x39'),_0x1e81aa);}};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 6f98d70..1a32761 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 _0xb3e7=['waiting','stringify','chat:queue:%s','emit','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','available','paused'];(function(_0x261e0a,_0x294869){var _0x330a48=function(_0x49a488){while(--_0x49a488){_0x261e0a['push'](_0x261e0a['shift']());}};_0x330a48(++_0x294869);}(_0xb3e7,0xf7));var _0x7b3e=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xb3e7[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x7b3e('0x0'));var md5=require(_0x7b3e('0x1'));var util=require(_0x7b3e('0x2'));var Redis=require(_0x7b3e('0x3'));var config=require('../../../config/environment');config[_0x7b3e('0x4')]=_[_0x7b3e('0x5')](config[_0x7b3e('0x4')],{'host':_0x7b3e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x2fcd86){this['id']=_0x2fcd86['id']||0x0;this[_0x7b3e('0x7')]=_0x2fcd86['name']||'';this[_0x7b3e('0x8')]=_0x2fcd86[_0x7b3e('0x8')]||0xa;this[_0x7b3e('0x9')]=_0x2fcd86[_0x7b3e('0x9')]||_0x7b3e('0xa');this[_0x7b3e('0xb')]=_0x2fcd86[_0x7b3e('0xb')];this[_0x7b3e('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x7b3e('0xd')]();this[_0x7b3e('0xe')]();}ChatQueue[_0x7b3e('0xf')]['updateRouting']=function(){var _0x141b2e=this['mapAgentsId'][_0x7b3e('0x10')];this[_0x7b3e('0xc')]=_[_0x7b3e('0x11')](this[_0x7b3e('0xb')],'id');this['mapAgentsId'][_0x7b3e('0x10')]=_0x141b2e;};ChatQueue[_0x7b3e('0xf')][_0x7b3e('0xe')]=function(){this[_0x7b3e('0x12')]=0x0;this['paused']=0x0;for(var _0x3ca9e6=0x0;_0x3ca9e6=0x0?this['available']:0x0;var _0x1af43b={'id':this['id'],'available':this[_0x7b3e('0x15')],'loggedIn':this[_0x7b3e('0x12')],'name':this[_0x7b3e('0x7')],'paused':this[_0x7b3e('0x16')],'waiting':this[_0x7b3e('0x17')]};var _0x311ffb=md5(JSON[_0x7b3e('0x18')](_0x1af43b));if(this['md5']!==_0x311ffb){this['md5']=_0x311ffb;io['to'](util['format'](_0x7b3e('0x19'),_0x1af43b['name']))[_0x7b3e('0x1a')]('chat_queue:save',_0x1af43b);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8414=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','name','format','chat:queue:%s','emit','chat_queue:save'];(function(_0x1abbd1,_0x26581f){var _0x41a7f2=function(_0x3e8820){while(--_0x3e8820){_0x1abbd1['push'](_0x1abbd1['shift']());}};_0x41a7f2(++_0x26581f);}(_0x8414,0x123));var _0x4841=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x8414[_0x1a7e4b];return _0x37a8fd;};'use strict';var _=require('lodash');var md5=require(_0x4841('0x0'));var util=require(_0x4841('0x1'));var Redis=require(_0x4841('0x2'));var config=require(_0x4841('0x3'));config[_0x4841('0x4')]=_[_0x4841('0x5')](config[_0x4841('0x4')],{'host':_0x4841('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4841('0x4')]));function ChatQueue(_0x5c7e44){this['id']=_0x5c7e44['id']||0x0;this['name']=_0x5c7e44['name']||'';this[_0x4841('0x7')]=_0x5c7e44[_0x4841('0x7')]||0xa;this[_0x4841('0x8')]=_0x5c7e44['strategy']||_0x4841('0x9');this[_0x4841('0xa')]=_0x5c7e44['Agents'];this[_0x4841('0xb')]={};this[_0x4841('0xc')]=0x0;this[_0x4841('0x0')]='';this[_0x4841('0xd')]();this[_0x4841('0xe')]();}ChatQueue[_0x4841('0xf')][_0x4841('0xd')]=function(){var _0x1173ba=this[_0x4841('0xb')]['_rr'];this[_0x4841('0xb')]=_[_0x4841('0x10')](this[_0x4841('0xa')],'id');this[_0x4841('0xb')][_0x4841('0x11')]=_0x1173ba;};ChatQueue[_0x4841('0xf')][_0x4841('0xe')]=function(){this[_0x4841('0x12')]=0x0;this[_0x4841('0x13')]=0x0;for(var _0x439a5c=0x0;_0x439a5c=0x0?this['available']:0x0;var _0x16e1f4={'id':this['id'],'available':this[_0x4841('0x16')],'loggedIn':this[_0x4841('0x12')],'name':this[_0x4841('0x17')],'paused':this[_0x4841('0x13')],'waiting':this[_0x4841('0xc')]};var _0x4c22ce=md5(JSON['stringify'](_0x16e1f4));if(this[_0x4841('0x0')]!==_0x4c22ce){this[_0x4841('0x0')]=_0x4c22ce;io['to'](util[_0x4841('0x18')](_0x4841('0x19'),_0x16e1f4[_0x4841('0x17')]))[_0x4841('0x1a')](_0x4841('0x1b'),_0x16e1f4);}};module[_0x4841('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index bb33286..6ce0e70 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 _0x48c5=['waiting','stringify','format','fax:queue:%s','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn'];(function(_0x57d3fd,_0x12f0ea){var _0x2956c9=function(_0x29f59f){while(--_0x29f59f){_0x57d3fd['push'](_0x57d3fd['shift']());}};_0x2956c9(++_0x12f0ea);}(_0x48c5,0x199));var _0x548c=function(_0x53b139,_0x1424de){_0x53b139=_0x53b139-0x0;var _0x17ed19=_0x48c5[_0x53b139];return _0x17ed19;};'use strict';var _=require(_0x548c('0x0'));var md5=require(_0x548c('0x1'));var util=require(_0x548c('0x2'));var Redis=require(_0x548c('0x3'));var config=require(_0x548c('0x4'));config['redis']=_[_0x548c('0x5')](config[_0x548c('0x6')],{'host':_0x548c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x548c('0x6')]));function FaxQueue(_0x21e948){this['id']=_0x21e948['id']||0x0;this['name']=_0x21e948[_0x548c('0x8')]||'';this[_0x548c('0x9')]=_0x21e948[_0x548c('0x9')]||0xa;this[_0x548c('0xa')]=_0x21e948[_0x548c('0xa')]||'beepall';this[_0x548c('0xb')]=_0x21e948[_0x548c('0xb')];this[_0x548c('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x548c('0xd')]();this[_0x548c('0xe')]();}FaxQueue[_0x548c('0xf')][_0x548c('0xd')]=function(){var _0x4d8e7e=this['mapAgentsId'][_0x548c('0x10')];this[_0x548c('0xc')]=_[_0x548c('0x11')](this['Agents'],'id');this[_0x548c('0xc')][_0x548c('0x10')]=_0x4d8e7e;};FaxQueue[_0x548c('0xf')][_0x548c('0xe')]=function(){this['loggedIn']=0x0;this[_0x548c('0x12')]=0x0;for(var _0x2829e6=0x0;_0x2829e6=0x0?this[_0x548c('0x15')]:0x0;var _0x5a6681={'id':this['id'],'available':this['available'],'loggedIn':this[_0x548c('0x16')],'name':this[_0x548c('0x8')],'paused':this['paused'],'waiting':this[_0x548c('0x17')]};var _0x233396=md5(JSON[_0x548c('0x18')](_0x5a6681));if(this[_0x548c('0x1')]!==_0x233396){this[_0x548c('0x1')]=_0x233396;io['to'](util[_0x548c('0x19')](_0x548c('0x1a'),_0x5a6681[_0x548c('0x8')]))['emit']('fax_queue:save',_0x5a6681);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x2686=['updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x2686,0xee));var _0x6268=function(_0x3615bf,_0x5a29b6){_0x3615bf=_0x3615bf-0x0;var _0x5953f0=_0x2686[_0x3615bf];return _0x5953f0;};'use strict';var _=require(_0x6268('0x0'));var md5=require(_0x6268('0x1'));var util=require(_0x6268('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x6268('0x3')](config[_0x6268('0x4')],{'host':_0x6268('0x5'),'port':0x18eb});var io=require(_0x6268('0x6'))(new Redis(config[_0x6268('0x4')]));function FaxQueue(_0x7f14fc){this['id']=_0x7f14fc['id']||0x0;this[_0x6268('0x7')]=_0x7f14fc[_0x6268('0x7')]||'';this[_0x6268('0x8')]=_0x7f14fc[_0x6268('0x8')]||0xa;this['strategy']=_0x7f14fc[_0x6268('0x9')]||_0x6268('0xa');this[_0x6268('0xb')]=_0x7f14fc[_0x6268('0xb')];this[_0x6268('0xc')]={};this[_0x6268('0xd')]=0x0;this[_0x6268('0x1')]='';this[_0x6268('0xe')]();this['updateRealtime']();}FaxQueue[_0x6268('0xf')][_0x6268('0xe')]=function(){var _0x42337e=this[_0x6268('0xc')][_0x6268('0x10')];this[_0x6268('0xc')]=_[_0x6268('0x11')](this[_0x6268('0xb')],'id');this['mapAgentsId']['_rr']=_0x42337e;};FaxQueue['prototype'][_0x6268('0x12')]=function(){this[_0x6268('0x13')]=0x0;this[_0x6268('0x14')]=0x0;for(var _0x512290=0x0;_0x512290=0x0?this[_0x6268('0x16')]:0x0;var _0x266f1d={'id':this['id'],'available':this[_0x6268('0x16')],'loggedIn':this[_0x6268('0x13')],'name':this[_0x6268('0x7')],'paused':this[_0x6268('0x14')],'waiting':this[_0x6268('0xd')]};var _0x2daec3=md5(JSON[_0x6268('0x17')](_0x266f1d));if(this[_0x6268('0x1')]!==_0x2daec3){this[_0x6268('0x1')]=_0x2daec3;io['to'](util[_0x6268('0x18')](_0x6268('0x19'),_0x266f1d[_0x6268('0x7')]))[_0x6268('0x1a')](_0x6268('0x1b'),_0x266f1d);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e1098d5..2ae203a 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 _0x3815=['name','Intervals','exports'];(function(_0x344442,_0xe0d533){var _0x40809a=function(_0x2583a0){while(--_0x2583a0){_0x344442['push'](_0x344442['shift']());}};_0x40809a(++_0xe0d533);}(_0x3815,0x78));var _0x5381=function(_0x22fb2a,_0x3f1261){_0x22fb2a=_0x22fb2a-0x0;var _0x4e790c=_0x3815[_0x22fb2a];return _0x4e790c;};'use strict';function Interval(_0x2cc560){this['id']=_0x2cc560['id']||0x0;this[_0x5381('0x0')]=_0x2cc560[_0x5381('0x0')]||'';this[_0x5381('0x1')]=_0x2cc560[_0x5381('0x1')]||{};}module[_0x5381('0x2')]=Interval; \ No newline at end of file +var _0x65c4=['Intervals','name'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0x65c4,0x1b9));var _0x465c=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x65c4[_0xa9a245];return _0x2d0eaa;};'use strict';function Interval(_0x1ee621){this['id']=_0x1ee621['id']||0x0;this[_0x465c('0x0')]=_0x1ee621['name']||'';this[_0x465c('0x1')]=_0x1ee621['Intervals']||{};}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 0f584d6..f15cd2d 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 _0x8060=['mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','Agents','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s'];(function(_0x2d1371,_0x43aef7){var _0xf17680=function(_0x31ae99){while(--_0x31ae99){_0x2d1371['push'](_0x2d1371['shift']());}};_0xf17680(++_0x43aef7);}(_0x8060,0x1c4));var _0x0806=function(_0x27eda0,_0x42a3cf){_0x27eda0=_0x27eda0-0x0;var _0x2b63a5=_0x8060[_0x27eda0];return _0x2b63a5;};'use strict';var _=require(_0x0806('0x0'));var md5=require(_0x0806('0x1'));var util=require(_0x0806('0x2'));var Redis=require(_0x0806('0x3'));var config=require(_0x0806('0x4'));config[_0x0806('0x5')]=_['defaults'](config['redis'],{'host':_0x0806('0x6'),'port':0x18eb});var io=require(_0x0806('0x7'))(new Redis(config['redis']));function MailQueue(_0x1ebd48){this['id']=_0x1ebd48['id']||0x0;this[_0x0806('0x8')]=_0x1ebd48[_0x0806('0x8')]||'';this['timeout']=_0x1ebd48[_0x0806('0x9')]||0xa;this[_0x0806('0xa')]=_0x1ebd48[_0x0806('0xa')]||_0x0806('0xb');this['Agents']=_0x1ebd48['Agents'];this[_0x0806('0xc')]={};this[_0x0806('0xd')]=0x0;this[_0x0806('0x1')]='';this[_0x0806('0xe')]();this[_0x0806('0xf')]();}MailQueue[_0x0806('0x10')][_0x0806('0xe')]=function(){var _0x27f02c=this[_0x0806('0xc')][_0x0806('0x11')];this['mapAgentsId']=_['map'](this[_0x0806('0x12')],'id');this[_0x0806('0xc')][_0x0806('0x11')]=_0x27f02c;};MailQueue[_0x0806('0x10')][_0x0806('0xf')]=function(){this[_0x0806('0x13')]=0x0;this[_0x0806('0x14')]=0x0;for(var _0xcae5e8=0x0;_0xcae5e8=0x0?this[_0x0806('0x18')]:0x0;var _0x38c78e={'id':this['id'],'available':this[_0x0806('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x0806('0x14')],'waiting':this[_0x0806('0xd')]};var _0x2b15c9=md5(JSON[_0x0806('0x19')](_0x38c78e));if(this[_0x0806('0x1')]!==_0x2b15c9){this[_0x0806('0x1')]=_0x2b15c9;io['to'](util[_0x0806('0x1a')](_0x0806('0x1b'),_0x38c78e[_0x0806('0x8')]))['emit'](_0x0806('0x1c'),_0x38c78e);}};module[_0x0806('0x1d')]=MailQueue; \ No newline at end of file +var _0x04e6=['waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x2f4d1f,_0x461983){var _0x16c572=function(_0x240aea){while(--_0x240aea){_0x2f4d1f['push'](_0x2f4d1f['shift']());}};_0x16c572(++_0x461983);}(_0x04e6,0x178));var _0x604e=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x04e6[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x604e('0x0'));var md5=require(_0x604e('0x1'));var util=require(_0x604e('0x2'));var Redis=require(_0x604e('0x3'));var config=require(_0x604e('0x4'));config[_0x604e('0x5')]=_[_0x604e('0x6')](config[_0x604e('0x5')],{'host':_0x604e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x604e('0x5')]));function MailQueue(_0xa5732e){this['id']=_0xa5732e['id']||0x0;this['name']=_0xa5732e[_0x604e('0x8')]||'';this[_0x604e('0x9')]=_0xa5732e[_0x604e('0x9')]||0xa;this[_0x604e('0xa')]=_0xa5732e['strategy']||_0x604e('0xb');this[_0x604e('0xc')]=_0xa5732e[_0x604e('0xc')];this[_0x604e('0xd')]={};this[_0x604e('0xe')]=0x0;this[_0x604e('0x1')]='';this[_0x604e('0xf')]();this[_0x604e('0x10')]();}MailQueue[_0x604e('0x11')][_0x604e('0xf')]=function(){var _0x67050c=this[_0x604e('0xd')][_0x604e('0x12')];this['mapAgentsId']=_[_0x604e('0x13')](this[_0x604e('0xc')],'id');this['mapAgentsId'][_0x604e('0x12')]=_0x67050c;};MailQueue['prototype']['updateRealtime']=function(){this[_0x604e('0x14')]=0x0;this[_0x604e('0x15')]=0x0;for(var _0x154ab2=0x0;_0x154ab2=0x0?this[_0x604e('0x19')]:0x0;var _0x34acec={'id':this['id'],'available':this[_0x604e('0x19')],'loggedIn':this[_0x604e('0x14')],'name':this['name'],'paused':this[_0x604e('0x15')],'waiting':this[_0x604e('0xe')]};var _0x3c7dd0=md5(JSON['stringify'](_0x34acec));if(this[_0x604e('0x1')]!==_0x3c7dd0){this[_0x604e('0x1')]=_0x3c7dd0;io['to'](util[_0x604e('0x1a')](_0x604e('0x1b'),_0x34acec[_0x604e('0x8')]))[_0x604e('0x1c')](_0x604e('0x1d'),_0x34acec);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e58f2a9..fc20bf1 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x1261,0x144));var _0x1126=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0x1261[_0x131e60];return _0x4bc497;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7c9a876..b08b5ed 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 _0x5712=['updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','waiting','stringify','sms:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x54858f,_0x45bd52){var _0x519825=function(_0x19df83){while(--_0x19df83){_0x54858f['push'](_0x54858f['shift']());}};_0x519825(++_0x45bd52);}(_0x5712,0x140));var _0x2571=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5712[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2571('0x0'));var md5=require(_0x2571('0x1'));var util=require(_0x2571('0x2'));var Redis=require(_0x2571('0x3'));var config=require(_0x2571('0x4'));config[_0x2571('0x5')]=_[_0x2571('0x6')](config[_0x2571('0x5')],{'host':_0x2571('0x7'),'port':0x18eb});var io=require(_0x2571('0x8'))(new Redis(config['redis']));function SmsQueue(_0x49d593){this['id']=_0x49d593['id']||0x0;this[_0x2571('0x9')]=_0x49d593['name']||'';this[_0x2571('0xa')]=_0x49d593[_0x2571('0xa')]||0xa;this[_0x2571('0xb')]=_0x49d593[_0x2571('0xb')]||_0x2571('0xc');this[_0x2571('0xd')]=_0x49d593['Agents'];this[_0x2571('0xe')]={};this['waiting']=0x0;this[_0x2571('0x1')]='';this[_0x2571('0xf')]();this[_0x2571('0x10')]();}SmsQueue[_0x2571('0x11')][_0x2571('0xf')]=function(){var _0x366f74=this[_0x2571('0xe')][_0x2571('0x12')];this['mapAgentsId']=_['map'](this[_0x2571('0xd')],'id');this[_0x2571('0xe')][_0x2571('0x12')]=_0x366f74;};SmsQueue[_0x2571('0x11')][_0x2571('0x10')]=function(){this[_0x2571('0x13')]=0x0;this[_0x2571('0x14')]=0x0;for(var _0x130ab1=0x0;_0x130ab1=0x0?this[_0x2571('0x17')]:0x0;var _0x576222={'id':this['id'],'available':this[_0x2571('0x17')],'loggedIn':this[_0x2571('0x13')],'name':this['name'],'paused':this[_0x2571('0x14')],'waiting':this[_0x2571('0x18')]};var _0x2647b7=md5(JSON[_0x2571('0x19')](_0x576222));if(this[_0x2571('0x1')]!==_0x2647b7){this['md5']=_0x2647b7;io['to'](util['format'](_0x2571('0x1a'),_0x576222[_0x2571('0x9')]))['emit']('sms_queue:save',_0x576222);}};module[_0x2571('0x1b')]=SmsQueue; \ No newline at end of file +var _0xd52d=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','sms:queue:%s','sms_queue:save','md5','util','../../../config/environment','redis'];(function(_0x57396e,_0x46d2fb){var _0x23b309=function(_0x548ea4){while(--_0x548ea4){_0x57396e['push'](_0x57396e['shift']());}};_0x23b309(++_0x46d2fb);}(_0xd52d,0x1c7));var _0xdd52=function(_0x580cef,_0x28b2d4){_0x580cef=_0x580cef-0x0;var _0x16b4ab=_0xd52d[_0x580cef];return _0x16b4ab;};'use strict';var _=require('lodash');var md5=require(_0xdd52('0x0'));var util=require(_0xdd52('0x1'));var Redis=require('ioredis');var config=require(_0xdd52('0x2'));config['redis']=_['defaults'](config[_0xdd52('0x3')],{'host':_0xdd52('0x4'),'port':0x18eb});var io=require(_0xdd52('0x5'))(new Redis(config[_0xdd52('0x3')]));function SmsQueue(_0x3b9337){this['id']=_0x3b9337['id']||0x0;this[_0xdd52('0x6')]=_0x3b9337[_0xdd52('0x6')]||'';this[_0xdd52('0x7')]=_0x3b9337['timeout']||0xa;this[_0xdd52('0x8')]=_0x3b9337[_0xdd52('0x8')]||_0xdd52('0x9');this[_0xdd52('0xa')]=_0x3b9337[_0xdd52('0xa')];this[_0xdd52('0xb')]={};this[_0xdd52('0xc')]=0x0;this[_0xdd52('0x0')]='';this[_0xdd52('0xd')]();this[_0xdd52('0xe')]();}SmsQueue[_0xdd52('0xf')][_0xdd52('0xd')]=function(){var _0x1cfc7f=this['mapAgentsId'][_0xdd52('0x10')];this[_0xdd52('0xb')]=_[_0xdd52('0x11')](this[_0xdd52('0xa')],'id');this[_0xdd52('0xb')][_0xdd52('0x10')]=_0x1cfc7f;};SmsQueue['prototype'][_0xdd52('0xe')]=function(){this[_0xdd52('0x12')]=0x0;this[_0xdd52('0x13')]=0x0;for(var _0x55b823=0x0;_0x55b823=0x0?this[_0xdd52('0x17')]:0x0;var _0x45062e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdd52('0x12')],'name':this[_0xdd52('0x6')],'paused':this[_0xdd52('0x13')],'waiting':this[_0xdd52('0xc')]};var _0x5de47a=md5(JSON[_0xdd52('0x18')](_0x45062e));if(this['md5']!==_0x5de47a){this[_0xdd52('0x0')]=_0x5de47a;io['to'](util['format'](_0xdd52('0x19'),_0x45062e[_0xdd52('0x6')]))['emit'](_0xdd52('0x1a'),_0x45062e);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 721ddd6..192cd89 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 _0x077a=['socket.io-emitter','redis','name','timeout','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','whatsappPause','paused','available','waiting','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','localhost'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x077a,0x6e));var _0xa077=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x077a[_0x4ac48d];return _0x7537af;};'use strict';var _=require(_0xa077('0x0'));var md5=require(_0xa077('0x1'));var util=require(_0xa077('0x2'));var Redis=require('ioredis');var config=require(_0xa077('0x3'));config['redis']=_[_0xa077('0x4')](config['redis'],{'host':_0xa077('0x5'),'port':0x18eb});var io=require(_0xa077('0x6'))(new Redis(config[_0xa077('0x7')]));function WhatsappQueue(_0x49e637){this['id']=_0x49e637['id']||0x0;this['name']=_0x49e637[_0xa077('0x8')]||'';this[_0xa077('0x9')]=_0x49e637['timeout']||0xa;this['strategy']=_0x49e637['strategy']||_0xa077('0xa');this[_0xa077('0xb')]=_0x49e637[_0xa077('0xb')];this[_0xa077('0xc')]={};this['waiting']=0x0;this[_0xa077('0x1')]='';this[_0xa077('0xd')]();this['updateRealtime']();}WhatsappQueue[_0xa077('0xe')][_0xa077('0xd')]=function(){var _0x43472a=this['mapAgentsId'][_0xa077('0xf')];this['mapAgentsId']=_[_0xa077('0x10')](this[_0xa077('0xb')],'id');this['mapAgentsId'][_0xa077('0xf')]=_0x43472a;};WhatsappQueue[_0xa077('0xe')][_0xa077('0x11')]=function(){this[_0xa077('0x12')]=0x0;this['paused']=0x0;for(var _0xda4c4c=0x0;_0xda4c4c=0x0?this[_0xa077('0x17')]:0x0;var _0x3ecddb={'id':this['id'],'available':this[_0xa077('0x17')],'loggedIn':this[_0xa077('0x12')],'name':this[_0xa077('0x8')],'paused':this[_0xa077('0x16')],'waiting':this[_0xa077('0x18')]};var _0x14a4e7=md5(JSON['stringify'](_0x3ecddb));if(this[_0xa077('0x1')]!==_0x14a4e7){this[_0xa077('0x1')]=_0x14a4e7;io['to'](util[_0xa077('0x19')](_0xa077('0x1a'),_0x3ecddb[_0xa077('0x8')]))['emit'](_0xa077('0x1b'),_0x3ecddb);}};module[_0xa077('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x2eaa=['waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','../../../config/environment','redis','localhost','name','timeout','beepall','Agents','mapAgentsId'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2eaa,0x116));var _0xa2ea=function(_0x370586,_0x2e4413){_0x370586=_0x370586-0x0;var _0x439a52=_0x2eaa[_0x370586];return _0x439a52;};'use strict';var _=require(_0xa2ea('0x0'));var md5=require(_0xa2ea('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa2ea('0x2'));config[_0xa2ea('0x3')]=_['defaults'](config[_0xa2ea('0x3')],{'host':_0xa2ea('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x203919){this['id']=_0x203919['id']||0x0;this[_0xa2ea('0x5')]=_0x203919['name']||'';this[_0xa2ea('0x6')]=_0x203919[_0xa2ea('0x6')]||0xa;this['strategy']=_0x203919['strategy']||_0xa2ea('0x7');this[_0xa2ea('0x8')]=_0x203919['Agents'];this[_0xa2ea('0x9')]={};this[_0xa2ea('0xa')]=0x0;this['md5']='';this[_0xa2ea('0xb')]();this[_0xa2ea('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x46f77c=this['mapAgentsId']['_rr'];this[_0xa2ea('0x9')]=_[_0xa2ea('0xd')](this[_0xa2ea('0x8')],'id');this[_0xa2ea('0x9')][_0xa2ea('0xe')]=_0x46f77c;};WhatsappQueue[_0xa2ea('0xf')][_0xa2ea('0xc')]=function(){this[_0xa2ea('0x10')]=0x0;this[_0xa2ea('0x11')]=0x0;for(var _0x1caf07=0x0;_0x1caf07=0x0?this[_0xa2ea('0x13')]:0x0;var _0x2a78df={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa2ea('0x10')],'name':this['name'],'paused':this[_0xa2ea('0x11')],'waiting':this[_0xa2ea('0xa')]};var _0x103a86=md5(JSON[_0xa2ea('0x14')](_0x2a78df));if(this['md5']!==_0x103a86){this[_0xa2ea('0x1')]=_0x103a86;io['to'](util['format'](_0xa2ea('0x15'),_0x2a78df[_0xa2ea('0x5')]))[_0xa2ea('0x16')](_0xa2ea('0x17'),_0x2a78df);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 189563c..e93d45b 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3c9bb8,_0x3775d7){var _0x5be009=function(_0x22ad3c){while(--_0x22ad3c){_0x3c9bb8['push'](_0x3c9bb8['shift']());}};_0x5be009(++_0x3775d7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xb10b[_0x3e2fcf];return _0x497db7;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _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(_0x4a2e40,_0x3c0a98){var _0x4875a7=function(_0x244fa8){while(--_0x244fa8){_0x4a2e40['push'](_0x4a2e40['shift']());}};_0x4875a7(++_0x3c0a98);}(_0xb10b,0x12a));var _0xbb10=function(_0x47e92b,_0x29e3b5){_0x47e92b=_0x47e92b-0x0;var _0x2da694=_0xb10b[_0x47e92b];return _0x2da694;};'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 7edf8d6..4ba32c2 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 _0x61bc=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x3c2152,_0x13b0bb){var _0x4eefcf=function(_0xd696ae){while(--_0xd696ae){_0x3c2152['push'](_0x3c2152['shift']());}};_0x4eefcf(++_0x13b0bb);}(_0x61bc,0x1f4));var _0xc61b=function(_0x54cdbe,_0x8bd1e){_0x54cdbe=_0x54cdbe-0x0;var _0x11e17e=_0x61bc[_0x54cdbe];return _0x11e17e;};'use strict';var client=require(_0xc61b('0x0'));exports[_0xc61b('0x1')]=function(_0x36aa0a,_0x63013a){return client[_0xc61b('0x2')](_0xc61b('0x3'),{'body':_0x63013a,'options':{'where':{'id':_0x36aa0a}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x2ebc99,_0xdc167a){return client['Request'](_0xc61b('0x4'),{'body':_0xdc167a,'options':{'where':{'id':_0x2ebc99}},'log':_0xc61b('0x5')});}; \ No newline at end of file +var _0x8a31=['../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request'];(function(_0x2851c8,_0x670458){var _0x514e70=function(_0x395da0){while(--_0x395da0){_0x2851c8['push'](_0x2851c8['shift']());}};_0x514e70(++_0x670458);}(_0x8a31,0xba));var _0x18a3=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x8a31[_0x4cbf20];return _0x582ae4;};'use strict';var client=require(_0x18a3('0x0'));exports[_0x18a3('0x1')]=function(_0x1093bb,_0x16a158){return client['Request'](_0x18a3('0x2'),{'body':_0x16a158,'options':{'where':{'id':_0x1093bb}},'log':_0x18a3('0x3')});};exports[_0x18a3('0x4')]=function(_0x4c1c81,_0x5c2f75){return client[_0x18a3('0x5')]('AddTagsToChatInteraction',{'body':_0x5c2f75,'options':{'where':{'id':_0x4c1c81}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 26901b6..92dd33b 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 _0x7b3a=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x3b1b2a,_0x4db33e){var _0x355ea9=function(_0x35396c){while(--_0x35396c){_0x3b1b2a['push'](_0x3b1b2a['shift']());}};_0x355ea9(++_0x4db33e);}(_0x7b3a,0x14f));var _0xa7b3=function(_0x4bc9dc,_0x39166e){_0x4bc9dc=_0x4bc9dc-0x0;var _0x52ada7=_0x7b3a[_0x4bc9dc];return _0x52ada7;};'use strict';var client=require(_0xa7b3('0x0'));exports[_0xa7b3('0x1')]=function(_0x50757c){return client['Request'](_0xa7b3('0x2'),{'body':_0x50757c,'log':_0xa7b3('0x3')});}; \ No newline at end of file +var _0xb962=['createChatMessage','../client','create','Request'];(function(_0x3960d1,_0xf16b39){var _0x3c9747=function(_0x23e933){while(--_0x23e933){_0x3960d1['push'](_0x3960d1['shift']());}};_0x3c9747(++_0xf16b39);}(_0xb962,0x69));var _0x2b96=function(_0x1f70cc,_0x31bb04){_0x1f70cc=_0x1f70cc-0x0;var _0x15fda0=_0xb962[_0x1f70cc];return _0x15fda0;};'use strict';var client=require(_0x2b96('0x0'));exports[_0x2b96('0x1')]=function(_0x1b2d28){return client[_0x2b96('0x2')]('CreateChatMessage',{'body':_0x1b2d28,'log':_0x2b96('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 47b560b..72e31b3 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 _0xe9e7=['online','../client','getChatQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x588b84,_0x5ffea7){var _0x5d18f0=function(_0x598682){while(--_0x598682){_0x588b84['push'](_0x588b84['shift']());}};_0x5d18f0(++_0x5ffea7);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x21d0b6,_0x11467f){_0x21d0b6=_0x21d0b6-0x0;var _0x4bbe0b=_0xe9e7[_0x21d0b6];return _0x4bbe0b;};'use strict';var client=require(_0x7e9e('0x0'));exports[_0x7e9e('0x1')]=function(){return function(){return client[_0x7e9e('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x7e9e('0x3'),_0x7e9e('0x4'),_0x7e9e('0x5')],'include':[{'model':_0x7e9e('0x6'),'as':_0x7e9e('0x7'),'attributes':['id',_0x7e9e('0x3'),_0x7e9e('0x8'),'chatPause']}]},'log':_0x7e9e('0x1')});};}; \ No newline at end of file +var _0xff3c=['chatPause','../client','getChatQueues','GetChatQueue','name','User','Agents','online'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff3c,0x179));var _0xcff3=function(_0x4c68bd,_0x187912){_0x4c68bd=_0x4c68bd-0x0;var _0x2af91c=_0xff3c[_0x4c68bd];return _0x2af91c;};'use strict';var client=require(_0xcff3('0x0'));exports[_0xcff3('0x1')]=function(){return function(){return client['Request'](_0xcff3('0x2'),{'options':{'raw':![],'attributes':['id',_0xcff3('0x3'),'timeout','strategy'],'include':[{'model':_0xcff3('0x4'),'as':_0xcff3('0x5'),'attributes':['id',_0xcff3('0x3'),_0xcff3('0x6'),_0xcff3('0x7')]}]},'log':_0xcff3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f5e3108..4e23801 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 _0x5b02=['create','Request','update','UpdateChatQueueReport','DESC','../client'];(function(_0x2e7054,_0x4d1543){var _0x305c25=function(_0x2546f0){while(--_0x2546f0){_0x2e7054['push'](_0x2e7054['shift']());}};_0x305c25(++_0x4d1543);}(_0x5b02,0xe9));var _0x25b0=function(_0xd82dc5,_0x4dfc8f){_0xd82dc5=_0xd82dc5-0x0;var _0x1da5ef=_0x5b02[_0xd82dc5];return _0x1da5ef;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateChatQueueReport',{'body':_0x428458,'log':'CreateChatQueueReport'});};exports[_0x25b0('0x3')]=function(_0x53493e,_0x3e1d20){return client[_0x25b0('0x2')](_0x25b0('0x4'),{'body':_0x3e1d20,'options':{'where':{'uniqueid':_0x53493e},'order':[['id',_0x25b0('0x5')]],'limit':0x1},'log':_0x25b0('0x4')});}; \ No newline at end of file +var _0xac65=['update','Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x1137a3,_0x5a1d69){var _0xd18ed1=function(_0x4d42d8){while(--_0x4d42d8){_0x1137a3['push'](_0x1137a3['shift']());}};_0xd18ed1(++_0x5a1d69);}(_0xac65,0x11d));var _0x5ac6=function(_0x2e73e3,_0x209c79){_0x2e73e3=_0x2e73e3-0x0;var _0x35ca15=_0xac65[_0x2e73e3];return _0x35ca15;};'use strict';var client=require(_0x5ac6('0x0'));exports[_0x5ac6('0x1')]=function(_0x11c244){return client['Request'](_0x5ac6('0x2'),{'body':_0x11c244,'log':_0x5ac6('0x2')});};exports[_0x5ac6('0x3')]=function(_0x4a8183,_0x16800d){return client[_0x5ac6('0x4')](_0x5ac6('0x5'),{'body':_0x16800d,'options':{'where':{'uniqueid':_0x4a8183},'order':[['id','DESC']],'limit':0x1},'log':_0x5ac6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7c2c265..1377101 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xaffe41,_0x5f215e){var _0x5c3ade=function(_0x23d611){while(--_0x23d611){_0xaffe41['push'](_0xaffe41['shift']());}};_0x5c3ade(++_0x5f215e);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0x7a54,0x106));var _0x47a5=function(_0x53dbb0,_0x411e6f){_0x53dbb0=_0x53dbb0-0x0;var _0x44c872=_0x7a54[_0x53dbb0];return _0x44c872;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f18ef58..40ee954 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 _0x752d=['createFaxMessage','create','Request'];(function(_0x9c0817,_0x50058d){var _0x396086=function(_0x45e7a6){while(--_0x45e7a6){_0x9c0817['push'](_0x9c0817['shift']());}};_0x396086(++_0x50058d);}(_0x752d,0x184));var _0xd752=function(_0x4788ca,_0x5cda70){_0x4788ca=_0x4788ca-0x0;var _0x28a6f5=_0x752d[_0x4788ca];return _0x28a6f5;};'use strict';var client=require('../client');exports[_0xd752('0x0')]=function(_0x47341a){return client[_0xd752('0x1')]('CreateFaxMessage',{'body':_0x47341a,'log':_0xd752('0x2')});}; \ No newline at end of file +var _0xd3dd=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3dd,0xb5));var _0xdd3d=function(_0x5a189b,_0x3b7402){_0x5a189b=_0x5a189b-0x0;var _0x2cb890=_0xd3dd[_0x5a189b];return _0x2cb890;};'use strict';var client=require(_0xdd3d('0x0'));exports[_0xdd3d('0x1')]=function(_0x439cdc){return client[_0xdd3d('0x2')](_0xdd3d('0x3'),{'body':_0x439cdc,'log':_0xdd3d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 6cf1d82..b1c6e0a 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 _0xb793=['User','online','faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','strategy'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xb793,0x67));var _0x3b79=function(_0x245471,_0x138b31){_0x245471=_0x245471-0x0;var _0x560ae1=_0xb793[_0x245471];return _0x560ae1;};'use strict';var client=require(_0x3b79('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x3b79('0x1')](_0x3b79('0x2'),{'options':{'raw':![],'attributes':['id',_0x3b79('0x3'),'timeout',_0x3b79('0x4')],'include':[{'model':_0x3b79('0x5'),'as':'Agents','attributes':['id','name',_0x3b79('0x6'),_0x3b79('0x7')]}]},'log':_0x3b79('0x8')});};}; \ No newline at end of file +var _0xd234=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','name'];(function(_0xdef5e2,_0x2a1e21){var _0x3efa81=function(_0x2789f6){while(--_0x2789f6){_0xdef5e2['push'](_0xdef5e2['shift']());}};_0x3efa81(++_0x2a1e21);}(_0xd234,0xd4));var _0x4d23=function(_0x59af6c,_0x3bd2de){_0x59af6c=_0x59af6c-0x0;var _0x5570de=_0xd234[_0x59af6c];return _0x5570de;};'use strict';var client=require(_0x4d23('0x0'));exports[_0x4d23('0x1')]=function(){return function(){return client[_0x4d23('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4d23('0x3'),'timeout',_0x4d23('0x4')],'include':[{'model':_0x4d23('0x5'),'as':_0x4d23('0x6'),'attributes':['id',_0x4d23('0x3'),_0x4d23('0x7'),_0x4d23('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d364e87..3181ccb 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 _0xf4f3=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0xf4f3,0x94));var _0x3f4f=function(_0x39e7bd,_0x2867d7){_0x39e7bd=_0x39e7bd-0x0;var _0x195fca=_0xf4f3[_0x39e7bd];return _0x195fca;};'use strict';var client=require(_0x3f4f('0x0'));exports['create']=function(_0x312604){return client[_0x3f4f('0x1')](_0x3f4f('0x2'),{'body':_0x312604,'log':_0x3f4f('0x2')});};exports[_0x3f4f('0x3')]=function(_0x438beb,_0xcfe54b){return client['Request'](_0x3f4f('0x4'),{'body':_0xcfe54b,'options':{'where':{'uniqueid':_0x438beb},'order':[['id',_0x3f4f('0x5')]],'limit':0x1},'log':_0x3f4f('0x4')});}; \ No newline at end of file +var _0x2c0a=['UpdateFaxQueueReport','DESC','Request','CreateFaxQueueReport','update'];(function(_0x26eb88,_0x5efcf1){var _0x5a1b15=function(_0x1871ce){while(--_0x1871ce){_0x26eb88['push'](_0x26eb88['shift']());}};_0x5a1b15(++_0x5efcf1);}(_0x2c0a,0x1f1));var _0xa2c0=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x2c0a[_0x10bcc4];return _0x2da988;};'use strict';var client=require('../client');exports['create']=function(_0x14f3a5){return client[_0xa2c0('0x0')](_0xa2c0('0x1'),{'body':_0x14f3a5,'log':_0xa2c0('0x1')});};exports[_0xa2c0('0x2')]=function(_0x166567,_0x951bb8){return client['Request'](_0xa2c0('0x3'),{'body':_0x951bb8,'options':{'where':{'uniqueid':_0x166567},'order':[['id',_0xa2c0('0x4')]],'limit':0x1},'log':_0xa2c0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2228b58..9c571d1 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 _0xe901=['../client','getIntervals','GetInterval','name','Interval'];(function(_0x1a2381,_0x2de9b7){var _0x3f30d0=function(_0x17e7ab){while(--_0x17e7ab){_0x1a2381['push'](_0x1a2381['shift']());}};_0x3f30d0(++_0x2de9b7);}(_0xe901,0x1ea));var _0x1e90=function(_0x552352,_0x51e3b0){_0x552352=_0x552352-0x0;var _0x1e0d71=_0xe901[_0x552352];return _0x1e0d71;};'use strict';var client=require(_0x1e90('0x0'));exports[_0x1e90('0x1')]=function(){return function(){return client['Request'](_0x1e90('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1e90('0x3')],'include':[{'model':_0x1e90('0x4'),'as':'Intervals','attributes':['id',_0x1e90('0x3'),'interval']}]},'log':_0x1e90('0x1')});};}; \ No newline at end of file +var _0x0e69=['getIntervals','Request','Intervals','name','../client'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0e69,0x10d));var _0x90e6=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x0e69[_0xbb091];return _0x467a04;};'use strict';var client=require(_0x90e6('0x0'));exports[_0x90e6('0x1')]=function(){return function(){return client[_0x90e6('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x90e6('0x3'),'attributes':['id',_0x90e6('0x4'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index dec7f43..941a68a 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 _0xb016=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x35af53,_0x5966b1){var _0x6bbbce=function(_0x3a79c0){while(--_0x3a79c0){_0x35af53['push'](_0x35af53['shift']());}};_0x6bbbce(++_0x5966b1);}(_0xb016,0x159));var _0x6b01=function(_0x3db7b0,_0x21af0c){_0x3db7b0=_0x3db7b0-0x0;var _0x2a1c85=_0xb016[_0x3db7b0];return _0x2a1c85;};'use strict';var client=require(_0x6b01('0x0'));exports[_0x6b01('0x1')]=function(_0x513ed6,_0x57ecae){return client[_0x6b01('0x2')]('UpdateMailInteraction',{'body':_0x57ecae,'options':{'where':{'id':_0x513ed6}},'log':_0x6b01('0x3')});};exports[_0x6b01('0x4')]=function(_0x161b59,_0x3b9de1){return client['Request'](_0x6b01('0x5'),{'body':_0x3b9de1,'options':{'where':{'id':_0x161b59}},'log':_0x6b01('0x6')});}; \ No newline at end of file +var _0xe2cf=['addTags','Request','AddTagsToMailInteraction','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x31aac8,_0x1ac0e3){_0x31aac8=_0x31aac8-0x0;var _0x55448d=_0xe2cf[_0x31aac8];return _0x55448d;};'use strict';var client=require('../client');exports[_0xfe2c('0x0')]=function(_0x546786,_0x11c3a4){return client['Request'](_0xfe2c('0x1'),{'body':_0x11c3a4,'options':{'where':{'id':_0x546786}},'log':_0xfe2c('0x2')});};exports[_0xfe2c('0x3')]=function(_0x11b6b8,_0x494978){return client[_0xfe2c('0x4')](_0xfe2c('0x5'),{'body':_0x494978,'options':{'where':{'id':_0x11b6b8}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 810764a..ec8244c 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 _0x8cb1=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x23c343,_0x3b4024){var _0x4eb82c=function(_0x225ac7){while(--_0x225ac7){_0x23c343['push'](_0x23c343['shift']());}};_0x4eb82c(++_0x3b4024);}(_0x8cb1,0x12c));var _0x18cb=function(_0x395e74,_0x33c903){_0x395e74=_0x395e74-0x0;var _0x3a9dda=_0x8cb1[_0x395e74];return _0x3a9dda;};'use strict';var client=require(_0x18cb('0x0'));exports[_0x18cb('0x1')]=function(_0x9b1ca1){return client[_0x18cb('0x2')](_0x18cb('0x3'),{'body':_0x9b1ca1,'log':_0x18cb('0x4')});}; \ No newline at end of file +var _0x1e37=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x1e37,0x8c));var _0x71e3=function(_0x33f849,_0x5bee3a){_0x33f849=_0x33f849-0x0;var _0x215c98=_0x1e37[_0x33f849];return _0x215c98;};'use strict';var client=require('../client');exports[_0x71e3('0x0')]=function(_0x4ff4e2){return client[_0x71e3('0x1')](_0x71e3('0x2'),{'body':_0x4ff4e2,'log':_0x71e3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cbf9999..61ab0f7 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 _0xfd19=['strategy','Agents','name','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout'];(function(_0x172540,_0x135a28){var _0x5c6632=function(_0x43b9bb){while(--_0x43b9bb){_0x172540['push'](_0x172540['shift']());}};_0x5c6632(++_0x135a28);}(_0xfd19,0xaf));var _0x9fd1=function(_0x1dae02,_0x1a1ec3){_0x1dae02=_0x1dae02-0x0;var _0x6e4126=_0xfd19[_0x1dae02];return _0x6e4126;};'use strict';var client=require(_0x9fd1('0x0'));exports[_0x9fd1('0x1')]=function(){return function(){return client[_0x9fd1('0x2')](_0x9fd1('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9fd1('0x4'),_0x9fd1('0x5')],'include':[{'model':'User','as':_0x9fd1('0x6'),'attributes':['id',_0x9fd1('0x7'),_0x9fd1('0x8'),_0x9fd1('0x9')]}]},'log':_0x9fd1('0x1')});};}; \ No newline at end of file +var _0x8f4f=['name','online','getMailQueues','Request','timeout','strategy','User','Agents'];(function(_0x484e47,_0x155a54){var _0x5c6ea5=function(_0x312683){while(--_0x312683){_0x484e47['push'](_0x484e47['shift']());}};_0x5c6ea5(++_0x155a54);}(_0x8f4f,0xba));var _0xf8f4=function(_0x31299c,_0x244f2c){_0x31299c=_0x31299c-0x0;var _0x2a1f6d=_0x8f4f[_0x31299c];return _0x2a1f6d;};'use strict';var client=require('../client');exports[_0xf8f4('0x0')]=function(){return function(){return client[_0xf8f4('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xf8f4('0x2'),_0xf8f4('0x3')],'include':[{'model':_0xf8f4('0x4'),'as':_0xf8f4('0x5'),'attributes':['id',_0xf8f4('0x6'),_0xf8f4('0x7'),'mailPause']}]},'log':_0xf8f4('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d7d4c55..063704d 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 _0xbf7b=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xbf7b,0x19c));var _0xbbf7=function(_0x14be06,_0x102586){_0x14be06=_0x14be06-0x0;var _0x258ae8=_0xbf7b[_0x14be06];return _0x258ae8;};'use strict';var client=require(_0xbbf7('0x0'));exports['create']=function(_0x2ce163){return client[_0xbbf7('0x1')](_0xbbf7('0x2'),{'body':_0x2ce163,'log':_0xbbf7('0x2')});};exports['update']=function(_0x1c34fa,_0x4bfbcc){return client[_0xbbf7('0x1')](_0xbbf7('0x3'),{'body':_0x4bfbcc,'options':{'where':{'uniqueid':_0x1c34fa},'order':[['id',_0xbbf7('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xb451=['CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport','../client','create'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb451,0xbb));var _0x1b45=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xb451[_0x125ff8];return _0x2d9ef;};'use strict';var client=require(_0x1b45('0x0'));exports[_0x1b45('0x1')]=function(_0x17c7af){return client['Request']('CreateMailQueueReport',{'body':_0x17c7af,'log':_0x1b45('0x2')});};exports[_0x1b45('0x3')]=function(_0x5cd825,_0x27e29e){return client[_0x1b45('0x4')]('UpdateMailQueueReport',{'body':_0x27e29e,'options':{'where':{'uniqueid':_0x5cd825},'order':[['id',_0x1b45('0x5')]],'limit':0x1},'log':_0x1b45('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6725806..1010993 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 _0xb6ab=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x5a17dd,_0x371fcc){var _0x354e54=function(_0x4bad56){while(--_0x4bad56){_0x5a17dd['push'](_0x5a17dd['shift']());}};_0x354e54(++_0x371fcc);}(_0xb6ab,0x10d));var _0xbb6a=function(_0x3c4567,_0x50cdf4){_0x3c4567=_0x3c4567-0x0;var _0x2e2881=_0xb6ab[_0x3c4567];return _0x2e2881;};'use strict';var client=require('../client');exports[_0xbb6a('0x0')]=function(_0x2aa712,_0xa4a283){return client[_0xbb6a('0x1')](_0xbb6a('0x2'),{'body':_0xa4a283,'options':{'where':{'id':_0x2aa712}},'log':'updateOpenchannelInteraction'});};exports[_0xbb6a('0x3')]=function(_0x2dbe85,_0x3ae683){return client['Request'](_0xbb6a('0x4'),{'body':_0x3ae683,'options':{'where':{'id':_0x2dbe85}},'log':_0xbb6a('0x5')});}; \ No newline at end of file +var _0x65ae=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x65ae,0x135));var _0xe65a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x65ae[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xe65a('0x0'));exports[_0xe65a('0x1')]=function(_0x50593a,_0x1c15c4){return client[_0xe65a('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1c15c4,'options':{'where':{'id':_0x50593a}},'log':_0xe65a('0x3')});};exports['addTags']=function(_0xc4ca5e,_0x4eed27){return client[_0xe65a('0x2')](_0xe65a('0x4'),{'body':_0x4eed27,'options':{'where':{'id':_0xc4ca5e}},'log':_0xe65a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7bebc08..c60e853 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 _0xb83b=['create','Request','../client'];(function(_0x4bd923,_0x541ed6){var _0xc785=function(_0x57cc10){while(--_0x57cc10){_0x4bd923['push'](_0x4bd923['shift']());}};_0xc785(++_0x541ed6);}(_0xb83b,0xec));var _0xbb83=function(_0x449bf0,_0x420d9d){_0x449bf0=_0x449bf0-0x0;var _0x5b4a89=_0xb83b[_0x449bf0];return _0x5b4a89;};'use strict';var client=require(_0xbb83('0x0'));exports[_0xbb83('0x1')]=function(_0x1893d5){return client[_0xbb83('0x2')]('CreateOpenchannelMessage',{'body':_0x1893d5,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x70c8=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x18c659,_0x1c0b15){var _0x6329ec=function(_0x28180d){while(--_0x28180d){_0x18c659['push'](_0x18c659['shift']());}};_0x6329ec(++_0x1c0b15);}(_0x70c8,0x131));var _0x870c=function(_0x400356,_0x419ab7){_0x400356=_0x400356-0x0;var _0x4ec5a6=_0x70c8[_0x400356];return _0x4ec5a6;};'use strict';var client=require(_0x870c('0x0'));exports[_0x870c('0x1')]=function(_0x11c026){return client[_0x870c('0x2')](_0x870c('0x3'),{'body':_0x11c026,'log':_0x870c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ec39d4c..e30de6f 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 _0x3a66=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','online','openchannelPause'];(function(_0x5f7e44,_0x440185){var _0x305de7=function(_0x2d6584){while(--_0x2d6584){_0x5f7e44['push'](_0x5f7e44['shift']());}};_0x305de7(++_0x440185);}(_0x3a66,0xa0));var _0x63a6=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x3a66[_0x3e32a8];return _0x2997b0;};'use strict';var client=require(_0x63a6('0x0'));exports[_0x63a6('0x1')]=function(){return function(){return client[_0x63a6('0x2')](_0x63a6('0x3'),{'options':{'raw':![],'attributes':['id',_0x63a6('0x4'),_0x63a6('0x5'),_0x63a6('0x6')],'include':[{'model':_0x63a6('0x7'),'as':'Agents','attributes':['id',_0x63a6('0x4'),_0x63a6('0x8'),_0x63a6('0x9')]}]},'log':_0x63a6('0x1')});};}; \ No newline at end of file +var _0x7ca3=['name','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','User','Agents'];(function(_0x44f9c0,_0x391085){var _0x241aa7=function(_0x369f23){while(--_0x369f23){_0x44f9c0['push'](_0x44f9c0['shift']());}};_0x241aa7(++_0x391085);}(_0x7ca3,0x17c));var _0x37ca=function(_0x4ab4a2,_0x41b416){_0x4ab4a2=_0x4ab4a2-0x0;var _0x57f331=_0x7ca3[_0x4ab4a2];return _0x57f331;};'use strict';var client=require(_0x37ca('0x0'));exports[_0x37ca('0x1')]=function(){return function(){return client[_0x37ca('0x2')](_0x37ca('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x37ca('0x4')],'include':[{'model':_0x37ca('0x5'),'as':_0x37ca('0x6'),'attributes':['id',_0x37ca('0x7'),'online',_0x37ca('0x8')]}]},'log':_0x37ca('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 11d68c2..5ce1bea 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 _0x6ccc=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ccc,0x197));var _0xc6cc=function(_0x390e6c,_0x4d7d42){_0x390e6c=_0x390e6c-0x0;var _0x596b05=_0x6ccc[_0x390e6c];return _0x596b05;};'use strict';var client=require(_0xc6cc('0x0'));exports[_0xc6cc('0x1')]=function(_0x4b82fc){return client[_0xc6cc('0x2')](_0xc6cc('0x3'),{'body':_0x4b82fc,'log':_0xc6cc('0x3')});};exports[_0xc6cc('0x4')]=function(_0x457d69,_0x3b9185){return client[_0xc6cc('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x3b9185,'options':{'where':{'uniqueid':_0x457d69},'order':[['id',_0xc6cc('0x5')]],'limit':0x1},'log':_0xc6cc('0x6')});}; \ No newline at end of file +var _0xaf5c=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','create'];(function(_0x3e9608,_0x433efc){var _0x3bdc7f=function(_0x3c6bce){while(--_0x3c6bce){_0x3e9608['push'](_0x3e9608['shift']());}};_0x3bdc7f(++_0x433efc);}(_0xaf5c,0x161));var _0xcaf5=function(_0x536173,_0x2ad68d){_0x536173=_0x536173-0x0;var _0x38828b=_0xaf5c[_0x536173];return _0x38828b;};'use strict';var client=require('../client');exports[_0xcaf5('0x0')]=function(_0x7e5ff4){return client[_0xcaf5('0x1')](_0xcaf5('0x2'),{'body':_0x7e5ff4,'log':'CreateOpenchannelQueueReport'});};exports[_0xcaf5('0x3')]=function(_0x457519,_0x549b40){return client[_0xcaf5('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x549b40,'options':{'where':{'uniqueid':_0x457519},'order':[['id',_0xcaf5('0x4')]],'limit':0x1},'log':_0xcaf5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7daa0ff..608e1f9 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 _0xe79f=['../client','Request'];(function(_0x455df7,_0x43e85e){var _0x53cb8d=function(_0x33fca2){while(--_0x33fca2){_0x455df7['push'](_0x455df7['shift']());}};_0x53cb8d(++_0x43e85e);}(_0xe79f,0x13a));var _0xfe79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe79f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xfe79('0x0'));exports['update']=function(_0x259811,_0x5b22f7){return client[_0xfe79('0x1')]('UpdateSmsInteraction',{'body':_0x5b22f7,'options':{'where':{'id':_0x259811}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x243f35,_0x3cfd2b){return client[_0xfe79('0x1')]('AddTagsToSmsInteraction',{'body':_0x3cfd2b,'options':{'where':{'id':_0x243f35}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x6a88=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6a88,0xa9));var _0x86a8=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x6a88[_0x28fbe3];return _0x45db6a;};'use strict';var client=require(_0x86a8('0x0'));exports[_0x86a8('0x1')]=function(_0x4346ff,_0x3c2a38){return client[_0x86a8('0x2')](_0x86a8('0x3'),{'body':_0x3c2a38,'options':{'where':{'id':_0x4346ff}},'log':_0x86a8('0x4')});};exports['addTags']=function(_0x21afeb,_0x5aa681){return client['Request'](_0x86a8('0x5'),{'body':_0x5aa681,'options':{'where':{'id':_0x21afeb}},'log':_0x86a8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f4ef5c2..38d793e 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 _0x2fa0=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x2fa0,0x10b));var _0x02fa=function(_0x3c43b9,_0x5a1b27){_0x3c43b9=_0x3c43b9-0x0;var _0x9efa8a=_0x2fa0[_0x3c43b9];return _0x9efa8a;};'use strict';var client=require(_0x02fa('0x0'));exports[_0x02fa('0x1')]=function(_0x6bf941){return client[_0x02fa('0x2')](_0x02fa('0x3'),{'body':_0x6bf941,'log':_0x02fa('0x4')});}; \ No newline at end of file +var _0x2b87=['create','CreateSmsMessage'];(function(_0x3fe2be,_0x24cfba){var _0x16b3ca=function(_0x266d1e){while(--_0x266d1e){_0x3fe2be['push'](_0x3fe2be['shift']());}};_0x16b3ca(++_0x24cfba);}(_0x2b87,0x1c4));var _0x72b8=function(_0x3b3b7b,_0x40724c){_0x3b3b7b=_0x3b3b7b-0x0;var _0x5b492d=_0x2b87[_0x3b3b7b];return _0x5b492d;};'use strict';var client=require('../client');exports[_0x72b8('0x0')]=function(_0x156f16){return client['Request'](_0x72b8('0x1'),{'body':_0x156f16,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index da845c5..8ec3877 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x4f8097,_0x58cd34){var _0x36148f=function(_0x1e82c9){while(--_0x1e82c9){_0x4f8097['push'](_0x4f8097['shift']());}};_0x36148f(++_0x58cd34);}(_0xe706,0xa3));var _0x6e70=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0xe706[_0x2f16e5];return _0x5d082a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x28af1c,_0x1273cb){var _0x53ce8f=function(_0x4b538b){while(--_0x4b538b){_0x28af1c['push'](_0x28af1c['shift']());}};_0x53ce8f(++_0x1273cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c8c8417..2a55721 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x431cf2,_0x1d4456){var _0x10c9a7=function(_0x574efe){while(--_0x574efe){_0x431cf2['push'](_0x431cf2['shift']());}};_0x10c9a7(++_0x1d4456);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2cd96d,_0x3c3192){var _0x3a65eb=function(_0x413eda){while(--_0x413eda){_0x2cd96d['push'](_0x2cd96d['shift']());}};_0x3a65eb(++_0x3c3192);}(_0x55ca,0x126));var _0xa55c=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x55ca[_0x341e0f];return _0x59555a;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 37de962..726846b 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(_0x4959ea,_0x8744de){var _0x2cc2f3=function(_0x9fd5bc){while(--_0x9fd5bc){_0x4959ea['push'](_0x4959ea['shift']());}};_0x2cc2f3(++_0x8744de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x380f4d,_0xeb0b1b){var _0x3d8021=function(_0x3fc2df){while(--_0x3fc2df){_0x380f4d['push'](_0x380f4d['shift']());}};_0x3d8021(++_0xeb0b1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 9c83493..80b03a5 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 _0x6691=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x2edbce,_0x292cdc){var _0x44b6f1=function(_0x3718e0){while(--_0x3718e0){_0x2edbce['push'](_0x2edbce['shift']());}};_0x44b6f1(++_0x292cdc);}(_0x6691,0x12d));var _0x1669=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6691[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x1669('0x0'));exports[_0x1669('0x1')]=function(_0xc9ad5a,_0x1cc116){return client[_0x1669('0x2')](_0x1669('0x3'),{'body':_0x1cc116,'options':{'where':{'id':_0xc9ad5a}},'log':_0x1669('0x4')});};exports[_0x1669('0x5')]=function(_0x19a3f5,_0x2ad807){return client['Request'](_0x1669('0x6'),{'body':_0x2ad807,'options':{'where':{'id':_0x19a3f5}},'log':_0x1669('0x7')});}; \ No newline at end of file +var _0xa93e=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','UpdateWhatsappInteraction'];(function(_0x3cbb6,_0x276033){var _0x166d5f=function(_0x2319e3){while(--_0x2319e3){_0x3cbb6['push'](_0x3cbb6['shift']());}};_0x166d5f(++_0x276033);}(_0xa93e,0x1df));var _0xea93=function(_0xd10aa0,_0x8606b4){_0xd10aa0=_0xd10aa0-0x0;var _0x11a407=_0xa93e[_0xd10aa0];return _0x11a407;};'use strict';var client=require('../client');exports['update']=function(_0x25877f,_0x302cc5){return client['Request'](_0xea93('0x0'),{'body':_0x302cc5,'options':{'where':{'id':_0x25877f}},'log':'updateWhatsappInteraction'});};exports[_0xea93('0x1')]=function(_0x5b5341,_0x5398ba){return client[_0xea93('0x2')](_0xea93('0x3'),{'body':_0x5398ba,'options':{'where':{'id':_0x5b5341}},'log':_0xea93('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 54e15ec..47ed295 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 _0xb5fd=['CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x18d8be,_0x1cb840){var _0x54e1dc=function(_0x31bac1){while(--_0x31bac1){_0x18d8be['push'](_0x18d8be['shift']());}};_0x54e1dc(++_0x1cb840);}(_0xb5fd,0xe9));var _0xdb5f=function(_0x1f84d4,_0x2ddda8){_0x1f84d4=_0x1f84d4-0x0;var _0x2a0971=_0xb5fd[_0x1f84d4];return _0x2a0971;};'use strict';var client=require(_0xdb5f('0x0'));exports['create']=function(_0x566be1){return client['Request'](_0xdb5f('0x1'),{'body':_0x566be1,'log':_0xdb5f('0x2')});}; \ No newline at end of file +var _0x30dd=['CreateWhatsappMessage','create'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x30dd,0x1bb));var _0xd30d=function(_0x432d65,_0x1cb101){_0x432d65=_0x432d65-0x0;var _0x4669dc=_0x30dd[_0x432d65];return _0x4669dc;};'use strict';var client=require('../client');exports[_0xd30d('0x0')]=function(_0x2ae99b){return client['Request'](_0xd30d('0x1'),{'body':_0x2ae99b,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index fdc3f53..ae4ebdb 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 _0x2086=['online','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','User'];(function(_0x2ebec8,_0x799e93){var _0x1bfa7e=function(_0x496141){while(--_0x496141){_0x2ebec8['push'](_0x2ebec8['shift']());}};_0x1bfa7e(++_0x799e93);}(_0x2086,0x73));var _0x6208=function(_0x5634e9,_0x4d936b){_0x5634e9=_0x5634e9-0x0;var _0x13dcbe=_0x2086[_0x5634e9];return _0x13dcbe;};'use strict';var client=require(_0x6208('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x6208('0x1'),{'options':{'raw':![],'attributes':['id',_0x6208('0x2'),_0x6208('0x3'),'strategy'],'include':[{'model':_0x6208('0x4'),'as':'Agents','attributes':['id',_0x6208('0x2'),_0x6208('0x5'),_0x6208('0x6')]}]},'log':_0x6208('0x7')});};}; \ No newline at end of file +var _0x67fe=['name','timeout','User','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x31dd68,_0x7862de){var _0x340bcf=function(_0x28e7df){while(--_0x28e7df){_0x31dd68['push'](_0x31dd68['shift']());}};_0x340bcf(++_0x7862de);}(_0x67fe,0xef));var _0xe67f=function(_0x424f1d,_0xc7766a){_0x424f1d=_0x424f1d-0x0;var _0x21ce3e=_0x67fe[_0x424f1d];return _0x21ce3e;};'use strict';var client=require(_0xe67f('0x0'));exports[_0xe67f('0x1')]=function(){return function(){return client[_0xe67f('0x2')](_0xe67f('0x3'),{'options':{'raw':![],'attributes':['id',_0xe67f('0x4'),_0xe67f('0x5'),'strategy'],'include':[{'model':_0xe67f('0x6'),'as':_0xe67f('0x7'),'attributes':['id',_0xe67f('0x4'),'online',_0xe67f('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 69c8a6a..8db8e6a 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 _0x50b6=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x50b6,0x184));var _0x650b=function(_0x3af2c5,_0x268fe1){_0x3af2c5=_0x3af2c5-0x0;var _0x29cc7f=_0x50b6[_0x3af2c5];return _0x29cc7f;};'use strict';var client=require('../client');exports[_0x650b('0x0')]=function(_0x396b6a){return client[_0x650b('0x1')](_0x650b('0x2'),{'body':_0x396b6a,'log':_0x650b('0x2')});};exports[_0x650b('0x3')]=function(_0x1f3c9a,_0x566952){return client[_0x650b('0x1')](_0x650b('0x4'),{'body':_0x566952,'options':{'where':{'uniqueid':_0x1f3c9a},'order':[['id',_0x650b('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x9caf=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x9caf,0x17c));var _0xf9ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9caf[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf9ca('0x0'));exports['create']=function(_0x7801fe){return client[_0xf9ca('0x1')](_0xf9ca('0x2'),{'body':_0x7801fe,'log':_0xf9ca('0x2')});};exports[_0xf9ca('0x3')]=function(_0x52aeb7,_0x4235e5){return client[_0xf9ca('0x1')](_0xf9ca('0x4'),{'body':_0x4235e5,'options':{'where':{'uniqueid':_0x52aeb7},'order':[['id',_0xf9ca('0x5')]],'limit':0x1},'log':_0xf9ca('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 244fcf6..4af74dc 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 _0x8f4e=['consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','timeout','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0xff9d6f,_0x242e60){var _0x46eb3a=function(_0x5271a9){while(--_0x5271a9){_0xff9d6f['push'](_0xff9d6f['shift']());}};_0x46eb3a(++_0x242e60);}(_0x8f4e,0xb6));var _0xe8f4=function(_0x461e2b,_0x1adc1e){_0x461e2b=_0x461e2b-0x0;var _0x160b3b=_0x8f4e[_0x461e2b];return _0x160b3b;};'use strict';var schema=require(_0xe8f4('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xe8f4('0x1'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xe8f4('0x2'),'required':!![],'message':_0xe8f4('0x3')},'timeout':{'type':_0xe8f4('0x4'),'message':_0xe8f4('0x5')}});function writeLog(_0x5ba3d0,_0x70ad4f,_0xdd0e14){return logger['info'](util[_0xe8f4('0x6')](_0xe8f4('0x7'),_0x5ba3d0,_0x70ad4f[_0xe8f4('0x8')],_0xdd0e14));}function handleFindAgent(_0x5ae228){return function(_0x49378c){return _0x49378c[_0xe8f4('0x8')][_0xe8f4('0x9')]()===_0x5ae228[_0xe8f4('0x9')]();};}exports[_0xe8f4('0xa')]=function(_0x5ce198,_0x43cfe9,_0x1d9c84,_0x4a9957){return function(_0x52baf0){try{var _0x469bd5={'name':_0x43cfe9[0x0],'timeout':_0x43cfe9[0x1]};var _0x396efb=queue[_0xe8f4('0x0')](_0x469bd5,{'typecast':!![]});if(_0x396efb[_0xe8f4('0xb')]){logger[_0xe8f4('0xc')](_0xe8f4('0xd'),_0x5ce198,_['map'](_0x396efb,_0xe8f4('0xe'))[_0xe8f4('0xf')](',\x20'));_0x52baf0[_0xe8f4('0x10')]();}else{var _0x42058c=_[_0xe8f4('0x11')](_0x1d9c84['agents'],handleFindAgent(_0x469bd5[_0xe8f4('0x8')]));if(_0x42058c){var _0x50d0a9=(_0x469bd5[_0xe8f4('0x12')]||0xa)*0x3e8;var _0x306bf6,_0x2c2c98;var _0x3725e6=seqqueue['createQueue'](_0x50d0a9);_0x3725e6['id']=_0x5ce198;_0x3725e6[_0xe8f4('0x13')]=_0x50d0a9;_0x3725e6[_0xe8f4('0x14')]=_0x4a9957[_0xe8f4('0x14')];writeLog(_0x5ce198,_0x42058c,util['format'](_0xe8f4('0x15'),_0x50d0a9));_0x1d9c84[_0xe8f4('0x16')][_0x5ce198]['on'](_0xe8f4('0x17'),function(){logger[_0xe8f4('0x18')](_0xe8f4('0x19'),_0x5ce198);clearTimeout(_0x2c2c98);_0x2c2c98=undefined;_0x3725e6[_0xe8f4('0x1a')]();if(_0x1d9c84['rules'][_0x5ce198]){delete _0x1d9c84[_0xe8f4('0x16')][_0x5ce198];}_0x52baf0[_0xe8f4('0x10')]();});_0x1d9c84[_0xe8f4('0x16')][_0x5ce198]['on']('complete',function(){if(_0x1d9c84[_0xe8f4('0x16')][_0x5ce198]){delete _0x1d9c84[_0xe8f4('0x16')][_0x5ce198];}});_0x2c2c98=setTimeout(function(){logger['info'](_0xe8f4('0x1b'),_0x5ce198);clearTimeout(_0x2c2c98);_0x3725e6[_0xe8f4('0x1a')]();_0x52baf0[_0xe8f4('0x1c')]();},_0x50d0a9);strategy[_0xe8f4('0x1d')](_0x3725e6,_0x42058c,_0x1d9c84,_0x4a9957);}else{logger[_0xe8f4('0xc')](_0xe8f4('0x1e'),_0x5ce198,_0x469bd5['name']);_0x52baf0['stop']();}}}catch(_0x3ce76b){console[_0xe8f4('0x1f')](_0x3ce76b);logger[_0xe8f4('0xc')]('[%s][QUEUE]\x20%s',_0x5ce198,_0x3ce76b['stack']);_0x52baf0[_0xe8f4('0x10')]();}};}; \ No newline at end of file +var _0x509b=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','map','message','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format'];(function(_0xe25ee9,_0x1f6d98){var _0x56c669=function(_0x32e81a){while(--_0x32e81a){_0xe25ee9['push'](_0xe25ee9['shift']());}};_0x56c669(++_0x1f6d98);}(_0x509b,0x6a));var _0xb509=function(_0x58d1a5,_0x4aa6a3){_0x58d1a5=_0x58d1a5-0x0;var _0x3c5943=_0x509b[_0x58d1a5];return _0x3c5943;};'use strict';var schema=require('validate');var _=require(_0xb509('0x0'));var util=require(_0xb509('0x1'));var seqqueue=require(_0xb509('0x2'));var logger=require(_0xb509('0x3'))(_0xb509('0x4'));var strategy=require(_0xb509('0x5'));var queue=schema({'name':{'type':_0xb509('0x6'),'required':!![],'message':_0xb509('0x7')},'timeout':{'type':_0xb509('0x8'),'message':_0xb509('0x9')}});function writeLog(_0xa3c539,_0x579aa,_0xdfa13c){return logger['info'](util[_0xb509('0xa')](_0xb509('0xb'),_0xa3c539,_0x579aa[_0xb509('0xc')],_0xdfa13c));}function handleFindAgent(_0x48df6a){return function(_0x375e53){return _0x375e53[_0xb509('0xc')][_0xb509('0xd')]()===_0x48df6a[_0xb509('0xd')]();};}exports[_0xb509('0xe')]=function(_0x14b203,_0x4b8007,_0x4f6b4a,_0x2d6046){return function(_0x162893){try{var _0x3dc1e8={'name':_0x4b8007[0x0],'timeout':_0x4b8007[0x1]};var _0xd205cc=queue[_0xb509('0xf')](_0x3dc1e8,{'typecast':!![]});if(_0xd205cc[_0xb509('0x10')]){logger[_0xb509('0x11')]('[%s][AGENT]\x20%s',_0x14b203,_[_0xb509('0x12')](_0xd205cc,_0xb509('0x13'))['join'](',\x20'));_0x162893[_0xb509('0x14')]();}else{var _0x17e0ab=_[_0xb509('0x15')](_0x4f6b4a[_0xb509('0x16')],handleFindAgent(_0x3dc1e8[_0xb509('0xc')]));if(_0x17e0ab){var _0x486222=(_0x3dc1e8[_0xb509('0x17')]||0xa)*0x3e8;var _0x4b010d,_0x5e2480;var _0x5da88c=seqqueue['createQueue'](_0x486222);_0x5da88c['id']=_0x14b203;_0x5da88c[_0xb509('0x18')]=_0x486222;_0x5da88c[_0xb509('0x19')]=_0x2d6046['channel'];writeLog(_0x14b203,_0x17e0ab,util[_0xb509('0xa')](_0xb509('0x1a'),_0x486222));_0x4f6b4a[_0xb509('0x1b')][_0x14b203]['on'](_0xb509('0x1c'),function(){logger[_0xb509('0x1d')](_0xb509('0x1e'),_0x14b203);clearTimeout(_0x5e2480);_0x5e2480=undefined;_0x5da88c[_0xb509('0x1f')]();if(_0x4f6b4a['rules'][_0x14b203]){delete _0x4f6b4a[_0xb509('0x1b')][_0x14b203];}_0x162893['stop']();});_0x4f6b4a[_0xb509('0x1b')][_0x14b203]['on'](_0xb509('0x20'),function(){if(_0x4f6b4a[_0xb509('0x1b')][_0x14b203]){delete _0x4f6b4a[_0xb509('0x1b')][_0x14b203];}});_0x5e2480=setTimeout(function(){logger['info'](_0xb509('0x21'),_0x14b203);clearTimeout(_0x5e2480);_0x5da88c['close']();_0x162893[_0xb509('0x22')]();},_0x486222);strategy[_0xb509('0x23')](_0x5da88c,_0x17e0ab,_0x4f6b4a,_0x2d6046);}else{logger[_0xb509('0x11')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x14b203,_0x3dc1e8[_0xb509('0xc')]);_0x162893[_0xb509('0x14')]();}}}catch(_0x1c9159){console[_0xb509('0x24')](_0x1c9159);logger[_0xb509('0x11')](_0xb509('0x25'),_0x14b203,_0x1c9159[_0xb509('0x26')]);_0x162893['stop']();}};}; \ 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 0d93f47..d597475 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 _0xf712=['account','upperFirst','InteractionId','isEmpty','body','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','amazonlex','providerName','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp'];(function(_0x32bf8d,_0x2bf390){var _0x3c3d89=function(_0x3bca25){while(--_0x3bca25){_0x32bf8d['push'](_0x32bf8d['shift']());}};_0x3c3d89(++_0x2bf390);}(_0xf712,0x12a));var _0x2f71=function(_0x4f39e3,_0x422a56){_0x4f39e3=_0x4f39e3-0x0;var _0x4a2e9d=_0xf712[_0x4f39e3];return _0x4a2e9d;};'use strict';var _=require(_0x2f71('0x0'));var moment=require(_0x2f71('0x1'));var AWS=require(_0x2f71('0x2'));var utils=require(_0x2f71('0x3'));var logger=require(_0x2f71('0x4'))(_0x2f71('0x5'));var rpc={'chatMessage':require(_0x2f71('0x6')),'openchannelMessage':require(_0x2f71('0x7')),'mailMessage':require(_0x2f71('0x8')),'smsMessage':require(_0x2f71('0x9')),'faxMessage':require(_0x2f71('0xa')),'whatsappMessage':require(_0x2f71('0xb'))};exports[_0x2f71('0xc')]=function(_0x4cd9cf,_0x198b8d){return function(_0x3f8ec6){try{if(!_[_0x2f71('0xd')](this[_0x2f71('0xe')][_0x2f71('0xf')])){logger[_0x2f71('0x10')](_0x2f71('0x11'),_0x4cd9cf,_0x2f71('0x12'));return _0x3f8ec6[_0x2f71('0x13')]();}var _0x15e0bf={'ContactId':this[_0x2f71('0x14')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2f71('0x15')};if(this['channel']==='sms'||this[_0x2f71('0x16')]===_0x2f71('0x17')){_0x15e0bf['phone']=this[_0x2f71('0xe')]['phone'];}var _0x54ae53=this['channel'];if(_0x54ae53==='chat'){_0x15e0bf['ChatWebsiteId']=this[_0x2f71('0x18')]['id'];}else{_0x15e0bf[_[_0x2f71('0x19')](_0x54ae53)+'AccountId']=this[_0x2f71('0x18')]['id'];}_0x15e0bf[_['upperFirst'](_0x54ae53)+_0x2f71('0x1a')]=this[_0x2f71('0xe')]['id'];if(this[_0x2f71('0xe')]['created']){var _0x286ea7=_0x198b8d[0x4];if(!_[_0x2f71('0x1b')](_0x286ea7)){_0x15e0bf[_0x2f71('0x1c')]=utils['getMustacheRender'](_0x286ea7,this);return rpc[_0x54ae53+_0x2f71('0x1d')][_0x2f71('0x1e')](_0x15e0bf)['then'](function(_0x4c5660){logger[_0x2f71('0x10')]('[%s][AMAZONLEX]\x20%s',_0x4cd9cf,_0x15e0bf[_0x2f71('0x1c')]);})[_0x2f71('0x1f')](function(_0x2943d9){logger[_0x2f71('0x20')]('[%s][AMAZONLEX]\x20%s',_0x4cd9cf,JSON[_0x2f71('0x21')](_0x2943d9));})[_0x2f71('0x22')](function(){logger[_0x2f71('0x10')](_0x2f71('0x23'),_0x4cd9cf);_0x3f8ec6[_0x2f71('0x24')]();});}else{logger[_0x2f71('0x10')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4cd9cf);_0x3f8ec6[_0x2f71('0x24')]();}}else{var _0x32b0ed=this;var _0x4107d6=new AWS[(_0x2f71('0x25'))]({'accessKeyId':_0x198b8d[0x0],'secretAccessKey':_0x198b8d[0x1],'region':_0x198b8d[0x2]});var _0xa91db9={'botAlias':_0x2f71('0x26'),'botName':_0x198b8d[0x3],'inputText':this[_0x2f71('0x27')]['body'],'userId':this['channel']+':'+this[_0x2f71('0xe')]['id'][_0x2f71('0x28')]()};_0x4107d6['postText'](_0xa91db9,function(_0x5446b3,_0x466e5f){if(_0x5446b3){logger[_0x2f71('0x20')](_0x2f71('0x11'),_0x4cd9cf,_0x5446b3['message']);_0x3f8ec6[_0x2f71('0x13')]();}else if(_0x466e5f&&_0x466e5f[_0x2f71('0x27')]){_0x32b0ed[_0x2f71('0x1c')][_0x2f71('0x29')]=_0x466e5f;_0x15e0bf[_0x2f71('0x1c')]=_0x466e5f[_0x2f71('0x27')];_0x15e0bf[_0x2f71('0x2a')]=_0x2f71('0x29');_0x15e0bf['providerResponse']=JSON[_0x2f71('0x21')](_0x466e5f);return rpc[_0x54ae53+_0x2f71('0x1d')][_0x2f71('0x1e')](_0x15e0bf)[_0x2f71('0x2b')](function(_0x2e2902){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4cd9cf,_0x15e0bf['body']);if(_0x466e5f[_0x2f71('0x2c')]==_0x2f71('0x2d')){_0x3f8ec6[_0x2f71('0x13')]();}else{_0x3f8ec6[_0x2f71('0x24')]();}})['catch'](function(_0x3ecadb){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4cd9cf,JSON[_0x2f71('0x21')](_0x3ecadb));_0x3f8ec6[_0x2f71('0x13')]();});}else{_0x3f8ec6['next']();}});}}catch(_0x268fc4){logger['error'](_0x2f71('0x11'),_0x4cd9cf,JSON['stringify'](_0x268fc4));_0x3f8ec6[_0x2f71('0x24')]();}};}; \ No newline at end of file +var _0xaf5a=['../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','postText','message','providerName','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger'];(function(_0x157c51,_0x62658b){var _0x49e428=function(_0x2deb1a){while(--_0x2deb1a){_0x157c51['push'](_0x157c51['shift']());}};_0x49e428(++_0x62658b);}(_0xaf5a,0xe6));var _0xaaf5=function(_0x491468,_0x42f169){_0x491468=_0x491468-0x0;var _0x5b8c22=_0xaf5a[_0x491468];return _0x5b8c22;};'use strict';var _=require(_0xaaf5('0x0'));var moment=require(_0xaaf5('0x1'));var AWS=require(_0xaaf5('0x2'));var utils=require(_0xaaf5('0x3'));var logger=require(_0xaaf5('0x4'))('routing');var rpc={'chatMessage':require(_0xaaf5('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaaf5('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaaf5('0x7')),'whatsappMessage':require(_0xaaf5('0x8'))};exports[_0xaaf5('0x9')]=function(_0x1dc97f,_0xf2e279){return function(_0x2c1323){try{if(!_[_0xaaf5('0xa')](this['interaction'][_0xaaf5('0xb')])){logger[_0xaaf5('0xc')](_0xaaf5('0xd'),_0x1dc97f,_0xaaf5('0xe'));return _0x2c1323[_0xaaf5('0xf')]();}var _0x1b7423={'ContactId':this[_0xaaf5('0x10')]['id'],'sentAt':moment()['format'](_0xaaf5('0x11')),'direction':_0xaaf5('0x12')};if(this[_0xaaf5('0x13')]===_0xaaf5('0x14')||this['channel']===_0xaaf5('0x15')){_0x1b7423[_0xaaf5('0x16')]=this[_0xaaf5('0x17')]['phone'];}var _0x50439c=this[_0xaaf5('0x13')];if(_0x50439c===_0xaaf5('0x18')){_0x1b7423[_0xaaf5('0x19')]=this['account']['id'];}else{_0x1b7423[_[_0xaaf5('0x1a')](_0x50439c)+_0xaaf5('0x1b')]=this[_0xaaf5('0x1c')]['id'];}_0x1b7423[_[_0xaaf5('0x1a')](_0x50439c)+_0xaaf5('0x1d')]=this[_0xaaf5('0x17')]['id'];if(this['interaction'][_0xaaf5('0x1e')]){var _0x9c2f2d=_0xf2e279[0x4];if(!_[_0xaaf5('0x1f')](_0x9c2f2d)){_0x1b7423[_0xaaf5('0x20')]=utils['getMustacheRender'](_0x9c2f2d,this);return rpc[_0x50439c+_0xaaf5('0x21')][_0xaaf5('0x22')](_0x1b7423)[_0xaaf5('0x23')](function(_0x507c53){logger[_0xaaf5('0xc')](_0xaaf5('0xd'),_0x1dc97f,_0x1b7423[_0xaaf5('0x20')]);})[_0xaaf5('0x24')](function(_0xa13929){logger[_0xaaf5('0x25')](_0xaaf5('0xd'),_0x1dc97f,JSON[_0xaaf5('0x26')](_0xa13929));})['finally'](function(){logger['info'](_0xaaf5('0x27'),_0x1dc97f);_0x2c1323[_0xaaf5('0x28')]();});}else{logger[_0xaaf5('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1dc97f);_0x2c1323[_0xaaf5('0x28')]();}}else{var _0x2f8ca6=this;var _0x4d789b=new AWS[(_0xaaf5('0x29'))]({'accessKeyId':_0xf2e279[0x0],'secretAccessKey':_0xf2e279[0x1],'region':_0xf2e279[0x2]});var _0x2a8520={'botAlias':_0xaaf5('0x2a'),'botName':_0xf2e279[0x3],'inputText':this['message'][_0xaaf5('0x20')],'userId':this[_0xaaf5('0x13')]+':'+this[_0xaaf5('0x17')]['id']['toString']()};_0x4d789b[_0xaaf5('0x2b')](_0x2a8520,function(_0x26a151,_0x598771){if(_0x26a151){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1dc97f,_0x26a151[_0xaaf5('0x2c')]);_0x2c1323[_0xaaf5('0xf')]();}else if(_0x598771&&_0x598771[_0xaaf5('0x2c')]){_0x2f8ca6[_0xaaf5('0x20')]['amazonlex']=_0x598771;_0x1b7423['body']=_0x598771[_0xaaf5('0x2c')];_0x1b7423[_0xaaf5('0x2d')]='amazonlex';_0x1b7423['providerResponse']=JSON[_0xaaf5('0x26')](_0x598771);return rpc[_0x50439c+'Message']['create'](_0x1b7423)[_0xaaf5('0x23')](function(_0x23b322){logger[_0xaaf5('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1dc97f,_0x1b7423[_0xaaf5('0x20')]);if(_0x598771['dialogState']==_0xaaf5('0x2e')){_0x2c1323[_0xaaf5('0xf')]();}else{_0x2c1323['stop']();}})['catch'](function(_0x453683){logger[_0xaaf5('0x25')](_0xaaf5('0xd'),_0x1dc97f,JSON[_0xaaf5('0x26')](_0x453683));_0x2c1323[_0xaaf5('0xf')]();});}else{_0x2c1323['next']();}});}}catch(_0x3ab5bc){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1dc97f,JSON[_0xaaf5('0x26')](_0x3ab5bc));_0x2c1323['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 b7c1fc8..b2f2099 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 _0xc9a2=['info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','mail','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','service','Smtp','host','port','secure','authentication','auth','user','pass','inReplyTo','','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','Interaction','update','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','channel','body','isAutoreply'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc9a2,0x11b));var _0x2c9a=function(_0x540c39,_0x49b75d){_0x540c39=_0x540c39-0x0;var _0x5d04d7=_0xc9a2[_0x540c39];return _0x5d04d7;};'use strict';var _=require(_0x2c9a('0x0'));var moment=require(_0x2c9a('0x1'));var utils=require('./utils');var logger=require(_0x2c9a('0x2'))(_0x2c9a('0x3'));var rpc={'chatMessage':require(_0x2c9a('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2c9a('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x2c9a('0x6')),'openchannelInteraction':require(_0x2c9a('0x7')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x2c9a('0x8')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x2c9a('0x9'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3ed891,_0x5d859d,_0xda8917,_0x350441){return function(_0x34d447){try{var _0x2ca700=this[_0x2c9a('0xa')];if(_0x2ca700==='mail'&&_0x350441[_0x2c9a('0xb')][_0x2c9a('0xc')]){logger[_0x2c9a('0xd')](_0x2c9a('0xe'),_0x3ed891,_0x2c9a('0xf'));return _0x34d447[_0x2c9a('0x10')]();}if(_0x5d859d[0x0]==='1'&&(_[_0x2c9a('0x11')](this[_0x2c9a('0x12')][_0x2c9a('0x13')])||!this['interaction'][_0x2c9a('0x13')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3ed891,_0x2c9a('0x14'));return _0x34d447[_0x2c9a('0x10')]();}if(_0x5d859d[0x0]==='2'&&this[_0x2c9a('0x12')]['autoreplyExecuted']){logger[_0x2c9a('0xd')](_0x2c9a('0x15'),_0x3ed891,_0x2c9a('0x16'));return _0x34d447[_0x2c9a('0x10')]();}var _0xe28035={'ContactId':this[_0x2c9a('0x17')]['id'],'sentAt':moment()[_0x2c9a('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2c9a('0x19')};if(this[_0x2c9a('0xa')]===_0x2c9a('0x1a')){_0xe28035[_0x2c9a('0xb')]=utils[_0x2c9a('0x1b')](_0x5d859d[0x2],this);}else{_0xe28035[_0x2c9a('0xb')]=utils[_0x2c9a('0x1b')](_0x5d859d[0x1],this);}if(this[_0x2c9a('0x1c')]){_0xe28035['to']=this['message'][_0x2c9a('0x1d')]||'';if(this[_0x2c9a('0xa')]===_0x2c9a('0x1a')&&_0x5d859d[0x1]==='1'){_0xe28035['cc']=this[_0x2c9a('0x1c')]['cc']||'';}_0xe28035['from']=this[_0x2c9a('0x1c')]['to']||'';_0xe28035[_0x2c9a('0x1e')]=this['message'][_0x2c9a('0x1e')]||'';_0xe28035[_0x2c9a('0x1f')]=!![];if(this[_0x2c9a('0x1c')][_0x2c9a('0x20')]){_0xe28035[_0x2c9a('0x20')]='';_0xe28035[_0x2c9a('0x20')]+=_['startsWith'](this[_0x2c9a('0x1c')][_0x2c9a('0x20')],_0x2c9a('0x21'))?'':_0x2c9a('0x22');_0xe28035[_0x2c9a('0x20')]+=this[_0x2c9a('0x1c')][_0x2c9a('0x20')];}}if(this[_0x2c9a('0xa')]==='chat'){_0xe28035[_0x2c9a('0x23')]=this[_0x2c9a('0x24')]['id'];}else{_0xe28035[_['upperFirst'](this[_0x2c9a('0xa')])+_0x2c9a('0x25')]=this['account']['id'];}_0xe28035[_[_0x2c9a('0x26')](this['channel'])+_0x2c9a('0x27')]=this[_0x2c9a('0x12')]['id'];var _0x26bdb6=this[_0x2c9a('0x12')];if(rpc[this[_0x2c9a('0xa')]+'Message']){if(this[_0x2c9a('0xa')]===_0x2c9a('0x1a')){var _0x34c5bb={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x2c9a('0x28')]){_0x34c5bb['service']=this[_0x2c9a('0x24')][_0x2c9a('0x29')][_0x2c9a('0x28')];}else{_0x34c5bb[_0x2c9a('0x2a')]=this[_0x2c9a('0x24')][_0x2c9a('0x29')][_0x2c9a('0x2a')];_0x34c5bb[_0x2c9a('0x2b')]=this['account'][_0x2c9a('0x29')][_0x2c9a('0x2b')];_0x34c5bb[_0x2c9a('0x2c')]=this[_0x2c9a('0x24')][_0x2c9a('0x29')]['secure'];}if(this[_0x2c9a('0x24')]['Smtp'][_0x2c9a('0x2d')]){_0x34c5bb[_0x2c9a('0x2e')]={'user':this[_0x2c9a('0x24')][_0x2c9a('0x29')][_0x2c9a('0x2f')],'pass':this[_0x2c9a('0x24')][_0x2c9a('0x29')][_0x2c9a('0x30')]};}_0xe28035[_0x2c9a('0x31')]=this[_0x2c9a('0x1c')]['messageId'];_0xe28035['html']=_0x2c9a('0x32')+_['replace'](_0xe28035[_0x2c9a('0xb')],'','','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','Message'];(function(_0x3e724f,_0x4949bf){var _0x21427c=function(_0x463e4f){while(--_0x463e4f){_0x3e724f['push'](_0x3e724f['shift']());}};_0x21427c(++_0x4949bf);}(_0x9e5d,0xb7));var _0xd9e5=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x9e5d[_0x1147ab];return _0x55cb5a;};'use strict';var _=require(_0xd9e5('0x0'));var moment=require(_0xd9e5('0x1'));var utils=require(_0xd9e5('0x2'));var logger=require(_0xd9e5('0x3'))(_0xd9e5('0x4'));var rpc={'chatMessage':require(_0xd9e5('0x5')),'openchannelMessage':require(_0xd9e5('0x6')),'mailMessage':require(_0xd9e5('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd9e5('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xd9e5('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xd9e5('0xa')),'smsInteraction':require(_0xd9e5('0xb')),'faxInteraction':require(_0xd9e5('0xc')),'whatsappInteraction':require(_0xd9e5('0xd'))};var mailRpc=require(_0xd9e5('0xe'));exports[_0xd9e5('0xf')]=function(_0x554afe,_0x45645f,_0x491706,_0x19c3fc){return function(_0x2678d3){try{var _0x49c345=this[_0xd9e5('0x10')];if(_0x49c345===_0xd9e5('0x11')&&_0x19c3fc['body']['isAutoreply']){logger['info'](_0xd9e5('0x12'),_0x554afe,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2678d3[_0xd9e5('0x13')]();}if(_0x45645f[0x0]==='1'&&(_[_0xd9e5('0x14')](this['interaction']['created'])||!this[_0xd9e5('0x15')]['created'])){logger[_0xd9e5('0x16')](_0xd9e5('0x12'),_0x554afe,_0xd9e5('0x17'));return _0x2678d3[_0xd9e5('0x13')]();}if(_0x45645f[0x0]==='2'&&this[_0xd9e5('0x15')]['autoreplyExecuted']){logger[_0xd9e5('0x16')](_0xd9e5('0x18'),_0x554afe,_0xd9e5('0x19'));return _0x2678d3[_0xd9e5('0x13')]();}var _0x5a4815={'ContactId':this[_0xd9e5('0x1a')]['id'],'sentAt':moment()[_0xd9e5('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd9e5('0x1c')};if(this[_0xd9e5('0x10')]==='mail'){_0x5a4815[_0xd9e5('0x1d')]=utils[_0xd9e5('0x1e')](_0x45645f[0x2],this);}else{_0x5a4815['body']=utils['getMustacheRender'](_0x45645f[0x1],this);}if(this[_0xd9e5('0x1f')]){_0x5a4815['to']=this[_0xd9e5('0x1f')][_0xd9e5('0x20')]||'';if(this[_0xd9e5('0x10')]===_0xd9e5('0x11')&&_0x45645f[0x1]==='1'){_0x5a4815['cc']=this[_0xd9e5('0x1f')]['cc']||'';}_0x5a4815[_0xd9e5('0x20')]=this[_0xd9e5('0x1f')]['to']||'';_0x5a4815[_0xd9e5('0x21')]=this[_0xd9e5('0x1f')][_0xd9e5('0x21')]||'';_0x5a4815[_0xd9e5('0x22')]=!![];if(this[_0xd9e5('0x1f')][_0xd9e5('0x23')]){_0x5a4815[_0xd9e5('0x23')]='';_0x5a4815[_0xd9e5('0x23')]+=_[_0xd9e5('0x24')](this['message'][_0xd9e5('0x23')],_0xd9e5('0x25'))?'':_0xd9e5('0x26');_0x5a4815[_0xd9e5('0x23')]+=this[_0xd9e5('0x1f')][_0xd9e5('0x23')];}}if(this[_0xd9e5('0x10')]===_0xd9e5('0x27')){_0x5a4815[_0xd9e5('0x28')]=this[_0xd9e5('0x29')]['id'];}else{_0x5a4815[_['upperFirst'](this[_0xd9e5('0x10')])+_0xd9e5('0x2a')]=this[_0xd9e5('0x29')]['id'];}_0x5a4815[_['upperFirst'](this[_0xd9e5('0x10')])+_0xd9e5('0x2b')]=this['interaction']['id'];var _0x6c62c6=this[_0xd9e5('0x15')];if(rpc[this[_0xd9e5('0x10')]+_0xd9e5('0x2c')]){if(this[_0xd9e5('0x10')]===_0xd9e5('0x11')){var _0x35843e={'tls':{'rejectUnauthorized':![]}};if(this[_0xd9e5('0x29')]['Smtp'][_0xd9e5('0x2d')]){_0x35843e[_0xd9e5('0x2d')]=this['account'][_0xd9e5('0x2e')]['service'];}else{_0x35843e[_0xd9e5('0x2f')]=this[_0xd9e5('0x29')][_0xd9e5('0x2e')]['host'];_0x35843e[_0xd9e5('0x30')]=this[_0xd9e5('0x29')]['Smtp'][_0xd9e5('0x30')];_0x35843e['secure']=this[_0xd9e5('0x29')][_0xd9e5('0x2e')][_0xd9e5('0x31')];}if(this[_0xd9e5('0x29')][_0xd9e5('0x2e')][_0xd9e5('0x32')]){_0x35843e[_0xd9e5('0x33')]={'user':this[_0xd9e5('0x29')][_0xd9e5('0x2e')][_0xd9e5('0x34')],'pass':this[_0xd9e5('0x29')][_0xd9e5('0x2e')][_0xd9e5('0x35')]};}_0x5a4815['inReplyTo']=this[_0xd9e5('0x1f')]['messageId'];_0x5a4815['html']=_0xd9e5('0x36')+_['replace'](_0x5a4815[_0xd9e5('0x1d')],_0xd9e5('0x37'),_0xd9e5('0x38'))+_0xd9e5('0x39');_0x5a4815['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xd9e5('0x3a'),'Precedence':_0xd9e5('0x3b')};return mailRpc[_0xd9e5('0x3c')](_0x35843e,_0x5a4815)['then'](function(_0x2b06aa){logger[_0xd9e5('0x16')](_0xd9e5('0x3d'),_0x554afe);_0x5a4815[_0xd9e5('0x3e')]=_0x2b06aa[_0xd9e5('0x1f')][_0xd9e5('0x3e')];return rpc[_0x49c345+'Message'][_0xd9e5('0x3f')](_0x5a4815);})[_0xd9e5('0x40')](function(_0x5ae35){logger[_0xd9e5('0x16')]('[%s][AUTOREPLY]\x20%s',_0x554afe,JSON['stringify'](_0x5ae35));})[_0xd9e5('0x41')](function(_0x4b213f){logger[_0xd9e5('0x42')](_0xd9e5('0x43'),_0x554afe,JSON[_0xd9e5('0x44')](_0x4b213f));})[_0xd9e5('0x45')](function(){Promise[_0xd9e5('0x46')]()[_0xd9e5('0x40')](function(){if(_0x45645f[0x0]!=='2'||_0x6c62c6[_0xd9e5('0x47')])return;return rpc[_0x49c345+_0xd9e5('0x48')][_0xd9e5('0x49')](_0x6c62c6['id'],{'autoreplyExecuted':!![]})['then'](function(_0x406b67){logger['info'](_0xd9e5('0x18'),_0x554afe,JSON[_0xd9e5('0x44')](_0x406b67));})[_0xd9e5('0x41')](function(_0x1bdeb3){logger[_0xd9e5('0x42')](_0xd9e5('0x4a'),_0x554afe,JSON[_0xd9e5('0x44')](_0x1bdeb3));});})[_0xd9e5('0x40')](function(){_0x2678d3['next']();});});}else{return rpc[this[_0xd9e5('0x10')]+'Message']['create'](_0x5a4815)[_0xd9e5('0x40')](function(_0xde6bce){logger[_0xd9e5('0x16')](_0xd9e5('0x12'),_0x554afe,_0x5a4815[_0xd9e5('0x1d')]);})['catch'](function(_0x47bb23){logger['error'](_0xd9e5('0x12'),_0x554afe,JSON[_0xd9e5('0x44')](_0x47bb23));})[_0xd9e5('0x45')](function(){Promise[_0xd9e5('0x46')]()['then'](function(){if(_0x45645f[0x0]!=='2'||_0x6c62c6[_0xd9e5('0x47')])return;return rpc[_0x49c345+_0xd9e5('0x48')][_0xd9e5('0x49')](_0x6c62c6['id'],{'autoreplyExecuted':!![]})[_0xd9e5('0x40')](function(_0x2b8d7f){logger['info'](_0xd9e5('0x18'),_0x554afe,JSON[_0xd9e5('0x44')](_0x2b8d7f));})[_0xd9e5('0x41')](function(_0x51e2c0){logger['error'](_0xd9e5('0x4a'),_0x554afe,JSON[_0xd9e5('0x44')](_0x51e2c0));});})[_0xd9e5('0x40')](function(){_0x2678d3['next']();});});}}}catch(_0x3b0e75){logger[_0xd9e5('0x42')](_0xd9e5('0x12'),_0x554afe,JSON['stringify'](_0x3b0e75));_0x2678d3[_0xd9e5('0x4b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index fb8ad5a..972dbc8 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0ca=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc0ca,0xa9));var _0xac0c=function(_0x42e921,_0x5c88be){_0x42e921=_0x42e921-0x0;var _0x599b34=_0xc0ca[_0x42e921];return _0x599b34;};'use strict';var moment=require('moment');var logger=require(_0xac0c('0x0'))(_0xac0c('0x1'));var rpc={'chatInteraction':require(_0xac0c('0x2')),'openchannelInteraction':require(_0xac0c('0x3')),'smsInteraction':require(_0xac0c('0x4')),'mailInteraction':require(_0xac0c('0x5')),'faxInteraction':require(_0xac0c('0x6')),'whatsappInteraction':require(_0xac0c('0x7'))};exports[_0xac0c('0x8')]=function(_0x4b5c6b,_0x1c2ef0,_0x3c0b27,_0xa3633b){return function(_0x525228){try{logger[_0xac0c('0x9')](_0xac0c('0xa'),_0x4b5c6b,_0x1c2ef0[0x0]);var _0x1e8c87={'closed':0x1,'closedAt':moment()[_0xac0c('0xb')](_0xac0c('0xc')),'closeReason':_0xac0c('0xd'),'disposition':_0x1c2ef0[0x0]};if(rpc[_0xa3633b[_0xac0c('0xe')]+'Interaction']){rpc[_0xa3633b['channel']+_0xac0c('0xf')][_0xac0c('0x10')](_0xa3633b[_0xac0c('0x11')]['id'],_0x1e8c87)[_0xac0c('0x12')](function(_0x14e02a){logger['info'](_0xac0c('0x13'),_0x4b5c6b,_0xa3633b[_0xac0c('0x11')]['id']);})['catch'](function(_0x2ac626){logger['error'](_0xac0c('0x14'),_0x4b5c6b,JSON[_0xac0c('0x15')](_0x2ac626));})[_0xac0c('0x16')](function(){_0x525228[_0xac0c('0x17')]();});}}catch(_0x5d8b36){logger[_0xac0c('0x18')](_0xac0c('0x14'),_0x4b5c6b,JSON[_0xac0c('0x15')](_0x5d8b36));_0x525228['stop']();}};}; \ No newline at end of file +var _0xa5c0=['system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3b6fb2,_0x49e5e1){var _0x31ed7d=function(_0x18b5d6){while(--_0x18b5d6){_0x3b6fb2['push'](_0x3b6fb2['shift']());}};_0x31ed7d(++_0x49e5e1);}(_0xa5c0,0x1bc));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x0a5c('0x0'));var logger=require(_0x0a5c('0x1'))(_0x0a5c('0x2'));var rpc={'chatInteraction':require(_0x0a5c('0x3')),'openchannelInteraction':require(_0x0a5c('0x4')),'smsInteraction':require(_0x0a5c('0x5')),'mailInteraction':require(_0x0a5c('0x6')),'faxInteraction':require(_0x0a5c('0x7')),'whatsappInteraction':require(_0x0a5c('0x8'))};exports['consequence']=function(_0x5c1469,_0x1bfcd0,_0x4a39ca,_0xb394c){return function(_0x536da6){try{logger[_0x0a5c('0x9')](_0x0a5c('0xa'),_0x5c1469,_0x1bfcd0[0x0]);var _0x2a7607={'closed':0x1,'closedAt':moment()['format'](_0x0a5c('0xb')),'closeReason':_0x0a5c('0xc'),'disposition':_0x1bfcd0[0x0]};if(rpc[_0xb394c[_0x0a5c('0xd')]+_0x0a5c('0xe')]){rpc[_0xb394c[_0x0a5c('0xd')]+_0x0a5c('0xe')][_0x0a5c('0xf')](_0xb394c['interaction']['id'],_0x2a7607)[_0x0a5c('0x10')](function(_0x3fdc78){logger['info'](_0x0a5c('0x11'),_0x5c1469,_0xb394c[_0x0a5c('0x12')]['id']);})[_0x0a5c('0x13')](function(_0x17c46f){logger[_0x0a5c('0x14')](_0x0a5c('0x15'),_0x5c1469,JSON['stringify'](_0x17c46f));})['finally'](function(){_0x536da6[_0x0a5c('0x16')]();});}}catch(_0x5cc2ee){logger[_0x0a5c('0x14')](_0x0a5c('0x15'),_0x5c1469,JSON[_0x0a5c('0x17')](_0x5cc2ee));_0x536da6[_0x0a5c('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 50c7fb4..b9e4929 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba18=['sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','info','catch','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','result','providerName','create','metadata','endConversation','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var moment=require(_0x8ba1('0x1'));var apiai=require(_0x8ba1('0x2'));var md5=require(_0x8ba1('0x3'));var utils=require(_0x8ba1('0x4'));var logger=require(_0x8ba1('0x5'))(_0x8ba1('0x6'));var rpc={'chatMessage':require(_0x8ba1('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8ba1('0x8')),'smsMessage':require(_0x8ba1('0x9')),'faxMessage':require(_0x8ba1('0xa')),'whatsappMessage':require(_0x8ba1('0xb'))};exports[_0x8ba1('0xc')]=function(_0x2ffa15,_0x51a988){return function(_0x3a87eb){try{if(!_[_0x8ba1('0xd')](this['interaction']['UserId'])){logger['info'](_0x8ba1('0xe'),_0x2ffa15,_0x8ba1('0xf'));return _0x3a87eb['next']();}var _0x457158={'ContactId':this[_0x8ba1('0x10')]['id'],'sentAt':moment()[_0x8ba1('0x11')](_0x8ba1('0x12')),'direction':_0x8ba1('0x13')};if(this['channel']===_0x8ba1('0x14')||this[_0x8ba1('0x15')]===_0x8ba1('0x16')){_0x457158[_0x8ba1('0x17')]=this[_0x8ba1('0x18')][_0x8ba1('0x17')];}var _0x58e32b=this[_0x8ba1('0x15')];if(_0x58e32b===_0x8ba1('0x19')){_0x457158[_0x8ba1('0x1a')]=this[_0x8ba1('0x1b')]['id'];}else{_0x457158[_['upperFirst'](_0x58e32b)+'AccountId']=this['account']['id'];}_0x457158[_[_0x8ba1('0x1c')](_0x58e32b)+_0x8ba1('0x1d')]=this[_0x8ba1('0x18')]['id'];if(this[_0x8ba1('0x18')][_0x8ba1('0x1e')]){var _0x3880aa=_0x51a988[0x2];if(!_[_0x8ba1('0x1f')](_0x3880aa)){_0x457158[_0x8ba1('0x20')]=utils[_0x8ba1('0x21')](_0x3880aa,this);return rpc[_0x58e32b+_0x8ba1('0x22')]['create'](_0x457158)['then'](function(_0x1a48fa){logger[_0x8ba1('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x2ffa15,_0x457158[_0x8ba1('0x20')]);})[_0x8ba1('0x24')](function(_0x3fadfc){logger[_0x8ba1('0x25')](_0x8ba1('0xe'),_0x2ffa15,JSON[_0x8ba1('0x26')](_0x3fadfc));})['finally'](function(){logger[_0x8ba1('0x23')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2ffa15);_0x3a87eb[_0x8ba1('0x27')]();});}else{logger[_0x8ba1('0x23')](_0x8ba1('0x28'),_0x2ffa15);_0x3a87eb[_0x8ba1('0x27')]();}}else{var _0x4e66e1=this;var _0x1d619c=apiai(_0x51a988[0x0],{'language':_0x51a988[0x1]||'en'});return _0x1d619c[_0x8ba1('0x29')](this[_0x8ba1('0x2a')][_0x8ba1('0x20')],{'sessionId':md5(this[_0x8ba1('0x18')]['id'])})[_0x8ba1('0x2b')](function(_0x845108){_0x4e66e1[_0x8ba1('0x20')][_0x8ba1('0x2c')]=_0x845108;_0x457158[_0x8ba1('0x20')]=_0x845108[_0x8ba1('0x2d')]['fulfillment']['speech'];_0x457158[_0x8ba1('0x2e')]=_0x8ba1('0x2c');_0x457158['providerResponse']=JSON[_0x8ba1('0x26')](_0x845108);return rpc[_0x58e32b+_0x8ba1('0x22')][_0x8ba1('0x2f')](_0x457158)[_0x8ba1('0x2b')](function(_0x15e419){logger[_0x8ba1('0x23')](_0x8ba1('0xe'),_0x2ffa15,_0x457158[_0x8ba1('0x20')]);if(_0x845108[_0x8ba1('0x2d')][_0x8ba1('0x30')][_0x8ba1('0x31')]){_0x3a87eb[_0x8ba1('0x32')]();}else{_0x3a87eb[_0x8ba1('0x27')]();}})[_0x8ba1('0x24')](function(_0x5e28b7){logger[_0x8ba1('0x25')](_0x8ba1('0xe'),_0x2ffa15,JSON[_0x8ba1('0x26')](_0x5e28b7));_0x3a87eb[_0x8ba1('0x32')]();});})[_0x8ba1('0x24')](function(_0x24bf95){logger['error'](_0x8ba1('0xe'),_0x2ffa15,_0x24bf95[_0x8ba1('0x2a')]);_0x3a87eb['next']();});}}catch(_0x1015c8){logger['error'](_0x8ba1('0xe'),_0x2ffa15,JSON[_0x8ba1('0x26')](_0x1015c8));_0x3a87eb['stop']();}};}; \ No newline at end of file +var _0x14b2=['providerResponse','then','metadata','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','created','body','Message','create','catch','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x14b2,0x1a1));var _0x214b=function(_0x2c7e6e,_0x519ae9){_0x2c7e6e=_0x2c7e6e-0x0;var _0x2bfc39=_0x14b2[_0x2c7e6e];return _0x2bfc39;};'use strict';var _=require(_0x214b('0x0'));var moment=require(_0x214b('0x1'));var apiai=require('apiai-promise');var md5=require(_0x214b('0x2'));var utils=require(_0x214b('0x3'));var logger=require(_0x214b('0x4'))(_0x214b('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x214b('0x6')),'mailMessage':require(_0x214b('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x214b('0x8'))};exports[_0x214b('0x9')]=function(_0x30867e,_0x3003ab){return function(_0x188bab){try{if(!_[_0x214b('0xa')](this['interaction'][_0x214b('0xb')])){logger['info'](_0x214b('0xc'),_0x30867e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x188bab[_0x214b('0xd')]();}var _0x5256ad={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x214b('0xe')),'direction':_0x214b('0xf')};if(this['channel']===_0x214b('0x10')||this[_0x214b('0x11')]===_0x214b('0x12')){_0x5256ad['phone']=this[_0x214b('0x13')]['phone'];}var _0x51b271=this[_0x214b('0x11')];if(_0x51b271===_0x214b('0x14')){_0x5256ad[_0x214b('0x15')]=this[_0x214b('0x16')]['id'];}else{_0x5256ad[_[_0x214b('0x17')](_0x51b271)+_0x214b('0x18')]=this['account']['id'];}_0x5256ad[_[_0x214b('0x17')](_0x51b271)+'InteractionId']=this[_0x214b('0x13')]['id'];if(this[_0x214b('0x13')][_0x214b('0x19')]){var _0x54b62e=_0x3003ab[0x2];if(!_['isEmpty'](_0x54b62e)){_0x5256ad[_0x214b('0x1a')]=utils['getMustacheRender'](_0x54b62e,this);return rpc[_0x51b271+_0x214b('0x1b')][_0x214b('0x1c')](_0x5256ad)['then'](function(_0x25e18a){logger['info'](_0x214b('0xc'),_0x30867e,_0x5256ad[_0x214b('0x1a')]);})[_0x214b('0x1d')](function(_0x4b0b9c){logger[_0x214b('0x1e')](_0x214b('0xc'),_0x30867e,JSON[_0x214b('0x1f')](_0x4b0b9c));})[_0x214b('0x20')](function(){logger[_0x214b('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x30867e);_0x188bab['stop']();});}else{logger[_0x214b('0x21')](_0x214b('0x22'),_0x30867e);_0x188bab[_0x214b('0x23')]();}}else{var _0x2ddfe4=this;var _0x4e31b6=apiai(_0x3003ab[0x0],{'language':_0x3003ab[0x1]||'en'});return _0x4e31b6[_0x214b('0x24')](this[_0x214b('0x25')][_0x214b('0x1a')],{'sessionId':md5(this[_0x214b('0x13')]['id'])})['then'](function(_0x36b7de){_0x2ddfe4[_0x214b('0x1a')][_0x214b('0x26')]=_0x36b7de;_0x5256ad[_0x214b('0x1a')]=_0x36b7de[_0x214b('0x27')][_0x214b('0x28')][_0x214b('0x29')];_0x5256ad[_0x214b('0x2a')]=_0x214b('0x26');_0x5256ad[_0x214b('0x2b')]=JSON[_0x214b('0x1f')](_0x36b7de);return rpc[_0x51b271+'Message']['create'](_0x5256ad)[_0x214b('0x2c')](function(_0x472d18){logger[_0x214b('0x21')](_0x214b('0xc'),_0x30867e,_0x5256ad['body']);if(_0x36b7de[_0x214b('0x27')][_0x214b('0x2d')]['endConversation']){_0x188bab['next']();}else{_0x188bab[_0x214b('0x23')]();}})[_0x214b('0x1d')](function(_0x2d7aea){logger['error'](_0x214b('0xc'),_0x30867e,JSON['stringify'](_0x2d7aea));_0x188bab['next']();});})[_0x214b('0x1d')](function(_0x361ed2){logger[_0x214b('0x1e')](_0x214b('0xc'),_0x30867e,_0x361ed2[_0x214b('0x25')]);_0x188bab[_0x214b('0xd')]();});}}catch(_0x351ac7){logger[_0x214b('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x30867e,JSON['stringify'](_0x351ac7));_0x188bab[_0x214b('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2154dfd..b5010df 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7429=['account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','fields','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','md5','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','chat','ChatWebsiteId'];(function(_0x5a273c,_0x4084c6){var _0x53d8ae=function(_0x4f6ca6){while(--_0x4f6ca6){_0x5a273c['push'](_0x5a273c['shift']());}};_0x53d8ae(++_0x4084c6);}(_0x7429,0x6f));var _0x9742=function(_0x42d5eb,_0x49210d){_0x42d5eb=_0x42d5eb-0x0;var _0x4e5c92=_0x7429[_0x42d5eb];return _0x4e5c92;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x9742('0x0'));var moment=require('moment');var Promise=require(_0x9742('0x1'));var logger=require(_0x9742('0x2'))('routing');var utils=require(_0x9742('0x3'));var rpc={'chatMessage':require(_0x9742('0x4')),'openchannelMessage':require(_0x9742('0x5')),'mailMessage':require(_0x9742('0x6')),'smsMessage':require(_0x9742('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0xaae8db,_0x380390,_0x4ead4b,_0x240a9f){return new Promise(function(_0x257625,_0x5af649){var _0x3ceed4=_[_0x9742('0x8')](_0x4ead4b);_0x3ceed4[_0x9742('0x9')]=_0x240a9f;return rpc[_0x380390+'Message'][_0x9742('0xa')](_0x3ceed4)['then'](function(){logger[_0x9742('0xb')](_0x9742('0xc'),_0xaae8db,_0x3ceed4['body']);_0x257625();})[_0x9742('0xd')](function(_0x247b0){logger[_0x9742('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0xaae8db,JSON[_0x9742('0xf')](_0x247b0));_0x5af649(_0x247b0);});});}exports[_0x9742('0x10')]=function(_0x405327,_0x5adbd2){return function(_0x3e2821){try{if(!_[_0x9742('0x11')](this['interaction'][_0x9742('0x12')])){logger[_0x9742('0xb')](_0x9742('0xc'),_0x405327,_0x9742('0x13'));return _0x3e2821[_0x9742('0x14')]();}var _0x50af96={'ContactId':this[_0x9742('0x15')]['id'],'sentAt':moment()['format'](_0x9742('0x16')),'direction':_0x9742('0x17')};if(this[_0x9742('0x18')]===_0x9742('0x19')||this[_0x9742('0x18')]==='whatsapp'){_0x50af96['phone']=this[_0x9742('0x1a')]['phone'];}var _0x224fea=this[_0x9742('0x18')];if(_0x224fea===_0x9742('0x1b')){_0x50af96[_0x9742('0x1c')]=this[_0x9742('0x1d')]['id'];}else{_0x50af96[_[_0x9742('0x1e')](_0x224fea)+_0x9742('0x1f')]=this[_0x9742('0x1d')]['id'];}_0x50af96[_['upperFirst'](_0x224fea)+_0x9742('0x20')]=this[_0x9742('0x1a')]['id'];if(this[_0x9742('0x1a')][_0x9742('0x21')]){var _0x4ce0f8=_0x5adbd2[0x4];if(!_[_0x9742('0x22')](_0x4ce0f8)){_0x50af96[_0x9742('0x9')]=utils['getMustacheRender'](_0x4ce0f8,this);return rpc[_0x224fea+_0x9742('0x23')][_0x9742('0xa')](_0x50af96)[_0x9742('0x24')](function(_0x5b3d8c){logger[_0x9742('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x405327,_0x50af96[_0x9742('0x9')]);})[_0x9742('0xd')](function(_0x183281){logger[_0x9742('0xe')](_0x9742('0xc'),_0x405327,JSON[_0x9742('0xf')](_0x183281));})[_0x9742('0x25')](function(){logger['info'](_0x9742('0x26'),_0x405327);_0x3e2821[_0x9742('0x27')]();});}else{logger[_0x9742('0xb')](_0x9742('0x28'),_0x405327);_0x3e2821['stop']();}}else{var _0x588fb4=this;var _0x146974=_0x5adbd2[0x2][_0x9742('0x29')](/\\n/g,'\x0a');var _0x4b25b7={'credentials':{'private_key':_0x146974,'client_email':_0x5adbd2[0x1]}};var _0x4a2040=new dialogflow[(_0x9742('0x2a'))](_0x4b25b7);var _0x25c237=_0x4a2040[_0x9742('0x2b')](_0x5adbd2[0x0],md5(_0x588fb4['interaction']['id']));var _0x53aa3b={'session':_0x25c237,'queryInput':{'text':{'text':_0x588fb4[_0x9742('0x2c')]['body'],'languageCode':_0x5adbd2[0x3]||'en'}}};return _0x4a2040[_0x9742('0x2d')](_0x53aa3b)['then'](function(_0x166816){if(_0x166816&&_0x166816[_0x9742('0x2e')]){_0x588fb4[_0x9742('0x9')][_0x9742('0x2f')]=_0x166816;var _0x5155ae=_0x166816[0x0];var _0xf4edf6=_0x5155ae[_0x9742('0x30')]['diagnosticInfo']&&_0x5155ae[_0x9742('0x30')]['diagnosticInfo'][_0x9742('0x31')]?_0x5155ae[_0x9742('0x30')][_0x9742('0x32')][_0x9742('0x31')][_0x9742('0x33')][_0x9742('0x34')]:![];_0x588fb4[_0x9742('0x9')][_0x9742('0x35')]=_0x5155ae[_0x9742('0x30')][_0x9742('0x36')];_0x588fb4[_0x9742('0x9')][_0x9742('0x37')]=_0x5155ae['queryResult'][_0x9742('0x38')];_0x588fb4[_0x9742('0x9')][_0x9742('0x39')]=_0x5155ae[_0x9742('0x30')][_0x9742('0x32')]&&_0x5155ae[_0x9742('0x30')][_0x9742('0x32')][_0x9742('0x31')]?_0x5155ae[_0x9742('0x30')]['diagnosticInfo'][_0x9742('0x31')]['end_conversation'][_0x9742('0x34')]:![];_0x588fb4[_0x9742('0x9')]['DIALOGFLOWV2_INTENTNAME']=_0x5155ae[_0x9742('0x30')][_0x9742('0x3a')][_0x9742('0x3b')];_0x588fb4[_0x9742('0x9')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5155ae['queryResult'][_0x9742('0x3a')][_0x9742('0x3c')];_0x588fb4[_0x9742('0x9')][_0x9742('0x3d')]=_0x5155ae['queryResult'][_0x9742('0x3a')][_0x9742('0x3e')];_0x588fb4[_0x9742('0x9')]['DIALOGFLOWV2_LANGUAGECODE']=_0x5155ae[_0x9742('0x30')][_0x9742('0x3f')];_0x588fb4[_0x9742('0x9')][_0x9742('0x40')]=_0x5155ae[_0x9742('0x30')][_0x9742('0x41')];_0x588fb4[_0x9742('0x9')]['DIALOGFLOWV2_SCORE']=_0x5155ae[_0x9742('0x30')][_0x9742('0x42')];_0x50af96['providerName']=_0x9742('0x2f');_0x50af96[_0x9742('0x43')]=JSON[_0x9742('0xf')](_0x166816);var _0x269c2c=[];for(var _0x48556d=0x0;_0x48556d<_0x166816[_0x9742('0x2e')];_0x48556d++){var _0x315832=_0x166816[_0x48556d];if(_0x315832&&_0x315832[_0x9742('0x30')]&&_0x315832[_0x9742('0x30')][_0x9742('0x44')]){_0x269c2c[_0x9742('0x45')](createMessage(_0x405327,_0x224fea,_0x50af96,_0x315832[_0x9742('0x30')][_0x9742('0x44')]));}}return Promise['all'](_0x269c2c)[_0x9742('0x24')](function(){if(_0xf4edf6){_0x3e2821['next']();}else{_0x3e2821[_0x9742('0x27')]();}})[_0x9742('0xd')](function(_0x1772a0){logger[_0x9742('0xe')](_0x9742('0xc'),_0x405327,JSON[_0x9742('0xf')](_0x1772a0));_0x3e2821['next']();});}})[_0x9742('0xd')](function(_0x3915d0){logger[_0x9742('0xe')](_0x9742('0xc'),_0x405327,_0x3915d0[_0x9742('0x2c')]);_0x3e2821[_0x9742('0x14')]();});}}catch(_0x1d6c5c){logger[_0x9742('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x405327,JSON[_0x9742('0xf')](_0x1d6c5c));_0x3e2821[_0x9742('0x27')]();}};}; \ No newline at end of file +var _0xc305=['create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','stringify','fulfillmentText','all','message','lodash','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body'];(function(_0x541152,_0x4c4d20){var _0x188bd3=function(_0xa8d128){while(--_0xa8d128){_0x541152['push'](_0x541152['shift']());}};_0x188bd3(++_0x4c4d20);}(_0xc305,0xcf));var _0x5c30=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xc305[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x5c30('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x5c30('0x1'));var Promise=require(_0x5c30('0x2'));var logger=require('../../../../config/logger')(_0x5c30('0x3'));var utils=require(_0x5c30('0x4'));var rpc={'chatMessage':require(_0x5c30('0x5')),'openchannelMessage':require(_0x5c30('0x6')),'mailMessage':require(_0x5c30('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5c30('0x8')),'whatsappMessage':require(_0x5c30('0x9'))};function createMessage(_0x175135,_0x2b436c,_0x3d6598,_0x1d6f15){return new Promise(function(_0x37aeb9,_0x11a01f){var _0x4f49e0=_[_0x5c30('0xa')](_0x3d6598);_0x4f49e0[_0x5c30('0xb')]=_0x1d6f15;return rpc[_0x2b436c+'Message'][_0x5c30('0xc')](_0x4f49e0)[_0x5c30('0xd')](function(){logger[_0x5c30('0xe')](_0x5c30('0xf'),_0x175135,_0x4f49e0[_0x5c30('0xb')]);_0x37aeb9();})['catch'](function(_0x362765){logger[_0x5c30('0x10')](_0x5c30('0xf'),_0x175135,JSON['stringify'](_0x362765));_0x11a01f(_0x362765);});});}exports[_0x5c30('0x11')]=function(_0x14a8a8,_0x40616e){return function(_0x3b37ee){try{if(!_[_0x5c30('0x12')](this['interaction'][_0x5c30('0x13')])){logger[_0x5c30('0xe')](_0x5c30('0xf'),_0x14a8a8,_0x5c30('0x14'));return _0x3b37ee[_0x5c30('0x15')]();}var _0x21e1dd={'ContactId':this[_0x5c30('0x16')]['id'],'sentAt':moment()['format'](_0x5c30('0x17')),'direction':'out'};if(this[_0x5c30('0x18')]===_0x5c30('0x19')||this[_0x5c30('0x18')]===_0x5c30('0x1a')){_0x21e1dd[_0x5c30('0x1b')]=this[_0x5c30('0x1c')][_0x5c30('0x1b')];}var _0xe7db37=this[_0x5c30('0x18')];if(_0xe7db37===_0x5c30('0x1d')){_0x21e1dd[_0x5c30('0x1e')]=this['account']['id'];}else{_0x21e1dd[_[_0x5c30('0x1f')](_0xe7db37)+_0x5c30('0x20')]=this['account']['id'];}_0x21e1dd[_[_0x5c30('0x1f')](_0xe7db37)+_0x5c30('0x21')]=this['interaction']['id'];if(this[_0x5c30('0x1c')][_0x5c30('0x22')]){var _0x3cf6b4=_0x40616e[0x4];if(!_['isEmpty'](_0x3cf6b4)){_0x21e1dd[_0x5c30('0xb')]=utils[_0x5c30('0x23')](_0x3cf6b4,this);return rpc[_0xe7db37+'Message']['create'](_0x21e1dd)[_0x5c30('0xd')](function(_0x1b4d11){logger[_0x5c30('0xe')](_0x5c30('0xf'),_0x14a8a8,_0x21e1dd['body']);})[_0x5c30('0x24')](function(_0x268b8f){logger[_0x5c30('0x10')](_0x5c30('0xf'),_0x14a8a8,JSON['stringify'](_0x268b8f));})[_0x5c30('0x25')](function(){logger[_0x5c30('0xe')](_0x5c30('0x26'),_0x14a8a8);_0x3b37ee[_0x5c30('0x27')]();});}else{logger[_0x5c30('0xe')](_0x5c30('0x28'),_0x14a8a8);_0x3b37ee['stop']();}}else{var _0x43369c=this;var _0x5546b9=_0x40616e[0x2][_0x5c30('0x29')](/\\n/g,'\x0a');var _0x44b4b6={'credentials':{'private_key':_0x5546b9,'client_email':_0x40616e[0x1]}};var _0x219a05=new dialogflow[(_0x5c30('0x2a'))](_0x44b4b6);var _0x4041a5=_0x219a05[_0x5c30('0x2b')](_0x40616e[0x0],md5(_0x43369c[_0x5c30('0x1c')]['id']));var _0x5cf814={'session':_0x4041a5,'queryInput':{'text':{'text':_0x43369c['message']['body'],'languageCode':_0x40616e[0x3]||'en'}}};return _0x219a05[_0x5c30('0x2c')](_0x5cf814)[_0x5c30('0xd')](function(_0x2be404){if(_0x2be404&&_0x2be404[_0x5c30('0x2d')]){_0x43369c[_0x5c30('0xb')][_0x5c30('0x2e')]=_0x2be404;var _0x13e84c=_0x2be404[0x0];var _0x12c3ef=_0x13e84c[_0x5c30('0x2f')][_0x5c30('0x30')]&&_0x13e84c['queryResult']['diagnosticInfo'][_0x5c30('0x31')]?_0x13e84c[_0x5c30('0x2f')]['diagnosticInfo']['fields'][_0x5c30('0x32')]['boolValue']:![];_0x43369c['body'][_0x5c30('0x33')]=_0x13e84c[_0x5c30('0x2f')][_0x5c30('0x34')];_0x43369c[_0x5c30('0xb')][_0x5c30('0x35')]=_0x13e84c[_0x5c30('0x2f')][_0x5c30('0x36')];_0x43369c['body'][_0x5c30('0x37')]=_0x13e84c[_0x5c30('0x2f')][_0x5c30('0x30')]&&_0x13e84c['queryResult'][_0x5c30('0x30')][_0x5c30('0x31')]?_0x13e84c[_0x5c30('0x2f')][_0x5c30('0x30')][_0x5c30('0x31')][_0x5c30('0x32')][_0x5c30('0x38')]:![];_0x43369c[_0x5c30('0xb')][_0x5c30('0x39')]=_0x13e84c['queryResult'][_0x5c30('0x3a')]['name'];_0x43369c[_0x5c30('0xb')][_0x5c30('0x3b')]=_0x13e84c['queryResult'][_0x5c30('0x3a')]['displayName'];_0x43369c['body'][_0x5c30('0x3c')]=_0x13e84c[_0x5c30('0x2f')][_0x5c30('0x3a')][_0x5c30('0x3d')];_0x43369c[_0x5c30('0xb')][_0x5c30('0x3e')]=_0x13e84c['queryResult'][_0x5c30('0x3f')];_0x43369c['body'][_0x5c30('0x40')]=_0x13e84c['queryResult'][_0x5c30('0x41')];_0x43369c[_0x5c30('0xb')][_0x5c30('0x42')]=_0x13e84c[_0x5c30('0x2f')]['intentDetectionConfidence'];_0x21e1dd[_0x5c30('0x43')]='dialogflowV2';_0x21e1dd[_0x5c30('0x44')]=JSON[_0x5c30('0x45')](_0x2be404);var _0xda3e1=[];for(var _0x14116b=0x0;_0x14116b<_0x2be404['length'];_0x14116b++){var _0xb80b34=_0x2be404[_0x14116b];if(_0xb80b34&&_0xb80b34[_0x5c30('0x2f')]&&_0xb80b34[_0x5c30('0x2f')][_0x5c30('0x46')]){_0xda3e1['push'](createMessage(_0x14a8a8,_0xe7db37,_0x21e1dd,_0xb80b34['queryResult'][_0x5c30('0x46')]));}}return Promise[_0x5c30('0x47')](_0xda3e1)[_0x5c30('0xd')](function(){if(_0x12c3ef){_0x3b37ee[_0x5c30('0x15')]();}else{_0x3b37ee[_0x5c30('0x27')]();}})[_0x5c30('0x24')](function(_0x4d9203){logger[_0x5c30('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x14a8a8,JSON['stringify'](_0x4d9203));_0x3b37ee[_0x5c30('0x15')]();});}})[_0x5c30('0x24')](function(_0x585806){logger[_0x5c30('0x10')](_0x5c30('0xf'),_0x14a8a8,_0x585806[_0x5c30('0x48')]);_0x3b37ee[_0x5c30('0x15')]();});}}catch(_0x3630a3){logger[_0x5c30('0x10')](_0x5c30('0xf'),_0x14a8a8,JSON[_0x5c30('0x45')](_0x3630a3));_0x3b37ee['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 7624f90..07b530c 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0951=['number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number'];(function(_0x5b1db5,_0x559cd7){var _0x39995c=function(_0x18c72f){while(--_0x18c72f){_0x5b1db5['push'](_0x5b1db5['shift']());}};_0x39995c(++_0x559cd7);}(_0x0951,0x172));var _0x1095=function(_0x57ccd4,_0x1f326d){_0x57ccd4=_0x57ccd4-0x0;var _0xe17b6e=_0x0951[_0x57ccd4];return _0xe17b6e;};'use strict';var schema=require(_0x1095('0x0'));var _=require(_0x1095('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x1095('0x2'));var logger=require(_0x1095('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x1095('0x4'),'required':!![],'message':_0x1095('0x5')},'priorityTrue':{'type':'number','message':_0x1095('0x6')},'priorityFalse':{'type':_0x1095('0x7'),'message':_0x1095('0x8')}});exports[_0x1095('0x9')]=function(_0x50d6a4,_0x37a2e7){return function(_0x12d525){try{var _0x3457ab={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x37a2e7[0x0],this),{'wordwrap':![]})[_0x1095('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x37a2e7[0x1],'priorityFalse':_0x37a2e7[0x2]};var _0x1c9679=gotoif[_0x1095('0x0')](_0x3457ab,{'typecast':!![]});if(_0x1c9679[_0x1095('0xb')]){logger[_0x1095('0xc')](_0x1095('0xd'),_0x50d6a4,_[_0x1095('0xe')](_0x1c9679,_0x1095('0xf'))[_0x1095('0x10')](',\x20'));_0x12d525[_0x1095('0x11')]();}else{try{var _0xf3049f=eval('('+_0x3457ab[_0x1095('0x12')]+')');var _0x589e19=_0xf3049f?_0x3457ab[_0x1095('0x13')]:_0x3457ab[_0x1095('0x14')];logger[_0x1095('0x15')](_0x1095('0x16'),_0x50d6a4,_0x3457ab['condition'],_0xf3049f,_0x589e19||_0x1095('0x17'));if(_0x589e19){var _0x4eaa9e=_[_0x1095('0x18')](_0x12d525[_0x1095('0x19')](),{'p':_0x589e19});if(_0x4eaa9e>=0x0){logger['info'](_0x1095('0x1a'),_0x50d6a4,_0x589e19||_0x1095('0x17'),_0x4eaa9e);_0x12d525[_0x1095('0x17')](_0x4eaa9e);}else{logger[_0x1095('0x15')](_0x1095('0x1b'),_0x50d6a4,_0x589e19||_0x1095('0x17'));_0x12d525[_0x1095('0x11')]();}}else{_0x12d525['next']();}}catch(_0x2e8c21){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x50d6a4,_0x2e8c21[_0x1095('0xf')]);_0x12d525[_0x1095('0x11')]();}}}catch(_0x7a7aff){logger[_0x1095('0xc')](_0x1095('0xd'),_0x50d6a4,JSON[_0x1095('0x1c')](_0x7a7aff));_0x12d525[_0x1095('0x11')]();}};}; \ No newline at end of file +var _0xb454=['condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0xf4251f,_0x5d37e8){var _0x2f1248=function(_0x169cae){while(--_0x169cae){_0xf4251f['push'](_0xf4251f['shift']());}};_0x2f1248(++_0x5d37e8);}(_0xb454,0x199));var _0x4b45=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb454[_0x166d93];return _0xba708;};'use strict';var schema=require('validate');var _=require(_0x4b45('0x0'));var htmlToText=require(_0x4b45('0x1'));var utils=require(_0x4b45('0x2'));var logger=require(_0x4b45('0x3'))(_0x4b45('0x4'));var gotoif=schema({'condition':{'type':_0x4b45('0x5'),'required':!![],'message':_0x4b45('0x6')},'priorityTrue':{'type':_0x4b45('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x4b45('0x7'),'message':_0x4b45('0x8')}});exports[_0x4b45('0x9')]=function(_0xf3a31d,_0x34c475){return function(_0x4a7d38){try{var _0xc3a209={'condition':htmlToText[_0x4b45('0xa')](utils[_0x4b45('0xb')](_0x34c475[0x0],this),{'wordwrap':![]})[_0x4b45('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x34c475[0x1],'priorityFalse':_0x34c475[0x2]};var _0x1793b8=gotoif[_0x4b45('0xd')](_0xc3a209,{'typecast':!![]});if(_0x1793b8[_0x4b45('0xe')]){logger[_0x4b45('0xf')](_0x4b45('0x10'),_0xf3a31d,_[_0x4b45('0x11')](_0x1793b8,_0x4b45('0x12'))[_0x4b45('0x13')](',\x20'));_0x4a7d38['stop']();}else{try{var _0x5bdcbb=eval('('+_0xc3a209[_0x4b45('0x14')]+')');var _0x49e8c8=_0x5bdcbb?_0xc3a209[_0x4b45('0x15')]:_0xc3a209[_0x4b45('0x16')];logger[_0x4b45('0x17')](_0x4b45('0x18'),_0xf3a31d,_0xc3a209[_0x4b45('0x14')],_0x5bdcbb,_0x49e8c8||'next');if(_0x49e8c8){var _0x1f407e=_[_0x4b45('0x19')](_0x4a7d38[_0x4b45('0x1a')](),{'p':_0x49e8c8});if(_0x1f407e>=0x0){logger[_0x4b45('0x17')](_0x4b45('0x1b'),_0xf3a31d,_0x49e8c8||'next',_0x1f407e);_0x4a7d38[_0x4b45('0x1c')](_0x1f407e);}else{logger[_0x4b45('0x17')](_0x4b45('0x1d'),_0xf3a31d,_0x49e8c8||_0x4b45('0x1c'));_0x4a7d38[_0x4b45('0x1e')]();}}else{_0x4a7d38['next']();}}catch(_0x55a9ec){logger[_0x4b45('0xf')](_0x4b45('0x1f'),_0xf3a31d,_0x55a9ec[_0x4b45('0x12')]);_0x4a7d38[_0x4b45('0x1e')]();}}}catch(_0x13d1bb){logger[_0x4b45('0xf')](_0x4b45('0x10'),_0xf3a31d,JSON[_0x4b45('0x20')](_0x13d1bb));_0x4a7d38[_0x4b45('0x1e')]();}};}; \ 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 89375db..5742f90 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 _0xc7d9=['error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','join','stop','findIndex','rules','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x5c6e2d,_0x1b807b){var _0x11725c=function(_0x4895d5){while(--_0x4895d5){_0x5c6e2d['push'](_0x5c6e2d['shift']());}};_0x11725c(++_0x1b807b);}(_0xc7d9,0xb6));var _0x9c7d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc7d9[_0x1035c1];return _0x308d67;};'use strict';var schema=require(_0x9c7d('0x0'));var _=require('lodash');var logger=require(_0x9c7d('0x1'))(_0x9c7d('0x2'));var gotop=schema({'priority':{'type':_0x9c7d('0x3'),'required':!![],'message':_0x9c7d('0x4')}});exports[_0x9c7d('0x5')]=function(_0x5a1366,_0x4e320e){return function(_0x3e80ce){try{var _0x304143={'priority':_0x4e320e[0x0]};var _0x3de0d3=gotop['validate'](_0x304143,{'typecast':!![]});if(_0x3de0d3['length']){logger['error'](_0x9c7d('0x6'),_0x5a1366,_['map'](_0x3de0d3,'message')[_0x9c7d('0x7')](',\x20'));_0x3e80ce[_0x9c7d('0x8')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x5a1366,_0x304143['priority']);if(_0x304143['priority']){var _0xb8dea3=_[_0x9c7d('0x9')](_0x3e80ce[_0x9c7d('0xa')](),{'p':_0x304143[_0x9c7d('0xb')]});if(_0xb8dea3>=0x0){logger[_0x9c7d('0xc')](_0x9c7d('0xd'),_0x5a1366,_0x304143[_0x9c7d('0xb')]||_0x9c7d('0xe'),_0xb8dea3);_0x3e80ce[_0x9c7d('0xe')](_0xb8dea3);}else{logger[_0x9c7d('0xc')](_0x9c7d('0xf'),_0x5a1366,_0x304143[_0x9c7d('0xb')]||_0x9c7d('0xe'));_0x3e80ce[_0x9c7d('0x8')]();}}else{_0x3e80ce[_0x9c7d('0xe')]();}}}catch(_0x6cb3eb){logger[_0x9c7d('0x10')](_0x9c7d('0x6'),_0x5a1366,JSON[_0x9c7d('0x11')](_0x6cb3eb));_0x3e80ce[_0x9c7d('0x8')]();}};}; \ No newline at end of file +var _0x21fb=['[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','stringify','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','message','join','info'];(function(_0x2d7d52,_0x5b286d){var _0x4cf280=function(_0x47a049){while(--_0x47a049){_0x2d7d52['push'](_0x2d7d52['shift']());}};_0x4cf280(++_0x5b286d);}(_0x21fb,0x183));var _0xb21f=function(_0x53ad64,_0x513878){_0x53ad64=_0x53ad64-0x0;var _0x504357=_0x21fb[_0x53ad64];return _0x504357;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xb21f('0x0'))(_0xb21f('0x1'));var gotop=schema({'priority':{'type':_0xb21f('0x2'),'required':!![],'message':_0xb21f('0x3')}});exports[_0xb21f('0x4')]=function(_0x5aa2b8,_0x1b9ce7){return function(_0x5d0166){try{var _0x3f49c6={'priority':_0x1b9ce7[0x0]};var _0x4e2396=gotop[_0xb21f('0x5')](_0x3f49c6,{'typecast':!![]});if(_0x4e2396[_0xb21f('0x6')]){logger['error'](_0xb21f('0x7'),_0x5aa2b8,_[_0xb21f('0x8')](_0x4e2396,_0xb21f('0x9'))[_0xb21f('0xa')](',\x20'));_0x5d0166['stop']();}else{logger[_0xb21f('0xb')](_0xb21f('0xc'),_0x5aa2b8,_0x3f49c6[_0xb21f('0xd')]);if(_0x3f49c6[_0xb21f('0xd')]){var _0x57715d=_['findIndex'](_0x5d0166[_0xb21f('0xe')](),{'p':_0x3f49c6[_0xb21f('0xd')]});if(_0x57715d>=0x0){logger['info'](_0xb21f('0xf'),_0x5aa2b8,_0x3f49c6[_0xb21f('0xd')]||_0xb21f('0x10'),_0x57715d);_0x5d0166['next'](_0x57715d);}else{logger[_0xb21f('0xb')](_0xb21f('0x11'),_0x5aa2b8,_0x3f49c6['priority']||_0xb21f('0x10'));_0x5d0166[_0xb21f('0x12')]();}}else{_0x5d0166[_0xb21f('0x10')]();}}}catch(_0x1c2190){logger[_0xb21f('0x13')](_0xb21f('0x7'),_0x5aa2b8,JSON[_0xb21f('0x14')](_0x1c2190));_0x5d0166[_0xb21f('0x12')]();}};}; \ 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 2520f5b..165f055 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 _0x11fa=['Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId'];(function(_0x1c37a5,_0x59ee51){var _0x389d03=function(_0x51b4f4){while(--_0x51b4f4){_0x1c37a5['push'](_0x1c37a5['shift']());}};_0x389d03(++_0x59ee51);}(_0x11fa,0xa0));var _0xa11f=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x11fa[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xa11f('0x0'));var utils=require(_0xa11f('0x1'));var logger=require(_0xa11f('0x2'))(_0xa11f('0x3'));var rpc={'chatMessage':require(_0xa11f('0x4')),'openchannelMessage':require(_0xa11f('0x5')),'mailMessage':require(_0xa11f('0x6')),'smsMessage':require(_0xa11f('0x7')),'faxMessage':require(_0xa11f('0x8')),'whatsappMessage':require(_0xa11f('0x9'))};exports[_0xa11f('0xa')]=function(_0x2e79f3,_0x550d8c){return function(_0x4e42d3){try{var _0x10d3be={'body':utils[_0xa11f('0xb')](_0x550d8c[0x0],this),'ContactId':this[_0xa11f('0xc')]['id']};if(this[_0xa11f('0xd')]===_0xa11f('0xe')){_0x10d3be[_0xa11f('0xf')]=this['account']['id'];}else{_0x10d3be[_[_0xa11f('0x10')](this[_0xa11f('0xd')])+_0xa11f('0x11')]=this[_0xa11f('0x12')]['id'];}_0x10d3be[_[_0xa11f('0x10')](this[_0xa11f('0xd')])+_0xa11f('0x13')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xa11f('0xd')]+_0xa11f('0x14')][_0xa11f('0x15')](_0x10d3be)[_0xa11f('0x16')](function(_0x426aa5){logger[_0xa11f('0x17')](_0xa11f('0x18'),_0x2e79f3,_0x10d3be[_0xa11f('0x19')]);_0x4e42d3['next']();})[_0xa11f('0x1a')](function(_0x197738){logger[_0xa11f('0x1b')](_0xa11f('0x18'),_0x2e79f3,JSON[_0xa11f('0x1c')](_0x197738));_0x4e42d3[_0xa11f('0x1d')]();});}}catch(_0x5e1e4e){logger['error']('[%s][MESSAGE]\x20%s',_0x2e79f3,JSON[_0xa11f('0x1c')](_0x5e1e4e));_0x4e42d3['stop']();}};}; \ No newline at end of file +var _0x15fd=['next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x15fd,0x1d4));var _0xd15f=function(_0x3eb633,_0x70b930){_0x3eb633=_0x3eb633-0x0;var _0x36a43b=_0x15fd[_0x3eb633];return _0x36a43b;};'use strict';var _=require(_0xd15f('0x0'));var utils=require(_0xd15f('0x1'));var logger=require(_0xd15f('0x2'))(_0xd15f('0x3'));var rpc={'chatMessage':require(_0xd15f('0x4')),'openchannelMessage':require(_0xd15f('0x5')),'mailMessage':require(_0xd15f('0x6')),'smsMessage':require(_0xd15f('0x7')),'faxMessage':require(_0xd15f('0x8')),'whatsappMessage':require(_0xd15f('0x9'))};exports['consequence']=function(_0x287230,_0x5dbd6d){return function(_0x4f0d69){try{var _0x1e9b68={'body':utils[_0xd15f('0xa')](_0x5dbd6d[0x0],this),'ContactId':this[_0xd15f('0xb')]['id']};if(this[_0xd15f('0xc')]===_0xd15f('0xd')){_0x1e9b68[_0xd15f('0xe')]=this[_0xd15f('0xf')]['id'];}else{_0x1e9b68[_[_0xd15f('0x10')](this[_0xd15f('0xc')])+_0xd15f('0x11')]=this[_0xd15f('0xf')]['id'];}_0x1e9b68[_[_0xd15f('0x10')](this['channel'])+'InteractionId']=this[_0xd15f('0x12')]['id'];if(rpc[this['channel']+_0xd15f('0x13')]){return rpc[this['channel']+'Message'][_0xd15f('0x14')](_0x1e9b68)[_0xd15f('0x15')](function(_0x4317c7){logger[_0xd15f('0x16')](_0xd15f('0x17'),_0x287230,_0x1e9b68[_0xd15f('0x18')]);_0x4f0d69[_0xd15f('0x19')]();})['catch'](function(_0x38bd88){logger[_0xd15f('0x1a')](_0xd15f('0x17'),_0x287230,JSON[_0xd15f('0x1b')](_0x38bd88));_0x4f0d69[_0xd15f('0x1c')]();});}}catch(_0x5356f1){logger[_0xd15f('0x1a')]('[%s][MESSAGE]\x20%s',_0x287230,JSON[_0xd15f('0x1b')](_0x5356f1));_0x4f0d69[_0xd15f('0x1c')]();}};}; \ 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 10768c1..f406d8b 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 _0x701a=['stop','./utils','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x1dad80,_0x8c40e1){var _0x26fc90=function(_0x388fc6){while(--_0x388fc6){_0x1dad80['push'](_0x1dad80['shift']());}};_0x26fc90(++_0x8c40e1);}(_0x701a,0x157));var _0xa701=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x701a[_0x12d033];return _0x3b4e80;};'use strict';var utils=require(_0xa701('0x0'));var logger=require('../../../../config/logger')(_0xa701('0x1'));exports['consequence']=function(_0x4e7cda,_0xa73538){return function(_0x50b0cc){try{logger[_0xa701('0x2')](_0xa701('0x3'),_0x4e7cda,utils[_0xa701('0x4')](_0xa73538[0x0],this));_0x50b0cc[_0xa701('0x5')]();}catch(_0x4810df){logger[_0xa701('0x6')](_0xa701('0x3'),_0x4e7cda,JSON[_0xa701('0x7')](_0x4810df));_0x50b0cc[_0xa701('0x8')]();}};}; \ No newline at end of file +var _0x6703=['[%s][NOOP]\x20%s','stop','./utils','../../../../config/logger','routing','consequence','info','next','error'];(function(_0x257896,_0x8de612){var _0x1ff242=function(_0x8ea06a){while(--_0x8ea06a){_0x257896['push'](_0x257896['shift']());}};_0x1ff242(++_0x8de612);}(_0x6703,0xf5));var _0x3670=function(_0x272156,_0x5e4b0d){_0x272156=_0x272156-0x0;var _0x1071d0=_0x6703[_0x272156];return _0x1071d0;};'use strict';var utils=require(_0x3670('0x0'));var logger=require(_0x3670('0x1'))(_0x3670('0x2'));exports[_0x3670('0x3')]=function(_0x5c0d0a,_0x339ecc){return function(_0x296b81){try{logger[_0x3670('0x4')]('[%s][NOOP]\x20%s',_0x5c0d0a,utils['getMustacheRender'](_0x339ecc[0x0],this));_0x296b81[_0x3670('0x5')]();}catch(_0x6e7bf0){logger[_0x3670('0x6')](_0x3670('0x7'),_0x5c0d0a,JSON['stringify'](_0x6e7bf0));_0x296b81[_0x3670('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 51cd4b0..7523cac 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 _0xe7e1=['close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','routing','./strategy','redis','defaults','queue_id','queue','from','joinAt','clone','account','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xe7e1,0x185));var _0x1e7e=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe7e1[_0x4b2436];return _0x4f5ab2;};'use strict';var schema=require(_0x1e7e('0x0'));var _=require(_0x1e7e('0x1'));var util=require(_0x1e7e('0x2'));var seqqueue=require(_0x1e7e('0x3'));var moment=require(_0x1e7e('0x4'));var Redis=require('ioredis');var config=require(_0x1e7e('0x5'));var logger=require('../../../../config/logger')(_0x1e7e('0x6'));var strategy=require(_0x1e7e('0x7'));config[_0x1e7e('0x8')]=_[_0x1e7e('0x9')](config[_0x1e7e('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x1e7e('0xa'),'account',_0x1e7e('0xb'),_0x1e7e('0xc'),_0x1e7e('0xd')];function emit(_0x27ffd8,_0x3d8787,_0xaca878){io['to'](_0x27ffd8)['emit'](_0x3d8787,_0xaca878);}function emitChannelQueueInteraction(_0x4634f1,_0xf9d787,_0x66e5c5,_0x545ce4,_0x1cb8b9,_0x236600,_0x3e2e3a,_0x156dc9){var _0x1ba1b7=_[_0x1e7e('0xe')](_0x66e5c5);_0x1ba1b7[_0x1e7e('0xa')]=_0x156dc9;_0x1ba1b7['queue']=_0xf9d787;_0x1ba1b7[_0x1e7e('0xf')]=_0x545ce4;_0x1ba1b7['id']=_0x1cb8b9;if(_0x236600){_0x3e2e3a[util[_0x1e7e('0x10')]('%sQueuesWaitingInteractions',_0x4634f1)][_0x1cb8b9]=_['pick'](_0x1ba1b7,attributes);}else{delete _0x3e2e3a[util[_0x1e7e('0x10')](_0x1e7e('0x11'),_0x4634f1)][_0x1cb8b9];}emit(util[_0x1e7e('0x10')](_0x1e7e('0x12'),_0x4634f1,_0xf9d787),util['format'](_0x1e7e('0x13'),_0x4634f1,_0x236600?_0x1e7e('0x14'):_0x1e7e('0x15')),_['pick'](_0x1ba1b7,attributes));}var rpc={'openchannelQueueReport':require(_0x1e7e('0x16')),'mailQueueReport':require(_0x1e7e('0x17')),'chatQueueReport':require(_0x1e7e('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x1e7e('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x1e7e('0x1a')},'timeout':{'type':'number','message':_0x1e7e('0x1b')}});function startRouting(_0x36602c,_0x1f822c,_0x413959,_0x16a60d){if(_0x36602c&&_0x1f822c&&_0x413959){_0x1f822c[_0x1e7e('0x1c')]+=0x1;var _0x2c0cb5={'uniqueid':_0x36602c,'from':_0x413959[_0x1e7e('0x1d')]?_0x413959['body']['from']:'','joinAt':moment()['format'](_0x1e7e('0x1e')),'ContactId':_0x413959[_0x1e7e('0x1f')]?_0x413959[_0x1e7e('0x1f')]['id']:null,'ListId':_0x413959[_0x1e7e('0x20')]?_0x413959['list']['id']:null};_0x2c0cb5[_[_0x1e7e('0x21')](_0x413959[_0x1e7e('0x22')])+_0x1e7e('0x23')]=_0x1f822c['id']||null;_0x2c0cb5[_[_0x1e7e('0x21')](_0x413959[_0x1e7e('0x22')])+_0x1e7e('0x24')]=_0x413959[_0x1e7e('0x25')]?_0x413959[_0x1e7e('0x25')]['id']:null;_0x2c0cb5[_[_0x1e7e('0x21')](_0x413959['channel'])+_0x1e7e('0x26')]=_0x413959['message']?_0x413959['message']['id']:null;_0x2c0cb5[_[_0x1e7e('0x21')](_0x413959[_0x1e7e('0x22')])+(_0x413959[_0x1e7e('0x22')]!==_0x1e7e('0x27')?_0x1e7e('0x28'):_0x1e7e('0x29'))]=_0x413959[_0x1e7e('0xf')]?_0x413959[_0x1e7e('0xf')]['id']:null;logger[_0x1e7e('0x2a')](util[_0x1e7e('0x10')](_0x1e7e('0x2b'),_0x36602c,_0x1f822c[_0x1e7e('0x2c')]));emitChannelQueueInteraction(_0x413959[_0x1e7e('0x22')],_0x1f822c['name'],_0x2c0cb5,_0x413959[_0x1e7e('0xf')][_0x1e7e('0x2c')],_0x413959[_0x1e7e('0x2d')]['id'],!![],_0x16a60d,_0x1f822c['id']);if(rpc[_0x413959['channel']+'QueueReport']){return rpc[_0x413959[_0x1e7e('0x22')]+_0x1e7e('0x2e')]['create'](_0x2c0cb5)[_0x1e7e('0x2f')](function(_0x436a91){logger[_0x1e7e('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0x211800,_0x587f35,_0x35c645,_0x5c8f09){if(_0x211800&&_0x587f35){_0x587f35['waiting']-=0x1;var _0x1a02a9={'leaveAt':moment()[_0x1e7e('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x1e7e('0x10')](_0x1e7e('0x1e')),'reason':_0x1e7e('0x31')};logger[_0x1e7e('0x2a')](util[_0x1e7e('0x10')](_0x1e7e('0x32'),_0x211800,_0x587f35[_0x1e7e('0x2c')]));emitChannelQueueInteraction(_0x35c645[_0x1e7e('0x22')],_0x587f35[_0x1e7e('0x2c')],_0x35c645[_0x1e7e('0x1d')],_0x35c645[_0x1e7e('0xf')][_0x1e7e('0x2c')],_0x35c645['message']['id'],![],_0x5c8f09,_0x587f35['id']);if(rpc[_0x35c645[_0x1e7e('0x22')]+_0x1e7e('0x2e')]){return rpc[_0x35c645[_0x1e7e('0x22')]+_0x1e7e('0x2e')][_0x1e7e('0x33')](_0x211800,_0x1a02a9)['catch'](function(_0x1b0d41){logger[_0x1e7e('0x30')](_0x1e7e('0x34'));});}}}function endRouting(_0x424400,_0x330c07,_0x4bb229,_0x4003cd){if(_0x424400&&_0x330c07){_0x330c07[_0x1e7e('0x1c')]-=0x1;var _0x542bb7={'leaveAt':moment()[_0x1e7e('0x10')](_0x1e7e('0x1e')),'exitAt':moment()[_0x1e7e('0x10')](_0x1e7e('0x1e')),'reason':_0x1e7e('0x35')};logger[_0x1e7e('0x2a')](util[_0x1e7e('0x10')](_0x1e7e('0x36'),_0x424400,_0x330c07['name']));emitChannelQueueInteraction(_0x4bb229[_0x1e7e('0x22')],_0x330c07[_0x1e7e('0x2c')],_0x4bb229[_0x1e7e('0x1d')],_0x4bb229[_0x1e7e('0xf')][_0x1e7e('0x2c')],_0x4bb229[_0x1e7e('0x2d')]['id'],![],_0x4003cd);if(rpc[_0x4bb229[_0x1e7e('0x22')]+'QueueReport']){return rpc[_0x4bb229[_0x1e7e('0x22')]+_0x1e7e('0x2e')][_0x1e7e('0x33')](_0x424400,_0x542bb7)[_0x1e7e('0x2f')](function(_0x3c3930){logger['error'](_0x1e7e('0x34'));});}}}function handleFindQueue(_0x22f01d){return function(_0x1826f5){return _0x1826f5[_0x1e7e('0x2c')][_0x1e7e('0x37')]()===_0x22f01d[_0x1e7e('0x37')]();};}exports[_0x1e7e('0x38')]=function(_0x174713,_0x26c3e0,_0x54743c,_0x333e21){return function(_0x2e33f6){try{var _0x337f43={'name':_0x26c3e0[0x0],'timeout':_0x26c3e0[0x1]};var _0x30401f=queue[_0x1e7e('0x0')](_0x337f43,{'typecast':!![]});if(_0x30401f['length']){logger[_0x1e7e('0x30')](_0x1e7e('0x39'),_0x174713,_['map'](_0x30401f,_0x1e7e('0x2d'))['join'](',\x20'));_0x2e33f6[_0x1e7e('0x3a')]();}else{var _0x1f9aca=_[_0x1e7e('0x3b')](_0x54743c[_0x333e21['channel']+_0x1e7e('0x3c')],handleFindQueue(_0x337f43[_0x1e7e('0x2c')]));if(_0x1f9aca){startRouting(_0x174713,_0x1f9aca,_0x333e21,_0x54743c);var _0x2e33be=(_0x1f9aca[_0x1e7e('0x35')]||0xa)*0x3e8;var _0x336d07=(_0x337f43[_0x1e7e('0x35')]||0x14)*0x3e8;var _0x32ff8d,_0x82b171;if(_0x2e33be>_0x336d07){_0x336d07=_0x2e33be;}var _0x22c947=seqqueue[_0x1e7e('0x3d')](_0x2e33be);_0x22c947['id']=_0x174713;_0x22c947[_0x1e7e('0x3e')]=_0x2e33be;_0x22c947[_0x1e7e('0x3f')]=_0x336d07;_0x22c947[_0x1e7e('0x22')]=_0x333e21[_0x1e7e('0x22')];_0x54743c[_0x1e7e('0x40')][_0x174713]['on'](_0x1e7e('0x41'),function(){logger['info'](_0x1e7e('0x42'),_0x174713);stopRouting(_0x174713,_0x1f9aca,_0x333e21,_0x54743c);clearTimeout(_0x32ff8d);_0x32ff8d=undefined;_0x22c947[_0x1e7e('0x43')](!![]);if(_0x54743c[_0x1e7e('0x40')][_0x174713]){delete _0x54743c[_0x1e7e('0x40')][_0x174713];}_0x2e33f6['stop']();});_0x54743c['rules'][_0x174713]['on'](_0x1e7e('0x44'),function(){if(_0x54743c['rules'][_0x174713]){delete _0x54743c[_0x1e7e('0x40')][_0x174713];}});_0x32ff8d=setTimeout(function(){logger[_0x1e7e('0x2a')](_0x1e7e('0x45'),_0x174713);endRouting(_0x174713,_0x1f9aca,_0x333e21,_0x54743c);clearTimeout(_0x32ff8d);_0x22c947[_0x1e7e('0x43')](!![]);_0x2e33f6[_0x1e7e('0x46')]();},_0x336d07);switch(_0x1f9aca['strategy']){case _0x1e7e('0x47'):strategy[_0x1e7e('0x47')](_0x22c947,_0x1f9aca,_0x54743c,_0x333e21);break;default:strategy[_0x1e7e('0x48')](_0x22c947,_0x1f9aca,_0x54743c,_0x333e21);}}else{logger[_0x1e7e('0x30')](_0x1e7e('0x49'),_0x174713,_0x337f43['name']);_0x2e33f6[_0x1e7e('0x3a')]();}}}catch(_0x3deb32){console[_0x1e7e('0x4a')](_0x3deb32);logger['error'](_0x1e7e('0x39'),_0x174713,_0x3deb32[_0x1e7e('0x4b')]);_0x2e33f6[_0x1e7e('0x3a')]();}};}; \ No newline at end of file +var _0x3665=['[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','defaults','socket.io-emitter','redis','queue_id','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','account','info','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','createQueue','atimeout','rules','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3665,0x194));var _0x5366=function(_0x39baa6,_0x3d4e93){_0x39baa6=_0x39baa6-0x0;var _0x158e9f=_0x3665[_0x39baa6];return _0x158e9f;};'use strict';var schema=require(_0x5366('0x0'));var _=require(_0x5366('0x1'));var util=require(_0x5366('0x2'));var seqqueue=require(_0x5366('0x3'));var moment=require(_0x5366('0x4'));var Redis=require(_0x5366('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5366('0x6'))(_0x5366('0x7'));var strategy=require(_0x5366('0x8'));config['redis']=_[_0x5366('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5366('0xa'))(new Redis(config[_0x5366('0xb')]));var attributes=['id',_0x5366('0xc'),'account',_0x5366('0xd'),_0x5366('0xe'),_0x5366('0xf')];function emit(_0x2a6e96,_0x4765ff,_0x3bb6da){io['to'](_0x2a6e96)[_0x5366('0x10')](_0x4765ff,_0x3bb6da);}function emitChannelQueueInteraction(_0x541e28,_0x22494d,_0xc13fa3,_0x5969a9,_0x4590fc,_0x28d361,_0x3bf0d0,_0x25eb68){var _0x50eb34=_[_0x5366('0x11')](_0xc13fa3);_0x50eb34[_0x5366('0xc')]=_0x25eb68;_0x50eb34[_0x5366('0xd')]=_0x22494d;_0x50eb34['account']=_0x5969a9;_0x50eb34['id']=_0x4590fc;if(_0x28d361){_0x3bf0d0[util[_0x5366('0x12')](_0x5366('0x13'),_0x541e28)][_0x4590fc]=_['pick'](_0x50eb34,attributes);}else{delete _0x3bf0d0[util[_0x5366('0x12')](_0x5366('0x13'),_0x541e28)][_0x4590fc];}emit(util[_0x5366('0x12')](_0x5366('0x14'),_0x541e28,_0x22494d),util[_0x5366('0x12')](_0x5366('0x15'),_0x541e28,_0x28d361?_0x5366('0x16'):'remove'),_[_0x5366('0x17')](_0x50eb34,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5366('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x5366('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x5366('0x1a'))};var queue=schema({'name':{'type':_0x5366('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5366('0x1c'),'message':_0x5366('0x1d')}});function startRouting(_0x46a71f,_0x38832d,_0x7be3bb,_0x1c62e1){if(_0x46a71f&&_0x38832d&&_0x7be3bb){_0x38832d['waiting']+=0x1;var _0x53982f={'uniqueid':_0x46a71f,'from':_0x7be3bb['body']?_0x7be3bb['body']['from']:'','joinAt':moment()[_0x5366('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x7be3bb[_0x5366('0x1e')]?_0x7be3bb[_0x5366('0x1e')]['id']:null,'ListId':_0x7be3bb[_0x5366('0x1f')]?_0x7be3bb[_0x5366('0x1f')]['id']:null};_0x53982f[_['upperFirst'](_0x7be3bb[_0x5366('0x20')])+_0x5366('0x21')]=_0x38832d['id']||null;_0x53982f[_[_0x5366('0x22')](_0x7be3bb['channel'])+_0x5366('0x23')]=_0x7be3bb[_0x5366('0x24')]?_0x7be3bb['interaction']['id']:null;_0x53982f[_[_0x5366('0x22')](_0x7be3bb[_0x5366('0x20')])+_0x5366('0x25')]=_0x7be3bb[_0x5366('0x26')]?_0x7be3bb[_0x5366('0x26')]['id']:null;_0x53982f[_[_0x5366('0x22')](_0x7be3bb[_0x5366('0x20')])+(_0x7be3bb[_0x5366('0x20')]!==_0x5366('0x27')?_0x5366('0x28'):_0x5366('0x29'))]=_0x7be3bb[_0x5366('0x2a')]?_0x7be3bb[_0x5366('0x2a')]['id']:null;logger[_0x5366('0x2b')](util[_0x5366('0x12')]('[%s][START:QUEUE][NAME:%s]',_0x46a71f,_0x38832d['name']));emitChannelQueueInteraction(_0x7be3bb[_0x5366('0x20')],_0x38832d[_0x5366('0x2c')],_0x53982f,_0x7be3bb[_0x5366('0x2a')][_0x5366('0x2c')],_0x7be3bb[_0x5366('0x26')]['id'],!![],_0x1c62e1,_0x38832d['id']);if(rpc[_0x7be3bb[_0x5366('0x20')]+_0x5366('0x2d')]){return rpc[_0x7be3bb['channel']+_0x5366('0x2d')][_0x5366('0x2e')](_0x53982f)[_0x5366('0x2f')](function(_0xb4b67c){logger[_0x5366('0x30')](_0x5366('0x31'));});}}}function stopRouting(_0x5d3c93,_0x57996e,_0x38ae76,_0x4c3cf5){if(_0x5d3c93&&_0x57996e){_0x57996e[_0x5366('0x32')]-=0x1;var _0x46dd9e={'leaveAt':moment()[_0x5366('0x12')](_0x5366('0x33')),'acceptAt':moment()[_0x5366('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5366('0x34')};logger[_0x5366('0x2b')](util[_0x5366('0x12')](_0x5366('0x35'),_0x5d3c93,_0x57996e['name']));emitChannelQueueInteraction(_0x38ae76['channel'],_0x57996e[_0x5366('0x2c')],_0x38ae76[_0x5366('0x36')],_0x38ae76['account'][_0x5366('0x2c')],_0x38ae76[_0x5366('0x26')]['id'],![],_0x4c3cf5,_0x57996e['id']);if(rpc[_0x38ae76['channel']+'QueueReport']){return rpc[_0x38ae76['channel']+_0x5366('0x2d')][_0x5366('0x37')](_0x5d3c93,_0x46dd9e)['catch'](function(_0x24445e){logger[_0x5366('0x30')](_0x5366('0x38'));});}}}function endRouting(_0x358428,_0x5dd7cb,_0x1a9dd7,_0x45c252){if(_0x358428&&_0x5dd7cb){_0x5dd7cb[_0x5366('0x32')]-=0x1;var _0x3e1468={'leaveAt':moment()[_0x5366('0x12')](_0x5366('0x33')),'exitAt':moment()['format'](_0x5366('0x33')),'reason':'timeout'};logger[_0x5366('0x2b')](util[_0x5366('0x12')](_0x5366('0x39'),_0x358428,_0x5dd7cb[_0x5366('0x2c')]));emitChannelQueueInteraction(_0x1a9dd7[_0x5366('0x20')],_0x5dd7cb['name'],_0x1a9dd7['body'],_0x1a9dd7['account']['name'],_0x1a9dd7['message']['id'],![],_0x45c252);if(rpc[_0x1a9dd7[_0x5366('0x20')]+_0x5366('0x2d')]){return rpc[_0x1a9dd7[_0x5366('0x20')]+'QueueReport']['update'](_0x358428,_0x3e1468)[_0x5366('0x2f')](function(_0x4546e3){logger[_0x5366('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x56fb80){return function(_0x2cad34){return _0x2cad34['name'][_0x5366('0x3a')]()===_0x56fb80['toLowerCase']();};}exports['consequence']=function(_0x4048ee,_0x9452a1,_0x3d3788,_0x413ff0){return function(_0xad5787){try{var _0xdc5d15={'name':_0x9452a1[0x0],'timeout':_0x9452a1[0x1]};var _0x31bf7c=queue[_0x5366('0x0')](_0xdc5d15,{'typecast':!![]});if(_0x31bf7c[_0x5366('0x3b')]){logger[_0x5366('0x30')](_0x5366('0x3c'),_0x4048ee,_['map'](_0x31bf7c,_0x5366('0x26'))[_0x5366('0x3d')](',\x20'));_0xad5787[_0x5366('0x3e')]();}else{var _0x239d40=_[_0x5366('0x3f')](_0x3d3788[_0x413ff0[_0x5366('0x20')]+_0x5366('0x40')],handleFindQueue(_0xdc5d15['name']));if(_0x239d40){startRouting(_0x4048ee,_0x239d40,_0x413ff0,_0x3d3788);var _0x19c316=(_0x239d40[_0x5366('0x41')]||0xa)*0x3e8;var _0x5a5b05=(_0xdc5d15[_0x5366('0x41')]||0x14)*0x3e8;var _0x250c48,_0x2b5875;if(_0x19c316>_0x5a5b05){_0x5a5b05=_0x19c316;}var _0x393fbb=seqqueue[_0x5366('0x42')](_0x19c316);_0x393fbb['id']=_0x4048ee;_0x393fbb[_0x5366('0x43')]=_0x19c316;_0x393fbb['qtimeout']=_0x5a5b05;_0x393fbb[_0x5366('0x20')]=_0x413ff0[_0x5366('0x20')];_0x3d3788[_0x5366('0x44')][_0x4048ee]['on'](_0x5366('0x45'),function(){logger[_0x5366('0x2b')](_0x5366('0x46'),_0x4048ee);stopRouting(_0x4048ee,_0x239d40,_0x413ff0,_0x3d3788);clearTimeout(_0x250c48);_0x250c48=undefined;_0x393fbb[_0x5366('0x47')](!![]);if(_0x3d3788[_0x5366('0x44')][_0x4048ee]){delete _0x3d3788['rules'][_0x4048ee];}_0xad5787[_0x5366('0x3e')]();});_0x3d3788[_0x5366('0x44')][_0x4048ee]['on'](_0x5366('0x48'),function(){if(_0x3d3788[_0x5366('0x44')][_0x4048ee]){delete _0x3d3788[_0x5366('0x44')][_0x4048ee];}});_0x250c48=setTimeout(function(){logger[_0x5366('0x2b')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4048ee);endRouting(_0x4048ee,_0x239d40,_0x413ff0,_0x3d3788);clearTimeout(_0x250c48);_0x393fbb[_0x5366('0x47')](!![]);_0xad5787['next']();},_0x5a5b05);switch(_0x239d40[_0x5366('0x49')]){case _0x5366('0x4a'):strategy[_0x5366('0x4a')](_0x393fbb,_0x239d40,_0x3d3788,_0x413ff0);break;default:strategy[_0x5366('0x4b')](_0x393fbb,_0x239d40,_0x3d3788,_0x413ff0);}}else{logger['error'](_0x5366('0x4c'),_0x4048ee,_0xdc5d15[_0x5366('0x2c')]);_0xad5787[_0x5366('0x3e')]();}}}catch(_0x5b4a46){console[_0x5366('0x4d')](_0x5b4a46);logger[_0x5366('0x30')](_0x5366('0x3c'),_0x4048ee,_0x5b4a46[_0x5366('0x4e')]);_0xad5787[_0x5366('0x3e')]();}};}; \ 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 70bc68e..0bf98b6 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 _0xb70b=['bind','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','isNil','routing','isAgentAvailable','agents','busy','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','handleRun','handleTimeout'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xb70b,0x92));var _0xbb70=function(_0x4bab8e,_0x3e973b){_0x4bab8e=_0x4bab8e-0x0;var _0x3778a4=_0xb70b[_0x4bab8e];return _0x3778a4;};'use strict';var _=require('lodash');var uuid=require(_0xbb70('0x0'));var util=require(_0xbb70('0x1'));var logger=require(_0xbb70('0x2'))('routing');var Agent=function(_0x587c14,_0x2f8f0d,_0x1adbce,_0x4bdc8f){this[_0xbb70('0x3')]=uuid['v4']();this[_0xbb70('0x4')]=_0x587c14;this[_0xbb70('0x5')]=_0x2f8f0d;this[_0xbb70('0x6')]=_0x1adbce;this['routing']=_0x4bdc8f;this['squeue']['push'](this[_0xbb70('0x7')]['bind'](this),this[_0xbb70('0x8')][_0xbb70('0x9')](this));this[_0xbb70('0x4')]['on']('timeout',this['handleTimeout'][_0xbb70('0x9')](this));this[_0xbb70('0x4')]['on']('drained',this[_0xbb70('0xa')][_0xbb70('0x9')](this));};Agent[_0xbb70('0xb')][_0xbb70('0xc')]=function(){this[_0xbb70('0x4')][_0xbb70('0xc')](this['handleRun'][_0xbb70('0x9')](this),this[_0xbb70('0x8')][_0xbb70('0x9')](this));};Agent[_0xbb70('0xb')]['handleDrained']=function(){this[_0xbb70('0x8')](!![]);};Agent[_0xbb70('0xb')][_0xbb70('0x7')]=function(_0x4ef183){logger['info'](_0xbb70('0xd'),this[_0xbb70('0x4')]['id'],this[_0xbb70('0x5')]['id']);if(_[_0xbb70('0xe')](this['realtime']['agents'][this[_0xbb70('0x5')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbb70('0x4')]['id'],this[_0xbb70('0x5')]['id']);setTimeout(this[_0xbb70('0xc')]['bind'](this),0x3e8);}else{if(this[_0xbb70('0xf')]['forcedOwnership']||util[_0xbb70('0x10')](this[_0xbb70('0x4')]['id'],this[_0xbb70('0x6')]['agents'][this[_0xbb70('0x5')]['id']],this[_0xbb70('0x4')]['channel'],![])){this[_0xbb70('0x6')][_0xbb70('0x11')][this[_0xbb70('0x5')]['id']][_0xbb70('0x12')]=!![];this[_0xbb70('0x6')][_0xbb70('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0xbb70('0x13')](this[_0xbb70('0x3')],this[_0xbb70('0x4')]['id'],this['realtime'][_0xbb70('0x11')][this['agent']['id']],null,this[_0xbb70('0xf')]);util[_0xbb70('0x14')](this[_0xbb70('0x4')]['id'],this[_0xbb70('0x6')]['agents'][this[_0xbb70('0x5')]['id']],_0xbb70('0x15')+(this[_0xbb70('0xf')][_0xbb70('0x16')]?_0xbb70('0x17'):''));}else{logger[_0xbb70('0x18')](_0xbb70('0x19'),this[_0xbb70('0x4')]['id'],this[_0xbb70('0x5')]['id']);setTimeout(this[_0xbb70('0xc')]['bind'](this),0x3e8);}}};Agent[_0xbb70('0xb')][_0xbb70('0x8')]=function(_0x47954b){if(_[_0xbb70('0xe')](this[_0xbb70('0x6')][_0xbb70('0x11')][this[_0xbb70('0x5')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbb70('0x4')]['id'],this['agent']['id']);}else{logger[_0xbb70('0x18')](_0xbb70('0x1a'),this[_0xbb70('0x4')]['id'],this[_0xbb70('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0xbb70('0x4')]['id'],this[_0xbb70('0x6')][_0xbb70('0x11')][this['agent']['id']],null,this[_0xbb70('0xf')]);this[_0xbb70('0x6')]['agents'][this[_0xbb70('0x5')]['id']][_0xbb70('0x12')]=![];this['realtime']['agents'][this[_0xbb70('0x5')]['id']][_0xbb70('0x1b')]=undefined;util['writeLog'](this[_0xbb70('0x4')]['id'],this['realtime'][_0xbb70('0x11')][this[_0xbb70('0x5')]['id']],_0x47954b?_0xbb70('0x1c'):_0xbb70('0x1d'));}if(!_0x47954b){setTimeout(this['push'][_0xbb70('0x9')](this),0x3e8);}};function agent(_0x65d332,_0x4c37e3,_0x211733,_0x10e451){return new Agent(_0x65d332,_0x4c37e3,_0x211733,_0x10e451);}module[_0xbb70('0x1e')]=agent; \ No newline at end of file +var _0xf651=['routing','isAgentAvailable','channel','busy','busyQueue','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','TIMEOUT','exports','./util','squeue','agent','realtime','bind','handleTimeout','drained','handleDrained','prototype','push','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf651,0x1f3));var _0x1f65=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xf651[_0xa8883];return _0x479426;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x1f65('0x0'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0xa3638c,_0x48e589,_0x42fbac,_0xa63702){this['notificationId']=uuid['v4']();this[_0x1f65('0x1')]=_0xa3638c;this[_0x1f65('0x2')]=_0x48e589;this[_0x1f65('0x3')]=_0x42fbac;this['routing']=_0xa63702;this[_0x1f65('0x1')]['push'](this['handleRun'][_0x1f65('0x4')](this),this[_0x1f65('0x5')][_0x1f65('0x4')](this));this[_0x1f65('0x1')]['on']('timeout',this[_0x1f65('0x5')][_0x1f65('0x4')](this));this[_0x1f65('0x1')]['on'](_0x1f65('0x6'),this[_0x1f65('0x7')][_0x1f65('0x4')](this));};Agent[_0x1f65('0x8')][_0x1f65('0x9')]=function(){this[_0x1f65('0x1')][_0x1f65('0x9')](this[_0x1f65('0xa')]['bind'](this),this['handleTimeout'][_0x1f65('0x4')](this));};Agent[_0x1f65('0x8')]['handleDrained']=function(){this[_0x1f65('0x5')](!![]);};Agent[_0x1f65('0x8')][_0x1f65('0xa')]=function(_0x3bef09){logger[_0x1f65('0xb')](_0x1f65('0xc'),this['squeue']['id'],this[_0x1f65('0x2')]['id']);if(_['isNil'](this[_0x1f65('0x3')][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']])){logger[_0x1f65('0xb')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1f65('0x1')]['id'],this[_0x1f65('0x2')]['id']);setTimeout(this[_0x1f65('0x9')][_0x1f65('0x4')](this),0x3e8);}else{if(this[_0x1f65('0xe')]['forcedOwnership']||util[_0x1f65('0xf')](this['squeue']['id'],this[_0x1f65('0x3')][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']],this[_0x1f65('0x1')][_0x1f65('0x10')],![])){this[_0x1f65('0x3')][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']][_0x1f65('0x11')]=!![];this[_0x1f65('0x3')][_0x1f65('0xd')][this['agent']['id']][_0x1f65('0x12')]=undefined;util['showNotification'](this['notificationId'],this[_0x1f65('0x1')]['id'],this[_0x1f65('0x3')][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']],null,this['routing']);util[_0x1f65('0x13')](this[_0x1f65('0x1')]['id'],this['realtime'][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']],_0x1f65('0x14')+(this[_0x1f65('0xe')][_0x1f65('0x15')]?_0x1f65('0x16'):''));}else{logger['info'](_0x1f65('0x17'),this[_0x1f65('0x1')]['id'],this[_0x1f65('0x2')]['id']);setTimeout(this['push'][_0x1f65('0x4')](this),0x3e8);}}};Agent[_0x1f65('0x8')][_0x1f65('0x5')]=function(_0x52a570){if(_[_0x1f65('0x18')](this[_0x1f65('0x3')]['agents'][this['agent']['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x1f65('0x2')]['id']);}else{logger[_0x1f65('0xb')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x1f65('0x1')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0x1f65('0x1')]['id'],this[_0x1f65('0x3')][_0x1f65('0xd')][this['agent']['id']],null,this[_0x1f65('0xe')]);this[_0x1f65('0x3')][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']][_0x1f65('0x11')]=![];this[_0x1f65('0x3')][_0x1f65('0xd')][this['agent']['id']][_0x1f65('0x12')]=undefined;util[_0x1f65('0x13')](this[_0x1f65('0x1')]['id'],this['realtime'][_0x1f65('0xd')][this[_0x1f65('0x2')]['id']],_0x52a570?'STOP':_0x1f65('0x19'));}if(!_0x52a570){setTimeout(this[_0x1f65('0x9')][_0x1f65('0x4')](this),0x3e8);}};function agent(_0x491bb6,_0x42884d,_0x24f822,_0x27dab0){return new Agent(_0x491bb6,_0x42884d,_0x24f822,_0x27dab0);}module[_0x1f65('0x1a')]=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 1024d8c..cc6cb29 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 _0xc949=['RINGING','busy','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','length','Agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc949,0x181));var _0x9c94=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc949[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9c94('0x0'));var uuid=require('uuid');var util=require(_0x9c94('0x1'));var logger=require(_0x9c94('0x2'))(_0x9c94('0x3'));var Beepall=function(_0x27613f,_0x54facf,_0x11a56c,_0x231762){this['notificationId']=uuid['v4']();this[_0x9c94('0x4')]=_0x27613f;this[_0x9c94('0x5')]=_0x54facf;this[_0x9c94('0x6')]=_0x11a56c;this[_0x9c94('0x3')]=_0x231762;this['squeue'][_0x9c94('0x7')](this[_0x9c94('0x8')][_0x9c94('0x9')](this),this[_0x9c94('0xa')][_0x9c94('0x9')](this));this[_0x9c94('0x4')]['on'](_0x9c94('0xb'),this[_0x9c94('0xa')][_0x9c94('0x9')](this));this[_0x9c94('0x4')]['on']('drained',this[_0x9c94('0xc')][_0x9c94('0x9')](this));};Beepall[_0x9c94('0xd')][_0x9c94('0x7')]=function(){this[_0x9c94('0x4')][_0x9c94('0x7')](this[_0x9c94('0x8')][_0x9c94('0x9')](this),this[_0x9c94('0xa')][_0x9c94('0x9')](this));};Beepall[_0x9c94('0xd')][_0x9c94('0xc')]=function(_0x369d70){this[_0x9c94('0xa')](!![]);};Beepall['prototype'][_0x9c94('0x8')]=function(_0x496f83){var _0x3d3de5=!![];if(!_[_0x9c94('0xe')](this['queue'])&&!_[_0x9c94('0xe')](this['queue']['Agents'])&&this[_0x9c94('0x5')]['Agents'][_0x9c94('0xf')]>0x0){for(var _0x33bd19=0x0,_0x4d9266;_0x33bd190x0){for(var _0x3a82bf=0x0,_0x2b0495;_0x3a82bf0x0&&_0x5da62a[_0x4edf84+_0x34bd('0x23')]>=_0x5da62a[_0x4edf84+_0x34bd('0x22')]){writeLog(_0x582772,_0x5da62a,_0x4edf84[_0x34bd('0x24')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x34bd('0x25')]=function(_0x3fe8b0,_0x5d2e3d,_0x27747e,_0x510a30,_0x16581f){return sendNotification(!![],_0x3fe8b0,_0x5d2e3d,_0x27747e,_0x510a30,_0x16581f);};exports[_0x34bd('0x26')]=function(_0x26b8e7,_0x4500c8,_0x177d43,_0x58b431,_0x43b92d){return sendNotification(![],_0x26b8e7,_0x4500c8,_0x177d43,_0x58b431,_0x43b92d);};exports[_0x34bd('0x27')]=writeLog; \ No newline at end of file +var _0x3831=['busy','BUSY','online','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','emit','user:%s','name','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','format','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]'];(function(_0x51fab7,_0x17e6b5){var _0x4e2e3f=function(_0x374c94){while(--_0x374c94){_0x51fab7['push'](_0x51fab7['shift']());}};_0x4e2e3f(++_0x17e6b5);}(_0x3831,0x14c));var _0x1383=function(_0x54783e,_0xe85a52){_0x54783e=_0x54783e-0x0;var _0x4b03f4=_0x3831[_0x54783e];return _0x4b03f4;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var utils=require(_0x1383('0x1'));var Mustache=require(_0x1383('0x2'));var Redis=require(_0x1383('0x3'));var config=require(_0x1383('0x4'));var logger=require(_0x1383('0x5'))('routing');config[_0x1383('0x6')]=_['defaults'](config[_0x1383('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x45a030,_0x5a6ba0,_0x187027){io['to'](_0x45a030)[_0x1383('0x7')](_0x5a6ba0,_0x187027);}function sendNotification(_0x2e9a5b,_0x266bde,_0xd6be3b,_0x7cb670,_0x3ca0e6,_0xe0ee2f){io['to'](util['format'](_0x1383('0x8'),_0x7cb670[_0x1383('0x9')]))[_0x1383('0x7')](_0x1383('0xa'),_0x7cb670);var _0x3675cb=_0xe0ee2f||{};var _0x5d5ee2=_0xd6be3b[_0x1383('0xb')]('.');var _0xbc12ea={'uniqueid':_0x266bde,'channel':_0x5d5ee2[0x0],'id':_0x5d5ee2[0x1],'title':_0x5d5ee2[0x0]+_0x1383('0xc'),'interactionId':_0x5d5ee2[0x2],'queue':_0x3ca0e6?_0x3ca0e6['name']:null,'sound':_0x3675cb['account'][_0x1383('0xd')],'shake':_0x3675cb[_0x1383('0xe')][_0x1383('0xf')]};try{if(!_0x3675cb[_0x1383('0x10')]){_0x3675cb[_0x1383('0x10')]={};}if(_0x3ca0e6){_0x3675cb[_0x1383('0x10')][_0x1383('0x11')]=_0x3ca0e6;}else if(_0x3675cb[_0x1383('0x10')]['queue']){delete _0x3675cb[_0x1383('0x10')][_0x1383('0x11')];}_0xbc12ea[_0x1383('0x12')]=utils[_0x1383('0x13')](_0x3675cb[_0x1383('0xe')][_0x1383('0x14')],_0x3675cb);}catch(_0x49fa65){_0xbc12ea['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x1383('0x15')](util['format'](_0x1383('0x16'),_0x266bde,_0x49fa65['message']));}io['to'](util['format']('user:%s',_0x7cb670[_0x1383('0x9')]))['emit'](util[_0x1383('0x17')]('notification:%s',_0x2e9a5b?_0x1383('0x18'):_0x1383('0x19')),_0xbc12ea);}function writeLog(_0xca314,_0x39884b,_0x32fb05){return logger[_0x1383('0x1a')](util[_0x1383('0x17')](_0x1383('0x1b'),_0xca314,_0x39884b[_0x1383('0x9')],_0x32fb05));}exports['isAgentAvailable']=function(_0x1aa695,_0x24f914,_0x39fea2,_0x241c3d){if(_0x24f914[_0x1383('0x1c')]){writeLog(_0x1aa695,_0x24f914,_0x1383('0x1d'));return![];}if(!_0x24f914[_0x1383('0x1e')]){writeLog(_0x1aa695,_0x24f914,'OFFLINE');return![];}if(_0x24f914[_0x39fea2+'Pause']){writeLog(_0x1aa695,_0x24f914,_0x1383('0x1f'));return![];}if(_0x241c3d&&_0x24f914[_0x1383('0x20')](_0x39fea2+_0x1383('0x21'))&&_0x24f914[_0x1383('0x20')](_0x39fea2+_0x1383('0x22'))){if(_0x24f914[_0x39fea2+'Capacity']>0x0&&_0x24f914[_0x39fea2+'CurrentCapacity']>=_0x24f914[_0x39fea2+'Capacity']){writeLog(_0x1aa695,_0x24f914,_0x39fea2[_0x1383('0x23')]()+_0x1383('0x24'));return![];}}return!![];};exports[_0x1383('0x25')]=function(_0x263aea,_0x5866a1,_0x1f7688,_0x4ac2d4,_0x3c788b){return sendNotification(!![],_0x263aea,_0x5866a1,_0x1f7688,_0x4ac2d4,_0x3c788b);};exports[_0x1383('0x26')]=function(_0x42d63f,_0x23e541,_0x3357e9,_0x15a3c4,_0x37a768){return sendNotification(![],_0x42d63f,_0x23e541,_0x3357e9,_0x15a3c4,_0x37a768);};exports[_0x1383('0x27')]=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 bc011a7..f97ff1e 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 _0xa859=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','consequence','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x165b1d,_0x5ec634){var _0x20de45=function(_0x37602d){while(--_0x37602d){_0x165b1d['push'](_0x165b1d['shift']());}};_0x20de45(++_0x5ec634);}(_0xa859,0x77));var _0x9a85=function(_0x1de5b5,_0x451ac3){_0x1de5b5=_0x1de5b5-0x0;var _0x6fbf06=_0xa859[_0x1de5b5];return _0x6fbf06;};'use strict';var schema=require(_0x9a85('0x0'));var sh=require(_0x9a85('0x1'));var _=require(_0x9a85('0x2'));var utils=require(_0x9a85('0x3'));var logger=require(_0x9a85('0x4'))('routing');var system=schema({'command':{'type':_0x9a85('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9a85('0x6')]=function(_0x3050c3,_0x5fad41){return function(_0x351d16){try{var _0x57d7e5={'command':_0x5fad41[0x0]};var _0x5582e6=system['validate'](_0x57d7e5,{'typecast':!![]});if(_0x5582e6[_0x9a85('0x7')]){logger['error'](_0x9a85('0x8'),_0x3050c3,_[_0x9a85('0x9')](_0x5582e6,'message')[_0x9a85('0xa')](',\x20'));logger[_0x9a85('0xb')](_0x9a85('0xc'),_0x3050c3);_0x351d16[_0x9a85('0xd')]();}else{var _0xbf8e15=this;var _0x25ca18=utils['getMustacheRender'](_0x5fad41[0x0],this);logger[_0x9a85('0xb')](_0x9a85('0xe'),_0x3050c3,_0x25ca18);sh[_0x9a85('0xf')](_['trim'](_0x25ca18),function(_0x7ed85d,_0x1f8931){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3050c3,_0x7ed85d);if(_0x7ed85d==0x0){var _0x262b0b=_0x1f8931[_0x9a85('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5fad41[0x1])||_[_0x9a85('0x11')](_0x5fad41[0x1])){logger[_0x9a85('0xb')](_0x9a85('0x12'),_0x3050c3);_0xbf8e15[_0x9a85('0x13')][_0x5fad41[0x1]]=_0x262b0b;}else{logger[_0x9a85('0xb')](_0x9a85('0x14'),_0x3050c3,_0x5fad41[0x1],_0x262b0b);_0xbf8e15[_0x9a85('0x13')][_0x5fad41[0x1]]=_0x262b0b;}}_0x351d16['next']();});}}catch(_0x178628){logger['error']('[%s][SYSTEM]\x20%s',_0x3050c3,_[_0x9a85('0x15')](_0x178628)?JSON[_0x9a85('0x16')](_0x178628):_0x178628);logger[_0x9a85('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3050c3);_0x351d16['next']();}};}; \ No newline at end of file +var _0xad26=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','validate','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xad26,0x1ab));var _0x6ad2=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xad26[_0x55e08b];return _0xd1a7ff;};'use strict';var schema=require(_0x6ad2('0x0'));var sh=require('shelljs');var _=require(_0x6ad2('0x1'));var utils=require(_0x6ad2('0x2'));var logger=require(_0x6ad2('0x3'))(_0x6ad2('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x6ad2('0x5')}});exports[_0x6ad2('0x6')]=function(_0x41a5d7,_0x451d0b){return function(_0x13f517){try{var _0x4ca015={'command':_0x451d0b[0x0]};var _0x1eb4d7=system[_0x6ad2('0x0')](_0x4ca015,{'typecast':!![]});if(_0x1eb4d7[_0x6ad2('0x7')]){logger[_0x6ad2('0x8')](_0x6ad2('0x9'),_0x41a5d7,_['map'](_0x1eb4d7,'message')[_0x6ad2('0xa')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x41a5d7);_0x13f517['next']();}else{var _0x1a960d=this;var _0x2c401e=utils['getMustacheRender'](_0x451d0b[0x0],this);logger[_0x6ad2('0xb')](_0x6ad2('0xc'),_0x41a5d7,_0x2c401e);sh[_0x6ad2('0xd')](_[_0x6ad2('0xe')](_0x2c401e),function(_0x2e2d6d,_0x2d400f){logger['info'](_0x6ad2('0xf'),_0x41a5d7,_0x2e2d6d);if(_0x2e2d6d==0x0){var _0x1e96a0=_0x2d400f[_0x6ad2('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x451d0b[0x1])||_['isEmpty'](_0x451d0b[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x41a5d7);_0x1a960d['body'][_0x451d0b[0x1]]=_0x1e96a0;}else{logger[_0x6ad2('0xb')](_0x6ad2('0x11'),_0x41a5d7,_0x451d0b[0x1],_0x1e96a0);_0x1a960d[_0x6ad2('0x12')][_0x451d0b[0x1]]=_0x1e96a0;}}_0x13f517['next']();});}}catch(_0x358f5a){logger[_0x6ad2('0x8')]('[%s][SYSTEM]\x20%s',_0x41a5d7,_['isObject'](_0x358f5a)?JSON[_0x6ad2('0x13')](_0x358f5a):_0x358f5a);logger['info'](_0x6ad2('0x14'),_0x41a5d7);_0x13f517[_0x6ad2('0x15')]();}};}; \ 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 341aef8..8542349 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 _0x34e5=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x34e5,0xfc));var _0x534e=function(_0x2a854d,_0x36b355){_0x2a854d=_0x2a854d-0x0;var _0x1b9a4a=_0x34e5[_0x2a854d];return _0x1b9a4a;};'use strict';var schema=require(_0x534e('0x0'));var _=require(_0x534e('0x1'));var rpc={'chatInteraction':require(_0x534e('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x534e('0x3')),'mailInteraction':require(_0x534e('0x4')),'faxInteraction':require(_0x534e('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x534e('0x6'))('routing');var tag=schema({'tag':{'type':_0x534e('0x7'),'required':!![],'message':_0x534e('0x8')}});exports[_0x534e('0x9')]=function(_0x502305,_0x4f876c,_0x4fca95,_0x51d08f){return function(_0x156fea){try{var _0x385579={'tag':_0x4f876c[0x0]};var _0x79bc0f=tag[_0x534e('0x0')](_0x385579,{'typecast':!![]});if(_0x79bc0f['length']){logger[_0x534e('0xa')](_0x534e('0xb'),_0x502305,_['map'](_0x79bc0f,_0x534e('0xc'))[_0x534e('0xd')](',\x20'));logger['info'](_0x534e('0xe'),_0x502305);_0x156fea[_0x534e('0xf')]();}else{var _0x2afc3c={'ids':[_0x4f876c[0x0]]};if(rpc[_0x51d08f[_0x534e('0x10')]+_0x534e('0x11')]){rpc[_0x51d08f[_0x534e('0x10')]+'Interaction'][_0x534e('0x12')](_0x51d08f['interaction']['id'],_0x2afc3c)[_0x534e('0x13')](function(_0x145d70){logger[_0x534e('0x14')](_0x534e('0x15'),_0x502305,_0x4f876c[0x1],_0x51d08f['channel'],_0x51d08f[_0x534e('0x16')]['id']);})['catch'](function(_0x3e1714){logger[_0x534e('0xa')](_0x534e('0xb'),_0x502305,JSON[_0x534e('0x17')](_0x3e1714));logger['info'](_0x534e('0xe'),_0x502305);})[_0x534e('0x18')](function(){_0x156fea['next']();});}}}catch(_0x28c6b5){logger['error'](_0x534e('0xb'),_0x502305,_[_0x534e('0x19')](_0x28c6b5)?JSON[_0x534e('0x17')](_0x28c6b5):_0x28c6b5);logger[_0x534e('0x14')](_0x534e('0xe'),_0x502305);_0x156fea[_0x534e('0xf')]();}};}; \ No newline at end of file +var _0x6443=['Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6443,0xe0));var _0x3644=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x6443[_0x5e1b91];return _0x59b52f;};'use strict';var schema=require('validate');var _=require(_0x3644('0x0'));var rpc={'chatInteraction':require(_0x3644('0x1')),'openchannelInteraction':require(_0x3644('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x3644('0x3')),'whatsappInteraction':require(_0x3644('0x4'))};var logger=require('../../../../config/logger')(_0x3644('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x3644('0x6')}});exports[_0x3644('0x7')]=function(_0x15b88f,_0x120c2a,_0x276934,_0x21eab7){return function(_0x7bd5ed){try{var _0x5a40e6={'tag':_0x120c2a[0x0]};var _0x7fcbb5=tag[_0x3644('0x8')](_0x5a40e6,{'typecast':!![]});if(_0x7fcbb5['length']){logger['error'](_0x3644('0x9'),_0x15b88f,_[_0x3644('0xa')](_0x7fcbb5,_0x3644('0xb'))['join'](',\x20'));logger[_0x3644('0xc')](_0x3644('0xd'),_0x15b88f);_0x7bd5ed[_0x3644('0xe')]();}else{var _0x1151fe={'ids':[_0x120c2a[0x0]]};if(rpc[_0x21eab7[_0x3644('0xf')]+'Interaction']){rpc[_0x21eab7[_0x3644('0xf')]+_0x3644('0x10')][_0x3644('0x11')](_0x21eab7[_0x3644('0x12')]['id'],_0x1151fe)[_0x3644('0x13')](function(_0x499ee7){logger[_0x3644('0xc')](_0x3644('0x14'),_0x15b88f,_0x120c2a[0x1],_0x21eab7[_0x3644('0xf')],_0x21eab7[_0x3644('0x12')]['id']);})['catch'](function(_0x18b1d2){logger['error']('[%s][TAG]\x20%s',_0x15b88f,JSON[_0x3644('0x15')](_0x18b1d2));logger[_0x3644('0xc')](_0x3644('0xd'),_0x15b88f);})[_0x3644('0x16')](function(){_0x7bd5ed[_0x3644('0xe')]();});}}}catch(_0x290909){logger['error'](_0x3644('0x9'),_0x15b88f,_[_0x3644('0x17')](_0x290909)?JSON[_0x3644('0x15')](_0x290909):_0x290909);logger[_0x3644('0xc')](_0x3644('0xd'),_0x15b88f);_0x7bd5ed['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 0176bfe..8ae9f70 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 _0xad3d=['&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','stringify','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','params','utf8','then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId='];(function(_0x1580c3,_0x21fa51){var _0x1826c9=function(_0x3e6ed4){while(--_0x3e6ed4){_0x1580c3['push'](_0x1580c3['shift']());}};_0x1826c9(++_0x21fa51);}(_0xad3d,0x1ae));var _0xdad3=function(_0x1ecd29,_0x3442f2){_0x1ecd29=_0x1ecd29-0x0;var _0x29c667=_0xad3d[_0x1ecd29];return _0x29c667;};'use strict';var rp=require(_0xdad3('0x0'));var logger=require(_0xdad3('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xdad3('0x2')]=function(_0x76da29,_0x19a705){return function(_0x269e1b){var _0x2a3327=_0x19a705[0xa];var _0x37184d=_0x19a705[0xb];var _0x5f485c=_0x19a705[0xc];var _0x4189ae=_0x19a705[0xd];var _0x1f3405=_0x19a705[0xe];var _0xd6680e=_0x19a705[0xf]['replace'](/\n/g,_0xdad3('0x3'));var _0x3617f3=_0x19a705[0x10][_0xdad3('0x4')](/\n/g,'\x20');if(!arr[_0xdad3('0x5')](_0x37184d)){arr[_0xdad3('0x6')](_0x37184d);var _0x2990b2=_0x19a705[0x3];var _0x362c3b=_0x19a705[0x4];var _0x5252bf=_0x19a705[0x1];var _0x576e06=_0x19a705[0x0];var _0x597bbc={};_0x597bbc[_0xdad3('0x7')]=_0x19a705[0x8]+_0xdad3('0x8')+_0x5f485c+'|'+_0x2a3327+'|'+_0x4189ae+'|'+_0x37184d+'|'+_0x1f3405;_0x597bbc[_0xdad3('0x9')]=_0x19a705[0x7]+_0xdad3('0x8')+_0x5f485c+'|'+_0x2a3327+'|'+_0x4189ae+'|'+_0x37184d+'|'+_0x1f3405+'|'+_0xd6680e+'|'+_0x3617f3;_0x597bbc['title']=_0x19a705[0x9];var _0x486e98={};_0x486e98[_0xdad3('0xa')]=_0xdad3('0xb');_0x486e98['method']=_0xdad3('0xc');var _0xd85cd3=[];_0xd85cd3[_0xdad3('0x6')](_0x19a705[0x2]);_0xd85cd3[_0xdad3('0x6')](_0x19a705[0x5]);_0xd85cd3['push'](_0x19a705[0x6]);_0x486e98[_0xdad3('0xd')]=_0xd85cd3;_0x486e98['id']=0x1;var _0x25f1f1=JSON['stringify'](_0x486e98);var _0x31b0e1={'encoding':_0xdad3('0xe'),'method':'POST','timeout':0x2710,'url':_0x2990b2,'headers':{'Content-Type':'application/json-rpc'},'body':_0x25f1f1};return rp(_0x31b0e1)[_0xdad3('0xf')](function(_0x4dd9c7){const _0x31a7b2=JSON['parse'](_0x4dd9c7);if(!_0x31a7b2[_0xdad3('0x10')]['logged']){throw new Error(_0xdad3('0x11'));}var _0x4e4713=_0x37184d;var _0x3a288b=_0xdad3('0x12')+_0x5252bf+'&serviceId='+_0x576e06+_0xdad3('0x13')+_0x4e4713+_0xdad3('0x14')+JSON['stringify'](_0x597bbc);var _0xa0a7df=_0x362c3b+'?'+_0x3a288b;return rp(_0xa0a7df);})[_0xdad3('0xf')](function(_0x56873f){logger['info'](_0xdad3('0x15'),_0x76da29,_0x56873f);_0x269e1b[_0xdad3('0x16')]();})[_0xdad3('0x17')](function(_0x33ae3b){logger[_0xdad3('0x18')]('[%s][TVOX]\x20%s',_0x76da29,_[_0xdad3('0x19')](_0x33ae3b)?JSON[_0xdad3('0x1a')](_0x33ae3b):_0x33ae3b);_0x269e1b[_0xdad3('0x16')]();});}else{logger[_0xdad3('0x1b')](_0xdad3('0x1c'),_0x76da29);_0x269e1b[_0xdad3('0x1d')]();}};}; \ No newline at end of file +var _0x7f06=['isObject','next','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','urlOnRing','title','login','push','utf8','POST','application/json-rpc','then','parse','logged','channelId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error'];(function(_0x4baa44,_0x405672){var _0x32137c=function(_0x4a6377){while(--_0x4a6377){_0x4baa44['push'](_0x4baa44['shift']());}};_0x32137c(++_0x405672);}(_0x7f06,0x7f));var _0x67f0=function(_0x1e8914,_0x5e8140){_0x1e8914=_0x1e8914-0x0;var _0x4ce4ce=_0x7f06[_0x1e8914];return _0x4ce4ce;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require(_0x67f0('0x0'));var arr=[];exports[_0x67f0('0x1')]=function(_0x5599e5,_0x38ddf4){return function(_0xe21119){var _0x5e5e60=_0x38ddf4[0xa];var _0x54c019=_0x38ddf4[0xb];var _0x58f7d3=_0x38ddf4[0xc];var _0x3644b0=_0x38ddf4[0xd];var _0x9e525f=_0x38ddf4[0xe];var _0x1ae6e0=_0x38ddf4[0xf][_0x67f0('0x2')](/\n/g,_0x67f0('0x3'));var _0x12f87b=_0x38ddf4[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x67f0('0x4')](_0x54c019)){arr['push'](_0x54c019);var _0x5c4f99=_0x38ddf4[0x3];var _0xbe8612=_0x38ddf4[0x4];var _0x12c136=_0x38ddf4[0x1];var _0x55fafe=_0x38ddf4[0x0];var _0x5a58fd={};_0x5a58fd[_0x67f0('0x5')]=_0x38ddf4[0x8]+'?params='+_0x58f7d3+'|'+_0x5e5e60+'|'+_0x3644b0+'|'+_0x54c019+'|'+_0x9e525f;_0x5a58fd[_0x67f0('0x6')]=_0x38ddf4[0x7]+'?params='+_0x58f7d3+'|'+_0x5e5e60+'|'+_0x3644b0+'|'+_0x54c019+'|'+_0x9e525f+'|'+_0x1ae6e0+'|'+_0x12f87b;_0x5a58fd[_0x67f0('0x7')]=_0x38ddf4[0x9];var _0x393aad={};_0x393aad['jsonrpc']='2.0';_0x393aad['method']=_0x67f0('0x8');var _0x9c0f17=[];_0x9c0f17[_0x67f0('0x9')](_0x38ddf4[0x2]);_0x9c0f17[_0x67f0('0x9')](_0x38ddf4[0x5]);_0x9c0f17['push'](_0x38ddf4[0x6]);_0x393aad['params']=_0x9c0f17;_0x393aad['id']=0x1;var _0x46cbcf=JSON['stringify'](_0x393aad);var _0x3c7477={'encoding':_0x67f0('0xa'),'method':_0x67f0('0xb'),'timeout':0x2710,'url':_0x5c4f99,'headers':{'Content-Type':_0x67f0('0xc')},'body':_0x46cbcf};return rp(_0x3c7477)[_0x67f0('0xd')](function(_0x597b36){const _0x55d5e9=JSON[_0x67f0('0xe')](_0x597b36);if(!_0x55d5e9['result'][_0x67f0('0xf')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x24660b=_0x54c019;var _0x39716a=_0x67f0('0x10')+_0x12c136+'&serviceId='+_0x55fafe+_0x67f0('0x11')+_0x24660b+_0x67f0('0x12')+JSON[_0x67f0('0x13')](_0x5a58fd);var _0x46e563=_0xbe8612+'?'+_0x39716a;return rp(_0x46e563);})['then'](function(_0x439ff8){logger[_0x67f0('0x14')](_0x67f0('0x15'),_0x5599e5,_0x439ff8);_0xe21119['stop']();})['catch'](function(_0x18e49e){logger[_0x67f0('0x16')]('[%s][TVOX]\x20%s',_0x5599e5,_[_0x67f0('0x17')](_0x18e49e)?JSON[_0x67f0('0x13')](_0x18e49e):_0x18e49e);_0xe21119['stop']();});}else{logger[_0x67f0('0x14')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5599e5);_0xe21119[_0x67f0('0x18')]();}};}; \ 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 780e62a..ece1606 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(_0x54a333,_0x43f0d1){var _0x2f4dba=function(_0x206f55){while(--_0x206f55){_0x54a333['push'](_0x54a333['shift']());}};_0x2f4dba(++_0x43f0d1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3a57cb,_0x1391a2){var _0x2ad4b9=function(_0x519e8f){while(--_0x519e8f){_0x3a57cb['push'](_0x3a57cb['shift']());}};_0x2ad4b9(++_0x1391a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index eb8f95c..4e8ecbc 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 _0xa902=['complete','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','emit'];(function(_0x1dbcba,_0x59ecb7){var _0x3fd7c8=function(_0x2cf7f4){while(--_0x2cf7f4){_0x1dbcba['push'](_0x1dbcba['shift']());}};_0x3fd7c8(++_0x59ecb7);}(_0xa902,0x8d));var _0x2a90=function(_0x33ca72,_0x38711f){_0x33ca72=_0x33ca72-0x0;var _0x120c96=_0xa902[_0x33ca72];return _0x120c96;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var path=require(_0x2a90('0x2'));var fs=require('fs');var jayson=require(_0x2a90('0x3'));var BPromise=require(_0x2a90('0x4'));var uuid=require('uuid');var utils=require(_0x2a90('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x2a90('0x6'));var rpc={'openchannelQueueReport':require(_0x2a90('0x7')),'mailQueueReport':require(_0x2a90('0x8')),'chatQueueReport':require(_0x2a90('0x9')),'smsQueueReport':require(_0x2a90('0xa')),'faxQueueReport':require(_0x2a90('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x2a90('0xc'));function getId(_0x570659,_0x5ec2b9,_0xc75b6e){return util[_0x2a90('0xd')](_0x2a90('0xe'),_0x570659,_0x5ec2b9||0x0,_0xc75b6e||0x0);}function getIntervals(_0x2b0a20,_0x18a60e){var _0x56550f=[];if(!_[_0x2a90('0xf')](_0x18a60e[_0x2a90('0x10')])&&!_[_0x2a90('0xf')](_0x2b0a20[_0x18a60e[_0x2a90('0x10')]])&&!_['isNil'](_0x2b0a20[_0x18a60e[_0x2a90('0x10')]]['Intervals'])){_0x56550f=_[_0x2a90('0x11')](_0x2b0a20[_0x18a60e['IntervalId']][_0x2a90('0x12')],'interval');}else if(!_[_0x2a90('0xf')](_0x18a60e[_0x2a90('0x13')])){_0x56550f=[_0x18a60e[_0x2a90('0x13')]];}return _0x56550f;}exports['listen']=function(_0x56d1b8){_0x56d1b8['rules']={};return new BPromise(function(_0x46cb32,_0x3a42df){var _0x5a2682={'Start':function(_0x1ff63d){var _0x21c648=this;return new Promise(function(_0x312782,_0x25bd0e){if(_0x1ff63d){try{var _0x3200b4=[];var _0x37858e=getId(_0x1ff63d[_0x2a90('0x14')],_0x1ff63d[_0x2a90('0x15')]?_0x1ff63d[_0x2a90('0x15')]['id']:0x0,_0x1ff63d['interaction']?_0x1ff63d[_0x2a90('0x16')]['id']:0x0);if(_0x1ff63d[_0x2a90('0x17')]&&_[_0x2a90('0x18')](_0x1ff63d['applications'])&&_0x1ff63d[_0x2a90('0x17')][_0x2a90('0x19')]){for(var _0x148d18=0x0;_0x148d18<_0x1ff63d[_0x2a90('0x17')][_0x2a90('0x19')];_0x148d18+=0x1){var _0x23d227=_0x1ff63d[_0x2a90('0x17')][_0x148d18];if(fs[_0x2a90('0x1a')](path[_0x2a90('0x1b')](__dirname,_0x2a90('0x17'),_0x23d227[_0x2a90('0x1c')]+_0x2a90('0x1d')))){var _0x4fdd62=[];switch(_0x23d227[_0x2a90('0x1c')][_0x2a90('0x1e')]()){case _0x2a90('0x1f'):var _0x21f03b=_0x23d227['appdata'][_0x2a90('0x20')](',');if(_0x1ff63d[_0x2a90('0x14')]==='mail'){_0x4fdd62[_0x2a90('0x21')](_0x21f03b[0x0]);_0x4fdd62[_0x2a90('0x21')](_0x21f03b[0x1]);_0x4fdd62[_0x2a90('0x21')](_0x21f03b[_0x2a90('0x22')](0x2,_0x21f03b[_0x2a90('0x19')])[_0x2a90('0x1b')](','));}else{_0x4fdd62[_0x2a90('0x21')](_0x21f03b[0x0]);_0x4fdd62[_0x2a90('0x21')](_0x21f03b['slice'](0x1,_0x21f03b[_0x2a90('0x19')])[_0x2a90('0x1b')](','));}break;case _0x2a90('0x23'):var _0x40c61a=_0x23d227[_0x2a90('0x24')]['split'](',');_0x4fdd62['push'](_0x40c61a[0x0]);_0x4fdd62[_0x2a90('0x21')](_0x40c61a[0x1]);_0x4fdd62['push'](_0x40c61a['slice'](0x2,_0x40c61a['length'])[_0x2a90('0x1b')](','));break;case _0x2a90('0x25'):var _0x595638=_0x23d227['appdata'][_0x2a90('0x20')](',');_0x4fdd62['push'](_0x595638[0x0]);_0x4fdd62[_0x2a90('0x21')](_0x595638[0x1]);_0x4fdd62[_0x2a90('0x21')](_0x595638[0x2]);_0x4fdd62[_0x2a90('0x21')](_0x595638[0x3]);_0x4fdd62[_0x2a90('0x21')](_0x595638[_0x2a90('0x22')](0x4,_0x595638[_0x2a90('0x19')])[_0x2a90('0x1b')](','));break;case'amazonlex':var _0x427918=_0x23d227[_0x2a90('0x24')][_0x2a90('0x20')](',');_0x4fdd62['push'](_0x427918[0x0]);_0x4fdd62[_0x2a90('0x21')](_0x427918[0x1]);_0x4fdd62[_0x2a90('0x21')](_0x427918[0x2]);_0x4fdd62[_0x2a90('0x21')](_0x427918[0x3]);_0x4fdd62[_0x2a90('0x21')](_0x427918['slice'](0x4,_0x427918[_0x2a90('0x19')])[_0x2a90('0x1b')](','));break;case _0x2a90('0x15'):_0x4fdd62[_0x2a90('0x21')](_0x23d227[_0x2a90('0x24')]);break;case _0x2a90('0x26'):_0x4fdd62['push'](_0x23d227[_0x2a90('0x27')]);_0x4fdd62[_0x2a90('0x21')](_0x23d227[_0x2a90('0x24')]);break;case _0x2a90('0x28'):var _0x58a86d=utils[_0x2a90('0x29')](_0x1ff63d[_0x2a90('0x2a')]['notificationTemplate'],_0x1ff63d);var _0x3e5002=_0x23d227[_0x2a90('0x24')]['split'](',');_0x4fdd62['push'](_0x3e5002[0x0]);_0x4fdd62[_0x2a90('0x21')](_0x3e5002[0x1]);_0x4fdd62[_0x2a90('0x21')](_0x3e5002[0x2]);_0x4fdd62[_0x2a90('0x21')](_0x3e5002[0x3]);_0x4fdd62['push'](_0x3e5002[0x4]);_0x4fdd62[_0x2a90('0x21')](_0x3e5002[0x5]);_0x4fdd62['push'](_0x3e5002[0x6]);_0x4fdd62[_0x2a90('0x21')](_0x3e5002[0x7]);_0x4fdd62['push'](_0x3e5002[0x8]);_0x4fdd62[_0x2a90('0x21')](_0x3e5002[0x9]);_0x4fdd62['push'](_0x3e5002[0xa]);_0x4fdd62['push'](_0x1ff63d[_0x2a90('0x16')]['id']);_0x4fdd62['push'](_0x1ff63d[_0x2a90('0x15')]['id']);_0x4fdd62[_0x2a90('0x21')](_0x23d227[_0x2a90('0x2b')]);_0x4fdd62['push'](_0x1ff63d[_0x2a90('0x16')][_0x2a90('0x2c')]);_0x4fdd62[_0x2a90('0x21')](_0x1ff63d['body'][_0x2a90('0x2d')]);_0x4fdd62[_0x2a90('0x21')](_0x58a86d);break;default:_0x4fdd62=_[_0x2a90('0xf')](_0x23d227['appdata'])?[]:_0x23d227[_0x2a90('0x24')][_0x2a90('0x20')](',');}var _0x504643={'id':util[_0x2a90('0xd')](_0x2a90('0x2e'),_0x37858e,_0x23d227['id'],_0x23d227[_0x2a90('0x1c')]),'condition':require(_0x2a90('0x2f'))[_0x2a90('0x30')](_0x37858e,getIntervals(_0x56d1b8[_0x2a90('0x31')],_0x23d227),_0x56d1b8),'consequence':require(_0x2a90('0x32')+_0x23d227[_0x2a90('0x1c')])[_0x2a90('0x33')](_0x37858e,_0x4fdd62,_0x56d1b8,_0x1ff63d),'p':_0x23d227[_0x2a90('0x34')]||0x0};logger[_0x2a90('0x35')](_0x2a90('0x36'),_0x504643['id'],_0x2a90('0x37'),getIntervals(_0x56d1b8[_0x2a90('0x31')],_0x23d227)['join'](_0x2a90('0x38')));_0x3200b4[_0x2a90('0x21')](_0x504643);}else{logger['error'](_0x2a90('0x39'),path[_0x2a90('0x1b')](__dirname,_0x2a90('0x17'),_0x23d227[_0x2a90('0x1c')]+_0x2a90('0x1d')));}}_0x56d1b8['rules'][_0x37858e]=new RuleEngine(_0x3200b4);_0x56d1b8[_0x2a90('0x3a')][_0x37858e]['execute'](_0x1ff63d,function(_0x4566a6){logger['info'](_0x2a90('0x3b'),JSON[_0x2a90('0x3c')](_0x4566a6[_0x2a90('0x3d')]));if(_0x56d1b8[_0x2a90('0x3a')][_0x37858e]){_0x56d1b8[_0x2a90('0x3a')][_0x37858e][_0x2a90('0x3e')](_0x2a90('0x3f'));}});return _0x312782({'code':0xc8,'message':_0x1ff63d});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x312782({'code':0xc8,'message':_0x1ff63d});}}catch(_0x2af810){logger[_0x2a90('0x40')](_0x2af810[_0x2a90('0x41')]);return _0x25bd0e(_0x21c648[_0x2a90('0x40')](0x1f4,_0x2af810));}}return _0x25bd0e(_0x2a90('0x42'));});},'AcceptMessage':function(_0xff4f4a){var _0x654803=this;return new Promise(function(_0x1fb729,_0x4fdbca){if(_0xff4f4a[_0x2a90('0x43')]&&_0xff4f4a['agent']['id']){if(_0x56d1b8[_0x2a90('0x44')][_0xff4f4a[_0x2a90('0x43')]['id']]){_0x56d1b8['agents'][_0xff4f4a[_0x2a90('0x43')]['id']][_0x2a90('0x45')]=![];_0x56d1b8[_0x2a90('0x44')][_0xff4f4a[_0x2a90('0x43')]['id']][_0x2a90('0x46')]=undefined;}}if(_0xff4f4a[_0x2a90('0x15')]&&_0xff4f4a[_0x2a90('0x15')]['id']){try{var _0x5c043f=getId(_0xff4f4a['channel'],_0xff4f4a[_0x2a90('0x15')]?_0xff4f4a[_0x2a90('0x15')]['id']:0x0,_0xff4f4a[_0x2a90('0x16')]?_0xff4f4a[_0x2a90('0x16')]['id']:0x0);if(_0x56d1b8[_0x2a90('0x3a')][_0x5c043f]){_0x56d1b8['rules'][_0x5c043f]['emit'](_0x2a90('0x47'));if(rpc[_0xff4f4a[_0x2a90('0x14')]+'QueueReport']){rpc[_0xff4f4a['channel']+'QueueReport'][_0x2a90('0x48')](_0x5c043f,{'UserId':_0xff4f4a['message'][_0x2a90('0x49')]})[_0x2a90('0x4a')](function(_0x272d07){logger[_0x2a90('0x40')](_0x2a90('0x4b'));});}}return _0x1fb729({'code':0xc8,'message':_0xff4f4a});}catch(_0x3ade08){logger['error'](_0x3ade08[_0x2a90('0x41')]);return _0x4fdbca(_0x654803[_0x2a90('0x40')](0x1f4,_0x3ade08));}}logger['error'](_0x2a90('0x4c'));return _0x4fdbca(_0x654803['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x46f687){var _0xe47c6b=this;return new Promise(function(_0x5819ab,_0x4c0cb2){if(_0x46f687[_0x2a90('0x43')]&&_0x46f687['agent']['id']){try{if(_0x56d1b8[_0x2a90('0x44')][_0x46f687[_0x2a90('0x43')]['id']]){_0x56d1b8['agents'][_0x46f687[_0x2a90('0x43')]['id']][_0x2a90('0x45')]=![];_0x56d1b8[_0x2a90('0x44')][_0x46f687['agent']['id']][_0x2a90('0x46')]=undefined;}return _0x5819ab({'code':0xc8,'message':_0x46f687});}catch(_0xdb6535){logger['error'](_0xdb6535['stack']);return _0x4c0cb2(_0xe47c6b[_0x2a90('0x40')](0x1f4,_0xdb6535));}}logger[_0x2a90('0x40')]('message\x20is\x20empty');return _0x4c0cb2(_0xe47c6b[_0x2a90('0x40')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1302b9){var _0x5ab061=this;return new Promise(function(_0x13440e,_0x1c8bbf){if(_0x1302b9[_0x2a90('0x14')]&&_0x1302b9['interaction']&&_0x1302b9['interaction']['id']){try{var _0x5a4515=getId(_0x1302b9[_0x2a90('0x14')],_0x1302b9[_0x2a90('0x15')]?_0x1302b9[_0x2a90('0x15')]['id']:0x0,_0x1302b9[_0x2a90('0x16')]?_0x1302b9[_0x2a90('0x16')]['id']:0x0);if(_0x56d1b8[_0x2a90('0x3a')][_0x5a4515]){_0x56d1b8[_0x2a90('0x3a')][_0x5a4515][_0x2a90('0x3e')](_0x2a90('0x47'));}return _0x13440e({'code':0xc8,'message':_0x1302b9});}catch(_0x4f4dc6){logger[_0x2a90('0x40')](_0x4f4dc6[_0x2a90('0x41')]);return _0x1c8bbf(_0x5ab061[_0x2a90('0x40')](0x1f4,_0x4f4dc6));}}logger['error']('message\x20is\x20empty');return _0x1c8bbf(_0x5ab061['error'](0x1f4,_0x2a90('0x4c')));});},'AgentCapacity':function(_0xfbe652){var _0x13270d=this;return new Promise(function(_0x400aca,_0x325a3d){if(_0x56d1b8[_0x2a90('0x44')][_0x2a90('0x4d')](_0xfbe652['id'])){for(var _0x2a38d3 in _0xfbe652[_0x2a90('0x4e')]){if(_0xfbe652[_0x2a90('0x4e')][_0x2a90('0x4d')](_0x2a38d3)){if(_0x56d1b8[_0x2a90('0x44')][_0xfbe652['id']][_0x2a90('0x4d')](_0x2a38d3+_0x2a90('0x4f'))){_0x56d1b8[_0x2a90('0x44')][_0xfbe652['id']][_0x2a38d3+_0x2a90('0x4f')]=parseInt(_0xfbe652['capacity'][_0x2a38d3],0xa);}}}_0x56d1b8[_0x2a90('0x44')][_0xfbe652['id']]['updateRealtime']();return _0x400aca({'code':0xc8,'message':_0x56d1b8[_0x2a90('0x44')][_0xfbe652['id']]});}else{return _0x325a3d(_0x13270d[_0x2a90('0x40')](0x1f4,_0x2a90('0x50')));}});},'Agents':function(_0x132d74){return new Promise(function(_0xc21770,_0x10960c){var _0x44b211=_['values'](_0x56d1b8[_0x2a90('0x44')]);_0xc21770({'count':_0x44b211[_0x2a90('0x19')],'rows':_0x44b211});});},'ChatQueues':function(_0xf88bbb){return new Promise(function(_0x48f9fa,_0xa1234a){var _0x3aa0d5=[];for(var _0x35c007 in _0x56d1b8[_0x2a90('0x51')]){if(_0x56d1b8['chatQueues'][_0x2a90('0x4d')](_0x35c007)){var _0x49687f=_0x56d1b8[_0x2a90('0x51')][_0x35c007];var _0x94e9fb={'id':_0x49687f['id'],'available':_0x49687f[_0x2a90('0x52')],'loggedIn':_0x49687f[_0x2a90('0x53')],'name':_0x49687f[_0x2a90('0x54')],'paused':_0x49687f[_0x2a90('0x55')],'waiting':_0x49687f['waiting']};_0x3aa0d5[_0x2a90('0x21')](_0x94e9fb);}}_0x48f9fa({'count':_0x3aa0d5[_0x2a90('0x19')],'rows':_0x3aa0d5});});},'MailQueues':function(_0x120c17){return new Promise(function(_0x3bbd96,_0x1f8788){var _0x60999d=[];for(var _0x1bf4f0 in _0x56d1b8[_0x2a90('0x56')]){if(_0x56d1b8[_0x2a90('0x56')]['hasOwnProperty'](_0x1bf4f0)){var _0xddf932=_0x56d1b8[_0x2a90('0x56')][_0x1bf4f0];var _0x3f6580={'id':_0xddf932['id'],'available':_0xddf932['available'],'loggedIn':_0xddf932[_0x2a90('0x53')],'name':_0xddf932[_0x2a90('0x54')],'paused':_0xddf932[_0x2a90('0x55')],'waiting':_0xddf932[_0x2a90('0x57')]};_0x60999d[_0x2a90('0x21')](_0x3f6580);}}_0x3bbd96({'count':_0x60999d['length'],'rows':_0x60999d});});},'OpenchannelQueues':function(_0x1bf94c){return new Promise(function(_0x5e0bf2,_0x5a770b){var _0x9fafd=[];for(var _0x4e1dcd in _0x56d1b8['openchannelQueues']){if(_0x56d1b8[_0x2a90('0x58')]['hasOwnProperty'](_0x4e1dcd)){var _0xac4adb=_0x56d1b8[_0x2a90('0x58')][_0x4e1dcd];var _0x4d680b={'id':_0xac4adb['id'],'available':_0xac4adb['available'],'loggedIn':_0xac4adb[_0x2a90('0x53')],'name':_0xac4adb['name'],'paused':_0xac4adb['paused'],'waiting':_0xac4adb[_0x2a90('0x57')]};_0x9fafd[_0x2a90('0x21')](_0x4d680b);}}_0x5e0bf2({'count':_0x9fafd[_0x2a90('0x19')],'rows':_0x9fafd});});},'SmsQueues':function(_0x2ec221){return new Promise(function(_0x5bdd4d,_0x4eaee2){var _0x370144=[];for(var _0x410c0f in _0x56d1b8[_0x2a90('0x59')]){if(_0x56d1b8[_0x2a90('0x59')][_0x2a90('0x4d')](_0x410c0f)){var _0x159b06=_0x56d1b8[_0x2a90('0x59')][_0x410c0f];var _0x220c3e={'id':_0x159b06['id'],'available':_0x159b06[_0x2a90('0x52')],'loggedIn':_0x159b06[_0x2a90('0x53')],'name':_0x159b06[_0x2a90('0x54')],'paused':_0x159b06[_0x2a90('0x55')],'waiting':_0x159b06['waiting']};_0x370144[_0x2a90('0x21')](_0x220c3e);}}_0x5bdd4d({'count':_0x370144['length'],'rows':_0x370144});});},'FaxQueues':function(_0x319e6d){return new Promise(function(_0x533b5b,_0x261a84){var _0x556128=[];for(var _0x4ea392 in _0x56d1b8[_0x2a90('0x5a')]){if(_0x56d1b8[_0x2a90('0x5a')][_0x2a90('0x4d')](_0x4ea392)){var _0x356337=_0x56d1b8['faxQueues'][_0x4ea392];var _0x5550d2={'id':_0x356337['id'],'available':_0x356337[_0x2a90('0x52')],'loggedIn':_0x356337[_0x2a90('0x53')],'name':_0x356337[_0x2a90('0x54')],'paused':_0x356337[_0x2a90('0x55')],'waiting':_0x356337[_0x2a90('0x57')]};_0x556128[_0x2a90('0x21')](_0x5550d2);}}_0x533b5b({'count':_0x556128[_0x2a90('0x19')],'rows':_0x556128});});},'WhatsappQueues':function(_0x17dacb){return new Promise(function(_0x42474d,_0x298d4b){var _0x25ae8c=[];for(var _0x323451 in _0x56d1b8['whatsappQueues']){if(_0x56d1b8[_0x2a90('0x5b')][_0x2a90('0x4d')](_0x323451)){var _0x104396=_0x56d1b8[_0x2a90('0x5b')][_0x323451];var _0x3729d2={'id':_0x104396['id'],'available':_0x104396[_0x2a90('0x52')],'loggedIn':_0x104396[_0x2a90('0x53')],'name':_0x104396[_0x2a90('0x54')],'paused':_0x104396['paused'],'waiting':_0x104396[_0x2a90('0x57')]};_0x25ae8c[_0x2a90('0x21')](_0x3729d2);}}_0x42474d({'count':_0x25ae8c['length'],'rows':_0x25ae8c});});},'ChatQueuesWaitingInteractions':function(_0x18be57){return new Promise(function(_0x77a107,_0x46e1d5){var _0xaf1b4a=_[_0x2a90('0x5c')](_0x56d1b8[_0x2a90('0x5d')]);_0x77a107({'count':_0xaf1b4a['length'],'rows':_0xaf1b4a});});},'MailQueuesWaitingInteractions':function(_0x45ea35){return new Promise(function(_0x4123e9,_0x22edda){var _0x1c0aa6=_[_0x2a90('0x5c')](_0x56d1b8[_0x2a90('0x5e')]);_0x4123e9({'count':_0x1c0aa6[_0x2a90('0x19')],'rows':_0x1c0aa6});});},'OpenchannelQueuesWaitingInteractions':function(_0x39ffac){return new Promise(function(_0x59a0a5,_0x36101c){var _0x20aae3=_[_0x2a90('0x5c')](_0x56d1b8[_0x2a90('0x5f')]);_0x59a0a5({'count':_0x20aae3[_0x2a90('0x19')],'rows':_0x20aae3});});},'SmsQueuesWaitingInteractions':function(_0x14138e){return new Promise(function(_0x5a4ef7,_0xfafe71){var _0x44ce8d=_[_0x2a90('0x5c')](_0x56d1b8['smsQueuesWaitingInteractions']);_0x5a4ef7({'count':_0x44ce8d[_0x2a90('0x19')],'rows':_0x44ce8d});});},'FaxQueuesWaitingInteractions':function(_0x2633d5){return new Promise(function(_0x19ecae,_0x5c0a1b){var _0x491227=_[_0x2a90('0x5c')](_0x56d1b8[_0x2a90('0x60')]);_0x19ecae({'count':_0x491227['length'],'rows':_0x491227});});},'WhatsappQueuesWaitingInteractions':function(_0x475fe8){return new Promise(function(_0x138b07,_0x4f3e5f){var _0x241d4b=_[_0x2a90('0x5c')](_0x56d1b8['whatsappQueuesWaitingInteractions']);_0x138b07({'count':_0x241d4b[_0x2a90('0x19')],'rows':_0x241d4b});});}};var _0x339b63=jayson['server'](_0x5a2682)['http']();_0x339b63['on'](_0x2a90('0x40'),function(_0x432db3){logger[_0x2a90('0x40')](JSON[_0x2a90('0x3c')](_0x432db3));return _0x3a42df(_0x432db3);});_0x339b63[_0x2a90('0x61')](0x232c,_0x2a90('0x62'),function(){console[_0x2a90('0x63')](_0x2a90('0x64'),0x232c);return _0x46cb32(_0x2a90('0x65')+0x232c);});});}; \ No newline at end of file +var _0xd547=['applications','existsSync','app','.js','toLowerCase','autoreply','mail','push','slice','join','dialogflow','appdata','split','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','body','format','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','mailQueues','paused','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','isArray','length'];(function(_0x161fd4,_0x5dd552){var _0x503577=function(_0x2d09b1){while(--_0x2d09b1){_0x161fd4['push'](_0x161fd4['shift']());}};_0x503577(++_0x5dd552);}(_0xd547,0x1c1));var _0x7d54=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0xd547[_0x4c06ac];return _0x2333cb;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x7d54('0x0'));var fs=require('fs');var jayson=require(_0x7d54('0x1'));var BPromise=require(_0x7d54('0x2'));var uuid=require(_0x7d54('0x3'));var utils=require('./applications/utils');var config=require('../../../config/environment');var logger=require(_0x7d54('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0x7d54('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x7d54('0x6')),'smsQueueReport':require(_0x7d54('0x7')),'faxQueueReport':require(_0x7d54('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x478f9b,_0xb224a9,_0x39885d){return util['format'](_0x7d54('0x9'),_0x478f9b,_0xb224a9||0x0,_0x39885d||0x0);}function getIntervals(_0x48b250,_0x2bede6){var _0x4d9dc3=[];if(!_[_0x7d54('0xa')](_0x2bede6['IntervalId'])&&!_[_0x7d54('0xa')](_0x48b250[_0x2bede6[_0x7d54('0xb')]])&&!_['isNil'](_0x48b250[_0x2bede6['IntervalId']]['Intervals'])){_0x4d9dc3=_[_0x7d54('0xc')](_0x48b250[_0x2bede6[_0x7d54('0xb')]][_0x7d54('0xd')],'interval');}else if(!_[_0x7d54('0xa')](_0x2bede6['interval'])){_0x4d9dc3=[_0x2bede6[_0x7d54('0xe')]];}return _0x4d9dc3;}exports['listen']=function(_0x11c94a){_0x11c94a[_0x7d54('0xf')]={};return new BPromise(function(_0x4bc96e,_0x268b0c){var _0x208b3c={'Start':function(_0x25b69c){var _0x5a6bec=this;return new Promise(function(_0x2b1b0f,_0x33a519){if(_0x25b69c){try{var _0x2b13d5=[];var _0x12c48d=getId(_0x25b69c[_0x7d54('0x10')],_0x25b69c[_0x7d54('0x11')]?_0x25b69c['message']['id']:0x0,_0x25b69c[_0x7d54('0x12')]?_0x25b69c[_0x7d54('0x12')]['id']:0x0);if(_0x25b69c['applications']&&_[_0x7d54('0x13')](_0x25b69c['applications'])&&_0x25b69c['applications'][_0x7d54('0x14')]){for(var _0x4138f1=0x0;_0x4138f1<_0x25b69c[_0x7d54('0x15')][_0x7d54('0x14')];_0x4138f1+=0x1){var _0x54e783=_0x25b69c[_0x7d54('0x15')][_0x4138f1];if(fs[_0x7d54('0x16')](path['join'](__dirname,_0x7d54('0x15'),_0x54e783[_0x7d54('0x17')]+_0x7d54('0x18')))){var _0x6cc88b=[];switch(_0x54e783[_0x7d54('0x17')][_0x7d54('0x19')]()){case _0x7d54('0x1a'):var _0x4f3a94=_0x54e783['appdata']['split'](',');if(_0x25b69c[_0x7d54('0x10')]===_0x7d54('0x1b')){_0x6cc88b['push'](_0x4f3a94[0x0]);_0x6cc88b[_0x7d54('0x1c')](_0x4f3a94[0x1]);_0x6cc88b[_0x7d54('0x1c')](_0x4f3a94[_0x7d54('0x1d')](0x2,_0x4f3a94[_0x7d54('0x14')])[_0x7d54('0x1e')](','));}else{_0x6cc88b[_0x7d54('0x1c')](_0x4f3a94[0x0]);_0x6cc88b[_0x7d54('0x1c')](_0x4f3a94[_0x7d54('0x1d')](0x1,_0x4f3a94['length'])[_0x7d54('0x1e')](','));}break;case _0x7d54('0x1f'):var _0x5117a4=_0x54e783['appdata']['split'](',');_0x6cc88b['push'](_0x5117a4[0x0]);_0x6cc88b[_0x7d54('0x1c')](_0x5117a4[0x1]);_0x6cc88b[_0x7d54('0x1c')](_0x5117a4['slice'](0x2,_0x5117a4[_0x7d54('0x14')])[_0x7d54('0x1e')](','));break;case'dialogflowv2':var _0x472032=_0x54e783[_0x7d54('0x20')][_0x7d54('0x21')](',');_0x6cc88b[_0x7d54('0x1c')](_0x472032[0x0]);_0x6cc88b[_0x7d54('0x1c')](_0x472032[0x1]);_0x6cc88b[_0x7d54('0x1c')](_0x472032[0x2]);_0x6cc88b[_0x7d54('0x1c')](_0x472032[0x3]);_0x6cc88b[_0x7d54('0x1c')](_0x472032['slice'](0x4,_0x472032[_0x7d54('0x14')])['join'](','));break;case'amazonlex':var _0x2602c2=_0x54e783[_0x7d54('0x20')]['split'](',');_0x6cc88b[_0x7d54('0x1c')](_0x2602c2[0x0]);_0x6cc88b[_0x7d54('0x1c')](_0x2602c2[0x1]);_0x6cc88b[_0x7d54('0x1c')](_0x2602c2[0x2]);_0x6cc88b[_0x7d54('0x1c')](_0x2602c2[0x3]);_0x6cc88b[_0x7d54('0x1c')](_0x2602c2[_0x7d54('0x1d')](0x4,_0x2602c2[_0x7d54('0x14')])['join'](','));break;case _0x7d54('0x11'):_0x6cc88b[_0x7d54('0x1c')](_0x54e783['appdata']);break;case _0x7d54('0x22'):_0x6cc88b[_0x7d54('0x1c')](_0x54e783[_0x7d54('0x23')]);_0x6cc88b['push'](_0x54e783[_0x7d54('0x20')]);break;case _0x7d54('0x24'):var _0x266d0d=utils[_0x7d54('0x25')](_0x25b69c[_0x7d54('0x26')]['notificationTemplate'],_0x25b69c);var _0x4560d9=_0x54e783[_0x7d54('0x20')]['split'](',');_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x0]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x1]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x2]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x3]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x4]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x5]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x6]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x7]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x8]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0x9]);_0x6cc88b[_0x7d54('0x1c')](_0x4560d9[0xa]);_0x6cc88b[_0x7d54('0x1c')](_0x25b69c['interaction']['id']);_0x6cc88b['push'](_0x25b69c[_0x7d54('0x11')]['id']);_0x6cc88b[_0x7d54('0x1c')](_0x54e783[_0x7d54('0x27')]);_0x6cc88b[_0x7d54('0x1c')](_0x25b69c['interaction']['ContactId']);_0x6cc88b[_0x7d54('0x1c')](_0x25b69c['body'][_0x7d54('0x28')]);_0x6cc88b[_0x7d54('0x1c')](_0x266d0d);break;default:_0x6cc88b=_['isNil'](_0x54e783['appdata'])?[]:_0x54e783[_0x7d54('0x20')][_0x7d54('0x21')](',');}var _0x57203d={'id':util[_0x7d54('0x29')](_0x7d54('0x2a'),_0x12c48d,_0x54e783['id'],_0x54e783['app']),'condition':require('./interval')[_0x7d54('0x2b')](_0x12c48d,getIntervals(_0x11c94a[_0x7d54('0x2c')],_0x54e783),_0x11c94a),'consequence':require(_0x7d54('0x2d')+_0x54e783[_0x7d54('0x17')])[_0x7d54('0x2e')](_0x12c48d,_0x6cc88b,_0x11c94a,_0x25b69c),'p':_0x54e783[_0x7d54('0x2f')]||0x0};logger[_0x7d54('0x30')](_0x7d54('0x31'),_0x57203d['id'],_0x7d54('0x32'),getIntervals(_0x11c94a[_0x7d54('0x2c')],_0x54e783)[_0x7d54('0x1e')]('\x20|\x20'));_0x2b13d5['push'](_0x57203d);}else{logger[_0x7d54('0x33')](_0x7d54('0x34'),path[_0x7d54('0x1e')](__dirname,_0x7d54('0x15'),_0x54e783[_0x7d54('0x17')]+_0x7d54('0x18')));}}_0x11c94a[_0x7d54('0xf')][_0x12c48d]=new RuleEngine(_0x2b13d5);_0x11c94a['rules'][_0x12c48d][_0x7d54('0x35')](_0x25b69c,function(_0x588360){logger['info'](_0x7d54('0x36'),JSON[_0x7d54('0x37')](_0x588360[_0x7d54('0x38')]));if(_0x11c94a[_0x7d54('0xf')][_0x12c48d]){_0x11c94a[_0x7d54('0xf')][_0x12c48d]['emit'](_0x7d54('0x39'));}});return _0x2b1b0f({'code':0xc8,'message':_0x25b69c});}else{logger[_0x7d54('0x30')]('No\x20applications\x20to\x20execute');return _0x2b1b0f({'code':0xc8,'message':_0x25b69c});}}catch(_0x18ea23){logger[_0x7d54('0x33')](_0x18ea23[_0x7d54('0x3a')]);return _0x33a519(_0x5a6bec[_0x7d54('0x33')](0x1f4,_0x18ea23));}}return _0x33a519(_0x7d54('0x3b'));});},'AcceptMessage':function(_0x3d6f39){var _0x5a2fcb=this;return new Promise(function(_0x4b6cd6,_0x403f9d){if(_0x3d6f39[_0x7d54('0x3c')]&&_0x3d6f39[_0x7d54('0x3c')]['id']){if(_0x11c94a[_0x7d54('0x3d')][_0x3d6f39[_0x7d54('0x3c')]['id']]){_0x11c94a[_0x7d54('0x3d')][_0x3d6f39['agent']['id']][_0x7d54('0x3e')]=![];_0x11c94a[_0x7d54('0x3d')][_0x3d6f39[_0x7d54('0x3c')]['id']][_0x7d54('0x3f')]=undefined;}}if(_0x3d6f39[_0x7d54('0x11')]&&_0x3d6f39['message']['id']){try{var _0x39094a=getId(_0x3d6f39['channel'],_0x3d6f39[_0x7d54('0x11')]?_0x3d6f39['message']['id']:0x0,_0x3d6f39['interaction']?_0x3d6f39[_0x7d54('0x12')]['id']:0x0);if(_0x11c94a['rules'][_0x39094a]){_0x11c94a['rules'][_0x39094a][_0x7d54('0x40')](_0x7d54('0x41'));if(rpc[_0x3d6f39['channel']+_0x7d54('0x42')]){rpc[_0x3d6f39[_0x7d54('0x10')]+_0x7d54('0x42')]['update'](_0x39094a,{'UserId':_0x3d6f39[_0x7d54('0x11')]['UserId']})[_0x7d54('0x43')](function(_0x1692e9){logger[_0x7d54('0x33')](_0x7d54('0x44'));});}}return _0x4b6cd6({'code':0xc8,'message':_0x3d6f39});}catch(_0x53de17){logger['error'](_0x53de17[_0x7d54('0x3a')]);return _0x403f9d(_0x5a2fcb[_0x7d54('0x33')](0x1f4,_0x53de17));}}logger[_0x7d54('0x33')](_0x7d54('0x45'));return _0x403f9d(_0x5a2fcb[_0x7d54('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x326bdb){var _0x33604c=this;return new Promise(function(_0x532e6c,_0x2e3e08){if(_0x326bdb[_0x7d54('0x3c')]&&_0x326bdb[_0x7d54('0x3c')]['id']){try{if(_0x11c94a[_0x7d54('0x3d')][_0x326bdb[_0x7d54('0x3c')]['id']]){_0x11c94a[_0x7d54('0x3d')][_0x326bdb[_0x7d54('0x3c')]['id']][_0x7d54('0x3e')]=![];_0x11c94a['agents'][_0x326bdb[_0x7d54('0x3c')]['id']][_0x7d54('0x3f')]=undefined;}return _0x532e6c({'code':0xc8,'message':_0x326bdb});}catch(_0x2938ac){logger['error'](_0x2938ac[_0x7d54('0x3a')]);return _0x2e3e08(_0x33604c[_0x7d54('0x33')](0x1f4,_0x2938ac));}}logger[_0x7d54('0x33')](_0x7d54('0x45'));return _0x2e3e08(_0x33604c['error'](0x1f4,_0x7d54('0x45')));});},'AbandonInteraction':function(_0x238210){var _0xe9db27=this;return new Promise(function(_0x55ee74,_0x5be8d3){if(_0x238210['channel']&&_0x238210['interaction']&&_0x238210[_0x7d54('0x12')]['id']){try{var _0x369c4a=getId(_0x238210[_0x7d54('0x10')],_0x238210[_0x7d54('0x11')]?_0x238210[_0x7d54('0x11')]['id']:0x0,_0x238210['interaction']?_0x238210['interaction']['id']:0x0);if(_0x11c94a['rules'][_0x369c4a]){_0x11c94a['rules'][_0x369c4a][_0x7d54('0x40')]('end');}return _0x55ee74({'code':0xc8,'message':_0x238210});}catch(_0x36a82a){logger['error'](_0x36a82a[_0x7d54('0x3a')]);return _0x5be8d3(_0xe9db27['error'](0x1f4,_0x36a82a));}}logger[_0x7d54('0x33')](_0x7d54('0x45'));return _0x5be8d3(_0xe9db27['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x519759){var _0x2b6dfb=this;return new Promise(function(_0x37bf9c,_0x4cccf1){if(_0x11c94a['agents'][_0x7d54('0x46')](_0x519759['id'])){for(var _0x21dcd7 in _0x519759[_0x7d54('0x47')]){if(_0x519759[_0x7d54('0x47')][_0x7d54('0x46')](_0x21dcd7)){if(_0x11c94a['agents'][_0x519759['id']][_0x7d54('0x46')](_0x21dcd7+'CurrentCapacity')){_0x11c94a['agents'][_0x519759['id']][_0x21dcd7+_0x7d54('0x48')]=parseInt(_0x519759[_0x7d54('0x47')][_0x21dcd7],0xa);}}}_0x11c94a[_0x7d54('0x3d')][_0x519759['id']][_0x7d54('0x49')]();return _0x37bf9c({'code':0xc8,'message':_0x11c94a[_0x7d54('0x3d')][_0x519759['id']]});}else{return _0x4cccf1(_0x2b6dfb['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x580664){return new Promise(function(_0x5a3cdb,_0x45d5f3){var _0x1a04b9=_['values'](_0x11c94a[_0x7d54('0x3d')]);_0x5a3cdb({'count':_0x1a04b9[_0x7d54('0x14')],'rows':_0x1a04b9});});},'ChatQueues':function(_0x5e78cc){return new Promise(function(_0x4b5f6f,_0x2c0f39){var _0x2a1ffa=[];for(var _0x37ae5e in _0x11c94a[_0x7d54('0x4a')]){if(_0x11c94a['chatQueues'][_0x7d54('0x46')](_0x37ae5e)){var _0x247d06=_0x11c94a[_0x7d54('0x4a')][_0x37ae5e];var _0xf45231={'id':_0x247d06['id'],'available':_0x247d06[_0x7d54('0x4b')],'loggedIn':_0x247d06[_0x7d54('0x4c')],'name':_0x247d06[_0x7d54('0x4d')],'paused':_0x247d06['paused'],'waiting':_0x247d06['waiting']};_0x2a1ffa[_0x7d54('0x1c')](_0xf45231);}}_0x4b5f6f({'count':_0x2a1ffa['length'],'rows':_0x2a1ffa});});},'MailQueues':function(_0x770d4d){return new Promise(function(_0x37d990,_0xc2b893){var _0x1b97da=[];for(var _0x3f0bdc in _0x11c94a[_0x7d54('0x4e')]){if(_0x11c94a['mailQueues'][_0x7d54('0x46')](_0x3f0bdc)){var _0x3abd4e=_0x11c94a[_0x7d54('0x4e')][_0x3f0bdc];var _0x2c4485={'id':_0x3abd4e['id'],'available':_0x3abd4e[_0x7d54('0x4b')],'loggedIn':_0x3abd4e[_0x7d54('0x4c')],'name':_0x3abd4e[_0x7d54('0x4d')],'paused':_0x3abd4e[_0x7d54('0x4f')],'waiting':_0x3abd4e['waiting']};_0x1b97da[_0x7d54('0x1c')](_0x2c4485);}}_0x37d990({'count':_0x1b97da[_0x7d54('0x14')],'rows':_0x1b97da});});},'OpenchannelQueues':function(_0x5b916d){return new Promise(function(_0x20bb3b,_0x28c5a0){var _0x49b9ae=[];for(var _0x562ff1 in _0x11c94a[_0x7d54('0x50')]){if(_0x11c94a['openchannelQueues']['hasOwnProperty'](_0x562ff1)){var _0xb70943=_0x11c94a[_0x7d54('0x50')][_0x562ff1];var _0x26c0ef={'id':_0xb70943['id'],'available':_0xb70943[_0x7d54('0x4b')],'loggedIn':_0xb70943[_0x7d54('0x4c')],'name':_0xb70943['name'],'paused':_0xb70943[_0x7d54('0x4f')],'waiting':_0xb70943[_0x7d54('0x51')]};_0x49b9ae[_0x7d54('0x1c')](_0x26c0ef);}}_0x20bb3b({'count':_0x49b9ae['length'],'rows':_0x49b9ae});});},'SmsQueues':function(_0x52baf0){return new Promise(function(_0x5306b3,_0xfd6137){var _0x4abf96=[];for(var _0x4cd995 in _0x11c94a[_0x7d54('0x52')]){if(_0x11c94a[_0x7d54('0x52')][_0x7d54('0x46')](_0x4cd995)){var _0x3276d9=_0x11c94a[_0x7d54('0x52')][_0x4cd995];var _0x1d5734={'id':_0x3276d9['id'],'available':_0x3276d9[_0x7d54('0x4b')],'loggedIn':_0x3276d9[_0x7d54('0x4c')],'name':_0x3276d9[_0x7d54('0x4d')],'paused':_0x3276d9['paused'],'waiting':_0x3276d9[_0x7d54('0x51')]};_0x4abf96[_0x7d54('0x1c')](_0x1d5734);}}_0x5306b3({'count':_0x4abf96[_0x7d54('0x14')],'rows':_0x4abf96});});},'FaxQueues':function(_0x1d631d){return new Promise(function(_0x80f9f2,_0x526990){var _0x5622fa=[];for(var _0x35029f in _0x11c94a['faxQueues']){if(_0x11c94a[_0x7d54('0x53')][_0x7d54('0x46')](_0x35029f)){var _0xfc06d7=_0x11c94a[_0x7d54('0x53')][_0x35029f];var _0x1c0268={'id':_0xfc06d7['id'],'available':_0xfc06d7[_0x7d54('0x4b')],'loggedIn':_0xfc06d7[_0x7d54('0x4c')],'name':_0xfc06d7[_0x7d54('0x4d')],'paused':_0xfc06d7[_0x7d54('0x4f')],'waiting':_0xfc06d7[_0x7d54('0x51')]};_0x5622fa[_0x7d54('0x1c')](_0x1c0268);}}_0x80f9f2({'count':_0x5622fa[_0x7d54('0x14')],'rows':_0x5622fa});});},'WhatsappQueues':function(_0x5d6beb){return new Promise(function(_0x215d29,_0x7cbc02){var _0x38084e=[];for(var _0x4e4550 in _0x11c94a[_0x7d54('0x54')]){if(_0x11c94a[_0x7d54('0x54')][_0x7d54('0x46')](_0x4e4550)){var _0x509ce6=_0x11c94a[_0x7d54('0x54')][_0x4e4550];var _0x28cc6f={'id':_0x509ce6['id'],'available':_0x509ce6[_0x7d54('0x4b')],'loggedIn':_0x509ce6['loggedIn'],'name':_0x509ce6[_0x7d54('0x4d')],'paused':_0x509ce6[_0x7d54('0x4f')],'waiting':_0x509ce6['waiting']};_0x38084e['push'](_0x28cc6f);}}_0x215d29({'count':_0x38084e[_0x7d54('0x14')],'rows':_0x38084e});});},'ChatQueuesWaitingInteractions':function(_0x18d0e7){return new Promise(function(_0x1ae929,_0x901f7){var _0x11294c=_['values'](_0x11c94a['chatQueuesWaitingInteractions']);_0x1ae929({'count':_0x11294c[_0x7d54('0x14')],'rows':_0x11294c});});},'MailQueuesWaitingInteractions':function(_0x165910){return new Promise(function(_0x17b675,_0x12f82e){var _0x46a397=_['values'](_0x11c94a[_0x7d54('0x55')]);_0x17b675({'count':_0x46a397[_0x7d54('0x14')],'rows':_0x46a397});});},'OpenchannelQueuesWaitingInteractions':function(_0x286187){return new Promise(function(_0x14d32d,_0x57d9f3){var _0x1ee675=_[_0x7d54('0x56')](_0x11c94a[_0x7d54('0x57')]);_0x14d32d({'count':_0x1ee675[_0x7d54('0x14')],'rows':_0x1ee675});});},'SmsQueuesWaitingInteractions':function(_0x3bf887){return new Promise(function(_0x1654b2,_0x9bd346){var _0xa5a4ba=_[_0x7d54('0x56')](_0x11c94a[_0x7d54('0x58')]);_0x1654b2({'count':_0xa5a4ba['length'],'rows':_0xa5a4ba});});},'FaxQueuesWaitingInteractions':function(_0xaffef1){return new Promise(function(_0x3d4acf,_0x6a6fce){var _0x2afe98=_['values'](_0x11c94a['faxQueuesWaitingInteractions']);_0x3d4acf({'count':_0x2afe98[_0x7d54('0x14')],'rows':_0x2afe98});});},'WhatsappQueuesWaitingInteractions':function(_0x62ba1c){return new Promise(function(_0x3ce36d,_0x2a6f31){var _0x1a1560=_[_0x7d54('0x56')](_0x11c94a[_0x7d54('0x59')]);_0x3ce36d({'count':_0x1a1560['length'],'rows':_0x1a1560});});}};var _0x68d02c=jayson[_0x7d54('0x5a')](_0x208b3c)['http']();_0x68d02c['on'](_0x7d54('0x33'),function(_0x39329d){logger[_0x7d54('0x33')](JSON[_0x7d54('0x37')](_0x39329d));return _0x268b0c(_0x39329d);});_0x68d02c[_0x7d54('0x5b')](0x232c,_0x7d54('0x5c'),function(){console[_0x7d54('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x4bc96e('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ceb9313..bfcb51e 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 _0xa402=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','iftime\x20%s','true','some','join','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','stop','jayson/promise','../../../config/logger','request','then','error','message','result','catch','rules'];(function(_0x49996d,_0x3fcd8f){var _0x9c2f5c=function(_0x5c40aa){while(--_0x5c40aa){_0x49996d['push'](_0x49996d['shift']());}};_0x9c2f5c(++_0x3fcd8f);}(_0xa402,0x150));var _0x2a40=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa402[_0x4e1d03];return _0x362d4b;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x2a40('0x0'));var _=require('lodash');var logger=require(_0x2a40('0x1'))('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x4ec6a9,_0x173aef){return new BPromise(function(_0x3d0e8f,_0xa02703){return client[_0x2a40('0x2')](_0x4ec6a9,_0x173aef)[_0x2a40('0x3')](function(_0x39d296){if(_0x39d296[_0x2a40('0x4')]){return _0xa02703(_0x39d296[_0x2a40('0x4')][_0x2a40('0x5')]);}else{return _0x3d0e8f(_0x39d296[_0x2a40('0x6')]);}})[_0x2a40('0x7')](function(_0x15a257){return _0xa02703(_0x15a257);});});}exports['condition']=function(_0x4b3298,_0x581f25,_0x3c6105){return function(_0x10211f){if(_0x3c6105[_0x2a40('0x8')]&&!_0x3c6105['rules'][_0x4b3298]){logger[_0x2a40('0x9')](_0x2a40('0xa'),_0x4b3298);return _0x10211f['stop']();}var _0x434a01=[];for(var _0x590a3b=0x0;_0x590a3b<_0x581f25[_0x2a40('0xb')];_0x590a3b+=0x1){_0x434a01[_0x2a40('0xc')](request(_0x2a40('0xd'),{'command':util['format'](_0x2a40('0xe'),_0x581f25[_0x590a3b])})[_0x2a40('0x3')](function(_0x5438e5){return _0x5438e5&&_0x5438e5['message']&&_0x5438e5[_0x2a40('0x5')]['indexOf'](_0x2a40('0xf'))>=0x0?!![]:![];})['catch'](function(_0x3ea5f4){logger[_0x2a40('0x4')]('[%s][INTERVAL]\x20%s',_0x4b3298,_0x581f25[_0x590a3b]);}));}BPromise['all'](_0x434a01)[_0x2a40('0x3')](function(_0x140aac){var _0x40ac90=_[_0x2a40('0x10')](_0x140aac);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x4b3298,_0x581f25[_0x2a40('0x11')]('\x20|\x20'),_0x40ac90);_0x10211f['when'](_0x40ac90);})[_0x2a40('0x7')](function(_0x3574d8){console[_0x2a40('0x12')](_0x3574d8);logger[_0x2a40('0x4')](_0x2a40('0x13'),_0x4b3298,_0x581f25[_0x2a40('0x11')](_0x2a40('0x14')),_0x3574d8[_0x2a40('0x15')]);_0x10211f[_0x2a40('0x16')]();});};}; \ No newline at end of file +var _0xd7d4=['stack','util','bluebird','routing','client','http','then','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log'];(function(_0x4ee412,_0x402c87){var _0x187ae3=function(_0x5ec22a){while(--_0x5ec22a){_0x4ee412['push'](_0x4ee412['shift']());}};_0x187ae3(++_0x402c87);}(_0xd7d4,0x11f));var _0x4d7d=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0xd7d4[_0x220afa];return _0x1b79d1;};'use strict';var util=require(_0x4d7d('0x0'));var BPromise=require(_0x4d7d('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x4d7d('0x2'));var client=jayson[_0x4d7d('0x3')][_0x4d7d('0x4')]({'port':0x232a});function request(_0xed9555,_0x1256b8){return new BPromise(function(_0x533cee,_0x4a3b34){return client['request'](_0xed9555,_0x1256b8)[_0x4d7d('0x5')](function(_0x321e69){if(_0x321e69[_0x4d7d('0x6')]){return _0x4a3b34(_0x321e69[_0x4d7d('0x6')][_0x4d7d('0x7')]);}else{return _0x533cee(_0x321e69['result']);}})[_0x4d7d('0x8')](function(_0x22dca6){return _0x4a3b34(_0x22dca6);});});}exports['condition']=function(_0x21219b,_0x336545,_0x16e817){return function(_0x4018ce){if(_0x16e817[_0x4d7d('0x9')]&&!_0x16e817[_0x4d7d('0x9')][_0x21219b]){logger[_0x4d7d('0xa')](_0x4d7d('0xb'),_0x21219b);return _0x4018ce[_0x4d7d('0xc')]();}var _0x90d43e=[];for(var _0x3068fd=0x0;_0x3068fd<_0x336545[_0x4d7d('0xd')];_0x3068fd+=0x1){_0x90d43e[_0x4d7d('0xe')](request(_0x4d7d('0xf'),{'command':util['format'](_0x4d7d('0x10'),_0x336545[_0x3068fd])})[_0x4d7d('0x5')](function(_0x1a5dba){return _0x1a5dba&&_0x1a5dba[_0x4d7d('0x7')]&&_0x1a5dba[_0x4d7d('0x7')][_0x4d7d('0x11')](_0x4d7d('0x12'))>=0x0?!![]:![];})[_0x4d7d('0x8')](function(_0x220627){logger['error']('[%s][INTERVAL]\x20%s',_0x21219b,_0x336545[_0x3068fd]);}));}BPromise[_0x4d7d('0x13')](_0x90d43e)[_0x4d7d('0x5')](function(_0x4007fc){var _0x17c5a6=_['some'](_0x4007fc);logger['info'](_0x4d7d('0x14'),_0x21219b,_0x336545[_0x4d7d('0x15')](_0x4d7d('0x16')),_0x17c5a6);_0x4018ce[_0x4d7d('0x17')](_0x17c5a6);})[_0x4d7d('0x8')](function(_0x1dc91e){console[_0x4d7d('0x18')](_0x1dc91e);logger[_0x4d7d('0x6')](_0x4d7d('0x14'),_0x21219b,_0x336545['join']('\x20|\x20'),_0x1dc91e[_0x4d7d('0x19')]);_0x4018ce['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 5b979ad..d4360be 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 _0x6e6c=['agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','agentcalledAt','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','format','agentringnoanswer','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0x52c112,_0x5ca4ac){var _0x574da0=function(_0x2476f3){while(--_0x2476f3){_0x52c112['push'](_0x52c112['shift']());}};_0x574da0(++_0x5ca4ac);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x370b21,_0x1b63fe){utils['info'](util['format'](_0xc6e6('0x2'),_0x370b21['uniqueid'],_0x370b21[_0xc6e6('0x3')],_0x370b21['queue'],_0x370b21[_0xc6e6('0x4')],_0x370b21[_0xc6e6('0x5')],_0x370b21['calleridnum'],_0x370b21[_0xc6e6('0x6')],_0x370b21[_0xc6e6('0x7')]));if(_0x370b21['queue']){utils[_0xc6e6('0x8')](_0x370b21[_0xc6e6('0x9')])['then'](function(_0x324f05){if(_0x324f05){_0x370b21['type']=_0x324f05[_0xc6e6('0xa')];_0x370b21[_0xc6e6('0xb')]=_0x370b21[_0xc6e6('0xc')]?_0x324f05[_0xc6e6('0xd')]:![];_0x370b21[_0xc6e6('0xe')]=_0x370b21[_0xc6e6('0xb')]?_0x324f05[_0xc6e6('0xf')]:0x0;}utils[_0xc6e6('0x10')](_0xc6e6('0x11'),_0x370b21);});}else{utils['request'](_0xc6e6('0x11'),_0x370b21);}if(_0x1b63fe){delete transfers[_0x370b21['uniqueid']];}else{delete agents[_0x370b21[_0xc6e6('0x12')]];}}exports[_0xc6e6('0x13')]=function(_0x33aea0){try{utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x33aea0);agents[_0x33aea0[_0xc6e6('0x12')]]=_0x33aea0;agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x17')]=utils['now']();agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x7')]='called';agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x6')]=null;agents[_0x33aea0[_0xc6e6('0x12')]]['connectedlinename']=null;utils['info'](util['format'](_0xc6e6('0x18'),_0x33aea0['uniqueid'],agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x33aea0[_0xc6e6('0x12')]));}catch(_0x41afe6){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x41afe6);}};exports[_0xc6e6('0x1b')]=function(_0x3d734d){try{if(!_['isNil'](agents[_0x3d734d[_0xc6e6('0x12')]])){utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x1c'),_0x3d734d[_0xc6e6('0x16')]),_0x3d734d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x1e'),_0x3d734d[_0xc6e6('0x16')],agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x3d734d[_0xc6e6('0x12')]));agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1b')]=!![];agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1f')]=utils[_0xc6e6('0x20')]();agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x7')]='timeout';agents[_0x3d734d[_0xc6e6('0x12')]]['reason']=_0xc6e6('0x21');agents[_0x3d734d['destuniqueid']][_0xc6e6('0x22')]=_0x3d734d[_0xc6e6('0x23')]?parseInt(_0x3d734d[_0xc6e6('0x23')])/0x3e8:0x0;agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x24')]=0x0;unanswered['push'](_0x3d734d[_0xc6e6('0x12')]);}}catch(_0x1501bd){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][agentringnoanswer]',_0x3d734d[_0xc6e6('0x16')]),_0x1501bd);}};exports['queuecallerabandon']=function(_0x29411c){try{_[_0xc6e6('0x25')](agents,function(_0x12c616,_0xc578b3){if(_0x12c616[_0xc6e6('0x16')]==_0x29411c[_0xc6e6('0x16')]&&!_[_0xc6e6('0x26')](unanswered,_0x12c616[_0xc6e6('0x12')])){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c[_0xc6e6('0x16')]),_0x29411c);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x28'),_0x29411c[_0xc6e6('0x16')],_0x12c616[_0xc6e6('0x4')],_0x12c616['destuniqueid']));_0x12c616[_0xc6e6('0x1b')]=!![];_0x12c616[_0xc6e6('0x1f')]=utils['now']();_0x12c616['lastevent']=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x2a')]=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x22')]=_0x29411c[_0xc6e6('0x22')];_0x12c616[_0xc6e6('0x24')]=0x0;writeDB(_0x12c616);}});}catch(_0x59a8f0){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c['uniqueid']),_0x59a8f0);}};exports['agentconnect']=function(_0xa5138d){try{if(agents[_0xa5138d[_0xc6e6('0x12')]]){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')]('[%s][agents][agentconnect]',_0xa5138d['uniqueid']),_0xa5138d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x2b'),_0xa5138d['uniqueid'],agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0xa5138d[_0xc6e6('0x12')]));agents[_0xa5138d[_0xc6e6('0x12')]]['agentconnectAt']=utils['now']();agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x6')]=_0xa5138d[_0xc6e6('0x6')];agents[_0xa5138d[_0xc6e6('0x12')]]['connectedlinename']=_0xa5138d['connectedlinename'];agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x22')]=_0xa5138d[_0xc6e6('0x23')];agents[_0xa5138d[_0xc6e6('0x12')]]['lastevent']=_0xc6e6('0x2c');_[_0xc6e6('0x25')](agents,function(_0x5ddab4,_0x500b7e){if(_0x5ddab4[_0xc6e6('0x12')]!=_0xa5138d['destuniqueid']&&_0x5ddab4[_0xc6e6('0x16')]==_0xa5138d[_0xc6e6('0x16')]){_0x5ddab4['talktime']=0x0;_0x5ddab4[_0xc6e6('0x22')]=_0xa5138d['ringtime'];_0x5ddab4[_0xc6e6('0x1b')]=!![];_0x5ddab4['agentringnoanswerAt']=utils[_0xc6e6('0x20')]();_0x5ddab4[_0xc6e6('0x7')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2a')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2e')]=_0xa5138d[_0xc6e6('0x12')];_0x5ddab4[_0xc6e6('0x2f')]=_0xa5138d[_0xc6e6('0x4')];writeDB(_0x5ddab4);}});}}catch(_0x5722db){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x30'),_0xa5138d[_0xc6e6('0x16')]),_0x5722db);}};exports['agentcomplete']=function(_0xc5f4fb){try{if(!_[_0xc6e6('0x31')](agents[_0xc5f4fb[_0xc6e6('0x12')]])){utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xc5f4fb);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x33'),_0xc5f4fb['uniqueid'],agents[_0xc5f4fb[_0xc6e6('0x12')]]['membername'],_0xc5f4fb[_0xc6e6('0x12')]));agents[_0xc5f4fb['destuniqueid']][_0xc6e6('0xc')]=!![];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](agents[_0xc5f4fb[_0xc6e6('0x12')]]['agentcompleteAt'],agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x36')]);agents[_0xc5f4fb[_0xc6e6('0x12')]]['reason']=_0xc5f4fb[_0xc6e6('0x2a')];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x7')]=_0xc6e6('0x37');writeDB(agents[_0xc5f4fb[_0xc6e6('0x12')]]);}}catch(_0xefd557){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xefd557);}};exports[_0xc6e6('0x38')]=function(_0x470167){try{if(!_[_0xc6e6('0x31')](agents[_0x470167[_0xc6e6('0x39')]])){utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x470167);utils[_0xc6e6('0x1d')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x470167['uniqueid'],agents[_0x470167['transfereruniqueid']]['membername'],agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')]));agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3a')]=!![];agents[_0x470167[_0xc6e6('0x39')]]['transfertype']='blind';agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3b')]=_0x470167[_0xc6e6('0x3c')];agents[_0x470167[_0xc6e6('0x39')]]['transferuniqueid']=agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')];}}catch(_0x286dc1){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x286dc1);}};exports[_0xc6e6('0x3d')]=function(_0x288912){try{utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x288912);if(_0x288912[_0xc6e6('0x3f')]==_0x288912[_0xc6e6('0x40')]){if(!_['isNil'](agents[_0x288912[_0xc6e6('0x41')]])){utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x42'),_0x288912[_0xc6e6('0x3f')],agents[_0x288912['secondtransfereruniqueid']]['membername']));agents[_0x288912['secondtransfereruniqueid']][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x3b')]=_0x288912['origtransfererexten'];agents[_0x288912[_0xc6e6('0x41')]]['transferuniqueid']=_0x288912[_0xc6e6('0x3f')];}if(_0x288912[_0xc6e6('0x45')]&&agents[_0x288912[_0xc6e6('0x45')]]){agents[_0x288912['transfereeuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912['transfereeuniqueid']]=_[_0xc6e6('0x47')](agents[_0x288912['transfereeuniqueid']]);transfers[_0x288912['transfereeuniqueid']][_0xc6e6('0x48')]=agents[_0x288912['secondtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x17')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]]['agentconnectAt']=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912[_0xc6e6('0x45')]]['agententerreason']=0x2;}}else if(_0x288912[_0xc6e6('0x41')]==_0x288912[_0xc6e6('0x4a')]){if(!_[_0xc6e6('0x31')](agents[_0x288912['origtransfereruniqueid']])){utils['info'](util[_0xc6e6('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x288912['origtransfereruniqueid'],agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x4')]));agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3b')]=_0x288912[_0xc6e6('0x4b')];agents[_0x288912[_0xc6e6('0x3f')]]['transferuniqueid']=_0x288912['secondtransfereruniqueid'];}if(_0x288912[_0xc6e6('0x4c')]&&agents[_0x288912['transfertargetuniqueid']]){agents[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912[_0xc6e6('0x4c')]]=_[_0xc6e6('0x47')](agents[_0x288912['transfertargetuniqueid']]);transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x48')]=agents[_0x288912['origtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x17')]=utils['now']();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x36')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x2;}}}catch(_0x3b1549){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x3b1549);}};exports['hangup']=function(_0x27e74b){try{utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][hangup]',_0x27e74b['uniqueid']),_0x27e74b);if(agents[_0x27e74b[_0xc6e6('0x16')]]&&agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')]===_0xc6e6('0x21')){if(_0x27e74b[_0xc6e6('0x4d')]==='21'){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]='rejected';agents[_0x27e74b[_0xc6e6('0x16')]]['lastevent']='rejected';}utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]]['membername'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);var _0x292107=unanswered[_0xc6e6('0x4f')](_0x27e74b['uniqueid']);if(_0x292107>-0x1){unanswered[_0xc6e6('0x50')](_0x292107,0x1);}}if(transfers[_0x27e74b[_0xc6e6('0x16')]]){transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];transfers[_0x27e74b[_0xc6e6('0x16')]]['agentcompleteAt']=utils[_0xc6e6('0x20')]();transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](transfers[_0x27e74b['uniqueid']]['agentcompleteAt'],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x36')]);transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]=_0xc6e6('0x51');transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27e74b[_0xc6e6('0x16')],transfers[_0x27e74b['uniqueid']][_0xc6e6('0x4')],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')],transfers[_0x27e74b['uniqueid']]['lastevent']));writeDB(transfers[_0x27e74b[_0xc6e6('0x16')]],!![]);}if(agents[_0x27e74b['uniqueid']]&&agents[_0x27e74b[_0xc6e6('0x16')]]['agentconnectAt']){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];agents[_0x27e74b['uniqueid']][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0x27e74b[_0xc6e6('0x16')]]['talktime']=utils[_0xc6e6('0x35')](agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x34')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x36')]);agents[_0x27e74b[_0xc6e6('0x16')]]['reason']=agents[_0x27e74b['uniqueid']]['transfer']?_0xc6e6('0x3a'):_0xc6e6('0x51');agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x4')],agents[_0x27e74b[_0xc6e6('0x16')]]['reason'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);}}catch(_0x1826d){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x52'),_0x27e74b[_0xc6e6('0x16')]),_0x1826d);}}; \ No newline at end of file +var _0x1be1=['destuniqueid','agentcalled','debug','called','error','[%s][agents][agentcalled]','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','lastevent','timeout','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','reason','holdtime','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request'];(function(_0x3a1229,_0x1563ab){var _0x49b2bd=function(_0x16f214){while(--_0x16f214){_0x3a1229['push'](_0x3a1229['shift']());}};_0x49b2bd(++_0x1563ab);}(_0x1be1,0x192));var _0x11be=function(_0x4d3080,_0x3a025d){_0x4d3080=_0x4d3080-0x0;var _0x112d85=_0x1be1[_0x4d3080];return _0x112d85;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x11be('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33a55d,_0x5527b3){utils[_0x11be('0x1')](util[_0x11be('0x2')](_0x11be('0x3'),_0x33a55d[_0x11be('0x4')],_0x33a55d['channel'],_0x33a55d[_0x11be('0x5')],_0x33a55d[_0x11be('0x6')],_0x33a55d[_0x11be('0x7')],_0x33a55d['calleridnum'],_0x33a55d[_0x11be('0x8')],_0x33a55d['lastevent']));if(_0x33a55d[_0x11be('0x5')]){utils[_0x11be('0x9')](_0x33a55d[_0x11be('0x5')])[_0x11be('0xa')](function(_0x162eaa){if(_0x162eaa){_0x33a55d['type']=_0x162eaa[_0x11be('0xb')];_0x33a55d[_0x11be('0xc')]=_0x33a55d['agentcomplete']?_0x162eaa[_0x11be('0xd')]:![];_0x33a55d[_0x11be('0xe')]=_0x33a55d[_0x11be('0xc')]?_0x162eaa[_0x11be('0xf')]:0x0;}utils['request'](_0x11be('0x10'),_0x33a55d);});}else{utils[_0x11be('0x11')](_0x11be('0x10'),_0x33a55d);}if(_0x5527b3){delete transfers[_0x33a55d['uniqueid']];}else{delete agents[_0x33a55d[_0x11be('0x12')]];}}exports[_0x11be('0x13')]=function(_0x4ce3ae){try{utils[_0x11be('0x14')](util['format']('[%s][agents][agentcalled]',_0x4ce3ae['uniqueid']),_0x4ce3ae);agents[_0x4ce3ae['destuniqueid']]=_0x4ce3ae;agents[_0x4ce3ae['destuniqueid']]['agentcalledAt']=utils['now']();agents[_0x4ce3ae[_0x11be('0x12')]]['lastevent']=_0x11be('0x15');agents[_0x4ce3ae[_0x11be('0x12')]][_0x11be('0x8')]=null;agents[_0x4ce3ae[_0x11be('0x12')]]['connectedlinename']=null;utils[_0x11be('0x1')](util[_0x11be('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4ce3ae[_0x11be('0x4')],agents[_0x4ce3ae[_0x11be('0x12')]][_0x11be('0x6')],_0x4ce3ae['destuniqueid']));}catch(_0x51ba82){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x17'),_0x4ce3ae[_0x11be('0x4')]),_0x51ba82);}};exports['agentringnoanswer']=function(_0x12a5bd){try{if(!_[_0x11be('0x18')](agents[_0x12a5bd[_0x11be('0x12')]])){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x19'),_0x12a5bd[_0x11be('0x4')]),_0x12a5bd);utils[_0x11be('0x1')](util[_0x11be('0x2')](_0x11be('0x1a'),_0x12a5bd['uniqueid'],agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x6')],_0x12a5bd[_0x11be('0x12')]));agents[_0x12a5bd['destuniqueid']]['agentringnoanswer']=!![];agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x1b')]=utils[_0x11be('0x1c')]();agents[_0x12a5bd['destuniqueid']][_0x11be('0x1d')]='timeout';agents[_0x12a5bd[_0x11be('0x12')]]['reason']=_0x11be('0x1e');agents[_0x12a5bd[_0x11be('0x12')]]['holdtime']=_0x12a5bd[_0x11be('0x1f')]?parseInt(_0x12a5bd[_0x11be('0x1f')])/0x3e8:0x0;agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x20')]=0x0;unanswered[_0x11be('0x21')](_0x12a5bd[_0x11be('0x12')]);}}catch(_0xf5a6ac){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][agentringnoanswer]',_0x12a5bd[_0x11be('0x4')]),_0xf5a6ac);}};exports['queuecallerabandon']=function(_0x182f6b){try{_[_0x11be('0x22')](agents,function(_0x510476,_0x584d4c){if(_0x510476[_0x11be('0x4')]==_0x182f6b[_0x11be('0x4')]&&!_[_0x11be('0x23')](unanswered,_0x510476[_0x11be('0x12')])){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x24'),_0x182f6b[_0x11be('0x4')]),_0x182f6b);utils[_0x11be('0x1')](util['format'](_0x11be('0x25'),_0x182f6b[_0x11be('0x4')],_0x510476[_0x11be('0x6')],_0x510476[_0x11be('0x12')]));_0x510476[_0x11be('0x26')]=!![];_0x510476[_0x11be('0x1b')]=utils['now']();_0x510476[_0x11be('0x1d')]=_0x11be('0x27');_0x510476[_0x11be('0x28')]=_0x11be('0x27');_0x510476[_0x11be('0x29')]=_0x182f6b['holdtime'];_0x510476[_0x11be('0x20')]=0x0;writeDB(_0x510476);}});}catch(_0x254be5){utils[_0x11be('0x16')](util['format'](_0x11be('0x24'),_0x182f6b['uniqueid']),_0x254be5);}};exports['agentconnect']=function(_0x4c1f4d){try{if(agents[_0x4c1f4d['destuniqueid']]){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x2a'),_0x4c1f4d['uniqueid']),_0x4c1f4d);utils[_0x11be('0x1')](util[_0x11be('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4c1f4d[_0x11be('0x4')],agents[_0x4c1f4d['destuniqueid']][_0x11be('0x6')],_0x4c1f4d['destuniqueid']));agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();agents[_0x4c1f4d[_0x11be('0x12')]]['connectedlinenum']=_0x4c1f4d[_0x11be('0x8')];agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x2c')]=_0x4c1f4d[_0x11be('0x2c')];agents[_0x4c1f4d['destuniqueid']][_0x11be('0x29')]=_0x4c1f4d[_0x11be('0x1f')];agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x1d')]=_0x11be('0x2d');_[_0x11be('0x22')](agents,function(_0x5742d1,_0x5ee47c){if(_0x5742d1[_0x11be('0x12')]!=_0x4c1f4d[_0x11be('0x12')]&&_0x5742d1['uniqueid']==_0x4c1f4d[_0x11be('0x4')]){_0x5742d1[_0x11be('0x20')]=0x0;_0x5742d1['holdtime']=_0x4c1f4d[_0x11be('0x1f')];_0x5742d1['agentringnoanswer']=!![];_0x5742d1[_0x11be('0x1b')]=utils['now']();_0x5742d1[_0x11be('0x1d')]=_0x11be('0x2e');_0x5742d1['reason']=_0x11be('0x2e');_0x5742d1['answeredelsewheredestinationuniqueid']=_0x4c1f4d[_0x11be('0x12')];_0x5742d1[_0x11be('0x2f')]=_0x4c1f4d[_0x11be('0x6')];writeDB(_0x5742d1);}});}}catch(_0x383604){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x2a'),_0x4c1f4d['uniqueid']),_0x383604);}};exports[_0x11be('0x30')]=function(_0x18cddf){try{if(!_[_0x11be('0x18')](agents[_0x18cddf[_0x11be('0x12')]])){utils['debug'](util['format']('[%s][agents][agentcomplete]',_0x18cddf[_0x11be('0x4')]),_0x18cddf);utils['info'](util[_0x11be('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x18cddf[_0x11be('0x4')],agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x6')],_0x18cddf[_0x11be('0x12')]));agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x30')]=!![];agents[_0x18cddf[_0x11be('0x12')]]['agentcompleteAt']=utils[_0x11be('0x1c')]();agents[_0x18cddf['destuniqueid']][_0x11be('0x20')]=utils[_0x11be('0x31')](agents[_0x18cddf[_0x11be('0x12')]]['agentcompleteAt'],agents[_0x18cddf['destuniqueid']]['agentconnectAt']);agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x28')]=_0x18cddf['reason'];agents[_0x18cddf['destuniqueid']]['lastevent']=_0x11be('0x32');writeDB(agents[_0x18cddf[_0x11be('0x12')]]);}}catch(_0x2cdf2a){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x33'),_0x18cddf[_0x11be('0x4')]),_0x2cdf2a);}};exports[_0x11be('0x34')]=function(_0x2ce110){try{if(!_[_0x11be('0x18')](agents[_0x2ce110[_0x11be('0x35')]])){utils['debug'](util[_0x11be('0x2')](_0x11be('0x36'),_0x2ce110['uniqueid']),_0x2ce110);utils['info'](util['format'](_0x11be('0x37'),_0x2ce110['uniqueid'],agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x6')],agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x4')]));agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x38')]=!![];agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x39')]=_0x11be('0x3a');agents[_0x2ce110['transfereruniqueid']][_0x11be('0x3b')]=_0x2ce110['extension'];agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x3c')]=agents[_0x2ce110['transfereruniqueid']][_0x11be('0x4')];}}catch(_0x1164a4){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x36'),_0x2ce110['uniqueid']),_0x1164a4);}};exports['attendedtransfer']=function(_0x46764d){try{utils[_0x11be('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x46764d[_0x11be('0x3d')]),_0x46764d);if(_0x46764d[_0x11be('0x3d')]==_0x46764d[_0x11be('0x3e')]){if(!_['isNil'](agents[_0x46764d['secondtransfereruniqueid']])){utils['info'](util[_0x11be('0x2')](_0x11be('0x3f'),_0x46764d[_0x11be('0x3d')],agents[_0x46764d['secondtransfereruniqueid']]['membername']));agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x38')]=!![];agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x39')]='ATTENDED';agents[_0x46764d[_0x11be('0x40')]]['transferexten']=_0x46764d['origtransfererexten'];agents[_0x46764d['secondtransfereruniqueid']]['transferuniqueid']=_0x46764d[_0x11be('0x3d')];}if(_0x46764d[_0x11be('0x41')]&&agents[_0x46764d[_0x11be('0x41')]]){agents[_0x46764d[_0x11be('0x41')]][_0x11be('0x42')]=0x1;transfers[_0x46764d[_0x11be('0x41')]]=_[_0x11be('0x43')](agents[_0x46764d['transfereeuniqueid']]);transfers[_0x46764d['transfereeuniqueid']][_0x11be('0x44')]=agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x44')];transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x45')]=agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x45')];transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x46')]=utils['now']();transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();transfers[_0x46764d['transfereeuniqueid']][_0x11be('0x29')]=0x0;transfers[_0x46764d[_0x11be('0x41')]]['agententerreason']=0x2;}}else if(_0x46764d['secondtransfereruniqueid']==_0x46764d[_0x11be('0x47')]){if(!_[_0x11be('0x18')](agents[_0x46764d[_0x11be('0x3d')]])){utils[_0x11be('0x1')](util['format'](_0x11be('0x3f'),_0x46764d[_0x11be('0x3d')],agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x6')]));agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x38')]=!![];agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x39')]=_0x11be('0x48');agents[_0x46764d['origtransfereruniqueid']]['transferexten']=_0x46764d[_0x11be('0x49')];agents[_0x46764d[_0x11be('0x3d')]]['transferuniqueid']=_0x46764d[_0x11be('0x40')];}if(_0x46764d[_0x11be('0x4a')]&&agents[_0x46764d[_0x11be('0x4a')]]){agents[_0x46764d[_0x11be('0x4a')]][_0x11be('0x42')]=0x1;transfers[_0x46764d[_0x11be('0x4a')]]=_[_0x11be('0x43')](agents[_0x46764d['transfertargetuniqueid']]);transfers[_0x46764d['transfertargetuniqueid']][_0x11be('0x44')]=agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x44')];transfers[_0x46764d['transfertargetuniqueid']][_0x11be('0x45')]=agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x45')];transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x46')]=utils[_0x11be('0x1c')]();transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x29')]=0x0;transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x42')]=0x2;}}}catch(_0x464459){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][attendedtransfer]',_0x46764d['origtransfereruniqueid']),_0x464459);}};exports[_0x11be('0x4b')]=function(_0x554aba){try{utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x4c'),_0x554aba[_0x11be('0x4')]),_0x554aba);if(agents[_0x554aba[_0x11be('0x4')]]&&agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')]===_0x11be('0x1e')){if(_0x554aba[_0x11be('0x4d')]==='21'){agents[_0x554aba['uniqueid']][_0x11be('0x28')]=_0x11be('0x4e');agents[_0x554aba[_0x11be('0x4')]]['lastevent']=_0x11be('0x4e');}utils[_0x11be('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x554aba['uniqueid'],agents[_0x554aba['uniqueid']][_0x11be('0x6')],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]));writeDB(agents[_0x554aba['uniqueid']]);var _0x2c80b7=unanswered[_0x11be('0x4f')](_0x554aba[_0x11be('0x4')]);if(_0x2c80b7>-0x1){unanswered[_0x11be('0x50')](_0x2c80b7,0x1);}}if(transfers[_0x554aba[_0x11be('0x4')]]){transfers[_0x554aba['uniqueid']][_0x11be('0x30')]=!![];transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')]=utils[_0x11be('0x1c')]();transfers[_0x554aba['uniqueid']][_0x11be('0x20')]=utils[_0x11be('0x31')](transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')],transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x2b')]);transfers[_0x554aba['uniqueid']][_0x11be('0x28')]=_0x11be('0x52');transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]='complete';utils[_0x11be('0x1')](util['format'](_0x11be('0x53'),_0x554aba[_0x11be('0x4')],transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x6')],transfers[_0x554aba['uniqueid']][_0x11be('0x28')],transfers[_0x554aba[_0x11be('0x4')]]['lastevent']));writeDB(transfers[_0x554aba[_0x11be('0x4')]],!![]);}if(agents[_0x554aba[_0x11be('0x4')]]&&agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x2b')]){agents[_0x554aba['uniqueid']][_0x11be('0x30')]=!![];agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')]=utils[_0x11be('0x1c')]();agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x20')]=utils[_0x11be('0x31')](agents[_0x554aba[_0x11be('0x4')]]['agentcompleteAt'],agents[_0x554aba[_0x11be('0x4')]]['agentconnectAt']);agents[_0x554aba['uniqueid']][_0x11be('0x28')]=agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x38')]?_0x11be('0x38'):_0x11be('0x52');agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]='complete';utils['info'](util[_0x11be('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x554aba['uniqueid'],agents[_0x554aba[_0x11be('0x4')]]['membername'],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')],agents[_0x554aba['uniqueid']][_0x11be('0x1d')]));writeDB(agents[_0x554aba[_0x11be('0x4')]]);}}catch(_0x56d8d7){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][hangup]',_0x554aba[_0x11be('0x4')]),_0x56d8d7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 80b9181..0fdd1fc 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 _0xc0a4=['connectedlinenum','accountcode','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum'];(function(_0xfeeb29,_0x3bd776){var _0x49538c=function(_0x5f07dc){while(--_0x5f07dc){_0xfeeb29['push'](_0xfeeb29['shift']());}};_0x49538c(++_0x3bd776);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x11dda3,_0x482da8){_0x11dda3=_0x11dda3-0x0;var _0x16d273=_0xc0a4[_0x11dda3];return _0x16d273;};'use strict';var _=require(_0x4c0a('0x0'));var util=require(_0x4c0a('0x1'));var utils=require('./utils');var transfers=require(_0x4c0a('0x2'));var dispositions=['NO\x20ANSWER',_0x4c0a('0x3'),_0x4c0a('0x3'),_0x4c0a('0x4'),_0x4c0a('0x4'),_0x4c0a('0x4'),_0x4c0a('0x5'),_0x4c0a('0x6'),_0x4c0a('0x3'),_0x4c0a('0x3'),_0x4c0a('0x3')];var channels={};function writeDB(_0x53e005){var _0x33fc7d;if(transfers[_0x4c0a('0x7')][_0x53e005['uniqueid']]){_0x33fc7d=_0x53e005[_0x4c0a('0x8')];_0x53e005[_0x4c0a('0x8')]=transfers['blinds'][_0x53e005[_0x4c0a('0x8')]]['transfereeuniqueid'];}utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')](_0x4c0a('0xb'),_0x53e005[_0x4c0a('0x8')],_0x53e005[_0x4c0a('0xc')],_0x53e005[_0x4c0a('0xd')],_0x53e005[_0x4c0a('0xe')],_0x53e005['interface'],_0x53e005[_0x4c0a('0xf')],_0x53e005[_0x4c0a('0x10')],_0x53e005['lastevent']));if(_0x53e005[_0x4c0a('0x11')]){utils['getUserByInternal'](_0x53e005['accountcode'])['then'](function(_0x38e904){if(_0x38e904){_0x53e005[_0x4c0a('0x12')]=_0x38e904['id'];}utils[_0x4c0a('0x13')](_0x4c0a('0x14'),_0x53e005);});}else{utils['request'](_0x4c0a('0x14'),_0x53e005);}if(channels[_0x53e005[_0x4c0a('0x8')]]){delete channels[_0x53e005['uniqueid']];}else if(_0x33fc7d&&channels[_0x33fc7d]){if(!transfers[_0x4c0a('0x7')][_0x33fc7d]['recording'])delete transfers[_0x4c0a('0x7')][_0x33fc7d];delete channels[_0x33fc7d];}}exports[_0x4c0a('0x15')]=function(_0x5d3ea0){try{utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')]('[%s][calls][newchannel]',_0x5d3ea0[_0x4c0a('0x8')]),_0x5d3ea0);if(_0x5d3ea0[_0x4c0a('0x8')]==_0x5d3ea0[_0x4c0a('0x17')]&&_0x5d3ea0['channel']!=_0x4c0a('0x18')){utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')](_0x4c0a('0x19'),_0x5d3ea0[_0x4c0a('0x8')],_0x5d3ea0['context'],_0x5d3ea0[_0x4c0a('0x1a')]));channels[_0x5d3ea0[_0x4c0a('0x8')]]={'uniqueid':_0x5d3ea0['uniqueid'],'accountcode':_0x5d3ea0[_0x4c0a('0x11')],'source':_0x5d3ea0['calleridnum'],'destination':_0x5d3ea0[_0x4c0a('0x1a')],'destinationcontext':_0x5d3ea0['context'],'channel':_0x5d3ea0[_0x4c0a('0xc')],'starttime':utils[_0x4c0a('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4c0a('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x238725){utils[_0x4c0a('0x1c')](util[_0x4c0a('0xa')](_0x4c0a('0x1d'),_0x5d3ea0[_0x4c0a('0x8')]),_0x238725);}};exports[_0x4c0a('0x1e')]=function(_0x22e7dd){try{utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')](_0x4c0a('0x1f'),_0x22e7dd[_0x4c0a('0x8')]),_0x22e7dd);if(!_[_0x4c0a('0x20')](channels[_0x22e7dd[_0x4c0a('0x8')]])&&_0x22e7dd['channelstate']==0x6){utils['info'](util[_0x4c0a('0xa')](_0x4c0a('0x21'),_0x22e7dd[_0x4c0a('0x8')],_0x22e7dd[_0x4c0a('0x22')],_0x22e7dd[_0x4c0a('0xc')]));if(_[_0x4c0a('0x20')](channels[_0x22e7dd[_0x4c0a('0x8')]][_0x4c0a('0x23')])){channels[_0x22e7dd['uniqueid']][_0x4c0a('0x23')]=utils[_0x4c0a('0x1b')]();}}else if(!_[_0x4c0a('0x20')](channels[_0x22e7dd['linkedid']])&&_0x22e7dd['channelstate']==0x6&&_0x22e7dd['context']!=_0x4c0a('0x24')){utils['info'](util[_0x4c0a('0xa')](_0x4c0a('0x25'),_0x22e7dd[_0x4c0a('0x8')],_0x22e7dd[_0x4c0a('0x17')],_0x22e7dd[_0x4c0a('0x22')],_0x22e7dd[_0x4c0a('0xc')]));channels[_0x22e7dd['linkedid']][_0x4c0a('0x11')]=_0x22e7dd[_0x4c0a('0x11')];channels[_0x22e7dd[_0x4c0a('0x17')]]['destinationchannel']=_0x22e7dd[_0x4c0a('0xc')];if(_['isNil'](channels[_0x22e7dd[_0x4c0a('0x17')]]['answertime'])){channels[_0x22e7dd[_0x4c0a('0x17')]][_0x4c0a('0x26')]=utils[_0x4c0a('0x1b')]();}channels[_0x22e7dd['linkedid']][_0x4c0a('0x27')]=dispositions[_[_0x4c0a('0x28')](_0x22e7dd['channelstate'])]||_0x4c0a('0x5');}}catch(_0x5a3f4a){utils['error'](util[_0x4c0a('0xa')]('[%s][calls][newstate]',_0x22e7dd[_0x4c0a('0x8')]),_0x5a3f4a);}};exports[_0x4c0a('0x29')]=function(_0x28b886){try{if(!_[_0x4c0a('0x20')](channels[_0x28b886[_0x4c0a('0x8')]])){utils[_0x4c0a('0x16')](util['format'](_0x4c0a('0x2a'),_0x28b886['uniqueid']),_0x28b886);if(_[_0x4c0a('0x20')](channels[_0x28b886['uniqueid']]['callerid'])){channels[_0x28b886[_0x4c0a('0x8')]][_0x4c0a('0x2b')]=_0x28b886[_0x4c0a('0x2c')]+'\x20<'+_0x28b886[_0x4c0a('0xf')]+'>';}utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')](_0x4c0a('0x2d'),_0x28b886[_0x4c0a('0x8')],channels[_0x28b886[_0x4c0a('0x8')]][_0x4c0a('0x2b')],_0x28b886[_0x4c0a('0x2e')]));channels[_0x28b886[_0x4c0a('0x8')]]['endtime']=utils[_0x4c0a('0x1b')]();channels[_0x28b886['uniqueid']][_0x4c0a('0x2f')]=utils['diffTime'](channels[_0x28b886[_0x4c0a('0x8')]][_0x4c0a('0x30')],channels[_0x28b886[_0x4c0a('0x8')]][_0x4c0a('0x31')]);channels[_0x28b886['uniqueid']][_0x4c0a('0x32')]=channels[_0x28b886['uniqueid']]['answertime']?utils[_0x4c0a('0x33')](channels[_0x28b886[_0x4c0a('0x8')]]['endtime'],channels[_0x28b886[_0x4c0a('0x8')]][_0x4c0a('0x26')]):0x0;writeDB(channels[_0x28b886['uniqueid']]);}}catch(_0x4cbd76){utils['error'](util[_0x4c0a('0xa')](_0x4c0a('0x2a'),_0x28b886[_0x4c0a('0x8')]),_0x4cbd76);}};exports[_0x4c0a('0x34')]=function(_0xd4764e){try{if(!_[_0x4c0a('0x20')](channels[_0xd4764e[_0x4c0a('0x35')]])){utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')](_0x4c0a('0x36'),_0xd4764e[_0x4c0a('0x37')]),_0xd4764e);if(channels[_0xd4764e[_0x4c0a('0x35')]][_0x4c0a('0xc')]==_0xd4764e[_0x4c0a('0x38')]){utils['info'](util[_0x4c0a('0xa')](_0x4c0a('0x39'),_0xd4764e[_0x4c0a('0x37')],_0xd4764e['localtwolinkedid'],_0xd4764e[_0x4c0a('0x3a')]));channels[_0xd4764e[_0x4c0a('0x35')]][_0x4c0a('0x3b')]=_0xd4764e[_0x4c0a('0x3a')];channels[_0xd4764e[_0x4c0a('0x35')]]['userfield']='_attended';}else if(channels[_0xd4764e[_0x4c0a('0x35')]][_0x4c0a('0xc')]=_0xd4764e['transfertargetchannel']){utils['info'](util[_0x4c0a('0xa')](_0x4c0a('0x39'),_0xd4764e[_0x4c0a('0x37')],_0xd4764e[_0x4c0a('0x35')],_0xd4764e['origtransfererchannel']));channels[_0xd4764e[_0x4c0a('0x35')]][_0x4c0a('0x3b')]=_0xd4764e[_0x4c0a('0x3c')];channels[_0xd4764e['localtwolinkedid']][_0x4c0a('0x3d')]='_attended';}}}catch(_0x556312){utils['error'](util[_0x4c0a('0xa')](_0x4c0a('0x36'),_0xd4764e[_0x4c0a('0x37')]),_0x556312);}};exports['musiconholdstart']=function(_0x412c75){try{if(!_[_0x4c0a('0x20')](channels[_0x412c75[_0x4c0a('0x8')]])){utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')](_0x4c0a('0x3e'),_0x412c75['uniqueid']),_0x412c75);channels[_0x412c75[_0x4c0a('0x8')]][_0x4c0a('0x3f')]=utils[_0x4c0a('0x1b')]();utils['info'](util[_0x4c0a('0xa')](_0x4c0a('0x40'),_0x412c75['uniqueid'],channels[_0x412c75[_0x4c0a('0x8')]][_0x4c0a('0x3f')]));}}catch(_0x1d0bcb){utils[_0x4c0a('0x1c')](util['format'](_0x4c0a('0x3e'),_0x412c75[_0x4c0a('0x8')]),_0x1d0bcb);}};exports[_0x4c0a('0x41')]=function(_0x2d4494){try{if(!_[_0x4c0a('0x20')](channels[_0x2d4494[_0x4c0a('0x8')]])){utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')](_0x4c0a('0x42'),_0x2d4494[_0x4c0a('0x8')]),_0x2d4494);if(!_['isNil'](channels[_0x2d4494[_0x4c0a('0x8')]][_0x4c0a('0x3f')])){channels[_0x2d4494[_0x4c0a('0x8')]][_0x4c0a('0x43')]+=utils[_0x4c0a('0x33')](utils['now'](),channels[_0x2d4494['uniqueid']][_0x4c0a('0x3f')]);utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')](_0x4c0a('0x44'),_0x2d4494[_0x4c0a('0x8')],channels[_0x2d4494[_0x4c0a('0x8')]][_0x4c0a('0x43')]));delete channels[_0x2d4494[_0x4c0a('0x8')]]['musiconholdstartAt'];}}}catch(_0x1744fe){utils[_0x4c0a('0x1c')](util['format']('[%s][calls][musiconholdstop]',_0x2d4494[_0x4c0a('0x8')]),_0x1744fe);}};exports[_0x4c0a('0x45')]=function(_0x435dff){try{if(!_[_0x4c0a('0x20')](channels[_0x435dff[_0x4c0a('0x8')]])){utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')](_0x4c0a('0x46'),_0x435dff[_0x4c0a('0x8')]),_0x435dff);if(!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x48')])){utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x435dff[_0x4c0a('0x8')],_0x435dff['value']));channels[_0x435dff['uniqueid']]['source']=_0x435dff[_0x4c0a('0x49')];}if(!_[_0x4c0a('0x20')](_0x435dff['variable']['xmd-phone'])){utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')](_0x4c0a('0x4a'),_0x435dff['uniqueid'],_0x435dff[_0x4c0a('0x49')]));channels[_0x435dff[_0x4c0a('0x8')]][_0x4c0a('0x4b')]=_0x435dff[_0x4c0a('0x49')];channels[_0x435dff[_0x4c0a('0x8')]][_0x4c0a('0x2b')]='\x22'+_0x435dff[_0x4c0a('0x49')]+_0x4c0a('0x4c')+_0x435dff[_0x4c0a('0x49')]+'>';}if(!_[_0x4c0a('0x20')](_0x435dff['variable'][_0x4c0a('0x4d')])||!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x4e')])){utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x435dff[_0x4c0a('0x8')],!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')]['xmd-callerid-preview'])?_0x4c0a('0x4d'):'xmd-callerid',_0x435dff['value']));channels[_0x435dff['uniqueid']]['callerid']=_0x435dff['value'];}if(!_[_0x4c0a('0x20')](_0x435dff['variable'][_0x4c0a('0x4f')])||!_['isNil'](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x50')])){utils['info'](util[_0x4c0a('0xa')](_0x4c0a('0x51'),_0x435dff[_0x4c0a('0x8')],!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')]['xmd-queue'])?_0x4c0a('0x4f'):_0x4c0a('0x50'),_0x435dff[_0x4c0a('0x49')]));channels[_0x435dff[_0x4c0a('0x8')]][_0x4c0a('0x52')]=_0x4c0a('0x53');channels[_0x435dff['uniqueid']][_0x4c0a('0x54')]=_0x435dff[_0x4c0a('0x49')];channels[_0x435dff['uniqueid']][_0x4c0a('0xd')]=!![];}if(!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x55')])){utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x435dff[_0x4c0a('0x8')],_0x435dff[_0x4c0a('0x49')]));channels[_0x435dff[_0x4c0a('0x8')]]['ContactId']=_0x435dff[_0x4c0a('0x49')];}if(!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x56')])){utils['info'](util['format'](_0x4c0a('0x57'),_0x435dff[_0x4c0a('0x8')],_0x435dff['value']));channels[_0x435dff[_0x4c0a('0x8')]][_0x4c0a('0x58')]=_0x435dff[_0x4c0a('0x49')];}if(!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x59')])){utils['info'](util[_0x4c0a('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x435dff[_0x4c0a('0x8')],_0x435dff[_0x4c0a('0x49')]));channels[_0x435dff[_0x4c0a('0x8')]][_0x4c0a('0x5a')]=_0x435dff['value'];}if(!_[_0x4c0a('0x20')](_0x435dff[_0x4c0a('0x47')][_0x4c0a('0x5b')])){utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x435dff[_0x4c0a('0x8')],_0x435dff[_0x4c0a('0x49')]));channels[_0x435dff['uniqueid']]['sipcallid']=_0x435dff[_0x4c0a('0x49')];}}}catch(_0xecf634){utils[_0x4c0a('0x1c')](util[_0x4c0a('0xa')](_0x4c0a('0x46'),_0x435dff[_0x4c0a('0x8')]),_0xecf634);}};exports[_0x4c0a('0x5c')]=function(_0x54b0da){try{if(!_['isNil'](channels[_0x54b0da[_0x4c0a('0x8')]])){utils[_0x4c0a('0x16')](util[_0x4c0a('0xa')](_0x4c0a('0x5d'),_0x54b0da[_0x4c0a('0x8')]),_0x54b0da);utils[_0x4c0a('0x9')](util[_0x4c0a('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x54b0da[_0x4c0a('0x8')],_0x54b0da[_0x4c0a('0x5e')],_0x54b0da[_0x4c0a('0x5f')]));if(_0x54b0da[_0x4c0a('0x5e')][_0x4c0a('0x60')]()==_0x4c0a('0x61')&&_[_0x4c0a('0x62')](_0x54b0da[_0x4c0a('0x5f')][_0x4c0a('0x60')](),_0x4c0a('0x63'))){var _0x3bebc6=_0x54b0da[_0x4c0a('0x5f')][_0x4c0a('0x64')]('=');var _0x51a447=_0x3bebc6[0x0][_0x4c0a('0x65')](_0x3bebc6[0x0][_0x4c0a('0x66')]('(')+0x1,_0x3bebc6[0x0][_0x4c0a('0x66')](')'));var _0x1874a3=_0x3bebc6[0x1];channels[_0x54b0da[_0x4c0a('0x8')]][_0x51a447]=_0x1874a3;}if(!_[_0x4c0a('0x67')]([_0x4c0a('0x29'),_0x4c0a('0x68'),_0x4c0a('0x69'),_0x4c0a('0x61'),_0x4c0a('0x6a')],_0x54b0da['application'][_0x4c0a('0x60')]())){channels[_0x54b0da[_0x4c0a('0x8')]][_0x4c0a('0x52')]=_0x54b0da[_0x4c0a('0x5e')];channels[_0x54b0da['uniqueid']][_0x4c0a('0x54')]=_0x54b0da['appdata'];}}}catch(_0x2c3f75){utils['error'](util[_0x4c0a('0xa')](_0x4c0a('0x5d'),_0x54b0da['uniqueid']),_0x2c3f75);}}; \ No newline at end of file +var _0x788c=['[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','noop','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum'];(function(_0x2d6f29,_0x2f6366){var _0x291f5a=function(_0x36b6bd){while(--_0x36b6bd){_0x2d6f29['push'](_0x2d6f29['shift']());}};_0x291f5a(++_0x2f6366);}(_0x788c,0xf6));var _0xc788=function(_0x245027,_0x3321ed){_0x245027=_0x245027-0x0;var _0x286688=_0x788c[_0x245027];return _0x286688;};'use strict';var _=require('lodash');var util=require(_0xc788('0x0'));var utils=require('./utils');var transfers=require(_0xc788('0x1'));var dispositions=['NO\x20ANSWER',_0xc788('0x2'),'FAILED','NO\x20ANSWER',_0xc788('0x3'),_0xc788('0x3'),_0xc788('0x4'),'BUSY','FAILED',_0xc788('0x2'),_0xc788('0x2')];var channels={};function writeDB(_0x184979){var _0x3685d2;if(transfers[_0xc788('0x5')][_0x184979[_0xc788('0x6')]]){_0x3685d2=_0x184979['uniqueid'];_0x184979[_0xc788('0x6')]=transfers['blinds'][_0x184979[_0xc788('0x6')]][_0xc788('0x7')];}utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0xa'),_0x184979[_0xc788('0x6')],_0x184979[_0xc788('0xb')],_0x184979['queue'],_0x184979[_0xc788('0xc')],_0x184979[_0xc788('0xd')],_0x184979[_0xc788('0xe')],_0x184979[_0xc788('0xf')],_0x184979['lastevent']));if(_0x184979['accountcode']){utils[_0xc788('0x10')](_0x184979[_0xc788('0x11')])['then'](function(_0x511250){if(_0x511250){_0x184979[_0xc788('0x12')]=_0x511250['id'];}utils[_0xc788('0x13')](_0xc788('0x14'),_0x184979);});}else{utils[_0xc788('0x13')]('CreateVoiceCallReport',_0x184979);}if(channels[_0x184979[_0xc788('0x6')]]){delete channels[_0x184979[_0xc788('0x6')]];}else if(_0x3685d2&&channels[_0x3685d2]){if(!transfers[_0xc788('0x5')][_0x3685d2][_0xc788('0x15')])delete transfers[_0xc788('0x5')][_0x3685d2];delete channels[_0x3685d2];}}exports[_0xc788('0x16')]=function(_0x267c96){try{utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x18'),_0x267c96['uniqueid']),_0x267c96);if(_0x267c96[_0xc788('0x6')]==_0x267c96[_0xc788('0x19')]&&_0x267c96['channel']!=_0xc788('0x1a')){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x1b'),_0x267c96[_0xc788('0x6')],_0x267c96[_0xc788('0x1c')],_0x267c96['exten']));channels[_0x267c96[_0xc788('0x6')]]={'uniqueid':_0x267c96['uniqueid'],'accountcode':_0x267c96[_0xc788('0x11')],'source':_0x267c96[_0xc788('0xe')],'destination':_0x267c96['exten'],'destinationcontext':_0x267c96['context'],'channel':_0x267c96['channel'],'starttime':utils[_0xc788('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc788('0x3'),'amaflags':_0xc788('0x1e')};}}catch(_0x4d457e){utils[_0xc788('0x1f')](util[_0xc788('0x9')]('[%s][calls][newchannel]',_0x267c96[_0xc788('0x6')]),_0x4d457e);}};exports[_0xc788('0x20')]=function(_0x3f470b){try{utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x21'),_0x3f470b[_0xc788('0x6')]),_0x3f470b);if(!_[_0xc788('0x22')](channels[_0x3f470b['uniqueid']])&&_0x3f470b['channelstate']==0x6){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x23'),_0x3f470b[_0xc788('0x6')],_0x3f470b['context'],_0x3f470b[_0xc788('0xb')]));if(_[_0xc788('0x22')](channels[_0x3f470b['uniqueid']][_0xc788('0x24')])){channels[_0x3f470b[_0xc788('0x6')]][_0xc788('0x24')]=utils[_0xc788('0x1d')]();}}else if(!_[_0xc788('0x22')](channels[_0x3f470b[_0xc788('0x19')]])&&_0x3f470b[_0xc788('0x25')]==0x6&&_0x3f470b[_0xc788('0x1c')]!=_0xc788('0x26')){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x27'),_0x3f470b[_0xc788('0x6')],_0x3f470b[_0xc788('0x19')],_0x3f470b[_0xc788('0x1c')],_0x3f470b[_0xc788('0xb')]));channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x11')]=_0x3f470b['accountcode'];channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x28')]=_0x3f470b[_0xc788('0xb')];if(_[_0xc788('0x22')](channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x29')])){channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x29')]=utils[_0xc788('0x1d')]();}channels[_0x3f470b['linkedid']]['disposition']=dispositions[_[_0xc788('0x2a')](_0x3f470b['channelstate'])]||'ANSWERED';}}catch(_0x50aea6){utils[_0xc788('0x1f')](util[_0xc788('0x9')]('[%s][calls][newstate]',_0x3f470b[_0xc788('0x6')]),_0x50aea6);}};exports[_0xc788('0x2b')]=function(_0x33f9a4){try{if(!_['isNil'](channels[_0x33f9a4[_0xc788('0x6')]])){utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x2c'),_0x33f9a4[_0xc788('0x6')]),_0x33f9a4);if(_[_0xc788('0x22')](channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x2d')])){channels[_0x33f9a4['uniqueid']][_0xc788('0x2d')]=_0x33f9a4['calleridname']+'\x20<'+_0x33f9a4[_0xc788('0xe')]+'>';}utils[_0xc788('0x8')](util['format'](_0xc788('0x2e'),_0x33f9a4[_0xc788('0x6')],channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x2d')],_0x33f9a4[_0xc788('0x2f')]));channels[_0x33f9a4[_0xc788('0x6')]]['endtime']=utils['now']();channels[_0x33f9a4['uniqueid']][_0xc788('0x30')]=utils['diffTime'](channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x31')],channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x32')]);channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x33')]=channels[_0x33f9a4[_0xc788('0x6')]]['answertime']?utils[_0xc788('0x34')](channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x31')],channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x29')]):0x0;writeDB(channels[_0x33f9a4[_0xc788('0x6')]]);}}catch(_0xd93ded){utils[_0xc788('0x1f')](util[_0xc788('0x9')](_0xc788('0x2c'),_0x33f9a4[_0xc788('0x6')]),_0xd93ded);}};exports[_0xc788('0x35')]=function(_0xb9b49f){try{if(!_[_0xc788('0x22')](channels[_0xb9b49f[_0xc788('0x36')]])){utils['debug'](util[_0xc788('0x9')](_0xc788('0x37'),_0xb9b49f[_0xc788('0x38')]),_0xb9b49f);if(channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0xb')]==_0xb9b49f[_0xc788('0x39')]){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x3a'),_0xb9b49f[_0xc788('0x38')],_0xb9b49f['localtwolinkedid'],_0xb9b49f[_0xc788('0x3b')]));channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x28')]=_0xb9b49f[_0xc788('0x3b')];channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x3c')]=_0xc788('0x3d');}else if(channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0xb')]=_0xb9b49f[_0xc788('0x3e')]){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xb9b49f[_0xc788('0x38')],_0xb9b49f['localtwolinkedid'],_0xb9b49f['origtransfererchannel']));channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x28')]=_0xb9b49f[_0xc788('0x3f')];channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x3c')]=_0xc788('0x3d');}}}catch(_0x404c9a){utils[_0xc788('0x1f')](util[_0xc788('0x9')](_0xc788('0x37'),_0xb9b49f[_0xc788('0x38')]),_0x404c9a);}};exports[_0xc788('0x40')]=function(_0x51afde){try{if(!_['isNil'](channels[_0x51afde['uniqueid']])){utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x41'),_0x51afde[_0xc788('0x6')]),_0x51afde);channels[_0x51afde['uniqueid']][_0xc788('0x42')]=utils[_0xc788('0x1d')]();utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x51afde[_0xc788('0x6')],channels[_0x51afde[_0xc788('0x6')]][_0xc788('0x42')]));}}catch(_0x4700fe){utils['error'](util[_0xc788('0x9')](_0xc788('0x41'),_0x51afde[_0xc788('0x6')]),_0x4700fe);}};exports[_0xc788('0x43')]=function(_0x4b6fac){try{if(!_['isNil'](channels[_0x4b6fac[_0xc788('0x6')]])){utils['debug'](util[_0xc788('0x9')](_0xc788('0x44'),_0x4b6fac['uniqueid']),_0x4b6fac);if(!_['isNil'](channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x42')])){channels[_0x4b6fac[_0xc788('0x6')]]['mohtime']+=utils[_0xc788('0x34')](utils[_0xc788('0x1d')](),channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x42')]);utils['info'](util[_0xc788('0x9')](_0xc788('0x45'),_0x4b6fac['uniqueid'],channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x46')]));delete channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x42')];}}}catch(_0x12daee){utils[_0xc788('0x1f')](util[_0xc788('0x9')]('[%s][calls][musiconholdstop]',_0x4b6fac[_0xc788('0x6')]),_0x12daee);}};exports[_0xc788('0x47')]=function(_0x5c164b){try{if(!_[_0xc788('0x22')](channels[_0x5c164b[_0xc788('0x6')]])){utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x48'),_0x5c164b[_0xc788('0x6')]),_0x5c164b);if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x4a')])){utils['info'](util[_0xc788('0x9')](_0xc788('0x4b'),_0x5c164b[_0xc788('0x6')],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x4d')]=_0x5c164b[_0xc788('0x4c')];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')]['xmd-phone'])){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x4e'),_0x5c164b[_0xc788('0x6')],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b['uniqueid']]['destination']=_0x5c164b['value'];channels[_0x5c164b['uniqueid']][_0xc788('0x2d')]='\x22'+_0x5c164b[_0xc788('0x4c')]+_0xc788('0x4f')+_0x5c164b[_0xc788('0x4c')]+'>';}if(!_[_0xc788('0x22')](_0x5c164b['variable']['xmd-callerid-preview'])||!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')]['xmd-callerid'])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5c164b['uniqueid'],!_[_0xc788('0x22')](_0x5c164b['variable'][_0xc788('0x50')])?_0xc788('0x50'):_0xc788('0x51'),_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x2d')]=_0x5c164b['value'];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x52')])||!_['isNil'](_0x5c164b[_0xc788('0x49')][_0xc788('0x53')])){utils['info'](util[_0xc788('0x9')](_0xc788('0x54'),_0x5c164b[_0xc788('0x6')],!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x52')])?_0xc788('0x52'):_0xc788('0x53'),_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x55')]=_0xc788('0x56');channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x57')]=_0x5c164b[_0xc788('0x4c')];channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x58')]=!![];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x59')])){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x5a'),_0x5c164b['uniqueid'],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]]['ContactId']=_0x5c164b[_0xc788('0x4c')];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x5b')])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5c164b[_0xc788('0x6')],_0x5c164b['value']));channels[_0x5c164b['uniqueid']]['type']=_0x5c164b[_0xc788('0x4c')];}if(!_['isNil'](_0x5c164b[_0xc788('0x49')][_0xc788('0x5c')])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5c164b['uniqueid'],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b['uniqueid']][_0xc788('0x5d')]=_0x5c164b[_0xc788('0x4c')];}if(!_[_0xc788('0x22')](_0x5c164b['variable']['sipcallid'])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5c164b['uniqueid'],_0x5c164b['value']));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x5e')]=_0x5c164b[_0xc788('0x4c')];}}}catch(_0xff7688){utils['error'](util['format']('[%s][calls][varset]',_0x5c164b[_0xc788('0x6')]),_0xff7688);}};exports[_0xc788('0x5f')]=function(_0x592b3d){try{if(!_['isNil'](channels[_0x592b3d[_0xc788('0x6')]])){utils['debug'](util[_0xc788('0x9')](_0xc788('0x60'),_0x592b3d[_0xc788('0x6')]),_0x592b3d);utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x61'),_0x592b3d[_0xc788('0x6')],_0x592b3d[_0xc788('0x62')],_0x592b3d[_0xc788('0x63')]));if(_0x592b3d['application'][_0xc788('0x64')]()==_0xc788('0x65')&&_[_0xc788('0x66')](_0x592b3d['appdata'][_0xc788('0x64')](),_0xc788('0x67'))){var _0x56a0be=_0x592b3d['appdata'][_0xc788('0x68')]('=');var _0x3b73aa=_0x56a0be[0x0][_0xc788('0x69')](_0x56a0be[0x0]['lastIndexOf']('(')+0x1,_0x56a0be[0x0]['lastIndexOf'](')'));var _0x469935=_0x56a0be[0x1];channels[_0x592b3d['uniqueid']][_0x3b73aa]=_0x469935;}if(!_['includes']([_0xc788('0x2b'),_0xc788('0x6a'),'execif',_0xc788('0x65'),'gotoif'],_0x592b3d['application'][_0xc788('0x64')]())){channels[_0x592b3d[_0xc788('0x6')]]['lastapplication']=_0x592b3d[_0xc788('0x62')];channels[_0x592b3d[_0xc788('0x6')]][_0xc788('0x57')]=_0x592b3d[_0xc788('0x63')];}}}catch(_0x19d8c2){utils[_0xc788('0x1f')](util[_0xc788('0x9')](_0xc788('0x60'),_0x592b3d[_0xc788('0x6')]),_0x19d8c2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 26cc88a..058a2e4 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 _0x89a6=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x4175ff,_0x776669){var _0x497b05=function(_0x52ee0d){while(--_0x52ee0d){_0x4175ff['push'](_0x4175ff['shift']());}};_0x497b05(++_0x776669);}(_0x89a6,0xfe));var _0x689a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89a6[_0x122ef9];return _0x42fba0;};'use strict';var utils=require(_0x689a('0x0'));exports[_0x689a('0x1')]=function(){utils[_0x689a('0x2')](_0x689a('0x3'));};exports[_0x689a('0x4')]=function(){utils[_0x689a('0x2')]('[core]\x20shutdown');};exports[_0x689a('0x5')]=function(){utils[_0x689a('0x2')](_0x689a('0x6'));};exports[_0x689a('0x7')]=function(_0x3914a){utils['error'](_0x689a('0x8'),_0x3914a);};exports[_0x689a('0x9')]=function(){utils['info'](_0x689a('0xa'));};exports[_0x689a('0xb')]=function(_0x25af13){}; \ No newline at end of file +var _0x6e3b=['[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','info','[core]\x20close','./utils','connect','[core]\x20connected','shutdown'];(function(_0x4dd2d4,_0x43b1e2){var _0x5bc661=function(_0xf066a7){while(--_0xf066a7){_0x4dd2d4['push'](_0x4dd2d4['shift']());}};_0x5bc661(++_0x43b1e2);}(_0x6e3b,0x19e));var _0xb6e3=function(_0xb1574a,_0x4fa533){_0xb1574a=_0xb1574a-0x0;var _0x12f243=_0x6e3b[_0xb1574a];return _0x12f243;};'use strict';var utils=require(_0xb6e3('0x0'));exports[_0xb6e3('0x1')]=function(){utils['info'](_0xb6e3('0x2'));};exports[_0xb6e3('0x3')]=function(){utils['info'](_0xb6e3('0x4'));};exports['fullybooted']=function(){utils['info'](_0xb6e3('0x5'));};exports[_0xb6e3('0x6')]=function(_0x13fdb9){utils[_0xb6e3('0x6')](_0xb6e3('0x7'),_0x13fdb9);};exports[_0xb6e3('0x8')]=function(){utils[_0xb6e3('0x9')](_0xb6e3('0xa'));};exports['managerevent']=function(_0x1c2593){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index eb28362..4ee43ca 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 _0x2b9a=['[%s][dials][dialbegin]','lastevent','called','starttime','dialend','[%s][dials][dialend]','assign','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','error','varset','debug','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin'];(function(_0x26e184,_0x1b1f2c){var _0x193c1c=function(_0x447fad){while(--_0x447fad){_0x26e184['push'](_0x26e184['shift']());}};_0x193c1c(++_0x1b1f2c);}(_0x2b9a,0x73));var _0xa2b9=function(_0x55c84c,_0x11b3fc){_0x55c84c=_0x55c84c-0x0;var _0x4e934c=_0x2b9a[_0x55c84c];return _0x4e934c;};'use strict';var _=require(_0xa2b9('0x0'));var util=require(_0xa2b9('0x1'));var utils=require(_0xa2b9('0x2'));var dials={};function writeDB(_0x4a2aba){utils[_0xa2b9('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4a2aba[_0xa2b9('0x4')],_0x4a2aba[_0xa2b9('0x5')],_0x4a2aba[_0xa2b9('0x6')],_0x4a2aba[_0xa2b9('0x7')],_0x4a2aba['connectedlinenum'],_0x4a2aba[_0xa2b9('0x8')]));utils[_0xa2b9('0x9')](_0xa2b9('0xa'),_0x4a2aba);delete dials[_0x4a2aba[_0xa2b9('0x4')]];}exports[_0xa2b9('0xb')]=function(_0x4a8bf6){try{utils['debug'](util[_0xa2b9('0xc')](_0xa2b9('0xd'),_0x4a8bf6['uniqueid']),_0x4a8bf6);utils[_0xa2b9('0x3')](util[_0xa2b9('0xc')](_0xa2b9('0xe'),_0x4a8bf6['uniqueid'],_0x4a8bf6[_0xa2b9('0xf')],_0x4a8bf6[_0xa2b9('0x10')]));if(_0x4a8bf6['application'][_0xa2b9('0x11')]()==_0xa2b9('0x12')&&_['startsWith'](_0x4a8bf6[_0xa2b9('0x10')][_0xa2b9('0x11')](),'cdr(routeid)')){var _0x27c19c=_0x4a8bf6[_0xa2b9('0x10')][_0xa2b9('0x13')]('=');dials[_0x4a8bf6[_0xa2b9('0x4')]]={'routeId':_0x27c19c[0x1]};}}catch(_0x3b2172){utils[_0xa2b9('0x14')](util['format'](_0xa2b9('0xd'),_0x4a8bf6['uniqueid']),_0x3b2172);}};exports[_0xa2b9('0x15')]=function(_0x1cc362){try{utils[_0xa2b9('0x16')](util['format']('[%s][dials][varset]',_0x1cc362[_0xa2b9('0x4')]),_0x1cc362);if(!_[_0xa2b9('0x17')](_0x1cc362['variable'][_0xa2b9('0x18')])){utils[_0xa2b9('0x3')](util[_0xa2b9('0xc')](_0xa2b9('0x19'),_0x1cc362[_0xa2b9('0x4')],_0x1cc362[_0xa2b9('0x1a')]));dials[_0x1cc362[_0xa2b9('0x4')]]={'routeId':_0x1cc362[_0xa2b9('0x1a')]};}}catch(_0x3807b9){utils[_0xa2b9('0x14')](util[_0xa2b9('0xc')](_0xa2b9('0x1b'),_0x1cc362[_0xa2b9('0x4')]),_0x3807b9);}};exports[_0xa2b9('0x1c')]=function(_0x8164fa){try{if(!_[_0xa2b9('0x17')](dials[_0x8164fa[_0xa2b9('0x4')]])){utils[_0xa2b9('0x16')](util['format'](_0xa2b9('0x1d'),_0x8164fa[_0xa2b9('0x4')]),_0x8164fa);dials[_0x8164fa['uniqueid']]=_['assign'](dials[_0x8164fa['uniqueid']],_0x8164fa);dials[_0x8164fa[_0xa2b9('0x4')]]['starttime']=utils['now']();dials[_0x8164fa[_0xa2b9('0x4')]][_0xa2b9('0x1e')]=_0xa2b9('0x1f');utils[_0xa2b9('0x3')](util[_0xa2b9('0xc')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x8164fa['uniqueid'],dials[_0x8164fa['uniqueid']][_0xa2b9('0x20')]));}}catch(_0x24766e){utils['error'](util[_0xa2b9('0xc')]('[%s][dials][dialbegin]',_0x8164fa[_0xa2b9('0x4')]),_0x24766e);}};exports[_0xa2b9('0x21')]=function(_0x5dc2b5){try{if(!_[_0xa2b9('0x17')](dials[_0x5dc2b5[_0xa2b9('0x4')]])){utils[_0xa2b9('0x16')](util['format'](_0xa2b9('0x22'),_0x5dc2b5['uniqueid']),_0x5dc2b5);dials[_0x5dc2b5[_0xa2b9('0x4')]][_0xa2b9('0x8')]=_0x5dc2b5[_0xa2b9('0x8')];if(_0x5dc2b5[_0xa2b9('0x8')]=='ANSWER'){dials[_0x5dc2b5[_0xa2b9('0x4')]]=_[_0xa2b9('0x23')](dials[_0x5dc2b5['uniqueid']],_0x5dc2b5);dials[_0x5dc2b5[_0xa2b9('0x4')]]['answertime']=utils[_0xa2b9('0x24')]();dials[_0x5dc2b5[_0xa2b9('0x4')]][_0xa2b9('0x1e')]=_0xa2b9('0x25');utils[_0xa2b9('0x3')](util[_0xa2b9('0xc')](_0xa2b9('0x26'),_0x5dc2b5[_0xa2b9('0x4')],_0x5dc2b5['dialstatus'],dials[_0x5dc2b5[_0xa2b9('0x4')]][_0xa2b9('0x27')]));}else{utils[_0xa2b9('0x3')](util[_0xa2b9('0xc')](_0xa2b9('0x28'),_0x5dc2b5['uniqueid'],_0x5dc2b5[_0xa2b9('0x8')]));}}}catch(_0xcf21e2){utils[_0xa2b9('0x14')](util['format'](_0xa2b9('0x22'),_0x5dc2b5[_0xa2b9('0x4')]),_0xcf21e2);}};exports[_0xa2b9('0x29')]=function(_0x54feab){try{if(!_['isNil'](dials[_0x54feab[_0xa2b9('0x4')]])){utils[_0xa2b9('0x16')](util[_0xa2b9('0xc')]('[%s][dials][hangup]',_0x54feab[_0xa2b9('0x4')]),_0x54feab);utils[_0xa2b9('0x3')](util['format'](_0xa2b9('0x2a'),_0x54feab['uniqueid'],_0x54feab[_0xa2b9('0x7')],_0x54feab['calleridname'],_0x54feab['cause-txt']));dials[_0x54feab['uniqueid']]=_[_0xa2b9('0x23')](dials[_0x54feab[_0xa2b9('0x4')]],{'endtime':utils['now'](),'lastevent':_0xa2b9('0x2b')});dials[_0x54feab[_0xa2b9('0x4')]]['duration']=utils[_0xa2b9('0x2c')](dials[_0x54feab[_0xa2b9('0x4')]][_0xa2b9('0x2d')],dials[_0x54feab[_0xa2b9('0x4')]][_0xa2b9('0x20')]);dials[_0x54feab['uniqueid']][_0xa2b9('0x2e')]=utils[_0xa2b9('0x2c')](dials[_0x54feab[_0xa2b9('0x4')]]['answertime']||dials[_0x54feab[_0xa2b9('0x4')]][_0xa2b9('0x2d')],dials[_0x54feab['uniqueid']][_0xa2b9('0x20')]);dials[_0x54feab[_0xa2b9('0x4')]][_0xa2b9('0x2f')]=dials[_0x54feab[_0xa2b9('0x4')]]['answertime']?utils[_0xa2b9('0x2c')](dials[_0x54feab[_0xa2b9('0x4')]][_0xa2b9('0x2d')],dials[_0x54feab[_0xa2b9('0x4')]][_0xa2b9('0x27')]):0x0;writeDB(dials[_0x54feab[_0xa2b9('0x4')]]);}}catch(_0x2d2553){utils[_0xa2b9('0x14')](util['format']('[%s][dials][hangup]',_0x54feab[_0xa2b9('0x4')]),_0x2d2553);}}; \ No newline at end of file +var _0xe781=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','isNil','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','now','connect'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe781,0x181));var _0x1e78=function(_0x48fc6e,_0x30da20){_0x48fc6e=_0x48fc6e-0x0;var _0x21f5fb=_0xe781[_0x48fc6e];return _0x21f5fb;};'use strict';var _=require(_0x1e78('0x0'));var util=require(_0x1e78('0x1'));var utils=require(_0x1e78('0x2'));var dials={};function writeDB(_0x2040ac){utils[_0x1e78('0x3')](util[_0x1e78('0x4')](_0x1e78('0x5'),_0x2040ac[_0x1e78('0x6')],_0x2040ac[_0x1e78('0x7')],_0x2040ac[_0x1e78('0x8')],_0x2040ac['calleridnum'],_0x2040ac[_0x1e78('0x9')],_0x2040ac[_0x1e78('0xa')]));utils[_0x1e78('0xb')](_0x1e78('0xc'),_0x2040ac);delete dials[_0x2040ac[_0x1e78('0x6')]];}exports['newexten']=function(_0x4a075d){try{utils[_0x1e78('0xd')](util[_0x1e78('0x4')](_0x1e78('0xe'),_0x4a075d[_0x1e78('0x6')]),_0x4a075d);utils[_0x1e78('0x3')](util[_0x1e78('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4a075d[_0x1e78('0x6')],_0x4a075d[_0x1e78('0xf')],_0x4a075d[_0x1e78('0x10')]));if(_0x4a075d[_0x1e78('0xf')][_0x1e78('0x11')]()==_0x1e78('0x12')&&_[_0x1e78('0x13')](_0x4a075d['appdata'][_0x1e78('0x11')](),_0x1e78('0x14'))){var _0x438e3f=_0x4a075d[_0x1e78('0x10')]['split']('=');dials[_0x4a075d[_0x1e78('0x6')]]={'routeId':_0x438e3f[0x1]};}}catch(_0x4c60aa){utils[_0x1e78('0x15')](util[_0x1e78('0x4')](_0x1e78('0xe'),_0x4a075d[_0x1e78('0x6')]),_0x4c60aa);}};exports['varset']=function(_0x184e00){try{utils['debug'](util[_0x1e78('0x4')]('[%s][dials][varset]',_0x184e00[_0x1e78('0x6')]),_0x184e00);if(!_[_0x1e78('0x16')](_0x184e00[_0x1e78('0x17')][_0x1e78('0x18')])){utils[_0x1e78('0x3')](util[_0x1e78('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x184e00[_0x1e78('0x6')],_0x184e00['value']));dials[_0x184e00[_0x1e78('0x6')]]={'routeId':_0x184e00[_0x1e78('0x19')]};}}catch(_0x4877d9){utils[_0x1e78('0x15')](util[_0x1e78('0x4')](_0x1e78('0x1a'),_0x184e00[_0x1e78('0x6')]),_0x4877d9);}};exports[_0x1e78('0x1b')]=function(_0x2de005){try{if(!_[_0x1e78('0x16')](dials[_0x2de005[_0x1e78('0x6')]])){utils['debug'](util[_0x1e78('0x4')](_0x1e78('0x1c'),_0x2de005[_0x1e78('0x6')]),_0x2de005);dials[_0x2de005[_0x1e78('0x6')]]=_['assign'](dials[_0x2de005[_0x1e78('0x6')]],_0x2de005);dials[_0x2de005['uniqueid']]['starttime']=utils['now']();dials[_0x2de005[_0x1e78('0x6')]][_0x1e78('0x1d')]=_0x1e78('0x1e');utils['info'](util['format'](_0x1e78('0x1f'),_0x2de005[_0x1e78('0x6')],dials[_0x2de005[_0x1e78('0x6')]][_0x1e78('0x20')]));}}catch(_0x4fd816){utils[_0x1e78('0x15')](util[_0x1e78('0x4')]('[%s][dials][dialbegin]',_0x2de005[_0x1e78('0x6')]),_0x4fd816);}};exports[_0x1e78('0x21')]=function(_0x31acdf){try{if(!_[_0x1e78('0x16')](dials[_0x31acdf[_0x1e78('0x6')]])){utils['debug'](util['format'](_0x1e78('0x22'),_0x31acdf['uniqueid']),_0x31acdf);dials[_0x31acdf[_0x1e78('0x6')]][_0x1e78('0xa')]=_0x31acdf['dialstatus'];if(_0x31acdf[_0x1e78('0xa')]==_0x1e78('0x23')){dials[_0x31acdf[_0x1e78('0x6')]]=_[_0x1e78('0x24')](dials[_0x31acdf[_0x1e78('0x6')]],_0x31acdf);dials[_0x31acdf[_0x1e78('0x6')]]['answertime']=utils[_0x1e78('0x25')]();dials[_0x31acdf['uniqueid']][_0x1e78('0x1d')]=_0x1e78('0x26');utils[_0x1e78('0x3')](util[_0x1e78('0x4')](_0x1e78('0x27'),_0x31acdf[_0x1e78('0x6')],_0x31acdf[_0x1e78('0xa')],dials[_0x31acdf['uniqueid']][_0x1e78('0x28')]));}else{utils[_0x1e78('0x3')](util[_0x1e78('0x4')](_0x1e78('0x29'),_0x31acdf[_0x1e78('0x6')],_0x31acdf[_0x1e78('0xa')]));}}}catch(_0x1c3979){utils['error'](util[_0x1e78('0x4')](_0x1e78('0x22'),_0x31acdf['uniqueid']),_0x1c3979);}};exports[_0x1e78('0x2a')]=function(_0x55a685){try{if(!_[_0x1e78('0x16')](dials[_0x55a685[_0x1e78('0x6')]])){utils[_0x1e78('0xd')](util['format'](_0x1e78('0x2b'),_0x55a685['uniqueid']),_0x55a685);utils['info'](util[_0x1e78('0x4')](_0x1e78('0x2c'),_0x55a685[_0x1e78('0x6')],_0x55a685[_0x1e78('0x2d')],_0x55a685['calleridname'],_0x55a685[_0x1e78('0x2e')]));dials[_0x55a685[_0x1e78('0x6')]]=_[_0x1e78('0x24')](dials[_0x55a685['uniqueid']],{'endtime':utils[_0x1e78('0x25')](),'lastevent':_0x1e78('0x2f')});dials[_0x55a685['uniqueid']][_0x1e78('0x30')]=utils['diffTime'](dials[_0x55a685[_0x1e78('0x6')]]['endtime'],dials[_0x55a685[_0x1e78('0x6')]][_0x1e78('0x20')]);dials[_0x55a685['uniqueid']][_0x1e78('0x31')]=utils[_0x1e78('0x32')](dials[_0x55a685[_0x1e78('0x6')]][_0x1e78('0x28')]||dials[_0x55a685[_0x1e78('0x6')]][_0x1e78('0x33')],dials[_0x55a685[_0x1e78('0x6')]][_0x1e78('0x20')]);dials[_0x55a685['uniqueid']][_0x1e78('0x34')]=dials[_0x55a685[_0x1e78('0x6')]][_0x1e78('0x28')]?utils[_0x1e78('0x32')](dials[_0x55a685['uniqueid']][_0x1e78('0x33')],dials[_0x55a685['uniqueid']]['answertime']):0x0;writeDB(dials[_0x55a685[_0x1e78('0x6')]]);}}catch(_0x374cd6){utils[_0x1e78('0x15')](util[_0x1e78('0x4')]('[%s][dials][hangup]',_0x55a685[_0x1e78('0x6')]),_0x374cd6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 98a7ecb..a6a698b 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 _0xb091=['queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','asterisk','port','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','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]'];(function(_0x32825e,_0x5981c1){var _0x119578=function(_0x40ce3d){while(--_0x40ce3d){_0x32825e['push'](_0x32825e['shift']());}};_0x119578(++_0x5981c1);}(_0xb091,0x16e));var _0x1b09=function(_0x1d6d5d,_0x38cbe7){_0x1d6d5d=_0x1d6d5d-0x0;var _0x41d3f7=_0xb091[_0x1d6d5d];return _0x41d3f7;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1b09('0x0'));var utils=require(_0x1b09('0x1'));var util=require(_0x1b09('0x2'));var isXDREnabled=config[_0x1b09('0x3')]&&!config['xdr'][_0x1b09('0x4')];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x1b09('0x3')]&&config[_0x1b09('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x1b09('0x5')][_0x1b09('0x6')],config[_0x1b09('0x5')]['ip'],config['asterisk'][_0x1b09('0x7')],config[_0x1b09('0x5')][_0x1b09('0x8')],!![]);ami[_0x1b09('0x9')]();if(!isXDREnabled){utils[_0x1b09('0xa')](_0x1b09('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1b09('0xa')](_0x1b09('0xc'));}else{var agents=require(_0x1b09('0xd'));var calls=require(_0x1b09('0xe'));var queues=require(_0x1b09('0xf'));var recordings=require('./recordings.controller');var members=require(_0x1b09('0x10'));var dials=require(_0x1b09('0x11'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x1b09('0x12'),core[_0x1b09('0x12')]);ami['on'](_0x1b09('0x13'),core[_0x1b09('0x13')]);ami['on'](_0x1b09('0x14'),core[_0x1b09('0x14')]);ami['on'](_0x1b09('0x15'),core['error']);ami['on'](_0x1b09('0x16'),core['close']);ami['on'](_0x1b09('0x17'),core[_0x1b09('0x17')]);ami['on'](_0x1b09('0x18'),function(_0x37673e){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x1b'),_0x37673e[_0x1b09('0x1c')]),_0x37673e);members[_0x1b09('0x18')](_0x37673e);}catch(_0x32244e){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x1b'),_0x37673e['device']),_0x32244e);}});ami['on'](_0x1b09('0x1d'),function(_0x1c1ef9){try{utils['debug'](util['format'](_0x1b09('0x1e'),_0x1c1ef9['uniqueid']),_0x1c1ef9);agents[_0x1b09('0x1d')](_0x1c1ef9);}catch(_0x5bb127){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x1e'),_0x1c1ef9[_0x1b09('0x1f')]),_0x5bb127);}});ami['on'](_0x1b09('0x20'),function(_0x24889f){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')]('[%s][index][agentringnoanswer]',_0x24889f['uniqueid']),_0x24889f);agents[_0x1b09('0x20')](_0x24889f);}catch(_0x41c786){utils['error'](util[_0x1b09('0x1a')](_0x1b09('0x21'),_0x24889f[_0x1b09('0x1f')]),_0x41c786);}});ami['on'](_0x1b09('0x22'),function(_0x5a9677){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')]('[%s][index][agentconnect]',_0x5a9677[_0x1b09('0x1f')]),_0x5a9677);agents[_0x1b09('0x22')](_0x5a9677);queues['agentconnect'](_0x5a9677);}catch(_0x13c89c){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x23'),_0x5a9677['uniqueid']),_0x13c89c);}});ami['on'](_0x1b09('0x24'),function(_0x3cdbc5){try{utils['debug'](util[_0x1b09('0x1a')](_0x1b09('0x25'),_0x3cdbc5[_0x1b09('0x1f')]),_0x3cdbc5);agents[_0x1b09('0x24')](_0x3cdbc5);queues[_0x1b09('0x24')](_0x3cdbc5);members[_0x1b09('0x24')](_0x3cdbc5);}catch(_0x34620f){utils['error'](util[_0x1b09('0x1a')](_0x1b09('0x25'),_0x3cdbc5['uniqueid']),_0x34620f);}});ami['on'](_0x1b09('0x26'),function(_0x1a6130){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x27'),_0x1a6130['uniqueid']),_0x1a6130);agents[_0x1b09('0x26')](_0x1a6130);queues['queuecallerabandon'](_0x1a6130);}catch(_0x143829){utils['error'](util[_0x1b09('0x1a')](_0x1b09('0x27'),_0x1a6130[_0x1b09('0x1f')]),_0x143829);}});ami['on'](_0x1b09('0x28'),function(_0x35b14c){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x29'),_0x35b14c[_0x1b09('0x1f')]),_0x35b14c);queues[_0x1b09('0x28')](_0x35b14c);recordings['queuecallerjoin'](_0x35b14c);}catch(_0x267b28){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')]('[%s][index][queuecallerjoin]',_0x35b14c[_0x1b09('0x1f')]),_0x267b28);}});ami['on'](_0x1b09('0x2a'),function(_0x4662d6){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x2b'),_0x4662d6[_0x1b09('0x1f')]),_0x4662d6);queues[_0x1b09('0x2a')](_0x4662d6);}catch(_0x4dc5d0){utils[_0x1b09('0x15')](util['format'](_0x1b09('0x2b'),_0x4662d6['uniqueid']),_0x4dc5d0);}});ami['on'](_0x1b09('0x2c'),function(_0x278aa8){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x2d'),_0x278aa8[_0x1b09('0x1f')]),_0x278aa8);queues[_0x1b09('0x2c')](_0x278aa8);calls[_0x1b09('0x2c')](_0x278aa8);}catch(_0x43032f){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x2d'),_0x278aa8[_0x1b09('0x1f')]),_0x43032f);}});ami['on']('musiconholdstop',function(_0x588b90){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x2e'),_0x588b90[_0x1b09('0x1f')]),_0x588b90);queues[_0x1b09('0x2f')](_0x588b90);calls[_0x1b09('0x2f')](_0x588b90);}catch(_0x529a21){utils[_0x1b09('0x15')](util['format']('[%s][index][musiconholdstop]',_0x588b90[_0x1b09('0x1f')]),_0x529a21);}});ami['on']('newstate',function(_0x966873){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')]('[%s][index][newstate]',_0x966873[_0x1b09('0x1f')]),_0x966873);calls[_0x1b09('0x30')](_0x966873);recordings[_0x1b09('0x30')](_0x966873);}catch(_0x58c7c2){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x31'),_0x966873[_0x1b09('0x1f')]),_0x58c7c2);}});ami['on']('hangup',function(_0x36f814){try{utils[_0x1b09('0x19')](util['format'](_0x1b09('0x32'),_0x36f814[_0x1b09('0x1f')]),_0x36f814);calls['hangup'](_0x36f814);recordings['hangup'](_0x36f814);dials['hangup'](_0x36f814);agents['hangup'](_0x36f814);queues[_0x1b09('0x33')](_0x36f814);}catch(_0xabc336){utils[_0x1b09('0x15')](util['format'](_0x1b09('0x32'),_0x36f814[_0x1b09('0x1f')]),_0xabc336);}});ami['on']('cdr',function(_0x1ad7b6){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x34'),_0x1ad7b6[_0x1b09('0x1f')]),_0x1ad7b6);members[_0x1b09('0x35')](_0x1ad7b6);}catch(_0x1bd847){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x34'),_0x1ad7b6['uniqueid']),_0x1bd847);}});ami['on'](_0x1b09('0x36'),function(_0x4116b0){try{utils[_0x1b09('0x19')](util['format'](_0x1b09('0x37'),_0x4116b0['uniqueid']),_0x4116b0);queues[_0x1b09('0x36')](_0x4116b0);agents[_0x1b09('0x36')](_0x4116b0);transfers['blindtransfer'](_0x4116b0);recordings[_0x1b09('0x36')](_0x4116b0);}catch(_0x9be1a){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x37'),_0x4116b0[_0x1b09('0x1f')]),_0x9be1a);}});ami['on']('attendedtransfer',function(_0x479dfc){try{utils['debug'](util[_0x1b09('0x1a')]('[%s][index][attendedtransfer]',_0x479dfc['origtransfereruniqueid']),_0x479dfc);queues[_0x1b09('0x38')](_0x479dfc);transfers[_0x1b09('0x38')](_0x479dfc);agents[_0x1b09('0x38')](_0x479dfc);calls[_0x1b09('0x38')](_0x479dfc);}catch(_0x66ca28){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x39'),_0x479dfc['origtransfereruniqueid']),_0x66ca28);}});ami['on'](_0x1b09('0x3a'),function(_0x3c6ea6){try{utils[_0x1b09('0x19')](util['format']('[%s][index][varset]',_0x3c6ea6[_0x1b09('0x1f')]),_0x3c6ea6);queues['varset'](_0x3c6ea6);recordings[_0x1b09('0x3a')](_0x3c6ea6);calls[_0x1b09('0x3a')](_0x3c6ea6);dials['varset'](_0x3c6ea6);}catch(_0x17378b){utils[_0x1b09('0x15')](util['format'](_0x1b09('0x3b'),_0x3c6ea6[_0x1b09('0x1f')]),_0x17378b);}});ami['on'](_0x1b09('0x3c'),function(_0x3d4144){try{utils[_0x1b09('0x19')](util['format'](_0x1b09('0x3d'),_0x3d4144[_0x1b09('0x1f')]),_0x3d4144);calls[_0x1b09('0x3c')](_0x3d4144);recordings[_0x1b09('0x3c')](_0x3d4144);dials[_0x1b09('0x3c')](_0x3d4144);}catch(_0x1d75d9){utils[_0x1b09('0x15')](util['format']('[%s][index][newexten]',_0x3d4144[_0x1b09('0x1f')]),_0x1d75d9);}});ami['on'](_0x1b09('0x3e'),function(_0x327254){try{utils['debug'](util[_0x1b09('0x1a')](_0x1b09('0x3f'),_0x327254[_0x1b09('0x1f')]),_0x327254);calls['newchannel'](_0x327254);recordings[_0x1b09('0x3e')](_0x327254);}catch(_0x2dcdb6){utils[_0x1b09('0x15')](util[_0x1b09('0x1a')](_0x1b09('0x3f'),_0x327254[_0x1b09('0x1f')]),_0x2dcdb6);}});ami['on'](_0x1b09('0x40'),function(_0x256d47){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')](_0x1b09('0x41'),_0x256d47[_0x1b09('0x1f')]),_0x256d47);dials[_0x1b09('0x40')](_0x256d47);}catch(_0x44cae9){utils[_0x1b09('0x15')](util['format']('[%s]dialbegin',_0x256d47[_0x1b09('0x1f')]),_0x44cae9);}});ami['on']('dialend',function(_0x315fe3){try{utils[_0x1b09('0x19')](util[_0x1b09('0x1a')]('[%s][index][dialend]',_0x315fe3['uniqueid']),_0x315fe3);dials[_0x1b09('0x42')](_0x315fe3);}catch(_0x7d382d){utils['error'](util[_0x1b09('0x1a')](_0x1b09('0x43'),_0x315fe3[_0x1b09('0x1f')]),_0x7d382d);}});} \ No newline at end of file +var _0x4bfa=['device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','../../config/environment','xdr','disabled','env','production','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]'];(function(_0x4a8cf5,_0x5e186b){var _0x1c9a96=function(_0x9b50f9){while(--_0x9b50f9){_0x4a8cf5['push'](_0x4a8cf5['shift']());}};_0x1c9a96(++_0x5e186b);}(_0x4bfa,0xb6));var _0xa4bf=function(_0x1aa5eb,_0x4efec4){_0x1aa5eb=_0x1aa5eb-0x0;var _0x45f0fa=_0x4bfa[_0x1aa5eb];return _0x45f0fa;};var AsteriskManager=require('asterisk-manager');var config=require(_0xa4bf('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0xa4bf('0x1')]&&config[_0xa4bf('0x1')][_0xa4bf('0x2')]?!config[_0xa4bf('0x1')]['disabled']:!![];var isProduction=config[_0xa4bf('0x3')]===_0xa4bf('0x4')||![];var isLocalAsterisk=config[_0xa4bf('0x1')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0xa4bf('0x5')][_0xa4bf('0x6')],config[_0xa4bf('0x5')]['ip'],config['asterisk']['username'],config[_0xa4bf('0x5')][_0xa4bf('0x7')],!![]);ami[_0xa4bf('0x8')]();if(!isXDREnabled){utils[_0xa4bf('0x9')](_0xa4bf('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xa4bf('0x9')](_0xa4bf('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0xa4bf('0xc'));var queues=require(_0xa4bf('0xd'));var recordings=require(_0xa4bf('0xe'));var members=require('./members.controller');var dials=require(_0xa4bf('0xf'));var transfers=require(_0xa4bf('0x10'));var core=require(_0xa4bf('0x11'));ami['on'](_0xa4bf('0x12'),core[_0xa4bf('0x12')]);ami['on']('shutdown',core[_0xa4bf('0x13')]);ami['on']('fullybooted',core[_0xa4bf('0x14')]);ami['on'](_0xa4bf('0x15'),core[_0xa4bf('0x15')]);ami['on'](_0xa4bf('0x16'),core[_0xa4bf('0x16')]);ami['on'](_0xa4bf('0x17'),core[_0xa4bf('0x17')]);ami['on'](_0xa4bf('0x18'),function(_0x319c1d){try{utils[_0xa4bf('0x19')](util['format']('[%s][index][devicestatechange]',_0x319c1d['device']),_0x319c1d);members[_0xa4bf('0x18')](_0x319c1d);}catch(_0xac55d3){utils['error'](util[_0xa4bf('0x1a')](_0xa4bf('0x1b'),_0x319c1d[_0xa4bf('0x1c')]),_0xac55d3);}});ami['on'](_0xa4bf('0x1d'),function(_0x5874d0){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x1e'),_0x5874d0['uniqueid']),_0x5874d0);agents[_0xa4bf('0x1d')](_0x5874d0);}catch(_0x5ce286){utils['error'](util['format']('[%s][index][agentcalled]',_0x5874d0[_0xa4bf('0x1f')]),_0x5ce286);}});ami['on'](_0xa4bf('0x20'),function(_0x554076){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x21'),_0x554076[_0xa4bf('0x1f')]),_0x554076);agents['agentringnoanswer'](_0x554076);}catch(_0x49f6eb){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')](_0xa4bf('0x21'),_0x554076[_0xa4bf('0x1f')]),_0x49f6eb);}});ami['on']('agentconnect',function(_0x30ab3e){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x22'),_0x30ab3e['uniqueid']),_0x30ab3e);agents[_0xa4bf('0x23')](_0x30ab3e);queues['agentconnect'](_0x30ab3e);}catch(_0x59de1a){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')](_0xa4bf('0x22'),_0x30ab3e['uniqueid']),_0x59de1a);}});ami['on']('agentcomplete',function(_0x521432){try{utils['debug'](util[_0xa4bf('0x1a')]('[%s][index][agentcomplete]',_0x521432[_0xa4bf('0x1f')]),_0x521432);agents[_0xa4bf('0x24')](_0x521432);queues[_0xa4bf('0x24')](_0x521432);members['agentcomplete'](_0x521432);}catch(_0x36ec34){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')](_0xa4bf('0x25'),_0x521432[_0xa4bf('0x1f')]),_0x36ec34);}});ami['on'](_0xa4bf('0x26'),function(_0x5a151b){try{utils['debug'](util[_0xa4bf('0x1a')]('[%s][index][queuecallerabandon]',_0x5a151b[_0xa4bf('0x1f')]),_0x5a151b);agents['queuecallerabandon'](_0x5a151b);queues[_0xa4bf('0x26')](_0x5a151b);}catch(_0x20d926){utils['error'](util[_0xa4bf('0x1a')](_0xa4bf('0x27'),_0x5a151b[_0xa4bf('0x1f')]),_0x20d926);}});ami['on'](_0xa4bf('0x28'),function(_0x43a93e){try{utils['debug'](util['format'](_0xa4bf('0x29'),_0x43a93e[_0xa4bf('0x1f')]),_0x43a93e);queues[_0xa4bf('0x28')](_0x43a93e);recordings[_0xa4bf('0x28')](_0x43a93e);}catch(_0x5c951d){utils['error'](util[_0xa4bf('0x1a')](_0xa4bf('0x29'),_0x43a93e[_0xa4bf('0x1f')]),_0x5c951d);}});ami['on'](_0xa4bf('0x2a'),function(_0x1e83da){try{utils[_0xa4bf('0x19')](util['format'](_0xa4bf('0x2b'),_0x1e83da[_0xa4bf('0x1f')]),_0x1e83da);queues[_0xa4bf('0x2a')](_0x1e83da);}catch(_0x504814){utils[_0xa4bf('0x15')](util['format'](_0xa4bf('0x2b'),_0x1e83da['uniqueid']),_0x504814);}});ami['on'](_0xa4bf('0x2c'),function(_0x3e5a61){try{utils['debug'](util[_0xa4bf('0x1a')](_0xa4bf('0x2d'),_0x3e5a61[_0xa4bf('0x1f')]),_0x3e5a61);queues['musiconholdstart'](_0x3e5a61);calls[_0xa4bf('0x2c')](_0x3e5a61);}catch(_0x5e1ff2){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')]('[%s][index][musiconholdstart]',_0x3e5a61[_0xa4bf('0x1f')]),_0x5e1ff2);}});ami['on']('musiconholdstop',function(_0x23ac01){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x2e'),_0x23ac01[_0xa4bf('0x1f')]),_0x23ac01);queues[_0xa4bf('0x2f')](_0x23ac01);calls[_0xa4bf('0x2f')](_0x23ac01);}catch(_0x37c34d){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')](_0xa4bf('0x2e'),_0x23ac01['uniqueid']),_0x37c34d);}});ami['on'](_0xa4bf('0x30'),function(_0x56e321){try{utils['debug'](util[_0xa4bf('0x1a')](_0xa4bf('0x31'),_0x56e321[_0xa4bf('0x1f')]),_0x56e321);calls[_0xa4bf('0x30')](_0x56e321);recordings[_0xa4bf('0x30')](_0x56e321);}catch(_0x399657){utils[_0xa4bf('0x15')](util['format'](_0xa4bf('0x31'),_0x56e321[_0xa4bf('0x1f')]),_0x399657);}});ami['on']('hangup',function(_0x3d0796){try{utils['debug'](util[_0xa4bf('0x1a')]('[%s][index][hangup]',_0x3d0796[_0xa4bf('0x1f')]),_0x3d0796);calls[_0xa4bf('0x32')](_0x3d0796);recordings[_0xa4bf('0x32')](_0x3d0796);dials[_0xa4bf('0x32')](_0x3d0796);agents[_0xa4bf('0x32')](_0x3d0796);queues['hangup'](_0x3d0796);}catch(_0x3053dc){utils['error'](util[_0xa4bf('0x1a')](_0xa4bf('0x33'),_0x3d0796[_0xa4bf('0x1f')]),_0x3053dc);}});ami['on'](_0xa4bf('0x34'),function(_0xb931c5){try{utils[_0xa4bf('0x19')](util['format'](_0xa4bf('0x35'),_0xb931c5[_0xa4bf('0x1f')]),_0xb931c5);members['cdr'](_0xb931c5);}catch(_0x2d2a20){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')]('[%s][index][cdr]',_0xb931c5[_0xa4bf('0x1f')]),_0x2d2a20);}});ami['on'](_0xa4bf('0x36'),function(_0x19d088){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x37'),_0x19d088[_0xa4bf('0x1f')]),_0x19d088);queues['blindtransfer'](_0x19d088);agents[_0xa4bf('0x36')](_0x19d088);transfers[_0xa4bf('0x36')](_0x19d088);recordings[_0xa4bf('0x36')](_0x19d088);}catch(_0x387945){utils['error'](util['format'](_0xa4bf('0x37'),_0x19d088[_0xa4bf('0x1f')]),_0x387945);}});ami['on'](_0xa4bf('0x38'),function(_0x48d920){try{utils['debug'](util[_0xa4bf('0x1a')](_0xa4bf('0x39'),_0x48d920['origtransfereruniqueid']),_0x48d920);queues[_0xa4bf('0x38')](_0x48d920);transfers['attendedtransfer'](_0x48d920);agents['attendedtransfer'](_0x48d920);calls[_0xa4bf('0x38')](_0x48d920);}catch(_0x27bfe2){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')](_0xa4bf('0x39'),_0x48d920[_0xa4bf('0x3a')]),_0x27bfe2);}});ami['on'](_0xa4bf('0x3b'),function(_0x5d5e63){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')]('[%s][index][varset]',_0x5d5e63[_0xa4bf('0x1f')]),_0x5d5e63);queues[_0xa4bf('0x3b')](_0x5d5e63);recordings[_0xa4bf('0x3b')](_0x5d5e63);calls['varset'](_0x5d5e63);dials[_0xa4bf('0x3b')](_0x5d5e63);}catch(_0x23cb81){utils[_0xa4bf('0x15')](util[_0xa4bf('0x1a')](_0xa4bf('0x3c'),_0x5d5e63[_0xa4bf('0x1f')]),_0x23cb81);}});ami['on'](_0xa4bf('0x3d'),function(_0xfdf7a7){try{utils[_0xa4bf('0x19')](util['format'](_0xa4bf('0x3e'),_0xfdf7a7[_0xa4bf('0x1f')]),_0xfdf7a7);calls[_0xa4bf('0x3d')](_0xfdf7a7);recordings[_0xa4bf('0x3d')](_0xfdf7a7);dials[_0xa4bf('0x3d')](_0xfdf7a7);}catch(_0x4c870d){utils['error'](util[_0xa4bf('0x1a')](_0xa4bf('0x3e'),_0xfdf7a7[_0xa4bf('0x1f')]),_0x4c870d);}});ami['on'](_0xa4bf('0x3f'),function(_0x5474bd){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x40'),_0x5474bd[_0xa4bf('0x1f')]),_0x5474bd);calls[_0xa4bf('0x3f')](_0x5474bd);recordings['newchannel'](_0x5474bd);}catch(_0x1da8ce){utils[_0xa4bf('0x15')](util['format']('[%s][index][newchannel]',_0x5474bd[_0xa4bf('0x1f')]),_0x1da8ce);}});ami['on']('dialbegin',function(_0x144d66){try{utils[_0xa4bf('0x19')](util['format'](_0xa4bf('0x41'),_0x144d66[_0xa4bf('0x1f')]),_0x144d66);dials[_0xa4bf('0x42')](_0x144d66);}catch(_0x2e1dea){utils['error'](util[_0xa4bf('0x1a')](_0xa4bf('0x43'),_0x144d66[_0xa4bf('0x1f')]),_0x2e1dea);}});ami['on']('dialend',function(_0x460dce){try{utils[_0xa4bf('0x19')](util[_0xa4bf('0x1a')](_0xa4bf('0x44'),_0x460dce[_0xa4bf('0x1f')]),_0x460dce);dials[_0xa4bf('0x45')](_0x460dce);}catch(_0x3eb707){utils['error'](util['format'](_0xa4bf('0x44'),_0x460dce[_0xa4bf('0x1f')]),_0x3eb707);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b3dc218..9fb4665 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 _0xdeb7=['agent','NOT_INUSE','isNil','exitAt','now','diffTime','enterAt','[%s][members][devicestatechange]','debug','queue','assign','cdr','[%s][members][cdr]','source','destination','data1','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','then','internal','CreateMemberReport','split','name','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xdeb7,0x77));var _0x7deb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdeb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7deb('0x0'));var util=require(_0x7deb('0x1'));var utils=require(_0x7deb('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x7deb('0x3')];function writeDB(_0x161729){utils[_0x7deb('0x4')](util[_0x7deb('0x5')](_0x7deb('0x6'),_0x161729['uniqueid'],_0x161729[_0x7deb('0x7')],_0x161729[_0x7deb('0x8')],_0x161729[_0x7deb('0x9')],_0x161729[_0x7deb('0xa')],_0x161729[_0x7deb('0xb')]));if(_0x161729[_0x7deb('0x7')]){utils['getUserByInterface'](_0x161729[_0x7deb('0x7')])[_0x7deb('0xc')](function(_0x3cb5d4){if(_0x3cb5d4){_0x161729[_0x7deb('0xa')]=_0x3cb5d4['name'];_0x161729[_0x7deb('0xd')]=_0x3cb5d4['internal'];utils['request'](_0x7deb('0xe'),_0x161729);}else{utils['getUserByName'](_0x161729[_0x7deb('0x7')][_0x7deb('0xf')]('/')[0x1])[_0x7deb('0xc')](function(_0x52f80b){if(_0x52f80b){_0x161729[_0x7deb('0xa')]=_0x52f80b[_0x7deb('0x10')];_0x161729[_0x7deb('0xd')]=_0x52f80b[_0x7deb('0xd')];utils['request'](_0x7deb('0xe'),_0x161729);}});}})[_0x7deb('0x11')](function(_0xe8e818){utils[_0x7deb('0x12')](util[_0x7deb('0x5')](_0x7deb('0x13'),_0x161729[_0x7deb('0x14')]),_0xe8e818);});}delete members[_0x161729[_0x7deb('0x7')]];}function startsWith(_0x18957d,_0x405ae6){return _[_0x7deb('0x15')](_0x18957d,function(_0x4764e3){return _[_0x7deb('0x16')](_0x405ae6,_0x4764e3);});}exports[_0x7deb('0x17')]=function(_0xbe8e2a){try{utils['debug'](util[_0x7deb('0x5')]('[%s][members][devicestatechange]',members[_0xbe8e2a[_0x7deb('0x18')]]?members[_0xbe8e2a[_0x7deb('0x18')]]['uniqueid']:_0xbe8e2a[_0x7deb('0x18')]),_0xbe8e2a);utils[_0x7deb('0x4')](util[_0x7deb('0x5')](_0x7deb('0x19'),members[_0xbe8e2a[_0x7deb('0x18')]]?members[_0xbe8e2a[_0x7deb('0x18')]][_0x7deb('0x14')]:_0xbe8e2a[_0x7deb('0x18')],_0xbe8e2a[_0x7deb('0x1a')],_0xbe8e2a['device']));switch(_0xbe8e2a[_0x7deb('0x1a')]){case _0x7deb('0x1b'):case _0x7deb('0x1c'):if(!startsWith(exclude,_0xbe8e2a[_0x7deb('0x18')])){members[_0xbe8e2a[_0x7deb('0x18')]]={'channel':_0x7deb('0x1d'),'interface':_0xbe8e2a[_0x7deb('0x18')],'type':_0x7deb('0x1e'),'enterAt':utils['now'](),'role':_0x7deb('0x1f')};}break;case _0x7deb('0x20'):if(!_[_0x7deb('0x21')](members[_0xbe8e2a['device']])){members[_0xbe8e2a[_0x7deb('0x18')]][_0x7deb('0x22')]=utils[_0x7deb('0x23')]();members[_0xbe8e2a[_0x7deb('0x18')]]['duration']=utils[_0x7deb('0x24')](members[_0xbe8e2a[_0x7deb('0x18')]][_0x7deb('0x22')],members[_0xbe8e2a[_0x7deb('0x18')]][_0x7deb('0x25')]);if(members[_0xbe8e2a[_0x7deb('0x18')]][_0x7deb('0x14')]){writeDB(members[_0xbe8e2a[_0x7deb('0x18')]]);}}break;default:break;}}catch(_0x3b2fe6){utils[_0x7deb('0x12')](util[_0x7deb('0x5')](_0x7deb('0x26'),members[_0xbe8e2a[_0x7deb('0x18')]]?members[_0xbe8e2a[_0x7deb('0x18')]]['uniqueid']:_0xbe8e2a[_0x7deb('0x18')]),_0x3b2fe6);}};exports['agentcomplete']=function(_0x1ce28d){try{if(!_['isNil'](members[_0x1ce28d[_0x7deb('0x7')]])){utils[_0x7deb('0x27')](util['format']('[%s][members][agentcomplete]',_0x1ce28d[_0x7deb('0x14')]),_0x1ce28d);utils[_0x7deb('0x4')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x1ce28d[_0x7deb('0x14')],_0x1ce28d[_0x7deb('0x7')],_0x1ce28d[_0x7deb('0x28')]));members[_0x1ce28d[_0x7deb('0x7')]]=_[_0x7deb('0x29')](members[_0x1ce28d[_0x7deb('0x7')]],{'data4':_0x1ce28d[_0x7deb('0x28')],'uniqueid':_0x1ce28d[_0x7deb('0x14')]});}}catch(_0xe89d70){utils['error'](util[_0x7deb('0x5')]('[%s][members][agentcomplete]',_0x1ce28d[_0x7deb('0x14')]),_0xe89d70);}};exports[_0x7deb('0x2a')]=function(_0x16b8d4){try{utils[_0x7deb('0x27')](util[_0x7deb('0x5')](_0x7deb('0x2b'),_0x16b8d4[_0x7deb('0x14')]),_0x16b8d4);if(_0x16b8d4[_0x7deb('0x8')]){var _0x7efb29=_0x16b8d4[_0x7deb('0x8')]['split']('-')[0x0];if(!_[_0x7deb('0x21')](members[_0x7efb29])){members[_0x7efb29]=_[_0x7deb('0x29')](members[_0x7efb29],{'data1':members[_0x7efb29]['data1']||_0x16b8d4['type'],'data2':members[_0x7efb29]['data2']||_0x16b8d4[_0x7deb('0x2c')],'data3':members[_0x7efb29]['data3']||_0x16b8d4[_0x7deb('0x2d')],'uniqueid':members[_0x7efb29][_0x7deb('0x14')]||_0x16b8d4[_0x7deb('0x14')]});utils[_0x7deb('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x16b8d4['uniqueid'],members[_0x7efb29][_0x7deb('0x2e')],members[_0x7efb29][_0x7deb('0x9')],members[_0x7efb29][_0x7deb('0x2f')]));if(members[_0x7efb29][_0x7deb('0x22')]){writeDB(members[_0x7efb29]);}}}if(_0x16b8d4[_0x7deb('0x30')]){var _0x327091=_0x16b8d4['destinationchannel']['split']('-')[0x0];if(!_[_0x7deb('0x21')](members[_0x327091])){members[_0x327091]=_[_0x7deb('0x29')](members[_0x327091],{'data1':members[_0x327091]['data1']||_0x16b8d4[_0x7deb('0xb')],'data2':members[_0x327091]['data2']||_0x16b8d4[_0x7deb('0x2c')],'data3':members[_0x327091][_0x7deb('0x2f')]||_0x16b8d4[_0x7deb('0x2d')],'uniqueid':members[_0x327091][_0x7deb('0x14')]||_0x16b8d4[_0x7deb('0x14')]});utils[_0x7deb('0x4')](util['format'](_0x7deb('0x31'),_0x16b8d4[_0x7deb('0x14')],members[_0x327091][_0x7deb('0x2e')],members[_0x327091][_0x7deb('0x9')],members[_0x327091]['data3']));if(members[_0x327091][_0x7deb('0x22')]){writeDB(members[_0x327091]);}}}}catch(_0x50b7d2){utils['error'](util['format'](_0x7deb('0x2b'),_0x16b8d4[_0x7deb('0x14')]),_0x50b7d2);}}; \ No newline at end of file +var _0xb56f=['diffTime','enterAt','agentcomplete','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','then','name','internal','request','split','CreateMemberReport','catch','error','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration'];(function(_0xebf231,_0x3f392b){var _0x5614ad=function(_0x68b56d){while(--_0x68b56d){_0xebf231['push'](_0xebf231['shift']());}};_0x5614ad(++_0x3f392b);}(_0xb56f,0x113));var _0xfb56=function(_0xf7ba77,_0x47757e){_0xf7ba77=_0xf7ba77-0x0;var _0x59f74c=_0xb56f[_0xf7ba77];return _0x59f74c;};'use strict';var _=require(_0xfb56('0x0'));var util=require(_0xfb56('0x1'));var utils=require(_0xfb56('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xfb56('0x3')];function writeDB(_0x335f2a){utils['info'](util[_0xfb56('0x4')](_0xfb56('0x5'),_0x335f2a['uniqueid'],_0x335f2a[_0xfb56('0x6')],_0x335f2a[_0xfb56('0x7')],_0x335f2a[_0xfb56('0x8')],_0x335f2a[_0xfb56('0x9')],_0x335f2a[_0xfb56('0xa')]));if(_0x335f2a[_0xfb56('0x6')]){utils['getUserByInterface'](_0x335f2a['interface'])[_0xfb56('0xb')](function(_0x3c9e36){if(_0x3c9e36){_0x335f2a[_0xfb56('0x9')]=_0x3c9e36[_0xfb56('0xc')];_0x335f2a[_0xfb56('0xd')]=_0x3c9e36[_0xfb56('0xd')];utils[_0xfb56('0xe')]('CreateMemberReport',_0x335f2a);}else{utils['getUserByName'](_0x335f2a['interface'][_0xfb56('0xf')]('/')[0x1])['then'](function(_0x84b622){if(_0x84b622){_0x335f2a[_0xfb56('0x9')]=_0x84b622[_0xfb56('0xc')];_0x335f2a[_0xfb56('0xd')]=_0x84b622['internal'];utils[_0xfb56('0xe')](_0xfb56('0x10'),_0x335f2a);}});}})[_0xfb56('0x11')](function(_0x492392){utils[_0xfb56('0x12')](util['format']('[%s][members][writeDB]',_0x335f2a[_0xfb56('0x13')]),_0x492392);});}delete members[_0x335f2a[_0xfb56('0x6')]];}function startsWith(_0xc1e894,_0xed4a16){return _[_0xfb56('0x14')](_0xc1e894,function(_0x3664ac){return _[_0xfb56('0x15')](_0xed4a16,_0x3664ac);});}exports[_0xfb56('0x16')]=function(_0x14c7b7){try{utils[_0xfb56('0x17')](util[_0xfb56('0x4')](_0xfb56('0x18'),members[_0x14c7b7[_0xfb56('0x19')]]?members[_0x14c7b7[_0xfb56('0x19')]][_0xfb56('0x13')]:_0x14c7b7[_0xfb56('0x19')]),_0x14c7b7);utils['info'](util['format'](_0xfb56('0x1a'),members[_0x14c7b7[_0xfb56('0x19')]]?members[_0x14c7b7[_0xfb56('0x19')]][_0xfb56('0x13')]:_0x14c7b7[_0xfb56('0x19')],_0x14c7b7[_0xfb56('0x1b')],_0x14c7b7[_0xfb56('0x19')]));switch(_0x14c7b7['state']){case _0xfb56('0x1c'):case'BUSY':if(!startsWith(exclude,_0x14c7b7[_0xfb56('0x19')])){members[_0x14c7b7[_0xfb56('0x19')]]={'channel':_0xfb56('0x1d'),'interface':_0x14c7b7[_0xfb56('0x19')],'type':_0xfb56('0x1e'),'enterAt':utils[_0xfb56('0x1f')](),'role':_0xfb56('0x20')};}break;case _0xfb56('0x21'):if(!_[_0xfb56('0x22')](members[_0x14c7b7[_0xfb56('0x19')]])){members[_0x14c7b7['device']][_0xfb56('0x23')]=utils[_0xfb56('0x1f')]();members[_0x14c7b7[_0xfb56('0x19')]][_0xfb56('0x24')]=utils[_0xfb56('0x25')](members[_0x14c7b7['device']][_0xfb56('0x23')],members[_0x14c7b7['device']][_0xfb56('0x26')]);if(members[_0x14c7b7['device']][_0xfb56('0x13')]){writeDB(members[_0x14c7b7['device']]);}}break;default:break;}}catch(_0x336492){utils[_0xfb56('0x12')](util[_0xfb56('0x4')](_0xfb56('0x18'),members[_0x14c7b7['device']]?members[_0x14c7b7[_0xfb56('0x19')]][_0xfb56('0x13')]:_0x14c7b7['device']),_0x336492);}};exports[_0xfb56('0x27')]=function(_0x41ab0d){try{if(!_[_0xfb56('0x22')](members[_0x41ab0d[_0xfb56('0x6')]])){utils[_0xfb56('0x17')](util[_0xfb56('0x4')]('[%s][members][agentcomplete]',_0x41ab0d['uniqueid']),_0x41ab0d);utils[_0xfb56('0x28')](util[_0xfb56('0x4')](_0xfb56('0x29'),_0x41ab0d[_0xfb56('0x13')],_0x41ab0d[_0xfb56('0x6')],_0x41ab0d[_0xfb56('0x2a')]));members[_0x41ab0d['interface']]=_[_0xfb56('0x2b')](members[_0x41ab0d[_0xfb56('0x6')]],{'data4':_0x41ab0d[_0xfb56('0x2a')],'uniqueid':_0x41ab0d['uniqueid']});}}catch(_0x452aa1){utils['error'](util[_0xfb56('0x4')](_0xfb56('0x2c'),_0x41ab0d['uniqueid']),_0x452aa1);}};exports['cdr']=function(_0xeb9a23){try{utils['debug'](util['format'](_0xfb56('0x2d'),_0xeb9a23[_0xfb56('0x13')]),_0xeb9a23);if(_0xeb9a23['channel']){var _0x40db54=_0xeb9a23[_0xfb56('0x7')]['split']('-')[0x0];if(!_[_0xfb56('0x22')](members[_0x40db54])){members[_0x40db54]=_[_0xfb56('0x2b')](members[_0x40db54],{'data1':members[_0x40db54][_0xfb56('0x2e')]||_0xeb9a23[_0xfb56('0xa')],'data2':members[_0x40db54][_0xfb56('0x8')]||_0xeb9a23[_0xfb56('0x2f')],'data3':members[_0x40db54][_0xfb56('0x30')]||_0xeb9a23[_0xfb56('0x31')],'uniqueid':members[_0x40db54][_0xfb56('0x13')]||_0xeb9a23[_0xfb56('0x13')]});utils[_0xfb56('0x28')](util[_0xfb56('0x4')](_0xfb56('0x32'),_0xeb9a23['uniqueid'],members[_0x40db54]['data1'],members[_0x40db54]['data2'],members[_0x40db54]['data3']));if(members[_0x40db54][_0xfb56('0x23')]){writeDB(members[_0x40db54]);}}}if(_0xeb9a23[_0xfb56('0x33')]){var _0x4a2e52=_0xeb9a23[_0xfb56('0x33')][_0xfb56('0xf')]('-')[0x0];if(!_[_0xfb56('0x22')](members[_0x4a2e52])){members[_0x4a2e52]=_[_0xfb56('0x2b')](members[_0x4a2e52],{'data1':members[_0x4a2e52]['data1']||_0xeb9a23[_0xfb56('0xa')],'data2':members[_0x4a2e52]['data2']||_0xeb9a23[_0xfb56('0x2f')],'data3':members[_0x4a2e52]['data3']||_0xeb9a23[_0xfb56('0x31')],'uniqueid':members[_0x4a2e52][_0xfb56('0x13')]||_0xeb9a23[_0xfb56('0x13')]});utils[_0xfb56('0x28')](util[_0xfb56('0x4')](_0xfb56('0x32'),_0xeb9a23[_0xfb56('0x13')],members[_0x4a2e52][_0xfb56('0x2e')],members[_0x4a2e52][_0xfb56('0x8')],members[_0x4a2e52][_0xfb56('0x30')]));if(members[_0x4a2e52][_0xfb56('0x23')]){writeDB(members[_0x4a2e52]);}}}}catch(_0x17406c){utils[_0xfb56('0x12')](util[_0xfb56('0x4')](_0xfb56('0x2d'),_0xeb9a23['uniqueid']),_0x17406c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a5cfbfd..7327d0d 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 _0x7892=['[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','position','now','error','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER'];(function(_0x5aa992,_0x559ebb){var _0x2e2d59=function(_0x1e2e35){while(--_0x1e2e35){_0x5aa992['push'](_0x5aa992['shift']());}};_0x2e2d59(++_0x559ebb);}(_0x7892,0x149));var _0x2789=function(_0x160205,_0x5daa4e){_0x160205=_0x160205-0x0;var _0x57838e=_0x7892[_0x160205];return _0x57838e;};'use strict';var _=require('lodash');var util=require(_0x2789('0x0'));var utils=require(_0x2789('0x1'));var queues={};function writeDB(_0x348a40){utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x4'),_0x348a40[_0x2789('0x5')],_0x348a40['channel'],_0x348a40[_0x2789('0x6')],_0x348a40['lastAssignedTo'],_0x348a40['calleridnum'],_0x348a40[_0x2789('0x7')],_0x348a40[_0x2789('0x8')]));if(_0x348a40[_0x2789('0x6')]){utils[_0x2789('0x9')](_0x348a40[_0x2789('0x6')])[_0x2789('0xa')](function(_0x5c86d2){if(_0x5c86d2){_0x348a40['type']=_0x5c86d2[_0x2789('0xb')];}utils[_0x2789('0xc')](_0x2789('0xd'),_0x348a40);});}else{utils['request'](_0x2789('0xd'),_0x348a40);}if(_0x348a40[_0x2789('0xe')]){delete queues[_0x348a40[_0x2789('0xe')]];}else{delete queues[_0x348a40[_0x2789('0x5')]];}}exports[_0x2789('0xf')]=function(_0x1c494b){try{utils[_0x2789('0x10')](util[_0x2789('0x3')]('[%s][queues][queuecallerjoin]',_0x1c494b[_0x2789('0x5')]),_0x1c494b);utils['info'](util[_0x2789('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1c494b[_0x2789('0x5')],_0x1c494b[_0x2789('0x6')],_0x1c494b[_0x2789('0x11')]));queues[_0x1c494b[_0x2789('0x5')]]=_['assign'](_0x1c494b,{'originalposition':_0x1c494b[_0x2789('0x11')],'queuecallerjoinAt':utils[_0x2789('0x12')](),'mohtime':0x0});}catch(_0x4f0301){utils[_0x2789('0x13')](util[_0x2789('0x3')]('[%s][queues][queuecallerjoin]',_0x1c494b['uniqueid']),_0x4f0301);}};exports['hangup']=function(_0x24bd61){try{if(!_[_0x2789('0x14')](queues[_0x24bd61['uniqueid']])){utils[_0x2789('0x10')](util[_0x2789('0x3')]('[%s][queues][hangup]',_0x24bd61['uniqueid']),_0x24bd61);if(queues[_0x24bd61['uniqueid']][_0x2789('0x15')]){if(!queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0x16')]&&!queues[_0x24bd61['uniqueid']][_0x2789('0x17')]){queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0x18')]=!![];queues[_0x24bd61[_0x2789('0x5')]]['queuecallercompleteAt']=utils[_0x2789('0x12')]();queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0x8')]='COMPLETEDBYAGENT';}utils[_0x2789('0x2')](util[_0x2789('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x24bd61[_0x2789('0x5')],queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0x19')],queues[_0x24bd61['uniqueid']][_0x2789('0x8')]));writeDB(queues[_0x24bd61[_0x2789('0x5')]]);}else if(queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0xe')]){utils[_0x2789('0x2')](util['format'](_0x2789('0x1a'),_0x24bd61[_0x2789('0x5')],queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0x19')],queues[_0x24bd61['uniqueid']]['transfereduniqueid']));queues[queues[_0x24bd61[_0x2789('0x5')]]['transfereduniqueid']]=queues[_0x24bd61[_0x2789('0x5')]];queues[queues[_0x24bd61[_0x2789('0x5')]][_0x2789('0xe')]][_0x2789('0x1b')]=0x2;delete queues[_0x24bd61[_0x2789('0x5')]];}}}catch(_0x5a9b0c){utils[_0x2789('0x13')](util['format']('[%s][queues][hangup]',_0x24bd61[_0x2789('0x5')]),_0x5a9b0c);}};exports['varset']=function(_0x3eba87){try{utils['debug'](util[_0x2789('0x3')](_0x2789('0x1c'),_0x3eba87['uniqueid']),_0x3eba87);if(!_['isNil'](_0x3eba87[_0x2789('0x1d')][_0x2789('0x1e')])&&_0x3eba87[_0x2789('0x1f')]['toUpperCase']()!==_0x2789('0x20')){if(!_['isNil'](queues[_0x3eba87[_0x2789('0x5')]])){queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x16')]=![];queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x21')]=null;queues[_0x3eba87[_0x2789('0x5')]]['queuecallerexit']=!![];queues[_0x3eba87['uniqueid']]['queuecallerexitAt']=utils[_0x2789('0x12')]();queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x8')]=_0x3eba87[_0x2789('0x1f')][_0x2789('0x22')]();utils['info'](util[_0x2789('0x3')](_0x2789('0x23'),_0x3eba87['uniqueid'],queues[_0x3eba87['uniqueid']][_0x2789('0x19')],_0x3eba87['value'],queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x8')]));writeDB(queues[_0x3eba87[_0x2789('0x5')]]);}}else if(!_[_0x2789('0x14')](_0x3eba87[_0x2789('0x1d')][_0x2789('0x24')])){if(!_[_0x2789('0x14')](queues[_0x3eba87[_0x2789('0x5')]])&&!queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x16')]){queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x16')]=![];queues[_0x3eba87['uniqueid']][_0x2789('0x21')]=null;queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x17')]=!![];queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x25')]=utils[_0x2789('0x12')]();queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x8')]='EXITWITHKEY';utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x26'),_0x3eba87[_0x2789('0x5')],queues[_0x3eba87[_0x2789('0x5')]][_0x2789('0x19')],_0x3eba87[_0x2789('0x1f')],queues[_0x3eba87['uniqueid']]['queuecallerexitreason']));}}}catch(_0x760cee){utils[_0x2789('0x13')](util[_0x2789('0x3')](_0x2789('0x1c'),_0x3eba87['uniqueid']),_0x760cee);}};exports[_0x2789('0x16')]=function(_0x33b977){try{if(!_['isNil'](queues[_0x33b977[_0x2789('0x5')]])){utils[_0x2789('0x10')](util['format'](_0x2789('0x27'),_0x33b977[_0x2789('0x5')]),_0x33b977);queues[_0x33b977['uniqueid']]['queuecallerexit']=![];queues[_0x33b977[_0x2789('0x5')]][_0x2789('0x25')]=null;queues[_0x33b977[_0x2789('0x5')]][_0x2789('0x16')]=!![];queues[_0x33b977['uniqueid']][_0x2789('0x21')]=utils['now']();queues[_0x33b977[_0x2789('0x5')]][_0x2789('0x8')]=_0x2789('0x28');utils[_0x2789('0x2')](util[_0x2789('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x33b977['uniqueid'],queues[_0x33b977[_0x2789('0x5')]][_0x2789('0x19')],queues[_0x33b977[_0x2789('0x5')]][_0x2789('0x8')]));}}catch(_0x18c86b){utils[_0x2789('0x13')](util[_0x2789('0x3')](_0x2789('0x27'),_0x33b977[_0x2789('0x5')]),_0x18c86b);}};exports[_0x2789('0x29')]=function(_0x1a4062){try{if(!_[_0x2789('0x14')](queues[_0x1a4062['uniqueid']])){utils[_0x2789('0x10')](util[_0x2789('0x3')](_0x2789('0x2a'),_0x1a4062[_0x2789('0x5')]),_0x1a4062);utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x2b'),_0x1a4062['uniqueid'],queues[_0x1a4062[_0x2789('0x5')]][_0x2789('0x19')],_0x1a4062[_0x2789('0x2c')],_0x1a4062[_0x2789('0x2d')]));queues[_0x1a4062[_0x2789('0x5')]]['queuecallerleave']=!![];queues[_0x1a4062[_0x2789('0x5')]]['queuecallerleaveAt']=utils[_0x2789('0x12')]();queues[_0x1a4062[_0x2789('0x5')]][_0x2789('0x2e')]=utils['diffTime'](queues[_0x1a4062[_0x2789('0x5')]][_0x2789('0x15')],queues[_0x1a4062[_0x2789('0x5')]][_0x2789('0x2f')]);queues[_0x1a4062['uniqueid']]['position']=_0x1a4062['position'];queues[_0x1a4062['uniqueid']][_0x2789('0x30')]=_0x1a4062[_0x2789('0x30')];queues[_0x1a4062[_0x2789('0x5')]]['connectedlinenum']=_0x1a4062['connectedlinenum'];queues[_0x1a4062['uniqueid']][_0x2789('0x2d')]=_0x1a4062[_0x2789('0x2d')];}}catch(_0x3cb2f5){utils[_0x2789('0x13')](util[_0x2789('0x3')](_0x2789('0x2a'),_0x1a4062['uniqueid']),_0x3cb2f5);}};exports[_0x2789('0x31')]=function(_0x23f500){try{if(!_[_0x2789('0x14')](queues[_0x23f500[_0x2789('0x5')]])){utils[_0x2789('0x10')](util['format'](_0x2789('0x32'),_0x23f500[_0x2789('0x5')]),_0x23f500);utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x33'),_0x23f500[_0x2789('0x5')],queues[_0x23f500[_0x2789('0x5')]]['name'],_0x23f500[_0x2789('0x34')],_0x23f500[_0x2789('0x35')]));queues[_0x23f500[_0x2789('0x5')]]['queuecallerabandon']=![];queues[_0x23f500[_0x2789('0x5')]]['queuecallerabandon']=![];queues[_0x23f500['uniqueid']][_0x2789('0x21')]=null;queues[_0x23f500[_0x2789('0x5')]][_0x2789('0x17')]=![];queues[_0x23f500[_0x2789('0x5')]][_0x2789('0x8')]=null;queues[_0x23f500['uniqueid']][_0x2789('0x25')]=null;queues[_0x23f500[_0x2789('0x5')]][_0x2789('0x36')]=!![];queues[_0x23f500['uniqueid']][_0x2789('0x7')]=_0x23f500[_0x2789('0x35')];queues[_0x23f500[_0x2789('0x5')]][_0x2789('0x37')]=_0x23f500[_0x2789('0x34')];}}catch(_0x320a47){utils[_0x2789('0x13')](util[_0x2789('0x3')]('[%s][queues][agentconnect]',_0x23f500[_0x2789('0x5')]),_0x320a47);}};exports[_0x2789('0x38')]=function(_0x213cac){try{if(!_[_0x2789('0x14')](queues[_0x213cac[_0x2789('0x5')]])){if(queues[_0x213cac[_0x2789('0x5')]]['queuecallerleaveAt']){utils[_0x2789('0x10')](util['format']('[%s][queues][agentcomplete]',_0x213cac[_0x2789('0x5')]),_0x213cac);queues[_0x213cac['uniqueid']][_0x2789('0x16')]=![];queues[_0x213cac[_0x2789('0x5')]][_0x2789('0x16')]=![];queues[_0x213cac['uniqueid']][_0x2789('0x21')]=null;queues[_0x213cac[_0x2789('0x5')]][_0x2789('0x17')]=![];queues[_0x213cac['uniqueid']][_0x2789('0x25')]=null;queues[_0x213cac['uniqueid']]['assigned']=!![];queues[_0x213cac[_0x2789('0x5')]]['lastAssignedTo']=_0x213cac[_0x2789('0x34')];queues[_0x213cac['uniqueid']][_0x2789('0x18')]=!![];queues[_0x213cac['uniqueid']][_0x2789('0x39')]=utils[_0x2789('0x12')]();if(_0x213cac[_0x2789('0x3a')]==_0x2789('0x3b')){if(!queues[_0x213cac[_0x2789('0x5')]][_0x2789('0x3b')]){queues[_0x213cac['uniqueid']]['queuecallerexitreason']=_0x2789('0x3c');}}else{queues[_0x213cac[_0x2789('0x5')]][_0x2789('0x8')]=_0x2789('0x3d')+_0x213cac[_0x2789('0x3a')]['toUpperCase']();}utils['info'](util[_0x2789('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x213cac[_0x2789('0x5')],queues[_0x213cac[_0x2789('0x5')]]['name'],_0x213cac[_0x2789('0x34')],queues[_0x213cac[_0x2789('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x213cac[_0x2789('0x5')]]);}}}catch(_0x1469f8){utils[_0x2789('0x13')](util[_0x2789('0x3')](_0x2789('0x3e'),_0x213cac[_0x2789('0x5')]),_0x1469f8);}};exports[_0x2789('0x3f')]=function(_0x24c5b5){try{if(!_[_0x2789('0x14')](queues[_0x24c5b5[_0x2789('0x40')]])){utils[_0x2789('0x10')](util['format']('[%s][queues][blindtransfer]',_0x24c5b5[_0x2789('0x5')]),_0x24c5b5);queues[_0x24c5b5['transfereeuniqueid']][_0x2789('0x3b')]=!![];queues[_0x24c5b5['transfereeuniqueid']][_0x2789('0x41')]=_0x2789('0x42');queues[_0x24c5b5[_0x2789('0x40')]][_0x2789('0x43')]=_0x24c5b5[_0x2789('0x44')];queues[_0x24c5b5['transfereeuniqueid']][_0x2789('0x45')]=_0x24c5b5[_0x2789('0x40')];queues[_0x24c5b5[_0x2789('0x40')]][_0x2789('0x8')]=_0x2789('0x46');utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x47'),_0x24c5b5['uniqueid'],queues[_0x24c5b5[_0x2789('0x40')]][_0x2789('0x19')],_0x24c5b5[_0x2789('0x40')],_0x24c5b5[_0x2789('0x44')]));}}catch(_0x40b9a0){utils[_0x2789('0x13')](util[_0x2789('0x3')]('[%s][queues][blindtransfer]',_0x24c5b5[_0x2789('0x5')]),_0x40b9a0);}};exports[_0x2789('0x48')]=function(_0x1631f3){try{utils['debug'](util[_0x2789('0x3')]('[%s][queues][attendedtransfer]',_0x1631f3[_0x2789('0x49')]),_0x1631f3);if(_0x1631f3[_0x2789('0x49')]==_0x1631f3[_0x2789('0x4a')]){if(!_['isNil'](queues[_0x1631f3[_0x2789('0x4b')]])){utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x4c'),_0x1631f3[_0x2789('0x49')],queues[_0x1631f3[_0x2789('0x4b')]][_0x2789('0x19')],_0x1631f3[_0x2789('0x4d')]));queues[_0x1631f3['secondtransfererlinkedid']][_0x2789('0x3b')]=!![];queues[_0x1631f3[_0x2789('0x4b')]][_0x2789('0x41')]=_0x2789('0x4e');queues[_0x1631f3['secondtransfererlinkedid']][_0x2789('0x43')]=_0x1631f3[_0x2789('0x4d')];queues[_0x1631f3[_0x2789('0x4b')]]['transferuniqueid']=_0x1631f3['origtransfereruniqueid'];queues[_0x1631f3[_0x2789('0x4b')]][_0x2789('0x8')]=_0x2789('0x4f');}if(!_[_0x2789('0x14')](queues[_0x1631f3[_0x2789('0x4a')]])){if(_0x1631f3[_0x2789('0x50')]&&queues[_0x1631f3['transfereelinkedid']]){queues[_0x1631f3[_0x2789('0x50')]]['queuecallerenterreason']=0x1;queues[_0x1631f3[_0x2789('0x40')]]=_[_0x2789('0x51')](queues[_0x1631f3[_0x2789('0x50')]]);queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0xe')]=_0x1631f3[_0x2789('0x52')];queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x1b')]=0x2;queues[_0x1631f3['transfereeuniqueid']]['calleridnum']=queues[_0x1631f3[_0x2789('0x4b')]][_0x2789('0x53')];queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x54')]=queues[_0x1631f3['secondtransfererlinkedid']][_0x2789('0x54')];queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x2f')]=utils[_0x2789('0x12')]();queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x15')]=utils[_0x2789('0x12')]();queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x2e')]=0x0;queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x55')]=0x0;utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x56'),_0x1631f3['origtransfereruniqueid'],queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x19')],queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x53')],queues[_0x1631f3[_0x2789('0x40')]][_0x2789('0x54')]));}else{utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x57'),_0x1631f3[_0x2789('0x49')],queues[_0x1631f3['origtransfererlinkedid']][_0x2789('0x19')],_0x1631f3[_0x2789('0x4b')]));queues[_0x1631f3['origtransfererlinkedid']]['transfereduniqueid']=_0x1631f3[_0x2789('0x4b')];}}}else if(_0x1631f3[_0x2789('0x58')]==_0x1631f3[_0x2789('0x4b')]){if(!_['isNil'](queues[_0x1631f3['origtransfererlinkedid']])){utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x59'),_0x1631f3['origtransfereruniqueid'],queues[_0x1631f3['origtransfererlinkedid']][_0x2789('0x19')],_0x1631f3[_0x2789('0x58')],_0x1631f3[_0x2789('0x5a')]));queues[_0x1631f3[_0x2789('0x4a')]][_0x2789('0x3b')]=!![];queues[_0x1631f3['origtransfererlinkedid']][_0x2789('0x41')]=_0x2789('0x4e');queues[_0x1631f3[_0x2789('0x4a')]][_0x2789('0x43')]=_0x1631f3[_0x2789('0x5a')];queues[_0x1631f3[_0x2789('0x4a')]][_0x2789('0x45')]=_0x1631f3[_0x2789('0x58')];queues[_0x1631f3[_0x2789('0x4a')]][_0x2789('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x2789('0x14')](queues[_0x1631f3[_0x2789('0x4b')]])){if(_0x1631f3[_0x2789('0x5b')]&&queues[_0x1631f3[_0x2789('0x5b')]]){queues[_0x1631f3[_0x2789('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x1631f3[_0x2789('0x52')]]=_[_0x2789('0x51')](queues[_0x1631f3['transfertargetlinkedid']]);queues[_0x1631f3[_0x2789('0x52')]]['transfereduniqueid']=_0x1631f3[_0x2789('0x52')];queues[_0x1631f3[_0x2789('0x52')]][_0x2789('0x1b')]=0x2;queues[_0x1631f3[_0x2789('0x52')]][_0x2789('0x53')]=queues[_0x1631f3[_0x2789('0x4a')]]['calleridnum'];queues[_0x1631f3[_0x2789('0x52')]][_0x2789('0x54')]=queues[_0x1631f3['origtransfererlinkedid']]['calleridname'];queues[_0x1631f3[_0x2789('0x52')]]['queuecallerjoinAt']=utils['now']();queues[_0x1631f3[_0x2789('0x52')]][_0x2789('0x15')]=utils[_0x2789('0x12')]();queues[_0x1631f3[_0x2789('0x52')]][_0x2789('0x2e')]=0x0;queues[_0x1631f3['transfertargetuniqueid']][_0x2789('0x55')]=0x0;utils[_0x2789('0x2')](util[_0x2789('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1631f3[_0x2789('0x49')],queues[_0x1631f3[_0x2789('0x52')]][_0x2789('0x19')],queues[_0x1631f3['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x1631f3['transfertargetuniqueid']][_0x2789('0x53')],queues[_0x1631f3['transfertargetuniqueid']][_0x2789('0x54')]));}else{utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x57'),_0x1631f3[_0x2789('0x49')],queues[_0x1631f3[_0x2789('0x4b')]][_0x2789('0x19')],_0x1631f3[_0x2789('0x4a')]));queues[_0x1631f3[_0x2789('0x4b')]][_0x2789('0xe')]=_0x1631f3[_0x2789('0x4a')];}}}}catch(_0x2d1088){utils['error'](util['format'](_0x2789('0x5c'),_0x1631f3[_0x2789('0x49')]),_0x2d1088);}};exports['musiconholdstart']=function(_0x1b41f6){try{if(!_[_0x2789('0x14')](queues[_0x1b41f6[_0x2789('0x5')]])){utils[_0x2789('0x10')](util[_0x2789('0x3')]('[%s][queues][musiconholdstart]',_0x1b41f6['uniqueid']),_0x1b41f6);queues[_0x1b41f6[_0x2789('0x5')]][_0x2789('0x5d')]=utils[_0x2789('0x12')]();utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x5e'),_0x1b41f6[_0x2789('0x5')],queues[_0x1b41f6[_0x2789('0x5')]][_0x2789('0x19')],queues[_0x1b41f6[_0x2789('0x5')]][_0x2789('0x5d')]));}}catch(_0x384869){utils[_0x2789('0x13')](util[_0x2789('0x3')](_0x2789('0x5f'),_0x1b41f6[_0x2789('0x5')]),_0x384869);}};exports[_0x2789('0x60')]=function(_0xabf05d){try{if(!_[_0x2789('0x14')](queues[_0xabf05d[_0x2789('0x5')]])){if(!_[_0x2789('0x14')](queues[_0xabf05d[_0x2789('0x5')]]['musiconholdstartAt'])){utils[_0x2789('0x10')](util['format'](_0x2789('0x61'),_0xabf05d[_0x2789('0x5')]),_0xabf05d);queues[_0xabf05d['uniqueid']][_0x2789('0x55')]+=utils[_0x2789('0x62')](utils[_0x2789('0x12')](),queues[_0xabf05d[_0x2789('0x5')]][_0x2789('0x5d')]);utils[_0x2789('0x2')](util[_0x2789('0x3')](_0x2789('0x63'),_0xabf05d[_0x2789('0x5')],queues[_0xabf05d['uniqueid']]['name'],queues[_0xabf05d[_0x2789('0x5')]]['mohtime']));delete queues[_0xabf05d[_0x2789('0x5')]][_0x2789('0x5d')];}}}catch(_0x27e26b){utils['error'](util[_0x2789('0x3')](_0x2789('0x61'),_0xabf05d[_0x2789('0x5')]),_0x27e26b);}}; \ No newline at end of file +var _0xe4d9=['[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','name','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerleaveAt','count','connectedlinename','agentconnect'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xe4d9,0x9b));var _0x9e4d=function(_0x1c71f8,_0x52799e){_0x1c71f8=_0x1c71f8-0x0;var _0x49a0a3=_0xe4d9[_0x1c71f8];return _0x49a0a3;};'use strict';var _=require('lodash');var util=require(_0x9e4d('0x0'));var utils=require(_0x9e4d('0x1'));var queues={};function writeDB(_0x1fa328){utils[_0x9e4d('0x2')](util['format'](_0x9e4d('0x3'),_0x1fa328['uniqueid'],_0x1fa328[_0x9e4d('0x4')],_0x1fa328[_0x9e4d('0x5')],_0x1fa328[_0x9e4d('0x6')],_0x1fa328[_0x9e4d('0x7')],_0x1fa328['accountcode'],_0x1fa328[_0x9e4d('0x8')]));if(_0x1fa328[_0x9e4d('0x5')]){utils[_0x9e4d('0x9')](_0x1fa328[_0x9e4d('0x5')])[_0x9e4d('0xa')](function(_0x1e189a){if(_0x1e189a){_0x1fa328[_0x9e4d('0xb')]=_0x1e189a[_0x9e4d('0xb')];}utils[_0x9e4d('0xc')]('CreateVoiceQueueReport',_0x1fa328);});}else{utils['request'](_0x9e4d('0xd'),_0x1fa328);}if(_0x1fa328[_0x9e4d('0xe')]){delete queues[_0x1fa328[_0x9e4d('0xe')]];}else{delete queues[_0x1fa328[_0x9e4d('0xf')]];}}exports[_0x9e4d('0x10')]=function(_0x260a7c){try{utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')]('[%s][queues][queuecallerjoin]',_0x260a7c[_0x9e4d('0xf')]),_0x260a7c);utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x260a7c[_0x9e4d('0xf')],_0x260a7c[_0x9e4d('0x5')],_0x260a7c[_0x9e4d('0x13')]));queues[_0x260a7c[_0x9e4d('0xf')]]=_['assign'](_0x260a7c,{'originalposition':_0x260a7c[_0x9e4d('0x13')],'queuecallerjoinAt':utils[_0x9e4d('0x14')](),'mohtime':0x0});}catch(_0x1bae64){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x16'),_0x260a7c[_0x9e4d('0xf')]),_0x1bae64);}};exports[_0x9e4d('0x17')]=function(_0x284ea9){try{if(!_[_0x9e4d('0x18')](queues[_0x284ea9[_0x9e4d('0xf')]])){utils[_0x9e4d('0x11')](util['format'](_0x9e4d('0x19'),_0x284ea9[_0x9e4d('0xf')]),_0x284ea9);if(queues[_0x284ea9[_0x9e4d('0xf')]]['queuecallerleaveAt']){if(!queues[_0x284ea9['uniqueid']]['queuecallerabandon']&&!queues[_0x284ea9['uniqueid']]['queuecallerexit']){queues[_0x284ea9[_0x9e4d('0xf')]]['queuecallercomplete']=!![];queues[_0x284ea9[_0x9e4d('0xf')]][_0x9e4d('0x1a')]=utils['now']();queues[_0x284ea9[_0x9e4d('0xf')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x1b'),_0x284ea9[_0x9e4d('0xf')],queues[_0x284ea9[_0x9e4d('0xf')]]['name'],queues[_0x284ea9['uniqueid']][_0x9e4d('0x8')]));writeDB(queues[_0x284ea9[_0x9e4d('0xf')]]);}else if(queues[_0x284ea9[_0x9e4d('0xf')]][_0x9e4d('0xe')]){utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x1c'),_0x284ea9[_0x9e4d('0xf')],queues[_0x284ea9[_0x9e4d('0xf')]]['name'],queues[_0x284ea9['uniqueid']][_0x9e4d('0xe')]));queues[queues[_0x284ea9['uniqueid']][_0x9e4d('0xe')]]=queues[_0x284ea9[_0x9e4d('0xf')]];queues[queues[_0x284ea9[_0x9e4d('0xf')]][_0x9e4d('0xe')]][_0x9e4d('0x1d')]=0x2;delete queues[_0x284ea9['uniqueid']];}}}catch(_0x1bb6b0){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')]('[%s][queues][hangup]',_0x284ea9[_0x9e4d('0xf')]),_0x1bb6b0);}};exports[_0x9e4d('0x1e')]=function(_0x1b784a){try{utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')]('[%s][queues][varset]',_0x1b784a[_0x9e4d('0xf')]),_0x1b784a);if(!_[_0x9e4d('0x18')](_0x1b784a[_0x9e4d('0x1f')][_0x9e4d('0x20')])&&_0x1b784a[_0x9e4d('0x21')][_0x9e4d('0x22')]()!==_0x9e4d('0x23')){if(!_[_0x9e4d('0x18')](queues[_0x1b784a[_0x9e4d('0xf')]])){queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x24')]=![];queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x25')]=null;queues[_0x1b784a['uniqueid']][_0x9e4d('0x26')]=!![];queues[_0x1b784a['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x8')]=_0x1b784a[_0x9e4d('0x21')]['toUpperCase']();utils['info'](util[_0x9e4d('0x12')](_0x9e4d('0x27'),_0x1b784a[_0x9e4d('0xf')],queues[_0x1b784a['uniqueid']]['name'],_0x1b784a[_0x9e4d('0x21')],queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x8')]));writeDB(queues[_0x1b784a[_0x9e4d('0xf')]]);}}else if(!_[_0x9e4d('0x18')](_0x1b784a['variable']['queueposition'])){if(!_[_0x9e4d('0x18')](queues[_0x1b784a['uniqueid']])&&!queues[_0x1b784a['uniqueid']][_0x9e4d('0x24')]){queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x24')]=![];queues[_0x1b784a[_0x9e4d('0xf')]]['queuecallerabandonAt']=null;queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x26')]=!![];queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x28')]=utils[_0x9e4d('0x14')]();queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x8')]=_0x9e4d('0x29');utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x2a'),_0x1b784a[_0x9e4d('0xf')],queues[_0x1b784a[_0x9e4d('0xf')]][_0x9e4d('0x2b')],_0x1b784a[_0x9e4d('0x21')],queues[_0x1b784a[_0x9e4d('0xf')]]['queuecallerexitreason']));}}}catch(_0x2b4c04){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x2c'),_0x1b784a[_0x9e4d('0xf')]),_0x2b4c04);}};exports[_0x9e4d('0x24')]=function(_0x2361af){try{if(!_[_0x9e4d('0x18')](queues[_0x2361af[_0x9e4d('0xf')]])){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')](_0x9e4d('0x2d'),_0x2361af[_0x9e4d('0xf')]),_0x2361af);queues[_0x2361af[_0x9e4d('0xf')]][_0x9e4d('0x26')]=![];queues[_0x2361af[_0x9e4d('0xf')]][_0x9e4d('0x28')]=null;queues[_0x2361af[_0x9e4d('0xf')]]['queuecallerabandon']=!![];queues[_0x2361af[_0x9e4d('0xf')]][_0x9e4d('0x25')]=utils[_0x9e4d('0x14')]();queues[_0x2361af[_0x9e4d('0xf')]]['queuecallerexitreason']=_0x9e4d('0x2e');utils[_0x9e4d('0x2')](util['format'](_0x9e4d('0x2f'),_0x2361af[_0x9e4d('0xf')],queues[_0x2361af['uniqueid']][_0x9e4d('0x2b')],queues[_0x2361af['uniqueid']]['queuecallerexitreason']));}}catch(_0x2bf154){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x2d'),_0x2361af['uniqueid']),_0x2bf154);}};exports[_0x9e4d('0x30')]=function(_0x45dc0b){try{if(!_[_0x9e4d('0x18')](queues[_0x45dc0b['uniqueid']])){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')](_0x9e4d('0x31'),_0x45dc0b[_0x9e4d('0xf')]),_0x45dc0b);utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x32'),_0x45dc0b[_0x9e4d('0xf')],queues[_0x45dc0b[_0x9e4d('0xf')]][_0x9e4d('0x2b')],_0x45dc0b[_0x9e4d('0x33')],_0x45dc0b['connectedlinename']));queues[_0x45dc0b[_0x9e4d('0xf')]]['queuecallerleave']=!![];queues[_0x45dc0b[_0x9e4d('0xf')]]['queuecallerleaveAt']=utils[_0x9e4d('0x14')]();queues[_0x45dc0b[_0x9e4d('0xf')]]['holdtime']=utils[_0x9e4d('0x34')](queues[_0x45dc0b['uniqueid']][_0x9e4d('0x35')],queues[_0x45dc0b['uniqueid']]['queuecallerjoinAt']);queues[_0x45dc0b[_0x9e4d('0xf')]][_0x9e4d('0x13')]=_0x45dc0b[_0x9e4d('0x13')];queues[_0x45dc0b[_0x9e4d('0xf')]][_0x9e4d('0x36')]=_0x45dc0b[_0x9e4d('0x36')];queues[_0x45dc0b['uniqueid']][_0x9e4d('0x33')]=_0x45dc0b[_0x9e4d('0x33')];queues[_0x45dc0b['uniqueid']]['connectedlinename']=_0x45dc0b[_0x9e4d('0x37')];}}catch(_0x5ecf71){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x31'),_0x45dc0b[_0x9e4d('0xf')]),_0x5ecf71);}};exports[_0x9e4d('0x38')]=function(_0x75cfcb){try{if(!_[_0x9e4d('0x18')](queues[_0x75cfcb['uniqueid']])){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')](_0x9e4d('0x39'),_0x75cfcb['uniqueid']),_0x75cfcb);utils[_0x9e4d('0x2')](util['format'](_0x9e4d('0x3a'),_0x75cfcb[_0x9e4d('0xf')],queues[_0x75cfcb[_0x9e4d('0xf')]][_0x9e4d('0x2b')],_0x75cfcb[_0x9e4d('0x3b')],_0x75cfcb['destaccountcode']));queues[_0x75cfcb[_0x9e4d('0xf')]]['queuecallerabandon']=![];queues[_0x75cfcb[_0x9e4d('0xf')]][_0x9e4d('0x24')]=![];queues[_0x75cfcb[_0x9e4d('0xf')]][_0x9e4d('0x25')]=null;queues[_0x75cfcb[_0x9e4d('0xf')]][_0x9e4d('0x26')]=![];queues[_0x75cfcb[_0x9e4d('0xf')]]['queuecallerexitreason']=null;queues[_0x75cfcb['uniqueid']]['queuecallerexitAt']=null;queues[_0x75cfcb[_0x9e4d('0xf')]][_0x9e4d('0x3c')]=!![];queues[_0x75cfcb[_0x9e4d('0xf')]][_0x9e4d('0x3d')]=_0x75cfcb['destaccountcode'];queues[_0x75cfcb[_0x9e4d('0xf')]]['lastAssignedTo']=_0x75cfcb[_0x9e4d('0x3b')];}}catch(_0x36c5aa){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x39'),_0x75cfcb['uniqueid']),_0x36c5aa);}};exports[_0x9e4d('0x3e')]=function(_0x36784d){try{if(!_[_0x9e4d('0x18')](queues[_0x36784d[_0x9e4d('0xf')]])){if(queues[_0x36784d['uniqueid']]['queuecallerleaveAt']){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')]('[%s][queues][agentcomplete]',_0x36784d['uniqueid']),_0x36784d);queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x24')]=![];queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x24')]=![];queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x25')]=null;queues[_0x36784d['uniqueid']][_0x9e4d('0x26')]=![];queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x28')]=null;queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x3c')]=!![];queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x6')]=_0x36784d[_0x9e4d('0x3b')];queues[_0x36784d['uniqueid']][_0x9e4d('0x3f')]=!![];queues[_0x36784d[_0x9e4d('0xf')]]['queuecallercompleteAt']=utils['now']();if(_0x36784d[_0x9e4d('0x40')]==_0x9e4d('0x41')){if(!queues[_0x36784d[_0x9e4d('0xf')]]['transfer']){queues[_0x36784d['uniqueid']]['queuecallerexitreason']=_0x9e4d('0x42');}}else{queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x8')]=_0x9e4d('0x43')+_0x36784d[_0x9e4d('0x40')][_0x9e4d('0x22')]();}utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x44'),_0x36784d['uniqueid'],queues[_0x36784d[_0x9e4d('0xf')]]['name'],_0x36784d[_0x9e4d('0x3b')],queues[_0x36784d[_0x9e4d('0xf')]][_0x9e4d('0x8')]));writeDB(queues[_0x36784d['uniqueid']]);}}}catch(_0x199b86){utils['error'](util[_0x9e4d('0x12')](_0x9e4d('0x45'),_0x36784d['uniqueid']),_0x199b86);}};exports['blindtransfer']=function(_0x5ada9c){try{if(!_[_0x9e4d('0x18')](queues[_0x5ada9c[_0x9e4d('0x46')]])){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')](_0x9e4d('0x47'),_0x5ada9c[_0x9e4d('0xf')]),_0x5ada9c);queues[_0x5ada9c[_0x9e4d('0x46')]][_0x9e4d('0x41')]=!![];queues[_0x5ada9c['transfereeuniqueid']]['transfertype']=_0x9e4d('0x48');queues[_0x5ada9c[_0x9e4d('0x46')]][_0x9e4d('0x49')]=_0x5ada9c['extension'];queues[_0x5ada9c['transfereeuniqueid']][_0x9e4d('0x4a')]=_0x5ada9c['transfereeuniqueid'];queues[_0x5ada9c[_0x9e4d('0x46')]][_0x9e4d('0x8')]=_0x9e4d('0x4b');utils[_0x9e4d('0x2')](util['format'](_0x9e4d('0x4c'),_0x5ada9c[_0x9e4d('0xf')],queues[_0x5ada9c['transfereeuniqueid']][_0x9e4d('0x2b')],_0x5ada9c[_0x9e4d('0x46')],_0x5ada9c[_0x9e4d('0x4d')]));}}catch(_0x5e11c9){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x47'),_0x5ada9c[_0x9e4d('0xf')]),_0x5e11c9);}};exports[_0x9e4d('0x4e')]=function(_0x242fdf){try{utils['debug'](util[_0x9e4d('0x12')]('[%s][queues][attendedtransfer]',_0x242fdf[_0x9e4d('0x4f')]),_0x242fdf);if(_0x242fdf['origtransfereruniqueid']==_0x242fdf[_0x9e4d('0x50')]){if(!_[_0x9e4d('0x18')](queues[_0x242fdf[_0x9e4d('0x51')]])){utils['info'](util[_0x9e4d('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x242fdf[_0x9e4d('0x4f')],queues[_0x242fdf['secondtransfererlinkedid']][_0x9e4d('0x2b')],_0x242fdf[_0x9e4d('0x52')]));queues[_0x242fdf['secondtransfererlinkedid']][_0x9e4d('0x41')]=!![];queues[_0x242fdf[_0x9e4d('0x51')]][_0x9e4d('0x53')]=_0x9e4d('0x54');queues[_0x242fdf[_0x9e4d('0x51')]][_0x9e4d('0x49')]=_0x242fdf[_0x9e4d('0x52')];queues[_0x242fdf['secondtransfererlinkedid']][_0x9e4d('0x4a')]=_0x242fdf[_0x9e4d('0x4f')];queues[_0x242fdf['secondtransfererlinkedid']][_0x9e4d('0x8')]=_0x9e4d('0x55');}if(!_[_0x9e4d('0x18')](queues[_0x242fdf[_0x9e4d('0x50')]])){if(_0x242fdf[_0x9e4d('0x56')]&&queues[_0x242fdf[_0x9e4d('0x56')]]){queues[_0x242fdf[_0x9e4d('0x56')]][_0x9e4d('0x1d')]=0x1;queues[_0x242fdf[_0x9e4d('0x46')]]=_[_0x9e4d('0x57')](queues[_0x242fdf[_0x9e4d('0x56')]]);queues[_0x242fdf['transfereeuniqueid']][_0x9e4d('0xe')]=_0x242fdf[_0x9e4d('0x58')];queues[_0x242fdf['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x242fdf[_0x9e4d('0x46')]]['calleridnum']=queues[_0x242fdf['secondtransfererlinkedid']][_0x9e4d('0x7')];queues[_0x242fdf['transfereeuniqueid']][_0x9e4d('0x59')]=queues[_0x242fdf[_0x9e4d('0x51')]][_0x9e4d('0x59')];queues[_0x242fdf['transfereeuniqueid']][_0x9e4d('0x5a')]=utils[_0x9e4d('0x14')]();queues[_0x242fdf[_0x9e4d('0x46')]][_0x9e4d('0x35')]=utils[_0x9e4d('0x14')]();queues[_0x242fdf[_0x9e4d('0x46')]][_0x9e4d('0x5b')]=0x0;queues[_0x242fdf[_0x9e4d('0x46')]][_0x9e4d('0x5c')]=0x0;utils[_0x9e4d('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x242fdf['origtransfereruniqueid'],queues[_0x242fdf[_0x9e4d('0x46')]]['name'],queues[_0x242fdf[_0x9e4d('0x46')]][_0x9e4d('0x7')],queues[_0x242fdf[_0x9e4d('0x46')]][_0x9e4d('0x59')]));}else{utils['info'](util[_0x9e4d('0x12')](_0x9e4d('0x5d'),_0x242fdf['origtransfereruniqueid'],queues[_0x242fdf['origtransfererlinkedid']][_0x9e4d('0x2b')],_0x242fdf[_0x9e4d('0x51')]));queues[_0x242fdf['origtransfererlinkedid']][_0x9e4d('0xe')]=_0x242fdf['secondtransfererlinkedid'];}}}else if(_0x242fdf[_0x9e4d('0x5e')]==_0x242fdf['secondtransfererlinkedid']){if(!_[_0x9e4d('0x18')](queues[_0x242fdf[_0x9e4d('0x50')]])){utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x5f'),_0x242fdf[_0x9e4d('0x4f')],queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x2b')],_0x242fdf[_0x9e4d('0x5e')],_0x242fdf[_0x9e4d('0x60')]));queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x41')]=!![];queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x53')]='ATTENDED';queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x49')]=_0x242fdf[_0x9e4d('0x60')];queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x4a')]=_0x242fdf[_0x9e4d('0x5e')];queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x8')]=_0x9e4d('0x55');}if(!_['isNil'](queues[_0x242fdf[_0x9e4d('0x51')]])){if(_0x242fdf[_0x9e4d('0x61')]&&queues[_0x242fdf[_0x9e4d('0x61')]]){queues[_0x242fdf['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x242fdf[_0x9e4d('0x58')]]=_[_0x9e4d('0x57')](queues[_0x242fdf[_0x9e4d('0x61')]]);queues[_0x242fdf[_0x9e4d('0x58')]][_0x9e4d('0xe')]=_0x242fdf[_0x9e4d('0x58')];queues[_0x242fdf[_0x9e4d('0x58')]][_0x9e4d('0x1d')]=0x2;queues[_0x242fdf[_0x9e4d('0x58')]]['calleridnum']=queues[_0x242fdf[_0x9e4d('0x50')]]['calleridnum'];queues[_0x242fdf['transfertargetuniqueid']]['calleridname']=queues[_0x242fdf[_0x9e4d('0x50')]][_0x9e4d('0x59')];queues[_0x242fdf[_0x9e4d('0x58')]]['queuecallerjoinAt']=utils[_0x9e4d('0x14')]();queues[_0x242fdf[_0x9e4d('0x58')]]['queuecallerleaveAt']=utils['now']();queues[_0x242fdf['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x242fdf[_0x9e4d('0x58')]][_0x9e4d('0x5c')]=0x0;utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x62'),_0x242fdf[_0x9e4d('0x4f')],queues[_0x242fdf[_0x9e4d('0x58')]][_0x9e4d('0x2b')],queues[_0x242fdf[_0x9e4d('0x58')]]['transfereduniqueid'],queues[_0x242fdf[_0x9e4d('0x58')]][_0x9e4d('0x7')],queues[_0x242fdf[_0x9e4d('0x58')]]['calleridname']));}else{utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x5d'),_0x242fdf[_0x9e4d('0x4f')],queues[_0x242fdf[_0x9e4d('0x51')]][_0x9e4d('0x2b')],_0x242fdf[_0x9e4d('0x50')]));queues[_0x242fdf[_0x9e4d('0x51')]][_0x9e4d('0xe')]=_0x242fdf[_0x9e4d('0x50')];}}}}catch(_0x22fb98){utils['error'](util['format']('[%s][queues][attendedtransfer]',_0x242fdf[_0x9e4d('0x4f')]),_0x22fb98);}};exports[_0x9e4d('0x63')]=function(_0x46a6f4){try{if(!_[_0x9e4d('0x18')](queues[_0x46a6f4['uniqueid']])){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')](_0x9e4d('0x64'),_0x46a6f4[_0x9e4d('0xf')]),_0x46a6f4);queues[_0x46a6f4[_0x9e4d('0xf')]][_0x9e4d('0x65')]=utils[_0x9e4d('0x14')]();utils[_0x9e4d('0x2')](util['format'](_0x9e4d('0x66'),_0x46a6f4[_0x9e4d('0xf')],queues[_0x46a6f4[_0x9e4d('0xf')]][_0x9e4d('0x2b')],queues[_0x46a6f4[_0x9e4d('0xf')]][_0x9e4d('0x65')]));}}catch(_0x2d8604){utils[_0x9e4d('0x15')](util[_0x9e4d('0x12')](_0x9e4d('0x64'),_0x46a6f4[_0x9e4d('0xf')]),_0x2d8604);}};exports[_0x9e4d('0x67')]=function(_0x217ec4){try{if(!_['isNil'](queues[_0x217ec4[_0x9e4d('0xf')]])){if(!_[_0x9e4d('0x18')](queues[_0x217ec4[_0x9e4d('0xf')]][_0x9e4d('0x65')])){utils[_0x9e4d('0x11')](util[_0x9e4d('0x12')](_0x9e4d('0x68'),_0x217ec4[_0x9e4d('0xf')]),_0x217ec4);queues[_0x217ec4['uniqueid']][_0x9e4d('0x5c')]+=utils[_0x9e4d('0x34')](utils['now'](),queues[_0x217ec4[_0x9e4d('0xf')]][_0x9e4d('0x65')]);utils[_0x9e4d('0x2')](util[_0x9e4d('0x12')](_0x9e4d('0x69'),_0x217ec4['uniqueid'],queues[_0x217ec4[_0x9e4d('0xf')]][_0x9e4d('0x2b')],queues[_0x217ec4[_0x9e4d('0xf')]][_0x9e4d('0x5c')]));delete queues[_0x217ec4[_0x9e4d('0xf')]][_0x9e4d('0x65')];}}}catch(_0x2505f3){utils['error'](util[_0x9e4d('0x12')](_0x9e4d('0x68'),_0x217ec4['uniqueid']),_0x2505f3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 75a10fa..be9b326 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 _0x9259=['[%s][recordings][newstate]','channelstate','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','error','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','newstate'];(function(_0x156e9b,_0x4fdea5){var _0x3b1772=function(_0x5274d5){while(--_0x5274d5){_0x156e9b['push'](_0x156e9b['shift']());}};_0x3b1772(++_0x4fdea5);}(_0x9259,0x1ee));var _0x9925=function(_0xef66ed,_0x1a5239){_0xef66ed=_0xef66ed-0x0;var _0xa14f66=_0x9259[_0xef66ed];return _0xa14f66;};'use strict';var _=require(_0x9925('0x0'));var util=require('util');var utils=require(_0x9925('0x1'));var transfers=require(_0x9925('0x2'));var recordings={};function writeDB(_0x12ed34){var _0x4cc353;utils[_0x9925('0x3')](util[_0x9925('0x4')](_0x9925('0x5'),_0x12ed34['uniqueid']));if(transfers['blinds'][_0x12ed34['uniqueid']]){_0x4cc353=_0x12ed34[_0x9925('0x6')];_0x12ed34[_0x9925('0x6')]=transfers[_0x9925('0x7')][_0x12ed34['uniqueid']][_0x9925('0x8')];}if(_0x12ed34[_0x9925('0x9')]){utils[_0x9925('0xa')](_0x12ed34[_0x9925('0x9')])[_0x9925('0xb')](function(_0x2b00f6){if(_0x2b00f6){_0x12ed34[_0x9925('0xc')]=_0x2b00f6[_0x9925('0xd')];_0x12ed34['UserId']=_0x2b00f6['id'];}utils[_0x9925('0xe')](_0x9925('0xf'),_0x12ed34);});}else{utils[_0x9925('0xe')](_0x9925('0xf'),_0x12ed34);}if(_0x4cc353)delete transfers[_0x9925('0x7')][_0x4cc353];}exports[_0x9925('0x10')]=function(_0x334a28){try{utils['debug'](util[_0x9925('0x4')](_0x9925('0x11'),_0x334a28['uniqueid']),_0x334a28);if(_0x334a28['uniqueid']==_0x334a28[_0x9925('0x12')]){utils[_0x9925('0x3')](util[_0x9925('0x4')](_0x9925('0x13'),_0x334a28[_0x9925('0x6')],_0x334a28['context'],_0x334a28[_0x9925('0x14')]));recordings[_0x334a28[_0x9925('0x6')]]={'uniqueid':_0x334a28[_0x9925('0x6')],'accountcode':_0x334a28[_0x9925('0x9')],'exten':_0x334a28['exten'],'context':_0x334a28[_0x9925('0x15')],'channel':_0x334a28[_0x9925('0x16')],'monitors':[]};}}catch(_0x3b1590){utils['error'](util[_0x9925('0x4')](_0x9925('0x11'),_0x334a28['uniqueid']),_0x3b1590);}};exports[_0x9925('0x17')]=function(_0x569f2a){try{utils['debug'](util[_0x9925('0x4')](_0x9925('0x18'),_0x569f2a[_0x9925('0x6')]),_0x569f2a);if(!_['isNil'](recordings[_0x569f2a['uniqueid']])&&_0x569f2a[_0x9925('0x19')]==0x6){utils[_0x9925('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x569f2a[_0x9925('0x6')],_0x569f2a[_0x9925('0x15')],_0x569f2a['channel']));}else if(!_[_0x9925('0x1a')](recordings[_0x569f2a[_0x9925('0x12')]])&&_0x569f2a[_0x9925('0x19')]==0x6&&_0x569f2a[_0x9925('0x15')]!=_0x9925('0x1b')){utils[_0x9925('0x3')](util[_0x9925('0x4')](_0x9925('0x1c'),_0x569f2a[_0x9925('0x6')],_0x569f2a[_0x9925('0x12')],_0x569f2a[_0x9925('0x15')],_0x569f2a[_0x9925('0x16')]));recordings[_0x569f2a[_0x9925('0x12')]][_0x9925('0x9')]=_0x569f2a['accountcode'];}}catch(_0x3e1f7d){utils['error'](util['format'](_0x9925('0x18'),_0x569f2a[_0x9925('0x6')]),_0x3e1f7d);}};exports[_0x9925('0x1d')]=function(_0x3b69e4){try{if(!_[_0x9925('0x1a')](_0x3b69e4[_0x9925('0x1e')])&&!_[_0x9925('0x1a')](_0x3b69e4[_0x9925('0x1e')]['mixmonitor_filename'])){utils[_0x9925('0x1f')](util[_0x9925('0x4')](_0x9925('0x20'),_0x3b69e4[_0x9925('0x6')]),_0x3b69e4);utils['info'](util[_0x9925('0x4')](_0x9925('0x21'),_0x3b69e4[_0x9925('0x6')],_0x3b69e4[_0x9925('0x1e')],_0x3b69e4[_0x9925('0x22')]));if(_[_0x9925('0x23')](_0x3b69e4[_0x9925('0x22')],_0x9925('0x24'))){_0x3b69e4[_0x9925('0x22')]=_0x3b69e4[_0x9925('0x22')][_0x9925('0x25')]('.wav49',_0x9925('0x26'));}if(recordings[_0x3b69e4[_0x9925('0x12')]]){var _0x236fdb=_[_0x9925('0x27')](recordings[_0x3b69e4[_0x9925('0x12')]][_0x9925('0x28')],{'value':_0x3b69e4[_0x9925('0x22')]});if(_[_0x9925('0x1a')](_0x236fdb)){recordings[_0x3b69e4['linkedid']][_0x9925('0x28')][_0x9925('0x29')]({'value':_0x3b69e4[_0x9925('0x22')]});}}}}catch(_0x127edf){utils[_0x9925('0x2a')](util[_0x9925('0x4')](_0x9925('0x20'),_0x3b69e4[_0x9925('0x6')]),_0x127edf);}};exports[_0x9925('0x2b')]=function(_0x39d079){try{if(!_[_0x9925('0x1a')](recordings[_0x39d079[_0x9925('0x6')]])){utils[_0x9925('0x1f')](util[_0x9925('0x4')](_0x9925('0x2c'),_0x39d079['uniqueid']),_0x39d079);utils['info'](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x39d079[_0x9925('0x6')],_0x39d079[_0x9925('0x2d')],_0x39d079[_0x9925('0x2e')],_0x39d079[_0x9925('0x2f')]));recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x2d')]=_0x39d079['calleridnum'];recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x2e')]=_0x39d079['calleridname'];recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x30')]=_0x39d079[_0x9925('0x30')];recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x31')]=_0x39d079[_0x9925('0x31')];if(recordings[_0x39d079['uniqueid']][_0x9925('0x32')]==_0x9925('0x33')&&recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x9')]){recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x30')]=recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x9')];recordings[_0x39d079['uniqueid']]['connectedlinename']='';}recordings[_0x39d079[_0x9925('0x6')]][_0x9925('0x28')]['forEach'](function(_0x13712e){var _0x1aca47=_[_0x9925('0x34')](recordings[_0x39d079[_0x9925('0x6')]]);_0x1aca47[_0x9925('0x22')]=_0x13712e[_0x9925('0x22')];writeDB(_0x1aca47);});delete recordings[_0x39d079[_0x9925('0x6')]];}}catch(_0x10ae9a){utils[_0x9925('0x2a')](util[_0x9925('0x4')](_0x9925('0x2c'),_0x39d079[_0x9925('0x6')]),_0x10ae9a);}};exports[_0x9925('0x35')]=function(_0x4cbc13){try{if(!_[_0x9925('0x1a')](recordings[_0x4cbc13['uniqueid']])){utils['debug'](util[_0x9925('0x4')](_0x9925('0x36'),_0x4cbc13[_0x9925('0x6')]),_0x4cbc13);utils['info'](util[_0x9925('0x4')](_0x9925('0x37'),_0x4cbc13[_0x9925('0x6')],_0x4cbc13['application'],_0x4cbc13[_0x9925('0x38')]));if(_0x4cbc13[_0x9925('0x39')]['toLowerCase']()==_0x9925('0x3a')&&_['startsWith'](_0x4cbc13[_0x9925('0x38')]['toLowerCase'](),_0x9925('0x3b'))){var _0x3f4aaf=_0x4cbc13[_0x9925('0x38')][_0x9925('0x3c')]('=');var _0x3059bc=_0x3f4aaf[0x0][_0x9925('0x3d')](_0x3f4aaf[0x0]['lastIndexOf']('(')+0x1,_0x3f4aaf[0x0][_0x9925('0x3e')](')'));var _0x17e040=_0x3f4aaf[0x1];recordings[_0x4cbc13[_0x9925('0x6')]][_0x3059bc]=_0x17e040;}}}catch(_0x4943a8){utils[_0x9925('0x2a')](util['format'](_0x9925('0x36'),_0x4cbc13[_0x9925('0x6')]),_0x4943a8);}};exports[_0x9925('0x3f')]=function(_0x2deb54){try{if(!_[_0x9925('0x1a')](recordings[_0x2deb54[_0x9925('0x6')]])){utils['debug'](util[_0x9925('0x4')](_0x9925('0x40'),_0x2deb54[_0x9925('0x6')]),_0x2deb54);utils['info'](util[_0x9925('0x4')](_0x9925('0x41'),_0x2deb54['uniqueid'],_0x2deb54[_0x9925('0x42')]));recordings[_0x2deb54[_0x9925('0x6')]][_0x9925('0x42')]=_0x2deb54[_0x9925('0x42')];}}catch(_0x5289fe){utils['error'](util[_0x9925('0x4')](_0x9925('0x40'),_0x2deb54['uniqueid']),_0x5289fe);}};exports[_0x9925('0x43')]=function(_0x41c99f){try{utils['debug'](util[_0x9925('0x4')](_0x9925('0x44'),_0x41c99f[_0x9925('0x6')]),_0x41c99f);utils[_0x9925('0x3')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x41c99f[_0x9925('0x6')],_0x41c99f[_0x9925('0x45')],_0x41c99f['transferercalleridname'],_0x41c99f[_0x9925('0x46')],_0x41c99f[_0x9925('0x47')]));if(recordings[_0x41c99f[_0x9925('0x48')]]&&transfers[_0x9925('0x7')][_0x41c99f['transfereruniqueid']]){transfers[_0x9925('0x7')][_0x41c99f[_0x9925('0x48')]][_0x9925('0x49')]=!![];}}catch(_0x11cd9d){utils[_0x9925('0x2a')](util[_0x9925('0x4')]('[%s][recordings][blindtransfer]',_0x41c99f['uniqueid']),_0x11cd9d);}}; \ No newline at end of file +var _0x9ce0=['[%s][recordings][blindtransfer]','lodash','util','./transfers.controller','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','linkedid','info','exten','context','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording'];(function(_0x3883df,_0x306f22){var _0x4706ab=function(_0x56ec3d){while(--_0x56ec3d){_0x3883df['push'](_0x3883df['shift']());}};_0x4706ab(++_0x306f22);}(_0x9ce0,0x97));var _0x09ce=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9ce0[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x09ce('0x0'));var util=require(_0x09ce('0x1'));var utils=require('./utils');var transfers=require(_0x09ce('0x2'));var recordings={};function writeDB(_0x48ae90){var _0x4d716c;utils['info'](util[_0x09ce('0x3')]('[%s][recordings][writeDB]',_0x48ae90[_0x09ce('0x4')]));if(transfers[_0x09ce('0x5')][_0x48ae90['uniqueid']]){_0x4d716c=_0x48ae90[_0x09ce('0x4')];_0x48ae90[_0x09ce('0x4')]=transfers['blinds'][_0x48ae90[_0x09ce('0x4')]][_0x09ce('0x6')];}if(_0x48ae90[_0x09ce('0x7')]){utils[_0x09ce('0x8')](_0x48ae90[_0x09ce('0x7')])[_0x09ce('0x9')](function(_0x40c1a3){if(_0x40c1a3){_0x48ae90[_0x09ce('0xa')]=_0x40c1a3[_0x09ce('0xb')];_0x48ae90['UserId']=_0x40c1a3['id'];}utils['request']('CreateVoiceRecording',_0x48ae90);});}else{utils[_0x09ce('0xc')](_0x09ce('0xd'),_0x48ae90);}if(_0x4d716c)delete transfers[_0x09ce('0x5')][_0x4d716c];}exports[_0x09ce('0xe')]=function(_0x51c4e5){try{utils[_0x09ce('0xf')](util[_0x09ce('0x3')]('[%s][recordings][newchannel]',_0x51c4e5[_0x09ce('0x4')]),_0x51c4e5);if(_0x51c4e5[_0x09ce('0x4')]==_0x51c4e5[_0x09ce('0x10')]){utils[_0x09ce('0x11')](util[_0x09ce('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x51c4e5[_0x09ce('0x4')],_0x51c4e5['context'],_0x51c4e5['exten']));recordings[_0x51c4e5[_0x09ce('0x4')]]={'uniqueid':_0x51c4e5[_0x09ce('0x4')],'accountcode':_0x51c4e5[_0x09ce('0x7')],'exten':_0x51c4e5[_0x09ce('0x12')],'context':_0x51c4e5[_0x09ce('0x13')],'channel':_0x51c4e5['channel'],'monitors':[]};}}catch(_0x29acb0){utils[_0x09ce('0x14')](util[_0x09ce('0x3')](_0x09ce('0x15'),_0x51c4e5[_0x09ce('0x4')]),_0x29acb0);}};exports[_0x09ce('0x16')]=function(_0x4db750){try{utils['debug'](util[_0x09ce('0x3')](_0x09ce('0x17'),_0x4db750[_0x09ce('0x4')]),_0x4db750);if(!_['isNil'](recordings[_0x4db750[_0x09ce('0x4')]])&&_0x4db750['channelstate']==0x6){utils['info'](util[_0x09ce('0x3')](_0x09ce('0x18'),_0x4db750[_0x09ce('0x4')],_0x4db750['context'],_0x4db750[_0x09ce('0x19')]));}else if(!_[_0x09ce('0x1a')](recordings[_0x4db750[_0x09ce('0x10')]])&&_0x4db750[_0x09ce('0x1b')]==0x6&&_0x4db750[_0x09ce('0x13')]!=_0x09ce('0x1c')){utils[_0x09ce('0x11')](util['format'](_0x09ce('0x1d'),_0x4db750[_0x09ce('0x4')],_0x4db750[_0x09ce('0x10')],_0x4db750[_0x09ce('0x13')],_0x4db750['channel']));recordings[_0x4db750['linkedid']][_0x09ce('0x7')]=_0x4db750[_0x09ce('0x7')];}}catch(_0x2461b1){utils[_0x09ce('0x14')](util['format'](_0x09ce('0x17'),_0x4db750[_0x09ce('0x4')]),_0x2461b1);}};exports[_0x09ce('0x1e')]=function(_0x11c671){try{if(!_['isNil'](_0x11c671[_0x09ce('0x1f')])&&!_[_0x09ce('0x1a')](_0x11c671[_0x09ce('0x1f')][_0x09ce('0x20')])){utils[_0x09ce('0xf')](util[_0x09ce('0x3')](_0x09ce('0x21'),_0x11c671['uniqueid']),_0x11c671);utils[_0x09ce('0x11')](util[_0x09ce('0x3')](_0x09ce('0x22'),_0x11c671[_0x09ce('0x4')],_0x11c671['variable'],_0x11c671[_0x09ce('0x23')]));if(_[_0x09ce('0x24')](_0x11c671['value'],_0x09ce('0x25'))){_0x11c671[_0x09ce('0x23')]=_0x11c671['value'][_0x09ce('0x26')]('.wav49',_0x09ce('0x27'));}if(recordings[_0x11c671[_0x09ce('0x10')]]){var _0x37cc39=_['find'](recordings[_0x11c671[_0x09ce('0x10')]][_0x09ce('0x28')],{'value':_0x11c671[_0x09ce('0x23')]});if(_['isNil'](_0x37cc39)){recordings[_0x11c671['linkedid']][_0x09ce('0x28')][_0x09ce('0x29')]({'value':_0x11c671[_0x09ce('0x23')]});}}}}catch(_0x3c6dbb){utils[_0x09ce('0x14')](util[_0x09ce('0x3')](_0x09ce('0x21'),_0x11c671[_0x09ce('0x4')]),_0x3c6dbb);}};exports[_0x09ce('0x2a')]=function(_0x177b3e){try{if(!_[_0x09ce('0x1a')](recordings[_0x177b3e['uniqueid']])){utils[_0x09ce('0xf')](util[_0x09ce('0x3')](_0x09ce('0x2b'),_0x177b3e['uniqueid']),_0x177b3e);utils[_0x09ce('0x11')](util[_0x09ce('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x177b3e[_0x09ce('0x4')],_0x177b3e[_0x09ce('0x2c')],_0x177b3e['calleridname'],_0x177b3e['cause-txt']));recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x2c')]=_0x177b3e['calleridnum'];recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x2d')]=_0x177b3e['calleridname'];recordings[_0x177b3e[_0x09ce('0x4')]]['connectedlinenum']=_0x177b3e[_0x09ce('0x2e')];recordings[_0x177b3e[_0x09ce('0x4')]]['connectedlinename']=_0x177b3e[_0x09ce('0x2f')];if(recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x30')]==_0x09ce('0x31')&&recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x7')]){recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x2e')]=recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x7')];recordings[_0x177b3e['uniqueid']][_0x09ce('0x2f')]='';}recordings[_0x177b3e[_0x09ce('0x4')]][_0x09ce('0x28')][_0x09ce('0x32')](function(_0x2da6a5){var _0x4c3ea7=_[_0x09ce('0x33')](recordings[_0x177b3e[_0x09ce('0x4')]]);_0x4c3ea7['value']=_0x2da6a5[_0x09ce('0x23')];writeDB(_0x4c3ea7);});delete recordings[_0x177b3e[_0x09ce('0x4')]];}}catch(_0x47cb76){utils[_0x09ce('0x14')](util[_0x09ce('0x3')](_0x09ce('0x2b'),_0x177b3e[_0x09ce('0x4')]),_0x47cb76);}};exports[_0x09ce('0x34')]=function(_0x5bb4b4){try{if(!_[_0x09ce('0x1a')](recordings[_0x5bb4b4['uniqueid']])){utils[_0x09ce('0xf')](util[_0x09ce('0x3')](_0x09ce('0x35'),_0x5bb4b4[_0x09ce('0x4')]),_0x5bb4b4);utils[_0x09ce('0x11')](util['format'](_0x09ce('0x36'),_0x5bb4b4['uniqueid'],_0x5bb4b4['application'],_0x5bb4b4[_0x09ce('0x37')]));if(_0x5bb4b4[_0x09ce('0x38')]['toLowerCase']()==_0x09ce('0x39')&&_[_0x09ce('0x3a')](_0x5bb4b4[_0x09ce('0x37')][_0x09ce('0x3b')](),_0x09ce('0x3c'))){var _0x1e03a8=_0x5bb4b4['appdata']['split']('=');var _0x2735ed=_0x1e03a8[0x0][_0x09ce('0x3d')](_0x1e03a8[0x0][_0x09ce('0x3e')]('(')+0x1,_0x1e03a8[0x0][_0x09ce('0x3e')](')'));var _0x3c8d6b=_0x1e03a8[0x1];recordings[_0x5bb4b4[_0x09ce('0x4')]][_0x2735ed]=_0x3c8d6b;}}}catch(_0x4770f2){utils['error'](util[_0x09ce('0x3')](_0x09ce('0x35'),_0x5bb4b4['uniqueid']),_0x4770f2);}};exports[_0x09ce('0x3f')]=function(_0x5a1c77){try{if(!_['isNil'](recordings[_0x5a1c77[_0x09ce('0x4')]])){utils['debug'](util[_0x09ce('0x3')](_0x09ce('0x40'),_0x5a1c77[_0x09ce('0x4')]),_0x5a1c77);utils[_0x09ce('0x11')](util[_0x09ce('0x3')](_0x09ce('0x41'),_0x5a1c77['uniqueid'],_0x5a1c77[_0x09ce('0x42')]));recordings[_0x5a1c77[_0x09ce('0x4')]][_0x09ce('0x42')]=_0x5a1c77[_0x09ce('0x42')];}}catch(_0x1201a2){utils[_0x09ce('0x14')](util[_0x09ce('0x3')](_0x09ce('0x40'),_0x5a1c77['uniqueid']),_0x1201a2);}};exports[_0x09ce('0x43')]=function(_0x218070){try{utils[_0x09ce('0xf')](util[_0x09ce('0x3')]('[%s][recordings][blindtransfer]',_0x218070[_0x09ce('0x4')]),_0x218070);utils[_0x09ce('0x11')](util[_0x09ce('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x218070[_0x09ce('0x4')],_0x218070[_0x09ce('0x44')],_0x218070[_0x09ce('0x45')],_0x218070[_0x09ce('0x46')],_0x218070[_0x09ce('0x47')]));if(recordings[_0x218070['transfereruniqueid']]&&transfers[_0x09ce('0x5')][_0x218070[_0x09ce('0x48')]]){transfers[_0x09ce('0x5')][_0x218070[_0x09ce('0x48')]][_0x09ce('0x49')]=!![];}}catch(_0x399bbd){utils[_0x09ce('0x14')](util[_0x09ce('0x3')](_0x09ce('0x4a'),_0x218070[_0x09ce('0x4')]),_0x399bbd);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 34292a8..3fc6c21 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 _0x9ad5=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info'];(function(_0x296174,_0x3e82a1){var _0x16ae68=function(_0x15c75e){while(--_0x15c75e){_0x296174['push'](_0x296174['shift']());}};_0x16ae68(++_0x3e82a1);}(_0x9ad5,0x7a));var _0x59ad=function(_0x2be434,_0x9ab164){_0x2be434=_0x2be434-0x0;var _0x2f9339=_0x9ad5[_0x2be434];return _0x2f9339;};'use strict';var _=require(_0x59ad('0x0'));var util=require(_0x59ad('0x1'));var utils=require(_0x59ad('0x2'));function writeDB(_0x2a5c83){utils[_0x59ad('0x3')](util[_0x59ad('0x4')](_0x59ad('0x5'),_0x2a5c83[_0x59ad('0x6')]===_0x59ad('0x7')?_0x2a5c83[_0x59ad('0x8')]:_0x2a5c83[_0x59ad('0x9')],_0x2a5c83[_0x59ad('0x6')]));utils[_0x59ad('0xa')](_0x59ad('0xb'),_0x2a5c83);}exports['blinds']={};exports['blindtransfer']=function(_0x249f23){try{utils['debug'](util[_0x59ad('0x4')](_0x59ad('0xc'),_0x249f23[_0x59ad('0x9')]),_0x249f23);utils[_0x59ad('0x3')](util[_0x59ad('0x4')](_0x59ad('0xd'),_0x249f23[_0x59ad('0x9')],_0x249f23['transferercalleridnum'],_0x249f23['transferercalleridname'],_0x249f23[_0x59ad('0xe')],_0x249f23[_0x59ad('0xf')]));_0x249f23[_0x59ad('0x6')]='blind';exports[_0x59ad('0x10')][_0x249f23[_0x59ad('0x11')]]=_0x249f23;writeDB(_0x249f23);}catch(_0x52e65a){utils['error'](util['format'](_0x59ad('0xc'),_0x249f23[_0x59ad('0x9')]),_0x52e65a);}};exports['attendedtransfer']=function(_0x13fe3e){try{utils[_0x59ad('0x12')](util[_0x59ad('0x4')](_0x59ad('0x13'),_0x13fe3e[_0x59ad('0x8')]),_0x13fe3e);utils[_0x59ad('0x3')](util[_0x59ad('0x4')](_0x59ad('0x14'),_0x13fe3e['origtransfereruniqueid'],_0x13fe3e[_0x59ad('0x15')],_0x13fe3e[_0x59ad('0x16')],_0x13fe3e[_0x59ad('0x17')],_0x13fe3e[_0x59ad('0x18')]));_0x13fe3e=_[_0x59ad('0x19')](_0x13fe3e,{'transfererchannel':_0x13fe3e['origtransfererchannel'],'transferercalleridnum':_0x13fe3e['origtransferercalleridnum'],'transferercalleridname':_0x13fe3e[_0x59ad('0x16')],'transfererconnectedlinenum':_0x13fe3e[_0x59ad('0x1a')],'transfererconnectedlinename':_0x13fe3e[_0x59ad('0x1b')],'transfereraccountcode':_0x13fe3e[_0x59ad('0x1c')],'transferercontext':_0x13fe3e[_0x59ad('0x1d')],'transfererexten':_0x13fe3e[_0x59ad('0x1e')],'transfererlinkedid':_0x13fe3e['origtransfererlinkedid'],'context':_0x13fe3e[_0x59ad('0x1f')],'extension':_0x13fe3e[_0x59ad('0x20')],'type':_0x59ad('0x7')});if(_[_0x59ad('0x21')](_0x13fe3e[_0x59ad('0x22')])){_0x13fe3e=_[_0x59ad('0x19')](_0x13fe3e,{'transfereechannel':_0x13fe3e[_0x59ad('0x23')],'transfereecalleridnum':_0x13fe3e[_0x59ad('0x17')],'transfereecalleridname':_0x13fe3e[_0x59ad('0x18')],'transfereeconnectedlinenum':_0x13fe3e[_0x59ad('0x24')],'transfereeconnectedlinename':_0x13fe3e[_0x59ad('0x25')],'transfereeaccountcode':_0x13fe3e[_0x59ad('0x26')],'transfereecontext':_0x13fe3e['transfertargetcontext'],'transfereeexten':_0x13fe3e[_0x59ad('0x27')],'transfereelinkedid':_0x13fe3e[_0x59ad('0x28')]});}writeDB(_0x13fe3e);}catch(_0x230716){utils[_0x59ad('0x29')](util[_0x59ad('0x4')](_0x59ad('0x13'),_0x13fe3e[_0x59ad('0x8')]),_0x230716);}}; \ No newline at end of file +var _0xca08=['format','uniqueid','transferercalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','lodash','./utils','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','info'];(function(_0x25eb9d,_0x44a89b){var _0x4cf557=function(_0x3f7c72){while(--_0x3f7c72){_0x25eb9d['push'](_0x25eb9d['shift']());}};_0x4cf557(++_0x44a89b);}(_0xca08,0x154));var _0x8ca0=function(_0x4c6f44,_0x413a03){_0x4c6f44=_0x4c6f44-0x0;var _0x5ee4b9=_0xca08[_0x4c6f44];return _0x5ee4b9;};'use strict';var _=require(_0x8ca0('0x0'));var util=require('util');var utils=require(_0x8ca0('0x1'));function writeDB(_0x2ba380){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x2ba380[_0x8ca0('0x2')]===_0x8ca0('0x3')?_0x2ba380[_0x8ca0('0x4')]:_0x2ba380['uniqueid'],_0x2ba380[_0x8ca0('0x2')]));utils[_0x8ca0('0x5')](_0x8ca0('0x6'),_0x2ba380);}exports['blinds']={};exports['blindtransfer']=function(_0x5876fb){try{utils[_0x8ca0('0x7')](util['format'](_0x8ca0('0x8'),_0x5876fb['uniqueid']),_0x5876fb);utils[_0x8ca0('0x9')](util[_0x8ca0('0xa')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5876fb[_0x8ca0('0xb')],_0x5876fb[_0x8ca0('0xc')],_0x5876fb['transferercalleridname'],_0x5876fb['transfereecalleridnum'],_0x5876fb[_0x8ca0('0xd')]));_0x5876fb[_0x8ca0('0x2')]=_0x8ca0('0xe');exports['blinds'][_0x5876fb['transfereruniqueid']]=_0x5876fb;writeDB(_0x5876fb);}catch(_0x428c9b){utils[_0x8ca0('0xf')](util['format'](_0x8ca0('0x8'),_0x5876fb['uniqueid']),_0x428c9b);}};exports['attendedtransfer']=function(_0x308afb){try{utils[_0x8ca0('0x7')](util[_0x8ca0('0xa')](_0x8ca0('0x10'),_0x308afb[_0x8ca0('0x4')]),_0x308afb);utils[_0x8ca0('0x9')](util[_0x8ca0('0xa')](_0x8ca0('0x11'),_0x308afb[_0x8ca0('0x4')],_0x308afb[_0x8ca0('0x12')],_0x308afb['origtransferercalleridname'],_0x308afb['transfertargetcalleridnum'],_0x308afb[_0x8ca0('0x13')]));_0x308afb=_[_0x8ca0('0x14')](_0x308afb,{'transfererchannel':_0x308afb['origtransfererchannel'],'transferercalleridnum':_0x308afb[_0x8ca0('0x12')],'transferercalleridname':_0x308afb[_0x8ca0('0x15')],'transfererconnectedlinenum':_0x308afb[_0x8ca0('0x16')],'transfererconnectedlinename':_0x308afb[_0x8ca0('0x17')],'transfereraccountcode':_0x308afb[_0x8ca0('0x18')],'transferercontext':_0x308afb[_0x8ca0('0x19')],'transfererexten':_0x308afb[_0x8ca0('0x1a')],'transfererlinkedid':_0x308afb['origtransfererlinkedid'],'context':_0x308afb['origtransferercontext'],'extension':_0x308afb[_0x8ca0('0x1b')],'type':_0x8ca0('0x3')});if(_['isNil'](_0x308afb[_0x8ca0('0x1c')])){_0x308afb=_[_0x8ca0('0x14')](_0x308afb,{'transfereechannel':_0x308afb[_0x8ca0('0x1d')],'transfereecalleridnum':_0x308afb[_0x8ca0('0x1e')],'transfereecalleridname':_0x308afb[_0x8ca0('0x13')],'transfereeconnectedlinenum':_0x308afb[_0x8ca0('0x1f')],'transfereeconnectedlinename':_0x308afb[_0x8ca0('0x20')],'transfereeaccountcode':_0x308afb['transfertargetaccountcode'],'transfereecontext':_0x308afb['transfertargetcontext'],'transfereeexten':_0x308afb[_0x8ca0('0x21')],'transfereelinkedid':_0x308afb[_0x8ca0('0x22')]});}writeDB(_0x308afb);}catch(_0x488b6f){utils[_0x8ca0('0xf')](util[_0x8ca0('0xa')](_0x8ca0('0x10'),_0x308afb[_0x8ca0('0x4')]),_0x488b6f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 346f773..06b7919 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 _0x5ef6=['util','client','http','../../config/logger','info','inspect','debug','error','then','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x5ef6,0xe8));var _0x65ef=function(_0x292e87,_0x9b2eb5){_0x292e87=_0x292e87-0x0;var _0x5186f6=_0x5ef6[_0x292e87];return _0x5186f6;};'use strict';var BPromise=require(_0x65ef('0x0'));var jayson=require(_0x65ef('0x1'));var moment=require(_0x65ef('0x2'));var util=require(_0x65ef('0x3'));var client=jayson[_0x65ef('0x4')][_0x65ef('0x5')]({'port':0x2329});var logger=require(_0x65ef('0x6'))('xdr');exports[_0x65ef('0x7')]=function(_0x3a4e52,_0x3f6148){logger[_0x65ef('0x7')](_0x3a4e52,_0x3f6148?util[_0x65ef('0x8')](_0x3f6148,{'showHidden':![],'depth':null}):'');};exports[_0x65ef('0x9')]=function(_0x33814c,_0x484eec){logger[_0x65ef('0x9')](_0x33814c,_0x484eec?util[_0x65ef('0x8')](_0x484eec,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3d05c6,_0x1ce248){logger[_0x65ef('0xa')](_0x3d05c6,_0x1ce248?util['inspect'](_0x1ce248,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x318932,_0x1cf0e9){return client['request'](_0x318932,{'body':_0x1cf0e9})[_0x65ef('0xb')](function(_0x586a88){logger[_0x65ef('0x9')](_0x65ef('0xc'),_0x318932,_0x586a88?util[_0x65ef('0x8')](_0x586a88,{'showHidden':![],'depth':null}):'');})[_0x65ef('0xd')](function(_0x5abd48){logger[_0x65ef('0xa')]('[utils][request]\x20name:%s',_0x318932,_0x5abd48?util['inspect'](_0x5abd48,{'showHidden':![],'depth':null}):'');});};function getUser(_0x52f4e6){return client[_0x65ef('0xe')](_0x65ef('0xf'),{'options':{'raw':!![],'attributes':['id',_0x65ef('0x10'),_0x65ef('0x11'),_0x65ef('0x12')],'where':_0x52f4e6,'limit':0x1}})['then'](function(_0x1a441c){logger['debug'](_0x65ef('0x13'),JSON[_0x65ef('0x14')](_0x52f4e6),_0x1a441c?util[_0x65ef('0x8')](_0x1a441c,{'showHidden':![],'depth':null}):'');return _0x1a441c[_0x65ef('0x15')][_0x65ef('0x16')]?_0x1a441c['result'][0x0]:null;});}exports[_0x65ef('0x17')]=function(_0x15cc8d){return new BPromise(function(_0xf1c8ba,_0x544be1){if(_0x15cc8d){return getUser({'internal':_0x15cc8d})[_0x65ef('0xb')](function(_0x2ce0a2){logger[_0x65ef('0x7')](_0x65ef('0x18'),_0x15cc8d,_0x2ce0a2?'found':_0x65ef('0x19'));return _0xf1c8ba(_0x2ce0a2);})[_0x65ef('0xd')](function(_0x4f0d96){logger[_0x65ef('0xa')](_0x65ef('0x1a'),_0x4f0d96?util['inspect'](_0x4f0d96,{'showHidden':![],'depth':null}):'');return _0xf1c8ba(null);});}return _0xf1c8ba(null);});};exports['getUserByInterface']=function(_0x2805b0){return new BPromise(function(_0x3a66d8,_0x32841b){if(_0x2805b0){return getUser({'interface':_0x2805b0})[_0x65ef('0xb')](function(_0x9b386a){logger['info'](_0x65ef('0x1b'),_0x2805b0,_0x9b386a?_0x65ef('0x1c'):_0x65ef('0x19'));return _0x3a66d8(_0x9b386a);})[_0x65ef('0xd')](function(_0x27a8f7){logger[_0x65ef('0xa')](_0x65ef('0x1d'),_0x27a8f7?util[_0x65ef('0x8')](_0x27a8f7,{'showHidden':![],'depth':null}):'');return _0x3a66d8(null);});}return _0x3a66d8(null);});};exports[_0x65ef('0x1e')]=function(_0x566724){return new BPromise(function(_0x46a7f3,_0x350ed6){if(_0x566724){return getUser({'name':_0x566724})[_0x65ef('0xb')](function(_0xaa1e17){logger[_0x65ef('0x7')](_0x65ef('0x1f'),_0x566724,_0xaa1e17?_0x65ef('0x1c'):_0x65ef('0x19'));return _0x46a7f3(_0xaa1e17);})[_0x65ef('0xd')](function(_0x31f78d){logger[_0x65ef('0xa')](_0x65ef('0x20'),_0x31f78d?util[_0x65ef('0x8')](_0x31f78d,{'showHidden':![],'depth':null}):'');return _0x46a7f3(null);});}return _0x46a7f3(null);});};exports['getVoiceQueueByName']=function(_0x4490e6){return new BPromise(function(_0x1af6ec,_0x31e277){if(_0x4490e6){return client[_0x65ef('0xe')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x65ef('0x11'),_0x65ef('0x21'),_0x65ef('0x22'),_0x65ef('0x23')],'where':{'name':_0x4490e6},'limit':0x1}})['then'](function(_0x5251b2){logger[_0x65ef('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4490e6,_0x5251b2?util['inspect'](_0x5251b2,{'showHidden':![],'depth':null}):'');logger[_0x65ef('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4490e6,_0x5251b2?_0x65ef('0x1c'):'notfound');return _0x1af6ec(_0x5251b2[_0x65ef('0x15')]['length']?_0x5251b2[_0x65ef('0x15')][0x0]:null);})[_0x65ef('0xd')](function(_0x1f26a1){logger[_0x65ef('0xa')]('[utils][getVoiceQueueByName]',_0x1f26a1?util[_0x65ef('0x8')](_0x1f26a1,{'showHidden':![],'depth':null}):'');return _0x1af6ec(null);});}return _0x1af6ec(null);});};exports[_0x65ef('0x24')]=function(_0x29b43a,_0xcda3d5){return moment(_0x29b43a)[_0x65ef('0x25')](_0xcda3d5,'seconds')[_0x65ef('0x26')](_0x65ef('0x27'));};exports[_0x65ef('0x28')]=function(_0x79620,_0x1a1f0f){return moment(_0x79620)['subtract'](_0x1a1f0f,_0x65ef('0x29'))[_0x65ef('0x26')](_0x65ef('0x27'));};exports[_0x65ef('0x2a')]=function(_0x2bed98,_0xee0ea){return moment(_0x2bed98)[_0x65ef('0x2b')](moment(_0xee0ea),_0x65ef('0x29'));};exports[_0x65ef('0x2c')]=function(_0xd467e3,_0x9d752f){return parseInt(_0xd467e3,0xa)+parseInt(_0x9d752f,0xa);};exports['now']=function(){return moment()['format'](_0x65ef('0x27'));};exports[_0x65ef('0x2d')]=function(_0x268a0c,_0x6f910f){if(_0x6f910f){return moment(_0x268a0c)['isAfter'](_0x6f910f);}return!![];};exports[_0x65ef('0x2e')]=function(_0x365ff4,_0x51e378){if(_0x51e378){return moment(_0x365ff4)[_0x65ef('0x2e')](_0x51e378);}else if(_0x365ff4){return!![];}return![];}; \ No newline at end of file +var _0x4b72=['xdr','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','found','notfound','getUserByInterface','info','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','now','format','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger'];(function(_0x5f6f4e,_0x2d4bcf){var _0x3b4f0b=function(_0x20073){while(--_0x20073){_0x5f6f4e['push'](_0x5f6f4e['shift']());}};_0x3b4f0b(++_0x2d4bcf);}(_0x4b72,0x1ea));var _0x24b7=function(_0x33a841,_0x1a1c82){_0x33a841=_0x33a841-0x0;var _0x52820f=_0x4b72[_0x33a841];return _0x52820f;};'use strict';var BPromise=require(_0x24b7('0x0'));var jayson=require(_0x24b7('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x24b7('0x2')][_0x24b7('0x3')]({'port':0x2329});var logger=require(_0x24b7('0x4'))(_0x24b7('0x5'));exports['info']=function(_0x148ce9,_0x45b6b3){logger['info'](_0x148ce9,_0x45b6b3?util[_0x24b7('0x6')](_0x45b6b3,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x56f1b9,_0x1e814f){logger[_0x24b7('0x7')](_0x56f1b9,_0x1e814f?util[_0x24b7('0x6')](_0x1e814f,{'showHidden':![],'depth':null}):'');};exports[_0x24b7('0x8')]=function(_0x17f74b,_0x10e86b){logger[_0x24b7('0x8')](_0x17f74b,_0x10e86b?util['inspect'](_0x10e86b,{'showHidden':![],'depth':null}):'');};exports[_0x24b7('0x9')]=function(_0x5a2f35,_0x9be556){return client[_0x24b7('0x9')](_0x5a2f35,{'body':_0x9be556})[_0x24b7('0xa')](function(_0x4ea0eb){logger['debug'](_0x24b7('0xb'),_0x5a2f35,_0x4ea0eb?util[_0x24b7('0x6')](_0x4ea0eb,{'showHidden':![],'depth':null}):'');})[_0x24b7('0xc')](function(_0x4765a4){logger[_0x24b7('0x8')](_0x24b7('0xb'),_0x5a2f35,_0x4765a4?util[_0x24b7('0x6')](_0x4765a4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1a845f){return client['request'](_0x24b7('0xd'),{'options':{'raw':!![],'attributes':['id',_0x24b7('0xe'),'name',_0x24b7('0xf')],'where':_0x1a845f,'limit':0x1}})['then'](function(_0x19a18b){logger[_0x24b7('0x7')](_0x24b7('0x10'),JSON[_0x24b7('0x11')](_0x1a845f),_0x19a18b?util[_0x24b7('0x6')](_0x19a18b,{'showHidden':![],'depth':null}):'');return _0x19a18b[_0x24b7('0x12')][_0x24b7('0x13')]?_0x19a18b[_0x24b7('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x23ab71){return new BPromise(function(_0x481b55,_0x457acd){if(_0x23ab71){return getUser({'internal':_0x23ab71})[_0x24b7('0xa')](function(_0x1e85c1){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x23ab71,_0x1e85c1?_0x24b7('0x14'):_0x24b7('0x15'));return _0x481b55(_0x1e85c1);})[_0x24b7('0xc')](function(_0x165d43){logger[_0x24b7('0x8')]('[utils][getUserByInternal]',_0x165d43?util['inspect'](_0x165d43,{'showHidden':![],'depth':null}):'');return _0x481b55(null);});}return _0x481b55(null);});};exports[_0x24b7('0x16')]=function(_0x146656){return new BPromise(function(_0x2e764f,_0x257de9){if(_0x146656){return getUser({'interface':_0x146656})[_0x24b7('0xa')](function(_0x2ead90){logger[_0x24b7('0x17')](_0x24b7('0x18'),_0x146656,_0x2ead90?'found':'notfound');return _0x2e764f(_0x2ead90);})[_0x24b7('0xc')](function(_0x2a5317){logger[_0x24b7('0x8')]('[utils][getUserByInterface]',_0x2a5317?util[_0x24b7('0x6')](_0x2a5317,{'showHidden':![],'depth':null}):'');return _0x2e764f(null);});}return _0x2e764f(null);});};exports[_0x24b7('0x19')]=function(_0x42f239){return new BPromise(function(_0x1536e5,_0x51fbad){if(_0x42f239){return getUser({'name':_0x42f239})[_0x24b7('0xa')](function(_0x140116){logger[_0x24b7('0x17')]('[utils][getUserByName]\x20name:%s\x20%s',_0x42f239,_0x140116?'found':_0x24b7('0x15'));return _0x1536e5(_0x140116);})[_0x24b7('0xc')](function(_0x1b2e9c){logger[_0x24b7('0x8')](_0x24b7('0x1a'),_0x1b2e9c?util['inspect'](_0x1b2e9c,{'showHidden':![],'depth':null}):'');return _0x1536e5(null);});}return _0x1536e5(null);});};exports[_0x24b7('0x1b')]=function(_0x1a621c){return new BPromise(function(_0x2906f9,_0x29133d){if(_0x1a621c){return client[_0x24b7('0x9')](_0x24b7('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x24b7('0x1d'),_0x24b7('0x1e'),_0x24b7('0x1f'),_0x24b7('0x20')],'where':{'name':_0x1a621c},'limit':0x1}})['then'](function(_0xb9fcfb){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x1a621c,_0xb9fcfb?util['inspect'](_0xb9fcfb,{'showHidden':![],'depth':null}):'');logger[_0x24b7('0x17')](_0x24b7('0x21'),_0x1a621c,_0xb9fcfb?_0x24b7('0x14'):'notfound');return _0x2906f9(_0xb9fcfb['result']['length']?_0xb9fcfb['result'][0x0]:null);})[_0x24b7('0xc')](function(_0x3d2c78){logger[_0x24b7('0x8')](_0x24b7('0x22'),_0x3d2c78?util[_0x24b7('0x6')](_0x3d2c78,{'showHidden':![],'depth':null}):'');return _0x2906f9(null);});}return _0x2906f9(null);});};exports[_0x24b7('0x23')]=function(_0x2efc24,_0x3932ef){return moment(_0x2efc24)[_0x24b7('0x24')](_0x3932ef,_0x24b7('0x25'))['format'](_0x24b7('0x26'));};exports['subtractTime']=function(_0x4e78da,_0x44153){return moment(_0x4e78da)[_0x24b7('0x27')](_0x44153,_0x24b7('0x25'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x508246,_0x3c74ad){return moment(_0x508246)[_0x24b7('0x28')](moment(_0x3c74ad),_0x24b7('0x25'));};exports['sumTime']=function(_0x46eaf2,_0x5a8748){return parseInt(_0x46eaf2,0xa)+parseInt(_0x5a8748,0xa);};exports[_0x24b7('0x29')]=function(){return moment()[_0x24b7('0x2a')](_0x24b7('0x26'));};exports[_0x24b7('0x2b')]=function(_0x20d0dc,_0x21ab01){if(_0x21ab01){return moment(_0x20d0dc)[_0x24b7('0x2b')](_0x21ab01);}return!![];};exports[_0x24b7('0x2c')]=function(_0x19b931,_0x1c95c7){if(_0x1c95c7){return moment(_0x19b931)[_0x24b7('0x2c')](_0x1c95c7);}else if(_0x19b931){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 d5ff6f3..07c3d88 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 _0x4e8f=['body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','name','inspect','use','%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)','connection','other','agent_name','test','setupLoggers','lodash','express-winston','path','util','fileLogger','./safe-template','./mask-sensitive-data','join','/var','log','xcally','client','role','then','catch','user','no-user','data','timestamp','error','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e8f,0x136));var _0xf4e8=function(_0x541486,_0x58b627){_0x541486=_0x541486-0x0;var _0xe75ae0=_0x4e8f[_0x541486];return _0xe75ae0;};var fs=require('fs-extra');var _=require(_0xf4e8('0x0'));var ewinston=require(_0xf4e8('0x1'));var path=require(_0xf4e8('0x2'));var util=require(_0xf4e8('0x3'));var fileLogger=require('./loggers')[_0xf4e8('0x4')];var safeTemplate=require(_0xf4e8('0x5'))['safeTemplate'];var maskSensitiveData=require(_0xf4e8('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x38e4b6(_0xac7fec){var _0x156053=path[_0xf4e8('0x7')](_0xf4e8('0x8'),_0xf4e8('0x9'),_0xf4e8('0xa'));var _0x330bb3=path['join'](_0xf4e8('0xb'),_0xac7fec[_0xf4e8('0xc')]+'-'+_0xac7fec['name']);return fs['ensureDir'](path[_0xf4e8('0x7')](_0x156053,_0x330bb3))[_0xf4e8('0xd')](function(){var _0x5065cc=fileLogger(_0xf4e8('0xb'),path[_0xf4e8('0x7')](_0x156053,_0x330bb3));return _0x5065cc;})[_0xf4e8('0xe')](function(_0x43c21e){throw _0x43c21e;});}this['log']=function(_0x21bb03,_0x333abd,_0xa48546,_0x435a42){return _0x38e4b6(_0x21bb03[_0xf4e8('0xf')])[_0xf4e8('0xd')](function(_0x2c4267){var _0x5e779d=_0x2c4267[_0x333abd];return _0x5e779d;})[_0xf4e8('0xd')](function(_0x1efb86){var _0x324286=_0x21bb03[_0xf4e8('0xf')]?_0x21bb03['user']['id']:_0xf4e8('0x10');var _0x4e4a9b=_0x435a42[_0xf4e8('0x11')];var _0x5d33fd=_0x435a42[_0xf4e8('0x12')];var _0x22d17d=new Date(Number(_0x5d33fd));return _0x1efb86(_0x324286,_0x22d17d,_0xa48546,_0x4e4a9b);})[_0xf4e8('0xe')](function(_0x15d7fb){fileLogger(_0xf4e8('0xb'))[_0xf4e8('0x13')](_0x15d7fb);});};}function setupLoggers(_0x3e6815){return new Promise(function(_0x95309){var _0x2351be=new ClientSideLogger();var _0x2bd850=fileLogger(_0xf4e8('0x14'));var _0x3a7dfb=fileLogger(_0xf4e8('0x15'));_0x3e6815['set'](_0xf4e8('0x16'),_0x2351be);_0x3e6815['use'](ewinston[_0xf4e8('0x17')]({'winstonInstance':_0x2bd850,'meta':![],'statusLevels':!![],'msg':function(_0x5aeeb8,_0x2b987a){var _0x40e4ec=_0xf4e8('0x18');if(!_[_0xf4e8('0x19')](_0x5aeeb8[_0xf4e8('0x1a')])){_0x40e4ec+=_0xf4e8('0x1b');var _0x1de5c7=_0x5aeeb8[_0xf4e8('0x1a')];maskSensitiveData(_0x1de5c7);}return safeTemplate(util[_0xf4e8('0x1c')](_0x40e4ec,_0x5aeeb8[_0xf4e8('0x1d')],_0x5aeeb8[_0xf4e8('0x1e')][_0xf4e8('0x1f')]?_0x5aeeb8[_0xf4e8('0x1e')][_0xf4e8('0x1f')]:_0x5aeeb8['connection'][_0xf4e8('0x20')]||_0x5aeeb8['ip'],_0x5aeeb8[_0xf4e8('0x21')],_0x2b987a[_0xf4e8('0x22')],_0x2b987a[_0xf4e8('0x23')],_0x5aeeb8[_0xf4e8('0xf')]?_0x5aeeb8[_0xf4e8('0xf')]['id']:null,_0x5aeeb8[_0xf4e8('0xf')]?_0x5aeeb8[_0xf4e8('0xf')][_0xf4e8('0x24')]:null,_0x5aeeb8[_0xf4e8('0xf')]?_0x5aeeb8[_0xf4e8('0xf')][_0xf4e8('0xc')]:null,_0x1de5c7?util[_0xf4e8('0x25')](_0x1de5c7,![],null):''));}}));_0x3e6815[_0xf4e8('0x26')](ewinston['logger']({'winstonInstance':_0x3a7dfb,'meta':![],'statusLevels':!![],'msg':function(_0x3210d2,_0x1e901a){var _0x307d71=_0xf4e8('0x27');if(_0x3210d2[_0xf4e8('0x1a')]&&_0x3210d2[_0xf4e8('0x1a')][_0xf4e8('0x28')]&&_0x3210d2[_0xf4e8('0x1a')][_0xf4e8('0x29')]){_0x307d71=_0xf4e8('0x2a');}return util[_0xf4e8('0x1c')](_0x307d71,_0x3210d2[_0xf4e8('0x1d')],_0x3210d2[_0xf4e8('0x1e')][_0xf4e8('0x1f')]?_0x3210d2['headers'][_0xf4e8('0x1f')]:_0x3210d2[_0xf4e8('0x2b')][_0xf4e8('0x20')]||_0x3210d2['ip'],_0x3210d2[_0xf4e8('0x21')],_0x1e901a[_0xf4e8('0x22')],_0x1e901a[_0xf4e8('0x23')],_0x3210d2[_0xf4e8('0xf')]?_0x3210d2['user']['id']:null,_0x3210d2[_0xf4e8('0xf')]?_0x3210d2[_0xf4e8('0xf')]['name']:null,_0x3210d2[_0xf4e8('0xf')]?_0x3210d2[_0xf4e8('0xf')]['role']:null,_0x3210d2[_0xf4e8('0x1a')]&&_0x3210d2[_0xf4e8('0x1a')]['device']?_0x3210d2['body'][_0xf4e8('0x28')]:_0xf4e8('0x2c'),_0x3210d2[_0xf4e8('0x1a')]&&_0x3210d2[_0xf4e8('0x1a')][_0xf4e8('0x29')]?_0x3210d2[_0xf4e8('0x1a')][_0xf4e8('0x29')]:'',_0x3210d2['body']&&_0x3210d2[_0xf4e8('0x1a')][_0xf4e8('0x2d')]?_0x3210d2[_0xf4e8('0x1a')][_0xf4e8('0x2d')]:'');},'ignoreRoute':function(_0x5c213c){var _0x1c200b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c200b[_0xf4e8('0x2e')](_0x5c213c['url']);}}));return _0x95309();});}exports[_0xf4e8('0x2f')]=setupLoggers; \ No newline at end of file +var _0x92c6=['fs-extra','lodash','express-winston','path','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','role','ensureDir','then','client','catch','user','no-user','timestamp','error','api','client-side-logger','use','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','responseTime','name','other','agent_name','test','setupLoggers'];(function(_0x82861,_0x546694){var _0x6ae5dc=function(_0x3736b1){while(--_0x3736b1){_0x82861['push'](_0x82861['shift']());}};_0x6ae5dc(++_0x546694);}(_0x92c6,0xeb));var _0x692c=function(_0xf94247,_0x179766){_0xf94247=_0xf94247-0x0;var _0x4d3653=_0x92c6[_0xf94247];return _0x4d3653;};var fs=require(_0x692c('0x0'));var _=require(_0x692c('0x1'));var ewinston=require(_0x692c('0x2'));var path=require(_0x692c('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0x692c('0x4')];var safeTemplate=require('./safe-template')[_0x692c('0x5')];var maskSensitiveData=require(_0x692c('0x6'))[_0x692c('0x7')];function ClientSideLogger(){function _0x4bdd93(_0x5c85a7){var _0x1dd2ea=path[_0x692c('0x8')](_0x692c('0x9'),_0x692c('0xa'),_0x692c('0xb'));var _0x108e7d=path[_0x692c('0x8')]('client',_0x5c85a7[_0x692c('0xc')]+'-'+_0x5c85a7['name']);return fs[_0x692c('0xd')](path[_0x692c('0x8')](_0x1dd2ea,_0x108e7d))[_0x692c('0xe')](function(){var _0xd2d060=fileLogger(_0x692c('0xf'),path[_0x692c('0x8')](_0x1dd2ea,_0x108e7d));return _0xd2d060;})[_0x692c('0x10')](function(_0x4414e4){throw _0x4414e4;});}this['log']=function(_0x6b2134,_0x460e42,_0x140d0f,_0x10fd80){return _0x4bdd93(_0x6b2134[_0x692c('0x11')])[_0x692c('0xe')](function(_0x4e8afa){var _0x326b06=_0x4e8afa[_0x460e42];return _0x326b06;})['then'](function(_0x511289){var _0x292946=_0x6b2134[_0x692c('0x11')]?_0x6b2134[_0x692c('0x11')]['id']:_0x692c('0x12');var _0x4c738f=_0x10fd80['data'];var _0x1fda76=_0x10fd80[_0x692c('0x13')];var _0x2a5433=new Date(Number(_0x1fda76));return _0x511289(_0x292946,_0x2a5433,_0x140d0f,_0x4c738f);})['catch'](function(_0x70b45e){fileLogger(_0x692c('0xf'))[_0x692c('0x14')](_0x70b45e);});};}function setupLoggers(_0x3ff4a3){return new Promise(function(_0x5aee98){var _0x493525=new ClientSideLogger();var _0x3db147=fileLogger(_0x692c('0x15'));var _0x529edf=fileLogger('auth');_0x3ff4a3['set'](_0x692c('0x16'),_0x493525);_0x3ff4a3[_0x692c('0x17')](ewinston['logger']({'winstonInstance':_0x3db147,'meta':![],'statusLevels':!![],'msg':function(_0x43fe81,_0x3dbe4b){var _0x3737bc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x692c('0x18')](_0x43fe81['body'])){_0x3737bc+=_0x692c('0x19');var _0x43e82c=_0x43fe81[_0x692c('0x1a')];maskSensitiveData(_0x43e82c);}return safeTemplate(util[_0x692c('0x1b')](_0x3737bc,_0x43fe81[_0x692c('0x1c')],_0x43fe81[_0x692c('0x1d')][_0x692c('0x1e')]?_0x43fe81[_0x692c('0x1d')]['x-forwarded-for']:_0x43fe81[_0x692c('0x1f')][_0x692c('0x20')]||_0x43fe81['ip'],_0x43fe81[_0x692c('0x21')],_0x3dbe4b['statusCode'],_0x3dbe4b['responseTime'],_0x43fe81[_0x692c('0x11')]?_0x43fe81[_0x692c('0x11')]['id']:null,_0x43fe81['user']?_0x43fe81['user']['name']:null,_0x43fe81[_0x692c('0x11')]?_0x43fe81['user'][_0x692c('0xc')]:null,_0x43e82c?util[_0x692c('0x22')](_0x43e82c,![],null):''));}}));_0x3ff4a3[_0x692c('0x17')](ewinston[_0x692c('0x23')]({'winstonInstance':_0x529edf,'meta':![],'statusLevels':!![],'msg':function(_0x4e4c0b,_0xd7084e){var _0x4360c7=_0x692c('0x24');if(_0x4e4c0b[_0x692c('0x1a')]&&_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x25')]&&_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x26')]){_0x4360c7=_0x692c('0x27');}return util[_0x692c('0x1b')](_0x4360c7,_0x4e4c0b[_0x692c('0x1c')],_0x4e4c0b['headers']['x-forwarded-for']?_0x4e4c0b[_0x692c('0x1d')]['x-forwarded-for']:_0x4e4c0b[_0x692c('0x1f')][_0x692c('0x20')]||_0x4e4c0b['ip'],_0x4e4c0b[_0x692c('0x21')],_0xd7084e[_0x692c('0x28')],_0xd7084e[_0x692c('0x29')],_0x4e4c0b[_0x692c('0x11')]?_0x4e4c0b['user']['id']:null,_0x4e4c0b[_0x692c('0x11')]?_0x4e4c0b[_0x692c('0x11')][_0x692c('0x2a')]:null,_0x4e4c0b[_0x692c('0x11')]?_0x4e4c0b['user'][_0x692c('0xc')]:null,_0x4e4c0b[_0x692c('0x1a')]&&_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x25')]?_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x25')]:_0x692c('0x2b'),_0x4e4c0b[_0x692c('0x1a')]&&_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x26')]?_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x26')]:'',_0x4e4c0b[_0x692c('0x1a')]&&_0x4e4c0b[_0x692c('0x1a')][_0x692c('0x2c')]?_0x4e4c0b['body'][_0x692c('0x2c')]:'');},'ignoreRoute':function(_0x356bf9){var _0x1b20f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1b20f3[_0x692c('0x2d')](_0x356bf9[_0x692c('0x21')]);}}));return _0x5aee98();});}exports[_0x692c('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 28a75ea..bd303d3 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eb7=['warn','Logger','transports','File','%s-%s','error','consoleLogger','fileLogger','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','{{{','meta','keys','length','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Console'];(function(_0x5725c1,_0x400b01){var _0x30a9e0=function(_0x36f329){while(--_0x36f329){_0x5725c1['push'](_0x5725c1['shift']());}};_0x30a9e0(++_0x400b01);}(_0x0eb7,0xcb));var _0x70eb=function(_0x4207e6,_0x1de576){_0x4207e6=_0x4207e6-0x0;var _0xaf5e7b=_0x0eb7[_0x4207e6];return _0xaf5e7b;};'use strict';var path=require('path');var util=require(_0x70eb('0x0'));var moment=require(_0x70eb('0x1'));var winston=require('winston');var config=require(_0x70eb('0x2'));var debugLevel=config[_0x70eb('0x3')]?config[_0x70eb('0x3')][_0x70eb('0x4')]():_0x70eb('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x70eb('0x6'),'error':_0x70eb('0x7'),'warn':_0x70eb('0x8'),'info':_0x70eb('0x9'),'print':'bold\x20white','success':_0x70eb('0xa'),'http':_0x70eb('0xb'),'verbose':_0x70eb('0xc'),'debug':_0x70eb('0xd'),'silly':_0x70eb('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1edf45,_0x118d02,_0x5eb5ff){var _0x3bbdde=_0x1edf45||_0x70eb('0xf');return path[_0x70eb('0x10')](_0x3bbdde,util[_0x70eb('0x11')](_0x70eb('0x12'),_0x118d02,_0x5eb5ff));}function formatter(_0x32db4d,_0x4ed648){_0x4ed648['message']=_0x4ed648[_0x70eb('0x13')][_0x70eb('0x14')](/@@{/g,'{{{')[_0x70eb('0x14')](/}@@/g,_0x70eb('0x15'))[_0x70eb('0x14')](/@{/g,'{{')[_0x70eb('0x14')](/}@/g,'}}');return util[_0x70eb('0x11')](_0x70eb('0x16'),moment()[_0x70eb('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4ed648[_0x70eb('0x17')]['toUpperCase'](),_0x32db4d,_0x4ed648[_0x70eb('0x13')]);}function fileFormat(_0x1ca729,_0x88a5ab){_0x88a5ab[_0x70eb('0x13')]=_0x88a5ab[_0x70eb('0x13')]['replace'](/@@{/g,_0x70eb('0x18'))[_0x70eb('0x14')](/}@@/g,_0x70eb('0x15'))['replace'](/@{/g,'{{')[_0x70eb('0x14')](/}@/g,'}}');var _0x223323=_0x88a5ab[_0x70eb('0x19')]&&Object[_0x70eb('0x1a')](_0x88a5ab[_0x70eb('0x19')])[_0x70eb('0x1b')]?'\x0a\x09'+JSON['stringify'](_0x88a5ab['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x70eb('0x11')](_0x70eb('0x1c')),_0x88a5ab[_0x70eb('0x17')][_0x70eb('0x1d')](),_0x1ca729,_0x88a5ab['message'],_0x223323);}function consoleLogger(){var _0xe8fe58=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x70eb('0x1e'))]({'level':_0x70eb('0x1f'),'json':![],'formatter':function(_0x1599ef){return formatter('',_0x1599ef);}})]});return _0xe8fe58;}function fileLogger(_0x3df122,_0x3fa211){var _0x34a05c=new winston[(_0x70eb('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x70eb('0x21'))][(_0x70eb('0x22'))]({'name':util['format'](_0x70eb('0x23'),_0x3df122,_0x70eb('0x24')),'filename':getLogFileName(_0x3fa211,_0x3df122,'error'),'level':_0x70eb('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38ea11){return fileFormat(_0x3df122,_0x38ea11);}}),new winston[(_0x70eb('0x21'))][(_0x70eb('0x22'))]({'name':util[_0x70eb('0x11')](_0x70eb('0x23'),_0x3df122,debugLevel),'filename':getLogFileName(_0x3fa211,_0x3df122,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x17d0f5){return fileFormat(_0x3df122,_0x17d0f5);}}),new winston[(_0x70eb('0x21'))][(_0x70eb('0x1e'))]({'level':_0x70eb('0x1f'),'json':![],'formatter':function(_0x5d4321){return fileFormat(_0x3df122,_0x5d4321);}})]});return _0x34a05c;}exports[_0x70eb('0x25')]=consoleLogger;exports[_0x70eb('0x26')]=fileLogger; \ No newline at end of file +var _0x45ec=['transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','path','util','../config/environment','debugLevel','toLowerCase','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger'];(function(_0x59af38,_0x8dbd6d){var _0x1f183e=function(_0x10cf05){while(--_0x10cf05){_0x59af38['push'](_0x59af38['shift']());}};_0x1f183e(++_0x8dbd6d);}(_0x45ec,0x120));var _0xc45e=function(_0x1f753a,_0x32cfa7){_0x1f753a=_0x1f753a-0x0;var _0x511472=_0x45ec[_0x1f753a];return _0x511472;};'use strict';var path=require(_0xc45e('0x0'));var util=require(_0xc45e('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0xc45e('0x2'));var debugLevel=config['debugLevel']?config[_0xc45e('0x3')][_0xc45e('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xc45e('0x5'),'warn':'bold\x20yellow','info':_0xc45e('0x6'),'print':_0xc45e('0x7'),'success':_0xc45e('0x8'),'http':_0xc45e('0x9'),'verbose':_0xc45e('0xa'),'debug':'bold\x20blue','silly':_0xc45e('0xb')};winston[_0xc45e('0xc')](XC_LOG_COLORS);function getLogFileName(_0x27eccb,_0x3476b1,_0x1e333f){var _0x4335c1=_0x27eccb||'/var/log/xcally';return path[_0xc45e('0xd')](_0x4335c1,util[_0xc45e('0xe')](_0xc45e('0xf'),_0x3476b1,_0x1e333f));}function formatter(_0x4be01b,_0x2d5c25){_0x2d5c25[_0xc45e('0x10')]=_0x2d5c25['message'][_0xc45e('0x11')](/@@{/g,_0xc45e('0x12'))[_0xc45e('0x11')](/}@@/g,_0xc45e('0x13'))[_0xc45e('0x11')](/@{/g,'{{')[_0xc45e('0x11')](/}@/g,'}}');return util[_0xc45e('0xe')](_0xc45e('0x14'),moment()[_0xc45e('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2d5c25[_0xc45e('0x15')]['toUpperCase'](),_0x4be01b,_0x2d5c25[_0xc45e('0x10')]);}function fileFormat(_0x5b597d,_0x371212){_0x371212[_0xc45e('0x10')]=_0x371212[_0xc45e('0x10')][_0xc45e('0x11')](/@@{/g,_0xc45e('0x12'))[_0xc45e('0x11')](/}@@/g,_0xc45e('0x13'))[_0xc45e('0x11')](/@{/g,'{{')[_0xc45e('0x11')](/}@/g,'}}');var _0x45871d=_0x371212[_0xc45e('0x16')]&&Object['keys'](_0x371212[_0xc45e('0x16')])[_0xc45e('0x17')]?'\x0a\x09'+JSON['stringify'](_0x371212[_0xc45e('0x16')]):'';return util[_0xc45e('0xe')](_0xc45e('0x18'),moment()['format'](_0xc45e('0x19')),_0x371212[_0xc45e('0x15')]['toUpperCase'](),_0x5b597d,_0x371212[_0xc45e('0x10')],_0x45871d);}function consoleLogger(){var _0x244ce8=new winston[(_0xc45e('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc45e('0x1b'))][(_0xc45e('0x1c'))]({'level':'warn','json':![],'formatter':function(_0x3883ed){return formatter('',_0x3883ed);}})]});return _0x244ce8;}function fileLogger(_0x3c505a,_0x9e88e6){var _0x58ec64=new winston[(_0xc45e('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc45e('0x1b'))][(_0xc45e('0x1d'))]({'name':util[_0xc45e('0xe')](_0xc45e('0x1e'),_0x3c505a,'error'),'filename':getLogFileName(_0x9e88e6,_0x3c505a,_0xc45e('0x1f')),'level':_0xc45e('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18a1ac){return fileFormat(_0x3c505a,_0x18a1ac);}}),new winston[(_0xc45e('0x1b'))][(_0xc45e('0x1d'))]({'name':util[_0xc45e('0xe')]('%s-%s',_0x3c505a,debugLevel),'filename':getLogFileName(_0x9e88e6,_0x3c505a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x27ae95){return fileFormat(_0x3c505a,_0x27ae95);}}),new winston['transports'][(_0xc45e('0x1c'))]({'level':_0xc45e('0x20'),'json':![],'formatter':function(_0x1a0bd1){return fileFormat(_0x3c505a,_0x1a0bd1);}})]});return _0x58ec64;}exports[_0xc45e('0x21')]=consoleLogger;exports[_0xc45e('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 0946f83..a75cf5c 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 _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(_0x4bb61f,_0x533ac6){var _0xe729f4=function(_0x303ffc){while(--_0x303ffc){_0x4bb61f['push'](_0x4bb61f['shift']());}};_0xe729f4(++_0x533ac6);}(_0xadb5,0xad));var _0x5adb=function(_0x28145d,_0x22a41e){_0x28145d=_0x28145d-0x0;var _0x1fd765=_0xadb5[_0x28145d];return _0x1fd765;};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 +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x1a85,0x178));var _0x51a8=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0x1a85[_0x421c56];return _0x49b244;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index bf84abb..826dab3 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 _0x6cb4=['keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x4baff4,_0xda812e){var _0x358871=function(_0x36d039){while(--_0x36d039){_0x4baff4['push'](_0x4baff4['shift']());}};_0x358871(++_0xda812e);}(_0x6cb4,0xff));var _0x46cb=function(_0x25fa8d,_0x3746e0){_0x25fa8d=_0x25fa8d-0x0;var _0x347073=_0x6cb4[_0x25fa8d];return _0x347073;};var _=require(_0x46cb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x338f2b){return _0x338f2b==='{{'?_0x46cb('0x1'):_0x46cb('0x2');}function safeTemplate(_0x375bef){var _0x36add6=_0x375bef;if(typeof _0x375bef===_0x46cb('0x3')){_0x36add6=_0x375bef[_0x46cb('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x46cb('0x5')](_0x375bef)){_0x36add6=_0x375bef['map'](function(_0x1a3fe4){return safeTemplate(_0x1a3fe4);});}else if(_['isPlainObject'](_0x375bef)){_0x36add6=Object[_0x46cb('0x6')](_0x375bef)['reduce'](function(_0x11262d,_0x148d0f){_0x11262d[_0x148d0f]=safeTemplate(_0x375bef[_0x148d0f]);return _0x11262d;},{});}return _0x36add6;}module[_0x46cb('0x7')][_0x46cb('0x8')]=safeTemplate; \ No newline at end of file +var _0xd7d1=['isArray','map','isPlainObject','keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x2b7521,_0x558dd3){var _0xc55f03=function(_0x88d478){while(--_0x88d478){_0x2b7521['push'](_0x2b7521['shift']());}};_0xc55f03(++_0x558dd3);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x11154e,_0x4a7f7b){_0x11154e=_0x11154e-0x0;var _0x133b5f=_0xd7d1[_0x11154e];return _0x133b5f;};var _=require(_0x1d7d('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x23f73c){return _0x23f73c==='{{'?_0x1d7d('0x1'):_0x1d7d('0x2');}function safeTemplate(_0x1d1926){var _0x3c3a27=_0x1d1926;if(typeof _0x1d1926===_0x1d7d('0x3')){_0x3c3a27=_0x1d1926[_0x1d7d('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x1d7d('0x5')](_0x1d1926)){_0x3c3a27=_0x1d1926[_0x1d7d('0x6')](function(_0x3c0839){return safeTemplate(_0x3c0839);});}else if(_[_0x1d7d('0x7')](_0x1d1926)){_0x3c3a27=Object[_0x1d7d('0x8')](_0x1d1926)['reduce'](function(_0x462ef8,_0x1aa456){_0x462ef8[_0x1aa456]=safeTemplate(_0x1d1926[_0x1aa456]);return _0x462ef8;},{});}return _0x3c3a27;}module[_0x1d7d('0x9')][_0x1d7d('0xa')]=safeTemplate; \ No newline at end of file